Index: lab4/.minix-src/include/c++/experimental/chrono
===================================================================
--- lab4/.minix-src/include/c++/experimental/chrono	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/chrono	(revision 13)
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//===------------------------------ chrono ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_CHRONO
+#define _LIBCPP_EXPERIMENTAL_CHRONO
+
+/**
+    experimental/chrono synopsis
+
+// C++1y
+
+#include <chrono>
+
+namespace std {
+namespace chrono {
+namespace experimental {
+inline namespace fundamentals_v1 {
+
+  // See C++14 20.12.4, customization traits
+  template <class Rep> constexpr bool treat_as_floating_point_v
+    = treat_as_floating_point<Rep>::value;
+
+} // namespace fundamentals_v1
+} // namespace experimental
+} // namespace chrono
+} // namespace std
+
+ */
+
+#include <experimental/__config>
+#include <chrono>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 11
+
+_LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS
+
+#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+
+template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
+    = treat_as_floating_point<_Rep>::value;
+
+#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
+
+_LIBCPP_END_NAMESPACE_CHRONO_LFTS
+
+#endif /* _LIBCPP_STD_VER > 11 */
+
+#endif /* _LIBCPP_EXPERIMENTAL_CHRONO */

Property changes on: lab4/.minix-src/include/c++/experimental/chrono
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/ext/__hash
===================================================================
--- lab4/.minix-src/include/c++/ext/__hash	(nonexistent)
+++ lab4/.minix-src/include/c++/ext/__hash	(revision 13)
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+//===------------------------- hash_set ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXT_HASH
+#define _LIBCPP_EXT_HASH
+
+#pragma GCC system_header
+
+#include <string>
+#include <cstring>
+
+namespace __gnu_cxx {
+using namespace std;
+
+template <typename _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash { };
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<const char*>
+    : public unary_function<const char*, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const char *__c) const _NOEXCEPT
+    {
+        return __do_string_hash(__c, __c + strlen(__c));
+    }
+};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char *>
+    : public unary_function<char*, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(char *__c) const _NOEXCEPT
+    {
+        return __do_string_hash<const char *>(__c, __c + strlen(__c));
+    }
+};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char>
+    : public unary_function<char, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(char __c) const _NOEXCEPT
+    {
+        return __c;
+    }
+};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<signed char>
+    : public unary_function<signed char, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(signed char __c) const _NOEXCEPT
+    {
+        return __c;
+    }
+};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned char>
+    : public unary_function<unsigned char, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(unsigned char __c) const _NOEXCEPT
+    {
+        return __c;
+    }
+};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<short>
+    : public unary_function<short, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(short __c) const _NOEXCEPT
+    {
+        return __c;
+    }
+};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned short>
+    : public unary_function<unsigned short, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(unsigned short __c) const _NOEXCEPT
+    {
+        return __c;
+    }
+};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<int>
+    : public unary_function<int, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(int __c) const _NOEXCEPT
+    {
+        return __c;
+    }
+};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned int>
+    : public unary_function<unsigned int, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(unsigned int __c) const _NOEXCEPT
+    {
+        return __c;
+    }
+};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<long>
+    : public unary_function<long, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(long __c) const _NOEXCEPT
+    {
+        return __c;
+    }
+};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned long>
+    : public unary_function<unsigned long, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(unsigned long __c) const _NOEXCEPT
+    {
+        return __c;
+    }
+};
+}
+
+#endif  // _LIBCPP_EXT_HASH

Property changes on: lab4/.minix-src/include/c++/ext/__hash
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/altq/if_altq.h
===================================================================
--- lab4/.minix-src/include/altq/if_altq.h	(nonexistent)
+++ lab4/.minix-src/include/altq/if_altq.h	(revision 13)
@@ -0,0 +1,177 @@
+/*	$NetBSD: if_altq.h,v 1.14 2014/07/01 10:16:02 ozaki-r Exp $	*/
+/*	$KAME: if_altq.h,v 1.12 2005/04/13 03:44:25 suz Exp $	*/
+
+/*
+ * Copyright (C) 1997-2003
+ *	Sony Computer Science Laboratories Inc.  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 SONY CSL AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _ALTQ_IF_ALTQ_H_
+#define	_ALTQ_IF_ALTQ_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_altq_enabled.h"
+#endif
+
+struct altq_pktattr; struct tb_regulator; struct top_cdnr;
+
+/*
+ * Structure defining a queue for a network interface.
+ */
+struct	ifaltq {
+	/* fields compatible with struct ifqueue */
+	struct	mbuf *ifq_head;
+	struct	mbuf *ifq_tail;
+	int	ifq_len;
+	int	ifq_maxlen;
+	int	ifq_drops;
+	kmutex_t	*ifq_lock;
+
+	/* alternate queueing related fields */
+	int	altq_type;		/* discipline type */
+	int	altq_flags;		/* flags (e.g. ready, in-use) */
+	void	*altq_disc;		/* for discipline-specific use */
+	struct	ifnet *altq_ifp;	/* back pointer to interface */
+
+	int	(*altq_enqueue)(struct ifaltq *, struct mbuf *,
+				struct altq_pktattr *);
+	struct	mbuf *(*altq_dequeue)(struct ifaltq *, int);
+	int	(*altq_request)(struct ifaltq *, int, void *);
+
+	/* classifier fields */
+	void	*altq_clfier;		/* classifier-specific use */
+	void	*(*altq_classify)(void *, struct mbuf *, int);
+
+	/* token bucket regulator */
+	struct	tb_regulator *altq_tbr;
+
+	/* input traffic conditioner (doesn't belong to the output queue...) */
+	struct top_cdnr *altq_cdnr;
+};
+
+
+#ifdef _KERNEL
+
+/*
+ * packet attributes used by queueing disciplines.
+ * pattr_class is a discipline-dependent scheduling class that is
+ * set by a classifier.
+ * pattr_hdr and pattr_af may be used by a discipline to access
+ * the header within a mbuf.  (e.g. ECN needs to update the CE bit)
+ * note that pattr_hdr could be stale after m_pullup, though link
+ * layer output routines usually don't use m_pullup.  link-level
+ * compression also invalidates these fields.  thus, pattr_hdr needs
+ * to be verified when a discipline touches the header.
+ */
+struct altq_pktattr {
+	void	*pattr_class;		/* sched class set by classifier */
+	int	pattr_af;		/* address family */
+	void *	pattr_hdr;		/* saved header position in mbuf */
+};
+
+/*
+ * mbuf tag to carry a queue id (and hints for ECN).
+ */
+struct altq_tag {
+	u_int32_t	qid;		/* queue id */
+	/* hints for ecn */
+	int		af;		/* address family */
+	void		*hdr;		/* saved header position in mbuf */
+};
+
+/*
+ * a token-bucket regulator limits the rate that a network driver can
+ * dequeue packets from the output queue.
+ * modern cards are able to buffer a large amount of packets and dequeue
+ * too many packets at a time.  this bursty dequeue behavior makes it
+ * impossible to schedule packets by queueing disciplines.
+ * a token-bucket is used to control the burst size in a device
+ * independent manner.
+ */
+struct tb_regulator {
+	int64_t		tbr_rate;	/* (scaled) token bucket rate */
+	int64_t		tbr_depth;	/* (scaled) token bucket depth */
+
+	int64_t		tbr_token;	/* (scaled) current token */
+	int64_t		tbr_filluptime;	/* (scaled) time to fill up bucket */
+	u_int64_t	tbr_last;	/* last time token was updated */
+
+	int		tbr_lastop;	/* last dequeue operation type
+					   needed for poll-and-dequeue */
+};
+
+/* if_altqflags */
+#define	ALTQF_READY	 0x01	/* driver supports alternate queueing */
+#define	ALTQF_ENABLED	 0x02	/* altq is in use */
+#define	ALTQF_CLASSIFY	 0x04	/* classify packets */
+#define	ALTQF_CNDTNING	 0x08	/* altq traffic conditioning is enabled */
+#define	ALTQF_DRIVER1	 0x40	/* driver specific */
+
+/* if_altqflags set internally only: */
+#define	ALTQF_CANTCHANGE 	(ALTQF_READY)
+
+/* altq_dequeue 2nd arg */
+#define	ALTDQ_REMOVE		1	/* dequeue mbuf from the queue */
+#define	ALTDQ_POLL		2	/* don't dequeue mbuf from the queue */
+
+/* altq request types (currently only purge is defined) */
+#define	ALTRQ_PURGE		1	/* purge all packets */
+
+#define	ALTQ_IS_READY(ifq)		((ifq)->altq_flags & ALTQF_READY)
+#define	ALTQ_IS_ENABLED(ifq)		((ifq)->altq_flags & ALTQF_ENABLED)
+#define	ALTQ_NEEDS_CLASSIFY(ifq)	((ifq)->altq_flags & ALTQF_CLASSIFY)
+#define	ALTQ_IS_CNDTNING(ifq)		((ifq)->altq_flags & ALTQF_CNDTNING)
+
+#define	ALTQ_SET_CNDTNING(ifq)		((ifq)->altq_flags |= ALTQF_CNDTNING)
+#define	ALTQ_CLEAR_CNDTNING(ifq)	((ifq)->altq_flags &= ~ALTQF_CNDTNING)
+#define	ALTQ_IS_ATTACHED(ifq)		((ifq)->altq_disc != NULL)
+
+#define	ALTQ_ENQUEUE(ifq, m, pa, err)					\
+	(err) = (*(ifq)->altq_enqueue)((ifq),(m),(pa))
+#define	ALTQ_DEQUEUE(ifq, m)						\
+	(m) = (*(ifq)->altq_dequeue)((ifq), ALTDQ_REMOVE)
+#define	ALTQ_POLL(ifq, m)						\
+	(m) = (*(ifq)->altq_dequeue)((ifq), ALTDQ_POLL)
+#define	ALTQ_PURGE(ifq)							\
+	(void)(*(ifq)->altq_request)((ifq), ALTRQ_PURGE, (void *)0)
+#define	ALTQ_IS_EMPTY(ifq)		((ifq)->ifq_len == 0)
+#define	TBR_IS_ENABLED(ifq)		((ifq)->altq_tbr != NULL)
+
+extern int altq_attach(struct ifaltq *, int, void *,
+		       int (*)(struct ifaltq *, struct mbuf *,
+			       struct altq_pktattr *),
+		       struct mbuf *(*)(struct ifaltq *, int),
+		       int (*)(struct ifaltq *, int, void *),
+		       void *,
+		       void *(*)(void *, struct mbuf *, int));
+extern int altq_detach(struct ifaltq *);
+extern int altq_enable(struct ifaltq *);
+extern int altq_disable(struct ifaltq *);
+extern struct mbuf *tbr_dequeue(struct ifaltq *, int);
+extern int (*altq_input)(struct mbuf *, int);
+#if 1 /* ALTQ3_CLFIER_COMPAT */
+void altq_etherclassify(struct ifaltq *, struct mbuf *, struct altq_pktattr *);
+#endif
+#endif /* _KERNEL */
+
+#endif /* _ALTQ_IF_ALTQ_H_ */

Property changes on: lab4/.minix-src/include/altq/if_altq.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/experimental/optional
===================================================================
--- lab4/.minix-src/include/c++/experimental/optional	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/optional	(revision 13)
@@ -0,0 +1,894 @@
+// -*- C++ -*-
+//===-------------------------- optional ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_OPTIONAL
+#define _LIBCPP_OPTIONAL
+
+/*
+    optional synopsis
+
+// C++1y
+
+namespace std { namespace experimental { inline namespace fundamentals_v1 {
+
+    // 5.3, optional for object types
+    template <class T> class optional;
+
+    // 5.4, In-place construction
+    struct in_place_t{};
+    constexpr in_place_t in_place{};
+
+    // 5.5, No-value state indicator
+    struct nullopt_t{see below};
+    constexpr nullopt_t nullopt(unspecified);
+
+    // 5.6, Class bad_optional_access
+    class bad_optional_access;
+
+    // 5.7, Relational operators
+    template <class T>
+      constexpr bool operator==(const optional<T>&, const optional<T>&);
+    template <class T>
+      constexpr bool operator!=(const optional<T>&, const optional<T>&);
+    template <class T>
+      constexpr bool operator<(const optional<T>&, const optional<T>&);
+    template <class T>
+      constexpr bool operator>(const optional<T>&, const optional<T>&);
+    template <class T>
+      constexpr bool operator<=(const optional<T>&, const optional<T>&);
+    template <class T>
+      constexpr bool operator>=(const optional<T>&, const optional<T>&);
+
+    // 5.8, Comparison with nullopt
+    template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
+    template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
+    template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
+    template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;
+    template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
+    template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
+    template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;
+    template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
+    template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;
+    template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
+    template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
+    template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
+
+    // 5.9, Comparison with T
+    template <class T> constexpr bool operator==(const optional<T>&, const T&);
+    template <class T> constexpr bool operator==(const T&, const optional<T>&);
+    template <class T> constexpr bool operator!=(const optional<T>&, const T&);
+    template <class T> constexpr bool operator!=(const T&, const optional<T>&);
+    template <class T> constexpr bool operator<(const optional<T>&, const T&);
+    template <class T> constexpr bool operator<(const T&, const optional<T>&);
+    template <class T> constexpr bool operator<=(const optional<T>&, const T&);
+    template <class T> constexpr bool operator<=(const T&, const optional<T>&);
+    template <class T> constexpr bool operator>(const optional<T>&, const T&);
+    template <class T> constexpr bool operator>(const T&, const optional<T>&);
+    template <class T> constexpr bool operator>=(const optional<T>&, const T&);
+    template <class T> constexpr bool operator>=(const T&, const optional<T>&);
+
+    // 5.10, Specialized algorithms
+    template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);
+    template <class T> constexpr optional<see below> make_optional(T&&);
+
+	template <class T>
+	class optional
+	{
+	public:
+	  typedef T value_type;
+
+	  // 5.3.1, Constructors
+	  constexpr optional() noexcept;
+	  constexpr optional(nullopt_t) noexcept;
+	  optional(const optional&);
+	  optional(optional&&) noexcept(see below);
+	  constexpr optional(const T&);
+	  constexpr optional(T&&);
+	  template <class... Args> constexpr explicit optional(in_place_t, Args&&...);
+	  template <class U, class... Args>
+		constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...);
+
+	  // 5.3.2, Destructor
+	  ~optional();
+
+	  // 5.3.3, Assignment
+	  optional& operator=(nullopt_t) noexcept;
+	  optional& operator=(const optional&);
+	  optional& operator=(optional&&) noexcept(see below);
+	  template <class U> optional& operator=(U&&);
+	  template <class... Args> void emplace(Args&&...);
+	  template <class U, class... Args>
+		void emplace(initializer_list<U>, Args&&...);
+
+	  // 5.3.4, Swap
+	  void swap(optional&) noexcept(see below);
+
+	  // 5.3.5, Observers
+	  constexpr T const* operator ->() const;
+	  constexpr T* operator ->();
+	  constexpr T const& operator *() const &;
+	  constexpr T& operator *() &;
+	  constexpr T&& operator *() &&;
+	  constexpr const T&& operator *() const &&;
+	  constexpr explicit operator bool() const noexcept;
+	  constexpr T const& value() const &;
+	  constexpr T& value() &;
+	  constexpr T&& value() &&;
+	  constexpr const T&& value() const &&;
+	  template <class U> constexpr T value_or(U&&) const &;
+	  template <class U> constexpr T value_or(U&&) &&;
+
+	private:
+	  T*   val;  // exposition only
+	};
+
+  } // namespace fundamentals_v1
+  } // namespace experimental
+
+  // 5.11, Hash support
+  template <class T> struct hash;
+  template <class T> struct hash<experimental::optional<T>>;
+
+} // namespace std
+
+*/
+
+#include <experimental/__config>
+#include <functional>
+#include <stdexcept>
+
+_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
+class _LIBCPP_EXCEPTION_ABI bad_optional_access
+    : public std::logic_error
+{
+public:
+	bad_optional_access() : std::logic_error("Bad optional Access") {}
+
+//	Get the key function ~bad_optional_access() into the dylib
+    virtual ~bad_optional_access() _NOEXCEPT;
+};
+
+_LIBCPP_END_NAMESPACE_EXPERIMENTAL
+
+
+#if _LIBCPP_STD_VER > 11
+
+#include <initializer_list>
+#include <type_traits>
+#include <new>
+#include <__functional_base>
+#include <__undef_min_max>
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
+struct in_place_t {};
+constexpr in_place_t in_place{};
+
+struct nullopt_t
+{
+    explicit constexpr nullopt_t(int) noexcept {}
+};
+
+constexpr nullopt_t nullopt{0};
+
+template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
+class __optional_storage
+{
+protected:
+    typedef _Tp value_type;
+    union
+    {
+        char __null_state_;
+        value_type __val_;
+    };
+    bool __engaged_ = false;
+
+    _LIBCPP_INLINE_VISIBILITY
+    ~__optional_storage()
+    {
+        if (__engaged_)
+            __val_.~value_type();
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr __optional_storage() noexcept
+        :  __null_state_('\0') {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_storage(const __optional_storage& __x)
+        :  __engaged_(__x.__engaged_)
+        {
+            if (__engaged_)
+                ::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_storage(__optional_storage&& __x)
+                      noexcept(is_nothrow_move_constructible<value_type>::value)
+        :  __engaged_(__x.__engaged_)
+        {
+            if (__engaged_)
+                ::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr __optional_storage(const value_type& __v)
+        :  __val_(__v),
+           __engaged_(true) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr __optional_storage(value_type&& __v)
+        :  __val_(_VSTD::move(__v)),
+           __engaged_(true) {}
+
+    template <class... _Args>
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr
+    explicit __optional_storage(in_place_t, _Args&&... __args)
+       :  __val_(_VSTD::forward<_Args>(__args)...),
+           __engaged_(true) {}
+};
+
+template <class _Tp>
+class __optional_storage<_Tp, true>
+{
+protected:
+    typedef _Tp value_type;
+    union
+    {
+        char __null_state_;
+        value_type __val_;
+    };
+    bool __engaged_ = false;
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr __optional_storage() noexcept
+        :  __null_state_('\0') {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_storage(const __optional_storage& __x)
+        :  __engaged_(__x.__engaged_)
+        {
+            if (__engaged_)
+                ::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_storage(__optional_storage&& __x)
+                      noexcept(is_nothrow_move_constructible<value_type>::value)
+        :  __engaged_(__x.__engaged_)
+        {
+            if (__engaged_)
+                ::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr __optional_storage(const value_type& __v)
+        :  __val_(__v),
+           __engaged_(true) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr __optional_storage(value_type&& __v)
+        :  __val_(_VSTD::move(__v)),
+           __engaged_(true) {}
+
+    template <class... _Args>
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr
+    explicit __optional_storage(in_place_t, _Args&&... __args)
+       :  __val_(_VSTD::forward<_Args>(__args)...),
+           __engaged_(true) {}
+};
+
+template <class _Tp>
+class optional
+    : private __optional_storage<_Tp>
+{
+    typedef __optional_storage<_Tp> __base;
+public:
+    typedef _Tp value_type;
+
+    static_assert(!is_reference<value_type>::value,
+              "Instantiation of optional with a reference type is ill-formed.");
+    static_assert(!is_same<typename remove_cv<value_type>::type, in_place_t>::value,
+              "Instantiation of optional with a in_place_t type is ill-formed.");
+    static_assert(!is_same<typename remove_cv<value_type>::type, nullopt_t>::value,
+              "Instantiation of optional with a nullopt_t type is ill-formed.");
+    static_assert(is_object<value_type>::value,
+        "Instantiation of optional with a non-object type is undefined behavior.");
+    static_assert(is_nothrow_destructible<value_type>::value,
+        "Instantiation of optional with an object type that is not noexcept destructible is undefined behavior.");
+
+    _LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}
+    _LIBCPP_INLINE_VISIBILITY optional(const optional&) = default;
+    _LIBCPP_INLINE_VISIBILITY optional(optional&&) = default;
+    _LIBCPP_INLINE_VISIBILITY ~optional() = default;
+    _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
+    _LIBCPP_INLINE_VISIBILITY constexpr optional(const value_type& __v)
+        : __base(__v) {}
+    _LIBCPP_INLINE_VISIBILITY constexpr optional(value_type&& __v)
+        : __base(_VSTD::move(__v)) {}
+
+    template <class... _Args,
+              class = typename enable_if
+                      <
+                           is_constructible<value_type, _Args...>::value
+                      >::type
+             >
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr
+    explicit optional(in_place_t, _Args&&... __args)
+        : __base(in_place, _VSTD::forward<_Args>(__args)...) {}
+
+    template <class _Up, class... _Args,
+              class = typename enable_if
+                      <
+                           is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
+                      >::type
+             >
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr
+    explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
+        : __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    optional& operator=(nullopt_t) noexcept
+    {
+        if (this->__engaged_)
+        {
+            this->__val_.~value_type();
+            this->__engaged_ = false;
+        }
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    optional&
+    operator=(const optional& __opt)
+    {
+        if (this->__engaged_ == __opt.__engaged_)
+        {
+            if (this->__engaged_)
+                this->__val_ = __opt.__val_;
+        }
+        else
+        {
+            if (this->__engaged_)
+                this->__val_.~value_type();
+            else
+                ::new(_VSTD::addressof(this->__val_)) value_type(__opt.__val_);
+            this->__engaged_ = __opt.__engaged_;
+        }
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    optional&
+    operator=(optional&& __opt)
+        noexcept(is_nothrow_move_assignable<value_type>::value &&
+                 is_nothrow_move_constructible<value_type>::value)
+    {
+        if (this->__engaged_ == __opt.__engaged_)
+        {
+            if (this->__engaged_)
+                this->__val_ = _VSTD::move(__opt.__val_);
+        }
+        else
+        {
+            if (this->__engaged_)
+                this->__val_.~value_type();
+            else
+                ::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
+            this->__engaged_ = __opt.__engaged_;
+        }
+        return *this;
+    }
+
+    template <class _Up,
+              class = typename enable_if
+                      <
+                          is_same<typename remove_reference<_Up>::type, value_type>::value &&
+                          is_constructible<value_type, _Up>::value &&
+                          is_assignable<value_type&, _Up>::value
+                      >::type
+             >
+    _LIBCPP_INLINE_VISIBILITY
+    optional&
+    operator=(_Up&& __v)
+    {
+        if (this->__engaged_)
+            this->__val_ = _VSTD::forward<_Up>(__v);
+        else
+        {
+            ::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Up>(__v));
+            this->__engaged_ = true;
+        }
+        return *this;
+    }
+
+    template <class... _Args,
+              class = typename enable_if
+                      <
+                          is_constructible<value_type, _Args...>::value
+                      >::type
+             >
+    _LIBCPP_INLINE_VISIBILITY
+    void
+    emplace(_Args&&... __args)
+    {
+        *this = nullopt;
+        ::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...);
+        this->__engaged_ = true;
+    }
+
+    template <class _Up, class... _Args,
+              class = typename enable_if
+                      <
+                          is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
+                      >::type
+             >
+    _LIBCPP_INLINE_VISIBILITY
+    void
+    emplace(initializer_list<_Up> __il, _Args&&... __args)
+    {
+        *this = nullopt;
+        ::new(_VSTD::addressof(this->__val_)) value_type(__il, _VSTD::forward<_Args>(__args)...);
+        this->__engaged_ = true;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void
+    swap(optional& __opt)
+        noexcept(is_nothrow_move_constructible<value_type>::value &&
+                 __is_nothrow_swappable<value_type>::value)
+    {
+        using _VSTD::swap;
+        if (this->__engaged_ == __opt.__engaged_)
+        {
+            if (this->__engaged_)
+                swap(this->__val_, __opt.__val_);
+        }
+        else
+        {
+            if (this->__engaged_)
+            {
+                ::new(_VSTD::addressof(__opt.__val_)) value_type(_VSTD::move(this->__val_));
+                this->__val_.~value_type();
+            }
+            else
+            {
+                ::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
+                __opt.__val_.~value_type();
+            }
+            swap(this->__engaged_, __opt.__engaged_);
+        }
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr
+    value_type const*
+    operator->() const
+    {
+        _LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
+        return __operator_arrow(__has_operator_addressof<value_type>{});
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    value_type*
+    operator->()
+    {
+        _LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
+        return _VSTD::addressof(this->__val_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr
+    const value_type&
+    operator*() const
+    {
+        _LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
+        return this->__val_;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    value_type&
+    operator*()
+    {
+        _LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
+        return this->__val_;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr explicit operator bool() const noexcept {return this->__engaged_;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr value_type const& value() const
+    {
+        if (!this->__engaged_)
+            throw bad_optional_access();
+        return this->__val_;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    value_type& value()
+    {
+        if (!this->__engaged_)
+            throw bad_optional_access();
+        return this->__val_;
+    }
+
+    template <class _Up>
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr value_type value_or(_Up&& __v) const&
+    {
+        static_assert(is_copy_constructible<value_type>::value,
+                      "optional<T>::value_or: T must be copy constructible");
+        static_assert(is_convertible<_Up, value_type>::value,
+                      "optional<T>::value_or: U must be convertible to T");
+        return this->__engaged_ ? this->__val_ :
+                                  static_cast<value_type>(_VSTD::forward<_Up>(__v));
+    }
+
+    template <class _Up>
+    _LIBCPP_INLINE_VISIBILITY
+    value_type value_or(_Up&& __v) &&
+    {
+        static_assert(is_move_constructible<value_type>::value,
+                      "optional<T>::value_or: T must be move constructible");
+        static_assert(is_convertible<_Up, value_type>::value,
+                      "optional<T>::value_or: U must be convertible to T");
+        return this->__engaged_ ? _VSTD::move(this->__val_) :
+                                  static_cast<value_type>(_VSTD::forward<_Up>(__v));
+    }
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    value_type const*
+    __operator_arrow(true_type) const
+    {
+        return _VSTD::addressof(this->__val_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr
+    value_type const*
+    __operator_arrow(false_type) const
+    {
+        return &this->__val_;
+    }
+};
+
+// Comparisons between optionals
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
+{
+    if (static_cast<bool>(__x) != static_cast<bool>(__y))
+        return false;
+    if (!static_cast<bool>(__x))
+        return true;
+    return *__x == *__y;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
+{
+    if (!static_cast<bool>(__y))
+        return false;
+    if (!static_cast<bool>(__x))
+        return true;
+    return *__x < *__y;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator>(const optional<_Tp>& __x, const optional<_Tp>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y)
+{
+    return !(__x < __y);
+}
+
+
+// Comparisons with nullopt
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator==(const optional<_Tp>& __x, nullopt_t) noexcept
+{
+    return !static_cast<bool>(__x);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator==(nullopt_t, const optional<_Tp>& __x) noexcept
+{
+    return !static_cast<bool>(__x);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator!=(const optional<_Tp>& __x, nullopt_t) noexcept
+{
+    return static_cast<bool>(__x);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator!=(nullopt_t, const optional<_Tp>& __x) noexcept
+{
+    return static_cast<bool>(__x);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator<(const optional<_Tp>&, nullopt_t) noexcept
+{
+    return false;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator<(nullopt_t, const optional<_Tp>& __x) noexcept
+{
+    return static_cast<bool>(__x);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator<=(const optional<_Tp>& __x, nullopt_t) noexcept
+{
+    return !static_cast<bool>(__x);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator<=(nullopt_t, const optional<_Tp>& __x) noexcept
+{
+    return true;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator>(const optional<_Tp>& __x, nullopt_t) noexcept
+{
+    return static_cast<bool>(__x);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator>(nullopt_t, const optional<_Tp>& __x) noexcept
+{
+    return false;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator>=(const optional<_Tp>&, nullopt_t) noexcept
+{
+    return true;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
+{
+    return !static_cast<bool>(__x);
+}
+
+// Comparisons with T
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator==(const optional<_Tp>& __x, const _Tp& __v)
+{
+    return static_cast<bool>(__x) ? *__x == __v : false;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator==(const _Tp& __v, const optional<_Tp>& __x)
+{
+    return static_cast<bool>(__x) ? *__x == __v : false;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator!=(const optional<_Tp>& __x, const _Tp& __v)
+{
+    return static_cast<bool>(__x) ? !(*__x == __v) : true;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator!=(const _Tp& __v, const optional<_Tp>& __x)
+{
+    return static_cast<bool>(__x) ? !(*__x == __v) : true;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator<(const optional<_Tp>& __x, const _Tp& __v)
+{
+    return static_cast<bool>(__x) ? less<_Tp>{}(*__x, __v) : true;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator<(const _Tp& __v, const optional<_Tp>& __x)
+{
+    return static_cast<bool>(__x) ? less<_Tp>{}(__v, *__x) : false;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator<=(const optional<_Tp>& __x, const _Tp& __v)
+{
+    return !(__x > __v);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator<=(const _Tp& __v, const optional<_Tp>& __x)
+{
+    return !(__v > __x);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator>(const optional<_Tp>& __x, const _Tp& __v)
+{
+    return static_cast<bool>(__x) ? __v < __x : false;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator>(const _Tp& __v, const optional<_Tp>& __x)
+{
+    return static_cast<bool>(__x) ? __x < __v : true;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator>=(const optional<_Tp>& __x, const _Tp& __v)
+{
+    return !(__x < __v);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+bool
+operator>=(const _Tp& __v, const optional<_Tp>& __x)
+{
+    return !(__v < __x);
+}
+
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr
+optional<typename decay<_Tp>::type>
+make_optional(_Tp&& __v)
+{
+    return optional<typename decay<_Tp>::type>(_VSTD::forward<_Tp>(__v));
+}
+
+_LIBCPP_END_NAMESPACE_LFTS
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::optional<_Tp> >
+{
+    typedef std::experimental::optional<_Tp> argument_type;
+    typedef size_t        result_type;
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator()(const argument_type& __opt) const _NOEXCEPT
+    {
+        return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;
+    }
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_STD_VER > 11
+
+#endif  // _LIBCPP_OPTIONAL

Property changes on: lab4/.minix-src/include/c++/experimental/optional
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/arpa/ftp.h
===================================================================
--- lab4/.minix-src/include/arpa/ftp.h	(nonexistent)
+++ lab4/.minix-src/include/arpa/ftp.h	(revision 13)
@@ -0,0 +1,107 @@
+/*	$NetBSD: ftp.h,v 1.6 2003/08/07 09:44:12 agc Exp $	*/
+
+/*
+ * Copyright (c) 1983, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ftp.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _ARPA_FTP_H_
+#define	_ARPA_FTP_H_
+
+/* Definitions for FTP; see RFC-765. */
+
+/*
+ * Reply codes.
+ */
+#define PRELIM		1	/* positive preliminary */
+#define COMPLETE	2	/* positive completion */
+#define CONTINUE	3	/* positive intermediate */
+#define TRANSIENT	4	/* transient negative completion */
+#define ERROR		5	/* permanent negative completion */
+
+/*
+ * Type codes
+ */
+#define	TYPE_A		1	/* ASCII */
+#define	TYPE_E		2	/* EBCDIC */
+#define	TYPE_I		3	/* image */
+#define	TYPE_L		4	/* local byte size */
+
+#ifdef FTP_NAMES
+char *typenames[] =  {"0", "ASCII", "EBCDIC", "Image", "Local" };
+#endif
+
+/*
+ * Form codes
+ */
+#define	FORM_N		1	/* non-print */
+#define	FORM_T		2	/* telnet format effectors */
+#define	FORM_C		3	/* carriage control (ASA) */
+#ifdef FTP_NAMES
+char *formnames[] =  {"0", "Nonprint", "Telnet", "Carriage-control" };
+#endif
+
+/*
+ * Structure codes
+ */
+#define	STRU_F		1	/* file (no record structure) */
+#define	STRU_R		2	/* record structure */
+#define	STRU_P		3	/* page structure */
+#ifdef FTP_NAMES
+char *strunames[] =  {"0", "File", "Record", "Page" };
+#endif
+
+/*
+ * Mode types
+ */
+#define	MODE_S		1	/* stream */
+#define	MODE_B		2	/* block */
+#define	MODE_C		3	/* compressed */
+#ifdef FTP_NAMES
+char *modenames[] =  {"0", "Stream", "Block", "Compressed" };
+#endif
+
+/*
+ * Record Tokens
+ */
+#define	REC_ESC		'\377'	/* Record-mode Escape */
+#define	REC_EOR		'\001'	/* Record-mode End-of-Record */
+#define REC_EOF		'\002'	/* Record-mode End-of-File */
+
+/*
+ * Block Header
+ */
+#define	BLK_EOR		0x80	/* Block is End-of-Record */
+#define	BLK_EOF		0x40	/* Block is End-of-File */
+#define BLK_ERRORS	0x20	/* Block is suspected of containing errors */
+#define	BLK_RESTART	0x10	/* Block is Restart Marker */
+
+#define	BLK_BYTECOUNT	2	/* Bytes in this block */
+
+#endif /* _ARPA_FTP_H_ */

Property changes on: lab4/.minix-src/include/arpa/ftp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__bit_reference
===================================================================
--- lab4/.minix-src/include/c++/__bit_reference	(nonexistent)
+++ lab4/.minix-src/include/c++/__bit_reference	(revision 13)
@@ -0,0 +1,1286 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___BIT_REFERENCE
+#define _LIBCPP___BIT_REFERENCE
+
+#include <__config>
+#include <algorithm>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
+template <class _Cp> class __bit_const_reference;
+
+template <class _Tp>
+struct __has_storage_type
+{
+    static const bool value = false;
+};
+
+template <class _Cp, bool = __has_storage_type<_Cp>::value>
+class __bit_reference
+{
+    typedef typename _Cp::__storage_type    __storage_type;
+    typedef typename _Cp::__storage_pointer __storage_pointer;
+
+    __storage_pointer __seg_;
+    __storage_type    __mask_;
+
+#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
+    friend typename _Cp::__self;
+#else
+    friend class _Cp::__self;
+#endif
+    friend class __bit_const_reference<_Cp>;
+    friend class __bit_iterator<_Cp, false>;
+public:
+    _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
+        {return static_cast<bool>(*__seg_ & __mask_);}
+    _LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT
+        {return !static_cast<bool>(*this);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bit_reference& operator=(bool __x) _NOEXCEPT
+    {
+        if (__x)
+            *__seg_ |= __mask_;
+        else
+            *__seg_ &= ~__mask_;
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bit_reference& operator=(const __bit_reference& __x) _NOEXCEPT
+        {return operator=(static_cast<bool>(__x));}
+
+    _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT
+        {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
+        : __seg_(__s), __mask_(__m) {}
+};
+
+template <class _Cp>
+class __bit_reference<_Cp, false>
+{
+};
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT
+{
+    bool __t = __x;
+    __x = __y;
+    __y = __t;
+}
+
+template <class _Cp, class _Dp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT
+{
+    bool __t = __x;
+    __x = __y;
+    __y = __t;
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT
+{
+    bool __t = __x;
+    __x = __y;
+    __y = __t;
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT
+{
+    bool __t = __x;
+    __x = __y;
+    __y = __t;
+}
+
+template <class _Cp>
+class __bit_const_reference
+{
+    typedef typename _Cp::__storage_type          __storage_type;
+    typedef typename _Cp::__const_storage_pointer __storage_pointer;
+
+    __storage_pointer        __seg_;
+    __storage_type __mask_;
+
+#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
+    friend typename _Cp::__self;
+#else
+    friend class _Cp::__self;
+#endif
+    friend class __bit_iterator<_Cp, true>;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
+        : __seg_(__x.__seg_), __mask_(__x.__mask_) {}
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT
+        {return static_cast<bool>(*__seg_ & __mask_);}
+
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT
+        {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR
+    __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
+        : __seg_(__s), __mask_(__m) {}
+
+    __bit_const_reference& operator=(const __bit_const_reference& __x);
+};
+
+// find
+
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, _IsConst>
+__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
+{
+    typedef __bit_iterator<_Cp, _IsConst> _It;
+    typedef typename _It::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _It::__bits_per_word;
+    // do first partial word
+    if (__first.__ctz_ != 0)
+    {
+        __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
+        __storage_type __dn = _VSTD::min(__clz_f, __n);
+        __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
+        __storage_type __b = *__first.__seg_ & __m;
+        if (__b)
+            return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
+        if (__n == __dn)
+            return __first + __n;
+        __n -= __dn;
+        ++__first.__seg_;
+    }
+    // do middle whole words
+    for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
+        if (*__first.__seg_)
+            return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(*__first.__seg_)));
+    // do last partial word
+    if (__n > 0)
+    {
+        __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        __storage_type __b = *__first.__seg_ & __m;
+        if (__b)
+            return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
+    }
+    return _It(__first.__seg_, static_cast<unsigned>(__n));
+}
+
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, _IsConst>
+__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
+{
+    typedef __bit_iterator<_Cp, _IsConst> _It;
+    typedef typename _It::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _It::__bits_per_word;
+    // do first partial word
+    if (__first.__ctz_ != 0)
+    {
+        __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
+        __storage_type __dn = _VSTD::min(__clz_f, __n);
+        __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
+        __storage_type __b = ~*__first.__seg_ & __m;
+        if (__b)
+            return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
+        if (__n == __dn)
+            return __first + __n;
+        __n -= __dn;
+        ++__first.__seg_;
+    }
+    // do middle whole words
+    for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
+    {
+        __storage_type __b = ~*__first.__seg_;
+        if (__b)
+            return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
+    }
+    // do last partial word
+    if (__n > 0)
+    {
+        __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        __storage_type __b = ~*__first.__seg_ & __m;
+        if (__b)
+            return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
+    }
+    return _It(__first.__seg_, static_cast<unsigned>(__n));
+}
+
+template <class _Cp, bool _IsConst, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__bit_iterator<_Cp, _IsConst>
+find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
+{
+    if (static_cast<bool>(__value_))
+        return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
+    return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
+}
+
+// count
+
+template <class _Cp, bool _IsConst>
+typename __bit_iterator<_Cp, _IsConst>::difference_type
+__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
+{
+    typedef __bit_iterator<_Cp, _IsConst> _It;
+    typedef typename _It::__storage_type __storage_type;
+    typedef typename _It::difference_type difference_type;
+    static const unsigned __bits_per_word = _It::__bits_per_word;
+    difference_type __r = 0;
+    // do first partial word
+    if (__first.__ctz_ != 0)
+    {
+        __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
+        __storage_type __dn = _VSTD::min(__clz_f, __n);
+        __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
+        __r = _VSTD::__pop_count(*__first.__seg_ & __m);
+        __n -= __dn;
+        ++__first.__seg_;
+    }
+    // do middle whole words
+    for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
+        __r += _VSTD::__pop_count(*__first.__seg_);
+    // do last partial word
+    if (__n > 0)
+    {
+        __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        __r += _VSTD::__pop_count(*__first.__seg_ & __m);
+    }
+    return __r;
+}
+
+template <class _Cp, bool _IsConst>
+typename __bit_iterator<_Cp, _IsConst>::difference_type
+__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
+{
+    typedef __bit_iterator<_Cp, _IsConst> _It;
+    typedef typename _It::__storage_type __storage_type;
+    typedef typename _It::difference_type difference_type;
+    static const unsigned __bits_per_word = _It::__bits_per_word;
+    difference_type __r = 0;
+    // do first partial word
+    if (__first.__ctz_ != 0)
+    {
+        __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
+        __storage_type __dn = _VSTD::min(__clz_f, __n);
+        __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
+        __r = _VSTD::__pop_count(~*__first.__seg_ & __m);
+        __n -= __dn;
+        ++__first.__seg_;
+    }
+    // do middle whole words
+    for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
+        __r += _VSTD::__pop_count(~*__first.__seg_);
+    // do last partial word
+    if (__n > 0)
+    {
+        __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        __r += _VSTD::__pop_count(~*__first.__seg_ & __m);
+    }
+    return __r;
+}
+
+template <class _Cp, bool _IsConst, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __bit_iterator<_Cp, _IsConst>::difference_type
+count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
+{
+    if (static_cast<bool>(__value_))
+        return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
+    return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
+}
+
+// fill_n
+
+template <class _Cp>
+void
+__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
+{
+    typedef __bit_iterator<_Cp, false> _It;
+    typedef typename _It::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _It::__bits_per_word;
+    // do first partial word
+    if (__first.__ctz_ != 0)
+    {
+        __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
+        __storage_type __dn = _VSTD::min(__clz_f, __n);
+        __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
+        *__first.__seg_ &= ~__m;
+        __n -= __dn;
+        ++__first.__seg_;
+    }
+    // do middle whole words
+    __storage_type __nw = __n / __bits_per_word;
+    _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type));
+    __n -= __nw * __bits_per_word;
+    // do last partial word
+    if (__n > 0)
+    {
+        __first.__seg_ += __nw;
+        __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        *__first.__seg_ &= ~__m;
+    }
+}
+
+template <class _Cp>
+void
+__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
+{
+    typedef __bit_iterator<_Cp, false> _It;
+    typedef typename _It::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _It::__bits_per_word;
+    // do first partial word
+    if (__first.__ctz_ != 0)
+    {
+        __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
+        __storage_type __dn = _VSTD::min(__clz_f, __n);
+        __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
+        *__first.__seg_ |= __m;
+        __n -= __dn;
+        ++__first.__seg_;
+    }
+    // do middle whole words
+    __storage_type __nw = __n / __bits_per_word;
+    _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type));
+    __n -= __nw * __bits_per_word;
+    // do last partial word
+    if (__n > 0)
+    {
+        __first.__seg_ += __nw;
+        __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        *__first.__seg_ |= __m;
+    }
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_)
+{
+    if (__n > 0)
+    {
+        if (__value_)
+            __fill_n_true(__first, __n);
+        else
+            __fill_n_false(__first, __n);
+    }
+}
+
+// fill
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_)
+{
+    _VSTD::fill_n(__first, static_cast<typename _Cp::size_type>(__last - __first), __value_);
+}
+
+// copy
+
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+                                                     __bit_iterator<_Cp, false> __result)
+{
+    typedef __bit_iterator<_Cp, _IsConst> _In;
+    typedef  typename _In::difference_type difference_type;
+    typedef typename _In::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _In::__bits_per_word;
+    difference_type __n = __last - __first;
+    if (__n > 0)
+    {
+        // do first word
+        if (__first.__ctz_ != 0)
+        {
+            unsigned __clz = __bits_per_word - __first.__ctz_;
+            difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
+            __n -= __dn;
+            __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
+            __storage_type __b = *__first.__seg_ & __m;
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b;
+            __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
+            __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_)  % __bits_per_word);
+            ++__first.__seg_;
+            // __first.__ctz_ = 0;
+        }
+        // __first.__ctz_ == 0;
+        // do middle words
+        __storage_type __nw = __n / __bits_per_word;
+        _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
+                       _VSTD::__to_raw_pointer(__first.__seg_),
+                       __nw * sizeof(__storage_type));
+        __n -= __nw * __bits_per_word;
+        __result.__seg_ += __nw;
+        // do last word
+        if (__n > 0)
+        {
+            __first.__seg_ += __nw;
+            __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+            __storage_type __b = *__first.__seg_ & __m;
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b;
+            __result.__ctz_ = static_cast<unsigned>(__n);
+        }
+    }
+    return __result;
+}
+
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+                                                       __bit_iterator<_Cp, false> __result)
+{
+    typedef __bit_iterator<_Cp, _IsConst> _In;
+    typedef  typename _In::difference_type difference_type;
+    typedef typename _In::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _In::__bits_per_word;
+    difference_type __n = __last - __first;
+    if (__n > 0)
+    {
+        // do first word
+        if (__first.__ctz_ != 0)
+        {
+            unsigned __clz_f = __bits_per_word - __first.__ctz_;
+            difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
+            __n -= __dn;
+            __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
+            __storage_type __b = *__first.__seg_ & __m;
+            unsigned __clz_r = __bits_per_word - __result.__ctz_;
+            __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
+            __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
+            *__result.__seg_ &= ~__m;
+            if (__result.__ctz_ > __first.__ctz_)
+                *__result.__seg_ |= __b << (__result.__ctz_ - __first.__ctz_);
+            else
+                *__result.__seg_ |= __b >> (__first.__ctz_ - __result.__ctz_);
+            __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word;
+            __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_)  % __bits_per_word);
+            __dn -= __ddn;
+            if (__dn > 0)
+            {
+                __m = ~__storage_type(0) >> (__bits_per_word - __dn);
+                *__result.__seg_ &= ~__m;
+                *__result.__seg_ |= __b >> (__first.__ctz_ + __ddn);
+                __result.__ctz_ = static_cast<unsigned>(__dn);
+            }
+            ++__first.__seg_;
+            // __first.__ctz_ = 0;
+        }
+        // __first.__ctz_ == 0;
+        // do middle words
+        unsigned __clz_r = __bits_per_word - __result.__ctz_;
+        __storage_type __m = ~__storage_type(0) << __result.__ctz_;
+        for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_)
+        {
+            __storage_type __b = *__first.__seg_;
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b << __result.__ctz_;
+            ++__result.__seg_;
+            *__result.__seg_ &= __m;
+            *__result.__seg_ |= __b >> __clz_r;
+        }
+        // do last word
+        if (__n > 0)
+        {
+            __m = ~__storage_type(0) >> (__bits_per_word - __n);
+            __storage_type __b = *__first.__seg_ & __m;
+            __storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__clz_r));
+            __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b << __result.__ctz_;
+            __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
+            __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_)  % __bits_per_word);
+            __n -= __dn;
+            if (__n > 0)
+            {
+                __m = ~__storage_type(0) >> (__bits_per_word - __n);
+                *__result.__seg_ &= ~__m;
+                *__result.__seg_ |= __b >> __dn;
+                __result.__ctz_ = static_cast<unsigned>(__n);
+            }
+        }
+    }
+    return __result;
+}
+
+template <class _Cp, bool _IsConst>
+inline _LIBCPP_INLINE_VISIBILITY
+__bit_iterator<_Cp, false>
+copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
+{
+    if (__first.__ctz_ == __result.__ctz_)
+        return __copy_aligned(__first, __last, __result);
+    return __copy_unaligned(__first, __last, __result);
+}
+
+// copy_backward
+
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+                                                     __bit_iterator<_Cp, false> __result)
+{
+    typedef __bit_iterator<_Cp, _IsConst> _In;
+    typedef  typename _In::difference_type difference_type;
+    typedef typename _In::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _In::__bits_per_word;
+    difference_type __n = __last - __first;
+    if (__n > 0)
+    {
+        // do first word
+        if (__last.__ctz_ != 0)
+        {
+            difference_type __dn = _VSTD::min(static_cast<difference_type>(__last.__ctz_), __n);
+            __n -= __dn;
+            unsigned __clz = __bits_per_word - __last.__ctz_;
+            __storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz);
+            __storage_type __b = *__last.__seg_ & __m;
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b;
+            __result.__ctz_ = static_cast<unsigned>(((-__dn & (__bits_per_word - 1)) +
+                                                       __result.__ctz_)  % __bits_per_word);
+            // __last.__ctz_ = 0
+         }
+        // __last.__ctz_ == 0 || __n == 0
+        // __result.__ctz_ == 0 || __n == 0
+        // do middle words
+        __storage_type __nw = __n / __bits_per_word;
+        __result.__seg_ -= __nw;
+        __last.__seg_ -= __nw;
+        _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
+                       _VSTD::__to_raw_pointer(__last.__seg_),
+                       __nw * sizeof(__storage_type));
+        __n -= __nw * __bits_per_word;
+        // do last word
+        if (__n > 0)
+        {
+            __storage_type __m = ~__storage_type(0) << (__bits_per_word - __n);
+            __storage_type __b = *--__last.__seg_ & __m;
+            *--__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b;
+            __result.__ctz_ = static_cast<unsigned>(-__n & (__bits_per_word - 1));
+        }
+    }
+    return __result;
+}
+
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+                                                       __bit_iterator<_Cp, false> __result)
+{
+    typedef __bit_iterator<_Cp, _IsConst> _In;
+    typedef  typename _In::difference_type difference_type;
+    typedef typename _In::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _In::__bits_per_word;
+    difference_type __n = __last - __first;
+    if (__n > 0)
+    {
+        // do first word
+        if (__last.__ctz_ != 0)
+        {
+            difference_type __dn = _VSTD::min(static_cast<difference_type>(__last.__ctz_), __n);
+            __n -= __dn;
+            unsigned __clz_l = __bits_per_word - __last.__ctz_;
+            __storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_l);
+            __storage_type __b = *__last.__seg_ & __m;
+            unsigned __clz_r = __bits_per_word - __result.__ctz_;
+            __storage_type __ddn = _VSTD::min(__dn, static_cast<difference_type>(__result.__ctz_));
+            if (__ddn > 0)
+            {
+                __m = (~__storage_type(0) << (__result.__ctz_ - __ddn)) & (~__storage_type(0) >> __clz_r);
+                *__result.__seg_ &= ~__m;
+                if (__result.__ctz_ > __last.__ctz_)
+                    *__result.__seg_ |= __b << (__result.__ctz_ - __last.__ctz_);
+                else
+                    *__result.__seg_ |= __b >> (__last.__ctz_ - __result.__ctz_);
+                __result.__ctz_ = static_cast<unsigned>(((-__ddn & (__bits_per_word - 1)) +
+                                                         __result.__ctz_)  % __bits_per_word);
+                __dn -= __ddn;
+            }
+            if (__dn > 0)
+            {
+                // __result.__ctz_ == 0
+                --__result.__seg_;
+                __result.__ctz_ = static_cast<unsigned>(-__dn & (__bits_per_word - 1));
+                __m = ~__storage_type(0) << __result.__ctz_;
+                *__result.__seg_ &= ~__m;
+                __last.__ctz_ -= __dn + __ddn;
+                *__result.__seg_ |= __b << (__result.__ctz_ - __last.__ctz_);
+            }
+            // __last.__ctz_ = 0
+         }
+        // __last.__ctz_ == 0 || __n == 0
+        // __result.__ctz_ != 0 || __n == 0
+        // do middle words
+        unsigned __clz_r = __bits_per_word - __result.__ctz_;
+        __storage_type __m = ~__storage_type(0) >> __clz_r;
+        for (; __n >= __bits_per_word; __n -= __bits_per_word)
+        {
+            __storage_type __b = *--__last.__seg_;
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b >> __clz_r;
+            *--__result.__seg_ &= __m;
+            *__result.__seg_ |= __b << __result.__ctz_;
+        }
+        // do last word
+        if (__n > 0)
+        {
+            __m = ~__storage_type(0) << (__bits_per_word - __n);
+            __storage_type __b = *--__last.__seg_ & __m;
+            __clz_r = __bits_per_word - __result.__ctz_;
+            __storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
+            __m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b >> (__bits_per_word - __result.__ctz_);
+            __result.__ctz_ = static_cast<unsigned>(((-__dn & (__bits_per_word - 1)) +
+                                                     __result.__ctz_)  % __bits_per_word);
+            __n -= __dn;
+            if (__n > 0)
+            {
+                // __result.__ctz_ == 0
+                --__result.__seg_;
+                __result.__ctz_ = static_cast<unsigned>(-__n & (__bits_per_word - 1));
+                __m = ~__storage_type(0) << __result.__ctz_;
+                *__result.__seg_ &= ~__m;
+                *__result.__seg_ |= __b << (__result.__ctz_ - (__bits_per_word - __n - __dn));
+            }
+        }
+    }
+    return __result;
+}
+
+template <class _Cp, bool _IsConst>
+inline _LIBCPP_INLINE_VISIBILITY
+__bit_iterator<_Cp, false>
+copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
+{
+    if (__last.__ctz_ == __result.__ctz_)
+        return __copy_backward_aligned(__first, __last, __result);
+    return __copy_backward_unaligned(__first, __last, __result);
+}
+
+// move
+
+template <class _Cp, bool _IsConst>
+inline _LIBCPP_INLINE_VISIBILITY
+__bit_iterator<_Cp, false>
+move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
+{
+    return _VSTD::copy(__first, __last, __result);
+}
+
+// move_backward
+
+template <class _Cp, bool _IsConst>
+inline _LIBCPP_INLINE_VISIBILITY
+__bit_iterator<_Cp, false>
+move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
+{
+    return _VSTD::copy_backward(__first, __last, __result);
+}
+
+// swap_ranges
+
+template <class __C1, class __C2>
+__bit_iterator<__C2, false>
+__swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
+                      __bit_iterator<__C2, false> __result)
+{
+    typedef __bit_iterator<__C1, false> _I1;
+    typedef  typename _I1::difference_type difference_type;
+    typedef typename _I1::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _I1::__bits_per_word;
+    difference_type __n = __last - __first;
+    if (__n > 0)
+    {
+        // do first word
+        if (__first.__ctz_ != 0)
+        {
+            unsigned __clz = __bits_per_word - __first.__ctz_;
+            difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
+            __n -= __dn;
+            __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
+            __storage_type __b1 = *__first.__seg_ & __m;
+            *__first.__seg_ &= ~__m;
+            __storage_type __b2 = *__result.__seg_ & __m;
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b1;
+            *__first.__seg_  |= __b2;
+            __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
+            __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_)  % __bits_per_word);
+            ++__first.__seg_;
+            // __first.__ctz_ = 0;
+        }
+        // __first.__ctz_ == 0;
+        // do middle words
+        for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_, ++__result.__seg_)
+            swap(*__first.__seg_, *__result.__seg_);
+        // do last word
+        if (__n > 0)
+        {
+            __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+            __storage_type __b1 = *__first.__seg_ & __m;
+            *__first.__seg_ &= ~__m;
+            __storage_type __b2 = *__result.__seg_ & __m;
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b1;
+            *__first.__seg_  |= __b2;
+            __result.__ctz_ = static_cast<unsigned>(__n);
+        }
+    }
+    return __result;
+}
+
+template <class __C1, class __C2>
+__bit_iterator<__C2, false>
+__swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
+                        __bit_iterator<__C2, false> __result)
+{
+    typedef __bit_iterator<__C1, false> _I1;
+    typedef  typename _I1::difference_type difference_type;
+    typedef typename _I1::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _I1::__bits_per_word;
+    difference_type __n = __last - __first;
+    if (__n > 0)
+    {
+        // do first word
+        if (__first.__ctz_ != 0)
+        {
+            unsigned __clz_f = __bits_per_word - __first.__ctz_;
+            difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
+            __n -= __dn;
+            __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
+            __storage_type __b1 = *__first.__seg_ & __m;
+            *__first.__seg_ &= ~__m;
+            unsigned __clz_r = __bits_per_word - __result.__ctz_;
+            __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
+            __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
+            __storage_type __b2 = *__result.__seg_ & __m;
+            *__result.__seg_ &= ~__m;
+            if (__result.__ctz_ > __first.__ctz_)
+            {
+                unsigned __s = __result.__ctz_ - __first.__ctz_;
+                *__result.__seg_ |= __b1 << __s;
+                *__first.__seg_  |= __b2 >> __s;
+            }
+            else
+            {
+                unsigned __s = __first.__ctz_ - __result.__ctz_;
+                *__result.__seg_ |= __b1 >> __s;
+                *__first.__seg_  |= __b2 << __s;
+            }
+            __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word;
+            __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_)  % __bits_per_word);
+            __dn -= __ddn;
+            if (__dn > 0)
+            {
+                __m = ~__storage_type(0) >> (__bits_per_word - __dn);
+                __b2 = *__result.__seg_ & __m;
+                *__result.__seg_ &= ~__m;
+                unsigned __s = __first.__ctz_ + __ddn;
+                *__result.__seg_ |= __b1 >> __s;
+                *__first.__seg_  |= __b2 << __s;
+                __result.__ctz_ = static_cast<unsigned>(__dn);
+            }
+            ++__first.__seg_;
+            // __first.__ctz_ = 0;
+        }
+        // __first.__ctz_ == 0;
+        // do middle words
+        __storage_type __m = ~__storage_type(0) << __result.__ctz_;
+        unsigned __clz_r = __bits_per_word - __result.__ctz_;
+        for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_)
+        {
+            __storage_type __b1 = *__first.__seg_;
+            __storage_type __b2 = *__result.__seg_ & __m;
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b1 << __result.__ctz_;
+            *__first.__seg_  = __b2 >> __result.__ctz_;
+            ++__result.__seg_;
+            __b2 = *__result.__seg_ & ~__m;
+            *__result.__seg_ &= __m;
+            *__result.__seg_ |= __b1 >> __clz_r;
+            *__first.__seg_  |= __b2 << __clz_r;
+        }
+        // do last word
+        if (__n > 0)
+        {
+            __m = ~__storage_type(0) >> (__bits_per_word - __n);
+            __storage_type __b1 = *__first.__seg_ & __m;
+            *__first.__seg_ &= ~__m;
+            __storage_type __dn = _VSTD::min<__storage_type>(__n, __clz_r);
+            __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
+            __storage_type __b2 = *__result.__seg_ & __m;
+            *__result.__seg_ &= ~__m;
+            *__result.__seg_ |= __b1 << __result.__ctz_;
+            *__first.__seg_  |= __b2 >> __result.__ctz_;
+            __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
+            __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_)  % __bits_per_word);
+            __n -= __dn;
+            if (__n > 0)
+            {
+                __m = ~__storage_type(0) >> (__bits_per_word - __n);
+                __b2 = *__result.__seg_ & __m;
+                *__result.__seg_ &= ~__m;
+                *__result.__seg_ |= __b1 >> __dn;
+                *__first.__seg_  |= __b2 << __dn;
+                __result.__ctz_ = static_cast<unsigned>(__n);
+            }
+        }
+    }
+    return __result;
+}
+
+template <class __C1, class __C2>
+inline _LIBCPP_INLINE_VISIBILITY
+__bit_iterator<__C2, false>
+swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1,
+            __bit_iterator<__C2, false> __first2)
+{
+    if (__first1.__ctz_ == __first2.__ctz_)
+        return __swap_ranges_aligned(__first1, __last1, __first2);
+    return __swap_ranges_unaligned(__first1, __last1, __first2);
+}
+
+// rotate
+
+template <class _Cp>
+struct __bit_array
+{
+    typedef typename _Cp::difference_type difference_type;
+    typedef typename _Cp::__storage_type  __storage_type;
+    typedef typename _Cp::__storage_pointer __storage_pointer;
+    typedef typename _Cp::iterator        iterator;
+    static const unsigned __bits_per_word = _Cp::__bits_per_word;
+    static const unsigned _Np = 4;
+
+    difference_type __size_;
+    __storage_type __word_[_Np];
+
+    _LIBCPP_INLINE_VISIBILITY static difference_type capacity()
+        {return static_cast<difference_type>(_Np * __bits_per_word);}
+    _LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
+    _LIBCPP_INLINE_VISIBILITY iterator begin()
+    {
+        return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0);
+    }
+    _LIBCPP_INLINE_VISIBILITY iterator end()
+    {
+        return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word,
+                                                  static_cast<unsigned>(__size_ % __bits_per_word));
+    }
+};
+
+template <class _Cp>
+__bit_iterator<_Cp, false>
+rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last)
+{
+    typedef __bit_iterator<_Cp, false> _I1;
+    typedef  typename _I1::difference_type difference_type;
+    difference_type __d1 = __middle - __first;
+    difference_type __d2 = __last - __middle;
+    _I1 __r = __first + __d2;
+    while (__d1 != 0 && __d2 != 0)
+    {
+        if (__d1 <= __d2)
+        {
+            if (__d1 <= __bit_array<_Cp>::capacity())
+            {
+                __bit_array<_Cp> __b(__d1);
+                _VSTD::copy(__first, __middle, __b.begin());
+                _VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
+                break;
+            }
+            else
+            {
+                __bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
+                __first = __middle;
+                __middle = __mp;
+                __d2 -= __d1;
+            }
+        }
+        else
+        {
+            if (__d2 <= __bit_array<_Cp>::capacity())
+            {
+                __bit_array<_Cp> __b(__d2);
+                _VSTD::copy(__middle, __last, __b.begin());
+                _VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
+                break;
+            }
+            else
+            {
+                __bit_iterator<_Cp, false> __mp = __first + __d2;
+                _VSTD::swap_ranges(__first, __mp, __middle);
+                __first = __mp;
+                __d1 -= __d2;
+            }
+        }
+    }
+    return __r;
+}
+
+// equal
+
+template <class _Cp, bool _IC1, bool _IC2>
+bool
+__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
+                  __bit_iterator<_Cp, _IC2> __first2)
+{
+    typedef __bit_iterator<_Cp, _IC1> _It;
+    typedef  typename _It::difference_type difference_type;
+    typedef typename _It::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _It::__bits_per_word;
+    difference_type __n = __last1 - __first1;
+    if (__n > 0)
+    {
+        // do first word
+        if (__first1.__ctz_ != 0)
+        {
+            unsigned __clz_f = __bits_per_word - __first1.__ctz_;
+            difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
+            __n -= __dn;
+            __storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
+            __storage_type __b = *__first1.__seg_ & __m;
+            unsigned __clz_r = __bits_per_word - __first2.__ctz_;
+            __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
+            __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
+            if (__first2.__ctz_ > __first1.__ctz_)
+            {
+                if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
+                    return false;
+            }
+            else
+            {
+                if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
+                    return false;
+            }
+            __first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
+            __first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_)  % __bits_per_word);
+            __dn -= __ddn;
+            if (__dn > 0)
+            {
+                __m = ~__storage_type(0) >> (__bits_per_word - __dn);
+                if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ + __ddn)))
+                    return false;
+                __first2.__ctz_ = static_cast<unsigned>(__dn);
+            }
+            ++__first1.__seg_;
+            // __first1.__ctz_ = 0;
+        }
+        // __first1.__ctz_ == 0;
+        // do middle words
+        unsigned __clz_r = __bits_per_word - __first2.__ctz_;
+        __storage_type __m = ~__storage_type(0) << __first2.__ctz_;
+        for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first1.__seg_)
+        {
+            __storage_type __b = *__first1.__seg_;
+            if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_))
+                return false;
+            ++__first2.__seg_;
+            if ((*__first2.__seg_ & ~__m) != (__b >> __clz_r))
+                return false;
+        }
+        // do last word
+        if (__n > 0)
+        {
+            __m = ~__storage_type(0) >> (__bits_per_word - __n);
+            __storage_type __b = *__first1.__seg_ & __m;
+            __storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__clz_r));
+            __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
+            if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_))
+                return false;
+            __first2.__seg_ += (__dn + __first2.__ctz_) / __bits_per_word;
+            __first2.__ctz_ = static_cast<unsigned>((__dn + __first2.__ctz_)  % __bits_per_word);
+            __n -= __dn;
+            if (__n > 0)
+            {
+                __m = ~__storage_type(0) >> (__bits_per_word - __n);
+                if ((*__first2.__seg_ & __m) != (__b >> __dn))
+                    return false;
+            }
+        }
+    }
+    return true;
+}
+
+template <class _Cp, bool _IC1, bool _IC2>
+bool
+__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
+                __bit_iterator<_Cp, _IC2> __first2)
+{
+    typedef __bit_iterator<_Cp, _IC1> _It;
+    typedef  typename _It::difference_type difference_type;
+    typedef typename _It::__storage_type __storage_type;
+    static const unsigned __bits_per_word = _It::__bits_per_word;
+    difference_type __n = __last1 - __first1;
+    if (__n > 0)
+    {
+        // do first word
+        if (__first1.__ctz_ != 0)
+        {
+            unsigned __clz = __bits_per_word - __first1.__ctz_;
+            difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
+            __n -= __dn;
+            __storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
+            if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m))
+                return false;
+            ++__first2.__seg_;
+            ++__first1.__seg_;
+            // __first1.__ctz_ = 0;
+            // __first2.__ctz_ = 0;
+        }
+        // __first1.__ctz_ == 0;
+        // __first2.__ctz_ == 0;
+        // do middle words
+        for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first1.__seg_, ++__first2.__seg_)
+            if (*__first2.__seg_ != *__first1.__seg_)
+                return false;
+        // do last word
+        if (__n > 0)
+        {
+            __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+            if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m))
+                return false;
+        }
+    }
+    return true;
+}
+
+template <class _Cp, bool _IC1, bool _IC2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2)
+{
+    if (__first1.__ctz_ == __first2.__ctz_)
+        return __equal_aligned(__first1, __last1, __first2);
+    return __equal_unaligned(__first1, __last1, __first2);
+}
+
+template <class _Cp, bool _IsConst,
+          typename _Cp::__storage_type>
+class __bit_iterator
+{
+public:
+    typedef typename _Cp::difference_type                                                          difference_type;
+    typedef bool                                                                                  value_type;
+    typedef __bit_iterator                                                                        pointer;
+    typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference;
+    typedef random_access_iterator_tag                                                            iterator_category;
+
+private:
+    typedef typename _Cp::__storage_type                                           __storage_type;
+    typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer,
+                                           typename _Cp::__storage_pointer>::type  __storage_pointer;
+    static const unsigned __bits_per_word = _Cp::__bits_per_word;
+
+    __storage_pointer __seg_;
+    unsigned          __ctz_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+    : __seg_(nullptr), __ctz_(0)
+#endif
+    {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
+        : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
+
+    _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
+        {return reference(__seg_, __storage_type(1) << __ctz_);}
+
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator& operator++()
+    {
+        if (__ctz_ != __bits_per_word-1)
+            ++__ctz_;
+        else
+        {
+            __ctz_ = 0;
+            ++__seg_;
+        }
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator operator++(int)
+    {
+        __bit_iterator __tmp = *this;
+        ++(*this);
+        return __tmp;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator& operator--()
+    {
+        if (__ctz_ != 0)
+            --__ctz_;
+        else
+        {
+            __ctz_ = __bits_per_word - 1;
+            --__seg_;
+        }
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator operator--(int)
+    {
+        __bit_iterator __tmp = *this;
+        --(*this);
+        return __tmp;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator& operator+=(difference_type __n)
+    {
+        if (__n >= 0)
+            __seg_ += (__n + __ctz_) / __bits_per_word;
+        else
+            __seg_ += static_cast<difference_type>(__n - __bits_per_word + __ctz_ + 1)
+                    / static_cast<difference_type>(__bits_per_word);
+        __n &= (__bits_per_word - 1);
+        __ctz_ = static_cast<unsigned>((__n + __ctz_)  % __bits_per_word);
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator& operator-=(difference_type __n)
+    {
+        return *this += -__n;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator operator+(difference_type __n) const
+    {
+        __bit_iterator __t(*this);
+        __t += __n;
+        return __t;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __bit_iterator operator-(difference_type __n) const
+    {
+        __bit_iterator __t(*this);
+        __t -= __n;
+        return __t;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    friend __bit_iterator operator+(difference_type __n, const __bit_iterator& __it) {return __it + __n;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    friend difference_type operator-(const __bit_iterator& __x, const __bit_iterator& __y)
+        {return (__x.__seg_ - __y.__seg_) * __bits_per_word + __x.__ctz_ - __y.__ctz_;}
+
+    _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const {return *(*this + __n);}
+
+    _LIBCPP_INLINE_VISIBILITY friend bool operator==(const __bit_iterator& __x, const __bit_iterator& __y)
+        {return __x.__seg_ == __y.__seg_ && __x.__ctz_ == __y.__ctz_;}
+
+    _LIBCPP_INLINE_VISIBILITY friend bool operator!=(const __bit_iterator& __x, const __bit_iterator& __y)
+        {return !(__x == __y);}
+
+    _LIBCPP_INLINE_VISIBILITY friend bool operator<(const __bit_iterator& __x, const __bit_iterator& __y)
+        {return __x.__seg_ < __y.__seg_ || (__x.__seg_ == __y.__seg_ && __x.__ctz_ < __y.__ctz_);}
+
+    _LIBCPP_INLINE_VISIBILITY friend bool operator>(const __bit_iterator& __x, const __bit_iterator& __y)
+        {return __y < __x;}
+
+    _LIBCPP_INLINE_VISIBILITY friend bool operator<=(const __bit_iterator& __x, const __bit_iterator& __y)
+        {return !(__y < __x);}
+
+    _LIBCPP_INLINE_VISIBILITY friend bool operator>=(const __bit_iterator& __x, const __bit_iterator& __y)
+        {return !(__x < __y);}
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    __bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
+        : __seg_(__s), __ctz_(__ctz) {}
+
+#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
+    friend typename _Cp::__self;
+#else
+    friend class _Cp::__self;
+#endif
+    friend class __bit_reference<_Cp>;
+    friend class __bit_const_reference<_Cp>;
+    friend class __bit_iterator<_Cp, true>;
+    template <class _Dp> friend struct __bit_array;
+    template <class _Dp> friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
+    template <class _Dp> friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
+    template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first,
+                                                                                  __bit_iterator<_Dp, _IC> __last,
+                                                                                  __bit_iterator<_Dp, false> __result);
+    template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first,
+                                                                                    __bit_iterator<_Dp, _IC> __last,
+                                                                                    __bit_iterator<_Dp, false> __result);
+    template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first,
+                                                                        __bit_iterator<_Dp, _IC> __last,
+                                                                        __bit_iterator<_Dp, false> __result);
+    template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first,
+                                                                                           __bit_iterator<_Dp, _IC> __last,
+                                                                                           __bit_iterator<_Dp, false> __result);
+    template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first,
+                                                                                             __bit_iterator<_Dp, _IC> __last,
+                                                                                             __bit_iterator<_Dp, false> __result);
+    template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first,
+                                                                                 __bit_iterator<_Dp, _IC> __last,
+                                                                                 __bit_iterator<_Dp, false> __result);
+    template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
+                                                                                           __bit_iterator<__C1, false>,
+                                                                                           __bit_iterator<__C2, false>);
+    template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false>,
+                                                                                             __bit_iterator<__C1, false>,
+                                                                                             __bit_iterator<__C2, false>);
+    template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
+                                                                                 __bit_iterator<__C1, false>,
+                                                                                 __bit_iterator<__C2, false>);
+    template <class _Dp> friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>,
+                                                                __bit_iterator<_Dp, false>,
+                                                                __bit_iterator<_Dp, false>);
+    template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>,
+                                                    __bit_iterator<_Dp, _IC1>,
+                                                    __bit_iterator<_Dp, _IC2>);
+    template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>,
+                                                      __bit_iterator<_Dp, _IC1>,
+                                                      __bit_iterator<_Dp, _IC2>);
+    template <class _Dp, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_Dp, _IC1>,
+                                                                __bit_iterator<_Dp, _IC1>,
+                                                                __bit_iterator<_Dp, _IC2>);
+    template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>,
+                                                                          typename _Dp::size_type);
+    template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>,
+                                                                           typename _Dp::size_type);
+    template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
+                   __count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
+    template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
+                   __count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP___BIT_REFERENCE

Property changes on: lab4/.minix-src/include/c++/__bit_reference
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/arpa/inet.h
===================================================================
--- lab4/.minix-src/include/arpa/inet.h	(nonexistent)
+++ lab4/.minix-src/include/arpa/inet.h	(revision 13)
@@ -0,0 +1,105 @@
+/*	$NetBSD: inet.h,v 1.24 2008/06/21 20:12:49 christos Exp $	*/
+
+/*
+ * ++Copyright++ 1983, 1993
+ * -
+ * Copyright (c) 1983, 1993
+ *    The Regents of the University of California.  All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ * 
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * -
+ * --Copyright--
+ */
+
+/*%
+ *	@(#)inet.h	8.1 (Berkeley) 6/2/93
+ *	Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp
+ */
+
+#ifndef _ARPA_INET_H_
+#define	_ARPA_INET_H_
+
+/* External definitions for functions in inet(3) */
+
+#include <sys/ansi.h>
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+#include <netinet/in.h>
+
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+#ifndef socklen_t
+typedef __socklen_t	socklen_t;
+#define socklen_t	__socklen_t
+#endif
+#endif /* _POSIX_C_SOURCE >= 200112 || XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */
+
+__BEGIN_DECLS
+in_addr_t	 inet_addr(const char *);
+in_addr_t	 inet_lnaof(struct in_addr);
+struct in_addr	 inet_makeaddr(in_addr_t, in_addr_t);
+in_addr_t	 inet_netof(struct in_addr);
+in_addr_t	 inet_network(const char *);
+char		*inet_ntoa(struct in_addr);
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+const char	*inet_ntop(int, const void * __restrict,
+		                char * __restrict, socklen_t);
+int		 inet_pton(int, const char * __restrict,
+		                void * __restrict);
+#endif
+#if defined(_NETBSD_SOURCE)
+int		 inet_aton(const char *, struct in_addr *);
+char *		 inet_neta(u_long, char *, size_t);
+char		*inet_net_ntop(int, const void *, int, char *, size_t);
+int		 inet_net_pton(int, const char *, void *, size_t);
+char		*inet_cidr_ntop(int, const void *, int, char *, size_t);
+int		 inet_cidr_pton(int, const char *, void *, int *);
+u_int		 inet_nsap_addr(const char *, u_char *, int);
+char		*inet_nsap_ntoa(int, const u_char *, char *);
+#endif
+__END_DECLS
+
+#endif /* _ARPA_INET_H_ */

Property changes on: lab4/.minix-src/include/arpa/inet.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/experimental/string_view
===================================================================
--- lab4/.minix-src/include/c++/experimental/string_view	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/string_view	(revision 13)
@@ -0,0 +1,812 @@
+// -*- C++ -*-
+//===------------------------ string_view ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_LFTS_STRING_VIEW
+#define _LIBCPP_LFTS_STRING_VIEW
+
+/*
+string_view synopsis
+
+namespace std {
+ namespace experimental {
+  inline namespace library_fundamentals_v1 {
+
+    // 7.2, Class template basic_string_view
+    template<class charT, class traits = char_traits<charT>>
+        class basic_string_view;
+
+    // 7.9, basic_string_view non-member comparison functions
+    template<class charT, class traits>
+    constexpr bool operator==(basic_string_view<charT, traits> x,
+                              basic_string_view<charT, traits> y) noexcept;
+    template<class charT, class traits>
+    constexpr bool operator!=(basic_string_view<charT, traits> x,
+                              basic_string_view<charT, traits> y) noexcept;
+    template<class charT, class traits>
+    constexpr bool operator< (basic_string_view<charT, traits> x,
+                                 basic_string_view<charT, traits> y) noexcept;
+    template<class charT, class traits>
+    constexpr bool operator> (basic_string_view<charT, traits> x,
+                              basic_string_view<charT, traits> y) noexcept;
+    template<class charT, class traits>
+    constexpr bool operator<=(basic_string_view<charT, traits> x,
+                                 basic_string_view<charT, traits> y) noexcept;
+    template<class charT, class traits>
+    constexpr bool operator>=(basic_string_view<charT, traits> x,
+                              basic_string_view<charT, traits> y) noexcept;
+    // see below, sufficient additional overloads of comparison functions
+
+    // 7.10, Inserters and extractors
+    template<class charT, class traits>
+      basic_ostream<charT, traits>&
+        operator<<(basic_ostream<charT, traits>& os,
+                   basic_string_view<charT, traits> str);
+
+    // basic_string_view typedef names
+    typedef basic_string_view<char> string_view;
+    typedef basic_string_view<char16_t> u16string_view;
+    typedef basic_string_view<char32_t> u32string_view;
+    typedef basic_string_view<wchar_t> wstring_view;
+
+    template<class charT, class traits = char_traits<charT>>
+    class basic_string_view {
+      public:
+      // types
+      typedef traits traits_type;
+      typedef charT value_type;
+      typedef charT* pointer;
+      typedef const charT* const_pointer;
+      typedef charT& reference;
+      typedef const charT& const_reference;
+      typedef implementation-defined const_iterator;
+      typedef const_iterator iterator;
+      typedef reverse_iterator<const_iterator> const_reverse_iterator;
+      typedef const_reverse_iterator reverse_iterator;
+      typedef size_t size_type;
+      typedef ptrdiff_t difference_type;
+      static constexpr size_type npos = size_type(-1);
+
+      // 7.3, basic_string_view constructors and assignment operators
+      constexpr basic_string_view() noexcept;
+      constexpr basic_string_view(const basic_string_view&) noexcept = default;
+      basic_string_view& operator=(const basic_string_view&) noexcept = default;
+      template<class Allocator>
+      basic_string_view(const basic_string<charT, traits, Allocator>& str) noexcept;
+      constexpr basic_string_view(const charT* str);
+      constexpr basic_string_view(const charT* str, size_type len);
+
+      // 7.4, basic_string_view iterator support
+      constexpr const_iterator begin() const noexcept;
+      constexpr const_iterator end() const noexcept;
+      constexpr const_iterator cbegin() const noexcept;
+      constexpr const_iterator cend() const noexcept;
+      const_reverse_iterator rbegin() const noexcept;
+      const_reverse_iterator rend() const noexcept;
+      const_reverse_iterator crbegin() const noexcept;
+      const_reverse_iterator crend() const noexcept;
+
+      // 7.5, basic_string_view capacity
+      constexpr size_type size() const noexcept;
+      constexpr size_type length() const noexcept;
+      constexpr size_type max_size() const noexcept;
+      constexpr bool empty() const noexcept;
+
+      // 7.6, basic_string_view element access
+      constexpr const_reference operator[](size_type pos) const;
+      constexpr const_reference at(size_type pos) const;
+      constexpr const_reference front() const;
+      constexpr const_reference back() const;
+      constexpr const_pointer data() const noexcept;
+
+      // 7.7, basic_string_view modifiers
+      constexpr void clear() noexcept;
+      constexpr void remove_prefix(size_type n);
+      constexpr void remove_suffix(size_type n);
+      constexpr void swap(basic_string_view& s) noexcept;
+
+      // 7.8, basic_string_view string operations
+      template<class Allocator>
+      explicit operator basic_string<charT, traits, Allocator>() const;
+      template<class Allocator = allocator<charT>>
+      basic_string<charT, traits, Allocator> to_string(
+        const Allocator& a = Allocator()) const;
+
+      size_type copy(charT* s, size_type n, size_type pos = 0) const;
+
+      constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
+      constexpr int compare(basic_string_view s) const noexcept;
+      constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const;
+      constexpr int compare(size_type pos1, size_type n1,
+                            basic_string_view s, size_type pos2, size_type n2) const;
+      constexpr int compare(const charT* s) const;
+      constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
+      constexpr int compare(size_type pos1, size_type n1,
+                            const charT* s, size_type n2) const;
+      constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
+      constexpr size_type find(charT c, size_type pos = 0) const noexcept;
+      constexpr size_type find(const charT* s, size_type pos, size_type n) const;
+      constexpr size_type find(const charT* s, size_type pos = 0) const;
+      constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept;
+      constexpr size_type rfind(charT c, size_type pos = npos) const noexcept;
+      constexpr size_type rfind(const charT* s, size_type pos, size_type n) const;
+      constexpr size_type rfind(const charT* s, size_type pos = npos) const;
+      constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept;
+      constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept;
+      constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const;
+      constexpr size_type find_first_of(const charT* s, size_type pos = 0) const;
+      constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept;
+      constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept;
+      constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const;
+      constexpr size_type find_last_of(const charT* s, size_type pos = npos) const;
+      constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept;
+      constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
+      constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
+      constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const;
+      constexpr size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept;
+      constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept;
+      constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const;
+      constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const;
+
+     private:
+      const_pointer data_;  // exposition only
+      size_type     size_;  // exposition only
+    };
+
+  }  // namespace fundamentals_v1
+ }  // namespace experimental
+
+  // 7.11, Hash support
+  template <class T> struct hash;
+  template <> struct hash<experimental::string_view>;
+  template <> struct hash<experimental::u16string_view>;
+  template <> struct hash<experimental::u32string_view>;
+  template <> struct hash<experimental::wstring_view>;
+
+}  // namespace std
+
+
+*/
+
+#include <experimental/__config>
+
+#include <string>
+#include <algorithm>
+#include <iterator>
+#include <ostream>
+#include <iomanip>
+
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
+    template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_string_view {
+    public:
+        // types
+        typedef _Traits                                    traits_type;
+        typedef _CharT                                     value_type;
+        typedef const _CharT*                              pointer;
+        typedef const _CharT*                              const_pointer;
+        typedef const _CharT&                              reference;
+        typedef const _CharT&                              const_reference;
+        typedef const_pointer                              const_iterator; // See [string.view.iterators]
+        typedef const_iterator                             iterator;
+        typedef _VSTD::reverse_iterator<const_iterator>    const_reverse_iterator;
+        typedef const_reverse_iterator                     reverse_iterator;
+        typedef size_t                                     size_type;
+        typedef ptrdiff_t                                  difference_type;
+        static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
+
+        // [string.view.cons], construct/copy
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {}
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        basic_string_view(const basic_string_view&) _NOEXCEPT = default;
+
+        _LIBCPP_INLINE_VISIBILITY
+        basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
+
+        template<class _Allocator>
+        _LIBCPP_INLINE_VISIBILITY
+        basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& __str) _NOEXCEPT
+            : __data (__str.data()), __size(__str.size()) {}
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        basic_string_view(const _CharT* __s, size_type __len)
+            : __data(__s), __size(__len)
+        {
+//             _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): recieved nullptr");
+        }
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        basic_string_view(const _CharT* __s)
+            : __data(__s), __size(_Traits::length(__s)) {}
+
+        // [string.view.iterators], iterators
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        const_iterator begin()  const _NOEXCEPT { return cbegin(); }
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        const_iterator end()    const _NOEXCEPT { return cend(); }
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        const_iterator cbegin() const _NOEXCEPT { return __data; }
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        const_iterator cend()   const _NOEXCEPT { return __data + __size; }
+
+        _LIBCPP_INLINE_VISIBILITY
+        const_reverse_iterator rbegin()   const _NOEXCEPT { return const_reverse_iterator(cend()); }
+
+        _LIBCPP_INLINE_VISIBILITY
+        const_reverse_iterator rend()     const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
+
+        _LIBCPP_INLINE_VISIBILITY
+        const_reverse_iterator crbegin()  const _NOEXCEPT { return const_reverse_iterator(cend()); }
+
+        _LIBCPP_INLINE_VISIBILITY
+        const_reverse_iterator crend()    const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
+
+        // [string.view.capacity], capacity
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        size_type size()     const _NOEXCEPT { return __size; }
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        size_type length()   const _NOEXCEPT { return __size; }
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        size_type max_size() const _NOEXCEPT { return _VSTD::numeric_limits<size_type>::max(); }
+
+        _LIBCPP_CONSTEXPR bool _LIBCPP_INLINE_VISIBILITY
+        empty()         const _NOEXCEPT { return __size == 0; }
+
+        // [string.view.access], element access
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        const_reference operator[](size_type __pos) const { return __data[__pos]; }
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        const_reference at(size_type __pos) const
+        {
+            return __pos >= size()
+                ? (throw out_of_range("string_view::at"), __data[0])
+                : __data[__pos];
+        }
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        const_reference front() const
+        {
+            return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0];
+        }
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        const_reference back() const
+        {
+            return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1];
+        }
+
+        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+        const_pointer data() const _NOEXCEPT { return __data; }
+
+        // [string.view.modifiers], modifiers:
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        void clear() _NOEXCEPT
+        {
+            __data = nullptr;
+            __size = 0;
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        void remove_prefix(size_type __n) _NOEXCEPT
+        {
+            _LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()");
+            __data += __n;
+            __size -= __n;
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        void remove_suffix(size_type __n) _NOEXCEPT
+        {
+            _LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()");
+            __size -= __n;
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        void swap(basic_string_view& __other) _NOEXCEPT
+        {
+            const value_type *__p = __data;
+            __data = __other.__data;
+            __other.__data = __p;
+
+            size_type __sz = __size;
+            __size = __other.__size;
+            __other.__size = __sz;
+//             _VSTD::swap( __data, __other.__data );
+//             _VSTD::swap( __size, __other.__size );
+        }
+
+        // [string.view.ops], string operations:
+        template<class _Allocator>
+        _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_EXPLICIT operator basic_string<_CharT, _Traits, _Allocator>() const
+        { return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); }
+
+        template<class _Allocator = allocator<_CharT> >
+        _LIBCPP_INLINE_VISIBILITY
+        basic_string<_CharT, _Traits, _Allocator>
+        to_string( const _Allocator& __a = _Allocator()) const
+        { return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); }
+
+        size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
+        {
+            if ( __pos > size())
+                throw out_of_range("string_view::copy");
+            size_type __rlen = _VSTD::min( __n, size() - __pos );
+            _VSTD::copy_n(begin() + __pos, __rlen, __s );
+            return __rlen;
+        }
+
+        _LIBCPP_CONSTEXPR
+        basic_string_view substr(size_type __pos = 0, size_type __n = npos) const
+        {
+//             if (__pos > size())
+//                 throw out_of_range("string_view::substr");
+//             size_type __rlen = _VSTD::min( __n, size() - __pos );
+//             return basic_string_view(data() + __pos, __rlen);
+            return __pos > size()
+                ? throw out_of_range("string_view::substr")
+                : basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos));
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT
+        {
+            size_type __rlen = _VSTD::min( size(), __sv.size());
+            int __retval = _Traits::compare(data(), __sv.data(), __rlen);
+            if ( __retval == 0 ) // first __rlen chars matched
+                __retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 );
+            return __retval;
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const
+        {
+            return substr(__pos1, __n1).compare(__sv);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        int compare(                       size_type __pos1, size_type __n1, 
+                    basic_string_view _sv, size_type __pos2, size_type __n2) const
+        {
+            return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2));
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        int compare(const _CharT* __s) const
+        {
+            return compare(basic_string_view(__s));
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
+        {
+            return substr(__pos1, __n1).compare(basic_string_view(__s));
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
+        {
+            return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
+        }
+
+        // find
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
+        {
+            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr");
+            return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+                (data(), size(), __s.data(), __pos, __s.size());
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT
+        {
+            return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+                (data(), size(), __c, __pos);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find(const _CharT* __s, size_type __pos, size_type __n) const
+        {
+            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): recieved nullptr");
+            return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, __n);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find(const _CharT* __s, size_type __pos = 0) const
+        {
+            _LIBCPP_ASSERT(__s != nullptr, "string_view::find(): recieved nullptr");
+            return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, traits_type::length(__s));
+        }
+
+        // rfind
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT
+        {
+            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr");
+            return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
+                (data(), size(), __s.data(), __pos, __s.size());
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT
+        {
+            return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
+                (data(), size(), __c, __pos);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const
+        {
+            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): recieved nullptr");
+            return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, __n);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type rfind(const _CharT* __s, size_type __pos=npos) const
+        {
+            _LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): recieved nullptr");
+            return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, traits_type::length(__s));
+        }
+
+        // find_first_of
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
+        {
+            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): recieved nullptr");
+            return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s.data(), __pos, __s.size());
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT
+        { return find(__c, __pos); }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
+        {
+            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): recieved nullptr");
+            return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, __n);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_first_of(const _CharT* __s, size_type __pos=0) const
+        {
+            _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): recieved nullptr");
+            return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, traits_type::length(__s));
+        }
+
+        // find_last_of
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
+        {
+            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): recieved nullptr");
+            return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s.data(), __pos, __s.size());
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT
+        { return rfind(__c, __pos); }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
+        {
+            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): recieved nullptr");
+            return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, __n);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_last_of(const _CharT* __s, size_type __pos=npos) const
+        {
+            _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): recieved nullptr");
+            return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, traits_type::length(__s));
+        }
+
+        // find_first_not_of
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
+        {
+            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): recieved nullptr");
+            return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s.data(), __pos, __s.size());
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
+        {
+            return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __c, __pos);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+        {
+            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): recieved nullptr");
+            return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, __n);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const
+        {
+            _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): recieved nullptr");
+            return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, traits_type::length(__s));
+        }
+
+        // find_last_not_of
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
+        {
+            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): recieved nullptr");
+            return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s.data(), __pos, __s.size());
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
+        {
+            return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __c, __pos);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+        {
+            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): recieved nullptr");
+            return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, __n);
+        }
+
+        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+        size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const
+        {
+            _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): recieved nullptr");
+            return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
+                (data(), size(), __s, __pos, traits_type::length(__s));
+        }
+
+    private:
+        const   value_type* __data;
+        size_type           __size;
+    };
+
+
+    // [string.view.comparison]
+    // operator ==
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator==(basic_string_view<_CharT, _Traits> __lhs,
+                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        if ( __lhs.size() != __rhs.size()) return false;
+        return __lhs.compare(__rhs) == 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator==(basic_string_view<_CharT, _Traits> __lhs,
+                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
+    {
+        if ( __lhs.size() != __rhs.size()) return false;
+        return __lhs.compare(__rhs) == 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator==(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        if ( __lhs.size() != __rhs.size()) return false;
+        return __lhs.compare(__rhs) == 0;
+    }
+
+
+    // operator !=
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        if ( __lhs.size() != __rhs.size())
+            return true;
+        return __lhs.compare(__rhs) != 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
+                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
+    {
+        if ( __lhs.size() != __rhs.size())
+            return true;
+        return __lhs.compare(__rhs) != 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        if ( __lhs.size() != __rhs.size())
+            return true;
+        return __lhs.compare(__rhs) != 0;
+    }
+
+
+    // operator <
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) < 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator<(basic_string_view<_CharT, _Traits> __lhs,
+                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) < 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) < 0;
+    }
+
+
+    // operator >
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) > 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator>(basic_string_view<_CharT, _Traits> __lhs,
+                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) > 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator>(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) > 0;
+    }
+
+
+    // operator <=
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) <= 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
+                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) <= 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) <= 0;
+    }
+
+
+    // operator >=
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) >= 0;
+    }
+
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
+                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) >= 0;
+    }
+
+    template<class _CharT, class _Traits>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator>=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
+                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
+    {
+        return __lhs.compare(__rhs) >= 0;
+    }
+
+
+    // [string.view.io]
+    template<class _CharT, class _Traits>
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv)
+    {
+        return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size());
+    }
+
+  typedef basic_string_view<char>     string_view;
+  typedef basic_string_view<char16_t> u16string_view;
+  typedef basic_string_view<char32_t> u32string_view;
+  typedef basic_string_view<wchar_t>  wstring_view;
+
+_LIBCPP_END_NAMESPACE_LFTS
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// [string.view.hash]
+// Shamelessly stolen from <string>
+template<class _CharT, class _Traits>
+struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::basic_string_view<_CharT, _Traits> >
+    : public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t>
+{
+    size_t operator()(const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT;
+};
+
+template<class _CharT, class _Traits>
+size_t
+hash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()(
+        const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT
+{
+    return __do_string_hash(__val.data(), __val.data() + __val.size());
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _CharT, class _Traits>
+__quoted_output_proxy<_CharT, const _CharT *, _Traits>
+quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv,
+             _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
+{
+    return __quoted_output_proxy<_CharT, const _CharT *, _Traits> 
+         ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
+}
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_LFTS_STRING_VIEW

Property changes on: lab4/.minix-src/include/c++/experimental/string_view
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__functional_03
===================================================================
--- lab4/.minix-src/include/c++/__functional_03	(nonexistent)
+++ lab4/.minix-src/include/c++/__functional_03	(revision 13)
@@ -0,0 +1,1576 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_FUNCTIONAL_03
+#define _LIBCPP_FUNCTIONAL_03
+
+// manual variadic expansion for <functional>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+namespace __function {
+
+template<class _Fp> class __base;
+
+template<class _Rp>
+class __base<_Rp()>
+{
+    __base(const __base&);
+    __base& operator=(const __base&);
+public:
+    __base() {}
+    virtual ~__base() {}
+    virtual __base* __clone() const = 0;
+    virtual void __clone(__base*) const = 0;
+    virtual void destroy() = 0;
+    virtual void destroy_deallocate() = 0;
+    virtual _Rp operator()() = 0;
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* target(const type_info&) const = 0;
+    virtual const std::type_info& target_type() const = 0;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Rp, class _A0>
+class __base<_Rp(_A0)>
+{
+    __base(const __base&);
+    __base& operator=(const __base&);
+public:
+    __base() {}
+    virtual ~__base() {}
+    virtual __base* __clone() const = 0;
+    virtual void __clone(__base*) const = 0;
+    virtual void destroy() = 0;
+    virtual void destroy_deallocate() = 0;
+    virtual _Rp operator()(_A0) = 0;
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* target(const type_info&) const = 0;
+    virtual const std::type_info& target_type() const = 0;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Rp, class _A0, class _A1>
+class __base<_Rp(_A0, _A1)>
+{
+    __base(const __base&);
+    __base& operator=(const __base&);
+public:
+    __base() {}
+    virtual ~__base() {}
+    virtual __base* __clone() const = 0;
+    virtual void __clone(__base*) const = 0;
+    virtual void destroy() = 0;
+    virtual void destroy_deallocate() = 0;
+    virtual _Rp operator()(_A0, _A1) = 0;
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* target(const type_info&) const = 0;
+    virtual const std::type_info& target_type() const = 0;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Rp, class _A0, class _A1, class _A2>
+class __base<_Rp(_A0, _A1, _A2)>
+{
+    __base(const __base&);
+    __base& operator=(const __base&);
+public:
+    __base() {}
+    virtual ~__base() {}
+    virtual __base* __clone() const = 0;
+    virtual void __clone(__base*) const = 0;
+    virtual void destroy() = 0;
+    virtual void destroy_deallocate() = 0;
+    virtual _Rp operator()(_A0, _A1, _A2) = 0;
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* target(const type_info&) const = 0;
+    virtual const std::type_info& target_type() const = 0;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _FD, class _Alloc, class _FB> class __func;
+
+template<class _Fp, class _Alloc, class _Rp>
+class __func<_Fp, _Alloc, _Rp()>
+    : public  __base<_Rp()>
+{
+    __compressed_pair<_Fp, _Alloc> __f_;
+public:
+    explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+    explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
+    virtual __base<_Rp()>* __clone() const;
+    virtual void __clone(__base<_Rp()>*) const;
+    virtual void destroy();
+    virtual void destroy_deallocate();
+    virtual _Rp operator()();
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* target(const type_info&) const;
+    virtual const std::type_info& target_type() const;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Fp, class _Alloc, class _Rp>
+__base<_Rp()>*
+__func<_Fp, _Alloc, _Rp()>::__clone() const
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
+    _Ap __a(__f_.second());
+    typedef __allocator_destructor<_Ap> _Dp;
+    unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+    ::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
+    return __hold.release();
+}
+
+template<class _Fp, class _Alloc, class _Rp>
+void
+__func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const
+{
+    ::new (__p) __func(__f_.first(), __f_.second());
+}
+
+template<class _Fp, class _Alloc, class _Rp>
+void
+__func<_Fp, _Alloc, _Rp()>::destroy()
+{
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+}
+
+template<class _Fp, class _Alloc, class _Rp>
+void
+__func<_Fp, _Alloc, _Rp()>::destroy_deallocate()
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
+    _Ap __a(__f_.second());
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+    __a.deallocate(this, 1);
+}
+
+template<class _Fp, class _Alloc, class _Rp>
+_Rp
+__func<_Fp, _Alloc, _Rp()>::operator()()
+{
+    typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+    return _Invoker::__call(__f_.first());
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Fp, class _Alloc, class _Rp>
+const void*
+__func<_Fp, _Alloc, _Rp()>::target(const type_info& __ti) const
+{
+    if (__ti == typeid(_Fp))
+        return &__f_.first();
+    return (const void*)0;
+}
+
+template<class _Fp, class _Alloc, class _Rp>
+const std::type_info&
+__func<_Fp, _Alloc, _Rp()>::target_type() const
+{
+    return typeid(_Fp);
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+class __func<_Fp, _Alloc, _Rp(_A0)>
+    : public  __base<_Rp(_A0)>
+{
+    __compressed_pair<_Fp, _Alloc> __f_;
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+    _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
+        : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
+    virtual __base<_Rp(_A0)>* __clone() const;
+    virtual void __clone(__base<_Rp(_A0)>*) const;
+    virtual void destroy();
+    virtual void destroy_deallocate();
+    virtual _Rp operator()(_A0);
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* target(const type_info&) const;
+    virtual const std::type_info& target_type() const;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+__base<_Rp(_A0)>*
+__func<_Fp, _Alloc, _Rp(_A0)>::__clone() const
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
+    _Ap __a(__f_.second());
+    typedef __allocator_destructor<_Ap> _Dp;
+    unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+    ::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
+    return __hold.release();
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+void
+__func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const
+{
+    ::new (__p) __func(__f_.first(), __f_.second());
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+void
+__func<_Fp, _Alloc, _Rp(_A0)>::destroy()
+{
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+void
+__func<_Fp, _Alloc, _Rp(_A0)>::destroy_deallocate()
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
+    _Ap __a(__f_.second());
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+    __a.deallocate(this, 1);
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+_Rp
+__func<_Fp, _Alloc, _Rp(_A0)>::operator()(_A0 __a0)
+{
+    typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+    return _Invoker::__call(__f_.first(), __a0);
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+const void*
+__func<_Fp, _Alloc, _Rp(_A0)>::target(const type_info& __ti) const
+{
+    if (__ti == typeid(_Fp))
+        return &__f_.first();
+    return (const void*)0;
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+const std::type_info&
+__func<_Fp, _Alloc, _Rp(_A0)>::target_type() const
+{
+    return typeid(_Fp);
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+class __func<_Fp, _Alloc, _Rp(_A0, _A1)>
+    : public  __base<_Rp(_A0, _A1)>
+{
+    __compressed_pair<_Fp, _Alloc> __f_;
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+    _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
+        : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
+    virtual __base<_Rp(_A0, _A1)>* __clone() const;
+    virtual void __clone(__base<_Rp(_A0, _A1)>*) const;
+    virtual void destroy();
+    virtual void destroy_deallocate();
+    virtual _Rp operator()(_A0, _A1);
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* target(const type_info&) const;
+    virtual const std::type_info& target_type() const;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+__base<_Rp(_A0, _A1)>*
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
+    _Ap __a(__f_.second());
+    typedef __allocator_destructor<_Ap> _Dp;
+    unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+    ::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
+    return __hold.release();
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+void
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const
+{
+    ::new (__p) __func(__f_.first(), __f_.second());
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+void
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy()
+{
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+void
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy_deallocate()
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
+    _Ap __a(__f_.second());
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+    __a.deallocate(this, 1);
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+_Rp
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1)
+{
+    typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+    return _Invoker::__call(__f_.first(), __a0, __a1);
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+const void*
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::target(const type_info& __ti) const
+{
+    if (__ti == typeid(_Fp))
+        return &__f_.first();
+    return (const void*)0;
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+const std::type_info&
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::target_type() const
+{
+    return typeid(_Fp);
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>
+    : public  __base<_Rp(_A0, _A1, _A2)>
+{
+    __compressed_pair<_Fp, _Alloc> __f_;
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+    _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
+        : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
+    virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const;
+    virtual void __clone(__base<_Rp(_A0, _A1, _A2)>*) const;
+    virtual void destroy();
+    virtual void destroy_deallocate();
+    virtual _Rp operator()(_A0, _A1, _A2);
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* target(const type_info&) const;
+    virtual const std::type_info& target_type() const;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+__base<_Rp(_A0, _A1, _A2)>*
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
+    _Ap __a(__f_.second());
+    typedef __allocator_destructor<_Ap> _Dp;
+    unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+    ::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
+    return __hold.release();
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+void
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const
+{
+    ::new (__p) __func(__f_.first(), __f_.second());
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+void
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy()
+{
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+void
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy_deallocate()
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
+    _Ap __a(__f_.second());
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+    __a.deallocate(this, 1);
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+_Rp
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2)
+{
+    typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+    return _Invoker::__call(__f_.first(), __a0, __a1, __a2);
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+const void*
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target(const type_info& __ti) const
+{
+    if (__ti == typeid(_Fp))
+        return &__f_.first();
+    return (const void*)0;
+}
+
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+const std::type_info&
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target_type() const
+{
+    return typeid(_Fp);
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+}  // __function
+
+template<class _Rp>
+class _LIBCPP_TYPE_VIS_ONLY function<_Rp()>
+{
+    typedef __function::__base<_Rp()> __base;
+    aligned_storage<3*sizeof(void*)>::type __buf_;
+    __base* __f_;
+
+public:
+    typedef _Rp result_type;
+
+    // 20.7.16.2.1, construct/copy/destroy:
+    _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
+    _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
+    function(const function&);
+    template<class _Fp>
+      function(_Fp,
+               typename enable_if<!is_integral<_Fp>::value>::type* = 0);
+
+    template<class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      function(allocator_arg_t, const _Alloc&) : __f_(0) {}
+    template<class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
+    template<class _Alloc>
+      function(allocator_arg_t, const _Alloc&, const function&);
+    template<class _Fp, class _Alloc>
+      function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+               typename enable_if<!is_integral<_Fp>::value>::type* = 0);
+
+    function& operator=(const function&);
+    function& operator=(nullptr_t);
+    template<class _Fp>
+      typename enable_if
+      <
+        !is_integral<_Fp>::value,
+        function&
+      >::type
+      operator=(_Fp);
+
+    ~function();
+
+    // 20.7.16.2.2, function modifiers:
+    void swap(function&);
+    template<class _Fp, class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      void assign(_Fp __f, const _Alloc& __a)
+        {function(allocator_arg, __a, __f).swap(*this);}
+
+    // 20.7.16.2.3, function capacity:
+    _LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
+
+private:
+    // deleted overloads close possible hole in the type system
+    template<class _R2>
+      bool operator==(const function<_R2()>&) const;// = delete;
+    template<class _R2>
+      bool operator!=(const function<_R2()>&) const;// = delete;
+public:
+    // 20.7.16.2.4, function invocation:
+    _Rp operator()() const;
+
+#ifndef _LIBCPP_NO_RTTI
+    // 20.7.16.2.5, function target access:
+    const std::type_info& target_type() const;
+    template <typename _Tp> _Tp* target();
+    template <typename _Tp> const _Tp* target() const;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Rp>
+function<_Rp()>::function(const function& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (const __base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+        __f_ = __f.__f_->__clone();
+}
+
+template<class _Rp>
+template<class _Alloc>
+function<_Rp()>::function(allocator_arg_t, const _Alloc&, const function& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (const __base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+        __f_ = __f.__f_->__clone();
+}
+
+template<class _Rp>
+template <class _Fp>
+function<_Rp()>::function(_Fp __f,
+                                     typename enable_if<!is_integral<_Fp>::value>::type*)
+    : __f_(0)
+{
+    if (__function::__not_null(__f))
+    {
+        typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF;
+        if (sizeof(_FF) <= sizeof(__buf_))
+        {
+            __f_ = (__base*)&__buf_;
+            ::new (__f_) _FF(__f);
+        }
+        else
+        {
+            typedef allocator<_FF> _Ap;
+            _Ap __a;
+            typedef __allocator_destructor<_Ap> _Dp;
+            unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+            ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
+            __f_ = __hold.release();
+        }
+    }
+}
+
+template<class _Rp>
+template <class _Fp, class _Alloc>
+function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+                                     typename enable_if<!is_integral<_Fp>::value>::type*)
+    : __f_(0)
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    if (__function::__not_null(__f))
+    {
+        typedef __function::__func<_Fp, _Alloc, _Rp()> _FF;
+        if (sizeof(_FF) <= sizeof(__buf_))
+        {
+            __f_ = (__base*)&__buf_;
+            ::new (__f_) _FF(__f, __a0);
+        }
+        else
+        {
+            typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
+            _Ap __a(__a0);
+            typedef __allocator_destructor<_Ap> _Dp;
+            unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+            ::new (__hold.get()) _FF(__f, _Alloc(__a));
+            __f_ = __hold.release();
+        }
+    }
+}
+
+template<class _Rp>
+function<_Rp()>&
+function<_Rp()>::operator=(const function& __f)
+{
+    function(__f).swap(*this);
+    return *this;
+}
+
+template<class _Rp>
+function<_Rp()>&
+function<_Rp()>::operator=(nullptr_t)
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+    __f_ = 0;
+    return *this;
+}
+
+template<class _Rp>
+template <class _Fp>
+typename enable_if
+<
+    !is_integral<_Fp>::value,
+    function<_Rp()>&
+>::type
+function<_Rp()>::operator=(_Fp __f)
+{
+    function(_VSTD::move(__f)).swap(*this);
+    return *this;
+}
+
+template<class _Rp>
+function<_Rp()>::~function()
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+}
+
+template<class _Rp>
+void
+function<_Rp()>::swap(function& __f)
+{
+    if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
+    {
+        typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
+        __base* __t = (__base*)&__tempbuf;
+        __f_->__clone(__t);
+        __f_->destroy();
+        __f_ = 0;
+        __f.__f_->__clone((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = 0;
+        __f_ = (__base*)&__buf_;
+        __t->__clone((__base*)&__f.__buf_);
+        __t->destroy();
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f_ == (__base*)&__buf_)
+    {
+        __f_->__clone((__base*)&__f.__buf_);
+        __f_->destroy();
+        __f_ = __f.__f_;
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f.__f_->__clone((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = __f_;
+        __f_ = (__base*)&__buf_;
+    }
+    else
+        _VSTD::swap(__f_, __f.__f_);
+}
+
+template<class _Rp>
+_Rp
+function<_Rp()>::operator()() const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__f_ == 0)
+        throw bad_function_call();
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return (*__f_)();
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Rp>
+const std::type_info&
+function<_Rp()>::target_type() const
+{
+    if (__f_ == 0)
+        return typeid(void);
+    return __f_->target_type();
+}
+
+template<class _Rp>
+template <typename _Tp>
+_Tp*
+function<_Rp()>::target()
+{
+    if (__f_ == 0)
+        return (_Tp*)0;
+    return (_Tp*)__f_->target(typeid(_Tp));
+}
+
+template<class _Rp>
+template <typename _Tp>
+const _Tp*
+function<_Rp()>::target() const
+{
+    if (__f_ == 0)
+        return (const _Tp*)0;
+    return (const _Tp*)__f_->target(typeid(_Tp));
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+template<class _Rp, class _A0>
+class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0)>
+    : public unary_function<_A0, _Rp>
+{
+    typedef __function::__base<_Rp(_A0)> __base;
+    aligned_storage<3*sizeof(void*)>::type __buf_;
+    __base* __f_;
+
+public:
+    typedef _Rp result_type;
+
+    // 20.7.16.2.1, construct/copy/destroy:
+    _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
+    _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
+    function(const function&);
+    template<class _Fp>
+      function(_Fp,
+               typename enable_if<!is_integral<_Fp>::value>::type* = 0);
+
+    template<class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      function(allocator_arg_t, const _Alloc&) : __f_(0) {}
+    template<class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
+    template<class _Alloc>
+      function(allocator_arg_t, const _Alloc&, const function&);
+    template<class _Fp, class _Alloc>
+      function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+               typename enable_if<!is_integral<_Fp>::value>::type* = 0);
+
+    function& operator=(const function&);
+    function& operator=(nullptr_t);
+    template<class _Fp>
+      typename enable_if
+      <
+        !is_integral<_Fp>::value,
+        function&
+      >::type
+      operator=(_Fp);
+
+    ~function();
+
+    // 20.7.16.2.2, function modifiers:
+    void swap(function&);
+    template<class _Fp, class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      void assign(_Fp __f, const _Alloc& __a)
+        {function(allocator_arg, __a, __f).swap(*this);}
+
+    // 20.7.16.2.3, function capacity:
+    _LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
+
+private:
+    // deleted overloads close possible hole in the type system
+    template<class _R2, class _B0>
+      bool operator==(const function<_R2(_B0)>&) const;// = delete;
+    template<class _R2, class _B0>
+      bool operator!=(const function<_R2(_B0)>&) const;// = delete;
+public:
+    // 20.7.16.2.4, function invocation:
+    _Rp operator()(_A0) const;
+
+#ifndef _LIBCPP_NO_RTTI
+    // 20.7.16.2.5, function target access:
+    const std::type_info& target_type() const;
+    template <typename _Tp> _Tp* target();
+    template <typename _Tp> const _Tp* target() const;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Rp, class _A0>
+function<_Rp(_A0)>::function(const function& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (const __base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+        __f_ = __f.__f_->__clone();
+}
+
+template<class _Rp, class _A0>
+template<class _Alloc>
+function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (const __base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+        __f_ = __f.__f_->__clone();
+}
+
+template<class _Rp, class _A0>
+template <class _Fp>
+function<_Rp(_A0)>::function(_Fp __f,
+                                     typename enable_if<!is_integral<_Fp>::value>::type*)
+    : __f_(0)
+{
+    if (__function::__not_null(__f))
+    {
+        typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF;
+        if (sizeof(_FF) <= sizeof(__buf_))
+        {
+            __f_ = (__base*)&__buf_;
+            ::new (__f_) _FF(__f);
+        }
+        else
+        {
+            typedef allocator<_FF> _Ap;
+            _Ap __a;
+            typedef __allocator_destructor<_Ap> _Dp;
+            unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+            ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
+            __f_ = __hold.release();
+        }
+    }
+}
+
+template<class _Rp, class _A0>
+template <class _Fp, class _Alloc>
+function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+                                     typename enable_if<!is_integral<_Fp>::value>::type*)
+    : __f_(0)
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    if (__function::__not_null(__f))
+    {
+        typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF;
+        if (sizeof(_FF) <= sizeof(__buf_))
+        {
+            __f_ = (__base*)&__buf_;
+            ::new (__f_) _FF(__f, __a0);
+        }
+        else
+        {
+            typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
+            _Ap __a(__a0);
+            typedef __allocator_destructor<_Ap> _Dp;
+            unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+            ::new (__hold.get()) _FF(__f, _Alloc(__a));
+            __f_ = __hold.release();
+        }
+    }
+}
+
+template<class _Rp, class _A0>
+function<_Rp(_A0)>&
+function<_Rp(_A0)>::operator=(const function& __f)
+{
+    function(__f).swap(*this);
+    return *this;
+}
+
+template<class _Rp, class _A0>
+function<_Rp(_A0)>&
+function<_Rp(_A0)>::operator=(nullptr_t)
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+    __f_ = 0;
+    return *this;
+}
+
+template<class _Rp, class _A0>
+template <class _Fp>
+typename enable_if
+<
+    !is_integral<_Fp>::value,
+    function<_Rp(_A0)>&
+>::type
+function<_Rp(_A0)>::operator=(_Fp __f)
+{
+    function(_VSTD::move(__f)).swap(*this);
+    return *this;
+}
+
+template<class _Rp, class _A0>
+function<_Rp(_A0)>::~function()
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+}
+
+template<class _Rp, class _A0>
+void
+function<_Rp(_A0)>::swap(function& __f)
+{
+    if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
+    {
+        typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
+        __base* __t = (__base*)&__tempbuf;
+        __f_->__clone(__t);
+        __f_->destroy();
+        __f_ = 0;
+        __f.__f_->__clone((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = 0;
+        __f_ = (__base*)&__buf_;
+        __t->__clone((__base*)&__f.__buf_);
+        __t->destroy();
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f_ == (__base*)&__buf_)
+    {
+        __f_->__clone((__base*)&__f.__buf_);
+        __f_->destroy();
+        __f_ = __f.__f_;
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f.__f_->__clone((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = __f_;
+        __f_ = (__base*)&__buf_;
+    }
+    else
+        _VSTD::swap(__f_, __f.__f_);
+}
+
+template<class _Rp, class _A0>
+_Rp
+function<_Rp(_A0)>::operator()(_A0 __a0) const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__f_ == 0)
+        throw bad_function_call();
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return (*__f_)(__a0);
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Rp, class _A0>
+const std::type_info&
+function<_Rp(_A0)>::target_type() const
+{
+    if (__f_ == 0)
+        return typeid(void);
+    return __f_->target_type();
+}
+
+template<class _Rp, class _A0>
+template <typename _Tp>
+_Tp*
+function<_Rp(_A0)>::target()
+{
+    if (__f_ == 0)
+        return (_Tp*)0;
+    return (_Tp*)__f_->target(typeid(_Tp));
+}
+
+template<class _Rp, class _A0>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_A0)>::target() const
+{
+    if (__f_ == 0)
+        return (const _Tp*)0;
+    return (const _Tp*)__f_->target(typeid(_Tp));
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+template<class _Rp, class _A0, class _A1>
+class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1)>
+    : public binary_function<_A0, _A1, _Rp>
+{
+    typedef __function::__base<_Rp(_A0, _A1)> __base;
+    aligned_storage<3*sizeof(void*)>::type __buf_;
+    __base* __f_;
+
+public:
+    typedef _Rp result_type;
+
+    // 20.7.16.2.1, construct/copy/destroy:
+    _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
+    _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
+    function(const function&);
+    template<class _Fp>
+      function(_Fp,
+               typename enable_if<!is_integral<_Fp>::value>::type* = 0);
+
+    template<class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      function(allocator_arg_t, const _Alloc&) : __f_(0) {}
+    template<class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
+    template<class _Alloc>
+      function(allocator_arg_t, const _Alloc&, const function&);
+    template<class _Fp, class _Alloc>
+      function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+               typename enable_if<!is_integral<_Fp>::value>::type* = 0);
+
+    function& operator=(const function&);
+    function& operator=(nullptr_t);
+    template<class _Fp>
+      typename enable_if
+      <
+        !is_integral<_Fp>::value,
+        function&
+      >::type
+      operator=(_Fp);
+
+    ~function();
+
+    // 20.7.16.2.2, function modifiers:
+    void swap(function&);
+    template<class _Fp, class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      void assign(_Fp __f, const _Alloc& __a)
+        {function(allocator_arg, __a, __f).swap(*this);}
+
+    // 20.7.16.2.3, function capacity:
+    operator bool() const {return __f_;}
+
+private:
+    // deleted overloads close possible hole in the type system
+    template<class _R2, class _B0, class _B1>
+      bool operator==(const function<_R2(_B0, _B1)>&) const;// = delete;
+    template<class _R2, class _B0, class _B1>
+      bool operator!=(const function<_R2(_B0, _B1)>&) const;// = delete;
+public:
+    // 20.7.16.2.4, function invocation:
+    _Rp operator()(_A0, _A1) const;
+
+#ifndef _LIBCPP_NO_RTTI
+    // 20.7.16.2.5, function target access:
+    const std::type_info& target_type() const;
+    template <typename _Tp> _Tp* target();
+    template <typename _Tp> const _Tp* target() const;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>::function(const function& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (const __base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+        __f_ = __f.__f_->__clone();
+}
+
+template<class _Rp, class _A0, class _A1>
+template<class _Alloc>
+function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (const __base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+        __f_ = __f.__f_->__clone();
+}
+
+template<class _Rp, class _A0, class _A1>
+template <class _Fp>
+function<_Rp(_A0, _A1)>::function(_Fp __f,
+                                 typename enable_if<!is_integral<_Fp>::value>::type*)
+    : __f_(0)
+{
+    if (__function::__not_null(__f))
+    {
+        typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF;
+        if (sizeof(_FF) <= sizeof(__buf_))
+        {
+            __f_ = (__base*)&__buf_;
+            ::new (__f_) _FF(__f);
+        }
+        else
+        {
+            typedef allocator<_FF> _Ap;
+            _Ap __a;
+            typedef __allocator_destructor<_Ap> _Dp;
+            unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+            ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
+            __f_ = __hold.release();
+        }
+    }
+}
+
+template<class _Rp, class _A0, class _A1>
+template <class _Fp, class _Alloc>
+function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+                                 typename enable_if<!is_integral<_Fp>::value>::type*)
+    : __f_(0)
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    if (__function::__not_null(__f))
+    {
+        typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF;
+        if (sizeof(_FF) <= sizeof(__buf_))
+        {
+            __f_ = (__base*)&__buf_;
+            ::new (__f_) _FF(__f, __a0);
+        }
+        else
+        {
+            typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
+            _Ap __a(__a0);
+            typedef __allocator_destructor<_Ap> _Dp;
+            unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+            ::new (__hold.get()) _FF(__f, _Alloc(__a));
+            __f_ = __hold.release();
+        }
+    }
+}
+
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>&
+function<_Rp(_A0, _A1)>::operator=(const function& __f)
+{
+    function(__f).swap(*this);
+    return *this;
+}
+
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>&
+function<_Rp(_A0, _A1)>::operator=(nullptr_t)
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+    __f_ = 0;
+    return *this;
+}
+
+template<class _Rp, class _A0, class _A1>
+template <class _Fp>
+typename enable_if
+<
+    !is_integral<_Fp>::value,
+    function<_Rp(_A0, _A1)>&
+>::type
+function<_Rp(_A0, _A1)>::operator=(_Fp __f)
+{
+    function(_VSTD::move(__f)).swap(*this);
+    return *this;
+}
+
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>::~function()
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+}
+
+template<class _Rp, class _A0, class _A1>
+void
+function<_Rp(_A0, _A1)>::swap(function& __f)
+{
+    if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
+    {
+        typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
+        __base* __t = (__base*)&__tempbuf;
+        __f_->__clone(__t);
+        __f_->destroy();
+        __f_ = 0;
+        __f.__f_->__clone((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = 0;
+        __f_ = (__base*)&__buf_;
+        __t->__clone((__base*)&__f.__buf_);
+        __t->destroy();
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f_ == (__base*)&__buf_)
+    {
+        __f_->__clone((__base*)&__f.__buf_);
+        __f_->destroy();
+        __f_ = __f.__f_;
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f.__f_->__clone((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = __f_;
+        __f_ = (__base*)&__buf_;
+    }
+    else
+        _VSTD::swap(__f_, __f.__f_);
+}
+
+template<class _Rp, class _A0, class _A1>
+_Rp
+function<_Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__f_ == 0)
+        throw bad_function_call();
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return (*__f_)(__a0, __a1);
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Rp, class _A0, class _A1>
+const std::type_info&
+function<_Rp(_A0, _A1)>::target_type() const
+{
+    if (__f_ == 0)
+        return typeid(void);
+    return __f_->target_type();
+}
+
+template<class _Rp, class _A0, class _A1>
+template <typename _Tp>
+_Tp*
+function<_Rp(_A0, _A1)>::target()
+{
+    if (__f_ == 0)
+        return (_Tp*)0;
+    return (_Tp*)__f_->target(typeid(_Tp));
+}
+
+template<class _Rp, class _A0, class _A1>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_A0, _A1)>::target() const
+{
+    if (__f_ == 0)
+        return (const _Tp*)0;
+    return (const _Tp*)__f_->target(typeid(_Tp));
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+template<class _Rp, class _A0, class _A1, class _A2>
+class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1, _A2)>
+{
+    typedef __function::__base<_Rp(_A0, _A1, _A2)> __base;
+    aligned_storage<3*sizeof(void*)>::type __buf_;
+    __base* __f_;
+
+public:
+    typedef _Rp result_type;
+
+    // 20.7.16.2.1, construct/copy/destroy:
+    _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
+    _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
+    function(const function&);
+    template<class _Fp>
+      function(_Fp,
+               typename enable_if<!is_integral<_Fp>::value>::type* = 0);
+
+    template<class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      function(allocator_arg_t, const _Alloc&) : __f_(0) {}
+    template<class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
+    template<class _Alloc>
+      function(allocator_arg_t, const _Alloc&, const function&);
+    template<class _Fp, class _Alloc>
+      function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+               typename enable_if<!is_integral<_Fp>::value>::type* = 0);
+
+    function& operator=(const function&);
+    function& operator=(nullptr_t);
+    template<class _Fp>
+      typename enable_if
+      <
+        !is_integral<_Fp>::value,
+        function&
+      >::type
+      operator=(_Fp);
+
+    ~function();
+
+    // 20.7.16.2.2, function modifiers:
+    void swap(function&);
+    template<class _Fp, class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      void assign(_Fp __f, const _Alloc& __a)
+        {function(allocator_arg, __a, __f).swap(*this);}
+
+    // 20.7.16.2.3, function capacity:
+    _LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
+
+private:
+    // deleted overloads close possible hole in the type system
+    template<class _R2, class _B0, class _B1, class _B2>
+      bool operator==(const function<_R2(_B0, _B1, _B2)>&) const;// = delete;
+    template<class _R2, class _B0, class _B1, class _B2>
+      bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const;// = delete;
+public:
+    // 20.7.16.2.4, function invocation:
+    _Rp operator()(_A0, _A1, _A2) const;
+
+#ifndef _LIBCPP_NO_RTTI
+    // 20.7.16.2.5, function target access:
+    const std::type_info& target_type() const;
+    template <typename _Tp> _Tp* target();
+    template <typename _Tp> const _Tp* target() const;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>::function(const function& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (const __base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+        __f_ = __f.__f_->__clone();
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+template<class _Alloc>
+function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&,
+                                      const function& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (const __base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+        __f_ = __f.__f_->__clone();
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+template <class _Fp>
+function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
+                                     typename enable_if<!is_integral<_Fp>::value>::type*)
+    : __f_(0)
+{
+    if (__function::__not_null(__f))
+    {
+        typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF;
+        if (sizeof(_FF) <= sizeof(__buf_))
+        {
+            __f_ = (__base*)&__buf_;
+            ::new (__f_) _FF(__f);
+        }
+        else
+        {
+            typedef allocator<_FF> _Ap;
+            _Ap __a;
+            typedef __allocator_destructor<_Ap> _Dp;
+            unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+            ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
+            __f_ = __hold.release();
+        }
+    }
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+template <class _Fp, class _Alloc>
+function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+                                     typename enable_if<!is_integral<_Fp>::value>::type*)
+    : __f_(0)
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    if (__function::__not_null(__f))
+    {
+        typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF;
+        if (sizeof(_FF) <= sizeof(__buf_))
+        {
+            __f_ = (__base*)&__buf_;
+            ::new (__f_) _FF(__f, __a0);
+        }
+        else
+        {
+            typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
+            _Ap __a(__a0);
+            typedef __allocator_destructor<_Ap> _Dp;
+            unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+            ::new (__hold.get()) _FF(__f, _Alloc(__a));
+            __f_ = __hold.release();
+        }
+    }
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>&
+function<_Rp(_A0, _A1, _A2)>::operator=(const function& __f)
+{
+    function(__f).swap(*this);
+    return *this;
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>&
+function<_Rp(_A0, _A1, _A2)>::operator=(nullptr_t)
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+    __f_ = 0;
+    return *this;
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+template <class _Fp>
+typename enable_if
+<
+    !is_integral<_Fp>::value,
+    function<_Rp(_A0, _A1, _A2)>&
+>::type
+function<_Rp(_A0, _A1, _A2)>::operator=(_Fp __f)
+{
+    function(_VSTD::move(__f)).swap(*this);
+    return *this;
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>::~function()
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+void
+function<_Rp(_A0, _A1, _A2)>::swap(function& __f)
+{
+    if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
+    {
+        typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
+        __base* __t = (__base*)&__tempbuf;
+        __f_->__clone(__t);
+        __f_->destroy();
+        __f_ = 0;
+        __f.__f_->__clone((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = 0;
+        __f_ = (__base*)&__buf_;
+        __t->__clone((__base*)&__f.__buf_);
+        __t->destroy();
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f_ == (__base*)&__buf_)
+    {
+        __f_->__clone((__base*)&__f.__buf_);
+        __f_->destroy();
+        __f_ = __f.__f_;
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f.__f_->__clone((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = __f_;
+        __f_ = (__base*)&__buf_;
+    }
+    else
+        _VSTD::swap(__f_, __f.__f_);
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+_Rp
+function<_Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__f_ == 0)
+        throw bad_function_call();
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return (*__f_)(__a0, __a1, __a2);
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Rp, class _A0, class _A1, class _A2>
+const std::type_info&
+function<_Rp(_A0, _A1, _A2)>::target_type() const
+{
+    if (__f_ == 0)
+        return typeid(void);
+    return __f_->target_type();
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+template <typename _Tp>
+_Tp*
+function<_Rp(_A0, _A1, _A2)>::target()
+{
+    if (__f_ == 0)
+        return (_Tp*)0;
+    return (_Tp*)__f_->target(typeid(_Tp));
+}
+
+template<class _Rp, class _A0, class _A1, class _A2>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_A0, _A1, _A2)>::target() const
+{
+    if (__f_ == 0)
+        return (const _Tp*)0;
+    return (const _Tp*)__f_->target(typeid(_Tp));
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+template <class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const function<_Fp>& __f, nullptr_t) {return !__f;}
+
+template <class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(nullptr_t, const function<_Fp>& __f) {return !__f;}
+
+template <class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const function<_Fp>& __f, nullptr_t) {return (bool)__f;}
+
+template <class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(nullptr_t, const function<_Fp>& __f) {return (bool)__f;}
+
+template <class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(function<_Fp>& __x, function<_Fp>& __y)
+{return __x.swap(__y);}
+
+#endif  // _LIBCPP_FUNCTIONAL_03

Property changes on: lab4/.minix-src/include/c++/__functional_03
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/experimental/tuple
===================================================================
--- lab4/.minix-src/include/c++/experimental/tuple	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/tuple	(revision 13)
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+//===----------------------------- tuple ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_TUPLE
+#define _LIBCPP_EXPERIMENTAL_TUPLE
+
+/*
+    experimental/tuple synopsis
+
+// C++1y
+
+#include <tuple>
+
+namespace std {
+namespace experimental {
+inline namespace fundamentals_v1 {
+
+  // See C++14 20.4.2.5, tuple helper classes
+  template <class T> constexpr size_t tuple_size_v
+    = tuple_size<T>::value;
+
+  // 3.2.2, Calling a function with a tuple of arguments
+  template <class F, class Tuple>
+  constexpr decltype(auto) apply(F&& f, Tuple&& t);
+
+} // namespace fundamentals_v1
+} // namespace experimental
+} // namespace std
+
+ */
+
+# include <experimental/__config>
+
+#if _LIBCPP_STD_VER > 11
+
+# include <tuple>
+# include <utility>
+# include <__functional_base>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
+#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+template <class _Tp>
+_LIBCPP_CONSTEXPR size_t tuple_size_v = tuple_size<_Tp>::value;
+#endif
+
+template <class _Fn, class _Tuple, size_t ..._Id>
+inline _LIBCPP_INLINE_VISIBILITY
+decltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t,
+                                  integer_sequence<size_t, _Id...>) {
+    return _VSTD::__invoke(
+        _VSTD::forward<_Fn>(__f),
+        _VSTD::get<_Id>(_VSTD::forward<_Tuple>(__t))...
+    );
+}
+
+template <class _Fn, class _Tuple>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+decltype(auto) apply(_Fn && __f, _Tuple && __t) {
+    return _VSTD_LFTS::__apply_tuple_impl(
+        _VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t),
+        make_index_sequence<tuple_size<typename decay<_Tuple>::type>::value>()
+    );
+}
+
+_LIBCPP_END_NAMESPACE_LFTS
+
+#endif /* _LIBCPP_STD_VER > 11 */
+
+#endif /* _LIBCPP_EXPERIMENTAL_TUPLE */

Property changes on: lab4/.minix-src/include/c++/experimental/tuple
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/experimental/utility
===================================================================
--- lab4/.minix-src/include/c++/experimental/utility	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/utility	(revision 13)
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+//===-------------------------- utility ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_UTILITY
+#define _LIBCPP_EXPERIMENTAL_UTILITY
+
+/*
+    experimental/utility synopsis
+
+// C++1y
+
+#include <utility>
+
+namespace std {
+namespace experimental {
+inline namespace fundamentals_v1 {
+
+  3.1.2, erased-type placeholder
+  struct erased_type { };
+
+} // namespace fundamentals_v1
+} // namespace experimental
+} // namespace std
+
+ */
+
+#include <experimental/__config>
+#include <utility>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
+  struct _LIBCPP_TYPE_VIS_ONLY erased_type { };
+
+_LIBCPP_END_NAMESPACE_LFTS
+
+#endif /* _LIBCPP_EXPERIMENTAL_UTILITY */

Property changes on: lab4/.minix-src/include/c++/experimental/utility
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/arpa/nameser.h
===================================================================
--- lab4/.minix-src/include/arpa/nameser.h	(nonexistent)
+++ lab4/.minix-src/include/arpa/nameser.h	(revision 13)
@@ -0,0 +1,681 @@
+/*	$NetBSD: nameser.h,v 1.25 2009/04/12 17:07:34 christos Exp $	*/
+
+/*
+ * Portions Copyright (C) 2004, 2005, 2008, 2009  Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (C) 1996-2003  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 1983, 1989, 1993
+ *    The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ *	Id: nameser.h,v 1.16 2009/03/03 01:52:48 each Exp
+ */
+
+#ifndef _ARPA_NAMESER_H_
+#define _ARPA_NAMESER_H_
+
+#define BIND_4_COMPAT
+
+#include <sys/param.h>
+#if (!defined(BSD)) || (BSD < 199306)
+# include <sys/bitypes.h>
+#else
+# include <sys/types.h>
+#endif
+#include <sys/cdefs.h>
+
+/*%
+ * Revision information.  This is the release date in YYYYMMDD format.
+ * It can change every day so the right thing to do with it is use it
+ * in preprocessor commands such as "#if (__NAMESER > 19931104)".  Do not
+ * compare for equality; rather, use it to determine whether your libbind.a
+ * contains a new enough lib/nameser/ to support the feature you need.
+ */
+
+#define __NAMESER	20090302	/*%< New interface version stamp. */
+/*
+ * Define constants based on RFC0883, RFC1034, RFC 1035
+ */
+#define NS_PACKETSZ	512	/*%< default UDP packet size */
+#define NS_MAXDNAME	1025	/*%< maximum domain name (presentation format)*/
+#define NS_MAXMSG	65535	/*%< maximum message size */
+#define NS_MAXCDNAME	255	/*%< maximum compressed domain name */
+#define NS_MAXLABEL	63	/*%< maximum length of domain label */
+#define NS_MAXLABELS	128	/*%< theoretical max #/labels per domain name */
+#define NS_MAXNNAME	256	/*%< maximum uncompressed (binary) domain name*/
+#define	NS_MAXPADDR	(sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
+#define NS_HFIXEDSZ	12	/*%< #/bytes of fixed data in header */
+#define NS_QFIXEDSZ	4	/*%< #/bytes of fixed data in query */
+#define NS_RRFIXEDSZ	10	/*%< #/bytes of fixed data in r record */
+#define NS_INT32SZ	4	/*%< #/bytes of data in a uint32_t */
+#define NS_INT16SZ	2	/*%< #/bytes of data in a uint16_t */
+#define NS_INT8SZ	1	/*%< #/bytes of data in a u_int8_t */
+#define NS_INADDRSZ	4	/*%< IPv4 T_A */
+#define NS_IN6ADDRSZ	16	/*%< IPv6 T_AAAA */
+#define NS_CMPRSFLGS	0xc0	/*%< Flag bits indicating name compression. */
+#define NS_DEFAULTPORT	53	/*%< For both TCP and UDP. */
+
+/*
+ * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
+ * in synch with it.
+ */
+typedef enum __ns_sect {
+	ns_s_qd = 0,		/*%< Query: Question. */
+	ns_s_zn = 0,		/*%< Update: Zone. */
+	ns_s_an = 1,		/*%< Query: Answer. */
+	ns_s_pr = 1,		/*%< Update: Prerequisites. */
+	ns_s_ns = 2,		/*%< Query: Name servers. */
+	ns_s_ud = 2,		/*%< Update: Update. */
+	ns_s_ar = 3,		/*%< Query|Update: Additional records. */
+	ns_s_max = 4
+} ns_sect;
+
+/*%
+ * Network name (compressed or not) type.  Equivilent to a pointer when used
+ * in a function prototype.  Can be const'd.
+ */
+typedef u_char ns_nname[NS_MAXNNAME];
+typedef const u_char *ns_nname_ct;
+typedef u_char *ns_nname_t;
+
+struct ns_namemap { ns_nname_ct base; int len; };
+typedef struct ns_namemap *ns_namemap_t;
+typedef const struct ns_namemap *ns_namemap_ct;
+
+/*%
+ * This is a message handle.  It is caller allocated and has no dynamic data.
+ * This structure is intended to be opaque to all but ns_parse.c, thus the
+ * leading _'s on the member names.  Use the accessor functions, not the _'s.
+ */
+typedef struct __ns_msg {
+	const u_char	*_msg, *_eom;
+	uint16_t	_id, _flags, _counts[ns_s_max];
+	const u_char	*_sections[ns_s_max];
+	ns_sect		_sect;
+	int		_rrnum;
+	const u_char	*_msg_ptr;
+} ns_msg;
+
+/*
+ * This is a newmsg handle, used when constructing new messages with
+ * ns_newmsg_init, et al.
+ */
+struct ns_newmsg {
+	ns_msg		msg;
+	const u_char	*dnptrs[25];
+	const u_char	**lastdnptr;
+};
+typedef struct ns_newmsg ns_newmsg;
+
+/* Private data structure - do not use from outside library. */
+struct _ns_flagdata {  int mask, shift;  };
+extern struct _ns_flagdata _ns_flagdata[];
+
+/* Accessor macros - this is part of the public interface. */
+
+#define ns_msg_id(handle) ((handle)._id + 0)
+#define ns_msg_base(handle) ((handle)._msg + 0)
+#define ns_msg_end(handle) ((handle)._eom + 0)
+#define ns_msg_size(handle) ((size_t)((handle)._eom - (handle)._msg))
+#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
+
+/*%
+ * This is a parsed record.  It is caller allocated and has no dynamic data.
+ */
+typedef	struct __ns_rr {
+	char		name[NS_MAXDNAME];
+	uint16_t	type;
+	uint16_t	rr_class;
+	uint32_t	ttl;
+	uint16_t	rdlength;
+	const u_char *	rdata;
+} ns_rr;
+
+/*
+ * Same thing, but using uncompressed network binary names, and real C types.
+ */
+typedef	struct __ns_rr2 {
+	ns_nname	nname;
+	size_t		nnamel;
+	int		type;
+	int		rr_class;
+	u_int		ttl;
+	int		rdlength;
+	const u_char *	rdata;
+} ns_rr2;
+
+/* Accessor macros - this is part of the public interface. */
+#define ns_rr_name(rr)	(((rr).name[0] != '\0') ? (rr).name : ".")
+#define ns_rr_nname(rr)	((const ns_nname_t)(rr).nname)
+#define ns_rr_nnamel(rr) ((rr).nnamel + 0)
+#define ns_rr_type(rr)	((ns_type)((rr).type + 0))
+#define ns_rr_class(rr)	((ns_class)((rr).rr_class + 0))
+#define ns_rr_ttl(rr)	((u_long)(rr).ttl + 0)
+#define ns_rr_rdlen(rr)	((size_t)(rr).rdlength + 0)
+#define ns_rr_rdata(rr)	((rr).rdata + 0)
+
+/*%
+ * These don't have to be in the same order as in the packet flags word,
+ * and they can even overlap in some cases, but they will need to be kept
+ * in synch with ns_parse.c:ns_flagdata[].
+ */
+typedef enum __ns_flag {
+	ns_f_qr,		/*%< Question/Response. */
+	ns_f_opcode,		/*%< Operation code. */
+	ns_f_aa,		/*%< Authoritative Answer. */
+	ns_f_tc,		/*%< Truncation occurred. */
+	ns_f_rd,		/*%< Recursion Desired. */
+	ns_f_ra,		/*%< Recursion Available. */
+	ns_f_z,			/*%< MBZ. */
+	ns_f_ad,		/*%< Authentic Data (DNSSEC). */
+	ns_f_cd,		/*%< Checking Disabled (DNSSEC). */
+	ns_f_rcode,		/*%< Response code. */
+	ns_f_max
+} ns_flag;
+
+/*%
+ * Currently defined opcodes.
+ */
+typedef enum __ns_opcode {
+	ns_o_query = 0,		/*%< Standard query. */
+	ns_o_iquery = 1,	/*%< Inverse query (deprecated/unsupported). */
+	ns_o_status = 2,	/*%< Name server status query (unsupported). */
+				/* Opcode 3 is undefined/reserved. */
+	ns_o_notify = 4,	/*%< Zone change notification. */
+	ns_o_update = 5,	/*%< Zone update message. */
+	ns_o_max = 6
+} ns_opcode;
+
+/*%
+ * Currently defined response codes.
+ */
+typedef	enum __ns_rcode {
+	ns_r_noerror = 0,	/*%< No error occurred. */
+	ns_r_formerr = 1,	/*%< Format error. */
+	ns_r_servfail = 2,	/*%< Server failure. */
+	ns_r_nxdomain = 3,	/*%< Name error. */
+	ns_r_notimpl = 4,	/*%< Unimplemented. */
+	ns_r_refused = 5,	/*%< Operation refused. */
+	/* these are for BIND_UPDATE */
+	ns_r_yxdomain = 6,	/*%< Name exists */
+	ns_r_yxrrset = 7,	/*%< RRset exists */
+	ns_r_nxrrset = 8,	/*%< RRset does not exist */
+	ns_r_notauth = 9,	/*%< Not authoritative for zone */
+	ns_r_notzone = 10,	/*%< Zone of record different from zone section */
+	ns_r_max = 11,
+	/* The following are EDNS extended rcodes */
+	ns_r_badvers = 16,
+	/* The following are TSIG errors */
+	ns_r_badsig = 16,
+	ns_r_badkey = 17,
+	ns_r_badtime = 18
+} ns_rcode;
+
+/* BIND_UPDATE */
+typedef enum __ns_update_operation {
+	ns_uop_delete = 0,
+	ns_uop_add = 1,
+	ns_uop_max = 2
+} ns_update_operation;
+
+/*%
+ * This structure is used for TSIG authenticated messages
+ */
+struct ns_tsig_key {
+	char name[NS_MAXDNAME], alg[NS_MAXDNAME];
+	unsigned char *data;
+	int len;
+};
+typedef struct ns_tsig_key ns_tsig_key;
+
+/*%
+ * This structure is used for TSIG authenticated TCP messages
+ */
+struct ns_tcp_tsig_state {
+	int counter;
+	struct dst_key *key;
+	void *ctx;
+	unsigned char sig[NS_PACKETSZ];
+	int siglen;
+};
+typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
+
+#define NS_TSIG_FUDGE 300
+#define NS_TSIG_TCP_COUNT 100
+#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
+
+#define NS_TSIG_ERROR_NO_TSIG -10
+#define NS_TSIG_ERROR_NO_SPACE -11
+#define NS_TSIG_ERROR_FORMERR -12
+
+/*%
+ * Currently defined type values for resources and queries.
+ */
+typedef enum __ns_type {
+	ns_t_invalid = 0,	/*%< Cookie. */
+	ns_t_a = 1,		/*%< Host address. */
+	ns_t_ns = 2,		/*%< Authoritative server. */
+	ns_t_md = 3,		/*%< Mail destination. */
+	ns_t_mf = 4,		/*%< Mail forwarder. */
+	ns_t_cname = 5,		/*%< Canonical name. */
+	ns_t_soa = 6,		/*%< Start of authority zone. */
+	ns_t_mb = 7,		/*%< Mailbox domain name. */
+	ns_t_mg = 8,		/*%< Mail group member. */
+	ns_t_mr = 9,		/*%< Mail rename name. */
+	ns_t_null = 10,		/*%< Null resource record. */
+	ns_t_wks = 11,		/*%< Well known service. */
+	ns_t_ptr = 12,		/*%< Domain name pointer. */
+	ns_t_hinfo = 13,	/*%< Host information. */
+	ns_t_minfo = 14,	/*%< Mailbox information. */
+	ns_t_mx = 15,		/*%< Mail routing information. */
+	ns_t_txt = 16,		/*%< Text strings. */
+	ns_t_rp = 17,		/*%< Responsible person. */
+	ns_t_afsdb = 18,	/*%< AFS cell database. */
+	ns_t_x25 = 19,		/*%< X_25 calling address. */
+	ns_t_isdn = 20,		/*%< ISDN calling address. */
+	ns_t_rt = 21,		/*%< Router. */
+	ns_t_nsap = 22,		/*%< NSAP address. */
+	ns_t_nsap_ptr = 23,	/*%< Reverse NSAP lookup (deprecated). */
+	ns_t_sig = 24,		/*%< Security signature. */
+	ns_t_key = 25,		/*%< Security key. */
+	ns_t_px = 26,		/*%< X.400 mail mapping. */
+	ns_t_gpos = 27,		/*%< Geographical position (withdrawn). */
+	ns_t_aaaa = 28,		/*%< IPv6 Address. */
+	ns_t_loc = 29,		/*%< Location Information. */
+	ns_t_nxt = 30,		/*%< Next domain (security). */
+	ns_t_eid = 31,		/*%< Endpoint identifier. */
+	ns_t_nimloc = 32,	/*%< Nimrod Locator. */
+	ns_t_srv = 33,		/*%< Server Selection. */
+	ns_t_atma = 34,		/*%< ATM Address */
+	ns_t_naptr = 35,	/*%< Naming Authority PoinTeR */
+	ns_t_kx = 36,		/*%< Key Exchange */
+	ns_t_cert = 37,		/*%< Certification record */
+	ns_t_a6 = 38,		/*%< IPv6 address (experimental) */
+	ns_t_dname = 39,	/*%< Non-terminal DNAME */
+	ns_t_sink = 40,		/*%< Kitchen sink (experimentatl) */
+	ns_t_opt = 41,		/*%< EDNS0 option (meta-RR) */
+	ns_t_apl = 42,		/*%< Address prefix list (RFC3123) */
+	ns_t_ds = 43,		/*%< Delegation Signer */
+	ns_t_sshfp = 44,	/*%< SSH Fingerprint */
+	ns_t_ipseckey = 45,	/*%< IPSEC Key */
+	ns_t_rrsig = 46,	/*%< RRset Signature */
+	ns_t_nsec = 47,		/*%< Negative security */
+	ns_t_dnskey = 48,	/*%< DNS Key */
+	ns_t_dhcid = 49,	/*%< Dynamic host configuratin identifier */
+	ns_t_nsec3 = 50,	/*%< Negative security type 3 */
+	ns_t_nsec3param = 51,	/*%< Negative security type 3 parameters */
+	ns_t_hip = 55,		/*%< Host Identity Protocol */
+	ns_t_spf = 99,		/*%< Sender Policy Framework */
+	ns_t_tkey = 249,	/*%< Transaction key */
+	ns_t_tsig = 250,	/*%< Transaction signature. */
+	ns_t_ixfr = 251,	/*%< Incremental zone transfer. */
+	ns_t_axfr = 252,	/*%< Transfer zone of authority. */
+	ns_t_mailb = 253,	/*%< Transfer mailbox records. */
+	ns_t_maila = 254,	/*%< Transfer mail agent records. */
+	ns_t_any = 255,		/*%< Wildcard match. */
+	ns_t_zxfr = 256,	/*%< BIND-specific, nonstandard. */
+	ns_t_dlv = 32769,	/*%< DNSSEC look-aside validatation. */
+	ns_t_max = 65536
+} ns_type;
+
+/* Exclusively a QTYPE? (not also an RTYPE) */
+#define	ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
+		      (t) == ns_t_mailb || (t) == ns_t_maila)
+/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */
+#define	ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
+/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */
+#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
+#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
+#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
+		       (t) == ns_t_zxfr)
+
+/*%
+ * Values for class field
+ */
+typedef enum __ns_class {
+	ns_c_invalid = 0,	/*%< Cookie. */
+	ns_c_in = 1,		/*%< Internet. */
+	ns_c_2 = 2,		/*%< unallocated/unsupported. */
+	ns_c_chaos = 3,		/*%< MIT Chaos-net. */
+	ns_c_hs = 4,		/*%< MIT Hesiod. */
+	/* Query class values which do not appear in resource records */
+	ns_c_none = 254,	/*%< for prereq. sections in update requests */
+	ns_c_any = 255,		/*%< Wildcard match. */
+	ns_c_max = 65536
+} ns_class;
+
+/* DNSSEC constants. */
+
+typedef enum __ns_key_types {
+	ns_kt_rsa = 1,		/*%< key type RSA/MD5 */
+	ns_kt_dh  = 2,		/*%< Diffie Hellman */
+	ns_kt_dsa = 3,		/*%< Digital Signature Standard (MANDATORY) */
+	ns_kt_private = 254	/*%< Private key type starts with OID */
+} ns_key_types;
+
+typedef enum __ns_cert_types {
+	cert_t_pkix = 1,	/*%< PKIX (X.509v3) */
+	cert_t_spki = 2,	/*%< SPKI */
+	cert_t_pgp  = 3,	/*%< PGP */
+	cert_t_url  = 253,	/*%< URL private type */
+	cert_t_oid  = 254	/*%< OID private type */
+} ns_cert_types;
+
+/* Flags field of the KEY RR rdata. */
+#define	NS_KEY_TYPEMASK		0xC000	/*%< Mask for "type" bits */
+#define	NS_KEY_TYPE_AUTH_CONF	0x0000	/*%< Key usable for both */
+#define	NS_KEY_TYPE_CONF_ONLY	0x8000	/*%< Key usable for confidentiality */
+#define	NS_KEY_TYPE_AUTH_ONLY	0x4000	/*%< Key usable for authentication */
+#define	NS_KEY_TYPE_NO_KEY	0xC000	/*%< No key usable for either; no key */
+/* The type bits can also be interpreted independently, as single bits: */
+#define	NS_KEY_NO_AUTH		0x8000	/*%< Key unusable for authentication */
+#define	NS_KEY_NO_CONF		0x4000	/*%< Key unusable for confidentiality */
+#define	NS_KEY_RESERVED2	0x2000	/* Security is *mandatory* if bit=0 */
+#define	NS_KEY_EXTENDED_FLAGS	0x1000	/*%< reserved - must be zero */
+#define	NS_KEY_RESERVED4	0x0800  /*%< reserved - must be zero */
+#define	NS_KEY_RESERVED5	0x0400  /*%< reserved - must be zero */
+#define	NS_KEY_NAME_TYPE	0x0300	/*%< these bits determine the type */
+#define	NS_KEY_NAME_USER	0x0000	/*%< key is assoc. with user */
+#define	NS_KEY_NAME_ENTITY	0x0200	/*%< key is assoc. with entity eg host */
+#define	NS_KEY_NAME_ZONE	0x0100	/*%< key is zone key */
+#define	NS_KEY_NAME_RESERVED	0x0300	/*%< reserved meaning */
+#define	NS_KEY_RESERVED8	0x0080  /*%< reserved - must be zero */
+#define	NS_KEY_RESERVED9	0x0040  /*%< reserved - must be zero */
+#define	NS_KEY_RESERVED10	0x0020  /*%< reserved - must be zero */
+#define	NS_KEY_RESERVED11	0x0010  /*%< reserved - must be zero */
+#define	NS_KEY_SIGNATORYMASK	0x000F	/*%< key can sign RR's of same name */
+#define	NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
+				  NS_KEY_RESERVED4 | \
+				  NS_KEY_RESERVED5 | \
+				  NS_KEY_RESERVED8 | \
+				  NS_KEY_RESERVED9 | \
+				  NS_KEY_RESERVED10 | \
+				  NS_KEY_RESERVED11 )
+#define NS_KEY_RESERVED_BITMASK2 0xFFFF /*%< no bits defined here */
+
+/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
+#define	NS_ALG_MD5RSA		1	/*%< MD5 with RSA */
+#define	NS_ALG_DH               2	/*%< Diffie Hellman KEY */
+#define	NS_ALG_DSA              3	/*%< DSA KEY */
+#define	NS_ALG_DSS              NS_ALG_DSA
+#define	NS_ALG_EXPIRE_ONLY	253	/*%< No alg, no security */
+#define	NS_ALG_PRIVATE_OID	254	/*%< Key begins with OID giving alg */
+
+/* Protocol values  */
+/* value 0 is reserved */
+#define NS_KEY_PROT_TLS         1
+#define NS_KEY_PROT_EMAIL       2
+#define NS_KEY_PROT_DNSSEC      3
+#define NS_KEY_PROT_IPSEC       4
+#define NS_KEY_PROT_ANY		255
+
+/* Signatures */
+#define	NS_MD5RSA_MIN_BITS	 512	/*%< Size of a mod or exp in bits */
+#define	NS_MD5RSA_MAX_BITS	4096
+	/* Total of binary mod and exp */
+#define	NS_MD5RSA_MAX_BYTES	((NS_MD5RSA_MAX_BITS+7/8)*2+3)
+	/* Max length of text sig block */
+#define	NS_MD5RSA_MAX_BASE64	(((NS_MD5RSA_MAX_BYTES+2)/3)*4)
+#define NS_MD5RSA_MIN_SIZE	((NS_MD5RSA_MIN_BITS+7)/8)
+#define NS_MD5RSA_MAX_SIZE	((NS_MD5RSA_MAX_BITS+7)/8)
+
+#define NS_DSA_SIG_SIZE         41
+#define NS_DSA_MIN_SIZE         213
+#define NS_DSA_MAX_BYTES        405
+
+/* Offsets into SIG record rdata to find various values */
+#define	NS_SIG_TYPE	0	/*%< Type flags */
+#define	NS_SIG_ALG	2	/*%< Algorithm */
+#define	NS_SIG_LABELS	3	/*%< How many labels in name */
+#define	NS_SIG_OTTL	4	/*%< Original TTL */
+#define	NS_SIG_EXPIR	8	/*%< Expiration time */
+#define	NS_SIG_SIGNED	12	/*%< Signature time */
+#define	NS_SIG_FOOT	16	/*%< Key footprint */
+#define	NS_SIG_SIGNER	18	/*%< Domain name of who signed it */
+
+/* How RR types are represented as bit-flags in NXT records */
+#define	NS_NXT_BITS 8
+#define	NS_NXT_BIT_SET(  n,p) (p[(n)/NS_NXT_BITS] |=  (0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] &   (0x80>>((n)%NS_NXT_BITS)))
+#define NS_NXT_MAX 127
+
+/*%
+ * EDNS0 extended flags and option codes, host order.
+ */
+#define NS_OPT_DNSSEC_OK	0x8000U
+#define NS_OPT_NSID             3
+
+/*%
+ * Inline versions of get/put short/long.  Pointer is advanced.
+ */
+#define NS_GET16(s, cp) do { \
+	const u_char *t_cp = (const u_char *)(cp); \
+	(s) = ((uint16_t)t_cp[0] << 8) \
+	    | ((uint16_t)t_cp[1]) \
+	    ; \
+	(cp) += NS_INT16SZ; \
+} while (/*CONSTCOND*/0)
+
+#define NS_GET32(l, cp) do { \
+	const u_char *t_cp = (const u_char *)(cp); \
+	(l) = ((uint32_t)t_cp[0] << 24) \
+	    | ((uint32_t)t_cp[1] << 16) \
+	    | ((uint32_t)t_cp[2] << 8) \
+	    | ((uint32_t)t_cp[3]) \
+	    ; \
+	(cp) += NS_INT32SZ; \
+} while (/*CONSTCOND*/0)
+
+#define NS_PUT16(s, cp) do { \
+	uint32_t t_s = (uint32_t)(s); \
+	u_char *t_cp = (u_char *)(cp); \
+	*t_cp++ = t_s >> 8; \
+	*t_cp   = t_s; \
+	(cp) += NS_INT16SZ; \
+} while (/*CONSTCOND*/0)
+
+#define NS_PUT32(l, cp) do { \
+	uint32_t t_l = (uint32_t)(l); \
+	u_char *t_cp = (u_char *)(cp); \
+	*t_cp++ = t_l >> 24; \
+	*t_cp++ = t_l >> 16; \
+	*t_cp++ = t_l >> 8; \
+	*t_cp   = t_l; \
+	(cp) += NS_INT32SZ; \
+} while (/*CONSTCOND*/0)
+
+/*%
+ * ANSI C identifier hiding for bind's lib/nameser.
+ */
+#define	ns_msg_getflag		__ns_msg_getflag
+#define ns_get16		__ns_get16
+#define ns_get32		__ns_get32
+#define ns_put16		__ns_put16
+#define ns_put32		__ns_put32
+#define ns_initparse		__ns_initparse
+#define ns_skiprr		__ns_skiprr
+#define ns_parserr		__ns_parserr
+#define ns_parserr2		__ns_parserr2
+#define	ns_sprintrr		__ns_sprintrr
+#define	ns_sprintrrf		__ns_sprintrrf
+#define	ns_format_ttl		__ns_format_ttl
+#define	ns_parse_ttl		__ns_parse_ttl
+#define ns_datetosecs		__ns_datetosecs
+#define	ns_name_ntol		__ns_name_ntol
+#define	ns_name_ntop		__ns_name_ntop
+#define	ns_name_pton		__ns_name_pton
+#define	ns_name_pton2		__ns_name_pton2
+#define	ns_name_unpack		__ns_name_unpack
+#define	ns_name_unpack2		__ns_name_unpack2
+#define	ns_name_pack		__ns_name_pack
+#define	ns_name_compress	__ns_name_compress
+#define	ns_name_uncompress	__ns_name_uncompress
+#define	ns_name_skip		__ns_name_skip
+#define	ns_name_rollback	__ns_name_rollback
+#define	ns_name_length		__ns_name_length
+#define	ns_name_eq		__ns_name_eq
+#define	ns_name_owned		__ns_name_owned
+#define	ns_name_map		__ns_name_map
+#define	ns_name_labels		__ns_name_labels
+#define	ns_sign			__ns_sign
+#define	ns_sign2		__ns_sign2
+#define	ns_sign_tcp		__ns_sign_tcp
+#define	ns_sign_tcp2		__ns_sign_tcp2
+#define	ns_sign_tcp_init	__ns_sign_tcp_init
+#define ns_find_tsig		__ns_find_tsig
+#define	ns_verify		__ns_verify
+#define	ns_verify_tcp		__ns_verify_tcp
+#define	ns_verify_tcp_init	__ns_verify_tcp_init
+#define	ns_samedomain		__ns_samedomain
+#define	ns_subdomain		__ns_subdomain
+#define	ns_makecanon		__ns_makecanon
+#define	ns_samename		__ns_samename
+#define	ns_newmsg_init		__ns_newmsg_init
+#define	ns_newmsg_copy		__ns_newmsg_copy
+#define	ns_newmsg_id		__ns_newmsg_id
+#define	ns_newmsg_flag		__ns_newmsg_flag
+#define	ns_newmsg_q		__ns_newmsg_q
+#define	ns_newmsg_rr		__ns_newmsg_rr
+#define	ns_newmsg_done		__ns_newmsg_done
+#define	ns_rdata_unpack		__ns_rdata_unpack
+#define	ns_rdata_equal		__ns_rdata_equal
+#define	ns_rdata_refers		__ns_rdata_refers
+
+__BEGIN_DECLS
+int		ns_msg_getflag(ns_msg, int);
+uint16_t	ns_get16(const u_char *);
+uint32_t	ns_get32(const u_char *);
+void		ns_put16(uint16_t, u_char *);
+void		ns_put32(uint32_t, u_char *);
+int		ns_initparse(const u_char *, int, ns_msg *);
+int		ns_skiprr(const u_char *, const u_char *, ns_sect, int);
+int		ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
+int		ns_parserr2(ns_msg *, ns_sect, int, ns_rr2 *);
+int		ns_sprintrr(const ns_msg *, const ns_rr *,
+				 const char *, const char *, char *, size_t);
+int		ns_sprintrrf(const u_char *, size_t, const char *,
+				  ns_class, ns_type, u_long, const u_char *,
+				  size_t, const char *, const char *,
+				  char *, size_t);
+int		ns_format_ttl(u_long, char *, size_t);
+int		ns_parse_ttl(const char *, u_long *);
+uint32_t	ns_datetosecs(const char *cp, int *errp);
+int		ns_name_ntol(const u_char *, u_char *, size_t);
+int		ns_name_ntop(const u_char *, char *, size_t);
+int		ns_name_pton(const char *, u_char *, size_t);
+int		ns_name_pton2(const char *, u_char *, size_t, size_t *);
+int		ns_name_unpack(const u_char *, const u_char *,
+				    const u_char *, u_char *, size_t);
+int		ns_name_unpack2(const u_char *, const u_char *,
+				     const u_char *, u_char *, size_t,
+				     size_t *);
+int		ns_name_pack(const u_char *, u_char *, int,
+				  const u_char **, const u_char **);
+int		ns_name_uncompress(const u_char *, const u_char *,
+					const u_char *, char *, size_t);
+int		ns_name_compress(const char *, u_char *, size_t,
+				      const u_char **, const u_char **);
+int		ns_name_skip(const u_char **, const u_char *);
+void		ns_name_rollback(const u_char *, const u_char **,
+				      const u_char **);
+#ifndef __LIBC12_SOURCE__
+int		ns_sign(u_char *, int *, int, int, void *,
+			     const u_char *, int, u_char *, int *, time_t)
+    __RENAME(__ns_sign50);
+int		ns_sign2(u_char *, int *, int, int, void *,
+			      const u_char *, int, u_char *, int *, time_t,
+			      u_char **, u_char **)
+    __RENAME(__ns_sign250);
+#endif
+ssize_t		ns_name_length(ns_nname_ct, size_t);
+int		ns_name_eq(ns_nname_ct, size_t, ns_nname_ct, size_t);
+int		ns_name_owned(ns_namemap_ct, int, ns_namemap_ct, int);
+int		ns_name_map(ns_nname_ct, size_t, ns_namemap_t, int);
+int		ns_name_labels(ns_nname_ct, size_t);
+int		ns_sign_tcp(u_char *, int *, int, int,
+				 ns_tcp_tsig_state *, int);
+int		ns_sign_tcp2(u_char *, int *, int, int,
+				  ns_tcp_tsig_state *, int,
+				  u_char **, u_char **);
+int		ns_sign_tcp_init(void *, const u_char *, int,
+					ns_tcp_tsig_state *);
+u_char		*ns_find_tsig(u_char *, u_char *);
+#ifndef __LIBC12_SOURCE__
+int		ns_verify(u_char *, int *, void *,
+			       const u_char *, int, u_char *, int *,
+			       time_t *, int)
+    __RENAME(__ns_verify50);
+#endif
+int		ns_verify_tcp(u_char *, int *, ns_tcp_tsig_state *, int);
+int		ns_verify_tcp_init(void *, const u_char *, int,
+					ns_tcp_tsig_state *);
+int		ns_samedomain(const char *, const char *);
+int		ns_subdomain(const char *, const char *);
+int		ns_makecanon(const char *, char *, size_t);
+int		ns_samename(const char *, const char *);
+int		ns_newmsg_init(u_char *buffer, size_t bufsiz, ns_newmsg *);
+int		ns_newmsg_copy(ns_newmsg *, ns_msg *);
+void		ns_newmsg_id(ns_newmsg *handle, uint16_t id);
+void		ns_newmsg_flag(ns_newmsg *handle, ns_flag flag, u_int value);
+int		ns_newmsg_q(ns_newmsg *handle, ns_nname_ct qname,
+			    ns_type qtype, ns_class qclass);
+int		ns_newmsg_rr(ns_newmsg *handle, ns_sect sect,
+			     ns_nname_ct name, ns_type type,
+			     ns_class rr_class, uint32_t ttl,
+			     uint16_t rdlen, const u_char *rdata);
+size_t		ns_newmsg_done(ns_newmsg *handle);
+ssize_t		ns_rdata_unpack(const u_char *, const u_char *, ns_type,
+				const u_char *, size_t, u_char *, size_t);
+int		ns_rdata_equal(ns_type,
+			       const u_char *, size_t,
+			       const u_char *, size_t);
+int		ns_rdata_refers(ns_type,
+				const u_char *, size_t,
+				const u_char *);
+__END_DECLS
+
+#ifdef BIND_4_COMPAT
+#include <arpa/nameser_compat.h>
+#endif
+
+#endif /* !_ARPA_NAMESER_H_ */

Property changes on: lab4/.minix-src/include/arpa/nameser.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__hash_table
===================================================================
--- lab4/.minix-src/include/c++/__hash_table	(nonexistent)
+++ lab4/.minix-src/include/c++/__hash_table	(revision 13)
@@ -0,0 +1,2453 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP__HASH_TABLE
+#define _LIBCPP__HASH_TABLE
+
+#include <__config>
+#include <initializer_list>
+#include <memory>
+#include <iterator>
+#include <algorithm>
+#include <cmath>
+
+#include <__undef_min_max>
+#include <__undef___deallocate>
+
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+_LIBCPP_FUNC_VIS
+size_t __next_prime(size_t __n);
+
+template <class _NodePtr>
+struct __hash_node_base
+{
+    typedef __hash_node_base __first_node;
+
+    _NodePtr    __next_;
+
+    _LIBCPP_INLINE_VISIBILITY __hash_node_base() _NOEXCEPT : __next_(nullptr) {}
+};
+
+template <class _Tp, class _VoidPtr>
+struct __hash_node
+    : public __hash_node_base
+             <
+                 typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+                     rebind<__hash_node<_Tp, _VoidPtr> >
+#else
+                     rebind<__hash_node<_Tp, _VoidPtr> >::other
+#endif
+             >
+{
+    typedef _Tp value_type;
+
+    size_t     __hash_;
+    value_type __value_;
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+__is_hash_power2(size_t __bc)
+{
+    return __bc > 2 && !(__bc & (__bc - 1));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+__constrain_hash(size_t __h, size_t __bc)
+{
+    return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : __h % __bc;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+__next_hash_pow2(size_t __n)
+{
+    return size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1));
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table;
+template <class _ConstNodePtr> class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
+template <class _HashIterator> class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator;
+template <class _HashIterator> class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
+
+template <class _NodePtr>
+class _LIBCPP_TYPE_VIS_ONLY __hash_iterator
+{
+    typedef _NodePtr __node_pointer;
+
+    __node_pointer            __node_;
+
+public:
+    typedef forward_iterator_tag                         iterator_category;
+    typedef typename pointer_traits<__node_pointer>::element_type::value_type value_type;
+    typedef typename pointer_traits<__node_pointer>::difference_type difference_type;
+    typedef value_type&                                  reference;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+                     rebind<value_type>
+#else
+                     rebind<value_type>::other
+#endif
+                                                         pointer;
+
+    _LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+    : __node_(nullptr)
+#endif
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__insert_i(this);
+#endif
+    }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_iterator(const __hash_iterator& __i)
+        : __node_(__i.__node_)
+    {
+        __get_db()->__iterator_copy(this, &__i);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    ~__hash_iterator()
+    {
+        __get_db()->__erase_i(this);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_iterator& operator=(const __hash_iterator& __i)
+    {
+        if (this != &__i)
+        {
+            __get_db()->__iterator_copy(this, &__i);
+            __node_ = __i.__node_;
+        }
+        return *this;
+    }
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+        reference operator*() const
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                           "Attempted to dereference a non-dereferenceable unordered container iterator");
+#endif
+            return __node_->__value_;
+        }
+    _LIBCPP_INLINE_VISIBILITY
+        pointer operator->() const
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                           "Attempted to dereference a non-dereferenceable unordered container iterator");
+#endif
+            return pointer_traits<pointer>::pointer_to(__node_->__value_);
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_iterator& operator++()
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to increment non-incrementable unordered container iterator");
+#endif
+        __node_ = __node_->__next_;
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_iterator operator++(int)
+    {
+        __hash_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __hash_iterator& __x, const __hash_iterator& __y)
+    {
+        return __x.__node_ == __y.__node_;
+    }
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y)
+        {return !(__x == __y);}
+
+private:
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_iterator(__node_pointer __node, const void* __c) _NOEXCEPT
+        : __node_(__node)
+        {
+            __get_db()->__insert_ic(this, __c);
+        }
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_iterator(__node_pointer __node) _NOEXCEPT
+        : __node_(__node)
+        {}
+#endif
+
+    template <class, class, class, class> friend class __hash_table;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator;
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_map;
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_multimap;
+};
+
+template <class _ConstNodePtr>
+class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator
+{
+    typedef _ConstNodePtr __node_pointer;
+
+    __node_pointer         __node_;
+
+    typedef typename remove_const<
+        typename pointer_traits<__node_pointer>::element_type
+                                 >::type __node;
+
+public:
+    typedef forward_iterator_tag                       iterator_category;
+    typedef typename __node::value_type                value_type;
+    typedef typename pointer_traits<__node_pointer>::difference_type difference_type;
+    typedef const value_type&                          reference;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<const value_type>
+#else
+            rebind<const value_type>::other
+#endif
+                                                       pointer;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<__node>
+#else
+            rebind<__node>::other
+#endif
+                                                      __non_const_node_pointer;
+    typedef __hash_iterator<__non_const_node_pointer> __non_const_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+    : __node_(nullptr)
+#endif
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__insert_i(this);
+#endif
+    }
+    _LIBCPP_INLINE_VISIBILITY 
+    __hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
+        : __node_(__x.__node_)
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__iterator_copy(this, &__x);
+#endif
+    }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_iterator(const __hash_const_iterator& __i)
+        : __node_(__i.__node_)
+    {
+        __get_db()->__iterator_copy(this, &__i);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    ~__hash_const_iterator()
+    {
+        __get_db()->__erase_i(this);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_iterator& operator=(const __hash_const_iterator& __i)
+    {
+        if (this != &__i)
+        {
+            __get_db()->__iterator_copy(this, &__i);
+            __node_ = __i.__node_;
+        }
+        return *this;
+    }
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+        reference operator*() const
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                           "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+#endif
+            return __node_->__value_;
+        }
+    _LIBCPP_INLINE_VISIBILITY
+        pointer operator->() const
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                           "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+#endif
+            return pointer_traits<pointer>::pointer_to(__node_->__value_);
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_iterator& operator++()
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to increment non-incrementable unordered container const_iterator");
+#endif
+        __node_ = __node_->__next_;
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_iterator operator++(int)
+    {
+        __hash_const_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
+    {
+        return __x.__node_ == __y.__node_;
+    }
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
+        {return !(__x == __y);}
+
+private:
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_iterator(__node_pointer __node, const void* __c) _NOEXCEPT
+        : __node_(__node)
+        {
+            __get_db()->__insert_ic(this, __c);
+        }
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_iterator(__node_pointer __node) _NOEXCEPT
+        : __node_(__node)
+        {}
+#endif
+
+    template <class, class, class, class> friend class __hash_table;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_map;
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_multimap;
+};
+
+template <class _ConstNodePtr> class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
+
+template <class _NodePtr>
+class _LIBCPP_TYPE_VIS_ONLY __hash_local_iterator
+{
+    typedef _NodePtr __node_pointer;
+
+    __node_pointer         __node_;
+    size_t                 __bucket_;
+    size_t                 __bucket_count_;
+
+    typedef pointer_traits<__node_pointer>          __pointer_traits;
+public:
+    typedef forward_iterator_tag                                iterator_category;
+    typedef typename __pointer_traits::element_type::value_type value_type;
+    typedef typename __pointer_traits::difference_type          difference_type;
+    typedef value_type&                                         reference;
+    typedef typename __pointer_traits::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<value_type>
+#else
+            rebind<value_type>::other
+#endif
+                                                                pointer;
+
+    _LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__insert_i(this);
+#endif
+    }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_local_iterator(const __hash_local_iterator& __i)
+        : __node_(__i.__node_),
+          __bucket_(__i.__bucket_),
+          __bucket_count_(__i.__bucket_count_)
+    {
+        __get_db()->__iterator_copy(this, &__i);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    ~__hash_local_iterator()
+    {
+        __get_db()->__erase_i(this);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_local_iterator& operator=(const __hash_local_iterator& __i)
+    {
+        if (this != &__i)
+        {
+            __get_db()->__iterator_copy(this, &__i);
+            __node_ = __i.__node_;
+            __bucket_ = __i.__bucket_;
+            __bucket_count_ = __i.__bucket_count_;
+        }
+        return *this;
+    }
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+        reference operator*() const
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                           "Attempted to dereference a non-dereferenceable unordered container local_iterator");
+#endif
+            return __node_->__value_;
+        }
+    _LIBCPP_INLINE_VISIBILITY
+        pointer operator->() const
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                           "Attempted to dereference a non-dereferenceable unordered container local_iterator");
+#endif
+            return pointer_traits<pointer>::pointer_to(__node_->__value_);
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_local_iterator& operator++()
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to increment non-incrementable unordered container local_iterator");
+#endif
+        __node_ = __node_->__next_;
+        if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_)
+            __node_ = nullptr;
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_local_iterator operator++(int)
+    {
+        __hash_local_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
+    {
+        return __x.__node_ == __y.__node_;
+    }
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
+        {return !(__x == __y);}
+
+private:
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_local_iterator(__node_pointer __node, size_t __bucket,
+                          size_t __bucket_count, const void* __c) _NOEXCEPT
+        : __node_(__node),
+          __bucket_(__bucket),
+          __bucket_count_(__bucket_count)
+        {
+            __get_db()->__insert_ic(this, __c);
+            if (__node_ != nullptr)
+                __node_ = __node_->__next_;
+        }
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_local_iterator(__node_pointer __node, size_t __bucket,
+                          size_t __bucket_count) _NOEXCEPT
+        : __node_(__node),
+          __bucket_(__bucket),
+          __bucket_count_(__bucket_count)
+        {
+            if (__node_ != nullptr)
+                __node_ = __node_->__next_;
+        }
+#endif
+    template <class, class, class, class> friend class __hash_table;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator;
+};
+
+template <class _ConstNodePtr>
+class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator
+{
+    typedef _ConstNodePtr __node_pointer;
+
+    __node_pointer         __node_;
+    size_t                 __bucket_;
+    size_t                 __bucket_count_;
+
+    typedef pointer_traits<__node_pointer>          __pointer_traits;
+    typedef typename __pointer_traits::element_type __node;
+    typedef typename remove_const<__node>::type     __non_const_node;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<__non_const_node>
+#else
+            rebind<__non_const_node>::other
+#endif
+                                                    __non_const_node_pointer;
+    typedef __hash_local_iterator<__non_const_node_pointer>
+                                                    __non_const_iterator;
+public:
+    typedef forward_iterator_tag                       iterator_category;
+    typedef typename remove_const<
+                        typename __pointer_traits::element_type::value_type
+                     >::type                           value_type;
+    typedef typename __pointer_traits::difference_type difference_type;
+    typedef const value_type&                          reference;
+    typedef typename __pointer_traits::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<const value_type>
+#else
+            rebind<const value_type>::other
+#endif
+                                                       pointer;
+
+    _LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__insert_i(this);
+#endif
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_local_iterator(const __non_const_iterator& __x) _NOEXCEPT
+        : __node_(__x.__node_),
+          __bucket_(__x.__bucket_),
+          __bucket_count_(__x.__bucket_count_)
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__iterator_copy(this, &__x);
+#endif
+    }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_local_iterator(const __hash_const_local_iterator& __i)
+        : __node_(__i.__node_),
+          __bucket_(__i.__bucket_),
+          __bucket_count_(__i.__bucket_count_)
+    {
+        __get_db()->__iterator_copy(this, &__i);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    ~__hash_const_local_iterator()
+    {
+        __get_db()->__erase_i(this);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_local_iterator& operator=(const __hash_const_local_iterator& __i)
+    {
+        if (this != &__i)
+        {
+            __get_db()->__iterator_copy(this, &__i);
+            __node_ = __i.__node_;
+            __bucket_ = __i.__bucket_;
+            __bucket_count_ = __i.__bucket_count_;
+        }
+        return *this;
+    }
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+        reference operator*() const
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                           "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+#endif
+            return __node_->__value_;
+        }
+    _LIBCPP_INLINE_VISIBILITY
+        pointer operator->() const
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                           "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+#endif
+            return pointer_traits<pointer>::pointer_to(__node_->__value_);
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_local_iterator& operator++()
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to increment non-incrementable unordered container const_local_iterator");
+#endif
+        __node_ = __node_->__next_;
+        if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_)
+            __node_ = nullptr;
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_local_iterator operator++(int)
+    {
+        __hash_const_local_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
+    {
+        return __x.__node_ == __y.__node_;
+    }
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
+        {return !(__x == __y);}
+
+private:
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_local_iterator(__node_pointer __node, size_t __bucket,
+                                size_t __bucket_count, const void* __c) _NOEXCEPT
+        : __node_(__node),
+          __bucket_(__bucket),
+          __bucket_count_(__bucket_count)
+        {
+            __get_db()->__insert_ic(this, __c);
+            if (__node_ != nullptr)
+                __node_ = __node_->__next_;
+        }
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_const_local_iterator(__node_pointer __node, size_t __bucket,
+                                size_t __bucket_count) _NOEXCEPT
+        : __node_(__node),
+          __bucket_(__bucket),
+          __bucket_count_(__bucket_count)
+        {
+            if (__node_ != nullptr)
+                __node_ = __node_->__next_;
+        }
+#endif
+    template <class, class, class, class> friend class __hash_table;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
+};
+
+template <class _Alloc>
+class __bucket_list_deallocator
+{
+    typedef _Alloc                                          allocator_type;
+    typedef allocator_traits<allocator_type>                __alloc_traits;
+    typedef typename __alloc_traits::size_type              size_type;
+
+    __compressed_pair<size_type, allocator_type> __data_;
+public:
+    typedef typename __alloc_traits::pointer pointer;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bucket_list_deallocator()
+        _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+        : __data_(0) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bucket_list_deallocator(const allocator_type& __a, size_type __size)
+        _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+        : __data_(__size, __a) {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bucket_list_deallocator(__bucket_list_deallocator&& __x)
+        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+        : __data_(_VSTD::move(__x.__data_))
+    {
+        __x.size() = 0;
+    }
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type& size() _NOEXCEPT {return __data_.first();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type  size() const _NOEXCEPT {return __data_.first();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type& __alloc() _NOEXCEPT {return __data_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const allocator_type& __alloc() const _NOEXCEPT {return __data_.second();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void operator()(pointer __p) _NOEXCEPT
+    {
+        __alloc_traits::deallocate(__alloc(), __p, size());
+    }
+};
+
+template <class _Alloc> class __hash_map_node_destructor;
+
+template <class _Alloc>
+class __hash_node_destructor
+{
+    typedef _Alloc                                          allocator_type;
+    typedef allocator_traits<allocator_type>                __alloc_traits;
+    typedef typename __alloc_traits::value_type::value_type value_type;
+public:
+    typedef typename __alloc_traits::pointer                pointer;
+private:
+
+    allocator_type& __na_;
+
+    __hash_node_destructor& operator=(const __hash_node_destructor&);
+
+public:
+    bool __value_constructed;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __hash_node_destructor(allocator_type& __na,
+                                    bool __constructed = false) _NOEXCEPT
+        : __na_(__na),
+          __value_constructed(__constructed)
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void operator()(pointer __p) _NOEXCEPT
+    {
+        if (__value_constructed)
+            __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_));
+        if (__p)
+            __alloc_traits::deallocate(__na_, __p, 1);
+    }
+
+    template <class> friend class __hash_map_node_destructor;
+};
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+class __hash_table
+{
+public:
+    typedef _Tp    value_type;
+    typedef _Hash  hasher;
+    typedef _Equal key_equal;
+    typedef _Alloc allocator_type;
+
+private:
+    typedef allocator_traits<allocator_type> __alloc_traits;
+public:
+    typedef value_type&                              reference;
+    typedef const value_type&                        const_reference;
+    typedef typename __alloc_traits::pointer         pointer;
+    typedef typename __alloc_traits::const_pointer   const_pointer;
+    typedef typename __alloc_traits::size_type       size_type;
+    typedef typename __alloc_traits::difference_type difference_type;
+public:
+    // Create __node
+    typedef __hash_node<value_type, typename __alloc_traits::void_pointer> __node;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator;
+    typedef allocator_traits<__node_allocator>       __node_traits;
+    typedef typename __node_traits::pointer          __node_pointer;
+    typedef typename __node_traits::pointer          __node_const_pointer;
+    typedef __hash_node_base<__node_pointer>         __first_node;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<__first_node>
+#else
+            rebind<__first_node>::other
+#endif
+                                                     __node_base_pointer;
+
+private:
+
+    typedef typename __rebind_alloc_helper<__node_traits, __node_pointer>::type __pointer_allocator;
+    typedef __bucket_list_deallocator<__pointer_allocator> __bucket_list_deleter;
+    typedef unique_ptr<__node_pointer[], __bucket_list_deleter> __bucket_list;
+    typedef allocator_traits<__pointer_allocator>          __pointer_alloc_traits;
+    typedef typename __bucket_list_deleter::pointer __node_pointer_pointer;
+
+    // --- Member data begin ---
+    __bucket_list                                     __bucket_list_;
+    __compressed_pair<__first_node, __node_allocator> __p1_;
+    __compressed_pair<size_type, hasher>              __p2_;
+    __compressed_pair<float, key_equal>               __p3_;
+    // --- Member data end ---
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type& size() _NOEXCEPT {return __p2_.first();}
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    size_type  size() const _NOEXCEPT {return __p2_.first();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    hasher& hash_function() _NOEXCEPT {return __p2_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const hasher& hash_function() const _NOEXCEPT {return __p2_.second();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    float& max_load_factor() _NOEXCEPT {return __p3_.first();}
+    _LIBCPP_INLINE_VISIBILITY
+    float  max_load_factor() const _NOEXCEPT {return __p3_.first();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    key_equal& key_eq() _NOEXCEPT {return __p3_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const key_equal& key_eq() const _NOEXCEPT {return __p3_.second();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __node_allocator& __node_alloc() _NOEXCEPT {return __p1_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const __node_allocator& __node_alloc() const _NOEXCEPT
+        {return __p1_.second();}
+
+public:
+    typedef __hash_iterator<__node_pointer>                   iterator;
+    typedef __hash_const_iterator<__node_pointer>             const_iterator;
+    typedef __hash_local_iterator<__node_pointer>             local_iterator;
+    typedef __hash_const_local_iterator<__node_pointer>       const_local_iterator;
+
+    __hash_table()
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<__bucket_list>::value &&
+            is_nothrow_default_constructible<__first_node>::value &&
+            is_nothrow_default_constructible<__node_allocator>::value &&
+            is_nothrow_default_constructible<hasher>::value &&
+            is_nothrow_default_constructible<key_equal>::value);
+    __hash_table(const hasher& __hf, const key_equal& __eql);
+    __hash_table(const hasher& __hf, const key_equal& __eql,
+                 const allocator_type& __a);
+    explicit __hash_table(const allocator_type& __a);
+    __hash_table(const __hash_table& __u);
+    __hash_table(const __hash_table& __u, const allocator_type& __a);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __hash_table(__hash_table&& __u)
+        _NOEXCEPT_(
+            is_nothrow_move_constructible<__bucket_list>::value &&
+            is_nothrow_move_constructible<__first_node>::value &&
+            is_nothrow_move_constructible<__node_allocator>::value &&
+            is_nothrow_move_constructible<hasher>::value &&
+            is_nothrow_move_constructible<key_equal>::value);
+    __hash_table(__hash_table&& __u, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~__hash_table();
+
+    __hash_table& operator=(const __hash_table& __u);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __hash_table& operator=(__hash_table&& __u)
+        _NOEXCEPT_(
+            __node_traits::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<__node_allocator>::value &&
+            is_nothrow_move_assignable<hasher>::value &&
+            is_nothrow_move_assignable<key_equal>::value);
+#endif
+    template <class _InputIterator>
+        void __assign_unique(_InputIterator __first, _InputIterator __last);
+    template <class _InputIterator>
+        void __assign_multi(_InputIterator __first, _InputIterator __last);
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT
+    {
+        return allocator_traits<__pointer_allocator>::max_size(
+            __bucket_list_.get_deleter().__alloc());
+    }
+
+    pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
+    iterator             __node_insert_multi(__node_pointer __nd);
+    iterator             __node_insert_multi(const_iterator __p,
+                                             __node_pointer __nd);
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    template <class... _Args>
+        pair<iterator, bool> __emplace_unique(_Args&&... __args);
+    template <class... _Args>
+        iterator __emplace_multi(_Args&&... __args);
+    template <class... _Args>
+        iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _ValueTp>
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, bool> __insert_unique_value(_ValueTp&& __x);
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, bool> __insert_unique_value(const value_type& __x);
+#endif
+
+    pair<iterator, bool> __insert_unique(const value_type& __x);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    pair<iterator, bool> __insert_unique(value_type&& __x);
+    template <class _Pp>
+    pair<iterator, bool> __insert_unique(_Pp&& __x);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Pp>
+        iterator __insert_multi(_Pp&& __x);
+    template <class _Pp>
+        iterator __insert_multi(const_iterator __p, _Pp&& __x);
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    iterator __insert_multi(const value_type& __x);
+    iterator __insert_multi(const_iterator __p, const value_type& __x);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    void clear() _NOEXCEPT;
+    void rehash(size_type __n);
+    _LIBCPP_INLINE_VISIBILITY void reserve(size_type __n)
+        {rehash(static_cast<size_type>(ceil(__n / max_load_factor())));}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_count() const _NOEXCEPT
+    {
+        return __bucket_list_.get_deleter().size();
+    }
+
+    iterator       begin() _NOEXCEPT;
+    iterator       end() _NOEXCEPT;
+    const_iterator begin() const _NOEXCEPT;
+    const_iterator end() const _NOEXCEPT;
+
+    template <class _Key>
+        _LIBCPP_INLINE_VISIBILITY
+        size_type bucket(const _Key& __k) const
+        {
+            _LIBCPP_ASSERT(bucket_count() > 0,
+                "unordered container::bucket(key) called when bucket_count() == 0");
+            return __constrain_hash(hash_function()(__k), bucket_count());
+        }
+
+    template <class _Key>
+        iterator       find(const _Key& __x);
+    template <class _Key>
+        const_iterator find(const _Key& __x) const;
+
+    typedef __hash_node_destructor<__node_allocator> _Dp;
+    typedef unique_ptr<__node, _Dp> __node_holder;
+
+    iterator erase(const_iterator __p);
+    iterator erase(const_iterator __first, const_iterator __last);
+    template <class _Key>
+        size_type __erase_unique(const _Key& __k);
+    template <class _Key>
+        size_type __erase_multi(const _Key& __k);
+    __node_holder remove(const_iterator __p) _NOEXCEPT;
+
+    template <class _Key>
+        size_type __count_unique(const _Key& __k) const;
+    template <class _Key>
+        size_type __count_multi(const _Key& __k) const;
+
+    template <class _Key>
+        pair<iterator, iterator>
+        __equal_range_unique(const _Key& __k);
+    template <class _Key>
+        pair<const_iterator, const_iterator>
+        __equal_range_unique(const _Key& __k) const;
+
+    template <class _Key>
+        pair<iterator, iterator>
+        __equal_range_multi(const _Key& __k);
+    template <class _Key>
+        pair<const_iterator, const_iterator>
+        __equal_range_multi(const _Key& __k) const;
+
+    void swap(__hash_table& __u)
+#if _LIBCPP_STD_VER <= 11
+        _NOEXCEPT_(
+            __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
+            && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
+                  || __is_nothrow_swappable<__pointer_allocator>::value)
+            && (!__node_traits::propagate_on_container_swap::value
+                  || __is_nothrow_swappable<__node_allocator>::value)
+            );
+#else
+     _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_bucket_count() const _NOEXCEPT
+        {return __pointer_alloc_traits::max_size(__bucket_list_.get_deleter().__alloc());}
+    size_type bucket_size(size_type __n) const;
+    _LIBCPP_INLINE_VISIBILITY float load_factor() const _NOEXCEPT
+    {
+        size_type __bc = bucket_count();
+        return __bc != 0 ? (float)size() / __bc : 0.f;
+    }
+    _LIBCPP_INLINE_VISIBILITY void max_load_factor(float __mlf) _NOEXCEPT
+    {
+        _LIBCPP_ASSERT(__mlf > 0,
+            "unordered container::max_load_factor(lf) called with lf <= 0");
+        max_load_factor() = _VSTD::max(__mlf, load_factor());
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    local_iterator
+    begin(size_type __n)
+    {
+        _LIBCPP_ASSERT(__n < bucket_count(),
+            "unordered container::begin(n) called with n >= bucket_count()");
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        return local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
+#else
+        return local_iterator(__bucket_list_[__n], __n, bucket_count());
+#endif
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    local_iterator
+    end(size_type __n)
+    {
+        _LIBCPP_ASSERT(__n < bucket_count(),
+            "unordered container::end(n) called with n >= bucket_count()");
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        return local_iterator(nullptr, __n, bucket_count(), this);
+#else
+        return local_iterator(nullptr, __n, bucket_count());
+#endif
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator
+    cbegin(size_type __n) const
+    {
+        _LIBCPP_ASSERT(__n < bucket_count(),
+            "unordered container::cbegin(n) called with n >= bucket_count()");
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
+#else
+        return const_local_iterator(__bucket_list_[__n], __n, bucket_count());
+#endif
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator
+    cend(size_type __n) const
+    {
+        _LIBCPP_ASSERT(__n < bucket_count(),
+            "unordered container::cend(n) called with n >= bucket_count()");
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        return const_local_iterator(nullptr, __n, bucket_count(), this);
+#else
+        return const_local_iterator(nullptr, __n, bucket_count());
+#endif
+    }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    bool __dereferenceable(const const_iterator* __i) const;
+    bool __decrementable(const const_iterator* __i) const;
+    bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
+    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+private:
+    void __rehash(size_type __n);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class ..._Args>
+        __node_holder __construct_node(_Args&& ...__args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+    __node_holder __construct_node(value_type&& __v, size_t __hash);
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __node_holder __construct_node(const value_type& __v);
+#endif
+    __node_holder __construct_node(const value_type& __v, size_t __hash);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __hash_table& __u)
+        {__copy_assign_alloc(__u, integral_constant<bool,
+             __node_traits::propagate_on_container_copy_assignment::value>());}
+    void __copy_assign_alloc(const __hash_table& __u, true_type);
+    _LIBCPP_INLINE_VISIBILITY
+        void __copy_assign_alloc(const __hash_table&, false_type) {}
+
+    void __move_assign(__hash_table& __u, false_type);
+    void __move_assign(__hash_table& __u, true_type)
+        _NOEXCEPT_(
+            is_nothrow_move_assignable<__node_allocator>::value &&
+            is_nothrow_move_assignable<hasher>::value &&
+            is_nothrow_move_assignable<key_equal>::value);
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__hash_table& __u)
+        _NOEXCEPT_(
+            !__node_traits::propagate_on_container_move_assignment::value ||
+            (is_nothrow_move_assignable<__pointer_allocator>::value &&
+             is_nothrow_move_assignable<__node_allocator>::value))
+        {__move_assign_alloc(__u, integral_constant<bool,
+             __node_traits::propagate_on_container_move_assignment::value>());}
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__hash_table& __u, true_type)
+        _NOEXCEPT_(
+            is_nothrow_move_assignable<__pointer_allocator>::value &&
+            is_nothrow_move_assignable<__node_allocator>::value)
+    {
+        __bucket_list_.get_deleter().__alloc() =
+                _VSTD::move(__u.__bucket_list_.get_deleter().__alloc());
+        __node_alloc() = _VSTD::move(__u.__node_alloc());
+    }
+    _LIBCPP_INLINE_VISIBILITY
+        void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
+
+    void __deallocate(__node_pointer __np) _NOEXCEPT;
+    __node_pointer __detach() _NOEXCEPT;
+
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_map;
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_multimap;
+};
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
+    _NOEXCEPT_(
+        is_nothrow_default_constructible<__bucket_list>::value &&
+        is_nothrow_default_constructible<__first_node>::value &&
+        is_nothrow_default_constructible<hasher>::value &&
+        is_nothrow_default_constructible<key_equal>::value)
+    : __p2_(0),
+      __p3_(1.0f)
+{
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
+                                                       const key_equal& __eql)
+    : __bucket_list_(nullptr, __bucket_list_deleter()),
+      __p1_(),
+      __p2_(0, __hf),
+      __p3_(1.0f, __eql)
+{
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
+                                                       const key_equal& __eql,
+                                                       const allocator_type& __a)
+    : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
+      __p1_(__node_allocator(__a)),
+      __p2_(0, __hf),
+      __p3_(1.0f, __eql)
+{
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)
+    : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
+      __p1_(__node_allocator(__a)),
+      __p2_(0),
+      __p3_(1.0f)
+{
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
+    : __bucket_list_(nullptr,
+          __bucket_list_deleter(allocator_traits<__pointer_allocator>::
+              select_on_container_copy_construction(
+                  __u.__bucket_list_.get_deleter().__alloc()), 0)),
+      __p1_(allocator_traits<__node_allocator>::
+          select_on_container_copy_construction(__u.__node_alloc())),
+      __p2_(0, __u.hash_function()),
+      __p3_(__u.__p3_)
+{
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
+                                                       const allocator_type& __a)
+    : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
+      __p1_(__node_allocator(__a)),
+      __p2_(0, __u.hash_function()),
+      __p3_(__u.__p3_)
+{
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
+        _NOEXCEPT_(
+            is_nothrow_move_constructible<__bucket_list>::value &&
+            is_nothrow_move_constructible<__first_node>::value &&
+            is_nothrow_move_constructible<hasher>::value &&
+            is_nothrow_move_constructible<key_equal>::value)
+    : __bucket_list_(_VSTD::move(__u.__bucket_list_)),
+      __p1_(_VSTD::move(__u.__p1_)),
+      __p2_(_VSTD::move(__u.__p2_)),
+      __p3_(_VSTD::move(__u.__p3_))
+{
+    if (size() > 0)
+    {
+        __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
+            static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
+        __u.__p1_.first().__next_ = nullptr;
+        __u.size() = 0;
+    }
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
+                                                       const allocator_type& __a)
+    : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
+      __p1_(__node_allocator(__a)),
+      __p2_(0, _VSTD::move(__u.hash_function())),
+      __p3_(_VSTD::move(__u.__p3_))
+{
+    if (__a == allocator_type(__u.__node_alloc()))
+    {
+        __bucket_list_.reset(__u.__bucket_list_.release());
+        __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size();
+        __u.__bucket_list_.get_deleter().size() = 0;
+        if (__u.size() > 0)
+        {
+            __p1_.first().__next_ = __u.__p1_.first().__next_;
+            __u.__p1_.first().__next_ = nullptr;
+            __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
+                static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
+            size() = __u.size();
+            __u.size() = 0;
+        }
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
+{
+    __deallocate(__p1_.first().__next_);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__erase_c(this);
+#endif
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__copy_assign_alloc(
+        const __hash_table& __u, true_type)
+{
+    if (__node_alloc() != __u.__node_alloc())
+    {
+        clear();
+        __bucket_list_.reset();
+        __bucket_list_.get_deleter().size() = 0;
+    }
+    __bucket_list_.get_deleter().__alloc() = __u.__bucket_list_.get_deleter().__alloc();
+    __node_alloc() = __u.__node_alloc();
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>&
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __u)
+{
+    if (this != &__u)
+    {
+        __copy_assign_alloc(__u);
+        hash_function() = __u.hash_function();
+        key_eq() = __u.key_eq();
+        max_load_factor() = __u.max_load_factor();
+        __assign_multi(__u.begin(), __u.end());
+    }
+    return *this;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate(__node_pointer __np)
+    _NOEXCEPT
+{
+    __node_allocator& __na = __node_alloc();
+    while (__np != nullptr)
+    {
+        __node_pointer __next = __np->__next_;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __c_node* __c = __get_db()->__find_c_and_lock(this);
+        for (__i_node** __p = __c->end_; __p != __c->beg_; )
+        {
+            --__p;
+            iterator* __i = static_cast<iterator*>((*__p)->__i_);
+            if (__i->__node_ == __np)
+            {
+                (*__p)->__c_ = nullptr;
+                if (--__c->end_ != __p)
+                    memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+            }
+        }
+        __get_db()->unlock();
+#endif
+        __node_traits::destroy(__na, _VSTD::addressof(__np->__value_));
+        __node_traits::deallocate(__na, __np, 1);
+        __np = __next;
+    }
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_pointer
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT
+{
+    size_type __bc = bucket_count();
+    for (size_type __i = 0; __i < __bc; ++__i)
+        __bucket_list_[__i] = nullptr;
+    size() = 0;
+    __node_pointer __cache = __p1_.first().__next_;
+    __p1_.first().__next_ = nullptr;
+    return __cache;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
+        __hash_table& __u, true_type)
+    _NOEXCEPT_(
+        is_nothrow_move_assignable<__node_allocator>::value &&
+        is_nothrow_move_assignable<hasher>::value &&
+        is_nothrow_move_assignable<key_equal>::value)
+{
+    clear();
+    __bucket_list_.reset(__u.__bucket_list_.release());
+    __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size();
+    __u.__bucket_list_.get_deleter().size() = 0;
+    __move_assign_alloc(__u);
+    size() = __u.size();
+    hash_function() = _VSTD::move(__u.hash_function());
+    max_load_factor() = __u.max_load_factor();
+    key_eq() = _VSTD::move(__u.key_eq());
+    __p1_.first().__next_ = __u.__p1_.first().__next_;
+    if (size() > 0)
+    {
+        __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
+            static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
+        __u.__p1_.first().__next_ = nullptr;
+        __u.size() = 0;
+    }
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->swap(this, &__u);
+#endif
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
+        __hash_table& __u, false_type)
+{
+    if (__node_alloc() == __u.__node_alloc())
+        __move_assign(__u, true_type());
+    else
+    {
+        hash_function() = _VSTD::move(__u.hash_function());
+        key_eq() = _VSTD::move(__u.key_eq());
+        max_load_factor() = __u.max_load_factor();
+        if (bucket_count() != 0)
+        {
+            __node_pointer __cache = __detach();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            try
+            {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+                const_iterator __i = __u.begin();
+                while (__cache != nullptr && __u.size() != 0)
+                {
+                    __cache->__value_ = _VSTD::move(__u.remove(__i++)->__value_);
+                    __node_pointer __next = __cache->__next_;
+                    __node_insert_multi(__cache);
+                    __cache = __next;
+                }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            }
+            catch (...)
+            {
+                __deallocate(__cache);
+                throw;
+            }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            __deallocate(__cache);
+        }
+        const_iterator __i = __u.begin();
+        while (__u.size() != 0)
+        {
+            __node_holder __h =
+                    __construct_node(_VSTD::move(__u.remove(__i++)->__value_));
+            __node_insert_multi(__h.get());
+            __h.release();
+        }
+    }
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+__hash_table<_Tp, _Hash, _Equal, _Alloc>&
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
+    _NOEXCEPT_(
+        __node_traits::propagate_on_container_move_assignment::value &&
+        is_nothrow_move_assignable<__node_allocator>::value &&
+        is_nothrow_move_assignable<hasher>::value &&
+        is_nothrow_move_assignable<key_equal>::value)
+{
+    __move_assign(__u, integral_constant<bool,
+                  __node_traits::propagate_on_container_move_assignment::value>());
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _InputIterator>
+void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first,
+                                                          _InputIterator __last)
+{
+    if (bucket_count() != 0)
+    {
+        __node_pointer __cache = __detach();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (; __cache != nullptr && __first != __last; ++__first)
+            {
+                __cache->__value_ = *__first;
+                __node_pointer __next = __cache->__next_;
+                __node_insert_unique(__cache);
+                __cache = __next;
+            }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __deallocate(__cache);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __deallocate(__cache);
+    }
+    for (; __first != __last; ++__first)
+        __insert_unique(*__first);
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _InputIterator>
+void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
+                                                         _InputIterator __last)
+{
+    if (bucket_count() != 0)
+    {
+        __node_pointer __cache = __detach();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (; __cache != nullptr && __first != __last; ++__first)
+            {
+                __cache->__value_ = *__first;
+                __node_pointer __next = __cache->__next_;
+                __node_insert_multi(__cache);
+                __cache = __next;
+            }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            __deallocate(__cache);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __deallocate(__cache);
+    }
+    for (; __first != __last; ++__first)
+        __insert_multi(*__first);
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator(__p1_.first().__next_, this);
+#else
+    return iterator(__p1_.first().__next_);
+#endif
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator(nullptr, this);
+#else
+    return iterator(nullptr);
+#endif
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return const_iterator(__p1_.first().__next_, this);
+#else
+    return const_iterator(__p1_.first().__next_);
+#endif
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return const_iterator(nullptr, this);
+#else
+    return const_iterator(nullptr);
+#endif
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT
+{
+    if (size() > 0)
+    {
+        __deallocate(__p1_.first().__next_);
+        __p1_.first().__next_ = nullptr;
+        size_type __bc = bucket_count();
+        for (size_type __i = 0; __i < __bc; ++__i)
+            __bucket_list_[__i] = nullptr;
+        size() = 0;
+    }
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __nd)
+{
+    __nd->__hash_ = hash_function()(__nd->__value_);
+    size_type __bc = bucket_count();
+    bool __inserted = false;
+    __node_pointer __ndptr;
+    size_t __chash;
+    if (__bc != 0)
+    {
+        __chash = __constrain_hash(__nd->__hash_, __bc);
+        __ndptr = __bucket_list_[__chash];
+        if (__ndptr != nullptr)
+        {
+            for (__ndptr = __ndptr->__next_; __ndptr != nullptr &&
+                                             __constrain_hash(__ndptr->__hash_, __bc) == __chash;
+                                                     __ndptr = __ndptr->__next_)
+            {
+                if (key_eq()(__ndptr->__value_, __nd->__value_))
+                    goto __done;
+            }
+        }
+    }
+    {
+        if (size()+1 > __bc * max_load_factor() || __bc == 0)
+        {
+            rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
+                           size_type(ceil(float(size() + 1) / max_load_factor()))));
+            __bc = bucket_count();
+            __chash = __constrain_hash(__nd->__hash_, __bc);
+        }
+        // insert_after __bucket_list_[__chash], or __first_node if bucket is null
+        __node_pointer __pn = __bucket_list_[__chash];
+        if (__pn == nullptr)
+        {
+            __pn = static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
+            __nd->__next_ = __pn->__next_;
+            __pn->__next_ = __nd;
+            // fix up __bucket_list_
+            __bucket_list_[__chash] = __pn;
+            if (__nd->__next_ != nullptr)
+                __bucket_list_[__constrain_hash(__nd->__next_->__hash_, __bc)] = __nd;
+        }
+        else
+        {
+            __nd->__next_ = __pn->__next_;
+            __pn->__next_ = __nd;
+        }
+        __ndptr = __nd;
+        // increment size
+        ++size();
+        __inserted = true;
+    }
+__done:
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return pair<iterator, bool>(iterator(__ndptr, this), __inserted);
+#else
+    return pair<iterator, bool>(iterator(__ndptr), __inserted);
+#endif
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __cp)
+{
+    __cp->__hash_ = hash_function()(__cp->__value_);
+    size_type __bc = bucket_count();
+    if (size()+1 > __bc * max_load_factor() || __bc == 0)
+    {
+        rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
+                       size_type(ceil(float(size() + 1) / max_load_factor()))));
+        __bc = bucket_count();
+    }
+    size_t __chash = __constrain_hash(__cp->__hash_, __bc);
+    __node_pointer __pn = __bucket_list_[__chash];
+    if (__pn == nullptr)
+    {
+        __pn = static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
+        __cp->__next_ = __pn->__next_;
+        __pn->__next_ = __cp;
+        // fix up __bucket_list_
+        __bucket_list_[__chash] = __pn;
+        if (__cp->__next_ != nullptr)
+            __bucket_list_[__constrain_hash(__cp->__next_->__hash_, __bc)] = __cp;
+    }
+    else
+    {
+        for (bool __found = false; __pn->__next_ != nullptr &&
+                                   __constrain_hash(__pn->__next_->__hash_, __bc) == __chash;
+                                                           __pn = __pn->__next_)
+        {
+            //      __found    key_eq()     action
+            //      false       false       loop
+            //      true        true        loop
+            //      false       true        set __found to true
+            //      true        false       break
+            if (__found != (__pn->__next_->__hash_ == __cp->__hash_ &&
+                            key_eq()(__pn->__next_->__value_, __cp->__value_)))
+            {
+                if (!__found)
+                    __found = true;
+                else
+                    break;
+            }
+        }
+        __cp->__next_ = __pn->__next_;
+        __pn->__next_ = __cp;
+        if (__cp->__next_ != nullptr)
+        {
+            size_t __nhash = __constrain_hash(__cp->__next_->__hash_, __bc);
+            if (__nhash != __chash)
+                __bucket_list_[__nhash] = __cp;
+        }
+    }
+    ++size();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator(__cp, this);
+#else
+    return iterator(__cp);
+#endif
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
+        const_iterator __p, __node_pointer __cp)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
+        " referring to this unordered container");
+#endif
+    if (__p != end() && key_eq()(*__p, __cp->__value_))
+    {
+        __node_pointer __np = __p.__node_;
+        __cp->__hash_ = __np->__hash_;
+        size_type __bc = bucket_count();
+        if (size()+1 > __bc * max_load_factor() || __bc == 0)
+        {
+            rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
+                           size_type(ceil(float(size() + 1) / max_load_factor()))));
+            __bc = bucket_count();
+        }
+        size_t __chash = __constrain_hash(__cp->__hash_, __bc);
+        __node_pointer __pp = __bucket_list_[__chash];
+        while (__pp->__next_ != __np)
+            __pp = __pp->__next_;
+        __cp->__next_ = __np;
+        __pp->__next_ = __cp;
+        ++size();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        return iterator(__cp, this);
+#else
+        return iterator(__cp);
+#endif
+    }
+    return __node_insert_multi(__cp);
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
+{
+    return __insert_unique_value(__x);
+}
+
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _ValueTp>
+_LIBCPP_INLINE_VISIBILITY
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique_value(_ValueTp&& __x)
+#else
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+_LIBCPP_INLINE_VISIBILITY
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique_value(const value_type& __x)
+#endif
+{
+#if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+    typedef const value_type& _ValueTp;
+#endif
+    size_t __hash = hash_function()(__x);
+    size_type __bc = bucket_count();
+    bool __inserted = false;
+    __node_pointer __nd;
+    size_t __chash;
+    if (__bc != 0)
+    {
+        __chash = __constrain_hash(__hash, __bc);
+        __nd = __bucket_list_[__chash];
+        if (__nd != nullptr)
+        {
+            for (__nd = __nd->__next_; __nd != nullptr &&
+                                       __constrain_hash(__nd->__hash_, __bc) == __chash;
+                                                           __nd = __nd->__next_)
+            {
+                if (key_eq()(__nd->__value_, __x))
+                    goto __done;
+            }
+        }
+    }
+    {
+        __node_holder __h = __construct_node(_VSTD::forward<_ValueTp>(__x), __hash);
+        if (size()+1 > __bc * max_load_factor() || __bc == 0)
+        {
+            rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
+                           size_type(ceil(float(size() + 1) / max_load_factor()))));
+            __bc = bucket_count();
+            __chash = __constrain_hash(__hash, __bc);
+        }
+        // insert_after __bucket_list_[__chash], or __first_node if bucket is null
+        __node_pointer __pn = __bucket_list_[__chash];
+        if (__pn == nullptr)
+        {
+            __pn = static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
+            __h->__next_ = __pn->__next_;
+            __pn->__next_ = __h.get();
+            // fix up __bucket_list_
+            __bucket_list_[__chash] = __pn;
+            if (__h->__next_ != nullptr)
+                __bucket_list_[__constrain_hash(__h->__next_->__hash_, __bc)] = __h.get();
+        }
+        else
+        {
+            __h->__next_ = __pn->__next_;
+            __pn->__next_ = __h.get();
+        }
+        __nd = __h.release();
+        // increment size
+        ++size();
+        __inserted = true;
+    }
+__done:
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return pair<iterator, bool>(iterator(__nd, this), __inserted);
+#else
+    return pair<iterator, bool>(iterator(__nd), __inserted);
+#endif
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class... _Args>
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique(_Args&&... __args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    pair<iterator, bool> __r = __node_insert_unique(__h.get());
+    if (__r.second)
+        __h.release();
+    return __r;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class... _Args>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_multi(_Args&&... __args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    iterator __r = __node_insert_multi(__h.get());
+    __h.release();
+    return __r;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class... _Args>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
+        const_iterator __p, _Args&&... __args)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
+        " referring to this unordered container");
+#endif
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    iterator __r = __node_insert_multi(__p, __h.get());
+    __h.release();
+    return __r;
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(value_type&& __x)
+{
+    return __insert_unique_value(_VSTD::move(__x));
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Pp>
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_Pp&& __x)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
+    pair<iterator, bool> __r = __node_insert_unique(__h.get());
+    if (__r.second)
+        __h.release();
+    return __r;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Pp>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_Pp&& __x)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
+    iterator __r = __node_insert_multi(__h.get());
+    __h.release();
+    return __r;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Pp>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
+                                                         _Pp&& __x)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "unordered container::insert(const_iterator, rvalue) called with an iterator not"
+        " referring to this unordered container");
+#endif
+    __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
+    iterator __r = __node_insert_multi(__p, __h.get());
+    __h.release();
+    return __r;
+}
+
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const value_type& __x)
+{
+    __node_holder __h = __construct_node(__x);
+    iterator __r = __node_insert_multi(__h.get());
+    __h.release();
+    return __r;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
+                                                         const value_type& __x)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "unordered container::insert(const_iterator, lvalue) called with an iterator not"
+        " referring to this unordered container");
+#endif
+    __node_holder __h = __construct_node(__x);
+    iterator __r = __node_insert_multi(__p, __h.get());
+    __h.release();
+    return __r;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
+{
+    if (__n == 1)
+        __n = 2;
+    else if (__n & (__n - 1))
+        __n = __next_prime(__n);
+    size_type __bc = bucket_count();
+    if (__n > __bc)
+        __rehash(__n);
+    else if (__n < __bc)
+    {
+        __n = _VSTD::max<size_type>
+              (
+                  __n,
+                  __is_hash_power2(__bc) ? __next_hash_pow2(size_t(ceil(float(size()) / max_load_factor()))) :
+                                           __next_prime(size_t(ceil(float(size()) / max_load_factor())))
+              );
+        if (__n < __bc)
+            __rehash(__n);
+    }
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__invalidate_all(this);
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+    __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
+    __bucket_list_.reset(__nbc > 0 ?
+                      __pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
+    __bucket_list_.get_deleter().size() = __nbc;
+    if (__nbc > 0)
+    {
+        for (size_type __i = 0; __i < __nbc; ++__i)
+            __bucket_list_[__i] = nullptr;
+        __node_pointer __pp(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first())));
+        __node_pointer __cp = __pp->__next_;
+        if (__cp != nullptr)
+        {
+            size_type __chash = __constrain_hash(__cp->__hash_, __nbc);
+            __bucket_list_[__chash] = __pp;
+            size_type __phash = __chash;
+            for (__pp = __cp, __cp = __cp->__next_; __cp != nullptr;
+                                                           __cp = __pp->__next_)
+            {
+                __chash = __constrain_hash(__cp->__hash_, __nbc);
+                if (__chash == __phash)
+                    __pp = __cp;
+                else
+                {
+                    if (__bucket_list_[__chash] == nullptr)
+                    {
+                        __bucket_list_[__chash] = __pp;
+                        __pp = __cp;
+                        __phash = __chash;
+                    }
+                    else
+                    {
+                        __node_pointer __np = __cp;
+                        for (; __np->__next_ != nullptr &&
+                               key_eq()(__cp->__value_, __np->__next_->__value_);
+                                                           __np = __np->__next_)
+                            ;
+                        __pp->__next_ = __np->__next_;
+                        __np->__next_ = __bucket_list_[__chash]->__next_;
+                        __bucket_list_[__chash]->__next_ = __cp;
+
+                    }
+                }
+            }
+        }
+    }
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Key>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
+{
+    size_t __hash = hash_function()(__k);
+    size_type __bc = bucket_count();
+    if (__bc != 0)
+    {
+        size_t __chash = __constrain_hash(__hash, __bc);
+        __node_pointer __nd = __bucket_list_[__chash];
+        if (__nd != nullptr)
+        {
+            for (__nd = __nd->__next_; __nd != nullptr &&
+                                       __constrain_hash(__nd->__hash_, __bc) == __chash;
+                                                           __nd = __nd->__next_)
+            {
+                if (key_eq()(__nd->__value_, __k))
+#if _LIBCPP_DEBUG_LEVEL >= 2
+                    return iterator(__nd, this);
+#else
+                    return iterator(__nd);
+#endif
+            }
+        }
+    }
+    return end();
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Key>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
+{
+    size_t __hash = hash_function()(__k);
+    size_type __bc = bucket_count();
+    if (__bc != 0)
+    {
+        size_t __chash = __constrain_hash(__hash, __bc);
+        __node_const_pointer __nd = __bucket_list_[__chash];
+        if (__nd != nullptr)
+        {
+            for (__nd = __nd->__next_; __nd != nullptr &&
+                                           __constrain_hash(__nd->__hash_, __bc) == __chash;
+                                                           __nd = __nd->__next_)
+            {
+                if (key_eq()(__nd->__value_, __k))
+#if _LIBCPP_DEBUG_LEVEL >= 2
+                    return const_iterator(__nd, this);
+#else
+                    return const_iterator(__nd);
+#endif
+            }
+        }
+
+    }
+    return end();
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class ..._Args>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
+{
+    __node_allocator& __na = __node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
+    __h.get_deleter().__value_constructed = true;
+    __h->__hash_ = hash_function()(__h->__value_);
+    __h->__next_ = nullptr;
+    return __h;
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v,
+                                                           size_t __hash)
+{
+    __node_allocator& __na = __node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
+    __h.get_deleter().__value_constructed = true;
+    __h->__hash_ = __hash;
+    __h->__next_ = nullptr;
+    return __h;
+}
+
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v)
+{
+    __node_allocator& __na = __node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
+    __h.get_deleter().__value_constructed = true;
+    __h->__hash_ = hash_function()(__h->__value_);
+    __h->__next_ = nullptr;
+    return _LIBCPP_EXPLICIT_MOVE(__h);  // explicitly moved for C++03
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v,
+                                                           size_t __hash)
+{
+    __node_allocator& __na = __node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
+    __h.get_deleter().__value_constructed = true;
+    __h->__hash_ = __hash;
+    __h->__next_ = nullptr;
+    return _LIBCPP_EXPLICIT_MOVE(__h);  // explicitly moved for C++03
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p)
+{
+    __node_pointer __np = __p.__node_;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "unordered container erase(iterator) called with an iterator not"
+        " referring to this container");
+    _LIBCPP_ASSERT(__p != end(),
+        "unordered container erase(iterator) called with a non-dereferenceable iterator");
+    iterator __r(__np, this);
+#else
+    iterator __r(__np);
+#endif
+    ++__r;
+    remove(__p);
+    return __r;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
+                                                const_iterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
+        "unodered container::erase(iterator, iterator) called with an iterator not"
+        " referring to this unodered container");
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__last) == this,
+        "unodered container::erase(iterator, iterator) called with an iterator not"
+        " referring to this unodered container");
+#endif
+    for (const_iterator __p = __first; __first != __last; __p = __first)
+    {
+        ++__first;
+        erase(__p);
+    }
+    __node_pointer __np = __last.__node_;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator (__np, this);
+#else
+    return iterator (__np);
+#endif
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Key>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_unique(const _Key& __k)
+{
+    iterator __i = find(__k);
+    if (__i == end())
+        return 0;
+    erase(__i);
+    return 1;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Key>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_multi(const _Key& __k)
+{
+    size_type __r = 0;
+    iterator __i = find(__k);
+    if (__i != end())
+    {
+        iterator __e = end();
+        do
+        {
+            erase(__i++);
+            ++__r;
+        } while (__i != __e && key_eq()(*__i, __k));
+    }
+    return __r;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
+{
+    // current node
+    __node_pointer __cn = __p.__node_;
+    size_type __bc = bucket_count();
+    size_t __chash = __constrain_hash(__cn->__hash_, __bc);
+    // find previous node
+    __node_pointer __pn = __bucket_list_[__chash];
+    for (; __pn->__next_ != __cn; __pn = __pn->__next_)
+        ;
+    // Fix up __bucket_list_
+        // if __pn is not in same bucket (before begin is not in same bucket) &&
+        //    if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
+    if (__pn == static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()))
+                            || __constrain_hash(__pn->__hash_, __bc) != __chash)
+    {
+        if (__cn->__next_ == nullptr || __constrain_hash(__cn->__next_->__hash_, __bc) != __chash)
+            __bucket_list_[__chash] = nullptr;
+    }
+        // if __cn->__next_ is not in same bucket (nullptr is in same bucket)
+    if (__cn->__next_ != nullptr)
+    {
+        size_t __nhash = __constrain_hash(__cn->__next_->__hash_, __bc);
+        if (__nhash != __chash)
+            __bucket_list_[__nhash] = __pn;
+    }
+    // remove __cn
+    __pn->__next_ = __cn->__next_;
+    __cn->__next_ = nullptr;
+    --size();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __c_node* __c = __get_db()->__find_c_and_lock(this);
+    for (__i_node** __p = __c->end_; __p != __c->beg_; )
+    {
+        --__p;
+        iterator* __i = static_cast<iterator*>((*__p)->__i_);
+        if (__i->__node_ == __cn)
+        {
+            (*__p)->__c_ = nullptr;
+            if (--__c->end_ != __p)
+                memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+        }
+    }
+    __get_db()->unlock();
+#endif
+    return __node_holder(__cn, _Dp(__node_alloc(), true));
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Key>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const
+{
+    return static_cast<size_type>(find(__k) != end());
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Key>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_multi(const _Key& __k) const
+{
+    size_type __r = 0;
+    const_iterator __i = find(__k);
+    if (__i != end())
+    {
+        const_iterator __e = end();
+        do
+        {
+            ++__i;
+            ++__r;
+        } while (__i != __e && key_eq()(*__i, __k));
+    }
+    return __r;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Key>
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator,
+     typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique(
+        const _Key& __k)
+{
+    iterator __i = find(__k);
+    iterator __j = __i;
+    if (__i != end())
+        ++__j;
+    return pair<iterator, iterator>(__i, __j);
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Key>
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator,
+     typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique(
+        const _Key& __k) const
+{
+    const_iterator __i = find(__k);
+    const_iterator __j = __i;
+    if (__i != end())
+        ++__j;
+    return pair<const_iterator, const_iterator>(__i, __j);
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Key>
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator,
+     typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(
+        const _Key& __k)
+{
+    iterator __i = find(__k);
+    iterator __j = __i;
+    if (__i != end())
+    {
+        iterator __e = end();
+        do
+        {
+            ++__j;
+        } while (__j != __e && key_eq()(*__j, __k));
+    }
+    return pair<iterator, iterator>(__i, __j);
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+template <class _Key>
+pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator,
+     typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator>
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(
+        const _Key& __k) const
+{
+    const_iterator __i = find(__k);
+    const_iterator __j = __i;
+    if (__i != end())
+    {
+        const_iterator __e = end();
+        do
+        {
+            ++__j;
+        } while (__j != __e && key_eq()(*__j, __k));
+    }
+    return pair<const_iterator, const_iterator>(__i, __j);
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
+#if _LIBCPP_STD_VER <= 11
+    _NOEXCEPT_(
+        __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
+        && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
+              || __is_nothrow_swappable<__pointer_allocator>::value)
+        && (!__node_traits::propagate_on_container_swap::value
+              || __is_nothrow_swappable<__node_allocator>::value)
+            )
+#else
+  _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
+#endif
+{
+    {
+    __node_pointer_pointer __npp = __bucket_list_.release();
+    __bucket_list_.reset(__u.__bucket_list_.release());
+    __u.__bucket_list_.reset(__npp);
+    }
+    _VSTD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
+    __swap_allocator(__bucket_list_.get_deleter().__alloc(),
+             __u.__bucket_list_.get_deleter().__alloc());
+    __swap_allocator(__node_alloc(), __u.__node_alloc());
+    _VSTD::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
+    __p2_.swap(__u.__p2_);
+    __p3_.swap(__u.__p3_);
+    if (size() > 0)
+        __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
+            static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
+    if (__u.size() > 0)
+        __u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash_, __u.bucket_count())] =
+            static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__u.__p1_.first()));
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->swap(this, &__u);
+#endif
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const
+{
+    _LIBCPP_ASSERT(__n < bucket_count(),
+        "unordered container::bucket_size(n) called with n >= bucket_count()");
+    __node_const_pointer __np = __bucket_list_[__n];
+    size_type __bc = bucket_count();
+    size_type __r = 0;
+    if (__np != nullptr)
+    {
+        for (__np = __np->__next_; __np != nullptr &&
+                                   __constrain_hash(__np->__hash_, __bc) == __n;
+                                                    __np = __np->__next_, ++__r)
+            ;
+    }
+    return __r;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x,
+     __hash_table<_Tp, _Hash, _Equal, _Alloc>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+bool
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__dereferenceable(const const_iterator* __i) const
+{
+    return __i->__node_ != nullptr;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+bool
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__decrementable(const const_iterator*) const
+{
+    return false;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+bool
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__addable(const const_iterator*, ptrdiff_t) const
+{
+    return false;
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+bool
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const
+{
+    return false;
+}
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP__HASH_TABLE

Property changes on: lab4/.minix-src/include/c++/__hash_table
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/arpa/nameser_compat.h
===================================================================
--- lab4/.minix-src/include/arpa/nameser_compat.h	(nonexistent)
+++ lab4/.minix-src/include/arpa/nameser_compat.h	(revision 13)
@@ -0,0 +1,232 @@
+/*	$NetBSD: nameser_compat.h,v 1.6 2015/02/24 17:57:08 christos Exp $	*/
+
+/* Copyright (c) 1983, 1989
+ *    The Regents of the University of California.  All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*%
+ *      from nameser.h	8.1 (Berkeley) 6/2/93
+ *	Id: nameser_compat.h,v 1.8 2006/05/19 02:33:40 marka Exp
+ */
+
+#ifndef _ARPA_NAMESER_COMPAT_
+#define	_ARPA_NAMESER_COMPAT_
+
+#define	__BIND		19950621	/*%< (DEAD) interface version stamp. */
+
+#ifndef BYTE_ORDER
+#if (BSD >= 199103)
+# include <machine/endian.h>
+#else
+#ifdef __linux
+# include <endian.h>
+#else
+#define	LITTLE_ENDIAN	1234	/*%< least-significant byte first (vax, pc) */
+#define	BIG_ENDIAN	4321	/*%< most-significant byte first (IBM, net) */
+#define	PDP_ENDIAN	3412	/*%< LSB first in word, MSW first in long (pdp) */
+
+#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
+    defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
+    defined(__i386__) || defined(__i386) || defined(__amd64__) || \
+    defined(__x86_64__) || defined(MIPSEL) || defined(_MIPSEL) || \
+    defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) || defined(__alpha) || \
+    (defined(__Lynx__) && defined(__x86__))
+#define BYTE_ORDER	LITTLE_ENDIAN
+#endif
+
+#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
+    defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
+    defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
+    defined(apollo) || defined(__convex__) || defined(_CRAY) || \
+    defined(__hppa) || defined(__hp9000) || \
+    defined(__hp9000s300) || defined(__hp9000s700) || \
+    defined(__hp3000s900) || defined(__hpux) || defined(MPE) || \
+    defined (BIT_ZERO_ON_LEFT) || defined(m68k) || defined(__sparc) ||  \
+    (defined(__Lynx__) && \
+     (defined(__68k__) || defined(__sparc__) || defined(__powerpc__)))
+#define BYTE_ORDER	BIG_ENDIAN
+#endif
+#endif /* __linux */
+#endif /* BSD */
+#endif /* BYTE_ORDER */
+
+#if !defined(BYTE_ORDER) || \
+    (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
+    BYTE_ORDER != PDP_ENDIAN)
+	/* you must determine what the correct bit order is for
+	 * your compiler - the next line is an intentional error
+	 * which will force your compiles to bomb until you fix
+	 * the above macros.
+	 */
+  error "Undefined or invalid BYTE_ORDER";
+#endif
+
+/*%
+ * Structure for query header.  The order of the fields is machine- and
+ * compiler-dependent, depending on the byte/bit order and the layout
+ * of bit fields.  We use bit fields only in int variables, as this
+ * is all ANSI requires.  This requires a somewhat confusing rearrangement.
+ */
+
+typedef struct {
+	unsigned	id :16;		/*%< query identification number */
+#if BYTE_ORDER == BIG_ENDIAN
+			/* fields in third byte */
+	unsigned	qr: 1;		/*%< response flag */
+	unsigned	opcode: 4;	/*%< purpose of message */
+	unsigned	aa: 1;		/*%< authoritive answer */
+	unsigned	tc: 1;		/*%< truncated message */
+	unsigned	rd: 1;		/*%< recursion desired */
+			/* fields in fourth byte */
+	unsigned	ra: 1;		/*%< recursion available */
+	unsigned	unused :1;	/*%< unused bits (MBZ as of 4.9.3a3) */
+	unsigned	ad: 1;		/*%< authentic data from named */
+	unsigned	cd: 1;		/*%< checking disabled by resolver */
+	unsigned	rcode :4;	/*%< response code */
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
+			/* fields in third byte */
+	unsigned	rd :1;		/*%< recursion desired */
+	unsigned	tc :1;		/*%< truncated message */
+	unsigned	aa :1;		/*%< authoritive answer */
+	unsigned	opcode :4;	/*%< purpose of message */
+	unsigned	qr :1;		/*%< response flag */
+			/* fields in fourth byte */
+	unsigned	rcode :4;	/*%< response code */
+	unsigned	cd: 1;		/*%< checking disabled by resolver */
+	unsigned	ad: 1;		/*%< authentic data from named */
+	unsigned	unused :1;	/*%< unused bits (MBZ as of 4.9.3a3) */
+	unsigned	ra :1;		/*%< recursion available */
+#endif
+			/* remaining bytes */
+	unsigned	qdcount :16;	/*%< number of question entries */
+	unsigned	ancount :16;	/*%< number of answer entries */
+	unsigned	nscount :16;	/*%< number of authority entries */
+	unsigned	arcount :16;	/*%< number of resource entries */
+} HEADER;
+
+#define PACKETSZ	NS_PACKETSZ
+#define MAXDNAME	NS_MAXDNAME
+#define MAXCDNAME	NS_MAXCDNAME
+#define MAXLABEL	NS_MAXLABEL
+#define	HFIXEDSZ	NS_HFIXEDSZ
+#define QFIXEDSZ	NS_QFIXEDSZ
+#define RRFIXEDSZ	NS_RRFIXEDSZ
+#define	INT32SZ		NS_INT32SZ
+#define	INT16SZ		NS_INT16SZ
+#define	INT8SZ		NS_INT8SZ
+#define	INADDRSZ	NS_INADDRSZ
+#define	IN6ADDRSZ	NS_IN6ADDRSZ
+#define	INDIR_MASK	NS_CMPRSFLGS
+#define NAMESERVER_PORT	NS_DEFAULTPORT
+
+#define S_ZONE		ns_s_zn
+#define S_PREREQ	ns_s_pr
+#define S_UPDATE	ns_s_ud
+#define S_ADDT		ns_s_ar
+
+#define QUERY		ns_o_query
+#define IQUERY		ns_o_iquery
+#define STATUS		ns_o_status
+#define	NS_NOTIFY_OP	ns_o_notify
+#define	NS_UPDATE_OP	ns_o_update
+
+#define NOERROR		ns_r_noerror
+#define FORMERR		ns_r_formerr
+#define SERVFAIL	ns_r_servfail
+#define NXDOMAIN	ns_r_nxdomain
+#define NOTIMP		ns_r_notimpl
+#define REFUSED		ns_r_refused
+#define YXDOMAIN	ns_r_yxdomain
+#define YXRRSET		ns_r_yxrrset
+#define NXRRSET		ns_r_nxrrset
+#define NOTAUTH		ns_r_notauth
+#define NOTZONE		ns_r_notzone
+/*#define BADSIG		ns_r_badsig*/
+/*#define BADKEY		ns_r_badkey*/
+/*#define BADTIME		ns_r_badtime*/
+
+
+#define DELETE		ns_uop_delete
+#define ADD		ns_uop_add
+
+#define T_A		ns_t_a
+#define T_NS		ns_t_ns
+#define T_MD		ns_t_md
+#define T_MF		ns_t_mf
+#define T_CNAME		ns_t_cname
+#define T_SOA		ns_t_soa
+#define T_MB		ns_t_mb
+#define T_MG		ns_t_mg
+#define T_MR		ns_t_mr
+#define T_NULL		ns_t_null
+#define T_WKS		ns_t_wks
+#define T_PTR		ns_t_ptr
+#define T_HINFO		ns_t_hinfo
+#define T_MINFO		ns_t_minfo
+#define T_MX		ns_t_mx
+#define T_TXT		ns_t_txt
+#define	T_RP		ns_t_rp
+#define T_AFSDB		ns_t_afsdb
+#define T_X25		ns_t_x25
+#define T_ISDN		ns_t_isdn
+#define T_RT		ns_t_rt
+#define T_NSAP		ns_t_nsap
+#define T_NSAP_PTR	ns_t_nsap_ptr
+#define	T_SIG		ns_t_sig
+#define	T_KEY		ns_t_key
+#define	T_PX		ns_t_px
+#define	T_GPOS		ns_t_gpos
+#define	T_AAAA		ns_t_aaaa
+#define	T_LOC		ns_t_loc
+#define	T_NXT		ns_t_nxt
+#define	T_EID		ns_t_eid
+#define	T_NIMLOC	ns_t_nimloc
+#define	T_SRV		ns_t_srv
+#define T_ATMA		ns_t_atma
+#define T_NAPTR		ns_t_naptr
+#define T_A6		ns_t_a6
+#define	T_TSIG		ns_t_tsig
+#define	T_IXFR		ns_t_ixfr
+#define T_AXFR		ns_t_axfr
+#define T_MAILB		ns_t_mailb
+#define T_MAILA		ns_t_maila
+#define T_ANY		ns_t_any
+
+#define C_IN		ns_c_in
+#define C_CHAOS		ns_c_chaos
+#define C_HS		ns_c_hs
+/* BIND_UPDATE */
+#define C_NONE		ns_c_none
+#define C_ANY		ns_c_any
+
+#define	GETSHORT		NS_GET16
+#define	GETLONG			NS_GET32
+#define	PUTSHORT		NS_PUT16
+#define	PUTLONG			NS_PUT32
+
+#endif /* _ARPA_NAMESER_COMPAT_ */

Property changes on: lab4/.minix-src/include/arpa/nameser_compat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/ext/hash_set
===================================================================
--- lab4/.minix-src/include/c++/ext/hash_set	(nonexistent)
+++ lab4/.minix-src/include/c++/ext/hash_set	(revision 13)
@@ -0,0 +1,661 @@
+// -*- C++ -*-
+//===------------------------- hash_set ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_HASH_SET
+#define _LIBCPP_HASH_SET
+
+/*
+
+    hash_set synopsis
+
+namespace __gnu_cxx
+{
+
+template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+          class Alloc = allocator<Value>>
+class hash_set
+{
+public:
+    // types
+    typedef Value                                                      key_type;
+    typedef key_type                                                   value_type;
+    typedef Hash                                                       hasher;
+    typedef Pred                                                       key_equal;
+    typedef Alloc                                                      allocator_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    typedef typename allocator_traits<allocator_type>::pointer         pointer;
+    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+    typedef typename allocator_traits<allocator_type>::size_type       size_type;
+    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+
+    typedef /unspecified/ iterator;
+    typedef /unspecified/ const_iterator;
+
+    explicit hash_set(size_type n = 193, const hasher& hf = hasher(),
+                           const key_equal& eql = key_equal(),
+                           const allocator_type& a = allocator_type());
+    template <class InputIterator>
+        hash_set(InputIterator f, InputIterator l,
+                      size_type n = 193, const hasher& hf = hasher(),
+                      const key_equal& eql = key_equal(),
+                      const allocator_type& a = allocator_type());
+    hash_set(const hash_set&);
+    ~hash_set();
+    hash_set& operator=(const hash_set&);
+
+    allocator_type get_allocator() const;
+
+    bool      empty() const;
+    size_type size() const;
+    size_type max_size() const;
+
+    iterator       begin();
+    iterator       end();
+    const_iterator begin()  const;
+    const_iterator end()    const;
+
+    pair<iterator, bool> insert(const value_type& obj);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+
+    void erase(const_iterator position);
+    size_type erase(const key_type& k);
+    void erase(const_iterator first, const_iterator last);
+    void clear();
+
+    void swap(hash_set&);
+
+    hasher hash_funct() const;
+    key_equal key_eq() const;
+
+    iterator       find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    size_type count(const key_type& k) const;
+    pair<iterator, iterator>             equal_range(const key_type& k);
+    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
+
+    size_type bucket_count() const;
+    size_type max_bucket_count() const;
+
+    size_type elems_in_bucket(size_type n) const;
+
+    void resize(size_type n);
+};
+
+template <class Value, class Hash, class Pred, class Alloc>
+    void swap(hash_set<Value, Hash, Pred, Alloc>& x,
+              hash_set<Value, Hash, Pred, Alloc>& y);
+
+template <class Value, class Hash, class Pred, class Alloc>
+    bool
+    operator==(const hash_set<Value, Hash, Pred, Alloc>& x,
+               const hash_set<Value, Hash, Pred, Alloc>& y);
+
+template <class Value, class Hash, class Pred, class Alloc>
+    bool
+    operator!=(const hash_set<Value, Hash, Pred, Alloc>& x,
+               const hash_set<Value, Hash, Pred, Alloc>& y);
+
+template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+          class Alloc = allocator<Value>>
+class hash_multiset
+{
+public:
+    // types
+    typedef Value                                                      key_type;
+    typedef key_type                                                   value_type;
+    typedef Hash                                                       hasher;
+    typedef Pred                                                       key_equal;
+    typedef Alloc                                                      allocator_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    typedef typename allocator_traits<allocator_type>::pointer         pointer;
+    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+    typedef typename allocator_traits<allocator_type>::size_type       size_type;
+    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+
+    typedef /unspecified/ iterator;
+    typedef /unspecified/ const_iterator;
+
+    explicit hash_multiset(size_type n = 193, const hasher& hf = hasher(),
+                           const key_equal& eql = key_equal(),
+                           const allocator_type& a = allocator_type());
+    template <class InputIterator>
+        hash_multiset(InputIterator f, InputIterator l,
+                      size_type n = 193, const hasher& hf = hasher(),
+                      const key_equal& eql = key_equal(),
+                      const allocator_type& a = allocator_type());
+    hash_multiset(const hash_multiset&);
+    ~hash_multiset();
+    hash_multiset& operator=(const hash_multiset&);
+
+    allocator_type get_allocator() const;
+
+    bool      empty() const;
+    size_type size() const;
+    size_type max_size() const;
+
+    iterator       begin();
+    iterator       end();
+    const_iterator begin()  const;
+    const_iterator end()    const;
+
+    iterator insert(const value_type& obj);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+
+    void erase(const_iterator position);
+    size_type erase(const key_type& k);
+    void erase(const_iterator first, const_iterator last);
+    void clear();
+
+    void swap(hash_multiset&);
+
+    hasher hash_funct() const;
+    key_equal key_eq() const;
+
+    iterator       find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    size_type count(const key_type& k) const;
+    pair<iterator, iterator>             equal_range(const key_type& k);
+    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
+
+    size_type bucket_count() const;
+    size_type max_bucket_count() const;
+
+    size_type elems_in_bucket(size_type n) const;
+
+    void resize(size_type n);
+};
+
+template <class Value, class Hash, class Pred, class Alloc>
+    void swap(hash_multiset<Value, Hash, Pred, Alloc>& x,
+              hash_multiset<Value, Hash, Pred, Alloc>& y);
+
+template <class Value, class Hash, class Pred, class Alloc>
+    bool
+    operator==(const hash_multiset<Value, Hash, Pred, Alloc>& x,
+               const hash_multiset<Value, Hash, Pred, Alloc>& y);
+
+template <class Value, class Hash, class Pred, class Alloc>
+    bool
+    operator!=(const hash_multiset<Value, Hash, Pred, Alloc>& x,
+               const hash_multiset<Value, Hash, Pred, Alloc>& y);
+}  // __gnu_cxx
+
+*/
+
+#include <__config>
+#include <__hash_table>
+#include <functional>
+#include <ext/__hash>
+
+#if __DEPRECATED
+#if defined(_MSC_VER) && ! defined(__clang__)
+    _LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated.  Migrate to <unordered_set>")
+#else
+#   warning Use of the header <ext/hash_set> is deprecated.  Migrate to <unordered_set>
+#endif
+#endif
+
+namespace __gnu_cxx {
+
+using namespace std;
+
+template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
+          class _Alloc = allocator<_Value> >
+class _LIBCPP_TYPE_VIS_ONLY hash_set
+{
+public:
+    // types
+    typedef _Value                                                     key_type;
+    typedef key_type                                                   value_type;
+    typedef _Hash                                                      hasher;
+    typedef _Pred                                                      key_equal;
+    typedef _Alloc                                                     allocator_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+
+private:
+    typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
+
+    __table __table_;
+
+public:
+    typedef typename __table::pointer         pointer;
+    typedef typename __table::const_pointer   const_pointer;
+    typedef typename __table::size_type       size_type;
+    typedef typename __table::difference_type difference_type;
+
+    typedef typename __table::const_iterator       iterator;
+    typedef typename __table::const_iterator       const_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    hash_set() {__table_.rehash(193);}
+    explicit hash_set(size_type __n, const hasher& __hf = hasher(),
+                           const key_equal& __eql = key_equal());
+    hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
+                  const allocator_type& __a);
+    template <class _InputIterator>
+        hash_set(_InputIterator __first, _InputIterator __last);
+    template <class _InputIterator>
+        hash_set(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf = hasher(),
+                      const key_equal& __eql = key_equal());
+    template <class _InputIterator>
+        hash_set(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf, const key_equal& __eql,
+                      const allocator_type& __a);
+    hash_set(const hash_set& __u);
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const
+        {return allocator_type(__table_.__node_alloc());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool      empty() const {return __table_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const  {return __table_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const {return __table_.max_size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       begin()        {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       end()          {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin()  const {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()    const {return __table_.end();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, bool> insert(const value_type& __x)
+        {return __table_.__insert_unique(__x);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
+    template <class _InputIterator>
+        void insert(_InputIterator __first, _InputIterator __last);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void erase(const_iterator __p) {__table_.erase(__p);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    void erase(const_iterator __first, const_iterator __last)
+        {__table_.erase(__first, __last);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() {__table_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(hash_set& __u) {__table_.swap(__u.__table_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    hasher hash_funct() const {return __table_.hash_function();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_equal key_eq() const {return __table_.key_eq();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       find(const key_type& __k)       {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, iterator>             equal_range(const key_type& __k)
+        {return __table_.__equal_range_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+        {return __table_.__equal_range_unique(__k);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_count() const {return __table_.bucket_count();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_bucket_count() const {return __table_.max_bucket_count();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void resize(size_type __n) {__table_.rehash(__n);}
+};
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n,
+        const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+    __table_.rehash(__n);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n,
+        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+    __table_.rehash(__n);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
+        _InputIterator __first, _InputIterator __last)
+{
+    __table_.rehash(193);
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
+        const hash_set& __u)
+    : __table_(__u.__table_)
+{
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
+                                                    _InputIterator __last)
+{
+    for (; __first != __last; ++__first)
+        __table_.__insert_unique(*__first);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
+     hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+bool
+operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
+           const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
+{
+    if (__x.size() != __y.size())
+        return false;
+    typedef typename hash_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
+                                                                 const_iterator;
+    for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
+            __i != __ex; ++__i)
+    {
+        const_iterator __j = __y.find(*__i);
+        if (__j == __ey || !(*__i == *__j))
+            return false;
+    }
+    return true;
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
+           const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
+          class _Alloc = allocator<_Value> >
+class _LIBCPP_TYPE_VIS_ONLY hash_multiset
+{
+public:
+    // types
+    typedef _Value                                                     key_type;
+    typedef key_type                                                   value_type;
+    typedef _Hash                                                      hasher;
+    typedef _Pred                                                      key_equal;
+    typedef _Alloc                                                     allocator_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+
+private:
+    typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
+
+    __table __table_;
+
+public:
+    typedef typename __table::pointer         pointer;
+    typedef typename __table::const_pointer   const_pointer;
+    typedef typename __table::size_type       size_type;
+    typedef typename __table::difference_type difference_type;
+
+    typedef typename __table::const_iterator       iterator;
+    typedef typename __table::const_iterator       const_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    hash_multiset() {__table_.rehash(193);}
+    explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),
+                                const key_equal& __eql = key_equal());
+    hash_multiset(size_type __n, const hasher& __hf,
+                       const key_equal& __eql, const allocator_type& __a);
+    template <class _InputIterator>
+        hash_multiset(_InputIterator __first, _InputIterator __last);
+    template <class _InputIterator>
+        hash_multiset(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf = hasher(),
+                      const key_equal& __eql = key_equal());
+    template <class _InputIterator>
+        hash_multiset(_InputIterator __first, _InputIterator __last,
+                      size_type __n , const hasher& __hf,
+                      const key_equal& __eql, const allocator_type& __a);
+    hash_multiset(const hash_multiset& __u);
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const
+        {return allocator_type(__table_.__node_alloc());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool      empty() const {return __table_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const  {return __table_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const {return __table_.max_size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       begin()        {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       end()          {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin()  const {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()    const {return __table_.end();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
+    template <class _InputIterator>
+        void insert(_InputIterator __first, _InputIterator __last);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void erase(const_iterator __p) {__table_.erase(__p);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    void erase(const_iterator __first, const_iterator __last)
+        {__table_.erase(__first, __last);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() {__table_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(hash_multiset& __u) {__table_.swap(__u.__table_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    hasher hash_funct() const {return __table_.hash_function();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_equal key_eq() const {return __table_.key_eq();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       find(const key_type& __k)       {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, iterator>             equal_range(const key_type& __k)
+        {return __table_.__equal_range_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+        {return __table_.__equal_range_multi(__k);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_count() const {return __table_.bucket_count();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_bucket_count() const {return __table_.max_bucket_count();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void resize(size_type __n) {__table_.rehash(__n);}
+};
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
+        size_type __n, const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+    __table_.rehash(__n);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
+        size_type __n, const hasher& __hf, const key_equal& __eql,
+        const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+    __table_.rehash(__n);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
+        _InputIterator __first, _InputIterator __last)
+{
+    __table_.rehash(193);
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
+        const hash_multiset& __u)
+    : __table_(__u.__table_)
+{
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
+                                                         _InputIterator __last)
+{
+    for (; __first != __last; ++__first)
+        __table_.__insert_multi(*__first);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+     hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+bool
+operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+           const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+{
+    if (__x.size() != __y.size())
+        return false;
+    typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
+                                                                 const_iterator;
+    typedef pair<const_iterator, const_iterator> _EqRng;
+    for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
+    {
+        _EqRng __xeq = __x.equal_range(*__i);
+        _EqRng __yeq = __y.equal_range(*__i);
+        if (_VSTD::distance(__xeq.first, __xeq.second) !=
+            _VSTD::distance(__yeq.first, __yeq.second) ||
+                  !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+            return false;
+        __i = __xeq.second;
+    }
+    return true;
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+           const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+{
+    return !(__x == __y);
+}
+
+} // __gnu_cxx
+
+#endif  // _LIBCPP_HASH_SET

Property changes on: lab4/.minix-src/include/c++/ext/hash_set
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/arpa/telnet.h
===================================================================
--- lab4/.minix-src/include/arpa/telnet.h	(nonexistent)
+++ lab4/.minix-src/include/arpa/telnet.h	(revision 13)
@@ -0,0 +1,354 @@
+/*	$NetBSD: telnet.h,v 1.12 2006/01/24 17:13:59 christos Exp $	*/
+
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)telnet.h	8.2 (Berkeley) 12/15/93
+ */
+
+#ifndef _ARPA_TELNET_H_
+#define	_ARPA_TELNET_H_
+
+/*
+ * Definitions for the TELNET protocol.
+ */
+#define	IAC	255		/* interpret as command: */
+#define	DONT	254		/* you are not to use option */
+#define	DO	253		/* please, you use option */
+#define	WONT	252		/* I won't use option */
+#define	WILL	251		/* I will use option */
+#define	SB	250		/* interpret as subnegotiation */
+#define	GA	249		/* you may reverse the line */
+#define	EL	248		/* erase the current line */
+#define	EC	247		/* erase the current character */
+#define	AYT	246		/* are you there */
+#define	AO	245		/* abort output--but let prog finish */
+#define	IP	244		/* interrupt process--permanently */
+#define	BREAK	243		/* break */
+#define	DM	242		/* data mark--for connect. cleaning */
+#define	NOP	241		/* nop */
+#define	SE	240		/* end sub negotiation */
+#define EOR     239             /* end of record (transparent mode) */
+#define	ABORT	238		/* Abort process */
+#define	SUSP	237		/* Suspend process */
+#define	xEOF	236		/* End of file: EOF is already used... */
+
+#define SYNCH	242		/* for telfunc calls */
+
+#ifdef TELCMDS
+const char *telcmds[] = {
+	"EOF", "SUSP", "ABORT", "EOR",
+	"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
+	"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0
+};
+#else
+extern const char *telcmds[];
+#endif
+
+#define	TELCMD_FIRST	xEOF
+#define	TELCMD_LAST	IAC
+#define	TELCMD_OK(x)	((unsigned int)(x) <= TELCMD_LAST && \
+			 (unsigned int)(x) >= TELCMD_FIRST)
+#define	TELCMD(x)	telcmds[(x)-TELCMD_FIRST]
+
+/* telnet options */
+#define TELOPT_BINARY	0	/* 8-bit data path */
+#define TELOPT_ECHO	1	/* echo */
+#define	TELOPT_RCP	2	/* prepare to reconnect */
+#define	TELOPT_SGA	3	/* suppress go ahead */
+#define	TELOPT_NAMS	4	/* approximate message size */
+#define	TELOPT_STATUS	5	/* give status */
+#define	TELOPT_TM	6	/* timing mark */
+#define	TELOPT_RCTE	7	/* remote controlled transmission and echo */
+#define TELOPT_NAOL 	8	/* negotiate about output line width */
+#define TELOPT_NAOP 	9	/* negotiate about output page size */
+#define TELOPT_NAOCRD	10	/* negotiate about CR disposition */
+#define TELOPT_NAOHTS	11	/* negotiate about horizontal tabstops */
+#define TELOPT_NAOHTD	12	/* negotiate about horizontal tab disposition */
+#define TELOPT_NAOFFD	13	/* negotiate about formfeed disposition */
+#define TELOPT_NAOVTS	14	/* negotiate about vertical tab stops */
+#define TELOPT_NAOVTD	15	/* negotiate about vertical tab disposition */
+#define TELOPT_NAOLFD	16	/* negotiate about output LF disposition */
+#define TELOPT_XASCII	17	/* extended ascic character set */
+#define	TELOPT_LOGOUT	18	/* force logout */
+#define	TELOPT_BM	19	/* byte macro */
+#define	TELOPT_DET	20	/* data entry terminal */
+#define	TELOPT_SUPDUP	21	/* supdup protocol */
+#define	TELOPT_SUPDUPOUTPUT 22	/* supdup output */
+#define	TELOPT_SNDLOC	23	/* send location */
+#define	TELOPT_TTYPE	24	/* terminal type */
+#define	TELOPT_EOR	25	/* end or record */
+#define	TELOPT_TUID	26	/* TACACS user identification */
+#define	TELOPT_OUTMRK	27	/* output marking */
+#define	TELOPT_TTYLOC	28	/* terminal location number */
+#define	TELOPT_3270REGIME 29	/* 3270 regime */
+#define	TELOPT_X3PAD	30	/* X.3 PAD */
+#define	TELOPT_NAWS	31	/* window size */
+#define	TELOPT_TSPEED	32	/* terminal speed */
+#define	TELOPT_LFLOW	33	/* remote flow control */
+#define TELOPT_LINEMODE	34	/* Linemode option */
+#define TELOPT_XDISPLOC	35	/* X Display Location */
+#define TELOPT_OLD_ENVIRON 36	/* Old - Environment variables */
+#define	TELOPT_AUTHENTICATION 37/* Authenticate */
+#define	TELOPT_ENCRYPT	38	/* Encryption option */
+#define TELOPT_NEW_ENVIRON 39	/* New - Environment variables */
+#define	TELOPT_TN3270E	40	/* RFC2355 - TN3270 Enhancements */
+#define	TELOPT_CHARSET	42	/* RFC2066 - Charset */
+#define	TELOPT_COMPORT	44	/* RFC2217 - Com Port Control */
+#define	TELOPT_KERMIT	47	/* RFC2840 - Kermit */
+#define	TELOPT_EXOPL	255	/* extended-options-list */
+
+
+#define	TELOPT_FIRST	TELOPT_BINARY
+#define	TELOPT_LAST	TELOPT_KERMIT
+#define	TELOPT_OK(x)	((unsigned int)(x) <= TELOPT_LAST)
+#define	TELOPT(x)	telopts[(x)-TELOPT_FIRST]
+
+#define	NTELOPTS	(1+TELOPT_LAST)
+
+#ifdef TELOPTS
+const char *telopts[NTELOPTS+1] = {
+	"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
+	"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
+	"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
+	"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
+	"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
+	"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
+	"TACACS UID", "OUTPUT MARKING", "TTYLOC",
+	"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
+	"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
+	"ENCRYPT", "NEW-ENVIRON", "TN3270E", "CHARSET", "COM-PORT",
+	"KERMIT",
+	0
+};
+#else
+extern const char *telopts[NTELOPTS+1];
+#endif
+
+/* sub-option qualifiers */
+#define	TELQUAL_IS	0	/* option is... */
+#define	TELQUAL_SEND	1	/* send option */
+#define	TELQUAL_INFO	2	/* ENVIRON: informational version of IS */
+#define	TELQUAL_REPLY	2	/* AUTHENTICATION: client version of IS */
+#define	TELQUAL_NAME	3	/* AUTHENTICATION: client version of IS */
+
+#define	LFLOW_OFF		0	/* Disable remote flow control */
+#define	LFLOW_ON		1	/* Enable remote flow control */
+#define	LFLOW_RESTART_ANY	2	/* Restart output on any char */
+#define	LFLOW_RESTART_XON	3	/* Restart output only on XON */
+
+/*
+ * LINEMODE suboptions
+ */
+
+#define	LM_MODE		1
+#define	LM_FORWARDMASK	2
+#define	LM_SLC		3
+
+#define	MODE_EDIT	0x01
+#define	MODE_TRAPSIG	0x02
+#define	MODE_ACK	0x04
+#define MODE_SOFT_TAB	0x08
+#define MODE_LIT_ECHO	0x10
+
+#define	MODE_MASK	0x1f
+
+/* Not part of protocol, but needed to simplify things... */
+#define MODE_FLOW		0x0100
+#define MODE_ECHO		0x0200
+#define MODE_INBIN		0x0400
+#define MODE_OUTBIN		0x0800
+#define MODE_FORCE		0x1000
+
+#define	SLC_SYNCH	1
+#define	SLC_BRK		2
+#define	SLC_IP		3
+#define	SLC_AO		4
+#define	SLC_AYT		5
+#define	SLC_EOR		6
+#define	SLC_ABORT	7
+#define	SLC_EOF		8
+#define	SLC_SUSP	9
+#define	SLC_EC		10
+#define	SLC_EL		11
+#define	SLC_EW		12
+#define	SLC_RP		13
+#define	SLC_LNEXT	14
+#define	SLC_XON		15
+#define	SLC_XOFF	16
+#define	SLC_FORW1	17
+#define	SLC_FORW2	18
+#define	SLC_MCL         19
+#define	SLC_MCR         20
+#define	SLC_MCWL        21
+#define	SLC_MCWR        22
+#define	SLC_MCBOL       23
+#define	SLC_MCEOL       24
+#define	SLC_INSRT       25
+#define	SLC_OVER        26
+#define	SLC_ECR         27
+#define	SLC_EWR         28
+#define	SLC_EBOL        29
+#define	SLC_EEOL        30
+
+#define	NSLC		30
+
+/*
+ * For backwards compatibility, we define SLC_NAMES to be the
+ * list of names if SLC_NAMES is not defined.
+ */
+#define	SLC_NAMELIST	"0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR",	\
+ 			"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP",	\
+ 			"LNEXT", "XON", "XOFF", "FORW1", "FORW2",	\
+ 			"MCL", "MCR", "MCWL", "MCWR", "MCBOL",		\
+ 			"MCEOL", "INSRT", "OVER", "ECR", "EWR",		\
+ 			"EBOL", "EEOL",					\
+ 			0
+
+#ifdef	SLC_NAMES
+char *slc_names[] = {
+	SLC_NAMELIST
+};
+#else
+extern char *slc_names[];
+#define	SLC_NAMES SLC_NAMELIST
+#endif
+
+#define	SLC_NAME_OK(x)	((unsigned int)(x) <= NSLC)
+#define SLC_NAME(x)	slc_names[x]
+
+#define	SLC_NOSUPPORT	0
+#define	SLC_CANTCHANGE	1
+#define	SLC_VARIABLE	2
+#define	SLC_DEFAULT	3
+#define	SLC_LEVELBITS	0x03
+
+#define	SLC_FUNC	0
+#define	SLC_FLAGS	1
+#define	SLC_VALUE	2
+
+#define	SLC_ACK		0x80
+#define	SLC_FLUSHIN	0x40
+#define	SLC_FLUSHOUT	0x20
+
+#define	OLD_ENV_VAR	1
+#define	OLD_ENV_VALUE	0
+#define	NEW_ENV_VAR	0
+#define	NEW_ENV_VALUE	1
+#define	ENV_ESC		2
+#define ENV_USERVAR	3
+
+/*
+ * AUTHENTICATION suboptions
+ */
+
+/*
+ * Who is authenticating who ...
+ */
+#define	AUTH_WHO_CLIENT		0	/* Client authenticating server */
+#define	AUTH_WHO_SERVER		1	/* Server authenticating client */
+#define	AUTH_WHO_MASK		1
+
+/*
+ * amount of authentication done
+ */
+#define	AUTH_HOW_ONE_WAY	0
+#define	AUTH_HOW_MUTUAL		2
+#define	AUTH_HOW_MASK		2
+
+/*
+ * should we be encrypting? (not yet formally standardized)
+ */
+#define AUTH_ENCRYPT_OFF	0
+#define AUTH_ENCRYPT_ON		4
+#define AUTH_ENCRYPT_MASK	4
+
+#define	AUTHTYPE_NULL		0
+#define	AUTHTYPE_KERBEROS_V4	1
+#define	AUTHTYPE_KERBEROS_V5	2
+#define	AUTHTYPE_SPX		3
+#define	AUTHTYPE_MINK		4
+#define	AUTHTYPE_SRA		6
+#define	AUTHTYPE_CNT		7
+
+#define	AUTHTYPE_TEST		99
+
+#ifdef	AUTH_NAMES
+const char *authtype_names[] = {
+	"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", NULL, "SRA",
+	0
+};
+#else
+extern const char *authtype_names[];
+#endif
+
+#define	AUTHTYPE_NAME_OK(x)	((unsigned int)(x) < AUTHTYPE_CNT)
+#define	AUTHTYPE_NAME(x)	authtype_names[x]
+
+/*
+ * ENCRYPTion suboptions
+ */
+#define	ENCRYPT_IS		0	/* I pick encryption type ... */
+#define	ENCRYPT_SUPPORT		1	/* I support encryption types ... */
+#define	ENCRYPT_REPLY		2	/* Initial setup response */
+#define	ENCRYPT_START		3	/* Am starting to send encrypted */
+#define	ENCRYPT_END		4	/* Am ending encrypted */
+#define	ENCRYPT_REQSTART	5	/* Request you start encrypting */
+#define	ENCRYPT_REQEND		6	/* Request you send encrypting */
+#define	ENCRYPT_ENC_KEYID	7
+#define	ENCRYPT_DEC_KEYID	8
+#define	ENCRYPT_CNT		9
+
+#define	ENCTYPE_ANY		0
+#define	ENCTYPE_DES_CFB64	1
+#define	ENCTYPE_DES_OFB64	2
+#define	ENCTYPE_CNT		3
+
+#ifdef	ENCRYPT_NAMES
+const char *encrypt_names[] = {
+	"IS", "SUPPORT", "REPLY", "START", "END",
+	"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
+	0
+};
+const char *enctype_names[] = {
+	"ANY", "DES_CFB64",  "DES_OFB64",
+	0
+};
+#else
+extern const char *encrypt_names[];
+extern const char *enctype_names[];
+#endif
+
+
+#define	ENCRYPT_NAME_OK(x)	((unsigned int)(x) < ENCRYPT_CNT)
+#define	ENCRYPT_NAME(x)		encrypt_names[x]
+
+#define	ENCTYPE_NAME_OK(x)	((unsigned int)(x) < ENCTYPE_CNT)
+#define	ENCTYPE_NAME(x)		enctype_names[x]
+
+#endif /* _ARPA_TELNET_H_ */

Property changes on: lab4/.minix-src/include/arpa/telnet.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/arpa/tftp.h
===================================================================
--- lab4/.minix-src/include/arpa/tftp.h	(nonexistent)
+++ lab4/.minix-src/include/arpa/tftp.h	(revision 13)
@@ -0,0 +1,84 @@
+/*	$NetBSD: tftp.h,v 1.8 2003/08/07 09:44:12 agc Exp $	*/
+
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tftp.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _ARPA_TFTP_H_
+#define	_ARPA_TFTP_H_
+
+/*
+ * Trivial File Transfer Protocol (IEN-133)
+ */
+#define	SEGSIZE		512	/* data segment size */
+#define	MAXSEGSIZE	65464	/* maximum negotiated data segment size */
+
+#define PKTSIZE		SEGSIZE + 4
+#define MAXPKTSIZE	MAXSEGSIZE + 4
+
+/*
+ * Packet types.
+ */
+#define	RRQ	01			/* read request */
+#define	WRQ	02			/* write request */
+#define	DATA	03			/* data packet */
+#define	ACK	04			/* acknowledgement */
+#define	ERROR	05			/* error code */
+#define	OACK	06			/* option acknowledgement */
+
+struct	tftphdr {
+	short	th_opcode;		/* packet type */
+	union {
+		unsigned short tu_block; /* block # */
+		short	tu_code;	/* error code */
+		char	tu_stuff[1];	/* request packet stuff */
+	} th_u;
+	char	th_data[1];		/* data or error string */
+};
+
+#define	th_block	th_u.tu_block
+#define	th_code		th_u.tu_code
+#define	th_stuff	th_u.tu_stuff
+#define	th_msg		th_data
+
+/*
+ * Error codes.
+ */
+#define	EUNDEF		0		/* not defined */
+#define	ENOTFOUND	1		/* file not found */
+#define	EACCESS		2		/* access violation */
+#define	ENOSPACE	3		/* disk full or allocation exceeded */
+#define	EBADOP		4		/* illegal TFTP operation */
+#define	EBADID		5		/* unknown transfer ID */
+#define	EEXISTS		6		/* file already exists */
+#define	ENOUSER		7		/* no such user */
+#define	EOPTNEG		8		/* option negotiation failed */
+
+#endif /* _ARPA_TFTP_H_ */

Property changes on: lab4/.minix-src/include/arpa/tftp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__debug
===================================================================
--- lab4/.minix-src/include/c++/__debug	(nonexistent)
+++ lab4/.minix-src/include/c++/__debug	(revision 13)
@@ -0,0 +1,222 @@
+// -*- C++ -*-
+//===--------------------------- __debug ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_DEBUG_H
+#define _LIBCPP_DEBUG_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#if _LIBCPP_DEBUG_LEVEL >= 1
+#   include <cstdlib>
+#   include <cstdio>
+#   include <cstddef>
+#   ifndef _LIBCPP_ASSERT
+#      define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::fprintf(stderr, "%s\n", m), _VSTD::abort()))
+#   endif
+#endif
+
+#ifndef _LIBCPP_ASSERT
+#   define _LIBCPP_ASSERT(x, m) ((void)0)
+#endif
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+struct _LIBCPP_TYPE_VIS __c_node;
+
+struct _LIBCPP_TYPE_VIS __i_node
+{
+    void* __i_;
+    __i_node* __next_;
+    __c_node* __c_;
+
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+    __i_node(const __i_node&) = delete;
+    __i_node& operator=(const __i_node&) = delete;
+#else
+private:
+    __i_node(const __i_node&);
+    __i_node& operator=(const __i_node&);
+public:
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    __i_node(void* __i, __i_node* __next, __c_node* __c)
+        : __i_(__i), __next_(__next), __c_(__c) {}
+    ~__i_node();
+};
+
+struct _LIBCPP_TYPE_VIS __c_node
+{
+    void* __c_;
+    __c_node* __next_;
+    __i_node** beg_;
+    __i_node** end_;
+    __i_node** cap_;
+
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+    __c_node(const __c_node&) = delete;
+    __c_node& operator=(const __c_node&) = delete;
+#else
+private:
+    __c_node(const __c_node&);
+    __c_node& operator=(const __c_node&);
+public:
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    __c_node(void* __c, __c_node* __next)
+        : __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
+    virtual ~__c_node();
+
+    virtual bool __dereferenceable(const void*) const = 0;
+    virtual bool __decrementable(const void*) const = 0;
+    virtual bool __addable(const void*, ptrdiff_t) const = 0;
+    virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
+
+    void __add(__i_node* __i);
+    _LIBCPP_HIDDEN void __remove(__i_node* __i);
+};
+
+template <class _Cont>
+struct _C_node
+    : public __c_node
+{
+    _C_node(void* __c, __c_node* __n)
+        : __c_node(__c, __n) {}
+
+    virtual bool __dereferenceable(const void*) const;
+    virtual bool __decrementable(const void*) const;
+    virtual bool __addable(const void*, ptrdiff_t) const;
+    virtual bool __subscriptable(const void*, ptrdiff_t) const;
+};
+
+template <class _Cont>
+bool
+_C_node<_Cont>::__dereferenceable(const void* __i) const
+{
+    typedef typename _Cont::const_iterator iterator;
+    const iterator* __j = static_cast<const iterator*>(__i);
+    _Cont* _Cp = static_cast<_Cont*>(__c_);
+    return _Cp->__dereferenceable(__j);
+}
+
+template <class _Cont>
+bool
+_C_node<_Cont>::__decrementable(const void* __i) const
+{
+    typedef typename _Cont::const_iterator iterator;
+    const iterator* __j = static_cast<const iterator*>(__i);
+    _Cont* _Cp = static_cast<_Cont*>(__c_);
+    return _Cp->__decrementable(__j);
+}
+
+template <class _Cont>
+bool
+_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
+{
+    typedef typename _Cont::const_iterator iterator;
+    const iterator* __j = static_cast<const iterator*>(__i);
+    _Cont* _Cp = static_cast<_Cont*>(__c_);
+    return _Cp->__addable(__j, __n);
+}
+
+template <class _Cont>
+bool
+_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
+{
+    typedef typename _Cont::const_iterator iterator;
+    const iterator* __j = static_cast<const iterator*>(__i);
+    _Cont* _Cp = static_cast<_Cont*>(__c_);
+    return _Cp->__subscriptable(__j, __n);
+}
+
+class _LIBCPP_TYPE_VIS __libcpp_db
+{
+    __c_node** __cbeg_;
+    __c_node** __cend_;
+    size_t   __csz_;
+    __i_node** __ibeg_;
+    __i_node** __iend_;
+    size_t   __isz_;
+
+    __libcpp_db();
+public:
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+    __libcpp_db(const __libcpp_db&) = delete;
+    __libcpp_db& operator=(const __libcpp_db&) = delete;
+#else
+private:
+    __libcpp_db(const __libcpp_db&);
+    __libcpp_db& operator=(const __libcpp_db&);
+public:
+#endif
+    ~__libcpp_db();
+
+    class __db_c_iterator;
+    class __db_c_const_iterator;
+    class __db_i_iterator;
+    class __db_i_const_iterator;
+
+    __db_c_const_iterator __c_end() const;
+    __db_i_const_iterator __i_end() const;
+
+    template <class _Cont>
+    _LIBCPP_INLINE_VISIBILITY
+    void __insert_c(_Cont* __c)
+    {
+        __c_node* __n = __insert_c(static_cast<void*>(__c));
+        ::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
+    }
+
+    void __insert_i(void* __i);
+    __c_node* __insert_c(void* __c);
+    void __erase_c(void* __c);
+
+    void __insert_ic(void* __i, const void* __c);
+    void __iterator_copy(void* __i, const void* __i0);
+    void __erase_i(void* __i);
+
+    void* __find_c_from_i(void* __i) const;
+    void __invalidate_all(void* __c);
+    __c_node* __find_c_and_lock(void* __c) const;
+    __c_node* __find_c(void* __c) const;
+    void unlock() const;
+
+    void swap(void* __c1, void* __c2);
+
+
+    bool __dereferenceable(const void* __i) const;
+    bool __decrementable(const void* __i) const;
+    bool __addable(const void* __i, ptrdiff_t __n) const;
+    bool __subscriptable(const void* __i, ptrdiff_t __n) const;
+    bool __less_than_comparable(const void* __i, const void* __j) const;
+private:
+    _LIBCPP_HIDDEN
+    __i_node* __insert_iterator(void* __i);
+    _LIBCPP_HIDDEN
+    __i_node* __find_iterator(const void* __i) const;
+
+    friend _LIBCPP_FUNC_VIS __libcpp_db* __get_db();
+};
+
+_LIBCPP_FUNC_VIS __libcpp_db* __get_db();
+_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
+
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif
+
+#endif  // _LIBCPP_DEBUG_H
+

Property changes on: lab4/.minix-src/include/c++/__debug
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c/build.h
===================================================================
--- lab4/.minix-src/include/atf-c/build.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c/build.h	(revision 13)
@@ -0,0 +1,42 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_BUILD_H)
+#define ATF_C_BUILD_H
+
+#include <atf-c/error_fwd.h>
+
+atf_error_t atf_build_c_o(const char *, const char *, const char *const [],
+                          char ***);
+atf_error_t atf_build_cpp(const char *, const char *, const char *const [],
+                          char ***);
+atf_error_t atf_build_cxx_o(const char *, const char *, const char *const [],
+                            char ***);
+
+#endif /* ATF_C_BUILD_H */

Property changes on: lab4/.minix-src/include/atf-c/build.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__functional_base_03
===================================================================
--- lab4/.minix-src/include/c++/__functional_base_03	(nonexistent)
+++ lab4/.minix-src/include/c++/__functional_base_03	(revision 13)
@@ -0,0 +1,524 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_FUNCTIONAL_BASE_03
+#define _LIBCPP_FUNCTIONAL_BASE_03
+
+// manual variadic expansion for <functional>
+
+// __invoke
+// first bullet
+
+template <class _Rp, class _Tp, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(), _T1& __t1)
+{
+    return (__t1.*__f)();
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0), _T1& __t1, _A0& __a0)
+{
+    return (__t1.*__f)(__a0);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1& __t1, _A0& __a0, _A1& __a1)
+{
+    return (__t1.*__f)(__a0, __a1);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return (__t1.*__f)(__a0, __a1, __a2);
+}
+
+template <class _Rp, class _Tp, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)() const, _T1& __t1)
+{
+    return (__t1.*__f)();
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0) const, _T1& __t1, _A0& __a0)
+{
+    return (__t1.*__f)(__a0);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1& __t1, _A0& __a0, _A1& __a1)
+{
+    return (__t1.*__f)(__a0, __a1);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return (__t1.*__f)(__a0, __a1, __a2);
+}
+
+template <class _Rp, class _Tp, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)() volatile, _T1& __t1)
+{
+    return (__t1.*__f)();
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1& __t1, _A0& __a0)
+{
+    return (__t1.*__f)(__a0);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1& __t1, _A0& __a0, _A1& __a1)
+{
+    return (__t1.*__f)(__a0, __a1);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return (__t1.*__f)(__a0, __a1, __a2);
+}
+
+template <class _Rp, class _Tp, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)() const volatile, _T1& __t1)
+{
+    return (__t1.*__f)();
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1& __t1, _A0& __a0)
+{
+    return (__t1.*__f)(__a0);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1& __t1, _A0& __a0, _A1& __a1)
+{
+    return (__t1.*__f)(__a0, __a1);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return (__t1.*__f)(__a0, __a1, __a2);
+}
+
+// second bullet
+
+template <class _Rp, class _Tp, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(), _T1 __t1)
+{
+    return ((*__t1).*__f)();
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0), _T1 __t1, _A0& __a0)
+{
+    return ((*__t1).*__f)(__a0);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1 __t1, _A0& __a0, _A1& __a1)
+{
+    return ((*__t1).*__f)(__a0, __a1);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return ((*__t1).*__f)(__a0, __a1, __a2);
+}
+
+template <class _Rp, class _Tp, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)() const, _T1 __t1)
+{
+    return ((*__t1).*__f)();
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0) const, _T1 __t1, _A0& __a0)
+{
+    return ((*__t1).*__f)(__a0);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1 __t1, _A0& __a0, _A1& __a1)
+{
+    return ((*__t1).*__f)(__a0, __a1);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return ((*__t1).*__f)(__a0, __a1, __a2);
+}
+
+template <class _Rp, class _Tp, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)() volatile, _T1 __t1)
+{
+    return ((*__t1).*__f)();
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1 __t1, _A0& __a0)
+{
+    return ((*__t1).*__f)(__a0);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1 __t1, _A0& __a0, _A1& __a1)
+{
+    return ((*__t1).*__f)(__a0, __a1);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return ((*__t1).*__f)(__a0, __a1, __a2);
+}
+
+template <class _Rp, class _Tp, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)() const volatile, _T1 __t1)
+{
+    return ((*__t1).*__f)();
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1 __t1, _A0& __a0)
+{
+    return ((*__t1).*__f)(__a0);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1 __t1, _A0& __a0, _A1& __a1)
+{
+    return ((*__t1).*__f)(__a0, __a1);
+}
+
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+    _Rp
+>::type
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return ((*__t1).*__f)(__a0, __a1, __a2);
+}
+
+// third bullet
+
+template <class _Rp, class _Tp, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_member_object_pointer<_Rp _Tp::*>::value &&
+    is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+   __apply_cv<_T1, _Rp>
+>::type::type&
+__invoke(_Rp _Tp::* __f, _T1& __t1)
+{
+    return __t1.*__f;
+}
+
+
+// forth bullet
+
+template <class _T1, class _Rp, bool>
+struct __4th_helper
+{
+};
+
+template <class _T1, class _Rp>
+struct __4th_helper<_T1, _Rp, true>
+{
+    typedef typename __apply_cv<decltype(*_VSTD::declval<_T1&>()), _Rp>::type type;
+};
+
+template <class _Rp, class _Tp, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __4th_helper<_T1, _Rp,
+    is_member_object_pointer<_Rp _Tp::*>::value &&
+    !is_base_of<_Tp, typename remove_reference<_T1>::type>::value
+>::type&
+__invoke(_Rp _Tp::* __f, _T1& __t1)
+{
+    return (*__t1).*__f;
+}
+
+// fifth bullet
+
+template <class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+decltype(_VSTD::declval<_Fp&>()())
+__invoke(_Fp& __f)
+{
+    return __f();
+}
+
+template <class _Fp, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>()))
+__invoke(_Fp& __f, _A0& __a0)
+{
+    return __f(__a0);
+}
+
+template <class _Fp, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>()))
+__invoke(_Fp& __f, _A0& __a0, _A1& __a1)
+{
+    return __f(__a0, __a1);
+}
+
+template <class _Fp, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>(), _VSTD::declval<_A2&>()))
+__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return __f(__a0, __a1, __a2);
+}
+
+template <class _Fp, bool = __has_result_type<__weak_result_type<_Fp> >::value>
+struct __invoke_return
+{
+    typedef typename __weak_result_type<_Fp>::result_type type;
+};
+
+template <class _Fp>
+struct __invoke_return<_Fp, false>
+{
+    typedef decltype(__invoke(_VSTD::declval<_Fp&>())) type;
+};
+
+template <class _Tp, class _A0, bool = is_member_object_pointer<_Tp>::value>
+struct __invoke_return0
+{
+    typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>())) type;
+};
+
+template <class _Rp, class _Tp, class _A0>
+struct __invoke_return0<_Rp _Tp::*, _A0, true>
+{
+    typedef typename __apply_cv<_A0, _Rp>::type& type;
+};
+
+template <class _Rp, class _Tp, class _A0>
+struct __invoke_return0<_Rp _Tp::*, _A0*, true>
+{
+    typedef typename __apply_cv<_A0, _Rp>::type& type;
+};
+
+template <class _Tp, class _A0, class _A1>
+struct __invoke_return1
+{
+    typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
+                                                     _VSTD::declval<_A1&>())) type;
+};
+
+template <class _Tp, class _A0, class _A1, class _A2>
+struct __invoke_return2
+{
+    typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
+                                                      _VSTD::declval<_A1&>(),
+                                                      _VSTD::declval<_A2&>())) type;
+};
+
+#endif  // _LIBCPP_FUNCTIONAL_BASE_03

Property changes on: lab4/.minix-src/include/c++/__functional_base_03
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__split_buffer
===================================================================
--- lab4/.minix-src/include/c++/__split_buffer	(nonexistent)
+++ lab4/.minix-src/include/c++/__split_buffer	(revision 13)
@@ -0,0 +1,635 @@
+// -*- C++ -*-
+#ifndef _LIBCPP_SPLIT_BUFFER
+#define _LIBCPP_SPLIT_BUFFER
+
+#include <__config>
+#include <type_traits>
+#include <algorithm>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <bool>
+class __split_buffer_common
+{
+protected:
+    void __throw_length_error() const;
+    void __throw_out_of_range() const;
+};
+
+template <class _Tp, class _Allocator = allocator<_Tp> >
+struct __split_buffer
+    : private __split_buffer_common<true>
+{
+private:
+    __split_buffer(const __split_buffer&);
+    __split_buffer& operator=(const __split_buffer&);
+public:
+    typedef _Tp                                             value_type;
+    typedef _Allocator                                      allocator_type;
+    typedef typename remove_reference<allocator_type>::type __alloc_rr;
+    typedef allocator_traits<__alloc_rr>                    __alloc_traits;
+    typedef value_type&                                     reference;
+    typedef const value_type&                               const_reference;
+    typedef typename __alloc_traits::size_type              size_type;
+    typedef typename __alloc_traits::difference_type        difference_type;
+    typedef typename __alloc_traits::pointer                pointer;
+    typedef typename __alloc_traits::const_pointer          const_pointer;
+    typedef pointer                                         iterator;
+    typedef const_pointer                                   const_iterator;
+
+    pointer                                         __first_;
+    pointer                                         __begin_;
+    pointer                                         __end_;
+    __compressed_pair<pointer, allocator_type> __end_cap_;
+
+    typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref;
+    typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref;
+
+    _LIBCPP_INLINE_VISIBILITY __alloc_rr&           __alloc() _NOEXCEPT         {return __end_cap_.second();}
+    _LIBCPP_INLINE_VISIBILITY const __alloc_rr&     __alloc() const _NOEXCEPT   {return __end_cap_.second();}
+    _LIBCPP_INLINE_VISIBILITY pointer&              __end_cap() _NOEXCEPT       {return __end_cap_.first();}
+    _LIBCPP_INLINE_VISIBILITY const pointer&        __end_cap() const _NOEXCEPT {return __end_cap_.first();}
+
+    __split_buffer()
+        _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
+    explicit __split_buffer(__alloc_rr& __a);
+    explicit __split_buffer(const __alloc_rr& __a);
+    __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
+    ~__split_buffer();
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __split_buffer(__split_buffer&& __c)
+        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+    __split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
+    __split_buffer& operator=(__split_buffer&& __c)
+        _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
+                is_nothrow_move_assignable<allocator_type>::value) ||
+               !__alloc_traits::propagate_on_container_move_assignment::value);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY       iterator begin() _NOEXCEPT       {return __begin_;}
+    _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
+    _LIBCPP_INLINE_VISIBILITY       iterator end() _NOEXCEPT         {return __end_;}
+    _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT   {return __end_;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT
+        {__destruct_at_end(__begin_);}
+    _LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
+    _LIBCPP_INLINE_VISIBILITY bool empty()     const {return __end_ == __begin_;}
+    _LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
+    _LIBCPP_INLINE_VISIBILITY size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);}
+    _LIBCPP_INLINE_VISIBILITY size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);}
+
+    _LIBCPP_INLINE_VISIBILITY       reference front()       {return *__begin_;}
+    _LIBCPP_INLINE_VISIBILITY const_reference front() const {return *__begin_;}
+    _LIBCPP_INLINE_VISIBILITY       reference back()        {return *(__end_ - 1);}
+    _LIBCPP_INLINE_VISIBILITY const_reference back() const  {return *(__end_ - 1);}
+
+    void reserve(size_type __n);
+    void shrink_to_fit() _NOEXCEPT;
+    void push_front(const_reference __x);
+    _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+    void push_front(value_type&& __x);
+    void push_back(value_type&& __x);
+#if !defined(_LIBCPP_HAS_NO_VARIADICS)
+    template <class... _Args>
+        void emplace_back(_Args&&... __args);
+#endif  // !defined(_LIBCPP_HAS_NO_VARIADICS)
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+    _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
+    _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
+
+    void __construct_at_end(size_type __n);
+    void __construct_at_end(size_type __n, const_reference __x);
+    template <class _InputIter>
+        typename enable_if
+        <
+            __is_input_iterator<_InputIter>::value &&
+           !__is_forward_iterator<_InputIter>::value,
+            void
+        >::type
+        __construct_at_end(_InputIter __first, _InputIter __last);
+    template <class _ForwardIterator>
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value,
+            void
+        >::type
+        __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
+
+    _LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
+        {__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
+        void __destruct_at_begin(pointer __new_begin, false_type);
+        void __destruct_at_begin(pointer __new_begin, true_type);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __destruct_at_end(pointer __new_last) _NOEXCEPT
+        {__destruct_at_end(__new_last, false_type());}
+    _LIBCPP_INLINE_VISIBILITY
+        void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+        void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
+
+    void swap(__split_buffer& __x)
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
+                   __is_nothrow_swappable<__alloc_rr>::value);
+
+    bool __invariants() const;
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__split_buffer& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+        {
+            __alloc() = _VSTD::move(__c.__alloc());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
+        {}
+};
+
+template <class _Tp, class _Allocator>
+bool
+__split_buffer<_Tp, _Allocator>::__invariants() const
+{
+    if (__first_ == nullptr)
+    {
+        if (__begin_ != nullptr)
+            return false;
+        if (__end_ != nullptr)
+            return false;
+        if (__end_cap() != nullptr)
+            return false;
+    }
+    else
+    {
+        if (__begin_ < __first_)
+            return false;
+        if (__end_ < __begin_)
+            return false;
+        if (__end_cap() < __end_)
+            return false;
+    }
+    return true;
+}
+
+//  Default constructs __n objects starting at __end_
+//  throws if construction throws
+//  Precondition:  __n > 0
+//  Precondition:  size() + __n <= capacity()
+//  Postcondition:  size() == size() + __n
+template <class _Tp, class _Allocator>
+void
+__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
+{
+    __alloc_rr& __a = this->__alloc();
+    do
+    {
+        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
+        ++this->__end_;
+        --__n;
+    } while (__n > 0);
+}
+
+//  Copy constructs __n objects starting at __end_ from __x
+//  throws if construction throws
+//  Precondition:  __n > 0
+//  Precondition:  size() + __n <= capacity()
+//  Postcondition:  size() == old size() + __n
+//  Postcondition:  [i] == __x for all i in [size() - __n, __n)
+template <class _Tp, class _Allocator>
+void
+__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
+{
+    __alloc_rr& __a = this->__alloc();
+    do
+    {
+        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
+        ++this->__end_;
+        --__n;
+    } while (__n > 0);
+}
+
+template <class _Tp, class _Allocator>
+template <class _InputIter>
+typename enable_if
+<
+     __is_input_iterator<_InputIter>::value &&
+    !__is_forward_iterator<_InputIter>::value,
+    void
+>::type
+__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
+{
+    __alloc_rr& __a = this->__alloc();
+    for (; __first != __last; ++__first)
+    {
+        if (__end_ == __end_cap())
+        {
+            size_type __old_cap = __end_cap() - __first_;
+            size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
+            __split_buffer __buf(__new_cap, 0, __a);
+            for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
+                __alloc_traits::construct(__buf.__alloc(),
+                        _VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
+            swap(__buf);
+        }
+        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
+        ++this->__end_;
+    }
+}
+
+template <class _Tp, class _Allocator>
+template <class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value,
+    void
+>::type
+__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
+{
+    __alloc_rr& __a = this->__alloc();
+    for (; __first != __last; ++__first)
+    {
+        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
+        ++this->__end_;
+    }
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
+{
+    while (__begin_ != __new_begin)
+        __alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
+{
+    __begin_ = __new_begin;
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
+{
+    while (__new_last != __end_)
+        __alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
+{
+    __end_ = __new_last;
+}
+
+template <class _Tp, class _Allocator>
+__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
+    : __end_cap_(nullptr, __a)
+{
+    __first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
+    __begin_ = __end_ = __first_ + __start;
+    __end_cap() = __first_ + __cap;
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+__split_buffer<_Tp, _Allocator>::__split_buffer()
+    _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+    : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
+{
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
+    : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
+{
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
+    : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
+{
+}
+
+template <class _Tp, class _Allocator>
+__split_buffer<_Tp, _Allocator>::~__split_buffer()
+{
+    clear();
+    if (__first_)
+        __alloc_traits::deallocate(__alloc(), __first_, capacity());
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
+    _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+    : __first_(_VSTD::move(__c.__first_)),
+      __begin_(_VSTD::move(__c.__begin_)),
+      __end_(_VSTD::move(__c.__end_)),
+      __end_cap_(_VSTD::move(__c.__end_cap_))
+{
+    __c.__first_ = nullptr;
+    __c.__begin_ = nullptr;
+    __c.__end_ = nullptr;
+    __c.__end_cap() = nullptr;
+}
+
+template <class _Tp, class _Allocator>
+__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
+    : __end_cap_(__a)
+{
+    if (__a == __c.__alloc())
+    {
+        __first_ = __c.__first_;
+        __begin_ = __c.__begin_;
+        __end_ = __c.__end_;
+        __end_cap() = __c.__end_cap();
+        __c.__first_ = nullptr;
+        __c.__begin_ = nullptr;
+        __c.__end_ = nullptr;
+        __c.__end_cap() = nullptr;
+    }
+    else
+    {
+        size_type __cap = __c.size();
+        __first_ = __alloc_traits::allocate(__alloc(), __cap);
+        __begin_ = __end_ = __first_;
+        __end_cap() = __first_ + __cap;
+        typedef move_iterator<iterator> _Ip;
+        __construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
+    }
+}
+
+template <class _Tp, class _Allocator>
+__split_buffer<_Tp, _Allocator>&
+__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
+    _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
+                is_nothrow_move_assignable<allocator_type>::value) ||
+               !__alloc_traits::propagate_on_container_move_assignment::value)
+{
+    clear();
+    shrink_to_fit();
+    __first_ = __c.__first_;
+    __begin_ = __c.__begin_;
+    __end_ = __c.__end_;
+    __end_cap() = __c.__end_cap();
+    __move_assign_alloc(__c,
+        integral_constant<bool,
+                          __alloc_traits::propagate_on_container_move_assignment::value>());
+    __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+void
+__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
+                   __is_nothrow_swappable<__alloc_rr>::value)
+{
+    _VSTD::swap(__first_, __x.__first_);
+    _VSTD::swap(__begin_, __x.__begin_);
+    _VSTD::swap(__end_, __x.__end_);
+    _VSTD::swap(__end_cap(), __x.__end_cap());
+    __swap_allocator(__alloc(), __x.__alloc());
+}
+
+template <class _Tp, class _Allocator>
+void
+__split_buffer<_Tp, _Allocator>::reserve(size_type __n)
+{
+    if (__n < capacity())
+    {
+        __split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
+        __t.__construct_at_end(move_iterator<pointer>(__begin_),
+                               move_iterator<pointer>(__end_));
+        _VSTD::swap(__first_, __t.__first_);
+        _VSTD::swap(__begin_, __t.__begin_);
+        _VSTD::swap(__end_, __t.__end_);
+        _VSTD::swap(__end_cap(), __t.__end_cap());
+    }
+}
+
+template <class _Tp, class _Allocator>
+void
+__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
+{
+    if (capacity() > size())
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            __split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
+            __t.__construct_at_end(move_iterator<pointer>(__begin_),
+                                   move_iterator<pointer>(__end_));
+            __t.__end_ = __t.__begin_ + (__end_ - __begin_);
+            _VSTD::swap(__first_, __t.__first_);
+            _VSTD::swap(__begin_, __t.__begin_);
+            _VSTD::swap(__end_, __t.__end_);
+            _VSTD::swap(__end_cap(), __t.__end_cap());
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+template <class _Tp, class _Allocator>
+void
+__split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
+{
+    if (__begin_ == __first_)
+    {
+        if (__end_ < __end_cap())
+        {
+            difference_type __d = __end_cap() - __end_;
+            __d = (__d + 1) / 2;
+            __begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
+            __end_ += __d;
+        }
+        else
+        {
+            size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+            __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
+            __t.__construct_at_end(move_iterator<pointer>(__begin_),
+                                   move_iterator<pointer>(__end_));
+            _VSTD::swap(__first_, __t.__first_);
+            _VSTD::swap(__begin_, __t.__begin_);
+            _VSTD::swap(__end_, __t.__end_);
+            _VSTD::swap(__end_cap(), __t.__end_cap());
+        }
+    }
+    __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);
+    --__begin_;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+void
+__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
+{
+    if (__begin_ == __first_)
+    {
+        if (__end_ < __end_cap())
+        {
+            difference_type __d = __end_cap() - __end_;
+            __d = (__d + 1) / 2;
+            __begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
+            __end_ += __d;
+        }
+        else
+        {
+            size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+            __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
+            __t.__construct_at_end(move_iterator<pointer>(__begin_),
+                                   move_iterator<pointer>(__end_));
+            _VSTD::swap(__first_, __t.__first_);
+            _VSTD::swap(__begin_, __t.__begin_);
+            _VSTD::swap(__end_, __t.__end_);
+            _VSTD::swap(__end_cap(), __t.__end_cap());
+        }
+    }
+    __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),
+            _VSTD::move(__x));
+    --__begin_;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
+{
+    if (__end_ == __end_cap())
+    {
+        if (__begin_ > __first_)
+        {
+            difference_type __d = __begin_ - __first_;
+            __d = (__d + 1) / 2;
+            __end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
+            __begin_ -= __d;
+        }
+        else
+        {
+            size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+            __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
+            __t.__construct_at_end(move_iterator<pointer>(__begin_),
+                                   move_iterator<pointer>(__end_));
+            _VSTD::swap(__first_, __t.__first_);
+            _VSTD::swap(__begin_, __t.__begin_);
+            _VSTD::swap(__end_, __t.__end_);
+            _VSTD::swap(__end_cap(), __t.__end_cap());
+        }
+    }
+    __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);
+    ++__end_;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+void
+__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
+{
+    if (__end_ == __end_cap())
+    {
+        if (__begin_ > __first_)
+        {
+            difference_type __d = __begin_ - __first_;
+            __d = (__d + 1) / 2;
+            __end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
+            __begin_ -= __d;
+        }
+        else
+        {
+            size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+            __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
+            __t.__construct_at_end(move_iterator<pointer>(__begin_),
+                                   move_iterator<pointer>(__end_));
+            _VSTD::swap(__first_, __t.__first_);
+            _VSTD::swap(__begin_, __t.__begin_);
+            _VSTD::swap(__end_, __t.__end_);
+            _VSTD::swap(__end_cap(), __t.__end_cap());
+        }
+    }
+    __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
+            _VSTD::move(__x));
+    ++__end_;
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Allocator>
+template <class... _Args>
+void
+__split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
+{
+    if (__end_ == __end_cap())
+    {
+        if (__begin_ > __first_)
+        {
+            difference_type __d = __begin_ - __first_;
+            __d = (__d + 1) / 2;
+            __end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
+            __begin_ -= __d;
+        }
+        else
+        {
+            size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+            __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
+            __t.__construct_at_end(move_iterator<pointer>(__begin_),
+                                   move_iterator<pointer>(__end_));
+            _VSTD::swap(__first_, __t.__first_);
+            _VSTD::swap(__begin_, __t.__begin_);
+            _VSTD::swap(__end_, __t.__end_);
+            _VSTD::swap(__end_cap(), __t.__end_cap());
+        }
+    }
+    __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
+                              _VSTD::forward<_Args>(__args)...);
+    ++__end_;
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
+        _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_SPLIT_BUFFER

Property changes on: lab4/.minix-src/include/c++/__split_buffer
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c/check.h
===================================================================
--- lab4/.minix-src/include/atf-c/check.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c/check.h	(revision 13)
@@ -0,0 +1,73 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_CHECK_H)
+#define ATF_C_CHECK_H
+
+#include <stdbool.h>
+
+#include <atf-c/error_fwd.h>
+
+/* ---------------------------------------------------------------------
+ * The "atf_check_result" type.
+ * --------------------------------------------------------------------- */
+
+struct atf_check_result_impl;
+struct atf_check_result {
+    struct atf_check_result_impl *pimpl;
+};
+typedef struct atf_check_result atf_check_result_t;
+
+/* Construtors and destructors */
+void atf_check_result_fini(atf_check_result_t *);
+
+/* Getters */
+const char *atf_check_result_stdout(const atf_check_result_t *);
+const char *atf_check_result_stderr(const atf_check_result_t *);
+bool atf_check_result_exited(const atf_check_result_t *);
+int atf_check_result_exitcode(const atf_check_result_t *);
+bool atf_check_result_signaled(const atf_check_result_t *);
+int atf_check_result_termsig(const atf_check_result_t *);
+
+/* ---------------------------------------------------------------------
+ * Free functions.
+ * --------------------------------------------------------------------- */
+
+atf_error_t atf_check_build_c_o(const char *, const char *,
+                                const char *const [],
+                                bool *);
+atf_error_t atf_check_build_cpp(const char *, const char *,
+                                const char *const [],
+                                bool *);
+atf_error_t atf_check_build_cxx_o(const char *, const char *,
+                                  const char *const [],
+                                  bool *);
+atf_error_t atf_check_exec_array(const char *const *, atf_check_result_t *);
+
+#endif /* ATF_C_CHECK_H */

Property changes on: lab4/.minix-src/include/atf-c/check.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c/config.h
===================================================================
--- lab4/.minix-src/include/atf-c/config.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c/config.h	(revision 13)
@@ -0,0 +1,37 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_CONFIG_H)
+#define ATF_C_CONFIG_H
+
+#include <stdbool.h>
+
+const char *atf_config_get(const char *);
+
+#endif /* !defined(ATF_C_CONFIG_H) */

Property changes on: lab4/.minix-src/include/atf-c/config.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__mutex_base
===================================================================
--- lab4/.minix-src/include/c++/__mutex_base	(nonexistent)
+++ lab4/.minix-src/include/c++/__mutex_base	(revision 13)
@@ -0,0 +1,407 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___MUTEX_BASE
+#define _LIBCPP___MUTEX_BASE
+
+#include <__config>
+#include <chrono>
+#include <system_error>
+#include <pthread.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifndef _LIBCPP_HAS_NO_THREADS
+
+class _LIBCPP_TYPE_VIS mutex
+{
+    pthread_mutex_t __m_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+     constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
+#else
+     mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
+#endif
+     ~mutex();
+
+private:
+    mutex(const mutex&);// = delete;
+    mutex& operator=(const mutex&);// = delete;
+
+public:
+    void lock();
+    bool try_lock() _NOEXCEPT;
+    void unlock() _NOEXCEPT;
+
+    typedef pthread_mutex_t* native_handle_type;
+    _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
+};
+
+struct _LIBCPP_TYPE_VIS defer_lock_t {};
+struct _LIBCPP_TYPE_VIS try_to_lock_t {};
+struct _LIBCPP_TYPE_VIS adopt_lock_t {};
+
+#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
+
+extern const defer_lock_t  defer_lock;
+extern const try_to_lock_t try_to_lock;
+extern const adopt_lock_t  adopt_lock;
+
+#else
+
+constexpr defer_lock_t  defer_lock  = defer_lock_t();
+constexpr try_to_lock_t try_to_lock = try_to_lock_t();
+constexpr adopt_lock_t  adopt_lock  = adopt_lock_t();
+
+#endif
+
+template <class _Mutex>
+class _LIBCPP_TYPE_VIS_ONLY lock_guard
+{
+public:
+    typedef _Mutex mutex_type;
+
+private:
+    mutex_type& __m_;
+public:
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit lock_guard(mutex_type& __m)
+        : __m_(__m) {__m_.lock();}
+    _LIBCPP_INLINE_VISIBILITY
+    lock_guard(mutex_type& __m, adopt_lock_t)
+        : __m_(__m) {}
+    _LIBCPP_INLINE_VISIBILITY
+    ~lock_guard() {__m_.unlock();}
+
+private:
+    lock_guard(lock_guard const&);// = delete;
+    lock_guard& operator=(lock_guard const&);// = delete;
+};
+
+template <class _Mutex>
+class _LIBCPP_TYPE_VIS_ONLY unique_lock
+{
+public:
+    typedef _Mutex mutex_type;
+
+private:
+    mutex_type* __m_;
+    bool __owns_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit unique_lock(mutex_type& __m)
+        : __m_(&__m), __owns_(true) {__m_->lock();}
+    _LIBCPP_INLINE_VISIBILITY
+    unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
+        : __m_(&__m), __owns_(false) {}
+    _LIBCPP_INLINE_VISIBILITY
+    unique_lock(mutex_type& __m, try_to_lock_t)
+        : __m_(&__m), __owns_(__m.try_lock()) {}
+    _LIBCPP_INLINE_VISIBILITY
+    unique_lock(mutex_type& __m, adopt_lock_t)
+        : __m_(&__m), __owns_(true) {}
+    template <class _Clock, class _Duration>
+    _LIBCPP_INLINE_VISIBILITY
+        unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
+            : __m_(&__m), __owns_(__m.try_lock_until(__t)) {}
+    template <class _Rep, class _Period>
+    _LIBCPP_INLINE_VISIBILITY
+        unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
+            : __m_(&__m), __owns_(__m.try_lock_for(__d)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    ~unique_lock()
+    {
+        if (__owns_)
+            __m_->unlock();
+    }
+
+private:
+    unique_lock(unique_lock const&); // = delete;
+    unique_lock& operator=(unique_lock const&); // = delete;
+
+public:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    unique_lock(unique_lock&& __u) _NOEXCEPT
+        : __m_(__u.__m_), __owns_(__u.__owns_)
+        {__u.__m_ = nullptr; __u.__owns_ = false;}
+    _LIBCPP_INLINE_VISIBILITY
+    unique_lock& operator=(unique_lock&& __u) _NOEXCEPT
+        {
+            if (__owns_)
+                __m_->unlock();
+            __m_ = __u.__m_;
+            __owns_ = __u.__owns_;
+            __u.__m_ = nullptr;
+            __u.__owns_ = false;
+            return *this;
+        }
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    void lock();
+    bool try_lock();
+
+    template <class _Rep, class _Period>
+        bool try_lock_for(const chrono::duration<_Rep, _Period>& __d);
+    template <class _Clock, class _Duration>
+        bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
+
+    void unlock();
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(unique_lock& __u) _NOEXCEPT
+    {
+        _VSTD::swap(__m_, __u.__m_);
+        _VSTD::swap(__owns_, __u.__owns_);
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    mutex_type* release() _NOEXCEPT
+    {
+        mutex_type* __m = __m_;
+        __m_ = nullptr;
+        __owns_ = false;
+        return __m;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool owns_lock() const _NOEXCEPT {return __owns_;}
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_EXPLICIT
+        operator bool () const _NOEXCEPT {return __owns_;}
+    _LIBCPP_INLINE_VISIBILITY
+    mutex_type* mutex() const _NOEXCEPT {return __m_;}
+};
+
+template <class _Mutex>
+void
+unique_lock<_Mutex>::lock()
+{
+    if (__m_ == nullptr)
+        __throw_system_error(EPERM, "unique_lock::lock: references null mutex");
+    if (__owns_)
+        __throw_system_error(EDEADLK, "unique_lock::lock: already locked");
+    __m_->lock();
+    __owns_ = true;
+}
+
+template <class _Mutex>
+bool
+unique_lock<_Mutex>::try_lock()
+{
+    if (__m_ == nullptr)
+        __throw_system_error(EPERM, "unique_lock::try_lock: references null mutex");
+    if (__owns_)
+        __throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
+    __owns_ = __m_->try_lock();
+    return __owns_;
+}
+
+template <class _Mutex>
+template <class _Rep, class _Period>
+bool
+unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d)
+{
+    if (__m_ == nullptr)
+        __throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex");
+    if (__owns_)
+        __throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked");
+    __owns_ = __m_->try_lock_for(__d);
+    return __owns_;
+}
+
+template <class _Mutex>
+template <class _Clock, class _Duration>
+bool
+unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
+{
+    if (__m_ == nullptr)
+        __throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex");
+    if (__owns_)
+        __throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked");
+    __owns_ = __m_->try_lock_until(__t);
+    return __owns_;
+}
+
+template <class _Mutex>
+void
+unique_lock<_Mutex>::unlock()
+{
+    if (!__owns_)
+        __throw_system_error(EPERM, "unique_lock::unlock: not locked");
+    __m_->unlock();
+    __owns_ = false;
+}
+
+template <class _Mutex>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT
+    {__x.swap(__y);}
+
+//enum class cv_status
+_LIBCPP_DECLARE_STRONG_ENUM(cv_status)
+{
+    no_timeout,
+    timeout
+};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)
+
+class _LIBCPP_TYPE_VIS condition_variable
+{
+    pthread_cond_t __cv_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
+#else
+    condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
+#endif
+    ~condition_variable();
+
+private:
+    condition_variable(const condition_variable&); // = delete;
+    condition_variable& operator=(const condition_variable&); // = delete;
+
+public:
+    void notify_one() _NOEXCEPT;
+    void notify_all() _NOEXCEPT;
+
+    void wait(unique_lock<mutex>& __lk) _NOEXCEPT;
+    template <class _Predicate>
+        void wait(unique_lock<mutex>& __lk, _Predicate __pred);
+
+    template <class _Clock, class _Duration>
+        cv_status
+        wait_until(unique_lock<mutex>& __lk,
+                   const chrono::time_point<_Clock, _Duration>& __t);
+
+    template <class _Clock, class _Duration, class _Predicate>
+        bool
+        wait_until(unique_lock<mutex>& __lk,
+                   const chrono::time_point<_Clock, _Duration>& __t,
+                   _Predicate __pred);
+
+    template <class _Rep, class _Period>
+        cv_status
+        wait_for(unique_lock<mutex>& __lk,
+                 const chrono::duration<_Rep, _Period>& __d);
+
+    template <class _Rep, class _Period, class _Predicate>
+        bool
+        wait_for(unique_lock<mutex>& __lk,
+                 const chrono::duration<_Rep, _Period>& __d,
+                 _Predicate __pred);
+
+    typedef pthread_cond_t* native_handle_type;
+    _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
+
+private:
+    void __do_timed_wait(unique_lock<mutex>& __lk,
+       chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
+};
+#endif // !_LIBCPP_HAS_NO_THREADS
+
+template <class _To, class _Rep, class _Period>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    chrono::__is_duration<_To>::value,
+    _To
+>::type
+__ceil(chrono::duration<_Rep, _Period> __d)
+{
+    using namespace chrono;
+    _To __r = duration_cast<_To>(__d);
+    if (__r < __d)
+        ++__r;
+    return __r;
+}
+
+#ifndef _LIBCPP_HAS_NO_THREADS
+template <class _Predicate>
+void
+condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
+{
+    while (!__pred())
+        wait(__lk);
+}
+
+template <class _Clock, class _Duration>
+cv_status
+condition_variable::wait_until(unique_lock<mutex>& __lk,
+                               const chrono::time_point<_Clock, _Duration>& __t)
+{
+    using namespace chrono;
+    wait_for(__lk, __t - _Clock::now());
+    return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
+}
+
+template <class _Clock, class _Duration, class _Predicate>
+bool
+condition_variable::wait_until(unique_lock<mutex>& __lk,
+                   const chrono::time_point<_Clock, _Duration>& __t,
+                   _Predicate __pred)
+{
+    while (!__pred())
+    {
+        if (wait_until(__lk, __t) == cv_status::timeout)
+            return __pred();
+    }
+    return true;
+}
+
+template <class _Rep, class _Period>
+cv_status
+condition_variable::wait_for(unique_lock<mutex>& __lk,
+                             const chrono::duration<_Rep, _Period>& __d)
+{
+    using namespace chrono;
+    if (__d <= __d.zero())
+        return cv_status::timeout;
+    typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;
+    typedef time_point<system_clock, nanoseconds> __sys_tpi;
+    __sys_tpf _Max = __sys_tpi::max();
+    system_clock::time_point __s_now = system_clock::now();
+    steady_clock::time_point __c_now = steady_clock::now();
+    if (_Max - __d > __s_now)
+        __do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
+    else
+        __do_timed_wait(__lk, __sys_tpi::max());
+    return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
+                                                 cv_status::timeout;
+}
+
+template <class _Rep, class _Period, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+condition_variable::wait_for(unique_lock<mutex>& __lk,
+                             const chrono::duration<_Rep, _Period>& __d,
+                             _Predicate __pred)
+{
+    return wait_until(__lk, chrono::steady_clock::now() + __d,
+                      _VSTD::move(__pred));
+}
+
+#endif // !_LIBCPP_HAS_NO_THREADS
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP___MUTEX_BASE

Property changes on: lab4/.minix-src/include/c++/__mutex_base
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c/defs.h
===================================================================
--- lab4/.minix-src/include/atf-c/defs.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c/defs.h	(revision 13)
@@ -0,0 +1,37 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_DEFS_H)
+#define ATF_C_DEFS_H
+
+#define ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(a, b) __attribute__((__format__(__printf__, a, b)))
+#define ATF_DEFS_ATTRIBUTE_NORETURN __attribute__((__noreturn__))
+#define ATF_DEFS_ATTRIBUTE_UNUSED __attribute__((__unused__))
+
+#endif /* !defined(ATF_C_DEFS_H) */

Property changes on: lab4/.minix-src/include/atf-c/defs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c/error.h
===================================================================
--- lab4/.minix-src/include/atf-c/error.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c/error.h	(revision 13)
@@ -0,0 +1,73 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_ERROR_H)
+#define ATF_C_ERROR_H
+
+#include <stdbool.h>
+#include <stddef.h>
+
+#include <atf-c/defs.h>
+#include <atf-c/error_fwd.h>
+
+/* ---------------------------------------------------------------------
+ * The "atf_error" type.
+ * --------------------------------------------------------------------- */
+
+struct atf_error {
+    bool m_free;
+    const char *m_type;
+    void *m_data;
+
+    void (*m_format)(struct atf_error *, char *, size_t);
+};
+
+atf_error_t atf_error_new(const char *, void *, size_t,
+                          void (*)(const atf_error_t, char *, size_t));
+void atf_error_free(atf_error_t);
+
+atf_error_t atf_no_error(void);
+bool atf_is_error(const atf_error_t);
+
+bool atf_error_is(const atf_error_t, const char *);
+const void *atf_error_data(const atf_error_t);
+void atf_error_format(const atf_error_t, char *, size_t);
+
+/* ---------------------------------------------------------------------
+ * Common error types.
+ * --------------------------------------------------------------------- */
+
+atf_error_t atf_libc_error(int, const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(2, 3);
+int atf_libc_error_code(const atf_error_t);
+const char *atf_libc_error_msg(const atf_error_t);
+
+atf_error_t atf_no_memory_error(void);
+
+#endif /* ATF_C_ERROR_H */

Property changes on: lab4/.minix-src/include/atf-c/error.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c/error_fwd.h
===================================================================
--- lab4/.minix-src/include/atf-c/error_fwd.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c/error_fwd.h	(revision 13)
@@ -0,0 +1,40 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_ERROR_FWD_H)
+#define ATF_C_ERROR_FWD_H
+
+/* ---------------------------------------------------------------------
+ * The "atf_error" type.
+ * --------------------------------------------------------------------- */
+
+struct atf_error;
+typedef struct atf_error *atf_error_t;
+
+#endif /* ATF_C_ERROR_FWD_H */

Property changes on: lab4/.minix-src/include/atf-c/error_fwd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__std_stream
===================================================================
--- lab4/.minix-src/include/c++/__std_stream	(nonexistent)
+++ lab4/.minix-src/include/c++/__std_stream	(revision 13)
@@ -0,0 +1,358 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___STD_STREAM
+#define _LIBCPP___STD_STREAM
+
+#include <__config>
+#include <ostream>
+#include <istream>
+#include <__locale>
+#include <cstdio>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+static const int __limit = 8;
+
+// __stdinbuf
+
+template <class _CharT>
+class _LIBCPP_HIDDEN __stdinbuf
+    : public basic_streambuf<_CharT, char_traits<_CharT> >
+{
+public:
+    typedef _CharT                           char_type;
+    typedef char_traits<char_type>           traits_type;
+    typedef typename traits_type::int_type   int_type;
+    typedef typename traits_type::pos_type   pos_type;
+    typedef typename traits_type::off_type   off_type;
+    typedef typename traits_type::state_type state_type;
+
+    __stdinbuf(FILE* __fp, state_type* __st);
+
+protected:
+    virtual int_type underflow();
+    virtual int_type uflow();
+    virtual int_type pbackfail(int_type __c = traits_type::eof());
+    virtual void imbue(const locale& __loc);
+
+private:
+
+    FILE* __file_;
+    const codecvt<char_type, char, state_type>* __cv_;
+    state_type* __st_;
+    int __encoding_;
+    int_type __last_consumed_;
+    bool __last_consumed_is_next_;
+    bool __always_noconv_;
+
+    __stdinbuf(const __stdinbuf&);
+    __stdinbuf& operator=(const __stdinbuf&);
+
+    int_type __getchar(bool __consume);
+};
+
+template <class _CharT>
+__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st)
+    : __file_(__fp),
+      __st_(__st),
+      __last_consumed_(traits_type::eof()),
+      __last_consumed_is_next_(false)
+{
+    imbue(this->getloc());
+}
+
+template <class _CharT>
+void
+__stdinbuf<_CharT>::imbue(const locale& __loc)
+{
+    __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
+    __encoding_ = __cv_->encoding();
+    __always_noconv_ = __cv_->always_noconv();
+    if (__encoding_ > __limit)
+        __throw_runtime_error("unsupported locale for standard input");
+}
+
+template <class _CharT>
+typename __stdinbuf<_CharT>::int_type
+__stdinbuf<_CharT>::underflow()
+{
+    return __getchar(false);
+}
+
+template <class _CharT>
+typename __stdinbuf<_CharT>::int_type
+__stdinbuf<_CharT>::uflow()
+{
+    return __getchar(true);
+}
+
+template <class _CharT>
+typename __stdinbuf<_CharT>::int_type
+__stdinbuf<_CharT>::__getchar(bool __consume)
+{
+    if (__last_consumed_is_next_)
+    {
+        int_type __result = __last_consumed_;
+        if (__consume)
+        {
+            __last_consumed_ = traits_type::eof();
+            __last_consumed_is_next_ = false;
+        }
+        return __result;
+    }
+    char __extbuf[__limit];
+    int __nread = _VSTD::max(1, __encoding_);
+    for (int __i = 0; __i < __nread; ++__i)
+    {
+        int __c = getc(__file_);
+        if (__c == EOF)
+            return traits_type::eof();
+        __extbuf[__i] = static_cast<char>(__c);
+    }
+    char_type __1buf;
+    if (__always_noconv_)
+        __1buf = static_cast<char_type>(__extbuf[0]);
+    else
+    {
+        const char* __enxt;
+        char_type* __inxt;
+        codecvt_base::result __r;
+        do
+        {
+            state_type __sv_st = *__st_;
+            __r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt,
+                                   &__1buf, &__1buf + 1, __inxt);
+            switch (__r)
+            {
+            case _VSTD::codecvt_base::ok:
+                break;
+            case codecvt_base::partial:
+                *__st_ = __sv_st;
+                if (__nread == sizeof(__extbuf))
+                    return traits_type::eof();
+                {
+                    int __c = getc(__file_);
+                    if (__c == EOF)
+                        return traits_type::eof();
+                    __extbuf[__nread] = static_cast<char>(__c);
+                }
+                ++__nread;
+                break;
+            case codecvt_base::error:
+                return traits_type::eof();
+            case _VSTD::codecvt_base::noconv:
+                __1buf = static_cast<char_type>(__extbuf[0]);
+                break;
+            }
+        } while (__r == _VSTD::codecvt_base::partial);
+    }
+    if (!__consume)
+    {
+        for (int __i = __nread; __i > 0;)
+        {
+            if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF)
+                return traits_type::eof();
+        }
+    }
+    else
+        __last_consumed_ = traits_type::to_int_type(__1buf);
+    return traits_type::to_int_type(__1buf);
+}
+
+template <class _CharT>
+typename __stdinbuf<_CharT>::int_type
+__stdinbuf<_CharT>::pbackfail(int_type __c)
+{
+    if (traits_type::eq_int_type(__c, traits_type::eof()))
+    {
+        if (!__last_consumed_is_next_)
+        {
+            __c = __last_consumed_;
+            __last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_,
+                                                                 traits_type::eof());
+        }
+        return __c;
+    }
+    if (__last_consumed_is_next_)
+    {
+        char __extbuf[__limit];
+        char* __enxt;
+        const char_type __ci = traits_type::to_char_type(__last_consumed_);
+        const char_type* __inxt;
+        switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
+                                  __extbuf, __extbuf + sizeof(__extbuf), __enxt))
+        {
+        case _VSTD::codecvt_base::ok:
+            break;
+        case _VSTD::codecvt_base::noconv:
+            __extbuf[0] = static_cast<char>(__last_consumed_);
+            __enxt = __extbuf + 1;
+            break;
+        case codecvt_base::partial:
+        case codecvt_base::error:
+            return traits_type::eof();
+        }
+        while (__enxt > __extbuf)
+            if (ungetc(*--__enxt, __file_) == EOF)
+                return traits_type::eof();
+    }
+    __last_consumed_ = __c;
+    __last_consumed_is_next_ = true;
+    return __c;
+}
+
+// __stdoutbuf
+
+template <class _CharT>
+class _LIBCPP_HIDDEN __stdoutbuf
+    : public basic_streambuf<_CharT, char_traits<_CharT> >
+{
+public:
+    typedef _CharT                           char_type;
+    typedef char_traits<char_type>           traits_type;
+    typedef typename traits_type::int_type   int_type;
+    typedef typename traits_type::pos_type   pos_type;
+    typedef typename traits_type::off_type   off_type;
+    typedef typename traits_type::state_type state_type;
+
+    __stdoutbuf(FILE* __fp, state_type* __st);
+
+protected:
+    virtual int_type overflow (int_type __c = traits_type::eof());
+    virtual streamsize xsputn(const char_type* __s, streamsize __n);
+    virtual int sync();
+    virtual void imbue(const locale& __loc);
+
+private:
+    FILE* __file_;
+    const codecvt<char_type, char, state_type>* __cv_;
+    state_type* __st_;
+    bool __always_noconv_;
+
+    __stdoutbuf(const __stdoutbuf&);
+    __stdoutbuf& operator=(const __stdoutbuf&);
+};
+
+template <class _CharT>
+__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st)
+    : __file_(__fp),
+      __cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
+      __st_(__st),
+      __always_noconv_(__cv_->always_noconv())
+{
+}
+
+template <class _CharT>
+typename __stdoutbuf<_CharT>::int_type
+__stdoutbuf<_CharT>::overflow(int_type __c)
+{
+    char __extbuf[__limit];
+    char_type __1buf;
+    if (!traits_type::eq_int_type(__c, traits_type::eof()))
+    {
+        __1buf = traits_type::to_char_type(__c);
+        if (__always_noconv_)
+        {
+            if (fwrite(&__1buf, sizeof(char_type), 1, __file_) != 1)
+                return traits_type::eof();
+        }
+        else
+        {
+            char* __extbe = __extbuf;
+            codecvt_base::result __r;
+            char_type* pbase = &__1buf;
+            char_type* pptr = pbase + 1;
+            do
+            {
+                const char_type* __e;
+                __r = __cv_->out(*__st_, pbase, pptr, __e,
+                                        __extbuf,
+                                        __extbuf + sizeof(__extbuf),
+                                        __extbe);
+                if (__e == pbase)
+                    return traits_type::eof();
+                if (__r == codecvt_base::noconv)
+                {
+                    if (fwrite(pbase, 1, 1, __file_) != 1)
+                        return traits_type::eof();
+                }
+                else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
+                {
+                    size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
+                    if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
+                        return traits_type::eof();
+                    if (__r == codecvt_base::partial)
+                    {
+                        pbase = (char_type*)__e;
+                    }
+                }
+                else
+                    return traits_type::eof();
+            } while (__r == codecvt_base::partial);
+        }
+    }
+    return traits_type::not_eof(__c);
+}
+
+template <class _CharT>
+streamsize
+__stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n)
+{
+    if (__always_noconv_)
+        return fwrite(__s, sizeof(char_type), __n, __file_);
+    streamsize __i = 0;
+    for (; __i < __n; ++__i, ++__s)
+        if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof())
+            break;
+    return __i;
+}
+
+template <class _CharT>
+int
+__stdoutbuf<_CharT>::sync()
+{
+    char __extbuf[__limit];
+    codecvt_base::result __r;
+    do
+    {
+        char* __extbe;
+        __r = __cv_->unshift(*__st_, __extbuf,
+                                    __extbuf + sizeof(__extbuf),
+                                    __extbe);
+        size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
+        if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
+            return -1;
+    } while (__r == codecvt_base::partial);
+    if (__r == codecvt_base::error)
+        return -1;
+    if (fflush(__file_))
+        return -1;
+    return 0;
+}
+
+template <class _CharT>
+void
+__stdoutbuf<_CharT>::imbue(const locale& __loc)
+{
+    sync();
+    __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
+    __always_noconv_ = __cv_->always_noconv();
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP___STD_STREAM

Property changes on: lab4/.minix-src/include/c++/__std_stream
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__tree
===================================================================
--- lab4/.minix-src/include/c++/__tree	(nonexistent)
+++ lab4/.minix-src/include/c++/__tree	(revision 13)
@@ -0,0 +1,2297 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___TREE
+#define _LIBCPP___TREE
+
+#include <__config>
+#include <iterator>
+#include <memory>
+#include <stdexcept>
+#include <algorithm>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, class _Compare, class _Allocator> class __tree;
+template <class _Tp, class _NodePtr, class _DiffType>
+    class _LIBCPP_TYPE_VIS_ONLY __tree_iterator;
+template <class _Tp, class _ConstNodePtr, class _DiffType>
+    class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
+
+/*
+
+_NodePtr algorithms
+
+The algorithms taking _NodePtr are red black tree algorithms.  Those
+algorithms taking a parameter named __root should assume that __root
+points to a proper red black tree (unless otherwise specified).
+
+Each algorithm herein assumes that __root->__parent_ points to a non-null
+structure which has a member __left_ which points back to __root.  No other
+member is read or written to at __root->__parent_.
+
+__root->__parent_ will be referred to below (in comments only) as end_node.
+end_node->__left_ is an externably accessible lvalue for __root, and can be
+changed by node insertion and removal (without explicit reference to end_node).
+
+All nodes (with the exception of end_node), even the node referred to as
+__root, have a non-null __parent_ field.
+
+*/
+
+// Returns:  true if __x is a left child of its parent, else false
+// Precondition:  __x != nullptr.
+template <class _NodePtr>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+__tree_is_left_child(_NodePtr __x) _NOEXCEPT
+{
+    return __x == __x->__parent_->__left_;
+}
+
+// Determintes if the subtree rooted at __x is a proper red black subtree.  If
+//    __x is a proper subtree, returns the black height (null counts as 1).  If
+//    __x is an improper subtree, returns 0.
+template <class _NodePtr>
+unsigned
+__tree_sub_invariant(_NodePtr __x)
+{
+    if (__x == nullptr)
+        return 1;
+    // parent consistency checked by caller
+    // check __x->__left_ consistency
+    if (__x->__left_ != nullptr && __x->__left_->__parent_ != __x)
+        return 0;
+    // check __x->__right_ consistency
+    if (__x->__right_ != nullptr && __x->__right_->__parent_ != __x)
+        return 0;
+    // check __x->__left_ != __x->__right_ unless both are nullptr
+    if (__x->__left_ == __x->__right_ && __x->__left_ != nullptr)
+        return 0;
+    // If this is red, neither child can be red
+    if (!__x->__is_black_)
+    {
+        if (__x->__left_ && !__x->__left_->__is_black_)
+            return 0;
+        if (__x->__right_ && !__x->__right_->__is_black_)
+            return 0;
+    }
+    unsigned __h = __tree_sub_invariant(__x->__left_);
+    if (__h == 0)
+        return 0;  // invalid left subtree
+    if (__h != __tree_sub_invariant(__x->__right_))
+        return 0;  // invalid or different height right subtree
+    return __h + __x->__is_black_;  // return black height of this node
+}
+
+// Determintes if the red black tree rooted at __root is a proper red black tree.
+//    __root == nullptr is a proper tree.  Returns true is __root is a proper
+//    red black tree, else returns false.
+template <class _NodePtr>
+bool
+__tree_invariant(_NodePtr __root)
+{
+    if (__root == nullptr)
+        return true;
+    // check __x->__parent_ consistency
+    if (__root->__parent_ == nullptr)
+        return false;
+    if (!__tree_is_left_child(__root))
+        return false;
+    // root must be black
+    if (!__root->__is_black_)
+        return false;
+    // do normal node checks
+    return __tree_sub_invariant(__root) != 0;
+}
+
+// Returns:  pointer to the left-most node under __x.
+// Precondition:  __x != nullptr.
+template <class _NodePtr>
+inline _LIBCPP_INLINE_VISIBILITY
+_NodePtr
+__tree_min(_NodePtr __x) _NOEXCEPT
+{
+    while (__x->__left_ != nullptr)
+        __x = __x->__left_;
+    return __x;
+}
+
+// Returns:  pointer to the right-most node under __x.
+// Precondition:  __x != nullptr.
+template <class _NodePtr>
+inline _LIBCPP_INLINE_VISIBILITY
+_NodePtr
+__tree_max(_NodePtr __x) _NOEXCEPT
+{
+    while (__x->__right_ != nullptr)
+        __x = __x->__right_;
+    return __x;
+}
+
+// Returns:  pointer to the next in-order node after __x.
+// Precondition:  __x != nullptr.
+template <class _NodePtr>
+_NodePtr
+__tree_next(_NodePtr __x) _NOEXCEPT
+{
+    if (__x->__right_ != nullptr)
+        return __tree_min(__x->__right_);
+    while (!__tree_is_left_child(__x))
+        __x = __x->__parent_;
+    return __x->__parent_;
+}
+
+// Returns:  pointer to the previous in-order node before __x.
+// Precondition:  __x != nullptr.
+template <class _NodePtr>
+_NodePtr
+__tree_prev(_NodePtr __x) _NOEXCEPT
+{
+    if (__x->__left_ != nullptr)
+        return __tree_max(__x->__left_);
+    while (__tree_is_left_child(__x))
+        __x = __x->__parent_;
+    return __x->__parent_;
+}
+
+// Returns:  pointer to a node which has no children
+// Precondition:  __x != nullptr.
+template <class _NodePtr>
+_NodePtr
+__tree_leaf(_NodePtr __x) _NOEXCEPT
+{
+    while (true)
+    {
+        if (__x->__left_ != nullptr)
+        {
+            __x = __x->__left_;
+            continue;
+        }
+        if (__x->__right_ != nullptr)
+        {
+            __x = __x->__right_;
+            continue;
+        }
+        break;
+    }
+    return __x;
+}
+
+// Effects:  Makes __x->__right_ the subtree root with __x as its left child
+//           while preserving in-order order.
+// Precondition:  __x->__right_ != nullptr
+template <class _NodePtr>
+void
+__tree_left_rotate(_NodePtr __x) _NOEXCEPT
+{
+    _NodePtr __y = __x->__right_;
+    __x->__right_ = __y->__left_;
+    if (__x->__right_ != nullptr)
+        __x->__right_->__parent_ = __x;
+    __y->__parent_ = __x->__parent_;
+    if (__tree_is_left_child(__x))
+        __x->__parent_->__left_ = __y;
+    else
+        __x->__parent_->__right_ = __y;
+    __y->__left_ = __x;
+    __x->__parent_ = __y;
+}
+
+// Effects:  Makes __x->__left_ the subtree root with __x as its right child
+//           while preserving in-order order.
+// Precondition:  __x->__left_ != nullptr
+template <class _NodePtr>
+void
+__tree_right_rotate(_NodePtr __x) _NOEXCEPT
+{
+    _NodePtr __y = __x->__left_;
+    __x->__left_ = __y->__right_;
+    if (__x->__left_ != nullptr)
+        __x->__left_->__parent_ = __x;
+    __y->__parent_ = __x->__parent_;
+    if (__tree_is_left_child(__x))
+        __x->__parent_->__left_ = __y;
+    else
+        __x->__parent_->__right_ = __y;
+    __y->__right_ = __x;
+    __x->__parent_ = __y;
+}
+
+// Effects:  Rebalances __root after attaching __x to a leaf.
+// Precondition:  __root != nulptr && __x != nullptr.
+//                __x has no children.
+//                __x == __root or == a direct or indirect child of __root.
+//                If __x were to be unlinked from __root (setting __root to
+//                  nullptr if __root == __x), __tree_invariant(__root) == true.
+// Postcondition: __tree_invariant(end_node->__left_) == true.  end_node->__left_
+//                may be different than the value passed in as __root.
+template <class _NodePtr>
+void
+__tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
+{
+    __x->__is_black_ = __x == __root;
+    while (__x != __root && !__x->__parent_->__is_black_)
+    {
+        // __x->__parent_ != __root because __x->__parent_->__is_black == false
+        if (__tree_is_left_child(__x->__parent_))
+        {
+            _NodePtr __y = __x->__parent_->__parent_->__right_;
+            if (__y != nullptr && !__y->__is_black_)
+            {
+                __x = __x->__parent_;
+                __x->__is_black_ = true;
+                __x = __x->__parent_;
+                __x->__is_black_ = __x == __root;
+                __y->__is_black_ = true;
+            }
+            else
+            {
+                if (!__tree_is_left_child(__x))
+                {
+                    __x = __x->__parent_;
+                    __tree_left_rotate(__x);
+                }
+                __x = __x->__parent_;
+                __x->__is_black_ = true;
+                __x = __x->__parent_;
+                __x->__is_black_ = false;
+                __tree_right_rotate(__x);
+                break;
+            }
+        }
+        else
+        {
+            _NodePtr __y = __x->__parent_->__parent_->__left_;
+            if (__y != nullptr && !__y->__is_black_)
+            {
+                __x = __x->__parent_;
+                __x->__is_black_ = true;
+                __x = __x->__parent_;
+                __x->__is_black_ = __x == __root;
+                __y->__is_black_ = true;
+            }
+            else
+            {
+                if (__tree_is_left_child(__x))
+                {
+                    __x = __x->__parent_;
+                    __tree_right_rotate(__x);
+                }
+                __x = __x->__parent_;
+                __x->__is_black_ = true;
+                __x = __x->__parent_;
+                __x->__is_black_ = false;
+                __tree_left_rotate(__x);
+                break;
+            }
+        }
+    }
+}
+
+// Precondition:  __root != nullptr && __z != nullptr.
+//                __tree_invariant(__root) == true.
+//                __z == __root or == a direct or indirect child of __root.
+// Effects:  unlinks __z from the tree rooted at __root, rebalancing as needed.
+// Postcondition: __tree_invariant(end_node->__left_) == true && end_node->__left_
+//                nor any of its children refer to __z.  end_node->__left_
+//                may be different than the value passed in as __root.
+template <class _NodePtr>
+void
+__tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
+{
+    // __z will be removed from the tree.  Client still needs to destruct/deallocate it
+    // __y is either __z, or if __z has two children, __tree_next(__z).
+    // __y will have at most one child.
+    // __y will be the initial hole in the tree (make the hole at a leaf)
+    _NodePtr __y = (__z->__left_ == nullptr || __z->__right_ == nullptr) ?
+                    __z : __tree_next(__z);
+    // __x is __y's possibly null single child
+    _NodePtr __x = __y->__left_ != nullptr ? __y->__left_ : __y->__right_;
+    // __w is __x's possibly null uncle (will become __x's sibling)
+    _NodePtr __w = nullptr;
+    // link __x to __y's parent, and find __w
+    if (__x != nullptr)
+        __x->__parent_ = __y->__parent_;
+    if (__tree_is_left_child(__y))
+    {
+        __y->__parent_->__left_ = __x;
+        if (__y != __root)
+            __w = __y->__parent_->__right_;
+        else
+            __root = __x;  // __w == nullptr
+    }
+    else
+    {
+        __y->__parent_->__right_ = __x;
+        // __y can't be root if it is a right child
+        __w = __y->__parent_->__left_;
+    }
+    bool __removed_black = __y->__is_black_;
+    // If we didn't remove __z, do so now by splicing in __y for __z,
+    //    but copy __z's color.  This does not impact __x or __w.
+    if (__y != __z)
+    {
+        // __z->__left_ != nulptr but __z->__right_ might == __x == nullptr
+        __y->__parent_ = __z->__parent_;
+        if (__tree_is_left_child(__z))
+            __y->__parent_->__left_ = __y;
+        else
+            __y->__parent_->__right_ = __y;
+        __y->__left_ = __z->__left_;
+        __y->__left_->__parent_ = __y;
+        __y->__right_ = __z->__right_;
+        if (__y->__right_ != nullptr)
+            __y->__right_->__parent_ = __y;
+        __y->__is_black_ = __z->__is_black_;
+        if (__root == __z)
+            __root = __y;
+    }
+    // There is no need to rebalance if we removed a red, or if we removed
+    //     the last node.
+    if (__removed_black && __root != nullptr)
+    {
+        // Rebalance:
+        // __x has an implicit black color (transferred from the removed __y)
+        //    associated with it, no matter what its color is.
+        // If __x is __root (in which case it can't be null), it is supposed
+        //    to be black anyway, and if it is doubly black, then the double
+        //    can just be ignored.
+        // If __x is red (in which case it can't be null), then it can absorb
+        //    the implicit black just by setting its color to black.
+        // Since __y was black and only had one child (which __x points to), __x
+        //   is either red with no children, else null, otherwise __y would have
+        //   different black heights under left and right pointers.
+        // if (__x == __root || __x != nullptr && !__x->__is_black_)
+        if (__x != nullptr)
+            __x->__is_black_ = true;
+        else
+        {
+            //  Else __x isn't root, and is "doubly black", even though it may
+            //     be null.  __w can not be null here, else the parent would
+            //     see a black height >= 2 on the __x side and a black height
+            //     of 1 on the __w side (__w must be a non-null black or a red
+            //     with a non-null black child).
+            while (true)
+            {
+                if (!__tree_is_left_child(__w))  // if x is left child
+                {
+                    if (!__w->__is_black_)
+                    {
+                        __w->__is_black_ = true;
+                        __w->__parent_->__is_black_ = false;
+                        __tree_left_rotate(__w->__parent_);
+                        // __x is still valid
+                        // reset __root only if necessary
+                        if (__root == __w->__left_)
+                            __root = __w;
+                        // reset sibling, and it still can't be null
+                        __w = __w->__left_->__right_;
+                    }
+                    // __w->__is_black_ is now true, __w may have null children
+                    if ((__w->__left_  == nullptr || __w->__left_->__is_black_) &&
+                        (__w->__right_ == nullptr || __w->__right_->__is_black_))
+                    {
+                        __w->__is_black_ = false;
+                        __x = __w->__parent_;
+                        // __x can no longer be null
+                        if (__x == __root || !__x->__is_black_)
+                        {
+                            __x->__is_black_ = true;
+                            break;
+                        }
+                        // reset sibling, and it still can't be null
+                        __w = __tree_is_left_child(__x) ?
+                                    __x->__parent_->__right_ :
+                                    __x->__parent_->__left_;
+                        // continue;
+                    }
+                    else  // __w has a red child
+                    {
+                        if (__w->__right_ == nullptr || __w->__right_->__is_black_)
+                        {
+                            // __w left child is non-null and red
+                            __w->__left_->__is_black_ = true;
+                            __w->__is_black_ = false;
+                            __tree_right_rotate(__w);
+                            // __w is known not to be root, so root hasn't changed
+                            // reset sibling, and it still can't be null
+                            __w = __w->__parent_;
+                        }
+                        // __w has a right red child, left child may be null
+                        __w->__is_black_ = __w->__parent_->__is_black_;
+                        __w->__parent_->__is_black_ = true;
+                        __w->__right_->__is_black_ = true;
+                        __tree_left_rotate(__w->__parent_);
+                        break;
+                    }
+                }
+                else
+                {
+                    if (!__w->__is_black_)
+                    {
+                        __w->__is_black_ = true;
+                        __w->__parent_->__is_black_ = false;
+                        __tree_right_rotate(__w->__parent_);
+                        // __x is still valid
+                        // reset __root only if necessary
+                        if (__root == __w->__right_)
+                            __root = __w;
+                        // reset sibling, and it still can't be null
+                        __w = __w->__right_->__left_;
+                    }
+                    // __w->__is_black_ is now true, __w may have null children
+                    if ((__w->__left_  == nullptr || __w->__left_->__is_black_) &&
+                        (__w->__right_ == nullptr || __w->__right_->__is_black_))
+                    {
+                        __w->__is_black_ = false;
+                        __x = __w->__parent_;
+                        // __x can no longer be null
+                        if (!__x->__is_black_ || __x == __root)
+                        {
+                            __x->__is_black_ = true;
+                            break;
+                        }
+                        // reset sibling, and it still can't be null
+                        __w = __tree_is_left_child(__x) ?
+                                    __x->__parent_->__right_ :
+                                    __x->__parent_->__left_;
+                        // continue;
+                    }
+                    else  // __w has a red child
+                    {
+                        if (__w->__left_ == nullptr || __w->__left_->__is_black_)
+                        {
+                            // __w right child is non-null and red
+                            __w->__right_->__is_black_ = true;
+                            __w->__is_black_ = false;
+                            __tree_left_rotate(__w);
+                            // __w is known not to be root, so root hasn't changed
+                            // reset sibling, and it still can't be null
+                            __w = __w->__parent_;
+                        }
+                        // __w has a left red child, right child may be null
+                        __w->__is_black_ = __w->__parent_->__is_black_;
+                        __w->__parent_->__is_black_ = true;
+                        __w->__left_->__is_black_ = true;
+                        __tree_right_rotate(__w->__parent_);
+                        break;
+                    }
+                }
+            }
+        }
+    }
+}
+
+template <class _Allocator> class __map_node_destructor;
+
+template <class _Allocator>
+class __tree_node_destructor
+{
+    typedef _Allocator                                      allocator_type;
+    typedef allocator_traits<allocator_type>                __alloc_traits;
+    typedef typename __alloc_traits::value_type::value_type value_type;
+public:
+    typedef typename __alloc_traits::pointer                pointer;
+private:
+
+    allocator_type& __na_;
+
+    __tree_node_destructor& operator=(const __tree_node_destructor&);
+
+public:
+    bool __value_constructed;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
+        : __na_(__na),
+          __value_constructed(__val)
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void operator()(pointer __p) _NOEXCEPT
+    {
+        if (__value_constructed)
+            __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_));
+        if (__p)
+            __alloc_traits::deallocate(__na_, __p, 1);
+    }
+
+    template <class> friend class __map_node_destructor;
+};
+
+// node
+
+template <class _Pointer>
+class __tree_end_node
+{
+public:
+    typedef _Pointer pointer;
+    pointer __left_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_end_node() _NOEXCEPT : __left_() {}
+};
+
+template <class _VoidPtr>
+class __tree_node_base
+    : public __tree_end_node
+             <
+                typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+                     rebind<__tree_node_base<_VoidPtr> >
+#else
+                     rebind<__tree_node_base<_VoidPtr> >::other
+#endif
+             >
+{
+    __tree_node_base(const __tree_node_base&);
+    __tree_node_base& operator=(const __tree_node_base&);
+public:
+    typedef typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<__tree_node_base>
+#else
+            rebind<__tree_node_base>::other
+#endif
+                                                pointer;
+    typedef typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<const __tree_node_base>
+#else
+            rebind<const __tree_node_base>::other
+#endif
+                                                const_pointer;
+    typedef __tree_end_node<pointer> base;
+
+    pointer __right_;
+    pointer __parent_;
+    bool __is_black_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_node_base() _NOEXCEPT
+        : __right_(), __parent_(), __is_black_(false) {}
+};
+
+template <class _Tp, class _VoidPtr>
+class __tree_node
+    : public __tree_node_base<_VoidPtr>
+{
+public:
+    typedef __tree_node_base<_VoidPtr> base;
+    typedef _Tp value_type;
+
+    value_type __value_;
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    template <class ..._Args>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit __tree_node(_Args&& ...__args)
+            : __value_(_VSTD::forward<_Args>(__args)...) {}
+#else  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __tree_node(const value_type& __v)
+            : __value_(__v) {}
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+};
+
+template <class _TreeIterator> class _LIBCPP_TYPE_VIS_ONLY __map_iterator;
+template <class _TreeIterator> class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
+
+template <class _Tp, class _NodePtr, class _DiffType>
+class _LIBCPP_TYPE_VIS_ONLY __tree_iterator
+{
+    typedef _NodePtr                                              __node_pointer;
+    typedef typename pointer_traits<__node_pointer>::element_type __node;
+
+    __node_pointer __ptr_;
+
+    typedef pointer_traits<__node_pointer> __pointer_traits;
+public:
+    typedef bidirectional_iterator_tag iterator_category;
+    typedef _Tp                        value_type;
+    typedef _DiffType                  difference_type;
+    typedef value_type&                reference;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<value_type>
+#else
+            rebind<value_type>::other
+#endif
+                                       pointer;
+
+    _LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+    : __ptr_(nullptr)
+#endif
+    {}
+
+    _LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
+    _LIBCPP_INLINE_VISIBILITY pointer operator->() const
+        {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_iterator& operator++() {
+      __ptr_ = static_cast<__node_pointer>(
+          __tree_next(static_cast<typename __node::base::pointer>(__ptr_)));
+      return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_iterator operator++(int)
+        {__tree_iterator __t(*this); ++(*this); return __t;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_iterator& operator--() {
+      __ptr_ = static_cast<__node_pointer>(
+          __tree_prev(static_cast<typename __node::base::pointer>(__ptr_)));
+      return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_iterator operator--(int)
+        {__tree_iterator __t(*this); --(*this); return __t;}
+
+    friend _LIBCPP_INLINE_VISIBILITY 
+        bool operator==(const __tree_iterator& __x, const __tree_iterator& __y)
+        {return __x.__ptr_ == __y.__ptr_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y)
+        {return !(__x == __y);}
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+    template <class, class, class> friend class __tree;
+    template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_iterator;
+    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
+    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
+    template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY set;
+    template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multiset;
+};
+
+template <class _Tp, class _ConstNodePtr, class _DiffType>
+class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator
+{
+    typedef _ConstNodePtr                                         __node_pointer;
+    typedef typename pointer_traits<__node_pointer>::element_type __node;
+
+    __node_pointer __ptr_;
+
+    typedef pointer_traits<__node_pointer> __pointer_traits;
+public:
+    typedef bidirectional_iterator_tag       iterator_category;
+    typedef _Tp                              value_type;
+    typedef _DiffType                        difference_type;
+    typedef const value_type&                reference;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<const value_type>
+#else
+            rebind<const value_type>::other
+#endif
+                                       pointer;
+
+    _LIBCPP_INLINE_VISIBILITY __tree_const_iterator() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+    : __ptr_(nullptr)
+#endif
+    {}
+
+private:
+    typedef typename remove_const<__node>::type  __non_const_node;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<__non_const_node>
+#else
+            rebind<__non_const_node>::other
+#endif
+                                                 __non_const_node_pointer;
+    typedef __tree_iterator<value_type, __non_const_node_pointer, difference_type>
+                                                 __non_const_iterator;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT
+        : __ptr_(__p.__ptr_) {}
+
+    _LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
+    _LIBCPP_INLINE_VISIBILITY pointer operator->() const
+        {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_const_iterator& operator++() {
+      typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+          rebind<typename __node::base>
+#else
+          rebind<typename __node::base>::other
+#endif
+              __node_base_pointer;
+
+      __ptr_ = static_cast<__node_pointer>(
+          __tree_next(static_cast<__node_base_pointer>(__ptr_)));
+      return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_const_iterator operator++(int)
+        {__tree_const_iterator __t(*this); ++(*this); return __t;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_const_iterator& operator--() {
+      typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+          rebind<typename __node::base>
+#else
+          rebind<typename __node::base>::other
+#endif
+              __node_base_pointer;
+
+      __ptr_ = static_cast<__node_pointer>(
+          __tree_prev(static_cast<__node_base_pointer>(__ptr_)));
+      return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __tree_const_iterator operator--(int)
+        {__tree_const_iterator __t(*this); --(*this); return __t;}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
+        {return __x.__ptr_ == __y.__ptr_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
+        {return !(__x == __y);}
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
+        : __ptr_(__p) {}
+    template <class, class, class> friend class __tree;
+    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
+    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
+    template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY set;
+    template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multiset;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
+};
+
+template <class _Tp, class _Compare, class _Allocator>
+class __tree
+{
+public:
+    typedef _Tp                                      value_type;
+    typedef _Compare                                 value_compare;
+    typedef _Allocator                               allocator_type;
+    typedef allocator_traits<allocator_type>         __alloc_traits;
+    typedef typename __alloc_traits::pointer         pointer;
+    typedef typename __alloc_traits::const_pointer   const_pointer;
+    typedef typename __alloc_traits::size_type       size_type;
+    typedef typename __alloc_traits::difference_type difference_type;
+
+    typedef typename __alloc_traits::void_pointer  __void_pointer;
+
+    typedef __tree_node<value_type, __void_pointer> __node;
+    typedef __tree_node_base<__void_pointer>        __node_base;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator;
+    typedef allocator_traits<__node_allocator>       __node_traits;
+    typedef typename __node_traits::pointer          __node_pointer;
+    typedef typename __node_traits::pointer          __node_const_pointer;
+    typedef typename __node_base::pointer            __node_base_pointer;
+    typedef typename __node_base::pointer            __node_base_const_pointer;
+private:
+    typedef typename __node_base::base __end_node_t;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<__end_node_t>
+#else
+            rebind<__end_node_t>::other
+#endif
+                                                     __end_node_ptr;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<__end_node_t>
+#else
+            rebind<__end_node_t>::other
+#endif
+                                                     __end_node_const_ptr;
+
+    __node_pointer                                          __begin_node_;
+    __compressed_pair<__end_node_t, __node_allocator>  __pair1_;
+    __compressed_pair<size_type, value_compare>        __pair3_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __node_pointer __end_node() _NOEXCEPT
+    {
+        return static_cast<__node_pointer>
+               (
+                   pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first())
+               );
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __node_const_pointer __end_node() const _NOEXCEPT
+    {
+        return static_cast<__node_const_pointer>
+               (
+                   pointer_traits<__end_node_const_ptr>::pointer_to(const_cast<__end_node_t&>(__pair1_.first()))
+               );
+    }
+    _LIBCPP_INLINE_VISIBILITY
+          __node_allocator& __node_alloc() _NOEXCEPT {return __pair1_.second();}
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    const __node_allocator& __node_alloc() const _NOEXCEPT
+        {return __pair1_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+          __node_pointer& __begin_node() _NOEXCEPT {return __begin_node_;}
+    _LIBCPP_INLINE_VISIBILITY
+    const __node_pointer& __begin_node() const _NOEXCEPT {return __begin_node_;}
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type __alloc() const _NOEXCEPT
+        {return allocator_type(__node_alloc());}
+private:
+    _LIBCPP_INLINE_VISIBILITY
+          size_type& size() _NOEXCEPT {return __pair3_.first();}
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    const size_type& size() const _NOEXCEPT {return __pair3_.first();}
+    _LIBCPP_INLINE_VISIBILITY
+          value_compare& value_comp() _NOEXCEPT {return __pair3_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const value_compare& value_comp() const _NOEXCEPT
+        {return __pair3_.second();}
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __node_pointer __root() _NOEXCEPT
+        {return static_cast<__node_pointer>      (__end_node()->__left_);}
+    _LIBCPP_INLINE_VISIBILITY
+    __node_const_pointer __root() const _NOEXCEPT
+        {return static_cast<__node_const_pointer>(__end_node()->__left_);}
+
+    typedef __tree_iterator<value_type, __node_pointer, difference_type>             iterator;
+    typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator;
+
+    explicit __tree(const value_compare& __comp)
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<__node_allocator>::value &&
+            is_nothrow_copy_constructible<value_compare>::value);
+    explicit __tree(const allocator_type& __a);
+    __tree(const value_compare& __comp, const allocator_type& __a);
+    __tree(const __tree& __t);
+    __tree& operator=(const __tree& __t);
+    template <class _InputIterator>
+        void __assign_unique(_InputIterator __first, _InputIterator __last);
+    template <class _InputIterator>
+        void __assign_multi(_InputIterator __first, _InputIterator __last);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __tree(__tree&& __t)
+        _NOEXCEPT_(
+            is_nothrow_move_constructible<__node_allocator>::value &&
+            is_nothrow_move_constructible<value_compare>::value);
+    __tree(__tree&& __t, const allocator_type& __a);
+    __tree& operator=(__tree&& __t)
+        _NOEXCEPT_(
+            __node_traits::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<value_compare>::value &&
+            is_nothrow_move_assignable<__node_allocator>::value);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    ~__tree();
+
+    _LIBCPP_INLINE_VISIBILITY
+          iterator begin()  _NOEXCEPT {return       iterator(__begin_node());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT {return const_iterator(__begin_node());}
+    _LIBCPP_INLINE_VISIBILITY
+          iterator end() _NOEXCEPT {return       iterator(__end_node());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end() const _NOEXCEPT {return const_iterator(__end_node());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT
+        {return __node_traits::max_size(__node_alloc());}
+
+    void clear() _NOEXCEPT;
+
+    void swap(__tree& __t)
+        _NOEXCEPT_(
+            __is_nothrow_swappable<value_compare>::value
+#if _LIBCPP_STD_VER <= 11
+            && (!__node_traits::propagate_on_container_swap::value ||
+                 __is_nothrow_swappable<__node_allocator>::value)
+#endif
+            );
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args>
+        pair<iterator, bool>
+        __emplace_unique(_Args&&... __args);
+    template <class... _Args>
+        iterator
+        __emplace_multi(_Args&&... __args);
+
+    template <class... _Args>
+        iterator
+        __emplace_hint_unique(const_iterator __p, _Args&&... __args);
+    template <class... _Args>
+        iterator
+        __emplace_hint_multi(const_iterator __p, _Args&&... __args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+    template <class _Vp>
+        pair<iterator, bool> __insert_unique(_Vp&& __v);
+    template <class _Vp>
+        iterator __insert_unique(const_iterator __p, _Vp&& __v);
+    template <class _Vp>
+        iterator __insert_multi(_Vp&& __v);
+    template <class _Vp>
+        iterator __insert_multi(const_iterator __p, _Vp&& __v);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    pair<iterator, bool> __insert_unique(const value_type& __v);
+    iterator __insert_unique(const_iterator __p, const value_type& __v);
+    iterator __insert_multi(const value_type& __v);
+    iterator __insert_multi(const_iterator __p, const value_type& __v);
+
+    pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
+    iterator             __node_insert_unique(const_iterator __p,
+                                              __node_pointer __nd);
+
+    iterator __node_insert_multi(__node_pointer __nd);
+    iterator __node_insert_multi(const_iterator __p, __node_pointer __nd);
+
+    iterator erase(const_iterator __p);
+    iterator erase(const_iterator __f, const_iterator __l);
+    template <class _Key>
+        size_type __erase_unique(const _Key& __k);
+    template <class _Key>
+        size_type __erase_multi(const _Key& __k);
+
+    void __insert_node_at(__node_base_pointer __parent,
+                          __node_base_pointer& __child,
+                          __node_base_pointer __new_node);
+
+    template <class _Key>
+        iterator find(const _Key& __v);
+    template <class _Key>
+        const_iterator find(const _Key& __v) const;
+
+    template <class _Key>
+        size_type __count_unique(const _Key& __k) const;
+    template <class _Key>
+        size_type __count_multi(const _Key& __k) const;
+
+    template <class _Key>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator lower_bound(const _Key& __v)
+            {return __lower_bound(__v, __root(), __end_node());}
+    template <class _Key>
+        iterator __lower_bound(const _Key& __v,
+                               __node_pointer __root,
+                               __node_pointer __result);
+    template <class _Key>
+        _LIBCPP_INLINE_VISIBILITY
+        const_iterator lower_bound(const _Key& __v) const
+            {return __lower_bound(__v, __root(), __end_node());}
+    template <class _Key>
+        const_iterator __lower_bound(const _Key& __v,
+                                     __node_const_pointer __root,
+                                     __node_const_pointer __result) const;
+    template <class _Key>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator upper_bound(const _Key& __v)
+            {return __upper_bound(__v, __root(), __end_node());}
+    template <class _Key>
+        iterator __upper_bound(const _Key& __v,
+                               __node_pointer __root,
+                               __node_pointer __result);
+    template <class _Key>
+        _LIBCPP_INLINE_VISIBILITY
+        const_iterator upper_bound(const _Key& __v) const
+            {return __upper_bound(__v, __root(), __end_node());}
+    template <class _Key>
+        const_iterator __upper_bound(const _Key& __v,
+                                     __node_const_pointer __root,
+                                     __node_const_pointer __result) const;
+    template <class _Key>
+        pair<iterator, iterator>
+        __equal_range_unique(const _Key& __k);
+    template <class _Key>
+        pair<const_iterator, const_iterator>
+        __equal_range_unique(const _Key& __k) const;
+
+    template <class _Key>
+        pair<iterator, iterator>
+        __equal_range_multi(const _Key& __k);
+    template <class _Key>
+        pair<const_iterator, const_iterator>
+        __equal_range_multi(const _Key& __k) const;
+
+    typedef __tree_node_destructor<__node_allocator> _Dp;
+    typedef unique_ptr<__node, _Dp> __node_holder;
+
+    __node_holder remove(const_iterator __p) _NOEXCEPT;
+private:
+    typename __node_base::pointer&
+        __find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v);
+    typename __node_base::pointer&
+        __find_leaf_high(typename __node_base::pointer& __parent, const value_type& __v);
+    typename __node_base::pointer&
+        __find_leaf(const_iterator __hint,
+                    typename __node_base::pointer& __parent, const value_type& __v);
+    template <class _Key>
+        typename __node_base::pointer&
+        __find_equal(typename __node_base::pointer& __parent, const _Key& __v);
+    template <class _Key>
+        typename __node_base::pointer&
+        __find_equal(const_iterator __hint, typename __node_base::pointer& __parent,
+                     const _Key& __v);
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    template <class ..._Args>
+        __node_holder __construct_node(_Args&& ...__args);
+#else  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+        __node_holder __construct_node(const value_type& __v);
+#endif
+
+    void destroy(__node_pointer __nd) _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __tree& __t)
+        {__copy_assign_alloc(__t, integral_constant<bool,
+             __node_traits::propagate_on_container_copy_assignment::value>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __tree& __t, true_type)
+        {__node_alloc() = __t.__node_alloc();}
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __tree& __t, false_type) {}
+
+    void __move_assign(__tree& __t, false_type);
+    void __move_assign(__tree& __t, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
+                   is_nothrow_move_assignable<__node_allocator>::value);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__tree& __t)
+        _NOEXCEPT_(
+            !__node_traits::propagate_on_container_move_assignment::value ||
+            is_nothrow_move_assignable<__node_allocator>::value)
+        {__move_assign_alloc(__t, integral_constant<bool,
+             __node_traits::propagate_on_container_move_assignment::value>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__tree& __t, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
+        {__node_alloc() = _VSTD::move(__t.__node_alloc());}
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {}
+
+    __node_pointer __detach();
+    static __node_pointer __detach(__node_pointer);
+
+    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
+    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
+};
+
+template <class _Tp, class _Compare, class _Allocator>
+__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<__node_allocator>::value &&
+            is_nothrow_copy_constructible<value_compare>::value)
+    : __pair3_(0, __comp)
+{
+    __begin_node() = __end_node();
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
+    : __begin_node_(__node_pointer()),
+      __pair1_(__node_allocator(__a)),
+      __pair3_(0)
+{
+    __begin_node() = __end_node();
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
+                                           const allocator_type& __a)
+    : __begin_node_(__node_pointer()),
+      __pair1_(__node_allocator(__a)),
+      __pair3_(0, __comp)
+{
+    __begin_node() = __end_node();
+}
+
+// Precondition:  size() != 0
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
+__tree<_Tp, _Compare, _Allocator>::__detach()
+{
+    __node_pointer __cache = __begin_node();
+    __begin_node() = __end_node();
+    __end_node()->__left_->__parent_ = nullptr;
+    __end_node()->__left_ = nullptr;
+    size() = 0;
+    // __cache->__left_ == nullptr
+    if (__cache->__right_ != nullptr)
+        __cache = static_cast<__node_pointer>(__cache->__right_);
+    // __cache->__left_ == nullptr
+    // __cache->__right_ == nullptr
+    return __cache;
+}
+
+// Precondition:  __cache != nullptr
+//    __cache->left_ == nullptr
+//    __cache->right_ == nullptr
+//    This is no longer a red-black tree
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
+__tree<_Tp, _Compare, _Allocator>::__detach(__node_pointer __cache)
+{
+    if (__cache->__parent_ == nullptr)
+        return nullptr;
+    if (__tree_is_left_child(static_cast<__node_base_pointer>(__cache)))
+    {
+        __cache->__parent_->__left_ = nullptr;
+        __cache = static_cast<__node_pointer>(__cache->__parent_);
+        if (__cache->__right_ == nullptr)
+            return __cache;
+        return static_cast<__node_pointer>(__tree_leaf(__cache->__right_));
+    }
+    // __cache is right child
+    __cache->__parent_->__right_ = nullptr;
+    __cache = static_cast<__node_pointer>(__cache->__parent_);
+    if (__cache->__left_ == nullptr)
+        return __cache;
+    return static_cast<__node_pointer>(__tree_leaf(__cache->__left_));
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+__tree<_Tp, _Compare, _Allocator>&
+__tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t)
+{
+    if (this != &__t)
+    {
+        value_comp() = __t.value_comp();
+        __copy_assign_alloc(__t);
+        __assign_multi(__t.begin(), __t.end());
+    }
+    return *this;
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _InputIterator>
+void
+__tree<_Tp, _Compare, _Allocator>::__assign_unique(_InputIterator __first, _InputIterator __last)
+{
+    if (size() != 0)
+    {
+        __node_pointer __cache = __detach();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (; __cache != nullptr && __first != __last; ++__first)
+            {
+                __cache->__value_ = *__first;
+                __node_pointer __next = __detach(__cache);
+                __node_insert_unique(__cache);
+                __cache = __next;
+            }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            while (__cache->__parent_ != nullptr)
+                __cache = static_cast<__node_pointer>(__cache->__parent_);
+            destroy(__cache);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        if (__cache != nullptr)
+        {
+            while (__cache->__parent_ != nullptr)
+                __cache = static_cast<__node_pointer>(__cache->__parent_);
+            destroy(__cache);
+        }
+    }
+    for (; __first != __last; ++__first)
+        __insert_unique(*__first);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _InputIterator>
+void
+__tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _InputIterator __last)
+{
+    if (size() != 0)
+    {
+        __node_pointer __cache = __detach();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (; __cache != nullptr && __first != __last; ++__first)
+            {
+                __cache->__value_ = *__first;
+                __node_pointer __next = __detach(__cache);
+                __node_insert_multi(__cache);
+                __cache = __next;
+            }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            while (__cache->__parent_ != nullptr)
+                __cache = static_cast<__node_pointer>(__cache->__parent_);
+            destroy(__cache);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        if (__cache != nullptr)
+        {
+            while (__cache->__parent_ != nullptr)
+                __cache = static_cast<__node_pointer>(__cache->__parent_);
+            destroy(__cache);
+        }
+    }
+    for (; __first != __last; ++__first)
+        __insert_multi(*__first);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
+    : __begin_node_(__node_pointer()),
+      __pair1_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())),
+      __pair3_(0, __t.value_comp())
+{
+    __begin_node() = __end_node();
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Compare, class _Allocator>
+__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
+    _NOEXCEPT_(
+        is_nothrow_move_constructible<__node_allocator>::value &&
+        is_nothrow_move_constructible<value_compare>::value)
+    : __begin_node_(_VSTD::move(__t.__begin_node_)),
+      __pair1_(_VSTD::move(__t.__pair1_)),
+      __pair3_(_VSTD::move(__t.__pair3_))
+{
+    if (size() == 0)
+        __begin_node() = __end_node();
+    else
+    {
+        __end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
+        __t.__begin_node() = __t.__end_node();
+        __t.__end_node()->__left_ = nullptr;
+        __t.size() = 0;
+    }
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
+    : __pair1_(__node_allocator(__a)),
+      __pair3_(0, _VSTD::move(__t.value_comp()))
+{
+    if (__a == __t.__alloc())
+    {
+        if (__t.size() == 0)
+            __begin_node() = __end_node();
+        else
+        {
+            __begin_node() = __t.__begin_node();
+            __end_node()->__left_ = __t.__end_node()->__left_;
+            __end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
+            size() = __t.size();
+            __t.__begin_node() = __t.__end_node();
+            __t.__end_node()->__left_ = nullptr;
+            __t.size() = 0;
+        }
+    }
+    else
+    {
+        __begin_node() = __end_node();
+    }
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+void
+__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
+    _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
+               is_nothrow_move_assignable<__node_allocator>::value)
+{
+    destroy(static_cast<__node_pointer>(__end_node()->__left_));
+    __begin_node_ = __t.__begin_node_;
+    __pair1_.first() = __t.__pair1_.first();
+    __move_assign_alloc(__t);
+    __pair3_ = _VSTD::move(__t.__pair3_);
+    if (size() == 0)
+        __begin_node() = __end_node();
+    else
+    {
+        __end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
+        __t.__begin_node() = __t.__end_node();
+        __t.__end_node()->__left_ = nullptr;
+        __t.size() = 0;
+    }
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+void
+__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
+{
+    if (__node_alloc() == __t.__node_alloc())
+        __move_assign(__t, true_type());
+    else
+    {
+        value_comp() = _VSTD::move(__t.value_comp());
+        const_iterator __e = end();
+        if (size() != 0)
+        {
+            __node_pointer __cache = __detach();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            try
+            {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+                while (__cache != nullptr && __t.size() != 0)
+                {
+                    __cache->__value_ = _VSTD::move(__t.remove(__t.begin())->__value_);
+                    __node_pointer __next = __detach(__cache);
+                    __node_insert_multi(__cache);
+                    __cache = __next;
+                }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            }
+            catch (...)
+            {
+                while (__cache->__parent_ != nullptr)
+                    __cache = static_cast<__node_pointer>(__cache->__parent_);
+                destroy(__cache);
+                throw;
+            }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            if (__cache != nullptr)
+            {
+                while (__cache->__parent_ != nullptr)
+                    __cache = static_cast<__node_pointer>(__cache->__parent_);
+                destroy(__cache);
+            }
+        }
+        while (__t.size() != 0)
+            __insert_multi(__e, _VSTD::move(__t.remove(__t.begin())->__value_));
+    }
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+__tree<_Tp, _Compare, _Allocator>&
+__tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
+    _NOEXCEPT_(
+        __node_traits::propagate_on_container_move_assignment::value &&
+        is_nothrow_move_assignable<value_compare>::value &&
+        is_nothrow_move_assignable<__node_allocator>::value)
+        
+{
+    __move_assign(__t, integral_constant<bool,
+                  __node_traits::propagate_on_container_move_assignment::value>());
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Compare, class _Allocator>
+__tree<_Tp, _Compare, _Allocator>::~__tree()
+{
+    destroy(__root());
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+void
+__tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT
+{
+    if (__nd != nullptr)
+    {
+        destroy(static_cast<__node_pointer>(__nd->__left_));
+        destroy(static_cast<__node_pointer>(__nd->__right_));
+        __node_allocator& __na = __node_alloc();
+        __node_traits::destroy(__na, _VSTD::addressof(__nd->__value_));
+        __node_traits::deallocate(__na, __nd, 1);
+    }
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+void
+__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
+        _NOEXCEPT_(
+            __is_nothrow_swappable<value_compare>::value
+#if _LIBCPP_STD_VER <= 11
+            && (!__node_traits::propagate_on_container_swap::value ||
+                 __is_nothrow_swappable<__node_allocator>::value)
+#endif
+            )
+{
+    using _VSTD::swap;
+    swap(__begin_node_, __t.__begin_node_);
+    swap(__pair1_.first(), __t.__pair1_.first());
+    __swap_allocator(__node_alloc(), __t.__node_alloc());
+    __pair3_.swap(__t.__pair3_);
+    if (size() == 0)
+        __begin_node() = __end_node();
+    else
+        __end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
+    if (__t.size() == 0)
+        __t.__begin_node() = __t.__end_node();
+    else
+        __t.__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__t.__end_node());
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+void
+__tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT
+{
+    destroy(__root());
+    size() = 0;
+    __begin_node() = __end_node();
+    __end_node()->__left_ = nullptr;
+}
+
+// Find lower_bound place to insert
+// Set __parent to parent of null leaf
+// Return reference to null leaf
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
+__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer& __parent,
+                                                   const value_type& __v)
+{
+    __node_pointer __nd = __root();
+    if (__nd != nullptr)
+    {
+        while (true)
+        {
+            if (value_comp()(__nd->__value_, __v))
+            {
+                if (__nd->__right_ != nullptr)
+                    __nd = static_cast<__node_pointer>(__nd->__right_);
+                else
+                {
+                    __parent = static_cast<__node_base_pointer>(__nd);
+                    return __parent->__right_;
+                }
+            }
+            else
+            {
+                if (__nd->__left_ != nullptr)
+                    __nd = static_cast<__node_pointer>(__nd->__left_);
+                else
+                {
+                    __parent = static_cast<__node_base_pointer>(__nd);
+                    return __parent->__left_;
+                }
+            }
+        }
+    }
+    __parent = static_cast<__node_base_pointer>(__end_node());
+    return __parent->__left_;
+}
+
+// Find upper_bound place to insert
+// Set __parent to parent of null leaf
+// Return reference to null leaf
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
+__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointer& __parent,
+                                                    const value_type& __v)
+{
+    __node_pointer __nd = __root();
+    if (__nd != nullptr)
+    {
+        while (true)
+        {
+            if (value_comp()(__v, __nd->__value_))
+            {
+                if (__nd->__left_ != nullptr)
+                    __nd = static_cast<__node_pointer>(__nd->__left_);
+                else
+                {
+                    __parent = static_cast<__node_base_pointer>(__nd);
+                    return __parent->__left_;
+                }
+            }
+            else
+            {
+                if (__nd->__right_ != nullptr)
+                    __nd = static_cast<__node_pointer>(__nd->__right_);
+                else
+                {
+                    __parent = static_cast<__node_base_pointer>(__nd);
+                    return __parent->__right_;
+                }
+            }
+        }
+    }
+    __parent = static_cast<__node_base_pointer>(__end_node());
+    return __parent->__left_;
+}
+
+// Find leaf place to insert closest to __hint
+// First check prior to __hint.
+// Next check after __hint.
+// Next do O(log N) search.
+// Set __parent to parent of null leaf
+// Return reference to null leaf
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
+__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
+                                               typename __node_base::pointer& __parent,
+                                               const value_type& __v)
+{
+    if (__hint == end() || !value_comp()(*__hint, __v))  // check before
+    {
+        // __v <= *__hint
+        const_iterator __prior = __hint;
+        if (__prior == begin() || !value_comp()(__v, *--__prior))
+        {
+            // *prev(__hint) <= __v <= *__hint
+            if (__hint.__ptr_->__left_ == nullptr)
+            {
+                __parent = static_cast<__node_base_pointer>(__hint.__ptr_);
+                return __parent->__left_;
+            }
+            else
+            {
+                __parent = static_cast<__node_base_pointer>(__prior.__ptr_);
+                return __parent->__right_;
+            }
+        }
+        // __v < *prev(__hint)
+        return __find_leaf_high(__parent, __v);
+    }
+    // else __v > *__hint
+    return __find_leaf_low(__parent, __v);
+}
+
+// Find place to insert if __v doesn't exist
+// Set __parent to parent of null leaf
+// Return reference to null leaf
+// If __v exists, set parent to node of __v and return reference to node of __v
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
+__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& __parent,
+                                                const _Key& __v)
+{
+    __node_pointer __nd = __root();
+    if (__nd != nullptr)
+    {
+        while (true)
+        {
+            if (value_comp()(__v, __nd->__value_))
+            {
+                if (__nd->__left_ != nullptr)
+                    __nd = static_cast<__node_pointer>(__nd->__left_);
+                else
+                {
+                    __parent = static_cast<__node_base_pointer>(__nd);
+                    return __parent->__left_;
+                }
+            }
+            else if (value_comp()(__nd->__value_, __v))
+            {
+                if (__nd->__right_ != nullptr)
+                    __nd = static_cast<__node_pointer>(__nd->__right_);
+                else
+                {
+                    __parent = static_cast<__node_base_pointer>(__nd);
+                    return __parent->__right_;
+                }
+            }
+            else
+            {
+                __parent = static_cast<__node_base_pointer>(__nd);
+                return __parent;
+            }
+        }
+    }
+    __parent = static_cast<__node_base_pointer>(__end_node());
+    return __parent->__left_;
+}
+
+// Find place to insert if __v doesn't exist
+// First check prior to __hint.
+// Next check after __hint.
+// Next do O(log N) search.
+// Set __parent to parent of null leaf
+// Return reference to null leaf
+// If __v exists, set parent to node of __v and return reference to node of __v
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
+__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
+                                                typename __node_base::pointer& __parent,
+                                                const _Key& __v)
+{
+    if (__hint == end() || value_comp()(__v, *__hint))  // check before
+    {
+        // __v < *__hint
+        const_iterator __prior = __hint;
+        if (__prior == begin() || value_comp()(*--__prior, __v))
+        {
+            // *prev(__hint) < __v < *__hint
+            if (__hint.__ptr_->__left_ == nullptr)
+            {
+                __parent = static_cast<__node_base_pointer>(__hint.__ptr_);
+                return __parent->__left_;
+            }
+            else
+            {
+                __parent = static_cast<__node_base_pointer>(__prior.__ptr_);
+                return __parent->__right_;
+            }
+        }
+        // __v <= *prev(__hint)
+        return __find_equal(__parent, __v);
+    }
+    else if (value_comp()(*__hint, __v))  // check after
+    {
+        // *__hint < __v
+        const_iterator __next = _VSTD::next(__hint);
+        if (__next == end() || value_comp()(__v, *__next))
+        {
+            // *__hint < __v < *_VSTD::next(__hint)
+            if (__hint.__ptr_->__right_ == nullptr)
+            {
+                __parent = static_cast<__node_base_pointer>(__hint.__ptr_);
+                return __parent->__right_;
+            }
+            else
+            {
+                __parent = static_cast<__node_base_pointer>(__next.__ptr_);
+                return __parent->__left_;
+            }
+        }
+        // *next(__hint) <= __v
+        return __find_equal(__parent, __v);
+    }
+    // else __v == *__hint
+    __parent = static_cast<__node_base_pointer>(__hint.__ptr_);
+    return __parent;
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+void
+__tree<_Tp, _Compare, _Allocator>::__insert_node_at(__node_base_pointer __parent,
+                                                    __node_base_pointer& __child,
+                                                    __node_base_pointer __new_node)
+{
+    __new_node->__left_   = nullptr;
+    __new_node->__right_  = nullptr;
+    __new_node->__parent_ = __parent;
+    __child = __new_node;
+    if (__begin_node()->__left_ != nullptr)
+        __begin_node() = static_cast<__node_pointer>(__begin_node()->__left_);
+    __tree_balance_after_insert(__end_node()->__left_, __child);
+    ++size();
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class ..._Args>
+typename __tree<_Tp, _Compare, _Allocator>::__node_holder
+__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
+{
+    __node_allocator& __na = __node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
+    __h.get_deleter().__value_constructed = true;
+    return __h;
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class... _Args>
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
+__tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_equal(__parent, __h->__value_);
+    __node_pointer __r = static_cast<__node_pointer>(__child);
+    bool __inserted = false;
+    if (__child == nullptr)
+    {
+        __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+        __r = __h.release();
+        __inserted = true;
+    }
+    return pair<iterator, bool>(iterator(__r), __inserted);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class... _Args>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Args&&... __args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_equal(__p, __parent, __h->__value_);
+    __node_pointer __r = static_cast<__node_pointer>(__child);
+    if (__child == nullptr)
+    {
+        __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+        __r = __h.release();
+    }
+    return iterator(__r);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class... _Args>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
+    __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+    return iterator(static_cast<__node_pointer>(__h.release()));
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class... _Args>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
+                                                        _Args&&... __args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
+    __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+    return iterator(static_cast<__node_pointer>(__h.release()));
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Vp>
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
+__tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
+    pair<iterator, bool> __r = __node_insert_unique(__h.get());
+    if (__r.second)
+        __h.release();
+    return __r;
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Vp>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
+    iterator __r = __node_insert_unique(__p, __h.get());
+    if (__r.__ptr_ == __h.get())
+        __h.release();
+    return __r;
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Vp>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
+    __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+    return iterator(__h.release());
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Vp>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
+    __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+    return iterator(__h.release());
+}
+
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::__node_holder
+__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
+{
+    __node_allocator& __na = __node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
+    __h.get_deleter().__value_constructed = true;
+    return _LIBCPP_EXPLICIT_MOVE(__h);  // explicitly moved for C++03
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Compare, class _Allocator>
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
+__tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_equal(__parent, __v);
+    __node_pointer __r = static_cast<__node_pointer>(__child);
+    bool __inserted = false;
+    if (__child == nullptr)
+    {
+        __node_holder __h = __construct_node(__v);
+        __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+        __r = __h.release();
+        __inserted = true;
+    }
+    return pair<iterator, bool>(iterator(__r), __inserted);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, const value_type& __v)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_equal(__p, __parent, __v);
+    __node_pointer __r = static_cast<__node_pointer>(__child);
+    if (__child == nullptr)
+    {
+        __node_holder __h = __construct_node(__v);
+        __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+        __r = __h.release();
+    }
+    return iterator(__r);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__insert_multi(const value_type& __v)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_leaf_high(__parent, __v);
+    __node_holder __h = __construct_node(__v);
+    __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+    return iterator(__h.release());
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const value_type& __v)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_leaf(__p, __parent, __v);
+    __node_holder __h = __construct_node(__v);
+    __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+    return iterator(__h.release());
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
+__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_equal(__parent, __nd->__value_);
+    __node_pointer __r = static_cast<__node_pointer>(__child);
+    bool __inserted = false;
+    if (__child == nullptr)
+    {
+        __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+        __r = __nd;
+        __inserted = true;
+    }
+    return pair<iterator, bool>(iterator(__r), __inserted);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(const_iterator __p,
+                                                        __node_pointer __nd)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_equal(__p, __parent, __nd->__value_);
+    __node_pointer __r = static_cast<__node_pointer>(__child);
+    if (__child == nullptr)
+    {
+        __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+        __r = __nd;
+    }
+    return iterator(__r);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_leaf_high(__parent, __nd->__value_);
+    __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+    return iterator(__nd);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p,
+                                                       __node_pointer __nd)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_leaf(__p, __parent, __nd->__value_);
+    __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+    return iterator(__nd);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
+{
+    __node_pointer __np = __p.__ptr_;
+    iterator __r(__np);
+    ++__r;
+    if (__begin_node() == __np)
+        __begin_node() = __r.__ptr_;
+    --size();
+    __node_allocator& __na = __node_alloc();
+    __tree_remove(__end_node()->__left_,
+                  static_cast<__node_base_pointer>(__np));
+    __node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
+    __node_traits::deallocate(__na, __np, 1);
+    return __r;
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l)
+{
+    while (__f != __l)
+        __f = erase(__f);
+    return iterator(__l.__ptr_);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::size_type
+__tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k)
+{
+    iterator __i = find(__k);
+    if (__i == end())
+        return 0;
+    erase(__i);
+    return 1;
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::size_type
+__tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k)
+{
+    pair<iterator, iterator> __p = __equal_range_multi(__k);
+    size_type __r = 0;
+    for (; __p.first != __p.second; ++__r)
+        __p.first = erase(__p.first);
+    return __r;
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v)
+{
+    iterator __p = __lower_bound(__v, __root(), __end_node());
+    if (__p != end() && !value_comp()(__v, *__p))
+        return __p;
+    return end();
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::const_iterator
+__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) const
+{
+    const_iterator __p = __lower_bound(__v, __root(), __end_node());
+    if (__p != end() && !value_comp()(__v, *__p))
+        return __p;
+    return end();
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::size_type
+__tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const
+{
+    __node_const_pointer __result = __end_node();
+    __node_const_pointer __rt = __root();
+    while (__rt != nullptr)
+    {
+        if (value_comp()(__k, __rt->__value_))
+        {
+            __result = __rt;
+            __rt = static_cast<__node_const_pointer>(__rt->__left_);
+        }
+        else if (value_comp()(__rt->__value_, __k))
+            __rt = static_cast<__node_const_pointer>(__rt->__right_);
+        else
+            return 1;
+    }
+    return 0;
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::size_type
+__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
+{
+    __node_const_pointer __result = __end_node();
+    __node_const_pointer __rt = __root();
+    while (__rt != nullptr)
+    {
+        if (value_comp()(__k, __rt->__value_))
+        {
+            __result = __rt;
+            __rt = static_cast<__node_const_pointer>(__rt->__left_);
+        }
+        else if (value_comp()(__rt->__value_, __k))
+            __rt = static_cast<__node_const_pointer>(__rt->__right_);
+        else
+            return _VSTD::distance(
+                __lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
+                __upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result)
+            );
+    }
+    return 0;
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v,
+                                                 __node_pointer __root,
+                                                 __node_pointer __result)
+{
+    while (__root != nullptr)
+    {
+        if (!value_comp()(__root->__value_, __v))
+        {
+            __result = __root;
+            __root = static_cast<__node_pointer>(__root->__left_);
+        }
+        else
+            __root = static_cast<__node_pointer>(__root->__right_);
+    }
+    return iterator(__result);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::const_iterator
+__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v,
+                                                 __node_const_pointer __root,
+                                                 __node_const_pointer __result) const
+{
+    while (__root != nullptr)
+    {
+        if (!value_comp()(__root->__value_, __v))
+        {
+            __result = __root;
+            __root = static_cast<__node_const_pointer>(__root->__left_);
+        }
+        else
+            __root = static_cast<__node_const_pointer>(__root->__right_);
+    }
+    return const_iterator(__result);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v,
+                                                 __node_pointer __root,
+                                                 __node_pointer __result)
+{
+    while (__root != nullptr)
+    {
+        if (value_comp()(__v, __root->__value_))
+        {
+            __result = __root;
+            __root = static_cast<__node_pointer>(__root->__left_);
+        }
+        else
+            __root = static_cast<__node_pointer>(__root->__right_);
+    }
+    return iterator(__result);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+typename __tree<_Tp, _Compare, _Allocator>::const_iterator
+__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v,
+                                                 __node_const_pointer __root,
+                                                 __node_const_pointer __result) const
+{
+    while (__root != nullptr)
+    {
+        if (value_comp()(__v, __root->__value_))
+        {
+            __result = __root;
+            __root = static_cast<__node_const_pointer>(__root->__left_);
+        }
+        else
+            __root = static_cast<__node_const_pointer>(__root->__right_);
+    }
+    return const_iterator(__result);
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
+     typename __tree<_Tp, _Compare, _Allocator>::iterator>
+__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
+{
+    typedef pair<iterator, iterator> _Pp;
+    __node_pointer __result = __end_node();
+    __node_pointer __rt = __root();
+    while (__rt != nullptr)
+    {
+        if (value_comp()(__k, __rt->__value_))
+        {
+            __result = __rt;
+            __rt = static_cast<__node_pointer>(__rt->__left_);
+        }
+        else if (value_comp()(__rt->__value_, __k))
+            __rt = static_cast<__node_pointer>(__rt->__right_);
+        else
+            return _Pp(iterator(__rt),
+                      iterator(
+                          __rt->__right_ != nullptr ?
+                              static_cast<__node_pointer>(__tree_min(__rt->__right_))
+                            : __result));
+    }
+    return _Pp(iterator(__result), iterator(__result));
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
+     typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
+__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
+{
+    typedef pair<const_iterator, const_iterator> _Pp;
+    __node_const_pointer __result = __end_node();
+    __node_const_pointer __rt = __root();
+    while (__rt != nullptr)
+    {
+        if (value_comp()(__k, __rt->__value_))
+        {
+            __result = __rt;
+            __rt = static_cast<__node_const_pointer>(__rt->__left_);
+        }
+        else if (value_comp()(__rt->__value_, __k))
+            __rt = static_cast<__node_const_pointer>(__rt->__right_);
+        else
+            return _Pp(const_iterator(__rt),
+                      const_iterator(
+                          __rt->__right_ != nullptr ?
+                              static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
+                            : __result));
+    }
+    return _Pp(const_iterator(__result), const_iterator(__result));
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
+     typename __tree<_Tp, _Compare, _Allocator>::iterator>
+__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
+{
+    typedef pair<iterator, iterator> _Pp;
+    __node_pointer __result = __end_node();
+    __node_pointer __rt = __root();
+    while (__rt != nullptr)
+    {
+        if (value_comp()(__k, __rt->__value_))
+        {
+            __result = __rt;
+            __rt = static_cast<__node_pointer>(__rt->__left_);
+        }
+        else if (value_comp()(__rt->__value_, __k))
+            __rt = static_cast<__node_pointer>(__rt->__right_);
+        else
+            return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
+                      __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+    }
+    return _Pp(iterator(__result), iterator(__result));
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+template <class _Key>
+pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
+     typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
+__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
+{
+    typedef pair<const_iterator, const_iterator> _Pp;
+    __node_const_pointer __result = __end_node();
+    __node_const_pointer __rt = __root();
+    while (__rt != nullptr)
+    {
+        if (value_comp()(__k, __rt->__value_))
+        {
+            __result = __rt;
+            __rt = static_cast<__node_const_pointer>(__rt->__left_);
+        }
+        else if (value_comp()(__rt->__value_, __k))
+            __rt = static_cast<__node_const_pointer>(__rt->__right_);
+        else
+            return _Pp(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
+                      __upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
+    }
+    return _Pp(const_iterator(__result), const_iterator(__result));
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+typename __tree<_Tp, _Compare, _Allocator>::__node_holder
+__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
+{
+    __node_pointer __np = __p.__ptr_;
+    if (__begin_node() == __np)
+    {
+        if (__np->__right_ != nullptr)
+            __begin_node() = static_cast<__node_pointer>(__np->__right_);
+        else
+            __begin_node() = static_cast<__node_pointer>(__np->__parent_);
+    }
+    --size();
+    __tree_remove(__end_node()->__left_,
+                  static_cast<__node_base_pointer>(__np));
+    return __node_holder(__np, _Dp(__node_alloc(), true));
+}
+
+template <class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__tree<_Tp, _Compare, _Allocator>& __x,
+     __tree<_Tp, _Compare, _Allocator>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP___TREE

Property changes on: lab4/.minix-src/include/c++/__tree
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c/macros.h
===================================================================
--- lab4/.minix-src/include/atf-c/macros.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c/macros.h	(revision 13)
@@ -0,0 +1,208 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_MACROS_H)
+#define ATF_C_MACROS_H
+
+#include <string.h>
+
+#include <atf-c/defs.h>
+#include <atf-c/error.h>
+#include <atf-c/tc.h>
+#include <atf-c/tp.h>
+#include <atf-c/utils.h>
+
+#define ATF_TC_NAME(tc) \
+    (atfu_ ## tc ## _tc)
+
+#define ATF_TC_PACK_NAME(tc) \
+    (atfu_ ## tc ## _tc_pack)
+
+#define ATF_TC_WITHOUT_HEAD(tc) \
+    static void atfu_ ## tc ## _body(const atf_tc_t *); \
+    static atf_tc_t atfu_ ## tc ## _tc; \
+    static atf_tc_pack_t atfu_ ## tc ## _tc_pack = { \
+        .m_ident = #tc, \
+        .m_head = NULL, \
+        .m_body = atfu_ ## tc ## _body, \
+        .m_cleanup = NULL, \
+    }
+
+#define ATF_TC(tc) \
+    static void atfu_ ## tc ## _head(atf_tc_t *); \
+    static void atfu_ ## tc ## _body(const atf_tc_t *); \
+    static atf_tc_t atfu_ ## tc ## _tc; \
+    static atf_tc_pack_t atfu_ ## tc ## _tc_pack = { \
+        .m_ident = #tc, \
+        .m_head = atfu_ ## tc ## _head, \
+        .m_body = atfu_ ## tc ## _body, \
+        .m_cleanup = NULL, \
+    }
+
+#define ATF_TC_WITH_CLEANUP(tc) \
+    static void atfu_ ## tc ## _head(atf_tc_t *); \
+    static void atfu_ ## tc ## _body(const atf_tc_t *); \
+    static void atfu_ ## tc ## _cleanup(const atf_tc_t *); \
+    static atf_tc_t atfu_ ## tc ## _tc; \
+    static atf_tc_pack_t atfu_ ## tc ## _tc_pack = { \
+        .m_ident = #tc, \
+        .m_head = atfu_ ## tc ## _head, \
+        .m_body = atfu_ ## tc ## _body, \
+        .m_cleanup = atfu_ ## tc ## _cleanup, \
+    }
+
+#define ATF_TC_HEAD(tc, tcptr) \
+    static \
+    void \
+    atfu_ ## tc ## _head(atf_tc_t *tcptr ATF_DEFS_ATTRIBUTE_UNUSED)
+
+#define ATF_TC_HEAD_NAME(tc) \
+    (atfu_ ## tc ## _head)
+
+#define ATF_TC_BODY(tc, tcptr) \
+    static \
+    void \
+    atfu_ ## tc ## _body(const atf_tc_t *tcptr ATF_DEFS_ATTRIBUTE_UNUSED)
+
+#define ATF_TC_BODY_NAME(tc) \
+    (atfu_ ## tc ## _body)
+
+#define ATF_TC_CLEANUP(tc, tcptr) \
+    static \
+    void \
+    atfu_ ## tc ## _cleanup(const atf_tc_t *tcptr ATF_DEFS_ATTRIBUTE_UNUSED)
+
+#define ATF_TC_CLEANUP_NAME(tc) \
+    (atfu_ ## tc ## _cleanup)
+
+#define ATF_TP_ADD_TCS(tps) \
+    static atf_error_t atfu_tp_add_tcs(atf_tp_t *); \
+    int atf_tp_main(int, char **, atf_error_t (*)(atf_tp_t *)); \
+    \
+    int \
+    main(int argc, char **argv) \
+    { \
+        return atf_tp_main(argc, argv, atfu_tp_add_tcs); \
+    } \
+    static \
+    atf_error_t \
+    atfu_tp_add_tcs(atf_tp_t *tps)
+
+#define ATF_TP_ADD_TC(tp, tc) \
+    do { \
+        atf_error_t atfu_err; \
+        char **atfu_config = atf_tp_get_config(tp); \
+        if (atfu_config == NULL) \
+            return atf_no_memory_error(); \
+        atfu_err = atf_tc_init_pack(&atfu_ ## tc ## _tc, \
+                                    &atfu_ ## tc ## _tc_pack, \
+                                    (const char *const *)atfu_config); \
+        atf_utils_free_charpp(atfu_config); \
+        if (atf_is_error(atfu_err)) \
+            return atfu_err; \
+        atfu_err = atf_tp_add_tc(tp, &atfu_ ## tc ## _tc); \
+        if (atf_is_error(atfu_err)) \
+            return atfu_err; \
+    } while (0)
+
+#define ATF_REQUIRE_MSG(x, fmt, ...) \
+    do { \
+        if (!(x)) \
+            atf_tc_fail_requirement(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \
+    } while(0)
+
+#define ATF_CHECK_MSG(x, fmt, ...) \
+    do { \
+        if (!(x)) \
+            atf_tc_fail_check(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \
+    } while(0)
+
+#define ATF_REQUIRE(x) \
+    do { \
+        if (!(x)) \
+            atf_tc_fail_requirement(__FILE__, __LINE__, "%s", #x " not met"); \
+    } while(0)
+
+#define ATF_CHECK(x) \
+    do { \
+        if (!(x)) \
+            atf_tc_fail_check(__FILE__, __LINE__, "%s", #x " not met"); \
+    } while(0)
+
+#define ATF_REQUIRE_EQ(x, y) \
+    ATF_REQUIRE_MSG((x) == (y), "%s != %s", #x, #y)
+
+#define ATF_CHECK_EQ(x, y) \
+    ATF_CHECK_MSG((x) == (y), "%s != %s", #x, #y)
+
+#define ATF_REQUIRE_EQ_MSG(x, y, fmt, ...) \
+    ATF_REQUIRE_MSG((x) == (y), "%s != %s: " fmt, #x, #y, ##__VA_ARGS__)
+
+#define ATF_CHECK_EQ_MSG(x, y, fmt, ...) \
+    ATF_CHECK_MSG((x) == (y), "%s != %s: " fmt, #x, #y, ##__VA_ARGS__)
+
+#define ATF_REQUIRE_STREQ(x, y) \
+    ATF_REQUIRE_MSG(strcmp(x, y) == 0, "%s != %s (%s != %s)", #x, #y, x, y)
+
+#define ATF_CHECK_STREQ(x, y) \
+    ATF_CHECK_MSG(strcmp(x, y) == 0, "%s != %s (%s != %s)", #x, #y, x, y)
+
+#define ATF_REQUIRE_STREQ_MSG(x, y, fmt, ...) \
+    ATF_REQUIRE_MSG(strcmp(x, y) == 0, "%s != %s (%s != %s): " fmt, \
+                    #x, #y, x, y, ##__VA_ARGS__)
+
+#define ATF_CHECK_STREQ_MSG(x, y, fmt, ...) \
+    ATF_CHECK_MSG(strcmp(x, y) == 0, "%s != %s (%s != %s): " fmt, \
+                    #x, #y, x, y, ##__VA_ARGS__)
+
+#define ATF_REQUIRE_MATCH(regexp, string) \
+    ATF_REQUIRE_MSG(atf_utils_grep_string("%s", string, regexp), \
+                    "'%s' not matched in '%s'", regexp, string);
+
+#define ATF_CHECK_MATCH(regexp, string) \
+    ATF_CHECK_MSG(atf_utils_grep_string("%s", string, regexp), \
+                  "'%s' not matched in '%s'", regexp, string);
+
+#define ATF_REQUIRE_MATCH_MSG(regexp, string, fmt, ...) \
+    ATF_REQUIRE_MSG(atf_utils_grep_string("%s", string, regexp), \
+                    "'%s' not matched in '%s': " fmt, regexp, string, \
+                    ##__VA_ARGS__);
+
+#define ATF_CHECK_MATCH_MSG(regexp, string, fmt, ...) \
+    ATF_CHECK_MSG(atf_utils_grep_string("%s", string, regexp), \
+                  "'%s' not matched in '%s': " fmt, regexp, string, \
+                  ##__VA_ARGS__);
+
+#define ATF_CHECK_ERRNO(exp_errno, bool_expr) \
+    atf_tc_check_errno(__FILE__, __LINE__, exp_errno, #bool_expr, bool_expr)
+
+#define ATF_REQUIRE_ERRNO(exp_errno, bool_expr) \
+    atf_tc_require_errno(__FILE__, __LINE__, exp_errno, #bool_expr, bool_expr)
+
+#endif /* !defined(ATF_C_MACROS_H) */

Property changes on: lab4/.minix-src/include/atf-c/macros.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c/tc.h
===================================================================
--- lab4/.minix-src/include/atf-c/tc.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c/tc.h	(revision 13)
@@ -0,0 +1,141 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_TC_H)
+#define ATF_C_TC_H
+
+#include <stdbool.h>
+#include <stddef.h>
+
+#include <atf-c/defs.h>
+#include <atf-c/error_fwd.h>
+
+struct atf_tc;
+
+typedef void (*atf_tc_head_t)(struct atf_tc *);
+typedef void (*atf_tc_body_t)(const struct atf_tc *);
+typedef void (*atf_tc_cleanup_t)(const struct atf_tc *);
+
+/* ---------------------------------------------------------------------
+ * The "atf_tc_pack" type.
+ * --------------------------------------------------------------------- */
+
+/* For static initialization only. */
+struct atf_tc_pack {
+    const char *m_ident;
+
+    const char *const *m_config;
+
+    atf_tc_head_t m_head;
+    atf_tc_body_t m_body;
+    atf_tc_cleanup_t m_cleanup;
+};
+typedef const struct atf_tc_pack atf_tc_pack_t;
+
+/* ---------------------------------------------------------------------
+ * The "atf_tc" type.
+ * --------------------------------------------------------------------- */
+
+struct atf_tc_impl;
+struct atf_tc {
+    struct atf_tc_impl *pimpl;
+};
+typedef struct atf_tc atf_tc_t;
+
+/* Constructors/destructors. */
+atf_error_t atf_tc_init(atf_tc_t *, const char *, atf_tc_head_t,
+                        atf_tc_body_t, atf_tc_cleanup_t,
+                        const char *const *);
+atf_error_t atf_tc_init_pack(atf_tc_t *, atf_tc_pack_t *,
+                             const char *const *);
+void atf_tc_fini(atf_tc_t *);
+
+/* Getters. */
+const char *atf_tc_get_ident(const atf_tc_t *);
+const char *atf_tc_get_config_var(const atf_tc_t *, const char *);
+const char *atf_tc_get_config_var_wd(const atf_tc_t *, const char *,
+                                     const char *);
+bool atf_tc_get_config_var_as_bool(const atf_tc_t *, const char *);
+bool atf_tc_get_config_var_as_bool_wd(const atf_tc_t *, const char *,
+                                      const bool);
+long atf_tc_get_config_var_as_long(const atf_tc_t *, const char *);
+long atf_tc_get_config_var_as_long_wd(const atf_tc_t *, const char *,
+                                      const long);
+const char *atf_tc_get_md_var(const atf_tc_t *, const char *);
+char **atf_tc_get_md_vars(const atf_tc_t *);
+bool atf_tc_has_config_var(const atf_tc_t *, const char *);
+bool atf_tc_has_md_var(const atf_tc_t *, const char *);
+
+/* Modifiers. */
+atf_error_t atf_tc_set_md_var(atf_tc_t *, const char *, const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(3, 4);
+
+/* ---------------------------------------------------------------------
+ * Free functions.
+ * --------------------------------------------------------------------- */
+
+atf_error_t atf_tc_run(const atf_tc_t *, const char *);
+atf_error_t atf_tc_cleanup(const atf_tc_t *);
+
+/* To be run from test case bodies only. */
+void atf_tc_fail(const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(1, 2)
+    ATF_DEFS_ATTRIBUTE_NORETURN;
+void atf_tc_fail_nonfatal(const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(1, 2);
+void atf_tc_pass(void)
+    ATF_DEFS_ATTRIBUTE_NORETURN;
+void atf_tc_require_prog(const char *);
+void atf_tc_skip(const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(1, 2)
+    ATF_DEFS_ATTRIBUTE_NORETURN;
+void atf_tc_expect_pass(void);
+void atf_tc_expect_fail(const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(1, 2);
+void atf_tc_expect_exit(const int, const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(2, 3);
+void atf_tc_expect_signal(const int, const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(2, 3);
+void atf_tc_expect_death(const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(1, 2);
+void atf_tc_expect_timeout(const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(1, 2);
+
+/* To be run from test case bodies only; internal to macros.h. */
+void atf_tc_fail_check(const char *, const size_t, const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(3, 4);
+void atf_tc_fail_requirement(const char *, const size_t, const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(3, 4)
+    ATF_DEFS_ATTRIBUTE_NORETURN;
+void atf_tc_check_errno(const char *, const size_t, const int,
+                        const char *, const bool);
+void atf_tc_require_errno(const char *, const size_t, const int,
+                          const char *, const bool);
+
+#endif /* ATF_C_TC_H */

Property changes on: lab4/.minix-src/include/atf-c/tc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__undef___deallocate
===================================================================
--- lab4/.minix-src/include/c++/__undef___deallocate	(nonexistent)
+++ lab4/.minix-src/include/c++/__undef___deallocate	(revision 13)
@@ -0,0 +1,18 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef __deallocate
+#if defined(_MSC_VER) && !defined(__clang__)
+_LIBCPP_WARNING("macro __deallocate is incompatible with C++.  #undefining __deallocate")
+#else
+#warning: macro __deallocate is incompatible with C++.  #undefining __deallocate
+#endif
+#undef __deallocate
+#endif

Property changes on: lab4/.minix-src/include/c++/__undef___deallocate
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/array
===================================================================
--- lab4/.minix-src/include/c++/array	(nonexistent)
+++ lab4/.minix-src/include/c++/array	(revision 13)
@@ -0,0 +1,331 @@
+// -*- C++ -*-
+//===---------------------------- array -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_ARRAY
+#define _LIBCPP_ARRAY
+
+/*
+    array synopsis
+
+namespace std
+{
+template <class T, size_t N >
+struct array
+{
+    // types:
+    typedef T & reference;
+    typedef const T & const_reference;
+    typedef implementation defined iterator;
+    typedef implementation defined const_iterator;
+    typedef size_t size_type;
+    typedef ptrdiff_t difference_type;
+    typedef T value_type;
+    typedef T* pointer;
+    typedef const T* const_pointer;
+    typedef std::reverse_iterator<iterator> reverse_iterator;
+    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+    // No explicit construct/copy/destroy for aggregate type
+    void fill(const T& u);
+    void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
+
+    // iterators:
+    iterator begin() noexcept;
+    const_iterator begin() const noexcept;
+    iterator end() noexcept;
+    const_iterator end() const noexcept;
+
+    reverse_iterator rbegin() noexcept;
+    const_reverse_iterator rbegin() const noexcept;
+    reverse_iterator rend() noexcept;
+    const_reverse_iterator rend() const noexcept;
+
+    const_iterator cbegin() const noexcept;
+    const_iterator cend() const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    const_reverse_iterator crend() const noexcept;
+
+    // capacity:
+    constexpr size_type size() const noexcept;
+    constexpr size_type max_size() const noexcept;
+    constexpr bool empty() const noexcept;
+
+    // element access:
+    reference operator[](size_type n);
+    const_reference operator[](size_type n) const; // constexpr in C++14
+    const_reference at(size_type n) const; // constexpr in C++14
+    reference at(size_type n);
+
+    reference front();
+    const_reference front() const; // constexpr in C++14
+    reference back();
+    const_reference back() const; // constexpr in C++14
+
+    T* data() noexcept;
+    const T* data() const noexcept;
+};
+
+template <class T, size_t N>
+  bool operator==(const array<T,N>& x, const array<T,N>& y);
+template <class T, size_t N>
+  bool operator!=(const array<T,N>& x, const array<T,N>& y);
+template <class T, size_t N>
+  bool operator<(const array<T,N>& x, const array<T,N>& y);
+template <class T, size_t N>
+  bool operator>(const array<T,N>& x, const array<T,N>& y);
+template <class T, size_t N>
+  bool operator<=(const array<T,N>& x, const array<T,N>& y);
+template <class T, size_t N>
+  bool operator>=(const array<T,N>& x, const array<T,N>& y);
+
+template <class T, size_t N >
+  void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
+
+template <class T> class tuple_size;
+template <int I, class T> class tuple_element;
+template <class T, size_t N> struct tuple_size<array<T, N>>;
+template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
+template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
+template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
+template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
+
+}  // std
+
+*/
+
+#include <__config>
+#include <__tuple>
+#include <type_traits>
+#include <utility>
+#include <iterator>
+#include <algorithm>
+#include <stdexcept>
+#if defined(_LIBCPP_NO_EXCEPTIONS)
+    #include <cassert>
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, size_t _Size>
+struct _LIBCPP_TYPE_VIS_ONLY array
+{
+    // types:
+    typedef array __self;
+    typedef _Tp                                   value_type;
+    typedef value_type&                           reference;
+    typedef const value_type&                     const_reference;
+    typedef value_type*                           iterator;
+    typedef const value_type*                     const_iterator;
+    typedef value_type*                           pointer;
+    typedef const value_type*                     const_pointer;
+    typedef size_t                                size_type;
+    typedef ptrdiff_t                             difference_type;
+    typedef std::reverse_iterator<iterator>       reverse_iterator;
+    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+    value_type __elems_[_Size > 0 ? _Size : 1];
+
+    // No explicit construct/copy/destroy for aggregate type
+    _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
+        {_VSTD::fill_n(__elems_, _Size, __u);}
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
+        {_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
+
+    // iterators:
+    _LIBCPP_INLINE_VISIBILITY
+    iterator begin() _NOEXCEPT {return iterator(__elems_);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin() const _NOEXCEPT {return begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend() const _NOEXCEPT {return end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crend() const _NOEXCEPT {return rend();}
+
+    // capacity:
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
+
+    // element access:
+    _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n)             {return __elems_[__n];}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}
+    reference at(size_type __n);
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
+
+    _LIBCPP_INLINE_VISIBILITY reference front()             {return __elems_[0];}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
+    _LIBCPP_INLINE_VISIBILITY reference back()              {return __elems_[_Size > 0 ? _Size-1 : 0];}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const  {return __elems_[_Size > 0 ? _Size-1 : 0];}
+
+    _LIBCPP_INLINE_VISIBILITY
+    value_type* data() _NOEXCEPT {return __elems_;}
+    _LIBCPP_INLINE_VISIBILITY
+    const value_type* data() const _NOEXCEPT {return __elems_;}
+};
+
+template <class _Tp, size_t _Size>
+typename array<_Tp, _Size>::reference
+array<_Tp, _Size>::at(size_type __n)
+{
+    if (__n >= _Size)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("array::at");
+#else
+        assert(!"array::at out_of_range");
+#endif
+    return __elems_[__n];
+}
+
+template <class _Tp, size_t _Size>
+_LIBCPP_CONSTEXPR_AFTER_CXX11
+typename array<_Tp, _Size>::const_reference
+array<_Tp, _Size>::at(size_type __n) const
+{
+    if (__n >= _Size)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("array::at");
+#else
+        assert(!"array::at out_of_range");
+#endif
+    return __elems_[__n];
+}
+
+template <class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
+{
+    return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
+}
+
+template <class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
+{
+    return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
+}
+
+template <class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_swappable<_Tp>::value,
+    void
+>::type
+swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
+                                  _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
+{
+    __x.swap(__y);
+}
+
+template <class _Tp, size_t _Size>
+class _LIBCPP_TYPE_VIS_ONLY tuple_size<array<_Tp, _Size> >
+    : public integral_constant<size_t, _Size> {};
+
+template <size_t _Ip, class _Tp, size_t _Size>
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, array<_Tp, _Size> >
+{
+public:
+    typedef _Tp type;
+};
+
+template <size_t _Ip, class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp&
+get(array<_Tp, _Size>& __a) _NOEXCEPT
+{
+    static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
+    return __a.__elems_[_Ip];
+}
+
+template <size_t _Ip, class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Tp&
+get(const array<_Tp, _Size>& __a) _NOEXCEPT
+{
+    static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
+    return __a.__elems_[_Ip];
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <size_t _Ip, class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp&&
+get(array<_Tp, _Size>&& __a) _NOEXCEPT
+{
+    static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
+    return _VSTD::move(__a.__elems_[_Ip]);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_ARRAY

Property changes on: lab4/.minix-src/include/c++/array
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__undef_min_max
===================================================================
--- lab4/.minix-src/include/c++/__undef_min_max	(nonexistent)
+++ lab4/.minix-src/include/c++/__undef_min_max	(revision 13)
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef min
+#if defined(_MSC_VER) && ! defined(__clang__)
+_LIBCPP_WARNING("macro min is incompatible with C++.  Try #define NOMINMAX "
+                "before any Windows header. #undefing min")
+#else
+#warning: macro min is incompatible with C++.  #undefing min
+#endif
+#undef min
+#endif
+
+#ifdef max
+#if defined(_MSC_VER) && ! defined(__clang__)
+_LIBCPP_WARNING("macro max is incompatible with C++.  Try #define NOMINMAX "
+                "before any Windows header. #undefing max")
+#else
+#warning: macro max is incompatible with C++.  #undefing max
+#endif
+#undef max
+#endif

Property changes on: lab4/.minix-src/include/c++/__undef_min_max
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c/tp.h
===================================================================
--- lab4/.minix-src/include/atf-c/tp.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c/tp.h	(revision 13)
@@ -0,0 +1,69 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_TP_H)
+#define ATF_C_TP_H
+
+#include <stdbool.h>
+
+#include <atf-c/error_fwd.h>
+
+struct atf_tc;
+
+/* ---------------------------------------------------------------------
+ * The "atf_tp" type.
+ * --------------------------------------------------------------------- */
+
+struct atf_tp_impl;
+struct atf_tp {
+    struct atf_tp_impl *pimpl;
+};
+typedef struct atf_tp atf_tp_t;
+
+/* Constructors/destructors. */
+atf_error_t atf_tp_init(atf_tp_t *, const char *const *);
+void atf_tp_fini(atf_tp_t *);
+
+/* Getters. */
+char **atf_tp_get_config(const atf_tp_t *);
+bool atf_tp_has_tc(const atf_tp_t *, const char *);
+const struct atf_tc *atf_tp_get_tc(const atf_tp_t *, const char *);
+const struct atf_tc *const *atf_tp_get_tcs(const atf_tp_t *);
+
+/* Modifiers. */
+atf_error_t atf_tp_add_tc(atf_tp_t *, struct atf_tc *);
+
+/* ---------------------------------------------------------------------
+ * Free functions.
+ * --------------------------------------------------------------------- */
+
+atf_error_t atf_tp_run(const atf_tp_t *, const char *, const char *);
+atf_error_t atf_tp_cleanup(const atf_tp_t *, const char *);
+
+#endif /* ATF_C_TP_H */

Property changes on: lab4/.minix-src/include/atf-c/tp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/atomic
===================================================================
--- lab4/.minix-src/include/c++/atomic	(nonexistent)
+++ lab4/.minix-src/include/c++/atomic	(revision 13)
@@ -0,0 +1,1794 @@
+// -*- C++ -*-
+//===--------------------------- atomic -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_ATOMIC
+#define _LIBCPP_ATOMIC
+
+/*
+    atomic synopsis
+
+namespace std
+{
+
+// order and consistency
+
+typedef enum memory_order
+{
+    memory_order_relaxed,
+    memory_order_consume,  // load-consume
+    memory_order_acquire,  // load-acquire
+    memory_order_release,  // store-release
+    memory_order_acq_rel,  // store-release load-acquire
+    memory_order_seq_cst   // store-release load-acquire
+} memory_order;
+
+template <class T> T kill_dependency(T y) noexcept;
+
+// lock-free property
+
+#define ATOMIC_BOOL_LOCK_FREE unspecified
+#define ATOMIC_CHAR_LOCK_FREE unspecified
+#define ATOMIC_CHAR16_T_LOCK_FREE unspecified
+#define ATOMIC_CHAR32_T_LOCK_FREE unspecified
+#define ATOMIC_WCHAR_T_LOCK_FREE unspecified
+#define ATOMIC_SHORT_LOCK_FREE unspecified
+#define ATOMIC_INT_LOCK_FREE unspecified
+#define ATOMIC_LONG_LOCK_FREE unspecified
+#define ATOMIC_LLONG_LOCK_FREE unspecified
+#define ATOMIC_POINTER_LOCK_FREE unspecified
+
+// flag type and operations
+
+typedef struct atomic_flag
+{
+    bool test_and_set(memory_order m = memory_order_seq_cst) volatile noexcept;
+    bool test_and_set(memory_order m = memory_order_seq_cst) noexcept;
+    void clear(memory_order m = memory_order_seq_cst) volatile noexcept;
+    void clear(memory_order m = memory_order_seq_cst) noexcept;
+    atomic_flag()  noexcept = default;
+    atomic_flag(const atomic_flag&) = delete;
+    atomic_flag& operator=(const atomic_flag&) = delete;
+    atomic_flag& operator=(const atomic_flag&) volatile = delete;
+} atomic_flag;
+
+bool
+    atomic_flag_test_and_set(volatile atomic_flag* obj) noexcept;
+
+bool
+    atomic_flag_test_and_set(atomic_flag* obj) noexcept;
+
+bool
+    atomic_flag_test_and_set_explicit(volatile atomic_flag* obj,
+                                      memory_order m) noexcept;
+
+bool
+    atomic_flag_test_and_set_explicit(atomic_flag* obj, memory_order m) noexcept;
+
+void
+    atomic_flag_clear(volatile atomic_flag* obj) noexcept;
+
+void
+    atomic_flag_clear(atomic_flag* obj) noexcept;
+
+void
+    atomic_flag_clear_explicit(volatile atomic_flag* obj, memory_order m) noexcept;
+
+void
+    atomic_flag_clear_explicit(atomic_flag* obj, memory_order m) noexcept;
+
+#define ATOMIC_FLAG_INIT see below
+#define ATOMIC_VAR_INIT(value) see below
+
+template <class T>
+struct atomic
+{
+    bool is_lock_free() const volatile noexcept;
+    bool is_lock_free() const noexcept;
+    void store(T desr, memory_order m = memory_order_seq_cst) volatile noexcept;
+    void store(T desr, memory_order m = memory_order_seq_cst) noexcept;
+    T load(memory_order m = memory_order_seq_cst) const volatile noexcept;
+    T load(memory_order m = memory_order_seq_cst) const noexcept;
+    operator T() const volatile noexcept;
+    operator T() const noexcept;
+    T exchange(T desr, memory_order m = memory_order_seq_cst) volatile noexcept;
+    T exchange(T desr, memory_order m = memory_order_seq_cst) noexcept;
+    bool compare_exchange_weak(T& expc, T desr,
+                               memory_order s, memory_order f) volatile noexcept;
+    bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f) noexcept;
+    bool compare_exchange_strong(T& expc, T desr,
+                                 memory_order s, memory_order f) volatile noexcept;
+    bool compare_exchange_strong(T& expc, T desr,
+                                 memory_order s, memory_order f) noexcept;
+    bool compare_exchange_weak(T& expc, T desr,
+                               memory_order m = memory_order_seq_cst) volatile noexcept;
+    bool compare_exchange_weak(T& expc, T desr,
+                               memory_order m = memory_order_seq_cst) noexcept;
+    bool compare_exchange_strong(T& expc, T desr,
+                                memory_order m = memory_order_seq_cst) volatile noexcept;
+    bool compare_exchange_strong(T& expc, T desr,
+                                 memory_order m = memory_order_seq_cst) noexcept;
+
+    atomic() noexcept = default;
+    constexpr atomic(T desr) noexcept;
+    atomic(const atomic&) = delete;
+    atomic& operator=(const atomic&) = delete;
+    atomic& operator=(const atomic&) volatile = delete;
+    T operator=(T) volatile noexcept;
+    T operator=(T) noexcept;
+};
+
+template <>
+struct atomic<integral>
+{
+    bool is_lock_free() const volatile noexcept;
+    bool is_lock_free() const noexcept;
+    void store(integral desr, memory_order m = memory_order_seq_cst) volatile noexcept;
+    void store(integral desr, memory_order m = memory_order_seq_cst) noexcept;
+    integral load(memory_order m = memory_order_seq_cst) const volatile noexcept;
+    integral load(memory_order m = memory_order_seq_cst) const noexcept;
+    operator integral() const volatile noexcept;
+    operator integral() const noexcept;
+    integral exchange(integral desr,
+                      memory_order m = memory_order_seq_cst) volatile noexcept;
+    integral exchange(integral desr, memory_order m = memory_order_seq_cst) noexcept;
+    bool compare_exchange_weak(integral& expc, integral desr,
+                               memory_order s, memory_order f) volatile noexcept;
+    bool compare_exchange_weak(integral& expc, integral desr,
+                               memory_order s, memory_order f) noexcept;
+    bool compare_exchange_strong(integral& expc, integral desr,
+                                 memory_order s, memory_order f) volatile noexcept;
+    bool compare_exchange_strong(integral& expc, integral desr,
+                                 memory_order s, memory_order f) noexcept;
+    bool compare_exchange_weak(integral& expc, integral desr,
+                               memory_order m = memory_order_seq_cst) volatile noexcept;
+    bool compare_exchange_weak(integral& expc, integral desr,
+                               memory_order m = memory_order_seq_cst) noexcept;
+    bool compare_exchange_strong(integral& expc, integral desr,
+                                memory_order m = memory_order_seq_cst) volatile noexcept;
+    bool compare_exchange_strong(integral& expc, integral desr,
+                                 memory_order m = memory_order_seq_cst) noexcept;
+
+    integral
+        fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile noexcept;
+    integral fetch_add(integral op, memory_order m = memory_order_seq_cst) noexcept;
+    integral
+        fetch_sub(integral op, memory_order m = memory_order_seq_cst) volatile noexcept;
+    integral fetch_sub(integral op, memory_order m = memory_order_seq_cst) noexcept;
+    integral
+        fetch_and(integral op, memory_order m = memory_order_seq_cst) volatile noexcept;
+    integral fetch_and(integral op, memory_order m = memory_order_seq_cst) noexcept;
+    integral
+        fetch_or(integral op, memory_order m = memory_order_seq_cst) volatile noexcept;
+    integral fetch_or(integral op, memory_order m = memory_order_seq_cst) noexcept;
+    integral
+        fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile noexcept;
+    integral fetch_xor(integral op, memory_order m = memory_order_seq_cst) noexcept;
+
+    atomic() noexcept = default;
+    constexpr atomic(integral desr) noexcept;
+    atomic(const atomic&) = delete;
+    atomic& operator=(const atomic&) = delete;
+    atomic& operator=(const atomic&) volatile = delete;
+    integral operator=(integral desr) volatile noexcept;
+    integral operator=(integral desr) noexcept;
+
+    integral operator++(int) volatile noexcept;
+    integral operator++(int) noexcept;
+    integral operator--(int) volatile noexcept;
+    integral operator--(int) noexcept;
+    integral operator++() volatile noexcept;
+    integral operator++() noexcept;
+    integral operator--() volatile noexcept;
+    integral operator--() noexcept;
+    integral operator+=(integral op) volatile noexcept;
+    integral operator+=(integral op) noexcept;
+    integral operator-=(integral op) volatile noexcept;
+    integral operator-=(integral op) noexcept;
+    integral operator&=(integral op) volatile noexcept;
+    integral operator&=(integral op) noexcept;
+    integral operator|=(integral op) volatile noexcept;
+    integral operator|=(integral op) noexcept;
+    integral operator^=(integral op) volatile noexcept;
+    integral operator^=(integral op) noexcept;
+};
+
+template <class T>
+struct atomic<T*>
+{
+    bool is_lock_free() const volatile noexcept;
+    bool is_lock_free() const noexcept;
+    void store(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept;
+    void store(T* desr, memory_order m = memory_order_seq_cst) noexcept;
+    T* load(memory_order m = memory_order_seq_cst) const volatile noexcept;
+    T* load(memory_order m = memory_order_seq_cst) const noexcept;
+    operator T*() const volatile noexcept;
+    operator T*() const noexcept;
+    T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept;
+    T* exchange(T* desr, memory_order m = memory_order_seq_cst) noexcept;
+    bool compare_exchange_weak(T*& expc, T* desr,
+                               memory_order s, memory_order f) volatile noexcept;
+    bool compare_exchange_weak(T*& expc, T* desr,
+                               memory_order s, memory_order f) noexcept;
+    bool compare_exchange_strong(T*& expc, T* desr,
+                                 memory_order s, memory_order f) volatile noexcept;
+    bool compare_exchange_strong(T*& expc, T* desr,
+                                 memory_order s, memory_order f) noexcept;
+    bool compare_exchange_weak(T*& expc, T* desr,
+                               memory_order m = memory_order_seq_cst) volatile noexcept;
+    bool compare_exchange_weak(T*& expc, T* desr,
+                               memory_order m = memory_order_seq_cst) noexcept;
+    bool compare_exchange_strong(T*& expc, T* desr,
+                                memory_order m = memory_order_seq_cst) volatile noexcept;
+    bool compare_exchange_strong(T*& expc, T* desr,
+                                 memory_order m = memory_order_seq_cst) noexcept;
+    T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile noexcept;
+    T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) noexcept;
+    T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile noexcept;
+    T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) noexcept;
+
+    atomic() noexcept = default;
+    constexpr atomic(T* desr) noexcept;
+    atomic(const atomic&) = delete;
+    atomic& operator=(const atomic&) = delete;
+    atomic& operator=(const atomic&) volatile = delete;
+
+    T* operator=(T*) volatile noexcept;
+    T* operator=(T*) noexcept;
+    T* operator++(int) volatile noexcept;
+    T* operator++(int) noexcept;
+    T* operator--(int) volatile noexcept;
+    T* operator--(int) noexcept;
+    T* operator++() volatile noexcept;
+    T* operator++() noexcept;
+    T* operator--() volatile noexcept;
+    T* operator--() noexcept;
+    T* operator+=(ptrdiff_t op) volatile noexcept;
+    T* operator+=(ptrdiff_t op) noexcept;
+    T* operator-=(ptrdiff_t op) volatile noexcept;
+    T* operator-=(ptrdiff_t op) noexcept;
+};
+
+
+template <class T>
+    bool
+    atomic_is_lock_free(const volatile atomic<T>* obj) noexcept;
+
+template <class T>
+    bool
+    atomic_is_lock_free(const atomic<T>* obj) noexcept;
+
+template <class T>
+    void
+    atomic_init(volatile atomic<T>* obj, T desr) noexcept;
+
+template <class T>
+    void
+    atomic_init(atomic<T>* obj, T desr) noexcept;
+
+template <class T>
+    void
+    atomic_store(volatile atomic<T>* obj, T desr) noexcept;
+
+template <class T>
+    void
+    atomic_store(atomic<T>* obj, T desr) noexcept;
+
+template <class T>
+    void
+    atomic_store_explicit(volatile atomic<T>* obj, T desr, memory_order m) noexcept;
+
+template <class T>
+    void
+    atomic_store_explicit(atomic<T>* obj, T desr, memory_order m) noexcept;
+
+template <class T>
+    T
+    atomic_load(const volatile atomic<T>* obj) noexcept;
+
+template <class T>
+    T
+    atomic_load(const atomic<T>* obj) noexcept;
+
+template <class T>
+    T
+    atomic_load_explicit(const volatile atomic<T>* obj, memory_order m) noexcept;
+
+template <class T>
+    T
+    atomic_load_explicit(const atomic<T>* obj, memory_order m) noexcept;
+
+template <class T>
+    T
+    atomic_exchange(volatile atomic<T>* obj, T desr) noexcept;
+
+template <class T>
+    T
+    atomic_exchange(atomic<T>* obj, T desr) noexcept;
+
+template <class T>
+    T
+    atomic_exchange_explicit(volatile atomic<T>* obj, T desr, memory_order m) noexcept;
+
+template <class T>
+    T
+    atomic_exchange_explicit(atomic<T>* obj, T desr, memory_order m) noexcept;
+
+template <class T>
+    bool
+    atomic_compare_exchange_weak(volatile atomic<T>* obj, T* expc, T desr) noexcept;
+
+template <class T>
+    bool
+    atomic_compare_exchange_weak(atomic<T>* obj, T* expc, T desr) noexcept;
+
+template <class T>
+    bool
+    atomic_compare_exchange_strong(volatile atomic<T>* obj, T* expc, T desr) noexcept;
+
+template <class T>
+    bool
+    atomic_compare_exchange_strong(atomic<T>* obj, T* expc, T desr) noexcept;
+
+template <class T>
+    bool
+    atomic_compare_exchange_weak_explicit(volatile atomic<T>* obj, T* expc,
+                                          T desr,
+                                          memory_order s, memory_order f) noexcept;
+
+template <class T>
+    bool
+    atomic_compare_exchange_weak_explicit(atomic<T>* obj, T* expc, T desr,
+                                          memory_order s, memory_order f) noexcept;
+
+template <class T>
+    bool
+    atomic_compare_exchange_strong_explicit(volatile atomic<T>* obj,
+                                            T* expc, T desr,
+                                            memory_order s, memory_order f) noexcept;
+
+template <class T>
+    bool
+    atomic_compare_exchange_strong_explicit(atomic<T>* obj, T* expc,
+                                            T desr,
+                                            memory_order s, memory_order f) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_add(volatile atomic<Integral>* obj, Integral op) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_add(atomic<Integral>* obj, Integral op) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_add_explicit(volatile atomic<Integral>* obj, Integral op,
+                              memory_order m) noexcept;
+template <class Integral>
+    Integral
+    atomic_fetch_add_explicit(atomic<Integral>* obj, Integral op,
+                              memory_order m) noexcept;
+template <class Integral>
+    Integral
+    atomic_fetch_sub(volatile atomic<Integral>* obj, Integral op) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_sub(atomic<Integral>* obj, Integral op) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_sub_explicit(volatile atomic<Integral>* obj, Integral op,
+                              memory_order m) noexcept;
+template <class Integral>
+    Integral
+    atomic_fetch_sub_explicit(atomic<Integral>* obj, Integral op,
+                              memory_order m) noexcept;
+template <class Integral>
+    Integral
+    atomic_fetch_and(volatile atomic<Integral>* obj, Integral op) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_and(atomic<Integral>* obj, Integral op) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_and_explicit(volatile atomic<Integral>* obj, Integral op,
+                              memory_order m) noexcept;
+template <class Integral>
+    Integral
+    atomic_fetch_and_explicit(atomic<Integral>* obj, Integral op,
+                              memory_order m) noexcept;
+template <class Integral>
+    Integral
+    atomic_fetch_or(volatile atomic<Integral>* obj, Integral op) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_or(atomic<Integral>* obj, Integral op) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_or_explicit(volatile atomic<Integral>* obj, Integral op,
+                             memory_order m) noexcept;
+template <class Integral>
+    Integral
+    atomic_fetch_or_explicit(atomic<Integral>* obj, Integral op,
+                             memory_order m) noexcept;
+template <class Integral>
+    Integral
+    atomic_fetch_xor(volatile atomic<Integral>* obj, Integral op) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_xor(atomic<Integral>* obj, Integral op) noexcept;
+
+template <class Integral>
+    Integral
+    atomic_fetch_xor_explicit(volatile atomic<Integral>* obj, Integral op,
+                              memory_order m) noexcept;
+template <class Integral>
+    Integral
+    atomic_fetch_xor_explicit(atomic<Integral>* obj, Integral op,
+                              memory_order m) noexcept;
+
+template <class T>
+    T*
+    atomic_fetch_add(volatile atomic<T*>* obj, ptrdiff_t op) noexcept;
+
+template <class T>
+    T*
+    atomic_fetch_add(atomic<T*>* obj, ptrdiff_t op) noexcept;
+
+template <class T>
+    T*
+    atomic_fetch_add_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
+                              memory_order m) noexcept;
+template <class T>
+    T*
+    atomic_fetch_add_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m) noexcept;
+
+template <class T>
+    T*
+    atomic_fetch_sub(volatile atomic<T*>* obj, ptrdiff_t op) noexcept;
+
+template <class T>
+    T*
+    atomic_fetch_sub(atomic<T*>* obj, ptrdiff_t op) noexcept;
+
+template <class T>
+    T*
+    atomic_fetch_sub_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
+                              memory_order m) noexcept;
+template <class T>
+    T*
+    atomic_fetch_sub_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m) noexcept;
+
+// Atomics for standard typedef types
+
+typedef atomic<bool>               atomic_bool;
+typedef atomic<char>               atomic_char;
+typedef atomic<signed char>        atomic_schar;
+typedef atomic<unsigned char>      atomic_uchar;
+typedef atomic<short>              atomic_short;
+typedef atomic<unsigned short>     atomic_ushort;
+typedef atomic<int>                atomic_int;
+typedef atomic<unsigned int>       atomic_uint;
+typedef atomic<long>               atomic_long;
+typedef atomic<unsigned long>      atomic_ulong;
+typedef atomic<long long>          atomic_llong;
+typedef atomic<unsigned long long> atomic_ullong;
+typedef atomic<char16_t>           atomic_char16_t;
+typedef atomic<char32_t>           atomic_char32_t;
+typedef atomic<wchar_t>            atomic_wchar_t;
+
+typedef atomic<int_least8_t>   atomic_int_least8_t;
+typedef atomic<uint_least8_t>  atomic_uint_least8_t;
+typedef atomic<int_least16_t>  atomic_int_least16_t;
+typedef atomic<uint_least16_t> atomic_uint_least16_t;
+typedef atomic<int_least32_t>  atomic_int_least32_t;
+typedef atomic<uint_least32_t> atomic_uint_least32_t;
+typedef atomic<int_least64_t>  atomic_int_least64_t;
+typedef atomic<uint_least64_t> atomic_uint_least64_t;
+
+typedef atomic<int_fast8_t>   atomic_int_fast8_t;
+typedef atomic<uint_fast8_t>  atomic_uint_fast8_t;
+typedef atomic<int_fast16_t>  atomic_int_fast16_t;
+typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
+typedef atomic<int_fast32_t>  atomic_int_fast32_t;
+typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
+typedef atomic<int_fast64_t>  atomic_int_fast64_t;
+typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
+
+typedef atomic<intptr_t>  atomic_intptr_t;
+typedef atomic<uintptr_t> atomic_uintptr_t;
+typedef atomic<size_t>    atomic_size_t;
+typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
+typedef atomic<intmax_t>  atomic_intmax_t;
+typedef atomic<uintmax_t> atomic_uintmax_t;
+
+// fences
+
+void atomic_thread_fence(memory_order m) noexcept;
+void atomic_signal_fence(memory_order m) noexcept;
+
+}  // std
+
+*/
+
+#include <__config>
+#include <cstddef>
+#include <cstdint>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error <atomic> is not supported on this single threaded system
+#endif
+#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
+#error <atomic> is not implemented
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+typedef enum memory_order
+{
+    memory_order_relaxed, memory_order_consume, memory_order_acquire,
+    memory_order_release, memory_order_acq_rel, memory_order_seq_cst
+} memory_order;
+
+#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
+namespace __gcc_atomic {
+template <typename _Tp>
+struct __gcc_atomic_t {
+  __gcc_atomic_t() _NOEXCEPT {}
+  _LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT
+    : __a_value(value) {}
+  _Tp __a_value;
+};
+#define _Atomic(x) __gcc_atomic::__gcc_atomic_t<x>
+
+template <typename _Tp> _Tp __create();
+
+template <typename _Tp, typename _Td>
+typename enable_if<sizeof(_Tp()->__a_value = __create<_Td>()), char>::type
+    __test_atomic_assignable(int);
+template <typename _Tp, typename _Up>
+__two __test_atomic_assignable(...);
+
+template <typename _Tp, typename _Td>
+struct __can_assign {
+  static const bool value =
+      sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
+};
+
+static inline constexpr int __to_gcc_order(memory_order __order) {
+  // Avoid switch statement to make this a constexpr.
+  return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
+         (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
+          (__order == memory_order_release ? __ATOMIC_RELEASE:
+           (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST:
+            (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL:
+              __ATOMIC_CONSUME))));
+}
+
+static inline constexpr int __to_gcc_failure_order(memory_order __order) {
+  // Avoid switch statement to make this a constexpr.
+  return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
+         (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
+          (__order == memory_order_release ? __ATOMIC_RELAXED:
+           (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST:
+            (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE:
+              __ATOMIC_CONSUME))));
+}
+
+} // namespace __gcc_atomic
+
+template <typename _Tp>
+static inline
+typename enable_if<
+    __gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value>::type
+__c11_atomic_init(volatile _Atomic(_Tp)* __a,  _Tp __val) {
+  __a->__a_value = __val;
+}
+
+template <typename _Tp>
+static inline
+typename enable_if<
+    !__gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value &&
+     __gcc_atomic::__can_assign<         _Atomic(_Tp)*, _Tp>::value>::type
+__c11_atomic_init(volatile _Atomic(_Tp)* __a,  _Tp __val) {
+  // [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
+  // the default operator= in an object is not volatile, a byte-by-byte copy
+  // is required.
+  volatile char* to = reinterpret_cast<volatile char*>(&__a->__a_value);
+  volatile char* end = to + sizeof(_Tp);
+  char* from = reinterpret_cast<char*>(&__val);
+  while (to != end) {
+    *to++ = *from++;
+  }
+}
+
+template <typename _Tp>
+static inline void __c11_atomic_init(_Atomic(_Tp)* __a,  _Tp __val) {
+  __a->__a_value = __val;
+}
+
+static inline void __c11_atomic_thread_fence(memory_order __order) {
+  __atomic_thread_fence(__gcc_atomic::__to_gcc_order(__order));
+}
+
+static inline void __c11_atomic_signal_fence(memory_order __order) {
+  __atomic_signal_fence(__gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp>
+static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a,  _Tp __val,
+                                      memory_order __order) {
+  return __atomic_store(&__a->__a_value, &__val,
+                        __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp>
+static inline void __c11_atomic_store(_Atomic(_Tp)* __a,  _Tp __val,
+                                      memory_order __order) {
+  __atomic_store(&__a->__a_value, &__val,
+                 __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_load(volatile _Atomic(_Tp)* __a,
+                                    memory_order __order) {
+  _Tp __ret;
+  __atomic_load(&__a->__a_value, &__ret,
+                __gcc_atomic::__to_gcc_order(__order));
+  return __ret;
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_load(_Atomic(_Tp)* __a, memory_order __order) {
+  _Tp __ret;
+  __atomic_load(&__a->__a_value, &__ret,
+                __gcc_atomic::__to_gcc_order(__order));
+  return __ret;
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_exchange(volatile _Atomic(_Tp)* __a,
+                                        _Tp __value, memory_order __order) {
+  _Tp __ret;
+  __atomic_exchange(&__a->__a_value, &__value, &__ret,
+                    __gcc_atomic::__to_gcc_order(__order));
+  return __ret;
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_exchange(_Atomic(_Tp)* __a, _Tp __value,
+                                        memory_order __order) {
+  _Tp __ret;
+  __atomic_exchange(&__a->__a_value, &__value, &__ret,
+                    __gcc_atomic::__to_gcc_order(__order));
+  return __ret;
+}
+
+template <typename _Tp>
+static inline bool __c11_atomic_compare_exchange_strong(
+    volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
+    memory_order __success, memory_order __failure) {
+  return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
+                                   false,
+                                   __gcc_atomic::__to_gcc_order(__success),
+                                   __gcc_atomic::__to_gcc_failure_order(__failure));
+}
+
+template <typename _Tp>
+static inline bool __c11_atomic_compare_exchange_strong(
+    _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success,
+    memory_order __failure) {
+  return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
+                                   false,
+                                   __gcc_atomic::__to_gcc_order(__success),
+                                   __gcc_atomic::__to_gcc_failure_order(__failure));
+}
+
+template <typename _Tp>
+static inline bool __c11_atomic_compare_exchange_weak(
+    volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
+    memory_order __success, memory_order __failure) {
+  return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
+                                   true,
+                                   __gcc_atomic::__to_gcc_order(__success),
+                                   __gcc_atomic::__to_gcc_failure_order(__failure));
+}
+
+template <typename _Tp>
+static inline bool __c11_atomic_compare_exchange_weak(
+    _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success,
+    memory_order __failure) {
+  return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
+                                   true,
+                                   __gcc_atomic::__to_gcc_order(__success),
+                                   __gcc_atomic::__to_gcc_failure_order(__failure));
+}
+
+template <typename _Tp>
+struct __skip_amt { enum {value = 1}; };
+
+template <typename _Tp>
+struct __skip_amt<_Tp*> { enum {value = sizeof(_Tp)}; };
+
+// FIXME: Haven't figured out what the spec says about using arrays with
+// atomic_fetch_add. Force a failure rather than creating bad behavior.
+template <typename _Tp>
+struct __skip_amt<_Tp[]> { };
+template <typename _Tp, int n>
+struct __skip_amt<_Tp[n]> { };
+
+template <typename _Tp, typename _Td>
+static inline _Tp __c11_atomic_fetch_add(volatile _Atomic(_Tp)* __a,
+                                         _Td __delta, memory_order __order) {
+  return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
+                            __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp, typename _Td>
+static inline _Tp __c11_atomic_fetch_add(_Atomic(_Tp)* __a, _Td __delta,
+                                         memory_order __order) {
+  return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
+                            __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp, typename _Td>
+static inline _Tp __c11_atomic_fetch_sub(volatile _Atomic(_Tp)* __a,
+                                         _Td __delta, memory_order __order) {
+  return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
+                            __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp, typename _Td>
+static inline _Tp __c11_atomic_fetch_sub(_Atomic(_Tp)* __a, _Td __delta,
+                                         memory_order __order) {
+  return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
+                            __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_and(volatile _Atomic(_Tp)* __a,
+                                         _Tp __pattern, memory_order __order) {
+  return __atomic_fetch_and(&__a->__a_value, __pattern,
+                            __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_and(_Atomic(_Tp)* __a,
+                                         _Tp __pattern, memory_order __order) {
+  return __atomic_fetch_and(&__a->__a_value, __pattern,
+                            __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_or(volatile _Atomic(_Tp)* __a,
+                                        _Tp __pattern, memory_order __order) {
+  return __atomic_fetch_or(&__a->__a_value, __pattern,
+                           __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_or(_Atomic(_Tp)* __a, _Tp __pattern,
+                                        memory_order __order) {
+  return __atomic_fetch_or(&__a->__a_value, __pattern,
+                           __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_xor(volatile _Atomic(_Tp)* __a,
+                                         _Tp __pattern, memory_order __order) {
+  return __atomic_fetch_xor(&__a->__a_value, __pattern,
+                            __gcc_atomic::__to_gcc_order(__order));
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a, _Tp __pattern,
+                                         memory_order __order) {
+  return __atomic_fetch_xor(&__a->__a_value, __pattern,
+                            __gcc_atomic::__to_gcc_order(__order));
+}
+#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+kill_dependency(_Tp __y) _NOEXCEPT
+{
+    return __y;
+}
+
+// general atomic<T>
+
+template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
+struct __atomic_base  // false
+{
+    mutable _Atomic(_Tp) __a_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool is_lock_free() const volatile _NOEXCEPT
+    {
+#if defined(_LIBCPP_HAS_C_ATOMIC_IMP)
+    return __c11_atomic_is_lock_free(sizeof(_Tp));
+#else
+    return __atomic_is_lock_free(sizeof(_Tp), 0);
+#endif
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    bool is_lock_free() const _NOEXCEPT
+        {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}
+    _LIBCPP_INLINE_VISIBILITY
+    void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {__c11_atomic_store(&__a_, __d, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {__c11_atomic_store(&__a_, __d, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
+        {return __c11_atomic_load(&__a_, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
+        {return __c11_atomic_load(&__a_, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    operator _Tp() const volatile _NOEXCEPT {return load();}
+    _LIBCPP_INLINE_VISIBILITY
+    operator _Tp() const _NOEXCEPT          {return load();}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {return __c11_atomic_exchange(&__a_, __d, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_exchange(&__a_, __d, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool compare_exchange_weak(_Tp& __e, _Tp __d,
+                               memory_order __s, memory_order __f) volatile _NOEXCEPT
+        {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool compare_exchange_weak(_Tp& __e, _Tp __d,
+                               memory_order __s, memory_order __f) _NOEXCEPT
+        {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool compare_exchange_strong(_Tp& __e, _Tp __d,
+                                 memory_order __s, memory_order __f) volatile _NOEXCEPT
+        {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool compare_exchange_strong(_Tp& __e, _Tp __d,
+                                 memory_order __s, memory_order __f) _NOEXCEPT
+        {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool compare_exchange_weak(_Tp& __e, _Tp __d,
+                              memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool compare_exchange_weak(_Tp& __e, _Tp __d,
+                               memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool compare_exchange_strong(_Tp& __e, _Tp __d,
+                              memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool compare_exchange_strong(_Tp& __e, _Tp __d,
+                                 memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
+
+    _LIBCPP_INLINE_VISIBILITY
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+    __atomic_base() _NOEXCEPT = default;
+#else
+    __atomic_base() _NOEXCEPT : __a_() {}
+#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+    __atomic_base(const __atomic_base&) = delete;
+    __atomic_base& operator=(const __atomic_base&) = delete;
+    __atomic_base& operator=(const __atomic_base&) volatile = delete;
+#else  // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+private:
+    __atomic_base(const __atomic_base&);
+    __atomic_base& operator=(const __atomic_base&);
+    __atomic_base& operator=(const __atomic_base&) volatile;
+#endif  // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+};
+
+// atomic<Integral>
+
+template <class _Tp>
+struct __atomic_base<_Tp, true>
+    : public __atomic_base<_Tp, false>
+{
+    typedef __atomic_base<_Tp, false> __base;
+    _LIBCPP_INLINE_VISIBILITY
+    __atomic_base() _NOEXCEPT _LIBCPP_DEFAULT
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {return __c11_atomic_fetch_and(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_fetch_and(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {return __c11_atomic_fetch_or(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_fetch_or(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator++(int) volatile _NOEXCEPT      {return fetch_add(_Tp(1));}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator++(int) _NOEXCEPT               {return fetch_add(_Tp(1));}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator--(int) volatile _NOEXCEPT      {return fetch_sub(_Tp(1));}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator--(int) _NOEXCEPT               {return fetch_sub(_Tp(1));}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator++() volatile _NOEXCEPT         {return fetch_add(_Tp(1)) + _Tp(1);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator++() _NOEXCEPT                  {return fetch_add(_Tp(1)) + _Tp(1);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator--() volatile _NOEXCEPT         {return fetch_sub(_Tp(1)) - _Tp(1);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator--() _NOEXCEPT                  {return fetch_sub(_Tp(1)) - _Tp(1);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator+=(_Tp __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator+=(_Tp __op) _NOEXCEPT          {return fetch_add(__op) + __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator-=(_Tp __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator-=(_Tp __op) _NOEXCEPT          {return fetch_sub(__op) - __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator&=(_Tp __op) volatile _NOEXCEPT {return fetch_and(__op) & __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator&=(_Tp __op) _NOEXCEPT          {return fetch_and(__op) & __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator|=(_Tp __op) volatile _NOEXCEPT {return fetch_or(__op) | __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator|=(_Tp __op) _NOEXCEPT          {return fetch_or(__op) | __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator^=(_Tp __op) volatile _NOEXCEPT {return fetch_xor(__op) ^ __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator^=(_Tp __op) _NOEXCEPT          {return fetch_xor(__op) ^ __op;}
+};
+
+// atomic<T>
+
+template <class _Tp>
+struct atomic
+    : public __atomic_base<_Tp>
+{
+    typedef __atomic_base<_Tp> __base;
+    _LIBCPP_INLINE_VISIBILITY
+    atomic() _NOEXCEPT _LIBCPP_DEFAULT
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator=(_Tp __d) volatile _NOEXCEPT
+        {__base::store(__d); return __d;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator=(_Tp __d) _NOEXCEPT
+        {__base::store(__d); return __d;}
+};
+
+// atomic<T*>
+
+template <class _Tp>
+struct atomic<_Tp*>
+    : public __atomic_base<_Tp*>
+{
+    typedef __atomic_base<_Tp*> __base;
+    _LIBCPP_INLINE_VISIBILITY
+    atomic() _NOEXCEPT _LIBCPP_DEFAULT
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator=(_Tp* __d) volatile _NOEXCEPT
+        {__base::store(__d); return __d;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator=(_Tp* __d) _NOEXCEPT
+        {__base::store(__d); return __d;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
+                                                                        volatile _NOEXCEPT
+        {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
+                                                                        volatile _NOEXCEPT
+        {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator++(int) volatile _NOEXCEPT            {return fetch_add(1);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator++(int) _NOEXCEPT                     {return fetch_add(1);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator--(int) volatile _NOEXCEPT            {return fetch_sub(1);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator--(int) _NOEXCEPT                     {return fetch_sub(1);}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator++() volatile _NOEXCEPT               {return fetch_add(1) + 1;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator++() _NOEXCEPT                        {return fetch_add(1) + 1;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator--() volatile _NOEXCEPT               {return fetch_sub(1) - 1;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator--() _NOEXCEPT                        {return fetch_sub(1) - 1;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator+=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator+=(ptrdiff_t __op) _NOEXCEPT          {return fetch_add(__op) + __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator-=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;}
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* operator-=(ptrdiff_t __op) _NOEXCEPT          {return fetch_sub(__op) - __op;}
+};
+
+// atomic_is_lock_free
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT
+{
+    return __o->is_lock_free();
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
+{
+    return __o->is_lock_free();
+}
+
+// atomic_init
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
+{
+    __c11_atomic_init(&__o->__a_, __d);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
+{
+    __c11_atomic_init(&__o->__a_, __d);
+}
+
+// atomic_store
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
+{
+    __o->store(__d);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
+{
+    __o->store(__d);
+}
+
+// atomic_store_explicit
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
+{
+    __o->store(__d, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
+{
+    __o->store(__d, __m);
+}
+
+// atomic_load
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT
+{
+    return __o->load();
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+atomic_load(const atomic<_Tp>* __o) _NOEXCEPT
+{
+    return __o->load();
+}
+
+// atomic_load_explicit
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
+{
+    return __o->load(__m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
+{
+    return __o->load(__m);
+}
+
+// atomic_exchange
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
+{
+    return __o->exchange(__d);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
+{
+    return __o->exchange(__d);
+}
+
+// atomic_exchange_explicit
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
+{
+    return __o->exchange(__d, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
+{
+    return __o->exchange(__d, __m);
+}
+
+// atomic_compare_exchange_weak
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
+{
+    return __o->compare_exchange_weak(*__e, __d);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
+{
+    return __o->compare_exchange_weak(*__e, __d);
+}
+
+// atomic_compare_exchange_strong
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
+{
+    return __o->compare_exchange_strong(*__e, __d);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
+{
+    return __o->compare_exchange_strong(*__e, __d);
+}
+
+// atomic_compare_exchange_weak_explicit
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
+                                      _Tp __d,
+                                      memory_order __s, memory_order __f) _NOEXCEPT
+{
+    return __o->compare_exchange_weak(*__e, __d, __s, __f);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
+                                      memory_order __s, memory_order __f) _NOEXCEPT
+{
+    return __o->compare_exchange_weak(*__e, __d, __s, __f);
+}
+
+// atomic_compare_exchange_strong_explicit
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
+                                        _Tp* __e, _Tp __d,
+                                        memory_order __s, memory_order __f) _NOEXCEPT
+{
+    return __o->compare_exchange_strong(*__e, __d, __s, __f);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
+                                        _Tp __d,
+                                        memory_order __s, memory_order __f) _NOEXCEPT
+{
+    return __o->compare_exchange_strong(*__e, __d, __s, __f);
+}
+
+// atomic_fetch_add
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
+{
+    return __o->fetch_add(__op);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
+{
+    return __o->fetch_add(__op);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
+{
+    return __o->fetch_add(__op);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
+{
+    return __o->fetch_add(__op);
+}
+
+// atomic_fetch_add_explicit
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_add(__op, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_add(__op, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
+                          memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_add(__op, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_add(__op, __m);
+}
+
+// atomic_fetch_sub
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
+{
+    return __o->fetch_sub(__op);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
+{
+    return __o->fetch_sub(__op);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
+{
+    return __o->fetch_sub(__op);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
+{
+    return __o->fetch_sub(__op);
+}
+
+// atomic_fetch_sub_explicit
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_sub(__op, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_sub(__op, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
+                          memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_sub(__op, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_sub(__op, __m);
+}
+
+// atomic_fetch_and
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
+{
+    return __o->fetch_and(__op);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
+{
+    return __o->fetch_and(__op);
+}
+
+// atomic_fetch_and_explicit
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_and(__op, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_and(__op, __m);
+}
+
+// atomic_fetch_or
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
+{
+    return __o->fetch_or(__op);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
+{
+    return __o->fetch_or(__op);
+}
+
+// atomic_fetch_or_explicit
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_or(__op, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_or(__op, __m);
+}
+
+// atomic_fetch_xor
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
+{
+    return __o->fetch_xor(__op);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
+{
+    return __o->fetch_xor(__op);
+}
+
+// atomic_fetch_xor_explicit
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_xor(__op, __m);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
+    _Tp
+>::type
+atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
+{
+    return __o->fetch_xor(__op, __m);
+}
+
+// flag type and operations
+
+typedef struct atomic_flag
+{
+    _Atomic(bool) __a_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {return __c11_atomic_exchange(&__a_, true, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {return __c11_atomic_exchange(&__a_, true, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+        {__c11_atomic_store(&__a_, false, __m);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT
+        {__c11_atomic_store(&__a_, false, __m);}
+
+    _LIBCPP_INLINE_VISIBILITY
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+    atomic_flag() _NOEXCEPT = default;
+#else
+    atomic_flag() _NOEXCEPT : __a_() {}
+#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+
+    _LIBCPP_INLINE_VISIBILITY
+    atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {}
+
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+    atomic_flag(const atomic_flag&) = delete;
+    atomic_flag& operator=(const atomic_flag&) = delete;
+    atomic_flag& operator=(const atomic_flag&) volatile = delete;
+#else  // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+private:
+    atomic_flag(const atomic_flag&);
+    atomic_flag& operator=(const atomic_flag&);
+    atomic_flag& operator=(const atomic_flag&) volatile;
+#endif  // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+} atomic_flag;
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_flag_test_and_set(volatile atomic_flag* __o) _NOEXCEPT
+{
+    return __o->test_and_set();
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_flag_test_and_set(atomic_flag* __o) _NOEXCEPT
+{
+    return __o->test_and_set();
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT
+{
+    return __o->test_and_set(__m);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT
+{
+    return __o->test_and_set(__m);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_flag_clear(volatile atomic_flag* __o) _NOEXCEPT
+{
+    __o->clear();
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_flag_clear(atomic_flag* __o) _NOEXCEPT
+{
+    __o->clear();
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT
+{
+    __o->clear(__m);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT
+{
+    __o->clear(__m);
+}
+
+// fences
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_thread_fence(memory_order __m) _NOEXCEPT
+{
+    __c11_atomic_thread_fence(__m);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_signal_fence(memory_order __m) _NOEXCEPT
+{
+    __c11_atomic_signal_fence(__m);
+}
+
+// Atomics for standard typedef types
+
+typedef atomic<bool>               atomic_bool;
+typedef atomic<char>               atomic_char;
+typedef atomic<signed char>        atomic_schar;
+typedef atomic<unsigned char>      atomic_uchar;
+typedef atomic<short>              atomic_short;
+typedef atomic<unsigned short>     atomic_ushort;
+typedef atomic<int>                atomic_int;
+typedef atomic<unsigned int>       atomic_uint;
+typedef atomic<long>               atomic_long;
+typedef atomic<unsigned long>      atomic_ulong;
+typedef atomic<long long>          atomic_llong;
+typedef atomic<unsigned long long> atomic_ullong;
+typedef atomic<char16_t>           atomic_char16_t;
+typedef atomic<char32_t>           atomic_char32_t;
+typedef atomic<wchar_t>            atomic_wchar_t;
+
+typedef atomic<int_least8_t>   atomic_int_least8_t;
+typedef atomic<uint_least8_t>  atomic_uint_least8_t;
+typedef atomic<int_least16_t>  atomic_int_least16_t;
+typedef atomic<uint_least16_t> atomic_uint_least16_t;
+typedef atomic<int_least32_t>  atomic_int_least32_t;
+typedef atomic<uint_least32_t> atomic_uint_least32_t;
+typedef atomic<int_least64_t>  atomic_int_least64_t;
+typedef atomic<uint_least64_t> atomic_uint_least64_t;
+
+typedef atomic<int_fast8_t>   atomic_int_fast8_t;
+typedef atomic<uint_fast8_t>  atomic_uint_fast8_t;
+typedef atomic<int_fast16_t>  atomic_int_fast16_t;
+typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
+typedef atomic<int_fast32_t>  atomic_int_fast32_t;
+typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
+typedef atomic<int_fast64_t>  atomic_int_fast64_t;
+typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
+
+typedef atomic<intptr_t>  atomic_intptr_t;
+typedef atomic<uintptr_t> atomic_uintptr_t;
+typedef atomic<size_t>    atomic_size_t;
+typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
+typedef atomic<intmax_t>  atomic_intmax_t;
+typedef atomic<uintmax_t> atomic_uintmax_t;
+
+#define ATOMIC_FLAG_INIT {false}
+#define ATOMIC_VAR_INIT(__v) {__v}
+
+#define ATOMIC_BOOL_LOCK_FREE      __GCC_ATOMIC_BOOL_LOCK_FREE
+#define ATOMIC_CHAR_LOCK_FREE      __GCC_ATOMIC_CHAR_LOCK_FREE
+#define ATOMIC_CHAR16_T_LOCK_FREE  __GCC_ATOMIC_CHAR16_T_LOCK_FREE
+#define ATOMIC_CHAR32_T_LOCK_FREE  __GCC_ATOMIC_CHAR32_T_LOCK_FREE
+#define ATOMIC_WCHAR_T_LOCK_FREE   __GCC_ATOMIC_WCHAR_T_LOCK_FREE
+#define ATOMIC_SHORT_LOCK_FREE     __GCC_ATOMIC_SHORT_LOCK_FREE
+#define ATOMIC_INT_LOCK_FREE       __GCC_ATOMIC_INT_LOCK_FREE
+#define ATOMIC_LONG_LOCK_FREE      __GCC_ATOMIC_LONG_LOCK_FREE
+#define ATOMIC_LLONG_LOCK_FREE     __GCC_ATOMIC_LLONG_LOCK_FREE
+#define ATOMIC_POINTER_LOCK_FREE   __GCC_ATOMIC_POINTER_LOCK_FREE
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_ATOMIC

Property changes on: lab4/.minix-src/include/c++/atomic
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c/utils.h
===================================================================
--- lab4/.minix-src/include/atf-c/utils.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c/utils.h	(revision 13)
@@ -0,0 +1,54 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_UTILS_H)
+#define ATF_C_UTILS_H
+
+#include <stdbool.h>
+#include <unistd.h>
+
+#include <atf-c/defs.h>
+
+void atf_utils_cat_file(const char *, const char *);
+bool atf_utils_compare_file(const char *, const char *);
+void atf_utils_copy_file(const char *, const char *);
+void atf_utils_create_file(const char *, const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(2, 3);
+bool atf_utils_file_exists(const char *);
+pid_t atf_utils_fork(void);
+void atf_utils_free_charpp(char **);
+bool atf_utils_grep_file(const char *, const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(1, 3);
+bool atf_utils_grep_string(const char *, const char *, ...)
+    ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(1, 3);
+char *atf_utils_readline(int);
+void atf_utils_redirect(const int, const char *);
+void atf_utils_wait(const pid_t, const int, const char *, const char *);
+
+#endif /* ATF_C_UTILS_H */

Property changes on: lab4/.minix-src/include/atf-c/utils.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c++/build.hpp
===================================================================
--- lab4/.minix-src/include/atf-c++/build.hpp	(nonexistent)
+++ lab4/.minix-src/include/atf-c++/build.hpp	(revision 13)
@@ -0,0 +1,57 @@
+//
+// Automated Testing Framework (atf)
+//
+// Copyright (c) 2009 The NetBSD Foundation, Inc.
+// 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 NETBSD FOUNDATION, INC. AND
+// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#if !defined(_ATF_CXX_BUILD_HPP_)
+#define _ATF_CXX_BUILD_HPP_
+
+#include <string>
+
+namespace atf {
+
+namespace process {
+class argv_array;
+} // namespace process
+
+namespace build {
+
+// ------------------------------------------------------------------------
+// Free functions.
+// ------------------------------------------------------------------------
+
+process::argv_array c_o(const std::string&, const std::string&,
+                        const process::argv_array&);
+process::argv_array cpp(const std::string&, const std::string&,
+                        const process::argv_array&);
+process::argv_array cxx_o(const std::string&, const std::string&,
+                          const process::argv_array&);
+
+} // namespace build
+} // namespace atf
+
+#endif // !defined(_ATF_CXX_BUILD_HPP_)

Property changes on: lab4/.minix-src/include/atf-c++/build.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cassert
===================================================================
--- lab4/.minix-src/include/c++/cassert	(nonexistent)
+++ lab4/.minix-src/include/c++/cassert	(revision 13)
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===-------------------------- cassert -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+/*
+    cassert synopsis
+
+Macros:
+
+    assert
+
+*/
+
+#include <__config>
+#include <assert.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif

Property changes on: lab4/.minix-src/include/c++/cassert
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cerrno
===================================================================
--- lab4/.minix-src/include/c++/cerrno	(nonexistent)
+++ lab4/.minix-src/include/c++/cerrno	(revision 13)
@@ -0,0 +1,393 @@
+// -*- C++ -*-
+//===-------------------------- cerrno ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CERRNO
+#define _LIBCPP_CERRNO
+
+/*
+    cerrno synopsis
+
+Macros:
+
+    EDOM
+    EILSEQ  // C99
+    ERANGE
+    errno
+
+*/
+
+#include <__config>
+#include <errno.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+
+#ifdef ELAST
+
+const int __elast1 = ELAST+1;
+const int __elast2 = ELAST+2;
+
+#else
+
+const int __elast1 = 104;
+const int __elast2 = 105;
+
+#endif
+
+#ifdef ENOTRECOVERABLE
+
+#define EOWNERDEAD __elast1
+
+#ifdef ELAST
+#undef ELAST
+#define ELAST EOWNERDEAD
+#endif
+
+#elif defined(EOWNERDEAD)
+
+#define ENOTRECOVERABLE __elast1
+#ifdef ELAST
+#undef ELAST
+#define ELAST ENOTRECOVERABLE
+#endif
+
+#else  // defined(EOWNERDEAD)
+
+#define EOWNERDEAD __elast1
+#define ENOTRECOVERABLE __elast2
+#ifdef ELAST
+#undef ELAST
+#define ELAST ENOTRECOVERABLE
+#endif
+
+#endif  // defined(EOWNERDEAD)
+
+#endif  // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+
+//  supply errno values likely to be missing, particularly on Windows
+
+#ifndef EAFNOSUPPORT
+#define EAFNOSUPPORT 9901
+#endif
+
+#ifndef EADDRINUSE
+#define EADDRINUSE 9902
+#endif
+
+#ifndef EADDRNOTAVAIL
+#define EADDRNOTAVAIL 9903
+#endif
+
+#ifndef EISCONN
+#define EISCONN 9904
+#endif
+
+#ifndef EBADMSG
+#define EBADMSG 9905
+#endif
+
+#ifndef ECONNABORTED
+#define ECONNABORTED 9906
+#endif
+
+#ifndef EALREADY
+#define EALREADY 9907
+#endif
+
+#ifndef ECONNREFUSED
+#define ECONNREFUSED 9908
+#endif
+
+#ifndef ECONNRESET
+#define ECONNRESET 9909
+#endif
+
+#ifndef EDESTADDRREQ
+#define EDESTADDRREQ 9910
+#endif
+
+#ifndef EHOSTUNREACH
+#define EHOSTUNREACH 9911
+#endif
+
+#ifndef EIDRM
+#define EIDRM 9912
+#endif
+
+#ifndef EMSGSIZE
+#define EMSGSIZE 9913
+#endif
+
+#ifndef ENETDOWN
+#define ENETDOWN 9914
+#endif
+
+#ifndef ENETRESET
+#define ENETRESET 9915
+#endif
+
+#ifndef ENETUNREACH
+#define ENETUNREACH 9916
+#endif
+
+#ifndef ENOBUFS
+#define ENOBUFS 9917
+#endif
+
+#ifndef ENOLINK
+#define ENOLINK 9918
+#endif
+
+#ifndef ENODATA
+#define ENODATA 9919
+#endif
+
+#ifndef ENOMSG
+#define ENOMSG 9920
+#endif
+
+#ifndef ENOPROTOOPT
+#define ENOPROTOOPT 9921
+#endif
+
+#ifndef ENOSR
+#define ENOSR 9922
+#endif
+
+#ifndef ENOTSOCK
+#define ENOTSOCK 9923
+#endif
+
+#ifndef ENOSTR
+#define ENOSTR 9924
+#endif
+
+#ifndef ENOTCONN
+#define ENOTCONN 9925
+#endif
+
+#ifndef ENOTSUP
+#define ENOTSUP 9926
+#endif
+
+#ifndef ECANCELED
+#define ECANCELED 9927
+#endif
+
+#ifndef EINPROGRESS
+#define EINPROGRESS 9928
+#endif
+
+#ifndef EOPNOTSUPP
+#define EOPNOTSUPP 9929
+#endif
+
+#ifndef EWOULDBLOCK
+#define EWOULDBLOCK 9930
+#endif
+
+#ifndef EOWNERDEAD
+#define EOWNERDEAD  9931
+#endif
+
+#ifndef EPROTO
+#define EPROTO 9932
+#endif
+
+#ifndef EPROTONOSUPPORT
+#define EPROTONOSUPPORT 9933
+#endif
+
+#ifndef ENOTRECOVERABLE
+#define ENOTRECOVERABLE 9934
+#endif
+
+#ifndef ETIME
+#define ETIME 9935
+#endif
+
+#ifndef ETXTBSY
+#define ETXTBSY 9936
+#endif
+
+#ifndef ETIMEDOUT
+#define ETIMEDOUT 9938
+#endif
+
+#ifndef ELOOP
+#define ELOOP 9939
+#endif
+
+#ifndef EOVERFLOW
+#define EOVERFLOW 9940
+#endif
+
+#ifndef EPROTOTYPE
+#define EPROTOTYPE 9941
+#endif
+
+#ifndef ENOSYS
+#define ENOSYS 9942
+#endif
+
+#ifndef EINVAL
+#define EINVAL 9943
+#endif
+
+#ifndef ERANGE
+#define ERANGE 9944
+#endif
+
+#ifndef EILSEQ
+#define EILSEQ 9945
+#endif
+
+//  Windows Mobile doesn't appear to define these:
+
+#ifndef E2BIG
+#define E2BIG 9946
+#endif
+
+#ifndef EDOM
+#define EDOM 9947
+#endif
+
+#ifndef EFAULT
+#define EFAULT 9948
+#endif
+
+#ifndef EBADF
+#define EBADF 9949
+#endif
+
+#ifndef EPIPE
+#define EPIPE 9950
+#endif
+
+#ifndef EXDEV
+#define EXDEV 9951
+#endif
+
+#ifndef EBUSY
+#define EBUSY 9952
+#endif
+
+#ifndef ENOTEMPTY
+#define ENOTEMPTY 9953
+#endif
+
+#ifndef ENOEXEC
+#define ENOEXEC 9954
+#endif
+
+#ifndef EEXIST
+#define EEXIST 9955
+#endif
+
+#ifndef EFBIG
+#define EFBIG 9956
+#endif
+
+#ifndef ENAMETOOLONG
+#define ENAMETOOLONG 9957
+#endif
+
+#ifndef ENOTTY
+#define ENOTTY 9958
+#endif
+
+#ifndef EINTR
+#define EINTR 9959
+#endif
+
+#ifndef ESPIPE
+#define ESPIPE 9960
+#endif
+
+#ifndef EIO
+#define EIO 9961
+#endif
+
+#ifndef EISDIR
+#define EISDIR 9962
+#endif
+
+#ifndef ECHILD
+#define ECHILD 9963
+#endif
+
+#ifndef ENOLCK
+#define ENOLCK 9964
+#endif
+
+#ifndef ENOSPC
+#define ENOSPC 9965
+#endif
+
+#ifndef ENXIO
+#define ENXIO 9966
+#endif
+
+#ifndef ENODEV
+#define ENODEV 9967
+#endif
+
+#ifndef ENOENT
+#define ENOENT 9968
+#endif
+
+#ifndef ESRCH
+#define ESRCH 9969
+#endif
+
+#ifndef ENOTDIR
+#define ENOTDIR 9970
+#endif
+
+#ifndef ENOMEM
+#define ENOMEM 9971
+#endif
+
+#ifndef EPERM
+#define EPERM 9972
+#endif
+
+#ifndef EACCES
+#define EACCES 9973
+#endif
+
+#ifndef EROFS
+#define EROFS 9974
+#endif
+
+#ifndef EDEADLK
+#define EDEADLK 9975
+#endif
+
+#ifndef EAGAIN
+#define EAGAIN 9976
+#endif
+
+#ifndef ENFILE
+#define ENFILE 9977
+#endif
+
+#ifndef EMFILE
+#define EMFILE 9978
+#endif
+
+#ifndef EMLINK
+#define EMLINK 9979
+#endif
+
+#endif  // _LIBCPP_CERRNO

Property changes on: lab4/.minix-src/include/c++/cerrno
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c++/check.hpp
===================================================================
--- lab4/.minix-src/include/atf-c++/check.hpp	(nonexistent)
+++ lab4/.minix-src/include/atf-c++/check.hpp	(revision 13)
@@ -0,0 +1,135 @@
+//
+// Automated Testing Framework (atf)
+//
+// Copyright (c) 2007 The NetBSD Foundation, Inc.
+// 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 NETBSD FOUNDATION, INC. AND
+// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#if !defined(_ATF_CXX_CHECK_HPP_)
+#define _ATF_CXX_CHECK_HPP_
+
+extern "C" {
+#include <atf-c/check.h>
+}
+
+#include <cstddef>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace atf {
+
+namespace process {
+class argv_array;
+} // namespace process
+
+namespace check {
+
+// ------------------------------------------------------------------------
+// The "check_result" class.
+// ------------------------------------------------------------------------
+
+//!
+//! \brief A class that contains results of executed command.
+//!
+//! The check_result class holds information about results
+//! of executing arbitrary command and manages files containing
+//! its output.
+//!
+class check_result {
+    // Non-copyable.
+    check_result(const check_result&);
+    check_result& operator=(const check_result&);
+
+    //!
+    //! \brief Internal representation of a result.
+    //!
+    atf_check_result_t m_result;
+
+    //!
+    //! \brief Constructs a results object and grabs ownership of the
+    //! parameter passed in.
+    //!
+    check_result(const atf_check_result_t* result);
+
+    friend check_result test_constructor(const char* const*);
+    friend std::auto_ptr< check_result > exec(const atf::process::argv_array&);
+
+public:
+    //!
+    //! \brief Destroys object and removes all managed files.
+    //!
+    ~check_result(void);
+
+    //!
+    //! \brief Returns whether the command exited correctly or not.
+    //!
+    bool exited(void) const;
+
+    //!
+    //! \brief Returns command's exit status.
+    //!
+    int exitcode(void) const;
+
+    //!
+    //! \brief Returns whether the command received a signal or not.
+    //!
+    bool signaled(void) const;
+
+    //!
+    //! \brief Returns the signal that terminated the command.
+    //!
+    int termsig(void) const;
+
+    //!
+    //! \brief Returns the path to file contaning command's stdout.
+    //!
+    const std::string stdout_path(void) const;
+
+    //!
+    //! \brief Returns the path to file contaning command's stderr.
+    //!
+    const std::string stderr_path(void) const;
+};
+
+// ------------------------------------------------------------------------
+// Free functions.
+// ------------------------------------------------------------------------
+
+bool build_c_o(const std::string&, const std::string&,
+               const atf::process::argv_array&);
+bool build_cpp(const std::string&, const std::string&,
+               const atf::process::argv_array&);
+bool build_cxx_o(const std::string&, const std::string&,
+                 const atf::process::argv_array&);
+std::auto_ptr< check_result > exec(const atf::process::argv_array&);
+
+// Useful for testing only.
+check_result test_constructor(void);
+
+} // namespace check
+} // namespace atf
+
+#endif // !defined(_ATF_CXX_CHECK_HPP_)

Property changes on: lab4/.minix-src/include/atf-c++/check.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c++/config.hpp
===================================================================
--- lab4/.minix-src/include/atf-c++/config.hpp	(nonexistent)
+++ lab4/.minix-src/include/atf-c++/config.hpp	(revision 13)
@@ -0,0 +1,75 @@
+//
+// Automated Testing Framework (atf)
+//
+// Copyright (c) 2007 The NetBSD Foundation, Inc.
+// 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 NETBSD FOUNDATION, INC. AND
+// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#if !defined(_ATF_CXX_CONFIG_HPP_)
+#define _ATF_CXX_CONFIG_HPP_
+
+#include <map>
+#include <string>
+
+namespace atf {
+
+namespace config {
+
+//!
+//! \brief Gets a build-time configuration variable's value.
+//!
+//! Given the name of a build-time configuration variable, returns its
+//! textual value.  The user is free to override these by setting their
+//! corresponding environment variables.  Therefore always use this
+//! interface to get the value of these variables.
+//!
+//! \pre The variable must exist.
+//!
+const std::string& get(const std::string&);
+
+//!
+//! \brief Returns all the build-time configuration variables.
+//!
+//! Returns a name to value map containing all build-time configuration
+//! variables.
+//!
+const std::map< std::string, std::string >& get_all(void);
+
+//!
+//! \brief Checks whether a build-time configuration variable exists.
+//!
+//! Given the name of a build-time configuration variable, checks
+//! whether it is defined and returns a boolean indicating this
+//! condition.  The program only has to use this function to sanity-check
+//! a variable name provided by the user.  Otherwise it can assume that
+//! the variables are defined.
+//!
+bool has(const std::string&);
+
+} // namespace config
+
+} // namespace atf
+
+#endif // !defined(_ATF_CXX_CONFIG_HPP_)

Property changes on: lab4/.minix-src/include/atf-c++/config.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/ccomplex
===================================================================
--- lab4/.minix-src/include/c++/ccomplex	(nonexistent)
+++ lab4/.minix-src/include/c++/ccomplex	(revision 13)
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//===--------------------------- ccomplex ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CCOMPLEX
+#define _LIBCPP_CCOMPLEX
+
+/*
+    ccomplex synopsis
+
+#include <complex>
+
+*/
+
+#include <complex>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+// hh 080623 Created
+
+#endif  // _LIBCPP_CCOMPLEX

Property changes on: lab4/.minix-src/include/c++/ccomplex
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/chrono
===================================================================
--- lab4/.minix-src/include/c++/chrono	(nonexistent)
+++ lab4/.minix-src/include/c++/chrono	(revision 13)
@@ -0,0 +1,1031 @@
+// -*- C++ -*-
+//===---------------------------- chrono ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CHRONO
+#define _LIBCPP_CHRONO
+
+/*
+    chrono synopsis
+
+namespace std
+{
+namespace chrono
+{
+
+template <class ToDuration, class Rep, class Period>
+constexpr
+ToDuration
+duration_cast(const duration<Rep, Period>& fd);
+
+template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
+
+template <class Rep>
+struct duration_values
+{
+public:
+    static constexpr Rep zero();
+    static constexpr Rep max();
+    static constexpr Rep min();
+};
+
+// duration
+
+template <class Rep, class Period = ratio<1>>
+class duration
+{
+    static_assert(!__is_duration<Rep>::value, "A duration representation can not be a duration");
+    static_assert(__is_ratio<Period>::value, "Second template parameter of duration must be a std::ratio");
+    static_assert(Period::num > 0, "duration period must be positive");
+public:
+    typedef Rep rep;
+    typedef Period period;
+
+    constexpr duration() = default;
+    template <class Rep2>
+        constexpr explicit duration(const Rep2& r,
+            typename enable_if
+            <
+               is_convertible<Rep2, rep>::value &&
+               (treat_as_floating_point<rep>::value ||
+               !treat_as_floating_point<rep>::value && !treat_as_floating_point<Rep2>::value)
+            >::type* = 0);
+
+    // conversions
+    template <class Rep2, class Period2>
+        constexpr duration(const duration<Rep2, Period2>& d,
+            typename enable_if
+            <
+                treat_as_floating_point<rep>::value ||
+                ratio_divide<Period2, period>::type::den == 1
+            >::type* = 0);
+
+    // observer
+
+    constexpr rep count() const;
+
+    // arithmetic
+
+    constexpr duration  operator+() const;
+    constexpr duration  operator-() const;
+    duration& operator++();
+    duration  operator++(int);
+    duration& operator--();
+    duration  operator--(int);
+
+    duration& operator+=(const duration& d);
+    duration& operator-=(const duration& d);
+
+    duration& operator*=(const rep& rhs);
+    duration& operator/=(const rep& rhs);
+
+    // special values
+
+    static constexpr duration zero();
+    static constexpr duration min();
+    static constexpr duration max();
+};
+
+typedef duration<long long,         nano> nanoseconds;
+typedef duration<long long,        micro> microseconds;
+typedef duration<long long,        milli> milliseconds;
+typedef duration<long long              > seconds;
+typedef duration<     long, ratio<  60> > minutes;
+typedef duration<     long, ratio<3600> > hours;
+
+template <class Clock, class Duration = typename Clock::duration>
+class time_point
+{
+public:
+    typedef Clock                     clock;
+    typedef Duration                  duration;
+    typedef typename duration::rep    rep;
+    typedef typename duration::period period;
+private:
+    duration d_;  // exposition only
+
+public:
+    time_point();  // has value "epoch" // constexpr in C++14
+    explicit time_point(const duration& d);  // same as time_point() + d // constexpr in C++14
+
+    // conversions
+    template <class Duration2>
+       time_point(const time_point<clock, Duration2>& t); // constexpr in C++14
+
+    // observer
+
+    duration time_since_epoch() const; // constexpr in C++14
+
+    // arithmetic
+
+    time_point& operator+=(const duration& d);
+    time_point& operator-=(const duration& d);
+
+    // special values
+
+    static constexpr time_point min();
+    static constexpr time_point max();
+};
+
+} // chrono
+
+// common_type traits
+template <class Rep1, class Period1, class Rep2, class Period2>
+  struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>;
+
+template <class Clock, class Duration1, class Duration2>
+  struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>;
+
+namespace chrono {
+
+// duration arithmetic
+template <class Rep1, class Period1, class Rep2, class Period2>
+  constexpr
+  typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
+  operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+template <class Rep1, class Period1, class Rep2, class Period2>
+  constexpr
+  typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
+  operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+template <class Rep1, class Period, class Rep2>
+  constexpr
+  duration<typename common_type<Rep1, Rep2>::type, Period>
+  operator*(const duration<Rep1, Period>& d, const Rep2& s);
+template <class Rep1, class Period, class Rep2>
+  constexpr
+  duration<typename common_type<Rep1, Rep2>::type, Period>
+  operator*(const Rep1& s, const duration<Rep2, Period>& d);
+template <class Rep1, class Period, class Rep2>
+  constexpr
+  duration<typename common_type<Rep1, Rep2>::type, Period>
+  operator/(const duration<Rep1, Period>& d, const Rep2& s);
+template <class Rep1, class Period1, class Rep2, class Period2>
+  constexpr
+  typename common_type<Rep1, Rep2>::type
+  operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+// duration comparisons
+template <class Rep1, class Period1, class Rep2, class Period2>
+   constexpr
+   bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+template <class Rep1, class Period1, class Rep2, class Period2>
+   constexpr
+   bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+template <class Rep1, class Period1, class Rep2, class Period2>
+   constexpr
+   bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+template <class Rep1, class Period1, class Rep2, class Period2>
+   constexpr
+   bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+template <class Rep1, class Period1, class Rep2, class Period2>
+   constexpr
+   bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+template <class Rep1, class Period1, class Rep2, class Period2>
+   constexpr
+   bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+// duration_cast
+template <class ToDuration, class Rep, class Period>
+  ToDuration duration_cast(const duration<Rep, Period>& d);
+
+// time_point arithmetic (all constexpr in C++14)
+template <class Clock, class Duration1, class Rep2, class Period2>
+  time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
+  operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
+template <class Rep1, class Period1, class Clock, class Duration2>
+  time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
+  operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
+template <class Clock, class Duration1, class Rep2, class Period2>
+  time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
+  operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
+template <class Clock, class Duration1, class Duration2>
+  typename common_type<Duration1, Duration2>::type
+  operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+// time_point comparisons (all constexpr in C++14)
+template <class Clock, class Duration1, class Duration2>
+   bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+template <class Clock, class Duration1, class Duration2>
+   bool operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+template <class Clock, class Duration1, class Duration2>
+   bool operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+template <class Clock, class Duration1, class Duration2>
+   bool operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+template <class Clock, class Duration1, class Duration2>
+   bool operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+template <class Clock, class Duration1, class Duration2>
+   bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+// time_point_cast (constexpr in C++14)
+
+template <class ToDuration, class Clock, class Duration>
+  time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
+
+// Clocks
+
+class system_clock
+{
+public:
+    typedef microseconds                     duration;
+    typedef duration::rep                    rep;
+    typedef duration::period                 period;
+    typedef chrono::time_point<system_clock> time_point;
+    static const bool is_steady =            false; // constexpr in C++14
+
+    static time_point now() noexcept;
+    static time_t     to_time_t  (const time_point& __t) noexcept;
+    static time_point from_time_t(time_t __t) noexcept;
+};
+
+class steady_clock
+{
+public:
+    typedef nanoseconds                                   duration;
+    typedef duration::rep                                 rep;
+    typedef duration::period                              period;
+    typedef chrono::time_point<steady_clock, duration>    time_point;
+    static const bool is_steady =                         true; // constexpr in C++14
+
+    static time_point now() noexcept;
+};
+
+typedef steady_clock high_resolution_clock;
+
+}  // chrono
+
+constexpr chrono::hours                                 operator "" h(unsigned long long); // C++14
+constexpr chrono::duration<unspecified , ratio<3600,1>> operator "" h(long double); // C++14
+constexpr chrono::minutes                               operator "" min(unsigned long long); // C++14
+constexpr chrono::duration<unspecified , ratio<60,1>>   operator "" min(long double); // C++14
+constexpr chrono::seconds                               operator "" s(unsigned long long); // C++14
+constexpr chrono::duration<unspecified >                operator "" s(long double); // C++14
+constexpr chrono::milliseconds                          operator "" ms(unsigned long long); // C++14
+constexpr chrono::duration<unspecified , milli>         operator "" ms(long double); // C++14
+constexpr chrono::microseconds                          operator "" us(unsigned long long); // C++14
+constexpr chrono::duration<unspecified , micro>         operator "" us(long double); // C++14
+constexpr chrono::nanoseconds                           operator "" ns(unsigned long long); // C++14
+constexpr chrono::duration<unspecified , nano>          operator "" ns(long double); // C++14
+
+}  // std
+*/
+
+#include <__config>
+#include <ctime>
+#include <type_traits>
+#include <ratio>
+#include <limits>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono
+{
+
+template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TYPE_VIS_ONLY duration;
+
+template <class _Tp>
+struct __is_duration : false_type {};
+
+template <class _Rep, class _Period>
+struct __is_duration<duration<_Rep, _Period> > : true_type  {};
+
+template <class _Rep, class _Period>
+struct __is_duration<const duration<_Rep, _Period> > : true_type  {};
+
+template <class _Rep, class _Period>
+struct __is_duration<volatile duration<_Rep, _Period> > : true_type  {};
+
+template <class _Rep, class _Period>
+struct __is_duration<const volatile duration<_Rep, _Period> > : true_type  {};
+
+} // chrono
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::duration<_Rep1, _Period1>,
+                                         chrono::duration<_Rep2, _Period2> >
+{
+    typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
+                             typename __ratio_gcd<_Period1, _Period2>::type> type;
+};
+
+namespace chrono {
+
+// duration_cast
+
+template <class _FromDuration, class _ToDuration,
+          class _Period = typename ratio_divide<typename _FromDuration::period, typename _ToDuration::period>::type,
+          bool = _Period::num == 1,
+          bool = _Period::den == 1>
+struct __duration_cast;
+
+template <class _FromDuration, class _ToDuration, class _Period>
+struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    _ToDuration operator()(const _FromDuration& __fd) const
+    {
+        return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
+    }
+};
+
+template <class _FromDuration, class _ToDuration, class _Period>
+struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    _ToDuration operator()(const _FromDuration& __fd) const
+    {
+        typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+        return _ToDuration(static_cast<typename _ToDuration::rep>(
+                           static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den)));
+    }
+};
+
+template <class _FromDuration, class _ToDuration, class _Period>
+struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    _ToDuration operator()(const _FromDuration& __fd) const
+    {
+        typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+        return _ToDuration(static_cast<typename _ToDuration::rep>(
+                           static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)));
+    }
+};
+
+template <class _FromDuration, class _ToDuration, class _Period>
+struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    _ToDuration operator()(const _FromDuration& __fd) const
+    {
+        typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+        return _ToDuration(static_cast<typename _ToDuration::rep>(
+                           static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)
+                                                          / static_cast<_Ct>(_Period::den)));
+    }
+};
+
+template <class _ToDuration, class _Rep, class _Period>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+typename enable_if
+<
+    __is_duration<_ToDuration>::value,
+    _ToDuration
+>::type
+duration_cast(const duration<_Rep, _Period>& __fd)
+{
+    return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
+}
+
+template <class _Rep>
+struct _LIBCPP_TYPE_VIS_ONLY treat_as_floating_point : is_floating_point<_Rep> {};
+
+template <class _Rep>
+struct _LIBCPP_TYPE_VIS_ONLY duration_values
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max()  {return numeric_limits<_Rep>::max();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min()  {return numeric_limits<_Rep>::lowest();}
+};
+
+// duration
+
+template <class _Rep, class _Period>
+class _LIBCPP_TYPE_VIS_ONLY duration
+{
+    static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
+    static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
+    static_assert(_Period::num > 0, "duration period must be positive");
+
+    template <class _R1, class _R2>
+    struct __no_overflow
+    {
+    private:
+        static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+        static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+        static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
+        static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
+        static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
+        static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
+        static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
+
+        template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
+        struct __mul    // __overflow == false
+        {
+            static const intmax_t value = _Xp * _Yp;
+        };
+
+        template <intmax_t _Xp, intmax_t _Yp>
+        struct __mul<_Xp, _Yp, true>
+        {
+            static const intmax_t value = 1;
+        };
+
+    public:
+        static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
+        typedef ratio<__mul<__n1, __d2, !value>::value,
+                      __mul<__n2, __d1, !value>::value> type;
+    };
+    
+public:
+    typedef _Rep rep;
+    typedef _Period period;
+private:
+    rep __rep_;
+public:
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+        duration() = default;
+#else
+        duration() {}
+#endif
+
+    template <class _Rep2>
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+        explicit duration(const _Rep2& __r,
+            typename enable_if
+            <
+               is_convertible<_Rep2, rep>::value &&
+               (treat_as_floating_point<rep>::value ||
+               !treat_as_floating_point<_Rep2>::value)
+            >::type* = 0)
+                : __rep_(__r) {}
+
+    // conversions
+    template <class _Rep2, class _Period2>
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+        duration(const duration<_Rep2, _Period2>& __d,
+            typename enable_if
+            <
+                __no_overflow<_Period2, period>::value && (
+                treat_as_floating_point<rep>::value ||
+                (__no_overflow<_Period2, period>::type::den == 1 &&
+                 !treat_as_floating_point<_Rep2>::value))
+            >::type* = 0)
+                : __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
+
+    // observer
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
+
+    // arithmetic
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration  operator+() const {return *this;}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration  operator-() const {return duration(-__rep_);}
+    _LIBCPP_INLINE_VISIBILITY duration& operator++()      {++__rep_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY duration  operator++(int)   {return duration(__rep_++);}
+    _LIBCPP_INLINE_VISIBILITY duration& operator--()      {--__rep_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY duration  operator--(int)   {return duration(__rep_--);}
+
+    _LIBCPP_INLINE_VISIBILITY duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;}
+    _LIBCPP_INLINE_VISIBILITY duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;}
+
+    _LIBCPP_INLINE_VISIBILITY duration& operator*=(const rep& rhs) {__rep_ *= rhs; return *this;}
+    _LIBCPP_INLINE_VISIBILITY duration& operator/=(const rep& rhs) {__rep_ /= rhs; return *this;}
+    _LIBCPP_INLINE_VISIBILITY duration& operator%=(const rep& rhs) {__rep_ %= rhs; return *this;}
+    _LIBCPP_INLINE_VISIBILITY duration& operator%=(const duration& rhs) {__rep_ %= rhs.count(); return *this;}
+
+    // special values
+
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min()  {return duration(duration_values<rep>::min());}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max()  {return duration(duration_values<rep>::max());}
+};
+
+typedef duration<long long,         nano> nanoseconds;
+typedef duration<long long,        micro> microseconds;
+typedef duration<long long,        milli> milliseconds;
+typedef duration<long long              > seconds;
+typedef duration<     long, ratio<  60> > minutes;
+typedef duration<     long, ratio<3600> > hours;
+
+// Duration ==
+
+template <class _LhsDuration, class _RhsDuration>
+struct __duration_eq
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
+        {
+            typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
+            return _Ct(__lhs).count() == _Ct(__rhs).count();
+        }
+};
+
+template <class _LhsDuration>
+struct __duration_eq<_LhsDuration, _LhsDuration>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
+        {return __lhs.count() == __rhs.count();}
+};
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+bool
+operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
+}
+
+// Duration !=
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+bool
+operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    return !(__lhs == __rhs);
+}
+
+// Duration <
+
+template <class _LhsDuration, class _RhsDuration>
+struct __duration_lt
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
+        {
+            typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
+            return _Ct(__lhs).count() < _Ct(__rhs).count();
+        }
+};
+
+template <class _LhsDuration>
+struct __duration_lt<_LhsDuration, _LhsDuration>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
+        {return __lhs.count() < __rhs.count();}
+};
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+bool
+operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
+}
+
+// Duration >
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+bool
+operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    return __rhs < __lhs;
+}
+
+// Duration <=
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+bool
+operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    return !(__rhs < __lhs);
+}
+
+// Duration >=
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+bool
+operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    return !(__lhs < __rhs);
+}
+
+// Duration +
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+    return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
+}
+
+// Duration -
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+    return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
+}
+
+// Duration *
+
+template <class _Rep1, class _Period, class _Rep2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+typename enable_if
+<
+    is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
+    duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+>::type
+operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
+{
+    typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+    typedef duration<_Cr, _Period> _Cd;
+    return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
+}
+
+template <class _Rep1, class _Period, class _Rep2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+typename enable_if
+<
+    is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
+    duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+>::type
+operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
+{
+    return __d * __s;
+}
+
+// Duration /
+
+template <class _Duration, class _Rep, bool = __is_duration<_Rep>::value>
+struct __duration_divide_result
+{
+};
+
+template <class _Duration, class _Rep2,
+    bool = is_convertible<_Rep2,
+                          typename common_type<typename _Duration::rep, _Rep2>::type>::value>
+struct __duration_divide_imp
+{
+};
+
+template <class _Rep1, class _Period, class _Rep2>
+struct __duration_divide_imp<duration<_Rep1, _Period>, _Rep2, true>
+{
+    typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period> type;
+};
+
+template <class _Rep1, class _Period, class _Rep2>
+struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
+    : __duration_divide_imp<duration<_Rep1, _Period>, _Rep2>
+{
+};
+
+template <class _Rep1, class _Period, class _Rep2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
+operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
+{
+    typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+    typedef duration<_Cr, _Period> _Cd;
+    return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
+}
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+typename common_type<_Rep1, _Rep2>::type
+operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct;
+    return _Ct(__lhs).count() / _Ct(__rhs).count();
+}
+
+// Duration %
+
+template <class _Rep1, class _Period, class _Rep2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
+operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
+{
+    typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+    typedef duration<_Cr, _Period> _Cd;
+    return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
+}
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+    typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+    return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
+}
+
+//////////////////////////////////////////////////////////
+///////////////////// time_point /////////////////////////
+//////////////////////////////////////////////////////////
+
+template <class _Clock, class _Duration = typename _Clock::duration>
+class _LIBCPP_TYPE_VIS_ONLY time_point
+{
+    static_assert(__is_duration<_Duration>::value,
+                  "Second template parameter of time_point must be a std::chrono::duration");
+public:
+    typedef _Clock                    clock;
+    typedef _Duration                 duration;
+    typedef typename duration::rep    rep;
+    typedef typename duration::period period;
+private:
+    duration __d_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 time_point() : __d_(duration::zero()) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit time_point(const duration& __d) : __d_(__d) {}
+
+    // conversions
+    template <class _Duration2>
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    time_point(const time_point<clock, _Duration2>& t,
+        typename enable_if
+        <
+            is_convertible<_Duration2, duration>::value
+        >::type* = 0)
+            : __d_(t.time_since_epoch()) {}
+
+    // observer
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 duration time_since_epoch() const {return __d_;}
+
+    // arithmetic
+
+    _LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
+    _LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
+
+    // special values
+
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());}
+};
+
+} // chrono
+
+template <class _Clock, class _Duration1, class _Duration2>
+struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::time_point<_Clock, _Duration1>,
+                                         chrono::time_point<_Clock, _Duration2> >
+{
+    typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
+};
+
+namespace chrono {
+
+template <class _ToDuration, class _Clock, class _Duration>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+time_point<_Clock, _ToDuration>
+time_point_cast(const time_point<_Clock, _Duration>& __t)
+{
+    return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
+}
+
+// time_point ==
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
+{
+    return __lhs.time_since_epoch() == __rhs.time_since_epoch();
+}
+
+// time_point !=
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
+{
+    return !(__lhs == __rhs);
+}
+
+// time_point <
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
+{
+    return __lhs.time_since_epoch() < __rhs.time_since_epoch();
+}
+
+// time_point >
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
+{
+    return __rhs < __lhs;
+}
+
+// time_point <=
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
+{
+    return !(__rhs < __lhs);
+}
+
+// time_point >=
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
+{
+    return !(__lhs < __rhs);
+}
+
+// time_point operator+(time_point x, duration y);
+
+template <class _Clock, class _Duration1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
+operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
+    return _Tr (__lhs.time_since_epoch() + __rhs);
+}
+
+// time_point operator+(duration x, time_point y);
+
+template <class _Rep1, class _Period1, class _Clock, class _Duration2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
+operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
+{
+    return __rhs + __lhs;
+}
+
+// time_point operator-(time_point x, duration y);
+
+template <class _Clock, class _Duration1, class _Rep2, class _Period2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
+operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
+{
+    return __lhs + (-__rhs);
+}
+
+// duration operator-(time_point x, time_point y);
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename common_type<_Duration1, _Duration2>::type
+operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
+{
+    return __lhs.time_since_epoch() - __rhs.time_since_epoch();
+}
+
+//////////////////////////////////////////////////////////
+/////////////////////// clocks ///////////////////////////
+//////////////////////////////////////////////////////////
+
+class _LIBCPP_TYPE_VIS system_clock
+{
+public:
+    typedef microseconds                     duration;
+    typedef duration::rep                    rep;
+    typedef duration::period                 period;
+    typedef chrono::time_point<system_clock> time_point;
+    static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
+
+    static time_point now() _NOEXCEPT;
+    static time_t     to_time_t  (const time_point& __t) _NOEXCEPT;
+    static time_point from_time_t(time_t __t) _NOEXCEPT;
+};
+
+#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
+class _LIBCPP_TYPE_VIS steady_clock
+{
+public:
+    typedef nanoseconds                                   duration;
+    typedef duration::rep                                 rep;
+    typedef duration::period                              period;
+    typedef chrono::time_point<steady_clock, duration>    time_point;
+    static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = true;
+
+    static time_point now() _NOEXCEPT;
+};
+
+typedef steady_clock high_resolution_clock;
+#else
+typedef system_clock high_resolution_clock;
+#endif
+
+} // chrono
+
+#if _LIBCPP_STD_VER > 11
+// Suffixes for duration literals [time.duration.literals]
+inline namespace literals
+{ 
+  inline namespace chrono_literals
+  {
+
+    constexpr chrono::hours operator"" h(unsigned long long __h)
+    {
+        return chrono::hours(static_cast<chrono::hours::rep>(__h));
+    }
+
+    constexpr chrono::duration<long double, ratio<3600,1>> operator"" h(long double __h)
+    {
+        return chrono::duration<long double, ratio<3600,1>>(__h);
+    }
+
+
+    constexpr chrono::minutes operator"" min(unsigned long long __m)
+    {
+        return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
+    }
+
+    constexpr chrono::duration<long double, ratio<60,1>> operator"" min(long double __m)
+    {
+        return chrono::duration<long double, ratio<60,1>> (__m);
+    }
+
+
+    constexpr chrono::seconds operator"" s(unsigned long long __s)
+    {
+        return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
+    }
+
+    constexpr chrono::duration<long double> operator"" s(long double __s)
+    {
+        return chrono::duration<long double> (__s);
+    }
+
+
+    constexpr chrono::milliseconds operator"" ms(unsigned long long __ms)
+    {
+        return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
+    }
+
+    constexpr chrono::duration<long double, milli> operator"" ms(long double __ms)
+    {
+        return chrono::duration<long double, milli>(__ms);
+    }
+
+
+    constexpr chrono::microseconds operator"" us(unsigned long long __us)
+    {
+        return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
+    }
+
+    constexpr chrono::duration<long double, micro> operator"" us(long double __us)
+    {
+        return chrono::duration<long double, micro> (__us);
+    }
+    
+
+    constexpr chrono::nanoseconds operator"" ns(unsigned long long __ns)
+    {
+        return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
+    }
+
+    constexpr chrono::duration<long double, nano> operator"" ns(long double __ns)
+    {
+        return chrono::duration<long double, nano> (__ns);
+    }
+
+}}
+
+namespace chrono { // hoist the literals into namespace std::chrono
+   using namespace literals::chrono_literals;
+}
+
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CHRONO

Property changes on: lab4/.minix-src/include/c++/chrono
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c++/macros.hpp
===================================================================
--- lab4/.minix-src/include/atf-c++/macros.hpp	(nonexistent)
+++ lab4/.minix-src/include/atf-c++/macros.hpp	(revision 13)
@@ -0,0 +1,222 @@
+//
+// Automated Testing Framework (atf)
+//
+// Copyright (c) 2007 The NetBSD Foundation, Inc.
+// 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 NETBSD FOUNDATION, INC. AND
+// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#if !defined(_ATF_CXX_MACROS_HPP_)
+#define _ATF_CXX_MACROS_HPP_
+
+#include <sstream>
+#include <stdexcept>
+#include <vector>
+
+#include <atf-c++/tests.hpp>
+
+// Do not define inline methods for the test case classes.  Doing so
+// significantly increases the memory requirements of GNU G++ during
+// compilation.
+
+#define ATF_TEST_CASE_WITHOUT_HEAD(name) \
+    namespace { \
+    class atfu_tc_ ## name : public atf::tests::tc { \
+        void body(void) const; \
+    public: \
+        atfu_tc_ ## name(void); \
+    }; \
+    static atfu_tc_ ## name* atfu_tcptr_ ## name; \
+    atfu_tc_ ## name::atfu_tc_ ## name(void) : atf::tests::tc(#name, false) {} \
+    }
+
+#define ATF_TEST_CASE(name) \
+    namespace { \
+    class atfu_tc_ ## name : public atf::tests::tc { \
+        void head(void); \
+        void body(void) const; \
+    public: \
+        atfu_tc_ ## name(void); \
+    }; \
+    static atfu_tc_ ## name* atfu_tcptr_ ## name; \
+    atfu_tc_ ## name::atfu_tc_ ## name(void) : atf::tests::tc(#name, false) {} \
+    }
+
+#define ATF_TEST_CASE_WITH_CLEANUP(name) \
+    namespace { \
+    class atfu_tc_ ## name : public atf::tests::tc { \
+        void head(void); \
+        void body(void) const; \
+        void cleanup(void) const; \
+    public: \
+        atfu_tc_ ## name(void); \
+    }; \
+    static atfu_tc_ ## name* atfu_tcptr_ ## name; \
+    atfu_tc_ ## name::atfu_tc_ ## name(void) : atf::tests::tc(#name, true) {} \
+    }
+
+#define ATF_TEST_CASE_NAME(name) atfu_tc_ ## name
+#define ATF_TEST_CASE_USE(name) (atfu_tcptr_ ## name) = NULL
+
+#define ATF_TEST_CASE_HEAD(name) \
+    void \
+    atfu_tc_ ## name::head(void)
+
+#define ATF_TEST_CASE_BODY(name) \
+    void \
+    atfu_tc_ ## name::body(void) \
+        const
+
+#define ATF_TEST_CASE_CLEANUP(name) \
+    void \
+    atfu_tc_ ## name::cleanup(void) \
+        const
+
+#define ATF_FAIL(reason) atf::tests::tc::fail(reason)
+
+#define ATF_SKIP(reason) atf::tests::tc::skip(reason)
+
+#define ATF_PASS() atf::tests::tc::pass()
+
+#define ATF_REQUIRE(x) \
+    do { \
+        if (!(x)) { \
+            std::ostringstream atfu_ss; \
+            atfu_ss << "Line " << __LINE__ << ": " << #x << " not met"; \
+            atf::tests::tc::fail(atfu_ss.str()); \
+        } \
+    } while (false)
+
+#define ATF_REQUIRE_EQ(x, y) \
+    do { \
+        if ((x) != (y)) { \
+            std::ostringstream atfu_ss; \
+            atfu_ss << "Line " << __LINE__ << ": " << #x << " != " << #y \
+                     << " (" << (x) << " != " << (y) << ")"; \
+            atf::tests::tc::fail(atfu_ss.str()); \
+        } \
+    } while (false)
+
+#define ATF_REQUIRE_IN(element, collection) \
+    ATF_REQUIRE((collection).find(element) != (collection).end())
+
+#define ATF_REQUIRE_NOT_IN(element, collection) \
+    ATF_REQUIRE((collection).find(element) == (collection).end())
+
+#define ATF_REQUIRE_MATCH(regexp, string) \
+    do { \
+        if (!atf::tests::detail::match(regexp, string)) { \
+            std::ostringstream atfu_ss; \
+            atfu_ss << "Line " << __LINE__ << ": '" << string << "' does not " \
+                    << "match regexp '" << regexp << "'"; \
+            atf::tests::tc::fail(atfu_ss.str()); \
+        } \
+    } while (false)
+
+#define ATF_REQUIRE_THROW(e, x) \
+    do { \
+        try { \
+            x; \
+            std::ostringstream atfu_ss; \
+            atfu_ss << "Line " << __LINE__ << ": " #x " did not throw " \
+                        #e " as expected"; \
+            atf::tests::tc::fail(atfu_ss.str()); \
+        } catch (const e&) { \
+        } catch (const std::exception& atfu_e) { \
+            std::ostringstream atfu_ss; \
+            atfu_ss << "Line " << __LINE__ << ": " #x " threw an " \
+                        "unexpected error (not " #e "): " << atfu_e.what(); \
+            atf::tests::tc::fail(atfu_ss.str()); \
+        } catch (...) { \
+            std::ostringstream atfu_ss; \
+            atfu_ss << "Line " << __LINE__ << ": " #x " threw an " \
+                        "unexpected error (not " #e ")"; \
+            atf::tests::tc::fail(atfu_ss.str()); \
+        } \
+    } while (false)
+
+#define ATF_REQUIRE_THROW_RE(type, regexp, x) \
+    do { \
+        try { \
+            x; \
+            std::ostringstream atfu_ss; \
+            atfu_ss << "Line " << __LINE__ << ": " #x " did not throw " \
+                        #type " as expected"; \
+            atf::tests::tc::fail(atfu_ss.str()); \
+        } catch (const type& e) { \
+            if (!atf::tests::detail::match(regexp, e.what())) { \
+                std::ostringstream atfu_ss; \
+                atfu_ss << "Line " << __LINE__ << ": " #x " threw " #type "(" \
+                        << e.what() << "), but does not match '" << regexp \
+                        << "'"; \
+                atf::tests::tc::fail(atfu_ss.str()); \
+            } \
+        } catch (const std::exception& atfu_e) { \
+            std::ostringstream atfu_ss; \
+            atfu_ss << "Line " << __LINE__ << ": " #x " threw an " \
+                        "unexpected error (not " #type "): " << atfu_e.what(); \
+            atf::tests::tc::fail(atfu_ss.str()); \
+        } catch (...) { \
+            std::ostringstream atfu_ss; \
+            atfu_ss << "Line " << __LINE__ << ": " #x " threw an " \
+                        "unexpected error (not " #type ")"; \
+            atf::tests::tc::fail(atfu_ss.str()); \
+        } \
+    } while (false)
+
+#define ATF_CHECK_ERRNO(exp_errno, bool_expr) \
+    atf::tests::tc::check_errno(__FILE__, __LINE__, exp_errno, #bool_expr, \
+                                bool_expr)
+
+#define ATF_REQUIRE_ERRNO(exp_errno, bool_expr) \
+    atf::tests::tc::require_errno(__FILE__, __LINE__, exp_errno, #bool_expr, \
+                                  bool_expr)
+
+#define ATF_INIT_TEST_CASES(tcs) \
+    namespace atf { \
+        namespace tests { \
+            int run_tp(int, char* const*, \
+                       void (*)(std::vector< atf::tests::tc * >&)); \
+        } \
+    } \
+    \
+    static void atfu_init_tcs(std::vector< atf::tests::tc * >&); \
+    \
+    int \
+    main(int argc, char* const* argv) \
+    { \
+        return atf::tests::run_tp(argc, argv, atfu_init_tcs); \
+    } \
+    \
+    static \
+    void \
+    atfu_init_tcs(std::vector< atf::tests::tc * >& tcs)
+
+#define ATF_ADD_TEST_CASE(tcs, tcname) \
+    do { \
+        atfu_tcptr_ ## tcname = new atfu_tc_ ## tcname(); \
+        (tcs).push_back(atfu_tcptr_ ## tcname); \
+    } while (0);
+
+#endif // !defined(_ATF_CXX_MACROS_HPP_)

Property changes on: lab4/.minix-src/include/atf-c++/macros.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c++/tests.hpp
===================================================================
--- lab4/.minix-src/include/atf-c++/tests.hpp	(nonexistent)
+++ lab4/.minix-src/include/atf-c++/tests.hpp	(revision 13)
@@ -0,0 +1,129 @@
+//
+// Automated Testing Framework (atf)
+//
+// Copyright (c) 2007 The NetBSD Foundation, Inc.
+// 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 NETBSD FOUNDATION, INC. AND
+// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#if !defined(_ATF_CXX_TESTS_HPP_)
+#define _ATF_CXX_TESTS_HPP_
+
+#include <map>
+#include <memory>
+#include <string>
+
+extern "C" {
+#include <atf-c/defs.h>
+}
+
+namespace atf {
+namespace tests {
+
+namespace detail {
+
+class atf_tp_writer {
+    std::ostream& m_os;
+
+    bool m_is_first;
+
+public:
+    atf_tp_writer(std::ostream&);
+
+    void start_tc(const std::string&);
+    void end_tc(void);
+    void tc_meta_data(const std::string&, const std::string&);
+};
+
+bool match(const std::string&, const std::string&);
+
+} // namespace
+
+// ------------------------------------------------------------------------
+// The "vars_map" class.
+// ------------------------------------------------------------------------
+
+typedef std::map< std::string, std::string > vars_map;
+
+// ------------------------------------------------------------------------
+// The "tc" class.
+// ------------------------------------------------------------------------
+
+struct tc_impl;
+
+class tc {
+    // Non-copyable.
+    tc(const tc&);
+    tc& operator=(const tc&);
+
+    std::auto_ptr< tc_impl > pimpl;
+
+protected:
+    virtual void head(void);
+    virtual void body(void) const = 0;
+    virtual void cleanup(void) const;
+
+    void require_prog(const std::string&) const;
+
+    friend struct tc_impl;
+
+public:
+    tc(const std::string&, const bool);
+    virtual ~tc(void);
+
+    void init(const vars_map&);
+
+    const std::string get_config_var(const std::string&) const;
+    const std::string get_config_var(const std::string&, const std::string&)
+        const;
+    const std::string get_md_var(const std::string&) const;
+    const vars_map get_md_vars(void) const;
+    bool has_config_var(const std::string&) const;
+    bool has_md_var(const std::string&) const;
+    void set_md_var(const std::string&, const std::string&);
+
+    void run(const std::string&) const;
+    void run_cleanup(void) const;
+
+    // To be called from the child process only.
+    static void pass(void) ATF_DEFS_ATTRIBUTE_NORETURN;
+    static void fail(const std::string&) ATF_DEFS_ATTRIBUTE_NORETURN;
+    static void fail_nonfatal(const std::string&);
+    static void skip(const std::string&) ATF_DEFS_ATTRIBUTE_NORETURN;
+    static void check_errno(const char*, const int, const int, const char*,
+                            const bool);
+    static void require_errno(const char*, const int, const int, const char*,
+                              const bool);
+    static void expect_pass(void);
+    static void expect_fail(const std::string&);
+    static void expect_exit(const int, const std::string&);
+    static void expect_signal(const int, const std::string&);
+    static void expect_death(const std::string&);
+    static void expect_timeout(const std::string&);
+};
+
+} // namespace tests
+} // namespace atf
+
+#endif // !defined(_ATF_CXX_TESTS_HPP_)

Property changes on: lab4/.minix-src/include/atf-c++/tests.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cfenv
===================================================================
--- lab4/.minix-src/include/c++/cfenv	(nonexistent)
+++ lab4/.minix-src/include/c++/cfenv	(revision 13)
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+//===---------------------------- cctype ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CFENV
+#define _LIBCPP_CFENV
+
+/*
+    cfenv synopsis
+
+This entire header is C99 / C++0X
+
+Macros:
+
+    FE_DIVBYZERO
+    FE_INEXACT
+    FE_INVALID
+    FE_OVERFLOW
+    FE_UNDERFLOW
+    FE_ALL_EXCEPT
+    FE_DOWNWARD
+    FE_TONEAREST
+    FE_TOWARDZERO
+    FE_UPWARD
+    FE_DFL_ENV
+
+namespace std
+{
+
+Types:
+
+    fenv_t
+    fexcept_t
+
+int feclearexcept(int excepts);
+int fegetexceptflag(fexcept_t* flagp, int excepts);
+int feraiseexcept(int excepts);
+int fesetexceptflag(const fexcept_t* flagp, int excepts);
+int fetestexcept(int excepts);
+int fegetround();
+int fesetround(int round);
+int fegetenv(fenv_t* envp);
+int feholdexcept(fenv_t* envp);
+int fesetenv(const fenv_t* envp);
+int feupdateenv(const fenv_t* envp);
+
+}  // std
+*/
+
+#include <__config>
+#include <fenv.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::fenv_t;
+using ::fexcept_t;
+
+using ::feclearexcept;
+using ::fegetexceptflag;
+using ::feraiseexcept;
+using ::fesetexceptflag;
+using ::fetestexcept;
+using ::fegetround;
+using ::fesetround;
+using ::fegetenv;
+using ::feholdexcept;
+using ::fesetenv;
+using ::feupdateenv;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CFENV

Property changes on: lab4/.minix-src/include/c++/cfenv
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cinttypes
===================================================================
--- lab4/.minix-src/include/c++/cinttypes	(nonexistent)
+++ lab4/.minix-src/include/c++/cinttypes	(revision 13)
@@ -0,0 +1,261 @@
+// -*- C++ -*-
+//===--------------------------- cinttypes --------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CINTTYPES
+#define _LIBCPP_CINTTYPES
+
+/*
+    cinttypes synopsis
+
+This entire header is C99 / C++0X
+
+#include <cstdint>  // <cinttypes> includes <cstdint>
+
+Macros:
+
+    PRId8
+    PRId16
+    PRId32
+    PRId64
+
+    PRIdLEAST8
+    PRIdLEAST16
+    PRIdLEAST32
+    PRIdLEAST64
+
+    PRIdFAST8
+    PRIdFAST16
+    PRIdFAST32
+    PRIdFAST64
+
+    PRIdMAX
+    PRIdPTR
+
+    PRIi8
+    PRIi16
+    PRIi32
+    PRIi64
+
+    PRIiLEAST8
+    PRIiLEAST16
+    PRIiLEAST32
+    PRIiLEAST64
+
+    PRIiFAST8
+    PRIiFAST16
+    PRIiFAST32
+    PRIiFAST64
+
+    PRIiMAX
+    PRIiPTR
+
+    PRIo8
+    PRIo16
+    PRIo32
+    PRIo64
+
+    PRIoLEAST8
+    PRIoLEAST16
+    PRIoLEAST32
+    PRIoLEAST64
+
+    PRIoFAST8
+    PRIoFAST16
+    PRIoFAST32
+    PRIoFAST64
+
+    PRIoMAX
+    PRIoPTR
+
+    PRIu8
+    PRIu16
+    PRIu32
+    PRIu64
+
+    PRIuLEAST8
+    PRIuLEAST16
+    PRIuLEAST32
+    PRIuLEAST64
+
+    PRIuFAST8
+    PRIuFAST16
+    PRIuFAST32
+    PRIuFAST64
+
+    PRIuMAX
+    PRIuPTR
+
+    PRIx8
+    PRIx16
+    PRIx32
+    PRIx64
+
+    PRIxLEAST8
+    PRIxLEAST16
+    PRIxLEAST32
+    PRIxLEAST64
+
+    PRIxFAST8
+    PRIxFAST16
+    PRIxFAST32
+    PRIxFAST64
+
+    PRIxMAX
+    PRIxPTR
+
+    PRIX8
+    PRIX16
+    PRIX32
+    PRIX64
+
+    PRIXLEAST8
+    PRIXLEAST16
+    PRIXLEAST32
+    PRIXLEAST64
+
+    PRIXFAST8
+    PRIXFAST16
+    PRIXFAST32
+    PRIXFAST64
+
+    PRIXMAX
+    PRIXPTR
+
+    SCNd8
+    SCNd16
+    SCNd32
+    SCNd64
+
+    SCNdLEAST8
+    SCNdLEAST16
+    SCNdLEAST32
+    SCNdLEAST64
+
+    SCNdFAST8
+    SCNdFAST16
+    SCNdFAST32
+    SCNdFAST64
+
+    SCNdMAX
+    SCNdPTR
+
+    SCNi8
+    SCNi16
+    SCNi32
+    SCNi64
+
+    SCNiLEAST8
+    SCNiLEAST16
+    SCNiLEAST32
+    SCNiLEAST64
+
+    SCNiFAST8
+    SCNiFAST16
+    SCNiFAST32
+    SCNiFAST64
+
+    SCNiMAX
+    SCNiPTR
+
+    SCNo8
+    SCNo16
+    SCNo32
+    SCNo64
+
+    SCNoLEAST8
+    SCNoLEAST16
+    SCNoLEAST32
+    SCNoLEAST64
+
+    SCNoFAST8
+    SCNoFAST16
+    SCNoFAST32
+    SCNoFAST64
+
+    SCNoMAX
+    SCNoPTR
+
+    SCNu8
+    SCNu16
+    SCNu32
+    SCNu64
+
+    SCNuLEAST8
+    SCNuLEAST16
+    SCNuLEAST32
+    SCNuLEAST64
+
+    SCNuFAST8
+    SCNuFAST16
+    SCNuFAST32
+    SCNuFAST64
+
+    SCNuMAX
+    SCNuPTR
+
+    SCNx8
+    SCNx16
+    SCNx32
+    SCNx64
+
+    SCNxLEAST8
+    SCNxLEAST16
+    SCNxLEAST32
+    SCNxLEAST64
+
+    SCNxFAST8
+    SCNxFAST16
+    SCNxFAST32
+    SCNxFAST64
+
+    SCNxMAX
+    SCNxPTR
+
+namespace std
+{
+
+Types:
+
+    imaxdiv_t
+
+intmax_t  imaxabs(intmax_t j);
+imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
+intmax_t  strtoimax(const char* restrict nptr, char** restrict endptr, int base);
+uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base);
+intmax_t  wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
+uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
+
+}  // std
+*/
+
+#include <__config>
+#include <cstdint>
+#include <inttypes.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using::imaxdiv_t;
+
+#undef imaxabs
+using::imaxabs;
+#undef imaxdiv
+using::imaxdiv;
+using::strtoimax;
+using::strtoumax;
+using::wcstoimax;
+using::wcstoumax;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CINTTYPES

Property changes on: lab4/.minix-src/include/c++/cinttypes
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/clocale
===================================================================
--- lab4/.minix-src/include/c++/clocale	(nonexistent)
+++ lab4/.minix-src/include/c++/clocale	(revision 13)
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//===--------------------------- clocale ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CLOCALE
+#define _LIBCPP_CLOCALE
+
+/*
+    clocale synopsis
+
+Macros:
+
+    LC_ALL
+    LC_COLLATE
+    LC_CTYPE
+    LC_MONETARY
+    LC_NUMERIC
+    LC_TIME
+    NULL
+
+namespace std
+{
+
+struct lconv;
+char* setlocale(int category, const char* locale);
+lconv* localeconv();
+
+}  // std
+
+*/
+
+#include <__config>
+#include <locale.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::lconv;
+#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
+using ::setlocale;
+#endif
+using ::localeconv;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CLOCALE

Property changes on: lab4/.minix-src/include/c++/clocale
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/climits
===================================================================
--- lab4/.minix-src/include/c++/climits	(nonexistent)
+++ lab4/.minix-src/include/c++/climits	(revision 13)
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+//===--------------------------- climits ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CLIMITS
+#define _LIBCPP_CLIMITS
+
+/*
+    climits synopsis
+
+Macros:
+
+    CHAR_BIT
+    SCHAR_MIN
+    SCHAR_MAX
+    UCHAR_MAX
+    CHAR_MIN
+    CHAR_MAX
+    MB_LEN_MAX
+    SHRT_MIN
+    SHRT_MAX
+    USHRT_MAX
+    INT_MIN
+    INT_MAX
+    UINT_MAX
+    LONG_MIN
+    LONG_MAX
+    ULONG_MAX
+    LLONG_MIN   // C99
+    LLONG_MAX   // C99
+    ULLONG_MAX  // C99
+
+*/
+
+#include <__config>
+#include <limits.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#endif  // _LIBCPP_CLIMITS

Property changes on: lab4/.minix-src/include/c++/climits
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/codecvt
===================================================================
--- lab4/.minix-src/include/c++/codecvt	(nonexistent)
+++ lab4/.minix-src/include/c++/codecvt	(revision 13)
@@ -0,0 +1,550 @@
+// -*- C++ -*-
+//===-------------------------- codecvt -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CODECVT
+#define _LIBCPP_CODECVT
+
+/*
+    codecvt synopsis
+
+namespace std
+{
+
+enum codecvt_mode
+{
+    consume_header = 4,
+    generate_header = 2,
+    little_endian = 1
+};
+
+template <class Elem, unsigned long Maxcode = 0x10ffff,
+          codecvt_mode Mode = (codecvt_mode)0>
+class codecvt_utf8
+    : public codecvt<Elem, char, mbstate_t>
+{
+    explicit codecvt_utf8(size_t refs = 0);
+    ~codecvt_utf8();
+};
+
+template <class Elem, unsigned long Maxcode = 0x10ffff,
+          codecvt_mode Mode = (codecvt_mode)0>
+class codecvt_utf16
+    : public codecvt<Elem, char, mbstate_t>
+{
+    explicit codecvt_utf16(size_t refs = 0);
+    ~codecvt_utf16();
+};
+
+template <class Elem, unsigned long Maxcode = 0x10ffff,
+          codecvt_mode Mode = (codecvt_mode)0>
+class codecvt_utf8_utf16
+    : public codecvt<Elem, char, mbstate_t>
+{
+    explicit codecvt_utf8_utf16(size_t refs = 0);
+    ~codecvt_utf8_utf16();
+};
+
+}  // std
+
+*/
+
+#include <__config>
+#include <__locale>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+enum codecvt_mode
+{
+    consume_header = 4,
+    generate_header = 2,
+    little_endian = 1
+};
+
+// codecvt_utf8
+
+template <class _Elem> class __codecvt_utf8;
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
+    : public codecvt<wchar_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef wchar_t   intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
+    : public codecvt<char16_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef char16_t  intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
+    : public codecvt<char32_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef char32_t  intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <class _Elem, unsigned long _Maxcode = 0x10ffff,
+          codecvt_mode _Mode = (codecvt_mode)0>
+class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8
+    : public __codecvt_utf8<_Elem>
+{
+public:
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt_utf8(size_t __refs = 0)
+        : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    ~codecvt_utf8() {}
+};
+
+// codecvt_utf16
+
+template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
+    : public codecvt<wchar_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef wchar_t   intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
+    : public codecvt<wchar_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef wchar_t   intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
+    : public codecvt<char16_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef char16_t  intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
+    : public codecvt<char16_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef char16_t  intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
+    : public codecvt<char32_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef char32_t  intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
+    : public codecvt<char32_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef char32_t  intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <class _Elem, unsigned long _Maxcode = 0x10ffff,
+          codecvt_mode _Mode = (codecvt_mode)0>
+class _LIBCPP_TYPE_VIS_ONLY codecvt_utf16
+    : public __codecvt_utf16<_Elem, _Mode & little_endian>
+{
+public:
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt_utf16(size_t __refs = 0)
+        : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    ~codecvt_utf16() {}
+};
+
+// codecvt_utf8_utf16
+
+template <class _Elem> class __codecvt_utf8_utf16;
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
+    : public codecvt<wchar_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef wchar_t   intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
+    : public codecvt<char32_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef char32_t  intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <>
+class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
+    : public codecvt<char16_t, char, mbstate_t>
+{
+    unsigned long _Maxcode_;
+    codecvt_mode _Mode_;
+public:
+    typedef char16_t  intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
+                            codecvt_mode _Mode)
+        : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
+          _Mode_(_Mode) {}
+protected:
+    virtual result
+        do_out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result
+        do_in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result
+        do_unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const throw();
+    virtual bool do_always_noconv() const throw();
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
+                          size_t __mx) const;
+    virtual int do_max_length() const throw();
+};
+
+template <class _Elem, unsigned long _Maxcode = 0x10ffff,
+          codecvt_mode _Mode = (codecvt_mode)0>
+class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8_utf16
+    : public __codecvt_utf8_utf16<_Elem>
+{
+public:
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt_utf8_utf16(size_t __refs = 0)
+        : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    ~codecvt_utf8_utf16() {}
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CODECVT

Property changes on: lab4/.minix-src/include/c++/codecvt
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/condition_variable
===================================================================
--- lab4/.minix-src/include/c++/condition_variable	(nonexistent)
+++ lab4/.minix-src/include/c++/condition_variable	(revision 13)
@@ -0,0 +1,260 @@
+// -*- C++ -*-
+//===---------------------- condition_variable ----------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CONDITION_VARIABLE
+#define _LIBCPP_CONDITION_VARIABLE
+
+/*
+    condition_variable synopsis
+
+namespace std
+{
+
+enum class cv_status { no_timeout, timeout };
+
+class condition_variable
+{
+public:
+    condition_variable();
+    ~condition_variable();
+
+    condition_variable(const condition_variable&) = delete;
+    condition_variable& operator=(const condition_variable&) = delete;
+
+    void notify_one() noexcept;
+    void notify_all() noexcept;
+
+    void wait(unique_lock<mutex>& lock);
+    template <class Predicate>
+        void wait(unique_lock<mutex>& lock, Predicate pred);
+
+    template <class Clock, class Duration>
+        cv_status
+        wait_until(unique_lock<mutex>& lock,
+                   const chrono::time_point<Clock, Duration>& abs_time);
+
+    template <class Clock, class Duration, class Predicate>
+        bool
+        wait_until(unique_lock<mutex>& lock,
+                   const chrono::time_point<Clock, Duration>& abs_time,
+                   Predicate pred);
+
+    template <class Rep, class Period>
+        cv_status
+        wait_for(unique_lock<mutex>& lock,
+                 const chrono::duration<Rep, Period>& rel_time);
+
+    template <class Rep, class Period, class Predicate>
+        bool
+        wait_for(unique_lock<mutex>& lock,
+                 const chrono::duration<Rep, Period>& rel_time,
+                 Predicate pred);
+
+    typedef pthread_cond_t* native_handle_type;
+    native_handle_type native_handle();
+};
+
+void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
+
+class condition_variable_any
+{
+public:
+    condition_variable_any();
+    ~condition_variable_any();
+
+    condition_variable_any(const condition_variable_any&) = delete;
+    condition_variable_any& operator=(const condition_variable_any&) = delete;
+
+    void notify_one() noexcept;
+    void notify_all() noexcept;
+
+    template <class Lock>
+        void wait(Lock& lock);
+    template <class Lock, class Predicate>
+        void wait(Lock& lock, Predicate pred);
+
+    template <class Lock, class Clock, class Duration>
+        cv_status
+        wait_until(Lock& lock,
+                   const chrono::time_point<Clock, Duration>& abs_time);
+
+    template <class Lock, class Clock, class Duration, class Predicate>
+        bool
+        wait_until(Lock& lock,
+                   const chrono::time_point<Clock, Duration>& abs_time,
+                   Predicate pred);
+
+    template <class Lock, class Rep, class Period>
+        cv_status
+        wait_for(Lock& lock,
+                 const chrono::duration<Rep, Period>& rel_time);
+
+    template <class Lock, class Rep, class Period, class Predicate>
+        bool
+        wait_for(Lock& lock,
+                 const chrono::duration<Rep, Period>& rel_time,
+                 Predicate pred);
+};
+
+}  // std
+
+*/
+
+#include <__config>
+#include <__mutex_base>
+#include <memory>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP_HAS_NO_THREADS
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+class _LIBCPP_TYPE_VIS condition_variable_any
+{
+    condition_variable __cv_;
+    shared_ptr<mutex>  __mut_;
+public:
+    condition_variable_any();
+
+    void notify_one() _NOEXCEPT;
+    void notify_all() _NOEXCEPT;
+
+    template <class _Lock>
+        void wait(_Lock& __lock);
+    template <class _Lock, class _Predicate>
+        void wait(_Lock& __lock, _Predicate __pred);
+
+    template <class _Lock, class _Clock, class _Duration>
+        cv_status
+        wait_until(_Lock& __lock,
+                   const chrono::time_point<_Clock, _Duration>& __t);
+
+    template <class _Lock, class _Clock, class _Duration, class _Predicate>
+        bool
+        wait_until(_Lock& __lock,
+                   const chrono::time_point<_Clock, _Duration>& __t,
+                   _Predicate __pred);
+
+    template <class _Lock, class _Rep, class _Period>
+        cv_status
+        wait_for(_Lock& __lock,
+                 const chrono::duration<_Rep, _Period>& __d);
+
+    template <class _Lock, class _Rep, class _Period, class _Predicate>
+        bool
+        wait_for(_Lock& __lock,
+                 const chrono::duration<_Rep, _Period>& __d,
+                 _Predicate __pred);
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+condition_variable_any::condition_variable_any()
+    : __mut_(make_shared<mutex>()) {}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+condition_variable_any::notify_one() _NOEXCEPT
+{
+    {lock_guard<mutex> __lx(*__mut_);}
+    __cv_.notify_one();
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+condition_variable_any::notify_all() _NOEXCEPT
+{
+    {lock_guard<mutex> __lx(*__mut_);}
+    __cv_.notify_all();
+}
+
+struct __lock_external
+{
+    template <class _Lock>
+    void operator()(_Lock* __m) {__m->lock();}
+};
+
+template <class _Lock>
+void
+condition_variable_any::wait(_Lock& __lock)
+{
+    shared_ptr<mutex> __mut = __mut_;
+    unique_lock<mutex> __lk(*__mut);
+    __lock.unlock();
+    unique_ptr<_Lock, __lock_external> __lxx(&__lock);
+    lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
+    __cv_.wait(__lk);
+}  // __mut_.unlock(), __lock.lock()
+
+template <class _Lock, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
+{
+    while (!__pred())
+        wait(__lock);
+}
+
+template <class _Lock, class _Clock, class _Duration>
+cv_status
+condition_variable_any::wait_until(_Lock& __lock,
+                                   const chrono::time_point<_Clock, _Duration>& __t)
+{
+    shared_ptr<mutex> __mut = __mut_;
+    unique_lock<mutex> __lk(*__mut);
+    __lock.unlock();
+    unique_ptr<_Lock, __lock_external> __lxx(&__lock);
+    lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
+    return __cv_.wait_until(__lk, __t);
+}  // __mut_.unlock(), __lock.lock()
+
+template <class _Lock, class _Clock, class _Duration, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+condition_variable_any::wait_until(_Lock& __lock,
+                                   const chrono::time_point<_Clock, _Duration>& __t,
+                                   _Predicate __pred)
+{
+    while (!__pred())
+        if (wait_until(__lock, __t) == cv_status::timeout)
+            return __pred();
+    return true;
+}
+
+template <class _Lock, class _Rep, class _Period>
+inline _LIBCPP_INLINE_VISIBILITY
+cv_status
+condition_variable_any::wait_for(_Lock& __lock,
+                                 const chrono::duration<_Rep, _Period>& __d)
+{
+    return wait_until(__lock, chrono::steady_clock::now() + __d);
+}
+
+template <class _Lock, class _Rep, class _Period, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+condition_variable_any::wait_for(_Lock& __lock,
+                                 const chrono::duration<_Rep, _Period>& __d,
+                                 _Predicate __pred)
+{
+    return wait_until(__lock, chrono::steady_clock::now() + __d,
+                      _VSTD::move(__pred));
+}
+
+_LIBCPP_FUNC_VIS
+void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // !_LIBCPP_HAS_NO_THREADS
+
+#endif  // _LIBCPP_CONDITION_VARIABLE

Property changes on: lab4/.minix-src/include/c++/condition_variable
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c++/utils.hpp
===================================================================
--- lab4/.minix-src/include/atf-c++/utils.hpp	(nonexistent)
+++ lab4/.minix-src/include/atf-c++/utils.hpp	(revision 13)
@@ -0,0 +1,68 @@
+//
+// Automated Testing Framework (atf)
+//
+// Copyright (c) 2007 The NetBSD Foundation, Inc.
+// 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 NETBSD FOUNDATION, INC. AND
+// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#if !defined(_ATF_CXX_UTILS_HPP_)
+#define _ATF_CXX_UTILS_HPP_
+
+extern "C" {
+#include <unistd.h>
+}
+
+#include <string>
+
+namespace atf {
+namespace utils {
+
+void cat_file(const std::string&, const std::string&);
+bool compare_file(const std::string&, const std::string&);
+void copy_file(const std::string&, const std::string&);
+void create_file(const std::string&, const std::string&);
+bool file_exists(const std::string&);
+pid_t fork(void);
+bool grep_file(const std::string&, const std::string&);
+bool grep_string(const std::string&, const std::string&);
+void redirect(const int, const std::string&);
+void wait(const pid_t, const int, const std::string&, const std::string&);
+
+template< typename Collection >
+bool
+grep_collection(const std::string& regexp, const Collection& collection)
+{
+    for (typename Collection::const_iterator iter = collection.begin();
+         iter != collection.end(); ++iter) {
+        if (grep_string(regexp, *iter))
+            return true;
+    }
+    return false;
+}
+
+} // namespace utils
+} // namespace atf
+
+#endif // !defined(_ATF_CXX_UTILS_HPP_)

Property changes on: lab4/.minix-src/include/atf-c++/utils.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/experimental/__config
===================================================================
--- lab4/.minix-src/include/c++/experimental/__config	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/__config	(revision 13)
@@ -0,0 +1,32 @@
+// -*- C++ -*-
+//===--------------------------- __config ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_CONFIG
+#define _LIBCPP_EXPERIMENTAL_CONFIG
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace std { namespace experimental {
+#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL  } }
+#define _VSTD_EXPERIMENTAL std::experimental
+
+#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {
+#define _LIBCPP_END_NAMESPACE_LFTS  } } }
+#define _VSTD_LFTS _VSTD_EXPERIMENTAL::fundamentals_v1
+
+#define _LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS _LIBCPP_BEGIN_NAMESPACE_STD        \
+  namespace chrono { namespace experimental { inline namespace fundamentals_v1 {
+#define _LIBCPP_END_NAMESPACE_CHRONO_LFTS _LIBCPP_END_NAMESPACE_STD } } }
+
+#endif

Property changes on: lab4/.minix-src/include/c++/experimental/__config
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/experimental/algorithm
===================================================================
--- lab4/.minix-src/include/c++/experimental/algorithm	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/algorithm	(revision 13)
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_ALGORITHM
+#define _LIBCPP_EXPERIMENTAL_ALGORITHM
+
+/*
+   experimental/algorithm synopsis
+
+#include <algorithm>
+
+namespace std {
+namespace experimental {
+inline namespace fundamentals_v1 {
+
+template <class ForwardIterator, class Searcher>
+ForwardIterator search(ForwardIterator first, ForwardIterator last,
+                       const Searcher &searcher);
+template <class PopulationIterator, class SampleIterator, class Distance,
+          class UniformRandomNumberGenerator>
+SampleIterator sample(PopulationIterator first, PopulationIterator last,
+                      SampleIterator out, Distance n,
+                      UniformRandomNumberGenerator &&g);
+
+} // namespace fundamentals_v1
+} // namespace experimental
+} // namespace std
+
+*/
+
+#include <experimental/__config>
+#include <algorithm>
+#include <type_traits>
+
+#include <__undef_min_max>
+
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
+
+template <class _ForwardIterator, class _Searcher>
+_LIBCPP_INLINE_VISIBILITY
+_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
+{ return __s(__f, __l); }
+
+
+template <class _PopulationIterator, class _SampleIterator, class _Distance,
+          class _UniformRandomNumberGenerator>
+_LIBCPP_INLINE_VISIBILITY
+_SampleIterator __sample(_PopulationIterator __first,
+                         _PopulationIterator __last, _SampleIterator __out,
+                         _Distance __n,
+                         _UniformRandomNumberGenerator &&__g,
+                         input_iterator_tag) {
+
+  _Distance __k = 0;
+  for (; __first != __last && __k < __n; ++__first, (void)++__k)
+    __out[__k] = *__first;
+  _Distance __sz = __k;
+  for (; __first != __last; ++__first, (void)++__k) {
+    _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);
+    if (__r < __sz)
+      __out[__r] = *__first;
+  }
+  return __out + _VSTD::min(__n, __k);
+}
+
+template <class _PopulationIterator, class _SampleIterator, class _Distance,
+          class _UniformRandomNumberGenerator>
+_LIBCPP_INLINE_VISIBILITY
+_SampleIterator __sample(_PopulationIterator __first,
+                         _PopulationIterator __last, _SampleIterator __out,
+                         _Distance __n,
+                         _UniformRandomNumberGenerator &&__g,
+                         forward_iterator_tag) {
+  _Distance __unsampled_sz = _VSTD::distance(__first, __last);
+  for (__n = _VSTD::min(__n, __unsampled_sz); __n != 0; ++__first) {
+    _Distance __r =
+        _VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
+    if (__r < __n) {
+      *__out++ = *__first;
+      --__n;
+    }
+  }
+  return __out;
+}
+
+template <class _PopulationIterator, class _SampleIterator, class _Distance,
+          class _UniformRandomNumberGenerator>
+_LIBCPP_INLINE_VISIBILITY
+_SampleIterator sample(_PopulationIterator __first,
+                         _PopulationIterator __last, _SampleIterator __out,
+                         _Distance __n, _UniformRandomNumberGenerator &&__g) {
+  typedef typename iterator_traits<_PopulationIterator>::iterator_category
+        _PopCategory;
+  typedef typename iterator_traits<_PopulationIterator>::difference_type
+        _Difference;
+  typedef typename common_type<_Distance, _Difference>::type _CommonType;
+  _LIBCPP_ASSERT(__n >= 0, "N must be a positive number.");
+  return _VSTD_LFTS::__sample(
+      __first, __last, __out, _CommonType(__n),
+      _VSTD::forward<_UniformRandomNumberGenerator>(__g),
+      _PopCategory());
+}
+
+_LIBCPP_END_NAMESPACE_LFTS
+
+#endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */

Property changes on: lab4/.minix-src/include/c++/experimental/algorithm
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/experimental/dynarray
===================================================================
--- lab4/.minix-src/include/c++/experimental/dynarray	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/dynarray	(revision 13)
@@ -0,0 +1,316 @@
+// -*- C++ -*-
+//===-------------------------- dynarray ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_DYNARRAY
+#define _LIBCPP_DYNARRAY
+
+#include <__config>
+#if _LIBCPP_STD_VER > 11
+
+/*
+    dynarray synopsis
+
+namespace std { namespace experimental {
+
+template< typename T >
+class dynarray
+{
+    // types:
+    typedef       T                               value_type;
+    typedef       T&                              reference;
+    typedef const T&                              const_reference;
+    typedef       T*                              pointer;
+    typedef const T*                              const_pointer;
+    typedef       implementation-defined          iterator;
+    typedef       implementation-defined          const_iterator;
+    typedef reverse_iterator<iterator>            reverse_iterator;
+    typedef reverse_iterator<const_iterator>      const_reverse_iterator;
+    typedef size_t                                size_type;
+    typedef ptrdiff_t                             difference_type;
+
+public:
+    // construct/copy/destroy:
+    explicit dynarray(size_type c);
+    dynarray(size_type c, const T& v);
+    dynarray(const dynarray& d);
+    dynarray(initializer_list<T>);
+
+    template <class Alloc>
+      dynarray(allocator_arg_t, const Alloc& a, size_type c, const Alloc& alloc);
+    template <class Alloc>
+      dynarray(allocator_arg_t, const Alloc& a, size_type c, const T& v, const Alloc& alloc);
+    template <class Alloc>
+      dynarray(allocator_arg_t, const Alloc& a, const dynarray& d, const Alloc& alloc);
+    template <class Alloc>
+      dynarray(allocator_arg_t, const Alloc& a, initializer_list<T>, const Alloc& alloc);
+    dynarray& operator=(const dynarray&) = delete;
+    ~dynarray();
+
+    // iterators:
+    iterator       begin()        noexcept;
+    const_iterator begin()  const noexcept;
+    const_iterator cbegin() const noexcept;
+    iterator       end()          noexcept;
+    const_iterator end()    const noexcept;
+    const_iterator cend()   const noexcept;
+
+    reverse_iterator       rbegin()        noexcept;
+    const_reverse_iterator rbegin()  const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    reverse_iterator       rend()          noexcept;
+    const_reverse_iterator rend()    const noexcept;
+    const_reverse_iterator crend()   const noexcept;
+
+    // capacity:
+    size_type size()     const noexcept;
+    size_type max_size() const noexcept;
+    bool      empty()    const noexcept;
+
+    // element access:
+    reference       operator[](size_type n);
+    const_reference operator[](size_type n) const;
+
+    reference       front();
+    const_reference front() const;
+    reference       back();
+    const_reference back()  const;
+
+    const_reference at(size_type n) const;
+    reference       at(size_type n);
+
+    // data access:
+    T*       data()       noexcept;
+    const T* data() const noexcept;
+
+    // mutating member functions:
+    void fill(const T& v);
+};
+
+}}  // std::experimental
+
+*/
+
+#include <__functional_base>
+#include <iterator>
+#include <stdexcept>
+#include <initializer_list>
+#include <new>
+#include <algorithm>
+
+#include <__undef___deallocate>
+
+#if defined(_LIBCPP_NO_EXCEPTIONS)
+    #include <cassert>
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+namespace std { namespace experimental { inline namespace __array_extensions_v1 {
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY dynarray
+{
+public:
+    // types:
+    typedef dynarray __self;
+    typedef _Tp                                   value_type;
+    typedef value_type&                           reference;
+    typedef const value_type&                     const_reference;
+    typedef value_type*                           iterator;
+    typedef const value_type*                     const_iterator;
+    typedef value_type*                           pointer;
+    typedef const value_type*                     const_pointer;
+    typedef size_t                                size_type;
+    typedef ptrdiff_t                             difference_type;
+    typedef std::reverse_iterator<iterator>       reverse_iterator;
+    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+private:
+    size_t                  __size_;
+    value_type *            __base_;
+    _LIBCPP_ALWAYS_INLINE dynarray () noexcept : __base_(nullptr), __size_(0) {}
+    
+    static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
+    {
+        if ( numeric_limits<size_t>::max() / sizeof (value_type) <= count )
+        {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            throw bad_array_length();
+#else
+            assert(!"dynarray::allocation");
+#endif
+        }
+        return static_cast<value_type *> (_VSTD::__allocate (sizeof(value_type) * count));
+    }
+
+    static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
+    {
+        _VSTD::__deallocate (static_cast<void *> (__ptr));
+    }
+
+public:
+
+    explicit dynarray(size_type __c);
+    dynarray(size_type __c, const value_type& __v);
+    dynarray(const dynarray& __d);
+    dynarray(initializer_list<value_type>);
+
+//  We're not implementing these right now.
+//  Updated with the resolution of LWG issue #2255
+//     template <typename _Alloc>
+//       dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c);
+//     template <typename _Alloc>
+//       dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c, const value_type& __v);
+//     template <typename _Alloc>
+//       dynarray(allocator_arg_t, const _Alloc& __alloc, const dynarray& __d);
+//     template <typename _Alloc>
+//       dynarray(allocator_arg_t, const _Alloc& __alloc, initializer_list<value_type>);
+
+    dynarray& operator=(const dynarray&) = delete;
+    ~dynarray();
+
+    // iterators:
+    inline _LIBCPP_INLINE_VISIBILITY iterator       begin()        noexcept { return iterator(data()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_iterator begin()  const noexcept { return const_iterator(data()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); }
+    inline _LIBCPP_INLINE_VISIBILITY iterator       end()          noexcept { return iterator(data() + __size_); }
+    inline _LIBCPP_INLINE_VISIBILITY const_iterator end()    const noexcept { return const_iterator(data() + __size_); }
+    inline _LIBCPP_INLINE_VISIBILITY const_iterator cend()   const noexcept { return const_iterator(data() + __size_); }
+
+    inline _LIBCPP_INLINE_VISIBILITY reverse_iterator       rbegin()        noexcept { return reverse_iterator(end()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin()  const noexcept { return const_reverse_iterator(end()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
+    inline _LIBCPP_INLINE_VISIBILITY reverse_iterator       rend()          noexcept { return reverse_iterator(begin()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend()    const noexcept { return const_reverse_iterator(begin()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend()   const noexcept { return const_reverse_iterator(begin()); }
+
+    // capacity:
+    inline _LIBCPP_INLINE_VISIBILITY size_type size()     const noexcept { return __size_; }
+    inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; }
+    inline _LIBCPP_INLINE_VISIBILITY bool      empty()    const noexcept { return __size_ == 0; }
+
+    // element access:
+    inline _LIBCPP_INLINE_VISIBILITY reference       operator[](size_type __n)       { return data()[__n]; }
+    inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; }
+
+    inline _LIBCPP_INLINE_VISIBILITY reference       front()       { return data()[0]; }
+    inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; }
+    inline _LIBCPP_INLINE_VISIBILITY reference       back()        { return data()[__size_-1]; }
+    inline _LIBCPP_INLINE_VISIBILITY const_reference back()  const { return data()[__size_-1]; }
+
+    inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const;
+    inline _LIBCPP_INLINE_VISIBILITY reference       at(size_type __n);
+
+    // data access:
+    inline _LIBCPP_INLINE_VISIBILITY _Tp*       data()       noexcept { return __base_; }
+    inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; }
+
+    // mutating member functions:
+    inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); }
+};
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+dynarray<_Tp>::dynarray(size_type __c) : dynarray ()
+{
+    __base_ = __allocate (__c);
+    value_type *__data = data ();
+    for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
+        ::new (__data) value_type;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray ()
+{
+    __base_ = __allocate (__c);
+    value_type *__data = data ();
+    for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
+        ::new (__data) value_type (__v);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray ()
+{
+    size_t sz = __il.size();
+    __base_ = __allocate (sz);
+    value_type *__data = data ();
+    auto src = __il.begin();
+    for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
+        ::new (__data) value_type (*src);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray ()
+{
+    size_t sz = __d.size();
+    __base_ = __allocate (sz);
+    value_type *__data = data ();
+    auto src = __d.begin();
+    for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
+        ::new (__data) value_type (*src);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+dynarray<_Tp>::~dynarray()
+{ 
+    value_type *__data = data () + __size_;
+    for ( size_t i = 0; i < __size_; ++i )
+        (--__data)->value_type::~value_type();
+    __deallocate ( __base_ );
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename dynarray<_Tp>::reference
+dynarray<_Tp>::at(size_type __n)
+{
+    if (__n >= __size_)
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("dynarray::at");
+#else
+        assert(!"dynarray::at out_of_range");
+#endif
+    }
+    return data()[__n];
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename dynarray<_Tp>::const_reference
+dynarray<_Tp>::at(size_type __n) const
+{
+    if (__n >= __size_)
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("dynarray::at");
+#else
+        assert(!"dynarray::at out_of_range");
+#endif
+    }
+    return data()[__n];
+}
+
+}}}
+
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _Tp, class _Alloc>
+struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {};
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // if _LIBCPP_STD_VER > 11 
+#endif  // _LIBCPP_DYNARRAY

Property changes on: lab4/.minix-src/include/c++/experimental/dynarray
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/experimental/ratio
===================================================================
--- lab4/.minix-src/include/c++/experimental/ratio	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/ratio	(revision 13)
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//===------------------------------ ratio ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_RATIO
+#define _LIBCPP_EXPERIMENTAL_RATIO
+
+/**
+    experimental/ratio synopsis
+    C++1y
+#include <ratio>
+
+namespace std {
+namespace experimental {
+inline namespace fundamentals_v1 {
+
+  // See C++14 20.11.5, ratio comparison
+  template <class R1, class R2> constexpr bool ratio_equal_v
+    = ratio_equal<R1, R2>::value;
+  template <class R1, class R2> constexpr bool ratio_not_equal_v
+    = ratio_not_equal<R1, R2>::value;
+  template <class R1, class R2> constexpr bool ratio_less_v
+    = ratio_less<R1, R2>::value;
+  template <class R1, class R2> constexpr bool ratio_less_equal_v
+    = ratio_less_equal<R1, R2>::value;
+  template <class R1, class R2> constexpr bool ratio_greater_v
+    = ratio_greater<R1, R2>::value;
+  template <class R1, class R2> constexpr bool ratio_greater_equal_v
+    = ratio_greater_equal<R1, R2>::value;
+
+} // namespace fundamentals_v1
+} // namespace experimental
+} // namespace std
+
+*/
+
+#include <experimental/__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <ratio>
+
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
+#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_equal_v
+    = ratio_equal<_R1, _R2>::value;
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_not_equal_v
+    = ratio_not_equal<_R1, _R2>::value;
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_v
+    = ratio_less<_R1, _R2>::value;
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_equal_v
+    = ratio_less_equal<_R1, _R2>::value;
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_v
+    = ratio_greater<_R1, _R2>::value;
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
+    = ratio_greater_equal<_R1, _R2>::value;
+
+#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
+
+_LIBCPP_END_NAMESPACE_LFTS
+
+#endif /* _LIBCPP_STD_VER > 11 */
+
+#endif // _LIBCPP_EXPERIMENTAL_RATIO

Property changes on: lab4/.minix-src/include/c++/experimental/ratio
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/complex
===================================================================
--- lab4/.minix-src/include/c++/complex	(nonexistent)
+++ lab4/.minix-src/include/c++/complex	(revision 13)
@@ -0,0 +1,1567 @@
+// -*- C++ -*-
+//===--------------------------- complex ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_COMPLEX
+#define _LIBCPP_COMPLEX
+
+/*
+    complex synopsis
+
+namespace std
+{
+
+template<class T>
+class complex
+{
+public:
+    typedef T value_type;
+
+    complex(const T& re = T(), const T& im = T()); // constexpr in C++14
+    complex(const complex&);  // constexpr in C++14
+    template<class X> complex(const complex<X>&);  // constexpr in C++14
+
+    T real() const; // constexpr in C++14
+    T imag() const; // constexpr in C++14
+
+    void real(T);
+    void imag(T);
+
+    complex<T>& operator= (const T&);
+    complex<T>& operator+=(const T&);
+    complex<T>& operator-=(const T&);
+    complex<T>& operator*=(const T&);
+    complex<T>& operator/=(const T&);
+
+    complex& operator=(const complex&);
+    template<class X> complex<T>& operator= (const complex<X>&);
+    template<class X> complex<T>& operator+=(const complex<X>&);
+    template<class X> complex<T>& operator-=(const complex<X>&);
+    template<class X> complex<T>& operator*=(const complex<X>&);
+    template<class X> complex<T>& operator/=(const complex<X>&);
+};
+
+template<>
+class complex<float>
+{
+public:
+    typedef float value_type;
+
+    constexpr complex(float re = 0.0f, float im = 0.0f);
+    explicit constexpr complex(const complex<double>&);
+    explicit constexpr complex(const complex<long double>&);
+
+    constexpr float real() const;
+    void real(float);
+    constexpr float imag() const;
+    void imag(float);
+
+    complex<float>& operator= (float);
+    complex<float>& operator+=(float);
+    complex<float>& operator-=(float);
+    complex<float>& operator*=(float);
+    complex<float>& operator/=(float);
+
+    complex<float>& operator=(const complex<float>&);
+    template<class X> complex<float>& operator= (const complex<X>&);
+    template<class X> complex<float>& operator+=(const complex<X>&);
+    template<class X> complex<float>& operator-=(const complex<X>&);
+    template<class X> complex<float>& operator*=(const complex<X>&);
+    template<class X> complex<float>& operator/=(const complex<X>&);
+};
+
+template<>
+class complex<double>
+{
+public:
+    typedef double value_type;
+
+    constexpr complex(double re = 0.0, double im = 0.0);
+    constexpr complex(const complex<float>&);
+    explicit constexpr complex(const complex<long double>&);
+
+    constexpr double real() const;
+    void real(double);
+    constexpr double imag() const;
+    void imag(double);
+
+    complex<double>& operator= (double);
+    complex<double>& operator+=(double);
+    complex<double>& operator-=(double);
+    complex<double>& operator*=(double);
+    complex<double>& operator/=(double);
+    complex<double>& operator=(const complex<double>&);
+
+    template<class X> complex<double>& operator= (const complex<X>&);
+    template<class X> complex<double>& operator+=(const complex<X>&);
+    template<class X> complex<double>& operator-=(const complex<X>&);
+    template<class X> complex<double>& operator*=(const complex<X>&);
+    template<class X> complex<double>& operator/=(const complex<X>&);
+};
+
+template<>
+class complex<long double>
+{
+public:
+    typedef long double value_type;
+
+    constexpr complex(long double re = 0.0L, long double im = 0.0L);
+    constexpr complex(const complex<float>&);
+    constexpr complex(const complex<double>&);
+
+    constexpr long double real() const;
+    void real(long double);
+    constexpr long double imag() const;
+    void imag(long double);
+
+    complex<long double>& operator=(const complex<long double>&);
+    complex<long double>& operator= (long double);
+    complex<long double>& operator+=(long double);
+    complex<long double>& operator-=(long double);
+    complex<long double>& operator*=(long double);
+    complex<long double>& operator/=(long double);
+
+    template<class X> complex<long double>& operator= (const complex<X>&);
+    template<class X> complex<long double>& operator+=(const complex<X>&);
+    template<class X> complex<long double>& operator-=(const complex<X>&);
+    template<class X> complex<long double>& operator*=(const complex<X>&);
+    template<class X> complex<long double>& operator/=(const complex<X>&);
+};
+
+// 26.3.6 operators:
+template<class T> complex<T> operator+(const complex<T>&, const complex<T>&);
+template<class T> complex<T> operator+(const complex<T>&, const T&);
+template<class T> complex<T> operator+(const T&, const complex<T>&);
+template<class T> complex<T> operator-(const complex<T>&, const complex<T>&);
+template<class T> complex<T> operator-(const complex<T>&, const T&);
+template<class T> complex<T> operator-(const T&, const complex<T>&);
+template<class T> complex<T> operator*(const complex<T>&, const complex<T>&);
+template<class T> complex<T> operator*(const complex<T>&, const T&);
+template<class T> complex<T> operator*(const T&, const complex<T>&);
+template<class T> complex<T> operator/(const complex<T>&, const complex<T>&);
+template<class T> complex<T> operator/(const complex<T>&, const T&);
+template<class T> complex<T> operator/(const T&, const complex<T>&);
+template<class T> complex<T> operator+(const complex<T>&);
+template<class T> complex<T> operator-(const complex<T>&);
+template<class T> bool operator==(const complex<T>&, const complex<T>&); // constexpr in C++14
+template<class T> bool operator==(const complex<T>&, const T&); // constexpr in C++14
+template<class T> bool operator==(const T&, const complex<T>&); // constexpr in C++14
+template<class T> bool operator!=(const complex<T>&, const complex<T>&); // constexpr in C++14
+template<class T> bool operator!=(const complex<T>&, const T&); // constexpr in C++14
+template<class T> bool operator!=(const T&, const complex<T>&); // constexpr in C++14
+
+template<class T, class charT, class traits>
+  basic_istream<charT, traits>&
+  operator>>(basic_istream<charT, traits>&, complex<T>&);
+template<class T, class charT, class traits>
+  basic_ostream<charT, traits>&
+  operator<<(basic_ostream<charT, traits>&, const complex<T>&);
+
+// 26.3.7 values:
+
+template<class T>              T real(const complex<T>&); // constexpr in C++14
+                     long double real(long double);       // constexpr in C++14
+                          double real(double);            // constexpr in C++14
+template<Integral T>      double real(T);                 // constexpr in C++14
+                          float  real(float);             // constexpr in C++14
+
+template<class T>              T imag(const complex<T>&); // constexpr in C++14
+                     long double imag(long double);       // constexpr in C++14
+                          double imag(double);            // constexpr in C++14
+template<Integral T>      double imag(T);                 // constexpr in C++14
+                          float  imag(float);             // constexpr in C++14
+
+template<class T> T abs(const complex<T>&);
+
+template<class T>              T arg(const complex<T>&);
+                     long double arg(long double);
+                          double arg(double);
+template<Integral T>      double arg(T);
+                          float  arg(float);
+
+template<class T>              T norm(const complex<T>&);
+                     long double norm(long double);
+                          double norm(double);
+template<Integral T>      double norm(T);
+                          float  norm(float);
+
+template<class T>      complex<T>           conj(const complex<T>&);
+                       complex<long double> conj(long double);
+                       complex<double>      conj(double);
+template<Integral T>   complex<double>      conj(T);
+                       complex<float>       conj(float);
+
+template<class T>    complex<T>           proj(const complex<T>&);
+                     complex<long double> proj(long double);
+                     complex<double>      proj(double);
+template<Integral T> complex<double>      proj(T);
+                     complex<float>       proj(float);
+
+template<class T> complex<T> polar(const T&, const T& = 0);
+
+// 26.3.8 transcendentals:
+template<class T> complex<T> acos(const complex<T>&);
+template<class T> complex<T> asin(const complex<T>&);
+template<class T> complex<T> atan(const complex<T>&);
+template<class T> complex<T> acosh(const complex<T>&);
+template<class T> complex<T> asinh(const complex<T>&);
+template<class T> complex<T> atanh(const complex<T>&);
+template<class T> complex<T> cos (const complex<T>&);
+template<class T> complex<T> cosh (const complex<T>&);
+template<class T> complex<T> exp (const complex<T>&);
+template<class T> complex<T> log (const complex<T>&);
+template<class T> complex<T> log10(const complex<T>&);
+
+template<class T> complex<T> pow(const complex<T>&, const T&);
+template<class T> complex<T> pow(const complex<T>&, const complex<T>&);
+template<class T> complex<T> pow(const T&, const complex<T>&);
+
+template<class T> complex<T> sin (const complex<T>&);
+template<class T> complex<T> sinh (const complex<T>&);
+template<class T> complex<T> sqrt (const complex<T>&);
+template<class T> complex<T> tan (const complex<T>&);
+template<class T> complex<T> tanh (const complex<T>&);
+
+template<class T, class charT, class traits>
+  basic_istream<charT, traits>&
+  operator>>(basic_istream<charT, traits>& is, complex<T>& x);
+
+template<class T, class charT, class traits>
+  basic_ostream<charT, traits>&
+  operator<<(basic_ostream<charT, traits>& o, const complex<T>& x);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <type_traits>
+#include <stdexcept>
+#include <cmath>
+#include <sstream>
+#if defined(_LIBCPP_NO_EXCEPTIONS)
+    #include <cassert>
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY complex;
+
+template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
+template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
+
+template<class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY complex
+{
+public:
+    typedef _Tp value_type;
+private:
+    value_type __re_;
+    value_type __im_;
+public:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    complex(const value_type& __re = value_type(), const value_type& __im = value_type())
+        : __re_(__re), __im_(__im) {}
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    complex(const complex<_Xp>& __c)
+        : __re_(__c.real()), __im_(__c.imag()) {}
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type real() const {return __re_;}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type imag() const {return __im_;}
+
+    _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
+    _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
+
+    _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re)
+        {__re_ = __re; __im_ = value_type(); return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator/=(const value_type& __re) {__re_ /= __re; __im_ /= __re; return *this;}
+
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
+        {
+            __re_ = __c.real();
+            __im_ = __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
+        {
+            __re_ += __c.real();
+            __im_ += __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
+        {
+            __re_ -= __c.real();
+            __im_ -= __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
+        {
+            *this = *this * complex(__c.real(), __c.imag());
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
+        {
+            *this = *this / complex(__c.real(), __c.imag());
+            return *this;
+        }
+};
+
+template<> class _LIBCPP_TYPE_VIS_ONLY complex<double>;
+template<> class _LIBCPP_TYPE_VIS_ONLY complex<long double>;
+
+template<>
+class _LIBCPP_TYPE_VIS_ONLY complex<float>
+{
+    float __re_;
+    float __im_;
+public:
+    typedef float value_type;
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
+        : __re_(__re), __im_(__im) {}
+    explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
+    explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;}
+
+    _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
+    _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
+
+    _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re)
+        {__re_ = __re; __im_ = value_type(); return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator/=(float __re) {__re_ /= __re; __im_ /= __re; return *this;}
+
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
+        {
+            __re_ = __c.real();
+            __im_ = __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
+        {
+            __re_ += __c.real();
+            __im_ += __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
+        {
+            __re_ -= __c.real();
+            __im_ -= __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
+        {
+            *this = *this * complex(__c.real(), __c.imag());
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
+        {
+            *this = *this / complex(__c.real(), __c.imag());
+            return *this;
+        }
+};
+
+template<>
+class _LIBCPP_TYPE_VIS_ONLY complex<double>
+{
+    double __re_;
+    double __im_;
+public:
+    typedef double value_type;
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
+        : __re_(__re), __im_(__im) {}
+    _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
+    explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;}
+
+    _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
+    _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
+
+    _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re)
+        {__re_ = __re; __im_ = value_type(); return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator/=(double __re) {__re_ /= __re; __im_ /= __re; return *this;}
+
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
+        {
+            __re_ = __c.real();
+            __im_ = __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
+        {
+            __re_ += __c.real();
+            __im_ += __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
+        {
+            __re_ -= __c.real();
+            __im_ -= __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
+        {
+            *this = *this * complex(__c.real(), __c.imag());
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
+        {
+            *this = *this / complex(__c.real(), __c.imag());
+            return *this;
+        }
+};
+
+template<>
+class _LIBCPP_TYPE_VIS_ONLY complex<long double>
+{
+    long double __re_;
+    long double __im_;
+public:
+    typedef long double value_type;
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
+        : __re_(__re), __im_(__im) {}
+    _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
+    _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;}
+
+    _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
+    _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
+
+    _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re)
+        {__re_ = __re; __im_ = value_type(); return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
+    _LIBCPP_INLINE_VISIBILITY complex& operator/=(long double __re) {__re_ /= __re; __im_ /= __re; return *this;}
+
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
+        {
+            __re_ = __c.real();
+            __im_ = __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
+        {
+            __re_ += __c.real();
+            __im_ += __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
+        {
+            __re_ -= __c.real();
+            __im_ -= __c.imag();
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
+        {
+            *this = *this * complex(__c.real(), __c.imag());
+            return *this;
+        }
+    template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
+        {
+            *this = *this / complex(__c.real(), __c.imag());
+            return *this;
+        }
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+complex<float>::complex(const complex<double>& __c)
+    : __re_(__c.real()), __im_(__c.imag()) {}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+complex<float>::complex(const complex<long double>& __c)
+    : __re_(__c.real()), __im_(__c.imag()) {}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+complex<double>::complex(const complex<float>& __c)
+    : __re_(__c.real()), __im_(__c.imag()) {}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+complex<double>::complex(const complex<long double>& __c)
+    : __re_(__c.real()), __im_(__c.imag()) {}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+complex<long double>::complex(const complex<float>& __c)
+    : __re_(__c.real()), __im_(__c.imag()) {}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+complex<long double>::complex(const complex<double>& __c)
+    : __re_(__c.real()), __im_(__c.imag()) {}
+
+// 26.3.6 operators:
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
+{
+    complex<_Tp> __t(__x);
+    __t += __y;
+    return __t;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator+(const complex<_Tp>& __x, const _Tp& __y)
+{
+    complex<_Tp> __t(__x);
+    __t += __y;
+    return __t;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator+(const _Tp& __x, const complex<_Tp>& __y)
+{
+    complex<_Tp> __t(__y);
+    __t += __x;
+    return __t;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
+{
+    complex<_Tp> __t(__x);
+    __t -= __y;
+    return __t;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator-(const complex<_Tp>& __x, const _Tp& __y)
+{
+    complex<_Tp> __t(__x);
+    __t -= __y;
+    return __t;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator-(const _Tp& __x, const complex<_Tp>& __y)
+{
+    complex<_Tp> __t(-__y);
+    __t += __x;
+    return __t;
+}
+
+template<class _Tp>
+complex<_Tp>
+operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
+{
+    _Tp __a = __z.real();
+    _Tp __b = __z.imag();
+    _Tp __c = __w.real();
+    _Tp __d = __w.imag();
+    _Tp __ac = __a * __c;
+    _Tp __bd = __b * __d;
+    _Tp __ad = __a * __d;
+    _Tp __bc = __b * __c;
+    _Tp __x = __ac - __bd;
+    _Tp __y = __ad + __bc;
+    if (isnan(__x) && isnan(__y))
+    {
+        bool __recalc = false;
+        if (isinf(__a) || isinf(__b))
+        {
+            __a = copysign(isinf(__a) ? _Tp(1) : _Tp(0), __a);
+            __b = copysign(isinf(__b) ? _Tp(1) : _Tp(0), __b);
+            if (isnan(__c))
+                __c = copysign(_Tp(0), __c);
+            if (isnan(__d))
+                __d = copysign(_Tp(0), __d);
+            __recalc = true;
+        }
+        if (isinf(__c) || isinf(__d))
+        {
+            __c = copysign(isinf(__c) ? _Tp(1) : _Tp(0), __c);
+            __d = copysign(isinf(__d) ? _Tp(1) : _Tp(0), __d);
+            if (isnan(__a))
+                __a = copysign(_Tp(0), __a);
+            if (isnan(__b))
+                __b = copysign(_Tp(0), __b);
+            __recalc = true;
+        }
+        if (!__recalc && (isinf(__ac) || isinf(__bd) ||
+                          isinf(__ad) || isinf(__bc)))
+        {
+            if (isnan(__a))
+                __a = copysign(_Tp(0), __a);
+            if (isnan(__b))
+                __b = copysign(_Tp(0), __b);
+            if (isnan(__c))
+                __c = copysign(_Tp(0), __c);
+            if (isnan(__d))
+                __d = copysign(_Tp(0), __d);
+            __recalc = true;
+        }
+        if (__recalc)
+        {
+            __x = _Tp(INFINITY) * (__a * __c - __b * __d);
+            __y = _Tp(INFINITY) * (__a * __d + __b * __c);
+        }
+    }
+    return complex<_Tp>(__x, __y);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator*(const complex<_Tp>& __x, const _Tp& __y)
+{
+    complex<_Tp> __t(__x);
+    __t *= __y;
+    return __t;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator*(const _Tp& __x, const complex<_Tp>& __y)
+{
+    complex<_Tp> __t(__y);
+    __t *= __x;
+    return __t;
+}
+
+template<class _Tp>
+complex<_Tp>
+operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
+{
+    int __ilogbw = 0;
+    _Tp __a = __z.real();
+    _Tp __b = __z.imag();
+    _Tp __c = __w.real();
+    _Tp __d = __w.imag();
+    _Tp __logbw = logb(fmax(fabs(__c), fabs(__d)));
+    if (isfinite(__logbw))
+    {
+        __ilogbw = static_cast<int>(__logbw);
+        __c = scalbn(__c, -__ilogbw);
+        __d = scalbn(__d, -__ilogbw);
+    }
+    _Tp __denom = __c * __c + __d * __d;
+    _Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
+    _Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
+    if (isnan(__x) && isnan(__y))
+    {
+        if ((__denom == _Tp(0)) && (!isnan(__a) || !isnan(__b)))
+        {
+            __x = copysign(_Tp(INFINITY), __c) * __a;
+            __y = copysign(_Tp(INFINITY), __c) * __b;
+        }
+        else if ((isinf(__a) || isinf(__b)) && isfinite(__c) && isfinite(__d))
+        {
+            __a = copysign(isinf(__a) ? _Tp(1) : _Tp(0), __a);
+            __b = copysign(isinf(__b) ? _Tp(1) : _Tp(0), __b);
+            __x = _Tp(INFINITY) * (__a * __c + __b * __d);
+            __y = _Tp(INFINITY) * (__b * __c - __a * __d);
+        }
+        else if (isinf(__logbw) && __logbw > _Tp(0) && isfinite(__a) && isfinite(__b))
+        {
+            __c = copysign(isinf(__c) ? _Tp(1) : _Tp(0), __c);
+            __d = copysign(isinf(__d) ? _Tp(1) : _Tp(0), __d);
+            __x = _Tp(0) * (__a * __c + __b * __d);
+            __y = _Tp(0) * (__b * __c - __a * __d);
+        }
+    }
+    return complex<_Tp>(__x, __y);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator/(const complex<_Tp>& __x, const _Tp& __y)
+{
+    return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator/(const _Tp& __x, const complex<_Tp>& __y)
+{
+    complex<_Tp> __t(__x);
+    __t /= __y;
+    return __t;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator+(const complex<_Tp>& __x)
+{
+    return __x;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+operator-(const complex<_Tp>& __x)
+{
+    return complex<_Tp>(-__x.real(), -__x.imag());
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
+{
+    return __x.real() == __y.real() && __x.imag() == __y.imag();
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator==(const complex<_Tp>& __x, const _Tp& __y)
+{
+    return __x.real() == __y && __x.imag() == 0;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator==(const _Tp& __x, const complex<_Tp>& __y)
+{
+    return __x == __y.real() && 0 == __y.imag();
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
+{
+    return !(__x == __y);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator!=(const complex<_Tp>& __x, const _Tp& __y)
+{
+    return !(__x == __y);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator!=(const _Tp& __x, const complex<_Tp>& __y)
+{
+    return !(__x == __y);
+}
+
+// 26.3.7 values:
+
+// real
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp
+real(const complex<_Tp>& __c)
+{
+    return __c.real();
+}
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+long double
+real(long double __re)
+{
+    return __re;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+double
+real(double __re)
+{
+    return __re;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename enable_if
+<
+    is_integral<_Tp>::value,
+    double
+>::type
+real(_Tp  __re)
+{
+    return __re;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+float
+real(float  __re)
+{
+    return __re;
+}
+
+// imag
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp
+imag(const complex<_Tp>& __c)
+{
+    return __c.imag();
+}
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+long double
+imag(long double __re)
+{
+    return 0;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+double
+imag(double __re)
+{
+    return 0;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename enable_if
+<
+    is_integral<_Tp>::value,
+    double
+>::type
+imag(_Tp  __re)
+{
+    return 0;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+float
+imag(float  __re)
+{
+    return 0;
+}
+
+// abs
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+abs(const complex<_Tp>& __c)
+{
+    return hypot(__c.real(), __c.imag());
+}
+
+// arg
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+arg(const complex<_Tp>& __c)
+{
+    return atan2(__c.imag(), __c.real());
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+long double
+arg(long double __re)
+{
+    return atan2l(0.L, __re);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+double
+arg(double __re)
+{
+    return atan2(0., __re);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value,
+    double
+>::type
+arg(_Tp __re)
+{
+    return atan2(0., __re);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+float
+arg(float __re)
+{
+    return atan2f(0.F, __re);
+}
+
+// norm
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+norm(const complex<_Tp>& __c)
+{
+    if (isinf(__c.real()))
+        return abs(__c.real());
+    if (isinf(__c.imag()))
+        return abs(__c.imag());
+    return __c.real() * __c.real() + __c.imag() * __c.imag();
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+long double
+norm(long double __re)
+{
+    return __re * __re;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+double
+norm(double __re)
+{
+    return __re * __re;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value,
+    double
+>::type
+norm(_Tp __re)
+{
+    return (double)__re * __re;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+float
+norm(float __re)
+{
+    return __re * __re;
+}
+
+// conj
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+conj(const complex<_Tp>& __c)
+{
+    return complex<_Tp>(__c.real(), -__c.imag());
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+complex<long double>
+conj(long double __re)
+{
+    return complex<long double>(__re);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+complex<double>
+conj(double __re)
+{
+    return complex<double>(__re);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value,
+    complex<double>
+>::type
+conj(_Tp __re)
+{
+    return complex<double>(__re);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+complex<float>
+conj(float __re)
+{
+    return complex<float>(__re);
+}
+
+// proj
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+proj(const complex<_Tp>& __c)
+{
+    std::complex<_Tp> __r = __c;
+    if (isinf(__c.real()) || isinf(__c.imag()))
+        __r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
+    return __r;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+complex<long double>
+proj(long double __re)
+{
+    if (isinf(__re))
+        __re = abs(__re);
+    return complex<long double>(__re);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+complex<double>
+proj(double __re)
+{
+    if (isinf(__re))
+        __re = abs(__re);
+    return complex<double>(__re);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value,
+    complex<double>
+>::type
+proj(_Tp __re)
+{
+    return complex<double>(__re);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+complex<float>
+proj(float __re)
+{
+    if (isinf(__re))
+        __re = abs(__re);
+    return complex<float>(__re);
+}
+
+// polar
+
+template<class _Tp>
+complex<_Tp>
+polar(const _Tp& __rho, const _Tp& __theta = _Tp(0))
+{
+    if (isnan(__rho) || signbit(__rho))
+        return complex<_Tp>(_Tp(NAN), _Tp(NAN));
+    if (isnan(__theta))
+    {
+        if (isinf(__rho))
+            return complex<_Tp>(__rho, __theta);
+        return complex<_Tp>(__theta, __theta);
+    }
+    if (isinf(__theta))
+    {
+        if (isinf(__rho))
+            return complex<_Tp>(__rho, _Tp(NAN));
+        return complex<_Tp>(_Tp(NAN), _Tp(NAN));
+    }
+    _Tp __x = __rho * cos(__theta);
+    if (isnan(__x))
+        __x = 0;
+    _Tp __y = __rho * sin(__theta);
+    if (isnan(__y))
+        __y = 0;
+    return complex<_Tp>(__x, __y);
+}
+
+// log
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+log(const complex<_Tp>& __x)
+{
+    return complex<_Tp>(log(abs(__x)), arg(__x));
+}
+
+// log10
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+log10(const complex<_Tp>& __x)
+{
+    return log(__x) / log(_Tp(10));
+}
+
+// sqrt
+
+template<class _Tp>
+complex<_Tp>
+sqrt(const complex<_Tp>& __x)
+{
+    if (isinf(__x.imag()))
+        return complex<_Tp>(_Tp(INFINITY), __x.imag());
+    if (isinf(__x.real()))
+    {
+        if (__x.real() > _Tp(0))
+            return complex<_Tp>(__x.real(), isnan(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag()));
+        return complex<_Tp>(isnan(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag()));
+    }
+    return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
+}
+
+// exp
+
+template<class _Tp>
+complex<_Tp>
+exp(const complex<_Tp>& __x)
+{
+    _Tp __i = __x.imag();
+    if (isinf(__x.real()))
+    {
+        if (__x.real() < _Tp(0))
+        {
+            if (!isfinite(__i))
+                __i = _Tp(1);
+        }
+        else if (__i == 0 || !isfinite(__i))
+        {
+            if (isinf(__i))
+                __i = _Tp(NAN);
+            return complex<_Tp>(__x.real(), __i);
+        }
+    }
+    else if (isnan(__x.real()) && __x.imag() == 0)
+        return __x;
+    _Tp __e = exp(__x.real());
+    return complex<_Tp>(__e * cos(__i), __e * sin(__i));
+}
+
+// pow
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
+{
+    return exp(__y * log(__x));
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<typename __promote<_Tp, _Up>::type>
+pow(const complex<_Tp>& __x, const complex<_Up>& __y)
+{
+    typedef complex<typename __promote<_Tp, _Up>::type> result_type;
+    return _VSTD::pow(result_type(__x), result_type(__y));
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_arithmetic<_Up>::value,
+    complex<typename __promote<_Tp, _Up>::type>
+>::type
+pow(const complex<_Tp>& __x, const _Up& __y)
+{
+    typedef complex<typename __promote<_Tp, _Up>::type> result_type;
+    return _VSTD::pow(result_type(__x), result_type(__y));
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_arithmetic<_Tp>::value,
+    complex<typename __promote<_Tp, _Up>::type>
+>::type
+pow(const _Tp& __x, const complex<_Up>& __y)
+{
+    typedef complex<typename __promote<_Tp, _Up>::type> result_type;
+    return _VSTD::pow(result_type(__x), result_type(__y));
+}
+
+// asinh
+
+template<class _Tp>
+complex<_Tp>
+asinh(const complex<_Tp>& __x)
+{
+    const _Tp __pi(atan2(+0., -0.));
+    if (isinf(__x.real()))
+    {
+        if (isnan(__x.imag()))
+            return __x;
+        if (isinf(__x.imag()))
+            return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
+        return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
+    }
+    if (isnan(__x.real()))
+    {
+        if (isinf(__x.imag()))
+            return complex<_Tp>(__x.imag(), __x.real());
+        if (__x.imag() == 0)
+            return __x;
+        return complex<_Tp>(__x.real(), __x.real());
+    }
+    if (isinf(__x.imag()))
+        return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
+    complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) + _Tp(1)));
+    return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
+}
+
+// acosh
+
+template<class _Tp>
+complex<_Tp>
+acosh(const complex<_Tp>& __x)
+{
+    const _Tp __pi(atan2(+0., -0.));
+    if (isinf(__x.real()))
+    {
+        if (isnan(__x.imag()))
+            return complex<_Tp>(abs(__x.real()), __x.imag());
+        if (isinf(__x.imag()))
+        {
+            if (__x.real() > 0)
+                return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
+            else
+                return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
+        }
+        if (__x.real() < 0)
+            return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
+        return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
+    }
+    if (isnan(__x.real()))
+    {
+        if (isinf(__x.imag()))
+            return complex<_Tp>(abs(__x.imag()), __x.real());
+        return complex<_Tp>(__x.real(), __x.real());
+    }
+    if (isinf(__x.imag()))
+        return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag()));
+    complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1)));
+    return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag()));
+}
+
+// atanh
+
+template<class _Tp>
+complex<_Tp>
+atanh(const complex<_Tp>& __x)
+{
+    const _Tp __pi(atan2(+0., -0.));
+    if (isinf(__x.imag()))
+    {
+        return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
+    }
+    if (isnan(__x.imag()))
+    {
+        if (isinf(__x.real()) || __x.real() == 0)
+            return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag());
+        return complex<_Tp>(__x.imag(), __x.imag());
+    }
+    if (isnan(__x.real()))
+    {
+        return complex<_Tp>(__x.real(), __x.real());
+    }
+    if (isinf(__x.real()))
+    {
+        return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
+    }
+    if (abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0))
+    {
+        return complex<_Tp>(copysign(_Tp(INFINITY), __x.real()), copysign(_Tp(0), __x.imag()));
+    }
+    complex<_Tp> __z = log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
+    return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
+}
+
+// sinh
+
+template<class _Tp>
+complex<_Tp>
+sinh(const complex<_Tp>& __x)
+{
+    if (isinf(__x.real()) && !isfinite(__x.imag()))
+        return complex<_Tp>(__x.real(), _Tp(NAN));
+    if (__x.real() == 0 && !isfinite(__x.imag()))
+        return complex<_Tp>(__x.real(), _Tp(NAN));
+    if (__x.imag() == 0 && !isfinite(__x.real()))
+        return __x;
+    return complex<_Tp>(sinh(__x.real()) * cos(__x.imag()), cosh(__x.real()) * sin(__x.imag()));
+}
+
+// cosh
+
+template<class _Tp>
+complex<_Tp>
+cosh(const complex<_Tp>& __x)
+{
+    if (isinf(__x.real()) && !isfinite(__x.imag()))
+        return complex<_Tp>(abs(__x.real()), _Tp(NAN));
+    if (__x.real() == 0 && !isfinite(__x.imag()))
+        return complex<_Tp>(_Tp(NAN), __x.real());
+    if (__x.real() == 0 && __x.imag() == 0)
+        return complex<_Tp>(_Tp(1), __x.imag());
+    if (__x.imag() == 0 && !isfinite(__x.real()))
+        return complex<_Tp>(abs(__x.real()), __x.imag());
+    return complex<_Tp>(cosh(__x.real()) * cos(__x.imag()), sinh(__x.real()) * sin(__x.imag()));
+}
+
+// tanh
+
+template<class _Tp>
+complex<_Tp>
+tanh(const complex<_Tp>& __x)
+{
+    if (isinf(__x.real()))
+    {
+        if (!isfinite(__x.imag()))
+            return complex<_Tp>(_Tp(1), _Tp(0));
+        return complex<_Tp>(_Tp(1), copysign(_Tp(0), sin(_Tp(2) * __x.imag())));
+    }
+    if (isnan(__x.real()) && __x.imag() == 0)
+        return __x;
+    _Tp __2r(_Tp(2) * __x.real());
+    _Tp __2i(_Tp(2) * __x.imag());
+    _Tp __d(cosh(__2r) + cos(__2i));
+    _Tp __2rsh(sinh(__2r));
+    if (isinf(__2rsh) && isinf(__d))
+        return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
+                            __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
+    return  complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
+}
+
+// asin
+
+template<class _Tp>
+complex<_Tp>
+asin(const complex<_Tp>& __x)
+{
+    complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real()));
+    return complex<_Tp>(__z.imag(), -__z.real());
+}
+
+// acos
+
+template<class _Tp>
+complex<_Tp>
+acos(const complex<_Tp>& __x)
+{
+    const _Tp __pi(atan2(+0., -0.));
+    if (isinf(__x.real()))
+    {
+        if (isnan(__x.imag()))
+            return complex<_Tp>(__x.imag(), __x.real());
+        if (isinf(__x.imag()))
+        {
+            if (__x.real() < _Tp(0))
+                return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
+            return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
+        }
+        if (__x.real() < _Tp(0))
+            return complex<_Tp>(__pi, signbit(__x.imag()) ? -__x.real() : __x.real());
+        return complex<_Tp>(_Tp(0), signbit(__x.imag()) ? __x.real() : -__x.real());
+    }
+    if (isnan(__x.real()))
+    {
+        if (isinf(__x.imag()))
+            return complex<_Tp>(__x.real(), -__x.imag());
+        return complex<_Tp>(__x.real(), __x.real());
+    }
+    if (isinf(__x.imag()))
+        return complex<_Tp>(__pi/_Tp(2), -__x.imag());
+    if (__x.real() == 0)
+        return complex<_Tp>(__pi/_Tp(2), -__x.imag());
+    complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1)));
+    if (signbit(__x.imag()))
+        return complex<_Tp>(abs(__z.imag()), abs(__z.real()));
+    return complex<_Tp>(abs(__z.imag()), -abs(__z.real()));
+}
+
+// atan
+
+template<class _Tp>
+complex<_Tp>
+atan(const complex<_Tp>& __x)
+{
+    complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real()));
+    return complex<_Tp>(__z.imag(), -__z.real());
+}
+
+// sin
+
+template<class _Tp>
+complex<_Tp>
+sin(const complex<_Tp>& __x)
+{
+    complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real()));
+    return complex<_Tp>(__z.imag(), -__z.real());
+}
+
+// cos
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+complex<_Tp>
+cos(const complex<_Tp>& __x)
+{
+    return cosh(complex<_Tp>(-__x.imag(), __x.real()));
+}
+
+// tan
+
+template<class _Tp>
+complex<_Tp>
+tan(const complex<_Tp>& __x)
+{
+    complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real()));
+    return complex<_Tp>(__z.imag(), -__z.real());
+}
+
+template<class _Tp, class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
+{
+    if (__is.good())
+    {
+        ws(__is);
+        if (__is.peek() == _CharT('('))
+        {
+            __is.get();
+            _Tp __r;
+            __is >> __r;
+            if (!__is.fail())
+            {
+                ws(__is);
+                _CharT __c = __is.peek();
+                if (__c == _CharT(','))
+                {
+                    __is.get();
+                    _Tp __i;
+                    __is >> __i;
+                    if (!__is.fail())
+                    {
+                        ws(__is);
+                        __c = __is.peek();
+                        if (__c == _CharT(')'))
+                        {
+                            __is.get();
+                            __x = complex<_Tp>(__r, __i);
+                        }
+                        else
+                            __is.setstate(ios_base::failbit);
+                    }
+                    else
+                        __is.setstate(ios_base::failbit);
+                }
+                else if (__c == _CharT(')'))
+                {
+                    __is.get();
+                    __x = complex<_Tp>(__r, _Tp(0));
+                }
+                else
+                    __is.setstate(ios_base::failbit);
+            }
+            else
+                __is.setstate(ios_base::failbit);
+        }
+        else
+        {
+            _Tp __r;
+            __is >> __r;
+            if (!__is.fail())
+                __x = complex<_Tp>(__r, _Tp(0));
+            else
+                __is.setstate(ios_base::failbit);
+        }
+    }
+    else
+        __is.setstate(ios_base::failbit);
+    return __is;
+}
+
+template<class _Tp, class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
+{
+    basic_ostringstream<_CharT, _Traits> __s;
+    __s.flags(__os.flags());
+    __s.imbue(__os.getloc());
+    __s.precision(__os.precision());
+    __s << '(' << __x.real() << ',' << __x.imag() << ')';
+    return __os << __s.str();
+}
+
+#if _LIBCPP_STD_VER > 11 
+// Literal suffix for complex number literals [complex.literals]
+inline namespace literals
+{ 
+  inline namespace complex_literals
+  {
+    constexpr complex<long double> operator""il(long double __im)
+    {
+        return { 0.0l, __im };
+    }
+
+    constexpr complex<long double> operator""il(unsigned long long __im)
+    {
+        return { 0.0l, static_cast<long double>(__im) };
+    }
+
+
+    constexpr complex<double> operator""i(long double __im)
+    {
+        return { 0.0, static_cast<double>(__im) };
+    }
+
+    constexpr complex<double> operator""i(unsigned long long __im)
+    {
+        return { 0.0, static_cast<double>(__im) };
+    }
+
+
+    constexpr complex<float> operator""if(long double __im)
+    {
+        return { 0.0f, static_cast<float>(__im) };
+    }
+
+    constexpr complex<float> operator""if(unsigned long long __im)
+    {
+        return { 0.0f, static_cast<float>(__im) };
+    }
+  }
+}
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_COMPLEX

Property changes on: lab4/.minix-src/include/c++/complex
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/csetjmp
===================================================================
--- lab4/.minix-src/include/c++/csetjmp	(nonexistent)
+++ lab4/.minix-src/include/c++/csetjmp	(revision 13)
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+//===--------------------------- csetjmp ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CSETJMP
+#define _LIBCPP_CSETJMP
+
+/*
+    csetjmp synopsis
+
+Macros:
+
+    setjmp
+
+namespace std
+{
+
+Types:
+
+    jmp_buf
+
+void longjmp(jmp_buf env, int val);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <setjmp.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifndef setjmp
+#define setjmp(env) setjmp(env)
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::jmp_buf;
+using ::longjmp;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CSETJMP

Property changes on: lab4/.minix-src/include/c++/csetjmp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cstdbool
===================================================================
--- lab4/.minix-src/include/c++/cstdbool	(nonexistent)
+++ lab4/.minix-src/include/c++/cstdbool	(revision 13)
@@ -0,0 +1,32 @@
+// -*- C++ -*-
+//===--------------------------- cstdbool ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CSTDBOOL
+#define _LIBCPP_CSTDBOOL
+
+/*
+    cstdbool synopsis
+
+Macros:
+
+    __bool_true_false_are_defined
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#undef __bool_true_false_are_defined
+#define __bool_true_false_are_defined 1
+
+#endif  // _LIBCPP_CSTDBOOL

Property changes on: lab4/.minix-src/include/c++/cstdbool
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cstdarg
===================================================================
--- lab4/.minix-src/include/c++/cstdarg	(nonexistent)
+++ lab4/.minix-src/include/c++/cstdarg	(revision 13)
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+//===--------------------------- cstdarg ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CSTDARG
+#define _LIBCPP_CSTDARG
+
+/*
+    cstdarg synopsis
+
+Macros:
+
+    type va_arg(va_list ap, type);
+    void va_copy(va_list dest, va_list src);  // C99
+    void va_end(va_list ap);
+    void va_start(va_list ap, parmN);
+
+namespace std
+{
+
+Types:
+
+    va_list
+
+}  // std
+
+*/
+
+#include <__config>
+#include <stdarg.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::va_list;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CSTDARG

Property changes on: lab4/.minix-src/include/c++/cstdarg
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cstdint
===================================================================
--- lab4/.minix-src/include/c++/cstdint	(nonexistent)
+++ lab4/.minix-src/include/c++/cstdint	(revision 13)
@@ -0,0 +1,191 @@
+// -*- C++ -*-
+//===--------------------------- cstdint ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CSTDINT
+#define _LIBCPP_CSTDINT
+
+/*
+    cstdint synopsis
+
+Macros:
+
+    INT8_MIN
+    INT16_MIN
+    INT32_MIN
+    INT64_MIN
+
+    INT8_MAX
+    INT16_MAX
+    INT32_MAX
+    INT64_MAX
+
+    UINT8_MAX
+    UINT16_MAX
+    UINT32_MAX
+    UINT64_MAX
+
+    INT_LEAST8_MIN
+    INT_LEAST16_MIN
+    INT_LEAST32_MIN
+    INT_LEAST64_MIN
+
+    INT_LEAST8_MAX
+    INT_LEAST16_MAX
+    INT_LEAST32_MAX
+    INT_LEAST64_MAX
+
+    UINT_LEAST8_MAX
+    UINT_LEAST16_MAX
+    UINT_LEAST32_MAX
+    UINT_LEAST64_MAX
+
+    INT_FAST8_MIN
+    INT_FAST16_MIN
+    INT_FAST32_MIN
+    INT_FAST64_MIN
+
+    INT_FAST8_MAX
+    INT_FAST16_MAX
+    INT_FAST32_MAX
+    INT_FAST64_MAX
+
+    UINT_FAST8_MAX
+    UINT_FAST16_MAX
+    UINT_FAST32_MAX
+    UINT_FAST64_MAX
+
+    INTPTR_MIN
+    INTPTR_MAX
+    UINTPTR_MAX
+
+    INTMAX_MIN
+    INTMAX_MAX
+
+    UINTMAX_MAX
+
+    PTRDIFF_MIN
+    PTRDIFF_MAX
+
+    SIG_ATOMIC_MIN
+    SIG_ATOMIC_MAX
+
+    SIZE_MAX
+
+    WCHAR_MIN
+    WCHAR_MAX
+
+    WINT_MIN
+    WINT_MAX
+
+    INT8_C(value)
+    INT16_C(value)
+    INT32_C(value)
+    INT64_C(value)
+
+    UINT8_C(value)
+    UINT16_C(value)
+    UINT32_C(value)
+    UINT64_C(value)
+
+    INTMAX_C(value)
+    UINTMAX_C(value)
+
+namespace std
+{
+
+Types:
+
+    int8_t
+    int16_t
+    int32_t
+    int64_t
+
+    uint8_t
+    uint16_t
+    uint32_t
+    uint64_t
+
+    int_least8_t
+    int_least16_t
+    int_least32_t
+    int_least64_t
+
+    uint_least8_t
+    uint_least16_t
+    uint_least32_t
+    uint_least64_t
+
+    int_fast8_t
+    int_fast16_t
+    int_fast32_t
+    int_fast64_t
+
+    uint_fast8_t
+    uint_fast16_t
+    uint_fast32_t
+    uint_fast64_t
+
+    intptr_t
+    uintptr_t
+
+    intmax_t
+    uintmax_t
+
+}  // std
+*/
+
+#include <__config>
+#include <stdint.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using::int8_t;
+using::int16_t;
+using::int32_t;
+using::int64_t;
+
+using::uint8_t;
+using::uint16_t;
+using::uint32_t;
+using::uint64_t;
+
+using::int_least8_t;
+using::int_least16_t;
+using::int_least32_t;
+using::int_least64_t;
+
+using::uint_least8_t;
+using::uint_least16_t;
+using::uint_least32_t;
+using::uint_least64_t;
+
+using::int_fast8_t;
+using::int_fast16_t;
+using::int_fast32_t;
+using::int_fast64_t;
+
+using::uint_fast8_t;
+using::uint_fast16_t;
+using::uint_fast32_t;
+using::uint_fast64_t;
+
+using::intptr_t;
+using::uintptr_t;
+
+using::intmax_t;
+using::uintmax_t;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CSTDINT

Property changes on: lab4/.minix-src/include/c++/cstdint
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cstring
===================================================================
--- lab4/.minix-src/include/c++/cstring	(nonexistent)
+++ lab4/.minix-src/include/c++/cstring	(revision 13)
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+//===--------------------------- cstring ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CSTRING
+#define _LIBCPP_CSTRING
+
+/*
+    cstring synopsis
+
+Macros:
+
+    NULL
+
+namespace std
+{
+
+Types:
+
+    size_t
+
+void* memcpy(void* restrict s1, const void* restrict s2, size_t n);
+void* memmove(void* s1, const void* s2, size_t n);
+char* strcpy (char* restrict s1, const char* restrict s2);
+char* strncpy(char* restrict s1, const char* restrict s2, size_t n);
+char* strcat (char* restrict s1, const char* restrict s2);
+char* strncat(char* restrict s1, const char* restrict s2, size_t n);
+int memcmp(const void* s1, const void* s2, size_t n);
+int strcmp (const char* s1, const char* s2);
+int strncmp(const char* s1, const char* s2, size_t n);
+int strcoll(const char* s1, const char* s2);
+size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n);
+const void* memchr(const void* s, int c, size_t n);
+      void* memchr(      void* s, int c, size_t n);
+const char* strchr(const char* s, int c);
+      char* strchr(      char* s, int c);
+size_t strcspn(const char* s1, const char* s2);
+const char* strpbrk(const char* s1, const char* s2);
+      char* strpbrk(      char* s1, const char* s2);
+const char* strrchr(const char* s, int c);
+      char* strrchr(      char* s, int c);
+size_t strspn(const char* s1, const char* s2);
+const char* strstr(const char* s1, const char* s2);
+      char* strstr(      char* s1, const char* s2);
+char* strtok(char* restrict s1, const char* restrict s2);
+void* memset(void* s, int c, size_t n);
+char* strerror(int errnum);
+size_t strlen(const char* s);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <string.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::size_t;
+using ::memcpy;
+using ::memmove;
+using ::strcpy;
+using ::strncpy;
+using ::strcat;
+using ::strncat;
+using ::memcmp;
+using ::strcmp;
+using ::strncmp;
+using ::strcoll;
+using ::strxfrm;
+
+using ::memchr;
+
+using ::strchr;
+
+using ::strcspn;
+
+using ::strpbrk;
+
+using ::strrchr;
+
+using ::strspn;
+
+using ::strstr;
+
+// MSVCRT, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
+#if !defined(__GLIBC__) && !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
+inline _LIBCPP_INLINE_VISIBILITY       char* strchr(      char* __s, int __c) {return ::strchr(__s, __c);}
+inline _LIBCPP_INLINE_VISIBILITY       char* strpbrk(      char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
+inline _LIBCPP_INLINE_VISIBILITY       char* strrchr(      char* __s, int __c) {return ::strrchr(__s, __c);}
+inline _LIBCPP_INLINE_VISIBILITY       void* memchr(      void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
+inline _LIBCPP_INLINE_VISIBILITY       char* strstr(      char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
+#endif
+
+#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
+using ::strtok;
+#endif
+using ::memset;
+using ::strerror;
+using ::strlen;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CSTRING

Property changes on: lab4/.minix-src/include/c++/cstring
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cwchar
===================================================================
--- lab4/.minix-src/include/c++/cwchar	(nonexistent)
+++ lab4/.minix-src/include/c++/cwchar	(revision 13)
@@ -0,0 +1,225 @@
+// -*- C++ -*-
+//===--------------------------- cwchar -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CWCHAR
+#define _LIBCPP_CWCHAR
+
+/*
+    cwchar synopsis
+
+Macros:
+
+    NULL
+    WCHAR_MAX
+    WCHAR_MIN
+    WEOF
+
+namespace std
+{
+
+Types:
+
+    mbstate_t
+    size_t
+    tm
+    wint_t
+
+int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
+int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
+int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
+int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
+int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
+int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);  // C99
+int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
+int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg);  // C99
+int vwprintf(const wchar_t* restrict format, va_list arg);
+int vwscanf(const wchar_t* restrict format, va_list arg);  // C99
+int wprintf(const wchar_t* restrict format, ...);
+int wscanf(const wchar_t* restrict format, ...);
+wint_t fgetwc(FILE* stream);
+wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
+wint_t fputwc(wchar_t c, FILE* stream);
+int fputws(const wchar_t* restrict s, FILE* restrict stream);
+int fwide(FILE* stream, int mode);
+wint_t getwc(FILE* stream);
+wint_t getwchar();
+wint_t putwc(wchar_t c, FILE* stream);
+wint_t putwchar(wchar_t c);
+wint_t ungetwc(wint_t c, FILE* stream);
+double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
+float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr);         // C99
+long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr);  // C99
+long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
+long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);  // C99
+unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
+unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);  // C99
+wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
+wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
+wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
+wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
+int wcscmp(const wchar_t* s1, const wchar_t* s2);
+int wcscoll(const wchar_t* s1, const wchar_t* s2);
+int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
+size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
+const wchar_t* wcschr(const wchar_t* s, wchar_t c);
+      wchar_t* wcschr(      wchar_t* s, wchar_t c);
+size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
+size_t wcslen(const wchar_t* s);
+const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
+      wchar_t* wcspbrk(      wchar_t* s1, const wchar_t* s2);
+const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
+      wchar_t* wcsrchr(      wchar_t* s, wchar_t c);
+size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
+const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
+      wchar_t* wcsstr(      wchar_t* s1, const wchar_t* s2);
+wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
+const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
+      wchar_t* wmemchr(      wchar_t* s, wchar_t c, size_t n);
+int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
+wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
+wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
+wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
+size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
+                const tm* restrict timeptr);
+wint_t btowc(int c);
+int wctob(wint_t c);
+int mbsinit(const mbstate_t* ps);
+size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
+size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
+size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
+size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
+                 mbstate_t* restrict ps);
+size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
+                 mbstate_t* restrict ps);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <cwctype>
+#include <wchar.h>
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+#include <support/win32/support.h> // pull in *swprintf defines
+#endif // _LIBCPP_MSVCRT
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::mbstate_t;
+using ::size_t;
+using ::tm;
+using ::wint_t;
+using ::FILE;
+using ::fwprintf;
+using ::fwscanf;
+using ::swprintf;
+using ::vfwprintf;
+using ::vswprintf;
+#ifndef _LIBCPP_MSVCRT
+using ::swscanf;
+using ::vfwscanf;
+using ::vswscanf;
+#endif // _LIBCPP_MSVCRT
+using ::fgetwc;
+using ::fgetws;
+using ::fputwc;
+using ::fputws;
+using ::fwide;
+using ::getwc;
+using ::putwc;
+using ::ungetwc;
+using ::wcstod;
+#ifndef _LIBCPP_MSVCRT
+using ::wcstof;
+using ::wcstold;
+#endif // _LIBCPP_MSVCRT
+using ::wcstol;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+using ::wcstoll;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+using ::wcstoul;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+using ::wcstoull;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+using ::wcscpy;
+using ::wcsncpy;
+using ::wcscat;
+using ::wcsncat;
+using ::wcscmp;
+using ::wcscoll;
+using ::wcsncmp;
+using ::wcsxfrm;
+
+#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
+
+using ::wcschr;
+using ::wcspbrk;
+using ::wcsrchr;
+using ::wcsstr;
+using ::wmemchr;
+
+#else
+
+inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
+inline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
+
+inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
+inline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcspbrk(      wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
+
+inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
+inline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcsrchr(      wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
+
+inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
+inline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcsstr(      wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
+
+inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
+inline _LIBCPP_INLINE_VISIBILITY       wchar_t* wmemchr(      wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
+
+#endif
+
+using ::wcscspn;
+using ::wcslen;
+using ::wcsspn;
+using ::wcstok;
+using ::wmemcmp;
+using ::wmemcpy;
+using ::wmemmove;
+using ::wmemset;
+using ::wcsftime;
+using ::btowc;
+using ::wctob;
+using ::mbsinit;
+using ::mbrlen;
+using ::mbrtowc;
+using ::wcrtomb;
+using ::mbsrtowcs;
+using ::wcsrtombs;
+
+#ifndef _LIBCPP_HAS_NO_STDIN
+using ::getwchar;
+#ifndef _LIBCPP_MSVCRT
+using ::vwscanf;
+#endif // _LIBCPP_MSVCRT
+using ::wscanf;
+#endif
+
+#ifndef _LIBCPP_HAS_NO_STDOUT
+using ::putwchar;
+using ::vwprintf;
+using ::wprintf;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CWCHAR

Property changes on: lab4/.minix-src/include/c++/cwchar
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cstdio
===================================================================
--- lab4/.minix-src/include/c++/cstdio	(nonexistent)
+++ lab4/.minix-src/include/c++/cstdio	(revision 13)
@@ -0,0 +1,209 @@
+// -*- C++ -*-
+//===---------------------------- cstdio ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CSTDIO
+#define _LIBCPP_CSTDIO
+
+/*
+    cstdio synopsis
+
+Macros:
+
+    BUFSIZ
+    EOF
+    FILENAME_MAX
+    FOPEN_MAX
+    L_tmpnam
+    NULL
+    SEEK_CUR
+    SEEK_END
+    SEEK_SET
+    TMP_MAX
+    _IOFBF
+    _IOLBF
+    _IONBF
+    stderr
+    stdin
+    stdout
+
+namespace std
+{
+
+Types:
+
+FILE
+fpos_t
+size_t
+
+int remove(const char* filename);
+int rename(const char* old, const char* new);
+FILE* tmpfile(void);
+char* tmpnam(char* s);
+int fclose(FILE* stream);
+int fflush(FILE* stream);
+FILE* fopen(const char* restrict filename, const char* restrict mode);
+FILE* freopen(const char* restrict filename, const char * restrict mode,
+              FILE * restrict stream);
+void setbuf(FILE* restrict stream, char* restrict buf);
+int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
+int fprintf(FILE* restrict stream, const char* restrict format, ...);
+int fscanf(FILE* restrict stream, const char * restrict format, ...);
+int printf(const char* restrict format, ...);
+int scanf(const char* restrict format, ...);
+int snprintf(char* restrict s, size_t n, const char* restrict format, ...);    // C99
+int sprintf(char* restrict s, const char* restrict format, ...);
+int sscanf(const char* restrict s, const char* restrict format, ...);
+int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
+int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg);  // C99
+int vprintf(const char* restrict format, va_list arg);
+int vscanf(const char* restrict format, va_list arg);                          // C99
+int vsnprintf(char* restrict s, size_t n, const char* restrict format,         // C99
+              va_list arg);
+int vsprintf(char* restrict s, const char* restrict format, va_list arg);
+int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
+int fgetc(FILE* stream);
+char* fgets(char* restrict s, int n, FILE* restrict stream);
+int fputc(int c, FILE* stream);
+int fputs(const char* restrict s, FILE* restrict stream);
+int getc(FILE* stream);
+int getchar(void);
+char* gets(char* s);  // removed in C++14
+int putc(int c, FILE* stream);
+int putchar(int c);
+int puts(const char* s);
+int ungetc(int c, FILE* stream);
+size_t fread(void* restrict ptr, size_t size, size_t nmemb,
+             FILE* restrict stream);
+size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
+              FILE* restrict stream);
+int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
+int fseek(FILE* stream, long offset, int whence);
+int fsetpos(FILE*stream, const fpos_t* pos);
+long ftell(FILE* stream);
+void rewind(FILE* stream);
+void clearerr(FILE* stream);
+int feof(FILE* stream);
+int ferror(FILE* stream);
+void perror(const char* s);
+
+}  // std
+*/
+
+#include <__config>
+#include <stdio.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+// snprintf
+#if defined(_LIBCPP_MSVCRT)
+#include "support/win32/support.h"
+#endif
+
+#ifdef getc
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
+#undef getc
+inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
+#endif  // getc
+
+#ifdef putc
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
+#undef putc
+inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
+#endif  // putc
+
+#ifdef clearerr
+inline _LIBCPP_INLINE_VISIBILITY void __libcpp_clearerr(FILE* __stream) { return clearerr(__stream); }
+#undef clearerr
+inline _LIBCPP_INLINE_VISIBILITY void clearerr(FILE* __stream) { return __libcpp_clearerr(__stream); }
+#endif  // clearerr
+
+#ifdef feof
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_feof(FILE* __stream) { return feof(__stream); }
+#undef feof
+inline _LIBCPP_INLINE_VISIBILITY int feof(FILE* __stream) { return __libcpp_feof(__stream); }
+#endif  // feof
+
+#ifdef ferror
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ferror(FILE* __stream) { return ferror(__stream); }
+#undef ferror
+inline _LIBCPP_INLINE_VISIBILITY int ferror(FILE* __stream) { return __libcpp_ferror(__stream); }
+#endif  // ferror
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::FILE;
+using ::fpos_t;
+using ::size_t;
+
+using ::fclose;
+using ::fflush;
+using ::setbuf;
+using ::setvbuf;
+using ::fprintf;
+using ::fscanf;
+using ::snprintf;
+using ::sprintf;
+using ::sscanf;
+#ifndef _LIBCPP_MSVCRT
+using ::vfprintf;
+using ::vfscanf;
+using ::vsscanf;
+#endif // _LIBCPP_MSVCRT
+using ::vsnprintf;
+using ::vsprintf;
+using ::fgetc;
+using ::fgets;
+using ::fputc;
+using ::fputs;
+using ::getc;
+using ::putc;
+using ::ungetc;
+using ::fread;
+using ::fwrite;
+using ::fgetpos;
+using ::fseek;
+using ::fsetpos;
+using ::ftell;
+using ::rewind;
+using ::clearerr;
+using ::feof;
+using ::ferror;
+using ::perror;
+
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+using ::fopen;
+using ::freopen;
+using ::remove;
+using ::rename;
+using ::tmpfile;
+using ::tmpnam;
+#endif
+
+#ifndef _LIBCPP_HAS_NO_STDIN
+using ::getchar;
+#if _LIBCPP_STD_VER <= 11
+using ::gets;
+#endif
+using ::scanf;
+using ::vscanf;
+#endif
+
+#ifndef _LIBCPP_HAS_NO_STDOUT
+using ::printf;
+using ::putchar;
+using ::puts;
+using ::vprintf;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CSTDIO

Property changes on: lab4/.minix-src/include/c++/cstdio
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/ctgmath
===================================================================
--- lab4/.minix-src/include/c++/ctgmath	(nonexistent)
+++ lab4/.minix-src/include/c++/ctgmath	(revision 13)
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//===-------------------------- ctgmath -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CTGMATH
+#define _LIBCPP_CTGMATH
+
+/*
+    ctgmath synopsis
+
+#include <ccomplex>
+#include <cmath>
+
+*/
+
+#include <ccomplex>
+#include <cmath>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#endif  // _LIBCPP_CTGMATH

Property changes on: lab4/.minix-src/include/c++/ctgmath
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/experimental/system_error
===================================================================
--- lab4/.minix-src/include/c++/experimental/system_error	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/system_error	(revision 13)
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+//===-------------------------- system_error ------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
+#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
+
+/**
+    experimental/system_error synopsis
+
+// C++1y
+
+#include <system_error>
+
+namespace std {
+namespace experimental {
+inline namespace fundamentals_v1 {
+
+  // See C++14 19.5, System error support
+  template <class T> constexpr bool is_error_code_enum_v
+    = is_error_code_enum<T>::value;
+  template <class T> constexpr bool is_error_condition_enum_v
+    = is_error_condition_enum<T>::value;
+
+} // namespace fundamentals_v1
+} // namespace experimental
+} // namespace std
+
+*/
+
+#include <experimental/__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <system_error>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
+#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_code_enum_v
+    = is_error_code_enum<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_condition_enum_v
+    = is_error_condition_enum<_Tp>::value;
+
+#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
+
+_LIBCPP_END_NAMESPACE_LFTS
+
+#endif /* _LIBCPP_STD_VER > 11 */
+
+#endif /* _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR */

Property changes on: lab4/.minix-src/include/c++/experimental/system_error
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/experimental/type_traits
===================================================================
--- lab4/.minix-src/include/c++/experimental/type_traits	(nonexistent)
+++ lab4/.minix-src/include/c++/experimental/type_traits	(revision 13)
@@ -0,0 +1,427 @@
+// -*- C++ -*-
+//===-------------------------- type_traits -------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
+#define _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
+
+/**
+    experimental/type_traits synopsis
+
+// C++1y
+#include <type_traits>
+
+namespace std {
+namespace experimental {
+inline namespace fundamentals_v1 {
+
+  // See C++14 20.10.4.1, primary type categories
+  template <class T> constexpr bool is_void_v
+    = is_void<T>::value;
+  template <class T> constexpr bool is_null_pointer_v
+    = is_null_pointer<T>::value;
+  template <class T> constexpr bool is_integral_v
+    = is_integral<T>::value;
+  template <class T> constexpr bool is_floating_point_v
+    = is_floating_point<T>::value;
+  template <class T> constexpr bool is_array_v
+    = is_array<T>::value;
+  template <class T> constexpr bool is_pointer_v
+    = is_pointer<T>::value;
+  template <class T> constexpr bool is_lvalue_reference_v
+    = is_lvalue_reference<T>::value;
+  template <class T> constexpr bool is_rvalue_reference_v
+    = is_rvalue_reference<T>::value;
+  template <class T> constexpr bool is_member_object_pointer_v
+    = is_member_object_pointer<T>::value;
+  template <class T> constexpr bool is_member_function_pointer_v
+    = is_member_function_pointer<T>::value;
+  template <class T> constexpr bool is_enum_v
+    = is_enum<T>::value;
+  template <class T> constexpr bool is_union_v
+    = is_union<T>::value;
+  template <class T> constexpr bool is_class_v
+    = is_class<T>::value;
+  template <class T> constexpr bool is_function_v
+    = is_function<T>::value;
+
+  // See C++14 20.10.4.2, composite type categories
+  template <class T> constexpr bool is_reference_v
+    = is_reference<T>::value;
+  template <class T> constexpr bool is_arithmetic_v
+    = is_arithmetic<T>::value;
+  template <class T> constexpr bool is_fundamental_v
+    = is_fundamental<T>::value;
+  template <class T> constexpr bool is_object_v
+    = is_object<T>::value;
+  template <class T> constexpr bool is_scalar_v
+    = is_scalar<T>::value;
+  template <class T> constexpr bool is_compound_v
+    = is_compound<T>::value;
+  template <class T> constexpr bool is_member_pointer_v
+    = is_member_pointer<T>::value;
+
+  // See C++14 20.10.4.3, type properties
+  template <class T> constexpr bool is_const_v
+    = is_const<T>::value;
+  template <class T> constexpr bool is_volatile_v
+    = is_volatile<T>::value;
+  template <class T> constexpr bool is_trivial_v
+    = is_trivial<T>::value;
+  template <class T> constexpr bool is_trivially_copyable_v
+    = is_trivially_copyable<T>::value;
+  template <class T> constexpr bool is_standard_layout_v
+    = is_standard_layout<T>::value;
+  template <class T> constexpr bool is_pod_v
+    = is_pod<T>::value;
+  template <class T> constexpr bool is_literal_type_v
+    = is_literal_type<T>::value;
+  template <class T> constexpr bool is_empty_v
+    = is_empty<T>::value;
+  template <class T> constexpr bool is_polymorphic_v
+    = is_polymorphic<T>::value;
+  template <class T> constexpr bool is_abstract_v
+    = is_abstract<T>::value;
+  template <class T> constexpr bool is_final_v
+    = is_final<T>::value;
+  template <class T> constexpr bool is_signed_v
+    = is_signed<T>::value;
+  template <class T> constexpr bool is_unsigned_v
+    = is_unsigned<T>::value;
+  template <class T, class... Args> constexpr bool is_constructible_v
+    = is_constructible<T, Args...>::value;
+  template <class T> constexpr bool is_default_constructible_v
+    = is_default_constructible<T>::value;
+  template <class T> constexpr bool is_copy_constructible_v
+    = is_copy_constructible<T>::value;
+  template <class T> constexpr bool is_move_constructible_v
+    = is_move_constructible<T>::value;
+  template <class T, class U> constexpr bool is_assignable_v
+    = is_assignable<T, U>::value;
+  template <class T> constexpr bool is_copy_assignable_v
+    = is_copy_assignable<T>::value;
+  template <class T> constexpr bool is_move_assignable_v
+    = is_move_assignable<T>::value;
+  template <class T> constexpr bool is_destructible_v
+    = is_destructible<T>::value;
+  template <class T, class... Args> constexpr bool is_trivially_constructible_v
+    = is_trivially_constructible<T, Args...>::value;
+  template <class T> constexpr bool is_trivially_default_constructible_v
+    = is_trivially_default_constructible<T>::value;
+  template <class T> constexpr bool is_trivially_copy_constructible_v
+    = is_trivially_copy_constructible<T>::value;
+  template <class T> constexpr bool is_trivially_move_constructible_v
+    = is_trivially_move_constructible<T>::value;
+  template <class T, class U> constexpr bool is_trivially_assignable_v
+    = is_trivially_assignable<T, U>::value;
+  template <class T> constexpr bool is_trivially_copy_assignable_v
+    = is_trivially_copy_assignable<T>::value;
+  template <class T> constexpr bool is_trivially_move_assignable_v
+    = is_trivially_move_assignable<T>::value;
+  template <class T> constexpr bool is_trivially_destructible_v
+    = is_trivially_destructible<T>::value;
+  template <class T, class... Args> constexpr bool is_nothrow_constructible_v
+    = is_nothrow_constructible<T, Args...>::value;
+  template <class T> constexpr bool is_nothrow_default_constructible_v
+    = is_nothrow_default_constructible<T>::value;
+  template <class T> constexpr bool is_nothrow_copy_constructible_v
+    = is_nothrow_copy_constructible<T>::value;
+  template <class T> constexpr bool is_nothrow_move_constructible_v
+    = is_nothrow_move_constructible<T>::value;
+  template <class T, class U> constexpr bool is_nothrow_assignable_v
+    = is_nothrow_assignable<T, U>::value;
+  template <class T> constexpr bool is_nothrow_copy_assignable_v
+    = is_nothrow_copy_assignable<T>::value;
+  template <class T> constexpr bool is_nothrow_move_assignable_v
+    = is_nothrow_move_assignable<T>::value;
+  template <class T> constexpr bool is_nothrow_destructible_v
+    = is_nothrow_destructible<T>::value;
+  template <class T> constexpr bool has_virtual_destructor_v
+    = has_virtual_destructor<T>::value;
+
+  // See C++14 20.10.5, type property queries
+  template <class T> constexpr size_t alignment_of_v
+    = alignment_of<T>::value;
+  template <class T> constexpr size_t rank_v
+    = rank<T>::value;
+  template <class T, unsigned I = 0> constexpr size_t extent_v
+    = extent<T, I>::value;
+
+  // See C++14 20.10.6, type relations
+  template <class T, class U> constexpr bool is_same_v
+    = is_same<T, U>::value;
+  template <class Base, class Derived> constexpr bool is_base_of_v
+    = is_base_of<Base, Derived>::value;
+  template <class From, class To> constexpr bool is_convertible_v
+    = is_convertible<From, To>::value;
+
+  // 3.3.2, Other type transformations
+  template <class> class invocation_type; // not defined
+  template <class F, class... ArgTypes> class invocation_type<F(ArgTypes...)>;
+  template <class> class raw_invocation_type; // not defined
+  template <class F, class... ArgTypes> class raw_invocation_type<F(ArgTypes...)>;
+
+  template <class T>
+    using invocation_type_t = typename invocation_type<T>::type;
+  template <class T>
+    using raw_invocation_type_t = typename raw_invocation_type<T>::type;
+
+} // namespace fundamentals_v1
+} // namespace experimental
+} // namespace std
+
+ */
+
+#include <experimental/__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
+#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+
+// C++14 20.10.4.1, primary type categories
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v
+    = is_void<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v
+    = is_null_pointer<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v
+    = is_integral<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v
+    = is_floating_point<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v
+    = is_array<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v
+    = is_pointer<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v
+    = is_lvalue_reference<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
+    = is_rvalue_reference<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
+    = is_member_object_pointer<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
+    = is_member_function_pointer<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v
+    = is_enum<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v
+    = is_union<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v
+    = is_class<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v
+    = is_function<_Tp>::value;
+
+// C++14 20.10.4.2,  composite type categories
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v
+    = is_reference<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v
+    = is_arithmetic<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v
+    = is_fundamental<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v
+    = is_object<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v
+    = is_scalar<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v
+    = is_compound<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v
+    = is_member_pointer<_Tp>::value;
+
+// C++14 20.10.4.3, type properties
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v
+    = is_const<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v
+    = is_volatile<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v
+    = is_trivial<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
+    = is_trivially_copyable<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v
+    = is_standard_layout<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v
+    = is_pod<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v
+    = is_literal_type<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v
+    = is_empty<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v
+    = is_polymorphic<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
+    = is_abstract<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
+    = is_final<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v
+    = is_signed<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v
+    = is_unsigned<_Tp>::value;
+
+template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_constructible_v
+    = is_constructible<_Tp, _Ts...>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v
+    = is_default_constructible<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v
+    = is_copy_constructible<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v
+    = is_move_constructible<_Tp>::value;
+
+template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_assignable_v
+    = is_assignable<_Tp, _Up>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v
+    = is_copy_assignable<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v
+    = is_move_assignable<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v
+    = is_destructible<_Tp>::value;
+
+template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
+    = is_trivially_constructible<_Tp, _Ts...>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v
+    = is_trivially_default_constructible<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v
+    = is_trivially_copy_constructible<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v
+    = is_trivially_move_constructible<_Tp>::value;
+
+template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v
+    = is_trivially_assignable<_Tp, _Up>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v
+    = is_trivially_copy_assignable<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v
+    = is_trivially_move_assignable<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v
+    = is_trivially_destructible<_Tp>::value;
+
+template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v
+    = is_nothrow_constructible<_Tp, _Ts...>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v
+    = is_nothrow_default_constructible<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v
+    = is_nothrow_copy_constructible<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v
+    = is_nothrow_move_constructible<_Tp>::value;
+
+template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v
+    = is_nothrow_assignable<_Tp, _Up>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
+    = is_nothrow_copy_assignable<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
+    = is_nothrow_move_assignable<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v
+    = is_nothrow_destructible<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v
+    = has_virtual_destructor<_Tp>::value;
+
+// C++14 20.10.5, type properties queries
+
+template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v
+    = alignment_of<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v
+    = rank<_Tp>::value;
+
+template <class _Tp, unsigned _Id = 0> _LIBCPP_CONSTEXPR size_t extent_v
+    = extent<_Tp, _Id>::value;
+
+// C++14 20.10.6, type relations
+
+template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v
+    = is_same<_Tp, _Up>::value;
+
+template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_base_of_v
+    = is_base_of<_Tp, _Up>::value;
+
+template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_convertible_v
+    = is_convertible<_Tp, _Up>::value;
+
+#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
+
+// 3.3.2, Other type transformations
+/*
+template <class>
+class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type;
+
+template <class _Fn, class ..._Args>
+class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type<_Fn(_Args...)>;
+
+template <class>
+class _LIBCPP_TYPE_VIS_ONLY invokation_type;
+
+template <class _Fn, class ..._Args>
+class _LIBCPP_TYPE_VIS_ONLY invokation_type<_Fn(_Args...)>;
+
+template <class _Tp>
+using invokation_type_t = typename invokation_type<_Tp>::type;
+
+template <class _Tp>
+using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
+*/
+
+_LIBCPP_END_NAMESPACE_LFTS
+
+#endif /* _LIBCPP_STD_VER > 11 */
+
+#endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */

Property changes on: lab4/.minix-src/include/c++/experimental/type_traits
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/ext/hash_map
===================================================================
--- lab4/.minix-src/include/c++/ext/hash_map	(nonexistent)
+++ lab4/.minix-src/include/c++/ext/hash_map	(revision 13)
@@ -0,0 +1,994 @@
+// -*- C++ -*-
+//===-------------------------- hash_map ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_HASH_MAP
+#define _LIBCPP_HASH_MAP
+
+/*
+
+    hash_map synopsis
+
+namespace __gnu_cxx
+{
+
+template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
+          class Alloc = allocator<pair<const Key, T>>>
+class hash_map
+{
+public:
+    // types
+    typedef Key                                                        key_type;
+    typedef T                                                          mapped_type;
+    typedef Hash                                                       hasher;
+    typedef Pred                                                       key_equal;
+    typedef Alloc                                                      allocator_type;
+    typedef pair<const key_type, mapped_type>                          value_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    typedef typename allocator_traits<allocator_type>::pointer         pointer;
+    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+    typedef typename allocator_traits<allocator_type>::size_type       size_type;
+    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+
+    typedef /unspecified/ iterator;
+    typedef /unspecified/ const_iterator;
+
+    explicit hash_map(size_type n = 193, const hasher& hf = hasher(),
+                           const key_equal& eql = key_equal(),
+                           const allocator_type& a = allocator_type());
+    template <class InputIterator>
+        hash_map(InputIterator f, InputIterator l,
+                      size_type n = 193, const hasher& hf = hasher(),
+                      const key_equal& eql = key_equal(),
+                      const allocator_type& a = allocator_type());
+    hash_map(const hash_map&);
+    ~hash_map();
+    hash_map& operator=(const hash_map&);
+
+    allocator_type get_allocator() const;
+
+    bool      empty() const;
+    size_type size() const;
+    size_type max_size() const;
+
+    iterator       begin();
+    iterator       end();
+    const_iterator begin()  const;
+    const_iterator end()    const;
+
+    pair<iterator, bool> insert(const value_type& obj);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+
+    void erase(const_iterator position);
+    size_type erase(const key_type& k);
+    void erase(const_iterator first, const_iterator last);
+    void clear();
+
+    void swap(hash_map&);
+
+    hasher hash_funct() const;
+    key_equal key_eq() const;
+
+    iterator       find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    size_type count(const key_type& k) const;
+    pair<iterator, iterator>             equal_range(const key_type& k);
+    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
+
+    mapped_type& operator[](const key_type& k);
+
+    size_type bucket_count() const;
+    size_type max_bucket_count() const;
+
+    size_type elems_in_bucket(size_type n) const;
+
+    void resize(size_type n);
+};
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    void swap(hash_map<Key, T, Hash, Pred, Alloc>& x,
+              hash_map<Key, T, Hash, Pred, Alloc>& y);
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    bool
+    operator==(const hash_map<Key, T, Hash, Pred, Alloc>& x,
+               const hash_map<Key, T, Hash, Pred, Alloc>& y);
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    bool
+    operator!=(const hash_map<Key, T, Hash, Pred, Alloc>& x,
+               const hash_map<Key, T, Hash, Pred, Alloc>& y);
+
+template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
+          class Alloc = allocator<pair<const Key, T>>>
+class hash_multimap
+{
+public:
+    // types
+    typedef Key                                                        key_type;
+    typedef T                                                          mapped_type;
+    typedef Hash                                                       hasher;
+    typedef Pred                                                       key_equal;
+    typedef Alloc                                                      allocator_type;
+    typedef pair<const key_type, mapped_type>                          value_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    typedef typename allocator_traits<allocator_type>::pointer         pointer;
+    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+    typedef typename allocator_traits<allocator_type>::size_type       size_type;
+    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+
+    typedef /unspecified/ iterator;
+    typedef /unspecified/ const_iterator;
+
+    explicit hash_multimap(size_type n = 193, const hasher& hf = hasher(),
+                           const key_equal& eql = key_equal(),
+                           const allocator_type& a = allocator_type());
+    template <class InputIterator>
+        hash_multimap(InputIterator f, InputIterator l,
+                      size_type n = 193, const hasher& hf = hasher(),
+                      const key_equal& eql = key_equal(),
+                      const allocator_type& a = allocator_type());
+    explicit hash_multimap(const allocator_type&);
+    hash_multimap(const hash_multimap&);
+    ~hash_multimap();
+    hash_multimap& operator=(const hash_multimap&);
+
+    allocator_type get_allocator() const;
+
+    bool      empty() const;
+    size_type size() const;
+    size_type max_size() const;
+
+    iterator       begin();
+    iterator       end();
+    const_iterator begin()  const;
+    const_iterator end()    const;
+
+    iterator insert(const value_type& obj);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+
+    void erase(const_iterator position);
+    size_type erase(const key_type& k);
+    void erase(const_iterator first, const_iterator last);
+    void clear();
+
+    void swap(hash_multimap&);
+
+    hasher hash_funct() const;
+    key_equal key_eq() const;
+
+    iterator       find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    size_type count(const key_type& k) const;
+    pair<iterator, iterator>             equal_range(const key_type& k);
+    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
+
+    size_type bucket_count() const;
+    size_type max_bucket_count() const;
+
+    size_type elems_in_bucket(size_type n) const;
+
+    void resize(size_type n);
+};
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    void swap(hash_multimap<Key, T, Hash, Pred, Alloc>& x,
+              hash_multimap<Key, T, Hash, Pred, Alloc>& y);
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    bool
+    operator==(const hash_multimap<Key, T, Hash, Pred, Alloc>& x,
+               const hash_multimap<Key, T, Hash, Pred, Alloc>& y);
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    bool
+    operator!=(const hash_multimap<Key, T, Hash, Pred, Alloc>& x,
+               const hash_multimap<Key, T, Hash, Pred, Alloc>& y);
+
+}  // __gnu_cxx
+
+*/
+
+#include <__config>
+#include <__hash_table>
+#include <functional>
+#include <stdexcept>
+#include <type_traits>
+#include <ext/__hash>
+
+#if __DEPRECATED
+#if defined(_MSC_VER) && ! defined(__clang__)
+    _LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated.  Migrate to <unordered_map>")
+#else
+#   warning Use of the header <ext/hash_map> is deprecated.  Migrate to <unordered_map>
+#endif
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+namespace __gnu_cxx {
+
+using namespace std;
+
+template <class _Tp, class _Hash,
+          bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value
+        >
+class __hash_map_hasher
+    : private _Hash
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : _Hash() {}
+    _LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
+    _LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const _Tp& __x) const
+        {return static_cast<const _Hash&>(*this)(__x.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const typename _Tp::first_type& __x) const
+        {return static_cast<const _Hash&>(*this)(__x);}
+};
+
+template <class _Tp, class _Hash>
+class __hash_map_hasher<_Tp, _Hash, false>
+{
+    _Hash __hash_;
+public:
+    _LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : __hash_() {}
+    _LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
+    _LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return __hash_;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const _Tp& __x) const
+        {return __hash_(__x.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const typename _Tp::first_type& __x) const
+        {return __hash_(__x);}
+};
+
+template <class _Tp, class _Pred,
+          bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
+         >
+class __hash_map_equal
+    : private _Pred
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY __hash_map_equal() : _Pred() {}
+    _LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
+    _LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
+        {return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
+        {return static_cast<const _Pred&>(*this)(__x, __y.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
+        {return static_cast<const _Pred&>(*this)(__x.first, __y);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const typename _Tp::first_type& __x,
+                    const typename _Tp::first_type& __y) const
+        {return static_cast<const _Pred&>(*this)(__x, __y);}
+};
+
+template <class _Tp, class _Pred>
+class __hash_map_equal<_Tp, _Pred, false>
+{
+    _Pred __pred_;
+public:
+    _LIBCPP_INLINE_VISIBILITY __hash_map_equal() : __pred_() {}
+    _LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return __pred_;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
+        {return __pred_(__x.first, __y.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
+        {return __pred_(__x, __y.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
+        {return __pred_(__x.first, __y);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const typename _Tp::first_type& __x,
+                    const typename _Tp::first_type& __y) const
+        {return __pred_(__x, __y);}
+};
+
+template <class _Alloc>
+class __hash_map_node_destructor
+{
+    typedef _Alloc                              allocator_type;
+    typedef allocator_traits<allocator_type>    __alloc_traits;
+    typedef typename __alloc_traits::value_type::value_type value_type;
+public:
+    typedef typename __alloc_traits::pointer    pointer;
+private:
+    typedef typename value_type::first_type     first_type;
+    typedef typename value_type::second_type    second_type;
+
+    allocator_type& __na_;
+
+    __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
+
+public:
+    bool __first_constructed;
+    bool __second_constructed;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __hash_map_node_destructor(allocator_type& __na)
+        : __na_(__na),
+          __first_constructed(false),
+          __second_constructed(false)
+        {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
+        : __na_(__x.__na_),
+          __first_constructed(__x.__value_constructed),
+          __second_constructed(__x.__value_constructed)
+        {
+            __x.__value_constructed = false;
+        }
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
+        : __na_(__x.__na_),
+          __first_constructed(__x.__value_constructed),
+          __second_constructed(__x.__value_constructed)
+        {
+            const_cast<bool&>(__x.__value_constructed) = false;
+        }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    void operator()(pointer __p)
+    {
+        if (__second_constructed)
+            __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
+        if (__first_constructed)
+            __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
+        if (__p)
+            __alloc_traits::deallocate(__na_, __p, 1);
+    }
+};
+
+template <class _HashIterator>
+class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
+{
+    _HashIterator __i_;
+
+    typedef pointer_traits<typename _HashIterator::pointer>      __pointer_traits;
+    typedef const typename _HashIterator::value_type::first_type key_type;
+    typedef typename _HashIterator::value_type::second_type      mapped_type;
+public:
+    typedef forward_iterator_tag                                 iterator_category;
+    typedef pair<key_type, mapped_type>                          value_type;
+    typedef typename _HashIterator::difference_type              difference_type;
+    typedef value_type&                                          reference;
+    typedef typename __pointer_traits::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<value_type>
+#else
+            rebind<value_type>::other
+#endif
+                                                                 pointer;
+
+    _LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
+
+    _LIBCPP_INLINE_VISIBILITY __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
+
+    _LIBCPP_INLINE_VISIBILITY reference operator*() const {return *operator->();}
+    _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return (pointer)__i_.operator->();}
+
+    _LIBCPP_INLINE_VISIBILITY __hash_map_iterator& operator++() {++__i_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_iterator operator++(int)
+    {
+        __hash_map_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY 
+    bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
+        {return __x.__i_ == __y.__i_;}
+    friend _LIBCPP_INLINE_VISIBILITY 
+    bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
+        {return __x.__i_ != __y.__i_;}
+
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
+};
+
+template <class _HashIterator>
+class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
+{
+    _HashIterator __i_;
+
+    typedef pointer_traits<typename _HashIterator::pointer>      __pointer_traits;
+    typedef const typename _HashIterator::value_type::first_type key_type;
+    typedef typename _HashIterator::value_type::second_type      mapped_type;
+public:
+    typedef forward_iterator_tag                                 iterator_category;
+    typedef pair<key_type, mapped_type>                          value_type;
+    typedef typename _HashIterator::difference_type              difference_type;
+    typedef const value_type&                                    reference;
+    typedef typename __pointer_traits::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<const value_type>
+#else
+            rebind<const value_type>::other
+#endif
+                                                                 pointer;
+
+    _LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_const_iterator(
+            __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
+                : __i_(__i.__i_) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference operator*() const {return *operator->();}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const {return (pointer)__i_.operator->();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_const_iterator& operator++() {++__i_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_const_iterator operator++(int)
+    {
+        __hash_map_const_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
+        {return __x.__i_ == __y.__i_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
+        {return __x.__i_ != __y.__i_;}
+
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
+};
+
+template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
+          class _Alloc = allocator<pair<const _Key, _Tp> > >
+class _LIBCPP_TYPE_VIS_ONLY hash_map
+{
+public:
+    // types
+    typedef _Key                                           key_type;
+    typedef _Tp                                            mapped_type;
+    typedef _Tp                                            data_type;
+    typedef _Hash                                          hasher;
+    typedef _Pred                                          key_equal;
+    typedef _Alloc                                         allocator_type;
+    typedef pair<const key_type, mapped_type>              value_type;
+    typedef value_type&                                    reference;
+    typedef const value_type&                              const_reference;
+
+private:
+    typedef pair<key_type, mapped_type>                    __value_type;
+    typedef __hash_map_hasher<__value_type, hasher>   __hasher;
+    typedef __hash_map_equal<__value_type, key_equal> __key_equal;
+    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
+
+    typedef __hash_table<__value_type, __hasher,
+                         __key_equal,  __allocator_type>   __table;
+
+    __table __table_;
+
+    typedef typename __table::__node_pointer               __node_pointer;
+    typedef typename __table::__node_const_pointer         __node_const_pointer;
+    typedef typename __table::__node_traits                __node_traits;
+    typedef typename __table::__node_allocator             __node_allocator;
+    typedef typename __table::__node                       __node;
+    typedef __hash_map_node_destructor<__node_allocator>   _Dp;
+    typedef unique_ptr<__node, _Dp>                         __node_holder;
+    typedef allocator_traits<allocator_type>               __alloc_traits;
+public:
+    typedef typename __alloc_traits::pointer         pointer;
+    typedef typename __alloc_traits::const_pointer   const_pointer;
+    typedef typename __alloc_traits::size_type       size_type;
+    typedef typename __alloc_traits::difference_type difference_type;
+
+    typedef __hash_map_iterator<typename __table::iterator>       iterator;
+    typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY hash_map() {__table_.rehash(193);}
+    explicit hash_map(size_type __n, const hasher& __hf = hasher(),
+                           const key_equal& __eql = key_equal());
+    hash_map(size_type __n, const hasher& __hf,
+                  const key_equal& __eql,
+                  const allocator_type& __a);
+    template <class _InputIterator>
+        hash_map(_InputIterator __first, _InputIterator __last);
+    template <class _InputIterator>
+        hash_map(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf = hasher(),
+                      const key_equal& __eql = key_equal());
+    template <class _InputIterator>
+        hash_map(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf,
+                      const key_equal& __eql,
+                      const allocator_type& __a);
+    hash_map(const hash_map& __u);
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const
+        {return allocator_type(__table_.__node_alloc());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool      empty() const {return __table_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const  {return __table_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const {return __table_.max_size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       begin()        {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       end()          {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin()  const {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()    const {return __table_.end();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, bool> insert(const value_type& __x)
+        {return __table_.__insert_unique(__x);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
+    template <class _InputIterator>
+        void insert(_InputIterator __first, _InputIterator __last);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void erase(const_iterator __p) {__table_.erase(__p.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    void erase(const_iterator __first, const_iterator __last)
+        {__table_.erase(__first.__i_, __last.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() {__table_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(hash_map& __u) {__table_.swap(__u.__table_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    hasher hash_funct() const
+        {return __table_.hash_function().hash_function();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_equal key_eq() const
+        {return __table_.key_eq().key_eq();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       find(const key_type& __k)       {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, iterator>             equal_range(const key_type& __k)
+        {return __table_.__equal_range_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+        {return __table_.__equal_range_unique(__k);}
+
+    mapped_type& operator[](const key_type& __k);
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_count() const {return __table_.bucket_count();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_bucket_count() const {return __table_.max_bucket_count();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type elems_in_bucket(size_type __n) const
+        {return __table_.bucket_size(__n);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void resize(size_type __n) {__table_.rehash(__n);}
+
+private:
+    __node_holder __construct_node(const key_type& __k);
+};
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
+        size_type __n, const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+    __table_.rehash(__n);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
+        size_type __n, const hasher& __hf, const key_equal& __eql,
+        const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+    __table_.rehash(__n);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
+        _InputIterator __first, _InputIterator __last)
+{
+    __table_.rehash(193);
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
+        const hash_map& __u)
+    : __table_(__u.__table_)
+{
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
+{
+    __node_allocator& __na = __table_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
+    __h.get_deleter().__first_constructed = true;
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
+    __h.get_deleter().__second_constructed = true;
+    return _LIBCPP_EXPLICIT_MOVE(__h);  // explicitly moved for C++03
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
+                                                       _InputIterator __last)
+{
+    for (; __first != __last; ++__first)
+        __table_.__insert_unique(*__first);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+_Tp&
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
+{
+    iterator __i = find(__k);
+    if (__i != end())
+        return __i->second;
+    __node_holder __h = __construct_node(__k);
+    pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
+    __h.release();
+    return __r.first->second;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+     hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+bool
+operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+           const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+{
+    if (__x.size() != __y.size())
+        return false;
+    typedef typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
+                                                                 const_iterator;
+    for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
+            __i != __ex; ++__i)
+    {
+        const_iterator __j = __y.find(__i->first);
+        if (__j == __ey || !(*__i == *__j))
+            return false;
+    }
+    return true;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+           const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
+          class _Alloc = allocator<pair<const _Key, _Tp> > >
+class _LIBCPP_TYPE_VIS_ONLY hash_multimap
+{
+public:
+    // types
+    typedef _Key                                           key_type;
+    typedef _Tp                                            mapped_type;
+    typedef _Tp                                            data_type;
+    typedef _Hash                                          hasher;
+    typedef _Pred                                          key_equal;
+    typedef _Alloc                                         allocator_type;
+    typedef pair<const key_type, mapped_type>              value_type;
+    typedef value_type&                                    reference;
+    typedef const value_type&                              const_reference;
+
+private:
+    typedef pair<key_type, mapped_type>                    __value_type;
+    typedef __hash_map_hasher<__value_type, hasher>   __hasher;
+    typedef __hash_map_equal<__value_type, key_equal> __key_equal;
+    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
+
+    typedef __hash_table<__value_type, __hasher,
+                         __key_equal,  __allocator_type>   __table;
+
+    __table __table_;
+
+    typedef typename __table::__node_traits                __node_traits;
+    typedef typename __table::__node_allocator             __node_allocator;
+    typedef typename __table::__node                       __node;
+    typedef __hash_map_node_destructor<__node_allocator>   _Dp;
+    typedef unique_ptr<__node, _Dp>                         __node_holder;
+    typedef allocator_traits<allocator_type>               __alloc_traits;
+public:
+    typedef typename __alloc_traits::pointer         pointer;
+    typedef typename __alloc_traits::const_pointer   const_pointer;
+    typedef typename __alloc_traits::size_type       size_type;
+    typedef typename __alloc_traits::difference_type difference_type;
+
+    typedef __hash_map_iterator<typename __table::iterator>       iterator;
+    typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    hash_multimap() {__table_.rehash(193);}
+    explicit hash_multimap(size_type __n, const hasher& __hf = hasher(),
+                                const key_equal& __eql = key_equal());
+    hash_multimap(size_type __n, const hasher& __hf,
+                                const key_equal& __eql,
+                                const allocator_type& __a);
+    template <class _InputIterator>
+        hash_multimap(_InputIterator __first, _InputIterator __last);
+    template <class _InputIterator>
+        hash_multimap(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf = hasher(),
+                      const key_equal& __eql = key_equal());
+    template <class _InputIterator>
+        hash_multimap(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf,
+                      const key_equal& __eql,
+                      const allocator_type& __a);
+    hash_multimap(const hash_multimap& __u);
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const
+        {return allocator_type(__table_.__node_alloc());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool      empty() const {return __table_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const  {return __table_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const {return __table_.max_size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       begin()        {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       end()          {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin()  const {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()    const {return __table_.end();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
+    template <class _InputIterator>
+        void insert(_InputIterator __first, _InputIterator __last);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void erase(const_iterator __p) {__table_.erase(__p.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    void erase(const_iterator __first, const_iterator __last)
+        {__table_.erase(__first.__i_, __last.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() {__table_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(hash_multimap& __u) {__table_.swap(__u.__table_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    hasher hash_funct() const
+        {return __table_.hash_function().hash_function();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_equal key_eq() const
+        {return __table_.key_eq().key_eq();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       find(const key_type& __k)       {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, iterator>             equal_range(const key_type& __k)
+        {return __table_.__equal_range_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+        {return __table_.__equal_range_multi(__k);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_count() const {return __table_.bucket_count();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_bucket_count() const {return __table_.max_bucket_count();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type elems_in_bucket(size_type __n) const
+        {return __table_.bucket_size(__n);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void resize(size_type __n) {__table_.rehash(__n);}
+};
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
+        size_type __n, const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+    __table_.rehash(__n);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
+        size_type __n, const hasher& __hf, const key_equal& __eql,
+        const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+    __table_.rehash(__n);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
+        _InputIterator __first, _InputIterator __last)
+{
+    __table_.rehash(193);
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
+        const hash_multimap& __u)
+    : __table_(__u.__table_)
+{
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
+                                                            _InputIterator __last)
+{
+    for (; __first != __last; ++__first)
+        __table_.__insert_multi(*__first);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+     hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+bool
+operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+           const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+{
+    if (__x.size() != __y.size())
+        return false;
+    typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
+                                                                 const_iterator;
+    typedef pair<const_iterator, const_iterator> _EqRng;
+    for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
+    {
+        _EqRng __xeq = __x.equal_range(__i->first);
+        _EqRng __yeq = __y.equal_range(__i->first);
+        if (_VSTD::distance(__xeq.first, __xeq.second) !=
+            _VSTD::distance(__yeq.first, __yeq.second) ||
+                  !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+            return false;
+        __i = __xeq.second;
+    }
+    return true;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+           const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+{
+    return !(__x == __y);
+}
+
+} // __gnu_cxx
+
+#endif  // _LIBCPP_HASH_MAP

Property changes on: lab4/.minix-src/include/c++/ext/hash_map
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__config
===================================================================
--- lab4/.minix-src/include/c++/__config	(nonexistent)
+++ lab4/.minix-src/include/c++/__config	(revision 13)
@@ -0,0 +1,794 @@
+// -*- C++ -*-
+//===--------------------------- __config ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CONFIG
+#define _LIBCPP_CONFIG
+
+#if !defined(_MSC_VER) || defined(__clang__)
+#pragma GCC system_header
+#endif
+
+#ifdef __GNUC__
+#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
+#else
+#define _GNUC_VER 0
+#endif
+
+#define _LIBCPP_VERSION 3800
+
+#define _LIBCPP_ABI_VERSION 1
+
+#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
+#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
+
+#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
+
+
+#ifndef __has_attribute
+#define __has_attribute(__x) 0
+#endif
+#ifndef __has_builtin
+#define __has_builtin(__x) 0
+#endif
+#ifndef __has_extension
+#define __has_extension(__x) 0
+#endif
+#ifndef __has_feature
+#define __has_feature(__x) 0
+#endif
+// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
+// the compiler and '1' otherwise.
+#ifndef __is_identifier
+#define __is_identifier(__x) 1
+#endif
+
+
+#ifdef __LITTLE_ENDIAN__
+#if __LITTLE_ENDIAN__
+#define _LIBCPP_LITTLE_ENDIAN 1
+#define _LIBCPP_BIG_ENDIAN    0
+#endif  // __LITTLE_ENDIAN__
+#endif  // __LITTLE_ENDIAN__
+
+#ifdef __BIG_ENDIAN__
+#if __BIG_ENDIAN__
+#define _LIBCPP_LITTLE_ENDIAN 0
+#define _LIBCPP_BIG_ENDIAN    1
+#endif  // __BIG_ENDIAN__
+#endif  // __BIG_ENDIAN__
+
+#ifdef __FreeBSD__
+# include <sys/endian.h>
+#  if _BYTE_ORDER == _LITTLE_ENDIAN
+#   define _LIBCPP_LITTLE_ENDIAN 1
+#   define _LIBCPP_BIG_ENDIAN    0
+# else  // _BYTE_ORDER == _LITTLE_ENDIAN
+#   define _LIBCPP_LITTLE_ENDIAN 0
+#   define _LIBCPP_BIG_ENDIAN    1
+# endif  // _BYTE_ORDER == _LITTLE_ENDIAN
+# ifndef __LONG_LONG_SUPPORTED
+#  define _LIBCPP_HAS_NO_LONG_LONG
+# endif  // __LONG_LONG_SUPPORTED
+#endif  // __FreeBSD__
+
+#if defined(__NetBSD__) || defined(__minix)
+# include <sys/endian.h>
+#  if _BYTE_ORDER == _LITTLE_ENDIAN
+#   define _LIBCPP_LITTLE_ENDIAN 1
+#   define _LIBCPP_BIG_ENDIAN    0
+# else  // _BYTE_ORDER == _LITTLE_ENDIAN
+#   define _LIBCPP_LITTLE_ENDIAN 0
+#   define _LIBCPP_BIG_ENDIAN    1
+# endif  // _BYTE_ORDER == _LITTLE_ENDIAN
+# define _LIBCPP_HAS_QUICK_EXIT
+#endif  // __NetBSD__
+
+#if defined(__minix)
+# define _LIBCPP_HAS_NO_THREADS 1
+#endif  // defined(__minix)
+
+#ifdef _WIN32
+#  define _LIBCPP_LITTLE_ENDIAN 1
+#  define _LIBCPP_BIG_ENDIAN    0
+// Compiler intrinsics (MSVC)
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+#    define _LIBCPP_HAS_IS_BASE_OF
+#  endif
+#  if defined(_MSC_VER) && !defined(__clang__)
+#    define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
+#    define _LIBCPP_TOSTRING2(x) #x
+#    define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
+#    define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
+#  endif
+#  // If mingw not explicitly detected, assume using MS C runtime only.
+#  ifndef __MINGW32__
+#    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
+#  endif
+#endif  // _WIN32
+
+#ifdef __sun__
+# include <sys/isa_defs.h>
+# ifdef _LITTLE_ENDIAN
+#   define _LIBCPP_LITTLE_ENDIAN 1
+#   define _LIBCPP_BIG_ENDIAN    0
+# else
+#   define _LIBCPP_LITTLE_ENDIAN 0
+#   define _LIBCPP_BIG_ENDIAN    1
+# endif
+#endif // __sun__
+
+#if defined(__CloudABI__)
+  // Certain architectures provide arc4random(). Prefer using
+  // arc4random() over /dev/{u,}random to make it possible to obtain
+  // random data even when using sandboxing mechanisms such as chroots,
+  // Capsicum, etc.
+# define _LIBCPP_USING_ARC4_RANDOM
+#elif defined(__native_client__)
+  // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
+  // including accesses to the special files under /dev. C++11's
+  // std::random_device is instead exposed through a NaCl syscall.
+# define _LIBCPP_USING_NACL_RANDOM
+#elif defined(_WIN32)
+# define _LIBCPP_USING_WIN32_RANDOM
+#else
+# define _LIBCPP_USING_DEV_RANDOM
+#endif
+
+#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
+# include <endian.h>
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  define _LIBCPP_LITTLE_ENDIAN 1
+#  define _LIBCPP_BIG_ENDIAN    0
+# elif __BYTE_ORDER == __BIG_ENDIAN
+#  define _LIBCPP_LITTLE_ENDIAN 0
+#  define _LIBCPP_BIG_ENDIAN    1
+# else  // __BYTE_ORDER == __BIG_ENDIAN
+#  error unable to determine endian
+# endif
+#endif  // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
+
+#ifdef _WIN32
+
+// only really useful for a DLL
+#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
+# ifdef cxx_EXPORTS
+#  define _LIBCPP_HIDDEN
+#  define _LIBCPP_FUNC_VIS __declspec(dllexport)
+#  define _LIBCPP_TYPE_VIS __declspec(dllexport)
+# else
+#  define _LIBCPP_HIDDEN
+#  define _LIBCPP_FUNC_VIS __declspec(dllimport)
+#  define _LIBCPP_TYPE_VIS __declspec(dllimport)
+# endif
+#else
+# define _LIBCPP_HIDDEN
+# define _LIBCPP_FUNC_VIS
+# define _LIBCPP_TYPE_VIS
+#endif
+
+#define _LIBCPP_TYPE_VIS_ONLY
+#define _LIBCPP_FUNC_VIS_ONLY
+
+#ifndef _LIBCPP_INLINE_VISIBILITY
+# ifdef _LIBCPP_MSVC
+#  define _LIBCPP_INLINE_VISIBILITY __forceinline
+# else // MinGW GCC and Clang
+#  define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
+# endif
+#endif
+
+#ifndef _LIBCPP_EXCEPTION_ABI
+#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
+#endif
+
+#ifndef _LIBCPP_ALWAYS_INLINE
+# ifdef _LIBCPP_MSVC
+#  define _LIBCPP_ALWAYS_INLINE __forceinline
+# endif
+#endif
+
+#endif // _WIN32
+
+#ifndef _LIBCPP_HIDDEN
+#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
+#endif
+
+#ifndef _LIBCPP_FUNC_VIS
+#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
+#endif
+
+#ifndef _LIBCPP_TYPE_VIS
+#  if __has_attribute(__type_visibility__)
+#    define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
+#  else
+#    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
+#  endif
+#endif
+
+#ifndef _LIBCPP_TYPE_VIS_ONLY
+# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
+#endif
+
+#ifndef _LIBCPP_FUNC_VIS_ONLY
+# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
+#endif
+
+#ifndef _LIBCPP_INLINE_VISIBILITY
+#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
+#endif
+
+#ifndef _LIBCPP_EXCEPTION_ABI
+#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
+#endif
+
+#ifndef _LIBCPP_ALWAYS_INLINE
+#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), __always_inline__))
+#endif
+
+#if defined(__clang__)
+
+#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) &&        \
+    !defined(__arm__)
+#define _LIBCPP_ALTERNATE_STRING_LAYOUT
+#endif
+
+#if __has_feature(cxx_alignas)
+#  define _ALIGNAS_TYPE(x) alignas(x)
+#  define _ALIGNAS(x) alignas(x)
+#else
+#  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
+#  define _ALIGNAS(x) __attribute__((__aligned__(x)))
+#endif
+
+#if !__has_feature(cxx_alias_templates)
+#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#endif
+
+#if __cplusplus < 201103L
+typedef __char16_t char16_t;
+typedef __char32_t char32_t;
+#endif
+
+#if !(__has_feature(cxx_exceptions))
+#define _LIBCPP_NO_EXCEPTIONS
+#endif
+
+#if !(__has_feature(cxx_rtti))
+#define _LIBCPP_NO_RTTI
+#endif
+
+#if !(__has_feature(cxx_strong_enums))
+#define _LIBCPP_HAS_NO_STRONG_ENUMS
+#endif
+
+#if !(__has_feature(cxx_decltype))
+#define _LIBCPP_HAS_NO_DECLTYPE
+#endif
+
+#if __has_feature(cxx_attributes)
+#  define _LIBCPP_NORETURN [[noreturn]]
+#else
+#  define _LIBCPP_NORETURN __attribute__ ((noreturn))
+#endif
+
+#define _LIBCPP_UNUSED __attribute__((__unused__))
+
+#if !(__has_feature(cxx_defaulted_functions))
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#endif  // !(__has_feature(cxx_defaulted_functions))
+
+#if !(__has_feature(cxx_deleted_functions))
+#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#endif  // !(__has_feature(cxx_deleted_functions))
+
+#if !(__has_feature(cxx_lambdas))
+#define _LIBCPP_HAS_NO_LAMBDAS
+#endif
+
+#if !(__has_feature(cxx_nullptr))
+#define _LIBCPP_HAS_NO_NULLPTR
+#endif
+
+#if !(__has_feature(cxx_rvalue_references))
+#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
+
+#if !(__has_feature(cxx_static_assert))
+#define _LIBCPP_HAS_NO_STATIC_ASSERT
+#endif
+
+#if !(__has_feature(cxx_auto_type))
+#define _LIBCPP_HAS_NO_AUTO_TYPE
+#endif
+
+#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
+#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#endif
+
+#if !(__has_feature(cxx_variadic_templates))
+#define _LIBCPP_HAS_NO_VARIADICS
+#endif
+
+#if !(__has_feature(cxx_trailing_return))
+#define _LIBCPP_HAS_NO_TRAILING_RETURN
+#endif
+
+#if !(__has_feature(cxx_generalized_initializers))
+#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif
+
+#if __has_feature(is_base_of)
+#  define _LIBCPP_HAS_IS_BASE_OF
+#endif
+
+#if __has_feature(is_final)
+#  define _LIBCPP_HAS_IS_FINAL
+#endif
+
+// Objective-C++ features (opt-in)
+#if __has_feature(objc_arc)
+#define _LIBCPP_HAS_OBJC_ARC
+#endif
+
+#if __has_feature(objc_arc_weak)
+#define _LIBCPP_HAS_OBJC_ARC_WEAK
+#define _LIBCPP_HAS_NO_STRONG_ENUMS
+#endif
+
+#if !(__has_feature(cxx_constexpr))
+#define _LIBCPP_HAS_NO_CONSTEXPR
+#endif
+
+#if !(__has_feature(cxx_relaxed_constexpr))
+#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+#endif
+
+#if !(__has_feature(cxx_variable_templates))
+#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+#endif
+
+#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
+#if defined(__FreeBSD__)
+#define _LIBCPP_HAS_QUICK_EXIT
+#define _LIBCPP_HAS_C11_FEATURES
+#elif defined(__ANDROID__)
+#define _LIBCPP_HAS_QUICK_EXIT
+#elif defined(__linux__)
+#include <features.h>
+#if __GLIBC_PREREQ(2, 15)
+#define _LIBCPP_HAS_QUICK_EXIT
+#endif
+#if __GLIBC_PREREQ(2, 17)
+#define _LIBCPP_HAS_C11_FEATURES
+#endif
+#endif
+#endif
+
+#if (__has_feature(cxx_noexcept))
+#  define _NOEXCEPT noexcept
+#  define _NOEXCEPT_(x) noexcept(x)
+#  define _NOEXCEPT_OR_FALSE(x) noexcept(x)
+#else
+#  define _NOEXCEPT throw()
+#  define _NOEXCEPT_(x)
+#  define _NOEXCEPT_OR_FALSE(x) false
+#endif
+
+#if __has_feature(underlying_type)
+#  define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
+#endif
+
+#if __has_feature(is_literal)
+#  define _LIBCPP_IS_LITERAL(T) __is_literal(T)
+#endif
+
+// Inline namespaces are available in Clang regardless of C++ dialect.
+#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
+#define _LIBCPP_END_NAMESPACE_STD  } }
+#define _VSTD std::_LIBCPP_NAMESPACE
+
+namespace std {
+  inline namespace _LIBCPP_NAMESPACE {
+  }
+}
+
+#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
+#define _LIBCPP_HAS_NO_ASAN
+#endif
+
+#elif defined(__GNUC__)
+
+#define _ALIGNAS(x) __attribute__((__aligned__(x)))
+#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
+
+#define _LIBCPP_NORETURN __attribute__((noreturn))
+
+#define _LIBCPP_UNUSED __attribute__((__unused__))
+
+#if _GNUC_VER >= 407
+#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
+#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
+#define _LIBCPP_HAS_IS_FINAL
+#endif
+
+#if defined(__GNUC__) && _GNUC_VER >= 403
+#  define _LIBCPP_HAS_IS_BASE_OF
+#endif
+
+#if !__EXCEPTIONS
+#define _LIBCPP_NO_EXCEPTIONS
+#endif
+
+#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+// constexpr was added to GCC in 4.6.
+#if _GNUC_VER < 406
+#define _LIBCPP_HAS_NO_CONSTEXPR
+// Can only use constexpr in c++11 mode.
+#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
+#define _LIBCPP_HAS_NO_CONSTEXPR
+#endif
+
+// No version of GCC supports relaxed constexpr rules
+#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+// GCC 5 will support variable templates
+#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+
+#define _NOEXCEPT throw()
+#define _NOEXCEPT_(x)
+#define _NOEXCEPT_OR_FALSE(x) false
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+
+#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#define _LIBCPP_HAS_NO_DECLTYPE
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define _LIBCPP_HAS_NO_NULLPTR
+#define _LIBCPP_HAS_NO_STATIC_ASSERT
+#define _LIBCPP_HAS_NO_UNICODE_CHARS
+#define _LIBCPP_HAS_NO_VARIADICS
+#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
+#define _LIBCPP_HAS_NO_STRONG_ENUMS
+
+#else  // __GXX_EXPERIMENTAL_CXX0X__
+
+#define _LIBCPP_HAS_NO_TRAILING_RETURN
+#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
+
+#if _GNUC_VER < 403
+#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
+
+#if _GNUC_VER < 403
+#define _LIBCPP_HAS_NO_STATIC_ASSERT
+#endif
+
+#if _GNUC_VER < 404
+#define _LIBCPP_HAS_NO_DECLTYPE
+#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define _LIBCPP_HAS_NO_UNICODE_CHARS
+#define _LIBCPP_HAS_NO_VARIADICS
+#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif  // _GNUC_VER < 404
+
+#if _GNUC_VER < 406
+#define _LIBCPP_HAS_NO_NULLPTR
+#endif
+
+#if _GNUC_VER < 407
+#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#endif
+
+#endif  // __GXX_EXPERIMENTAL_CXX0X__
+
+#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
+#define _LIBCPP_END_NAMESPACE_STD  } }
+#define _VSTD std::_LIBCPP_NAMESPACE
+
+namespace std {
+namespace _LIBCPP_NAMESPACE {
+}
+using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
+}
+
+#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
+#define _LIBCPP_HAS_NO_ASAN
+#endif
+
+#elif defined(_LIBCPP_MSVC)
+
+#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
+#define _LIBCPP_HAS_NO_CONSTEXPR
+#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+#define _LIBCPP_HAS_NO_UNICODE_CHARS
+#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#define __alignof__ __alignof
+#define _LIBCPP_NORETURN __declspec(noreturn)
+#define _LIBCPP_UNUSED
+#define _ALIGNAS(x) __declspec(align(x))
+#define _LIBCPP_HAS_NO_VARIADICS
+
+#define _NOEXCEPT throw ()
+#define _NOEXCEPT_(x)
+#define _NOEXCEPT_OR_FALSE(x) false
+
+#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
+#define _LIBCPP_END_NAMESPACE_STD  }
+#define _VSTD std
+
+#  define _LIBCPP_WEAK
+namespace std {
+}
+
+#define _LIBCPP_HAS_NO_ASAN
+
+#elif defined(__IBMCPP__)
+
+#define _ALIGNAS(x) __attribute__((__aligned__(x)))
+#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
+#define _ATTRIBUTE(x) __attribute__((x))
+#define _LIBCPP_NORETURN __attribute__((noreturn))
+#define _LIBCPP_UNUSED
+
+#define _NOEXCEPT throw()
+#define _NOEXCEPT_(x)
+#define _NOEXCEPT_OR_FALSE(x) false
+
+#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
+#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#define _LIBCPP_HAS_NO_NULLPTR
+#define _LIBCPP_HAS_NO_UNICODE_CHARS
+#define _LIBCPP_HAS_IS_BASE_OF
+#define _LIBCPP_HAS_IS_FINAL
+#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+
+#if defined(_AIX)
+#define __MULTILOCALE_API
+#endif
+
+#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
+#define _LIBCPP_END_NAMESPACE_STD  } }
+#define _VSTD std::_LIBCPP_NAMESPACE
+
+namespace std {
+  inline namespace _LIBCPP_NAMESPACE {
+  }
+}
+
+#define _LIBCPP_HAS_NO_ASAN
+
+#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
+
+#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
+typedef unsigned short char16_t;
+typedef unsigned int   char32_t;
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+
+#ifndef __SIZEOF_INT128__
+#define _LIBCPP_HAS_NO_INT128
+#endif
+
+#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
+
+template <bool> struct __static_assert_test;
+template <> struct __static_assert_test<true> {};
+template <unsigned> struct __static_assert_check {};
+#define static_assert(__b, __m) \
+    typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
+    _LIBCPP_CONCAT(__t, __LINE__)
+
+#endif  // _LIBCPP_HAS_NO_STATIC_ASSERT
+
+#ifdef _LIBCPP_HAS_NO_DECLTYPE
+// GCC 4.6 provides __decltype in all standard modes.
+#if !__is_identifier(__decltype) || _GNUC_VER >= 406
+#  define decltype(__x) __decltype(__x)
+#else
+#  define decltype(__x) __typeof__(__x)
+#endif
+#endif
+
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#define _LIBCPP_CONSTEXPR
+#else
+#define _LIBCPP_CONSTEXPR constexpr
+#endif
+
+#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#define _LIBCPP_DEFAULT {}
+#else
+#define _LIBCPP_DEFAULT = default;
+#endif
+
+#ifdef __GNUC__
+#define _NOALIAS __attribute__((__malloc__))
+#else
+#define _NOALIAS
+#endif
+
+#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
+#   define _LIBCPP_EXPLICIT explicit
+#else
+#   define _LIBCPP_EXPLICIT
+#endif
+
+#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
+#   define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
+#endif
+
+#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
+#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
+    __lx __v_; \
+    _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
+    _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
+    _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
+    };
+#else  // _LIBCPP_HAS_NO_STRONG_ENUMS
+#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
+#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
+#endif  // _LIBCPP_HAS_NO_STRONG_ENUMS
+
+#ifdef _LIBCPP_DEBUG
+#   if _LIBCPP_DEBUG == 0
+#       define _LIBCPP_DEBUG_LEVEL 1
+#   elif _LIBCPP_DEBUG == 1
+#       define _LIBCPP_DEBUG_LEVEL 2
+#   else
+#       error Supported values for _LIBCPP_DEBUG are 0 and 1
+#   endif
+#   define _LIBCPP_EXTERN_TEMPLATE(...)
+#endif
+
+#ifndef _LIBCPP_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
+#endif
+
+#ifndef _LIBCPP_EXTERN_TEMPLATE2
+#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
+#endif
+
+#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
+#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
+#endif
+
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \
+    defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__) || defined(__minix)
+#define _LIBCPP_LOCALE__L_EXTENSIONS 1
+#endif
+
+#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \
+    !defined(__CloudABI__)
+#define _LIBCPP_HAS_CATOPEN 1
+#endif
+
+#ifdef __FreeBSD__
+#define _DECLARE_C99_LDBL_MATH 1
+#endif
+
+#if defined(__APPLE__) || defined(__FreeBSD__)
+#define _LIBCPP_HAS_DEFAULTRUNELOCALE
+#endif
+
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
+#define _LIBCPP_WCTYPE_IS_MASK
+#endif
+
+#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+#  define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
+#endif
+
+#ifndef _LIBCPP_STD_VER
+#  if  __cplusplus <= 201103L
+#    define _LIBCPP_STD_VER 11
+#  elif __cplusplus <= 201402L
+#    define _LIBCPP_STD_VER 14
+#  else
+#    define _LIBCPP_STD_VER 15  // current year, or date of c++17 ratification
+#  endif
+#endif  // _LIBCPP_STD_VER
+
+#if _LIBCPP_STD_VER > 11
+#define _LIBCPP_DEPRECATED [[deprecated]]
+#else
+#define _LIBCPP_DEPRECATED
+#endif
+
+#if _LIBCPP_STD_VER <= 11
+#define _LIBCPP_EXPLICIT_AFTER_CXX11
+#define _LIBCPP_DEPRECATED_AFTER_CXX11
+#else
+#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
+#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
+#endif
+
+#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
+#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
+#else
+#define _LIBCPP_CONSTEXPR_AFTER_CXX11
+#endif
+
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#  define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
+#else
+#  define _LIBCPP_EXPLICIT_MOVE(x) (x)
+#endif
+
+#ifndef _LIBCPP_HAS_NO_ASAN
+extern "C" void __sanitizer_annotate_contiguous_container(
+  const void *, const void *, const void *, const void *);
+#endif
+
+// Try to find out if RTTI is disabled.
+// g++ and cl.exe have RTTI on by default and define a macro when it is.
+// g++ only defines the macro in 4.3.2 and onwards.
+#if !defined(_LIBCPP_NO_RTTI)
+#  if defined(__GNUG__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
+   (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
+#    define _LIBCPP_NO_RTTI
+#  elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
+#    define _LIBCPP_NO_RTTI
+#  endif
+#endif
+
+#ifndef _LIBCPP_WEAK
+#  define _LIBCPP_WEAK __attribute__((__weak__))
+#endif
+
+#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
+#  error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
+         _LIBCPP_HAS_NO_THREADS is defined.
+#endif
+
+// Systems that use capability-based security (FreeBSD with Capsicum,
+// Nuxi CloudABI) may only provide local filesystem access (using *at()).
+// Functions like open(), rename(), unlink() and stat() should not be
+// used, as they attempt to access the global filesystem namespace.
+#ifdef __CloudABI__
+#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+#endif
+
+// CloudABI is intended for running networked services. Processes do not
+// have standard input and output channels.
+#ifdef __CloudABI__
+#define _LIBCPP_HAS_NO_STDIN
+#define _LIBCPP_HAS_NO_STDOUT
+#endif
+
+#if defined(__ANDROID__) || defined(__CloudABI__)
+#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
+#endif
+
+// Thread-unsafe functions such as strtok(), mbtowc() and localtime()
+// are not available.
+#ifdef __CloudABI__
+#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
+#endif
+
+#if __has_extension(c_atomic)
+#define _LIBCPP_HAS_C_ATOMIC_IMP
+#elif _GNUC_VER > 407
+#define _LIBCPP_HAS_GCC_ATOMIC_IMP
+#endif
+
+#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
+     || defined(_LIBCPP_HAS_NO_THREADS)
+#define _LIBCPP_HAS_NO_ATOMIC_HEADER
+#endif
+
+#endif // _LIBCPP_CONFIG

Property changes on: lab4/.minix-src/include/c++/__config
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__functional_base
===================================================================
--- lab4/.minix-src/include/c++/__functional_base	(nonexistent)
+++ lab4/.minix-src/include/c++/__functional_base	(revision 13)
@@ -0,0 +1,721 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_FUNCTIONAL_BASE
+#define _LIBCPP_FUNCTIONAL_BASE
+
+#include <__config>
+#include <type_traits>
+#include <typeinfo>
+#include <exception>
+#include <new>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Arg, class _Result>
+struct _LIBCPP_TYPE_VIS_ONLY unary_function
+{
+    typedef _Arg    argument_type;
+    typedef _Result result_type;
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+struct _LIBCPP_TYPE_VIS_ONLY binary_function
+{
+    typedef _Arg1   first_argument_type;
+    typedef _Arg2   second_argument_type;
+    typedef _Result result_type;
+};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
+
+template <class _Tp>
+struct __has_result_type
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::result_type* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY less : binary_function<_Tp, _Tp, bool>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 
+    bool operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x < __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY less<void>
+{
+    template <class _T1, class _T2> 
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+// addressof
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+addressof(_Tp& __x) _NOEXCEPT
+{
+    return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
+}
+
+#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
+// Objective-C++ Automatic Reference Counting uses qualified pointers
+// that require special addressof() signatures. When
+// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
+// itself is providing these definitions. Otherwise, we provide them.
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__strong _Tp*
+addressof(__strong _Tp& __x) _NOEXCEPT
+{
+  return &__x;
+}
+
+#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__weak _Tp*
+addressof(__weak _Tp& __x) _NOEXCEPT
+{
+  return &__x;
+}
+#endif
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__autoreleasing _Tp*
+addressof(__autoreleasing _Tp& __x) _NOEXCEPT
+{
+  return &__x;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__unsafe_unretained _Tp*
+addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
+{
+  return &__x;
+}
+#endif
+
+
+// __weak_result_type
+
+template <class _Tp>
+struct __derives_from_unary_function
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    static __two __test(...);
+    template <class _Ap, class _Rp>
+        static unary_function<_Ap, _Rp>
+        __test(const volatile unary_function<_Ap, _Rp>*);
+public:
+    static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
+    typedef decltype(__test((_Tp*)0)) type;
+};
+
+template <class _Tp>
+struct __derives_from_binary_function
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    static __two __test(...);
+    template <class _A1, class _A2, class _Rp>
+        static binary_function<_A1, _A2, _Rp>
+        __test(const volatile binary_function<_A1, _A2, _Rp>*);
+public:
+    static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
+    typedef decltype(__test((_Tp*)0)) type;
+};
+
+template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
+struct __maybe_derive_from_unary_function  // bool is true
+    : public __derives_from_unary_function<_Tp>::type
+{
+};
+
+template <class _Tp>
+struct __maybe_derive_from_unary_function<_Tp, false>
+{
+};
+
+template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
+struct __maybe_derive_from_binary_function  // bool is true
+    : public __derives_from_binary_function<_Tp>::type
+{
+};
+
+template <class _Tp>
+struct __maybe_derive_from_binary_function<_Tp, false>
+{
+};
+
+template <class _Tp, bool = __has_result_type<_Tp>::value>
+struct __weak_result_type_imp // bool is true
+    : public __maybe_derive_from_unary_function<_Tp>,
+      public __maybe_derive_from_binary_function<_Tp>
+{
+    typedef typename _Tp::result_type result_type;
+};
+
+template <class _Tp>
+struct __weak_result_type_imp<_Tp, false>
+    : public __maybe_derive_from_unary_function<_Tp>,
+      public __maybe_derive_from_binary_function<_Tp>
+{
+};
+
+template <class _Tp>
+struct __weak_result_type
+    : public __weak_result_type_imp<_Tp>
+{
+};
+
+// 0 argument case
+
+template <class _Rp>
+struct __weak_result_type<_Rp ()>
+{
+    typedef _Rp result_type;
+};
+
+template <class _Rp>
+struct __weak_result_type<_Rp (&)()>
+{
+    typedef _Rp result_type;
+};
+
+template <class _Rp>
+struct __weak_result_type<_Rp (*)()>
+{
+    typedef _Rp result_type;
+};
+
+// 1 argument case
+
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (_A1)>
+    : public unary_function<_A1, _Rp>
+{
+};
+
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (&)(_A1)>
+    : public unary_function<_A1, _Rp>
+{
+};
+
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (*)(_A1)>
+    : public unary_function<_A1, _Rp>
+{
+};
+
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)()>
+    : public unary_function<_Cp*, _Rp>
+{
+};
+
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() const>
+    : public unary_function<const _Cp*, _Rp>
+{
+};
+
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() volatile>
+    : public unary_function<volatile _Cp*, _Rp>
+{
+};
+
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() const volatile>
+    : public unary_function<const volatile _Cp*, _Rp>
+{
+};
+
+// 2 argument case
+
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_A1, _A2)>
+    : public binary_function<_A1, _A2, _Rp>
+{
+};
+
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (*)(_A1, _A2)>
+    : public binary_function<_A1, _A2, _Rp>
+{
+};
+
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (&)(_A1, _A2)>
+    : public binary_function<_A1, _A2, _Rp>
+{
+};
+
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1)>
+    : public binary_function<_Cp*, _A1, _Rp>
+{
+};
+
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
+    : public binary_function<const _Cp*, _A1, _Rp>
+{
+};
+
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
+    : public binary_function<volatile _Cp*, _A1, _Rp>
+{
+};
+
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
+    : public binary_function<const volatile _Cp*, _A1, _Rp>
+{
+};
+
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+// 3 or more arguments
+
+template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
+struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
+{
+    typedef _Rp result_type;
+};
+
+template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
+struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
+{
+    typedef _Rp result_type;
+};
+
+template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
+struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
+{
+    typedef _Rp result_type;
+};
+
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
+{
+    typedef _Rp result_type;
+};
+
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
+{
+    typedef _Rp result_type;
+};
+
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
+{
+    typedef _Rp result_type;
+};
+
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
+{
+    typedef _Rp result_type;
+};
+
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
+// __invoke
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+// bullets 1 and 2
+
+template <class _Fp, class _A0, class ..._Args,
+            class>
+inline _LIBCPP_INLINE_VISIBILITY
+auto
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+    -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
+{
+    return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
+}
+
+template <class _Fp, class _A0, class ..._Args,
+            class>
+inline _LIBCPP_INLINE_VISIBILITY
+auto
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+    -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
+{
+    return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
+}
+
+// bullets 3 and 4
+
+template <class _Fp, class _A0,
+            class>
+inline _LIBCPP_INLINE_VISIBILITY
+auto
+__invoke(_Fp&& __f, _A0&& __a0)
+    -> decltype(_VSTD::forward<_A0>(__a0).*__f)
+{
+    return _VSTD::forward<_A0>(__a0).*__f;
+}
+
+template <class _Fp, class _A0,
+            class>
+inline _LIBCPP_INLINE_VISIBILITY
+auto
+__invoke(_Fp&& __f, _A0&& __a0)
+    -> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
+{
+    return (*_VSTD::forward<_A0>(__a0)).*__f;
+}
+
+// bullet 5
+
+template <class _Fp, class ..._Args>
+inline _LIBCPP_INLINE_VISIBILITY
+auto
+__invoke(_Fp&& __f, _Args&& ...__args)
+    -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
+{
+    return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
+}
+template <class _Tp, class ..._Args>
+struct __invoke_return
+{
+    typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
+};
+
+#else // _LIBCPP_HAS_NO_VARIADICS
+
+#include <__functional_base_03>
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+
+template <class _Ret>
+struct __invoke_void_return_wrapper
+{
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class ..._Args>
+    static _Ret __call(_Args&&... __args) {
+        return __invoke(_VSTD::forward<_Args>(__args)...);
+    }
+#else
+    template <class _Fn>
+    static _Ret __call(_Fn __f) {
+        return __invoke(__f);
+    }
+
+    template <class _Fn, class _A0>
+    static _Ret __call(_Fn __f, _A0& __a0) {
+        return __invoke(__f, __a0);
+    }
+
+    template <class _Fn, class _A0, class _A1>
+    static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) {
+        return __invoke(__f, __a0, __a1);
+    }
+
+    template <class _Fn, class _A0, class _A1, class _A2>
+    static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){
+        return __invoke(__f, __a0, __a1, __a2);
+    }
+#endif
+};
+
+template <>
+struct __invoke_void_return_wrapper<void>
+{
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class ..._Args>
+    static void __call(_Args&&... __args) {
+        __invoke(_VSTD::forward<_Args>(__args)...);
+    }
+#else
+    template <class _Fn>
+    static void __call(_Fn __f) {
+        __invoke(__f);
+    }
+
+    template <class _Fn, class _A0>
+    static void __call(_Fn __f, _A0& __a0) {
+        __invoke(__f, __a0);
+    }
+
+    template <class _Fn, class _A0, class _A1>
+    static void __call(_Fn __f, _A0& __a0, _A1& __a1) {
+        __invoke(__f, __a0, __a1);
+    }
+
+    template <class _Fn, class _A0, class _A1, class _A2>
+    static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) {
+        __invoke(__f, __a0, __a1, __a2);
+    }
+#endif
+};
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
+    : public __weak_result_type<_Tp>
+{
+public:
+    // types
+    typedef _Tp type;
+private:
+    type* __f_;
+
+public:
+    // construct/copy/destroy
+    _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
+        : __f_(_VSTD::addressof(__f)) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
+#endif
+
+    // access
+    _LIBCPP_INLINE_VISIBILITY operator type&    () const _NOEXCEPT {return *__f_;}
+    _LIBCPP_INLINE_VISIBILITY          type& get() const _NOEXCEPT {return *__f_;}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    // invoke
+    template <class... _ArgTypes>
+       _LIBCPP_INLINE_VISIBILITY
+       typename __invoke_of<type&, _ArgTypes...>::type
+          operator() (_ArgTypes&&... __args) const
+          {
+              return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
+          }
+#else
+
+    _LIBCPP_INLINE_VISIBILITY
+    typename __invoke_return<type>::type
+       operator() () const
+       {
+           return __invoke(get());
+       }
+
+    template <class _A0>
+       _LIBCPP_INLINE_VISIBILITY
+       typename __invoke_return0<type&, _A0>::type
+          operator() (_A0& __a0) const
+          {
+              return __invoke<type&, _A0>(get(), __a0);
+          }
+
+    template <class _A0, class _A1>
+       _LIBCPP_INLINE_VISIBILITY
+       typename __invoke_return1<type&, _A0, _A1>::type
+          operator() (_A0& __a0, _A1& __a1) const
+          {
+              return __invoke<type&, _A0, _A1>(get(), __a0, __a1);
+          }
+
+    template <class _A0, class _A1, class _A2>
+       _LIBCPP_INLINE_VISIBILITY
+       typename __invoke_return2<type&, _A0, _A1, _A2>::type
+          operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
+          {
+              return __invoke<type&, _A0, _A1, _A2>(get(), __a0, __a1, __a2);
+          }
+#endif // _LIBCPP_HAS_NO_VARIADICS
+};
+
+template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
+template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
+template <class _Tp> struct __is_reference_wrapper
+    : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+reference_wrapper<_Tp>
+ref(_Tp& __t) _NOEXCEPT
+{
+    return reference_wrapper<_Tp>(__t);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+reference_wrapper<_Tp>
+ref(reference_wrapper<_Tp> __t) _NOEXCEPT
+{
+    return ref(__t.get());
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+reference_wrapper<const _Tp>
+cref(const _Tp& __t) _NOEXCEPT
+{
+    return reference_wrapper<const _Tp>(__t);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+reference_wrapper<const _Tp>
+cref(reference_wrapper<_Tp> __t) _NOEXCEPT
+{
+    return cref(__t.get());
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+
+template <class _Tp> void ref(const _Tp&&) = delete;
+template <class _Tp> void cref(const _Tp&&) = delete;
+
+#else  // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+
+template <class _Tp> void ref(const _Tp&&);// = delete;
+template <class _Tp> void cref(const _Tp&&);// = delete;
+
+#endif  // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp1, class _Tp2 = void>
+struct __is_transparent
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp1>(0)) == 1;
+};
+#endif
+
+// allocator_arg_t
+
+struct _LIBCPP_TYPE_VIS_ONLY allocator_arg_t { };
+
+#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
+extern const allocator_arg_t allocator_arg;
+#else
+constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+#endif
+
+// uses_allocator
+
+template <class _Tp>
+struct __has_allocator_type
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::allocator_type* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
+struct __uses_allocator
+    : public integral_constant<bool,
+        is_convertible<_Alloc, typename _Tp::allocator_type>::value>
+{
+};
+
+template <class _Tp, class _Alloc>
+struct __uses_allocator<_Tp, _Alloc, false>
+    : public false_type
+{
+};
+
+template <class _Tp, class _Alloc>
+struct _LIBCPP_TYPE_VIS_ONLY uses_allocator
+    : public __uses_allocator<_Tp, _Alloc>
+{
+};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+// allocator construction
+
+template <class _Tp, class _Alloc, class ..._Args>
+struct __uses_alloc_ctor_imp
+{
+    static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
+    static const bool __ic =
+        is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
+    static const int value = __ua ? 2 - __ic : 0;
+};
+
+template <class _Tp, class _Alloc, class ..._Args>
+struct __uses_alloc_ctor
+    : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
+    {};
+
+template <class _Tp, class _Allocator, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
+{
+    new (__storage) _Tp (_VSTD::forward<_Args>(__args)...);
+}
+
+template <class _Tp, class _Allocator, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
+{
+    new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...);
+}
+
+template <class _Tp, class _Allocator, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
+{
+    new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a);
+}
+
+template <class _Tp, class _Allocator, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __args)
+{ 
+    __user_alloc_construct_impl( 
+             __uses_alloc_ctor<_Tp, _Allocator>(), 
+             __storage, __a, _VSTD::forward<_Args>(__args)...
+        );
+}
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_FUNCTIONAL_BASE

Property changes on: lab4/.minix-src/include/c++/__functional_base
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__locale
===================================================================
--- lab4/.minix-src/include/c++/__locale	(nonexistent)
+++ lab4/.minix-src/include/c++/__locale	(revision 13)
@@ -0,0 +1,1475 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___LOCALE
+#define _LIBCPP___LOCALE
+
+#include <__config>
+#include <string>
+#include <memory>
+#include <utility>
+#include <mutex>
+#include <cstdint>
+#include <cctype>
+#include <locale.h>
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+# include <support/win32/locale_win32.h>
+#elif defined(_AIX)
+# include <support/ibm/xlocale.h>
+#elif defined(__ANDROID__)
+// Android gained the locale aware functions in L (API level 21)
+# include <android/api-level.h>
+# if __ANDROID_API__ <= 20
+#  include <support/android/locale_bionic.h>
+# endif
+#elif defined(__sun__)
+# include <xlocale.h>
+# include <support/solaris/xlocale.h>
+#elif defined(_NEWLIB_VERSION)
+# include <support/newlib/xlocale.h>
+#elif (defined(__GLIBC__) || defined(__APPLE__)      || defined(__FreeBSD__) \
+    || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
+# include <xlocale.h>
+#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+class _LIBCPP_TYPE_VIS locale;
+
+template <class _Facet>
+_LIBCPP_INLINE_VISIBILITY
+bool
+has_facet(const locale&) _NOEXCEPT;
+
+template <class _Facet>
+_LIBCPP_INLINE_VISIBILITY
+const _Facet&
+use_facet(const locale&);
+
+class _LIBCPP_TYPE_VIS locale
+{
+public:
+    // types:
+    class _LIBCPP_TYPE_VIS facet;
+    class _LIBCPP_TYPE_VIS id;
+
+    typedef int category;
+    static const category // values assigned here are for exposition only
+        none     = 0,
+        collate  = LC_COLLATE_MASK,
+        ctype    = LC_CTYPE_MASK,
+        monetary = LC_MONETARY_MASK,
+        numeric  = LC_NUMERIC_MASK,
+        time     = LC_TIME_MASK,
+        messages = LC_MESSAGES_MASK,
+        all = collate | ctype | monetary | numeric | time | messages;
+
+    // construct/copy/destroy:
+    locale()  _NOEXCEPT;
+    locale(const locale&)  _NOEXCEPT;
+    explicit locale(const char*);
+    explicit locale(const string&);
+    locale(const locale&, const char*, category);
+    locale(const locale&, const string&, category);
+    template <class _Facet>
+        _LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
+    locale(const locale&, const locale&, category);
+
+    ~locale();
+
+    const locale& operator=(const locale&)  _NOEXCEPT;
+
+    template <class _Facet> locale combine(const locale&) const;
+
+    // locale operations:
+    string name() const;
+    bool operator==(const locale&) const;
+    bool operator!=(const locale& __y) const {return !(*this == __y);}
+    template <class _CharT, class _Traits, class _Allocator>
+      bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
+                      const basic_string<_CharT, _Traits, _Allocator>&) const;
+
+    // global locale objects:
+    static locale global(const locale&);
+    static const locale& classic();
+
+private:
+    class __imp;
+    __imp* __locale_;
+
+    void __install_ctor(const locale&, facet*, long);
+    static locale& __global();
+    bool has_facet(id&) const;
+    const facet* use_facet(id&) const;
+
+    template <class _Facet> friend bool has_facet(const locale&)  _NOEXCEPT;
+    template <class _Facet> friend const _Facet& use_facet(const locale&);
+};
+
+class _LIBCPP_TYPE_VIS locale::facet
+    : public __shared_count
+{
+protected:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit facet(size_t __refs = 0)
+        : __shared_count(static_cast<long>(__refs)-1) {}
+
+    virtual ~facet();
+
+//    facet(const facet&) = delete;     // effectively done in __shared_count
+//    void operator=(const facet&) = delete;
+private:
+    virtual void __on_zero_shared() _NOEXCEPT;
+};
+
+class _LIBCPP_TYPE_VIS locale::id
+{
+    once_flag      __flag_;
+    int32_t        __id_;
+
+    static int32_t __next_id;
+public:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
+private:
+    void __init();
+    void operator=(const id&); // = delete;
+    id(const id&); // = delete;
+public:  // only needed for tests
+    long __get();
+
+    friend class locale;
+    friend class locale::__imp;
+};
+
+template <class _Facet>
+inline _LIBCPP_INLINE_VISIBILITY
+locale::locale(const locale& __other, _Facet* __f)
+{
+    __install_ctor(__other, __f, __f ? __f->id.__get() : 0);
+}
+
+template <class _Facet>
+locale
+locale::combine(const locale& __other) const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (!_VSTD::has_facet<_Facet>(__other))
+        throw runtime_error("locale::combine: locale missing facet");
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other)));
+}
+
+template <class _Facet>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+has_facet(const locale& __l)  _NOEXCEPT
+{
+    return __l.has_facet(_Facet::id);
+}
+
+template <class _Facet>
+inline _LIBCPP_INLINE_VISIBILITY
+const _Facet&
+use_facet(const locale& __l)
+{
+    return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
+}
+
+// template <class _CharT> class collate;
+
+template <class _CharT>
+class _LIBCPP_TYPE_VIS_ONLY collate
+    : public locale::facet
+{
+public:
+    typedef _CharT char_type;
+    typedef basic_string<char_type> string_type;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit collate(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    int compare(const char_type* __lo1, const char_type* __hi1,
+                const char_type* __lo2, const char_type* __hi2) const
+    {
+        return do_compare(__lo1, __hi1, __lo2, __hi2);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    string_type transform(const char_type* __lo, const char_type* __hi) const
+    {
+        return do_transform(__lo, __hi);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    long hash(const char_type* __lo, const char_type* __hi) const
+    {
+        return do_hash(__lo, __hi);
+    }
+
+    static locale::id id;
+
+protected:
+    ~collate();
+    virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
+                           const char_type* __lo2, const char_type* __hi2) const;
+    virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const
+        {return string_type(__lo, __hi);}
+    virtual long do_hash(const char_type* __lo, const char_type* __hi) const;
+};
+
+template <class _CharT> locale::id collate<_CharT>::id;
+
+template <class _CharT>
+collate<_CharT>::~collate()
+{
+}
+
+template <class _CharT>
+int
+collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
+                            const char_type* __lo2, const char_type* __hi2) const
+{
+    for (; __lo2 != __hi2; ++__lo1, ++__lo2)
+    {
+        if (__lo1 == __hi1 || *__lo1 < *__lo2)
+            return -1;
+        if (*__lo2 < *__lo1)
+            return 1;
+    }
+    return __lo1 != __hi1;
+}
+
+template <class _CharT>
+long
+collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
+{
+    size_t __h = 0;
+    const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
+    const size_t __mask = size_t(0xF) << (__sr + 4);
+    for(const char_type* __p = __lo; __p != __hi; ++__p)
+    {
+        __h = (__h << 4) + static_cast<size_t>(*__p);
+        size_t __g = __h & __mask;
+        __h ^= __g | (__g >> __sr);
+    }
+    return static_cast<long>(__h);
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<wchar_t>)
+
+// template <class CharT> class collate_byname;
+
+template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY collate_byname;
+
+template <>
+class _LIBCPP_TYPE_VIS collate_byname<char>
+    : public collate<char>
+{
+    locale_t __l;
+public:
+    typedef char char_type;
+    typedef basic_string<char_type> string_type;
+
+    explicit collate_byname(const char* __n, size_t __refs = 0);
+    explicit collate_byname(const string& __n, size_t __refs = 0);
+
+protected:
+    ~collate_byname();
+    virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
+                           const char_type* __lo2, const char_type* __hi2) const;
+    virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
+};
+
+template <>
+class _LIBCPP_TYPE_VIS collate_byname<wchar_t>
+    : public collate<wchar_t>
+{
+    locale_t __l;
+public:
+    typedef wchar_t char_type;
+    typedef basic_string<char_type> string_type;
+
+    explicit collate_byname(const char* __n, size_t __refs = 0);
+    explicit collate_byname(const string& __n, size_t __refs = 0);
+
+protected:
+    ~collate_byname();
+
+    virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
+                           const char_type* __lo2, const char_type* __hi2) const;
+    virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
+};
+
+template <class _CharT, class _Traits, class _Allocator>
+bool
+locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
+                   const basic_string<_CharT, _Traits, _Allocator>& __y) const
+{
+    return _VSTD::use_facet<_VSTD::collate<_CharT> >(*this).compare(
+                                       __x.data(), __x.data() + __x.size(),
+                                       __y.data(), __y.data() + __y.size()) < 0;
+}
+
+// template <class charT> class ctype
+
+class _LIBCPP_TYPE_VIS ctype_base
+{
+public:
+#ifdef __GLIBC__
+    typedef unsigned short mask;
+    static const mask space  = _ISspace;
+    static const mask print  = _ISprint;
+    static const mask cntrl  = _IScntrl;
+    static const mask upper  = _ISupper;
+    static const mask lower  = _ISlower;
+    static const mask alpha  = _ISalpha;
+    static const mask digit  = _ISdigit;
+    static const mask punct  = _ISpunct;
+    static const mask xdigit = _ISxdigit;
+    static const mask blank  = _ISblank;
+#elif defined(_WIN32)
+    typedef unsigned short mask;
+    static const mask space  = _SPACE;
+    static const mask print  = _BLANK|_PUNCT|_ALPHA|_DIGIT;
+    static const mask cntrl  = _CONTROL;
+    static const mask upper  = _UPPER;
+    static const mask lower  = _LOWER;
+    static const mask alpha  = _ALPHA;
+    static const mask digit  = _DIGIT;
+    static const mask punct  = _PUNCT;
+    static const mask xdigit = _HEX;
+    static const mask blank  = _BLANK;
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
+#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(__minix)
+# ifdef __APPLE__
+    typedef __uint32_t mask;
+# elif defined(__FreeBSD__)
+    typedef unsigned long mask;
+# elif defined(__EMSCRIPTEN__) ||  defined(__NetBSD__) || defined(__minix)
+    typedef unsigned short mask;
+# endif
+    static const mask space  = _CTYPE_S;
+    static const mask print  = _CTYPE_R;
+    static const mask cntrl  = _CTYPE_C;
+    static const mask upper  = _CTYPE_U;
+    static const mask lower  = _CTYPE_L;
+    static const mask alpha  = _CTYPE_A;
+    static const mask digit  = _CTYPE_D;
+    static const mask punct  = _CTYPE_P;
+    static const mask xdigit = _CTYPE_X;
+
+# if defined(__NetBSD__) || defined(__minix)
+    static const mask blank  = _CTYPE_BL;
+# else
+    static const mask blank  = _CTYPE_B;
+# endif
+#elif defined(__sun__) || defined(_AIX)
+    typedef unsigned int mask;
+    static const mask space  = _ISSPACE;
+    static const mask print  = _ISPRINT;
+    static const mask cntrl  = _ISCNTRL;
+    static const mask upper  = _ISUPPER;
+    static const mask lower  = _ISLOWER;
+    static const mask alpha  = _ISALPHA;
+    static const mask digit  = _ISDIGIT;
+    static const mask punct  = _ISPUNCT;
+    static const mask xdigit = _ISXDIGIT;
+    static const mask blank  = _ISBLANK;
+#elif defined(_NEWLIB_VERSION)
+    // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
+    typedef char mask;
+    static const mask space  = _S;
+    static const mask print  = _P | _U | _L | _N | _B;
+    static const mask cntrl  = _C;
+    static const mask upper  = _U;
+    static const mask lower  = _L;
+    static const mask alpha  = _U | _L;
+    static const mask digit  = _N;
+    static const mask punct  = _P;
+    static const mask xdigit = _X | _N;
+    static const mask blank  = _B;
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
+#else
+    typedef unsigned long mask;
+    static const mask space  = 1<<0;
+    static const mask print  = 1<<1;
+    static const mask cntrl  = 1<<2;
+    static const mask upper  = 1<<3;
+    static const mask lower  = 1<<4;
+    static const mask alpha  = 1<<5;
+    static const mask digit  = 1<<6;
+    static const mask punct  = 1<<7;
+    static const mask xdigit = 1<<8;
+    static const mask blank  = 1<<9;
+#endif
+    static const mask alnum  = alpha | digit;
+    static const mask graph  = alnum | punct;
+
+    _LIBCPP_ALWAYS_INLINE ctype_base() {}
+};
+
+template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype;
+
+template <>
+class _LIBCPP_TYPE_VIS ctype<wchar_t>
+    : public locale::facet,
+      public ctype_base
+{
+public:
+    typedef wchar_t char_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit ctype(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    bool is(mask __m, char_type __c) const
+    {
+        return do_is(__m, __c);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
+    {
+        return do_is(__low, __high, __vec);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const
+    {
+        return do_scan_is(__m, __low, __high);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
+    {
+        return do_scan_not(__m, __low, __high);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    char_type toupper(char_type __c) const
+    {
+        return do_toupper(__c);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* toupper(char_type* __low, const char_type* __high) const
+    {
+        return do_toupper(__low, __high);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    char_type tolower(char_type __c) const
+    {
+        return do_tolower(__c);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* tolower(char_type* __low, const char_type* __high) const
+    {
+        return do_tolower(__low, __high);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    char_type widen(char __c) const
+    {
+        return do_widen(__c);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char* widen(const char* __low, const char* __high, char_type* __to) const
+    {
+        return do_widen(__low, __high, __to);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    char narrow(char_type __c, char __dfault) const
+    {
+        return do_narrow(__c, __dfault);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
+    {
+        return do_narrow(__low, __high, __dfault, __to);
+    }
+
+    static locale::id id;
+
+protected:
+    ~ctype();
+    virtual bool do_is(mask __m, char_type __c) const;
+    virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
+    virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
+    virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
+    virtual char_type do_toupper(char_type) const;
+    virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
+    virtual char_type do_tolower(char_type) const;
+    virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
+    virtual char_type do_widen(char) const;
+    virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
+    virtual char do_narrow(char_type, char __dfault) const;
+    virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
+};
+
+template <>
+class _LIBCPP_TYPE_VIS ctype<char>
+    : public locale::facet, public ctype_base
+{
+    const mask* __tab_;
+    bool        __del_;
+public:
+    typedef char char_type;
+
+    explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
+
+    _LIBCPP_ALWAYS_INLINE
+    bool is(mask __m, char_type __c) const
+    {
+        return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
+    {
+        for (; __low != __high; ++__low, ++__vec)
+            *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
+        return __low;
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
+    {
+        for (; __low != __high; ++__low)
+            if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
+                break;
+        return __low;
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
+    {
+        for (; __low != __high; ++__low)
+            if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
+                break;
+        return __low;
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    char_type toupper(char_type __c) const
+    {
+        return do_toupper(__c);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* toupper(char_type* __low, const char_type* __high) const
+    {
+        return do_toupper(__low, __high);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    char_type tolower(char_type __c) const
+    {
+        return do_tolower(__c);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char_type* tolower(char_type* __low, const char_type* __high) const
+    {
+        return do_tolower(__low, __high);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    char_type widen(char __c) const
+    {
+        return do_widen(__c);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char* widen(const char* __low, const char* __high, char_type* __to) const
+    {
+        return do_widen(__low, __high, __to);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    char narrow(char_type __c, char __dfault) const
+    {
+        return do_narrow(__c, __dfault);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
+    {
+        return do_narrow(__low, __high, __dfault, __to);
+    }
+
+    static locale::id id;
+
+#ifdef _CACHED_RUNES
+    static const size_t table_size = _CACHED_RUNES;
+#else
+    static const size_t table_size = 256;  // FIXME: Don't hardcode this.
+#endif
+    _LIBCPP_ALWAYS_INLINE const mask* table() const  _NOEXCEPT {return __tab_;}
+    static const mask* classic_table()  _NOEXCEPT;
+#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+    static const int* __classic_upper_table() _NOEXCEPT;
+    static const int* __classic_lower_table() _NOEXCEPT;
+#endif
+#if defined(__NetBSD__) || defined(__minix)
+    static const short* __classic_upper_table() _NOEXCEPT;
+    static const short* __classic_lower_table() _NOEXCEPT;
+#endif
+
+protected:
+    ~ctype();
+    virtual char_type do_toupper(char_type __c) const;
+    virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
+    virtual char_type do_tolower(char_type __c) const;
+    virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
+    virtual char_type do_widen(char __c) const;
+    virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const;
+    virtual char do_narrow(char_type __c, char __dfault) const;
+    virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const;
+};
+
+// template <class CharT> class ctype_byname;
+
+template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype_byname;
+
+template <>
+class _LIBCPP_TYPE_VIS ctype_byname<char>
+    : public ctype<char>
+{
+    locale_t __l;
+
+public:
+    explicit ctype_byname(const char*, size_t = 0);
+    explicit ctype_byname(const string&, size_t = 0);
+
+protected:
+    ~ctype_byname();
+    virtual char_type do_toupper(char_type) const;
+    virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
+    virtual char_type do_tolower(char_type) const;
+    virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
+};
+
+template <>
+class _LIBCPP_TYPE_VIS ctype_byname<wchar_t>
+    : public ctype<wchar_t>
+{
+    locale_t __l;
+
+public:
+    explicit ctype_byname(const char*, size_t = 0);
+    explicit ctype_byname(const string&, size_t = 0);
+
+protected:
+    ~ctype_byname();
+    virtual bool do_is(mask __m, char_type __c) const;
+    virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
+    virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
+    virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
+    virtual char_type do_toupper(char_type) const;
+    virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
+    virtual char_type do_tolower(char_type) const;
+    virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
+    virtual char_type do_widen(char) const;
+    virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
+    virtual char do_narrow(char_type, char __dfault) const;
+    virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
+};
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+isspace(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+isprint(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+iscntrl(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+isupper(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+islower(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+isalpha(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+isdigit(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+ispunct(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+isxdigit(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+isalnum(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+isgraph(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+_CharT
+toupper(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).toupper(__c);
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+_CharT
+tolower(_CharT __c, const locale& __loc)
+{
+    return use_facet<ctype<_CharT> >(__loc).tolower(__c);
+}
+
+// codecvt_base
+
+class _LIBCPP_TYPE_VIS codecvt_base
+{
+public:
+    _LIBCPP_ALWAYS_INLINE codecvt_base() {}
+    enum result {ok, partial, error, noconv};
+};
+
+// template <class internT, class externT, class stateT> class codecvt;
+
+template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TYPE_VIS_ONLY codecvt;
+
+// template <> class codecvt<char, char, mbstate_t>
+
+template <>
+class _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t>
+    : public locale::facet,
+      public codecvt_base
+{
+public:
+    typedef char      intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    result out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
+    {
+        return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    result unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
+    {
+        return do_unshift(__st, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    result in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
+    {
+        return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int encoding() const  _NOEXCEPT
+    {
+        return do_encoding();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    bool always_noconv() const  _NOEXCEPT
+    {
+        return do_always_noconv();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
+    {
+        return do_length(__st, __frm, __end, __mx);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int max_length() const  _NOEXCEPT
+    {
+        return do_max_length();
+    }
+
+    static locale::id id;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt(const char*, size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    ~codecvt();
+
+    virtual result do_out(state_type& __st,
+                          const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+                          extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result do_in(state_type& __st,
+                         const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+                         intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result do_unshift(state_type& __st,
+                              extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const  _NOEXCEPT;
+    virtual bool do_always_noconv() const  _NOEXCEPT;
+    virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+    virtual int do_max_length() const  _NOEXCEPT;
+};
+
+// template <> class codecvt<wchar_t, char, mbstate_t>
+
+template <>
+class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t>
+    : public locale::facet,
+      public codecvt_base
+{
+    locale_t __l;
+public:
+    typedef wchar_t   intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    explicit codecvt(size_t __refs = 0);
+
+    _LIBCPP_ALWAYS_INLINE
+    result out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
+    {
+        return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    result unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
+    {
+        return do_unshift(__st, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    result in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
+    {
+        return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int encoding() const  _NOEXCEPT
+    {
+        return do_encoding();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    bool always_noconv() const  _NOEXCEPT
+    {
+        return do_always_noconv();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
+    {
+        return do_length(__st, __frm, __end, __mx);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int max_length() const  _NOEXCEPT
+    {
+        return do_max_length();
+    }
+
+    static locale::id id;
+
+protected:
+    explicit codecvt(const char*, size_t __refs = 0);
+
+    ~codecvt();
+
+    virtual result do_out(state_type& __st,
+                          const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+                          extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result do_in(state_type& __st,
+                         const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+                         intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result do_unshift(state_type& __st,
+                              extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const  _NOEXCEPT;
+    virtual bool do_always_noconv() const  _NOEXCEPT;
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+    virtual int do_max_length() const  _NOEXCEPT;
+};
+
+// template <> class codecvt<char16_t, char, mbstate_t>
+
+template <>
+class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
+    : public locale::facet,
+      public codecvt_base
+{
+public:
+    typedef char16_t  intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    result out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
+    {
+        return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    result unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
+    {
+        return do_unshift(__st, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    result in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
+    {
+        return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int encoding() const  _NOEXCEPT
+    {
+        return do_encoding();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    bool always_noconv() const  _NOEXCEPT
+    {
+        return do_always_noconv();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
+    {
+        return do_length(__st, __frm, __end, __mx);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int max_length() const  _NOEXCEPT
+    {
+        return do_max_length();
+    }
+
+    static locale::id id;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt(const char*, size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    ~codecvt();
+
+    virtual result do_out(state_type& __st,
+                          const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+                          extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result do_in(state_type& __st,
+                         const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+                         intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result do_unshift(state_type& __st,
+                              extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const  _NOEXCEPT;
+    virtual bool do_always_noconv() const  _NOEXCEPT;
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+    virtual int do_max_length() const  _NOEXCEPT;
+};
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+
+template <>
+class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
+    : public locale::facet,
+      public codecvt_base
+{
+public:
+    typedef char32_t  intern_type;
+    typedef char      extern_type;
+    typedef mbstate_t state_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    result out(state_type& __st,
+               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
+    {
+        return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    result unshift(state_type& __st,
+                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
+    {
+        return do_unshift(__st, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    result in(state_type& __st,
+              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
+    {
+        return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int encoding() const  _NOEXCEPT
+    {
+        return do_encoding();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    bool always_noconv() const  _NOEXCEPT
+    {
+        return do_always_noconv();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
+    {
+        return do_length(__st, __frm, __end, __mx);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int max_length() const  _NOEXCEPT
+    {
+        return do_max_length();
+    }
+
+    static locale::id id;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt(const char*, size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    ~codecvt();
+
+    virtual result do_out(state_type& __st,
+                          const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
+                          extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual result do_in(state_type& __st,
+                         const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
+                         intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
+    virtual result do_unshift(state_type& __st,
+                              extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+    virtual int do_encoding() const  _NOEXCEPT;
+    virtual bool do_always_noconv() const  _NOEXCEPT;
+    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+    virtual int do_max_length() const  _NOEXCEPT;
+};
+
+// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
+
+template <class _InternT, class _ExternT, class _StateT>
+class _LIBCPP_TYPE_VIS_ONLY codecvt_byname
+    : public codecvt<_InternT, _ExternT, _StateT>
+{
+public:
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt_byname(const char* __nm, size_t __refs = 0)
+        : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
+    _LIBCPP_ALWAYS_INLINE
+    explicit codecvt_byname(const string& __nm, size_t __refs = 0)
+        : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
+protected:
+    ~codecvt_byname();
+};
+
+template <class _InternT, class _ExternT, class _StateT>
+codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
+{
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
+
+_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
+
+template <size_t _Np>
+struct __narrow_to_utf8
+{
+    template <class _OutputIterator, class _CharT>
+    _OutputIterator
+    operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const;
+};
+
+template <>
+struct __narrow_to_utf8<8>
+{
+    template <class _OutputIterator, class _CharT>
+    _LIBCPP_ALWAYS_INLINE
+    _OutputIterator
+    operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
+    {
+        for (; __wb < __we; ++__wb, ++__s)
+            *__s = *__wb;
+        return __s;
+    }
+};
+
+template <>
+struct __narrow_to_utf8<16>
+    : public codecvt<char16_t, char, mbstate_t>
+{
+    _LIBCPP_ALWAYS_INLINE
+    __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
+
+    ~__narrow_to_utf8();
+
+    template <class _OutputIterator, class _CharT>
+    _LIBCPP_ALWAYS_INLINE
+    _OutputIterator
+    operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
+    {
+        result __r = ok;
+        mbstate_t __mb;
+        while (__wb < __we && __r != error)
+        {
+            const int __sz = 32;
+            char __buf[__sz];
+            char* __bn;
+            const char16_t* __wn = (const char16_t*)__wb;
+            __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn,
+                         __buf, __buf+__sz, __bn);
+            if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
+                __throw_runtime_error("locale not supported");
+            for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
+                *__s = *__p;
+            __wb = (const _CharT*)__wn;
+        }
+        return __s;
+    }
+};
+
+template <>
+struct __narrow_to_utf8<32>
+    : public codecvt<char32_t, char, mbstate_t>
+{
+    _LIBCPP_ALWAYS_INLINE
+    __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
+
+    ~__narrow_to_utf8();
+
+    template <class _OutputIterator, class _CharT>
+    _LIBCPP_ALWAYS_INLINE
+    _OutputIterator
+    operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
+    {
+        result __r = ok;
+        mbstate_t __mb;
+        while (__wb < __we && __r != error)
+        {
+            const int __sz = 32;
+            char __buf[__sz];
+            char* __bn;
+            const char32_t* __wn = (const char32_t*)__wb;
+            __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn,
+                         __buf, __buf+__sz, __bn);
+            if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
+                __throw_runtime_error("locale not supported");
+            for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
+                *__s = *__p;
+            __wb = (const _CharT*)__wn;
+        }
+        return __s;
+    }
+};
+
+template <size_t _Np>
+struct __widen_from_utf8
+{
+    template <class _OutputIterator>
+    _OutputIterator
+    operator()(_OutputIterator __s, const char* __nb, const char* __ne) const;
+};
+
+template <>
+struct __widen_from_utf8<8>
+{
+    template <class _OutputIterator>
+    _LIBCPP_ALWAYS_INLINE
+    _OutputIterator
+    operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
+    {
+        for (; __nb < __ne; ++__nb, ++__s)
+            *__s = *__nb;
+        return __s;
+    }
+};
+
+template <>
+struct __widen_from_utf8<16>
+    : public codecvt<char16_t, char, mbstate_t>
+{
+    _LIBCPP_ALWAYS_INLINE
+    __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
+
+    ~__widen_from_utf8();
+
+    template <class _OutputIterator>
+    _LIBCPP_ALWAYS_INLINE
+    _OutputIterator
+    operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
+    {
+        result __r = ok;
+        mbstate_t __mb;
+        while (__nb < __ne && __r != error)
+        {
+            const int __sz = 32;
+            char16_t __buf[__sz];
+            char16_t* __bn;
+            const char* __nn = __nb;
+            __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
+                        __buf, __buf+__sz, __bn);
+            if (__r == codecvt_base::error || __nn == __nb)
+                __throw_runtime_error("locale not supported");
+            for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
+                *__s = (wchar_t)*__p;
+            __nb = __nn;
+        }
+        return __s;
+    }
+};
+
+template <>
+struct __widen_from_utf8<32>
+    : public codecvt<char32_t, char, mbstate_t>
+{
+    _LIBCPP_ALWAYS_INLINE
+    __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
+
+    ~__widen_from_utf8();
+
+    template <class _OutputIterator>
+    _LIBCPP_ALWAYS_INLINE
+    _OutputIterator
+    operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
+    {
+        result __r = ok;
+        mbstate_t __mb;
+        while (__nb < __ne && __r != error)
+        {
+            const int __sz = 32;
+            char32_t __buf[__sz];
+            char32_t* __bn;
+            const char* __nn = __nb;
+            __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
+                        __buf, __buf+__sz, __bn);
+            if (__r == codecvt_base::error || __nn == __nb)
+                __throw_runtime_error("locale not supported");
+            for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
+                *__s = (wchar_t)*__p;
+            __nb = __nn;
+        }
+        return __s;
+    }
+};
+
+// template <class charT> class numpunct
+
+template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct;
+
+template <>
+class _LIBCPP_TYPE_VIS numpunct<char>
+    : public locale::facet
+{
+public:
+    typedef char char_type;
+    typedef basic_string<char_type> string_type;
+
+    explicit numpunct(size_t __refs = 0);
+
+    _LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();}
+    _LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();}
+    _LIBCPP_ALWAYS_INLINE string grouping() const         {return do_grouping();}
+    _LIBCPP_ALWAYS_INLINE string_type truename() const    {return do_truename();}
+    _LIBCPP_ALWAYS_INLINE string_type falsename() const   {return do_falsename();}
+
+    static locale::id id;
+
+protected:
+    ~numpunct();
+    virtual char_type do_decimal_point() const;
+    virtual char_type do_thousands_sep() const;
+    virtual string do_grouping() const;
+    virtual string_type do_truename() const;
+    virtual string_type do_falsename() const;
+
+    char_type __decimal_point_;
+    char_type __thousands_sep_;
+    string __grouping_;
+};
+
+template <>
+class _LIBCPP_TYPE_VIS numpunct<wchar_t>
+    : public locale::facet
+{
+public:
+    typedef wchar_t char_type;
+    typedef basic_string<char_type> string_type;
+
+    explicit numpunct(size_t __refs = 0);
+
+    _LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();}
+    _LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();}
+    _LIBCPP_ALWAYS_INLINE string grouping() const         {return do_grouping();}
+    _LIBCPP_ALWAYS_INLINE string_type truename() const    {return do_truename();}
+    _LIBCPP_ALWAYS_INLINE string_type falsename() const   {return do_falsename();}
+
+    static locale::id id;
+
+protected:
+    ~numpunct();
+    virtual char_type do_decimal_point() const;
+    virtual char_type do_thousands_sep() const;
+    virtual string do_grouping() const;
+    virtual string_type do_truename() const;
+    virtual string_type do_falsename() const;
+
+    char_type __decimal_point_;
+    char_type __thousands_sep_;
+    string __grouping_;
+};
+
+// template <class charT> class numpunct_byname
+
+template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname;
+
+template <>
+class _LIBCPP_TYPE_VIS numpunct_byname<char>
+: public numpunct<char>
+{
+public:
+    typedef char char_type;
+    typedef basic_string<char_type> string_type;
+
+    explicit numpunct_byname(const char* __nm, size_t __refs = 0);
+    explicit numpunct_byname(const string& __nm, size_t __refs = 0);
+
+protected:
+    ~numpunct_byname();
+
+private:
+    void __init(const char*);
+};
+
+template <>
+class _LIBCPP_TYPE_VIS numpunct_byname<wchar_t>
+: public numpunct<wchar_t>
+{
+public:
+    typedef wchar_t char_type;
+    typedef basic_string<char_type> string_type;
+
+    explicit numpunct_byname(const char* __nm, size_t __refs = 0);
+    explicit numpunct_byname(const string& __nm, size_t __refs = 0);
+
+protected:
+    ~numpunct_byname();
+
+private:
+    void __init(const char*);
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP___LOCALE

Property changes on: lab4/.minix-src/include/c++/__locale
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__sso_allocator
===================================================================
--- lab4/.minix-src/include/c++/__sso_allocator	(nonexistent)
+++ lab4/.minix-src/include/c++/__sso_allocator	(revision 13)
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___SSO_ALLOCATOR
+#define _LIBCPP___SSO_ALLOCATOR
+
+#include <__config>
+#include <type_traits>
+#include <new>
+
+#include <__undef___deallocate>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, size_t _Np> class _LIBCPP_HIDDEN __sso_allocator;
+
+template <size_t _Np>
+class _LIBCPP_HIDDEN __sso_allocator<void, _Np>
+{
+public:
+    typedef const void*       const_pointer;
+    typedef void              value_type;
+};
+
+template <class _Tp, size_t _Np>
+class _LIBCPP_HIDDEN __sso_allocator
+{
+    typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
+    bool __allocated_;
+public:
+    typedef size_t            size_type;
+    typedef _Tp*              pointer;
+    typedef _Tp               value_type;
+
+    _LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
+    _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
+    template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw()
+         : __allocated_(false) {}
+private:
+    __sso_allocator& operator=(const __sso_allocator&);
+public:
+    _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
+    {
+        if (!__allocated_ && __n <= _Np)
+        {
+            __allocated_ = true;
+            return (pointer)&buf_;
+        }
+        return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));
+    }
+    _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type)
+    {
+        if (__p == (pointer)&buf_)
+            __allocated_ = false;
+        else
+            _VSTD::__deallocate(__p);
+    }
+    _LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;}
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP___SSO_ALLOCATOR

Property changes on: lab4/.minix-src/include/c++/__sso_allocator
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/__tuple
===================================================================
--- lab4/.minix-src/include/c++/__tuple	(nonexistent)
+++ lab4/.minix-src/include/c++/__tuple	(revision 13)
@@ -0,0 +1,373 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___TUPLE
+#define _LIBCPP___TUPLE
+
+#include <__config>
+#include <cstddef>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_size<const _Tp>
+    : public tuple_size<_Tp> {};
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_size<volatile _Tp>
+    : public tuple_size<_Tp> {};
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_size<const volatile _Tp>
+    : public tuple_size<_Tp> {};
+
+template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element;
+
+template <size_t _Ip, class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const _Tp>
+{
+public:
+    typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
+};
+
+template <size_t _Ip, class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, volatile _Tp>
+{
+public:
+    typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
+};
+
+template <size_t _Ip, class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const volatile _Tp>
+{
+public:
+    typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
+};
+
+template <class _Tp> struct __tuple_like : false_type {};
+
+template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
+template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
+template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
+
+// tuple specializations
+
+#if !defined(_LIBCPP_HAS_NO_VARIADICS)
+template <class ..._Tp> class _LIBCPP_TYPE_VIS_ONLY tuple;
+
+template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
+
+template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename tuple_element<_Ip, tuple<_Tp...> >::type&
+get(tuple<_Tp...>&) _NOEXCEPT;
+
+template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Ip, tuple<_Tp...> >::type&
+get(const tuple<_Tp...>&) _NOEXCEPT;
+
+template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(tuple<_Tp...>&&) _NOEXCEPT;
+#endif
+
+// pair specializations
+
+template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY pair;
+
+template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
+
+template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+get(pair<_T1, _T2>&) _NOEXCEPT;
+
+template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+get(const pair<_T1, _T2>&) _NOEXCEPT;
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(pair<_T1, _T2>&&) _NOEXCEPT;
+#endif
+
+// array specializations
+
+template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY array;
+
+template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
+
+template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp&
+get(array<_Tp, _Size>&) _NOEXCEPT;
+
+template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Tp&
+get(const array<_Tp, _Size>&) _NOEXCEPT;
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp&&
+get(array<_Tp, _Size>&&) _NOEXCEPT;
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_VARIADICS)
+
+// __lazy_and
+
+template <bool _Last, class ..._Preds>
+struct __lazy_and_impl;
+
+template <class ..._Preds>
+struct __lazy_and_impl<false, _Preds...> : false_type {};
+
+template <>
+struct __lazy_and_impl<true> : true_type {};
+
+template <class _Pred>
+struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
+
+template <class _Hp, class ..._Tp>
+struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
+
+template <class _P1, class ..._Pr>
+struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
+
+// __lazy_not
+
+template <class _Pred>
+struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
+
+// __make_tuple_indices
+
+template <size_t...> struct __tuple_indices {};
+
+template <size_t _Sp, class _IntTuple, size_t _Ep>
+struct __make_indices_imp;
+
+template <size_t _Sp, size_t ..._Indices, size_t _Ep>
+struct __make_indices_imp<_Sp, __tuple_indices<_Indices...>, _Ep>
+{
+    typedef typename __make_indices_imp<_Sp+1, __tuple_indices<_Indices..., _Sp>, _Ep>::type type;
+};
+
+template <size_t _Ep, size_t ..._Indices>
+struct __make_indices_imp<_Ep, __tuple_indices<_Indices...>, _Ep>
+{
+    typedef __tuple_indices<_Indices...> type;
+};
+
+template <size_t _Ep, size_t _Sp = 0>
+struct __make_tuple_indices
+{
+    static_assert(_Sp <= _Ep, "__make_tuple_indices input error");
+    typedef typename __make_indices_imp<_Sp, __tuple_indices<>, _Ep>::type type;
+};
+
+// __tuple_types
+
+template <class ..._Tp> struct __tuple_types {};
+
+template <size_t _Ip>
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<> >
+{
+public:
+    static_assert(_Ip == 0, "tuple_element index out of range");
+    static_assert(_Ip != 0, "tuple_element index out of range");
+};
+
+template <class _Hp, class ..._Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, __tuple_types<_Hp, _Tp...> >
+{
+public:
+    typedef _Hp type;
+};
+
+template <size_t _Ip, class _Hp, class ..._Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
+{
+public:
+    typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
+};
+
+template <class ..._Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_size<__tuple_types<_Tp...> >
+    : public integral_constant<size_t, sizeof...(_Tp)>
+{
+};
+
+template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
+
+// __make_tuple_types
+
+// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
+// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
+// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>.  If _Tuple is a
+// lvalue_reference type, then __tuple_types<_Types&...> is the result.
+
+template <class _TupleTypes, class _Tp, size_t _Sp, size_t _Ep>
+struct __make_tuple_types_imp;
+
+template <class ..._Types, class _Tp, size_t _Sp, size_t _Ep>
+struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
+{
+    typedef typename remove_reference<_Tp>::type _Tpr;
+    typedef typename __make_tuple_types_imp<__tuple_types<_Types...,
+                                            typename conditional<is_lvalue_reference<_Tp>::value,
+                                                typename tuple_element<_Sp, _Tpr>::type&,
+                                                typename tuple_element<_Sp, _Tpr>::type>::type>,
+                                            _Tp, _Sp+1, _Ep>::type type;
+};
+
+template <class ..._Types, class _Tp, size_t _Ep>
+struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Ep, _Ep>
+{
+    typedef __tuple_types<_Types...> type;
+};
+
+template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0>
+struct __make_tuple_types
+{
+    static_assert(_Sp <= _Ep, "__make_tuple_types input error");
+    typedef typename __make_tuple_types_imp<__tuple_types<>, _Tp, _Sp, _Ep>::type type;
+};
+
+// __tuple_convertible
+
+template <class, class>
+struct __tuple_convertible_imp : public false_type {};
+
+template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
+struct __tuple_convertible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
+    : public integral_constant<bool,
+                               is_convertible<_Tp0, _Up0>::value &&
+                               __tuple_convertible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
+
+template <>
+struct __tuple_convertible_imp<__tuple_types<>, __tuple_types<> >
+    : public true_type {};
+
+template <bool, class, class>
+struct __tuple_convertible_apply : public false_type {};
+
+template <class _Tp, class _Up>
+struct __tuple_convertible_apply<true, _Tp, _Up>
+  : public __tuple_convertible_imp<
+      typename __make_tuple_types<_Tp>::type
+    , typename __make_tuple_types<_Up>::type
+    >
+{};
+
+template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
+                                bool = __tuple_like<_Up>::value>
+struct __tuple_convertible
+    : public false_type {};
+
+template <class _Tp, class _Up>
+struct __tuple_convertible<_Tp, _Up, true, true>
+    : public __tuple_convertible_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
+                                     tuple_size<_Up>::value, _Tp, _Up>
+{};
+
+// __tuple_constructible
+
+template <class, class>
+struct __tuple_constructible_imp : public false_type {};
+
+template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
+struct __tuple_constructible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
+    : public integral_constant<bool,
+                               is_constructible<_Up0, _Tp0>::value &&
+                               __tuple_constructible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
+
+template <>
+struct __tuple_constructible_imp<__tuple_types<>, __tuple_types<> >
+    : public true_type {};
+
+template <bool _SameSize, class, class>
+struct __tuple_constructible_apply : public false_type {};
+
+template <class _Tp, class _Up>
+struct __tuple_constructible_apply<true, _Tp, _Up>
+  : public __tuple_constructible_imp<
+      typename __make_tuple_types<_Tp>::type
+    , typename __make_tuple_types<_Up>::type
+    >
+{};
+
+template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
+                                bool = __tuple_like<_Up>::value>
+struct __tuple_constructible
+    : public false_type {};
+
+template <class _Tp, class _Up>
+struct __tuple_constructible<_Tp, _Up, true, true>
+    : public __tuple_constructible_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
+                                     tuple_size<_Up>::value, _Tp, _Up>
+{};
+
+// __tuple_assignable
+
+template <class, class>
+struct __tuple_assignable_imp : public false_type {};
+
+template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
+struct __tuple_assignable_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
+    : public integral_constant<bool,
+                               is_assignable<_Up0&, _Tp0>::value &&
+                               __tuple_assignable_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
+
+template <>
+struct __tuple_assignable_imp<__tuple_types<>, __tuple_types<> >
+    : public true_type {};
+
+template <bool, class, class>
+struct __tuple_assignable_apply : public false_type {};
+
+template <class _Tp, class _Up>
+struct __tuple_assignable_apply<true, _Tp, _Up>
+  : __tuple_assignable_imp<
+      typename __make_tuple_types<_Tp>::type
+    , typename __make_tuple_types<_Up>::type
+    >
+{};
+
+template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
+                                bool = __tuple_like<_Up>::value>
+struct __tuple_assignable
+    : public false_type {};
+
+template <class _Tp, class _Up>
+struct __tuple_assignable<_Tp, _Up, true, true>
+    : public __tuple_assignable_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
+                                    tuple_size<_Up>::value, _Tp, _Up>
+{};
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP___TUPLE

Property changes on: lab4/.minix-src/include/c++/__tuple
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cwctype
===================================================================
--- lab4/.minix-src/include/c++/cwctype	(nonexistent)
+++ lab4/.minix-src/include/c++/cwctype	(revision 13)
@@ -0,0 +1,213 @@
+// -*- C++ -*-
+//===--------------------------- cwctype ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CWCTYPE
+#define _LIBCPP_CWCTYPE
+
+/*
+    cwctype synopsis
+
+Macros:
+
+    WEOF
+
+namespace std
+{
+
+Types:
+
+    wint_t
+    wctrans_t
+    wctype_t
+
+int iswalnum(wint_t wc);
+int iswalpha(wint_t wc);
+int iswblank(wint_t wc);  // C99
+int iswcntrl(wint_t wc);
+int iswdigit(wint_t wc);
+int iswgraph(wint_t wc);
+int iswlower(wint_t wc);
+int iswprint(wint_t wc);
+int iswpunct(wint_t wc);
+int iswspace(wint_t wc);
+int iswupper(wint_t wc);
+int iswxdigit(wint_t wc);
+int iswctype(wint_t wc, wctype_t desc);
+wctype_t wctype(const char* property);
+wint_t towlower(wint_t wc);
+wint_t towupper(wint_t wc);
+wint_t towctrans(wint_t wc, wctrans_t desc);
+wctrans_t wctrans(const char* property);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <cctype>
+#include <wctype.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::wint_t;
+using ::wctrans_t;
+using ::wctype_t;
+
+#ifdef iswalnum
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
+#undef iswalnum
+inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
+#else  // iswalnum
+using ::iswalnum;
+#endif
+
+#ifdef iswalpha
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
+#undef iswalpha
+inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
+#else  // iswalpha
+using ::iswalpha;
+#endif
+
+#ifdef iswblank
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
+#undef iswblank
+inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
+#else  // iswblank
+using ::iswblank;
+#endif
+
+#ifdef iswcntrl
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
+#undef iswcntrl
+inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
+#else  // iswcntrl
+using ::iswcntrl;
+#endif
+
+#ifdef iswdigit
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
+#undef iswdigit
+inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
+#else  // iswdigit
+using ::iswdigit;
+#endif
+
+#ifdef iswgraph
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
+#undef iswgraph
+inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
+#else  // iswgraph
+using ::iswgraph;
+#endif
+
+#ifdef iswlower
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
+#undef iswlower
+inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
+#else  // iswlower
+using ::iswlower;
+#endif
+
+#ifdef iswprint
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
+#undef iswprint
+inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
+#else  // iswprint
+using ::iswprint;
+#endif
+
+#ifdef iswpunct
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
+#undef iswpunct
+inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
+#else  // iswpunct
+using ::iswpunct;
+#endif
+
+#ifdef iswspace
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
+#undef iswspace
+inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
+#else  // iswspace
+using ::iswspace;
+#endif
+
+#ifdef iswupper
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
+#undef iswupper
+inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
+#else  // iswupper
+using ::iswupper;
+#endif
+
+#ifdef iswxdigit
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
+#undef iswxdigit
+inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
+#else  // iswxdigit
+using ::iswxdigit;
+#endif
+
+#ifdef iswctype
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
+#undef iswctype
+inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
+#else  // iswctype
+using ::iswctype;
+#endif
+
+#ifdef wctype
+inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
+#undef wctype
+inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
+#else  // wctype
+using ::wctype;
+#endif
+
+#ifdef towlower
+inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
+#undef towlower
+inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
+#else  // towlower
+using ::towlower;
+#endif
+
+#ifdef towupper
+inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
+#undef towupper
+inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
+#else  // towupper
+using ::towupper;
+#endif
+
+#ifdef towctrans
+inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
+#undef towctrans
+inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
+#else  // towctrans
+using ::towctrans;
+#endif
+
+#ifdef wctrans
+inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
+#undef wctrans
+inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
+#else  // wctrans
+using ::wctrans;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CWCTYPE

Property changes on: lab4/.minix-src/include/c++/cwctype
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/exception
===================================================================
--- lab4/.minix-src/include/c++/exception	(nonexistent)
+++ lab4/.minix-src/include/c++/exception	(revision 13)
@@ -0,0 +1,254 @@
+// -*- C++ -*-
+//===-------------------------- exception ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXCEPTION
+#define _LIBCPP_EXCEPTION
+
+/*
+    exception synopsis
+
+namespace std
+{
+
+class exception
+{
+public:
+    exception() noexcept;
+    exception(const exception&) noexcept;
+    exception& operator=(const exception&) noexcept;
+    virtual ~exception() noexcept;
+    virtual const char* what() const noexcept;
+};
+
+class bad_exception
+    : public exception
+{
+public:
+    bad_exception() noexcept;
+    bad_exception(const bad_exception&) noexcept;
+    bad_exception& operator=(const bad_exception&) noexcept;
+    virtual ~bad_exception() noexcept;
+    virtual const char* what() const noexcept;
+};
+
+typedef void (*unexpected_handler)();
+unexpected_handler set_unexpected(unexpected_handler  f ) noexcept;
+unexpected_handler get_unexpected() noexcept;
+[[noreturn]] void unexpected();
+
+typedef void (*terminate_handler)();
+terminate_handler set_terminate(terminate_handler  f ) noexcept;
+terminate_handler get_terminate() noexcept;
+[[noreturn]] void terminate() noexcept;
+
+bool uncaught_exception()  noexcept;
+int  uncaught_exceptions() noexcept;  // C++17
+
+typedef unspecified exception_ptr;
+
+exception_ptr current_exception() noexcept;
+void rethrow_exception [[noreturn]] (exception_ptr p);
+template<class E> exception_ptr make_exception_ptr(E e) noexcept;
+
+class nested_exception
+{
+public:
+    nested_exception() noexcept;
+    nested_exception(const nested_exception&) noexcept = default;
+    nested_exception& operator=(const nested_exception&) noexcept = default;
+    virtual ~nested_exception() = default;
+
+    // access functions
+    [[noreturn]] void rethrow_nested() const;
+    exception_ptr nested_ptr() const noexcept;
+};
+
+template <class T> [[noreturn]] void throw_with_nested(T&& t);
+template <class E> void rethrow_if_nested(const E& e);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <cstddef>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+namespace std  // purposefully not using versioning namespace
+{
+
+class _LIBCPP_EXCEPTION_ABI exception
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {}
+    virtual ~exception() _NOEXCEPT;
+    virtual const char* what() const _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI bad_exception
+    : public exception
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {}
+    virtual ~bad_exception() _NOEXCEPT;
+    virtual const char* what() const _NOEXCEPT;
+};
+
+typedef void (*unexpected_handler)();
+_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
+_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
+
+typedef void (*terminate_handler)();
+_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
+_LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT;
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT;
+
+_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
+_LIBCPP_FUNC_VIS int uncaught_exceptions() _NOEXCEPT;
+
+class _LIBCPP_TYPE_VIS exception_ptr;
+
+_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
+
+class _LIBCPP_TYPE_VIS exception_ptr
+{
+    void* __ptr_;
+public:
+    _LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {}
+    _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
+    exception_ptr(const exception_ptr&) _NOEXCEPT;
+    exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
+    ~exception_ptr() _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_EXPLICIT
+        operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
+        {return __x.__ptr_ == __y.__ptr_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
+        {return !(__x == __y);}
+
+    friend _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
+    friend _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
+};
+
+template<class _Ep>
+exception_ptr
+make_exception_ptr(_Ep __e) _NOEXCEPT
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+        throw __e;
+    }
+    catch (...)
+    {
+        return current_exception();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+// nested_exception
+
+class _LIBCPP_EXCEPTION_ABI nested_exception
+{
+    exception_ptr __ptr_;
+public:
+    nested_exception() _NOEXCEPT;
+//     nested_exception(const nested_exception&) noexcept = default;
+//     nested_exception& operator=(const nested_exception&) noexcept = default;
+    virtual ~nested_exception() _NOEXCEPT;
+
+    // access functions
+    _LIBCPP_NORETURN void rethrow_nested() const;
+    _LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
+};
+
+template <class _Tp>
+struct __nested
+    : public _Tp,
+      public nested_exception
+{
+    _LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
+};
+
+template <class _Tp>
+_LIBCPP_NORETURN
+void
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+throw_with_nested(_Tp&& __t, typename enable_if<
+                  is_class<typename remove_reference<_Tp>::type>::value &&
+                  !is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
+                  && !__libcpp_is_final<typename remove_reference<_Tp>::type>::value
+                                    >::type* = 0)
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+throw_with_nested (_Tp& __t, typename enable_if<
+                  is_class<_Tp>::value && !is_base_of<nested_exception, _Tp>::value
+                                    >::type* = 0)
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
+#endif
+}
+
+template <class _Tp>
+_LIBCPP_NORETURN
+void
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+throw_with_nested(_Tp&& __t, typename enable_if<
+                  !is_class<typename remove_reference<_Tp>::type>::value ||
+                  is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
+                  || __libcpp_is_final<typename remove_reference<_Tp>::type>::value
+                                    >::type* = 0)
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+throw_with_nested (_Tp& __t, typename enable_if<
+                  !is_class<_Tp>::value || is_base_of<nested_exception, _Tp>::value
+                                    >::type* = 0)
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    throw _VSTD::forward<_Tp>(__t);
+#endif
+}
+
+template <class _Ep>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+rethrow_if_nested(const _Ep& __e, typename enable_if<
+                                   is_polymorphic<_Ep>::value
+                                                   >::type* = 0)
+{
+    const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
+    if (__nep)
+        __nep->rethrow_nested();
+}
+
+template <class _Ep>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+rethrow_if_nested(const _Ep&, typename enable_if<
+                                   !is_polymorphic<_Ep>::value
+                                                   >::type* = 0)
+{
+}
+
+}  // std
+
+#endif  // _LIBCPP_EXCEPTION

Property changes on: lab4/.minix-src/include/c++/exception
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/functional
===================================================================
--- lab4/.minix-src/include/c++/functional	(nonexistent)
+++ lab4/.minix-src/include/c++/functional	(revision 13)
@@ -0,0 +1,2498 @@
+// -*- C++ -*-
+//===------------------------ functional ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_FUNCTIONAL
+#define _LIBCPP_FUNCTIONAL
+
+/*
+    functional synopsis
+
+namespace std
+{
+
+template <class Arg, class Result>
+struct unary_function
+{
+    typedef Arg    argument_type;
+    typedef Result result_type;
+};
+
+template <class Arg1, class Arg2, class Result>
+struct binary_function
+{
+    typedef Arg1   first_argument_type;
+    typedef Arg2   second_argument_type;
+    typedef Result result_type;
+};
+
+template <class T>
+class reference_wrapper
+    : public unary_function<T1, R> // if wrapping a unary functor
+    : public binary_function<T1, T2, R> // if wraping a binary functor
+{
+public:
+    // types
+    typedef T type;
+    typedef see below result_type; // Not always defined
+
+    // construct/copy/destroy
+    reference_wrapper(T&) noexcept;
+    reference_wrapper(T&&) = delete; // do not bind to temps
+    reference_wrapper(const reference_wrapper<T>& x) noexcept;
+
+    // assignment
+    reference_wrapper& operator=(const reference_wrapper<T>& x) noexcept;
+
+    // access
+    operator T& () const noexcept;
+    T& get() const noexcept;
+
+    // invoke
+    template <class... ArgTypes>
+      typename result_of<T&(ArgTypes&&...)>::type
+          operator() (ArgTypes&&...) const;
+};
+
+template <class T> reference_wrapper<T> ref(T& t) noexcept;
+template <class T> void ref(const T&& t) = delete;
+template <class T> reference_wrapper<T> ref(reference_wrapper<T>t) noexcept;
+
+template <class T> reference_wrapper<const T> cref(const T& t) noexcept;
+template <class T> void cref(const T&& t) = delete;
+template <class T> reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;
+
+template <class T> // <class T=void> in C++14
+struct plus : binary_function<T, T, T>
+{
+    T operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct minus : binary_function<T, T, T>
+{
+    T operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct multiplies : binary_function<T, T, T>
+{
+    T operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct divides : binary_function<T, T, T>
+{
+    T operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct modulus : binary_function<T, T, T>
+{
+    T operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct negate : unary_function<T, T>
+{
+    T operator()(const T& x) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct equal_to : binary_function<T, T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct not_equal_to : binary_function<T, T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct greater : binary_function<T, T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct less : binary_function<T, T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct greater_equal : binary_function<T, T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct less_equal : binary_function<T, T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct logical_and : binary_function<T, T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct logical_or : binary_function<T, T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct logical_not : unary_function<T, bool>
+{
+    bool operator()(const T& x) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct bit_and : unary_function<T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct bit_or : unary_function<T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T> // <class T=void> in C++14
+struct bit_xor : unary_function<T, bool>
+{
+    bool operator()(const T& x, const T& y) const;
+};
+
+template <class T=void> // C++14
+struct bit_xor : unary_function<T, bool>
+{
+    bool operator()(const T& x) const;
+};
+
+template <class Predicate>
+class unary_negate
+    : public unary_function<typename Predicate::argument_type, bool>
+{
+public:
+    explicit unary_negate(const Predicate& pred);
+    bool operator()(const typename Predicate::argument_type& x) const;
+};
+
+template <class Predicate> unary_negate<Predicate> not1(const Predicate& pred);
+
+template <class Predicate>
+class binary_negate
+    : public binary_function<typename Predicate::first_argument_type,
+                             typename Predicate::second_argument_type,
+                             bool>
+{
+public:
+    explicit binary_negate(const Predicate& pred);
+    bool operator()(const typename Predicate::first_argument_type& x,
+                    const typename Predicate::second_argument_type& y) const;
+};
+
+template <class Predicate> binary_negate<Predicate> not2(const Predicate& pred);
+
+template<class T> struct is_bind_expression;
+template<class T> struct is_placeholder;
+
+template<class Fn, class... BoundArgs>
+  unspecified bind(Fn&&, BoundArgs&&...);
+template<class R, class Fn, class... BoundArgs>
+  unspecified bind(Fn&&, BoundArgs&&...);
+
+namespace placeholders {
+  // M is the implementation-defined number of placeholders
+  extern unspecified _1;
+  extern unspecified _2;
+  .
+  .
+  .
+  extern unspecified _Mp;
+}
+
+template <class Operation>
+class binder1st
+    : public unary_function<typename Operation::second_argument_type,
+                            typename Operation::result_type>
+{
+protected:
+    Operation                               op;
+    typename Operation::first_argument_type value;
+public:
+    binder1st(const Operation& x, const typename Operation::first_argument_type y);
+    typename Operation::result_type operator()(      typename Operation::second_argument_type& x) const;
+    typename Operation::result_type operator()(const typename Operation::second_argument_type& x) const;
+};
+
+template <class Operation, class T>
+binder1st<Operation> bind1st(const Operation& op, const T& x);
+
+template <class Operation>
+class binder2nd
+    : public unary_function<typename Operation::first_argument_type,
+                            typename Operation::result_type>
+{
+protected:
+    Operation                                op;
+    typename Operation::second_argument_type value;
+public:
+    binder2nd(const Operation& x, const typename Operation::second_argument_type y);
+    typename Operation::result_type operator()(      typename Operation::first_argument_type& x) const;
+    typename Operation::result_type operator()(const typename Operation::first_argument_type& x) const;
+};
+
+template <class Operation, class T>
+binder2nd<Operation> bind2nd(const Operation& op, const T& x);
+
+template <class Arg, class Result>
+class pointer_to_unary_function : public unary_function<Arg, Result>
+{
+public:
+    explicit pointer_to_unary_function(Result (*f)(Arg));
+    Result operator()(Arg x) const;
+};
+
+template <class Arg, class Result>
+pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg));
+
+template <class Arg1, class Arg2, class Result>
+class pointer_to_binary_function : public binary_function<Arg1, Arg2, Result>
+{
+public:
+    explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2));
+    Result operator()(Arg1 x, Arg2 y) const;
+};
+
+template <class Arg1, class Arg2, class Result>
+pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2));
+
+template<class S, class T>
+class mem_fun_t : public unary_function<T*, S>
+{
+public:
+    explicit mem_fun_t(S (T::*p)());
+    S operator()(T* p) const;
+};
+
+template<class S, class T, class A>
+class mem_fun1_t : public binary_function<T*, A, S>
+{
+public:
+    explicit mem_fun1_t(S (T::*p)(A));
+    S operator()(T* p, A x) const;
+};
+
+template<class S, class T>          mem_fun_t<S,T>    mem_fun(S (T::*f)());
+template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A));
+
+template<class S, class T>
+class mem_fun_ref_t : public unary_function<T, S>
+{
+public:
+    explicit mem_fun_ref_t(S (T::*p)());
+    S operator()(T& p) const;
+};
+
+template<class S, class T, class A>
+class mem_fun1_ref_t : public binary_function<T, A, S>
+{
+public:
+    explicit mem_fun1_ref_t(S (T::*p)(A));
+    S operator()(T& p, A x) const;
+};
+
+template<class S, class T>          mem_fun_ref_t<S,T>    mem_fun_ref(S (T::*f)());
+template<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A));
+
+template <class S, class T>
+class const_mem_fun_t : public unary_function<const T*, S>
+{
+public:
+    explicit const_mem_fun_t(S (T::*p)() const);
+    S operator()(const T* p) const;
+};
+
+template <class S, class T, class A>
+class const_mem_fun1_t : public binary_function<const T*, A, S>
+{
+public:
+    explicit const_mem_fun1_t(S (T::*p)(A) const);
+    S operator()(const T* p, A x) const;
+};
+
+template <class S, class T>          const_mem_fun_t<S,T>    mem_fun(S (T::*f)() const);
+template <class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const);
+
+template <class S, class T>
+class const_mem_fun_ref_t : public unary_function<T, S>
+{
+public:
+    explicit const_mem_fun_ref_t(S (T::*p)() const);
+    S operator()(const T& p) const;
+};
+
+template <class S, class T, class A>
+class const_mem_fun1_ref_t : public binary_function<T, A, S>
+{
+public:
+    explicit const_mem_fun1_ref_t(S (T::*p)(A) const);
+    S operator()(const T& p, A x) const;
+};
+
+template <class S, class T>          const_mem_fun_ref_t<S,T>    mem_fun_ref(S (T::*f)() const);
+template <class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const);
+
+template<class R, class T> unspecified mem_fn(R T::*);
+
+class bad_function_call
+    : public exception
+{
+};
+
+template<class> class function; // undefined
+
+template<class R, class... ArgTypes>
+class function<R(ArgTypes...)>
+  : public unary_function<T1, R>      // iff sizeof...(ArgTypes) == 1 and
+                                      // ArgTypes contains T1
+  : public binary_function<T1, T2, R> // iff sizeof...(ArgTypes) == 2 and
+                                      // ArgTypes contains T1 and T2
+{
+public:
+    typedef R result_type;
+
+    // construct/copy/destroy:
+    function() noexcept;
+    function(nullptr_t) noexcept;
+    function(const function&);
+    function(function&&) noexcept;
+    template<class F>
+      function(F);
+    template<Allocator Alloc>
+      function(allocator_arg_t, const Alloc&) noexcept;
+    template<Allocator Alloc>
+      function(allocator_arg_t, const Alloc&, nullptr_t) noexcept;
+    template<Allocator Alloc>
+      function(allocator_arg_t, const Alloc&, const function&);
+    template<Allocator Alloc>
+      function(allocator_arg_t, const Alloc&, function&&);
+    template<class F, Allocator Alloc>
+      function(allocator_arg_t, const Alloc&, F);
+
+    function& operator=(const function&);
+    function& operator=(function&&) noexcept;
+    function& operator=(nullptr_t) noexcept;
+    template<class F>
+      function& operator=(F&&);
+    template<class F>
+      function& operator=(reference_wrapper<F>) noexcept;
+
+    ~function();
+
+    // function modifiers:
+    void swap(function&) noexcept;
+    template<class F, class Alloc>
+      void assign(F&&, const Alloc&);
+
+    // function capacity:
+    explicit operator bool() const noexcept;
+
+    // function invocation:
+    R operator()(ArgTypes...) const;
+
+    // function target access:
+    const std::type_info& target_type() const noexcept;
+    template <typename T>       T* target() noexcept;
+    template <typename T> const T* target() const noexcept;
+};
+
+// Null pointer comparisons:
+template <class R, class ... ArgTypes>
+  bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
+
+template <class R, class ... ArgTypes>
+  bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
+
+template <class R, class ... ArgTypes>
+  bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
+
+template <class  R, class ... ArgTypes>
+  bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
+
+// specialized algorithms:
+template <class  R, class ... ArgTypes>
+  void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept;
+
+template <class T> struct hash;
+
+template <> struct hash<bool>;
+template <> struct hash<char>;
+template <> struct hash<signed char>;
+template <> struct hash<unsigned char>;
+template <> struct hash<char16_t>;
+template <> struct hash<char32_t>;
+template <> struct hash<wchar_t>;
+template <> struct hash<short>;
+template <> struct hash<unsigned short>;
+template <> struct hash<int>;
+template <> struct hash<unsigned int>;
+template <> struct hash<long>;
+template <> struct hash<long long>;
+template <> struct hash<unsigned long>;
+template <> struct hash<unsigned long long>;
+
+template <> struct hash<float>;
+template <> struct hash<double>;
+template <> struct hash<long double>;
+
+template<class T> struct hash<T*>;
+
+}  // std
+
+POLICY:  For non-variadic implementations, the number of arguments is limited
+         to 3.  It is hoped that the need for non-variadic implementations
+         will be minimal.
+
+*/
+
+#include <__config>
+#include <type_traits>
+#include <typeinfo>
+#include <exception>
+#include <memory>
+#include <tuple>
+
+#include <__functional_base>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY plus : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x + __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY plus<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY minus : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x - __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY minus<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY multiplies : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x * __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY multiplies<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY divides : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x / __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY divides<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY modulus : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x % __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY modulus<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY negate : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return -__x;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY negate<void>
+{
+    template <class _Tp>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_Tp&& __x) const
+    _NOEXCEPT_(noexcept(- _VSTD::forward<_Tp>(__x)))
+    -> decltype        (- _VSTD::forward<_Tp>(__x))
+        { return        - _VSTD::forward<_Tp>(__x); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY equal_to : binary_function<_Tp, _Tp, bool>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x == __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY equal_to<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY not_equal_to : binary_function<_Tp, _Tp, bool>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x != __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY not_equal_to<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY greater : binary_function<_Tp, _Tp, bool>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x > __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY greater<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+// less in <__functional_base>
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY greater_equal : binary_function<_Tp, _Tp, bool>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x >= __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY greater_equal<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY less_equal : binary_function<_Tp, _Tp, bool>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x <= __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY less_equal<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY logical_and : binary_function<_Tp, _Tp, bool>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x && __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY logical_and<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY logical_or : binary_function<_Tp, _Tp, bool>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x || __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY logical_or<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY logical_not : unary_function<_Tp, bool>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Tp& __x) const
+        {return !__x;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY logical_not<void>
+{
+    template <class _Tp>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_Tp&& __x) const
+    _NOEXCEPT_(noexcept(!_VSTD::forward<_Tp>(__x)))
+    -> decltype        (!_VSTD::forward<_Tp>(__x))
+        { return        !_VSTD::forward<_Tp>(__x); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY bit_and : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x & __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY bit_and<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY bit_or : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x | __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY bit_or<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY bit_xor : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x ^ __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY bit_xor<void>
+{
+    template <class _T1, class _T2>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_T1&& __t, _T2&& __u) const
+    _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u)))
+    -> decltype        (_VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u))
+        { return        _VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u); }
+    typedef void is_transparent;
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+struct _LIBCPP_TYPE_VIS_ONLY bit_not : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return ~__x;}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY bit_not<void>
+{
+    template <class _Tp>
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    auto operator()(_Tp&& __x) const
+    _NOEXCEPT_(noexcept(~_VSTD::forward<_Tp>(__x)))
+    -> decltype        (~_VSTD::forward<_Tp>(__x))
+        { return        ~_VSTD::forward<_Tp>(__x); }
+    typedef void is_transparent;
+};
+#endif
+
+template <class _Predicate>
+class _LIBCPP_TYPE_VIS_ONLY unary_negate
+    : public unary_function<typename _Predicate::argument_type, bool>
+{
+    _Predicate __pred_;
+public:
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    explicit unary_negate(const _Predicate& __pred)
+        : __pred_(__pred) {}
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const typename _Predicate::argument_type& __x) const
+        {return !__pred_(__x);}
+};
+
+template <class _Predicate>
+inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+unary_negate<_Predicate>
+not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);}
+
+template <class _Predicate>
+class _LIBCPP_TYPE_VIS_ONLY binary_negate
+    : public binary_function<typename _Predicate::first_argument_type,
+                             typename _Predicate::second_argument_type,
+                             bool>
+{
+    _Predicate __pred_;
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR_AFTER_CXX11 
+    binary_negate(const _Predicate& __pred) : __pred_(__pred) {}
+
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const typename _Predicate::first_argument_type& __x,
+                    const typename _Predicate::second_argument_type& __y) const
+        {return !__pred_(__x, __y);}
+};
+
+template <class _Predicate>
+inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+binary_negate<_Predicate>
+not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
+
+template <class __Operation>
+class _LIBCPP_TYPE_VIS_ONLY binder1st
+    : public unary_function<typename __Operation::second_argument_type,
+                            typename __Operation::result_type>
+{
+protected:
+    __Operation                               op;
+    typename __Operation::first_argument_type value;
+public:
+    _LIBCPP_INLINE_VISIBILITY binder1st(const __Operation& __x,
+                               const typename __Operation::first_argument_type __y)
+        : op(__x), value(__y) {}
+    _LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
+        (typename __Operation::second_argument_type& __x) const
+            {return op(value, __x);}
+    _LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
+        (const typename __Operation::second_argument_type& __x) const
+            {return op(value, __x);}
+};
+
+template <class __Operation, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+binder1st<__Operation>
+bind1st(const __Operation& __op, const _Tp& __x)
+    {return binder1st<__Operation>(__op, __x);}
+
+template <class __Operation>
+class _LIBCPP_TYPE_VIS_ONLY binder2nd
+    : public unary_function<typename __Operation::first_argument_type,
+                            typename __Operation::result_type>
+{
+protected:
+    __Operation                                op;
+    typename __Operation::second_argument_type value;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    binder2nd(const __Operation& __x, const typename __Operation::second_argument_type __y)
+        : op(__x), value(__y) {}
+    _LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
+        (      typename __Operation::first_argument_type& __x) const
+            {return op(__x, value);}
+    _LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
+        (const typename __Operation::first_argument_type& __x) const
+            {return op(__x, value);}
+};
+
+template <class __Operation, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+binder2nd<__Operation>
+bind2nd(const __Operation& __op, const _Tp& __x)
+    {return binder2nd<__Operation>(__op, __x);}
+
+template <class _Arg, class _Result>
+class _LIBCPP_TYPE_VIS_ONLY pointer_to_unary_function
+    : public unary_function<_Arg, _Result>
+{
+    _Result (*__f_)(_Arg);
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit pointer_to_unary_function(_Result (*__f)(_Arg))
+        : __f_(__f) {}
+    _LIBCPP_INLINE_VISIBILITY _Result operator()(_Arg __x) const
+        {return __f_(__x);}
+};
+
+template <class _Arg, class _Result>
+inline _LIBCPP_INLINE_VISIBILITY
+pointer_to_unary_function<_Arg,_Result>
+ptr_fun(_Result (*__f)(_Arg))
+    {return pointer_to_unary_function<_Arg,_Result>(__f);}
+
+template <class _Arg1, class _Arg2, class _Result>
+class _LIBCPP_TYPE_VIS_ONLY pointer_to_binary_function
+    : public binary_function<_Arg1, _Arg2, _Result>
+{
+    _Result (*__f_)(_Arg1, _Arg2);
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit pointer_to_binary_function(_Result (*__f)(_Arg1, _Arg2))
+        : __f_(__f) {}
+    _LIBCPP_INLINE_VISIBILITY _Result operator()(_Arg1 __x, _Arg2 __y) const
+        {return __f_(__x, __y);}
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+inline _LIBCPP_INLINE_VISIBILITY
+pointer_to_binary_function<_Arg1,_Arg2,_Result>
+ptr_fun(_Result (*__f)(_Arg1,_Arg2))
+    {return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);}
+
+template<class _Sp, class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY mem_fun_t : public unary_function<_Tp*, _Sp>
+{
+    _Sp (_Tp::*__p_)();
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit mem_fun_t(_Sp (_Tp::*__p)())
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY _Sp operator()(_Tp* __p) const
+        {return (__p->*__p_)();}
+};
+
+template<class _Sp, class _Tp, class _Ap>
+class _LIBCPP_TYPE_VIS_ONLY mem_fun1_t : public binary_function<_Tp*, _Ap, _Sp>
+{
+    _Sp (_Tp::*__p_)(_Ap);
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit mem_fun1_t(_Sp (_Tp::*__p)(_Ap))
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY _Sp operator()(_Tp* __p, _Ap __x) const
+        {return (__p->*__p_)(__x);}
+};
+
+template<class _Sp, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+mem_fun_t<_Sp,_Tp>
+mem_fun(_Sp (_Tp::*__f)())
+    {return mem_fun_t<_Sp,_Tp>(__f);}
+
+template<class _Sp, class _Tp, class _Ap>
+inline _LIBCPP_INLINE_VISIBILITY
+mem_fun1_t<_Sp,_Tp,_Ap>
+mem_fun(_Sp (_Tp::*__f)(_Ap))
+    {return mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
+
+template<class _Sp, class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY mem_fun_ref_t : public unary_function<_Tp, _Sp>
+{
+    _Sp (_Tp::*__p_)();
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit mem_fun_ref_t(_Sp (_Tp::*__p)())
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY _Sp operator()(_Tp& __p) const
+        {return (__p.*__p_)();}
+};
+
+template<class _Sp, class _Tp, class _Ap>
+class _LIBCPP_TYPE_VIS_ONLY mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp>
+{
+    _Sp (_Tp::*__p_)(_Ap);
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap))
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY _Sp operator()(_Tp& __p, _Ap __x) const
+        {return (__p.*__p_)(__x);}
+};
+
+template<class _Sp, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+mem_fun_ref_t<_Sp,_Tp>
+mem_fun_ref(_Sp (_Tp::*__f)())
+    {return mem_fun_ref_t<_Sp,_Tp>(__f);}
+
+template<class _Sp, class _Tp, class _Ap>
+inline _LIBCPP_INLINE_VISIBILITY
+mem_fun1_ref_t<_Sp,_Tp,_Ap>
+mem_fun_ref(_Sp (_Tp::*__f)(_Ap))
+    {return mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
+
+template <class _Sp, class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY const_mem_fun_t : public unary_function<const _Tp*, _Sp>
+{
+    _Sp (_Tp::*__p_)() const;
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit const_mem_fun_t(_Sp (_Tp::*__p)() const)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY _Sp operator()(const _Tp* __p) const
+        {return (__p->*__p_)();}
+};
+
+template <class _Sp, class _Tp, class _Ap>
+class _LIBCPP_TYPE_VIS_ONLY const_mem_fun1_t : public binary_function<const _Tp*, _Ap, _Sp>
+{
+    _Sp (_Tp::*__p_)(_Ap) const;
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit const_mem_fun1_t(_Sp (_Tp::*__p)(_Ap) const)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY _Sp operator()(const _Tp* __p, _Ap __x) const
+        {return (__p->*__p_)(__x);}
+};
+
+template <class _Sp, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+const_mem_fun_t<_Sp,_Tp>
+mem_fun(_Sp (_Tp::*__f)() const)
+    {return const_mem_fun_t<_Sp,_Tp>(__f);}
+
+template <class _Sp, class _Tp, class _Ap>
+inline _LIBCPP_INLINE_VISIBILITY
+const_mem_fun1_t<_Sp,_Tp,_Ap>
+mem_fun(_Sp (_Tp::*__f)(_Ap) const)
+    {return const_mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
+
+template <class _Sp, class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY const_mem_fun_ref_t : public unary_function<_Tp, _Sp>
+{
+    _Sp (_Tp::*__p_)() const;
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit const_mem_fun_ref_t(_Sp (_Tp::*__p)() const)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY _Sp operator()(const _Tp& __p) const
+        {return (__p.*__p_)();}
+};
+
+template <class _Sp, class _Tp, class _Ap>
+class _LIBCPP_TYPE_VIS_ONLY const_mem_fun1_ref_t
+    : public binary_function<_Tp, _Ap, _Sp>
+{
+    _Sp (_Tp::*__p_)(_Ap) const;
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit const_mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap) const)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY _Sp operator()(const _Tp& __p, _Ap __x) const
+        {return (__p.*__p_)(__x);}
+};
+
+template <class _Sp, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+const_mem_fun_ref_t<_Sp,_Tp>
+mem_fun_ref(_Sp (_Tp::*__f)() const)
+    {return const_mem_fun_ref_t<_Sp,_Tp>(__f);}
+
+template <class _Sp, class _Tp, class _Ap>
+inline _LIBCPP_INLINE_VISIBILITY
+const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
+mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
+    {return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
+
+////////////////////////////////////////////////////////////////////////////////
+//                                MEMFUN
+//==============================================================================
+
+template <class _Tp>
+class __mem_fn
+    : public __weak_result_type<_Tp>
+{
+public:
+    // types
+    typedef _Tp type;
+private:
+    type __f_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) : __f_(__f) {}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    // invoke
+    template <class... _ArgTypes>
+    _LIBCPP_INLINE_VISIBILITY
+    typename __invoke_return<type, _ArgTypes...>::type
+    operator() (_ArgTypes&&... __args) const {
+        return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
+    }
+#else
+
+    template <class _A0>
+    typename __invoke_return0<type, _A0>::type
+    operator() (_A0& __a0) const {
+        return __invoke(__f_, __a0);
+    }
+
+    template <class _A0, class _A1>
+    typename __invoke_return1<type, _A0, _A1>::type
+    operator() (_A0& __a0, _A1& __a1) const {
+        return __invoke(__f_, __a0, __a1);
+    }
+
+    template <class _A0, class _A1, class _A2>
+    typename __invoke_return2<type, _A0, _A1, _A2>::type
+    operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
+        return __invoke(__f_, __a0, __a1, __a2);
+    }
+#endif
+};
+
+template<class _Rp, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__mem_fn<_Rp _Tp::*>
+mem_fn(_Rp _Tp::* __pm)
+{
+    return __mem_fn<_Rp _Tp::*>(__pm);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//                                FUNCTION
+//==============================================================================
+
+// bad_function_call
+
+class _LIBCPP_EXCEPTION_ABI bad_function_call
+    : public exception
+{
+};
+
+template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined
+
+namespace __function
+{
+
+template<class _Rp>
+struct __maybe_derive_from_unary_function
+{
+};
+
+template<class _Rp, class _A1>
+struct __maybe_derive_from_unary_function<_Rp(_A1)>
+    : public unary_function<_A1, _Rp>
+{
+};
+
+template<class _Rp>
+struct __maybe_derive_from_binary_function
+{
+};
+
+template<class _Rp, class _A1, class _A2>
+struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
+    : public binary_function<_A1, _A2, _Rp>
+{
+};
+
+template <class _Fp>
+_LIBCPP_INLINE_VISIBILITY
+bool __not_null(_Fp const&) { return true; }
+
+template <class _Fp>
+_LIBCPP_INLINE_VISIBILITY
+bool __not_null(_Fp* __ptr) { return __ptr; }
+
+template <class _Ret, class _Class>
+_LIBCPP_INLINE_VISIBILITY
+bool __not_null(_Ret _Class::*__ptr) { return __ptr; }
+
+template <class _Fp>
+_LIBCPP_INLINE_VISIBILITY
+bool __not_null(function<_Fp> const& __f) { return !!__f; }
+
+} // namespace __function
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+namespace __function {
+
+template<class _Fp> class __base;
+
+template<class _Rp, class ..._ArgTypes>
+class __base<_Rp(_ArgTypes...)>
+{
+    __base(const __base&);
+    __base& operator=(const __base&);
+public:
+    _LIBCPP_INLINE_VISIBILITY __base() {}
+    _LIBCPP_INLINE_VISIBILITY virtual ~__base() {}
+    virtual __base* __clone() const = 0;
+    virtual void __clone(__base*) const = 0;
+    virtual void destroy() _NOEXCEPT = 0;
+    virtual void destroy_deallocate() _NOEXCEPT = 0;
+    virtual _Rp operator()(_ArgTypes&& ...) = 0;
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* target(const type_info&) const _NOEXCEPT = 0;
+    virtual const std::type_info& target_type() const _NOEXCEPT = 0;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _FD, class _Alloc, class _FB> class __func;
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+class __func<_Fp, _Alloc, _Rp(_ArgTypes...)>
+    : public  __base<_Rp(_ArgTypes...)>
+{
+    __compressed_pair<_Fp, _Alloc> __f_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __func(_Fp&& __f)
+        : __f_(piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__f)),
+                                    _VSTD::forward_as_tuple()) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __func(const _Fp& __f, const _Alloc& __a)
+        : __f_(piecewise_construct, _VSTD::forward_as_tuple(__f),
+                                    _VSTD::forward_as_tuple(__a)) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __func(const _Fp& __f, _Alloc&& __a)
+        : __f_(piecewise_construct, _VSTD::forward_as_tuple(__f),
+                                    _VSTD::forward_as_tuple(_VSTD::move(__a))) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __func(_Fp&& __f, _Alloc&& __a)
+        : __f_(piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__f)),
+                                    _VSTD::forward_as_tuple(_VSTD::move(__a))) {}
+    virtual __base<_Rp(_ArgTypes...)>* __clone() const;
+    virtual void __clone(__base<_Rp(_ArgTypes...)>*) const;
+    virtual void destroy() _NOEXCEPT;
+    virtual void destroy_deallocate() _NOEXCEPT;
+    virtual _Rp operator()(_ArgTypes&& ... __arg);
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* target(const type_info&) const _NOEXCEPT;
+    virtual const std::type_info& target_type() const _NOEXCEPT;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+__base<_Rp(_ArgTypes...)>*
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
+    _Ap __a(__f_.second());
+    typedef __allocator_destructor<_Ap> _Dp;
+    unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+    ::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
+    return __hold.release();
+}
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+void
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const
+{
+    ::new (__p) __func(__f_.first(), __f_.second());
+}
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+void
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() _NOEXCEPT
+{
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+}
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+void
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
+    _Ap __a(__f_.second());
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+    __a.deallocate(this, 1);
+}
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+_Rp
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
+{
+    typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+    return _Invoker::__call(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+const void*
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT
+{
+    if (__ti == typeid(_Fp))
+        return &__f_.first();
+    return (const void*)0;
+}
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+const std::type_info&
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target_type() const _NOEXCEPT
+{
+    return typeid(_Fp);
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+}  // __function
+
+template<class _Rp, class ..._ArgTypes>
+class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_ArgTypes...)>
+    : public __function::__maybe_derive_from_unary_function<_Rp(_ArgTypes...)>,
+      public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)>
+{
+    typedef __function::__base<_Rp(_ArgTypes...)> __base;
+    typename aligned_storage<3*sizeof(void*)>::type __buf_;
+    __base* __f_;
+
+    template <class _Fp, bool = !is_same<_Fp, function>::value &&
+                                __invokable<_Fp&, _ArgTypes...>::value>
+        struct __callable;
+    template <class _Fp>
+        struct __callable<_Fp, true>
+        {
+            static const bool value = is_same<void, _Rp>::value ||
+                is_convertible<typename __invoke_of<_Fp&, _ArgTypes...>::type,
+                               _Rp>::value;
+        };
+    template <class _Fp>
+        struct __callable<_Fp, false>
+        {
+            static const bool value = false;
+        };
+public:
+    typedef _Rp result_type;
+
+    // construct/copy/destroy:
+    _LIBCPP_INLINE_VISIBILITY
+    function() _NOEXCEPT : __f_(0) {}
+    _LIBCPP_INLINE_VISIBILITY
+    function(nullptr_t) _NOEXCEPT : __f_(0) {}
+    function(const function&);
+    function(function&&) _NOEXCEPT;
+    template<class _Fp>
+      function(_Fp, typename enable_if
+                                     <
+                                        __callable<_Fp>::value &&
+                                        !is_same<_Fp, function>::value
+                                      >::type* = 0);
+
+    template<class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      function(allocator_arg_t, const _Alloc&) _NOEXCEPT : __f_(0) {}
+    template<class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      function(allocator_arg_t, const _Alloc&, nullptr_t) _NOEXCEPT : __f_(0) {}
+    template<class _Alloc>
+      function(allocator_arg_t, const _Alloc&, const function&);
+    template<class _Alloc>
+      function(allocator_arg_t, const _Alloc&, function&&);
+    template<class _Fp, class _Alloc>
+      function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+               typename enable_if<__callable<_Fp>::value>::type* = 0);
+
+    function& operator=(const function&);
+    function& operator=(function&&) _NOEXCEPT;
+    function& operator=(nullptr_t) _NOEXCEPT;
+    template<class _Fp>
+      typename enable_if
+      <
+        __callable<typename decay<_Fp>::type>::value &&
+        !is_same<typename remove_reference<_Fp>::type, function>::value,
+        function&
+      >::type
+      operator=(_Fp&&);
+
+    ~function();
+
+    // function modifiers:
+    void swap(function&) _NOEXCEPT;
+    template<class _Fp, class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      void assign(_Fp&& __f, const _Alloc& __a)
+        {function(allocator_arg, __a, _VSTD::forward<_Fp>(__f)).swap(*this);}
+
+    // function capacity:
+    _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return __f_;}
+
+    // deleted overloads close possible hole in the type system
+    template<class _R2, class... _ArgTypes2>
+      bool operator==(const function<_R2(_ArgTypes2...)>&) const = delete;
+    template<class _R2, class... _ArgTypes2>
+      bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete;
+public:
+    // function invocation:
+    _Rp operator()(_ArgTypes...) const;
+
+#ifndef _LIBCPP_NO_RTTI
+    // function target access:
+    const std::type_info& target_type() const _NOEXCEPT;
+    template <typename _Tp> _Tp* target() _NOEXCEPT;
+    template <typename _Tp> const _Tp* target() const _NOEXCEPT;
+#endif  // _LIBCPP_NO_RTTI
+};
+
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>::function(const function& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (const __base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+        __f_ = __f.__f_->__clone();
+}
+
+template<class _Rp, class ..._ArgTypes>
+template <class _Alloc>
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
+                                     const function& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (const __base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+        __f_ = __f.__f_->__clone();
+}
+
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+    {
+        __f_ = __f.__f_;
+        __f.__f_ = 0;
+    }
+}
+
+template<class _Rp, class ..._ArgTypes>
+template <class _Alloc>
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
+                                     function&& __f)
+{
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+    {
+        __f_ = __f.__f_;
+        __f.__f_ = 0;
+    }
+}
+
+template<class _Rp, class ..._ArgTypes>
+template <class _Fp>
+function<_Rp(_ArgTypes...)>::function(_Fp __f,
+                                     typename enable_if
+                                     <
+                                        __callable<_Fp>::value &&
+                                        !is_same<_Fp, function>::value
+                                     >::type*)
+    : __f_(0)
+{
+    if (__function::__not_null(__f))
+    {
+        typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_ArgTypes...)> _FF;
+        if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value)
+        {
+            __f_ = (__base*)&__buf_;
+            ::new (__f_) _FF(_VSTD::move(__f));
+        }
+        else
+        {
+            typedef allocator<_FF> _Ap;
+            _Ap __a;
+            typedef __allocator_destructor<_Ap> _Dp;
+            unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+            ::new (__hold.get()) _FF(_VSTD::move(__f), allocator<_Fp>(__a));
+            __f_ = __hold.release();
+        }
+    }
+}
+
+template<class _Rp, class ..._ArgTypes>
+template <class _Fp, class _Alloc>
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+                                     typename enable_if<__callable<_Fp>::value>::type*)
+    : __f_(0)
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+    if (__function::__not_null(__f))
+    {
+        typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _FF;
+        typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
+        _Ap __a(__a0);
+        if (sizeof(_FF) <= sizeof(__buf_) && 
+            is_nothrow_copy_constructible<_Fp>::value && is_nothrow_copy_constructible<_Ap>::value)
+        {
+            __f_ = (__base*)&__buf_;
+            ::new (__f_) _FF(_VSTD::move(__f), _Alloc(__a));
+        }
+        else
+        {
+            typedef __allocator_destructor<_Ap> _Dp;
+            unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+            ::new (__hold.get()) _FF(_VSTD::move(__f), _Alloc(__a));
+            __f_ = __hold.release();
+        }
+    }
+}
+
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>&
+function<_Rp(_ArgTypes...)>::operator=(const function& __f)
+{
+    function(__f).swap(*this);
+    return *this;
+}
+
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>&
+function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+    __f_ = 0;
+    if (__f.__f_ == 0)
+        __f_ = 0;
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__clone(__f_);
+    }
+    else
+    {
+        __f_ = __f.__f_;
+        __f.__f_ = 0;
+    }
+    return *this;
+}
+
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>&
+function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+    __f_ = 0;
+    return *this;
+}
+
+template<class _Rp, class ..._ArgTypes>
+template <class _Fp>
+typename enable_if
+<
+    function<_Rp(_ArgTypes...)>::template __callable<typename decay<_Fp>::type>::value &&
+    !is_same<typename remove_reference<_Fp>::type, function<_Rp(_ArgTypes...)>>::value,
+    function<_Rp(_ArgTypes...)>&
+>::type
+function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f)
+{
+    function(_VSTD::forward<_Fp>(__f)).swap(*this);
+    return *this;
+}
+
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>::~function()
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+}
+
+template<class _Rp, class ..._ArgTypes>
+void
+function<_Rp(_ArgTypes...)>::swap(function& __f) _NOEXCEPT
+{
+    if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
+    {
+        typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
+        __base* __t = (__base*)&__tempbuf;
+        __f_->__clone(__t);
+        __f_->destroy();
+        __f_ = 0;
+        __f.__f_->__clone((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = 0;
+        __f_ = (__base*)&__buf_;
+        __t->__clone((__base*)&__f.__buf_);
+        __t->destroy();
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f_ == (__base*)&__buf_)
+    {
+        __f_->__clone((__base*)&__f.__buf_);
+        __f_->destroy();
+        __f_ = __f.__f_;
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f.__f_->__clone((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = __f_;
+        __f_ = (__base*)&__buf_;
+    }
+    else
+        _VSTD::swap(__f_, __f.__f_);
+}
+
+template<class _Rp, class ..._ArgTypes>
+_Rp
+function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__f_ == 0)
+        throw bad_function_call();
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return (*__f_)(_VSTD::forward<_ArgTypes>(__arg)...);
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Rp, class ..._ArgTypes>
+const std::type_info&
+function<_Rp(_ArgTypes...)>::target_type() const _NOEXCEPT
+{
+    if (__f_ == 0)
+        return typeid(void);
+    return __f_->target_type();
+}
+
+template<class _Rp, class ..._ArgTypes>
+template <typename _Tp>
+_Tp*
+function<_Rp(_ArgTypes...)>::target() _NOEXCEPT
+{
+    if (__f_ == 0)
+        return (_Tp*)0;
+    return (_Tp*)__f_->target(typeid(_Tp));
+}
+
+template<class _Rp, class ..._ArgTypes>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT
+{
+    if (__f_ == 0)
+        return (const _Tp*)0;
+    return (const _Tp*)__f_->target(typeid(_Tp));
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+template <class _Rp, class... _ArgTypes>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;}
+
+template <class _Rp, class... _ArgTypes>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return !__f;}
+
+template <class _Rp, class... _ArgTypes>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;}
+
+template <class _Rp, class... _ArgTypes>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;}
+
+template <class _Rp, class... _ArgTypes>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
+{return __x.swap(__y);}
+
+#else // _LIBCPP_HAS_NO_VARIADICS
+
+#include <__functional_03>
+
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+//                                  BIND
+//==============================================================================
+
+template<class _Tp> struct __is_bind_expression : public false_type {};
+template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression
+    : public __is_bind_expression<typename remove_cv<_Tp>::type> {};
+
+template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {};
+template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_placeholder
+    : public __is_placeholder<typename remove_cv<_Tp>::type> {};
+
+namespace placeholders
+{
+
+template <int _Np> struct __ph {};
+
+_LIBCPP_FUNC_VIS extern __ph<1>   _1;
+_LIBCPP_FUNC_VIS extern __ph<2>   _2;
+_LIBCPP_FUNC_VIS extern __ph<3>   _3;
+_LIBCPP_FUNC_VIS extern __ph<4>   _4;
+_LIBCPP_FUNC_VIS extern __ph<5>   _5;
+_LIBCPP_FUNC_VIS extern __ph<6>   _6;
+_LIBCPP_FUNC_VIS extern __ph<7>   _7;
+_LIBCPP_FUNC_VIS extern __ph<8>   _8;
+_LIBCPP_FUNC_VIS extern __ph<9>   _9;
+_LIBCPP_FUNC_VIS extern __ph<10> _10;
+
+}  // placeholders
+
+template<int _Np>
+struct __is_placeholder<placeholders::__ph<_Np> >
+    : public integral_constant<int, _Np> {};
+
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Uj>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp&
+__mu(reference_wrapper<_Tp> __t, _Uj&)
+{
+    return __t.get();
+}
+
+template <class _Ti, class ..._Uj, size_t ..._Indx>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __invoke_of<_Ti&, _Uj...>::type
+__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>)
+{
+    return __ti(_VSTD::forward<_Uj>(_VSTD::get<_Indx>(__uj))...);
+}
+
+template <class _Ti, class ..._Uj>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_bind_expression<_Ti>::value,
+    __invoke_of<_Ti&, _Uj...>
+>::type
+__mu(_Ti& __ti, tuple<_Uj...>& __uj)
+{
+    typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
+    return  __mu_expand(__ti, __uj, __indices());
+}
+
+template <bool IsPh, class _Ti, class _Uj>
+struct __mu_return2 {};
+
+template <class _Ti, class _Uj>
+struct __mu_return2<true, _Ti, _Uj>
+{
+    typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type;
+};
+
+template <class _Ti, class _Uj>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    0 < is_placeholder<_Ti>::value,
+    typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
+>::type
+__mu(_Ti&, _Uj& __uj)
+{
+    const size_t _Indx = is_placeholder<_Ti>::value - 1;
+    return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj));
+}
+
+template <class _Ti, class _Uj>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_bind_expression<_Ti>::value &&
+    is_placeholder<_Ti>::value == 0 &&
+    !__is_reference_wrapper<_Ti>::value,
+    _Ti&
+>::type
+__mu(_Ti& __ti, _Uj&)
+{
+    return __ti;
+}
+
+template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh,
+          class _TupleUj>
+struct ____mu_return;
+
+template <bool _Invokable, class _Ti, class ..._Uj>
+struct ____mu_return_invokable  // false
+{
+    typedef __nat type;
+};
+
+template <class _Ti, class ..._Uj>
+struct ____mu_return_invokable<true, _Ti, _Uj...>
+{
+    typedef typename __invoke_of<_Ti&, _Uj...>::type type;
+};
+
+template <class _Ti, class ..._Uj>
+struct ____mu_return<_Ti, false, true, false, tuple<_Uj...> >
+    : public ____mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...>
+{
+};
+
+template <class _Ti, class _TupleUj>
+struct ____mu_return<_Ti, false, false, true, _TupleUj>
+{
+    typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
+                                   _TupleUj>::type&& type;
+};
+
+template <class _Ti, class _TupleUj>
+struct ____mu_return<_Ti, true, false, false, _TupleUj>
+{
+    typedef typename _Ti::type& type;
+};
+
+template <class _Ti, class _TupleUj>
+struct ____mu_return<_Ti, false, false, false, _TupleUj>
+{
+    typedef _Ti& type;
+};
+
+template <class _Ti, class _TupleUj>
+struct __mu_return
+    : public ____mu_return<_Ti,
+                           __is_reference_wrapper<_Ti>::value,
+                           is_bind_expression<_Ti>::value,
+                           0 < is_placeholder<_Ti>::value &&
+                           is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value,
+                           _TupleUj>
+{
+};
+
+template <class _Fp, class _BoundArgs, class _TupleUj>
+struct __is_valid_bind_return
+{
+    static const bool value = false;
+};
+
+template <class _Fp, class ..._BoundArgs, class _TupleUj>
+struct __is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
+{
+    static const bool value = __invokable<_Fp,
+                    typename __mu_return<_BoundArgs, _TupleUj>::type...>::value;
+};
+
+template <class _Fp, class ..._BoundArgs, class _TupleUj>
+struct __is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
+{
+    static const bool value = __invokable<_Fp,
+                    typename __mu_return<const _BoundArgs, _TupleUj>::type...>::value;
+};
+
+template <class _Fp, class _BoundArgs, class _TupleUj,
+          bool = __is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value>
+struct __bind_return;
+
+template <class _Fp, class ..._BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj, true>
+{
+    typedef typename __invoke_of
+    <
+        _Fp&,
+        typename __mu_return
+        <
+            _BoundArgs,
+            _TupleUj
+        >::type...
+    >::type type;
+};
+
+template <class _Fp, class ..._BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true>
+{
+    typedef typename __invoke_of
+    <
+        _Fp&,
+        typename __mu_return
+        <
+            const _BoundArgs,
+            _TupleUj
+        >::type...
+    >::type type;
+};
+
+template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __bind_return<_Fp, _BoundArgs, _Args>::type
+__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
+                _Args&& __args)
+{
+    return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...);
+}
+
+template<class _Fp, class ..._BoundArgs>
+class __bind
+    : public __weak_result_type<typename decay<_Fp>::type>
+{
+protected:
+    typedef typename decay<_Fp>::type _Fd;
+    typedef tuple<typename decay<_BoundArgs>::type...> _Td;
+private:
+    _Fd __f_;
+    _Td __bound_args_;
+
+    typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
+public:
+#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bind(const __bind& __b)
+        : __f_(__b.__f_),
+          __bound_args_(__b.__bound_args_) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bind& operator=(const __bind& __b)
+    {
+        __f_ = __b.__f_;
+        __bound_args_ = __b.__bound_args_;
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bind(__bind&& __b)
+        : __f_(_VSTD::move(__b.__f_)),
+          __bound_args_(_VSTD::move(__b.__bound_args_)) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bind& operator=(__bind&& __b)
+    {
+        __f_ = _VSTD::move(__b.__f_);
+        __bound_args_ = _VSTD::move(__b.__bound_args_);
+        return *this;
+    }
+
+#endif  // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+
+    template <class _Gp, class ..._BA,
+              class = typename enable_if
+                               <
+                                  is_constructible<_Fd, _Gp>::value &&
+                                  !is_same<typename remove_reference<_Gp>::type,
+                                           __bind>::value
+                               >::type>
+      _LIBCPP_INLINE_VISIBILITY
+      explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
+        : __f_(_VSTD::forward<_Gp>(__f)),
+          __bound_args_(_VSTD::forward<_BA>(__bound_args)...) {}
+
+    template <class ..._Args>
+        _LIBCPP_INLINE_VISIBILITY
+        typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
+        operator()(_Args&& ...__args)
+        {
+            return __apply_functor(__f_, __bound_args_, __indices(),
+                                  tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...));
+        }
+
+    template <class ..._Args>
+        _LIBCPP_INLINE_VISIBILITY
+        typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
+        operator()(_Args&& ...__args) const
+        {
+            return __apply_functor(__f_, __bound_args_, __indices(),
+                                   tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...));
+        }
+};
+
+template<class _Fp, class ..._BoundArgs>
+struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
+
+template<class _Rp, class _Fp, class ..._BoundArgs>
+class __bind_r
+    : public __bind<_Fp, _BoundArgs...>
+{
+    typedef __bind<_Fp, _BoundArgs...> base;
+    typedef typename base::_Fd _Fd;
+    typedef typename base::_Td _Td;
+public:
+    typedef _Rp result_type;
+
+#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bind_r(const __bind_r& __b)
+        : base(_VSTD::forward<const base&>(__b)) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bind_r& operator=(const __bind_r& __b)
+    {
+        base::operator=(_VSTD::forward<const base&>(__b));
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bind_r(__bind_r&& __b)
+        : base(_VSTD::forward<base>(__b)) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bind_r& operator=(__bind_r&& __b)
+    {
+        base::operator=(_VSTD::forward<base>(__b));
+        return *this;
+    }
+
+#endif  // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+
+    template <class _Gp, class ..._BA,
+              class = typename enable_if
+                               <
+                                  is_constructible<_Fd, _Gp>::value &&
+                                  !is_same<typename remove_reference<_Gp>::type,
+                                           __bind_r>::value
+                               >::type>
+      _LIBCPP_INLINE_VISIBILITY
+      explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args)
+        : base(_VSTD::forward<_Gp>(__f),
+               _VSTD::forward<_BA>(__bound_args)...) {}
+
+    template <class ..._Args>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type,
+                           result_type>::value || is_void<_Rp>::value,
+            result_type
+        >::type
+        operator()(_Args&& ...__args)
+        {
+            typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+            return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...);
+        }
+
+    template <class ..._Args>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
+                           result_type>::value || is_void<_Rp>::value,
+            result_type
+        >::type
+        operator()(_Args&& ...__args) const
+        {
+            typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+            return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...);
+        }
+};
+
+template<class _Rp, class _Fp, class ..._BoundArgs>
+struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
+
+template<class _Fp, class ..._BoundArgs>
+inline _LIBCPP_INLINE_VISIBILITY
+__bind<_Fp, _BoundArgs...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args)
+{
+    typedef __bind<_Fp, _BoundArgs...> type;
+    return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
+}
+
+template<class _Rp, class _Fp, class ..._BoundArgs>
+inline _LIBCPP_INLINE_VISIBILITY
+__bind_r<_Rp, _Fp, _BoundArgs...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args)
+{
+    typedef __bind_r<_Rp, _Fp, _BoundArgs...> type;
+    return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<bool>
+    : public unary_function<bool, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<char>
+    : public unary_function<char, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<signed char>
+    : public unary_function<signed char, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned char>
+    : public unary_function<unsigned char, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<char16_t>
+    : public unary_function<char16_t, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<char32_t>
+    : public unary_function<char32_t, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<wchar_t>
+    : public unary_function<wchar_t, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<short>
+    : public unary_function<short, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned short>
+    : public unary_function<unsigned short, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<int>
+    : public unary_function<int, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned int>
+    : public unary_function<unsigned int, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<long>
+    : public unary_function<long, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned long>
+    : public unary_function<unsigned long, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<long long>
+    : public __scalar_hash<long long>
+{
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned long long>
+    : public __scalar_hash<unsigned long long>
+{
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<float>
+    : public __scalar_hash<float>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(float __v) const _NOEXCEPT
+    {
+        // -0.0 and 0.0 should return same hash
+       if (__v == 0)
+           return 0;
+        return __scalar_hash<float>::operator()(__v);
+    }
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<double>
+    : public __scalar_hash<double>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(double __v) const _NOEXCEPT
+    {
+        // -0.0 and 0.0 should return same hash
+       if (__v == 0)
+           return 0;
+        return __scalar_hash<double>::operator()(__v);
+    }
+};
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<long double>
+    : public __scalar_hash<long double>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(long double __v) const _NOEXCEPT
+    {
+        // -0.0 and 0.0 should return same hash
+        if (__v == 0)
+            return 0;
+#if defined(__i386__)
+        // Zero out padding bits
+        union
+        {
+            long double __t;
+            struct
+            {
+                size_t __a;
+                size_t __b;
+                size_t __c;
+                size_t __d;
+            } __s;
+        } __u;
+        __u.__s.__a = 0;
+        __u.__s.__b = 0;
+        __u.__s.__c = 0;
+        __u.__s.__d = 0;
+        __u.__t = __v;
+        return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
+#elif defined(__x86_64__)
+        // Zero out padding bits
+        union
+        {
+            long double __t;
+            struct
+            {
+                size_t __a;
+                size_t __b;
+            } __s;
+        } __u;
+        __u.__s.__a = 0;
+        __u.__s.__b = 0;
+        __u.__t = __v;
+        return __u.__s.__a ^ __u.__s.__b;
+#else
+        return __scalar_hash<long double>::operator()(__v);
+#endif
+    }
+};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY hash
+    : public unary_function<_Tp, size_t>
+{
+    static_assert(is_enum<_Tp>::value, "This hash only works for enumeration types");
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(_Tp __v) const _NOEXCEPT
+    {
+        typedef typename underlying_type<_Tp>::type type;
+        return hash<type>{}(static_cast<type>(__v));
+    }
+};
+#endif
+
+
+#if _LIBCPP_STD_VER > 14
+template <class _Fn, class ..._Args>
+result_of_t<_Fn&&(_Args&&...)>
+invoke(_Fn&& __f, _Args&&... __args) {
+    return __invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);
+}
+#endif
+
+// struct hash<T*> in <memory>
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_FUNCTIONAL

Property changes on: lab4/.minix-src/include/c++/functional
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/deque
===================================================================
--- lab4/.minix-src/include/c++/deque	(nonexistent)
+++ lab4/.minix-src/include/c++/deque	(revision 13)
@@ -0,0 +1,2860 @@
+// -*- C++ -*-
+//===---------------------------- deque -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_DEQUE
+#define _LIBCPP_DEQUE
+
+/*
+    deque synopsis
+
+namespace std
+{
+
+template <class T, class Allocator = allocator<T> >
+class deque
+{
+public:
+    // types:
+    typedef T value_type;
+    typedef Allocator allocator_type;
+
+    typedef typename allocator_type::reference       reference;
+    typedef typename allocator_type::const_reference const_reference;
+    typedef implementation-defined                   iterator;
+    typedef implementation-defined                   const_iterator;
+    typedef typename allocator_type::size_type       size_type;
+    typedef typename allocator_type::difference_type difference_type;
+
+    typedef typename allocator_type::pointer         pointer;
+    typedef typename allocator_type::const_pointer   const_pointer;
+    typedef std::reverse_iterator<iterator>          reverse_iterator;
+    typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
+
+    // construct/copy/destroy:
+    deque() noexcept(is_nothrow_default_constructible<allocator_type>::value);
+    explicit deque(const allocator_type& a);
+    explicit deque(size_type n);
+    explicit deque(size_type n, const allocator_type& a); // C++14
+    deque(size_type n, const value_type& v);
+    deque(size_type n, const value_type& v, const allocator_type& a);
+    template <class InputIterator>
+        deque(InputIterator f, InputIterator l);
+    template <class InputIterator>
+        deque(InputIterator f, InputIterator l, const allocator_type& a);
+    deque(const deque& c);
+    deque(deque&& c)
+        noexcept(is_nothrow_move_constructible<allocator_type>::value);
+    deque(initializer_list<value_type> il, const Allocator& a = allocator_type());
+    deque(const deque& c, const allocator_type& a);
+    deque(deque&& c, const allocator_type& a);
+    ~deque();
+
+    deque& operator=(const deque& c);
+    deque& operator=(deque&& c)
+        noexcept(
+             allocator_type::propagate_on_container_move_assignment::value &&
+             is_nothrow_move_assignable<allocator_type>::value);
+    deque& operator=(initializer_list<value_type> il);
+
+    template <class InputIterator>
+        void assign(InputIterator f, InputIterator l);
+    void assign(size_type n, const value_type& v);
+    void assign(initializer_list<value_type> il);
+
+    allocator_type get_allocator() const noexcept;
+
+    // iterators:
+
+    iterator       begin() noexcept;
+    const_iterator begin() const noexcept;
+    iterator       end() noexcept;
+    const_iterator end() const noexcept;
+
+    reverse_iterator       rbegin() noexcept;
+    const_reverse_iterator rbegin() const noexcept;
+    reverse_iterator       rend() noexcept;
+    const_reverse_iterator rend() const noexcept;
+
+    const_iterator         cbegin() const noexcept;
+    const_iterator         cend() const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    const_reverse_iterator crend() const noexcept;
+
+    // capacity:
+    size_type size() const noexcept;
+    size_type max_size() const noexcept;
+    void resize(size_type n);
+    void resize(size_type n, const value_type& v);
+    void shrink_to_fit();
+    bool empty() const noexcept;
+
+    // element access:
+    reference operator[](size_type i);
+    const_reference operator[](size_type i) const;
+    reference at(size_type i);
+    const_reference at(size_type i) const;
+    reference front();
+    const_reference front() const;
+    reference back();
+    const_reference back() const;
+
+    // modifiers:
+    void push_front(const value_type& v);
+    void push_front(value_type&& v);
+    void push_back(const value_type& v);
+    void push_back(value_type&& v);
+    template <class... Args> void emplace_front(Args&&... args);
+    template <class... Args> void emplace_back(Args&&... args);
+    template <class... Args> iterator emplace(const_iterator p, Args&&... args);
+    iterator insert(const_iterator p, const value_type& v);
+    iterator insert(const_iterator p, value_type&& v);
+    iterator insert(const_iterator p, size_type n, const value_type& v);
+    template <class InputIterator>
+        iterator insert(const_iterator p, InputIterator f, InputIterator l);
+    iterator insert(const_iterator p, initializer_list<value_type> il);
+    void pop_front();
+    void pop_back();
+    iterator erase(const_iterator p);
+    iterator erase(const_iterator f, const_iterator l);
+    void swap(deque& c)
+        noexcept(allocator_traits<allocator_type>::is_always_equal::value);  // C++17
+    void clear() noexcept;
+};
+
+template <class T, class Allocator>
+    bool operator==(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+template <class T, class Allocator>
+    bool operator< (const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+template <class T, class Allocator>
+    bool operator!=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+template <class T, class Allocator>
+    bool operator> (const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+template <class T, class Allocator>
+    bool operator>=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+template <class T, class Allocator>
+    bool operator<=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+
+// specialized algorithms:
+template <class T, class Allocator>
+    void swap(deque<T,Allocator>& x, deque<T,Allocator>& y)
+         noexcept(noexcept(x.swap(y)));
+
+}  // std
+
+*/
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include <__config>
+#include <__split_buffer>
+#include <type_traits>
+#include <initializer_list>
+#include <iterator>
+#include <algorithm>
+#include <stdexcept>
+
+#include <__undef_min_max>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, class _Allocator> class __deque_base;
+template <class _Tp, class _Allocator = allocator<_Tp> > class _LIBCPP_TYPE_VIS_ONLY deque;
+
+template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
+          class _DiffType, _DiffType _BlockSize>
+class _LIBCPP_TYPE_VIS_ONLY __deque_iterator;
+
+template <class _RAIter,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+copy(_RAIter __f,
+     _RAIter __l,
+     __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+     typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _OutputIterator>
+_OutputIterator
+copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+     __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+     _OutputIterator __r);
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+     __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+     __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
+
+template <class _RAIter,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+copy_backward(_RAIter __f,
+              _RAIter __l,
+              __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+              typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _OutputIterator>
+_OutputIterator
+copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+              __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+              _OutputIterator __r);
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+              __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+              __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
+
+template <class _RAIter,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+move(_RAIter __f,
+     _RAIter __l,
+     __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+     typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _OutputIterator>
+_OutputIterator
+move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+     __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+     _OutputIterator __r);
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+     __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+     __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
+
+template <class _RAIter,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+move_backward(_RAIter __f,
+              _RAIter __l,
+              __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+              typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _OutputIterator>
+_OutputIterator
+move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+              __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+              _OutputIterator __r);
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+              __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+              __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
+
+template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
+          class _DiffType, _DiffType _BlockSize>
+class _LIBCPP_TYPE_VIS_ONLY __deque_iterator
+{
+    typedef _MapPointer __map_iterator;
+public:
+    typedef _Pointer  pointer;
+    typedef _DiffType difference_type;
+private:
+    __map_iterator __m_iter_;
+    pointer        __ptr_;
+
+    static const difference_type __block_size = _BlockSize;
+public:
+    typedef _ValueType                  value_type;
+    typedef random_access_iterator_tag  iterator_category;
+    typedef _Reference                  reference;
+
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+     : __m_iter_(nullptr), __ptr_(nullptr)
+#endif
+     {}
+
+    template <class _Pp, class _Rp, class _MP>
+    _LIBCPP_INLINE_VISIBILITY
+    __deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, __block_size>& __it,
+                typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT
+        : __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
+
+    _LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;}
+    _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return __ptr_;}
+
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator& operator++()
+    {
+        if (++__ptr_ - *__m_iter_ == __block_size)
+        {
+            ++__m_iter_;
+            __ptr_ = *__m_iter_;
+        }
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator operator++(int)
+    {
+        __deque_iterator __tmp = *this;
+        ++(*this);
+        return __tmp;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator& operator--()
+    {
+        if (__ptr_ == *__m_iter_)
+        {
+            --__m_iter_;
+            __ptr_ = *__m_iter_ + __block_size;
+        }
+        --__ptr_;
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator operator--(int)
+    {
+        __deque_iterator __tmp = *this;
+        --(*this);
+        return __tmp;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator& operator+=(difference_type __n)
+    {
+        if (__n != 0)
+        {
+            __n += __ptr_ - *__m_iter_;
+            if (__n > 0)
+            {
+                __m_iter_ += __n / __block_size;
+                __ptr_ = *__m_iter_ + __n % __block_size;
+            }
+            else // (__n < 0)
+            {
+                difference_type __z = __block_size - 1 - __n;
+                __m_iter_ -= __z / __block_size;
+                __ptr_ = *__m_iter_ + (__block_size - 1 - __z % __block_size);
+            }
+        }
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator& operator-=(difference_type __n)
+    {
+        return *this += -__n;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator operator+(difference_type __n) const
+    {
+        __deque_iterator __t(*this);
+        __t += __n;
+        return __t;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator operator-(difference_type __n) const
+    {
+        __deque_iterator __t(*this);
+        __t -= __n;
+        return __t;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    friend __deque_iterator operator+(difference_type __n, const __deque_iterator& __it)
+        {return __it + __n;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    friend difference_type operator-(const __deque_iterator& __x, const __deque_iterator& __y)
+    {
+        if (__x != __y)
+            return (__x.__m_iter_ - __y.__m_iter_) * __block_size
+                 + (__x.__ptr_ - *__x.__m_iter_)
+                 - (__y.__ptr_ - *__y.__m_iter_);
+        return 0;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
+        {return *(*this + __n);}
+
+    _LIBCPP_INLINE_VISIBILITY friend
+        bool operator==(const __deque_iterator& __x, const __deque_iterator& __y)
+        {return __x.__ptr_ == __y.__ptr_;}
+
+    _LIBCPP_INLINE_VISIBILITY friend
+        bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y)
+        {return !(__x == __y);}
+
+    _LIBCPP_INLINE_VISIBILITY friend
+        bool operator<(const __deque_iterator& __x, const __deque_iterator& __y)
+        {return __x.__m_iter_ < __y.__m_iter_ ||
+               (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);}
+
+    _LIBCPP_INLINE_VISIBILITY friend
+        bool operator>(const __deque_iterator& __x, const __deque_iterator& __y)
+        {return __y < __x;}
+
+    _LIBCPP_INLINE_VISIBILITY friend
+        bool operator<=(const __deque_iterator& __x, const __deque_iterator& __y)
+        {return !(__y < __x);}
+
+    _LIBCPP_INLINE_VISIBILITY friend
+        bool operator>=(const __deque_iterator& __x, const __deque_iterator& __y)
+        {return !(__x < __y);}
+
+private:
+    _LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
+        : __m_iter_(__m), __ptr_(__p) {}
+
+    template <class _Tp, class _Ap> friend class __deque_base;
+    template <class _Tp, class _Ap> friend class _LIBCPP_TYPE_VIS_ONLY deque;
+    template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
+        friend class _LIBCPP_TYPE_VIS_ONLY __deque_iterator;
+
+    template <class _RAIter,
+              class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+    friend
+    __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+    copy(_RAIter __f,
+         _RAIter __l,
+         __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+         typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*);
+
+    template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+              class _OutputIterator>
+    friend
+    _OutputIterator
+    copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+         __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+         _OutputIterator __r);
+
+    template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+              class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+    friend
+    __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+    copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+         __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+         __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
+
+    template <class _RAIter,
+              class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+    friend
+    __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+    copy_backward(_RAIter __f,
+                  _RAIter __l,
+                  __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+                  typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*);
+
+    template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+              class _OutputIterator>
+    friend
+    _OutputIterator
+    copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+                  __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+                  _OutputIterator __r);
+
+    template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+              class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+    friend
+    __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+    copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+                  __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+                  __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
+
+    template <class _RAIter,
+              class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+    friend
+    __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+    move(_RAIter __f,
+         _RAIter __l,
+         __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+         typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*);
+
+    template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+              class _OutputIterator>
+    friend
+    _OutputIterator
+    move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+         __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+         _OutputIterator __r);
+
+    template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+              class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+    friend
+    __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+    move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+         __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+         __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
+
+    template <class _RAIter,
+              class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+    friend
+    __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+    move_backward(_RAIter __f,
+                  _RAIter __l,
+                  __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+                  typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*);
+
+    template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+              class _OutputIterator>
+    friend
+    _OutputIterator
+    move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+                  __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+                  _OutputIterator __r);
+
+    template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+              class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+    friend
+    __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+    move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+                  __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+                  __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
+};
+
+// copy
+
+template <class _RAIter,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+copy(_RAIter __f,
+     _RAIter __l,
+     __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+     typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*)
+{
+    typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
+    typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
+    while (__f != __l)
+    {
+        pointer __rb = __r.__ptr_;
+        pointer __re = *__r.__m_iter_ + _B2;
+        difference_type __bs = __re - __rb;
+        difference_type __n = __l - __f;
+        _RAIter __m = __l;
+        if (__n > __bs)
+        {
+            __n = __bs;
+            __m = __f + __n;
+        }
+        _VSTD::copy(__f, __m, __rb);
+        __f = __m;
+        __r += __n;
+    }
+    return __r;
+}
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _OutputIterator>
+_OutputIterator
+copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+     __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+     _OutputIterator __r)
+{
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        pointer __fb = __f.__ptr_;
+        pointer __fe = *__f.__m_iter_ + _B1;
+        difference_type __bs = __fe - __fb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __fe = __fb + __bs;
+        }
+        __r = _VSTD::copy(__fb, __fe, __r);
+        __n -= __bs;
+        __f += __bs;
+    }
+    return __r;
+}
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+     __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+     __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r)
+{
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        pointer __fb = __f.__ptr_;
+        pointer __fe = *__f.__m_iter_ + _B1;
+        difference_type __bs = __fe - __fb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __fe = __fb + __bs;
+        }
+        __r = _VSTD::copy(__fb, __fe, __r);
+        __n -= __bs;
+        __f += __bs;
+    }
+    return __r;
+}
+
+// copy_backward
+
+template <class _RAIter,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+copy_backward(_RAIter __f,
+              _RAIter __l,
+              __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+              typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*)
+{
+    typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
+    typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
+    while (__f != __l)
+    {
+        __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _VSTD::prev(__r);
+        pointer __rb = *__rp.__m_iter_;
+        pointer __re = __rp.__ptr_ + 1;
+        difference_type __bs = __re - __rb;
+        difference_type __n = __l - __f;
+        _RAIter __m = __f;
+        if (__n > __bs)
+        {
+            __n = __bs;
+            __m = __l - __n;
+        }
+        _VSTD::copy_backward(__m, __l, __re);
+        __l = __m;
+        __r -= __n;
+    }
+    return __r;
+}
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _OutputIterator>
+_OutputIterator
+copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+              __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+              _OutputIterator __r)
+{
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        --__l;
+        pointer __lb = *__l.__m_iter_;
+        pointer __le = __l.__ptr_ + 1;
+        difference_type __bs = __le - __lb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __lb = __le - __bs;
+        }
+        __r = _VSTD::copy_backward(__lb, __le, __r);
+        __n -= __bs;
+        __l -= __bs - 1;
+    }
+    return __r;
+}
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+              __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+              __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r)
+{
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        --__l;
+        pointer __lb = *__l.__m_iter_;
+        pointer __le = __l.__ptr_ + 1;
+        difference_type __bs = __le - __lb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __lb = __le - __bs;
+        }
+        __r = _VSTD::copy_backward(__lb, __le, __r);
+        __n -= __bs;
+        __l -= __bs - 1;
+    }
+    return __r;
+}
+
+// move
+
+template <class _RAIter,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+move(_RAIter __f,
+     _RAIter __l,
+     __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+     typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*)
+{
+    typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
+    typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
+    while (__f != __l)
+    {
+        pointer __rb = __r.__ptr_;
+        pointer __re = *__r.__m_iter_ + _B2;
+        difference_type __bs = __re - __rb;
+        difference_type __n = __l - __f;
+        _RAIter __m = __l;
+        if (__n > __bs)
+        {
+            __n = __bs;
+            __m = __f + __n;
+        }
+        _VSTD::move(__f, __m, __rb);
+        __f = __m;
+        __r += __n;
+    }
+    return __r;
+}
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _OutputIterator>
+_OutputIterator
+move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+     __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+     _OutputIterator __r)
+{
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        pointer __fb = __f.__ptr_;
+        pointer __fe = *__f.__m_iter_ + _B1;
+        difference_type __bs = __fe - __fb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __fe = __fb + __bs;
+        }
+        __r = _VSTD::move(__fb, __fe, __r);
+        __n -= __bs;
+        __f += __bs;
+    }
+    return __r;
+}
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+     __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+     __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r)
+{
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        pointer __fb = __f.__ptr_;
+        pointer __fe = *__f.__m_iter_ + _B1;
+        difference_type __bs = __fe - __fb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __fe = __fb + __bs;
+        }
+        __r = _VSTD::move(__fb, __fe, __r);
+        __n -= __bs;
+        __f += __bs;
+    }
+    return __r;
+}
+
+// move_backward
+
+template <class _RAIter,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+move_backward(_RAIter __f,
+              _RAIter __l,
+              __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
+              typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*)
+{
+    typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
+    typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
+    while (__f != __l)
+    {
+        __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _VSTD::prev(__r);
+        pointer __rb = *__rp.__m_iter_;
+        pointer __re = __rp.__ptr_ + 1;
+        difference_type __bs = __re - __rb;
+        difference_type __n = __l - __f;
+        _RAIter __m = __f;
+        if (__n > __bs)
+        {
+            __n = __bs;
+            __m = __l - __n;
+        }
+        _VSTD::move_backward(__m, __l, __re);
+        __l = __m;
+        __r -= __n;
+    }
+    return __r;
+}
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _OutputIterator>
+_OutputIterator
+move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+              __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+              _OutputIterator __r)
+{
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        --__l;
+        pointer __lb = *__l.__m_iter_;
+        pointer __le = __l.__ptr_ + 1;
+        difference_type __bs = __le - __lb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __lb = __le - __bs;
+        }
+        __r = _VSTD::move_backward(__lb, __le, __r);
+        __n -= __bs;
+        __l -= __bs - 1;
+    }
+    return __r;
+}
+
+template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
+          class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
+__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
+              __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
+              __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r)
+{
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
+    typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        --__l;
+        pointer __lb = *__l.__m_iter_;
+        pointer __le = __l.__ptr_ + 1;
+        difference_type __bs = __le - __lb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __lb = __le - __bs;
+        }
+        __r = _VSTD::move_backward(__lb, __le, __r);
+        __n -= __bs;
+        __l -= __bs - 1;
+    }
+    return __r;
+}
+
+template <bool>
+class __deque_base_common
+{
+protected:
+    void __throw_length_error() const;
+    void __throw_out_of_range() const;
+};
+
+template <bool __b>
+void
+__deque_base_common<__b>::__throw_length_error() const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    throw length_error("deque");
+#endif
+}
+
+template <bool __b>
+void
+__deque_base_common<__b>::__throw_out_of_range() const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    throw out_of_range("deque");
+#endif
+}
+
+template <class _Tp, class _Allocator>
+class __deque_base
+    : protected __deque_base_common<true>
+{
+    __deque_base(const __deque_base& __c);
+    __deque_base& operator=(const __deque_base& __c);
+protected:
+    typedef _Tp                                      value_type;
+    typedef _Allocator                               allocator_type;
+    typedef allocator_traits<allocator_type>         __alloc_traits;
+    typedef value_type&                              reference;
+    typedef const value_type&                        const_reference;
+    typedef typename __alloc_traits::size_type       size_type;
+    typedef typename __alloc_traits::difference_type difference_type;
+    typedef typename __alloc_traits::pointer         pointer;
+    typedef typename __alloc_traits::const_pointer   const_pointer;
+
+    static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16;
+
+    typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator;
+    typedef allocator_traits<__pointer_allocator>        __map_traits;
+    typedef typename __map_traits::pointer               __map_pointer;
+    typedef typename __rebind_alloc_helper<__alloc_traits, const_pointer>::type __const_pointer_allocator;
+    typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer;
+    typedef __split_buffer<pointer, __pointer_allocator> __map;
+
+    typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
+                             difference_type, __block_size>    iterator;
+    typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
+                             difference_type, __block_size>    const_iterator;
+
+    __map __map_;
+    size_type __start_;
+    __compressed_pair<size_type, allocator_type> __size_;
+
+    iterator       begin() _NOEXCEPT;
+    const_iterator begin() const _NOEXCEPT;
+    iterator       end() _NOEXCEPT;
+    const_iterator end() const _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY size_type&            size()          {return __size_.first();}
+    _LIBCPP_INLINE_VISIBILITY
+    const size_type& size() const _NOEXCEPT {return __size_.first();}
+    _LIBCPP_INLINE_VISIBILITY allocator_type&       __alloc()       {return __size_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const allocator_type& __alloc() const _NOEXCEPT {return __size_.second();}
+
+    __deque_base()
+        _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
+    explicit __deque_base(const allocator_type& __a);
+public:
+    ~__deque_base();
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    __deque_base(__deque_base&& __c)
+        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+    __deque_base(__deque_base&& __c, const allocator_type& __a);
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void swap(__deque_base& __c)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT;
+#else
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                    __is_nothrow_swappable<allocator_type>::value);
+#endif
+protected:
+    void clear() _NOEXCEPT;
+
+    bool __invariants() const;
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign(__deque_base& __c)
+        _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
+                   is_nothrow_move_assignable<allocator_type>::value)
+    {
+        __map_ = _VSTD::move(__c.__map_);
+        __start_ = __c.__start_;
+        size() = __c.size();
+        __move_assign_alloc(__c);
+        __c.__start_ = __c.size() = 0;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__deque_base& __c)
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value ||
+                   is_nothrow_move_assignable<allocator_type>::value)
+        {__move_assign_alloc(__c, integral_constant<bool,
+                      __alloc_traits::propagate_on_container_move_assignment::value>());}
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__deque_base& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+        {
+            __alloc() = _VSTD::move(__c.__alloc());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__deque_base&, false_type) _NOEXCEPT
+        {}
+};
+
+template <class _Tp, class _Allocator>
+bool
+__deque_base<_Tp, _Allocator>::__invariants() const
+{
+    if (!__map_.__invariants())
+        return false;
+    if (__map_.size() >= size_type(-1) / __block_size)
+        return false;
+    for (typename __map::const_iterator __i = __map_.begin(), __e = __map_.end();
+         __i != __e; ++__i)
+        if (*__i == nullptr)
+            return false;
+    if (__map_.size() != 0)
+    {
+        if (size() >= __map_.size() * __block_size)
+            return false;
+        if (__start_ >= __map_.size() * __block_size - size())
+            return false;
+    }
+    else
+    {
+        if (size() != 0)
+            return false;
+        if (__start_ != 0)
+            return false;
+    }
+    return true;
+}
+
+template <class _Tp, class _Allocator>
+typename __deque_base<_Tp, _Allocator>::iterator
+__deque_base<_Tp, _Allocator>::begin() _NOEXCEPT
+{
+    __map_pointer __mp = __map_.begin() + __start_ / __block_size;
+    return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
+}
+
+template <class _Tp, class _Allocator>
+typename __deque_base<_Tp, _Allocator>::const_iterator
+__deque_base<_Tp, _Allocator>::begin() const _NOEXCEPT
+{
+    __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
+    return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
+}
+
+template <class _Tp, class _Allocator>
+typename __deque_base<_Tp, _Allocator>::iterator
+__deque_base<_Tp, _Allocator>::end() _NOEXCEPT
+{
+    size_type __p = size() + __start_;
+    __map_pointer __mp = __map_.begin() + __p / __block_size;
+    return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
+}
+
+template <class _Tp, class _Allocator>
+typename __deque_base<_Tp, _Allocator>::const_iterator
+__deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
+{
+    size_type __p = size() + __start_;
+    __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
+    return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+__deque_base<_Tp, _Allocator>::__deque_base()
+    _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+    : __start_(0), __size_(0) {}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+__deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a)
+    : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {}
+
+template <class _Tp, class _Allocator>
+__deque_base<_Tp, _Allocator>::~__deque_base()
+{
+    clear();
+    typename __map::iterator __i = __map_.begin();
+    typename __map::iterator __e = __map_.end();
+    for (; __i != __e; ++__i)
+        __alloc_traits::deallocate(__alloc(), *__i, __block_size);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+__deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c)
+    _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+    : __map_(_VSTD::move(__c.__map_)),
+      __start_(_VSTD::move(__c.__start_)),
+      __size_(_VSTD::move(__c.__size_))
+{
+    __c.__start_ = 0;
+    __c.size() = 0;
+}
+
+template <class _Tp, class _Allocator>
+__deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_type& __a)
+    : __map_(_VSTD::move(__c.__map_), __pointer_allocator(__a)),
+      __start_(_VSTD::move(__c.__start_)),
+      __size_(_VSTD::move(__c.size()), __a)
+{
+    if (__a == __c.__alloc())
+    {
+        __c.__start_ = 0;
+        __c.size() = 0;
+    }
+    else
+    {
+        __map_.clear();
+        __start_ = 0;
+        size() = 0;
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+void
+__deque_base<_Tp, _Allocator>::swap(__deque_base& __c)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT
+#else
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                    __is_nothrow_swappable<allocator_type>::value)
+#endif
+{
+    __map_.swap(__c.__map_);
+    _VSTD::swap(__start_, __c.__start_);
+    _VSTD::swap(size(), __c.size());
+    __swap_allocator(__alloc(), __c.__alloc());
+}
+
+template <class _Tp, class _Allocator>
+void
+__deque_base<_Tp, _Allocator>::clear() _NOEXCEPT
+{
+    allocator_type& __a = __alloc();
+    for (iterator __i = begin(), __e = end(); __i != __e; ++__i)
+        __alloc_traits::destroy(__a, _VSTD::addressof(*__i));
+    size() = 0;
+    while (__map_.size() > 2)
+    {
+        __alloc_traits::deallocate(__a, __map_.front(), __block_size);
+        __map_.pop_front();
+    }
+    switch (__map_.size())
+    {
+    case 1:
+        __start_ = __block_size / 2;
+        break;
+    case 2:
+        __start_ = __block_size;
+        break;
+    }
+}
+
+template <class _Tp, class _Allocator /*= allocator<_Tp>*/>
+class _LIBCPP_TYPE_VIS_ONLY deque
+    : private __deque_base<_Tp, _Allocator>
+{
+public:
+    // types:
+
+    typedef _Tp value_type;
+    typedef _Allocator allocator_type;
+
+    typedef __deque_base<value_type, allocator_type> __base;
+
+    typedef typename __base::__alloc_traits        __alloc_traits;
+    typedef typename __base::reference             reference;
+    typedef typename __base::const_reference       const_reference;
+    typedef typename __base::iterator              iterator;
+    typedef typename __base::const_iterator        const_iterator;
+    typedef typename __base::size_type             size_type;
+    typedef typename __base::difference_type       difference_type;
+
+    typedef typename __base::pointer               pointer;
+    typedef typename __base::const_pointer         const_pointer;
+    typedef _VSTD::reverse_iterator<iterator>       reverse_iterator;
+    typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
+
+    // construct/copy/destroy:
+    _LIBCPP_INLINE_VISIBILITY
+    deque()
+        _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+        {}
+    _LIBCPP_INLINE_VISIBILITY explicit deque(const allocator_type& __a) : __base(__a) {}
+    explicit deque(size_type __n);
+#if _LIBCPP_STD_VER > 11
+    explicit deque(size_type __n, const _Allocator& __a);
+#endif
+    deque(size_type __n, const value_type& __v);
+    deque(size_type __n, const value_type& __v, const allocator_type& __a);
+    template <class _InputIter>
+        deque(_InputIter __f, _InputIter __l,
+              typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
+    template <class _InputIter>
+        deque(_InputIter __f, _InputIter __l, const allocator_type& __a,
+              typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
+    deque(const deque& __c);
+    deque(const deque& __c, const allocator_type& __a);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    deque(initializer_list<value_type> __il);
+    deque(initializer_list<value_type> __il, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    deque& operator=(const deque& __c);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
+#endif   // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
+    deque(deque&& __c, const allocator_type& __a);
+    deque& operator=(deque&& __c)
+        _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
+                   is_nothrow_move_assignable<allocator_type>::value);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    template <class _InputIter>
+        void assign(_InputIter __f, _InputIter __l,
+                    typename enable_if<__is_input_iterator<_InputIter>::value &&
+                                      !__is_random_access_iterator<_InputIter>::value>::type* = 0);
+    template <class _RAIter>
+        void assign(_RAIter __f, _RAIter __l,
+                    typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
+    void assign(size_type __n, const value_type& __v);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    allocator_type get_allocator() const _NOEXCEPT;
+
+    // iterators:
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       begin() _NOEXCEPT       {return __base::begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT {return __base::begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       end() _NOEXCEPT         {return __base::end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()   const _NOEXCEPT {return __base::end();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reverse_iterator       rbegin() _NOEXCEPT
+        {return       reverse_iterator(__base::end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rbegin() const _NOEXCEPT
+        {return const_reverse_iterator(__base::end());}
+    _LIBCPP_INLINE_VISIBILITY
+    reverse_iterator       rend() _NOEXCEPT
+        {return       reverse_iterator(__base::begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rend()   const _NOEXCEPT
+        {return const_reverse_iterator(__base::begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator         cbegin()  const _NOEXCEPT
+        {return __base::begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator         cend()    const _NOEXCEPT
+        {return __base::end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crbegin() const _NOEXCEPT
+        {return const_reverse_iterator(__base::end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crend()   const _NOEXCEPT
+        {return const_reverse_iterator(__base::begin());}
+
+    // capacity:
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT {return __base::size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT
+        {return __alloc_traits::max_size(__base::__alloc());}
+    void resize(size_type __n);
+    void resize(size_type __n, const value_type& __v);
+    void shrink_to_fit() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty() const _NOEXCEPT {return __base::size() == 0;}
+
+    // element access:
+    reference operator[](size_type __i);
+    const_reference operator[](size_type __i) const;
+    reference at(size_type __i);
+    const_reference at(size_type __i) const;
+    reference front();
+    const_reference front() const;
+    reference back();
+    const_reference back() const;
+
+    // 23.2.2.3 modifiers:
+    void push_front(const value_type& __v);
+    void push_back(const value_type& __v);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args> void emplace_front(_Args&&... __args);
+    template <class... _Args> void emplace_back(_Args&&... __args);
+    template <class... _Args> iterator emplace(const_iterator __p, _Args&&... __args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+    void push_front(value_type&& __v);
+    void push_back(value_type&& __v);
+    iterator insert(const_iterator __p, value_type&& __v);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    iterator insert(const_iterator __p, const value_type& __v);
+    iterator insert(const_iterator __p, size_type __n, const value_type& __v);
+    template <class _InputIter>
+        iterator insert(const_iterator __p, _InputIter __f, _InputIter __l,
+                         typename enable_if<__is_input_iterator<_InputIter>::value
+                                         &&!__is_forward_iterator<_InputIter>::value>::type* = 0);
+    template <class _ForwardIterator>
+        iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
+                               typename enable_if<__is_forward_iterator<_ForwardIterator>::value
+                                         &&!__is_bidirectional_iterator<_ForwardIterator>::value>::type* = 0);
+    template <class _BiIter>
+        iterator insert(const_iterator __p, _BiIter __f, _BiIter __l,
+                         typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __p, initializer_list<value_type> __il)
+        {return insert(__p, __il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    void pop_front();
+    void pop_back();
+    iterator erase(const_iterator __p);
+    iterator erase(const_iterator __f, const_iterator __l);
+
+    void swap(deque& __c)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT;
+#else
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
+                   __is_nothrow_swappable<allocator_type>::value);
+#endif
+    void clear() _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool __invariants() const {return __base::__invariants();}
+private:
+    typedef typename __base::__map_const_pointer __map_const_pointer;
+
+    _LIBCPP_INLINE_VISIBILITY
+    static size_type __recommend_blocks(size_type __n)
+    {
+        return __n / __base::__block_size + (__n % __base::__block_size != 0);
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    size_type __capacity() const
+    {
+        return __base::__map_.size() == 0 ? 0 : __base::__map_.size() * __base::__block_size - 1;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    size_type __front_spare() const
+    {
+        return __base::__start_;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    size_type __back_spare() const
+    {
+        return __capacity() - (__base::__start_ + __base::size());
+    }
+
+    template <class _InpIter>
+        void __append(_InpIter __f, _InpIter __l,
+                 typename enable_if<__is_input_iterator<_InpIter>::value &&
+                                   !__is_forward_iterator<_InpIter>::value>::type* = 0);
+    template <class _ForIter>
+        void __append(_ForIter __f, _ForIter __l,
+                      typename enable_if<__is_forward_iterator<_ForIter>::value>::type* = 0);
+    void __append(size_type __n);
+    void __append(size_type __n, const value_type& __v);
+    void __erase_to_end(const_iterator __f);
+    void __add_front_capacity();
+    void __add_front_capacity(size_type __n);
+    void __add_back_capacity();
+    void __add_back_capacity(size_type __n);
+    iterator __move_and_check(iterator __f, iterator __l, iterator __r,
+                              const_pointer& __vt);
+    iterator __move_backward_and_check(iterator __f, iterator __l, iterator __r,
+                                       const_pointer& __vt);
+    void __move_construct_and_check(iterator __f, iterator __l,
+                                    iterator __r, const_pointer& __vt);
+    void __move_construct_backward_and_check(iterator __f, iterator __l,
+                                             iterator __r, const_pointer& __vt);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const deque& __c)
+        {__copy_assign_alloc(__c, integral_constant<bool,
+                      __alloc_traits::propagate_on_container_copy_assignment::value>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const deque& __c, true_type)
+        {
+            if (__base::__alloc() != __c.__alloc())
+            {
+                clear();
+                shrink_to_fit();
+            }
+            __base::__alloc() = __c.__alloc();
+            __base::__map_.__alloc() = __c.__map_.__alloc();
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const deque&, false_type)
+        {}
+
+    void __move_assign(deque& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+    void __move_assign(deque& __c, false_type);
+};
+
+template <class _Tp, class _Allocator>
+deque<_Tp, _Allocator>::deque(size_type __n)
+{
+    if (__n > 0)
+        __append(__n);
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp, class _Allocator>
+deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
+    : __base(__a)
+{
+    if (__n > 0)
+        __append(__n);
+}
+#endif
+
+template <class _Tp, class _Allocator>
+deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v)
+{
+    if (__n > 0)
+        __append(__n, __v);
+}
+
+template <class _Tp, class _Allocator>
+deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v, const allocator_type& __a)
+    : __base(__a)
+{
+    if (__n > 0)
+        __append(__n, __v);
+}
+
+template <class _Tp, class _Allocator>
+template <class _InputIter>
+deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l,
+              typename enable_if<__is_input_iterator<_InputIter>::value>::type*)
+{
+    __append(__f, __l);
+}
+
+template <class _Tp, class _Allocator>
+template <class _InputIter>
+deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a,
+              typename enable_if<__is_input_iterator<_InputIter>::value>::type*)
+    : __base(__a)
+{
+    __append(__f, __l);
+}
+
+template <class _Tp, class _Allocator>
+deque<_Tp, _Allocator>::deque(const deque& __c)
+    : __base(__alloc_traits::select_on_container_copy_construction(__c.__alloc()))
+{
+    __append(__c.begin(), __c.end());
+}
+
+template <class _Tp, class _Allocator>
+deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a)
+    : __base(__a)
+{
+    __append(__c.begin(), __c.end());
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Allocator>
+deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
+{
+    __append(__il.begin(), __il.end());
+}
+
+template <class _Tp, class _Allocator>
+deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator_type& __a)
+    : __base(__a)
+{
+    __append(__il.begin(), __il.end());
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Allocator>
+deque<_Tp, _Allocator>&
+deque<_Tp, _Allocator>::operator=(const deque& __c)
+{
+    if (this != &__c)
+    {
+        __copy_assign_alloc(__c);
+        assign(__c.begin(), __c.end());
+    }
+    return *this;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+deque<_Tp, _Allocator>::deque(deque&& __c)
+    _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+    : __base(_VSTD::move(__c))
+{
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
+    : __base(_VSTD::move(__c), __a)
+{
+    if (__a != __c.__alloc())
+    {
+        typedef move_iterator<iterator> _Ip;
+        assign(_Ip(__c.begin()), _Ip(__c.end()));
+    }
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+deque<_Tp, _Allocator>&
+deque<_Tp, _Allocator>::operator=(deque&& __c)
+        _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
+                   is_nothrow_move_assignable<allocator_type>::value)
+{
+    __move_assign(__c, integral_constant<bool,
+          __alloc_traits::propagate_on_container_move_assignment::value>());
+    return *this;
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type)
+{
+    if (__base::__alloc() != __c.__alloc())
+    {
+        typedef move_iterator<iterator> _Ip;
+        assign(_Ip(__c.begin()), _Ip(__c.end()));
+    }
+    else
+        __move_assign(__c, true_type());
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type)
+    _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+{
+    clear();
+    shrink_to_fit();
+    __base::__move_assign(__c);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+template <class _InputIter>
+void
+deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l,
+                               typename enable_if<__is_input_iterator<_InputIter>::value &&
+                                                 !__is_random_access_iterator<_InputIter>::value>::type*)
+{
+    iterator __i = __base::begin();
+    iterator __e = __base::end();
+    for (; __f != __l && __i != __e; ++__f, (void) ++__i)
+        *__i = *__f;
+    if (__f != __l)
+        __append(__f, __l);
+    else
+        __erase_to_end(__i);
+}
+
+template <class _Tp, class _Allocator>
+template <class _RAIter>
+void
+deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l,
+                               typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*)
+{
+    if (static_cast<size_type>(__l - __f) > __base::size())
+    {
+        _RAIter __m = __f + __base::size();
+        _VSTD::copy(__f, __m, __base::begin());
+        __append(__m, __l);
+    }
+    else
+        __erase_to_end(_VSTD::copy(__f, __l, __base::begin()));
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
+{
+    if (__n > __base::size())
+    {
+        _VSTD::fill_n(__base::begin(), __base::size(), __v);
+        __n -= __base::size();
+        __append(__n, __v);
+    }
+    else
+        __erase_to_end(_VSTD::fill_n(__base::begin(), __n, __v));
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+_Allocator
+deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT
+{
+    return __base::__alloc();
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::resize(size_type __n)
+{
+    if (__n > __base::size())
+        __append(__n - __base::size());
+    else if (__n < __base::size())
+        __erase_to_end(__base::begin() + __n);
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v)
+{
+    if (__n > __base::size())
+        __append(__n - __base::size(), __v);
+    else if (__n < __base::size())
+        __erase_to_end(__base::begin() + __n);
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
+{
+    allocator_type& __a = __base::__alloc();
+    if (empty())
+    {
+        while (__base::__map_.size() > 0)
+        {
+            __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
+            __base::__map_.pop_back();
+        }
+        __base::__start_ = 0;
+    }
+    else
+    {
+        if (__front_spare() >= __base::__block_size)
+        {
+            __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
+            __base::__map_.pop_front();
+            __base::__start_ -= __base::__block_size;
+        }
+        if (__back_spare() >= __base::__block_size)
+        {
+            __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
+            __base::__map_.pop_back();
+        }
+    }
+    __base::__map_.shrink_to_fit();
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename deque<_Tp, _Allocator>::reference
+deque<_Tp, _Allocator>::operator[](size_type __i)
+{
+    size_type __p = __base::__start_ + __i;
+    return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename deque<_Tp, _Allocator>::const_reference
+deque<_Tp, _Allocator>::operator[](size_type __i) const
+{
+    size_type __p = __base::__start_ + __i;
+    return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename deque<_Tp, _Allocator>::reference
+deque<_Tp, _Allocator>::at(size_type __i)
+{
+    if (__i >= __base::size())
+        __base::__throw_out_of_range();
+    size_type __p = __base::__start_ + __i;
+    return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename deque<_Tp, _Allocator>::const_reference
+deque<_Tp, _Allocator>::at(size_type __i) const
+{
+    if (__i >= __base::size())
+        __base::__throw_out_of_range();
+    size_type __p = __base::__start_ + __i;
+    return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename deque<_Tp, _Allocator>::reference
+deque<_Tp, _Allocator>::front()
+{
+    return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size)
+                                      + __base::__start_ % __base::__block_size);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename deque<_Tp, _Allocator>::const_reference
+deque<_Tp, _Allocator>::front() const
+{
+    return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size)
+                                      + __base::__start_ % __base::__block_size);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename deque<_Tp, _Allocator>::reference
+deque<_Tp, _Allocator>::back()
+{
+    size_type __p = __base::size() + __base::__start_ - 1;
+    return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename deque<_Tp, _Allocator>::const_reference
+deque<_Tp, _Allocator>::back() const
+{
+    size_type __p = __base::size() + __base::__start_ - 1;
+    return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::push_back(const value_type& __v)
+{
+    allocator_type& __a = __base::__alloc();
+    if (__back_spare() == 0)
+        __add_back_capacity();
+    // __back_spare() >= 1
+    __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), __v);
+    ++__base::size();
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::push_back(value_type&& __v)
+{
+    allocator_type& __a = __base::__alloc();
+    if (__back_spare() == 0)
+        __add_back_capacity();
+    // __back_spare() >= 1
+    __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v));
+    ++__base::size();
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Allocator>
+template <class... _Args>
+void
+deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
+{
+    allocator_type& __a = __base::__alloc();
+    if (__back_spare() == 0)
+        __add_back_capacity();
+    // __back_spare() >= 1
+    __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...);
+    ++__base::size();
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::push_front(const value_type& __v)
+{
+    allocator_type& __a = __base::__alloc();
+    if (__front_spare() == 0)
+        __add_front_capacity();
+    // __front_spare() >= 1
+    __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
+    --__base::__start_;
+    ++__base::size();
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::push_front(value_type&& __v)
+{
+    allocator_type& __a = __base::__alloc();
+    if (__front_spare() == 0)
+        __add_front_capacity();
+    // __front_spare() >= 1
+    __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v));
+    --__base::__start_;
+    ++__base::size();
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Allocator>
+template <class... _Args>
+void
+deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
+{
+    allocator_type& __a = __base::__alloc();
+    if (__front_spare() == 0)
+        __add_front_capacity();
+    // __front_spare() >= 1
+    __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
+    --__base::__start_;
+    ++__base::size();
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
+{
+    size_type __pos = __p - __base::begin();
+    size_type __to_end = __base::size() - __pos;
+    allocator_type& __a = __base::__alloc();
+    if (__pos < __to_end)
+    {   // insert by shifting things backward
+        if (__front_spare() == 0)
+            __add_front_capacity();
+        // __front_spare() >= 1
+        if (__pos == 0)
+        {
+            __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
+            --__base::__start_;
+            ++__base::size();
+        }
+        else
+        {
+            const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+            iterator __b = __base::begin();
+            iterator __bm1 = _VSTD::prev(__b);
+            if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
+                __vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
+            __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
+            --__base::__start_;
+            ++__base::size();
+            if (__pos > 1)
+                __b = __move_and_check(_VSTD::next(__b), __b + __pos, __b, __vt);
+            *__b = *__vt;
+        }
+    }
+    else
+    {   // insert by shifting things forward
+        if (__back_spare() == 0)
+            __add_back_capacity();
+        // __back_capacity >= 1
+        size_type __de = __base::size() - __pos;
+        if (__de == 0)
+        {
+            __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), __v);
+            ++__base::size();
+        }
+        else
+        {
+            const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+            iterator __e = __base::end();
+            iterator __em1 = _VSTD::prev(__e);
+            if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
+                __vt = pointer_traits<const_pointer>::pointer_to(*__e);
+            __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
+            ++__base::size();
+            if (__de > 1)
+                __e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
+            *--__e = *__vt;
+        }
+    }
+    return __base::begin() + __pos;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
+{
+    size_type __pos = __p - __base::begin();
+    size_type __to_end = __base::size() - __pos;
+    allocator_type& __a = __base::__alloc();
+    if (__pos < __to_end)
+    {   // insert by shifting things backward
+        if (__front_spare() == 0)
+            __add_front_capacity();
+        // __front_spare() >= 1
+        if (__pos == 0)
+        {
+            __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v));
+            --__base::__start_;
+            ++__base::size();
+        }
+        else
+        {
+            iterator __b = __base::begin();
+            iterator __bm1 = _VSTD::prev(__b);
+            __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
+            --__base::__start_;
+            ++__base::size();
+            if (__pos > 1)
+                __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
+            *__b = _VSTD::move(__v);
+        }
+    }
+    else
+    {   // insert by shifting things forward
+        if (__back_spare() == 0)
+            __add_back_capacity();
+        // __back_capacity >= 1
+        size_type __de = __base::size() - __pos;
+        if (__de == 0)
+        {
+            __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v));
+            ++__base::size();
+        }
+        else
+        {
+            iterator __e = __base::end();
+            iterator __em1 = _VSTD::prev(__e);
+            __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
+            ++__base::size();
+            if (__de > 1)
+                __e = _VSTD::move_backward(__e - __de, __em1, __e);
+            *--__e = _VSTD::move(__v);
+        }
+    }
+    return __base::begin() + __pos;
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Allocator>
+template <class... _Args>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
+{
+    size_type __pos = __p - __base::begin();
+    size_type __to_end = __base::size() - __pos;
+    allocator_type& __a = __base::__alloc();
+    if (__pos < __to_end)
+    {   // insert by shifting things backward
+        if (__front_spare() == 0)
+            __add_front_capacity();
+        // __front_spare() >= 1
+        if (__pos == 0)
+        {
+            __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
+            --__base::__start_;
+            ++__base::size();
+        }
+        else
+        {
+            value_type __tmp(_VSTD::forward<_Args>(__args)...);
+            iterator __b = __base::begin();
+            iterator __bm1 = _VSTD::prev(__b);
+            __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
+            --__base::__start_;
+            ++__base::size();
+            if (__pos > 1)
+                __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
+            *__b = _VSTD::move(__tmp);
+        }
+    }
+    else
+    {   // insert by shifting things forward
+        if (__back_spare() == 0)
+            __add_back_capacity();
+        // __back_capacity >= 1
+        size_type __de = __base::size() - __pos;
+        if (__de == 0)
+        {
+            __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...);
+            ++__base::size();
+        }
+        else
+        {
+            value_type __tmp(_VSTD::forward<_Args>(__args)...);
+            iterator __e = __base::end();
+            iterator __em1 = _VSTD::prev(__e);
+            __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
+            ++__base::size();
+            if (__de > 1)
+                __e = _VSTD::move_backward(__e - __de, __em1, __e);
+            *--__e = _VSTD::move(__tmp);
+        }
+    }
+    return __base::begin() + __pos;
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v)
+{
+    size_type __pos = __p - __base::begin();
+    size_type __to_end = __base::size() - __pos;
+    allocator_type& __a = __base::__alloc();
+    if (__pos < __to_end)
+    {   // insert by shifting things backward
+        if (__n > __front_spare())
+            __add_front_capacity(__n - __front_spare());
+        // __n <= __front_spare()
+        iterator __old_begin = __base::begin();
+        iterator __i = __old_begin;
+        if (__n > __pos)
+        {
+            for (size_type __m = __n - __pos; __m; --__m, --__base::__start_, ++__base::size())
+                __alloc_traits::construct(__a, _VSTD::addressof(*--__i), __v);
+            __n = __pos;
+        }
+        if (__n > 0)
+        {
+            const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+            iterator __obn = __old_begin + __n;
+            __move_construct_backward_and_check(__old_begin, __obn, __i, __vt);
+            if (__n < __pos)
+                __old_begin = __move_and_check(__obn, __old_begin + __pos, __old_begin, __vt);
+            _VSTD::fill_n(__old_begin, __n, *__vt);
+        }
+    }
+    else
+    {   // insert by shifting things forward
+        size_type __back_capacity = __back_spare();
+        if (__n > __back_capacity)
+            __add_back_capacity(__n - __back_capacity);
+        // __n <= __back_capacity
+        iterator __old_end = __base::end();
+        iterator __i = __old_end;
+        size_type __de = __base::size() - __pos;
+        if (__n > __de)
+        {
+            for (size_type __m = __n - __de; __m; --__m, ++__i, ++__base::size())
+                __alloc_traits::construct(__a, _VSTD::addressof(*__i), __v);
+            __n = __de;
+        }
+        if (__n > 0)
+        {
+            const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+            iterator __oen = __old_end - __n;
+            __move_construct_and_check(__oen, __old_end, __i, __vt);
+            if (__n < __de)
+                __old_end = __move_backward_and_check(__old_end - __de, __oen, __old_end, __vt);
+            _VSTD::fill_n(__old_end - __n, __n, *__vt);
+        }
+    }
+    return __base::begin() + __pos;
+}
+
+template <class _Tp, class _Allocator>
+template <class _InputIter>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l,
+                               typename enable_if<__is_input_iterator<_InputIter>::value
+                                               &&!__is_forward_iterator<_InputIter>::value>::type*)
+{
+    __split_buffer<value_type, allocator_type&> __buf(__base::__alloc());
+    __buf.__construct_at_end(__f, __l);
+    typedef typename __split_buffer<value_type, allocator_type&>::iterator __bi;
+    return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end()));
+}
+
+template <class _Tp, class _Allocator>
+template <class _ForwardIterator>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
+                               typename enable_if<__is_forward_iterator<_ForwardIterator>::value
+                                               &&!__is_bidirectional_iterator<_ForwardIterator>::value>::type*)
+{
+    size_type __n = _VSTD::distance(__f, __l);
+    __split_buffer<value_type, allocator_type&> __buf(__n, 0, __base::__alloc());
+    __buf.__construct_at_end(__f, __l);
+    typedef typename __split_buffer<value_type, allocator_type&>::iterator __fwd;
+    return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end()));
+}
+
+template <class _Tp, class _Allocator>
+template <class _BiIter>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
+                               typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type*)
+{
+    size_type __n = _VSTD::distance(__f, __l);
+    size_type __pos = __p - __base::begin();
+    size_type __to_end = __base::size() - __pos;
+    allocator_type& __a = __base::__alloc();
+    if (__pos < __to_end)
+    {   // insert by shifting things backward
+        if (__n > __front_spare())
+            __add_front_capacity(__n - __front_spare());
+        // __n <= __front_spare()
+        iterator __old_begin = __base::begin();
+        iterator __i = __old_begin;
+        _BiIter __m = __f;
+        if (__n > __pos)
+        {
+            __m = __pos < __n / 2 ? _VSTD::prev(__l, __pos) : _VSTD::next(__f, __n - __pos);
+            for (_BiIter __j = __m; __j != __f; --__base::__start_, ++__base::size())
+                __alloc_traits::construct(__a, _VSTD::addressof(*--__i), *--__j);
+            __n = __pos;
+        }
+        if (__n > 0)
+        {
+            iterator __obn = __old_begin + __n;
+            for (iterator __j = __obn; __j != __old_begin;)
+            {
+                __alloc_traits::construct(__a, _VSTD::addressof(*--__i), _VSTD::move(*--__j));
+                --__base::__start_;
+                ++__base::size();
+            }
+            if (__n < __pos)
+                __old_begin = _VSTD::move(__obn, __old_begin + __pos, __old_begin);
+            _VSTD::copy(__m, __l, __old_begin);
+        }
+    }
+    else
+    {   // insert by shifting things forward
+        size_type __back_capacity = __back_spare();
+        if (__n > __back_capacity)
+            __add_back_capacity(__n - __back_capacity);
+        // __n <= __back_capacity
+        iterator __old_end = __base::end();
+        iterator __i = __old_end;
+        _BiIter __m = __l;
+        size_type __de = __base::size() - __pos;
+        if (__n > __de)
+        {
+            __m = __de < __n / 2 ? _VSTD::next(__f, __de) : _VSTD::prev(__l, __n - __de);
+            for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__base::size())
+                __alloc_traits::construct(__a, _VSTD::addressof(*__i), *__j);
+            __n = __de;
+        }
+        if (__n > 0)
+        {
+            iterator __oen = __old_end - __n;
+            for (iterator __j = __oen; __j != __old_end; ++__i, ++__j, ++__base::size())
+                __alloc_traits::construct(__a, _VSTD::addressof(*__i), _VSTD::move(*__j));
+            if (__n < __de)
+                __old_end = _VSTD::move_backward(__old_end - __de, __oen, __old_end);
+            _VSTD::copy_backward(__f, __m, __old_end);
+        }
+    }
+    return __base::begin() + __pos;
+}
+
+template <class _Tp, class _Allocator>
+template <class _InpIter>
+void
+deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l,
+                                 typename enable_if<__is_input_iterator<_InpIter>::value &&
+                                                   !__is_forward_iterator<_InpIter>::value>::type*)
+{
+    for (; __f != __l; ++__f)
+        push_back(*__f);
+}
+
+template <class _Tp, class _Allocator>
+template <class _ForIter>
+void
+deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
+                                 typename enable_if<__is_forward_iterator<_ForIter>::value>::type*)
+{
+    size_type __n = _VSTD::distance(__f, __l);
+    allocator_type& __a = __base::__alloc();
+    size_type __back_capacity = __back_spare();
+    if (__n > __back_capacity)
+        __add_back_capacity(__n - __back_capacity);
+    // __n <= __back_capacity
+    for (iterator __i = __base::end(); __f != __l; ++__i, (void) ++__f, ++__base::size())
+        __alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f);
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__append(size_type __n)
+{
+    allocator_type& __a = __base::__alloc();
+    size_type __back_capacity = __back_spare();
+    if (__n > __back_capacity)
+        __add_back_capacity(__n - __back_capacity);
+    // __n <= __back_capacity
+    for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())
+        __alloc_traits::construct(__a, _VSTD::addressof(*__i));
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
+{
+    allocator_type& __a = __base::__alloc();
+    size_type __back_capacity = __back_spare();
+    if (__n > __back_capacity)
+        __add_back_capacity(__n - __back_capacity);
+    // __n <= __back_capacity
+    for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())
+        __alloc_traits::construct(__a, _VSTD::addressof(*__i), __v);
+}
+
+// Create front capacity for one block of elements.
+// Strong guarantee.  Either do it or don't touch anything.
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__add_front_capacity()
+{
+    allocator_type& __a = __base::__alloc();
+    if (__back_spare() >= __base::__block_size)
+    {
+        __base::__start_ += __base::__block_size;
+        pointer __pt = __base::__map_.back();
+        __base::__map_.pop_back();
+        __base::__map_.push_front(__pt);
+    }
+    // Else if __base::__map_.size() < __base::__map_.capacity() then we need to allocate 1 buffer
+    else if (__base::__map_.size() < __base::__map_.capacity())
+    {   // we can put the new buffer into the map, but don't shift things around
+        // until all buffers are allocated.  If we throw, we don't need to fix
+        // anything up (any added buffers are undetectible)
+        if (__base::__map_.__front_spare() > 0)
+            __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size));
+        else
+        {
+            __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size));
+            // Done allocating, reorder capacity
+            pointer __pt = __base::__map_.back();
+            __base::__map_.pop_back();
+            __base::__map_.push_front(__pt);
+        }
+        __base::__start_ = __base::__map_.size() == 1 ?
+                               __base::__block_size / 2 :
+                               __base::__start_ + __base::__block_size;
+    }
+    // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
+    else
+    {
+        __split_buffer<pointer, typename __base::__pointer_allocator&>
+            __buf(max<size_type>(2 * __base::__map_.capacity(), 1),
+                  0, __base::__map_.__alloc());
+
+        typedef __allocator_destructor<_Allocator> _Dp;
+        unique_ptr<pointer, _Dp> __hold(
+            __alloc_traits::allocate(__a, __base::__block_size),
+                _Dp(__a, __base::__block_size));
+        __buf.push_back(__hold.get());
+        __hold.release();
+    
+        for (typename __base::__map_pointer __i = __base::__map_.begin();
+                __i != __base::__map_.end(); ++__i)
+            __buf.push_back(*__i);
+        _VSTD::swap(__base::__map_.__first_, __buf.__first_);
+        _VSTD::swap(__base::__map_.__begin_, __buf.__begin_);
+        _VSTD::swap(__base::__map_.__end_, __buf.__end_);
+        _VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
+        __base::__start_ = __base::__map_.size() == 1 ?
+                               __base::__block_size / 2 :
+                               __base::__start_ + __base::__block_size;
+    }
+}
+
+// Create front capacity for __n elements.
+// Strong guarantee.  Either do it or don't touch anything.
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
+{
+    allocator_type& __a = __base::__alloc();
+    size_type __nb = __recommend_blocks(__n + __base::__map_.empty());
+    // Number of unused blocks at back:
+    size_type __back_capacity = __back_spare() / __base::__block_size;
+    __back_capacity = _VSTD::min(__back_capacity, __nb);  // don't take more than you need
+    __nb -= __back_capacity;  // number of blocks need to allocate
+    // If __nb == 0, then we have sufficient capacity.
+    if (__nb == 0)
+    {
+        __base::__start_ += __base::__block_size * __back_capacity;
+        for (; __back_capacity > 0; --__back_capacity)
+        {
+            pointer __pt = __base::__map_.back();
+            __base::__map_.pop_back();
+            __base::__map_.push_front(__pt);
+        }
+    }
+    // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
+    else if (__nb <= __base::__map_.capacity() - __base::__map_.size())
+    {   // we can put the new buffers into the map, but don't shift things around
+        // until all buffers are allocated.  If we throw, we don't need to fix
+        // anything up (any added buffers are undetectible)
+        for (; __nb > 0; --__nb, __base::__start_ += __base::__block_size - (__base::__map_.size() == 1))
+        {
+            if (__base::__map_.__front_spare() == 0)
+                break;
+            __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size));
+        }
+        for (; __nb > 0; --__nb, ++__back_capacity)
+            __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size));
+        // Done allocating, reorder capacity
+        __base::__start_ += __back_capacity * __base::__block_size;
+        for (; __back_capacity > 0; --__back_capacity)
+        {
+            pointer __pt = __base::__map_.back();
+            __base::__map_.pop_back();
+            __base::__map_.push_front(__pt);
+        }
+    }
+    // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
+    else
+    {
+        size_type __ds = (__nb + __back_capacity) * __base::__block_size - __base::__map_.empty();
+        __split_buffer<pointer, typename __base::__pointer_allocator&>
+            __buf(max<size_type>(2* __base::__map_.capacity(),
+                                 __nb + __base::__map_.size()),
+                  0, __base::__map_.__alloc());
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (; __nb > 0; --__nb)
+                __buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            for (typename __base::__map_pointer __i = __buf.begin();
+                    __i != __buf.end(); ++__i)
+                __alloc_traits::deallocate(__a, *__i, __base::__block_size);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        for (; __back_capacity > 0; --__back_capacity)
+        {
+            __buf.push_back(__base::__map_.back());
+            __base::__map_.pop_back();
+        }
+        for (typename __base::__map_pointer __i = __base::__map_.begin();
+                __i != __base::__map_.end(); ++__i)
+            __buf.push_back(*__i);
+        _VSTD::swap(__base::__map_.__first_, __buf.__first_);
+        _VSTD::swap(__base::__map_.__begin_, __buf.__begin_);
+        _VSTD::swap(__base::__map_.__end_, __buf.__end_);
+        _VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
+        __base::__start_ += __ds;
+    }
+}
+
+// Create back capacity for one block of elements.
+// Strong guarantee.  Either do it or don't touch anything.
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__add_back_capacity()
+{
+    allocator_type& __a = __base::__alloc();
+    if (__front_spare() >= __base::__block_size)
+    {
+        __base::__start_ -= __base::__block_size;
+        pointer __pt = __base::__map_.front();
+        __base::__map_.pop_front();
+        __base::__map_.push_back(__pt);
+    }
+    // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
+    else if (__base::__map_.size() < __base::__map_.capacity())
+    {   // we can put the new buffer into the map, but don't shift things around
+        // until it is allocated.  If we throw, we don't need to fix
+        // anything up (any added buffers are undetectible)
+        if (__base::__map_.__back_spare() != 0)
+            __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size));
+        else
+        {
+            __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size));
+            // Done allocating, reorder capacity
+            pointer __pt = __base::__map_.front();
+            __base::__map_.pop_front();
+            __base::__map_.push_back(__pt);
+        }
+    }
+    // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
+    else
+    {
+        __split_buffer<pointer, typename __base::__pointer_allocator&>
+            __buf(max<size_type>(2* __base::__map_.capacity(), 1),
+                  __base::__map_.size(),
+                  __base::__map_.__alloc());
+
+        typedef __allocator_destructor<_Allocator> _Dp;
+        unique_ptr<pointer, _Dp> __hold(
+            __alloc_traits::allocate(__a, __base::__block_size),
+                _Dp(__a, __base::__block_size));
+        __buf.push_back(__hold.get());
+        __hold.release();
+
+        for (typename __base::__map_pointer __i = __base::__map_.end();
+                __i != __base::__map_.begin();)
+            __buf.push_front(*--__i);
+        _VSTD::swap(__base::__map_.__first_, __buf.__first_);
+        _VSTD::swap(__base::__map_.__begin_, __buf.__begin_);
+        _VSTD::swap(__base::__map_.__end_, __buf.__end_);
+        _VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
+    }
+}
+
+// Create back capacity for __n elements.
+// Strong guarantee.  Either do it or don't touch anything.
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
+{
+    allocator_type& __a = __base::__alloc();
+    size_type __nb = __recommend_blocks(__n + __base::__map_.empty());
+    // Number of unused blocks at front:
+    size_type __front_capacity = __front_spare() / __base::__block_size;
+    __front_capacity = _VSTD::min(__front_capacity, __nb);  // don't take more than you need
+    __nb -= __front_capacity;  // number of blocks need to allocate
+    // If __nb == 0, then we have sufficient capacity.
+    if (__nb == 0)
+    {
+        __base::__start_ -= __base::__block_size * __front_capacity;
+        for (; __front_capacity > 0; --__front_capacity)
+        {
+            pointer __pt = __base::__map_.front();
+            __base::__map_.pop_front();
+            __base::__map_.push_back(__pt);
+        }
+    }
+    // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
+    else if (__nb <= __base::__map_.capacity() - __base::__map_.size())
+    {   // we can put the new buffers into the map, but don't shift things around
+        // until all buffers are allocated.  If we throw, we don't need to fix
+        // anything up (any added buffers are undetectible)
+        for (; __nb > 0; --__nb)
+        {
+            if (__base::__map_.__back_spare() == 0)
+                break;
+            __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size));
+        }
+        for (; __nb > 0; --__nb, ++__front_capacity, __base::__start_ +=
+                                 __base::__block_size - (__base::__map_.size() == 1))
+            __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size));
+        // Done allocating, reorder capacity
+        __base::__start_ -= __base::__block_size * __front_capacity;
+        for (; __front_capacity > 0; --__front_capacity)
+        {
+            pointer __pt = __base::__map_.front();
+            __base::__map_.pop_front();
+            __base::__map_.push_back(__pt);
+        }
+    }
+    // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
+    else
+    {
+        size_type __ds = __front_capacity * __base::__block_size;
+        __split_buffer<pointer, typename __base::__pointer_allocator&>
+            __buf(max<size_type>(2* __base::__map_.capacity(),
+                                 __nb + __base::__map_.size()),
+                  __base::__map_.size() - __front_capacity,
+                  __base::__map_.__alloc());
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (; __nb > 0; --__nb)
+                __buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            for (typename __base::__map_pointer __i = __buf.begin();
+                    __i != __buf.end(); ++__i)
+                __alloc_traits::deallocate(__a, *__i, __base::__block_size);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        for (; __front_capacity > 0; --__front_capacity)
+        {
+            __buf.push_back(__base::__map_.front());
+            __base::__map_.pop_front();
+        }
+        for (typename __base::__map_pointer __i = __base::__map_.end();
+                __i != __base::__map_.begin();)
+            __buf.push_front(*--__i);
+        _VSTD::swap(__base::__map_.__first_, __buf.__first_);
+        _VSTD::swap(__base::__map_.__begin_, __buf.__begin_);
+        _VSTD::swap(__base::__map_.__end_, __buf.__end_);
+        _VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
+        __base::__start_ -= __ds;
+    }
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::pop_front()
+{
+    allocator_type& __a = __base::__alloc();
+    __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
+                                                    __base::__start_ / __base::__block_size) +
+                                                    __base::__start_ % __base::__block_size));
+    --__base::size();
+    if (++__base::__start_ >= 2 * __base::__block_size)
+    {
+        __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
+        __base::__map_.pop_front();
+        __base::__start_ -= __base::__block_size;
+    }
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::pop_back()
+{
+    allocator_type& __a = __base::__alloc();
+    size_type __p = __base::size() + __base::__start_ - 1;
+    __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
+                                                    __p / __base::__block_size) +
+                                                    __p % __base::__block_size));
+    --__base::size();
+    if (__back_spare() >= 2 * __base::__block_size)
+    {
+        __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
+        __base::__map_.pop_back();
+    }
+}
+
+// move assign [__f, __l) to [__r, __r + (__l-__f)).
+// If __vt points into [__f, __l), then subtract (__f - __r) from __vt.
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __r,
+                                         const_pointer& __vt)
+{
+    // as if
+    //   for (; __f != __l; ++__f, ++__r)
+    //       *__r = _VSTD::move(*__f);
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        pointer __fb = __f.__ptr_;
+        pointer __fe = *__f.__m_iter_ + __base::__block_size;
+        difference_type __bs = __fe - __fb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __fe = __fb + __bs;
+        }
+        if (__fb <= __vt && __vt < __fe)
+            __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
+        __r = _VSTD::move(__fb, __fe, __r);
+        __n -= __bs;
+        __f += __bs;
+    }
+    return __r;
+}
+
+// move assign [__f, __l) to [__r - (__l-__f), __r) backwards.
+// If __vt points into [__f, __l), then add (__r - __l) to __vt.
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, iterator __r,
+                                                  const_pointer& __vt)
+{
+    // as if
+    //   while (__f != __l)
+    //       *--__r = _VSTD::move(*--__l);
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        --__l;
+        pointer __lb = *__l.__m_iter_;
+        pointer __le = __l.__ptr_ + 1;
+        difference_type __bs = __le - __lb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __lb = __le - __bs;
+        }
+        if (__lb <= __vt && __vt < __le)
+            __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
+        __r = _VSTD::move_backward(__lb, __le, __r);
+        __n -= __bs;
+        __l -= __bs - 1;
+    }
+    return __r;
+}
+
+// move construct [__f, __l) to [__r, __r + (__l-__f)).
+// If __vt points into [__f, __l), then add (__r - __f) to __vt.
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
+                                                   iterator __r, const_pointer& __vt)
+{
+    allocator_type& __a = __base::__alloc();
+    // as if
+    //   for (; __f != __l; ++__r, ++__f, ++__base::size())
+    //       __alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__f));
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        pointer __fb = __f.__ptr_;
+        pointer __fe = *__f.__m_iter_ + __base::__block_size;
+        difference_type __bs = __fe - __fb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __fe = __fb + __bs;
+        }
+        if (__fb <= __vt && __vt < __fe)
+            __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
+        for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
+            __alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__fb));
+        __n -= __bs;
+        __f += __bs;
+    }
+}
+
+// move construct [__f, __l) to [__r - (__l-__f), __r) backwards.
+// If __vt points into [__f, __l), then subtract (__l - __r) from __vt.
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterator __l,
+                                                            iterator __r, const_pointer& __vt)
+{
+    allocator_type& __a = __base::__alloc();
+    // as if
+    //   for (iterator __j = __l; __j != __f;)
+    //   {
+    //       __alloc_traitsconstruct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__j));
+    //       --__base::__start_;
+    //       ++__base::size();
+    //   }
+    difference_type __n = __l - __f;
+    while (__n > 0)
+    {
+        --__l;
+        pointer __lb = *__l.__m_iter_;
+        pointer __le = __l.__ptr_ + 1;
+        difference_type __bs = __le - __lb;
+        if (__bs > __n)
+        {
+            __bs = __n;
+            __lb = __le - __bs;
+        }
+        if (__lb <= __vt && __vt < __le)
+            __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
+        while (__le != __lb)
+        {
+            __alloc_traits::construct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__le));
+            --__base::__start_;
+            ++__base::size();
+        }
+        __n -= __bs;
+        __l -= __bs - 1;
+    }
+}
+
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::erase(const_iterator __f)
+{
+    iterator __b = __base::begin();
+    difference_type __pos = __f - __b;
+    iterator __p = __b + __pos;
+    allocator_type& __a = __base::__alloc();
+    if (__pos <= (__base::size() - 1) / 2)
+    {   // erase from front
+        _VSTD::move_backward(__b, __p, _VSTD::next(__p));
+        __alloc_traits::destroy(__a, _VSTD::addressof(*__b));
+        --__base::size();
+        ++__base::__start_;
+        if (__front_spare() >= 2 * __base::__block_size)
+        {
+            __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
+            __base::__map_.pop_front();
+            __base::__start_ -= __base::__block_size;
+        }
+    }
+    else
+    {   // erase from back
+        iterator __i = _VSTD::move(_VSTD::next(__p), __base::end(), __p);
+        __alloc_traits::destroy(__a, _VSTD::addressof(*__i));
+        --__base::size();
+        if (__back_spare() >= 2 * __base::__block_size)
+        {
+            __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
+            __base::__map_.pop_back();
+        }
+    }
+    return __base::begin() + __pos;
+}
+
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
+{
+    difference_type __n = __l - __f;
+    iterator __b = __base::begin();
+    difference_type __pos = __f - __b;
+    iterator __p = __b + __pos;
+    if (__n > 0)
+    {
+        allocator_type& __a = __base::__alloc();
+        if (__pos <= (__base::size() - __n) / 2)
+        {   // erase from front
+            iterator __i = _VSTD::move_backward(__b, __p, __p + __n);
+            for (; __b != __i; ++__b)
+                __alloc_traits::destroy(__a, _VSTD::addressof(*__b));
+            __base::size() -= __n;
+            __base::__start_ += __n;
+            while (__front_spare() >= 2 * __base::__block_size)
+            {
+                __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
+                __base::__map_.pop_front();
+                __base::__start_ -= __base::__block_size;
+            }
+        }
+        else
+        {   // erase from back
+            iterator __i = _VSTD::move(__p + __n, __base::end(), __p);
+            for (iterator __e = __base::end(); __i != __e; ++__i)
+                __alloc_traits::destroy(__a, _VSTD::addressof(*__i));
+            __base::size() -= __n;
+            while (__back_spare() >= 2 * __base::__block_size)
+            {
+                __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
+                __base::__map_.pop_back();
+            }
+        }
+    }
+    return __base::begin() + __pos;
+}
+
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
+{
+    iterator __e = __base::end();
+    difference_type __n = __e - __f;
+    if (__n > 0)
+    {
+        allocator_type& __a = __base::__alloc();
+        iterator __b = __base::begin();
+        difference_type __pos = __f - __b;
+        for (iterator __p = __b + __pos; __p != __e; ++__p)
+            __alloc_traits::destroy(__a, _VSTD::addressof(*__p));
+        __base::size() -= __n;
+        while (__back_spare() >= 2 * __base::__block_size)
+        {
+            __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
+            __base::__map_.pop_back();
+        }
+    }
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+deque<_Tp, _Allocator>::swap(deque& __c)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT
+#else
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                    __is_nothrow_swappable<allocator_type>::value)
+#endif
+{
+    __base::swap(__c);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+deque<_Tp, _Allocator>::clear() _NOEXCEPT
+{
+    __base::clear();
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
+{
+    const typename deque<_Tp, _Allocator>::size_type __sz = __x.size();
+    return __sz == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
+{
+    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_DEQUE

Property changes on: lab4/.minix-src/include/c++/deque
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/fstream
===================================================================
--- lab4/.minix-src/include/c++/fstream	(nonexistent)
+++ lab4/.minix-src/include/c++/fstream	(revision 13)
@@ -0,0 +1,1457 @@
+// -*- C++ -*-
+//===------------------------- fstream ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_FSTREAM
+#define _LIBCPP_FSTREAM
+
+/*
+    fstream synopsis
+
+template <class charT, class traits = char_traits<charT> >
+class basic_filebuf
+    : public basic_streambuf<charT, traits>
+{
+public:
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    // 27.9.1.2 Constructors/destructor:
+    basic_filebuf();
+    basic_filebuf(basic_filebuf&& rhs);
+    virtual ~basic_filebuf();
+
+    // 27.9.1.3 Assign/swap:
+    basic_filebuf& operator=(basic_filebuf&& rhs);
+    void swap(basic_filebuf& rhs);
+
+    // 27.9.1.4 Members:
+    bool is_open() const;
+    basic_filebuf* open(const char* s, ios_base::openmode mode);
+    basic_filebuf* open(const string& s, ios_base::openmode mode);
+    basic_filebuf* close();
+
+protected:
+    // 27.9.1.5 Overridden virtual functions:
+    virtual streamsize showmanyc();
+    virtual int_type underflow();
+    virtual int_type uflow();
+    virtual int_type pbackfail(int_type c = traits_type::eof());
+    virtual int_type overflow (int_type c = traits_type::eof());
+    virtual basic_streambuf<char_type, traits_type>* setbuf(char_type* s, streamsize n);
+    virtual pos_type seekoff(off_type off, ios_base::seekdir way,
+                             ios_base::openmode which = ios_base::in | ios_base::out);
+    virtual pos_type seekpos(pos_type sp,
+                             ios_base::openmode which = ios_base::in | ios_base::out);
+    virtual int sync();
+    virtual void imbue(const locale& loc);
+};
+
+template <class charT, class traits>
+  void
+  swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
+
+typedef basic_filebuf<char>    filebuf;
+typedef basic_filebuf<wchar_t> wfilebuf;
+
+template <class charT, class traits = char_traits<charT> >
+class basic_ifstream
+    : public basic_istream<charT,traits>
+{
+public:
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    basic_ifstream();
+    explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in);
+    explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in);
+    basic_ifstream(basic_ifstream&& rhs);
+
+    basic_ifstream& operator=(basic_ifstream&& rhs);
+    void swap(basic_ifstream& rhs);
+
+    basic_filebuf<char_type, traits_type>* rdbuf() const;
+    bool is_open() const;
+    void open(const char* s, ios_base::openmode mode = ios_base::in);
+    void open(const string& s, ios_base::openmode mode = ios_base::in);
+    void close();
+};
+
+template <class charT, class traits>
+  void
+  swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
+
+typedef basic_ifstream<char>    ifstream;
+typedef basic_ifstream<wchar_t> wifstream;
+
+template <class charT, class traits = char_traits<charT> >
+class basic_ofstream
+    : public basic_ostream<charT,traits>
+{
+public:
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    basic_ofstream();
+    explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out);
+    explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out);
+    basic_ofstream(basic_ofstream&& rhs);
+
+    basic_ofstream& operator=(basic_ofstream&& rhs);
+    void swap(basic_ofstream& rhs);
+
+    basic_filebuf<char_type, traits_type>* rdbuf() const;
+    bool is_open() const;
+    void open(const char* s, ios_base::openmode mode = ios_base::out);
+    void open(const string& s, ios_base::openmode mode = ios_base::out);
+    void close();
+};
+
+template <class charT, class traits>
+  void
+  swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
+
+typedef basic_ofstream<char>    ofstream;
+typedef basic_ofstream<wchar_t> wofstream;
+
+template <class charT, class traits=char_traits<charT> >
+class basic_fstream
+    : public basic_iostream<charT,traits>
+{
+public:
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    basic_fstream();
+    explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
+    explicit basic_fstream(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out);
+    basic_fstream(basic_fstream&& rhs);
+
+    basic_fstream& operator=(basic_fstream&& rhs);
+    void swap(basic_fstream& rhs);
+
+    basic_filebuf<char_type, traits_type>* rdbuf() const;
+    bool is_open() const;
+    void open(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
+    void open(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out);
+    void close();
+};
+
+template <class charT, class traits>
+  void swap(basic_fstream<charT, traits>& x, basic_fstream<charT, traits>& y);
+
+typedef basic_fstream<char>    fstream;
+typedef basic_fstream<wchar_t> wfstream;
+
+}  // std
+
+*/
+
+#include <__config>
+#include <ostream>
+#include <istream>
+#include <__locale>
+#include <cstdio>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_filebuf
+    : public basic_streambuf<_CharT, _Traits>
+{
+public:
+    typedef _CharT                           char_type;
+    typedef _Traits                          traits_type;
+    typedef typename traits_type::int_type   int_type;
+    typedef typename traits_type::pos_type   pos_type;
+    typedef typename traits_type::off_type   off_type;
+    typedef typename traits_type::state_type state_type;
+
+    // 27.9.1.2 Constructors/destructor:
+    basic_filebuf();
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_filebuf(basic_filebuf&& __rhs);
+#endif
+    virtual ~basic_filebuf();
+
+    // 27.9.1.3 Assign/swap:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_filebuf& operator=(basic_filebuf&& __rhs);
+#endif
+    void swap(basic_filebuf& __rhs);
+
+    // 27.9.1.4 Members:
+    bool is_open() const;
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+    basic_filebuf* open(const char* __s, ios_base::openmode __mode);
+    basic_filebuf* open(const string& __s, ios_base::openmode __mode);
+#endif
+    basic_filebuf* close();
+
+protected:
+    // 27.9.1.5 Overridden virtual functions:
+    virtual int_type underflow();
+    virtual int_type pbackfail(int_type __c = traits_type::eof());
+    virtual int_type overflow (int_type __c = traits_type::eof());
+    virtual basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n);
+    virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
+                             ios_base::openmode __wch = ios_base::in | ios_base::out);
+    virtual pos_type seekpos(pos_type __sp,
+                             ios_base::openmode __wch = ios_base::in | ios_base::out);
+    virtual int sync();
+    virtual void imbue(const locale& __loc);
+
+private:
+    char*       __extbuf_;
+    const char* __extbufnext_;
+    const char* __extbufend_;
+    char __extbuf_min_[8];
+    size_t __ebs_;
+    char_type* __intbuf_;
+    size_t __ibs_;
+    FILE* __file_;
+    const codecvt<char_type, char, state_type>* __cv_;
+    state_type __st_;
+    state_type __st_last_;
+    ios_base::openmode __om_;
+    ios_base::openmode __cm_;
+    bool __owns_eb_;
+    bool __owns_ib_;
+    bool __always_noconv_;
+
+    bool __read_mode();
+    void __write_mode();
+};
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::basic_filebuf()
+    : __extbuf_(0),
+      __extbufnext_(0),
+      __extbufend_(0),
+      __ebs_(0),
+      __intbuf_(0),
+      __ibs_(0),
+      __file_(0),
+      __cv_(nullptr),
+      __st_(),
+      __st_last_(),
+      __om_(0),
+      __cm_(0),
+      __owns_eb_(false),
+      __owns_ib_(false),
+      __always_noconv_(false)
+{
+    if (has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
+    {
+        __cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
+        __always_noconv_ = __cv_->always_noconv();
+    }
+    setbuf(0, 4096);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
+    : basic_streambuf<_CharT, _Traits>(__rhs)
+{
+    if (__rhs.__extbuf_ == __rhs.__extbuf_min_)
+    {
+        __extbuf_ = __extbuf_min_;
+        __extbufnext_ = __extbuf_ + (__rhs.__extbufnext_ - __rhs.__extbuf_);
+        __extbufend_ = __extbuf_ + (__rhs.__extbufend_ - __rhs.__extbuf_);
+    }
+    else
+    {
+        __extbuf_ = __rhs.__extbuf_;
+        __extbufnext_ = __rhs.__extbufnext_;
+        __extbufend_ = __rhs.__extbufend_;
+    }
+    __ebs_ = __rhs.__ebs_;
+    __intbuf_ = __rhs.__intbuf_;
+    __ibs_ = __rhs.__ibs_;
+    __file_ = __rhs.__file_;
+    __cv_ = __rhs.__cv_;
+    __st_ = __rhs.__st_;
+    __st_last_ = __rhs.__st_last_;
+    __om_ = __rhs.__om_;
+    __cm_ = __rhs.__cm_;
+    __owns_eb_ = __rhs.__owns_eb_;
+    __owns_ib_ = __rhs.__owns_ib_;
+    __always_noconv_ = __rhs.__always_noconv_;
+    if (__rhs.pbase())
+    {
+        if (__rhs.pbase() == __rhs.__intbuf_)
+            this->setp(__intbuf_, __intbuf_ + (__rhs. epptr() - __rhs.pbase()));
+        else
+            this->setp((char_type*)__extbuf_,
+                       (char_type*)__extbuf_ + (__rhs. epptr() - __rhs.pbase()));
+        this->pbump(__rhs. pptr() - __rhs.pbase());
+    }
+    else if (__rhs.eback())
+    {
+        if (__rhs.eback() == __rhs.__intbuf_)
+            this->setg(__intbuf_, __intbuf_ + (__rhs.gptr() - __rhs.eback()),
+                                  __intbuf_ + (__rhs.egptr() - __rhs.eback()));
+        else
+            this->setg((char_type*)__extbuf_,
+                       (char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()),
+                       (char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback()));
+    }
+    __rhs.__extbuf_ = 0;
+    __rhs.__extbufnext_ = 0;
+    __rhs.__extbufend_ = 0;
+    __rhs.__ebs_ = 0;
+    __rhs.__intbuf_ = 0;
+    __rhs.__ibs_ = 0;
+    __rhs.__file_ = 0;
+    __rhs.__st_ = state_type();
+    __rhs.__st_last_ = state_type();
+    __rhs.__om_ = 0;
+    __rhs.__cm_ = 0;
+    __rhs.__owns_eb_ = false;
+    __rhs.__owns_ib_ = false;
+    __rhs.setg(0, 0, 0);
+    __rhs.setp(0, 0);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_filebuf<_CharT, _Traits>&
+basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
+{
+    close();
+    swap(__rhs);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::~basic_filebuf()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        close();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    if (__owns_eb_)
+        delete [] __extbuf_;
+    if (__owns_ib_)
+        delete [] __intbuf_;
+}
+
+template <class _CharT, class _Traits>
+void
+basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
+{
+    basic_streambuf<char_type, traits_type>::swap(__rhs);
+    if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
+    {
+        _VSTD::swap(__extbuf_, __rhs.__extbuf_);
+        _VSTD::swap(__extbufnext_, __rhs.__extbufnext_);
+        _VSTD::swap(__extbufend_, __rhs.__extbufend_);
+    }
+    else
+    {
+        ptrdiff_t __ln = __extbufnext_ - __extbuf_;
+        ptrdiff_t __le = __extbufend_ - __extbuf_;
+        ptrdiff_t __rn = __rhs.__extbufnext_ - __rhs.__extbuf_;
+        ptrdiff_t __re = __rhs.__extbufend_ - __rhs.__extbuf_;
+        if (__extbuf_ == __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
+        {
+            __extbuf_ = __rhs.__extbuf_;
+            __rhs.__extbuf_ = __rhs.__extbuf_min_;
+        }
+        else if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ == __rhs.__extbuf_min_)
+        {
+            __rhs.__extbuf_ = __extbuf_;
+            __extbuf_ = __extbuf_min_;
+        }
+        __extbufnext_ = __extbuf_ + __rn;
+        __extbufend_ = __extbuf_ + __re;
+        __rhs.__extbufnext_ = __rhs.__extbuf_ + __ln;
+        __rhs.__extbufend_ = __rhs.__extbuf_ + __le;
+    }
+    _VSTD::swap(__ebs_, __rhs.__ebs_);
+    _VSTD::swap(__intbuf_, __rhs.__intbuf_);
+    _VSTD::swap(__ibs_, __rhs.__ibs_);
+    _VSTD::swap(__file_, __rhs.__file_);
+    _VSTD::swap(__cv_, __rhs.__cv_);
+    _VSTD::swap(__st_, __rhs.__st_);
+    _VSTD::swap(__st_last_, __rhs.__st_last_);
+    _VSTD::swap(__om_, __rhs.__om_);
+    _VSTD::swap(__cm_, __rhs.__cm_);
+    _VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
+    _VSTD::swap(__owns_ib_, __rhs.__owns_ib_);
+    _VSTD::swap(__always_noconv_, __rhs.__always_noconv_);
+    if (this->eback() == (char_type*)__rhs.__extbuf_min_)
+    {
+        ptrdiff_t __n = this->gptr() - this->eback();
+        ptrdiff_t __e = this->egptr() - this->eback();
+        this->setg((char_type*)__extbuf_min_,
+                   (char_type*)__extbuf_min_ + __n,
+                   (char_type*)__extbuf_min_ + __e);
+    }
+    else if (this->pbase() == (char_type*)__rhs.__extbuf_min_)
+    {
+        ptrdiff_t __n = this->pptr() - this->pbase();
+        ptrdiff_t __e = this->epptr() - this->pbase();
+        this->setp((char_type*)__extbuf_min_,
+                   (char_type*)__extbuf_min_ + __e);
+        this->pbump(__n);
+    }
+    if (__rhs.eback() == (char_type*)__extbuf_min_)
+    {
+        ptrdiff_t __n = __rhs.gptr() - __rhs.eback();
+        ptrdiff_t __e = __rhs.egptr() - __rhs.eback();
+        __rhs.setg((char_type*)__rhs.__extbuf_min_,
+                   (char_type*)__rhs.__extbuf_min_ + __n,
+                   (char_type*)__rhs.__extbuf_min_ + __e);
+    }
+    else if (__rhs.pbase() == (char_type*)__extbuf_min_)
+    {
+        ptrdiff_t __n = __rhs.pptr() - __rhs.pbase();
+        ptrdiff_t __e = __rhs.epptr() - __rhs.pbase();
+        __rhs.setp((char_type*)__rhs.__extbuf_min_,
+                   (char_type*)__rhs.__extbuf_min_ + __e);
+        __rhs.pbump(__n);
+    }
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(basic_filebuf<_CharT, _Traits>& __x, basic_filebuf<_CharT, _Traits>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+basic_filebuf<_CharT, _Traits>::is_open() const
+{
+    return __file_ != 0;
+}
+
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
+{
+    basic_filebuf<_CharT, _Traits>* __rt = 0;
+    if (__file_ == 0)
+    {
+        __rt = this;
+        const char* __mdstr;
+        switch (__mode & ~ios_base::ate)
+        {
+        case ios_base::out:
+        case ios_base::out | ios_base::trunc:
+            __mdstr = "w";
+            break;
+        case ios_base::out | ios_base::app:
+        case ios_base::app:
+            __mdstr = "a";
+            break;
+        case ios_base::in:
+            __mdstr = "r";
+            break;
+        case ios_base::in | ios_base::out:
+            __mdstr = "r+";
+            break;
+        case ios_base::in | ios_base::out | ios_base::trunc:
+            __mdstr = "w+";
+            break;
+        case ios_base::in | ios_base::out | ios_base::app:
+        case ios_base::in | ios_base::app:
+            __mdstr = "a+";
+            break;
+        case ios_base::out | ios_base::binary:
+        case ios_base::out | ios_base::trunc | ios_base::binary:
+            __mdstr = "wb";
+            break;
+        case ios_base::out | ios_base::app | ios_base::binary:
+        case ios_base::app | ios_base::binary:
+            __mdstr = "ab";
+            break;
+        case ios_base::in | ios_base::binary:
+            __mdstr = "rb";
+            break;
+        case ios_base::in | ios_base::out | ios_base::binary:
+            __mdstr = "r+b";
+            break;
+        case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary:
+            __mdstr = "w+b";
+            break;
+        case ios_base::in | ios_base::out | ios_base::app | ios_base::binary:
+        case ios_base::in | ios_base::app | ios_base::binary:
+            __mdstr = "a+b";
+            break;
+        default:
+            __rt = 0;
+            break;
+        }
+        if (__rt)
+        {
+            __file_ = fopen(__s, __mdstr);
+            if (__file_)
+            {
+                __om_ = __mode;
+                if (__mode & ios_base::ate)
+                {
+                    if (fseek(__file_, 0, SEEK_END))
+                    {
+                        fclose(__file_);
+                        __file_ = 0;
+                        __rt = 0;
+                    }
+                }
+            }
+            else
+                __rt = 0;
+        }
+    }
+    return __rt;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_filebuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
+{
+    return open(__s.c_str(), __mode);
+}
+#endif
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::close()
+{
+    basic_filebuf<_CharT, _Traits>* __rt = 0;
+    if (__file_)
+    {
+        __rt = this;
+        unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
+        if (sync())
+            __rt = 0;
+        if (fclose(__h.release()) == 0)
+            __file_ = 0;
+        else
+            __rt = 0;
+    }
+    return __rt;
+}
+
+template <class _CharT, class _Traits>
+typename basic_filebuf<_CharT, _Traits>::int_type
+basic_filebuf<_CharT, _Traits>::underflow()
+{
+    if (__file_ == 0)
+        return traits_type::eof();
+    bool __initial = __read_mode();
+    char_type __1buf;
+    if (this->gptr() == 0)
+        this->setg(&__1buf, &__1buf+1, &__1buf+1);
+    const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4);
+    int_type __c = traits_type::eof();
+    if (this->gptr() == this->egptr())
+    {
+        memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
+        if (__always_noconv_)
+        {
+            size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz);
+            __nmemb = fread(this->eback() + __unget_sz, 1, __nmemb, __file_);
+            if (__nmemb != 0)
+            {
+                this->setg(this->eback(),
+                           this->eback() + __unget_sz,
+                           this->eback() + __unget_sz + __nmemb);
+                __c = traits_type::to_int_type(*this->gptr());
+            }
+        }
+        else
+        {
+            memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
+            __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
+            __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
+            size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),
+                                 static_cast<size_t>(__extbufend_ - __extbufnext_));
+            codecvt_base::result __r;
+            __st_last_ = __st_;
+            size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
+            if (__nr != 0)
+            {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+                if (!__cv_)
+                    throw bad_cast();
+#endif
+                __extbufend_ = __extbufnext_ + __nr;
+                char_type*  __inext;
+                __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
+                                       this->eback() + __unget_sz,
+                                       this->eback() + __ibs_, __inext);
+                if (__r == codecvt_base::noconv)
+                {
+                    this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
+                    __c = traits_type::to_int_type(*this->gptr());
+                }
+                else if (__inext != this->eback() + __unget_sz)
+                {
+                    this->setg(this->eback(), this->eback() + __unget_sz, __inext);
+                    __c = traits_type::to_int_type(*this->gptr());
+                }
+            }
+        }
+    }
+    else
+        __c = traits_type::to_int_type(*this->gptr());
+    if (this->eback() == &__1buf)
+        this->setg(0, 0, 0);
+    return __c;
+}
+
+template <class _CharT, class _Traits>
+typename basic_filebuf<_CharT, _Traits>::int_type
+basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c)
+{
+    if (__file_ && this->eback() < this->gptr())
+    {
+        if (traits_type::eq_int_type(__c, traits_type::eof()))
+        {
+            this->gbump(-1);
+            return traits_type::not_eof(__c);
+        }
+        if ((__om_ & ios_base::out) ||
+            traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
+        {
+            this->gbump(-1);
+            *this->gptr() = traits_type::to_char_type(__c);
+            return __c;
+        }
+    }
+    return traits_type::eof();
+}
+
+template <class _CharT, class _Traits>
+typename basic_filebuf<_CharT, _Traits>::int_type
+basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
+{
+    if (__file_ == 0)
+        return traits_type::eof();
+    __write_mode();
+    char_type __1buf;
+    char_type* __pb_save = this->pbase();
+    char_type* __epb_save = this->epptr();
+    if (!traits_type::eq_int_type(__c, traits_type::eof()))
+    {
+        if (this->pptr() == 0)
+            this->setp(&__1buf, &__1buf+1);
+        *this->pptr() = traits_type::to_char_type(__c);
+        this->pbump(1);
+    }
+    if (this->pptr() != this->pbase())
+    {
+        if (__always_noconv_)
+        {
+            size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
+            if (fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb)
+                return traits_type::eof();
+        }
+        else
+        {
+            char* __extbe = __extbuf_;
+            codecvt_base::result __r;
+            do
+            {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+                if (!__cv_)
+                    throw bad_cast();
+#endif
+                const char_type* __e;
+                __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
+                                        __extbuf_, __extbuf_ + __ebs_, __extbe);
+                if (__e == this->pbase())
+                    return traits_type::eof();
+                if (__r == codecvt_base::noconv)
+                {
+                    size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
+                    if (fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb)
+                        return traits_type::eof();
+                }
+                else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
+                {
+                    size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_);
+                    if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb)
+                        return traits_type::eof();
+                    if (__r == codecvt_base::partial)
+                    {
+                        this->setp((char_type*)__e, this->pptr());
+                        this->pbump(this->epptr() - this->pbase());
+                    }
+                }
+                else
+                    return traits_type::eof();
+            } while (__r == codecvt_base::partial);
+        }
+        this->setp(__pb_save, __epb_save);
+    }
+    return traits_type::not_eof(__c);
+}
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n)
+{
+    this->setg(0, 0, 0);
+    this->setp(0, 0);
+    if (__owns_eb_)
+        delete [] __extbuf_;
+    if (__owns_ib_)
+        delete [] __intbuf_;
+    __ebs_ = __n;
+    if (__ebs_ > sizeof(__extbuf_min_))
+    {
+        if (__always_noconv_ && __s)
+        {
+            __extbuf_ = (char*)__s;
+            __owns_eb_ = false;
+        }
+        else
+        {
+            __extbuf_ = new char[__ebs_];
+            __owns_eb_ = true;
+        }
+    }
+    else
+    {
+        __extbuf_ = __extbuf_min_;
+        __ebs_ = sizeof(__extbuf_min_);
+        __owns_eb_ = false;
+    }
+    if (!__always_noconv_)
+    {
+        __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_));
+        if (__s && __ibs_ >= sizeof(__extbuf_min_))
+        {
+            __intbuf_ = __s;
+            __owns_ib_ = false;
+        }
+        else
+        {
+            __intbuf_ = new char_type[__ibs_];
+            __owns_ib_ = true;
+        }
+    }
+    else
+    {
+        __ibs_ = 0;
+        __intbuf_ = 0;
+        __owns_ib_ = false;
+    }
+    return this;
+}
+
+template <class _CharT, class _Traits>
+typename basic_filebuf<_CharT, _Traits>::pos_type
+basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
+                                        ios_base::openmode)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (!__cv_)
+        throw bad_cast();
+#endif
+    int __width = __cv_->encoding();
+    if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
+        return pos_type(off_type(-1));
+    // __width > 0 || __off == 0
+    int __whence;
+    switch (__way)
+    {
+    case ios_base::beg:
+        __whence = SEEK_SET;
+        break;
+    case ios_base::cur:
+        __whence = SEEK_CUR;
+        break;
+    case ios_base::end:
+        __whence = SEEK_END;
+        break;
+    default:
+        return pos_type(off_type(-1));
+    }
+#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+    if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
+        return pos_type(off_type(-1));
+    pos_type __r = ftell(__file_);
+#else
+    if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
+        return pos_type(off_type(-1));
+    pos_type __r = ftello(__file_);
+#endif
+    __r.state(__st_);
+    return __r;
+}
+
+template <class _CharT, class _Traits>
+typename basic_filebuf<_CharT, _Traits>::pos_type
+basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
+{
+    if (__file_ == 0 || sync())
+        return pos_type(off_type(-1));
+#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+    if (fseek(__file_, __sp, SEEK_SET))
+        return pos_type(off_type(-1));
+#else
+    if (fseeko(__file_, __sp, SEEK_SET))
+        return pos_type(off_type(-1));
+#endif
+    __st_ = __sp.state();
+    return __sp;
+}
+
+template <class _CharT, class _Traits>
+int
+basic_filebuf<_CharT, _Traits>::sync()
+{
+    if (__file_ == 0)
+        return 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (!__cv_)
+        throw bad_cast();
+#endif
+    if (__cm_ & ios_base::out)
+    {
+        if (this->pptr() != this->pbase())
+            if (overflow() == traits_type::eof())
+                return -1;
+        codecvt_base::result __r;
+        do
+        {
+            char* __extbe;
+            __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe);
+            size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_);
+            if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb)
+                return -1;
+        } while (__r == codecvt_base::partial);
+        if (__r == codecvt_base::error)
+            return -1;
+        if (fflush(__file_))
+            return -1;
+    }
+    else if (__cm_ & ios_base::in)
+    {
+        off_type __c;
+        state_type __state = __st_last_;
+        bool __update_st = false;
+        if (__always_noconv_)
+            __c = this->egptr() - this->gptr();
+        else
+        {
+            int __width = __cv_->encoding();
+            __c = __extbufend_ - __extbufnext_;
+            if (__width > 0)
+                __c += __width * (this->egptr() - this->gptr());
+            else
+            {
+                if (this->gptr() != this->egptr())
+                {
+                    const int __off =  __cv_->length(__state, __extbuf_,
+                                                     __extbufnext_,
+                                                     this->gptr() - this->eback());
+                    __c += __extbufnext_ - __extbuf_ - __off;
+                    __update_st = true;
+                }
+            }
+        }
+#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+        if (fseek(__file_, -__c, SEEK_CUR))
+            return -1;
+#else
+        if (fseeko(__file_, -__c, SEEK_CUR))
+            return -1;
+#endif
+        if (__update_st)
+            __st_ = __state;
+        __extbufnext_ = __extbufend_ = __extbuf_;
+        this->setg(0, 0, 0);
+        __cm_ = 0;
+    }
+    return 0;
+}
+
+template <class _CharT, class _Traits>
+void
+basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc)
+{
+    sync();
+    __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
+    bool __old_anc = __always_noconv_;
+    __always_noconv_ = __cv_->always_noconv();
+    if (__old_anc != __always_noconv_)
+    {
+        this->setg(0, 0, 0);
+        this->setp(0, 0);
+        // invariant, char_type is char, else we couldn't get here
+        if (__always_noconv_)  // need to dump __intbuf_
+        {
+            if (__owns_eb_)
+                delete [] __extbuf_;
+            __owns_eb_ = __owns_ib_;
+            __ebs_ = __ibs_;
+            __extbuf_ = (char*)__intbuf_;
+            __ibs_ = 0;
+            __intbuf_ = 0;
+            __owns_ib_ = false;
+        }
+        else  // need to obtain an __intbuf_.
+        {     // If __extbuf_ is user-supplied, use it, else new __intbuf_
+            if (!__owns_eb_ && __extbuf_ != __extbuf_min_)
+            {
+                __ibs_ = __ebs_;
+                __intbuf_ = (char_type*)__extbuf_;
+                __owns_ib_ = false;
+                __extbuf_ = new char[__ebs_];
+                __owns_eb_ = true;
+            }
+            else
+            {
+                __ibs_ = __ebs_;
+                __intbuf_ = new char_type[__ibs_];
+                __owns_ib_ = true;
+            }
+        }
+    }
+}
+
+template <class _CharT, class _Traits>
+bool
+basic_filebuf<_CharT, _Traits>::__read_mode()
+{
+    if (!(__cm_ & ios_base::in))
+    {
+        this->setp(0, 0);
+        if (__always_noconv_)
+            this->setg((char_type*)__extbuf_,
+                       (char_type*)__extbuf_ + __ebs_,
+                       (char_type*)__extbuf_ + __ebs_);
+        else
+            this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
+        __cm_ = ios_base::in;
+        return true;
+    }
+    return false;
+}
+
+template <class _CharT, class _Traits>
+void
+basic_filebuf<_CharT, _Traits>::__write_mode()
+{
+    if (!(__cm_ & ios_base::out))
+    {
+        this->setg(0, 0, 0);
+        if (__ebs_ > sizeof(__extbuf_min_))
+        {
+            if (__always_noconv_)
+                this->setp((char_type*)__extbuf_,
+                           (char_type*)__extbuf_ + (__ebs_ - 1));
+            else
+                this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
+        }
+        else
+            this->setp(0, 0);
+        __cm_ = ios_base::out;
+    }
+}
+
+// basic_ifstream
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_ifstream
+    : public basic_istream<_CharT, _Traits>
+{
+public:
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    basic_ifstream();
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+    explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
+    explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
+#endif
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_ifstream(basic_ifstream&& __rhs);
+#endif
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_ifstream& operator=(basic_ifstream&& __rhs);
+#endif
+    void swap(basic_ifstream& __rhs);
+
+    basic_filebuf<char_type, traits_type>* rdbuf() const;
+    bool is_open() const;
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+    void open(const char* __s, ios_base::openmode __mode = ios_base::in);
+    void open(const string& __s, ios_base::openmode __mode = ios_base::in);
+#endif
+    void close();
+
+private:
+    basic_filebuf<char_type, traits_type> __sb_;
+};
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ifstream<_CharT, _Traits>::basic_ifstream()
+    : basic_istream<char_type, traits_type>(&__sb_)
+{
+}
+
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
+    : basic_istream<char_type, traits_type>(&__sb_)
+{
+    if (__sb_.open(__s, __mode | ios_base::in) == 0)
+        this->setstate(ios_base::failbit);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode)
+    : basic_istream<char_type, traits_type>(&__sb_)
+{
+    if (__sb_.open(__s, __mode | ios_base::in) == 0)
+        this->setstate(ios_base::failbit);
+}
+#endif
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
+    : basic_istream<char_type, traits_type>(_VSTD::move(__rhs)),
+      __sb_(_VSTD::move(__rhs.__sb_))
+{
+    this->set_rdbuf(&__sb_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ifstream<_CharT, _Traits>&
+basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
+{
+    basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
+    __sb_ = _VSTD::move(__rhs.__sb_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ifstream<_CharT, _Traits>::swap(basic_ifstream& __rhs)
+{
+    basic_istream<char_type, traits_type>::swap(__rhs);
+    __sb_.swap(__rhs.__sb_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(basic_ifstream<_CharT, _Traits>& __x, basic_ifstream<_CharT, _Traits>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_filebuf<_CharT, _Traits>*
+basic_ifstream<_CharT, _Traits>::rdbuf() const
+{
+    return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+basic_ifstream<_CharT, _Traits>::is_open() const
+{
+    return __sb_.is_open();
+}
+
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+template <class _CharT, class _Traits>
+void
+basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
+{
+    if (__sb_.open(__s, __mode | ios_base::in))
+        this->clear();
+    else
+        this->setstate(ios_base::failbit);
+}
+
+template <class _CharT, class _Traits>
+void
+basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
+{
+    if (__sb_.open(__s, __mode | ios_base::in))
+        this->clear();
+    else
+        this->setstate(ios_base::failbit);
+}
+#endif
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ifstream<_CharT, _Traits>::close()
+{
+    if (__sb_.close() == 0)
+        this->setstate(ios_base::failbit);
+}
+
+// basic_ofstream
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_ofstream
+    : public basic_ostream<_CharT, _Traits>
+{
+public:
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    basic_ofstream();
+    explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
+    explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_ofstream(basic_ofstream&& __rhs);
+#endif
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_ofstream& operator=(basic_ofstream&& __rhs);
+#endif
+    void swap(basic_ofstream& __rhs);
+
+    basic_filebuf<char_type, traits_type>* rdbuf() const;
+    bool is_open() const;
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+    void open(const char* __s, ios_base::openmode __mode = ios_base::out);
+    void open(const string& __s, ios_base::openmode __mode = ios_base::out);
+#endif
+    void close();
+
+private:
+    basic_filebuf<char_type, traits_type> __sb_;
+};
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ofstream<_CharT, _Traits>::basic_ofstream()
+    : basic_ostream<char_type, traits_type>(&__sb_)
+{
+}
+
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
+    : basic_ostream<char_type, traits_type>(&__sb_)
+{
+    if (__sb_.open(__s, __mode | ios_base::out) == 0)
+        this->setstate(ios_base::failbit);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode)
+    : basic_ostream<char_type, traits_type>(&__sb_)
+{
+    if (__sb_.open(__s, __mode | ios_base::out) == 0)
+        this->setstate(ios_base::failbit);
+}
+#endif
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
+    : basic_ostream<char_type, traits_type>(_VSTD::move(__rhs)),
+      __sb_(_VSTD::move(__rhs.__sb_))
+{
+    this->set_rdbuf(&__sb_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ofstream<_CharT, _Traits>&
+basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
+{
+    basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
+    __sb_ = _VSTD::move(__rhs.__sb_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ofstream<_CharT, _Traits>::swap(basic_ofstream& __rhs)
+{
+    basic_ostream<char_type, traits_type>::swap(__rhs);
+    __sb_.swap(__rhs.__sb_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(basic_ofstream<_CharT, _Traits>& __x, basic_ofstream<_CharT, _Traits>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_filebuf<_CharT, _Traits>*
+basic_ofstream<_CharT, _Traits>::rdbuf() const
+{
+    return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+basic_ofstream<_CharT, _Traits>::is_open() const
+{
+    return __sb_.is_open();
+}
+
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+template <class _CharT, class _Traits>
+void
+basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
+{
+    if (__sb_.open(__s, __mode | ios_base::out))
+        this->clear();
+    else
+        this->setstate(ios_base::failbit);
+}
+
+template <class _CharT, class _Traits>
+void
+basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
+{
+    if (__sb_.open(__s, __mode | ios_base::out))
+        this->clear();
+    else
+        this->setstate(ios_base::failbit);
+}
+#endif
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ofstream<_CharT, _Traits>::close()
+{
+    if (__sb_.close() == 0)
+        this->setstate(ios_base::failbit);
+}
+
+// basic_fstream
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_fstream
+    : public basic_iostream<_CharT, _Traits>
+{
+public:
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    basic_fstream();
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+    explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
+    explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
+#endif
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_fstream(basic_fstream&& __rhs);
+#endif
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_fstream& operator=(basic_fstream&& __rhs);
+#endif
+    void swap(basic_fstream& __rhs);
+
+    basic_filebuf<char_type, traits_type>* rdbuf() const;
+    bool is_open() const;
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+    void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
+    void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
+#endif
+    void close();
+
+private:
+    basic_filebuf<char_type, traits_type> __sb_;
+};
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_fstream<_CharT, _Traits>::basic_fstream()
+    : basic_iostream<char_type, traits_type>(&__sb_)
+{
+}
+
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
+    : basic_iostream<char_type, traits_type>(&__sb_)
+{
+    if (__sb_.open(__s, __mode) == 0)
+        this->setstate(ios_base::failbit);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode)
+    : basic_iostream<char_type, traits_type>(&__sb_)
+{
+    if (__sb_.open(__s, __mode) == 0)
+        this->setstate(ios_base::failbit);
+}
+#endif
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
+    : basic_iostream<char_type, traits_type>(_VSTD::move(__rhs)),
+      __sb_(_VSTD::move(__rhs.__sb_))
+{
+    this->set_rdbuf(&__sb_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_fstream<_CharT, _Traits>&
+basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
+{
+    basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
+    __sb_ = _VSTD::move(__rhs.__sb_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_fstream<_CharT, _Traits>::swap(basic_fstream& __rhs)
+{
+    basic_iostream<char_type, traits_type>::swap(__rhs);
+    __sb_.swap(__rhs.__sb_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(basic_fstream<_CharT, _Traits>& __x, basic_fstream<_CharT, _Traits>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_filebuf<_CharT, _Traits>*
+basic_fstream<_CharT, _Traits>::rdbuf() const
+{
+    return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+basic_fstream<_CharT, _Traits>::is_open() const
+{
+    return __sb_.is_open();
+}
+
+#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+template <class _CharT, class _Traits>
+void
+basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
+{
+    if (__sb_.open(__s, __mode))
+        this->clear();
+    else
+        this->setstate(ios_base::failbit);
+}
+
+template <class _CharT, class _Traits>
+void
+basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
+{
+    if (__sb_.open(__s, __mode))
+        this->clear();
+    else
+        this->setstate(ios_base::failbit);
+}
+#endif
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_fstream<_CharT, _Traits>::close()
+{
+    if (__sb_.close() == 0)
+        this->setstate(ios_base::failbit);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_FSTREAM

Property changes on: lab4/.minix-src/include/c++/fstream
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/initializer_list
===================================================================
--- lab4/.minix-src/include/c++/initializer_list	(nonexistent)
+++ lab4/.minix-src/include/c++/initializer_list	(revision 13)
@@ -0,0 +1,118 @@
+// -*- C++ -*-
+//===----------------------- initializer_list -----------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_INITIALIZER_LIST
+#define _LIBCPP_INITIALIZER_LIST
+
+/*
+    initializer_list synopsis
+
+namespace std
+{
+
+template<class E>
+class initializer_list
+{
+public:
+    typedef E        value_type;
+    typedef const E& reference;
+    typedef const E& const_reference;
+    typedef size_t   size_type;
+
+    typedef const E* iterator;
+    typedef const E* const_iterator;
+
+    initializer_list() noexcept; // constexpr in C++14
+
+    size_t   size()  const noexcept; // constexpr in C++14
+    const E* begin() const noexcept; // constexpr in C++14
+    const E* end()   const noexcept; // constexpr in C++14
+};
+
+template<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14
+template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14
+
+}  // std
+
+*/
+
+#include <__config>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+namespace std  // purposefully not versioned
+{
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template<class _Ep>
+class _LIBCPP_TYPE_VIS_ONLY initializer_list
+{
+    const _Ep* __begin_;
+    size_t    __size_;
+
+    _LIBCPP_ALWAYS_INLINE
+    _LIBCPP_CONSTEXPR_AFTER_CXX11
+    initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
+        : __begin_(__b),
+          __size_(__s)
+        {}
+public:
+    typedef _Ep        value_type;
+    typedef const _Ep& reference;
+    typedef const _Ep& const_reference;
+    typedef size_t    size_type;
+
+    typedef const _Ep* iterator;
+    typedef const _Ep* const_iterator;
+
+    _LIBCPP_ALWAYS_INLINE
+    _LIBCPP_CONSTEXPR_AFTER_CXX11
+    initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    _LIBCPP_CONSTEXPR_AFTER_CXX11
+    size_t    size()  const _NOEXCEPT {return __size_;}
+    
+    _LIBCPP_ALWAYS_INLINE
+    _LIBCPP_CONSTEXPR_AFTER_CXX11
+    const _Ep* begin() const _NOEXCEPT {return __begin_;}
+
+    _LIBCPP_ALWAYS_INLINE
+    _LIBCPP_CONSTEXPR_AFTER_CXX11
+    const _Ep* end()   const _NOEXCEPT {return __begin_ + __size_;}
+};
+
+template<class _Ep>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Ep*
+begin(initializer_list<_Ep> __il) _NOEXCEPT
+{
+    return __il.begin();
+}
+
+template<class _Ep>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Ep*
+end(initializer_list<_Ep> __il) _NOEXCEPT
+{
+    return __il.end();
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+}  // std
+
+#endif  // _LIBCPP_INITIALIZER_LIST

Property changes on: lab4/.minix-src/include/c++/initializer_list
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/iosfwd
===================================================================
--- lab4/.minix-src/include/c++/iosfwd	(nonexistent)
+++ lab4/.minix-src/include/c++/iosfwd	(revision 13)
@@ -0,0 +1,199 @@
+// -*- C++ -*-
+//===--------------------------- iosfwd -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_IOSFWD
+#define _LIBCPP_IOSFWD
+
+/*
+    iosfwd synopsis
+
+namespace std
+{
+
+template<class charT> struct char_traits;
+template<class T>     class allocator;
+
+class ios_base;
+template <class charT, class traits = char_traits<charT> > class basic_ios;
+
+template <class charT, class traits = char_traits<charT> > class basic_streambuf;
+template <class charT, class traits = char_traits<charT> > class basic_istream;
+template <class charT, class traits = char_traits<charT> > class basic_ostream;
+template <class charT, class traits = char_traits<charT> > class basic_iostream;
+
+template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+    class basic_stringbuf;
+template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+    class basic_istringstream;
+template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+    class basic_ostringstream;
+template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+    class basic_stringstream;
+
+template <class charT, class traits = char_traits<charT> > class basic_filebuf;
+template <class charT, class traits = char_traits<charT> > class basic_ifstream;
+template <class charT, class traits = char_traits<charT> > class basic_ofstream;
+template <class charT, class traits = char_traits<charT> > class basic_fstream;
+
+template <class charT, class traits = char_traits<charT> > class istreambuf_iterator;
+template <class charT, class traits = char_traits<charT> > class ostreambuf_iterator;
+
+typedef basic_ios<char>              ios;
+typedef basic_ios<wchar_t>           wios;
+
+typedef basic_streambuf<char>        streambuf;
+typedef basic_istream<char>          istream;
+typedef basic_ostream<char>          ostream;
+typedef basic_iostream<char>         iostream;
+
+typedef basic_stringbuf<char>        stringbuf;
+typedef basic_istringstream<char>    istringstream;
+typedef basic_ostringstream<char>    ostringstream;
+typedef basic_stringstream<char>     stringstream;
+
+typedef basic_filebuf<char>          filebuf;
+typedef basic_ifstream<char>         ifstream;
+typedef basic_ofstream<char>         ofstream;
+typedef basic_fstream<char>          fstream;
+
+typedef basic_streambuf<wchar_t>     wstreambuf;
+typedef basic_istream<wchar_t>       wistream;
+typedef basic_ostream<wchar_t>       wostream;
+typedef basic_iostream<wchar_t>      wiostream;
+
+typedef basic_stringbuf<wchar_t>     wstringbuf;
+typedef basic_istringstream<wchar_t> wistringstream;
+typedef basic_ostringstream<wchar_t> wostringstream;
+typedef basic_stringstream<wchar_t>  wstringstream;
+
+typedef basic_filebuf<wchar_t>       wfilebuf;
+typedef basic_ifstream<wchar_t>      wifstream;
+typedef basic_ofstream<wchar_t>      wofstream;
+typedef basic_fstream<wchar_t>       wfstream;
+
+template <class state> class fpos;
+typedef fpos<char_traits<char>::state_type>    streampos;
+typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
+
+}  // std
+
+*/
+
+#include <__config>
+#include <wchar.h>  // for mbstate_t
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+class _LIBCPP_TYPE_VIS ios_base;
+
+template<class _CharT>  struct _LIBCPP_TYPE_VIS_ONLY char_traits;
+template<class _Tp>     class _LIBCPP_TYPE_VIS_ONLY allocator;
+
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_ios;
+
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_streambuf;
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_istream;
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_ostream;
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_iostream;
+
+template <class _CharT, class _Traits = char_traits<_CharT>,
+          class _Allocator = allocator<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_stringbuf;
+template <class _CharT, class _Traits = char_traits<_CharT>,
+          class _Allocator = allocator<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_istringstream;
+template <class _CharT, class _Traits = char_traits<_CharT>,
+          class _Allocator = allocator<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_ostringstream;
+template <class _CharT, class _Traits = char_traits<_CharT>,
+          class _Allocator = allocator<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_stringstream;
+
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_filebuf;
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_ifstream;
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_ofstream;
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_fstream;
+
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator;
+template <class _CharT, class _Traits = char_traits<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator;
+
+typedef basic_ios<char>              ios;
+typedef basic_ios<wchar_t>           wios;
+
+typedef basic_streambuf<char>        streambuf;
+typedef basic_istream<char>          istream;
+typedef basic_ostream<char>          ostream;
+typedef basic_iostream<char>         iostream;
+
+typedef basic_stringbuf<char>        stringbuf;
+typedef basic_istringstream<char>    istringstream;
+typedef basic_ostringstream<char>    ostringstream;
+typedef basic_stringstream<char>     stringstream;
+
+typedef basic_filebuf<char>          filebuf;
+typedef basic_ifstream<char>         ifstream;
+typedef basic_ofstream<char>         ofstream;
+typedef basic_fstream<char>          fstream;
+
+typedef basic_streambuf<wchar_t>     wstreambuf;
+typedef basic_istream<wchar_t>       wistream;
+typedef basic_ostream<wchar_t>       wostream;
+typedef basic_iostream<wchar_t>      wiostream;
+
+typedef basic_stringbuf<wchar_t>     wstringbuf;
+typedef basic_istringstream<wchar_t> wistringstream;
+typedef basic_ostringstream<wchar_t> wostringstream;
+typedef basic_stringstream<wchar_t>  wstringstream;
+
+typedef basic_filebuf<wchar_t>       wfilebuf;
+typedef basic_ifstream<wchar_t>      wifstream;
+typedef basic_ofstream<wchar_t>      wofstream;
+typedef basic_fstream<wchar_t>       wfstream;
+
+template <class _State>             class _LIBCPP_TYPE_VIS_ONLY fpos;
+typedef fpos<mbstate_t>    streampos;
+typedef fpos<mbstate_t>    wstreampos;
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+typedef fpos<mbstate_t>    u16streampos;
+typedef fpos<mbstate_t>    u32streampos;
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+
+#if defined(_NEWLIB_VERSION)
+// On newlib, off_t is 'long int'
+typedef long int streamoff;         // for char_traits in <string>
+#else
+typedef long long streamoff;        // for char_traits in <string>
+#endif
+
+template <class _CharT,             // for <stdexcept>
+          class _Traits = char_traits<_CharT>,
+          class _Allocator = allocator<_CharT> >
+    class _LIBCPP_TYPE_VIS_ONLY basic_string;
+typedef basic_string<char, char_traits<char>, allocator<char> > string;
+typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_IOSFWD

Property changes on: lab4/.minix-src/include/c++/iosfwd
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/iterator
===================================================================
--- lab4/.minix-src/include/c++/iterator	(nonexistent)
+++ lab4/.minix-src/include/c++/iterator	(revision 13)
@@ -0,0 +1,1614 @@
+// -*- C++ -*-
+//===-------------------------- iterator ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_ITERATOR
+#define _LIBCPP_ITERATOR
+
+/*
+    iterator synopsis
+
+namespace std
+{
+
+template<class Iterator>
+struct iterator_traits
+{
+    typedef typename Iterator::difference_type difference_type;
+    typedef typename Iterator::value_type value_type;
+    typedef typename Iterator::pointer pointer;
+    typedef typename Iterator::reference reference;
+    typedef typename Iterator::iterator_category iterator_category;
+};
+
+template<class T>
+struct iterator_traits<T*>
+{
+    typedef ptrdiff_t difference_type;
+    typedef T value_type;
+    typedef T* pointer;
+    typedef T& reference;
+    typedef random_access_iterator_tag iterator_category;
+};
+
+template<class T>
+struct iterator_traits<const T*>
+{
+    typedef ptrdiff_t difference_type;
+    typedef T value_type;
+    typedef const T* pointer;
+    typedef const T& reference;
+    typedef random_access_iterator_tag iterator_category;
+};
+
+template<class Category, class T, class Distance = ptrdiff_t,
+         class Pointer = T*, class Reference = T&>
+struct iterator
+{
+    typedef T         value_type;
+    typedef Distance  difference_type;
+    typedef Pointer   pointer;
+    typedef Reference reference;
+    typedef Category  iterator_category;
+};
+
+struct input_iterator_tag  {};
+struct output_iterator_tag {};
+struct forward_iterator_tag       : public input_iterator_tag         {};
+struct bidirectional_iterator_tag : public forward_iterator_tag       {};
+struct random_access_iterator_tag : public bidirectional_iterator_tag {};
+
+// extension: second argument not conforming to C++03
+template <class InputIterator>
+void advance(InputIterator& i,
+             typename iterator_traits<InputIterator>::difference_type n);
+
+template <class InputIterator>
+typename iterator_traits<InputIterator>::difference_type
+distance(InputIterator first, InputIterator last);
+
+template <class Iterator>
+class reverse_iterator
+    : public iterator<typename iterator_traits<Iterator>::iterator_category,
+                      typename iterator_traits<Iterator>::value_type,
+                      typename iterator_traits<Iterator>::difference_type,
+                      typename iterator_traits<Iterator>::pointer,
+                      typename iterator_traits<Iterator>::reference>
+{
+protected:
+    Iterator current;
+public:
+    typedef Iterator                                            iterator_type;
+    typedef typename iterator_traits<Iterator>::difference_type difference_type;
+    typedef typename iterator_traits<Iterator>::reference       reference;
+    typedef typename iterator_traits<Iterator>::pointer         pointer;
+
+    reverse_iterator();
+    explicit reverse_iterator(Iterator x);
+    template <class U> reverse_iterator(const reverse_iterator<U>& u);
+    Iterator base() const;
+    reference operator*() const;
+    pointer   operator->() const;
+    reverse_iterator& operator++();
+    reverse_iterator  operator++(int);
+    reverse_iterator& operator--();
+    reverse_iterator  operator--(int);
+    reverse_iterator  operator+ (difference_type n) const;
+    reverse_iterator& operator+=(difference_type n);
+    reverse_iterator  operator- (difference_type n) const;
+    reverse_iterator& operator-=(difference_type n);
+    reference         operator[](difference_type n) const;
+};
+
+template <class Iterator1, class Iterator2>
+bool
+operator==(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
+
+template <class Iterator1, class Iterator2>
+bool
+operator<(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
+
+template <class Iterator1, class Iterator2>
+bool
+operator!=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
+
+template <class Iterator1, class Iterator2>
+bool
+operator>(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
+
+template <class Iterator1, class Iterator2>
+bool
+operator>=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
+
+template <class Iterator1, class Iterator2>
+bool
+operator<=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
+
+template <class Iterator1, class Iterator2>
+typename reverse_iterator<Iterator1>::difference_type
+operator-(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y);
+
+template <class Iterator>
+reverse_iterator<Iterator>
+operator+(typename reverse_iterator<Iterator>::difference_type n, const reverse_iterator<Iterator>& x);
+
+template <class Iterator> reverse_iterator<Iterator> make_reverse_iterator(Iterator i); // C++14
+
+template <class Container>
+class back_insert_iterator
+{
+protected:
+    Container* container;
+public:
+    typedef Container                   container_type;
+    typedef void                        value_type;
+    typedef void                        difference_type;
+    typedef back_insert_iterator<Cont>& reference;
+    typedef void                        pointer;
+
+    explicit back_insert_iterator(Container& x);
+    back_insert_iterator& operator=(const typename Container::value_type& value);
+    back_insert_iterator& operator*();
+    back_insert_iterator& operator++();
+    back_insert_iterator  operator++(int);
+};
+
+template <class Container> back_insert_iterator<Container> back_inserter(Container& x);
+
+template <class Container>
+class front_insert_iterator
+{
+protected:
+    Container* container;
+public:
+    typedef Container                    container_type;
+    typedef void                         value_type;
+    typedef void                         difference_type;
+    typedef front_insert_iterator<Cont>& reference;
+    typedef void                         pointer;
+
+    explicit front_insert_iterator(Container& x);
+    front_insert_iterator& operator=(const typename Container::value_type& value);
+    front_insert_iterator& operator*();
+    front_insert_iterator& operator++();
+    front_insert_iterator  operator++(int);
+};
+
+template <class Container> front_insert_iterator<Container> front_inserter(Container& x);
+
+template <class Container>
+class insert_iterator
+{
+protected:
+    Container* container;
+    typename Container::iterator iter;
+public:
+    typedef Container              container_type;
+    typedef void                   value_type;
+    typedef void                   difference_type;
+    typedef insert_iterator<Cont>& reference;
+    typedef void                   pointer;
+
+    insert_iterator(Container& x, typename Container::iterator i);
+    insert_iterator& operator=(const typename Container::value_type& value);
+    insert_iterator& operator*();
+    insert_iterator& operator++();
+    insert_iterator& operator++(int);
+};
+
+template <class Container, class Iterator>
+insert_iterator<Container> inserter(Container& x, Iterator i);
+
+template <class T, class charT = char, class traits = char_traits<charT>, class Distance = ptrdiff_t>
+class istream_iterator
+    : public iterator<input_iterator_tag, T, Distance, const T*, const T&>
+{
+public:
+    typedef charT char_type;
+    typedef traits traits_type;
+    typedef basic_istream<charT,traits> istream_type;
+
+    constexpr istream_iterator();
+    istream_iterator(istream_type& s);
+    istream_iterator(const istream_iterator& x);
+    ~istream_iterator();
+
+    const T& operator*() const;
+    const T* operator->() const;
+    istream_iterator& operator++();
+    istream_iterator  operator++(int);
+};
+
+template <class T, class charT, class traits, class Distance>
+bool operator==(const istream_iterator<T,charT,traits,Distance>& x,
+                const istream_iterator<T,charT,traits,Distance>& y);
+template <class T, class charT, class traits, class Distance>
+bool operator!=(const istream_iterator<T,charT,traits,Distance>& x,
+                const istream_iterator<T,charT,traits,Distance>& y);
+
+template <class T, class charT = char, class traits = char_traits<charT> >
+class ostream_iterator
+    : public iterator<output_iterator_tag, void, void, void ,void>
+{
+public:
+    typedef charT char_type;
+    typedef traits traits_type;
+    typedef basic_ostream<charT,traits> ostream_type;
+
+    ostream_iterator(ostream_type& s);
+    ostream_iterator(ostream_type& s, const charT* delimiter);
+    ostream_iterator(const ostream_iterator& x);
+    ~ostream_iterator();
+    ostream_iterator& operator=(const T& value);
+
+    ostream_iterator& operator*();
+    ostream_iterator& operator++();
+    ostream_iterator& operator++(int);
+};
+
+template<class charT, class traits = char_traits<charT> >
+class istreambuf_iterator
+    : public iterator<input_iterator_tag, charT,
+                      typename traits::off_type, unspecified,
+                      charT>
+{
+public:
+    typedef charT                         char_type;
+    typedef traits                        traits_type;
+    typedef typename traits::int_type     int_type;
+    typedef basic_streambuf<charT,traits> streambuf_type;
+    typedef basic_istream<charT,traits>   istream_type;
+
+    istreambuf_iterator() noexcept;
+    istreambuf_iterator(istream_type& s) noexcept;
+    istreambuf_iterator(streambuf_type* s) noexcept;
+    istreambuf_iterator(a-private-type) noexcept;
+
+    charT                operator*() const;
+    pointer operator->() const;
+    istreambuf_iterator& operator++();
+    a-private-type       operator++(int);
+
+    bool equal(const istreambuf_iterator& b) const;
+};
+
+template <class charT, class traits>
+bool operator==(const istreambuf_iterator<charT,traits>& a,
+                const istreambuf_iterator<charT,traits>& b);
+template <class charT, class traits>
+bool operator!=(const istreambuf_iterator<charT,traits>& a,
+                const istreambuf_iterator<charT,traits>& b);
+
+template <class charT, class traits = char_traits<charT> >
+class ostreambuf_iterator
+    : public iterator<output_iterator_tag, void, void, void, void>
+{
+public:
+    typedef charT                         char_type;
+    typedef traits                        traits_type;
+    typedef basic_streambuf<charT,traits> streambuf_type;
+    typedef basic_ostream<charT,traits>   ostream_type;
+
+    ostreambuf_iterator(ostream_type& s) noexcept;
+    ostreambuf_iterator(streambuf_type* s) noexcept;
+    ostreambuf_iterator& operator=(charT c);
+    ostreambuf_iterator& operator*();
+    ostreambuf_iterator& operator++();
+    ostreambuf_iterator& operator++(int);
+    bool failed() const noexcept;
+};
+
+template <class C> auto begin(C& c) -> decltype(c.begin());
+template <class C> auto begin(const C& c) -> decltype(c.begin());
+template <class C> auto end(C& c) -> decltype(c.end());
+template <class C> auto end(const C& c) -> decltype(c.end());
+template <class T, size_t N> T* begin(T (&array)[N]);
+template <class T, size_t N> T* end(T (&array)[N]);
+
+template <class C> auto cbegin(const C& c) -> decltype(std::begin(c));        // C++14
+template <class C> auto cend(const C& c) -> decltype(std::end(c));            // C++14
+template <class C> auto rbegin(C& c) -> decltype(c.rbegin());                 // C++14
+template <class C> auto rbegin(const C& c) -> decltype(c.rbegin());           // C++14
+template <class C> auto rend(C& c) -> decltype(c.rend());                     // C++14
+template <class C> auto rend(const C& c) -> decltype(c.rend());               // C++14
+template <class E> reverse_iterator<const E*> rbegin(initializer_list<E> il); // C++14
+template <class E> reverse_iterator<const E*> rend(initializer_list<E> il);   // C++14
+template <class T, size_t N> reverse_iterator<T*> rbegin(T (&array)[N]);      // C++14
+template <class T, size_t N> reverse_iterator<T*> rend(T (&array)[N]);        // C++14
+template <class C> auto crbegin(const C& c) -> decltype(std::rbegin(c));      // C++14
+template <class C> auto crend(const C& c) -> decltype(std::rend(c));          // C++14
+
+// 24.8, container access:
+template <class C> constexpr auto size(const C& c) -> decltype(c.size());         // C++17
+template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17
+template <class C> constexpr auto empty(const C& c) -> decltype(c.empty());       // C++17
+template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept;  // C++17
+template <class E> constexpr bool empty(initializer_list<E> il) noexcept;         // C++17
+template <class C> constexpr auto data(C& c) -> decltype(c.data());               // C++17
+template <class C> constexpr auto data(const C& c) -> decltype(c.data());         // C++17
+template <class T, size_t N> constexpr T* data(T (&array)[N]) noexcept;           // C++17
+template <class E> constexpr const E* data(initializer_list<E> il) noexcept;      // C++17
+
+}  // std
+
+*/
+
+#include <__config>
+#include <__functional_base>
+#include <type_traits>
+#include <cstddef>
+#include <iosfwd>
+#include <initializer_list>
+#ifdef __APPLE__
+#include <Availability.h>
+#endif
+
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+struct _LIBCPP_TYPE_VIS_ONLY input_iterator_tag {};
+struct _LIBCPP_TYPE_VIS_ONLY output_iterator_tag {};
+struct _LIBCPP_TYPE_VIS_ONLY forward_iterator_tag       : public input_iterator_tag {};
+struct _LIBCPP_TYPE_VIS_ONLY bidirectional_iterator_tag : public forward_iterator_tag {};
+struct _LIBCPP_TYPE_VIS_ONLY random_access_iterator_tag : public bidirectional_iterator_tag {};
+
+template <class _Tp>
+struct __has_iterator_category
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::iterator_category* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Iter, bool> struct __iterator_traits_impl {};
+
+template <class _Iter>
+struct __iterator_traits_impl<_Iter, true>
+{
+    typedef typename _Iter::difference_type   difference_type;
+    typedef typename _Iter::value_type        value_type;
+    typedef typename _Iter::pointer           pointer;
+    typedef typename _Iter::reference         reference;
+    typedef typename _Iter::iterator_category iterator_category;
+};
+
+template <class _Iter, bool> struct __iterator_traits {};
+
+template <class _Iter>
+struct __iterator_traits<_Iter, true>
+    :  __iterator_traits_impl
+      <
+        _Iter,
+        is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value ||
+        is_convertible<typename _Iter::iterator_category, output_iterator_tag>::value
+      >
+{};
+
+// iterator_traits<Iterator> will only have the nested types if Iterator::iterator_category
+//    exists.  Else iterator_traits<Iterator> will be an empty class.  This is a
+//    conforming extension which allows some programs to compile and behave as
+//    the client expects instead of failing at compile time.
+
+template <class _Iter>
+struct _LIBCPP_TYPE_VIS_ONLY iterator_traits
+    : __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
+
+template<class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY iterator_traits<_Tp*>
+{
+    typedef ptrdiff_t difference_type;
+    typedef typename remove_const<_Tp>::type value_type;
+    typedef _Tp* pointer;
+    typedef _Tp& reference;
+    typedef random_access_iterator_tag iterator_category;
+};
+
+template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value>
+struct __has_iterator_category_convertible_to
+    : public integral_constant<bool, is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up>::value>
+{};
+
+template <class _Tp, class _Up>
+struct __has_iterator_category_convertible_to<_Tp, _Up, false> : public false_type {};
+
+template <class _Tp>
+struct __is_input_iterator : public __has_iterator_category_convertible_to<_Tp, input_iterator_tag> {};
+
+template <class _Tp>
+struct __is_forward_iterator : public __has_iterator_category_convertible_to<_Tp, forward_iterator_tag> {};
+
+template <class _Tp>
+struct __is_bidirectional_iterator : public __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag> {};
+
+template <class _Tp>
+struct __is_random_access_iterator : public __has_iterator_category_convertible_to<_Tp, random_access_iterator_tag> {};
+
+template<class _Category, class _Tp, class _Distance = ptrdiff_t,
+         class _Pointer = _Tp*, class _Reference = _Tp&>
+struct _LIBCPP_TYPE_VIS_ONLY iterator
+{
+    typedef _Tp        value_type;
+    typedef _Distance  difference_type;
+    typedef _Pointer   pointer;
+    typedef _Reference reference;
+    typedef _Category  iterator_category;
+};
+
+template <class _InputIter>
+inline _LIBCPP_INLINE_VISIBILITY
+void __advance(_InputIter& __i,
+             typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag)
+{
+    for (; __n > 0; --__n)
+        ++__i;
+}
+
+template <class _BiDirIter>
+inline _LIBCPP_INLINE_VISIBILITY
+void __advance(_BiDirIter& __i,
+             typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag)
+{
+    if (__n >= 0)
+        for (; __n > 0; --__n)
+            ++__i;
+    else
+        for (; __n < 0; ++__n)
+            --__i;
+}
+
+template <class _RandIter>
+inline _LIBCPP_INLINE_VISIBILITY
+void __advance(_RandIter& __i,
+             typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag)
+{
+   __i += __n;
+}
+
+template <class _InputIter>
+inline _LIBCPP_INLINE_VISIBILITY
+void advance(_InputIter& __i,
+             typename iterator_traits<_InputIter>::difference_type __n)
+{
+    __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());
+}
+
+template <class _InputIter>
+inline _LIBCPP_INLINE_VISIBILITY
+typename iterator_traits<_InputIter>::difference_type
+__distance(_InputIter __first, _InputIter __last, input_iterator_tag)
+{
+    typename iterator_traits<_InputIter>::difference_type __r(0);
+    for (; __first != __last; ++__first)
+        ++__r;
+    return __r;
+}
+
+template <class _RandIter>
+inline _LIBCPP_INLINE_VISIBILITY
+typename iterator_traits<_RandIter>::difference_type
+__distance(_RandIter __first, _RandIter __last, random_access_iterator_tag)
+{
+    return __last - __first;
+}
+
+template <class _InputIter>
+inline _LIBCPP_INLINE_VISIBILITY
+typename iterator_traits<_InputIter>::difference_type
+distance(_InputIter __first, _InputIter __last)
+{
+    return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
+}
+
+template <class _ForwardIter>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIter
+next(_ForwardIter __x,
+     typename iterator_traits<_ForwardIter>::difference_type __n = 1,
+     typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
+{
+    _VSTD::advance(__x, __n);
+    return __x;
+}
+
+template <class _BidiretionalIter>
+inline _LIBCPP_INLINE_VISIBILITY
+_BidiretionalIter
+prev(_BidiretionalIter __x,
+     typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
+     typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
+{
+    _VSTD::advance(__x, -__n);
+    return __x;
+}
+
+template <class _Iter>
+class _LIBCPP_TYPE_VIS_ONLY reverse_iterator
+    : public iterator<typename iterator_traits<_Iter>::iterator_category,
+                      typename iterator_traits<_Iter>::value_type,
+                      typename iterator_traits<_Iter>::difference_type,
+                      typename iterator_traits<_Iter>::pointer,
+                      typename iterator_traits<_Iter>::reference>
+{
+private:
+    mutable _Iter __t;  // no longer used as of LWG #2360, not removed due to ABI break
+protected:
+    _Iter current;
+public:
+    typedef _Iter                                            iterator_type;
+    typedef typename iterator_traits<_Iter>::difference_type difference_type;
+    typedef typename iterator_traits<_Iter>::reference       reference;
+    typedef typename iterator_traits<_Iter>::pointer         pointer;
+
+    _LIBCPP_INLINE_VISIBILITY reverse_iterator() : current() {}
+    _LIBCPP_INLINE_VISIBILITY explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {}
+    template <class _Up> _LIBCPP_INLINE_VISIBILITY reverse_iterator(const reverse_iterator<_Up>& __u)
+        : __t(__u.base()), current(__u.base()) {}
+    _LIBCPP_INLINE_VISIBILITY _Iter base() const {return current;}
+    _LIBCPP_INLINE_VISIBILITY reference operator*() const {_Iter __tmp = current; return *--__tmp;}
+    _LIBCPP_INLINE_VISIBILITY pointer  operator->() const {return _VSTD::addressof(operator*());}
+    _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator++() {--current; return *this;}
+    _LIBCPP_INLINE_VISIBILITY reverse_iterator  operator++(int)
+        {reverse_iterator __tmp(*this); --current; return __tmp;}
+    _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator--() {++current; return *this;}
+    _LIBCPP_INLINE_VISIBILITY reverse_iterator  operator--(int)
+        {reverse_iterator __tmp(*this); ++current; return __tmp;}
+    _LIBCPP_INLINE_VISIBILITY reverse_iterator  operator+ (difference_type __n) const
+        {return reverse_iterator(current - __n);}
+    _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator+=(difference_type __n)
+        {current -= __n; return *this;}
+    _LIBCPP_INLINE_VISIBILITY reverse_iterator  operator- (difference_type __n) const
+        {return reverse_iterator(current + __n);}
+    _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator-=(difference_type __n)
+        {current += __n; return *this;}
+    _LIBCPP_INLINE_VISIBILITY reference         operator[](difference_type __n) const
+        {return *(*this + __n);}
+};
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
+{
+    return __x.base() == __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
+{
+    return __x.base() > __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
+{
+    return __x.base() != __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
+{
+    return __x.base() < __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
+{
+    return __x.base() <= __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
+{
+    return __x.base() >= __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename reverse_iterator<_Iter1>::difference_type
+operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
+{
+    return __y.base() - __x.base();
+}
+
+template <class _Iter>
+inline _LIBCPP_INLINE_VISIBILITY
+reverse_iterator<_Iter>
+operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x)
+{
+    return reverse_iterator<_Iter>(__x.base() - __n);
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _Iter>
+inline _LIBCPP_INLINE_VISIBILITY
+reverse_iterator<_Iter> make_reverse_iterator(_Iter __i)
+{
+    return reverse_iterator<_Iter>(__i);
+}
+#endif
+
+template <class _Container>
+class _LIBCPP_TYPE_VIS_ONLY back_insert_iterator
+    : public iterator<output_iterator_tag,
+                      void,
+                      void,
+                      void,
+                      back_insert_iterator<_Container>&>
+{
+protected:
+    _Container* container;
+public:
+    typedef _Container container_type;
+
+    _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {}
+    _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_)
+        {container->push_back(__value_); return *this;}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_)
+        {container->push_back(_VSTD::move(__value_)); return *this;}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*()     {return *this;}
+    _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++()    {return *this;}
+    _LIBCPP_INLINE_VISIBILITY back_insert_iterator  operator++(int) {return *this;}
+};
+
+template <class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+back_insert_iterator<_Container>
+back_inserter(_Container& __x)
+{
+    return back_insert_iterator<_Container>(__x);
+}
+
+template <class _Container>
+class _LIBCPP_TYPE_VIS_ONLY front_insert_iterator
+    : public iterator<output_iterator_tag,
+                      void,
+                      void,
+                      void,
+                      front_insert_iterator<_Container>&>
+{
+protected:
+    _Container* container;
+public:
+    typedef _Container container_type;
+
+    _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {}
+    _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_)
+        {container->push_front(__value_); return *this;}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_)
+        {container->push_front(_VSTD::move(__value_)); return *this;}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*()     {return *this;}
+    _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++()    {return *this;}
+    _LIBCPP_INLINE_VISIBILITY front_insert_iterator  operator++(int) {return *this;}
+};
+
+template <class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+front_insert_iterator<_Container>
+front_inserter(_Container& __x)
+{
+    return front_insert_iterator<_Container>(__x);
+}
+
+template <class _Container>
+class _LIBCPP_TYPE_VIS_ONLY insert_iterator
+    : public iterator<output_iterator_tag,
+                      void,
+                      void,
+                      void,
+                      insert_iterator<_Container>&>
+{
+protected:
+    _Container* container;
+    typename _Container::iterator iter;
+public:
+    typedef _Container container_type;
+
+    _LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
+        : container(_VSTD::addressof(__x)), iter(__i) {}
+    _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_)
+        {iter = container->insert(iter, __value_); ++iter; return *this;}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_)
+        {iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*()        {return *this;}
+    _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++()       {return *this;}
+    _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int)    {return *this;}
+};
+
+template <class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+insert_iterator<_Container>
+inserter(_Container& __x, typename _Container::iterator __i)
+{
+    return insert_iterator<_Container>(__x, __i);
+}
+
+template <class _Tp, class _CharT = char,
+          class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
+class _LIBCPP_TYPE_VIS_ONLY istream_iterator
+    : public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
+{
+public:
+    typedef _CharT char_type;
+    typedef _Traits traits_type;
+    typedef basic_istream<_CharT,_Traits> istream_type;
+private:
+    istream_type* __in_stream_;
+    _Tp __value_;
+public:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(0), __value_() {}
+    _LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(&__s)
+        {
+            if (!(*__in_stream_ >> __value_))
+                __in_stream_ = 0;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY const _Tp& operator*() const {return __value_;}
+    _LIBCPP_INLINE_VISIBILITY const _Tp* operator->() const {return &(operator*());}
+    _LIBCPP_INLINE_VISIBILITY istream_iterator& operator++()
+        {
+            if (!(*__in_stream_ >> __value_))
+                __in_stream_ = 0;
+            return *this;
+        }
+    _LIBCPP_INLINE_VISIBILITY istream_iterator  operator++(int)
+        {istream_iterator __t(*this); ++(*this); return __t;}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const istream_iterator& __x, const istream_iterator& __y)
+        {return __x.__in_stream_ == __y.__in_stream_;}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const istream_iterator& __x, const istream_iterator& __y)
+        {return !(__x == __y);}
+};
+
+template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY ostream_iterator
+    : public iterator<output_iterator_tag, void, void, void, void>
+{
+public:
+    typedef _CharT char_type;
+    typedef _Traits traits_type;
+    typedef basic_ostream<_CharT,_Traits> ostream_type;
+private:
+    ostream_type* __out_stream_;
+    const char_type* __delim_;
+public:
+    _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s)
+        : __out_stream_(&__s), __delim_(0) {}
+    _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter)
+        : __out_stream_(&__s), __delim_(__delimiter) {}
+    _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_)
+        {
+            *__out_stream_ << __value_;
+            if (__delim_)
+                *__out_stream_ << __delim_;
+            return *this;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator*()     {return *this;}
+    _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator++()    {return *this;}
+    _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator++(int) {return *this;}
+};
+
+template<class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator
+    : public iterator<input_iterator_tag, _CharT,
+                      typename _Traits::off_type, _CharT*,
+                      _CharT>
+{
+public:
+    typedef _CharT                          char_type;
+    typedef _Traits                         traits_type;
+    typedef typename _Traits::int_type      int_type;
+    typedef basic_streambuf<_CharT,_Traits> streambuf_type;
+    typedef basic_istream<_CharT,_Traits>   istream_type;
+private:
+    mutable streambuf_type* __sbuf_;
+
+    class __proxy
+    {
+        char_type __keep_;
+        streambuf_type* __sbuf_;
+        _LIBCPP_INLINE_VISIBILITY __proxy(char_type __c, streambuf_type* __s)
+            : __keep_(__c), __sbuf_(__s) {}
+        friend class istreambuf_iterator;
+    public:
+        _LIBCPP_INLINE_VISIBILITY char_type operator*() const {return __keep_;}
+    };
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool __test_for_eof() const
+    {
+        if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
+            __sbuf_ = 0;
+        return __sbuf_ == 0;
+    }
+public:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {}
+    _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT
+        : __sbuf_(__s.rdbuf()) {}
+    _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT
+        : __sbuf_(__s) {}
+    _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT
+        : __sbuf_(__p.__sbuf_) {}
+
+    _LIBCPP_INLINE_VISIBILITY char_type  operator*() const
+        {return static_cast<char_type>(__sbuf_->sgetc());}
+    _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
+    _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
+        {
+            __sbuf_->sbumpc();
+            return *this;
+        }
+    _LIBCPP_INLINE_VISIBILITY __proxy              operator++(int)
+        {
+            return __proxy(__sbuf_->sbumpc(), __sbuf_);
+        }
+
+    _LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const
+        {return __test_for_eof() == __b.__test_for_eof();}
+};
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator==(const istreambuf_iterator<_CharT,_Traits>& __a,
+                const istreambuf_iterator<_CharT,_Traits>& __b)
+                {return __a.equal(__b);}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
+                const istreambuf_iterator<_CharT,_Traits>& __b)
+                {return !__a.equal(__b);}
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator
+    : public iterator<output_iterator_tag, void, void, void, void>
+{
+public:
+    typedef _CharT                          char_type;
+    typedef _Traits                         traits_type;
+    typedef basic_streambuf<_CharT,_Traits> streambuf_type;
+    typedef basic_ostream<_CharT,_Traits>   ostream_type;
+private:
+    streambuf_type* __sbuf_;
+public:
+    _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) _NOEXCEPT
+        : __sbuf_(__s.rdbuf()) {}
+    _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT
+        : __sbuf_(__s) {}
+    _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c)
+        {
+            if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof()))
+                __sbuf_ = 0;
+            return *this;
+        }
+    _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*()     {return *this;}
+    _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++()    {return *this;}
+    _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
+    _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}
+
+#if !defined(__APPLE__) || \
+    (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
+    (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
+
+    template <class _Ch, class _Tr>
+    friend
+    _LIBCPP_HIDDEN
+    ostreambuf_iterator<_Ch, _Tr>
+    __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
+                     const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
+                     ios_base& __iob, _Ch __fl);
+#endif
+};
+
+template <class _Iter>
+class _LIBCPP_TYPE_VIS_ONLY move_iterator
+{
+private:
+    _Iter __i;
+public:
+    typedef _Iter                                            iterator_type;
+    typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
+    typedef typename iterator_traits<iterator_type>::value_type value_type;
+    typedef typename iterator_traits<iterator_type>::difference_type difference_type;
+    typedef typename iterator_traits<iterator_type>::pointer pointer;
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    typedef value_type&& reference;
+#else
+    typedef typename iterator_traits<iterator_type>::reference reference;
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY move_iterator() : __i() {}
+    _LIBCPP_INLINE_VISIBILITY explicit move_iterator(_Iter __x) : __i(__x) {}
+    template <class _Up> _LIBCPP_INLINE_VISIBILITY move_iterator(const move_iterator<_Up>& __u)
+        : __i(__u.base()) {}
+    _LIBCPP_INLINE_VISIBILITY _Iter base() const {return __i;}
+    _LIBCPP_INLINE_VISIBILITY reference operator*() const {
+      return static_cast<reference>(*__i);
+    }
+    _LIBCPP_INLINE_VISIBILITY pointer  operator->() const {
+      typename iterator_traits<iterator_type>::reference __ref = *__i;
+      return &__ref;
+    }
+    _LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;}
+    _LIBCPP_INLINE_VISIBILITY move_iterator  operator++(int)
+        {move_iterator __tmp(*this); ++__i; return __tmp;}
+    _LIBCPP_INLINE_VISIBILITY move_iterator& operator--() {--__i; return *this;}
+    _LIBCPP_INLINE_VISIBILITY move_iterator  operator--(int)
+        {move_iterator __tmp(*this); --__i; return __tmp;}
+    _LIBCPP_INLINE_VISIBILITY move_iterator  operator+ (difference_type __n) const
+        {return move_iterator(__i + __n);}
+    _LIBCPP_INLINE_VISIBILITY move_iterator& operator+=(difference_type __n)
+        {__i += __n; return *this;}
+    _LIBCPP_INLINE_VISIBILITY move_iterator  operator- (difference_type __n) const
+        {return move_iterator(__i - __n);}
+    _LIBCPP_INLINE_VISIBILITY move_iterator& operator-=(difference_type __n)
+        {__i -= __n; return *this;}
+    _LIBCPP_INLINE_VISIBILITY reference         operator[](difference_type __n) const
+    {
+      return static_cast<reference>(__i[__n]);
+    }
+};
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+{
+    return __x.base() == __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+{
+    return __x.base() < __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+{
+    return __x.base() != __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+{
+    return __x.base() > __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+{
+    return __x.base() >= __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+{
+    return __x.base() <= __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename move_iterator<_Iter1>::difference_type
+operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+{
+    return __x.base() - __y.base();
+}
+
+template <class _Iter>
+inline _LIBCPP_INLINE_VISIBILITY
+move_iterator<_Iter>
+operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x)
+{
+    return move_iterator<_Iter>(__x.base() + __n);
+}
+
+template <class _Iter>
+inline _LIBCPP_INLINE_VISIBILITY
+move_iterator<_Iter>
+make_move_iterator(_Iter __i)
+{
+    return move_iterator<_Iter>(__i);
+}
+
+// __wrap_iter
+
+template <class _Iter> class __wrap_iter;
+
+template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
+typename __wrap_iter<_Iter1>::difference_type
+operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+template <class _Iter>
+_LIBCPP_INLINE_VISIBILITY
+__wrap_iter<_Iter>
+operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
+
+template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
+template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
+template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
+template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
+
+template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_trivially_copy_assignable<_Tp>::value,
+    _Tp*
+>::type
+__unwrap_iter(__wrap_iter<_Tp*>);
+
+template <class _Iter>
+class __wrap_iter
+{
+public:
+    typedef _Iter                                                      iterator_type;
+    typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
+    typedef typename iterator_traits<iterator_type>::value_type        value_type;
+    typedef typename iterator_traits<iterator_type>::difference_type   difference_type;
+    typedef typename iterator_traits<iterator_type>::pointer           pointer;
+    typedef typename iterator_traits<iterator_type>::reference         reference;
+private:
+    iterator_type __i;
+public:
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+                : __i{}
+#endif
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__insert_i(this);
+#endif
+    }
+    template <class _Up> _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u,
+        typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT
+        : __i(__u.base())
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__iterator_copy(this, &__u);
+#endif
+    }
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    __wrap_iter(const __wrap_iter& __x)
+        : __i(__x.base())
+    {
+        __get_db()->__iterator_copy(this, &__x);
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __wrap_iter& operator=(const __wrap_iter& __x)
+    {
+        if (this != &__x)
+        {
+            __get_db()->__iterator_copy(this, &__x);
+            __i = __x.__i;
+        }
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    ~__wrap_iter()
+    {
+        __get_db()->__erase_i(this);
+    }
+#endif
+    _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to dereference a non-dereferenceable iterator");
+#endif
+        return *__i;
+    }
+    _LIBCPP_INLINE_VISIBILITY pointer  operator->() const _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to dereference a non-dereferenceable iterator");
+#endif
+        return (pointer)&reinterpret_cast<const volatile char&>(*__i);
+    }
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to increment non-incrementable iterator");
+#endif
+        ++__i;
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter  operator++(int) _NOEXCEPT
+        {__wrap_iter __tmp(*this); ++(*this); return __tmp;}
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
+                       "Attempted to decrement non-decrementable iterator");
+#endif
+        --__i;
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter  operator--(int) _NOEXCEPT
+        {__wrap_iter __tmp(*this); --(*this); return __tmp;}
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter  operator+ (difference_type __n) const _NOEXCEPT
+        {__wrap_iter __w(*this); __w += __n; return __w;}
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
+                   "Attempted to add/subtract iterator outside of valid range");
+#endif
+        __i += __n;
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter  operator- (difference_type __n) const _NOEXCEPT
+        {return *this + (-__n);}
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
+        {*this += -__n; return *this;}
+    _LIBCPP_INLINE_VISIBILITY reference        operator[](difference_type __n) const _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
+                   "Attempted to subscript iterator outside of valid range");
+#endif
+        return __i[__n];
+    }
+
+    _LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;}
+
+private:
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
+    {
+        __get_db()->__insert_ic(this, __p);
+    }
+#else
+    _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
+#endif
+
+    template <class _Up> friend class __wrap_iter;
+    template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
+    template <class _Tp, class _Alloc> friend class _LIBCPP_TYPE_VIS_ONLY vector;
+
+    template <class _Iter1, class _Iter2>
+    friend
+    bool
+    operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+    template <class _Iter1, class _Iter2>
+    friend
+    bool
+    operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+    template <class _Iter1, class _Iter2>
+    friend
+    bool
+    operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+    template <class _Iter1, class _Iter2>
+    friend
+    bool
+    operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+    template <class _Iter1, class _Iter2>
+    friend
+    bool
+    operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+    template <class _Iter1, class _Iter2>
+    friend
+    bool
+    operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+    template <class _Iter1, class _Iter2>
+    friend
+    typename __wrap_iter<_Iter1>::difference_type
+    operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
+
+    template <class _Iter1>
+    friend
+    __wrap_iter<_Iter1>
+    operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
+
+    template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op);
+    template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
+    template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op);
+    template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2);
+
+    template <class _Tp>
+    friend
+    typename enable_if
+    <
+        is_trivially_copy_assignable<_Tp>::value,
+        _Tp*
+    >::type
+    __unwrap_iter(__wrap_iter<_Tp*>);
+};
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+{
+    return __x.base() == __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
+                   "Attempted to compare incomparable iterators");
+#endif
+    return __x.base() < __y.base();
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+{
+    return !(__x == __y);
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+{
+    return __y < __x;
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+{
+    return !(__x < __y);
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+{
+    return !(__y < __x);
+}
+
+template <class _Iter1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
+{
+    return !(__x == __y);
+}
+
+template <class _Iter1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
+{
+    return __y < __x;
+}
+
+template <class _Iter1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
+{
+    return !(__x < __y);
+}
+
+template <class _Iter1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
+{
+    return !(__y < __x);
+}
+
+template <class _Iter1, class _Iter2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __wrap_iter<_Iter1>::difference_type
+operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
+                   "Attempted to subtract incompatible iterators");
+#endif
+    return __x.base() - __y.base();
+}
+
+template <class _Iter>
+inline _LIBCPP_INLINE_VISIBILITY
+__wrap_iter<_Iter>
+operator+(typename __wrap_iter<_Iter>::difference_type __n,
+          __wrap_iter<_Iter> __x) _NOEXCEPT
+{
+    __x += __n;
+    return __x;
+}
+
+template <class _Tp, size_t _Np>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp*
+begin(_Tp (&__array)[_Np])
+{
+    return __array;
+}
+
+template <class _Tp, size_t _Np>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp*
+end(_Tp (&__array)[_Np])
+{
+    return __array + _Np;
+}
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+auto
+begin(_Cp& __c) -> decltype(__c.begin())
+{
+    return __c.begin();
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+auto
+begin(const _Cp& __c) -> decltype(__c.begin())
+{
+    return __c.begin();
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+auto
+end(_Cp& __c) -> decltype(__c.end())
+{
+    return __c.end();
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+auto
+end(const _Cp& __c) -> decltype(__c.end())
+{
+    return __c.end();
+}
+
+#if _LIBCPP_STD_VER > 11
+
+template <class _Tp, size_t _Np>
+inline _LIBCPP_INLINE_VISIBILITY
+reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
+{
+    return reverse_iterator<_Tp*>(__array + _Np);
+}
+
+template <class _Tp, size_t _Np>
+inline _LIBCPP_INLINE_VISIBILITY
+reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
+{
+    return reverse_iterator<_Tp*>(__array);
+}
+
+template <class _Ep>
+inline _LIBCPP_INLINE_VISIBILITY
+reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
+{
+    return reverse_iterator<const _Ep*>(__il.end());
+}
+
+template <class _Ep>
+inline _LIBCPP_INLINE_VISIBILITY
+reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
+{
+    return reverse_iterator<const _Ep*>(__il.begin());
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+auto cbegin(const _Cp& __c) -> decltype(begin(__c))
+{
+    return begin(__c);
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+auto cend(const _Cp& __c) -> decltype(end(__c))
+{
+    return end(__c);
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
+{
+    return __c.rbegin();
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
+{
+    return __c.rbegin();
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+auto rend(_Cp& __c) -> decltype(__c.rend())
+{
+    return __c.rend();
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+auto rend(const _Cp& __c) -> decltype(__c.rend())
+{
+    return __c.rend();
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+auto crbegin(const _Cp& __c) -> decltype(rbegin(__c))
+{
+    return rbegin(__c);
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+auto crend(const _Cp& __c) -> decltype(rend(__c))
+{
+    return rend(__c);
+}
+
+#endif
+
+
+#else  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename _Cp::iterator
+begin(_Cp& __c)
+{
+    return __c.begin();
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename _Cp::const_iterator
+begin(const _Cp& __c)
+{
+    return __c.begin();
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename _Cp::iterator
+end(_Cp& __c)
+{
+    return __c.end();
+}
+
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename _Cp::const_iterator
+end(const _Cp& __c)
+{
+    return __c.end();
+}
+
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
+
+#if _LIBCPP_STD_VER > 14
+template <class _Cont>
+constexpr auto size(const _Cont& __c) -> decltype(__c.size()) { return __c.size(); }
+
+template <class _Tp, size_t _Sz>
+constexpr size_t size(const _Tp (&__array)[_Sz]) noexcept { return _Sz; }
+
+template <class _Cont>
+constexpr auto empty(const _Cont& __c) -> decltype(__c.empty()) { return __c.empty(); }
+
+template <class _Tp, size_t _Sz>
+constexpr bool empty(const _Tp (&__array)[_Sz]) noexcept { return false; }
+
+template <class _Ep>
+constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }
+
+template <class _Cont> constexpr
+auto data(_Cont& __c) -> decltype(__c.data()) { return __c.data(); }
+
+template <class _Cont> constexpr
+auto data(const _Cont& __c) -> decltype(__c.data()) { return __c.data(); }
+
+template <class _Tp, size_t _Sz>
+constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; }
+
+template <class _Ep>
+constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
+#endif
+
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_ITERATOR

Property changes on: lab4/.minix-src/include/c++/iterator
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/iomanip
===================================================================
--- lab4/.minix-src/include/c++/iomanip	(nonexistent)
+++ lab4/.minix-src/include/c++/iomanip	(revision 13)
@@ -0,0 +1,654 @@
+// -*- C++ -*-
+//===--------------------------- iomanip ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_IOMANIP
+#define _LIBCPP_IOMANIP
+
+/*
+    iomanip synopsis
+
+namespace std {
+
+// types T1, T2, ... are unspecified implementation types
+T1 resetiosflags(ios_base::fmtflags mask);
+T2 setiosflags (ios_base::fmtflags mask);
+T3 setbase(int base);
+template<charT> T4 setfill(charT c);
+T5 setprecision(int n);
+T6 setw(int n);
+template <class moneyT> T7 get_money(moneyT& mon, bool intl = false);
+template <class charT, class moneyT> T8 put_money(const moneyT& mon, bool intl = false);
+template <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
+template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
+
+template <class charT>
+  T11 quoted(const charT* s, charT delim=charT('"'), charT escape=charT('\\')); // C++14
+
+template <class charT, class traits, class Allocator>
+  T12 quoted(const basic_string<charT, traits, Allocator>& s,
+             charT delim=charT('"'), charT escape=charT('\\')); // C++14
+
+template <class charT, class traits, class Allocator>
+  T13 quoted(basic_string<charT, traits, Allocator>& s,
+             charT delim=charT('"'), charT escape=charT('\\')); // C++14
+
+}  // std
+
+*/
+
+#include <__config>
+#include <istream>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// resetiosflags
+
+class __iom_t1
+{
+    ios_base::fmtflags __mask_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
+
+    template <class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x)
+    {
+        __is.unsetf(__x.__mask_);
+        return __is;
+    }
+
+    template <class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x)
+    {
+        __os.unsetf(__x.__mask_);
+        return __os;
+    }
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+__iom_t1
+resetiosflags(ios_base::fmtflags __mask)
+{
+    return __iom_t1(__mask);
+}
+
+// setiosflags
+
+class __iom_t2
+{
+    ios_base::fmtflags __mask_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
+
+    template <class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x)
+    {
+        __is.setf(__x.__mask_);
+        return __is;
+    }
+
+    template <class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x)
+    {
+        __os.setf(__x.__mask_);
+        return __os;
+    }
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+__iom_t2
+setiosflags(ios_base::fmtflags __mask)
+{
+    return __iom_t2(__mask);
+}
+
+// setbase
+
+class __iom_t3
+{
+    int __base_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __iom_t3(int __b) : __base_(__b) {}
+
+    template <class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x)
+    {
+        __is.setf(__x.__base_ == 8  ? ios_base::oct :
+                  __x.__base_ == 10 ? ios_base::dec :
+                  __x.__base_ == 16 ? ios_base::hex :
+                  ios_base::fmtflags(0), ios_base::basefield);
+        return __is;
+    }
+
+    template <class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x)
+    {
+        __os.setf(__x.__base_ == 8  ? ios_base::oct :
+                  __x.__base_ == 10 ? ios_base::dec :
+                  __x.__base_ == 16 ? ios_base::hex :
+                  ios_base::fmtflags(0), ios_base::basefield);
+        return __os;
+    }
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+__iom_t3
+setbase(int __base)
+{
+    return __iom_t3(__base);
+}
+
+// setfill
+
+template<class _CharT>
+class __iom_t4
+{
+    _CharT __fill_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __iom_t4(_CharT __c) : __fill_(__c) {}
+
+    template <class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x)
+    {
+        __os.fill(__x.__fill_);
+        return __os;
+    }
+};
+
+template<class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+__iom_t4<_CharT>
+setfill(_CharT __c)
+{
+    return __iom_t4<_CharT>(__c);
+}
+
+// setprecision
+
+class __iom_t5
+{
+    int __n_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __iom_t5(int __n) : __n_(__n) {}
+
+    template <class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x)
+    {
+        __is.precision(__x.__n_);
+        return __is;
+    }
+
+    template <class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x)
+    {
+        __os.precision(__x.__n_);
+        return __os;
+    }
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+__iom_t5
+setprecision(int __n)
+{
+    return __iom_t5(__n);
+}
+
+// setw
+
+class __iom_t6
+{
+    int __n_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __iom_t6(int __n) : __n_(__n) {}
+
+    template <class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x)
+    {
+        __is.width(__x.__n_);
+        return __is;
+    }
+
+    template <class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x)
+    {
+        __os.width(__x.__n_);
+        return __os;
+    }
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+__iom_t6
+setw(int __n)
+{
+    return __iom_t6(__n);
+}
+
+// get_money
+
+template <class _MoneyT> class __iom_t7;
+
+template <class _CharT, class _Traits, class _MoneyT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x);
+
+template <class _MoneyT>
+class __iom_t7
+{
+    _MoneyT& __mon_;
+    bool __intl_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __iom_t7(_MoneyT& __mon, bool __intl)
+        : __mon_(__mon), __intl_(__intl) {}
+
+    template <class _CharT, class _Traits, class _Mp>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
+};
+
+template <class _CharT, class _Traits, class _MoneyT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+        if (__s)
+        {
+            typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+            typedef money_get<_CharT, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            const _Fp& __mf = use_facet<_Fp>(__is.getloc());
+            __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
+            __is.setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __is.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __is;
+}
+
+template <class _MoneyT>
+inline _LIBCPP_INLINE_VISIBILITY
+__iom_t7<_MoneyT>
+get_money(_MoneyT& __mon, bool __intl = false)
+{
+    return __iom_t7<_MoneyT>(__mon, __intl);
+}
+
+// put_money
+
+template <class _MoneyT> class __iom_t8;
+
+template <class _CharT, class _Traits, class _MoneyT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x);
+
+template <class _MoneyT>
+class __iom_t8
+{
+    const _MoneyT& __mon_;
+    bool __intl_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __iom_t8(const _MoneyT& __mon, bool __intl)
+        : __mon_(__mon), __intl_(__intl) {}
+
+    template <class _CharT, class _Traits, class _Mp>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
+};
+
+template <class _CharT, class _Traits, class _MoneyT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+        if (__s)
+        {
+            typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+            typedef money_put<_CharT, _Op> _Fp;
+            const _Fp& __mf = use_facet<_Fp>(__os.getloc());
+            if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
+                __os.setstate(ios_base::badbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __os.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __os;
+}
+
+template <class _MoneyT>
+inline _LIBCPP_INLINE_VISIBILITY
+__iom_t8<_MoneyT>
+put_money(const _MoneyT& __mon, bool __intl = false)
+{
+    return __iom_t8<_MoneyT>(__mon, __intl);
+}
+
+// get_time
+
+template <class _CharT> class __iom_t9;
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x);
+
+template <class _CharT>
+class __iom_t9
+{
+    tm* __tm_;
+    const _CharT* __fmt_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __iom_t9(tm* __tm, const _CharT* __fmt)
+        : __tm_(__tm), __fmt_(__fmt) {}
+
+    template <class _Cp, class _Traits>
+    friend
+    basic_istream<_Cp, _Traits>&
+    operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
+};
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+        if (__s)
+        {
+            typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+            typedef time_get<_CharT, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            const _Fp& __tf = use_facet<_Fp>(__is.getloc());
+            __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
+                     __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
+            __is.setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __is.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __is;
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+__iom_t9<_CharT>
+get_time(tm* __tm, const _CharT* __fmt)
+{
+    return __iom_t9<_CharT>(__tm, __fmt);
+}
+
+// put_time
+
+template <class _CharT> class __iom_t10;
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x);
+
+template <class _CharT>
+class __iom_t10
+{
+    const tm* __tm_;
+    const _CharT* __fmt_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __iom_t10(const tm* __tm, const _CharT* __fmt)
+        : __tm_(__tm), __fmt_(__fmt) {}
+
+    template <class _Cp, class _Traits>
+    friend
+    basic_ostream<_Cp, _Traits>&
+    operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
+};
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+        if (__s)
+        {
+            typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+            typedef time_put<_CharT, _Op> _Fp;
+            const _Fp& __tf = use_facet<_Fp>(__os.getloc());
+            if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
+                         __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
+                __os.setstate(ios_base::badbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __os.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __os;
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+__iom_t10<_CharT>
+put_time(const tm* __tm, const _CharT* __fmt)
+{
+    return __iom_t10<_CharT>(__tm, __fmt);
+}
+
+#if _LIBCPP_STD_VER > 11
+
+template <class _CharT, class _Traits, class _ForwardIterator>
+std::basic_ostream<_CharT, _Traits> &
+__quoted_output ( basic_ostream<_CharT, _Traits> &__os, 
+        _ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
+{
+    _VSTD::basic_string<_CharT, _Traits> __str;
+    __str.push_back(__delim);
+    for ( ; __first != __last; ++ __first )
+    {
+        if (_Traits::eq (*__first, __escape) || _Traits::eq (*__first, __delim))
+            __str.push_back(__escape);
+        __str.push_back(*__first);
+    }
+    __str.push_back(__delim);
+    return __put_character_sequence(__os, __str.data(), __str.size());
+}
+
+template <class _CharT, class _Traits, class _String>
+basic_istream<_CharT, _Traits> &
+__quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _CharT __delim, _CharT __escape )
+{
+    __string.clear ();
+    _CharT __c;
+    __is >> __c;
+    if ( __is.fail ())
+        return __is;
+
+    if (!_Traits::eq (__c, __delim))    // no delimiter, read the whole string
+    {
+        __is.unget ();
+        __is >> __string;
+        return __is;
+    }
+
+    __save_flags<_CharT, _Traits> sf(__is);
+    noskipws (__is);
+    while (true)
+        {
+        __is >> __c;
+        if ( __is.fail ())
+            break;
+        if (_Traits::eq (__c, __escape))
+        {
+            __is >> __c;
+            if ( __is.fail ())
+                break;
+        }
+        else if (_Traits::eq (__c, __delim))
+            break;
+        __string.push_back ( __c );
+        }
+    return __is;
+}
+
+
+template <class _CharT, class _Iter, class _Traits=char_traits<_CharT>>
+struct __quoted_output_proxy
+{
+    _Iter  __first;
+    _Iter  __last;
+    _CharT  __delim;
+    _CharT  __escape;
+
+    __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e)
+    : __first(__f), __last(__l), __delim(__d), __escape(__e) {}
+    //  This would be a nice place for a string_ref 
+};
+
+template <class _CharT, class _Traits, class _Iter>
+basic_ostream<_CharT, _Traits>& operator<<(
+         basic_ostream<_CharT, _Traits>& __os, 
+         const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy)
+{
+    return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+struct __quoted_proxy
+{
+    basic_string<_CharT, _Traits, _Allocator> &__string;
+    _CharT  __delim;
+    _CharT  __escape;
+
+    __quoted_proxy(basic_string<_CharT, _Traits, _Allocator> &__s, _CharT __d, _CharT __e)
+    : __string(__s), __delim(__d), __escape(__e) {}
+};
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>& operator<<(
+        basic_ostream<_CharT, _Traits>& __os, 
+        const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
+{
+    return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape);
+}
+
+//  extractor for non-const basic_string& proxies
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>& operator>>(
+        basic_istream<_CharT, _Traits>& __is, 
+        const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
+{
+    return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape );
+}
+
+
+template <class _CharT>
+_LIBCPP_INLINE_VISIBILITY
+__quoted_output_proxy<_CharT, const _CharT *>
+quoted ( const _CharT *__s, _CharT __delim = _CharT('"'), _CharT __escape =_CharT('\\'))
+{
+    const _CharT *__end = __s;
+    while ( *__end ) ++__end;
+    return __quoted_output_proxy<_CharT, const _CharT *> ( __s, __end, __delim, __escape );
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_INLINE_VISIBILITY
+__quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
+quoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
+{
+    return __quoted_output_proxy<_CharT, 
+            typename basic_string <_CharT, _Traits, _Allocator>::const_iterator> 
+                    ( __s.cbegin(), __s.cend (), __delim, __escape );
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+__quoted_proxy<_CharT, _Traits, _Allocator>
+quoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
+{
+    return __quoted_proxy<_CharT, _Traits, _Allocator>( __s, __delim, __escape );
+}
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_IOMANIP

Property changes on: lab4/.minix-src/include/c++/iomanip
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/iostream
===================================================================
--- lab4/.minix-src/include/c++/iostream	(nonexistent)
+++ lab4/.minix-src/include/c++/iostream	(revision 13)
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+//===--------------------------- iostream ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_IOSTREAM
+#define _LIBCPP_IOSTREAM
+
+/*
+    iostream synopsis
+
+#include <ios>
+#include <streambuf>
+#include <istream>
+#include <ostream>
+
+namespace std {
+
+extern istream cin;
+extern ostream cout;
+extern ostream cerr;
+extern ostream clog;
+extern wistream wcin;
+extern wostream wcout;
+extern wostream wcerr;
+extern wostream wclog;
+
+}  // std
+
+*/
+
+#include <__config>
+#include <ios>
+#include <streambuf>
+#include <istream>
+#include <ostream>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifndef _LIBCPP_HAS_NO_STDIN
+extern _LIBCPP_FUNC_VIS istream cin;
+extern _LIBCPP_FUNC_VIS wistream wcin;
+#endif
+#ifndef _LIBCPP_HAS_NO_STDOUT
+extern _LIBCPP_FUNC_VIS ostream cout;
+extern _LIBCPP_FUNC_VIS wostream wcout;
+#endif
+extern _LIBCPP_FUNC_VIS ostream cerr;
+extern _LIBCPP_FUNC_VIS wostream wcerr;
+extern _LIBCPP_FUNC_VIS ostream clog;
+extern _LIBCPP_FUNC_VIS wostream wclog;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_IOSTREAM

Property changes on: lab4/.minix-src/include/c++/iostream
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/limits
===================================================================
--- lab4/.minix-src/include/c++/limits	(nonexistent)
+++ lab4/.minix-src/include/c++/limits	(revision 13)
@@ -0,0 +1,813 @@
+// -*- C++ -*-
+//===---------------------------- limits ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_LIMITS
+#define _LIBCPP_LIMITS
+
+/*
+    limits synopsis
+
+namespace std
+{
+
+template<class T>
+class numeric_limits
+{
+public:
+    static constexpr bool is_specialized = false;
+    static constexpr T min() noexcept;
+    static constexpr T max() noexcept;
+    static constexpr T lowest() noexcept;
+
+    static constexpr int  digits = 0;
+    static constexpr int  digits10 = 0;
+    static constexpr int  max_digits10 = 0;
+    static constexpr bool is_signed = false;
+    static constexpr bool is_integer = false;
+    static constexpr bool is_exact = false;
+    static constexpr int  radix = 0;
+    static constexpr T epsilon() noexcept;
+    static constexpr T round_error() noexcept;
+
+    static constexpr int  min_exponent = 0;
+    static constexpr int  min_exponent10 = 0;
+    static constexpr int  max_exponent = 0;
+    static constexpr int  max_exponent10 = 0;
+
+    static constexpr bool has_infinity = false;
+    static constexpr bool has_quiet_NaN = false;
+    static constexpr bool has_signaling_NaN = false;
+    static constexpr float_denorm_style has_denorm = denorm_absent;
+    static constexpr bool has_denorm_loss = false;
+    static constexpr T infinity() noexcept;
+    static constexpr T quiet_NaN() noexcept;
+    static constexpr T signaling_NaN() noexcept;
+    static constexpr T denorm_min() noexcept;
+
+    static constexpr bool is_iec559 = false;
+    static constexpr bool is_bounded = false;
+    static constexpr bool is_modulo = false;
+
+    static constexpr bool traps = false;
+    static constexpr bool tinyness_before = false;
+    static constexpr float_round_style round_style = round_toward_zero;
+};
+
+enum float_round_style
+{
+    round_indeterminate       = -1,
+    round_toward_zero         =  0,
+    round_to_nearest          =  1,
+    round_toward_infinity     =  2,
+    round_toward_neg_infinity =  3
+};
+
+enum float_denorm_style
+{
+    denorm_indeterminate = -1,
+    denorm_absent = 0,
+    denorm_present = 1
+};
+
+template<> class numeric_limits<cv bool>;
+
+template<> class numeric_limits<cv char>;
+template<> class numeric_limits<cv signed char>;
+template<> class numeric_limits<cv unsigned char>;
+template<> class numeric_limits<cv wchar_t>;
+template<> class numeric_limits<cv char16_t>;
+template<> class numeric_limits<cv char32_t>;
+
+template<> class numeric_limits<cv short>;
+template<> class numeric_limits<cv int>;
+template<> class numeric_limits<cv long>;
+template<> class numeric_limits<cv long long>;
+template<> class numeric_limits<cv unsigned short>;
+template<> class numeric_limits<cv unsigned int>;
+template<> class numeric_limits<cv unsigned long>;
+template<> class numeric_limits<cv unsigned long long>;
+
+template<> class numeric_limits<cv float>;
+template<> class numeric_limits<cv double>;
+template<> class numeric_limits<cv long double>;
+
+}  // std
+
+*/
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include <__config>
+#include <type_traits>
+
+#include <__undef_min_max>
+
+#if defined(_LIBCPP_MSVCRT)
+#include "support/win32/limits_win32.h"
+#endif // _LIBCPP_MSVCRT
+
+#if defined(__IBMCPP__)
+#include "support/ibm/limits.h"
+#endif // __IBMCPP__
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+enum float_round_style
+{
+    round_indeterminate       = -1,
+    round_toward_zero         =  0,
+    round_to_nearest          =  1,
+    round_toward_infinity     =  2,
+    round_toward_neg_infinity =  3
+};
+
+enum float_denorm_style
+{
+    denorm_indeterminate = -1,
+    denorm_absent = 0,
+    denorm_present = 1
+};
+
+template <class _Tp, bool = is_arithmetic<_Tp>::value>
+class __libcpp_numeric_limits
+{
+protected:
+    typedef _Tp type;
+
+    static _LIBCPP_CONSTEXPR const  bool is_specialized = false;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return type();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return type();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return type();}
+
+    static _LIBCPP_CONSTEXPR const int  digits = 0;
+    static _LIBCPP_CONSTEXPR const int  digits10 = 0;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = 0;
+    static _LIBCPP_CONSTEXPR const bool is_signed = false;
+    static _LIBCPP_CONSTEXPR const bool is_integer = false;
+    static _LIBCPP_CONSTEXPR const bool is_exact = false;
+    static _LIBCPP_CONSTEXPR const int  radix = 0;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type();}
+
+    static _LIBCPP_CONSTEXPR const int  min_exponent = 0;
+    static _LIBCPP_CONSTEXPR const int  min_exponent10 = 0;
+    static _LIBCPP_CONSTEXPR const int  max_exponent = 0;
+    static _LIBCPP_CONSTEXPR const int  max_exponent10 = 0;
+
+    static _LIBCPP_CONSTEXPR const bool has_infinity = false;
+    static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
+    static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
+    static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
+    static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type();}
+
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+    static _LIBCPP_CONSTEXPR const bool is_bounded = false;
+    static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+    static _LIBCPP_CONSTEXPR const bool traps = false;
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+    static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
+};
+
+template <class _Tp, int digits, bool is_signed>
+struct __libcpp_compute_min
+{
+    static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << digits);
+};
+
+template <class _Tp, int digits>
+struct __libcpp_compute_min<_Tp, digits, false>
+{
+    static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0);
+};
+
+template <class _Tp>
+class __libcpp_numeric_limits<_Tp, true>
+{
+protected:
+    typedef _Tp type;
+
+    static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+    static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
+    static _LIBCPP_CONSTEXPR const int  digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed);
+    static _LIBCPP_CONSTEXPR const int  digits10 = digits * 3 / 10;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = 0;
+    static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
+    static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();}
+
+    static _LIBCPP_CONSTEXPR const bool is_integer = true;
+    static _LIBCPP_CONSTEXPR const bool is_exact = true;
+    static _LIBCPP_CONSTEXPR const int  radix = 2;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
+
+    static _LIBCPP_CONSTEXPR const int  min_exponent = 0;
+    static _LIBCPP_CONSTEXPR const int  min_exponent10 = 0;
+    static _LIBCPP_CONSTEXPR const int  max_exponent = 0;
+    static _LIBCPP_CONSTEXPR const int  max_exponent10 = 0;
+
+    static _LIBCPP_CONSTEXPR const bool has_infinity = false;
+    static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
+    static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
+    static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
+    static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
+
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+    static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+    static _LIBCPP_CONSTEXPR const bool is_modulo = !_VSTD::is_signed<_Tp>::value;
+
+#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__)
+    static _LIBCPP_CONSTEXPR const bool traps = true;
+#else
+    static _LIBCPP_CONSTEXPR const bool traps = false;
+#endif
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+    static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
+};
+
+template <>
+class __libcpp_numeric_limits<bool, true>
+{
+protected:
+    typedef bool type;
+
+    static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+    static _LIBCPP_CONSTEXPR const bool is_signed = false;
+    static _LIBCPP_CONSTEXPR const int  digits = 1;
+    static _LIBCPP_CONSTEXPR const int  digits10 = 0;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = 0;
+    static _LIBCPP_CONSTEXPR const type __min = false;
+    static _LIBCPP_CONSTEXPR const type __max = true;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();}
+
+    static _LIBCPP_CONSTEXPR const bool is_integer = true;
+    static _LIBCPP_CONSTEXPR const bool is_exact = true;
+    static _LIBCPP_CONSTEXPR const int  radix = 2;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
+
+    static _LIBCPP_CONSTEXPR const int  min_exponent = 0;
+    static _LIBCPP_CONSTEXPR const int  min_exponent10 = 0;
+    static _LIBCPP_CONSTEXPR const int  max_exponent = 0;
+    static _LIBCPP_CONSTEXPR const int  max_exponent10 = 0;
+
+    static _LIBCPP_CONSTEXPR const bool has_infinity = false;
+    static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
+    static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
+    static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
+    static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
+
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+    static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+    static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+    static _LIBCPP_CONSTEXPR const bool traps = false;
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+    static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
+};
+
+template <>
+class __libcpp_numeric_limits<float, true>
+{
+protected:
+    typedef float type;
+
+    static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+    static _LIBCPP_CONSTEXPR const bool is_signed = true;
+    static _LIBCPP_CONSTEXPR const int  digits = __FLT_MANT_DIG__;
+    static _LIBCPP_CONSTEXPR const int  digits10 = __FLT_DIG__;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = 2+(digits * 30103)/100000;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __FLT_MIN__;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __FLT_MAX__;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
+
+    static _LIBCPP_CONSTEXPR const bool is_integer = false;
+    static _LIBCPP_CONSTEXPR const bool is_exact = false;
+    static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __FLT_EPSILON__;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5F;}
+
+    static _LIBCPP_CONSTEXPR const int  min_exponent = __FLT_MIN_EXP__;
+    static _LIBCPP_CONSTEXPR const int  min_exponent10 = __FLT_MIN_10_EXP__;
+    static _LIBCPP_CONSTEXPR const int  max_exponent = __FLT_MAX_EXP__;
+    static _LIBCPP_CONSTEXPR const int  max_exponent10 = __FLT_MAX_10_EXP__;
+
+    static _LIBCPP_CONSTEXPR const bool has_infinity = true;
+    static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
+    static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
+    static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
+    static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_valf();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;}
+
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+    static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+    static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+    static _LIBCPP_CONSTEXPR const bool traps = false;
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+    static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
+};
+
+template <>
+class __libcpp_numeric_limits<double, true>
+{
+protected:
+    typedef double type;
+
+    static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+    static _LIBCPP_CONSTEXPR const bool is_signed = true;
+    static _LIBCPP_CONSTEXPR const int  digits = __DBL_MANT_DIG__;
+    static _LIBCPP_CONSTEXPR const int  digits10 = __DBL_DIG__;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = 2+(digits * 30103)/100000;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __DBL_MIN__;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __DBL_MAX__;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
+
+    static _LIBCPP_CONSTEXPR const bool is_integer = false;
+    static _LIBCPP_CONSTEXPR const bool is_exact = false;
+    static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __DBL_EPSILON__;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
+
+    static _LIBCPP_CONSTEXPR const int  min_exponent = __DBL_MIN_EXP__;
+    static _LIBCPP_CONSTEXPR const int  min_exponent10 = __DBL_MIN_10_EXP__;
+    static _LIBCPP_CONSTEXPR const int  max_exponent = __DBL_MAX_EXP__;
+    static _LIBCPP_CONSTEXPR const int  max_exponent10 = __DBL_MAX_10_EXP__;
+
+    static _LIBCPP_CONSTEXPR const bool has_infinity = true;
+    static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
+    static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
+    static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
+    static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_val();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nan("");}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nans("");}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;}
+
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+    static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+    static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+    static _LIBCPP_CONSTEXPR const bool traps = false;
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+    static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
+};
+
+template <>
+class __libcpp_numeric_limits<long double, true>
+{
+protected:
+    typedef long double type;
+
+    static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+    static _LIBCPP_CONSTEXPR const bool is_signed = true;
+    static _LIBCPP_CONSTEXPR const int  digits = __LDBL_MANT_DIG__;
+    static _LIBCPP_CONSTEXPR const int  digits10 = __LDBL_DIG__;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = 2+(digits * 30103)/100000;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __LDBL_MIN__;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __LDBL_MAX__;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
+
+    static _LIBCPP_CONSTEXPR const bool is_integer = false;
+    static _LIBCPP_CONSTEXPR const bool is_exact = false;
+    static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
+
+    static _LIBCPP_CONSTEXPR const int  min_exponent = __LDBL_MIN_EXP__;
+    static _LIBCPP_CONSTEXPR const int  min_exponent10 = __LDBL_MIN_10_EXP__;
+    static _LIBCPP_CONSTEXPR const int  max_exponent = __LDBL_MAX_EXP__;
+    static _LIBCPP_CONSTEXPR const int  max_exponent10 = __LDBL_MAX_10_EXP__;
+
+    static _LIBCPP_CONSTEXPR const bool has_infinity = true;
+    static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
+    static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
+    static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
+    static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_vall();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+
+#if (defined(__ppc__) || defined(__ppc64__))
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+#else
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+#endif
+    static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+    static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+    static _LIBCPP_CONSTEXPR const bool traps = false;
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+    static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
+};
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY numeric_limits
+    : private __libcpp_numeric_limits<typename remove_cv<_Tp>::type>
+{
+    typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base;
+    typedef typename __base::type type;
+public:
+    static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
+
+    static _LIBCPP_CONSTEXPR const int  digits = __base::digits;
+    static _LIBCPP_CONSTEXPR const int  digits10 = __base::digits10;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = __base::max_digits10;
+    static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+    static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+    static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+    static _LIBCPP_CONSTEXPR const int  radix = __base::radix;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
+
+    static _LIBCPP_CONSTEXPR const int  min_exponent = __base::min_exponent;
+    static _LIBCPP_CONSTEXPR const int  min_exponent10 = __base::min_exponent10;
+    static _LIBCPP_CONSTEXPR const int  max_exponent = __base::max_exponent;
+    static _LIBCPP_CONSTEXPR const int  max_exponent10 = __base::max_exponent10;
+
+    static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+    static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+    static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+    static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+    static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
+
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+    static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+    static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+    static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+    static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+};
+
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style;
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY numeric_limits<const _Tp>
+    : private numeric_limits<_Tp>
+{
+    typedef numeric_limits<_Tp> __base;
+    typedef _Tp type;
+public:
+    static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
+
+    static _LIBCPP_CONSTEXPR const int  digits = __base::digits;
+    static _LIBCPP_CONSTEXPR const int  digits10 = __base::digits10;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = __base::max_digits10;
+    static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+    static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+    static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+    static _LIBCPP_CONSTEXPR const int  radix = __base::radix;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
+
+    static _LIBCPP_CONSTEXPR const int  min_exponent = __base::min_exponent;
+    static _LIBCPP_CONSTEXPR const int  min_exponent10 = __base::min_exponent10;
+    static _LIBCPP_CONSTEXPR const int  max_exponent = __base::max_exponent;
+    static _LIBCPP_CONSTEXPR const int  max_exponent10 = __base::max_exponent10;
+
+    static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+    static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+    static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+    static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+    static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
+
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+    static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+    static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+    static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+    static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+};
+
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_specialized;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_digits10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_signed;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_integer;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_exact;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::radix;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_infinity;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_quiet_NaN;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_signaling_NaN;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const _Tp>::has_denorm;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_denorm_loss;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_iec559;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_bounded;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_modulo;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::traps;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::tinyness_before;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const float_round_style numeric_limits<const _Tp>::round_style;
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY numeric_limits<volatile _Tp>
+    : private numeric_limits<_Tp>
+{
+    typedef numeric_limits<_Tp> __base;
+    typedef _Tp type;
+public:
+    static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
+
+    static _LIBCPP_CONSTEXPR const int  digits = __base::digits;
+    static _LIBCPP_CONSTEXPR const int  digits10 = __base::digits10;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = __base::max_digits10;
+    static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+    static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+    static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+    static _LIBCPP_CONSTEXPR const int  radix = __base::radix;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
+
+    static _LIBCPP_CONSTEXPR const int  min_exponent = __base::min_exponent;
+    static _LIBCPP_CONSTEXPR const int  min_exponent10 = __base::min_exponent10;
+    static _LIBCPP_CONSTEXPR const int  max_exponent = __base::max_exponent;
+    static _LIBCPP_CONSTEXPR const int  max_exponent10 = __base::max_exponent10;
+
+    static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+    static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+    static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+    static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+    static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
+
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+    static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+    static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+    static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+    static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+};
+
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_specialized;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_digits10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_signed;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_integer;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_exact;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::radix;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_infinity;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_quiet_NaN;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_signaling_NaN;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<volatile _Tp>::has_denorm;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_denorm_loss;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_iec559;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_bounded;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_modulo;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::traps;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::tinyness_before;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const float_round_style numeric_limits<volatile _Tp>::round_style;
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY numeric_limits<const volatile _Tp>
+    : private numeric_limits<_Tp>
+{
+    typedef numeric_limits<_Tp> __base;
+    typedef _Tp type;
+public:
+    static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
+
+    static _LIBCPP_CONSTEXPR const int  digits = __base::digits;
+    static _LIBCPP_CONSTEXPR const int  digits10 = __base::digits10;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = __base::max_digits10;
+    static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+    static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+    static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+    static _LIBCPP_CONSTEXPR const int  radix = __base::radix;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
+
+    static _LIBCPP_CONSTEXPR const int  min_exponent = __base::min_exponent;
+    static _LIBCPP_CONSTEXPR const int  min_exponent10 = __base::min_exponent10;
+    static _LIBCPP_CONSTEXPR const int  max_exponent = __base::max_exponent;
+    static _LIBCPP_CONSTEXPR const int  max_exponent10 = __base::max_exponent10;
+
+    static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+    static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+    static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+    static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+    static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
+
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+    static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+    static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+    static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+    static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+};
+
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_specialized;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_digits10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_signed;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_integer;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_exact;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::radix;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent10;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_infinity;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_quiet_NaN;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_signaling_NaN;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const volatile _Tp>::has_denorm;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_denorm_loss;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_iec559;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_bounded;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_modulo;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::traps;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::tinyness_before;
+template <class _Tp>
+    _LIBCPP_CONSTEXPR const float_round_style numeric_limits<const volatile _Tp>::round_style;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_LIMITS

Property changes on: lab4/.minix-src/include/c++/limits
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/map
===================================================================
--- lab4/.minix-src/include/c++/map	(nonexistent)
+++ lab4/.minix-src/include/c++/map	(revision 13)
@@ -0,0 +1,2230 @@
+// -*- C++ -*-
+//===----------------------------- map ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_MAP
+#define _LIBCPP_MAP
+
+/*
+
+    map synopsis
+
+namespace std
+{
+
+template <class Key, class T, class Compare = less<Key>,
+          class Allocator = allocator<pair<const Key, T>>>
+class map
+{
+public:
+    // types:
+    typedef Key                                      key_type;
+    typedef T                                        mapped_type;
+    typedef pair<const key_type, mapped_type>        value_type;
+    typedef Compare                                  key_compare;
+    typedef Allocator                                allocator_type;
+    typedef typename allocator_type::reference       reference;
+    typedef typename allocator_type::const_reference const_reference;
+    typedef typename allocator_type::pointer         pointer;
+    typedef typename allocator_type::const_pointer   const_pointer;
+    typedef typename allocator_type::size_type       size_type;
+    typedef typename allocator_type::difference_type difference_type;
+
+    typedef implementation-defined                   iterator;
+    typedef implementation-defined                   const_iterator;
+    typedef std::reverse_iterator<iterator>          reverse_iterator;
+    typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
+
+    class value_compare
+        : public binary_function<value_type, value_type, bool>
+    {
+        friend class map;
+    protected:
+        key_compare comp;
+
+        value_compare(key_compare c);
+    public:
+        bool operator()(const value_type& x, const value_type& y) const;
+    };
+
+    // construct/copy/destroy:
+    map()
+        noexcept(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_default_constructible<key_compare>::value &&
+            is_nothrow_copy_constructible<key_compare>::value);
+    explicit map(const key_compare& comp);
+    map(const key_compare& comp, const allocator_type& a);
+    template <class InputIterator>
+        map(InputIterator first, InputIterator last,
+            const key_compare& comp = key_compare());
+    template <class InputIterator>
+        map(InputIterator first, InputIterator last,
+            const key_compare& comp, const allocator_type& a);
+    map(const map& m);
+    map(map&& m)
+        noexcept(
+            is_nothrow_move_constructible<allocator_type>::value &&
+            is_nothrow_move_constructible<key_compare>::value);
+    explicit map(const allocator_type& a);
+    map(const map& m, const allocator_type& a);
+    map(map&& m, const allocator_type& a);
+    map(initializer_list<value_type> il, const key_compare& comp = key_compare());
+    map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
+    template <class InputIterator>
+        map(InputIterator first, InputIterator last, const allocator_type& a)
+            : map(first, last, Compare(), a) {}  // C++14
+    map(initializer_list<value_type> il, const allocator_type& a)
+        : map(il, Compare(), a) {}  // C++14
+   ~map();
+
+    map& operator=(const map& m);
+    map& operator=(map&& m)
+        noexcept(
+            allocator_type::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<allocator_type>::value &&
+            is_nothrow_move_assignable<key_compare>::value);
+    map& operator=(initializer_list<value_type> il);
+
+    // iterators:
+          iterator begin() noexcept;
+    const_iterator begin() const noexcept;
+          iterator end() noexcept;
+    const_iterator end()   const noexcept;
+
+          reverse_iterator rbegin() noexcept;
+    const_reverse_iterator rbegin() const noexcept;
+          reverse_iterator rend() noexcept;
+    const_reverse_iterator rend()   const noexcept;
+
+    const_iterator         cbegin()  const noexcept;
+    const_iterator         cend()    const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    const_reverse_iterator crend()   const noexcept;
+
+    // capacity:
+    bool      empty()    const noexcept;
+    size_type size()     const noexcept;
+    size_type max_size() const noexcept;
+
+    // element access:
+    mapped_type& operator[](const key_type& k);
+    mapped_type& operator[](key_type&& k);
+
+          mapped_type& at(const key_type& k);
+    const mapped_type& at(const key_type& k) const;
+
+    // modifiers:
+    template <class... Args>
+        pair<iterator, bool> emplace(Args&&... args);
+    template <class... Args>
+        iterator emplace_hint(const_iterator position, Args&&... args);
+    pair<iterator, bool> insert(const value_type& v);
+    template <class P>
+        pair<iterator, bool> insert(P&& p);
+    iterator insert(const_iterator position, const value_type& v);
+    template <class P>
+        iterator insert(const_iterator position, P&& p);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+    void insert(initializer_list<value_type> il);
+
+    template <class... Args>
+        pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);          // C++17
+    template <class... Args>
+        pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);               // C++17
+    template <class... Args>
+        iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17
+    template <class... Args>
+        iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);      // C++17
+    template <class M>
+        pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);            // C++17
+    template <class M>
+        pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);                 // C++17
+    template <class M>
+        iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);   // C++17
+    template <class M>
+        iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);        // C++17
+
+    iterator  erase(const_iterator position);
+    iterator  erase(iterator position); // C++14
+    size_type erase(const key_type& k);
+    iterator  erase(const_iterator first, const_iterator last);
+    void clear() noexcept;
+
+    void swap(map& m)
+        noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
+            __is_nothrow_swappable<key_compare>::value); // C++17
+
+    // observers:
+    allocator_type get_allocator() const noexcept;
+    key_compare    key_comp()      const;
+    value_compare  value_comp()    const;
+
+    // map operations:
+          iterator find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    template<typename K>
+        iterator find(const K& x);              // C++14
+    template<typename K>
+        const_iterator find(const K& x) const;  // C++14
+    template<typename K>
+      size_type count(const K& x) const;        // C++14
+
+    size_type      count(const key_type& k) const;
+          iterator lower_bound(const key_type& k);
+    const_iterator lower_bound(const key_type& k) const;
+    template<typename K>
+        iterator lower_bound(const K& x);              // C++14
+    template<typename K>
+        const_iterator lower_bound(const K& x) const;  // C++14
+
+          iterator upper_bound(const key_type& k);
+    const_iterator upper_bound(const key_type& k) const;
+    template<typename K>
+        iterator upper_bound(const K& x);              // C++14
+    template<typename K>
+        const_iterator upper_bound(const K& x) const;  // C++14
+
+    pair<iterator,iterator>             equal_range(const key_type& k);
+    pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+    template<typename K>
+        pair<iterator,iterator>             equal_range(const K& x);        // C++14
+    template<typename K>
+        pair<const_iterator,const_iterator> equal_range(const K& x) const;  // C++14
+};
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator==(const map<Key, T, Compare, Allocator>& x,
+           const map<Key, T, Compare, Allocator>& y);
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator< (const map<Key, T, Compare, Allocator>& x,
+           const map<Key, T, Compare, Allocator>& y);
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator!=(const map<Key, T, Compare, Allocator>& x,
+           const map<Key, T, Compare, Allocator>& y);
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator> (const map<Key, T, Compare, Allocator>& x,
+           const map<Key, T, Compare, Allocator>& y);
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator>=(const map<Key, T, Compare, Allocator>& x,
+           const map<Key, T, Compare, Allocator>& y);
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator<=(const map<Key, T, Compare, Allocator>& x,
+           const map<Key, T, Compare, Allocator>& y);
+
+// specialized algorithms:
+template <class Key, class T, class Compare, class Allocator>
+void
+swap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y)
+    noexcept(noexcept(x.swap(y)));
+
+template <class Key, class T, class Compare = less<Key>,
+          class Allocator = allocator<pair<const Key, T>>>
+class multimap
+{
+public:
+    // types:
+    typedef Key                                      key_type;
+    typedef T                                        mapped_type;
+    typedef pair<const key_type,mapped_type>         value_type;
+    typedef Compare                                  key_compare;
+    typedef Allocator                                allocator_type;
+    typedef typename allocator_type::reference       reference;
+    typedef typename allocator_type::const_reference const_reference;
+    typedef typename allocator_type::size_type       size_type;
+    typedef typename allocator_type::difference_type difference_type;
+    typedef typename allocator_type::pointer         pointer;
+    typedef typename allocator_type::const_pointer   const_pointer;
+
+    typedef implementation-defined                   iterator;
+    typedef implementation-defined                   const_iterator;
+    typedef std::reverse_iterator<iterator>          reverse_iterator;
+    typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
+
+    class value_compare
+        : public binary_function<value_type,value_type,bool>
+    {
+        friend class multimap;
+    protected:
+        key_compare comp;
+        value_compare(key_compare c);
+    public:
+        bool operator()(const value_type& x, const value_type& y) const;
+    };
+
+    // construct/copy/destroy:
+    multimap()
+        noexcept(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_default_constructible<key_compare>::value &&
+            is_nothrow_copy_constructible<key_compare>::value);
+    explicit multimap(const key_compare& comp);
+    multimap(const key_compare& comp, const allocator_type& a);
+    template <class InputIterator>
+        multimap(InputIterator first, InputIterator last, const key_compare& comp);
+    template <class InputIterator>
+        multimap(InputIterator first, InputIterator last, const key_compare& comp,
+                 const allocator_type& a);
+    multimap(const multimap& m);
+    multimap(multimap&& m)
+        noexcept(
+            is_nothrow_move_constructible<allocator_type>::value &&
+            is_nothrow_move_constructible<key_compare>::value);
+    explicit multimap(const allocator_type& a);
+    multimap(const multimap& m, const allocator_type& a);
+    multimap(multimap&& m, const allocator_type& a);
+    multimap(initializer_list<value_type> il, const key_compare& comp = key_compare());
+    multimap(initializer_list<value_type> il, const key_compare& comp,
+             const allocator_type& a);
+    template <class InputIterator>
+        multimap(InputIterator first, InputIterator last, const allocator_type& a)
+            : multimap(first, last, Compare(), a) {} // C++14
+    multimap(initializer_list<value_type> il, const allocator_type& a)
+        : multimap(il, Compare(), a) {} // C++14
+    ~multimap();
+
+    multimap& operator=(const multimap& m);
+    multimap& operator=(multimap&& m)
+        noexcept(
+            allocator_type::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<allocator_type>::value &&
+            is_nothrow_move_assignable<key_compare>::value);
+    multimap& operator=(initializer_list<value_type> il);
+
+    // iterators:
+          iterator begin() noexcept;
+    const_iterator begin() const noexcept;
+          iterator end() noexcept;
+    const_iterator end()   const noexcept;
+
+          reverse_iterator rbegin() noexcept;
+    const_reverse_iterator rbegin() const noexcept;
+          reverse_iterator rend() noexcept;
+    const_reverse_iterator rend()   const noexcept;
+
+    const_iterator         cbegin()  const noexcept;
+    const_iterator         cend()    const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    const_reverse_iterator crend()   const noexcept;
+
+    // capacity:
+    bool      empty()    const noexcept;
+    size_type size()     const noexcept;
+    size_type max_size() const noexcept;
+
+    // modifiers:
+    template <class... Args>
+        iterator emplace(Args&&... args);
+    template <class... Args>
+        iterator emplace_hint(const_iterator position, Args&&... args);
+    iterator insert(const value_type& v);
+    template <class P>
+        iterator insert(P&& p);
+    iterator insert(const_iterator position, const value_type& v);
+    template <class P>
+        iterator insert(const_iterator position, P&& p);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+    void insert(initializer_list<value_type> il);
+
+    iterator  erase(const_iterator position);
+    iterator  erase(iterator position); // C++14
+    size_type erase(const key_type& k);
+    iterator  erase(const_iterator first, const_iterator last);
+    void clear() noexcept;
+
+    void swap(multimap& m)
+        noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
+            __is_nothrow_swappable<key_compare>::value); // C++17
+
+    // observers:
+    allocator_type get_allocator() const noexcept;
+    key_compare    key_comp()      const;
+    value_compare  value_comp()    const;
+
+    // map operations:
+          iterator find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    template<typename K>
+        iterator find(const K& x);              // C++14
+    template<typename K>
+        const_iterator find(const K& x) const;  // C++14
+    template<typename K>
+      size_type count(const K& x) const;        // C++14
+
+    size_type      count(const key_type& k) const;
+          iterator lower_bound(const key_type& k);
+    const_iterator lower_bound(const key_type& k) const;
+    template<typename K>
+        iterator lower_bound(const K& x);              // C++14
+    template<typename K>
+        const_iterator lower_bound(const K& x) const;  // C++14
+
+          iterator upper_bound(const key_type& k);
+    const_iterator upper_bound(const key_type& k) const;
+    template<typename K>
+        iterator upper_bound(const K& x);              // C++14
+    template<typename K>
+        const_iterator upper_bound(const K& x) const;  // C++14
+
+    pair<iterator,iterator>             equal_range(const key_type& k);
+    pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+    template<typename K>
+        pair<iterator,iterator>             equal_range(const K& x);        // C++14
+    template<typename K>
+        pair<const_iterator,const_iterator> equal_range(const K& x) const;  // C++14
+};
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator==(const multimap<Key, T, Compare, Allocator>& x,
+           const multimap<Key, T, Compare, Allocator>& y);
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator< (const multimap<Key, T, Compare, Allocator>& x,
+           const multimap<Key, T, Compare, Allocator>& y);
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator!=(const multimap<Key, T, Compare, Allocator>& x,
+           const multimap<Key, T, Compare, Allocator>& y);
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator> (const multimap<Key, T, Compare, Allocator>& x,
+           const multimap<Key, T, Compare, Allocator>& y);
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator>=(const multimap<Key, T, Compare, Allocator>& x,
+           const multimap<Key, T, Compare, Allocator>& y);
+
+template <class Key, class T, class Compare, class Allocator>
+bool
+operator<=(const multimap<Key, T, Compare, Allocator>& x,
+           const multimap<Key, T, Compare, Allocator>& y);
+
+// specialized algorithms:
+template <class Key, class T, class Compare, class Allocator>
+void
+swap(multimap<Key, T, Compare, Allocator>& x,
+     multimap<Key, T, Compare, Allocator>& y)
+    noexcept(noexcept(x.swap(y)));
+
+}  // std
+
+*/
+
+#include <__config>
+#include <__tree>
+#include <iterator>
+#include <memory>
+#include <utility>
+#include <functional>
+#include <initializer_list>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Key, class _CP, class _Compare,
+          bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value
+         >
+class __map_value_compare
+    : private _Compare
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __map_value_compare()
+        _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
+        : _Compare() {}
+    _LIBCPP_INLINE_VISIBILITY
+    __map_value_compare(_Compare c)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
+        : _Compare(c) {}
+    _LIBCPP_INLINE_VISIBILITY
+    const _Compare& key_comp() const _NOEXCEPT {return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _CP& __x, const _CP& __y) const
+        {return static_cast<const _Compare&>(*this)(__x.__cc.first, __y.__cc.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _CP& __x, const _Key& __y) const
+        {return static_cast<const _Compare&>(*this)(__x.__cc.first, __y);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Key& __x, const _CP& __y) const
+        {return static_cast<const _Compare&>(*this)(__x, __y.__cc.first);}
+    void swap(__map_value_compare&__y)
+        _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
+    {
+        using _VSTD::swap;
+        swap(static_cast<const _Compare&>(*this), static_cast<const _Compare&>(__y));
+    }
+
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
+    operator () ( const _K2& __x, const _CP& __y ) const
+        {return static_cast<const _Compare&>(*this) (__x, __y.__cc.first);}
+
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
+    operator () (const _CP& __x, const _K2& __y) const
+        {return static_cast<const _Compare&>(*this) (__x.__cc.first, __y);}
+#endif
+};
+
+template <class _Key, class _CP, class _Compare>
+class __map_value_compare<_Key, _CP, _Compare, false>
+{
+    _Compare comp;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __map_value_compare()
+        _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
+        : comp() {}
+    _LIBCPP_INLINE_VISIBILITY
+    __map_value_compare(_Compare c)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
+        : comp(c) {}
+    _LIBCPP_INLINE_VISIBILITY
+    const _Compare& key_comp() const _NOEXCEPT {return comp;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _CP& __x, const _CP& __y) const
+        {return comp(__x.__cc.first, __y.__cc.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _CP& __x, const _Key& __y) const
+        {return comp(__x.__cc.first, __y);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Key& __x, const _CP& __y) const
+        {return comp(__x, __y.__cc.first);}
+    void swap(__map_value_compare&__y)
+        _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
+    {
+        using _VSTD::swap;
+        swap(comp, __y.comp);
+    }
+    
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
+    operator () ( const _K2& __x, const _CP& __y ) const
+        {return comp (__x, __y.__cc.first);}
+
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
+    operator () (const _CP& __x, const _K2& __y) const
+        {return comp (__x.__cc.first, __y);}
+#endif
+};
+
+template <class _Key, class _CP, class _Compare, bool __b>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__map_value_compare<_Key, _CP, _Compare, __b>& __x,
+     __map_value_compare<_Key, _CP, _Compare, __b>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Allocator>
+class __map_node_destructor
+{
+    typedef _Allocator                          allocator_type;
+    typedef allocator_traits<allocator_type>    __alloc_traits;
+    typedef typename __alloc_traits::value_type::value_type value_type;
+public:
+    typedef typename __alloc_traits::pointer    pointer;
+private:
+    typedef typename value_type::value_type::first_type     first_type;
+    typedef typename value_type::value_type::second_type    second_type;
+
+    allocator_type& __na_;
+
+    __map_node_destructor& operator=(const __map_node_destructor&);
+
+public:
+    bool __first_constructed;
+    bool __second_constructed;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT
+        : __na_(__na),
+          __first_constructed(false),
+          __second_constructed(false)
+        {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT
+        : __na_(__x.__na_),
+          __first_constructed(__x.__value_constructed),
+          __second_constructed(__x.__value_constructed)
+        {
+            __x.__value_constructed = false;
+        }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    void operator()(pointer __p) _NOEXCEPT
+    {
+        if (__second_constructed)
+            __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.second));
+        if (__first_constructed)
+            __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.first));
+        if (__p)
+            __alloc_traits::deallocate(__na_, __p, 1);
+    }
+};
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+    class map;
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+    class multimap;
+template <class _TreeIterator> class __map_const_iterator;
+
+#if __cplusplus >= 201103L
+
+template <class _Key, class _Tp>
+union __value_type
+{
+    typedef _Key                                     key_type;
+    typedef _Tp                                      mapped_type;
+    typedef pair<const key_type, mapped_type>        value_type;
+    typedef pair<key_type, mapped_type>              __nc_value_type;
+
+    value_type __cc;
+    __nc_value_type __nc;
+
+    template <class ..._Args>
+    _LIBCPP_INLINE_VISIBILITY
+    __value_type(_Args&& ...__args)
+        : __cc(std::forward<_Args>(__args)...) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __value_type(const __value_type& __v)
+        : __cc(__v.__cc) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __value_type(__value_type& __v)
+        : __cc(__v.__cc) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __value_type(__value_type&& __v)
+        : __nc(std::move(__v.__nc)) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __value_type& operator=(const __value_type& __v)
+        {__nc = __v.__cc; return *this;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __value_type& operator=(__value_type&& __v)
+        {__nc = std::move(__v.__nc); return *this;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    ~__value_type() {__cc.~value_type();}
+};
+
+#else
+
+template <class _Key, class _Tp>
+struct __value_type
+{
+    typedef _Key                                     key_type;
+    typedef _Tp                                      mapped_type;
+    typedef pair<const key_type, mapped_type>        value_type;
+
+    value_type __cc;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __value_type() {}
+
+    template <class _A0>
+    _LIBCPP_INLINE_VISIBILITY
+    __value_type(const _A0& __a0)
+        : __cc(__a0) {}
+
+    template <class _A0, class _A1>
+    _LIBCPP_INLINE_VISIBILITY
+    __value_type(const _A0& __a0, const _A1& __a1)
+        : __cc(__a0, __a1) {}
+};
+
+#endif
+
+template <class _Tp>
+struct __extract_key_value_types;
+
+template <class _Key, class _Tp>
+struct __extract_key_value_types<__value_type<_Key, _Tp> >
+{
+  typedef _Key const __key_type;
+  typedef _Tp        __mapped_type;
+};
+
+template <class _TreeIterator>
+class _LIBCPP_TYPE_VIS_ONLY __map_iterator
+{
+    _TreeIterator __i_;
+
+    typedef typename _TreeIterator::__pointer_traits             __pointer_traits;
+    typedef typename _TreeIterator::value_type __value_type;
+    typedef typename __extract_key_value_types<__value_type>::__key_type    __key_type;
+    typedef typename __extract_key_value_types<__value_type>::__mapped_type __mapped_type;
+public:
+    typedef bidirectional_iterator_tag                           iterator_category;
+    typedef pair<__key_type, __mapped_type>                      value_type;
+    typedef typename _TreeIterator::difference_type              difference_type;
+    typedef value_type&                                          reference;
+    typedef typename __pointer_traits::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<value_type>
+#else
+            rebind<value_type>::other
+#endif
+                                                                 pointer;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __map_iterator() _NOEXCEPT {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference operator*() const {return __i_->__cc;}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__cc);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __map_iterator& operator++() {++__i_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    __map_iterator operator++(int)
+    {
+        __map_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __map_iterator& operator--() {--__i_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    __map_iterator operator--(int)
+    {
+        __map_iterator __t(*this);
+        --(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __map_iterator& __x, const __map_iterator& __y)
+        {return __x.__i_ == __y.__i_;}
+    friend 
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
+        {return __x.__i_ != __y.__i_;}
+
+    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
+    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
+};
+
+template <class _TreeIterator>
+class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator
+{
+    _TreeIterator __i_;
+
+    typedef typename _TreeIterator::__pointer_traits             __pointer_traits;
+    typedef typename _TreeIterator::value_type __value_type;
+    typedef typename __extract_key_value_types<__value_type>::__key_type    __key_type;
+    typedef typename __extract_key_value_types<__value_type>::__mapped_type __mapped_type;
+public:
+    typedef bidirectional_iterator_tag                           iterator_category;
+    typedef pair<__key_type, __mapped_type>                      value_type;
+    typedef typename _TreeIterator::difference_type              difference_type;
+    typedef const value_type&                                    reference;
+    typedef typename __pointer_traits::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<const value_type>
+#else
+            rebind<const value_type>::other
+#endif
+                                                                 pointer;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __map_const_iterator() _NOEXCEPT {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
+    _LIBCPP_INLINE_VISIBILITY
+    __map_const_iterator(__map_iterator<
+        typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT
+        : __i_(__i.__i_) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference operator*() const {return __i_->__cc;}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__cc);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __map_const_iterator& operator++() {++__i_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    __map_const_iterator operator++(int)
+    {
+        __map_const_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __map_const_iterator& operator--() {--__i_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    __map_const_iterator operator--(int)
+    {
+        __map_const_iterator __t(*this);
+        --(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y)
+        {return __x.__i_ == __y.__i_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
+        {return __x.__i_ != __y.__i_;}
+
+    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
+    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
+    template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
+};
+
+template <class _Key, class _Tp, class _Compare = less<_Key>,
+          class _Allocator = allocator<pair<const _Key, _Tp> > >
+class _LIBCPP_TYPE_VIS_ONLY map
+{
+public:
+    // types:
+    typedef _Key                                     key_type;
+    typedef _Tp                                      mapped_type;
+    typedef pair<const key_type, mapped_type>        value_type;
+    typedef pair<key_type, mapped_type>              __nc_value_type;
+    typedef _Compare                                 key_compare;
+    typedef _Allocator                               allocator_type;
+    typedef value_type&                              reference;
+    typedef const value_type&                        const_reference;
+
+    class _LIBCPP_TYPE_VIS_ONLY value_compare
+        : public binary_function<value_type, value_type, bool>
+    {
+        friend class map;
+    protected:
+        key_compare comp;
+
+        _LIBCPP_INLINE_VISIBILITY value_compare(key_compare c) : comp(c) {}
+    public:
+        _LIBCPP_INLINE_VISIBILITY
+        bool operator()(const value_type& __x, const value_type& __y) const
+            {return comp(__x.first, __y.first);}
+    };
+
+private:
+
+    typedef _VSTD::__value_type<key_type, mapped_type>             __value_type;
+    typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
+    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
+                                                 __value_type>::type __allocator_type;
+    typedef __tree<__value_type, __vc, __allocator_type>   __base;
+    typedef typename __base::__node_traits                 __node_traits;
+    typedef allocator_traits<allocator_type>               __alloc_traits;
+
+    __base __tree_;
+
+public:
+    typedef typename __alloc_traits::pointer               pointer;
+    typedef typename __alloc_traits::const_pointer         const_pointer;
+    typedef typename __alloc_traits::size_type             size_type;
+    typedef typename __alloc_traits::difference_type       difference_type;
+    typedef __map_iterator<typename __base::iterator>             iterator;
+    typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
+    typedef _VSTD::reverse_iterator<iterator>               reverse_iterator;
+    typedef _VSTD::reverse_iterator<const_iterator>         const_reverse_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    map()
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_default_constructible<key_compare>::value &&
+            is_nothrow_copy_constructible<key_compare>::value)
+        : __tree_(__vc(key_compare())) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit map(const key_compare& __comp)
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_copy_constructible<key_compare>::value)
+        : __tree_(__vc(__comp)) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit map(const key_compare& __comp, const allocator_type& __a)
+        : __tree_(__vc(__comp), __a) {}
+
+    template <class _InputIterator>
+    _LIBCPP_INLINE_VISIBILITY
+        map(_InputIterator __f, _InputIterator __l,
+            const key_compare& __comp = key_compare())
+        : __tree_(__vc(__comp))
+        {
+            insert(__f, __l);
+        }
+
+    template <class _InputIterator>
+    _LIBCPP_INLINE_VISIBILITY
+        map(_InputIterator __f, _InputIterator __l,
+            const key_compare& __comp, const allocator_type& __a)
+        : __tree_(__vc(__comp), __a)
+        {
+            insert(__f, __l);
+        }
+
+#if _LIBCPP_STD_VER > 11
+    template <class _InputIterator>
+    _LIBCPP_INLINE_VISIBILITY 
+    map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+        : map(__f, __l, key_compare(), __a) {}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    map(const map& __m)
+        : __tree_(__m.__tree_)
+        {
+            insert(__m.begin(), __m.end());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    map& operator=(const map& __m)
+        {
+#if __cplusplus >= 201103L
+            __tree_ = __m.__tree_;
+#else
+            if (this != &__m) {
+                __tree_.clear();
+                __tree_.value_comp() = __m.__tree_.value_comp();
+                __tree_.__copy_assign_alloc(__m.__tree_);
+                insert(__m.begin(), __m.end());
+            }
+#endif
+            return *this;
+        }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    map(map&& __m)
+        _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+        : __tree_(_VSTD::move(__m.__tree_))
+        {
+        }
+
+    map(map&& __m, const allocator_type& __a);
+
+    _LIBCPP_INLINE_VISIBILITY
+    map& operator=(map&& __m)
+        _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
+        {
+            __tree_ = _VSTD::move(__m.__tree_);
+            return *this;
+        }
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+        : __tree_(__vc(__comp))
+        {
+            insert(__il.begin(), __il.end());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
+        : __tree_(__vc(__comp), __a)
+        {
+            insert(__il.begin(), __il.end());
+        }
+
+#if _LIBCPP_STD_VER > 11
+    _LIBCPP_INLINE_VISIBILITY 
+    map(initializer_list<value_type> __il, const allocator_type& __a)
+        : map(__il, key_compare(), __a) {}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    map& operator=(initializer_list<value_type> __il)
+        {
+            __tree_.__assign_unique(__il.begin(), __il.end());
+            return *this;
+        }
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit map(const allocator_type& __a)
+        : __tree_(__a)
+        {
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    map(const map& __m, const allocator_type& __a)
+        : __tree_(__m.__tree_.value_comp(), __a)
+        {
+            insert(__m.begin(), __m.end());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+          iterator begin() _NOEXCEPT {return __tree_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+          iterator end() _NOEXCEPT {return __tree_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end() const _NOEXCEPT {return __tree_.end();}
+
+    _LIBCPP_INLINE_VISIBILITY
+          reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rbegin() const _NOEXCEPT
+        {return const_reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+          reverse_iterator rend() _NOEXCEPT
+            {return       reverse_iterator(begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rend() const _NOEXCEPT
+        {return const_reverse_iterator(begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin() const _NOEXCEPT {return begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend() const _NOEXCEPT {return end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crend() const _NOEXCEPT {return rend();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool      empty() const _NOEXCEPT {return __tree_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT {return __tree_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
+
+    mapped_type& operator[](const key_type& __k);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    mapped_type& operator[](key_type&& __k);
+#endif
+
+          mapped_type& at(const key_type& __k);
+    const mapped_type& at(const key_type& __k) const;
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_compare    key_comp()      const {return __tree_.value_comp().key_comp();}
+    _LIBCPP_INLINE_VISIBILITY
+    value_compare  value_comp()    const {return value_compare(__tree_.value_comp().key_comp());}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template <class ..._Args>
+        pair<iterator, bool>
+        emplace(_Args&& ...__args);
+
+    template <class ..._Args>
+        iterator
+        emplace_hint(const_iterator __p, _Args&& ...__args);
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+    template <class _Pp,
+              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> insert(_Pp&& __p)
+            {return __tree_.__insert_unique(_VSTD::forward<_Pp>(__p));}
+
+    template <class _Pp,
+              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator insert(const_iterator __pos, _Pp&& __p)
+            {return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_Pp>(__p));}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, bool>
+        insert(const value_type& __v) {return __tree_.__insert_unique(__v);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator
+        insert(const_iterator __p, const value_type& __v)
+            {return __tree_.__insert_unique(__p.__i_, __v);}
+
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        void insert(_InputIterator __f, _InputIterator __l)
+        {
+            for (const_iterator __e = cend(); __f != __l; ++__f)
+                insert(__e.__i_, *__f);
+        }
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    void insert(initializer_list<value_type> __il)
+        {insert(__il.begin(), __il.end());}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#if _LIBCPP_STD_VER > 14
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
+    {
+        iterator __p = lower_bound(__k);
+        if ( __p != end() && !key_comp()(__k, __p->first))
+            return _VSTD::make_pair(__p, false);
+        else
+            return _VSTD::make_pair(
+                      emplace_hint(__p, 
+                        _VSTD::piecewise_construct, _VSTD::forward_as_tuple(__k), 
+                        _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)),
+                      true);
+    }
+
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
+    {
+        iterator __p = lower_bound(__k);
+        if ( __p != end() && !key_comp()(__k, __p->first))
+            return _VSTD::make_pair(__p, false);
+        else
+            return _VSTD::make_pair(
+                      emplace_hint(__p, 
+                        _VSTD::piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)), 
+                        _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)),
+                      true);
+    }
+
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
+    {
+        iterator __p = lower_bound(__k);
+        if ( __p != end() && !key_comp()(__k, __p->first))
+            return __p;
+        else
+            return emplace_hint(__p, 
+                      _VSTD::piecewise_construct, _VSTD::forward_as_tuple(__k), 
+                      _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
+    }
+
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
+    {
+        iterator __p = lower_bound(__k);
+        if ( __p != end() && !key_comp()(__k, __p->first))
+            return __p;
+        else
+            return emplace_hint(__p, 
+                      _VSTD::piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)), 
+                      _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
+    }
+
+    template <class _Vp>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v)
+    {
+        iterator __p = lower_bound(__k);
+        if ( __p != end() && !key_comp()(__k, __p->first))
+        {
+            __p->second = _VSTD::forward<_Vp>(__v);
+            return _VSTD::make_pair(__p, false);
+        }
+        return _VSTD::make_pair(emplace_hint(__p, __k, _VSTD::forward<_Vp>(__v)), true);
+    }
+        
+    template <class _Vp>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v)
+    {
+        iterator __p = lower_bound(__k);
+        if ( __p != end() && !key_comp()(__k, __p->first))
+        {
+            __p->second = _VSTD::forward<_Vp>(__v);
+            return _VSTD::make_pair(__p, false);
+        }
+        return _VSTD::make_pair(emplace_hint(__p, _VSTD::move(__k), _VSTD::forward<_Vp>(__v)), true);
+    }
+
+    template <class _Vp>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v)
+     {
+        iterator __p = lower_bound(__k);
+        if ( __p != end() && !key_comp()(__k, __p->first))
+        {
+            __p->second = _VSTD::forward<_Vp>(__v);
+            return __p;
+        }
+        return emplace_hint(__h, __k, _VSTD::forward<_Vp>(__v));
+     }
+
+    template <class _Vp>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v)
+     {
+        iterator __p = lower_bound(__k);
+        if ( __p != end() && !key_comp()(__k, __p->first))
+        {
+            __p->second = _VSTD::forward<_Vp>(__v);
+            return __p;
+        }
+        return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v));
+     }
+#endif
+#endif
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(iterator __p)       {return __tree_.erase(__p.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k)
+        {return __tree_.__erase_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator  erase(const_iterator __f, const_iterator __l)
+        {return __tree_.erase(__f.__i_, __l.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {__tree_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(map& __m)
+        _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
+        {__tree_.swap(__m.__tree_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator find(const key_type& __k)             {return __tree_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+    find(const _K2& __k)                           {return __tree_.find(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    find(const _K2& __k) const                     {return __tree_.find(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type      count(const key_type& __k) const
+        {return __tree_.__count_unique(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
+    count(const _K2& __k) const {return __tree_.__count_unique(__k);}
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    iterator lower_bound(const key_type& __k)
+        {return __tree_.lower_bound(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator lower_bound(const key_type& __k) const
+        {return __tree_.lower_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+    lower_bound(const _K2& __k)       {return __tree_.lower_bound(__k);}
+
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator upper_bound(const key_type& __k)
+        {return __tree_.upper_bound(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator upper_bound(const key_type& __k) const
+        {return __tree_.upper_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+    upper_bound(const _K2& __k)       {return __tree_.upper_bound(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator,iterator> equal_range(const key_type& __k)
+        {return __tree_.__equal_range_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
+        {return __tree_.__equal_range_unique(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
+    equal_range(const _K2& __k)       {return __tree_.__equal_range_unique(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
+    equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);}
+#endif
+
+private:
+    typedef typename __base::__node                    __node;
+    typedef typename __base::__node_allocator          __node_allocator;
+    typedef typename __base::__node_pointer            __node_pointer;
+    typedef typename __base::__node_const_pointer      __node_const_pointer;
+    typedef typename __base::__node_base_pointer       __node_base_pointer;
+    typedef typename __base::__node_base_const_pointer __node_base_const_pointer;
+    typedef __map_node_destructor<__node_allocator> _Dp;
+    typedef unique_ptr<__node, _Dp> __node_holder;
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __node_holder __construct_node();
+    template <class _A0>
+        __node_holder __construct_node(_A0&& __a0);
+    __node_holder __construct_node_with_key(key_type&& __k);
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class _A0, class _A1, class ..._Args>
+        __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif
+    __node_holder __construct_node_with_key(const key_type& __k);
+
+    __node_base_pointer&
+        __find_equal_key(__node_base_pointer& __parent, const key_type& __k);
+    __node_base_const_pointer
+        __find_equal_key(__node_base_const_pointer& __parent, const key_type& __k) const;
+};
+
+// Find place to insert if __k doesn't exist
+// Set __parent to parent of null leaf
+// Return reference to null leaf
+// If __k exists, set parent to node of __k and return reference to node of __k
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+typename map<_Key, _Tp, _Compare, _Allocator>::__node_base_pointer&
+map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(__node_base_pointer& __parent,
+                                                       const key_type& __k)
+{
+    __node_pointer __nd = __tree_.__root();
+    if (__nd != nullptr)
+    {
+        while (true)
+        {
+            if (__tree_.value_comp().key_comp()(__k, __nd->__value_.__cc.first))
+            {
+                if (__nd->__left_ != nullptr)
+                    __nd = static_cast<__node_pointer>(__nd->__left_);
+                else
+                {
+                    __parent = static_cast<__node_base_pointer>(__nd);
+                    return __parent->__left_;
+                }
+            }
+            else if (__tree_.value_comp().key_comp()(__nd->__value_.__cc.first, __k))
+            {
+                if (__nd->__right_ != nullptr)
+                    __nd = static_cast<__node_pointer>(__nd->__right_);
+                else
+                {
+                    __parent = static_cast<__node_base_pointer>(__nd);
+                    return __parent->__right_;
+                }
+            }
+            else
+            {
+                __parent = static_cast<__node_base_pointer>(__nd);
+                return __parent;
+            }
+        }
+    }
+    __parent = static_cast<__node_base_pointer>(__tree_.__end_node());
+    return __parent->__left_;
+}
+
+// Find __k
+// Set __parent to parent of null leaf and
+//    return reference to null leaf iv __k does not exist.
+// If __k exists, set parent to node of __k and return reference to node of __k
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+typename map<_Key, _Tp, _Compare, _Allocator>::__node_base_const_pointer
+map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(__node_base_const_pointer& __parent,
+                                                       const key_type& __k) const
+{
+    __node_const_pointer __nd = __tree_.__root();
+    if (__nd != nullptr)
+    {
+        while (true)
+        {
+            if (__tree_.value_comp().key_comp()(__k, __nd->__value_.__cc.first))
+            {
+                if (__nd->__left_ != nullptr)
+                    __nd = static_cast<__node_pointer>(__nd->__left_);
+                else
+                {
+                    __parent = static_cast<__node_base_pointer>(__nd);
+                    return const_cast<const __node_base_const_pointer&>(__parent->__left_);
+                }
+            }
+            else if (__tree_.value_comp().key_comp()(__nd->__value_.__cc.first, __k))
+            {
+                if (__nd->__right_ != nullptr)
+                    __nd = static_cast<__node_pointer>(__nd->__right_);
+                else
+                {
+                    __parent = static_cast<__node_base_pointer>(__nd);
+                    return const_cast<const __node_base_const_pointer&>(__parent->__right_);
+                }
+            }
+            else
+            {
+                __parent = static_cast<__node_base_pointer>(__nd);
+                return __parent;
+            }
+        }
+    }
+    __parent = static_cast<__node_base_pointer>(__tree_.__end_node());
+    return const_cast<const __node_base_const_pointer&>(__parent->__left_);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
+    : __tree_(_VSTD::move(__m.__tree_), __a)
+{
+    if (__a != __m.get_allocator())
+    {
+        const_iterator __e = cend();
+        while (!__m.empty())
+            __tree_.__insert_unique(__e.__i_,
+                    _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
+    }
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
+map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
+{
+    __node_allocator& __na = __tree_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first));
+    __h.get_deleter().__first_constructed = true;
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+template <class _A0>
+typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
+map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
+{
+    __node_allocator& __na = __tree_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
+    __h.get_deleter().__first_constructed = true;
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
+map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(key_type&& __k)
+{
+    __node_allocator& __na = __tree_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), _VSTD::move(__k));
+    __h.get_deleter().__first_constructed = true;
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+template <class _A0, class _A1, class ..._Args>
+typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
+map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args)
+{
+    __node_allocator& __na = __tree_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_),
+                             _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
+                             _VSTD::forward<_Args>(__args)...);
+    __h.get_deleter().__first_constructed = true;
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
+map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type& __k)
+{
+    __node_allocator& __na = __tree_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k);
+    __h.get_deleter().__first_constructed = true;
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
+    __h.get_deleter().__second_constructed = true;
+    return _LIBCPP_EXPLICIT_MOVE(__h);  // explicitly moved for C++03
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+_Tp&
+map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_equal_key(__parent, __k);
+    __node_pointer __r = static_cast<__node_pointer>(__child);
+    if (__child == nullptr)
+    {
+        __node_holder __h = __construct_node_with_key(__k);
+        __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+        __r = __h.release();
+    }
+    return __r->__value_.__cc.second;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+_Tp&
+map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_equal_key(__parent, __k);
+    __node_pointer __r = static_cast<__node_pointer>(__child);
+    if (__child == nullptr)
+    {
+        __node_holder __h = __construct_node_with_key(_VSTD::move(__k));
+        __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+        __r = __h.release();
+    }
+    return __r->__value_.__cc.second;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+_Tp&
+map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)
+{
+    __node_base_pointer __parent;
+    __node_base_pointer& __child = __find_equal_key(__parent, __k);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__child == nullptr)
+        throw out_of_range("map::at:  key not found");
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return static_cast<__node_pointer>(__child)->__value_.__cc.second;
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+const _Tp&
+map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
+{
+    __node_base_const_pointer __parent;
+    __node_base_const_pointer __child = __find_equal_key(__parent, __k);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__child == nullptr)
+        throw out_of_range("map::at:  key not found");
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return static_cast<__node_const_pointer>(__child)->__value_.__cc.second;
+}
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+template <class ..._Args>
+pair<typename map<_Key, _Tp, _Compare, _Allocator>::iterator, bool>
+map<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    pair<iterator, bool> __r = __tree_.__node_insert_unique(__h.get());
+    if (__r.second)
+        __h.release();
+    return __r;
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+template <class ..._Args>
+typename map<_Key, _Tp, _Compare, _Allocator>::iterator
+map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
+                                                   _Args&& ...__args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    iterator __r = __tree_.__node_insert_unique(__p.__i_, __h.get());
+    if (__r.__i_.__ptr_ == __h.get())
+        __h.release();
+    return __r;
+}
+
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
+           const map<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
+           const map<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
+           const map<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x,
+           const map<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
+           const map<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
+           const map<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
+     map<_Key, _Tp, _Compare, _Allocator>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Key, class _Tp, class _Compare = less<_Key>,
+          class _Allocator = allocator<pair<const _Key, _Tp> > >
+class _LIBCPP_TYPE_VIS_ONLY multimap
+{
+public:
+    // types:
+    typedef _Key                                     key_type;
+    typedef _Tp                                      mapped_type;
+    typedef pair<const key_type, mapped_type>        value_type;
+    typedef pair<key_type, mapped_type>              __nc_value_type;
+    typedef _Compare                                 key_compare;
+    typedef _Allocator                               allocator_type;
+    typedef value_type&                              reference;
+    typedef const value_type&                        const_reference;
+
+    class _LIBCPP_TYPE_VIS_ONLY value_compare
+        : public binary_function<value_type, value_type, bool>
+    {
+        friend class multimap;
+    protected:
+        key_compare comp;
+
+        _LIBCPP_INLINE_VISIBILITY
+        value_compare(key_compare c) : comp(c) {}
+    public:
+        _LIBCPP_INLINE_VISIBILITY
+        bool operator()(const value_type& __x, const value_type& __y) const
+            {return comp(__x.first, __y.first);}
+    };
+
+private:
+
+    typedef _VSTD::__value_type<key_type, mapped_type>             __value_type;
+    typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
+    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
+                                                 __value_type>::type __allocator_type;
+    typedef __tree<__value_type, __vc, __allocator_type>            __base;
+    typedef typename __base::__node_traits                          __node_traits;
+    typedef allocator_traits<allocator_type>                        __alloc_traits;
+
+    __base __tree_;
+
+public:
+    typedef typename __alloc_traits::pointer               pointer;
+    typedef typename __alloc_traits::const_pointer         const_pointer;
+    typedef typename __alloc_traits::size_type             size_type;
+    typedef typename __alloc_traits::difference_type       difference_type;
+    typedef __map_iterator<typename __base::iterator>      iterator;
+    typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
+    typedef _VSTD::reverse_iterator<iterator>               reverse_iterator;
+    typedef _VSTD::reverse_iterator<const_iterator>         const_reverse_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    multimap()
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_default_constructible<key_compare>::value &&
+            is_nothrow_copy_constructible<key_compare>::value)
+        : __tree_(__vc(key_compare())) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit multimap(const key_compare& __comp)
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_copy_constructible<key_compare>::value)
+        : __tree_(__vc(__comp)) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit multimap(const key_compare& __comp, const allocator_type& __a)
+        : __tree_(__vc(__comp), __a) {}
+
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        multimap(_InputIterator __f, _InputIterator __l,
+            const key_compare& __comp = key_compare())
+        : __tree_(__vc(__comp))
+        {
+            insert(__f, __l);
+        }
+
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        multimap(_InputIterator __f, _InputIterator __l,
+            const key_compare& __comp, const allocator_type& __a)
+        : __tree_(__vc(__comp), __a)
+        {
+            insert(__f, __l);
+        }
+
+#if _LIBCPP_STD_VER > 11
+    template <class _InputIterator>
+    _LIBCPP_INLINE_VISIBILITY 
+    multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+        : multimap(__f, __l, key_compare(), __a) {}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    multimap(const multimap& __m)
+        : __tree_(__m.__tree_.value_comp(),
+          __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc()))
+        {
+            insert(__m.begin(), __m.end());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    multimap& operator=(const multimap& __m)
+        {
+#if __cplusplus >= 201103L
+            __tree_ = __m.__tree_;
+#else
+            if (this != &__m) {
+                __tree_.clear();
+                __tree_.value_comp() = __m.__tree_.value_comp();
+                __tree_.__copy_assign_alloc(__m.__tree_);
+                insert(__m.begin(), __m.end());
+            }
+#endif
+            return *this;
+        }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    multimap(multimap&& __m)
+        _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+        : __tree_(_VSTD::move(__m.__tree_))
+        {
+        }
+
+    multimap(multimap&& __m, const allocator_type& __a);
+
+    _LIBCPP_INLINE_VISIBILITY
+    multimap& operator=(multimap&& __m)
+        _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
+        {
+            __tree_ = _VSTD::move(__m.__tree_);
+            return *this;
+        }
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+        : __tree_(__vc(__comp))
+        {
+            insert(__il.begin(), __il.end());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
+        : __tree_(__vc(__comp), __a)
+        {
+            insert(__il.begin(), __il.end());
+        }
+
+#if _LIBCPP_STD_VER > 11
+    _LIBCPP_INLINE_VISIBILITY 
+    multimap(initializer_list<value_type> __il, const allocator_type& __a)
+        : multimap(__il, key_compare(), __a) {}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    multimap& operator=(initializer_list<value_type> __il)
+        {
+            __tree_.__assign_multi(__il.begin(), __il.end());
+            return *this;
+        }
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit multimap(const allocator_type& __a)
+        : __tree_(__a)
+        {
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    multimap(const multimap& __m, const allocator_type& __a)
+        : __tree_(__m.__tree_.value_comp(), __a)
+        {
+            insert(__m.begin(), __m.end());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+          iterator begin() _NOEXCEPT {return __tree_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+          iterator end() _NOEXCEPT {return __tree_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end() const _NOEXCEPT {return __tree_.end();}
+
+    _LIBCPP_INLINE_VISIBILITY
+          reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rbegin() const _NOEXCEPT
+        {return const_reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+          reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rend() const _NOEXCEPT
+        {return const_reverse_iterator(begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin()  const _NOEXCEPT {return begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend() const _NOEXCEPT {return end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crend() const _NOEXCEPT {return rend();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT {return __tree_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_compare    key_comp() const {return __tree_.value_comp().key_comp();}
+    _LIBCPP_INLINE_VISIBILITY
+    value_compare  value_comp() const
+        {return value_compare(__tree_.value_comp().key_comp());}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template <class ..._Args>
+        iterator
+        emplace(_Args&& ...__args);
+
+    template <class ..._Args>
+        iterator
+        emplace_hint(const_iterator __p, _Args&& ...__args);
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+    template <class _Pp,
+              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator insert(_Pp&& __p)
+            {return __tree_.__insert_multi(_VSTD::forward<_Pp>(__p));}
+
+    template <class _Pp,
+              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator insert(const_iterator __pos, _Pp&& __p)
+            {return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_Pp>(__p));}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __p, const value_type& __v)
+            {return __tree_.__insert_multi(__p.__i_, __v);}
+
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        void insert(_InputIterator __f, _InputIterator __l)
+        {
+            for (const_iterator __e = cend(); __f != __l; ++__f)
+                __tree_.__insert_multi(__e.__i_, *__f);
+        }
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    void insert(initializer_list<value_type> __il)
+        {insert(__il.begin(), __il.end());}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(iterator __p)       {return __tree_.erase(__p.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator  erase(const_iterator __f, const_iterator __l)
+        {return __tree_.erase(__f.__i_, __l.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() {__tree_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(multimap& __m)
+        _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
+        {__tree_.swap(__m.__tree_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator find(const key_type& __k)             {return __tree_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+    find(const _K2& __k)                           {return __tree_.find(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    find(const _K2& __k) const                     {return __tree_.find(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type      count(const key_type& __k) const
+        {return __tree_.__count_multi(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
+    count(const _K2& __k) const {return __tree_.__count_multi(__k);}
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    iterator lower_bound(const key_type& __k)
+        {return __tree_.lower_bound(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator lower_bound(const key_type& __k) const
+            {return __tree_.lower_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+    lower_bound(const _K2& __k)       {return __tree_.lower_bound(__k);}
+
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator upper_bound(const key_type& __k)
+            {return __tree_.upper_bound(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator upper_bound(const key_type& __k) const
+            {return __tree_.upper_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+    upper_bound(const _K2& __k)       {return __tree_.upper_bound(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator,iterator>             equal_range(const key_type& __k)
+            {return __tree_.__equal_range_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
+            {return __tree_.__equal_range_multi(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
+    equal_range(const _K2& __k)       {return __tree_.__equal_range_multi(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
+    equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+#endif
+
+private:
+    typedef typename __base::__node                    __node;
+    typedef typename __base::__node_allocator          __node_allocator;
+    typedef typename __base::__node_pointer            __node_pointer;
+    typedef typename __base::__node_const_pointer      __node_const_pointer;
+    typedef __map_node_destructor<__node_allocator> _Dp;
+    typedef unique_ptr<__node, _Dp> __node_holder;
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __node_holder __construct_node();
+    template <class _A0>
+        __node_holder
+         __construct_node(_A0&& __a0);
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class _A0, class _A1, class ..._Args>
+        __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
+    : __tree_(_VSTD::move(__m.__tree_), __a)
+{
+    if (__a != __m.get_allocator())
+    {
+        const_iterator __e = cend();
+        while (!__m.empty())
+            __tree_.__insert_multi(__e.__i_,
+                    _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
+    }
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
+multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
+{
+    __node_allocator& __na = __tree_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first));
+    __h.get_deleter().__first_constructed = true;
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+template <class _A0>
+typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
+multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
+{
+    __node_allocator& __na = __tree_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
+    __h.get_deleter().__first_constructed = true;
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+template <class _A0, class _A1, class ..._Args>
+typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
+multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args)
+{
+    __node_allocator& __na = __tree_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_),
+                             _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
+                             _VSTD::forward<_Args>(__args)...);
+    __h.get_deleter().__first_constructed = true;
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+template <class ..._Args>
+typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
+multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    iterator __r = __tree_.__node_insert_multi(__h.get());
+    __h.release();
+    return __r;
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+template <class ..._Args>
+typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
+multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
+                                                        _Args&& ...__args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    iterator __r = __tree_.__node_insert_multi(__p.__i_, __h.get());
+    __h.release();
+    return __r;
+}
+
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
+           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
+           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
+           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
+           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
+           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
+           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x,
+     multimap<_Key, _Tp, _Compare, _Allocator>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_MAP

Property changes on: lab4/.minix-src/include/c++/map
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/algorithm
===================================================================
--- lab4/.minix-src/include/c++/algorithm	(nonexistent)
+++ lab4/.minix-src/include/c++/algorithm	(revision 13)
@@ -0,0 +1,5777 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_ALGORITHM
+#define _LIBCPP_ALGORITHM
+
+/*
+    algorithm synopsis
+
+#include <initializer_list>
+
+namespace std
+{
+
+template <class InputIterator, class Predicate>
+    bool
+    all_of(InputIterator first, InputIterator last, Predicate pred);
+
+template <class InputIterator, class Predicate>
+    bool
+    any_of(InputIterator first, InputIterator last, Predicate pred);
+
+template <class InputIterator, class Predicate>
+    bool
+    none_of(InputIterator first, InputIterator last, Predicate pred);
+
+template <class InputIterator, class Function>
+    Function
+    for_each(InputIterator first, InputIterator last, Function f);
+
+template <class InputIterator, class T>
+    InputIterator
+    find(InputIterator first, InputIterator last, const T& value);
+
+template <class InputIterator, class Predicate>
+    InputIterator
+    find_if(InputIterator first, InputIterator last, Predicate pred);
+
+template<class InputIterator, class Predicate>
+    InputIterator
+    find_if_not(InputIterator first, InputIterator last, Predicate pred);
+
+template <class ForwardIterator1, class ForwardIterator2>
+    ForwardIterator1
+    find_end(ForwardIterator1 first1, ForwardIterator1 last1,
+             ForwardIterator2 first2, ForwardIterator2 last2);
+
+template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
+    ForwardIterator1
+    find_end(ForwardIterator1 first1, ForwardIterator1 last1,
+             ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
+
+template <class ForwardIterator1, class ForwardIterator2>
+    ForwardIterator1
+    find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
+                  ForwardIterator2 first2, ForwardIterator2 last2);
+
+template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
+    ForwardIterator1
+    find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
+                  ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
+
+template <class ForwardIterator>
+    ForwardIterator
+    adjacent_find(ForwardIterator first, ForwardIterator last);
+
+template <class ForwardIterator, class BinaryPredicate>
+    ForwardIterator
+    adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
+
+template <class InputIterator, class T>
+    typename iterator_traits<InputIterator>::difference_type
+    count(InputIterator first, InputIterator last, const T& value);
+
+template <class InputIterator, class Predicate>
+    typename iterator_traits<InputIterator>::difference_type
+    count_if(InputIterator first, InputIterator last, Predicate pred);
+
+template <class InputIterator1, class InputIterator2>
+    pair<InputIterator1, InputIterator2>
+    mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
+
+template <class InputIterator1, class InputIterator2>
+    pair<InputIterator1, InputIterator2>
+    mismatch(InputIterator1 first1, InputIterator1 last1, 
+             InputIterator2 first2, InputIterator2 last2); // **C++14**
+
+template <class InputIterator1, class InputIterator2, class BinaryPredicate>
+    pair<InputIterator1, InputIterator2>
+    mismatch(InputIterator1 first1, InputIterator1 last1,
+             InputIterator2 first2, BinaryPredicate pred);
+
+template <class InputIterator1, class InputIterator2, class BinaryPredicate>
+    pair<InputIterator1, InputIterator2>
+    mismatch(InputIterator1 first1, InputIterator1 last1,
+             InputIterator2 first2, InputIterator2 last2,
+             BinaryPredicate pred); // **C++14**
+
+template <class InputIterator1, class InputIterator2>
+    bool
+    equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
+
+template <class InputIterator1, class InputIterator2>
+    bool
+    equal(InputIterator1 first1, InputIterator1 last1, 
+          InputIterator2 first2, InputIterator2 last2); // **C++14**
+
+template <class InputIterator1, class InputIterator2, class BinaryPredicate>
+    bool
+    equal(InputIterator1 first1, InputIterator1 last1,
+          InputIterator2 first2, BinaryPredicate pred);
+
+template <class InputIterator1, class InputIterator2, class BinaryPredicate>
+    bool
+    equal(InputIterator1 first1, InputIterator1 last1,
+          InputIterator2 first2, InputIterator2 last2,
+          BinaryPredicate pred); // **C++14**
+
+template<class ForwardIterator1, class ForwardIterator2>
+    bool
+    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
+                   ForwardIterator2 first2);
+
+template<class ForwardIterator1, class ForwardIterator2>
+    bool
+    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
+                   ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
+
+template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
+    bool
+    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
+                   ForwardIterator2 first2, BinaryPredicate pred);
+
+template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
+    bool
+    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
+                   ForwardIterator2 first2, ForwardIterator2 last2,
+                   BinaryPredicate pred);  // **C++14**
+
+template <class ForwardIterator1, class ForwardIterator2>
+    ForwardIterator1
+    search(ForwardIterator1 first1, ForwardIterator1 last1,
+           ForwardIterator2 first2, ForwardIterator2 last2);
+
+template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
+    ForwardIterator1
+    search(ForwardIterator1 first1, ForwardIterator1 last1,
+           ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
+
+template <class ForwardIterator, class Size, class T>
+    ForwardIterator
+    search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
+
+template <class ForwardIterator, class Size, class T, class BinaryPredicate>
+    ForwardIterator
+    search_n(ForwardIterator first, ForwardIterator last,
+             Size count, const T& value, BinaryPredicate pred);
+
+template <class InputIterator, class OutputIterator>
+    OutputIterator
+    copy(InputIterator first, InputIterator last, OutputIterator result);
+
+template<class InputIterator, class OutputIterator, class Predicate>
+    OutputIterator
+    copy_if(InputIterator first, InputIterator last,
+            OutputIterator result, Predicate pred);
+
+template<class InputIterator, class Size, class OutputIterator>
+    OutputIterator
+    copy_n(InputIterator first, Size n, OutputIterator result);
+
+template <class BidirectionalIterator1, class BidirectionalIterator2>
+    BidirectionalIterator2
+    copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
+                  BidirectionalIterator2 result);
+
+template <class ForwardIterator1, class ForwardIterator2>
+    ForwardIterator2
+    swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
+
+template <class ForwardIterator1, class ForwardIterator2>
+    void
+    iter_swap(ForwardIterator1 a, ForwardIterator2 b);
+
+template <class InputIterator, class OutputIterator, class UnaryOperation>
+    OutputIterator
+    transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
+    OutputIterator
+    transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
+              OutputIterator result, BinaryOperation binary_op);
+
+template <class ForwardIterator, class T>
+    void
+    replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
+
+template <class ForwardIterator, class Predicate, class T>
+    void
+    replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
+
+template <class InputIterator, class OutputIterator, class T>
+    OutputIterator
+    replace_copy(InputIterator first, InputIterator last, OutputIterator result,
+                 const T& old_value, const T& new_value);
+
+template <class InputIterator, class OutputIterator, class Predicate, class T>
+    OutputIterator
+    replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
+
+template <class ForwardIterator, class T>
+    void
+    fill(ForwardIterator first, ForwardIterator last, const T& value);
+
+template <class OutputIterator, class Size, class T>
+    OutputIterator
+    fill_n(OutputIterator first, Size n, const T& value);
+
+template <class ForwardIterator, class Generator>
+    void
+    generate(ForwardIterator first, ForwardIterator last, Generator gen);
+
+template <class OutputIterator, class Size, class Generator>
+    OutputIterator
+    generate_n(OutputIterator first, Size n, Generator gen);
+
+template <class ForwardIterator, class T>
+    ForwardIterator
+    remove(ForwardIterator first, ForwardIterator last, const T& value);
+
+template <class ForwardIterator, class Predicate>
+    ForwardIterator
+    remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
+
+template <class InputIterator, class OutputIterator, class T>
+    OutputIterator
+    remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
+
+template <class InputIterator, class OutputIterator, class Predicate>
+    OutputIterator
+    remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
+
+template <class ForwardIterator>
+    ForwardIterator
+    unique(ForwardIterator first, ForwardIterator last);
+
+template <class ForwardIterator, class BinaryPredicate>
+    ForwardIterator
+    unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
+
+template <class InputIterator, class OutputIterator>
+    OutputIterator
+    unique_copy(InputIterator first, InputIterator last, OutputIterator result);
+
+template <class InputIterator, class OutputIterator, class BinaryPredicate>
+    OutputIterator
+    unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
+
+template <class BidirectionalIterator>
+    void
+    reverse(BidirectionalIterator first, BidirectionalIterator last);
+
+template <class BidirectionalIterator, class OutputIterator>
+    OutputIterator
+    reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
+
+template <class ForwardIterator>
+    ForwardIterator
+    rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
+
+template <class ForwardIterator, class OutputIterator>
+    OutputIterator
+    rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
+
+template <class RandomAccessIterator>
+    void
+    random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14
+
+template <class RandomAccessIterator, class RandomNumberGenerator>
+    void
+    random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
+                   RandomNumberGenerator& rand);  // deprecated in C++14
+
+template<class RandomAccessIterator, class UniformRandomNumberGenerator>
+    void shuffle(RandomAccessIterator first, RandomAccessIterator last,
+                 UniformRandomNumberGenerator&& g);
+
+template <class InputIterator, class Predicate>
+    bool
+    is_partitioned(InputIterator first, InputIterator last, Predicate pred);
+
+template <class ForwardIterator, class Predicate>
+    ForwardIterator
+    partition(ForwardIterator first, ForwardIterator last, Predicate pred);
+
+template <class InputIterator, class OutputIterator1,
+          class OutputIterator2, class Predicate>
+    pair<OutputIterator1, OutputIterator2>
+    partition_copy(InputIterator first, InputIterator last,
+                   OutputIterator1 out_true, OutputIterator2 out_false,
+                   Predicate pred);
+
+template <class ForwardIterator, class Predicate>
+    ForwardIterator
+    stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
+
+template<class ForwardIterator, class Predicate>
+    ForwardIterator
+    partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
+
+template <class ForwardIterator>
+    bool
+    is_sorted(ForwardIterator first, ForwardIterator last);
+
+template <class ForwardIterator, class Compare>
+    bool
+    is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
+
+template<class ForwardIterator>
+    ForwardIterator
+    is_sorted_until(ForwardIterator first, ForwardIterator last);
+
+template <class ForwardIterator, class Compare>
+    ForwardIterator
+    is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
+
+template <class RandomAccessIterator>
+    void
+    sort(RandomAccessIterator first, RandomAccessIterator last);
+
+template <class RandomAccessIterator, class Compare>
+    void
+    sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
+
+template <class RandomAccessIterator>
+    void
+    stable_sort(RandomAccessIterator first, RandomAccessIterator last);
+
+template <class RandomAccessIterator, class Compare>
+    void
+    stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
+
+template <class RandomAccessIterator>
+    void
+    partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
+
+template <class RandomAccessIterator, class Compare>
+    void
+    partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
+
+template <class InputIterator, class RandomAccessIterator>
+    RandomAccessIterator
+    partial_sort_copy(InputIterator first, InputIterator last,
+                      RandomAccessIterator result_first, RandomAccessIterator result_last);
+
+template <class InputIterator, class RandomAccessIterator, class Compare>
+    RandomAccessIterator
+    partial_sort_copy(InputIterator first, InputIterator last,
+                      RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
+
+template <class RandomAccessIterator>
+    void
+    nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
+
+template <class RandomAccessIterator, class Compare>
+    void
+    nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
+
+template <class ForwardIterator, class T>
+    ForwardIterator
+    lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
+
+template <class ForwardIterator, class T, class Compare>
+    ForwardIterator
+    lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
+
+template <class ForwardIterator, class T>
+    ForwardIterator
+    upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
+
+template <class ForwardIterator, class T, class Compare>
+    ForwardIterator
+    upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
+
+template <class ForwardIterator, class T>
+    pair<ForwardIterator, ForwardIterator>
+    equal_range(ForwardIterator first, ForwardIterator last, const T& value);
+
+template <class ForwardIterator, class T, class Compare>
+    pair<ForwardIterator, ForwardIterator>
+    equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
+
+template <class ForwardIterator, class T>
+    bool
+    binary_search(ForwardIterator first, ForwardIterator last, const T& value);
+
+template <class ForwardIterator, class T, class Compare>
+    bool
+    binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator>
+    OutputIterator
+    merge(InputIterator1 first1, InputIterator1 last1,
+          InputIterator2 first2, InputIterator2 last2, OutputIterator result);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
+    OutputIterator
+    merge(InputIterator1 first1, InputIterator1 last1,
+          InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
+
+template <class BidirectionalIterator>
+    void
+    inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
+
+template <class BidirectionalIterator, class Compare>
+    void
+    inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
+
+template <class InputIterator1, class InputIterator2>
+    bool
+    includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
+
+template <class InputIterator1, class InputIterator2, class Compare>
+    bool
+    includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator>
+    OutputIterator
+    set_union(InputIterator1 first1, InputIterator1 last1,
+              InputIterator2 first2, InputIterator2 last2, OutputIterator result);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
+    OutputIterator
+    set_union(InputIterator1 first1, InputIterator1 last1,
+              InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator>
+    OutputIterator
+    set_intersection(InputIterator1 first1, InputIterator1 last1,
+                     InputIterator2 first2, InputIterator2 last2, OutputIterator result);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
+    OutputIterator
+    set_intersection(InputIterator1 first1, InputIterator1 last1,
+                     InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator>
+    OutputIterator
+    set_difference(InputIterator1 first1, InputIterator1 last1,
+                   InputIterator2 first2, InputIterator2 last2, OutputIterator result);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
+    OutputIterator
+    set_difference(InputIterator1 first1, InputIterator1 last1,
+                   InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator>
+    OutputIterator
+    set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
+                             InputIterator2 first2, InputIterator2 last2, OutputIterator result);
+
+template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
+    OutputIterator
+    set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
+                             InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
+
+template <class RandomAccessIterator>
+    void
+    push_heap(RandomAccessIterator first, RandomAccessIterator last);
+
+template <class RandomAccessIterator, class Compare>
+    void
+    push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
+
+template <class RandomAccessIterator>
+    void
+    pop_heap(RandomAccessIterator first, RandomAccessIterator last);
+
+template <class RandomAccessIterator, class Compare>
+    void
+    pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
+
+template <class RandomAccessIterator>
+    void
+    make_heap(RandomAccessIterator first, RandomAccessIterator last);
+
+template <class RandomAccessIterator, class Compare>
+    void
+    make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
+
+template <class RandomAccessIterator>
+    void
+    sort_heap(RandomAccessIterator first, RandomAccessIterator last);
+
+template <class RandomAccessIterator, class Compare>
+    void
+    sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
+
+template <class RandomAccessIterator>
+    bool
+    is_heap(RandomAccessIterator first, RandomAccessiterator last);
+
+template <class RandomAccessIterator, class Compare>
+    bool
+    is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
+
+template <class RandomAccessIterator>
+    RandomAccessIterator
+    is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
+
+template <class RandomAccessIterator, class Compare>
+    RandomAccessIterator
+    is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
+
+template <class ForwardIterator>
+    ForwardIterator
+    min_element(ForwardIterator first, ForwardIterator last);  // constexpr in C++14
+
+template <class ForwardIterator, class Compare>
+    ForwardIterator
+    min_element(ForwardIterator first, ForwardIterator last, Compare comp);  // constexpr in C++14
+
+template <class T>
+    const T&
+    min(const T& a, const T& b);  // constexpr in C++14
+
+template <class T, class Compare>
+    const T&
+    min(const T& a, const T& b, Compare comp);  // constexpr in C++14
+
+template<class T>
+    T
+    min(initializer_list<T> t);  // constexpr in C++14
+
+template<class T, class Compare>
+    T
+    min(initializer_list<T> t, Compare comp);  // constexpr in C++14
+
+template <class ForwardIterator>
+    ForwardIterator
+    max_element(ForwardIterator first, ForwardIterator last);  // constexpr in C++14
+
+template <class ForwardIterator, class Compare>
+    ForwardIterator
+    max_element(ForwardIterator first, ForwardIterator last, Compare comp);  // constexpr in C++14
+
+template <class T>
+    const T&
+    max(const T& a, const T& b); // constexpr in C++14
+
+template <class T, class Compare>
+    const T&
+    max(const T& a, const T& b, Compare comp);  // constexpr in C++14
+
+template<class T>
+    T
+    max(initializer_list<T> t);  // constexpr in C++14
+
+template<class T, class Compare>
+    T
+    max(initializer_list<T> t, Compare comp);  // constexpr in C++14
+
+template<class ForwardIterator>
+    pair<ForwardIterator, ForwardIterator>
+    minmax_element(ForwardIterator first, ForwardIterator last);   // constexpr in C++14
+
+template<class ForwardIterator, class Compare>
+    pair<ForwardIterator, ForwardIterator>
+    minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);   // constexpr in C++14
+
+template<class T>
+    pair<const T&, const T&>
+    minmax(const T& a, const T& b);  // constexpr in C++14
+
+template<class T, class Compare>
+    pair<const T&, const T&>
+    minmax(const T& a, const T& b, Compare comp);  // constexpr in C++14
+
+template<class T>
+    pair<T, T>
+    minmax(initializer_list<T> t);  // constexpr in C++14
+
+template<class T, class Compare>
+    pair<T, T>
+    minmax(initializer_list<T> t, Compare comp);  // constexpr in C++14
+
+template <class InputIterator1, class InputIterator2>
+    bool
+    lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
+
+template <class InputIterator1, class InputIterator2, class Compare>
+    bool
+    lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
+                            InputIterator2 first2, InputIterator2 last2, Compare comp);
+
+template <class BidirectionalIterator>
+    bool
+    next_permutation(BidirectionalIterator first, BidirectionalIterator last);
+
+template <class BidirectionalIterator, class Compare>
+    bool
+    next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
+
+template <class BidirectionalIterator>
+    bool
+    prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
+
+template <class BidirectionalIterator, class Compare>
+    bool
+    prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <initializer_list>
+#include <type_traits>
+#include <cstring>
+#include <utility>
+#include <memory>
+#include <iterator>
+#include <cstddef>
+
+#if defined(__IBMCPP__)
+#include "support/ibm/support.h"
+#endif
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+#include "support/win32/support.h"
+#endif
+
+#include <__undef_min_max>
+
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// I'd like to replace these with _VSTD::equal_to<void>, but can't because:
+//   * That only works with C++14 and later, and
+//   * We haven't included <functional> here.
+template <class _T1, class _T2 = _T1>
+struct __equal_to
+{
+    _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
+    _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T2& __y) const {return __x == __y;}
+    _LIBCPP_INLINE_VISIBILITY bool operator()(const _T2& __x, const _T1& __y) const {return __x == __y;}
+    _LIBCPP_INLINE_VISIBILITY bool operator()(const _T2& __x, const _T2& __y) const {return __x == __y;}
+};
+
+template <class _T1>
+struct __equal_to<_T1, _T1>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
+};
+
+template <class _T1>
+struct __equal_to<const _T1, _T1>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
+};
+
+template <class _T1>
+struct __equal_to<_T1, const _T1>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
+};
+
+template <class _T1, class _T2 = _T1>
+struct __less
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 
+    bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _T1& __x, const _T2& __y) const {return __x < __y;}
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _T2& __x, const _T1& __y) const {return __x < __y;}
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _T2& __x, const _T2& __y) const {return __x < __y;}
+};
+
+template <class _T1>
+struct __less<_T1, _T1>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
+};
+
+template <class _T1>
+struct __less<const _T1, _T1>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
+};
+
+template <class _T1>
+struct __less<_T1, const _T1>
+{
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
+};
+
+template <class _Predicate>
+class __negate
+{
+private:
+    _Predicate __p_;
+public:
+    _LIBCPP_INLINE_VISIBILITY __negate() {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __negate(_Predicate __p) : __p_(__p) {}
+
+    template <class _T1>
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _T1& __x) {return !__p_(__x);}
+
+    template <class _T1, class _T2>
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _T1& __x, const _T2& __y) {return !__p_(__x, __y);}
+};
+
+#ifdef _LIBCPP_DEBUG
+
+template <class _Compare>
+struct __debug_less
+{
+    _Compare __comp_;
+    __debug_less(_Compare& __c) : __comp_(__c) {}
+    template <class _Tp, class _Up>
+    bool operator()(const _Tp& __x, const _Up& __y)
+    {
+        bool __r = __comp_(__x, __y);
+        if (__r)
+            _LIBCPP_ASSERT(!__comp_(__y, __x), "Comparator does not induce a strict weak ordering");
+        return __r;
+    }
+};
+
+#endif  // _LIBCPP_DEBUG
+
+// Precondition:  __x != 0
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned
+__ctz(unsigned __x)
+{
+    return static_cast<unsigned>(__builtin_ctz(__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long
+__ctz(unsigned long __x)
+{
+    return static_cast<unsigned long>(__builtin_ctzl(__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long long
+__ctz(unsigned long long __x)
+{
+    return static_cast<unsigned long long>(__builtin_ctzll(__x));
+}
+
+// Precondition:  __x != 0
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned
+__clz(unsigned __x)
+{
+    return static_cast<unsigned>(__builtin_clz(__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long
+__clz(unsigned long __x)
+{
+    return static_cast<unsigned long>(__builtin_clzl (__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long long
+__clz(unsigned long long __x)
+{
+    return static_cast<unsigned long long>(__builtin_clzll(__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned           __x) {return __builtin_popcount  (__x);}
+inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned      long __x) {return __builtin_popcountl (__x);}
+inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {return __builtin_popcountll(__x);}
+
+// all_of
+
+template <class _InputIterator, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+{
+    for (; __first != __last; ++__first)
+        if (!__pred(*__first))
+            return false;
+    return true;
+}
+
+// any_of
+
+template <class _InputIterator, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+{
+    for (; __first != __last; ++__first)
+        if (__pred(*__first))
+            return true;
+    return false;
+}
+
+// none_of
+
+template <class _InputIterator, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+{
+    for (; __first != __last; ++__first)
+        if (__pred(*__first))
+            return false;
+    return true;
+}
+
+// for_each
+
+template <class _InputIterator, class _Function>
+inline _LIBCPP_INLINE_VISIBILITY
+_Function
+for_each(_InputIterator __first, _InputIterator __last, _Function __f)
+{
+    for (; __first != __last; ++__first)
+        __f(*__first);
+    return _LIBCPP_EXPLICIT_MOVE(__f);  // explicitly moved for (emulated) C++03
+}
+
+// find
+
+template <class _InputIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_InputIterator
+find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
+{
+    for (; __first != __last; ++__first)
+        if (*__first == __value_)
+            break;
+    return __first;
+}
+
+// find_if
+
+template <class _InputIterator, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_InputIterator
+find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+{
+    for (; __first != __last; ++__first)
+        if (__pred(*__first))
+            break;
+    return __first;
+}
+
+// find_if_not
+
+template<class _InputIterator, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_InputIterator
+find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+{
+    for (; __first != __last; ++__first)
+        if (!__pred(*__first))
+            break;
+    return __first;
+}
+
+// find_end
+
+template <class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2>
+_ForwardIterator1
+__find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+           _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred,
+           forward_iterator_tag, forward_iterator_tag)
+{
+    // modeled after search algorithm
+    _ForwardIterator1 __r = __last1;  // __last1 is the "default" answer
+    if (__first2 == __last2)
+        return __r;
+    while (true)
+    {
+        while (true)
+        {
+            if (__first1 == __last1)         // if source exhausted return last correct answer
+                return __r;                  //    (or __last1 if never found)
+            if (__pred(*__first1, *__first2))
+                break;
+            ++__first1;
+        }
+        // *__first1 matches *__first2, now match elements after here
+        _ForwardIterator1 __m1 = __first1;
+        _ForwardIterator2 __m2 = __first2;
+        while (true)
+        {
+            if (++__m2 == __last2)
+            {                         // Pattern exhaused, record answer and search for another one
+                __r = __first1;
+                ++__first1;
+                break;
+            }
+            if (++__m1 == __last1)     // Source exhausted, return last answer
+                return __r;
+            if (!__pred(*__m1, *__m2))  // mismatch, restart with a new __first
+            {
+                ++__first1;
+                break;
+            }  // else there is a match, check next elements
+        }
+    }
+}
+
+template <class _BinaryPredicate, class _BidirectionalIterator1, class _BidirectionalIterator2>
+_BidirectionalIterator1
+__find_end(_BidirectionalIterator1 __first1, _BidirectionalIterator1 __last1,
+           _BidirectionalIterator2 __first2, _BidirectionalIterator2 __last2, _BinaryPredicate __pred,
+           bidirectional_iterator_tag, bidirectional_iterator_tag)
+{
+    // modeled after search algorithm (in reverse)
+    if (__first2 == __last2)
+        return __last1;  // Everything matches an empty sequence
+    _BidirectionalIterator1 __l1 = __last1;
+    _BidirectionalIterator2 __l2 = __last2;
+    --__l2;
+    while (true)
+    {
+        // Find last element in sequence 1 that matchs *(__last2-1), with a mininum of loop checks
+        while (true)
+        {
+            if (__first1 == __l1)  // return __last1 if no element matches *__first2
+                return __last1;
+            if (__pred(*--__l1, *__l2))
+                break;
+        }
+        // *__l1 matches *__l2, now match elements before here
+        _BidirectionalIterator1 __m1 = __l1;
+        _BidirectionalIterator2 __m2 = __l2;
+        while (true)
+        {
+            if (__m2 == __first2)  // If pattern exhausted, __m1 is the answer (works for 1 element pattern)
+                return __m1;
+            if (__m1 == __first1)  // Otherwise if source exhaused, pattern not found
+                return __last1;
+            if (!__pred(*--__m1, *--__m2))  // if there is a mismatch, restart with a new __l1
+            {
+                break;
+            }  // else there is a match, check next elements
+        }
+    }
+}
+
+template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
+_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1
+__find_end(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
+           _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred,
+           random_access_iterator_tag, random_access_iterator_tag)
+{
+    // Take advantage of knowing source and pattern lengths.  Stop short when source is smaller than pattern
+    typename iterator_traits<_RandomAccessIterator2>::difference_type __len2 = __last2 - __first2;
+    if (__len2 == 0)
+        return __last1;
+    typename iterator_traits<_RandomAccessIterator1>::difference_type __len1 = __last1 - __first1;
+    if (__len1 < __len2)
+        return __last1;
+    const _RandomAccessIterator1 __s = __first1 + (__len2 - 1);  // End of pattern match can't go before here
+    _RandomAccessIterator1 __l1 = __last1;
+    _RandomAccessIterator2 __l2 = __last2;
+    --__l2;
+    while (true)
+    {
+        while (true)
+        {
+            if (__s == __l1)
+                return __last1;
+            if (__pred(*--__l1, *__l2))
+                break;
+        }
+        _RandomAccessIterator1 __m1 = __l1;
+        _RandomAccessIterator2 __m2 = __l2;
+        while (true)
+        {
+            if (__m2 == __first2)
+                return __m1;
+                                 // no need to check range on __m1 because __s guarantees we have enough source
+            if (!__pred(*--__m1, *--__m2))
+            {
+                break;
+            }
+        }
+    }
+}
+
+template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator1
+find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+         _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
+{
+    return _VSTD::__find_end<typename add_lvalue_reference<_BinaryPredicate>::type>
+                         (__first1, __last1, __first2, __last2, __pred,
+                          typename iterator_traits<_ForwardIterator1>::iterator_category(),
+                          typename iterator_traits<_ForwardIterator2>::iterator_category());
+}
+
+template <class _ForwardIterator1, class _ForwardIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator1
+find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+         _ForwardIterator2 __first2, _ForwardIterator2 __last2)
+{
+    typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
+    typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
+    return _VSTD::find_end(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
+}
+
+// find_first_of
+
+template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
+_LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator1
+__find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+              _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
+{
+    for (; __first1 != __last1; ++__first1)
+        for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j)
+            if (__pred(*__first1, *__j))
+                return __first1;
+    return __last1;
+}
+
+
+template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator1
+find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+              _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
+{
+    return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred);
+}
+
+template <class _ForwardIterator1, class _ForwardIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator1
+find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+              _ForwardIterator2 __first2, _ForwardIterator2 __last2)
+{
+    typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
+    typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
+    return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
+}
+
+// adjacent_find
+
+template <class _ForwardIterator, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __i = __first;
+        while (++__i != __last)
+        {
+            if (__pred(*__first, *__i))
+                return __first;
+            __first = __i;
+        }
+    }
+    return __last;
+}
+
+template <class _ForwardIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
+{
+    typedef typename iterator_traits<_ForwardIterator>::value_type __v;
+    return _VSTD::adjacent_find(__first, __last, __equal_to<__v>());
+}
+
+// count
+
+template <class _InputIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename iterator_traits<_InputIterator>::difference_type
+count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
+{
+    typename iterator_traits<_InputIterator>::difference_type __r(0);
+    for (; __first != __last; ++__first)
+        if (*__first == __value_)
+            ++__r;
+    return __r;
+}
+
+// count_if
+
+template <class _InputIterator, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+typename iterator_traits<_InputIterator>::difference_type
+count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+{
+    typename iterator_traits<_InputIterator>::difference_type __r(0);
+    for (; __first != __last; ++__first)
+        if (__pred(*__first))
+            ++__r;
+    return __r;
+}
+
+// mismatch
+
+template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
+         _InputIterator2 __first2, _BinaryPredicate __pred)
+{
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
+        if (!__pred(*__first1, *__first2))
+            break;
+    return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
+}
+
+template <class _InputIterator1, class _InputIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)
+{
+    typedef typename iterator_traits<_InputIterator1>::value_type __v1;
+    typedef typename iterator_traits<_InputIterator2>::value_type __v2;
+    return _VSTD::mismatch(__first1, __last1, __first2, __equal_to<__v1, __v2>());
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
+         _InputIterator2 __first2, _InputIterator2 __last2,
+         _BinaryPredicate __pred)
+{
+    for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2)
+        if (!__pred(*__first1, *__first2))
+            break;
+    return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
+}
+
+template <class _InputIterator1, class _InputIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
+         _InputIterator2 __first2, _InputIterator2 __last2)
+{
+    typedef typename iterator_traits<_InputIterator1>::value_type __v1;
+    typedef typename iterator_traits<_InputIterator2>::value_type __v2;
+    return _VSTD::mismatch(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
+}
+#endif
+
+// equal
+
+template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred)
+{
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
+        if (!__pred(*__first1, *__first2))
+            return false;
+    return true;
+}
+
+template <class _InputIterator1, class _InputIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)
+{
+    typedef typename iterator_traits<_InputIterator1>::value_type __v1;
+    typedef typename iterator_traits<_InputIterator2>::value_type __v2;
+    return _VSTD::equal(__first1, __last1, __first2, __equal_to<__v1, __v2>());
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _BinaryPredicate, class _InputIterator1, class _InputIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+__equal(_InputIterator1 __first1, _InputIterator1 __last1, 
+        _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred,
+        input_iterator_tag, input_iterator_tag )
+{
+    for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2)
+        if (!__pred(*__first1, *__first2))
+            return false;
+    return __first1 == __last1 && __first2 == __last2;
+}
+
+template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+__equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, 
+        _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred, 
+      random_access_iterator_tag, random_access_iterator_tag )
+{
+    if ( _VSTD::distance(__first1, __last1) != _VSTD::distance(__first2, __last2))
+        return false;
+    return _VSTD::equal<_RandomAccessIterator1, _RandomAccessIterator2,
+                        typename add_lvalue_reference<_BinaryPredicate>::type>
+                       (__first1, __last1, __first2, __pred );
+}
+
+template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+equal(_InputIterator1 __first1, _InputIterator1 __last1, 
+      _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred )
+{
+    return _VSTD::__equal<typename add_lvalue_reference<_BinaryPredicate>::type>
+       (__first1, __last1, __first2, __last2, __pred, 
+        typename iterator_traits<_InputIterator1>::iterator_category(),
+        typename iterator_traits<_InputIterator2>::iterator_category());
+}
+
+template <class _InputIterator1, class _InputIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+equal(_InputIterator1 __first1, _InputIterator1 __last1, 
+      _InputIterator2 __first2, _InputIterator2 __last2)
+{
+    typedef typename iterator_traits<_InputIterator1>::value_type __v1;
+    typedef typename iterator_traits<_InputIterator2>::value_type __v2;
+    return _VSTD::__equal(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>(),
+        typename iterator_traits<_InputIterator1>::iterator_category(),
+        typename iterator_traits<_InputIterator2>::iterator_category());
+}
+#endif
+
+// is_permutation
+
+template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
+bool
+is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+               _ForwardIterator2 __first2, _BinaryPredicate __pred)
+{
+    // shorten sequences as much as possible by lopping of any equal parts
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
+        if (!__pred(*__first1, *__first2))
+            goto __not_done;
+    return true;
+__not_done:
+    // __first1 != __last1 && *__first1 != *__first2
+    typedef typename iterator_traits<_ForwardIterator1>::difference_type _D1;
+    _D1 __l1 = _VSTD::distance(__first1, __last1);
+    if (__l1 == _D1(1))
+        return false;
+    _ForwardIterator2 __last2 = _VSTD::next(__first2, __l1);
+    // For each element in [f1, l1) see if there are the same number of
+    //    equal elements in [f2, l2)
+    for (_ForwardIterator1 __i = __first1; __i != __last1; ++__i)
+    {
+        // Have we already counted the number of *__i in [f1, l1)?
+        for (_ForwardIterator1 __j = __first1; __j != __i; ++__j)
+            if (__pred(*__j, *__i))
+                goto __next_iter;
+        {
+            // Count number of *__i in [f2, l2)
+            _D1 __c2 = 0;
+            for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j)
+                if (__pred(*__i, *__j))
+                    ++__c2;
+            if (__c2 == 0)
+                return false;
+            // Count number of *__i in [__i, l1) (we can start with 1)
+            _D1 __c1 = 1;
+            for (_ForwardIterator1 __j = _VSTD::next(__i); __j != __last1; ++__j)
+                if (__pred(*__i, *__j))
+                    ++__c1;
+            if (__c1 != __c2)
+                return false;
+        }
+__next_iter:;
+    }
+    return true;
+}
+
+template<class _ForwardIterator1, class _ForwardIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+               _ForwardIterator2 __first2)
+{
+    typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
+    typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
+    return _VSTD::is_permutation(__first1, __last1, __first2, __equal_to<__v1, __v2>());
+}
+
+#if _LIBCPP_STD_VER > 11
+template<class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2>
+bool
+__is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+                 _ForwardIterator2 __first2, _ForwardIterator2 __last2, 
+                 _BinaryPredicate __pred,
+                 forward_iterator_tag, forward_iterator_tag )
+{
+    // shorten sequences as much as possible by lopping of any equal parts
+    for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2)
+        if (!__pred(*__first1, *__first2))
+            goto __not_done;
+    return __first1 == __last1 && __first2 == __last2;
+__not_done:
+    // __first1 != __last1 && __first2 != __last2 && *__first1 != *__first2
+    typedef typename iterator_traits<_ForwardIterator1>::difference_type _D1;
+    _D1 __l1 = _VSTD::distance(__first1, __last1);
+
+    typedef typename iterator_traits<_ForwardIterator2>::difference_type _D2;
+    _D2 __l2 = _VSTD::distance(__first2, __last2);
+    if (__l1 != __l2)
+        return false;
+
+    // For each element in [f1, l1) see if there are the same number of
+    //    equal elements in [f2, l2)
+    for (_ForwardIterator1 __i = __first1; __i != __last1; ++__i)
+    {
+        // Have we already counted the number of *__i in [f1, l1)?
+        for (_ForwardIterator1 __j = __first1; __j != __i; ++__j)
+            if (__pred(*__j, *__i))
+                goto __next_iter;
+        {
+            // Count number of *__i in [f2, l2)
+            _D1 __c2 = 0;
+            for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j)
+                if (__pred(*__i, *__j))
+                    ++__c2;
+            if (__c2 == 0)
+                return false;
+            // Count number of *__i in [__i, l1) (we can start with 1)
+            _D1 __c1 = 1;
+            for (_ForwardIterator1 __j = _VSTD::next(__i); __j != __last1; ++__j)
+                if (__pred(*__i, *__j))
+                    ++__c1;
+            if (__c1 != __c2)
+                return false;
+        }
+__next_iter:;
+    }
+    return true;
+}
+
+template<class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
+bool
+__is_permutation(_RandomAccessIterator1 __first1, _RandomAccessIterator2 __last1,
+               _RandomAccessIterator1 __first2, _RandomAccessIterator2 __last2, 
+               _BinaryPredicate __pred,
+               random_access_iterator_tag, random_access_iterator_tag )
+{
+    if ( _VSTD::distance(__first1, __last1) != _VSTD::distance(__first2, __last2))
+        return false;
+    return _VSTD::is_permutation<_RandomAccessIterator1, _RandomAccessIterator2,
+                                 typename add_lvalue_reference<_BinaryPredicate>::type>
+                                (__first1, __last1, __first2, __pred );
+}
+
+template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+               _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+               _BinaryPredicate __pred )
+{
+    return _VSTD::__is_permutation<typename add_lvalue_reference<_BinaryPredicate>::type>
+       (__first1, __last1, __first2, __last2, __pred,
+        typename iterator_traits<_ForwardIterator1>::iterator_category(),
+        typename iterator_traits<_ForwardIterator2>::iterator_category());
+}
+
+template<class _ForwardIterator1, class _ForwardIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+               _ForwardIterator2 __first2, _ForwardIterator2 __last2)
+{
+    typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
+    typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
+    return _VSTD::__is_permutation(__first1, __last1, __first2, __last2,
+        __equal_to<__v1, __v2>(),
+        typename iterator_traits<_ForwardIterator1>::iterator_category(),
+        typename iterator_traits<_ForwardIterator2>::iterator_category());
+}
+#endif
+
+// search
+
+template <class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2>
+_ForwardIterator1
+__search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+         _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred,
+         forward_iterator_tag, forward_iterator_tag)
+{
+    if (__first2 == __last2)
+        return __first1;  // Everything matches an empty sequence
+    while (true)
+    {
+        // Find first element in sequence 1 that matchs *__first2, with a mininum of loop checks
+        while (true)
+        {
+            if (__first1 == __last1)  // return __last1 if no element matches *__first2
+                return __last1;
+            if (__pred(*__first1, *__first2))
+                break;
+            ++__first1;
+        }
+        // *__first1 matches *__first2, now match elements after here
+        _ForwardIterator1 __m1 = __first1;
+        _ForwardIterator2 __m2 = __first2;
+        while (true)
+        {
+            if (++__m2 == __last2)  // If pattern exhausted, __first1 is the answer (works for 1 element pattern)
+                return __first1;
+            if (++__m1 == __last1)  // Otherwise if source exhaused, pattern not found
+                return __last1;
+            if (!__pred(*__m1, *__m2))  // if there is a mismatch, restart with a new __first1
+            {
+                ++__first1;
+                break;
+            }  // else there is a match, check next elements
+        }
+    }
+}
+
+template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
+_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1
+__search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
+           _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred,
+           random_access_iterator_tag, random_access_iterator_tag)
+{
+    typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type _D1;
+    typedef typename std::iterator_traits<_RandomAccessIterator2>::difference_type _D2;
+    // Take advantage of knowing source and pattern lengths.  Stop short when source is smaller than pattern
+    _D2 __len2 = __last2 - __first2;
+    if (__len2 == 0)
+        return __first1;
+    _D1 __len1 = __last1 - __first1;
+    if (__len1 < __len2)
+        return __last1;
+    const _RandomAccessIterator1 __s = __last1 - (__len2 - 1);  // Start of pattern match can't go beyond here
+    while (true)
+    {
+#if !_LIBCPP_UNROLL_LOOPS
+        while (true)
+        {
+            if (__first1 == __s)
+                return __last1;
+            if (__pred(*__first1, *__first2))
+                break;
+            ++__first1;
+        }
+#else  // !_LIBCPP_UNROLL_LOOPS
+        for (_D1 __loop_unroll = (__s - __first1) / 4; __loop_unroll > 0; --__loop_unroll)
+        {
+            if (__pred(*__first1, *__first2))
+                goto __phase2;
+            if (__pred(*++__first1, *__first2))
+                goto __phase2;
+            if (__pred(*++__first1, *__first2))
+                goto __phase2;
+            if (__pred(*++__first1, *__first2))
+                goto __phase2;
+            ++__first1;
+        }
+        switch (__s - __first1)
+        {
+        case 3:
+            if (__pred(*__first1, *__first2))
+                break;
+            ++__first1;
+        case 2:
+            if (__pred(*__first1, *__first2))
+                break;
+            ++__first1;
+        case 1:
+            if (__pred(*__first1, *__first2))
+                break;
+        case 0:
+            return __last1;
+        }
+    __phase2:
+#endif  // !_LIBCPP_UNROLL_LOOPS
+        _RandomAccessIterator1 __m1 = __first1;
+        _RandomAccessIterator2 __m2 = __first2;
+#if !_LIBCPP_UNROLL_LOOPS
+         while (true)
+         {
+             if (++__m2 == __last2)
+                 return __first1;
+             ++__m1;          // no need to check range on __m1 because __s guarantees we have enough source
+             if (!__pred(*__m1, *__m2))
+             {
+                 ++__first1;
+                 break;
+             }
+         }
+#else  // !_LIBCPP_UNROLL_LOOPS
+        ++__m2;
+        ++__m1;
+        for (_D2 __loop_unroll = (__last2 - __m2) / 4; __loop_unroll > 0; --__loop_unroll)
+        {
+            if (!__pred(*__m1, *__m2))
+                goto __continue;
+            if (!__pred(*++__m1, *++__m2))
+                goto __continue;
+            if (!__pred(*++__m1, *++__m2))
+                goto __continue;
+            if (!__pred(*++__m1, *++__m2))
+                goto __continue;
+            ++__m1;
+            ++__m2;
+        }
+        switch (__last2 - __m2)
+        {
+        case 3:
+            if (!__pred(*__m1, *__m2))
+                break;
+            ++__m1;
+            ++__m2;
+        case 2:
+            if (!__pred(*__m1, *__m2))
+                break;
+            ++__m1;
+            ++__m2;
+        case 1:
+            if (!__pred(*__m1, *__m2))
+                break;
+        case 0:
+            return __first1;
+        }
+    __continue:
+        ++__first1;
+#endif  // !_LIBCPP_UNROLL_LOOPS
+    }
+}
+
+template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator1
+search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+       _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
+{
+    return _VSTD::__search<typename add_lvalue_reference<_BinaryPredicate>::type>
+                         (__first1, __last1, __first2, __last2, __pred,
+                          typename std::iterator_traits<_ForwardIterator1>::iterator_category(),
+                          typename std::iterator_traits<_ForwardIterator2>::iterator_category());
+}
+
+template <class _ForwardIterator1, class _ForwardIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator1
+search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+       _ForwardIterator2 __first2, _ForwardIterator2 __last2)
+{
+    typedef typename std::iterator_traits<_ForwardIterator1>::value_type __v1;
+    typedef typename std::iterator_traits<_ForwardIterator2>::value_type __v2;
+    return _VSTD::search(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
+}
+
+// search_n
+
+template <class _BinaryPredicate, class _ForwardIterator, class _Size, class _Tp>
+_ForwardIterator
+__search_n(_ForwardIterator __first, _ForwardIterator __last,
+           _Size __count, const _Tp& __value_, _BinaryPredicate __pred, forward_iterator_tag)
+{
+    if (__count <= 0)
+        return __first;
+    while (true)
+    {
+        // Find first element in sequence that matchs __value_, with a mininum of loop checks
+        while (true)
+        {
+            if (__first == __last)  // return __last if no element matches __value_
+                return __last;
+            if (__pred(*__first, __value_))
+                break;
+            ++__first;
+        }
+        // *__first matches __value_, now match elements after here
+        _ForwardIterator __m = __first;
+        _Size __c(0);
+        while (true)
+        {
+            if (++__c == __count)  // If pattern exhausted, __first is the answer (works for 1 element pattern)
+                return __first;
+            if (++__m == __last)  // Otherwise if source exhaused, pattern not found
+                return __last;
+            if (!__pred(*__m, __value_))  // if there is a mismatch, restart with a new __first
+            {
+                __first = __m;
+                ++__first;
+                break;
+            }  // else there is a match, check next elements
+        }
+    }
+}
+
+template <class _BinaryPredicate, class _RandomAccessIterator, class _Size, class _Tp>
+_RandomAccessIterator
+__search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
+           _Size __count, const _Tp& __value_, _BinaryPredicate __pred, random_access_iterator_tag)
+{
+    if (__count <= 0)
+        return __first;
+    _Size __len = static_cast<_Size>(__last - __first);
+    if (__len < __count)
+        return __last;
+    const _RandomAccessIterator __s = __last - (__count - 1);  // Start of pattern match can't go beyond here
+    while (true)
+    {
+        // Find first element in sequence that matchs __value_, with a mininum of loop checks
+        while (true)
+        {
+            if (__first >= __s)  // return __last if no element matches __value_
+                return __last;
+            if (__pred(*__first, __value_))
+                break;
+            ++__first;
+        }
+        // *__first matches __value_, now match elements after here
+        _RandomAccessIterator __m = __first;
+        _Size __c(0);
+        while (true)
+        {
+            if (++__c == __count)  // If pattern exhausted, __first is the answer (works for 1 element pattern)
+                return __first;
+             ++__m;          // no need to check range on __m because __s guarantees we have enough source
+            if (!__pred(*__m, __value_))  // if there is a mismatch, restart with a new __first
+            {
+                __first = __m;
+                ++__first;
+                break;
+            }  // else there is a match, check next elements
+        }
+    }
+}
+
+template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+search_n(_ForwardIterator __first, _ForwardIterator __last,
+         _Size __count, const _Tp& __value_, _BinaryPredicate __pred)
+{
+    return _VSTD::__search_n<typename add_lvalue_reference<_BinaryPredicate>::type>
+           (__first, __last, __convert_to_integral(__count), __value_, __pred,
+           typename iterator_traits<_ForwardIterator>::iterator_category());
+}
+
+template <class _ForwardIterator, class _Size, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)
+{
+    typedef typename iterator_traits<_ForwardIterator>::value_type __v;
+    return _VSTD::search_n(__first, __last, __convert_to_integral(__count),
+                           __value_, __equal_to<__v, _Tp>());
+}
+
+// copy
+
+template <class _Iter>
+struct __libcpp_is_trivial_iterator
+{
+    static const bool value = is_pointer<_Iter>::value;
+};
+
+template <class _Iter>
+struct __libcpp_is_trivial_iterator<move_iterator<_Iter> >
+{
+    static const bool value = is_pointer<_Iter>::value;
+};
+
+template <class _Iter>
+struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> >
+{
+    static const bool value = is_pointer<_Iter>::value;
+};
+
+template <class _Iter>
+inline _LIBCPP_INLINE_VISIBILITY
+_Iter
+__unwrap_iter(_Iter __i)
+{
+    return __i;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_trivially_copy_assignable<_Tp>::value,
+    _Tp*
+>::type
+__unwrap_iter(move_iterator<_Tp*> __i)
+{
+    return __i.base();
+}
+
+#if _LIBCPP_DEBUG_LEVEL < 2
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_trivially_copy_assignable<_Tp>::value,
+    _Tp*
+>::type
+__unwrap_iter(__wrap_iter<_Tp*> __i)
+{
+    return __i.base();
+}
+
+#endif  // _LIBCPP_DEBUG_LEVEL < 2
+
+template <class _InputIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+__copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
+{
+    for (; __first != __last; ++__first, (void) ++__result)
+        *__result = *__first;
+    return __result;
+}
+
+template <class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_same<typename remove_const<_Tp>::type, _Up>::value &&
+    is_trivially_copy_assignable<_Up>::value,
+    _Up*
+>::type
+__copy(_Tp* __first, _Tp* __last, _Up* __result)
+{
+    const size_t __n = static_cast<size_t>(__last - __first);
+    if (__n > 0)
+        _VSTD::memmove(__result, __first, __n * sizeof(_Up));
+    return __result + __n;
+}
+
+template <class _InputIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
+{
+    return _VSTD::__copy(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result));
+}
+
+// copy_backward
+
+template <class _BidirectionalIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+__copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)
+{
+    while (__first != __last)
+        *--__result = *--__last;
+    return __result;
+}
+
+template <class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_same<typename remove_const<_Tp>::type, _Up>::value &&
+    is_trivially_copy_assignable<_Up>::value,
+    _Up*
+>::type
+__copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
+{
+    const size_t __n = static_cast<size_t>(__last - __first);
+    if (__n > 0)
+    {
+        __result -= __n;
+        _VSTD::memmove(__result, __first, __n * sizeof(_Up));
+    }
+    return __result;
+}
+
+template <class _BidirectionalIterator1, class _BidirectionalIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+_BidirectionalIterator2
+copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
+              _BidirectionalIterator2 __result)
+{
+    return _VSTD::__copy_backward(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result));
+}
+
+// copy_if
+
+template<class _InputIterator, class _OutputIterator, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+copy_if(_InputIterator __first, _InputIterator __last,
+        _OutputIterator __result, _Predicate __pred)
+{
+    for (; __first != __last; ++__first)
+    {
+        if (__pred(*__first))
+        {
+            *__result = *__first;
+            ++__result;
+        }
+    }
+    return __result;
+}
+
+// copy_n
+
+template<class _InputIterator, class _Size, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_input_iterator<_InputIterator>::value &&
+   !__is_random_access_iterator<_InputIterator>::value,
+    _OutputIterator
+>::type
+copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
+{
+    typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
+    _IntegralSize __n = __orig_n;
+    if (__n > 0)
+    {
+        *__result = *__first;
+        ++__result;
+        for (--__n; __n > 0; --__n)
+        {
+            ++__first;
+            *__result = *__first;
+            ++__result;
+        }
+    }
+    return __result;
+}
+
+template<class _InputIterator, class _Size, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_random_access_iterator<_InputIterator>::value,
+    _OutputIterator
+>::type
+copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
+{
+    typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
+    _IntegralSize __n = __orig_n;
+    return _VSTD::copy(__first, __first + __n, __result);
+}
+
+// move
+
+template <class _InputIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+__move(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
+{
+    for (; __first != __last; ++__first, (void) ++__result)
+        *__result = _VSTD::move(*__first);
+    return __result;
+}
+
+template <class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_same<typename remove_const<_Tp>::type, _Up>::value &&
+    is_trivially_copy_assignable<_Up>::value,
+    _Up*
+>::type
+__move(_Tp* __first, _Tp* __last, _Up* __result)
+{
+    const size_t __n = static_cast<size_t>(__last - __first);
+    if (__n > 0)
+        _VSTD::memmove(__result, __first, __n * sizeof(_Up));
+    return __result + __n;
+}
+
+template <class _InputIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+move(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
+{
+    return _VSTD::__move(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result));
+}
+
+// move_backward
+
+template <class _InputIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+__move_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
+{
+    while (__first != __last)
+        *--__result = _VSTD::move(*--__last);
+    return __result;
+}
+
+template <class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_same<typename remove_const<_Tp>::type, _Up>::value &&
+    is_trivially_copy_assignable<_Up>::value,
+    _Up*
+>::type
+__move_backward(_Tp* __first, _Tp* __last, _Up* __result)
+{
+    const size_t __n = static_cast<size_t>(__last - __first);
+    if (__n > 0)
+    {
+        __result -= __n;
+        _VSTD::memmove(__result, __first, __n * sizeof(_Up));
+    }
+    return __result;
+}
+
+template <class _BidirectionalIterator1, class _BidirectionalIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+_BidirectionalIterator2
+move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
+              _BidirectionalIterator2 __result)
+{
+    return _VSTD::__move_backward(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result));
+}
+
+// iter_swap
+
+// moved to <type_traits> for better swap / noexcept support
+
+// transform
+
+template <class _InputIterator, class _OutputIterator, class _UnaryOperation>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op)
+{
+    for (; __first != __last; ++__first, (void) ++__result)
+        *__result = __op(*__first);
+    return __result;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _BinaryOperation>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+transform(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
+          _OutputIterator __result, _BinaryOperation __binary_op)
+{
+    for (; __first1 != __last1; ++__first1, (void) ++__first2, ++__result)
+        *__result = __binary_op(*__first1, *__first2);
+    return __result;
+}
+
+// replace
+
+template <class _ForwardIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value, const _Tp& __new_value)
+{
+    for (; __first != __last; ++__first)
+        if (*__first == __old_value)
+            *__first = __new_value;
+}
+
+// replace_if
+
+template <class _ForwardIterator, class _Predicate, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+replace_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp& __new_value)
+{
+    for (; __first != __last; ++__first)
+        if (__pred(*__first))
+            *__first = __new_value;
+}
+
+// replace_copy
+
+template <class _InputIterator, class _OutputIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+replace_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
+             const _Tp& __old_value, const _Tp& __new_value)
+{
+    for (; __first != __last; ++__first, (void) ++__result)
+        if (*__first == __old_value)
+            *__result = __new_value;
+        else
+            *__result = *__first;
+    return __result;
+}
+
+// replace_copy_if
+
+template <class _InputIterator, class _OutputIterator, class _Predicate, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
+                _Predicate __pred, const _Tp& __new_value)
+{
+    for (; __first != __last; ++__first, (void) ++__result)
+        if (__pred(*__first))
+            *__result = __new_value;
+        else
+            *__result = *__first;
+    return __result;
+}
+
+// fill_n
+
+template <class _OutputIterator, class _Size, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
+{
+    for (; __n > 0; ++__first, (void) --__n)
+        *__first = __value_;
+    return __first;
+}
+
+template <class _Tp, class _Size, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value && sizeof(_Tp) == 1 &&
+    !is_same<_Tp, bool>::value &&
+    is_integral<_Up>::value && sizeof(_Up) == 1,
+    _Tp*
+>::type
+__fill_n(_Tp* __first, _Size __n,_Up __value_)
+{
+    if (__n > 0)
+        _VSTD::memset(__first, (unsigned char)__value_, (size_t)(__n));
+    return __first + __n;
+}
+
+template <class _OutputIterator, class _Size, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
+{
+   return _VSTD::__fill_n(__first, __convert_to_integral(__n), __value_);
+}
+
+// fill
+
+template <class _ForwardIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, forward_iterator_tag)
+{
+    for (; __first != __last; ++__first)
+        *__first = __value_;
+}
+
+template <class _RandomAccessIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value_, random_access_iterator_tag)
+{
+    _VSTD::fill_n(__first, __last - __first, __value_);
+}
+
+template <class _ForwardIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
+{
+    _VSTD::__fill(__first, __last, __value_, typename iterator_traits<_ForwardIterator>::iterator_category());
+}
+
+// generate
+
+template <class _ForwardIterator, class _Generator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen)
+{
+    for (; __first != __last; ++__first)
+        *__first = __gen();
+}
+
+// generate_n
+
+template <class _OutputIterator, class _Size, class _Generator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
+{
+    typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
+    _IntegralSize __n = __orig_n;
+    for (; __n > 0; ++__first, (void) --__n)
+        *__first = __gen();
+    return __first;
+}
+
+// remove
+
+template <class _ForwardIterator, class _Tp>
+_ForwardIterator
+remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
+{
+    __first = _VSTD::find(__first, __last, __value_);
+    if (__first != __last)
+    {
+        _ForwardIterator __i = __first;
+        while (++__i != __last)
+        {
+            if (!(*__i == __value_))
+            {
+                *__first = _VSTD::move(*__i);
+                ++__first;
+            }
+        }
+    }
+    return __first;
+}
+
+// remove_if
+
+template <class _ForwardIterator, class _Predicate>
+_ForwardIterator
+remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
+{
+    __first = _VSTD::find_if<_ForwardIterator, typename add_lvalue_reference<_Predicate>::type>
+                           (__first, __last, __pred);
+    if (__first != __last)
+    {
+        _ForwardIterator __i = __first;
+        while (++__i != __last)
+        {
+            if (!__pred(*__i))
+            {
+                *__first = _VSTD::move(*__i);
+                ++__first;
+            }
+        }
+    }
+    return __first;
+}
+
+// remove_copy
+
+template <class _InputIterator, class _OutputIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value_)
+{
+    for (; __first != __last; ++__first)
+    {
+        if (!(*__first == __value_))
+        {
+            *__result = *__first;
+            ++__result;
+        }
+    }
+    return __result;
+}
+
+// remove_copy_if
+
+template <class _InputIterator, class _OutputIterator, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred)
+{
+    for (; __first != __last; ++__first)
+    {
+        if (!__pred(*__first))
+        {
+            *__result = *__first;
+            ++__result;
+        }
+    }
+    return __result;
+}
+
+// unique
+
+template <class _ForwardIterator, class _BinaryPredicate>
+_ForwardIterator
+unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)
+{
+    __first = _VSTD::adjacent_find<_ForwardIterator, typename add_lvalue_reference<_BinaryPredicate>::type>
+                                 (__first, __last, __pred);
+    if (__first != __last)
+    {
+        // ...  a  a  ?  ...
+        //      f     i
+        _ForwardIterator __i = __first;
+        for (++__i; ++__i != __last;)
+            if (!__pred(*__first, *__i))
+                *++__first = _VSTD::move(*__i);
+        ++__first;
+    }
+    return __first;
+}
+
+template <class _ForwardIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+unique(_ForwardIterator __first, _ForwardIterator __last)
+{
+    typedef typename iterator_traits<_ForwardIterator>::value_type __v;
+    return _VSTD::unique(__first, __last, __equal_to<__v>());
+}
+
+// unique_copy
+
+template <class _BinaryPredicate, class _InputIterator, class _OutputIterator>
+_OutputIterator
+__unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __pred,
+              input_iterator_tag, output_iterator_tag)
+{
+    if (__first != __last)
+    {
+        typename iterator_traits<_InputIterator>::value_type __t(*__first);
+        *__result = __t;
+        ++__result;
+        while (++__first != __last)
+        {
+            if (!__pred(__t, *__first))
+            {
+                __t = *__first;
+                *__result = __t;
+                ++__result;
+            }
+        }
+    }
+    return __result;
+}
+
+template <class _BinaryPredicate, class _ForwardIterator, class _OutputIterator>
+_OutputIterator
+__unique_copy(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result, _BinaryPredicate __pred,
+              forward_iterator_tag, output_iterator_tag)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __i = __first;
+        *__result = *__i;
+        ++__result;
+        while (++__first != __last)
+        {
+            if (!__pred(*__i, *__first))
+            {
+                *__result = *__first;
+                ++__result;
+                __i = __first;
+            }
+        }
+    }
+    return __result;
+}
+
+template <class _BinaryPredicate, class _InputIterator, class _ForwardIterator>
+_ForwardIterator
+__unique_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _BinaryPredicate __pred,
+              input_iterator_tag, forward_iterator_tag)
+{
+    if (__first != __last)
+    {
+        *__result = *__first;
+        while (++__first != __last)
+            if (!__pred(*__result, *__first))
+                *++__result = *__first;
+        ++__result;
+    }
+    return __result;
+}
+
+template <class _InputIterator, class _OutputIterator, class _BinaryPredicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __pred)
+{
+    return _VSTD::__unique_copy<typename add_lvalue_reference<_BinaryPredicate>::type>
+                              (__first, __last, __result, __pred,
+                               typename iterator_traits<_InputIterator>::iterator_category(),
+                               typename iterator_traits<_OutputIterator>::iterator_category());
+}
+
+template <class _InputIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
+{
+    typedef typename iterator_traits<_InputIterator>::value_type __v;
+    return _VSTD::unique_copy(__first, __last, __result, __equal_to<__v>());
+}
+
+// reverse
+
+template <class _BidirectionalIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirectional_iterator_tag)
+{
+    while (__first != __last)
+    {
+        if (__first == --__last)
+            break;
+        swap(*__first, *__last);
+        ++__first;
+    }
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag)
+{
+    if (__first != __last)
+        for (; __first < --__last; ++__first)
+            swap(*__first, *__last);
+}
+
+template <class _BidirectionalIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
+{
+    _VSTD::__reverse(__first, __last, typename iterator_traits<_BidirectionalIterator>::iterator_category());
+}
+
+// reverse_copy
+
+template <class _BidirectionalIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)
+{
+    for (; __first != __last; ++__result)
+        *__result = *--__last;
+    return __result;
+}
+
+// rotate
+
+template <class _ForwardIterator>
+_ForwardIterator
+__rotate_left(_ForwardIterator __first, _ForwardIterator __last)
+{
+    typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+    value_type __tmp = _VSTD::move(*__first);
+    _ForwardIterator __lm1 = _VSTD::move(_VSTD::next(__first), __last, __first);
+    *__lm1 = _VSTD::move(__tmp);
+    return __lm1;
+}
+
+template <class _BidirectionalIterator>
+_BidirectionalIterator
+__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
+{
+    typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+    _BidirectionalIterator __lm1 = _VSTD::prev(__last);
+    value_type __tmp = _VSTD::move(*__lm1);
+    _BidirectionalIterator __fp1 = _VSTD::move_backward(__first, __lm1, __last);
+    *__first = _VSTD::move(__tmp);
+    return __fp1;
+}
+
+template <class _ForwardIterator>
+_ForwardIterator
+__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
+{
+    _ForwardIterator __i = __middle;
+    while (true)
+    {
+        swap(*__first, *__i);
+        ++__first;
+        if (++__i == __last)
+            break;
+        if (__first == __middle)
+            __middle = __i;
+    }
+    _ForwardIterator __r = __first;
+    if (__first != __middle)
+    {
+        __i = __middle;
+        while (true)
+        {
+            swap(*__first, *__i);
+            ++__first;
+            if (++__i == __last)
+            {
+                if (__first == __middle)
+                    break;
+                __i = __middle;
+            }
+            else if (__first == __middle)
+                __middle = __i;
+        }
+    }
+    return __r;
+}
+
+template<typename _Integral>
+inline _LIBCPP_INLINE_VISIBILITY
+_Integral
+__gcd(_Integral __x, _Integral __y)
+{
+    do
+    {
+        _Integral __t = __x % __y;
+        __x = __y;
+        __y = __t;
+    } while (__y);
+    return __x;
+}
+
+template<typename _RandomAccessIterator>
+_RandomAccessIterator
+__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+
+    const difference_type __m1 = __middle - __first;
+    const difference_type __m2 = __last - __middle;
+    if (__m1 == __m2)
+    {
+        _VSTD::swap_ranges(__first, __middle, __middle);
+        return __middle;
+    }
+    const difference_type __g = _VSTD::__gcd(__m1, __m2);
+    for (_RandomAccessIterator __p = __first + __g; __p != __first;)
+    {
+        value_type __t(_VSTD::move(*--__p));
+        _RandomAccessIterator __p1 = __p;
+        _RandomAccessIterator __p2 = __p1 + __m1;
+        do
+        {
+            *__p1 = _VSTD::move(*__p2);
+            __p1 = __p2;
+            const difference_type __d = __last - __p2;
+            if (__m1 < __d)
+                __p2 += __m1;
+            else
+                __p2 = __first + (__m1 - __d);
+        } while (__p2 != __p);
+        *__p1 = _VSTD::move(__t);
+    }
+    return __first + __m2;
+}
+
+template <class _ForwardIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
+         _VSTD::forward_iterator_tag)
+{
+    typedef typename _VSTD::iterator_traits<_ForwardIterator>::value_type value_type;
+    if (_VSTD::is_trivially_move_assignable<value_type>::value)
+    {
+        if (_VSTD::next(__first) == __middle)
+            return _VSTD::__rotate_left(__first, __last);
+    }
+    return _VSTD::__rotate_forward(__first, __middle, __last);
+}
+
+template <class _BidirectionalIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_BidirectionalIterator
+__rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
+         _VSTD::bidirectional_iterator_tag)
+{
+    typedef typename _VSTD::iterator_traits<_BidirectionalIterator>::value_type value_type;
+    if (_VSTD::is_trivially_move_assignable<value_type>::value)
+    {
+        if (_VSTD::next(__first) == __middle)
+            return _VSTD::__rotate_left(__first, __last);
+        if (_VSTD::next(__middle) == __last)
+            return _VSTD::__rotate_right(__first, __last);
+    }
+    return _VSTD::__rotate_forward(__first, __middle, __last);
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_RandomAccessIterator
+__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
+         _VSTD::random_access_iterator_tag)
+{
+    typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::value_type value_type;
+    if (_VSTD::is_trivially_move_assignable<value_type>::value)
+    {
+        if (_VSTD::next(__first) == __middle)
+            return _VSTD::__rotate_left(__first, __last);
+        if (_VSTD::next(__middle) == __last)
+            return _VSTD::__rotate_right(__first, __last);
+        return _VSTD::__rotate_gcd(__first, __middle, __last);
+    }
+    return _VSTD::__rotate_forward(__first, __middle, __last);
+}
+
+template <class _ForwardIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
+{
+    if (__first == __middle)
+        return __last;
+    if (__middle == __last)
+        return __first;
+    return _VSTD::__rotate(__first, __middle, __last,
+                           typename _VSTD::iterator_traits<_ForwardIterator>::iterator_category());
+}
+
+// rotate_copy
+
+template <class _ForwardIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result)
+{
+    return _VSTD::copy(__first, __middle, _VSTD::copy(__middle, __last, __result));
+}
+
+// min_element
+
+template <class _ForwardIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_ForwardIterator
+min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __i = __first;
+        while (++__i != __last)
+            if (__comp(*__i, *__first))
+                __first = __i;
+    }
+    return __first;
+}
+
+template <class _ForwardIterator>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_ForwardIterator
+min_element(_ForwardIterator __first, _ForwardIterator __last)
+{
+    return _VSTD::min_element(__first, __last,
+              __less<typename iterator_traits<_ForwardIterator>::value_type>());
+}
+
+// min
+
+template <class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Tp&
+min(const _Tp& __a, const _Tp& __b, _Compare __comp)
+{
+    return __comp(__b, __a) ? __b : __a;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Tp&
+min(const _Tp& __a, const _Tp& __b)
+{
+    return _VSTD::min(__a, __b, __less<_Tp>());
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template<class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp
+min(initializer_list<_Tp> __t, _Compare __comp)
+{
+    return *_VSTD::min_element(__t.begin(), __t.end(), __comp);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp
+min(initializer_list<_Tp> __t)
+{
+    return *_VSTD::min_element(__t.begin(), __t.end(), __less<_Tp>());
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+// max_element
+
+template <class _ForwardIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_ForwardIterator
+max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __i = __first;
+        while (++__i != __last)
+            if (__comp(*__first, *__i))
+                __first = __i;
+    }
+    return __first;
+}
+
+
+template <class _ForwardIterator>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_ForwardIterator
+max_element(_ForwardIterator __first, _ForwardIterator __last)
+{
+    return _VSTD::max_element(__first, __last,
+              __less<typename iterator_traits<_ForwardIterator>::value_type>());
+}
+
+// max
+
+template <class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Tp&
+max(const _Tp& __a, const _Tp& __b, _Compare __comp)
+{
+    return __comp(__a, __b) ? __b : __a;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Tp&
+max(const _Tp& __a, const _Tp& __b)
+{
+    return _VSTD::max(__a, __b, __less<_Tp>());
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template<class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp
+max(initializer_list<_Tp> __t, _Compare __comp)
+{
+    return *_VSTD::max_element(__t.begin(), __t.end(), __comp);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp
+max(initializer_list<_Tp> __t)
+{
+    return *_VSTD::max_element(__t.begin(), __t.end(), __less<_Tp>());
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+// minmax_element
+
+template <class _ForwardIterator, class _Compare>
+_LIBCPP_CONSTEXPR_AFTER_CXX11
+std::pair<_ForwardIterator, _ForwardIterator>
+minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
+{
+  std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first);
+  if (__first != __last)
+  {
+      if (++__first != __last)
+      {
+          if (__comp(*__first, *__result.first))
+              __result.first = __first;
+          else
+              __result.second = __first;
+          while (++__first != __last)
+          {
+              _ForwardIterator __i = __first;
+              if (++__first == __last)
+              {
+                  if (__comp(*__i, *__result.first))
+                      __result.first = __i;
+                  else if (!__comp(*__i, *__result.second))
+                      __result.second = __i;
+                  break;
+              }
+              else
+              {
+                  if (__comp(*__first, *__i))
+                  {
+                      if (__comp(*__first, *__result.first))
+                          __result.first = __first;
+                      if (!__comp(*__i, *__result.second))
+                          __result.second = __i;
+                  }
+                  else
+                  {
+                      if (__comp(*__i, *__result.first))
+                          __result.first = __i;
+                      if (!__comp(*__first, *__result.second))
+                          __result.second = __first;
+                  }
+              }
+          }
+      }
+  }
+  return __result;
+}
+
+template <class _ForwardIterator>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+std::pair<_ForwardIterator, _ForwardIterator>
+minmax_element(_ForwardIterator __first, _ForwardIterator __last)
+{
+    return _VSTD::minmax_element(__first, __last,
+              __less<typename iterator_traits<_ForwardIterator>::value_type>());
+}
+
+// minmax
+
+template<class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<const _Tp&, const _Tp&>
+minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
+{
+    return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) :
+                              pair<const _Tp&, const _Tp&>(__a, __b);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<const _Tp&, const _Tp&>
+minmax(const _Tp& __a, const _Tp& __b)
+{
+    return _VSTD::minmax(__a, __b, __less<_Tp>());
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template<class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<_Tp, _Tp>
+minmax(initializer_list<_Tp> __t, _Compare __comp)
+{
+    typedef typename initializer_list<_Tp>::const_iterator _Iter;
+    _Iter __first = __t.begin();
+    _Iter __last  = __t.end();
+    std::pair<_Tp, _Tp> __result(*__first, *__first);
+
+    ++__first;
+    if (__t.size() % 2 == 0)
+    {
+        if (__comp(*__first,  __result.first))
+            __result.first  = *__first;
+        else
+            __result.second = *__first;
+        ++__first;
+    }
+    
+    while (__first != __last)
+    {
+        _Tp __prev = *__first++;
+        if (__comp(*__first, __prev)) {
+            if ( __comp(*__first, __result.first)) __result.first  = *__first;
+            if (!__comp(__prev, __result.second))  __result.second = __prev;
+            }
+        else {
+            if ( __comp(__prev, __result.first))    __result.first  = __prev;
+            if (!__comp(*__first, __result.second)) __result.second = *__first;
+            }
+                
+        __first++;
+    }
+    return __result;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<_Tp, _Tp>
+minmax(initializer_list<_Tp> __t)
+{
+    return _VSTD::minmax(__t, __less<_Tp>());
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+// random_shuffle
+
+// __independent_bits_engine
+
+template <unsigned long long _Xp, size_t _Rp>
+struct __log2_imp
+{
+    static const size_t value = _Xp & ((unsigned long long)(1) << _Rp) ? _Rp
+                                           : __log2_imp<_Xp, _Rp - 1>::value;
+};
+
+template <unsigned long long _Xp>
+struct __log2_imp<_Xp, 0>
+{
+    static const size_t value = 0;
+};
+
+template <size_t _Rp>
+struct __log2_imp<0, _Rp>
+{
+    static const size_t value = _Rp + 1;
+};
+
+template <class _UI, _UI _Xp>
+struct __log2
+{
+    static const size_t value = __log2_imp<_Xp,
+                                         sizeof(_UI) * __CHAR_BIT__ - 1>::value;
+};
+
+template<class _Engine, class _UIntType>
+class __independent_bits_engine
+{
+public:
+    // types
+    typedef _UIntType result_type;
+
+private:
+    typedef typename _Engine::result_type _Engine_result_type;
+    typedef typename conditional
+        <
+            sizeof(_Engine_result_type) <= sizeof(result_type),
+                result_type,
+                _Engine_result_type
+        >::type _Working_result_type;
+
+    _Engine& __e_;
+    size_t __w_;
+    size_t __w0_;
+    size_t __n_;
+    size_t __n0_;
+    _Working_result_type __y0_;
+    _Working_result_type __y1_;
+    _Engine_result_type __mask0_;
+    _Engine_result_type __mask1_;
+
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+    static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
+                                          + _Working_result_type(1);
+#else
+    static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min()
+                                                      + _Working_result_type(1);
+#endif
+    static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
+    static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
+    static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
+
+public:
+    // constructors and seeding functions
+    __independent_bits_engine(_Engine& __e, size_t __w);
+
+    // generating functions
+    result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
+
+private:
+    result_type __eval(false_type);
+    result_type __eval(true_type);
+};
+
+template<class _Engine, class _UIntType>
+__independent_bits_engine<_Engine, _UIntType>
+    ::__independent_bits_engine(_Engine& __e, size_t __w)
+        : __e_(__e),
+          __w_(__w)
+{
+    __n_ = __w_ / __m + (__w_ % __m != 0);
+    __w0_ = __w_ / __n_;
+    if (_Rp == 0)
+        __y0_ = _Rp;
+    else if (__w0_ < _WDt)
+        __y0_ = (_Rp >> __w0_) << __w0_;
+    else
+        __y0_ = 0;
+    if (_Rp - __y0_ > __y0_ / __n_)
+    {
+        ++__n_;
+        __w0_ = __w_ / __n_;
+        if (__w0_ < _WDt)
+            __y0_ = (_Rp >> __w0_) << __w0_;
+        else
+            __y0_ = 0;
+    }
+    __n0_ = __n_ - __w_ % __n_;
+    if (__w0_ < _WDt - 1)
+        __y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1);
+    else
+        __y1_ = 0;
+    __mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) :
+                          _Engine_result_type(0);
+    __mask1_ = __w0_ < _EDt - 1 ?
+                               _Engine_result_type(~0) >> (_EDt - (__w0_ + 1)) :
+                               _Engine_result_type(~0);
+}
+
+template<class _Engine, class _UIntType>
+inline
+_UIntType
+__independent_bits_engine<_Engine, _UIntType>::__eval(false_type)
+{
+    return static_cast<result_type>(__e_() & __mask0_);
+}
+
+template<class _Engine, class _UIntType>
+_UIntType
+__independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
+{
+    result_type _Sp = 0;
+    for (size_t __k = 0; __k < __n0_; ++__k)
+    {
+        _Engine_result_type __u;
+        do
+        {
+            __u = __e_() - _Engine::min();
+        } while (__u >= __y0_);
+        if (__w0_ < _WDt)
+            _Sp <<= __w0_;
+        else
+            _Sp = 0;
+        _Sp += __u & __mask0_;
+    }
+    for (size_t __k = __n0_; __k < __n_; ++__k)
+    {
+        _Engine_result_type __u;
+        do
+        {
+            __u = __e_() - _Engine::min();
+        } while (__u >= __y1_);
+        if (__w0_ < _WDt - 1)
+            _Sp <<= __w0_ + 1;
+        else
+            _Sp = 0;
+        _Sp += __u & __mask1_;
+    }
+    return _Sp;
+}
+
+// uniform_int_distribution
+
+template<class _IntType = int>
+class uniform_int_distribution
+{
+public:
+    // types
+    typedef _IntType result_type;
+
+    class param_type
+    {
+        result_type __a_;
+        result_type __b_;
+    public:
+        typedef uniform_int_distribution distribution_type;
+
+        explicit param_type(result_type __a = 0,
+                            result_type __b = numeric_limits<result_type>::max())
+            : __a_(__a), __b_(__b) {}
+
+        result_type a() const {return __a_;}
+        result_type b() const {return __b_;}
+
+        friend bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
+        friend bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructors and reset functions
+    explicit uniform_int_distribution(result_type __a = 0,
+                                      result_type __b = numeric_limits<result_type>::max())
+        : __p_(param_type(__a, __b)) {}
+    explicit uniform_int_distribution(const param_type& __p) : __p_(__p) {}
+    void reset() {}
+
+    // generating functions
+    template<class _URNG> result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    result_type a() const {return __p_.a();}
+    result_type b() const {return __p_.b();}
+
+    param_type param() const {return __p_;}
+    void param(const param_type& __p) {__p_ = __p;}
+
+    result_type min() const {return a();}
+    result_type max() const {return b();}
+
+    friend bool operator==(const uniform_int_distribution& __x,
+                           const uniform_int_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend bool operator!=(const uniform_int_distribution& __x,
+                           const uniform_int_distribution& __y)
+            {return !(__x == __y);}
+};
+
+template<class _IntType>
+template<class _URNG>
+typename uniform_int_distribution<_IntType>::result_type
+uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p)
+{
+    typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t),
+                                            uint32_t, uint64_t>::type _UIntType;
+    const _UIntType _Rp = __p.b() - __p.a() + _UIntType(1);
+    if (_Rp == 1)
+        return __p.a();
+    const size_t _Dt = numeric_limits<_UIntType>::digits;
+    typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
+    if (_Rp == 0)
+        return static_cast<result_type>(_Eng(__g, _Dt)());
+    size_t __w = _Dt - __clz(_Rp) - 1;
+    if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0)
+        ++__w;
+    _Eng __e(__g, __w);
+    _UIntType __u;
+    do
+    {
+        __u = __e();
+    } while (__u >= _Rp);
+    return static_cast<result_type>(__u + __p.a());
+}
+
+class _LIBCPP_TYPE_VIS __rs_default;
+
+_LIBCPP_FUNC_VIS __rs_default __rs_get();
+
+class _LIBCPP_TYPE_VIS __rs_default
+{
+    static unsigned __c_;
+
+    __rs_default();
+public:
+    typedef uint_fast32_t result_type;
+
+    static const result_type _Min = 0;
+    static const result_type _Max = 0xFFFFFFFF;
+
+    __rs_default(const __rs_default&);
+    ~__rs_default();
+
+    result_type operator()();
+
+    static _LIBCPP_CONSTEXPR result_type min() {return _Min;}
+    static _LIBCPP_CONSTEXPR result_type max() {return _Max;}
+
+    friend _LIBCPP_FUNC_VIS __rs_default __rs_get();
+};
+
+_LIBCPP_FUNC_VIS __rs_default __rs_get();
+
+template <class _RandomAccessIterator>
+void
+random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    typedef uniform_int_distribution<ptrdiff_t> _Dp;
+    typedef typename _Dp::param_type _Pp;
+    difference_type __d = __last - __first;
+    if (__d > 1)
+    {
+        _Dp __uid;
+        __rs_default __g = __rs_get();
+        for (--__last, --__d; __first < __last; ++__first, --__d)
+        {
+            difference_type __i = __uid(__g, _Pp(0, __d));
+            if (__i != difference_type(0))
+                swap(*__first, *(__first + __i));
+        }
+    }
+}
+
+template <class _RandomAccessIterator, class _RandomNumberGenerator>
+void
+random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+               _RandomNumberGenerator&& __rand)
+#else
+               _RandomNumberGenerator& __rand)
+#endif
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    difference_type __d = __last - __first;
+    if (__d > 1)
+    {
+        for (--__last; __first < __last; ++__first, --__d)
+        {
+            difference_type __i = __rand(__d);
+            swap(*__first, *(__first + __i));
+        }
+    }
+}
+
+template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
+    void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+                 _UniformRandomNumberGenerator&& __g)
+#else
+                 _UniformRandomNumberGenerator& __g)
+#endif
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    typedef uniform_int_distribution<ptrdiff_t> _Dp;
+    typedef typename _Dp::param_type _Pp;
+    difference_type __d = __last - __first;
+    if (__d > 1)
+    {
+        _Dp __uid;
+        for (--__last, --__d; __first < __last; ++__first, --__d)
+        {
+            difference_type __i = __uid(__g, _Pp(0, __d));
+            if (__i != difference_type(0))
+                swap(*__first, *(__first + __i));
+        }
+    }
+}
+
+template <class _InputIterator, class _Predicate>
+bool
+is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+{
+    for (; __first != __last; ++__first)
+        if (!__pred(*__first))
+            break;
+    if ( __first == __last )
+        return true;
+    ++__first;
+    for (; __first != __last; ++__first)
+        if (__pred(*__first))
+            return false;
+    return true;
+}
+
+// partition
+
+template <class _Predicate, class _ForwardIterator>
+_ForwardIterator
+__partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_tag)
+{
+    while (true)
+    {
+        if (__first == __last)
+            return __first;
+        if (!__pred(*__first))
+            break;
+        ++__first;
+    }
+    for (_ForwardIterator __p = __first; ++__p != __last;)
+    {
+        if (__pred(*__p))
+        {
+            swap(*__first, *__p);
+            ++__first;
+        }
+    }
+    return __first;
+}
+
+template <class _Predicate, class _BidirectionalIterator>
+_BidirectionalIterator
+__partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
+            bidirectional_iterator_tag)
+{
+    while (true)
+    {
+        while (true)
+        {
+            if (__first == __last)
+                return __first;
+            if (!__pred(*__first))
+                break;
+            ++__first;
+        }
+        do
+        {
+            if (__first == --__last)
+                return __first;
+        } while (!__pred(*__last));
+        swap(*__first, *__last);
+        ++__first;
+    }
+}
+
+template <class _ForwardIterator, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
+{
+    return _VSTD::__partition<typename add_lvalue_reference<_Predicate>::type>
+                            (__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
+}
+
+// partition_copy
+
+template <class _InputIterator, class _OutputIterator1,
+          class _OutputIterator2, class _Predicate>
+pair<_OutputIterator1, _OutputIterator2>
+partition_copy(_InputIterator __first, _InputIterator __last,
+               _OutputIterator1 __out_true, _OutputIterator2 __out_false,
+               _Predicate __pred)
+{
+    for (; __first != __last; ++__first)
+    {
+        if (__pred(*__first))
+        {
+            *__out_true = *__first;
+            ++__out_true;
+        }
+        else
+        {
+            *__out_false = *__first;
+            ++__out_false;
+        }
+    }
+    return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false);
+}
+
+// partition_point
+
+template<class _ForwardIterator, class _Predicate>
+_ForwardIterator
+partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
+{
+    typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
+    difference_type __len = _VSTD::distance(__first, __last);
+    while (__len != 0)
+    {
+        difference_type __l2 = __len / 2;
+        _ForwardIterator __m = __first;
+        _VSTD::advance(__m, __l2);
+        if (__pred(*__m))
+        {
+            __first = ++__m;
+            __len -= __l2 + 1;
+        }
+        else
+            __len = __l2;
+    }
+    return __first;
+}
+
+// stable_partition
+
+template <class _Predicate, class _ForwardIterator, class _Distance, class _Pair>
+_ForwardIterator
+__stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
+                   _Distance __len, _Pair __p, forward_iterator_tag __fit)
+{
+    // *__first is known to be false
+    // __len >= 1
+    if (__len == 1)
+        return __first;
+    if (__len == 2)
+    {
+        _ForwardIterator __m = __first;
+        if (__pred(*++__m))
+        {
+            swap(*__first, *__m);
+            return __m;
+        }
+        return __first;
+    }
+    if (__len <= __p.second)
+    {   // The buffer is big enough to use
+        typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+        __destruct_n __d(0);
+        unique_ptr<value_type, __destruct_n&> __h(__p.first, __d);
+        // Move the falses into the temporary buffer, and the trues to the front of the line
+        // Update __first to always point to the end of the trues
+        value_type* __t = __p.first;
+        ::new(__t) value_type(_VSTD::move(*__first));
+        __d.__incr((value_type*)0);
+        ++__t;
+        _ForwardIterator __i = __first;
+        while (++__i != __last)
+        {
+            if (__pred(*__i))
+            {
+                *__first = _VSTD::move(*__i);
+                ++__first;
+            }
+            else
+            {
+                ::new(__t) value_type(_VSTD::move(*__i));
+                __d.__incr((value_type*)0);
+                ++__t;
+            }
+        }
+        // All trues now at start of range, all falses in buffer
+        // Move falses back into range, but don't mess up __first which points to first false
+        __i = __first;
+        for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i)
+            *__i = _VSTD::move(*__t2);
+        // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
+        return __first;
+    }
+    // Else not enough buffer, do in place
+    // __len >= 3
+    _ForwardIterator __m = __first;
+    _Distance __len2 = __len / 2;  // __len2 >= 2
+    _VSTD::advance(__m, __len2);
+    // recurse on [__first, __m), *__first know to be false
+    // F?????????????????
+    // f       m         l
+    typedef typename add_lvalue_reference<_Predicate>::type _PredRef;
+    _ForwardIterator __first_false = __stable_partition<_PredRef>(__first, __m, __pred, __len2, __p, __fit);
+    // TTTFFFFF??????????
+    // f  ff   m         l
+    // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
+    _ForwardIterator __m1 = __m;
+    _ForwardIterator __second_false = __last;
+    _Distance __len_half = __len - __len2;
+    while (__pred(*__m1))
+    {
+        if (++__m1 == __last)
+            goto __second_half_done;
+        --__len_half;
+    }
+    // TTTFFFFFTTTF??????
+    // f  ff   m  m1     l
+    __second_false = __stable_partition<_PredRef>(__m1, __last, __pred, __len_half, __p, __fit);
+__second_half_done:
+    // TTTFFFFFTTTTTFFFFF
+    // f  ff   m    sf   l
+    return _VSTD::rotate(__first_false, __m, __second_false);
+    // TTTTTTTTFFFFFFFFFF
+    //         |
+}
+
+struct __return_temporary_buffer
+{
+    template <class _Tp>
+    _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __p) const {_VSTD::return_temporary_buffer(__p);}
+};
+
+template <class _Predicate, class _ForwardIterator>
+_ForwardIterator
+__stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
+                   forward_iterator_tag)
+{
+    const unsigned __alloc_limit = 3;  // might want to make this a function of trivial assignment
+    // Either prove all true and return __first or point to first false
+    while (true)
+    {
+        if (__first == __last)
+            return __first;
+        if (!__pred(*__first))
+            break;
+        ++__first;
+    }
+    // We now have a reduced range [__first, __last)
+    // *__first is known to be false
+    typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
+    typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+    difference_type __len = _VSTD::distance(__first, __last);
+    pair<value_type*, ptrdiff_t> __p(0, 0);
+    unique_ptr<value_type, __return_temporary_buffer> __h;
+    if (__len >= __alloc_limit)
+    {
+        __p = _VSTD::get_temporary_buffer<value_type>(__len);
+        __h.reset(__p.first);
+    }
+    return __stable_partition<typename add_lvalue_reference<_Predicate>::type>
+                             (__first, __last, __pred, __len, __p, forward_iterator_tag());
+}
+
+template <class _Predicate, class _BidirectionalIterator, class _Distance, class _Pair>
+_BidirectionalIterator
+__stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
+                   _Distance __len, _Pair __p, bidirectional_iterator_tag __bit)
+{
+    // *__first is known to be false
+    // *__last is known to be true
+    // __len >= 2
+    if (__len == 2)
+    {
+        swap(*__first, *__last);
+        return __last;
+    }
+    if (__len == 3)
+    {
+        _BidirectionalIterator __m = __first;
+        if (__pred(*++__m))
+        {
+            swap(*__first, *__m);
+            swap(*__m, *__last);
+            return __last;
+        }
+        swap(*__m, *__last);
+        swap(*__first, *__m);
+        return __m;
+    }
+    if (__len <= __p.second)
+    {   // The buffer is big enough to use
+        typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+        __destruct_n __d(0);
+        unique_ptr<value_type, __destruct_n&> __h(__p.first, __d);
+        // Move the falses into the temporary buffer, and the trues to the front of the line
+        // Update __first to always point to the end of the trues
+        value_type* __t = __p.first;
+        ::new(__t) value_type(_VSTD::move(*__first));
+        __d.__incr((value_type*)0);
+        ++__t;
+        _BidirectionalIterator __i = __first;
+        while (++__i != __last)
+        {
+            if (__pred(*__i))
+            {
+                *__first = _VSTD::move(*__i);
+                ++__first;
+            }
+            else
+            {
+                ::new(__t) value_type(_VSTD::move(*__i));
+                __d.__incr((value_type*)0);
+                ++__t;
+            }
+        }
+        // move *__last, known to be true
+        *__first = _VSTD::move(*__i);
+        __i = ++__first;
+        // All trues now at start of range, all falses in buffer
+        // Move falses back into range, but don't mess up __first which points to first false
+        for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i)
+            *__i = _VSTD::move(*__t2);
+        // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
+        return __first;
+    }
+    // Else not enough buffer, do in place
+    // __len >= 4
+    _BidirectionalIterator __m = __first;
+    _Distance __len2 = __len / 2;  // __len2 >= 2
+    _VSTD::advance(__m, __len2);
+    // recurse on [__first, __m-1], except reduce __m-1 until *(__m-1) is true, *__first know to be false
+    // F????????????????T
+    // f       m        l
+    _BidirectionalIterator __m1 = __m;
+    _BidirectionalIterator __first_false = __first;
+    _Distance __len_half = __len2;
+    while (!__pred(*--__m1))
+    {
+        if (__m1 == __first)
+            goto __first_half_done;
+        --__len_half;
+    }
+    // F???TFFF?????????T
+    // f   m1  m        l
+    typedef typename add_lvalue_reference<_Predicate>::type _PredRef;
+    __first_false = __stable_partition<_PredRef>(__first, __m1, __pred, __len_half, __p, __bit);
+__first_half_done:
+    // TTTFFFFF?????????T
+    // f  ff   m        l
+    // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
+    __m1 = __m;
+    _BidirectionalIterator __second_false = __last;
+    ++__second_false;
+    __len_half = __len - __len2;
+    while (__pred(*__m1))
+    {
+        if (++__m1 == __last)
+            goto __second_half_done;
+        --__len_half;
+    }
+    // TTTFFFFFTTTF?????T
+    // f  ff   m  m1    l
+    __second_false = __stable_partition<_PredRef>(__m1, __last, __pred, __len_half, __p, __bit);
+__second_half_done:
+    // TTTFFFFFTTTTTFFFFF
+    // f  ff   m    sf  l
+    return _VSTD::rotate(__first_false, __m, __second_false);
+    // TTTTTTTTFFFFFFFFFF
+    //         |
+}
+
+template <class _Predicate, class _BidirectionalIterator>
+_BidirectionalIterator
+__stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
+                   bidirectional_iterator_tag)
+{
+    typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+    typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+    const difference_type __alloc_limit = 4;  // might want to make this a function of trivial assignment
+    // Either prove all true and return __first or point to first false
+    while (true)
+    {
+        if (__first == __last)
+            return __first;
+        if (!__pred(*__first))
+            break;
+        ++__first;
+    }
+    // __first points to first false, everything prior to __first is already set.
+    // Either prove [__first, __last) is all false and return __first, or point __last to last true
+    do
+    {
+        if (__first == --__last)
+            return __first;
+    } while (!__pred(*__last));
+    // We now have a reduced range [__first, __last]
+    // *__first is known to be false
+    // *__last is known to be true
+    // __len >= 2
+    difference_type __len = _VSTD::distance(__first, __last) + 1;
+    pair<value_type*, ptrdiff_t> __p(0, 0);
+    unique_ptr<value_type, __return_temporary_buffer> __h;
+    if (__len >= __alloc_limit)
+    {
+        __p = _VSTD::get_temporary_buffer<value_type>(__len);
+        __h.reset(__p.first);
+    }
+    return __stable_partition<typename add_lvalue_reference<_Predicate>::type>
+                             (__first, __last, __pred, __len, __p, bidirectional_iterator_tag());
+}
+
+template <class _ForwardIterator, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
+{
+    return __stable_partition<typename add_lvalue_reference<_Predicate>::type>
+                             (__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
+}
+
+// is_sorted_until
+
+template <class _ForwardIterator, class _Compare>
+_ForwardIterator
+is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __i = __first;
+        while (++__i != __last)
+        {
+            if (__comp(*__i, *__first))
+                return __i;
+            __first = __i;
+        }
+    }
+    return __last;
+}
+
+template<class _ForwardIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
+{
+    return _VSTD::is_sorted_until(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
+}
+
+// is_sorted
+
+template <class _ForwardIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
+{
+    return _VSTD::is_sorted_until(__first, __last, __comp) == __last;
+}
+
+template<class _ForwardIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+is_sorted(_ForwardIterator __first, _ForwardIterator __last)
+{
+    return _VSTD::is_sorted(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
+}
+
+// sort
+
+// stable, 2-3 compares, 0-2 swaps
+
+template <class _Compare, class _ForwardIterator>
+unsigned
+__sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z, _Compare __c)
+{
+    unsigned __r = 0;
+    if (!__c(*__y, *__x))          // if x <= y
+    {
+        if (!__c(*__z, *__y))      // if y <= z
+            return __r;            // x <= y && y <= z
+                                   // x <= y && y > z
+        swap(*__y, *__z);          // x <= z && y < z
+        __r = 1;
+        if (__c(*__y, *__x))       // if x > y
+        {
+            swap(*__x, *__y);      // x < y && y <= z
+            __r = 2;
+        }
+        return __r;                // x <= y && y < z
+    }
+    if (__c(*__z, *__y))           // x > y, if y > z
+    {
+        swap(*__x, *__z);          // x < y && y < z
+        __r = 1;
+        return __r;
+    }
+    swap(*__x, *__y);              // x > y && y <= z
+    __r = 1;                       // x < y && x <= z
+    if (__c(*__z, *__y))           // if y > z
+    {
+        swap(*__y, *__z);          // x <= y && y < z
+        __r = 2;
+    }
+    return __r;
+}                                  // x <= y && y <= z
+
+// stable, 3-6 compares, 0-5 swaps
+
+template <class _Compare, class _ForwardIterator>
+unsigned
+__sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
+            _ForwardIterator __x4, _Compare __c)
+{
+    unsigned __r = __sort3<_Compare>(__x1, __x2, __x3, __c);
+    if (__c(*__x4, *__x3))
+    {
+        swap(*__x3, *__x4);
+        ++__r;
+        if (__c(*__x3, *__x2))
+        {
+            swap(*__x2, *__x3);
+            ++__r;
+            if (__c(*__x2, *__x1))
+            {
+                swap(*__x1, *__x2);
+                ++__r;
+            }
+        }
+    }
+    return __r;
+}
+
+// stable, 4-10 compares, 0-9 swaps
+
+template <class _Compare, class _ForwardIterator>
+unsigned
+__sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
+            _ForwardIterator __x4, _ForwardIterator __x5, _Compare __c)
+{
+    unsigned __r = __sort4<_Compare>(__x1, __x2, __x3, __x4, __c);
+    if (__c(*__x5, *__x4))
+    {
+        swap(*__x4, *__x5);
+        ++__r;
+        if (__c(*__x4, *__x3))
+        {
+            swap(*__x3, *__x4);
+            ++__r;
+            if (__c(*__x3, *__x2))
+            {
+                swap(*__x2, *__x3);
+                ++__r;
+                if (__c(*__x2, *__x1))
+                {
+                    swap(*__x1, *__x2);
+                    ++__r;
+                }
+            }
+        }
+    }
+    return __r;
+}
+
+// Assumes size > 0
+template <class _Compare, class _BirdirectionalIterator>
+void
+__selection_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp)
+{
+    _BirdirectionalIterator __lm1 = __last;
+    for (--__lm1; __first != __lm1; ++__first)
+    {
+        _BirdirectionalIterator __i = _VSTD::min_element<_BirdirectionalIterator,
+                                                        typename add_lvalue_reference<_Compare>::type>
+                                                       (__first, __last, __comp);
+        if (__i != __first)
+            swap(*__first, *__i);
+    }
+}
+
+template <class _Compare, class _BirdirectionalIterator>
+void
+__insertion_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp)
+{
+    typedef typename iterator_traits<_BirdirectionalIterator>::value_type value_type;
+    if (__first != __last)
+    {
+        _BirdirectionalIterator __i = __first;
+        for (++__i; __i != __last; ++__i)
+        {
+            _BirdirectionalIterator __j = __i;
+            value_type __t(_VSTD::move(*__j));
+            for (_BirdirectionalIterator __k = __i; __k != __first && __comp(__t,  *--__k); --__j)
+                *__j = _VSTD::move(*__k);
+            *__j = _VSTD::move(__t);
+        }
+    }
+}
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+    _RandomAccessIterator __j = __first+2;
+    __sort3<_Compare>(__first, __first+1, __j, __comp);
+    for (_RandomAccessIterator __i = __j+1; __i != __last; ++__i)
+    {
+        if (__comp(*__i, *__j))
+        {
+            value_type __t(_VSTD::move(*__i));
+            _RandomAccessIterator __k = __j;
+            __j = __i;
+            do
+            {
+                *__j = _VSTD::move(*__k);
+                __j = __k;
+            } while (__j != __first && __comp(__t, *--__k));
+            *__j = _VSTD::move(__t);
+        }
+        __j = __i;
+    }
+}
+
+template <class _Compare, class _RandomAccessIterator>
+bool
+__insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+    switch (__last - __first)
+    {
+    case 0:
+    case 1:
+        return true;
+    case 2:
+        if (__comp(*--__last, *__first))
+            swap(*__first, *__last);
+        return true;
+    case 3:
+        _VSTD::__sort3<_Compare>(__first, __first+1, --__last, __comp);
+        return true;
+    case 4:
+        _VSTD::__sort4<_Compare>(__first, __first+1, __first+2, --__last, __comp);
+        return true;
+    case 5:
+        _VSTD::__sort5<_Compare>(__first, __first+1, __first+2, __first+3, --__last, __comp);
+        return true;
+    }
+    typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+    _RandomAccessIterator __j = __first+2;
+    __sort3<_Compare>(__first, __first+1, __j, __comp);
+    const unsigned __limit = 8;
+    unsigned __count = 0;
+    for (_RandomAccessIterator __i = __j+1; __i != __last; ++__i)
+    {
+        if (__comp(*__i, *__j))
+        {
+            value_type __t(_VSTD::move(*__i));
+            _RandomAccessIterator __k = __j;
+            __j = __i;
+            do
+            {
+                *__j = _VSTD::move(*__k);
+                __j = __k;
+            } while (__j != __first && __comp(__t, *--__k));
+            *__j = _VSTD::move(__t);
+            if (++__count == __limit)
+                return ++__i == __last;
+        }
+        __j = __i;
+    }
+    return true;
+}
+
+template <class _Compare, class _BirdirectionalIterator>
+void
+__insertion_sort_move(_BirdirectionalIterator __first1, _BirdirectionalIterator __last1,
+                      typename iterator_traits<_BirdirectionalIterator>::value_type* __first2, _Compare __comp)
+{
+    typedef typename iterator_traits<_BirdirectionalIterator>::value_type value_type;
+    if (__first1 != __last1)
+    {
+        __destruct_n __d(0);
+        unique_ptr<value_type, __destruct_n&> __h(__first2, __d);
+        value_type* __last2 = __first2;
+        ::new(__last2) value_type(_VSTD::move(*__first1));
+        __d.__incr((value_type*)0);
+        for (++__last2; ++__first1 != __last1; ++__last2)
+        {
+            value_type* __j2 = __last2;
+            value_type* __i2 = __j2;
+            if (__comp(*__first1, *--__i2))
+            {
+                ::new(__j2) value_type(_VSTD::move(*__i2));
+                __d.__incr((value_type*)0);
+                for (--__j2; __i2 != __first2 && __comp(*__first1,  *--__i2); --__j2)
+                    *__j2 = _VSTD::move(*__i2);
+                *__j2 = _VSTD::move(*__first1);
+            }
+            else
+            {
+                ::new(__j2) value_type(_VSTD::move(*__first1));
+                __d.__incr((value_type*)0);
+            }
+        }
+        __h.release();
+    }
+}
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+    // _Compare is known to be a reference type
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+    const difference_type __limit = is_trivially_copy_constructible<value_type>::value &&
+                                    is_trivially_copy_assignable<value_type>::value ? 30 : 6;
+    while (true)
+    {
+    __restart:
+        difference_type __len = __last - __first;
+        switch (__len)
+        {
+        case 0:
+        case 1:
+            return;
+        case 2:
+            if (__comp(*--__last, *__first))
+                swap(*__first, *__last);
+            return;
+        case 3:
+            _VSTD::__sort3<_Compare>(__first, __first+1, --__last, __comp);
+            return;
+        case 4:
+            _VSTD::__sort4<_Compare>(__first, __first+1, __first+2, --__last, __comp);
+            return;
+        case 5:
+            _VSTD::__sort5<_Compare>(__first, __first+1, __first+2, __first+3, --__last, __comp);
+            return;
+        }
+        if (__len <= __limit)
+        {
+            _VSTD::__insertion_sort_3<_Compare>(__first, __last, __comp);
+            return;
+        }
+        // __len > 5
+        _RandomAccessIterator __m = __first;
+        _RandomAccessIterator __lm1 = __last;
+        --__lm1;
+        unsigned __n_swaps;
+        {
+        difference_type __delta;
+        if (__len >= 1000)
+        {
+            __delta = __len/2;
+            __m += __delta;
+            __delta /= 2;
+            __n_swaps = _VSTD::__sort5<_Compare>(__first, __first + __delta, __m, __m+__delta, __lm1, __comp);
+        }
+        else
+        {
+            __delta = __len/2;
+            __m += __delta;
+            __n_swaps = _VSTD::__sort3<_Compare>(__first, __m, __lm1, __comp);
+        }
+        }
+        // *__m is median
+        // partition [__first, __m) < *__m and *__m <= [__m, __last)
+        // (this inhibits tossing elements equivalent to __m around unnecessarily)
+        _RandomAccessIterator __i = __first;
+        _RandomAccessIterator __j = __lm1;
+        // j points beyond range to be tested, *__m is known to be <= *__lm1
+        // The search going up is known to be guarded but the search coming down isn't.
+        // Prime the downward search with a guard.
+        if (!__comp(*__i, *__m))  // if *__first == *__m
+        {
+            // *__first == *__m, *__first doesn't go in first part
+            // manually guard downward moving __j against __i
+            while (true)
+            {
+                if (__i == --__j)
+                {
+                    // *__first == *__m, *__m <= all other elements
+                    // Parition instead into [__first, __i) == *__first and *__first < [__i, __last)
+                    ++__i;  // __first + 1
+                    __j = __last;
+                    if (!__comp(*__first, *--__j))  // we need a guard if *__first == *(__last-1)
+                    {
+                        while (true)
+                        {
+                            if (__i == __j)
+                                return;  // [__first, __last) all equivalent elements
+                            if (__comp(*__first, *__i))
+                            {
+                                swap(*__i, *__j);
+                                ++__n_swaps;
+                                ++__i;
+                                break;
+                            }
+                            ++__i;
+                        }
+                    }
+                    // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1
+                    if (__i == __j)
+                        return;
+                    while (true)
+                    {
+                        while (!__comp(*__first, *__i))
+                            ++__i;
+                        while (__comp(*__first, *--__j))
+                            ;
+                        if (__i >= __j)
+                            break;
+                        swap(*__i, *__j);
+                        ++__n_swaps;
+                        ++__i;
+                    }
+                    // [__first, __i) == *__first and *__first < [__i, __last)
+                    // The first part is sorted, sort the secod part
+                    // _VSTD::__sort<_Compare>(__i, __last, __comp);
+                    __first = __i;
+                    goto __restart;
+                }
+                if (__comp(*__j, *__m))
+                {
+                    swap(*__i, *__j);
+                    ++__n_swaps;
+                    break;  // found guard for downward moving __j, now use unguarded partition
+                }
+            }
+        }
+        // It is known that *__i < *__m
+        ++__i;
+        // j points beyond range to be tested, *__m is known to be <= *__lm1
+        // if not yet partitioned...
+        if (__i < __j)
+        {
+            // known that *(__i - 1) < *__m
+            // known that __i <= __m
+            while (true)
+            {
+                // __m still guards upward moving __i
+                while (__comp(*__i, *__m))
+                    ++__i;
+                // It is now known that a guard exists for downward moving __j
+                while (!__comp(*--__j, *__m))
+                    ;
+                if (__i > __j)
+                    break;
+                swap(*__i, *__j);
+                ++__n_swaps;
+                // It is known that __m != __j
+                // If __m just moved, follow it
+                if (__m == __i)
+                    __m = __j;
+                ++__i;
+            }
+        }
+        // [__first, __i) < *__m and *__m <= [__i, __last)
+        if (__i != __m && __comp(*__m, *__i))
+        {
+            swap(*__i, *__m);
+            ++__n_swaps;
+        }
+        // [__first, __i) < *__i and *__i <= [__i+1, __last)
+        // If we were given a perfect partition, see if insertion sort is quick...
+        if (__n_swaps == 0)
+        {
+            bool __fs = _VSTD::__insertion_sort_incomplete<_Compare>(__first, __i, __comp);
+            if (_VSTD::__insertion_sort_incomplete<_Compare>(__i+1, __last, __comp))
+            {
+                if (__fs)
+                    return;
+                __last = __i;
+                continue;
+            }
+            else
+            {
+                if (__fs)
+                {
+                    __first = ++__i;
+                    continue;
+                }
+            }
+        }
+        // sort smaller range with recursive call and larger with tail recursion elimination
+        if (__i - __first < __last - __i)
+        {
+            _VSTD::__sort<_Compare>(__first, __i, __comp);
+            // _VSTD::__sort<_Compare>(__i+1, __last, __comp);
+            __first = ++__i;
+        }
+        else
+        {
+            _VSTD::__sort<_Compare>(__i+1, __last, __comp);
+            // _VSTD::__sort<_Compare>(__first, __i, __comp);
+            __last = __i;
+        }
+    }
+}
+
+// This forwarder keeps the top call and the recursive calls using the same instantiation, forcing a reference _Compare
+template <class _RandomAccessIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    __sort<_Comp_ref>(__first, __last, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    __sort<_Comp_ref>(__first, __last, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+    _VSTD::sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+sort(_Tp** __first, _Tp** __last)
+{
+    _VSTD::sort((size_t*)__first, (size_t*)__last, __less<size_t>());
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last)
+{
+    _VSTD::sort(__first.base(), __last.base());
+}
+
+template <class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp)
+{
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    _VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
+}
+
+#ifdef _LIBCPP_MSVC
+#pragma warning( push )
+#pragma warning( disable: 4231)
+#endif // _LIBCPP_MSVC
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<char>&, char*>(char*, char*, __less<char>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<short>&, short*>(short*, short*, __less<short>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<int>&, int*>(int*, int*, __less<int>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<long>&, long*>(long*, long*, __less<long>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<float>&, float*>(float*, float*, __less<float>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<double>&, double*>(double*, double*, __less<double>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
+
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
+
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&))
+#ifdef _LIBCPP_MSVC
+#pragma warning( pop )
+#endif  // _LIBCPP_MSVC
+
+// lower_bound
+
+template <class _Compare, class _ForwardIterator, class _Tp>
+_ForwardIterator
+__lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
+{
+    typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
+    difference_type __len = _VSTD::distance(__first, __last);
+    while (__len != 0)
+    {
+        difference_type __l2 = __len / 2;
+        _ForwardIterator __m = __first;
+        _VSTD::advance(__m, __l2);
+        if (__comp(*__m, __value_))
+        {
+            __first = ++__m;
+            __len -= __l2 + 1;
+        }
+        else
+            __len = __l2;
+    }
+    return __first;
+}
+
+template <class _ForwardIterator, class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __lower_bound<_Comp_ref>(__first, __last, __value_, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __lower_bound<_Comp_ref>(__first, __last, __value_, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _ForwardIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
+{
+    return _VSTD::lower_bound(__first, __last, __value_,
+                             __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
+}
+
+// upper_bound
+
+template <class _Compare, class _ForwardIterator, class _Tp>
+_ForwardIterator
+__upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
+{
+    typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
+    difference_type __len = _VSTD::distance(__first, __last);
+    while (__len != 0)
+    {
+        difference_type __l2 = __len / 2;
+        _ForwardIterator __m = __first;
+        _VSTD::advance(__m, __l2);
+        if (__comp(__value_, *__m))
+            __len = __l2;
+        else
+        {
+            __first = ++__m;
+            __len -= __l2 + 1;
+        }
+    }
+    return __first;
+}
+
+template <class _ForwardIterator, class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __upper_bound<_Comp_ref>(__first, __last, __value_, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __upper_bound<_Comp_ref>(__first, __last, __value_, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _ForwardIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
+upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
+{
+    return _VSTD::upper_bound(__first, __last, __value_,
+                             __less<_Tp, typename iterator_traits<_ForwardIterator>::value_type>());
+}
+
+// equal_range
+
+template <class _Compare, class _ForwardIterator, class _Tp>
+pair<_ForwardIterator, _ForwardIterator>
+__equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
+{
+    typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
+    difference_type __len = _VSTD::distance(__first, __last);
+    while (__len != 0)
+    {
+        difference_type __l2 = __len / 2;
+        _ForwardIterator __m = __first;
+        _VSTD::advance(__m, __l2);
+        if (__comp(*__m, __value_))
+        {
+            __first = ++__m;
+            __len -= __l2 + 1;
+        }
+        else if (__comp(__value_, *__m))
+        {
+            __last = __m;
+            __len = __l2;
+        }
+        else
+        {
+            _ForwardIterator __mp1 = __m;
+            return pair<_ForwardIterator, _ForwardIterator>
+                   (
+                      __lower_bound<_Compare>(__first, __m, __value_, __comp),
+                      __upper_bound<_Compare>(++__mp1, __last, __value_, __comp)
+                   );
+        }
+    }
+    return pair<_ForwardIterator, _ForwardIterator>(__first, __first);
+}
+
+template <class _ForwardIterator, class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+pair<_ForwardIterator, _ForwardIterator>
+equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __equal_range<_Comp_ref>(__first, __last, __value_, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __equal_range<_Comp_ref>(__first, __last, __value_, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _ForwardIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+pair<_ForwardIterator, _ForwardIterator>
+equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
+{
+    return _VSTD::equal_range(__first, __last, __value_,
+                             __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
+}
+
+// binary_search
+
+template <class _Compare, class _ForwardIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
+{
+    __first = __lower_bound<_Compare>(__first, __last, __value_, __comp);
+    return __first != __last && !__comp(__value_, *__first);
+}
+
+template <class _ForwardIterator, class _Tp, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __binary_search<_Comp_ref>(__first, __last, __value_, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __binary_search<_Comp_ref>(__first, __last, __value_, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _ForwardIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
+{
+    return _VSTD::binary_search(__first, __last, __value_,
+                             __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
+}
+
+// merge
+
+template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
+_OutputIterator
+__merge(_InputIterator1 __first1, _InputIterator1 __last1,
+        _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
+{
+    for (; __first1 != __last1; ++__result)
+    {
+        if (__first2 == __last2)
+            return _VSTD::copy(__first1, __last1, __result);
+        if (__comp(*__first2, *__first1))
+        {
+            *__result = *__first2;
+            ++__first2;
+        }
+        else
+        {
+            *__result = *__first1;
+            ++__first1;
+        }
+    }
+    return _VSTD::copy(__first2, __last2, __result);
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+merge(_InputIterator1 __first1, _InputIterator1 __last1,
+      _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+merge(_InputIterator1 __first1, _InputIterator1 __last1,
+      _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
+{
+    typedef typename iterator_traits<_InputIterator1>::value_type __v1;
+    typedef typename iterator_traits<_InputIterator2>::value_type __v2;
+    return merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>());
+}
+
+// inplace_merge
+
+template <class _Compare, class _InputIterator1, class _InputIterator2,
+          class _OutputIterator>
+void __half_inplace_merge(_InputIterator1 __first1, _InputIterator1 __last1,
+                          _InputIterator2 __first2, _InputIterator2 __last2,
+                          _OutputIterator __result, _Compare __comp)
+{
+    for (; __first1 != __last1; ++__result)
+    {
+        if (__first2 == __last2)
+        {
+            _VSTD::move(__first1, __last1, __result);
+            return;
+        }
+
+        if (__comp(*__first2, *__first1))
+        {
+            *__result = _VSTD::move(*__first2);
+            ++__first2;
+        }
+        else
+        {
+            *__result = _VSTD::move(*__first1);
+            ++__first1;
+        }
+    }
+    // __first2 through __last2 are already in the right spot.
+}
+
+template <class _Compare, class _BidirectionalIterator>
+void
+__buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
+                _Compare __comp, typename iterator_traits<_BidirectionalIterator>::difference_type __len1,
+                                 typename iterator_traits<_BidirectionalIterator>::difference_type __len2,
+                typename iterator_traits<_BidirectionalIterator>::value_type* __buff)
+{
+    typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+    __destruct_n __d(0);
+    unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
+    if (__len1 <= __len2)
+    {
+        value_type* __p = __buff;
+        for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, ++__p)
+            ::new(__p) value_type(_VSTD::move(*__i));
+        __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp);
+    }
+    else
+    {
+        value_type* __p = __buff;
+        for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, ++__p)
+            ::new(__p) value_type(_VSTD::move(*__i));
+        typedef reverse_iterator<_BidirectionalIterator> _RBi;
+        typedef reverse_iterator<value_type*> _Rv;
+        __half_inplace_merge(_Rv(__p), _Rv(__buff), 
+                             _RBi(__middle), _RBi(__first),
+                             _RBi(__last), __negate<_Compare>(__comp));
+    }
+}
+
+template <class _Compare, class _BidirectionalIterator>
+void
+__inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
+                _Compare __comp, typename iterator_traits<_BidirectionalIterator>::difference_type __len1,
+                                 typename iterator_traits<_BidirectionalIterator>::difference_type __len2,
+                typename iterator_traits<_BidirectionalIterator>::value_type* __buff, ptrdiff_t __buff_size)
+{
+    typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+    while (true)
+    {
+        // if __middle == __last, we're done
+        if (__len2 == 0)
+            return;
+        if (__len1 <= __buff_size || __len2 <= __buff_size)
+            return __buffered_inplace_merge<_Compare>
+                   (__first, __middle, __last, __comp, __len1, __len2, __buff);
+        // shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
+        for (; true; ++__first, (void) --__len1)
+        {
+            if (__len1 == 0)
+                return;
+            if (__comp(*__middle, *__first))
+                break;
+        }
+        // __first < __middle < __last
+        // *__first > *__middle
+        // partition [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last) such that
+        //     all elements in:
+        //         [__first, __m1)  <= [__middle, __m2)
+        //         [__middle, __m2) <  [__m1, __middle)
+        //         [__m1, __middle) <= [__m2, __last)
+        //     and __m1 or __m2 is in the middle of its range
+        _BidirectionalIterator __m1;  // "median" of [__first, __middle)
+        _BidirectionalIterator __m2;  // "median" of [__middle, __last)
+        difference_type __len11;      // distance(__first, __m1)
+        difference_type __len21;      // distance(__middle, __m2)
+        // binary search smaller range
+        if (__len1 < __len2)
+        {   // __len >= 1, __len2 >= 2
+            __len21 = __len2 / 2;
+            __m2 = __middle;
+            _VSTD::advance(__m2, __len21);
+            __m1 = __upper_bound<_Compare>(__first, __middle, *__m2, __comp);
+            __len11 = _VSTD::distance(__first, __m1);
+        }
+        else
+        {
+            if (__len1 == 1)
+            {   // __len1 >= __len2 && __len2 > 0, therefore __len2 == 1
+                // It is known *__first > *__middle
+                swap(*__first, *__middle);
+                return;
+            }
+            // __len1 >= 2, __len2 >= 1
+            __len11 = __len1 / 2;
+            __m1 = __first;
+            _VSTD::advance(__m1, __len11);
+            __m2 = __lower_bound<_Compare>(__middle, __last, *__m1, __comp);
+            __len21 = _VSTD::distance(__middle, __m2);
+        }
+        difference_type __len12 = __len1 - __len11;  // distance(__m1, __middle)
+        difference_type __len22 = __len2 - __len21;  // distance(__m2, __last)
+        // [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last)
+        // swap middle two partitions
+        __middle = _VSTD::rotate(__m1, __middle, __m2);
+        // __len12 and __len21 now have swapped meanings
+        // merge smaller range with recurisve call and larger with tail recursion elimination
+        if (__len11 + __len21 < __len12 + __len22)
+        {
+            __inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size);
+//          __inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size);
+            __first = __middle;
+            __middle = __m2;
+            __len1 = __len12;
+            __len2 = __len22;
+        }
+        else
+        {
+            __inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size);
+//          __inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size);
+            __last = __middle;
+            __middle = __m1;
+            __len1 = __len11;
+            __len2 = __len21;
+        }
+    }
+}
+
+template <class _BidirectionalIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
+              _Compare __comp)
+{
+    typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+    typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+    difference_type __len1 = _VSTD::distance(__first, __middle);
+    difference_type __len2 = _VSTD::distance(__middle, __last);
+    difference_type __buf_size = _VSTD::min(__len1, __len2);
+    pair<value_type*, ptrdiff_t> __buf = _VSTD::get_temporary_buffer<value_type>(__buf_size);
+    unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
+
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __c, __len1, __len2,
+                                            __buf.first, __buf.second);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,
+                                            __buf.first, __buf.second);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _BidirectionalIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last)
+{
+    _VSTD::inplace_merge(__first, __middle, __last,
+                        __less<typename iterator_traits<_BidirectionalIterator>::value_type>());
+}
+
+// stable_sort
+
+template <class _Compare, class _InputIterator1, class _InputIterator2>
+void
+__merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
+        _InputIterator2 __first2, _InputIterator2 __last2,
+        typename iterator_traits<_InputIterator1>::value_type* __result, _Compare __comp)
+{
+    typedef typename iterator_traits<_InputIterator1>::value_type value_type;
+    __destruct_n __d(0);
+    unique_ptr<value_type, __destruct_n&> __h(__result, __d);
+    for (; true; ++__result)
+    {
+        if (__first1 == __last1)
+        {
+            for (; __first2 != __last2; ++__first2, ++__result, __d.__incr((value_type*)0))
+                ::new (__result) value_type(_VSTD::move(*__first2));
+            __h.release();
+            return;
+        }
+        if (__first2 == __last2)
+        {
+            for (; __first1 != __last1; ++__first1, ++__result, __d.__incr((value_type*)0))
+                ::new (__result) value_type(_VSTD::move(*__first1));
+            __h.release();
+            return;
+        }
+        if (__comp(*__first2, *__first1))
+        {
+            ::new (__result) value_type(_VSTD::move(*__first2));
+            __d.__incr((value_type*)0);
+            ++__first2;
+        }
+        else
+        {
+            ::new (__result) value_type(_VSTD::move(*__first1));
+            __d.__incr((value_type*)0);
+            ++__first1;
+        }
+    }
+}
+
+template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
+void
+__merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,
+        _InputIterator2 __first2, _InputIterator2 __last2,
+        _OutputIterator __result, _Compare __comp)
+{
+    for (; __first1 != __last1; ++__result)
+    {
+        if (__first2 == __last2)
+        {
+            for (; __first1 != __last1; ++__first1, ++__result)
+                *__result = _VSTD::move(*__first1);
+            return;
+        }
+        if (__comp(*__first2, *__first1))
+        {
+            *__result = _VSTD::move(*__first2);
+            ++__first2;
+        }
+        else
+        {
+            *__result = _VSTD::move(*__first1);
+            ++__first1;
+        }
+    }
+    for (; __first2 != __last2; ++__first2, ++__result)
+        *__result = _VSTD::move(*__first2);
+}
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
+              typename iterator_traits<_RandomAccessIterator>::difference_type __len,
+              typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size);
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1, _Compare __comp,
+                   typename iterator_traits<_RandomAccessIterator>::difference_type __len,
+                   typename iterator_traits<_RandomAccessIterator>::value_type* __first2)
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+    switch (__len)
+    {
+    case 0:
+        return;
+    case 1:
+        ::new(__first2) value_type(_VSTD::move(*__first1));
+        return;
+    case 2:
+       __destruct_n __d(0);
+        unique_ptr<value_type, __destruct_n&> __h2(__first2, __d);
+         if (__comp(*--__last1, *__first1))
+        {
+            ::new(__first2) value_type(_VSTD::move(*__last1));
+            __d.__incr((value_type*)0);
+            ++__first2;
+            ::new(__first2) value_type(_VSTD::move(*__first1));
+        }
+        else
+        {
+            ::new(__first2) value_type(_VSTD::move(*__first1));
+            __d.__incr((value_type*)0);
+            ++__first2;
+            ::new(__first2) value_type(_VSTD::move(*__last1));
+        }
+        __h2.release();
+        return;
+    }
+    if (__len <= 8)
+    {
+        __insertion_sort_move<_Compare>(__first1, __last1, __first2, __comp);
+        return;
+    }
+    typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
+    _RandomAccessIterator __m = __first1 + __l2;
+    __stable_sort<_Compare>(__first1, __m, __comp, __l2, __first2, __l2);
+    __stable_sort<_Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2);
+    __merge_move_construct<_Compare>(__first1, __m, __m, __last1, __first2, __comp);
+}
+
+template <class _Tp>
+struct __stable_sort_switch
+{
+    static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value;
+};
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
+              typename iterator_traits<_RandomAccessIterator>::difference_type __len,
+              typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size)
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    switch (__len)
+    {
+    case 0:
+    case 1:
+        return;
+    case 2:
+        if (__comp(*--__last, *__first))
+            swap(*__first, *__last);
+        return;
+    }
+    if (__len <= static_cast<difference_type>(__stable_sort_switch<value_type>::value))
+    {
+        __insertion_sort<_Compare>(__first, __last, __comp);
+        return;
+    }
+    typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
+    _RandomAccessIterator __m = __first + __l2;
+    if (__len <= __buff_size)
+    {
+        __destruct_n __d(0);
+        unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
+        __stable_sort_move<_Compare>(__first, __m, __comp, __l2, __buff);
+        __d.__set(__l2, (value_type*)0);
+        __stable_sort_move<_Compare>(__m, __last, __comp, __len - __l2, __buff + __l2);
+        __d.__set(__len, (value_type*)0);
+        __merge_move_assign<_Compare>(__buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp);
+//         __merge<_Compare>(move_iterator<value_type*>(__buff),
+//                           move_iterator<value_type*>(__buff + __l2),
+//                           move_iterator<_RandomAccessIterator>(__buff + __l2),
+//                           move_iterator<_RandomAccessIterator>(__buff + __len),
+//                           __first, __comp);
+        return;
+    }
+    __stable_sort<_Compare>(__first, __m, __comp, __l2, __buff, __buff_size);
+    __stable_sort<_Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size);
+    __inplace_merge<_Compare>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size);
+}
+
+template <class _RandomAccessIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    difference_type __len = __last - __first;
+    pair<value_type*, ptrdiff_t> __buf(0, 0);
+    unique_ptr<value_type, __return_temporary_buffer> __h;
+    if (__len > static_cast<difference_type>(__stable_sort_switch<value_type>::value))
+    {
+        __buf = _VSTD::get_temporary_buffer<value_type>(__len);
+        __h.reset(__buf.first);
+    }
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    __stable_sort<_Comp_ref>(__first, __last, __c, __len, __buf.first, __buf.second);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    __stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+    _VSTD::stable_sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+// is_heap_until
+
+template <class _RandomAccessIterator, class _Compare>
+_RandomAccessIterator
+is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+    typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    difference_type __len = __last - __first;
+    difference_type __p = 0;
+    difference_type __c = 1;
+    _RandomAccessIterator __pp = __first;
+    while (__c < __len)
+    {
+        _RandomAccessIterator __cp = __first + __c;
+        if (__comp(*__pp, *__cp))
+            return __cp;
+        ++__c;
+        ++__cp;
+        if (__c == __len)
+            return __last;
+        if (__comp(*__pp, *__cp))
+            return __cp;
+        ++__p;
+        ++__pp;
+        __c = 2 * __p + 1;
+    }
+    return __last;
+}
+
+template<class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_RandomAccessIterator
+is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+    return _VSTD::is_heap_until(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+// is_heap
+
+template <class _RandomAccessIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+    return _VSTD::is_heap_until(__first, __last, __comp) == __last;
+}
+
+template<class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+    return _VSTD::is_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+// push_heap
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
+          typename iterator_traits<_RandomAccessIterator>::difference_type __len)
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+    if (__len > 1)
+    {
+        __len = (__len - 2) / 2;
+        _RandomAccessIterator __ptr = __first + __len;
+        if (__comp(*__ptr, *--__last))
+        {
+            value_type __t(_VSTD::move(*__last));
+            do
+            {
+                *__last = _VSTD::move(*__ptr);
+                __last = __ptr;
+                if (__len == 0)
+                    break;
+                __len = (__len - 1) / 2;
+                __ptr = __first + __len;
+            } while (__comp(*__ptr, __t));
+            *__last = _VSTD::move(__t);
+        }
+    }
+}
+
+template <class _RandomAccessIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    __sift_up<_Comp_ref>(__first, __last, __c, __last - __first);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    __sift_up<_Comp_ref>(__first, __last, __comp, __last - __first);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+    _VSTD::push_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+// pop_heap
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__sift_down(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
+            typename iterator_traits<_RandomAccessIterator>::difference_type __len,
+            _RandomAccessIterator __start)
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+    // left-child of __start is at 2 * __start + 1
+    // right-child of __start is at 2 * __start + 2
+    difference_type __child = __start - __first;
+
+    if (__len < 2 || (__len - 2) / 2 < __child)
+        return;
+
+    __child = 2 * __child + 1;
+    _RandomAccessIterator __child_i = __first + __child;
+
+    if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + 1))) {
+        // right-child exists and is greater than left-child
+        ++__child_i;
+        ++__child;
+    }
+
+    // check if we are in heap-order
+    if (__comp(*__child_i, *__start))
+        // we are, __start is larger than it's largest child
+        return;
+
+    value_type __top(_VSTD::move(*__start));
+    do
+    {
+        // we are not in heap-order, swap the parent with it's largest child
+        *__start = _VSTD::move(*__child_i);
+        __start = __child_i;
+
+        if ((__len - 2) / 2 < __child)
+            break;
+
+        // recompute the child based off of the updated parent
+        __child = 2 * __child + 1;
+        __child_i = __first + __child;
+
+        if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + 1))) {
+            // right-child exists and is greater than left-child
+            ++__child_i;
+            ++__child;
+        }
+
+        // check if we are in heap-order
+    } while (!__comp(*__child_i, __top));
+    *__start = _VSTD::move(__top);
+}
+
+template <class _Compare, class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
+           typename iterator_traits<_RandomAccessIterator>::difference_type __len)
+{
+    if (__len > 1)
+    {
+        swap(*__first, *--__last);
+        __sift_down<_Compare>(__first, __last, __comp, __len - 1, __first);
+    }
+}
+
+template <class _RandomAccessIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    __pop_heap<_Comp_ref>(__first, __last, __c, __last - __first);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    __pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+    _VSTD::pop_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+// make_heap
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    difference_type __n = __last - __first;
+    if (__n > 1)
+    {
+        // start from the first parent, there is no need to consider children
+        for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start)
+        {
+            __sift_down<_Compare>(__first, __last, __comp, __n, __first + __start);
+        }
+    }
+}
+
+template <class _RandomAccessIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    __make_heap<_Comp_ref>(__first, __last, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    __make_heap<_Comp_ref>(__first, __last, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+    _VSTD::make_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+// sort_heap
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    for (difference_type __n = __last - __first; __n > 1; --__last, --__n)
+        __pop_heap<_Compare>(__first, __last, __comp, __n);
+}
+
+template <class _RandomAccessIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    __sort_heap<_Comp_ref>(__first, __last, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    __sort_heap<_Comp_ref>(__first, __last, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+    _VSTD::sort_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+// partial_sort
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
+             _Compare __comp)
+{
+    __make_heap<_Compare>(__first, __middle, __comp);
+    typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first;
+    for (_RandomAccessIterator __i = __middle; __i != __last; ++__i)
+    {
+        if (__comp(*__i, *__first))
+        {
+            swap(*__i, *__first);
+            __sift_down<_Compare>(__first, __middle, __comp, __len, __first);
+        }
+    }
+    __sort_heap<_Compare>(__first, __middle, __comp);
+}
+
+template <class _RandomAccessIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
+             _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    __partial_sort<_Comp_ref>(__first, __middle, __last, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    __partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
+{
+    _VSTD::partial_sort(__first, __middle, __last,
+                       __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+// partial_sort_copy
+
+template <class _Compare, class _InputIterator, class _RandomAccessIterator>
+_RandomAccessIterator
+__partial_sort_copy(_InputIterator __first, _InputIterator __last,
+                    _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
+{
+    _RandomAccessIterator __r = __result_first;
+    if (__r != __result_last)
+    {
+        for (; __first != __last && __r != __result_last; (void) ++__first, ++__r)
+            *__r = *__first;
+        __make_heap<_Compare>(__result_first, __r, __comp);
+        typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
+        for (; __first != __last; ++__first)
+            if (__comp(*__first, *__result_first))
+            {
+                *__result_first = *__first;
+                __sift_down<_Compare>(__result_first, __r, __comp, __len, __result_first);
+            }
+        __sort_heap<_Compare>(__result_first, __r, __comp);
+    }
+    return __r;
+}
+
+template <class _InputIterator, class _RandomAccessIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+_RandomAccessIterator
+partial_sort_copy(_InputIterator __first, _InputIterator __last,
+                  _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _InputIterator, class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_RandomAccessIterator
+partial_sort_copy(_InputIterator __first, _InputIterator __last,
+                  _RandomAccessIterator __result_first, _RandomAccessIterator __result_last)
+{
+    return _VSTD::partial_sort_copy(__first, __last, __result_first, __result_last,
+                                   __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+// nth_element
+
+template <class _Compare, class _RandomAccessIterator>
+void
+__nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
+{
+    // _Compare is known to be a reference type
+    typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+    const difference_type __limit = 7;
+    while (true)
+    {
+    __restart:
+        if (__nth == __last)
+            return;
+        difference_type __len = __last - __first;
+        switch (__len)
+        {
+        case 0:
+        case 1:
+            return;
+        case 2:
+            if (__comp(*--__last, *__first))
+                swap(*__first, *__last);
+            return;
+        case 3:
+            {
+            _RandomAccessIterator __m = __first;
+            _VSTD::__sort3<_Compare>(__first, ++__m, --__last, __comp);
+            return;
+            }
+        }
+        if (__len <= __limit)
+        {
+            __selection_sort<_Compare>(__first, __last, __comp);
+            return;
+        }
+        // __len > __limit >= 3
+        _RandomAccessIterator __m = __first + __len/2;
+        _RandomAccessIterator __lm1 = __last;
+        unsigned __n_swaps = _VSTD::__sort3<_Compare>(__first, __m, --__lm1, __comp);
+        // *__m is median
+        // partition [__first, __m) < *__m and *__m <= [__m, __last)
+        // (this inhibits tossing elements equivalent to __m around unnecessarily)
+        _RandomAccessIterator __i = __first;
+        _RandomAccessIterator __j = __lm1;
+        // j points beyond range to be tested, *__lm1 is known to be <= *__m
+        // The search going up is known to be guarded but the search coming down isn't.
+        // Prime the downward search with a guard.
+        if (!__comp(*__i, *__m))  // if *__first == *__m
+        {
+            // *__first == *__m, *__first doesn't go in first part
+            // manually guard downward moving __j against __i
+            while (true)
+            {
+                if (__i == --__j)
+                {
+                    // *__first == *__m, *__m <= all other elements
+                    // Parition instead into [__first, __i) == *__first and *__first < [__i, __last)
+                    ++__i;  // __first + 1
+                    __j = __last;
+                    if (!__comp(*__first, *--__j))  // we need a guard if *__first == *(__last-1)
+                    {
+                        while (true)
+                        {
+                            if (__i == __j)
+                                return;  // [__first, __last) all equivalent elements
+                            if (__comp(*__first, *__i))
+                            {
+                                swap(*__i, *__j);
+                                ++__n_swaps;
+                                ++__i;
+                                break;
+                            }
+                            ++__i;
+                        }
+                    }
+                    // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1
+                    if (__i == __j)
+                        return;
+                    while (true)
+                    {
+                        while (!__comp(*__first, *__i))
+                            ++__i;
+                        while (__comp(*__first, *--__j))
+                            ;
+                        if (__i >= __j)
+                            break;
+                        swap(*__i, *__j);
+                        ++__n_swaps;
+                        ++__i;
+                    }
+                    // [__first, __i) == *__first and *__first < [__i, __last)
+                    // The first part is sorted,
+                    if (__nth < __i)
+                        return;
+                    // __nth_element the secod part
+                    // __nth_element<_Compare>(__i, __nth, __last, __comp);
+                    __first = __i;
+                    goto __restart;
+                }
+                if (__comp(*__j, *__m))
+                {
+                    swap(*__i, *__j);
+                    ++__n_swaps;
+                    break;  // found guard for downward moving __j, now use unguarded partition
+                }
+            }
+        }
+        ++__i;
+        // j points beyond range to be tested, *__lm1 is known to be <= *__m
+        // if not yet partitioned...
+        if (__i < __j)
+        {
+            // known that *(__i - 1) < *__m
+            while (true)
+            {
+                // __m still guards upward moving __i
+                while (__comp(*__i, *__m))
+                    ++__i;
+                // It is now known that a guard exists for downward moving __j
+                while (!__comp(*--__j, *__m))
+                    ;
+                if (__i >= __j)
+                    break;
+                swap(*__i, *__j);
+                ++__n_swaps;
+                // It is known that __m != __j
+                // If __m just moved, follow it
+                if (__m == __i)
+                    __m = __j;
+                ++__i;
+            }
+        }
+        // [__first, __i) < *__m and *__m <= [__i, __last)
+        if (__i != __m && __comp(*__m, *__i))
+        {
+            swap(*__i, *__m);
+            ++__n_swaps;
+        }
+        // [__first, __i) < *__i and *__i <= [__i+1, __last)
+        if (__nth == __i)
+            return;
+        if (__n_swaps == 0)
+        {
+            // We were given a perfectly partitioned sequence.  Coincidence?
+            if (__nth < __i)
+            {
+                // Check for [__first, __i) already sorted
+                __j = __m = __first;
+                while (++__j != __i)
+                {
+                    if (__comp(*__j, *__m))
+                        // not yet sorted, so sort
+                        goto not_sorted;
+                    __m = __j;
+                }
+                // [__first, __i) sorted
+                return;
+            }
+            else
+            {
+                // Check for [__i, __last) already sorted
+                __j = __m = __i;
+                while (++__j != __last)
+                {
+                    if (__comp(*__j, *__m))
+                        // not yet sorted, so sort
+                        goto not_sorted;
+                    __m = __j;
+                }
+                // [__i, __last) sorted
+                return;
+            }
+        }
+not_sorted:
+        // __nth_element on range containing __nth
+        if (__nth < __i)
+        {
+            // __nth_element<_Compare>(__first, __nth, __i, __comp);
+            __last = __i;
+        }
+        else
+        {
+            // __nth_element<_Compare>(__i+1, __nth, __last, __comp);
+            __first = ++__i;
+        }
+    }
+}
+
+template <class _RandomAccessIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    __nth_element<_Comp_ref>(__first, __nth, __last, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    __nth_element<_Comp_ref>(__first, __nth, __last, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last)
+{
+    _VSTD::nth_element(__first, __nth, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
+}
+
+// includes
+
+template <class _Compare, class _InputIterator1, class _InputIterator2>
+bool
+__includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
+           _Compare __comp)
+{
+    for (; __first2 != __last2; ++__first1)
+    {
+        if (__first1 == __last1 || __comp(*__first2, *__first1))
+            return false;
+        if (!__comp(*__first1, *__first2))
+            ++__first2;
+    }
+    return true;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
+         _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _InputIterator1, class _InputIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2)
+{
+    return _VSTD::includes(__first1, __last1, __first2, __last2,
+                          __less<typename iterator_traits<_InputIterator1>::value_type,
+                                 typename iterator_traits<_InputIterator2>::value_type>());
+}
+
+// set_union
+
+template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
+_OutputIterator
+__set_union(_InputIterator1 __first1, _InputIterator1 __last1,
+            _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
+{
+    for (; __first1 != __last1; ++__result)
+    {
+        if (__first2 == __last2)
+            return _VSTD::copy(__first1, __last1, __result);
+        if (__comp(*__first2, *__first1))
+        {
+            *__result = *__first2;
+            ++__first2;
+        }
+        else
+        {
+            *__result = *__first1;
+            if (!__comp(*__first1, *__first2))
+                ++__first2;
+            ++__first1;
+        }
+    }
+    return _VSTD::copy(__first2, __last2, __result);
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+set_union(_InputIterator1 __first1, _InputIterator1 __last1,
+          _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+set_union(_InputIterator1 __first1, _InputIterator1 __last1,
+          _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
+{
+    return _VSTD::set_union(__first1, __last1, __first2, __last2, __result,
+                          __less<typename iterator_traits<_InputIterator1>::value_type,
+                                 typename iterator_traits<_InputIterator2>::value_type>());
+}
+
+// set_intersection
+
+template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
+_OutputIterator
+__set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
+                   _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
+{
+    while (__first1 != __last1 && __first2 != __last2)
+    {
+        if (__comp(*__first1, *__first2))
+            ++__first1;
+        else
+        {
+            if (!__comp(*__first2, *__first1))
+            {
+                *__result = *__first1;
+                ++__result;
+                ++__first1;
+            }
+            ++__first2;
+        }
+    }
+    return __result;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
+                 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
+                 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
+{
+    return _VSTD::set_intersection(__first1, __last1, __first2, __last2, __result,
+                                  __less<typename iterator_traits<_InputIterator1>::value_type,
+                                         typename iterator_traits<_InputIterator2>::value_type>());
+}
+
+// set_difference
+
+template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
+_OutputIterator
+__set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+                 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
+{
+    while (__first1 != __last1)
+    {
+        if (__first2 == __last2)
+            return _VSTD::copy(__first1, __last1, __result);
+        if (__comp(*__first1, *__first2))
+        {
+            *__result = *__first1;
+            ++__result;
+            ++__first1;
+        }
+        else
+        {
+            if (!__comp(*__first2, *__first1))
+                ++__first1;
+            ++__first2;
+        }
+    }
+    return __result;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+               _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+               _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
+{
+    return _VSTD::set_difference(__first1, __last1, __first2, __last2, __result,
+                                __less<typename iterator_traits<_InputIterator1>::value_type,
+                                       typename iterator_traits<_InputIterator2>::value_type>());
+}
+
+// set_symmetric_difference
+
+template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
+_OutputIterator
+__set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+                           _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
+{
+    while (__first1 != __last1)
+    {
+        if (__first2 == __last2)
+            return _VSTD::copy(__first1, __last1, __result);
+        if (__comp(*__first1, *__first2))
+        {
+            *__result = *__first1;
+            ++__result;
+            ++__first1;
+        }
+        else
+        {
+            if (__comp(*__first2, *__first1))
+            {
+                *__result = *__first2;
+                ++__result;
+            }
+            else
+                ++__first1;
+            ++__first2;
+        }
+    }
+    return _VSTD::copy(__first2, __last2, __result);
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+                         _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+                         _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
+{
+    return _VSTD::set_symmetric_difference(__first1, __last1, __first2, __last2, __result,
+                                          __less<typename iterator_traits<_InputIterator1>::value_type,
+                                                 typename iterator_traits<_InputIterator2>::value_type>());
+}
+
+// lexicographical_compare
+
+template <class _Compare, class _InputIterator1, class _InputIterator2>
+bool
+__lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
+                          _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
+{
+    for (; __first2 != __last2; ++__first1, (void) ++__first2)
+    {
+        if (__first1 == __last1 || __comp(*__first1, *__first2))
+            return true;
+        if (__comp(*__first2, *__first1))
+            return false;
+    }
+    return false;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
+                        _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _InputIterator1, class _InputIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
+                        _InputIterator2 __first2, _InputIterator2 __last2)
+{
+    return _VSTD::lexicographical_compare(__first1, __last1, __first2, __last2,
+                                         __less<typename iterator_traits<_InputIterator1>::value_type,
+                                                typename iterator_traits<_InputIterator2>::value_type>());
+}
+
+// next_permutation
+
+template <class _Compare, class _BidirectionalIterator>
+bool
+__next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
+{
+    _BidirectionalIterator __i = __last;
+    if (__first == __last || __first == --__i)
+        return false;
+    while (true)
+    {
+        _BidirectionalIterator __ip1 = __i;
+        if (__comp(*--__i, *__ip1))
+        {
+            _BidirectionalIterator __j = __last;
+            while (!__comp(*__i, *--__j))
+                ;
+            swap(*__i, *__j);
+            _VSTD::reverse(__ip1, __last);
+            return true;
+        }
+        if (__i == __first)
+        {
+            _VSTD::reverse(__first, __last);
+            return false;
+        }
+    }
+}
+
+template <class _BidirectionalIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __next_permutation<_Comp_ref>(__first, __last, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __next_permutation<_Comp_ref>(__first, __last, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _BidirectionalIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
+{
+    return _VSTD::next_permutation(__first, __last,
+                                  __less<typename iterator_traits<_BidirectionalIterator>::value_type>());
+}
+
+// prev_permutation
+
+template <class _Compare, class _BidirectionalIterator>
+bool
+__prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
+{
+    _BidirectionalIterator __i = __last;
+    if (__first == __last || __first == --__i)
+        return false;
+    while (true)
+    {
+        _BidirectionalIterator __ip1 = __i;
+        if (__comp(*__ip1, *--__i))
+        {
+            _BidirectionalIterator __j = __last;
+            while (!__comp(*--__j, *__i))
+                ;
+            swap(*__i, *__j);
+            _VSTD::reverse(__ip1, __last);
+            return true;
+        }
+        if (__i == __first)
+        {
+            _VSTD::reverse(__first, __last);
+            return false;
+        }
+    }
+}
+
+template <class _BidirectionalIterator, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
+{
+#ifdef _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
+    __debug_less<_Compare> __c(__comp);
+    return __prev_permutation<_Comp_ref>(__first, __last, __c);
+#else  // _LIBCPP_DEBUG
+    typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
+    return __prev_permutation<_Comp_ref>(__first, __last, __comp);
+#endif  // _LIBCPP_DEBUG
+}
+
+template <class _BidirectionalIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
+{
+    return _VSTD::prev_permutation(__first, __last,
+                                  __less<typename iterator_traits<_BidirectionalIterator>::value_type>());
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value,
+    _Tp
+>::type
+__rotate_left(_Tp __t, _Tp __n = 1)
+{
+    const unsigned __bits = static_cast<unsigned>(sizeof(_Tp) * __CHAR_BIT__ - 1);
+    __n &= __bits;
+    return static_cast<_Tp>((__t << __n) | (static_cast<typename make_unsigned<_Tp>::type>(__t) >> (__bits - __n)));
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_integral<_Tp>::value,
+    _Tp
+>::type
+__rotate_right(_Tp __t, _Tp __n = 1)
+{
+    const unsigned __bits = static_cast<unsigned>(sizeof(_Tp) * __CHAR_BIT__ - 1);
+    __n &= __bits;
+    return static_cast<_Tp>((__t << (__bits - __n)) | (static_cast<typename make_unsigned<_Tp>::type>(__t) >> __n));
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_ALGORITHM

Property changes on: lab4/.minix-src/include/c++/algorithm
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/bitset
===================================================================
--- lab4/.minix-src/include/c++/bitset	(nonexistent)
+++ lab4/.minix-src/include/c++/bitset	(revision 13)
@@ -0,0 +1,1081 @@
+// -*- C++ -*-
+//===---------------------------- bitset ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_BITSET
+#define _LIBCPP_BITSET
+
+/*
+    bitset synopsis
+
+namespace std
+{
+
+namespace std {
+
+template <size_t N>
+class bitset
+{
+public:
+    // bit reference:
+    class reference
+    {
+        friend class bitset;
+        reference() noexcept;
+    public:
+        ~reference() noexcept;
+        reference& operator=(bool x) noexcept;           // for b[i] = x;
+        reference& operator=(const reference&) noexcept; // for b[i] = b[j];
+        bool operator~() const noexcept;                 // flips the bit
+        operator bool() const noexcept;                  // for x = b[i];
+        reference& flip() noexcept;                      // for b[i].flip();
+    };
+
+    // 23.3.5.1 constructors:
+    constexpr bitset() noexcept;
+    constexpr bitset(unsigned long long val) noexcept;
+    template <class charT>
+        explicit bitset(const charT* str,
+                        typename basic_string<charT>::size_type n = basic_string<charT>::npos,
+                        charT zero = charT('0'), charT one = charT('1'));
+    template<class charT, class traits, class Allocator>
+        explicit bitset(const basic_string<charT,traits,Allocator>& str,
+                        typename basic_string<charT,traits,Allocator>::size_type pos = 0,
+                        typename basic_string<charT,traits,Allocator>::size_type n =
+                                 basic_string<charT,traits,Allocator>::npos,
+                        charT zero = charT('0'), charT one = charT('1'));
+
+    // 23.3.5.2 bitset operations:
+    bitset& operator&=(const bitset& rhs) noexcept;
+    bitset& operator|=(const bitset& rhs) noexcept;
+    bitset& operator^=(const bitset& rhs) noexcept;
+    bitset& operator<<=(size_t pos) noexcept;
+    bitset& operator>>=(size_t pos) noexcept;
+    bitset& set() noexcept;
+    bitset& set(size_t pos, bool val = true);
+    bitset& reset() noexcept;
+    bitset& reset(size_t pos);
+    bitset operator~() const noexcept;
+    bitset& flip() noexcept;
+    bitset& flip(size_t pos);
+
+    // element access:
+    constexpr bool operator[](size_t pos) const; // for b[i];
+    reference operator[](size_t pos);            // for b[i];
+    unsigned long to_ulong() const;
+    unsigned long long to_ullong() const;
+    template <class charT, class traits, class Allocator>
+        basic_string<charT, traits, Allocator> to_string(charT zero = charT('0'), charT one = charT('1')) const;
+    template <class charT, class traits>
+        basic_string<charT, traits, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const;
+    template <class charT>
+        basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const;
+    basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const;
+    size_t count() const noexcept;
+    constexpr size_t size() const noexcept;
+    bool operator==(const bitset& rhs) const noexcept;
+    bool operator!=(const bitset& rhs) const noexcept;
+    bool test(size_t pos) const;
+    bool all() const noexcept;
+    bool any() const noexcept;
+    bool none() const noexcept;
+    bitset operator<<(size_t pos) const noexcept;
+    bitset operator>>(size_t pos) const noexcept;
+};
+
+// 23.3.5.3 bitset operators:
+template <size_t N>
+bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept;
+
+template <size_t N>
+bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept;
+
+template <size_t N>
+bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept;
+
+template <class charT, class traits, size_t N>
+basic_istream<charT, traits>&
+operator>>(basic_istream<charT, traits>& is, bitset<N>& x);
+
+template <class charT, class traits, size_t N>
+basic_ostream<charT, traits>&
+operator<<(basic_ostream<charT, traits>& os, const bitset<N>& x);
+
+template <size_t N> struct hash<std::bitset<N>>;
+
+}  // std
+
+*/
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include <__config>
+#include <__bit_reference>
+#include <cstddef>
+#include <climits>
+#include <string>
+#include <stdexcept>
+#include <iosfwd>
+#include <__functional_base>
+#if defined(_LIBCPP_NO_EXCEPTIONS)
+    #include <cassert>
+#endif
+
+#include <__undef_min_max>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <size_t _N_words, size_t _Size>
+class __bitset;
+
+template <size_t _N_words, size_t _Size>
+struct __has_storage_type<__bitset<_N_words, _Size> >
+{
+    static const bool value = true;
+};
+
+template <size_t _N_words, size_t _Size>
+class __bitset
+{
+public:
+    typedef ptrdiff_t              difference_type;
+    typedef size_t                 size_type;
+    typedef size_type              __storage_type;
+protected:
+    typedef __bitset __self;
+    typedef       __storage_type*  __storage_pointer;
+    typedef const __storage_type*  __const_storage_pointer;
+    static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+    friend class __bit_reference<__bitset>;
+    friend class __bit_const_reference<__bitset>;
+    friend class __bit_iterator<__bitset, false>;
+    friend class __bit_iterator<__bitset, true>;
+    friend struct __bit_array<__bitset>;
+
+    __storage_type __first_[_N_words];
+
+    typedef __bit_reference<__bitset>                  reference;
+    typedef __bit_const_reference<__bitset>            const_reference;
+    typedef __bit_iterator<__bitset, false>            iterator;
+    typedef __bit_iterator<__bitset, true>             const_iterator;
+
+    _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+    explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
+        {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
+        {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
+    _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
+        {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
+    _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
+        {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
+
+    void operator&=(const __bitset& __v) _NOEXCEPT;
+    void operator|=(const __bitset& __v) _NOEXCEPT;
+    void operator^=(const __bitset& __v) _NOEXCEPT;
+
+    void flip() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const
+        {return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());}
+    _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const
+        {return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());}
+
+    bool all() const _NOEXCEPT;
+    bool any() const _NOEXCEPT;
+    size_t __hash_code() const _NOEXCEPT;
+private:
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+    void __init(unsigned long long __v, false_type) _NOEXCEPT;
+    void __init(unsigned long long __v, true_type) _NOEXCEPT;
+#endif  // _LIBCPP_HAS_NO_CONSTEXPR
+    unsigned long to_ulong(false_type) const;
+    unsigned long to_ulong(true_type) const;
+    unsigned long long to_ullong(false_type) const;
+    unsigned long long to_ullong(true_type) const;
+    unsigned long long to_ullong(true_type, false_type) const;
+    unsigned long long to_ullong(true_type, true_type) const;
+};
+
+template <size_t _N_words, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    : __first_{0}
+#endif
+{
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+    _VSTD::fill_n(__first_, _N_words, __storage_type(0));
+#endif
+}
+
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+
+template <size_t _N_words, size_t _Size>
+void
+__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
+{
+    __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
+    for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
+        __t[__i] = static_cast<__storage_type>(__v);
+    _VSTD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
+    _VSTD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
+               __storage_type(0));
+}
+
+template <size_t _N_words, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
+{
+    __first_[0] = __v;
+    _VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
+}
+
+#endif  // _LIBCPP_HAS_NO_CONSTEXPR
+
+template <size_t _N_words, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#if __SIZEOF_SIZE_T__ == 8
+    : __first_{__v}
+#elif __SIZEOF_SIZE_T__ == 4
+    : __first_{__v, __v >> __bits_per_word}
+#else
+#error This constructor has not been ported to this platform
+#endif
+#endif
+{
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+    __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
+#endif
+}
+
+template <size_t _N_words, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
+{
+    for (size_type __i = 0; __i < _N_words; ++__i)
+        __first_[__i] &= __v.__first_[__i];
+}
+
+template <size_t _N_words, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
+{
+    for (size_type __i = 0; __i < _N_words; ++__i)
+        __first_[__i] |= __v.__first_[__i];
+}
+
+template <size_t _N_words, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
+{
+    for (size_type __i = 0; __i < _N_words; ++__i)
+        __first_[__i] ^= __v.__first_[__i];
+}
+
+template <size_t _N_words, size_t _Size>
+void
+__bitset<_N_words, _Size>::flip() _NOEXCEPT
+{
+    // do middle whole words
+    size_type __n = _Size;
+    __storage_pointer __p = __first_;
+    for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+        *__p = ~*__p;
+    // do last partial word
+    if (__n > 0)
+    {
+        __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        __storage_type __b = *__p & __m;
+        *__p &= ~__m;
+        *__p |= ~__b & __m;
+    }
+}
+
+template <size_t _N_words, size_t _Size>
+unsigned long
+__bitset<_N_words, _Size>::to_ulong(false_type) const
+{
+    const_iterator __e = __make_iter(_Size);
+    const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
+    if (__i != __e)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw overflow_error("bitset to_ulong overflow error");
+#else
+        assert(!"bitset to_ulong overflow error");
+#endif
+    return __first_[0];
+}
+
+template <size_t _N_words, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long
+__bitset<_N_words, _Size>::to_ulong(true_type) const
+{
+    return __first_[0];
+}
+
+template <size_t _N_words, size_t _Size>
+unsigned long long
+__bitset<_N_words, _Size>::to_ullong(false_type) const
+{
+    const_iterator __e = __make_iter(_Size);
+    const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
+    if (__i != __e)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw overflow_error("bitset to_ullong overflow error");
+#else
+        assert(!"bitset to_ullong overflow error");
+#endif
+    return to_ullong(true_type());
+}
+
+template <size_t _N_words, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long long
+__bitset<_N_words, _Size>::to_ullong(true_type) const
+{
+    return to_ullong(true_type(), integral_constant<bool, sizeof(__storage_type) < sizeof(unsigned long long)>());
+}
+
+template <size_t _N_words, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long long
+__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
+{
+    return __first_[0];
+}
+
+template <size_t _N_words, size_t _Size>
+unsigned long long
+__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
+{
+    unsigned long long __r = __first_[0];
+    for (std::size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
+        __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT);
+    return __r;
+}
+
+template <size_t _N_words, size_t _Size>
+bool
+__bitset<_N_words, _Size>::all() const _NOEXCEPT
+{
+    // do middle whole words
+    size_type __n = _Size;
+    __const_storage_pointer __p = __first_;
+    for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+        if (~*__p)
+            return false;
+    // do last partial word
+    if (__n > 0)
+    {
+        __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        if (~*__p & __m)
+            return false;
+    }
+    return true;
+}
+
+template <size_t _N_words, size_t _Size>
+bool
+__bitset<_N_words, _Size>::any() const _NOEXCEPT
+{
+    // do middle whole words
+    size_type __n = _Size;
+    __const_storage_pointer __p = __first_;
+    for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+        if (*__p)
+            return true;
+    // do last partial word
+    if (__n > 0)
+    {
+        __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        if (*__p & __m)
+            return true;
+    }
+    return false;
+}
+
+template <size_t _N_words, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
+{
+    size_t __h = 0;
+    for (size_type __i = 0; __i < _N_words; ++__i)
+        __h ^= __first_[__i];
+    return __h;
+}
+
+template <size_t _Size>
+class __bitset<1, _Size>
+{
+public:
+    typedef ptrdiff_t              difference_type;
+    typedef size_t                 size_type;
+    typedef size_type              __storage_type;
+protected:
+    typedef __bitset __self;
+    typedef       __storage_type*  __storage_pointer;
+    typedef const __storage_type*  __const_storage_pointer;
+    static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+    friend class __bit_reference<__bitset>;
+    friend class __bit_const_reference<__bitset>;
+    friend class __bit_iterator<__bitset, false>;
+    friend class __bit_iterator<__bitset, true>;
+    friend struct __bit_array<__bitset>;
+
+    __storage_type __first_;
+
+    typedef __bit_reference<__bitset>                  reference;
+    typedef __bit_const_reference<__bitset>            const_reference;
+    typedef __bit_iterator<__bitset, false>            iterator;
+    typedef __bit_iterator<__bitset, true>             const_iterator;
+
+    _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+    explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
+        {return reference(&__first_, __storage_type(1) << __pos);}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
+        {return const_reference(&__first_, __storage_type(1) << __pos);}
+    _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
+        {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
+    _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
+        {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
+
+    void operator&=(const __bitset& __v) _NOEXCEPT;
+    void operator|=(const __bitset& __v) _NOEXCEPT;
+    void operator^=(const __bitset& __v) _NOEXCEPT;
+
+    void flip() _NOEXCEPT;
+
+    unsigned long to_ulong() const;
+    unsigned long long to_ullong() const;
+
+    bool all() const _NOEXCEPT;
+    bool any() const _NOEXCEPT;
+
+    size_t __hash_code() const _NOEXCEPT;
+};
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+__bitset<1, _Size>::__bitset() _NOEXCEPT
+    : __first_(0)
+{
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
+    : __first_(static_cast<__storage_type>(__v))
+{
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
+{
+    __first_ &= __v.__first_;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
+{
+    __first_ |= __v.__first_;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
+{
+    __first_ ^= __v.__first_;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__bitset<1, _Size>::flip() _NOEXCEPT
+{
+    __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
+    __first_ = ~__first_;
+    __first_ &= __m;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long
+__bitset<1, _Size>::to_ulong() const
+{
+    return __first_;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long long
+__bitset<1, _Size>::to_ullong() const
+{
+    return __first_;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+__bitset<1, _Size>::all() const _NOEXCEPT
+{
+    __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
+    return !(~__first_ & __m);
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+__bitset<1, _Size>::any() const _NOEXCEPT
+{
+    __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
+    return __first_ & __m;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+__bitset<1, _Size>::__hash_code() const _NOEXCEPT
+{
+    return __first_;
+}
+
+template <>
+class __bitset<0, 0>
+{
+public:
+    typedef ptrdiff_t              difference_type;
+    typedef size_t                 size_type;
+    typedef size_type              __storage_type;
+protected:
+    typedef __bitset __self;
+    typedef       __storage_type*  __storage_pointer;
+    typedef const __storage_type*  __const_storage_pointer;
+    static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+    friend class __bit_reference<__bitset>;
+    friend class __bit_const_reference<__bitset>;
+    friend class __bit_iterator<__bitset, false>;
+    friend class __bit_iterator<__bitset, true>;
+    friend struct __bit_array<__bitset>;
+
+    typedef __bit_reference<__bitset>                  reference;
+    typedef __bit_const_reference<__bitset>            const_reference;
+    typedef __bit_iterator<__bitset, false>            iterator;
+    typedef __bit_iterator<__bitset, true>             const_iterator;
+
+    _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+    explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
+        {return reference(0, 1);}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
+        {return const_reference(0, 1);}
+    _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
+        {return iterator(0, 0);}
+    _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
+        {return const_iterator(0, 0);}
+
+    _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) _NOEXCEPT {}
+
+    _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {}
+
+    _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;}
+
+    _LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT {return true;}
+    _LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT {return false;}
+
+    _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+__bitset<0, 0>::__bitset() _NOEXCEPT
+{
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
+{
+}
+
+template <size_t _Size> class _LIBCPP_TYPE_VIS_ONLY bitset;
+template <size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY hash<bitset<_Size> >;
+
+template <size_t _Size>
+class _LIBCPP_TYPE_VIS_ONLY bitset
+    : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
+{
+public:
+    static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
+    typedef __bitset<__n_words, _Size> base;
+
+public:
+    typedef typename base::reference       reference;
+    typedef typename base::const_reference const_reference;
+
+    // 23.3.5.1 constructors:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+        bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
+    template<class _CharT>
+        explicit bitset(const _CharT* __str,
+                        typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
+                        _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
+    template<class _CharT, class _Traits, class _Allocator>
+        explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
+                        typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0,
+                        typename basic_string<_CharT,_Traits,_Allocator>::size_type __n =
+                                (basic_string<_CharT,_Traits,_Allocator>::npos),
+                        _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
+
+    // 23.3.5.2 bitset operations:
+    bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
+    bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
+    bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
+    bitset& operator<<=(size_t __pos) _NOEXCEPT;
+    bitset& operator>>=(size_t __pos) _NOEXCEPT;
+    bitset& set() _NOEXCEPT;
+    bitset& set(size_t __pos, bool __val = true);
+    bitset& reset() _NOEXCEPT;
+    bitset& reset(size_t __pos);
+    bitset  operator~() const _NOEXCEPT;
+    bitset& flip() _NOEXCEPT;
+    bitset& flip(size_t __pos);
+
+    // element access:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+                              const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
+    _LIBCPP_INLINE_VISIBILITY       reference operator[](size_t __p)       {return base::__make_ref(__p);}
+    unsigned long to_ulong() const;
+    unsigned long long to_ullong() const;
+    template <class _CharT, class _Traits, class _Allocator>
+        basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
+                                                            _CharT __one = _CharT('1')) const;
+    template <class _CharT, class _Traits>
+        basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
+                                                                    _CharT __one = _CharT('1')) const;
+    template <class _CharT>
+        basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
+                                                                                _CharT __one = _CharT('1')) const;
+    basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
+                                                                      char __one = '1') const;
+    size_t count() const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
+    bool operator==(const bitset& __rhs) const _NOEXCEPT;
+    bool operator!=(const bitset& __rhs) const _NOEXCEPT;
+    bool test(size_t __pos) const;
+    bool all() const _NOEXCEPT;
+    bool any() const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
+    bitset operator<<(size_t __pos) const _NOEXCEPT;
+    bitset operator>>(size_t __pos) const _NOEXCEPT;
+
+private:
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t __hash_code() const _NOEXCEPT {return base::__hash_code();}
+
+    friend struct hash<bitset>;
+};
+
+template <size_t _Size>
+template<class _CharT>
+bitset<_Size>::bitset(const _CharT* __str,
+                      typename basic_string<_CharT>::size_type __n,
+                      _CharT __zero, _CharT __one)
+{
+    size_t __rlen = _VSTD::min(__n, char_traits<_CharT>::length(__str));
+    for (size_t __i = 0; __i < __rlen; ++__i)
+        if (__str[__i] != __zero && __str[__i] != __one)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            throw invalid_argument("bitset string ctor has invalid argument");
+#else
+            assert(!"bitset string ctor has invalid argument");
+#endif
+    size_t _Mp = _VSTD::min(__rlen, _Size);
+    size_t __i = 0;
+    for (; __i < _Mp; ++__i)
+    {
+        _CharT __c = __str[_Mp - 1 - __i];
+        if (__c == __zero)
+            (*this)[__i] = false;
+        else
+            (*this)[__i] = true;
+    }
+    _VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
+}
+
+template <size_t _Size>
+template<class _CharT, class _Traits, class _Allocator>
+bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
+       typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos,
+       typename basic_string<_CharT,_Traits,_Allocator>::size_type __n,
+       _CharT __zero, _CharT __one)
+{
+    if (__pos > __str.size())
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("bitset string pos out of range");
+#else
+        assert(!"bitset string pos out of range");
+#endif
+    size_t __rlen = _VSTD::min(__n, __str.size() - __pos);
+    for (size_t __i = __pos; __i < __pos + __rlen; ++__i)
+        if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            throw invalid_argument("bitset string ctor has invalid argument");
+#else
+            assert(!"bitset string ctor has invalid argument");
+#endif
+    size_t _Mp = _VSTD::min(__rlen, _Size);
+    size_t __i = 0;
+    for (; __i < _Mp; ++__i)
+    {
+        _CharT __c = __str[__pos + _Mp - 1 - __i];
+        if (_Traits::eq(__c, __zero))
+            (*this)[__i] = false;
+        else
+            (*this)[__i] = true;
+    }
+    _VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>&
+bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
+{
+    base::operator&=(__rhs);
+    return *this;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>&
+bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
+{
+    base::operator|=(__rhs);
+    return *this;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>&
+bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
+{
+    base::operator^=(__rhs);
+    return *this;
+}
+
+template <size_t _Size>
+bitset<_Size>&
+bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT
+{
+    __pos = _VSTD::min(__pos, _Size);
+    _VSTD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
+    _VSTD::fill_n(base::__make_iter(0), __pos, false);
+    return *this;
+}
+
+template <size_t _Size>
+bitset<_Size>&
+bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
+{
+    __pos = _VSTD::min(__pos, _Size);
+    _VSTD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
+    _VSTD::fill_n(base::__make_iter(_Size - __pos), __pos, false);
+    return *this;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>&
+bitset<_Size>::set() _NOEXCEPT
+{
+    _VSTD::fill_n(base::__make_iter(0), _Size, true);
+    return *this;
+}
+
+template <size_t _Size>
+bitset<_Size>&
+bitset<_Size>::set(size_t __pos, bool __val)
+{
+    if (__pos >= _Size)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("bitset set argument out of range");
+#else
+        assert(!"bitset set argument out of range");
+#endif
+    (*this)[__pos] = __val;
+    return *this;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>&
+bitset<_Size>::reset() _NOEXCEPT
+{
+    _VSTD::fill_n(base::__make_iter(0), _Size, false);
+    return *this;
+}
+
+template <size_t _Size>
+bitset<_Size>&
+bitset<_Size>::reset(size_t __pos)
+{
+    if (__pos >= _Size)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("bitset reset argument out of range");
+#else
+        assert(!"bitset reset argument out of range");
+#endif
+    (*this)[__pos] = false;
+    return *this;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>
+bitset<_Size>::operator~() const _NOEXCEPT
+{
+    bitset __x(*this);
+    __x.flip();
+    return __x;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>&
+bitset<_Size>::flip() _NOEXCEPT
+{
+    base::flip();
+    return *this;
+}
+
+template <size_t _Size>
+bitset<_Size>&
+bitset<_Size>::flip(size_t __pos)
+{
+    if (__pos >= _Size)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("bitset flip argument out of range");
+#else
+        assert(!"bitset flip argument out of range");
+#endif
+    reference r = base::__make_ref(__pos);
+    r = ~r;
+    return *this;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long
+bitset<_Size>::to_ulong() const
+{
+    return base::to_ulong();
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long long
+bitset<_Size>::to_ullong() const
+{
+    return base::to_ullong();
+}
+
+template <size_t _Size>
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
+{
+    basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero);
+    for (size_t __i = 0; __i < _Size; ++__i)
+    {
+        if ((*this)[__i])
+            __r[_Size - 1 - __i] = __one;
+    }
+    return __r;
+}
+
+template <size_t _Size>
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, allocator<_CharT> >
+bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
+{
+    return to_string<_CharT, _Traits, allocator<_CharT> >(__zero, __one);
+}
+
+template <size_t _Size>
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
+bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
+{
+    return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(__zero, __one);
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<char, char_traits<char>, allocator<char> >
+bitset<_Size>::to_string(char __zero, char __one) const
+{
+    return to_string<char, char_traits<char>, allocator<char> >(__zero, __one);
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+bitset<_Size>::count() const _NOEXCEPT
+{
+    return static_cast<size_t>(_VSTD::count(base::__make_iter(0), base::__make_iter(_Size), true));
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
+{
+    return _VSTD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
+{
+    return !(*this == __rhs);
+}
+
+template <size_t _Size>
+bool
+bitset<_Size>::test(size_t __pos) const
+{
+    if (__pos >= _Size)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("bitset test argument out of range");
+#else
+        assert(!"bitset test argument out of range");
+#endif
+    return (*this)[__pos];
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+bitset<_Size>::all() const _NOEXCEPT
+{
+    return base::all();
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+bitset<_Size>::any() const _NOEXCEPT
+{
+    return base::any();
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>
+bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
+{
+    bitset __r = *this;
+    __r <<= __pos;
+    return __r;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>
+bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
+{
+    bitset __r = *this;
+    __r >>= __pos;
+    return __r;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>
+operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
+{
+    bitset<_Size> __r = __x;
+    __r &= __y;
+    return __r;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>
+operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
+{
+    bitset<_Size> __r = __x;
+    __r |= __y;
+    return __r;
+}
+
+template <size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+bitset<_Size>
+operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
+{
+    bitset<_Size> __r = __x;
+    __r ^= __y;
+    return __r;
+}
+
+template <size_t _Size>
+struct _LIBCPP_TYPE_VIS_ONLY hash<bitset<_Size> >
+    : public unary_function<bitset<_Size>, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT
+        {return __bs.__hash_code();}
+};
+
+template <class _CharT, class _Traits, size_t _Size>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
+
+template <class _CharT, class _Traits, size_t _Size>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_BITSET

Property changes on: lab4/.minix-src/include/c++/bitset
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cctype
===================================================================
--- lab4/.minix-src/include/c++/cctype	(nonexistent)
+++ lab4/.minix-src/include/c++/cctype	(revision 13)
@@ -0,0 +1,165 @@
+// -*- C++ -*-
+//===---------------------------- cctype ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CCTYPE
+#define _LIBCPP_CCTYPE
+
+/*
+    cctype synopsis
+
+namespace std
+{
+
+int isalnum(int c);
+int isalpha(int c);
+int isblank(int c);  // C99
+int iscntrl(int c);
+int isdigit(int c);
+int isgraph(int c);
+int islower(int c);
+int isprint(int c);
+int ispunct(int c);
+int isspace(int c);
+int isupper(int c);
+int isxdigit(int c);
+int tolower(int c);
+int toupper(int c);
+
+}  // std
+*/
+
+#include <__config>
+#include <ctype.h>
+#if defined(_LIBCPP_MSVCRT)
+#include "support/win32/support.h"
+#include "support/win32/locale_win32.h"
+#endif // _LIBCPP_MSVCRT
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifdef isalnum
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalnum(int __c) {return isalnum(__c);}
+#undef isalnum
+inline _LIBCPP_INLINE_VISIBILITY int isalnum(int __c) {return __libcpp_isalnum(__c);}
+#else  // isalnum
+using ::isalnum;
+#endif  // isalnum
+
+#ifdef isalpha
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalpha(int __c) {return isalpha(__c);}
+#undef isalpha
+inline _LIBCPP_INLINE_VISIBILITY int isalpha(int __c) {return __libcpp_isalpha(__c);}
+#else  // isalpha
+using ::isalpha;
+#endif  // isalpha
+
+#ifdef isblank
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isblank(int __c) {return isblank(__c);}
+#undef isblank
+inline _LIBCPP_INLINE_VISIBILITY int isblank(int __c) {return __libcpp_isblank(__c);}
+#else  // isblank
+using ::isblank;
+#endif  // isblank
+
+#ifdef iscntrl
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iscntrl(int __c) {return iscntrl(__c);}
+#undef iscntrl
+inline _LIBCPP_INLINE_VISIBILITY int iscntrl(int __c) {return __libcpp_iscntrl(__c);}
+#else  // iscntrl
+using ::iscntrl;
+#endif  // iscntrl
+
+#ifdef isdigit
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isdigit(int __c) {return isdigit(__c);}
+#undef isdigit
+inline _LIBCPP_INLINE_VISIBILITY int isdigit(int __c) {return __libcpp_isdigit(__c);}
+#else  // isdigit
+using ::isdigit;
+#endif  // isdigit
+
+#ifdef isgraph
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isgraph(int __c) {return isgraph(__c);}
+#undef isgraph
+inline _LIBCPP_INLINE_VISIBILITY int isgraph(int __c) {return __libcpp_isgraph(__c);}
+#else  // isgraph
+using ::isgraph;
+#endif  // isgraph
+
+#ifdef islower
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_islower(int __c) {return islower(__c);}
+#undef islower
+inline _LIBCPP_INLINE_VISIBILITY int islower(int __c) {return __libcpp_islower(__c);}
+#else  // islower
+using ::islower;
+#endif  // islower
+
+#ifdef isprint
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isprint(int __c) {return isprint(__c);}
+#undef isprint
+inline _LIBCPP_INLINE_VISIBILITY int isprint(int __c) {return __libcpp_isprint(__c);}
+#else  // isprint
+using ::isprint;
+#endif  // isprint
+
+#ifdef ispunct
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ispunct(int __c) {return ispunct(__c);}
+#undef ispunct
+inline _LIBCPP_INLINE_VISIBILITY int ispunct(int __c) {return __libcpp_ispunct(__c);}
+#else  // ispunct
+using ::ispunct;
+#endif  // ispunct
+
+#ifdef isspace
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isspace(int __c) {return isspace(__c);}
+#undef isspace
+inline _LIBCPP_INLINE_VISIBILITY int isspace(int __c) {return __libcpp_isspace(__c);}
+#else  // isspace
+using ::isspace;
+#endif  // isspace
+
+#ifdef isupper
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isupper(int __c) {return isupper(__c);}
+#undef isupper
+inline _LIBCPP_INLINE_VISIBILITY int isupper(int __c) {return __libcpp_isupper(__c);}
+#else  // isupper
+using ::isupper;
+#endif  // isupper
+
+#ifdef isxdigit
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isxdigit(int __c) {return isxdigit(__c);}
+#undef isxdigit
+inline _LIBCPP_INLINE_VISIBILITY int isxdigit(int __c) {return __libcpp_isxdigit(__c);}
+#else  // isxdigit
+using ::isxdigit;
+#endif  // isxdigit
+
+#ifdef tolower
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_tolower(int __c) {return tolower(__c);}
+#undef tolower
+inline _LIBCPP_INLINE_VISIBILITY int tolower(int __c) {return __libcpp_tolower(__c);}
+#else  // tolower
+using ::tolower;
+#endif  // tolower
+
+#ifdef toupper
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_toupper(int __c) {return toupper(__c);}
+#undef toupper
+inline _LIBCPP_INLINE_VISIBILITY int toupper(int __c) {return __libcpp_toupper(__c);}
+#else  // toupper
+using ::toupper;
+#endif  // toupper
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CCTYPE

Property changes on: lab4/.minix-src/include/c++/cctype
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cfloat
===================================================================
--- lab4/.minix-src/include/c++/cfloat	(nonexistent)
+++ lab4/.minix-src/include/c++/cfloat	(revision 13)
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+//===--------------------------- cfloat -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CFLOAT
+#define _LIBCPP_CFLOAT
+
+/*
+    cfloat synopsis
+
+Macros:
+
+    FLT_ROUNDS
+    FLT_EVAL_METHOD     // C99
+    FLT_RADIX
+
+    FLT_MANT_DIG
+    DBL_MANT_DIG
+    LDBL_MANT_DIG
+
+    DECIMAL_DIG         // C99
+
+    FLT_DIG
+    DBL_DIG
+    LDBL_DIG
+
+    FLT_MIN_EXP
+    DBL_MIN_EXP
+    LDBL_MIN_EXP
+
+    FLT_MIN_10_EXP
+    DBL_MIN_10_EXP
+    LDBL_MIN_10_EXP
+
+    FLT_MAX_EXP
+    DBL_MAX_EXP
+    LDBL_MAX_EXP
+
+    FLT_MAX_10_EXP
+    DBL_MAX_10_EXP
+    LDBL_MAX_10_EXP
+
+    FLT_MAX
+    DBL_MAX
+    LDBL_MAX
+
+    FLT_EPSILON
+    DBL_EPSILON
+    LDBL_EPSILON
+
+    FLT_MIN
+    DBL_MIN
+    LDBL_MIN
+
+*/
+
+#include <__config>
+#include <float.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifndef FLT_EVAL_METHOD
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#endif
+
+#ifndef DECIMAL_DIG
+#define DECIMAL_DIG __DECIMAL_DIG__
+#endif
+
+#endif  // _LIBCPP_CFLOAT

Property changes on: lab4/.minix-src/include/c++/cfloat
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/ciso646
===================================================================
--- lab4/.minix-src/include/c++/ciso646	(nonexistent)
+++ lab4/.minix-src/include/c++/ciso646	(revision 13)
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===--------------------------- ciso646 ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CISO646
+#define _LIBCPP_CISO646
+
+/*
+    ciso646 synopsis
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#endif  // _LIBCPP_CISO646

Property changes on: lab4/.minix-src/include/c++/ciso646
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cmath
===================================================================
--- lab4/.minix-src/include/c++/cmath	(nonexistent)
+++ lab4/.minix-src/include/c++/cmath	(revision 13)
@@ -0,0 +1,1697 @@
+// -*- C++ -*-
+//===---------------------------- cmath -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CMATH
+#define _LIBCPP_CMATH
+
+/*
+    cmath synopsis
+
+Macros:
+
+    HUGE_VAL
+    HUGE_VALF               // C99
+    HUGE_VALL               // C99
+    INFINITY                // C99
+    NAN                     // C99
+    FP_INFINITE             // C99
+    FP_NAN                  // C99
+    FP_NORMAL               // C99
+    FP_SUBNORMAL            // C99
+    FP_ZERO                 // C99
+    FP_FAST_FMA             // C99
+    FP_FAST_FMAF            // C99
+    FP_FAST_FMAL            // C99
+    FP_ILOGB0               // C99
+    FP_ILOGBNAN             // C99
+    MATH_ERRNO              // C99
+    MATH_ERREXCEPT          // C99
+    math_errhandling        // C99
+
+namespace std
+{
+
+Types:
+
+    float_t                 // C99
+    double_t                // C99
+
+// C90
+
+floating_point abs(floating_point x);
+
+floating_point acos (arithmetic x);
+float          acosf(float x);
+long double    acosl(long double x);
+
+floating_point asin (arithmetic x);
+float          asinf(float x);
+long double    asinl(long double x);
+
+floating_point atan (arithmetic x);
+float          atanf(float x);
+long double    atanl(long double x);
+
+floating_point atan2 (arithmetic y, arithmetic x);
+float          atan2f(float y, float x);
+long double    atan2l(long double y, long double x);
+
+floating_point ceil (arithmetic x);
+float          ceilf(float x);
+long double    ceill(long double x);
+
+floating_point cos (arithmetic x);
+float          cosf(float x);
+long double    cosl(long double x);
+
+floating_point cosh (arithmetic x);
+float          coshf(float x);
+long double    coshl(long double x);
+
+floating_point exp (arithmetic x);
+float          expf(float x);
+long double    expl(long double x);
+
+floating_point fabs (arithmetic x);
+float          fabsf(float x);
+long double    fabsl(long double x);
+
+floating_point floor (arithmetic x);
+float          floorf(float x);
+long double    floorl(long double x);
+
+floating_point fmod (arithmetic x, arithmetic y);
+float          fmodf(float x, float y);
+long double    fmodl(long double x, long double y);
+
+floating_point frexp (arithmetic value, int* exp);
+float          frexpf(float value, int* exp);
+long double    frexpl(long double value, int* exp);
+
+floating_point ldexp (arithmetic value, int exp);
+float          ldexpf(float value, int exp);
+long double    ldexpl(long double value, int exp);
+
+floating_point log (arithmetic x);
+float          logf(float x);
+long double    logl(long double x);
+
+floating_point log10 (arithmetic x);
+float          log10f(float x);
+long double    log10l(long double x);
+
+floating_point modf (floating_point value, floating_point* iptr);
+float          modff(float value, float* iptr);
+long double    modfl(long double value, long double* iptr);
+
+floating_point pow (arithmetic x, arithmetic y);
+float          powf(float x, float y);
+long double    powl(long double x, long double y);
+
+floating_point sin (arithmetic x);
+float          sinf(float x);
+long double    sinl(long double x);
+
+floating_point sinh (arithmetic x);
+float          sinhf(float x);
+long double    sinhl(long double x);
+
+floating_point sqrt (arithmetic x);
+float          sqrtf(float x);
+long double    sqrtl(long double x);
+
+floating_point tan (arithmetic x);
+float          tanf(float x);
+long double    tanl(long double x);
+
+floating_point tanh (arithmetic x);
+float          tanhf(float x);
+long double    tanhl(long double x);
+
+//  C99
+
+bool signbit(arithmetic x);
+
+int fpclassify(arithmetic x);
+
+bool isfinite(arithmetic x);
+bool isinf(arithmetic x);
+bool isnan(arithmetic x);
+bool isnormal(arithmetic x);
+
+bool isgreater(arithmetic x, arithmetic y);
+bool isgreaterequal(arithmetic x, arithmetic y);
+bool isless(arithmetic x, arithmetic y);
+bool islessequal(arithmetic x, arithmetic y);
+bool islessgreater(arithmetic x, arithmetic y);
+bool isunordered(arithmetic x, arithmetic y);
+
+floating_point acosh (arithmetic x);
+float          acoshf(float x);
+long double    acoshl(long double x);
+
+floating_point asinh (arithmetic x);
+float          asinhf(float x);
+long double    asinhl(long double x);
+
+floating_point atanh (arithmetic x);
+float          atanhf(float x);
+long double    atanhl(long double x);
+
+floating_point cbrt (arithmetic x);
+float          cbrtf(float x);
+long double    cbrtl(long double x);
+
+floating_point copysign (arithmetic x, arithmetic y);
+float          copysignf(float x, float y);
+long double    copysignl(long double x, long double y);
+
+floating_point erf (arithmetic x);
+float          erff(float x);
+long double    erfl(long double x);
+
+floating_point erfc (arithmetic x);
+float          erfcf(float x);
+long double    erfcl(long double x);
+
+floating_point exp2 (arithmetic x);
+float          exp2f(float x);
+long double    exp2l(long double x);
+
+floating_point expm1 (arithmetic x);
+float          expm1f(float x);
+long double    expm1l(long double x);
+
+floating_point fdim (arithmetic x, arithmetic y);
+float          fdimf(float x, float y);
+long double    fdiml(long double x, long double y);
+
+floating_point fma (arithmetic x, arithmetic y, arithmetic z);
+float          fmaf(float x, float y, float z);
+long double    fmal(long double x, long double y, long double z);
+
+floating_point fmax (arithmetic x, arithmetic y);
+float          fmaxf(float x, float y);
+long double    fmaxl(long double x, long double y);
+
+floating_point fmin (arithmetic x, arithmetic y);
+float          fminf(float x, float y);
+long double    fminl(long double x, long double y);
+
+floating_point hypot (arithmetic x, arithmetic y);
+float          hypotf(float x, float y);
+long double    hypotl(long double x, long double y);
+
+int ilogb (arithmetic x);
+int ilogbf(float x);
+int ilogbl(long double x);
+
+floating_point lgamma (arithmetic x);
+float          lgammaf(float x);
+long double    lgammal(long double x);
+
+long long llrint (arithmetic x);
+long long llrintf(float x);
+long long llrintl(long double x);
+
+long long llround (arithmetic x);
+long long llroundf(float x);
+long long llroundl(long double x);
+
+floating_point log1p (arithmetic x);
+float          log1pf(float x);
+long double    log1pl(long double x);
+
+floating_point log2 (arithmetic x);
+float          log2f(float x);
+long double    log2l(long double x);
+
+floating_point logb (arithmetic x);
+float          logbf(float x);
+long double    logbl(long double x);
+
+long lrint (arithmetic x);
+long lrintf(float x);
+long lrintl(long double x);
+
+long lround (arithmetic x);
+long lroundf(float x);
+long lroundl(long double x);
+
+double      nan (const char* str);
+float       nanf(const char* str);
+long double nanl(const char* str);
+
+floating_point nearbyint (arithmetic x);
+float          nearbyintf(float x);
+long double    nearbyintl(long double x);
+
+floating_point nextafter (arithmetic x, arithmetic y);
+float          nextafterf(float x, float y);
+long double    nextafterl(long double x, long double y);
+
+floating_point nexttoward (arithmetic x, long double y);
+float          nexttowardf(float x, long double y);
+long double    nexttowardl(long double x, long double y);
+
+floating_point remainder (arithmetic x, arithmetic y);
+float          remainderf(float x, float y);
+long double    remainderl(long double x, long double y);
+
+floating_point remquo (arithmetic x, arithmetic y, int* pquo);
+float          remquof(float x, float y, int* pquo);
+long double    remquol(long double x, long double y, int* pquo);
+
+floating_point rint (arithmetic x);
+float          rintf(float x);
+long double    rintl(long double x);
+
+floating_point round (arithmetic x);
+float          roundf(float x);
+long double    roundl(long double x);
+
+floating_point scalbln (arithmetic x, long ex);
+float          scalblnf(float x, long ex);
+long double    scalblnl(long double x, long ex);
+
+floating_point scalbn (arithmetic x, int ex);
+float          scalbnf(float x, int ex);
+long double    scalbnl(long double x, int ex);
+
+floating_point tgamma (arithmetic x);
+float          tgammaf(float x);
+long double    tgammal(long double x);
+
+floating_point trunc (arithmetic x);
+float          truncf(float x);
+long double    truncl(long double x);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <math.h>
+#include <type_traits>
+
+#ifdef _LIBCPP_MSVCRT
+#include "support/win32/math_win32.h"
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+// signbit
+
+#ifdef signbit
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
+{
+    return signbit(__lcpp_x);
+}
+
+#undef signbit
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+signbit(_A1 __lcpp_x) _NOEXCEPT
+{
+    return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif  // signbit
+
+// fpclassify
+
+#ifdef fpclassify
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+int
+__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
+{
+    return fpclassify(__lcpp_x);
+}
+
+#undef fpclassify
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
+fpclassify(_A1 __lcpp_x) _NOEXCEPT
+{
+    return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif  // fpclassify
+
+// isfinite
+
+#ifdef isfinite
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
+{
+    return isfinite(__lcpp_x);
+}
+
+#undef isfinite
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+isfinite(_A1 __lcpp_x) _NOEXCEPT
+{
+    return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif  // isfinite
+
+// isinf
+
+#ifdef isinf
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
+{
+    return isinf(__lcpp_x);
+}
+
+#undef isinf
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+isinf(_A1 __lcpp_x) _NOEXCEPT
+{
+    return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif  // isinf
+
+// isnan
+
+#ifdef isnan
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
+{
+    return isnan(__lcpp_x);
+}
+
+#undef isnan
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+isnan(_A1 __lcpp_x) _NOEXCEPT
+{
+    return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif  // isnan
+
+// isnormal
+
+#ifdef isnormal
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
+{
+    return isnormal(__lcpp_x);
+}
+
+#undef isnormal
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+isnormal(_A1 __lcpp_x) _NOEXCEPT
+{
+    return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif  // isnormal
+
+// isgreater
+
+#ifdef isgreater
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    return isgreater(__lcpp_x, __lcpp_y);
+}
+
+#undef isgreater
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+    std::is_arithmetic<_A1>::value &&
+    std::is_arithmetic<_A2>::value,
+    bool
+>::type
+isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename std::__promote<_A1, _A2>::type type;
+    return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif  // isgreater
+
+// isgreaterequal
+
+#ifdef isgreaterequal
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    return isgreaterequal(__lcpp_x, __lcpp_y);
+}
+
+#undef isgreaterequal
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+    std::is_arithmetic<_A1>::value &&
+    std::is_arithmetic<_A2>::value,
+    bool
+>::type
+isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename std::__promote<_A1, _A2>::type type;
+    return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif  // isgreaterequal
+
+// isless
+
+#ifdef isless
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    return isless(__lcpp_x, __lcpp_y);
+}
+
+#undef isless
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+    std::is_arithmetic<_A1>::value &&
+    std::is_arithmetic<_A2>::value,
+    bool
+>::type
+isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename std::__promote<_A1, _A2>::type type;
+    return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif  // isless
+
+// islessequal
+
+#ifdef islessequal
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    return islessequal(__lcpp_x, __lcpp_y);
+}
+
+#undef islessequal
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+    std::is_arithmetic<_A1>::value &&
+    std::is_arithmetic<_A2>::value,
+    bool
+>::type
+islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename std::__promote<_A1, _A2>::type type;
+    return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif  // islessequal
+
+// islessgreater
+
+#ifdef islessgreater
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    return islessgreater(__lcpp_x, __lcpp_y);
+}
+
+#undef islessgreater
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+    std::is_arithmetic<_A1>::value &&
+    std::is_arithmetic<_A2>::value,
+    bool
+>::type
+islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename std::__promote<_A1, _A2>::type type;
+    return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif  // islessgreater
+
+// isunordered
+
+#ifdef isunordered
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    return isunordered(__lcpp_x, __lcpp_y);
+}
+
+#undef isunordered
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+    std::is_arithmetic<_A1>::value &&
+    std::is_arithmetic<_A2>::value,
+    bool
+>::type
+isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename std::__promote<_A1, _A2>::type type;
+    return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif  // isunordered
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::signbit;
+using ::fpclassify;
+using ::isfinite;
+using ::isinf;
+using ::isnan;
+using ::isnormal;
+using ::isgreater;
+using ::isgreaterequal;
+using ::isless;
+using ::islessequal;
+using ::islessgreater;
+using ::isunordered;
+using ::isunordered;
+
+using ::float_t;
+using ::double_t;
+
+// abs
+
+#if defined(__sun__)
+using ::abs;
+#endif
+
+#if !defined(_AIX) && !defined(__sun__)
+inline _LIBCPP_INLINE_VISIBILITY
+float
+abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
+
+inline _LIBCPP_INLINE_VISIBILITY
+double
+abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
+
+inline _LIBCPP_INLINE_VISIBILITY
+long double
+abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
+#endif // !defined(_AIX)
+
+#ifndef __sun__
+
+// acos
+
+using ::acos;
+using ::acosf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       acos(float __lcpp_x) _NOEXCEPT       {return acosf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
+
+// asin
+
+using ::asin;
+using ::asinf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       asin(float __lcpp_x) _NOEXCEPT       {return asinf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
+
+// atan
+
+using ::atan;
+using ::atanf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       atan(float __lcpp_x) _NOEXCEPT       {return atanf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
+
+// atan2
+
+using ::atan2;
+using ::atan2f;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT             {return atan2f(__lcpp_y, __lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
+#endif
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
+}
+
+// ceil
+
+using ::ceil;
+using ::ceilf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       ceil(float __lcpp_x) _NOEXCEPT       {return ceilf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);}
+
+// cos
+
+using ::cos;
+using ::cosf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       cos(float __lcpp_x) _NOEXCEPT       {return cosf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return cosl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+cos(_A1 __lcpp_x) _NOEXCEPT {return cos((double)__lcpp_x);}
+
+// cosh
+
+using ::cosh;
+using ::coshf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       cosh(float __lcpp_x) _NOEXCEPT       {return coshf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return coshl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+cosh(_A1 __lcpp_x) _NOEXCEPT {return cosh((double)__lcpp_x);}
+
+#endif // __sun__
+// exp
+
+using ::exp;
+using ::expf;
+
+#ifndef __sun__
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       exp(float __lcpp_x) _NOEXCEPT       {return expf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return expl(__lcpp_x);}
+#endif
+
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+exp(_A1 __lcpp_x) _NOEXCEPT {return exp((double)__lcpp_x);}
+
+// fabs
+
+using ::fabs;
+using ::fabsf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       fabs(float __lcpp_x) _NOEXCEPT       {return fabsf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+fabs(_A1 __lcpp_x) _NOEXCEPT {return fabs((double)__lcpp_x);}
+
+// floor
+
+using ::floor;
+using ::floorf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       floor(float __lcpp_x) _NOEXCEPT       {return floorf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return floorl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+floor(_A1 __lcpp_x) _NOEXCEPT {return floor((double)__lcpp_x);}
+
+// fmod
+
+#endif //__sun__
+using ::fmod;
+using ::fmodf;
+#ifndef __sun__
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fmodf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmodl(__lcpp_x, __lcpp_y);}
+#endif
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+}
+
+
+// frexp
+
+using ::frexp;
+using ::frexpf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT       {return frexpf(__lcpp_x, __lcpp_e);}
+inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpl(__lcpp_x, __lcpp_e);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexp((double)__lcpp_x, __lcpp_e);}
+
+// ldexp
+
+using ::ldexp;
+using ::ldexpf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT       {return ldexpf(__lcpp_x, __lcpp_e);}
+inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpl(__lcpp_x, __lcpp_e);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexp((double)__lcpp_x, __lcpp_e);}
+
+// log
+
+#endif // __sun__
+using ::log;
+using ::logf;
+#ifndef __sun__
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       log(float __lcpp_x) _NOEXCEPT       {return logf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return logl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);}
+
+
+// log10
+
+using ::log10;
+using ::log10f;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       log10(float __lcpp_x) _NOEXCEPT       {return log10f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return log10l(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+log10(_A1 __lcpp_x) _NOEXCEPT {return log10((double)__lcpp_x);}
+
+// modf
+
+using ::modf;
+using ::modff;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT             {return modff(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x, __lcpp_y);}
+#endif
+
+// pow
+
+#endif // __sun__ 
+using ::pow;
+using ::powf;
+
+#ifndef __sun__
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return powf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, __lcpp_y);}
+#endif
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+}
+
+// sin
+
+using ::sin;
+using ::sinf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       sin(float __lcpp_x) _NOEXCEPT       {return sinf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return sinl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+sin(_A1 __lcpp_x) _NOEXCEPT {return sin((double)__lcpp_x);}
+
+// sinh
+
+using ::sinh;
+using ::sinhf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       sinh(float __lcpp_x) _NOEXCEPT       {return sinhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return sinhl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+sinh(_A1 __lcpp_x) _NOEXCEPT {return sinh((double)__lcpp_x);}
+
+// sqrt
+
+#endif // __sun__
+using ::sqrt;
+using ::sqrtf;
+
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(__sun__) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __lcpp_x) _NOEXCEPT       {return sqrtf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);}
+
+// tan
+
+using ::tan;
+using ::tanf;
+#ifndef __sun__
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       tan(float __lcpp_x) _NOEXCEPT       {return tanf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return tanl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+tan(_A1 __lcpp_x) _NOEXCEPT {return tan((double)__lcpp_x);}
+
+// tanh
+
+using ::tanh;
+using ::tanhf;
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+inline _LIBCPP_INLINE_VISIBILITY float       tanh(float __lcpp_x) _NOEXCEPT       {return tanhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return tanhl(__lcpp_x);}
+#endif
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+tanh(_A1 __lcpp_x) _NOEXCEPT {return tanh((double)__lcpp_x);}
+
+// acosh
+
+#ifndef _LIBCPP_MSVCRT
+using ::acosh;
+using ::acoshf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       acosh(float __lcpp_x) _NOEXCEPT       {return acoshf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+acosh(_A1 __lcpp_x) _NOEXCEPT {return acosh((double)__lcpp_x);}
+#endif
+
+// asinh
+
+#ifndef _LIBCPP_MSVCRT
+using ::asinh;
+using ::asinhf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       asinh(float __lcpp_x) _NOEXCEPT       {return asinhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+asinh(_A1 __lcpp_x) _NOEXCEPT {return asinh((double)__lcpp_x);}
+#endif
+
+// atanh
+
+#ifndef _LIBCPP_MSVCRT
+using ::atanh;
+using ::atanhf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       atanh(float __lcpp_x) _NOEXCEPT       {return atanhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return atanhl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+atanh(_A1 __lcpp_x) _NOEXCEPT {return atanh((double)__lcpp_x);}
+#endif
+
+// cbrt
+
+#ifndef _LIBCPP_MSVCRT
+using ::cbrt;
+using ::cbrtf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       cbrt(float __lcpp_x) _NOEXCEPT       {return cbrtf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return cbrtl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);}
+#endif
+
+// copysign
+
+using ::copysign;
+using ::copysignf;
+
+#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12)
+inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
+                                                float __lcpp_y) _NOEXCEPT {
+  return copysignf(__lcpp_x, __lcpp_y);
+}
+inline _LIBCPP_INLINE_VISIBILITY long double
+copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
+  return copysignl(__lcpp_x, __lcpp_y);
+}
+#endif
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+}
+
+#ifndef _LIBCPP_MSVCRT
+
+// erf
+
+using ::erf;
+using ::erff;
+
+inline _LIBCPP_INLINE_VISIBILITY float       erf(float __lcpp_x) _NOEXCEPT       {return erff(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return erfl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+erf(_A1 __lcpp_x) _NOEXCEPT {return erf((double)__lcpp_x);}
+
+// erfc
+
+using ::erfc;
+using ::erfcf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       erfc(float __lcpp_x) _NOEXCEPT       {return erfcf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return erfcl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+erfc(_A1 __lcpp_x) _NOEXCEPT {return erfc((double)__lcpp_x);}
+
+// exp2
+
+using ::exp2;
+using ::exp2f;
+
+inline _LIBCPP_INLINE_VISIBILITY float       exp2(float __lcpp_x) _NOEXCEPT       {return exp2f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return exp2l(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+exp2(_A1 __lcpp_x) _NOEXCEPT {return exp2((double)__lcpp_x);}
+
+// expm1
+
+using ::expm1;
+using ::expm1f;
+
+inline _LIBCPP_INLINE_VISIBILITY float       expm1(float __lcpp_x) _NOEXCEPT       {return expm1f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return expm1l(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+expm1(_A1 __lcpp_x) _NOEXCEPT {return expm1((double)__lcpp_x);}
+
+// fdim
+
+using ::fdim;
+using ::fdimf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fdimf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fdiml(__lcpp_x, __lcpp_y);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+}
+
+// fma
+
+using ::fmaf;
+using ::fma;
+
+inline _LIBCPP_INLINE_VISIBILITY float       fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT                   {return fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
+inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
+
+template <class _A1, class _A2, class _A3>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value &&
+    is_arithmetic<_A3>::value,
+    __promote<_A1, _A2, _A3>
+>::type
+fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2, _A3>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value &&
+                      is_same<_A3, __result_type>::value)), "");
+    return fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
+}
+
+// fmax
+
+using ::fmax;
+using ::fmaxf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fmaxf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmaxl(__lcpp_x, __lcpp_y);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+}
+
+// fmin
+
+using ::fmin;
+using ::fminf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fminf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fminl(__lcpp_x, __lcpp_y);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+}
+
+// hypot
+
+using ::hypot;
+using ::hypotf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return hypotf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return hypotl(__lcpp_x, __lcpp_y);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+}
+
+// ilogb
+
+using ::ilogb;
+using ::ilogbf;
+
+inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT       {return ilogbf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ilogbl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, int>::type
+ilogb(_A1 __lcpp_x) _NOEXCEPT {return ilogb((double)__lcpp_x);}
+
+// lgamma
+
+using ::lgamma;
+using ::lgammaf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       lgamma(float __lcpp_x) _NOEXCEPT       {return lgammaf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return lgammal(__lcpp_x);}
+
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+lgamma(_A1 __lcpp_x) _NOEXCEPT {return lgamma((double)__lcpp_x);}
+
+
+// llrint
+
+using ::llrint;
+using ::llrintf;
+
+inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT       {return llrintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return llrintl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, long long>::type
+llrint(_A1 __lcpp_x) _NOEXCEPT {return llrint((double)__lcpp_x);}
+
+// llround
+
+using ::llround;
+using ::llroundf;
+
+inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT       {return llroundf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return llroundl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, long long>::type
+llround(_A1 __lcpp_x) _NOEXCEPT {return llround((double)__lcpp_x);}
+
+// log1p
+
+using ::log1p;
+using ::log1pf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       log1p(float __lcpp_x) _NOEXCEPT       {return log1pf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return log1pl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+log1p(_A1 __lcpp_x) _NOEXCEPT {return log1p((double)__lcpp_x);}
+
+// log2
+
+using ::log2;
+using ::log2f;
+
+inline _LIBCPP_INLINE_VISIBILITY float       log2(float __lcpp_x) _NOEXCEPT       {return log2f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return log2l(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+log2(_A1 __lcpp_x) _NOEXCEPT {return log2((double)__lcpp_x);}
+
+// logb
+
+using ::logb;
+using ::logbf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       logb(float __lcpp_x) _NOEXCEPT       {return logbf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return logbl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+logb(_A1 __lcpp_x) _NOEXCEPT {return logb((double)__lcpp_x);}
+
+// lrint
+
+using ::lrint;
+using ::lrintf;
+
+inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT       {return lrintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return lrintl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, long>::type
+lrint(_A1 __lcpp_x) _NOEXCEPT {return lrint((double)__lcpp_x);}
+
+// lround
+
+using ::lround;
+using ::lroundf;
+
+inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT       {return lroundf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return lroundl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, long>::type
+lround(_A1 __lcpp_x) _NOEXCEPT {return lround((double)__lcpp_x);}
+
+#endif // _LIBCPP_MSVCRT
+#endif // __sun__
+
+// nan
+
+#ifndef _LIBCPP_MSVCRT
+using ::nan;
+using ::nanf;
+#endif // _LIBCPP_MSVCRT
+
+#ifndef __sun__
+#ifndef _LIBCPP_MSVCRT
+
+// nearbyint
+
+using ::nearbyint;
+using ::nearbyintf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       nearbyint(float __lcpp_x) _NOEXCEPT       {return nearbyintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return nearbyintl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+nearbyint(_A1 __lcpp_x) _NOEXCEPT {return nearbyint((double)__lcpp_x);}
+
+// nextafter
+
+using ::nextafter;
+using ::nextafterf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return nextafterf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nextafterl(__lcpp_x, __lcpp_y);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+}
+
+// nexttoward
+
+using ::nexttoward;
+using ::nexttowardf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT       {return nexttowardf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardl(__lcpp_x, __lcpp_y);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttoward((double)__lcpp_x, __lcpp_y);}
+
+// remainder
+
+using ::remainder;
+using ::remainderf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return remainderf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return remainderl(__lcpp_x, __lcpp_y);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+}
+
+// remquo
+
+using ::remquo;
+using ::remquof;
+
+inline _LIBCPP_INLINE_VISIBILITY float       remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT             {return remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
+inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __lazy_enable_if
+<
+    is_arithmetic<_A1>::value &&
+    is_arithmetic<_A2>::value,
+    __promote<_A1, _A2>
+>::type
+remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
+{
+    typedef typename __promote<_A1, _A2>::type __result_type;
+    static_assert((!(is_same<_A1, __result_type>::value &&
+                      is_same<_A2, __result_type>::value)), "");
+    return remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
+}
+
+// rint
+
+using ::rint;
+using ::rintf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       rint(float __lcpp_x) _NOEXCEPT       {return rintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return rintl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+rint(_A1 __lcpp_x) _NOEXCEPT {return rint((double)__lcpp_x);}
+
+// round
+
+using ::round;
+using ::roundf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       round(float __lcpp_x) _NOEXCEPT       {return roundf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return roundl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+round(_A1 __lcpp_x) _NOEXCEPT {return round((double)__lcpp_x);}
+
+// scalbln
+
+using ::scalbln;
+using ::scalblnf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT       {return scalblnf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnl(__lcpp_x, __lcpp_y);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalbln((double)__lcpp_x, __lcpp_y);}
+
+// scalbn
+
+using ::scalbn;
+using ::scalbnf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT       {return scalbnf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnl(__lcpp_x, __lcpp_y);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbn((double)__lcpp_x, __lcpp_y);}
+
+// tgamma
+
+using ::tgamma;
+using ::tgammaf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       tgamma(float __lcpp_x) _NOEXCEPT       {return tgammaf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return tgammal(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+tgamma(_A1 __lcpp_x) _NOEXCEPT {return tgamma((double)__lcpp_x);}
+
+// trunc
+
+using ::trunc;
+using ::truncf;
+
+inline _LIBCPP_INLINE_VISIBILITY float       trunc(float __lcpp_x) _NOEXCEPT       {return truncf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return truncl(__lcpp_x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+trunc(_A1 __lcpp_x) _NOEXCEPT {return trunc((double)__lcpp_x);}
+
+#endif // !_LIBCPP_MSVCRT
+
+using ::acosl;
+using ::asinl;
+using ::atanl;
+using ::atan2l;
+using ::ceill;
+using ::cosl;
+using ::coshl;
+using ::expl;
+using ::fabsl;
+using ::floorl;
+using ::fmodl;
+using ::frexpl;
+using ::ldexpl;
+using ::logl;
+using ::log10l;
+using ::modfl;
+using ::powl;
+using ::sinl;
+using ::sinhl;
+using ::sqrtl;
+using ::tanl;
+#ifndef _LIBCPP_MSVCRT
+using ::tanhl;
+using ::acoshl;
+using ::asinhl;
+using ::atanhl;
+using ::cbrtl;
+#endif  // !_LIBCPP_MSVCRT
+using ::copysignl;
+#ifndef _LIBCPP_MSVCRT
+using ::erfl;
+using ::erfcl;
+using ::exp2l;
+using ::expm1l;
+using ::fdiml;
+using ::fmal;
+using ::fmaxl;
+using ::fminl;
+using ::hypotl;
+using ::ilogbl;
+using ::lgammal;
+using ::llrintl;
+using ::llroundl;
+using ::log1pl;
+using ::log2l;
+using ::logbl;
+using ::lrintl;
+using ::lroundl;
+using ::nanl;
+using ::nearbyintl;
+using ::nextafterl;
+using ::nexttowardl;
+using ::remainderl;
+using ::remquol;
+using ::rintl;
+using ::roundl;
+using ::scalblnl;
+using ::scalbnl;
+using ::tgammal;
+using ::truncl;
+#endif // !_LIBCPP_MSVCRT
+
+#else 
+using ::lgamma;
+using ::lgammaf;
+#endif // __sun__
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CMATH

Property changes on: lab4/.minix-src/include/c++/cmath
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/complex.h
===================================================================
--- lab4/.minix-src/include/c++/complex.h	(nonexistent)
+++ lab4/.minix-src/include/c++/complex.h	(revision 13)
@@ -0,0 +1,35 @@
+// -*- C++ -*-
+//===--------------------------- complex.h --------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_COMPLEX_H
+#define _LIBCPP_COMPLEX_H
+
+/*
+    complex.h synopsis
+
+#include <ccomplex>
+
+*/
+
+#ifdef __cplusplus
+
+#include <ccomplex>
+
+#else  // __cplusplus
+
+#include_next <complex.h>
+
+#endif  // __cplusplus
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#endif  // _LIBCPP_COMPLEX_H

Property changes on: lab4/.minix-src/include/c++/complex.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/csignal
===================================================================
--- lab4/.minix-src/include/c++/csignal	(nonexistent)
+++ lab4/.minix-src/include/c++/csignal	(revision 13)
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//===--------------------------- csignal ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CSIGNAL
+#define _LIBCPP_CSIGNAL
+
+/*
+    csignal synopsis
+
+Macros:
+
+    SIG_DFL
+    SIG_ERR
+    SIG_IGN
+    SIGABRT
+    SIGFPE
+    SIGILL
+    SIGINT
+    SIGSEGV
+    SIGTERM
+
+namespace std
+{
+
+Types:
+
+    sig_atomic_t
+
+void (*signal(int sig, void (*func)(int)))(int);
+int raise(int sig);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <signal.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::sig_atomic_t;
+using ::signal;
+using ::raise;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CSIGNAL

Property changes on: lab4/.minix-src/include/c++/csignal
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cstddef
===================================================================
--- lab4/.minix-src/include/c++/cstddef	(nonexistent)
+++ lab4/.minix-src/include/c++/cstddef	(revision 13)
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+//===--------------------------- cstddef ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CSTDDEF
+#define _LIBCPP_CSTDDEF
+
+/*
+    cstddef synopsis
+
+Macros:
+
+    offsetof(type,member-designator)
+    NULL
+
+namespace std
+{
+
+Types:
+
+    ptrdiff_t
+    size_t
+    max_align_t
+    nullptr_t
+
+}  // std
+
+*/
+
+#include <__config>
+
+#include <stddef.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::ptrdiff_t;
+using ::size_t;
+
+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
+// Re-use the compiler's <stddef.h> max_align_t where possible.
+using ::max_align_t;
+#else
+typedef long double max_align_t;
+#endif
+
+#ifdef _LIBCPP_HAS_NO_NULLPTR
+
+struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
+{
+    void* __lx;
+
+    struct __nat {int __for_bool_;};
+
+    _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
+    _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
+
+    _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
+
+    template <class _Tp>
+        _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
+        operator _Tp* () const {return 0;}
+
+    template <class _Tp, class _Up>
+        _LIBCPP_ALWAYS_INLINE
+        operator _Tp _Up::* () const {return 0;}
+
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
+    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
+};
+
+inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
+
+#define nullptr _VSTD::__get_nullptr_t()
+
+#endif  // _LIBCPP_HAS_NO_NULLPTR
+
+_LIBCPP_END_NAMESPACE_STD
+
+#ifndef _LIBCPP_HAS_NO_NULLPTR
+
+namespace std
+{
+    typedef decltype(nullptr) nullptr_t;
+}
+
+#endif  // _LIBCPP_HAS_NO_NULLPTR
+
+#endif  // _LIBCPP_CSTDDEF

Property changes on: lab4/.minix-src/include/c++/cstddef
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cstdlib
===================================================================
--- lab4/.minix-src/include/c++/cstdlib	(nonexistent)
+++ lab4/.minix-src/include/c++/cstdlib	(revision 13)
@@ -0,0 +1,180 @@
+// -*- C++ -*-
+//===--------------------------- cstdlib ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CSTDLIB
+#define _LIBCPP_CSTDLIB
+
+/*
+    cstdlib synopsis
+
+Macros:
+
+    EXIT_FAILURE
+    EXIT_SUCCESS
+    MB_CUR_MAX
+    NULL
+    RAND_MAX
+
+namespace std
+{
+
+Types:
+
+    size_t
+    div_t
+    ldiv_t
+    lldiv_t                                                               // C99
+
+double    atof (const char* nptr);
+int       atoi (const char* nptr);
+long      atol (const char* nptr);
+long long atoll(const char* nptr);                                        // C99
+double             strtod  (const char* restrict nptr, char** restrict endptr);
+float              strtof  (const char* restrict nptr, char** restrict endptr); // C99
+long double        strtold (const char* restrict nptr, char** restrict endptr); // C99
+long               strtol  (const char* restrict nptr, char** restrict endptr, int base);
+long long          strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99
+unsigned long      strtoul (const char* restrict nptr, char** restrict endptr, int base);
+unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99
+int rand(void);
+void srand(unsigned int seed);
+void* calloc(size_t nmemb, size_t size);
+void free(void* ptr);
+void* malloc(size_t size);
+void* realloc(void* ptr, size_t size);
+void abort(void);
+int atexit(void (*func)(void));
+void exit(int status);
+void _Exit(int status);
+char* getenv(const char* name);
+int system(const char* string);
+void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
+              int (*compar)(const void *, const void *));
+void qsort(void* base, size_t nmemb, size_t size,
+           int (*compar)(const void *, const void *));
+int         abs(      int j);
+long        abs(     long j);
+long long   abs(long long j);                                             // C++0X
+long       labs(     long j);
+long long llabs(long long j);                                             // C99
+div_t     div(      int numer,       int denom);
+ldiv_t    div(     long numer,      long denom);
+lldiv_t   div(long long numer, long long denom);                          // C++0X
+ldiv_t   ldiv(     long numer,      long denom);
+lldiv_t lldiv(long long numer, long long denom);                          // C99
+int mblen(const char* s, size_t n);
+int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
+int wctomb(char* s, wchar_t wchar);
+size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
+size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
+int at_quick_exit(void (*func)(void))                                     // C++11
+void quick_exit(int status);                                              // C++11
+void *aligned_alloc(size_t alignment, size_t size);                       // C11
+
+}  // std
+
+*/
+
+#include <__config>
+#include <stdlib.h>
+#ifdef _LIBCPP_MSVCRT
+#include "support/win32/locale_win32.h"
+#endif // _LIBCPP_MSVCRT
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::size_t;
+using ::div_t;
+using ::ldiv_t;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+using ::lldiv_t;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+using ::atof;
+using ::atoi;
+using ::atol;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+using ::atoll;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+using ::strtod;
+using ::strtof;
+using ::strtold;
+using ::strtol;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+using ::strtoll;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+using ::strtoul;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+using ::strtoull;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+using ::rand;
+using ::srand;
+using ::calloc;
+using ::free;
+using ::malloc;
+using ::realloc;
+using ::abort;
+using ::atexit;
+using ::exit;
+using ::_Exit;
+using ::getenv;
+using ::system;
+using ::bsearch;
+using ::qsort;
+#undef abs
+using ::abs;
+#undef labs
+using ::labs;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+#undef llabs
+using ::llabs;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+#undef div
+using ::div;
+#undef ldiv
+using ::ldiv;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+#undef lldiv
+using ::lldiv;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
+using ::mblen;
+using ::mbtowc;
+using ::wctomb;
+#endif
+using ::mbstowcs;
+using ::wcstombs;
+#ifdef _LIBCPP_HAS_QUICK_EXIT
+using ::at_quick_exit;
+using ::quick_exit;
+#endif
+#ifdef _LIBCPP_HAS_C11_FEATURES
+using ::aligned_alloc;
+#endif
+
+// MSVCRT already has the correct prototype in <stdlib.h> #ifdef __cplusplus
+#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
+inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+
+inline _LIBCPP_INLINE_VISIBILITY  ldiv_t div(     long __x,      long __y) _NOEXCEPT {return  ldiv(__x, __y);}
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+#endif // _LIBCPP_MSVCRT
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CSTDLIB

Property changes on: lab4/.minix-src/include/c++/cstdlib
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/ctime
===================================================================
--- lab4/.minix-src/include/c++/ctime	(nonexistent)
+++ lab4/.minix-src/include/c++/ctime	(revision 13)
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+//===---------------------------- ctime -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CTIME
+#define _LIBCPP_CTIME
+
+/*
+    ctime synopsis
+
+Macros:
+
+    NULL
+    CLOCKS_PER_SEC
+
+namespace std
+{
+
+Types:
+
+    clock_t
+    size_t
+    time_t
+    tm
+
+clock_t clock();
+double difftime(time_t time1, time_t time0);
+time_t mktime(tm* timeptr);
+time_t time(time_t* timer);
+char* asctime(const tm* timeptr);
+char* ctime(const time_t* timer);
+tm*    gmtime(const time_t* timer);
+tm* localtime(const time_t* timer);
+size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
+                const tm* restrict timeptr);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <time.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+using ::clock_t;
+using ::size_t;
+using ::time_t;
+using ::tm;
+using ::clock;
+using ::difftime;
+using ::mktime;
+using ::time;
+#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
+using ::asctime;
+using ::ctime;
+using ::gmtime;
+using ::localtime;
+#endif
+using ::strftime;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_CTIME

Property changes on: lab4/.minix-src/include/c++/ctime
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/cxxabi.h
===================================================================
--- lab4/.minix-src/include/c++/cxxabi.h	(nonexistent)
+++ lab4/.minix-src/include/c++/cxxabi.h	(revision 13)
@@ -0,0 +1,244 @@
+/* 
+ * Copyright 2012 David Chisnall. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */ 
+
+#ifndef __CXXABI_H_
+#define __CXXABI_H_
+#include <stddef.h>
+#include <stdint.h>
+#include "unwind.h"
+namespace std 
+{
+	class type_info;
+}
+/*
+ * The cxxabi.h header provides a set of public definitions for types and
+ * functions defined by the Itanium C++ ABI specification.  For reference, see
+ * the ABI specification here:
+ *
+ * http://sourcery.mentor.com/public/cxx-abi/abi.html
+ *
+ * All deviations from this specification, unless otherwise noted, are
+ * accidental.
+ */
+
+#ifdef __cplusplus
+namespace __cxxabiv1 {
+extern "C" {
+#endif
+/**
+ * Function type to call when an unexpected exception is encountered.
+ */
+typedef void (*unexpected_handler)();
+/**
+ * Function type to call when an unrecoverable condition is encountered.
+ */
+typedef void (*terminate_handler)();
+
+
+/**
+ * Structure used as a header on thrown exceptions.  This is the same layout as
+ * defined by the Itanium ABI spec, so should be interoperable with any other
+ * implementation of this spec, such as GNU libsupc++.
+ *
+ * This structure is allocated when an exception is thrown.  Unwinding happens
+ * in two phases, the first looks for a handler and the second installs the
+ * context.  This structure stores a cache of the handler location between
+ * phase 1 and phase 2.  Unfortunately, cleanup information is not cached, so
+ * must be looked up in both phases.  This happens for two reasons.  The first
+ * is that we don't know how many frames containing cleanups there will be, and
+ * we should avoid dynamic allocation during unwinding (the exception may be
+ * reporting that we've run out of memory).  The second is that finding
+ * cleanups is much cheaper than finding handlers, because we don't have to
+ * look at the type table at all.
+ *
+ * Note: Several fields of this structure have not-very-informative names.
+ * These are taken from the ABI spec and have not been changed to make it
+ * easier for people referring to to the spec while reading this code.
+ */
+struct __cxa_exception
+{
+#if __LP64__
+	/**
+	 * Reference count.  Used to support the C++11 exception_ptr class.  This
+	 * is prepended to the structure in 64-bit mode and squeezed in to the
+	 * padding left before the 64-bit aligned _Unwind_Exception at the end in
+	 * 32-bit mode.
+	 *
+	 * Note that it is safe to extend this structure at the beginning, rather
+	 * than the end, because the public API for creating it returns the address
+	 * of the end (where the exception object can be stored).
+	 */
+	uintptr_t referenceCount;
+#endif
+	/** Type info for the thrown object. */
+	std::type_info *exceptionType;
+	/** Destructor for the object, if one exists. */
+	void (*exceptionDestructor) (void *); 
+	/** Handler called when an exception specification is violated. */
+	unexpected_handler unexpectedHandler;
+	/** Hander called to terminate. */
+	terminate_handler terminateHandler;
+	/**
+	 * Next exception in the list.  If an exception is thrown inside a catch
+	 * block and caught in a nested catch, this points to the exception that
+	 * will be handled after the inner catch block completes.
+	 */
+	__cxa_exception *nextException;
+	/**
+	 * The number of handlers that currently have references to this
+	 * exception.  The top (non-sign) bit of this is used as a flag to indicate
+	 * that the exception is being rethrown, so should not be deleted when its
+	 * handler count reaches 0 (which it doesn't with the top bit set).
+	 */
+	int handlerCount;
+#if defined(__arm__) && !defined(__ARM_DWARF_EH__)
+	/**
+	 * The ARM EH ABI requires the unwind library to keep track of exceptions
+	 * during cleanups.  These support nesting, so we need to keep a list of
+	 * them.
+	 */
+	_Unwind_Exception *nextCleanup;
+	/**
+	 * The number of cleanups that are currently being run on this exception. 
+	 */
+	int cleanupCount;
+#endif
+	/**
+	 * The selector value to be returned when installing the catch handler.
+	 * Used at the call site to determine which catch() block should execute.
+	 * This is found in phase 1 of unwinding then installed in phase 2.
+	 */
+	int handlerSwitchValue;
+	/**
+	 * The action record for the catch.  This is cached during phase 1
+	 * unwinding.
+	 */
+	const char *actionRecord;
+	/**
+	 * Pointer to the language-specific data area (LSDA) for the handler
+	 * frame.  This is unused in this implementation, but set for ABI
+	 * compatibility in case we want to mix code in very weird ways.
+	 */
+	const char *languageSpecificData;
+	/** The cached landing pad for the catch handler.*/
+	void *catchTemp;
+	/**
+	 * The pointer that will be returned as the pointer to the object.  When
+	 * throwing a class and catching a virtual superclass (for example), we
+	 * need to adjust the thrown pointer to make it all work correctly.
+	 */
+	void *adjustedPtr;
+#if !__LP64__
+	/**
+	 * Reference count.  Used to support the C++11 exception_ptr class.  This
+	 * is prepended to the structure in 64-bit mode and squeezed in to the
+	 * padding left before the 64-bit aligned _Unwind_Exception at the end in
+	 * 32-bit mode.
+	 *
+	 * Note that it is safe to extend this structure at the beginning, rather
+	 * than the end, because the public API for creating it returns the address
+	 * of the end (where the exception object can be stored) 
+	 */
+	uintptr_t referenceCount;
+#endif
+	/** The language-agnostic part of the exception header. */
+	_Unwind_Exception unwindHeader;
+};
+
+/**
+ * ABI-specified globals structure.  Returned by the __cxa_get_globals()
+ * function and its fast variant.  This is a per-thread structure - every
+ * thread will have one lazily allocated.
+ *
+ * This structure is defined by the ABI, so may be used outside of this
+ * library.
+ */
+struct __cxa_eh_globals
+{
+	/**
+	 * A linked list of exceptions that are currently caught.  There may be
+	 * several of these in nested catch() blocks.
+	 */
+	__cxa_exception *caughtExceptions;
+	/**
+	 * The number of uncaught exceptions.
+	 */
+	unsigned int uncaughtExceptions;
+};
+/**
+ * ABI function returning the __cxa_eh_globals structure.
+ */
+__cxa_eh_globals *__cxa_get_globals(void);
+/**
+ * Version of __cxa_get_globals() assuming that __cxa_get_globals() has already
+ * been called at least once by this thread.
+ */
+__cxa_eh_globals *__cxa_get_globals_fast(void);
+
+std::type_info * __cxa_current_exception_type();
+
+/**
+ * Throws an exception returned by __cxa_current_primary_exception().  This
+ * exception may have been caught in another thread.
+ */
+void __cxa_rethrow_primary_exception(void* thrown_exception);
+/**
+ * Returns the current exception in a form that can be stored in an
+ * exception_ptr object and then rethrown by a call to
+ * __cxa_rethrow_primary_exception().
+ */
+void *__cxa_current_primary_exception(void);
+/**
+ * Increments the reference count of an exception.  Called when an
+ * exception_ptr is copied.
+ */
+void __cxa_increment_exception_refcount(void* thrown_exception);
+/**
+ * Decrements the reference count of an exception.  Called when an
+ * exception_ptr is deleted.
+ */
+void __cxa_decrement_exception_refcount(void* thrown_exception);
+/**
+ * Demangles a C++ symbol or type name.  The buffer, if non-NULL, must be
+ * allocated with malloc() and must be *n bytes or more long.  This function
+ * may call realloc() on the value pointed to by buf, and will return the
+ * length of the string via *n.
+ *
+ * The value pointed to by status is set to one of the following:
+ *
+ * 0: success
+ * -1: memory allocation failure
+ * -2: invalid mangled name
+ * -3: invalid arguments
+ */
+char* __cxa_demangle(const char* mangled_name,
+                     char* buf,
+                     size_t* n,
+                     int* status);
+#ifdef __cplusplus
+} // extern "C"
+} // namespace
+
+namespace abi = __cxxabiv1;
+
+#endif /* __cplusplus */
+#endif /* __CXXABI_H_ */

Property changes on: lab4/.minix-src/include/c++/cxxabi.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/new
===================================================================
--- lab4/.minix-src/include/c++/new	(nonexistent)
+++ lab4/.minix-src/include/c++/new	(revision 13)
@@ -0,0 +1,182 @@
+// -*- C++ -*-
+//===----------------------------- new ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_NEW
+#define _LIBCPP_NEW
+
+/*
+    new synopsis
+
+namespace std
+{
+
+class bad_alloc
+    : public exception
+{
+public:
+    bad_alloc() noexcept;
+    bad_alloc(const bad_alloc&) noexcept;
+    bad_alloc& operator=(const bad_alloc&) noexcept;
+    virtual const char* what() const noexcept;
+};
+
+class bad_array_length : public bad_alloc // C++14
+{
+public:
+    bad_array_length() noexcept;
+};
+
+class bad_array_new_length : public bad_alloc
+{
+public:
+    bad_array_new_length() noexcept;
+};
+
+struct nothrow_t {};
+extern const nothrow_t nothrow;
+typedef void (*new_handler)();
+new_handler set_new_handler(new_handler new_p) noexcept;
+new_handler get_new_handler() noexcept;
+
+}  // std
+
+void* operator new(std::size_t size);                                   // replaceable
+void* operator new(std::size_t size, const std::nothrow_t&) noexcept;   // replaceable
+void  operator delete(void* ptr) noexcept;                              // replaceable
+void  operator delete(void* ptr, std::size_t size) noexcept;            // replaceable, C++14
+void  operator delete(void* ptr, const std::nothrow_t&) noexcept;       // replaceable
+
+void* operator new[](std::size_t size);                                 // replaceable
+void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable
+void  operator delete[](void* ptr) noexcept;                            // replaceable
+void  operator delete[](void* ptr, std::size_t size) noexcept;          // replaceable, C++14
+void  operator delete[](void* ptr, const std::nothrow_t&) noexcept;     // replaceable
+
+void* operator new  (std::size_t size, void* ptr) noexcept;
+void* operator new[](std::size_t size, void* ptr) noexcept;
+void  operator delete  (void* ptr, void*) noexcept;
+void  operator delete[](void* ptr, void*) noexcept;
+
+*/
+
+#include <__config>
+#include <exception>
+#include <cstddef>
+
+#include <__undef___deallocate>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+namespace std  // purposefully not using versioning namespace
+{
+
+class _LIBCPP_EXCEPTION_ABI bad_alloc
+    : public exception
+{
+public:
+    bad_alloc() _NOEXCEPT;
+    virtual ~bad_alloc() _NOEXCEPT;
+    virtual const char* what() const _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI bad_array_new_length
+    : public bad_alloc
+{
+public:
+    bad_array_new_length() _NOEXCEPT;
+    virtual ~bad_array_new_length() _NOEXCEPT;
+    virtual const char* what() const _NOEXCEPT;
+};
+
+#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
+
+class _LIBCPP_EXCEPTION_ABI bad_array_length
+    : public bad_alloc
+{
+public:
+    bad_array_length() _NOEXCEPT;
+    virtual ~bad_array_length() _NOEXCEPT;
+    virtual const char* what() const _NOEXCEPT;
+};
+
+#define _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
+
+#endif  // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
+
+_LIBCPP_FUNC_VIS void __throw_bad_alloc();  // not in C++ spec
+
+struct _LIBCPP_TYPE_VIS nothrow_t {};
+extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
+typedef void (*new_handler)();
+_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
+_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
+
+}  // std
+
+#if defined(_WIN32) && !defined(cxx_EXPORTS)
+# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS_ONLY
+#else
+# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS
+#endif
+
+_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz)
+#if !__has_feature(cxx_noexcept)
+    throw(std::bad_alloc)
+#endif
+;
+_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
+_LIBCPP_NEW_DELETE_VIS void  operator delete(void* __p) _NOEXCEPT;
+_LIBCPP_NEW_DELETE_VIS void  operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
+#if defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER >= 14 || \
+    (defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309)
+_LIBCPP_NEW_DELETE_VIS void  operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
+#endif
+
+_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)
+#if !__has_feature(cxx_noexcept)
+    throw(std::bad_alloc)
+#endif
+;
+_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
+_LIBCPP_NEW_DELETE_VIS void  operator delete[](void* __p) _NOEXCEPT;
+_LIBCPP_NEW_DELETE_VIS void  operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
+#if defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER >= 14 || \
+    (defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309)
+_LIBCPP_NEW_DELETE_VIS void  operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
+#endif
+
+inline _LIBCPP_INLINE_VISIBILITY void* operator new  (std::size_t, void* __p) _NOEXCEPT {return __p;}
+inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
+inline _LIBCPP_INLINE_VISIBILITY void  operator delete  (void*, void*) _NOEXCEPT {}
+inline _LIBCPP_INLINE_VISIBILITY void  operator delete[](void*, void*) _NOEXCEPT {}
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) {
+#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
+  return ::operator new(__size);
+#else
+  return __builtin_operator_new(__size);
+#endif
+}
+
+inline _LIBCPP_INLINE_VISIBILITY void __deallocate(void *__ptr) {
+#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
+  ::operator delete(__ptr);
+#else
+  __builtin_operator_delete(__ptr);
+#endif
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_NEW

Property changes on: lab4/.minix-src/include/c++/new
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/queue
===================================================================
--- lab4/.minix-src/include/c++/queue	(nonexistent)
+++ lab4/.minix-src/include/c++/queue	(revision 13)
@@ -0,0 +1,717 @@
+// -*- C++ -*-
+//===--------------------------- queue ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_QUEUE
+#define _LIBCPP_QUEUE
+
+/*
+    queue synopsis
+
+namespace std
+{
+
+template <class T, class Container = deque<T>>
+class queue
+{
+public:
+    typedef Container                                container_type;
+    typedef typename container_type::value_type      value_type;
+    typedef typename container_type::reference       reference;
+    typedef typename container_type::const_reference const_reference;
+    typedef typename container_type::size_type       size_type;
+
+protected:
+    container_type c;
+
+public:
+    queue() = default;
+    ~queue() = default;
+
+    queue(const queue& q) = default;
+    queue(queue&& q) = default;
+
+    queue& operator=(const queue& q) = default;
+    queue& operator=(queue&& q) = default;
+
+    explicit queue(const container_type& c);
+    explicit queue(container_type&& c)
+    template <class Alloc>
+        explicit queue(const Alloc& a);
+    template <class Alloc>
+        queue(const container_type& c, const Alloc& a);
+    template <class Alloc>
+        queue(container_type&& c, const Alloc& a);
+    template <class Alloc>
+        queue(const queue& q, const Alloc& a);
+    template <class Alloc>
+        queue(queue&& q, const Alloc& a);
+
+    bool      empty() const;
+    size_type size() const;
+
+    reference       front();
+    const_reference front() const;
+    reference       back();
+    const_reference back() const;
+
+    void push(const value_type& v);
+    void push(value_type&& v);
+    template <class... Args> void emplace(Args&&... args);
+    void pop();
+
+    void swap(queue& q) noexcept(noexcept(swap(c, q.c)));
+};
+
+template <class T, class Container>
+  bool operator==(const queue<T, Container>& x,const queue<T, Container>& y);
+
+template <class T, class Container>
+  bool operator< (const queue<T, Container>& x,const queue<T, Container>& y);
+
+template <class T, class Container>
+  bool operator!=(const queue<T, Container>& x,const queue<T, Container>& y);
+
+template <class T, class Container>
+  bool operator> (const queue<T, Container>& x,const queue<T, Container>& y);
+
+template <class T, class Container>
+  bool operator>=(const queue<T, Container>& x,const queue<T, Container>& y);
+
+template <class T, class Container>
+  bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y);
+
+template <class T, class Container>
+  void swap(queue<T, Container>& x, queue<T, Container>& y)
+  noexcept(noexcept(x.swap(y)));
+
+template <class T, class Container = vector<T>,
+          class Compare = less<typename Container::value_type>>
+class priority_queue
+{
+public:
+    typedef Container                                container_type;
+    typedef typename container_type::value_type      value_type;
+    typedef typename container_type::reference       reference;
+    typedef typename container_type::const_reference const_reference;
+    typedef typename container_type::size_type       size_type;
+
+protected:
+    container_type c;
+    Compare comp;
+
+public:
+    priority_queue() = default;
+    ~priority_queue() = default;
+
+    priority_queue(const priority_queue& q) = default;
+    priority_queue(priority_queue&& q) = default;
+
+    priority_queue& operator=(const priority_queue& q) = default;
+    priority_queue& operator=(priority_queue&& q) = default;
+
+    explicit priority_queue(const Compare& comp);
+    priority_queue(const Compare& comp, const container_type& c);
+    explicit priority_queue(const Compare& comp, container_type&& c);
+    template <class InputIterator>
+        priority_queue(InputIterator first, InputIterator last,
+                       const Compare& comp = Compare());
+    template <class InputIterator>
+        priority_queue(InputIterator first, InputIterator last,
+                       const Compare& comp, const container_type& c);
+    template <class InputIterator>
+        priority_queue(InputIterator first, InputIterator last,
+                       const Compare& comp, container_type&& c);
+    template <class Alloc>
+        explicit priority_queue(const Alloc& a);
+    template <class Alloc>
+        priority_queue(const Compare& comp, const Alloc& a);
+    template <class Alloc>
+        priority_queue(const Compare& comp, const container_type& c,
+                       const Alloc& a);
+    template <class Alloc>
+        priority_queue(const Compare& comp, container_type&& c,
+                       const Alloc& a);
+    template <class Alloc>
+        priority_queue(const priority_queue& q, const Alloc& a);
+    template <class Alloc>
+        priority_queue(priority_queue&& q, const Alloc& a);
+
+    bool            empty() const;
+    size_type       size() const;
+    const_reference top() const;
+
+    void push(const value_type& v);
+    void push(value_type&& v);
+    template <class... Args> void emplace(Args&&... args);
+    void pop();
+
+    void swap(priority_queue& q)
+        noexcept(noexcept(swap(c, q.c)) && noexcept(swap(comp.q.comp)));
+};
+
+template <class T, class Container, class Compare>
+  void swap(priority_queue<T, Container, Compare>& x,
+            priority_queue<T, Container, Compare>& y)
+            noexcept(noexcept(x.swap(y)));
+
+}  // std
+
+*/
+
+#include <__config>
+#include <deque>
+#include <vector>
+#include <functional>
+#include <algorithm>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TYPE_VIS_ONLY queue;
+
+template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
+
+template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
+
+template <class _Tp, class _Container /*= deque<_Tp>*/>
+class _LIBCPP_TYPE_VIS_ONLY queue
+{
+public:
+    typedef _Container                               container_type;
+    typedef typename container_type::value_type      value_type;
+    typedef typename container_type::reference       reference;
+    typedef typename container_type::const_reference const_reference;
+    typedef typename container_type::size_type       size_type;
+
+protected:
+    container_type c;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    queue()
+        _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
+        : c() {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    queue(const queue& __q) : c(__q.c) {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    queue(queue&& __q)
+        _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
+        : c(_VSTD::move(__q.c)) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    queue& operator=(const queue& __q) {c = __q.c; return *this;}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    queue& operator=(queue&& __q)
+        _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
+        {c = _VSTD::move(__q.c); return *this;}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit queue(const container_type& __c)  : c(__c) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit queue(const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0)
+            : c(__a) {}
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        queue(const queue& __q, const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0)
+            : c(__q.c, __a) {}
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        queue(const container_type& __c, const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0)
+            : c(__c, __a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        queue(container_type&& __c, const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0)
+            : c(_VSTD::move(__c), __a) {}
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        queue(queue&& __q, const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0)
+            : c(_VSTD::move(__q.c), __a) {}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool      empty() const {return c.empty();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const  {return c.size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference       front()       {return c.front();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference front() const {return c.front();}
+    _LIBCPP_INLINE_VISIBILITY
+    reference       back()        {return c.back();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference back() const  {return c.back();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void push(const value_type& __v) {c.push_back(__v);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void push(value_type&& __v)      {c.push_back(_VSTD::move(__v));}
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        void emplace(_Args&&... __args)
+            {c.emplace_back(_VSTD::forward<_Args>(__args)...);}
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void pop() {c.pop_front();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(queue& __q)
+        _NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
+    {
+        using _VSTD::swap;
+        swap(c, __q.c);
+    }
+
+    template <class _T1, class _C1>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    bool
+    operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
+
+    template <class _T1, class _C1>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    bool
+    operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
+};
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
+{
+    return __x.c == __y.c;
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
+{
+    return __x.c < __y.c;
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Tp, class _Container, class _Alloc>
+struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<queue<_Tp, _Container>, _Alloc>
+    : public uses_allocator<_Container, _Alloc>
+{
+};
+
+template <class _Tp, class _Container = vector<_Tp>,
+          class _Compare = less<typename _Container::value_type> >
+class _LIBCPP_TYPE_VIS_ONLY priority_queue
+{
+public:
+    typedef _Container                               container_type;
+    typedef _Compare                                 value_compare;
+    typedef typename container_type::value_type      value_type;
+    typedef typename container_type::reference       reference;
+    typedef typename container_type::const_reference const_reference;
+    typedef typename container_type::size_type       size_type;
+
+protected:
+    container_type c;
+    value_compare comp;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    priority_queue()
+        _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
+                   is_nothrow_default_constructible<value_compare>::value)
+        : c(), comp() {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    priority_queue(priority_queue&& __q)
+        _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
+                   is_nothrow_move_constructible<value_compare>::value)
+        : c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    priority_queue& operator=(const priority_queue& __q)
+        {c = __q.c; comp = __q.comp; return *this;}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    priority_queue& operator=(priority_queue&& __q)
+        _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
+                   is_nothrow_move_assignable<value_compare>::value)
+        {c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit priority_queue(const value_compare& __comp)
+        : c(), comp(__comp) {}
+    priority_queue(const value_compare& __comp, const container_type& __c);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    explicit priority_queue(const value_compare& __comp, container_type&& __c);
+#endif
+    template <class _InputIter>
+        priority_queue(_InputIter __f, _InputIter __l,
+                       const value_compare& __comp = value_compare());
+    template <class _InputIter>
+        priority_queue(_InputIter __f, _InputIter __l,
+                       const value_compare& __comp, const container_type& __c);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _InputIter>
+        priority_queue(_InputIter __f, _InputIter __l,
+                       const value_compare& __comp, container_type&& __c);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Alloc>
+        explicit priority_queue(const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0);
+    template <class _Alloc>
+        priority_queue(const value_compare& __comp, const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0);
+    template <class _Alloc>
+        priority_queue(const value_compare& __comp, const container_type& __c,
+                       const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0);
+    template <class _Alloc>
+        priority_queue(const priority_queue& __q, const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Alloc>
+        priority_queue(const value_compare& __comp, container_type&& __c,
+                       const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0);
+    template <class _Alloc>
+        priority_queue(priority_queue&& __q, const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool            empty() const {return c.empty();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type       size() const  {return c.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference top() const   {return c.front();}
+
+    void push(const value_type& __v);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void push(value_type&& __v);
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args> void emplace(_Args&&... __args);
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void pop();
+
+    void swap(priority_queue& __q)
+        _NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
+                   __is_nothrow_swappable<value_compare>::value);
+};
+
+template <class _Tp, class _Container, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
+                                                          const container_type& __c)
+    : c(__c),
+      comp(__comp)
+{
+    _VSTD::make_heap(c.begin(), c.end(), comp);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Container, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
+                                                          container_type&& __c)
+    : c(_VSTD::move(__c)),
+      comp(__comp)
+{
+    _VSTD::make_heap(c.begin(), c.end(), comp);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Container, class _Compare>
+template <class _InputIter>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
+                                                          const value_compare& __comp)
+    : c(__f, __l),
+      comp(__comp)
+{
+    _VSTD::make_heap(c.begin(), c.end(), comp);
+}
+
+template <class _Tp, class _Container, class _Compare>
+template <class _InputIter>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
+                                                          const value_compare& __comp,
+                                                          const container_type& __c)
+    : c(__c),
+      comp(__comp)
+{
+    c.insert(c.end(), __f, __l);
+    _VSTD::make_heap(c.begin(), c.end(), comp);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Container, class _Compare>
+template <class _InputIter>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
+                                                          const value_compare& __comp,
+                                                          container_type&& __c)
+    : c(_VSTD::move(__c)),
+      comp(__comp)
+{
+    c.insert(c.end(), __f, __l);
+    _VSTD::make_heap(c.begin(), c.end(), comp);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Container, class _Compare>
+template <class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type*)
+    : c(__a)
+{
+}
+
+template <class _Tp, class _Container, class _Compare>
+template <class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
+                                                          const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type*)
+    : c(__a),
+      comp(__comp)
+{
+}
+
+template <class _Tp, class _Container, class _Compare>
+template <class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
+                                                          const container_type& __c,
+                                                          const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type*)
+    : c(__c, __a),
+      comp(__comp)
+{
+    _VSTD::make_heap(c.begin(), c.end(), comp);
+}
+
+template <class _Tp, class _Container, class _Compare>
+template <class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
+                                                          const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type*)
+    : c(__q.c, __a),
+      comp(__q.comp)
+{
+    _VSTD::make_heap(c.begin(), c.end(), comp);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Container, class _Compare>
+template <class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
+                                                          container_type&& __c,
+                                                          const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type*)
+    : c(_VSTD::move(__c), __a),
+      comp(__comp)
+{
+    _VSTD::make_heap(c.begin(), c.end(), comp);
+}
+
+template <class _Tp, class _Container, class _Compare>
+template <class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
+                                                          const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type*)
+    : c(_VSTD::move(__q.c), __a),
+      comp(_VSTD::move(__q.comp))
+{
+    _VSTD::make_heap(c.begin(), c.end(), comp);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Container, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
+{
+    c.push_back(__v);
+    _VSTD::push_heap(c.begin(), c.end(), comp);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Container, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
+{
+    c.push_back(_VSTD::move(__v));
+    _VSTD::push_heap(c.begin(), c.end(), comp);
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Container, class _Compare>
+template <class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
+{
+    c.emplace_back(_VSTD::forward<_Args>(__args)...);
+    _VSTD::push_heap(c.begin(), c.end(), comp);
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Container, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+priority_queue<_Tp, _Container, _Compare>::pop()
+{
+    _VSTD::pop_heap(c.begin(), c.end(), comp);
+    c.pop_back();
+}
+
+template <class _Tp, class _Container, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
+        _NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
+                   __is_nothrow_swappable<value_compare>::value)
+{
+    using _VSTD::swap;
+    swap(c, __q.c);
+    swap(comp, __q.comp);
+}
+
+template <class _Tp, class _Container, class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(priority_queue<_Tp, _Container, _Compare>& __x,
+     priority_queue<_Tp, _Container, _Compare>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Tp, class _Container, class _Compare, class _Alloc>
+struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
+    : public uses_allocator<_Container, _Alloc>
+{
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_QUEUE

Property changes on: lab4/.minix-src/include/c++/queue
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/locale
===================================================================
--- lab4/.minix-src/include/c++/locale	(nonexistent)
+++ lab4/.minix-src/include/c++/locale	(revision 13)
@@ -0,0 +1,4475 @@
+// -*- C++ -*-
+//===-------------------------- locale ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_LOCALE
+#define _LIBCPP_LOCALE
+
+/*
+    locale synopsis
+
+namespace std
+{
+
+class locale
+{
+public:
+    // types:
+    class facet;
+    class id;
+
+    typedef int category;
+    static const category // values assigned here are for exposition only
+        none     = 0x000,
+        collate  = 0x010,
+        ctype    = 0x020,
+        monetary = 0x040,
+        numeric  = 0x080,
+        time     = 0x100,
+        messages = 0x200,
+        all = collate | ctype | monetary | numeric | time | messages;
+
+    // construct/copy/destroy:
+    locale() noexcept;
+    locale(const locale& other) noexcept;
+    explicit locale(const char* std_name);
+    explicit locale(const string& std_name);
+    locale(const locale& other, const char* std_name, category);
+    locale(const locale& other, const string& std_name, category);
+    template <class Facet> locale(const locale& other, Facet* f);
+    locale(const locale& other, const locale& one, category);
+
+    ~locale(); // not virtual
+
+    const locale& operator=(const locale& other) noexcept;
+
+    template <class Facet> locale combine(const locale& other) const;
+
+    // locale operations:
+    basic_string<char> name() const;
+    bool operator==(const locale& other) const;
+    bool operator!=(const locale& other) const;
+    template <class charT, class Traits, class Allocator>
+      bool operator()(const basic_string<charT,Traits,Allocator>& s1,
+                      const basic_string<charT,Traits,Allocator>& s2) const;
+
+    // global locale objects:
+    static locale global(const locale&);
+    static const locale& classic();
+};
+
+template <class Facet> const Facet& use_facet(const locale&);
+template <class Facet> bool has_facet(const locale&) noexcept;
+
+// 22.3.3, convenience interfaces:
+template <class charT> bool isspace (charT c, const locale& loc);
+template <class charT> bool isprint (charT c, const locale& loc);
+template <class charT> bool iscntrl (charT c, const locale& loc);
+template <class charT> bool isupper (charT c, const locale& loc);
+template <class charT> bool islower (charT c, const locale& loc);
+template <class charT> bool isalpha (charT c, const locale& loc);
+template <class charT> bool isdigit (charT c, const locale& loc);
+template <class charT> bool ispunct (charT c, const locale& loc);
+template <class charT> bool isxdigit(charT c, const locale& loc);
+template <class charT> bool isalnum (charT c, const locale& loc);
+template <class charT> bool isgraph (charT c, const locale& loc);
+template <class charT> charT toupper(charT c, const locale& loc);
+template <class charT> charT tolower(charT c, const locale& loc);
+
+template<class Codecvt, class Elem = wchar_t,
+         class Wide_alloc = allocator<Elem>,
+         class Byte_alloc = allocator<char>>
+class wstring_convert
+{
+public:
+    typedef basic_string<char, char_traits<char>, Byte_alloc> byte_string;
+    typedef basic_string<Elem, char_traits<Elem>, Wide_alloc> wide_string;
+    typedef typename Codecvt::state_type                      state_type;
+    typedef typename wide_string::traits_type::int_type       int_type;
+
+    explicit wstring_convert(Codecvt* pcvt = new Codecvt);          // explicit in C++14
+    wstring_convert(Codecvt* pcvt, state_type state);
+    explicit wstring_convert(const byte_string& byte_err,           // explicit in C++14
+                    const wide_string& wide_err = wide_string());
+    wstring_convert(const wstring_convert&) = delete;               // C++14
+    wstring_convert & operator=(const wstring_convert &) = delete;  // C++14
+    ~wstring_convert();
+
+    wide_string from_bytes(char byte);
+    wide_string from_bytes(const char* ptr);
+    wide_string from_bytes(const byte_string& str);
+    wide_string from_bytes(const char* first, const char* last);
+
+    byte_string to_bytes(Elem wchar);
+    byte_string to_bytes(const Elem* wptr);
+    byte_string to_bytes(const wide_string& wstr);
+    byte_string to_bytes(const Elem* first, const Elem* last);
+
+    size_t converted() const; // noexcept in C++14
+    state_type state() const;
+};
+
+template <class Codecvt, class Elem = wchar_t, class Tr = char_traits<Elem>>
+class wbuffer_convert
+    : public basic_streambuf<Elem, Tr>
+{
+public:
+    typedef typename Tr::state_type state_type;
+
+    explicit wbuffer_convert(streambuf* bytebuf = 0, Codecvt* pcvt = new Codecvt,
+                    state_type state = state_type());       // explicit in C++14
+    wbuffer_convert(const wbuffer_convert&) = delete;               // C++14
+    wbuffer_convert & operator=(const wbuffer_convert &) = delete;  // C++14
+    ~wbuffer_convert();                                             // C++14
+    
+    streambuf* rdbuf() const;
+    streambuf* rdbuf(streambuf* bytebuf);
+
+    state_type state() const;
+};
+
+// 22.4.1 and 22.4.1.3, ctype:
+class ctype_base;
+template <class charT> class ctype;
+template <> class ctype<char>; // specialization
+template <class charT> class ctype_byname;
+template <> class ctype_byname<char>; // specialization
+
+class codecvt_base;
+template <class internT, class externT, class stateT> class codecvt;
+template <class internT, class externT, class stateT> class codecvt_byname;
+
+// 22.4.2 and 22.4.3, numeric:
+template <class charT, class InputIterator> class num_get;
+template <class charT, class OutputIterator> class num_put;
+template <class charT> class numpunct;
+template <class charT> class numpunct_byname;
+
+// 22.4.4, col lation:
+template <class charT> class collate;
+template <class charT> class collate_byname;
+
+// 22.4.5, date and time:
+class time_base;
+template <class charT, class InputIterator> class time_get;
+template <class charT, class InputIterator> class time_get_byname;
+template <class charT, class OutputIterator> class time_put;
+template <class charT, class OutputIterator> class time_put_byname;
+
+// 22.4.6, money:
+class money_base;
+template <class charT, class InputIterator> class money_get;
+template <class charT, class OutputIterator> class money_put;
+template <class charT, bool Intl> class moneypunct;
+template <class charT, bool Intl> class moneypunct_byname;
+
+// 22.4.7, message retrieval:
+class messages_base;
+template <class charT> class messages;
+template <class charT> class messages_byname;
+
+}  // std
+
+*/
+
+#include <__config>
+#include <__locale>
+#include <algorithm>
+#include <memory>
+#include <ios>
+#include <streambuf>
+#include <iterator>
+#include <limits>
+#ifndef __APPLE__
+#include <cstdarg>
+#endif
+#include <cstdlib>
+#include <ctime>
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+#include <support/win32/locale_win32.h>
+#elif defined(_NEWLIB_VERSION)
+// FIXME: replace all the uses of _NEWLIB_VERSION with __NEWLIB__ preceded by an
+// include of <sys/cdefs.h> once https://sourceware.org/ml/newlib-cvs/2014-q3/msg00038.html
+// has had a chance to bake for a bit
+#include <support/newlib/xlocale.h>
+#endif
+#ifdef _LIBCPP_HAS_CATOPEN
+#include <nl_types.h>
+#endif
+
+#ifdef __APPLE__
+#include <Availability.h>
+#endif
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if defined(__APPLE__) || defined(__FreeBSD__)
+#  define _LIBCPP_GET_C_LOCALE 0
+#elif defined(__CloudABI__) || defined(__NetBSD__) || defined(__minix)
+#  define _LIBCPP_GET_C_LOCALE LC_C_LOCALE
+#else
+#  define _LIBCPP_GET_C_LOCALE __cloc()
+   // Get the C locale object
+   _LIBCPP_FUNC_VIS locale_t __cloc();
+#define __cloc_defined
+#endif
+
+typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
+typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr;
+#ifndef _LIBCPP_LOCALE__L_EXTENSIONS
+typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
+#endif
+
+// OSX has nice foo_l() functions that let you turn off use of the global
+// locale.  Linux, not so much.  The following functions avoid the locale when
+// that's possible and otherwise do the wrong thing.  FIXME.
+#if defined(__linux__) || defined(__EMSCRIPTEN__) || defined(_AIX) || \
+    defined(_NEWLIB_VERSION) || defined(__GLIBC__)
+
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
+inline _LIBCPP_INLINE_VISIBILITY
+__mb_cur_max_l(locale_t __l)
+{
+  return MB_CUR_MAX_L(__l);
+}
+#else  // _LIBCPP_LOCALE__L_EXTENSIONS
+inline _LIBCPP_ALWAYS_INLINE
+decltype(MB_CUR_MAX) __mb_cur_max_l(locale_t __l)
+{
+  __locale_raii __current(uselocale(__l), uselocale);
+  return MB_CUR_MAX;
+}
+#endif // _LIBCPP_LOCALE__L_EXTENSIONS
+
+inline _LIBCPP_ALWAYS_INLINE
+wint_t __btowc_l(int __c, locale_t __l)
+{
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  return btowc_l(__c, __l);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  return btowc(__c);
+#endif
+}
+
+inline _LIBCPP_ALWAYS_INLINE
+int __wctob_l(wint_t __c, locale_t __l)
+{
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  return wctob_l(__c, __l);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  return wctob(__c);
+#endif
+}
+
+inline _LIBCPP_ALWAYS_INLINE
+size_t __wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
+                      size_t __len, mbstate_t *__ps, locale_t __l)
+{
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  return wcsnrtombs_l(__dest, __src, __nwc, __len, __ps, __l);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
+#endif
+}
+
+inline _LIBCPP_ALWAYS_INLINE
+size_t __wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
+{
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  return wcrtomb_l(__s, __wc, __ps, __l);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  return wcrtomb(__s, __wc, __ps);
+#endif
+}
+
+inline _LIBCPP_ALWAYS_INLINE
+size_t __mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
+                      size_t __len, mbstate_t *__ps, locale_t __l)
+{
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  return mbsnrtowcs_l(__dest, __src, __nms, __len, __ps, __l);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
+#endif
+}
+
+inline _LIBCPP_ALWAYS_INLINE
+size_t __mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
+                   mbstate_t *__ps, locale_t __l)
+{
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  return mbrtowc_l(__pwc, __s, __n, __ps, __l);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  return mbrtowc(__pwc, __s, __n, __ps);
+#endif
+}
+
+inline _LIBCPP_ALWAYS_INLINE
+int __mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
+{
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  return mbtowc_l(__pwc, __pmb, __max, __l);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  return mbtowc(__pwc, __pmb, __max);
+#endif
+}
+
+inline _LIBCPP_ALWAYS_INLINE
+size_t __mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
+{
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  return mbrlen_l(__s, __n, __ps, __l);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  return mbrlen(__s, __n, __ps);
+#endif
+}
+
+inline _LIBCPP_ALWAYS_INLINE
+lconv *__localeconv_l(locale_t __l)
+{
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  return localeconv_l(__l);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  return localeconv();
+#endif
+}
+
+inline _LIBCPP_ALWAYS_INLINE
+size_t __mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
+                     mbstate_t *__ps, locale_t __l)
+{
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  return mbsrtowcs_l(__dest, __src, __len, __ps, __l);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  return mbsrtowcs(__dest, __src, __len, __ps);
+#endif
+}
+
+inline
+int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
+  va_list __va;
+  va_start(__va, __format);
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  int __res = vsnprintf_l(__s, __n, __l, __format, __va);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  int __res = vsnprintf(__s, __n, __format, __va);
+#endif
+  va_end(__va);
+  return __res;
+}
+
+inline
+int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
+  va_list __va;
+  va_start(__va, __format);
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  int __res = vasprintf_l(__s, __l, __format, __va);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  int __res = vasprintf(__s, __format, __va);
+#endif
+  va_end(__va);
+  return __res;
+}
+
+inline
+int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
+  va_list __va;
+  va_start(__va, __format);
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+  int __res = vsscanf_l(__s, __l, __format, __va);
+#else
+  __locale_raii __current(uselocale(__l), uselocale);
+  int __res = vsscanf(__s, __format, __va);
+#endif
+  va_end(__va);
+  return __res;
+}
+
+#endif  // __linux__
+
+// __scan_keyword
+// Scans [__b, __e) until a match is found in the basic_strings range
+//  [__kb, __ke) or until it can be shown that there is no match in [__kb, __ke).
+//  __b will be incremented (visibly), consuming CharT until a match is found
+//  or proved to not exist.  A keyword may be "", in which will match anything.
+//  If one keyword is a prefix of another, and the next CharT in the input
+//  might match another keyword, the algorithm will attempt to find the longest
+//  matching keyword.  If the longer matching keyword ends up not matching, then
+//  no keyword match is found.  If no keyword match is found, __ke is returned
+//  and failbit is set in __err.
+//  Else an iterator pointing to the matching keyword is found.  If more than
+//  one keyword matches, an iterator to the first matching keyword is returned.
+//  If on exit __b == __e, eofbit is set in __err.  If __case_sensitive is false,
+//  __ct is used to force to lower case before comparing characters.
+//  Examples:
+//  Keywords:  "a", "abb"
+//  If the input is "a", the first keyword matches and eofbit is set.
+//  If the input is "abc", no match is found and "ab" are consumed.
+template <class _InputIterator, class _ForwardIterator, class _Ctype>
+_LIBCPP_HIDDEN
+_ForwardIterator
+__scan_keyword(_InputIterator& __b, _InputIterator __e,
+               _ForwardIterator __kb, _ForwardIterator __ke,
+               const _Ctype& __ct, ios_base::iostate& __err,
+               bool __case_sensitive = true)
+{
+    typedef typename iterator_traits<_InputIterator>::value_type _CharT;
+    size_t __nkw = static_cast<size_t>(_VSTD::distance(__kb, __ke));
+    const unsigned char __doesnt_match = '\0';
+    const unsigned char __might_match = '\1';
+    const unsigned char __does_match = '\2';
+    unsigned char __statbuf[100];
+    unsigned char* __status = __statbuf;
+    unique_ptr<unsigned char, void(*)(void*)> __stat_hold(0, free);
+    if (__nkw > sizeof(__statbuf))
+    {
+        __status = (unsigned char*)malloc(__nkw);
+        if (__status == 0)
+            __throw_bad_alloc();
+        __stat_hold.reset(__status);
+    }
+    size_t __n_might_match = __nkw;  // At this point, any keyword might match
+    size_t __n_does_match = 0;       // but none of them definitely do
+    // Initialize all statuses to __might_match, except for "" keywords are __does_match
+    unsigned char* __st = __status;
+    for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
+    {
+        if (!__ky->empty())
+            *__st = __might_match;
+        else
+        {
+            *__st = __does_match;
+            --__n_might_match;
+            ++__n_does_match;
+        }
+    }
+    // While there might be a match, test keywords against the next CharT
+    for (size_t __indx = 0; __b != __e && __n_might_match > 0; ++__indx)
+    {
+        // Peek at the next CharT but don't consume it
+        _CharT __c = *__b;
+        if (!__case_sensitive)
+            __c = __ct.toupper(__c);
+        bool __consume = false;
+        // For each keyword which might match, see if the __indx character is __c
+        // If a match if found, consume __c
+        // If a match is found, and that is the last character in the keyword,
+        //    then that keyword matches.
+        // If the keyword doesn't match this character, then change the keyword
+        //    to doesn't match
+        __st = __status;
+        for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
+        {
+            if (*__st == __might_match)
+            {
+                _CharT __kc = (*__ky)[__indx];
+                if (!__case_sensitive)
+                    __kc = __ct.toupper(__kc);
+                if (__c == __kc)
+                {
+                    __consume = true;
+                    if (__ky->size() == __indx+1)
+                    {
+                        *__st = __does_match;
+                        --__n_might_match;
+                        ++__n_does_match;
+                    }
+                }
+                else
+                {
+                    *__st = __doesnt_match;
+                    --__n_might_match;
+                }
+            }
+        }
+        // consume if we matched a character
+        if (__consume)
+        {
+            ++__b;
+            // If we consumed a character and there might be a matched keyword that
+            //   was marked matched on a previous iteration, then such keywords
+            //   which are now marked as not matching.
+            if (__n_might_match + __n_does_match > 1)
+            {
+                __st = __status;
+                for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
+                {
+                    if (*__st == __does_match && __ky->size() != __indx+1)
+                    {
+                        *__st = __doesnt_match;
+                        --__n_does_match;
+                    }
+                }
+            }
+        }
+    }
+    // We've exited the loop because we hit eof and/or we have no more "might matches".
+    if (__b == __e)
+        __err |= ios_base::eofbit;
+    // Return the first matching result
+    for (__st = __status; __kb != __ke; ++__kb, (void) ++__st)
+        if (*__st == __does_match)
+            break;
+    if (__kb == __ke)
+        __err |= ios_base::failbit;
+    return __kb;
+}
+
+struct _LIBCPP_TYPE_VIS __num_get_base
+{
+    static const int __num_get_buf_sz = 40;
+
+    static int __get_base(ios_base&);
+    static const char __src[33];
+};
+
+_LIBCPP_FUNC_VIS
+void __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
+                      ios_base::iostate& __err);
+
+template <class _CharT>
+struct __num_get
+    : protected __num_get_base
+{
+    static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep);
+    static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point,
+                                      _CharT& __thousands_sep);
+    static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
+                  unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
+                  unsigned* __g, unsigned*& __g_end, _CharT* __atoms);
+    static int __stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp,
+                                   char* __a, char*& __a_end,
+                                   _CharT __decimal_point, _CharT __thousands_sep,
+                                   const string& __grouping, unsigned* __g,
+                                   unsigned*& __g_end, unsigned& __dc, _CharT* __atoms);
+};
+
+template <class _CharT>
+string
+__num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep)
+{
+    locale __loc = __iob.getloc();
+    use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms);
+    const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
+    __thousands_sep = __np.thousands_sep();
+    return __np.grouping();
+}
+
+template <class _CharT>
+string
+__num_get<_CharT>::__stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point,
+                    _CharT& __thousands_sep)
+{
+    locale __loc = __iob.getloc();
+    use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms);
+    const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
+    __decimal_point = __np.decimal_point();
+    __thousands_sep = __np.thousands_sep();
+    return __np.grouping();
+}
+
+template <class _CharT>
+int
+__num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
+                  unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
+                  unsigned* __g, unsigned*& __g_end, _CharT* __atoms)
+{
+    if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
+    {
+        *__a_end++ = __ct == __atoms[24] ? '+' : '-';
+        __dc = 0;
+        return 0;
+    }
+    if (__grouping.size() != 0 && __ct == __thousands_sep)
+    {
+        if (__g_end-__g < __num_get_buf_sz)
+        {
+            *__g_end++ = __dc;
+            __dc = 0;
+        }
+        return 0;
+    }
+    ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms;
+    if (__f >= 24)
+        return -1;
+    switch (__base)
+    {
+    case 8:
+    case 10:
+        if (__f >= __base)
+            return -1;
+        break;
+    case 16:
+        if (__f < 22)
+            break;
+        if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
+        {
+            __dc = 0;
+            *__a_end++ = __src[__f];
+            return 0;
+        }
+        return -1;
+    }
+    *__a_end++ = __src[__f];
+    ++__dc;
+    return 0;
+}
+
+template <class _CharT>
+int
+__num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp, char* __a, char*& __a_end,
+                    _CharT __decimal_point, _CharT __thousands_sep, const string& __grouping,
+                    unsigned* __g, unsigned*& __g_end, unsigned& __dc, _CharT* __atoms)
+{
+    if (__ct == __decimal_point)
+    {
+        if (!__in_units)
+            return -1;
+        __in_units = false;
+        *__a_end++ = '.';
+        if (__grouping.size() != 0 && __g_end-__g < __num_get_buf_sz)
+            *__g_end++ = __dc;
+        return 0;
+    }
+    if (__ct == __thousands_sep && __grouping.size() != 0)
+    {
+        if (!__in_units)
+            return -1;
+        if (__g_end-__g < __num_get_buf_sz)
+        {
+            *__g_end++ = __dc;
+            __dc = 0;
+        }
+        return 0;
+    }
+    ptrdiff_t __f = find(__atoms, __atoms + 32, __ct) - __atoms;
+    if (__f >= 32)
+        return -1;
+    char __x = __src[__f];
+    if (__x == '-' || __x == '+')
+    {
+        if (__a_end == __a || (__a_end[-1] & 0x5F) == (__exp & 0x7F))
+        {
+            *__a_end++ = __x;
+            return 0;
+        }
+        return -1;
+    }
+    if (__x == 'x' || __x == 'X')
+        __exp = 'P';
+    else if ((__x & 0x5F) == __exp)
+    {
+        __exp |= 0x80;
+        if (__in_units)
+        {
+            __in_units = false;
+            if (__grouping.size() != 0 && __g_end-__g < __num_get_buf_sz)
+                *__g_end++ = __dc;
+        }
+    }
+    *__a_end++ = __x;
+    if (__f >= 22)
+        return 0;
+    ++__dc;
+    return 0;
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_TYPE_VIS __num_get<char>)
+_LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_TYPE_VIS __num_get<wchar_t>)
+
+template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY num_get
+    : public locale::facet,
+      private __num_get<_CharT>
+{
+public:
+    typedef _CharT char_type;
+    typedef _InputIterator iter_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit num_get(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, bool& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, long& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, long long& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, unsigned short& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, unsigned int& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, unsigned long& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, unsigned long long& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, float& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, double& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, long double& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, void*& __v) const
+    {
+        return do_get(__b, __e, __iob, __err, __v);
+    }
+
+    static locale::id id;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    ~num_get() {}
+
+    template <class _Fp>
+    iter_type __do_get_floating_point
+                            (iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, _Fp& __v) const;
+
+    template <class _Signed>
+    iter_type __do_get_signed
+                            (iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, _Signed& __v) const;
+
+    template <class _Unsigned>
+    iter_type __do_get_unsigned
+                            (iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, _Unsigned& __v) const;
+
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, bool& __v) const;
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, long& __v) const
+    { return this->__do_get_signed ( __b, __e, __iob, __err, __v ); }
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, long long& __v) const
+    { return this->__do_get_signed ( __b, __e, __iob, __err, __v ); }
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, unsigned short& __v) const
+    { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, unsigned int& __v) const
+    { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, unsigned long& __v) const
+    { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, unsigned long long& __v) const
+    { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, float& __v) const
+    { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); }
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, double& __v) const
+    { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); }
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, long double& __v) const
+    { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); }
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, void*& __v) const;
+};
+
+template <class _CharT, class _InputIterator>
+locale::id
+num_get<_CharT, _InputIterator>::id;
+
+template <class _Tp>
+_Tp
+__num_get_signed_integral(const char* __a, const char* __a_end,
+                          ios_base::iostate& __err, int __base)
+{
+    if (__a != __a_end)
+    {
+        typename remove_reference<decltype(errno)>::type __save_errno = errno;
+        errno = 0;
+        char *__p2;
+        long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+        typename remove_reference<decltype(errno)>::type __current_errno = errno;
+        if (__current_errno == 0)
+            errno = __save_errno;
+        if (__p2 != __a_end)
+        {
+            __err = ios_base::failbit;
+            return 0;
+        }
+        else if (__current_errno == ERANGE         ||
+                 __ll < numeric_limits<_Tp>::min() ||
+                 numeric_limits<_Tp>::max() < __ll)
+        {
+            __err = ios_base::failbit;
+            if (__ll > 0)
+                return numeric_limits<_Tp>::max();
+            else
+                return numeric_limits<_Tp>::min();
+        }
+        return static_cast<_Tp>(__ll);
+    }
+    __err = ios_base::failbit;
+    return 0;
+}
+
+template <class _Tp>
+_Tp
+__num_get_unsigned_integral(const char* __a, const char* __a_end,
+                            ios_base::iostate& __err, int __base)
+{
+    if (__a != __a_end)
+    {
+        if (*__a == '-')
+        {
+            __err = ios_base::failbit;
+            return 0;
+        }
+        typename remove_reference<decltype(errno)>::type __save_errno = errno;
+        errno = 0;
+        char *__p2;
+        unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+        typename remove_reference<decltype(errno)>::type __current_errno = errno;
+        if (__current_errno == 0)
+            errno = __save_errno;
+        if (__p2 != __a_end)
+        {
+            __err = ios_base::failbit;
+            return 0;
+        }
+        else if (__current_errno == ERANGE ||
+                 numeric_limits<_Tp>::max() < __ll)
+        {
+            __err = ios_base::failbit;
+            return numeric_limits<_Tp>::max();
+        }
+        return static_cast<_Tp>(__ll);
+    }
+    __err = ios_base::failbit;
+    return 0;
+}
+
+template <class _Tp>
+_Tp
+__num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
+{
+    if (__a != __a_end)
+    {
+        typename remove_reference<decltype(errno)>::type __save_errno = errno;
+        errno = 0;
+        char *__p2;
+        long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE);
+        typename remove_reference<decltype(errno)>::type __current_errno = errno;
+        if (__current_errno == 0)
+            errno = __save_errno;
+        if (__p2 != __a_end)
+        {
+            __err = ios_base::failbit;
+            return 0;
+        }
+        else if (__current_errno == ERANGE)
+            __err = ios_base::failbit;
+        return static_cast<_Tp>(__ld);
+    }
+    __err = ios_base::failbit;
+    return 0;
+}
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
+                                        ios_base& __iob,
+                                        ios_base::iostate& __err,
+                                        bool& __v) const
+{
+    if ((__iob.flags() & ios_base::boolalpha) == 0)
+    {
+        long __lv = -1;
+        __b = do_get(__b, __e, __iob, __err, __lv);
+        switch (__lv)
+        {
+        case 0:
+            __v = false;
+            break;
+        case 1:
+            __v = true;
+            break;
+        default:
+            __v = true;
+            __err = ios_base::failbit;
+            break;
+        }
+        return __b;
+    }
+    const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__iob.getloc());
+    const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__iob.getloc());
+    typedef typename numpunct<_CharT>::string_type string_type;
+    const string_type __names[2] = {__np.truename(), __np.falsename()};
+    const string_type* __i = __scan_keyword(__b, __e, __names, __names+2,
+                                            __ct, __err);
+    __v = __i == __names;
+    return __b;
+}
+
+// signed
+
+template <class _CharT, class _InputIterator>
+template <class _Signed>
+_InputIterator
+num_get<_CharT, _InputIterator>::__do_get_signed(iter_type __b, iter_type __e,
+                                        ios_base& __iob,
+                                        ios_base::iostate& __err,
+                                        _Signed& __v) const
+{
+    // Stage 1
+    int __base = this->__get_base(__iob);
+    // Stage 2
+    char_type __atoms[26];
+    char_type __thousands_sep;
+    string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
+    string __buf;
+    __buf.resize(__buf.capacity());
+    char* __a = &__buf[0];
+    char* __a_end = __a;
+    unsigned __g[__num_get_base::__num_get_buf_sz];
+    unsigned* __g_end = __g;
+    unsigned __dc = 0;
+    for (; __b != __e; ++__b)
+    {
+        if (__a_end == __a + __buf.size())
+        {
+            size_t __tmp = __buf.size();
+            __buf.resize(2*__buf.size());
+            __buf.resize(__buf.capacity());
+            __a = &__buf[0];
+            __a_end = __a + __tmp;
+        }
+        if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
+                                    __thousands_sep, __grouping, __g, __g_end,
+                                    __atoms))
+            break;
+    }
+    if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz)
+        *__g_end++ = __dc;
+    // Stage 3
+    __v = __num_get_signed_integral<_Signed>(__a, __a_end, __err, __base);
+    // Digit grouping checked
+    __check_grouping(__grouping, __g, __g_end, __err);
+    // EOF checked
+    if (__b == __e)
+        __err |= ios_base::eofbit;
+    return __b;
+}
+
+// unsigned
+
+template <class _CharT, class _InputIterator>
+template <class _Unsigned>
+_InputIterator
+num_get<_CharT, _InputIterator>::__do_get_unsigned(iter_type __b, iter_type __e,
+                                        ios_base& __iob,
+                                        ios_base::iostate& __err,
+                                        _Unsigned& __v) const
+{
+    // Stage 1
+    int __base = this->__get_base(__iob);
+    // Stage 2
+    char_type __atoms[26];
+    char_type __thousands_sep;
+    string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
+    string __buf;
+    __buf.resize(__buf.capacity());
+    char* __a = &__buf[0];
+    char* __a_end = __a;
+    unsigned __g[__num_get_base::__num_get_buf_sz];
+    unsigned* __g_end = __g;
+    unsigned __dc = 0;
+    for (; __b != __e; ++__b)
+    {
+        if (__a_end == __a + __buf.size())
+        {
+            size_t __tmp = __buf.size();
+            __buf.resize(2*__buf.size());
+            __buf.resize(__buf.capacity());
+            __a = &__buf[0];
+            __a_end = __a + __tmp;
+        }
+        if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
+                                    __thousands_sep, __grouping, __g, __g_end,
+                                    __atoms))
+            break;
+    }
+    if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz)
+        *__g_end++ = __dc;
+    // Stage 3
+    __v = __num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base);
+    // Digit grouping checked
+    __check_grouping(__grouping, __g, __g_end, __err);
+    // EOF checked
+    if (__b == __e)
+        __err |= ios_base::eofbit;
+    return __b;
+}
+
+// floating point
+
+template <class _CharT, class _InputIterator>
+template <class _Fp>
+_InputIterator
+num_get<_CharT, _InputIterator>::__do_get_floating_point(iter_type __b, iter_type __e,
+                                        ios_base& __iob,
+                                        ios_base::iostate& __err,
+                                        _Fp& __v) const
+{
+    // Stage 1, nothing to do
+    // Stage 2
+    char_type __atoms[32];
+    char_type __decimal_point;
+    char_type __thousands_sep;
+    string __grouping = this->__stage2_float_prep(__iob, __atoms,
+                                                  __decimal_point,
+                                                  __thousands_sep);
+    string __buf;
+    __buf.resize(__buf.capacity());
+    char* __a = &__buf[0];
+    char* __a_end = __a;
+    unsigned __g[__num_get_base::__num_get_buf_sz];
+    unsigned* __g_end = __g;
+    unsigned __dc = 0;
+    bool __in_units = true;
+    char __exp = 'E';
+    for (; __b != __e; ++__b)
+    {
+        if (__a_end == __a + __buf.size())
+        {
+            size_t __tmp = __buf.size();
+            __buf.resize(2*__buf.size());
+            __buf.resize(__buf.capacity());
+            __a = &__buf[0];
+            __a_end = __a + __tmp;
+        }
+        if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end,
+                                      __decimal_point, __thousands_sep,
+                                      __grouping, __g, __g_end,
+                                      __dc, __atoms))
+            break;
+    }
+    if (__grouping.size() != 0 && __in_units && __g_end-__g < __num_get_base::__num_get_buf_sz)
+        *__g_end++ = __dc;
+    // Stage 3
+    __v = __num_get_float<_Fp>(__a, __a_end, __err);
+    // Digit grouping checked
+    __check_grouping(__grouping, __g, __g_end, __err);
+    // EOF checked
+    if (__b == __e)
+        __err |= ios_base::eofbit;
+    return __b;
+}
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
+                                        ios_base& __iob,
+                                        ios_base::iostate& __err,
+                                        void*& __v) const
+{
+    // Stage 1
+    int __base = 16;
+    // Stage 2
+    char_type __atoms[26];
+    char_type __thousands_sep = 0;
+    string __grouping;
+    use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src,
+                                                    __num_get_base::__src + 26, __atoms);
+    string __buf;
+    __buf.resize(__buf.capacity());
+    char* __a = &__buf[0];
+    char* __a_end = __a;
+    unsigned __g[__num_get_base::__num_get_buf_sz];
+    unsigned* __g_end = __g;
+    unsigned __dc = 0;
+    for (; __b != __e; ++__b)
+    {
+        if (__a_end == __a + __buf.size())
+        {
+            size_t __tmp = __buf.size();
+            __buf.resize(2*__buf.size());
+            __buf.resize(__buf.capacity());
+            __a = &__buf[0];
+            __a_end = __a + __tmp;
+        }
+        if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
+                                    __thousands_sep, __grouping,
+                                    __g, __g_end, __atoms))
+            break;
+    }
+    // Stage 3
+    __buf.resize(__a_end - __a);
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+    if (sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
+#else
+    if (__sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
+#endif
+        __err = ios_base::failbit;
+    // EOF checked
+    if (__b == __e)
+        __err |= ios_base::eofbit;
+    return __b;
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS num_get<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS num_get<wchar_t>)
+
+struct _LIBCPP_TYPE_VIS __num_put_base
+{
+protected:
+    static void __format_int(char* __fmt, const char* __len, bool __signd,
+                             ios_base::fmtflags __flags);
+    static bool __format_float(char* __fmt, const char* __len,
+                               ios_base::fmtflags __flags);
+    static char* __identify_padding(char* __nb, char* __ne,
+                                    const ios_base& __iob);
+};
+
+template <class _CharT>
+struct __num_put
+    : protected __num_put_base
+{
+    static void __widen_and_group_int(char* __nb, char* __np, char* __ne,
+                                      _CharT* __ob, _CharT*& __op, _CharT*& __oe,
+                                      const locale& __loc);
+    static void __widen_and_group_float(char* __nb, char* __np, char* __ne,
+                                        _CharT* __ob, _CharT*& __op, _CharT*& __oe,
+                                        const locale& __loc);
+};
+
+template <class _CharT>
+void
+__num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne,
+                                         _CharT* __ob, _CharT*& __op, _CharT*& __oe,
+                                         const locale& __loc)
+{
+    const ctype<_CharT>&    __ct = use_facet<ctype<_CharT> >   (__loc);
+    const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc);
+    string __grouping = __npt.grouping();
+    if (__grouping.empty())
+    {
+        __ct.widen(__nb, __ne, __ob);
+        __oe = __ob + (__ne - __nb);
+    }
+    else
+    {
+        __oe = __ob;
+        char* __nf = __nb;
+        if (*__nf == '-' || *__nf == '+')
+            *__oe++ = __ct.widen(*__nf++);
+        if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' ||
+                                                   __nf[1] == 'X'))
+        {
+            *__oe++ = __ct.widen(*__nf++);
+            *__oe++ = __ct.widen(*__nf++);
+        }
+        reverse(__nf, __ne);
+        _CharT __thousands_sep = __npt.thousands_sep();
+        unsigned __dc = 0;
+        unsigned __dg = 0;
+        for (char* __p = __nf; __p < __ne; ++__p)
+        {
+            if (static_cast<unsigned>(__grouping[__dg]) > 0 &&
+                __dc == static_cast<unsigned>(__grouping[__dg]))
+            {
+                *__oe++ = __thousands_sep;
+                __dc = 0;
+                if (__dg < __grouping.size()-1)
+                    ++__dg;
+            }
+            *__oe++ = __ct.widen(*__p);
+            ++__dc;
+        }
+        reverse(__ob + (__nf - __nb), __oe);
+    }
+    if (__np == __ne)
+        __op = __oe;
+    else
+        __op = __ob + (__np - __nb);
+}
+
+template <class _CharT>
+void
+__num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
+                                           _CharT* __ob, _CharT*& __op, _CharT*& __oe,
+                                           const locale& __loc)
+{
+    const ctype<_CharT>&    __ct = use_facet<ctype<_CharT> >   (__loc);
+    const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc);
+    string __grouping = __npt.grouping();
+    __oe = __ob;
+    char* __nf = __nb;
+    if (*__nf == '-' || *__nf == '+')
+        *__oe++ = __ct.widen(*__nf++);
+    char* __ns;
+    if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' ||
+                                               __nf[1] == 'X'))
+    {
+        *__oe++ = __ct.widen(*__nf++);
+        *__oe++ = __ct.widen(*__nf++);
+        for (__ns = __nf; __ns < __ne; ++__ns)
+            if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
+                break;
+    }
+    else
+    {
+        for (__ns = __nf; __ns < __ne; ++__ns)
+            if (!isdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
+                break;
+    }
+    if (__grouping.empty())
+    {
+        __ct.widen(__nf, __ns, __oe);
+        __oe += __ns - __nf;
+    }
+    else
+    {
+        reverse(__nf, __ns);
+        _CharT __thousands_sep = __npt.thousands_sep();
+        unsigned __dc = 0;
+        unsigned __dg = 0;
+        for (char* __p = __nf; __p < __ns; ++__p)
+        {
+            if (__grouping[__dg] > 0 && __dc == static_cast<unsigned>(__grouping[__dg]))
+            {
+                *__oe++ = __thousands_sep;
+                __dc = 0;
+                if (__dg < __grouping.size()-1)
+                    ++__dg;
+            }
+            *__oe++ = __ct.widen(*__p);
+            ++__dc;
+        }
+        reverse(__ob + (__nf - __nb), __oe);
+    }
+    for (__nf = __ns; __nf < __ne; ++__nf)
+    {
+        if (*__nf == '.')
+        {
+            *__oe++ = __npt.decimal_point();
+            ++__nf;
+            break;
+        }
+        else
+            *__oe++ = __ct.widen(*__nf);
+    }
+    __ct.widen(__nf, __ne, __oe);
+    __oe += __ne - __nf;
+    if (__np == __ne)
+        __op = __oe;
+    else
+        __op = __ob + (__np - __nb);
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_TYPE_VIS __num_put<char>)
+_LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_TYPE_VIS __num_put<wchar_t>)
+
+template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY num_put
+    : public locale::facet,
+      private __num_put<_CharT>
+{
+public:
+    typedef _CharT char_type;
+    typedef _OutputIterator iter_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit num_put(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
+                  bool __v) const
+    {
+        return do_put(__s, __iob, __fl, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
+                  long __v) const
+    {
+        return do_put(__s, __iob, __fl, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
+                  long long __v) const
+    {
+        return do_put(__s, __iob, __fl, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
+                  unsigned long __v) const
+    {
+        return do_put(__s, __iob, __fl, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
+                  unsigned long long __v) const
+    {
+        return do_put(__s, __iob, __fl, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
+                  double __v) const
+    {
+        return do_put(__s, __iob, __fl, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
+                  long double __v) const
+    {
+        return do_put(__s, __iob, __fl, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
+                  const void* __v) const
+    {
+        return do_put(__s, __iob, __fl, __v);
+    }
+
+    static locale::id id;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    ~num_put() {}
+
+    virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
+                             bool __v) const;
+    virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
+                             long __v) const;
+    virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
+                             long long __v) const;
+    virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
+                             unsigned long) const;
+    virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
+                             unsigned long long) const;
+    virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
+                             double __v) const;
+    virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
+                             long double __v) const;
+    virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
+                             const void* __v) const;
+};
+
+template <class _CharT, class _OutputIterator>
+locale::id
+num_put<_CharT, _OutputIterator>::id;
+
+template <class _CharT, class _OutputIterator>
+_LIBCPP_HIDDEN
+_OutputIterator
+__pad_and_output(_OutputIterator __s,
+                 const _CharT* __ob, const _CharT* __op, const _CharT* __oe,
+                 ios_base& __iob, _CharT __fl)
+{
+    streamsize __sz = __oe - __ob;
+    streamsize __ns = __iob.width();
+    if (__ns > __sz)
+        __ns -= __sz;
+    else
+        __ns = 0;
+    for (;__ob < __op; ++__ob, ++__s)
+        *__s = *__ob;
+    for (; __ns; --__ns, ++__s)
+        *__s = __fl;
+    for (; __ob < __oe; ++__ob, ++__s)
+        *__s = *__ob;
+    __iob.width(0);
+    return __s;
+}
+
+#if !defined(__APPLE__) || \
+    (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
+    (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDDEN
+ostreambuf_iterator<_CharT, _Traits>
+__pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s,
+                 const _CharT* __ob, const _CharT* __op, const _CharT* __oe,
+                 ios_base& __iob, _CharT __fl)
+{
+    if (__s.__sbuf_ == nullptr)
+        return __s;
+    streamsize __sz = __oe - __ob;
+    streamsize __ns = __iob.width();
+    if (__ns > __sz)
+        __ns -= __sz;
+    else
+        __ns = 0;
+    streamsize __np = __op - __ob;
+    if (__np > 0)
+    {
+        if (__s.__sbuf_->sputn(__ob, __np) != __np)
+        {
+            __s.__sbuf_ = nullptr;
+            return __s;
+        }
+    }
+    if (__ns > 0)
+    {
+        basic_string<_CharT, _Traits> __sp(__ns, __fl);
+        if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns)
+        {
+            __s.__sbuf_ = nullptr;
+            return __s;
+        }
+    }
+    __np = __oe - __op;
+    if (__np > 0)
+    {
+        if (__s.__sbuf_->sputn(__op, __np) != __np)
+        {
+            __s.__sbuf_ = nullptr;
+            return __s;
+        }
+    }
+    __iob.width(0);
+    return __s;
+}
+
+#endif
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+                                         char_type __fl, bool __v) const
+{
+    if ((__iob.flags() & ios_base::boolalpha) == 0)
+        return do_put(__s, __iob, __fl, (unsigned long)__v);
+    const numpunct<char_type>& __np = use_facet<numpunct<char_type> >(__iob.getloc());
+    typedef typename numpunct<char_type>::string_type string_type;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    string_type __tmp(__v ? __np.truename() : __np.falsename());
+    string_type __nm = _VSTD::move(__tmp);
+#else
+    string_type __nm = __v ? __np.truename() : __np.falsename();
+#endif
+    for (typename string_type::iterator __i = __nm.begin(); __i != __nm.end(); ++__i, ++__s)
+        *__s = *__i;
+    return __s;
+}
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+                                         char_type __fl, long __v) const
+{
+    // Stage 1 - Get number in narrow char
+    char __fmt[6] = {'%', 0};
+    const char* __len = "l";
+    this->__format_int(__fmt+1, __len, true, __iob.flags());
+    const unsigned __nbuf = (numeric_limits<long>::digits / 3)
+                          + ((numeric_limits<long>::digits % 3) != 0)
+                          + 1;
+    char __nar[__nbuf];
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+    int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#else
+    int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#endif
+    char* __ne = __nar + __nc;
+    char* __np = this->__identify_padding(__nar, __ne, __iob);
+    // Stage 2 - Widen __nar while adding thousands separators
+    char_type __o[2*(__nbuf-1) - 1];
+    char_type* __op;  // pad here
+    char_type* __oe;  // end of output
+    this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc());
+    // [__o, __oe) contains thousands_sep'd wide number
+    // Stage 3 & 4
+    return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+}
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+                                         char_type __fl, long long __v) const
+{
+    // Stage 1 - Get number in narrow char
+    char __fmt[8] = {'%', 0};
+    const char* __len = "ll";
+    this->__format_int(__fmt+1, __len, true, __iob.flags());
+    const unsigned __nbuf = (numeric_limits<long long>::digits / 3)
+                          + ((numeric_limits<long long>::digits % 3) != 0)
+                          + 2;
+    char __nar[__nbuf];
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+    int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#else
+    int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#endif
+    char* __ne = __nar + __nc;
+    char* __np = this->__identify_padding(__nar, __ne, __iob);
+    // Stage 2 - Widen __nar while adding thousands separators
+    char_type __o[2*(__nbuf-1) - 1];
+    char_type* __op;  // pad here
+    char_type* __oe;  // end of output
+    this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc());
+    // [__o, __oe) contains thousands_sep'd wide number
+    // Stage 3 & 4
+    return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+}
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+                                         char_type __fl, unsigned long __v) const
+{
+    // Stage 1 - Get number in narrow char
+    char __fmt[6] = {'%', 0};
+    const char* __len = "l";
+    this->__format_int(__fmt+1, __len, false, __iob.flags());
+    const unsigned __nbuf = (numeric_limits<unsigned long>::digits / 3)
+                          + ((numeric_limits<unsigned long>::digits % 3) != 0)
+                          + 1;
+    char __nar[__nbuf];
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+    int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#else
+    int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#endif
+    char* __ne = __nar + __nc;
+    char* __np = this->__identify_padding(__nar, __ne, __iob);
+    // Stage 2 - Widen __nar while adding thousands separators
+    char_type __o[2*(__nbuf-1) - 1];
+    char_type* __op;  // pad here
+    char_type* __oe;  // end of output
+    this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc());
+    // [__o, __oe) contains thousands_sep'd wide number
+    // Stage 3 & 4
+    return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+}
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+                                         char_type __fl, unsigned long long __v) const
+{
+    // Stage 1 - Get number in narrow char
+    char __fmt[8] = {'%', 0};
+    const char* __len = "ll";
+    this->__format_int(__fmt+1, __len, false, __iob.flags());
+    const unsigned __nbuf = (numeric_limits<unsigned long long>::digits / 3)
+                          + ((numeric_limits<unsigned long long>::digits % 3) != 0)
+                          + 1;
+    char __nar[__nbuf];
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+    int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#else
+    int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#endif
+    char* __ne = __nar + __nc;
+    char* __np = this->__identify_padding(__nar, __ne, __iob);
+    // Stage 2 - Widen __nar while adding thousands separators
+    char_type __o[2*(__nbuf-1) - 1];
+    char_type* __op;  // pad here
+    char_type* __oe;  // end of output
+    this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc());
+    // [__o, __oe) contains thousands_sep'd wide number
+    // Stage 3 & 4
+    return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+}
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+                                         char_type __fl, double __v) const
+{
+    // Stage 1 - Get number in narrow char
+    char __fmt[8] = {'%', 0};
+    const char* __len = "";
+    bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags());
+    const unsigned __nbuf = 30;
+    char __nar[__nbuf];
+    char* __nb = __nar;
+    int __nc;
+    if (__specify_precision)
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+        __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
+                                   (int)__iob.precision(), __v);
+#else
+        __nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
+                                   (int)__iob.precision(), __v);
+#endif
+    else
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+        __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#else
+        __nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#endif
+    unique_ptr<char, void(*)(void*)> __nbh(0, free);
+    if (__nc > static_cast<int>(__nbuf-1))
+    {
+        if (__specify_precision)
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+            __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
+#else
+            __nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
+#endif
+        else
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+            __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#else
+            __nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
+#endif
+        if (__nb == 0)
+            __throw_bad_alloc();
+        __nbh.reset(__nb);
+    }
+    char* __ne = __nb + __nc;
+    char* __np = this->__identify_padding(__nb, __ne, __iob);
+    // Stage 2 - Widen __nar while adding thousands separators
+    char_type __o[2*(__nbuf-1) - 1];
+    char_type* __ob = __o;
+    unique_ptr<char_type, void(*)(void*)> __obh(0, free);
+    if (__nb != __nar)
+    {
+        __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
+        if (__ob == 0)
+            __throw_bad_alloc();
+        __obh.reset(__ob);
+    }
+    char_type* __op;  // pad here
+    char_type* __oe;  // end of output
+    this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc());
+    // [__o, __oe) contains thousands_sep'd wide number
+    // Stage 3 & 4
+    __s = __pad_and_output(__s, __ob, __op, __oe, __iob, __fl);
+    return __s;
+}
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+                                         char_type __fl, long double __v) const
+{
+    // Stage 1 - Get number in narrow char
+    char __fmt[8] = {'%', 0};
+    const char* __len = "L";
+    bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags());
+    const unsigned __nbuf = 30;
+    char __nar[__nbuf];
+    char* __nb = __nar;
+    int __nc;
+    if (__specify_precision)
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+        __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
+                                   (int)__iob.precision(), __v);
+#else
+        __nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
+                                   (int)__iob.precision(), __v);
+#endif
+    else
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+        __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#else
+        __nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#endif
+    unique_ptr<char, void(*)(void*)> __nbh(0, free);
+    if (__nc > static_cast<int>(__nbuf-1))
+    {
+        if (__specify_precision)
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+            __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
+#else
+            __nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
+#endif
+        else
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+            __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#else
+            __nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#endif
+        if (__nb == 0)
+            __throw_bad_alloc();
+        __nbh.reset(__nb);
+    }
+    char* __ne = __nb + __nc;
+    char* __np = this->__identify_padding(__nb, __ne, __iob);
+    // Stage 2 - Widen __nar while adding thousands separators
+    char_type __o[2*(__nbuf-1) - 1];
+    char_type* __ob = __o;
+    unique_ptr<char_type, void(*)(void*)> __obh(0, free);
+    if (__nb != __nar)
+    {
+        __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
+        if (__ob == 0)
+            __throw_bad_alloc();
+        __obh.reset(__ob);
+    }
+    char_type* __op;  // pad here
+    char_type* __oe;  // end of output
+    this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc());
+    // [__o, __oe) contains thousands_sep'd wide number
+    // Stage 3 & 4
+    __s = __pad_and_output(__s, __ob, __op, __oe, __iob, __fl);
+    return __s;
+}
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+                                         char_type __fl, const void* __v) const
+{
+    // Stage 1 - Get pointer in narrow char
+    char __fmt[6] = "%p";
+    const unsigned __nbuf = 20;
+    char __nar[__nbuf];
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+    int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#else
+    int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+#endif
+    char* __ne = __nar + __nc;
+    char* __np = this->__identify_padding(__nar, __ne, __iob);
+    // Stage 2 - Widen __nar
+    char_type __o[2*(__nbuf-1) - 1];
+    char_type* __op;  // pad here
+    char_type* __oe;  // end of output
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+    __ct.widen(__nar, __ne, __o);
+    __oe = __o + (__ne - __nar);
+    if (__np == __ne)
+        __op = __oe;
+    else
+        __op = __o + (__np - __nar);
+    // [__o, __oe) contains wide number
+    // Stage 3 & 4
+    return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS num_put<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS num_put<wchar_t>)
+
+template <class _CharT, class _InputIterator>
+_LIBCPP_HIDDEN
+int
+__get_up_to_n_digits(_InputIterator& __b, _InputIterator __e,
+                     ios_base::iostate& __err, const ctype<_CharT>& __ct, int __n)
+{
+    // Precondition:  __n >= 1
+    if (__b == __e)
+    {
+        __err |= ios_base::eofbit | ios_base::failbit;
+        return 0;
+    }
+    // get first digit
+    _CharT __c = *__b;
+    if (!__ct.is(ctype_base::digit, __c))
+    {
+        __err |= ios_base::failbit;
+        return 0;
+    }
+    int __r = __ct.narrow(__c, 0) - '0';
+    for (++__b, (void) --__n; __b != __e && __n > 0; ++__b, (void) --__n)
+    {
+        // get next digit
+        __c = *__b;
+        if (!__ct.is(ctype_base::digit, __c))
+            return __r;
+        __r = __r * 10 + __ct.narrow(__c, 0) - '0';
+    }
+    if (__b == __e)
+        __err |= ios_base::eofbit;
+    return __r;
+}
+
+class _LIBCPP_TYPE_VIS time_base
+{
+public:
+    enum dateorder {no_order, dmy, mdy, ymd, ydm};
+};
+
+template <class _CharT>
+class _LIBCPP_TYPE_VIS_ONLY __time_get_c_storage
+{
+protected:
+    typedef basic_string<_CharT> string_type;
+
+    virtual const string_type* __weeks() const;
+    virtual const string_type* __months() const;
+    virtual const string_type* __am_pm() const;
+    virtual const string_type& __c() const;
+    virtual const string_type& __r() const;
+    virtual const string_type& __x() const;
+    virtual const string_type& __X() const;
+
+    _LIBCPP_ALWAYS_INLINE
+    ~__time_get_c_storage() {}
+};
+
+template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY time_get
+    : public locale::facet,
+      public time_base,
+      private __time_get_c_storage<_CharT>
+{
+public:
+    typedef _CharT                  char_type;
+    typedef _InputIterator          iter_type;
+    typedef time_base::dateorder    dateorder;
+    typedef basic_string<char_type> string_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit time_get(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    dateorder date_order() const
+    {
+        return this->do_date_order();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get_time(iter_type __b, iter_type __e, ios_base& __iob,
+                       ios_base::iostate& __err, tm* __tm) const
+    {
+        return do_get_time(__b, __e, __iob, __err, __tm);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get_date(iter_type __b, iter_type __e, ios_base& __iob,
+                       ios_base::iostate& __err, tm* __tm) const
+    {
+        return do_get_date(__b, __e, __iob, __err, __tm);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get_weekday(iter_type __b, iter_type __e, ios_base& __iob,
+                          ios_base::iostate& __err, tm* __tm) const
+    {
+        return do_get_weekday(__b, __e, __iob, __err, __tm);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get_monthname(iter_type __b, iter_type __e, ios_base& __iob,
+                            ios_base::iostate& __err, tm* __tm) const
+    {
+        return do_get_monthname(__b, __e, __iob, __err, __tm);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get_year(iter_type __b, iter_type __e, ios_base& __iob,
+                       ios_base::iostate& __err, tm* __tm) const
+    {
+        return do_get_year(__b, __e, __iob, __err, __tm);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, tm *__tm,
+                  char __fmt, char __mod = 0) const
+    {
+        return do_get(__b, __e, __iob, __err, __tm, __fmt, __mod);
+    }
+
+    iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
+                  ios_base::iostate& __err, tm* __tm,
+                  const char_type* __fmtb, const char_type* __fmte) const;
+
+    static locale::id id;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    ~time_get() {}
+
+    virtual dateorder do_date_order() const;
+    virtual iter_type do_get_time(iter_type __b, iter_type __e, ios_base& __iob,
+                                  ios_base::iostate& __err, tm* __tm) const;
+    virtual iter_type do_get_date(iter_type __b, iter_type __e, ios_base& __iob,
+                                  ios_base::iostate& __err, tm* __tm) const;
+    virtual iter_type do_get_weekday(iter_type __b, iter_type __e, ios_base& __iob,
+                                     ios_base::iostate& __err, tm* __tm) const;
+    virtual iter_type do_get_monthname(iter_type __b, iter_type __e, ios_base& __iob,
+                                       ios_base::iostate& __err, tm* __tm) const;
+    virtual iter_type do_get_year(iter_type __b, iter_type __e, ios_base& __iob,
+                                  ios_base::iostate& __err, tm* __tm) const;
+    virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
+                             ios_base::iostate& __err, tm* __tm,
+                             char __fmt, char __mod) const;
+private:
+    void __get_white_space(iter_type& __b, iter_type __e,
+                           ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+    void __get_percent(iter_type& __b, iter_type __e, ios_base::iostate& __err,
+                       const ctype<char_type>& __ct) const;
+
+    void __get_weekdayname(int& __m,
+                           iter_type& __b, iter_type __e,
+                           ios_base::iostate& __err,
+                           const ctype<char_type>& __ct) const;
+    void __get_monthname(int& __m,
+                         iter_type& __b, iter_type __e,
+                         ios_base::iostate& __err,
+                         const ctype<char_type>& __ct) const;
+    void __get_day(int& __d,
+                   iter_type& __b, iter_type __e,
+                   ios_base::iostate& __err,
+                   const ctype<char_type>& __ct) const;
+    void __get_month(int& __m,
+                     iter_type& __b, iter_type __e,
+                     ios_base::iostate& __err,
+                     const ctype<char_type>& __ct) const;
+    void __get_year(int& __y,
+                   iter_type& __b, iter_type __e,
+                   ios_base::iostate& __err,
+                   const ctype<char_type>& __ct) const;
+    void __get_year4(int& __y,
+                    iter_type& __b, iter_type __e,
+                    ios_base::iostate& __err,
+                    const ctype<char_type>& __ct) const;
+    void __get_hour(int& __d,
+                    iter_type& __b, iter_type __e,
+                    ios_base::iostate& __err,
+                    const ctype<char_type>& __ct) const;
+    void __get_12_hour(int& __h,
+                       iter_type& __b, iter_type __e,
+                       ios_base::iostate& __err,
+                       const ctype<char_type>& __ct) const;
+    void __get_am_pm(int& __h,
+                     iter_type& __b, iter_type __e,
+                     ios_base::iostate& __err,
+                     const ctype<char_type>& __ct) const;
+    void __get_minute(int& __m,
+                      iter_type& __b, iter_type __e,
+                      ios_base::iostate& __err,
+                      const ctype<char_type>& __ct) const;
+    void __get_second(int& __s,
+                      iter_type& __b, iter_type __e,
+                      ios_base::iostate& __err,
+                      const ctype<char_type>& __ct) const;
+    void __get_weekday(int& __w,
+                       iter_type& __b, iter_type __e,
+                       ios_base::iostate& __err,
+                       const ctype<char_type>& __ct) const;
+    void __get_day_year_num(int& __w,
+                            iter_type& __b, iter_type __e,
+                            ios_base::iostate& __err,
+                            const ctype<char_type>& __ct) const;
+};
+
+template <class _CharT, class _InputIterator>
+locale::id
+time_get<_CharT, _InputIterator>::id;
+
+// time_get primitives
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w,
+                                                    iter_type& __b, iter_type __e,
+                                                    ios_base::iostate& __err,
+                                                    const ctype<char_type>& __ct) const
+{
+    // Note:  ignoring case comes from the POSIX strptime spec
+    const string_type* __wk = this->__weeks();
+    ptrdiff_t __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk;
+    if (__i < 14)
+        __w = __i % 7;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_monthname(int& __m,
+                                                  iter_type& __b, iter_type __e,
+                                                  ios_base::iostate& __err,
+                                                  const ctype<char_type>& __ct) const
+{
+    // Note:  ignoring case comes from the POSIX strptime spec
+    const string_type* __month = this->__months();
+    ptrdiff_t __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month;
+    if (__i < 24)
+        __m = __i % 12;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_day(int& __d,
+                                            iter_type& __b, iter_type __e,
+                                            ios_base::iostate& __err,
+                                            const ctype<char_type>& __ct) const
+{
+    int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2);
+    if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 31)
+        __d = __t;
+    else
+        __err |= ios_base::failbit;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_month(int& __m,
+                                              iter_type& __b, iter_type __e,
+                                              ios_base::iostate& __err,
+                                              const ctype<char_type>& __ct) const
+{
+    int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1;
+    if (!(__err & ios_base::failbit) && __t <= 11)
+        __m = __t;
+    else
+        __err |= ios_base::failbit;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_year(int& __y,
+                                             iter_type& __b, iter_type __e,
+                                             ios_base::iostate& __err,
+                                             const ctype<char_type>& __ct) const
+{
+    int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4);
+    if (!(__err & ios_base::failbit))
+    {
+        if (__t < 69)
+            __t += 2000;
+        else if (69 <= __t && __t <= 99)
+            __t += 1900;
+        __y = __t - 1900;
+    }
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_year4(int& __y,
+                                              iter_type& __b, iter_type __e,
+                                              ios_base::iostate& __err,
+                                              const ctype<char_type>& __ct) const
+{
+    int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4);
+    if (!(__err & ios_base::failbit))
+        __y = __t - 1900;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_hour(int& __h,
+                                             iter_type& __b, iter_type __e,
+                                             ios_base::iostate& __err,
+                                             const ctype<char_type>& __ct) const
+{
+    int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2);
+    if (!(__err & ios_base::failbit) && __t <= 23)
+        __h = __t;
+    else
+        __err |= ios_base::failbit;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_12_hour(int& __h,
+                                                iter_type& __b, iter_type __e,
+                                                ios_base::iostate& __err,
+                                                const ctype<char_type>& __ct) const
+{
+    int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2);
+    if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 12)
+        __h = __t;
+    else
+        __err |= ios_base::failbit;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_minute(int& __m,
+                                               iter_type& __b, iter_type __e,
+                                               ios_base::iostate& __err,
+                                               const ctype<char_type>& __ct) const
+{
+    int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2);
+    if (!(__err & ios_base::failbit) && __t <= 59)
+        __m = __t;
+    else
+        __err |= ios_base::failbit;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_second(int& __s,
+                                               iter_type& __b, iter_type __e,
+                                               ios_base::iostate& __err,
+                                               const ctype<char_type>& __ct) const
+{
+    int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2);
+    if (!(__err & ios_base::failbit) && __t <= 60)
+        __s = __t;
+    else
+        __err |= ios_base::failbit;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_weekday(int& __w,
+                                                iter_type& __b, iter_type __e,
+                                                ios_base::iostate& __err,
+                                                const ctype<char_type>& __ct) const
+{
+    int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 1);
+    if (!(__err & ios_base::failbit) && __t <= 6)
+        __w = __t;
+    else
+        __err |= ios_base::failbit;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_day_year_num(int& __d,
+                                                     iter_type& __b, iter_type __e,
+                                                     ios_base::iostate& __err,
+                                                     const ctype<char_type>& __ct) const
+{
+    int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 3);
+    if (!(__err & ios_base::failbit) && __t <= 365)
+        __d = __t;
+    else
+        __err |= ios_base::failbit;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_white_space(iter_type& __b, iter_type __e,
+                                                    ios_base::iostate& __err,
+                                                    const ctype<char_type>& __ct) const
+{
+    for (; __b != __e && __ct.is(ctype_base::space, *__b); ++__b)
+        ;
+    if (__b == __e)
+        __err |= ios_base::eofbit;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_am_pm(int& __h,
+                                              iter_type& __b, iter_type __e,
+                                              ios_base::iostate& __err,
+                                              const ctype<char_type>& __ct) const
+{
+    const string_type* __ap = this->__am_pm();
+    if (__ap[0].size() + __ap[1].size() == 0)
+    {
+        __err |= ios_base::failbit;
+        return;
+    }
+    ptrdiff_t __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap;
+    if (__i == 0 && __h == 12)
+        __h = 0;
+    else if (__i == 1 && __h < 12)
+        __h += 12;
+}
+
+template <class _CharT, class _InputIterator>
+void
+time_get<_CharT, _InputIterator>::__get_percent(iter_type& __b, iter_type __e,
+                                                ios_base::iostate& __err,
+                                                const ctype<char_type>& __ct) const
+{
+    if (__b == __e)
+    {
+        __err |= ios_base::eofbit | ios_base::failbit;
+        return;
+    }
+    if (__ct.narrow(*__b, 0) != '%')
+        __err |= ios_base::failbit;
+    else if(++__b == __e)
+        __err |= ios_base::eofbit;
+}
+
+// time_get end primitives
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+time_get<_CharT, _InputIterator>::get(iter_type __b, iter_type __e,
+                                      ios_base& __iob,
+                                      ios_base::iostate& __err, tm* __tm,
+                                      const char_type* __fmtb, const char_type* __fmte) const
+{
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+    __err = ios_base::goodbit;
+    while (__fmtb != __fmte && __err == ios_base::goodbit)
+    {
+        if (__b == __e)
+        {
+            __err = ios_base::failbit;
+            break;
+        }
+        if (__ct.narrow(*__fmtb, 0) == '%')
+        {
+            if (++__fmtb == __fmte)
+            {
+                __err = ios_base::failbit;
+                break;
+            }
+            char __cmd = __ct.narrow(*__fmtb, 0);
+            char __opt = '\0';
+            if (__cmd == 'E' || __cmd == '0')
+            {
+                if (++__fmtb == __fmte)
+                {
+                    __err = ios_base::failbit;
+                    break;
+                }
+                __opt = __cmd;
+                __cmd = __ct.narrow(*__fmtb, 0);
+            }
+            __b = do_get(__b, __e, __iob, __err, __tm, __cmd, __opt);
+            ++__fmtb;
+        }
+        else if (__ct.is(ctype_base::space, *__fmtb))
+        {
+            for (++__fmtb; __fmtb != __fmte && __ct.is(ctype_base::space, *__fmtb); ++__fmtb)
+                ;
+            for (        ;    __b != __e    && __ct.is(ctype_base::space, *__b);    ++__b)
+                ;
+        }
+        else if (__ct.toupper(*__b) == __ct.toupper(*__fmtb))
+        {
+            ++__b;
+            ++__fmtb;
+        }
+        else
+            __err = ios_base::failbit;
+    }
+    if (__b == __e)
+        __err |= ios_base::eofbit;
+    return __b;
+}
+
+template <class _CharT, class _InputIterator>
+typename time_get<_CharT, _InputIterator>::dateorder
+time_get<_CharT, _InputIterator>::do_date_order() const
+{
+    return mdy;
+}
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+time_get<_CharT, _InputIterator>::do_get_time(iter_type __b, iter_type __e,
+                                              ios_base& __iob,
+                                              ios_base::iostate& __err,
+                                              tm* __tm) const
+{
+    const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
+    return get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
+}
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+time_get<_CharT, _InputIterator>::do_get_date(iter_type __b, iter_type __e,
+                                              ios_base& __iob,
+                                              ios_base::iostate& __err,
+                                              tm* __tm) const
+{
+    const string_type& __fmt = this->__x();
+    return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
+}
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+time_get<_CharT, _InputIterator>::do_get_weekday(iter_type __b, iter_type __e,
+                                                 ios_base& __iob,
+                                                 ios_base::iostate& __err,
+                                                 tm* __tm) const
+{
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+    __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
+    return __b;
+}
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+time_get<_CharT, _InputIterator>::do_get_monthname(iter_type __b, iter_type __e,
+                                                   ios_base& __iob,
+                                                   ios_base::iostate& __err,
+                                                   tm* __tm) const
+{
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+    __get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
+    return __b;
+}
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+time_get<_CharT, _InputIterator>::do_get_year(iter_type __b, iter_type __e,
+                                              ios_base& __iob,
+                                              ios_base::iostate& __err,
+                                              tm* __tm) const
+{
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+    __get_year(__tm->tm_year, __b, __e, __err, __ct);
+    return __b;
+}
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
+                                         ios_base& __iob,
+                                         ios_base::iostate& __err, tm* __tm,
+                                         char __fmt, char) const
+{
+    __err = ios_base::goodbit;
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+    switch (__fmt)
+    {
+    case 'a':
+    case 'A':
+        __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
+        break;
+    case 'b':
+    case 'B':
+    case 'h':
+        __get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
+        break;
+    case 'c':
+        {
+        const string_type& __fm = this->__c();
+        __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
+        }
+        break;
+    case 'd':
+    case 'e':
+        __get_day(__tm->tm_mday, __b, __e, __err, __ct);
+        break;
+    case 'D':
+        {
+        const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'};
+        __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
+        }
+        break;
+    case 'F':
+        {
+        const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
+        __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
+        }
+        break;
+    case 'H':
+        __get_hour(__tm->tm_hour, __b, __e, __err, __ct);
+        break;
+    case 'I':
+        __get_12_hour(__tm->tm_hour, __b, __e, __err, __ct);
+        break;
+    case 'j':
+        __get_day_year_num(__tm->tm_yday, __b, __e, __err, __ct);
+        break;
+    case 'm':
+        __get_month(__tm->tm_mon, __b, __e, __err, __ct);
+        break;
+    case 'M':
+        __get_minute(__tm->tm_min, __b, __e, __err, __ct);
+        break;
+    case 'n':
+    case 't':
+        __get_white_space(__b, __e, __err, __ct);
+        break;
+    case 'p':
+        __get_am_pm(__tm->tm_hour, __b, __e, __err, __ct);
+        break;
+    case 'r':
+        {
+        const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'};
+        __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
+        }
+        break;
+    case 'R':
+        {
+        const char_type __fm[] = {'%', 'H', ':', '%', 'M'};
+        __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
+        }
+        break;
+    case 'S':
+        __get_second(__tm->tm_sec, __b, __e, __err, __ct);
+        break;
+    case 'T':
+        {
+        const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
+        __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
+        }
+        break;
+    case 'w':
+        __get_weekday(__tm->tm_wday, __b, __e, __err, __ct);
+        break;
+    case 'x':
+        return do_get_date(__b, __e, __iob, __err, __tm);
+    case 'X':
+        {
+        const string_type& __fm = this->__X();
+        __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
+        }
+        break;
+    case 'y':
+        __get_year(__tm->tm_year, __b, __e, __err, __ct);
+        break;
+    case 'Y':
+        __get_year4(__tm->tm_year, __b, __e, __err, __ct);
+        break;
+    case '%':
+        __get_percent(__b, __e, __err, __ct);
+        break;
+    default:
+        __err |= ios_base::failbit;
+    }
+    return __b;
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS time_get<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS time_get<wchar_t>)
+
+class _LIBCPP_TYPE_VIS __time_get
+{
+protected:
+    locale_t __loc_;
+
+    __time_get(const char* __nm);
+    __time_get(const string& __nm);
+    ~__time_get();
+};
+
+template <class _CharT>
+class _LIBCPP_TYPE_VIS_ONLY __time_get_storage
+    : public __time_get
+{
+protected:
+    typedef basic_string<_CharT> string_type;
+
+    string_type __weeks_[14];
+    string_type __months_[24];
+    string_type __am_pm_[2];
+    string_type __c_;
+    string_type __r_;
+    string_type __x_;
+    string_type __X_;
+
+    explicit __time_get_storage(const char* __nm);
+    explicit __time_get_storage(const string& __nm);
+
+    _LIBCPP_ALWAYS_INLINE ~__time_get_storage() {}
+
+    time_base::dateorder __do_date_order() const;
+
+private:
+    void init(const ctype<_CharT>&);
+    string_type __analyze(char __fmt, const ctype<_CharT>&);
+};
+
+template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY time_get_byname
+    : public time_get<_CharT, _InputIterator>,
+      private __time_get_storage<_CharT>
+{
+public:
+    typedef time_base::dateorder    dateorder;
+    typedef _InputIterator          iter_type;
+    typedef _CharT                  char_type;
+    typedef basic_string<char_type> string_type;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit time_get_byname(const char* __nm, size_t __refs = 0)
+        : time_get<_CharT, _InputIterator>(__refs),
+          __time_get_storage<_CharT>(__nm) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit time_get_byname(const string& __nm, size_t __refs = 0)
+        : time_get<_CharT, _InputIterator>(__refs),
+          __time_get_storage<_CharT>(__nm) {}
+
+protected:
+    _LIBCPP_INLINE_VISIBILITY
+    ~time_get_byname() {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    virtual dateorder do_date_order() const {return this->__do_date_order();}
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    virtual const string_type* __weeks() const  {return this->__weeks_;}
+    _LIBCPP_INLINE_VISIBILITY
+    virtual const string_type* __months() const {return this->__months_;}
+    _LIBCPP_INLINE_VISIBILITY
+    virtual const string_type* __am_pm() const  {return this->__am_pm_;}
+    _LIBCPP_INLINE_VISIBILITY
+    virtual const string_type& __c() const      {return this->__c_;}
+    _LIBCPP_INLINE_VISIBILITY
+    virtual const string_type& __r() const      {return this->__r_;}
+    _LIBCPP_INLINE_VISIBILITY
+    virtual const string_type& __x() const      {return this->__x_;}
+    _LIBCPP_INLINE_VISIBILITY
+    virtual const string_type& __X() const      {return this->__X_;}
+};
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS time_get_byname<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS time_get_byname<wchar_t>)
+
+class _LIBCPP_TYPE_VIS __time_put
+{
+    locale_t __loc_;
+protected:
+    _LIBCPP_ALWAYS_INLINE __time_put() : __loc_(_LIBCPP_GET_C_LOCALE) {}
+    __time_put(const char* __nm);
+    __time_put(const string& __nm);
+    ~__time_put();
+    void __do_put(char* __nb, char*& __ne, const tm* __tm,
+                  char __fmt, char __mod) const;
+    void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
+                  char __fmt, char __mod) const;
+};
+
+template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY time_put
+    : public locale::facet,
+      private __time_put
+{
+public:
+    typedef _CharT char_type;
+    typedef _OutputIterator iter_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit time_put(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    iter_type put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm,
+                  const char_type* __pb, const char_type* __pe) const;
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
+                  const tm* __tm, char __fmt, char __mod = 0) const
+    {
+        return do_put(__s, __iob, __fl, __tm, __fmt, __mod);
+    }
+
+    static locale::id id;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    ~time_put() {}
+    virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm,
+                             char __fmt, char __mod) const;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit time_put(const char* __nm, size_t __refs)
+        : locale::facet(__refs),
+          __time_put(__nm) {}
+    _LIBCPP_ALWAYS_INLINE
+    explicit time_put(const string& __nm, size_t __refs)
+        : locale::facet(__refs),
+          __time_put(__nm) {}
+};
+
+template <class _CharT, class _OutputIterator>
+locale::id
+time_put<_CharT, _OutputIterator>::id;
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob,
+                                       char_type __fl, const tm* __tm,
+                                       const char_type* __pb,
+                                       const char_type* __pe) const
+{
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+    for (; __pb != __pe; ++__pb)
+    {
+        if (__ct.narrow(*__pb, 0) == '%')
+        {
+            if (++__pb == __pe)
+            {
+                *__s++ = __pb[-1];
+                break;
+            }
+            char __mod = 0;
+            char __fmt = __ct.narrow(*__pb, 0);
+            if (__fmt == 'E' || __fmt == 'O')
+            {
+                if (++__pb == __pe)
+                {
+                    *__s++ = __pb[-2];
+                    *__s++ = __pb[-1];
+                    break;
+                }
+                __mod = __fmt;
+                __fmt = __ct.narrow(*__pb, 0);
+            }
+            __s = do_put(__s, __iob, __fl, __tm, __fmt, __mod);
+        }
+        else
+            *__s++ = *__pb;
+    }
+    return __s;
+}
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&,
+                                          char_type, const tm* __tm,
+                                          char __fmt, char __mod) const
+{
+    char_type __nar[100];
+    char_type* __nb = __nar;
+    char_type* __ne = __nb + 100;
+    __do_put(__nb, __ne, __tm, __fmt, __mod);
+    return _VSTD::copy(__nb, __ne, __s);
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS time_put<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS time_put<wchar_t>)
+
+template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY time_put_byname
+    : public time_put<_CharT, _OutputIterator>
+{
+public:
+    _LIBCPP_ALWAYS_INLINE
+    explicit time_put_byname(const char* __nm, size_t __refs = 0)
+        : time_put<_CharT, _OutputIterator>(__nm, __refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit time_put_byname(const string& __nm, size_t __refs = 0)
+        : time_put<_CharT, _OutputIterator>(__nm, __refs) {}
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    ~time_put_byname() {}
+};
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS time_put_byname<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS time_put_byname<wchar_t>)
+
+// money_base
+
+class _LIBCPP_TYPE_VIS money_base
+{
+public:
+    enum part {none, space, symbol, sign, value};
+    struct pattern {char field[4];};
+
+    _LIBCPP_ALWAYS_INLINE money_base() {}
+};
+
+// moneypunct
+
+template <class _CharT, bool _International = false>
+class _LIBCPP_TYPE_VIS_ONLY moneypunct
+    : public locale::facet,
+      public money_base
+{
+public:
+    typedef _CharT                  char_type;
+    typedef basic_string<char_type> string_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit moneypunct(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE char_type   decimal_point() const {return do_decimal_point();}
+    _LIBCPP_ALWAYS_INLINE char_type   thousands_sep() const {return do_thousands_sep();}
+    _LIBCPP_ALWAYS_INLINE string      grouping()      const {return do_grouping();}
+    _LIBCPP_ALWAYS_INLINE string_type curr_symbol()   const {return do_curr_symbol();}
+    _LIBCPP_ALWAYS_INLINE string_type positive_sign() const {return do_positive_sign();}
+    _LIBCPP_ALWAYS_INLINE string_type negative_sign() const {return do_negative_sign();}
+    _LIBCPP_ALWAYS_INLINE int         frac_digits()   const {return do_frac_digits();}
+    _LIBCPP_ALWAYS_INLINE pattern     pos_format()    const {return do_pos_format();}
+    _LIBCPP_ALWAYS_INLINE pattern     neg_format()    const {return do_neg_format();}
+
+    static locale::id id;
+    static const bool intl = _International;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    ~moneypunct() {}
+
+    virtual char_type   do_decimal_point() const {return numeric_limits<char_type>::max();}
+    virtual char_type   do_thousands_sep() const {return numeric_limits<char_type>::max();}
+    virtual string      do_grouping()      const {return string();}
+    virtual string_type do_curr_symbol()   const {return string_type();}
+    virtual string_type do_positive_sign() const {return string_type();}
+    virtual string_type do_negative_sign() const {return string_type(1, '-');}
+    virtual int         do_frac_digits()   const {return 0;}
+    virtual pattern     do_pos_format()    const
+        {pattern __p = {{symbol, sign, none, value}}; return __p;}
+    virtual pattern     do_neg_format()    const
+        {pattern __p = {{symbol, sign, none, value}}; return __p;}
+};
+
+template <class _CharT, bool _International>
+locale::id
+moneypunct<_CharT, _International>::id;
+
+template <class _CharT, bool _International>
+const bool
+moneypunct<_CharT, _International>::intl;
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS moneypunct<char, false>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS moneypunct<char, true>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS moneypunct<wchar_t, false>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS moneypunct<wchar_t, true>)
+
+// moneypunct_byname
+
+template <class _CharT, bool _International = false>
+class _LIBCPP_TYPE_VIS_ONLY moneypunct_byname
+    : public moneypunct<_CharT, _International>
+{
+public:
+    typedef money_base::pattern  pattern;
+    typedef _CharT                  char_type;
+    typedef basic_string<char_type> string_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit moneypunct_byname(const char* __nm, size_t __refs = 0)
+        : moneypunct<_CharT, _International>(__refs) {init(__nm);}
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit moneypunct_byname(const string& __nm, size_t __refs = 0)
+        : moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());}
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    ~moneypunct_byname() {}
+
+    virtual char_type   do_decimal_point() const {return __decimal_point_;}
+    virtual char_type   do_thousands_sep() const {return __thousands_sep_;}
+    virtual string      do_grouping()      const {return __grouping_;}
+    virtual string_type do_curr_symbol()   const {return __curr_symbol_;}
+    virtual string_type do_positive_sign() const {return __positive_sign_;}
+    virtual string_type do_negative_sign() const {return __negative_sign_;}
+    virtual int         do_frac_digits()   const {return __frac_digits_;}
+    virtual pattern     do_pos_format()    const {return __pos_format_;}
+    virtual pattern     do_neg_format()    const {return __neg_format_;}
+
+private:
+    char_type   __decimal_point_;
+    char_type   __thousands_sep_;
+    string      __grouping_;
+    string_type __curr_symbol_;
+    string_type __positive_sign_;
+    string_type __negative_sign_;
+    int         __frac_digits_;
+    pattern     __pos_format_;
+    pattern     __neg_format_;
+
+    void init(const char*);
+};
+
+template<> void moneypunct_byname<char, false>::init(const char*);
+template<> void moneypunct_byname<char, true>::init(const char*);
+template<> void moneypunct_byname<wchar_t, false>::init(const char*);
+template<> void moneypunct_byname<wchar_t, true>::init(const char*);
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS moneypunct_byname<char, false>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS moneypunct_byname<char, true>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS moneypunct_byname<wchar_t, false>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS moneypunct_byname<wchar_t, true>)
+
+// money_get
+
+template <class _CharT>
+class __money_get
+{
+protected:
+    typedef _CharT                  char_type;
+    typedef basic_string<char_type> string_type;
+
+    _LIBCPP_ALWAYS_INLINE __money_get() {}
+
+    static void __gather_info(bool __intl, const locale& __loc,
+                              money_base::pattern& __pat, char_type& __dp,
+                              char_type& __ts, string& __grp,
+                              string_type& __sym, string_type& __psn,
+                              string_type& __nsn, int& __fd);
+};
+
+template <class _CharT>
+void
+__money_get<_CharT>::__gather_info(bool __intl, const locale& __loc,
+                                   money_base::pattern& __pat, char_type& __dp,
+                                   char_type& __ts, string& __grp,
+                                   string_type& __sym, string_type& __psn,
+                                   string_type& __nsn, int& __fd)
+{
+    if (__intl)
+    {
+        const moneypunct<char_type, true>& __mp =
+            use_facet<moneypunct<char_type, true> >(__loc);
+        __pat = __mp.neg_format();
+        __nsn = __mp.negative_sign();
+        __psn = __mp.positive_sign();
+        __dp = __mp.decimal_point();
+        __ts = __mp.thousands_sep();
+        __grp = __mp.grouping();
+        __sym = __mp.curr_symbol();
+        __fd = __mp.frac_digits();
+    }
+    else
+    {
+        const moneypunct<char_type, false>& __mp =
+            use_facet<moneypunct<char_type, false> >(__loc);
+        __pat = __mp.neg_format();
+        __nsn = __mp.negative_sign();
+        __psn = __mp.positive_sign();
+        __dp = __mp.decimal_point();
+        __ts = __mp.thousands_sep();
+        __grp = __mp.grouping();
+        __sym = __mp.curr_symbol();
+        __fd = __mp.frac_digits();
+    }
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS __money_get<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS __money_get<wchar_t>)
+
+template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY money_get
+    : public locale::facet,
+      private __money_get<_CharT>
+{
+public:
+    typedef _CharT                  char_type;
+    typedef _InputIterator          iter_type;
+    typedef basic_string<char_type> string_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit money_get(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob,
+                  ios_base::iostate& __err, long double& __v) const
+    {
+        return do_get(__b, __e, __intl, __iob, __err, __v);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob,
+                  ios_base::iostate& __err, string_type& __v) const
+    {
+        return do_get(__b, __e, __intl, __iob, __err, __v);
+    }
+
+    static locale::id id;
+
+protected:
+
+    _LIBCPP_ALWAYS_INLINE
+    ~money_get() {}
+
+    virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
+                             ios_base& __iob, ios_base::iostate& __err,
+                             long double& __v) const;
+    virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
+                             ios_base& __iob, ios_base::iostate& __err,
+                             string_type& __v) const;
+
+private:
+    static bool __do_get(iter_type& __b, iter_type __e,
+                         bool __intl, const locale& __loc,
+                         ios_base::fmtflags __flags, ios_base::iostate& __err,
+                         bool& __neg, const ctype<char_type>& __ct,
+                         unique_ptr<char_type, void(*)(void*)>& __wb,
+                         char_type*& __wn, char_type* __we);
+};
+
+template <class _CharT, class _InputIterator>
+locale::id
+money_get<_CharT, _InputIterator>::id;
+
+_LIBCPP_FUNC_VIS void __do_nothing(void*);
+
+template <class _Tp>
+_LIBCPP_HIDDEN
+void
+__double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e)
+{
+    bool __owns = __b.get_deleter() != __do_nothing;
+    size_t __cur_cap = static_cast<size_t>(__e-__b.get()) * sizeof(_Tp);
+    size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ?
+                       2 * __cur_cap : numeric_limits<size_t>::max();
+    if (__new_cap == 0)
+        __new_cap = sizeof(_Tp);
+    size_t __n_off = static_cast<size_t>(__n - __b.get());
+    _Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap);
+    if (__t == 0)
+        __throw_bad_alloc();
+    if (__owns)
+        __b.release();
+    __b = unique_ptr<_Tp, void(*)(void*)>(__t, free);
+    __new_cap /= sizeof(_Tp);
+    __n = __b.get() + __n_off;
+    __e = __b.get() + __new_cap;
+}
+
+// true == success
+template <class _CharT, class _InputIterator>
+bool
+money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
+                                            bool __intl, const locale& __loc,
+                                            ios_base::fmtflags __flags,
+                                            ios_base::iostate& __err,
+                                            bool& __neg,
+                                            const ctype<char_type>& __ct,
+                                            unique_ptr<char_type, void(*)(void*)>& __wb,
+                                            char_type*& __wn, char_type* __we)
+{
+    const unsigned __bz = 100;
+    unsigned __gbuf[__bz];
+    unique_ptr<unsigned, void(*)(void*)> __gb(__gbuf, __do_nothing);
+    unsigned* __gn = __gb.get();
+    unsigned* __ge = __gn + __bz;
+    money_base::pattern __pat;
+    char_type __dp;
+    char_type __ts;
+    string __grp;
+    string_type __sym;
+    string_type __psn;
+    string_type __nsn;
+    // Capture the spaces read into money_base::{space,none} so they
+    // can be compared to initial spaces in __sym.
+    string_type __spaces;
+    int __fd;
+    __money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp,
+                                       __sym, __psn, __nsn, __fd);
+    const string_type* __trailing_sign = 0;
+    __wn = __wb.get();
+    for (unsigned __p = 0; __p < 4 && __b != __e; ++__p)
+    {
+        switch (__pat.field[__p])
+        {
+        case money_base::space:
+            if (__p != 3)
+            {
+                if (__ct.is(ctype_base::space, *__b))
+                    __spaces.push_back(*__b++);
+                else
+                {
+                    __err |= ios_base::failbit;
+                    return false;
+                }
+            }
+            // drop through
+        case money_base::none:
+            if (__p != 3)
+            {
+                while (__b != __e && __ct.is(ctype_base::space, *__b))
+                    __spaces.push_back(*__b++);
+            }
+            break;
+        case money_base::sign:
+            if (__psn.size() + __nsn.size() > 0)
+            {
+                if (__psn.size() == 0 || __nsn.size() == 0)
+                {   // sign is optional
+                    if (__psn.size() > 0)
+                    {   // __nsn.size() == 0
+                        if (*__b == __psn[0])
+                        {
+                            ++__b;
+                            if (__psn.size() > 1)
+                                __trailing_sign = &__psn;
+                        }
+                        else
+                            __neg = true;
+                    }
+                    else if (*__b == __nsn[0])  // __nsn.size() > 0 &&  __psn.size() == 0
+                    {
+                        ++__b;
+                        __neg = true;
+                        if (__nsn.size() > 1)
+                            __trailing_sign = &__nsn;
+                    }
+                }
+                else  // sign is required
+                {
+                    if (*__b == __psn[0])
+                    {
+                        ++__b;
+                        if (__psn.size() > 1)
+                            __trailing_sign = &__psn;
+                    }
+                    else if (*__b == __nsn[0])
+                    {
+                        ++__b;
+                        __neg = true;
+                        if (__nsn.size() > 1)
+                            __trailing_sign = &__nsn;
+                    }
+                    else
+                    {
+                        __err |= ios_base::failbit;
+                        return false;
+                    }
+                }
+            }
+            break;
+        case money_base::symbol:
+            {
+            bool __more_needed = __trailing_sign ||
+                                 (__p < 2)       ||
+                                 (__p == 2 && __pat.field[3] != static_cast<char>(money_base::none));
+            bool __sb = (__flags & ios_base::showbase) != 0;
+            if (__sb || __more_needed)
+            {
+                typename string_type::const_iterator __sym_space_end = __sym.begin();
+                if (__p > 0 && (__pat.field[__p - 1] == money_base::none ||
+                                __pat.field[__p - 1] == money_base::space)) {
+                    // Match spaces we've already read against spaces at
+                    // the beginning of __sym.
+                    while (__sym_space_end != __sym.end() &&
+                           __ct.is(ctype_base::space, *__sym_space_end))
+                        ++__sym_space_end;
+                    const size_t __num_spaces = __sym_space_end - __sym.begin();
+                    if (__num_spaces > __spaces.size() ||
+                        !equal(__spaces.end() - __num_spaces, __spaces.end(),
+                               __sym.begin())) {
+                        // No match. Put __sym_space_end back at the
+                        // beginning of __sym, which will prevent a
+                        // match in the next loop.
+                        __sym_space_end = __sym.begin();
+                    }
+                }
+                typename string_type::const_iterator __sym_curr_char = __sym_space_end;
+                while (__sym_curr_char != __sym.end() && __b != __e &&
+                       *__b == *__sym_curr_char) {
+                    ++__b;
+                    ++__sym_curr_char;
+                }
+                if (__sb && __sym_curr_char != __sym.end())
+                {
+                    __err |= ios_base::failbit;
+                    return false;
+                }
+            }
+            }
+            break;
+        case money_base::value:
+            {
+            unsigned __ng = 0;
+            for (; __b != __e; ++__b)
+            {
+                char_type __c = *__b;
+                if (__ct.is(ctype_base::digit, __c))
+                {
+                    if (__wn == __we)
+                        __double_or_nothing(__wb, __wn, __we);
+                    *__wn++ = __c;
+                    ++__ng;
+                }
+                else if (__grp.size() > 0 && __ng > 0 && __c == __ts)
+                {
+                    if (__gn == __ge)
+                        __double_or_nothing(__gb, __gn, __ge);
+                    *__gn++ = __ng;
+                    __ng = 0;
+                }
+                else
+                    break;
+            }
+            if (__gb.get() != __gn && __ng > 0)
+            {
+                if (__gn == __ge)
+                    __double_or_nothing(__gb, __gn, __ge);
+                *__gn++ = __ng;
+            }
+            if (__fd > 0)
+            {
+                if (__b == __e || *__b != __dp)
+                {
+                    __err |= ios_base::failbit;
+                    return false;
+                }
+                for (++__b; __fd > 0; --__fd, ++__b)
+                {
+                    if (__b == __e || !__ct.is(ctype_base::digit, *__b))
+                    {
+                        __err |= ios_base::failbit;
+                        return false;
+                    }
+                    if (__wn == __we)
+                        __double_or_nothing(__wb, __wn, __we);
+                    *__wn++ = *__b;
+                }
+            }
+            if (__wn == __wb.get())
+            {
+                __err |= ios_base::failbit;
+                return false;
+            }
+            }
+            break;
+        }
+    }
+    if (__trailing_sign)
+    {
+        for (unsigned __i = 1; __i < __trailing_sign->size(); ++__i, ++__b)
+        {
+            if (__b == __e || *__b != (*__trailing_sign)[__i])
+            {
+                __err |= ios_base::failbit;
+                return false;
+            }
+        }
+    }
+    if (__gb.get() != __gn)
+    {
+        ios_base::iostate __et = ios_base::goodbit;
+        __check_grouping(__grp, __gb.get(), __gn, __et);
+        if (__et)
+        {
+            __err |= ios_base::failbit;
+            return false;
+        }
+    }
+    return true;
+}
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
+                                          bool __intl, ios_base& __iob,
+                                          ios_base::iostate& __err,
+                                          long double& __v) const
+{
+    const int __bz = 100;
+    char_type __wbuf[__bz];
+    unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
+    char_type* __wn;
+    char_type* __we = __wbuf + __bz;
+    locale __loc = __iob.getloc();
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc);
+    bool __neg = false;
+    if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct,
+                 __wb, __wn, __we))
+    {
+        const char __src[] = "0123456789";
+        char_type __atoms[sizeof(__src)-1];
+        __ct.widen(__src, __src + (sizeof(__src)-1), __atoms);
+        char __nbuf[__bz];
+        char* __nc = __nbuf;
+        unique_ptr<char, void(*)(void*)> __h(0, free);
+        if (__wn - __wb.get() > __bz-2)
+        {
+            __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
+            if (__h.get() == 0)
+                __throw_bad_alloc();
+            __nc = __h.get();
+        }
+        if (__neg)
+            *__nc++ = '-';
+        for (const char_type* __w = __wb.get(); __w < __wn; ++__w, ++__nc)
+            *__nc = __src[find(__atoms, _VSTD::end(__atoms), *__w) - __atoms];
+        *__nc = char();
+        if (sscanf(__nbuf, "%Lf", &__v) != 1)
+            __throw_runtime_error("money_get error");
+    }
+    if (__b == __e)
+        __err |= ios_base::eofbit;
+    return __b;
+}
+
+template <class _CharT, class _InputIterator>
+_InputIterator
+money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
+                                          bool __intl, ios_base& __iob,
+                                          ios_base::iostate& __err,
+                                          string_type& __v) const
+{
+    const int __bz = 100;
+    char_type __wbuf[__bz];
+    unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
+    char_type* __wn;
+    char_type* __we = __wbuf + __bz;
+    locale __loc = __iob.getloc();
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc);
+    bool __neg = false;
+    if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct,
+                 __wb, __wn, __we))
+    {
+        __v.clear();
+        if (__neg)
+            __v.push_back(__ct.widen('-'));
+        char_type __z = __ct.widen('0');
+        char_type* __w;
+        for (__w = __wb.get(); __w < __wn-1; ++__w)
+            if (*__w != __z)
+                break;
+        __v.append(__w, __wn);
+    }
+    if (__b == __e)
+        __err |= ios_base::eofbit;
+    return __b;
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS money_get<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS money_get<wchar_t>)
+
+// money_put
+
+template <class _CharT>
+class __money_put
+{
+protected:
+    typedef _CharT                  char_type;
+    typedef basic_string<char_type> string_type;
+
+    _LIBCPP_ALWAYS_INLINE __money_put() {}
+
+    static void __gather_info(bool __intl, bool __neg, const locale& __loc,
+                              money_base::pattern& __pat, char_type& __dp,
+                              char_type& __ts, string& __grp,
+                              string_type& __sym, string_type& __sn,
+                              int& __fd);
+    static void __format(char_type* __mb, char_type*& __mi, char_type*& __me,
+                         ios_base::fmtflags __flags,
+                         const char_type* __db, const char_type* __de,
+                         const ctype<char_type>& __ct, bool __neg,
+                         const money_base::pattern& __pat, char_type __dp,
+                         char_type __ts, const string& __grp,
+                         const string_type& __sym, const string_type& __sn,
+                         int __fd);
+};
+
+template <class _CharT>
+void
+__money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc,
+                                   money_base::pattern& __pat, char_type& __dp,
+                                   char_type& __ts, string& __grp,
+                                   string_type& __sym, string_type& __sn,
+                                   int& __fd)
+{
+    if (__intl)
+    {
+        const moneypunct<char_type, true>& __mp =
+            use_facet<moneypunct<char_type, true> >(__loc);
+        if (__neg)
+        {
+            __pat = __mp.neg_format();
+            __sn = __mp.negative_sign();
+        }
+        else
+        {
+            __pat = __mp.pos_format();
+            __sn = __mp.positive_sign();
+        }
+        __dp = __mp.decimal_point();
+        __ts = __mp.thousands_sep();
+        __grp = __mp.grouping();
+        __sym = __mp.curr_symbol();
+        __fd = __mp.frac_digits();
+    }
+    else
+    {
+        const moneypunct<char_type, false>& __mp =
+            use_facet<moneypunct<char_type, false> >(__loc);
+        if (__neg)
+        {
+            __pat = __mp.neg_format();
+            __sn = __mp.negative_sign();
+        }
+        else
+        {
+            __pat = __mp.pos_format();
+            __sn = __mp.positive_sign();
+        }
+        __dp = __mp.decimal_point();
+        __ts = __mp.thousands_sep();
+        __grp = __mp.grouping();
+        __sym = __mp.curr_symbol();
+        __fd = __mp.frac_digits();
+    }
+}
+
+template <class _CharT>
+void
+__money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __me,
+                              ios_base::fmtflags __flags,
+                              const char_type* __db, const char_type* __de,
+                              const ctype<char_type>& __ct, bool __neg,
+                              const money_base::pattern& __pat, char_type __dp,
+                              char_type __ts, const string& __grp,
+                              const string_type& __sym, const string_type& __sn,
+                              int __fd)
+{
+    __me = __mb;
+    for (unsigned __p = 0; __p < 4; ++__p)
+    {
+        switch (__pat.field[__p])
+        {
+        case money_base::none:
+            __mi = __me;
+            break;
+        case money_base::space:
+            __mi = __me;
+            *__me++ = __ct.widen(' ');
+            break;
+        case money_base::sign:
+            if (!__sn.empty())
+                *__me++ = __sn[0];
+            break;
+        case money_base::symbol:
+            if (!__sym.empty() && (__flags & ios_base::showbase))
+                __me = _VSTD::copy(__sym.begin(), __sym.end(), __me);
+            break;
+        case money_base::value:
+            {
+            // remember start of value so we can reverse it
+            char_type* __t = __me;
+            // find beginning of digits
+            if (__neg)
+                ++__db;
+            // find end of digits
+            const char_type* __d;
+            for (__d = __db; __d < __de; ++__d)
+                if (!__ct.is(ctype_base::digit, *__d))
+                    break;
+            // print fractional part
+            if (__fd > 0)
+            {
+                int __f;
+                for (__f = __fd; __d > __db && __f > 0; --__f)
+                    *__me++ = *--__d;
+                char_type __z = __f > 0 ? __ct.widen('0') : char_type();
+                for (; __f > 0; --__f)
+                    *__me++ = __z;
+                *__me++ = __dp;
+            }
+            // print units part
+            if (__d == __db)
+            {
+                *__me++ = __ct.widen('0');
+            }
+            else
+            {
+                unsigned __ng = 0;
+                unsigned __ig = 0;
+                unsigned __gl = __grp.empty() ? numeric_limits<unsigned>::max()
+                                              : static_cast<unsigned>(__grp[__ig]);
+                while (__d != __db)
+                {
+                    if (__ng == __gl)
+                    {
+                        *__me++ = __ts;
+                        __ng = 0;
+                        if (++__ig < __grp.size())
+                            __gl = __grp[__ig] == numeric_limits<char>::max() ?
+                                        numeric_limits<unsigned>::max() :
+                                        static_cast<unsigned>(__grp[__ig]);
+                    }
+                    *__me++ = *--__d;
+                    ++__ng;
+                }
+            }
+            // reverse it
+            reverse(__t, __me);
+            }
+            break;
+        }
+    }
+    // print rest of sign, if any
+    if (__sn.size() > 1)
+        __me = _VSTD::copy(__sn.begin()+1, __sn.end(), __me);
+    // set alignment
+    if ((__flags & ios_base::adjustfield) == ios_base::left)
+        __mi = __me;
+    else if ((__flags & ios_base::adjustfield) != ios_base::internal)
+        __mi = __mb;
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS __money_put<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS __money_put<wchar_t>)
+
+template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY money_put
+    : public locale::facet,
+      private __money_put<_CharT>
+{
+public:
+    typedef _CharT                  char_type;
+    typedef _OutputIterator         iter_type;
+    typedef basic_string<char_type> string_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit money_put(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl,
+                  long double __units) const
+    {
+        return do_put(__s, __intl, __iob, __fl, __units);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl,
+                  const string_type& __digits) const
+    {
+        return do_put(__s, __intl, __iob, __fl, __digits);
+    }
+
+    static locale::id id;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    ~money_put() {}
+
+    virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
+                             char_type __fl, long double __units) const;
+    virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
+                             char_type __fl, const string_type& __digits) const;
+};
+
+template <class _CharT, class _OutputIterator>
+locale::id
+money_put<_CharT, _OutputIterator>::id;
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
+                                           ios_base& __iob, char_type __fl,
+                                           long double __units) const
+{
+    // convert to char
+    const size_t __bs = 100;
+    char __buf[__bs];
+    char* __bb = __buf;
+    char_type __digits[__bs];
+    char_type* __db = __digits;
+    size_t __n = static_cast<size_t>(snprintf(__bb, __bs, "%.0Lf", __units));
+    unique_ptr<char, void(*)(void*)> __hn(0, free);
+    unique_ptr<char_type, void(*)(void*)> __hd(0, free);
+    // secure memory for digit storage
+    if (__n > __bs-1)
+    {
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+        __n = static_cast<size_t>(asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units));
+#else
+        __n = __asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
+#endif
+        if (__bb == 0)
+            __throw_bad_alloc();
+        __hn.reset(__bb);
+        __hd.reset((char_type*)malloc(__n * sizeof(char_type)));
+        if (__hd == nullptr)
+            __throw_bad_alloc();
+        __db = __hd.get();
+    }
+    // gather info
+    locale __loc = __iob.getloc();
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc);
+    __ct.widen(__bb, __bb + __n, __db);
+    bool __neg = __n > 0 && __bb[0] == '-';
+    money_base::pattern __pat;
+    char_type __dp;
+    char_type __ts;
+    string __grp;
+    string_type __sym;
+    string_type __sn;
+    int __fd;
+    this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
+    // secure memory for formatting
+    char_type __mbuf[__bs];
+    char_type* __mb = __mbuf;
+    unique_ptr<char_type, void(*)(void*)> __hw(0, free);
+    size_t __exn = static_cast<int>(__n) > __fd ?
+                   (__n - static_cast<size_t>(__fd)) * 2 + __sn.size() +
+                    __sym.size() + static_cast<size_t>(__fd) + 1
+                 : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
+    if (__exn > __bs)
+    {
+        __hw.reset((char_type*)malloc(__exn * sizeof(char_type)));
+        __mb = __hw.get();
+        if (__mb == 0)
+            __throw_bad_alloc();
+    }
+    // format
+    char_type* __mi;
+    char_type* __me;
+    this->__format(__mb, __mi, __me, __iob.flags(),
+                   __db, __db + __n, __ct,
+                   __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
+    return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
+}
+
+template <class _CharT, class _OutputIterator>
+_OutputIterator
+money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
+                                           ios_base& __iob, char_type __fl,
+                                           const string_type& __digits) const
+{
+    // gather info
+    locale __loc = __iob.getloc();
+    const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc);
+    bool __neg = __digits.size() > 0 && __digits[0] == __ct.widen('-');
+    money_base::pattern __pat;
+    char_type __dp;
+    char_type __ts;
+    string __grp;
+    string_type __sym;
+    string_type __sn;
+    int __fd;
+    this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
+    // secure memory for formatting
+    char_type __mbuf[100];
+    char_type* __mb = __mbuf;
+    unique_ptr<char_type, void(*)(void*)> __h(0, free);
+    size_t __exn = static_cast<int>(__digits.size()) > __fd ?
+                   (__digits.size() - static_cast<size_t>(__fd)) * 2 +
+                    __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 1
+                 : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
+    if (__exn > 100)
+    {
+        __h.reset((char_type*)malloc(__exn * sizeof(char_type)));
+        __mb = __h.get();
+        if (__mb == 0)
+            __throw_bad_alloc();
+    }
+    // format
+    char_type* __mi;
+    char_type* __me;
+    this->__format(__mb, __mi, __me, __iob.flags(),
+                   __digits.data(), __digits.data() + __digits.size(), __ct,
+                   __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
+    return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS money_put<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS money_put<wchar_t>)
+
+// messages
+
+class _LIBCPP_TYPE_VIS messages_base
+{
+public:
+    typedef ptrdiff_t catalog;
+
+    _LIBCPP_ALWAYS_INLINE messages_base() {}
+};
+
+template <class _CharT>
+class _LIBCPP_TYPE_VIS_ONLY messages
+    : public locale::facet,
+      public messages_base
+{
+public:
+    typedef _CharT               char_type;
+    typedef basic_string<_CharT> string_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit messages(size_t __refs = 0)
+        : locale::facet(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    catalog open(const basic_string<char>& __nm, const locale& __loc) const
+    {
+        return do_open(__nm, __loc);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    string_type get(catalog __c, int __set, int __msgid,
+                    const string_type& __dflt) const
+    {
+        return do_get(__c, __set, __msgid, __dflt);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    void close(catalog __c) const
+    {
+        do_close(__c);
+    }
+
+    static locale::id id;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    ~messages() {}
+
+    virtual catalog do_open(const basic_string<char>&, const locale&) const;
+    virtual string_type do_get(catalog, int __set, int __msgid,
+                               const string_type& __dflt) const;
+    virtual void do_close(catalog) const;
+};
+
+template <class _CharT>
+locale::id
+messages<_CharT>::id;
+
+template <class _CharT>
+typename messages<_CharT>::catalog
+messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
+{
+#ifdef _LIBCPP_HAS_CATOPEN
+    catalog __cat = (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
+    if (__cat != -1)
+        __cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
+    return __cat;
+#else // !_LIBCPP_HAS_CATOPEN
+    return -1;
+#endif // _LIBCPP_HAS_CATOPEN
+}
+
+template <class _CharT>
+typename messages<_CharT>::string_type
+messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
+                         const string_type& __dflt) const
+{
+#ifdef _LIBCPP_HAS_CATOPEN
+    string __ndflt;
+    __narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
+                                                       __dflt.c_str(),
+                                                       __dflt.c_str() + __dflt.size());
+    if (__c != -1)
+        __c <<= 1;
+    nl_catd __cat = (nl_catd)__c;
+    char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
+    string_type __w;
+    __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
+                                                        __n, __n + strlen(__n));
+    return __w;
+#else // !_LIBCPP_HAS_CATOPEN
+    return __dflt;
+#endif // _LIBCPP_HAS_CATOPEN
+}
+
+template <class _CharT>
+void
+messages<_CharT>::do_close(catalog __c) const
+{
+#ifdef _LIBCPP_HAS_CATOPEN
+    if (__c != -1)
+        __c <<= 1;
+    nl_catd __cat = (nl_catd)__c;
+    catclose(__cat);
+#endif // _LIBCPP_HAS_CATOPEN
+}
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS messages<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS messages<wchar_t>)
+
+template <class _CharT>
+class _LIBCPP_TYPE_VIS_ONLY messages_byname
+    : public messages<_CharT>
+{
+public:
+    typedef messages_base::catalog catalog;
+    typedef basic_string<_CharT> string_type;
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit messages_byname(const char*, size_t __refs = 0)
+        : messages<_CharT>(__refs) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    explicit messages_byname(const string&, size_t __refs = 0)
+        : messages<_CharT>(__refs) {}
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    ~messages_byname() {}
+};
+
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS messages_byname<char>)
+_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS messages_byname<wchar_t>)
+
+template<class _Codecvt, class _Elem = wchar_t,
+         class _Wide_alloc = allocator<_Elem>,
+         class _Byte_alloc = allocator<char> >
+class _LIBCPP_TYPE_VIS_ONLY wstring_convert
+{
+public:
+    typedef basic_string<char, char_traits<char>, _Byte_alloc>   byte_string;
+    typedef basic_string<_Elem, char_traits<_Elem>, _Wide_alloc> wide_string;
+    typedef typename _Codecvt::state_type                        state_type;
+    typedef typename wide_string::traits_type::int_type          int_type;
+
+private:
+    byte_string __byte_err_string_;
+    wide_string __wide_err_string_;
+    _Codecvt* __cvtptr_;
+    state_type __cvtstate_;
+    size_t __cvtcount_;
+
+    wstring_convert(const wstring_convert& __wc);
+    wstring_convert& operator=(const wstring_convert& __wc);
+public:
+    _LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(_Codecvt* __pcvt = new _Codecvt);
+    wstring_convert(_Codecvt* __pcvt, state_type __state);
+    _LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err,
+                    const wide_string& __wide_err = wide_string());
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    wstring_convert(wstring_convert&& __wc);
+#endif
+    ~wstring_convert();
+
+    _LIBCPP_ALWAYS_INLINE
+    wide_string from_bytes(char __byte)
+        {return from_bytes(&__byte, &__byte+1);}
+    _LIBCPP_ALWAYS_INLINE
+    wide_string from_bytes(const char* __ptr)
+        {return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));}
+    _LIBCPP_ALWAYS_INLINE
+    wide_string from_bytes(const byte_string& __str)
+        {return from_bytes(__str.data(), __str.data() + __str.size());}
+    wide_string from_bytes(const char* __first, const char* __last);
+
+    _LIBCPP_ALWAYS_INLINE
+    byte_string to_bytes(_Elem __wchar)
+        {return to_bytes(&__wchar, &__wchar+1);}
+    _LIBCPP_ALWAYS_INLINE
+    byte_string to_bytes(const _Elem* __wptr)
+        {return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));}
+    _LIBCPP_ALWAYS_INLINE
+    byte_string to_bytes(const wide_string& __wstr)
+        {return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());}
+    byte_string to_bytes(const _Elem* __first, const _Elem* __last);
+
+    _LIBCPP_ALWAYS_INLINE
+    size_t converted() const _NOEXCEPT {return __cvtcount_;}
+    _LIBCPP_ALWAYS_INLINE
+    state_type state() const {return __cvtstate_;}
+};
+
+template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
+inline _LIBCPP_ALWAYS_INLINE
+wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
+    wstring_convert(_Codecvt* __pcvt)
+        : __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
+{
+}
+
+template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
+inline _LIBCPP_ALWAYS_INLINE
+wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
+    wstring_convert(_Codecvt* __pcvt, state_type __state)
+        : __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
+{
+}
+
+template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
+wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
+    wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err)
+        : __byte_err_string_(__byte_err), __wide_err_string_(__wide_err),
+          __cvtstate_(), __cvtcount_(0)
+{
+    __cvtptr_ = new _Codecvt;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
+inline _LIBCPP_ALWAYS_INLINE
+wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
+    wstring_convert(wstring_convert&& __wc)
+        : __byte_err_string_(_VSTD::move(__wc.__byte_err_string_)),
+          __wide_err_string_(_VSTD::move(__wc.__wide_err_string_)),
+          __cvtptr_(__wc.__cvtptr_),
+          __cvtstate_(__wc.__cvtstate_), __cvtcount_(__wc.__cvtstate_)
+{
+    __wc.__cvtptr_ = nullptr;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
+wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert()
+{
+    delete __cvtptr_;
+}
+
+template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
+typename wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::wide_string
+wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
+    from_bytes(const char* __frm, const char* __frm_end)
+{
+    __cvtcount_ = 0;
+    if (__cvtptr_ != nullptr)
+    {
+        wide_string __ws(2*(__frm_end - __frm), _Elem());
+        if (__frm != __frm_end)
+            __ws.resize(__ws.capacity());
+        codecvt_base::result __r = codecvt_base::ok;
+        state_type __st = __cvtstate_;
+        if (__frm != __frm_end)
+        {
+            _Elem* __to = &__ws[0];
+            _Elem* __to_end = __to + __ws.size();
+            const char* __frm_nxt;
+            do
+            {
+                _Elem* __to_nxt;
+                __r = __cvtptr_->in(__st, __frm, __frm_end, __frm_nxt,
+                                          __to, __to_end, __to_nxt);
+                __cvtcount_ += __frm_nxt - __frm;
+                if (__frm_nxt == __frm)
+                {
+                    __r = codecvt_base::error;
+                }
+                else if (__r == codecvt_base::noconv)
+                {
+                    __ws.resize(__to - &__ws[0]);
+                    // This only gets executed if _Elem is char
+                    __ws.append((const _Elem*)__frm, (const _Elem*)__frm_end);
+                    __frm = __frm_nxt;
+                    __r = codecvt_base::ok;
+                }
+                else if (__r == codecvt_base::ok)
+                {
+                    __ws.resize(__to_nxt - &__ws[0]);
+                    __frm = __frm_nxt;
+                }
+                else if (__r == codecvt_base::partial)
+                {
+                    ptrdiff_t __s = __to_nxt - &__ws[0];
+                    __ws.resize(2 * __s);
+                    __to = &__ws[0] + __s;
+                    __to_end = &__ws[0] + __ws.size();
+                    __frm = __frm_nxt;
+                }
+            } while (__r == codecvt_base::partial && __frm_nxt < __frm_end);
+        }
+        if (__r == codecvt_base::ok)
+            return __ws;
+    }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__wide_err_string_.empty())
+        throw range_error("wstring_convert: from_bytes error");
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __wide_err_string_;
+}
+
+template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
+typename wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::byte_string
+wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
+    to_bytes(const _Elem* __frm, const _Elem* __frm_end)
+{
+    __cvtcount_ = 0;
+    if (__cvtptr_ != nullptr)
+    {
+        byte_string __bs(2*(__frm_end - __frm), char());
+        if (__frm != __frm_end)
+            __bs.resize(__bs.capacity());
+        codecvt_base::result __r = codecvt_base::ok;
+        state_type __st = __cvtstate_;
+        if (__frm != __frm_end)
+        {
+            char* __to = &__bs[0];
+            char* __to_end = __to + __bs.size();
+            const _Elem* __frm_nxt;
+            do
+            {
+                char* __to_nxt;
+                __r = __cvtptr_->out(__st, __frm, __frm_end, __frm_nxt,
+                                           __to, __to_end, __to_nxt);
+                __cvtcount_ += __frm_nxt - __frm;
+                if (__frm_nxt == __frm)
+                {
+                    __r = codecvt_base::error;
+                }
+                else if (__r == codecvt_base::noconv)
+                {
+                    __bs.resize(__to - &__bs[0]);
+                    // This only gets executed if _Elem is char
+                    __bs.append((const char*)__frm, (const char*)__frm_end);
+                    __frm = __frm_nxt;
+                    __r = codecvt_base::ok;
+                }
+                else if (__r == codecvt_base::ok)
+                {
+                    __bs.resize(__to_nxt - &__bs[0]);
+                    __frm = __frm_nxt;
+                }
+                else if (__r == codecvt_base::partial)
+                {
+                    ptrdiff_t __s = __to_nxt - &__bs[0];
+                    __bs.resize(2 * __s);
+                    __to = &__bs[0] + __s;
+                    __to_end = &__bs[0] + __bs.size();
+                    __frm = __frm_nxt;
+                }
+            } while (__r == codecvt_base::partial && __frm_nxt < __frm_end);
+        }
+        if (__r == codecvt_base::ok)
+        {
+            size_t __s = __bs.size();
+            __bs.resize(__bs.capacity());
+            char* __to = &__bs[0] + __s;
+            char* __to_end = __to + __bs.size();
+            do
+            {
+                char* __to_nxt;
+                __r = __cvtptr_->unshift(__st, __to, __to_end, __to_nxt);
+                if (__r == codecvt_base::noconv)
+                {
+                    __bs.resize(__to - &__bs[0]);
+                    __r = codecvt_base::ok;
+                }
+                else if (__r == codecvt_base::ok)
+                {
+                    __bs.resize(__to_nxt - &__bs[0]);
+                }
+                else if (__r == codecvt_base::partial)
+                {
+                    ptrdiff_t __sp = __to_nxt - &__bs[0];
+                    __bs.resize(2 * __sp);
+                    __to = &__bs[0] + __sp;
+                    __to_end = &__bs[0] + __bs.size();
+                }
+            } while (__r == codecvt_base::partial);
+            if (__r == codecvt_base::ok)
+                return __bs;
+        }
+    }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__byte_err_string_.empty())
+        throw range_error("wstring_convert: to_bytes error");
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __byte_err_string_;
+}
+
+template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> >
+class _LIBCPP_TYPE_VIS_ONLY wbuffer_convert
+    : public basic_streambuf<_Elem, _Tr>
+{
+public:
+    // types:
+    typedef _Elem                          char_type;
+    typedef _Tr                            traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+    typedef typename _Codecvt::state_type  state_type;
+
+private:
+    char*       __extbuf_;
+    const char* __extbufnext_;
+    const char* __extbufend_;
+    char __extbuf_min_[8];
+    size_t __ebs_;
+    char_type* __intbuf_;
+    size_t __ibs_;
+    streambuf* __bufptr_;
+    _Codecvt* __cv_;
+    state_type __st_;
+    ios_base::openmode __cm_;
+    bool __owns_eb_;
+    bool __owns_ib_;
+    bool __always_noconv_;
+
+    wbuffer_convert(const wbuffer_convert&);
+    wbuffer_convert& operator=(const wbuffer_convert&);
+public:
+    _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0, 
+            _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
+    ~wbuffer_convert();
+
+    _LIBCPP_INLINE_VISIBILITY
+    streambuf* rdbuf() const {return __bufptr_;}
+    _LIBCPP_INLINE_VISIBILITY
+    streambuf* rdbuf(streambuf* __bytebuf)
+    {
+        streambuf* __r = __bufptr_;
+        __bufptr_ = __bytebuf;
+        return __r;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    state_type state() const {return __st_;}
+
+protected:
+    virtual int_type underflow();
+    virtual int_type pbackfail(int_type __c = traits_type::eof());
+    virtual int_type overflow (int_type __c = traits_type::eof());
+    virtual basic_streambuf<char_type, traits_type>* setbuf(char_type* __s,
+                                                            streamsize __n);
+    virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
+                             ios_base::openmode __wch = ios_base::in | ios_base::out);
+    virtual pos_type seekpos(pos_type __sp,
+                             ios_base::openmode __wch = ios_base::in | ios_base::out);
+    virtual int sync();
+
+private:
+    bool __read_mode();
+    void __write_mode();
+    wbuffer_convert* __close();
+};
+
+template <class _Codecvt, class _Elem, class _Tr>
+wbuffer_convert<_Codecvt, _Elem, _Tr>::
+    wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state)
+    : __extbuf_(0),
+      __extbufnext_(0),
+      __extbufend_(0),
+      __ebs_(0),
+      __intbuf_(0),
+      __ibs_(0),
+      __bufptr_(__bytebuf),
+      __cv_(__pcvt),
+      __st_(__state),
+      __cm_(0),
+      __owns_eb_(false),
+      __owns_ib_(false),
+      __always_noconv_(__cv_ ? __cv_->always_noconv() : false)
+{
+    setbuf(0, 4096);
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+wbuffer_convert<_Codecvt, _Elem, _Tr>::~wbuffer_convert()
+{
+    __close();
+    delete __cv_;
+    if (__owns_eb_)
+        delete [] __extbuf_;
+    if (__owns_ib_)
+        delete [] __intbuf_;
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
+wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
+{
+    if (__cv_ == 0 || __bufptr_ == 0)
+        return traits_type::eof();
+    bool __initial = __read_mode();
+    char_type __1buf;
+    if (this->gptr() == 0)
+        this->setg(&__1buf, &__1buf+1, &__1buf+1);
+    const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4);
+    int_type __c = traits_type::eof();
+    if (this->gptr() == this->egptr())
+    {
+        memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
+        if (__always_noconv_)
+        {
+            streamsize __nmemb = static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz);
+            __nmemb = __bufptr_->sgetn((char*)this->eback() + __unget_sz, __nmemb);
+            if (__nmemb != 0)
+            {
+                this->setg(this->eback(),
+                           this->eback() + __unget_sz,
+                           this->eback() + __unget_sz + __nmemb);
+                __c = *this->gptr();
+            }
+        }
+        else
+        {
+            memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
+            __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
+            __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
+            streamsize __nmemb = _VSTD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
+                                 static_cast<streamsize>(__extbufend_ - __extbufnext_));
+            codecvt_base::result __r;
+            state_type __svs = __st_;
+            streamsize __nr = __bufptr_->sgetn(const_cast<char*>(__extbufnext_), __nmemb);
+            if (__nr != 0)
+            {
+                __extbufend_ = __extbufnext_ + __nr;
+                char_type*  __inext;
+                __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
+                                       this->eback() + __unget_sz,
+                                       this->egptr(), __inext);
+                if (__r == codecvt_base::noconv)
+                {
+                    this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
+                    __c = *this->gptr();
+                }
+                else if (__inext != this->eback() + __unget_sz)
+                {
+                    this->setg(this->eback(), this->eback() + __unget_sz, __inext);
+                    __c = *this->gptr();
+                }
+            }
+        }
+    }
+    else
+        __c = *this->gptr();
+    if (this->eback() == &__1buf)
+        this->setg(0, 0, 0);
+    return __c;
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
+wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c)
+{
+    if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr())
+    {
+        if (traits_type::eq_int_type(__c, traits_type::eof()))
+        {
+            this->gbump(-1);
+            return traits_type::not_eof(__c);
+        }
+        if (traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
+        {
+            this->gbump(-1);
+            *this->gptr() = traits_type::to_char_type(__c);
+            return __c;
+        }
+    }
+    return traits_type::eof();
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
+wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c)
+{
+    if (__cv_ == 0 || __bufptr_ == 0)
+        return traits_type::eof();
+    __write_mode();
+    char_type __1buf;
+    char_type* __pb_save = this->pbase();
+    char_type* __epb_save = this->epptr();
+    if (!traits_type::eq_int_type(__c, traits_type::eof()))
+    {
+        if (this->pptr() == 0)
+            this->setp(&__1buf, &__1buf+1);
+        *this->pptr() = traits_type::to_char_type(__c);
+        this->pbump(1);
+    }
+    if (this->pptr() != this->pbase())
+    {
+        if (__always_noconv_)
+        {
+            streamsize __nmemb = static_cast<streamsize>(this->pptr() - this->pbase());
+            if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb)
+                return traits_type::eof();
+        }
+        else
+        {
+            char* __extbe = __extbuf_;
+            codecvt_base::result __r;
+            do
+            {
+                const char_type* __e;
+                __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
+                                        __extbuf_, __extbuf_ + __ebs_, __extbe);
+                if (__e == this->pbase())
+                    return traits_type::eof();
+                if (__r == codecvt_base::noconv)
+                {
+                    streamsize __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
+                    if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb)
+                        return traits_type::eof();
+                }
+                else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
+                {
+                    streamsize __nmemb = static_cast<size_t>(__extbe - __extbuf_);
+                    if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb)
+                        return traits_type::eof();
+                    if (__r == codecvt_base::partial)
+                    {
+                        this->setp((char_type*)__e, this->pptr());
+                        this->pbump(this->epptr() - this->pbase());
+                    }
+                }
+                else
+                    return traits_type::eof();
+            } while (__r == codecvt_base::partial);
+        }
+        this->setp(__pb_save, __epb_save);
+    }
+    return traits_type::not_eof(__c);
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+basic_streambuf<_Elem, _Tr>*
+wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n)
+{
+    this->setg(0, 0, 0);
+    this->setp(0, 0);
+    if (__owns_eb_)
+        delete [] __extbuf_;
+    if (__owns_ib_)
+        delete [] __intbuf_;
+    __ebs_ = __n;
+    if (__ebs_ > sizeof(__extbuf_min_))
+    {
+        if (__always_noconv_ && __s)
+        {
+            __extbuf_ = (char*)__s;
+            __owns_eb_ = false;
+        }
+        else
+        {
+            __extbuf_ = new char[__ebs_];
+            __owns_eb_ = true;
+        }
+    }
+    else
+    {
+        __extbuf_ = __extbuf_min_;
+        __ebs_ = sizeof(__extbuf_min_);
+        __owns_eb_ = false;
+    }
+    if (!__always_noconv_)
+    {
+        __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_));
+        if (__s && __ibs_ >= sizeof(__extbuf_min_))
+        {
+            __intbuf_ = __s;
+            __owns_ib_ = false;
+        }
+        else
+        {
+            __intbuf_ = new char_type[__ibs_];
+            __owns_ib_ = true;
+        }
+    }
+    else
+    {
+        __ibs_ = 0;
+        __intbuf_ = 0;
+        __owns_ib_ = false;
+    }
+    return this;
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type
+wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way,
+                                        ios_base::openmode __om)
+{
+    int __width = __cv_->encoding();
+    if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync())
+        return pos_type(off_type(-1));
+    // __width > 0 || __off == 0
+    switch (__way)
+    {
+    case ios_base::beg:
+        break;
+    case ios_base::cur:
+        break;
+    case ios_base::end:
+        break;
+    default:
+        return pos_type(off_type(-1));
+    }
+    pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om);
+    __r.state(__st_);
+    return __r;
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type
+wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode __wch)
+{
+    if (__cv_ == 0 || __bufptr_ == 0 || sync())
+        return pos_type(off_type(-1));
+    if (__bufptr_->pubseekpos(__sp, __wch) == pos_type(off_type(-1)))
+        return pos_type(off_type(-1));
+    return __sp;
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+int
+wbuffer_convert<_Codecvt, _Elem, _Tr>::sync()
+{
+    if (__cv_ == 0 || __bufptr_ == 0)
+        return 0;
+    if (__cm_ & ios_base::out)
+    {
+        if (this->pptr() != this->pbase())
+            if (overflow() == traits_type::eof())
+                return -1;
+        codecvt_base::result __r;
+        do
+        {
+            char* __extbe;
+            __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe);
+            streamsize __nmemb = static_cast<streamsize>(__extbe - __extbuf_);
+            if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb)
+                return -1;
+        } while (__r == codecvt_base::partial);
+        if (__r == codecvt_base::error)
+            return -1;
+        if (__bufptr_->pubsync())
+            return -1;
+    }
+    else if (__cm_ & ios_base::in)
+    {
+        off_type __c;
+        if (__always_noconv_)
+            __c = this->egptr() - this->gptr();
+        else
+        {
+            int __width = __cv_->encoding();
+            __c = __extbufend_ - __extbufnext_;
+            if (__width > 0)
+                __c += __width * (this->egptr() - this->gptr());
+            else
+            {
+                if (this->gptr() != this->egptr())
+                {
+                    reverse(this->gptr(), this->egptr());
+                    codecvt_base::result __r;
+                    const char_type* __e = this->gptr();
+                    char* __extbe;
+                    do
+                    {
+                        __r = __cv_->out(__st_, __e, this->egptr(), __e,
+                                         __extbuf_, __extbuf_ + __ebs_, __extbe);
+                        switch (__r)
+                        {
+                        case codecvt_base::noconv:
+                            __c += this->egptr() - this->gptr();
+                            break;
+                        case codecvt_base::ok:
+                        case codecvt_base::partial:
+                            __c += __extbe - __extbuf_;
+                            break;
+                        default:
+                            return -1;
+                        }
+                    } while (__r == codecvt_base::partial);
+                }
+            }
+        }
+        if (__bufptr_->pubseekoff(-__c, ios_base::cur, __cm_) == pos_type(off_type(-1)))
+            return -1;
+        this->setg(0, 0, 0);
+        __cm_ = 0;
+    }
+    return 0;
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+bool
+wbuffer_convert<_Codecvt, _Elem, _Tr>::__read_mode()
+{
+    if (!(__cm_ & ios_base::in))
+    {
+        this->setp(0, 0);
+        if (__always_noconv_)
+            this->setg((char_type*)__extbuf_,
+                       (char_type*)__extbuf_ + __ebs_,
+                       (char_type*)__extbuf_ + __ebs_);
+        else
+            this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
+        __cm_ = ios_base::in;
+        return true;
+    }
+    return false;
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+void
+wbuffer_convert<_Codecvt, _Elem, _Tr>::__write_mode()
+{
+    if (!(__cm_ & ios_base::out))
+    {
+        this->setg(0, 0, 0);
+        if (__ebs_ > sizeof(__extbuf_min_))
+        {
+            if (__always_noconv_)
+                this->setp((char_type*)__extbuf_,
+                           (char_type*)__extbuf_ + (__ebs_ - 1));
+            else
+                this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
+        }
+        else
+            this->setp(0, 0);
+        __cm_ = ios_base::out;
+    }
+}
+
+template <class _Codecvt, class _Elem, class _Tr>
+wbuffer_convert<_Codecvt, _Elem, _Tr>*
+wbuffer_convert<_Codecvt, _Elem, _Tr>::__close()
+{
+    wbuffer_convert* __rt = 0;
+    if (__cv_ != 0 && __bufptr_ != 0)
+    {
+        __rt = this;
+        if ((__cm_ & ios_base::out) && sync())
+            __rt = 0;
+    }
+    return __rt;
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_LOCALE

Property changes on: lab4/.minix-src/include/c++/locale
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/mutex
===================================================================
--- lab4/.minix-src/include/c++/mutex	(nonexistent)
+++ lab4/.minix-src/include/c++/mutex	(revision 13)
@@ -0,0 +1,584 @@
+// -*- C++ -*-
+//===--------------------------- mutex ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_MUTEX
+#define _LIBCPP_MUTEX
+
+/*
+    mutex synopsis
+
+namespace std
+{
+
+class mutex
+{
+public:
+     constexpr mutex() noexcept;
+     ~mutex();
+
+    mutex(const mutex&) = delete;
+    mutex& operator=(const mutex&) = delete;
+
+    void lock();
+    bool try_lock();
+    void unlock();
+
+    typedef pthread_mutex_t* native_handle_type;
+    native_handle_type native_handle();
+};
+
+class recursive_mutex
+{
+public:
+     recursive_mutex();
+     ~recursive_mutex();
+
+    recursive_mutex(const recursive_mutex&) = delete;
+    recursive_mutex& operator=(const recursive_mutex&) = delete;
+
+    void lock();
+    bool try_lock() noexcept;
+    void unlock();
+
+    typedef pthread_mutex_t* native_handle_type;
+    native_handle_type native_handle();
+};
+
+class timed_mutex
+{
+public:
+     timed_mutex();
+     ~timed_mutex();
+
+    timed_mutex(const timed_mutex&) = delete;
+    timed_mutex& operator=(const timed_mutex&) = delete;
+
+    void lock();
+    bool try_lock();
+    template <class Rep, class Period>
+        bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
+    template <class Clock, class Duration>
+        bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
+    void unlock();
+};
+
+class recursive_timed_mutex
+{
+public:
+     recursive_timed_mutex();
+     ~recursive_timed_mutex();
+
+    recursive_timed_mutex(const recursive_timed_mutex&) = delete;
+    recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
+
+    void lock();
+    bool try_lock() noexcept;
+    template <class Rep, class Period>
+        bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
+    template <class Clock, class Duration>
+        bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
+    void unlock();
+};
+
+struct defer_lock_t {};
+struct try_to_lock_t {};
+struct adopt_lock_t {};
+
+constexpr defer_lock_t  defer_lock{};
+constexpr try_to_lock_t try_to_lock{};
+constexpr adopt_lock_t  adopt_lock{};
+
+template <class Mutex>
+class lock_guard
+{
+public:
+    typedef Mutex mutex_type;
+
+    explicit lock_guard(mutex_type& m);
+    lock_guard(mutex_type& m, adopt_lock_t);
+    ~lock_guard();
+
+    lock_guard(lock_guard const&) = delete;
+    lock_guard& operator=(lock_guard const&) = delete;
+};
+
+template <class Mutex>
+class unique_lock
+{
+public:
+    typedef Mutex mutex_type;
+    unique_lock() noexcept;
+    explicit unique_lock(mutex_type& m);
+    unique_lock(mutex_type& m, defer_lock_t) noexcept;
+    unique_lock(mutex_type& m, try_to_lock_t);
+    unique_lock(mutex_type& m, adopt_lock_t);
+    template <class Clock, class Duration>
+        unique_lock(mutex_type& m, const chrono::time_point<Clock, Duration>& abs_time);
+    template <class Rep, class Period>
+        unique_lock(mutex_type& m, const chrono::duration<Rep, Period>& rel_time);
+    ~unique_lock();
+
+    unique_lock(unique_lock const&) = delete;
+    unique_lock& operator=(unique_lock const&) = delete;
+
+    unique_lock(unique_lock&& u) noexcept;
+    unique_lock& operator=(unique_lock&& u) noexcept;
+
+    void lock();
+    bool try_lock();
+
+    template <class Rep, class Period>
+        bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
+    template <class Clock, class Duration>
+        bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
+
+    void unlock();
+
+    void swap(unique_lock& u) noexcept;
+    mutex_type* release() noexcept;
+
+    bool owns_lock() const noexcept;
+    explicit operator bool () const noexcept;
+    mutex_type* mutex() const noexcept;
+};
+
+template <class Mutex>
+  void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept;
+
+template <class L1, class L2, class... L3>
+  int try_lock(L1&, L2&, L3&...);
+template <class L1, class L2, class... L3>
+  void lock(L1&, L2&, L3&...);
+
+struct once_flag
+{
+    constexpr once_flag() noexcept;
+
+    once_flag(const once_flag&) = delete;
+    once_flag& operator=(const once_flag&) = delete;
+};
+
+template<class Callable, class ...Args>
+  void call_once(once_flag& flag, Callable&& func, Args&&... args);
+
+}  // std
+
+*/
+
+#include <__config>
+#if !defined(_LIBCPP_HAS_NO_THREADS) && defined(__minix)
+#include <__mutex_base>
+#endif // !defined(_LIBCPP_HAS_NO_THREADS) && defined(__minix)
+#include <functional>
+#include <memory>
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+#include <tuple>
+#endif
+#include <sched.h>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifndef _LIBCPP_HAS_NO_THREADS
+
+class _LIBCPP_TYPE_VIS recursive_mutex
+{
+    pthread_mutex_t __m_;
+
+public:
+     recursive_mutex();
+     ~recursive_mutex();
+
+private:
+    recursive_mutex(const recursive_mutex&); // = delete;
+    recursive_mutex& operator=(const recursive_mutex&); // = delete;
+
+public:
+    void lock();
+    bool try_lock() _NOEXCEPT;
+    void unlock()  _NOEXCEPT;
+
+    typedef pthread_mutex_t* native_handle_type;
+    _LIBCPP_INLINE_VISIBILITY
+    native_handle_type native_handle() {return &__m_;}
+};
+
+class _LIBCPP_TYPE_VIS timed_mutex
+{
+    mutex              __m_;
+    condition_variable __cv_;
+    bool               __locked_;
+public:
+     timed_mutex();
+     ~timed_mutex();
+
+private:
+    timed_mutex(const timed_mutex&); // = delete;
+    timed_mutex& operator=(const timed_mutex&); // = delete;
+
+public:
+    void lock();
+    bool try_lock() _NOEXCEPT;
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
+            {return try_lock_until(chrono::steady_clock::now() + __d);}
+    template <class _Clock, class _Duration>
+        bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
+    void unlock() _NOEXCEPT;
+};
+
+template <class _Clock, class _Duration>
+bool
+timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
+{
+    using namespace chrono;
+    unique_lock<mutex> __lk(__m_);
+    bool no_timeout = _Clock::now() < __t;
+    while (no_timeout && __locked_)
+        no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
+    if (!__locked_)
+    {
+        __locked_ = true;
+        return true;
+    }
+    return false;
+}
+
+class _LIBCPP_TYPE_VIS recursive_timed_mutex
+{
+    mutex              __m_;
+    condition_variable __cv_;
+    size_t             __count_;
+    pthread_t          __id_;
+public:
+     recursive_timed_mutex();
+     ~recursive_timed_mutex();
+
+private:
+    recursive_timed_mutex(const recursive_timed_mutex&); // = delete;
+    recursive_timed_mutex& operator=(const recursive_timed_mutex&); // = delete;
+
+public:
+    void lock();
+    bool try_lock() _NOEXCEPT;
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
+            {return try_lock_until(chrono::steady_clock::now() + __d);}
+    template <class _Clock, class _Duration>
+        bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
+    void unlock() _NOEXCEPT;
+};
+
+template <class _Clock, class _Duration>
+bool
+recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
+{
+    using namespace chrono;
+    pthread_t __id = pthread_self();
+    unique_lock<mutex> lk(__m_);
+    if (pthread_equal(__id, __id_))
+    {
+        if (__count_ == numeric_limits<size_t>::max())
+            return false;
+        ++__count_;
+        return true;
+    }
+    bool no_timeout = _Clock::now() < __t;
+    while (no_timeout && __count_ != 0)
+        no_timeout = __cv_.wait_until(lk, __t) == cv_status::no_timeout;
+    if (__count_ == 0)
+    {
+        __count_ = 1;
+        __id_ = __id;
+        return true;
+    }
+    return false;
+}
+
+template <class _L0, class _L1>
+int
+try_lock(_L0& __l0, _L1& __l1)
+{
+    unique_lock<_L0> __u0(__l0, try_to_lock);
+    if (__u0.owns_lock())
+    {
+        if (__l1.try_lock())
+        {
+            __u0.release();
+            return -1;
+        }
+        else
+            return 1;
+    }
+    return 0;
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _L0, class _L1, class _L2, class... _L3>
+int
+try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
+{
+    int __r = 0;
+    unique_lock<_L0> __u0(__l0, try_to_lock);
+    if (__u0.owns_lock())
+    {
+        __r = try_lock(__l1, __l2, __l3...);
+        if (__r == -1)
+            __u0.release();
+        else
+            ++__r;
+    }
+    return __r;
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _L0, class _L1>
+void
+lock(_L0& __l0, _L1& __l1)
+{
+    while (true)
+    {
+        {
+            unique_lock<_L0> __u0(__l0);
+            if (__l1.try_lock())
+            {
+                __u0.release();
+                break;
+            }
+        }
+        sched_yield();
+        {
+            unique_lock<_L1> __u1(__l1);
+            if (__l0.try_lock())
+            {
+                __u1.release();
+                break;
+            }
+        }
+        sched_yield();
+    }
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _L0, class _L1, class _L2, class ..._L3>
+void
+__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
+{
+    while (true)
+    {
+        switch (__i)
+        {
+        case 0:
+            {
+                unique_lock<_L0> __u0(__l0);
+                __i = try_lock(__l1, __l2, __l3...);
+                if (__i == -1)
+                {
+                    __u0.release();
+                    return;
+                }
+            }
+            ++__i;
+            sched_yield();
+            break;
+        case 1:
+            {
+                unique_lock<_L1> __u1(__l1);
+                __i = try_lock(__l2, __l3..., __l0);
+                if (__i == -1)
+                {
+                    __u1.release();
+                    return;
+                }
+            }
+            if (__i == sizeof...(_L3) + 1)
+                __i = 0;
+            else
+                __i += 2;
+            sched_yield();
+            break;
+        default:
+            __lock_first(__i - 2, __l2, __l3..., __l0, __l1);
+            return;
+        }
+    }
+}
+
+template <class _L0, class _L1, class _L2, class ..._L3>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
+{
+    __lock_first(0, __l0, __l1, __l2, __l3...);
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+#endif // !_LIBCPP_HAS_NO_THREADS
+
+struct _LIBCPP_TYPE_VIS_ONLY once_flag;
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template<class _Callable, class... _Args>
+_LIBCPP_INLINE_VISIBILITY
+void call_once(once_flag&, _Callable&&, _Args&&...);
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template<class _Callable>
+_LIBCPP_INLINE_VISIBILITY
+void call_once(once_flag&, _Callable&);
+
+template<class _Callable>
+_LIBCPP_INLINE_VISIBILITY
+void call_once(once_flag&, const _Callable&);
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+struct _LIBCPP_TYPE_VIS_ONLY once_flag
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR
+        once_flag() _NOEXCEPT : __state_(0) {}
+
+private:
+    once_flag(const once_flag&); // = delete;
+    once_flag& operator=(const once_flag&); // = delete;
+
+    unsigned long __state_;
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template<class _Callable, class... _Args>
+    friend
+    void call_once(once_flag&, _Callable&&, _Args&&...);
+#else  // _LIBCPP_HAS_NO_VARIADICS
+    template<class _Callable>
+    friend
+    void call_once(once_flag&, _Callable&);
+
+    template<class _Callable>
+    friend
+    void call_once(once_flag&, const _Callable&);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Fp>
+class __call_once_param
+{
+    _Fp& __f_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __call_once_param(_Fp& __f) : __f_(__f) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void operator()()
+    {
+        typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
+        __execute(_Index());
+    }
+
+private:
+    template <size_t ..._Indices>
+    _LIBCPP_INLINE_VISIBILITY
+    void __execute(__tuple_indices<_Indices...>)
+    {
+        __invoke(_VSTD::get<0>(_VSTD::move(__f_)), _VSTD::get<_Indices>(_VSTD::move(__f_))...);
+    }
+};
+
+#else
+
+template <class _Fp>
+class __call_once_param
+{
+    _Fp& __f_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __call_once_param(_Fp& __f) : __f_(__f) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void operator()()
+    {
+        __f_();
+    }
+};
+
+#endif
+
+template <class _Fp>
+void
+__call_once_proxy(void* __vp)
+{
+    __call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp);
+    (*__p)();
+}
+
+_LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*));
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template<class _Callable, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
+{
+    if (__libcpp_relaxed_load(&__flag.__state_) != ~0ul)
+    {
+        typedef tuple<_Callable&&, _Args&&...> _Gp;
+        _Gp __f(_VSTD::forward<_Callable>(__func), _VSTD::forward<_Args>(__args)...);
+        __call_once_param<_Gp> __p(__f);
+        __call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
+    }
+}
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template<class _Callable>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+call_once(once_flag& __flag, _Callable& __func)
+{
+    if (__libcpp_relaxed_load(&__flag.__state_) != ~0ul)
+    {
+        __call_once_param<_Callable> __p(__func);
+        __call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>);
+    }
+}
+
+template<class _Callable>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+call_once(once_flag& __flag, const _Callable& __func)
+{
+    if (__flag.__state_ != ~0ul)
+    {
+        __call_once_param<const _Callable> __p(__func);
+        __call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>);
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_MUTEX

Property changes on: lab4/.minix-src/include/c++/mutex
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/ostream
===================================================================
--- lab4/.minix-src/include/c++/ostream	(nonexistent)
+++ lab4/.minix-src/include/c++/ostream	(revision 13)
@@ -0,0 +1,1113 @@
+// -*- C++ -*-
+//===-------------------------- ostream -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_OSTREAM
+#define _LIBCPP_OSTREAM
+
+/*
+    ostream synopsis
+
+template <class charT, class traits = char_traits<charT> >
+class basic_ostream
+    : virtual public basic_ios<charT,traits>
+{
+public:
+    // types (inherited from basic_ios (27.5.4)):
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    // 27.7.2.2 Constructor/destructor:
+    explicit basic_ostream(basic_streambuf<char_type,traits>* sb);
+    basic_ostream(basic_ostream&& rhs);
+    virtual ~basic_ostream();
+
+    // 27.7.2.3 Assign/swap
+    basic_ostream& operator=(const basic_ostream& rhs) = delete; // C++14
+    basic_ostream& operator=(basic_ostream&& rhs);
+    void swap(basic_ostream& rhs);
+
+    // 27.7.2.4 Prefix/suffix:
+    class sentry;
+
+    // 27.7.2.6 Formatted output:
+    basic_ostream& operator<<(basic_ostream& (*pf)(basic_ostream&));
+    basic_ostream& operator<<(basic_ios<charT, traits>& (*pf)(basic_ios<charT,traits>&));
+    basic_ostream& operator<<(ios_base& (*pf)(ios_base&));
+    basic_ostream& operator<<(bool n);
+    basic_ostream& operator<<(short n);
+    basic_ostream& operator<<(unsigned short n);
+    basic_ostream& operator<<(int n);
+    basic_ostream& operator<<(unsigned int n);
+    basic_ostream& operator<<(long n);
+    basic_ostream& operator<<(unsigned long n);
+    basic_ostream& operator<<(long long n);
+    basic_ostream& operator<<(unsigned long long n);
+    basic_ostream& operator<<(float f);
+    basic_ostream& operator<<(double f);
+    basic_ostream& operator<<(long double f);
+    basic_ostream& operator<<(const void* p);
+    basic_ostream& operator<<(basic_streambuf<char_type,traits>* sb);
+
+    // 27.7.2.7 Unformatted output:
+    basic_ostream& put(char_type c);
+    basic_ostream& write(const char_type* s, streamsize n);
+    basic_ostream& flush();
+
+    // 27.7.2.5 seeks:
+    pos_type tellp();
+    basic_ostream& seekp(pos_type);
+    basic_ostream& seekp(off_type, ios_base::seekdir);
+protected:
+    basic_ostream(const basic_ostream& rhs) = delete;
+    basic_ostream(basic_ostream&& rhs);
+    // 27.7.3.3 Assign/swap
+    basic_ostream& operator=(basic_ostream& rhs) = delete;
+    basic_ostream& operator=(const basic_ostream&& rhs);
+    void swap(basic_ostream& rhs);
+};
+
+// 27.7.2.6.4 character inserters
+
+template<class charT, class traits>
+  basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, charT);
+
+template<class charT, class traits>
+  basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, char);
+
+template<class traits>
+  basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, char);
+
+// signed and unsigned
+
+template<class traits>
+  basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, signed char);
+
+template<class traits>
+  basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, unsigned char);
+
+// NTBS
+template<class charT, class traits>
+  basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, const charT*);
+
+template<class charT, class traits>
+  basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, const char*);
+
+template<class traits>
+  basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, const char*);
+
+// signed and unsigned
+template<class traits>
+basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, const signed char*);
+
+template<class traits>
+  basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, const unsigned char*);
+
+// swap:
+template <class charT, class traits>
+  void swap(basic_ostream<charT, traits>& x, basic_ostream<charT, traits>& y);
+
+template <class charT, class traits>
+  basic_ostream<charT,traits>& endl(basic_ostream<charT,traits>& os);
+
+template <class charT, class traits>
+  basic_ostream<charT,traits>& ends(basic_ostream<charT,traits>& os);
+
+template <class charT, class traits>
+  basic_ostream<charT,traits>& flush(basic_ostream<charT,traits>& os);
+
+// rvalue stream insertion
+template <class charT, class traits, class T>
+  basic_ostream<charT, traits>&
+  operator<<(basic_ostream<charT, traits>&& os, const T& x);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <ios>
+#include <streambuf>
+#include <locale>
+#include <iterator>
+#include <bitset>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_ostream
+    : virtual public basic_ios<_CharT, _Traits>
+{
+public:
+    // types (inherited from basic_ios (27.5.4)):
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    // 27.7.2.2 Constructor/destructor:
+    explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb);
+    virtual ~basic_ostream();
+protected:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream(basic_ostream&& __rhs);
+#endif
+
+    // 27.7.2.3 Assign/swap
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream& operator=(basic_ostream&& __rhs);
+#endif
+    void swap(basic_ostream& __rhs);
+
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+    basic_ostream           (const basic_ostream& __rhs) = delete;
+    basic_ostream& operator=(const basic_ostream& __rhs) = delete;
+#else
+    basic_ostream           (const basic_ostream& __rhs); // not defined
+    basic_ostream& operator=(const basic_ostream& __rhs); // not defined
+#endif
+public:
+
+    // 27.7.2.4 Prefix/suffix:
+    class _LIBCPP_TYPE_VIS_ONLY sentry;
+
+    // 27.7.2.6 Formatted output:
+    basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
+    basic_ostream& operator<<(basic_ios<char_type, traits_type>&
+                              (*__pf)(basic_ios<char_type,traits_type>&));
+    basic_ostream& operator<<(ios_base& (*__pf)(ios_base&));
+    basic_ostream& operator<<(bool __n);
+    basic_ostream& operator<<(short __n);
+    basic_ostream& operator<<(unsigned short __n);
+    basic_ostream& operator<<(int __n);
+    basic_ostream& operator<<(unsigned int __n);
+    basic_ostream& operator<<(long __n);
+    basic_ostream& operator<<(unsigned long __n);
+    basic_ostream& operator<<(long long __n);
+    basic_ostream& operator<<(unsigned long long __n);
+    basic_ostream& operator<<(float __f);
+    basic_ostream& operator<<(double __f);
+    basic_ostream& operator<<(long double __f);
+    basic_ostream& operator<<(const void* __p);
+    basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
+
+    // 27.7.2.7 Unformatted output:
+    basic_ostream& put(char_type __c);
+    basic_ostream& write(const char_type* __s, streamsize __n);
+    basic_ostream& flush();
+
+    // 27.7.2.5 seeks:
+    pos_type tellp();
+    basic_ostream& seekp(pos_type __pos);
+    basic_ostream& seekp(off_type __off, ios_base::seekdir __dir);
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    basic_ostream() {}  // extension, intentially does not initialize
+};
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_ostream<_CharT, _Traits>::sentry
+{
+    bool __ok_;
+    basic_ostream<_CharT, _Traits>& __os_;
+
+    sentry(const sentry&); // = delete;
+    sentry& operator=(const sentry&); // = delete;
+
+public:
+    explicit sentry(basic_ostream<_CharT, _Traits>& __os);
+    ~sentry();
+
+    _LIBCPP_ALWAYS_INLINE
+        _LIBCPP_EXPLICIT
+        operator bool() const {return __ok_;}
+};
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& __os)
+    : __ok_(false),
+      __os_(__os)
+{
+    if (__os.good())
+    {
+        if (__os.tie())
+            __os.tie()->flush();
+        __ok_ = true;
+    }
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::sentry::~sentry()
+{
+    if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf)
+                      && !uncaught_exception())
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            if (__os_.rdbuf()->pubsync() == -1)
+                __os_.setstate(ios_base::badbit);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_type>* __sb)
+{
+    this->init(__sb);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs)
+{
+    this->move(__rhs);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
+{
+    swap(__rhs);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::~basic_ostream()
+{
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ostream<_CharT, _Traits>::swap(basic_ostream& __rhs)
+{
+    basic_ios<char_type, traits_type>::swap(__rhs);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(basic_ostream& (*__pf)(basic_ostream&))
+{
+    return __pf(*this);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(basic_ios<char_type, traits_type>&
+                                           (*__pf)(basic_ios<char_type,traits_type>&))
+{
+    __pf(*this);
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(ios_base& (*__pf)(ios_base&))
+{
+    __pf(*this);
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            if (__sb)
+            {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+                try
+                {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+                    typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+                    typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+                    _Ip __i(__sb);
+                    _Ip __eof;
+                    _Op __o(*this);
+                    size_t __c = 0;
+                    for (; __i != __eof; ++__i, ++__o, ++__c)
+                    {
+                        *__o = *__i;
+                        if (__o.failed())
+                            break;
+                    }
+                    if (__c == 0)
+                        this->setstate(ios_base::failbit);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+                }
+                catch (...)
+                {
+                    this->__set_failbit_and_consider_rethrow();
+                }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            }
+            else
+                this->setstate(ios_base::badbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(bool __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), __n).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(short __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(),
+                        __flags == ios_base::oct || __flags == ios_base::hex ?
+                        static_cast<long>(static_cast<unsigned short>(__n))  :
+                        static_cast<long>(__n)).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(int __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(),
+                        __flags == ios_base::oct || __flags == ios_base::hex ?
+                        static_cast<long>(static_cast<unsigned int>(__n))  :
+                        static_cast<long>(__n)).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(long __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), __n).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), __n).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(long long __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), __n).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), __n).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(float __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(double __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), __n).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(long double __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), __n).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+            const _Fp& __f = use_facet<_Fp>(this->getloc());
+            if (__f.put(*this, *this, this->fill(), __n).failed())
+                this->setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+__put_character_sequence(basic_ostream<_CharT, _Traits>& __os,
+                          const _CharT* __str, size_t __len)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+        if (__s)
+        {
+            typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+            if (__pad_and_output(_Ip(__os),
+                                 __str,
+                                 (__os.flags() & ios_base::adjustfield) == ios_base::left ?
+                                     __str + __len :
+                                     __str,
+                                 __str + __len,
+                                 __os,
+                                 __os.fill()).failed())
+                __os.setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __os.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __os;
+}
+
+
+template<class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
+{
+    return _VSTD::__put_character_sequence(__os, &__c, 1);
+}
+
+template<class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+        if (__s)
+        {
+            _CharT __c = __os.widen(__cn);
+            typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+            if (__pad_and_output(_Ip(__os),
+                                 &__c,
+                                 (__os.flags() & ios_base::adjustfield) == ios_base::left ?
+                                     &__c + 1 :
+                                     &__c,
+                                 &__c + 1,
+                                 __os,
+                                 __os.fill()).failed())
+                __os.setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __os.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __os;
+}
+
+template<class _Traits>
+basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, char __c)
+{
+    return _VSTD::__put_character_sequence(__os, &__c, 1);
+}
+
+template<class _Traits>
+basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
+{
+    return _VSTD::__put_character_sequence(__os, (char *) &__c, 1);
+}
+
+template<class _Traits>
+basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
+{
+    return _VSTD::__put_character_sequence(__os, (char *) &__c, 1);
+}
+
+template<class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
+{
+    return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str));
+}
+
+template<class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+        if (__s)
+        {
+            typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+            size_t __len = char_traits<char>::length(__strn);
+            const int __bs = 100;
+            _CharT __wbb[__bs];
+            _CharT* __wb = __wbb;
+            unique_ptr<_CharT, void(*)(void*)> __h(0, free);
+            if (__len > __bs)
+            {
+                __wb = (_CharT*)malloc(__len*sizeof(_CharT));
+                if (__wb == 0)
+                    __throw_bad_alloc();
+                __h.reset(__wb);
+            }
+            for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
+                *__p = __os.widen(*__strn);
+            if (__pad_and_output(_Ip(__os),
+                                 __wb,
+                                 (__os.flags() & ios_base::adjustfield) == ios_base::left ?
+                                     __wb + __len :
+                                     __wb,
+                                 __wb + __len,
+                                 __os,
+                                 __os.fill()).failed())
+                __os.setstate(ios_base::badbit | ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __os.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __os;
+}
+
+template<class _Traits>
+basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
+{
+    return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str));
+}
+
+template<class _Traits>
+basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
+{
+    const char *__s = (const char *) __str;
+    return _VSTD::__put_character_sequence(__os, __s, _Traits::length(__s));
+}
+
+template<class _Traits>
+basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
+{
+    const char *__s = (const char *) __str;
+    return _VSTD::__put_character_sequence(__os, __s, _Traits::length(__s));
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::put(char_type __c)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+            _Op __o(*this);
+            *__o = __c;
+            if (__o.failed())
+                this->setstate(ios_base::badbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __sen(*this);
+        if (__sen && __n)
+        {
+            if (this->rdbuf()->sputn(__s, __n) != __n)
+                this->setstate(ios_base::badbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::flush()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        if (this->rdbuf())
+        {
+            sentry __s(*this);
+            if (__s)
+            {
+                if (this->rdbuf()->pubsync() == -1)
+                    this->setstate(ios_base::badbit);
+            }
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_ostream<_CharT, _Traits>::pos_type
+basic_ostream<_CharT, _Traits>::tellp()
+{
+    if (this->fail())
+        return pos_type(-1);
+    return this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
+{
+    sentry __s(*this);
+    if (!this->fail())
+    {
+        if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
+            this->setstate(ios_base::failbit);
+    }
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
+{
+    sentry __s(*this);
+    if (!this->fail())
+    {
+        if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
+            this->setstate(ios_base::failbit);
+    }
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+endl(basic_ostream<_CharT, _Traits>& __os)
+{
+    __os.put(__os.widen('\n'));
+    __os.flush();
+    return __os;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+ends(basic_ostream<_CharT, _Traits>& __os)
+{
+    __os.put(_CharT());
+    return __os;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+flush(basic_ostream<_CharT, _Traits>& __os)
+{
+    __os.flush();
+    return __os;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Stream, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_lvalue_reference<_Stream>::value &&
+    is_base_of<ios_base, _Stream>::value,
+    _Stream&&
+>::type
+operator<<(_Stream&& __os, const _Tp& __x)
+{
+    __os << __x;
+    return _VSTD::move(__os);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const basic_string<_CharT, _Traits, _Allocator>& __str)
+{
+    return _VSTD::__put_character_sequence(__os, __str.data(), __str.size());
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
+{
+    return __os << __ec.category().name() << ':' << __ec.value();
+}
+
+template<class _CharT, class _Traits, class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
+{
+    return __os << __p.get();
+}
+
+template <class _CharT, class _Traits, size_t _Size>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
+{
+    return __os << __x.template to_string<_CharT, _Traits>
+                        (use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
+                         use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
+}
+
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<wchar_t>)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_OSTREAM

Property changes on: lab4/.minix-src/include/c++/ostream
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/ratio
===================================================================
--- lab4/.minix-src/include/c++/ratio	(nonexistent)
+++ lab4/.minix-src/include/c++/ratio	(revision 13)
@@ -0,0 +1,490 @@
+// -*- C++ -*-
+//===---------------------------- ratio -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_RATIO
+#define _LIBCPP_RATIO
+
+/*
+    ratio synopsis
+
+namespace std
+{
+
+template <intmax_t N, intmax_t D = 1>
+class ratio
+{
+public:
+    static constexpr intmax_t num;
+    static constexpr intmax_t den;
+    typedef ratio<num, den> type;
+};
+
+// ratio arithmetic
+template <class R1, class R2> using ratio_add = ...;
+template <class R1, class R2> using ratio_subtract = ...;
+template <class R1, class R2> using ratio_multiply = ...;
+template <class R1, class R2> using ratio_divide = ...;
+
+// ratio comparison
+template <class R1, class R2> struct ratio_equal;
+template <class R1, class R2> struct ratio_not_equal;
+template <class R1, class R2> struct ratio_less;
+template <class R1, class R2> struct ratio_less_equal;
+template <class R1, class R2> struct ratio_greater;
+template <class R1, class R2> struct ratio_greater_equal;
+
+// convenience SI typedefs
+typedef ratio<1, 1000000000000000000000000> yocto;  // not supported
+typedef ratio<1,    1000000000000000000000> zepto;  // not supported
+typedef ratio<1,       1000000000000000000> atto;
+typedef ratio<1,          1000000000000000> femto;
+typedef ratio<1,             1000000000000> pico;
+typedef ratio<1,                1000000000> nano;
+typedef ratio<1,                   1000000> micro;
+typedef ratio<1,                      1000> milli;
+typedef ratio<1,                       100> centi;
+typedef ratio<1,                        10> deci;
+typedef ratio<                       10, 1> deca;
+typedef ratio<                      100, 1> hecto;
+typedef ratio<                     1000, 1> kilo;
+typedef ratio<                  1000000, 1> mega;
+typedef ratio<               1000000000, 1> giga;
+typedef ratio<            1000000000000, 1> tera;
+typedef ratio<         1000000000000000, 1> peta;
+typedef ratio<      1000000000000000000, 1> exa;
+typedef ratio<   1000000000000000000000, 1> zetta;  // not supported
+typedef ratio<1000000000000000000000000, 1> yotta;  // not supported
+
+}
+*/
+
+#include <__config>
+#include <cstdint>
+#include <climits>
+#include <type_traits>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// __static_gcd
+
+template <intmax_t _Xp, intmax_t _Yp>
+struct __static_gcd
+{
+    static const intmax_t value = __static_gcd<_Yp, _Xp % _Yp>::value;
+};
+
+template <intmax_t _Xp>
+struct __static_gcd<_Xp, 0>
+{
+    static const intmax_t value = _Xp;
+};
+
+template <>
+struct __static_gcd<0, 0>
+{
+    static const intmax_t value = 1;
+};
+
+// __static_lcm
+
+template <intmax_t _Xp, intmax_t _Yp>
+struct __static_lcm
+{
+    static const intmax_t value = _Xp / __static_gcd<_Xp, _Yp>::value * _Yp;
+};
+
+template <intmax_t _Xp>
+struct __static_abs
+{
+    static const intmax_t value = _Xp < 0 ? -_Xp : _Xp;
+};
+
+template <intmax_t _Xp>
+struct __static_sign
+{
+    static const intmax_t value = _Xp == 0 ? 0 : (_Xp < 0 ? -1 : 1);
+};
+
+template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value>
+class __ll_add;
+
+template <intmax_t _Xp, intmax_t _Yp>
+class __ll_add<_Xp, _Yp, 1>
+{
+    static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+    static const intmax_t max = -min;
+
+    static_assert(_Xp <= max - _Yp, "overflow in __ll_add");
+public:
+    static const intmax_t value = _Xp + _Yp;
+};
+
+template <intmax_t _Xp, intmax_t _Yp>
+class __ll_add<_Xp, _Yp, 0>
+{
+public:
+    static const intmax_t value = _Xp;
+};
+
+template <intmax_t _Xp, intmax_t _Yp>
+class __ll_add<_Xp, _Yp, -1>
+{
+    static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+    static const intmax_t max = -min;
+
+    static_assert(min - _Yp <= _Xp, "overflow in __ll_add");
+public:
+    static const intmax_t value = _Xp + _Yp;
+};
+
+template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value>
+class __ll_sub;
+
+template <intmax_t _Xp, intmax_t _Yp>
+class __ll_sub<_Xp, _Yp, 1>
+{
+    static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+    static const intmax_t max = -min;
+
+    static_assert(min + _Yp <= _Xp, "overflow in __ll_sub");
+public:
+    static const intmax_t value = _Xp - _Yp;
+};
+
+template <intmax_t _Xp, intmax_t _Yp>
+class __ll_sub<_Xp, _Yp, 0>
+{
+public:
+    static const intmax_t value = _Xp;
+};
+
+template <intmax_t _Xp, intmax_t _Yp>
+class __ll_sub<_Xp, _Yp, -1>
+{
+    static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+    static const intmax_t max = -min;
+
+    static_assert(_Xp <= max + _Yp, "overflow in __ll_sub");
+public:
+    static const intmax_t value = _Xp - _Yp;
+};
+
+template <intmax_t _Xp, intmax_t _Yp>
+class __ll_mul
+{
+    static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
+    static const intmax_t min = nan + 1;
+    static const intmax_t max = -min;
+    static const intmax_t __a_x = __static_abs<_Xp>::value;
+    static const intmax_t __a_y = __static_abs<_Yp>::value;
+
+    static_assert(_Xp != nan && _Yp != nan && __a_x <= max / __a_y, "overflow in __ll_mul");
+public:
+    static const intmax_t value = _Xp * _Yp;
+};
+
+template <intmax_t _Yp>
+class __ll_mul<0, _Yp>
+{
+public:
+    static const intmax_t value = 0;
+};
+
+template <intmax_t _Xp>
+class __ll_mul<_Xp, 0>
+{
+public:
+    static const intmax_t value = 0;
+};
+
+template <>
+class __ll_mul<0, 0>
+{
+public:
+    static const intmax_t value = 0;
+};
+
+// Not actually used but left here in case needed in future maintenance
+template <intmax_t _Xp, intmax_t _Yp>
+class __ll_div
+{
+    static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
+    static const intmax_t min = nan + 1;
+    static const intmax_t max = -min;
+
+    static_assert(_Xp != nan && _Yp != nan && _Yp != 0, "overflow in __ll_div");
+public:
+    static const intmax_t value = _Xp / _Yp;
+};
+
+template <intmax_t _Num, intmax_t _Den = 1>
+class _LIBCPP_TYPE_VIS_ONLY ratio
+{
+    static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
+    static_assert(_Den != 0, "ratio divide by 0");
+    static_assert(__static_abs<_Den>::value >  0, "ratio denominator is out of range");
+    static _LIBCPP_CONSTEXPR const intmax_t __na = __static_abs<_Num>::value;
+    static _LIBCPP_CONSTEXPR const intmax_t __da = __static_abs<_Den>::value;
+    static _LIBCPP_CONSTEXPR const intmax_t __s = __static_sign<_Num>::value * __static_sign<_Den>::value;
+    static _LIBCPP_CONSTEXPR const intmax_t __gcd = __static_gcd<__na, __da>::value;
+public:
+    static _LIBCPP_CONSTEXPR const intmax_t num = __s * __na / __gcd;
+    static _LIBCPP_CONSTEXPR const intmax_t den = __da / __gcd;
+
+    typedef ratio<num, den> type;
+};
+
+template <intmax_t _Num, intmax_t _Den>
+_LIBCPP_CONSTEXPR const intmax_t ratio<_Num, _Den>::num;
+
+template <intmax_t _Num, intmax_t _Den>
+_LIBCPP_CONSTEXPR const intmax_t ratio<_Num, _Den>::den;
+
+template <class _Tp>                    struct __is_ratio                     : false_type {};
+template <intmax_t _Num, intmax_t _Den> struct __is_ratio<ratio<_Num, _Den> > : true_type  {};
+
+typedef ratio<1LL, 1000000000000000000LL> atto;
+typedef ratio<1LL,    1000000000000000LL> femto;
+typedef ratio<1LL,       1000000000000LL> pico;
+typedef ratio<1LL,          1000000000LL> nano;
+typedef ratio<1LL,             1000000LL> micro;
+typedef ratio<1LL,                1000LL> milli;
+typedef ratio<1LL,                 100LL> centi;
+typedef ratio<1LL,                  10LL> deci;
+typedef ratio<                 10LL, 1LL> deca;
+typedef ratio<                100LL, 1LL> hecto;
+typedef ratio<               1000LL, 1LL> kilo;
+typedef ratio<            1000000LL, 1LL> mega;
+typedef ratio<         1000000000LL, 1LL> giga;
+typedef ratio<      1000000000000LL, 1LL> tera;
+typedef ratio<   1000000000000000LL, 1LL> peta;
+typedef ratio<1000000000000000000LL, 1LL> exa;
+
+template <class _R1, class _R2>
+struct __ratio_multiply
+{
+private:
+    static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
+    static const intmax_t __gcd_d1_n2 = __static_gcd<_R1::den, _R2::num>::value;
+public:
+    typedef typename ratio
+        <
+            __ll_mul<_R1::num / __gcd_n1_d2, _R2::num / __gcd_d1_n2>::value,
+            __ll_mul<_R2::den / __gcd_n1_d2, _R1::den / __gcd_d1_n2>::value
+        >::type type;
+};
+
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2> using ratio_multiply
+                                    = typename __ratio_multiply<_R1, _R2>::type;
+
+#else  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2>
+struct _LIBCPP_TYPE_VIS_ONLY ratio_multiply
+    : public __ratio_multiply<_R1, _R2>::type {};
+
+#endif  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2>
+struct __ratio_divide
+{
+private:
+    static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+    static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+public:
+    typedef typename ratio
+        <
+            __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
+            __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
+        >::type type;
+};
+
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2> using ratio_divide
+                                      = typename __ratio_divide<_R1, _R2>::type;
+
+#else  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2>
+struct _LIBCPP_TYPE_VIS_ONLY ratio_divide
+    : public __ratio_divide<_R1, _R2>::type {};
+
+#endif  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2>
+struct __ratio_add
+{
+private:
+    static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+    static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+public:
+    typedef typename ratio_multiply
+        <
+            ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
+            ratio
+            <
+                __ll_add
+                <
+                    __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
+                    __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
+                >::value,
+                _R2::den
+            >
+        >::type type;
+};
+
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2> using ratio_add
+                                         = typename __ratio_add<_R1, _R2>::type;
+
+#else  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2>
+struct _LIBCPP_TYPE_VIS_ONLY ratio_add
+    : public __ratio_add<_R1, _R2>::type {};
+
+#endif  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2>
+struct __ratio_subtract
+{
+private:
+    static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+    static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+public:
+    typedef typename ratio_multiply
+        <
+            ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
+            ratio
+            <
+                __ll_sub
+                <
+                    __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
+                    __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
+                >::value,
+                _R2::den
+            >
+        >::type type;
+};
+
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2> using ratio_subtract
+                                    = typename __ratio_subtract<_R1, _R2>::type;
+
+#else  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+template <class _R1, class _R2>
+struct _LIBCPP_TYPE_VIS_ONLY ratio_subtract
+    : public __ratio_subtract<_R1, _R2>::type {};
+
+#endif  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+// ratio_equal
+
+template <class _R1, class _R2>
+struct _LIBCPP_TYPE_VIS_ONLY ratio_equal
+    : public _LIBCPP_BOOL_CONSTANT((_R1::num == _R2::num && _R1::den == _R2::den)) {};
+
+template <class _R1, class _R2>
+struct _LIBCPP_TYPE_VIS_ONLY ratio_not_equal
+    : public _LIBCPP_BOOL_CONSTANT((!ratio_equal<_R1, _R2>::value)) {};
+
+// ratio_less
+
+template <class _R1, class _R2, bool _Odd = false,
+          intmax_t _Q1 = _R1::num / _R1::den, intmax_t _M1 = _R1::num % _R1::den,
+          intmax_t _Q2 = _R2::num / _R2::den, intmax_t _M2 = _R2::num % _R2::den>
+struct __ratio_less1
+{
+    static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
+};
+
+template <class _R1, class _R2, bool _Odd, intmax_t _Qp>
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0>
+{
+    static const bool value = false;
+};
+
+template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2>
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2>
+{
+    static const bool value = !_Odd;
+};
+
+template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1>
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0>
+{
+    static const bool value = _Odd;
+};
+
+template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1,
+                                                        intmax_t _M2>
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2>
+{
+    static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
+                                            ratio<_R2::den, _M2>, !_Odd>::value;
+};
+
+template <class _R1, class _R2, intmax_t _S1 = __static_sign<_R1::num>::value,
+                                intmax_t _S2 = __static_sign<_R2::num>::value>
+struct __ratio_less
+{
+    static const bool value = _S1 < _S2;
+};
+
+template <class _R1, class _R2>
+struct __ratio_less<_R1, _R2, 1LL, 1LL>
+{
+    static const bool value = __ratio_less1<_R1, _R2>::value;
+};
+
+template <class _R1, class _R2>
+struct __ratio_less<_R1, _R2, -1LL, -1LL>
+{
+    static const bool value = __ratio_less1<ratio<-_R2::num, _R2::den>, ratio<-_R1::num, _R1::den> >::value;
+};
+
+template <class _R1, class _R2>
+struct _LIBCPP_TYPE_VIS_ONLY ratio_less
+    : public _LIBCPP_BOOL_CONSTANT((__ratio_less<_R1, _R2>::value)) {};
+
+template <class _R1, class _R2>
+struct _LIBCPP_TYPE_VIS_ONLY ratio_less_equal
+    : public _LIBCPP_BOOL_CONSTANT((!ratio_less<_R2, _R1>::value)) {};
+
+template <class _R1, class _R2>
+struct _LIBCPP_TYPE_VIS_ONLY ratio_greater
+    : public _LIBCPP_BOOL_CONSTANT((ratio_less<_R2, _R1>::value)) {};
+
+template <class _R1, class _R2>
+struct _LIBCPP_TYPE_VIS_ONLY ratio_greater_equal
+    : public _LIBCPP_BOOL_CONSTANT((!ratio_less<_R1, _R2>::value)) {};
+
+template <class _R1, class _R2>
+struct __ratio_gcd
+{
+    typedef ratio<__static_gcd<_R1::num, _R2::num>::value,
+                  __static_lcm<_R1::den, _R2::den>::value> type;
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_RATIO

Property changes on: lab4/.minix-src/include/c++/ratio
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/set
===================================================================
--- lab4/.minix-src/include/c++/set	(nonexistent)
+++ lab4/.minix-src/include/c++/set	(revision 13)
@@ -0,0 +1,1219 @@
+// -*- C++ -*-
+//===---------------------------- set -------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SET
+#define _LIBCPP_SET
+
+/*
+
+    set synopsis
+
+namespace std
+{
+
+template <class Key, class Compare = less<Key>,
+          class Allocator = allocator<Key>>
+class set
+{
+public:
+    // types:
+    typedef Key                                      key_type;
+    typedef key_type                                 value_type;
+    typedef Compare                                  key_compare;
+    typedef key_compare                              value_compare;
+    typedef Allocator                                allocator_type;
+    typedef typename allocator_type::reference       reference;
+    typedef typename allocator_type::const_reference const_reference;
+    typedef typename allocator_type::size_type       size_type;
+    typedef typename allocator_type::difference_type difference_type;
+    typedef typename allocator_type::pointer         pointer;
+    typedef typename allocator_type::const_pointer   const_pointer;
+
+    typedef implementation-defined                   iterator;
+    typedef implementation-defined                   const_iterator;
+    typedef std::reverse_iterator<iterator>          reverse_iterator;
+    typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
+
+    // construct/copy/destroy:
+    set()
+        noexcept(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_default_constructible<key_compare>::value &&
+            is_nothrow_copy_constructible<key_compare>::value);
+    explicit set(const value_compare& comp);
+    set(const value_compare& comp, const allocator_type& a);
+    template <class InputIterator>
+        set(InputIterator first, InputIterator last,
+            const value_compare& comp = value_compare());
+    template <class InputIterator>
+        set(InputIterator first, InputIterator last, const value_compare& comp,
+            const allocator_type& a);
+    set(const set& s);
+    set(set&& s)
+        noexcept(
+            is_nothrow_move_constructible<allocator_type>::value &&
+            is_nothrow_move_constructible<key_compare>::value);
+    explicit set(const allocator_type& a);
+    set(const set& s, const allocator_type& a);
+    set(set&& s, const allocator_type& a);
+    set(initializer_list<value_type> il, const value_compare& comp = value_compare());
+    set(initializer_list<value_type> il, const value_compare& comp,
+        const allocator_type& a);
+    template <class InputIterator>
+        set(InputIterator first, InputIterator last, const allocator_type& a)
+            : set(first, last, Compare(), a) {}  // C++14
+    set(initializer_list<value_type> il, const allocator_type& a)
+        : set(il, Compare(), a) {}  // C++14
+    ~set();
+
+    set& operator=(const set& s);
+    set& operator=(set&& s)
+        noexcept(
+            allocator_type::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<allocator_type>::value &&
+            is_nothrow_move_assignable<key_compare>::value);
+    set& operator=(initializer_list<value_type> il);
+
+    // iterators:
+          iterator begin() noexcept;
+    const_iterator begin() const noexcept;
+          iterator end() noexcept;
+    const_iterator end()   const noexcept;
+
+          reverse_iterator rbegin() noexcept;
+    const_reverse_iterator rbegin() const noexcept;
+          reverse_iterator rend() noexcept;
+    const_reverse_iterator rend()   const noexcept;
+
+    const_iterator         cbegin()  const noexcept;
+    const_iterator         cend()    const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    const_reverse_iterator crend()   const noexcept;
+
+    // capacity:
+    bool      empty()    const noexcept;
+    size_type size()     const noexcept;
+    size_type max_size() const noexcept;
+
+    // modifiers:
+    template <class... Args>
+        pair<iterator, bool> emplace(Args&&... args);
+    template <class... Args>
+        iterator emplace_hint(const_iterator position, Args&&... args);
+    pair<iterator,bool> insert(const value_type& v);
+    pair<iterator,bool> insert(value_type&& v);
+    iterator insert(const_iterator position, const value_type& v);
+    iterator insert(const_iterator position, value_type&& v);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+    void insert(initializer_list<value_type> il);
+
+    iterator  erase(const_iterator position);
+    iterator  erase(iterator position);  // C++14
+    size_type erase(const key_type& k);
+    iterator  erase(const_iterator first, const_iterator last);
+    void clear() noexcept;
+
+    void swap(set& s)
+        noexcept(
+            __is_nothrow_swappable<key_compare>::value &&
+            (!allocator_type::propagate_on_container_swap::value ||
+             __is_nothrow_swappable<allocator_type>::value));
+
+    // observers:
+    allocator_type get_allocator() const noexcept;
+    key_compare    key_comp()      const;
+    value_compare  value_comp()    const;
+
+    // set operations:
+          iterator find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    template<typename K>
+        iterator find(const K& x);
+    template<typename K>
+        const_iterator find(const K& x) const;  // C++14
+    template<typename K>
+      size_type count(const K& x) const;        // C++14
+
+    size_type      count(const key_type& k) const;
+          iterator lower_bound(const key_type& k);
+    const_iterator lower_bound(const key_type& k) const;
+    template<typename K>
+        iterator lower_bound(const K& x);              // C++14
+    template<typename K>
+        const_iterator lower_bound(const K& x) const;  // C++14
+
+          iterator upper_bound(const key_type& k);
+    const_iterator upper_bound(const key_type& k) const;
+    template<typename K>
+        iterator upper_bound(const K& x);              // C++14
+    template<typename K>
+        const_iterator upper_bound(const K& x) const;  // C++14
+    pair<iterator,iterator>             equal_range(const key_type& k);
+    pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+    template<typename K>
+        pair<iterator,iterator>             equal_range(const K& x);        // C++14
+    template<typename K>
+        pair<const_iterator,const_iterator> equal_range(const K& x) const;  // C++14
+};
+
+template <class Key, class Compare, class Allocator>
+bool
+operator==(const set<Key, Compare, Allocator>& x,
+           const set<Key, Compare, Allocator>& y);
+
+template <class Key, class Compare, class Allocator>
+bool
+operator< (const set<Key, Compare, Allocator>& x,
+           const set<Key, Compare, Allocator>& y);
+
+template <class Key, class Compare, class Allocator>
+bool
+operator!=(const set<Key, Compare, Allocator>& x,
+           const set<Key, Compare, Allocator>& y);
+
+template <class Key, class Compare, class Allocator>
+bool
+operator> (const set<Key, Compare, Allocator>& x,
+           const set<Key, Compare, Allocator>& y);
+
+template <class Key, class Compare, class Allocator>
+bool
+operator>=(const set<Key, Compare, Allocator>& x,
+           const set<Key, Compare, Allocator>& y);
+
+template <class Key, class Compare, class Allocator>
+bool
+operator<=(const set<Key, Compare, Allocator>& x,
+           const set<Key, Compare, Allocator>& y);
+
+// specialized algorithms:
+template <class Key, class Compare, class Allocator>
+void
+swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y)
+    noexcept(noexcept(x.swap(y)));
+
+template <class Key, class Compare = less<Key>,
+          class Allocator = allocator<Key>>
+class multiset
+{
+public:
+    // types:
+    typedef Key                                      key_type;
+    typedef key_type                                 value_type;
+    typedef Compare                                  key_compare;
+    typedef key_compare                              value_compare;
+    typedef Allocator                                allocator_type;
+    typedef typename allocator_type::reference       reference;
+    typedef typename allocator_type::const_reference const_reference;
+    typedef typename allocator_type::size_type       size_type;
+    typedef typename allocator_type::difference_type difference_type;
+    typedef typename allocator_type::pointer         pointer;
+    typedef typename allocator_type::const_pointer   const_pointer;
+
+    typedef implementation-defined                   iterator;
+    typedef implementation-defined                   const_iterator;
+    typedef std::reverse_iterator<iterator>          reverse_iterator;
+    typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
+
+    // construct/copy/destroy:
+    multiset()
+        noexcept(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_default_constructible<key_compare>::value &&
+            is_nothrow_copy_constructible<key_compare>::value);
+    explicit multiset(const value_compare& comp);
+    multiset(const value_compare& comp, const allocator_type& a);
+    template <class InputIterator>
+        multiset(InputIterator first, InputIterator last,
+                 const value_compare& comp = value_compare());
+    template <class InputIterator>
+        multiset(InputIterator first, InputIterator last,
+                 const value_compare& comp, const allocator_type& a);
+    multiset(const multiset& s);
+    multiset(multiset&& s)
+        noexcept(
+            is_nothrow_move_constructible<allocator_type>::value &&
+            is_nothrow_move_constructible<key_compare>::value);
+    explicit multiset(const allocator_type& a);
+    multiset(const multiset& s, const allocator_type& a);
+    multiset(multiset&& s, const allocator_type& a);
+    multiset(initializer_list<value_type> il, const value_compare& comp = value_compare());
+    multiset(initializer_list<value_type> il, const value_compare& comp,
+             const allocator_type& a);
+    template <class InputIterator>
+        multiset(InputIterator first, InputIterator last, const allocator_type& a)
+            : set(first, last, Compare(), a) {}  // C++14
+    multiset(initializer_list<value_type> il, const allocator_type& a)
+        : set(il, Compare(), a) {}  // C++14
+    ~multiset();
+
+    multiset& operator=(const multiset& s);
+    multiset& operator=(multiset&& s)
+        noexcept(
+            allocator_type::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<allocator_type>::value &&
+            is_nothrow_move_assignable<key_compare>::value);
+    multiset& operator=(initializer_list<value_type> il);
+
+    // iterators:
+          iterator begin() noexcept;
+    const_iterator begin() const noexcept;
+          iterator end() noexcept;
+    const_iterator end()   const noexcept;
+
+          reverse_iterator rbegin() noexcept;
+    const_reverse_iterator rbegin() const noexcept;
+          reverse_iterator rend() noexcept;
+    const_reverse_iterator rend()   const noexcept;
+
+    const_iterator         cbegin()  const noexcept;
+    const_iterator         cend()    const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    const_reverse_iterator crend()   const noexcept;
+
+    // capacity:
+    bool      empty()    const noexcept;
+    size_type size()     const noexcept;
+    size_type max_size() const noexcept;
+
+    // modifiers:
+    template <class... Args>
+        iterator emplace(Args&&... args);
+    template <class... Args>
+        iterator emplace_hint(const_iterator position, Args&&... args);
+    iterator insert(const value_type& v);
+    iterator insert(value_type&& v);
+    iterator insert(const_iterator position, const value_type& v);
+    iterator insert(const_iterator position, value_type&& v);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+    void insert(initializer_list<value_type> il);
+
+    iterator  erase(const_iterator position);
+    iterator  erase(iterator position);  // C++14
+    size_type erase(const key_type& k);
+    iterator  erase(const_iterator first, const_iterator last);
+    void clear() noexcept;
+
+    void swap(multiset& s)
+        noexcept(
+            __is_nothrow_swappable<key_compare>::value &&
+            (!allocator_type::propagate_on_container_swap::value ||
+             __is_nothrow_swappable<allocator_type>::value));
+
+    // observers:
+    allocator_type get_allocator() const noexcept;
+    key_compare    key_comp()      const;
+    value_compare  value_comp()    const;
+
+    // set operations:
+          iterator find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    template<typename K>
+        iterator find(const K& x);
+    template<typename K>
+        const_iterator find(const K& x) const;  // C++14
+
+    size_type      count(const key_type& k) const;
+          iterator lower_bound(const key_type& k);
+    const_iterator lower_bound(const key_type& k) const;
+    template<typename K>
+        iterator lower_bound(const K& x);              // C++14
+    template<typename K>
+        const_iterator lower_bound(const K& x) const;  // C++14
+
+          iterator upper_bound(const key_type& k);
+    const_iterator upper_bound(const key_type& k) const;
+    template<typename K>
+        iterator upper_bound(const K& x);              // C++14
+    template<typename K>
+        const_iterator upper_bound(const K& x) const;  // C++14
+
+    pair<iterator,iterator>             equal_range(const key_type& k);
+    pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+    template<typename K>
+        pair<iterator,iterator>             equal_range(const K& x);        // C++14
+    template<typename K>
+        pair<const_iterator,const_iterator> equal_range(const K& x) const;  // C++14
+};
+
+template <class Key, class Compare, class Allocator>
+bool
+operator==(const multiset<Key, Compare, Allocator>& x,
+           const multiset<Key, Compare, Allocator>& y);
+
+template <class Key, class Compare, class Allocator>
+bool
+operator< (const multiset<Key, Compare, Allocator>& x,
+           const multiset<Key, Compare, Allocator>& y);
+
+template <class Key, class Compare, class Allocator>
+bool
+operator!=(const multiset<Key, Compare, Allocator>& x,
+           const multiset<Key, Compare, Allocator>& y);
+
+template <class Key, class Compare, class Allocator>
+bool
+operator> (const multiset<Key, Compare, Allocator>& x,
+           const multiset<Key, Compare, Allocator>& y);
+
+template <class Key, class Compare, class Allocator>
+bool
+operator>=(const multiset<Key, Compare, Allocator>& x,
+           const multiset<Key, Compare, Allocator>& y);
+
+template <class Key, class Compare, class Allocator>
+bool
+operator<=(const multiset<Key, Compare, Allocator>& x,
+           const multiset<Key, Compare, Allocator>& y);
+
+// specialized algorithms:
+template <class Key, class Compare, class Allocator>
+void
+swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
+    noexcept(noexcept(x.swap(y)));
+
+}  // std
+
+*/
+
+#include <__config>
+#include <__tree>
+#include <functional>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Key, class _Compare = less<_Key>,
+          class _Allocator = allocator<_Key> >
+class _LIBCPP_TYPE_VIS_ONLY set
+{
+public:
+    // types:
+    typedef _Key                                     key_type;
+    typedef key_type                                 value_type;
+    typedef _Compare                                 key_compare;
+    typedef key_compare                              value_compare;
+    typedef _Allocator                               allocator_type;
+    typedef value_type&                              reference;
+    typedef const value_type&                        const_reference;
+
+private:
+    typedef __tree<value_type, value_compare, allocator_type> __base;
+    typedef allocator_traits<allocator_type>                  __alloc_traits;
+    typedef typename __base::__node_holder                    __node_holder;
+
+    __base __tree_;
+
+public:
+    typedef typename __base::pointer               pointer;
+    typedef typename __base::const_pointer         const_pointer;
+    typedef typename __base::size_type             size_type;
+    typedef typename __base::difference_type       difference_type;
+    typedef typename __base::const_iterator        iterator;
+    typedef typename __base::const_iterator        const_iterator;
+    typedef _VSTD::reverse_iterator<iterator>       reverse_iterator;
+    typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    set()
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_default_constructible<key_compare>::value &&
+            is_nothrow_copy_constructible<key_compare>::value)
+        : __tree_(value_compare()) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit set(const value_compare& __comp)
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_copy_constructible<key_compare>::value)
+        : __tree_(__comp) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit set(const value_compare& __comp, const allocator_type& __a)
+        : __tree_(__comp, __a) {}
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        set(_InputIterator __f, _InputIterator __l,
+            const value_compare& __comp = value_compare())
+        : __tree_(__comp)
+        {
+            insert(__f, __l);
+        }
+
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
+            const allocator_type& __a)
+        : __tree_(__comp, __a)
+        {
+            insert(__f, __l);
+        }
+
+#if _LIBCPP_STD_VER > 11
+        template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY 
+        set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+            : set(__f, __l, key_compare(), __a) {}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    set(const set& __s)
+        : __tree_(__s.__tree_)
+        {
+            insert(__s.begin(), __s.end());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    set& operator=(const set& __s)
+        {
+            __tree_ = __s.__tree_;
+            return *this;
+        }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    set(set&& __s)
+        _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+        : __tree_(_VSTD::move(__s.__tree_)) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit set(const allocator_type& __a)
+        : __tree_(__a) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    set(const set& __s, const allocator_type& __a)
+        : __tree_(__s.__tree_.value_comp(), __a)
+        {
+            insert(__s.begin(), __s.end());
+        }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    set(set&& __s, const allocator_type& __a);
+#endif
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
+        : __tree_(__comp)
+        {
+            insert(__il.begin(), __il.end());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    set(initializer_list<value_type> __il, const value_compare& __comp,
+        const allocator_type& __a)
+        : __tree_(__comp, __a)
+        {
+            insert(__il.begin(), __il.end());
+        }
+
+#if _LIBCPP_STD_VER > 11
+    _LIBCPP_INLINE_VISIBILITY 
+    set(initializer_list<value_type> __il, const allocator_type& __a)
+        : set(__il, key_compare(), __a) {}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    set& operator=(initializer_list<value_type> __il)
+        {
+            __tree_.__assign_unique(__il.begin(), __il.end());
+            return *this;
+        }
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    set& operator=(set&& __s)
+        _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
+        {
+            __tree_ = _VSTD::move(__s.__tree_);
+            return *this;
+        }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+          iterator begin() _NOEXCEPT       {return __tree_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+          iterator end() _NOEXCEPT         {return __tree_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()   const _NOEXCEPT {return __tree_.end();}
+
+    _LIBCPP_INLINE_VISIBILITY
+          reverse_iterator rbegin() _NOEXCEPT
+            {return reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rbegin() const _NOEXCEPT
+        {return const_reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+          reverse_iterator rend() _NOEXCEPT
+            {return reverse_iterator(begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rend() const _NOEXCEPT
+        {return const_reverse_iterator(begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin()  const _NOEXCEPT {return begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend() const _NOEXCEPT {return end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crend() const _NOEXCEPT {return rend();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT {return __tree_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
+
+    // modifiers:
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> emplace(_Args&&... __args)
+            {return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator emplace_hint(const_iterator __p, _Args&&... __args)
+            {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);}
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator,bool> insert(const value_type& __v)
+        {return __tree_.__insert_unique(__v);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator,bool> insert(value_type&& __v)
+        {return __tree_.__insert_unique(_VSTD::move(__v));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __p, const value_type& __v)
+        {return __tree_.__insert_unique(__p, __v);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __p, value_type&& __v)
+        {return __tree_.__insert_unique(__p, _VSTD::move(__v));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        void insert(_InputIterator __f, _InputIterator __l)
+        {
+            for (const_iterator __e = cend(); __f != __l; ++__f)
+                __tree_.__insert_unique(__e, *__f);
+        }
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    void insert(initializer_list<value_type> __il)
+        {insert(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator  erase(const_iterator __p) {return __tree_.erase(__p);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k)
+        {return __tree_.__erase_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator  erase(const_iterator __f, const_iterator __l)
+        {return __tree_.erase(__f, __l);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {__tree_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
+        {__tree_.swap(__s.__tree_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_compare    key_comp()      const {return __tree_.value_comp();}
+    _LIBCPP_INLINE_VISIBILITY
+    value_compare  value_comp()    const {return __tree_.value_comp();}
+
+    // set operations:
+    _LIBCPP_INLINE_VISIBILITY
+    iterator find(const key_type& __k)             {return __tree_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+    find(const _K2& __k)                           {return __tree_.find(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    find(const _K2& __k) const                     {return __tree_.find(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type      count(const key_type& __k) const
+        {return __tree_.__count_unique(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
+    count(const _K2& __k)                  {return __tree_.__count_unique(__k);}
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    iterator lower_bound(const key_type& __k)
+        {return __tree_.lower_bound(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator lower_bound(const key_type& __k) const
+        {return __tree_.lower_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+    lower_bound(const _K2& __k)       {return __tree_.lower_bound(__k);}
+
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator upper_bound(const key_type& __k)
+        {return __tree_.upper_bound(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator upper_bound(const key_type& __k) const
+        {return __tree_.upper_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+    upper_bound(const _K2& __k)       {return __tree_.upper_bound(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator,iterator> equal_range(const key_type& __k)
+        {return __tree_.__equal_range_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
+        {return __tree_.__equal_range_unique(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
+    equal_range(const _K2& __k)       {return __tree_.__equal_range_unique(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
+    equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);}
+#endif
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Compare, class _Allocator>
+set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
+    : __tree_(_VSTD::move(__s.__tree_), __a)
+{
+    if (__a != __s.get_allocator())
+    {
+        const_iterator __e = cend();
+        while (!__s.empty())
+            insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const set<_Key, _Compare, _Allocator>& __x,
+           const set<_Key, _Compare, _Allocator>& __y)
+{
+    return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const set<_Key, _Compare, _Allocator>& __x,
+           const set<_Key, _Compare, _Allocator>& __y)
+{
+    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const set<_Key, _Compare, _Allocator>& __x,
+           const set<_Key, _Compare, _Allocator>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const set<_Key, _Compare, _Allocator>& __x,
+           const set<_Key, _Compare, _Allocator>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const set<_Key, _Compare, _Allocator>& __x,
+           const set<_Key, _Compare, _Allocator>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const set<_Key, _Compare, _Allocator>& __x,
+           const set<_Key, _Compare, _Allocator>& __y)
+{
+    return !(__y < __x);
+}
+
+// specialized algorithms:
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(set<_Key, _Compare, _Allocator>& __x,
+     set<_Key, _Compare, _Allocator>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Key, class _Compare = less<_Key>,
+          class _Allocator = allocator<_Key> >
+class _LIBCPP_TYPE_VIS_ONLY multiset
+{
+public:
+    // types:
+    typedef _Key                                      key_type;
+    typedef key_type                                 value_type;
+    typedef _Compare                                  key_compare;
+    typedef key_compare                              value_compare;
+    typedef _Allocator                                allocator_type;
+    typedef value_type&                              reference;
+    typedef const value_type&                        const_reference;
+
+private:
+    typedef __tree<value_type, value_compare, allocator_type> __base;
+    typedef allocator_traits<allocator_type>                  __alloc_traits;
+    typedef typename __base::__node_holder                    __node_holder;
+
+    __base __tree_;
+
+public:
+    typedef typename __base::pointer               pointer;
+    typedef typename __base::const_pointer         const_pointer;
+    typedef typename __base::size_type             size_type;
+    typedef typename __base::difference_type       difference_type;
+    typedef typename __base::const_iterator        iterator;
+    typedef typename __base::const_iterator        const_iterator;
+    typedef _VSTD::reverse_iterator<iterator>       reverse_iterator;
+    typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
+
+    // construct/copy/destroy:
+    _LIBCPP_INLINE_VISIBILITY
+    multiset()
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_default_constructible<key_compare>::value &&
+            is_nothrow_copy_constructible<key_compare>::value)
+        : __tree_(value_compare()) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit multiset(const value_compare& __comp)
+        _NOEXCEPT_(
+            is_nothrow_default_constructible<allocator_type>::value &&
+            is_nothrow_copy_constructible<key_compare>::value)
+        : __tree_(__comp) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit multiset(const value_compare& __comp, const allocator_type& __a)
+        : __tree_(__comp, __a) {}
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        multiset(_InputIterator __f, _InputIterator __l,
+                 const value_compare& __comp = value_compare())
+        : __tree_(__comp)
+        {
+            insert(__f, __l);
+        }
+
+#if _LIBCPP_STD_VER > 11
+        template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY 
+        multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+            : multiset(__f, __l, key_compare(), __a) {}
+#endif
+
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        multiset(_InputIterator __f, _InputIterator __l,
+                 const value_compare& __comp, const allocator_type& __a)
+        : __tree_(__comp, __a)
+        {
+            insert(__f, __l);
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    multiset(const multiset& __s)
+        : __tree_(__s.__tree_.value_comp(),
+          __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
+        {
+            insert(__s.begin(), __s.end());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    multiset& operator=(const multiset& __s)
+        {
+            __tree_ = __s.__tree_;
+            return *this;
+        }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    multiset(multiset&& __s)
+        _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+        : __tree_(_VSTD::move(__s.__tree_)) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    explicit multiset(const allocator_type& __a)
+        : __tree_(__a) {}
+    _LIBCPP_INLINE_VISIBILITY
+    multiset(const multiset& __s, const allocator_type& __a)
+        : __tree_(__s.__tree_.value_comp(), __a)
+        {
+            insert(__s.begin(), __s.end());
+        }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    multiset(multiset&& __s, const allocator_type& __a);
+#endif
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
+        : __tree_(__comp)
+        {
+            insert(__il.begin(), __il.end());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    multiset(initializer_list<value_type> __il, const value_compare& __comp,
+        const allocator_type& __a)
+        : __tree_(__comp, __a)
+        {
+            insert(__il.begin(), __il.end());
+        }
+
+#if _LIBCPP_STD_VER > 11
+    _LIBCPP_INLINE_VISIBILITY 
+    multiset(initializer_list<value_type> __il, const allocator_type& __a)
+        : multiset(__il, key_compare(), __a) {}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    multiset& operator=(initializer_list<value_type> __il)
+        {
+            __tree_.__assign_multi(__il.begin(), __il.end());
+            return *this;
+        }
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    multiset& operator=(multiset&& __s)
+        _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
+        {
+            __tree_ = _VSTD::move(__s.__tree_);
+            return *this;
+        }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+          iterator begin() _NOEXCEPT       {return __tree_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+          iterator end() _NOEXCEPT         {return __tree_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()   const _NOEXCEPT {return __tree_.end();}
+
+    _LIBCPP_INLINE_VISIBILITY
+          reverse_iterator rbegin() _NOEXCEPT
+            {return reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rbegin() const _NOEXCEPT
+        {return const_reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+          reverse_iterator rend() _NOEXCEPT
+            {return       reverse_iterator(begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rend() const _NOEXCEPT
+        {return const_reverse_iterator(begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin()  const _NOEXCEPT {return begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend() const _NOEXCEPT {return end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crend() const _NOEXCEPT {return rend();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT {return __tree_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
+
+    // modifiers:
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator emplace(_Args&&... __args)
+            {return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator emplace_hint(const_iterator __p, _Args&&... __args)
+            {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const value_type& __v)
+        {return __tree_.__insert_multi(__v);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(value_type&& __v)
+        {return __tree_.__insert_multi(_VSTD::move(__v));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __p, const value_type& __v)
+        {return __tree_.__insert_multi(__p, __v);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __p, value_type&& __v)
+        {return __tree_.__insert_multi(_VSTD::move(__v));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        void insert(_InputIterator __f, _InputIterator __l)
+        {
+            for (const_iterator __e = cend(); __f != __l; ++__f)
+                __tree_.__insert_multi(__e, *__f);
+        }
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    void insert(initializer_list<value_type> __il)
+        {insert(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator  erase(const_iterator __p) {return __tree_.erase(__p);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator  erase(const_iterator __f, const_iterator __l)
+        {return __tree_.erase(__f, __l);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {__tree_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(multiset& __s)
+        _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
+        {__tree_.swap(__s.__tree_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_compare    key_comp()      const {return __tree_.value_comp();}
+    _LIBCPP_INLINE_VISIBILITY
+    value_compare  value_comp()    const {return __tree_.value_comp();}
+
+    // set operations:
+    _LIBCPP_INLINE_VISIBILITY
+    iterator find(const key_type& __k)             {return __tree_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
+    find(const _K2& __k)                           {return __tree_.find(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    find(const _K2& __k) const                     {return __tree_.find(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type      count(const key_type& __k) const
+        {return __tree_.__count_multi(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
+    count(const _K2& __k)                  {return __tree_.__count_multi(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator lower_bound(const key_type& __k)
+        {return __tree_.lower_bound(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator lower_bound(const key_type& __k) const
+            {return __tree_.lower_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
+    lower_bound(const _K2& __k)       {return __tree_.lower_bound(__k);}
+
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator upper_bound(const key_type& __k)
+            {return __tree_.upper_bound(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator upper_bound(const key_type& __k) const
+            {return __tree_.upper_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
+    upper_bound(const _K2& __k)       {return __tree_.upper_bound(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
+    upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator,iterator>             equal_range(const key_type& __k)
+            {return __tree_.__equal_range_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
+            {return __tree_.__equal_range_multi(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
+    equal_range(const _K2& __k)       {return __tree_.__equal_range_multi(__k);}
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
+    equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+#endif
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Compare, class _Allocator>
+multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
+    : __tree_(_VSTD::move(__s.__tree_), __a)
+{
+    if (__a != __s.get_allocator())
+    {
+        const_iterator __e = cend();
+        while (!__s.empty())
+            insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const multiset<_Key, _Compare, _Allocator>& __x,
+           const multiset<_Key, _Compare, _Allocator>& __y)
+{
+    return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const multiset<_Key, _Compare, _Allocator>& __x,
+           const multiset<_Key, _Compare, _Allocator>& __y)
+{
+    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
+           const multiset<_Key, _Compare, _Allocator>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const multiset<_Key, _Compare, _Allocator>& __x,
+           const multiset<_Key, _Compare, _Allocator>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
+           const multiset<_Key, _Compare, _Allocator>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
+           const multiset<_Key, _Compare, _Allocator>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Key, class _Compare, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(multiset<_Key, _Compare, _Allocator>& __x,
+     multiset<_Key, _Compare, _Allocator>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_SET

Property changes on: lab4/.minix-src/include/c++/set
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/stack
===================================================================
--- lab4/.minix-src/include/c++/stack	(nonexistent)
+++ lab4/.minix-src/include/c++/stack	(revision 13)
@@ -0,0 +1,292 @@
+// -*- C++ -*-
+//===---------------------------- stack -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_STACK
+#define _LIBCPP_STACK
+
+/*
+    stack synopsis
+
+namespace std
+{
+
+template <class T, class Container = deque<T>>
+class stack
+{
+public:
+    typedef Container                                container_type;
+    typedef typename container_type::value_type      value_type;
+    typedef typename container_type::reference       reference;
+    typedef typename container_type::const_reference const_reference;
+    typedef typename container_type::size_type       size_type;
+
+protected:
+    container_type c;
+
+public:
+    stack() = default;
+    ~stack() = default;
+
+    stack(const stack& q) = default;
+    stack(stack&& q) = default;
+
+    stack& operator=(const stack& q) = default;
+    stack& operator=(stack&& q) = default;
+
+    explicit stack(const container_type& c);
+    explicit stack(container_type&& c);
+    template <class Alloc> explicit stack(const Alloc& a);
+    template <class Alloc> stack(const container_type& c, const Alloc& a);
+    template <class Alloc> stack(container_type&& c, const Alloc& a);
+    template <class Alloc> stack(const stack& c, const Alloc& a);
+    template <class Alloc> stack(stack&& c, const Alloc& a);
+
+    bool empty() const;
+    size_type size() const;
+    reference top();
+    const_reference top() const;
+
+    void push(const value_type& x);
+    void push(value_type&& x);
+    template <class... Args> void emplace(Args&&... args);
+    void pop();
+
+    void swap(stack& c) noexcept(noexcept(swap(c, q.c)));
+};
+
+template <class T, class Container>
+  bool operator==(const stack<T, Container>& x, const stack<T, Container>& y);
+template <class T, class Container>
+  bool operator< (const stack<T, Container>& x, const stack<T, Container>& y);
+template <class T, class Container>
+  bool operator!=(const stack<T, Container>& x, const stack<T, Container>& y);
+template <class T, class Container>
+  bool operator> (const stack<T, Container>& x, const stack<T, Container>& y);
+template <class T, class Container>
+  bool operator>=(const stack<T, Container>& x, const stack<T, Container>& y);
+template <class T, class Container>
+  bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
+
+template <class T, class Container>
+  void swap(stack<T, Container>& x, stack<T, Container>& y)
+  noexcept(noexcept(x.swap(y)));
+
+}  // std
+
+*/
+
+#include <__config>
+#include <deque>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TYPE_VIS_ONLY stack;
+
+template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
+
+template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
+
+template <class _Tp, class _Container /*= deque<_Tp>*/>
+class _LIBCPP_TYPE_VIS_ONLY stack
+{
+public:
+    typedef _Container                               container_type;
+    typedef typename container_type::value_type      value_type;
+    typedef typename container_type::reference       reference;
+    typedef typename container_type::const_reference const_reference;
+    typedef typename container_type::size_type       size_type;
+
+protected:
+    container_type c;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    stack()
+        _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
+        : c() {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    stack(const stack& __q) : c(__q.c) {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    stack(stack&& __q)
+        _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
+        : c(_VSTD::move(__q.c)) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    stack& operator=(const stack& __q) {c = __q.c; return *this;}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    stack& operator=(stack&& __q)
+        _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
+        {c = _VSTD::move(__q.c); return *this;}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit stack(const container_type& __c) : c(__c) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit stack(const _Alloc& __a,
+                       typename enable_if<uses_allocator<container_type,
+                                                         _Alloc>::value>::type* = 0)
+            : c(__a) {}
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        stack(const container_type& __c, const _Alloc& __a,
+              typename enable_if<uses_allocator<container_type,
+                                                _Alloc>::value>::type* = 0)
+            : c(__c, __a) {}
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        stack(const stack& __s, const _Alloc& __a,
+              typename enable_if<uses_allocator<container_type,
+                                                _Alloc>::value>::type* = 0)
+            : c(__s.c, __a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        stack(container_type&& __c, const _Alloc& __a,
+              typename enable_if<uses_allocator<container_type,
+                                                _Alloc>::value>::type* = 0)
+            : c(_VSTD::move(__c), __a) {}
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        stack(stack&& __s, const _Alloc& __a,
+              typename enable_if<uses_allocator<container_type,
+                                                _Alloc>::value>::type* = 0)
+            : c(_VSTD::move(__s.c), __a) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty()     const      {return c.empty();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const      {return c.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    reference top()             {return c.back();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference top() const {return c.back();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void push(const value_type& __v) {c.push_back(__v);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        void emplace(_Args&&... __args)
+        {c.emplace_back(_VSTD::forward<_Args>(__args)...);}
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void pop() {c.pop_back();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(stack& __s)
+        _NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
+    {
+        using _VSTD::swap;
+        swap(c, __s.c);
+    }
+
+    template <class T1, class _C1>
+    friend
+    bool
+    operator==(const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
+
+    template <class T1, class _C1>
+    friend
+    bool
+    operator< (const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
+};
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
+{
+    return __x.c == __y.c;
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
+{
+    return __x.c < __y.c;
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Tp, class _Container>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Tp, class _Container, class _Alloc>
+struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<stack<_Tp, _Container>, _Alloc>
+    : public uses_allocator<_Container, _Alloc>
+{
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_STACK

Property changes on: lab4/.minix-src/include/c++/stack
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/strstream
===================================================================
--- lab4/.minix-src/include/c++/strstream	(nonexistent)
+++ lab4/.minix-src/include/c++/strstream	(revision 13)
@@ -0,0 +1,400 @@
+// -*- C++ -*-
+//===--------------------------- strstream --------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_STRSTREAM
+#define _LIBCPP_STRSTREAM
+
+/*
+    strstream synopsis
+
+class strstreambuf
+    : public basic_streambuf<char>
+{
+public:
+    explicit strstreambuf(streamsize alsize_arg = 0);
+    strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
+    strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
+    strstreambuf(const char* gnext_arg, streamsize n);
+
+    strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = 0);
+    strstreambuf(const signed char* gnext_arg, streamsize n);
+    strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = 0);
+    strstreambuf(const unsigned char* gnext_arg, streamsize n);
+
+    strstreambuf(strstreambuf&& rhs);
+    strstreambuf& operator=(strstreambuf&& rhs);
+
+    virtual ~strstreambuf();
+
+    void swap(strstreambuf& rhs);
+
+    void freeze(bool freezefl = true);
+    char* str();
+    int pcount() const;
+
+protected:
+    virtual int_type overflow (int_type c = EOF);
+    virtual int_type pbackfail(int_type c = EOF);
+    virtual int_type underflow();
+    virtual pos_type seekoff(off_type off, ios_base::seekdir way,
+                             ios_base::openmode which = ios_base::in | ios_base::out);
+    virtual pos_type seekpos(pos_type sp,
+                             ios_base::openmode which = ios_base::in | ios_base::out);
+    virtual streambuf* setbuf(char* s, streamsize n);
+
+private:
+    typedef T1 strstate;                // exposition only
+    static const strstate allocated;    // exposition only
+    static const strstate constant;     // exposition only
+    static const strstate dynamic;      // exposition only
+    static const strstate frozen;       // exposition only
+    strstate strmode;                   // exposition only
+    streamsize alsize;                  // exposition only
+    void* (*palloc)(size_t);            // exposition only
+    void (*pfree)(void*);               // exposition only
+};
+
+class istrstream
+    : public basic_istream<char>
+{
+public:
+    explicit istrstream(const char* s);
+    explicit istrstream(char* s);
+    istrstream(const char* s, streamsize n);
+    istrstream(char* s, streamsize n);
+
+    virtual ~istrstream();
+
+    strstreambuf* rdbuf() const;
+    char *str();
+
+private:
+    strstreambuf sb; // exposition only
+};
+
+class ostrstream
+    : public basic_ostream<char>
+{
+public:
+    ostrstream();
+    ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
+
+    virtual ~ostrstream();
+
+    strstreambuf* rdbuf() const;
+    void freeze(bool freezefl = true);
+    char* str();
+    int pcount() const;
+
+private:
+    strstreambuf sb; // exposition only
+};
+
+class strstream
+    : public basic_iostream<char>
+{
+public:
+    // Types
+    typedef char                        char_type;
+    typedef char_traits<char>::int_type int_type;
+    typedef char_traits<char>::pos_type pos_type;
+    typedef char_traits<char>::off_type off_type;
+
+    // constructors/destructor
+    strstream();
+    strstream(char* s, int n, ios_base::openmode mode = ios_base::in | ios_base::out);
+
+    virtual ~strstream();
+
+    // Members:
+    strstreambuf* rdbuf() const;
+    void freeze(bool freezefl = true);
+    int pcount() const;
+    char* str();
+
+private:
+    strstreambuf sb; // exposition only
+};
+
+}  // std
+
+*/
+
+#include <__config>
+#include <ostream>
+#include <istream>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+class _LIBCPP_TYPE_VIS strstreambuf
+    : public streambuf
+{
+public:
+    explicit strstreambuf(streamsize __alsize = 0);
+    strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
+    strstreambuf(char* __gnext, streamsize __n, char* __pbeg = 0);
+    strstreambuf(const char* __gnext, streamsize __n);
+
+    strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = 0);
+    strstreambuf(const signed char* __gnext, streamsize __n);
+    strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0);
+    strstreambuf(const unsigned char* __gnext, streamsize __n);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    strstreambuf(strstreambuf&& __rhs);
+    _LIBCPP_INLINE_VISIBILITY
+    strstreambuf& operator=(strstreambuf&& __rhs);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    virtual ~strstreambuf();
+
+    void swap(strstreambuf& __rhs);
+
+    void freeze(bool __freezefl = true);
+    char* str();
+    int pcount() const;
+
+protected:
+    virtual int_type overflow (int_type __c = EOF);
+    virtual int_type pbackfail(int_type __c = EOF);
+    virtual int_type underflow();
+    virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
+                             ios_base::openmode __which = ios_base::in | ios_base::out);
+    virtual pos_type seekpos(pos_type __sp,
+                             ios_base::openmode __which = ios_base::in | ios_base::out);
+
+private:
+    typedef unsigned __mode_type;
+    static const __mode_type __allocated = 0x01;
+    static const __mode_type __constant  = 0x02;
+    static const __mode_type __dynamic   = 0x04;
+    static const __mode_type __frozen    = 0x08;
+    static const streamsize    __default_alsize = 4096;
+
+    __mode_type __strmode_;
+    streamsize __alsize_;
+    void* (*__palloc_)(size_t);
+    void (*__pfree_)(void*);
+
+    void __init(char* __gnext, streamsize __n, char* __pbeg);
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+inline _LIBCPP_INLINE_VISIBILITY
+strstreambuf::strstreambuf(strstreambuf&& __rhs)
+    : streambuf(__rhs),
+      __strmode_(__rhs.__strmode_),
+      __alsize_(__rhs.__alsize_),
+      __palloc_(__rhs.__palloc_),
+      __pfree_(__rhs.__pfree_)
+{
+    __rhs.setg(nullptr, nullptr, nullptr);
+    __rhs.setp(nullptr, nullptr);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+strstreambuf&
+strstreambuf::operator=(strstreambuf&& __rhs)
+{
+    if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
+    {
+        if (__pfree_)
+            __pfree_(eback());
+        else
+            delete [] eback();
+    }
+    streambuf::operator=(__rhs);
+    __strmode_ = __rhs.__strmode_;
+    __alsize_ = __rhs.__alsize_;
+    __palloc_ = __rhs.__palloc_;
+    __pfree_ = __rhs.__pfree_;
+    __rhs.setg(nullptr, nullptr, nullptr);
+    __rhs.setp(nullptr, nullptr);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+class _LIBCPP_TYPE_VIS istrstream
+    : public istream
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit istrstream(const char* __s)
+        : istream(&__sb_), __sb_(__s, 0) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit istrstream(char* __s)
+        : istream(&__sb_), __sb_(__s, 0) {}
+    _LIBCPP_INLINE_VISIBILITY
+    istrstream(const char* __s, streamsize __n)
+        : istream(&__sb_), __sb_(__s, __n) {}
+    _LIBCPP_INLINE_VISIBILITY
+    istrstream(char* __s, streamsize __n)
+        : istream(&__sb_), __sb_(__s, __n) {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    istrstream(istrstream&& __rhs)
+        : istream(_VSTD::move(__rhs)),
+          __sb_(_VSTD::move(__rhs.__sb_))
+    {
+        istream::set_rdbuf(&__sb_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    istrstream& operator=(istrstream&& __rhs)
+    {
+        istream::operator=(_VSTD::move(__rhs));
+        __sb_ = _VSTD::move(__rhs.__sb_);
+        return *this;
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    virtual ~istrstream();
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(istrstream& __rhs)
+    {
+        istream::swap(__rhs);
+        __sb_.swap(__rhs.__sb_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
+    _LIBCPP_INLINE_VISIBILITY
+    char *str() {return __sb_.str();}
+
+private:
+    strstreambuf __sb_;
+};
+
+class _LIBCPP_TYPE_VIS ostrstream
+    : public ostream
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    ostrstream()
+        : ostream(&__sb_) {}
+    _LIBCPP_INLINE_VISIBILITY
+    ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
+        : ostream(&__sb_),
+          __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
+        {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    ostrstream(ostrstream&& __rhs)
+        : ostream(_VSTD::move(__rhs)),
+          __sb_(_VSTD::move(__rhs.__sb_))
+    {
+        ostream::set_rdbuf(&__sb_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    ostrstream& operator=(ostrstream&& __rhs)
+    {
+        ostream::operator=(_VSTD::move(__rhs));
+        __sb_ = _VSTD::move(__rhs.__sb_);
+        return *this;
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    virtual ~ostrstream();
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(ostrstream& __rhs)
+    {
+        ostream::swap(__rhs);
+        __sb_.swap(__rhs.__sb_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
+    _LIBCPP_INLINE_VISIBILITY
+    void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
+    _LIBCPP_INLINE_VISIBILITY
+    char* str()         {return __sb_.str();}
+    _LIBCPP_INLINE_VISIBILITY
+    int pcount() const  {return __sb_.pcount();}
+
+private:
+    strstreambuf __sb_; // exposition only
+};
+
+class _LIBCPP_TYPE_VIS strstream
+    : public iostream
+{
+public:
+    // Types
+    typedef char                        char_type;
+    typedef char_traits<char>::int_type int_type;
+    typedef char_traits<char>::pos_type pos_type;
+    typedef char_traits<char>::off_type off_type;
+
+    // constructors/destructor
+    _LIBCPP_INLINE_VISIBILITY
+    strstream()
+        : iostream(&__sb_) {}
+    _LIBCPP_INLINE_VISIBILITY
+    strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
+        : iostream(&__sb_),
+          __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
+        {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    strstream(strstream&& __rhs)
+        : iostream(_VSTD::move(__rhs)),
+          __sb_(_VSTD::move(__rhs.__sb_))
+    {
+        iostream::set_rdbuf(&__sb_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    strstream& operator=(strstream&& __rhs)
+    {
+        iostream::operator=(_VSTD::move(__rhs));
+        __sb_ = _VSTD::move(__rhs.__sb_);
+        return *this;
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    virtual ~strstream();
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(strstream& __rhs)
+    {
+        iostream::swap(__rhs);
+        __sb_.swap(__rhs.__sb_);
+    }
+
+    // Members:
+    _LIBCPP_INLINE_VISIBILITY
+    strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
+    _LIBCPP_INLINE_VISIBILITY
+    void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
+    _LIBCPP_INLINE_VISIBILITY
+    int pcount() const {return __sb_.pcount();}
+    _LIBCPP_INLINE_VISIBILITY
+    char* str()        {return __sb_.str();}
+
+private:
+    strstreambuf __sb_; // exposition only
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_STRSTREAM

Property changes on: lab4/.minix-src/include/c++/strstream
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/regex
===================================================================
--- lab4/.minix-src/include/c++/regex	(nonexistent)
+++ lab4/.minix-src/include/c++/regex	(revision 13)
@@ -0,0 +1,6510 @@
+// -*- C++ -*-
+//===--------------------------- regex ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_REGEX
+#define _LIBCPP_REGEX
+
+/*
+    regex synopsis
+
+#include <initializer_list>
+
+namespace std
+{
+
+namespace regex_constants
+{
+
+emum syntax_option_type
+{
+    icase      = unspecified,
+    nosubs     = unspecified,
+    optimize   = unspecified,
+    collate    = unspecified,
+    ECMAScript = unspecified,
+    basic      = unspecified,
+    extended   = unspecified,
+    awk        = unspecified,
+    grep       = unspecified,
+    egrep      = unspecified
+};
+
+constexpr syntax_option_type operator~(syntax_option_type f);
+constexpr syntax_option_type operator&(syntax_option_type lhs, syntax_option_type rhs);
+constexpr syntax_option_type operator|(syntax_option_type lhs, syntax_option_type rhs);
+
+enum match_flag_type
+{
+    match_default     = 0,
+    match_not_bol     = unspecified,
+    match_not_eol     = unspecified,
+    match_not_bow     = unspecified,
+    match_not_eow     = unspecified,
+    match_any         = unspecified,
+    match_not_null    = unspecified,
+    match_continuous  = unspecified,
+    match_prev_avail  = unspecified,
+    format_default    = 0,
+    format_sed        = unspecified,
+    format_no_copy    = unspecified,
+    format_first_only = unspecified
+};
+
+constexpr match_flag_type operator~(match_flag_type f);
+constexpr match_flag_type operator&(match_flag_type lhs, match_flag_type rhs);
+constexpr match_flag_type operator|(match_flag_type lhs, match_flag_type rhs);
+
+enum error_type
+{
+    error_collate    = unspecified,
+    error_ctype      = unspecified,
+    error_escape     = unspecified,
+    error_backref    = unspecified,
+    error_brack      = unspecified,
+    error_paren      = unspecified,
+    error_brace      = unspecified,
+    error_badbrace   = unspecified,
+    error_range      = unspecified,
+    error_space      = unspecified,
+    error_badrepeat  = unspecified,
+    error_complexity = unspecified,
+    error_stack      = unspecified
+};
+
+}  // regex_constants
+
+class regex_error
+    : public runtime_error
+{
+public:
+    explicit regex_error(regex_constants::error_type ecode);
+    regex_constants::error_type code() const;
+};
+
+template <class charT>
+struct regex_traits
+{
+public:
+    typedef charT                   char_type;
+    typedef basic_string<char_type> string_type;
+    typedef locale                  locale_type;
+    typedef /bitmask_type/          char_class_type;
+
+    regex_traits();
+
+    static size_t length(const char_type* p);
+    charT translate(charT c) const;
+    charT translate_nocase(charT c) const;
+    template <class ForwardIterator>
+        string_type
+        transform(ForwardIterator first, ForwardIterator last) const;
+    template <class ForwardIterator>
+        string_type
+        transform_primary( ForwardIterator first, ForwardIterator last) const;
+    template <class ForwardIterator>
+        string_type
+        lookup_collatename(ForwardIterator first, ForwardIterator last) const;
+    template <class ForwardIterator>
+        char_class_type
+        lookup_classname(ForwardIterator first, ForwardIterator last,
+                         bool icase = false) const;
+    bool isctype(charT c, char_class_type f) const;
+    int value(charT ch, int radix) const;
+    locale_type imbue(locale_type l);
+    locale_type getloc()const;
+};
+
+template <class charT, class traits = regex_traits<charT>>
+class basic_regex
+{
+public:
+    // types:
+    typedef charT                               value_type;
+    typedef regex_constants::syntax_option_type flag_type;
+    typedef typename traits::locale_type        locale_type;
+
+    // constants:
+    static constexpr regex_constants::syntax_option_type icase = regex_constants::icase;
+    static constexpr regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
+    static constexpr regex_constants::syntax_option_type optimize = regex_constants::optimize;
+    static constexpr regex_constants::syntax_option_type collate = regex_constants::collate;
+    static constexpr regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
+    static constexpr regex_constants::syntax_option_type basic = regex_constants::basic;
+    static constexpr regex_constants::syntax_option_type extended = regex_constants::extended;
+    static constexpr regex_constants::syntax_option_type awk = regex_constants::awk;
+    static constexpr regex_constants::syntax_option_type grep = regex_constants::grep;
+    static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep;
+
+    // construct/copy/destroy:
+    basic_regex();
+    explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
+    basic_regex(const charT* p, size_t len, flag_type f);
+    basic_regex(const basic_regex&);
+    basic_regex(basic_regex&&) noexcept;
+    template <class ST, class SA>
+        explicit basic_regex(const basic_string<charT, ST, SA>& p,
+                             flag_type f = regex_constants::ECMAScript);
+    template <class ForwardIterator>
+        basic_regex(ForwardIterator first, ForwardIterator last,
+                    flag_type f = regex_constants::ECMAScript);
+    basic_regex(initializer_list<charT>, flag_type = regex_constants::ECMAScript);
+
+    ~basic_regex();
+
+    basic_regex& operator=(const basic_regex&);
+    basic_regex& operator=(basic_regex&&) noexcept;
+    basic_regex& operator=(const charT* ptr);
+    basic_regex& operator=(initializer_list<charT> il);
+    template <class ST, class SA>
+        basic_regex& operator=(const basic_string<charT, ST, SA>& p);
+
+    // assign:
+    basic_regex& assign(const basic_regex& that);
+    basic_regex& assign(basic_regex&& that) noexcept;
+    basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
+    basic_regex& assign(const charT* p, size_t len, flag_type f);
+    template <class string_traits, class A>
+        basic_regex& assign(const basic_string<charT, string_traits, A>& s,
+                            flag_type f = regex_constants::ECMAScript);
+    template <class InputIterator>
+        basic_regex& assign(InputIterator first, InputIterator last,
+                            flag_type f = regex_constants::ECMAScript);
+    basic_regex& assign(initializer_list<charT>, flag_type = regex_constants::ECMAScript);
+
+    // const operations:
+    unsigned mark_count() const;
+    flag_type flags() const;
+
+    // locale:
+    locale_type imbue(locale_type loc);
+    locale_type getloc() const;
+
+    // swap:
+    void swap(basic_regex&);
+};
+
+typedef basic_regex<char>    regex;
+typedef basic_regex<wchar_t> wregex;
+
+template <class charT, class traits>
+    void swap(basic_regex<charT, traits>& e1, basic_regex<charT, traits>& e2);
+
+template <class BidirectionalIterator>
+class sub_match
+    : public pair<BidirectionalIterator, BidirectionalIterator>
+{
+public:
+    typedef typename iterator_traits<BidirectionalIterator>::value_type value_type;
+    typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
+    typedef BidirectionalIterator                                      iterator;
+    typedef basic_string<value_type>                                string_type;
+
+    bool matched;
+
+    constexpr sub_match();
+
+    difference_type length() const;
+    operator string_type() const;
+    string_type str() const;
+
+    int compare(const sub_match& s) const;
+    int compare(const string_type& s) const;
+    int compare(const value_type* s) const;
+};
+
+typedef sub_match<const char*>             csub_match;
+typedef sub_match<const wchar_t*>          wcsub_match;
+typedef sub_match<string::const_iterator>  ssub_match;
+typedef sub_match<wstring::const_iterator> wssub_match;
+
+template <class BiIter>
+    bool
+    operator==(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator!=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator<(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator<=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator>=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool
+    operator==(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool
+    operator!=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool
+    operator<(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+              const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool
+    operator>(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+              const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool operator>=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+                    const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool
+    operator<=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool
+    operator==(const sub_match<BiIter>& lhs,
+               const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool
+    operator!=(const sub_match<BiIter>& lhs,
+               const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool
+    operator<(const sub_match<BiIter>& lhs,
+              const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool operator>(const sub_match<BiIter>& lhs,
+                   const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool
+    operator>=(const sub_match<BiIter>& lhs,
+               const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter, class ST, class SA>
+    bool
+    operator<=(const sub_match<BiIter>& lhs,
+               const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter>
+    bool
+    operator==(typename iterator_traits<BiIter>::value_type const* lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator!=(typename iterator_traits<BiIter>::value_type const* lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator<(typename iterator_traits<BiIter>::value_type const* lhs,
+              const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator>(typename iterator_traits<BiIter>::value_type const* lhs,
+              const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator>=(typename iterator_traits<BiIter>::value_type const* lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator<=(typename iterator_traits<BiIter>::value_type const* lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator==(const sub_match<BiIter>& lhs,
+               typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+    bool
+    operator!=(const sub_match<BiIter>& lhs,
+               typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+    bool
+    operator<(const sub_match<BiIter>& lhs,
+              typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+    bool
+    operator>(const sub_match<BiIter>& lhs,
+              typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+    bool
+    operator>=(const sub_match<BiIter>& lhs,
+               typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+    bool
+    operator<=(const sub_match<BiIter>& lhs,
+               typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+    bool
+    operator==(typename iterator_traits<BiIter>::value_type const& lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator!=(typename iterator_traits<BiIter>::value_type const& lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator<(typename iterator_traits<BiIter>::value_type const& lhs,
+              const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator>(typename iterator_traits<BiIter>::value_type const& lhs,
+              const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator>=(typename iterator_traits<BiIter>::value_type const& lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator<=(typename iterator_traits<BiIter>::value_type const& lhs,
+               const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+    bool
+    operator==(const sub_match<BiIter>& lhs,
+               typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class BiIter>
+    bool
+    operator!=(const sub_match<BiIter>& lhs,
+               typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class BiIter>
+    bool
+    operator<(const sub_match<BiIter>& lhs,
+              typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class BiIter>
+    bool
+    operator>(const sub_match<BiIter>& lhs,
+              typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class BiIter>
+    bool
+    operator>=(const sub_match<BiIter>& lhs,
+               typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class BiIter>
+    bool
+    operator<=(const sub_match<BiIter>& lhs,
+               typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class charT, class ST, class BiIter>
+    basic_ostream<charT, ST>&
+    operator<<(basic_ostream<charT, ST>& os, const sub_match<BiIter>& m);
+
+template <class BidirectionalIterator,
+          class Allocator = allocator<sub_match<BidirectionalIterator>>>
+class match_results
+{
+public:
+    typedef sub_match<BidirectionalIterator>                  value_type;
+    typedef const value_type&                                 const_reference;
+    typedef value_type&                                       reference;
+    typedef /implementation-defined/                          const_iterator;
+    typedef const_iterator                                    iterator;
+    typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
+    typedef typename allocator_traits<Allocator>::size_type   size_type;
+    typedef Allocator                                         allocator_type;
+    typedef typename iterator_traits<BidirectionalIterator>::value_type char_type;
+    typedef basic_string<char_type>                           string_type;
+
+    // construct/copy/destroy:
+    explicit match_results(const Allocator& a = Allocator());
+    match_results(const match_results& m);
+    match_results(match_results&& m) noexcept;
+    match_results& operator=(const match_results& m);
+    match_results& operator=(match_results&& m);
+    ~match_results();
+
+    bool ready() const;
+
+    // size:
+    size_type size() const;
+    size_type max_size() const;
+    bool empty() const;
+
+    // element access:
+    difference_type length(size_type sub = 0) const;
+    difference_type position(size_type sub = 0) const;
+    string_type str(size_type sub = 0) const;
+    const_reference operator[](size_type n) const;
+
+    const_reference prefix() const;
+    const_reference suffix() const;
+
+    const_iterator begin() const;
+    const_iterator end() const;
+    const_iterator cbegin() const;
+    const_iterator cend() const;
+
+    // format:
+    template <class OutputIter>
+        OutputIter
+        format(OutputIter out, const char_type* fmt_first,
+               const char_type* fmt_last,
+               regex_constants::match_flag_type flags = regex_constants::format_default) const;
+    template <class OutputIter, class ST, class SA>
+        OutputIter
+        format(OutputIter out, const basic_string<char_type, ST, SA>& fmt,
+               regex_constants::match_flag_type flags = regex_constants::format_default) const;
+    template <class ST, class SA>
+        basic_string<char_type, ST, SA>
+        format(const basic_string<char_type, ST, SA>& fmt,
+               regex_constants::match_flag_type flags = regex_constants::format_default) const;
+    string_type
+        format(const char_type* fmt,
+               regex_constants::match_flag_type flags = regex_constants::format_default) const;
+
+    // allocator:
+    allocator_type get_allocator() const;
+
+    // swap:
+    void swap(match_results& that);
+};
+
+typedef match_results<const char*>             cmatch;
+typedef match_results<const wchar_t*>          wcmatch;
+typedef match_results<string::const_iterator>  smatch;
+typedef match_results<wstring::const_iterator> wsmatch;
+
+template <class BidirectionalIterator, class Allocator>
+    bool
+    operator==(const match_results<BidirectionalIterator, Allocator>& m1,
+               const match_results<BidirectionalIterator, Allocator>& m2);
+
+template <class BidirectionalIterator, class Allocator>
+    bool
+    operator!=(const match_results<BidirectionalIterator, Allocator>& m1,
+               const match_results<BidirectionalIterator, Allocator>& m2);
+
+template <class BidirectionalIterator, class Allocator>
+    void
+    swap(match_results<BidirectionalIterator, Allocator>& m1,
+         match_results<BidirectionalIterator, Allocator>& m2);
+
+template <class BidirectionalIterator, class Allocator, class charT, class traits>
+    bool
+    regex_match(BidirectionalIterator first, BidirectionalIterator last,
+                match_results<BidirectionalIterator, Allocator>& m,
+                const basic_regex<charT, traits>& e,
+                regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class BidirectionalIterator, class charT, class traits>
+    bool
+    regex_match(BidirectionalIterator first, BidirectionalIterator last,
+                const basic_regex<charT, traits>& e,
+                regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class charT, class Allocator, class traits>
+    bool
+    regex_match(const charT* str, match_results<const charT*, Allocator>& m,
+                const basic_regex<charT, traits>& e,
+                regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class ST, class SA, class Allocator, class charT, class traits>
+    bool
+    regex_match(const basic_string<charT, ST, SA>& s,
+                match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
+                const basic_regex<charT, traits>& e,
+                regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class ST, class SA, class Allocator, class charT, class traits>
+    bool
+    regex_match(const basic_string<charT, ST, SA>&& s,
+                match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
+                const basic_regex<charT, traits>& e,
+                regex_constants::match_flag_type flags = regex_constants::match_default) = delete; // C++14
+
+template <class charT, class traits>
+    bool
+    regex_match(const charT* str, const basic_regex<charT, traits>& e,
+                regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class ST, class SA, class charT, class traits>
+    bool
+    regex_match(const basic_string<charT, ST, SA>& s,
+                const basic_regex<charT, traits>& e,
+                regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class BidirectionalIterator, class Allocator, class charT, class traits>
+    bool
+    regex_search(BidirectionalIterator first, BidirectionalIterator last,
+                 match_results<BidirectionalIterator, Allocator>& m,
+                 const basic_regex<charT, traits>& e,
+                 regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class BidirectionalIterator, class charT, class traits>
+    bool
+    regex_search(BidirectionalIterator first, BidirectionalIterator last,
+                 const basic_regex<charT, traits>& e,
+                 regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class charT, class Allocator, class traits>
+    bool
+    regex_search(const charT* str, match_results<const charT*, Allocator>& m,
+                 const basic_regex<charT, traits>& e,
+                 regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class charT, class traits>
+    bool
+    regex_search(const charT* str, const basic_regex<charT, traits>& e,
+                 regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class ST, class SA, class charT, class traits>
+    bool
+    regex_search(const basic_string<charT, ST, SA>& s,
+                 const basic_regex<charT, traits>& e,
+                 regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class ST, class SA, class Allocator, class charT, class traits>
+    bool
+    regex_search(const basic_string<charT, ST, SA>& s,
+                 match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
+                 const basic_regex<charT, traits>& e,
+                 regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class ST, class SA, class Allocator, class charT, class traits>
+    bool
+    regex_search(const basic_string<charT, ST, SA>&& s,
+                 match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
+                 const basic_regex<charT, traits>& e,
+                 regex_constants::match_flag_type flags = regex_constants::match_default) = delete; // C++14
+
+template <class OutputIterator, class BidirectionalIterator,
+          class traits, class charT, class ST, class SA>
+    OutputIterator
+    regex_replace(OutputIterator out,
+                  BidirectionalIterator first, BidirectionalIterator last,
+                  const basic_regex<charT, traits>& e,
+                  const basic_string<charT, ST, SA>& fmt,
+                  regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class OutputIterator, class BidirectionalIterator,
+          class traits, class charT>
+    OutputIterator
+    regex_replace(OutputIterator out,
+                  BidirectionalIterator first, BidirectionalIterator last,
+                  const basic_regex<charT, traits>& e, const charT* fmt,
+                  regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class traits, class charT, class ST, class SA, class FST, class FSA>>
+    basic_string<charT, ST, SA>
+    regex_replace(const basic_string<charT, ST, SA>& s,
+                  const basic_regex<charT, traits>& e,
+                  const basic_string<charT, FST, FSA>& fmt,
+                  regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class traits, class charT, class ST, class SA>
+    basic_string<charT, ST, SA>
+    regex_replace(const basic_string<charT, ST, SA>& s,
+                  const basic_regex<charT, traits>& e, const charT* fmt,
+                  regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class traits, class charT, class ST, class SA>
+    basic_string<charT>
+    regex_replace(const charT* s,
+                  const basic_regex<charT, traits>& e,
+                  const basic_string<charT, ST, SA>& fmt,
+                  regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class traits, class charT>
+    basic_string<charT>
+    regex_replace(const charT* s,
+                  const basic_regex<charT, traits>& e,
+                  const charT* fmt,
+                  regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class BidirectionalIterator,
+          class charT = typename iterator_traits< BidirectionalIterator>::value_type,
+          class traits = regex_traits<charT>>
+class regex_iterator
+{
+public:
+    typedef basic_regex<charT, traits>           regex_type;
+    typedef match_results<BidirectionalIterator> value_type;
+    typedef ptrdiff_t                            difference_type;
+    typedef const value_type*                    pointer;
+    typedef const value_type&                    reference;
+    typedef forward_iterator_tag                 iterator_category;
+
+    regex_iterator();
+    regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
+                   const regex_type& re,
+                   regex_constants::match_flag_type m = regex_constants::match_default);
+    regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                   const regex_type&& __re,
+                   regex_constants::match_flag_type __m 
+                                     = regex_constants::match_default) = delete; // C++14
+    regex_iterator(const regex_iterator&);
+    regex_iterator& operator=(const regex_iterator&);
+
+    bool operator==(const regex_iterator&) const;
+    bool operator!=(const regex_iterator&) const;
+
+    const value_type& operator*() const;
+    const value_type* operator->() const;
+
+    regex_iterator& operator++();
+    regex_iterator operator++(int);
+};
+
+typedef regex_iterator<const char*>             cregex_iterator;
+typedef regex_iterator<const wchar_t*>          wcregex_iterator;
+typedef regex_iterator<string::const_iterator>  sregex_iterator;
+typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
+
+template <class BidirectionalIterator,
+          class charT = typename iterator_traits< BidirectionalIterator>::value_type,
+          class traits = regex_traits<charT>>
+class regex_token_iterator
+{
+public:
+    typedef basic_regex<charT, traits>       regex_type;
+    typedef sub_match<BidirectionalIterator> value_type;
+    typedef ptrdiff_t                        difference_type;
+    typedef const value_type*                pointer;
+    typedef const value_type&                reference;
+    typedef forward_iterator_tag             iterator_category;
+
+    regex_token_iterator();
+    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+                         const regex_type& re, int submatch = 0,
+                         regex_constants::match_flag_type m = regex_constants::match_default);
+    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+                         const regex_type&& re, int submatch = 0,
+                         regex_constants::match_flag_type m = regex_constants::match_default) = delete; // C++14
+    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+                         const regex_type& re, const vector<int>& submatches,
+                         regex_constants::match_flag_type m = regex_constants::match_default);
+    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+                         const regex_type&& re, const vector<int>& submatches,
+                         regex_constants::match_flag_type m = regex_constants::match_default) = delete; // C++14
+    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+                         const regex_type& re, initializer_list<int> submatches,
+                         regex_constants::match_flag_type m = regex_constants::match_default);
+    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+                         const regex_type&& re, initializer_list<int> submatches,
+                         regex_constants::match_flag_type m = regex_constants::match_default) = delete; // C++14
+    template <size_t N>
+        regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+                             const regex_type& re, const int (&submatches)[N],
+                             regex_constants::match_flag_type m = regex_constants::match_default);
+    template <size_t N>
+        regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+                             const regex_type& re, const int (&submatches)[N],
+                             regex_constants::match_flag_type m = regex_constants::match_default) = delete // C++14;
+    regex_token_iterator(const regex_token_iterator&);
+    regex_token_iterator& operator=(const regex_token_iterator&);
+
+    bool operator==(const regex_token_iterator&) const;
+    bool operator!=(const regex_token_iterator&) const;
+
+    const value_type& operator*() const;
+    const value_type* operator->() const;
+
+    regex_token_iterator& operator++();
+    regex_token_iterator operator++(int);
+};
+
+typedef regex_token_iterator<const char*>             cregex_token_iterator;
+typedef regex_token_iterator<const wchar_t*>          wcregex_token_iterator;
+typedef regex_token_iterator<string::const_iterator>  sregex_token_iterator;
+typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
+
+} // std
+*/
+
+#include <__config>
+#include <stdexcept>
+#include <__locale>
+#include <initializer_list>
+#include <utility>
+#include <iterator>
+#include <string>
+#include <memory>
+#include <vector>
+#include <deque>
+#include <cassert>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace regex_constants
+{
+
+// syntax_option_type
+
+enum syntax_option_type
+{
+    icase      = 1 << 0,
+    nosubs     = 1 << 1,
+    optimize   = 1 << 2,
+    collate    = 1 << 3,
+    ECMAScript = 0,
+    basic      = 1 << 4,
+    extended   = 1 << 5,
+    awk        = 1 << 6,
+    grep       = 1 << 7,
+    egrep      = 1 << 8
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+syntax_option_type
+operator~(syntax_option_type __x)
+{
+    return syntax_option_type(~int(__x) & 0x1FF);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+syntax_option_type
+operator&(syntax_option_type __x, syntax_option_type __y)
+{
+    return syntax_option_type(int(__x) & int(__y));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+syntax_option_type
+operator|(syntax_option_type __x, syntax_option_type __y)
+{
+    return syntax_option_type(int(__x) | int(__y));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+syntax_option_type
+operator^(syntax_option_type __x, syntax_option_type __y)
+{
+    return syntax_option_type(int(__x) ^ int(__y));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+syntax_option_type&
+operator&=(syntax_option_type& __x, syntax_option_type __y)
+{
+    __x = __x & __y;
+    return __x;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+syntax_option_type&
+operator|=(syntax_option_type& __x, syntax_option_type __y)
+{
+    __x = __x | __y;
+    return __x;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+syntax_option_type&
+operator^=(syntax_option_type& __x, syntax_option_type __y)
+{
+    __x = __x ^ __y;
+    return __x;
+}
+
+// match_flag_type
+
+enum match_flag_type
+{
+    match_default     = 0,
+    match_not_bol     = 1 << 0,
+    match_not_eol     = 1 << 1,
+    match_not_bow     = 1 << 2,
+    match_not_eow     = 1 << 3,
+    match_any         = 1 << 4,
+    match_not_null    = 1 << 5,
+    match_continuous  = 1 << 6,
+    match_prev_avail  = 1 << 7,
+    format_default    = 0,
+    format_sed        = 1 << 8,
+    format_no_copy    = 1 << 9,
+    format_first_only = 1 << 10,
+    __no_update_pos   = 1 << 11
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+match_flag_type
+operator~(match_flag_type __x)
+{
+    return match_flag_type(~int(__x) & 0x0FFF);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+match_flag_type
+operator&(match_flag_type __x, match_flag_type __y)
+{
+    return match_flag_type(int(__x) & int(__y));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+match_flag_type
+operator|(match_flag_type __x, match_flag_type __y)
+{
+    return match_flag_type(int(__x) | int(__y));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+match_flag_type
+operator^(match_flag_type __x, match_flag_type __y)
+{
+    return match_flag_type(int(__x) ^ int(__y));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+match_flag_type&
+operator&=(match_flag_type& __x, match_flag_type __y)
+{
+    __x = __x & __y;
+    return __x;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+match_flag_type&
+operator|=(match_flag_type& __x, match_flag_type __y)
+{
+    __x = __x | __y;
+    return __x;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+match_flag_type&
+operator^=(match_flag_type& __x, match_flag_type __y)
+{
+    __x = __x ^ __y;
+    return __x;
+}
+
+enum error_type
+{
+    error_collate = 1,
+    error_ctype,
+    error_escape,
+    error_backref,
+    error_brack,
+    error_paren,
+    error_brace,
+    error_badbrace,
+    error_range,
+    error_space,
+    error_badrepeat,
+    error_complexity,
+    error_stack,
+    __re_err_grammar,
+    __re_err_empty,
+    __re_err_unknown
+};
+
+}  // regex_constants
+
+class _LIBCPP_EXCEPTION_ABI regex_error
+    : public runtime_error
+{
+    regex_constants::error_type __code_;
+public:
+    explicit regex_error(regex_constants::error_type __ecode);
+    virtual ~regex_error() throw();
+     _LIBCPP_INLINE_VISIBILITY
+    regex_constants::error_type code() const {return __code_;}
+};
+
+template <regex_constants::error_type _Ev>
+_LIBCPP_ALWAYS_INLINE
+void __throw_regex_error()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    throw regex_error(_Ev);
+#else
+    assert(!"regex_error");
+#endif
+}
+
+template <class _CharT>
+struct _LIBCPP_TYPE_VIS_ONLY regex_traits
+{
+public:
+    typedef _CharT                  char_type;
+    typedef basic_string<char_type> string_type;
+    typedef locale                  locale_type;
+    typedef ctype_base::mask        char_class_type;
+
+    static const char_class_type __regex_word = 0x80;
+private:
+    locale __loc_;
+    const ctype<char_type>* __ct_;
+    const collate<char_type>* __col_;
+
+public:
+    regex_traits();
+
+    _LIBCPP_INLINE_VISIBILITY
+    static size_t length(const char_type* __p)
+        {return char_traits<char_type>::length(__p);}
+    _LIBCPP_INLINE_VISIBILITY
+    char_type translate(char_type __c) const {return __c;}
+    char_type translate_nocase(char_type __c) const;
+    template <class _ForwardIterator>
+        string_type
+        transform(_ForwardIterator __f, _ForwardIterator __l) const;
+    template <class _ForwardIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        string_type
+        transform_primary( _ForwardIterator __f, _ForwardIterator __l) const
+            {return __transform_primary(__f, __l, char_type());}
+    template <class _ForwardIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        string_type
+        lookup_collatename(_ForwardIterator __f, _ForwardIterator __l) const
+            {return __lookup_collatename(__f, __l, char_type());}
+    template <class _ForwardIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        char_class_type
+        lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
+                         bool __icase = false) const
+            {return __lookup_classname(__f, __l, __icase, char_type());}
+    bool isctype(char_type __c, char_class_type __m) const;
+    _LIBCPP_INLINE_VISIBILITY
+    int value(char_type __ch, int __radix) const
+        {return __regex_traits_value(__ch, __radix);}
+    locale_type imbue(locale_type __l);
+    _LIBCPP_INLINE_VISIBILITY
+    locale_type getloc()const {return __loc_;}
+
+private:
+    void __init();
+
+    template <class _ForwardIterator>
+        string_type
+        __transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const;
+    template <class _ForwardIterator>
+        string_type
+        __transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
+
+    template <class _ForwardIterator>
+        string_type
+        __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const;
+    template <class _ForwardIterator>
+        string_type
+        __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
+
+    template <class _ForwardIterator>
+        char_class_type
+        __lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
+                           bool __icase, char) const;
+    template <class _ForwardIterator>
+        char_class_type
+        __lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
+                           bool __icase, wchar_t) const;
+
+    static int __regex_traits_value(unsigned char __ch, int __radix);
+    _LIBCPP_INLINE_VISIBILITY
+    int __regex_traits_value(char __ch, int __radix) const
+        {return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
+    int __regex_traits_value(wchar_t __ch, int __radix) const;
+};
+
+template <class _CharT>
+const typename regex_traits<_CharT>::char_class_type
+regex_traits<_CharT>::__regex_word;
+
+template <class _CharT>
+regex_traits<_CharT>::regex_traits()
+{
+    __init();
+}
+
+template <class _CharT>
+typename regex_traits<_CharT>::char_type
+regex_traits<_CharT>::translate_nocase(char_type __c) const
+{
+    return __ct_->tolower(__c);
+}
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::string_type
+regex_traits<_CharT>::transform(_ForwardIterator __f, _ForwardIterator __l) const
+{
+    string_type __s(__f, __l);
+    return __col_->transform(__s.data(), __s.data() + __s.size());
+}
+
+template <class _CharT>
+void
+regex_traits<_CharT>::__init()
+{
+    __ct_ = &use_facet<ctype<char_type> >(__loc_);
+    __col_ = &use_facet<collate<char_type> >(__loc_);
+}
+
+template <class _CharT>
+typename regex_traits<_CharT>::locale_type
+regex_traits<_CharT>::imbue(locale_type __l)
+{
+    locale __r = __loc_;
+    __loc_ = __l;
+    __init();
+    return __r;
+}
+
+// transform_primary is very FreeBSD-specific
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::string_type
+regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
+                                          _ForwardIterator __l, char) const
+{
+    const string_type __s(__f, __l);
+    string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
+    switch (__d.size())
+    {
+    case 1:
+        break;
+    case 12:
+        __d[11] = __d[3];
+        break;
+    default:
+        __d.clear();
+        break;
+    }
+    return __d;
+}
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::string_type
+regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
+                                          _ForwardIterator __l, wchar_t) const
+{
+    const string_type __s(__f, __l);
+    string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
+    switch (__d.size())
+    {
+    case 1:
+        break;
+    case 3:
+        __d[2] = __d[0];
+        break;
+    default:
+        __d.clear();
+        break;
+    }
+    return __d;
+}
+
+// lookup_collatename is very FreeBSD-specific
+
+_LIBCPP_FUNC_VIS string __get_collation_name(const char* __s);
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::string_type
+regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
+                                           _ForwardIterator __l, char) const
+{
+    string_type __s(__f, __l);
+    string_type __r;
+    if (!__s.empty())
+    {
+        __r = __get_collation_name(__s.c_str());
+        if (__r.empty() && __s.size() <= 2)
+        {
+            __r = __col_->transform(__s.data(), __s.data() + __s.size());
+            if (__r.size() == 1 || __r.size() == 12)
+                __r = __s;
+            else
+                __r.clear();
+        }
+    }
+    return __r;
+}
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::string_type
+regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
+                                           _ForwardIterator __l, wchar_t) const
+{
+    string_type __s(__f, __l);
+    string __n;
+    __n.reserve(__s.size());
+    for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end();
+                                                              __i != __e; ++__i)
+    {
+        if (static_cast<unsigned>(*__i) >= 127)
+            return string_type();
+        __n.push_back(char(*__i));
+    }
+    string_type __r;
+    if (!__s.empty())
+    {
+        __n = __get_collation_name(__n.c_str());
+        if (!__n.empty())
+            __r.assign(__n.begin(), __n.end());
+        else if (__s.size() <= 2)
+        {
+            __r = __col_->transform(__s.data(), __s.data() + __s.size());
+            if (__r.size() == 1 || __r.size() == 3)
+                __r = __s;
+            else
+                __r.clear();
+        }
+    }
+    return __r;
+}
+
+// lookup_classname
+
+regex_traits<char>::char_class_type _LIBCPP_FUNC_VIS
+__get_classname(const char* __s, bool __icase);
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::char_class_type
+regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f,
+                                         _ForwardIterator __l,
+                                         bool __icase, char) const
+{
+    string_type __s(__f, __l);
+    __ct_->tolower(&__s[0], &__s[0] + __s.size());
+    return __get_classname(__s.c_str(), __icase);
+}
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::char_class_type
+regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f,
+                                         _ForwardIterator __l,
+                                         bool __icase, wchar_t) const
+{
+    string_type __s(__f, __l);
+    __ct_->tolower(&__s[0], &__s[0] + __s.size());
+    string __n;
+    __n.reserve(__s.size());
+    for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end();
+                                                              __i != __e; ++__i)
+    {
+        if (static_cast<unsigned>(*__i) >= 127)
+            return char_class_type();
+        __n.push_back(char(*__i));
+    }
+    return __get_classname(__n.c_str(), __icase);
+}
+
+template <class _CharT>
+bool
+regex_traits<_CharT>::isctype(char_type __c, char_class_type __m) const
+{
+    if (__ct_->is(__m, __c))
+        return true;
+    return (__c == '_' && (__m & __regex_word));
+}
+
+template <class _CharT>
+int
+regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
+{
+    if ((__ch & 0xF8u) == 0x30)  // '0' <= __ch && __ch <= '7'
+        return __ch - '0';
+    if (__radix != 8)
+    {
+        if ((__ch & 0xFEu) == 0x38)  // '8' <= __ch && __ch <= '9'
+            return __ch - '0';
+        if (__radix == 16)
+        {
+            __ch |= 0x20;  // tolower
+            if ('a' <= __ch && __ch <= 'f')
+                return __ch - ('a' - 10);
+        }
+    }
+    return -1;
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+int
+regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
+{
+    return __regex_traits_value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
+}
+
+template <class _CharT> class __node;
+
+template <class _BidirectionalIterator> class _LIBCPP_TYPE_VIS_ONLY sub_match;
+
+template <class _BidirectionalIterator,
+          class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
+class _LIBCPP_TYPE_VIS_ONLY match_results;
+
+template <class _CharT>
+struct __state
+{
+    enum
+    {
+        __end_state = -1000,
+        __consume_input,  // -999
+        __begin_marked_expr, // -998
+        __end_marked_expr,   // -997
+        __pop_state,           // -996
+        __accept_and_consume,  // -995
+        __accept_but_not_consume,  // -994
+        __reject,                  // -993
+        __split,
+        __repeat
+    };
+
+    int __do_;
+    const _CharT* __first_;
+    const _CharT* __current_;
+    const _CharT* __last_;
+    vector<sub_match<const _CharT*> > __sub_matches_;
+    vector<pair<size_t, const _CharT*> > __loop_data_;
+    const __node<_CharT>* __node_;
+    regex_constants::match_flag_type __flags_;
+    bool __at_first_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __state()
+        : __do_(0), __first_(nullptr), __current_(nullptr), __last_(nullptr),
+          __node_(nullptr), __flags_() {}
+};
+
+// __node
+
+template <class _CharT>
+class __node
+{
+    __node(const __node&);
+    __node& operator=(const __node&);
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __node() {}
+    _LIBCPP_INLINE_VISIBILITY
+    virtual ~__node() {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    virtual void __exec(__state&) const {};
+    _LIBCPP_INLINE_VISIBILITY
+    virtual void __exec_split(bool, __state&) const {};
+};
+
+// __end_state
+
+template <class _CharT>
+class __end_state
+    : public __node<_CharT>
+{
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __end_state() {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__end_state<_CharT>::__exec(__state& __s) const
+{
+    __s.__do_ = __state::__end_state;
+}
+
+// __has_one_state
+
+template <class _CharT>
+class __has_one_state
+    : public __node<_CharT>
+{
+    __node<_CharT>* __first_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __has_one_state(__node<_CharT>* __s)
+        : __first_(__s) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __node<_CharT>*  first() const {return __first_;}
+    _LIBCPP_INLINE_VISIBILITY
+    __node<_CharT>*& first()       {return __first_;}
+};
+
+// __owns_one_state
+
+template <class _CharT>
+class __owns_one_state
+    : public __has_one_state<_CharT>
+{
+    typedef __has_one_state<_CharT> base;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __owns_one_state(__node<_CharT>* __s)
+        : base(__s) {}
+
+    virtual ~__owns_one_state();
+};
+
+template <class _CharT>
+__owns_one_state<_CharT>::~__owns_one_state()
+{
+    delete this->first();
+}
+
+// __empty_state
+
+template <class _CharT>
+class __empty_state
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __empty_state(__node<_CharT>* __s)
+        : base(__s) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__empty_state<_CharT>::__exec(__state& __s) const
+{
+    __s.__do_ = __state::__accept_but_not_consume;
+    __s.__node_ = this->first();
+}
+
+// __empty_non_own_state
+
+template <class _CharT>
+class __empty_non_own_state
+    : public __has_one_state<_CharT>
+{
+    typedef __has_one_state<_CharT> base;
+
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __empty_non_own_state(__node<_CharT>* __s)
+        : base(__s) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__empty_non_own_state<_CharT>::__exec(__state& __s) const
+{
+    __s.__do_ = __state::__accept_but_not_consume;
+    __s.__node_ = this->first();
+}
+
+// __repeat_one_loop
+
+template <class _CharT>
+class __repeat_one_loop
+    : public __has_one_state<_CharT>
+{
+    typedef __has_one_state<_CharT> base;
+
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __repeat_one_loop(__node<_CharT>* __s)
+        : base(__s) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__repeat_one_loop<_CharT>::__exec(__state& __s) const
+{
+    __s.__do_ = __state::__repeat;
+    __s.__node_ = this->first();
+}
+
+// __owns_two_states
+
+template <class _CharT>
+class __owns_two_states
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    base* __second_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __owns_two_states(__node<_CharT>* __s1, base* __s2)
+        : base(__s1), __second_(__s2) {}
+
+    virtual ~__owns_two_states();
+
+    _LIBCPP_INLINE_VISIBILITY
+    base*  second() const {return __second_;}
+    _LIBCPP_INLINE_VISIBILITY
+    base*& second()       {return __second_;}
+};
+
+template <class _CharT>
+__owns_two_states<_CharT>::~__owns_two_states()
+{
+    delete __second_;
+}
+
+// __loop
+
+template <class _CharT>
+class __loop
+    : public __owns_two_states<_CharT>
+{
+    typedef __owns_two_states<_CharT> base;
+
+    size_t __min_;
+    size_t __max_;
+    unsigned __loop_id_;
+    unsigned __mexp_begin_;
+    unsigned __mexp_end_;
+    bool __greedy_;
+
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __loop(unsigned __loop_id,
+                          __node<_CharT>* __s1, __owns_one_state<_CharT>* __s2,
+                          unsigned __mexp_begin, unsigned __mexp_end,
+                          bool __greedy = true,
+                          size_t __min = 0,
+                          size_t __max = numeric_limits<size_t>::max())
+        : base(__s1, __s2), __min_(__min), __max_(__max), __loop_id_(__loop_id),
+          __mexp_begin_(__mexp_begin), __mexp_end_(__mexp_end),
+          __greedy_(__greedy) {}
+
+    virtual void __exec(__state& __s) const;
+    virtual void __exec_split(bool __second, __state& __s) const;
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    void __init_repeat(__state& __s) const
+    {
+        __s.__loop_data_[__loop_id_].second = __s.__current_;
+        for (size_t __i = __mexp_begin_-1; __i != __mexp_end_-1; ++__i)
+        {
+            __s.__sub_matches_[__i].first = __s.__last_;
+            __s.__sub_matches_[__i].second = __s.__last_;
+            __s.__sub_matches_[__i].matched = false;
+        }
+    }
+};
+
+template <class _CharT>
+void
+__loop<_CharT>::__exec(__state& __s) const
+{
+    if (__s.__do_ == __state::__repeat)
+    {
+        bool __do_repeat = ++__s.__loop_data_[__loop_id_].first < __max_;
+        bool __do_alt = __s.__loop_data_[__loop_id_].first >= __min_;
+        if (__do_repeat && __do_alt &&
+                               __s.__loop_data_[__loop_id_].second == __s.__current_)
+            __do_repeat = false;
+        if (__do_repeat && __do_alt)
+            __s.__do_ = __state::__split;
+        else if (__do_repeat)
+        {
+            __s.__do_ = __state::__accept_but_not_consume;
+            __s.__node_ = this->first();
+            __init_repeat(__s);
+        }
+        else
+        {
+            __s.__do_ = __state::__accept_but_not_consume;
+            __s.__node_ = this->second();
+        }
+    }
+    else
+    {
+        __s.__loop_data_[__loop_id_].first = 0;
+        bool __do_repeat = 0 < __max_;
+        bool __do_alt = 0 >= __min_;
+        if (__do_repeat && __do_alt)
+            __s.__do_ = __state::__split;
+        else if (__do_repeat)
+        {
+            __s.__do_ = __state::__accept_but_not_consume;
+            __s.__node_ = this->first();
+            __init_repeat(__s);
+        }
+        else
+        {
+            __s.__do_ = __state::__accept_but_not_consume;
+            __s.__node_ = this->second();
+        }
+    }
+}
+
+template <class _CharT>
+void
+__loop<_CharT>::__exec_split(bool __second, __state& __s) const
+{
+    __s.__do_ = __state::__accept_but_not_consume;
+    if (__greedy_ != __second)
+    {
+        __s.__node_ = this->first();
+        __init_repeat(__s);
+    }
+    else
+        __s.__node_ = this->second();
+}
+
+// __alternate
+
+template <class _CharT>
+class __alternate
+    : public __owns_two_states<_CharT>
+{
+    typedef __owns_two_states<_CharT> base;
+
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __alternate(__owns_one_state<_CharT>* __s1,
+                         __owns_one_state<_CharT>* __s2)
+        : base(__s1, __s2) {}
+
+    virtual void __exec(__state& __s) const;
+    virtual void __exec_split(bool __second, __state& __s) const;
+};
+
+template <class _CharT>
+void
+__alternate<_CharT>::__exec(__state& __s) const
+{
+    __s.__do_ = __state::__split;
+}
+
+template <class _CharT>
+void
+__alternate<_CharT>::__exec_split(bool __second, __state& __s) const
+{
+    __s.__do_ = __state::__accept_but_not_consume;
+    if (__second)
+        __s.__node_ = this->second();
+    else
+        __s.__node_ = this->first();
+}
+
+// __begin_marked_subexpression
+
+template <class _CharT>
+class __begin_marked_subexpression
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    unsigned __mexp_;
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __begin_marked_subexpression(unsigned __mexp, __node<_CharT>* __s)
+        : base(__s), __mexp_(__mexp) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__begin_marked_subexpression<_CharT>::__exec(__state& __s) const
+{
+    __s.__do_ = __state::__accept_but_not_consume;
+    __s.__sub_matches_[__mexp_-1].first = __s.__current_;
+    __s.__node_ = this->first();
+}
+
+// __end_marked_subexpression
+
+template <class _CharT>
+class __end_marked_subexpression
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    unsigned __mexp_;
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __end_marked_subexpression(unsigned __mexp, __node<_CharT>* __s)
+        : base(__s), __mexp_(__mexp) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__end_marked_subexpression<_CharT>::__exec(__state& __s) const
+{
+    __s.__do_ = __state::__accept_but_not_consume;
+    __s.__sub_matches_[__mexp_-1].second = __s.__current_;
+    __s.__sub_matches_[__mexp_-1].matched = true;
+    __s.__node_ = this->first();
+}
+
+// __back_ref
+
+template <class _CharT>
+class __back_ref
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    unsigned __mexp_;
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __back_ref(unsigned __mexp, __node<_CharT>* __s)
+        : base(__s), __mexp_(__mexp) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__back_ref<_CharT>::__exec(__state& __s) const
+{
+    sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
+    if (__sm.matched)
+    {
+        ptrdiff_t __len = __sm.second - __sm.first;
+        if (__s.__last_ - __s.__current_ >= __len &&
+            _VSTD::equal(__sm.first, __sm.second, __s.__current_))
+        {
+            __s.__do_ = __state::__accept_but_not_consume;
+            __s.__current_ += __len;
+            __s.__node_ = this->first();
+        }
+        else
+        {
+            __s.__do_ = __state::__reject;
+            __s.__node_ = nullptr;
+        }
+    }
+    else
+    {
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+// __back_ref_icase
+
+template <class _CharT, class _Traits>
+class __back_ref_icase
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    _Traits __traits_;
+    unsigned __mexp_;
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __back_ref_icase(const _Traits& __traits, unsigned __mexp,
+                              __node<_CharT>* __s)
+        : base(__s), __traits_(__traits), __mexp_(__mexp) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT, class _Traits>
+void
+__back_ref_icase<_CharT, _Traits>::__exec(__state& __s) const
+{
+    sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
+    if (__sm.matched)
+    {
+        ptrdiff_t __len = __sm.second - __sm.first;
+        if (__s.__last_ - __s.__current_ >= __len)
+        {
+            for (ptrdiff_t __i = 0; __i < __len; ++__i)
+            {
+                if (__traits_.translate_nocase(__sm.first[__i]) !=
+                                __traits_.translate_nocase(__s.__current_[__i]))
+                    goto __not_equal;
+            }
+            __s.__do_ = __state::__accept_but_not_consume;
+            __s.__current_ += __len;
+            __s.__node_ = this->first();
+        }
+        else
+        {
+            __s.__do_ = __state::__reject;
+            __s.__node_ = nullptr;
+        }
+    }
+    else
+    {
+__not_equal:
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+// __back_ref_collate
+
+template <class _CharT, class _Traits>
+class __back_ref_collate
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    _Traits __traits_;
+    unsigned __mexp_;
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __back_ref_collate(const _Traits& __traits, unsigned __mexp,
+                              __node<_CharT>* __s)
+        : base(__s), __traits_(__traits), __mexp_(__mexp) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT, class _Traits>
+void
+__back_ref_collate<_CharT, _Traits>::__exec(__state& __s) const
+{
+    sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
+    if (__sm.matched)
+    {
+        ptrdiff_t __len = __sm.second - __sm.first;
+        if (__s.__last_ - __s.__current_ >= __len)
+        {
+            for (ptrdiff_t __i = 0; __i < __len; ++__i)
+            {
+                if (__traits_.translate(__sm.first[__i]) !=
+                                       __traits_.translate(__s.__current_[__i]))
+                    goto __not_equal;
+            }
+            __s.__do_ = __state::__accept_but_not_consume;
+            __s.__current_ += __len;
+            __s.__node_ = this->first();
+        }
+        else
+        {
+            __s.__do_ = __state::__reject;
+            __s.__node_ = nullptr;
+        }
+    }
+    else
+    {
+__not_equal:
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+// __word_boundary
+
+template <class _CharT, class _Traits>
+class __word_boundary
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    _Traits __traits_;
+    bool __invert_;
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __word_boundary(const _Traits& __traits, bool __invert,
+                             __node<_CharT>* __s)
+        : base(__s), __traits_(__traits), __invert_(__invert) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT, class _Traits>
+void
+__word_boundary<_CharT, _Traits>::__exec(__state& __s) const
+{
+    bool __is_word_b = false;
+    if (__s.__first_ != __s.__last_)
+    {
+        if (__s.__current_ == __s.__last_)
+        {
+            if (!(__s.__flags_ & regex_constants::match_not_eow))
+            {
+                _CharT __c = __s.__current_[-1];
+                __is_word_b = __c == '_' ||
+                              __traits_.isctype(__c, ctype_base::alnum);
+            }
+        }
+        else if (__s.__current_ == __s.__first_ &&
+                !(__s.__flags_ & regex_constants::match_prev_avail))
+        {
+            if (!(__s.__flags_ & regex_constants::match_not_bow))
+            {
+                _CharT __c = *__s.__current_;
+                __is_word_b = __c == '_' ||
+                              __traits_.isctype(__c, ctype_base::alnum);
+            }
+        }
+        else
+        {
+            _CharT __c1 = __s.__current_[-1];
+            _CharT __c2 = *__s.__current_;
+            bool __is_c1_b = __c1 == '_' ||
+                             __traits_.isctype(__c1, ctype_base::alnum);
+            bool __is_c2_b = __c2 == '_' ||
+                             __traits_.isctype(__c2, ctype_base::alnum);
+            __is_word_b = __is_c1_b != __is_c2_b;
+        }
+    }
+    if (__is_word_b != __invert_)
+    {
+        __s.__do_ = __state::__accept_but_not_consume;
+        __s.__node_ = this->first();
+    }
+    else
+    {
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+// __l_anchor
+
+template <class _CharT>
+class __l_anchor
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __l_anchor(__node<_CharT>* __s)
+        : base(__s) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__l_anchor<_CharT>::__exec(__state& __s) const
+{
+    if (__s.__at_first_ && __s.__current_ == __s.__first_ &&
+        !(__s.__flags_ & regex_constants::match_not_bol))
+    {
+        __s.__do_ = __state::__accept_but_not_consume;
+        __s.__node_ = this->first();
+    }
+    else
+    {
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+// __r_anchor
+
+template <class _CharT>
+class __r_anchor
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __r_anchor(__node<_CharT>* __s)
+        : base(__s) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__r_anchor<_CharT>::__exec(__state& __s) const
+{
+    if (__s.__current_ == __s.__last_ &&
+        !(__s.__flags_ & regex_constants::match_not_eol))
+    {
+        __s.__do_ = __state::__accept_but_not_consume;
+        __s.__node_ = this->first();
+    }
+    else
+    {
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+// __match_any
+
+template <class _CharT>
+class __match_any
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __match_any(__node<_CharT>* __s)
+        : base(__s) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__match_any<_CharT>::__exec(__state& __s) const
+{
+    if (__s.__current_ != __s.__last_ && *__s.__current_ != 0)
+    {
+        __s.__do_ = __state::__accept_and_consume;
+        ++__s.__current_;
+        __s.__node_ = this->first();
+    }
+    else
+    {
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+// __match_any_but_newline
+
+template <class _CharT>
+class __match_any_but_newline
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __match_any_but_newline(__node<_CharT>* __s)
+        : base(__s) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<char>::__exec(__state&) const;
+template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<wchar_t>::__exec(__state&) const;
+
+// __match_char
+
+template <class _CharT>
+class __match_char
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    _CharT __c_;
+
+    __match_char(const __match_char&);
+    __match_char& operator=(const __match_char&);
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __match_char(_CharT __c, __node<_CharT>* __s)
+        : base(__s), __c_(__c) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT>
+void
+__match_char<_CharT>::__exec(__state& __s) const
+{
+    if (__s.__current_ != __s.__last_ && *__s.__current_ == __c_)
+    {
+        __s.__do_ = __state::__accept_and_consume;
+        ++__s.__current_;
+        __s.__node_ = this->first();
+    }
+    else
+    {
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+// __match_char_icase
+
+template <class _CharT, class _Traits>
+class __match_char_icase
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    _Traits __traits_;
+    _CharT __c_;
+
+    __match_char_icase(const __match_char_icase&);
+    __match_char_icase& operator=(const __match_char_icase&);
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __match_char_icase(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
+        : base(__s), __traits_(__traits), __c_(__traits.translate_nocase(__c)) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT, class _Traits>
+void
+__match_char_icase<_CharT, _Traits>::__exec(__state& __s) const
+{
+    if (__s.__current_ != __s.__last_ &&
+        __traits_.translate_nocase(*__s.__current_) == __c_)
+    {
+        __s.__do_ = __state::__accept_and_consume;
+        ++__s.__current_;
+        __s.__node_ = this->first();
+    }
+    else
+    {
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+// __match_char_collate
+
+template <class _CharT, class _Traits>
+class __match_char_collate
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    _Traits __traits_;
+    _CharT __c_;
+
+    __match_char_collate(const __match_char_collate&);
+    __match_char_collate& operator=(const __match_char_collate&);
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __match_char_collate(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
+        : base(__s), __traits_(__traits), __c_(__traits.translate(__c)) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT, class _Traits>
+void
+__match_char_collate<_CharT, _Traits>::__exec(__state& __s) const
+{
+    if (__s.__current_ != __s.__last_ &&
+        __traits_.translate(*__s.__current_) == __c_)
+    {
+        __s.__do_ = __state::__accept_and_consume;
+        ++__s.__current_;
+        __s.__node_ = this->first();
+    }
+    else
+    {
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+// __bracket_expression
+
+template <class _CharT, class _Traits>
+class __bracket_expression
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+    typedef typename _Traits::string_type string_type;
+
+    _Traits __traits_;
+    vector<_CharT> __chars_;
+    vector<_CharT> __neg_chars_;
+    vector<pair<string_type, string_type> > __ranges_;
+    vector<pair<_CharT, _CharT> > __digraphs_;
+    vector<string_type> __equivalences_;
+    typename regex_traits<_CharT>::char_class_type __mask_;
+    typename regex_traits<_CharT>::char_class_type __neg_mask_;
+    bool __negate_;
+    bool __icase_;
+    bool __collate_;
+    bool __might_have_digraph_;
+
+    __bracket_expression(const __bracket_expression&);
+    __bracket_expression& operator=(const __bracket_expression&);
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __bracket_expression(const _Traits& __traits, __node<_CharT>* __s,
+                                 bool __negate, bool __icase, bool __collate)
+        : base(__s), __traits_(__traits), __mask_(), __neg_mask_(),
+          __negate_(__negate), __icase_(__icase), __collate_(__collate),
+          __might_have_digraph_(__traits_.getloc().name() != "C") {}
+
+    virtual void __exec(__state&) const;
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool __negated() const {return __negate_;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __add_char(_CharT __c)
+        {
+            if (__icase_)
+                __chars_.push_back(__traits_.translate_nocase(__c));
+            else if (__collate_)
+                __chars_.push_back(__traits_.translate(__c));
+            else
+                __chars_.push_back(__c);
+        }
+    _LIBCPP_INLINE_VISIBILITY
+    void __add_neg_char(_CharT __c)
+        {
+            if (__icase_)
+                __neg_chars_.push_back(__traits_.translate_nocase(__c));
+            else if (__collate_)
+                __neg_chars_.push_back(__traits_.translate(__c));
+            else
+                __neg_chars_.push_back(__c);
+        }
+    _LIBCPP_INLINE_VISIBILITY
+    void __add_range(string_type __b, string_type __e)
+        {
+            if (__collate_)
+            {
+                if (__icase_)
+                {
+                    for (size_t __i = 0; __i < __b.size(); ++__i)
+                        __b[__i] = __traits_.translate_nocase(__b[__i]);
+                    for (size_t __i = 0; __i < __e.size(); ++__i)
+                        __e[__i] = __traits_.translate_nocase(__e[__i]);
+                }
+                else
+                {
+                    for (size_t __i = 0; __i < __b.size(); ++__i)
+                        __b[__i] = __traits_.translate(__b[__i]);
+                    for (size_t __i = 0; __i < __e.size(); ++__i)
+                        __e[__i] = __traits_.translate(__e[__i]);
+                }
+                __ranges_.push_back(make_pair(
+                                  __traits_.transform(__b.begin(), __b.end()),
+                                  __traits_.transform(__e.begin(), __e.end())));
+            }
+            else
+            {
+                if (__b.size() != 1 || __e.size() != 1)
+                    __throw_regex_error<regex_constants::error_collate>();
+                if (__icase_)
+                {
+                    __b[0] = __traits_.translate_nocase(__b[0]);
+                    __e[0] = __traits_.translate_nocase(__e[0]);
+                }
+                __ranges_.push_back(make_pair(_VSTD::move(__b), _VSTD::move(__e)));
+            }
+        }
+    _LIBCPP_INLINE_VISIBILITY
+    void __add_digraph(_CharT __c1, _CharT __c2)
+        {
+            if (__icase_)
+                __digraphs_.push_back(make_pair(__traits_.translate_nocase(__c1),
+                                                __traits_.translate_nocase(__c2)));
+            else if (__collate_)
+                __digraphs_.push_back(make_pair(__traits_.translate(__c1),
+                                                __traits_.translate(__c2)));
+            else
+                __digraphs_.push_back(make_pair(__c1, __c2));
+        }
+    _LIBCPP_INLINE_VISIBILITY
+    void __add_equivalence(const string_type& __s)
+        {__equivalences_.push_back(__s);}
+    _LIBCPP_INLINE_VISIBILITY
+    void __add_class(typename regex_traits<_CharT>::char_class_type __mask)
+        {__mask_ |= __mask;}
+    _LIBCPP_INLINE_VISIBILITY
+    void __add_neg_class(typename regex_traits<_CharT>::char_class_type __mask)
+        {__neg_mask_ |= __mask;}
+};
+
+template <class _CharT, class _Traits>
+void
+__bracket_expression<_CharT, _Traits>::__exec(__state& __s) const
+{
+    bool __found = false;
+    unsigned __consumed = 0;
+    if (__s.__current_ != __s.__last_)
+    {
+        ++__consumed;
+        if (__might_have_digraph_)
+        {
+            const _CharT* __next = _VSTD::next(__s.__current_);
+            if (__next != __s.__last_)
+            {
+                pair<_CharT, _CharT> __ch2(*__s.__current_, *__next);
+                if (__icase_)
+                {
+                    __ch2.first = __traits_.translate_nocase(__ch2.first);
+                    __ch2.second = __traits_.translate_nocase(__ch2.second);
+                }
+                else if (__collate_)
+                {
+                    __ch2.first = __traits_.translate(__ch2.first);
+                    __ch2.second = __traits_.translate(__ch2.second);
+                }
+                if (!__traits_.lookup_collatename(&__ch2.first, &__ch2.first+2).empty())
+                {
+                    // __ch2 is a digraph in this locale
+                    ++__consumed;
+                    for (size_t __i = 0; __i < __digraphs_.size(); ++__i)
+                    {
+                        if (__ch2 == __digraphs_[__i])
+                        {
+                            __found = true;
+                            goto __exit;
+                        }
+                    }
+                    if (__collate_ && !__ranges_.empty())
+                    {
+                        string_type __s2 = __traits_.transform(&__ch2.first,
+                                                               &__ch2.first + 2);
+                        for (size_t __i = 0; __i < __ranges_.size(); ++__i)
+                        {
+                            if (__ranges_[__i].first <= __s2 &&
+                                __s2 <= __ranges_[__i].second)
+                            {
+                                __found = true;
+                                goto __exit;
+                            }
+                        }
+                    }
+                    if (!__equivalences_.empty())
+                    {
+                        string_type __s2 = __traits_.transform_primary(&__ch2.first,
+                                                                       &__ch2.first + 2);
+                        for (size_t __i = 0; __i < __equivalences_.size(); ++__i)
+                        {
+                            if (__s2 == __equivalences_[__i])
+                            {
+                                __found = true;
+                                goto __exit;
+                            }
+                        }
+                    }
+                    if (__traits_.isctype(__ch2.first, __mask_) &&
+                        __traits_.isctype(__ch2.second, __mask_))
+                    {
+                        __found = true;
+                        goto __exit;
+                    }
+                    if (!__traits_.isctype(__ch2.first, __neg_mask_) &&
+                        !__traits_.isctype(__ch2.second, __neg_mask_))
+                    {
+                        __found = true;
+                        goto __exit;
+                    }
+                    goto __exit;
+                }
+            }
+        }
+        // test *__s.__current_ as not a digraph
+        _CharT __ch = *__s.__current_;
+        if (__icase_)
+            __ch = __traits_.translate_nocase(__ch);
+        else if (__collate_)
+            __ch = __traits_.translate(__ch);
+        for (size_t __i = 0; __i < __chars_.size(); ++__i)
+        {
+            if (__ch == __chars_[__i])
+            {
+                __found = true;
+                goto __exit;
+            }
+        }
+        if (!__neg_chars_.empty())
+        {
+            for (size_t __i = 0; __i < __neg_chars_.size(); ++__i)
+            {
+                if (__ch == __neg_chars_[__i])
+                    goto __is_neg_char;
+            }
+            __found = true;
+            goto __exit;
+        }
+__is_neg_char:
+        if (!__ranges_.empty())
+        {
+            string_type __s2 = __collate_ ?
+                                   __traits_.transform(&__ch, &__ch + 1) :
+                                   string_type(1, __ch);
+            for (size_t __i = 0; __i < __ranges_.size(); ++__i)
+            {
+                if (__ranges_[__i].first <= __s2 && __s2 <= __ranges_[__i].second)
+                {
+                    __found = true;
+                    goto __exit;
+                }
+            }
+        }
+        if (!__equivalences_.empty())
+        {
+            string_type __s2 = __traits_.transform_primary(&__ch, &__ch + 1);
+            for (size_t __i = 0; __i < __equivalences_.size(); ++__i)
+            {
+                if (__s2 == __equivalences_[__i])
+                {
+                    __found = true;
+                    goto __exit;
+                }
+            }
+        }
+        if (__traits_.isctype(__ch, __mask_))
+        {
+            __found = true;
+            goto __exit;
+        }
+        if (__neg_mask_ && !__traits_.isctype(__ch, __neg_mask_))
+        {
+            __found = true;
+            goto __exit;
+        }
+    }
+    else
+        __found = __negate_;  // force reject
+__exit:
+    if (__found != __negate_)
+    {
+        __s.__do_ = __state::__accept_and_consume;
+        __s.__current_ += __consumed;
+        __s.__node_ = this->first();
+    }
+    else
+    {
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+template <class _CharT, class _Traits> class __lookahead;
+
+template <class _CharT, class _Traits = regex_traits<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY basic_regex
+{
+public:
+    // types:
+    typedef _CharT                              value_type;
+    typedef regex_constants::syntax_option_type flag_type;
+    typedef typename _Traits::locale_type       locale_type;
+
+private:
+    _Traits   __traits_;
+    flag_type __flags_;
+    unsigned __marked_count_;
+    unsigned __loop_count_;
+    int __open_count_;
+    shared_ptr<__empty_state<_CharT> > __start_;
+    __owns_one_state<_CharT>* __end_;
+
+    typedef _VSTD::__state<_CharT> __state;
+    typedef _VSTD::__node<_CharT> __node;
+
+public:
+    // constants:
+    static const regex_constants::syntax_option_type icase = regex_constants::icase;
+    static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
+    static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
+    static const regex_constants::syntax_option_type collate = regex_constants::collate;
+    static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
+    static const regex_constants::syntax_option_type basic = regex_constants::basic;
+    static const regex_constants::syntax_option_type extended = regex_constants::extended;
+    static const regex_constants::syntax_option_type awk = regex_constants::awk;
+    static const regex_constants::syntax_option_type grep = regex_constants::grep;
+    static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
+
+    // construct/copy/destroy:
+    _LIBCPP_INLINE_VISIBILITY
+    basic_regex()
+        : __flags_(), __marked_count_(0), __loop_count_(0), __open_count_(0),
+          __end_(0)
+        {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
+        : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
+          __end_(0)
+        {__parse(__p, __p + __traits_.length(__p));}
+    _LIBCPP_INLINE_VISIBILITY
+    basic_regex(const value_type* __p, size_t __len, flag_type __f)
+        : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
+          __end_(0)
+        {__parse(__p, __p + __len);}
+//     basic_regex(const basic_regex&) = default;
+//     basic_regex(basic_regex&&) = default;
+    template <class _ST, class _SA>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
+                             flag_type __f = regex_constants::ECMAScript)
+        : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
+          __end_(0)
+        {__parse(__p.begin(), __p.end());}
+    template <class _ForwardIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        basic_regex(_ForwardIterator __first, _ForwardIterator __last,
+                    flag_type __f = regex_constants::ECMAScript)
+        : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
+          __end_(0)
+        {__parse(__first, __last);}
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    basic_regex(initializer_list<value_type> __il,
+                flag_type __f = regex_constants::ECMAScript)
+        : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
+          __end_(0)
+        {__parse(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+//    ~basic_regex() = default;
+
+//     basic_regex& operator=(const basic_regex&) = default;
+//     basic_regex& operator=(basic_regex&&) = default;
+    _LIBCPP_INLINE_VISIBILITY
+    basic_regex& operator=(const value_type* __p)
+        {return assign(__p);}
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    basic_regex& operator=(initializer_list<value_type> __il)
+        {return assign(__il);}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    template <class _ST, class _SA>
+        _LIBCPP_INLINE_VISIBILITY
+        basic_regex& operator=(const basic_string<value_type, _ST, _SA>& __p)
+        {return assign(__p);}
+
+    // assign:
+    _LIBCPP_INLINE_VISIBILITY
+    basic_regex& assign(const basic_regex& __that)
+        {return *this = __that;}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    basic_regex& assign(basic_regex&& __that) _NOEXCEPT
+        {return *this = _VSTD::move(__that);}
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
+        {return assign(__p, __p + __traits_.length(__p), __f);}
+    _LIBCPP_INLINE_VISIBILITY
+    basic_regex& assign(const value_type* __p, size_t __len, flag_type __f)
+        {return assign(__p, __p + __len, __f);}
+    template <class _ST, class _SA>
+        _LIBCPP_INLINE_VISIBILITY
+        basic_regex& assign(const basic_string<value_type, _ST, _SA>& __s,
+                            flag_type __f = regex_constants::ECMAScript)
+            {return assign(__s.begin(), __s.end(), __f);}
+
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+             __is_input_iterator  <_InputIterator>::value &&
+            !__is_forward_iterator<_InputIterator>::value,
+            basic_regex&
+        >::type
+        assign(_InputIterator __first, _InputIterator __last,
+                            flag_type __f = regex_constants::ECMAScript)
+        {
+            basic_string<_CharT> __t(__first, __last);
+            return assign(__t.begin(), __t.end(), __f);
+        }
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    void __member_init(flag_type __f)
+    {
+        __flags_ = __f;
+        __marked_count_ = 0;
+        __loop_count_ = 0;
+        __open_count_ = 0;
+        __end_ = nullptr;
+    }
+public:
+
+    template <class _ForwardIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value,
+            basic_regex&
+        >::type
+        assign(_ForwardIterator __first, _ForwardIterator __last,
+                            flag_type __f = regex_constants::ECMAScript)
+        {
+            return assign(basic_regex(__first, __last, __f));
+        }
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    basic_regex& assign(initializer_list<value_type> __il,
+                        flag_type __f = regex_constants::ECMAScript)
+        {return assign(__il.begin(), __il.end(), __f);}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    // const operations:
+    _LIBCPP_INLINE_VISIBILITY
+    unsigned mark_count() const {return __marked_count_;}
+    _LIBCPP_INLINE_VISIBILITY
+    flag_type flags() const {return __flags_;}
+
+    // locale:
+    _LIBCPP_INLINE_VISIBILITY
+    locale_type imbue(locale_type __loc)
+    {
+        __member_init(ECMAScript);
+        __start_.reset();
+        return __traits_.imbue(__loc);
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    locale_type getloc() const {return __traits_.getloc();}
+
+    // swap:
+    void swap(basic_regex& __r);
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    unsigned __loop_count() const {return __loop_count_;}
+
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_basic_reg_exp(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_RE_expression(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_simple_RE(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_nondupl_RE(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_one_char_or_coll_elem_RE(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_Back_open_paren(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_Back_close_paren(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_Back_open_brace(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_Back_close_brace(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_BACKREF(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_ORD_CHAR(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_QUOTED_CHAR(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_RE_dupl_symbol(_ForwardIterator __first, _ForwardIterator __last,
+                               __owns_one_state<_CharT>* __s,
+                               unsigned __mexp_begin, unsigned __mexp_end);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_ERE_dupl_symbol(_ForwardIterator __first, _ForwardIterator __last,
+                                __owns_one_state<_CharT>* __s,
+                                unsigned __mexp_begin, unsigned __mexp_end);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_bracket_expression(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_follow_list(_ForwardIterator __first, _ForwardIterator __last,
+                            __bracket_expression<_CharT, _Traits>* __ml);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_expression_term(_ForwardIterator __first, _ForwardIterator __last,
+                                __bracket_expression<_CharT, _Traits>* __ml);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_equivalence_class(_ForwardIterator __first, _ForwardIterator __last,
+                                  __bracket_expression<_CharT, _Traits>* __ml);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_character_class(_ForwardIterator __first, _ForwardIterator __last,
+                                __bracket_expression<_CharT, _Traits>* __ml);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_collating_symbol(_ForwardIterator __first, _ForwardIterator __last,
+                                 basic_string<_CharT>& __col_sym);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_DUP_COUNT(_ForwardIterator __first, _ForwardIterator __last, int& __c);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_extended_reg_exp(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_ERE_branch(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_ERE_expression(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_one_char_or_coll_elem_ERE(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_ORD_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_QUOTED_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_ecma_exp(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_alternative(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_term(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_assertion(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_atom(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_atom_escape(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_decimal_escape(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_character_class_escape(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_character_escape(_ForwardIterator __first, _ForwardIterator __last,
+                                 basic_string<_CharT>* __str = nullptr);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_pattern_character(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_grep(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_egrep(_ForwardIterator __first, _ForwardIterator __last);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_class_escape(_ForwardIterator __first, _ForwardIterator __last,
+                          basic_string<_CharT>& __str,
+                          __bracket_expression<_CharT, _Traits>* __ml);
+    template <class _ForwardIterator>
+        _ForwardIterator
+        __parse_awk_escape(_ForwardIterator __first, _ForwardIterator __last,
+                          basic_string<_CharT>* __str = nullptr);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __push_l_anchor();
+    void __push_r_anchor();
+    void __push_match_any();
+    void __push_match_any_but_newline();
+    _LIBCPP_INLINE_VISIBILITY
+    void __push_greedy_inf_repeat(size_t __min, __owns_one_state<_CharT>* __s,
+                                  unsigned __mexp_begin = 0, unsigned __mexp_end = 0)
+        {__push_loop(__min, numeric_limits<size_t>::max(), __s,
+                     __mexp_begin, __mexp_end);}
+    _LIBCPP_INLINE_VISIBILITY
+    void __push_nongreedy_inf_repeat(size_t __min, __owns_one_state<_CharT>* __s,
+                                  unsigned __mexp_begin = 0, unsigned __mexp_end = 0)
+        {__push_loop(__min, numeric_limits<size_t>::max(), __s,
+                     __mexp_begin, __mexp_end, false);}
+    void __push_loop(size_t __min, size_t __max, __owns_one_state<_CharT>* __s,
+                     size_t __mexp_begin = 0, size_t __mexp_end = 0,
+                     bool __greedy = true);
+    __bracket_expression<_CharT, _Traits>* __start_matching_list(bool __negate);
+    void __push_char(value_type __c);
+    void __push_back_ref(int __i);
+    void __push_alternation(__owns_one_state<_CharT>* __sa,
+                            __owns_one_state<_CharT>* __sb);
+    void __push_begin_marked_subexpression();
+    void __push_end_marked_subexpression(unsigned);
+    void __push_empty();
+    void __push_word_boundary(bool);
+    void __push_lookahead(const basic_regex&, bool, unsigned);
+
+    template <class _Allocator>
+        bool
+        __search(const _CharT* __first, const _CharT* __last,
+                 match_results<const _CharT*, _Allocator>& __m,
+                 regex_constants::match_flag_type __flags) const;
+
+    template <class _Allocator>
+        bool
+        __match_at_start(const _CharT* __first, const _CharT* __last,
+                 match_results<const _CharT*, _Allocator>& __m,
+                 regex_constants::match_flag_type __flags, bool) const;
+    template <class _Allocator>
+        bool
+        __match_at_start_ecma(const _CharT* __first, const _CharT* __last,
+                 match_results<const _CharT*, _Allocator>& __m,
+                 regex_constants::match_flag_type __flags, bool) const;
+    template <class _Allocator>
+        bool
+        __match_at_start_posix_nosubs(const _CharT* __first, const _CharT* __last,
+                 match_results<const _CharT*, _Allocator>& __m,
+                 regex_constants::match_flag_type __flags, bool) const;
+    template <class _Allocator>
+        bool
+        __match_at_start_posix_subs(const _CharT* __first, const _CharT* __last,
+                 match_results<const _CharT*, _Allocator>& __m,
+                 regex_constants::match_flag_type __flags, bool) const;
+
+    template <class _Bp, class _Ap, class _Cp, class _Tp>
+    friend
+    bool
+    regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
+                 regex_constants::match_flag_type);
+
+    template <class _Ap, class _Cp, class _Tp>
+    friend
+    bool
+    regex_search(const _Cp*, const _Cp*, match_results<const _Cp*, _Ap>&,
+                 const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
+
+    template <class _Bp, class _Cp, class _Tp>
+    friend
+    bool
+    regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&,
+                 regex_constants::match_flag_type);
+
+    template <class _Cp, class _Tp>
+    friend
+    bool
+    regex_search(const _Cp*, const _Cp*,
+                 const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
+
+    template <class _Cp, class _Ap, class _Tp>
+    friend
+    bool
+    regex_search(const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&,
+                 regex_constants::match_flag_type);
+
+    template <class _ST, class _SA, class _Cp, class _Tp>
+    friend
+    bool
+    regex_search(const basic_string<_Cp, _ST, _SA>& __s,
+                 const basic_regex<_Cp, _Tp>& __e,
+                 regex_constants::match_flag_type __flags);
+
+    template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
+    friend
+    bool
+    regex_search(const basic_string<_Cp, _ST, _SA>& __s,
+                 match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
+                 const basic_regex<_Cp, _Tp>& __e,
+                 regex_constants::match_flag_type __flags);
+
+    template <class _Iter, class _Ap, class _Cp, class _Tp>
+    friend
+    bool
+    regex_search(__wrap_iter<_Iter> __first,
+                 __wrap_iter<_Iter> __last,
+                 match_results<__wrap_iter<_Iter>, _Ap>& __m,
+                 const basic_regex<_Cp, _Tp>& __e,
+                 regex_constants::match_flag_type __flags);
+
+    template <class, class> friend class __lookahead;
+};
+
+template <class _CharT, class _Traits>
+    const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase;
+template <class _CharT, class _Traits>
+    const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs;
+template <class _CharT, class _Traits>
+    const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize;
+template <class _CharT, class _Traits>
+    const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate;
+template <class _CharT, class _Traits>
+    const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript;
+template <class _CharT, class _Traits>
+    const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic;
+template <class _CharT, class _Traits>
+    const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended;
+template <class _CharT, class _Traits>
+    const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk;
+template <class _CharT, class _Traits>
+    const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep;
+template <class _CharT, class _Traits>
+    const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep;
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
+{
+    using _VSTD::swap;
+    swap(__traits_, __r.__traits_);
+    swap(__flags_, __r.__flags_);
+    swap(__marked_count_, __r.__marked_count_);
+    swap(__loop_count_, __r.__loop_count_);
+    swap(__open_count_, __r.__open_count_);
+    swap(__start_, __r.__start_);
+    swap(__end_, __r.__end_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(basic_regex<_CharT, _Traits>& __x, basic_regex<_CharT, _Traits>& __y)
+{
+    return __x.swap(__y);
+}
+
+// __lookahead
+
+template <class _CharT, class _Traits>
+class __lookahead
+    : public __owns_one_state<_CharT>
+{
+    typedef __owns_one_state<_CharT> base;
+
+    basic_regex<_CharT, _Traits> __exp_;
+    unsigned __mexp_;
+    bool __invert_;
+
+    __lookahead(const __lookahead&);
+    __lookahead& operator=(const __lookahead&);
+public:
+    typedef _VSTD::__state<_CharT> __state;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
+        : base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
+
+    virtual void __exec(__state&) const;
+};
+
+template <class _CharT, class _Traits>
+void
+__lookahead<_CharT, _Traits>::__exec(__state& __s) const
+{
+    match_results<const _CharT*> __m;
+    __m.__init(1 + __exp_.mark_count(), __s.__current_, __s.__last_);
+    bool __matched = __exp_.__match_at_start_ecma(__s.__current_, __s.__last_,
+                                                  __m,
+                                                  __s.__flags_ | regex_constants::match_continuous,
+                                                  __s.__at_first_ && __s.__current_ == __s.__first_);
+    if (__matched != __invert_)
+    {
+        __s.__do_ = __state::__accept_but_not_consume;
+        __s.__node_ = this->first();
+        for (unsigned __i = 1; __i < __m.size(); ++__i) {
+            __s.__sub_matches_[__mexp_ + __i - 1] = __m.__matches_[__i];
+        }
+    }
+    else
+    {
+        __s.__do_ = __state::__reject;
+        __s.__node_ = nullptr;
+    }
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first,
+                                      _ForwardIterator __last)
+{
+    {
+        unique_ptr<__node> __h(new __end_state<_CharT>);
+        __start_.reset(new __empty_state<_CharT>(__h.get()));
+        __h.release();
+        __end_ = __start_.get();
+    }
+    switch (__flags_ & 0x1F0)
+    {
+    case ECMAScript:
+        __first = __parse_ecma_exp(__first, __last);
+        break;
+    case basic:
+        __first = __parse_basic_reg_exp(__first, __last);
+        break;
+    case extended:
+    case awk:
+        __first = __parse_extended_reg_exp(__first, __last);
+        break;
+    case grep:
+        __first = __parse_grep(__first, __last);
+        break;
+    case egrep:
+        __first = __parse_egrep(__first, __last);
+        break;
+    default:
+        __throw_regex_error<regex_constants::__re_err_grammar>();
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first,
+                                                    _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        if (*__first == '^')
+        {
+            __push_l_anchor();
+            ++__first;
+        }
+        if (__first != __last)
+        {
+            __first = __parse_RE_expression(__first, __last);
+            if (__first != __last)
+            {
+                _ForwardIterator __temp = _VSTD::next(__first);
+                if (__temp == __last && *__first == '$')
+                {
+                    __push_r_anchor();
+                    ++__first;
+                }
+            }
+        }
+        if (__first != __last)
+            __throw_regex_error<regex_constants::__re_err_empty>();
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_extended_reg_exp(_ForwardIterator __first,
+                                                       _ForwardIterator __last)
+{
+    __owns_one_state<_CharT>* __sa = __end_;
+    _ForwardIterator __temp = __parse_ERE_branch(__first, __last);
+    if (__temp == __first)
+        __throw_regex_error<regex_constants::__re_err_empty>();
+    __first = __temp;
+    while (__first != __last && *__first == '|')
+    {
+        __owns_one_state<_CharT>* __sb = __end_;
+        __temp = __parse_ERE_branch(++__first, __last);
+        if (__temp == __first)
+            __throw_regex_error<regex_constants::__re_err_empty>();
+        __push_alternation(__sa, __sb);
+        __first = __temp;
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_ERE_branch(_ForwardIterator __first,
+                                                 _ForwardIterator __last)
+{
+    _ForwardIterator __temp = __parse_ERE_expression(__first, __last);
+    if (__temp == __first)
+        __throw_regex_error<regex_constants::__re_err_empty>();
+    do
+    {
+        __first = __temp;
+        __temp = __parse_ERE_expression(__first, __last);
+    } while (__temp != __first);
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_ERE_expression(_ForwardIterator __first,
+                                                     _ForwardIterator __last)
+{
+    __owns_one_state<_CharT>* __e = __end_;
+    unsigned __mexp_begin = __marked_count_;
+    _ForwardIterator __temp = __parse_one_char_or_coll_elem_ERE(__first, __last);
+    if (__temp == __first && __temp != __last)
+    {
+        switch (*__temp)
+        {
+        case '^':
+            __push_l_anchor();
+            ++__temp;
+            break;
+        case '$':
+            __push_r_anchor();
+            ++__temp;
+            break;
+        case '(':
+            __push_begin_marked_subexpression();
+            unsigned __temp_count = __marked_count_;
+            ++__open_count_;
+            __temp = __parse_extended_reg_exp(++__temp, __last);
+            if (__temp == __last || *__temp != ')')
+                __throw_regex_error<regex_constants::error_paren>();
+            __push_end_marked_subexpression(__temp_count);
+            --__open_count_;
+            ++__temp;
+            break;
+        }
+    }
+    if (__temp != __first)
+        __temp = __parse_ERE_dupl_symbol(__temp, __last, __e, __mexp_begin+1,
+                                         __marked_count_+1);
+    __first = __temp;
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_RE_expression(_ForwardIterator __first,
+                                                    _ForwardIterator __last)
+{
+    while (true)
+    {
+        _ForwardIterator __temp = __parse_simple_RE(__first, __last);
+        if (__temp == __first)
+            break;
+        __first = __temp;
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_simple_RE(_ForwardIterator __first,
+                                                _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        __owns_one_state<_CharT>* __e = __end_;
+        unsigned __mexp_begin = __marked_count_;
+        _ForwardIterator __temp = __parse_nondupl_RE(__first, __last);
+        if (__temp != __first)
+            __first = __parse_RE_dupl_symbol(__temp, __last, __e,
+                                             __mexp_begin+1, __marked_count_+1);
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_nondupl_RE(_ForwardIterator __first,
+                                                 _ForwardIterator __last)
+{
+    _ForwardIterator __temp = __first;
+    __first = __parse_one_char_or_coll_elem_RE(__first, __last);
+    if (__temp == __first)
+    {
+        __temp = __parse_Back_open_paren(__first, __last);
+        if (__temp != __first)
+        {
+            __push_begin_marked_subexpression();
+            unsigned __temp_count = __marked_count_;
+            __first = __parse_RE_expression(__temp, __last);
+            __temp = __parse_Back_close_paren(__first, __last);
+            if (__temp == __first)
+                __throw_regex_error<regex_constants::error_paren>();
+            __push_end_marked_subexpression(__temp_count);
+            __first = __temp;
+        }
+        else
+            __first = __parse_BACKREF(__first, __last);
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_one_char_or_coll_elem_RE(
+                                                       _ForwardIterator __first,
+                                                       _ForwardIterator __last)
+{
+    _ForwardIterator __temp = __parse_ORD_CHAR(__first, __last);
+    if (__temp == __first)
+    {
+        __temp = __parse_QUOTED_CHAR(__first, __last);
+        if (__temp == __first)
+        {
+            if (__temp != __last && *__temp == '.')
+            {
+                __push_match_any();
+                ++__temp;
+            }
+            else
+                __temp = __parse_bracket_expression(__first, __last);
+        }
+    }
+    __first = __temp;
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_one_char_or_coll_elem_ERE(
+                                                       _ForwardIterator __first,
+                                                       _ForwardIterator __last)
+{
+    _ForwardIterator __temp = __parse_ORD_CHAR_ERE(__first, __last);
+    if (__temp == __first)
+    {
+        __temp = __parse_QUOTED_CHAR_ERE(__first, __last);
+        if (__temp == __first)
+        {
+            if (__temp != __last && *__temp == '.')
+            {
+                __push_match_any();
+                ++__temp;
+            }
+            else
+                __temp = __parse_bracket_expression(__first, __last);
+        }
+    }
+    __first = __temp;
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_Back_open_paren(_ForwardIterator __first,
+                                                      _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __temp = _VSTD::next(__first);
+        if (__temp != __last)
+        {
+            if (*__first == '\\' && *__temp == '(')
+                __first = ++__temp;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_Back_close_paren(_ForwardIterator __first,
+                                                       _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __temp = _VSTD::next(__first);
+        if (__temp != __last)
+        {
+            if (*__first == '\\' && *__temp == ')')
+                __first = ++__temp;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_Back_open_brace(_ForwardIterator __first,
+                                                      _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __temp = _VSTD::next(__first);
+        if (__temp != __last)
+        {
+            if (*__first == '\\' && *__temp == '{')
+                __first = ++__temp;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_Back_close_brace(_ForwardIterator __first,
+                                                       _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __temp = _VSTD::next(__first);
+        if (__temp != __last)
+        {
+            if (*__first == '\\' && *__temp == '}')
+                __first = ++__temp;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first,
+                                              _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __temp = _VSTD::next(__first);
+        if (__temp != __last)
+        {
+            if (*__first == '\\')
+            { 
+                int __val = __traits_.value(*__temp, 10);
+                if (__val >= 1 && __val <= 9)
+                {
+                    __push_back_ref(__val);
+                    __first = ++__temp;
+                }
+            }
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_ORD_CHAR(_ForwardIterator __first,
+                                               _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __temp = _VSTD::next(__first);
+        if (__temp == __last && *__first == '$')
+            return __first;
+        // Not called inside a bracket
+        if (*__first == '.' || *__first == '\\' || *__first == '[')
+            return __first;
+        __push_char(*__first);
+        ++__first;
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_ORD_CHAR_ERE(_ForwardIterator __first,
+                                                   _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        switch (*__first)
+        {
+        case '^':
+        case '.':
+        case '[':
+        case '$':
+        case '(':
+        case '|':
+        case '*':
+        case '+':
+        case '?':
+        case '{':
+        case '\\':
+            break;
+        case ')':
+            if (__open_count_ == 0)
+            {
+                __push_char(*__first);
+                ++__first;
+            }
+            break;
+        default:
+            __push_char(*__first);
+            ++__first;
+            break;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR(_ForwardIterator __first,
+                                                  _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __temp = _VSTD::next(__first);
+        if (__temp != __last)
+        {
+            if (*__first == '\\')
+            {
+                switch (*__temp)
+                {
+                case '^':
+                case '.':
+                case '*':
+                case '[':
+                case '$':
+                case '\\':
+                    __push_char(*__temp);
+                    __first = ++__temp;
+                    break;
+                }
+            }
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,
+                                                      _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __temp = _VSTD::next(__first);
+        if (__temp != __last)
+        {
+            if (*__first == '\\')
+            {
+                switch (*__temp)
+                {
+                case '^':
+                case '.':
+                case '*':
+                case '[':
+                case '$':
+                case '\\':
+                case '(':
+                case ')':
+                case '|':
+                case '+':
+                case '?':
+                case '{':
+                case '}':
+                    __push_char(*__temp);
+                    __first = ++__temp;
+                    break;
+                default:
+                    if ((__flags_ & 0x1F0) == awk)
+                        __first = __parse_awk_escape(++__first, __last);
+                    break;
+                }
+            }
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(_ForwardIterator __first,
+                                                     _ForwardIterator __last,
+                                                     __owns_one_state<_CharT>* __s,
+                                                     unsigned __mexp_begin,
+                                                     unsigned __mexp_end)
+{
+    if (__first != __last)
+    {
+        if (*__first == '*')
+        {
+            __push_greedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
+            ++__first;
+        }
+        else
+        {
+            _ForwardIterator __temp = __parse_Back_open_brace(__first, __last);
+            if (__temp != __first)
+            {
+                int __min = 0;
+                __first = __temp;
+                __temp = __parse_DUP_COUNT(__first, __last, __min);
+                if (__temp == __first)
+                    __throw_regex_error<regex_constants::error_badbrace>();
+                __first = __temp;
+                if (__first == __last)
+                    __throw_regex_error<regex_constants::error_brace>();
+                if (*__first != ',')
+                {
+                    __temp = __parse_Back_close_brace(__first, __last);
+                    if (__temp == __first)
+                        __throw_regex_error<regex_constants::error_brace>();
+                    __push_loop(__min, __min, __s, __mexp_begin, __mexp_end,
+                                    true);
+                    __first = __temp;
+                }
+                else
+                {
+                    ++__first;  // consume ','
+                    int __max = -1;
+                    __first = __parse_DUP_COUNT(__first, __last, __max);
+                    __temp = __parse_Back_close_brace(__first, __last);
+                    if (__temp == __first)
+                        __throw_regex_error<regex_constants::error_brace>();
+                    if (__max == -1)
+                        __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
+                    else
+                    {
+                        if (__max < __min)
+                            __throw_regex_error<regex_constants::error_badbrace>();
+                        __push_loop(__min, __max, __s, __mexp_begin, __mexp_end,
+                                    true);
+                    }
+                    __first = __temp;
+                }
+            }
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
+                                                      _ForwardIterator __last,
+                                                      __owns_one_state<_CharT>* __s,
+                                                      unsigned __mexp_begin,
+                                                      unsigned __mexp_end)
+{
+    if (__first != __last)
+    {
+        unsigned __grammar = __flags_ & 0x1F0;
+        switch (*__first)
+        {
+        case '*':
+            ++__first;
+            if (__grammar == ECMAScript && __first != __last && *__first == '?')
+            {
+                ++__first;
+                __push_nongreedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
+            }
+            else
+                __push_greedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
+            break;
+        case '+':
+            ++__first;
+            if (__grammar == ECMAScript && __first != __last && *__first == '?')
+            {
+                ++__first;
+                __push_nongreedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
+            }
+            else
+                __push_greedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
+            break;
+        case '?':
+            ++__first;
+            if (__grammar == ECMAScript && __first != __last && *__first == '?')
+            {
+                ++__first;
+                __push_loop(0, 1, __s, __mexp_begin, __mexp_end, false);
+            }
+            else
+                __push_loop(0, 1, __s, __mexp_begin, __mexp_end);
+            break;
+        case '{':
+            {
+                int __min;
+                _ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min);
+                if (__temp == __first)
+                    __throw_regex_error<regex_constants::error_badbrace>();
+                __first = __temp;
+                if (__first == __last)
+                    __throw_regex_error<regex_constants::error_brace>();
+                switch (*__first)
+                {
+                case '}':
+                    ++__first;
+                    if (__grammar == ECMAScript && __first != __last && *__first == '?')
+                    {
+                        ++__first;
+                        __push_loop(__min, __min, __s, __mexp_begin, __mexp_end, false);
+                    }
+                    else
+                        __push_loop(__min, __min, __s, __mexp_begin, __mexp_end);
+                    break;
+                case ',':
+                    ++__first;
+                    if (__first == __last)
+                        __throw_regex_error<regex_constants::error_badbrace>();
+                    if (*__first == '}')
+                    {
+                        ++__first;
+                        if (__grammar == ECMAScript && __first != __last && *__first == '?')
+                        {
+                            ++__first;
+                            __push_nongreedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
+                        }
+                        else
+                            __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
+                    }
+                    else
+                    {
+                        int __max = -1;
+                        __temp = __parse_DUP_COUNT(__first, __last, __max);
+                        if (__temp == __first)
+                            __throw_regex_error<regex_constants::error_brace>();
+                        __first = __temp;
+                        if (__first == __last || *__first != '}')
+                            __throw_regex_error<regex_constants::error_brace>();
+                        ++__first;
+                        if (__max < __min)
+                            __throw_regex_error<regex_constants::error_badbrace>();
+                        if (__grammar == ECMAScript && __first != __last && *__first == '?')
+                        {
+                            ++__first;
+                            __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, false);
+                        }
+                        else
+                            __push_loop(__min, __max, __s, __mexp_begin, __mexp_end);
+                    }
+                    break;
+                default:
+                    __throw_regex_error<regex_constants::error_badbrace>();
+                }
+            }
+            break;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __first,
+                                                         _ForwardIterator __last)
+{
+    if (__first != __last && *__first == '[')
+    {
+        ++__first;
+        if (__first == __last)
+            __throw_regex_error<regex_constants::error_brack>();
+        bool __negate = false;
+        if (*__first == '^')
+        {
+            ++__first;
+            __negate = true;
+        }
+        __bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate);
+        // __ml owned by *this
+        if (__first == __last)
+            __throw_regex_error<regex_constants::error_brack>();
+        if ((__flags_ & 0x1F0) != ECMAScript && *__first == ']')
+        {
+            __ml->__add_char(']');
+            ++__first;
+        }
+        __first = __parse_follow_list(__first, __last, __ml);
+        if (__first == __last)
+            __throw_regex_error<regex_constants::error_brack>();
+        if (*__first == '-')
+        {
+            __ml->__add_char('-');
+            ++__first;
+        }
+        if (__first == __last || *__first != ']')
+            __throw_regex_error<regex_constants::error_brack>();
+        ++__first;
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_follow_list(_ForwardIterator __first,
+                                    _ForwardIterator __last,
+                                    __bracket_expression<_CharT, _Traits>* __ml)
+{
+    if (__first != __last)
+    {
+        while (true)
+        {
+            _ForwardIterator __temp = __parse_expression_term(__first, __last,
+                                                              __ml);
+            if (__temp == __first)
+                break;
+            __first = __temp;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
+                                    _ForwardIterator __last,
+                                    __bracket_expression<_CharT, _Traits>* __ml)
+{
+    if (__first != __last && *__first != ']')
+    {
+        _ForwardIterator __temp = _VSTD::next(__first);
+        basic_string<_CharT> __start_range;
+        if (__temp != __last && *__first == '[')
+        {
+            if (*__temp == '=')
+                return __parse_equivalence_class(++__temp, __last, __ml);
+            else if (*__temp == ':')
+                return __parse_character_class(++__temp, __last, __ml);
+            else if (*__temp == '.')
+                __first = __parse_collating_symbol(++__temp, __last, __start_range);
+        }
+        unsigned __grammar = __flags_ & 0x1F0;
+        if (__start_range.empty())
+        {
+            if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\')
+            {
+                if (__grammar == ECMAScript)
+                    __first = __parse_class_escape(++__first, __last, __start_range, __ml);
+                else
+                    __first = __parse_awk_escape(++__first, __last, &__start_range);
+            }
+            else
+            {
+                __start_range = *__first;
+                ++__first;
+            }
+        }
+        if (__first != __last && *__first != ']')
+        {
+            __temp = _VSTD::next(__first);
+            if (__temp != __last && *__first == '-' && *__temp != ']')
+            {
+                // parse a range
+                basic_string<_CharT> __end_range;
+                __first = __temp;
+                ++__temp;
+                if (__temp != __last && *__first == '[' && *__temp == '.')
+                    __first = __parse_collating_symbol(++__temp, __last, __end_range);
+                else
+                {
+                    if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\')
+                    {
+                        if (__grammar == ECMAScript)
+                            __first = __parse_class_escape(++__first, __last,
+                                                           __end_range, __ml);
+                        else
+                            __first = __parse_awk_escape(++__first, __last,
+                                                         &__end_range);
+                    }
+                    else
+                    {
+                        __end_range = *__first;
+                        ++__first;
+                    }
+                }
+                __ml->__add_range(_VSTD::move(__start_range), _VSTD::move(__end_range));
+            }
+            else if (!__start_range.empty())
+            {
+                if (__start_range.size() == 1)
+                    __ml->__add_char(__start_range[0]);
+                else
+                    __ml->__add_digraph(__start_range[0], __start_range[1]);
+            }
+        }
+        else if (!__start_range.empty())
+        {
+            if (__start_range.size() == 1)
+                __ml->__add_char(__start_range[0]);
+            else
+                __ml->__add_digraph(__start_range[0], __start_range[1]);
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_class_escape(_ForwardIterator __first,
+                          _ForwardIterator __last,
+                          basic_string<_CharT>& __str,
+                          __bracket_expression<_CharT, _Traits>* __ml)
+{
+    if (__first == __last)
+        __throw_regex_error<regex_constants::error_escape>();
+    switch (*__first)
+    {
+    case 0:
+        __str = *__first;
+        return ++__first;
+    case 'b':
+        __str = _CharT(8);
+        return ++__first;
+    case 'd':
+        __ml->__add_class(ctype_base::digit);
+        return ++__first;
+    case 'D':
+        __ml->__add_neg_class(ctype_base::digit);
+        return ++__first;
+    case 's':
+        __ml->__add_class(ctype_base::space);
+        return ++__first;
+    case 'S':
+        __ml->__add_neg_class(ctype_base::space);
+        return ++__first;
+    case 'w':
+        __ml->__add_class(ctype_base::alnum);
+        __ml->__add_char('_');
+        return ++__first;
+    case 'W':
+        __ml->__add_neg_class(ctype_base::alnum);
+        __ml->__add_neg_char('_');
+        return ++__first;
+    }
+    __first = __parse_character_escape(__first, __last, &__str);
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
+                          _ForwardIterator __last,
+                          basic_string<_CharT>* __str)
+{
+    if (__first == __last)
+        __throw_regex_error<regex_constants::error_escape>();
+    switch (*__first)
+    {
+    case '\\':
+    case '"':
+    case '/':
+        if (__str)
+            *__str = *__first;
+        else
+            __push_char(*__first);
+        return ++__first;
+    case 'a':
+        if (__str)
+            *__str = _CharT(7);
+        else
+            __push_char(_CharT(7));
+        return ++__first;
+    case 'b':
+        if (__str)
+            *__str = _CharT(8);
+        else
+            __push_char(_CharT(8));
+        return ++__first;
+    case 'f':
+        if (__str)
+            *__str = _CharT(0xC);
+        else
+            __push_char(_CharT(0xC));
+        return ++__first;
+    case 'n':
+        if (__str)
+            *__str = _CharT(0xA);
+        else
+            __push_char(_CharT(0xA));
+        return ++__first;
+    case 'r':
+        if (__str)
+            *__str = _CharT(0xD);
+        else
+            __push_char(_CharT(0xD));
+        return ++__first;
+    case 't':
+        if (__str)
+            *__str = _CharT(0x9);
+        else
+            __push_char(_CharT(0x9));
+        return ++__first;
+    case 'v':
+        if (__str)
+            *__str = _CharT(0xB);
+        else
+            __push_char(_CharT(0xB));
+        return ++__first;
+    }
+    if ('0' <= *__first && *__first <= '7')
+    {
+        unsigned __val = *__first - '0';
+        if (++__first != __last && ('0' <= *__first && *__first <= '7'))
+        {
+            __val = 8 * __val + *__first - '0';
+            if (++__first != __last && ('0' <= *__first && *__first <= '7'))
+                __val = 8 * __val + *__first++ - '0';
+        }
+        if (__str)
+            *__str = _CharT(__val);
+        else
+            __push_char(_CharT(__val));
+    }
+    else
+        __throw_regex_error<regex_constants::error_escape>();
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first,
+                                    _ForwardIterator __last,
+                                    __bracket_expression<_CharT, _Traits>* __ml)
+{
+    // Found [=
+    //   This means =] must exist
+    value_type _Equal_close[2] = {'=', ']'};
+    _ForwardIterator __temp = _VSTD::search(__first, __last, _Equal_close,
+                                                            _Equal_close+2);
+    if (__temp == __last)
+        __throw_regex_error<regex_constants::error_brack>();
+    // [__first, __temp) contains all text in [= ... =]
+    typedef typename _Traits::string_type string_type;
+    string_type __collate_name =
+        __traits_.lookup_collatename(__first, __temp);
+    if (__collate_name.empty())
+        __throw_regex_error<regex_constants::error_collate>();
+    string_type __equiv_name =
+        __traits_.transform_primary(__collate_name.begin(),
+                                    __collate_name.end());
+    if (!__equiv_name.empty())
+        __ml->__add_equivalence(__equiv_name);
+    else
+    {
+        switch (__collate_name.size())
+        {
+        case 1:
+            __ml->__add_char(__collate_name[0]);
+            break;
+        case 2:
+            __ml->__add_digraph(__collate_name[0], __collate_name[1]);
+            break;
+        default:
+            __throw_regex_error<regex_constants::error_collate>();
+        }
+    }
+    __first = _VSTD::next(__temp, 2);
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first,
+                                    _ForwardIterator __last,
+                                    __bracket_expression<_CharT, _Traits>* __ml)
+{
+    // Found [:
+    //   This means :] must exist
+    value_type _Colon_close[2] = {':', ']'};
+    _ForwardIterator __temp = _VSTD::search(__first, __last, _Colon_close,
+                                                            _Colon_close+2);
+    if (__temp == __last)
+        __throw_regex_error<regex_constants::error_brack>();
+    // [__first, __temp) contains all text in [: ... :]
+    typedef typename _Traits::char_class_type char_class_type;
+    char_class_type __class_type =
+        __traits_.lookup_classname(__first, __temp, __flags_ & icase);
+    if (__class_type == 0)
+        __throw_regex_error<regex_constants::error_brack>();
+    __ml->__add_class(__class_type);
+    __first = _VSTD::next(__temp, 2);
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_collating_symbol(_ForwardIterator __first,
+                                                _ForwardIterator __last,
+                                                basic_string<_CharT>& __col_sym)
+{
+    // Found [.
+    //   This means .] must exist
+    value_type _Dot_close[2] = {'.', ']'};
+    _ForwardIterator __temp = _VSTD::search(__first, __last, _Dot_close,
+                                                            _Dot_close+2);
+    if (__temp == __last)
+        __throw_regex_error<regex_constants::error_brack>();
+    // [__first, __temp) contains all text in [. ... .]
+    __col_sym = __traits_.lookup_collatename(__first, __temp);
+    switch (__col_sym.size())
+    {
+    case 1:
+    case 2:
+        break;
+    default:
+        __throw_regex_error<regex_constants::error_collate>();
+    }
+    __first = _VSTD::next(__temp, 2);
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first,
+                                                _ForwardIterator __last,
+                                                int& __c)
+{
+    if (__first != __last )
+    {
+        int __val = __traits_.value(*__first, 10);
+        if ( __val != -1 )
+        {
+            __c = __val;
+            for (++__first; 
+                 __first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
+                 ++__first)
+            {
+                __c *= 10;
+                __c += __val;
+            }
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_ecma_exp(_ForwardIterator __first,
+                                               _ForwardIterator __last)
+{
+    __owns_one_state<_CharT>* __sa = __end_;
+    _ForwardIterator __temp = __parse_alternative(__first, __last);
+    if (__temp == __first)
+        __push_empty();
+    __first = __temp;
+    while (__first != __last && *__first == '|')
+    {
+        __owns_one_state<_CharT>* __sb = __end_;
+        __temp = __parse_alternative(++__first, __last);
+        if (__temp == __first)
+            __push_empty();
+        __push_alternation(__sa, __sb);
+        __first = __temp;
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_alternative(_ForwardIterator __first,
+                                                  _ForwardIterator __last)
+{
+    while (true)
+    {
+        _ForwardIterator __temp = __parse_term(__first, __last);
+        if (__temp == __first)
+            break;
+        __first = __temp;
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_term(_ForwardIterator __first,
+                                           _ForwardIterator __last)
+{
+    _ForwardIterator __temp = __parse_assertion(__first, __last);
+    if (__temp == __first)
+    {
+        __owns_one_state<_CharT>* __e = __end_;
+        unsigned __mexp_begin = __marked_count_;
+        __temp = __parse_atom(__first, __last);
+        if (__temp != __first)
+            __first = __parse_ERE_dupl_symbol(__temp, __last, __e,
+                                              __mexp_begin+1, __marked_count_+1);
+    }
+    else
+        __first = __temp;
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
+                                                _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        switch (*__first)
+        {
+        case '^':
+            __push_l_anchor();
+            ++__first;
+            break;
+        case '$':
+            __push_r_anchor();
+            ++__first;
+            break;
+        case '\\':
+            {
+                _ForwardIterator __temp = _VSTD::next(__first);
+                if (__temp != __last)
+                {
+                    if (*__temp == 'b')
+                    {
+                        __push_word_boundary(false);
+                        __first = ++__temp;
+                    }
+                    else if (*__temp == 'B')
+                    {
+                        __push_word_boundary(true);
+                        __first = ++__temp;
+                    }
+                }
+            }
+            break;
+        case '(':
+            {
+                _ForwardIterator __temp = _VSTD::next(__first);
+                if (__temp != __last && *__temp == '?')
+                {
+                    if (++__temp != __last)
+                    {
+                        switch (*__temp)
+                        {
+                        case '=':
+                            {
+                                basic_regex __exp;
+                                __exp.__flags_ = __flags_;
+                                __temp = __exp.__parse(++__temp, __last);
+                                unsigned __mexp = __exp.__marked_count_;
+                                __push_lookahead(_VSTD::move(__exp), false, __marked_count_);
+                                __marked_count_ += __mexp;
+                                if (__temp == __last || *__temp != ')')
+                                    __throw_regex_error<regex_constants::error_paren>();
+                                __first = ++__temp;
+                            }
+                            break;
+                        case '!':
+                            {
+                                basic_regex __exp;
+                                __exp.__flags_ = __flags_;
+                                __temp = __exp.__parse(++__temp, __last);
+                                unsigned __mexp = __exp.__marked_count_;
+                                __push_lookahead(_VSTD::move(__exp), true, __marked_count_);
+                                __marked_count_ += __mexp;
+                                if (__temp == __last || *__temp != ')')
+                                    __throw_regex_error<regex_constants::error_paren>();
+                                __first = ++__temp;
+                            }
+                            break;
+                        }
+                    }
+                }
+            }
+            break;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first,
+                                           _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        switch (*__first)
+        {
+        case '.':
+            __push_match_any_but_newline();
+            ++__first;
+            break;
+        case '\\':
+            __first = __parse_atom_escape(__first, __last);
+            break;
+        case '[':
+            __first = __parse_bracket_expression(__first, __last);
+            break;
+        case '(':
+            {
+                ++__first;
+                if (__first == __last)
+                    __throw_regex_error<regex_constants::error_paren>();
+                _ForwardIterator __temp = _VSTD::next(__first);
+                if (__temp != __last && *__first == '?' && *__temp == ':')
+                {
+                    ++__open_count_;
+                    __first = __parse_ecma_exp(++__temp, __last);
+                    if (__first == __last || *__first != ')')
+                        __throw_regex_error<regex_constants::error_paren>();
+                    --__open_count_;
+                    ++__first;
+                }
+                else
+                {
+                    __push_begin_marked_subexpression();
+                    unsigned __temp_count = __marked_count_;
+                    ++__open_count_;
+                    __first = __parse_ecma_exp(__first, __last);
+                    if (__first == __last || *__first != ')')
+                        __throw_regex_error<regex_constants::error_paren>();
+                    __push_end_marked_subexpression(__temp_count);
+                    --__open_count_;
+                    ++__first;
+                }
+            }
+            break;
+        case '*':
+        case '+':
+        case '?':
+        case '{':
+            __throw_regex_error<regex_constants::error_badrepeat>();
+            break;
+        default:
+            __first = __parse_pattern_character(__first, __last);
+            break;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_atom_escape(_ForwardIterator __first,
+                                                  _ForwardIterator __last)
+{
+    if (__first != __last && *__first == '\\')
+    {
+        _ForwardIterator __t1 = _VSTD::next(__first);
+        _ForwardIterator __t2 = __parse_decimal_escape(__t1, __last);
+        if (__t2 != __t1)
+            __first = __t2;
+        else
+        {
+            __t2 = __parse_character_class_escape(__t1, __last);
+            if (__t2 != __t1)
+                __first = __t2;
+            else
+            {
+                __t2 = __parse_character_escape(__t1, __last);
+                if (__t2 != __t1)
+                    __first = __t2;
+            }
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first,
+                                                     _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        if (*__first == '0')
+        {
+            __push_char(_CharT());
+            ++__first;
+        }
+        else if ('1' <= *__first && *__first <= '9')
+        {
+            unsigned __v = *__first - '0';
+            for (++__first; '0' <= *__first && *__first <= '9'; ++__first)
+                __v = 10 * __v + *__first - '0';
+            if (__v > mark_count())
+                __throw_regex_error<regex_constants::error_backref>();
+            __push_back_ref(__v);
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_character_class_escape(_ForwardIterator __first,
+                                                             _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        __bracket_expression<_CharT, _Traits>* __ml;
+        switch (*__first)
+        {
+        case 'd':
+            __ml = __start_matching_list(false);
+            __ml->__add_class(ctype_base::digit);
+            ++__first;
+            break;
+        case 'D':
+            __ml = __start_matching_list(true);
+            __ml->__add_class(ctype_base::digit);
+            ++__first;
+            break;
+        case 's':
+            __ml = __start_matching_list(false);
+            __ml->__add_class(ctype_base::space);
+            ++__first;
+            break;
+        case 'S':
+            __ml = __start_matching_list(true);
+            __ml->__add_class(ctype_base::space);
+            ++__first;
+            break;
+        case 'w':
+            __ml = __start_matching_list(false);
+            __ml->__add_class(ctype_base::alnum);
+            __ml->__add_char('_');
+            ++__first;
+            break;
+        case 'W':
+            __ml = __start_matching_list(true);
+            __ml->__add_class(ctype_base::alnum);
+            __ml->__add_char('_');
+            ++__first;
+            break;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
+                                                    _ForwardIterator __last,
+                                                    basic_string<_CharT>* __str)
+{
+    if (__first != __last)
+    {
+        _ForwardIterator __t;
+        unsigned __sum = 0;
+        int __hd;
+        switch (*__first)
+        {
+        case 'f':
+            if (__str)
+                *__str = _CharT(0xC);
+            else
+                __push_char(_CharT(0xC));
+            ++__first;
+            break;
+        case 'n':
+            if (__str)
+                *__str = _CharT(0xA);
+            else
+                __push_char(_CharT(0xA));
+            ++__first;
+            break;
+        case 'r':
+            if (__str)
+                *__str = _CharT(0xD);
+            else
+                __push_char(_CharT(0xD));
+            ++__first;
+            break;
+        case 't':
+            if (__str)
+                *__str = _CharT(0x9);
+            else
+                __push_char(_CharT(0x9));
+            ++__first;
+            break;
+        case 'v':
+            if (__str)
+                *__str = _CharT(0xB);
+            else
+                __push_char(_CharT(0xB));
+            ++__first;
+            break;
+        case 'c':
+            if ((__t = _VSTD::next(__first)) != __last)
+            {
+                if (('A' <= *__t && *__t <= 'Z') || 
+                    ('a' <= *__t && *__t <= 'z'))
+                {
+                    if (__str)
+                        *__str = _CharT(*__t % 32);
+                    else
+                        __push_char(_CharT(*__t % 32));
+                    __first = ++__t;
+                }
+                else 
+                    __throw_regex_error<regex_constants::error_escape>();
+            }
+            else
+                __throw_regex_error<regex_constants::error_escape>();
+            break;
+        case 'u':
+            ++__first;
+            if (__first == __last)
+                __throw_regex_error<regex_constants::error_escape>();
+            __hd = __traits_.value(*__first, 16);
+            if (__hd == -1)
+                __throw_regex_error<regex_constants::error_escape>();
+            __sum = 16 * __sum + static_cast<unsigned>(__hd);
+            ++__first;
+            if (__first == __last)
+                __throw_regex_error<regex_constants::error_escape>();
+            __hd = __traits_.value(*__first, 16);
+            if (__hd == -1)
+                __throw_regex_error<regex_constants::error_escape>();
+            __sum = 16 * __sum + static_cast<unsigned>(__hd);
+            // drop through
+        case 'x':
+            ++__first;
+            if (__first == __last)
+                __throw_regex_error<regex_constants::error_escape>();
+            __hd = __traits_.value(*__first, 16);
+            if (__hd == -1)
+                __throw_regex_error<regex_constants::error_escape>();
+            __sum = 16 * __sum + static_cast<unsigned>(__hd);
+            ++__first;
+            if (__first == __last)
+                __throw_regex_error<regex_constants::error_escape>();
+            __hd = __traits_.value(*__first, 16);
+            if (__hd == -1)
+                __throw_regex_error<regex_constants::error_escape>();
+            __sum = 16 * __sum + static_cast<unsigned>(__hd);
+            if (__str)
+                *__str = _CharT(__sum);
+            else
+                __push_char(_CharT(__sum));
+            ++__first;
+            break;
+        case '0':
+            if (__str)
+                *__str = _CharT(0);
+            else
+                __push_char(_CharT(0));
+            ++__first;
+            break;
+        default:
+            if (*__first != '_' && !__traits_.isctype(*__first, ctype_base::alnum))
+            {
+                if (__str)
+                    *__str = *__first;
+                else
+                    __push_char(*__first);
+                ++__first;
+            }
+            else
+                __throw_regex_error<regex_constants::error_escape>();
+            break;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_pattern_character(_ForwardIterator __first,
+                                                        _ForwardIterator __last)
+{
+    if (__first != __last)
+    {
+        switch (*__first)
+        {
+        case '^':
+        case '$':
+        case '\\':
+        case '.':
+        case '*':
+        case '+':
+        case '?':
+        case '(':
+        case ')':
+        case '[':
+        case ']':
+        case '{':
+        case '}':
+        case '|':
+            break;
+        default:
+            __push_char(*__first);
+            ++__first;
+            break;
+        }
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_grep(_ForwardIterator __first,
+                                           _ForwardIterator __last)
+{
+    __owns_one_state<_CharT>* __sa = __end_;
+    _ForwardIterator __t1 = _VSTD::find(__first, __last, _CharT('\n'));
+    if (__t1 != __first)
+        __parse_basic_reg_exp(__first, __t1);
+    else
+        __push_empty();
+    __first = __t1;
+    if (__first != __last)
+        ++__first;
+    while (__first != __last)
+    {
+        __t1 = _VSTD::find(__first, __last, _CharT('\n'));
+        __owns_one_state<_CharT>* __sb = __end_;
+        if (__t1 != __first)
+            __parse_basic_reg_exp(__first, __t1);
+        else
+            __push_empty();
+        __push_alternation(__sa, __sb);
+        __first = __t1;
+        if (__first != __last)
+            ++__first;
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator
+basic_regex<_CharT, _Traits>::__parse_egrep(_ForwardIterator __first,
+                                            _ForwardIterator __last)
+{
+    __owns_one_state<_CharT>* __sa = __end_;
+    _ForwardIterator __t1 = _VSTD::find(__first, __last, _CharT('\n'));
+    if (__t1 != __first)
+        __parse_extended_reg_exp(__first, __t1);
+    else
+        __push_empty();
+    __first = __t1;
+    if (__first != __last)
+        ++__first;
+    while (__first != __last)
+    {
+        __t1 = _VSTD::find(__first, __last, _CharT('\n'));
+        __owns_one_state<_CharT>* __sb = __end_;
+        if (__t1 != __first)
+            __parse_extended_reg_exp(__first, __t1);
+        else
+            __push_empty();
+        __push_alternation(__sa, __sb);
+        __first = __t1;
+        if (__first != __last)
+            ++__first;
+    }
+    return __first;
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_loop(size_t __min, size_t __max,
+        __owns_one_state<_CharT>* __s, size_t __mexp_begin, size_t __mexp_end,
+        bool __greedy)
+{
+    unique_ptr<__empty_state<_CharT> > __e1(new __empty_state<_CharT>(__end_->first()));
+    __end_->first() = nullptr;
+    unique_ptr<__loop<_CharT> > __e2(new __loop<_CharT>(__loop_count_,
+                __s->first(), __e1.get(), __mexp_begin, __mexp_end, __greedy,
+                __min, __max));
+    __s->first() = nullptr;
+    __e1.release();
+    __end_->first() = new __repeat_one_loop<_CharT>(__e2.get());
+    __end_ = __e2->second();
+    __s->first() = __e2.release();
+    ++__loop_count_;
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_char(value_type __c)
+{
+    if (flags() & icase)
+        __end_->first() = new __match_char_icase<_CharT, _Traits>
+                                              (__traits_, __c, __end_->first());
+    else if (flags() & collate)
+        __end_->first() = new __match_char_collate<_CharT, _Traits>
+                                              (__traits_, __c, __end_->first());
+    else
+        __end_->first() = new __match_char<_CharT>(__c, __end_->first());
+    __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_begin_marked_subexpression()
+{
+    if (!(__flags_ & nosubs))
+    {
+        __end_->first() =
+                new __begin_marked_subexpression<_CharT>(++__marked_count_,
+                                                         __end_->first());
+        __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+    }
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_end_marked_subexpression(unsigned __sub)
+{
+    if (!(__flags_ & nosubs))
+    {
+        __end_->first() =
+                new __end_marked_subexpression<_CharT>(__sub, __end_->first());
+        __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+    }
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_l_anchor()
+{
+    __end_->first() = new __l_anchor<_CharT>(__end_->first());
+    __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_r_anchor()
+{
+    __end_->first() = new __r_anchor<_CharT>(__end_->first());
+    __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_match_any()
+{
+    __end_->first() = new __match_any<_CharT>(__end_->first());
+    __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_match_any_but_newline()
+{
+    __end_->first() = new __match_any_but_newline<_CharT>(__end_->first());
+    __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_empty()
+{
+    __end_->first() = new __empty_state<_CharT>(__end_->first());
+    __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_word_boundary(bool __invert)
+{
+    __end_->first() = new __word_boundary<_CharT, _Traits>(__traits_, __invert,
+                                                           __end_->first());
+    __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_back_ref(int __i)
+{
+    if (flags() & icase)
+        __end_->first() = new __back_ref_icase<_CharT, _Traits>
+                                              (__traits_, __i, __end_->first());
+    else if (flags() & collate)
+        __end_->first() = new __back_ref_collate<_CharT, _Traits>
+                                              (__traits_, __i, __end_->first());
+    else
+        __end_->first() = new __back_ref<_CharT>(__i, __end_->first());
+    __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_alternation(__owns_one_state<_CharT>* __sa,
+                                                 __owns_one_state<_CharT>* __ea)
+{
+    __sa->first() = new __alternate<_CharT>(
+                         static_cast<__owns_one_state<_CharT>*>(__sa->first()),
+                         static_cast<__owns_one_state<_CharT>*>(__ea->first()));
+    __ea->first() = nullptr;
+    __ea->first() = new __empty_state<_CharT>(__end_->first());
+    __end_->first() = nullptr;
+    __end_->first() = new __empty_non_own_state<_CharT>(__ea->first());
+    __end_ = static_cast<__owns_one_state<_CharT>*>(__ea->first());
+}
+
+template <class _CharT, class _Traits>
+__bracket_expression<_CharT, _Traits>*
+basic_regex<_CharT, _Traits>::__start_matching_list(bool __negate)
+{
+    __bracket_expression<_CharT, _Traits>* __r =
+        new __bracket_expression<_CharT, _Traits>(__traits_, __end_->first(),
+                                                  __negate, __flags_ & icase,
+                                                  __flags_ & collate);
+    __end_->first() = __r;
+    __end_ = __r;
+    return __r;
+}
+
+template <class _CharT, class _Traits>
+void
+basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
+                                               bool __invert,
+                                               unsigned __mexp)
+{
+    __end_->first() = new __lookahead<_CharT, _Traits>(__exp, __invert,
+                                                           __end_->first(), __mexp);
+    __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+}
+
+typedef basic_regex<char>    regex;
+typedef basic_regex<wchar_t> wregex;
+
+// sub_match
+
+template <class _BidirectionalIterator>
+class _LIBCPP_TYPE_VIS_ONLY sub_match
+    : public pair<_BidirectionalIterator, _BidirectionalIterator>
+{
+public:
+    typedef _BidirectionalIterator                              iterator;
+    typedef typename iterator_traits<iterator>::value_type      value_type;
+    typedef typename iterator_traits<iterator>::difference_type difference_type;
+    typedef basic_string<value_type>                            string_type;
+
+    bool matched;
+
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR sub_match() : matched() {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    difference_type length() const
+        {return matched ? _VSTD::distance(this->first, this->second) : 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    string_type str() const
+        {return matched ? string_type(this->first, this->second) : string_type();}
+    _LIBCPP_INLINE_VISIBILITY
+    operator string_type() const
+        {return str();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    int compare(const sub_match& __s) const
+        {return str().compare(__s.str());}
+    _LIBCPP_INLINE_VISIBILITY
+    int compare(const string_type& __s) const
+        {return str().compare(__s);}
+    _LIBCPP_INLINE_VISIBILITY
+    int compare(const value_type* __s) const
+        {return str().compare(__s);}
+};
+
+typedef sub_match<const char*>             csub_match;
+typedef sub_match<const wchar_t*>          wcsub_match;
+typedef sub_match<string::const_iterator>  ssub_match;
+typedef sub_match<wstring::const_iterator> wssub_match;
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
+{
+    return __x.compare(__y) == 0;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
+{
+    return __x.compare(__y) < 0;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
+{
+    return __y < __x;
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
+           const sub_match<_BiIter>& __y)
+{
+    return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) == 0;
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
+           const sub_match<_BiIter>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
+          const sub_match<_BiIter>& __y)
+{
+    return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) > 0;
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
+          const sub_match<_BiIter>& __y)
+{
+    return __y < __x;
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator>=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
+                const sub_match<_BiIter>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
+           const sub_match<_BiIter>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const sub_match<_BiIter>& __x,
+           const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
+{
+    return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) == 0;
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const sub_match<_BiIter>& __x,
+           const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const sub_match<_BiIter>& __x,
+          const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
+{
+    return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) < 0;
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator>(const sub_match<_BiIter>& __x,
+               const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
+{
+    return __y < __x;
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const sub_match<_BiIter>& __x,
+           const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _BiIter, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const sub_match<_BiIter>& __x,
+           const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(typename iterator_traits<_BiIter>::value_type const* __x,
+           const sub_match<_BiIter>& __y)
+{
+    return __y.compare(__x) == 0;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(typename iterator_traits<_BiIter>::value_type const* __x,
+           const sub_match<_BiIter>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(typename iterator_traits<_BiIter>::value_type const* __x,
+          const sub_match<_BiIter>& __y)
+{
+    return __y.compare(__x) > 0;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(typename iterator_traits<_BiIter>::value_type const* __x,
+          const sub_match<_BiIter>& __y)
+{
+    return __y < __x;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(typename iterator_traits<_BiIter>::value_type const* __x,
+           const sub_match<_BiIter>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(typename iterator_traits<_BiIter>::value_type const* __x,
+           const sub_match<_BiIter>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const sub_match<_BiIter>& __x,
+           typename iterator_traits<_BiIter>::value_type const* __y)
+{
+    return __x.compare(__y) == 0;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const sub_match<_BiIter>& __x,
+           typename iterator_traits<_BiIter>::value_type const* __y)
+{
+    return !(__x == __y);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const sub_match<_BiIter>& __x,
+          typename iterator_traits<_BiIter>::value_type const* __y)
+{
+    return __x.compare(__y) < 0;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const sub_match<_BiIter>& __x,
+          typename iterator_traits<_BiIter>::value_type const* __y)
+{
+    return __y < __x;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const sub_match<_BiIter>& __x,
+           typename iterator_traits<_BiIter>::value_type const* __y)
+{
+    return !(__x < __y);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const sub_match<_BiIter>& __x,
+           typename iterator_traits<_BiIter>::value_type const* __y)
+{
+    return !(__y < __x);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(typename iterator_traits<_BiIter>::value_type const& __x,
+           const sub_match<_BiIter>& __y)
+{
+    typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+    return __y.compare(string_type(1, __x)) == 0;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(typename iterator_traits<_BiIter>::value_type const& __x,
+           const sub_match<_BiIter>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(typename iterator_traits<_BiIter>::value_type const& __x,
+          const sub_match<_BiIter>& __y)
+{
+    typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+    return __y.compare(string_type(1, __x)) > 0;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(typename iterator_traits<_BiIter>::value_type const& __x,
+          const sub_match<_BiIter>& __y)
+{
+    return __y < __x;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(typename iterator_traits<_BiIter>::value_type const& __x,
+           const sub_match<_BiIter>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(typename iterator_traits<_BiIter>::value_type const& __x,
+           const sub_match<_BiIter>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const sub_match<_BiIter>& __x,
+           typename iterator_traits<_BiIter>::value_type const& __y)
+{
+    typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+    return __x.compare(string_type(1, __y)) == 0;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const sub_match<_BiIter>& __x,
+           typename iterator_traits<_BiIter>::value_type const& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const sub_match<_BiIter>& __x,
+          typename iterator_traits<_BiIter>::value_type const& __y)
+{
+    typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+    return __x.compare(string_type(1, __y)) < 0;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const sub_match<_BiIter>& __x,
+          typename iterator_traits<_BiIter>::value_type const& __y)
+{
+    return __y < __x;
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const sub_match<_BiIter>& __x,
+           typename iterator_traits<_BiIter>::value_type const& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const sub_match<_BiIter>& __x,
+           typename iterator_traits<_BiIter>::value_type const& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _CharT, class _ST, class _BiIter>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _ST>&
+operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
+{
+    return __os << __m.str();
+}
+
+template <class _BidirectionalIterator, class _Allocator>
+class _LIBCPP_TYPE_VIS_ONLY match_results
+{
+public:
+    typedef _Allocator                                        allocator_type;
+    typedef sub_match<_BidirectionalIterator>                 value_type;
+private:
+    typedef vector<value_type, allocator_type>                __container_type;
+
+    __container_type  __matches_;
+    value_type __unmatched_;
+    value_type __prefix_;
+    value_type __suffix_;
+    bool       __ready_;
+public:
+    _BidirectionalIterator __position_start_;
+    typedef const value_type&                                 const_reference;
+    typedef value_type&                                       reference;
+    typedef typename __container_type::const_iterator         const_iterator;
+    typedef const_iterator                                    iterator;
+    typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+    typedef typename allocator_traits<allocator_type>::size_type size_type;
+    typedef typename iterator_traits<_BidirectionalIterator>::value_type char_type;
+    typedef basic_string<char_type>                           string_type;
+
+    // construct/copy/destroy:
+    explicit match_results(const allocator_type& __a = allocator_type());
+//    match_results(const match_results&) = default;
+//    match_results& operator=(const match_results&) = default;
+//    match_results(match_results&& __m) = default;
+//    match_results& operator=(match_results&& __m) = default;
+//    ~match_results() = default;
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool ready() const {return __ready_;}
+
+    // size:
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const {return __matches_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const {return __matches_.max_size();}
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty() const {return size() == 0;}
+
+    // element access:
+    _LIBCPP_INLINE_VISIBILITY
+    difference_type length(size_type __sub = 0) const
+        {return (*this)[__sub].length();}
+    _LIBCPP_INLINE_VISIBILITY
+    difference_type position(size_type __sub = 0) const
+        {return _VSTD::distance(__position_start_, (*this)[__sub].first);}
+    _LIBCPP_INLINE_VISIBILITY
+    string_type str(size_type __sub = 0) const
+        {return (*this)[__sub].str();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference operator[](size_type __n) const
+        {return __n < __matches_.size() ? __matches_[__n] : __unmatched_;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference prefix() const {return __prefix_;}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference suffix() const {return __suffix_;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end() const {return __matches_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend() const {return __matches_.end();}
+
+    // format:
+    template <class _OutputIter>
+        _OutputIter
+        format(_OutputIter __out, const char_type* __fmt_first,
+               const char_type* __fmt_last,
+               regex_constants::match_flag_type __flags = regex_constants::format_default) const;
+    template <class _OutputIter, class _ST, class _SA>
+        _LIBCPP_INLINE_VISIBILITY
+        _OutputIter
+        format(_OutputIter __out, const basic_string<char_type, _ST, _SA>& __fmt,
+               regex_constants::match_flag_type __flags = regex_constants::format_default) const
+            {return format(__out, __fmt.data(), __fmt.data() + __fmt.size(), __flags);}
+    template <class _ST, class _SA>
+        _LIBCPP_INLINE_VISIBILITY
+        basic_string<char_type, _ST, _SA>
+        format(const basic_string<char_type, _ST, _SA>& __fmt,
+               regex_constants::match_flag_type __flags = regex_constants::format_default) const
+        {
+            basic_string<char_type, _ST, _SA> __r;
+            format(back_inserter(__r), __fmt.data(), __fmt.data() + __fmt.size(),
+                   __flags);
+            return __r;
+        }
+    _LIBCPP_INLINE_VISIBILITY
+    string_type
+        format(const char_type* __fmt,
+               regex_constants::match_flag_type __flags = regex_constants::format_default) const
+        {
+            string_type __r;
+            format(back_inserter(__r), __fmt,
+                   __fmt + char_traits<char_type>::length(__fmt), __flags);
+            return __r;
+        }
+
+    // allocator:
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const {return __matches_.get_allocator();}
+
+    // swap:
+    void swap(match_results& __m);
+
+    template <class _Bp, class _Ap>
+        _LIBCPP_INLINE_VISIBILITY
+        void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l,
+                      const match_results<_Bp, _Ap>& __m, bool __no_update_pos)
+    {
+        _Bp __mf = __m.prefix().first;
+        __matches_.resize(__m.size());
+        for (size_type __i = 0; __i < __matches_.size(); ++__i)
+        {
+            __matches_[__i].first = _VSTD::next(__f, _VSTD::distance(__mf, __m[__i].first));
+            __matches_[__i].second = _VSTD::next(__f, _VSTD::distance(__mf, __m[__i].second));
+            __matches_[__i].matched = __m[__i].matched;
+        }
+        __unmatched_.first   = __l;
+        __unmatched_.second  = __l;
+        __unmatched_.matched = false;
+        __prefix_.first = _VSTD::next(__f, _VSTD::distance(__mf, __m.prefix().first));
+        __prefix_.second = _VSTD::next(__f, _VSTD::distance(__mf, __m.prefix().second));
+        __prefix_.matched = __m.prefix().matched;
+        __suffix_.first = _VSTD::next(__f, _VSTD::distance(__mf, __m.suffix().first));
+        __suffix_.second = _VSTD::next(__f, _VSTD::distance(__mf, __m.suffix().second));
+        __suffix_.matched = __m.suffix().matched;
+        if (!__no_update_pos)
+            __position_start_ = __prefix_.first;
+        __ready_ = __m.ready();
+    }
+
+private:
+    void __init(unsigned __s,
+                _BidirectionalIterator __f, _BidirectionalIterator __l,
+                bool __no_update_pos = false);
+
+    template <class, class> friend class basic_regex;
+
+    template <class _Bp, class _Ap, class _Cp, class _Tp>
+    friend
+    bool
+    regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
+                regex_constants::match_flag_type);
+
+    template <class _Bp, class _Ap>
+    friend
+    bool
+    operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&);
+
+    template <class, class> friend class __lookahead;
+};
+
+template <class _BidirectionalIterator, class _Allocator>
+match_results<_BidirectionalIterator, _Allocator>::match_results(
+        const allocator_type& __a)
+    : __matches_(__a),
+      __unmatched_(),
+      __prefix_(),
+      __suffix_(),
+      __ready_(false),
+      __position_start_()
+{
+}
+
+template <class _BidirectionalIterator, class _Allocator>
+void
+match_results<_BidirectionalIterator, _Allocator>::__init(unsigned __s,
+                         _BidirectionalIterator __f, _BidirectionalIterator __l,
+                         bool __no_update_pos)
+{
+    __unmatched_.first   = __l;
+    __unmatched_.second  = __l;
+    __unmatched_.matched = false;
+    __matches_.assign(__s, __unmatched_);
+    __prefix_.first      = __f;
+    __prefix_.second     = __f;
+    __prefix_.matched    = false;
+    __suffix_ = __unmatched_;
+    if (!__no_update_pos)
+        __position_start_ = __prefix_.first;
+    __ready_ = true;
+}
+
+template <class _BidirectionalIterator, class _Allocator>
+template <class _OutputIter>
+_OutputIter
+match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __out,
+        const char_type* __fmt_first, const char_type* __fmt_last,
+        regex_constants::match_flag_type __flags) const
+{
+    if (__flags & regex_constants::format_sed)
+    {
+        for (; __fmt_first != __fmt_last; ++__fmt_first)
+        {
+            if (*__fmt_first == '&')
+                __out = _VSTD::copy(__matches_[0].first, __matches_[0].second,
+                                   __out);
+            else if (*__fmt_first == '\\' && __fmt_first + 1 != __fmt_last)
+            {
+                ++__fmt_first;
+                if ('0' <= *__fmt_first && *__fmt_first <= '9')
+                {
+                    size_t __i = *__fmt_first - '0';
+                    __out = _VSTD::copy(__matches_[__i].first,
+                                       __matches_[__i].second, __out);
+                }
+                else
+                {
+                    *__out = *__fmt_first;
+                    ++__out;
+                }
+            }
+            else
+            {
+                *__out = *__fmt_first;
+                ++__out;
+            }
+        }
+    }
+    else
+    {
+        for (; __fmt_first != __fmt_last; ++__fmt_first)
+        {
+            if (*__fmt_first == '$' && __fmt_first + 1 != __fmt_last)
+            {
+                switch (__fmt_first[1])
+                {
+                case '$':
+                    *__out = *++__fmt_first;
+                    ++__out;
+                    break;
+                case '&':
+                    ++__fmt_first;
+                    __out = _VSTD::copy(__matches_[0].first, __matches_[0].second,
+                                       __out);
+                    break;
+                case '`':
+                    ++__fmt_first;
+                    __out = _VSTD::copy(__prefix_.first, __prefix_.second, __out);
+                    break;
+                case '\'':
+                    ++__fmt_first;
+                    __out = _VSTD::copy(__suffix_.first, __suffix_.second, __out);
+                    break;
+                default:
+                    if ('0' <= __fmt_first[1] && __fmt_first[1] <= '9')
+                    {
+                        ++__fmt_first;
+                        size_t __i = *__fmt_first - '0';
+                        if (__fmt_first + 1 != __fmt_last &&
+                            '0' <= __fmt_first[1] && __fmt_first[1] <= '9')
+                        {
+                            ++__fmt_first;
+                            __i = 10 * __i + *__fmt_first - '0';
+                        }
+                        __out = _VSTD::copy(__matches_[__i].first,
+                                           __matches_[__i].second, __out);
+                    }
+                    else
+                    {
+                        *__out = *__fmt_first;
+                        ++__out;
+                    }
+                    break;
+                }
+            }
+            else
+            {
+                *__out = *__fmt_first;
+                ++__out;
+            }
+        }
+    }
+    return __out;
+}
+
+template <class _BidirectionalIterator, class _Allocator>
+void
+match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m)
+{
+    using _VSTD::swap;
+    swap(__matches_, __m.__matches_);
+    swap(__unmatched_, __m.__unmatched_);
+    swap(__prefix_, __m.__prefix_);
+    swap(__suffix_, __m.__suffix_);
+    swap(__position_start_, __m.__position_start_);
+    swap(__ready_, __m.__ready_);
+}
+
+typedef match_results<const char*>             cmatch;
+typedef match_results<const wchar_t*>          wcmatch;
+typedef match_results<string::const_iterator>  smatch;
+typedef match_results<wstring::const_iterator> wsmatch;
+
+template <class _BidirectionalIterator, class _Allocator>
+bool
+operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
+           const match_results<_BidirectionalIterator, _Allocator>& __y)
+{
+    if (__x.__ready_ != __y.__ready_)
+        return false;
+    if (!__x.__ready_)
+        return true;
+    return __x.__matches_ == __y.__matches_ &&
+           __x.__prefix_ == __y.__prefix_ &&
+           __x.__suffix_ == __y.__suffix_;
+}
+
+template <class _BidirectionalIterator, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const match_results<_BidirectionalIterator, _Allocator>& __x,
+           const match_results<_BidirectionalIterator, _Allocator>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _BidirectionalIterator, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(match_results<_BidirectionalIterator, _Allocator>& __x,
+     match_results<_BidirectionalIterator, _Allocator>& __y)
+{
+    __x.swap(__y);
+}
+
+// regex_search
+
+template <class _CharT, class _Traits>
+template <class _Allocator>
+bool
+basic_regex<_CharT, _Traits>::__match_at_start_ecma(
+        const _CharT* __first, const _CharT* __last,
+        match_results<const _CharT*, _Allocator>& __m,
+        regex_constants::match_flag_type __flags, bool __at_first) const
+{
+    vector<__state> __states;
+    __node* __st = __start_.get();
+    if (__st)
+    {
+        sub_match<const _CharT*> __unmatched;
+        __unmatched.first   = __last;
+        __unmatched.second  = __last;
+        __unmatched.matched = false;
+
+        __states.push_back(__state());
+        __states.back().__do_ = 0;
+        __states.back().__first_ = __first;
+        __states.back().__current_ = __first;
+        __states.back().__last_ = __last;
+        __states.back().__sub_matches_.resize(mark_count(), __unmatched);
+        __states.back().__loop_data_.resize(__loop_count());
+        __states.back().__node_ = __st;
+        __states.back().__flags_ = __flags;
+        __states.back().__at_first_ = __at_first;
+        do
+        {
+            __state& __s = __states.back();
+            if (__s.__node_)
+                __s.__node_->__exec(__s);
+            switch (__s.__do_)
+            {
+            case __state::__end_state:
+                __m.__matches_[0].first = __first;
+                __m.__matches_[0].second = _VSTD::next(__first, __s.__current_ - __first);
+                __m.__matches_[0].matched = true;
+                for (unsigned __i = 0; __i < __s.__sub_matches_.size(); ++__i)
+                    __m.__matches_[__i+1] = __s.__sub_matches_[__i];
+                return true;
+            case __state::__accept_and_consume:
+            case __state::__repeat:
+            case __state::__accept_but_not_consume:
+                break;
+            case __state::__split:
+                {
+                __state __snext = __s;
+                __s.__node_->__exec_split(true, __s);
+                __snext.__node_->__exec_split(false, __snext);
+                __states.push_back(_VSTD::move(__snext));
+                }
+                break;
+            case __state::__reject:
+                __states.pop_back();
+                break;
+            default:
+                __throw_regex_error<regex_constants::__re_err_unknown>();
+                break;
+
+            }
+        } while (!__states.empty());
+    }
+    return false;
+}
+
+template <class _CharT, class _Traits>
+template <class _Allocator>
+bool
+basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
+        const _CharT* __first, const _CharT* __last,
+        match_results<const _CharT*, _Allocator>& __m,
+        regex_constants::match_flag_type __flags, bool __at_first) const
+{
+    deque<__state> __states;
+    ptrdiff_t __highest_j = 0;
+    ptrdiff_t _Np = _VSTD::distance(__first, __last);
+    __node* __st = __start_.get();
+    if (__st)
+    {
+        __states.push_back(__state());
+        __states.back().__do_ = 0;
+        __states.back().__first_ = __first;
+        __states.back().__current_ = __first;
+        __states.back().__last_ = __last;
+        __states.back().__loop_data_.resize(__loop_count());
+        __states.back().__node_ = __st;
+        __states.back().__flags_ = __flags;
+        __states.back().__at_first_ = __at_first;
+        bool __matched = false;
+        do
+        {
+            __state& __s = __states.back();
+            if (__s.__node_)
+                __s.__node_->__exec(__s);
+            switch (__s.__do_)
+            {
+            case __state::__end_state:
+                if (!__matched || __highest_j < __s.__current_ - __s.__first_)
+                    __highest_j = __s.__current_ - __s.__first_;
+                __matched = true;
+                if (__highest_j == _Np)
+                    __states.clear();
+                else
+                    __states.pop_back();
+                break;
+            case __state::__consume_input:
+                break;
+            case __state::__accept_and_consume:
+                __states.push_front(_VSTD::move(__s));
+                __states.pop_back();
+                break;
+            case __state::__repeat:
+            case __state::__accept_but_not_consume:
+                break;
+            case __state::__split:
+                {
+                __state __snext = __s;
+                __s.__node_->__exec_split(true, __s);
+                __snext.__node_->__exec_split(false, __snext);
+                __states.push_back(_VSTD::move(__snext));
+                }
+                break;
+            case __state::__reject:
+                __states.pop_back();
+                break;
+            default:
+                __throw_regex_error<regex_constants::__re_err_unknown>();
+                break;
+            }
+        } while (!__states.empty());
+        if (__matched)
+        {
+            __m.__matches_[0].first = __first;
+            __m.__matches_[0].second = _VSTD::next(__first, __highest_j);
+            __m.__matches_[0].matched = true;
+            return true;
+        }
+    }
+    return false;
+}
+
+template <class _CharT, class _Traits>
+template <class _Allocator>
+bool
+basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
+        const _CharT* __first, const _CharT* __last,
+        match_results<const _CharT*, _Allocator>& __m,
+        regex_constants::match_flag_type __flags, bool __at_first) const
+{
+    vector<__state> __states;
+    __state __best_state;
+    ptrdiff_t __j = 0;
+    ptrdiff_t __highest_j = 0;
+    ptrdiff_t _Np = _VSTD::distance(__first, __last);
+    __node* __st = __start_.get();
+    if (__st)
+    {
+        sub_match<const _CharT*> __unmatched;
+        __unmatched.first   = __last;
+        __unmatched.second  = __last;
+        __unmatched.matched = false;
+
+        __states.push_back(__state());
+        __states.back().__do_ = 0;
+        __states.back().__first_ = __first;
+        __states.back().__current_ = __first;
+        __states.back().__last_ = __last;
+        __states.back().__sub_matches_.resize(mark_count(), __unmatched);
+        __states.back().__loop_data_.resize(__loop_count());
+        __states.back().__node_ = __st;
+        __states.back().__flags_ = __flags;
+        __states.back().__at_first_ = __at_first;
+        const _CharT* __current = __first;
+        bool __matched = false;
+        do
+        {
+            __state& __s = __states.back();
+            if (__s.__node_)
+                __s.__node_->__exec(__s);
+            switch (__s.__do_)
+            {
+            case __state::__end_state:
+                if (!__matched || __highest_j < __s.__current_ - __s.__first_)
+                {
+                    __highest_j = __s.__current_ - __s.__first_;
+                    __best_state = __s;
+                }
+                __matched = true;
+                if (__highest_j == _Np)
+                    __states.clear();
+                else
+                    __states.pop_back();
+                break;
+            case __state::__accept_and_consume:
+                __j += __s.__current_ - __current;
+                __current = __s.__current_;
+                break;
+            case __state::__repeat:
+            case __state::__accept_but_not_consume:
+                break;
+            case __state::__split:
+                {
+                __state __snext = __s;
+                __s.__node_->__exec_split(true, __s);
+                __snext.__node_->__exec_split(false, __snext);
+                __states.push_back(_VSTD::move(__snext));
+                }
+                break;
+            case __state::__reject:
+                __states.pop_back();
+                break;
+            default:
+                __throw_regex_error<regex_constants::__re_err_unknown>();
+                break;
+            }
+        } while (!__states.empty());
+        if (__matched)
+        {
+            __m.__matches_[0].first = __first;
+            __m.__matches_[0].second = _VSTD::next(__first, __highest_j);
+            __m.__matches_[0].matched = true;
+            for (unsigned __i = 0; __i < __best_state.__sub_matches_.size(); ++__i)
+                __m.__matches_[__i+1] = __best_state.__sub_matches_[__i];
+            return true;
+        }
+    }
+    return false;
+}
+
+template <class _CharT, class _Traits>
+template <class _Allocator>
+bool
+basic_regex<_CharT, _Traits>::__match_at_start(
+        const _CharT* __first, const _CharT* __last,
+        match_results<const _CharT*, _Allocator>& __m,
+        regex_constants::match_flag_type __flags, bool __at_first) const
+{
+    if ((__flags_ & 0x1F0) == ECMAScript)
+        return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
+    if (mark_count() == 0)
+        return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
+    return __match_at_start_posix_subs(__first, __last, __m, __flags, __at_first);
+}
+
+template <class _CharT, class _Traits>
+template <class _Allocator>
+bool
+basic_regex<_CharT, _Traits>::__search(
+        const _CharT* __first, const _CharT* __last,
+        match_results<const _CharT*, _Allocator>& __m,
+        regex_constants::match_flag_type __flags) const
+{
+    __m.__init(1 + mark_count(), __first, __last,
+                                    __flags & regex_constants::__no_update_pos);
+    if (__match_at_start(__first, __last, __m, __flags, 
+                                    !(__flags & regex_constants::__no_update_pos)))
+    {
+        __m.__prefix_.second = __m[0].first;
+        __m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
+        __m.__suffix_.first = __m[0].second;
+        __m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second;
+        return true;
+    }
+    if (__first != __last && !(__flags & regex_constants::match_continuous))
+    {
+        __flags |= regex_constants::match_prev_avail;
+        for (++__first; __first != __last; ++__first)
+        {
+            __m.__matches_.assign(__m.size(), __m.__unmatched_);
+            if (__match_at_start(__first, __last, __m, __flags, false))
+            {
+                __m.__prefix_.second = __m[0].first;
+                __m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
+                __m.__suffix_.first = __m[0].second;
+                __m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second;
+                return true;
+            }
+            __m.__matches_.assign(__m.size(), __m.__unmatched_);
+        }
+    }
+    __m.__matches_.clear();
+    return false;
+}
+
+template <class _BidirectionalIterator, class _Allocator, class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_search(_BidirectionalIterator __first, _BidirectionalIterator __last,
+             match_results<_BidirectionalIterator, _Allocator>& __m,
+             const basic_regex<_CharT, _Traits>& __e,
+             regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    int __offset = (__flags & regex_constants::match_prev_avail) ? 1 : 0;
+    basic_string<_CharT> __s(_VSTD::prev(__first, __offset), __last);
+    match_results<const _CharT*> __mc;
+    bool __r = __e.__search(__s.data() + __offset, __s.data() + __s.size(), __mc, __flags);
+    __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
+    return __r;
+}
+
+template <class _Iter, class _Allocator, class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_search(__wrap_iter<_Iter> __first,
+             __wrap_iter<_Iter> __last,
+             match_results<__wrap_iter<_Iter>, _Allocator>& __m,
+             const basic_regex<_CharT, _Traits>& __e,
+             regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    match_results<const _CharT*> __mc;
+    bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags);
+    __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
+    return __r;
+}
+
+template <class _Allocator, class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_search(const _CharT* __first, const _CharT* __last,
+             match_results<const _CharT*, _Allocator>& __m,
+             const basic_regex<_CharT, _Traits>& __e,
+             regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    return __e.__search(__first, __last, __m, __flags);
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_search(_BidirectionalIterator __first, _BidirectionalIterator __last,
+             const basic_regex<_CharT, _Traits>& __e,
+             regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    basic_string<_CharT> __s(__first, __last);
+    match_results<const _CharT*> __mc;
+    return __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_search(const _CharT* __first, const _CharT* __last,
+             const basic_regex<_CharT, _Traits>& __e,
+             regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    match_results<const _CharT*> __mc;
+    return __e.__search(__first, __last, __mc, __flags);
+}
+
+template <class _CharT, class _Allocator, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_search(const _CharT* __str, match_results<const _CharT*, _Allocator>& __m,
+             const basic_regex<_CharT, _Traits>& __e,
+             regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    return __e.__search(__str, __str + _Traits::length(__str), __m, __flags);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_search(const _CharT* __str, const basic_regex<_CharT, _Traits>& __e,
+             regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    match_results<const _CharT*> __m;
+    return _VSTD::regex_search(__str, __m, __e, __flags);
+}
+
+template <class _ST, class _SA, class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_search(const basic_string<_CharT, _ST, _SA>& __s,
+             const basic_regex<_CharT, _Traits>& __e,
+             regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    match_results<const _CharT*> __mc;
+    return __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
+}
+
+template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_search(const basic_string<_CharT, _ST, _SA>& __s,
+             match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
+             const basic_regex<_CharT, _Traits>& __e,
+             regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    match_results<const _CharT*> __mc;
+    bool __r = __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
+    __m.__assign(__s.begin(), __s.end(), __mc, __flags & regex_constants::__no_update_pos);
+    return __r;
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
+bool
+regex_search(const basic_string<_Cp, _ST, _SA>&& __s,
+             match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
+             const basic_regex<_Cp, _Tp>& __e,
+             regex_constants::match_flag_type __flags = regex_constants::match_default) = delete; 
+#endif
+
+// regex_match
+
+template <class _BidirectionalIterator, class _Allocator, class _CharT, class _Traits>
+bool
+regex_match(_BidirectionalIterator __first, _BidirectionalIterator __last,
+            match_results<_BidirectionalIterator, _Allocator>& __m,
+            const basic_regex<_CharT, _Traits>& __e,
+            regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    bool __r = _VSTD::regex_search(__first, __last, __m, __e,
+                            __flags | regex_constants::match_continuous);
+    if (__r)
+    {
+        __r = !__m.suffix().matched;
+        if (!__r)
+            __m.__matches_.clear();
+    }
+    return __r;
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_match(_BidirectionalIterator __first, _BidirectionalIterator __last,
+            const basic_regex<_CharT, _Traits>& __e,
+            regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    match_results<_BidirectionalIterator> __m;
+    return _VSTD::regex_match(__first, __last, __m, __e, __flags);
+}
+
+template <class _CharT, class _Allocator, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_match(const _CharT* __str, match_results<const _CharT*, _Allocator>& __m,
+            const basic_regex<_CharT, _Traits>& __e,
+            regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    return _VSTD::regex_match(__str, __str + _Traits::length(__str), __m, __e, __flags);
+}
+
+template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_match(const basic_string<_CharT, _ST, _SA>& __s,
+            match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
+            const basic_regex<_CharT, _Traits>& __e,
+            regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    return _VSTD::regex_match(__s.begin(), __s.end(), __m, __e, __flags);
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_match(const basic_string<_CharT, _ST, _SA>&& __s,
+            match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
+            const basic_regex<_CharT, _Traits>& __e,
+            regex_constants::match_flag_type __flags = regex_constants::match_default) = delete; 
+#endif
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_match(const _CharT* __str, const basic_regex<_CharT, _Traits>& __e,
+            regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    return _VSTD::regex_match(__str, __str + _Traits::length(__str), __e, __flags);
+}
+
+template <class _ST, class _SA, class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+regex_match(const basic_string<_CharT, _ST, _SA>& __s,
+            const basic_regex<_CharT, _Traits>& __e,
+            regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    return _VSTD::regex_match(__s.begin(), __s.end(), __e, __flags);
+}
+
+// regex_iterator
+
+template <class _BidirectionalIterator,
+          class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
+          class _Traits = regex_traits<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY regex_iterator
+{
+public:
+    typedef basic_regex<_CharT, _Traits>          regex_type;
+    typedef match_results<_BidirectionalIterator> value_type;
+    typedef ptrdiff_t                             difference_type;
+    typedef const value_type*                     pointer;
+    typedef const value_type&                     reference;
+    typedef forward_iterator_tag                  iterator_category;
+
+private:
+    _BidirectionalIterator           __begin_;
+    _BidirectionalIterator           __end_;
+    const regex_type*                __pregex_;
+    regex_constants::match_flag_type __flags_;
+    value_type                       __match_;
+
+public:
+    regex_iterator();
+    regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                   const regex_type& __re,
+                   regex_constants::match_flag_type __m
+                                              = regex_constants::match_default);
+#if _LIBCPP_STD_VER > 11
+    regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                   const regex_type&& __re,
+                   regex_constants::match_flag_type __m 
+                                     = regex_constants::match_default) = delete;
+#endif
+
+    bool operator==(const regex_iterator& __x) const;
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const regex_iterator& __x) const {return !(*this == __x);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference operator*() const {return  __match_;}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const  {return &__match_;}
+
+    regex_iterator& operator++();
+    _LIBCPP_INLINE_VISIBILITY
+    regex_iterator operator++(int)
+    {
+        regex_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+};
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+regex_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_iterator()
+    : __begin_(), __end_(), __pregex_(nullptr), __flags_(), __match_()
+{
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+regex_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                   const regex_type& __re, regex_constants::match_flag_type __m)
+    : __begin_(__a),
+      __end_(__b),
+      __pregex_(&__re),
+      __flags_(__m)
+{
+    _VSTD::regex_search(__begin_, __end_, __match_, *__pregex_, __flags_);
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+bool
+regex_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    operator==(const regex_iterator& __x) const
+{
+    if (__match_.empty() && __x.__match_.empty())
+        return true;
+    if (__match_.empty() || __x.__match_.empty())
+        return false;
+    return __begin_ == __x.__begin_       &&
+           __end_ == __x.__end_           &&
+           __pregex_ == __x.__pregex_     &&
+           __flags_ == __x.__flags_       &&
+           __match_[0] == __x.__match_[0];
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+regex_iterator<_BidirectionalIterator, _CharT, _Traits>&
+regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
+{
+    __flags_ |= regex_constants::__no_update_pos;
+    _BidirectionalIterator __start = __match_[0].second;
+    if (__match_.empty())
+    {
+        if (__start == __end_)
+        {
+            __match_ = value_type();
+            return *this;
+        }
+        else if (_VSTD::regex_search(__start, __end_, __match_, *__pregex_,
+                                    __flags_ | regex_constants::match_not_null |
+                                    regex_constants::match_continuous))
+            return *this;
+        else
+            ++__start;
+    }
+    __flags_ |= regex_constants::match_prev_avail;
+    if (!_VSTD::regex_search(__start, __end_, __match_, *__pregex_, __flags_))
+        __match_ = value_type();
+    return *this;
+}
+
+typedef regex_iterator<const char*>             cregex_iterator;
+typedef regex_iterator<const wchar_t*>          wcregex_iterator;
+typedef regex_iterator<string::const_iterator>  sregex_iterator;
+typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
+
+// regex_token_iterator
+
+template <class _BidirectionalIterator,
+          class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
+          class _Traits = regex_traits<_CharT> >
+class _LIBCPP_TYPE_VIS_ONLY regex_token_iterator
+{
+public:
+    typedef basic_regex<_CharT, _Traits>      regex_type;
+    typedef sub_match<_BidirectionalIterator> value_type;
+    typedef ptrdiff_t                         difference_type;
+    typedef const value_type*                 pointer;
+    typedef const value_type&                 reference;
+    typedef forward_iterator_tag              iterator_category;
+
+private:
+    typedef regex_iterator<_BidirectionalIterator, _CharT, _Traits> _Position;
+
+    _Position         __position_;
+    const value_type* __result_;
+    value_type        __suffix_;
+    ptrdiff_t         _N_;
+    vector<int>       __subs_;
+
+public:
+    regex_token_iterator();
+    regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                         const regex_type& __re, int __submatch = 0,
+                         regex_constants::match_flag_type __m =
+                                                regex_constants::match_default);
+#if _LIBCPP_STD_VER > 11
+    regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                         const regex_type&& __re, int __submatch = 0,
+                         regex_constants::match_flag_type __m =
+                                       regex_constants::match_default) = delete;
+#endif
+
+    regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                         const regex_type& __re, const vector<int>& __submatches,
+                         regex_constants::match_flag_type __m =
+                                                regex_constants::match_default);
+#if _LIBCPP_STD_VER > 11
+    regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                         const regex_type&& __re, const vector<int>& __submatches,
+                         regex_constants::match_flag_type __m =
+                                     regex_constants::match_default) = delete;
+#endif
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                         const regex_type& __re,
+                         initializer_list<int> __submatches,
+                         regex_constants::match_flag_type __m =
+                                                regex_constants::match_default);
+
+#if _LIBCPP_STD_VER > 11
+    regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                         const regex_type&& __re,
+                         initializer_list<int> __submatches,
+                         regex_constants::match_flag_type __m =
+                                       regex_constants::match_default) = delete;
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    template <size_t _Np>
+        regex_token_iterator(_BidirectionalIterator __a,
+                             _BidirectionalIterator __b,
+                             const regex_type& __re,
+                             const int (&__submatches)[_Np],
+                             regex_constants::match_flag_type __m =
+                                                regex_constants::match_default);
+#if _LIBCPP_STD_VER > 11
+    template <std::size_t _Np>
+        regex_token_iterator(_BidirectionalIterator __a,
+                             _BidirectionalIterator __b,
+                             const regex_type&& __re,
+                             const int (&__submatches)[_Np],
+                             regex_constants::match_flag_type __m =
+                                      regex_constants::match_default) = delete;
+#endif
+
+    regex_token_iterator(const regex_token_iterator&);
+    regex_token_iterator& operator=(const regex_token_iterator&);
+
+    bool operator==(const regex_token_iterator& __x) const;
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const regex_token_iterator& __x) const {return !(*this == __x);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const value_type& operator*() const {return *__result_;}
+    _LIBCPP_INLINE_VISIBILITY
+    const value_type* operator->() const {return __result_;}
+
+    regex_token_iterator& operator++();
+    _LIBCPP_INLINE_VISIBILITY
+    regex_token_iterator operator++(int)
+    {
+        regex_token_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+private:
+    void __init(_BidirectionalIterator __a, _BidirectionalIterator __b);
+    void __establish_result () {
+        if (__subs_[_N_] == -1)
+            __result_ = &__position_->prefix();
+        else
+            __result_ = &(*__position_)[__subs_[_N_]];
+        }       
+};
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    regex_token_iterator()
+    : __result_(nullptr),
+      __suffix_(),
+      _N_(0)
+{
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+void
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    __init(_BidirectionalIterator __a, _BidirectionalIterator __b)
+{
+    if (__position_ != _Position())
+        __establish_result ();
+    else if (__subs_[_N_] == -1)
+    {
+        __suffix_.matched = true;
+        __suffix_.first = __a;
+        __suffix_.second = __b;
+        __result_ = &__suffix_;
+    }
+    else
+        __result_ = nullptr;
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                         const regex_type& __re, int __submatch,
+                         regex_constants::match_flag_type __m)
+    : __position_(__a, __b, __re, __m),
+      _N_(0),
+      __subs_(1, __submatch)
+{
+    __init(__a, __b);
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                         const regex_type& __re, const vector<int>& __submatches,
+                         regex_constants::match_flag_type __m)
+    : __position_(__a, __b, __re, __m),
+      _N_(0),
+      __subs_(__submatches)
+{
+    __init(__a, __b);
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                         const regex_type& __re,
+                         initializer_list<int> __submatches,
+                         regex_constants::match_flag_type __m)
+    : __position_(__a, __b, __re, __m),
+      _N_(0),
+      __subs_(__submatches)
+{
+    __init(__a, __b);
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+template <size_t _Np>
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
+                             const regex_type& __re,
+                             const int (&__submatches)[_Np],
+                             regex_constants::match_flag_type __m)
+    : __position_(__a, __b, __re, __m),
+      _N_(0),
+      __subs_(__submatches, __submatches + _Np)
+{
+    __init(__a, __b);
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    regex_token_iterator(const regex_token_iterator& __x)
+    : __position_(__x.__position_),
+      __result_(__x.__result_),
+      __suffix_(__x.__suffix_),
+      _N_(__x._N_),
+      __subs_(__x.__subs_)
+{
+    if (__x.__result_ == &__x.__suffix_)
+        __result_ = &__suffix_;
+    else if ( __result_ != nullptr )
+        __establish_result ();
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>&
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    operator=(const regex_token_iterator& __x)
+{
+    if (this != &__x)
+    {
+        __position_ = __x.__position_;
+        if (__x.__result_ == &__x.__suffix_)
+            __result_ = &__suffix_;
+        else
+            __result_ = __x.__result_;
+        __suffix_ = __x.__suffix_;
+        _N_ = __x._N_;
+        __subs_ = __x.__subs_;
+
+        if ( __result_ != nullptr && __result_ != &__suffix_ )
+            __establish_result();
+    }
+    return *this;
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+bool
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
+    operator==(const regex_token_iterator& __x) const
+{
+    if (__result_ == nullptr && __x.__result_ == nullptr)
+        return true;
+    if (__result_ == &__suffix_ && __x.__result_ == &__x.__suffix_ &&
+            __suffix_ == __x.__suffix_)
+        return true;
+    if (__result_ == nullptr || __x.__result_ == nullptr)
+        return false;
+    if (__result_ == &__suffix_ || __x.__result_ == &__x.__suffix_)
+        return false;
+    return __position_ == __x.__position_ && _N_ == __x._N_ &&
+           __subs_ == __x.__subs_;
+}
+
+template <class _BidirectionalIterator, class _CharT, class _Traits>
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>&
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
+{
+    _Position __prev = __position_;
+    if (__result_ == &__suffix_)
+        __result_ = nullptr;
+    else if (_N_ + 1 < __subs_.size())
+    {
+        ++_N_;
+        __establish_result();
+    }
+    else
+    {
+        _N_ = 0;
+        ++__position_;
+        if (__position_ != _Position())
+            __establish_result();
+        else
+        {
+            if (_VSTD::find(__subs_.begin(), __subs_.end(), -1) != __subs_.end()
+                && __prev->suffix().length() != 0)
+            {
+                __suffix_.matched = true;
+                __suffix_.first = __prev->suffix().first;
+                __suffix_.second = __prev->suffix().second;
+                __result_ = &__suffix_;
+            }
+            else
+                __result_ = nullptr;
+        }
+    }
+    return *this;
+}
+
+typedef regex_token_iterator<const char*>             cregex_token_iterator;
+typedef regex_token_iterator<const wchar_t*>          wcregex_token_iterator;
+typedef regex_token_iterator<string::const_iterator>  sregex_token_iterator;
+typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
+
+// regex_replace
+
+template <class _OutputIterator, class _BidirectionalIterator,
+          class _Traits, class _CharT>
+_OutputIterator
+regex_replace(_OutputIterator __out,
+              _BidirectionalIterator __first, _BidirectionalIterator __last,
+              const basic_regex<_CharT, _Traits>& __e, const _CharT* __fmt,
+              regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    typedef regex_iterator<_BidirectionalIterator, _CharT, _Traits> _Iter;
+    _Iter __i(__first, __last, __e, __flags);
+    _Iter __eof;
+    if (__i == __eof)
+    {
+        if (!(__flags & regex_constants::format_no_copy))
+            __out = _VSTD::copy(__first, __last, __out);
+    }
+    else
+    {
+        sub_match<_BidirectionalIterator> __lm;
+        for (size_t __len = char_traits<_CharT>::length(__fmt); __i != __eof; ++__i)
+        {
+            if (!(__flags & regex_constants::format_no_copy))
+                __out = _VSTD::copy(__i->prefix().first, __i->prefix().second, __out);
+            __out = __i->format(__out, __fmt, __fmt + __len, __flags);
+            __lm = __i->suffix();
+            if (__flags & regex_constants::format_first_only)
+                break;
+        }
+        if (!(__flags & regex_constants::format_no_copy))
+            __out = _VSTD::copy(__lm.first, __lm.second, __out);
+    }
+    return __out;
+}
+
+template <class _OutputIterator, class _BidirectionalIterator,
+          class _Traits, class _CharT, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+regex_replace(_OutputIterator __out,
+              _BidirectionalIterator __first, _BidirectionalIterator __last,
+              const basic_regex<_CharT, _Traits>& __e,
+              const basic_string<_CharT, _ST, _SA>& __fmt,
+              regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    return _VSTD::regex_replace(__out, __first, __last, __e, __fmt.c_str(), __flags);
+}
+
+template <class _Traits, class _CharT, class _ST, class _SA, class _FST,
+          class _FSA>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _ST, _SA>
+regex_replace(const basic_string<_CharT, _ST, _SA>& __s,
+              const basic_regex<_CharT, _Traits>& __e,
+              const basic_string<_CharT, _FST, _FSA>& __fmt,
+              regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    basic_string<_CharT, _ST, _SA> __r;
+    _VSTD::regex_replace(back_inserter(__r), __s.begin(), __s.end(), __e,
+                        __fmt.c_str(), __flags);
+    return __r;
+}
+
+template <class _Traits, class _CharT, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _ST, _SA>
+regex_replace(const basic_string<_CharT, _ST, _SA>& __s,
+              const basic_regex<_CharT, _Traits>& __e, const _CharT* __fmt,
+              regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    basic_string<_CharT, _ST, _SA> __r;
+    _VSTD::regex_replace(back_inserter(__r), __s.begin(), __s.end(), __e,
+                        __fmt, __flags);
+    return __r;
+}
+
+template <class _Traits, class _CharT, class _ST, class _SA>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT>
+regex_replace(const _CharT* __s,
+              const basic_regex<_CharT, _Traits>& __e,
+              const basic_string<_CharT, _ST, _SA>& __fmt,
+              regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    basic_string<_CharT> __r;
+    _VSTD::regex_replace(back_inserter(__r), __s,
+                        __s + char_traits<_CharT>::length(__s), __e,
+                        __fmt.c_str(), __flags);
+    return __r;
+}
+
+template <class _Traits, class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT>
+regex_replace(const _CharT* __s,
+              const basic_regex<_CharT, _Traits>& __e,
+              const _CharT* __fmt,
+              regex_constants::match_flag_type __flags = regex_constants::match_default)
+{
+    basic_string<_CharT> __r;
+    _VSTD::regex_replace(back_inserter(__r), __s,
+                        __s + char_traits<_CharT>::length(__s), __e,
+                        __fmt, __flags);
+    return __r;
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_REGEX

Property changes on: lab4/.minix-src/include/c++/regex
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/shared_mutex
===================================================================
--- lab4/.minix-src/include/c++/shared_mutex	(nonexistent)
+++ lab4/.minix-src/include/c++/shared_mutex	(revision 13)
@@ -0,0 +1,501 @@
+// -*- C++ -*-
+//===------------------------ shared_mutex --------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SHARED_MUTEX
+#define _LIBCPP_SHARED_MUTEX
+
+/*
+    shared_mutex synopsis
+
+// C++1y
+
+namespace std
+{
+
+class shared_mutex      // C++17
+{
+public:
+    shared_mutex();
+    ~shared_mutex();
+
+    shared_mutex(const shared_mutex&) = delete;
+    shared_mutex& operator=(const shared_mutex&) = delete;
+
+    // Exclusive ownership
+    void lock(); // blocking
+    bool try_lock();
+    void unlock();
+
+    // Shared ownership
+    void lock_shared(); // blocking
+    bool try_lock_shared();
+    void unlock_shared();
+
+    typedef implementation-defined native_handle_type; // See 30.2.3
+    native_handle_type native_handle(); // See 30.2.3
+};
+
+class shared_timed_mutex
+{
+public:
+    shared_timed_mutex();
+    ~shared_timed_mutex();
+
+    shared_timed_mutex(const shared_timed_mutex&) = delete;
+    shared_timed_mutex& operator=(const shared_timed_mutex&) = delete;
+
+    // Exclusive ownership
+    void lock(); // blocking
+    bool try_lock();
+    template <class Rep, class Period>
+        bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
+    template <class Clock, class Duration>
+        bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
+    void unlock();
+
+    // Shared ownership
+    void lock_shared(); // blocking
+    bool try_lock_shared();
+    template <class Rep, class Period>
+        bool
+        try_lock_shared_for(const chrono::duration<Rep, Period>& rel_time);
+    template <class Clock, class Duration>
+        bool
+        try_lock_shared_until(const chrono::time_point<Clock, Duration>& abs_time);
+    void unlock_shared();
+};
+
+template <class Mutex>
+class shared_lock
+{
+public:
+    typedef Mutex mutex_type;
+
+    // Shared locking
+    shared_lock() noexcept;
+    explicit shared_lock(mutex_type& m); // blocking
+    shared_lock(mutex_type& m, defer_lock_t) noexcept;
+    shared_lock(mutex_type& m, try_to_lock_t);
+    shared_lock(mutex_type& m, adopt_lock_t);
+    template <class Clock, class Duration>
+        shared_lock(mutex_type& m,
+                    const chrono::time_point<Clock, Duration>& abs_time);
+    template <class Rep, class Period>
+        shared_lock(mutex_type& m,
+                    const chrono::duration<Rep, Period>& rel_time);
+    ~shared_lock();
+
+    shared_lock(shared_lock const&) = delete;
+    shared_lock& operator=(shared_lock const&) = delete;
+
+    shared_lock(shared_lock&& u) noexcept;
+    shared_lock& operator=(shared_lock&& u) noexcept;
+
+    void lock(); // blocking
+    bool try_lock();
+    template <class Rep, class Period>
+        bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
+    template <class Clock, class Duration>
+        bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
+    void unlock();
+
+    // Setters
+    void swap(shared_lock& u) noexcept;
+    mutex_type* release() noexcept;
+
+    // Getters
+    bool owns_lock() const noexcept;
+    explicit operator bool () const noexcept;
+    mutex_type* mutex() const noexcept;
+};
+
+template <class Mutex>
+    void swap(shared_lock<Mutex>& x, shared_lock<Mutex>& y) noexcept;
+
+}  // std
+
+*/
+
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11 || defined(_LIBCPP_BUILDING_SHARED_MUTEX)
+
+#include <__mutex_base>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error <shared_mutex> is not supported on this single threaded system
+#else // !_LIBCPP_HAS_NO_THREADS
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+struct _LIBCPP_TYPE_VIS __shared_mutex_base
+{
+    mutex               __mut_;
+    condition_variable  __gate1_;
+    condition_variable  __gate2_;
+    unsigned            __state_;
+
+    static const unsigned __write_entered_ = 1U << (sizeof(unsigned)*__CHAR_BIT__ - 1);
+    static const unsigned __n_readers_ = ~__write_entered_;
+
+    __shared_mutex_base();
+    _LIBCPP_INLINE_VISIBILITY ~__shared_mutex_base() = default;
+
+    __shared_mutex_base(const __shared_mutex_base&) = delete;
+    __shared_mutex_base& operator=(const __shared_mutex_base&) = delete;
+
+    // Exclusive ownership
+    void lock(); // blocking
+    bool try_lock();
+    void unlock();
+
+    // Shared ownership
+    void lock_shared(); // blocking
+    bool try_lock_shared();
+    void unlock_shared();
+
+//     typedef implementation-defined native_handle_type; // See 30.2.3
+//     native_handle_type native_handle(); // See 30.2.3
+};
+
+
+#if _LIBCPP_STD_VER > 14
+class _LIBCPP_TYPE_VIS shared_mutex
+{
+	__shared_mutex_base __base;
+public:
+    shared_mutex() : __base() {}
+    _LIBCPP_INLINE_VISIBILITY ~shared_mutex() = default;
+
+    shared_mutex(const shared_mutex&) = delete;
+    shared_mutex& operator=(const shared_mutex&) = delete;
+
+    // Exclusive ownership
+    _LIBCPP_INLINE_VISIBILITY void lock()     { return __base.lock(); }
+    _LIBCPP_INLINE_VISIBILITY bool try_lock() { return __base.try_lock(); }
+    _LIBCPP_INLINE_VISIBILITY void unlock()   { return __base.unlock(); }
+
+    // Shared ownership
+    _LIBCPP_INLINE_VISIBILITY void lock_shared()     { return __base.lock_shared(); }
+    _LIBCPP_INLINE_VISIBILITY bool try_lock_shared() { return __base.try_lock_shared(); }
+    _LIBCPP_INLINE_VISIBILITY void unlock_shared()   { return __base.unlock_shared(); }
+
+//     typedef __shared_mutex_base::native_handle_type native_handle_type;
+//     _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() { return __base::unlock_shared(); }
+};
+#endif
+
+
+class _LIBCPP_TYPE_VIS shared_timed_mutex
+{
+	__shared_mutex_base __base;
+public:
+    shared_timed_mutex();
+    _LIBCPP_INLINE_VISIBILITY ~shared_timed_mutex() = default;
+
+    shared_timed_mutex(const shared_timed_mutex&) = delete;
+    shared_timed_mutex& operator=(const shared_timed_mutex&) = delete;
+
+    // Exclusive ownership
+    void lock();
+    bool try_lock();
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        bool
+        try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time)
+        {
+            return try_lock_until(chrono::steady_clock::now() + __rel_time);
+        }
+    template <class _Clock, class _Duration>
+        bool
+        try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
+    void unlock();
+
+    // Shared ownership
+    void lock_shared();
+    bool try_lock_shared();
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        bool
+        try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time)
+        {
+            return try_lock_shared_until(chrono::steady_clock::now() + __rel_time);
+        }
+    template <class _Clock, class _Duration>
+        bool
+        try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
+    void unlock_shared();
+};
+
+template <class _Clock, class _Duration>
+bool
+shared_timed_mutex::try_lock_until(
+                        const chrono::time_point<_Clock, _Duration>& __abs_time)
+{
+    unique_lock<mutex> __lk(__base.__mut_);
+    if (__base.__state_ & __base.__write_entered_)
+    {
+        while (true)
+        {
+            cv_status __status = __base.__gate1_.wait_until(__lk, __abs_time);
+            if ((__base.__state_ & __base.__write_entered_) == 0)
+                break;
+            if (__status == cv_status::timeout)
+                return false;
+        }
+    }
+    __base.__state_ |= __base.__write_entered_;
+    if (__base.__state_ & __base.__n_readers_)
+    {
+        while (true)
+        {
+            cv_status __status = __base.__gate2_.wait_until(__lk, __abs_time);
+            if ((__base.__state_ & __base.__n_readers_) == 0)
+                break;
+            if (__status == cv_status::timeout)
+            {
+                __base.__state_ &= ~__base.__write_entered_;
+                __base.__gate1_.notify_all();
+                return false;
+            }
+        }
+    }
+    return true;
+}
+
+template <class _Clock, class _Duration>
+bool
+shared_timed_mutex::try_lock_shared_until(
+                        const chrono::time_point<_Clock, _Duration>& __abs_time)
+{
+    unique_lock<mutex> __lk(__base.__mut_);
+    if ((__base.__state_ & __base.__write_entered_) || (__base.__state_ & __base.__n_readers_) == __base.__n_readers_)
+    {
+        while (true)
+        {
+            cv_status status = __base.__gate1_.wait_until(__lk, __abs_time);
+            if ((__base.__state_ & __base.__write_entered_) == 0 &&
+                                       (__base.__state_ & __base.__n_readers_) < __base.__n_readers_)
+                break;
+            if (status == cv_status::timeout)
+                return false;
+        }
+    }
+    unsigned __num_readers = (__base.__state_ & __base.__n_readers_) + 1;
+    __base.__state_ &= ~__base.__n_readers_;
+    __base.__state_ |= __num_readers;
+    return true;
+}
+
+template <class _Mutex>
+class shared_lock
+{
+public:
+    typedef _Mutex mutex_type;
+
+private:
+    mutex_type* __m_;
+    bool __owns_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    shared_lock() _NOEXCEPT
+        : __m_(nullptr),
+          __owns_(false)
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit shared_lock(mutex_type& __m)
+        : __m_(&__m),
+          __owns_(true)
+        {__m_->lock_shared();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    shared_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
+        : __m_(&__m),
+          __owns_(false)
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    shared_lock(mutex_type& __m, try_to_lock_t)
+        : __m_(&__m),
+          __owns_(__m.try_lock_shared())
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    shared_lock(mutex_type& __m, adopt_lock_t)
+        : __m_(&__m),
+          __owns_(true)
+        {}
+
+    template <class _Clock, class _Duration>
+        _LIBCPP_INLINE_VISIBILITY
+        shared_lock(mutex_type& __m,
+                    const chrono::time_point<_Clock, _Duration>& __abs_time)
+            : __m_(&__m),
+              __owns_(__m.try_lock_shared_until(__abs_time))
+            {}
+
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        shared_lock(mutex_type& __m,
+                    const chrono::duration<_Rep, _Period>& __rel_time)
+            : __m_(&__m),
+              __owns_(__m.try_lock_shared_for(__rel_time))
+            {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    ~shared_lock()
+    {
+        if (__owns_)
+            __m_->unlock_shared();
+    }
+
+    shared_lock(shared_lock const&) = delete;
+    shared_lock& operator=(shared_lock const&) = delete;
+
+    _LIBCPP_INLINE_VISIBILITY
+    shared_lock(shared_lock&& __u) _NOEXCEPT
+        : __m_(__u.__m_),
+          __owns_(__u.__owns_)
+        {
+            __u.__m_ = nullptr;
+            __u.__owns_ = false;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    shared_lock& operator=(shared_lock&& __u) _NOEXCEPT
+    {
+        if (__owns_)
+            __m_->unlock_shared();
+        __m_ = nullptr;
+        __owns_ = false;
+        __m_ = __u.__m_;
+        __owns_ = __u.__owns_;
+        __u.__m_ = nullptr;
+        __u.__owns_ = false;
+        return *this;
+    }
+
+    void lock();
+    bool try_lock();
+    template <class Rep, class Period>
+        bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
+    template <class Clock, class Duration>
+        bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
+    void unlock();
+
+    // Setters
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(shared_lock& __u) _NOEXCEPT
+    {
+        _VSTD::swap(__m_, __u.__m_);
+        _VSTD::swap(__owns_, __u.__owns_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    mutex_type* release() _NOEXCEPT
+    {
+        mutex_type* __m = __m_;
+        __m_ = nullptr;
+        __owns_ = false;
+        return __m;
+    }
+
+    // Getters
+    _LIBCPP_INLINE_VISIBILITY
+    bool owns_lock() const _NOEXCEPT {return __owns_;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit operator bool () const _NOEXCEPT {return __owns_;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    mutex_type* mutex() const _NOEXCEPT {return __m_;}
+};
+
+template <class _Mutex>
+void
+shared_lock<_Mutex>::lock()
+{
+    if (__m_ == nullptr)
+        __throw_system_error(EPERM, "shared_lock::lock: references null mutex");
+    if (__owns_)
+        __throw_system_error(EDEADLK, "shared_lock::lock: already locked");
+    __m_->lock_shared();
+    __owns_ = true;
+}
+
+template <class _Mutex>
+bool
+shared_lock<_Mutex>::try_lock()
+{
+    if (__m_ == nullptr)
+        __throw_system_error(EPERM, "shared_lock::try_lock: references null mutex");
+    if (__owns_)
+        __throw_system_error(EDEADLK, "shared_lock::try_lock: already locked");
+    __owns_ = __m_->try_lock_shared();
+    return __owns_;
+}
+
+template <class _Mutex>
+template <class _Rep, class _Period>
+bool
+shared_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d)
+{
+    if (__m_ == nullptr)
+        __throw_system_error(EPERM, "shared_lock::try_lock_for: references null mutex");
+    if (__owns_)
+        __throw_system_error(EDEADLK, "shared_lock::try_lock_for: already locked");
+    __owns_ = __m_->try_lock_shared_for(__d);
+    return __owns_;
+}
+
+template <class _Mutex>
+template <class _Clock, class _Duration>
+bool
+shared_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
+{
+    if (__m_ == nullptr)
+        __throw_system_error(EPERM, "shared_lock::try_lock_until: references null mutex");
+    if (__owns_)
+        __throw_system_error(EDEADLK, "shared_lock::try_lock_until: already locked");
+    __owns_ = __m_->try_lock_shared_until(__t);
+    return __owns_;
+}
+
+template <class _Mutex>
+void
+shared_lock<_Mutex>::unlock()
+{
+    if (!__owns_)
+        __throw_system_error(EPERM, "shared_lock::unlock: not locked");
+    __m_->unlock_shared();
+    __owns_ = false;
+}
+
+template <class _Mutex>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) _NOEXCEPT
+    {__x.swap(__y);}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // !_LIBCPP_HAS_NO_THREADS
+
+#endif  // _LIBCPP_STD_VER > 11
+
+#endif  // _LIBCPP_SHARED_MUTEX

Property changes on: lab4/.minix-src/include/c++/shared_mutex
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/stdexcept
===================================================================
--- lab4/.minix-src/include/c++/stdexcept	(nonexistent)
+++ lab4/.minix-src/include/c++/stdexcept	(revision 13)
@@ -0,0 +1,170 @@
+// -*- C++ -*-
+//===--------------------------- stdexcept --------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_STDEXCEPT
+#define _LIBCPP_STDEXCEPT
+
+/*
+    stdexcept synopsis
+
+namespace std
+{
+
+class logic_error;
+    class domain_error;
+    class invalid_argument;
+    class length_error;
+    class out_of_range;
+class runtime_error;
+    class range_error;
+    class overflow_error;
+    class underflow_error;
+
+for each class xxx_error:
+
+class xxx_error : public exception // at least indirectly
+{
+public:
+    explicit xxx_error(const string& what_arg);
+    explicit xxx_error(const char*   what_arg);
+
+    virtual const char* what() const noexcept // returns what_arg
+};
+
+}  // std
+
+*/
+
+#include <__config>
+#include <exception>
+#include <iosfwd>  // for string forward decl
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP___REFSTRING
+_LIBCPP_BEGIN_NAMESPACE_STD
+class _LIBCPP_HIDDEN __libcpp_refstring {
+    const char *__imp_ _LIBCPP_UNUSED;
+};
+_LIBCPP_END_NAMESPACE_STD
+#endif
+
+namespace std  // purposefully not using versioning namespace
+{
+
+class _LIBCPP_EXCEPTION_ABI logic_error
+    : public exception
+{
+private:
+    _VSTD::__libcpp_refstring __imp_;
+public:
+    explicit logic_error(const string&);
+    explicit logic_error(const char*);
+
+    logic_error(const logic_error&) _NOEXCEPT;
+    logic_error& operator=(const logic_error&) _NOEXCEPT;
+
+    virtual ~logic_error() _NOEXCEPT;
+
+    virtual const char* what() const _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI runtime_error
+    : public exception
+{
+private:
+    _VSTD::__libcpp_refstring __imp_;
+public:
+    explicit runtime_error(const string&);
+    explicit runtime_error(const char*);
+
+    runtime_error(const runtime_error&) _NOEXCEPT;
+    runtime_error& operator=(const runtime_error&) _NOEXCEPT;
+
+    virtual ~runtime_error() _NOEXCEPT;
+
+    virtual const char* what() const _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI domain_error
+    : public logic_error
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
+    _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s)   : logic_error(__s) {}
+
+    virtual ~domain_error() _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI invalid_argument
+    : public logic_error
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
+    _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s)   : logic_error(__s) {}
+
+    virtual ~invalid_argument() _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI length_error
+    : public logic_error
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
+    _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s)   : logic_error(__s) {}
+
+    virtual ~length_error() _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI out_of_range
+    : public logic_error
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
+    _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s)   : logic_error(__s) {}
+
+    virtual ~out_of_range() _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI range_error
+    : public runtime_error
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
+    _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s)   : runtime_error(__s) {}
+
+    virtual ~range_error() _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI overflow_error
+    : public runtime_error
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
+    _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s)   : runtime_error(__s) {}
+
+    virtual ~overflow_error() _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI underflow_error
+    : public runtime_error
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
+    _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s)   : runtime_error(__s) {}
+
+    virtual ~underflow_error() _NOEXCEPT;
+};
+
+}  // std
+
+#endif  // _LIBCPP_STDEXCEPT

Property changes on: lab4/.minix-src/include/c++/stdexcept
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/system_error
===================================================================
--- lab4/.minix-src/include/c++/system_error	(nonexistent)
+++ lab4/.minix-src/include/c++/system_error	(revision 13)
@@ -0,0 +1,642 @@
+// -*- C++ -*-
+//===---------------------------- system_error ----------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SYSTEM_ERROR
+#define _LIBCPP_SYSTEM_ERROR
+
+/*
+    system_error synopsis
+
+namespace std
+{
+
+class error_category
+{
+public:
+    virtual ~error_category() noexcept;
+
+    constexpr error_category();
+    error_category(const error_category&) = delete;
+    error_category& operator=(const error_category&) = delete;
+
+    virtual const char* name() const noexcept = 0;
+    virtual error_condition default_error_condition(int ev) const noexcept;
+    virtual bool equivalent(int code, const error_condition& condition) const noexcept;
+    virtual bool equivalent(const error_code& code, int condition) const noexcept;
+    virtual string message(int ev) const = 0;
+
+    bool operator==(const error_category& rhs) const noexcept;
+    bool operator!=(const error_category& rhs) const noexcept;
+    bool operator<(const error_category& rhs) const noexcept;
+};
+
+const error_category& generic_category() noexcept;
+const error_category& system_category() noexcept;
+
+template <class T> struct is_error_code_enum
+    : public false_type {};
+
+template <class T> struct is_error_condition_enum
+    : public false_type {};
+
+class error_code
+{
+public:
+    // constructors:
+    error_code() noexcept;
+    error_code(int val, const error_category& cat) noexcept;
+    template <class ErrorCodeEnum>
+        error_code(ErrorCodeEnum e) noexcept;
+
+    // modifiers:
+    void assign(int val, const error_category& cat) noexcept;
+    template <class ErrorCodeEnum>
+        error_code& operator=(ErrorCodeEnum e) noexcept;
+    void clear() noexcept;
+
+    // observers:
+    int value() const noexcept;
+    const error_category& category() const noexcept;
+    error_condition default_error_condition() const noexcept;
+    string message() const;
+    explicit operator bool() const noexcept;
+};
+
+// non-member functions:
+bool operator<(const error_code& lhs, const error_code& rhs) noexcept;
+template <class charT, class traits>
+    basic_ostream<charT,traits>&
+    operator<<(basic_ostream<charT,traits>& os, const error_code& ec);
+
+class error_condition
+{
+public:
+    // constructors:
+    error_condition() noexcept;
+    error_condition(int val, const error_category& cat) noexcept;
+    template <class ErrorConditionEnum>
+        error_condition(ErrorConditionEnum e) noexcept;
+
+    // modifiers:
+    void assign(int val, const error_category& cat) noexcept;
+    template <class ErrorConditionEnum>
+        error_condition& operator=(ErrorConditionEnum e) noexcept;
+    void clear() noexcept;
+
+    // observers:
+    int value() const noexcept;
+    const error_category& category() const noexcept;
+    string message() const noexcept;
+    explicit operator bool() const noexcept;
+};
+
+bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept;
+
+class system_error
+    : public runtime_error
+{
+public:
+    system_error(error_code ec, const string& what_arg);
+    system_error(error_code ec, const char* what_arg);
+    system_error(error_code ec);
+    system_error(int ev, const error_category& ecat, const string& what_arg);
+    system_error(int ev, const error_category& ecat, const char* what_arg);
+    system_error(int ev, const error_category& ecat);
+
+    const error_code& code() const noexcept;
+    const char* what() const noexcept;
+};
+
+enum class errc
+{
+    address_family_not_supported,       // EAFNOSUPPORT
+    address_in_use,                     // EADDRINUSE
+    address_not_available,              // EADDRNOTAVAIL
+    already_connected,                  // EISCONN
+    argument_list_too_long,             // E2BIG
+    argument_out_of_domain,             // EDOM
+    bad_address,                        // EFAULT
+    bad_file_descriptor,                // EBADF
+    bad_message,                        // EBADMSG
+    broken_pipe,                        // EPIPE
+    connection_aborted,                 // ECONNABORTED
+    connection_already_in_progress,     // EALREADY
+    connection_refused,                 // ECONNREFUSED
+    connection_reset,                   // ECONNRESET
+    cross_device_link,                  // EXDEV
+    destination_address_required,       // EDESTADDRREQ
+    device_or_resource_busy,            // EBUSY
+    directory_not_empty,                // ENOTEMPTY
+    executable_format_error,            // ENOEXEC
+    file_exists,                        // EEXIST
+    file_too_large,                     // EFBIG
+    filename_too_long,                  // ENAMETOOLONG
+    function_not_supported,             // ENOSYS
+    host_unreachable,                   // EHOSTUNREACH
+    identifier_removed,                 // EIDRM
+    illegal_byte_sequence,              // EILSEQ
+    inappropriate_io_control_operation, // ENOTTY
+    interrupted,                        // EINTR
+    invalid_argument,                   // EINVAL
+    invalid_seek,                       // ESPIPE
+    io_error,                           // EIO
+    is_a_directory,                     // EISDIR
+    message_size,                       // EMSGSIZE
+    network_down,                       // ENETDOWN
+    network_reset,                      // ENETRESET
+    network_unreachable,                // ENETUNREACH
+    no_buffer_space,                    // ENOBUFS
+    no_child_process,                   // ECHILD
+    no_link,                            // ENOLINK
+    no_lock_available,                  // ENOLCK
+    no_message_available,               // ENODATA
+    no_message,                         // ENOMSG
+    no_protocol_option,                 // ENOPROTOOPT
+    no_space_on_device,                 // ENOSPC
+    no_stream_resources,                // ENOSR
+    no_such_device_or_address,          // ENXIO
+    no_such_device,                     // ENODEV
+    no_such_file_or_directory,          // ENOENT
+    no_such_process,                    // ESRCH
+    not_a_directory,                    // ENOTDIR
+    not_a_socket,                       // ENOTSOCK
+    not_a_stream,                       // ENOSTR
+    not_connected,                      // ENOTCONN
+    not_enough_memory,                  // ENOMEM
+    not_supported,                      // ENOTSUP
+    operation_canceled,                 // ECANCELED
+    operation_in_progress,              // EINPROGRESS
+    operation_not_permitted,            // EPERM
+    operation_not_supported,            // EOPNOTSUPP
+    operation_would_block,              // EWOULDBLOCK
+    owner_dead,                         // EOWNERDEAD
+    permission_denied,                  // EACCES
+    protocol_error,                     // EPROTO
+    protocol_not_supported,             // EPROTONOSUPPORT
+    read_only_file_system,              // EROFS
+    resource_deadlock_would_occur,      // EDEADLK
+    resource_unavailable_try_again,     // EAGAIN
+    result_out_of_range,                // ERANGE
+    state_not_recoverable,              // ENOTRECOVERABLE
+    stream_timeout,                     // ETIME
+    text_file_busy,                     // ETXTBSY
+    timed_out,                          // ETIMEDOUT
+    too_many_files_open_in_system,      // ENFILE
+    too_many_files_open,                // EMFILE
+    too_many_links,                     // EMLINK
+    too_many_symbolic_link_levels,      // ELOOP
+    value_too_large,                    // EOVERFLOW
+    wrong_protocol_type                 // EPROTOTYPE
+};
+
+template <> struct is_error_condition_enum<errc>
+    : true_type { }
+
+error_code make_error_code(errc e) noexcept;
+error_condition make_error_condition(errc e) noexcept;
+
+// Comparison operators:
+bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
+bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
+bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
+bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
+bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
+bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
+bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
+bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
+
+template <> struct hash<std::error_code>;
+
+}  // std
+
+*/
+
+#include <__config>
+#include <cerrno>
+#include <type_traits>
+#include <stdexcept>
+#include <__functional_base>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// is_error_code_enum
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum
+    : public false_type {};
+
+// is_error_condition_enum
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_error_condition_enum
+    : public false_type {};
+
+// Some error codes are not present on all platforms, so we provide equivalents
+// for them:
+
+//enum class errc
+_LIBCPP_DECLARE_STRONG_ENUM(errc)
+{
+    address_family_not_supported        = EAFNOSUPPORT,
+    address_in_use                      = EADDRINUSE,
+    address_not_available               = EADDRNOTAVAIL,
+    already_connected                   = EISCONN,
+    argument_list_too_long              = E2BIG,
+    argument_out_of_domain              = EDOM,
+    bad_address                         = EFAULT,
+    bad_file_descriptor                 = EBADF,
+    bad_message                         = EBADMSG,
+    broken_pipe                         = EPIPE,
+    connection_aborted                  = ECONNABORTED,
+    connection_already_in_progress      = EALREADY,
+    connection_refused                  = ECONNREFUSED,
+    connection_reset                    = ECONNRESET,
+    cross_device_link                   = EXDEV,
+    destination_address_required        = EDESTADDRREQ,
+    device_or_resource_busy             = EBUSY,
+    directory_not_empty                 = ENOTEMPTY,
+    executable_format_error             = ENOEXEC,
+    file_exists                         = EEXIST,
+    file_too_large                      = EFBIG,
+    filename_too_long                   = ENAMETOOLONG,
+    function_not_supported              = ENOSYS,
+    host_unreachable                    = EHOSTUNREACH,
+    identifier_removed                  = EIDRM,
+    illegal_byte_sequence               = EILSEQ,
+    inappropriate_io_control_operation  = ENOTTY,
+    interrupted                         = EINTR,
+    invalid_argument                    = EINVAL,
+    invalid_seek                        = ESPIPE,
+    io_error                            = EIO,
+    is_a_directory                      = EISDIR,
+    message_size                        = EMSGSIZE,
+    network_down                        = ENETDOWN,
+    network_reset                       = ENETRESET,
+    network_unreachable                 = ENETUNREACH,
+    no_buffer_space                     = ENOBUFS,
+    no_child_process                    = ECHILD,
+    no_link                             = ENOLINK,
+    no_lock_available                   = ENOLCK,
+#ifdef ENODATA
+    no_message_available                = ENODATA,
+#else
+    no_message_available                = ENOMSG,
+#endif
+    no_message                          = ENOMSG,
+    no_protocol_option                  = ENOPROTOOPT,
+    no_space_on_device                  = ENOSPC,
+#ifdef ENOSR
+    no_stream_resources                 = ENOSR,
+#else
+    no_stream_resources                 = ENOMEM,
+#endif
+    no_such_device_or_address           = ENXIO,
+    no_such_device                      = ENODEV,
+    no_such_file_or_directory           = ENOENT,
+    no_such_process                     = ESRCH,
+    not_a_directory                     = ENOTDIR,
+    not_a_socket                        = ENOTSOCK,
+#ifdef ENOSTR
+    not_a_stream                        = ENOSTR,
+#else
+    not_a_stream                        = EINVAL,
+#endif
+    not_connected                       = ENOTCONN,
+    not_enough_memory                   = ENOMEM,
+    not_supported                       = ENOTSUP,
+    operation_canceled                  = ECANCELED,
+    operation_in_progress               = EINPROGRESS,
+    operation_not_permitted             = EPERM,
+    operation_not_supported             = EOPNOTSUPP,
+    operation_would_block               = EWOULDBLOCK,
+    owner_dead                          = EOWNERDEAD,
+    permission_denied                   = EACCES,
+    protocol_error                      = EPROTO,
+    protocol_not_supported              = EPROTONOSUPPORT,
+    read_only_file_system               = EROFS,
+    resource_deadlock_would_occur       = EDEADLK,
+    resource_unavailable_try_again      = EAGAIN,
+    result_out_of_range                 = ERANGE,
+    state_not_recoverable               = ENOTRECOVERABLE,
+#ifdef ETIME
+    stream_timeout                      = ETIME,
+#else
+    stream_timeout                      = ETIMEDOUT,
+#endif
+    text_file_busy                      = ETXTBSY,
+    timed_out                           = ETIMEDOUT,
+    too_many_files_open_in_system       = ENFILE,
+    too_many_files_open                 = EMFILE,
+    too_many_links                      = EMLINK,
+    too_many_symbolic_link_levels       = ELOOP,
+    value_too_large                     = EOVERFLOW,
+    wrong_protocol_type                 = EPROTOTYPE
+};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY is_error_condition_enum<errc>
+    : true_type { };
+
+#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY is_error_condition_enum<errc::__lx>
+    : true_type { };
+#endif
+
+class _LIBCPP_TYPE_VIS error_condition;
+class _LIBCPP_TYPE_VIS error_code;
+
+// class error_category
+
+class _LIBCPP_HIDDEN __do_message;
+
+class _LIBCPP_TYPE_VIS error_category
+{
+public:
+    virtual ~error_category() _NOEXCEPT;
+
+#ifdef _LIBCPP_BUILDING_SYSTEM_ERROR
+    error_category() _NOEXCEPT;
+#else
+    _LIBCPP_ALWAYS_INLINE
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 error_category() _NOEXCEPT _LIBCPP_DEFAULT;
+#endif
+private:
+    error_category(const error_category&);// = delete;
+    error_category& operator=(const error_category&);// = delete;
+
+public:
+    virtual const char* name() const _NOEXCEPT = 0;
+    virtual error_condition default_error_condition(int __ev) const _NOEXCEPT;
+    virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT;
+    virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT;
+    virtual string message(int __ev) const = 0;
+
+    _LIBCPP_ALWAYS_INLINE
+    bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;}
+
+    _LIBCPP_ALWAYS_INLINE
+    bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);}
+
+    _LIBCPP_ALWAYS_INLINE
+    bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}
+
+    friend class _LIBCPP_HIDDEN __do_message;
+};
+
+class _LIBCPP_HIDDEN __do_message
+    : public error_category
+{
+public:
+    virtual string message(int ev) const;
+};
+
+_LIBCPP_FUNC_VIS const error_category& generic_category() _NOEXCEPT;
+_LIBCPP_FUNC_VIS const error_category& system_category() _NOEXCEPT;
+
+class _LIBCPP_TYPE_VIS error_condition
+{
+    int __val_;
+    const error_category* __cat_;
+public:
+    _LIBCPP_ALWAYS_INLINE
+    error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    error_condition(int __val, const error_category& __cat) _NOEXCEPT
+        : __val_(__val), __cat_(&__cat) {}
+
+    template <class _Ep>
+        _LIBCPP_ALWAYS_INLINE
+        error_condition(_Ep __e,
+              typename enable_if<is_error_condition_enum<_Ep>::value>::type* = 0
+                                                                     ) _NOEXCEPT
+            {*this = make_error_condition(__e);}
+
+    _LIBCPP_ALWAYS_INLINE
+    void assign(int __val, const error_category& __cat) _NOEXCEPT
+    {
+        __val_ = __val;
+        __cat_ = &__cat;
+    }
+
+    template <class _Ep>
+        _LIBCPP_ALWAYS_INLINE
+        typename enable_if
+        <
+            is_error_condition_enum<_Ep>::value,
+            error_condition&
+        >::type
+        operator=(_Ep __e) _NOEXCEPT
+            {*this = make_error_condition(__e); return *this;}
+
+    _LIBCPP_ALWAYS_INLINE
+    void clear() _NOEXCEPT
+    {
+        __val_ = 0;
+        __cat_ = &generic_category();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int value() const _NOEXCEPT {return __val_;}
+
+    _LIBCPP_ALWAYS_INLINE
+    const error_category& category() const _NOEXCEPT {return *__cat_;}
+    string message() const;
+
+    _LIBCPP_ALWAYS_INLINE
+        _LIBCPP_EXPLICIT
+        operator bool() const _NOEXCEPT {return __val_ != 0;}
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+error_condition
+make_error_condition(errc __e) _NOEXCEPT
+{
+    return error_condition(static_cast<int>(__e), generic_category());
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT
+{
+    return __x.category() < __y.category()
+        || (__x.category() == __y.category() && __x.value() < __y.value());
+}
+
+// error_code
+
+class _LIBCPP_TYPE_VIS error_code
+{
+    int __val_;
+    const error_category* __cat_;
+public:
+    _LIBCPP_ALWAYS_INLINE
+    error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    error_code(int __val, const error_category& __cat) _NOEXCEPT
+        : __val_(__val), __cat_(&__cat) {}
+
+    template <class _Ep>
+        _LIBCPP_ALWAYS_INLINE
+        error_code(_Ep __e,
+                   typename enable_if<is_error_code_enum<_Ep>::value>::type* = 0
+                                                                     ) _NOEXCEPT
+            {*this = make_error_code(__e);}
+
+    _LIBCPP_ALWAYS_INLINE
+    void assign(int __val, const error_category& __cat) _NOEXCEPT
+    {
+        __val_ = __val;
+        __cat_ = &__cat;
+    }
+
+    template <class _Ep>
+        _LIBCPP_ALWAYS_INLINE
+        typename enable_if
+        <
+            is_error_code_enum<_Ep>::value,
+            error_code&
+        >::type
+        operator=(_Ep __e) _NOEXCEPT
+            {*this = make_error_code(__e); return *this;}
+
+    _LIBCPP_ALWAYS_INLINE
+    void clear() _NOEXCEPT
+    {
+        __val_ = 0;
+        __cat_ = &system_category();
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    int value() const _NOEXCEPT {return __val_;}
+
+    _LIBCPP_ALWAYS_INLINE
+    const error_category& category() const _NOEXCEPT {return *__cat_;}
+
+    _LIBCPP_ALWAYS_INLINE
+    error_condition default_error_condition() const _NOEXCEPT
+        {return __cat_->default_error_condition(__val_);}
+
+    string message() const;
+
+    _LIBCPP_ALWAYS_INLINE
+        _LIBCPP_EXPLICIT
+        operator bool() const _NOEXCEPT {return __val_ != 0;}
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+error_code
+make_error_code(errc __e) _NOEXCEPT
+{
+    return error_code(static_cast<int>(__e), generic_category());
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const error_code& __x, const error_code& __y) _NOEXCEPT
+{
+    return __x.category() < __y.category()
+        || (__x.category() == __y.category() && __x.value() < __y.value());
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const error_code& __x, const error_code& __y) _NOEXCEPT
+{
+    return __x.category() == __y.category() && __x.value() == __y.value();
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT
+{
+    return __x.category().equivalent(__x.value(), __y)
+        || __y.category().equivalent(__x, __y.value());
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT
+{
+    return __y == __x;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT
+{
+    return __x.category() == __y.category() && __x.value() == __y.value();
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT
+{return !(__x == __y);}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT
+{return !(__x == __y);}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT
+{return !(__x == __y);}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
+{return !(__x == __y);}
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<error_code>
+    : public unary_function<error_code, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const error_code& __ec) const _NOEXCEPT
+    {
+        return static_cast<size_t>(__ec.value());
+    }
+};
+
+// system_error
+
+class _LIBCPP_TYPE_VIS system_error
+    : public runtime_error
+{
+    error_code __ec_;
+public:
+    system_error(error_code __ec, const string& __what_arg);
+    system_error(error_code __ec, const char* __what_arg);
+    system_error(error_code __ec);
+    system_error(int __ev, const error_category& __ecat, const string& __what_arg);
+    system_error(int __ev, const error_category& __ecat, const char* __what_arg);
+    system_error(int __ev, const error_category& __ecat);
+    ~system_error() _NOEXCEPT;
+
+    _LIBCPP_ALWAYS_INLINE
+    const error_code& code() const _NOEXCEPT {return __ec_;}
+
+private:
+    static string __init(const error_code&, string);
+};
+
+_LIBCPP_FUNC_VIS void __throw_system_error(int ev, const char* what_arg);
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_SYSTEM_ERROR

Property changes on: lab4/.minix-src/include/c++/system_error
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/type_traits
===================================================================
--- lab4/.minix-src/include/c++/type_traits	(nonexistent)
+++ lab4/.minix-src/include/c++/type_traits	(revision 13)
@@ -0,0 +1,3773 @@
+// -*- C++ -*-
+//===------------------------ type_traits ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_TYPE_TRAITS
+#define _LIBCPP_TYPE_TRAITS
+
+/*
+    type_traits synopsis
+
+namespace std
+{
+
+    // helper class:
+    template <class T, T v> struct integral_constant;
+    typedef integral_constant<bool, true>  true_type;   // C++11
+    typedef integral_constant<bool, false> false_type;  // C++11
+    
+    template <bool B>                                   // C++14
+    using bool_constant = integral_constant<bool, B>;   // C++14
+    typedef bool_constant<true> true_type;              // C++14
+    typedef bool_constant<false> false_type;            // C++14
+
+    // helper traits
+    template <bool, class T = void> struct enable_if;
+    template <bool, class T, class F> struct conditional;
+
+    // Primary classification traits:
+    template <class T> struct is_void;
+    template <class T> struct is_null_pointer;  // C++14
+    template <class T> struct is_integral;
+    template <class T> struct is_floating_point;
+    template <class T> struct is_array;
+    template <class T> struct is_pointer;
+    template <class T> struct is_lvalue_reference;
+    template <class T> struct is_rvalue_reference;
+    template <class T> struct is_member_object_pointer;
+    template <class T> struct is_member_function_pointer;
+    template <class T> struct is_enum;
+    template <class T> struct is_union;
+    template <class T> struct is_class;
+    template <class T> struct is_function;
+
+    // Secondary classification traits:
+    template <class T> struct is_reference;
+    template <class T> struct is_arithmetic;
+    template <class T> struct is_fundamental;
+    template <class T> struct is_member_pointer;
+    template <class T> struct is_scalar;
+    template <class T> struct is_object;
+    template <class T> struct is_compound;
+
+    // Const-volatile properties and transformations:
+    template <class T> struct is_const;
+    template <class T> struct is_volatile;
+    template <class T> struct remove_const;
+    template <class T> struct remove_volatile;
+    template <class T> struct remove_cv;
+    template <class T> struct add_const;
+    template <class T> struct add_volatile;
+    template <class T> struct add_cv;
+
+    // Reference transformations:
+    template <class T> struct remove_reference;
+    template <class T> struct add_lvalue_reference;
+    template <class T> struct add_rvalue_reference;
+
+    // Pointer transformations:
+    template <class T> struct remove_pointer;
+    template <class T> struct add_pointer;
+
+    // Integral properties:
+    template <class T> struct is_signed;
+    template <class T> struct is_unsigned;
+    template <class T> struct make_signed;
+    template <class T> struct make_unsigned;
+
+    // Array properties and transformations:
+    template <class T> struct rank;
+    template <class T, unsigned I = 0> struct extent;
+    template <class T> struct remove_extent;
+    template <class T> struct remove_all_extents;
+
+    // Member introspection:
+    template <class T> struct is_pod;
+    template <class T> struct is_trivial;
+    template <class T> struct is_trivially_copyable;
+    template <class T> struct is_standard_layout;
+    template <class T> struct is_literal_type;
+    template <class T> struct is_empty;
+    template <class T> struct is_polymorphic;
+    template <class T> struct is_abstract;
+    template <class T> struct is_final; // C++14
+
+    template <class T, class... Args> struct is_constructible;
+    template <class T>                struct is_default_constructible;
+    template <class T>                struct is_copy_constructible;
+    template <class T>                struct is_move_constructible;
+    template <class T, class U>       struct is_assignable;
+    template <class T>                struct is_copy_assignable;
+    template <class T>                struct is_move_assignable;
+    template <class T>                struct is_destructible;
+
+    template <class T, class... Args> struct is_trivially_constructible;
+    template <class T>                struct is_trivially_default_constructible;
+    template <class T>                struct is_trivially_copy_constructible;
+    template <class T>                struct is_trivially_move_constructible;
+    template <class T, class U>       struct is_trivially_assignable;
+    template <class T>                struct is_trivially_copy_assignable;
+    template <class T>                struct is_trivially_move_assignable;
+    template <class T>                struct is_trivially_destructible;
+
+    template <class T, class... Args> struct is_nothrow_constructible;
+    template <class T>                struct is_nothrow_default_constructible;
+    template <class T>                struct is_nothrow_copy_constructible;
+    template <class T>                struct is_nothrow_move_constructible;
+    template <class T, class U>       struct is_nothrow_assignable;
+    template <class T>                struct is_nothrow_copy_assignable;
+    template <class T>                struct is_nothrow_move_assignable;
+    template <class T>                struct is_nothrow_destructible;
+
+    template <class T> struct has_virtual_destructor;
+
+    // Relationships between types:
+    template <class T, class U> struct is_same;
+    template <class Base, class Derived> struct is_base_of;
+    template <class From, class To> struct is_convertible;
+
+    // Alignment properties and transformations:
+    template <class T> struct alignment_of;
+    template <size_t Len, size_t Align = most_stringent_alignment_requirement>
+        struct aligned_storage;
+    template <size_t Len, class... Types> struct aligned_union;
+
+    template <class T> struct decay;
+    template <class... T> struct common_type;
+    template <class T> struct underlying_type;
+    template <class> class result_of; // undefined
+    template <class Fn, class... ArgTypes> class result_of<Fn(ArgTypes...)>;
+
+    // const-volatile modifications:
+    template <class T>
+      using remove_const_t    = typename remove_const<T>::type;  // C++14
+    template <class T>
+      using remove_volatile_t = typename remove_volatile<T>::type;  // C++14
+    template <class T>
+      using remove_cv_t       = typename remove_cv<T>::type;  // C++14
+    template <class T>
+      using add_const_t       = typename add_const<T>::type;  // C++14
+    template <class T>
+      using add_volatile_t    = typename add_volatile<T>::type;  // C++14
+    template <class T>
+      using add_cv_t          = typename add_cv<T>::type;  // C++14
+  
+    // reference modifications:
+    template <class T>
+      using remove_reference_t     = typename remove_reference<T>::type;  // C++14
+    template <class T>
+      using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;  // C++14
+    template <class T>
+      using add_rvalue_reference_t = typename add_rvalue_reference<T>::type;  // C++14
+  
+    // sign modifications:
+    template <class T>
+      using make_signed_t   = typename make_signed<T>::type;  // C++14
+    template <class T>
+      using make_unsigned_t = typename make_unsigned<T>::type;  // C++14
+  
+    // array modifications:
+    template <class T>
+      using remove_extent_t      = typename remove_extent<T>::type;  // C++14
+    template <class T>
+      using remove_all_extents_t = typename remove_all_extents<T>::type;  // C++14
+
+    // pointer modifications:
+    template <class T>
+      using remove_pointer_t = typename remove_pointer<T>::type;  // C++14
+    template <class T>
+      using add_pointer_t    = typename add_pointer<T>::type;  // C++14
+
+    // other transformations:
+    template <size_t Len, std::size_t Align=default-alignment>
+      using aligned_storage_t = typename aligned_storage<Len,Align>::type;  // C++14
+    template <std::size_t Len, class... Types>
+      using aligned_union_t   = typename aligned_union<Len,Types...>::type;  // C++14
+    template <class T>
+      using decay_t           = typename decay<T>::type;  // C++14
+    template <bool b, class T=void>
+      using enable_if_t       = typename enable_if<b,T>::type;  // C++14
+    template <bool b, class T, class F>
+      using conditional_t     = typename conditional<b,T,F>::type;  // C++14
+    template <class... T>
+      using common_type_t     = typename common_type<T...>::type;  // C++14
+    template <class T>
+      using underlying_type_t = typename underlying_type<T>::type;  // C++14
+    template <class F, class... ArgTypes>
+      using result_of_t       = typename result_of<F(ArgTypes...)>::type;  // C++14
+
+    template <class...>
+      using void_t = void;
+}  // C++17
+
+*/
+#include <__config>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class>
+struct __void_t { typedef void type; };
+
+template <class _Tp>
+struct __identity { typedef _Tp type; };
+
+template <class _Tp, bool>
+struct _LIBCPP_TYPE_VIS_ONLY __dependent_type : public _Tp {};
+
+template <bool _Bp, class _If, class _Then>
+    struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;};
+template <class _If, class _Then>
+    struct _LIBCPP_TYPE_VIS_ONLY conditional<false, _If, _Then> {typedef _Then type;};
+
+#if _LIBCPP_STD_VER > 11
+template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
+#endif
+
+template <bool, class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;};
+
+template <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef _Tp type;};
+
+#if _LIBCPP_STD_VER > 11
+template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
+#endif
+
+
+struct __two {char __lx[2];};
+
+// helper class:
+
+template <class _Tp, _Tp __v>
+struct _LIBCPP_TYPE_VIS_ONLY integral_constant
+{
+    static _LIBCPP_CONSTEXPR const _Tp      value = __v;
+    typedef _Tp               value_type;
+    typedef integral_constant type;
+    _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;}
+#if _LIBCPP_STD_VER > 11
+    _LIBCPP_INLINE_VISIBILITY
+         constexpr value_type operator ()() const _NOEXCEPT {return value;}
+#endif
+};
+
+template <class _Tp, _Tp __v>
+_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
+
+#if _LIBCPP_STD_VER > 14
+template <bool __b>
+using bool_constant = integral_constant<bool, __b>;
+#define	_LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
+#else
+#define	_LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
+#endif
+
+typedef _LIBCPP_BOOL_CONSTANT(true)  true_type;
+typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
+
+// is_const
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const            : public false_type {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {};
+
+// is_volatile
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile               : public false_type {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {};
+
+// remove_const
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const            {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const<const _Tp> {typedef _Tp type;};
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type;
+#endif
+
+// remove_volatile
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile               {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile<volatile _Tp> {typedef _Tp type;};
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type;
+#endif
+
+// remove_cv
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_cv
+{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;};
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type;
+#endif
+
+// is_void
+
+template <class _Tp> struct __libcpp_is_void       : public false_type {};
+template <>          struct __libcpp_is_void<void> : public true_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void
+    : public __libcpp_is_void<typename remove_cv<_Tp>::type> {};
+
+// __is_nullptr_t
+
+template <class _Tp> struct __is_nullptr_t_impl       : public false_type {};
+template <>          struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t
+    : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer
+    : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
+#endif
+
+// is_integral
+
+template <class _Tp> struct __libcpp_is_integral                     : public false_type {};
+template <>          struct __libcpp_is_integral<bool>               : public true_type {};
+template <>          struct __libcpp_is_integral<char>               : public true_type {};
+template <>          struct __libcpp_is_integral<signed char>        : public true_type {};
+template <>          struct __libcpp_is_integral<unsigned char>      : public true_type {};
+template <>          struct __libcpp_is_integral<wchar_t>            : public true_type {};
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+template <>          struct __libcpp_is_integral<char16_t>           : public true_type {};
+template <>          struct __libcpp_is_integral<char32_t>           : public true_type {};
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+template <>          struct __libcpp_is_integral<short>              : public true_type {};
+template <>          struct __libcpp_is_integral<unsigned short>     : public true_type {};
+template <>          struct __libcpp_is_integral<int>                : public true_type {};
+template <>          struct __libcpp_is_integral<unsigned int>       : public true_type {};
+template <>          struct __libcpp_is_integral<long>               : public true_type {};
+template <>          struct __libcpp_is_integral<unsigned long>      : public true_type {};
+template <>          struct __libcpp_is_integral<long long>          : public true_type {};
+template <>          struct __libcpp_is_integral<unsigned long long> : public true_type {};
+#ifndef _LIBCPP_HAS_NO_INT128
+template <>          struct __libcpp_is_integral<__int128_t>         : public true_type {};
+template <>          struct __libcpp_is_integral<__uint128_t>        : public true_type {};
+#endif
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral
+    : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {};
+
+// is_floating_point
+
+template <class _Tp> struct __libcpp_is_floating_point              : public false_type {};
+template <>          struct __libcpp_is_floating_point<float>       : public true_type {};
+template <>          struct __libcpp_is_floating_point<double>      : public true_type {};
+template <>          struct __libcpp_is_floating_point<long double> : public true_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point
+    : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {};
+
+// is_array
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array
+    : public false_type {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]>
+    : public true_type {};
+template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]>
+    : public true_type {};
+
+// is_pointer
+
+template <class _Tp> struct __libcpp_is_pointer       : public false_type {};
+template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer
+    : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {};
+
+// is_reference
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference       : public false_type {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference<_Tp&> : public true_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference        : public false_type {};
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference<_Tp&&> : public true_type {};
+#endif
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference        : public false_type {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&>  : public true_type {};
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {};
+#endif
+
+// is_union
+
+#if __has_feature(is_union) || (_GNUC_VER >= 403)
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union
+    : public integral_constant<bool, __is_union(_Tp)> {};
+
+#else
+
+template <class _Tp> struct __libcpp_union : public false_type {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union
+    : public __libcpp_union<typename remove_cv<_Tp>::type> {};
+
+#endif
+
+// is_class
+
+#if __has_feature(is_class) || (_GNUC_VER >= 403)
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class
+    : public integral_constant<bool, __is_class(_Tp)> {};
+
+#else
+
+namespace __is_class_imp
+{
+template <class _Tp> char  __test(int _Tp::*);
+template <class _Tp> __two __test(...);
+}
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class
+    : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {};
+
+#endif
+
+// is_same
+
+template <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same           : public false_type {};
+template <class _Tp>            struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {};
+
+// is_function
+
+namespace __libcpp_is_function_imp
+{
+struct __dummy_type {};
+template <class _Tp> char  __test(_Tp*);
+template <class _Tp> char __test(__dummy_type);
+template <class _Tp> __two __test(...);
+template <class _Tp> _Tp&  __source(int);
+template <class _Tp> __dummy_type __source(...);
+}
+
+template <class _Tp, bool = is_class<_Tp>::value ||
+                            is_union<_Tp>::value ||
+                            is_void<_Tp>::value  ||
+                            is_reference<_Tp>::value ||
+                            __is_nullptr_t<_Tp>::value >
+struct __libcpp_is_function
+    : public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>(0))) == 1>
+    {};
+template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function
+    : public __libcpp_is_function<_Tp> {};
+
+// is_member_function_pointer
+
+// template <class _Tp> struct            __libcpp_is_member_function_pointer             : public false_type {};
+// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
+// 
+
+template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
+struct __member_pointer_traits_imp
+{  // forward declaration; specializations later
+};
+
+
+template <class _Tp> struct __libcpp_is_member_function_pointer
+    : public false_type {};
+
+template <class _Ret, class _Class>
+struct __libcpp_is_member_function_pointer<_Ret _Class::*>
+    : public is_function<_Ret> {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer
+    : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type>::type {};
+
+// is_member_pointer
+
+template <class _Tp>            struct __libcpp_is_member_pointer             : public false_type {};
+template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer
+    : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {};
+
+// is_member_object_pointer
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer
+    : public integral_constant<bool, is_member_pointer<_Tp>::value &&
+                                    !is_member_function_pointer<_Tp>::value> {};
+
+// is_enum
+
+#if __has_feature(is_enum) || (_GNUC_VER >= 403)
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum
+    : public integral_constant<bool, __is_enum(_Tp)> {};
+
+#else
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum
+    : public integral_constant<bool, !is_void<_Tp>::value             &&
+                                     !is_integral<_Tp>::value         &&
+                                     !is_floating_point<_Tp>::value   &&
+                                     !is_array<_Tp>::value            &&
+                                     !is_pointer<_Tp>::value          &&
+                                     !is_reference<_Tp>::value        &&
+                                     !is_member_pointer<_Tp>::value   &&
+                                     !is_union<_Tp>::value            &&
+                                     !is_class<_Tp>::value            &&
+                                     !is_function<_Tp>::value         > {};
+
+#endif
+
+// is_arithmetic
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic
+    : public integral_constant<bool, is_integral<_Tp>::value      ||
+                                     is_floating_point<_Tp>::value> {};
+
+// is_fundamental
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental
+    : public integral_constant<bool, is_void<_Tp>::value        ||
+                                     __is_nullptr_t<_Tp>::value ||
+                                     is_arithmetic<_Tp>::value> {};
+
+// is_scalar
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar
+    : public integral_constant<bool, is_arithmetic<_Tp>::value     ||
+                                     is_member_pointer<_Tp>::value ||
+                                     is_pointer<_Tp>::value        ||
+                                     __is_nullptr_t<_Tp>::value    ||
+                                     is_enum<_Tp>::value           > {};
+
+template <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {};
+
+// is_object
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object
+    : public integral_constant<bool, is_scalar<_Tp>::value ||
+                                     is_array<_Tp>::value  ||
+                                     is_union<_Tp>::value  ||
+                                     is_class<_Tp>::value  > {};
+
+// is_compound
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound
+    : public integral_constant<bool, !is_fundamental<_Tp>::value> {};
+
+// add_const
+
+template <class _Tp, bool = is_reference<_Tp>::value ||
+                            is_function<_Tp>::value  ||
+                            is_const<_Tp>::value     >
+struct __add_const             {typedef _Tp type;};
+
+template <class _Tp>
+struct __add_const<_Tp, false> {typedef const _Tp type;};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_const
+    {typedef typename __add_const<_Tp>::type type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using add_const_t = typename add_const<_Tp>::type;
+#endif
+
+// add_volatile
+
+template <class _Tp, bool = is_reference<_Tp>::value ||
+                            is_function<_Tp>::value  ||
+                            is_volatile<_Tp>::value  >
+struct __add_volatile             {typedef _Tp type;};
+
+template <class _Tp>
+struct __add_volatile<_Tp, false> {typedef volatile _Tp type;};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_volatile
+    {typedef typename __add_volatile<_Tp>::type type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
+#endif
+
+// add_cv
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_cv
+    {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
+#endif
+
+// remove_reference
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference        {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&>  {typedef _Tp type;};
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&&> {typedef _Tp type;};
+#endif
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;
+#endif
+
+// add_lvalue_reference
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference                      {typedef _Tp& type;};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<_Tp&>                {typedef _Tp& type;};  // for older compiler
+template <>          struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<void>                {typedef void type;};
+template <>          struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const void>          {typedef const void type;};
+template <>          struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<volatile void>       {typedef volatile void type;};
+template <>          struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const volatile void> {typedef const volatile void type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;
+#endif
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY  add_rvalue_reference                     {typedef _Tp&& type;};
+template <>          struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<void>                {typedef void type;};
+template <>          struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const void>          {typedef const void type;};
+template <>          struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<volatile void>       {typedef volatile void type;};
+template <>          struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const volatile void> {typedef const volatile void type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
+#endif
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+typename add_rvalue_reference<_Tp>::type
+declval() _NOEXCEPT;
+
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+typename add_lvalue_reference<_Tp>::type
+declval();
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+struct __any
+{
+    __any(...);
+};
+
+// remove_pointer
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer                      {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp*>                {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const>          {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* volatile>       {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const volatile> {typedef _Tp type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type;
+#endif
+
+// add_pointer
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_pointer
+    {typedef typename remove_reference<_Tp>::type* type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
+#endif
+
+// is_signed
+
+template <class _Tp, bool = is_integral<_Tp>::value>
+struct __libcpp_is_signed_impl : public _LIBCPP_BOOL_CONSTANT(_Tp(-1) < _Tp(0)) {};
+
+template <class _Tp>
+struct __libcpp_is_signed_impl<_Tp, false> : public true_type {};  // floating point
+
+template <class _Tp, bool = is_arithmetic<_Tp>::value>
+struct __libcpp_is_signed : public __libcpp_is_signed_impl<_Tp> {};
+
+template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {};
+
+// is_unsigned
+
+template <class _Tp, bool = is_integral<_Tp>::value>
+struct __libcpp_is_unsigned_impl : public _LIBCPP_BOOL_CONSTANT(_Tp(0) < _Tp(-1)) {};
+
+template <class _Tp>
+struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {};  // floating point
+
+template <class _Tp, bool = is_arithmetic<_Tp>::value>
+struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp> {};
+
+template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {};
+
+// rank
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank
+    : public integral_constant<size_t, 0> {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[]>
+    : public integral_constant<size_t, rank<_Tp>::value + 1> {};
+template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[_Np]>
+    : public integral_constant<size_t, rank<_Tp>::value + 1> {};
+
+// extent
+
+template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS_ONLY extent
+    : public integral_constant<size_t, 0> {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], 0>
+    : public integral_constant<size_t, 0> {};
+template <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], _Ip>
+    : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
+template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], 0>
+    : public integral_constant<size_t, _Np> {};
+template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], _Ip>
+    : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
+
+// remove_extent
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent
+    {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[]>
+    {typedef _Tp type;};
+template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[_Np]>
+    {typedef _Tp type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type;
+#endif
+
+// remove_all_extents
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents
+    {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[]>
+    {typedef typename remove_all_extents<_Tp>::type type;};
+template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[_Np]>
+    {typedef typename remove_all_extents<_Tp>::type type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type;
+#endif
+
+// decay
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY decay
+{
+private:
+    typedef typename remove_reference<_Tp>::type _Up;
+public:
+    typedef typename conditional
+                     <
+                         is_array<_Up>::value,
+                         typename remove_extent<_Up>::type*,
+                         typename conditional
+                         <
+                              is_function<_Up>::value,
+                              typename add_pointer<_Up>::type,
+                              typename remove_cv<_Up>::type
+                         >::type
+                     >::type type;
+};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using decay_t = typename decay<_Tp>::type;
+#endif
+
+// is_abstract
+
+namespace __is_abstract_imp
+{
+template <class _Tp> char  __test(_Tp (*)[1]);
+template <class _Tp> __two __test(...);
+}
+
+template <class _Tp, bool = is_class<_Tp>::value>
+struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {};
+
+template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {};
+
+// is_final
+
+#if defined(_LIBCPP_HAS_IS_FINAL)
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
+__libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {};
+#else
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
+__libcpp_is_final : public false_type {};
+#endif
+
+#if defined(_LIBCPP_HAS_IS_FINAL) && _LIBCPP_STD_VER > 11
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
+is_final : public integral_constant<bool, __is_final(_Tp)> {};
+#endif
+
+// is_base_of
+
+#ifdef _LIBCPP_HAS_IS_BASE_OF
+
+template <class _Bp, class _Dp>
+struct _LIBCPP_TYPE_VIS_ONLY is_base_of
+    : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
+
+#else  // _LIBCPP_HAS_IS_BASE_OF
+
+namespace __is_base_of_imp
+{
+template <class _Tp>
+struct _Dst
+{
+    _Dst(const volatile _Tp &);
+};
+template <class _Tp>
+struct _Src
+{
+    operator const volatile _Tp &();
+    template <class _Up> operator const _Dst<_Up> &();
+};
+template <size_t> struct __one { typedef char type; };
+template <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int);
+template <class _Bp, class _Dp> __two __test(...);
+}
+
+template <class _Bp, class _Dp>
+struct _LIBCPP_TYPE_VIS_ONLY is_base_of
+    : public integral_constant<bool, is_class<_Bp>::value &&
+                                     sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {};
+
+#endif  // _LIBCPP_HAS_IS_BASE_OF
+
+// is_convertible
+
+#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
+
+template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible
+    : public integral_constant<bool, __is_convertible_to(_T1, _T2) &&
+                                     !is_abstract<_T2>::value> {};
+
+#else  // __has_feature(is_convertible_to)
+
+namespace __is_convertible_imp
+{
+template <class _Tp> void  __test_convert(_Tp);
+
+template <class _From, class _To, class = void>
+struct __is_convertible_test : public false_type {};
+
+template <class _From, class _To>
+struct __is_convertible_test<_From, _To,
+    decltype(__test_convert<_To>(_VSTD::declval<_From>()))> : public true_type
+{};
+
+template <class _Tp> __two __test(...);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _Tp> _Tp&& __source();
+#else
+template <class _Tp> typename remove_reference<_Tp>::type& __source();
+#endif
+
+template <class _Tp, bool _IsArray =    is_array<_Tp>::value,
+                     bool _IsFunction = is_function<_Tp>::value,
+                     bool _IsVoid =     is_void<_Tp>::value>
+                     struct __is_array_function_or_void                          {enum {value = 0};};
+template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};};
+template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};};
+template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};};
+}
+
+template <class _Tp,
+    unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value>
+struct __is_convertible_check
+{
+    static const size_t __v = 0;
+};
+
+template <class _Tp>
+struct __is_convertible_check<_Tp, 0>
+{
+    static const size_t __v = sizeof(_Tp);
+};
+
+template <class _T1, class _T2,
+    unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value,
+    unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
+struct __is_convertible
+    : public integral_constant<bool,
+        __is_convertible_imp::__is_convertible_test<_T1, _T2>::value
+#if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+         && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value
+              && (!is_const<typename remove_reference<_T2>::type>::value
+                  || is_volatile<typename remove_reference<_T2>::type>::value)
+                  && (is_same<typename remove_cv<_T1>::type,
+                              typename remove_cv<typename remove_reference<_T2>::type>::type>::value
+                      || is_base_of<typename remove_reference<_T2>::type, _T1>::value))
+#endif
+    >
+{};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {};
+
+template <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {};
+template <class _T1> struct __is_convertible<const _T1, const _T1&, 1, 0> : true_type {};
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {};
+template <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {};
+template <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {};
+template <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {};
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0>
+    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0>
+    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0>
+    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0>
+    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0>                : public false_type {};
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _T1>            struct __is_convertible<_T1, _T1&&, 2, 0>               : public true_type {};
+#endif
+template <class _T1>            struct __is_convertible<_T1, _T1&, 2, 0>               : public true_type {};
+template <class _T1>            struct __is_convertible<_T1, _T1*, 2, 0>               : public true_type {};
+template <class _T1>            struct __is_convertible<_T1, _T1*const, 2, 0>          : public true_type {};
+template <class _T1>            struct __is_convertible<_T1, _T1*volatile, 2, 0>       : public true_type {};
+template <class _T1>            struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {};
+
+template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible
+    : public __is_convertible<_T1, _T2>
+{
+    static const size_t __complete_check1 = __is_convertible_check<_T1>::__v;
+    static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
+};
+
+#endif  // __has_feature(is_convertible_to)
+
+// is_empty
+
+#if __has_feature(is_empty) || (_GNUC_VER >= 407)
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_empty
+    : public integral_constant<bool, __is_empty(_Tp)> {};
+
+#else  // __has_feature(is_empty)
+
+template <class _Tp>
+struct __is_empty1
+    : public _Tp
+{
+    double __lx;
+};
+
+struct __is_empty2
+{
+    double __lx;
+};
+
+template <class _Tp, bool = is_class<_Tp>::value>
+struct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {};
+
+template <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_empty<_Tp> {};
+
+#endif  // __has_feature(is_empty)
+
+// is_polymorphic
+
+#if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC)
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic
+    : public integral_constant<bool, __is_polymorphic(_Tp)> {};
+
+#else
+
+template<typename _Tp> char &__is_polymorphic_impl(
+    typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0,
+                       int>::type);
+template<typename _Tp> __two &__is_polymorphic_impl(...);
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic
+    : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {};
+
+#endif // __has_feature(is_polymorphic)
+
+// has_virtual_destructor
+
+#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403)
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor
+    : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
+
+#else
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor
+    : public false_type {};
+
+#endif
+
+// alignment_of
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY alignment_of
+    : public integral_constant<size_t, __alignof__(_Tp)> {};
+
+// aligned_storage
+
+template <class _Hp, class _Tp>
+struct __type_list
+{
+    typedef _Hp _Head;
+    typedef _Tp _Tail;
+};
+
+struct __nat
+{
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+    __nat() = delete;
+    __nat(const __nat&) = delete;
+    __nat& operator=(const __nat&) = delete;
+    ~__nat() = delete;
+#endif
+};
+
+template <class _Tp>
+struct __align_type
+{
+    static const size_t value = alignment_of<_Tp>::value;
+    typedef _Tp type;
+};
+
+struct __struct_double {long double __lx;};
+struct __struct_double4 {double __lx[4];};
+
+typedef
+    __type_list<__align_type<unsigned char>,
+    __type_list<__align_type<unsigned short>,
+    __type_list<__align_type<unsigned int>,
+    __type_list<__align_type<unsigned long>,
+    __type_list<__align_type<unsigned long long>,
+    __type_list<__align_type<double>,
+    __type_list<__align_type<long double>,
+    __type_list<__align_type<__struct_double>,
+    __type_list<__align_type<__struct_double4>,
+    __type_list<__align_type<int*>,
+    __nat
+    > > > > > > > > > > __all_types;
+
+template <class _TL, size_t _Align> struct __find_pod;
+
+template <class _Hp, size_t _Align>
+struct __find_pod<__type_list<_Hp, __nat>, _Align>
+{
+    typedef typename conditional<
+                             _Align == _Hp::value,
+                             typename _Hp::type,
+                             void
+                         >::type type;
+};
+
+template <class _Hp, class _Tp, size_t _Align>
+struct __find_pod<__type_list<_Hp, _Tp>, _Align>
+{
+    typedef typename conditional<
+                             _Align == _Hp::value,
+                             typename _Hp::type,
+                             typename __find_pod<_Tp, _Align>::type
+                         >::type type;
+};
+
+template <class _TL, size_t _Len> struct __find_max_align;
+
+template <class _Hp, size_t _Len>
+struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {};
+
+template <size_t _Len, size_t _A1, size_t _A2>
+struct __select_align
+{
+private:
+    static const size_t __min = _A2 < _A1 ? _A2 : _A1;
+    static const size_t __max = _A1 < _A2 ? _A2 : _A1;
+public:
+    static const size_t value = _Len < __max ? __min : __max;
+};
+
+template <class _Hp, class _Tp, size_t _Len>
+struct __find_max_align<__type_list<_Hp, _Tp>, _Len>
+    : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {};
+
+template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
+struct _LIBCPP_TYPE_VIS_ONLY aligned_storage
+{
+    typedef typename __find_pod<__all_types, _Align>::type _Aligner;
+    static_assert(!is_void<_Aligner>::value, "");
+    union type
+    {
+        _Aligner __align;
+        unsigned char __data[_Len];
+    };
+};
+
+#if _LIBCPP_STD_VER > 11
+template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
+    using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;
+#endif
+
+#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \
+template <size_t _Len>\
+struct _LIBCPP_TYPE_VIS_ONLY aligned_storage<_Len, n>\
+{\
+    struct _ALIGNAS(n) type\
+    {\
+        unsigned char __lx[_Len];\
+    };\
+}
+
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000);
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000);
+// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000)
+#if !defined(_LIBCPP_MSVC)
+_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
+#endif // !_LIBCPP_MSVC
+
+#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+// aligned_union
+
+template <size_t _I0, size_t ..._In>
+struct __static_max;
+
+template <size_t _I0>
+struct __static_max<_I0>
+{
+    static const size_t value = _I0;
+};
+
+template <size_t _I0, size_t _I1, size_t ..._In>
+struct __static_max<_I0, _I1, _In...>
+{
+    static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value :
+                                             __static_max<_I1, _In...>::value;
+};
+
+template <size_t _Len, class _Type0, class ..._Types>
+struct aligned_union
+{
+    static const size_t alignment_value = __static_max<__alignof__(_Type0),
+                                                       __alignof__(_Types)...>::value;
+    static const size_t __len = __static_max<_Len, sizeof(_Type0),
+                                             sizeof(_Types)...>::value;
+    typedef typename aligned_storage<__len, alignment_value>::type type;
+};
+
+#if _LIBCPP_STD_VER > 11
+template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
+#endif
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp>
+struct __numeric_type
+{
+   static void __test(...);
+   static float __test(float);
+   static double __test(char);
+   static double __test(int);
+   static double __test(unsigned);
+   static double __test(long);
+   static double __test(unsigned long);
+   static double __test(long long);
+   static double __test(unsigned long long);
+   static double __test(double);
+   static long double __test(long double);
+
+   typedef decltype(__test(declval<_Tp>())) type;
+   static const bool value = !is_same<type, void>::value;
+};
+
+template <>
+struct __numeric_type<void>
+{
+   static const bool value = true;
+};
+
+// __promote
+
+template <class _A1, class _A2 = void, class _A3 = void,
+          bool = __numeric_type<_A1>::value &&
+                 __numeric_type<_A2>::value &&
+                 __numeric_type<_A3>::value>
+class __promote_imp
+{
+public:
+    static const bool value = false;
+};
+
+template <class _A1, class _A2, class _A3>
+class __promote_imp<_A1, _A2, _A3, true>
+{
+private:
+    typedef typename __promote_imp<_A1>::type __type1;
+    typedef typename __promote_imp<_A2>::type __type2;
+    typedef typename __promote_imp<_A3>::type __type3;
+public:
+    typedef decltype(__type1() + __type2() + __type3()) type;
+    static const bool value = true;
+};
+
+template <class _A1, class _A2>
+class __promote_imp<_A1, _A2, void, true>
+{
+private:
+    typedef typename __promote_imp<_A1>::type __type1;
+    typedef typename __promote_imp<_A2>::type __type2;
+public:
+    typedef decltype(__type1() + __type2()) type;
+    static const bool value = true;
+};
+
+template <class _A1>
+class __promote_imp<_A1, void, void, true>
+{
+public:
+    typedef typename __numeric_type<_A1>::type type;
+    static const bool value = true;
+};
+
+template <class _A1, class _A2 = void, class _A3 = void>
+class __promote : public __promote_imp<_A1, _A2, _A3> {};
+
+#ifdef _LIBCPP_STORE_AS_OPTIMIZATION
+
+// __transform
+
+template <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;};
+template <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char      type;};
+template <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short     type;};
+template <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int       type;};
+template <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;};
+
+#endif  // _LIBCPP_STORE_AS_OPTIMIZATION
+
+// make_signed / make_unsigned
+
+typedef
+    __type_list<signed char,
+    __type_list<signed short,
+    __type_list<signed int,
+    __type_list<signed long,
+    __type_list<signed long long,
+#ifndef _LIBCPP_HAS_NO_INT128
+    __type_list<__int128_t,
+#endif
+    __nat
+#ifndef _LIBCPP_HAS_NO_INT128
+    >
+#endif
+    > > > > > __signed_types;
+
+typedef
+    __type_list<unsigned char,
+    __type_list<unsigned short,
+    __type_list<unsigned int,
+    __type_list<unsigned long,
+    __type_list<unsigned long long,
+#ifndef _LIBCPP_HAS_NO_INT128
+    __type_list<__uint128_t,
+#endif
+    __nat
+#ifndef _LIBCPP_HAS_NO_INT128
+    >
+#endif
+    > > > > > __unsigned_types;
+
+template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first;
+
+template <class _Hp, class _Tp, size_t _Size>
+struct __find_first<__type_list<_Hp, _Tp>, _Size, true>
+{
+    typedef _Hp type;
+};
+
+template <class _Hp, class _Tp, size_t _Size>
+struct __find_first<__type_list<_Hp, _Tp>, _Size, false>
+{
+    typedef typename __find_first<_Tp, _Size>::type type;
+};
+
+template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,
+                             bool = is_volatile<typename remove_reference<_Tp>::type>::value>
+struct __apply_cv
+{
+    typedef _Up type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp, _Up, true, false>
+{
+    typedef const _Up type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp, _Up, false, true>
+{
+    typedef volatile _Up type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp, _Up, true, true>
+{
+    typedef const volatile _Up type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp&, _Up, false, false>
+{
+    typedef _Up& type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp&, _Up, true, false>
+{
+    typedef const _Up& type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp&, _Up, false, true>
+{
+    typedef volatile _Up& type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp&, _Up, true, true>
+{
+    typedef const volatile _Up& type;
+};
+
+template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
+struct __make_signed {};
+
+template <class _Tp>
+struct __make_signed<_Tp, true>
+{
+    typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type;
+};
+
+template <> struct __make_signed<bool,               true> {};
+template <> struct __make_signed<  signed short,     true> {typedef short     type;};
+template <> struct __make_signed<unsigned short,     true> {typedef short     type;};
+template <> struct __make_signed<  signed int,       true> {typedef int       type;};
+template <> struct __make_signed<unsigned int,       true> {typedef int       type;};
+template <> struct __make_signed<  signed long,      true> {typedef long      type;};
+template <> struct __make_signed<unsigned long,      true> {typedef long      type;};
+template <> struct __make_signed<  signed long long, true> {typedef long long type;};
+template <> struct __make_signed<unsigned long long, true> {typedef long long type;};
+#ifndef _LIBCPP_HAS_NO_INT128
+template <> struct __make_signed<__int128_t,         true> {typedef __int128_t type;};
+template <> struct __make_signed<__uint128_t,        true> {typedef __int128_t type;};
+#endif
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY make_signed
+{
+    typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type;
+};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using make_signed_t = typename make_signed<_Tp>::type;
+#endif
+
+template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
+struct __make_unsigned {};
+
+template <class _Tp>
+struct __make_unsigned<_Tp, true>
+{
+    typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type;
+};
+
+template <> struct __make_unsigned<bool,               true> {};
+template <> struct __make_unsigned<  signed short,     true> {typedef unsigned short     type;};
+template <> struct __make_unsigned<unsigned short,     true> {typedef unsigned short     type;};
+template <> struct __make_unsigned<  signed int,       true> {typedef unsigned int       type;};
+template <> struct __make_unsigned<unsigned int,       true> {typedef unsigned int       type;};
+template <> struct __make_unsigned<  signed long,      true> {typedef unsigned long      type;};
+template <> struct __make_unsigned<unsigned long,      true> {typedef unsigned long      type;};
+template <> struct __make_unsigned<  signed long long, true> {typedef unsigned long long type;};
+template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;};
+#ifndef _LIBCPP_HAS_NO_INT128
+template <> struct __make_unsigned<__int128_t,         true> {typedef __uint128_t        type;};
+template <> struct __make_unsigned<__uint128_t,        true> {typedef __uint128_t        type;};
+#endif
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY make_unsigned
+{
+    typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type;
+};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;
+#endif
+
+#ifdef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Up = void, class _Vp = void>
+struct _LIBCPP_TYPE_VIS_ONLY common_type
+{
+public:
+    typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp>::type type;
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, void, void>
+{
+public:
+    typedef typename decay<_Tp>::type type;
+};
+
+template <class _Tp, class _Up>
+struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, void>
+{
+private:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    static _Tp&& __t();
+    static _Up&& __u();
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    static _Tp __t();
+    static _Up __u();
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+public:
+    typedef typename remove_reference<decltype(true ? __t() : __u())>::type type;
+};
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class ..._Tp> struct common_type;
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp>
+{
+    typedef typename decay<_Tp>::type type;
+};
+
+template <class _Tp, class _Up>
+struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up>
+{
+private:
+    static _Tp&& __t();
+    static _Up&& __u();
+    static bool __f();
+public:
+    typedef typename decay<decltype(__f() ? __t() : __u())>::type type;
+};
+
+template <class _Tp, class _Up, class ..._Vp>
+struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...>
+{
+    typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type;
+};
+
+#if _LIBCPP_STD_VER > 11
+template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type;
+#endif
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+// is_assignable
+
+template<typename, typename _Tp> struct __select_2nd { typedef _Tp type; };
+
+template <class _Tp, class _Arg>
+typename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+__is_assignable_test(_Tp&&, _Arg&&);
+#else
+__is_assignable_test(_Tp, _Arg&);
+#endif
+
+template <class _Arg>
+false_type
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+__is_assignable_test(__any, _Arg&&);
+#else
+__is_assignable_test(__any, _Arg&);
+#endif
+
+template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value>
+struct __is_assignable_imp
+    : public common_type
+        <
+            decltype(_VSTD::__is_assignable_test(declval<_Tp>(), declval<_Arg>()))
+        >::type {};
+
+template <class _Tp, class _Arg>
+struct __is_assignable_imp<_Tp, _Arg, true>
+    : public false_type
+{
+};
+
+template <class _Tp, class _Arg>
+struct is_assignable
+    : public __is_assignable_imp<_Tp, _Arg> {};
+
+// is_copy_assignable
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable
+    : public is_assignable<typename add_lvalue_reference<_Tp>::type,
+                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+
+// is_move_assignable
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    : public is_assignable<typename add_lvalue_reference<_Tp>::type,
+                     const typename add_rvalue_reference<_Tp>::type> {};
+#else
+    : public is_copy_assignable<_Tp> {};
+#endif
+
+// is_destructible
+
+//  if it's a reference, return true
+//  if it's a function, return false
+//  if it's   void,     return false
+//  if it's an array of unknown bound, return false
+//  Otherwise, return "std::declval<_Up&>().~_Up()" is well-formed
+//    where _Up is remove_all_extents<_Tp>::type
+
+template <class>
+struct __is_destructible_apply { typedef int type; };
+
+template <typename _Tp>
+struct __is_destructor_wellformed {
+    template <typename _Tp1>
+    static char  __test (
+        typename __is_destructible_apply<decltype(_VSTD::declval<_Tp1&>().~_Tp1())>::type
+    );
+
+    template <typename _Tp1>
+    static __two __test (...);
+    
+    static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char);
+};
+
+template <class _Tp, bool>
+struct __destructible_imp;
+
+template <class _Tp>
+struct __destructible_imp<_Tp, false> 
+   : public _VSTD::integral_constant<bool, 
+        __is_destructor_wellformed<typename _VSTD::remove_all_extents<_Tp>::type>::value> {};
+
+template <class _Tp>
+struct __destructible_imp<_Tp, true>
+    : public _VSTD::true_type {};
+
+template <class _Tp, bool>
+struct __destructible_false;
+
+template <class _Tp>
+struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, _VSTD::is_reference<_Tp>::value> {};
+
+template <class _Tp>
+struct __destructible_false<_Tp, true> : public _VSTD::false_type {};
+
+template <class _Tp>
+struct is_destructible
+    : public __destructible_false<_Tp, _VSTD::is_function<_Tp>::value> {};
+
+template <class _Tp>
+struct is_destructible<_Tp[]>
+    : public _VSTD::false_type {};
+
+template <>
+struct is_destructible<void>
+    : public _VSTD::false_type {};
+
+// move
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename remove_reference<_Tp>::type&&
+move(_Tp&& __t) _NOEXCEPT
+{
+    typedef typename remove_reference<_Tp>::type _Up;
+    return static_cast<_Up&&>(__t);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp&&
+forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
+{
+    return static_cast<_Tp&&>(__t);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Tp&&
+forward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT
+{
+    static_assert(!std::is_lvalue_reference<_Tp>::value,
+                  "Can not forward an rvalue as an lvalue.");
+    return static_cast<_Tp&&>(__t);
+}
+
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp&
+move(_Tp& __t)
+{
+    return __t;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+const _Tp&
+move(const _Tp& __t)
+{
+    return __t;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp&
+forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
+{
+    return __t;
+}
+
+
+template <class _Tp>
+class __rv
+{
+    typedef typename remove_reference<_Tp>::type _Trr;
+    _Trr& t_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    _Trr* operator->() {return &t_;}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __rv(_Trr& __t) : t_(__t) {}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename decay<_Tp>::type
+__decay_copy(_Tp&& __t)
+{
+    return _VSTD::forward<_Tp>(__t);
+}
+
+#else
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename decay<_Tp>::type
+__decay_copy(const _Tp& __t)
+{
+    return _VSTD::forward<_Tp>(__t);
+}
+
+#endif
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+#if __has_feature(cxx_reference_qualified_functions) || \
+    (defined(_GNUC_VER) && _GNUC_VER >= 409)
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
+{
+    typedef _Class& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false>
+{
+    typedef _Class& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
+{
+    typedef _Class const& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false>
+{
+    typedef _Class const& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
+{
+    typedef _Class volatile& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false>
+{
+    typedef _Class volatile& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
+{
+    typedef _Class const volatile& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false>
+{
+    typedef _Class const volatile& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
+{
+    typedef _Class&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false>
+{
+    typedef _Class&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
+{
+    typedef _Class const&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false>
+{
+    typedef _Class const&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
+{
+    typedef _Class volatile&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false>
+{
+    typedef _Class volatile&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
+{
+    typedef _Class const volatile&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false>
+{
+    typedef _Class const volatile&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+#endif  // __has_feature(cxx_reference_qualified_functions) || _GNUC_VER >= 409
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) ();
+};
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0);
+};
+
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) ();
+};
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0);
+};
+
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) ();
+};
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0);
+};
+
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) ();
+};
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0);
+};
+
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2);
+};
+
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+};
+
+template <class _MP>
+struct __member_pointer_traits
+    : public __member_pointer_traits_imp<typename remove_cv<_MP>::type,
+                    is_member_function_pointer<_MP>::value,
+                    is_member_object_pointer<_MP>::value>
+{
+//     typedef ... _ClassType;
+//     typedef ... _ReturnType;
+//     typedef ... _FnType;
+};
+
+// result_of
+
+template <class _Callable> class result_of;
+
+#ifdef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Fn, bool, bool>
+class __result_of
+{
+};
+
+template <class _Fn>
+class __result_of<_Fn(), true, false>
+{
+public:
+    typedef decltype(declval<_Fn>()()) type;
+};
+
+template <class _Fn, class _A0>
+class __result_of<_Fn(_A0), true, false>
+{
+public:
+    typedef decltype(declval<_Fn>()(declval<_A0>())) type;
+};
+
+template <class _Fn, class _A0, class _A1>
+class __result_of<_Fn(_A0, _A1), true, false>
+{
+public:
+    typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type;
+};
+
+template <class _Fn, class _A0, class _A1, class _A2>
+class __result_of<_Fn(_A0, _A1, _A2), true, false>
+{
+public:
+    typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type;
+};
+
+template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
+struct __result_of_mp;
+
+// member function pointer
+
+template <class _MP, class _Tp>
+struct __result_of_mp<_MP, _Tp, true>
+    : public __identity<typename __member_pointer_traits<_MP>::_ReturnType>
+{
+};
+
+// member data pointer
+
+template <class _MP, class _Tp, bool>
+struct __result_of_mdp;
+
+template <class _Rp, class _Class, class _Tp>
+struct __result_of_mdp<_Rp _Class::*, _Tp, false>
+{
+    typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type;
+};
+
+template <class _Rp, class _Class, class _Tp>
+struct __result_of_mdp<_Rp _Class::*, _Tp, true>
+{
+    typedef typename __apply_cv<_Tp, _Rp>::type& type;
+};
+
+template <class _Rp, class _Class, class _Tp>
+struct __result_of_mp<_Rp _Class::*, _Tp, false>
+    : public __result_of_mdp<_Rp _Class::*, _Tp,
+            is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
+{
+};
+
+
+
+template <class _Fn, class _Tp>
+class __result_of<_Fn(_Tp), false, true>  // _Fn must be member pointer
+    : public __result_of_mp<typename remove_reference<_Fn>::type,
+                            _Tp,
+                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
+{
+};
+
+template <class _Fn, class _Tp, class _A0>
+class __result_of<_Fn(_Tp, _A0), false, true>  // _Fn must be member pointer
+    : public __result_of_mp<typename remove_reference<_Fn>::type,
+                            _Tp,
+                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
+{
+};
+
+template <class _Fn, class _Tp, class _A0, class _A1>
+class __result_of<_Fn(_Tp, _A0, _A1), false, true>  // _Fn must be member pointer
+    : public __result_of_mp<typename remove_reference<_Fn>::type,
+                            _Tp,
+                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
+{
+};
+
+template <class _Fn, class _Tp, class _A0, class _A1, class _A2>
+class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true>  // _Fn must be member pointer
+    : public __result_of_mp<typename remove_reference<_Fn>::type,
+                            _Tp,
+                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
+{
+};
+
+// result_of
+
+template <class _Fn>
+class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn()>
+    : public __result_of<_Fn(),
+                         is_class<typename remove_reference<_Fn>::type>::value ||
+                         is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
+                         is_member_pointer<typename remove_reference<_Fn>::type>::value
+                        >
+{
+};
+
+template <class _Fn, class _A0>
+class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0)>
+    : public __result_of<_Fn(_A0),
+                         is_class<typename remove_reference<_Fn>::type>::value ||
+                         is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
+                         is_member_pointer<typename remove_reference<_Fn>::type>::value
+                        >
+{
+};
+
+template <class _Fn, class _A0, class _A1>
+class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1)>
+    : public __result_of<_Fn(_A0, _A1),
+                         is_class<typename remove_reference<_Fn>::type>::value ||
+                         is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
+                         is_member_pointer<typename remove_reference<_Fn>::type>::value
+                        >
+{
+};
+
+template <class _Fn, class _A0, class _A1, class _A2>
+class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)>
+    : public __result_of<_Fn(_A0, _A1, _A2),
+                         is_class<typename remove_reference<_Fn>::type>::value ||
+                         is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
+                         is_member_pointer<typename remove_reference<_Fn>::type>::value
+                        >
+{
+};
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+// template <class T, class... Args> struct is_constructible;
+
+namespace __is_construct
+{
+struct __nat {};
+}
+
+#if __has_feature(is_constructible)
+
+template <class _Tp, class ..._Args>
+struct _LIBCPP_TYPE_VIS_ONLY is_constructible
+    : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
+    {};
+
+#else
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+//      main is_constructible test
+
+template <class _Tp, class ..._Args>
+typename __select_2nd<decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...))), true_type>::type
+__is_constructible_test(_Tp&&, _Args&& ...);
+
+template <class ..._Args>
+false_type
+__is_constructible_test(__any, _Args&& ...);
+
+template <bool, class _Tp, class... _Args>
+struct __libcpp_is_constructible // false, _Tp is not a scalar
+    : public common_type
+             <
+                 decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...))
+             >::type
+    {};
+
+//      function types are not constructible
+
+template <class _Rp, class... _A1, class... _A2>
+struct __libcpp_is_constructible<false, _Rp(_A1...), _A2...>
+    : public false_type
+    {};
+
+//      handle scalars and reference types
+
+//      Scalars are default constructible, references are not
+
+template <class _Tp>
+struct __libcpp_is_constructible<true, _Tp>
+    : public is_scalar<_Tp>
+    {};
+
+//      Scalars and references are constructible from one arg if that arg is
+//          implicitly convertible to the scalar or reference.
+
+template <class _Tp>
+struct __is_constructible_ref
+{
+    true_type static __lxx(_Tp);
+    false_type static __lxx(...);
+};
+
+template <class _Tp, class _A0>
+struct __libcpp_is_constructible<true, _Tp, _A0>
+    : public common_type
+             <
+                 decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>()))
+             >::type
+    {};
+
+//      Scalars and references are not constructible from multiple args.
+
+template <class _Tp, class _A0, class ..._Args>
+struct __libcpp_is_constructible<true, _Tp, _A0, _Args...>
+    : public false_type
+    {};
+
+//      Treat scalars and reference types separately
+
+template <bool, class _Tp, class... _Args>
+struct __is_constructible_void_check
+    : public __libcpp_is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
+                                _Tp, _Args...>
+    {};
+
+//      If any of T or Args is void, is_constructible should be false
+
+template <class _Tp, class... _Args>
+struct __is_constructible_void_check<true, _Tp, _Args...>
+    : public false_type
+    {};
+
+template <class ..._Args> struct __contains_void;
+
+template <> struct __contains_void<> : false_type {};
+
+template <class _A0, class ..._Args>
+struct __contains_void<_A0, _Args...>
+{
+    static const bool value = is_void<_A0>::value ||
+                              __contains_void<_Args...>::value;
+};
+
+//      is_constructible entry point
+
+template <class _Tp, class... _Args>
+struct _LIBCPP_TYPE_VIS_ONLY is_constructible
+    : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
+                                        || is_abstract<_Tp>::value,
+                                           _Tp, _Args...>
+    {};
+
+//      Array types are default constructible if their element type
+//      is default constructible
+
+template <class _Ap, size_t _Np>
+struct __libcpp_is_constructible<false, _Ap[_Np]>
+    : public is_constructible<typename remove_all_extents<_Ap>::type>
+    {};
+
+//      Otherwise array types are not constructible by this syntax
+
+template <class _Ap, size_t _Np, class ..._Args>
+struct __libcpp_is_constructible<false, _Ap[_Np], _Args...>
+    : public false_type
+    {};
+
+//      Incomplete array types are not constructible
+
+template <class _Ap, class ..._Args>
+struct __libcpp_is_constructible<false, _Ap[], _Args...>
+    : public false_type
+    {};
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+// template <class T> struct is_constructible0;
+
+//      main is_constructible0 test
+
+template <class _Tp>
+decltype((_Tp(), true_type()))
+__is_constructible0_test(_Tp&);
+
+false_type
+__is_constructible0_test(__any);
+
+template <class _Tp, class _A0>
+decltype((_Tp(_VSTD::declval<_A0>()), true_type()))
+__is_constructible1_test(_Tp&, _A0&);
+
+template <class _A0>
+false_type
+__is_constructible1_test(__any, _A0&);
+
+template <class _Tp, class _A0, class _A1>
+decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type()))
+__is_constructible2_test(_Tp&, _A0&, _A1&);
+
+template <class _A0, class _A1>
+false_type
+__is_constructible2_test(__any, _A0&, _A1&);
+
+template <bool, class _Tp>
+struct __is_constructible0_imp // false, _Tp is not a scalar
+    : public common_type
+             <
+                 decltype(__is_constructible0_test(declval<_Tp&>()))
+             >::type
+    {};
+
+template <bool, class _Tp, class _A0>
+struct __is_constructible1_imp // false, _Tp is not a scalar
+    : public common_type
+             <
+                 decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>()))
+             >::type
+    {};
+
+template <bool, class _Tp, class _A0, class _A1>
+struct __is_constructible2_imp // false, _Tp is not a scalar
+    : public common_type
+             <
+                 decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>()))
+             >::type
+    {};
+
+//      handle scalars and reference types
+
+//      Scalars are default constructible, references are not
+
+template <class _Tp>
+struct __is_constructible0_imp<true, _Tp>
+    : public is_scalar<_Tp>
+    {};
+
+template <class _Tp, class _A0>
+struct __is_constructible1_imp<true, _Tp, _A0>
+    : public is_convertible<_A0, _Tp>
+    {};
+
+template <class _Tp, class _A0, class _A1>
+struct __is_constructible2_imp<true, _Tp, _A0, _A1>
+    : public false_type
+    {};
+
+//      Treat scalars and reference types separately
+
+template <bool, class _Tp>
+struct __is_constructible0_void_check
+    : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
+                                _Tp>
+    {};
+
+template <bool, class _Tp, class _A0>
+struct __is_constructible1_void_check
+    : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
+                                _Tp, _A0>
+    {};
+
+template <bool, class _Tp, class _A0, class _A1>
+struct __is_constructible2_void_check
+    : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
+                                _Tp, _A0, _A1>
+    {};
+
+//      If any of T or Args is void, is_constructible should be false
+
+template <class _Tp>
+struct __is_constructible0_void_check<true, _Tp>
+    : public false_type
+    {};
+
+template <class _Tp, class _A0>
+struct __is_constructible1_void_check<true, _Tp, _A0>
+    : public false_type
+    {};
+
+template <class _Tp, class _A0, class _A1>
+struct __is_constructible2_void_check<true, _Tp, _A0, _A1>
+    : public false_type
+    {};
+
+//      is_constructible entry point
+
+template <class _Tp, class _A0 = __is_construct::__nat,
+                     class _A1 = __is_construct::__nat>
+struct _LIBCPP_TYPE_VIS_ONLY is_constructible
+    : public __is_constructible2_void_check<is_void<_Tp>::value
+                                        || is_abstract<_Tp>::value
+                                        || is_function<_Tp>::value
+                                        || is_void<_A0>::value
+                                        || is_void<_A1>::value,
+                                           _Tp, _A0, _A1>
+    {};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
+    : public __is_constructible0_void_check<is_void<_Tp>::value
+                                        || is_abstract<_Tp>::value
+                                        || is_function<_Tp>::value,
+                                           _Tp>
+    {};
+
+template <class _Tp, class _A0>
+struct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, _A0, __is_construct::__nat>
+    : public __is_constructible1_void_check<is_void<_Tp>::value
+                                        || is_abstract<_Tp>::value
+                                        || is_function<_Tp>::value
+                                        || is_void<_A0>::value,
+                                           _Tp, _A0>
+    {};
+
+//      Array types are default constructible if their element type
+//      is default constructible
+
+template <class _Ap, size_t _Np>
+struct __is_constructible0_imp<false, _Ap[_Np]>
+    : public is_constructible<typename remove_all_extents<_Ap>::type>
+    {};
+
+template <class _Ap, size_t _Np, class _A0>
+struct __is_constructible1_imp<false, _Ap[_Np], _A0>
+    : public false_type
+    {};
+
+template <class _Ap, size_t _Np, class _A0, class _A1>
+struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1>
+    : public false_type
+    {};
+
+//      Incomplete array types are not constructible
+
+template <class _Ap>
+struct __is_constructible0_imp<false, _Ap[]>
+    : public false_type
+    {};
+
+template <class _Ap, class _A0>
+struct __is_constructible1_imp<false, _Ap[], _A0>
+    : public false_type
+    {};
+
+template <class _Ap, class _A0, class _A1>
+struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
+    : public false_type
+    {};
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // __has_feature(is_constructible)
+
+// is_default_constructible
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_default_constructible
+    : public is_constructible<_Tp>
+    {};
+
+// is_copy_constructible
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible
+    : public is_constructible<_Tp, 
+                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+
+// is_move_constructible
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_move_constructible
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
+#else
+    : public is_copy_constructible<_Tp>
+#endif
+    {};
+
+// is_trivially_constructible
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
+
+template <class _Tp, class... _Args>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
+    : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)>
+{
+};
+
+#else  // !__has_feature(is_trivially_constructible)
+
+template <class _Tp, class... _Args>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
+    : false_type
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp>
+#if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_trivial_constructor(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value>
+#endif
+{
+};
+
+template <class _Tp>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&&>
+#else
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp>
+#endif
+    : integral_constant<bool, is_scalar<_Tp>::value>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&>
+    : integral_constant<bool, is_scalar<_Tp>::value>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&>
+    : integral_constant<bool, is_scalar<_Tp>::value>
+{
+};
+
+#endif  // !__has_feature(is_trivially_constructible)
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _A0 = __is_construct::__nat,
+                     class _A1 = __is_construct::__nat>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
+    : false_type
+{
+};
+
+#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat,
+                                                       __is_construct::__nat>
+    : integral_constant<bool, __is_trivially_constructible(_Tp)>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp,
+                                                       __is_construct::__nat>
+    : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&,
+                                                       __is_construct::__nat>
+    : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&,
+                                                       __is_construct::__nat>
+    : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)>
+{
+};
+
+#else  // !__has_feature(is_trivially_constructible)
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat,
+                                                       __is_construct::__nat>
+    : integral_constant<bool, is_scalar<_Tp>::value>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp,
+                                                       __is_construct::__nat>
+    : integral_constant<bool, is_scalar<_Tp>::value>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&,
+                                                       __is_construct::__nat>
+    : integral_constant<bool, is_scalar<_Tp>::value>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&,
+                                                       __is_construct::__nat>
+    : integral_constant<bool, is_scalar<_Tp>::value>
+{
+};
+
+#endif  // !__has_feature(is_trivially_constructible)
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+// is_trivially_default_constructible
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_default_constructible
+    : public is_trivially_constructible<_Tp>
+    {};
+
+// is_trivially_copy_constructible
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_constructible
+    : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type>
+    {};
+
+// is_trivially_move_constructible
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructible
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
+#else
+    : public is_trivially_copy_constructible<_Tp>
+#endif
+    {};
+
+// is_trivially_assignable
+
+#if __has_feature(is_trivially_assignable) || _GNUC_VER >= 501
+
+template <class _Tp, class _Arg>
+struct is_trivially_assignable
+    : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)>
+{
+};
+
+#else  // !__has_feature(is_trivially_assignable)
+
+template <class _Tp, class _Arg>
+struct is_trivially_assignable
+    : public false_type {};
+
+template <class _Tp>
+struct is_trivially_assignable<_Tp&, _Tp>
+    : integral_constant<bool, is_scalar<_Tp>::value> {};
+
+template <class _Tp>
+struct is_trivially_assignable<_Tp&, _Tp&>
+    : integral_constant<bool, is_scalar<_Tp>::value> {};
+
+template <class _Tp>
+struct is_trivially_assignable<_Tp&, const _Tp&>
+    : integral_constant<bool, is_scalar<_Tp>::value> {};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+struct is_trivially_assignable<_Tp&, _Tp&&>
+    : integral_constant<bool, is_scalar<_Tp>::value> {};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#endif  // !__has_feature(is_trivially_assignable)
+
+// is_trivially_copy_assignable
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable
+    : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
+                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+
+// is_trivially_move_assignable
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable
+    : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+                                     typename add_rvalue_reference<_Tp>::type>
+#else
+                                     typename add_lvalue_reference<_Tp>::type>
+#endif
+    {};
+
+// is_trivially_destructible
+
+#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403)
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
+    : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {};
+
+#else
+
+template <class _Tp> struct __libcpp_trivial_destructor
+    : public integral_constant<bool, is_scalar<_Tp>::value ||
+                                     is_reference<_Tp>::value> {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
+    : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible<_Tp[]>
+    : public false_type {};
+
+#endif
+
+// is_nothrow_constructible
+
+#if 0
+template <class _Tp, class... _Args>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
+    : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))>
+{
+};
+
+#else
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
+
+template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
+
+template <class _Tp, class... _Args>
+struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/false, _Tp, _Args...>
+    : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
+{
+};
+
+template <class _Tp>
+void __implicit_conversion_to(_Tp) noexcept { }
+
+template <class _Tp, class _Arg>
+struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg>
+    : public integral_constant<bool, noexcept(__implicit_conversion_to<_Tp>(declval<_Arg>()))>
+{
+};
+
+template <class _Tp, bool _IsReference, class... _Args>
+struct __libcpp_is_nothrow_constructible</*is constructible*/false, _IsReference, _Tp, _Args...>
+    : public false_type
+{
+};
+
+template <class _Tp, class... _Args>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
+    : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...>
+{
+};
+
+template <class _Tp, size_t _Ns>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]>
+    : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp>
+{
+};
+
+#else  // __has_feature(cxx_noexcept)
+
+template <class _Tp, class... _Args>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
+    : false_type
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp>
+#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_constructor(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value>
+#endif
+{
+};
+
+template <class _Tp>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&>
+#else
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp>
+#endif
+#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_copy(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value>
+#endif
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&>
+#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_copy(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value>
+#endif
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&>
+#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_copy(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value>
+#endif
+{
+};
+
+#endif  // __has_feature(cxx_noexcept)
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _A0 = __is_construct::__nat,
+                     class _A1 = __is_construct::__nat>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
+    : false_type
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat,
+                                                       __is_construct::__nat>
+#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_constructor(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value>
+#endif
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp,
+                                                       __is_construct::__nat>
+#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_copy(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value>
+#endif
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&,
+                                                       __is_construct::__nat>
+#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_copy(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value>
+#endif
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&,
+                                                       __is_construct::__nat>
+#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_copy(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value>
+#endif
+{
+};
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // __has_feature(is_nothrow_constructible)
+
+// is_nothrow_default_constructible
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructible
+    : public is_nothrow_constructible<_Tp>
+    {};
+
+// is_nothrow_copy_constructible
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible
+    : public is_nothrow_constructible<_Tp,
+                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+
+// is_nothrow_move_constructible
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
+#else
+    : public is_nothrow_copy_constructible<_Tp>
+#endif
+    {};
+
+// is_nothrow_assignable
+
+#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
+
+template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable;
+
+template <class _Tp, class _Arg>
+struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg>
+    : public false_type
+{
+};
+
+template <class _Tp, class _Arg>
+struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg>
+    : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) >
+{
+};
+
+template <class _Tp, class _Arg>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable
+    : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
+{
+};
+
+#else  // __has_feature(cxx_noexcept)
+
+template <class _Tp, class _Arg>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable
+    : public false_type {};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp>
+#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value> {};
+#endif
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&>
+#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value> {};
+#endif
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&>
+#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value> {};
+#endif
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+struct is_nothrow_assignable<_Tp&, _Tp&&>
+#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
+    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
+#else
+    : integral_constant<bool, is_scalar<_Tp>::value> {};
+#endif
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#endif  // __has_feature(cxx_noexcept)
+
+// is_nothrow_copy_assignable
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable
+    : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
+                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+
+// is_nothrow_move_assignable
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable
+    : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+                                     typename add_rvalue_reference<_Tp>::type>
+#else
+                                     typename add_lvalue_reference<_Tp>::type>
+#endif
+    {};
+
+// is_nothrow_destructible
+
+#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
+
+template <bool, class _Tp> struct __libcpp_is_nothrow_destructible;
+
+template <class _Tp>
+struct __libcpp_is_nothrow_destructible<false, _Tp>
+    : public false_type
+{
+};
+
+template <class _Tp>
+struct __libcpp_is_nothrow_destructible<true, _Tp>
+    : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) >
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible
+    : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
+{
+};
+
+template <class _Tp, size_t _Ns>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[_Ns]>
+    : public is_nothrow_destructible<_Tp>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&>
+    : public true_type
+{
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&&>
+    : public true_type
+{
+};
+
+#endif
+
+#else
+
+template <class _Tp> struct __libcpp_nothrow_destructor
+    : public integral_constant<bool, is_scalar<_Tp>::value ||
+                                     is_reference<_Tp>::value> {};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible
+    : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[]>
+    : public false_type {};
+
+#endif
+
+// is_pod
+
+#if __has_feature(is_pod) || (_GNUC_VER >= 403)
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod
+    : public integral_constant<bool, __is_pod(_Tp)> {};
+
+#else
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod
+    : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value   &&
+                                     is_trivially_copy_constructible<_Tp>::value      &&
+                                     is_trivially_copy_assignable<_Tp>::value    &&
+                                     is_trivially_destructible<_Tp>::value> {};
+
+#endif
+
+// is_literal_type;
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type
+#ifdef _LIBCPP_IS_LITERAL
+    : public integral_constant<bool, _LIBCPP_IS_LITERAL(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value ||
+                              is_reference<typename remove_all_extents<_Tp>::type>::value>
+#endif
+    {};
+    
+// is_standard_layout;
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout
+#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407)
+    : public integral_constant<bool, __is_standard_layout(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
+#endif
+    {};
+    
+// is_trivially_copyable;
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
+#if __has_feature(is_trivially_copyable)
+    : public integral_constant<bool, __is_trivially_copyable(_Tp)>
+#elif _GNUC_VER >= 501
+    : public integral_constant<bool, !is_volatile<_Tp>::value && __is_trivially_copyable(_Tp)>
+#else
+    : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
+#endif
+    {};
+    
+// is_trivial;
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial
+#if __has_feature(is_trivial) || _GNUC_VER >= 407
+    : public integral_constant<bool, __is_trivial(_Tp)>
+#else
+    : integral_constant<bool, is_trivially_copyable<_Tp>::value &&
+                                 is_trivially_default_constructible<_Tp>::value>
+#endif
+    {};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+// Check for complete types
+
+template <class ..._Tp> struct __check_complete;
+
+template <>
+struct __check_complete<>
+{
+};
+
+template <class _Hp, class _T0, class ..._Tp>
+struct __check_complete<_Hp, _T0, _Tp...>
+    : private __check_complete<_Hp>,
+      private __check_complete<_T0, _Tp...>
+{
+};
+
+template <class _Hp>
+struct __check_complete<_Hp, _Hp>
+    : private __check_complete<_Hp>
+{
+};
+
+template <class _Tp>
+struct __check_complete<_Tp>
+{
+    static_assert(sizeof(_Tp) > 0, "Type must be complete.");
+};
+
+template <class _Tp>
+struct __check_complete<_Tp&>
+    : private __check_complete<_Tp>
+{
+};
+
+template <class _Tp>
+struct __check_complete<_Tp&&>
+    : private __check_complete<_Tp>
+{
+};
+
+template <class _Rp, class ..._Param>
+struct __check_complete<_Rp (*)(_Param...)>
+    : private __check_complete<_Rp>
+{
+};
+
+template <class ..._Param>
+struct __check_complete<void (*)(_Param...)>
+{
+};
+
+template <class _Rp, class ..._Param>
+struct __check_complete<_Rp (_Param...)>
+    : private __check_complete<_Rp>
+{
+};
+
+template <class ..._Param>
+struct __check_complete<void (_Param...)>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...)>
+    : private __check_complete<_Class>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const>
+    : private __check_complete<_Class>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) volatile>
+    : private __check_complete<_Class>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const volatile>
+    : private __check_complete<_Class>
+{
+};
+
+#if __has_feature(cxx_reference_qualified_functions)
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) &>
+    : private __check_complete<_Class>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const&>
+    : private __check_complete<_Class>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) volatile&>
+    : private __check_complete<_Class>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&>
+    : private __check_complete<_Class>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) &&>
+    : private __check_complete<_Class>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const&&>
+    : private __check_complete<_Class>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&>
+    : private __check_complete<_Class>
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&>
+    : private __check_complete<_Class>
+{
+};
+
+#endif
+
+template <class _Rp, class _Class>
+struct __check_complete<_Rp _Class::*>
+    : private __check_complete<_Class>
+{
+};
+
+// __invoke forward declarations
+
+// fall back - none of the bullets
+
+template <class ..._Args>
+auto
+__invoke(__any, _Args&& ...__args)
+    -> __nat;
+
+// bullets 1 and 2
+
+template <class _Fp, class _A0, class ..._Args,
+            class = typename enable_if
+            <
+                is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
+                is_base_of<typename remove_reference<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType>::type,
+                           typename remove_reference<_A0>::type>::value
+            >::type
+         >
+_LIBCPP_INLINE_VISIBILITY
+auto
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+    -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...));
+
+template <class _Fp, class _A0, class ..._Args,
+            class = typename enable_if
+            <
+                is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
+                !is_base_of<typename remove_reference<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType>::type,
+                           typename remove_reference<_A0>::type>::value
+            >::type
+         >
+_LIBCPP_INLINE_VISIBILITY
+auto
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+    -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...));
+
+// bullets 3 and 4
+
+template <class _Fp, class _A0,
+            class = typename enable_if
+            <
+                is_member_object_pointer<typename remove_reference<_Fp>::type>::value &&
+                is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
+                           typename remove_reference<_A0>::type>::value
+            >::type
+         >
+_LIBCPP_INLINE_VISIBILITY
+auto
+__invoke(_Fp&& __f, _A0&& __a0)
+    -> decltype(_VSTD::forward<_A0>(__a0).*__f);
+
+template <class _Fp, class _A0,
+            class = typename enable_if
+            <
+                is_member_object_pointer<typename remove_reference<_Fp>::type>::value &&
+                !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
+                           typename remove_reference<_A0>::type>::value
+            >::type
+         >
+_LIBCPP_INLINE_VISIBILITY
+auto
+__invoke(_Fp&& __f, _A0&& __a0)
+    -> decltype((*_VSTD::forward<_A0>(__a0)).*__f);
+
+// bullet 5
+
+template <class _Fp, class ..._Args>
+_LIBCPP_INLINE_VISIBILITY
+auto
+__invoke(_Fp&& __f, _Args&& ...__args)
+    -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...));
+
+// __invokable
+
+template <class _Fp, class ..._Args>
+struct __invokable_imp
+    : private __check_complete<_Fp>
+{
+    typedef decltype(
+            __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)
+                    ) type;
+    static const bool value = !is_same<type, __nat>::value;
+};
+
+template <class _Fp, class ..._Args>
+struct __invokable
+    : public integral_constant<bool,
+          __invokable_imp<_Fp, _Args...>::value>
+{
+};
+
+// __invoke_of
+
+template <bool _Invokable, class _Fp, class ..._Args>
+struct __invoke_of_imp  // false
+{
+};
+
+template <class _Fp, class ..._Args>
+struct __invoke_of_imp<true, _Fp, _Args...>
+{
+    typedef typename __invokable_imp<_Fp, _Args...>::type type;
+};
+
+template <class _Fp, class ..._Args>
+struct __invoke_of
+    : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...>
+{
+};
+
+template <class _Fp, class ..._Args>
+class _LIBCPP_TYPE_VIS_ONLY result_of<_Fp(_Args...)>
+    : public __invoke_of<_Fp, _Args...>
+{
+};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using result_of_t = typename result_of<_Tp>::type;
+#endif
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+typename enable_if
+<
+    is_move_constructible<_Tp>::value &&
+    is_move_assignable<_Tp>::value
+>::type
+#else
+void
+#endif
+swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
+                                    is_nothrow_move_assignable<_Tp>::value)
+{
+    _Tp __t(_VSTD::move(__x));
+    __x = _VSTD::move(__y);
+    __y = _VSTD::move(__t);
+}
+
+template <class _ForwardIterator1, class _ForwardIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
+    //                                  _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
+               _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(),
+                                          *_VSTD::declval<_ForwardIterator2>())))
+{
+    swap(*__a, *__b);
+}
+
+// __swappable
+
+namespace __detail
+{
+
+using _VSTD::swap;
+__nat swap(__any, __any);
+
+template <class _Tp>
+struct __swappable
+{
+    typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type;
+    static const bool value = !is_same<type, __nat>::value;
+};
+
+}  // __detail
+
+template <class _Tp>
+struct __is_swappable
+    : public integral_constant<bool, __detail::__swappable<_Tp>::value>
+{
+};
+
+#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
+
+template <bool, class _Tp>
+struct __is_nothrow_swappable_imp
+    : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(),
+                                                   _VSTD::declval<_Tp&>()))>
+{
+};
+
+template <class _Tp>
+struct __is_nothrow_swappable_imp<false, _Tp>
+    : public false_type
+{
+};
+
+template <class _Tp>
+struct __is_nothrow_swappable
+    : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp>
+{
+};
+
+#else  // __has_feature(cxx_noexcept)
+
+template <class _Tp>
+struct __is_nothrow_swappable
+    : public false_type
+{
+};
+
+#endif  // __has_feature(cxx_noexcept)
+
+#ifdef _LIBCPP_UNDERLYING_TYPE
+
+template <class _Tp>
+struct underlying_type
+{
+    typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type;
+};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type;
+#endif
+
+#else  // _LIBCPP_UNDERLYING_TYPE
+
+template <class _Tp, bool _Support = false>
+struct underlying_type
+{
+    static_assert(_Support, "The underyling_type trait requires compiler "
+                            "support. Either no such support exists or "
+                            "libc++ does not know how to use it.");
+};
+
+#endif // _LIBCPP_UNDERLYING_TYPE
+
+
+template <class _Tp, bool = std::is_enum<_Tp>::value>
+struct __sfinae_underlying_type
+{
+    typedef typename underlying_type<_Tp>::type type;
+    typedef decltype(((type)1) + 0) __promoted_type;
+};
+
+template <class _Tp>
+struct __sfinae_underlying_type<_Tp, false> {};
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+int __convert_to_integral(int __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+unsigned __convert_to_integral(unsigned __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+long __convert_to_integral(long __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+unsigned long __convert_to_integral(unsigned long __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+long long __convert_to_integral(long long __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+unsigned long long __convert_to_integral(unsigned long long __val) {return __val; }
+
+#ifndef _LIBCPP_HAS_NO_INT128
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+__int128_t __convert_to_integral(__int128_t __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+__uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
+#endif
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+typename __sfinae_underlying_type<_Tp>::__promoted_type
+__convert_to_integral(_Tp __val) { return __val; }
+
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+
+template <class _Tp>
+struct __has_operator_addressof_member_imp
+{
+    template <class _Up>
+        static auto __test(int)
+            -> typename __select_2nd<decltype(_VSTD::declval<_Up>().operator&()), true_type>::type;
+    template <class>
+        static auto __test(long) -> false_type;
+
+    static const bool value = decltype(__test<_Tp>(0))::value;
+};
+
+template <class _Tp>
+struct __has_operator_addressof_free_imp
+{
+    template <class _Up>
+        static auto __test(int)
+            -> typename __select_2nd<decltype(operator&(_VSTD::declval<_Up>())), true_type>::type;
+    template <class>
+        static auto __test(long) -> false_type;
+
+    static const bool value = decltype(__test<_Tp>(0))::value;
+};
+
+template <class _Tp>
+struct __has_operator_addressof
+    : public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value
+                                  || __has_operator_addressof_free_imp<_Tp>::value>
+{};
+
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+
+#if _LIBCPP_STD_VER > 14
+template <class...> using void_t = void;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_TYPE_TRAITS

Property changes on: lab4/.minix-src/include/c++/type_traits
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/unordered_set
===================================================================
--- lab4/.minix-src/include/c++/unordered_set	(nonexistent)
+++ lab4/.minix-src/include/c++/unordered_set	(revision 13)
@@ -0,0 +1,1379 @@
+// -*- C++ -*-
+//===-------------------------- unordered_set -----------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_UNORDERED_SET
+#define _LIBCPP_UNORDERED_SET
+
+/*
+
+    unordered_set synopsis
+
+#include <initializer_list>
+
+namespace std
+{
+
+template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+          class Alloc = allocator<Value>>
+class unordered_set
+{
+public:
+    // types
+    typedef Value                                                      key_type;
+    typedef key_type                                                   value_type;
+    typedef Hash                                                       hasher;
+    typedef Pred                                                       key_equal;
+    typedef Alloc                                                      allocator_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    typedef typename allocator_traits<allocator_type>::pointer         pointer;
+    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+    typedef typename allocator_traits<allocator_type>::size_type       size_type;
+    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+
+    typedef /unspecified/ iterator;
+    typedef /unspecified/ const_iterator;
+    typedef /unspecified/ local_iterator;
+    typedef /unspecified/ const_local_iterator;
+
+    unordered_set()
+        noexcept(
+            is_nothrow_default_constructible<hasher>::value &&
+            is_nothrow_default_constructible<key_equal>::value &&
+            is_nothrow_default_constructible<allocator_type>::value);
+    explicit unordered_set(size_type n, const hasher& hf = hasher(),
+                           const key_equal& eql = key_equal(),
+                           const allocator_type& a = allocator_type());
+    template <class InputIterator>
+        unordered_set(InputIterator f, InputIterator l,
+                      size_type n = 0, const hasher& hf = hasher(),
+                      const key_equal& eql = key_equal(),
+                      const allocator_type& a = allocator_type());
+    explicit unordered_set(const allocator_type&);
+    unordered_set(const unordered_set&);
+    unordered_set(const unordered_set&, const Allocator&);
+    unordered_set(unordered_set&&)
+        noexcept(
+            is_nothrow_move_constructible<hasher>::value &&
+            is_nothrow_move_constructible<key_equal>::value &&
+            is_nothrow_move_constructible<allocator_type>::value);
+    unordered_set(unordered_set&&, const Allocator&);
+    unordered_set(initializer_list<value_type>, size_type n = 0,
+                  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
+                  const allocator_type& a = allocator_type());
+    unordered_set(size_type n, const allocator_type& a); // C++14
+    unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14
+    template <class InputIterator>
+      unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
+    template <class InputIterator>
+      unordered_set(InputIterator f, InputIterator l, size_type n, 
+                    const hasher& hf,  const allocator_type& a); // C++14
+    unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
+    unordered_set(initializer_list<value_type> il, size_type n,
+                  const hasher& hf,  const allocator_type& a); // C++14
+    ~unordered_set();
+    unordered_set& operator=(const unordered_set&);
+    unordered_set& operator=(unordered_set&&)
+        noexcept(
+            allocator_type::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<allocator_type>::value &&
+            is_nothrow_move_assignable<hasher>::value &&
+            is_nothrow_move_assignable<key_equal>::value);
+    unordered_set& operator=(initializer_list<value_type>);
+
+    allocator_type get_allocator() const noexcept;
+
+    bool      empty() const noexcept;
+    size_type size() const noexcept;
+    size_type max_size() const noexcept;
+
+    iterator       begin() noexcept;
+    iterator       end() noexcept;
+    const_iterator begin()  const noexcept;
+    const_iterator end()    const noexcept;
+    const_iterator cbegin() const noexcept;
+    const_iterator cend()   const noexcept;
+
+    template <class... Args>
+        pair<iterator, bool> emplace(Args&&... args);
+    template <class... Args>
+        iterator emplace_hint(const_iterator position, Args&&... args);
+    pair<iterator, bool> insert(const value_type& obj);
+    pair<iterator, bool> insert(value_type&& obj);
+    iterator insert(const_iterator hint, const value_type& obj);
+    iterator insert(const_iterator hint, value_type&& obj);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+    void insert(initializer_list<value_type>);
+
+    iterator erase(const_iterator position);
+    iterator erase(iterator position);  // C++14
+    size_type erase(const key_type& k);
+    iterator erase(const_iterator first, const_iterator last);
+    void clear() noexcept;
+
+    void swap(unordered_set&)
+       noexcept(allocator_traits<Allocator>::is_always_equal::value &&
+                 noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&
+                 noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17
+
+    hasher hash_function() const;
+    key_equal key_eq() const;
+
+    iterator       find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    size_type count(const key_type& k) const;
+    pair<iterator, iterator>             equal_range(const key_type& k);
+    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
+
+    size_type bucket_count() const noexcept;
+    size_type max_bucket_count() const noexcept;
+
+    size_type bucket_size(size_type n) const;
+    size_type bucket(const key_type& k) const;
+
+    local_iterator       begin(size_type n);
+    local_iterator       end(size_type n);
+    const_local_iterator begin(size_type n) const;
+    const_local_iterator end(size_type n) const;
+    const_local_iterator cbegin(size_type n) const;
+    const_local_iterator cend(size_type n) const;
+
+    float load_factor() const noexcept;
+    float max_load_factor() const noexcept;
+    void max_load_factor(float z);
+    void rehash(size_type n);
+    void reserve(size_type n);
+};
+
+template <class Value, class Hash, class Pred, class Alloc>
+    void swap(unordered_set<Value, Hash, Pred, Alloc>& x,
+              unordered_set<Value, Hash, Pred, Alloc>& y)
+              noexcept(noexcept(x.swap(y)));
+
+template <class Value, class Hash, class Pred, class Alloc>
+    bool
+    operator==(const unordered_set<Value, Hash, Pred, Alloc>& x,
+               const unordered_set<Value, Hash, Pred, Alloc>& y);
+
+template <class Value, class Hash, class Pred, class Alloc>
+    bool
+    operator!=(const unordered_set<Value, Hash, Pred, Alloc>& x,
+               const unordered_set<Value, Hash, Pred, Alloc>& y);
+
+template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+          class Alloc = allocator<Value>>
+class unordered_multiset
+{
+public:
+    // types
+    typedef Value                                                      key_type;
+    typedef key_type                                                   value_type;
+    typedef Hash                                                       hasher;
+    typedef Pred                                                       key_equal;
+    typedef Alloc                                                      allocator_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    typedef typename allocator_traits<allocator_type>::pointer         pointer;
+    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+    typedef typename allocator_traits<allocator_type>::size_type       size_type;
+    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+
+    typedef /unspecified/ iterator;
+    typedef /unspecified/ const_iterator;
+    typedef /unspecified/ local_iterator;
+    typedef /unspecified/ const_local_iterator;
+
+    unordered_multiset()
+        noexcept(
+            is_nothrow_default_constructible<hasher>::value &&
+            is_nothrow_default_constructible<key_equal>::value &&
+            is_nothrow_default_constructible<allocator_type>::value);
+    explicit unordered_multiset(size_type n, const hasher& hf = hasher(),
+                           const key_equal& eql = key_equal(),
+                           const allocator_type& a = allocator_type());
+    template <class InputIterator>
+        unordered_multiset(InputIterator f, InputIterator l,
+                      size_type n = 0, const hasher& hf = hasher(),
+                      const key_equal& eql = key_equal(),
+                      const allocator_type& a = allocator_type());
+    explicit unordered_multiset(const allocator_type&);
+    unordered_multiset(const unordered_multiset&);
+    unordered_multiset(const unordered_multiset&, const Allocator&);
+    unordered_multiset(unordered_multiset&&)
+        noexcept(
+            is_nothrow_move_constructible<hasher>::value &&
+            is_nothrow_move_constructible<key_equal>::value &&
+            is_nothrow_move_constructible<allocator_type>::value);
+    unordered_multiset(unordered_multiset&&, const Allocator&);
+    unordered_multiset(initializer_list<value_type>, size_type n = /see below/,
+                  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
+                  const allocator_type& a = allocator_type());
+    unordered_multiset(size_type n, const allocator_type& a); // C++14
+    unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14
+    template <class InputIterator>
+      unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
+    template <class InputIterator>
+      unordered_multiset(InputIterator f, InputIterator l, size_type n,
+                         const hasher& hf, const allocator_type& a); // C++14
+    unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
+    unordered_multiset(initializer_list<value_type> il, size_type n, 
+                       const hasher& hf,  const allocator_type& a); // C++14
+    ~unordered_multiset();
+    unordered_multiset& operator=(const unordered_multiset&);
+    unordered_multiset& operator=(unordered_multiset&&)
+        noexcept(
+            allocator_type::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<allocator_type>::value &&
+            is_nothrow_move_assignable<hasher>::value &&
+            is_nothrow_move_assignable<key_equal>::value);
+    unordered_multiset& operator=(initializer_list<value_type>);
+
+    allocator_type get_allocator() const noexcept;
+
+    bool      empty() const noexcept;
+    size_type size() const noexcept;
+    size_type max_size() const noexcept;
+
+    iterator       begin() noexcept;
+    iterator       end() noexcept;
+    const_iterator begin()  const noexcept;
+    const_iterator end()    const noexcept;
+    const_iterator cbegin() const noexcept;
+    const_iterator cend()   const noexcept;
+
+    template <class... Args>
+        iterator emplace(Args&&... args);
+    template <class... Args>
+        iterator emplace_hint(const_iterator position, Args&&... args);
+    iterator insert(const value_type& obj);
+    iterator insert(value_type&& obj);
+    iterator insert(const_iterator hint, const value_type& obj);
+    iterator insert(const_iterator hint, value_type&& obj);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+    void insert(initializer_list<value_type>);
+
+    iterator erase(const_iterator position);
+    iterator erase(iterator position);  // C++14
+    size_type erase(const key_type& k);
+    iterator erase(const_iterator first, const_iterator last);
+    void clear() noexcept;
+
+    void swap(unordered_multiset&)
+       noexcept(allocator_traits<Allocator>::is_always_equal::value &&
+                 noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&
+                 noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17
+
+    hasher hash_function() const;
+    key_equal key_eq() const;
+
+    iterator       find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    size_type count(const key_type& k) const;
+    pair<iterator, iterator>             equal_range(const key_type& k);
+    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
+
+    size_type bucket_count() const noexcept;
+    size_type max_bucket_count() const noexcept;
+
+    size_type bucket_size(size_type n) const;
+    size_type bucket(const key_type& k) const;
+
+    local_iterator       begin(size_type n);
+    local_iterator       end(size_type n);
+    const_local_iterator begin(size_type n) const;
+    const_local_iterator end(size_type n) const;
+    const_local_iterator cbegin(size_type n) const;
+    const_local_iterator cend(size_type n) const;
+
+    float load_factor() const noexcept;
+    float max_load_factor() const noexcept;
+    void max_load_factor(float z);
+    void rehash(size_type n);
+    void reserve(size_type n);
+};
+
+template <class Value, class Hash, class Pred, class Alloc>
+    void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x,
+              unordered_multiset<Value, Hash, Pred, Alloc>& y)
+              noexcept(noexcept(x.swap(y)));
+
+template <class Value, class Hash, class Pred, class Alloc>
+    bool
+    operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
+               const unordered_multiset<Value, Hash, Pred, Alloc>& y);
+
+template <class Value, class Hash, class Pred, class Alloc>
+    bool
+    operator!=(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
+               const unordered_multiset<Value, Hash, Pred, Alloc>& y);
+}  // std
+
+*/
+
+#include <__config>
+#include <__hash_table>
+#include <functional>
+
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
+          class _Alloc = allocator<_Value> >
+class _LIBCPP_TYPE_VIS_ONLY unordered_set
+{
+public:
+    // types
+    typedef _Value                                                     key_type;
+    typedef key_type                                                   value_type;
+    typedef _Hash                                                      hasher;
+    typedef _Pred                                                      key_equal;
+    typedef _Alloc                                                     allocator_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+                  "Invalid allocator::value_type");
+
+private:
+    typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
+
+    __table __table_;
+
+public:
+    typedef typename __table::pointer         pointer;
+    typedef typename __table::const_pointer   const_pointer;
+    typedef typename __table::size_type       size_type;
+    typedef typename __table::difference_type difference_type;
+
+    typedef typename __table::const_iterator       iterator;
+    typedef typename __table::const_iterator       const_iterator;
+    typedef typename __table::const_local_iterator local_iterator;
+    typedef typename __table::const_local_iterator const_local_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_set()
+        _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            __get_db()->__insert_c(this);
+#endif
+        }
+    explicit unordered_set(size_type __n, const hasher& __hf = hasher(),
+                           const key_equal& __eql = key_equal());
+#if _LIBCPP_STD_VER > 11
+    inline _LIBCPP_INLINE_VISIBILITY
+    unordered_set(size_type __n, const allocator_type& __a)
+        : unordered_set(__n, hasher(), key_equal(), __a) {}
+    inline _LIBCPP_INLINE_VISIBILITY
+    unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a)
+        : unordered_set(__n, __hf, key_equal(), __a) {}
+#endif
+    unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql,
+                  const allocator_type& __a);
+    template <class _InputIterator>
+        unordered_set(_InputIterator __first, _InputIterator __last);
+    template <class _InputIterator>
+        unordered_set(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf = hasher(),
+                      const key_equal& __eql = key_equal());
+    template <class _InputIterator>
+        unordered_set(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf, const key_equal& __eql,
+                      const allocator_type& __a);
+#if _LIBCPP_STD_VER > 11
+    template <class _InputIterator>
+    inline _LIBCPP_INLINE_VISIBILITY
+        unordered_set(_InputIterator __first, _InputIterator __last, 
+                    size_type __n, const allocator_type& __a)
+            : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}
+    template <class _InputIterator>
+        unordered_set(_InputIterator __first, _InputIterator __last, 
+                      size_type __n, const hasher& __hf, const allocator_type& __a)
+            : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
+#endif
+    explicit unordered_set(const allocator_type& __a);
+    unordered_set(const unordered_set& __u);
+    unordered_set(const unordered_set& __u, const allocator_type& __a);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    unordered_set(unordered_set&& __u)
+        _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+    unordered_set(unordered_set&& __u, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    unordered_set(initializer_list<value_type> __il);
+    unordered_set(initializer_list<value_type> __il, size_type __n,
+                  const hasher& __hf = hasher(),
+                  const key_equal& __eql = key_equal());
+    unordered_set(initializer_list<value_type> __il, size_type __n,
+                  const hasher& __hf, const key_equal& __eql,
+                  const allocator_type& __a);
+#if _LIBCPP_STD_VER > 11
+    inline _LIBCPP_INLINE_VISIBILITY
+    unordered_set(initializer_list<value_type> __il, size_type __n,
+                                                      const allocator_type& __a)
+        : unordered_set(__il, __n, hasher(), key_equal(), __a) {}
+    inline _LIBCPP_INLINE_VISIBILITY
+    unordered_set(initializer_list<value_type> __il, size_type __n, 
+                                  const hasher& __hf, const allocator_type& __a)
+        : unordered_set(__il, __n, __hf, key_equal(), __a) {}
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    // ~unordered_set() = default;
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_set& operator=(const unordered_set& __u)
+    {
+        __table_ = __u.__table_;
+        return *this;
+    }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    unordered_set& operator=(unordered_set&& __u)
+        _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+#endif
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    unordered_set& operator=(initializer_list<value_type> __il);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT
+        {return allocator_type(__table_.__node_alloc());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool      empty() const _NOEXCEPT {return __table_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT  {return __table_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT {return __table_.max_size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       begin() _NOEXCEPT        {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       end() _NOEXCEPT          {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin()  const _NOEXCEPT {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()    const _NOEXCEPT {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend()   const _NOEXCEPT {return __table_.end();}
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> emplace(_Args&&... __args)
+            {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        iterator emplace_hint(const_iterator __p, _Args&&... __args)
+        {
+            _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+                "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not"
+                " referring to this unordered_set");
+            return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;
+        }
+#else
+        iterator emplace_hint(const_iterator, _Args&&... __args)
+            {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;}
+#endif
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, bool> insert(const value_type& __x)
+        {return __table_.__insert_unique(__x);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, bool> insert(value_type&& __x)
+        {return __table_.__insert_unique(_VSTD::move(__x));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    iterator insert(const_iterator __p, const value_type& __x)
+        {
+            _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+                "unordered_set::insert(const_iterator, const value_type&) called with an iterator not"
+                " referring to this unordered_set");
+            return insert(__x).first;
+        }
+#else
+    iterator insert(const_iterator, const value_type& __x)
+        {return insert(__x).first;}
+#endif
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    iterator insert(const_iterator __p, value_type&& __x)
+        {
+            _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+                "unordered_set::insert(const_iterator, value_type&&) called with an iterator not"
+                " referring to this unordered_set");
+            return insert(_VSTD::move(__x)).first;
+        }
+#else
+    iterator insert(const_iterator, value_type&& __x)
+        {return insert(_VSTD::move(__x)).first;}
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _InputIterator>
+        void insert(_InputIterator __first, _InputIterator __last);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    void insert(initializer_list<value_type> __il)
+        {insert(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(const_iterator __p) {return __table_.erase(__p);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(const_iterator __first, const_iterator __last)
+        {return __table_.erase(__first, __last);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {__table_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(unordered_set& __u)
+        _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
+        {__table_.swap(__u.__table_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    hasher hash_function() const {return __table_.hash_function();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_equal key_eq() const {return __table_.key_eq();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       find(const key_type& __k)       {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, iterator>             equal_range(const key_type& __k)
+        {return __table_.__equal_range_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+        {return __table_.__equal_range_unique(__k);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    local_iterator       begin(size_type __n)        {return __table_.begin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    local_iterator       end(size_type __n)          {return __table_.end(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator begin(size_type __n) const  {return __table_.cbegin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator end(size_type __n) const    {return __table_.cend(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator cend(size_type __n) const   {return __table_.cend(__n);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    float load_factor() const _NOEXCEPT {return __table_.load_factor();}
+    _LIBCPP_INLINE_VISIBILITY
+    float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
+    _LIBCPP_INLINE_VISIBILITY
+    void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
+    _LIBCPP_INLINE_VISIBILITY
+    void rehash(size_type __n) {__table_.rehash(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    void reserve(size_type __n) {__table_.reserve(__n);}
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    bool __dereferenceable(const const_iterator* __i) const
+        {return __table_.__dereferenceable(__i);}
+    bool __decrementable(const const_iterator* __i) const
+        {return __table_.__decrementable(__i);}
+    bool __addable(const const_iterator* __i, ptrdiff_t __n) const
+        {return __table_.__addable(__i, __n);}
+    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
+        {return __table_.__addable(__i, __n);}
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+};
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
+        const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
+        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        _InputIterator __first, _InputIterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        const allocator_type& __a)
+    : __table_(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        const unordered_set& __u)
+    : __table_(__u.__table_)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        const unordered_set& __u, const allocator_type& __a)
+    : __table_(__u.__table_, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        unordered_set&& __u)
+    _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
+    : __table_(_VSTD::move(__u.__table_))
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+    __get_db()->swap(this, &__u);
+#endif
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        unordered_set&& __u, const allocator_type& __a)
+    : __table_(_VSTD::move(__u.__table_), __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__a != __u.get_allocator())
+    {
+        iterator __i = __u.begin();
+        while (__u.size() != 0)
+            __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_));
+    }
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    else
+        __get_db()->swap(this, &__u);
+#endif
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        initializer_list<value_type> __il)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    insert(__il.begin(), __il.end());
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
+        const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__il.begin(), __il.end());
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
+        const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__il.begin(), __il.end());
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_set<_Value, _Hash, _Pred, _Alloc>&
+unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
+    _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
+{
+    __table_ = _VSTD::move(__u.__table_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_set<_Value, _Hash, _Pred, _Alloc>&
+unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
+        initializer_list<value_type> __il)
+{
+    __table_.__assign_unique(__il.begin(), __il.end());
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
+                                                    _InputIterator __last)
+{
+    for (; __first != __last; ++__first)
+        __table_.__insert_unique(*__first);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+     unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+bool
+operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+           const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+{
+    if (__x.size() != __y.size())
+        return false;
+    typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
+                                                                 const_iterator;
+    for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
+            __i != __ex; ++__i)
+    {
+        const_iterator __j = __y.find(*__i);
+        if (__j == __ey || !(*__i == *__j))
+            return false;
+    }
+    return true;
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+           const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
+          class _Alloc = allocator<_Value> >
+class _LIBCPP_TYPE_VIS_ONLY unordered_multiset
+{
+public:
+    // types
+    typedef _Value                                                     key_type;
+    typedef key_type                                                   value_type;
+    typedef _Hash                                                      hasher;
+    typedef _Pred                                                      key_equal;
+    typedef _Alloc                                                     allocator_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+                  "Invalid allocator::value_type");
+
+private:
+    typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
+
+    __table __table_;
+
+public:
+    typedef typename __table::pointer         pointer;
+    typedef typename __table::const_pointer   const_pointer;
+    typedef typename __table::size_type       size_type;
+    typedef typename __table::difference_type difference_type;
+
+    typedef typename __table::const_iterator       iterator;
+    typedef typename __table::const_iterator       const_iterator;
+    typedef typename __table::const_local_iterator local_iterator;
+    typedef typename __table::const_local_iterator const_local_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_multiset()
+        _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            __get_db()->__insert_c(this);
+#endif
+        }
+    explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(),
+                                const key_equal& __eql = key_equal());
+    unordered_multiset(size_type __n, const hasher& __hf,
+                       const key_equal& __eql, const allocator_type& __a);
+#if _LIBCPP_STD_VER > 11
+    inline _LIBCPP_INLINE_VISIBILITY
+    unordered_multiset(size_type __n, const allocator_type& __a)
+        : unordered_multiset(__n, hasher(), key_equal(), __a) {}
+    inline _LIBCPP_INLINE_VISIBILITY
+    unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a)
+        : unordered_multiset(__n, __hf, key_equal(), __a) {}
+#endif
+    template <class _InputIterator>
+        unordered_multiset(_InputIterator __first, _InputIterator __last);
+    template <class _InputIterator>
+        unordered_multiset(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf = hasher(),
+                      const key_equal& __eql = key_equal());
+    template <class _InputIterator>
+        unordered_multiset(_InputIterator __first, _InputIterator __last,
+                      size_type __n , const hasher& __hf,
+                      const key_equal& __eql, const allocator_type& __a);
+#if _LIBCPP_STD_VER > 11
+    template <class _InputIterator>
+    inline _LIBCPP_INLINE_VISIBILITY
+    unordered_multiset(_InputIterator __first, _InputIterator __last, 
+                       size_type __n, const allocator_type& __a)
+        : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}
+    template <class _InputIterator>
+    inline _LIBCPP_INLINE_VISIBILITY
+    unordered_multiset(_InputIterator __first, _InputIterator __last,
+                       size_type __n, const hasher& __hf, const allocator_type& __a)
+        : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {}
+#endif
+    explicit unordered_multiset(const allocator_type& __a);
+    unordered_multiset(const unordered_multiset& __u);
+    unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    unordered_multiset(unordered_multiset&& __u)
+        _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+    unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    unordered_multiset(initializer_list<value_type> __il);
+    unordered_multiset(initializer_list<value_type> __il, size_type __n,
+                       const hasher& __hf = hasher(),
+                       const key_equal& __eql = key_equal());
+    unordered_multiset(initializer_list<value_type> __il, size_type __n,
+                       const hasher& __hf, const key_equal& __eql,
+                       const allocator_type& __a);
+#if _LIBCPP_STD_VER > 11
+    inline _LIBCPP_INLINE_VISIBILITY
+    unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+      : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {}
+    inline _LIBCPP_INLINE_VISIBILITY
+    unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
+      : unordered_multiset(__il, __n, __hf, key_equal(), __a) {}
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    // ~unordered_multiset() = default;
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_multiset& operator=(const unordered_multiset& __u)
+    {
+        __table_ = __u.__table_;
+        return *this;
+    }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    unordered_multiset& operator=(unordered_multiset&& __u)
+        _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+#endif
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    unordered_multiset& operator=(initializer_list<value_type> __il);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT
+        {return allocator_type(__table_.__node_alloc());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool      empty() const _NOEXCEPT {return __table_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT  {return __table_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT {return __table_.max_size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       begin() _NOEXCEPT        {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       end() _NOEXCEPT          {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin()  const _NOEXCEPT {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()    const _NOEXCEPT {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend()   const _NOEXCEPT {return __table_.end();}
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator emplace(_Args&&... __args)
+            {return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator emplace_hint(const_iterator __p, _Args&&... __args)
+            {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));}
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __p, const value_type& __x)
+        {return __table_.__insert_multi(__p, __x);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __p, value_type&& __x)
+        {return __table_.__insert_multi(__p, _VSTD::move(__x));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _InputIterator>
+        void insert(_InputIterator __first, _InputIterator __last);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    void insert(initializer_list<value_type> __il)
+        {insert(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(const_iterator __p) {return __table_.erase(__p);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(const_iterator __first, const_iterator __last)
+        {return __table_.erase(__first, __last);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {__table_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(unordered_multiset& __u)
+        _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
+        {__table_.swap(__u.__table_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    hasher hash_function() const {return __table_.hash_function();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_equal key_eq() const {return __table_.key_eq();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       find(const key_type& __k)       {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, iterator>             equal_range(const key_type& __k)
+        {return __table_.__equal_range_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+        {return __table_.__equal_range_multi(__k);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    local_iterator       begin(size_type __n)        {return __table_.begin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    local_iterator       end(size_type __n)          {return __table_.end(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator begin(size_type __n) const  {return __table_.cbegin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator end(size_type __n) const    {return __table_.cend(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator cend(size_type __n) const   {return __table_.cend(__n);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    float load_factor() const _NOEXCEPT {return __table_.load_factor();}
+    _LIBCPP_INLINE_VISIBILITY
+    float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
+    _LIBCPP_INLINE_VISIBILITY
+    void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
+    _LIBCPP_INLINE_VISIBILITY
+    void rehash(size_type __n) {__table_.rehash(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    void reserve(size_type __n) {__table_.reserve(__n);}
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    bool __dereferenceable(const const_iterator* __i) const
+        {return __table_.__dereferenceable(__i);}
+    bool __decrementable(const const_iterator* __i) const
+        {return __table_.__decrementable(__i);}
+    bool __addable(const const_iterator* __i, ptrdiff_t __n) const
+        {return __table_.__addable(__i, __n);}
+    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
+        {return __table_.__addable(__i, __n);}
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+};
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        size_type __n, const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        size_type __n, const hasher& __hf, const key_equal& __eql,
+        const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        _InputIterator __first, _InputIterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        const allocator_type& __a)
+    : __table_(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        const unordered_multiset& __u)
+    : __table_(__u.__table_)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        const unordered_multiset& __u, const allocator_type& __a)
+    : __table_(__u.__table_, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        unordered_multiset&& __u)
+    _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
+    : __table_(_VSTD::move(__u.__table_))
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+    __get_db()->swap(this, &__u);
+#endif
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        unordered_multiset&& __u, const allocator_type& __a)
+    : __table_(_VSTD::move(__u.__table_), __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__a != __u.get_allocator())
+    {
+        iterator __i = __u.begin();
+        while (__u.size() != 0)
+            __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_));
+    }
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    else
+        __get_db()->swap(this, &__u);
+#endif
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        initializer_list<value_type> __il)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    insert(__il.begin(), __il.end());
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
+        const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__il.begin(), __il.end());
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
+        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
+        const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__il.begin(), __il.end());
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
+        unordered_multiset&& __u)
+    _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
+{
+    __table_ = _VSTD::move(__u.__table_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
+        initializer_list<value_type> __il)
+{
+    __table_.__assign_multi(__il.begin(), __il.end());
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
+                                                         _InputIterator __last)
+{
+    for (; __first != __last; ++__first)
+        __table_.__insert_multi(*__first);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+     unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+bool
+operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+           const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+{
+    if (__x.size() != __y.size())
+        return false;
+    typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
+                                                                 const_iterator;
+    typedef pair<const_iterator, const_iterator> _EqRng;
+    for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
+    {
+        _EqRng __xeq = __x.equal_range(*__i);
+        _EqRng __yeq = __y.equal_range(*__i);
+        if (_VSTD::distance(__xeq.first, __xeq.second) !=
+            _VSTD::distance(__yeq.first, __yeq.second) ||
+                  !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+            return false;
+        __i = __xeq.second;
+    }
+    return true;
+}
+
+template <class _Value, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+           const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+{
+    return !(__x == __y);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_UNORDERED_SET

Property changes on: lab4/.minix-src/include/c++/unordered_set
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/forward_list
===================================================================
--- lab4/.minix-src/include/c++/forward_list	(nonexistent)
+++ lab4/.minix-src/include/c++/forward_list	(revision 13)
@@ -0,0 +1,1649 @@
+// -*- C++ -*-
+//===----------------------- forward_list ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_FORWARD_LIST
+#define _LIBCPP_FORWARD_LIST
+
+/*
+    forward_list synopsis
+
+namespace std
+{
+
+template <class T, class Allocator = allocator<T>>
+class forward_list
+{
+public:
+    typedef T         value_type;
+    typedef Allocator allocator_type;
+
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    typedef typename allocator_traits<allocator_type>::pointer         pointer;
+    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+    typedef typename allocator_traits<allocator_type>::size_type       size_type;
+    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+
+    typedef <details> iterator;
+    typedef <details> const_iterator;
+
+    forward_list()
+        noexcept(is_nothrow_default_constructible<allocator_type>::value);
+    explicit forward_list(const allocator_type& a);
+    explicit forward_list(size_type n);
+    explicit forward_list(size_type n, const allocator_type& a); // C++14
+    forward_list(size_type n, const value_type& v);
+    forward_list(size_type n, const value_type& v, const allocator_type& a);
+    template <class InputIterator>
+        forward_list(InputIterator first, InputIterator last);
+    template <class InputIterator>
+        forward_list(InputIterator first, InputIterator last, const allocator_type& a);
+    forward_list(const forward_list& x);
+    forward_list(const forward_list& x, const allocator_type& a);
+    forward_list(forward_list&& x)
+        noexcept(is_nothrow_move_constructible<allocator_type>::value);
+    forward_list(forward_list&& x, const allocator_type& a);
+    forward_list(initializer_list<value_type> il);
+    forward_list(initializer_list<value_type> il, const allocator_type& a);
+
+    ~forward_list();
+
+    forward_list& operator=(const forward_list& x);
+    forward_list& operator=(forward_list&& x)
+        noexcept(
+             allocator_type::propagate_on_container_move_assignment::value &&
+             is_nothrow_move_assignable<allocator_type>::value);
+    forward_list& operator=(initializer_list<value_type> il);
+
+    template <class InputIterator>
+        void assign(InputIterator first, InputIterator last);
+    void assign(size_type n, const value_type& v);
+    void assign(initializer_list<value_type> il);
+
+    allocator_type get_allocator() const noexcept;
+
+    iterator       begin() noexcept;
+    const_iterator begin() const noexcept;
+    iterator       end() noexcept;
+    const_iterator end() const noexcept;
+
+    const_iterator cbegin() const noexcept;
+    const_iterator cend() const noexcept;
+
+    iterator       before_begin() noexcept;
+    const_iterator before_begin() const noexcept;
+    const_iterator cbefore_begin() const noexcept;
+
+    bool empty() const noexcept;
+    size_type max_size() const noexcept;
+
+    reference       front();
+    const_reference front() const;
+
+    template <class... Args> void emplace_front(Args&&... args);
+    void push_front(const value_type& v);
+    void push_front(value_type&& v);
+
+    void pop_front();
+
+    template <class... Args>
+        iterator emplace_after(const_iterator p, Args&&... args);
+    iterator insert_after(const_iterator p, const value_type& v);
+    iterator insert_after(const_iterator p, value_type&& v);
+    iterator insert_after(const_iterator p, size_type n, const value_type& v);
+    template <class InputIterator>
+        iterator insert_after(const_iterator p,
+                              InputIterator first, InputIterator last);
+    iterator insert_after(const_iterator p, initializer_list<value_type> il);
+
+    iterator erase_after(const_iterator p);
+    iterator erase_after(const_iterator first, const_iterator last);
+
+    void swap(forward_list& x)
+        noexcept(allocator_traits<allocator_type>::is_always_equal::value);  // C++17
+
+    void resize(size_type n);
+    void resize(size_type n, const value_type& v);
+    void clear() noexcept;
+
+    void splice_after(const_iterator p, forward_list& x);
+    void splice_after(const_iterator p, forward_list&& x);
+    void splice_after(const_iterator p, forward_list& x, const_iterator i);
+    void splice_after(const_iterator p, forward_list&& x, const_iterator i);
+    void splice_after(const_iterator p, forward_list& x,
+                      const_iterator first, const_iterator last);
+    void splice_after(const_iterator p, forward_list&& x,
+                      const_iterator first, const_iterator last);
+    void remove(const value_type& v);
+    template <class Predicate> void remove_if(Predicate pred);
+    void unique();
+    template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);
+    void merge(forward_list& x);
+    void merge(forward_list&& x);
+    template <class Compare> void merge(forward_list& x, Compare comp);
+    template <class Compare> void merge(forward_list&& x, Compare comp);
+    void sort();
+    template <class Compare> void sort(Compare comp);
+    void reverse() noexcept;
+};
+
+template <class T, class Allocator>
+    bool operator==(const forward_list<T, Allocator>& x,
+                    const forward_list<T, Allocator>& y);
+
+template <class T, class Allocator>
+    bool operator< (const forward_list<T, Allocator>& x,
+                    const forward_list<T, Allocator>& y);
+
+template <class T, class Allocator>
+    bool operator!=(const forward_list<T, Allocator>& x,
+                    const forward_list<T, Allocator>& y);
+
+template <class T, class Allocator>
+    bool operator> (const forward_list<T, Allocator>& x,
+                    const forward_list<T, Allocator>& y);
+
+template <class T, class Allocator>
+    bool operator>=(const forward_list<T, Allocator>& x,
+                    const forward_list<T, Allocator>& y);
+
+template <class T, class Allocator>
+    bool operator<=(const forward_list<T, Allocator>& x,
+                    const forward_list<T, Allocator>& y);
+
+template <class T, class Allocator>
+    void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y)
+         noexcept(noexcept(x.swap(y)));
+
+}  // std
+
+*/
+
+#include <__config>
+
+#include <initializer_list>
+#include <memory>
+#include <limits>
+#include <iterator>
+#include <algorithm>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, class _VoidPtr> struct __forward_list_node;
+
+template <class _NodePtr>
+struct __forward_begin_node
+{
+    typedef _NodePtr pointer;
+
+    pointer __next_;
+
+     _LIBCPP_INLINE_VISIBILITY __forward_begin_node() : __next_(nullptr) {}
+};
+
+template <class _Tp, class _VoidPtr>
+struct _LIBCPP_HIDDEN __begin_node_of
+{
+    typedef __forward_begin_node
+        <
+             typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+                 rebind<__forward_list_node<_Tp, _VoidPtr> >
+#else
+                 rebind<__forward_list_node<_Tp, _VoidPtr> >::other
+#endif
+         > type;
+};
+
+template <class _Tp, class _VoidPtr>
+struct __forward_list_node
+    : public __begin_node_of<_Tp, _VoidPtr>::type
+{
+    typedef _Tp value_type;
+
+    value_type __value_;
+};
+
+template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TYPE_VIS_ONLY forward_list;
+template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
+
+template <class _NodePtr>
+class _LIBCPP_TYPE_VIS_ONLY __forward_list_iterator
+{
+    typedef _NodePtr __node_pointer;
+
+    __node_pointer __ptr_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+
+    template<class, class> friend class _LIBCPP_TYPE_VIS_ONLY forward_list;
+    template<class> friend class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
+
+public:
+    typedef forward_iterator_tag                              iterator_category;
+    typedef typename pointer_traits<__node_pointer>::element_type::value_type
+                                                              value_type;
+    typedef value_type&                                       reference;
+    typedef typename pointer_traits<__node_pointer>::difference_type
+                                                              difference_type;
+    typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<value_type>
+#else
+            rebind<value_type>::other
+#endif
+                                                              pointer;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference operator*() const {return __ptr_->__value_;}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __forward_list_iterator& operator++()
+    {
+        __ptr_ = __ptr_->__next_;
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __forward_list_iterator operator++(int)
+    {
+        __forward_list_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __forward_list_iterator& __x,
+                    const __forward_list_iterator& __y)
+        {return __x.__ptr_ == __y.__ptr_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const __forward_list_iterator& __x,
+                    const __forward_list_iterator& __y)
+        {return !(__x == __y);}
+};
+
+template <class _NodeConstPtr>
+class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator
+{
+    typedef _NodeConstPtr __node_const_pointer;
+
+    __node_const_pointer __ptr_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __forward_list_const_iterator(__node_const_pointer __p) _NOEXCEPT
+        : __ptr_(__p) {}
+
+    typedef typename remove_const
+        <
+            typename pointer_traits<__node_const_pointer>::element_type
+        >::type                                               __node;
+    typedef typename pointer_traits<__node_const_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<__node>
+#else
+            rebind<__node>::other
+#endif
+                                                              __node_pointer;
+
+    template<class, class> friend class forward_list;
+
+public:
+    typedef forward_iterator_tag                              iterator_category;
+    typedef typename __node::value_type                       value_type;
+    typedef const value_type&                                 reference;
+    typedef typename pointer_traits<__node_const_pointer>::difference_type
+                                                              difference_type;
+    typedef typename pointer_traits<__node_const_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<const value_type>
+#else
+            rebind<const value_type>::other
+#endif
+                                                              pointer;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
+    _LIBCPP_INLINE_VISIBILITY
+    __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT
+        : __ptr_(__p.__ptr_) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference operator*() const {return __ptr_->__value_;}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __forward_list_const_iterator& operator++()
+    {
+        __ptr_ = __ptr_->__next_;
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __forward_list_const_iterator operator++(int)
+    {
+        __forward_list_const_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __forward_list_const_iterator& __x,
+                    const __forward_list_const_iterator& __y)
+        {return __x.__ptr_ == __y.__ptr_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const __forward_list_const_iterator& __x,
+                           const __forward_list_const_iterator& __y)
+        {return !(__x == __y);}
+};
+
+template <class _Tp, class _Alloc>
+class __forward_list_base
+{
+protected:
+    typedef _Tp    value_type;
+    typedef _Alloc allocator_type;
+
+    typedef typename allocator_traits<allocator_type>::void_pointer  void_pointer;
+    typedef __forward_list_node<value_type, void_pointer>            __node;
+    typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node;
+    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __node>::type __node_allocator;
+    typedef allocator_traits<__node_allocator>        __node_traits;
+    typedef typename __node_traits::pointer           __node_pointer;
+    typedef typename __node_traits::pointer           __node_const_pointer;
+
+    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __begin_node>::type __begin_node_allocator;
+    typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer;
+
+    __compressed_pair<__begin_node, __node_allocator> __before_begin_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __node_pointer        __before_begin() _NOEXCEPT
+        {return static_cast<__node_pointer>(pointer_traits<__begin_node_pointer>::
+                                        pointer_to(__before_begin_.first()));}
+    _LIBCPP_INLINE_VISIBILITY
+    __node_const_pointer  __before_begin() const _NOEXCEPT
+        {return static_cast<__node_const_pointer>(pointer_traits<__begin_node_pointer>::
+                                        pointer_to(const_cast<__begin_node&>(__before_begin_.first())));}
+
+    _LIBCPP_INLINE_VISIBILITY
+          __node_allocator& __alloc() _NOEXCEPT
+            {return __before_begin_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const __node_allocator& __alloc() const _NOEXCEPT
+        {return __before_begin_.second();}
+
+    typedef __forward_list_iterator<__node_pointer>             iterator;
+    typedef __forward_list_const_iterator<__node_pointer>       const_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __forward_list_base()
+        _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
+        : __before_begin_(__begin_node()) {}
+    _LIBCPP_INLINE_VISIBILITY
+    __forward_list_base(const allocator_type& __a)
+        : __before_begin_(__begin_node(), __node_allocator(__a)) {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+public:
+    __forward_list_base(__forward_list_base&& __x)
+        _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
+    __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+private:
+    __forward_list_base(const __forward_list_base&);
+    __forward_list_base& operator=(const __forward_list_base&);
+
+public:
+    ~__forward_list_base();
+
+protected:
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __forward_list_base& __x)
+        {__copy_assign_alloc(__x, integral_constant<bool,
+              __node_traits::propagate_on_container_copy_assignment::value>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__forward_list_base& __x)
+        _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
+                   is_nothrow_move_assignable<__node_allocator>::value)
+        {__move_assign_alloc(__x, integral_constant<bool,
+              __node_traits::propagate_on_container_move_assignment::value>());}
+
+public:
+    void swap(__forward_list_base& __x)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT;
+#else
+        _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value || 
+                    __is_nothrow_swappable<__node_allocator>::value);
+#endif
+protected:
+    void clear() _NOEXCEPT;
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __forward_list_base&, false_type) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __forward_list_base& __x, true_type)
+    {
+        if (__alloc() != __x.__alloc())
+            clear();
+        __alloc() = __x.__alloc();
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__forward_list_base& __x, false_type) _NOEXCEPT
+        {}
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__forward_list_base& __x, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
+        {__alloc() = _VSTD::move(__x.__alloc());}
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
+        _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
+    : __before_begin_(_VSTD::move(__x.__before_begin_))
+{
+    __x.__before_begin()->__next_ = nullptr;
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x,
+                                                      const allocator_type& __a)
+    : __before_begin_(__begin_node(), __node_allocator(__a))
+{
+    if (__alloc() == __x.__alloc())
+    {
+        __before_begin()->__next_ = __x.__before_begin()->__next_;
+        __x.__before_begin()->__next_ = nullptr;
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+__forward_list_base<_Tp, _Alloc>::~__forward_list_base()
+{
+    clear();
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT
+#else
+        _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value || 
+                    __is_nothrow_swappable<__node_allocator>::value)
+#endif
+{
+    __swap_allocator(__alloc(), __x.__alloc(), 
+            integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
+    using _VSTD::swap;
+    swap(__before_begin()->__next_, __x.__before_begin()->__next_);
+}
+
+template <class _Tp, class _Alloc>
+void
+__forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
+{
+    __node_allocator& __a = __alloc();
+    for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
+    {
+        __node_pointer __next = __p->__next_;
+        __node_traits::destroy(__a, _VSTD::addressof(__p->__value_));
+        __node_traits::deallocate(__a, __p, 1);
+        __p = __next;
+    }
+    __before_begin()->__next_ = nullptr;
+}
+
+template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
+class _LIBCPP_TYPE_VIS_ONLY forward_list
+    : private __forward_list_base<_Tp, _Alloc>
+{
+    typedef __forward_list_base<_Tp, _Alloc> base;
+    typedef typename base::__node_allocator  __node_allocator;
+    typedef typename base::__node            __node;
+    typedef typename base::__node_traits     __node_traits;
+    typedef typename base::__node_pointer    __node_pointer;
+
+public:
+    typedef _Tp    value_type;
+    typedef _Alloc allocator_type;
+
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    typedef typename allocator_traits<allocator_type>::pointer         pointer;
+    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+    typedef typename allocator_traits<allocator_type>::size_type       size_type;
+    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+
+    typedef typename base::iterator       iterator;
+    typedef typename base::const_iterator const_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    forward_list()
+        _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
+        {} // = default;
+    explicit forward_list(const allocator_type& __a);
+    explicit forward_list(size_type __n);
+#if _LIBCPP_STD_VER > 11
+    explicit forward_list(size_type __n, const allocator_type& __a);
+#endif
+    forward_list(size_type __n, const value_type& __v);
+    forward_list(size_type __n, const value_type& __v, const allocator_type& __a);
+    template <class _InputIterator>
+        forward_list(_InputIterator __f, _InputIterator __l,
+                     typename enable_if<
+                       __is_input_iterator<_InputIterator>::value
+                     >::type* = nullptr);
+    template <class _InputIterator>
+        forward_list(_InputIterator __f, _InputIterator __l,
+                     const allocator_type& __a,
+                     typename enable_if<
+                       __is_input_iterator<_InputIterator>::value
+                     >::type* = nullptr);
+    forward_list(const forward_list& __x);
+    forward_list(const forward_list& __x, const allocator_type& __a);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    forward_list(forward_list&& __x)
+        _NOEXCEPT_(is_nothrow_move_constructible<base>::value)
+        : base(_VSTD::move(__x)) {}
+    forward_list(forward_list&& __x, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    forward_list(initializer_list<value_type> __il);
+    forward_list(initializer_list<value_type> __il, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    // ~forward_list() = default;
+
+    forward_list& operator=(const forward_list& __x);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    forward_list& operator=(forward_list&& __x)
+        _NOEXCEPT_(
+             __node_traits::propagate_on_container_move_assignment::value &&
+             is_nothrow_move_assignable<allocator_type>::value);
+#endif
+#ifndef  _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    forward_list& operator=(initializer_list<value_type> __il);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    template <class _InputIterator>
+        typename enable_if
+        <
+            __is_input_iterator<_InputIterator>::value,
+            void
+        >::type
+        assign(_InputIterator __f, _InputIterator __l);
+    void assign(size_type __n, const value_type& __v);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    void assign(initializer_list<value_type> __il);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT
+        {return allocator_type(base::__alloc());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       begin() _NOEXCEPT
+        {return       iterator(base::__before_begin()->__next_);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT
+        {return const_iterator(base::__before_begin()->__next_);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       end() _NOEXCEPT
+        {return       iterator(nullptr);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end() const _NOEXCEPT
+        {return const_iterator(nullptr);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin() const _NOEXCEPT
+        {return const_iterator(base::__before_begin()->__next_);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend() const _NOEXCEPT
+        {return const_iterator(nullptr);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       before_begin() _NOEXCEPT
+        {return       iterator(base::__before_begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator before_begin() const _NOEXCEPT
+        {return const_iterator(base::__before_begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbefore_begin() const _NOEXCEPT
+        {return const_iterator(base::__before_begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty() const _NOEXCEPT
+        {return base::__before_begin()->__next_ == nullptr;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT
+        {return numeric_limits<size_type>::max();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference       front()       {return base::__before_begin()->__next_->__value_;}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference front() const {return base::__before_begin()->__next_->__value_;}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args> void emplace_front(_Args&&... __args);
+#endif
+    void push_front(value_type&& __v);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void push_front(const value_type& __v);
+
+    void pop_front();
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args>
+        iterator emplace_after(const_iterator __p, _Args&&... __args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+    iterator insert_after(const_iterator __p, value_type&& __v);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    iterator insert_after(const_iterator __p, const value_type& __v);
+    iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
+    template <class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            __is_input_iterator<_InputIterator>::value,
+            iterator
+        >::type
+        insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
+        {return insert_after(__p, __il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    iterator erase_after(const_iterator __p);
+    iterator erase_after(const_iterator __f, const_iterator __l);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(forward_list& __x)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT
+#else
+        _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
+                   __is_nothrow_swappable<__node_allocator>::value)
+#endif
+        {base::swap(__x);}
+
+    void resize(size_type __n);
+    void resize(size_type __n, const value_type& __v);
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {base::clear();}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void splice_after(const_iterator __p, forward_list&& __x);
+    _LIBCPP_INLINE_VISIBILITY
+    void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
+    _LIBCPP_INLINE_VISIBILITY
+    void splice_after(const_iterator __p, forward_list&& __x,
+                      const_iterator __f, const_iterator __l);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void splice_after(const_iterator __p, forward_list& __x);
+    void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
+    void splice_after(const_iterator __p, forward_list& __x,
+                      const_iterator __f, const_iterator __l);
+    void remove(const value_type& __v);
+    template <class _Predicate> void remove_if(_Predicate __pred);
+    _LIBCPP_INLINE_VISIBILITY
+    void unique() {unique(__equal_to<value_type>());}
+    template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
+    template <class _Compare>
+        _LIBCPP_INLINE_VISIBILITY
+        void merge(forward_list&& __x, _Compare __comp)
+        {merge(__x, _VSTD::move(__comp));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void merge(forward_list& __x) {merge(__x, __less<value_type>());}
+    template <class _Compare> void merge(forward_list& __x, _Compare __comp);
+    _LIBCPP_INLINE_VISIBILITY
+    void sort() {sort(__less<value_type>());}
+    template <class _Compare> void sort(_Compare __comp);
+    void reverse() _NOEXCEPT;
+
+private:
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void __move_assign(forward_list& __x, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+    void __move_assign(forward_list& __x, false_type);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    template <class _Compare>
+        static
+        __node_pointer
+        __merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp);
+
+    template <class _Compare>
+        static
+        __node_pointer
+        __sort(__node_pointer __f, difference_type __sz, _Compare& __comp);
+};
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a)
+    : base(__a)
+{
+}
+
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>::forward_list(size_type __n)
+{
+    if (__n > 0)
+    {
+        __node_allocator& __a = base::__alloc();
+        typedef __allocator_destructor<__node_allocator> _Dp;
+        unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
+        for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
+                                                             __p = __p->__next_)
+        {
+            __h.reset(__node_traits::allocate(__a, 1));
+            __node_traits::construct(__a, _VSTD::addressof(__h->__value_));
+            __h->__next_ = nullptr;
+            __p->__next_ = __h.release();
+        }
+    }
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __a)
+    : base ( __a )
+{
+    if (__n > 0)
+    {
+        __node_allocator& __a = base::__alloc();
+        typedef __allocator_destructor<__node_allocator> _Dp;
+        unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
+        for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
+                                                             __p = __p->__next_)
+        {
+            __h.reset(__node_traits::allocate(__a, 1));
+            __node_traits::construct(__a, _VSTD::addressof(__h->__value_));
+            __h->__next_ = nullptr;
+            __p->__next_ = __h.release();
+        }
+    }
+}
+#endif
+
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
+{
+    insert_after(cbefore_begin(), __n, __v);
+}
+
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v,
+                                        const allocator_type& __a)
+    : base(__a)
+{
+    insert_after(cbefore_begin(), __n, __v);
+}
+
+template <class _Tp, class _Alloc>
+template <class _InputIterator>
+forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
+                                        typename enable_if<
+                                          __is_input_iterator<_InputIterator>::value
+                                        >::type*)
+{
+    insert_after(cbefore_begin(), __f, __l);
+}
+
+template <class _Tp, class _Alloc>
+template <class _InputIterator>
+forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
+                                        const allocator_type& __a,
+                                        typename enable_if<
+                                          __is_input_iterator<_InputIterator>::value
+                                        >::type*)
+    : base(__a)
+{
+    insert_after(cbefore_begin(), __f, __l);
+}
+
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x)
+    : base(allocator_type(
+             __node_traits::select_on_container_copy_construction(__x.__alloc())
+                         )
+          )
+{
+    insert_after(cbefore_begin(), __x.begin(), __x.end());
+}
+
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
+                                        const allocator_type& __a)
+    : base(__a)
+{
+    insert_after(cbefore_begin(), __x.begin(), __x.end());
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
+                                        const allocator_type& __a)
+    : base(_VSTD::move(__x), __a)
+{
+    if (base::__alloc() != __x.__alloc())
+    {
+        typedef move_iterator<iterator> _Ip;
+        insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
+{
+    insert_after(cbefore_begin(), __il.begin(), __il.end());
+}
+
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
+                                        const allocator_type& __a)
+    : base(__a)
+{
+    insert_after(cbefore_begin(), __il.begin(), __il.end());
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>&
+forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
+{
+    if (this != &__x)
+    {
+        base::__copy_assign_alloc(__x);
+        assign(__x.begin(), __x.end());
+    }
+    return *this;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
+    _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+{
+    clear();
+    base::__move_assign_alloc(__x);
+    base::__before_begin()->__next_ = __x.__before_begin()->__next_;
+    __x.__before_begin()->__next_ = nullptr;
+}
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
+{
+    if (base::__alloc() == __x.__alloc())
+        __move_assign(__x, true_type());
+    else
+    {
+        typedef move_iterator<iterator> _Ip;
+        assign(_Ip(__x.begin()), _Ip(__x.end()));
+    }
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+forward_list<_Tp, _Alloc>&
+forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
+    _NOEXCEPT_(
+             __node_traits::propagate_on_container_move_assignment::value &&
+             is_nothrow_move_assignable<allocator_type>::value)
+{
+    __move_assign(__x, integral_constant<bool,
+          __node_traits::propagate_on_container_move_assignment::value>());
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+forward_list<_Tp, _Alloc>&
+forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
+{
+    assign(__il.begin(), __il.end());
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Alloc>
+template <class _InputIterator>
+typename enable_if
+<
+    __is_input_iterator<_InputIterator>::value,
+    void
+>::type
+forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
+{
+    iterator __i = before_begin();
+    iterator __j = _VSTD::next(__i);
+    iterator __e = end();
+    for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f)
+        *__j = *__f;
+    if (__j == __e)
+        insert_after(__i, __f, __l);
+    else
+        erase_after(__i, __e);
+}
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
+{
+    iterator __i = before_begin();
+    iterator __j = _VSTD::next(__i);
+    iterator __e = end();
+    for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
+        *__j = __v;
+    if (__j == __e)
+        insert_after(__i, __n, __v);
+    else
+        erase_after(__i, __e);
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
+{
+    assign(__il.begin(), __il.end());
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Alloc>
+template <class... _Args>
+void
+forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
+{
+    __node_allocator& __a = base::__alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
+    __node_traits::construct(__a, _VSTD::addressof(__h->__value_),
+                                  _VSTD::forward<_Args>(__args)...);
+    __h->__next_ = base::__before_begin()->__next_;
+    base::__before_begin()->__next_ = __h.release();
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
+{
+    __node_allocator& __a = base::__alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
+    __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
+    __h->__next_ = base::__before_begin()->__next_;
+    base::__before_begin()->__next_ = __h.release();
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
+{
+    __node_allocator& __a = base::__alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
+    __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
+    __h->__next_ = base::__before_begin()->__next_;
+    base::__before_begin()->__next_ = __h.release();
+}
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::pop_front()
+{
+    __node_allocator& __a = base::__alloc();
+    __node_pointer __p = base::__before_begin()->__next_;
+    base::__before_begin()->__next_ = __p->__next_;
+    __node_traits::destroy(__a, _VSTD::addressof(__p->__value_));
+    __node_traits::deallocate(__a, __p, 1);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Alloc>
+template <class... _Args>
+typename forward_list<_Tp, _Alloc>::iterator
+forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
+{
+    __node_pointer const __r = __p.__ptr_;
+    __node_allocator& __a = base::__alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
+    __node_traits::construct(__a, _VSTD::addressof(__h->__value_),
+                                  _VSTD::forward<_Args>(__args)...);
+    __h->__next_ = __r->__next_;
+    __r->__next_ = __h.release();
+    return iterator(__r->__next_);
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Alloc>
+typename forward_list<_Tp, _Alloc>::iterator
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
+{
+    __node_pointer const __r = __p.__ptr_;
+    __node_allocator& __a = base::__alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
+    __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
+    __h->__next_ = __r->__next_;
+    __r->__next_ = __h.release();
+    return iterator(__r->__next_);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+typename forward_list<_Tp, _Alloc>::iterator
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v)
+{
+    __node_pointer const __r = __p.__ptr_;
+    __node_allocator& __a = base::__alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
+    __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
+    __h->__next_ = __r->__next_;
+    __r->__next_ = __h.release();
+    return iterator(__r->__next_);
+}
+
+template <class _Tp, class _Alloc>
+typename forward_list<_Tp, _Alloc>::iterator
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
+                                        const value_type& __v)
+{
+    __node_pointer __r = __p.__ptr_;
+    if (__n > 0)
+    {
+        __node_allocator& __a = base::__alloc();
+        typedef __allocator_destructor<__node_allocator> _Dp;
+        unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
+        __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
+        __node_pointer __first = __h.release();
+        __node_pointer __last = __first;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (--__n; __n != 0; --__n, __last = __last->__next_)
+            {
+                __h.reset(__node_traits::allocate(__a, 1));
+                __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
+                __last->__next_ = __h.release();
+            }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            while (__first != nullptr)
+            {
+                __node_pointer __next = __first->__next_;
+                __node_traits::destroy(__a, _VSTD::addressof(__first->__value_));
+                __node_traits::deallocate(__a, __first, 1);
+                __first = __next;
+            }
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __last->__next_ = __r->__next_;
+        __r->__next_ = __first;
+        __r = __last;
+    }
+    return iterator(__r);
+}
+
+template <class _Tp, class _Alloc>
+template <class _InputIterator>
+typename enable_if
+<
+    __is_input_iterator<_InputIterator>::value,
+    typename forward_list<_Tp, _Alloc>::iterator
+>::type
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
+                                        _InputIterator __f, _InputIterator __l)
+{
+    __node_pointer __r = __p.__ptr_;
+    if (__f != __l)
+    {
+        __node_allocator& __a = base::__alloc();
+        typedef __allocator_destructor<__node_allocator> _Dp;
+        unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
+        __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
+        __node_pointer __first = __h.release();
+        __node_pointer __last = __first;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_)))
+            {
+                __h.reset(__node_traits::allocate(__a, 1));
+                __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
+                __last->__next_ = __h.release();
+            }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            while (__first != nullptr)
+            {
+                __node_pointer __next = __first->__next_;
+                __node_traits::destroy(__a, _VSTD::addressof(__first->__value_));
+                __node_traits::deallocate(__a, __first, 1);
+                __first = __next;
+            }
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __last->__next_ = __r->__next_;
+        __r->__next_ = __first;
+        __r = __last;
+    }
+    return iterator(__r);
+}
+
+template <class _Tp, class _Alloc>
+typename forward_list<_Tp, _Alloc>::iterator
+forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
+{
+    __node_pointer __p = __f.__ptr_;
+    __node_pointer __n = __p->__next_;
+    __p->__next_ = __n->__next_;
+    __node_allocator& __a = base::__alloc();
+    __node_traits::destroy(__a, _VSTD::addressof(__n->__value_));
+    __node_traits::deallocate(__a, __n, 1);
+    return iterator(__p->__next_);
+}
+
+template <class _Tp, class _Alloc>
+typename forward_list<_Tp, _Alloc>::iterator
+forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
+{
+    __node_pointer __e = __l.__ptr_;
+    if (__f != __l)
+    {
+        __node_pointer __p = __f.__ptr_;
+        __node_pointer __n = __p->__next_;
+        if (__n != __e)
+        {
+            __p->__next_ = __e;
+            __node_allocator& __a = base::__alloc();
+            do
+            {
+                __p = __n->__next_;
+                __node_traits::destroy(__a, _VSTD::addressof(__n->__value_));
+                __node_traits::deallocate(__a, __n, 1);
+                __n = __p;
+            } while (__n != __e);
+        }
+    }
+    return iterator(__e);
+}
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::resize(size_type __n)
+{
+    size_type __sz = 0;
+    iterator __p = before_begin();
+    iterator __i = begin();
+    iterator __e = end();
+    for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
+        ;
+    if (__i != __e)
+        erase_after(__p, __e);
+    else
+    {
+        __n -= __sz;
+        if (__n > 0)
+        {
+            __node_allocator& __a = base::__alloc();
+            typedef __allocator_destructor<__node_allocator> _Dp;
+            unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
+            for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
+                                                         __ptr = __ptr->__next_)
+            {
+                __h.reset(__node_traits::allocate(__a, 1));
+                __node_traits::construct(__a, _VSTD::addressof(__h->__value_));
+                __h->__next_ = nullptr;
+                __ptr->__next_ = __h.release();
+            }
+        }
+    }
+}
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
+{
+    size_type __sz = 0;
+    iterator __p = before_begin();
+    iterator __i = begin();
+    iterator __e = end();
+    for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
+        ;
+    if (__i != __e)
+        erase_after(__p, __e);
+    else
+    {
+        __n -= __sz;
+        if (__n > 0)
+        {
+            __node_allocator& __a = base::__alloc();
+            typedef __allocator_destructor<__node_allocator> _Dp;
+            unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
+            for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
+                                                         __ptr = __ptr->__next_)
+            {
+                __h.reset(__node_traits::allocate(__a, 1));
+                __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
+                __h->__next_ = nullptr;
+                __ptr->__next_ = __h.release();
+            }
+        }
+    }
+}
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
+                                        forward_list& __x)
+{
+    if (!__x.empty())
+    {
+        if (__p.__ptr_->__next_ != nullptr)
+        {
+            const_iterator __lm1 = __x.before_begin();
+            while (__lm1.__ptr_->__next_ != nullptr)
+                ++__lm1;
+            __lm1.__ptr_->__next_ = __p.__ptr_->__next_;
+        }
+        __p.__ptr_->__next_ = __x.__before_begin()->__next_;
+        __x.__before_begin()->__next_ = nullptr;
+    }
+}
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
+                                        forward_list& __x,
+                                        const_iterator __i)
+{
+    const_iterator __lm1 = _VSTD::next(__i);
+    if (__p != __i && __p != __lm1)
+    {
+        __i.__ptr_->__next_ = __lm1.__ptr_->__next_;
+        __lm1.__ptr_->__next_ = __p.__ptr_->__next_;
+        __p.__ptr_->__next_ = __lm1.__ptr_;
+    }
+}
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
+                                        forward_list& __x,
+                                        const_iterator __f, const_iterator __l)
+{
+    if (__f != __l && __p != __f)
+    {
+        const_iterator __lm1 = __f;
+        while (__lm1.__ptr_->__next_ != __l.__ptr_)
+            ++__lm1;
+        if (__f != __lm1)
+        {
+            __lm1.__ptr_->__next_ = __p.__ptr_->__next_;
+            __p.__ptr_->__next_ = __f.__ptr_->__next_;
+            __f.__ptr_->__next_ = __l.__ptr_;
+        }
+    }
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
+                                        forward_list&& __x)
+{
+    splice_after(__p, __x);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
+                                        forward_list&& __x,
+                                        const_iterator __i)
+{
+    splice_after(__p, __x, __i);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
+                                        forward_list&& __x,
+                                        const_iterator __f, const_iterator __l)
+{
+    splice_after(__p, __x, __f, __l);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::remove(const value_type& __v)
+{
+    forward_list<_Tp, _Alloc> __deleted_nodes; // collect the nodes we're removing
+    iterator __e = end();
+    for (iterator __i = before_begin(); __i.__ptr_->__next_ != nullptr;)
+    {
+        if (__i.__ptr_->__next_->__value_ == __v)
+        {
+            iterator __j = _VSTD::next(__i, 2);
+            for (; __j != __e && *__j == __v; ++__j)
+                ;
+            __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
+            if (__j == __e)
+                break;
+            __i = __j;
+        }
+        else
+            ++__i;
+    }
+}
+
+template <class _Tp, class _Alloc>
+template <class _Predicate>
+void
+forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
+{
+    iterator __e = end();
+    for (iterator __i = before_begin(); __i.__ptr_->__next_ != nullptr;)
+    {
+        if (__pred(__i.__ptr_->__next_->__value_))
+        {
+            iterator __j = _VSTD::next(__i, 2);
+            for (; __j != __e && __pred(*__j); ++__j)
+                ;
+            erase_after(__i, __j);
+            if (__j == __e)
+                break;
+            __i = __j;
+        }
+        else
+            ++__i;
+    }
+}
+
+template <class _Tp, class _Alloc>
+template <class _BinaryPredicate>
+void
+forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
+{
+    for (iterator __i = begin(), __e = end(); __i != __e;)
+    {
+        iterator __j = _VSTD::next(__i);
+        for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
+            ;
+        if (__i.__ptr_->__next_ != __j.__ptr_)
+            erase_after(__i, __j);
+        __i = __j;
+    }
+}
+
+template <class _Tp, class _Alloc>
+template <class _Compare>
+void
+forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp)
+{
+    if (this != &__x)
+    {
+        base::__before_begin()->__next_ = __merge(base::__before_begin()->__next_,
+                                                    __x.__before_begin()->__next_,
+                                                    __comp);
+        __x.__before_begin()->__next_ = nullptr;
+    }
+}
+
+template <class _Tp, class _Alloc>
+template <class _Compare>
+typename forward_list<_Tp, _Alloc>::__node_pointer
+forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2,
+                                   _Compare& __comp)
+{
+    if (__f1 == nullptr)
+        return __f2;
+    if (__f2 == nullptr)
+        return __f1;
+    __node_pointer __r;
+    if (__comp(__f2->__value_, __f1->__value_))
+    {
+        __node_pointer __t = __f2;
+        while (__t->__next_ != nullptr &&
+                             __comp(__t->__next_->__value_, __f1->__value_))
+            __t = __t->__next_;
+        __r = __f2;
+        __f2 = __t->__next_;
+        __t->__next_ = __f1;
+    }
+    else
+        __r = __f1;
+    __node_pointer __p = __f1;
+    __f1 = __f1->__next_;
+    while (__f1 != nullptr && __f2 != nullptr)
+    {
+        if (__comp(__f2->__value_, __f1->__value_))
+        {
+            __node_pointer __t = __f2;
+            while (__t->__next_ != nullptr &&
+                                 __comp(__t->__next_->__value_, __f1->__value_))
+                __t = __t->__next_;
+            __p->__next_ = __f2;
+            __f2 = __t->__next_;
+            __t->__next_ = __f1;
+        }
+        __p = __f1;
+        __f1 = __f1->__next_;
+    }
+    if (__f2 != nullptr)
+        __p->__next_ = __f2;
+    return __r;
+}
+
+template <class _Tp, class _Alloc>
+template <class _Compare>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+forward_list<_Tp, _Alloc>::sort(_Compare __comp)
+{
+    base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_,
+                                       _VSTD::distance(begin(), end()), __comp);
+}
+
+template <class _Tp, class _Alloc>
+template <class _Compare>
+typename forward_list<_Tp, _Alloc>::__node_pointer
+forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
+                                  _Compare& __comp)
+{
+    switch (__sz)
+    {
+    case 0:
+    case 1:
+        return __f1;
+    case 2:
+        if (__comp(__f1->__next_->__value_, __f1->__value_))
+        {
+            __node_pointer __t = __f1->__next_;
+            __t->__next_ = __f1;
+            __f1->__next_ = nullptr;
+            __f1 = __t;
+        }
+        return __f1;
+    }
+    difference_type __sz1 = __sz / 2;
+    difference_type __sz2 = __sz - __sz1;
+    __node_pointer __t = _VSTD::next(iterator(__f1), __sz1 - 1).__ptr_;
+    __node_pointer __f2 = __t->__next_;
+    __t->__next_ = nullptr;
+    return __merge(__sort(__f1, __sz1, __comp),
+                   __sort(__f2, __sz2, __comp), __comp);
+}
+
+template <class _Tp, class _Alloc>
+void
+forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT
+{
+    __node_pointer __p = base::__before_begin()->__next_;
+    if (__p != nullptr)
+    {
+        __node_pointer __f = __p->__next_;
+        __p->__next_ = nullptr;
+        while (__f != nullptr)
+        {
+            __node_pointer __t = __f->__next_;
+            __f->__next_ = __p;
+            __p = __f;
+            __f = __t;
+        }
+        base::__before_begin()->__next_ = __p;
+    }
+}
+
+template <class _Tp, class _Alloc>
+bool operator==(const forward_list<_Tp, _Alloc>& __x,
+                const forward_list<_Tp, _Alloc>& __y)
+{
+    typedef forward_list<_Tp, _Alloc> _Cp;
+    typedef typename _Cp::const_iterator _Ip;
+    _Ip __ix = __x.begin();
+    _Ip __ex = __x.end();
+    _Ip __iy = __y.begin();
+    _Ip __ey = __y.end();
+    for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
+        if (!(*__ix == *__iy))
+            return false;
+    return (__ix == __ex) == (__iy == __ey);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator!=(const forward_list<_Tp, _Alloc>& __x,
+                const forward_list<_Tp, _Alloc>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator< (const forward_list<_Tp, _Alloc>& __x,
+                const forward_list<_Tp, _Alloc>& __y)
+{
+    return _VSTD::lexicographical_compare(__x.begin(), __x.end(),
+                                         __y.begin(), __y.end());
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator> (const forward_list<_Tp, _Alloc>& __x,
+                const forward_list<_Tp, _Alloc>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator>=(const forward_list<_Tp, _Alloc>& __x,
+                const forward_list<_Tp, _Alloc>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator<=(const forward_list<_Tp, _Alloc>& __x,
+                const forward_list<_Tp, _Alloc>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_FORWARD_LIST

Property changes on: lab4/.minix-src/include/c++/forward_list
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/future
===================================================================
--- lab4/.minix-src/include/c++/future	(nonexistent)
+++ lab4/.minix-src/include/c++/future	(revision 13)
@@ -0,0 +1,2625 @@
+// -*- C++ -*-
+//===--------------------------- future -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_FUTURE
+#define _LIBCPP_FUTURE
+
+/*
+    future synopsis
+
+namespace std
+{
+
+enum class future_errc
+{
+    future_already_retrieved = 1,
+    promise_already_satisfied,
+    no_state,
+    broken_promise
+};
+
+enum class launch
+{
+    async = 1,
+    deferred = 2,
+    any = async | deferred
+};
+
+enum class future_status
+{
+    ready,
+    timeout,
+    deferred
+};
+
+template <> struct is_error_code_enum<future_errc> : public true_type { };
+error_code make_error_code(future_errc e) noexcept;
+error_condition make_error_condition(future_errc e) noexcept;
+
+const error_category& future_category() noexcept;
+
+class future_error
+    : public logic_error
+{
+public:
+    future_error(error_code ec);  // exposition only
+
+    const error_code& code() const noexcept;
+    const char*       what() const noexcept;
+};
+
+template <class R>
+class promise
+{
+public:
+    promise();
+    template <class Allocator>
+        promise(allocator_arg_t, const Allocator& a);
+    promise(promise&& rhs) noexcept;
+    promise(const promise& rhs) = delete;
+    ~promise();
+
+    // assignment
+    promise& operator=(promise&& rhs) noexcept;
+    promise& operator=(const promise& rhs) = delete;
+    void swap(promise& other) noexcept;
+
+    // retrieving the result
+    future<R> get_future();
+
+    // setting the result
+    void set_value(const R& r);
+    void set_value(R&& r);
+    void set_exception(exception_ptr p);
+
+    // setting the result with deferred notification
+    void set_value_at_thread_exit(const R& r);
+    void set_value_at_thread_exit(R&& r);
+    void set_exception_at_thread_exit(exception_ptr p);
+};
+
+template <class R>
+class promise<R&>
+{
+public:
+    promise();
+    template <class Allocator>
+        promise(allocator_arg_t, const Allocator& a);
+    promise(promise&& rhs) noexcept;
+    promise(const promise& rhs) = delete;
+    ~promise();
+
+    // assignment
+    promise& operator=(promise&& rhs) noexcept;
+    promise& operator=(const promise& rhs) = delete;
+    void swap(promise& other) noexcept;
+
+    // retrieving the result
+    future<R&> get_future();
+
+    // setting the result
+    void set_value(R& r);
+    void set_exception(exception_ptr p);
+
+    // setting the result with deferred notification
+    void set_value_at_thread_exit(R&);
+    void set_exception_at_thread_exit(exception_ptr p);
+};
+
+template <>
+class promise<void>
+{
+public:
+    promise();
+    template <class Allocator>
+        promise(allocator_arg_t, const Allocator& a);
+    promise(promise&& rhs) noexcept;
+    promise(const promise& rhs) = delete;
+    ~promise();
+
+    // assignment
+    promise& operator=(promise&& rhs) noexcept;
+    promise& operator=(const promise& rhs) = delete;
+    void swap(promise& other) noexcept;
+
+    // retrieving the result
+    future<void> get_future();
+
+    // setting the result
+    void set_value();
+    void set_exception(exception_ptr p);
+
+    // setting the result with deferred notification
+    void set_value_at_thread_exit();
+    void set_exception_at_thread_exit(exception_ptr p);
+};
+
+template <class R> void swap(promise<R>& x, promise<R>& y) noexcept;
+
+template <class R, class Alloc>
+    struct uses_allocator<promise<R>, Alloc> : public true_type {};
+
+template <class R>
+class future
+{
+public:
+    future() noexcept;
+    future(future&&) noexcept;
+    future(const future& rhs) = delete;
+    ~future();
+    future& operator=(const future& rhs) = delete;
+    future& operator=(future&&) noexcept;
+    shared_future<R> share();
+
+    // retrieving the value
+    R get();
+
+    // functions to check state
+    bool valid() const noexcept;
+
+    void wait() const;
+    template <class Rep, class Period>
+        future_status
+        wait_for(const chrono::duration<Rep, Period>& rel_time) const;
+    template <class Clock, class Duration>
+        future_status
+        wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
+};
+
+template <class R>
+class future<R&>
+{
+public:
+    future() noexcept;
+    future(future&&) noexcept;
+    future(const future& rhs) = delete;
+    ~future();
+    future& operator=(const future& rhs) = delete;
+    future& operator=(future&&) noexcept;
+    shared_future<R&> share();
+
+    // retrieving the value
+    R& get();
+
+    // functions to check state
+    bool valid() const noexcept;
+
+    void wait() const;
+    template <class Rep, class Period>
+        future_status
+        wait_for(const chrono::duration<Rep, Period>& rel_time) const;
+    template <class Clock, class Duration>
+        future_status
+        wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
+};
+
+template <>
+class future<void>
+{
+public:
+    future() noexcept;
+    future(future&&) noexcept;
+    future(const future& rhs) = delete;
+    ~future();
+    future& operator=(const future& rhs) = delete;
+    future& operator=(future&&) noexcept;
+    shared_future<void> share();
+
+    // retrieving the value
+    void get();
+
+    // functions to check state
+    bool valid() const noexcept;
+
+    void wait() const;
+    template <class Rep, class Period>
+        future_status
+        wait_for(const chrono::duration<Rep, Period>& rel_time) const;
+    template <class Clock, class Duration>
+        future_status
+        wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
+};
+
+template <class R>
+class shared_future
+{
+public:
+    shared_future() noexcept;
+    shared_future(const shared_future& rhs);
+    shared_future(future<R>&&) noexcept;
+    shared_future(shared_future&& rhs) noexcept;
+    ~shared_future();
+    shared_future& operator=(const shared_future& rhs);
+    shared_future& operator=(shared_future&& rhs) noexcept;
+
+    // retrieving the value
+    const R& get() const;
+
+    // functions to check state
+    bool valid() const noexcept;
+
+    void wait() const;
+    template <class Rep, class Period>
+        future_status
+        wait_for(const chrono::duration<Rep, Period>& rel_time) const;
+    template <class Clock, class Duration>
+        future_status
+        wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
+};
+
+template <class R>
+class shared_future<R&>
+{
+public:
+    shared_future() noexcept;
+    shared_future(const shared_future& rhs);
+    shared_future(future<R&>&&) noexcept;
+    shared_future(shared_future&& rhs) noexcept;
+    ~shared_future();
+    shared_future& operator=(const shared_future& rhs);
+    shared_future& operator=(shared_future&& rhs) noexcept;
+
+    // retrieving the value
+    R& get() const;
+
+    // functions to check state
+    bool valid() const noexcept;
+
+    void wait() const;
+    template <class Rep, class Period>
+        future_status
+        wait_for(const chrono::duration<Rep, Period>& rel_time) const;
+    template <class Clock, class Duration>
+        future_status
+        wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
+};
+
+template <>
+class shared_future<void>
+{
+public:
+    shared_future() noexcept;
+    shared_future(const shared_future& rhs);
+    shared_future(future<void>&&) noexcept;
+    shared_future(shared_future&& rhs) noexcept;
+    ~shared_future();
+    shared_future& operator=(const shared_future& rhs);
+    shared_future& operator=(shared_future&& rhs) noexcept;
+
+    // retrieving the value
+    void get() const;
+
+    // functions to check state
+    bool valid() const noexcept;
+
+    void wait() const;
+    template <class Rep, class Period>
+        future_status
+        wait_for(const chrono::duration<Rep, Period>& rel_time) const;
+    template <class Clock, class Duration>
+        future_status
+        wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
+};
+
+template <class F, class... Args>
+  future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
+  async(F&& f, Args&&... args);
+
+template <class F, class... Args>
+  future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
+  async(launch policy, F&& f, Args&&... args);
+
+template <class> class packaged_task; // undefined
+
+template <class R, class... ArgTypes>
+class packaged_task<R(ArgTypes...)>
+{
+public:
+    typedef R result_type;
+
+    // construction and destruction
+    packaged_task() noexcept;
+    template <class F>
+        explicit packaged_task(F&& f);
+    template <class F, class Allocator>
+        packaged_task(allocator_arg_t, const Allocator& a, F&& f);
+    ~packaged_task();
+
+    // no copy
+    packaged_task(const packaged_task&) = delete;
+    packaged_task& operator=(const packaged_task&) = delete;
+
+    // move support
+    packaged_task(packaged_task&& other) noexcept;
+    packaged_task& operator=(packaged_task&& other) noexcept;
+    void swap(packaged_task& other) noexcept;
+
+    bool valid() const noexcept;
+
+    // result retrieval
+    future<R> get_future();
+
+    // execution
+    void operator()(ArgTypes... );
+    void make_ready_at_thread_exit(ArgTypes...);
+
+    void reset();
+};
+
+template <class R>
+  void swap(packaged_task<R(ArgTypes...)&, packaged_task<R(ArgTypes...)>&) noexcept;
+
+template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
+
+}  // std
+
+*/
+
+#include <__config>
+#include <system_error>
+#include <memory>
+#include <chrono>
+#include <exception>
+#include <mutex>
+#include <thread>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error <future> is not supported on this single threaded system
+#else // !_LIBCPP_HAS_NO_THREADS
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+//enum class future_errc
+_LIBCPP_DECLARE_STRONG_ENUM(future_errc)
+{
+    future_already_retrieved = 1,
+    promise_already_satisfied,
+    no_state,
+    broken_promise
+};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_errc)
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<future_errc> : public true_type {};
+
+#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<future_errc::__lx> : public true_type { };
+#endif
+
+//enum class launch
+_LIBCPP_DECLARE_STRONG_ENUM(launch)
+{
+    async = 1,
+    deferred = 2,
+    any = async | deferred
+};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
+
+#ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
+
+#ifdef _LIBCXX_UNDERLYING_TYPE
+typedef underlying_type<launch>::type __launch_underlying_type;
+#else
+typedef int __launch_underlying_type;
+#endif
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+launch
+operator&(launch __x, launch __y)
+{
+    return static_cast<launch>(static_cast<__launch_underlying_type>(__x) &
+                               static_cast<__launch_underlying_type>(__y));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+launch
+operator|(launch __x, launch __y)
+{
+    return static_cast<launch>(static_cast<__launch_underlying_type>(__x) |
+                               static_cast<__launch_underlying_type>(__y));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+launch
+operator^(launch __x, launch __y)
+{
+    return static_cast<launch>(static_cast<__launch_underlying_type>(__x) ^
+                               static_cast<__launch_underlying_type>(__y));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+launch
+operator~(launch __x)
+{
+    return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) & 3);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+launch&
+operator&=(launch& __x, launch __y)
+{
+    __x = __x & __y; return __x;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+launch&
+operator|=(launch& __x, launch __y)
+{
+    __x = __x | __y; return __x;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+launch&
+operator^=(launch& __x, launch __y)
+{
+    __x = __x ^ __y; return __x;
+}
+
+#endif  // !_LIBCPP_HAS_NO_STRONG_ENUMS
+
+//enum class future_status
+_LIBCPP_DECLARE_STRONG_ENUM(future_status)
+{
+    ready,
+    timeout,
+    deferred
+};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_status)
+
+_LIBCPP_FUNC_VIS
+const error_category& future_category() _NOEXCEPT;
+
+inline _LIBCPP_INLINE_VISIBILITY
+error_code
+make_error_code(future_errc __e) _NOEXCEPT
+{
+    return error_code(static_cast<int>(__e), future_category());
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+error_condition
+make_error_condition(future_errc __e) _NOEXCEPT
+{
+    return error_condition(static_cast<int>(__e), future_category());
+}
+
+class _LIBCPP_EXCEPTION_ABI future_error
+    : public logic_error
+{
+    error_code __ec_;
+public:
+    future_error(error_code __ec);
+
+    _LIBCPP_INLINE_VISIBILITY
+    const error_code& code() const _NOEXCEPT {return __ec_;}
+
+    virtual ~future_error() _NOEXCEPT;
+};
+
+class _LIBCPP_TYPE_VIS __assoc_sub_state
+    : public __shared_count
+{
+protected:
+    exception_ptr __exception_;
+    mutable mutex __mut_;
+    mutable condition_variable __cv_;
+    unsigned __state_;
+
+    virtual void __on_zero_shared() _NOEXCEPT;
+    void __sub_wait(unique_lock<mutex>& __lk);
+public:
+    enum
+    {
+        __constructed = 1,
+        __future_attached = 2,
+        ready = 4,
+        deferred = 8
+    };
+
+    _LIBCPP_INLINE_VISIBILITY
+    __assoc_sub_state() : __state_(0) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool __has_value() const
+        {return (__state_ & __constructed) || (__exception_ != nullptr);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __set_future_attached()
+    {
+        lock_guard<mutex> __lk(__mut_);
+        __state_ |= __future_attached;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    bool __has_future_attached() const {return (__state_ & __future_attached) != 0;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __set_deferred() {__state_ |= deferred;}
+
+    void __make_ready();
+    _LIBCPP_INLINE_VISIBILITY
+    bool __is_ready() const {return (__state_ & ready) != 0;}
+
+    void set_value();
+    void set_value_at_thread_exit();
+
+    void set_exception(exception_ptr __p);
+    void set_exception_at_thread_exit(exception_ptr __p);
+
+    void copy();
+
+    void wait();
+    template <class _Rep, class _Period>
+        future_status
+        wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
+    template <class _Clock, class _Duration>
+        future_status
+        wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
+
+    virtual void __execute();
+};
+
+template <class _Clock, class _Duration>
+future_status
+__assoc_sub_state::wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
+{
+    unique_lock<mutex> __lk(__mut_);
+    if (__state_ & deferred)
+        return future_status::deferred;
+    while (!(__state_ & ready) && _Clock::now() < __abs_time)
+        __cv_.wait_until(__lk, __abs_time);
+    if (__state_ & ready)
+        return future_status::ready;
+    return future_status::timeout;
+}
+
+template <class _Rep, class _Period>
+inline _LIBCPP_INLINE_VISIBILITY
+future_status
+__assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
+{
+    return wait_until(chrono::steady_clock::now() + __rel_time);
+}
+
+template <class _Rp>
+class __assoc_state
+    : public __assoc_sub_state
+{
+    typedef __assoc_sub_state base;
+    typedef typename aligned_storage<sizeof(_Rp), alignment_of<_Rp>::value>::type _Up;
+protected:
+    _Up __value_;
+
+    virtual void __on_zero_shared() _NOEXCEPT;
+public:
+
+    template <class _Arg>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+        void set_value(_Arg&& __arg);
+#else
+        void set_value(_Arg& __arg);
+#endif
+
+    template <class _Arg>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+        void set_value_at_thread_exit(_Arg&& __arg);
+#else
+        void set_value_at_thread_exit(_Arg& __arg);
+#endif
+
+    _Rp move();
+    typename add_lvalue_reference<_Rp>::type copy();
+};
+
+template <class _Rp>
+void
+__assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT
+{
+    if (this->__state_ & base::__constructed)
+        reinterpret_cast<_Rp*>(&__value_)->~_Rp();
+    delete this;
+}
+
+template <class _Rp>
+template <class _Arg>
+void
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+__assoc_state<_Rp>::set_value(_Arg&& __arg)
+#else
+__assoc_state<_Rp>::set_value(_Arg& __arg)
+#endif
+{
+    unique_lock<mutex> __lk(this->__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (this->__has_value())
+        throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
+    ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
+    this->__state_ |= base::__constructed | base::ready;
+    __cv_.notify_all();
+}
+
+template <class _Rp>
+template <class _Arg>
+void
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+__assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg)
+#else
+__assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg)
+#endif
+{
+    unique_lock<mutex> __lk(this->__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (this->__has_value())
+        throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
+    ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
+    this->__state_ |= base::__constructed;
+    __thread_local_data()->__make_ready_at_thread_exit(this);
+}
+
+template <class _Rp>
+_Rp
+__assoc_state<_Rp>::move()
+{
+    unique_lock<mutex> __lk(this->__mut_);
+    this->__sub_wait(__lk);
+    if (this->__exception_ != nullptr)
+        rethrow_exception(this->__exception_);
+    return _VSTD::move(*reinterpret_cast<_Rp*>(&__value_));
+}
+
+template <class _Rp>
+typename add_lvalue_reference<_Rp>::type
+__assoc_state<_Rp>::copy()
+{
+    unique_lock<mutex> __lk(this->__mut_);
+    this->__sub_wait(__lk);
+    if (this->__exception_ != nullptr)
+        rethrow_exception(this->__exception_);
+    return *reinterpret_cast<_Rp*>(&__value_);
+}
+
+template <class _Rp>
+class __assoc_state<_Rp&>
+    : public __assoc_sub_state
+{
+    typedef __assoc_sub_state base;
+    typedef _Rp* _Up;
+protected:
+    _Up __value_;
+
+    virtual void __on_zero_shared() _NOEXCEPT;
+public:
+
+    void set_value(_Rp& __arg);
+    void set_value_at_thread_exit(_Rp& __arg);
+
+    _Rp& copy();
+};
+
+template <class _Rp>
+void
+__assoc_state<_Rp&>::__on_zero_shared() _NOEXCEPT
+{
+    delete this;
+}
+
+template <class _Rp>
+void
+__assoc_state<_Rp&>::set_value(_Rp& __arg)
+{
+    unique_lock<mutex> __lk(this->__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (this->__has_value())
+        throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
+    __value_ = _VSTD::addressof(__arg);
+    this->__state_ |= base::__constructed | base::ready;
+    __cv_.notify_all();
+}
+
+template <class _Rp>
+void
+__assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
+{
+    unique_lock<mutex> __lk(this->__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (this->__has_value())
+        throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
+    __value_ = _VSTD::addressof(__arg);
+    this->__state_ |= base::__constructed;
+    __thread_local_data()->__make_ready_at_thread_exit(this);
+}
+
+template <class _Rp>
+_Rp&
+__assoc_state<_Rp&>::copy()
+{
+    unique_lock<mutex> __lk(this->__mut_);
+    this->__sub_wait(__lk);
+    if (this->__exception_ != nullptr)
+        rethrow_exception(this->__exception_);
+    return *__value_;
+}
+
+template <class _Rp, class _Alloc>
+class __assoc_state_alloc
+    : public __assoc_state<_Rp>
+{
+    typedef __assoc_state<_Rp> base;
+    _Alloc __alloc_;
+
+    virtual void __on_zero_shared() _NOEXCEPT;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __assoc_state_alloc(const _Alloc& __a)
+        : __alloc_(__a) {}
+};
+
+template <class _Rp, class _Alloc>
+void
+__assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
+{
+    if (this->__state_ & base::__constructed)
+        reinterpret_cast<_Rp*>(_VSTD::addressof(this->__value_))->~_Rp();
+    typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
+    typedef allocator_traits<_Al> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+    _Al __a(__alloc_);
+    this->~__assoc_state_alloc();
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
+}
+
+template <class _Rp, class _Alloc>
+class __assoc_state_alloc<_Rp&, _Alloc>
+    : public __assoc_state<_Rp&>
+{
+    typedef __assoc_state<_Rp&> base;
+    _Alloc __alloc_;
+
+    virtual void __on_zero_shared() _NOEXCEPT;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __assoc_state_alloc(const _Alloc& __a)
+        : __alloc_(__a) {}
+};
+
+template <class _Rp, class _Alloc>
+void
+__assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
+{
+    typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
+    typedef allocator_traits<_Al> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+    _Al __a(__alloc_);
+    this->~__assoc_state_alloc();
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
+}
+
+template <class _Alloc>
+class __assoc_sub_state_alloc
+    : public __assoc_sub_state
+{
+    typedef __assoc_sub_state base;
+    _Alloc __alloc_;
+
+    virtual void __on_zero_shared() _NOEXCEPT;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __assoc_sub_state_alloc(const _Alloc& __a)
+        : __alloc_(__a) {}
+};
+
+template <class _Alloc>
+void
+__assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
+{
+    typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _Al;
+    typedef allocator_traits<_Al> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+    _Al __a(__alloc_);
+    this->~__assoc_sub_state_alloc();
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
+}
+
+template <class _Rp, class _Fp>
+class __deferred_assoc_state
+    : public __assoc_state<_Rp>
+{
+    typedef __assoc_state<_Rp> base;
+
+    _Fp __func_;
+
+public:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    explicit __deferred_assoc_state(_Fp&& __f);
+#endif
+
+    virtual void __execute();
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Rp, class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
+    : __func_(_VSTD::forward<_Fp>(__f))
+{
+    this->__set_deferred();
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Rp, class _Fp>
+void
+__deferred_assoc_state<_Rp, _Fp>::__execute()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        this->set_value(__func_());
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->set_exception(current_exception());
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template <class _Fp>
+class __deferred_assoc_state<void, _Fp>
+    : public __assoc_sub_state
+{
+    typedef __assoc_sub_state base;
+
+    _Fp __func_;
+
+public:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    explicit __deferred_assoc_state(_Fp&& __f);
+#endif
+
+    virtual void __execute();
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+__deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
+    : __func_(_VSTD::forward<_Fp>(__f))
+{
+    this->__set_deferred();
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Fp>
+void
+__deferred_assoc_state<void, _Fp>::__execute()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __func_();
+        this->set_value();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->set_exception(current_exception());
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template <class _Rp, class _Fp>
+class __async_assoc_state
+    : public __assoc_state<_Rp>
+{
+    typedef __assoc_state<_Rp> base;
+
+    _Fp __func_;
+
+    virtual void __on_zero_shared() _NOEXCEPT;
+public:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    explicit __async_assoc_state(_Fp&& __f);
+#endif
+
+    virtual void __execute();
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Rp, class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
+    : __func_(_VSTD::forward<_Fp>(__f))
+{
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Rp, class _Fp>
+void
+__async_assoc_state<_Rp, _Fp>::__execute()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        this->set_value(__func_());
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->set_exception(current_exception());
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template <class _Rp, class _Fp>
+void
+__async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT
+{
+    this->wait();
+    base::__on_zero_shared();
+}
+
+template <class _Fp>
+class __async_assoc_state<void, _Fp>
+    : public __assoc_sub_state
+{
+    typedef __assoc_sub_state base;
+
+    _Fp __func_;
+
+    virtual void __on_zero_shared() _NOEXCEPT;
+public:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    explicit __async_assoc_state(_Fp&& __f);
+#endif
+
+    virtual void __execute();
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+__async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
+    : __func_(_VSTD::forward<_Fp>(__f))
+{
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Fp>
+void
+__async_assoc_state<void, _Fp>::__execute()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __func_();
+        this->set_value();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->set_exception(current_exception());
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template <class _Fp>
+void
+__async_assoc_state<void, _Fp>::__on_zero_shared() _NOEXCEPT
+{
+    this->wait();
+    base::__on_zero_shared();
+}
+
+template <class _Rp> class _LIBCPP_TYPE_VIS_ONLY promise;
+template <class _Rp> class _LIBCPP_TYPE_VIS_ONLY shared_future;
+
+// future
+
+template <class _Rp> class _LIBCPP_TYPE_VIS_ONLY future;
+
+template <class _Rp, class _Fp>
+future<_Rp>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+__make_deferred_assoc_state(_Fp&& __f);
+#else
+__make_deferred_assoc_state(_Fp __f);
+#endif
+
+template <class _Rp, class _Fp>
+future<_Rp>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+__make_async_assoc_state(_Fp&& __f);
+#else
+__make_async_assoc_state(_Fp __f);
+#endif
+
+template <class _Rp>
+class _LIBCPP_TYPE_VIS_ONLY future
+{
+    __assoc_state<_Rp>* __state_;
+
+    explicit future(__assoc_state<_Rp>* __state);
+
+    template <class> friend class promise;
+    template <class> friend class shared_future;
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_async_assoc_state(_Fp&& __f);
+#else
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_deferred_assoc_state(_Fp __f);
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_async_assoc_state(_Fp __f);
+#endif
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    future() _NOEXCEPT : __state_(nullptr) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    future(future&& __rhs) _NOEXCEPT
+        : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
+    future(const future&) = delete;
+    future& operator=(const future&) = delete;
+    _LIBCPP_INLINE_VISIBILITY
+    future& operator=(future&& __rhs) _NOEXCEPT
+        {
+            future(std::move(__rhs)).swap(*this);
+            return *this;
+        }
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+private:
+    future(const future&);
+    future& operator=(const future&);
+public:
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~future();
+    shared_future<_Rp> share();
+
+    // retrieving the value
+    _Rp get();
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
+
+    // functions to check state
+    _LIBCPP_INLINE_VISIBILITY
+    bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void wait() const {__state_->wait();}
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
+            {return __state_->wait_for(__rel_time);}
+    template <class _Clock, class _Duration>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
+            {return __state_->wait_until(__abs_time);}
+};
+
+template <class _Rp>
+future<_Rp>::future(__assoc_state<_Rp>* __state)
+    : __state_(__state)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_->__has_future_attached())
+        throw future_error(make_error_code(future_errc::future_already_retrieved));
+#endif
+    __state_->__add_shared();
+    __state_->__set_future_attached();
+}
+
+struct __release_shared_count
+{
+    void operator()(__shared_count* p) {p->__release_shared();}
+};
+
+template <class _Rp>
+future<_Rp>::~future()
+{
+    if (__state_)
+        __state_->__release_shared();
+}
+
+template <class _Rp>
+_Rp
+future<_Rp>::get()
+{
+    unique_ptr<__shared_count, __release_shared_count> __(__state_);
+    __assoc_state<_Rp>* __s = __state_;
+    __state_ = nullptr;
+    return __s->move();
+}
+
+template <class _Rp>
+class _LIBCPP_TYPE_VIS_ONLY future<_Rp&>
+{
+    __assoc_state<_Rp&>* __state_;
+
+    explicit future(__assoc_state<_Rp&>* __state);
+
+    template <class> friend class promise;
+    template <class> friend class shared_future;
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_async_assoc_state(_Fp&& __f);
+#else
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_deferred_assoc_state(_Fp __f);
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_async_assoc_state(_Fp __f);
+#endif
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    future() _NOEXCEPT : __state_(nullptr) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    future(future&& __rhs) _NOEXCEPT
+        : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
+    future(const future&) = delete;
+    future& operator=(const future&) = delete;
+    _LIBCPP_INLINE_VISIBILITY
+    future& operator=(future&& __rhs) _NOEXCEPT
+        {
+            future(std::move(__rhs)).swap(*this);
+            return *this;
+        }
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+private:
+    future(const future&);
+    future& operator=(const future&);
+public:
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~future();
+    shared_future<_Rp&> share();
+
+    // retrieving the value
+    _Rp& get();
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
+
+    // functions to check state
+    _LIBCPP_INLINE_VISIBILITY
+    bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void wait() const {__state_->wait();}
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
+            {return __state_->wait_for(__rel_time);}
+    template <class _Clock, class _Duration>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
+            {return __state_->wait_until(__abs_time);}
+};
+
+template <class _Rp>
+future<_Rp&>::future(__assoc_state<_Rp&>* __state)
+    : __state_(__state)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_->__has_future_attached())
+        throw future_error(make_error_code(future_errc::future_already_retrieved));
+#endif
+    __state_->__add_shared();
+    __state_->__set_future_attached();
+}
+
+template <class _Rp>
+future<_Rp&>::~future()
+{
+    if (__state_)
+        __state_->__release_shared();
+}
+
+template <class _Rp>
+_Rp&
+future<_Rp&>::get()
+{
+    unique_ptr<__shared_count, __release_shared_count> __(__state_);
+    __assoc_state<_Rp&>* __s = __state_;
+    __state_ = nullptr;
+    return __s->copy();
+}
+
+template <>
+class _LIBCPP_TYPE_VIS future<void>
+{
+    __assoc_sub_state* __state_;
+
+    explicit future(__assoc_sub_state* __state);
+
+    template <class> friend class promise;
+    template <class> friend class shared_future;
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_async_assoc_state(_Fp&& __f);
+#else
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_deferred_assoc_state(_Fp __f);
+    template <class _R1, class _Fp>
+        friend future<_R1> __make_async_assoc_state(_Fp __f);
+#endif
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    future() _NOEXCEPT : __state_(nullptr) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    future(future&& __rhs) _NOEXCEPT
+        : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
+    future(const future&) = delete;
+    future& operator=(const future&) = delete;
+    _LIBCPP_INLINE_VISIBILITY
+    future& operator=(future&& __rhs) _NOEXCEPT
+        {
+            future(std::move(__rhs)).swap(*this);
+            return *this;
+        }
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+private:
+    future(const future&);
+    future& operator=(const future&);
+public:
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~future();
+    shared_future<void> share();
+
+    // retrieving the value
+    void get();
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
+
+    // functions to check state
+    _LIBCPP_INLINE_VISIBILITY
+    bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void wait() const {__state_->wait();}
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
+            {return __state_->wait_for(__rel_time);}
+    template <class _Clock, class _Duration>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
+            {return __state_->wait_until(__abs_time);}
+};
+
+template <class _Rp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT
+{
+    __x.swap(__y);
+}
+
+// promise<R>
+
+template <class _Callable> class packaged_task;
+
+template <class _Rp>
+class _LIBCPP_TYPE_VIS_ONLY promise
+{
+    __assoc_state<_Rp>* __state_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+
+    template <class> friend class packaged_task;
+public:
+    promise();
+    template <class _Alloc>
+        promise(allocator_arg_t, const _Alloc& __a);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    promise(promise&& __rhs) _NOEXCEPT
+        : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
+    promise(const promise& __rhs) = delete;
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+private:
+    promise(const promise& __rhs);
+public:
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~promise();
+
+    // assignment
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    promise& operator=(promise&& __rhs) _NOEXCEPT
+        {
+            promise(std::move(__rhs)).swap(*this);
+            return *this;
+        }
+    promise& operator=(const promise& __rhs) = delete;
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+private:
+    promise& operator=(const promise& __rhs);
+public:
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
+
+    // retrieving the result
+    future<_Rp> get_future();
+
+    // setting the result
+    void set_value(const _Rp& __r);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void set_value(_Rp&& __r);
+#endif
+    void set_exception(exception_ptr __p);
+
+    // setting the result with deferred notification
+    void set_value_at_thread_exit(const _Rp& __r);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void set_value_at_thread_exit(_Rp&& __r);
+#endif
+    void set_exception_at_thread_exit(exception_ptr __p);
+};
+
+template <class _Rp>
+promise<_Rp>::promise()
+    : __state_(new __assoc_state<_Rp>)
+{
+}
+
+template <class _Rp>
+template <class _Alloc>
+promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0)
+{
+    typedef __assoc_state_alloc<_Rp, _Alloc> _State;
+    typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
+    typedef __allocator_destructor<_A2> _D2;
+    _A2 __a(__a0);
+    unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
+    __state_ = _VSTD::addressof(*__hold.release());
+}
+
+template <class _Rp>
+promise<_Rp>::~promise()
+{
+    if (__state_)
+    {
+        if (!__state_->__has_value() && __state_->use_count() > 1)
+            __state_->set_exception(make_exception_ptr(
+                      future_error(make_error_code(future_errc::broken_promise))
+                                                      ));
+        __state_->__release_shared();
+    }
+}
+
+template <class _Rp>
+future<_Rp>
+promise<_Rp>::get_future()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    return future<_Rp>(__state_);
+}
+
+template <class _Rp>
+void
+promise<_Rp>::set_value(const _Rp& __r)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    __state_->set_value(__r);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Rp>
+void
+promise<_Rp>::set_value(_Rp&& __r)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    __state_->set_value(_VSTD::move(__r));
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Rp>
+void
+promise<_Rp>::set_exception(exception_ptr __p)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    __state_->set_exception(__p);
+}
+
+template <class _Rp>
+void
+promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    __state_->set_value_at_thread_exit(__r);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Rp>
+void
+promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    __state_->set_value_at_thread_exit(_VSTD::move(__r));
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Rp>
+void
+promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    __state_->set_exception_at_thread_exit(__p);
+}
+
+// promise<R&>
+
+template <class _Rp>
+class _LIBCPP_TYPE_VIS_ONLY promise<_Rp&>
+{
+    __assoc_state<_Rp&>* __state_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+
+    template <class> friend class packaged_task;
+
+public:
+    promise();
+    template <class _Allocator>
+        promise(allocator_arg_t, const _Allocator& __a);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    promise(promise&& __rhs) _NOEXCEPT
+        : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
+    promise(const promise& __rhs) = delete;
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+private:
+    promise(const promise& __rhs);
+public:
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~promise();
+
+    // assignment
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    promise& operator=(promise&& __rhs) _NOEXCEPT
+        {
+            promise(std::move(__rhs)).swap(*this);
+            return *this;
+        }
+    promise& operator=(const promise& __rhs) = delete;
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+private:
+    promise& operator=(const promise& __rhs);
+public:
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
+
+    // retrieving the result
+    future<_Rp&> get_future();
+
+    // setting the result
+    void set_value(_Rp& __r);
+    void set_exception(exception_ptr __p);
+
+    // setting the result with deferred notification
+    void set_value_at_thread_exit(_Rp&);
+    void set_exception_at_thread_exit(exception_ptr __p);
+};
+
+template <class _Rp>
+promise<_Rp&>::promise()
+    : __state_(new __assoc_state<_Rp&>)
+{
+}
+
+template <class _Rp>
+template <class _Alloc>
+promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0)
+{
+    typedef __assoc_state_alloc<_Rp&, _Alloc> _State;
+    typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
+    typedef __allocator_destructor<_A2> _D2;
+    _A2 __a(__a0);
+    unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
+    __state_ = _VSTD::addressof(*__hold.release());
+}
+
+template <class _Rp>
+promise<_Rp&>::~promise()
+{
+    if (__state_)
+    {
+        if (!__state_->__has_value() && __state_->use_count() > 1)
+            __state_->set_exception(make_exception_ptr(
+                      future_error(make_error_code(future_errc::broken_promise))
+                                                      ));
+        __state_->__release_shared();
+    }
+}
+
+template <class _Rp>
+future<_Rp&>
+promise<_Rp&>::get_future()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    return future<_Rp&>(__state_);
+}
+
+template <class _Rp>
+void
+promise<_Rp&>::set_value(_Rp& __r)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    __state_->set_value(__r);
+}
+
+template <class _Rp>
+void
+promise<_Rp&>::set_exception(exception_ptr __p)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    __state_->set_exception(__p);
+}
+
+template <class _Rp>
+void
+promise<_Rp&>::set_value_at_thread_exit(_Rp& __r)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    __state_->set_value_at_thread_exit(__r);
+}
+
+template <class _Rp>
+void
+promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+#endif
+    __state_->set_exception_at_thread_exit(__p);
+}
+
+// promise<void>
+
+template <>
+class _LIBCPP_TYPE_VIS promise<void>
+{
+    __assoc_sub_state* __state_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+
+    template <class> friend class packaged_task;
+
+public:
+    promise();
+    template <class _Allocator>
+        promise(allocator_arg_t, const _Allocator& __a);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    promise(promise&& __rhs) _NOEXCEPT
+        : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
+    promise(const promise& __rhs) = delete;
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+private:
+    promise(const promise& __rhs);
+public:
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~promise();
+
+    // assignment
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    promise& operator=(promise&& __rhs) _NOEXCEPT
+        {
+            promise(std::move(__rhs)).swap(*this);
+            return *this;
+        }
+    promise& operator=(const promise& __rhs) = delete;
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+private:
+    promise& operator=(const promise& __rhs);
+public:
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
+
+    // retrieving the result
+    future<void> get_future();
+
+    // setting the result
+    void set_value();
+    void set_exception(exception_ptr __p);
+
+    // setting the result with deferred notification
+    void set_value_at_thread_exit();
+    void set_exception_at_thread_exit(exception_ptr __p);
+};
+
+template <class _Alloc>
+promise<void>::promise(allocator_arg_t, const _Alloc& __a0)
+{
+    typedef __assoc_sub_state_alloc<_Alloc> _State;
+    typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
+    typedef __allocator_destructor<_A2> _D2;
+    _A2 __a(__a0);
+    unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
+    __state_ = _VSTD::addressof(*__hold.release());
+}
+
+template <class _Rp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(promise<_Rp>& __x, promise<_Rp>& __y) _NOEXCEPT
+{
+    __x.swap(__y);
+}
+
+template <class _Rp, class _Alloc>
+    struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<promise<_Rp>, _Alloc>
+        : public true_type {};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+// packaged_task
+
+template<class _Fp> class __packaged_task_base;
+
+template<class _Rp, class ..._ArgTypes>
+class __packaged_task_base<_Rp(_ArgTypes...)>
+{
+    __packaged_task_base(const __packaged_task_base&);
+    __packaged_task_base& operator=(const __packaged_task_base&);
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __packaged_task_base() {}
+    _LIBCPP_INLINE_VISIBILITY
+    virtual ~__packaged_task_base() {}
+    virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0;
+    virtual void destroy() = 0;
+    virtual void destroy_deallocate() = 0;
+    virtual _Rp operator()(_ArgTypes&& ...) = 0;
+};
+
+template<class _FD, class _Alloc, class _FB> class __packaged_task_func;
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>
+    : public  __packaged_task_base<_Rp(_ArgTypes...)>
+{
+    __compressed_pair<_Fp, _Alloc> __f_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __packaged_task_func(const _Fp& __f) : __f_(__f) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __packaged_task_func(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    __packaged_task_func(const _Fp& __f, const _Alloc& __a)
+        : __f_(__f, __a) {}
+    _LIBCPP_INLINE_VISIBILITY
+    __packaged_task_func(_Fp&& __f, const _Alloc& __a)
+        : __f_(_VSTD::move(__f), __a) {}
+    virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) _NOEXCEPT;
+    virtual void destroy();
+    virtual void destroy_deallocate();
+    virtual _Rp operator()(_ArgTypes&& ... __args);
+};
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+void
+__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
+                              __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT
+{
+    ::new (__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second()));
+}
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+void
+__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy()
+{
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+}
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+void
+__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate()
+{
+    typedef typename __allocator_traits_rebind<_Alloc, __packaged_task_func>::type _Ap;
+    typedef allocator_traits<_Ap> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+    _Ap __a(__f_.second());
+    __f_.~__compressed_pair<_Fp, _Alloc>();
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
+}
+
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+_Rp
+__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
+{
+    return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
+}
+
+template <class _Callable> class __packaged_task_function;
+
+template<class _Rp, class ..._ArgTypes>
+class __packaged_task_function<_Rp(_ArgTypes...)>
+{
+    typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
+    typename aligned_storage<3*sizeof(void*)>::type __buf_;
+    __base* __f_;
+
+public:
+    typedef _Rp result_type;
+
+    // construct/copy/destroy:
+    _LIBCPP_INLINE_VISIBILITY
+    __packaged_task_function() _NOEXCEPT : __f_(nullptr) {}
+    template<class _Fp>
+      __packaged_task_function(_Fp&& __f);
+    template<class _Fp, class _Alloc>
+      __packaged_task_function(allocator_arg_t, const _Alloc& __a, _Fp&& __f);
+
+    __packaged_task_function(__packaged_task_function&&) _NOEXCEPT;
+    __packaged_task_function& operator=(__packaged_task_function&&) _NOEXCEPT;
+
+    __packaged_task_function(const __packaged_task_function&) =  delete;
+    __packaged_task_function& operator=(const __packaged_task_function&) =  delete;
+
+    ~__packaged_task_function();
+
+    void swap(__packaged_task_function&) _NOEXCEPT;
+
+    _Rp operator()(_ArgTypes...) const;
+};
+
+template<class _Rp, class ..._ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) _NOEXCEPT
+{
+    if (__f.__f_ == nullptr)
+        __f_ = nullptr;
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__move_to(__f_);
+    }
+    else
+    {
+        __f_ = __f.__f_;
+        __f.__f_ = nullptr;
+    }
+}
+
+template<class _Rp, class ..._ArgTypes>
+template <class _Fp>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
+    : __f_(nullptr)
+{
+    typedef typename remove_reference<typename decay<_Fp>::type>::type _FR;
+    typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF;
+    if (sizeof(_FF) <= sizeof(__buf_))
+    {
+        __f_ = (__base*)&__buf_;
+        ::new (__f_) _FF(_VSTD::forward<_Fp>(__f));
+    }
+    else
+    {
+        typedef allocator<_FF> _Ap;
+        _Ap __a;
+        typedef __allocator_destructor<_Ap> _Dp;
+        unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+        ::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), allocator<_FR>(__a));
+        __f_ = __hold.release();
+    }
+}
+
+template<class _Rp, class ..._ArgTypes>
+template <class _Fp, class _Alloc>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
+                                  allocator_arg_t, const _Alloc& __a0, _Fp&& __f)
+    : __f_(nullptr)
+{
+    typedef typename remove_reference<typename decay<_Fp>::type>::type _FR;
+    typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF;
+    if (sizeof(_FF) <= sizeof(__buf_))
+    {
+        __f_ = (__base*)&__buf_;
+        ::new (__f_) _FF(_VSTD::forward<_Fp>(__f));
+    }
+    else
+    {
+        typedef typename __allocator_traits_rebind<_Alloc, _FF>::type _Ap;
+        _Ap __a(__a0);
+        typedef __allocator_destructor<_Ap> _Dp;
+        unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+        ::new (static_cast<void*>(_VSTD::addressof(*__hold.get())))
+            _FF(_VSTD::forward<_Fp>(__f), _Alloc(__a));
+        __f_ = _VSTD::addressof(*__hold.release());
+    }
+}
+
+template<class _Rp, class ..._ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>&
+__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+    __f_ = nullptr;
+    if (__f.__f_ == nullptr)
+        __f_ = nullptr;
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f_ = (__base*)&__buf_;
+        __f.__f_->__move_to(__f_);
+    }
+    else
+    {
+        __f_ = __f.__f_;
+        __f.__f_ = nullptr;
+    }
+    return *this;
+}
+
+template<class _Rp, class ..._ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function()
+{
+    if (__f_ == (__base*)&__buf_)
+        __f_->destroy();
+    else if (__f_)
+        __f_->destroy_deallocate();
+}
+
+template<class _Rp, class ..._ArgTypes>
+void
+__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT
+{
+    if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
+    {
+        typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
+        __base* __t = (__base*)&__tempbuf;
+        __f_->__move_to(__t);
+        __f_->destroy();
+        __f_ = nullptr;
+        __f.__f_->__move_to((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = nullptr;
+        __f_ = (__base*)&__buf_;
+        __t->__move_to((__base*)&__f.__buf_);
+        __t->destroy();
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f_ == (__base*)&__buf_)
+    {
+        __f_->__move_to((__base*)&__f.__buf_);
+        __f_->destroy();
+        __f_ = __f.__f_;
+        __f.__f_ = (__base*)&__f.__buf_;
+    }
+    else if (__f.__f_ == (__base*)&__f.__buf_)
+    {
+        __f.__f_->__move_to((__base*)&__buf_);
+        __f.__f_->destroy();
+        __f.__f_ = __f_;
+        __f_ = (__base*)&__buf_;
+    }
+    else
+        _VSTD::swap(__f_, __f.__f_);
+}
+
+template<class _Rp, class ..._ArgTypes>
+inline _LIBCPP_INLINE_VISIBILITY
+_Rp
+__packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
+{
+    return (*__f_)(_VSTD::forward<_ArgTypes>(__arg)...);
+}
+
+template<class _Rp, class ..._ArgTypes>
+class _LIBCPP_TYPE_VIS_ONLY packaged_task<_Rp(_ArgTypes...)>
+{
+public:
+    typedef _Rp result_type;
+
+private:
+    __packaged_task_function<result_type(_ArgTypes...)> __f_;
+    promise<result_type>                                __p_;
+
+public:
+    // construction and destruction
+    _LIBCPP_INLINE_VISIBILITY
+    packaged_task() _NOEXCEPT : __p_(nullptr) {}
+    template <class _Fp,
+              class = typename enable_if
+              <
+                  !is_same<
+                      typename decay<_Fp>::type, 
+                      packaged_task
+                      >::value
+                  >::type
+             >
+        _LIBCPP_INLINE_VISIBILITY
+        explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
+    template <class _Fp, class _Allocator,
+              class = typename enable_if
+              <
+                  !is_same<
+                      typename decay<_Fp>::type, 
+                      packaged_task
+                      >::value
+                  >::type
+              >
+        _LIBCPP_INLINE_VISIBILITY
+        packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
+             : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
+               __p_(allocator_arg, __a) {}
+    // ~packaged_task() = default;
+
+    // no copy
+    packaged_task(const packaged_task&) = delete;
+    packaged_task& operator=(const packaged_task&) = delete;
+
+    // move support
+    _LIBCPP_INLINE_VISIBILITY
+    packaged_task(packaged_task&& __other) _NOEXCEPT
+        : __f_(_VSTD::move(__other.__f_)), __p_(_VSTD::move(__other.__p_)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    packaged_task& operator=(packaged_task&& __other) _NOEXCEPT
+    {
+        __f_ = _VSTD::move(__other.__f_);
+        __p_ = _VSTD::move(__other.__p_);
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(packaged_task& __other) _NOEXCEPT
+    {
+        __f_.swap(__other.__f_);
+        __p_.swap(__other.__p_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;}
+
+    // result retrieval
+    _LIBCPP_INLINE_VISIBILITY
+    future<result_type> get_future() {return __p_.get_future();}
+
+    // execution
+    void operator()(_ArgTypes... __args);
+    void make_ready_at_thread_exit(_ArgTypes... __args);
+
+    void reset();
+};
+
+template<class _Rp, class ..._ArgTypes>
+void
+packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__p_.__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+    if (__p_.__state_->__has_value())
+        throw future_error(make_error_code(future_errc::promise_already_satisfied));
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __p_.set_value(__f_(_VSTD::forward<_ArgTypes>(__args)...));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __p_.set_exception(current_exception());
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template<class _Rp, class ..._ArgTypes>
+void
+packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__p_.__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+    if (__p_.__state_->__has_value())
+        throw future_error(make_error_code(future_errc::promise_already_satisfied));
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __p_.set_value_at_thread_exit(__f_(_VSTD::forward<_ArgTypes>(__args)...));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __p_.set_exception_at_thread_exit(current_exception());
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template<class _Rp, class ..._ArgTypes>
+void
+packaged_task<_Rp(_ArgTypes...)>::reset()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (!valid())
+        throw future_error(make_error_code(future_errc::no_state));
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    __p_ = promise<result_type>();
+}
+
+template<class ..._ArgTypes>
+class _LIBCPP_TYPE_VIS_ONLY packaged_task<void(_ArgTypes...)>
+{
+public:
+    typedef void result_type;
+
+private:
+    __packaged_task_function<result_type(_ArgTypes...)> __f_;
+    promise<result_type>                                __p_;
+
+public:
+    // construction and destruction
+    _LIBCPP_INLINE_VISIBILITY
+    packaged_task() _NOEXCEPT : __p_(nullptr) {}
+    template <class _Fp,
+              class = typename enable_if
+              <
+                  !is_same<
+                      typename decay<_Fp>::type, 
+                      packaged_task
+                      >::value
+                  >::type
+              >
+        _LIBCPP_INLINE_VISIBILITY
+        explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
+    template <class _Fp, class _Allocator,
+              class = typename enable_if
+              <
+                  !is_same<
+                      typename decay<_Fp>::type, 
+                      packaged_task
+                      >::value
+                  >::type
+              >    
+        _LIBCPP_INLINE_VISIBILITY
+        packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
+             : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
+               __p_(allocator_arg, __a) {}
+    // ~packaged_task() = default;
+
+    // no copy
+    packaged_task(const packaged_task&) = delete;
+    packaged_task& operator=(const packaged_task&) = delete;
+
+    // move support
+    _LIBCPP_INLINE_VISIBILITY
+    packaged_task(packaged_task&& __other) _NOEXCEPT
+        : __f_(_VSTD::move(__other.__f_)), __p_(_VSTD::move(__other.__p_)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    packaged_task& operator=(packaged_task&& __other) _NOEXCEPT
+    {
+        __f_ = _VSTD::move(__other.__f_);
+        __p_ = _VSTD::move(__other.__p_);
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(packaged_task& __other) _NOEXCEPT
+    {
+        __f_.swap(__other.__f_);
+        __p_.swap(__other.__p_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;}
+
+    // result retrieval
+    _LIBCPP_INLINE_VISIBILITY
+    future<result_type> get_future() {return __p_.get_future();}
+
+    // execution
+    void operator()(_ArgTypes... __args);
+    void make_ready_at_thread_exit(_ArgTypes... __args);
+
+    void reset();
+};
+
+template<class ..._ArgTypes>
+void
+packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__p_.__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+    if (__p_.__state_->__has_value())
+        throw future_error(make_error_code(future_errc::promise_already_satisfied));
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __f_(_VSTD::forward<_ArgTypes>(__args)...);
+        __p_.set_value();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __p_.set_exception(current_exception());
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template<class ..._ArgTypes>
+void
+packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__p_.__state_ == nullptr)
+        throw future_error(make_error_code(future_errc::no_state));
+    if (__p_.__state_->__has_value())
+        throw future_error(make_error_code(future_errc::promise_already_satisfied));
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __f_(_VSTD::forward<_ArgTypes>(__args)...);
+        __p_.set_value_at_thread_exit();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __p_.set_exception_at_thread_exit(current_exception());
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template<class ..._ArgTypes>
+void
+packaged_task<void(_ArgTypes...)>::reset()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (!valid())
+        throw future_error(make_error_code(future_errc::no_state));
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    __p_ = promise<result_type>();
+}
+
+template <class _Callable>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(packaged_task<_Callable>& __x, packaged_task<_Callable>& __y) _NOEXCEPT
+{
+    __x.swap(__y);
+}
+
+template <class _Callable, class _Alloc>
+struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<packaged_task<_Callable>, _Alloc>
+    : public true_type {};
+
+template <class _Rp, class _Fp>
+future<_Rp>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+__make_deferred_assoc_state(_Fp&& __f)
+#else
+__make_deferred_assoc_state(_Fp __f)
+#endif
+{
+    unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count>
+        __h(new __deferred_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f)));
+    return future<_Rp>(__h.get());
+}
+
+template <class _Rp, class _Fp>
+future<_Rp>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+__make_async_assoc_state(_Fp&& __f)
+#else
+__make_async_assoc_state(_Fp __f)
+#endif
+{
+    unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count>
+        __h(new __async_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f)));
+    _VSTD::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach();
+    return future<_Rp>(__h.get());
+}
+
+template <class _Fp, class... _Args>
+class __async_func
+{
+    tuple<_Fp, _Args...> __f_;
+
+public:
+    typedef typename __invoke_of<_Fp, _Args...>::type _Rp;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __async_func(_Fp&& __f, _Args&&... __args)
+        : __f_(_VSTD::move(__f), _VSTD::move(__args)...) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __async_func(__async_func&& __f) : __f_(_VSTD::move(__f.__f_)) {}
+
+    _Rp operator()()
+    {
+        typedef typename __make_tuple_indices<1+sizeof...(_Args), 1>::type _Index;
+        return __execute(_Index());
+    }
+private:
+    template <size_t ..._Indices>
+    _Rp
+    __execute(__tuple_indices<_Indices...>)
+    {
+        return __invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
+    }
+};
+
+inline _LIBCPP_INLINE_VISIBILITY bool __does_policy_contain(launch __policy, launch __value )
+{ return (int(__policy) & int(__value)) != 0; }
+
+template <class _Fp, class... _Args>
+future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
+async(launch __policy, _Fp&& __f, _Args&&... __args)
+{
+    typedef __async_func<typename decay<_Fp>::type, typename decay<_Args>::type...> _BF;
+    typedef typename _BF::_Rp _Rp;
+
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif
+        if (__does_policy_contain(__policy, launch::async))
+        return _VSTD::__make_async_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)),
+                                                     __decay_copy(_VSTD::forward<_Args>(__args))...));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch ( ... ) { if (__policy == launch::async) throw ; }
+#endif
+
+    if (__does_policy_contain(__policy, launch::deferred))
+        return _VSTD::__make_deferred_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)),
+                                                        __decay_copy(_VSTD::forward<_Args>(__args))...));
+    return future<_Rp>{};
+}
+
+template <class _Fp, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
+async(_Fp&& __f, _Args&&... __args)
+{
+    return _VSTD::async(launch::any, _VSTD::forward<_Fp>(__f),
+                                    _VSTD::forward<_Args>(__args)...);
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+// shared_future
+
+template <class _Rp>
+class _LIBCPP_TYPE_VIS_ONLY shared_future
+{
+    __assoc_state<_Rp>* __state_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future() _NOEXCEPT : __state_(nullptr) {}
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
+        {if (__state_) __state_->__add_shared();}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_)
+        {__f.__state_ = nullptr;}
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
+        {__rhs.__state_ = nullptr;}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~shared_future();
+    shared_future& operator=(const shared_future& __rhs);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
+        {
+            shared_future(std::move(__rhs)).swap(*this);
+            return *this;
+        }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    // retrieving the value
+    _LIBCPP_INLINE_VISIBILITY
+    const _Rp& get() const {return __state_->copy();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
+
+    // functions to check state
+    _LIBCPP_INLINE_VISIBILITY
+    bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void wait() const {__state_->wait();}
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
+            {return __state_->wait_for(__rel_time);}
+    template <class _Clock, class _Duration>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
+            {return __state_->wait_until(__abs_time);}
+};
+
+template <class _Rp>
+shared_future<_Rp>::~shared_future()
+{
+    if (__state_)
+        __state_->__release_shared();
+}
+
+template <class _Rp>
+shared_future<_Rp>&
+shared_future<_Rp>::operator=(const shared_future& __rhs)
+{
+    if (__rhs.__state_)
+        __rhs.__state_->__add_shared();
+    if (__state_)
+        __state_->__release_shared();
+    __state_ = __rhs.__state_;
+    return *this;
+}
+
+template <class _Rp>
+class _LIBCPP_TYPE_VIS_ONLY shared_future<_Rp&>
+{
+    __assoc_state<_Rp&>* __state_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future() _NOEXCEPT : __state_(nullptr) {}
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
+        {if (__state_) __state_->__add_shared();}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_)
+        {__f.__state_ = nullptr;}
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
+        {__rhs.__state_ = nullptr;}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~shared_future();
+    shared_future& operator=(const shared_future& __rhs);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
+        {
+            shared_future(std::move(__rhs)).swap(*this);
+            return *this;
+        }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    // retrieving the value
+    _LIBCPP_INLINE_VISIBILITY
+    _Rp& get() const {return __state_->copy();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
+
+    // functions to check state
+    _LIBCPP_INLINE_VISIBILITY
+    bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void wait() const {__state_->wait();}
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
+            {return __state_->wait_for(__rel_time);}
+    template <class _Clock, class _Duration>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
+            {return __state_->wait_until(__abs_time);}
+};
+
+template <class _Rp>
+shared_future<_Rp&>::~shared_future()
+{
+    if (__state_)
+        __state_->__release_shared();
+}
+
+template <class _Rp>
+shared_future<_Rp&>&
+shared_future<_Rp&>::operator=(const shared_future& __rhs)
+{
+    if (__rhs.__state_)
+        __rhs.__state_->__add_shared();
+    if (__state_)
+        __state_->__release_shared();
+    __state_ = __rhs.__state_;
+    return *this;
+}
+
+template <>
+class _LIBCPP_TYPE_VIS shared_future<void>
+{
+    __assoc_sub_state* __state_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future() _NOEXCEPT : __state_(nullptr) {}
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
+        {if (__state_) __state_->__add_shared();}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future(future<void>&& __f) _NOEXCEPT : __state_(__f.__state_)
+        {__f.__state_ = nullptr;}
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
+        {__rhs.__state_ = nullptr;}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~shared_future();
+    shared_future& operator=(const shared_future& __rhs);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
+        {
+            shared_future(std::move(__rhs)).swap(*this);
+            return *this;
+        }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    // retrieving the value
+    _LIBCPP_INLINE_VISIBILITY
+    void get() const {__state_->copy();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
+
+    // functions to check state
+    _LIBCPP_INLINE_VISIBILITY
+    bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void wait() const {__state_->wait();}
+    template <class _Rep, class _Period>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
+            {return __state_->wait_for(__rel_time);}
+    template <class _Clock, class _Duration>
+        _LIBCPP_INLINE_VISIBILITY
+        future_status
+        wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
+            {return __state_->wait_until(__abs_time);}
+};
+
+template <class _Rp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
+{
+    __x.swap(__y);
+}
+
+template <class _Rp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_future<_Rp>
+future<_Rp>::share()
+{
+    return shared_future<_Rp>(_VSTD::move(*this));
+}
+
+template <class _Rp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_future<_Rp&>
+future<_Rp&>::share()
+{
+    return shared_future<_Rp&>(_VSTD::move(*this));
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+inline _LIBCPP_INLINE_VISIBILITY
+shared_future<void>
+future<void>::share()
+{
+    return shared_future<void>(_VSTD::move(*this));
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // !_LIBCPP_HAS_NO_THREADS
+
+#endif  // _LIBCPP_FUTURE

Property changes on: lab4/.minix-src/include/c++/future
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/ios
===================================================================
--- lab4/.minix-src/include/c++/ios	(nonexistent)
+++ lab4/.minix-src/include/c++/ios	(revision 13)
@@ -0,0 +1,1025 @@
+// -*- C++ -*-
+//===---------------------------- ios -------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_IOS
+#define _LIBCPP_IOS
+
+/*
+    ios synopsis
+
+#include <iosfwd>
+
+namespace std
+{
+
+typedef OFF_T streamoff;
+typedef SZ_T streamsize;
+template <class stateT> class fpos;
+
+class ios_base
+{
+public:
+    class failure;
+
+    typedef T1 fmtflags;
+    static constexpr fmtflags boolalpha;
+    static constexpr fmtflags dec;
+    static constexpr fmtflags fixed;
+    static constexpr fmtflags hex;
+    static constexpr fmtflags internal;
+    static constexpr fmtflags left;
+    static constexpr fmtflags oct;
+    static constexpr fmtflags right;
+    static constexpr fmtflags scientific;
+    static constexpr fmtflags showbase;
+    static constexpr fmtflags showpoint;
+    static constexpr fmtflags showpos;
+    static constexpr fmtflags skipws;
+    static constexpr fmtflags unitbuf;
+    static constexpr fmtflags uppercase;
+    static constexpr fmtflags adjustfield;
+    static constexpr fmtflags basefield;
+    static constexpr fmtflags floatfield;
+
+    typedef T2 iostate;
+    static constexpr iostate badbit;
+    static constexpr iostate eofbit;
+    static constexpr iostate failbit;
+    static constexpr iostate goodbit;
+
+    typedef T3 openmode;
+    static constexpr openmode app;
+    static constexpr openmode ate;
+    static constexpr openmode binary;
+    static constexpr openmode in;
+    static constexpr openmode out;
+    static constexpr openmode trunc;
+
+    typedef T4 seekdir;
+    static constexpr seekdir beg;
+    static constexpr seekdir cur;
+    static constexpr seekdir end;
+
+    class Init;
+
+    // 27.5.2.2 fmtflags state:
+    fmtflags flags() const;
+    fmtflags flags(fmtflags fmtfl);
+    fmtflags setf(fmtflags fmtfl);
+    fmtflags setf(fmtflags fmtfl, fmtflags mask);
+    void unsetf(fmtflags mask);
+
+    streamsize precision() const;
+    streamsize precision(streamsize prec);
+    streamsize width() const;
+    streamsize width(streamsize wide);
+
+    // 27.5.2.3 locales:
+    locale imbue(const locale& loc);
+    locale getloc() const;
+
+    // 27.5.2.5 storage:
+    static int xalloc();
+    long& iword(int index);
+    void*& pword(int index);
+
+    // destructor
+    virtual ~ios_base();
+
+    // 27.5.2.6 callbacks;
+    enum event { erase_event, imbue_event, copyfmt_event };
+    typedef void (*event_callback)(event, ios_base&, int index);
+    void register_callback(event_callback fn, int index);
+
+    ios_base(const ios_base&) = delete;
+    ios_base& operator=(const ios_base&) = delete;
+
+    static bool sync_with_stdio(bool sync = true);
+
+protected:
+    ios_base();
+};
+
+template <class charT, class traits = char_traits<charT> >
+class basic_ios
+    : public ios_base
+{
+public:
+    // types:
+    typedef charT char_type;
+    typedef typename traits::int_type int_type;
+    typedef typename traits::pos_type pos_type;
+    typedef typename traits::off_type off_type;
+    typedef traits traits_type;
+
+    operator unspecified-bool-type() const;
+    bool operator!() const;
+    iostate rdstate() const;
+    void clear(iostate state = goodbit);
+    void setstate(iostate state);
+    bool good() const;
+    bool eof() const;
+    bool fail() const;
+    bool bad() const;
+
+    iostate exceptions() const;
+    void exceptions(iostate except);
+
+    // 27.5.4.1 Constructor/destructor:
+    explicit basic_ios(basic_streambuf<charT,traits>* sb);
+    virtual ~basic_ios();
+
+    // 27.5.4.2 Members:
+    basic_ostream<charT,traits>* tie() const;
+    basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
+
+    basic_streambuf<charT,traits>* rdbuf() const;
+    basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
+
+    basic_ios& copyfmt(const basic_ios& rhs);
+
+    char_type fill() const;
+    char_type fill(char_type ch);
+
+    locale imbue(const locale& loc);
+
+    char narrow(char_type c, char dfault) const;
+    char_type widen(char c) const;
+
+    basic_ios(const basic_ios& ) = delete;
+    basic_ios& operator=(const basic_ios&) = delete;
+
+protected:
+    basic_ios();
+    void init(basic_streambuf<charT,traits>* sb);
+    void move(basic_ios& rhs);
+    void swap(basic_ios& rhs) noexcept;
+    void set_rdbuf(basic_streambuf<charT, traits>* sb);
+};
+
+// 27.5.5, manipulators:
+ios_base& boolalpha (ios_base& str);
+ios_base& noboolalpha(ios_base& str);
+ios_base& showbase (ios_base& str);
+ios_base& noshowbase (ios_base& str);
+ios_base& showpoint (ios_base& str);
+ios_base& noshowpoint(ios_base& str);
+ios_base& showpos (ios_base& str);
+ios_base& noshowpos (ios_base& str);
+ios_base& skipws (ios_base& str);
+ios_base& noskipws (ios_base& str);
+ios_base& uppercase (ios_base& str);
+ios_base& nouppercase(ios_base& str);
+ios_base& unitbuf (ios_base& str);
+ios_base& nounitbuf (ios_base& str);
+
+// 27.5.5.2 adjustfield:
+ios_base& internal (ios_base& str);
+ios_base& left (ios_base& str);
+ios_base& right (ios_base& str);
+
+// 27.5.5.3 basefield:
+ios_base& dec (ios_base& str);
+ios_base& hex (ios_base& str);
+ios_base& oct (ios_base& str);
+
+// 27.5.5.4 floatfield:
+ios_base& fixed (ios_base& str);
+ios_base& scientific (ios_base& str);
+ios_base& hexfloat (ios_base& str);
+ios_base& defaultfloat(ios_base& str);
+
+// 27.5.5.5 error reporting:
+enum class io_errc
+{
+    stream = 1
+};
+
+concept_map ErrorCodeEnum<io_errc> { };
+error_code make_error_code(io_errc e) noexcept; 
+error_condition make_error_condition(io_errc e) noexcept; 
+storage-class-specifier const error_category& iostream_category() noexcept;
+
+}  // std
+
+*/
+
+#include <__config>
+#include <iosfwd>
+#include <__locale>
+#include <system_error>
+
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
+#include <atomic>     // for __xindex_
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+typedef ptrdiff_t streamsize;
+
+class _LIBCPP_TYPE_VIS ios_base
+{
+public:
+    class _LIBCPP_TYPE_VIS failure;
+
+    typedef unsigned int fmtflags;
+    static const fmtflags boolalpha   = 0x0001;
+    static const fmtflags dec         = 0x0002;
+    static const fmtflags fixed       = 0x0004;
+    static const fmtflags hex         = 0x0008;
+    static const fmtflags internal    = 0x0010;
+    static const fmtflags left        = 0x0020;
+    static const fmtflags oct         = 0x0040;
+    static const fmtflags right       = 0x0080;
+    static const fmtflags scientific  = 0x0100;
+    static const fmtflags showbase    = 0x0200;
+    static const fmtflags showpoint   = 0x0400;
+    static const fmtflags showpos     = 0x0800;
+    static const fmtflags skipws      = 0x1000;
+    static const fmtflags unitbuf     = 0x2000;
+    static const fmtflags uppercase   = 0x4000;
+    static const fmtflags adjustfield = left | right | internal;
+    static const fmtflags basefield   = dec | oct | hex;
+    static const fmtflags floatfield  = scientific | fixed;
+
+    typedef unsigned int iostate;
+    typedef iostate      io_state;
+    static const iostate badbit  = 0x1;
+    static const iostate eofbit  = 0x2;
+    static const iostate failbit = 0x4;
+    static const iostate goodbit = 0x0;
+
+    typedef unsigned int openmode;
+    typedef openmode     open_mode;
+    static const openmode app    = 0x01;
+    static const openmode ate    = 0x02;
+    static const openmode binary = 0x04;
+    static const openmode in     = 0x08;
+    static const openmode out    = 0x10;
+    static const openmode trunc  = 0x20;
+
+    enum seekdir {beg, cur, end};
+    typedef seekdir seek_dir;
+
+    typedef _VSTD::streamoff streamoff;
+    typedef _VSTD::streampos streampos;
+
+    class _LIBCPP_TYPE_VIS Init;
+
+    // 27.5.2.2 fmtflags state:
+    _LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
+    _LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
+    _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
+    _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
+    _LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
+
+    _LIBCPP_INLINE_VISIBILITY streamsize precision() const;
+    _LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
+    _LIBCPP_INLINE_VISIBILITY streamsize width() const;
+    _LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
+
+    // 27.5.2.3 locales:
+    locale imbue(const locale& __loc);
+    locale getloc() const;
+
+    // 27.5.2.5 storage:
+    static int xalloc();
+    long& iword(int __index);
+    void*& pword(int __index);
+
+    // destructor
+    virtual ~ios_base();
+
+    // 27.5.2.6 callbacks;
+    enum event { erase_event, imbue_event, copyfmt_event };
+    typedef void (*event_callback)(event, ios_base&, int __index);
+    void register_callback(event_callback __fn, int __index);
+
+private:
+    ios_base(const ios_base&); // = delete;
+    ios_base& operator=(const ios_base&); // = delete;
+
+public:
+    static bool sync_with_stdio(bool __sync = true);
+
+    _LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
+    void clear(iostate __state = goodbit);
+    _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
+
+    _LIBCPP_INLINE_VISIBILITY bool good() const;
+    _LIBCPP_INLINE_VISIBILITY bool eof() const;
+    _LIBCPP_INLINE_VISIBILITY bool fail() const;
+    _LIBCPP_INLINE_VISIBILITY bool bad() const;
+
+    _LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
+    _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __iostate);
+
+    void __set_badbit_and_consider_rethrow();
+    void __set_failbit_and_consider_rethrow();
+
+protected:
+    _LIBCPP_INLINE_VISIBILITY
+    ios_base() {// purposefully does no initialization
+               }
+
+    void init(void* __sb);
+    _LIBCPP_ALWAYS_INLINE void* rdbuf() const {return __rdbuf_;}
+
+    _LIBCPP_ALWAYS_INLINE
+    void rdbuf(void* __sb)
+    {
+        __rdbuf_ = __sb;
+        clear();
+    }
+
+    void __call_callbacks(event);
+    void copyfmt(const ios_base&);
+    void move(ios_base&);
+    void swap(ios_base&) _NOEXCEPT;
+
+    _LIBCPP_ALWAYS_INLINE
+    void set_rdbuf(void* __sb)
+    {
+        __rdbuf_ = __sb;
+    }
+
+private:
+    // All data members must be scalars
+    fmtflags        __fmtflags_;
+    streamsize      __precision_;
+    streamsize      __width_;
+    iostate         __rdstate_;
+    iostate         __exceptions_;
+    void*           __rdbuf_;
+    void*           __loc_;
+    event_callback* __fn_;
+    int*            __index_;
+    size_t          __event_size_;
+    size_t          __event_cap_;
+// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
+// enabled with clang.
+#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+    static atomic<int> __xindex_;
+#else
+    static int      __xindex_;
+#endif
+    long*           __iarray_;
+    size_t          __iarray_size_;
+    size_t          __iarray_cap_;
+    void**          __parray_;
+    size_t          __parray_size_;
+    size_t          __parray_cap_;
+};
+
+//enum class io_errc
+_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
+{
+    stream = 1
+};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc> : public true_type { };
+
+#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc::__lx> : public true_type { };
+#endif
+
+_LIBCPP_FUNC_VIS
+const error_category& iostream_category() _NOEXCEPT;
+
+inline _LIBCPP_INLINE_VISIBILITY
+error_code
+make_error_code(io_errc __e) _NOEXCEPT
+{
+    return error_code(static_cast<int>(__e), iostream_category());
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+error_condition
+make_error_condition(io_errc __e) _NOEXCEPT
+{
+    return error_condition(static_cast<int>(__e), iostream_category());
+}
+
+class _LIBCPP_EXCEPTION_ABI ios_base::failure
+    : public system_error
+{
+public:
+    explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
+    explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
+    virtual ~failure() throw();
+};
+
+class _LIBCPP_TYPE_VIS ios_base::Init
+{
+public:
+    Init();
+    ~Init();
+};
+
+// fmtflags
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base::fmtflags
+ios_base::flags() const
+{
+    return __fmtflags_;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base::fmtflags
+ios_base::flags(fmtflags __fmtfl)
+{
+    fmtflags __r = __fmtflags_;
+    __fmtflags_ = __fmtfl;
+    return __r;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base::fmtflags
+ios_base::setf(fmtflags __fmtfl)
+{
+    fmtflags __r = __fmtflags_;
+    __fmtflags_ |= __fmtfl;
+    return __r;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+ios_base::unsetf(fmtflags __mask)
+{
+    __fmtflags_ &= ~__mask;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base::fmtflags
+ios_base::setf(fmtflags __fmtfl, fmtflags __mask)
+{
+    fmtflags __r = __fmtflags_;
+    unsetf(__mask);
+    __fmtflags_ |= __fmtfl & __mask;
+    return __r;
+}
+
+// precision
+
+inline _LIBCPP_INLINE_VISIBILITY
+streamsize
+ios_base::precision() const
+{
+    return __precision_;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+streamsize
+ios_base::precision(streamsize __prec)
+{
+    streamsize __r = __precision_;
+    __precision_ = __prec;
+    return __r;
+}
+
+// width
+
+inline _LIBCPP_INLINE_VISIBILITY
+streamsize
+ios_base::width() const
+{
+    return __width_;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+streamsize
+ios_base::width(streamsize __wide)
+{
+    streamsize __r = __width_;
+    __width_ = __wide;
+    return __r;
+}
+
+// iostate
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base::iostate
+ios_base::rdstate() const
+{
+    return __rdstate_;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+ios_base::setstate(iostate __state)
+{
+    clear(__rdstate_ | __state);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+ios_base::good() const
+{
+    return __rdstate_ == 0;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+ios_base::eof() const
+{
+    return (__rdstate_ & eofbit) != 0;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+ios_base::fail() const
+{
+    return (__rdstate_ & (failbit | badbit)) != 0;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+ios_base::bad() const
+{
+    return (__rdstate_ & badbit) != 0;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base::iostate
+ios_base::exceptions() const
+{
+    return __exceptions_;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+ios_base::exceptions(iostate __iostate)
+{
+    __exceptions_ = __iostate;
+    clear(__rdstate_);
+}
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_ios
+    : public ios_base
+{
+public:
+    // types:
+    typedef _CharT char_type;
+    typedef _Traits traits_type;
+
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    _LIBCPP_ALWAYS_INLINE
+        _LIBCPP_EXPLICIT
+        operator bool() const {return !fail();}
+    _LIBCPP_ALWAYS_INLINE bool operator!() const    {return  fail();}
+    _LIBCPP_ALWAYS_INLINE iostate rdstate() const   {return ios_base::rdstate();}
+    _LIBCPP_ALWAYS_INLINE void clear(iostate __state = goodbit) {ios_base::clear(__state);}
+    _LIBCPP_ALWAYS_INLINE void setstate(iostate __state) {ios_base::setstate(__state);}
+    _LIBCPP_ALWAYS_INLINE bool good() const {return ios_base::good();}
+    _LIBCPP_ALWAYS_INLINE bool eof() const  {return ios_base::eof();}
+    _LIBCPP_ALWAYS_INLINE bool fail() const {return ios_base::fail();}
+    _LIBCPP_ALWAYS_INLINE bool bad() const  {return ios_base::bad();}
+
+    _LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
+    _LIBCPP_ALWAYS_INLINE void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
+
+    // 27.5.4.1 Constructor/destructor:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
+    virtual ~basic_ios();
+
+    // 27.5.4.2 Members:
+    _LIBCPP_INLINE_VISIBILITY 
+    basic_ostream<char_type, traits_type>* tie() const;
+    _LIBCPP_INLINE_VISIBILITY 
+    basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
+
+    _LIBCPP_INLINE_VISIBILITY 
+    basic_streambuf<char_type, traits_type>* rdbuf() const;
+    _LIBCPP_INLINE_VISIBILITY 
+    basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
+
+    basic_ios& copyfmt(const basic_ios& __rhs);
+
+    _LIBCPP_INLINE_VISIBILITY 
+    char_type fill() const;
+    _LIBCPP_INLINE_VISIBILITY 
+    char_type fill(char_type __ch);
+
+    _LIBCPP_INLINE_VISIBILITY 
+    locale imbue(const locale& __loc);
+
+    _LIBCPP_INLINE_VISIBILITY 
+    char narrow(char_type __c, char __dfault) const;
+    _LIBCPP_INLINE_VISIBILITY 
+    char_type widen(char __c) const;
+
+protected:
+    _LIBCPP_ALWAYS_INLINE
+    basic_ios() {// purposefully does no initialization
+                }
+    _LIBCPP_INLINE_VISIBILITY 
+    void init(basic_streambuf<char_type, traits_type>* __sb);
+
+    _LIBCPP_INLINE_VISIBILITY 
+    void move(basic_ios& __rhs);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_ALWAYS_INLINE
+    void move(basic_ios&& __rhs) {move(__rhs);}
+#endif
+    _LIBCPP_INLINE_VISIBILITY 
+    void swap(basic_ios& __rhs) _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY 
+    void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
+private:
+    basic_ostream<char_type, traits_type>* __tie_;
+     mutable int_type __fill_;
+};
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)
+{
+    init(__sb);
+}
+
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>::~basic_ios()
+{
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
+{
+    ios_base::init(__sb);
+    __tie_ = 0;
+    __fill_ = traits_type::eof();
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::tie() const
+{
+    return __tie_;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)
+{
+    basic_ostream<char_type, traits_type>* __r = __tie_;
+    __tie_ = __tiestr;
+    return __r;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_streambuf<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::rdbuf() const
+{
+    return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_streambuf<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)
+{
+    basic_streambuf<char_type, traits_type>* __r = rdbuf();
+    ios_base::rdbuf(__sb);
+    return __r;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+locale
+basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
+{
+    locale __r = getloc();
+    ios_base::imbue(__loc);
+    if (rdbuf())
+        rdbuf()->pubimbue(__loc);
+    return __r;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+char
+basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
+{
+    return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+_CharT
+basic_ios<_CharT, _Traits>::widen(char __c) const
+{
+    return use_facet<ctype<char_type> >(getloc()).widen(__c);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+_CharT
+basic_ios<_CharT, _Traits>::fill() const
+{
+    if (traits_type::eq_int_type(traits_type::eof(), __fill_))
+        __fill_ = widen(' ');
+    return __fill_;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+_CharT
+basic_ios<_CharT, _Traits>::fill(char_type __ch)
+{
+    char_type __r = __fill_;
+    __fill_ = __ch;
+    return __r;
+}
+
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>&
+basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
+{
+    if (this != &__rhs)
+    {
+        __call_callbacks(erase_event);
+        ios_base::copyfmt(__rhs);
+        __tie_ = __rhs.__tie_;
+        __fill_ = __rhs.__fill_;
+        __call_callbacks(copyfmt_event);
+        exceptions(__rhs.exceptions());
+    }
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
+{
+    ios_base::move(__rhs);
+    __tie_ = __rhs.__tie_;
+    __rhs.__tie_ = 0;
+    __fill_ = __rhs.__fill_;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
+{
+    ios_base::swap(__rhs);
+    _VSTD::swap(__tie_, __rhs.__tie_);
+    _VSTD::swap(__fill_, __rhs.__fill_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)
+{
+    ios_base::set_rdbuf(__sb);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+boolalpha(ios_base& __str)
+{
+    __str.setf(ios_base::boolalpha);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+noboolalpha(ios_base& __str)
+{
+    __str.unsetf(ios_base::boolalpha);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+showbase(ios_base& __str)
+{
+    __str.setf(ios_base::showbase);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+noshowbase(ios_base& __str)
+{
+    __str.unsetf(ios_base::showbase);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+showpoint(ios_base& __str)
+{
+    __str.setf(ios_base::showpoint);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+noshowpoint(ios_base& __str)
+{
+    __str.unsetf(ios_base::showpoint);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+showpos(ios_base& __str)
+{
+    __str.setf(ios_base::showpos);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+noshowpos(ios_base& __str)
+{
+    __str.unsetf(ios_base::showpos);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+skipws(ios_base& __str)
+{
+    __str.setf(ios_base::skipws);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+noskipws(ios_base& __str)
+{
+    __str.unsetf(ios_base::skipws);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+uppercase(ios_base& __str)
+{
+    __str.setf(ios_base::uppercase);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+nouppercase(ios_base& __str)
+{
+    __str.unsetf(ios_base::uppercase);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+unitbuf(ios_base& __str)
+{
+    __str.setf(ios_base::unitbuf);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+nounitbuf(ios_base& __str)
+{
+    __str.unsetf(ios_base::unitbuf);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+internal(ios_base& __str)
+{
+    __str.setf(ios_base::internal, ios_base::adjustfield);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+left(ios_base& __str)
+{
+    __str.setf(ios_base::left, ios_base::adjustfield);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+right(ios_base& __str)
+{
+    __str.setf(ios_base::right, ios_base::adjustfield);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+dec(ios_base& __str)
+{
+    __str.setf(ios_base::dec, ios_base::basefield);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+hex(ios_base& __str)
+{
+    __str.setf(ios_base::hex, ios_base::basefield);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+oct(ios_base& __str)
+{
+    __str.setf(ios_base::oct, ios_base::basefield);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+fixed(ios_base& __str)
+{
+    __str.setf(ios_base::fixed, ios_base::floatfield);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+scientific(ios_base& __str)
+{
+    __str.setf(ios_base::scientific, ios_base::floatfield);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+hexfloat(ios_base& __str)
+{
+    __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
+    return __str;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+ios_base&
+defaultfloat(ios_base& __str)
+{
+    __str.unsetf(ios_base::floatfield);
+    return __str;
+}
+
+template <class _CharT, class _Traits>
+class __save_flags
+{
+    typedef basic_ios<_CharT, _Traits> __stream_type;
+    typedef typename __stream_type::fmtflags fmtflags;
+
+    __stream_type& __stream_;
+    fmtflags       __fmtflags_;
+    _CharT         __fill_;
+
+    __save_flags(const __save_flags&);
+    __save_flags& operator=(const __save_flags&);
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __save_flags(__stream_type& __stream)
+        : __stream_(__stream),
+          __fmtflags_(__stream.flags()),
+          __fill_(__stream.fill())
+        {}
+    _LIBCPP_INLINE_VISIBILITY
+    ~__save_flags()
+    {
+        __stream_.flags(__fmtflags_);
+        __stream_.fill(__fill_);
+    }
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_IOS

Property changes on: lab4/.minix-src/include/c++/ios
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/istream
===================================================================
--- lab4/.minix-src/include/c++/istream	(nonexistent)
+++ lab4/.minix-src/include/c++/istream	(revision 13)
@@ -0,0 +1,1732 @@
+// -*- C++ -*-
+//===--------------------------- istream ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_ISTREAM
+#define _LIBCPP_ISTREAM
+
+/*
+    istream synopsis
+
+template <class charT, class traits = char_traits<charT> >
+class basic_istream
+    : virtual public basic_ios<charT,traits>
+{
+public:
+    // types (inherited from basic_ios (27.5.4)):
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    // 27.7.1.1.1 Constructor/destructor:
+    explicit basic_istream(basic_streambuf<char_type, traits_type>* sb);
+    basic_istream(basic_istream&& rhs);
+    virtual ~basic_istream();
+
+    // 27.7.1.1.2 Assign/swap:
+    basic_istream& operator=(basic_istream&& rhs);
+    void swap(basic_istream& rhs);
+
+    // 27.7.1.1.3 Prefix/suffix:
+    class sentry;
+
+    // 27.7.1.2 Formatted input:
+    basic_istream& operator>>(basic_istream& (*pf)(basic_istream&));
+    basic_istream& operator>>(basic_ios<char_type, traits_type>&
+                              (*pf)(basic_ios<char_type, traits_type>&));
+    basic_istream& operator>>(ios_base& (*pf)(ios_base&));
+    basic_istream& operator>>(basic_streambuf<char_type, traits_type>* sb);
+    basic_istream& operator>>(bool& n);
+    basic_istream& operator>>(short& n);
+    basic_istream& operator>>(unsigned short& n);
+    basic_istream& operator>>(int& n);
+    basic_istream& operator>>(unsigned int& n);
+    basic_istream& operator>>(long& n);
+    basic_istream& operator>>(unsigned long& n);
+    basic_istream& operator>>(long long& n);
+    basic_istream& operator>>(unsigned long long& n);
+    basic_istream& operator>>(float& f);
+    basic_istream& operator>>(double& f);
+    basic_istream& operator>>(long double& f);
+    basic_istream& operator>>(void*& p);
+
+    // 27.7.1.3 Unformatted input:
+    streamsize gcount() const;
+    int_type get();
+    basic_istream& get(char_type& c);
+    basic_istream& get(char_type* s, streamsize n);
+    basic_istream& get(char_type* s, streamsize n, char_type delim);
+    basic_istream& get(basic_streambuf<char_type,traits_type>& sb);
+    basic_istream& get(basic_streambuf<char_type,traits_type>& sb, char_type delim);
+
+    basic_istream& getline(char_type* s, streamsize n);
+    basic_istream& getline(char_type* s, streamsize n, char_type delim);
+
+    basic_istream& ignore(streamsize n = 1, int_type delim = traits_type::eof());
+    int_type peek();
+    basic_istream& read (char_type* s, streamsize n);
+    streamsize readsome(char_type* s, streamsize n);
+
+    basic_istream& putback(char_type c);
+    basic_istream& unget();
+    int sync();
+
+    pos_type tellg();
+    basic_istream& seekg(pos_type);
+    basic_istream& seekg(off_type, ios_base::seekdir);
+protected:
+    basic_istream(const basic_istream& rhs) = delete;
+    basic_istream(basic_istream&& rhs);
+    // 27.7.2.1.2 Assign/swap:
+    basic_istream& operator=(const basic_istream& rhs) = delete;
+    basic_istream& operator=(basic_istream&& rhs);
+    void swap(basic_istream& rhs);
+};
+
+// 27.7.1.2.3 character extraction templates:
+template<class charT, class traits>
+  basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&, charT&);
+
+template<class traits>
+  basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, unsigned char&);
+
+template<class traits>
+  basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, signed char&);
+
+template<class charT, class traits>
+  basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&, charT*);
+
+template<class traits>
+  basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, unsigned char*);
+
+template<class traits>
+  basic_istream<char,traits>& operator>>(basic_istream<char,traits>&, signed char*);
+
+template <class charT, class traits>
+  void
+  swap(basic_istream<charT, traits>& x, basic_istream<charT, traits>& y);
+
+typedef basic_istream<char> istream;
+typedef basic_istream<wchar_t> wistream;
+
+template <class charT, class traits = char_traits<charT> >
+class basic_iostream :
+    public basic_istream<charT,traits>,
+    public basic_ostream<charT,traits>
+{
+public:
+    // types:
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    // constructor/destructor
+    explicit basic_iostream(basic_streambuf<char_type, traits_type>* sb);
+    basic_iostream(basic_iostream&& rhs);
+    virtual ~basic_iostream();
+
+    // assign/swap
+    basic_iostream& operator=(basic_iostream&& rhs);
+    void swap(basic_iostream& rhs);
+};
+
+template <class charT, class traits>
+  void
+  swap(basic_iostream<charT, traits>& x, basic_iostream<charT, traits>& y);
+
+typedef basic_iostream<char> iostream;
+typedef basic_iostream<wchar_t> wiostream;
+
+template <class charT, class traits>
+  basic_istream<charT,traits>&
+  ws(basic_istream<charT,traits>& is);
+
+template <class charT, class traits, class T>
+  basic_istream<charT, traits>&
+  operator>>(basic_istream<charT, traits>&& is, T& x);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <ostream>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_istream
+    : virtual public basic_ios<_CharT, _Traits>
+{
+    streamsize __gc_;
+public:
+    // types (inherited from basic_ios (27.5.4)):
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    // 27.7.1.1.1 Constructor/destructor:
+    explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb);
+    virtual ~basic_istream();
+protected:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    basic_istream(basic_istream&& __rhs);
+#endif
+    // 27.7.1.1.2 Assign/swap:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    basic_istream& operator=(basic_istream&& __rhs);
+#endif
+    void swap(basic_istream& __rhs);
+
+#if _LIBCPP_STD_VER > 11
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+    basic_istream           (const basic_istream& __rhs) = delete;
+    basic_istream& operator=(const basic_istream& __rhs) = delete;
+#else
+    basic_istream           (const basic_istream& __rhs); // not defined
+    basic_istream& operator=(const basic_istream& __rhs); // not defined
+#endif
+#endif
+public:
+
+    // 27.7.1.1.3 Prefix/suffix:
+    class _LIBCPP_TYPE_VIS_ONLY sentry;
+
+    // 27.7.1.2 Formatted input:
+    basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
+    basic_istream& operator>>(basic_ios<char_type, traits_type>&
+                              (*__pf)(basic_ios<char_type, traits_type>&));
+    basic_istream& operator>>(ios_base& (*__pf)(ios_base&));
+    basic_istream& operator>>(basic_streambuf<char_type, traits_type>* __sb);
+    basic_istream& operator>>(bool& __n);
+    basic_istream& operator>>(short& __n);
+    basic_istream& operator>>(unsigned short& __n);
+    basic_istream& operator>>(int& __n);
+    basic_istream& operator>>(unsigned int& __n);
+    basic_istream& operator>>(long& __n);
+    basic_istream& operator>>(unsigned long& __n);
+    basic_istream& operator>>(long long& __n);
+    basic_istream& operator>>(unsigned long long& __n);
+    basic_istream& operator>>(float& __f);
+    basic_istream& operator>>(double& __f);
+    basic_istream& operator>>(long double& __f);
+    basic_istream& operator>>(void*& __p);
+
+    // 27.7.1.3 Unformatted input:
+    _LIBCPP_INLINE_VISIBILITY
+    streamsize gcount() const {return __gc_;}
+    int_type get();
+    basic_istream& get(char_type& __c);
+    basic_istream& get(char_type* __s, streamsize __n);
+    basic_istream& get(char_type* __s, streamsize __n, char_type __dlm);
+    basic_istream& get(basic_streambuf<char_type, traits_type>& __sb);
+    basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm);
+
+    basic_istream& getline(char_type* __s, streamsize __n);
+    basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm);
+
+    basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof());
+    int_type peek();
+    basic_istream& read (char_type* __s, streamsize __n);
+    streamsize readsome(char_type* __s, streamsize __n);
+
+    basic_istream& putback(char_type __c);
+    basic_istream& unget();
+    int sync();
+
+    pos_type tellg();
+    basic_istream& seekg(pos_type __pos);
+    basic_istream& seekg(off_type __off, ios_base::seekdir __dir);
+};
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_istream<_CharT, _Traits>::sentry
+{
+    bool __ok_;
+
+    sentry(const sentry&); // = delete;
+    sentry& operator=(const sentry&); // = delete;
+
+public:
+    explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
+//    ~sentry() = default;
+
+    _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_EXPLICIT
+        operator bool() const {return __ok_;}
+};
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is,
+                                               bool __noskipws)
+    : __ok_(false)
+{
+    if (__is.good())
+    {
+        if (__is.tie())
+            __is.tie()->flush();
+        if (!__noskipws && (__is.flags() & ios_base::skipws))
+        {
+            typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+            const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
+            _Ip __i(__is);
+            _Ip __eof;
+            for (; __i != __eof; ++__i)
+                if (!__ct.is(__ct.space, *__i))
+                    break;
+            if (__i == __eof)
+                __is.setstate(ios_base::failbit | ios_base::eofbit);
+        }
+        __ok_ = __is.good();
+    }
+    else
+        __is.setstate(ios_base::failbit);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>::basic_istream(basic_streambuf<char_type, traits_type>* __sb)
+    : __gc_(0)
+{
+    this->init(__sb);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
+    : __gc_(__rhs.__gc_)
+{
+    __rhs.__gc_ = 0;
+    this->move(__rhs);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
+{
+    swap(__rhs);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>::~basic_istream()
+{
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_istream<_CharT, _Traits>::swap(basic_istream& __rhs)
+{
+    _VSTD::swap(__gc_, __rhs.__gc_);
+    basic_ios<char_type, traits_type>::swap(__rhs);
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(long& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(long long& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(float& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(double& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(long double& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(bool& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(void*& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(short& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            long __temp;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
+            if (__temp < numeric_limits<short>::min())
+            {
+                __err |= ios_base::failbit;
+                __n = numeric_limits<short>::min();
+            }
+            else if (__temp > numeric_limits<short>::max())
+            {
+                __err |= ios_base::failbit;
+                __n = numeric_limits<short>::max();
+            }
+            else
+                __n = static_cast<short>(__temp);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(int& __n)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this);
+        if (__s)
+        {
+            typedef istreambuf_iterator<char_type, traits_type> _Ip;
+            typedef num_get<char_type, _Ip> _Fp;
+            ios_base::iostate __err = ios_base::goodbit;
+            long __temp;
+            use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
+            if (__temp < numeric_limits<int>::min())
+            {
+                __err |= ios_base::failbit;
+                __n = numeric_limits<int>::min();
+            }
+            else if (__temp > numeric_limits<int>::max())
+            {
+                __err |= ios_base::failbit;
+                __n = numeric_limits<int>::max();
+            }
+            else
+                __n = static_cast<int>(__temp);
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(basic_istream& (*__pf)(basic_istream&))
+{
+    return __pf(*this);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(basic_ios<char_type, traits_type>&
+                                           (*__pf)(basic_ios<char_type, traits_type>&))
+{
+    __pf(*this);
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(ios_base& (*__pf)(ios_base&))
+{
+    __pf(*this);
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+        if (__sen)
+        {
+            streamsize __n = __is.width();
+            if (__n <= 0)
+                __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
+            streamsize __c = 0;
+            const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
+            ios_base::iostate __err = ios_base::goodbit;
+            while (__c < __n-1)
+            {
+                typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+                if (_Traits::eq_int_type(__i, _Traits::eof()))
+                {
+                   __err |= ios_base::eofbit;
+                   break;
+                }
+                _CharT __ch = _Traits::to_char_type(__i);
+                if (__ct.is(__ct.space, __ch))
+                    break;
+                *__s++ = __ch;
+                ++__c;
+                 __is.rdbuf()->sbumpc();
+            }
+            *__s = _CharT();
+            __is.width(0);
+            if (__c == 0)
+               __err |= ios_base::failbit;
+            __is.setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __is.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __is;
+}
+
+template<class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s)
+{
+    return __is >> (char*)__s;
+}
+
+template<class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, signed char* __s)
+{
+    return __is >> (char*)__s;
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+        if (__sen)
+        {
+            typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
+            if (_Traits::eq_int_type(__i, _Traits::eof()))
+                __is.setstate(ios_base::eofbit | ios_base::failbit);
+            else
+                __c = _Traits::to_char_type(__i);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __is.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __is;
+}
+
+template<class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c)
+{
+    return __is >> (char&)__c;
+}
+
+template<class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, signed char& __c)
+{
+    return __is >> (char&)__c;
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb)
+{
+    __gc_ = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this, true);
+        if (__s)
+        {
+            if (__sb)
+            {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+                try
+                {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+                    ios_base::iostate __err = ios_base::goodbit;
+                    while (true)
+                    {
+                        typename traits_type::int_type __i = this->rdbuf()->sgetc();
+                        if (traits_type::eq_int_type(__i, _Traits::eof()))
+                        {
+                           __err |= ios_base::eofbit;
+                           break;
+                        }
+                        if (traits_type::eq_int_type(
+                                __sb->sputc(traits_type::to_char_type(__i)),
+                                traits_type::eof()))
+                            break;
+                        ++__gc_;
+                        this->rdbuf()->sbumpc();
+                    }
+                    if (__gc_ == 0)
+                       __err |= ios_base::failbit;
+                    this->setstate(__err);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+                }
+                catch (...)
+                {
+                    if (__gc_ == 0)
+                        this->__set_failbit_and_consider_rethrow();
+                }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            }
+            else
+                this->setstate(ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+typename basic_istream<_CharT, _Traits>::int_type
+basic_istream<_CharT, _Traits>::get()
+{
+    __gc_ = 0;
+    int_type __r = traits_type::eof();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __s(*this, true);
+        if (__s)
+        {
+            __r = this->rdbuf()->sbumpc();
+            if (traits_type::eq_int_type(__r, traits_type::eof()))
+               this->setstate(ios_base::failbit | ios_base::eofbit);
+            else
+                __gc_ = 1;
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __r;
+}
+
+template<class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(char_type& __c)
+{
+    int_type __ch = get();
+    if (__ch != traits_type::eof())
+        __c = traits_type::to_char_type(__ch);
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm)
+{
+    __gc_ = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            if (__n > 0)
+            {
+                ios_base::iostate __err = ios_base::goodbit;
+                while (__gc_ < __n-1)
+                {
+                    int_type __i = this->rdbuf()->sgetc();
+                    if (traits_type::eq_int_type(__i, traits_type::eof()))
+                    {
+                       __err |= ios_base::eofbit;
+                       break;
+                    }
+                    char_type __ch = traits_type::to_char_type(__i);
+                    if (traits_type::eq(__ch, __dlm))
+                        break;
+                    *__s++ = __ch;
+                    ++__gc_;
+                     this->rdbuf()->sbumpc();
+                }
+                *__s = char_type();
+                if (__gc_ == 0)
+                   __err |= ios_base::failbit;
+                this->setstate(__err);
+            }
+            else
+                this->setstate(ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n)
+{
+    return get(__s, __n, this->widen('\n'));
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb,
+                                    char_type __dlm)
+{
+    __gc_ = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            ios_base::iostate __err = ios_base::goodbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            try
+            {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+                while (true)
+                {
+                    typename traits_type::int_type __i = this->rdbuf()->sgetc();
+                    if (traits_type::eq_int_type(__i, traits_type::eof()))
+                    {
+                       __err |= ios_base::eofbit;
+                       break;
+                    }
+                    char_type __ch = traits_type::to_char_type(__i);
+                    if (traits_type::eq(__ch, __dlm))
+                        break;
+                    if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
+                        break;
+                    ++__gc_;
+                    this->rdbuf()->sbumpc();
+                }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            }
+            catch (...)
+            {
+            }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            if (__gc_ == 0)
+               __err |= ios_base::failbit;
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb)
+{
+    return get(__sb, this->widen('\n'));
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm)
+{
+    __gc_ = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            ios_base::iostate __err = ios_base::goodbit;
+            while (true)
+            {
+                typename traits_type::int_type __i = this->rdbuf()->sgetc();
+                if (traits_type::eq_int_type(__i, traits_type::eof()))
+                {
+                   __err |= ios_base::eofbit;
+                   break;
+                }
+                char_type __ch = traits_type::to_char_type(__i);
+                if (traits_type::eq(__ch, __dlm))
+                {
+                    this->rdbuf()->sbumpc();
+                    ++__gc_;
+                    break;
+                }
+                if (__gc_ >= __n-1)
+                {
+                    __err |= ios_base::failbit;
+                    break;
+                }
+                *__s++ = __ch;
+                this->rdbuf()->sbumpc();
+                ++__gc_;
+            }
+            if (__n > 0)
+                *__s = char_type();
+            if (__gc_ == 0)
+               __err |= ios_base::failbit;
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n)
+{
+    return getline(__s, __n, this->widen('\n'));
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
+{
+    __gc_ = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            ios_base::iostate __err = ios_base::goodbit;
+            if (__n == numeric_limits<streamsize>::max())
+            {
+                while (true)
+                {
+                    typename traits_type::int_type __i = this->rdbuf()->sbumpc();
+                    if (traits_type::eq_int_type(__i, traits_type::eof()))
+                    {
+                       __err |= ios_base::eofbit;
+                       break;
+                    }
+                    ++__gc_;
+                    if (traits_type::eq_int_type(__i, __dlm))
+                        break;
+                }
+            }
+            else
+            {
+                while (__gc_ < __n)
+                {
+                    typename traits_type::int_type __i = this->rdbuf()->sbumpc();
+                    if (traits_type::eq_int_type(__i, traits_type::eof()))
+                    {
+                       __err |= ios_base::eofbit;
+                       break;
+                    }
+                    ++__gc_;
+                    if (traits_type::eq_int_type(__i, __dlm))
+                        break;
+                }
+            }
+            this->setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+typename basic_istream<_CharT, _Traits>::int_type
+basic_istream<_CharT, _Traits>::peek()
+{
+    __gc_ = 0;
+    int_type __r = traits_type::eof();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            __r = this->rdbuf()->sgetc();
+            if (traits_type::eq_int_type(__r, traits_type::eof()))
+                this->setstate(ios_base::eofbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __r;
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
+{
+    __gc_ = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            __gc_ = this->rdbuf()->sgetn(__s, __n);
+            if (__gc_ != __n)
+                this->setstate(ios_base::failbit | ios_base::eofbit);
+        }
+        else
+            this->setstate(ios_base::failbit);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+streamsize
+basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
+{
+    __gc_ = 0;
+    streamsize __c = this->rdbuf()->in_avail();
+    switch (__c)
+    {
+    case -1:
+        this->setstate(ios_base::eofbit);
+        break;
+    case 0:
+        break;
+    default:
+        read(__s, _VSTD::min(__c, __n));
+        break;
+    }
+    return __gc_;
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::putback(char_type __c)
+{
+    __gc_ = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        this->clear(this->rdstate() & ~ios_base::eofbit);
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())
+                this->setstate(ios_base::badbit);
+        }
+        else
+            this->setstate(ios_base::failbit);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::unget()
+{
+    __gc_ = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        this->clear(this->rdstate() & ~ios_base::eofbit);
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())
+                this->setstate(ios_base::badbit);
+        }
+        else
+            this->setstate(ios_base::failbit);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+int
+basic_istream<_CharT, _Traits>::sync()
+{
+    int __r = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            if (this->rdbuf() == 0)
+                return -1;
+            if (this->rdbuf()->pubsync() == -1)
+            {
+                this->setstate(ios_base::badbit);
+                return -1;
+            }
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __r;
+}
+
+template<class _CharT, class _Traits>
+typename basic_istream<_CharT, _Traits>::pos_type
+basic_istream<_CharT, _Traits>::tellg()
+{
+    pos_type __r(-1);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __sen(*this, true);
+        if (__sen)
+            __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __r;
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        this->clear(this->rdstate() & ~ios_base::eofbit);
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
+                this->setstate(ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template<class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        sentry __sen(*this, true);
+        if (__sen)
+        {
+            if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
+                this->setstate(ios_base::failbit);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        this->__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+ws(basic_istream<_CharT, _Traits>& __is)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
+        if (__sen)
+        {
+            const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
+            while (true)
+            {
+                typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+                if (_Traits::eq_int_type(__i, _Traits::eof()))
+                {
+                   __is.setstate(ios_base::eofbit);
+                   break;
+                }
+                if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
+                    break;
+                __is.rdbuf()->sbumpc();
+            }
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __is.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __is;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
+{
+    __is >> __x;
+    return __is;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_iostream
+    : public basic_istream<_CharT, _Traits>,
+      public basic_ostream<_CharT, _Traits>
+{
+public:
+    // types:
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    // constructor/destructor
+    explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb);
+    virtual ~basic_iostream();
+protected:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    basic_iostream(basic_iostream&& __rhs);
+#endif
+
+    // assign/swap
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    basic_iostream& operator=(basic_iostream&& __rhs);
+#endif
+    void swap(basic_iostream& __rhs);
+public:
+};
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
+    : basic_istream<_CharT, _Traits>(__sb)
+{
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
+    : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
+{
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_iostream<_CharT, _Traits>&
+basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
+{
+    swap(__rhs);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits>
+basic_iostream<_CharT, _Traits>::~basic_iostream()
+{
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_iostream<_CharT, _Traits>::swap(basic_iostream& __rhs)
+{
+    basic_istream<char_type, traits_type>::swap(__rhs);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           basic_string<_CharT, _Traits, _Allocator>& __str)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+        if (__sen)
+        {
+            __str.clear();
+            streamsize __n = __is.width();
+            if (__n <= 0)
+                __n = __str.max_size();
+            if (__n <= 0)
+                __n = numeric_limits<streamsize>::max();
+            streamsize __c = 0;
+            const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
+            ios_base::iostate __err = ios_base::goodbit;
+            while (__c < __n)
+            {
+                typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+                if (_Traits::eq_int_type(__i, _Traits::eof()))
+                {
+                   __err |= ios_base::eofbit;
+                   break;
+                }
+                _CharT __ch = _Traits::to_char_type(__i);
+                if (__ct.is(__ct.space, __ch))
+                    break;
+                __str.push_back(__ch);
+                ++__c;
+                 __is.rdbuf()->sbumpc();
+            }
+            __is.width(0);
+            if (__c == 0)
+               __err |= ios_base::failbit;
+            __is.setstate(__err);
+        }
+        else
+            __is.setstate(ios_base::failbit);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __is.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __is;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>& __is,
+        basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
+        if (__sen)
+        {
+            __str.clear();
+            ios_base::iostate __err = ios_base::goodbit;
+            streamsize __extr = 0;
+            while (true)
+            {
+                typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
+                if (_Traits::eq_int_type(__i, _Traits::eof()))
+                {
+                   __err |= ios_base::eofbit;
+                   break;
+                }
+                ++__extr;
+                _CharT __ch = _Traits::to_char_type(__i);
+                if (_Traits::eq(__ch, __dlm))
+                    break;
+                __str.push_back(__ch);
+                if (__str.size() == __str.max_size())
+                {
+                    __err |= ios_base::failbit;
+                    break;
+                }
+            }
+            if (__extr == 0)
+               __err |= ios_base::failbit;
+            __is.setstate(__err);
+        }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __is.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __is;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>& __is,
+        basic_string<_CharT, _Traits, _Allocator>& __str)
+{
+    return getline(__is, __str, __is.widen('\n'));
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is,
+        basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
+{
+    return getline(__is, __str, __dlm);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is,
+        basic_string<_CharT, _Traits, _Allocator>& __str)
+{
+    return getline(__is, __str, __is.widen('\n'));
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, size_t _Size>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+        if (__sen)
+        {
+            basic_string<_CharT, _Traits> __str;
+            const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
+            streamsize __c = 0;
+            ios_base::iostate __err = ios_base::goodbit;
+            _CharT __zero = __ct.widen('0');
+            _CharT __one = __ct.widen('1');
+            while (__c < _Size)
+            {
+                typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+                if (_Traits::eq_int_type(__i, _Traits::eof()))
+                {
+                   __err |= ios_base::eofbit;
+                   break;
+                }
+                _CharT __ch = _Traits::to_char_type(__i);
+                if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
+                    break;
+                __str.push_back(__ch);
+                ++__c;
+                 __is.rdbuf()->sbumpc();
+            }
+            __x = bitset<_Size>(__str);
+            if (__c == 0)
+               __err |= ios_base::failbit;
+            __is.setstate(__err);
+        }
+        else
+            __is.setstate(ios_base::failbit);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __is.__set_badbit_and_consider_rethrow();
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __is;
+}
+
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_istream<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_istream<wchar_t>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_iostream<char>)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_ISTREAM

Property changes on: lab4/.minix-src/include/c++/istream
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/list
===================================================================
--- lab4/.minix-src/include/c++/list	(nonexistent)
+++ lab4/.minix-src/include/c++/list	(revision 13)
@@ -0,0 +1,2358 @@
+// -*- C++ -*-
+//===---------------------------- list ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_LIST
+#define _LIBCPP_LIST
+
+/*
+    list synopsis
+
+namespace std
+{
+
+template <class T, class Alloc = allocator<T> >
+class list
+{
+public:
+
+    // types:
+    typedef T value_type;
+    typedef Alloc allocator_type;
+    typedef typename allocator_type::reference reference;
+    typedef typename allocator_type::const_reference const_reference;
+    typedef typename allocator_type::pointer pointer;
+    typedef typename allocator_type::const_pointer const_pointer;
+    typedef implementation-defined iterator;
+    typedef implementation-defined const_iterator;
+    typedef implementation-defined size_type;
+    typedef implementation-defined difference_type;
+    typedef reverse_iterator<iterator> reverse_iterator;
+    typedef reverse_iterator<const_iterator> const_reverse_iterator;
+
+    list()
+        noexcept(is_nothrow_default_constructible<allocator_type>::value);
+    explicit list(const allocator_type& a);
+    explicit list(size_type n);
+    explicit list(size_type n, const allocator_type& a); // C++14
+    list(size_type n, const value_type& value);
+    list(size_type n, const value_type& value, const allocator_type& a);
+    template <class Iter>
+        list(Iter first, Iter last);
+    template <class Iter>
+        list(Iter first, Iter last, const allocator_type& a);
+    list(const list& x);
+    list(const list&, const allocator_type& a);
+    list(list&& x)
+        noexcept(is_nothrow_move_constructible<allocator_type>::value);
+    list(list&&, const allocator_type& a);
+    list(initializer_list<value_type>);
+    list(initializer_list<value_type>, const allocator_type& a);
+
+    ~list();
+
+    list& operator=(const list& x);
+    list& operator=(list&& x)
+        noexcept(
+             allocator_type::propagate_on_container_move_assignment::value &&
+             is_nothrow_move_assignable<allocator_type>::value);
+    list& operator=(initializer_list<value_type>);
+    template <class Iter>
+        void assign(Iter first, Iter last);
+    void assign(size_type n, const value_type& t);
+    void assign(initializer_list<value_type>);
+
+    allocator_type get_allocator() const noexcept;
+
+    iterator begin() noexcept;
+    const_iterator begin() const noexcept;
+    iterator end() noexcept;
+    const_iterator end() const noexcept;
+    reverse_iterator rbegin() noexcept;
+    const_reverse_iterator rbegin() const noexcept;
+    reverse_iterator rend() noexcept;
+    const_reverse_iterator rend() const noexcept;
+    const_iterator cbegin() const noexcept;
+    const_iterator cend() const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    const_reverse_iterator crend() const noexcept;
+
+    reference front();
+    const_reference front() const;
+    reference back();
+    const_reference back() const;
+
+    bool empty() const noexcept;
+    size_type size() const noexcept;
+    size_type max_size() const noexcept;
+
+    template <class... Args>
+        void emplace_front(Args&&... args);
+    void pop_front();
+    template <class... Args>
+        void emplace_back(Args&&... args);
+    void pop_back();
+    void push_front(const value_type& x);
+    void push_front(value_type&& x);
+    void push_back(const value_type& x);
+    void push_back(value_type&& x);
+    template <class... Args>
+        iterator emplace(const_iterator position, Args&&... args);
+    iterator insert(const_iterator position, const value_type& x);
+    iterator insert(const_iterator position, value_type&& x);
+    iterator insert(const_iterator position, size_type n, const value_type& x);
+    template <class Iter>
+        iterator insert(const_iterator position, Iter first, Iter last);
+    iterator insert(const_iterator position, initializer_list<value_type> il);
+
+    iterator erase(const_iterator position);
+    iterator erase(const_iterator position, const_iterator last);
+
+    void resize(size_type sz);
+    void resize(size_type sz, const value_type& c);
+
+    void swap(list&)
+        noexcept(allocator_traits<allocator_type>::is_always_equal::value);  // C++17
+    void clear() noexcept;
+
+    void splice(const_iterator position, list& x);
+    void splice(const_iterator position, list&& x);
+    void splice(const_iterator position, list& x, const_iterator i);
+    void splice(const_iterator position, list&& x, const_iterator i);
+    void splice(const_iterator position, list& x, const_iterator first,
+                                                  const_iterator last);
+    void splice(const_iterator position, list&& x, const_iterator first,
+                                                  const_iterator last);
+
+    void remove(const value_type& value);
+    template <class Pred> void remove_if(Pred pred);
+    void unique();
+    template <class BinaryPredicate>
+        void unique(BinaryPredicate binary_pred);
+    void merge(list& x);
+    void merge(list&& x);
+    template <class Compare>
+        void merge(list& x, Compare comp);
+    template <class Compare>
+        void merge(list&& x, Compare comp);
+    void sort();
+    template <class Compare>
+        void sort(Compare comp);
+    void reverse() noexcept;
+};
+
+template <class T, class Alloc>
+    bool operator==(const list<T,Alloc>& x, const list<T,Alloc>& y);
+template <class T, class Alloc>
+    bool operator< (const list<T,Alloc>& x, const list<T,Alloc>& y);
+template <class T, class Alloc>
+    bool operator!=(const list<T,Alloc>& x, const list<T,Alloc>& y);
+template <class T, class Alloc>
+    bool operator> (const list<T,Alloc>& x, const list<T,Alloc>& y);
+template <class T, class Alloc>
+    bool operator>=(const list<T,Alloc>& x, const list<T,Alloc>& y);
+template <class T, class Alloc>
+    bool operator<=(const list<T,Alloc>& x, const list<T,Alloc>& y);
+
+template <class T, class Alloc>
+    void swap(list<T,Alloc>& x, list<T,Alloc>& y)
+         noexcept(noexcept(x.swap(y)));
+
+}  // std
+
+*/
+
+#include <__config>
+
+#include <memory>
+#include <limits>
+#include <initializer_list>
+#include <iterator>
+#include <algorithm>
+
+#include <__undef_min_max>
+
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, class _VoidPtr> struct __list_node;
+
+template <class _Tp, class _VoidPtr>
+struct __list_node_base
+{
+    typedef typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+        rebind<__list_node<_Tp, _VoidPtr> > pointer;
+#else
+        rebind<__list_node<_Tp, _VoidPtr> >::other pointer;
+#endif
+
+    typedef typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+        rebind<__list_node_base> __base_pointer;
+#else
+        rebind<__list_node_base>::other __base_pointer;
+#endif
+
+    pointer __prev_;
+    pointer __next_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_node_base() : __prev_(__self()), __next_(__self()) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    pointer __self()
+    {
+        return static_cast<pointer>(pointer_traits<__base_pointer>::pointer_to(*this));
+    }
+};
+
+template <class _Tp, class _VoidPtr>
+struct __list_node
+    : public __list_node_base<_Tp, _VoidPtr>
+{
+    _Tp __value_;
+};
+
+template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TYPE_VIS_ONLY list;
+template <class _Tp, class _Alloc> class __list_imp;
+template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator;
+
+template <class _Tp, class _VoidPtr>
+class _LIBCPP_TYPE_VIS_ONLY __list_iterator
+{
+    typedef typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+        rebind<__list_node<_Tp, _VoidPtr> > __node_pointer;
+#else
+        rebind<__list_node<_Tp, _VoidPtr> >::other __node_pointer;
+#endif
+
+    __node_pointer __ptr_;
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __list_iterator(__node_pointer __p, const void* __c) _NOEXCEPT
+        : __ptr_(__p)
+    {
+        __get_db()->__insert_ic(this, __c);
+    }
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+#endif
+
+
+
+    template<class, class> friend class list;
+    template<class, class> friend class __list_imp;
+    template<class, class> friend class __list_const_iterator;
+public:
+    typedef bidirectional_iterator_tag       iterator_category;
+    typedef _Tp                              value_type;
+    typedef value_type&                      reference;
+    typedef typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<value_type>
+#else
+            rebind<value_type>::other
+#endif
+                                             pointer;
+    typedef typename pointer_traits<pointer>::difference_type difference_type;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_iterator() _NOEXCEPT : __ptr_(nullptr)
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__insert_i(this);
+#endif
+    }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_iterator(const __list_iterator& __p)
+        : __ptr_(__p.__ptr_)
+    {
+        __get_db()->__iterator_copy(this, &__p);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    ~__list_iterator()
+    {
+        __get_db()->__erase_i(this);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_iterator& operator=(const __list_iterator& __p)
+    {
+        if (this != &__p)
+        {
+            __get_db()->__iterator_copy(this, &__p);
+            __ptr_ = __p.__ptr_;
+        }
+        return *this;
+    }
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference operator*() const
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to dereference a non-dereferenceable list::iterator");
+#endif
+        return __ptr_->__value_;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to dereference a non-dereferenceable list::iterator");
+#endif
+        return pointer_traits<pointer>::pointer_to(__ptr_->__value_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_iterator& operator++()
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to increment non-incrementable list::iterator");
+#endif
+        __ptr_ = __ptr_->__next_;
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_iterator& operator--()
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
+                       "Attempted to decrement non-decrementable list::iterator");
+#endif
+        __ptr_ = __ptr_->__prev_;
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __list_iterator& __x, const __list_iterator& __y)
+    {
+        return __x.__ptr_ == __y.__ptr_;
+    }
+    friend _LIBCPP_INLINE_VISIBILITY
+     bool operator!=(const __list_iterator& __x, const __list_iterator& __y)
+        {return !(__x == __y);}
+};
+
+template <class _Tp, class _VoidPtr>
+class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator
+{
+    typedef typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+        rebind<__list_node<_Tp, _VoidPtr> > __node_pointer;
+#else
+        rebind<__list_node<_Tp, _VoidPtr> >::other __node_pointer;
+#endif
+
+    __node_pointer __ptr_;
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __list_const_iterator(__node_pointer __p, const void* __c) _NOEXCEPT
+        : __ptr_(__p)
+    {
+        __get_db()->__insert_ic(this, __c);
+    }
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __list_const_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+#endif
+
+    template<class, class> friend class list;
+    template<class, class> friend class __list_imp;
+public:
+    typedef bidirectional_iterator_tag       iterator_category;
+    typedef _Tp                              value_type;
+    typedef const value_type&                reference;
+    typedef typename pointer_traits<_VoidPtr>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<const value_type>
+#else
+            rebind<const value_type>::other
+#endif
+                                             pointer;
+    typedef typename pointer_traits<pointer>::difference_type difference_type;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_const_iterator() _NOEXCEPT : __ptr_(nullptr)
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__insert_i(this);
+#endif
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
+        : __ptr_(__p.__ptr_)
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__iterator_copy(this, &__p);
+#endif
+    }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_const_iterator(const __list_const_iterator& __p)
+        : __ptr_(__p.__ptr_)
+    {
+        __get_db()->__iterator_copy(this, &__p);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    ~__list_const_iterator()
+    {
+        __get_db()->__erase_i(this);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_const_iterator& operator=(const __list_const_iterator& __p)
+    {
+        if (this != &__p)
+        {
+            __get_db()->__iterator_copy(this, &__p);
+            __ptr_ = __p.__ptr_;
+        }
+        return *this;
+    }
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    reference operator*() const
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to dereference a non-dereferenceable list::const_iterator");
+#endif
+        return __ptr_->__value_;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to dereference a non-dereferenceable list::iterator");
+#endif
+        return pointer_traits<pointer>::pointer_to(__ptr_->__value_);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_const_iterator& operator++()
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+                       "Attempted to increment non-incrementable list::const_iterator");
+#endif
+        __ptr_ = __ptr_->__next_;
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __list_const_iterator& operator--()
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
+                       "Attempted to decrement non-decrementable list::const_iterator");
+#endif
+        __ptr_ = __ptr_->__prev_;
+        return *this;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    __list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
+    {
+        return __x.__ptr_ == __y.__ptr_;
+    }
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y)
+        {return !(__x == __y);}
+};
+
+template <class _Tp, class _Alloc>
+class __list_imp
+{
+    __list_imp(const __list_imp&);
+    __list_imp& operator=(const __list_imp&);
+protected:
+    typedef _Tp                                                     value_type;
+    typedef _Alloc                                                  allocator_type;
+    typedef allocator_traits<allocator_type>                        __alloc_traits;
+    typedef typename __alloc_traits::size_type                      size_type;
+    typedef typename __alloc_traits::void_pointer                   __void_pointer;
+    typedef __list_iterator<value_type, __void_pointer>             iterator;
+    typedef __list_const_iterator<value_type, __void_pointer>       const_iterator;
+    typedef __list_node_base<value_type, __void_pointer>            __node_base;
+    typedef __list_node<value_type, __void_pointer>                 __node;
+    typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator;
+    typedef allocator_traits<__node_allocator>                       __node_alloc_traits;
+    typedef typename __node_alloc_traits::pointer                    __node_pointer;
+    typedef typename __node_alloc_traits::pointer                    __node_const_pointer;
+    typedef typename __alloc_traits::pointer                         pointer;
+    typedef typename __alloc_traits::const_pointer                   const_pointer;
+    typedef typename __alloc_traits::difference_type                 difference_type;
+
+    typedef typename __rebind_alloc_helper<__alloc_traits, __node_base>::type __node_base_allocator;
+    typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
+
+    __node_base __end_;
+    __compressed_pair<size_type, __node_allocator> __size_alloc_;
+
+    _LIBCPP_INLINE_VISIBILITY
+          size_type& __sz() _NOEXCEPT {return __size_alloc_.first();}
+    _LIBCPP_INLINE_VISIBILITY
+    const size_type& __sz() const _NOEXCEPT
+        {return __size_alloc_.first();}
+    _LIBCPP_INLINE_VISIBILITY
+          __node_allocator& __node_alloc() _NOEXCEPT
+          {return __size_alloc_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const __node_allocator& __node_alloc() const _NOEXCEPT
+        {return __size_alloc_.second();}
+
+    static void __unlink_nodes(__node_pointer __f, __node_pointer __l) _NOEXCEPT;
+
+    __list_imp()
+        _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
+    __list_imp(const allocator_type& __a);
+    ~__list_imp();
+    void clear() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty() const _NOEXCEPT {return __sz() == 0;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator begin() _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        return iterator(__end_.__next_, this);
+#else
+        return iterator(__end_.__next_);
+#endif
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const  _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        return const_iterator(__end_.__next_, this);
+#else
+        return const_iterator(__end_.__next_);
+#endif
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    iterator end() _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        return iterator(static_cast<__node_pointer>(
+                pointer_traits<__node_base_pointer>::pointer_to(__end_)), this);
+#else
+        return iterator(static_cast<__node_pointer>(
+                      pointer_traits<__node_base_pointer>::pointer_to(__end_)));
+#endif
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end() const _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        return const_iterator(static_cast<__node_const_pointer>(
+        pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(__end_))), this);
+#else
+        return const_iterator(static_cast<__node_const_pointer>(
+        pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(__end_))));
+#endif
+    }
+
+    void swap(__list_imp& __c)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT;
+#else
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                    __is_nothrow_swappable<allocator_type>::value);
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __list_imp& __c)
+        {__copy_assign_alloc(__c, integral_constant<bool,
+                      __node_alloc_traits::propagate_on_container_copy_assignment::value>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__list_imp& __c)
+        _NOEXCEPT_(
+            !__node_alloc_traits::propagate_on_container_move_assignment::value ||
+            is_nothrow_move_assignable<__node_allocator>::value)
+        {__move_assign_alloc(__c, integral_constant<bool,
+                      __node_alloc_traits::propagate_on_container_move_assignment::value>());}
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __list_imp& __c, true_type)
+        {
+            if (__node_alloc() != __c.__node_alloc())
+                clear();
+            __node_alloc() = __c.__node_alloc();
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __list_imp& __c, false_type)
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__list_imp& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
+        {
+            __node_alloc() = _VSTD::move(__c.__node_alloc());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__list_imp& __c, false_type)
+        _NOEXCEPT
+        {}
+};
+
+// Unlink nodes [__f, __l]
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_pointer __f, __node_pointer __l)
+    _NOEXCEPT
+{
+    __f->__prev_->__next_ = __l->__next_;
+    __l->__next_->__prev_ = __f->__prev_;
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+__list_imp<_Tp, _Alloc>::__list_imp()
+        _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
+    : __size_alloc_(0)
+{
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+__list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a)
+    : __size_alloc_(0, __node_allocator(__a))
+{
+}
+
+template <class _Tp, class _Alloc>
+__list_imp<_Tp, _Alloc>::~__list_imp()
+{
+    clear();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__erase_c(this);
+#endif
+}
+
+template <class _Tp, class _Alloc>
+void
+__list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
+{
+    if (!empty())
+    {
+        __node_allocator& __na = __node_alloc();
+        __node_pointer __f = __end_.__next_;
+        __node_pointer __l = static_cast<__node_pointer>(
+                       pointer_traits<__node_base_pointer>::pointer_to(__end_));
+        __unlink_nodes(__f, __l->__prev_);
+        __sz() = 0;
+        while (__f != __l)
+        {
+            __node_pointer __n = __f;
+            __f = __f->__next_;
+            __node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
+            __node_alloc_traits::deallocate(__na, __n, 1);
+        }
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __c_node* __c = __get_db()->__find_c_and_lock(this);
+        for (__i_node** __p = __c->end_; __p != __c->beg_; )
+        {
+            --__p;
+            const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
+            if (__i->__ptr_ != __l)
+            {
+                (*__p)->__c_ = nullptr;
+                if (--__c->end_ != __p)
+                    memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+            }
+        }
+        __get_db()->unlock();
+#endif
+    }
+}
+
+template <class _Tp, class _Alloc>
+void
+__list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT
+#else
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                    __is_nothrow_swappable<allocator_type>::value)
+#endif
+{
+    _LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value ||
+                   this->__node_alloc() == __c.__node_alloc(),
+                   "list::swap: Either propagate_on_container_swap must be true"
+                   " or the allocators must compare equal");
+    using _VSTD::swap;
+    __swap_allocator(__node_alloc(), __c.__node_alloc());
+    swap(__sz(), __c.__sz());
+    swap(__end_, __c.__end_);
+    if (__sz() == 0)
+        __end_.__next_ = __end_.__prev_ = __end_.__self();
+    else
+        __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_.__self();
+    if (__c.__sz() == 0)
+        __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_.__self();
+    else
+        __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_.__self();
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __libcpp_db* __db = __get_db();
+    __c_node* __cn1 = __db->__find_c_and_lock(this);
+    __c_node* __cn2 = __db->__find_c(&__c);
+    std::swap(__cn1->beg_, __cn2->beg_);
+    std::swap(__cn1->end_, __cn2->end_);
+    std::swap(__cn1->cap_, __cn2->cap_);
+    for (__i_node** __p = __cn1->end_; __p != __cn1->beg_;)
+    {
+        --__p;
+        const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
+        if (__i->__ptr_ == static_cast<__node_pointer>(
+                       pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
+        {
+            __cn2->__add(*__p);
+            if (--__cn1->end_ != __p)
+                memmove(__p, __p+1, (__cn1->end_ - __p)*sizeof(__i_node*));
+        }
+        else
+            (*__p)->__c_ = __cn1;
+    }
+    for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
+    {
+        --__p;
+        const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
+        if (__i->__ptr_ == static_cast<__node_pointer>(
+                       pointer_traits<__node_base_pointer>::pointer_to(__end_)))
+        {
+            __cn1->__add(*__p);
+            if (--__cn2->end_ != __p)
+                memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
+        }
+        else
+            (*__p)->__c_ = __cn2;
+    }
+    __db->unlock();
+#endif
+}
+
+template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
+class _LIBCPP_TYPE_VIS_ONLY list
+    : private __list_imp<_Tp, _Alloc>
+{
+    typedef __list_imp<_Tp, _Alloc> base;
+    typedef typename base::__node              __node;
+    typedef typename base::__node_allocator    __node_allocator;
+    typedef typename base::__node_pointer      __node_pointer;
+    typedef typename base::__node_alloc_traits __node_alloc_traits;
+    typedef typename base::__node_base         __node_base;
+    typedef typename base::__node_base_pointer __node_base_pointer;
+
+public:
+    typedef _Tp                                      value_type;
+    typedef _Alloc                                   allocator_type;
+    static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+                  "Invalid allocator::value_type");
+    typedef value_type&                              reference;
+    typedef const value_type&                        const_reference;
+    typedef typename base::pointer                   pointer;
+    typedef typename base::const_pointer             const_pointer;
+    typedef typename base::size_type                 size_type;
+    typedef typename base::difference_type           difference_type;
+    typedef typename base::iterator                  iterator;
+    typedef typename base::const_iterator            const_iterator;
+    typedef _VSTD::reverse_iterator<iterator>         reverse_iterator;
+    typedef _VSTD::reverse_iterator<const_iterator>   const_reverse_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    list()
+        _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__insert_c(this);
+#endif
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    explicit list(const allocator_type& __a) : base(__a)
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__insert_c(this);
+#endif
+    }
+    explicit list(size_type __n);
+#if _LIBCPP_STD_VER > 11
+    explicit list(size_type __n, const allocator_type& __a);
+#endif
+    list(size_type __n, const value_type& __x);
+    list(size_type __n, const value_type& __x, const allocator_type& __a);
+    template <class _InpIter>
+        list(_InpIter __f, _InpIter __l,
+             typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
+    template <class _InpIter>
+        list(_InpIter __f, _InpIter __l, const allocator_type& __a,
+             typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
+
+    list(const list& __c);
+    list(const list& __c, const allocator_type& __a);
+    list& operator=(const list& __c);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    list(initializer_list<value_type> __il);
+    list(initializer_list<value_type> __il, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    list(list&& __c)
+        _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
+    list(list&& __c, const allocator_type& __a);
+    list& operator=(list&& __c)
+        _NOEXCEPT_(
+            __node_alloc_traits::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<__node_allocator>::value);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    list& operator=(initializer_list<value_type> __il)
+        {assign(__il.begin(), __il.end()); return *this;}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    template <class _InpIter>
+        void assign(_InpIter __f, _InpIter __l,
+             typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
+    void assign(size_type __n, const value_type& __x);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    void assign(initializer_list<value_type> __il)
+        {assign(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    allocator_type get_allocator() const _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT     {return base::__sz();}
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty() const _NOEXCEPT         {return base::empty();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT
+        {return numeric_limits<difference_type>::max();}
+
+    _LIBCPP_INLINE_VISIBILITY
+          iterator begin() _NOEXCEPT        {return base::begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin()  const _NOEXCEPT {return base::begin();}
+    _LIBCPP_INLINE_VISIBILITY
+          iterator end() _NOEXCEPT          {return base::end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()    const _NOEXCEPT {return base::end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin() const _NOEXCEPT {return base::begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend()   const _NOEXCEPT {return base::end();}
+
+    _LIBCPP_INLINE_VISIBILITY
+          reverse_iterator rbegin() _NOEXCEPT
+            {return       reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rbegin()  const _NOEXCEPT
+        {return const_reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+          reverse_iterator rend() _NOEXCEPT
+            {return       reverse_iterator(begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rend()    const _NOEXCEPT
+        {return const_reverse_iterator(begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crbegin() const _NOEXCEPT
+        {return const_reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crend()   const _NOEXCEPT
+        {return const_reverse_iterator(begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference front()
+    {
+        _LIBCPP_ASSERT(!empty(), "list::front called on empty list");
+        return base::__end_.__next_->__value_;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference front() const
+    {
+        _LIBCPP_ASSERT(!empty(), "list::front called on empty list");
+        return base::__end_.__next_->__value_;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    reference back()
+    {
+        _LIBCPP_ASSERT(!empty(), "list::back called on empty list");
+        return base::__end_.__prev_->__value_;
+    }
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference back() const
+    {
+        _LIBCPP_ASSERT(!empty(), "list::back called on empty list");
+        return base::__end_.__prev_->__value_;
+    }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void push_front(value_type&& __x);
+    void push_back(value_type&& __x);
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args>
+       void emplace_front(_Args&&... __args);
+    template <class... _Args>
+        void emplace_back(_Args&&... __args);
+    template <class... _Args>
+        iterator emplace(const_iterator __p, _Args&&... __args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+    iterator insert(const_iterator __p, value_type&& __x);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    void push_front(const value_type& __x);
+    void push_back(const value_type& __x);
+
+    iterator insert(const_iterator __p, const value_type& __x);
+    iterator insert(const_iterator __p, size_type __n, const value_type& __x);
+    template <class _InpIter>
+        iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
+             typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __p, initializer_list<value_type> __il)
+        {return insert(__p, __il.begin(), __il.end());}
+#endif   // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(list& __c)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT
+#else
+        _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
+                   __is_nothrow_swappable<__node_allocator>::value)
+#endif
+        {base::swap(__c);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {base::clear();}
+
+    void pop_front();
+    void pop_back();
+
+    iterator erase(const_iterator __p);
+    iterator erase(const_iterator __f, const_iterator __l);
+
+    void resize(size_type __n);
+    void resize(size_type __n, const value_type& __x);
+
+    void splice(const_iterator __p, list& __c);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void splice(const_iterator __p, list&& __c) {splice(__p, __c);}
+#endif
+    void splice(const_iterator __p, list& __c, const_iterator __i);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void splice(const_iterator __p, list&& __c, const_iterator __i)
+        {splice(__p, __c, __i);}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l)
+        {splice(__p, __c, __f, __l);}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    void remove(const value_type& __x);
+    template <class _Pred> void remove_if(_Pred __pred);
+    void unique();
+    template <class _BinaryPred>
+        void unique(_BinaryPred __binary_pred);
+    void merge(list& __c);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void merge(list&& __c) {merge(__c);}
+#endif
+    template <class _Comp>
+        void merge(list& __c, _Comp __comp);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Comp>
+    _LIBCPP_INLINE_VISIBILITY
+        void merge(list&& __c, _Comp __comp) {merge(__c, __comp);}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void sort();
+    template <class _Comp>
+        void sort(_Comp __comp);
+
+    void reverse() _NOEXCEPT;
+
+    bool __invariants() const;
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    bool __dereferenceable(const const_iterator* __i) const;
+    bool __decrementable(const const_iterator* __i) const;
+    bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
+    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+private:
+    static void __link_nodes  (__node_pointer __p, __node_pointer __f, __node_pointer __l);
+    void __link_nodes_at_front(__node_pointer __f, __node_pointer __l);
+    void __link_nodes_at_back (__node_pointer __f, __node_pointer __l);
+    iterator __iterator(size_type __n);
+    template <class _Comp>
+        static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
+
+    void __move_assign(list& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value);
+    void __move_assign(list& __c, false_type);
+};
+
+// Link in nodes [__f, __l] just prior to __p
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+list<_Tp, _Alloc>::__link_nodes(__node_pointer __p, __node_pointer __f, __node_pointer __l)
+{
+    __p->__prev_->__next_ = __f;
+    __f->__prev_ = __p->__prev_;
+    __p->__prev_ = __l;
+    __l->__next_ = __p;
+}
+
+// Link in nodes [__f, __l] at the front of the list
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+list<_Tp, _Alloc>::__link_nodes_at_front(__node_pointer __f, __node_pointer __l)
+{
+    __f->__prev_ = base::__end_.__self();
+    __l->__next_ = base::__end_.__next_;
+    __l->__next_->__prev_ = __l;
+    base::__end_.__next_ = __f;
+}
+
+// Link in nodes [__f, __l] at the front of the list
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+list<_Tp, _Alloc>::__link_nodes_at_back(__node_pointer __f, __node_pointer __l)
+{
+    __l->__next_ = base::__end_.__self();
+    __f->__prev_ = base::__end_.__prev_;
+    __f->__prev_->__next_ = __f;
+    base::__end_.__prev_ = __l;
+}
+
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+typename list<_Tp, _Alloc>::iterator
+list<_Tp, _Alloc>::__iterator(size_type __n)
+{
+    return __n <= base::__sz() / 2 ? _VSTD::next(begin(), __n)
+                                   : _VSTD::prev(end(), base::__sz() - __n);
+}
+
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>::list(size_type __n)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (; __n > 0; --__n)
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+        emplace_back();
+#else
+        push_back(value_type());
+#endif
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (; __n > 0; --__n)
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+        emplace_back();
+#else
+        push_back(value_type());
+#endif
+}
+#endif
+
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (; __n > 0; --__n)
+        push_back(__x);
+}
+
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_type& __a)
+    : base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (; __n > 0; --__n)
+        push_back(__x);
+}
+
+template <class _Tp, class _Alloc>
+template <class _InpIter>
+list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
+                        typename enable_if<__is_input_iterator<_InpIter>::value>::type*)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (; __f != __l; ++__f)
+        push_back(*__f);
+}
+
+template <class _Tp, class _Alloc>
+template <class _InpIter>
+list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
+                        typename enable_if<__is_input_iterator<_InpIter>::value>::type*)
+    : base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (; __f != __l; ++__f)
+        push_back(*__f);
+}
+
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>::list(const list& __c)
+    : base(allocator_type(
+           __node_alloc_traits::select_on_container_copy_construction(
+                __c.__node_alloc())))
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
+        push_back(*__i);
+}
+
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a)
+    : base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
+        push_back(*__i);
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a)
+    : base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
+            __e = __il.end(); __i != __e; ++__i)
+        push_back(*__i);
+}
+
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
+            __e = __il.end(); __i != __e; ++__i)
+        push_back(*__i);
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+list<_Tp, _Alloc>&
+list<_Tp, _Alloc>::operator=(const list& __c)
+{
+    if (this != &__c)
+    {
+        base::__copy_assign_alloc(__c);
+        assign(__c.begin(), __c.end());
+    }
+    return *this;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+list<_Tp, _Alloc>::list(list&& __c)
+    _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
+    : base(allocator_type(_VSTD::move(__c.__node_alloc())))
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    splice(end(), __c);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
+    : base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__a == __c.get_allocator())
+        splice(end(), __c);
+    else
+    {
+        typedef move_iterator<iterator> _Ip;
+        assign(_Ip(__c.begin()), _Ip(__c.end()));
+    }
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+list<_Tp, _Alloc>&
+list<_Tp, _Alloc>::operator=(list&& __c)
+        _NOEXCEPT_(
+            __node_alloc_traits::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<__node_allocator>::value)
+{
+    __move_assign(__c, integral_constant<bool,
+          __node_alloc_traits::propagate_on_container_move_assignment::value>());
+    return *this;
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::__move_assign(list& __c, false_type)
+{
+    if (base::__node_alloc() != __c.__node_alloc())
+    {
+        typedef move_iterator<iterator> _Ip;
+        assign(_Ip(__c.begin()), _Ip(__c.end()));
+    }
+    else
+        __move_assign(__c, true_type());
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
+{
+    clear();
+    base::__move_assign_alloc(__c);
+    splice(end(), __c);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+template <class _InpIter>
+void
+list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,
+                          typename enable_if<__is_input_iterator<_InpIter>::value>::type*)
+{
+    iterator __i = begin();
+    iterator __e = end();
+    for (; __f != __l && __i != __e; ++__f, ++__i)
+        *__i = *__f;
+    if (__i == __e)
+        insert(__e, __f, __l);
+    else
+        erase(__i, __e);
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
+{
+    iterator __i = begin();
+    iterator __e = end();
+    for (; __n > 0 && __i != __e; --__n, ++__i)
+        *__i = __x;
+    if (__i == __e)
+        insert(__e, __n, __x);
+    else
+        erase(__i, __e);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+_Alloc
+list<_Tp, _Alloc>::get_allocator() const _NOEXCEPT
+{
+    return allocator_type(base::__node_alloc());
+}
+
+template <class _Tp, class _Alloc>
+typename list<_Tp, _Alloc>::iterator
+list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "list::insert(iterator, x) called with an iterator not"
+        " referring to this list");
+#endif
+    __node_allocator& __na = base::__node_alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+    __hold->__prev_ = 0;
+    __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
+    __link_nodes(__p.__ptr_, __hold.get(), __hold.get());
+    ++base::__sz();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator(__hold.release(), this);
+#else
+    return iterator(__hold.release());
+#endif
+}
+
+template <class _Tp, class _Alloc>
+typename list<_Tp, _Alloc>::iterator
+list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "list::insert(iterator, n, x) called with an iterator not"
+        " referring to this list");
+    iterator __r(__p.__ptr_, this);
+#else
+    iterator __r(__p.__ptr_);
+#endif
+    if (__n > 0)
+    {
+        size_type __ds = 0;
+        __node_allocator& __na = base::__node_alloc();
+        typedef __allocator_destructor<__node_allocator> _Dp;
+        unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+        __hold->__prev_ = 0;
+        __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
+        ++__ds;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __r = iterator(__hold.get(), this);
+#else
+        __r = iterator(__hold.get());
+#endif
+        __hold.release();
+        iterator __e = __r;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (--__n; __n != 0; --__n, ++__e, ++__ds)
+            {
+                __hold.reset(__node_alloc_traits::allocate(__na, 1));
+                __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
+                __e.__ptr_->__next_ = __hold.get();
+                __hold->__prev_ = __e.__ptr_;
+                __hold.release();
+            }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            while (true)
+            {
+                __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
+                __node_pointer __prev = __e.__ptr_->__prev_;
+                __node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
+                if (__prev == 0)
+                    break;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+                __e = iterator(__prev, this);
+#else
+                __e = iterator(__prev);
+#endif
+            }
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
+        base::__sz() += __ds;
+    }
+    return __r;
+}
+
+template <class _Tp, class _Alloc>
+template <class _InpIter>
+typename list<_Tp, _Alloc>::iterator
+list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
+             typename enable_if<__is_input_iterator<_InpIter>::value>::type*)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "list::insert(iterator, range) called with an iterator not"
+        " referring to this list");
+    iterator __r(__p.__ptr_, this);
+#else
+    iterator __r(__p.__ptr_);
+#endif
+    if (__f != __l)
+    {
+        size_type __ds = 0;
+        __node_allocator& __na = base::__node_alloc();
+        typedef __allocator_destructor<__node_allocator> _Dp;
+        unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+        __hold->__prev_ = 0;
+        __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
+        ++__ds;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __r = iterator(__hold.get(), this);
+#else
+        __r = iterator(__hold.get());
+#endif
+        __hold.release();
+        iterator __e = __r;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (++__f; __f != __l; ++__f, (void) ++__e, (void) ++__ds)
+            {
+                __hold.reset(__node_alloc_traits::allocate(__na, 1));
+                __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
+                __e.__ptr_->__next_ = __hold.get();
+                __hold->__prev_ = __e.__ptr_;
+                __hold.release();
+            }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            while (true)
+            {
+                __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
+                __node_pointer __prev = __e.__ptr_->__prev_;
+                __node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
+                if (__prev == 0)
+                    break;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+                __e = iterator(__prev, this);
+#else
+                __e = iterator(__prev);
+#endif
+            }
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
+        base::__sz() += __ds;
+    }
+    return __r;
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::push_front(const value_type& __x)
+{
+    __node_allocator& __na = base::__node_alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+    __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
+    __link_nodes_at_front(__hold.get(), __hold.get());
+    ++base::__sz();
+    __hold.release();
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::push_back(const value_type& __x)
+{
+    __node_allocator& __na = base::__node_alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+    __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
+    __link_nodes_at_back(__hold.get(), __hold.get());
+    ++base::__sz();
+    __hold.release();
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::push_front(value_type&& __x)
+{
+    __node_allocator& __na = base::__node_alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+    __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
+    __link_nodes_at_front(__hold.get(), __hold.get());
+    ++base::__sz();
+    __hold.release();
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::push_back(value_type&& __x)
+{
+    __node_allocator& __na = base::__node_alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+    __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
+    __link_nodes_at_back(__hold.get(), __hold.get());
+    ++base::__sz();
+    __hold.release();
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Alloc>
+template <class... _Args>
+void
+list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
+{
+    __node_allocator& __na = base::__node_alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+    __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
+    __link_nodes_at_front(__hold.get(), __hold.get());
+    ++base::__sz();
+    __hold.release();
+}
+
+template <class _Tp, class _Alloc>
+template <class... _Args>
+void
+list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
+{
+    __node_allocator& __na = base::__node_alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+    __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
+    __link_nodes_at_back(__hold.get(), __hold.get());
+    ++base::__sz();
+    __hold.release();
+}
+
+template <class _Tp, class _Alloc>
+template <class... _Args>
+typename list<_Tp, _Alloc>::iterator
+list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "list::emplace(iterator, args...) called with an iterator not"
+        " referring to this list");
+#endif
+    __node_allocator& __na = base::__node_alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+    __hold->__prev_ = 0;
+    __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
+    __link_nodes(__p.__ptr_, __hold.get(), __hold.get());
+    ++base::__sz();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator(__hold.release(), this);
+#else
+    return iterator(__hold.release());
+#endif
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Alloc>
+typename list<_Tp, _Alloc>::iterator
+list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "list::insert(iterator, x) called with an iterator not"
+        " referring to this list");
+#endif
+    __node_allocator& __na = base::__node_alloc();
+    typedef __allocator_destructor<__node_allocator> _Dp;
+    unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+    __hold->__prev_ = 0;
+    __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
+    __link_nodes(__p.__ptr_, __hold.get(), __hold.get());
+    ++base::__sz();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator(__hold.release(), this);
+#else
+    return iterator(__hold.release());
+#endif
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::pop_front()
+{
+    _LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list");
+    __node_allocator& __na = base::__node_alloc();
+    __node_pointer __n = base::__end_.__next_;
+    base::__unlink_nodes(__n, __n);
+    --base::__sz();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __c_node* __c = __get_db()->__find_c_and_lock(this);
+    for (__i_node** __p = __c->end_; __p != __c->beg_; )
+    {
+        --__p;
+        iterator* __i = static_cast<iterator*>((*__p)->__i_);
+        if (__i->__ptr_ == __n)
+        {
+            (*__p)->__c_ = nullptr;
+            if (--__c->end_ != __p)
+                memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+        }
+    }
+    __get_db()->unlock();
+#endif
+    __node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
+    __node_alloc_traits::deallocate(__na, __n, 1);
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::pop_back()
+{
+    _LIBCPP_ASSERT(!empty(), "list::pop_back() called with empty list");
+    __node_allocator& __na = base::__node_alloc();
+    __node_pointer __n = base::__end_.__prev_;
+    base::__unlink_nodes(__n, __n);
+    --base::__sz();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __c_node* __c = __get_db()->__find_c_and_lock(this);
+    for (__i_node** __p = __c->end_; __p != __c->beg_; )
+    {
+        --__p;
+        iterator* __i = static_cast<iterator*>((*__p)->__i_);
+        if (__i->__ptr_ == __n)
+        {
+            (*__p)->__c_ = nullptr;
+            if (--__c->end_ != __p)
+                memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+        }
+    }
+    __get_db()->unlock();
+#endif
+    __node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
+    __node_alloc_traits::deallocate(__na, __n, 1);
+}
+
+template <class _Tp, class _Alloc>
+typename list<_Tp, _Alloc>::iterator
+list<_Tp, _Alloc>::erase(const_iterator __p)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "list::erase(iterator) called with an iterator not"
+        " referring to this list");
+#endif
+    _LIBCPP_ASSERT(__p != end(),
+        "list::erase(iterator) called with a non-dereferenceable iterator");
+    __node_allocator& __na = base::__node_alloc();
+    __node_pointer __n = __p.__ptr_;
+    __node_pointer __r = __n->__next_;
+    base::__unlink_nodes(__n, __n);
+    --base::__sz();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __c_node* __c = __get_db()->__find_c_and_lock(this);
+    for (__i_node** __p = __c->end_; __p != __c->beg_; )
+    {
+        --__p;
+        iterator* __i = static_cast<iterator*>((*__p)->__i_);
+        if (__i->__ptr_ == __n)
+        {
+            (*__p)->__c_ = nullptr;
+            if (--__c->end_ != __p)
+                memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+        }
+    }
+    __get_db()->unlock();
+#endif
+    __node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
+    __node_alloc_traits::deallocate(__na, __n, 1);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator(__r, this);
+#else
+    return iterator(__r);
+#endif
+}
+
+template <class _Tp, class _Alloc>
+typename list<_Tp, _Alloc>::iterator
+list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__f) == this,
+        "list::erase(iterator, iterator) called with an iterator not"
+        " referring to this list");
+#endif
+    if (__f != __l)
+    {
+        __node_allocator& __na = base::__node_alloc();
+        base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_);
+        while (__f != __l)
+        {
+            __node_pointer __n = __f.__ptr_;
+            ++__f;
+            --base::__sz();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            __c_node* __c = __get_db()->__find_c_and_lock(this);
+            for (__i_node** __p = __c->end_; __p != __c->beg_; )
+            {
+                --__p;
+                iterator* __i = static_cast<iterator*>((*__p)->__i_);
+                if (__i->__ptr_ == __n)
+                {
+                    (*__p)->__c_ = nullptr;
+                    if (--__c->end_ != __p)
+                        memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+                }
+            }
+            __get_db()->unlock();
+#endif
+            __node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
+            __node_alloc_traits::deallocate(__na, __n, 1);
+        }
+    }
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator(__l.__ptr_, this);
+#else
+    return iterator(__l.__ptr_);
+#endif
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::resize(size_type __n)
+{
+    if (__n < base::__sz())
+        erase(__iterator(__n), end());
+    else if (__n > base::__sz())
+    {
+        __n -= base::__sz();
+        size_type __ds = 0;
+        __node_allocator& __na = base::__node_alloc();
+        typedef __allocator_destructor<__node_allocator> _Dp;
+        unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+        __hold->__prev_ = 0;
+        __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
+        ++__ds;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        iterator __r = iterator(__hold.release(), this);
+#else
+        iterator __r = iterator(__hold.release());
+#endif
+        iterator __e = __r;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (--__n; __n != 0; --__n, ++__e, ++__ds)
+            {
+                __hold.reset(__node_alloc_traits::allocate(__na, 1));
+                __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
+                __e.__ptr_->__next_ = __hold.get();
+                __hold->__prev_ = __e.__ptr_;
+                __hold.release();
+            }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            while (true)
+            {
+                __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
+                __node_pointer __prev = __e.__ptr_->__prev_;
+                __node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
+                if (__prev == 0)
+                    break;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+                __e = iterator(__prev, this);
+#else
+                __e = iterator(__prev);
+#endif
+            }
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __link_nodes_at_back(__r.__ptr_, __e.__ptr_);
+        base::__sz() += __ds;
+    }
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
+{
+    if (__n < base::__sz())
+        erase(__iterator(__n), end());
+    else if (__n > base::__sz())
+    {
+        __n -= base::__sz();
+        size_type __ds = 0;
+        __node_allocator& __na = base::__node_alloc();
+        typedef __allocator_destructor<__node_allocator> _Dp;
+        unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
+        __hold->__prev_ = 0;
+        __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
+        ++__ds;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        iterator __r = iterator(__hold.release(), this);
+#else
+        iterator __r = iterator(__hold.release());
+#endif
+        iterator __e = __r;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (--__n; __n != 0; --__n, ++__e, ++__ds)
+            {
+                __hold.reset(__node_alloc_traits::allocate(__na, 1));
+                __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
+                __e.__ptr_->__next_ = __hold.get();
+                __hold->__prev_ = __e.__ptr_;
+                __hold.release();
+            }
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            while (true)
+            {
+                __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
+                __node_pointer __prev = __e.__ptr_->__prev_;
+                __node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
+                if (__prev == 0)
+                    break;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+                __e = iterator(__prev, this);
+#else
+                __e = iterator(__prev);
+#endif
+            }
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        __link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
+                         pointer_to(base::__end_)), __r.__ptr_, __e.__ptr_);
+        base::__sz() += __ds;
+    }
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
+{
+    _LIBCPP_ASSERT(this != &__c,
+                   "list::splice(iterator, list) called with this == &list");
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "list::splice(iterator, list) called with an iterator not"
+        " referring to this list");
+#endif
+    if (!__c.empty())
+    {
+        __node_pointer __f = __c.__end_.__next_;
+        __node_pointer __l = __c.__end_.__prev_;
+        base::__unlink_nodes(__f, __l);
+        __link_nodes(__p.__ptr_, __f, __l);
+        base::__sz() += __c.__sz();
+        __c.__sz() = 0;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __libcpp_db* __db = __get_db();
+        __c_node* __cn1 = __db->__find_c_and_lock(this);
+        __c_node* __cn2 = __db->__find_c(&__c);
+        for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
+        {
+            --__p;
+            iterator* __i = static_cast<iterator*>((*__p)->__i_);
+            if (__i->__ptr_ != static_cast<__node_pointer>(
+                       pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
+            {
+                __cn1->__add(*__p);
+                (*__p)->__c_ = __cn1;
+                if (--__cn2->end_ != __p)
+                    memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
+            }
+        }
+        __db->unlock();
+#endif
+    }
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "list::splice(iterator, list, iterator) called with first iterator not"
+        " referring to this list");
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__i) == &__c,
+        "list::splice(iterator, list, iterator) called with second iterator not"
+        " referring to list argument");
+    _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(&__i),
+        "list::splice(iterator, list, iterator) called with second iterator not"
+        " derefereceable");
+#endif
+    if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
+    {
+        __node_pointer __f = __i.__ptr_;
+        base::__unlink_nodes(__f, __f);
+        __link_nodes(__p.__ptr_, __f, __f);
+        --__c.__sz();
+        ++base::__sz();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __libcpp_db* __db = __get_db();
+        __c_node* __cn1 = __db->__find_c_and_lock(this);
+        __c_node* __cn2 = __db->__find_c(&__c);
+        for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
+        {
+            --__p;
+            iterator* __j = static_cast<iterator*>((*__p)->__i_);
+            if (__j->__ptr_ == __f)
+            {
+                __cn1->__add(*__p);
+                (*__p)->__c_ = __cn1;
+                if (--__cn2->end_ != __p)
+                    memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
+            }
+        }
+        __db->unlock();
+#endif
+    }
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+        "list::splice(iterator, list, iterator, iterator) called with first iterator not"
+        " referring to this list");
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__f) == &__c,
+        "list::splice(iterator, list, iterator, iterator) called with second iterator not"
+        " referring to list argument");
+    if (this == &__c)
+    {
+        for (const_iterator __i = __f; __i != __l; ++__i)
+            _LIBCPP_ASSERT(__i != __p,
+                           "list::splice(iterator, list, iterator, iterator)"
+                           " called with the first iterator within the range"
+                           " of the second and third iterators");
+    }
+#endif
+    if (__f != __l)
+    {
+        if (this != &__c)
+        {
+            size_type __s = _VSTD::distance(__f, __l);
+            __c.__sz() -= __s;
+            base::__sz() += __s;
+        }
+        __node_pointer __first = __f.__ptr_;
+        --__l;
+        __node_pointer __last = __l.__ptr_;
+        base::__unlink_nodes(__first, __last);
+        __link_nodes(__p.__ptr_, __first, __last);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __libcpp_db* __db = __get_db();
+        __c_node* __cn1 = __db->__find_c_and_lock(this);
+        __c_node* __cn2 = __db->__find_c(&__c);
+        for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
+        {
+            --__p;
+            iterator* __j = static_cast<iterator*>((*__p)->__i_);
+            for (__node_pointer __k = __f.__ptr_;
+                                          __k != __l.__ptr_; __k = __k->__next_)
+            {
+                if (__j->__ptr_ == __k)
+                {
+                    __cn1->__add(*__p);
+                    (*__p)->__c_ = __cn1;
+                    if (--__cn2->end_ != __p)
+                        memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
+                }
+            }
+        }
+        __db->unlock();
+#endif
+    }
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::remove(const value_type& __x)
+{
+    list<_Tp, _Alloc> __deleted_nodes; // collect the nodes we're removing
+    for (const_iterator __i = begin(), __e = end(); __i != __e;)
+    {
+        if (*__i == __x)
+        {
+            const_iterator __j = _VSTD::next(__i);
+            for (; __j != __e && *__j == __x; ++__j)
+                ;
+            __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
+            __i = __j;
+            if (__i != __e)
+                ++__i;
+        }
+        else
+            ++__i;
+    }
+}
+
+template <class _Tp, class _Alloc>
+template <class _Pred>
+void
+list<_Tp, _Alloc>::remove_if(_Pred __pred)
+{
+    for (iterator __i = begin(), __e = end(); __i != __e;)
+    {
+        if (__pred(*__i))
+        {
+            iterator __j = _VSTD::next(__i);
+            for (; __j != __e && __pred(*__j); ++__j)
+                ;
+            __i = erase(__i, __j);
+            if (__i != __e)
+                ++__i;
+        }
+        else
+            ++__i;
+    }
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+list<_Tp, _Alloc>::unique()
+{
+    unique(__equal_to<value_type>());
+}
+
+template <class _Tp, class _Alloc>
+template <class _BinaryPred>
+void
+list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
+{
+    for (iterator __i = begin(), __e = end(); __i != __e;)
+    {
+        iterator __j = _VSTD::next(__i);
+        for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
+            ;
+        if (++__i != __j)
+            __i = erase(__i, __j);
+    }
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+list<_Tp, _Alloc>::merge(list& __c)
+{
+    merge(__c, __less<value_type>());
+}
+
+template <class _Tp, class _Alloc>
+template <class _Comp>
+void
+list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
+{
+    if (this != &__c)
+    {
+        iterator __f1 = begin();
+        iterator __e1 = end();
+        iterator __f2 = __c.begin();
+        iterator __e2 = __c.end();
+        while (__f1 != __e1 && __f2 != __e2)
+        {
+            if (__comp(*__f2, *__f1))
+            {
+                size_type __ds = 1;
+                iterator __m2 = _VSTD::next(__f2);
+                for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, ++__ds)
+                    ;
+                base::__sz() += __ds;
+                __c.__sz() -= __ds;
+                __node_pointer __f = __f2.__ptr_;
+                __node_pointer __l = __m2.__ptr_->__prev_;
+                __f2 = __m2;
+                base::__unlink_nodes(__f, __l);
+                __m2 = _VSTD::next(__f1);
+                __link_nodes(__f1.__ptr_, __f, __l);
+                __f1 = __m2;
+            }
+            else
+                ++__f1;
+        }
+        splice(__e1, __c);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __libcpp_db* __db = __get_db();
+        __c_node* __cn1 = __db->__find_c_and_lock(this);
+        __c_node* __cn2 = __db->__find_c(&__c);
+        for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
+        {
+            --__p;
+            iterator* __i = static_cast<iterator*>((*__p)->__i_);
+            if (__i->__ptr_ != static_cast<__node_pointer>(
+                       pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
+            {
+                __cn1->__add(*__p);
+                (*__p)->__c_ = __cn1;
+                if (--__cn2->end_ != __p)
+                    memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
+            }
+        }
+        __db->unlock();
+#endif
+    }
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+list<_Tp, _Alloc>::sort()
+{
+    sort(__less<value_type>());
+}
+
+template <class _Tp, class _Alloc>
+template <class _Comp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+list<_Tp, _Alloc>::sort(_Comp __comp)
+{
+    __sort(begin(), end(), base::__sz(), __comp);
+}
+
+template <class _Tp, class _Alloc>
+template <class _Comp>
+typename list<_Tp, _Alloc>::iterator
+list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp)
+{
+    switch (__n)
+    {
+    case 0:
+    case 1:
+        return __f1;
+    case 2:
+        if (__comp(*--__e2, *__f1))
+        {
+            __node_pointer __f = __e2.__ptr_;
+            base::__unlink_nodes(__f, __f);
+            __link_nodes(__f1.__ptr_, __f, __f);
+            return __e2;
+        }
+        return __f1;
+    }
+    size_type __n2 = __n / 2;
+    iterator __e1 = _VSTD::next(__f1, __n2);
+    iterator  __r = __f1 = __sort(__f1, __e1, __n2, __comp);
+    iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
+    if (__comp(*__f2, *__f1))
+    {
+        iterator __m2 = _VSTD::next(__f2);
+        for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
+            ;
+        __node_pointer __f = __f2.__ptr_;
+        __node_pointer __l = __m2.__ptr_->__prev_;
+        __r = __f2;
+        __e1 = __f2 = __m2;
+        base::__unlink_nodes(__f, __l);
+        __m2 = _VSTD::next(__f1);
+        __link_nodes(__f1.__ptr_, __f, __l);
+        __f1 = __m2;
+    }
+    else
+        ++__f1;
+    while (__f1 != __e1 && __f2 != __e2)
+    {
+        if (__comp(*__f2, *__f1))
+        {
+            iterator __m2 = _VSTD::next(__f2);
+            for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
+                ;
+            __node_pointer __f = __f2.__ptr_;
+            __node_pointer __l = __m2.__ptr_->__prev_;
+            if (__e1 == __f2)
+                __e1 = __m2;
+            __f2 = __m2;
+            base::__unlink_nodes(__f, __l);
+            __m2 = _VSTD::next(__f1);
+            __link_nodes(__f1.__ptr_, __f, __l);
+            __f1 = __m2;
+        }
+        else
+            ++__f1;
+    }
+    return __r;
+}
+
+template <class _Tp, class _Alloc>
+void
+list<_Tp, _Alloc>::reverse() _NOEXCEPT
+{
+    if (base::__sz() > 1)
+    {
+        iterator __e = end();
+        for (iterator __i = begin(); __i.__ptr_ != __e.__ptr_;)
+        {
+            _VSTD::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_);
+            __i.__ptr_ = __i.__ptr_->__prev_;
+        }
+        _VSTD::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_);
+    }
+}
+
+template <class _Tp, class _Alloc>
+bool
+list<_Tp, _Alloc>::__invariants() const
+{
+    return size() == _VSTD::distance(begin(), end());
+}
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+template <class _Tp, class _Alloc>
+bool
+list<_Tp, _Alloc>::__dereferenceable(const const_iterator* __i) const
+{
+    return __i->__ptr_ != static_cast<__node_pointer>(
+                       pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(this->__end_)));
+}
+
+template <class _Tp, class _Alloc>
+bool
+list<_Tp, _Alloc>::__decrementable(const const_iterator* __i) const
+{
+    return !empty() &&  __i->__ptr_ != base::__end_.__next_;
+}
+
+template <class _Tp, class _Alloc>
+bool
+list<_Tp, _Alloc>::__addable(const const_iterator* __i, ptrdiff_t __n) const
+{
+    return false;
+}
+
+template <class _Tp, class _Alloc>
+bool
+list<_Tp, _Alloc>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const
+{
+    return false;
+}
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+{
+    return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+{
+    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_LIST

Property changes on: lab4/.minix-src/include/c++/list
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/memory
===================================================================
--- lab4/.minix-src/include/c++/memory	(nonexistent)
+++ lab4/.minix-src/include/c++/memory	(revision 13)
@@ -0,0 +1,5591 @@
+// -*- C++ -*-
+//===-------------------------- memory ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_MEMORY
+#define _LIBCPP_MEMORY
+
+/*
+    memory synopsis
+
+namespace std
+{
+
+struct allocator_arg_t { };
+constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+
+template <class T, class Alloc> struct uses_allocator;
+
+template <class Ptr>
+struct pointer_traits
+{
+    typedef Ptr pointer;
+    typedef <details> element_type;
+    typedef <details> difference_type;
+
+    template <class U> using rebind = <details>;
+
+    static pointer pointer_to(<details>);
+};
+
+template <class T>
+struct pointer_traits<T*>
+{
+    typedef T* pointer;
+    typedef T element_type;
+    typedef ptrdiff_t difference_type;
+
+    template <class U> using rebind = U*;
+
+    static pointer pointer_to(<details>) noexcept;
+};
+
+template <class Alloc>
+struct allocator_traits
+{
+    typedef Alloc                        allocator_type;
+    typedef typename allocator_type::value_type
+                                         value_type;
+
+    typedef Alloc::pointer | value_type* pointer;
+    typedef Alloc::const_pointer
+          | pointer_traits<pointer>::rebind<const value_type>
+                                         const_pointer;
+    typedef Alloc::void_pointer
+          | pointer_traits<pointer>::rebind<void>
+                                         void_pointer;
+    typedef Alloc::const_void_pointer
+          | pointer_traits<pointer>::rebind<const void>
+                                         const_void_pointer;
+    typedef Alloc::difference_type
+          | pointer_traits<pointer>::difference_type
+                                         difference_type;
+    typedef Alloc::size_type
+          | make_unsigned<difference_type>::type
+                                         size_type;
+    typedef Alloc::propagate_on_container_copy_assignment
+          | false_type                   propagate_on_container_copy_assignment;
+    typedef Alloc::propagate_on_container_move_assignment
+          | false_type                   propagate_on_container_move_assignment;
+    typedef Alloc::propagate_on_container_swap
+          | false_type                   propagate_on_container_swap;
+    typedef Alloc::is_always_equal
+          | is_empty                     is_always_equal;
+
+    template <class T> using rebind_alloc  = Alloc::rebind<U>::other | Alloc<T, Args...>;
+    template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
+
+    static pointer allocate(allocator_type& a, size_type n);
+    static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint);
+
+    static void deallocate(allocator_type& a, pointer p, size_type n) noexcept;
+
+    template <class T, class... Args>
+        static void construct(allocator_type& a, T* p, Args&&... args);
+
+    template <class T>
+        static void destroy(allocator_type& a, T* p);
+
+    static size_type max_size(const allocator_type& a); // noexcept in C++14
+
+    static allocator_type
+        select_on_container_copy_construction(const allocator_type& a);
+};
+
+template <>
+class allocator<void>
+{
+public:
+    typedef void*                                 pointer;
+    typedef const void*                           const_pointer;
+    typedef void                                  value_type;
+
+    template <class _Up> struct rebind {typedef allocator<_Up> other;};
+};
+
+template <class T>
+class allocator
+{
+public:
+    typedef size_t                                size_type;
+    typedef ptrdiff_t                             difference_type;
+    typedef T*                                    pointer;
+    typedef const T*                              const_pointer;
+    typedef typename add_lvalue_reference<T>::type       reference;
+    typedef typename add_lvalue_reference<const T>::type const_reference;
+    typedef T                                     value_type;
+
+    template <class U> struct rebind {typedef allocator<U> other;};
+
+    allocator() noexcept;
+    allocator(const allocator&) noexcept;
+    template <class U> allocator(const allocator<U>&) noexcept;
+    ~allocator();
+    pointer address(reference x) const noexcept;
+    const_pointer address(const_reference x) const noexcept;
+    pointer allocate(size_type, allocator<void>::const_pointer hint = 0);
+    void deallocate(pointer p, size_type n) noexcept;
+    size_type max_size() const noexcept;
+    template<class U, class... Args>
+        void construct(U* p, Args&&... args);
+    template <class U>
+        void destroy(U* p);
+};
+
+template <class T, class U>
+bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
+
+template <class T, class U>
+bool operator!=(const allocator<T>&, const allocator<U>&) noexcept;
+
+template <class OutputIterator, class T>
+class raw_storage_iterator
+    : public iterator<output_iterator_tag,
+                      T,                               // purposefully not C++03
+                      ptrdiff_t,                       // purposefully not C++03
+                      T*,                              // purposefully not C++03
+                      raw_storage_iterator&>           // purposefully not C++03
+{
+public:
+    explicit raw_storage_iterator(OutputIterator x);
+    raw_storage_iterator& operator*();
+    raw_storage_iterator& operator=(const T& element);
+    raw_storage_iterator& operator++();
+    raw_storage_iterator  operator++(int);
+};
+
+template <class T> pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept;
+template <class T> void               return_temporary_buffer(T* p) noexcept;
+
+template <class T> T* addressof(T& r) noexcept;
+
+template <class InputIterator, class ForwardIterator>
+ForwardIterator
+uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator result);
+
+template <class InputIterator, class Size, class ForwardIterator>
+ForwardIterator
+uninitialized_copy_n(InputIterator first, Size n, ForwardIterator result);
+
+template <class ForwardIterator, class T>
+void uninitialized_fill(ForwardIterator first, ForwardIterator last, const T& x);
+
+template <class ForwardIterator, class Size, class T>
+ForwardIterator
+uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
+
+template <class Y> struct auto_ptr_ref {};
+
+template<class X>
+class auto_ptr
+{
+public:
+    typedef X element_type;
+
+    explicit auto_ptr(X* p =0) throw();
+    auto_ptr(auto_ptr&) throw();
+    template<class Y> auto_ptr(auto_ptr<Y>&) throw();
+    auto_ptr& operator=(auto_ptr&) throw();
+    template<class Y> auto_ptr& operator=(auto_ptr<Y>&) throw();
+    auto_ptr& operator=(auto_ptr_ref<X> r) throw();
+    ~auto_ptr() throw();
+
+    typename add_lvalue_reference<X>::type operator*() const throw();
+    X* operator->() const throw();
+    X* get() const throw();
+    X* release() throw();
+    void reset(X* p =0) throw();
+
+    auto_ptr(auto_ptr_ref<X>) throw();
+    template<class Y> operator auto_ptr_ref<Y>() throw();
+    template<class Y> operator auto_ptr<Y>() throw();
+};
+
+template <class T>
+struct default_delete
+{
+    constexpr default_delete() noexcept = default;
+    template <class U> default_delete(const default_delete<U>&) noexcept;
+
+    void operator()(T*) const noexcept;
+};
+
+template <class T>
+struct default_delete<T[]>
+{
+    constexpr default_delete() noexcept = default;
+    void operator()(T*) const noexcept;
+    template <class U> void operator()(U*) const = delete;
+};
+
+template <class T, class D = default_delete<T>>
+class unique_ptr
+{
+public:
+    typedef see below pointer;
+    typedef T element_type;
+    typedef D deleter_type;
+
+    // constructors
+    constexpr unique_ptr() noexcept;
+    explicit unique_ptr(pointer p) noexcept;
+    unique_ptr(pointer p, see below d1) noexcept;
+    unique_ptr(pointer p, see below d2) noexcept;
+    unique_ptr(unique_ptr&& u) noexcept;
+    unique_ptr(nullptr_t) noexcept : unique_ptr() { }
+    template <class U, class E>
+        unique_ptr(unique_ptr<U, E>&& u) noexcept;
+    template <class U>
+        unique_ptr(auto_ptr<U>&& u) noexcept;
+
+    // destructor
+    ~unique_ptr();
+
+    // assignment
+    unique_ptr& operator=(unique_ptr&& u) noexcept;
+    template <class U, class E> unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
+    unique_ptr& operator=(nullptr_t) noexcept;
+
+    // observers
+    typename add_lvalue_reference<T>::type operator*() const;
+    pointer operator->() const noexcept;
+    pointer get() const noexcept;
+    deleter_type& get_deleter() noexcept;
+    const deleter_type& get_deleter() const noexcept;
+    explicit operator bool() const noexcept;
+
+    // modifiers
+    pointer release() noexcept;
+    void reset(pointer p = pointer()) noexcept;
+    void swap(unique_ptr& u) noexcept;
+};
+
+template <class T, class D>
+class unique_ptr<T[], D>
+{
+public:
+    typedef implementation-defined pointer;
+    typedef T element_type;
+    typedef D deleter_type;
+
+    // constructors
+    constexpr unique_ptr() noexcept;
+    explicit unique_ptr(pointer p) noexcept;
+    unique_ptr(pointer p, see below d) noexcept;
+    unique_ptr(pointer p, see below d) noexcept;
+    unique_ptr(unique_ptr&& u) noexcept;
+    unique_ptr(nullptr_t) noexcept : unique_ptr() { }
+
+    // destructor
+    ~unique_ptr();
+
+    // assignment
+    unique_ptr& operator=(unique_ptr&& u) noexcept;
+    unique_ptr& operator=(nullptr_t) noexcept;
+
+    // observers
+    T& operator[](size_t i) const;
+    pointer get() const noexcept;
+    deleter_type& get_deleter() noexcept;
+    const deleter_type& get_deleter() const noexcept;
+    explicit operator bool() const noexcept;
+
+    // modifiers
+    pointer release() noexcept;
+    void reset(pointer p = pointer()) noexcept;
+    void reset(nullptr_t) noexcept;
+    template <class U> void reset(U) = delete;
+    void swap(unique_ptr& u) noexcept;
+};
+
+template <class T, class D>
+    void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;
+
+template <class T1, class D1, class T2, class D2>
+    bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+template <class T1, class D1, class T2, class D2>
+    bool operator!=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+template <class T1, class D1, class T2, class D2>
+    bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+template <class T1, class D1, class T2, class D2>
+    bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+template <class T1, class D1, class T2, class D2>
+    bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+template <class T1, class D1, class T2, class D2>
+    bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
+template <class T, class D>
+    bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;
+template <class T, class D>
+    bool operator==(nullptr_t, const unique_ptr<T, D>& y) noexcept;
+template <class T, class D>
+    bool operator!=(const unique_ptr<T, D>& x, nullptr_t) noexcept;
+template <class T, class D>
+    bool operator!=(nullptr_t, const unique_ptr<T, D>& y) noexcept;
+
+template <class T, class D>
+    bool operator<(const unique_ptr<T, D>& x, nullptr_t);
+template <class T, class D>
+    bool operator<(nullptr_t, const unique_ptr<T, D>& y);
+template <class T, class D>
+    bool operator<=(const unique_ptr<T, D>& x, nullptr_t);
+template <class T, class D>
+    bool operator<=(nullptr_t, const unique_ptr<T, D>& y);
+template <class T, class D>
+    bool operator>(const unique_ptr<T, D>& x, nullptr_t);
+template <class T, class D>
+    bool operator>(nullptr_t, const unique_ptr<T, D>& y);
+template <class T, class D>
+    bool operator>=(const unique_ptr<T, D>& x, nullptr_t);
+template <class T, class D>
+    bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
+
+class bad_weak_ptr
+    : public std::exception
+{
+    bad_weak_ptr() noexcept;
+};
+
+template<class T, class... Args> unique_ptr<T> make_unique(Args&&... args);     // C++14
+template<class T>                unique_ptr<T> make_unique(size_t n);           // C++14
+template<class T, class... Args> unspecified   make_unique(Args&&...) = delete; // C++14, T == U[N]
+
+template<class T>
+class shared_ptr
+{
+public:
+    typedef T element_type;
+
+    // constructors:
+    constexpr shared_ptr() noexcept;
+    template<class Y> explicit shared_ptr(Y* p);
+    template<class Y, class D> shared_ptr(Y* p, D d);
+    template<class Y, class D, class A> shared_ptr(Y* p, D d, A a);
+    template <class D> shared_ptr(nullptr_t p, D d);
+    template <class D, class A> shared_ptr(nullptr_t p, D d, A a);
+    template<class Y> shared_ptr(const shared_ptr<Y>& r, T *p) noexcept;
+    shared_ptr(const shared_ptr& r) noexcept;
+    template<class Y> shared_ptr(const shared_ptr<Y>& r) noexcept;
+    shared_ptr(shared_ptr&& r) noexcept;
+    template<class Y> shared_ptr(shared_ptr<Y>&& r) noexcept;
+    template<class Y> explicit shared_ptr(const weak_ptr<Y>& r);
+    template<class Y> shared_ptr(auto_ptr<Y>&& r);
+    template <class Y, class D> shared_ptr(unique_ptr<Y, D>&& r);
+    shared_ptr(nullptr_t) : shared_ptr() { }
+
+    // destructor:
+    ~shared_ptr();
+
+    // assignment:
+    shared_ptr& operator=(const shared_ptr& r) noexcept;
+    template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r) noexcept;
+    shared_ptr& operator=(shared_ptr&& r) noexcept;
+    template<class Y> shared_ptr& operator=(shared_ptr<Y>&& r);
+    template<class Y> shared_ptr& operator=(auto_ptr<Y>&& r);
+    template <class Y, class D> shared_ptr& operator=(unique_ptr<Y, D>&& r);
+
+    // modifiers:
+    void swap(shared_ptr& r) noexcept;
+    void reset() noexcept;
+    template<class Y> void reset(Y* p);
+    template<class Y, class D> void reset(Y* p, D d);
+    template<class Y, class D, class A> void reset(Y* p, D d, A a);
+
+    // observers:
+    T* get() const noexcept;
+    T& operator*() const noexcept;
+    T* operator->() const noexcept;
+    long use_count() const noexcept;
+    bool unique() const noexcept;
+    explicit operator bool() const noexcept;
+    template<class U> bool owner_before(shared_ptr<U> const& b) const;
+    template<class U> bool owner_before(weak_ptr<U> const& b) const;
+};
+
+// shared_ptr comparisons:
+template<class T, class U>
+    bool operator==(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
+template<class T, class U>
+    bool operator!=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
+template<class T, class U>
+    bool operator<(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
+template<class T, class U>
+    bool operator>(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
+template<class T, class U>
+    bool operator<=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
+template<class T, class U>
+    bool operator>=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
+
+template <class T>
+    bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;
+template <class T>
+    bool operator==(nullptr_t, const shared_ptr<T>& y) noexcept;
+template <class T>
+    bool operator!=(const shared_ptr<T>& x, nullptr_t) noexcept;
+template <class T>
+    bool operator!=(nullptr_t, const shared_ptr<T>& y) noexcept;
+template <class T>
+    bool operator<(const shared_ptr<T>& x, nullptr_t) noexcept;
+template <class T>
+bool operator<(nullptr_t, const shared_ptr<T>& y) noexcept;
+template <class T>
+    bool operator<=(const shared_ptr<T>& x, nullptr_t) noexcept;
+template <class T>
+    bool operator<=(nullptr_t, const shared_ptr<T>& y) noexcept;
+template <class T>
+    bool operator>(const shared_ptr<T>& x, nullptr_t) noexcept;
+template <class T>
+    bool operator>(nullptr_t, const shared_ptr<T>& y) noexcept;
+template <class T>
+    bool operator>=(const shared_ptr<T>& x, nullptr_t) noexcept;
+template <class T>
+    bool operator>=(nullptr_t, const shared_ptr<T>& y) noexcept;
+
+// shared_ptr specialized algorithms:
+template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;
+
+// shared_ptr casts:
+template<class T, class U>
+    shared_ptr<T> static_pointer_cast(shared_ptr<U> const& r) noexcept;
+template<class T, class U>
+    shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const& r) noexcept;
+template<class T, class U>
+    shared_ptr<T> const_pointer_cast(shared_ptr<U> const& r) noexcept;
+
+// shared_ptr I/O:
+template<class E, class T, class Y>
+    basic_ostream<E, T>& operator<< (basic_ostream<E, T>& os, shared_ptr<Y> const& p);
+
+// shared_ptr get_deleter:
+template<class D, class T> D* get_deleter(shared_ptr<T> const& p) noexcept;
+
+template<class T, class... Args>
+    shared_ptr<T> make_shared(Args&&... args);
+template<class T, class A, class... Args>
+    shared_ptr<T> allocate_shared(const A& a, Args&&... args);
+
+template<class T>
+class weak_ptr
+{
+public:
+    typedef T element_type;
+
+    // constructors
+    constexpr weak_ptr() noexcept;
+    template<class Y> weak_ptr(shared_ptr<Y> const& r) noexcept;
+    weak_ptr(weak_ptr const& r) noexcept;
+    template<class Y> weak_ptr(weak_ptr<Y> const& r) noexcept;
+    weak_ptr(weak_ptr&& r) noexcept;                      // C++14
+    template<class Y> weak_ptr(weak_ptr<Y>&& r) noexcept; // C++14
+
+    // destructor
+    ~weak_ptr();
+
+    // assignment
+    weak_ptr& operator=(weak_ptr const& r) noexcept;
+    template<class Y> weak_ptr& operator=(weak_ptr<Y> const& r) noexcept;
+    template<class Y> weak_ptr& operator=(shared_ptr<Y> const& r) noexcept;
+    weak_ptr& operator=(weak_ptr&& r) noexcept;                      // C++14
+    template<class Y> weak_ptr& operator=(weak_ptr<Y>&& r) noexcept; // C++14
+
+    // modifiers
+    void swap(weak_ptr& r) noexcept;
+    void reset() noexcept;
+
+    // observers
+    long use_count() const noexcept;
+    bool expired() const noexcept;
+    shared_ptr<T> lock() const noexcept;
+    template<class U> bool owner_before(shared_ptr<U> const& b) const;
+    template<class U> bool owner_before(weak_ptr<U> const& b) const;
+};
+
+// weak_ptr specialized algorithms:
+template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;
+
+// class owner_less:
+template<class T> struct owner_less;
+
+template<class T>
+struct owner_less<shared_ptr<T>>
+    : binary_function<shared_ptr<T>, shared_ptr<T>, bool>
+{
+    typedef bool result_type;
+    bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const;
+    bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
+    bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
+};
+
+template<class T>
+struct owner_less<weak_ptr<T>>
+    : binary_function<weak_ptr<T>, weak_ptr<T>, bool>
+{
+    typedef bool result_type;
+    bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const;
+    bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
+    bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
+};
+
+template<class T>
+class enable_shared_from_this
+{
+protected:
+    constexpr enable_shared_from_this() noexcept;
+    enable_shared_from_this(enable_shared_from_this const&) noexcept;
+    enable_shared_from_this& operator=(enable_shared_from_this const&) noexcept;
+    ~enable_shared_from_this();
+public:
+    shared_ptr<T> shared_from_this();
+    shared_ptr<T const> shared_from_this() const;
+};
+
+template<class T>
+    bool atomic_is_lock_free(const shared_ptr<T>* p);
+template<class T>
+    shared_ptr<T> atomic_load(const shared_ptr<T>* p);
+template<class T>
+    shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);
+template<class T>
+    void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);
+template<class T>
+    void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
+template<class T>
+    shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
+template<class T>
+    shared_ptr<T>
+    atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
+template<class T>
+    bool
+    atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
+template<class T>
+    bool
+    atomic_compare_exchange_strong( shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
+template<class T>
+    bool
+    atomic_compare_exchange_weak_explicit(shared_ptr<T>* p, shared_ptr<T>* v,
+                                          shared_ptr<T> w, memory_order success,
+                                          memory_order failure);
+template<class T>
+    bool
+    atomic_compare_exchange_strong_explicit(shared_ptr<T>* p, shared_ptr<T>* v,
+                                            shared_ptr<T> w, memory_order success,
+                                            memory_order failure);
+// Hash support
+template <class T> struct hash;
+template <class T, class D> struct hash<unique_ptr<T, D> >;
+template <class T> struct hash<shared_ptr<T> >;
+
+// Pointer safety
+enum class pointer_safety { relaxed, preferred, strict };
+void declare_reachable(void *p);
+template <class T> T *undeclare_reachable(T *p);
+void declare_no_pointers(char *p, size_t n);
+void undeclare_no_pointers(char *p, size_t n);
+pointer_safety get_pointer_safety() noexcept;
+
+void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <type_traits>
+#include <typeinfo>
+#include <cstddef>
+#include <cstdint>
+#include <new>
+#include <utility>
+#include <limits>
+#include <iterator>
+#include <__functional_base>
+#include <iosfwd>
+#include <tuple>
+#include <cstring>
+#if defined(_LIBCPP_NO_EXCEPTIONS)
+    #include <cassert>
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
+#  include <atomic>
+#endif
+
+#include <__undef_min_max>
+#include <__undef___deallocate>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _ValueType>
+inline _LIBCPP_ALWAYS_INLINE
+_ValueType __libcpp_relaxed_load(_ValueType const* __value) {
+#if !defined(_LIBCPP_HAS_NO_THREADS) && \
+    defined(__ATOMIC_RELAXED) &&        \
+    (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407)
+    return __atomic_load_n(__value, __ATOMIC_RELAXED);
+#else
+    return *__value;
+#endif
+}
+
+// addressof moved to <__functional_base>
+
+template <class _Tp> class allocator;
+
+template <>
+class _LIBCPP_TYPE_VIS_ONLY allocator<void>
+{
+public:
+    typedef void*             pointer;
+    typedef const void*       const_pointer;
+    typedef void              value_type;
+
+    template <class _Up> struct rebind {typedef allocator<_Up> other;};
+};
+
+template <>
+class _LIBCPP_TYPE_VIS_ONLY allocator<const void>
+{
+public:
+    typedef const void*       pointer;
+    typedef const void*       const_pointer;
+    typedef const void        value_type;
+
+    template <class _Up> struct rebind {typedef allocator<_Up> other;};
+};
+
+// pointer_traits
+
+template <class _Tp>
+struct __has_element_type
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::element_type* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Ptr, bool = __has_element_type<_Ptr>::value>
+struct __pointer_traits_element_type;
+
+template <class _Ptr>
+struct __pointer_traits_element_type<_Ptr, true>
+{
+    typedef typename _Ptr::element_type type;
+};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <template <class, class...> class _Sp, class _Tp, class ..._Args>
+struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
+{
+    typedef typename _Sp<_Tp, _Args...>::element_type type;
+};
+
+template <template <class, class...> class _Sp, class _Tp, class ..._Args>
+struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
+{
+    typedef _Tp type;
+};
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template <template <class> class _Sp, class _Tp>
+struct __pointer_traits_element_type<_Sp<_Tp>, true>
+{
+    typedef typename _Sp<_Tp>::element_type type;
+};
+
+template <template <class> class _Sp, class _Tp>
+struct __pointer_traits_element_type<_Sp<_Tp>, false>
+{
+    typedef _Tp type;
+};
+
+template <template <class, class> class _Sp, class _Tp, class _A0>
+struct __pointer_traits_element_type<_Sp<_Tp, _A0>, true>
+{
+    typedef typename _Sp<_Tp, _A0>::element_type type;
+};
+
+template <template <class, class> class _Sp, class _Tp, class _A0>
+struct __pointer_traits_element_type<_Sp<_Tp, _A0>, false>
+{
+    typedef _Tp type;
+};
+
+template <template <class, class, class> class _Sp, class _Tp, class _A0, class _A1>
+struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1>, true>
+{
+    typedef typename _Sp<_Tp, _A0, _A1>::element_type type;
+};
+
+template <template <class, class, class> class _Sp, class _Tp, class _A0, class _A1>
+struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1>, false>
+{
+    typedef _Tp type;
+};
+
+template <template <class, class, class, class> class _Sp, class _Tp, class _A0,
+                                                           class _A1, class _A2>
+struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1, _A2>, true>
+{
+    typedef typename _Sp<_Tp, _A0, _A1, _A2>::element_type type;
+};
+
+template <template <class, class, class, class> class _Sp, class _Tp, class _A0,
+                                                           class _A1, class _A2>
+struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1, _A2>, false>
+{
+    typedef _Tp type;
+};
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp>
+struct __has_difference_type
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::difference_type* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
+struct __pointer_traits_difference_type
+{
+    typedef ptrdiff_t type;
+};
+
+template <class _Ptr>
+struct __pointer_traits_difference_type<_Ptr, true>
+{
+    typedef typename _Ptr::difference_type type;
+};
+
+template <class _Tp, class _Up>
+struct __has_rebind
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Xp> static __two __test(...);
+    template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
+struct __pointer_traits_rebind
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    typedef typename _Tp::template rebind<_Up> type;
+#else
+    typedef typename _Tp::template rebind<_Up>::other type;
+#endif
+};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    typedef typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
+#else
+    typedef typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
+#endif
+};
+
+template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>
+{
+    typedef _Sp<_Up, _Args...> type;
+};
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template <template <class> class _Sp, class _Tp, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp>, _Up, true>
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    typedef typename _Sp<_Tp>::template rebind<_Up> type;
+#else
+    typedef typename _Sp<_Tp>::template rebind<_Up>::other type;
+#endif
+};
+
+template <template <class> class _Sp, class _Tp, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp>, _Up, false>
+{
+    typedef _Sp<_Up> type;
+};
+
+template <template <class, class> class _Sp, class _Tp, class _A0, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _A0>, _Up, true>
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    typedef typename _Sp<_Tp, _A0>::template rebind<_Up> type;
+#else
+    typedef typename _Sp<_Tp, _A0>::template rebind<_Up>::other type;
+#endif
+};
+
+template <template <class, class> class _Sp, class _Tp, class _A0, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _A0>, _Up, false>
+{
+    typedef _Sp<_Up, _A0> type;
+};
+
+template <template <class, class, class> class _Sp, class _Tp, class _A0,
+                                         class _A1, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1>, _Up, true>
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    typedef typename _Sp<_Tp, _A0, _A1>::template rebind<_Up> type;
+#else
+    typedef typename _Sp<_Tp, _A0, _A1>::template rebind<_Up>::other type;
+#endif
+};
+
+template <template <class, class, class> class _Sp, class _Tp, class _A0,
+                                         class _A1, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1>, _Up, false>
+{
+    typedef _Sp<_Up, _A0, _A1> type;
+};
+
+template <template <class, class, class, class> class _Sp, class _Tp, class _A0,
+                                                class _A1, class _A2, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, true>
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    typedef typename _Sp<_Tp, _A0, _A1, _A2>::template rebind<_Up> type;
+#else
+    typedef typename _Sp<_Tp, _A0, _A1, _A2>::template rebind<_Up>::other type;
+#endif
+};
+
+template <template <class, class, class, class> class _Sp, class _Tp, class _A0,
+                                                class _A1, class _A2, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, false>
+{
+    typedef _Sp<_Up, _A0, _A1, _A2> type;
+};
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Ptr>
+struct _LIBCPP_TYPE_VIS_ONLY pointer_traits
+{
+    typedef _Ptr                                                     pointer;
+    typedef typename __pointer_traits_element_type<pointer>::type    element_type;
+    typedef typename __pointer_traits_difference_type<pointer>::type difference_type;
+
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
+#else
+    template <class _Up> struct rebind
+        {typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};
+#endif  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+private:
+    struct __nat {};
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    static pointer pointer_to(typename conditional<is_void<element_type>::value,
+                                           __nat, element_type>::type& __r)
+        {return pointer::pointer_to(__r);}
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY pointer_traits<_Tp*>
+{
+    typedef _Tp*      pointer;
+    typedef _Tp       element_type;
+    typedef ptrdiff_t difference_type;
+
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    template <class _Up> using rebind = _Up*;
+#else
+    template <class _Up> struct rebind {typedef _Up* other;};
+#endif
+
+private:
+    struct __nat {};
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    static pointer pointer_to(typename conditional<is_void<element_type>::value,
+                                      __nat, element_type>::type& __r) _NOEXCEPT
+        {return _VSTD::addressof(__r);}
+};
+
+// allocator_traits
+
+namespace __has_pointer_type_imp
+{
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::pointer* = 0);
+}
+
+template <class _Tp>
+struct __has_pointer_type
+    : public integral_constant<bool, sizeof(__has_pointer_type_imp::__test<_Tp>(0)) == 1>
+{
+};
+
+namespace __pointer_type_imp
+{
+
+template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>
+struct __pointer_type
+{
+    typedef typename _Dp::pointer type;
+};
+
+template <class _Tp, class _Dp>
+struct __pointer_type<_Tp, _Dp, false>
+{
+    typedef _Tp* type;
+};
+
+}  // __pointer_type_imp
+
+template <class _Tp, class _Dp>
+struct __pointer_type
+{
+    typedef typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
+};
+
+template <class _Tp>
+struct __has_const_pointer
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::const_pointer* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
+struct __const_pointer
+{
+    typedef typename _Alloc::const_pointer type;
+};
+
+template <class _Tp, class _Ptr, class _Alloc>
+struct __const_pointer<_Tp, _Ptr, _Alloc, false>
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    typedef typename pointer_traits<_Ptr>::template rebind<const _Tp> type;
+#else
+    typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type;
+#endif
+};
+
+template <class _Tp>
+struct __has_void_pointer
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::void_pointer* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
+struct __void_pointer
+{
+    typedef typename _Alloc::void_pointer type;
+};
+
+template <class _Ptr, class _Alloc>
+struct __void_pointer<_Ptr, _Alloc, false>
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    typedef typename pointer_traits<_Ptr>::template rebind<void> type;
+#else
+    typedef typename pointer_traits<_Ptr>::template rebind<void>::other type;
+#endif
+};
+
+template <class _Tp>
+struct __has_const_void_pointer
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::const_void_pointer* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
+struct __const_void_pointer
+{
+    typedef typename _Alloc::const_void_pointer type;
+};
+
+template <class _Ptr, class _Alloc>
+struct __const_void_pointer<_Ptr, _Alloc, false>
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    typedef typename pointer_traits<_Ptr>::template rebind<const void> type;
+#else
+    typedef typename pointer_traits<_Ptr>::template rebind<const void>::other type;
+#endif
+};
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+__to_raw_pointer(_Tp* __p) _NOEXCEPT
+{
+    return __p;
+}
+
+template <class _Pointer>
+inline _LIBCPP_INLINE_VISIBILITY
+typename pointer_traits<_Pointer>::element_type*
+__to_raw_pointer(_Pointer __p) _NOEXCEPT
+{
+    return _VSTD::__to_raw_pointer(__p.operator->());
+}
+
+template <class _Tp>
+struct __has_size_type
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::size_type* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
+struct __size_type
+{
+    typedef typename make_unsigned<_DiffType>::type type;
+};
+
+template <class _Alloc, class _DiffType>
+struct __size_type<_Alloc, _DiffType, true>
+{
+    typedef typename _Alloc::size_type type;
+};
+
+template <class _Tp>
+struct __has_propagate_on_container_copy_assignment
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::propagate_on_container_copy_assignment* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
+struct __propagate_on_container_copy_assignment
+{
+    typedef false_type type;
+};
+
+template <class _Alloc>
+struct __propagate_on_container_copy_assignment<_Alloc, true>
+{
+    typedef typename _Alloc::propagate_on_container_copy_assignment type;
+};
+
+template <class _Tp>
+struct __has_propagate_on_container_move_assignment
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::propagate_on_container_move_assignment* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>
+struct __propagate_on_container_move_assignment
+{
+    typedef false_type type;
+};
+
+template <class _Alloc>
+struct __propagate_on_container_move_assignment<_Alloc, true>
+{
+    typedef typename _Alloc::propagate_on_container_move_assignment type;
+};
+
+template <class _Tp>
+struct __has_propagate_on_container_swap
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::propagate_on_container_swap* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>
+struct __propagate_on_container_swap
+{
+    typedef false_type type;
+};
+
+template <class _Alloc>
+struct __propagate_on_container_swap<_Alloc, true>
+{
+    typedef typename _Alloc::propagate_on_container_swap type;
+};
+
+template <class _Tp>
+struct __has_is_always_equal
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Up> static __two __test(...);
+    template <class _Up> static char __test(typename _Up::is_always_equal* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
+struct __is_always_equal
+{
+    typedef typename _VSTD::is_empty<_Alloc>::type type;
+};
+
+template <class _Alloc>
+struct __is_always_equal<_Alloc, true>
+{
+    typedef typename _Alloc::is_always_equal type;
+};
+
+template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
+struct __has_rebind_other
+{
+private:
+    struct __two {char __lx; char __lxx;};
+    template <class _Xp> static __two __test(...);
+    template <class _Xp> static char __test(typename _Xp::template rebind<_Up>::other* = 0);
+public:
+    static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Tp, class _Up>
+struct __has_rebind_other<_Tp, _Up, false>
+{
+    static const bool value = false;
+};
+
+template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
+struct __allocator_traits_rebind
+{
+    typedef typename _Tp::template rebind<_Up>::other type;
+};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>
+{
+    typedef typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;
+};
+
+template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>
+{
+    typedef _Alloc<_Up, _Args...> type;
+};
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template <template <class> class _Alloc, class _Tp, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp>, _Up, true>
+{
+    typedef typename _Alloc<_Tp>::template rebind<_Up>::other type;
+};
+
+template <template <class> class _Alloc, class _Tp, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp>, _Up, false>
+{
+    typedef _Alloc<_Up> type;
+};
+
+template <template <class, class> class _Alloc, class _Tp, class _A0, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp, _A0>, _Up, true>
+{
+    typedef typename _Alloc<_Tp, _A0>::template rebind<_Up>::other type;
+};
+
+template <template <class, class> class _Alloc, class _Tp, class _A0, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp, _A0>, _Up, false>
+{
+    typedef _Alloc<_Up, _A0> type;
+};
+
+template <template <class, class, class> class _Alloc, class _Tp, class _A0,
+                                         class _A1, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp, _A0, _A1>, _Up, true>
+{
+    typedef typename _Alloc<_Tp, _A0, _A1>::template rebind<_Up>::other type;
+};
+
+template <template <class, class, class> class _Alloc, class _Tp, class _A0,
+                                         class _A1, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp, _A0, _A1>, _Up, false>
+{
+    typedef _Alloc<_Up, _A0, _A1> type;
+};
+
+template <template <class, class, class, class> class _Alloc, class _Tp, class _A0,
+                                                class _A1, class _A2, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp, _A0, _A1, _A2>, _Up, true>
+{
+    typedef typename _Alloc<_Tp, _A0, _A1, _A2>::template rebind<_Up>::other type;
+};
+
+template <template <class, class, class, class> class _Alloc, class _Tp, class _A0,
+                                                class _A1, class _A2, class _Up>
+struct __allocator_traits_rebind<_Alloc<_Tp, _A0, _A1, _A2>, _Up, false>
+{
+    typedef _Alloc<_Up, _A0, _A1, _A2> type;
+};
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+
+template <class _Alloc, class _SizeType, class _ConstVoidPtr>
+auto
+__has_allocate_hint_test(_Alloc&& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
+    -> decltype(__a.allocate(__sz, __p), true_type());
+
+template <class _Alloc, class _SizeType, class _ConstVoidPtr>
+auto
+__has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
+    -> false_type;
+
+template <class _Alloc, class _SizeType, class _ConstVoidPtr>
+struct __has_allocate_hint
+    : integral_constant<bool,
+        is_same<
+            decltype(__has_allocate_hint_test(declval<_Alloc>(),
+                                          declval<_SizeType>(),
+                                          declval<_ConstVoidPtr>())),
+            true_type>::value>
+{
+};
+
+#else  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+
+template <class _Alloc, class _SizeType, class _ConstVoidPtr>
+struct __has_allocate_hint
+    : true_type
+{
+};
+
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+
+#if !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+
+template <class _Alloc, class _Tp, class ..._Args>
+decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Tp*>(),
+                                           _VSTD::declval<_Args>()...),
+                                           true_type())
+__has_construct_test(_Alloc&& __a, _Tp* __p, _Args&& ...__args);
+
+template <class _Alloc, class _Pointer, class ..._Args>
+false_type
+__has_construct_test(const _Alloc& __a, _Pointer&& __p, _Args&& ...__args);
+
+template <class _Alloc, class _Pointer, class ..._Args>
+struct __has_construct
+    : integral_constant<bool,
+        is_same<
+            decltype(__has_construct_test(declval<_Alloc>(),
+                                          declval<_Pointer>(),
+                                          declval<_Args>()...)),
+            true_type>::value>
+{
+};
+
+template <class _Alloc, class _Pointer>
+auto
+__has_destroy_test(_Alloc&& __a, _Pointer&& __p)
+    -> decltype(__a.destroy(__p), true_type());
+
+template <class _Alloc, class _Pointer>
+auto
+__has_destroy_test(const _Alloc& __a, _Pointer&& __p)
+    -> false_type;
+
+template <class _Alloc, class _Pointer>
+struct __has_destroy
+    : integral_constant<bool,
+        is_same<
+            decltype(__has_destroy_test(declval<_Alloc>(),
+                                        declval<_Pointer>())),
+            true_type>::value>
+{
+};
+
+template <class _Alloc>
+auto
+__has_max_size_test(_Alloc&& __a)
+    -> decltype(__a.max_size(), true_type());
+
+template <class _Alloc>
+auto
+__has_max_size_test(const volatile _Alloc& __a)
+    -> false_type;
+
+template <class _Alloc>
+struct __has_max_size
+    : integral_constant<bool,
+        is_same<
+            decltype(__has_max_size_test(declval<_Alloc&>())),
+            true_type>::value>
+{
+};
+
+template <class _Alloc>
+auto
+__has_select_on_container_copy_construction_test(_Alloc&& __a)
+    -> decltype(__a.select_on_container_copy_construction(), true_type());
+
+template <class _Alloc>
+auto
+__has_select_on_container_copy_construction_test(const volatile _Alloc& __a)
+    -> false_type;
+
+template <class _Alloc>
+struct __has_select_on_container_copy_construction
+    : integral_constant<bool,
+        is_same<
+            decltype(__has_select_on_container_copy_construction_test(declval<_Alloc&>())),
+            true_type>::value>
+{
+};
+
+#else  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Alloc, class _Pointer, class ..._Args>
+struct __has_construct
+    : false_type
+{
+};
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Alloc, class _Pointer, class _Args>
+struct __has_construct
+    : false_type
+{
+};
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Alloc, class _Pointer>
+struct __has_destroy
+    : false_type
+{
+};
+
+template <class _Alloc>
+struct __has_max_size
+    : true_type
+{
+};
+
+template <class _Alloc>
+struct __has_select_on_container_copy_construction
+    : false_type
+{
+};
+
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+
+template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>
+struct __alloc_traits_difference_type
+{
+    typedef typename pointer_traits<_Ptr>::difference_type type;
+};
+
+template <class _Alloc, class _Ptr>
+struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
+{
+    typedef typename _Alloc::difference_type type;
+};
+
+template <class _Alloc>
+struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
+{
+    typedef _Alloc                              allocator_type;
+    typedef typename allocator_type::value_type value_type;
+
+    typedef typename __pointer_type<value_type, allocator_type>::type pointer;
+    typedef typename __const_pointer<value_type, pointer, allocator_type>::type const_pointer;
+    typedef typename __void_pointer<pointer, allocator_type>::type void_pointer;
+    typedef typename __const_void_pointer<pointer, allocator_type>::type const_void_pointer;
+
+    typedef typename __alloc_traits_difference_type<allocator_type, pointer>::type difference_type;
+    typedef typename __size_type<allocator_type, difference_type>::type size_type;
+
+    typedef typename __propagate_on_container_copy_assignment<allocator_type>::type
+                     propagate_on_container_copy_assignment;
+    typedef typename __propagate_on_container_move_assignment<allocator_type>::type
+                     propagate_on_container_move_assignment;
+    typedef typename __propagate_on_container_swap<allocator_type>::type
+                     propagate_on_container_swap;
+    typedef typename __is_always_equal<allocator_type>::type
+                     is_always_equal;
+
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    template <class _Tp> using rebind_alloc =
+                  typename __allocator_traits_rebind<allocator_type, _Tp>::type;
+    template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;
+#else  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    template <class _Tp> struct rebind_alloc
+        {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;};
+    template <class _Tp> struct rebind_traits
+        {typedef allocator_traits<typename rebind_alloc<_Tp>::other> other;};
+#endif  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+    _LIBCPP_INLINE_VISIBILITY
+    static pointer allocate(allocator_type& __a, size_type __n)
+        {return __a.allocate(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint)
+        {return allocate(__a, __n, __hint,
+            __has_allocate_hint<allocator_type, size_type, const_void_pointer>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT
+        {__a.deallocate(__p, __n);}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class _Tp, class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args)
+            {__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
+                         __a, __p, _VSTD::forward<_Args>(__args)...);}
+#else  // _LIBCPP_HAS_NO_VARIADICS
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        static void construct(allocator_type& __a, _Tp* __p)
+            {
+                ::new ((void*)__p) _Tp();
+            }
+    template <class _Tp, class _A0>
+        _LIBCPP_INLINE_VISIBILITY
+        static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0)
+            {
+                ::new ((void*)__p) _Tp(__a0);
+            }
+    template <class _Tp, class _A0, class _A1>
+        _LIBCPP_INLINE_VISIBILITY
+        static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0,
+                              const _A1& __a1)
+            {
+                ::new ((void*)__p) _Tp(__a0, __a1);
+            }
+    template <class _Tp, class _A0, class _A1, class _A2>
+        _LIBCPP_INLINE_VISIBILITY
+        static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0,
+                              const _A1& __a1, const _A2& __a2)
+            {
+                ::new ((void*)__p) _Tp(__a0, __a1, __a2);
+            }
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        static void destroy(allocator_type& __a, _Tp* __p)
+            {__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    static size_type max_size(const allocator_type& __a) _NOEXCEPT
+        {return __max_size(__has_max_size<const allocator_type>(), __a);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    static allocator_type
+        select_on_container_copy_construction(const allocator_type& __a)
+            {return select_on_container_copy_construction(
+                __has_select_on_container_copy_construction<const allocator_type>(),
+                __a);}
+
+    template <class _Ptr>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        void
+        __construct_forward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2)
+        {
+            for (; __begin1 != __end1; ++__begin1, ++__begin2)
+                construct(__a, _VSTD::__to_raw_pointer(__begin2), _VSTD::move_if_noexcept(*__begin1));
+        }
+
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        typename enable_if
+        <
+            (is_same<allocator_type, allocator<_Tp> >::value
+                || !__has_construct<allocator_type, _Tp*, _Tp>::value) &&
+             is_trivially_move_constructible<_Tp>::value,
+            void
+        >::type
+        __construct_forward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
+        {
+            ptrdiff_t _Np = __end1 - __begin1;
+            if (_Np > 0)
+            {
+                _VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp));
+                __begin2 += _Np;
+            }
+        }
+
+    template <class _Iter, class _Ptr>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        void
+        __construct_range_forward(allocator_type& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2)
+        {
+            for (; __begin1 != __end1; ++__begin1, (void) ++__begin2)
+                construct(__a, _VSTD::__to_raw_pointer(__begin2), *__begin1);
+        }
+
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        typename enable_if
+        <
+            (is_same<allocator_type, allocator<_Tp> >::value
+                || !__has_construct<allocator_type, _Tp*, _Tp>::value) &&
+             is_trivially_move_constructible<_Tp>::value,
+            void
+        >::type
+        __construct_range_forward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
+        {
+            typedef typename remove_const<_Tp>::type _Vp;
+            ptrdiff_t _Np = __end1 - __begin1;
+            if (_Np > 0)
+            {
+                _VSTD::memcpy(const_cast<_Vp*>(__begin2), __begin1, _Np * sizeof(_Tp));
+                __begin2 += _Np;
+            }
+        }
+
+    template <class _Ptr>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        void
+        __construct_backward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2)
+        {
+            while (__end1 != __begin1)
+            {
+                construct(__a, _VSTD::__to_raw_pointer(__end2-1), _VSTD::move_if_noexcept(*--__end1));
+                --__end2;
+            }
+        }
+
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        typename enable_if
+        <
+            (is_same<allocator_type, allocator<_Tp> >::value
+                || !__has_construct<allocator_type, _Tp*, _Tp>::value) &&
+             is_trivially_move_constructible<_Tp>::value,
+            void
+        >::type
+        __construct_backward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __end2)
+        {
+            ptrdiff_t _Np = __end1 - __begin1;
+            __end2 -= _Np;
+            if (_Np > 0)
+                _VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp));
+        }
+
+private:
+
+    _LIBCPP_INLINE_VISIBILITY
+    static pointer allocate(allocator_type& __a, size_type __n,
+        const_void_pointer __hint, true_type)
+        {return __a.allocate(__n, __hint);}
+    _LIBCPP_INLINE_VISIBILITY
+    static pointer allocate(allocator_type& __a, size_type __n,
+        const_void_pointer, false_type)
+        {return __a.allocate(__n);}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class _Tp, class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args)
+            {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
+    template <class _Tp, class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args)
+            {
+                ::new ((void*)__p) _Tp(_VSTD::forward<_Args>(__args)...);
+            }
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        static void __destroy(true_type, allocator_type& __a, _Tp* __p)
+            {__a.destroy(__p);}
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        static void __destroy(false_type, allocator_type&, _Tp* __p)
+            {
+                __p->~_Tp();
+            }
+
+    _LIBCPP_INLINE_VISIBILITY
+    static size_type __max_size(true_type, const allocator_type& __a)
+            {return __a.max_size();}
+    _LIBCPP_INLINE_VISIBILITY
+    static size_type __max_size(false_type, const allocator_type&)
+            {return numeric_limits<size_type>::max();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    static allocator_type
+        select_on_container_copy_construction(true_type, const allocator_type& __a)
+            {return __a.select_on_container_copy_construction();}
+    _LIBCPP_INLINE_VISIBILITY
+    static allocator_type
+        select_on_container_copy_construction(false_type, const allocator_type& __a)
+            {return __a;}
+};
+
+template <class _Traits, class _Tp>
+struct __rebind_alloc_helper
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    typedef typename _Traits::template rebind_alloc<_Tp>        type;
+#else
+    typedef typename _Traits::template rebind_alloc<_Tp>::other type;
+#endif
+};
+
+// allocator
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY allocator
+{
+public:
+    typedef size_t            size_type;
+    typedef ptrdiff_t         difference_type;
+    typedef _Tp*              pointer;
+    typedef const _Tp*        const_pointer;
+    typedef _Tp&              reference;
+    typedef const _Tp&        const_reference;
+    typedef _Tp               value_type;
+
+    typedef true_type propagate_on_container_move_assignment;
+    typedef true_type is_always_equal;
+
+    template <class _Up> struct rebind {typedef allocator<_Up> other;};
+
+    _LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {}
+    template <class _Up> _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const _NOEXCEPT
+        {return _VSTD::addressof(__x);}
+    _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
+        {return _VSTD::addressof(__x);}
+    _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
+        {return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));}
+    _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
+        {_VSTD::__deallocate((void*)__p);}
+    _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
+        {return size_type(~0) / sizeof(_Tp);}
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    template <class _Up, class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(_Up* __p, _Args&&... __args)
+        {
+            ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
+        }
+#else  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p)
+        {
+            ::new((void*)__p) _Tp();
+        }
+# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+    template <class _A0>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, _A0& __a0)
+        {
+            ::new((void*)__p) _Tp(__a0);
+        }
+    template <class _A0>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, const _A0& __a0)
+        {
+            ::new((void*)__p) _Tp(__a0);
+        }
+# endif  // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+    template <class _A0, class _A1>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, _A0& __a0, _A1& __a1)
+        {
+            ::new((void*)__p) _Tp(__a0, __a1);
+        }
+    template <class _A0, class _A1>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, const _A0& __a0, _A1& __a1)
+        {
+            ::new((void*)__p) _Tp(__a0, __a1);
+        }
+    template <class _A0, class _A1>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, _A0& __a0, const _A1& __a1)
+        {
+            ::new((void*)__p) _Tp(__a0, __a1);
+        }
+    template <class _A0, class _A1>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, const _A0& __a0, const _A1& __a1)
+        {
+            ::new((void*)__p) _Tp(__a0, __a1);
+        }
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}
+};
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY allocator<const _Tp>
+{
+public:
+    typedef size_t            size_type;
+    typedef ptrdiff_t         difference_type;
+    typedef const _Tp*        pointer;
+    typedef const _Tp*        const_pointer;
+    typedef const _Tp&        reference;
+    typedef const _Tp&        const_reference;
+    typedef const _Tp         value_type;
+
+    typedef true_type propagate_on_container_move_assignment;
+    typedef true_type is_always_equal;
+
+    template <class _Up> struct rebind {typedef allocator<_Up> other;};
+
+    _LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {}
+    template <class _Up> _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
+        {return _VSTD::addressof(__x);}
+    _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
+        {return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));}
+    _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
+        {_VSTD::__deallocate((void*)__p);}
+    _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
+        {return size_type(~0) / sizeof(_Tp);}
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    template <class _Up, class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(_Up* __p, _Args&&... __args)
+        {
+            ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
+        }
+#else  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p)
+        {
+            ::new((void*)__p) _Tp();
+        }
+# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+    template <class _A0>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, _A0& __a0)
+        {
+            ::new((void*)__p) _Tp(__a0);
+        }
+    template <class _A0>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, const _A0& __a0)
+        {
+            ::new((void*)__p) _Tp(__a0);
+        }
+# endif  // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+    template <class _A0, class _A1>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, _A0& __a0, _A1& __a1)
+        {
+            ::new((void*)__p) _Tp(__a0, __a1);
+        }
+    template <class _A0, class _A1>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, const _A0& __a0, _A1& __a1)
+        {
+            ::new((void*)__p) _Tp(__a0, __a1);
+        }
+    template <class _A0, class _A1>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, _A0& __a0, const _A1& __a1)
+        {
+            ::new((void*)__p) _Tp(__a0, __a1);
+        }
+    template <class _A0, class _A1>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        construct(pointer __p, const _A0& __a0, const _A1& __a1)
+        {
+            ::new((void*)__p) _Tp(__a0, __a1);
+        }
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+    _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}
+};
+
+template <class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;}
+
+template <class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
+
+template <class _OutputIterator, class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY raw_storage_iterator
+    : public iterator<output_iterator_tag,
+                      _Tp,                                         // purposefully not C++03
+                      ptrdiff_t,                                   // purposefully not C++03
+                      _Tp*,                                        // purposefully not C++03
+                      raw_storage_iterator<_OutputIterator, _Tp>&> // purposefully not C++03
+{
+private:
+    _OutputIterator __x_;
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
+    _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
+    _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element)
+        {::new(&*__x_) _Tp(__element); return *this;}
+    _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY raw_storage_iterator  operator++(int)
+        {raw_storage_iterator __t(*this); ++__x_; return __t;}
+#if _LIBCPP_STD_VER >= 14
+    _LIBCPP_INLINE_VISIBILITY _OutputIterator base() const { return __x_; } 
+#endif
+};
+
+template <class _Tp>
+pair<_Tp*, ptrdiff_t>
+get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT
+{
+    pair<_Tp*, ptrdiff_t> __r(0, 0);
+    const ptrdiff_t __m = (~ptrdiff_t(0) ^
+                           ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1)))
+                           / sizeof(_Tp);
+    if (__n > __m)
+        __n = __m;
+    while (__n > 0)
+    {
+        __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow));
+        if (__r.first)
+        {
+            __r.second = __n;
+            break;
+        }
+        __n /= 2;
+    }
+    return __r;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void return_temporary_buffer(_Tp* __p) _NOEXCEPT {::operator delete(__p);}
+
+template <class _Tp>
+struct auto_ptr_ref
+{
+    _Tp* __ptr_;
+};
+
+template<class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY auto_ptr
+{
+private:
+    _Tp* __ptr_;
+public:
+    typedef _Tp element_type;
+
+    _LIBCPP_INLINE_VISIBILITY explicit auto_ptr(_Tp* __p = 0) throw() : __ptr_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY auto_ptr(auto_ptr& __p) throw() : __ptr_(__p.release()) {}
+    template<class _Up> _LIBCPP_INLINE_VISIBILITY auto_ptr(auto_ptr<_Up>& __p) throw()
+        : __ptr_(__p.release()) {}
+    _LIBCPP_INLINE_VISIBILITY auto_ptr& operator=(auto_ptr& __p) throw()
+        {reset(__p.release()); return *this;}
+    template<class _Up> _LIBCPP_INLINE_VISIBILITY auto_ptr& operator=(auto_ptr<_Up>& __p) throw()
+        {reset(__p.release()); return *this;}
+    _LIBCPP_INLINE_VISIBILITY auto_ptr& operator=(auto_ptr_ref<_Tp> __p) throw()
+        {reset(__p.__ptr_); return *this;}
+    _LIBCPP_INLINE_VISIBILITY ~auto_ptr() throw() {delete __ptr_;}
+
+    _LIBCPP_INLINE_VISIBILITY _Tp& operator*() const throw()
+        {return *__ptr_;}
+    _LIBCPP_INLINE_VISIBILITY _Tp* operator->() const throw() {return __ptr_;}
+    _LIBCPP_INLINE_VISIBILITY _Tp* get() const throw() {return __ptr_;}
+    _LIBCPP_INLINE_VISIBILITY _Tp* release() throw()
+    {
+        _Tp* __t = __ptr_;
+        __ptr_ = 0;
+        return __t;
+    }
+    _LIBCPP_INLINE_VISIBILITY void reset(_Tp* __p = 0) throw()
+    {
+        if (__ptr_ != __p)
+            delete __ptr_;
+        __ptr_ = __p;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY auto_ptr(auto_ptr_ref<_Tp> __p) throw() : __ptr_(__p.__ptr_) {}
+    template<class _Up> _LIBCPP_INLINE_VISIBILITY operator auto_ptr_ref<_Up>() throw()
+        {auto_ptr_ref<_Up> __t; __t.__ptr_ = release(); return __t;}
+    template<class _Up> _LIBCPP_INLINE_VISIBILITY operator auto_ptr<_Up>() throw()
+        {return auto_ptr<_Up>(release());}
+};
+
+template <>
+class _LIBCPP_TYPE_VIS_ONLY auto_ptr<void>
+{
+public:
+    typedef void element_type;
+};
+
+template <class _T1, class _T2, bool = is_same<typename remove_cv<_T1>::type,
+                                                     typename remove_cv<_T2>::type>::value,
+                                bool = is_empty<_T1>::value
+                                       && !__libcpp_is_final<_T1>::value,
+                                bool = is_empty<_T2>::value
+                                       && !__libcpp_is_final<_T2>::value
+         >
+struct __libcpp_compressed_pair_switch;
+
+template <class _T1, class _T2, bool IsSame>
+struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, false, false> {enum {value = 0};};
+
+template <class _T1, class _T2, bool IsSame>
+struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, true, false>  {enum {value = 1};};
+
+template <class _T1, class _T2, bool IsSame>
+struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, false, true>  {enum {value = 2};};
+
+template <class _T1, class _T2>
+struct __libcpp_compressed_pair_switch<_T1, _T2, false, true, true>    {enum {value = 3};};
+
+template <class _T1, class _T2>
+struct __libcpp_compressed_pair_switch<_T1, _T2, true, true, true>     {enum {value = 1};};
+
+template <class _T1, class _T2, unsigned = __libcpp_compressed_pair_switch<_T1, _T2>::value>
+class __libcpp_compressed_pair_imp;
+
+template <class _T1, class _T2>
+class __libcpp_compressed_pair_imp<_T1, _T2, 0>
+{
+private:
+    _T1 __first_;
+    _T2 __second_;
+public:
+    typedef _T1 _T1_param;
+    typedef _T2 _T2_param;
+
+    typedef typename remove_reference<_T1>::type& _T1_reference;
+    typedef typename remove_reference<_T2>::type& _T2_reference;
+
+    typedef const typename remove_reference<_T1>::type& _T1_const_reference;
+    typedef const typename remove_reference<_T2>::type& _T2_const_reference;
+
+    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_(), __second_() {}
+    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
+        : __first_(_VSTD::forward<_T1_param>(__t1)), __second_() {}
+    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
+        : __first_(), __second_(_VSTD::forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
+        : __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
+
+#if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value &&
+                   is_nothrow_copy_constructible<_T2>::value)
+        : __first_(__p.first()),
+          __second_(__p.second()) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p)
+        _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value &&
+                   is_nothrow_copy_assignable<_T2>::value)
+        {
+            __first_ = __p.first();
+            __second_ = __p.second();
+            return *this;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
+        _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
+                   is_nothrow_move_constructible<_T2>::value)
+        : __first_(_VSTD::forward<_T1>(__p.first())),
+          __second_(_VSTD::forward<_T2>(__p.second())) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p)
+        _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value &&
+                   is_nothrow_move_assignable<_T2>::value)
+        {
+            __first_ = _VSTD::forward<_T1>(__p.first());
+            __second_ = _VSTD::forward<_T2>(__p.second());
+            return *this;
+        }
+
+#endif  // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+        _LIBCPP_INLINE_VISIBILITY
+        __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+                                     tuple<_Args1...> __first_args,
+                                     tuple<_Args2...> __second_args,
+                                     __tuple_indices<_I1...>,
+                                     __tuple_indices<_I2...>)
+            : __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
+              __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
+            {}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+    _LIBCPP_INLINE_VISIBILITY _T1_reference       first() _NOEXCEPT       {return __first_;}
+    _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return __first_;}
+
+    _LIBCPP_INLINE_VISIBILITY _T2_reference       second() _NOEXCEPT       {return __second_;}
+    _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return __second_;}
+
+    _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x)
+        _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
+                   __is_nothrow_swappable<_T2>::value)
+    {
+        using _VSTD::swap;
+        swap(__first_, __x.__first_);
+        swap(__second_, __x.__second_);
+    }
+};
+
+template <class _T1, class _T2>
+class __libcpp_compressed_pair_imp<_T1, _T2, 1>
+    : private _T1
+{
+private:
+    _T2 __second_;
+public:
+    typedef _T1 _T1_param;
+    typedef _T2 _T2_param;
+
+    typedef _T1&                                        _T1_reference;
+    typedef typename remove_reference<_T2>::type& _T2_reference;
+
+    typedef const _T1&                                        _T1_const_reference;
+    typedef const typename remove_reference<_T2>::type& _T2_const_reference;
+
+    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __second_() {}
+    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
+        : _T1(_VSTD::forward<_T1_param>(__t1)), __second_() {}
+    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
+        : __second_(_VSTD::forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
+        : _T1(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
+
+#if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value &&
+                   is_nothrow_copy_constructible<_T2>::value)
+        : _T1(__p.first()), __second_(__p.second()) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p)
+        _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value &&
+                   is_nothrow_copy_assignable<_T2>::value)
+        {
+            _T1::operator=(__p.first());
+            __second_ = __p.second();
+            return *this;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
+        _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
+                   is_nothrow_move_constructible<_T2>::value)
+        : _T1(_VSTD::move(__p.first())), __second_(_VSTD::forward<_T2>(__p.second())) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p)
+        _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value &&
+                   is_nothrow_move_assignable<_T2>::value)
+        {
+            _T1::operator=(_VSTD::move(__p.first()));
+            __second_ = _VSTD::forward<_T2>(__p.second());
+            return *this;
+        }
+
+#endif  // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+        _LIBCPP_INLINE_VISIBILITY
+        __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+                                     tuple<_Args1...> __first_args,
+                                     tuple<_Args2...> __second_args,
+                                     __tuple_indices<_I1...>,
+                                     __tuple_indices<_I2...>)
+            : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
+              __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
+            {}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+    _LIBCPP_INLINE_VISIBILITY _T1_reference       first() _NOEXCEPT       {return *this;}
+    _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return *this;}
+
+    _LIBCPP_INLINE_VISIBILITY _T2_reference       second() _NOEXCEPT       {return __second_;}
+    _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return __second_;}
+
+    _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x)
+        _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
+                   __is_nothrow_swappable<_T2>::value)
+    {
+        using _VSTD::swap;
+        swap(__second_, __x.__second_);
+    }
+};
+
+template <class _T1, class _T2>
+class __libcpp_compressed_pair_imp<_T1, _T2, 2>
+    : private _T2
+{
+private:
+    _T1 __first_;
+public:
+    typedef _T1 _T1_param;
+    typedef _T2 _T2_param;
+
+    typedef typename remove_reference<_T1>::type& _T1_reference;
+    typedef _T2&                                        _T2_reference;
+
+    typedef const typename remove_reference<_T1>::type& _T1_const_reference;
+    typedef const _T2&                                        _T2_const_reference;
+
+    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_() {}
+    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
+        : __first_(_VSTD::forward<_T1_param>(__t1)) {}
+    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
+        : _T2(_VSTD::forward<_T2_param>(__t2)), __first_() {}
+    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
+        _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
+                   is_nothrow_move_constructible<_T2>::value)
+        : _T2(_VSTD::forward<_T2_param>(__t2)), __first_(_VSTD::forward<_T1_param>(__t1)) {}
+
+#if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value &&
+                   is_nothrow_copy_constructible<_T2>::value)
+        : _T2(__p.second()), __first_(__p.first()) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p)
+        _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value &&
+                   is_nothrow_copy_assignable<_T2>::value)
+        {
+            _T2::operator=(__p.second());
+            __first_ = __p.first();
+            return *this;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
+        _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
+                   is_nothrow_move_constructible<_T2>::value)
+        : _T2(_VSTD::forward<_T2>(__p.second())), __first_(_VSTD::move(__p.first())) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p)
+        _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value &&
+                   is_nothrow_move_assignable<_T2>::value)
+        {
+            _T2::operator=(_VSTD::forward<_T2>(__p.second()));
+            __first_ = _VSTD::move(__p.first());
+            return *this;
+        }
+
+#endif  // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+        _LIBCPP_INLINE_VISIBILITY
+        __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+                                     tuple<_Args1...> __first_args,
+                                     tuple<_Args2...> __second_args,
+                                     __tuple_indices<_I1...>,
+                                     __tuple_indices<_I2...>)
+            : _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...),
+              __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...)
+              
+            {}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+    _LIBCPP_INLINE_VISIBILITY _T1_reference       first() _NOEXCEPT       {return __first_;}
+    _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return __first_;}
+
+    _LIBCPP_INLINE_VISIBILITY _T2_reference       second() _NOEXCEPT       {return *this;}
+    _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;}
+
+    _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x)
+        _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
+                   __is_nothrow_swappable<_T2>::value)
+    {
+        using _VSTD::swap;
+        swap(__first_, __x.__first_);
+    }
+};
+
+template <class _T1, class _T2>
+class __libcpp_compressed_pair_imp<_T1, _T2, 3>
+    : private _T1,
+      private _T2
+{
+public:
+    typedef _T1 _T1_param;
+    typedef _T2 _T2_param;
+
+    typedef _T1& _T1_reference;
+    typedef _T2& _T2_reference;
+
+    typedef const _T1& _T1_const_reference;
+    typedef const _T2& _T2_const_reference;
+
+    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
+    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
+        : _T1(_VSTD::forward<_T1_param>(__t1)) {}
+    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
+        : _T2(_VSTD::forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
+        : _T1(_VSTD::forward<_T1_param>(__t1)), _T2(_VSTD::forward<_T2_param>(__t2)) {}
+
+#if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value &&
+                   is_nothrow_copy_constructible<_T2>::value)
+        : _T1(__p.first()), _T2(__p.second()) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p)
+        _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value &&
+                   is_nothrow_copy_assignable<_T2>::value)
+        {
+            _T1::operator=(__p.first());
+            _T2::operator=(__p.second());
+            return *this;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
+        _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
+                   is_nothrow_move_constructible<_T2>::value)
+        : _T1(_VSTD::move(__p.first())), _T2(_VSTD::move(__p.second())) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p)
+        _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value &&
+                   is_nothrow_move_assignable<_T2>::value)
+        {
+            _T1::operator=(_VSTD::move(__p.first()));
+            _T2::operator=(_VSTD::move(__p.second()));
+            return *this;
+        }
+
+#endif  // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+        _LIBCPP_INLINE_VISIBILITY
+        __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+                                     tuple<_Args1...> __first_args,
+                                     tuple<_Args2...> __second_args,
+                                     __tuple_indices<_I1...>,
+                                     __tuple_indices<_I2...>)
+            : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
+              _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
+            {}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+    _LIBCPP_INLINE_VISIBILITY _T1_reference       first() _NOEXCEPT       {return *this;}
+    _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return *this;}
+
+    _LIBCPP_INLINE_VISIBILITY _T2_reference       second() _NOEXCEPT       {return *this;}
+    _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;}
+
+    _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp&)
+        _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
+                   __is_nothrow_swappable<_T2>::value)
+    {
+    }
+};
+
+template <class _T1, class _T2>
+class __compressed_pair
+    : private __libcpp_compressed_pair_imp<_T1, _T2>
+{
+    typedef __libcpp_compressed_pair_imp<_T1, _T2> base;
+public:
+    typedef typename base::_T1_param _T1_param;
+    typedef typename base::_T2_param _T2_param;
+
+    typedef typename base::_T1_reference _T1_reference;
+    typedef typename base::_T2_reference _T2_reference;
+
+    typedef typename base::_T1_const_reference _T1_const_reference;
+    typedef typename base::_T2_const_reference _T2_const_reference;
+
+    _LIBCPP_INLINE_VISIBILITY __compressed_pair() {}
+    _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1)
+        : base(_VSTD::forward<_T1_param>(__t1)) {}
+    _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2)
+        : base(_VSTD::forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2)
+        : base(_VSTD::forward<_T1_param>(__t1), _VSTD::forward<_T2_param>(__t2)) {}
+
+#if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+    _LIBCPP_INLINE_VISIBILITY
+    __compressed_pair(const __compressed_pair& __p)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value &&
+                   is_nothrow_copy_constructible<_T2>::value)
+        : base(__p) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __compressed_pair& operator=(const __compressed_pair& __p)
+        _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value &&
+                   is_nothrow_copy_assignable<_T2>::value)
+        {
+            base::operator=(__p);
+            return *this;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __compressed_pair(__compressed_pair&& __p)
+        _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
+                   is_nothrow_move_constructible<_T2>::value)
+        : base(_VSTD::move(__p)) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __compressed_pair& operator=(__compressed_pair&& __p)
+        _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value &&
+                   is_nothrow_move_assignable<_T2>::value)
+        {
+            base::operator=(_VSTD::move(__p));
+            return *this;
+        }
+
+#endif  // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template <class... _Args1, class... _Args2>
+        _LIBCPP_INLINE_VISIBILITY
+        __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
+                                                      tuple<_Args2...> __second_args)
+            : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args),
+                   typename __make_tuple_indices<sizeof...(_Args1)>::type(),
+                   typename __make_tuple_indices<sizeof...(_Args2) >::type())
+            {}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+    _LIBCPP_INLINE_VISIBILITY _T1_reference       first() _NOEXCEPT       {return base::first();}
+    _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return base::first();}
+
+    _LIBCPP_INLINE_VISIBILITY _T2_reference       second() _NOEXCEPT       {return base::second();}
+    _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return base::second();}
+
+    _LIBCPP_INLINE_VISIBILITY void swap(__compressed_pair& __x)
+        _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
+                   __is_nothrow_swappable<_T2>::value)
+        {base::swap(__x);}
+};
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
+        _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
+                   __is_nothrow_swappable<_T2>::value)
+    {__x.swap(__y);}
+
+// __same_or_less_cv_qualified
+
+template <class _Ptr1, class _Ptr2,
+          bool = is_same<typename remove_cv<typename pointer_traits<_Ptr1>::element_type>::type,
+                         typename remove_cv<typename pointer_traits<_Ptr2>::element_type>::type
+                        >::value
+         >
+struct __same_or_less_cv_qualified_imp
+    : is_convertible<_Ptr1, _Ptr2> {};
+
+template <class _Ptr1, class _Ptr2>
+struct __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false>
+    : false_type {};
+
+template <class _Ptr1, class _Ptr2, bool = is_pointer<_Ptr1>::value ||
+                                           is_same<_Ptr1, _Ptr2>::value ||
+                                           __has_element_type<_Ptr1>::value>
+struct __same_or_less_cv_qualified
+    : __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {};
+
+template <class _Ptr1, class _Ptr2>
+struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, false>
+    : false_type {};
+
+// default_delete
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY default_delete
+{
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default;
+#else
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {}
+#endif
+    template <class _Up>
+        _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up>&,
+             typename enable_if<is_convertible<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY void operator() (_Tp* __ptr) const _NOEXCEPT
+        {
+            static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type");
+            static_assert(!is_void<_Tp>::value, "default_delete can not delete incomplete type");
+            delete __ptr;
+        }
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY default_delete<_Tp[]>
+{
+public:
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default;
+#else
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {}
+#endif
+    template <class _Up>
+        _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up[]>&,
+             typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {}
+    template <class _Up>
+        _LIBCPP_INLINE_VISIBILITY
+        void operator() (_Up* __ptr,
+                         typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) const _NOEXCEPT
+        {
+            static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type");
+            static_assert(!is_void<_Tp>::value, "default_delete can not delete incomplete type");
+            delete [] __ptr;
+        }
+};
+
+template <class _Tp, class _Dp = default_delete<_Tp> >
+class _LIBCPP_TYPE_VIS_ONLY unique_ptr
+{
+public:
+    typedef _Tp element_type;
+    typedef _Dp deleter_type;
+    typedef typename __pointer_type<_Tp, deleter_type>::type pointer;
+private:
+    __compressed_pair<pointer, deleter_type> __ptr_;
+
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    unique_ptr(unique_ptr&);
+    template <class _Up, class _Ep>
+        unique_ptr(unique_ptr<_Up, _Ep>&);
+    unique_ptr& operator=(unique_ptr&);
+    template <class _Up, class _Ep>
+        unique_ptr& operator=(unique_ptr<_Up, _Ep>&);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    struct __nat {int __for_bool_;};
+
+    typedef       typename remove_reference<deleter_type>::type& _Dp_reference;
+    typedef const typename remove_reference<deleter_type>::type& _Dp_const_reference;
+public:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT
+        : __ptr_(pointer())
+        {
+            static_assert(!is_pointer<deleter_type>::value,
+                "unique_ptr constructed with null function pointer deleter");
+        }
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT
+        : __ptr_(pointer())
+        {
+            static_assert(!is_pointer<deleter_type>::value,
+                "unique_ptr constructed with null function pointer deleter");
+        }
+    _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) _NOEXCEPT
+        : __ptr_(_VSTD::move(__p))
+        {
+            static_assert(!is_pointer<deleter_type>::value,
+                "unique_ptr constructed with null function pointer deleter");
+        }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, typename conditional<
+                                        is_reference<deleter_type>::value,
+                                        deleter_type,
+                                        typename add_lvalue_reference<const deleter_type>::type>::type __d)
+             _NOEXCEPT
+        : __ptr_(__p, __d) {}
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, typename remove_reference<deleter_type>::type&& __d)
+             _NOEXCEPT
+        : __ptr_(__p, _VSTD::move(__d))
+        {
+            static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
+        }
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr&& __u) _NOEXCEPT
+        : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {}
+    template <class _Up, class _Ep>
+        _LIBCPP_INLINE_VISIBILITY
+        unique_ptr(unique_ptr<_Up, _Ep>&& __u,
+                   typename enable_if
+                      <
+                        !is_array<_Up>::value &&
+                         is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
+                         is_convertible<_Ep, deleter_type>::value &&
+                         (
+                            !is_reference<deleter_type>::value ||
+                            is_same<deleter_type, _Ep>::value
+                         ),
+                         __nat
+                      >::type = __nat()) _NOEXCEPT
+            : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {}
+
+    template <class _Up>
+        _LIBCPP_INLINE_VISIBILITY unique_ptr(auto_ptr<_Up>&& __p,
+                typename enable_if<
+                                      is_convertible<_Up*, _Tp*>::value &&
+                                      is_same<_Dp, default_delete<_Tp> >::value,
+                                      __nat
+                                  >::type = __nat()) _NOEXCEPT
+            : __ptr_(__p.release())
+            {
+            }
+
+        _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT
+            {
+                reset(__u.release());
+                __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
+                return *this;
+            }
+
+        template <class _Up, class _Ep>
+            _LIBCPP_INLINE_VISIBILITY
+            typename enable_if
+            <
+                !is_array<_Up>::value &&
+                is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
+                is_assignable<deleter_type&, _Ep&&>::value,
+                unique_ptr&
+            >::type
+            operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
+            {
+                reset(__u.release());
+                __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
+                return *this;
+            }
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY operator __rv<unique_ptr>()
+    {
+        return __rv<unique_ptr>(*this);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(__rv<unique_ptr> __u)
+        : __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {}
+
+    template <class _Up, class _Ep>
+    _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr<_Up, _Ep> __u)
+    {
+        reset(__u.release());
+        __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d)
+        : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {}
+
+    template <class _Up>
+        _LIBCPP_INLINE_VISIBILITY
+                typename enable_if<
+                                      is_convertible<_Up*, _Tp*>::value &&
+                                      is_same<_Dp, default_delete<_Tp> >::value,
+                                      unique_ptr&
+                                  >::type
+        operator=(auto_ptr<_Up> __p)
+            {reset(__p.release()); return *this;}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY ~unique_ptr() {reset();}
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT
+    {
+        reset();
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator*() const
+        {return *__ptr_.first();}
+    _LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return __ptr_.first();}
+    _LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT {return __ptr_.first();}
+    _LIBCPP_INLINE_VISIBILITY       _Dp_reference get_deleter() _NOEXCEPT
+        {return __ptr_.second();}
+    _LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT
+        {return __ptr_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT
+        {return __ptr_.first() != nullptr;}
+
+    _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT
+    {
+        pointer __t = __ptr_.first();
+        __ptr_.first() = pointer();
+        return __t;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY void reset(pointer __p = pointer()) _NOEXCEPT
+    {
+        pointer __tmp = __ptr_.first();
+        __ptr_.first() = __p;
+        if (__tmp)
+            __ptr_.second()(__tmp);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY void swap(unique_ptr& __u) _NOEXCEPT
+        {__ptr_.swap(__u.__ptr_);}
+};
+
+template <class _Tp, class _Dp>
+class _LIBCPP_TYPE_VIS_ONLY unique_ptr<_Tp[], _Dp>
+{
+public:
+    typedef _Tp element_type;
+    typedef _Dp deleter_type;
+    typedef typename __pointer_type<_Tp, deleter_type>::type pointer;
+private:
+    __compressed_pair<pointer, deleter_type> __ptr_;
+
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    unique_ptr(unique_ptr&);
+    template <class _Up>
+        unique_ptr(unique_ptr<_Up>&);
+    unique_ptr& operator=(unique_ptr&);
+    template <class _Up>
+        unique_ptr& operator=(unique_ptr<_Up>&);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    struct __nat {int __for_bool_;};
+
+    typedef       typename remove_reference<deleter_type>::type& _Dp_reference;
+    typedef const typename remove_reference<deleter_type>::type& _Dp_const_reference;
+public:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT
+        : __ptr_(pointer())
+        {
+            static_assert(!is_pointer<deleter_type>::value,
+                "unique_ptr constructed with null function pointer deleter");
+        }
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT
+        : __ptr_(pointer())
+        {
+            static_assert(!is_pointer<deleter_type>::value,
+                "unique_ptr constructed with null function pointer deleter");
+        }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Pp>
+    _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p,
+            typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat()) _NOEXCEPT
+        : __ptr_(__p)
+        {
+            static_assert(!is_pointer<deleter_type>::value,
+                "unique_ptr constructed with null function pointer deleter");
+        }
+
+    template <class _Pp>
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename conditional<
+                                       is_reference<deleter_type>::value,
+                                       deleter_type,
+                                       typename add_lvalue_reference<const deleter_type>::type>::type __d,
+                                       typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat())
+             _NOEXCEPT
+        : __ptr_(__p, __d) {}
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, typename conditional<
+                                       is_reference<deleter_type>::value,
+                                       deleter_type,
+                                       typename add_lvalue_reference<const deleter_type>::type>::type __d)
+             _NOEXCEPT
+        : __ptr_(pointer(), __d) {}
+
+    template <class _Pp>
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p,
+                                         typename remove_reference<deleter_type>::type&& __d,
+                                         typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat())
+             _NOEXCEPT
+        : __ptr_(__p, _VSTD::move(__d))
+        {
+            static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
+        }
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, typename remove_reference<deleter_type>::type&& __d)
+             _NOEXCEPT
+        : __ptr_(pointer(), _VSTD::move(__d))
+        {
+            static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
+        }
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr&& __u) _NOEXCEPT
+        : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {}
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT
+        {
+            reset(__u.release());
+            __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
+            return *this;
+        }
+
+    template <class _Up, class _Ep>
+        _LIBCPP_INLINE_VISIBILITY
+        unique_ptr(unique_ptr<_Up, _Ep>&& __u,
+                   typename enable_if
+                            <
+                                is_array<_Up>::value &&
+                                __same_or_less_cv_qualified<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value
+                                && is_convertible<_Ep, deleter_type>::value &&
+                                (
+                                    !is_reference<deleter_type>::value ||
+                                    is_same<deleter_type, _Ep>::value
+                                ),
+                                __nat
+                            >::type = __nat()
+                  ) _NOEXCEPT
+        : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {}
+
+
+        template <class _Up, class _Ep>
+            _LIBCPP_INLINE_VISIBILITY
+            typename enable_if
+            <
+                is_array<_Up>::value &&
+                __same_or_less_cv_qualified<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
+                is_assignable<deleter_type&, _Ep&&>::value,
+                unique_ptr&
+            >::type
+            operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
+            {
+                reset(__u.release());
+                __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
+                return *this;
+            }
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p)
+        : __ptr_(__p)
+        {
+            static_assert(!is_pointer<deleter_type>::value,
+                "unique_ptr constructed with null function pointer deleter");
+        }
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d)
+        : __ptr_(__p, _VSTD::forward<deleter_type>(__d)) {}
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, deleter_type __d)
+        : __ptr_(pointer(), _VSTD::forward<deleter_type>(__d)) {}
+
+    _LIBCPP_INLINE_VISIBILITY operator __rv<unique_ptr>()
+    {
+        return __rv<unique_ptr>(*this);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr(__rv<unique_ptr> __u)
+        : __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {}
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(__rv<unique_ptr> __u)
+    {
+        reset(__u->release());
+        __ptr_.second() = _VSTD::forward<deleter_type>(__u->get_deleter());
+        return *this;
+    }
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY ~unique_ptr() {reset();}
+
+    _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT
+    {
+        reset();
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator[](size_t __i) const
+        {return __ptr_.first()[__i];}
+    _LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT {return __ptr_.first();}
+    _LIBCPP_INLINE_VISIBILITY       _Dp_reference get_deleter() _NOEXCEPT
+        {return __ptr_.second();}
+    _LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT
+        {return __ptr_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT
+        {return __ptr_.first() != nullptr;}
+
+    _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT
+    {
+        pointer __t = __ptr_.first();
+        __ptr_.first() = pointer();
+        return __t;
+    }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Pp>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, void>::type
+    reset(_Pp __p) _NOEXCEPT
+    {
+        pointer __tmp = __ptr_.first();
+        __ptr_.first() = __p;
+        if (__tmp)
+            __ptr_.second()(__tmp);
+    }
+    _LIBCPP_INLINE_VISIBILITY void reset(nullptr_t) _NOEXCEPT
+    {
+        pointer __tmp = __ptr_.first();
+        __ptr_.first() = nullptr;
+        if (__tmp)
+            __ptr_.second()(__tmp);
+    }
+    _LIBCPP_INLINE_VISIBILITY void reset() _NOEXCEPT
+    {
+        pointer __tmp = __ptr_.first();
+        __ptr_.first() = nullptr;
+        if (__tmp)
+            __ptr_.second()(__tmp);
+    }
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY void reset(pointer __p = pointer())
+    {
+        pointer __tmp = __ptr_.first();
+        __ptr_.first() = __p;
+        if (__tmp)
+            __ptr_.second()(__tmp);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY void swap(unique_ptr& __u) {__ptr_.swap(__u.__ptr_);}
+private:
+
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Up>
+        explicit unique_ptr(_Up);
+    template <class _Up>
+        unique_ptr(_Up __u,
+                   typename conditional<
+                                       is_reference<deleter_type>::value,
+                                       deleter_type,
+                                       typename add_lvalue_reference<const deleter_type>::type>::type,
+                   typename enable_if
+                      <
+                         is_convertible<_Up, pointer>::value,
+                         __nat
+                      >::type = __nat());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+};
+
+template <class _Tp, class _Dp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT {__x.swap(__y);}
+
+template <class _T1, class _D1, class _T2, class _D2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __x.get() == __y.get();}
+
+template <class _T1, class _D1, class _T2, class _D2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);}
+
+template <class _T1, class _D1, class _T2, class _D2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
+{
+    typedef typename unique_ptr<_T1, _D1>::pointer _P1;
+    typedef typename unique_ptr<_T2, _D2>::pointer _P2;
+    typedef typename common_type<_P1, _P2>::type _Vp;
+    return less<_Vp>()(__x.get(), __y.get());
+}
+
+template <class _T1, class _D1, class _T2, class _D2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __y < __x;}
+
+template <class _T1, class _D1, class _T2, class _D2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__y < __x);}
+
+template <class _T1, class _D1, class _T2, class _D2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x < __y);}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
+{
+    return !__x;
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
+{
+    return !__x;
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
+{
+    return static_cast<bool>(__x);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
+{
+    return static_cast<bool>(__x);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+{
+    typedef typename unique_ptr<_T1, _D1>::pointer _P1;
+    return less<_P1>()(__x.get(), nullptr);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+{
+    typedef typename unique_ptr<_T1, _D1>::pointer _P1;
+    return less<_P1>()(nullptr, __x.get());
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+{
+    return nullptr < __x;
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+{
+    return __x < nullptr;
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+{
+    return !(nullptr < __x);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+{
+    return !(__x < nullptr);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+{
+    return !(__x < nullptr);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+{
+    return !(nullptr < __x);
+}
+
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Dp>
+inline _LIBCPP_INLINE_VISIBILITY
+unique_ptr<_Tp, _Dp>
+move(unique_ptr<_Tp, _Dp>& __t)
+{
+    return unique_ptr<_Tp, _Dp>(__rv<unique_ptr<_Tp, _Dp> >(__t));
+}
+
+#endif
+
+#if _LIBCPP_STD_VER > 11
+
+template<class _Tp>
+struct __unique_if
+{
+    typedef unique_ptr<_Tp> __unique_single;
+};
+
+template<class _Tp>
+struct __unique_if<_Tp[]>
+{
+    typedef unique_ptr<_Tp[]> __unique_array_unknown_bound;
+};
+
+template<class _Tp, size_t _Np>
+struct __unique_if<_Tp[_Np]>
+{
+    typedef void __unique_array_known_bound;
+};
+
+template<class _Tp, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __unique_if<_Tp>::__unique_single
+make_unique(_Args&&... __args)
+{
+    return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...));
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __unique_if<_Tp>::__unique_array_unknown_bound
+make_unique(size_t __n)
+{
+    typedef typename remove_extent<_Tp>::type _Up;
+    return unique_ptr<_Tp>(new _Up[__n]());
+}
+
+template<class _Tp, class... _Args>
+    typename __unique_if<_Tp>::__unique_array_known_bound
+    make_unique(_Args&&...) = delete;
+
+#endif  // _LIBCPP_STD_VER > 11
+
+template <class _Tp> struct hash;
+
+template <class _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+_Size
+__loadword(const void* __p)
+{
+    _Size __r;
+    std::memcpy(&__r, __p, sizeof(__r));
+    return __r;
+}
+
+// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t
+// is 64 bits.  This is because cityhash64 uses 64bit x 64bit
+// multiplication, which can be very slow on 32-bit systems.
+template <class _Size, size_t = sizeof(_Size)*__CHAR_BIT__>
+struct __murmur2_or_cityhash;
+
+template <class _Size>
+struct __murmur2_or_cityhash<_Size, 32>
+{
+    _Size operator()(const void* __key, _Size __len);
+};
+
+// murmur2
+template <class _Size>
+_Size
+__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len)
+{
+    const _Size __m = 0x5bd1e995;
+    const _Size __r = 24;
+    _Size __h = __len;
+    const unsigned char* __data = static_cast<const unsigned char*>(__key);
+    for (; __len >= 4; __data += 4, __len -= 4)
+    {
+        _Size __k = __loadword<_Size>(__data);
+        __k *= __m;
+        __k ^= __k >> __r;
+        __k *= __m;
+        __h *= __m;
+        __h ^= __k;
+    }
+    switch (__len)
+    {
+    case 3:
+        __h ^= __data[2] << 16;
+    case 2:
+        __h ^= __data[1] << 8;
+    case 1:
+        __h ^= __data[0];
+        __h *= __m;
+    }
+    __h ^= __h >> 13;
+    __h *= __m;
+    __h ^= __h >> 15;
+    return __h;
+}
+
+template <class _Size>
+struct __murmur2_or_cityhash<_Size, 64>
+{
+    _Size operator()(const void* __key, _Size __len);
+
+ private:
+  // Some primes between 2^63 and 2^64.
+  static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
+  static const _Size __k1 = 0xb492b66fbe98f273ULL;
+  static const _Size __k2 = 0x9ae16a3b2f90404fULL;
+  static const _Size __k3 = 0xc949d7c7509e6557ULL;
+
+  static _Size __rotate(_Size __val, int __shift) {
+    return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift)));
+  }
+
+  static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
+    return (__val >> __shift) | (__val << (64 - __shift));
+  }
+
+  static _Size __shift_mix(_Size __val) {
+    return __val ^ (__val >> 47);
+  }
+
+  static _Size __hash_len_16(_Size __u, _Size __v) {
+    const _Size __mul = 0x9ddfea08eb382d69ULL;
+    _Size __a = (__u ^ __v) * __mul;
+    __a ^= (__a >> 47);
+    _Size __b = (__v ^ __a) * __mul;
+    __b ^= (__b >> 47);
+    __b *= __mul;
+    return __b;
+  }
+
+  static _Size __hash_len_0_to_16(const char* __s, _Size __len) {
+    if (__len > 8) {
+      const _Size __a = __loadword<_Size>(__s);
+      const _Size __b = __loadword<_Size>(__s + __len - 8);
+      return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b;
+    }
+    if (__len >= 4) {
+      const uint32_t __a = __loadword<uint32_t>(__s);
+      const uint32_t __b = __loadword<uint32_t>(__s + __len - 4);
+      return __hash_len_16(__len + (__a << 3), __b);
+    }
+    if (__len > 0) {
+      const unsigned char __a = __s[0];
+      const unsigned char __b = __s[__len >> 1];
+      const unsigned char __c = __s[__len - 1];
+      const uint32_t __y = static_cast<uint32_t>(__a) +
+                           (static_cast<uint32_t>(__b) << 8);
+      const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
+      return __shift_mix(__y * __k2 ^ __z * __k3) * __k2;
+    }
+    return __k2;
+  }
+
+  static _Size __hash_len_17_to_32(const char *__s, _Size __len) {
+    const _Size __a = __loadword<_Size>(__s) * __k1;
+    const _Size __b = __loadword<_Size>(__s + 8);
+    const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2;
+    const _Size __d = __loadword<_Size>(__s + __len - 16) * __k0;
+    return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d,
+                         __a + __rotate(__b ^ __k3, 20) - __c + __len);
+  }
+
+  // Return a 16-byte hash for 48 bytes.  Quick and dirty.
+  // Callers do best to use "random-looking" values for a and b.
+  static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
+      _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) {
+    __a += __w;
+    __b = __rotate(__b + __a + __z, 21);
+    const _Size __c = __a;
+    __a += __x;
+    __a += __y;
+    __b += __rotate(__a, 44);
+    return pair<_Size, _Size>(__a + __z, __b + __c);
+  }
+
+  // Return a 16-byte hash for s[0] ... s[31], a, and b.  Quick and dirty.
+  static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
+      const char* __s, _Size __a, _Size __b) {
+    return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s),
+                                         __loadword<_Size>(__s + 8),
+                                         __loadword<_Size>(__s + 16),
+                                         __loadword<_Size>(__s + 24),
+                                         __a,
+                                         __b);
+  }
+
+  // Return an 8-byte hash for 33 to 64 bytes.
+  static _Size __hash_len_33_to_64(const char *__s, size_t __len) {
+    _Size __z = __loadword<_Size>(__s + 24);
+    _Size __a = __loadword<_Size>(__s) +
+                (__len + __loadword<_Size>(__s + __len - 16)) * __k0;
+    _Size __b = __rotate(__a + __z, 52);
+    _Size __c = __rotate(__a, 37);
+    __a += __loadword<_Size>(__s + 8);
+    __c += __rotate(__a, 7);
+    __a += __loadword<_Size>(__s + 16);
+    _Size __vf = __a + __z;
+    _Size __vs = __b + __rotate(__a, 31) + __c;
+    __a = __loadword<_Size>(__s + 16) + __loadword<_Size>(__s + __len - 32);
+    __z += __loadword<_Size>(__s + __len - 8);
+    __b = __rotate(__a + __z, 52);
+    __c = __rotate(__a, 37);
+    __a += __loadword<_Size>(__s + __len - 24);
+    __c += __rotate(__a, 7);
+    __a += __loadword<_Size>(__s + __len - 16);
+    _Size __wf = __a + __z;
+    _Size __ws = __b + __rotate(__a, 31) + __c;
+    _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
+    return __shift_mix(__r * __k0 + __vs) * __k2;
+  }
+};
+
+// cityhash64
+template <class _Size>
+_Size
+__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
+{
+  const char* __s = static_cast<const char*>(__key);
+  if (__len <= 32) {
+    if (__len <= 16) {
+      return __hash_len_0_to_16(__s, __len);
+    } else {
+      return __hash_len_17_to_32(__s, __len);
+    }
+  } else if (__len <= 64) {
+    return __hash_len_33_to_64(__s, __len);
+  }
+
+  // For strings over 64 bytes we hash the end first, and then as we
+  // loop we keep 56 bytes of state: v, w, x, y, and z.
+  _Size __x = __loadword<_Size>(__s + __len - 40);
+  _Size __y = __loadword<_Size>(__s + __len - 16) +
+              __loadword<_Size>(__s + __len - 56);
+  _Size __z = __hash_len_16(__loadword<_Size>(__s + __len - 48) + __len,
+                          __loadword<_Size>(__s + __len - 24));
+  pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
+  pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
+  __x = __x * __k1 + __loadword<_Size>(__s);
+
+  // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
+  __len = (__len - 1) & ~static_cast<_Size>(63);
+  do {
+    __x = __rotate(__x + __y + __v.first + __loadword<_Size>(__s + 8), 37) * __k1;
+    __y = __rotate(__y + __v.second + __loadword<_Size>(__s + 48), 42) * __k1;
+    __x ^= __w.second;
+    __y += __v.first + __loadword<_Size>(__s + 40);
+    __z = __rotate(__z + __w.first, 33) * __k1;
+    __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
+    __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
+                                        __y + __loadword<_Size>(__s + 16));
+    std::swap(__z, __x);
+    __s += 64;
+    __len -= 64;
+  } while (__len != 0);
+  return __hash_len_16(
+      __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
+      __hash_len_16(__v.second, __w.second) + __x);
+}
+
+template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
+struct __scalar_hash;
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 0>
+    : public unary_function<_Tp, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(_Tp __v) const _NOEXCEPT
+    {
+        union
+        {
+            _Tp    __t;
+            size_t __a;
+        } __u;
+        __u.__a = 0;
+        __u.__t = __v;
+        return __u.__a;
+    }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 1>
+    : public unary_function<_Tp, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(_Tp __v) const _NOEXCEPT
+    {
+        union
+        {
+            _Tp    __t;
+            size_t __a;
+        } __u;
+        __u.__t = __v;
+        return __u.__a;
+    }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 2>
+    : public unary_function<_Tp, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(_Tp __v) const _NOEXCEPT
+    {
+        union
+        {
+            _Tp __t;
+            struct
+            {
+                size_t __a;
+                size_t __b;
+            } __s;
+        } __u;
+        __u.__t = __v;
+        return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+    }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 3>
+    : public unary_function<_Tp, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(_Tp __v) const _NOEXCEPT
+    {
+        union
+        {
+            _Tp __t;
+            struct
+            {
+                size_t __a;
+                size_t __b;
+                size_t __c;
+            } __s;
+        } __u;
+        __u.__t = __v;
+        return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+    }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 4>
+    : public unary_function<_Tp, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(_Tp __v) const _NOEXCEPT
+    {
+        union
+        {
+            _Tp __t;
+            struct
+            {
+                size_t __a;
+                size_t __b;
+                size_t __c;
+                size_t __d;
+            } __s;
+        } __u;
+        __u.__t = __v;
+        return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+    }
+};
+
+template<class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY hash<_Tp*>
+    : public unary_function<_Tp*, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(_Tp* __v) const _NOEXCEPT
+    {
+        union
+        {
+            _Tp* __t;
+            size_t __a;
+        } __u;
+        __u.__t = __v;
+        return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+    }
+};
+
+template <class _Tp, class _Dp>
+struct _LIBCPP_TYPE_VIS_ONLY hash<unique_ptr<_Tp, _Dp> >
+{
+    typedef unique_ptr<_Tp, _Dp> argument_type;
+    typedef size_t               result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator()(const argument_type& __ptr) const _NOEXCEPT
+    {
+        typedef typename argument_type::pointer pointer;
+        return hash<pointer>()(__ptr.get());
+    }
+};
+
+struct __destruct_n
+{
+private:
+    size_t size;
+
+    template <class _Tp>
+    _LIBCPP_INLINE_VISIBILITY void __process(_Tp* __p, false_type) _NOEXCEPT
+        {for (size_t __i = 0; __i < size; ++__i, ++__p) __p->~_Tp();}
+
+    template <class _Tp>
+    _LIBCPP_INLINE_VISIBILITY void __process(_Tp*, true_type) _NOEXCEPT
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY void __incr(false_type) _NOEXCEPT
+        {++size;}
+    _LIBCPP_INLINE_VISIBILITY void __incr(true_type) _NOEXCEPT
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, false_type) _NOEXCEPT
+        {size = __s;}
+    _LIBCPP_INLINE_VISIBILITY void __set(size_t, true_type) _NOEXCEPT
+        {}
+public:
+    _LIBCPP_INLINE_VISIBILITY explicit __destruct_n(size_t __s) _NOEXCEPT
+        : size(__s) {}
+
+    template <class _Tp>
+    _LIBCPP_INLINE_VISIBILITY void __incr(_Tp*) _NOEXCEPT
+        {__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
+
+    template <class _Tp>
+    _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, _Tp*) _NOEXCEPT
+        {__set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
+
+    template <class _Tp>
+    _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __p) _NOEXCEPT
+        {__process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
+};
+
+template <class _Alloc>
+class __allocator_destructor
+{
+    typedef allocator_traits<_Alloc> __alloc_traits;
+public:
+    typedef typename __alloc_traits::pointer pointer;
+    typedef typename __alloc_traits::size_type size_type;
+private:
+    _Alloc& __alloc_;
+    size_type __s_;
+public:
+    _LIBCPP_INLINE_VISIBILITY __allocator_destructor(_Alloc& __a, size_type __s)
+             _NOEXCEPT
+        : __alloc_(__a), __s_(__s) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void operator()(pointer __p) _NOEXCEPT
+        {__alloc_traits::deallocate(__alloc_, __p, __s_);}
+};
+
+template <class _InputIterator, class _ForwardIterator>
+_ForwardIterator
+uninitialized_copy(_InputIterator __f, _InputIterator __l, _ForwardIterator __r)
+{
+    typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    _ForwardIterator __s = __r;
+    try
+    {
+#endif
+        for (; __f != __l; ++__f, (void) ++__r)
+            ::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        for (; __s != __r; ++__s)
+            __s->~value_type();
+        throw;
+    }
+#endif
+    return __r;
+}
+
+template <class _InputIterator, class _Size, class _ForwardIterator>
+_ForwardIterator
+uninitialized_copy_n(_InputIterator __f, _Size __n, _ForwardIterator __r)
+{
+    typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    _ForwardIterator __s = __r;
+    try
+    {
+#endif
+        for (; __n > 0; ++__f, (void) ++__r, (void) --__n)
+            ::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        for (; __s != __r; ++__s)
+            __s->~value_type();
+        throw;
+    }
+#endif
+    return __r;
+}
+
+template <class _ForwardIterator, class _Tp>
+void
+uninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x)
+{
+    typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    _ForwardIterator __s = __f;
+    try
+    {
+#endif
+        for (; __f != __l; ++__f)
+            ::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        for (; __s != __f; ++__s)
+            __s->~value_type();
+        throw;
+    }
+#endif
+}
+
+template <class _ForwardIterator, class _Size, class _Tp>
+_ForwardIterator
+uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
+{
+    typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    _ForwardIterator __s = __f;
+    try
+    {
+#endif
+        for (; __n > 0; ++__f, (void) --__n)
+            ::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        for (; __s != __f; ++__s)
+            __s->~value_type();
+        throw;
+    }
+#endif
+    return __f;
+}
+
+class _LIBCPP_EXCEPTION_ABI bad_weak_ptr
+    : public std::exception
+{
+public:
+    virtual ~bad_weak_ptr() _NOEXCEPT;
+    virtual const char* what() const  _NOEXCEPT;
+};
+
+template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
+
+class _LIBCPP_TYPE_VIS __shared_count
+{
+    __shared_count(const __shared_count&);
+    __shared_count& operator=(const __shared_count&);
+
+protected:
+    long __shared_owners_;
+    virtual ~__shared_count();
+private:
+    virtual void __on_zero_shared() _NOEXCEPT = 0;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __shared_count(long __refs = 0) _NOEXCEPT
+        : __shared_owners_(__refs) {}
+
+    void __add_shared() _NOEXCEPT;
+    bool __release_shared() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    long use_count() const _NOEXCEPT {
+        return __libcpp_relaxed_load(&__shared_owners_) + 1;
+    }
+};
+
+class _LIBCPP_TYPE_VIS __shared_weak_count
+    : private __shared_count
+{
+    long __shared_weak_owners_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __shared_weak_count(long __refs = 0) _NOEXCEPT
+        : __shared_count(__refs),
+          __shared_weak_owners_(__refs) {}
+protected:
+    virtual ~__shared_weak_count();
+
+public:
+    void __add_shared() _NOEXCEPT;
+    void __add_weak() _NOEXCEPT;
+    void __release_shared() _NOEXCEPT;
+    void __release_weak() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    long use_count() const _NOEXCEPT {return __shared_count::use_count();}
+    __shared_weak_count* lock() _NOEXCEPT;
+
+    // Define the function out only if we build static libc++ without RTTI.
+    // Otherwise we may break clients who need to compile their projects with
+    // -fno-rtti and yet link against a libc++.dylib compiled
+    // without -fno-rtti.
+#if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC)
+    virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
+#endif
+private:
+    virtual void __on_zero_shared_weak() _NOEXCEPT = 0;
+};
+
+template <class _Tp, class _Dp, class _Alloc>
+class __shared_ptr_pointer
+    : public __shared_weak_count
+{
+    __compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
+        :  __data_(__compressed_pair<_Tp, _Dp>(__p, _VSTD::move(__d)), _VSTD::move(__a)) {}
+
+#ifndef _LIBCPP_NO_RTTI
+    virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
+#endif
+
+private:
+    virtual void __on_zero_shared() _NOEXCEPT;
+    virtual void __on_zero_shared_weak() _NOEXCEPT;
+};
+
+#ifndef _LIBCPP_NO_RTTI
+
+template <class _Tp, class _Dp, class _Alloc>
+const void*
+__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT
+{
+    return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : 0;
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+template <class _Tp, class _Dp, class _Alloc>
+void
+__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() _NOEXCEPT
+{
+    __data_.first().second()(__data_.first().first());
+    __data_.first().second().~_Dp();
+}
+
+template <class _Tp, class _Dp, class _Alloc>
+void
+__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
+{
+    typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al;
+    typedef allocator_traits<_Al> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+
+    _Al __a(__data_.second());
+    __data_.second().~_Alloc();
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
+}
+
+template <class _Tp, class _Alloc>
+class __shared_ptr_emplace
+    : public __shared_weak_count
+{
+    __compressed_pair<_Alloc, _Tp> __data_;
+public:
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    _LIBCPP_INLINE_VISIBILITY
+    __shared_ptr_emplace(_Alloc __a)
+        :  __data_(_VSTD::move(__a)) {}
+
+    template <class ..._Args>
+        _LIBCPP_INLINE_VISIBILITY
+        __shared_ptr_emplace(_Alloc __a, _Args&& ...__args)
+            :  __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),
+                   _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) {}
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+    _LIBCPP_INLINE_VISIBILITY
+    __shared_ptr_emplace(_Alloc __a)
+        :  __data_(__a) {}
+
+    template <class _A0>
+        _LIBCPP_INLINE_VISIBILITY
+        __shared_ptr_emplace(_Alloc __a, _A0& __a0)
+            :  __data_(__a, _Tp(__a0)) {}
+
+    template <class _A0, class _A1>
+        _LIBCPP_INLINE_VISIBILITY
+        __shared_ptr_emplace(_Alloc __a, _A0& __a0, _A1& __a1)
+            :  __data_(__a, _Tp(__a0, __a1)) {}
+
+    template <class _A0, class _A1, class _A2>
+        _LIBCPP_INLINE_VISIBILITY
+        __shared_ptr_emplace(_Alloc __a, _A0& __a0, _A1& __a1, _A2& __a2)
+            :  __data_(__a, _Tp(__a0, __a1, __a2)) {}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+private:
+    virtual void __on_zero_shared() _NOEXCEPT;
+    virtual void __on_zero_shared_weak() _NOEXCEPT;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp* get() _NOEXCEPT {return &__data_.second();}
+};
+
+template <class _Tp, class _Alloc>
+void
+__shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared() _NOEXCEPT
+{
+    __data_.second().~_Tp();
+}
+
+template <class _Tp, class _Alloc>
+void
+__shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
+{
+    typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _Al;
+    typedef allocator_traits<_Al> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+    _Al __a(__data_.first());
+    __data_.first().~_Alloc();
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
+}
+
+template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this;
+
+template<class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY shared_ptr
+{
+public:
+    typedef _Tp element_type;
+private:
+    element_type*      __ptr_;
+    __shared_weak_count* __cntrl_;
+
+    struct __nat {int __for_bool_;};
+public:
+    _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT;
+    _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
+    template<class _Yp>
+        explicit shared_ptr(_Yp* __p,
+                            typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
+    template<class _Yp, class _Dp>
+        shared_ptr(_Yp* __p, _Dp __d,
+                   typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
+    template<class _Yp, class _Dp, class _Alloc>
+        shared_ptr(_Yp* __p, _Dp __d, _Alloc __a,
+                   typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
+    template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d);
+    template <class _Dp, class _Alloc> shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a);
+    template<class _Yp> shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
+    shared_ptr(const shared_ptr& __r) _NOEXCEPT;
+    template<class _Yp>
+        shared_ptr(const shared_ptr<_Yp>& __r,
+                   typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat())
+                       _NOEXCEPT;
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    shared_ptr(shared_ptr&& __r) _NOEXCEPT;
+    template<class _Yp> shared_ptr(shared_ptr<_Yp>&& __r,
+                   typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat())
+                       _NOEXCEPT;
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template<class _Yp> explicit shared_ptr(const weak_ptr<_Yp>& __r,
+                   typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type= __nat());
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template<class _Yp>
+        shared_ptr(auto_ptr<_Yp>&& __r,
+                   typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
+#else
+    template<class _Yp>
+        shared_ptr(auto_ptr<_Yp> __r,
+                   typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
+#endif
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Yp, class _Dp>
+        shared_ptr(unique_ptr<_Yp, _Dp>&&,
+                   typename enable_if
+                   <
+                       !is_lvalue_reference<_Dp>::value &&
+                       !is_array<_Yp>::value &&
+                       is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
+                       __nat
+                   >::type = __nat());
+    template <class _Yp, class _Dp>
+        shared_ptr(unique_ptr<_Yp, _Dp>&&,
+                   typename enable_if
+                   <
+                       is_lvalue_reference<_Dp>::value &&
+                       !is_array<_Yp>::value &&
+                       is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
+                       __nat
+                   >::type = __nat());
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Yp, class _Dp>
+        shared_ptr(unique_ptr<_Yp, _Dp>,
+                   typename enable_if
+                   <
+                       !is_lvalue_reference<_Dp>::value &&
+                       !is_array<_Yp>::value &&
+                       is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
+                       __nat
+                   >::type = __nat());
+    template <class _Yp, class _Dp>
+        shared_ptr(unique_ptr<_Yp, _Dp>,
+                   typename enable_if
+                   <
+                       is_lvalue_reference<_Dp>::value &&
+                       !is_array<_Yp>::value &&
+                       is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
+                       __nat
+                   >::type = __nat());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    ~shared_ptr();
+
+    shared_ptr& operator=(const shared_ptr& __r) _NOEXCEPT;
+    template<class _Yp>
+        typename enable_if
+        <
+            is_convertible<_Yp*, element_type*>::value,
+            shared_ptr&
+        >::type
+        operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT;
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT;
+    template<class _Yp>
+        typename enable_if
+        <
+            is_convertible<_Yp*, element_type*>::value,
+            shared_ptr<_Tp>&
+        >::type
+        operator=(shared_ptr<_Yp>&& __r);
+    template<class _Yp>
+        typename enable_if
+        <
+            !is_array<_Yp>::value &&
+            is_convertible<_Yp*, element_type*>::value,
+            shared_ptr
+        >::type&
+        operator=(auto_ptr<_Yp>&& __r);
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template<class _Yp>
+        typename enable_if
+        <
+            !is_array<_Yp>::value &&
+            is_convertible<_Yp*, element_type*>::value,
+            shared_ptr&
+        >::type
+        operator=(auto_ptr<_Yp> __r);
+#endif
+    template <class _Yp, class _Dp>
+        typename enable_if
+        <
+            !is_array<_Yp>::value &&
+            is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
+            shared_ptr&
+        >::type
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+        operator=(unique_ptr<_Yp, _Dp>&& __r);
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+        operator=(unique_ptr<_Yp, _Dp> __r);
+#endif
+
+    void swap(shared_ptr& __r) _NOEXCEPT;
+    void reset() _NOEXCEPT;
+    template<class _Yp>
+        typename enable_if
+        <
+            is_convertible<_Yp*, element_type*>::value,
+            void
+        >::type
+        reset(_Yp* __p);
+    template<class _Yp, class _Dp>
+        typename enable_if
+        <
+            is_convertible<_Yp*, element_type*>::value,
+            void
+        >::type
+        reset(_Yp* __p, _Dp __d);
+    template<class _Yp, class _Dp, class _Alloc>
+        typename enable_if
+        <
+            is_convertible<_Yp*, element_type*>::value,
+            void
+        >::type
+        reset(_Yp* __p, _Dp __d, _Alloc __a);
+
+    _LIBCPP_INLINE_VISIBILITY
+    element_type* get() const _NOEXCEPT {return __ptr_;}
+    _LIBCPP_INLINE_VISIBILITY
+    typename add_lvalue_reference<element_type>::type operator*() const _NOEXCEPT
+        {return *__ptr_;}
+    _LIBCPP_INLINE_VISIBILITY
+    element_type* operator->() const _NOEXCEPT {return __ptr_;}
+    _LIBCPP_INLINE_VISIBILITY
+    long use_count() const _NOEXCEPT {return __cntrl_ ? __cntrl_->use_count() : 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool unique() const _NOEXCEPT {return use_count() == 1;}
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;}
+    template <class _Up>
+        _LIBCPP_INLINE_VISIBILITY
+        bool owner_before(shared_ptr<_Up> const& __p) const
+        {return __cntrl_ < __p.__cntrl_;}
+    template <class _Up>
+        _LIBCPP_INLINE_VISIBILITY
+        bool owner_before(weak_ptr<_Up> const& __p) const
+        {return __cntrl_ < __p.__cntrl_;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool
+    __owner_equivalent(const shared_ptr& __p) const
+        {return __cntrl_ == __p.__cntrl_;}
+
+#ifndef _LIBCPP_NO_RTTI
+    template <class _Dp>
+        _LIBCPP_INLINE_VISIBILITY
+        _Dp* __get_deleter() const _NOEXCEPT
+            {return (_Dp*)(__cntrl_ ? __cntrl_->__get_deleter(typeid(_Dp)) : 0);}
+#endif  // _LIBCPP_NO_RTTI
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template<class ..._Args>
+        static
+        shared_ptr<_Tp>
+        make_shared(_Args&& ...__args);
+
+    template<class _Alloc, class ..._Args>
+        static
+        shared_ptr<_Tp>
+        allocate_shared(const _Alloc& __a, _Args&& ...__args);
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+    static shared_ptr<_Tp> make_shared();
+
+    template<class _A0>
+        static shared_ptr<_Tp> make_shared(_A0&);
+
+    template<class _A0, class _A1>
+        static shared_ptr<_Tp> make_shared(_A0&, _A1&);
+
+    template<class _A0, class _A1, class _A2>
+        static shared_ptr<_Tp> make_shared(_A0&, _A1&, _A2&);
+
+    template<class _Alloc>
+        static shared_ptr<_Tp>
+        allocate_shared(const _Alloc& __a);
+
+    template<class _Alloc, class _A0>
+        static shared_ptr<_Tp>
+        allocate_shared(const _Alloc& __a, _A0& __a0);
+
+    template<class _Alloc, class _A0, class _A1>
+        static shared_ptr<_Tp>
+        allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1);
+
+    template<class _Alloc, class _A0, class _A1, class _A2>
+        static shared_ptr<_Tp>
+        allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2);
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+private:
+
+    template <class _Yp>
+        _LIBCPP_INLINE_VISIBILITY
+        void
+        __enable_weak_this(const enable_shared_from_this<_Yp>* __e) _NOEXCEPT
+        {
+            if (__e)
+            {
+                __e->__weak_this_.__ptr_ = const_cast<_Yp*>(static_cast<const _Yp*>(__e));
+                __e->__weak_this_.__cntrl_ = __cntrl_;
+                __cntrl_->__add_weak();
+            }
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __enable_weak_this(const volatile void*) _NOEXCEPT {}
+
+    template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
+    template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
+};
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
+    : __ptr_(0),
+      __cntrl_(0)
+{
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT
+    : __ptr_(0),
+      __cntrl_(0)
+{
+}
+
+template<class _Tp>
+template<class _Yp>
+shared_ptr<_Tp>::shared_ptr(_Yp* __p,
+                            typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
+    : __ptr_(__p)
+{
+    unique_ptr<_Yp> __hold(__p);
+    typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
+    __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>());
+    __hold.release();
+    __enable_weak_this(__p);
+}
+
+template<class _Tp>
+template<class _Yp, class _Dp>
+shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d,
+                            typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
+    : __ptr_(__p)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>());
+        __enable_weak_this(__p);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __d(__p);
+        throw;
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template<class _Tp>
+template<class _Dp>
+shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d)
+    : __ptr_(0)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typedef __shared_ptr_pointer<nullptr_t, _Dp, allocator<_Tp> > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>());
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __d(__p);
+        throw;
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template<class _Tp>
+template<class _Yp, class _Dp, class _Alloc>
+shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a,
+                            typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
+    : __ptr_(__p)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
+        typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
+        typedef __allocator_destructor<_A2> _D2;
+        _A2 __a2(__a);
+        unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
+        ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+            _CntrlBlk(__p, __d, __a);
+        __cntrl_ = _VSTD::addressof(*__hold2.release());
+        __enable_weak_this(__p);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __d(__p);
+        throw;
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template<class _Tp>
+template<class _Dp, class _Alloc>
+shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
+    : __ptr_(0)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
+        typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
+        typedef __allocator_destructor<_A2> _D2;
+        _A2 __a2(__a);
+        unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
+        ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+            _CntrlBlk(__p, __d, __a);
+        __cntrl_ = _VSTD::addressof(*__hold2.release());
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        __d(__p);
+        throw;
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEXCEPT
+    : __ptr_(__p),
+      __cntrl_(__r.__cntrl_)
+{
+    if (__cntrl_)
+        __cntrl_->__add_shared();
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) _NOEXCEPT
+    : __ptr_(__r.__ptr_),
+      __cntrl_(__r.__cntrl_)
+{
+    if (__cntrl_)
+        __cntrl_->__add_shared();
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r,
+                            typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
+         _NOEXCEPT
+    : __ptr_(__r.__ptr_),
+      __cntrl_(__r.__cntrl_)
+{
+    if (__cntrl_)
+        __cntrl_->__add_shared();
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
+    : __ptr_(__r.__ptr_),
+      __cntrl_(__r.__cntrl_)
+{
+    __r.__ptr_ = 0;
+    __r.__cntrl_ = 0;
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r,
+                            typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
+         _NOEXCEPT
+    : __ptr_(__r.__ptr_),
+      __cntrl_(__r.__cntrl_)
+{
+    __r.__ptr_ = 0;
+    __r.__cntrl_ = 0;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+template<class _Yp>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp>&& __r,
+#else
+shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r,
+#endif
+                            typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
+    : __ptr_(__r.get())
+{
+    typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
+    __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>());
+    __enable_weak_this(__r.get());
+    __r.release();
+}
+
+template<class _Tp>
+template <class _Yp, class _Dp>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r,
+#else
+shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
+#endif
+                            typename enable_if
+                            <
+                                !is_lvalue_reference<_Dp>::value &&
+                                !is_array<_Yp>::value &&
+                                is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
+                                __nat
+                            >::type)
+    : __ptr_(__r.get())
+{
+#if _LIBCPP_STD_VER > 11
+    if (__ptr_ == nullptr)
+        __cntrl_ = nullptr;
+    else
+#endif
+    {
+        typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>());
+        __enable_weak_this(__r.get());
+    }
+    __r.release();
+}
+
+template<class _Tp>
+template <class _Yp, class _Dp>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r,
+#else
+shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
+#endif
+                            typename enable_if
+                            <
+                                is_lvalue_reference<_Dp>::value &&
+                                !is_array<_Yp>::value &&
+                                is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
+                                __nat
+                            >::type)
+    : __ptr_(__r.get())
+{
+#if _LIBCPP_STD_VER > 11
+    if (__ptr_ == nullptr)
+        __cntrl_ = nullptr;
+    else
+#endif
+    {
+        typedef __shared_ptr_pointer<_Yp*,
+                                     reference_wrapper<typename remove_reference<_Dp>::type>,
+                                     allocator<_Yp> > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>());
+        __enable_weak_this(__r.get());
+    }
+    __r.release();
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template<class _Tp>
+template<class ..._Args>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::make_shared(_Args&& ...__args)
+{
+    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
+    typedef allocator<_CntrlBlk> _A2;
+    typedef __allocator_destructor<_A2> _D2;
+    _A2 __a2;
+    unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
+    ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
+    shared_ptr<_Tp> __r;
+    __r.__ptr_ = __hold2.get()->get();
+    __r.__cntrl_ = __hold2.release();
+    __r.__enable_weak_this(__r.__ptr_);
+    return __r;
+}
+
+template<class _Tp>
+template<class _Alloc, class ..._Args>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)
+{
+    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
+    typedef __allocator_destructor<_A2> _D2;
+    _A2 __a2(__a);
+    unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+        _CntrlBlk(__a, _VSTD::forward<_Args>(__args)...);
+    shared_ptr<_Tp> __r;
+    __r.__ptr_ = __hold2.get()->get();
+    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
+    __r.__enable_weak_this(__r.__ptr_);
+    return __r;
+}
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template<class _Tp>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::make_shared()
+{
+    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
+    typedef allocator<_CntrlBlk> _Alloc2;
+    typedef __allocator_destructor<_Alloc2> _D2;
+    _Alloc2 __alloc2;
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
+    ::new(__hold2.get()) _CntrlBlk(__alloc2);
+    shared_ptr<_Tp> __r;
+    __r.__ptr_ = __hold2.get()->get();
+    __r.__cntrl_ = __hold2.release();
+    __r.__enable_weak_this(__r.__ptr_);
+    return __r;
+}
+
+template<class _Tp>
+template<class _A0>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::make_shared(_A0& __a0)
+{
+    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
+    typedef allocator<_CntrlBlk> _Alloc2;
+    typedef __allocator_destructor<_Alloc2> _D2;
+    _Alloc2 __alloc2;
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
+    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0);
+    shared_ptr<_Tp> __r;
+    __r.__ptr_ = __hold2.get()->get();
+    __r.__cntrl_ = __hold2.release();
+    __r.__enable_weak_this(__r.__ptr_);
+    return __r;
+}
+
+template<class _Tp>
+template<class _A0, class _A1>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1)
+{
+    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
+    typedef allocator<_CntrlBlk> _Alloc2;
+    typedef __allocator_destructor<_Alloc2> _D2;
+    _Alloc2 __alloc2;
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
+    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1);
+    shared_ptr<_Tp> __r;
+    __r.__ptr_ = __hold2.get()->get();
+    __r.__cntrl_ = __hold2.release();
+    __r.__enable_weak_this(__r.__ptr_);
+    return __r;
+}
+
+template<class _Tp>
+template<class _A0, class _A1, class _A2>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1, _A2& __a2)
+{
+    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
+    typedef allocator<_CntrlBlk> _Alloc2;
+    typedef __allocator_destructor<_Alloc2> _D2;
+    _Alloc2 __alloc2;
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
+    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1, __a2);
+    shared_ptr<_Tp> __r;
+    __r.__ptr_ = __hold2.get()->get();
+    __r.__cntrl_ = __hold2.release();
+    __r.__enable_weak_this(__r.__ptr_);
+    return __r;
+}
+
+template<class _Tp>
+template<class _Alloc>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::allocate_shared(const _Alloc& __a)
+{
+    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
+    typedef __allocator_destructor<_Alloc2> _D2;
+    _Alloc2 __alloc2(__a);
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+        _CntrlBlk(__a);
+    shared_ptr<_Tp> __r;
+    __r.__ptr_ = __hold2.get()->get();
+    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
+    __r.__enable_weak_this(__r.__ptr_);
+    return __r;
+}
+
+template<class _Tp>
+template<class _Alloc, class _A0>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0)
+{
+    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
+    typedef __allocator_destructor<_Alloc2> _D2;
+    _Alloc2 __alloc2(__a);
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+        _CntrlBlk(__a, __a0);
+    shared_ptr<_Tp> __r;
+    __r.__ptr_ = __hold2.get()->get();
+    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
+    __r.__enable_weak_this(__r.__ptr_);
+    return __r;
+}
+
+template<class _Tp>
+template<class _Alloc, class _A0, class _A1>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1)
+{
+    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
+    typedef __allocator_destructor<_Alloc2> _D2;
+    _Alloc2 __alloc2(__a);
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+        _CntrlBlk(__a, __a0, __a1);
+    shared_ptr<_Tp> __r;
+    __r.__ptr_ = __hold2.get()->get();
+    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
+    __r.__enable_weak_this(__r.__ptr_);
+    return __r;
+}
+
+template<class _Tp>
+template<class _Alloc, class _A0, class _A1, class _A2>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
+    typedef __allocator_destructor<_Alloc2> _D2;
+    _Alloc2 __alloc2(__a);
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+        _CntrlBlk(__a, __a0, __a1, __a2);
+    shared_ptr<_Tp> __r;
+    __r.__ptr_ = __hold2.get()->get();
+    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
+    __r.__enable_weak_this(__r.__ptr_);
+    return __r;
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template<class _Tp>
+shared_ptr<_Tp>::~shared_ptr()
+{
+    if (__cntrl_)
+        __cntrl_->__release_shared();
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>&
+shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT
+{
+    shared_ptr(__r).swap(*this);
+    return *this;
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_convertible<_Yp*, _Tp*>::value,
+    shared_ptr<_Tp>&
+>::type
+shared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT
+{
+    shared_ptr(__r).swap(*this);
+    return *this;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>&
+shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT
+{
+    shared_ptr(_VSTD::move(__r)).swap(*this);
+    return *this;
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_convertible<_Yp*, _Tp*>::value,
+    shared_ptr<_Tp>&
+>::type
+shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r)
+{
+    shared_ptr(_VSTD::move(__r)).swap(*this);
+    return *this;
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_array<_Yp>::value &&
+    is_convertible<_Yp*, _Tp*>::value,
+    shared_ptr<_Tp>
+>::type&
+shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
+{
+    shared_ptr(_VSTD::move(__r)).swap(*this);
+    return *this;
+}
+
+template<class _Tp>
+template <class _Yp, class _Dp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_array<_Yp>::value &&
+    is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, _Tp*>::value,
+    shared_ptr<_Tp>&
+>::type
+shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp>&& __r)
+{
+    shared_ptr(_VSTD::move(__r)).swap(*this);
+    return *this;
+}
+
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_array<_Yp>::value &&
+    is_convertible<_Yp*, _Tp*>::value,
+    shared_ptr<_Tp>&
+>::type
+shared_ptr<_Tp>::operator=(auto_ptr<_Yp> __r)
+{
+    shared_ptr(__r).swap(*this);
+    return *this;
+}
+
+template<class _Tp>
+template <class _Yp, class _Dp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_array<_Yp>::value &&
+    is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, _Tp*>::value,
+    shared_ptr<_Tp>&
+>::type
+shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp> __r)
+{
+    shared_ptr(_VSTD::move(__r)).swap(*this);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+shared_ptr<_Tp>::swap(shared_ptr& __r) _NOEXCEPT
+{
+    _VSTD::swap(__ptr_, __r.__ptr_);
+    _VSTD::swap(__cntrl_, __r.__cntrl_);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+shared_ptr<_Tp>::reset() _NOEXCEPT
+{
+    shared_ptr().swap(*this);
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_convertible<_Yp*, _Tp*>::value,
+    void
+>::type
+shared_ptr<_Tp>::reset(_Yp* __p)
+{
+    shared_ptr(__p).swap(*this);
+}
+
+template<class _Tp>
+template<class _Yp, class _Dp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_convertible<_Yp*, _Tp*>::value,
+    void
+>::type
+shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d)
+{
+    shared_ptr(__p, __d).swap(*this);
+}
+
+template<class _Tp>
+template<class _Yp, class _Dp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_convertible<_Yp*, _Tp*>::value,
+    void
+>::type
+shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a)
+{
+    shared_ptr(__p, __d, __a).swap(*this);
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template<class _Tp, class ..._Args>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_array<_Tp>::value,
+    shared_ptr<_Tp>
+>::type
+make_shared(_Args&& ...__args)
+{
+    return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
+}
+
+template<class _Tp, class _Alloc, class ..._Args>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_array<_Tp>::value,
+    shared_ptr<_Tp>
+>::type
+allocate_shared(const _Alloc& __a, _Args&& ...__args)
+{
+    return shared_ptr<_Tp>::allocate_shared(__a, _VSTD::forward<_Args>(__args)...);
+}
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+make_shared()
+{
+    return shared_ptr<_Tp>::make_shared();
+}
+
+template<class _Tp, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+make_shared(_A0& __a0)
+{
+    return shared_ptr<_Tp>::make_shared(__a0);
+}
+
+template<class _Tp, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+make_shared(_A0& __a0, _A1& __a1)
+{
+    return shared_ptr<_Tp>::make_shared(__a0, __a1);
+}
+
+template<class _Tp, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+make_shared(_A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return shared_ptr<_Tp>::make_shared(__a0, __a1, __a2);
+}
+
+template<class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+allocate_shared(const _Alloc& __a)
+{
+    return shared_ptr<_Tp>::allocate_shared(__a);
+}
+
+template<class _Tp, class _Alloc, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+allocate_shared(const _Alloc& __a, _A0& __a0)
+{
+    return shared_ptr<_Tp>::allocate_shared(__a, __a0);
+}
+
+template<class _Tp, class _Alloc, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1)
+{
+    return shared_ptr<_Tp>::allocate_shared(__a, __a0, __a1);
+}
+
+template<class _Tp, class _Alloc, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+    return shared_ptr<_Tp>::allocate_shared(__a, __a0, __a1, __a2);
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
+{
+    return __x.get() == __y.get();
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
+{
+    return !(__x == __y);
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
+{
+    typedef typename common_type<_Tp*, _Up*>::type _Vp;
+    return less<_Vp>()(__x.get(), __y.get());
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
+{
+    return __y < __x;
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
+{
+    return !(__y < __x);
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
+{
+    return !(__x < __y);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+    return !__x;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+    return !__x;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+    return static_cast<bool>(__x);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+    return static_cast<bool>(__x);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+    return less<_Tp*>()(__x.get(), nullptr);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+    return less<_Tp*>()(nullptr, __x.get());
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+    return nullptr < __x;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+    return __x < nullptr;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+    return !(nullptr < __x);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+    return !(__x < nullptr);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+    return !(__x < nullptr);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+    return !(nullptr < __x);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT
+{
+    __x.swap(__y);
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_array<_Tp>::value && !is_array<_Up>::value,
+    shared_ptr<_Tp>
+>::type
+static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
+{
+    return shared_ptr<_Tp>(__r, static_cast<_Tp*>(__r.get()));
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_array<_Tp>::value && !is_array<_Up>::value,
+    shared_ptr<_Tp>
+>::type
+dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
+{
+    _Tp* __p = dynamic_cast<_Tp*>(__r.get());
+    return __p ? shared_ptr<_Tp>(__r, __p) : shared_ptr<_Tp>();
+}
+
+template<class _Tp, class _Up>
+typename enable_if
+<
+    is_array<_Tp>::value == is_array<_Up>::value,
+    shared_ptr<_Tp>
+>::type
+const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
+{
+    typedef typename remove_extent<_Tp>::type _RTp;
+    return shared_ptr<_Tp>(__r, const_cast<_RTp*>(__r.get()));
+}
+
+#ifndef _LIBCPP_NO_RTTI
+
+template<class _Dp, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Dp*
+get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT
+{
+    return __p.template __get_deleter<_Dp>();
+}
+
+#endif  // _LIBCPP_NO_RTTI
+
+template<class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY weak_ptr
+{
+public:
+    typedef _Tp element_type;
+private:
+    element_type*        __ptr_;
+    __shared_weak_count* __cntrl_;
+
+public:
+    _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
+    template<class _Yp> weak_ptr(shared_ptr<_Yp> const& __r,
+                   typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
+                        _NOEXCEPT;
+    weak_ptr(weak_ptr const& __r) _NOEXCEPT;
+    template<class _Yp> weak_ptr(weak_ptr<_Yp> const& __r,
+                   typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
+                         _NOEXCEPT;
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    weak_ptr(weak_ptr&& __r) _NOEXCEPT;
+    template<class _Yp> weak_ptr(weak_ptr<_Yp>&& __r,
+                   typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
+                         _NOEXCEPT;
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    ~weak_ptr();
+
+    weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
+    template<class _Yp>
+        typename enable_if
+        <
+            is_convertible<_Yp*, element_type*>::value,
+            weak_ptr&
+        >::type
+        operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
+    template<class _Yp>
+        typename enable_if
+        <
+            is_convertible<_Yp*, element_type*>::value,
+            weak_ptr&
+        >::type
+        operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    template<class _Yp>
+        typename enable_if
+        <
+            is_convertible<_Yp*, element_type*>::value,
+            weak_ptr&
+        >::type
+        operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
+
+    void swap(weak_ptr& __r) _NOEXCEPT;
+    void reset() _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    long use_count() const _NOEXCEPT
+        {return __cntrl_ ? __cntrl_->use_count() : 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool expired() const _NOEXCEPT
+        {return __cntrl_ == 0 || __cntrl_->use_count() == 0;}
+    shared_ptr<_Tp> lock() const _NOEXCEPT;
+    template<class _Up>
+        _LIBCPP_INLINE_VISIBILITY
+        bool owner_before(const shared_ptr<_Up>& __r) const
+        {return __cntrl_ < __r.__cntrl_;}
+    template<class _Up>
+        _LIBCPP_INLINE_VISIBILITY
+        bool owner_before(const weak_ptr<_Up>& __r) const
+        {return __cntrl_ < __r.__cntrl_;}
+
+    template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
+    template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
+};
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
+    : __ptr_(0),
+      __cntrl_(0)
+{
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
+    : __ptr_(__r.__ptr_),
+      __cntrl_(__r.__cntrl_)
+{
+    if (__cntrl_)
+        __cntrl_->__add_weak();
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
+                        typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
+                         _NOEXCEPT
+    : __ptr_(__r.__ptr_),
+      __cntrl_(__r.__cntrl_)
+{
+    if (__cntrl_)
+        __cntrl_->__add_weak();
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
+                        typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
+         _NOEXCEPT
+    : __ptr_(__r.__ptr_),
+      __cntrl_(__r.__cntrl_)
+{
+    if (__cntrl_)
+        __cntrl_->__add_weak();
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
+    : __ptr_(__r.__ptr_),
+      __cntrl_(__r.__cntrl_)
+{
+    __r.__ptr_ = 0;
+    __r.__cntrl_ = 0;
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r,
+                        typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
+         _NOEXCEPT
+    : __ptr_(__r.__ptr_),
+      __cntrl_(__r.__cntrl_)
+{
+    __r.__ptr_ = 0;
+    __r.__cntrl_ = 0;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+weak_ptr<_Tp>::~weak_ptr()
+{
+    if (__cntrl_)
+        __cntrl_->__release_weak();
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp>&
+weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
+{
+    weak_ptr(__r).swap(*this);
+    return *this;
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_convertible<_Yp*, _Tp*>::value,
+    weak_ptr<_Tp>&
+>::type
+weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT
+{
+    weak_ptr(__r).swap(*this);
+    return *this;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp>&
+weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
+{
+    weak_ptr(_VSTD::move(__r)).swap(*this);
+    return *this;
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_convertible<_Yp*, _Tp*>::value,
+    weak_ptr<_Tp>&
+>::type
+weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT
+{
+    weak_ptr(_VSTD::move(__r)).swap(*this);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    is_convertible<_Yp*, _Tp*>::value,
+    weak_ptr<_Tp>&
+>::type
+weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT
+{
+    weak_ptr(__r).swap(*this);
+    return *this;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT
+{
+    _VSTD::swap(__ptr_, __r.__ptr_);
+    _VSTD::swap(__cntrl_, __r.__cntrl_);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT
+{
+    __x.swap(__y);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+weak_ptr<_Tp>::reset() _NOEXCEPT
+{
+    weak_ptr().swap(*this);
+}
+
+template<class _Tp>
+template<class _Yp>
+shared_ptr<_Tp>::shared_ptr(const weak_ptr<_Yp>& __r,
+                            typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
+    : __ptr_(__r.__ptr_),
+      __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_)
+{
+    if (__cntrl_ == 0)
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw bad_weak_ptr();
+#else
+        assert(!"bad_weak_ptr");
+#endif
+}
+
+template<class _Tp>
+shared_ptr<_Tp>
+weak_ptr<_Tp>::lock() const _NOEXCEPT
+{
+    shared_ptr<_Tp> __r;
+    __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_;
+    if (__r.__cntrl_)
+        __r.__ptr_ = __ptr_;
+    return __r;
+}
+
+template <class _Tp> struct owner_less;
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY owner_less<shared_ptr<_Tp> >
+    : binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool>
+{
+    typedef bool result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
+        {return __x.owner_before(__y);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(shared_ptr<_Tp> const& __x,   weak_ptr<_Tp> const& __y) const
+        {return __x.owner_before(__y);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(  weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
+        {return __x.owner_before(__y);}
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY owner_less<weak_ptr<_Tp> >
+    : binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool>
+{
+    typedef bool result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(  weak_ptr<_Tp> const& __x,   weak_ptr<_Tp> const& __y) const
+        {return __x.owner_before(__y);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(shared_ptr<_Tp> const& __x,   weak_ptr<_Tp> const& __y) const
+        {return __x.owner_before(__y);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(  weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
+        {return __x.owner_before(__y);}
+};
+
+template<class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this
+{
+    mutable weak_ptr<_Tp> __weak_this_;
+protected:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    enable_shared_from_this() _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY
+    enable_shared_from_this(enable_shared_from_this const&) _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY
+    enable_shared_from_this& operator=(enable_shared_from_this const&) _NOEXCEPT
+        {return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    ~enable_shared_from_this() {}
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    shared_ptr<_Tp> shared_from_this()
+        {return shared_ptr<_Tp>(__weak_this_);}
+    _LIBCPP_INLINE_VISIBILITY
+    shared_ptr<_Tp const> shared_from_this() const
+        {return shared_ptr<const _Tp>(__weak_this_);}
+
+    template <class _Up> friend class shared_ptr;
+};
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY hash<shared_ptr<_Tp> >
+{
+    typedef shared_ptr<_Tp>      argument_type;
+    typedef size_t               result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator()(const argument_type& __ptr) const _NOEXCEPT
+    {
+        return hash<_Tp*>()(__ptr.get());
+    }
+};
+
+template<class _CharT, class _Traits, class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
+
+// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
+// enabled with clang.
+#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+
+class _LIBCPP_TYPE_VIS __sp_mut
+{
+    void* __lx;
+public:
+    void lock() _NOEXCEPT;
+    void unlock() _NOEXCEPT;
+
+private:
+    _LIBCPP_CONSTEXPR __sp_mut(void*) _NOEXCEPT;
+    __sp_mut(const __sp_mut&);
+    __sp_mut& operator=(const __sp_mut&);
+
+    friend _LIBCPP_FUNC_VIS __sp_mut& __get_sp_mut(const void*);
+};
+
+_LIBCPP_FUNC_VIS __sp_mut& __get_sp_mut(const void*);
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_is_lock_free(const shared_ptr<_Tp>*)
+{
+    return false;
+}
+
+template <class _Tp>
+shared_ptr<_Tp>
+atomic_load(const shared_ptr<_Tp>* __p)
+{
+    __sp_mut& __m = __get_sp_mut(__p);
+    __m.lock();
+    shared_ptr<_Tp> __q = *__p;
+    __m.unlock();
+    return __q;
+}
+  
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order)
+{
+    return atomic_load(__p);
+}
+
+template <class _Tp>
+void
+atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
+{
+    __sp_mut& __m = __get_sp_mut(__p);
+    __m.lock();
+    __p->swap(__r);
+    __m.unlock();
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
+{
+    atomic_store(__p, __r);
+}
+
+template <class _Tp>
+shared_ptr<_Tp>
+atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
+{
+    __sp_mut& __m = __get_sp_mut(__p);
+    __m.lock();
+    __p->swap(__r);
+    __m.unlock();
+    return __r;
+}
+  
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
+{
+    return atomic_exchange(__p, __r);
+}
+
+template <class _Tp>
+bool
+atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
+{
+    __sp_mut& __m = __get_sp_mut(__p);
+    __m.lock();
+    if (__p->__owner_equivalent(*__v))
+    {
+        *__p = __w;
+        __m.unlock();
+        return true;
+    }
+    *__v = *__p;
+    __m.unlock();
+    return false;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
+{
+    return atomic_compare_exchange_strong(__p, __v, __w);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
+                                        shared_ptr<_Tp> __w, memory_order, memory_order)
+{
+    return atomic_compare_exchange_strong(__p, __v, __w);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
+                                      shared_ptr<_Tp> __w, memory_order, memory_order)
+{
+    return atomic_compare_exchange_weak(__p, __v, __w);
+}
+
+#endif  // defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+
+//enum class
+struct _LIBCPP_TYPE_VIS pointer_safety
+{
+    enum __lx
+    {
+        relaxed,
+        preferred,
+        strict
+    };
+
+    __lx __v_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    pointer_safety(__lx __v) : __v_(__v) {}
+    _LIBCPP_INLINE_VISIBILITY
+    operator int() const {return __v_;}
+};
+
+_LIBCPP_FUNC_VIS void declare_reachable(void* __p);
+_LIBCPP_FUNC_VIS void declare_no_pointers(char* __p, size_t __n);
+_LIBCPP_FUNC_VIS void undeclare_no_pointers(char* __p, size_t __n);
+_LIBCPP_FUNC_VIS pointer_safety get_pointer_safety() _NOEXCEPT;
+_LIBCPP_FUNC_VIS void* __undeclare_reachable(void* __p);
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+undeclare_reachable(_Tp* __p)
+{
+    return static_cast<_Tp*>(__undeclare_reachable(__p));
+}
+
+_LIBCPP_FUNC_VIS void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);
+
+// --- Helper for container swap --
+template <typename _Alloc>
+_LIBCPP_INLINE_VISIBILITY
+void __swap_allocator(_Alloc & __a1, _Alloc & __a2)
+#if _LIBCPP_STD_VER >= 14
+    _NOEXCEPT
+#else
+    _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)
+#endif
+{
+    __swap_allocator(__a1, __a2, 
+      integral_constant<bool, _VSTD::allocator_traits<_Alloc>::propagate_on_container_swap::value>());
+}
+
+template <typename _Alloc>
+_LIBCPP_INLINE_VISIBILITY
+void __swap_allocator(_Alloc & __a1, _Alloc & __a2, true_type)
+#if _LIBCPP_STD_VER >= 14
+    _NOEXCEPT
+#else
+    _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)
+#endif
+{
+    using _VSTD::swap;
+    swap(__a1, __a2);
+}
+
+template <typename _Alloc>
+_LIBCPP_INLINE_VISIBILITY
+void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {}
+
+template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> >
+struct __noexcept_move_assign_container : public integral_constant<bool, 
+    _Traits::propagate_on_container_move_assignment::value
+#if _LIBCPP_STD_VER > 14
+        || _Traits::is_always_equal::value
+#else
+        && is_nothrow_move_assignable<_Alloc>::value
+#endif
+    > {};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_MEMORY

Property changes on: lab4/.minix-src/include/c++/memory
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/numeric
===================================================================
--- lab4/.minix-src/include/c++/numeric	(nonexistent)
+++ lab4/.minix-src/include/c++/numeric	(revision 13)
@@ -0,0 +1,197 @@
+// -*- C++ -*-
+//===---------------------------- numeric ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_NUMERIC
+#define _LIBCPP_NUMERIC
+
+/*
+    numeric synopsis
+
+namespace std
+{
+
+template <class InputIterator, class T>
+    T
+    accumulate(InputIterator first, InputIterator last, T init);
+
+template <class InputIterator, class T, class BinaryOperation>
+    T
+    accumulate(InputIterator first, InputIterator last, T init, BinaryOperation binary_op);
+
+template <class InputIterator1, class InputIterator2, class T>
+    T
+    inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init);
+
+template <class InputIterator1, class InputIterator2, class T, class BinaryOperation1, class BinaryOperation2>
+    T
+    inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
+                  T init, BinaryOperation1 binary_op1, BinaryOperation2 binary_op2);
+
+template <class InputIterator, class OutputIterator>
+    OutputIterator
+    partial_sum(InputIterator first, InputIterator last, OutputIterator result);
+
+template <class InputIterator, class OutputIterator, class BinaryOperation>
+    OutputIterator
+    partial_sum(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op);
+
+template <class InputIterator, class OutputIterator>
+    OutputIterator
+    adjacent_difference(InputIterator first, InputIterator last, OutputIterator result);
+
+template <class InputIterator, class OutputIterator, class BinaryOperation>
+    OutputIterator
+    adjacent_difference(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op);
+
+template <class ForwardIterator, class T>
+    void iota(ForwardIterator first, ForwardIterator last, T value);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <iterator>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _InputIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
+{
+    for (; __first != __last; ++__first)
+        __init = __init + *__first;
+    return __init;
+}
+
+template <class _InputIterator, class _Tp, class _BinaryOperation>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op)
+{
+    for (; __first != __last; ++__first)
+        __init = __binary_op(__init, *__first);
+    return __init;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init)
+{
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
+        __init = __init + *__first1 * *__first2;
+    return __init;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
+              _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2)
+{
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
+        __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
+    return __init;
+}
+
+template <class _InputIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
+{
+    if (__first != __last)
+    {
+        typename iterator_traits<_InputIterator>::value_type __t(*__first);
+        *__result = __t;
+        for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
+        {
+            __t = __t + *__first;
+            *__result = __t;
+        }
+    }
+    return __result;
+}
+
+template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
+              _BinaryOperation __binary_op)
+{
+    if (__first != __last)
+    {
+        typename iterator_traits<_InputIterator>::value_type __t(*__first);
+        *__result = __t;
+        for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
+        {
+            __t = __binary_op(__t, *__first);
+            *__result = __t;
+        }
+    }
+    return __result;
+}
+
+template <class _InputIterator, class _OutputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
+{
+    if (__first != __last)
+    {
+        typename iterator_traits<_InputIterator>::value_type __t1(*__first);
+        *__result = __t1;
+        for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
+        {
+            typename iterator_traits<_InputIterator>::value_type __t2(*__first);
+            *__result = __t2 - __t1;
+            __t1 = _VSTD::move(__t2);
+        }
+    }
+    return __result;
+}
+
+template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
+                      _BinaryOperation __binary_op)
+{
+    if (__first != __last)
+    {
+        typename iterator_traits<_InputIterator>::value_type __t1(*__first);
+        *__result = __t1;
+        for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
+        {
+            typename iterator_traits<_InputIterator>::value_type __t2(*__first);
+            *__result = __binary_op(__t2, __t1);
+            __t1 = _VSTD::move(__t2);
+        }
+    }
+    return __result;
+}
+
+template <class _ForwardIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
+{
+    for (; __first != __last; ++__first, (void) ++__value_)
+        *__first = __value_;
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_NUMERIC

Property changes on: lab4/.minix-src/include/c++/numeric
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/random
===================================================================
--- lab4/.minix-src/include/c++/random	(nonexistent)
+++ lab4/.minix-src/include/c++/random	(revision 13)
@@ -0,0 +1,6723 @@
+// -*- C++ -*-
+//===--------------------------- random -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_RANDOM
+#define _LIBCPP_RANDOM
+
+/*
+    random synopsis
+
+#include <initializer_list>
+
+namespace std
+{
+
+// Engines
+
+template <class UIntType, UIntType a, UIntType c, UIntType m>
+class linear_congruential_engine
+{
+public:
+    // types
+    typedef UIntType result_type;
+
+    // engine characteristics
+    static constexpr result_type multiplier = a;
+    static constexpr result_type increment = c;
+    static constexpr result_type modulus = m;
+    static constexpr result_type min() { return c == 0u ? 1u: 0u;}
+    static constexpr result_type max() { return m - 1u;}
+    static constexpr result_type default_seed = 1u;
+
+    // constructors and seeding functions
+    explicit linear_congruential_engine(result_type s = default_seed);
+    template<class Sseq> explicit linear_congruential_engine(Sseq& q);
+    void seed(result_type s = default_seed);
+    template<class Sseq> void seed(Sseq& q);
+
+    // generating functions
+    result_type operator()();
+    void discard(unsigned long long z);
+};
+
+template <class UIntType, UIntType a, UIntType c, UIntType m>
+bool
+operator==(const linear_congruential_engine<UIntType, a, c, m>& x,
+           const linear_congruential_engine<UIntType, a, c, m>& y);
+
+template <class UIntType, UIntType a, UIntType c, UIntType m>
+bool
+operator!=(const linear_congruential_engine<UIntType, a, c, m>& x,
+           const linear_congruential_engine<UIntType, a, c, m>& y);
+
+template <class charT, class traits,
+          class UIntType, UIntType a, UIntType c, UIntType m>
+basic_ostream<charT, traits>&
+operator<<(basic_ostream<charT, traits>& os,
+           const linear_congruential_engine<UIntType, a, c, m>& x);
+
+template <class charT, class traits,
+          class UIntType, UIntType a, UIntType c, UIntType m>
+basic_istream<charT, traits>&
+operator>>(basic_istream<charT, traits>& is,
+           linear_congruential_engine<UIntType, a, c, m>& x);
+
+template <class UIntType, size_t w, size_t n, size_t m, size_t r,
+          UIntType a, size_t u, UIntType d, size_t s,
+          UIntType b, size_t t, UIntType c, size_t l, UIntType f>
+class mersenne_twister_engine
+{
+public:
+    // types
+    typedef UIntType result_type;
+
+    // engine characteristics
+    static constexpr size_t word_size = w;
+    static constexpr size_t state_size = n;
+    static constexpr size_t shift_size = m;
+    static constexpr size_t mask_bits = r;
+    static constexpr result_type xor_mask = a;
+    static constexpr size_t tempering_u = u;
+    static constexpr result_type tempering_d = d;
+    static constexpr size_t tempering_s = s;
+    static constexpr result_type tempering_b = b;
+    static constexpr size_t tempering_t = t;
+    static constexpr result_type tempering_c = c;
+    static constexpr size_t tempering_l = l;
+    static constexpr result_type initialization_multiplier = f;
+    static constexpr result_type min () { return 0; }
+    static constexpr result_type max() { return 2^w - 1; }
+    static constexpr result_type default_seed = 5489u;
+
+    // constructors and seeding functions
+    explicit mersenne_twister_engine(result_type value = default_seed);
+    template<class Sseq> explicit mersenne_twister_engine(Sseq& q);
+    void seed(result_type value = default_seed);
+    template<class Sseq> void seed(Sseq& q);
+
+    // generating functions
+    result_type operator()();
+    void discard(unsigned long long z);
+};
+
+template <class UIntType, size_t w, size_t n, size_t m, size_t r,
+          UIntType a, size_t u, UIntType d, size_t s,
+          UIntType b, size_t t, UIntType c, size_t l, UIntType f>
+bool
+operator==(
+    const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x,
+    const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& y);
+
+template <class UIntType, size_t w, size_t n, size_t m, size_t r,
+          UIntType a, size_t u, UIntType d, size_t s,
+          UIntType b, size_t t, UIntType c, size_t l, UIntType f>
+bool
+operator!=(
+    const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x,
+    const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& y);
+
+template <class charT, class traits,
+          class UIntType, size_t w, size_t n, size_t m, size_t r,
+          UIntType a, size_t u, UIntType d, size_t s,
+          UIntType b, size_t t, UIntType c, size_t l, UIntType f>
+basic_ostream<charT, traits>&
+operator<<(basic_ostream<charT, traits>& os,
+           const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x);
+
+template <class charT, class traits,
+          class UIntType, size_t w, size_t n, size_t m, size_t r,
+          UIntType a, size_t u, UIntType d, size_t s,
+          UIntType b, size_t t, UIntType c, size_t l, UIntType f>
+basic_istream<charT, traits>&
+operator>>(basic_istream<charT, traits>& is,
+           mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x);
+
+template<class UIntType, size_t w, size_t s, size_t r>
+class subtract_with_carry_engine
+{
+public:
+    // types
+    typedef UIntType result_type;
+
+    // engine characteristics
+    static constexpr size_t word_size = w;
+    static constexpr size_t short_lag = s;
+    static constexpr size_t long_lag = r;
+    static constexpr result_type min() { return 0; }
+    static constexpr result_type max() { return m-1; }
+    static constexpr result_type default_seed = 19780503u;
+
+    // constructors and seeding functions
+    explicit subtract_with_carry_engine(result_type value = default_seed);
+    template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
+    void seed(result_type value = default_seed);
+    template<class Sseq> void seed(Sseq& q);
+
+    // generating functions
+    result_type operator()();
+    void discard(unsigned long long z);
+};
+
+template<class UIntType, size_t w, size_t s, size_t r>
+bool
+operator==(
+    const subtract_with_carry_engine<UIntType, w, s, r>& x,
+    const subtract_with_carry_engine<UIntType, w, s, r>& y);
+
+template<class UIntType, size_t w, size_t s, size_t r>
+bool
+operator!=(
+    const subtract_with_carry_engine<UIntType, w, s, r>& x,
+    const subtract_with_carry_engine<UIntType, w, s, r>& y);
+
+template <class charT, class traits,
+          class UIntType, size_t w, size_t s, size_t r>
+basic_ostream<charT, traits>&
+operator<<(basic_ostream<charT, traits>& os,
+           const subtract_with_carry_engine<UIntType, w, s, r>& x);
+
+template <class charT, class traits,
+          class UIntType, size_t w, size_t s, size_t r>
+basic_istream<charT, traits>&
+operator>>(basic_istream<charT, traits>& is,
+           subtract_with_carry_engine<UIntType, w, s, r>& x);
+
+template<class Engine, size_t p, size_t r>
+class discard_block_engine
+{
+public:
+    // types
+    typedef typename Engine::result_type result_type;
+
+    // engine characteristics
+    static constexpr size_t block_size = p;
+    static constexpr size_t used_block = r;
+    static constexpr result_type min() { return Engine::min(); }
+    static constexpr result_type max() { return Engine::max(); }
+
+    // constructors and seeding functions
+    discard_block_engine();
+    explicit discard_block_engine(const Engine& e);
+    explicit discard_block_engine(Engine&& e);
+    explicit discard_block_engine(result_type s);
+    template<class Sseq> explicit discard_block_engine(Sseq& q);
+    void seed();
+    void seed(result_type s);
+    template<class Sseq> void seed(Sseq& q);
+
+    // generating functions
+    result_type operator()();
+    void discard(unsigned long long z);
+
+    // property functions
+    const Engine& base() const noexcept;
+};
+
+template<class Engine, size_t p, size_t r>
+bool
+operator==(
+    const discard_block_engine<Engine, p, r>& x,
+    const discard_block_engine<Engine, p, r>& y);
+
+template<class Engine, size_t p, size_t r>
+bool
+operator!=(
+    const discard_block_engine<Engine, p, r>& x,
+    const discard_block_engine<Engine, p, r>& y);
+
+template <class charT, class traits,
+          class Engine, size_t p, size_t r>
+basic_ostream<charT, traits>&
+operator<<(basic_ostream<charT, traits>& os,
+           const discard_block_engine<Engine, p, r>& x);
+
+template <class charT, class traits,
+          class Engine, size_t p, size_t r>
+basic_istream<charT, traits>&
+operator>>(basic_istream<charT, traits>& is,
+           discard_block_engine<Engine, p, r>& x);
+
+template<class Engine, size_t w, class UIntType>
+class independent_bits_engine
+{
+public:
+    // types
+    typedef UIntType result_type;
+
+    // engine characteristics
+    static constexpr result_type min() { return 0; }
+    static constexpr result_type max() { return 2^w - 1; }
+
+    // constructors and seeding functions
+    independent_bits_engine();
+    explicit independent_bits_engine(const Engine& e);
+    explicit independent_bits_engine(Engine&& e);
+    explicit independent_bits_engine(result_type s);
+    template<class Sseq> explicit independent_bits_engine(Sseq& q);
+    void seed();
+    void seed(result_type s);
+    template<class Sseq> void seed(Sseq& q);
+
+    // generating functions
+    result_type operator()(); void discard(unsigned long long z);
+
+    // property functions
+    const Engine& base() const noexcept;
+};
+
+template<class Engine, size_t w, class UIntType>
+bool
+operator==(
+    const independent_bits_engine<Engine, w, UIntType>& x,
+    const independent_bits_engine<Engine, w, UIntType>& y);
+
+template<class Engine, size_t w, class UIntType>
+bool
+operator!=(
+    const independent_bits_engine<Engine, w, UIntType>& x,
+    const independent_bits_engine<Engine, w, UIntType>& y);
+
+template <class charT, class traits,
+          class Engine, size_t w, class UIntType>
+basic_ostream<charT, traits>&
+operator<<(basic_ostream<charT, traits>& os,
+           const independent_bits_engine<Engine, w, UIntType>& x);
+
+template <class charT, class traits,
+          class Engine, size_t w, class UIntType>
+basic_istream<charT, traits>&
+operator>>(basic_istream<charT, traits>& is,
+           independent_bits_engine<Engine, w, UIntType>& x);
+
+template<class Engine, size_t k>
+class shuffle_order_engine
+{
+public:
+    // types
+    typedef typename Engine::result_type result_type;
+
+    // engine characteristics
+    static constexpr size_t table_size = k;
+    static constexpr result_type min() { return Engine::min; }
+    static constexpr result_type max() { return Engine::max; }
+
+    // constructors and seeding functions
+    shuffle_order_engine();
+    explicit shuffle_order_engine(const Engine& e);
+    explicit shuffle_order_engine(Engine&& e);
+    explicit shuffle_order_engine(result_type s);
+    template<class Sseq> explicit shuffle_order_engine(Sseq& q);
+    void seed();
+    void seed(result_type s);
+    template<class Sseq> void seed(Sseq& q);
+
+    // generating functions
+    result_type operator()();
+    void discard(unsigned long long z);
+
+    // property functions
+    const Engine& base() const noexcept;
+};
+
+template<class Engine, size_t k>
+bool
+operator==(
+    const shuffle_order_engine<Engine, k>& x,
+    const shuffle_order_engine<Engine, k>& y);
+
+template<class Engine, size_t k>
+bool
+operator!=(
+    const shuffle_order_engine<Engine, k>& x,
+    const shuffle_order_engine<Engine, k>& y);
+
+template <class charT, class traits,
+          class Engine, size_t k>
+basic_ostream<charT, traits>&
+operator<<(basic_ostream<charT, traits>& os,
+           const shuffle_order_engine<Engine, k>& x);
+
+template <class charT, class traits,
+          class Engine, size_t k>
+basic_istream<charT, traits>&
+operator>>(basic_istream<charT, traits>& is,
+           shuffle_order_engine<Engine, k>& x);
+
+typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647>
+                                                                   minstd_rand0;
+typedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647>
+                                                                    minstd_rand;
+typedef mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31,
+                                0x9908b0df,
+                                11, 0xffffffff,
+                                7,  0x9d2c5680,
+                                15, 0xefc60000,
+                                18, 1812433253>                         mt19937;
+typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31,
+                                0xb5026f5aa96619e9,
+                                29, 0x5555555555555555,
+                                17, 0x71d67fffeda60000,
+                                37, 0xfff7eee000000000,
+                                43, 6364136223846793005>             mt19937_64;
+typedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24>     ranlux24_base;
+typedef subtract_with_carry_engine<uint_fast64_t, 48,  5, 12>     ranlux48_base;
+typedef discard_block_engine<ranlux24_base, 223, 23>                   ranlux24;
+typedef discard_block_engine<ranlux48_base, 389, 11>                   ranlux48;
+typedef shuffle_order_engine<minstd_rand0, 256>                         knuth_b;
+typedef minstd_rand                                       default_random_engine;
+
+// Generators
+
+class random_device
+{
+public:
+    // types
+    typedef unsigned int result_type;
+
+    // generator characteristics
+    static constexpr result_type min() { return numeric_limits<result_type>::min(); }
+    static constexpr result_type max() { return numeric_limits<result_type>::max(); }
+
+    // constructors
+    explicit random_device(const string& token = "/dev/urandom");
+
+    // generating functions
+    result_type operator()();
+
+    // property functions
+    double entropy() const noexcept;
+
+    // no copy functions
+    random_device(const random_device& ) = delete;
+    void operator=(const random_device& ) = delete;
+};
+
+// Utilities
+
+class seed_seq
+{
+public:
+    // types
+    typedef uint_least32_t result_type;
+
+    // constructors
+    seed_seq();
+    template<class T>
+        seed_seq(initializer_list<T> il);
+    template<class InputIterator>
+        seed_seq(InputIterator begin, InputIterator end);
+
+    // generating functions
+    template<class RandomAccessIterator>
+        void generate(RandomAccessIterator begin, RandomAccessIterator end);
+
+    // property functions
+    size_t size() const;
+    template<class OutputIterator>
+        void param(OutputIterator dest) const;
+
+    // no copy functions
+    seed_seq(const seed_seq&) = delete;
+    void operator=(const seed_seq& ) = delete;
+};
+
+template<class RealType, size_t bits, class URNG>
+    RealType generate_canonical(URNG& g);
+
+// Distributions
+
+template<class IntType = int>
+class uniform_int_distribution
+{
+public:
+    // types
+    typedef IntType result_type;
+
+    class param_type
+    {
+    public:
+        typedef uniform_int_distribution distribution_type;
+
+        explicit param_type(IntType a = 0,
+                                    IntType b = numeric_limits<IntType>::max());
+
+        result_type a() const;
+        result_type b() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructors and reset functions
+    explicit uniform_int_distribution(IntType a = 0,
+                                    IntType b = numeric_limits<IntType>::max());
+    explicit uniform_int_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type a() const;
+    result_type b() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const uniform_int_distribution& x,
+                           const uniform_int_distribution& y);
+    friend bool operator!=(const uniform_int_distribution& x,
+                           const uniform_int_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const uniform_int_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               uniform_int_distribution& x);
+};
+
+template<class RealType = double>
+class uniform_real_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef uniform_real_distribution distribution_type;
+
+        explicit param_type(RealType a = 0,
+                            RealType b = 1);
+
+        result_type a() const;
+        result_type b() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructors and reset functions
+    explicit uniform_real_distribution(RealType a = 0.0, RealType b = 1.0);
+    explicit uniform_real_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type a() const;
+    result_type b() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const uniform_real_distribution& x,
+                           const uniform_real_distribution& y);
+    friend bool operator!=(const uniform_real_distribution& x,
+                           const uniform_real_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const uniform_real_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               uniform_real_distribution& x);
+};
+
+class bernoulli_distribution
+{
+public:
+    // types
+    typedef bool result_type;
+
+    class param_type
+    {
+    public:
+        typedef bernoulli_distribution distribution_type;
+
+        explicit param_type(double p = 0.5);
+
+        double p() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructors and reset functions
+    explicit bernoulli_distribution(double p = 0.5);
+    explicit bernoulli_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    double p() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const bernoulli_distribution& x,
+                           const bernoulli_distribution& y);
+    friend bool operator!=(const bernoulli_distribution& x,
+                           const bernoulli_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const bernoulli_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               bernoulli_distribution& x);
+};
+
+template<class IntType = int>
+class binomial_distribution
+{
+public:
+    // types
+    typedef IntType result_type;
+
+    class param_type
+    {
+    public:
+        typedef binomial_distribution distribution_type;
+
+        explicit param_type(IntType t = 1, double p = 0.5);
+
+        IntType t() const;
+        double p() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructors and reset functions
+    explicit binomial_distribution(IntType t = 1, double p = 0.5);
+    explicit binomial_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    IntType t() const;
+    double p() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const binomial_distribution& x,
+                           const binomial_distribution& y);
+    friend bool operator!=(const binomial_distribution& x,
+                           const binomial_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const binomial_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               binomial_distribution& x);
+};
+
+template<class IntType = int>
+class geometric_distribution
+{
+public:
+    // types
+    typedef IntType result_type;
+
+    class param_type
+    {
+    public:
+        typedef geometric_distribution distribution_type;
+
+        explicit param_type(double p = 0.5);
+
+        double p() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructors and reset functions
+    explicit geometric_distribution(double p = 0.5);
+    explicit geometric_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    double p() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const geometric_distribution& x,
+                           const geometric_distribution& y);
+    friend bool operator!=(const geometric_distribution& x,
+                           const geometric_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const geometric_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               geometric_distribution& x);
+};
+
+template<class IntType = int>
+class negative_binomial_distribution
+{
+public:
+    // types
+    typedef IntType result_type;
+
+    class param_type
+    {
+    public:
+        typedef negative_binomial_distribution distribution_type;
+
+        explicit param_type(result_type k = 1, double p = 0.5);
+
+        result_type k() const;
+        double p() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    explicit negative_binomial_distribution(result_type k = 1, double p = 0.5);
+    explicit negative_binomial_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type k() const;
+    double p() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const negative_binomial_distribution& x,
+                           const negative_binomial_distribution& y);
+    friend bool operator!=(const negative_binomial_distribution& x,
+                           const negative_binomial_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const negative_binomial_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               negative_binomial_distribution& x);
+};
+
+template<class IntType = int>
+class poisson_distribution
+{
+public:
+    // types
+    typedef IntType result_type;
+
+    class param_type
+    {
+    public:
+        typedef poisson_distribution distribution_type;
+
+        explicit param_type(double mean = 1.0);
+
+        double mean() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructors and reset functions
+    explicit poisson_distribution(double mean = 1.0);
+    explicit poisson_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    double mean() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const poisson_distribution& x,
+                           const poisson_distribution& y);
+    friend bool operator!=(const poisson_distribution& x,
+                           const poisson_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const poisson_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               poisson_distribution& x);
+};
+
+template<class RealType = double>
+class exponential_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef exponential_distribution distribution_type;
+
+        explicit param_type(result_type lambda = 1.0);
+
+        result_type lambda() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructors and reset functions
+    explicit exponential_distribution(result_type lambda = 1.0);
+    explicit exponential_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type lambda() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const exponential_distribution& x,
+                           const exponential_distribution& y);
+    friend bool operator!=(const exponential_distribution& x,
+                           const exponential_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const exponential_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               exponential_distribution& x);
+};
+
+template<class RealType = double>
+class gamma_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef gamma_distribution distribution_type;
+
+        explicit param_type(result_type alpha = 1, result_type beta = 1);
+
+        result_type alpha() const;
+        result_type beta() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructors and reset functions
+    explicit gamma_distribution(result_type alpha = 1, result_type beta = 1);
+    explicit gamma_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type alpha() const;
+    result_type beta() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const gamma_distribution& x,
+                           const gamma_distribution& y);
+    friend bool operator!=(const gamma_distribution& x,
+                           const gamma_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const gamma_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               gamma_distribution& x);
+};
+
+template<class RealType = double>
+class weibull_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef weibull_distribution distribution_type;
+
+        explicit param_type(result_type alpha = 1, result_type beta = 1);
+
+        result_type a() const;
+        result_type b() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    explicit weibull_distribution(result_type a = 1, result_type b = 1);
+    explicit weibull_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type a() const;
+    result_type b() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const weibull_distribution& x,
+                           const weibull_distribution& y);
+    friend bool operator!=(const weibull_distribution& x,
+                           const weibull_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const weibull_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               weibull_distribution& x);
+};
+
+template<class RealType = double>
+class extreme_value_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef extreme_value_distribution distribution_type;
+
+        explicit param_type(result_type a = 0, result_type b = 1);
+
+        result_type a() const;
+        result_type b() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    explicit extreme_value_distribution(result_type a = 0, result_type b = 1);
+    explicit extreme_value_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type a() const;
+    result_type b() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const extreme_value_distribution& x,
+                           const extreme_value_distribution& y);
+    friend bool operator!=(const extreme_value_distribution& x,
+                           const extreme_value_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const extreme_value_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               extreme_value_distribution& x);
+};
+
+template<class RealType = double>
+class normal_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef normal_distribution distribution_type;
+
+        explicit param_type(result_type mean = 0, result_type stddev = 1);
+
+        result_type mean() const;
+        result_type stddev() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructors and reset functions
+    explicit normal_distribution(result_type mean = 0, result_type stddev = 1);
+    explicit normal_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type mean() const;
+    result_type stddev() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const normal_distribution& x,
+                           const normal_distribution& y);
+    friend bool operator!=(const normal_distribution& x,
+                           const normal_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const normal_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               normal_distribution& x);
+};
+
+template<class RealType = double>
+class lognormal_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef lognormal_distribution distribution_type;
+
+        explicit param_type(result_type m = 0, result_type s = 1);
+
+        result_type m() const;
+        result_type s() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    explicit lognormal_distribution(result_type m = 0, result_type s = 1);
+    explicit lognormal_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type m() const;
+    result_type s() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const lognormal_distribution& x,
+                           const lognormal_distribution& y);
+    friend bool operator!=(const lognormal_distribution& x,
+                           const lognormal_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const lognormal_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               lognormal_distribution& x);
+};
+
+template<class RealType = double>
+class chi_squared_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef chi_squared_distribution distribution_type;
+
+        explicit param_type(result_type n = 1);
+
+        result_type n() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    explicit chi_squared_distribution(result_type n = 1);
+    explicit chi_squared_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type n() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const chi_squared_distribution& x,
+                           const chi_squared_distribution& y);
+    friend bool operator!=(const chi_squared_distribution& x,
+                           const chi_squared_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const chi_squared_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               chi_squared_distribution& x);
+};
+
+template<class RealType = double>
+class cauchy_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef cauchy_distribution distribution_type;
+
+        explicit param_type(result_type a = 0, result_type b = 1);
+
+        result_type a() const;
+        result_type b() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    explicit cauchy_distribution(result_type a = 0, result_type b = 1);
+    explicit cauchy_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type a() const;
+    result_type b() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const cauchy_distribution& x,
+                           const cauchy_distribution& y);
+    friend bool operator!=(const cauchy_distribution& x,
+                           const cauchy_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const cauchy_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               cauchy_distribution& x);
+};
+
+template<class RealType = double>
+class fisher_f_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef fisher_f_distribution distribution_type;
+
+        explicit param_type(result_type m = 1, result_type n = 1);
+
+        result_type m() const;
+        result_type n() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    explicit fisher_f_distribution(result_type m = 1, result_type n = 1);
+    explicit fisher_f_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type m() const;
+    result_type n() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const fisher_f_distribution& x,
+                           const fisher_f_distribution& y);
+    friend bool operator!=(const fisher_f_distribution& x,
+                           const fisher_f_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const fisher_f_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               fisher_f_distribution& x);
+};
+
+template<class RealType = double>
+class student_t_distribution
+{
+public:
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef student_t_distribution distribution_type;
+
+        explicit param_type(result_type n = 1);
+
+        result_type n() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    explicit student_t_distribution(result_type n = 1);
+    explicit student_t_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    result_type n() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const student_t_distribution& x,
+                           const student_t_distribution& y);
+    friend bool operator!=(const student_t_distribution& x,
+                           const student_t_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const student_t_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               student_t_distribution& x);
+};
+
+template<class IntType = int>
+class discrete_distribution
+{
+public:
+    // types
+    typedef IntType result_type;
+
+    class param_type
+    {
+    public:
+        typedef discrete_distribution distribution_type;
+
+        param_type();
+        template<class InputIterator>
+            param_type(InputIterator firstW, InputIterator lastW);
+        param_type(initializer_list<double> wl);
+        template<class UnaryOperation>
+            param_type(size_t nw, double xmin, double xmax, UnaryOperation fw);
+
+        vector<double> probabilities() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    discrete_distribution();
+    template<class InputIterator>
+        discrete_distribution(InputIterator firstW, InputIterator lastW);
+    discrete_distribution(initializer_list<double> wl);
+    template<class UnaryOperation>
+        discrete_distribution(size_t nw, double xmin, double xmax,
+                              UnaryOperation fw);
+    explicit discrete_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    vector<double> probabilities() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const discrete_distribution& x,
+                           const discrete_distribution& y);
+    friend bool operator!=(const discrete_distribution& x,
+                           const discrete_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const discrete_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               discrete_distribution& x);
+};
+
+template<class RealType = double>
+class piecewise_constant_distribution
+{
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef piecewise_constant_distribution distribution_type;
+
+        param_type();
+        template<class InputIteratorB, class InputIteratorW>
+            param_type(InputIteratorB firstB, InputIteratorB lastB,
+                       InputIteratorW firstW);
+        template<class UnaryOperation>
+            param_type(initializer_list<result_type> bl, UnaryOperation fw);
+        template<class UnaryOperation>
+            param_type(size_t nw, result_type xmin, result_type xmax,
+                       UnaryOperation fw);
+
+        vector<result_type> intervals() const;
+        vector<result_type> densities() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    piecewise_constant_distribution();
+    template<class InputIteratorB, class InputIteratorW>
+        piecewise_constant_distribution(InputIteratorB firstB,
+                                        InputIteratorB lastB,
+                                        InputIteratorW firstW);
+    template<class UnaryOperation>
+        piecewise_constant_distribution(initializer_list<result_type> bl,
+                                        UnaryOperation fw);
+    template<class UnaryOperation>
+        piecewise_constant_distribution(size_t nw, result_type xmin,
+                                        result_type xmax, UnaryOperation fw);
+    explicit piecewise_constant_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    vector<result_type> intervals() const;
+    vector<result_type> densities() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const piecewise_constant_distribution& x,
+                           const piecewise_constant_distribution& y);
+    friend bool operator!=(const piecewise_constant_distribution& x,
+                           const piecewise_constant_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const piecewise_constant_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               piecewise_constant_distribution& x);
+};
+
+template<class RealType = double>
+class piecewise_linear_distribution
+{
+    // types
+    typedef RealType result_type;
+
+    class param_type
+    {
+    public:
+        typedef piecewise_linear_distribution distribution_type;
+
+        param_type();
+        template<class InputIteratorB, class InputIteratorW>
+            param_type(InputIteratorB firstB, InputIteratorB lastB,
+                       InputIteratorW firstW);
+        template<class UnaryOperation>
+            param_type(initializer_list<result_type> bl, UnaryOperation fw);
+        template<class UnaryOperation>
+            param_type(size_t nw, result_type xmin, result_type xmax,
+                       UnaryOperation fw);
+
+        vector<result_type> intervals() const;
+        vector<result_type> densities() const;
+
+        friend bool operator==(const param_type& x, const param_type& y);
+        friend bool operator!=(const param_type& x, const param_type& y);
+    };
+
+    // constructor and reset functions
+    piecewise_linear_distribution();
+    template<class InputIteratorB, class InputIteratorW>
+        piecewise_linear_distribution(InputIteratorB firstB,
+                                      InputIteratorB lastB,
+                                      InputIteratorW firstW);
+
+    template<class UnaryOperation>
+        piecewise_linear_distribution(initializer_list<result_type> bl,
+                                      UnaryOperation fw);
+
+    template<class UnaryOperation>
+        piecewise_linear_distribution(size_t nw, result_type xmin,
+                                      result_type xmax, UnaryOperation fw);
+
+    explicit piecewise_linear_distribution(const param_type& parm);
+    void reset();
+
+    // generating functions
+    template<class URNG> result_type operator()(URNG& g);
+    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
+
+    // property functions
+    vector<result_type> intervals() const;
+    vector<result_type> densities() const;
+
+    param_type param() const;
+    void param(const param_type& parm);
+
+    result_type min() const;
+    result_type max() const;
+
+    friend bool operator==(const piecewise_linear_distribution& x,
+                           const piecewise_linear_distribution& y);
+    friend bool operator!=(const piecewise_linear_distribution& x,
+                           const piecewise_linear_distribution& y);
+
+    template <class charT, class traits>
+    friend
+    basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os,
+               const piecewise_linear_distribution& x);
+
+    template <class charT, class traits>
+    friend
+    basic_istream<charT, traits>&
+    operator>>(basic_istream<charT, traits>& is,
+               piecewise_linear_distribution& x);
+};
+
+} // std
+*/
+
+#include <__config>
+#include <cstddef>
+#include <cstdint>
+#include <cmath>
+#include <type_traits>
+#include <initializer_list>
+#include <limits>
+#include <algorithm>
+#include <numeric>
+#include <vector>
+#include <string>
+#include <istream>
+#include <ostream>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// __is_seed_sequence
+
+template <class _Sseq, class _Engine>
+struct __is_seed_sequence
+{
+    static _LIBCPP_CONSTEXPR const bool value =
+              !is_convertible<_Sseq, typename _Engine::result_type>::value &&
+              !is_same<typename remove_cv<_Sseq>::type, _Engine>::value;
+};
+
+// linear_congruential_engine
+
+template <unsigned long long __a, unsigned long long __c,
+          unsigned long long __m, unsigned long long _Mp,
+          bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_Mp-__c)/__a)>
+struct __lce_ta;
+
+// 64
+
+template <unsigned long long __a, unsigned long long __c, unsigned long long __m>
+struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), true>
+{
+    typedef unsigned long long result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    static result_type next(result_type __x)
+    {
+        // Schrage's algorithm
+        const result_type __q = __m / __a;
+        const result_type __r = __m % __a;
+        const result_type __t0 = __a * (__x % __q);
+        const result_type __t1 = __r * (__x / __q);
+        __x = __t0 + (__t0 < __t1) * __m - __t1;
+        __x += __c - (__x >= __m - __c) * __m;
+        return __x;
+    }
+};
+
+template <unsigned long long __a, unsigned long long __m>
+struct __lce_ta<__a, 0, __m, (unsigned long long)(~0), true>
+{
+    typedef unsigned long long result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    static result_type next(result_type __x)
+    {
+        // Schrage's algorithm
+        const result_type __q = __m / __a;
+        const result_type __r = __m % __a;
+        const result_type __t0 = __a * (__x % __q);
+        const result_type __t1 = __r * (__x / __q);
+        __x = __t0 + (__t0 < __t1) * __m - __t1;
+        return __x;
+    }
+};
+
+template <unsigned long long __a, unsigned long long __c, unsigned long long __m>
+struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), false>
+{
+    typedef unsigned long long result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    static result_type next(result_type __x)
+    {
+        return (__a * __x + __c) % __m;
+    }
+};
+
+template <unsigned long long __a, unsigned long long __c>
+struct __lce_ta<__a, __c, 0, (unsigned long long)(~0), false>
+{
+    typedef unsigned long long result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    static result_type next(result_type __x)
+    {
+        return __a * __x + __c;
+    }
+};
+
+// 32
+
+template <unsigned long long _Ap, unsigned long long _Cp, unsigned long long _Mp>
+struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), true>
+{
+    typedef unsigned result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    static result_type next(result_type __x)
+    {
+        const result_type __a = static_cast<result_type>(_Ap);
+        const result_type __c = static_cast<result_type>(_Cp);
+        const result_type __m = static_cast<result_type>(_Mp);
+        // Schrage's algorithm
+        const result_type __q = __m / __a;
+        const result_type __r = __m % __a;
+        const result_type __t0 = __a * (__x % __q);
+        const result_type __t1 = __r * (__x / __q);
+        __x = __t0 + (__t0 < __t1) * __m - __t1;
+        __x += __c - (__x >= __m - __c) * __m;
+        return __x;
+    }
+};
+
+template <unsigned long long _Ap, unsigned long long _Mp>
+struct __lce_ta<_Ap, 0, _Mp, unsigned(~0), true>
+{
+    typedef unsigned result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    static result_type next(result_type __x)
+    {
+        const result_type __a = static_cast<result_type>(_Ap);
+        const result_type __m = static_cast<result_type>(_Mp);
+        // Schrage's algorithm
+        const result_type __q = __m / __a;
+        const result_type __r = __m % __a;
+        const result_type __t0 = __a * (__x % __q);
+        const result_type __t1 = __r * (__x / __q);
+        __x = __t0 + (__t0 < __t1) * __m - __t1;
+        return __x;
+    }
+};
+
+template <unsigned long long _Ap, unsigned long long _Cp, unsigned long long _Mp>
+struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), false>
+{
+    typedef unsigned result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    static result_type next(result_type __x)
+    {
+        const result_type __a = static_cast<result_type>(_Ap);
+        const result_type __c = static_cast<result_type>(_Cp);
+        const result_type __m = static_cast<result_type>(_Mp);
+        return (__a * __x + __c) % __m;
+    }
+};
+
+template <unsigned long long _Ap, unsigned long long _Cp>
+struct __lce_ta<_Ap, _Cp, 0, unsigned(~0), false>
+{
+    typedef unsigned result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    static result_type next(result_type __x)
+    {
+        const result_type __a = static_cast<result_type>(_Ap);
+        const result_type __c = static_cast<result_type>(_Cp);
+        return __a * __x + __c;
+    }
+};
+
+// 16
+
+template <unsigned long long __a, unsigned long long __c, unsigned long long __m, bool __b>
+struct __lce_ta<__a, __c, __m, (unsigned short)(~0), __b>
+{
+    typedef unsigned short result_type;
+    _LIBCPP_INLINE_VISIBILITY
+    static result_type next(result_type __x)
+    {
+        return static_cast<result_type>(__lce_ta<__a, __c, __m, unsigned(~0)>::next(__x));
+    }
+};
+
+template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+class _LIBCPP_TYPE_VIS_ONLY linear_congruential_engine;
+
+template <class _CharT, class _Traits,
+          class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+_LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
+
+template <class _CharT, class _Traits,
+          class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
+
+template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+class _LIBCPP_TYPE_VIS_ONLY linear_congruential_engine
+{
+public:
+    // types
+    typedef _UIntType result_type;
+
+private:
+    result_type __x_;
+
+    static _LIBCPP_CONSTEXPR const result_type _Mp = result_type(~0);
+
+    static_assert(__m == 0 || __a < __m, "linear_congruential_engine invalid parameters");
+    static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters");
+public:
+    static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u: 0u;
+    static _LIBCPP_CONSTEXPR const result_type _Max = __m - 1u;
+    static_assert(_Min < _Max,           "linear_congruential_engine invalid parameters");
+
+    // engine characteristics
+    static _LIBCPP_CONSTEXPR const result_type multiplier = __a;
+    static _LIBCPP_CONSTEXPR const result_type increment = __c;
+    static _LIBCPP_CONSTEXPR const result_type modulus = __m;
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type min() {return _Min;}
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type max() {return _Max;}
+    static _LIBCPP_CONSTEXPR const result_type default_seed = 1u;
+
+    // constructors and seeding functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit linear_congruential_engine(result_type __s = default_seed)
+        {seed(__s);}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit linear_congruential_engine(_Sseq& __q,
+        typename enable_if<__is_seed_sequence<_Sseq, linear_congruential_engine>::value>::type* = 0)
+        {seed(__q);}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed(result_type __s = default_seed)
+        {seed(integral_constant<bool, __m == 0>(),
+              integral_constant<bool, __c == 0>(), __s);}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            __is_seed_sequence<_Sseq, linear_congruential_engine>::value,
+            void
+        >::type
+        seed(_Sseq& __q)
+            {__seed(__q, integral_constant<unsigned,
+                1 + (__m == 0 ? (sizeof(result_type) * __CHAR_BIT__ - 1)/32
+                             :  (__m > 0x100000000ull))>());}
+
+    // generating functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator()()
+        {return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _Mp>::next(__x_));}
+    _LIBCPP_INLINE_VISIBILITY
+    void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const linear_congruential_engine& __x,
+                    const linear_congruential_engine& __y)
+        {return __x.__x_ == __y.__x_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const linear_congruential_engine& __x,
+                    const linear_congruential_engine& __y)
+        {return !(__x == __y);}
+
+private:
+
+    _LIBCPP_INLINE_VISIBILITY
+    void seed(true_type, true_type, result_type __s) {__x_ = __s == 0 ? 1 : __s;}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed(true_type, false_type, result_type __s) {__x_ = __s;}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed(false_type, true_type, result_type __s) {__x_ = __s % __m == 0 ?
+                                                                 1 : __s % __m;}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed(false_type, false_type, result_type __s) {__x_ = __s % __m;}
+
+    template<class _Sseq>
+        void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
+    template<class _Sseq>
+        void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
+
+    template <class _CharT, class _Traits,
+              class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
+
+    template <class _CharT, class _Traits,
+              class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
+};
+
+template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+    linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier;
+
+template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+    linear_congruential_engine<_UIntType, __a, __c, __m>::increment;
+
+template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+    linear_congruential_engine<_UIntType, __a, __c, __m>::modulus;
+
+template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+    linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed;
+
+template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+template<class _Sseq>
+void
+linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q,
+                                                 integral_constant<unsigned, 1>)
+{
+    const unsigned __k = 1;
+    uint32_t __ar[__k+3];
+    __q.generate(__ar, __ar + __k + 3);
+    result_type __s = static_cast<result_type>(__ar[3] % __m);
+    __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
+}
+
+template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+template<class _Sseq>
+void
+linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q,
+                                                 integral_constant<unsigned, 2>)
+{
+    const unsigned __k = 2;
+    uint32_t __ar[__k+3];
+    __q.generate(__ar, __ar + __k + 3);
+    result_type __s = static_cast<result_type>((__ar[3] +
+                                              ((uint64_t)__ar[4] << 32)) % __m);
+    __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
+}
+
+template <class _CharT, class _Traits,
+          class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left);
+    __os.fill(__os.widen(' '));
+    return __os << __x.__x_;
+}
+
+template <class _CharT, class _Traits,
+          class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    _UIntType __t;
+    __is >> __t;
+    if (!__is.fail())
+        __x.__x_ = __t;
+    return __is;
+}
+
+typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647>
+                                                                   minstd_rand0;
+typedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647>
+                                                                    minstd_rand;
+typedef minstd_rand                                       default_random_engine;
+// mersenne_twister_engine
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+class _LIBCPP_TYPE_VIS_ONLY mersenne_twister_engine;
+
+template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+          _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+          _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+bool
+operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                         _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+           const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                         _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+          _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+          _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                         _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+           const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                         _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+template <class _CharT, class _Traits,
+          class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+          _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+          _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                         _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
+
+template <class _CharT, class _Traits,
+          class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+          _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+          _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                   _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+class _LIBCPP_TYPE_VIS_ONLY mersenne_twister_engine
+{
+public:
+    // types
+    typedef _UIntType result_type;
+
+private:
+    result_type __x_[__n];
+    size_t      __i_;
+
+    static_assert(  0 <  __m, "mersenne_twister_engine invalid parameters");
+    static_assert(__m <= __n, "mersenne_twister_engine invalid parameters");
+    static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
+    static_assert(__w <= _Dt, "mersenne_twister_engine invalid parameters");
+    static_assert(  2 <= __w, "mersenne_twister_engine invalid parameters");
+    static_assert(__r <= __w, "mersenne_twister_engine invalid parameters");
+    static_assert(__u <= __w, "mersenne_twister_engine invalid parameters");
+    static_assert(__s <= __w, "mersenne_twister_engine invalid parameters");
+    static_assert(__t <= __w, "mersenne_twister_engine invalid parameters");
+    static_assert(__l <= __w, "mersenne_twister_engine invalid parameters");
+public:
+    static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+    static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) :
+                                                      (result_type(1) << __w) - result_type(1);
+    static_assert(_Min < _Max, "mersenne_twister_engine invalid parameters");
+    static_assert(__a <= _Max, "mersenne_twister_engine invalid parameters");
+    static_assert(__b <= _Max, "mersenne_twister_engine invalid parameters");
+    static_assert(__c <= _Max, "mersenne_twister_engine invalid parameters");
+    static_assert(__d <= _Max, "mersenne_twister_engine invalid parameters");
+    static_assert(__f <= _Max, "mersenne_twister_engine invalid parameters");
+
+    // engine characteristics
+    static _LIBCPP_CONSTEXPR const size_t word_size = __w;
+    static _LIBCPP_CONSTEXPR const size_t state_size = __n;
+    static _LIBCPP_CONSTEXPR const size_t shift_size = __m;
+    static _LIBCPP_CONSTEXPR const size_t mask_bits = __r;
+    static _LIBCPP_CONSTEXPR const result_type xor_mask = __a;
+    static _LIBCPP_CONSTEXPR const size_t tempering_u = __u;
+    static _LIBCPP_CONSTEXPR const result_type tempering_d = __d;
+    static _LIBCPP_CONSTEXPR const size_t tempering_s = __s;
+    static _LIBCPP_CONSTEXPR const result_type tempering_b = __b;
+    static _LIBCPP_CONSTEXPR const size_t tempering_t = __t;
+    static _LIBCPP_CONSTEXPR const result_type tempering_c = __c;
+    static _LIBCPP_CONSTEXPR const size_t tempering_l = __l;
+    static _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f;
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+    static _LIBCPP_CONSTEXPR const result_type default_seed = 5489u;
+
+    // constructors and seeding functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit mersenne_twister_engine(result_type __sd = default_seed)
+        {seed(__sd);}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit mersenne_twister_engine(_Sseq& __q,
+        typename enable_if<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value>::type* = 0)
+        {seed(__q);}
+    void seed(result_type __sd = default_seed);
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            __is_seed_sequence<_Sseq, mersenne_twister_engine>::value,
+            void
+        >::type
+        seed(_Sseq& __q)
+            {__seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());}
+
+    // generating functions
+    result_type operator()();
+    _LIBCPP_INLINE_VISIBILITY
+    void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
+
+    template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+              _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+              _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+    friend
+    bool
+    operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                             _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+               const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                             _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+    template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+              _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+              _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+    friend
+    bool
+    operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                             _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+               const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                             _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+    template <class _CharT, class _Traits,
+              class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+              _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+              _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                             _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
+
+    template <class _CharT, class _Traits,
+              class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+              _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+              _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                       _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
+private:
+
+    template<class _Sseq>
+        void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
+    template<class _Sseq>
+        void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
+
+    template <size_t __count>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        typename enable_if
+        <
+            __count < __w,
+            result_type
+        >::type
+        __lshift(result_type __x) {return (__x << __count) & _Max;}
+
+    template <size_t __count>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        typename enable_if
+        <
+            (__count >= __w),
+            result_type
+        >::type
+        __lshift(result_type) {return result_type(0);}
+
+    template <size_t __count>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        typename enable_if
+        <
+            __count < _Dt,
+            result_type
+        >::type
+        __rshift(result_type __x) {return __x >> __count;}
+
+    template <size_t __count>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        typename enable_if
+        <
+            (__count >= _Dt),
+            result_type
+        >::type
+        __rshift(result_type) {return result_type(0);}
+};
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const size_t
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::word_size;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const size_t 
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const size_t 
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const size_t 
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::xor_mask;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const size_t 
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_d;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const size_t 
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_b;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const size_t 
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_c;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const size_t 
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::initialization_multiplier;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+    _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::default_seed;
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+void
+mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
+    __t, __c, __l, __f>::seed(result_type __sd)
+{   // __w >= 2
+    __x_[0] = __sd & _Max;
+    for (size_t __i = 1; __i < __n; ++__i)
+        __x_[__i] = (__f * (__x_[__i-1] ^ __rshift<__w - 2>(__x_[__i-1])) + __i) & _Max;
+    __i_ = 0;
+}
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+template<class _Sseq>
+void
+mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
+    __t, __c, __l, __f>::__seed(_Sseq& __q, integral_constant<unsigned, 1>)
+{
+    const unsigned __k = 1;
+    uint32_t __ar[__n * __k];
+    __q.generate(__ar, __ar + __n * __k);
+    for (size_t __i = 0; __i < __n; ++__i)
+        __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
+    const result_type __mask = __r == _Dt ? result_type(~0) :
+                                       (result_type(1) << __r) - result_type(1);
+    __i_ = 0;
+    if ((__x_[0] & ~__mask) == 0)
+    {
+        for (size_t __i = 1; __i < __n; ++__i)
+            if (__x_[__i] != 0)
+                return;
+        __x_[0] = _Max;
+    }
+}
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+template<class _Sseq>
+void
+mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
+    __t, __c, __l, __f>::__seed(_Sseq& __q, integral_constant<unsigned, 2>)
+{
+    const unsigned __k = 2;
+    uint32_t __ar[__n * __k];
+    __q.generate(__ar, __ar + __n * __k);
+    for (size_t __i = 0; __i < __n; ++__i)
+        __x_[__i] = static_cast<result_type>(
+            (__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
+    const result_type __mask = __r == _Dt ? result_type(~0) :
+                                       (result_type(1) << __r) - result_type(1);
+    __i_ = 0;
+    if ((__x_[0] & ~__mask) == 0)
+    {
+        for (size_t __i = 1; __i < __n; ++__i)
+            if (__x_[__i] != 0)
+                return;
+        __x_[0] = _Max;
+    }
+}
+
+template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+_UIntType
+mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
+    __t, __c, __l, __f>::operator()()
+{
+    const size_t __j = (__i_ + 1) % __n;
+    const result_type __mask = __r == _Dt ? result_type(~0) :
+                                       (result_type(1) << __r) - result_type(1);
+    const result_type _Yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
+    const size_t __k = (__i_ + __m) % __n;
+    __x_[__i_] = __x_[__k] ^ __rshift<1>(_Yp) ^ (__a * (_Yp & 1));
+    result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d);
+    __i_ = __j;
+    __z ^= __lshift<__s>(__z) & __b;
+    __z ^= __lshift<__t>(__z) & __c;
+    return __z ^ __rshift<__l>(__z);
+}
+
+template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+          _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+          _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+bool
+operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                         _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+           const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                         _Bp, _Tp, _Cp, _Lp, _Fp>& __y)
+{
+    if (__x.__i_ == __y.__i_)
+        return _VSTD::equal(__x.__x_, __x.__x_ + _Np, __y.__x_);
+    if (__x.__i_ == 0 || __y.__i_ == 0)
+    {
+        size_t __j = _VSTD::min(_Np - __x.__i_, _Np - __y.__i_);
+        if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
+                         __y.__x_ + __y.__i_))
+            return false;
+        if (__x.__i_ == 0)
+            return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _Np, __y.__x_);
+        return _VSTD::equal(__x.__x_, __x.__x_ + (_Np - __j), __y.__x_ + __j);
+    }
+    if (__x.__i_ < __y.__i_)
+    {
+        size_t __j = _Np - __y.__i_;
+        if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
+                         __y.__x_ + __y.__i_))
+            return false;
+        if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Np,
+                         __y.__x_))
+            return false;
+        return _VSTD::equal(__x.__x_, __x.__x_ + __x.__i_,
+                           __y.__x_ + (_Np - (__x.__i_ + __j)));
+    }
+    size_t __j = _Np - __x.__i_;
+    if (!_VSTD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
+                     __x.__x_ + __x.__i_))
+        return false;
+    if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Np,
+                     __x.__x_))
+        return false;
+    return _VSTD::equal(__y.__x_, __y.__x_ + __y.__i_,
+                       __x.__x_ + (_Np - (__y.__i_ + __j)));
+}
+
+template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+          _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+          _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                         _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+           const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                         _Bp, _Tp, _Cp, _Lp, _Fp>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _CharT, class _Traits,
+          class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+          _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+          _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                         _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    __os << __x.__x_[__x.__i_];
+    for (size_t __j = __x.__i_ + 1; __j < _Np; ++__j)
+        __os << __sp << __x.__x_[__j];
+    for (size_t __j = 0; __j < __x.__i_; ++__j)
+        __os << __sp << __x.__x_[__j];
+    return __os;
+}
+
+template <class _CharT, class _Traits,
+          class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+          _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+          _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+                                   _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    _UI __t[_Np];
+    for (size_t __i = 0; __i < _Np; ++__i)
+        __is >> __t[__i];
+    if (!__is.fail())
+    {
+        for (size_t __i = 0; __i < _Np; ++__i)
+            __x.__x_[__i] = __t[__i];
+        __x.__i_ = 0;
+    }
+    return __is;
+}
+
+typedef mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31,
+                                0x9908b0df, 11, 0xffffffff,
+                                7,  0x9d2c5680,
+                                15, 0xefc60000,
+                                18, 1812433253>                         mt19937;
+typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31,
+                                0xb5026f5aa96619e9ULL, 29, 0x5555555555555555ULL,
+                                17, 0x71d67fffeda60000ULL,
+                                37, 0xfff7eee000000000ULL,
+                                43, 6364136223846793005ULL>          mt19937_64;
+
+// subtract_with_carry_engine
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+class _LIBCPP_TYPE_VIS_ONLY subtract_with_carry_engine;
+
+template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+bool
+operator==(
+    const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+    const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
+
+template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+_LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(
+    const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+    const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
+
+template <class _CharT, class _Traits,
+          class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
+
+template <class _CharT, class _Traits,
+          class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+class _LIBCPP_TYPE_VIS_ONLY subtract_with_carry_engine
+{
+public:
+    // types
+    typedef _UIntType result_type;
+
+private:
+    result_type __x_[__r];
+    result_type  __c_;
+    size_t      __i_;
+
+    static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
+    static_assert(  0 <  __w, "subtract_with_carry_engine invalid parameters");
+    static_assert(__w <= _Dt, "subtract_with_carry_engine invalid parameters");
+    static_assert(  0 <  __s, "subtract_with_carry_engine invalid parameters");
+    static_assert(__s <  __r, "subtract_with_carry_engine invalid parameters");
+public:
+    static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+    static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) :
+                                                      (result_type(1) << __w) - result_type(1);
+    static_assert(_Min < _Max, "subtract_with_carry_engine invalid parameters");
+
+    // engine characteristics
+    static _LIBCPP_CONSTEXPR const size_t word_size = __w;
+    static _LIBCPP_CONSTEXPR const size_t short_lag = __s;
+    static _LIBCPP_CONSTEXPR const size_t long_lag = __r;
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+    static _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u;
+
+    // constructors and seeding functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit subtract_with_carry_engine(result_type __sd = default_seed)
+        {seed(__sd);}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit subtract_with_carry_engine(_Sseq& __q,
+        typename enable_if<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value>::type* = 0)
+        {seed(__q);}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed(result_type __sd = default_seed)
+        {seed(__sd, integral_constant<unsigned, 1 + (__w - 1) / 32>());}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            __is_seed_sequence<_Sseq, subtract_with_carry_engine>::value,
+            void
+        >::type
+        seed(_Sseq& __q)
+            {__seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());}
+
+    // generating functions
+    result_type operator()();
+    _LIBCPP_INLINE_VISIBILITY
+    void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
+
+    template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+    friend
+    bool
+    operator==(
+        const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+        const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
+
+    template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+    friend
+    bool
+    operator!=(
+        const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+        const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
+
+    template <class _CharT, class _Traits,
+              class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
+
+    template <class _CharT, class _Traits,
+              class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
+
+private:
+
+    void seed(result_type __sd, integral_constant<unsigned, 1>);
+    void seed(result_type __sd, integral_constant<unsigned, 2>);
+    template<class _Sseq>
+        void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
+    template<class _Sseq>
+        void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
+};
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+    _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+    _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+    _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+    _LIBCPP_CONSTEXPR const typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::result_type
+    subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed;
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+void
+subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd,
+        integral_constant<unsigned, 1>)
+{
+    linear_congruential_engine<result_type, 40014u, 0u, 2147483563u>
+        __e(__sd == 0u ? default_seed : __sd);
+    for (size_t __i = 0; __i < __r; ++__i)
+        __x_[__i] = static_cast<result_type>(__e() & _Max);
+    __c_ = __x_[__r-1] == 0;
+    __i_ = 0;
+}
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+void
+subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd,
+        integral_constant<unsigned, 2>)
+{
+    linear_congruential_engine<result_type, 40014u, 0u, 2147483563u>
+        __e(__sd == 0u ? default_seed : __sd);
+    for (size_t __i = 0; __i < __r; ++__i)
+    {
+        result_type __e0 = __e();
+        __x_[__i] = static_cast<result_type>(
+                                    (__e0 + ((uint64_t)__e() << 32)) & _Max);
+    }
+    __c_ = __x_[__r-1] == 0;
+    __i_ = 0;
+}
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+template<class _Sseq>
+void
+subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q,
+        integral_constant<unsigned, 1>)
+{
+    const unsigned __k = 1;
+    uint32_t __ar[__r * __k];
+    __q.generate(__ar, __ar + __r * __k);
+    for (size_t __i = 0; __i < __r; ++__i)
+        __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
+    __c_ = __x_[__r-1] == 0;
+    __i_ = 0;
+}
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+template<class _Sseq>
+void
+subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q,
+        integral_constant<unsigned, 2>)
+{
+    const unsigned __k = 2;
+    uint32_t __ar[__r * __k];
+    __q.generate(__ar, __ar + __r * __k);
+    for (size_t __i = 0; __i < __r; ++__i)
+        __x_[__i] = static_cast<result_type>(
+                  (__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
+    __c_ = __x_[__r-1] == 0;
+    __i_ = 0;
+}
+
+template<class _UIntType, size_t __w, size_t __s, size_t __r>
+_UIntType
+subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()()
+{
+    const result_type& __xs = __x_[(__i_ + (__r - __s)) % __r];
+    result_type& __xr = __x_[__i_];
+    result_type __new_c = __c_ == 0 ? __xs < __xr : __xs != 0 ? __xs <= __xr : 1;
+    __xr = (__xs - __xr - __c_) & _Max;
+    __c_ = __new_c;
+    __i_ = (__i_ + 1) % __r;
+    return __xr;
+}
+
+template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+bool
+operator==(
+    const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+    const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y)
+{
+    if (__x.__c_ != __y.__c_)
+        return false;
+    if (__x.__i_ == __y.__i_)
+        return _VSTD::equal(__x.__x_, __x.__x_ + _Rp, __y.__x_);
+    if (__x.__i_ == 0 || __y.__i_ == 0)
+    {
+        size_t __j = _VSTD::min(_Rp - __x.__i_, _Rp - __y.__i_);
+        if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
+                         __y.__x_ + __y.__i_))
+            return false;
+        if (__x.__i_ == 0)
+            return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _Rp, __y.__x_);
+        return _VSTD::equal(__x.__x_, __x.__x_ + (_Rp - __j), __y.__x_ + __j);
+    }
+    if (__x.__i_ < __y.__i_)
+    {
+        size_t __j = _Rp - __y.__i_;
+        if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
+                         __y.__x_ + __y.__i_))
+            return false;
+        if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Rp,
+                         __y.__x_))
+            return false;
+        return _VSTD::equal(__x.__x_, __x.__x_ + __x.__i_,
+                           __y.__x_ + (_Rp - (__x.__i_ + __j)));
+    }
+    size_t __j = _Rp - __x.__i_;
+    if (!_VSTD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
+                     __x.__x_ + __x.__i_))
+        return false;
+    if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Rp,
+                     __x.__x_))
+        return false;
+    return _VSTD::equal(__y.__x_, __y.__x_ + __y.__i_,
+                       __x.__x_ + (_Rp - (__y.__i_ + __j)));
+}
+
+template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(
+    const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+    const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _CharT, class _Traits,
+          class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    __os << __x.__x_[__x.__i_];
+    for (size_t __j = __x.__i_ + 1; __j < _Rp; ++__j)
+        __os << __sp << __x.__x_[__j];
+    for (size_t __j = 0; __j < __x.__i_; ++__j)
+        __os << __sp << __x.__x_[__j];
+    __os << __sp << __x.__c_;
+    return __os;
+}
+
+template <class _CharT, class _Traits,
+          class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    _UI __t[_Rp+1];
+    for (size_t __i = 0; __i < _Rp+1; ++__i)
+        __is >> __t[__i];
+    if (!__is.fail())
+    {
+        for (size_t __i = 0; __i < _Rp; ++__i)
+            __x.__x_[__i] = __t[__i];
+        __x.__c_ = __t[_Rp];
+        __x.__i_ = 0;
+    }
+    return __is;
+}
+
+typedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24>     ranlux24_base;
+typedef subtract_with_carry_engine<uint_fast64_t, 48,  5, 12>     ranlux48_base;
+
+// discard_block_engine
+
+template<class _Engine, size_t __p, size_t __r>
+class _LIBCPP_TYPE_VIS_ONLY discard_block_engine
+{
+    _Engine __e_;
+    int     __n_;
+
+    static_assert(  0 <  __r, "discard_block_engine invalid parameters");
+    static_assert(__r <= __p, "discard_block_engine invalid parameters");
+public:
+    // types
+    typedef typename _Engine::result_type result_type;
+
+    // engine characteristics
+    static _LIBCPP_CONSTEXPR const size_t block_size = __p;
+    static _LIBCPP_CONSTEXPR const size_t used_block = __r;
+
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+    static const result_type _Min = _Engine::_Min;
+    static const result_type _Max = _Engine::_Max;
+#else
+    static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
+    static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); }
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type max() { return _Engine::max(); }
+
+    // constructors and seeding functions
+    _LIBCPP_INLINE_VISIBILITY
+    discard_block_engine() : __n_(0) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit discard_block_engine(const _Engine& __e)
+        : __e_(__e), __n_(0) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    explicit discard_block_engine(_Engine&& __e)
+        : __e_(_VSTD::move(__e)), __n_(0) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit discard_block_engine(_Sseq& __q,
+        typename enable_if<__is_seed_sequence<_Sseq, discard_block_engine>::value &&
+                           !is_convertible<_Sseq, _Engine>::value>::type* = 0)
+        : __e_(__q), __n_(0) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed() {__e_.seed(); __n_ = 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed(result_type __sd) {__e_.seed(__sd); __n_ = 0;}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            __is_seed_sequence<_Sseq, discard_block_engine>::value,
+            void
+        >::type
+        seed(_Sseq& __q) {__e_.seed(__q); __n_ = 0;}
+
+    // generating functions
+    result_type operator()();
+    _LIBCPP_INLINE_VISIBILITY
+    void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    const _Engine& base() const _NOEXCEPT {return __e_;}
+
+    template<class _Eng, size_t _Pp, size_t _Rp>
+    friend
+    bool
+    operator==(
+        const discard_block_engine<_Eng, _Pp, _Rp>& __x,
+        const discard_block_engine<_Eng, _Pp, _Rp>& __y);
+
+    template<class _Eng, size_t _Pp, size_t _Rp>
+    friend
+    bool
+    operator!=(
+        const discard_block_engine<_Eng, _Pp, _Rp>& __x,
+        const discard_block_engine<_Eng, _Pp, _Rp>& __y);
+
+    template <class _CharT, class _Traits,
+              class _Eng, size_t _Pp, size_t _Rp>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const discard_block_engine<_Eng, _Pp, _Rp>& __x);
+
+    template <class _CharT, class _Traits,
+              class _Eng, size_t _Pp, size_t _Rp>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               discard_block_engine<_Eng, _Pp, _Rp>& __x);
+};
+
+template<class _Engine, size_t __p, size_t __r>
+    _LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::block_size;
+
+template<class _Engine, size_t __p, size_t __r>
+    _LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::used_block;
+
+template<class _Engine, size_t __p, size_t __r>
+typename discard_block_engine<_Engine, __p, __r>::result_type
+discard_block_engine<_Engine, __p, __r>::operator()()
+{
+    if (__n_ >= __r)
+    {
+        __e_.discard(__p - __r);
+        __n_ = 0;
+    }
+    ++__n_;
+    return __e_();
+}
+
+template<class _Eng, size_t _Pp, size_t _Rp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const discard_block_engine<_Eng, _Pp, _Rp>& __x,
+           const discard_block_engine<_Eng, _Pp, _Rp>& __y)
+{
+    return __x.__n_ == __y.__n_ && __x.__e_ == __y.__e_;
+}
+
+template<class _Eng, size_t _Pp, size_t _Rp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x,
+           const discard_block_engine<_Eng, _Pp, _Rp>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _CharT, class _Traits,
+          class _Eng, size_t _Pp, size_t _Rp>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const discard_block_engine<_Eng, _Pp, _Rp>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    return __os << __x.__e_ << __sp << __x.__n_;
+}
+
+template <class _CharT, class _Traits,
+          class _Eng, size_t _Pp, size_t _Rp>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           discard_block_engine<_Eng, _Pp, _Rp>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    _Eng __e;
+    int __n;
+    __is >> __e >> __n;
+    if (!__is.fail())
+    {
+        __x.__e_ = __e;
+        __x.__n_ = __n;
+    }
+    return __is;
+}
+
+typedef discard_block_engine<ranlux24_base, 223, 23> ranlux24;
+typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48;
+
+// independent_bits_engine
+
+template<class _Engine, size_t __w, class _UIntType>
+class _LIBCPP_TYPE_VIS_ONLY independent_bits_engine
+{
+    template <class _UI, _UI _R0, size_t _Wp, size_t _Mp>
+    class __get_n
+    {
+        static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UI>::digits;
+        static _LIBCPP_CONSTEXPR const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0);
+        static _LIBCPP_CONSTEXPR const size_t _W0 = _Wp / _Np;
+        static _LIBCPP_CONSTEXPR const _UI _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0;
+    public:
+        static _LIBCPP_CONSTEXPR const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np;
+    };
+public:
+    // types
+    typedef _UIntType result_type;
+
+private:
+    _Engine __e_;
+
+    static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
+    static_assert(  0 <  __w, "independent_bits_engine invalid parameters");
+    static_assert(__w <= _Dt, "independent_bits_engine invalid parameters");
+
+    typedef typename _Engine::result_type _Engine_result_type;
+    typedef typename conditional
+        <
+            sizeof(_Engine_result_type) <= sizeof(result_type),
+                result_type,
+                _Engine_result_type
+        >::type _Working_result_type;
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+    static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
+                                          + _Working_result_type(1);
+#else
+    static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min()
+                                                            + _Working_result_type(1);
+#endif
+    static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
+    static _LIBCPP_CONSTEXPR const size_t __n = __get_n<_Working_result_type, _Rp, __w, __m>::value;
+    static _LIBCPP_CONSTEXPR const size_t __w0 = __w / __n;
+    static _LIBCPP_CONSTEXPR const size_t __n0 = __n - __w % __n;
+    static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
+    static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
+    static _LIBCPP_CONSTEXPR const _Working_result_type __y0 = __w0 >= _WDt ? 0 :
+                                                               (_Rp >> __w0) << __w0;
+    static _LIBCPP_CONSTEXPR const _Working_result_type __y1 = __w0 >= _WDt - 1 ? 0 :
+                                                               (_Rp >> (__w0+1)) << (__w0+1);
+    static _LIBCPP_CONSTEXPR const _Engine_result_type __mask0 = __w0 > 0 ?
+                                _Engine_result_type(~0) >> (_EDt - __w0) :
+                                _Engine_result_type(0);
+    static _LIBCPP_CONSTEXPR const _Engine_result_type __mask1 = __w0 < _EDt - 1 ?
+                                _Engine_result_type(~0) >> (_EDt - (__w0 + 1)) :
+                                _Engine_result_type(~0);
+public:
+    static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+    static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) :
+                                                      (result_type(1) << __w) - result_type(1);
+    static_assert(_Min < _Max, "independent_bits_engine invalid parameters");
+
+    // engine characteristics
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+
+    // constructors and seeding functions
+    _LIBCPP_INLINE_VISIBILITY
+    independent_bits_engine() {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit independent_bits_engine(const _Engine& __e)
+        : __e_(__e) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    explicit independent_bits_engine(_Engine&& __e)
+        : __e_(_VSTD::move(__e)) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit independent_bits_engine(_Sseq& __q,
+        typename enable_if<__is_seed_sequence<_Sseq, independent_bits_engine>::value &&
+                           !is_convertible<_Sseq, _Engine>::value>::type* = 0)
+         : __e_(__q) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed() {__e_.seed();}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed(result_type __sd) {__e_.seed(__sd);}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            __is_seed_sequence<_Sseq, independent_bits_engine>::value,
+            void
+        >::type
+        seed(_Sseq& __q) {__e_.seed(__q);}
+
+    // generating functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
+    _LIBCPP_INLINE_VISIBILITY
+    void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    const _Engine& base() const _NOEXCEPT {return __e_;}
+
+    template<class _Eng, size_t _Wp, class _UI>
+    friend
+    bool
+    operator==(
+        const independent_bits_engine<_Eng, _Wp, _UI>& __x,
+        const independent_bits_engine<_Eng, _Wp, _UI>& __y);
+
+    template<class _Eng, size_t _Wp, class _UI>
+    friend
+    bool
+    operator!=(
+        const independent_bits_engine<_Eng, _Wp, _UI>& __x,
+        const independent_bits_engine<_Eng, _Wp, _UI>& __y);
+
+    template <class _CharT, class _Traits,
+              class _Eng, size_t _Wp, class _UI>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const independent_bits_engine<_Eng, _Wp, _UI>& __x);
+
+    template <class _CharT, class _Traits,
+              class _Eng, size_t _Wp, class _UI>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               independent_bits_engine<_Eng, _Wp, _UI>& __x);
+
+private:
+    result_type __eval(false_type);
+    result_type __eval(true_type);
+
+    template <size_t __count>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        typename enable_if
+        <
+            __count < _Dt,
+            result_type
+        >::type
+        __lshift(result_type __x) {return __x << __count;}
+
+    template <size_t __count>
+        _LIBCPP_INLINE_VISIBILITY
+        static
+        typename enable_if
+        <
+            (__count >= _Dt),
+            result_type
+        >::type
+        __lshift(result_type) {return result_type(0);}
+};
+
+template<class _Engine, size_t __w, class _UIntType>
+inline _LIBCPP_INLINE_VISIBILITY
+_UIntType
+independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type)
+{
+    return static_cast<result_type>(__e_() & __mask0);
+}
+
+template<class _Engine, size_t __w, class _UIntType>
+_UIntType
+independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type)
+{
+    result_type _Sp = 0;
+    for (size_t __k = 0; __k < __n0; ++__k)
+    {
+        _Engine_result_type __u;
+        do
+        {
+            __u = __e_() - _Engine::min();
+        } while (__u >= __y0);
+        _Sp = static_cast<result_type>(__lshift<__w0>(_Sp) + (__u & __mask0));
+    }
+    for (size_t __k = __n0; __k < __n; ++__k)
+    {
+        _Engine_result_type __u;
+        do
+        {
+            __u = __e_() - _Engine::min();
+        } while (__u >= __y1);
+        _Sp = static_cast<result_type>(__lshift<__w0+1>(_Sp) + (__u & __mask1));
+    }
+    return _Sp;
+}
+
+template<class _Eng, size_t _Wp, class _UI>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(
+    const independent_bits_engine<_Eng, _Wp, _UI>& __x,
+    const independent_bits_engine<_Eng, _Wp, _UI>& __y)
+{
+    return __x.base() == __y.base();
+}
+
+template<class _Eng, size_t _Wp, class _UI>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(
+    const independent_bits_engine<_Eng, _Wp, _UI>& __x,
+    const independent_bits_engine<_Eng, _Wp, _UI>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _CharT, class _Traits,
+          class _Eng, size_t _Wp, class _UI>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const independent_bits_engine<_Eng, _Wp, _UI>& __x)
+{
+    return __os << __x.base();
+}
+
+template <class _CharT, class _Traits,
+          class _Eng, size_t _Wp, class _UI>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           independent_bits_engine<_Eng, _Wp, _UI>& __x)
+{
+    _Eng __e;
+    __is >> __e;
+    if (!__is.fail())
+        __x.__e_ = __e;
+    return __is;
+}
+
+// shuffle_order_engine
+
+template <uint64_t _Xp, uint64_t _Yp>
+struct __ugcd
+{
+    static _LIBCPP_CONSTEXPR const uint64_t value = __ugcd<_Yp, _Xp % _Yp>::value;
+};
+
+template <uint64_t _Xp>
+struct __ugcd<_Xp, 0>
+{
+    static _LIBCPP_CONSTEXPR const uint64_t value = _Xp;
+};
+
+template <uint64_t _Np, uint64_t _Dp>
+class __uratio
+{
+    static_assert(_Dp != 0, "__uratio divide by 0");
+    static _LIBCPP_CONSTEXPR const uint64_t __gcd = __ugcd<_Np, _Dp>::value;
+public:
+    static _LIBCPP_CONSTEXPR const uint64_t num = _Np / __gcd;
+    static _LIBCPP_CONSTEXPR const uint64_t den = _Dp / __gcd;
+
+    typedef __uratio<num, den> type;
+};
+
+template<class _Engine, size_t __k>
+class _LIBCPP_TYPE_VIS_ONLY shuffle_order_engine
+{
+    static_assert(0 < __k, "shuffle_order_engine invalid parameters");
+public:
+    // types
+    typedef typename _Engine::result_type result_type;
+
+private:
+    _Engine __e_;
+    result_type _V_[__k];
+    result_type _Y_;
+
+public:
+    // engine characteristics
+    static _LIBCPP_CONSTEXPR const size_t table_size = __k;
+
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+    static const result_type _Min = _Engine::_Min;
+    static const result_type _Max = _Engine::_Max;
+#else
+    static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
+    static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
+#endif
+    static_assert(_Min < _Max, "shuffle_order_engine invalid parameters");
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+
+    static _LIBCPP_CONSTEXPR const unsigned long long _Rp = _Max - _Min + 1ull;
+
+    // constructors and seeding functions
+    _LIBCPP_INLINE_VISIBILITY
+    shuffle_order_engine() {__init();}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit shuffle_order_engine(const _Engine& __e)
+        : __e_(__e) {__init();}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    explicit shuffle_order_engine(_Engine&& __e)
+        : __e_(_VSTD::move(__e)) {__init();}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit shuffle_order_engine(_Sseq& __q,
+        typename enable_if<__is_seed_sequence<_Sseq, shuffle_order_engine>::value &&
+                           !is_convertible<_Sseq, _Engine>::value>::type* = 0)
+         : __e_(__q) {__init();}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed() {__e_.seed(); __init();}
+    _LIBCPP_INLINE_VISIBILITY
+    void seed(result_type __sd) {__e_.seed(__sd); __init();}
+    template<class _Sseq>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            __is_seed_sequence<_Sseq, shuffle_order_engine>::value,
+            void
+        >::type
+        seed(_Sseq& __q) {__e_.seed(__q); __init();}
+
+    // generating functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
+    _LIBCPP_INLINE_VISIBILITY
+    void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    const _Engine& base() const _NOEXCEPT {return __e_;}
+
+private:
+    template<class _Eng, size_t _Kp>
+    friend
+    bool
+    operator==(
+        const shuffle_order_engine<_Eng, _Kp>& __x,
+        const shuffle_order_engine<_Eng, _Kp>& __y);
+
+    template<class _Eng, size_t _Kp>
+    friend
+    bool
+    operator!=(
+        const shuffle_order_engine<_Eng, _Kp>& __x,
+        const shuffle_order_engine<_Eng, _Kp>& __y);
+
+    template <class _CharT, class _Traits,
+              class _Eng, size_t _Kp>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const shuffle_order_engine<_Eng, _Kp>& __x);
+
+    template <class _CharT, class _Traits,
+              class _Eng, size_t _Kp>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               shuffle_order_engine<_Eng, _Kp>& __x);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __init()
+    {
+        for (size_t __i = 0; __i < __k; ++__i)
+            _V_[__i] = __e_();
+        _Y_ = __e_();
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type __eval(false_type) {return __eval2(integral_constant<bool, __k & 1>());}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type __eval(true_type) {return __eval(__uratio<__k, _Rp>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type __eval2(false_type) {return __eval(__uratio<__k/2, 0x8000000000000000ull>());}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type __eval2(true_type) {return __evalf<__k, 0>();}
+
+    template <uint64_t _Np, uint64_t _Dp>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            (__uratio<_Np, _Dp>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)),
+            result_type
+        >::type
+        __eval(__uratio<_Np, _Dp>)
+            {return __evalf<__uratio<_Np, _Dp>::num, __uratio<_Np, _Dp>::den>();}
+
+    template <uint64_t _Np, uint64_t _Dp>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            __uratio<_Np, _Dp>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min),
+            result_type
+        >::type
+        __eval(__uratio<_Np, _Dp>)
+        {
+            const size_t __j = static_cast<size_t>(__uratio<_Np, _Dp>::num * (_Y_ - _Min)
+                                                   / __uratio<_Np, _Dp>::den);
+            _Y_ = _V_[__j];
+            _V_[__j] = __e_();
+            return _Y_;
+        }
+
+    template <uint64_t __n, uint64_t __d>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type __evalf()
+        {
+            const double _Fp = __d == 0 ?
+                __n / (2. * 0x8000000000000000ull) :
+                __n / (double)__d;
+            const size_t __j = static_cast<size_t>(_Fp * (_Y_ - _Min));
+            _Y_ = _V_[__j];
+            _V_[__j] = __e_();
+            return _Y_;
+        }
+};
+
+template<class _Engine, size_t __k>
+    _LIBCPP_CONSTEXPR const size_t shuffle_order_engine<_Engine, __k>::table_size;
+
+template<class _Eng, size_t _Kp>
+bool
+operator==(
+    const shuffle_order_engine<_Eng, _Kp>& __x,
+    const shuffle_order_engine<_Eng, _Kp>& __y)
+{
+    return __x._Y_ == __y._Y_ && _VSTD::equal(__x._V_, __x._V_ + _Kp, __y._V_) &&
+           __x.__e_ == __y.__e_;
+}
+
+template<class _Eng, size_t _Kp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(
+    const shuffle_order_engine<_Eng, _Kp>& __x,
+    const shuffle_order_engine<_Eng, _Kp>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _CharT, class _Traits,
+          class _Eng, size_t _Kp>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const shuffle_order_engine<_Eng, _Kp>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    __os << __x.__e_ << __sp << __x._V_[0];
+    for (size_t __i = 1; __i < _Kp; ++__i)
+        __os << __sp << __x._V_[__i];
+    return __os << __sp << __x._Y_;
+}
+
+template <class _CharT, class _Traits,
+          class _Eng, size_t _Kp>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           shuffle_order_engine<_Eng, _Kp>& __x)
+{
+    typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    _Eng __e;
+    result_type _Vp[_Kp+1];
+    __is >> __e;
+    for (size_t __i = 0; __i < _Kp+1; ++__i)
+        __is >> _Vp[__i];
+    if (!__is.fail())
+    {
+        __x.__e_ = __e;
+        for (size_t __i = 0; __i < _Kp; ++__i)
+            __x._V_[__i] = _Vp[__i];
+        __x._Y_ = _Vp[_Kp];
+    }
+    return __is;
+}
+
+typedef shuffle_order_engine<minstd_rand0, 256>                         knuth_b;
+
+// random_device
+
+class _LIBCPP_TYPE_VIS random_device
+{
+#ifdef _LIBCPP_USING_DEV_RANDOM
+    int __f_;
+#endif // defined(_LIBCPP_USING_DEV_RANDOM)
+public:
+    // types
+    typedef unsigned result_type;
+
+    // generator characteristics
+    static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+    static _LIBCPP_CONSTEXPR const result_type _Max = 0xFFFFFFFFu;
+
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type min() { return _Min;}
+    _LIBCPP_INLINE_VISIBILITY
+    static _LIBCPP_CONSTEXPR result_type max() { return _Max;}
+
+    // constructors
+    explicit random_device(const string& __token = "/dev/urandom");
+    ~random_device();
+
+    // generating functions
+    result_type operator()();
+
+    // property functions
+    double entropy() const _NOEXCEPT;
+
+private:
+    // no copy functions
+    random_device(const random_device&); // = delete;
+    random_device& operator=(const random_device&); // = delete;
+};
+
+// seed_seq
+
+class _LIBCPP_TYPE_VIS_ONLY seed_seq
+{
+public:
+    // types
+    typedef uint32_t result_type;
+
+private:
+    vector<result_type> __v_;
+
+    template<class _InputIterator>
+        void init(_InputIterator __first, _InputIterator __last);
+public:
+    // constructors
+    _LIBCPP_INLINE_VISIBILITY
+    seed_seq() _NOEXCEPT {}
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    template<class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        seed_seq(initializer_list<_Tp> __il) {init(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    template<class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        seed_seq(_InputIterator __first, _InputIterator __last)
+             {init(__first, __last);}
+
+    // generating functions
+    template<class _RandomAccessIterator>
+        void generate(_RandomAccessIterator __first, _RandomAccessIterator __last);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const _NOEXCEPT {return __v_.size();}
+    template<class _OutputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        void param(_OutputIterator __dest) const
+            {_VSTD::copy(__v_.begin(), __v_.end(), __dest);}
+
+private:
+    // no copy functions
+    seed_seq(const seed_seq&); // = delete;
+    void operator=(const seed_seq&); // = delete;
+
+    _LIBCPP_INLINE_VISIBILITY
+    static result_type _Tp(result_type __x) {return __x ^ (__x >> 27);}
+};
+
+template<class _InputIterator>
+void
+seed_seq::init(_InputIterator __first, _InputIterator __last)
+{
+    for (_InputIterator __s = __first; __s != __last; ++__s)
+        __v_.push_back(*__s & 0xFFFFFFFF);
+}
+
+template<class _RandomAccessIterator>
+void
+seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+    if (__first != __last)
+    {
+        _VSTD::fill(__first, __last, 0x8b8b8b8b);
+        const size_t __n = static_cast<size_t>(__last - __first);
+        const size_t __s = __v_.size();
+        const size_t __t = (__n >= 623) ? 11
+                         : (__n >= 68) ? 7
+                         : (__n >= 39) ? 5
+                         : (__n >= 7)  ? 3
+                         : (__n - 1) / 2;
+        const size_t __p = (__n - __t) / 2;
+        const size_t __q = __p + __t;
+        const size_t __m = _VSTD::max(__s + 1, __n);
+        // __k = 0;
+        {
+            result_type __r = 1664525 * _Tp(__first[0] ^ __first[__p]
+                                                      ^  __first[__n - 1]);
+            __first[__p] += __r;
+            __r += __s;
+            __first[__q] += __r;
+            __first[0] = __r;
+        }
+        for (size_t __k = 1; __k <= __s; ++__k)
+        {
+            const size_t __kmodn = __k % __n;
+            const size_t __kpmodn = (__k + __p) % __n;
+            result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn]
+                                           ^ __first[(__k - 1) % __n]);
+            __first[__kpmodn] += __r;
+            __r +=  __kmodn + __v_[__k-1];
+            __first[(__k + __q) % __n] += __r;
+            __first[__kmodn] = __r;
+        }
+        for (size_t __k = __s + 1; __k < __m; ++__k)
+        {
+            const size_t __kmodn = __k % __n;
+            const size_t __kpmodn = (__k + __p) % __n;
+            result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn]
+                                           ^ __first[(__k - 1) % __n]);
+            __first[__kpmodn] += __r;
+            __r +=  __kmodn;
+            __first[(__k + __q) % __n] += __r;
+            __first[__kmodn] = __r;
+        }
+        for (size_t __k = __m; __k < __m + __n; ++__k)
+        {
+            const size_t __kmodn = __k % __n;
+            const size_t __kpmodn = (__k + __p) % __n;
+            result_type __r = 1566083941 * _Tp(__first[__kmodn] +
+                                              __first[__kpmodn] +
+                                              __first[(__k - 1) % __n]);
+            __first[__kpmodn] ^= __r;
+            __r -= __kmodn;
+            __first[(__k + __q) % __n] ^= __r;
+            __first[__kmodn] = __r;
+        }
+    }
+}
+
+// generate_canonical
+
+template<class _RealType, size_t __bits, class _URNG>
+_RealType
+generate_canonical(_URNG& __g)
+{
+    const size_t _Dt = numeric_limits<_RealType>::digits;
+    const size_t __b = _Dt < __bits ? _Dt : __bits;
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+    const size_t __logR = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value;
+#else
+    const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
+#endif
+    const size_t __k = __b / __logR + (__b % __logR != 0) + (__b == 0);
+    const _RealType _Rp = _URNG::max() - _URNG::min() + _RealType(1);
+    _RealType __base = _Rp;
+    _RealType _Sp = __g() - _URNG::min();
+    for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp)
+        _Sp += (__g() - _URNG::min()) * __base;
+    return _Sp / __base;
+}
+
+// uniform_int_distribution
+
+// in <algorithm>
+
+template <class _CharT, class _Traits, class _IT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const uniform_int_distribution<_IT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    return __os << __x.a() << __sp << __x.b();
+}
+
+template <class _CharT, class _Traits, class _IT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           uniform_int_distribution<_IT>& __x)
+{
+    typedef uniform_int_distribution<_IT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __a;
+    result_type __b;
+    __is >> __a >> __b;
+    if (!__is.fail())
+        __x.param(param_type(__a, __b));
+    return __is;
+}
+
+// uniform_real_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY uniform_real_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __a_;
+        result_type __b_;
+    public:
+        typedef uniform_real_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __a = 0,
+                            result_type __b = 1)
+            : __a_(__a), __b_(__b) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type a() const {return __a_;}
+        _LIBCPP_INLINE_VISIBILITY
+        result_type b() const {return __b_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructors and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit uniform_real_distribution(result_type __a = 0, result_type __b = 1)
+        : __p_(param_type(__a, __b)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit uniform_real_distribution(const param_type& __p) : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type a() const {return __p_.a();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type b() const {return __p_.b();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return a();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return b();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const uniform_real_distribution& __x,
+                        const uniform_real_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const uniform_real_distribution& __x,
+                        const uniform_real_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template<class _RealType>
+template<class _URNG>
+inline _LIBCPP_INLINE_VISIBILITY
+typename uniform_real_distribution<_RealType>::result_type
+uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
+{
+    return (__p.b() - __p.a())
+        * _VSTD::generate_canonical<_RealType, numeric_limits<_RealType>::digits>(__g)
+        + __p.a();
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const uniform_real_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    return __os << __x.a() << __sp << __x.b();
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           uniform_real_distribution<_RT>& __x)
+{
+    typedef uniform_real_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __a;
+    result_type __b;
+    __is >> __a >> __b;
+    if (!__is.fail())
+        __x.param(param_type(__a, __b));
+    return __is;
+}
+
+// bernoulli_distribution
+
+class _LIBCPP_TYPE_VIS_ONLY bernoulli_distribution
+{
+public:
+    // types
+    typedef bool result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        double __p_;
+    public:
+        typedef bernoulli_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(double __p = 0.5) : __p_(__p) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        double p() const {return __p_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__p_ == __y.__p_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructors and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit bernoulli_distribution(double __p = 0.5)
+        : __p_(param_type(__p)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit bernoulli_distribution(const param_type& __p) : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    double p() const {return __p_.p();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return false;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return true;}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const bernoulli_distribution& __x,
+                        const bernoulli_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const bernoulli_distribution& __x,
+                        const bernoulli_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template<class _URNG>
+inline _LIBCPP_INLINE_VISIBILITY
+bernoulli_distribution::result_type
+bernoulli_distribution::operator()(_URNG& __g, const param_type& __p)
+{
+    uniform_real_distribution<double> __gen;
+    return __gen(__g) < __p.p();
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    return __os << __x.p();
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x)
+{
+    typedef bernoulli_distribution _Eng;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    double __p;
+    __is >> __p;
+    if (!__is.fail())
+        __x.param(param_type(__p));
+    return __is;
+}
+
+// binomial_distribution
+
+template<class _IntType = int>
+class _LIBCPP_TYPE_VIS_ONLY binomial_distribution
+{
+public:
+    // types
+    typedef _IntType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __t_;
+        double __p_;
+        double __pr_;
+        double __odds_ratio_;
+        result_type __r0_;
+    public:
+        typedef binomial_distribution distribution_type;
+
+        explicit param_type(result_type __t = 1, double __p = 0.5);
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type t() const {return __t_;}
+        _LIBCPP_INLINE_VISIBILITY
+        double p() const {return __p_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__t_ == __y.__t_ && __x.__p_ == __y.__p_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+
+        friend class binomial_distribution;
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructors and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit binomial_distribution(result_type __t = 1, double __p = 0.5)
+        : __p_(param_type(__t, __p)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit binomial_distribution(const param_type& __p) : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type t() const {return __p_.t();}
+    _LIBCPP_INLINE_VISIBILITY
+    double p() const {return __p_.p();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return t();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const binomial_distribution& __x,
+                        const binomial_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const binomial_distribution& __x,
+                        const binomial_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template<class _IntType>
+binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p)
+    : __t_(__t), __p_(__p)
+{
+    if (0 < __p_ && __p_ < 1)
+    {
+        __r0_ = static_cast<result_type>((__t_ + 1) * __p_);
+        __pr_ = _VSTD::exp(_VSTD::lgamma(__t_ + 1.) - _VSTD::lgamma(__r0_ + 1.) -
+                          _VSTD::lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) +
+                          (__t_ - __r0_) * _VSTD::log(1 - __p_));
+        __odds_ratio_ = __p_ / (1 - __p_);
+    }
+}
+
+// Reference: Kemp, C.D. (1986). `A modal method for generating binomial
+//           variables', Commun. Statist. - Theor. Meth. 15(3), 805-813.
+template<class _IntType>
+template<class _URNG>
+_IntType
+binomial_distribution<_IntType>::operator()(_URNG& __g, const param_type& __pr)
+{
+    if (__pr.__t_ == 0 || __pr.__p_ == 0)
+        return 0;
+    if (__pr.__p_ == 1)
+        return __pr.__t_;
+    uniform_real_distribution<double> __gen;
+    double __u = __gen(__g) - __pr.__pr_;
+    if (__u < 0)
+        return __pr.__r0_;
+    double __pu = __pr.__pr_;
+    double __pd = __pu;
+    result_type __ru = __pr.__r0_;
+    result_type __rd = __ru;
+    while (true)
+    {
+        if (__rd >= 1)
+        {
+            __pd *= __rd / (__pr.__odds_ratio_ * (__pr.__t_ - __rd + 1));
+            __u -= __pd;
+            if (__u < 0)
+                return __rd - 1;
+        }
+        if ( __rd != 0 )
+            --__rd;
+        ++__ru;
+        if (__ru <= __pr.__t_)
+        {
+            __pu *= (__pr.__t_ - __ru + 1) * __pr.__odds_ratio_ / __ru;
+            __u -= __pu;
+            if (__u < 0)
+                return __ru;
+        }
+    }
+}
+
+template <class _CharT, class _Traits, class _IntType>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const binomial_distribution<_IntType>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    return __os << __x.t() << __sp << __x.p();
+}
+
+template <class _CharT, class _Traits, class _IntType>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           binomial_distribution<_IntType>& __x)
+{
+    typedef binomial_distribution<_IntType> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __t;
+    double __p;
+    __is >> __t >> __p;
+    if (!__is.fail())
+        __x.param(param_type(__t, __p));
+    return __is;
+}
+
+// exponential_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY exponential_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __lambda_;
+    public:
+        typedef exponential_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __lambda = 1) : __lambda_(__lambda) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type lambda() const {return __lambda_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__lambda_ == __y.__lambda_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructors and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit exponential_distribution(result_type __lambda = 1)
+        : __p_(param_type(__lambda)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit exponential_distribution(const param_type& __p) : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type lambda() const {return __p_.lambda();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::infinity();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const exponential_distribution& __x,
+                        const exponential_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const exponential_distribution& __x,
+                        const exponential_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template <class _RealType>
+template<class _URNG>
+_RealType
+exponential_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
+{
+    return -_VSTD::log
+                  (
+                      result_type(1) -
+                      _VSTD::generate_canonical<result_type,
+                                       numeric_limits<result_type>::digits>(__g)
+                  )
+                  / __p.lambda();
+}
+
+template <class _CharT, class _Traits, class _RealType>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const exponential_distribution<_RealType>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    return __os << __x.lambda();
+}
+
+template <class _CharT, class _Traits, class _RealType>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           exponential_distribution<_RealType>& __x)
+{
+    typedef exponential_distribution<_RealType> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __lambda;
+    __is >> __lambda;
+    if (!__is.fail())
+        __x.param(param_type(__lambda));
+    return __is;
+}
+
+// normal_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY normal_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __mean_;
+        result_type __stddev_;
+    public:
+        typedef normal_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __mean = 0, result_type __stddev = 1)
+            : __mean_(__mean), __stddev_(__stddev) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type mean() const {return __mean_;}
+        _LIBCPP_INLINE_VISIBILITY
+        result_type stddev() const {return __stddev_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__mean_ == __y.__mean_ && __x.__stddev_ == __y.__stddev_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+    result_type _V_;
+    bool _V_hot_;
+
+public:
+    // constructors and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit normal_distribution(result_type __mean = 0, result_type __stddev = 1)
+        : __p_(param_type(__mean, __stddev)), _V_hot_(false) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit normal_distribution(const param_type& __p)
+        : __p_(__p), _V_hot_(false) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {_V_hot_ = false;}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type mean() const {return __p_.mean();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type stddev() const {return __p_.stddev();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return -numeric_limits<result_type>::infinity();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::infinity();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const normal_distribution& __x,
+                        const normal_distribution& __y)
+        {return __x.__p_ == __y.__p_ && __x._V_hot_ == __y._V_hot_ &&
+                (!__x._V_hot_ || __x._V_ == __y._V_);}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const normal_distribution& __x,
+                        const normal_distribution& __y)
+        {return !(__x == __y);}
+
+    template <class _CharT, class _Traits, class _RT>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const normal_distribution<_RT>& __x);
+
+    template <class _CharT, class _Traits, class _RT>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               normal_distribution<_RT>& __x);
+};
+
+template <class _RealType>
+template<class _URNG>
+_RealType
+normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
+{
+    result_type _Up;
+    if (_V_hot_)
+    {
+        _V_hot_ = false;
+        _Up = _V_;
+    }
+    else
+    {
+        uniform_real_distribution<result_type> _Uni(-1, 1);
+        result_type __u;
+        result_type __v;
+        result_type __s;
+        do
+        {
+            __u = _Uni(__g);
+            __v = _Uni(__g);
+            __s = __u * __u + __v * __v;
+        } while (__s > 1 || __s == 0);
+        result_type _Fp = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s);
+        _V_ = __v * _Fp;
+        _V_hot_ = true;
+        _Up = __u * _Fp;
+    }
+    return _Up * __p.stddev() + __p.mean();
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const normal_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    __os << __x.mean() << __sp << __x.stddev() << __sp << __x._V_hot_;
+    if (__x._V_hot_)
+        __os << __sp << __x._V_;
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           normal_distribution<_RT>& __x)
+{
+    typedef normal_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __mean;
+    result_type __stddev;
+    result_type _Vp = 0;
+    bool _V_hot = false;
+    __is >> __mean >> __stddev >> _V_hot;
+    if (_V_hot)
+        __is >> _Vp;
+    if (!__is.fail())
+    {
+        __x.param(param_type(__mean, __stddev));
+        __x._V_hot_ = _V_hot;
+        __x._V_ = _Vp;
+    }
+    return __is;
+}
+
+// lognormal_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY lognormal_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        normal_distribution<result_type> __nd_;
+    public:
+        typedef lognormal_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __m = 0, result_type __s = 1)
+            : __nd_(__m, __s) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type m() const {return __nd_.mean();}
+        _LIBCPP_INLINE_VISIBILITY
+        result_type s() const {return __nd_.stddev();}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__nd_ == __y.__nd_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+        friend class lognormal_distribution;
+
+        template <class _CharT, class _Traits, class _RT>
+        friend
+        basic_ostream<_CharT, _Traits>&
+        operator<<(basic_ostream<_CharT, _Traits>& __os,
+                   const lognormal_distribution<_RT>& __x);
+
+        template <class _CharT, class _Traits, class _RT>
+        friend
+        basic_istream<_CharT, _Traits>&
+        operator>>(basic_istream<_CharT, _Traits>& __is,
+                   lognormal_distribution<_RT>& __x);
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit lognormal_distribution(result_type __m = 0, result_type __s = 1)
+        : __p_(param_type(__m, __s)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit lognormal_distribution(const param_type& __p)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {__p_.__nd_.reset();}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g, const param_type& __p)
+        {return _VSTD::exp(const_cast<normal_distribution<result_type>&>(__p.__nd_)(__g));}
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type m() const {return __p_.m();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type s() const {return __p_.s();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::infinity();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const lognormal_distribution& __x,
+                        const lognormal_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const lognormal_distribution& __x,
+                        const lognormal_distribution& __y)
+        {return !(__x == __y);}
+
+    template <class _CharT, class _Traits, class _RT>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const lognormal_distribution<_RT>& __x);
+
+    template <class _CharT, class _Traits, class _RT>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               lognormal_distribution<_RT>& __x);
+};
+
+template <class _CharT, class _Traits, class _RT>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const lognormal_distribution<_RT>& __x)
+{
+    return __os << __x.__p_.__nd_;
+}
+
+template <class _CharT, class _Traits, class _RT>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           lognormal_distribution<_RT>& __x)
+{
+    return __is >> __x.__p_.__nd_;
+}
+
+// poisson_distribution
+
+template<class _IntType = int>
+class _LIBCPP_TYPE_VIS_ONLY poisson_distribution
+{
+public:
+    // types
+    typedef _IntType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        double __mean_;
+        double __s_;
+        double __d_;
+        double __l_;
+        double __omega_;
+        double __c0_;
+        double __c1_;
+        double __c2_;
+        double __c3_;
+        double __c_;
+
+    public:
+        typedef poisson_distribution distribution_type;
+
+        explicit param_type(double __mean = 1.0);
+
+        _LIBCPP_INLINE_VISIBILITY
+        double mean() const {return __mean_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__mean_ == __y.__mean_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+
+        friend class poisson_distribution;
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructors and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit poisson_distribution(double __mean = 1.0) : __p_(__mean) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit poisson_distribution(const param_type& __p) : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    double mean() const {return __p_.mean();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::max();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const poisson_distribution& __x,
+                        const poisson_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const poisson_distribution& __x,
+                        const poisson_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template<class _IntType>
+poisson_distribution<_IntType>::param_type::param_type(double __mean)
+    : __mean_(__mean)
+{
+    if (__mean_ < 10)
+    {
+        __s_ = 0;
+        __d_ = 0;
+        __l_ = _VSTD::exp(-__mean_);
+        __omega_ = 0;
+        __c3_ = 0;
+        __c2_ = 0;
+        __c1_ = 0;
+        __c0_ = 0;
+        __c_ = 0;
+    }
+    else
+    {
+        __s_ = _VSTD::sqrt(__mean_);
+        __d_ = 6 * __mean_ * __mean_;
+        __l_ = static_cast<result_type>(__mean_ - 1.1484);
+        __omega_ = .3989423 / __s_;
+        double __b1_ = .4166667E-1 / __mean_;
+        double __b2_ = .3 * __b1_ * __b1_;
+        __c3_ = .1428571 * __b1_ * __b2_;
+        __c2_ = __b2_ - 15. * __c3_;
+        __c1_ = __b1_ - 6. * __b2_ + 45. * __c3_;
+        __c0_ = 1. - __b1_ + 3. * __b2_ - 15. * __c3_;
+        __c_ = .1069 / __mean_;
+    }
+}
+
+template <class _IntType>
+template<class _URNG>
+_IntType
+poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr)
+{
+    result_type __x;
+    uniform_real_distribution<double> __urd;
+    if (__pr.__mean_ < 10)
+    {
+         __x = 0;
+        for (double __p = __urd(__urng); __p > __pr.__l_; ++__x)
+            __p *= __urd(__urng);
+    }
+    else
+    {
+        double __difmuk;
+        double __g = __pr.__mean_ + __pr.__s_ * normal_distribution<double>()(__urng);
+        double __u;
+        if (__g > 0)
+        {
+            __x = static_cast<result_type>(__g);
+            if (__x >= __pr.__l_)
+                return __x;
+            __difmuk = __pr.__mean_ - __x;
+            __u = __urd(__urng);
+            if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk)
+                return __x;
+        }
+        exponential_distribution<double> __edist;
+        for (bool __using_exp_dist = false; true; __using_exp_dist = true)
+        {
+            double __e;
+            if (__using_exp_dist || __g < 0)
+            {
+                double __t;
+                do
+                {
+                    __e = __edist(__urng);
+                    __u = __urd(__urng);
+                    __u += __u - 1;
+                    __t = 1.8 + (__u < 0 ? -__e : __e);
+                } while (__t <= -.6744);
+                __x = __pr.__mean_ + __pr.__s_ * __t;
+                __difmuk = __pr.__mean_ - __x;
+                __using_exp_dist = true;
+            }
+            double __px;
+            double __py;
+            if (__x < 10)
+            {
+                const result_type __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040,
+                                             40320, 362880};
+                __px = -__pr.__mean_;
+                __py = _VSTD::pow(__pr.__mean_, (double)__x) / __fac[__x];
+            }
+            else
+            {
+                double __del = .8333333E-1 / __x;
+                __del -= 4.8 * __del * __del * __del;
+                double __v = __difmuk / __x;
+                if (_VSTD::abs(__v) > 0.25)
+                    __px = __x * _VSTD::log(1 + __v) - __difmuk - __del;
+                else
+                    __px = __x * __v * __v * (((((((.1250060 * __v + -.1384794) *
+                           __v + .1421878) * __v + -.1661269) * __v + .2000118) *
+                           __v + -.2500068) * __v + .3333333) * __v + -.5) - __del;
+                __py = .3989423 / _VSTD::sqrt(__x);
+            }
+            double __r = (0.5 - __difmuk) / __pr.__s_;
+            double __r2 = __r * __r;
+            double __fx = -0.5 * __r2;
+            double __fy = __pr.__omega_ * (((__pr.__c3_ * __r2 + __pr.__c2_) *
+                                        __r2 + __pr.__c1_) * __r2 + __pr.__c0_);
+            if (__using_exp_dist)
+            {
+                if (__pr.__c_ * _VSTD::abs(__u) <= __py * _VSTD::exp(__px + __e) -
+                                                   __fy * _VSTD::exp(__fx + __e))
+                    break;
+            }
+            else
+            {
+                if (__fy - __u * __fy <= __py * _VSTD::exp(__px - __fx))
+                    break;
+            }
+        }
+    }
+    return __x;
+}
+
+template <class _CharT, class _Traits, class _IntType>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const poisson_distribution<_IntType>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    return __os << __x.mean();
+}
+
+template <class _CharT, class _Traits, class _IntType>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           poisson_distribution<_IntType>& __x)
+{
+    typedef poisson_distribution<_IntType> _Eng;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    double __mean;
+    __is >> __mean;
+    if (!__is.fail())
+        __x.param(param_type(__mean));
+    return __is;
+}
+
+// weibull_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY weibull_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __a_;
+        result_type __b_;
+    public:
+        typedef weibull_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __a = 1, result_type __b = 1)
+            : __a_(__a), __b_(__b) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type a() const {return __a_;}
+        _LIBCPP_INLINE_VISIBILITY
+        result_type b() const {return __b_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit weibull_distribution(result_type __a = 1, result_type __b = 1)
+        : __p_(param_type(__a, __b)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit weibull_distribution(const param_type& __p)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g, const param_type& __p)
+        {return __p.b() *
+            _VSTD::pow(exponential_distribution<result_type>()(__g), 1/__p.a());}
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type a() const {return __p_.a();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type b() const {return __p_.b();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::infinity();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const weibull_distribution& __x,
+                        const weibull_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const weibull_distribution& __x,
+                        const weibull_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const weibull_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    __os << __x.a() << __sp << __x.b();
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           weibull_distribution<_RT>& __x)
+{
+    typedef weibull_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __a;
+    result_type __b;
+    __is >> __a >> __b;
+    if (!__is.fail())
+        __x.param(param_type(__a, __b));
+    return __is;
+}
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY extreme_value_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __a_;
+        result_type __b_;
+    public:
+        typedef extreme_value_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __a = 0, result_type __b = 1)
+            : __a_(__a), __b_(__b) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type a() const {return __a_;}
+        _LIBCPP_INLINE_VISIBILITY
+        result_type b() const {return __b_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit extreme_value_distribution(result_type __a = 0, result_type __b = 1)
+        : __p_(param_type(__a, __b)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit extreme_value_distribution(const param_type& __p)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type a() const {return __p_.a();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type b() const {return __p_.b();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return -numeric_limits<result_type>::infinity();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::infinity();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const extreme_value_distribution& __x,
+                        const extreme_value_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const extreme_value_distribution& __x,
+                        const extreme_value_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template<class _RealType>
+template<class _URNG>
+_RealType
+extreme_value_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
+{
+    return __p.a() - __p.b() *
+         _VSTD::log(-_VSTD::log(1-uniform_real_distribution<result_type>()(__g)));
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const extreme_value_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    __os << __x.a() << __sp << __x.b();
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           extreme_value_distribution<_RT>& __x)
+{
+    typedef extreme_value_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __a;
+    result_type __b;
+    __is >> __a >> __b;
+    if (!__is.fail())
+        __x.param(param_type(__a, __b));
+    return __is;
+}
+
+// gamma_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY gamma_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __alpha_;
+        result_type __beta_;
+    public:
+        typedef gamma_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __alpha = 1, result_type __beta = 1)
+            : __alpha_(__alpha), __beta_(__beta) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type alpha() const {return __alpha_;}
+        _LIBCPP_INLINE_VISIBILITY
+        result_type beta() const {return __beta_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__alpha_ == __y.__alpha_ && __x.__beta_ == __y.__beta_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructors and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit gamma_distribution(result_type __alpha = 1, result_type __beta = 1)
+        : __p_(param_type(__alpha, __beta)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit gamma_distribution(const param_type& __p)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type alpha() const {return __p_.alpha();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type beta() const {return __p_.beta();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::infinity();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const gamma_distribution& __x,
+                        const gamma_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const gamma_distribution& __x,
+                        const gamma_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template <class _RealType>
+template<class _URNG>
+_RealType
+gamma_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
+{
+    result_type __a = __p.alpha();
+    uniform_real_distribution<result_type> __gen(0, 1);
+    exponential_distribution<result_type> __egen;
+    result_type __x;
+    if (__a == 1)
+        __x = __egen(__g);
+    else if (__a > 1)
+    {
+        const result_type __b = __a - 1;
+        const result_type __c = 3 * __a - result_type(0.75);
+        while (true)
+        {
+            const result_type __u = __gen(__g);
+            const result_type __v = __gen(__g);
+            const result_type __w = __u * (1 - __u);
+            if (__w != 0)
+            {
+                const result_type __y = _VSTD::sqrt(__c / __w) *
+                                        (__u - result_type(0.5));
+                __x = __b + __y;
+                if (__x >= 0)
+                {
+                    const result_type __z = 64 * __w * __w * __w * __v * __v;
+                    if (__z <= 1 - 2 * __y * __y / __x)
+                        break;
+                    if (_VSTD::log(__z) <= 2 * (__b * _VSTD::log(__x / __b) - __y))
+                        break;
+                }
+            }
+        }
+    }
+    else  // __a < 1
+    {
+        while (true)
+        {
+            const result_type __u = __gen(__g);
+            const result_type __es = __egen(__g);
+            if (__u <= 1 - __a)
+            {
+                __x = _VSTD::pow(__u, 1 / __a);
+                if (__x <= __es)
+                    break;
+            }
+            else
+            {
+                const result_type __e = -_VSTD::log((1-__u)/__a);
+                __x = _VSTD::pow(1 - __a + __a * __e, 1 / __a);
+                if (__x <= __e + __es)
+                    break;
+            }
+        }
+    }
+    return __x * __p.beta();
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const gamma_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    __os << __x.alpha() << __sp << __x.beta();
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           gamma_distribution<_RT>& __x)
+{
+    typedef gamma_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __alpha;
+    result_type __beta;
+    __is >> __alpha >> __beta;
+    if (!__is.fail())
+        __x.param(param_type(__alpha, __beta));
+    return __is;
+}
+
+// negative_binomial_distribution
+
+template<class _IntType = int>
+class _LIBCPP_TYPE_VIS_ONLY negative_binomial_distribution
+{
+public:
+    // types
+    typedef _IntType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __k_;
+        double __p_;
+    public:
+        typedef negative_binomial_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __k = 1, double __p = 0.5)
+            : __k_(__k), __p_(__p) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type k() const {return __k_;}
+        _LIBCPP_INLINE_VISIBILITY
+        double p() const {return __p_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__k_ == __y.__k_ && __x.__p_ == __y.__p_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit negative_binomial_distribution(result_type __k = 1, double __p = 0.5)
+        : __p_(__k, __p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit negative_binomial_distribution(const param_type& __p) : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type k() const {return __p_.k();}
+    _LIBCPP_INLINE_VISIBILITY
+    double p() const {return __p_.p();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::max();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const negative_binomial_distribution& __x,
+                        const negative_binomial_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const negative_binomial_distribution& __x,
+                        const negative_binomial_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template <class _IntType>
+template<class _URNG>
+_IntType
+negative_binomial_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr)
+{
+    result_type __k = __pr.k();
+    double __p = __pr.p();
+    if (__k <= 21 * __p)
+    {
+        bernoulli_distribution __gen(__p);
+        result_type __f = 0;
+        result_type __s = 0;
+        while (__s < __k)
+        {
+            if (__gen(__urng))
+                ++__s;
+            else
+                ++__f;
+        }
+        return __f;
+    }
+    return poisson_distribution<result_type>(gamma_distribution<double>
+                                            (__k, (1-__p)/__p)(__urng))(__urng);
+}
+
+template <class _CharT, class _Traits, class _IntType>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const negative_binomial_distribution<_IntType>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    return __os << __x.k() << __sp << __x.p();
+}
+
+template <class _CharT, class _Traits, class _IntType>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           negative_binomial_distribution<_IntType>& __x)
+{
+    typedef negative_binomial_distribution<_IntType> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __k;
+    double __p;
+    __is >> __k >> __p;
+    if (!__is.fail())
+        __x.param(param_type(__k, __p));
+    return __is;
+}
+
+// geometric_distribution
+
+template<class _IntType = int>
+class _LIBCPP_TYPE_VIS_ONLY geometric_distribution
+{
+public:
+    // types
+    typedef _IntType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        double __p_;
+    public:
+        typedef geometric_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(double __p = 0.5) : __p_(__p) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        double p() const {return __p_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__p_ == __y.__p_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructors and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit geometric_distribution(double __p = 0.5) : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit geometric_distribution(const param_type& __p) : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g, const param_type& __p)
+        {return negative_binomial_distribution<result_type>(1, __p.p())(__g);}
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    double p() const {return __p_.p();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::max();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const geometric_distribution& __x,
+                        const geometric_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const geometric_distribution& __x,
+                        const geometric_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template <class _CharT, class _Traits, class _IntType>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const geometric_distribution<_IntType>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    return __os << __x.p();
+}
+
+template <class _CharT, class _Traits, class _IntType>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           geometric_distribution<_IntType>& __x)
+{
+    typedef geometric_distribution<_IntType> _Eng;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    double __p;
+    __is >> __p;
+    if (!__is.fail())
+        __x.param(param_type(__p));
+    return __is;
+}
+
+// chi_squared_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY chi_squared_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __n_;
+    public:
+        typedef chi_squared_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __n = 1) : __n_(__n) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type n() const {return __n_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__n_ == __y.__n_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit chi_squared_distribution(result_type __n = 1)
+        : __p_(param_type(__n)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit chi_squared_distribution(const param_type& __p)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g, const param_type& __p)
+        {return gamma_distribution<result_type>(__p.n() / 2, 2)(__g);}
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type n() const {return __p_.n();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::infinity();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const chi_squared_distribution& __x,
+                        const chi_squared_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const chi_squared_distribution& __x,
+                        const chi_squared_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const chi_squared_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    __os << __x.n();
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           chi_squared_distribution<_RT>& __x)
+{
+    typedef chi_squared_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __n;
+    __is >> __n;
+    if (!__is.fail())
+        __x.param(param_type(__n));
+    return __is;
+}
+
+// cauchy_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY cauchy_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __a_;
+        result_type __b_;
+    public:
+        typedef cauchy_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __a = 0, result_type __b = 1)
+            : __a_(__a), __b_(__b) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type a() const {return __a_;}
+        _LIBCPP_INLINE_VISIBILITY
+        result_type b() const {return __b_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit cauchy_distribution(result_type __a = 0, result_type __b = 1)
+        : __p_(param_type(__a, __b)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit cauchy_distribution(const param_type& __p)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type a() const {return __p_.a();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type b() const {return __p_.b();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return -numeric_limits<result_type>::infinity();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::infinity();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const cauchy_distribution& __x,
+                        const cauchy_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const cauchy_distribution& __x,
+                        const cauchy_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template <class _RealType>
+template<class _URNG>
+inline _LIBCPP_INLINE_VISIBILITY
+_RealType
+cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
+{
+    uniform_real_distribution<result_type> __gen;
+    // purposefully let tan arg get as close to pi/2 as it wants, tan will return a finite
+    return __p.a() + __p.b() * _VSTD::tan(3.1415926535897932384626433832795 * __gen(__g));
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const cauchy_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    __os << __x.a() << __sp << __x.b();
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           cauchy_distribution<_RT>& __x)
+{
+    typedef cauchy_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __a;
+    result_type __b;
+    __is >> __a >> __b;
+    if (!__is.fail())
+        __x.param(param_type(__a, __b));
+    return __is;
+}
+
+// fisher_f_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY fisher_f_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __m_;
+        result_type __n_;
+    public:
+        typedef fisher_f_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __m = 1, result_type __n = 1)
+            : __m_(__m), __n_(__n) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type m() const {return __m_;}
+        _LIBCPP_INLINE_VISIBILITY
+        result_type n() const {return __n_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit fisher_f_distribution(result_type __m = 1, result_type __n = 1)
+        : __p_(param_type(__m, __n)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit fisher_f_distribution(const param_type& __p)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type m() const {return __p_.m();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type n() const {return __p_.n();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::infinity();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const fisher_f_distribution& __x,
+                        const fisher_f_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const fisher_f_distribution& __x,
+                        const fisher_f_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template <class _RealType>
+template<class _URNG>
+_RealType
+fisher_f_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
+{
+    gamma_distribution<result_type> __gdm(__p.m() * result_type(.5));
+    gamma_distribution<result_type> __gdn(__p.n() * result_type(.5));
+    return __p.n() * __gdm(__g) / (__p.m() * __gdn(__g));
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const fisher_f_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    __os << __x.m() << __sp << __x.n();
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           fisher_f_distribution<_RT>& __x)
+{
+    typedef fisher_f_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __m;
+    result_type __n;
+    __is >> __m >> __n;
+    if (!__is.fail())
+        __x.param(param_type(__m, __n));
+    return __is;
+}
+
+// student_t_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY student_t_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        result_type __n_;
+    public:
+        typedef student_t_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        explicit param_type(result_type __n = 1) : __n_(__n) {}
+
+        _LIBCPP_INLINE_VISIBILITY
+        result_type n() const {return __n_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__n_ == __y.__n_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+    };
+
+private:
+    param_type __p_;
+    normal_distribution<result_type> __nd_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    explicit student_t_distribution(result_type __n = 1)
+        : __p_(param_type(__n)) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit student_t_distribution(const param_type& __p)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {__nd_.reset();}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    result_type n() const {return __p_.n();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return -numeric_limits<result_type>::infinity();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return numeric_limits<result_type>::infinity();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const student_t_distribution& __x,
+                        const student_t_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const student_t_distribution& __x,
+                        const student_t_distribution& __y)
+        {return !(__x == __y);}
+};
+
+template <class _RealType>
+template<class _URNG>
+_RealType
+student_t_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
+{
+    gamma_distribution<result_type> __gd(__p.n() * .5, 2);
+    return __nd_(__g) * _VSTD::sqrt(__p.n()/__gd(__g));
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const student_t_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    __os << __x.n();
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           student_t_distribution<_RT>& __x)
+{
+    typedef student_t_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    typedef typename _Eng::param_type param_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    result_type __n;
+    __is >> __n;
+    if (!__is.fail())
+        __x.param(param_type(__n));
+    return __is;
+}
+
+// discrete_distribution
+
+template<class _IntType = int>
+class _LIBCPP_TYPE_VIS_ONLY discrete_distribution
+{
+public:
+    // types
+    typedef _IntType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        vector<double> __p_;
+    public:
+        typedef discrete_distribution distribution_type;
+
+        _LIBCPP_INLINE_VISIBILITY
+        param_type() {}
+        template<class _InputIterator>
+            _LIBCPP_INLINE_VISIBILITY
+            param_type(_InputIterator __f, _InputIterator __l)
+            : __p_(__f, __l) {__init();}
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+        _LIBCPP_INLINE_VISIBILITY
+        param_type(initializer_list<double> __wl)
+            : __p_(__wl.begin(), __wl.end()) {__init();}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+        template<class _UnaryOperation>
+            param_type(size_t __nw, double __xmin, double __xmax,
+                       _UnaryOperation __fw);
+
+        vector<double> probabilities() const;
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__p_ == __y.__p_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+
+    private:
+        void __init();
+
+        friend class discrete_distribution;
+
+        template <class _CharT, class _Traits, class _IT>
+        friend
+        basic_ostream<_CharT, _Traits>&
+        operator<<(basic_ostream<_CharT, _Traits>& __os,
+                   const discrete_distribution<_IT>& __x);
+
+        template <class _CharT, class _Traits, class _IT>
+        friend
+        basic_istream<_CharT, _Traits>&
+        operator>>(basic_istream<_CharT, _Traits>& __is,
+                   discrete_distribution<_IT>& __x);
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    discrete_distribution() {}
+    template<class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        discrete_distribution(_InputIterator __f, _InputIterator __l)
+            : __p_(__f, __l) {}
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    discrete_distribution(initializer_list<double> __wl)
+        : __p_(__wl) {}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    template<class _UnaryOperation>
+        _LIBCPP_INLINE_VISIBILITY
+        discrete_distribution(size_t __nw, double __xmin, double __xmax,
+                              _UnaryOperation __fw)
+        : __p_(__nw, __xmin, __xmax, __fw) {}
+    _LIBCPP_INLINE_VISIBILITY
+    explicit discrete_distribution(const param_type& __p)
+        : __p_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    vector<double> probabilities() const {return __p_.probabilities();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return __p_.__p_.size();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const discrete_distribution& __x,
+                        const discrete_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const discrete_distribution& __x,
+                        const discrete_distribution& __y)
+        {return !(__x == __y);}
+
+    template <class _CharT, class _Traits, class _IT>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const discrete_distribution<_IT>& __x);
+
+    template <class _CharT, class _Traits, class _IT>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               discrete_distribution<_IT>& __x);
+};
+
+template<class _IntType>
+template<class _UnaryOperation>
+discrete_distribution<_IntType>::param_type::param_type(size_t __nw,
+                                                        double __xmin,
+                                                        double __xmax,
+                                                        _UnaryOperation __fw)
+{
+    if (__nw > 1)
+    {
+        __p_.reserve(__nw - 1);
+        double __d = (__xmax - __xmin) / __nw;
+        double __d2 = __d / 2;
+        for (size_t __k = 0; __k < __nw; ++__k)
+            __p_.push_back(__fw(__xmin + __k * __d + __d2));
+        __init();
+    }
+}
+
+template<class _IntType>
+void
+discrete_distribution<_IntType>::param_type::__init()
+{
+    if (!__p_.empty())
+    {
+        if (__p_.size() > 1)
+        {
+            double __s = _VSTD::accumulate(__p_.begin(), __p_.end(), 0.0);
+            for (_VSTD::vector<double>::iterator __i = __p_.begin(), __e = __p_.end();
+                                                                       __i < __e; ++__i)
+                *__i /= __s;
+            vector<double> __t(__p_.size() - 1);
+            _VSTD::partial_sum(__p_.begin(), __p_.end() - 1, __t.begin());
+            swap(__p_, __t);
+        }
+        else
+        {
+            __p_.clear();
+            __p_.shrink_to_fit();
+        }
+    }
+}
+
+template<class _IntType>
+vector<double>
+discrete_distribution<_IntType>::param_type::probabilities() const
+{
+    size_t __n = __p_.size();
+    _VSTD::vector<double> __p(__n+1);
+    _VSTD::adjacent_difference(__p_.begin(), __p_.end(), __p.begin());
+    if (__n > 0)
+        __p[__n] = 1 - __p_[__n-1];
+    else
+        __p[0] = 1;
+    return __p;
+}
+
+template<class _IntType>
+template<class _URNG>
+_IntType
+discrete_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p)
+{
+    uniform_real_distribution<double> __gen;
+    return static_cast<_IntType>(
+           _VSTD::upper_bound(__p.__p_.begin(), __p.__p_.end(), __gen(__g)) -
+                                                              __p.__p_.begin());
+}
+
+template <class _CharT, class _Traits, class _IT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const discrete_distribution<_IT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    size_t __n = __x.__p_.__p_.size();
+    __os << __n;
+    for (size_t __i = 0; __i < __n; ++__i)
+        __os << __sp << __x.__p_.__p_[__i];
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _IT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           discrete_distribution<_IT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    size_t __n;
+    __is >> __n;
+    vector<double> __p(__n);
+    for (size_t __i = 0; __i < __n; ++__i)
+        __is >> __p[__i];
+    if (!__is.fail())
+        swap(__x.__p_.__p_, __p);
+    return __is;
+}
+
+// piecewise_constant_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY piecewise_constant_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        vector<result_type> __b_;
+        vector<result_type> __densities_;
+        vector<result_type> __areas_;
+    public:
+        typedef piecewise_constant_distribution distribution_type;
+
+        param_type();
+        template<class _InputIteratorB, class _InputIteratorW>
+            param_type(_InputIteratorB __fB, _InputIteratorB __lB,
+                       _InputIteratorW __fW);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+        template<class _UnaryOperation>
+            param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+        template<class _UnaryOperation>
+            param_type(size_t __nw, result_type __xmin, result_type __xmax,
+                       _UnaryOperation __fw);
+        param_type & operator=(const param_type& __rhs);
+
+        _LIBCPP_INLINE_VISIBILITY
+        vector<result_type> intervals() const {return __b_;}
+        _LIBCPP_INLINE_VISIBILITY
+        vector<result_type> densities() const {return __densities_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+
+    private:
+        void __init();
+
+        friend class piecewise_constant_distribution;
+
+        template <class _CharT, class _Traits, class _RT>
+        friend
+        basic_ostream<_CharT, _Traits>&
+        operator<<(basic_ostream<_CharT, _Traits>& __os,
+                   const piecewise_constant_distribution<_RT>& __x);
+
+        template <class _CharT, class _Traits, class _RT>
+        friend
+        basic_istream<_CharT, _Traits>&
+        operator>>(basic_istream<_CharT, _Traits>& __is,
+                   piecewise_constant_distribution<_RT>& __x);
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    piecewise_constant_distribution() {}
+    template<class _InputIteratorB, class _InputIteratorW>
+        _LIBCPP_INLINE_VISIBILITY
+        piecewise_constant_distribution(_InputIteratorB __fB,
+                                        _InputIteratorB __lB,
+                                        _InputIteratorW __fW)
+        : __p_(__fB, __lB, __fW) {}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    template<class _UnaryOperation>
+        _LIBCPP_INLINE_VISIBILITY
+        piecewise_constant_distribution(initializer_list<result_type> __bl,
+                                        _UnaryOperation __fw)
+        : __p_(__bl, __fw) {}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    template<class _UnaryOperation>
+        _LIBCPP_INLINE_VISIBILITY
+        piecewise_constant_distribution(size_t __nw, result_type __xmin,
+                                        result_type __xmax, _UnaryOperation __fw)
+        : __p_(__nw, __xmin, __xmax, __fw) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit piecewise_constant_distribution(const param_type& __p)
+        : __p_(__p) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    vector<result_type> intervals() const {return __p_.intervals();}
+    _LIBCPP_INLINE_VISIBILITY
+    vector<result_type> densities() const {return __p_.densities();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return __p_.__b_.front();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return __p_.__b_.back();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const piecewise_constant_distribution& __x,
+                        const piecewise_constant_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const piecewise_constant_distribution& __x,
+                           const piecewise_constant_distribution& __y)
+        {return !(__x == __y);}
+
+    template <class _CharT, class _Traits, class _RT>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const piecewise_constant_distribution<_RT>& __x);
+
+    template <class _CharT, class _Traits, class _RT>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               piecewise_constant_distribution<_RT>& __x);
+};
+
+template<class _RealType>
+typename piecewise_constant_distribution<_RealType>::param_type &
+piecewise_constant_distribution<_RealType>::param_type::operator=
+                                                       (const param_type& __rhs)
+{
+//  These can throw
+    __b_.reserve        (__rhs.__b_.size ());
+    __densities_.reserve(__rhs.__densities_.size());
+    __areas_.reserve    (__rhs.__areas_.size());
+
+//  These can not throw
+    __b_         = __rhs.__b_;
+    __densities_ = __rhs.__densities_;
+    __areas_     =  __rhs.__areas_;
+    return *this;
+}
+
+template<class _RealType>
+void
+piecewise_constant_distribution<_RealType>::param_type::__init()
+{
+    // __densities_ contains non-normalized areas
+    result_type __total_area = _VSTD::accumulate(__densities_.begin(),
+                                                __densities_.end(),
+                                                result_type());
+    for (size_t __i = 0; __i < __densities_.size(); ++__i)
+        __densities_[__i] /= __total_area;
+    // __densities_ contains normalized areas
+    __areas_.assign(__densities_.size(), result_type());
+    _VSTD::partial_sum(__densities_.begin(), __densities_.end() - 1,
+                                                          __areas_.begin() + 1);
+    // __areas_ contains partial sums of normalized areas: [0, __densities_ - 1]
+    __densities_.back() = 1 - __areas_.back();  // correct round off error
+    for (size_t __i = 0; __i < __densities_.size(); ++__i)
+        __densities_[__i] /= (__b_[__i+1] - __b_[__i]);
+    // __densities_ now contains __densities_
+}
+
+template<class _RealType>
+piecewise_constant_distribution<_RealType>::param_type::param_type()
+    : __b_(2),
+      __densities_(1, 1.0),
+      __areas_(1, 0.0)
+{
+    __b_[1] = 1;
+}
+
+template<class _RealType>
+template<class _InputIteratorB, class _InputIteratorW>
+piecewise_constant_distribution<_RealType>::param_type::param_type(
+        _InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW)
+    : __b_(__fB, __lB)
+{
+    if (__b_.size() < 2)
+    {
+        __b_.resize(2);
+        __b_[0] = 0;
+        __b_[1] = 1;
+        __densities_.assign(1, 1.0);
+        __areas_.assign(1, 0.0);
+    }
+    else
+    {
+        __densities_.reserve(__b_.size() - 1);
+        for (size_t __i = 0; __i < __b_.size() - 1; ++__i, ++__fW)
+            __densities_.push_back(*__fW);
+        __init();
+    }
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template<class _RealType>
+template<class _UnaryOperation>
+piecewise_constant_distribution<_RealType>::param_type::param_type(
+        initializer_list<result_type> __bl, _UnaryOperation __fw)
+    : __b_(__bl.begin(), __bl.end())
+{
+    if (__b_.size() < 2)
+    {
+        __b_.resize(2);
+        __b_[0] = 0;
+        __b_[1] = 1;
+        __densities_.assign(1, 1.0);
+        __areas_.assign(1, 0.0);
+    }
+    else
+    {
+        __densities_.reserve(__b_.size() - 1);
+        for (size_t __i = 0; __i < __b_.size() - 1; ++__i)
+            __densities_.push_back(__fw((__b_[__i+1] + __b_[__i])*.5));
+        __init();
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template<class _RealType>
+template<class _UnaryOperation>
+piecewise_constant_distribution<_RealType>::param_type::param_type(
+        size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
+    : __b_(__nw == 0 ? 2 : __nw + 1)
+{
+    size_t __n = __b_.size() - 1;
+    result_type __d = (__xmax - __xmin) / __n;
+    __densities_.reserve(__n);
+    for (size_t __i = 0; __i < __n; ++__i)
+    {
+        __b_[__i] = __xmin + __i * __d;
+        __densities_.push_back(__fw(__b_[__i] + __d*.5));
+    }
+    __b_[__n] = __xmax;
+    __init();
+}
+
+template<class _RealType>
+template<class _URNG>
+_RealType
+piecewise_constant_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
+{
+    typedef uniform_real_distribution<result_type> _Gen;
+    result_type __u = _Gen()(__g);
+    ptrdiff_t __k = _VSTD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
+                                      __u) - __p.__areas_.begin() - 1;
+    return (__u - __p.__areas_[__k]) / __p.__densities_[__k] + __p.__b_[__k];
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const piecewise_constant_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    size_t __n = __x.__p_.__b_.size();
+    __os << __n;
+    for (size_t __i = 0; __i < __n; ++__i)
+        __os << __sp << __x.__p_.__b_[__i];
+    __n = __x.__p_.__densities_.size();
+    __os << __sp << __n;
+    for (size_t __i = 0; __i < __n; ++__i)
+        __os << __sp << __x.__p_.__densities_[__i];
+    __n = __x.__p_.__areas_.size();
+    __os << __sp << __n;
+    for (size_t __i = 0; __i < __n; ++__i)
+        __os << __sp << __x.__p_.__areas_[__i];
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           piecewise_constant_distribution<_RT>& __x)
+{
+    typedef piecewise_constant_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    size_t __n;
+    __is >> __n;
+    vector<result_type> __b(__n);
+    for (size_t __i = 0; __i < __n; ++__i)
+        __is >> __b[__i];
+    __is >> __n;
+    vector<result_type> __densities(__n);
+    for (size_t __i = 0; __i < __n; ++__i)
+        __is >> __densities[__i];
+    __is >> __n;
+    vector<result_type> __areas(__n);
+    for (size_t __i = 0; __i < __n; ++__i)
+        __is >> __areas[__i];
+    if (!__is.fail())
+    {
+        swap(__x.__p_.__b_, __b);
+        swap(__x.__p_.__densities_, __densities);
+        swap(__x.__p_.__areas_, __areas);
+    }
+    return __is;
+}
+
+// piecewise_linear_distribution
+
+template<class _RealType = double>
+class _LIBCPP_TYPE_VIS_ONLY piecewise_linear_distribution
+{
+public:
+    // types
+    typedef _RealType result_type;
+
+    class _LIBCPP_TYPE_VIS_ONLY param_type
+    {
+        vector<result_type> __b_;
+        vector<result_type> __densities_;
+        vector<result_type> __areas_;
+    public:
+        typedef piecewise_linear_distribution distribution_type;
+
+        param_type();
+        template<class _InputIteratorB, class _InputIteratorW>
+            param_type(_InputIteratorB __fB, _InputIteratorB __lB,
+                       _InputIteratorW __fW);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+        template<class _UnaryOperation>
+            param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+        template<class _UnaryOperation>
+            param_type(size_t __nw, result_type __xmin, result_type __xmax,
+                       _UnaryOperation __fw);
+        param_type & operator=(const param_type& __rhs);
+        
+        _LIBCPP_INLINE_VISIBILITY
+        vector<result_type> intervals() const {return __b_;}
+        _LIBCPP_INLINE_VISIBILITY
+        vector<result_type> densities() const {return __densities_;}
+
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator==(const param_type& __x, const param_type& __y)
+            {return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;}
+        friend _LIBCPP_INLINE_VISIBILITY
+            bool operator!=(const param_type& __x, const param_type& __y)
+            {return !(__x == __y);}
+
+    private:
+        void __init();
+
+        friend class piecewise_linear_distribution;
+
+        template <class _CharT, class _Traits, class _RT>
+        friend
+        basic_ostream<_CharT, _Traits>&
+        operator<<(basic_ostream<_CharT, _Traits>& __os,
+                   const piecewise_linear_distribution<_RT>& __x);
+
+        template <class _CharT, class _Traits, class _RT>
+        friend
+        basic_istream<_CharT, _Traits>&
+        operator>>(basic_istream<_CharT, _Traits>& __is,
+                   piecewise_linear_distribution<_RT>& __x);
+    };
+
+private:
+    param_type __p_;
+
+public:
+    // constructor and reset functions
+    _LIBCPP_INLINE_VISIBILITY
+    piecewise_linear_distribution() {}
+    template<class _InputIteratorB, class _InputIteratorW>
+        _LIBCPP_INLINE_VISIBILITY
+        piecewise_linear_distribution(_InputIteratorB __fB,
+                                      _InputIteratorB __lB,
+                                      _InputIteratorW __fW)
+        : __p_(__fB, __lB, __fW) {}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    template<class _UnaryOperation>
+        _LIBCPP_INLINE_VISIBILITY
+        piecewise_linear_distribution(initializer_list<result_type> __bl,
+                                      _UnaryOperation __fw)
+        : __p_(__bl, __fw) {}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    template<class _UnaryOperation>
+        _LIBCPP_INLINE_VISIBILITY
+        piecewise_linear_distribution(size_t __nw, result_type __xmin,
+                                      result_type __xmax, _UnaryOperation __fw)
+        : __p_(__nw, __xmin, __xmax, __fw) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit piecewise_linear_distribution(const param_type& __p)
+        : __p_(__p) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void reset() {}
+
+    // generating functions
+    template<class _URNG>
+        _LIBCPP_INLINE_VISIBILITY
+        result_type operator()(_URNG& __g)
+        {return (*this)(__g, __p_);}
+    template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+
+    // property functions
+    _LIBCPP_INLINE_VISIBILITY
+    vector<result_type> intervals() const {return __p_.intervals();}
+    _LIBCPP_INLINE_VISIBILITY
+    vector<result_type> densities() const {return __p_.densities();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    param_type param() const {return __p_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void param(const param_type& __p) {__p_ = __p;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const {return __p_.__b_.front();}
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const {return __p_.__b_.back();}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const piecewise_linear_distribution& __x,
+                        const piecewise_linear_distribution& __y)
+        {return __x.__p_ == __y.__p_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const piecewise_linear_distribution& __x,
+                        const piecewise_linear_distribution& __y)
+        {return !(__x == __y);}
+
+    template <class _CharT, class _Traits, class _RT>
+    friend
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+               const piecewise_linear_distribution<_RT>& __x);
+
+    template <class _CharT, class _Traits, class _RT>
+    friend
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is,
+               piecewise_linear_distribution<_RT>& __x);
+};
+
+template<class _RealType>
+typename piecewise_linear_distribution<_RealType>::param_type &
+piecewise_linear_distribution<_RealType>::param_type::operator=
+                                                       (const param_type& __rhs)
+{
+//  These can throw
+    __b_.reserve        (__rhs.__b_.size ());
+    __densities_.reserve(__rhs.__densities_.size());
+    __areas_.reserve    (__rhs.__areas_.size());
+
+//  These can not throw
+    __b_         = __rhs.__b_;
+    __densities_ = __rhs.__densities_;
+    __areas_     =  __rhs.__areas_;
+    return *this;
+}
+
+
+template<class _RealType>
+void
+piecewise_linear_distribution<_RealType>::param_type::__init()
+{
+    __areas_.assign(__densities_.size() - 1, result_type());
+    result_type _Sp = 0;
+    for (size_t __i = 0; __i < __areas_.size(); ++__i)
+    {
+        __areas_[__i] = (__densities_[__i+1] + __densities_[__i]) *
+                        (__b_[__i+1] - __b_[__i]) * .5;
+        _Sp += __areas_[__i];
+    }
+    for (size_t __i = __areas_.size(); __i > 1;)
+    {
+        --__i;
+        __areas_[__i] = __areas_[__i-1] / _Sp;
+    }
+    __areas_[0] = 0;
+    for (size_t __i = 1; __i < __areas_.size(); ++__i)
+        __areas_[__i] += __areas_[__i-1];
+    for (size_t __i = 0; __i < __densities_.size(); ++__i)
+        __densities_[__i] /= _Sp;
+}
+
+template<class _RealType>
+piecewise_linear_distribution<_RealType>::param_type::param_type()
+    : __b_(2),
+      __densities_(2, 1.0),
+      __areas_(1, 0.0)
+{
+    __b_[1] = 1;
+}
+
+template<class _RealType>
+template<class _InputIteratorB, class _InputIteratorW>
+piecewise_linear_distribution<_RealType>::param_type::param_type(
+        _InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW)
+    : __b_(__fB, __lB)
+{
+    if (__b_.size() < 2)
+    {
+        __b_.resize(2);
+        __b_[0] = 0;
+        __b_[1] = 1;
+        __densities_.assign(2, 1.0);
+        __areas_.assign(1, 0.0);
+    }
+    else
+    {
+        __densities_.reserve(__b_.size());
+        for (size_t __i = 0; __i < __b_.size(); ++__i, ++__fW)
+            __densities_.push_back(*__fW);
+        __init();
+    }
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template<class _RealType>
+template<class _UnaryOperation>
+piecewise_linear_distribution<_RealType>::param_type::param_type(
+        initializer_list<result_type> __bl, _UnaryOperation __fw)
+    : __b_(__bl.begin(), __bl.end())
+{
+    if (__b_.size() < 2)
+    {
+        __b_.resize(2);
+        __b_[0] = 0;
+        __b_[1] = 1;
+        __densities_.assign(2, 1.0);
+        __areas_.assign(1, 0.0);
+    }
+    else
+    {
+        __densities_.reserve(__b_.size());
+        for (size_t __i = 0; __i < __b_.size(); ++__i)
+            __densities_.push_back(__fw(__b_[__i]));
+        __init();
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template<class _RealType>
+template<class _UnaryOperation>
+piecewise_linear_distribution<_RealType>::param_type::param_type(
+        size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
+    : __b_(__nw == 0 ? 2 : __nw + 1)
+{
+    size_t __n = __b_.size() - 1;
+    result_type __d = (__xmax - __xmin) / __n;
+    __densities_.reserve(__b_.size());
+    for (size_t __i = 0; __i < __n; ++__i)
+    {
+        __b_[__i] = __xmin + __i * __d;
+        __densities_.push_back(__fw(__b_[__i]));
+    }
+    __b_[__n] = __xmax;
+    __densities_.push_back(__fw(__b_[__n]));
+    __init();
+}
+
+template<class _RealType>
+template<class _URNG>
+_RealType
+piecewise_linear_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
+{
+    typedef uniform_real_distribution<result_type> _Gen;
+    result_type __u = _Gen()(__g);
+    ptrdiff_t __k = _VSTD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
+                                      __u) - __p.__areas_.begin() - 1;
+    __u -= __p.__areas_[__k];
+    const result_type __dk = __p.__densities_[__k];
+    const result_type __dk1 = __p.__densities_[__k+1];
+    const result_type __deltad = __dk1 - __dk;
+    const result_type __bk = __p.__b_[__k];
+    if (__deltad == 0)
+        return __u / __dk + __bk;
+    const result_type __bk1 = __p.__b_[__k+1];
+    const result_type __deltab = __bk1 - __bk;
+    return (__bk * __dk1 - __bk1 * __dk +
+        _VSTD::sqrt(__deltab * (__deltab * __dk * __dk + 2 * __deltad * __u))) /
+        __deltad;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const piecewise_linear_distribution<_RT>& __x)
+{
+    __save_flags<_CharT, _Traits> __lx(__os);
+    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
+               ios_base::scientific);
+    _CharT __sp = __os.widen(' ');
+    __os.fill(__sp);
+    size_t __n = __x.__p_.__b_.size();
+    __os << __n;
+    for (size_t __i = 0; __i < __n; ++__i)
+        __os << __sp << __x.__p_.__b_[__i];
+    __n = __x.__p_.__densities_.size();
+    __os << __sp << __n;
+    for (size_t __i = 0; __i < __n; ++__i)
+        __os << __sp << __x.__p_.__densities_[__i];
+    __n = __x.__p_.__areas_.size();
+    __os << __sp << __n;
+    for (size_t __i = 0; __i < __n; ++__i)
+        __os << __sp << __x.__p_.__areas_[__i];
+    return __os;
+}
+
+template <class _CharT, class _Traits, class _RT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           piecewise_linear_distribution<_RT>& __x)
+{
+    typedef piecewise_linear_distribution<_RT> _Eng;
+    typedef typename _Eng::result_type result_type;
+    __save_flags<_CharT, _Traits> __lx(__is);
+    __is.flags(ios_base::dec | ios_base::skipws);
+    size_t __n;
+    __is >> __n;
+    vector<result_type> __b(__n);
+    for (size_t __i = 0; __i < __n; ++__i)
+        __is >> __b[__i];
+    __is >> __n;
+    vector<result_type> __densities(__n);
+    for (size_t __i = 0; __i < __n; ++__i)
+        __is >> __densities[__i];
+    __is >> __n;
+    vector<result_type> __areas(__n);
+    for (size_t __i = 0; __i < __n; ++__i)
+        __is >> __areas[__i];
+    if (!__is.fail())
+    {
+        swap(__x.__p_.__b_, __b);
+        swap(__x.__p_.__densities_, __densities);
+        swap(__x.__p_.__areas_, __areas);
+    }
+    return __is;
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_RANDOM

Property changes on: lab4/.minix-src/include/c++/random
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/scoped_allocator
===================================================================
--- lab4/.minix-src/include/c++/scoped_allocator	(nonexistent)
+++ lab4/.minix-src/include/c++/scoped_allocator	(revision 13)
@@ -0,0 +1,600 @@
+// -*- C++ -*-
+//===-------------------------- scoped_allocator --------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SCOPED_ALLOCATOR
+#define _LIBCPP_SCOPED_ALLOCATOR
+
+/*
+    scoped_allocator synopsis
+
+namespace std
+{
+
+template <class OuterAlloc, class... InnerAllocs>
+class scoped_allocator_adaptor : public OuterAlloc
+{
+    typedef allocator_traits<OuterAlloc> OuterTraits; // exposition only
+    scoped_allocator_adaptor<InnerAllocs...> inner;   // exposition only
+public:
+
+    typedef OuterAlloc outer_allocator_type;
+    typedef see below inner_allocator_type;
+
+    typedef typename OuterTraits::value_type value_type;
+    typedef typename OuterTraits::size_type size_type;
+    typedef typename OuterTraits::difference_type difference_type;
+    typedef typename OuterTraits::pointer pointer;
+    typedef typename OuterTraits::const_pointer const_pointer;
+    typedef typename OuterTraits::void_pointer void_pointer;
+    typedef typename OuterTraits::const_void_pointer const_void_pointer;
+
+    typedef see below propagate_on_container_copy_assignment;
+    typedef see below propagate_on_container_move_assignment;
+    typedef see below propagate_on_container_swap;
+    typedef see below is_always_equal;
+
+    template <class Tp>
+        struct rebind
+        {
+            typedef scoped_allocator_adaptor<
+                OuterTraits::template rebind_alloc<Tp>, InnerAllocs...> other;
+        };
+
+    scoped_allocator_adaptor();
+    template <class OuterA2>
+        scoped_allocator_adaptor(OuterA2&& outerAlloc,
+                                 const InnerAllocs&... innerAllocs) noexcept;
+    scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept;
+    scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept;
+    template <class OuterA2>
+        scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept;
+    template <class OuterA2>
+        scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
+
+    ~scoped_allocator_adaptor();
+
+    inner_allocator_type& inner_allocator() noexcept;
+    const inner_allocator_type& inner_allocator() const noexcept;
+
+    outer_allocator_type& outer_allocator() noexcept;
+    const outer_allocator_type& outer_allocator() const noexcept;
+
+    pointer allocate(size_type n);
+    pointer allocate(size_type n, const_void_pointer hint);
+    void deallocate(pointer p, size_type n) noexcept;
+
+    size_type max_size() const;
+    template <class T, class... Args> void construct(T* p, Args&& args);
+    template <class T1, class T2, class... Args1, class... Args2>
+        void construct(pair<T1, T2>* p, piecewise_construct t, tuple<Args1...> x,
+                       tuple<Args2...> y);
+    template <class T1, class T2>
+        void construct(pair<T1, T2>* p);
+    template <class T1, class T2, class U, class V>
+        void construct(pair<T1, T2>* p, U&& x, V&& y);
+    template <class T1, class T2, class U, class V>
+        void construct(pair<T1, T2>* p, const pair<U, V>& x);
+    template <class T1, class T2, class U, class V>
+        void construct(pair<T1, T2>* p, pair<U, V>&& x);
+    template <class T> void destroy(T* p);
+
+    template <class T> void destroy(T* p) noexcept;
+
+    scoped_allocator_adaptor select_on_container_copy_construction() const noexcept;
+};
+
+template <class OuterA1, class OuterA2, class... InnerAllocs>
+    bool
+    operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
+               const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
+
+template <class OuterA1, class OuterA2, class... InnerAllocs>
+    bool
+    operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
+               const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
+
+}  // std
+
+*/
+
+#include <__config>
+#include <memory>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
+
+// scoped_allocator_adaptor
+
+template <class ..._Allocs>
+class scoped_allocator_adaptor;
+
+template <class ..._Allocs> struct __get_poc_copy_assignment;
+
+template <class _A0>
+struct __get_poc_copy_assignment<_A0>
+{
+    static const bool value = allocator_traits<_A0>::
+                              propagate_on_container_copy_assignment::value;
+};
+
+template <class _A0, class ..._Allocs>
+struct __get_poc_copy_assignment<_A0, _Allocs...>
+{
+    static const bool value =
+        allocator_traits<_A0>::propagate_on_container_copy_assignment::value ||
+        __get_poc_copy_assignment<_Allocs...>::value;
+};
+
+template <class ..._Allocs> struct __get_poc_move_assignment;
+
+template <class _A0>
+struct __get_poc_move_assignment<_A0>
+{
+    static const bool value = allocator_traits<_A0>::
+                              propagate_on_container_move_assignment::value;
+};
+
+template <class _A0, class ..._Allocs>
+struct __get_poc_move_assignment<_A0, _Allocs...>
+{
+    static const bool value =
+        allocator_traits<_A0>::propagate_on_container_move_assignment::value ||
+        __get_poc_move_assignment<_Allocs...>::value;
+};
+
+template <class ..._Allocs> struct __get_poc_swap;
+
+template <class _A0>
+struct __get_poc_swap<_A0>
+{
+    static const bool value = allocator_traits<_A0>::
+                              propagate_on_container_swap::value;
+};
+
+template <class _A0, class ..._Allocs>
+struct __get_poc_swap<_A0, _Allocs...>
+{
+    static const bool value =
+        allocator_traits<_A0>::propagate_on_container_swap::value ||
+        __get_poc_swap<_Allocs...>::value;
+};
+
+template <class ..._Allocs> struct __get_is_always_equal;
+
+template <class _A0>
+struct __get_is_always_equal<_A0>
+{
+    static const bool value = allocator_traits<_A0>::is_always_equal::value;
+};
+
+template <class _A0, class ..._Allocs>
+struct __get_is_always_equal<_A0, _Allocs...>
+{
+    static const bool value =
+        allocator_traits<_A0>::is_always_equal::value &&
+        __get_is_always_equal<_Allocs...>::value;
+};
+
+template <class ..._Allocs>
+class __scoped_allocator_storage;
+
+template <class _OuterAlloc, class... _InnerAllocs>
+class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
+    : public _OuterAlloc
+{
+    typedef _OuterAlloc outer_allocator_type;
+protected:
+    typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type;
+
+private:
+    inner_allocator_type __inner_;
+
+protected:
+
+    _LIBCPP_INLINE_VISIBILITY
+    __scoped_allocator_storage() _NOEXCEPT {}
+
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, _OuterA2>::value
+                      >::type>
+        _LIBCPP_INLINE_VISIBILITY
+        __scoped_allocator_storage(_OuterA2&& __outerAlloc,
+                                   const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
+            : outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)),
+              __inner_(__innerAllocs...) {}
+
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, const _OuterA2&>::value
+                      >::type>
+        _LIBCPP_INLINE_VISIBILITY
+        __scoped_allocator_storage(
+            const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
+            : outer_allocator_type(__other.outer_allocator()),
+              __inner_(__other.inner_allocator()) {}
+
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, _OuterA2>::value
+                      >::type>
+        _LIBCPP_INLINE_VISIBILITY
+        __scoped_allocator_storage(
+            __scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
+            : outer_allocator_type(_VSTD::move(__other.outer_allocator())),
+              __inner_(_VSTD::move(__other.inner_allocator())) {}
+
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, _OuterA2>::value
+                      >::type>
+        _LIBCPP_INLINE_VISIBILITY
+        __scoped_allocator_storage(_OuterA2&& __o,
+                                   const inner_allocator_type& __i) _NOEXCEPT
+            : outer_allocator_type(_VSTD::forward<_OuterA2>(__o)),
+              __inner_(__i)
+        {
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    inner_allocator_type& inner_allocator() _NOEXCEPT             {return __inner_;}
+    _LIBCPP_INLINE_VISIBILITY
+    const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    outer_allocator_type& outer_allocator() _NOEXCEPT
+        {return static_cast<outer_allocator_type&>(*this);}
+    _LIBCPP_INLINE_VISIBILITY
+    const outer_allocator_type& outer_allocator() const _NOEXCEPT
+        {return static_cast<const outer_allocator_type&>(*this);}
+
+    scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
+    _LIBCPP_INLINE_VISIBILITY
+    select_on_container_copy_construction() const _NOEXCEPT
+        {
+            return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
+            (
+                allocator_traits<outer_allocator_type>::
+                    select_on_container_copy_construction(outer_allocator()),
+                allocator_traits<inner_allocator_type>::
+                    select_on_container_copy_construction(inner_allocator())
+            );
+        }
+
+    template <class...> friend class __scoped_allocator_storage;
+};
+
+template <class _OuterAlloc>
+class __scoped_allocator_storage<_OuterAlloc>
+    : public _OuterAlloc
+{
+    typedef _OuterAlloc outer_allocator_type;
+protected:
+    typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __scoped_allocator_storage() _NOEXCEPT {}
+
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, _OuterA2>::value
+                      >::type>
+        _LIBCPP_INLINE_VISIBILITY
+        __scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT
+            : outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)) {}
+
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, const _OuterA2&>::value
+                      >::type>
+        _LIBCPP_INLINE_VISIBILITY
+        __scoped_allocator_storage(
+            const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
+            : outer_allocator_type(__other.outer_allocator()) {}
+
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, _OuterA2>::value
+                      >::type>
+        _LIBCPP_INLINE_VISIBILITY
+        __scoped_allocator_storage(
+            __scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
+            : outer_allocator_type(_VSTD::move(__other.outer_allocator())) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    inner_allocator_type& inner_allocator() _NOEXCEPT
+        {return static_cast<inner_allocator_type&>(*this);}
+    _LIBCPP_INLINE_VISIBILITY
+    const inner_allocator_type& inner_allocator() const _NOEXCEPT
+        {return static_cast<const inner_allocator_type&>(*this);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    outer_allocator_type& outer_allocator() _NOEXCEPT
+        {return static_cast<outer_allocator_type&>(*this);}
+    _LIBCPP_INLINE_VISIBILITY
+    const outer_allocator_type& outer_allocator() const _NOEXCEPT
+        {return static_cast<const outer_allocator_type&>(*this);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    scoped_allocator_adaptor<outer_allocator_type>
+    select_on_container_copy_construction() const _NOEXCEPT
+        {return scoped_allocator_adaptor<outer_allocator_type>(
+            allocator_traits<outer_allocator_type>::
+                select_on_container_copy_construction(outer_allocator())
+        );}
+
+    __scoped_allocator_storage(const outer_allocator_type& __o,
+                               const inner_allocator_type& __i) _NOEXCEPT;
+
+    template <class...> friend class __scoped_allocator_storage;
+};
+
+// __outermost
+
+template <class _Alloc>
+decltype(declval<_Alloc>().outer_allocator(), true_type())
+__has_outer_allocator_test(_Alloc&& __a);
+
+template <class _Alloc>
+false_type
+__has_outer_allocator_test(const volatile _Alloc& __a);
+
+template <class _Alloc>
+struct __has_outer_allocator
+    : public common_type
+             <
+                 decltype(__has_outer_allocator_test(declval<_Alloc&>()))
+             >::type
+{
+};
+
+template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
+struct __outermost
+{
+    typedef _Alloc type;
+    _LIBCPP_INLINE_VISIBILITY
+    type& operator()(type& __a) const _NOEXCEPT {return __a;}
+};
+
+template <class _Alloc>
+struct __outermost<_Alloc, true>
+{
+    typedef typename remove_reference
+                     <
+                        decltype(_VSTD::declval<_Alloc>().outer_allocator())
+                     >::type                                    _OuterAlloc;
+    typedef typename __outermost<_OuterAlloc>::type             type;
+    _LIBCPP_INLINE_VISIBILITY
+    type& operator()(_Alloc& __a) const _NOEXCEPT
+        {return __outermost<_OuterAlloc>()(__a.outer_allocator());}
+};
+
+template <class _OuterAlloc, class... _InnerAllocs>
+class _LIBCPP_TYPE_VIS_ONLY scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
+    : public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
+{
+    typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
+    typedef allocator_traits<_OuterAlloc>             _OuterTraits;
+public:
+    typedef _OuterAlloc                               outer_allocator_type;
+    typedef typename base::inner_allocator_type       inner_allocator_type;
+    typedef typename _OuterTraits::size_type          size_type;
+    typedef typename _OuterTraits::difference_type    difference_type;
+    typedef typename _OuterTraits::pointer            pointer;
+    typedef typename _OuterTraits::const_pointer      const_pointer;
+    typedef typename _OuterTraits::void_pointer       void_pointer;
+    typedef typename _OuterTraits::const_void_pointer const_void_pointer;
+
+    typedef integral_constant
+            <
+                bool,
+                __get_poc_copy_assignment<outer_allocator_type,
+                                          _InnerAllocs...>::value
+            > propagate_on_container_copy_assignment;
+    typedef integral_constant
+            <
+                bool,
+                __get_poc_move_assignment<outer_allocator_type,
+                                          _InnerAllocs...>::value
+            > propagate_on_container_move_assignment;
+    typedef integral_constant
+            <
+                bool,
+                __get_poc_swap<outer_allocator_type, _InnerAllocs...>::value
+            > propagate_on_container_swap;
+    typedef integral_constant
+            <
+                bool,
+                __get_is_always_equal<outer_allocator_type, _InnerAllocs...>::value
+            > is_always_equal;
+
+    template <class _Tp>
+    struct rebind
+    {
+        typedef scoped_allocator_adaptor
+        <
+            typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs...
+        > other;
+    };
+
+    _LIBCPP_INLINE_VISIBILITY
+    scoped_allocator_adaptor() _NOEXCEPT {}
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, _OuterA2>::value
+                      >::type>
+        _LIBCPP_INLINE_VISIBILITY
+        scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
+                                 const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
+            : base(_VSTD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
+    // scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, const _OuterA2&>::value
+                      >::type>
+        _LIBCPP_INLINE_VISIBILITY
+        scoped_allocator_adaptor(
+            const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
+                : base(__other) {}
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, _OuterA2>::value
+                      >::type>
+        _LIBCPP_INLINE_VISIBILITY
+        scoped_allocator_adaptor(
+            scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
+                : base(_VSTD::move(__other)) {}
+
+    // ~scoped_allocator_adaptor() = default;
+
+    _LIBCPP_INLINE_VISIBILITY
+    inner_allocator_type& inner_allocator() _NOEXCEPT
+        {return base::inner_allocator();}
+    _LIBCPP_INLINE_VISIBILITY
+    const inner_allocator_type& inner_allocator() const _NOEXCEPT
+        {return base::inner_allocator();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    outer_allocator_type& outer_allocator() _NOEXCEPT
+        {return base::outer_allocator();}
+    _LIBCPP_INLINE_VISIBILITY
+    const outer_allocator_type& outer_allocator() const _NOEXCEPT
+        {return base::outer_allocator();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    pointer allocate(size_type __n)
+        {return allocator_traits<outer_allocator_type>::
+            allocate(outer_allocator(), __n);}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer allocate(size_type __n, const_void_pointer __hint)
+        {return allocator_traits<outer_allocator_type>::
+            allocate(outer_allocator(), __n, __hint);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void deallocate(pointer __p, size_type __n) _NOEXCEPT
+        {allocator_traits<outer_allocator_type>::
+            deallocate(outer_allocator(), __p, __n);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const
+        {return allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
+
+    template <class _Tp, class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        void construct(_Tp* __p, _Args&& ...__args)
+            {__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
+                         __p, _VSTD::forward<_Args>(__args)...);}
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        void destroy(_Tp* __p)
+            {
+                typedef __outermost<outer_allocator_type> _OM;
+                allocator_traits<typename _OM::type>::
+                                         destroy(_OM()(outer_allocator()), __p);
+            }
+
+    _LIBCPP_INLINE_VISIBILITY
+    scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT
+        {return base::select_on_container_copy_construction();}
+
+private:
+
+    template <class _OuterA2,
+              class = typename enable_if<
+                        is_constructible<outer_allocator_type, _OuterA2>::value
+                      >::type>
+    _LIBCPP_INLINE_VISIBILITY
+    scoped_allocator_adaptor(_OuterA2&& __o,
+                             const inner_allocator_type& __i) _NOEXCEPT
+        : base(_VSTD::forward<_OuterA2>(__o), __i) {}
+
+    template <class _Tp, class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        void __construct(integral_constant<int, 0>, _Tp* __p, _Args&& ...__args)
+            {
+                typedef __outermost<outer_allocator_type> _OM;
+                allocator_traits<typename _OM::type>::construct
+                (
+                    _OM()(outer_allocator()),
+                    __p,
+                    _VSTD::forward<_Args>(__args)...
+                );
+            }
+
+    template <class _Tp, class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        void __construct(integral_constant<int, 1>, _Tp* __p, _Args&& ...__args)
+            {
+                typedef __outermost<outer_allocator_type> _OM;
+                allocator_traits<typename _OM::type>::construct
+                (
+                    _OM()(outer_allocator()),
+                    __p,
+                    allocator_arg,
+                    inner_allocator(),
+                    _VSTD::forward<_Args>(__args)...
+                );
+            }
+
+    template <class _Tp, class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        void __construct(integral_constant<int, 2>, _Tp* __p, _Args&& ...__args)
+            {
+                typedef __outermost<outer_allocator_type> _OM;
+                allocator_traits<typename _OM::type>::construct
+                (
+                    _OM()(outer_allocator()),
+                    __p,
+                    _VSTD::forward<_Args>(__args)...,
+                    inner_allocator()
+                );
+            }
+
+    template <class...> friend class __scoped_allocator_storage;
+};
+
+template <class _OuterA1, class _OuterA2>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
+           const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT
+{
+    return __a.outer_allocator() == __b.outer_allocator();
+}
+
+template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
+           const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT
+{
+    return __a.outer_allocator() == __b.outer_allocator() &&
+           __a.inner_allocator() == __b.inner_allocator();
+}
+
+template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
+           const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT
+{
+    return !(__a == __b);
+}
+
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_SCOPED_ALLOCATOR

Property changes on: lab4/.minix-src/include/c++/scoped_allocator
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/sstream
===================================================================
--- lab4/.minix-src/include/c++/sstream	(nonexistent)
+++ lab4/.minix-src/include/c++/sstream	(revision 13)
@@ -0,0 +1,977 @@
+// -*- C++ -*-
+//===--------------------------- sstream ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SSTREAM
+#define _LIBCPP_SSTREAM
+
+/*
+    sstream synopsis
+
+template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+class basic_stringbuf
+    : public basic_streambuf<charT, traits>
+{
+public:
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+    typedef Allocator                      allocator_type;
+
+    // 27.8.1.1 Constructors:
+    explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out);
+    explicit basic_stringbuf(const basic_string<char_type, traits_type, allocator_type>& str,
+                             ios_base::openmode which = ios_base::in | ios_base::out);
+    basic_stringbuf(basic_stringbuf&& rhs);
+
+    // 27.8.1.2 Assign and swap:
+    basic_stringbuf& operator=(basic_stringbuf&& rhs);
+    void swap(basic_stringbuf& rhs);
+
+    // 27.8.1.3 Get and set:
+    basic_string<char_type, traits_type, allocator_type> str() const;
+    void str(const basic_string<char_type, traits_type, allocator_type>& s);
+
+protected:
+    // 27.8.1.4 Overridden virtual functions:
+    virtual int_type underflow();
+    virtual int_type pbackfail(int_type c = traits_type::eof());
+    virtual int_type overflow (int_type c = traits_type::eof());
+    virtual basic_streambuf<char_type, traits_type>* setbuf(char_type*, streamsize);
+    virtual pos_type seekoff(off_type off, ios_base::seekdir way,
+                             ios_base::openmode which = ios_base::in | ios_base::out);
+    virtual pos_type seekpos(pos_type sp,
+                             ios_base::openmode which = ios_base::in | ios_base::out);
+};
+
+template <class charT, class traits, class Allocator>
+  void swap(basic_stringbuf<charT, traits, Allocator>& x,
+            basic_stringbuf<charT, traits, Allocator>& y);
+
+typedef basic_stringbuf<char>    stringbuf;
+typedef basic_stringbuf<wchar_t> wstringbuf;
+
+template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+class basic_istringstream
+    : public basic_istream<charT, traits>
+{
+public:
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+    typedef Allocator                      allocator_type;
+
+    // 27.8.2.1 Constructors:
+    explicit basic_istringstream(ios_base::openmode which = ios_base::in);
+    explicit basic_istringstream(const basic_string<char_type, traits_type,allocator_type>& str,
+                                 ios_base::openmode which = ios_base::in);
+    basic_istringstream(basic_istringstream&& rhs);
+
+    // 27.8.2.2 Assign and swap:
+    basic_istringstream& operator=(basic_istringstream&& rhs);
+    void swap(basic_istringstream& rhs);
+
+    // 27.8.2.3 Members:
+    basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
+    basic_string<char_type, traits_type, allocator_type> str() const;
+    void str(const basic_string<char_type, traits_type, allocator_type>& s);
+};
+
+template <class charT, class traits, class Allocator>
+  void swap(basic_istringstream<charT, traits, Allocator>& x,
+            basic_istringstream<charT, traits, Allocator>& y);
+
+typedef basic_istringstream<char>    istringstream;
+typedef basic_istringstream<wchar_t> wistringstream;
+
+template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+class basic_ostringstream
+    : public basic_ostream<charT, traits>
+{
+public:
+    // types:
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+    typedef Allocator                      allocator_type;
+
+    // 27.8.3.1 Constructors/destructor:
+    explicit basic_ostringstream(ios_base::openmode which = ios_base::out);
+    explicit basic_ostringstream(const basic_string<char_type, traits_type, allocator_type>& str,
+                                 ios_base::openmode which = ios_base::out);
+    basic_ostringstream(basic_ostringstream&& rhs);
+
+    // 27.8.3.2 Assign/swap:
+    basic_ostringstream& operator=(basic_ostringstream&& rhs);
+    void swap(basic_ostringstream& rhs);
+
+    // 27.8.3.3 Members:
+    basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
+    basic_string<char_type, traits_type, allocator_type> str() const;
+    void str(const basic_string<char_type, traits_type, allocator_type>& s);
+};
+
+template <class charT, class traits, class Allocator>
+  void swap(basic_ostringstream<charT, traits, Allocator>& x,
+            basic_ostringstream<charT, traits, Allocator>& y);
+
+typedef basic_ostringstream<char>    ostringstream;
+typedef basic_ostringstream<wchar_t> wostringstream;
+
+template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+class basic_stringstream
+    : public basic_iostream<charT, traits>
+{
+public:
+    // types:
+    typedef charT                          char_type;
+    typedef traits                         traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+    typedef Allocator                      allocator_type;
+
+    // constructors/destructor
+    explicit basic_stringstream(ios_base::openmode which = ios_base::out|ios_base::in);
+    explicit basic_stringstream(const basic_string<char_type, traits_type, allocator_type>& str,
+                                ios_base::openmode which = ios_base::out|ios_base::in);
+    basic_stringstream(basic_stringstream&& rhs);
+
+    // 27.8.5.1 Assign/swap:
+    basic_stringstream& operator=(basic_stringstream&& rhs);
+    void swap(basic_stringstream& rhs);
+
+    // Members:
+    basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
+    basic_string<char_type, traits_type, allocator_type> str() const;
+    void str(const basic_string<char_type, traits_type, allocator_type>& str);
+};
+
+template <class charT, class traits, class Allocator>
+  void swap(basic_stringstream<charT, traits, Allocator>& x,
+            basic_stringstream<charT, traits, Allocator>& y);
+
+typedef basic_stringstream<char>    stringstream;
+typedef basic_stringstream<wchar_t> wstringstream;
+
+}  // std
+
+*/
+
+#include <__config>
+#include <ostream>
+#include <istream>
+#include <string>
+
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// basic_stringbuf
+
+template <class _CharT, class _Traits, class _Allocator>
+class _LIBCPP_TYPE_VIS_ONLY basic_stringbuf
+    : public basic_streambuf<_CharT, _Traits>
+{
+public:
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+    typedef _Allocator                     allocator_type;
+
+    typedef basic_string<char_type, traits_type, allocator_type> string_type;
+
+private:
+
+    string_type __str_;
+    mutable char_type* __hm_;
+    ios_base::openmode __mode_;
+
+public:
+    // 27.8.1.1 Constructors:
+    explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out);
+    explicit basic_stringbuf(const string_type& __s,
+                             ios_base::openmode __wch = ios_base::in | ios_base::out);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_stringbuf(basic_stringbuf&& __rhs);
+#endif
+
+    // 27.8.1.2 Assign and swap:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_stringbuf& operator=(basic_stringbuf&& __rhs);
+#endif
+    void swap(basic_stringbuf& __rhs);
+
+    // 27.8.1.3 Get and set:
+    string_type str() const;
+    void str(const string_type& __s);
+
+protected:
+    // 27.8.1.4 Overridden virtual functions:
+    virtual int_type underflow();
+    virtual int_type pbackfail(int_type __c = traits_type::eof());
+    virtual int_type overflow (int_type __c = traits_type::eof());
+    virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
+                             ios_base::openmode __wch = ios_base::in | ios_base::out);
+    virtual pos_type seekpos(pos_type __sp,
+                             ios_base::openmode __wch = ios_base::in | ios_base::out);
+};
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode __wch)
+    : __hm_(0),
+      __mode_(__wch)
+{
+    str(string_type());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s,
+                             ios_base::openmode __wch)
+    : __hm_(0),
+      __mode_(__wch)
+{
+    str(__s);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
+    : __mode_(__rhs.__mode_)
+{
+    char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
+    ptrdiff_t __binp = -1;
+    ptrdiff_t __ninp = -1;
+    ptrdiff_t __einp = -1;
+    if (__rhs.eback() != nullptr)
+    {
+        __binp = __rhs.eback() - __p;
+        __ninp = __rhs.gptr() - __p;
+        __einp = __rhs.egptr() - __p;
+    }
+    ptrdiff_t __bout = -1;
+    ptrdiff_t __nout = -1;
+    ptrdiff_t __eout = -1;
+    if (__rhs.pbase() != nullptr)
+    {
+        __bout = __rhs.pbase() - __p;
+        __nout = __rhs.pptr() - __p;
+        __eout = __rhs.epptr() - __p;
+    }
+    ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
+    __str_ = _VSTD::move(__rhs.__str_);
+    __p = const_cast<char_type*>(__str_.data());
+    if (__binp != -1)
+        this->setg(__p + __binp, __p + __ninp, __p + __einp);
+    if (__bout != -1)
+    {
+        this->setp(__p + __bout, __p + __eout);
+        this->pbump(__nout);
+    }
+    __hm_ = __hm == -1 ? nullptr : __p + __hm;
+    __p = const_cast<char_type*>(__rhs.__str_.data());
+    __rhs.setg(__p, __p, __p);
+    __rhs.setp(__p, __p);
+    __rhs.__hm_ = __p;
+    this->pubimbue(__rhs.getloc());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_stringbuf<_CharT, _Traits, _Allocator>&
+basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
+{
+    char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
+    ptrdiff_t __binp = -1;
+    ptrdiff_t __ninp = -1;
+    ptrdiff_t __einp = -1;
+    if (__rhs.eback() != nullptr)
+    {
+        __binp = __rhs.eback() - __p;
+        __ninp = __rhs.gptr() - __p;
+        __einp = __rhs.egptr() - __p;
+    }
+    ptrdiff_t __bout = -1;
+    ptrdiff_t __nout = -1;
+    ptrdiff_t __eout = -1;
+    if (__rhs.pbase() != nullptr)
+    {
+        __bout = __rhs.pbase() - __p;
+        __nout = __rhs.pptr() - __p;
+        __eout = __rhs.epptr() - __p;
+    }
+    ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
+    __str_ = _VSTD::move(__rhs.__str_);
+    __p = const_cast<char_type*>(__str_.data());
+    if (__binp != -1)
+        this->setg(__p + __binp, __p + __ninp, __p + __einp);
+    else
+        this->setg(nullptr, nullptr, nullptr);
+    if (__bout != -1)
+    {
+        this->setp(__p + __bout, __p + __eout);
+        this->pbump(__nout);
+    }
+    else
+        this->setp(nullptr, nullptr);
+
+    __hm_ = __hm == -1 ? nullptr : __p + __hm;
+    __mode_ = __rhs.__mode_;
+    __p = const_cast<char_type*>(__rhs.__str_.data());
+    __rhs.setg(__p, __p, __p);
+    __rhs.setp(__p, __p);
+    __rhs.__hm_ = __p;
+    this->pubimbue(__rhs.getloc());
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+void
+basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
+{
+    char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
+    ptrdiff_t __rbinp = -1;
+    ptrdiff_t __rninp = -1;
+    ptrdiff_t __reinp = -1;
+    if (__rhs.eback() != nullptr)
+    {
+        __rbinp = __rhs.eback() - __p;
+        __rninp = __rhs.gptr() - __p;
+        __reinp = __rhs.egptr() - __p;
+    }
+    ptrdiff_t __rbout = -1;
+    ptrdiff_t __rnout = -1;
+    ptrdiff_t __reout = -1;
+    if (__rhs.pbase() != nullptr)
+    {
+        __rbout = __rhs.pbase() - __p;
+        __rnout = __rhs.pptr() - __p;
+        __reout = __rhs.epptr() - __p;
+    }
+    ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
+    __p = const_cast<char_type*>(__str_.data());
+    ptrdiff_t __lbinp = -1;
+    ptrdiff_t __lninp = -1;
+    ptrdiff_t __leinp = -1;
+    if (this->eback() != nullptr)
+    {
+        __lbinp = this->eback() - __p;
+        __lninp = this->gptr() - __p;
+        __leinp = this->egptr() - __p;
+    }
+    ptrdiff_t __lbout = -1;
+    ptrdiff_t __lnout = -1;
+    ptrdiff_t __leout = -1;
+    if (this->pbase() != nullptr)
+    {
+        __lbout = this->pbase() - __p;
+        __lnout = this->pptr() - __p;
+        __leout = this->epptr() - __p;
+    }
+    ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p;
+    _VSTD::swap(__mode_, __rhs.__mode_);
+    __str_.swap(__rhs.__str_);
+    __p = const_cast<char_type*>(__str_.data());
+    if (__rbinp != -1)
+        this->setg(__p + __rbinp, __p + __rninp, __p + __reinp);
+    else
+        this->setg(nullptr, nullptr, nullptr);
+    if (__rbout != -1)
+    {
+        this->setp(__p + __rbout, __p + __reout);
+        this->pbump(__rnout);
+    }
+    else
+        this->setp(nullptr, nullptr);
+    __hm_ = __rhm == -1 ? nullptr : __p + __rhm;
+    __p = const_cast<char_type*>(__rhs.__str_.data());
+    if (__lbinp != -1)
+        __rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp);
+    else
+        __rhs.setg(nullptr, nullptr, nullptr);
+    if (__lbout != -1)
+    {
+        __rhs.setp(__p + __lbout, __p + __leout);
+        __rhs.pbump(__lnout);
+    }
+    else
+        __rhs.setp(nullptr, nullptr);
+    __rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm;
+    locale __tl = __rhs.getloc();
+    __rhs.pubimbue(this->getloc());
+    this->pubimbue(__tl);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
+     basic_stringbuf<_CharT, _Traits, _Allocator>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+basic_stringbuf<_CharT, _Traits, _Allocator>::str() const
+{
+    if (__mode_ & ios_base::out)
+    {
+        if (__hm_ < this->pptr())
+            __hm_ = this->pptr();
+        return string_type(this->pbase(), __hm_, __str_.get_allocator());
+    }
+    else if (__mode_ & ios_base::in)
+        return string_type(this->eback(), this->egptr(), __str_.get_allocator());
+    return string_type(__str_.get_allocator());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+void
+basic_stringbuf<_CharT, _Traits, _Allocator>::str(const string_type& __s)
+{
+    __str_ = __s;
+    __hm_ = 0;
+    if (__mode_ & ios_base::in)
+    {
+        __hm_ = const_cast<char_type*>(__str_.data()) + __str_.size();
+        this->setg(const_cast<char_type*>(__str_.data()),
+                   const_cast<char_type*>(__str_.data()),
+                   __hm_);
+    }
+    if (__mode_ & ios_base::out)
+    {
+        typename string_type::size_type __sz = __str_.size();
+        __hm_ = const_cast<char_type*>(__str_.data()) + __sz;
+        __str_.resize(__str_.capacity());
+        this->setp(const_cast<char_type*>(__str_.data()),
+                   const_cast<char_type*>(__str_.data()) + __str_.size());
+        if (__mode_ & (ios_base::app | ios_base::ate))
+            this->pbump(__sz);
+    }
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type
+basic_stringbuf<_CharT, _Traits, _Allocator>::underflow()
+{
+    if (__hm_ < this->pptr())
+        __hm_ = this->pptr();
+    if (__mode_ & ios_base::in)
+    {
+        if (this->egptr() < __hm_)
+            this->setg(this->eback(), this->gptr(), __hm_);
+        if (this->gptr() < this->egptr())
+            return traits_type::to_int_type(*this->gptr());
+    }
+    return traits_type::eof();
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type
+basic_stringbuf<_CharT, _Traits, _Allocator>::pbackfail(int_type __c)
+{
+    if (__hm_ < this->pptr())
+        __hm_ = this->pptr();
+    if (this->eback() < this->gptr())
+    {
+        if (traits_type::eq_int_type(__c, traits_type::eof()))
+        {
+            this->setg(this->eback(), this->gptr()-1, __hm_);
+            return traits_type::not_eof(__c);
+        }
+        if ((__mode_ & ios_base::out) ||
+            traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
+        {
+            this->setg(this->eback(), this->gptr()-1, __hm_);
+            *this->gptr() = traits_type::to_char_type(__c);
+            return __c;
+        }
+    }
+    return traits_type::eof();
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type
+basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
+{
+    if (!traits_type::eq_int_type(__c, traits_type::eof()))
+    {
+        ptrdiff_t __ninp = this->gptr()  - this->eback();
+        if (this->pptr() == this->epptr())
+        {
+            if (!(__mode_ & ios_base::out))
+                return traits_type::eof();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            try
+            {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+                ptrdiff_t __nout = this->pptr()  - this->pbase();
+                ptrdiff_t __hm = __hm_ - this->pbase();
+                __str_.push_back(char_type());
+                __str_.resize(__str_.capacity());
+                char_type* __p = const_cast<char_type*>(__str_.data());
+                this->setp(__p, __p + __str_.size());
+                this->pbump(__nout);
+                __hm_ = this->pbase() + __hm;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            }
+            catch (...)
+            {
+                return traits_type::eof();
+            }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        }
+        __hm_ = _VSTD::max(this->pptr() + 1, __hm_);
+        if (__mode_ & ios_base::in)
+        {
+            char_type* __p = const_cast<char_type*>(__str_.data());
+            this->setg(__p, __p + __ninp, __hm_);
+        }
+        return this->sputc(__c);
+    }
+    return traits_type::not_eof(__c);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type
+basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
+                                                      ios_base::seekdir __way,
+                                                      ios_base::openmode __wch)
+{
+    if (__hm_ < this->pptr())
+        __hm_ = this->pptr();
+    if ((__wch & (ios_base::in | ios_base::out)) == 0)
+        return pos_type(-1);
+    if ((__wch & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out)
+        && __way == ios_base::cur)
+        return pos_type(-1);
+    off_type __noff;
+    switch (__way)
+    {
+    case ios_base::beg:
+        __noff = 0;
+        break;
+    case ios_base::cur:
+        if (__wch & ios_base::in)
+            __noff = this->gptr() - this->eback();
+        else
+            __noff = this->pptr() - this->pbase();
+        break;
+    case ios_base::end:
+        __noff = __hm_ - __str_.data();
+        break;
+    default:
+        return pos_type(-1);
+    }
+    __noff += __off;
+    if (__noff < 0 || __hm_ - __str_.data() < __noff)
+        return pos_type(-1);
+    if (__noff != 0)
+    {
+        if ((__wch & ios_base::in) && this->gptr() == 0)
+            return pos_type(-1);
+        if ((__wch & ios_base::out) && this->pptr() == 0)
+            return pos_type(-1);
+    }
+    if (__wch & ios_base::in)
+        this->setg(this->eback(), this->eback() + __noff, __hm_);
+    if (__wch & ios_base::out)
+    {
+        this->setp(this->pbase(), this->epptr());
+        this->pbump(__noff);
+    }
+    return pos_type(__noff);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type
+basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
+                                                      ios_base::openmode __wch)
+{
+    return seekoff(__sp, ios_base::beg, __wch);
+}
+
+// basic_istringstream
+
+template <class _CharT, class _Traits, class _Allocator>
+class _LIBCPP_TYPE_VIS_ONLY basic_istringstream
+    : public basic_istream<_CharT, _Traits>
+{
+public:
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+    typedef _Allocator                     allocator_type;
+
+    typedef basic_string<char_type, traits_type, allocator_type> string_type;
+
+private:
+    basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
+
+public:
+    // 27.8.2.1 Constructors:
+    explicit basic_istringstream(ios_base::openmode __wch = ios_base::in);
+    explicit basic_istringstream(const string_type& __s,
+                                 ios_base::openmode __wch = ios_base::in);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_istringstream(basic_istringstream&& __rhs);
+
+    // 27.8.2.2 Assign and swap:
+    basic_istringstream& operator=(basic_istringstream&& __rhs);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void swap(basic_istringstream& __rhs);
+
+    // 27.8.2.3 Members:
+    basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
+    string_type str() const;
+    void str(const string_type& __s);
+};
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(ios_base::openmode __wch)
+    : basic_istream<_CharT, _Traits>(&__sb_),
+      __sb_(__wch | ios_base::in)
+{
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const string_type& __s,
+                                                                      ios_base::openmode __wch)
+    : basic_istream<_CharT, _Traits>(&__sb_),
+      __sb_(__s, __wch | ios_base::in)
+{
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
+    : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)),
+      __sb_(_VSTD::move(__rhs.__sb_))
+{
+    basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_istringstream<_CharT, _Traits, _Allocator>&
+basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs)
+{
+    basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
+    __sb_ = _VSTD::move(__rhs.__sb_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs)
+{
+    basic_istream<char_type, traits_type>::swap(__rhs);
+    __sb_.swap(__rhs.__sb_);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
+     basic_istringstream<_CharT, _Traits, _Allocator>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_stringbuf<_CharT, _Traits, _Allocator>*
+basic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const
+{
+    return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+basic_istringstream<_CharT, _Traits, _Allocator>::str() const
+{
+    return __sb_.str();
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
+{
+    __sb_.str(__s);
+}
+
+// basic_ostringstream
+
+template <class _CharT, class _Traits, class _Allocator>
+class _LIBCPP_TYPE_VIS_ONLY basic_ostringstream
+    : public basic_ostream<_CharT, _Traits>
+{
+public:
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+    typedef _Allocator                     allocator_type;
+
+    typedef basic_string<char_type, traits_type, allocator_type> string_type;
+
+private:
+    basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
+
+public:
+    // 27.8.2.1 Constructors:
+    explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out);
+    explicit basic_ostringstream(const string_type& __s,
+                                 ios_base::openmode __wch = ios_base::out);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_ostringstream(basic_ostringstream&& __rhs);
+
+    // 27.8.2.2 Assign and swap:
+    basic_ostringstream& operator=(basic_ostringstream&& __rhs);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void swap(basic_ostringstream& __rhs);
+
+    // 27.8.2.3 Members:
+    basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
+    string_type str() const;
+    void str(const string_type& __s);
+};
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(ios_base::openmode __wch)
+    : basic_ostream<_CharT, _Traits>(&__sb_),
+      __sb_(__wch | ios_base::out)
+{
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const string_type& __s,
+                                                                      ios_base::openmode __wch)
+    : basic_ostream<_CharT, _Traits>(&__sb_),
+      __sb_(__s, __wch | ios_base::out)
+{
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
+    : basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)),
+      __sb_(_VSTD::move(__rhs.__sb_))
+{
+    basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_ostringstream<_CharT, _Traits, _Allocator>&
+basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs)
+{
+    basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
+    __sb_ = _VSTD::move(__rhs.__sb_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ostringstream<_CharT, _Traits, _Allocator>::swap(basic_ostringstream& __rhs)
+{
+    basic_ostream<char_type, traits_type>::swap(__rhs);
+    __sb_.swap(__rhs.__sb_);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
+     basic_ostringstream<_CharT, _Traits, _Allocator>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_stringbuf<_CharT, _Traits, _Allocator>*
+basic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const
+{
+    return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+basic_ostringstream<_CharT, _Traits, _Allocator>::str() const
+{
+    return __sb_.str();
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
+{
+    __sb_.str(__s);
+}
+
+// basic_stringstream
+
+template <class _CharT, class _Traits, class _Allocator>
+class _LIBCPP_TYPE_VIS_ONLY basic_stringstream
+    : public basic_iostream<_CharT, _Traits>
+{
+public:
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+    typedef _Allocator                     allocator_type;
+
+    typedef basic_string<char_type, traits_type, allocator_type> string_type;
+
+private:
+    basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
+
+public:
+    // 27.8.2.1 Constructors:
+    explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out);
+    explicit basic_stringstream(const string_type& __s,
+                                ios_base::openmode __wch = ios_base::in | ios_base::out);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    basic_stringstream(basic_stringstream&& __rhs);
+
+    // 27.8.2.2 Assign and swap:
+    basic_stringstream& operator=(basic_stringstream&& __rhs);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void swap(basic_stringstream& __rhs);
+
+    // 27.8.2.3 Members:
+    basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
+    string_type str() const;
+    void str(const string_type& __s);
+};
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::openmode __wch)
+    : basic_iostream<_CharT, _Traits>(&__sb_),
+      __sb_(__wch)
+{
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string_type& __s,
+                                                                    ios_base::openmode __wch)
+    : basic_iostream<_CharT, _Traits>(&__sb_),
+      __sb_(__s, __wch)
+{
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
+    : basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)),
+      __sb_(_VSTD::move(__rhs.__sb_))
+{
+    basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_stringstream<_CharT, _Traits, _Allocator>&
+basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs)
+{
+    basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
+    __sb_ = _VSTD::move(__rhs.__sb_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_stringstream<_CharT, _Traits, _Allocator>::swap(basic_stringstream& __rhs)
+{
+    basic_iostream<char_type, traits_type>::swap(__rhs);
+    __sb_.swap(__rhs.__sb_);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
+     basic_stringstream<_CharT, _Traits, _Allocator>& __y)
+{
+    __x.swap(__y);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_stringbuf<_CharT, _Traits, _Allocator>*
+basic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const
+{
+    return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+basic_stringstream<_CharT, _Traits, _Allocator>::str() const
+{
+    return __sb_.str();
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
+{
+    __sb_.str(__s);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_SSTREAM

Property changes on: lab4/.minix-src/include/c++/sstream
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/streambuf
===================================================================
--- lab4/.minix-src/include/c++/streambuf	(nonexistent)
+++ lab4/.minix-src/include/c++/streambuf	(revision 13)
@@ -0,0 +1,575 @@
+// -*- C++ -*-
+//===------------------------- streambuf ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_STEAMBUF
+#define _LIBCPP_STEAMBUF
+
+/*
+    streambuf synopsis
+
+namespace std
+{
+
+template <class charT, class traits = char_traits<charT> >
+class basic_streambuf
+{
+public:
+    // types:
+    typedef charT char_type;
+    typedef traits traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    virtual ~basic_streambuf();
+
+    // 27.6.2.2.1 locales:
+    locale pubimbue(const locale& loc);
+    locale getloc() const;
+
+    // 27.6.2.2.2 buffer and positioning:
+    basic_streambuf* pubsetbuf(char_type* s, streamsize n);
+    pos_type pubseekoff(off_type off, ios_base::seekdir way,
+                        ios_base::openmode which = ios_base::in | ios_base::out);
+    pos_type pubseekpos(pos_type sp,
+                        ios_base::openmode which = ios_base::in | ios_base::out);
+    int pubsync();
+
+    // Get and put areas:
+    // 27.6.2.2.3 Get area:
+    streamsize in_avail();
+    int_type snextc();
+    int_type sbumpc();
+    int_type sgetc();
+    streamsize sgetn(char_type* s, streamsize n);
+
+    // 27.6.2.2.4 Putback:
+    int_type sputbackc(char_type c);
+    int_type sungetc();
+
+    // 27.6.2.2.5 Put area:
+    int_type sputc(char_type c);
+    streamsize sputn(const char_type* s, streamsize n);
+
+protected:
+    basic_streambuf();
+    basic_streambuf(const basic_streambuf& rhs);
+    basic_streambuf& operator=(const basic_streambuf& rhs);
+    void swap(basic_streambuf& rhs);
+
+    // 27.6.2.3.2 Get area:
+    char_type* eback() const;
+    char_type* gptr() const;
+    char_type* egptr() const;
+    void gbump(int n);
+    void setg(char_type* gbeg, char_type* gnext, char_type* gend);
+
+    // 27.6.2.3.3 Put area:
+    char_type* pbase() const;
+    char_type* pptr() const;
+    char_type* epptr() const;
+    void pbump(int n);
+    void setp(char_type* pbeg, char_type* pend);
+
+    // 27.6.2.4 virtual functions:
+    // 27.6.2.4.1 Locales:
+    virtual void imbue(const locale& loc);
+
+    // 27.6.2.4.2 Buffer management and positioning:
+    virtual basic_streambuf* setbuf(char_type* s, streamsize n);
+    virtual pos_type seekoff(off_type off, ios_base::seekdir way,
+                             ios_base::openmode which = ios_base::in | ios_base::out);
+    virtual pos_type seekpos(pos_type sp,
+                             ios_base::openmode which = ios_base::in | ios_base::out);
+    virtual int sync();
+
+    // 27.6.2.4.3 Get area:
+    virtual streamsize showmanyc();
+    virtual streamsize xsgetn(char_type* s, streamsize n);
+    virtual int_type underflow();
+    virtual int_type uflow();
+
+    // 27.6.2.4.4 Putback:
+    virtual int_type pbackfail(int_type c = traits_type::eof());
+
+    // 27.6.2.4.5 Put area:
+    virtual streamsize xsputn(const char_type* s, streamsize n);
+    virtual int_type overflow (int_type c = traits_type::eof());
+};
+
+}  // std
+
+*/
+
+#include <__config>
+#include <iosfwd>
+#include <ios>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TYPE_VIS_ONLY basic_streambuf
+{
+public:
+    // types:
+    typedef _CharT                         char_type;
+    typedef _Traits                        traits_type;
+    typedef typename traits_type::int_type int_type;
+    typedef typename traits_type::pos_type pos_type;
+    typedef typename traits_type::off_type off_type;
+
+    virtual ~basic_streambuf();
+
+    // 27.6.2.2.1 locales:
+    locale pubimbue(const locale& __loc);
+    locale getloc() const;
+
+    // 27.6.2.2.2 buffer and positioning:
+    basic_streambuf* pubsetbuf(char_type* __s, streamsize __n);
+    pos_type pubseekoff(off_type __off, ios_base::seekdir __way,
+                        ios_base::openmode __which = ios_base::in | ios_base::out);
+    pos_type pubseekpos(pos_type __sp,
+                        ios_base::openmode __which = ios_base::in | ios_base::out);
+    int pubsync();
+
+    // Get and put areas:
+    // 27.6.2.2.3 Get area:
+    streamsize in_avail();
+    int_type snextc();
+    int_type sbumpc();
+    int_type sgetc();
+    streamsize sgetn(char_type* __s, streamsize __n);
+
+    // 27.6.2.2.4 Putback:
+    int_type sputbackc(char_type __c);
+    int_type sungetc();
+
+    // 27.6.2.2.5 Put area:
+    int_type sputc(char_type __c);
+    streamsize sputn(const char_type* __s, streamsize __n);
+
+protected:
+    basic_streambuf();
+    basic_streambuf(const basic_streambuf& __rhs);
+    basic_streambuf& operator=(const basic_streambuf& __rhs);
+    void swap(basic_streambuf& __rhs);
+
+    // 27.6.2.3.2 Get area:
+    _LIBCPP_ALWAYS_INLINE char_type* eback() const {return __binp_;}
+    _LIBCPP_ALWAYS_INLINE char_type* gptr()  const {return __ninp_;}
+    _LIBCPP_ALWAYS_INLINE char_type* egptr() const {return __einp_;}
+    void gbump(int __n);
+    void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend);
+
+    // 27.6.2.3.3 Put area:
+    _LIBCPP_ALWAYS_INLINE char_type* pbase() const {return __bout_;}
+    _LIBCPP_ALWAYS_INLINE char_type* pptr()  const {return __nout_;}
+    _LIBCPP_ALWAYS_INLINE char_type* epptr() const {return __eout_;}
+    void pbump(int __n);
+    void setp(char_type* __pbeg, char_type* __pend);
+
+    // 27.6.2.4 virtual functions:
+    // 27.6.2.4.1 Locales:
+    virtual void imbue(const locale& __loc);
+
+    // 27.6.2.4.2 Buffer management and positioning:
+    virtual basic_streambuf* setbuf(char_type* __s, streamsize __n);
+    virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
+                             ios_base::openmode __which = ios_base::in | ios_base::out);
+    virtual pos_type seekpos(pos_type __sp,
+                             ios_base::openmode __which = ios_base::in | ios_base::out);
+    virtual int sync();
+
+    // 27.6.2.4.3 Get area:
+    virtual streamsize showmanyc();
+    virtual streamsize xsgetn(char_type* __s, streamsize __n);
+    virtual int_type underflow();
+    virtual int_type uflow();
+
+    // 27.6.2.4.4 Putback:
+    virtual int_type pbackfail(int_type __c = traits_type::eof());
+
+    // 27.6.2.4.5 Put area:
+    virtual streamsize xsputn(const char_type* __s, streamsize __n);
+    virtual int_type overflow(int_type __c = traits_type::eof());
+
+private:
+    locale __loc_;
+    char_type* __binp_;
+    char_type* __ninp_;
+    char_type* __einp_;
+    char_type* __bout_;
+    char_type* __nout_;
+    char_type* __eout_;
+};
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>::~basic_streambuf()
+{
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+locale
+basic_streambuf<_CharT, _Traits>::pubimbue(const locale& __loc)
+{
+    imbue(__loc);
+    locale __r = __loc_;
+    __loc_ = __loc;
+    return __r;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+locale
+basic_streambuf<_CharT, _Traits>::getloc() const
+{
+    return __loc_;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_streambuf<_CharT, _Traits>*
+basic_streambuf<_CharT, _Traits>::pubsetbuf(char_type* __s, streamsize __n)
+{
+    return setbuf(__s, __n);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_streambuf<_CharT, _Traits>::pos_type
+basic_streambuf<_CharT, _Traits>::pubseekoff(off_type __off,
+                                             ios_base::seekdir __way,
+                                             ios_base::openmode __which)
+{
+    return seekoff(__off, __way, __which);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_streambuf<_CharT, _Traits>::pos_type
+basic_streambuf<_CharT, _Traits>::pubseekpos(pos_type __sp,
+                                             ios_base::openmode __which)
+{
+    return seekpos(__sp, __which);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+int
+basic_streambuf<_CharT, _Traits>::pubsync()
+{
+    return sync();
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+streamsize
+basic_streambuf<_CharT, _Traits>::in_avail()
+{
+    if (__ninp_ < __einp_)
+        return static_cast<streamsize>(__einp_ - __ninp_);
+    return showmanyc();
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::snextc()
+{
+    if (sbumpc() == traits_type::eof())
+        return traits_type::eof();
+    return sgetc();
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::sbumpc()
+{
+    if (__ninp_ == __einp_)
+        return uflow();
+    return traits_type::to_int_type(*__ninp_++);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::sgetc()
+{
+    if (__ninp_ == __einp_)
+        return underflow();
+    return traits_type::to_int_type(*__ninp_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+streamsize
+basic_streambuf<_CharT, _Traits>::sgetn(char_type* __s, streamsize __n)
+{
+    return xsgetn(__s, __n);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::sputbackc(char_type __c)
+{
+    if (__binp_ == __ninp_ || !traits_type::eq(__c, __ninp_[-1]))
+        return pbackfail(traits_type::to_int_type(__c));
+    return traits_type::to_int_type(*--__ninp_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::sungetc()
+{
+    if (__binp_ == __ninp_)
+        return pbackfail();
+    return traits_type::to_int_type(*--__ninp_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::sputc(char_type __c)
+{
+    if (__nout_ == __eout_)
+        return overflow(traits_type::to_int_type(__c));
+    *__nout_++ = __c;
+    return traits_type::to_int_type(__c);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+streamsize
+basic_streambuf<_CharT, _Traits>::sputn(const char_type* __s, streamsize __n)
+{
+    return xsputn(__s, __n);
+}
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>::basic_streambuf()
+    : __binp_(0),
+      __ninp_(0),
+      __einp_(0),
+      __bout_(0),
+      __nout_(0),
+      __eout_(0)
+{
+}
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>::basic_streambuf(const basic_streambuf& __sb)
+    : __loc_(__sb.__loc_),
+      __binp_(__sb.__binp_),
+      __ninp_(__sb.__ninp_),
+      __einp_(__sb.__einp_),
+      __bout_(__sb.__bout_),
+      __nout_(__sb.__nout_),
+      __eout_(__sb.__eout_)
+{
+}
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>&
+basic_streambuf<_CharT, _Traits>::operator=(const basic_streambuf& __sb)
+{
+    __loc_ = __sb.__loc_;
+    __binp_ = __sb.__binp_;
+    __ninp_ = __sb.__ninp_;
+    __einp_ = __sb.__einp_;
+    __bout_ = __sb.__bout_;
+    __nout_ = __sb.__nout_;
+    __eout_ = __sb.__eout_;
+    return *this;
+}
+
+template <class _CharT, class _Traits>
+void
+basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
+{
+    _VSTD::swap(__loc_, __sb.__loc_);
+    _VSTD::swap(__binp_, __sb.__binp_);
+    _VSTD::swap(__ninp_, __sb.__ninp_);
+    _VSTD::swap(__einp_, __sb.__einp_);
+    _VSTD::swap(__bout_, __sb.__bout_);
+    _VSTD::swap(__nout_, __sb.__nout_);
+    _VSTD::swap(__eout_, __sb.__eout_);
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_streambuf<_CharT, _Traits>::gbump(int __n)
+{
+    __ninp_ += __n;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_streambuf<_CharT, _Traits>::setg(char_type* __gbeg, char_type* __gnext,
+                                                          char_type* __gend)
+{
+    __binp_ = __gbeg;
+    __ninp_ = __gnext;
+    __einp_ = __gend;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_streambuf<_CharT, _Traits>::pbump(int __n)
+{
+    __nout_ += __n;
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_streambuf<_CharT, _Traits>::setp(char_type* __pbeg, char_type* __pend)
+{
+    __bout_ = __nout_ = __pbeg;
+    __eout_ = __pend;
+}
+
+template <class _CharT, class _Traits>
+void
+basic_streambuf<_CharT, _Traits>::imbue(const locale&)
+{
+}
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>*
+basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
+{
+    return this;
+}
+
+template <class _CharT, class _Traits>
+typename basic_streambuf<_CharT, _Traits>::pos_type
+basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
+                                          ios_base::openmode)
+{
+    return pos_type(off_type(-1));
+}
+
+template <class _CharT, class _Traits>
+typename basic_streambuf<_CharT, _Traits>::pos_type
+basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode)
+{
+    return pos_type(off_type(-1));
+}
+
+template <class _CharT, class _Traits>
+int
+basic_streambuf<_CharT, _Traits>::sync()
+{
+    return 0;
+}
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::showmanyc()
+{
+    return 0;
+}
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::xsgetn(char_type* __s, streamsize __n)
+{
+    const int_type __eof = traits_type::eof();
+    int_type __c;
+    streamsize __i = 0;
+    for (;__i < __n; ++__i, ++__s)
+    {
+        if (__ninp_ < __einp_)
+            *__s = *__ninp_++;
+        else if ((__c = uflow()) != __eof)
+            *__s = traits_type::to_char_type(__c);
+        else
+            break;
+    }
+    return __i;
+}
+
+template <class _CharT, class _Traits>
+typename basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::underflow()
+{
+    return traits_type::eof();
+}
+
+template <class _CharT, class _Traits>
+typename basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::uflow()
+{
+    if (underflow() == traits_type::eof())
+        return traits_type::eof();
+    return traits_type::to_int_type(*__ninp_++);
+}
+
+template <class _CharT, class _Traits>
+typename basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::pbackfail(int_type)
+{
+    return traits_type::eof();
+}
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
+{
+    streamsize __i = 0;
+    int_type __eof = traits_type::eof();
+    while( __i < __n)
+    {
+        if (__nout_ >= __eout_)
+        {
+            if (overflow(traits_type::to_int_type(*__s)) == __eof)
+                break;
+            ++__s;
+            ++__i;
+        }
+        else
+        {
+            streamsize __chunk_size = _VSTD::min(__eout_ - __nout_, __n - __i);
+            traits_type::copy(__nout_, __s, __chunk_size);
+            __nout_ += __chunk_size;
+            __s     += __chunk_size;
+            __i     += __chunk_size;
+        }
+    }
+    return __i;
+}
+
+template <class _CharT, class _Traits>
+typename basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::overflow(int_type)
+{
+    return traits_type::eof();
+}
+
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_streambuf<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_streambuf<wchar_t>)
+
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ios<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ios<wchar_t>)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_STEAMBUF

Property changes on: lab4/.minix-src/include/c++/streambuf
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/tgmath.h
===================================================================
--- lab4/.minix-src/include/c++/tgmath.h	(nonexistent)
+++ lab4/.minix-src/include/c++/tgmath.h	(revision 13)
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//===-------------------------- tgmath.h ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_TGMATH_H
+#define _LIBCPP_TGMATH_H
+
+/*
+    tgmath.h synopsis
+
+#include <complex.h>
+#include <math.h>
+
+*/
+
+#include <complex.h>
+#include <math.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#endif  // _LIBCPP_TGMATH_H

Property changes on: lab4/.minix-src/include/c++/tgmath.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/typeindex
===================================================================
--- lab4/.minix-src/include/c++/typeindex	(nonexistent)
+++ lab4/.minix-src/include/c++/typeindex	(revision 13)
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+//===-------------------------- typeindex ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_TYPEINDEX
+#define _LIBCPP_TYPEINDEX
+
+/*
+
+    typeindex synopsis
+
+namespace std
+{
+
+class type_index
+{
+public:
+    type_index(const type_info& rhs) noexcept;
+
+    bool operator==(const type_index& rhs) const noexcept;
+    bool operator!=(const type_index& rhs) const noexcept;
+    bool operator< (const type_index& rhs) const noexcept;
+    bool operator<=(const type_index& rhs) const noexcept;
+    bool operator> (const type_index& rhs) const noexcept;
+    bool operator>=(const type_index& rhs) const noexcept;
+
+    size_t hash_code() const noexcept;
+    const char* name() const noexcept;
+};
+
+template <>
+struct hash<type_index>
+    : public unary_function<type_index, size_t>
+{
+    size_t operator()(type_index index) const noexcept;
+};
+
+}  // std
+
+*/
+
+#include <__config>
+#include <typeinfo>
+#include <__functional_base>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+class _LIBCPP_TYPE_VIS_ONLY type_index
+{
+    const type_info* __t_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const type_index& __y) const _NOEXCEPT
+        {return *__t_ == *__y.__t_;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const type_index& __y) const _NOEXCEPT
+        {return *__t_ != *__y.__t_;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator< (const type_index& __y) const _NOEXCEPT
+        {return  __t_->before(*__y.__t_);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator<=(const type_index& __y) const _NOEXCEPT
+        {return !__y.__t_->before(*__t_);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator> (const type_index& __y) const _NOEXCEPT
+        {return  __y.__t_->before(*__t_);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator>=(const type_index& __y) const _NOEXCEPT
+        {return !__t_->before(*__y.__t_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t hash_code() const _NOEXCEPT {return __t_->hash_code();}
+    _LIBCPP_INLINE_VISIBILITY
+    const char* name() const _NOEXCEPT {return __t_->name();}
+};
+
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY hash<type_index>
+    : public unary_function<type_index, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(type_index __index) const _NOEXCEPT
+        {return __index.hash_code();}
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_TYPEINDEX

Property changes on: lab4/.minix-src/include/c++/typeindex
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/utility
===================================================================
--- lab4/.minix-src/include/c++/utility	(nonexistent)
+++ lab4/.minix-src/include/c++/utility	(revision 13)
@@ -0,0 +1,755 @@
+// -*- C++ -*-
+//===-------------------------- utility -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_UTILITY
+#define _LIBCPP_UTILITY
+
+/*
+    utility synopsis
+
+namespace std
+{
+
+template <class T>
+    void
+    swap(T& a, T& b);
+
+namespace rel_ops
+{
+    template<class T> bool operator!=(const T&, const T&);
+    template<class T> bool operator> (const T&, const T&);
+    template<class T> bool operator<=(const T&, const T&);
+    template<class T> bool operator>=(const T&, const T&);
+}
+
+template<class T>
+void
+swap(T& a, T& b) noexcept(is_nothrow_move_constructible<T>::value &&
+                          is_nothrow_move_assignable<T>::value);
+
+template <class T, size_t N>
+void
+swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b)));
+
+template <class T> T&& forward(typename remove_reference<T>::type& t) noexcept;  // constexpr in C++14
+template <class T> T&& forward(typename remove_reference<T>::type&& t) noexcept; // constexpr in C++14
+
+template <class T> typename remove_reference<T>::type&& move(T&&) noexcept;      // constexpr in C++14
+
+template <class T>
+    typename conditional
+    <
+        !is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value,
+        const T&,
+        T&&
+    >::type
+    move_if_noexcept(T& x) noexcept; // constexpr in C++14
+
+template <class T> typename add_rvalue_reference<T>::type declval() noexcept;
+
+template <class T1, class T2>
+struct pair
+{
+    typedef T1 first_type;
+    typedef T2 second_type;
+
+    T1 first;
+    T2 second;
+
+    pair(const pair&) = default;
+    pair(pair&&) = default;
+    constexpr pair();
+    pair(const T1& x, const T2& y);                          // constexpr in C++14
+    template <class U, class V> pair(U&& x, V&& y);          // constexpr in C++14
+    template <class U, class V> pair(const pair<U, V>& p);   // constexpr in C++14
+    template <class U, class V> pair(pair<U, V>&& p);        // constexpr in C++14
+    template <class... Args1, class... Args2>
+        pair(piecewise_construct_t, tuple<Args1...> first_args,
+             tuple<Args2...> second_args);
+
+    template <class U, class V> pair& operator=(const pair<U, V>& p);
+    pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable<T1>::value &&
+                                       is_nothrow_move_assignable<T2>::value);
+    template <class U, class V> pair& operator=(pair<U, V>&& p);
+
+    void swap(pair& p) noexcept(noexcept(swap(first, p.first)) &&
+                                noexcept(swap(second, p.second)));
+};
+
+template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
+template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
+template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
+template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
+template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
+template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
+
+template <class T1, class T2> pair<V1, V2> make_pair(T1&&, T2&&);   // constexpr in C++14
+template <class T1, class T2>
+void
+swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
+
+struct piecewise_construct_t { };
+constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
+
+template <class T> class tuple_size;
+template <size_t I, class T> class tuple_element;
+
+template <class T1, class T2> struct tuple_size<pair<T1, T2> >;
+template <class T1, class T2> struct tuple_element<0, pair<T1, T2> >;
+template <class T1, class T2> struct tuple_element<1, pair<T1, T2> >;
+
+template<size_t I, class T1, class T2>
+    typename tuple_element<I, pair<T1, T2> >::type&
+    get(pair<T1, T2>&) noexcept; // constexpr in C++14
+
+template<size_t I, class T1, class T2>
+    const typename const tuple_element<I, pair<T1, T2> >::type&
+    get(const pair<T1, T2>&) noexcept; // constexpr in C++14
+
+template<size_t I, class T1, class T2>
+    typename tuple_element<I, pair<T1, T2> >::type&&
+    get(pair<T1, T2>&&) noexcept; // constexpr in C++14
+
+template<class T1, class T2>
+    constexpr T1& get(pair<T1, T2>&) noexcept; // C++14
+
+template<size_t I, class T1, class T2>
+    constexpr T1 const& get(pair<T1, T2> const &) noexcept; // C++14
+
+template<size_t I, class T1, class T2>
+    constexpr T1&& get(pair<T1, T2>&&) noexcept; // C++14
+
+// C++14
+
+template<class T, T... I>
+struct integer_sequence
+{
+    typedef T value_type;
+
+    static constexpr size_t size() noexcept;
+};
+
+template<size_t... I>
+  using index_sequence = integer_sequence<size_t, I...>;
+
+template<class T, T N>
+  using make_integer_sequence = integer_sequence<T, 0, 1, ..., N-1>;
+template<size_t N>
+  using make_index_sequence = make_integer_sequence<size_t, N>;
+
+template<class... T>
+  using index_sequence_for = make_index_sequence<sizeof...(T)>;
+
+template<class T, class U=T> 
+    T exchange(T& obj, U&& new_value);
+}  // std
+
+*/
+
+#include <__config>
+#include <__tuple>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace rel_ops
+{
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const _Tp& __x, const _Tp& __y)
+{
+    return !(__x == __y);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const _Tp& __x, const _Tp& __y)
+{
+    return __y < __x;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const _Tp& __x, const _Tp& __y)
+{
+    return !(__y < __x);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const _Tp& __x, const _Tp& __y)
+{
+    return !(__x < __y);
+}
+
+}  // rel_ops
+
+// swap_ranges
+
+// forward
+template<class _Tp, size_t _Np>
+inline _LIBCPP_INLINE_VISIBILITY
+void swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
+
+template <class _ForwardIterator1, class _ForwardIterator2>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator2
+swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
+{
+    for(; __first1 != __last1; ++__first1, (void) ++__first2)
+        swap(*__first1, *__first2);
+    return __first2;
+}
+
+template<class _Tp, size_t _Np>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
+{
+    _VSTD::swap_ranges(__a, __a + _Np, __b);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+typename conditional
+<
+    !is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value,
+    const _Tp&,
+    _Tp&&
+>::type
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+const _Tp&
+#endif
+move_if_noexcept(_Tp& __x) _NOEXCEPT
+{
+    return _VSTD::move(__x);
+}
+
+struct _LIBCPP_TYPE_VIS_ONLY piecewise_construct_t { };
+#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY)
+extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
+#else
+constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
+#endif
+
+template <class _T1, class _T2>
+struct _LIBCPP_TYPE_VIS_ONLY pair
+{
+    typedef _T1 first_type;
+    typedef _T2 second_type;
+
+    _T1 first;
+    _T2 second;
+
+    // pair(const pair&) = default;
+    // pair(pair&&) = default;
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {}
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    pair(const _T1& __x, const _T2& __y)
+        : first(__x), second(__y) {}
+
+    template<class _U1, class _U2>
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        pair(const pair<_U1, _U2>& __p
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+                 ,typename enable_if<is_convertible<const _U1&, _T1>::value &&
+                                    is_convertible<const _U2&, _T2>::value>::type* = 0
+#endif
+                                      )
+            : first(__p.first), second(__p.second) {}
+
+#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+    _LIBCPP_INLINE_VISIBILITY
+    pair(const pair& __p) = default;
+#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) || !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+    _LIBCPP_INLINE_VISIBILITY
+    pair(const pair& __p)
+        _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
+                   is_nothrow_copy_constructible<second_type>::value)
+        : first(__p.first),
+          second(__p.second)
+    {
+    }
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    pair& operator=(const pair& __p)
+        _NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value &&
+                   is_nothrow_copy_assignable<second_type>::value)
+    {
+        first = __p.first;
+        second = __p.second;
+        return *this;
+    }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    template <class _U1, class _U2,
+              class = typename enable_if<is_convertible<_U1, first_type>::value &&
+                                         is_convertible<_U2, second_type>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        pair(_U1&& __u1, _U2&& __u2)
+            : first(_VSTD::forward<_U1>(__u1)),
+              second(_VSTD::forward<_U2>(__u2))
+            {}
+
+    template<class _U1, class _U2>
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        pair(pair<_U1, _U2>&& __p,
+                 typename enable_if<is_convertible<_U1, _T1>::value &&
+                                    is_convertible<_U2, _T2>::value>::type* = 0)
+            : first(_VSTD::forward<_U1>(__p.first)),
+              second(_VSTD::forward<_U2>(__p.second)) {}
+
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+    _LIBCPP_INLINE_VISIBILITY
+    pair(pair&& __p) = default;
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    pair(pair&& __p) _NOEXCEPT_(is_nothrow_move_constructible<first_type>::value &&
+                                is_nothrow_move_constructible<second_type>::value)
+        : first(_VSTD::forward<first_type>(__p.first)),
+          second(_VSTD::forward<second_type>(__p.second))
+    {
+    }
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    pair&
+    operator=(pair&& __p) _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value &&
+                                     is_nothrow_move_assignable<second_type>::value)
+    {
+        first = _VSTD::forward<first_type>(__p.first);
+        second = _VSTD::forward<second_type>(__p.second);
+        return *this;
+    }
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template<class _Tuple,
+             class = typename enable_if<__tuple_convertible<_Tuple, pair>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        pair(_Tuple&& __p)
+            : first(_VSTD::forward<typename tuple_element<0,
+                                  typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<0>(__p))),
+              second(_VSTD::forward<typename tuple_element<1,
+                                   typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<1>(__p)))
+            {}
+
+
+
+    template <class... _Args1, class... _Args2>
+        _LIBCPP_INLINE_VISIBILITY
+        pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
+                                    tuple<_Args2...> __second_args)
+            : pair(__pc, __first_args, __second_args,
+                   typename __make_tuple_indices<sizeof...(_Args1)>::type(),
+                   typename __make_tuple_indices<sizeof...(_Args2) >::type())
+            {}
+
+    template <class _Tuple,
+              class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY
+        pair&
+        operator=(_Tuple&& __p)
+        {
+            typedef typename __make_tuple_types<_Tuple>::type _TupleRef;
+            typedef typename tuple_element<0, _TupleRef>::type _U0;
+            typedef typename tuple_element<1, _TupleRef>::type _U1;
+            first  = _VSTD::forward<_U0>(_VSTD::get<0>(__p));
+            second = _VSTD::forward<_U1>(_VSTD::get<1>(__p));
+            return *this;
+        }
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void
+    swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
+                               __is_nothrow_swappable<second_type>::value)
+    {
+        _VSTD::iter_swap(&first, &__p.first);
+        _VSTD::iter_swap(&second, &__p.second);
+    }
+private:
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+        _LIBCPP_INLINE_VISIBILITY
+        pair(piecewise_construct_t,
+             tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
+             __tuple_indices<_I1...>, __tuple_indices<_I2...>);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+};
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
+{
+    return __x.first == __y.first && __x.second == __y.second;
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
+{
+    return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second);
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
+{
+    return __y < __x;
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_swappable<_T1>::value &&
+    __is_swappable<_T2>::value,
+    void
+>::type
+swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
+                     _NOEXCEPT_((__is_nothrow_swappable<_T1>::value &&
+                                 __is_nothrow_swappable<_T2>::value))
+{
+    __x.swap(__y);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY reference_wrapper;
+
+template <class _Tp>
+struct __make_pair_return_impl
+{
+    typedef _Tp type;
+};
+
+template <class _Tp>
+struct __make_pair_return_impl<reference_wrapper<_Tp>>
+{
+    typedef _Tp& type;
+};
+
+template <class _Tp>
+struct __make_pair_return
+{
+    typedef typename __make_pair_return_impl<typename decay<_Tp>::type>::type type;
+};
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type>
+make_pair(_T1&& __t1, _T2&& __t2)
+{
+    return pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type>
+               (_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2));
+}
+
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
+pair<_T1,_T2>
+make_pair(_T1 __x, _T2 __y)
+{
+    return pair<_T1, _T2>(__x, __y);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _T1, class _T2>
+  class _LIBCPP_TYPE_VIS_ONLY tuple_size<pair<_T1, _T2> >
+    : public integral_constant<size_t, 2> {};
+
+template <class _T1, class _T2>
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, pair<_T1, _T2> >
+{
+public:
+    typedef _T1 type;
+};
+
+template <class _T1, class _T2>
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<1, pair<_T1, _T2> >
+{
+public:
+    typedef _T2 type;
+};
+
+template <size_t _Ip> struct __get_pair;
+
+template <>
+struct __get_pair<0>
+{
+    template <class _T1, class _T2>
+    static
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    _T1&
+    get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
+
+    template <class _T1, class _T2>
+    static
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    const _T1&
+    get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    template <class _T1, class _T2>
+    static
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    _T1&&
+    get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+};
+
+template <>
+struct __get_pair<1>
+{
+    template <class _T1, class _T2>
+    static
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    _T2&
+    get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
+
+    template <class _T1, class _T2>
+    static
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    const _T2&
+    get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    template <class _T1, class _T2>
+    static
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    _T2&&
+    get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+};
+
+template <size_t _Ip, class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+get(pair<_T1, _T2>& __p) _NOEXCEPT
+{
+    return __get_pair<_Ip>::get(__p);
+}
+
+template <size_t _Ip, class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+get(const pair<_T1, _T2>& __p) _NOEXCEPT
+{
+    return __get_pair<_Ip>::get(__p);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <size_t _Ip, class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(pair<_T1, _T2>&& __p) _NOEXCEPT
+{
+    return __get_pair<_Ip>::get(_VSTD::move(__p));
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#if _LIBCPP_STD_VER > 11
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1 & get(pair<_T1, _T2>& __p) _NOEXCEPT
+{
+    return __get_pair<0>::get(__p);
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1 const & get(pair<_T1, _T2> const& __p) _NOEXCEPT
+{
+    return __get_pair<0>::get(__p);
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT
+{
+    return __get_pair<0>::get(_VSTD::move(__p));
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT
+{
+    return __get_pair<1>::get(__p);
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1 const & get(pair<_T2, _T1> const& __p) _NOEXCEPT
+{
+    return __get_pair<1>::get(__p);
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT
+{
+    return __get_pair<1>::get(_VSTD::move(__p));
+}
+
+#endif
+
+#if _LIBCPP_STD_VER > 11
+
+template<class _Tp, _Tp... _Ip>
+struct _LIBCPP_TYPE_VIS_ONLY integer_sequence
+{
+    typedef _Tp value_type;
+    static_assert( is_integral<_Tp>::value,
+                  "std::integer_sequence can only be instantiated with an integral type" );
+    static
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr
+    size_t
+    size() noexcept { return sizeof...(_Ip); }
+};
+
+template<size_t... _Ip>
+    using index_sequence = integer_sequence<size_t, _Ip...>;
+
+namespace __detail {
+
+template<typename _Tp, size_t ..._Extra> struct __repeat;
+template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<integer_sequence<_Tp, _Np...>, _Extra...> {
+  typedef integer_sequence<_Tp,
+                           _Np...,
+                           sizeof...(_Np) + _Np...,
+                           2 * sizeof...(_Np) + _Np...,
+                           3 * sizeof...(_Np) + _Np...,
+                           4 * sizeof...(_Np) + _Np...,
+                           5 * sizeof...(_Np) + _Np...,
+                           6 * sizeof...(_Np) + _Np...,
+                           7 * sizeof...(_Np) + _Np...,
+                           _Extra...> type;
+};
+
+template<size_t _Np> struct __parity;
+template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {};
+
+template<> struct __make<0> { typedef integer_sequence<size_t> type; };
+template<> struct __make<1> { typedef integer_sequence<size_t, 0> type; };
+template<> struct __make<2> { typedef integer_sequence<size_t, 0, 1> type; };
+template<> struct __make<3> { typedef integer_sequence<size_t, 0, 1, 2> type; };
+template<> struct __make<4> { typedef integer_sequence<size_t, 0, 1, 2, 3> type; };
+template<> struct __make<5> { typedef integer_sequence<size_t, 0, 1, 2, 3, 4> type; };
+template<> struct __make<6> { typedef integer_sequence<size_t, 0, 1, 2, 3, 4, 5> type; };
+template<> struct __make<7> { typedef integer_sequence<size_t, 0, 1, 2, 3, 4, 5, 6> type; };
+
+template<> struct __parity<0> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type> {}; };
+template<> struct __parity<1> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 1> {}; };
+template<> struct __parity<2> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 2, _Np - 1> {}; };
+template<> struct __parity<3> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 3, _Np - 2, _Np - 1> {}; };
+template<> struct __parity<4> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
+template<> struct __parity<5> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
+template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
+template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
+
+template<typename _Tp, typename _Up> struct __convert {
+  template<typename> struct __result;
+  template<_Tp ..._Np> struct __result<integer_sequence<_Tp, _Np...> > { typedef integer_sequence<_Up, _Np...> type; };
+};
+template<typename _Tp> struct __convert<_Tp, _Tp> { template<typename _Up> struct __result { typedef _Up type; }; };
+
+}
+
+template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked =
+  typename __detail::__convert<size_t, _Tp>::template __result<typename __detail::__make<_Np>::type>::type;
+
+template <class _Tp, _Tp _Ep>
+struct __make_integer_sequence
+{
+    static_assert(is_integral<_Tp>::value,
+                  "std::make_integer_sequence can only be instantiated with an integral type" );
+    static_assert(0 <= _Ep, "std::make_integer_sequence input shall not be negative");
+    typedef __make_integer_sequence_unchecked<_Tp, _Ep> type;
+};
+
+template<class _Tp, _Tp _Np>
+    using make_integer_sequence = typename __make_integer_sequence<_Tp, _Np>::type;
+
+template<size_t _Np>
+    using make_index_sequence = make_integer_sequence<size_t, _Np>;
+
+template<class... _Tp>
+    using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
+  
+#endif  // _LIBCPP_STD_VER > 11
+
+#if _LIBCPP_STD_VER > 11
+template<class _T1, class _T2 = _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+_T1 exchange(_T1& __obj, _T2 && __new_value)
+{
+    _T1 __old_value = _VSTD::move(__obj);
+    __obj = _VSTD::forward<_T2>(__new_value);
+    return __old_value;
+}    
+#endif  // _LIBCPP_STD_VER > 11
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_UTILITY

Property changes on: lab4/.minix-src/include/c++/utility
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/__wmmintrin_pclmul.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/__wmmintrin_pclmul.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/__wmmintrin_pclmul.h	(revision 13)
@@ -0,0 +1,34 @@
+/*===---- __wmmintrin_pclmul.h - AES intrinsics ----------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+#ifndef _WMMINTRIN_PCLMUL_H
+#define _WMMINTRIN_PCLMUL_H
+
+#if !defined (__PCLMUL__)
+# error "PCLMUL instruction is not enabled"
+#else
+#define _mm_clmulepi64_si128(__X, __Y, __I) \
+  ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(__X), \
+                                        (__v2di)(__m128i)(__Y), (char)(__I)))
+#endif
+
+#endif /* _WMMINTRIN_PCLMUL_H */

Property changes on: lab4/.minix-src/include/clang-3.6/__wmmintrin_pclmul.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/avx512bwintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/avx512bwintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/avx512bwintrin.h	(revision 13)
@@ -0,0 +1,60 @@
+/*===------------- avx512bwintrin.h - AVX512BW intrinsics ------------------===
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __AVX512BWINTRIN_H
+#define __AVX512BWINTRIN_H
+
+typedef unsigned int __mmask32;
+typedef unsigned long long __mmask64;
+typedef char __v64qi __attribute__ ((vector_size (64)));
+typedef short __v32hi __attribute__ ((__vector_size__ (64)));
+
+
+/* Integer compare */
+
+static __inline__ __mmask64 __attribute__((__always_inline__, __nodebug__))
+_mm512_cmpeq_epi8_mask(__m512i __a, __m512i __b) {
+  return (__mmask64)__builtin_ia32_pcmpeqb512_mask((__v64qi)__a, (__v64qi)__b,
+                                                   (__mmask64)-1);
+}
+
+static __inline__ __mmask64 __attribute__((__always_inline__, __nodebug__))
+_mm512_mask_cmpeq_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
+  return (__mmask64)__builtin_ia32_pcmpeqb512_mask((__v64qi)__a, (__v64qi)__b,
+                                                   __u);
+}
+
+static __inline__ __mmask32 __attribute__((__always_inline__, __nodebug__))
+_mm512_cmpeq_epi16_mask(__m512i __a, __m512i __b) {
+  return (__mmask32)__builtin_ia32_pcmpeqw512_mask((__v32hi)__a, (__v32hi)__b,
+                                                   (__mmask32)-1);
+}
+
+static __inline__ __mmask32 __attribute__((__always_inline__, __nodebug__))
+_mm512_mask_cmpeq_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
+  return (__mmask32)__builtin_ia32_pcmpeqw512_mask((__v32hi)__a, (__v32hi)__b,
+                                                   __u);
+}
+
+#endif

Property changes on: lab4/.minix-src/include/clang-3.6/avx512bwintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/__wmmintrin_aes.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/__wmmintrin_aes.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/__wmmintrin_aes.h	(revision 13)
@@ -0,0 +1,67 @@
+/*===---- __wmmintrin_aes.h - AES intrinsics -------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+#ifndef _WMMINTRIN_AES_H
+#define _WMMINTRIN_AES_H
+
+#include <emmintrin.h>
+
+#if !defined (__AES__)
+#  error "AES instructions not enabled"
+#else
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_aesenc_si128(__m128i __V, __m128i __R)
+{
+  return (__m128i)__builtin_ia32_aesenc128(__V, __R);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_aesenclast_si128(__m128i __V, __m128i __R)
+{
+  return (__m128i)__builtin_ia32_aesenclast128(__V, __R);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_aesdec_si128(__m128i __V, __m128i __R)
+{
+  return (__m128i)__builtin_ia32_aesdec128(__V, __R);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_aesdeclast_si128(__m128i __V, __m128i __R)
+{
+  return (__m128i)__builtin_ia32_aesdeclast128(__V, __R);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_aesimc_si128(__m128i __V)
+{
+  return (__m128i)__builtin_ia32_aesimc128(__V);
+}
+
+#define _mm_aeskeygenassist_si128(C, R) \
+  __builtin_ia32_aeskeygenassist128((C), (R))
+
+#endif
+
+#endif  /* _WMMINTRIN_AES_H */

Property changes on: lab4/.minix-src/include/clang-3.6/__wmmintrin_aes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/avx2intrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/avx2intrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/avx2intrin.h	(revision 13)
@@ -0,0 +1,1234 @@
+/*===---- avx2intrin.h - AVX2 intrinsics -----------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use <avx2intrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef __AVX2INTRIN_H
+#define __AVX2INTRIN_H
+
+/* SSE4 Multiple Packed Sums of Absolute Difference.  */
+#define _mm256_mpsadbw_epu8(X, Y, M) __builtin_ia32_mpsadbw256((X), (Y), (M))
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_abs_epi8(__m256i __a)
+{
+    return (__m256i)__builtin_ia32_pabsb256((__v32qi)__a);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_abs_epi16(__m256i __a)
+{
+    return (__m256i)__builtin_ia32_pabsw256((__v16hi)__a);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_abs_epi32(__m256i __a)
+{
+    return (__m256i)__builtin_ia32_pabsd256((__v8si)__a);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_packs_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_packsswb256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_packs_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_packssdw256((__v8si)__a, (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_packus_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_packuswb256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_packus_epi32(__m256i __V1, __m256i __V2)
+{
+  return (__m256i) __builtin_ia32_packusdw256((__v8si)__V1, (__v8si)__V2);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_add_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v32qi)__a + (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_add_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v16hi)__a + (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_add_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v8si)__a + (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_add_epi64(__m256i __a, __m256i __b)
+{
+  return __a + __b;
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_adds_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_paddsb256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_adds_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_paddsw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_adds_epu8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_paddusb256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_adds_epu16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_paddusw256((__v16hi)__a, (__v16hi)__b);
+}
+
+#define _mm256_alignr_epi8(a, b, n) __extension__ ({ \
+  __m256i __a = (a); \
+  __m256i __b = (b); \
+  (__m256i)__builtin_ia32_palignr256((__v32qi)__a, (__v32qi)__b, (n)); })
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_and_si256(__m256i __a, __m256i __b)
+{
+  return __a & __b;
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_andnot_si256(__m256i __a, __m256i __b)
+{
+  return ~__a & __b;
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_avg_epu8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pavgb256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_avg_epu16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pavgw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_blendv_epi8(__m256i __V1, __m256i __V2, __m256i __M)
+{
+  return (__m256i)__builtin_ia32_pblendvb256((__v32qi)__V1, (__v32qi)__V2,
+                                              (__v32qi)__M);
+}
+
+#define _mm256_blend_epi16(V1, V2, M) __extension__ ({ \
+  __m256i __V1 = (V1); \
+  __m256i __V2 = (V2); \
+  (__m256d)__builtin_shufflevector((__v16hi)__V1, (__v16hi)__V2, \
+                                   (((M) & 0x01) ? 16 : 0), \
+                                   (((M) & 0x02) ? 17 : 1), \
+                                   (((M) & 0x04) ? 18 : 2), \
+                                   (((M) & 0x08) ? 19 : 3), \
+                                   (((M) & 0x10) ? 20 : 4), \
+                                   (((M) & 0x20) ? 21 : 5), \
+                                   (((M) & 0x40) ? 22 : 6), \
+                                   (((M) & 0x80) ? 23 : 7), \
+                                   (((M) & 0x01) ? 24 : 8), \
+                                   (((M) & 0x02) ? 25 : 9), \
+                                   (((M) & 0x04) ? 26 : 10), \
+                                   (((M) & 0x08) ? 27 : 11), \
+                                   (((M) & 0x10) ? 28 : 12), \
+                                   (((M) & 0x20) ? 29 : 13), \
+                                   (((M) & 0x40) ? 30 : 14), \
+                                   (((M) & 0x80) ? 31 : 15)); })
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpeq_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v32qi)__a == (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpeq_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v16hi)__a == (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpeq_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v8si)__a == (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpeq_epi64(__m256i __a, __m256i __b)
+{
+  return (__m256i)(__a == __b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpgt_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v32qi)__a > (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpgt_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v16hi)__a > (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpgt_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v8si)__a > (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpgt_epi64(__m256i __a, __m256i __b)
+{
+  return (__m256i)(__a > __b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_hadd_epi16(__m256i __a, __m256i __b)
+{
+    return (__m256i)__builtin_ia32_phaddw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_hadd_epi32(__m256i __a, __m256i __b)
+{
+    return (__m256i)__builtin_ia32_phaddd256((__v8si)__a, (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_hadds_epi16(__m256i __a, __m256i __b)
+{
+    return (__m256i)__builtin_ia32_phaddsw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_hsub_epi16(__m256i __a, __m256i __b)
+{
+    return (__m256i)__builtin_ia32_phsubw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_hsub_epi32(__m256i __a, __m256i __b)
+{
+    return (__m256i)__builtin_ia32_phsubd256((__v8si)__a, (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_hsubs_epi16(__m256i __a, __m256i __b)
+{
+    return (__m256i)__builtin_ia32_phsubsw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_maddubs_epi16(__m256i __a, __m256i __b)
+{
+    return (__m256i)__builtin_ia32_pmaddubsw256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_madd_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmaddwd256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_max_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmaxsb256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_max_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmaxsw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_max_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmaxsd256((__v8si)__a, (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_max_epu8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmaxub256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_max_epu16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmaxuw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_max_epu32(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmaxud256((__v8si)__a, (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_min_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pminsb256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_min_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pminsw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_min_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pminsd256((__v8si)__a, (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_min_epu8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pminub256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_min_epu16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pminuw256 ((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_min_epu32(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pminud256((__v8si)__a, (__v8si)__b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm256_movemask_epi8(__m256i __a)
+{
+  return __builtin_ia32_pmovmskb256((__v32qi)__a);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepi8_epi16(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovsxbw256((__v16qi)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepi8_epi32(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovsxbd256((__v16qi)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepi8_epi64(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovsxbq256((__v16qi)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepi16_epi32(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovsxwd256((__v8hi)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepi16_epi64(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovsxwq256((__v8hi)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepi32_epi64(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovsxdq256((__v4si)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepu8_epi16(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovzxbw256((__v16qi)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepu8_epi32(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovzxbd256((__v16qi)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepu8_epi64(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovzxbq256((__v16qi)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepu16_epi32(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovzxwd256((__v8hi)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepu16_epi64(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovzxwq256((__v8hi)__V);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepu32_epi64(__m128i __V)
+{
+  return (__m256i)__builtin_ia32_pmovzxdq256((__v4si)__V);
+}
+
+static __inline__  __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_mul_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmuldq256((__v8si)__a, (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_mulhrs_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmulhrsw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_mulhi_epu16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmulhuw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_mulhi_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pmulhw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_mullo_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v16hi)__a * (__v16hi)__b);
+}
+
+static __inline__  __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_mullo_epi32 (__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v8si)__a * (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_mul_epu32(__m256i __a, __m256i __b)
+{
+  return __builtin_ia32_pmuludq256((__v8si)__a, (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_or_si256(__m256i __a, __m256i __b)
+{
+  return __a | __b;
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sad_epu8(__m256i __a, __m256i __b)
+{
+  return __builtin_ia32_psadbw256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_shuffle_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_pshufb256((__v32qi)__a, (__v32qi)__b);
+}
+
+#define _mm256_shuffle_epi32(a, imm) __extension__ ({ \
+  __m256i __a = (a); \
+  (__m256i)__builtin_shufflevector((__v8si)__a, (__v8si)_mm256_set1_epi32(0), \
+                                   (imm) & 0x3, ((imm) & 0xc) >> 2, \
+                                   ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \
+                                   4 + (((imm) & 0x03) >> 0), \
+                                   4 + (((imm) & 0x0c) >> 2), \
+                                   4 + (((imm) & 0x30) >> 4), \
+                                   4 + (((imm) & 0xc0) >> 6)); })
+
+#define _mm256_shufflehi_epi16(a, imm) __extension__ ({ \
+  __m256i __a = (a); \
+  (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)_mm256_set1_epi16(0), \
+                                   0, 1, 2, 3, \
+                                   4 + (((imm) & 0x03) >> 0), \
+                                   4 + (((imm) & 0x0c) >> 2), \
+                                   4 + (((imm) & 0x30) >> 4), \
+                                   4 + (((imm) & 0xc0) >> 6), \
+                                   8, 9, 10, 11, \
+                                   12 + (((imm) & 0x03) >> 0), \
+                                   12 + (((imm) & 0x0c) >> 2), \
+                                   12 + (((imm) & 0x30) >> 4), \
+                                   12 + (((imm) & 0xc0) >> 6)); })
+
+#define _mm256_shufflelo_epi16(a, imm) __extension__ ({ \
+  __m256i __a = (a); \
+  (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)_mm256_set1_epi16(0), \
+                                   (imm) & 0x3,((imm) & 0xc) >> 2, \
+                                   ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \
+                                   4, 5, 6, 7, \
+                                   8 + (((imm) & 0x03) >> 0), \
+                                   8 + (((imm) & 0x0c) >> 2), \
+                                   8 + (((imm) & 0x30) >> 4), \
+                                   8 + (((imm) & 0xc0) >> 6), \
+                                   12, 13, 14, 15); })
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sign_epi8(__m256i __a, __m256i __b)
+{
+    return (__m256i)__builtin_ia32_psignb256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sign_epi16(__m256i __a, __m256i __b)
+{
+    return (__m256i)__builtin_ia32_psignw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sign_epi32(__m256i __a, __m256i __b)
+{
+    return (__m256i)__builtin_ia32_psignd256((__v8si)__a, (__v8si)__b);
+}
+
+#define _mm256_slli_si256(a, count) __extension__ ({ \
+  __m256i __a = (a); \
+  (__m256i)__builtin_ia32_pslldqi256(__a, (count)*8); })
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_slli_epi16(__m256i __a, int __count)
+{
+  return (__m256i)__builtin_ia32_psllwi256((__v16hi)__a, __count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sll_epi16(__m256i __a, __m128i __count)
+{
+  return (__m256i)__builtin_ia32_psllw256((__v16hi)__a, (__v8hi)__count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_slli_epi32(__m256i __a, int __count)
+{
+  return (__m256i)__builtin_ia32_pslldi256((__v8si)__a, __count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sll_epi32(__m256i __a, __m128i __count)
+{
+  return (__m256i)__builtin_ia32_pslld256((__v8si)__a, (__v4si)__count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_slli_epi64(__m256i __a, int __count)
+{
+  return __builtin_ia32_psllqi256(__a, __count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sll_epi64(__m256i __a, __m128i __count)
+{
+  return __builtin_ia32_psllq256(__a, __count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srai_epi16(__m256i __a, int __count)
+{
+  return (__m256i)__builtin_ia32_psrawi256((__v16hi)__a, __count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sra_epi16(__m256i __a, __m128i __count)
+{
+  return (__m256i)__builtin_ia32_psraw256((__v16hi)__a, (__v8hi)__count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srai_epi32(__m256i __a, int __count)
+{
+  return (__m256i)__builtin_ia32_psradi256((__v8si)__a, __count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sra_epi32(__m256i __a, __m128i __count)
+{
+  return (__m256i)__builtin_ia32_psrad256((__v8si)__a, (__v4si)__count);
+}
+
+#define _mm256_srli_si256(a, count) __extension__ ({ \
+  __m256i __a = (a); \
+  (__m256i)__builtin_ia32_psrldqi256(__a, (count)*8); })
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srli_epi16(__m256i __a, int __count)
+{
+  return (__m256i)__builtin_ia32_psrlwi256((__v16hi)__a, __count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srl_epi16(__m256i __a, __m128i __count)
+{
+  return (__m256i)__builtin_ia32_psrlw256((__v16hi)__a, (__v8hi)__count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srli_epi32(__m256i __a, int __count)
+{
+  return (__m256i)__builtin_ia32_psrldi256((__v8si)__a, __count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srl_epi32(__m256i __a, __m128i __count)
+{
+  return (__m256i)__builtin_ia32_psrld256((__v8si)__a, (__v4si)__count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srli_epi64(__m256i __a, int __count)
+{
+  return __builtin_ia32_psrlqi256(__a, __count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srl_epi64(__m256i __a, __m128i __count)
+{
+  return __builtin_ia32_psrlq256(__a, __count);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sub_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v32qi)__a - (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sub_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v16hi)__a - (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sub_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)((__v8si)__a - (__v8si)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sub_epi64(__m256i __a, __m256i __b)
+{
+  return __a - __b;
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_subs_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_psubsb256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_subs_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_psubsw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_subs_epu8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_psubusb256((__v32qi)__a, (__v32qi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_subs_epu16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_psubusw256((__v16hi)__a, (__v16hi)__b);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_unpackhi_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_shufflevector((__v32qi)__a, (__v32qi)__b, 8, 32+8, 9, 32+9, 10, 32+10, 11, 32+11, 12, 32+12, 13, 32+13, 14, 32+14, 15, 32+15, 24, 32+24, 25, 32+25, 26, 32+26, 27, 32+27, 28, 32+28, 29, 32+29, 30, 32+30, 31, 32+31);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_unpackhi_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)__b, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_unpackhi_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_shufflevector((__v8si)__a, (__v8si)__b, 2, 8+2, 3, 8+3, 6, 8+6, 7, 8+7);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_unpackhi_epi64(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_shufflevector(__a, __b, 1, 4+1, 3, 4+3);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_unpacklo_epi8(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_shufflevector((__v32qi)__a, (__v32qi)__b, 0, 32+0, 1, 32+1, 2, 32+2, 3, 32+3, 4, 32+4, 5, 32+5, 6, 32+6, 7, 32+7, 16, 32+16, 17, 32+17, 18, 32+18, 19, 32+19, 20, 32+20, 21, 32+21, 22, 32+22, 23, 32+23);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_unpacklo_epi16(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)__b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_unpacklo_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_shufflevector((__v8si)__a, (__v8si)__b, 0, 8+0, 1, 8+1, 4, 8+4, 5, 8+5);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_unpacklo_epi64(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_shufflevector(__a, __b, 0, 4+0, 2, 4+2);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_xor_si256(__m256i __a, __m256i __b)
+{
+  return __a ^ __b;
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_stream_load_si256(__m256i *__V)
+{
+  return (__m256i)__builtin_ia32_movntdqa256((__v4di *)__V);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_broadcastss_ps(__m128 __X)
+{
+  return (__m128)__builtin_ia32_vbroadcastss_ps((__v4sf)__X);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcastss_ps(__m128 __X)
+{
+  return (__m256)__builtin_ia32_vbroadcastss_ps256((__v4sf)__X);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcastsd_pd(__m128d __X)
+{
+  return (__m256d)__builtin_ia32_vbroadcastsd_pd256((__v2df)__X);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcastsi128_si256(__m128i __X)
+{
+  return (__m256i)__builtin_ia32_vbroadcastsi256(__X);
+}
+
+#define _mm_blend_epi32(V1, V2, M) __extension__ ({ \
+  __m128i __V1 = (V1); \
+  __m128i __V2 = (V2); \
+  (__m128i)__builtin_shufflevector((__v4si)__V1, (__v4si)__V2, \
+                                   (((M) & 0x01) ? 4 : 0), \
+                                   (((M) & 0x02) ? 5 : 1), \
+                                   (((M) & 0x04) ? 6 : 2), \
+                                   (((M) & 0x08) ? 7 : 3)); })
+
+#define _mm256_blend_epi32(V1, V2, M) __extension__ ({ \
+  __m256i __V1 = (V1); \
+  __m256i __V2 = (V2); \
+  (__m256i)__builtin_shufflevector((__v8si)__V1, (__v8si)__V2, \
+                                   (((M) & 0x01) ?  8 : 0), \
+                                   (((M) & 0x02) ?  9 : 1), \
+                                   (((M) & 0x04) ? 10 : 2), \
+                                   (((M) & 0x08) ? 11 : 3), \
+                                   (((M) & 0x10) ? 12 : 4), \
+                                   (((M) & 0x20) ? 13 : 5), \
+                                   (((M) & 0x40) ? 14 : 6), \
+                                   (((M) & 0x80) ? 15 : 7)); })
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcastb_epi8(__m128i __X)
+{
+  return (__m256i)__builtin_ia32_pbroadcastb256((__v16qi)__X);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcastw_epi16(__m128i __X)
+{
+  return (__m256i)__builtin_ia32_pbroadcastw256((__v8hi)__X);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcastd_epi32(__m128i __X)
+{
+  return (__m256i)__builtin_ia32_pbroadcastd256((__v4si)__X);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcastq_epi64(__m128i __X)
+{
+  return (__m256i)__builtin_ia32_pbroadcastq256(__X);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_broadcastb_epi8(__m128i __X)
+{
+  return (__m128i)__builtin_ia32_pbroadcastb128((__v16qi)__X);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_broadcastw_epi16(__m128i __X)
+{
+  return (__m128i)__builtin_ia32_pbroadcastw128((__v8hi)__X);
+}
+
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_broadcastd_epi32(__m128i __X)
+{
+  return (__m128i)__builtin_ia32_pbroadcastd128((__v4si)__X);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_broadcastq_epi64(__m128i __X)
+{
+  return (__m128i)__builtin_ia32_pbroadcastq128(__X);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_permutevar8x32_epi32(__m256i __a, __m256i __b)
+{
+  return (__m256i)__builtin_ia32_permvarsi256((__v8si)__a, (__v8si)__b);
+}
+
+#define _mm256_permute4x64_pd(V, M) __extension__ ({ \
+  __m256d __V = (V); \
+  (__m256d)__builtin_shufflevector((__v4df)__V, (__v4df) _mm256_setzero_pd(), \
+                                   (M) & 0x3, ((M) & 0xc) >> 2, \
+                                   ((M) & 0x30) >> 4, ((M) & 0xc0) >> 6); })
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_permutevar8x32_ps(__m256 __a, __m256 __b)
+{
+  return (__m256)__builtin_ia32_permvarsf256((__v8sf)__a, (__v8sf)__b);
+}
+
+#define _mm256_permute4x64_epi64(V, M) __extension__ ({ \
+  __m256i __V = (V); \
+  (__m256i)__builtin_shufflevector((__v4di)__V, (__v4di) _mm256_setzero_si256(), \
+                                   (M) & 0x3, ((M) & 0xc) >> 2, \
+                                   ((M) & 0x30) >> 4, ((M) & 0xc0) >> 6); })
+
+#define _mm256_permute2x128_si256(V1, V2, M) __extension__ ({ \
+  __m256i __V1 = (V1); \
+  __m256i __V2 = (V2); \
+  (__m256i)__builtin_ia32_permti256(__V1, __V2, (M)); })
+
+#define _mm256_extracti128_si256(A, O) __extension__ ({ \
+  __m256i __A = (A); \
+  (__m128i)__builtin_ia32_extract128i256(__A, (O)); })
+
+#define _mm256_inserti128_si256(V1, V2, O) __extension__ ({ \
+  __m256i __V1 = (V1); \
+  __m128i __V2 = (V2); \
+  (__m256i)__builtin_ia32_insert128i256(__V1, __V2, (O)); })
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_maskload_epi32(int const *__X, __m256i __M)
+{
+  return (__m256i)__builtin_ia32_maskloadd256((const __v8si *)__X, (__v8si)__M);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_maskload_epi64(long long const *__X, __m256i __M)
+{
+  return (__m256i)__builtin_ia32_maskloadq256((const __v4di *)__X, __M);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maskload_epi32(int const *__X, __m128i __M)
+{
+  return (__m128i)__builtin_ia32_maskloadd((const __v4si *)__X, (__v4si)__M);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maskload_epi64(long long const *__X, __m128i __M)
+{
+  return (__m128i)__builtin_ia32_maskloadq((const __v2di *)__X, (__v2di)__M);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm256_maskstore_epi32(int *__X, __m256i __M, __m256i __Y)
+{
+  __builtin_ia32_maskstored256((__v8si *)__X, (__v8si)__M, (__v8si)__Y);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm256_maskstore_epi64(long long *__X, __m256i __M, __m256i __Y)
+{
+  __builtin_ia32_maskstoreq256((__v4di *)__X, __M, __Y);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_maskstore_epi32(int *__X, __m128i __M, __m128i __Y)
+{
+  __builtin_ia32_maskstored((__v4si *)__X, (__v4si)__M, (__v4si)__Y);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_maskstore_epi64(long long *__X, __m128i __M, __m128i __Y)
+{
+  __builtin_ia32_maskstoreq(( __v2di *)__X, __M, __Y);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sllv_epi32(__m256i __X, __m256i __Y)
+{
+  return (__m256i)__builtin_ia32_psllv8si((__v8si)__X, (__v8si)__Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sllv_epi32(__m128i __X, __m128i __Y)
+{
+  return (__m128i)__builtin_ia32_psllv4si((__v4si)__X, (__v4si)__Y);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sllv_epi64(__m256i __X, __m256i __Y)
+{
+  return (__m256i)__builtin_ia32_psllv4di(__X, __Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sllv_epi64(__m128i __X, __m128i __Y)
+{
+  return (__m128i)__builtin_ia32_psllv2di(__X, __Y);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srav_epi32(__m256i __X, __m256i __Y)
+{
+  return (__m256i)__builtin_ia32_psrav8si((__v8si)__X, (__v8si)__Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srav_epi32(__m128i __X, __m128i __Y)
+{
+  return (__m128i)__builtin_ia32_psrav4si((__v4si)__X, (__v4si)__Y);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srlv_epi32(__m256i __X, __m256i __Y)
+{
+  return (__m256i)__builtin_ia32_psrlv8si((__v8si)__X, (__v8si)__Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srlv_epi32(__m128i __X, __m128i __Y)
+{
+  return (__m128i)__builtin_ia32_psrlv4si((__v4si)__X, (__v4si)__Y);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srlv_epi64(__m256i __X, __m256i __Y)
+{
+  return (__m256i)__builtin_ia32_psrlv4di(__X, __Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srlv_epi64(__m128i __X, __m128i __Y)
+{
+  return (__m128i)__builtin_ia32_psrlv2di(__X, __Y);
+}
+
+#define _mm_mask_i32gather_pd(a, m, i, mask, s) __extension__ ({ \
+  __m128d __a = (a); \
+  double const *__m = (m); \
+  __m128i __i = (i); \
+  __m128d __mask = (mask); \
+  (__m128d)__builtin_ia32_gatherd_pd((__v2df)__a, (const __v2df *)__m, \
+             (__v4si)__i, (__v2df)__mask, (s)); })
+
+#define _mm256_mask_i32gather_pd(a, m, i, mask, s) __extension__ ({ \
+  __m256d __a = (a); \
+  double const *__m = (m); \
+  __m128i __i = (i); \
+  __m256d __mask = (mask); \
+  (__m256d)__builtin_ia32_gatherd_pd256((__v4df)__a, (const __v4df *)__m, \
+             (__v4si)__i, (__v4df)__mask, (s)); })
+
+#define _mm_mask_i64gather_pd(a, m, i, mask, s) __extension__ ({ \
+  __m128d __a = (a); \
+  double const *__m = (m); \
+  __m128i __i = (i); \
+  __m128d __mask = (mask); \
+  (__m128d)__builtin_ia32_gatherq_pd((__v2df)__a, (const __v2df *)__m, \
+             (__v2di)__i, (__v2df)__mask, (s)); })
+
+#define _mm256_mask_i64gather_pd(a, m, i, mask, s) __extension__ ({ \
+  __m256d __a = (a); \
+  double const *__m = (m); \
+  __m256i __i = (i); \
+  __m256d __mask = (mask); \
+  (__m256d)__builtin_ia32_gatherq_pd256((__v4df)__a, (const __v4df *)__m, \
+             (__v4di)__i, (__v4df)__mask, (s)); })
+
+#define _mm_mask_i32gather_ps(a, m, i, mask, s) __extension__ ({ \
+  __m128 __a = (a); \
+  float const *__m = (m); \
+  __m128i __i = (i); \
+  __m128 __mask = (mask); \
+  (__m128)__builtin_ia32_gatherd_ps((__v4sf)__a, (const __v4sf *)__m, \
+            (__v4si)__i, (__v4sf)__mask, (s)); })
+
+#define _mm256_mask_i32gather_ps(a, m, i, mask, s) __extension__ ({ \
+  __m256 __a = (a); \
+  float const *__m = (m); \
+  __m256i __i = (i); \
+  __m256 __mask = (mask); \
+  (__m256)__builtin_ia32_gatherd_ps256((__v8sf)__a, (const __v8sf *)__m, \
+            (__v8si)__i, (__v8sf)__mask, (s)); })
+
+#define _mm_mask_i64gather_ps(a, m, i, mask, s) __extension__ ({ \
+  __m128 __a = (a); \
+  float const *__m = (m); \
+  __m128i __i = (i); \
+  __m128 __mask = (mask); \
+  (__m128)__builtin_ia32_gatherq_ps((__v4sf)__a, (const __v4sf *)__m, \
+            (__v2di)__i, (__v4sf)__mask, (s)); })
+
+#define _mm256_mask_i64gather_ps(a, m, i, mask, s) __extension__ ({ \
+  __m128 __a = (a); \
+  float const *__m = (m); \
+  __m256i __i = (i); \
+  __m128 __mask = (mask); \
+  (__m128)__builtin_ia32_gatherq_ps256((__v4sf)__a, (const __v4sf *)__m, \
+            (__v4di)__i, (__v4sf)__mask, (s)); })
+
+#define _mm_mask_i32gather_epi32(a, m, i, mask, s) __extension__ ({ \
+  __m128i __a = (a); \
+  int const *__m = (m); \
+  __m128i __i = (i); \
+  __m128i __mask = (mask); \
+  (__m128i)__builtin_ia32_gatherd_d((__v4si)__a, (const __v4si *)__m, \
+            (__v4si)__i, (__v4si)__mask, (s)); })
+
+#define _mm256_mask_i32gather_epi32(a, m, i, mask, s) __extension__ ({ \
+  __m256i __a = (a); \
+  int const *__m = (m); \
+  __m256i __i = (i); \
+  __m256i __mask = (mask); \
+  (__m256i)__builtin_ia32_gatherd_d256((__v8si)__a, (const __v8si *)__m, \
+            (__v8si)__i, (__v8si)__mask, (s)); })
+
+#define _mm_mask_i64gather_epi32(a, m, i, mask, s) __extension__ ({ \
+  __m128i __a = (a); \
+  int const *__m = (m); \
+  __m128i __i = (i); \
+  __m128i __mask = (mask); \
+  (__m128i)__builtin_ia32_gatherq_d((__v4si)__a, (const __v4si *)__m, \
+            (__v2di)__i, (__v4si)__mask, (s)); })
+
+#define _mm256_mask_i64gather_epi32(a, m, i, mask, s) __extension__ ({ \
+  __m128i __a = (a); \
+  int const *__m = (m); \
+  __m256i __i = (i); \
+  __m128i __mask = (mask); \
+  (__m128i)__builtin_ia32_gatherq_d256((__v4si)__a, (const __v4si *)__m, \
+            (__v4di)__i, (__v4si)__mask, (s)); })
+
+#define _mm_mask_i32gather_epi64(a, m, i, mask, s) __extension__ ({ \
+  __m128i __a = (a); \
+  long long const *__m = (m); \
+  __m128i __i = (i); \
+  __m128i __mask = (mask); \
+  (__m128i)__builtin_ia32_gatherd_q((__v2di)__a, (const __v2di *)__m, \
+             (__v4si)__i, (__v2di)__mask, (s)); })
+
+#define _mm256_mask_i32gather_epi64(a, m, i, mask, s) __extension__ ({ \
+  __m256i __a = (a); \
+  long long const *__m = (m); \
+  __m128i __i = (i); \
+  __m256i __mask = (mask); \
+  (__m256i)__builtin_ia32_gatherd_q256((__v4di)__a, (const __v4di *)__m, \
+             (__v4si)__i, (__v4di)__mask, (s)); })
+
+#define _mm_mask_i64gather_epi64(a, m, i, mask, s) __extension__ ({ \
+  __m128i __a = (a); \
+  long long const *__m = (m); \
+  __m128i __i = (i); \
+  __m128i __mask = (mask); \
+  (__m128i)__builtin_ia32_gatherq_q((__v2di)__a, (const __v2di *)__m, \
+             (__v2di)__i, (__v2di)__mask, (s)); })
+
+#define _mm256_mask_i64gather_epi64(a, m, i, mask, s) __extension__ ({ \
+  __m256i __a = (a); \
+  long long const *__m = (m); \
+  __m256i __i = (i); \
+  __m256i __mask = (mask); \
+  (__m256i)__builtin_ia32_gatherq_q256((__v4di)__a, (const __v4di *)__m, \
+             (__v4di)__i, (__v4di)__mask, (s)); })
+
+#define _mm_i32gather_pd(m, i, s) __extension__ ({ \
+  double const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128d)__builtin_ia32_gatherd_pd((__v2df)_mm_setzero_pd(), \
+             (const __v2df *)__m, (__v4si)__i, \
+             (__v2df)_mm_set1_pd((double)(long long int)-1), (s)); })
+
+#define _mm256_i32gather_pd(m, i, s) __extension__ ({ \
+  double const *__m = (m); \
+  __m128i __i = (i); \
+  (__m256d)__builtin_ia32_gatherd_pd256((__v4df)_mm256_setzero_pd(), \
+             (const __v4df *)__m, (__v4si)__i, \
+             (__v4df)_mm256_set1_pd((double)(long long int)-1), (s)); })
+
+#define _mm_i64gather_pd(m, i, s) __extension__ ({ \
+  double const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128d)__builtin_ia32_gatherq_pd((__v2df)_mm_setzero_pd(), \
+             (const __v2df *)__m, (__v2di)__i, \
+             (__v2df)_mm_set1_pd((double)(long long int)-1), (s)); })
+
+#define _mm256_i64gather_pd(m, i, s) __extension__ ({ \
+  double const *__m = (m); \
+  __m256i __i = (i); \
+  (__m256d)__builtin_ia32_gatherq_pd256((__v4df)_mm256_setzero_pd(), \
+             (const __v4df *)__m, (__v4di)__i, \
+             (__v4df)_mm256_set1_pd((double)(long long int)-1), (s)); })
+
+#define _mm_i32gather_ps(m, i, s) __extension__ ({ \
+  float const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128)__builtin_ia32_gatherd_ps((__v4sf)_mm_setzero_ps(), \
+             (const __v4sf *)__m, (__v4si)__i, \
+             (__v4sf)_mm_set1_ps((float)(int)-1), (s)); })
+
+#define _mm256_i32gather_ps(m, i, s) __extension__ ({ \
+  float const *__m = (m); \
+  __m256i __i = (i); \
+  (__m256)__builtin_ia32_gatherd_ps256((__v8sf)_mm256_setzero_ps(), \
+             (const __v8sf *)__m, (__v8si)__i, \
+             (__v8sf)_mm256_set1_ps((float)(int)-1), (s)); })
+
+#define _mm_i64gather_ps(m, i, s) __extension__ ({ \
+  float const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128)__builtin_ia32_gatherq_ps((__v4sf)_mm_setzero_ps(), \
+             (const __v4sf *)__m, (__v2di)__i, \
+             (__v4sf)_mm_set1_ps((float)(int)-1), (s)); })
+
+#define _mm256_i64gather_ps(m, i, s) __extension__ ({ \
+  float const *__m = (m); \
+  __m256i __i = (i); \
+  (__m128)__builtin_ia32_gatherq_ps256((__v4sf)_mm_setzero_ps(), \
+             (const __v4sf *)__m, (__v4di)__i, \
+             (__v4sf)_mm_set1_ps((float)(int)-1), (s)); })
+
+#define _mm_i32gather_epi32(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128i)__builtin_ia32_gatherd_d((__v4si)_mm_setzero_si128(), \
+            (const __v4si *)__m, (__v4si)__i, \
+            (__v4si)_mm_set1_epi32(-1), (s)); })
+
+#define _mm256_i32gather_epi32(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m256i __i = (i); \
+  (__m256i)__builtin_ia32_gatherd_d256((__v8si)_mm256_setzero_si256(), \
+            (const __v8si *)__m, (__v8si)__i, \
+            (__v8si)_mm256_set1_epi32(-1), (s)); })
+
+#define _mm_i64gather_epi32(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128i)__builtin_ia32_gatherq_d((__v4si)_mm_setzero_si128(), \
+            (const __v4si *)__m, (__v2di)__i, \
+            (__v4si)_mm_set1_epi32(-1), (s)); })
+
+#define _mm256_i64gather_epi32(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m256i __i = (i); \
+  (__m128i)__builtin_ia32_gatherq_d256((__v4si)_mm_setzero_si128(), \
+            (const __v4si *)__m, (__v4di)__i, \
+            (__v4si)_mm_set1_epi32(-1), (s)); })
+
+#define _mm_i32gather_epi64(m, i, s) __extension__ ({ \
+  long long const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128i)__builtin_ia32_gatherd_q((__v2di)_mm_setzero_si128(), \
+             (const __v2di *)__m, (__v4si)__i, \
+             (__v2di)_mm_set1_epi64x(-1), (s)); })
+
+#define _mm256_i32gather_epi64(m, i, s) __extension__ ({ \
+  long long const *__m = (m); \
+  __m128i __i = (i); \
+  (__m256i)__builtin_ia32_gatherd_q256((__v4di)_mm256_setzero_si256(), \
+             (const __v4di *)__m, (__v4si)__i, \
+             (__v4di)_mm256_set1_epi64x(-1), (s)); })
+
+#define _mm_i64gather_epi64(m, i, s) __extension__ ({ \
+  long long const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128i)__builtin_ia32_gatherq_q((__v2di)_mm_setzero_si128(), \
+             (const __v2di *)__m, (__v2di)__i, \
+             (__v2di)_mm_set1_epi64x(-1), (s)); })
+
+#define _mm256_i64gather_epi64(m, i, s) __extension__ ({ \
+  long long const *__m = (m); \
+  __m256i __i = (i); \
+  (__m256i)__builtin_ia32_gatherq_q256((__v4di)_mm256_setzero_si256(), \
+             (const __v4di *)__m, (__v4di)__i, \
+             (__v4di)_mm256_set1_epi64x(-1), (s)); })
+
+#endif /* __AVX2INTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/avx2intrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/avx512vlbwintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/avx512vlbwintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/avx512vlbwintrin.h	(revision 13)
@@ -0,0 +1,83 @@
+/*===---- avx512vlbwintrin.h - AVX512VL and AVX512BW intrinsics ----------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use <avx512vlbwintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef __AVX512VLBWINTRIN_H
+#define __AVX512VLBWINTRIN_H
+
+/* Integer compare */
+
+static __inline__ __mmask16 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_epi8_mask(__m128i __a, __m128i __b) {
+  return (__mmask16)__builtin_ia32_pcmpeqb128_mask((__v16qi)__a, (__v16qi)__b,
+                                                   (__mmask16)-1);
+}
+
+static __inline__ __mmask16 __attribute__((__always_inline__, __nodebug__))
+_mm_mask_cmpeq_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
+  return (__mmask16)__builtin_ia32_pcmpeqb128_mask((__v16qi)__a, (__v16qi)__b,
+                                                   __u);
+}
+
+
+static __inline__ __mmask32 __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpeq_epi8_mask(__m256i __a, __m256i __b) {
+  return (__mmask32)__builtin_ia32_pcmpeqb256_mask((__v32qi)__a, (__v32qi)__b,
+                                                   (__mmask32)-1);
+}
+
+static __inline__ __mmask32 __attribute__((__always_inline__, __nodebug__))
+_mm256_mask_cmpeq_epi8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
+  return (__mmask32)__builtin_ia32_pcmpeqb256_mask((__v32qi)__a, (__v32qi)__b,
+                                                   __u);
+}
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_epi16_mask(__m128i __a, __m128i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqw128_mask((__v8hi)__a, (__v8hi)__b,
+                                                  (__mmask8)-1);
+}
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm_mask_cmpeq_epi16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqw128_mask((__v8hi)__a, (__v8hi)__b,
+                                                  __u);
+}
+
+
+static __inline__ __mmask16 __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpeq_epi16_mask(__m256i __a, __m256i __b) {
+  return (__mmask16)__builtin_ia32_pcmpeqw256_mask((__v16hi)__a, (__v16hi)__b,
+                                                   (__mmask16)-1);
+}
+
+static __inline__ __mmask16 __attribute__((__always_inline__, __nodebug__))
+_mm256_mask_cmpeq_epi16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
+  return (__mmask16)__builtin_ia32_pcmpeqw256_mask((__v16hi)__a, (__v16hi)__b,
+                                                   __u);
+}
+
+#endif /* __AVX512VLBWINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/avx512vlbwintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/bmiintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/bmiintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/bmiintrin.h	(revision 13)
@@ -0,0 +1,148 @@
+/*===---- bmiintrin.h - BMI intrinsics -------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
+#error "Never use <bmiintrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+#ifndef __BMI__
+# error "BMI instruction set not enabled"
+#endif /* __BMI__ */
+
+#ifndef __BMIINTRIN_H
+#define __BMIINTRIN_H
+
+#define _tzcnt_u16(a)     (__tzcnt_u16((a)))
+#define _andn_u32(a, b)   (__andn_u32((a), (b)))
+/* _bextr_u32 != __bextr_u32 */
+#define _blsi_u32(a)      (__blsi_u32((a)))
+#define _blsmsk_u32(a)    (__blsmsk_u32((a)))
+#define _blsr_u32(a)      (__blsr_u32((a)))
+#define _tzcnt_u32(a)     (__tzcnt_u32((a)))
+
+static __inline__ unsigned short __attribute__((__always_inline__, __nodebug__))
+__tzcnt_u16(unsigned short __X)
+{
+  return __X ? __builtin_ctzs(__X) : 16;
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__andn_u32(unsigned int __X, unsigned int __Y)
+{
+  return ~__X & __Y;
+}
+
+/* AMD-specified, double-leading-underscore version of BEXTR */
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__bextr_u32(unsigned int __X, unsigned int __Y)
+{
+  return __builtin_ia32_bextr_u32(__X, __Y);
+}
+
+/* Intel-specified, single-leading-underscore version of BEXTR */
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_bextr_u32(unsigned int __X, unsigned int __Y, unsigned int __Z)
+{
+  return __builtin_ia32_bextr_u32 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__blsi_u32(unsigned int __X)
+{
+  return __X & -__X;
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__blsmsk_u32(unsigned int __X)
+{
+  return __X ^ (__X - 1);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__blsr_u32(unsigned int __X)
+{
+  return __X & (__X - 1);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__tzcnt_u32(unsigned int __X)
+{
+  return __X ? __builtin_ctz(__X) : 32;
+}
+
+#ifdef __x86_64__
+
+#define _andn_u64(a, b)   (__andn_u64((a), (b)))
+/* _bextr_u64 != __bextr_u64 */
+#define _blsi_u64(a)      (__blsi_u64((a)))
+#define _blsmsk_u64(a)    (__blsmsk_u64((a)))
+#define _blsr_u64(a)      (__blsr_u64((a)))
+#define _tzcnt_u64(a)     (__tzcnt_u64((a)))
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__andn_u64 (unsigned long long __X, unsigned long long __Y)
+{
+  return ~__X & __Y;
+}
+
+/* AMD-specified, double-leading-underscore version of BEXTR */
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__bextr_u64(unsigned long long __X, unsigned long long __Y)
+{
+  return __builtin_ia32_bextr_u64(__X, __Y);
+}
+
+/* Intel-specified, single-leading-underscore version of BEXTR */
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+_bextr_u64(unsigned long long __X, unsigned int __Y, unsigned int __Z)
+{
+  return __builtin_ia32_bextr_u64 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__blsi_u64(unsigned long long __X)
+{
+  return __X & -__X;
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__blsmsk_u64(unsigned long long __X)
+{
+  return __X ^ (__X - 1);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__blsr_u64(unsigned long long __X)
+{
+  return __X & (__X - 1);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__tzcnt_u64(unsigned long long __X)
+{
+  return __X ? __builtin_ctzll(__X) : 64;
+}
+
+#endif /* __x86_64__ */
+
+#endif /* __BMIINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/bmiintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/tuple
===================================================================
--- lab4/.minix-src/include/c++/tuple	(nonexistent)
+++ lab4/.minix-src/include/c++/tuple	(revision 13)
@@ -0,0 +1,1135 @@
+// -*- C++ -*-
+//===--------------------------- tuple ------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_TUPLE
+#define _LIBCPP_TUPLE
+
+/*
+    tuple synopsis
+
+namespace std
+{
+
+template <class... T>
+class tuple {
+public:
+    constexpr tuple();
+    explicit tuple(const T&...);  // constexpr in C++14
+    template <class... U>
+        explicit tuple(U&&...);  // constexpr in C++14
+    tuple(const tuple&) = default;
+    tuple(tuple&&) = default;
+    template <class... U>
+        tuple(const tuple<U...>&);  // constexpr in C++14
+    template <class... U>
+        tuple(tuple<U...>&&);  // constexpr in C++14
+    template <class U1, class U2>
+        tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14
+    template <class U1, class U2>
+        tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2  // constexpr in C++14
+
+    // allocator-extended constructors
+    template <class Alloc>
+        tuple(allocator_arg_t, const Alloc& a);
+    template <class Alloc>
+        tuple(allocator_arg_t, const Alloc& a, const T&...);
+    template <class Alloc, class... U>
+        tuple(allocator_arg_t, const Alloc& a, U&&...);
+    template <class Alloc>
+        tuple(allocator_arg_t, const Alloc& a, const tuple&);
+    template <class Alloc>
+        tuple(allocator_arg_t, const Alloc& a, tuple&&);
+    template <class Alloc, class... U>
+        tuple(allocator_arg_t, const Alloc& a, const tuple<U...>&);
+    template <class Alloc, class... U>
+        tuple(allocator_arg_t, const Alloc& a, tuple<U...>&&);
+    template <class Alloc, class U1, class U2>
+        tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
+    template <class Alloc, class U1, class U2>
+        tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
+
+    tuple& operator=(const tuple&);
+    tuple&
+        operator=(tuple&&) noexcept(AND(is_nothrow_move_assignable<T>::value ...));
+    template <class... U>
+        tuple& operator=(const tuple<U...>&);
+    template <class... U>
+        tuple& operator=(tuple<U...>&&);
+    template <class U1, class U2>
+        tuple& operator=(const pair<U1, U2>&); // iff sizeof...(T) == 2
+    template <class U1, class U2>
+        tuple& operator=(pair<U1, U2>&&); //iffsizeof...(T) == 2
+
+    void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...));
+};
+
+const unspecified ignore;
+
+template <class... T> tuple<V...>  make_tuple(T&&...); // constexpr in C++14
+template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept; // constexpr in C++14
+template <class... T> tuple<T&...> tie(T&...) noexcept; // constexpr in C++14
+template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls); // constexpr in C++14
+  
+// 20.4.1.4, tuple helper classes:
+template <class T> class tuple_size; // undefined
+template <class... T> class tuple_size<tuple<T...>>;
+template <intsize_t I, class T> class tuple_element; // undefined
+template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
+template <size_t _Ip, class ..._Tp>
+  using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; // C++14
+
+// 20.4.1.5, element access:
+template <intsize_t I, class... T>
+    typename tuple_element<I, tuple<T...>>::type&
+    get(tuple<T...>&) noexcept; // constexpr in C++14
+template <intsize_t I, class... T>
+    typename const tuple_element<I, tuple<T...>>::type &
+    get(const tuple<T...>&) noexcept; // constexpr in C++14
+template <intsize_t I, class... T>
+    typename tuple_element<I, tuple<T...>>::type&&
+    get(tuple<T...>&&) noexcept; // constexpr in C++14
+
+template <class T1, class... T>
+    constexpr T1& get(tuple<T...>&) noexcept;  // C++14
+template <class T1, class... T>
+    constexpr T1 const& get(const tuple<T...>&) noexcept;   // C++14
+template <class T1, class... T>
+    constexpr T1&& get(tuple<T...>&&) noexcept;   // C++14
+
+// 20.4.1.6, relational operators:
+template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
+template<class... T, class... U> bool operator<(const tuple<T...>&, const tuple<U...>&);  // constexpr in C++14
+template<class... T, class... U> bool operator!=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
+template<class... T, class... U> bool operator>(const tuple<T...>&, const tuple<U...>&);  // constexpr in C++14
+template<class... T, class... U> bool operator<=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
+template<class... T, class... U> bool operator>=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
+
+template <class... Types, class Alloc>
+  struct uses_allocator<tuple<Types...>, Alloc>;
+
+template <class... Types>
+  void
+  swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(noexcept(x.swap(y)));
+
+}  // std
+
+*/
+
+#include <__config>
+#include <__tuple>
+#include <cstddef>
+#include <type_traits>
+#include <__functional_base>
+#include <utility>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+// tuple_size
+
+template <class ..._Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_size<tuple<_Tp...> >
+    : public integral_constant<size_t, sizeof...(_Tp)>
+{
+};
+
+// tuple_element
+
+template <size_t _Ip, class ..._Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, tuple<_Tp...> >
+{
+public:
+    typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
+};
+
+#if _LIBCPP_STD_VER > 11
+template <size_t _Ip, class ..._Tp>
+using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type;
+#endif
+
+// __tuple_leaf
+
+template <size_t _Ip, class _Hp,
+          bool=is_empty<_Hp>::value && !__libcpp_is_final<_Hp>::value
+         >
+class __tuple_leaf;
+
+template <size_t _Ip, class _Hp, bool _Ep>
+inline _LIBCPP_INLINE_VISIBILITY
+void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
+    _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value)
+{
+    swap(__x.get(), __y.get());
+}
+
+template <size_t _Ip, class _Hp, bool>
+class __tuple_leaf
+{
+    _Hp value;
+
+    __tuple_leaf& operator=(const __tuple_leaf&);
+public:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
+             _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value()
+       {static_assert(!is_reference<_Hp>::value,
+              "Attempted to default construct a reference element in a tuple");}
+
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        __tuple_leaf(integral_constant<int, 0>, const _Alloc&)
+            : value()
+        {static_assert(!is_reference<_Hp>::value,
+              "Attempted to default construct a reference element in a tuple");}
+
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
+            : value(allocator_arg_t(), __a)
+        {static_assert(!is_reference<_Hp>::value,
+              "Attempted to default construct a reference element in a tuple");}
+
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
+            : value(__a)
+        {static_assert(!is_reference<_Hp>::value,
+              "Attempted to default construct a reference element in a tuple");}
+
+    template <class _Tp,
+              class = typename enable_if<
+                  __lazy_and<
+                      __lazy_not<is_same<typename decay<_Tp>::type, __tuple_leaf>>
+                    , is_constructible<_Hp, _Tp>
+                    >::value
+                >::type
+            >
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
+            : value(_VSTD::forward<_Tp>(__t))
+        {static_assert(!is_reference<_Hp>::value ||
+                       (is_lvalue_reference<_Hp>::value &&
+                        (is_lvalue_reference<_Tp>::value ||
+                         is_same<typename remove_reference<_Tp>::type,
+                                 reference_wrapper<
+                                    typename remove_reference<_Hp>::type
+                                 >
+                                >::value)) ||
+                        (is_rvalue_reference<_Hp>::value &&
+                         !is_lvalue_reference<_Tp>::value),
+       "Attempted to construct a reference element in a tuple with an rvalue");}
+
+    template <class _Tp, class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
+            : value(_VSTD::forward<_Tp>(__t))
+        {static_assert(!is_lvalue_reference<_Hp>::value ||
+                       (is_lvalue_reference<_Hp>::value &&
+                        (is_lvalue_reference<_Tp>::value ||
+                         is_same<typename remove_reference<_Tp>::type,
+                                 reference_wrapper<
+                                    typename remove_reference<_Hp>::type
+                                 >
+                                >::value)),
+       "Attempted to construct a reference element in a tuple with an rvalue");}
+
+    template <class _Tp, class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
+            : value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t))
+        {static_assert(!is_lvalue_reference<_Hp>::value ||
+                       (is_lvalue_reference<_Hp>::value &&
+                        (is_lvalue_reference<_Tp>::value ||
+                         is_same<typename remove_reference<_Tp>::type,
+                                 reference_wrapper<
+                                    typename remove_reference<_Hp>::type
+                                 >
+                                >::value)),
+       "Attempted to construct a reference element in a tuple with an rvalue");}
+
+    template <class _Tp, class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
+            : value(_VSTD::forward<_Tp>(__t), __a)
+        {static_assert(!is_lvalue_reference<_Hp>::value ||
+                       (is_lvalue_reference<_Hp>::value &&
+                        (is_lvalue_reference<_Tp>::value ||
+                         is_same<typename remove_reference<_Tp>::type,
+                                 reference_wrapper<
+                                    typename remove_reference<_Hp>::type
+                                 >
+                                >::value)),
+       "Attempted to construct a reference element in a tuple with an rvalue");}
+
+    __tuple_leaf(const __tuple_leaf& __t) = default;
+    __tuple_leaf(__tuple_leaf&& __t) = default;
+
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        __tuple_leaf&
+        operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
+        {
+            value = _VSTD::forward<_Tp>(__t);
+            return *this;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
+    {
+        _VSTD::swap(*this, __t);
+        return 0;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11       _Hp& get()       _NOEXCEPT {return value;}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return value;}
+};
+
+template <size_t _Ip, class _Hp>
+class __tuple_leaf<_Ip, _Hp, true>
+    : private _Hp
+{
+
+    __tuple_leaf& operator=(const __tuple_leaf&);
+public:
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
+             _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
+
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {}
+
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
+            : _Hp(allocator_arg_t(), __a) {}
+
+    template <class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
+            : _Hp(__a) {}
+
+    template <class _Tp,
+              class = typename enable_if<
+                  __lazy_and<
+                        __lazy_not<is_same<typename decay<_Tp>::type, __tuple_leaf>>
+                      , is_constructible<_Hp, _Tp>
+                    >::value
+                >::type
+            >
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
+            : _Hp(_VSTD::forward<_Tp>(__t)) {}
+
+    template <class _Tp, class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
+            : _Hp(_VSTD::forward<_Tp>(__t)) {}
+
+    template <class _Tp, class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
+            : _Hp(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {}
+
+    template <class _Tp, class _Alloc>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
+            : _Hp(_VSTD::forward<_Tp>(__t), __a) {}
+
+    __tuple_leaf(__tuple_leaf const &) = default;
+    __tuple_leaf(__tuple_leaf &&) = default;
+
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        __tuple_leaf&
+        operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
+        {
+            _Hp::operator=(_VSTD::forward<_Tp>(__t));
+            return *this;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    int
+    swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
+    {
+        _VSTD::swap(*this, __t);
+        return 0;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11       _Hp& get()       _NOEXCEPT {return static_cast<_Hp&>(*this);}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);}
+};
+
+template <class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY
+void __swallow(_Tp&&...) _NOEXCEPT {}
+
+template <bool ..._Pred>
+struct __all
+    : is_same<__all<_Pred...>, __all<(_Pred, true)...>>
+{ };
+
+template <class _Tp>
+struct __all_default_constructible;
+
+template <class ..._Tp>
+struct __all_default_constructible<__tuple_types<_Tp...>>
+    : __all<is_default_constructible<_Tp>::value...>
+{ };
+
+// __tuple_impl
+
+template<class _Indx, class ..._Tp> struct __tuple_impl;
+
+template<size_t ..._Indx, class ..._Tp>
+struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
+    : public __tuple_leaf<_Indx, _Tp>...
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR __tuple_impl()
+        _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
+
+    template <size_t ..._Uf, class ..._Tf,
+              size_t ..._Ul, class ..._Tl, class ..._Up>
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        explicit
+        __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
+                     __tuple_indices<_Ul...>, __tuple_types<_Tl...>,
+                     _Up&&... __u)
+                     _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
+                                 __all<is_nothrow_default_constructible<_Tl>::value...>::value)) :
+            __tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))...,
+            __tuple_leaf<_Ul, _Tl>()...
+            {}
+
+    template <class _Alloc, size_t ..._Uf, class ..._Tf,
+              size_t ..._Ul, class ..._Tl, class ..._Up>
+        _LIBCPP_INLINE_VISIBILITY
+        explicit
+        __tuple_impl(allocator_arg_t, const _Alloc& __a,
+                     __tuple_indices<_Uf...>, __tuple_types<_Tf...>,
+                     __tuple_indices<_Ul...>, __tuple_types<_Tl...>,
+                     _Up&&... __u) :
+            __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a,
+            _VSTD::forward<_Up>(__u))...,
+            __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)...
+            {}
+
+    template <class _Tuple,
+              class = typename enable_if
+                      <
+                         __tuple_constructible<_Tuple, tuple<_Tp...> >::value
+                      >::type
+             >
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx,
+                                       typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
+            : __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename tuple_element<_Indx,
+                                       typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
+            {}
+
+    template <class _Alloc, class _Tuple,
+              class = typename enable_if
+                      <
+                         __tuple_convertible<_Tuple, tuple<_Tp...> >::value
+                      >::type
+             >
+        _LIBCPP_INLINE_VISIBILITY
+        __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
+            : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx,
+                                       typename __make_tuple_types<_Tuple>::type>::type>(), __a,
+                                       _VSTD::forward<typename tuple_element<_Indx,
+                                       typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
+            {}
+
+    template <class _Tuple>
+        _LIBCPP_INLINE_VISIBILITY
+        typename enable_if
+        <
+            __tuple_assignable<_Tuple, tuple<_Tp...> >::value,
+            __tuple_impl&
+        >::type
+        operator=(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_assignable<_Tp&, typename tuple_element<_Indx,
+                                       typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
+        {
+            __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<typename tuple_element<_Indx,
+                                       typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...);
+            return *this;
+        }
+
+    __tuple_impl(const __tuple_impl&) = default;
+    __tuple_impl(__tuple_impl&&) = default;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __tuple_impl&
+    operator=(const __tuple_impl& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value))
+    {
+        __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __tuple_impl&
+    operator=(__tuple_impl&& __t) _NOEXCEPT_((__all<is_nothrow_move_assignable<_Tp>::value...>::value))
+    {
+        __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<_Tp>(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t).get()))...);
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(__tuple_impl& __t)
+        _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
+    {
+        __swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
+    }
+};
+
+template <class ..._Tp>
+class _LIBCPP_TYPE_VIS_ONLY tuple
+{
+    typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> base;
+
+    base base_;
+
+    template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
+        typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
+    template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
+        const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
+    template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
+        typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
+public:
+
+    template <bool _Dummy = true, class = typename enable_if<
+        __all<__dependent_type<is_default_constructible<_Tp>, _Dummy>::value...>::value
+    >::type>
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR tuple()
+        _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value)) 
+        : base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
+                typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
+                typename __make_tuple_indices<0>::type(),
+                typename __make_tuple_types<tuple, 0>::type(),
+                __t...
+               ) {}
+
+    template <class _Alloc>
+      _LIBCPP_INLINE_VISIBILITY
+      tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
+        : base_(allocator_arg_t(), __a,
+                typename __make_tuple_indices<sizeof...(_Tp)>::type(),
+                typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
+                typename __make_tuple_indices<0>::type(),
+                typename __make_tuple_types<tuple, 0>::type(),
+                __t...
+               ) {}
+
+    template <class ..._Up,
+              typename enable_if
+                      <
+                         sizeof...(_Up) <= sizeof...(_Tp) &&
+                         __tuple_convertible
+                         <
+                            tuple<_Up...>,
+                            typename __make_tuple_types<tuple,
+                                     sizeof...(_Up) < sizeof...(_Tp) ?
+                                        sizeof...(_Up) :
+                                        sizeof...(_Tp)>::type
+                         >::value &&
+                         __all_default_constructible<
+                            typename __make_tuple_types<tuple, sizeof...(_Tp),
+                                sizeof...(_Up) < sizeof...(_Tp) ?
+                                    sizeof...(_Up) :
+                                    sizeof...(_Tp)>::type
+                         >::value,
+                         bool
+                      >::type = false
+             >
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        tuple(_Up&&... __u)
+            _NOEXCEPT_((
+                is_nothrow_constructible<base,
+                    typename __make_tuple_indices<sizeof...(_Up)>::type,
+                    typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
+                    typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
+                    typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type,
+                    _Up...
+                >::value
+            ))
+            : base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
+                    typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
+                    typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
+                    typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
+                    _VSTD::forward<_Up>(__u)...) {}
+
+    template <class ..._Up,
+              typename enable_if
+                      <
+                         sizeof...(_Up) <= sizeof...(_Tp) &&
+                         __tuple_constructible
+                         <
+                            tuple<_Up...>,
+                            typename __make_tuple_types<tuple,
+                                     sizeof...(_Up) < sizeof...(_Tp) ?
+                                        sizeof...(_Up) :
+                                        sizeof...(_Tp)>::type
+                         >::value &&
+                         !__tuple_convertible
+                         <
+                            tuple<_Up...>,
+                            typename __make_tuple_types<tuple,
+                                     sizeof...(_Up) < sizeof...(_Tp) ?
+                                        sizeof...(_Up) :
+                                        sizeof...(_Tp)>::type
+                         >::value &&
+                         __all_default_constructible<
+                            typename __make_tuple_types<tuple, sizeof...(_Tp),
+                                sizeof...(_Up) < sizeof...(_Tp) ?
+                                    sizeof...(_Up) :
+                                    sizeof...(_Tp)>::type
+                         >::value,
+                         bool
+                      >::type =false
+             >
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        explicit
+        tuple(_Up&&... __u)
+            _NOEXCEPT_((
+                is_nothrow_constructible<base,
+                    typename __make_tuple_indices<sizeof...(_Up)>::type,
+                    typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
+                    typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
+                    typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type,
+                    _Up...
+                >::value
+            ))
+            : base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
+                    typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
+                    typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
+                    typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
+                    _VSTD::forward<_Up>(__u)...) {}
+
+    template <class _Alloc, class ..._Up,
+              class = typename enable_if
+                      <
+                         sizeof...(_Up) <= sizeof...(_Tp) &&
+                         __tuple_convertible
+                         <
+                            tuple<_Up...>,
+                            typename __make_tuple_types<tuple,
+                                     sizeof...(_Up) < sizeof...(_Tp) ?
+                                        sizeof...(_Up) :
+                                        sizeof...(_Tp)>::type
+                         >::value &&
+                         __all_default_constructible<
+                            typename __make_tuple_types<tuple, sizeof...(_Tp),
+                                sizeof...(_Up) < sizeof...(_Tp) ?
+                                    sizeof...(_Up) :
+                                    sizeof...(_Tp)>::type
+                         >::value
+                      >::type
+             >
+        _LIBCPP_INLINE_VISIBILITY
+        tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
+            : base_(allocator_arg_t(), __a,
+                    typename __make_tuple_indices<sizeof...(_Up)>::type(),
+                    typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
+                    typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
+                    typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
+                    _VSTD::forward<_Up>(__u)...) {}
+
+    template <class _Tuple,
+              typename enable_if
+                      <
+                         __tuple_convertible<_Tuple, tuple>::value,
+                         bool
+                      >::type = false
+             >
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
+            : base_(_VSTD::forward<_Tuple>(__t)) {}
+
+    template <class _Tuple,
+              typename enable_if
+                      <
+                         __tuple_constructible<_Tuple, tuple>::value &&
+                         !__tuple_convertible<_Tuple, tuple>::value,
+                         bool
+                      >::type = false
+             >
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+        explicit
+        tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
+            : base_(_VSTD::forward<_Tuple>(__t)) {}
+
+    template <class _Alloc, class _Tuple,
+              class = typename enable_if
+                      <
+                         __tuple_convertible<_Tuple, tuple>::value
+                      >::type
+             >
+        _LIBCPP_INLINE_VISIBILITY
+        tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
+            : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {}
+
+    template <class _Tuple,
+              class = typename enable_if
+                      <
+                         __tuple_assignable<_Tuple, tuple>::value
+                      >::type
+             >
+        _LIBCPP_INLINE_VISIBILITY
+        tuple&
+        operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<base&, _Tuple>::value))
+        {
+            base_.operator=(_VSTD::forward<_Tuple>(__t));
+            return *this;
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
+        {base_.swap(__t.base_);}
+};
+
+template <>
+class _LIBCPP_TYPE_VIS_ONLY tuple<>
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {}
+    template <class _Alloc>
+    _LIBCPP_INLINE_VISIBILITY
+        tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
+    template <class _Alloc>
+    _LIBCPP_INLINE_VISIBILITY
+        tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {}
+    template <class _Up>
+    _LIBCPP_INLINE_VISIBILITY
+        tuple(array<_Up, 0>) _NOEXCEPT {}
+    template <class _Alloc, class _Up>
+    _LIBCPP_INLINE_VISIBILITY
+        tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(tuple&) _NOEXCEPT {}
+};
+
+template <class ..._Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __all<__is_swappable<_Tp>::value...>::value,
+    void
+>::type
+swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
+                 _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
+    {__t.swap(__u);}
+
+// get
+
+template <size_t _Ip, class ..._Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename tuple_element<_Ip, tuple<_Tp...> >::type&
+get(tuple<_Tp...>& __t) _NOEXCEPT
+{
+    typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+    return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get();
+}
+
+template <size_t _Ip, class ..._Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Ip, tuple<_Tp...> >::type&
+get(const tuple<_Tp...>& __t) _NOEXCEPT
+{
+    typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+    return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
+}
+
+template <size_t _Ip, class ..._Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(tuple<_Tp...>&& __t) _NOEXCEPT
+{
+    typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+    return static_cast<type&&>(
+             static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
+}
+
+#if _LIBCPP_STD_VER > 11
+// get by type
+template <typename _T1, size_t _Idx, typename... _Args>
+struct __find_exactly_one_t_helper;
+
+// -- find exactly one
+template <typename _T1, size_t _Idx, typename... _Args>
+struct __find_exactly_one_t_checker {
+    static constexpr size_t value = _Idx;
+//  Check the rest of the list to make sure there's only one
+    static_assert ( __find_exactly_one_t_helper<_T1, 0, _Args...>::value == -1, "type can only occur once in type list" );
+    };
+
+
+template <typename _T1, size_t _Idx>
+struct __find_exactly_one_t_helper <_T1, _Idx> {
+    static constexpr size_t value = -1;
+    };
+
+template <typename _T1, size_t _Idx, typename _Head, typename... _Args>
+struct __find_exactly_one_t_helper <_T1, _Idx, _Head, _Args...> {
+    static constexpr size_t value =
+        std::conditional<
+            std::is_same<_T1, _Head>::value,
+            __find_exactly_one_t_checker<_T1, _Idx,   _Args...>,
+            __find_exactly_one_t_helper <_T1, _Idx+1, _Args...>
+        >::type::value;
+    };
+
+template <typename _T1, typename... _Args>
+struct __find_exactly_one_t {
+    static constexpr size_t value = __find_exactly_one_t_helper<_T1, 0, _Args...>::value;
+    static_assert ( value != -1, "type not found in type list" );
+    };
+
+template <class _T1, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1& get(tuple<_Args...>& __tup) noexcept
+{
+    return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
+}
+
+template <class _T1, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept
+{
+    return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
+}
+
+template <class _T1, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept
+{
+    return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup));
+}
+
+#endif
+
+// tie
+
+template <class ..._Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+tuple<_Tp&...>
+tie(_Tp&... __t) _NOEXCEPT
+{
+    return tuple<_Tp&...>(__t...);
+}
+
+template <class _Up>
+struct __ignore_t
+{
+    template <class _Tp>
+        _LIBCPP_INLINE_VISIBILITY
+        const __ignore_t& operator=(_Tp&&) const {return *this;}
+};
+
+namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); }
+
+template <class _Tp>
+struct __make_tuple_return_impl
+{
+    typedef _Tp type;
+};
+
+template <class _Tp>
+struct __make_tuple_return_impl<reference_wrapper<_Tp> >
+{
+    typedef _Tp& type;
+};
+
+template <class _Tp>
+struct __make_tuple_return
+{
+    typedef typename __make_tuple_return_impl<typename decay<_Tp>::type>::type type;
+};
+
+template <class... _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+tuple<typename __make_tuple_return<_Tp>::type...>
+make_tuple(_Tp&&... __t)
+{
+    return tuple<typename __make_tuple_return<_Tp>::type...>(_VSTD::forward<_Tp>(__t)...);
+}
+
+template <class... _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+tuple<_Tp&&...>
+forward_as_tuple(_Tp&&... __t) _NOEXCEPT
+{
+    return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
+}
+
+template <size_t _Ip>
+struct __tuple_equal
+{
+    template <class _Tp, class _Up>
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _Tp& __x, const _Up& __y)
+    {
+        return __tuple_equal<_Ip - 1>()(__x, __y) && _VSTD::get<_Ip-1>(__x) == _VSTD::get<_Ip-1>(__y);
+    }
+};
+
+template <>
+struct __tuple_equal<0>
+{
+    template <class _Tp, class _Up>
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _Tp&, const _Up&)
+    {
+        return true;
+    }
+};
+
+template <class ..._Tp, class ..._Up>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
+{
+    return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
+}
+
+template <class ..._Tp, class ..._Up>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
+{
+    return !(__x == __y);
+}
+
+template <size_t _Ip>
+struct __tuple_less
+{
+    template <class _Tp, class _Up>
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _Tp& __x, const _Up& __y)
+    {
+        const size_t __idx = tuple_size<_Tp>::value - _Ip;
+        if (_VSTD::get<__idx>(__x) < _VSTD::get<__idx>(__y))
+            return true;
+        if (_VSTD::get<__idx>(__y) < _VSTD::get<__idx>(__x))
+            return false;
+        return __tuple_less<_Ip-1>()(__x, __y);
+    }
+};
+
+template <>
+struct __tuple_less<0>
+{
+    template <class _Tp, class _Up>
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(const _Tp&, const _Up&)
+    {
+        return false;
+    }
+};
+
+template <class ..._Tp, class ..._Up>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
+{
+    return __tuple_less<sizeof...(_Tp)>()(__x, __y);
+}
+
+template <class ..._Tp, class ..._Up>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
+{
+    return __y < __x;
+}
+
+template <class ..._Tp, class ..._Up>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class ..._Tp, class ..._Up>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool
+operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
+{
+    return !(__y < __x);
+}
+
+// tuple_cat
+
+template <class _Tp, class _Up> struct __tuple_cat_type;
+
+template <class ..._Ttypes, class ..._Utypes>
+struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
+{
+    typedef tuple<_Ttypes..., _Utypes...> type;
+};
+
+template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
+struct __tuple_cat_return_1
+{
+};
+
+template <class ..._Types, class _Tuple0>
+struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
+{
+    typedef typename __tuple_cat_type<tuple<_Types...>,
+            typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type
+                                                                           type;
+};
+
+template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
+struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
+    : public __tuple_cat_return_1<
+                 typename __tuple_cat_type<
+                     tuple<_Types...>,
+                     typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type
+                 >::type,
+                 __tuple_like<typename remove_reference<_Tuple1>::type>::value,
+                 _Tuple1, _Tuples...>
+{
+};
+
+template <class ..._Tuples> struct __tuple_cat_return;
+
+template <class _Tuple0, class ..._Tuples>
+struct __tuple_cat_return<_Tuple0, _Tuples...>
+    : public __tuple_cat_return_1<tuple<>,
+         __tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0,
+                                                                     _Tuples...>
+{
+};
+
+template <>
+struct __tuple_cat_return<>
+{
+    typedef tuple<> type;
+};
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+tuple<>
+tuple_cat()
+{
+    return tuple<>();
+}
+
+template <class _Rp, class _Indices, class _Tuple0, class ..._Tuples>
+struct __tuple_cat_return_ref_imp;
+
+template <class ..._Types, size_t ..._I0, class _Tuple0>
+struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
+{
+    typedef typename remove_reference<_Tuple0>::type _T0;
+    typedef tuple<_Types..., typename __apply_cv<_Tuple0,
+                          typename tuple_element<_I0, _T0>::type>::type&&...> type;
+};
+
+template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
+struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
+                                  _Tuple0, _Tuple1, _Tuples...>
+    : public __tuple_cat_return_ref_imp<
+         tuple<_Types..., typename __apply_cv<_Tuple0,
+               typename tuple_element<_I0,
+                  typename remove_reference<_Tuple0>::type>::type>::type&&...>,
+         typename __make_tuple_indices<tuple_size<typename
+                                 remove_reference<_Tuple1>::type>::value>::type,
+         _Tuple1, _Tuples...>
+{
+};
+
+template <class _Tuple0, class ..._Tuples>
+struct __tuple_cat_return_ref
+    : public __tuple_cat_return_ref_imp<tuple<>,
+               typename __make_tuple_indices<
+                        tuple_size<typename remove_reference<_Tuple0>::type>::value
+               >::type, _Tuple0, _Tuples...>
+{
+};
+
+template <class _Types, class _I0, class _J0>
+struct __tuple_cat;
+
+template <class ..._Types, size_t ..._I0, size_t ..._J0>
+struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> >
+{
+    template <class _Tuple0>
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
+    operator()(tuple<_Types...> __t, _Tuple0&& __t0)
+    {
+        return forward_as_tuple(_VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,
+                                      _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...);
+    }
+
+    template <class _Tuple0, class _Tuple1, class ..._Tuples>
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
+    operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
+    {
+        typedef typename remove_reference<_Tuple0>::type _T0;
+        typedef typename remove_reference<_Tuple1>::type _T1;
+        return __tuple_cat<
+           tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
+           typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
+           typename __make_tuple_indices<tuple_size<_T1>::value>::type>()
+                           (forward_as_tuple(
+                              _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,
+                              _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...
+                            ),
+                            _VSTD::forward<_Tuple1>(__t1),
+                            _VSTD::forward<_Tuples>(__tpls)...);
+    }
+};
+
+template <class _Tuple0, class... _Tuples>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+typename __tuple_cat_return<_Tuple0, _Tuples...>::type
+tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
+{
+    typedef typename remove_reference<_Tuple0>::type _T0;
+    return __tuple_cat<tuple<>, __tuple_indices<>,
+                  typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
+                  (tuple<>(), _VSTD::forward<_Tuple0>(__t0),
+                                            _VSTD::forward<_Tuples>(__tpls)...);
+}
+
+template <class ..._Tp, class _Alloc>
+struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<tuple<_Tp...>, _Alloc>
+    : true_type {};
+
+template <class _T1, class _T2>
+template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2>
+inline _LIBCPP_INLINE_VISIBILITY
+pair<_T1, _T2>::pair(piecewise_construct_t,
+                     tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
+                     __tuple_indices<_I1...>, __tuple_indices<_I2...>)
+    :  first(_VSTD::forward<_Args1>(_VSTD::get<_I1>( __first_args))...),
+      second(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
+{
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_TUPLE

Property changes on: lab4/.minix-src/include/c++/tuple
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/unordered_map
===================================================================
--- lab4/.minix-src/include/c++/unordered_map	(nonexistent)
+++ lab4/.minix-src/include/c++/unordered_map	(revision 13)
@@ -0,0 +1,2251 @@
+// -*- C++ -*-
+//===-------------------------- unordered_map -----------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_UNORDERED_MAP
+#define _LIBCPP_UNORDERED_MAP
+
+/*
+
+    unordered_map synopsis
+
+#include <initializer_list>
+
+namespace std
+{
+
+template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
+          class Alloc = allocator<pair<const Key, T>>>
+class unordered_map
+{
+public:
+    // types
+    typedef Key                                                        key_type;
+    typedef T                                                          mapped_type;
+    typedef Hash                                                       hasher;
+    typedef Pred                                                       key_equal;
+    typedef Alloc                                                      allocator_type;
+    typedef pair<const key_type, mapped_type>                          value_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    typedef typename allocator_traits<allocator_type>::pointer         pointer;
+    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+    typedef typename allocator_traits<allocator_type>::size_type       size_type;
+    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+
+    typedef /unspecified/ iterator;
+    typedef /unspecified/ const_iterator;
+    typedef /unspecified/ local_iterator;
+    typedef /unspecified/ const_local_iterator;
+
+    unordered_map()
+        noexcept(
+            is_nothrow_default_constructible<hasher>::value &&
+            is_nothrow_default_constructible<key_equal>::value &&
+            is_nothrow_default_constructible<allocator_type>::value);
+    explicit unordered_map(size_type n, const hasher& hf = hasher(),
+                           const key_equal& eql = key_equal(),
+                           const allocator_type& a = allocator_type());
+    template <class InputIterator>
+        unordered_map(InputIterator f, InputIterator l,
+                      size_type n = 0, const hasher& hf = hasher(),
+                      const key_equal& eql = key_equal(),
+                      const allocator_type& a = allocator_type());
+    explicit unordered_map(const allocator_type&);
+    unordered_map(const unordered_map&);
+    unordered_map(const unordered_map&, const Allocator&);
+    unordered_map(unordered_map&&)
+        noexcept(
+            is_nothrow_move_constructible<hasher>::value &&
+            is_nothrow_move_constructible<key_equal>::value &&
+            is_nothrow_move_constructible<allocator_type>::value);
+    unordered_map(unordered_map&&, const Allocator&);
+    unordered_map(initializer_list<value_type>, size_type n = 0,
+                  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
+                  const allocator_type& a = allocator_type());
+    unordered_map(size_type n, const allocator_type& a)
+      : unordered_map(n, hasher(), key_equal(), a) {}  // C++14
+    unordered_map(size_type n, const hasher& hf, const allocator_type& a)
+      : unordered_map(n, hf, key_equal(), a) {}  // C++14
+    template <class InputIterator>
+      unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
+      : unordered_map(f, l, n, hasher(), key_equal(), a) {}  // C++14
+    template <class InputIterator>
+      unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf, 
+        const allocator_type& a)
+      : unordered_map(f, l, n, hf, key_equal(), a) {}  // C++14
+    unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
+      : unordered_map(il, n, hasher(), key_equal(), a) {}  // C++14
+    unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf, 
+      const allocator_type& a)
+      : unordered_map(il, n, hf, key_equal(), a) {}  // C++14
+    ~unordered_map();
+    unordered_map& operator=(const unordered_map&);
+    unordered_map& operator=(unordered_map&&)
+        noexcept(
+            allocator_type::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<allocator_type>::value &&
+            is_nothrow_move_assignable<hasher>::value &&
+            is_nothrow_move_assignable<key_equal>::value);
+    unordered_map& operator=(initializer_list<value_type>);
+
+    allocator_type get_allocator() const noexcept;
+
+    bool      empty() const noexcept;
+    size_type size() const noexcept;
+    size_type max_size() const noexcept;
+
+    iterator       begin() noexcept;
+    iterator       end() noexcept;
+    const_iterator begin()  const noexcept;
+    const_iterator end()    const noexcept;
+    const_iterator cbegin() const noexcept;
+    const_iterator cend()   const noexcept;
+
+    template <class... Args>
+        pair<iterator, bool> emplace(Args&&... args);
+    template <class... Args>
+        iterator emplace_hint(const_iterator position, Args&&... args);
+    pair<iterator, bool> insert(const value_type& obj);
+    template <class P>
+        pair<iterator, bool> insert(P&& obj);
+    iterator insert(const_iterator hint, const value_type& obj);
+    template <class P>
+        iterator insert(const_iterator hint, P&& obj);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+    void insert(initializer_list<value_type>);
+
+    template <class... Args>
+        pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);          // C++17
+    template <class... Args>
+        pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);               // C++17
+    template <class... Args>
+        iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17
+    template <class... Args>
+        iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);      // C++17
+    template <class M>
+        pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);            // C++17
+    template <class M>
+        pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);                 // C++17
+    template <class M>
+        iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);   // C++17
+    template <class M>
+        iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);        // C++17
+
+    iterator erase(const_iterator position);
+    iterator erase(iterator position);  // C++14
+    size_type erase(const key_type& k);
+    iterator erase(const_iterator first, const_iterator last);
+    void clear() noexcept;
+
+    void swap(unordered_map&)
+        noexcept(
+            (!allocator_type::propagate_on_container_swap::value ||
+             __is_nothrow_swappable<allocator_type>::value) &&
+            __is_nothrow_swappable<hasher>::value &&
+            __is_nothrow_swappable<key_equal>::value);
+
+    hasher hash_function() const;
+    key_equal key_eq() const;
+
+    iterator       find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    size_type count(const key_type& k) const;
+    pair<iterator, iterator>             equal_range(const key_type& k);
+    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
+
+    mapped_type& operator[](const key_type& k);
+    mapped_type& operator[](key_type&& k);
+
+    mapped_type&       at(const key_type& k);
+    const mapped_type& at(const key_type& k) const;
+
+    size_type bucket_count() const noexcept;
+    size_type max_bucket_count() const noexcept;
+
+    size_type bucket_size(size_type n) const;
+    size_type bucket(const key_type& k) const;
+
+    local_iterator       begin(size_type n);
+    local_iterator       end(size_type n);
+    const_local_iterator begin(size_type n) const;
+    const_local_iterator end(size_type n) const;
+    const_local_iterator cbegin(size_type n) const;
+    const_local_iterator cend(size_type n) const;
+
+    float load_factor() const noexcept;
+    float max_load_factor() const noexcept;
+    void max_load_factor(float z);
+    void rehash(size_type n);
+    void reserve(size_type n);
+};
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
+              unordered_map<Key, T, Hash, Pred, Alloc>& y)
+              noexcept(noexcept(x.swap(y)));
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    bool
+    operator==(const unordered_map<Key, T, Hash, Pred, Alloc>& x,
+               const unordered_map<Key, T, Hash, Pred, Alloc>& y);
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    bool
+    operator!=(const unordered_map<Key, T, Hash, Pred, Alloc>& x,
+               const unordered_map<Key, T, Hash, Pred, Alloc>& y);
+
+template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
+          class Alloc = allocator<pair<const Key, T>>>
+class unordered_multimap
+{
+public:
+    // types
+    typedef Key                                                        key_type;
+    typedef T                                                          mapped_type;
+    typedef Hash                                                       hasher;
+    typedef Pred                                                       key_equal;
+    typedef Alloc                                                      allocator_type;
+    typedef pair<const key_type, mapped_type>                          value_type;
+    typedef value_type&                                                reference;
+    typedef const value_type&                                          const_reference;
+    typedef typename allocator_traits<allocator_type>::pointer         pointer;
+    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+    typedef typename allocator_traits<allocator_type>::size_type       size_type;
+    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+
+    typedef /unspecified/ iterator;
+    typedef /unspecified/ const_iterator;
+    typedef /unspecified/ local_iterator;
+    typedef /unspecified/ const_local_iterator;
+
+    unordered_multimap()
+        noexcept(
+            is_nothrow_default_constructible<hasher>::value &&
+            is_nothrow_default_constructible<key_equal>::value &&
+            is_nothrow_default_constructible<allocator_type>::value);
+    explicit unordered_multimap(size_type n, const hasher& hf = hasher(),
+                           const key_equal& eql = key_equal(),
+                           const allocator_type& a = allocator_type());
+    template <class InputIterator>
+        unordered_multimap(InputIterator f, InputIterator l,
+                      size_type n = 0, const hasher& hf = hasher(),
+                      const key_equal& eql = key_equal(),
+                      const allocator_type& a = allocator_type());
+    explicit unordered_multimap(const allocator_type&);
+    unordered_multimap(const unordered_multimap&);
+    unordered_multimap(const unordered_multimap&, const Allocator&);
+    unordered_multimap(unordered_multimap&&)
+        noexcept(
+            is_nothrow_move_constructible<hasher>::value &&
+            is_nothrow_move_constructible<key_equal>::value &&
+            is_nothrow_move_constructible<allocator_type>::value);
+    unordered_multimap(unordered_multimap&&, const Allocator&);
+    unordered_multimap(initializer_list<value_type>, size_type n = 0,
+                  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
+                  const allocator_type& a = allocator_type());
+    unordered_multimap(size_type n, const allocator_type& a)
+      : unordered_multimap(n, hasher(), key_equal(), a) {}  // C++14
+    unordered_multimap(size_type n, const hasher& hf, const allocator_type& a)
+      : unordered_multimap(n, hf, key_equal(), a) {}  // C++14
+    template <class InputIterator>
+      unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
+      : unordered_multimap(f, l, n, hasher(), key_equal(), a) {}  // C++14
+    template <class InputIterator>
+      unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf, 
+        const allocator_type& a)
+      : unordered_multimap(f, l, n, hf, key_equal(), a) {}  // C++14
+    unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a)
+      : unordered_multimap(il, n, hasher(), key_equal(), a) {}  // C++14
+    unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf, 
+      const allocator_type& a)
+      : unordered_multimap(il, n, hf, key_equal(), a) {}  // C++14
+    ~unordered_multimap();
+    unordered_multimap& operator=(const unordered_multimap&);
+    unordered_multimap& operator=(unordered_multimap&&)
+        noexcept(
+            allocator_type::propagate_on_container_move_assignment::value &&
+            is_nothrow_move_assignable<allocator_type>::value &&
+            is_nothrow_move_assignable<hasher>::value &&
+            is_nothrow_move_assignable<key_equal>::value);
+    unordered_multimap& operator=(initializer_list<value_type>);
+
+    allocator_type get_allocator() const noexcept;
+
+    bool      empty() const noexcept;
+    size_type size() const noexcept;
+    size_type max_size() const noexcept;
+
+    iterator       begin() noexcept;
+    iterator       end() noexcept;
+    const_iterator begin()  const noexcept;
+    const_iterator end()    const noexcept;
+    const_iterator cbegin() const noexcept;
+    const_iterator cend()   const noexcept;
+
+    template <class... Args>
+        iterator emplace(Args&&... args);
+    template <class... Args>
+        iterator emplace_hint(const_iterator position, Args&&... args);
+    iterator insert(const value_type& obj);
+    template <class P>
+        iterator insert(P&& obj);
+    iterator insert(const_iterator hint, const value_type& obj);
+    template <class P>
+        iterator insert(const_iterator hint, P&& obj);
+    template <class InputIterator>
+        void insert(InputIterator first, InputIterator last);
+    void insert(initializer_list<value_type>);
+
+    iterator erase(const_iterator position);
+    iterator erase(iterator position);  // C++14
+    size_type erase(const key_type& k);
+    iterator erase(const_iterator first, const_iterator last);
+    void clear() noexcept;
+
+    void swap(unordered_multimap&)
+        noexcept(
+            (!allocator_type::propagate_on_container_swap::value ||
+             __is_nothrow_swappable<allocator_type>::value) &&
+            __is_nothrow_swappable<hasher>::value &&
+            __is_nothrow_swappable<key_equal>::value);
+
+    hasher hash_function() const;
+    key_equal key_eq() const;
+
+    iterator       find(const key_type& k);
+    const_iterator find(const key_type& k) const;
+    size_type count(const key_type& k) const;
+    pair<iterator, iterator>             equal_range(const key_type& k);
+    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
+
+    size_type bucket_count() const noexcept;
+    size_type max_bucket_count() const noexcept;
+
+    size_type bucket_size(size_type n) const;
+    size_type bucket(const key_type& k) const;
+
+    local_iterator       begin(size_type n);
+    local_iterator       end(size_type n);
+    const_local_iterator begin(size_type n) const;
+    const_local_iterator end(size_type n) const;
+    const_local_iterator cbegin(size_type n) const;
+    const_local_iterator cend(size_type n) const;
+
+    float load_factor() const noexcept;
+    float max_load_factor() const noexcept;
+    void max_load_factor(float z);
+    void rehash(size_type n);
+    void reserve(size_type n);
+};
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
+              unordered_multimap<Key, T, Hash, Pred, Alloc>& y)
+              noexcept(noexcept(x.swap(y)));
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    bool
+    operator==(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
+               const unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
+
+template <class Key, class T, class Hash, class Pred, class Alloc>
+    bool
+    operator!=(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
+               const unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <__hash_table>
+#include <functional>
+#include <stdexcept>
+
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Key, class _Cp, class _Hash,
+          bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value
+         >
+class __unordered_map_hasher
+    : private _Hash
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __unordered_map_hasher()
+        _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
+        : _Hash() {}
+    _LIBCPP_INLINE_VISIBILITY
+    __unordered_map_hasher(const _Hash& __h)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
+        : _Hash(__h) {}
+    _LIBCPP_INLINE_VISIBILITY
+    const _Hash& hash_function() const _NOEXCEPT {return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const _Cp& __x) const
+        {return static_cast<const _Hash&>(*this)(__x.__cc.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const _Key& __x) const
+        {return static_cast<const _Hash&>(*this)(__x);}
+    void swap(__unordered_map_hasher&__y)
+        _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
+    {
+        using _VSTD::swap;
+        swap(static_cast<const _Hash&>(*this), static_cast<const _Hash&>(__y));
+    }
+};
+
+template <class _Key, class _Cp, class _Hash>
+class __unordered_map_hasher<_Key, _Cp, _Hash, false>
+{
+    _Hash __hash_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __unordered_map_hasher()
+        _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
+        : __hash_() {}
+    _LIBCPP_INLINE_VISIBILITY
+    __unordered_map_hasher(const _Hash& __h)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
+        : __hash_(__h) {}
+    _LIBCPP_INLINE_VISIBILITY
+    const _Hash& hash_function() const _NOEXCEPT {return __hash_;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const _Cp& __x) const
+        {return __hash_(__x.__cc.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const _Key& __x) const
+        {return __hash_(__x);}
+    void swap(__unordered_map_hasher&__y)
+        _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
+    {
+        using _VSTD::swap;
+        swap(__hash_, __y.__hash_);
+    }
+};
+
+template <class _Key, class _Cp, class _Hash, bool __b>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x,
+     __unordered_map_hasher<_Key, _Cp, _Hash, __b>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Key, class _Cp, class _Pred,
+          bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
+         >
+class __unordered_map_equal
+    : private _Pred
+{
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __unordered_map_equal()
+        _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
+        : _Pred() {}
+    _LIBCPP_INLINE_VISIBILITY
+    __unordered_map_equal(const _Pred& __p)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
+        : _Pred(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    const _Pred& key_eq() const _NOEXCEPT {return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Cp& __x, const _Cp& __y) const
+        {return static_cast<const _Pred&>(*this)(__x.__cc.first, __y.__cc.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Cp& __x, const _Key& __y) const
+        {return static_cast<const _Pred&>(*this)(__x.__cc.first, __y);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Key& __x, const _Cp& __y) const
+        {return static_cast<const _Pred&>(*this)(__x, __y.__cc.first);}
+    void swap(__unordered_map_equal&__y)
+        _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
+    {
+        using _VSTD::swap;
+        swap(static_cast<const _Pred&>(*this), static_cast<const _Pred&>(__y));
+    }
+};
+
+template <class _Key, class _Cp, class _Pred>
+class __unordered_map_equal<_Key, _Cp, _Pred, false>
+{
+    _Pred __pred_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __unordered_map_equal()
+        _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
+        : __pred_() {}
+    _LIBCPP_INLINE_VISIBILITY
+    __unordered_map_equal(const _Pred& __p)
+        _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
+        : __pred_(__p) {}
+    _LIBCPP_INLINE_VISIBILITY
+    const _Pred& key_eq() const _NOEXCEPT {return __pred_;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Cp& __x, const _Cp& __y) const
+        {return __pred_(__x.__cc.first, __y.__cc.first);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Cp& __x, const _Key& __y) const
+        {return __pred_(__x.__cc.first, __y);}
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const _Key& __x, const _Cp& __y) const
+        {return __pred_(__x, __y.__cc.first);}
+    void swap(__unordered_map_equal&__y)
+        _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
+    {
+        using _VSTD::swap;
+        swap(__pred_, __y.__pred_);
+    }
+};
+
+template <class _Key, class _Cp, class _Pred, bool __b>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__unordered_map_equal<_Key, _Cp, _Pred, __b>& __x,
+     __unordered_map_equal<_Key, _Cp, _Pred, __b>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Alloc>
+class __hash_map_node_destructor
+{
+    typedef _Alloc                              allocator_type;
+    typedef allocator_traits<allocator_type>    __alloc_traits;
+    typedef typename __alloc_traits::value_type::value_type value_type;
+public:
+    typedef typename __alloc_traits::pointer    pointer;
+private:
+    typedef typename value_type::value_type::first_type     first_type;
+    typedef typename value_type::value_type::second_type    second_type;
+
+    allocator_type& __na_;
+
+    __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
+
+public:
+    bool __first_constructed;
+    bool __second_constructed;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT
+        : __na_(__na),
+          __first_constructed(false),
+          __second_constructed(false)
+        {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
+        _NOEXCEPT
+        : __na_(__x.__na_),
+          __first_constructed(__x.__value_constructed),
+          __second_constructed(__x.__value_constructed)
+        {
+            __x.__value_constructed = false;
+        }
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
+        : __na_(__x.__na_),
+          __first_constructed(__x.__value_constructed),
+          __second_constructed(__x.__value_constructed)
+        {
+            const_cast<bool&>(__x.__value_constructed) = false;
+        }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    void operator()(pointer __p) _NOEXCEPT
+    {
+        if (__second_constructed)
+            __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.second));
+        if (__first_constructed)
+            __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.first));
+        if (__p)
+            __alloc_traits::deallocate(__na_, __p, 1);
+    }
+};
+
+#if __cplusplus >= 201103L
+
+template <class _Key, class _Tp>
+union __hash_value_type
+{
+    typedef _Key                                     key_type;
+    typedef _Tp                                      mapped_type;
+    typedef pair<const key_type, mapped_type>        value_type;
+    typedef pair<key_type, mapped_type>              __nc_value_type;
+
+    value_type __cc;
+    __nc_value_type __nc;
+
+    template <class ..._Args>
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_value_type(_Args&& ...__args)
+        : __cc(std::forward<_Args>(__args)...) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_value_type(const __hash_value_type& __v)
+        : __cc(__v.__cc) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_value_type(__hash_value_type&& __v)
+        : __nc(_VSTD::move(__v.__nc)) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_value_type& operator=(const __hash_value_type& __v)
+        {__nc = __v.__cc; return *this;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_value_type& operator=(__hash_value_type&& __v)
+        {__nc = _VSTD::move(__v.__nc); return *this;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    ~__hash_value_type() {__cc.~value_type();}
+};
+
+#else
+
+template <class _Key, class _Tp>
+struct __hash_value_type
+{
+    typedef _Key                                     key_type;
+    typedef _Tp                                      mapped_type;
+    typedef pair<const key_type, mapped_type>        value_type;
+
+    value_type __cc;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_value_type() {}
+
+    template <class _A0>
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_value_type(const _A0& __a0)
+        : __cc(__a0) {}
+
+    template <class _A0, class _A1>
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_value_type(const _A0& __a0, const _A1& __a1)
+        : __cc(__a0, __a1) {}
+};
+
+#endif
+
+template <class _HashIterator>
+class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
+{
+    _HashIterator __i_;
+
+    typedef pointer_traits<typename _HashIterator::pointer>      __pointer_traits;
+    typedef const typename _HashIterator::value_type::value_type::first_type key_type;
+    typedef typename _HashIterator::value_type::value_type::second_type      mapped_type;
+public:
+    typedef forward_iterator_tag                                 iterator_category;
+    typedef pair<key_type, mapped_type>                          value_type;
+    typedef typename _HashIterator::difference_type              difference_type;
+    typedef value_type&                                          reference;
+    typedef typename __pointer_traits::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<value_type>
+#else
+            rebind<value_type>::other
+#endif
+                                                                 pointer;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_iterator() _NOEXCEPT {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference operator*() const {return __i_->__cc;}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__cc);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_iterator& operator++() {++__i_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_iterator operator++(int)
+    {
+        __hash_map_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
+        {return __x.__i_ == __y.__i_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
+        {return __x.__i_ != __y.__i_;}
+
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_map;
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_multimap;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
+};
+
+template <class _HashIterator>
+class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
+{
+    _HashIterator __i_;
+
+    typedef pointer_traits<typename _HashIterator::pointer>      __pointer_traits;
+    typedef const typename _HashIterator::value_type::value_type::first_type key_type;
+    typedef typename _HashIterator::value_type::value_type::second_type      mapped_type;
+public:
+    typedef forward_iterator_tag                                 iterator_category;
+    typedef pair<key_type, mapped_type>                          value_type;
+    typedef typename _HashIterator::difference_type              difference_type;
+    typedef const value_type&                                    reference;
+    typedef typename __pointer_traits::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+            rebind<const value_type>
+#else
+            rebind<const value_type>::other
+#endif
+                                                                 pointer;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_const_iterator() _NOEXCEPT {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_const_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_const_iterator(
+            __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
+                 _NOEXCEPT
+                : __i_(__i.__i_) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reference operator*() const {return __i_->__cc;}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__cc);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_const_iterator& operator++() {++__i_; return *this;}
+    _LIBCPP_INLINE_VISIBILITY
+    __hash_map_const_iterator operator++(int)
+    {
+        __hash_map_const_iterator __t(*this);
+        ++(*this);
+        return __t;
+    }
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
+        {return __x.__i_ == __y.__i_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
+        {return __x.__i_ != __y.__i_;}
+
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_map;
+    template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_multimap;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
+};
+
+template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
+          class _Alloc = allocator<pair<const _Key, _Tp> > >
+class _LIBCPP_TYPE_VIS_ONLY unordered_map
+{
+public:
+    // types
+    typedef _Key                                           key_type;
+    typedef _Tp                                            mapped_type;
+    typedef _Hash                                          hasher;
+    typedef _Pred                                          key_equal;
+    typedef _Alloc                                         allocator_type;
+    typedef pair<const key_type, mapped_type>              value_type;
+    typedef pair<key_type, mapped_type>                    __nc_value_type;
+    typedef value_type&                                    reference;
+    typedef const value_type&                              const_reference;
+    static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+                  "Invalid allocator::value_type");
+
+private:
+    typedef __hash_value_type<key_type, mapped_type>                 __value_type;
+    typedef __unordered_map_hasher<key_type, __value_type, hasher>   __hasher;
+    typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal;
+    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
+                                                 __value_type>::type __allocator_type;
+
+    typedef __hash_table<__value_type, __hasher,
+                         __key_equal,  __allocator_type>   __table;
+
+    __table __table_;
+
+    typedef typename __table::__node_pointer               __node_pointer;
+    typedef typename __table::__node_const_pointer         __node_const_pointer;
+    typedef typename __table::__node_traits                __node_traits;
+    typedef typename __table::__node_allocator             __node_allocator;
+    typedef typename __table::__node                       __node;
+    typedef __hash_map_node_destructor<__node_allocator>   _Dp;
+    typedef unique_ptr<__node, _Dp>                         __node_holder;
+    typedef allocator_traits<allocator_type>               __alloc_traits;
+public:
+    typedef typename __alloc_traits::pointer         pointer;
+    typedef typename __alloc_traits::const_pointer   const_pointer;
+    typedef typename __alloc_traits::size_type       size_type;
+    typedef typename __alloc_traits::difference_type difference_type;
+
+    typedef __hash_map_iterator<typename __table::iterator>       iterator;
+    typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+    typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
+    typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_map()
+        _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            __get_db()->__insert_c(this);
+#endif
+        }
+    explicit unordered_map(size_type __n, const hasher& __hf = hasher(),
+                           const key_equal& __eql = key_equal());
+    unordered_map(size_type __n, const hasher& __hf,
+                  const key_equal& __eql,
+                  const allocator_type& __a);
+    template <class _InputIterator>
+        unordered_map(_InputIterator __first, _InputIterator __last);
+    template <class _InputIterator>
+        unordered_map(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf = hasher(),
+                      const key_equal& __eql = key_equal());
+    template <class _InputIterator>
+        unordered_map(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf,
+                      const key_equal& __eql,
+                      const allocator_type& __a);
+    explicit unordered_map(const allocator_type& __a);
+    unordered_map(const unordered_map& __u);
+    unordered_map(const unordered_map& __u, const allocator_type& __a);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    unordered_map(unordered_map&& __u)
+        _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+    unordered_map(unordered_map&& __u, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    unordered_map(initializer_list<value_type> __il);
+    unordered_map(initializer_list<value_type> __il, size_type __n,
+                  const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+    unordered_map(initializer_list<value_type> __il, size_type __n,
+                  const hasher& __hf, const key_equal& __eql,
+                  const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if _LIBCPP_STD_VER > 11
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_map(size_type __n, const allocator_type& __a)
+      : unordered_map(__n, hasher(), key_equal(), __a) {}
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a)
+      : unordered_map(__n, __hf, key_equal(), __a) {}
+    template <class _InputIterator>
+    _LIBCPP_INLINE_VISIBILITY
+      unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
+      : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) {}
+    template <class _InputIterator>
+    _LIBCPP_INLINE_VISIBILITY
+      unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, 
+        const allocator_type& __a)
+      : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {}
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+      : unordered_map(__il, __n, hasher(), key_equal(), __a) {}
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf, 
+      const allocator_type& __a)
+      : unordered_map(__il, __n, __hf, key_equal(), __a) {}
+#endif
+    // ~unordered_map() = default;
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_map& operator=(const unordered_map& __u)
+    {
+#if __cplusplus >= 201103L
+        __table_ = __u.__table_;
+#else
+        if (this != &__u) {
+            __table_.clear();
+            __table_.hash_function() = __u.__table_.hash_function();
+            __table_.key_eq() = __u.__table_.key_eq();
+            __table_.max_load_factor() = __u.__table_.max_load_factor();
+            __table_.__copy_assign_alloc(__u.__table_);
+            insert(__u.begin(), __u.end());
+        }
+#endif
+        return *this;
+    }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    unordered_map& operator=(unordered_map&& __u)
+        _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+#endif
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    unordered_map& operator=(initializer_list<value_type> __il);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT
+        {return allocator_type(__table_.__node_alloc());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool      empty() const _NOEXCEPT {return __table_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT  {return __table_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT {return __table_.max_size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       begin() _NOEXCEPT        {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       end() _NOEXCEPT          {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin()  const _NOEXCEPT {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()    const _NOEXCEPT {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend()   const _NOEXCEPT {return __table_.end();}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template <class... _Args>
+        pair<iterator, bool> emplace(_Args&&... __args);
+
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        iterator emplace_hint(const_iterator __p, _Args&&... __args)
+        {
+            _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+                "unordered_map::emplace_hint(const_iterator, args...) called with an iterator not"
+                " referring to this unordered_map");
+            return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;
+        }
+#else
+        iterator emplace_hint(const_iterator, _Args&&... __args)
+            {return emplace(_VSTD::forward<_Args>(__args)...).first;}
+#endif
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, bool> insert(const value_type& __x)
+        {return __table_.__insert_unique(__x);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Pp,
+              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> insert(_Pp&& __x)
+            {return __table_.__insert_unique(_VSTD::forward<_Pp>(__x));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    iterator insert(const_iterator __p, const value_type& __x)
+        {
+            _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+                "unordered_map::insert(const_iterator, const value_type&) called with an iterator not"
+                " referring to this unordered_map");
+            return insert(__x).first;
+        }
+#else
+    iterator insert(const_iterator, const value_type& __x)
+        {return insert(__x).first;}
+#endif
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Pp,
+              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        iterator insert(const_iterator __p, _Pp&& __x)
+        {
+            _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+                "unordered_map::insert(const_iterator, value_type&&) called with an iterator not"
+                " referring to this unordered_map");
+            return insert(_VSTD::forward<_Pp>(__x)).first;
+        }
+#else
+        iterator insert(const_iterator, _Pp&& __x)
+            {return insert(_VSTD::forward<_Pp>(__x)).first;}
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _InputIterator>
+        void insert(_InputIterator __first, _InputIterator __last);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    void insert(initializer_list<value_type> __il)
+        {insert(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#if _LIBCPP_STD_VER > 14
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
+    {
+        iterator __p = __table_.find(__k);
+        if ( __p != end())
+            return _VSTD::make_pair(__p, false);
+        else
+            return _VSTD::make_pair(
+                      emplace_hint(__p, 
+                        _VSTD::piecewise_construct, _VSTD::forward_as_tuple(__k), 
+                        _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)),
+                      true);
+    }
+
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
+    {
+        iterator __p = __table_.find(__k);
+        if ( __p != end())
+            return _VSTD::make_pair(__p, false);
+        else
+            return _VSTD::make_pair(
+                      emplace_hint(__p, 
+                        _VSTD::piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)), 
+                        _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)),
+                      true);
+    }
+
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
+    {
+        iterator __p = __table_.find(__k);
+        if ( __p != end())
+            return __p;
+        else
+            return emplace_hint(__h, 
+                      _VSTD::piecewise_construct, _VSTD::forward_as_tuple(__k), 
+                      _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
+    }
+
+    template <class... _Args>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
+    {
+        iterator __p = __table_.find(__k);
+        if ( __p != end())
+            return __p;
+        else
+            return emplace_hint(__h, 
+                      _VSTD::piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)), 
+                      _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
+    }
+
+    template <class _Vp>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v)
+    {
+        iterator __p = __table_.find(__k);
+        if ( __p != end())
+        {
+            __p->second = _VSTD::move(__v);
+            return _VSTD::make_pair(__p, false);
+        }
+        return _VSTD::make_pair(emplace_hint(__p, __k, _VSTD::forward<_Vp>(__v)), true);
+    }
+        
+    template <class _Vp>
+        _LIBCPP_INLINE_VISIBILITY
+        pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v)
+    {
+        iterator __p = __table_.find(__k);
+        if ( __p != end())
+        {
+            __p->second = _VSTD::move(__v);
+            return _VSTD::make_pair(__p, false);
+        }
+        return _VSTD::make_pair(emplace_hint(__p, _VSTD::forward<key_type>(__k), _VSTD::forward<_Vp>(__v)), true);
+    }
+
+    template <class _Vp>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v)
+     {
+        iterator __p = __table_.find(__k);
+        if ( __p != end())
+        {
+            __p->second = _VSTD::move(__v);
+            return __p;
+        }
+        return emplace_hint(__h, __k, _VSTD::forward<_Vp>(__v));
+     }
+
+    template <class _Vp>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v)
+     {
+        iterator __p = __table_.find(__k);
+        if ( __p != end())
+        {
+            __p->second = _VSTD::move(__v);
+            return __p;
+        }
+        return emplace_hint(__h, _VSTD::forward<key_type>(__k), _VSTD::forward<_Vp>(__v));
+     }
+#endif
+#endif
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(iterator __p)       {return __table_.erase(__p.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(const_iterator __first, const_iterator __last)
+        {return __table_.erase(__first.__i_, __last.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {__table_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(unordered_map& __u)
+        _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
+        {__table_.swap(__u.__table_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    hasher hash_function() const
+        {return __table_.hash_function().hash_function();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_equal key_eq() const
+        {return __table_.key_eq().key_eq();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       find(const key_type& __k)       {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, iterator>             equal_range(const key_type& __k)
+        {return __table_.__equal_range_unique(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+        {return __table_.__equal_range_unique(__k);}
+
+    mapped_type& operator[](const key_type& __k);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    mapped_type& operator[](key_type&& __k);
+#endif
+
+    mapped_type&       at(const key_type& __k);
+    const mapped_type& at(const key_type& __k) const;
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_size(size_type __n) const
+        {return __table_.bucket_size(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    local_iterator       begin(size_type __n)        {return __table_.begin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    local_iterator       end(size_type __n)          {return __table_.end(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator begin(size_type __n) const  {return __table_.cbegin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator end(size_type __n) const    {return __table_.cend(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator cend(size_type __n) const   {return __table_.cend(__n);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    float load_factor() const _NOEXCEPT {return __table_.load_factor();}
+    _LIBCPP_INLINE_VISIBILITY
+    float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
+    _LIBCPP_INLINE_VISIBILITY
+    void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
+    _LIBCPP_INLINE_VISIBILITY
+    void rehash(size_type __n) {__table_.rehash(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    void reserve(size_type __n) {__table_.reserve(__n);}
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    bool __dereferenceable(const const_iterator* __i) const
+        {return __table_.__dereferenceable(&__i->__i_);}
+    bool __decrementable(const const_iterator* __i) const
+        {return __table_.__decrementable(&__i->__i_);}
+    bool __addable(const const_iterator* __i, ptrdiff_t __n) const
+        {return __table_.__addable(&__i->__i_, __n);}
+    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
+        {return __table_.__addable(&__i->__i_, __n);}
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+private:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __node_holder __construct_node();
+    template <class _A0>
+        __node_holder
+         __construct_node(_A0&& __a0);
+    __node_holder __construct_node_with_key(key_type&& __k);
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class _A0, class _A1, class ..._Args>
+        __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __node_holder __construct_node_with_key(const key_type& __k);
+};
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        size_type __n, const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        size_type __n, const hasher& __hf, const key_equal& __eql,
+        const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        const allocator_type& __a)
+    : __table_(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        _InputIterator __first, _InputIterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        const unordered_map& __u)
+    : __table_(__u.__table_)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        const unordered_map& __u, const allocator_type& __a)
+    : __table_(__u.__table_, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        unordered_map&& __u)
+    _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
+    : __table_(_VSTD::move(__u.__table_))
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+    __get_db()->swap(this, &__u);
+#endif
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        unordered_map&& __u, const allocator_type& __a)
+    : __table_(_VSTD::move(__u.__table_), __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__a != __u.get_allocator())
+    {
+        iterator __i = __u.begin();
+        while (__u.size() != 0)
+            __table_.__insert_unique(
+                _VSTD::move(__u.__table_.remove((__i++).__i_)->__value_)
+                                    );
+    }
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    else
+        __get_db()->swap(this, &__u);
+#endif
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        initializer_list<value_type> __il)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    insert(__il.begin(), __il.end());
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
+        const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__il.begin(), __il.end());
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
+        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
+        const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__il.begin(), __il.end());
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
+    _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
+{
+    __table_ = _VSTD::move(__u.__table_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
+        initializer_list<value_type> __il)
+{
+    __table_.__assign_unique(__il.begin(), __il.end());
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node()
+{
+    __node_allocator& __na = __table_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_));
+    __h.get_deleter().__first_constructed = true;
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _A0>
+typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
+{
+    __node_allocator& __na = __table_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_),
+                             _VSTD::forward<_A0>(__a0));
+    __h.get_deleter().__first_constructed = true;
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(key_type&& __k)
+{
+    __node_allocator& __na = __table_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), _VSTD::move(__k));
+    __h.get_deleter().__first_constructed = true;
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _A0, class _A1, class ..._Args>
+typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
+                                                                 _A1&& __a1,
+                                                                 _Args&&... __args)
+{
+    __node_allocator& __na = __table_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_),
+                             _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
+                             _VSTD::forward<_Args>(__args)...);
+    __h.get_deleter().__first_constructed = true;
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class... _Args>
+pair<typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator, bool>
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_Args&&... __args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
+    if (__r.second)
+        __h.release();
+    return __r;
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k)
+{
+    __node_allocator& __na = __table_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k);
+    __h.get_deleter().__first_constructed = true;
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
+    __h.get_deleter().__second_constructed = true;
+    return _LIBCPP_EXPLICIT_MOVE(__h);  // explicitly moved for C++03
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
+                                                       _InputIterator __last)
+{
+    for (; __first != __last; ++__first)
+        __table_.__insert_unique(*__first);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+_Tp&
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
+{
+    iterator __i = find(__k);
+    if (__i != end())
+        return __i->second;
+    __node_holder __h = __construct_node_with_key(__k);
+    pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
+    __h.release();
+    return __r.first->second;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+_Tp&
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k)
+{
+    iterator __i = find(__k);
+    if (__i != end())
+        return __i->second;
+    __node_holder __h = __construct_node_with_key(_VSTD::move(__k));
+    pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
+    __h.release();
+    return __r.first->second;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+_Tp&
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k)
+{
+    iterator __i = find(__k);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__i == end())
+        throw out_of_range("unordered_map::at: key not found");
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __i->second;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+const _Tp&
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const
+{
+    const_iterator __i = find(__k);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__i == end())
+        throw out_of_range("unordered_map::at: key not found");
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    return __i->second;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+     unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+bool
+operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+           const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+{
+    if (__x.size() != __y.size())
+        return false;
+    typedef typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
+                                                                 const_iterator;
+    for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
+            __i != __ex; ++__i)
+    {
+        const_iterator __j = __y.find(__i->first);
+        if (__j == __ey || !(*__i == *__j))
+            return false;
+    }
+    return true;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+           const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
+          class _Alloc = allocator<pair<const _Key, _Tp> > >
+class _LIBCPP_TYPE_VIS_ONLY unordered_multimap
+{
+public:
+    // types
+    typedef _Key                                           key_type;
+    typedef _Tp                                            mapped_type;
+    typedef _Hash                                          hasher;
+    typedef _Pred                                          key_equal;
+    typedef _Alloc                                         allocator_type;
+    typedef pair<const key_type, mapped_type>              value_type;
+    typedef pair<key_type, mapped_type>                    __nc_value_type;
+    typedef value_type&                                    reference;
+    typedef const value_type&                              const_reference;
+    static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+                  "Invalid allocator::value_type");
+
+private:
+    typedef __hash_value_type<key_type, mapped_type>                 __value_type;
+    typedef __unordered_map_hasher<key_type, __value_type, hasher>   __hasher;
+    typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal;
+    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
+                                                 __value_type>::type __allocator_type;
+
+    typedef __hash_table<__value_type, __hasher,
+                         __key_equal,  __allocator_type>   __table;
+
+    __table __table_;
+
+    typedef typename __table::__node_traits                __node_traits;
+    typedef typename __table::__node_allocator             __node_allocator;
+    typedef typename __table::__node                       __node;
+    typedef __hash_map_node_destructor<__node_allocator>   _Dp;
+    typedef unique_ptr<__node, _Dp>                         __node_holder;
+    typedef allocator_traits<allocator_type>               __alloc_traits;
+public:
+    typedef typename __alloc_traits::pointer         pointer;
+    typedef typename __alloc_traits::const_pointer   const_pointer;
+    typedef typename __alloc_traits::size_type       size_type;
+    typedef typename __alloc_traits::difference_type difference_type;
+
+    typedef __hash_map_iterator<typename __table::iterator>       iterator;
+    typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+    typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
+    typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
+
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_multimap()
+        _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            __get_db()->__insert_c(this);
+#endif
+        }
+    explicit unordered_multimap(size_type __n, const hasher& __hf = hasher(),
+                                const key_equal& __eql = key_equal());
+    unordered_multimap(size_type __n, const hasher& __hf,
+                                const key_equal& __eql,
+                                const allocator_type& __a);
+    template <class _InputIterator>
+        unordered_multimap(_InputIterator __first, _InputIterator __last);
+    template <class _InputIterator>
+        unordered_multimap(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf = hasher(),
+                      const key_equal& __eql = key_equal());
+    template <class _InputIterator>
+        unordered_multimap(_InputIterator __first, _InputIterator __last,
+                      size_type __n, const hasher& __hf,
+                      const key_equal& __eql,
+                      const allocator_type& __a);
+    explicit unordered_multimap(const allocator_type& __a);
+    unordered_multimap(const unordered_multimap& __u);
+    unordered_multimap(const unordered_multimap& __u, const allocator_type& __a);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    unordered_multimap(unordered_multimap&& __u)
+        _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+    unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    unordered_multimap(initializer_list<value_type> __il);
+    unordered_multimap(initializer_list<value_type> __il, size_type __n,
+                       const hasher& __hf = hasher(),
+                       const key_equal& __eql = key_equal());
+    unordered_multimap(initializer_list<value_type> __il, size_type __n,
+                       const hasher& __hf, const key_equal& __eql,
+                       const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if _LIBCPP_STD_VER > 11
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_multimap(size_type __n, const allocator_type& __a)
+      : unordered_multimap(__n, hasher(), key_equal(), __a) {}
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a)
+      : unordered_multimap(__n, __hf, key_equal(), __a) {}
+    template <class _InputIterator>
+    _LIBCPP_INLINE_VISIBILITY
+      unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
+      : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) {}
+    template <class _InputIterator>
+    _LIBCPP_INLINE_VISIBILITY
+      unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, 
+        const allocator_type& __a)
+      : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {}
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+      : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {}
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf, 
+      const allocator_type& __a)
+      : unordered_multimap(__il, __n, __hf, key_equal(), __a) {}
+#endif
+    // ~unordered_multimap() = default;
+    _LIBCPP_INLINE_VISIBILITY
+    unordered_multimap& operator=(const unordered_multimap& __u)
+    {
+#if __cplusplus >= 201103L
+        __table_ = __u.__table_;
+#else
+        if (this != &__u) {
+            __table_.clear();
+            __table_.hash_function() = __u.__table_.hash_function();
+            __table_.key_eq() = __u.__table_.key_eq();
+            __table_.max_load_factor() = __u.__table_.max_load_factor();
+            __table_.__copy_assign_alloc(__u.__table_);
+            insert(__u.begin(), __u.end());
+        }
+#endif
+        return *this;
+    }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    unordered_multimap& operator=(unordered_multimap&& __u)
+        _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+#endif
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    unordered_multimap& operator=(initializer_list<value_type> __il);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT
+        {return allocator_type(__table_.__node_alloc());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool      empty() const _NOEXCEPT {return __table_.size() == 0;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT  {return __table_.size();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_size() const _NOEXCEPT {return __table_.max_size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       begin() _NOEXCEPT        {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       end() _NOEXCEPT          {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin()  const _NOEXCEPT {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()    const _NOEXCEPT {return __table_.end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend()   const _NOEXCEPT {return __table_.end();}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+    template <class... _Args>
+        iterator emplace(_Args&&... __args);
+
+    template <class... _Args>
+        iterator emplace_hint(const_iterator __p, _Args&&... __args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Pp,
+              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator insert(_Pp&& __x)
+            {return __table_.__insert_multi(_VSTD::forward<_Pp>(__x));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __p, const value_type& __x)
+        {return __table_.__insert_multi(__p.__i_, __x);}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _Pp,
+              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+        _LIBCPP_INLINE_VISIBILITY
+        iterator insert(const_iterator __p, _Pp&& __x)
+            {return __table_.__insert_multi(__p.__i_, _VSTD::forward<_Pp>(__x));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    template <class _InputIterator>
+        void insert(_InputIterator __first, _InputIterator __last);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    void insert(initializer_list<value_type> __il)
+        {insert(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(iterator __p)       {return __table_.erase(__p.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator erase(const_iterator __first, const_iterator __last)
+        {return __table_.erase(__first.__i_, __last.__i_);}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {__table_.clear();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(unordered_multimap& __u)
+        _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
+        {__table_.swap(__u.__table_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    hasher hash_function() const
+        {return __table_.hash_function().hash_function();}
+    _LIBCPP_INLINE_VISIBILITY
+    key_equal key_eq() const
+        {return __table_.key_eq().key_eq();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       find(const key_type& __k)       {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<iterator, iterator>             equal_range(const key_type& __k)
+        {return __table_.__equal_range_multi(__k);}
+    _LIBCPP_INLINE_VISIBILITY
+    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
+        {return __table_.__equal_range_multi(__k);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type max_bucket_count() const _NOEXCEPT
+        {return __table_.max_bucket_count();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket_size(size_type __n) const
+        {return __table_.bucket_size(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    local_iterator       begin(size_type __n)        {return __table_.begin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    local_iterator       end(size_type __n)          {return __table_.end(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator begin(size_type __n) const  {return __table_.cbegin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator end(size_type __n) const    {return __table_.cend(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_local_iterator cend(size_type __n) const   {return __table_.cend(__n);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    float load_factor() const _NOEXCEPT {return __table_.load_factor();}
+    _LIBCPP_INLINE_VISIBILITY
+    float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
+    _LIBCPP_INLINE_VISIBILITY
+    void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
+    _LIBCPP_INLINE_VISIBILITY
+    void rehash(size_type __n) {__table_.rehash(__n);}
+    _LIBCPP_INLINE_VISIBILITY
+    void reserve(size_type __n) {__table_.reserve(__n);}
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    bool __dereferenceable(const const_iterator* __i) const
+        {return __table_.__dereferenceable(&__i->__i_);}
+    bool __decrementable(const const_iterator* __i) const
+        {return __table_.__decrementable(&__i->__i_);}
+    bool __addable(const const_iterator* __i, ptrdiff_t __n) const
+        {return __table_.__addable(&__i->__i_, __n);}
+    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
+        {return __table_.__addable(&__i->__i_, __n);}
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+private:
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __node_holder __construct_node();
+    template <class _A0>
+        __node_holder
+         __construct_node(_A0&& __a0);
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class _A0, class _A1, class ..._Args>
+        __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+};
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        size_type __n, const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        size_type __n, const hasher& __hf, const key_equal& __eql,
+        const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        _InputIterator __first, _InputIterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        _InputIterator __first, _InputIterator __last, size_type __n,
+        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__first, __last);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        const allocator_type& __a)
+    : __table_(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        const unordered_multimap& __u)
+    : __table_(__u.__table_)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        const unordered_multimap& __u, const allocator_type& __a)
+    : __table_(__u.__table_, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__u.bucket_count());
+    insert(__u.begin(), __u.end());
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        unordered_multimap&& __u)
+    _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
+    : __table_(_VSTD::move(__u.__table_))
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+    __get_db()->swap(this, &__u);
+#endif
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        unordered_multimap&& __u, const allocator_type& __a)
+    : __table_(_VSTD::move(__u.__table_), __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__a != __u.get_allocator())
+    {
+        iterator __i = __u.begin();
+        while (__u.size() != 0)
+        {
+            __table_.__insert_multi(
+                _VSTD::move(__u.__table_.remove((__i++).__i_)->__value_)
+                                   );
+        }
+    }
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    else
+        __get_db()->swap(this, &__u);
+#endif
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        initializer_list<value_type> __il)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    insert(__il.begin(), __il.end());
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
+        const key_equal& __eql)
+    : __table_(__hf, __eql)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__il.begin(), __il.end());
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
+        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
+        const key_equal& __eql, const allocator_type& __a)
+    : __table_(__hf, __eql, __a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __table_.rehash(__n);
+    insert(__il.begin(), __il.end());
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u)
+    _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
+{
+    __table_ = _VSTD::move(__u.__table_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
+        initializer_list<value_type> __il)
+{
+    __table_.__assign_multi(__il.begin(), __il.end());
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node()
+{
+    __node_allocator& __na = __table_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_));
+    __h.get_deleter().__first_constructed = true;
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _A0>
+typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
+{
+    __node_allocator& __na = __table_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_),
+                             _VSTD::forward<_A0>(__a0));
+    __h.get_deleter().__first_constructed = true;
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _A0, class _A1, class ..._Args>
+typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
+        _A0&& __a0, _A1&& __a1, _Args&&... __args)
+{
+    __node_allocator& __na = __table_.__node_alloc();
+    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+    __node_traits::construct(__na, _VSTD::addressof(__h->__value_),
+                             _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
+                             _VSTD::forward<_Args>(__args)...);
+    __h.get_deleter().__first_constructed = true;
+    __h.get_deleter().__second_constructed = true;
+    return __h;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class... _Args>
+typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_Args&&... __args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    iterator __r = __table_.__node_insert_multi(__h.get());
+    __h.release();
+    return __r;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class... _Args>
+typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace_hint(
+        const_iterator __p, _Args&&... __args)
+{
+    __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
+    iterator __r = __table_.__node_insert_multi(__p.__i_, __h.get());
+    __h.release();
+    return __r;
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
+                                                            _InputIterator __last)
+{
+    for (; __first != __last; ++__first)
+        __table_.__insert_multi(*__first);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+     unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+bool
+operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+           const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+{
+    if (__x.size() != __y.size())
+        return false;
+    typedef typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
+                                                                 const_iterator;
+    typedef pair<const_iterator, const_iterator> _EqRng;
+    for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
+    {
+        _EqRng __xeq = __x.equal_range(__i->first);
+        _EqRng __yeq = __y.equal_range(__i->first);
+        if (_VSTD::distance(__xeq.first, __xeq.second) !=
+            _VSTD::distance(__yeq.first, __yeq.second) ||
+                  !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+            return false;
+        __i = __xeq.second;
+    }
+    return true;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+           const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+{
+    return !(__x == __y);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_UNORDERED_MAP

Property changes on: lab4/.minix-src/include/c++/unordered_map
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/vector
===================================================================
--- lab4/.minix-src/include/c++/vector	(nonexistent)
+++ lab4/.minix-src/include/c++/vector	(revision 13)
@@ -0,0 +1,3312 @@
+// -*- C++ -*-
+//===------------------------------ vector --------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_VECTOR
+#define _LIBCPP_VECTOR
+
+/*
+    vector synopsis
+
+namespace std
+{
+
+template <class T, class Allocator = allocator<T> >
+class vector
+{
+public:
+    typedef T                                        value_type;
+    typedef Allocator                                allocator_type;
+    typedef typename allocator_type::reference       reference;
+    typedef typename allocator_type::const_reference const_reference;
+    typedef implementation-defined                   iterator;
+    typedef implementation-defined                   const_iterator;
+    typedef typename allocator_type::size_type       size_type;
+    typedef typename allocator_type::difference_type difference_type;
+    typedef typename allocator_type::pointer         pointer;
+    typedef typename allocator_type::const_pointer   const_pointer;
+    typedef std::reverse_iterator<iterator>          reverse_iterator;
+    typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
+
+    vector()
+        noexcept(is_nothrow_default_constructible<allocator_type>::value);
+    explicit vector(const allocator_type&);
+    explicit vector(size_type n);
+    explicit vector(size_type n, const allocator_type&); // C++14
+    vector(size_type n, const value_type& value, const allocator_type& = allocator_type());
+    template <class InputIterator>
+        vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
+    vector(const vector& x);
+    vector(vector&& x)
+        noexcept(is_nothrow_move_constructible<allocator_type>::value);
+    vector(initializer_list<value_type> il);
+    vector(initializer_list<value_type> il, const allocator_type& a);
+    ~vector();
+    vector& operator=(const vector& x);
+    vector& operator=(vector&& x)
+        noexcept(
+             allocator_type::propagate_on_container_move_assignment::value ||
+             allocator_type::is_always_equal::value); // C++17
+    vector& operator=(initializer_list<value_type> il);
+    template <class InputIterator>
+        void assign(InputIterator first, InputIterator last);
+    void assign(size_type n, const value_type& u);
+    void assign(initializer_list<value_type> il);
+
+    allocator_type get_allocator() const noexcept;
+
+    iterator               begin() noexcept;
+    const_iterator         begin()   const noexcept;
+    iterator               end() noexcept;
+    const_iterator         end()     const noexcept;
+
+    reverse_iterator       rbegin() noexcept;
+    const_reverse_iterator rbegin()  const noexcept;
+    reverse_iterator       rend() noexcept;
+    const_reverse_iterator rend()    const noexcept;
+
+    const_iterator         cbegin()  const noexcept;
+    const_iterator         cend()    const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    const_reverse_iterator crend()   const noexcept;
+
+    size_type size() const noexcept;
+    size_type max_size() const noexcept;
+    size_type capacity() const noexcept;
+    bool empty() const noexcept;
+    void reserve(size_type n);
+    void shrink_to_fit() noexcept;
+
+    reference       operator[](size_type n);
+    const_reference operator[](size_type n) const;
+    reference       at(size_type n);
+    const_reference at(size_type n) const;
+
+    reference       front();
+    const_reference front() const;
+    reference       back();
+    const_reference back() const;
+
+    value_type*       data() noexcept;
+    const value_type* data() const noexcept;
+
+    void push_back(const value_type& x);
+    void push_back(value_type&& x);
+    template <class... Args>
+        void emplace_back(Args&&... args);
+    void pop_back();
+
+    template <class... Args> iterator emplace(const_iterator position, Args&&... args);
+    iterator insert(const_iterator position, const value_type& x);
+    iterator insert(const_iterator position, value_type&& x);
+    iterator insert(const_iterator position, size_type n, const value_type& x);
+    template <class InputIterator>
+        iterator insert(const_iterator position, InputIterator first, InputIterator last);
+    iterator insert(const_iterator position, initializer_list<value_type> il);
+
+    iterator erase(const_iterator position);
+    iterator erase(const_iterator first, const_iterator last);
+
+    void clear() noexcept;
+
+    void resize(size_type sz);
+    void resize(size_type sz, const value_type& c);
+
+    void swap(vector&)
+        noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
+                 allocator_traits<allocator_type>::is_always_equal::value);  // C++17
+
+    bool __invariants() const;
+};
+
+template <class Allocator = allocator<T> >
+class vector<bool, Allocator>
+{
+public:
+    typedef bool                                     value_type;
+    typedef Allocator                                allocator_type;
+    typedef implementation-defined                   iterator;
+    typedef implementation-defined                   const_iterator;
+    typedef typename allocator_type::size_type       size_type;
+    typedef typename allocator_type::difference_type difference_type;
+    typedef iterator                                 pointer;
+    typedef const_iterator                           const_pointer;
+    typedef std::reverse_iterator<iterator>          reverse_iterator;
+    typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
+
+    class reference
+    {
+    public:
+        reference(const reference&) noexcept;
+        operator bool() const noexcept;
+        reference& operator=(const bool x) noexcept;
+        reference& operator=(const reference& x) noexcept;
+        iterator operator&() const noexcept;
+        void flip() noexcept;
+    };
+
+    class const_reference
+    {
+    public:
+        const_reference(const reference&) noexcept;
+        operator bool() const noexcept;
+        const_iterator operator&() const noexcept;
+    };
+
+    vector()
+        noexcept(is_nothrow_default_constructible<allocator_type>::value);
+    explicit vector(const allocator_type&);
+    explicit vector(size_type n, const allocator_type& a = allocator_type()); // C++14
+    vector(size_type n, const value_type& value, const allocator_type& = allocator_type());
+    template <class InputIterator>
+        vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
+    vector(const vector& x);
+    vector(vector&& x)
+        noexcept(is_nothrow_move_constructible<allocator_type>::value);
+    vector(initializer_list<value_type> il);
+    vector(initializer_list<value_type> il, const allocator_type& a);
+    ~vector();
+    vector& operator=(const vector& x);
+    vector& operator=(vector&& x)
+        noexcept(
+             allocator_type::propagate_on_container_move_assignment::value ||
+             allocator_type::is_always_equal::value); // C++17
+    vector& operator=(initializer_list<value_type> il);
+    template <class InputIterator>
+        void assign(InputIterator first, InputIterator last);
+    void assign(size_type n, const value_type& u);
+    void assign(initializer_list<value_type> il);
+
+    allocator_type get_allocator() const noexcept;
+
+    iterator               begin() noexcept;
+    const_iterator         begin()   const noexcept;
+    iterator               end() noexcept;
+    const_iterator         end()     const noexcept;
+
+    reverse_iterator       rbegin() noexcept;
+    const_reverse_iterator rbegin()  const noexcept;
+    reverse_iterator       rend() noexcept;
+    const_reverse_iterator rend()    const noexcept;
+
+    const_iterator         cbegin()  const noexcept;
+    const_iterator         cend()    const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    const_reverse_iterator crend()   const noexcept;
+
+    size_type size() const noexcept;
+    size_type max_size() const noexcept;
+    size_type capacity() const noexcept;
+    bool empty() const noexcept;
+    void reserve(size_type n);
+    void shrink_to_fit() noexcept;
+
+    reference       operator[](size_type n);
+    const_reference operator[](size_type n) const;
+    reference       at(size_type n);
+    const_reference at(size_type n) const;
+
+    reference       front();
+    const_reference front() const;
+    reference       back();
+    const_reference back() const;
+
+    void push_back(const value_type& x);
+    template <class... Args> void emplace_back(Args&&... args);  // C++14
+    void pop_back();
+
+    template <class... Args> iterator emplace(const_iterator position, Args&&... args);  // C++14
+    iterator insert(const_iterator position, const value_type& x);
+    iterator insert(const_iterator position, size_type n, const value_type& x);
+    template <class InputIterator>
+        iterator insert(const_iterator position, InputIterator first, InputIterator last);
+    iterator insert(const_iterator position, initializer_list<value_type> il);
+
+    iterator erase(const_iterator position);
+    iterator erase(const_iterator first, const_iterator last);
+
+    void clear() noexcept;
+
+    void resize(size_type sz);
+    void resize(size_type sz, value_type x);
+
+    void swap(vector&)
+        noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
+                 allocator_traits<allocator_type>::is_always_equal::value);  // C++17
+    void flip() noexcept;
+
+    bool __invariants() const;
+};
+
+template <class Allocator> struct hash<std::vector<bool, Allocator>>;
+
+template <class T, class Allocator> bool operator==(const vector<T,Allocator>& x, const vector<T,Allocator>& y);
+template <class T, class Allocator> bool operator< (const vector<T,Allocator>& x, const vector<T,Allocator>& y);
+template <class T, class Allocator> bool operator!=(const vector<T,Allocator>& x, const vector<T,Allocator>& y);
+template <class T, class Allocator> bool operator> (const vector<T,Allocator>& x, const vector<T,Allocator>& y);
+template <class T, class Allocator> bool operator>=(const vector<T,Allocator>& x, const vector<T,Allocator>& y);
+template <class T, class Allocator> bool operator<=(const vector<T,Allocator>& x, const vector<T,Allocator>& y);
+
+template <class T, class Allocator>
+void swap(vector<T,Allocator>& x, vector<T,Allocator>& y)
+    noexcept(noexcept(x.swap(y)));
+
+}  // std
+
+*/
+
+#include <__config>
+#include <__bit_reference>
+#include <type_traits>
+#include <climits>
+#include <limits>
+#include <initializer_list>
+#include <memory>
+#include <stdexcept>
+#include <algorithm>
+#include <cstring>
+#include <__split_buffer>
+#include <__functional_base>
+
+#include <__undef_min_max>
+
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <bool>
+class __vector_base_common
+{
+protected:
+    _LIBCPP_ALWAYS_INLINE __vector_base_common() {}
+    void __throw_length_error() const;
+    void __throw_out_of_range() const;
+};
+
+template <bool __b>
+void
+__vector_base_common<__b>::__throw_length_error() const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    throw length_error("vector");
+#else
+    assert(!"vector length_error");
+#endif
+}
+
+template <bool __b>
+void
+__vector_base_common<__b>::__throw_out_of_range() const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    throw out_of_range("vector");
+#else
+    assert(!"vector out_of_range");
+#endif
+}
+
+#ifdef _LIBCPP_MSVC
+#pragma warning( push )
+#pragma warning( disable: 4231 )
+#endif // _LIBCPP_MSVC
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS __vector_base_common<true>)
+#ifdef _LIBCPP_MSVC
+#pragma warning( pop )
+#endif // _LIBCPP_MSVC
+
+template <class _Tp, class _Allocator>
+class __vector_base
+    : protected __vector_base_common<true>
+{
+protected:
+    typedef _Tp                                      value_type;
+    typedef _Allocator                               allocator_type;
+    typedef allocator_traits<allocator_type>         __alloc_traits;
+    typedef value_type&                              reference;
+    typedef const value_type&                        const_reference;
+    typedef typename __alloc_traits::size_type       size_type;
+    typedef typename __alloc_traits::difference_type difference_type;
+    typedef typename __alloc_traits::pointer         pointer;
+    typedef typename __alloc_traits::const_pointer   const_pointer;
+    typedef pointer                                  iterator;
+    typedef const_pointer                            const_iterator;
+
+    pointer                                         __begin_;
+    pointer                                         __end_;
+    __compressed_pair<pointer, allocator_type> __end_cap_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type& __alloc() _NOEXCEPT
+        {return __end_cap_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const allocator_type& __alloc() const _NOEXCEPT
+        {return __end_cap_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer& __end_cap() _NOEXCEPT
+        {return __end_cap_.first();}
+    _LIBCPP_INLINE_VISIBILITY
+    const pointer& __end_cap() const _NOEXCEPT
+        {return __end_cap_.first();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __vector_base()
+        _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
+    _LIBCPP_INLINE_VISIBILITY __vector_base(const allocator_type& __a);
+    ~__vector_base();
+
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {__destruct_at_end(__begin_);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type capacity() const _NOEXCEPT
+        {return static_cast<size_type>(__end_cap() - __begin_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __destruct_at_end(pointer __new_last) _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __vector_base& __c)
+        {__copy_assign_alloc(__c, integral_constant<bool,
+                      __alloc_traits::propagate_on_container_copy_assignment::value>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__vector_base& __c)
+        _NOEXCEPT_(
+            !__alloc_traits::propagate_on_container_move_assignment::value ||
+            is_nothrow_move_assignable<allocator_type>::value)
+        {__move_assign_alloc(__c, integral_constant<bool,
+                      __alloc_traits::propagate_on_container_move_assignment::value>());}
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __vector_base& __c, true_type)
+        {
+            if (__alloc() != __c.__alloc())
+            {
+                clear();
+                __alloc_traits::deallocate(__alloc(), __begin_, capacity());
+                __begin_ = __end_ = __end_cap() = nullptr;
+            }
+            __alloc() = __c.__alloc();
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const __vector_base&, false_type)
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__vector_base& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+        {
+            __alloc() = _VSTD::move(__c.__alloc());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(__vector_base&, false_type)
+        _NOEXCEPT
+        {}
+};
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT
+{
+    while (__new_last != __end_)
+        __alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_));
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+__vector_base<_Tp, _Allocator>::__vector_base()
+        _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+    : __begin_(nullptr),
+      __end_(nullptr),
+      __end_cap_(nullptr)
+{
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+__vector_base<_Tp, _Allocator>::__vector_base(const allocator_type& __a)
+    : __begin_(nullptr),
+      __end_(nullptr),
+      __end_cap_(nullptr, __a)
+{
+}
+
+template <class _Tp, class _Allocator>
+__vector_base<_Tp, _Allocator>::~__vector_base()
+{
+    if (__begin_ != nullptr)
+    {
+        clear();
+        __alloc_traits::deallocate(__alloc(), __begin_, capacity());
+    }
+}
+
+template <class _Tp, class _Allocator = allocator<_Tp> >
+class _LIBCPP_TYPE_VIS_ONLY vector
+    : private __vector_base<_Tp, _Allocator>
+{
+private:
+    typedef __vector_base<_Tp, _Allocator>           __base;
+    typedef allocator<_Tp>                           __default_allocator_type;
+public:
+    typedef vector                                   __self;
+    typedef _Tp                                      value_type;
+    typedef _Allocator                               allocator_type;
+    typedef typename __base::__alloc_traits          __alloc_traits;
+    typedef typename __base::reference               reference;
+    typedef typename __base::const_reference         const_reference;
+    typedef typename __base::size_type               size_type;
+    typedef typename __base::difference_type         difference_type;
+    typedef typename __base::pointer                 pointer;
+    typedef typename __base::const_pointer           const_pointer;
+    typedef __wrap_iter<pointer>                     iterator;
+    typedef __wrap_iter<const_pointer>               const_iterator;
+    typedef _VSTD::reverse_iterator<iterator>         reverse_iterator;
+    typedef _VSTD::reverse_iterator<const_iterator>   const_reverse_iterator;
+
+    static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+                  "Allocator::value_type must be same type as value_type");
+
+    _LIBCPP_INLINE_VISIBILITY
+    vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+        {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+            __get_db()->__insert_c(this);
+#endif
+        }
+    _LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a)
+#if _LIBCPP_STD_VER <= 14
+        _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+#else
+        _NOEXCEPT
+#endif
+        : __base(__a)
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->__insert_c(this);
+#endif
+    }
+    explicit vector(size_type __n);
+#if _LIBCPP_STD_VER > 11
+    explicit vector(size_type __n, const allocator_type& __a);
+#endif
+    vector(size_type __n, const_reference __x);
+    vector(size_type __n, const_reference __x, const allocator_type& __a);
+    template <class _InputIterator>
+        vector(_InputIterator __first,
+               typename enable_if<__is_input_iterator  <_InputIterator>::value &&
+                                 !__is_forward_iterator<_InputIterator>::value &&
+                                 is_constructible<
+                                    value_type,
+                                    typename iterator_traits<_InputIterator>::reference>::value,
+                                 _InputIterator>::type __last);
+    template <class _InputIterator>
+        vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
+               typename enable_if<__is_input_iterator  <_InputIterator>::value &&
+                                 !__is_forward_iterator<_InputIterator>::value &&
+                                 is_constructible<
+                                    value_type,
+                                    typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);
+    template <class _ForwardIterator>
+        vector(_ForwardIterator __first,
+               typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
+                                 is_constructible<
+                                    value_type,
+                                    typename iterator_traits<_ForwardIterator>::reference>::value,
+                                 _ForwardIterator>::type __last);
+    template <class _ForwardIterator>
+        vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
+               typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
+                                 is_constructible<
+                                    value_type,
+                                    typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    vector(initializer_list<value_type> __il);
+    _LIBCPP_INLINE_VISIBILITY
+    vector(initializer_list<value_type> __il, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    ~vector()
+    {
+        __get_db()->__erase_c(this);
+    }
+#endif
+
+    vector(const vector& __x);
+    vector(const vector& __x, const allocator_type& __a);
+    _LIBCPP_INLINE_VISIBILITY
+    vector& operator=(const vector& __x);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    vector(vector&& __x)
+#if _LIBCPP_STD_VER > 14
+        _NOEXCEPT;
+#else
+        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    vector(vector&& __x, const allocator_type& __a);
+    _LIBCPP_INLINE_VISIBILITY
+    vector& operator=(vector&& __x)
+        _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    vector& operator=(initializer_list<value_type> __il)
+        {assign(__il.begin(), __il.end()); return *this;}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    template <class _InputIterator>
+        typename enable_if
+        <
+             __is_input_iterator  <_InputIterator>::value &&
+            !__is_forward_iterator<_InputIterator>::value &&
+            is_constructible<
+                 value_type,
+                 typename iterator_traits<_InputIterator>::reference>::value,
+            void
+        >::type
+        assign(_InputIterator __first, _InputIterator __last);
+    template <class _ForwardIterator>
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value &&
+            is_constructible<
+                 value_type,
+                 typename iterator_traits<_ForwardIterator>::reference>::value,
+            void
+        >::type
+        assign(_ForwardIterator __first, _ForwardIterator __last);
+
+    void assign(size_type __n, const_reference __u);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    void assign(initializer_list<value_type> __il)
+        {assign(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT
+        {return this->__alloc();}
+
+    _LIBCPP_INLINE_VISIBILITY iterator               begin() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY const_iterator         begin()   const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY iterator               end() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY const_iterator         end()     const _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    reverse_iterator       rbegin() _NOEXCEPT
+        {return       reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rbegin()  const _NOEXCEPT
+        {return const_reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    reverse_iterator       rend() _NOEXCEPT
+        {return       reverse_iterator(begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rend()    const _NOEXCEPT
+        {return const_reverse_iterator(begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator         cbegin()  const _NOEXCEPT
+        {return begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator         cend()    const _NOEXCEPT
+        {return end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crbegin() const _NOEXCEPT
+        {return rbegin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crend()   const _NOEXCEPT
+        {return rend();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT
+        {return static_cast<size_type>(this->__end_ - this->__begin_);}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type capacity() const _NOEXCEPT
+        {return __base::capacity();}
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty() const _NOEXCEPT
+        {return this->__begin_ == this->__end_;}
+    size_type max_size() const _NOEXCEPT;
+    void reserve(size_type __n);
+    void shrink_to_fit() _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY reference       operator[](size_type __n);
+    _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const;
+    reference       at(size_type __n);
+    const_reference at(size_type __n) const;
+
+    _LIBCPP_INLINE_VISIBILITY reference       front()
+    {
+        _LIBCPP_ASSERT(!empty(), "front() called for empty vector");
+        return *this->__begin_;
+    }
+    _LIBCPP_INLINE_VISIBILITY const_reference front() const
+    {
+        _LIBCPP_ASSERT(!empty(), "front() called for empty vector");
+        return *this->__begin_;
+    }
+    _LIBCPP_INLINE_VISIBILITY reference       back()
+    {
+        _LIBCPP_ASSERT(!empty(), "back() called for empty vector");
+        return *(this->__end_ - 1);
+    }
+    _LIBCPP_INLINE_VISIBILITY const_reference back()  const
+    {
+        _LIBCPP_ASSERT(!empty(), "back() called for empty vector");
+        return *(this->__end_ - 1);
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    value_type*       data() _NOEXCEPT
+        {return _VSTD::__to_raw_pointer(this->__begin_);}
+    _LIBCPP_INLINE_VISIBILITY
+    const value_type* data() const _NOEXCEPT
+        {return _VSTD::__to_raw_pointer(this->__begin_);}
+
+    _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x);
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args>
+        void emplace_back(_Args&&... __args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void pop_back();
+
+    iterator insert(const_iterator __position, const_reference __x);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    iterator insert(const_iterator __position, value_type&& __x);
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class... _Args>
+        iterator emplace(const_iterator __position, _Args&&... __args);
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    iterator insert(const_iterator __position, size_type __n, const_reference __x);
+    template <class _InputIterator>
+        typename enable_if
+        <
+             __is_input_iterator  <_InputIterator>::value &&
+            !__is_forward_iterator<_InputIterator>::value &&
+            is_constructible<
+                 value_type,
+                 typename iterator_traits<_InputIterator>::reference>::value,
+            iterator
+        >::type
+        insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
+    template <class _ForwardIterator>
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value &&
+            is_constructible<
+                 value_type,
+                 typename iterator_traits<_ForwardIterator>::reference>::value,
+            iterator
+        >::type
+        insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __position, initializer_list<value_type> __il)
+        {return insert(__position, __il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
+    iterator erase(const_iterator __first, const_iterator __last);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT
+    {
+        size_type __old_size = size();
+        __base::clear();
+        __annotate_shrink(__old_size);
+        __invalidate_all_iterators();
+    }
+
+    void resize(size_type __sz);
+    void resize(size_type __sz, const_reference __x);
+
+    void swap(vector&)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT;
+#else
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                    __is_nothrow_swappable<allocator_type>::value);
+#endif
+
+    bool __invariants() const;
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    bool __dereferenceable(const const_iterator* __i) const;
+    bool __decrementable(const const_iterator* __i) const;
+    bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
+    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+private:
+    _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
+    void allocate(size_type __n);
+    void deallocate() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
+    void __construct_at_end(size_type __n);
+    void __construct_at_end(size_type __n, const_reference __x);
+    template <class _ForwardIterator>
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value,
+            void
+        >::type
+        __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n);
+    void __append(size_type __n);
+    void __append(size_type __n, const_reference __x);
+    _LIBCPP_INLINE_VISIBILITY
+    iterator       __make_iter(pointer __p) _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator __make_iter(const_pointer __p) const _NOEXCEPT;
+    void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
+    pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
+    void __move_range(pointer __from_s, pointer __from_e, pointer __to);
+    void __move_assign(vector& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+    void __move_assign(vector& __c, false_type)
+        _NOEXCEPT_(__alloc_traits::is_always_equal::value);
+    _LIBCPP_INLINE_VISIBILITY
+    void __destruct_at_end(pointer __new_last) _NOEXCEPT
+    {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __c_node* __c = __get_db()->__find_c_and_lock(this);
+        for (__i_node** __p = __c->end_; __p != __c->beg_; )
+        {
+            --__p;
+            const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
+            if (__i->base() > __new_last)
+            {
+                (*__p)->__c_ = nullptr;
+                if (--__c->end_ != __p)
+                    memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+            }
+        }
+        __get_db()->unlock();
+#endif
+        size_type __old_size = size();
+        __base::__destruct_at_end(__new_last);
+        __annotate_shrink(__old_size);
+    }
+    template <class _Up>
+        void
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+        __push_back_slow_path(_Up&& __x);
+#else
+        __push_back_slow_path(_Up& __x);
+#endif
+#if !defined(_LIBCPP_HAS_NO_VARIADICS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+    template <class... _Args>
+        void
+        __emplace_back_slow_path(_Args&&... __args);
+#endif
+    // The following functions are no-ops outside of AddressSanitizer mode.
+    // We call annotatations only for the default Allocator because other allocators
+    // may not meet the AddressSanitizer alignment constraints.
+    // See the documentation for __sanitizer_annotate_contiguous_container for more details.
+    void __annotate_contiguous_container
+    (const void *__beg, const void *__end, const void *__old_mid, const void *__new_mid) const
+    {
+#ifndef _LIBCPP_HAS_NO_ASAN
+      if (__beg && is_same<allocator_type, __default_allocator_type>::value)
+        __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid);
+#endif
+    }
+
+    void __annotate_new(size_type __current_size) const
+    {
+      __annotate_contiguous_container(data(), data() + capacity(),
+                                      data() + capacity(), data() + __current_size);
+    }
+    void __annotate_delete() const
+    {
+      __annotate_contiguous_container(data(), data() + capacity(),
+                                      data() + size(), data() + capacity());
+    }
+    void __annotate_increase(size_type __n) const
+    {
+      __annotate_contiguous_container(data(), data() + capacity(),
+                                      data() + size(), data() + size() + __n);
+    }
+    void __annotate_shrink(size_type __old_size) const
+    {
+      __annotate_contiguous_container(data(), data() + capacity(),
+                                      data() + __old_size, data() + size());
+    }
+#ifndef _LIBCPP_HAS_NO_ASAN
+    // The annotation for size increase should happen before the actual increase,
+    // but if an exception is thrown after that the annotation has to be undone.
+    struct __RAII_IncreaseAnnotator {
+      __RAII_IncreaseAnnotator(const vector &__v, size_type __n = 1)
+        : __commit(false), __v(__v), __old_size(__v.size() + __n) {
+        __v.__annotate_increase(__n);
+      }
+      void __done() { __commit = true; }
+      ~__RAII_IncreaseAnnotator() {
+        if (__commit) return;
+        __v.__annotate_shrink(__old_size);
+      }
+      bool __commit;
+      const vector &__v;
+      size_type __old_size;
+    };
+#else
+    struct __RAII_IncreaseAnnotator {
+      inline __RAII_IncreaseAnnotator(const vector &, size_type __n = 1) {}
+      inline void __done() {}
+    };
+#endif
+
+};
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v)
+{
+    __annotate_delete();
+    __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_);
+    _VSTD::swap(this->__begin_, __v.__begin_);
+    _VSTD::swap(this->__end_, __v.__end_);
+    _VSTD::swap(this->__end_cap(), __v.__end_cap());
+    __v.__first_ = __v.__begin_;
+    __annotate_new(size());
+    __invalidate_all_iterators();
+}
+
+template <class _Tp, class _Allocator>
+typename vector<_Tp, _Allocator>::pointer
+vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p)
+{
+    __annotate_delete();
+    pointer __r = __v.__begin_;
+    __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, __p, __v.__begin_);
+    __alloc_traits::__construct_forward(this->__alloc(), __p, this->__end_, __v.__end_);
+    _VSTD::swap(this->__begin_, __v.__begin_);
+    _VSTD::swap(this->__end_, __v.__end_);
+    _VSTD::swap(this->__end_cap(), __v.__end_cap());
+    __v.__first_ = __v.__begin_;
+    __annotate_new(size());
+    __invalidate_all_iterators();
+    return __r;
+}
+
+//  Allocate space for __n objects
+//  throws length_error if __n > max_size()
+//  throws (probably bad_alloc) if memory run out
+//  Precondition:  __begin_ == __end_ == __end_cap() == 0
+//  Precondition:  __n > 0
+//  Postcondition:  capacity() == __n
+//  Postcondition:  size() == 0
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::allocate(size_type __n)
+{
+    if (__n > max_size())
+        this->__throw_length_error();
+    this->__begin_ = this->__end_ = __alloc_traits::allocate(this->__alloc(), __n);
+    this->__end_cap() = this->__begin_ + __n;
+    __annotate_new(0);
+}
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::deallocate() _NOEXCEPT
+{
+    if (this->__begin_ != nullptr)
+    {
+        clear();
+        __alloc_traits::deallocate(this->__alloc(), this->__begin_, capacity());
+        this->__begin_ = this->__end_ = this->__end_cap() = nullptr;
+    }
+}
+
+template <class _Tp, class _Allocator>
+typename vector<_Tp, _Allocator>::size_type
+vector<_Tp, _Allocator>::max_size() const _NOEXCEPT
+{
+    return _VSTD::min<size_type>(__alloc_traits::max_size(this->__alloc()), numeric_limits<size_type>::max() / 2);  // end() >= begin(), always
+}
+
+//  Precondition:  __new_size > capacity()
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<_Tp, _Allocator>::size_type
+vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
+{
+    const size_type __ms = max_size();
+    if (__new_size > __ms)
+        this->__throw_length_error();
+    const size_type __cap = capacity();
+    if (__cap >= __ms / 2)
+        return __ms;
+    return _VSTD::max<size_type>(2*__cap, __new_size);
+}
+
+//  Default constructs __n objects starting at __end_
+//  throws if construction throws
+//  Precondition:  __n > 0
+//  Precondition:  size() + __n <= capacity()
+//  Postcondition:  size() == size() + __n
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
+{
+    allocator_type& __a = this->__alloc();
+    do
+    {
+        __RAII_IncreaseAnnotator __annotator(*this);
+        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
+        ++this->__end_;
+        --__n;
+        __annotator.__done();
+    } while (__n > 0);
+}
+
+//  Copy constructs __n objects starting at __end_ from __x
+//  throws if construction throws
+//  Precondition:  __n > 0
+//  Precondition:  size() + __n <= capacity()
+//  Postcondition:  size() == old size() + __n
+//  Postcondition:  [i] == __x for all i in [size() - __n, __n)
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
+{
+    allocator_type& __a = this->__alloc();
+    do
+    {
+        __RAII_IncreaseAnnotator __annotator(*this);
+        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
+        ++this->__end_;
+        --__n;
+        __annotator.__done();
+    } while (__n > 0);
+}
+
+template <class _Tp, class _Allocator>
+template <class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value,
+    void
+>::type
+vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n)
+{
+    allocator_type& __a = this->__alloc();
+    __RAII_IncreaseAnnotator __annotator(*this, __n);
+    __alloc_traits::__construct_range_forward(__a, __first, __last, this->__end_);
+    __annotator.__done();
+}
+
+//  Default constructs __n objects starting at __end_
+//  throws if construction throws
+//  Postcondition:  size() == size() + __n
+//  Exception safety: strong.
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::__append(size_type __n)
+{
+    if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n)
+        this->__construct_at_end(__n);
+    else
+    {
+        allocator_type& __a = this->__alloc();
+        __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a);
+        __v.__construct_at_end(__n);
+        __swap_out_circular_buffer(__v);
+    }
+}
+
+//  Default constructs __n objects starting at __end_
+//  throws if construction throws
+//  Postcondition:  size() == size() + __n
+//  Exception safety: strong.
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x)
+{
+    if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n)
+        this->__construct_at_end(__n, __x);
+    else
+    {
+        allocator_type& __a = this->__alloc();
+        __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a);
+        __v.__construct_at_end(__n, __x);
+        __swap_out_circular_buffer(__v);
+    }
+}
+
+template <class _Tp, class _Allocator>
+vector<_Tp, _Allocator>::vector(size_type __n)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__n);
+    }
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp, class _Allocator>
+vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
+    : __base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__n);
+    }
+}
+#endif
+
+template <class _Tp, class _Allocator>
+vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__n, __x);
+    }
+}
+
+template <class _Tp, class _Allocator>
+vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x, const allocator_type& __a)
+    : __base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__n, __x);
+    }
+}
+
+template <class _Tp, class _Allocator>
+template <class _InputIterator>
+vector<_Tp, _Allocator>::vector(_InputIterator __first,
+       typename enable_if<__is_input_iterator  <_InputIterator>::value &&
+                         !__is_forward_iterator<_InputIterator>::value &&
+                         is_constructible<
+                            value_type,
+                            typename iterator_traits<_InputIterator>::reference>::value,
+                          _InputIterator>::type __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (; __first != __last; ++__first)
+        push_back(*__first);
+}
+
+template <class _Tp, class _Allocator>
+template <class _InputIterator>
+vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
+       typename enable_if<__is_input_iterator  <_InputIterator>::value &&
+                         !__is_forward_iterator<_InputIterator>::value &&
+                         is_constructible<
+                            value_type,
+                            typename iterator_traits<_InputIterator>::reference>::value>::type*)
+    : __base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    for (; __first != __last; ++__first)
+        push_back(*__first);
+}
+
+template <class _Tp, class _Allocator>
+template <class _ForwardIterator>
+vector<_Tp, _Allocator>::vector(_ForwardIterator __first,
+                                typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
+                                is_constructible<
+                                   value_type,
+                                   typename iterator_traits<_ForwardIterator>::reference>::value,
+                                                   _ForwardIterator>::type __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__first, __last, __n);
+    }
+}
+
+template <class _Tp, class _Allocator>
+template <class _ForwardIterator>
+vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
+                                typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
+                                is_constructible<
+                                   value_type,
+                                   typename iterator_traits<_ForwardIterator>::reference>::value>::type*)
+    : __base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__first, __last, __n);
+    }
+}
+
+template <class _Tp, class _Allocator>
+vector<_Tp, _Allocator>::vector(const vector& __x)
+    : __base(__alloc_traits::select_on_container_copy_construction(__x.__alloc()))
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    size_type __n = __x.size();
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__x.__begin_, __x.__end_, __n);
+    }
+}
+
+template <class _Tp, class _Allocator>
+vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a)
+    : __base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    size_type __n = __x.size();
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__x.__begin_, __x.__end_, __n);
+    }
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+vector<_Tp, _Allocator>::vector(vector&& __x)
+#if _LIBCPP_STD_VER > 14
+        _NOEXCEPT
+#else
+        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+#endif
+    : __base(_VSTD::move(__x.__alloc()))
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+    __get_db()->swap(this, &__x);
+#endif
+    this->__begin_ = __x.__begin_;
+    this->__end_ = __x.__end_;
+    this->__end_cap() = __x.__end_cap();
+    __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
+    : __base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__a == __x.__alloc())
+    {
+        this->__begin_ = __x.__begin_;
+        this->__end_ = __x.__end_;
+        this->__end_cap() = __x.__end_cap();
+        __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+        __get_db()->swap(this, &__x);
+#endif
+    }
+    else
+    {
+        typedef move_iterator<iterator> _Ip;
+        assign(_Ip(__x.begin()), _Ip(__x.end()));
+    }
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__il.size() > 0)
+    {
+        allocate(__il.size());
+        __construct_at_end(__il.begin(), __il.end(), __il.size());
+    }
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
+    : __base(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    if (__il.size() > 0)
+    {
+        allocate(__il.size());
+        __construct_at_end(__il.begin(), __il.end(), __il.size());
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+vector<_Tp, _Allocator>&
+vector<_Tp, _Allocator>::operator=(vector&& __x)
+    _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
+{
+    __move_assign(__x, integral_constant<bool,
+          __alloc_traits::propagate_on_container_move_assignment::value>());
+    return *this;
+}
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type)
+    _NOEXCEPT_(__alloc_traits::is_always_equal::value)
+{
+    if (__base::__alloc() != __c.__alloc())
+    {
+        typedef move_iterator<iterator> _Ip;
+        assign(_Ip(__c.begin()), _Ip(__c.end()));
+    }
+    else
+        __move_assign(__c, true_type());
+}
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
+    _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+{
+    deallocate();
+    __base::__move_assign_alloc(__c); // this can throw
+    this->__begin_ = __c.__begin_;
+    this->__end_ = __c.__end_;
+    this->__end_cap() = __c.__end_cap();
+    __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->swap(this, &__c);
+#endif
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+vector<_Tp, _Allocator>&
+vector<_Tp, _Allocator>::operator=(const vector& __x)
+{
+    if (this != &__x)
+    {
+        __base::__copy_assign_alloc(__x);
+        assign(__x.__begin_, __x.__end_);
+    }
+    return *this;
+}
+
+template <class _Tp, class _Allocator>
+template <class _InputIterator>
+typename enable_if
+<
+     __is_input_iterator  <_InputIterator>::value &&
+    !__is_forward_iterator<_InputIterator>::value &&
+    is_constructible<
+       _Tp,
+       typename iterator_traits<_InputIterator>::reference>::value,
+    void
+>::type
+vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
+{
+    clear();
+    for (; __first != __last; ++__first)
+        push_back(*__first);
+}
+
+template <class _Tp, class _Allocator>
+template <class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value &&
+    is_constructible<
+       _Tp,
+       typename iterator_traits<_ForwardIterator>::reference>::value,
+    void
+>::type
+vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
+{
+    size_type __new_size = static_cast<size_type>(_VSTD::distance(__first, __last));
+    if (__new_size <= capacity())
+    {
+        _ForwardIterator __mid = __last;
+        bool __growing = false;
+        if (__new_size > size())
+        {
+            __growing = true;
+            __mid =  __first;
+            _VSTD::advance(__mid, size());
+        }
+        pointer __m = _VSTD::copy(__first, __mid, this->__begin_);
+        if (__growing)
+            __construct_at_end(__mid, __last, __new_size - size());
+        else
+            this->__destruct_at_end(__m);
+    }
+    else
+    {
+        deallocate();
+        allocate(__recommend(__new_size));
+        __construct_at_end(__first, __last, __new_size);
+    }
+}
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u)
+{
+    if (__n <= capacity())
+    {
+        size_type __s = size();
+        _VSTD::fill_n(this->__begin_, _VSTD::min(__n, __s), __u);
+        if (__n > __s)
+            __construct_at_end(__n - __s, __u);
+        else
+            this->__destruct_at_end(this->__begin_ + __n);
+    }
+    else
+    {
+        deallocate();
+        allocate(__recommend(static_cast<size_type>(__n)));
+        __construct_at_end(__n, __u);
+    }
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator(this, __p);
+#else
+    return iterator(__p);
+#endif
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<_Tp, _Allocator>::const_iterator
+vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return const_iterator(this, __p);
+#else
+    return const_iterator(__p);
+#endif
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::begin() _NOEXCEPT
+{
+    return __make_iter(this->__begin_);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<_Tp, _Allocator>::const_iterator
+vector<_Tp, _Allocator>::begin() const _NOEXCEPT
+{
+    return __make_iter(this->__begin_);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::end() _NOEXCEPT
+{
+    return __make_iter(this->__end_);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<_Tp, _Allocator>::const_iterator
+vector<_Tp, _Allocator>::end() const _NOEXCEPT
+{
+    return __make_iter(this->__end_);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<_Tp, _Allocator>::reference
+vector<_Tp, _Allocator>::operator[](size_type __n)
+{
+    _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");
+    return this->__begin_[__n];
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<_Tp, _Allocator>::const_reference
+vector<_Tp, _Allocator>::operator[](size_type __n) const
+{
+    _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");
+    return this->__begin_[__n];
+}
+
+template <class _Tp, class _Allocator>
+typename vector<_Tp, _Allocator>::reference
+vector<_Tp, _Allocator>::at(size_type __n)
+{
+    if (__n >= size())
+        this->__throw_out_of_range();
+    return this->__begin_[__n];
+}
+
+template <class _Tp, class _Allocator>
+typename vector<_Tp, _Allocator>::const_reference
+vector<_Tp, _Allocator>::at(size_type __n) const
+{
+    if (__n >= size())
+        this->__throw_out_of_range();
+    return this->__begin_[__n];
+}
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::reserve(size_type __n)
+{
+    if (__n > capacity())
+    {
+        allocator_type& __a = this->__alloc();
+        __split_buffer<value_type, allocator_type&> __v(__n, size(), __a);
+        __swap_out_circular_buffer(__v);
+    }
+}
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
+{
+    if (capacity() > size())
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            allocator_type& __a = this->__alloc();
+            __split_buffer<value_type, allocator_type&> __v(size(), size(), __a);
+            __swap_out_circular_buffer(__v);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+template <class _Tp, class _Allocator>
+template <class _Up>
+void
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x)
+#else
+vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x)
+#endif
+{
+    allocator_type& __a = this->__alloc();
+    __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
+    // __v.push_back(_VSTD::forward<_Up>(__x));
+    __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Up>(__x));
+    __v.__end_++;
+    __swap_out_circular_buffer(__v);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+vector<_Tp, _Allocator>::push_back(const_reference __x)
+{
+    if (this->__end_ != this->__end_cap())
+    {
+        __RAII_IncreaseAnnotator __annotator(*this);
+        __alloc_traits::construct(this->__alloc(),
+                                  _VSTD::__to_raw_pointer(this->__end_), __x);
+        __annotator.__done();
+        ++this->__end_;
+    }
+    else
+        __push_back_slow_path(__x);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+vector<_Tp, _Allocator>::push_back(value_type&& __x)
+{
+    if (this->__end_ < this->__end_cap())
+    {
+        __RAII_IncreaseAnnotator __annotator(*this);
+        __alloc_traits::construct(this->__alloc(),
+                                  _VSTD::__to_raw_pointer(this->__end_),
+                                  _VSTD::move(__x));
+        __annotator.__done();
+        ++this->__end_;
+    }
+    else
+        __push_back_slow_path(_VSTD::move(__x));
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Allocator>
+template <class... _Args>
+void
+vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
+{
+    allocator_type& __a = this->__alloc();
+    __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
+//    __v.emplace_back(_VSTD::forward<_Args>(__args)...);
+    __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Args>(__args)...);
+    __v.__end_++;
+    __swap_out_circular_buffer(__v);
+}
+
+template <class _Tp, class _Allocator>
+template <class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
+{
+    if (this->__end_ < this->__end_cap())
+    {
+        __RAII_IncreaseAnnotator __annotator(*this);
+        __alloc_traits::construct(this->__alloc(),
+                                  _VSTD::__to_raw_pointer(this->__end_),
+                                  _VSTD::forward<_Args>(__args)...);
+        __annotator.__done();
+        ++this->__end_;
+    }
+    else
+        __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...);
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+vector<_Tp, _Allocator>::pop_back()
+{
+    _LIBCPP_ASSERT(!empty(), "vector::pop_back called for empty vector");
+    this->__destruct_at_end(this->__end_ - 1);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::erase(const_iterator __position)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
+        "vector::erase(iterator) called with an iterator not"
+        " referring to this vector");
+#endif
+    _LIBCPP_ASSERT(__position != end(),
+        "vector::erase(iterator) called with a non-dereferenceable iterator");
+    difference_type __ps = __position - cbegin();
+    pointer __p = this->__begin_ + __ps;
+    iterator __r = __make_iter(__p);
+    this->__destruct_at_end(_VSTD::move(__p + 1, this->__end_, __p));
+    return __r;
+}
+
+template <class _Tp, class _Allocator>
+typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
+        "vector::erase(iterator,  iterator) called with an iterator not"
+        " referring to this vector");
+#endif
+    _LIBCPP_ASSERT(__first <= __last, "vector::erase(first, last) called with invalid range");
+    pointer __p = this->__begin_ + (__first - begin());
+    iterator __r = __make_iter(__p);
+    if (__first != __last)
+        this->__destruct_at_end(_VSTD::move(__p + (__last - __first), this->__end_, __p));
+    return __r;
+}
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to)
+{
+    pointer __old_last = this->__end_;
+    difference_type __n = __old_last - __to;
+    for (pointer __i = __from_s + __n; __i < __from_e; ++__i, ++this->__end_)
+        __alloc_traits::construct(this->__alloc(),
+                                  _VSTD::__to_raw_pointer(this->__end_),
+                                  _VSTD::move(*__i));
+    _VSTD::move_backward(__from_s, __from_s + __n, __old_last);
+}
+
+template <class _Tp, class _Allocator>
+typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
+        "vector::insert(iterator, x) called with an iterator not"
+        " referring to this vector");
+#endif
+    pointer __p = this->__begin_ + (__position - begin());
+    if (this->__end_ < this->__end_cap())
+    {
+        __RAII_IncreaseAnnotator __annotator(*this);
+        if (__p == this->__end_)
+        {
+            __alloc_traits::construct(this->__alloc(),
+                                      _VSTD::__to_raw_pointer(this->__end_), __x);
+            ++this->__end_;
+        }
+        else
+        {
+            __move_range(__p, this->__end_, __p + 1);
+            const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
+            if (__p <= __xr && __xr < this->__end_)
+                ++__xr;
+            *__p = *__xr;
+        }
+        __annotator.__done();
+    }
+    else
+    {
+        allocator_type& __a = this->__alloc();
+        __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
+        __v.push_back(__x);
+        __p = __swap_out_circular_buffer(__v, __p);
+    }
+    return __make_iter(__p);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
+        "vector::insert(iterator, x) called with an iterator not"
+        " referring to this vector");
+#endif
+    pointer __p = this->__begin_ + (__position - begin());
+    if (this->__end_ < this->__end_cap())
+    {
+        __RAII_IncreaseAnnotator __annotator(*this);
+        if (__p == this->__end_)
+        {
+            __alloc_traits::construct(this->__alloc(),
+                                      _VSTD::__to_raw_pointer(this->__end_),
+                                      _VSTD::move(__x));
+            ++this->__end_;
+        }
+        else
+        {
+            __move_range(__p, this->__end_, __p + 1);
+            *__p = _VSTD::move(__x);
+        }
+        __annotator.__done();
+    }
+    else
+    {
+        allocator_type& __a = this->__alloc();
+        __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
+        __v.push_back(_VSTD::move(__x));
+        __p = __swap_out_circular_buffer(__v, __p);
+    }
+    return __make_iter(__p);
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Tp, class _Allocator>
+template <class... _Args>
+typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
+        "vector::emplace(iterator, x) called with an iterator not"
+        " referring to this vector");
+#endif
+    pointer __p = this->__begin_ + (__position - begin());
+    if (this->__end_ < this->__end_cap())
+    {
+        __RAII_IncreaseAnnotator __annotator(*this);
+        if (__p == this->__end_)
+        {
+            __alloc_traits::construct(this->__alloc(),
+                                      _VSTD::__to_raw_pointer(this->__end_),
+                                      _VSTD::forward<_Args>(__args)...);
+            ++this->__end_;
+        }
+        else
+        {
+            value_type __tmp(_VSTD::forward<_Args>(__args)...);
+            __move_range(__p, this->__end_, __p + 1);
+            *__p = _VSTD::move(__tmp);
+        }
+        __annotator.__done();
+    }
+    else
+    {
+        allocator_type& __a = this->__alloc();
+        __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
+        __v.emplace_back(_VSTD::forward<_Args>(__args)...);
+        __p = __swap_out_circular_buffer(__v, __p);
+    }
+    return __make_iter(__p);
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Allocator>
+typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
+        "vector::insert(iterator, n, x) called with an iterator not"
+        " referring to this vector");
+#endif
+    pointer __p = this->__begin_ + (__position - begin());
+    if (__n > 0)
+    {
+        if (__n <= static_cast<size_type>(this->__end_cap() - this->__end_))
+        {
+            size_type __old_n = __n;
+            pointer __old_last = this->__end_;
+            if (__n > static_cast<size_type>(this->__end_ - __p))
+            {
+                size_type __cx = __n - (this->__end_ - __p);
+                __construct_at_end(__cx, __x);
+                __n -= __cx;
+            }
+            if (__n > 0)
+            {
+                __RAII_IncreaseAnnotator __annotator(*this, __n);
+                __move_range(__p, __old_last, __p + __old_n);
+                __annotator.__done();
+                const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
+                if (__p <= __xr && __xr < this->__end_)
+                    __xr += __old_n;
+                _VSTD::fill_n(__p, __n, *__xr);
+            }
+        }
+        else
+        {
+            allocator_type& __a = this->__alloc();
+            __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a);
+            __v.__construct_at_end(__n, __x);
+            __p = __swap_out_circular_buffer(__v, __p);
+        }
+    }
+    return __make_iter(__p);
+}
+
+template <class _Tp, class _Allocator>
+template <class _InputIterator>
+typename enable_if
+<
+     __is_input_iterator  <_InputIterator>::value &&
+    !__is_forward_iterator<_InputIterator>::value &&
+    is_constructible<
+       _Tp,
+       typename iterator_traits<_InputIterator>::reference>::value,
+    typename vector<_Tp, _Allocator>::iterator
+>::type
+vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
+        "vector::insert(iterator, range) called with an iterator not"
+        " referring to this vector");
+#endif
+    difference_type __off = __position - begin();
+    pointer __p = this->__begin_ + __off;
+    allocator_type& __a = this->__alloc();
+    pointer __old_last = this->__end_;
+    for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)
+    {
+        __RAII_IncreaseAnnotator __annotator(*this);
+        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
+                                  *__first);
+        ++this->__end_;
+        __annotator.__done();
+    }
+    __split_buffer<value_type, allocator_type&> __v(__a);
+    if (__first != __last)
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            __v.__construct_at_end(__first, __last);
+            difference_type __old_size = __old_last - this->__begin_;
+            difference_type __old_p = __p - this->__begin_;
+            reserve(__recommend(size() + __v.size()));
+            __p = this->__begin_ + __old_p;
+            __old_last = this->__begin_ + __old_size;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            erase(__make_iter(__old_last), end());
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+    __p = _VSTD::rotate(__p, __old_last, this->__end_);
+    insert(__make_iter(__p), make_move_iterator(__v.begin()),
+                                    make_move_iterator(__v.end()));
+    return begin() + __off;
+}
+
+template <class _Tp, class _Allocator>
+template <class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value &&
+    is_constructible<
+       _Tp,
+       typename iterator_traits<_ForwardIterator>::reference>::value,
+    typename vector<_Tp, _Allocator>::iterator
+>::type
+vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
+        "vector::insert(iterator, range) called with an iterator not"
+        " referring to this vector");
+#endif
+    pointer __p = this->__begin_ + (__position - begin());
+    difference_type __n = _VSTD::distance(__first, __last);
+    if (__n > 0)
+    {
+        if (__n <= this->__end_cap() - this->__end_)
+        {
+            size_type __old_n = __n;
+            pointer __old_last = this->__end_;
+            _ForwardIterator __m = __last;
+            difference_type __dx = this->__end_ - __p;
+            if (__n > __dx)
+            {
+                __m = __first;
+                difference_type __diff = this->__end_ - __p;
+                _VSTD::advance(__m, __diff);
+                __construct_at_end(__m, __last, __n - __diff);
+                __n = __dx;
+            }
+            if (__n > 0)
+            {
+                __RAII_IncreaseAnnotator __annotator(*this, __n);
+                __move_range(__p, __old_last, __p + __old_n);
+                __annotator.__done();
+                _VSTD::copy(__first, __m, __p);
+            }
+        }
+        else
+        {
+            allocator_type& __a = this->__alloc();
+            __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a);
+            __v.__construct_at_end(__first, __last);
+            __p = __swap_out_circular_buffer(__v, __p);
+        }
+    }
+    return __make_iter(__p);
+}
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::resize(size_type __sz)
+{
+    size_type __cs = size();
+    if (__cs < __sz)
+        this->__append(__sz - __cs);
+    else if (__cs > __sz)
+        this->__destruct_at_end(this->__begin_ + __sz);
+}
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x)
+{
+    size_type __cs = size();
+    if (__cs < __sz)
+        this->__append(__sz - __cs, __x);
+    else if (__cs > __sz)
+        this->__destruct_at_end(this->__begin_ + __sz);
+}
+
+template <class _Tp, class _Allocator>
+void
+vector<_Tp, _Allocator>::swap(vector& __x)
+#if _LIBCPP_STD_VER >= 14
+    _NOEXCEPT
+#else
+    _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                __is_nothrow_swappable<allocator_type>::value)
+#endif
+{
+    _LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value ||
+                   this->__alloc() == __x.__alloc(),
+                   "vector::swap: Either propagate_on_container_swap must be true"
+                   " or the allocators must compare equal");
+    _VSTD::swap(this->__begin_, __x.__begin_);
+    _VSTD::swap(this->__end_, __x.__end_);
+    _VSTD::swap(this->__end_cap(), __x.__end_cap());
+    __swap_allocator(this->__alloc(), __x.__alloc(), 
+        integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->swap(this, &__x);
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+}
+
+template <class _Tp, class _Allocator>
+bool
+vector<_Tp, _Allocator>::__invariants() const
+{
+    if (this->__begin_ == nullptr)
+    {
+        if (this->__end_ != nullptr || this->__end_cap() != nullptr)
+            return false;
+    }
+    else
+    {
+        if (this->__begin_ > this->__end_)
+            return false;
+        if (this->__begin_ == this->__end_cap())
+            return false;
+        if (this->__end_ > this->__end_cap())
+            return false;
+    }
+    return true;
+}
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+template <class _Tp, class _Allocator>
+bool
+vector<_Tp, _Allocator>::__dereferenceable(const const_iterator* __i) const
+{
+    return this->__begin_ <= __i->base() && __i->base() < this->__end_;
+}
+
+template <class _Tp, class _Allocator>
+bool
+vector<_Tp, _Allocator>::__decrementable(const const_iterator* __i) const
+{
+    return this->__begin_ < __i->base() && __i->base() <= this->__end_;
+}
+
+template <class _Tp, class _Allocator>
+bool
+vector<_Tp, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const
+{
+    const_pointer __p = __i->base() + __n;
+    return this->__begin_ <= __p && __p <= this->__end_;
+}
+
+template <class _Tp, class _Allocator>
+bool
+vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const
+{
+    const_pointer __p = __i->base() + __n;
+    return this->__begin_ <= __p && __p < this->__end_;
+}
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+vector<_Tp, _Allocator>::__invalidate_all_iterators()
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__invalidate_all(this);
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+}
+
+// vector<bool>
+
+template <class _Allocator> class vector<bool, _Allocator>;
+
+template <class _Allocator> struct hash<vector<bool, _Allocator> >;
+
+template <class _Allocator>
+struct __has_storage_type<vector<bool, _Allocator> >
+{
+    static const bool value = true;
+};
+
+template <class _Allocator>
+class _LIBCPP_TYPE_VIS_ONLY vector<bool, _Allocator>
+    : private __vector_base_common<true>
+{
+public:
+    typedef vector                                   __self;
+    typedef bool                                     value_type;
+    typedef _Allocator                               allocator_type;
+    typedef allocator_traits<allocator_type>         __alloc_traits;
+    typedef typename __alloc_traits::size_type       size_type;
+    typedef typename __alloc_traits::difference_type difference_type;
+    typedef size_type __storage_type;
+    typedef __bit_iterator<vector, false>            pointer;
+    typedef __bit_iterator<vector, true>             const_pointer;
+    typedef pointer                                  iterator;
+    typedef const_pointer                            const_iterator;
+    typedef _VSTD::reverse_iterator<iterator>         reverse_iterator;
+    typedef _VSTD::reverse_iterator<const_iterator>   const_reverse_iterator;
+
+private:
+    typedef typename __rebind_alloc_helper<__alloc_traits, __storage_type>::type __storage_allocator;
+    typedef allocator_traits<__storage_allocator>    __storage_traits;
+    typedef typename __storage_traits::pointer       __storage_pointer;
+    typedef typename __storage_traits::const_pointer __const_storage_pointer;
+
+    __storage_pointer                                      __begin_;
+    size_type                                              __size_;
+    __compressed_pair<size_type, __storage_allocator> __cap_alloc_;
+public:
+    typedef __bit_reference<vector>                  reference;
+    typedef __bit_const_reference<vector>            const_reference;
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    size_type& __cap() _NOEXCEPT
+        {return __cap_alloc_.first();}
+    _LIBCPP_INLINE_VISIBILITY
+    const size_type& __cap() const _NOEXCEPT
+        {return __cap_alloc_.first();}
+    _LIBCPP_INLINE_VISIBILITY
+    __storage_allocator& __alloc() _NOEXCEPT
+        {return __cap_alloc_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const __storage_allocator& __alloc() const _NOEXCEPT
+        {return __cap_alloc_.second();}
+
+    static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+    _LIBCPP_INLINE_VISIBILITY
+    static size_type __internal_cap_to_external(size_type __n) _NOEXCEPT
+        {return __n * __bits_per_word;}
+    _LIBCPP_INLINE_VISIBILITY
+    static size_type __external_cap_to_internal(size_type __n) _NOEXCEPT
+        {return (__n - 1) / __bits_per_word + 1;}
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
+
+    _LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a)
+#if _LIBCPP_STD_VER <= 14
+        _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
+#else
+        _NOEXCEPT;
+#endif
+    ~vector();
+    explicit vector(size_type __n);
+#if _LIBCPP_STD_VER > 11
+    explicit vector(size_type __n, const allocator_type& __a);
+#endif
+    vector(size_type __n, const value_type& __v);
+    vector(size_type __n, const value_type& __v, const allocator_type& __a);
+    template <class _InputIterator>
+        vector(_InputIterator __first, _InputIterator __last,
+               typename enable_if<__is_input_iterator  <_InputIterator>::value &&
+                                 !__is_forward_iterator<_InputIterator>::value>::type* = 0);
+    template <class _InputIterator>
+        vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
+               typename enable_if<__is_input_iterator  <_InputIterator>::value &&
+                                 !__is_forward_iterator<_InputIterator>::value>::type* = 0);
+    template <class _ForwardIterator>
+        vector(_ForwardIterator __first, _ForwardIterator __last,
+               typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);
+    template <class _ForwardIterator>
+        vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
+               typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);
+
+    vector(const vector& __v);
+    vector(const vector& __v, const allocator_type& __a);
+    vector& operator=(const vector& __v);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    vector(initializer_list<value_type> __il);
+    vector(initializer_list<value_type> __il, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    vector(vector&& __v)
+#if _LIBCPP_STD_VER > 14
+        _NOEXCEPT;
+#else
+        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+#endif
+    vector(vector&& __v, const allocator_type& __a);
+    _LIBCPP_INLINE_VISIBILITY
+    vector& operator=(vector&& __v)
+        _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    vector& operator=(initializer_list<value_type> __il)
+        {assign(__il.begin(), __il.end()); return *this;}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    template <class _InputIterator>
+        typename enable_if
+        <
+            __is_input_iterator<_InputIterator>::value &&
+           !__is_forward_iterator<_InputIterator>::value,
+           void
+        >::type
+        assign(_InputIterator __first, _InputIterator __last);
+    template <class _ForwardIterator>
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value,
+           void
+        >::type
+        assign(_ForwardIterator __first, _ForwardIterator __last);
+
+    void assign(size_type __n, const value_type& __x);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    void assign(initializer_list<value_type> __il)
+        {assign(__il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT
+        {return allocator_type(this->__alloc());}
+
+    size_type max_size() const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type capacity() const _NOEXCEPT
+        {return __internal_cap_to_external(__cap());}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type size() const _NOEXCEPT
+        {return __size_;}
+    _LIBCPP_INLINE_VISIBILITY
+    bool empty() const _NOEXCEPT
+        {return __size_ == 0;}
+    void reserve(size_type __n);
+    void shrink_to_fit() _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    iterator begin() _NOEXCEPT
+        {return __make_iter(0);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT
+        {return __make_iter(0);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator end() _NOEXCEPT
+        {return __make_iter(__size_);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end()   const _NOEXCEPT
+        {return __make_iter(__size_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    reverse_iterator rbegin() _NOEXCEPT
+        {return       reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rbegin() const _NOEXCEPT
+        {return const_reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    reverse_iterator rend() _NOEXCEPT
+        {return       reverse_iterator(begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rend()   const _NOEXCEPT
+        {return const_reverse_iterator(begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator         cbegin()  const _NOEXCEPT
+        {return __make_iter(0);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator         cend()    const _NOEXCEPT
+        {return __make_iter(__size_);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crbegin() const _NOEXCEPT
+        {return rbegin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crend()   const _NOEXCEPT
+        {return rend();}
+
+    _LIBCPP_INLINE_VISIBILITY reference       operator[](size_type __n)       {return __make_ref(__n);}
+    _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __make_ref(__n);}
+    reference       at(size_type __n);
+    const_reference at(size_type __n) const;
+
+    _LIBCPP_INLINE_VISIBILITY reference       front()       {return __make_ref(0);}
+    _LIBCPP_INLINE_VISIBILITY const_reference front() const {return __make_ref(0);}
+    _LIBCPP_INLINE_VISIBILITY reference       back()        {return __make_ref(__size_ - 1);}
+    _LIBCPP_INLINE_VISIBILITY const_reference back()  const {return __make_ref(__size_ - 1);}
+
+    void push_back(const value_type& __x);
+#if _LIBCPP_STD_VER > 11
+    template <class... _Args>
+    _LIBCPP_INLINE_VISIBILITY void emplace_back(_Args&&... __args)
+        { push_back ( value_type ( _VSTD::forward<_Args>(__args)... )); }
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY void pop_back() {--__size_;}
+
+#if _LIBCPP_STD_VER > 11
+    template <class... _Args>
+   _LIBCPP_INLINE_VISIBILITY iterator emplace(const_iterator position, _Args&&... __args)
+        { return insert ( position, value_type ( _VSTD::forward<_Args>(__args)... )); }
+#endif
+
+    iterator insert(const_iterator __position, const value_type& __x);
+    iterator insert(const_iterator __position, size_type __n, const value_type& __x);
+    iterator insert(const_iterator __position, size_type __n, const_reference __x);
+    template <class _InputIterator>
+        typename enable_if
+        <
+             __is_input_iterator  <_InputIterator>::value &&
+            !__is_forward_iterator<_InputIterator>::value,
+            iterator
+        >::type
+        insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
+    template <class _ForwardIterator>
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value,
+            iterator
+        >::type
+        insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __position, initializer_list<value_type> __il)
+        {return insert(__position, __il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
+    iterator erase(const_iterator __first, const_iterator __last);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT {__size_ = 0;}
+
+    void swap(vector&)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT;
+#else
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                    __is_nothrow_swappable<allocator_type>::value);
+#endif
+
+    void resize(size_type __sz, value_type __x = false);
+    void flip() _NOEXCEPT;
+
+    bool __invariants() const;
+
+private:
+    _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
+    void allocate(size_type __n);
+    void deallocate() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    static size_type __align_it(size_type __new_size) _NOEXCEPT
+        {return __new_size + (__bits_per_word-1) & ~((size_type)__bits_per_word-1);};
+    _LIBCPP_INLINE_VISIBILITY  size_type __recommend(size_type __new_size) const;
+    _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x);
+    template <class _ForwardIterator>
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value,
+            void
+        >::type
+        __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
+    void __append(size_type __n, const_reference __x);
+    _LIBCPP_INLINE_VISIBILITY
+    reference __make_ref(size_type __pos) _NOEXCEPT
+        {return reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reference __make_ref(size_type __pos) const _NOEXCEPT
+        {return const_reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator __make_iter(size_type __pos) _NOEXCEPT
+        {return iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator __make_iter(size_type __pos) const _NOEXCEPT
+        {return const_iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator __const_iterator_cast(const_iterator __p) _NOEXCEPT
+        {return begin() + (__p - cbegin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const vector& __v)
+        {__copy_assign_alloc(__v, integral_constant<bool,
+                      __storage_traits::propagate_on_container_copy_assignment::value>());}
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const vector& __c, true_type)
+        {
+            if (__alloc() != __c.__alloc())
+                deallocate();
+            __alloc() = __c.__alloc();
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const vector&, false_type)
+        {}
+
+    void __move_assign(vector& __c, false_type);
+    void __move_assign(vector& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(vector& __c)
+        _NOEXCEPT_(
+            !__storage_traits::propagate_on_container_move_assignment::value ||
+            is_nothrow_move_assignable<allocator_type>::value)
+        {__move_assign_alloc(__c, integral_constant<bool,
+                      __storage_traits::propagate_on_container_move_assignment::value>());}
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(vector& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+        {
+            __alloc() = _VSTD::move(__c.__alloc());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(vector&, false_type)
+        _NOEXCEPT
+        {}
+
+    size_t __hash_code() const _NOEXCEPT;
+
+    friend class __bit_reference<vector>;
+    friend class __bit_const_reference<vector>;
+    friend class __bit_iterator<vector, false>;
+    friend class __bit_iterator<vector, true>;
+    friend struct __bit_array<vector>;
+    friend struct _LIBCPP_TYPE_VIS_ONLY hash<vector>;
+};
+
+template <class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+vector<bool, _Allocator>::__invalidate_all_iterators()
+{
+}
+
+//  Allocate space for __n objects
+//  throws length_error if __n > max_size()
+//  throws (probably bad_alloc) if memory run out
+//  Precondition:  __begin_ == __end_ == __cap() == 0
+//  Precondition:  __n > 0
+//  Postcondition:  capacity() == __n
+//  Postcondition:  size() == 0
+template <class _Allocator>
+void
+vector<bool, _Allocator>::allocate(size_type __n)
+{
+    if (__n > max_size())
+        this->__throw_length_error();
+    __n = __external_cap_to_internal(__n);
+    this->__begin_ = __storage_traits::allocate(this->__alloc(), __n);
+    this->__size_ = 0;
+    this->__cap() = __n;
+}
+
+template <class _Allocator>
+void
+vector<bool, _Allocator>::deallocate() _NOEXCEPT
+{
+    if (this->__begin_ != nullptr)
+    {
+        __storage_traits::deallocate(this->__alloc(), this->__begin_, __cap());
+        __invalidate_all_iterators();
+        this->__begin_ = nullptr;
+        this->__size_ = this->__cap() = 0;
+    }
+}
+
+template <class _Allocator>
+typename vector<bool, _Allocator>::size_type
+vector<bool, _Allocator>::max_size() const _NOEXCEPT
+{
+    size_type __amax = __storage_traits::max_size(__alloc());
+    size_type __nmax = numeric_limits<size_type>::max() / 2;  // end() >= begin(), always
+    if (__nmax / __bits_per_word <= __amax)
+        return __nmax;
+    return __internal_cap_to_external(__amax);
+}
+
+//  Precondition:  __new_size > capacity()
+template <class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<bool, _Allocator>::size_type
+vector<bool, _Allocator>::__recommend(size_type __new_size) const
+{
+    const size_type __ms = max_size();
+    if (__new_size > __ms)
+        this->__throw_length_error();
+    const size_type __cap = capacity();
+    if (__cap >= __ms / 2)
+        return __ms;
+    return _VSTD::max(2*__cap, __align_it(__new_size));
+}
+
+//  Default constructs __n objects starting at __end_
+//  Precondition:  __n > 0
+//  Precondition:  size() + __n <= capacity()
+//  Postcondition:  size() == size() + __n
+template <class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x)
+{
+    size_type __old_size = this->__size_;
+    this->__size_ += __n;
+    _VSTD::fill_n(__make_iter(__old_size), __n, __x);
+}
+
+template <class _Allocator>
+template <class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value,
+    void
+>::type
+vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
+{
+    size_type __old_size = this->__size_;
+    this->__size_ += _VSTD::distance(__first, __last);
+    _VSTD::copy(__first, __last, __make_iter(__old_size));
+}
+
+template <class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+vector<bool, _Allocator>::vector()
+    _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0)
+{
+}
+
+template <class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+vector<bool, _Allocator>::vector(const allocator_type& __a)
+#if _LIBCPP_STD_VER <= 14
+        _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+#else
+        _NOEXCEPT
+#endif
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0, static_cast<__storage_allocator>(__a))
+{
+}
+
+template <class _Allocator>
+vector<bool, _Allocator>::vector(size_type __n)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0)
+{
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__n, false);
+    }
+}
+
+#if _LIBCPP_STD_VER > 11
+template <class _Allocator>
+vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0, static_cast<__storage_allocator>(__a))
+{
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__n, false);
+    }
+}
+#endif
+
+template <class _Allocator>
+vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0)
+{
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__n, __x);
+    }
+}
+
+template <class _Allocator>
+vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0, static_cast<__storage_allocator>(__a))
+{
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__n, __x);
+    }
+}
+
+template <class _Allocator>
+template <class _InputIterator>
+vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
+       typename enable_if<__is_input_iterator  <_InputIterator>::value &&
+                         !__is_forward_iterator<_InputIterator>::value>::type*)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        for (; __first != __last; ++__first)
+            push_back(*__first);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        if (__begin_ != nullptr)
+            __storage_traits::deallocate(__alloc(), __begin_, __cap());
+        __invalidate_all_iterators();
+        throw;
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template <class _Allocator>
+template <class _InputIterator>
+vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
+       typename enable_if<__is_input_iterator  <_InputIterator>::value &&
+                         !__is_forward_iterator<_InputIterator>::value>::type*)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0, static_cast<__storage_allocator>(__a))
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+        for (; __first != __last; ++__first)
+            push_back(*__first);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        if (__begin_ != nullptr)
+            __storage_traits::deallocate(__alloc(), __begin_, __cap());
+        __invalidate_all_iterators();
+        throw;
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template <class _Allocator>
+template <class _ForwardIterator>
+vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last,
+                                typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0)
+{
+    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__first, __last);
+    }
+}
+
+template <class _Allocator>
+template <class _ForwardIterator>
+vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
+                                typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0, static_cast<__storage_allocator>(__a))
+{
+    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__first, __last);
+    }
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Allocator>
+vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0)
+{
+    size_type __n = static_cast<size_type>(__il.size());
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__il.begin(), __il.end());
+    }
+}
+
+template <class _Allocator>
+vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0, static_cast<__storage_allocator>(__a))
+{
+    size_type __n = static_cast<size_type>(__il.size());
+    if (__n > 0)
+    {
+        allocate(__n);
+        __construct_at_end(__il.begin(), __il.end());
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Allocator>
+vector<bool, _Allocator>::~vector()
+{
+    if (__begin_ != nullptr)
+        __storage_traits::deallocate(__alloc(), __begin_, __cap());
+    __invalidate_all_iterators();
+}
+
+template <class _Allocator>
+vector<bool, _Allocator>::vector(const vector& __v)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0, __storage_traits::select_on_container_copy_construction(__v.__alloc()))
+{
+    if (__v.size() > 0)
+    {
+        allocate(__v.size());
+        __construct_at_end(__v.begin(), __v.end());
+    }
+}
+
+template <class _Allocator>
+vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0, __a)
+{
+    if (__v.size() > 0)
+    {
+        allocate(__v.size());
+        __construct_at_end(__v.begin(), __v.end());
+    }
+}
+
+template <class _Allocator>
+vector<bool, _Allocator>&
+vector<bool, _Allocator>::operator=(const vector& __v)
+{
+    if (this != &__v)
+    {
+        __copy_assign_alloc(__v);
+        if (__v.__size_)
+        {
+            if (__v.__size_ > capacity())
+            {
+                deallocate();
+                allocate(__v.__size_);
+            }
+            _VSTD::copy(__v.__begin_, __v.__begin_ + __external_cap_to_internal(__v.__size_), __begin_);
+        }
+        __size_ = __v.__size_;
+    }
+    return *this;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+vector<bool, _Allocator>::vector(vector&& __v)
+#if _LIBCPP_STD_VER > 14
+        _NOEXCEPT
+#else
+        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+#endif
+    : __begin_(__v.__begin_),
+      __size_(__v.__size_),
+      __cap_alloc_(__v.__cap_alloc_)
+{
+    __v.__begin_ = nullptr;
+    __v.__size_ = 0;
+    __v.__cap() = 0;
+}
+
+template <class _Allocator>
+vector<bool, _Allocator>::vector(vector&& __v, const allocator_type& __a)
+    : __begin_(nullptr),
+      __size_(0),
+      __cap_alloc_(0, __a)
+{
+    if (__a == allocator_type(__v.__alloc()))
+    {
+        this->__begin_ = __v.__begin_;
+        this->__size_ = __v.__size_;
+        this->__cap() = __v.__cap();
+        __v.__begin_ = nullptr;
+        __v.__cap() = __v.__size_ = 0;
+    }
+    else if (__v.size() > 0)
+    {
+        allocate(__v.size());
+        __construct_at_end(__v.begin(), __v.end());
+    }
+}
+
+template <class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+vector<bool, _Allocator>&
+vector<bool, _Allocator>::operator=(vector&& __v)
+    _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
+{
+    __move_assign(__v, integral_constant<bool,
+          __storage_traits::propagate_on_container_move_assignment::value>());
+    return *this;
+}
+
+template <class _Allocator>
+void
+vector<bool, _Allocator>::__move_assign(vector& __c, false_type)
+{
+    if (__alloc() != __c.__alloc())
+        assign(__c.begin(), __c.end());
+    else
+        __move_assign(__c, true_type());
+}
+
+template <class _Allocator>
+void
+vector<bool, _Allocator>::__move_assign(vector& __c, true_type)
+    _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+{
+    deallocate();
+    __move_assign_alloc(__c);
+    this->__begin_ = __c.__begin_;
+    this->__size_ = __c.__size_;
+    this->__cap() = __c.__cap();
+    __c.__begin_ = nullptr;
+    __c.__cap() = __c.__size_ = 0;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Allocator>
+void
+vector<bool, _Allocator>::assign(size_type __n, const value_type& __x)
+{
+    __size_ = 0;
+    if (__n > 0)
+    {
+        size_type __c = capacity();
+        if (__n <= __c)
+            __size_ = __n;
+        else
+        {
+            vector __v(__alloc());
+            __v.reserve(__recommend(__n));
+            __v.__size_ = __n;
+            swap(__v);
+        }
+        _VSTD::fill_n(begin(), __n, __x);
+    }
+}
+
+template <class _Allocator>
+template <class _InputIterator>
+typename enable_if
+<
+    __is_input_iterator<_InputIterator>::value &&
+   !__is_forward_iterator<_InputIterator>::value,
+   void
+>::type
+vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
+{
+    clear();
+    for (; __first != __last; ++__first)
+        push_back(*__first);
+}
+
+template <class _Allocator>
+template <class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value,
+   void
+>::type
+vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
+{
+    clear();
+    difference_type __n = _VSTD::distance(__first, __last);
+    if (__n)
+    {
+        if (__n > capacity())
+        {
+            deallocate();
+            allocate(__n);
+        }
+        __construct_at_end(__first, __last);
+    }
+}
+
+template <class _Allocator>
+void
+vector<bool, _Allocator>::reserve(size_type __n)
+{
+    if (__n > capacity())
+    {
+        vector __v(this->__alloc());
+        __v.allocate(__n);
+        __v.__construct_at_end(this->begin(), this->end());
+        swap(__v);
+        __invalidate_all_iterators();
+    }
+}
+
+template <class _Allocator>
+void
+vector<bool, _Allocator>::shrink_to_fit() _NOEXCEPT
+{
+    if (__external_cap_to_internal(size()) > __cap())
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            vector(*this, allocator_type(__alloc())).swap(*this);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+template <class _Allocator>
+typename vector<bool, _Allocator>::reference
+vector<bool, _Allocator>::at(size_type __n)
+{
+    if (__n >= size())
+        this->__throw_out_of_range();
+    return (*this)[__n];
+}
+
+template <class _Allocator>
+typename vector<bool, _Allocator>::const_reference
+vector<bool, _Allocator>::at(size_type __n) const
+{
+    if (__n >= size())
+        this->__throw_out_of_range();
+    return (*this)[__n];
+}
+
+template <class _Allocator>
+void
+vector<bool, _Allocator>::push_back(const value_type& __x)
+{
+    if (this->__size_ == this->capacity())
+        reserve(__recommend(this->__size_ + 1));
+    ++this->__size_;
+    back() = __x;
+}
+
+template <class _Allocator>
+typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::insert(const_iterator __position, const value_type& __x)
+{
+    iterator __r;
+    if (size() < capacity())
+    {
+        const_iterator __old_end = end();
+        ++__size_;
+        _VSTD::copy_backward(__position, __old_end, end());
+        __r = __const_iterator_cast(__position);
+    }
+    else
+    {
+        vector __v(__alloc());
+        __v.reserve(__recommend(__size_ + 1));
+        __v.__size_ = __size_ + 1;
+        __r = _VSTD::copy(cbegin(), __position, __v.begin());
+        _VSTD::copy_backward(__position, cend(), __v.end());
+        swap(__v);
+    }
+    *__r = __x;
+    return __r;
+}
+
+template <class _Allocator>
+typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::insert(const_iterator __position, size_type __n, const value_type& __x)
+{
+    iterator __r;
+    size_type __c = capacity();
+    if (__n <= __c && size() <= __c - __n)
+    {
+        const_iterator __old_end = end();
+        __size_ += __n;
+        _VSTD::copy_backward(__position, __old_end, end());
+        __r = __const_iterator_cast(__position);
+    }
+    else
+    {
+        vector __v(__alloc());
+        __v.reserve(__recommend(__size_ + __n));
+        __v.__size_ = __size_ + __n;
+        __r = _VSTD::copy(cbegin(), __position, __v.begin());
+        _VSTD::copy_backward(__position, cend(), __v.end());
+        swap(__v);
+    }
+    _VSTD::fill_n(__r, __n, __x);
+    return __r;
+}
+
+template <class _Allocator>
+template <class _InputIterator>
+typename enable_if
+<
+     __is_input_iterator  <_InputIterator>::value &&
+    !__is_forward_iterator<_InputIterator>::value,
+    typename vector<bool, _Allocator>::iterator
+>::type
+vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
+{
+    difference_type __off = __position - begin();
+    iterator __p = __const_iterator_cast(__position);
+    iterator __old_end = end();
+    for (; size() != capacity() && __first != __last; ++__first)
+    {
+        ++this->__size_;
+        back() = *__first;
+    }
+    vector __v(__alloc());
+    if (__first != __last)
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            __v.assign(__first, __last);
+            difference_type __old_size = static_cast<difference_type>(__old_end - begin());
+            difference_type __old_p = __p - begin();
+            reserve(__recommend(size() + __v.size()));
+            __p = begin() + __old_p;
+            __old_end = begin() + __old_size;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            erase(__old_end, end());
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+    __p = _VSTD::rotate(__p, __old_end, end());
+    insert(__p, __v.begin(), __v.end());
+    return begin() + __off;
+}
+
+template <class _Allocator>
+template <class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value,
+    typename vector<bool, _Allocator>::iterator
+>::type
+vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
+{
+    difference_type __n = _VSTD::distance(__first, __last);
+    iterator __r;
+    size_type __c = capacity();
+    if (__n <= __c && size() <= __c - __n)
+    {
+        const_iterator __old_end = end();
+        __size_ += __n;
+        _VSTD::copy_backward(__position, __old_end, end());
+        __r = __const_iterator_cast(__position);
+    }
+    else
+    {
+        vector __v(__alloc());
+        __v.reserve(__recommend(__size_ + __n));
+        __v.__size_ = __size_ + __n;
+        __r = _VSTD::copy(cbegin(), __position, __v.begin());
+        _VSTD::copy_backward(__position, cend(), __v.end());
+        swap(__v);
+    }
+    _VSTD::copy(__first, __last, __r);
+    return __r;
+}
+
+template <class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::erase(const_iterator __position)
+{
+    iterator __r = __const_iterator_cast(__position);
+    _VSTD::copy(__position + 1, this->cend(), __r);
+    --__size_;
+    return __r;
+}
+
+template <class _Allocator>
+typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::erase(const_iterator __first, const_iterator __last)
+{
+    iterator __r = __const_iterator_cast(__first);
+    difference_type __d = __last - __first;
+    _VSTD::copy(__last, this->cend(), __r);
+    __size_ -= __d;
+    return __r;
+}
+
+template <class _Allocator>
+void
+vector<bool, _Allocator>::swap(vector& __x)
+#if _LIBCPP_STD_VER >= 14
+    _NOEXCEPT
+#else
+    _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                __is_nothrow_swappable<allocator_type>::value)
+#endif
+{
+    _VSTD::swap(this->__begin_, __x.__begin_);
+    _VSTD::swap(this->__size_, __x.__size_);
+    _VSTD::swap(this->__cap(), __x.__cap());
+    __swap_allocator(this->__alloc(), __x.__alloc(), 
+        integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
+}
+
+template <class _Allocator>
+void
+vector<bool, _Allocator>::resize(size_type __sz, value_type __x)
+{
+    size_type __cs = size();
+    if (__cs < __sz)
+    {
+        iterator __r;
+        size_type __c = capacity();
+        size_type __n = __sz - __cs;
+        if (__n <= __c && __cs <= __c - __n)
+        {
+            __r = end();
+            __size_ += __n;
+        }
+        else
+        {
+            vector __v(__alloc());
+            __v.reserve(__recommend(__size_ + __n));
+            __v.__size_ = __size_ + __n;
+            __r = _VSTD::copy(cbegin(), cend(), __v.begin());
+            swap(__v);
+        }
+        _VSTD::fill_n(__r, __n, __x);
+    }
+    else
+        __size_ = __sz;
+}
+
+template <class _Allocator>
+void
+vector<bool, _Allocator>::flip() _NOEXCEPT
+{
+    // do middle whole words
+    size_type __n = __size_;
+    __storage_pointer __p = __begin_;
+    for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+        *__p = ~*__p;
+    // do last partial word
+    if (__n > 0)
+    {
+        __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        __storage_type __b = *__p & __m;
+        *__p &= ~__m;
+        *__p |= ~__b & __m;
+    }
+}
+
+template <class _Allocator>
+bool
+vector<bool, _Allocator>::__invariants() const
+{
+    if (this->__begin_ == nullptr)
+    {
+        if (this->__size_ != 0 || this->__cap() != 0)
+            return false;
+    }
+    else
+    {
+        if (this->__cap() == 0)
+            return false;
+        if (this->__size_ > this->capacity())
+            return false;
+    }
+    return true;
+}
+
+template <class _Allocator>
+size_t
+vector<bool, _Allocator>::__hash_code() const _NOEXCEPT
+{
+    size_t __h = 0;
+    // do middle whole words
+    size_type __n = __size_;
+    __storage_pointer __p = __begin_;
+    for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+        __h ^= *__p;
+    // do last partial word
+    if (__n > 0)
+    {
+        const __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+        __h ^= *__p & __m;
+    }
+    return __h;
+}
+
+template <class _Allocator>
+struct _LIBCPP_TYPE_VIS_ONLY hash<vector<bool, _Allocator> >
+    : public unary_function<vector<bool, _Allocator>, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT
+        {return __vec.__hash_code();}
+};
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
+{
+    const typename vector<_Tp, _Allocator>::size_type __sz = __x.size();
+    return __sz == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
+{
+    return !(__x == __y);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
+{
+    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
+{
+    return __y < __x;
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
+{
+    return !(__x < __y);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
+{
+    return !(__y < __x);
+}
+
+template <class _Tp, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y)
+    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
+{
+    __x.swap(__y);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_VECTOR

Property changes on: lab4/.minix-src/include/c++/vector
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/ammintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/ammintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/ammintrin.h	(revision 13)
@@ -0,0 +1,68 @@
+/*===---- ammintrin.h - SSE4a intrinsics -----------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __AMMINTRIN_H
+#define __AMMINTRIN_H
+
+#ifndef __SSE4A__
+#error "SSE4A instruction set not enabled"
+#else
+
+#include <pmmintrin.h>
+
+#define _mm_extracti_si64(x, len, idx) \
+  ((__m128i)__builtin_ia32_extrqi((__v2di)(__m128i)(x), \
+                                  (char)(len), (char)(idx)))
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_extract_si64(__m128i __x, __m128i __y)
+{
+  return (__m128i)__builtin_ia32_extrq((__v2di)__x, (__v16qi)__y);
+}
+
+#define _mm_inserti_si64(x, y, len, idx) \
+  ((__m128i)__builtin_ia32_insertqi((__v2di)(__m128i)(x), \
+                                    (__v2di)(__m128i)(y), \
+                                    (char)(len), (char)(idx)))
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_insert_si64(__m128i __x, __m128i __y)
+{
+  return (__m128i)__builtin_ia32_insertq((__v2di)__x, (__v2di)__y);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_stream_sd(double *__p, __m128d __a)
+{
+  __builtin_ia32_movntsd(__p, (__v2df)__a);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_stream_ss(float *__p, __m128 __a)
+{
+  __builtin_ia32_movntss(__p, (__v4sf)__a);
+}
+
+#endif /* __SSE4A__ */
+
+#endif /* __AMMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/ammintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/avx512fintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/avx512fintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/avx512fintrin.h	(revision 13)
@@ -0,0 +1,1036 @@
+/*===---- avx512fintrin.h - AVX2 intrinsics --------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+#ifndef __IMMINTRIN_H
+#error "Never use <avx512fintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef __AVX512FINTRIN_H
+#define __AVX512FINTRIN_H
+
+typedef double __v8df __attribute__((__vector_size__(64)));
+typedef float __v16sf __attribute__((__vector_size__(64)));
+typedef long long __v8di __attribute__((__vector_size__(64)));
+typedef int __v16si __attribute__((__vector_size__(64)));
+
+typedef float __m512 __attribute__((__vector_size__(64)));
+typedef double __m512d __attribute__((__vector_size__(64)));
+typedef long long __m512i __attribute__((__vector_size__(64)));
+
+typedef unsigned char __mmask8;
+typedef unsigned short __mmask16;
+
+/* Rounding mode macros.  */
+#define _MM_FROUND_TO_NEAREST_INT   0x00
+#define _MM_FROUND_TO_NEG_INF       0x01
+#define _MM_FROUND_TO_POS_INF       0x02
+#define _MM_FROUND_TO_ZERO          0x03
+#define _MM_FROUND_CUR_DIRECTION    0x04
+
+/* Create vectors with repeated elements */
+
+static  __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_setzero_si512(void)
+{
+  return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 };
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_maskz_set1_epi32(__mmask16 __M, int __A)
+{
+  return (__m512i) __builtin_ia32_pbroadcastd512_gpr_mask (__A,
+                 (__v16si)
+                 _mm512_setzero_si512 (),
+                 __M);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_maskz_set1_epi64(__mmask8 __M, long long __A)
+{
+#ifdef __x86_64__
+  return (__m512i) __builtin_ia32_pbroadcastq512_gpr_mask (__A,
+                 (__v8di)
+                 _mm512_setzero_si512 (),
+                 __M);
+#else
+  return (__m512i) __builtin_ia32_pbroadcastq512_mem_mask (__A,
+                 (__v8di)
+                 _mm512_setzero_si512 (),
+                 __M);
+#endif
+}
+
+static __inline __m512 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_setzero_ps(void)
+{
+  return (__m512){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
+                   0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
+}
+static  __inline __m512d __attribute__ ((__always_inline__, __nodebug__))
+_mm512_setzero_pd(void)
+{
+  return (__m512d){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
+}
+
+static __inline __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_set1_ps(float __w)
+{
+  return (__m512){ __w, __w, __w, __w, __w, __w, __w, __w,
+                   __w, __w, __w, __w, __w, __w, __w, __w  };
+}
+
+static __inline __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_set1_pd(double __w)
+{
+  return (__m512d){ __w, __w, __w, __w, __w, __w, __w, __w };
+}
+
+static __inline __m512i __attribute__((__always_inline__, __nodebug__))
+_mm512_set1_epi32(int __s)
+{
+  return (__m512i)(__v16si){ __s, __s, __s, __s, __s, __s, __s, __s,
+                             __s, __s, __s, __s, __s, __s, __s, __s };
+}
+
+static __inline __m512i __attribute__((__always_inline__, __nodebug__))
+_mm512_set1_epi64(long long __d)
+{
+  return (__m512i)(__v8di){ __d, __d, __d, __d, __d, __d, __d, __d };
+}
+
+static __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_broadcastss_ps(__m128 __X)
+{
+  float __f = __X[0];
+  return (__v16sf){ __f, __f, __f, __f,
+                    __f, __f, __f, __f,
+                    __f, __f, __f, __f,
+                    __f, __f, __f, __f };
+}
+
+static __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_broadcastsd_pd(__m128d __X)
+{
+  double __d = __X[0];
+  return (__v8df){ __d, __d, __d, __d,
+                   __d, __d, __d, __d };
+}
+
+/* Cast between vector types */
+
+static __inline __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_castpd256_pd512(__m256d __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 1, 2, 3, -1, -1, -1, -1);
+}
+
+static __inline __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_castps256_ps512(__m256 __a)
+{
+  return __builtin_shufflevector(__a, __a, 0,  1,  2,  3,  4,  5,  6,  7,
+                                          -1, -1, -1, -1, -1, -1, -1, -1);
+}
+
+static __inline __m128d __attribute__((__always_inline__, __nodebug__))
+_mm512_castpd512_pd128(__m512d __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 1);
+}
+
+static __inline __m128 __attribute__((__always_inline__, __nodebug__))
+_mm512_castps512_ps128(__m512 __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 1, 2, 3);
+}
+
+/* Arithmetic */
+
+static __inline __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_add_pd(__m512d __a, __m512d __b)
+{
+  return __a + __b;
+}
+
+static __inline __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_add_ps(__m512 __a, __m512 __b)
+{
+  return __a + __b;
+}
+
+static __inline __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_mul_pd(__m512d __a, __m512d __b)
+{
+  return __a * __b;
+}
+
+static __inline __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_mul_ps(__m512 __a, __m512 __b)
+{
+  return __a * __b;
+}
+
+static __inline __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_sub_pd(__m512d __a, __m512d __b)
+{
+  return __a - __b;
+}
+
+static __inline __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_sub_ps(__m512 __a, __m512 __b)
+{
+  return __a - __b;
+}
+
+static  __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_max_pd(__m512d __A, __m512d __B)
+{
+  return (__m512d) __builtin_ia32_maxpd512_mask ((__v8df) __A,
+             (__v8df) __B,
+             (__v8df)
+             _mm512_setzero_pd (),
+             (__mmask8) -1,
+             _MM_FROUND_CUR_DIRECTION);
+}
+
+static  __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_max_ps(__m512 __A, __m512 __B)
+{
+  return (__m512) __builtin_ia32_maxps512_mask ((__v16sf) __A,
+            (__v16sf) __B,
+            (__v16sf)
+            _mm512_setzero_ps (),
+            (__mmask16) -1,
+            _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __m512i
+__attribute__ ((__always_inline__, __nodebug__))
+_mm512_max_epi32(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_pmaxsd512_mask ((__v16si) __A,
+              (__v16si) __B,
+              (__v16si)
+              _mm512_setzero_si512 (),
+              (__mmask16) -1);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_max_epu32(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_pmaxud512_mask ((__v16si) __A,
+              (__v16si) __B,
+              (__v16si)
+              _mm512_setzero_si512 (),
+              (__mmask16) -1);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_max_epi64(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_pmaxsq512_mask ((__v8di) __A,
+              (__v8di) __B,
+              (__v8di)
+              _mm512_setzero_si512 (),
+              (__mmask8) -1);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_max_epu64(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_pmaxuq512_mask ((__v8di) __A,
+              (__v8di) __B,
+              (__v8di)
+              _mm512_setzero_si512 (),
+              (__mmask8) -1);
+}
+
+static  __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_min_pd(__m512d __A, __m512d __B)
+{
+  return (__m512d) __builtin_ia32_minpd512_mask ((__v8df) __A,
+             (__v8df) __B,
+             (__v8df)
+             _mm512_setzero_pd (),
+             (__mmask8) -1,
+             _MM_FROUND_CUR_DIRECTION);
+}
+
+static  __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_min_ps(__m512 __A, __m512 __B)
+{
+  return (__m512) __builtin_ia32_minps512_mask ((__v16sf) __A,
+            (__v16sf) __B,
+            (__v16sf)
+            _mm512_setzero_ps (),
+            (__mmask16) -1,
+            _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __m512i
+__attribute__ ((__always_inline__, __nodebug__))
+_mm512_min_epi32(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_pminsd512_mask ((__v16si) __A,
+              (__v16si) __B,
+              (__v16si)
+              _mm512_setzero_si512 (),
+              (__mmask16) -1);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_min_epu32(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_pminud512_mask ((__v16si) __A,
+              (__v16si) __B,
+              (__v16si)
+              _mm512_setzero_si512 (),
+              (__mmask16) -1);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_min_epi64(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_pminsq512_mask ((__v8di) __A,
+              (__v8di) __B,
+              (__v8di)
+              _mm512_setzero_si512 (),
+              (__mmask8) -1);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_min_epu64(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_pminuq512_mask ((__v8di) __A,
+              (__v8di) __B,
+              (__v8di)
+              _mm512_setzero_si512 (),
+              (__mmask8) -1);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_mul_epi32(__m512i __X, __m512i __Y)
+{
+  return (__m512i) __builtin_ia32_pmuldq512_mask ((__v16si) __X,
+              (__v16si) __Y,
+              (__v8di)
+              _mm512_setzero_si512 (),
+              (__mmask8) -1);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_mul_epu32(__m512i __X, __m512i __Y)
+{
+  return (__m512i) __builtin_ia32_pmuludq512_mask ((__v16si) __X,
+               (__v16si) __Y,
+               (__v8di)
+               _mm512_setzero_si512 (),
+               (__mmask8) -1);
+}
+
+static  __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_sqrt_pd(__m512d a)
+{
+  return (__m512d)__builtin_ia32_sqrtpd512_mask((__v8df)a,
+                                                (__v8df) _mm512_setzero_pd (),
+                                                (__mmask8) -1,
+                                                _MM_FROUND_CUR_DIRECTION);
+}
+
+static  __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_sqrt_ps(__m512 a)
+{
+  return (__m512)__builtin_ia32_sqrtps512_mask((__v16sf)a,
+                                               (__v16sf) _mm512_setzero_ps (),
+                                               (__mmask16) -1,
+                                               _MM_FROUND_CUR_DIRECTION);
+}
+
+static  __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_rsqrt14_pd(__m512d __A)
+{
+  return (__m512d) __builtin_ia32_rsqrt14pd512_mask ((__v8df) __A,
+                 (__v8df)
+                 _mm512_setzero_pd (),
+                 (__mmask8) -1);}
+
+static  __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_rsqrt14_ps(__m512 __A)
+{
+  return (__m512) __builtin_ia32_rsqrt14ps512_mask ((__v16sf) __A,
+                (__v16sf)
+                _mm512_setzero_ps (),
+                (__mmask16) -1);
+}
+
+static  __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_rsqrt14_ss(__m128 __A, __m128 __B)
+{
+  return (__m128) __builtin_ia32_rsqrt14ss_mask ((__v4sf) __A,
+             (__v4sf) __B,
+             (__v4sf)
+             _mm_setzero_ps (),
+             (__mmask8) -1);
+}
+
+static  __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_rsqrt14_sd(__m128d __A, __m128d __B)
+{
+  return (__m128d) __builtin_ia32_rsqrt14sd_mask ((__v2df) __A,
+              (__v2df) __B,
+              (__v2df)
+              _mm_setzero_pd (),
+              (__mmask8) -1);
+}
+
+static  __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_rcp14_pd(__m512d __A)
+{
+  return (__m512d) __builtin_ia32_rcp14pd512_mask ((__v8df) __A,
+               (__v8df)
+               _mm512_setzero_pd (),
+               (__mmask8) -1);
+}
+
+static  __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_rcp14_ps(__m512 __A)
+{
+  return (__m512) __builtin_ia32_rcp14ps512_mask ((__v16sf) __A,
+              (__v16sf)
+              _mm512_setzero_ps (),
+              (__mmask16) -1);
+}
+static  __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_rcp14_ss(__m128 __A, __m128 __B)
+{
+  return (__m128) __builtin_ia32_rcp14ss_mask ((__v4sf) __A,
+                 (__v4sf) __B,
+                 (__v4sf)
+                 _mm_setzero_ps (),
+                 (__mmask8) -1);
+}
+
+static  __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_rcp14_sd(__m128d __A, __m128d __B)
+{
+  return (__m128d) __builtin_ia32_rcp14sd_mask ((__v2df) __A,
+            (__v2df) __B,
+            (__v2df)
+            _mm_setzero_pd (),
+            (__mmask8) -1);
+}
+
+static __inline __m512 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_floor_ps(__m512 __A)
+{
+  return (__m512) __builtin_ia32_rndscaleps_mask ((__v16sf) __A,
+                                                  _MM_FROUND_FLOOR,
+                                                  (__v16sf) __A, -1,
+                                                  _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __m512d __attribute__ ((__always_inline__, __nodebug__))
+_mm512_floor_pd(__m512d __A)
+{
+  return (__m512d) __builtin_ia32_rndscalepd_mask ((__v8df) __A,
+                                                   _MM_FROUND_FLOOR,
+                                                   (__v8df) __A, -1,
+                                                   _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __m512 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_ceil_ps(__m512 __A)
+{
+  return (__m512) __builtin_ia32_rndscaleps_mask ((__v16sf) __A,
+                                                  _MM_FROUND_CEIL,
+                                                  (__v16sf) __A, -1,
+                                                  _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __m512d __attribute__ ((__always_inline__, __nodebug__))
+_mm512_ceil_pd(__m512d __A)
+{
+  return (__m512d) __builtin_ia32_rndscalepd_mask ((__v8df) __A,
+                                                   _MM_FROUND_CEIL,
+                                                   (__v8df) __A, -1,
+                                                   _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __m512i __attribute__ (( __always_inline__, __nodebug__))
+_mm512_abs_epi64(__m512i __A)
+{
+  return (__m512i) __builtin_ia32_pabsq512_mask ((__v8di) __A,
+             (__v8di)
+             _mm512_setzero_si512 (),
+             (__mmask8) -1);
+}
+
+static __inline __m512i __attribute__ (( __always_inline__, __nodebug__))
+_mm512_abs_epi32(__m512i __A)
+{
+  return (__m512i) __builtin_ia32_pabsd512_mask ((__v16si) __A,
+             (__v16si)
+             _mm512_setzero_si512 (),
+             (__mmask16) -1);
+}
+
+static __inline __m512 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_roundscale_ps(__m512 __A, const int __imm)
+{
+  return (__m512) __builtin_ia32_rndscaleps_mask ((__v16sf) __A, __imm,
+              (__v16sf) __A, -1,
+              _MM_FROUND_CUR_DIRECTION);
+}
+static __inline __m512d __attribute__ ((__always_inline__, __nodebug__))
+_mm512_roundscale_pd(__m512d __A, const int __imm)
+{
+  return (__m512d) __builtin_ia32_rndscalepd_mask ((__v8df) __A, __imm,
+               (__v8df) __A, -1,
+               _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_fmadd_pd(__m512d __A, __m512d __B, __m512d __C)
+{
+  return (__m512d)
+    __builtin_ia32_vfmaddpd512_mask(__A,
+                                    __B,
+                                    __C,
+                                    (__mmask8) -1,
+                                    _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_fmsub_pd(__m512d __A, __m512d __B, __m512d __C)
+{
+  return (__m512d)
+    __builtin_ia32_vfmsubpd512_mask(__A,
+                                    __B,
+                                    __C,
+                                    (__mmask8) -1,
+                                    _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C)
+{
+  return (__m512d)
+    __builtin_ia32_vfnmaddpd512_mask(__A,
+                                     __B,
+                                     __C,
+                                     (__mmask8) -1,
+                                     _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_fmadd_ps(__m512 __A, __m512 __B, __m512 __C)
+{
+  return (__m512)
+    __builtin_ia32_vfmaddps512_mask(__A,
+                                    __B,
+                                    __C,
+                                    (__mmask16) -1,
+                                    _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_fmsub_ps(__m512 __A, __m512 __B, __m512 __C)
+{
+  return (__m512)
+    __builtin_ia32_vfmsubps512_mask(__A,
+                                    __B,
+                                    __C,
+                                    (__mmask16) -1,
+                                    _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C)
+{
+  return (__m512)
+    __builtin_ia32_vfnmaddps512_mask(__A,
+                                     __B,
+                                     __C,
+                                     (__mmask16) -1,
+                                     _MM_FROUND_CUR_DIRECTION);
+}
+
+/* Vector permutations */
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_permutex2var_epi32(__m512i __A, __m512i __I, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_vpermt2vard512_mask ((__v16si) __I
+                                                       /* idx */ ,
+                                                       (__v16si) __A,
+                                                       (__v16si) __B,
+                                                       (__mmask16) -1);
+}
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_permutex2var_epi64(__m512i __A, __m512i __I, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_vpermt2varq512_mask ((__v8di) __I
+                                                       /* idx */ ,
+                                                       (__v8di) __A,
+                                                       (__v8di) __B,
+                                                       (__mmask8) -1);
+}
+
+static __inline __m512d __attribute__ ((__always_inline__, __nodebug__))
+_mm512_permutex2var_pd(__m512d __A, __m512i __I, __m512d __B)
+{
+  return (__m512d) __builtin_ia32_vpermt2varpd512_mask ((__v8di) __I
+                                                        /* idx */ ,
+                                                        (__v8df) __A,
+                                                        (__v8df) __B,
+                                                        (__mmask8) -1);
+}
+static __inline __m512 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_permutex2var_ps(__m512 __A, __m512i __I, __m512 __B)
+{
+  return (__m512) __builtin_ia32_vpermt2varps512_mask ((__v16si) __I
+                                                       /* idx */ ,
+                                                       (__v16sf) __A,
+                                                       (__v16sf) __B,
+                                                       (__mmask16) -1);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_valign_epi64(__m512i __A, __m512i __B, const int __I)
+{
+  return (__m512i) __builtin_ia32_alignq512_mask((__v8di)__A,
+                                                 (__v8di)__B,
+                                                 __I,
+                                                 (__v8di)_mm512_setzero_si512(),
+                                                 (__mmask8) -1);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_valign_epi32(__m512i __A, __m512i __B, const int __I)
+{
+  return (__m512i)__builtin_ia32_alignd512_mask((__v16si)__A,
+                                                (__v16si)__B,
+                                                __I,
+                                                (__v16si)_mm512_setzero_si512(),
+                                                (__mmask16) -1);
+}
+
+/* Vector Blend */
+
+static __inline __m512d __attribute__ ((__always_inline__, __nodebug__))
+_mm512_mask_blend_pd(__mmask8 __U, __m512d __A, __m512d __W)
+{
+  return (__m512d) __builtin_ia32_blendmpd_512_mask ((__v8df) __A,
+                 (__v8df) __W,
+                 (__mmask8) __U);
+}
+
+static __inline __m512 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_mask_blend_ps(__mmask16 __U, __m512 __A, __m512 __W)
+{
+  return (__m512) __builtin_ia32_blendmps_512_mask ((__v16sf) __A,
+                (__v16sf) __W,
+                (__mmask16) __U);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_mask_blend_epi64(__mmask8 __U, __m512i __A, __m512i __W)
+{
+  return (__m512i) __builtin_ia32_blendmq_512_mask ((__v8di) __A,
+                (__v8di) __W,
+                (__mmask8) __U);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_mask_blend_epi32(__mmask16 __U, __m512i __A, __m512i __W)
+{
+  return (__m512i) __builtin_ia32_blendmd_512_mask ((__v16si) __A,
+                (__v16si) __W,
+                (__mmask16) __U);
+}
+
+/* Compare */
+
+static __inline __mmask16 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_cmp_ps_mask(__m512 a, __m512 b, const int p)
+{
+  return (__mmask16) __builtin_ia32_cmpps512_mask ((__v16sf) a,
+               (__v16sf) b, p, (__mmask16) -1,
+               _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __mmask8 __attribute__ ((__always_inline__, __nodebug__)) 
+_mm512_cmp_pd_mask(__m512d __X, __m512d __Y, const int __P)
+{
+  return (__mmask8) __builtin_ia32_cmppd512_mask ((__v8df) __X,
+              (__v8df) __Y, __P,
+              (__mmask8) -1,
+              _MM_FROUND_CUR_DIRECTION);
+}
+
+/* Conversion */
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_cvttps_epu32(__m512 __A)
+{
+  return (__m512i) __builtin_ia32_cvttps2udq512_mask ((__v16sf) __A,
+                  (__v16si)
+                  _mm512_setzero_si512 (),
+                  (__mmask16) -1,
+                  _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __m512 __attribute__ (( __always_inline__, __nodebug__))
+_mm512_cvt_roundepi32_ps(__m512i __A, const int __R)
+{
+  return (__m512) __builtin_ia32_cvtdq2ps512_mask ((__v16si) __A,
+               (__v16sf)
+               _mm512_setzero_ps (),
+               (__mmask16) -1,
+               __R);
+}
+
+static __inline __m512 __attribute__ (( __always_inline__, __nodebug__))
+_mm512_cvt_roundepu32_ps(__m512i __A, const int __R)
+{
+  return (__m512) __builtin_ia32_cvtudq2ps512_mask ((__v16si) __A,
+               (__v16sf)
+               _mm512_setzero_ps (),
+               (__mmask16) -1,
+               __R);
+}
+
+static __inline __m512d __attribute__ (( __always_inline__, __nodebug__))
+_mm512_cvtepi32_pd(__m256i __A)
+{
+  return (__m512d) __builtin_ia32_cvtdq2pd512_mask ((__v8si) __A,
+                (__v8df)
+                _mm512_setzero_pd (),
+                (__mmask8) -1);
+}
+
+static __inline __m512d __attribute__ (( __always_inline__, __nodebug__))
+_mm512_cvtepu32_pd(__m256i __A)
+{
+  return (__m512d) __builtin_ia32_cvtudq2pd512_mask ((__v8si) __A,
+                (__v8df)
+                _mm512_setzero_pd (),
+                (__mmask8) -1);
+}
+static __inline __m256 __attribute__ (( __always_inline__, __nodebug__))
+_mm512_cvt_roundpd_ps(__m512d __A, const int __R)
+{
+  return (__m256) __builtin_ia32_cvtpd2ps512_mask ((__v8df) __A,
+               (__v8sf)
+               _mm256_setzero_ps (),
+               (__mmask8) -1,
+               __R);
+}
+
+static  __inline __m256i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_cvtps_ph(__m512 __A, const int __I)
+{
+  return (__m256i) __builtin_ia32_vcvtps2ph512_mask ((__v16sf) __A,
+                 __I,
+                 (__v16hi)
+                 _mm256_setzero_si256 (),
+                 -1);
+}
+
+static  __inline __m512 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_cvtph_ps(__m256i __A)
+{
+  return (__m512) __builtin_ia32_vcvtph2ps512_mask ((__v16hi) __A,
+                (__v16sf)
+                _mm512_setzero_ps (),
+                (__mmask16) -1,
+                _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __m512i __attribute__((__always_inline__, __nodebug__))
+_mm512_cvttps_epi32(__m512 a)
+{
+  return (__m512i)
+    __builtin_ia32_cvttps2dq512_mask((__v16sf) a,
+                                     (__v16si) _mm512_setzero_si512 (),
+                                     (__mmask16) -1, _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm512_cvttpd_epi32(__m512d a)
+{
+  return (__m256i)__builtin_ia32_cvttpd2dq512_mask((__v8df) a,
+                                                   (__v8si)_mm256_setzero_si256(),
+                                                   (__mmask8) -1,
+                                                    _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline __m256i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_cvtt_roundpd_epi32(__m512d __A, const int __R)
+{
+  return (__m256i) __builtin_ia32_cvttpd2dq512_mask ((__v8df) __A,
+                 (__v8si)
+                 _mm256_setzero_si256 (),
+                 (__mmask8) -1,
+                 __R);
+}
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_cvtt_roundps_epi32(__m512 __A, const int __R)
+{
+  return (__m512i) __builtin_ia32_cvttps2dq512_mask ((__v16sf) __A,
+                 (__v16si)
+                 _mm512_setzero_si512 (),
+                 (__mmask16) -1,
+                 __R);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_cvt_roundps_epi32(__m512 __A, const int __R)
+{
+  return (__m512i) __builtin_ia32_cvtps2dq512_mask ((__v16sf) __A,
+                (__v16si)
+                _mm512_setzero_si512 (),
+                (__mmask16) -1,
+                __R);
+}
+static __inline __m256i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_cvt_roundpd_epi32(__m512d __A, const int __R)
+{
+  return (__m256i) __builtin_ia32_cvtpd2dq512_mask ((__v8df) __A,
+                (__v8si)
+                _mm256_setzero_si256 (),
+                (__mmask8) -1,
+                __R);
+}
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_cvt_roundps_epu32(__m512 __A, const int __R)
+{
+  return (__m512i) __builtin_ia32_cvtps2udq512_mask ((__v16sf) __A,
+                (__v16si)
+                _mm512_setzero_si512 (),
+                (__mmask16) -1,
+                __R);
+}
+static __inline __m256i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_cvt_roundpd_epu32(__m512d __A, const int __R)
+{
+  return (__m256i) __builtin_ia32_cvtpd2udq512_mask ((__v8df) __A,
+                (__v8si)
+                _mm256_setzero_si256 (),
+                (__mmask8) -1,
+                __R);
+}
+
+/* Unpack and Interleave */
+static __inline __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_unpackhi_pd(__m512d __a, __m512d __b)
+{
+  return __builtin_shufflevector(__a, __b, 1, 9, 1+2, 9+2, 1+4, 9+4, 1+6, 9+6);
+}
+
+static __inline __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_unpacklo_pd(__m512d __a, __m512d __b)
+{
+  return __builtin_shufflevector(__a, __b, 0, 8, 0+2, 8+2, 0+4, 8+4, 0+6, 8+6);
+}
+
+static __inline __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_unpackhi_ps(__m512 __a, __m512 __b)
+{
+  return __builtin_shufflevector(__a, __b,
+                                 2,    18,    3,    19,
+                                 2+4,  18+4,  3+4,  19+4,
+                                 2+8,  18+8,  3+8,  19+8,
+                                 2+12, 18+12, 3+12, 19+12);
+}
+
+static __inline __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_unpacklo_ps(__m512 __a, __m512 __b)
+{
+  return __builtin_shufflevector(__a, __b,
+                                 0,    16,    1,    17,
+                                 0+4,  16+4,  1+4,  17+4,
+                                 0+8,  16+8,  1+8,  17+8,
+                                 0+12, 16+12, 1+12, 17+12);
+}
+
+/* Bit Test */
+
+static __inline __mmask16 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_test_epi32_mask(__m512i __A, __m512i __B)
+{
+  return (__mmask16) __builtin_ia32_ptestmd512 ((__v16si) __A,
+            (__v16si) __B,
+            (__mmask16) -1);
+}
+
+static __inline __mmask8 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_test_epi64_mask(__m512i __A, __m512i __B)
+{
+  return (__mmask8) __builtin_ia32_ptestmq512 ((__v8di) __A,
+                 (__v8di) __B,
+                 (__mmask8) -1);
+}
+
+/* SIMD load ops */
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_maskz_loadu_epi32(__mmask16 __U, void const *__P)
+{
+  return (__m512i) __builtin_ia32_loaddqusi512_mask ((const __v16si *)__P,
+                                                     (__v16si)
+                                                     _mm512_setzero_si512 (),
+                                                     (__mmask16) __U);
+}
+
+static __inline __m512i __attribute__ ((__always_inline__, __nodebug__))
+_mm512_maskz_loadu_epi64(__mmask8 __U, void const *__P)
+{
+  return (__m512i) __builtin_ia32_loaddqudi512_mask ((const __v8di *)__P,
+                                                     (__v8di)
+                                                     _mm512_setzero_si512 (),
+                                                     (__mmask8) __U);
+}
+
+static __inline __m512 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_maskz_loadu_ps(__mmask16 __U, void const *__P)
+{
+  return (__m512) __builtin_ia32_loadups512_mask ((const __v16sf *)__P,
+                                                  (__v16sf)
+                                                  _mm512_setzero_ps (),
+                                                  (__mmask16) __U);
+}
+
+static __inline __m512d __attribute__ ((__always_inline__, __nodebug__))
+_mm512_maskz_loadu_pd(__mmask8 __U, void const *__P)
+{
+  return (__m512d) __builtin_ia32_loadupd512_mask ((const __v8df *)__P,
+                                                   (__v8df)
+                                                   _mm512_setzero_pd (),
+                                                   (__mmask8) __U);
+}
+
+static __inline __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_loadu_pd(double const *__p)
+{
+  struct __loadu_pd {
+    __m512d __v;
+  } __attribute__((packed, may_alias));
+  return ((struct __loadu_pd*)__p)->__v;
+}
+
+static __inline __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_loadu_ps(float const *__p)
+{
+  struct __loadu_ps {
+    __m512 __v;
+  } __attribute__((packed, may_alias));
+  return ((struct __loadu_ps*)__p)->__v;
+}
+
+/* SIMD store ops */
+
+static __inline void __attribute__ ((__always_inline__, __nodebug__))
+_mm512_mask_storeu_epi64(void *__P, __mmask8 __U, __m512i __A)
+{
+  __builtin_ia32_storedqudi512_mask ((__v8di *)__P, (__v8di) __A,
+                                     (__mmask8) __U);
+}
+
+static __inline void __attribute__ ((__always_inline__, __nodebug__))
+_mm512_mask_storeu_epi32(void *__P, __mmask16 __U, __m512i __A)
+{
+  __builtin_ia32_storedqusi512_mask ((__v16si *)__P, (__v16si) __A,
+                                     (__mmask16) __U);
+}
+
+static __inline void __attribute__ ((__always_inline__, __nodebug__))
+_mm512_mask_storeu_pd(void *__P, __mmask8 __U, __m512d __A)
+{
+  __builtin_ia32_storeupd512_mask ((__v8df *)__P, (__v8df) __A, (__mmask8) __U);
+}
+
+static __inline void __attribute__ ((__always_inline__, __nodebug__))
+_mm512_storeu_pd(void *__P, __m512d __A)
+{
+  __builtin_ia32_storeupd512_mask((__v8df *)__P, (__v8df)__A, (__mmask8)-1);
+}
+
+static __inline void __attribute__ ((__always_inline__, __nodebug__))
+_mm512_mask_storeu_ps(void *__P, __mmask16 __U, __m512 __A)
+{
+  __builtin_ia32_storeups512_mask ((__v16sf *)__P, (__v16sf) __A,
+                                   (__mmask16) __U);
+}
+
+static __inline void __attribute__ ((__always_inline__, __nodebug__))
+_mm512_storeu_ps(void *__P, __m512 __A)
+{
+  __builtin_ia32_storeups512_mask((__v16sf *)__P, (__v16sf)__A, (__mmask16)-1);
+}
+
+static __inline void __attribute__ ((__always_inline__, __nodebug__))
+_mm512_store_ps(void *__P, __m512 __A)
+{
+  *(__m512*)__P = __A;
+}
+
+static __inline void __attribute__ ((__always_inline__, __nodebug__))
+_mm512_store_pd(void *__P, __m512d __A)
+{
+  *(__m512d*)__P = __A;
+}
+
+/* Mask ops */
+
+static __inline __mmask16 __attribute__ ((__always_inline__, __nodebug__))
+_mm512_knot(__mmask16 __M)
+{
+  return __builtin_ia32_knothi(__M);
+}
+
+/* Integer compare */
+
+static __inline__ __mmask16 __attribute__((__always_inline__, __nodebug__))
+_mm512_cmpeq_epi32_mask(__m512i __a, __m512i __b) {
+  return (__mmask16)__builtin_ia32_pcmpeqd512_mask((__v16si)__a, (__v16si)__b,
+                                                   (__mmask16)-1);
+}
+
+static __inline__ __mmask16 __attribute__((__always_inline__, __nodebug__))
+_mm512_mask_cmpeq_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
+  return (__mmask16)__builtin_ia32_pcmpeqd512_mask((__v16si)__a, (__v16si)__b,
+                                                   __u);
+}
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm512_mask_cmpeq_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqq512_mask((__v8di)__a, (__v8di)__b,
+                                                  __u);
+}
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm512_cmpeq_epi64_mask(__m512i __a, __m512i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqq512_mask((__v8di)__a, (__v8di)__b,
+                                                  (__mmask8)-1);
+}
+
+#endif // __AVX512FINTRIN_H

Property changes on: lab4/.minix-src/include/clang-3.6/avx512fintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/bmi2intrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/bmi2intrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/bmi2intrin.h	(revision 13)
@@ -0,0 +1,94 @@
+/*===---- bmi2intrin.h - BMI2 intrinsics -----------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
+#error "Never use <bmi2intrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+#ifndef __BMI2__
+# error "BMI2 instruction set not enabled"
+#endif /* __BMI2__ */
+
+#ifndef __BMI2INTRIN_H
+#define __BMI2INTRIN_H
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_bzhi_u32(unsigned int __X, unsigned int __Y)
+{
+  return __builtin_ia32_bzhi_si(__X, __Y);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_pdep_u32(unsigned int __X, unsigned int __Y)
+{
+  return __builtin_ia32_pdep_si(__X, __Y);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_pext_u32(unsigned int __X, unsigned int __Y)
+{
+  return __builtin_ia32_pext_si(__X, __Y);
+}
+
+#ifdef  __x86_64__
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+_bzhi_u64(unsigned long long __X, unsigned long long __Y)
+{
+  return __builtin_ia32_bzhi_di(__X, __Y);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+_pdep_u64(unsigned long long __X, unsigned long long __Y)
+{
+  return __builtin_ia32_pdep_di(__X, __Y);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+_pext_u64(unsigned long long __X, unsigned long long __Y)
+{
+  return __builtin_ia32_pext_di(__X, __Y);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+_mulx_u64 (unsigned long long __X, unsigned long long __Y,
+	   unsigned long long *__P)
+{
+  unsigned __int128 __res = (unsigned __int128) __X * __Y;
+  *__P = (unsigned long long) (__res >> 64);
+  return (unsigned long long) __res;
+}
+
+#else /* !__x86_64__ */
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_mulx_u32 (unsigned int __X, unsigned int __Y, unsigned int *__P)
+{
+  unsigned long long __res = (unsigned long long) __X * __Y;
+  *__P = (unsigned int) (__res >> 32);
+  return (unsigned int) __res;
+}
+
+#endif /* !__x86_64__  */
+
+#endif /* __BMI2INTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/bmi2intrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/fma4intrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/fma4intrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/fma4intrin.h	(revision 13)
@@ -0,0 +1,231 @@
+/*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __X86INTRIN_H
+#error "Never use <fma4intrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+#ifndef __FMA4INTRIN_H
+#define __FMA4INTRIN_H
+
+#ifndef __FMA4__
+# error "FMA4 instruction set is not enabled"
+#else
+
+#include <pmmintrin.h>
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_macc_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmaddps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_macc_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmaddpd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_macc_ss(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmaddss(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_macc_sd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmaddsd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_msub_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmsubps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_msub_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmsubpd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_msub_ss(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmsubss(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_msub_sd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmsubsd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_nmacc_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfnmaddps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_nmacc_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfnmaddpd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_nmacc_ss(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfnmaddss(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_nmacc_sd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfnmaddsd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_nmsub_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfnmsubps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_nmsub_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfnmsubpd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_nmsub_ss(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfnmsubss(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_nmsub_sd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfnmsubsd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_maddsub_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmaddsubps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_maddsub_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmaddsubpd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_msubadd_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmsubaddps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_msubadd_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmsubaddpd(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_macc_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfmaddps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_macc_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfmaddpd256(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_msub_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfmsubps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_msub_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfmsubpd256(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_nmacc_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfnmaddps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_nmacc_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfnmaddpd256(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_nmsub_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfnmsubps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_nmsub_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfnmsubpd256(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_maddsub_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfmaddsubps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_maddsub_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfmaddsubpd256(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_msubadd_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfmsubaddps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_msubadd_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfmsubaddpd256(__A, __B, __C);
+}
+
+#endif /* __FMA4__ */
+
+#endif /* __FMA4INTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/fma4intrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/lzcntintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/lzcntintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/lzcntintrin.h	(revision 13)
@@ -0,0 +1,67 @@
+/*===---- lzcntintrin.h - LZCNT intrinsics ---------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
+#error "Never use <lzcntintrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+#ifndef __LZCNT__
+# error "LZCNT instruction is not enabled"
+#endif /* __LZCNT__ */
+
+#ifndef __LZCNTINTRIN_H
+#define __LZCNTINTRIN_H
+
+static __inline__ unsigned short __attribute__((__always_inline__, __nodebug__))
+__lzcnt16(unsigned short __X)
+{
+  return __X ? __builtin_clzs(__X) : 16;
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__lzcnt32(unsigned int __X)
+{
+  return __X ? __builtin_clz(__X) : 32;
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_lzcnt_u32(unsigned int __X)
+{
+  return __X ? __builtin_clz(__X) : 32;
+}
+
+#ifdef __x86_64__
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__lzcnt64(unsigned long long __X)
+{
+  return __X ? __builtin_clzll(__X) : 64;
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+_lzcnt_u64(unsigned long long __X)
+{
+  return __X ? __builtin_clzll(__X) : 64;
+}
+#endif
+
+#endif /* __LZCNTINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/lzcntintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/nmmintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/nmmintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/nmmintrin.h	(revision 13)
@@ -0,0 +1,35 @@
+/*===---- nmmintrin.h - SSE4 intrinsics ------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef _NMMINTRIN_H
+#define _NMMINTRIN_H
+
+#ifndef __SSE4_2__
+#error "SSE4.2 instruction set not enabled"
+#else
+
+/* To match expectations of gcc we put the sse4.2 definitions into smmintrin.h,
+   just include it now then.  */
+#include <smmintrin.h>
+#endif /* __SSE4_2__ */
+#endif /* _NMMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/nmmintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/rdseedintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/rdseedintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/rdseedintrin.h	(revision 13)
@@ -0,0 +1,52 @@
+/*===---- rdseedintrin.h - RDSEED intrinsics -------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __X86INTRIN_H
+#error "Never use <rdseedintrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+#ifndef __RDSEEDINTRIN_H
+#define __RDSEEDINTRIN_H
+
+#ifdef __RDSEED__
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_rdseed16_step(unsigned short *__p)
+{
+  return __builtin_ia32_rdseed16_step(__p);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_rdseed32_step(unsigned int *__p)
+{
+  return __builtin_ia32_rdseed32_step(__p);
+}
+
+#ifdef __x86_64__
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_rdseed64_step(unsigned long long *__p)
+{
+  return __builtin_ia32_rdseed64_step(__p);
+}
+#endif
+#endif /* __RDSEED__ */
+#endif /* __RDSEEDINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/rdseedintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/string
===================================================================
--- lab4/.minix-src/include/c++/string	(nonexistent)
+++ lab4/.minix-src/include/c++/string	(revision 13)
@@ -0,0 +1,4269 @@
+// -*- C++ -*-
+//===--------------------------- string -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_STRING
+#define _LIBCPP_STRING
+
+/*
+    string synopsis
+
+namespace std
+{
+
+template <class stateT>
+class fpos
+{
+private:
+    stateT st;
+public:
+    fpos(streamoff = streamoff());
+
+    operator streamoff() const;
+
+    stateT state() const;
+    void state(stateT);
+
+    fpos& operator+=(streamoff);
+    fpos  operator+ (streamoff) const;
+    fpos& operator-=(streamoff);
+    fpos  operator- (streamoff) const;
+};
+
+template <class stateT> streamoff operator-(const fpos<stateT>& x, const fpos<stateT>& y);
+
+template <class stateT> bool operator==(const fpos<stateT>& x, const fpos<stateT>& y);
+template <class stateT> bool operator!=(const fpos<stateT>& x, const fpos<stateT>& y);
+
+template <class charT>
+struct char_traits
+{
+    typedef charT     char_type;
+    typedef ...       int_type;
+    typedef streamoff off_type;
+    typedef streampos pos_type;
+    typedef mbstate_t state_type;
+
+    static void assign(char_type& c1, const char_type& c2) noexcept;
+    static constexpr bool eq(char_type c1, char_type c2) noexcept;
+    static constexpr bool lt(char_type c1, char_type c2) noexcept;
+
+    static int              compare(const char_type* s1, const char_type* s2, size_t n);
+    static size_t           length(const char_type* s);
+    static const char_type* find(const char_type* s, size_t n, const char_type& a);
+    static char_type*       move(char_type* s1, const char_type* s2, size_t n);
+    static char_type*       copy(char_type* s1, const char_type* s2, size_t n);
+    static char_type*       assign(char_type* s, size_t n, char_type a);
+
+    static constexpr int_type  not_eof(int_type c) noexcept;
+    static constexpr char_type to_char_type(int_type c) noexcept;
+    static constexpr int_type  to_int_type(char_type c) noexcept;
+    static constexpr bool      eq_int_type(int_type c1, int_type c2) noexcept;
+    static constexpr int_type  eof() noexcept;
+};
+
+template <> struct char_traits<char>;
+template <> struct char_traits<wchar_t>;
+
+template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+class basic_string
+{
+public:
+// types:
+    typedef traits traits_type;
+    typedef typename traits_type::char_type value_type;
+    typedef Allocator allocator_type;
+    typedef typename allocator_type::size_type size_type;
+    typedef typename allocator_type::difference_type difference_type;
+    typedef typename allocator_type::reference reference;
+    typedef typename allocator_type::const_reference const_reference;
+    typedef typename allocator_type::pointer pointer;
+    typedef typename allocator_type::const_pointer const_pointer;
+    typedef implementation-defined iterator;
+    typedef implementation-defined const_iterator;
+    typedef std::reverse_iterator<iterator> reverse_iterator;
+    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+    static const size_type npos = -1;
+
+    basic_string()
+        noexcept(is_nothrow_default_constructible<allocator_type>::value);
+    explicit basic_string(const allocator_type& a);
+    basic_string(const basic_string& str);
+    basic_string(basic_string&& str)
+        noexcept(is_nothrow_move_constructible<allocator_type>::value);
+    basic_string(const basic_string& str, size_type pos, size_type n = npos,
+                 const allocator_type& a = allocator_type());
+    basic_string(const value_type* s, const allocator_type& a = allocator_type());
+    basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type());
+    basic_string(size_type n, value_type c, const allocator_type& a = allocator_type());
+    template<class InputIterator>
+        basic_string(InputIterator begin, InputIterator end,
+                     const allocator_type& a = allocator_type());
+    basic_string(initializer_list<value_type>, const Allocator& = Allocator());
+    basic_string(const basic_string&, const Allocator&);
+    basic_string(basic_string&&, const Allocator&);
+
+    ~basic_string();
+
+    basic_string& operator=(const basic_string& str);
+    basic_string& operator=(basic_string&& str)
+        noexcept(
+             allocator_type::propagate_on_container_move_assignment::value ||
+             allocator_type::is_always_equal::value ); // C++17
+    basic_string& operator=(const value_type* s);
+    basic_string& operator=(value_type c);
+    basic_string& operator=(initializer_list<value_type>);
+
+    iterator       begin() noexcept;
+    const_iterator begin() const noexcept;
+    iterator       end() noexcept;
+    const_iterator end() const noexcept;
+
+    reverse_iterator       rbegin() noexcept;
+    const_reverse_iterator rbegin() const noexcept;
+    reverse_iterator       rend() noexcept;
+    const_reverse_iterator rend() const noexcept;
+
+    const_iterator         cbegin() const noexcept;
+    const_iterator         cend() const noexcept;
+    const_reverse_iterator crbegin() const noexcept;
+    const_reverse_iterator crend() const noexcept;
+
+    size_type size() const noexcept;
+    size_type length() const noexcept;
+    size_type max_size() const noexcept;
+    size_type capacity() const noexcept;
+
+    void resize(size_type n, value_type c);
+    void resize(size_type n);
+
+    void reserve(size_type res_arg = 0);
+    void shrink_to_fit();
+    void clear() noexcept;
+    bool empty() const noexcept;
+
+    const_reference operator[](size_type pos) const;
+    reference       operator[](size_type pos);
+
+    const_reference at(size_type n) const;
+    reference       at(size_type n);
+
+    basic_string& operator+=(const basic_string& str);
+    basic_string& operator+=(const value_type* s);
+    basic_string& operator+=(value_type c);
+    basic_string& operator+=(initializer_list<value_type>);
+
+    basic_string& append(const basic_string& str);
+    basic_string& append(const basic_string& str, size_type pos, size_type n=npos); //C++14
+    basic_string& append(const value_type* s, size_type n);
+    basic_string& append(const value_type* s);
+    basic_string& append(size_type n, value_type c);
+    template<class InputIterator>
+        basic_string& append(InputIterator first, InputIterator last);
+    basic_string& append(initializer_list<value_type>);
+
+    void push_back(value_type c);
+    void pop_back();
+    reference       front();
+    const_reference front() const;
+    reference       back();
+    const_reference back() const;
+
+    basic_string& assign(const basic_string& str);
+    basic_string& assign(basic_string&& str);
+    basic_string& assign(const basic_string& str, size_type pos, size_type n=npos); // C++14
+    basic_string& assign(const value_type* s, size_type n);
+    basic_string& assign(const value_type* s);
+    basic_string& assign(size_type n, value_type c);
+    template<class InputIterator>
+        basic_string& assign(InputIterator first, InputIterator last);
+    basic_string& assign(initializer_list<value_type>);
+
+    basic_string& insert(size_type pos1, const basic_string& str);
+    basic_string& insert(size_type pos1, const basic_string& str,
+                         size_type pos2, size_type n);
+    basic_string& insert(size_type pos, const value_type* s, size_type n=npos); //C++14
+    basic_string& insert(size_type pos, const value_type* s);
+    basic_string& insert(size_type pos, size_type n, value_type c);
+    iterator      insert(const_iterator p, value_type c);
+    iterator      insert(const_iterator p, size_type n, value_type c);
+    template<class InputIterator>
+        iterator insert(const_iterator p, InputIterator first, InputIterator last);
+    iterator      insert(const_iterator p, initializer_list<value_type>);
+
+    basic_string& erase(size_type pos = 0, size_type n = npos);
+    iterator      erase(const_iterator position);
+    iterator      erase(const_iterator first, const_iterator last);
+
+    basic_string& replace(size_type pos1, size_type n1, const basic_string& str);
+    basic_string& replace(size_type pos1, size_type n1, const basic_string& str,
+                          size_type pos2, size_type n2=npos); // C++14
+    basic_string& replace(size_type pos, size_type n1, const value_type* s, size_type n2);
+    basic_string& replace(size_type pos, size_type n1, const value_type* s);
+    basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
+    basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
+    basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n);
+    basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s);
+    basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
+    template<class InputIterator>
+        basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
+    basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);
+
+    size_type copy(value_type* s, size_type n, size_type pos = 0) const;
+    basic_string substr(size_type pos = 0, size_type n = npos) const;
+
+    void swap(basic_string& str)
+        noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
+                 allocator_traits<allocator_type>::is_always_equal::value);  // C++17
+
+    const value_type* c_str() const noexcept;
+    const value_type* data() const noexcept;
+
+    allocator_type get_allocator() const noexcept;
+
+    size_type find(const basic_string& str, size_type pos = 0) const noexcept;
+    size_type find(const value_type* s, size_type pos, size_type n) const noexcept;
+    size_type find(const value_type* s, size_type pos = 0) const noexcept;
+    size_type find(value_type c, size_type pos = 0) const noexcept;
+
+    size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
+    size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept;
+    size_type rfind(const value_type* s, size_type pos = npos) const noexcept;
+    size_type rfind(value_type c, size_type pos = npos) const noexcept;
+
+    size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
+    size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept;
+    size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept;
+    size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
+
+    size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
+    size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept;
+    size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept;
+    size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
+
+    size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept;
+    size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
+    size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept;
+    size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept;
+
+    size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
+    size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
+    size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept;
+    size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept;
+
+    int compare(const basic_string& str) const noexcept;
+    int compare(size_type pos1, size_type n1, const basic_string& str) const;
+    int compare(size_type pos1, size_type n1, const basic_string& str,
+                size_type pos2, size_type n2=npos) const; // C++14
+    int compare(const value_type* s) const noexcept;
+    int compare(size_type pos1, size_type n1, const value_type* s) const;
+    int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const;
+
+    bool __invariants() const;
+};
+
+template<class charT, class traits, class Allocator>
+basic_string<charT, traits, Allocator>
+operator+(const basic_string<charT, traits, Allocator>& lhs,
+          const basic_string<charT, traits, Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+basic_string<charT, traits, Allocator>
+operator+(const charT* lhs , const basic_string<charT,traits,Allocator>&rhs);
+
+template<class charT, class traits, class Allocator>
+basic_string<charT, traits, Allocator>
+operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+basic_string<charT, traits, Allocator>
+operator+(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+basic_string<charT, traits, Allocator>
+operator+(const basic_string<charT, traits, Allocator>& lhs, charT rhs);
+
+template<class charT, class traits, class Allocator>
+bool operator==(const basic_string<charT, traits, Allocator>& lhs,
+                const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator==(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
+                const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator!=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator!=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator< (const basic_string<charT, traits, Allocator>& lhs,
+                const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator< (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator< (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator> (const basic_string<charT, traits, Allocator>& lhs,
+                const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator> (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator> (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator<=(const basic_string<charT, traits, Allocator>& lhs,
+                const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator<=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator<=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator>=(const basic_string<charT, traits, Allocator>& lhs,
+                const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator>=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+bool operator>=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+
+template<class charT, class traits, class Allocator>
+void swap(basic_string<charT, traits, Allocator>& lhs,
+          basic_string<charT, traits, Allocator>& rhs)
+            noexcept(noexcept(lhs.swap(rhs)));
+
+template<class charT, class traits, class Allocator>
+basic_istream<charT, traits>&
+operator>>(basic_istream<charT, traits>& is, basic_string<charT, traits, Allocator>& str);
+
+template<class charT, class traits, class Allocator>
+basic_ostream<charT, traits>&
+operator<<(basic_ostream<charT, traits>& os, const basic_string<charT, traits, Allocator>& str);
+
+template<class charT, class traits, class Allocator>
+basic_istream<charT, traits>&
+getline(basic_istream<charT, traits>& is, basic_string<charT, traits, Allocator>& str,
+        charT delim);
+
+template<class charT, class traits, class Allocator>
+basic_istream<charT, traits>&
+getline(basic_istream<charT, traits>& is, basic_string<charT, traits, Allocator>& str);
+
+typedef basic_string<char>    string;
+typedef basic_string<wchar_t> wstring;
+typedef basic_string<char16_t> u16string;
+typedef basic_string<char32_t> u32string;
+
+int                stoi  (const string& str, size_t* idx = 0, int base = 10);
+long               stol  (const string& str, size_t* idx = 0, int base = 10);
+unsigned long      stoul (const string& str, size_t* idx = 0, int base = 10);
+long long          stoll (const string& str, size_t* idx = 0, int base = 10);
+unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10);
+
+float       stof (const string& str, size_t* idx = 0);
+double      stod (const string& str, size_t* idx = 0);
+long double stold(const string& str, size_t* idx = 0);
+
+string to_string(int val);
+string to_string(unsigned val);
+string to_string(long val);
+string to_string(unsigned long val);
+string to_string(long long val);
+string to_string(unsigned long long val);
+string to_string(float val);
+string to_string(double val);
+string to_string(long double val);
+
+int                stoi  (const wstring& str, size_t* idx = 0, int base = 10);
+long               stol  (const wstring& str, size_t* idx = 0, int base = 10);
+unsigned long      stoul (const wstring& str, size_t* idx = 0, int base = 10);
+long long          stoll (const wstring& str, size_t* idx = 0, int base = 10);
+unsigned long long stoull(const wstring& str, size_t* idx = 0, int base = 10);
+
+float       stof (const wstring& str, size_t* idx = 0);
+double      stod (const wstring& str, size_t* idx = 0);
+long double stold(const wstring& str, size_t* idx = 0);
+
+wstring to_wstring(int val);
+wstring to_wstring(unsigned val);
+wstring to_wstring(long val);
+wstring to_wstring(unsigned long val);
+wstring to_wstring(long long val);
+wstring to_wstring(unsigned long long val);
+wstring to_wstring(float val);
+wstring to_wstring(double val);
+wstring to_wstring(long double val);
+
+template <> struct hash<string>;
+template <> struct hash<u16string>;
+template <> struct hash<u32string>;
+template <> struct hash<wstring>;
+
+basic_string<char>     operator "" s( const char *str,     size_t len ); // C++14
+basic_string<wchar_t>  operator "" s( const wchar_t *str,  size_t len ); // C++14
+basic_string<char16_t> operator "" s( const char16_t *str, size_t len ); // C++14
+basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++14
+
+}  // std
+
+*/
+
+#include <__config>
+#include <iosfwd>
+#include <cstring>
+#include <cstdio>  // For EOF.
+#include <cwchar>
+#include <algorithm>
+#include <iterator>
+#include <utility>
+#include <memory>
+#include <stdexcept>
+#include <type_traits>
+#include <initializer_list>
+#include <__functional_base>
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+#include <cstdint>
+#endif
+#if defined(_LIBCPP_NO_EXCEPTIONS)
+#include <cassert>
+#endif
+
+#include <__undef_min_max>
+
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// fpos
+
+template <class _StateT>
+class _LIBCPP_TYPE_VIS_ONLY fpos
+{
+private:
+    _StateT __st_;
+    streamoff __off_;
+public:
+    _LIBCPP_INLINE_VISIBILITY fpos(streamoff __off = streamoff()) : __st_(), __off_(__off) {}
+
+    _LIBCPP_INLINE_VISIBILITY operator streamoff() const {return __off_;}
+
+    _LIBCPP_INLINE_VISIBILITY _StateT state() const {return __st_;}
+    _LIBCPP_INLINE_VISIBILITY void state(_StateT __st) {__st_ = __st;}
+
+    _LIBCPP_INLINE_VISIBILITY fpos& operator+=(streamoff __off) {__off_ += __off; return *this;}
+    _LIBCPP_INLINE_VISIBILITY fpos  operator+ (streamoff __off) const {fpos __t(*this); __t += __off; return __t;}
+    _LIBCPP_INLINE_VISIBILITY fpos& operator-=(streamoff __off) {__off_ -= __off; return *this;}
+    _LIBCPP_INLINE_VISIBILITY fpos  operator- (streamoff __off) const {fpos __t(*this); __t -= __off; return __t;}
+};
+
+template <class _StateT>
+inline _LIBCPP_INLINE_VISIBILITY
+streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
+    {return streamoff(__x) - streamoff(__y);}
+
+template <class _StateT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
+    {return streamoff(__x) == streamoff(__y);}
+
+template <class _StateT>
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
+    {return streamoff(__x) != streamoff(__y);}
+
+// char_traits
+
+template <class _CharT>
+struct _LIBCPP_TYPE_VIS_ONLY char_traits
+{
+    typedef _CharT    char_type;
+    typedef int       int_type;
+    typedef streamoff off_type;
+    typedef streampos pos_type;
+    typedef mbstate_t state_type;
+
+    static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+        {__c1 = __c2;}
+    static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+        {return __c1 == __c2;}
+    static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+        {return __c1 < __c2;}
+
+    static int              compare(const char_type* __s1, const char_type* __s2, size_t __n);
+    static size_t           length(const char_type* __s);
+    static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
+    static char_type*       move(char_type* __s1, const char_type* __s2, size_t __n);
+    static char_type*       copy(char_type* __s1, const char_type* __s2, size_t __n);
+    static char_type*       assign(char_type* __s, size_t __n, char_type __a);
+
+    static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
+        {return eq_int_type(__c, eof()) ? ~eof() : __c;}
+    static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+        {return char_type(__c);}
+    static inline _LIBCPP_CONSTEXPR int_type  to_int_type(char_type __c) _NOEXCEPT
+        {return int_type(__c);}
+    static inline _LIBCPP_CONSTEXPR bool      eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+        {return __c1 == __c2;}
+    static inline _LIBCPP_CONSTEXPR int_type  eof() _NOEXCEPT
+        {return int_type(EOF);}
+};
+
+template <class _CharT>
+int
+char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
+{
+    for (; __n; --__n, ++__s1, ++__s2)
+    {
+        if (lt(*__s1, *__s2))
+            return -1;
+        if (lt(*__s2, *__s1))
+            return 1;
+    }
+    return 0;
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+char_traits<_CharT>::length(const char_type* __s)
+{
+    size_t __len = 0;
+    for (; !eq(*__s, char_type(0)); ++__s)
+        ++__len;
+    return __len;
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+const _CharT*
+char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a)
+{
+    for (; __n; --__n)
+    {
+        if (eq(*__s, __a))
+            return __s;
+        ++__s;
+    }
+    return 0;
+}
+
+template <class _CharT>
+_CharT*
+char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
+{
+    char_type* __r = __s1;
+    if (__s1 < __s2)
+    {
+        for (; __n; --__n, ++__s1, ++__s2)
+            assign(*__s1, *__s2);
+    }
+    else if (__s2 < __s1)
+    {
+        __s1 += __n;
+        __s2 += __n;
+        for (; __n; --__n)
+            assign(*--__s1, *--__s2);
+    }
+    return __r;
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+_CharT*
+char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
+{
+    _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
+    char_type* __r = __s1;
+    for (; __n; --__n, ++__s1, ++__s2)
+        assign(*__s1, *__s2);
+    return __r;
+}
+
+template <class _CharT>
+inline _LIBCPP_INLINE_VISIBILITY
+_CharT*
+char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
+{
+    char_type* __r = __s;
+    for (; __n; --__n, ++__s)
+        assign(*__s, __a);
+    return __r;
+}
+
+// char_traits<char>
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY char_traits<char>
+{
+    typedef char      char_type;
+    typedef int       int_type;
+    typedef streamoff off_type;
+    typedef streampos pos_type;
+    typedef mbstate_t state_type;
+
+    static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+        {__c1 = __c2;}
+    static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+            {return __c1 == __c2;}
+    static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+        {return (unsigned char)__c1 < (unsigned char)__c2;}
+
+    static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
+        {return __n == 0 ? 0 : memcmp(__s1, __s2, __n);}
+    static inline size_t length(const char_type* __s) {return strlen(__s);}
+    static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
+        {return __n == 0 ? NULL : (const char_type*) memchr(__s, to_int_type(__a), __n);}
+    static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
+        {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);}
+    static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
+        {
+            _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
+            return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
+        }
+    static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
+        {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);}
+
+    static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
+        {return eq_int_type(__c, eof()) ? ~eof() : __c;}
+    static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+        {return char_type(__c);}
+    static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
+        {return int_type((unsigned char)__c);}
+    static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+        {return __c1 == __c2;}
+    static inline _LIBCPP_CONSTEXPR int_type  eof() _NOEXCEPT
+        {return int_type(EOF);}
+};
+
+// char_traits<wchar_t>
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY char_traits<wchar_t>
+{
+    typedef wchar_t   char_type;
+    typedef wint_t    int_type;
+    typedef streamoff off_type;
+    typedef streampos pos_type;
+    typedef mbstate_t state_type;
+
+    static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+        {__c1 = __c2;}
+    static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+        {return __c1 == __c2;}
+    static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+        {return __c1 < __c2;}
+
+    static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
+        {return __n == 0 ? 0 : wmemcmp(__s1, __s2, __n);}
+    static inline size_t length(const char_type* __s)
+        {return wcslen(__s);}
+    static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
+        {return __n == 0 ? NULL : (const char_type*)wmemchr(__s, __a, __n);}
+    static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
+        {return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);}
+    static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
+        {
+            _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
+            return __n == 0 ? __s1 : (char_type*)wmemcpy(__s1, __s2, __n);
+        }
+    static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
+        {return __n == 0 ? __s : (char_type*)wmemset(__s, __a, __n);}
+
+    static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
+        {return eq_int_type(__c, eof()) ? ~eof() : __c;}
+    static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+        {return char_type(__c);}
+    static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
+        {return int_type(__c);}
+    static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+        {return __c1 == __c2;}
+    static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
+        {return int_type(WEOF);}
+};
+
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
+{
+    typedef char16_t       char_type;
+    typedef uint_least16_t int_type;
+    typedef streamoff      off_type;
+    typedef u16streampos   pos_type;
+    typedef mbstate_t      state_type;
+
+    static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+        {__c1 = __c2;}
+    static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+        {return __c1 == __c2;}
+    static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+        {return __c1 < __c2;}
+
+    static int              compare(const char_type* __s1, const char_type* __s2, size_t __n);
+    static size_t           length(const char_type* __s);
+    static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
+    static char_type*       move(char_type* __s1, const char_type* __s2, size_t __n);
+    static char_type*       copy(char_type* __s1, const char_type* __s2, size_t __n);
+    static char_type*       assign(char_type* __s, size_t __n, char_type __a);
+
+    static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
+        {return eq_int_type(__c, eof()) ? ~eof() : __c;}
+    static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+        {return char_type(__c);}
+    static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
+        {return int_type(__c);}
+    static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+        {return __c1 == __c2;}
+    static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
+        {return int_type(0xFFFF);}
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+int
+char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
+{
+    for (; __n; --__n, ++__s1, ++__s2)
+    {
+        if (lt(*__s1, *__s2))
+            return -1;
+        if (lt(*__s2, *__s1))
+            return 1;
+    }
+    return 0;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+char_traits<char16_t>::length(const char_type* __s)
+{
+    size_t __len = 0;
+    for (; !eq(*__s, char_type(0)); ++__s)
+        ++__len;
+    return __len;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+const char16_t*
+char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a)
+{
+    for (; __n; --__n)
+    {
+        if (eq(*__s, __a))
+            return __s;
+        ++__s;
+    }
+    return 0;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+char16_t*
+char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
+{
+    char_type* __r = __s1;
+    if (__s1 < __s2)
+    {
+        for (; __n; --__n, ++__s1, ++__s2)
+            assign(*__s1, *__s2);
+    }
+    else if (__s2 < __s1)
+    {
+        __s1 += __n;
+        __s2 += __n;
+        for (; __n; --__n)
+            assign(*--__s1, *--__s2);
+    }
+    return __r;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+char16_t*
+char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
+{
+    _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
+    char_type* __r = __s1;
+    for (; __n; --__n, ++__s1, ++__s2)
+        assign(*__s1, *__s2);
+    return __r;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+char16_t*
+char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a)
+{
+    char_type* __r = __s;
+    for (; __n; --__n, ++__s)
+        assign(*__s, __a);
+    return __r;
+}
+
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
+{
+    typedef char32_t       char_type;
+    typedef uint_least32_t int_type;
+    typedef streamoff      off_type;
+    typedef u32streampos   pos_type;
+    typedef mbstate_t      state_type;
+
+    static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+        {__c1 = __c2;}
+    static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+        {return __c1 == __c2;}
+    static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+        {return __c1 < __c2;}
+
+    static int              compare(const char_type* __s1, const char_type* __s2, size_t __n);
+    static size_t           length(const char_type* __s);
+    static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
+    static char_type*       move(char_type* __s1, const char_type* __s2, size_t __n);
+    static char_type*       copy(char_type* __s1, const char_type* __s2, size_t __n);
+    static char_type*       assign(char_type* __s, size_t __n, char_type __a);
+
+    static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
+        {return eq_int_type(__c, eof()) ? ~eof() : __c;}
+    static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+        {return char_type(__c);}
+    static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
+        {return int_type(__c);}
+    static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+        {return __c1 == __c2;}
+    static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
+        {return int_type(0xFFFFFFFF);}
+};
+
+inline _LIBCPP_INLINE_VISIBILITY
+int
+char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
+{
+    for (; __n; --__n, ++__s1, ++__s2)
+    {
+        if (lt(*__s1, *__s2))
+            return -1;
+        if (lt(*__s2, *__s1))
+            return 1;
+    }
+    return 0;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+char_traits<char32_t>::length(const char_type* __s)
+{
+    size_t __len = 0;
+    for (; !eq(*__s, char_type(0)); ++__s)
+        ++__len;
+    return __len;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+const char32_t*
+char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a)
+{
+    for (; __n; --__n)
+    {
+        if (eq(*__s, __a))
+            return __s;
+        ++__s;
+    }
+    return 0;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+char32_t*
+char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
+{
+    char_type* __r = __s1;
+    if (__s1 < __s2)
+    {
+        for (; __n; --__n, ++__s1, ++__s2)
+            assign(*__s1, *__s2);
+    }
+    else if (__s2 < __s1)
+    {
+        __s1 += __n;
+        __s2 += __n;
+        for (; __n; --__n)
+            assign(*--__s1, *--__s2);
+    }
+    return __r;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+char32_t*
+char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
+{
+    _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
+    char_type* __r = __s1;
+    for (; __n; --__n, ++__s1, ++__s2)
+        assign(*__s1, *__s2);
+    return __r;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+char32_t*
+char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a)
+{
+    char_type* __r = __s;
+    for (; __n; --__n, ++__s)
+        assign(*__s, __a);
+    return __r;
+}
+
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+
+// helper fns for basic_string
+
+// __str_find
+template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+__str_find(const _CharT *__p, _SizeT __sz, 
+             _CharT __c, _SizeT __pos) _NOEXCEPT
+{
+    if (__pos >= __sz)
+        return __npos;
+    const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
+    if (__r == 0)
+        return __npos;
+    return static_cast<_SizeT>(__r - __p);
+}
+
+template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+__str_find(const _CharT *__p, _SizeT __sz, 
+       const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
+{
+    if (__pos > __sz || __sz - __pos < __n)
+        return __npos;
+    if (__n == 0)
+        return __pos;
+    const _CharT* __r = 
+        _VSTD::__search(__p + __pos, __p + __sz,
+                        __s, __s + __n, _Traits::eq,
+                        random_access_iterator_tag(), random_access_iterator_tag());
+    if (__r == __p + __sz)
+        return __npos;
+    return static_cast<_SizeT>(__r - __p);
+}
+
+
+// __str_rfind
+
+template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+__str_rfind(const _CharT *__p, _SizeT __sz, 
+              _CharT __c, _SizeT __pos) _NOEXCEPT
+{
+    if (__sz < 1)
+        return __npos;
+    if (__pos < __sz)
+        ++__pos;
+    else
+        __pos = __sz;
+    for (const _CharT* __ps = __p + __pos; __ps != __p;)
+    {
+        if (_Traits::eq(*--__ps, __c))
+            return static_cast<_SizeT>(__ps - __p);
+    }
+    return __npos;
+}
+
+template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+__str_rfind(const _CharT *__p, _SizeT __sz, 
+        const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
+{
+    __pos = _VSTD::min(__pos, __sz);
+    if (__n < __sz - __pos)
+        __pos += __n;
+    else
+        __pos = __sz;
+    const _CharT* __r = _VSTD::__find_end(
+                  __p, __p + __pos, __s, __s + __n, _Traits::eq, 
+                        random_access_iterator_tag(), random_access_iterator_tag());
+    if (__n > 0 && __r == __p + __pos)
+        return __npos;
+    return static_cast<_SizeT>(__r - __p);
+}
+
+// __str_find_first_of
+template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+__str_find_first_of(const _CharT *__p, _SizeT __sz,
+                const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
+{
+    if (__pos >= __sz || __n == 0)
+        return __npos;
+    const _CharT* __r = _VSTD::__find_first_of_ce
+        (__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq );
+    if (__r == __p + __sz)
+        return __npos;
+    return static_cast<_SizeT>(__r - __p);
+}
+
+
+// __str_find_last_of
+template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 
+__str_find_last_of(const _CharT *__p, _SizeT __sz,
+               const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
+    {
+    if (__n != 0)
+    {
+        if (__pos < __sz)
+            ++__pos;
+        else
+            __pos = __sz;
+        for (const _CharT* __ps = __p + __pos; __ps != __p;)
+        {
+            const _CharT* __r = _Traits::find(__s, __n, *--__ps);
+            if (__r)
+                return static_cast<_SizeT>(__ps - __p);
+        }
+    }
+    return __npos;
+}
+
+
+// __str_find_first_not_of
+template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
+                    const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
+{
+    if (__pos < __sz)
+    {
+        const _CharT* __pe = __p + __sz;
+        for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
+            if (_Traits::find(__s, __n, *__ps) == 0)
+                return static_cast<_SizeT>(__ps - __p);
+    }
+    return __npos;
+}
+
+
+template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
+                          _CharT __c, _SizeT __pos) _NOEXCEPT
+{
+    if (__pos < __sz)
+    {
+        const _CharT* __pe = __p + __sz;
+        for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
+            if (!_Traits::eq(*__ps, __c))
+                return static_cast<_SizeT>(__ps - __p);
+    }
+    return __npos;
+}
+
+
+// __str_find_last_not_of
+template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
+                   const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
+{
+    if (__pos < __sz)
+        ++__pos;
+    else
+        __pos = __sz;
+    for (const _CharT* __ps = __p + __pos; __ps != __p;)
+        if (_Traits::find(__s, __n, *--__ps) == 0)
+            return static_cast<_SizeT>(__ps - __p);
+    return __npos;
+}
+
+
+template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
+                         _CharT __c, _SizeT __pos) _NOEXCEPT
+{
+    if (__pos < __sz)
+        ++__pos;
+    else
+        __pos = __sz;
+    for (const _CharT* __ps = __p + __pos; __ps != __p;)
+        if (!_Traits::eq(*--__ps, __c))
+            return static_cast<_SizeT>(__ps - __p);
+    return __npos;
+}
+
+template<class _Ptr>
+size_t _LIBCPP_INLINE_VISIBILITY __do_string_hash(_Ptr __p, _Ptr __e)
+{
+    typedef typename iterator_traits<_Ptr>::value_type value_type;
+    return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type));
+}
+
+// basic_string
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __x,
+          const basic_string<_CharT, _Traits, _Allocator>& __y);
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y);
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
+
+template <bool>
+class _LIBCPP_TYPE_VIS_ONLY __basic_string_common
+{
+protected:
+    void __throw_length_error() const;
+    void __throw_out_of_range() const;
+};
+
+template <bool __b>
+void
+__basic_string_common<__b>::__throw_length_error() const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    throw length_error("basic_string");
+#else
+    assert(!"basic_string length_error");
+#endif
+}
+
+template <bool __b>
+void
+__basic_string_common<__b>::__throw_out_of_range() const
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    throw out_of_range("basic_string");
+#else
+    assert(!"basic_string out_of_range");
+#endif
+}
+
+#ifdef _LIBCPP_MSVC
+#pragma warning( push )
+#pragma warning( disable: 4231 )
+#endif // _LIBCPP_MSVC
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS __basic_string_common<true>)
+#ifdef _LIBCPP_MSVC
+#pragma warning( pop )
+#endif // _LIBCPP_MSVC
+
+#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
+
+template <class _CharT, size_t = sizeof(_CharT)>
+struct __padding
+{
+    unsigned char __xx[sizeof(_CharT)-1];
+};
+
+template <class _CharT>
+struct __padding<_CharT, 1>
+{
+};
+
+#endif  // _LIBCPP_ALTERNATE_STRING_LAYOUT
+
+template<class _CharT, class _Traits, class _Allocator>
+class _LIBCPP_TYPE_VIS_ONLY basic_string
+    : private __basic_string_common<true>
+{
+public:
+    typedef basic_string                                 __self;
+    typedef _Traits                                      traits_type;
+    typedef typename traits_type::char_type              value_type;
+    typedef _Allocator                                   allocator_type;
+    typedef allocator_traits<allocator_type>             __alloc_traits;
+    typedef typename __alloc_traits::size_type           size_type;
+    typedef typename __alloc_traits::difference_type     difference_type;
+    typedef value_type&                                  reference;
+    typedef const value_type&                            const_reference;
+    typedef typename __alloc_traits::pointer             pointer;
+    typedef typename __alloc_traits::const_pointer       const_pointer;
+
+    static_assert(is_pod<value_type>::value, "Character type of basic_string must be a POD");
+    static_assert((is_same<_CharT, value_type>::value),
+                  "traits_type::char_type must be the same type as CharT");
+    static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+                  "Allocator::value_type must be same type as value_type");
+#if defined(_LIBCPP_RAW_ITERATORS)
+    typedef pointer                                      iterator;
+    typedef const_pointer                                const_iterator;
+#else  // defined(_LIBCPP_RAW_ITERATORS)
+    typedef __wrap_iter<pointer>                         iterator;
+    typedef __wrap_iter<const_pointer>                   const_iterator;
+#endif  // defined(_LIBCPP_RAW_ITERATORS)
+    typedef _VSTD::reverse_iterator<iterator>             reverse_iterator;
+    typedef _VSTD::reverse_iterator<const_iterator>       const_reverse_iterator;
+
+private:
+
+#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
+
+    struct __long
+    {
+        pointer   __data_;
+        size_type __size_;
+        size_type __cap_;
+    };
+
+#if _LIBCPP_BIG_ENDIAN
+    enum {__short_mask = 0x01};
+    enum {__long_mask  = 0x1ul};
+#else  // _LIBCPP_BIG_ENDIAN
+    enum {__short_mask = 0x80};
+    enum {__long_mask  = ~(size_type(~0) >> 1)};
+#endif  // _LIBCPP_BIG_ENDIAN
+
+    enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
+                      (sizeof(__long) - 1)/sizeof(value_type) : 2};
+
+    struct __short
+    {
+        value_type __data_[__min_cap];
+        struct
+            : __padding<value_type>
+        {
+            unsigned char __size_;
+        };
+    };
+
+#else
+
+    struct __long
+    {
+        size_type __cap_;
+        size_type __size_;
+        pointer   __data_;
+    };
+
+#if _LIBCPP_BIG_ENDIAN
+    enum {__short_mask = 0x80};
+    enum {__long_mask  = ~(size_type(~0) >> 1)};
+#else  // _LIBCPP_BIG_ENDIAN
+    enum {__short_mask = 0x01};
+    enum {__long_mask  = 0x1ul};
+#endif  // _LIBCPP_BIG_ENDIAN
+
+    enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
+                      (sizeof(__long) - 1)/sizeof(value_type) : 2};
+
+    struct __short
+    {
+        union
+        {
+            unsigned char __size_;
+            value_type __lx;
+        };
+        value_type __data_[__min_cap];
+    };
+
+#endif  // _LIBCPP_ALTERNATE_STRING_LAYOUT
+
+    union __ulx{__long __lx; __short __lxx;};
+
+    enum {__n_words = sizeof(__ulx) / sizeof(size_type)};
+
+    struct __raw
+    {
+        size_type __words[__n_words];
+    };
+
+    struct __rep
+    {
+        union
+        {
+            __long  __l;
+            __short __s;
+            __raw   __r;
+        };
+    };
+
+    __compressed_pair<__rep, allocator_type> __r_;
+
+public:
+    static const size_type npos = -1;
+
+    _LIBCPP_INLINE_VISIBILITY basic_string()
+        _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
+
+    _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a)
+#if _LIBCPP_STD_VER <= 14
+        _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
+#else
+        _NOEXCEPT;
+#endif
+
+    basic_string(const basic_string& __str);
+    basic_string(const basic_string& __str, const allocator_type& __a);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string(basic_string&& __str)
+#if _LIBCPP_STD_VER <= 14
+        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+#else
+        _NOEXCEPT;
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string(basic_string&& __str, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s);
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string(const value_type* __s, const allocator_type& __a);
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string(const value_type* __s, size_type __n);
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string(const value_type* __s, size_type __n, const allocator_type& __a);
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string(size_type __n, value_type __c);
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string(size_type __n, value_type __c, const allocator_type& __a);
+    basic_string(const basic_string& __str, size_type __pos, size_type __n = npos,
+                 const allocator_type& __a = allocator_type());
+    template<class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        basic_string(_InputIterator __first, _InputIterator __last);
+    template<class _InputIterator>
+        _LIBCPP_INLINE_VISIBILITY
+        basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string(initializer_list<value_type> __il);
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string(initializer_list<value_type> __il, const allocator_type& __a);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    ~basic_string();
+
+    basic_string& operator=(const basic_string& __str);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& operator=(basic_string&& __str)
+        _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
+#endif
+    _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
+    basic_string& operator=(value_type __c);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    iterator begin() _NOEXCEPT
+        {return iterator(this, __get_pointer());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT
+        {return const_iterator(this, __get_pointer());}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator end() _NOEXCEPT
+        {return iterator(this, __get_pointer() + size());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end() const _NOEXCEPT
+        {return const_iterator(this, __get_pointer() + size());}
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    iterator begin() _NOEXCEPT
+        {return iterator(__get_pointer());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator begin() const _NOEXCEPT
+        {return const_iterator(__get_pointer());}
+    _LIBCPP_INLINE_VISIBILITY
+    iterator end() _NOEXCEPT
+        {return iterator(__get_pointer() + size());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator end() const _NOEXCEPT
+        {return const_iterator(__get_pointer() + size());}
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_INLINE_VISIBILITY
+    reverse_iterator rbegin() _NOEXCEPT
+        {return reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rbegin() const _NOEXCEPT
+        {return const_reverse_iterator(end());}
+    _LIBCPP_INLINE_VISIBILITY
+    reverse_iterator rend() _NOEXCEPT
+        {return reverse_iterator(begin());}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator rend() const _NOEXCEPT
+        {return const_reverse_iterator(begin());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cbegin() const _NOEXCEPT
+        {return begin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_iterator cend() const _NOEXCEPT
+        {return end();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crbegin() const _NOEXCEPT
+        {return rbegin();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_reverse_iterator crend() const _NOEXCEPT
+        {return rend();}
+
+    _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT
+        {return __is_long() ? __get_long_size() : __get_short_size();}
+    _LIBCPP_INLINE_VISIBILITY size_type length() const _NOEXCEPT {return size();}
+    _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT
+        {return (__is_long() ? __get_long_cap() : __min_cap) - 1;}
+
+    void resize(size_type __n, value_type __c);
+    _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
+
+    void reserve(size_type res_arg = 0);
+    _LIBCPP_INLINE_VISIBILITY
+    void shrink_to_fit() _NOEXCEPT {reserve();}
+    _LIBCPP_INLINE_VISIBILITY
+    void clear() _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return size() == 0;}
+
+    _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __pos) const;
+    _LIBCPP_INLINE_VISIBILITY reference       operator[](size_type __pos);
+
+    const_reference at(size_type __n) const;
+    reference       at(size_type __n);
+
+    _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const basic_string& __str) {return append(__str);}
+    _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s)         {return append(__s);}
+    _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c)            {push_back(__c); return *this;}
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& append(const basic_string& __str);
+    basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
+    basic_string& append(const value_type* __s, size_type __n);
+    basic_string& append(const value_type* __s);
+    basic_string& append(size_type __n, value_type __c);
+    template<class _InputIterator>
+        typename enable_if
+        <
+             __is_input_iterator  <_InputIterator>::value &&
+            !__is_forward_iterator<_InputIterator>::value,
+            basic_string&
+        >::type
+        append(_InputIterator __first, _InputIterator __last);
+    template<class _ForwardIterator>
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value,
+            basic_string&
+        >::type
+        append(_ForwardIterator __first, _ForwardIterator __last);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    void push_back(value_type __c);
+    _LIBCPP_INLINE_VISIBILITY
+    void pop_back();
+    _LIBCPP_INLINE_VISIBILITY reference       front();
+    _LIBCPP_INLINE_VISIBILITY const_reference front() const;
+    _LIBCPP_INLINE_VISIBILITY reference       back();
+    _LIBCPP_INLINE_VISIBILITY const_reference back() const;
+
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& assign(const basic_string& __str);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& assign(basic_string&& str)
+        {*this = _VSTD::move(str); return *this;}
+#endif
+    basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
+    basic_string& assign(const value_type* __s, size_type __n);
+    basic_string& assign(const value_type* __s);
+    basic_string& assign(size_type __n, value_type __c);
+    template<class _InputIterator>
+        typename enable_if
+        <
+             __is_input_iterator  <_InputIterator>::value &&
+            !__is_forward_iterator<_InputIterator>::value,
+            basic_string&
+        >::type
+        assign(_InputIterator __first, _InputIterator __last);
+    template<class _ForwardIterator>
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value,
+            basic_string&
+        >::type
+        assign(_ForwardIterator __first, _ForwardIterator __last);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& insert(size_type __pos1, const basic_string& __str);
+    basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n=npos);
+    basic_string& insert(size_type __pos, const value_type* __s, size_type __n);
+    basic_string& insert(size_type __pos, const value_type* __s);
+    basic_string& insert(size_type __pos, size_type __n, value_type __c);
+    iterator      insert(const_iterator __pos, value_type __c);
+    _LIBCPP_INLINE_VISIBILITY
+    iterator      insert(const_iterator __pos, size_type __n, value_type __c);
+    template<class _InputIterator>
+        typename enable_if
+        <
+             __is_input_iterator  <_InputIterator>::value &&
+            !__is_forward_iterator<_InputIterator>::value,
+            iterator
+        >::type
+        insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);
+    template<class _ForwardIterator>
+        typename enable_if
+        <
+            __is_forward_iterator<_ForwardIterator>::value,
+            iterator
+        >::type
+        insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    iterator insert(const_iterator __pos, initializer_list<value_type> __il)
+                    {return insert(__pos, __il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    basic_string& erase(size_type __pos = 0, size_type __n = npos);
+    _LIBCPP_INLINE_VISIBILITY
+    iterator      erase(const_iterator __pos);
+    _LIBCPP_INLINE_VISIBILITY
+    iterator      erase(const_iterator __first, const_iterator __last);
+
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
+    basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);
+    basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2);
+    basic_string& replace(size_type __pos, size_type __n1, const value_type* __s);
+    basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n);
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s);
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
+    template<class _InputIterator>
+        typename enable_if
+        <
+            __is_input_iterator<_InputIterator>::value,
+            basic_string&
+        >::type
+        replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
+        {return replace(__i1, __i2, __il.begin(), __il.end());}
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+    size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
+    _LIBCPP_INLINE_VISIBILITY
+    basic_string substr(size_type __pos = 0, size_type __n = npos) const;
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(basic_string& __str)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT;
+#else
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                    __is_nothrow_swappable<allocator_type>::value);
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    const value_type* c_str() const _NOEXCEPT {return data();}
+    _LIBCPP_INLINE_VISIBILITY
+    const value_type* data() const _NOEXCEPT  {return _VSTD::__to_raw_pointer(__get_pointer());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type get_allocator() const _NOEXCEPT {return __alloc();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
+    size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
+    size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
+    size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
+    size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
+    size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
+    size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
+    size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
+    size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    int compare(const basic_string& __str) const _NOEXCEPT;
+    _LIBCPP_INLINE_VISIBILITY
+    int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
+    int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos) const;
+    int compare(const value_type* __s) const _NOEXCEPT;
+    int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
+    int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
+
+    _LIBCPP_INLINE_VISIBILITY bool __invariants() const;
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool __is_long() const _NOEXCEPT
+        {return bool(__r_.first().__s.__size_ & __short_mask);}
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+    bool __dereferenceable(const const_iterator* __i) const;
+    bool __decrementable(const const_iterator* __i) const;
+    bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
+    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    allocator_type& __alloc() _NOEXCEPT
+        {return __r_.second();}
+    _LIBCPP_INLINE_VISIBILITY
+    const allocator_type& __alloc() const _NOEXCEPT
+        {return __r_.second();}
+
+#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __set_short_size(size_type __s) _NOEXCEPT
+#   if _LIBCPP_BIG_ENDIAN
+        {__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
+#   else
+        {__r_.first().__s.__size_ = (unsigned char)(__s);}
+#   endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type __get_short_size() const _NOEXCEPT
+#   if _LIBCPP_BIG_ENDIAN
+        {return __r_.first().__s.__size_ >> 1;}
+#   else
+        {return __r_.first().__s.__size_;}
+#   endif
+
+#else  // _LIBCPP_ALTERNATE_STRING_LAYOUT
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __set_short_size(size_type __s) _NOEXCEPT
+#   if _LIBCPP_BIG_ENDIAN
+        {__r_.first().__s.__size_ = (unsigned char)(__s);}
+#   else
+        {__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
+#   endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_type __get_short_size() const _NOEXCEPT
+#   if _LIBCPP_BIG_ENDIAN
+        {return __r_.first().__s.__size_;}
+#   else
+        {return __r_.first().__s.__size_ >> 1;}
+#   endif
+
+#endif  // _LIBCPP_ALTERNATE_STRING_LAYOUT
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __set_long_size(size_type __s) _NOEXCEPT
+        {__r_.first().__l.__size_ = __s;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type __get_long_size() const _NOEXCEPT
+        {return __r_.first().__l.__size_;}
+    _LIBCPP_INLINE_VISIBILITY
+    void __set_size(size_type __s) _NOEXCEPT
+        {if (__is_long()) __set_long_size(__s); else __set_short_size(__s);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __set_long_cap(size_type __s) _NOEXCEPT
+        {__r_.first().__l.__cap_  = __long_mask | __s;}
+    _LIBCPP_INLINE_VISIBILITY
+    size_type __get_long_cap() const _NOEXCEPT
+        {return __r_.first().__l.__cap_ & size_type(~__long_mask);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __set_long_pointer(pointer __p) _NOEXCEPT
+        {__r_.first().__l.__data_ = __p;}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer __get_long_pointer() _NOEXCEPT
+        {return __r_.first().__l.__data_;}
+    _LIBCPP_INLINE_VISIBILITY
+    const_pointer __get_long_pointer() const _NOEXCEPT
+        {return __r_.first().__l.__data_;}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer __get_short_pointer() _NOEXCEPT
+        {return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);}
+    _LIBCPP_INLINE_VISIBILITY
+    const_pointer __get_short_pointer() const _NOEXCEPT
+        {return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer __get_pointer() _NOEXCEPT
+        {return __is_long() ? __get_long_pointer() : __get_short_pointer();}
+    _LIBCPP_INLINE_VISIBILITY
+    const_pointer __get_pointer() const _NOEXCEPT
+        {return __is_long() ? __get_long_pointer() : __get_short_pointer();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __zero() _NOEXCEPT
+        {
+            size_type (&__a)[__n_words] = __r_.first().__r.__words;
+            for (unsigned __i = 0; __i < __n_words; ++__i)
+                __a[__i] = 0;
+        }
+
+    template <size_type __a> static
+        _LIBCPP_INLINE_VISIBILITY
+        size_type __align_it(size_type __s) _NOEXCEPT
+            {return __s + (__a-1) & ~(__a-1);}
+    enum {__alignment = 16};
+    static _LIBCPP_INLINE_VISIBILITY
+    size_type __recommend(size_type __s) _NOEXCEPT
+        {return (__s < __min_cap ? __min_cap :
+                 __align_it<sizeof(value_type) < __alignment ?
+                            __alignment/sizeof(value_type) : 1 > (__s+1)) - 1;}
+
+    void __init(const value_type* __s, size_type __sz, size_type __reserve);
+    void __init(const value_type* __s, size_type __sz);
+    void __init(size_type __n, value_type __c);
+
+    template <class _InputIterator>
+    typename enable_if
+    <
+         __is_input_iterator  <_InputIterator>::value &&
+        !__is_forward_iterator<_InputIterator>::value,
+        void
+    >::type
+    __init(_InputIterator __first, _InputIterator __last);
+
+    template <class _ForwardIterator>
+    typename enable_if
+    <
+        __is_forward_iterator<_ForwardIterator>::value,
+        void
+    >::type
+    __init(_ForwardIterator __first, _ForwardIterator __last);
+
+    void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
+                   size_type __n_copy,  size_type __n_del,     size_type __n_add = 0);
+    void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
+                               size_type __n_copy,  size_type __n_del,
+                               size_type __n_add, const value_type* __p_new_stuff);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __erase_to_end(size_type __pos);
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const basic_string& __str)
+        {__copy_assign_alloc(__str, integral_constant<bool,
+                      __alloc_traits::propagate_on_container_copy_assignment::value>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const basic_string& __str, true_type)
+        {
+            if (__alloc() != __str.__alloc())
+            {
+                clear();
+                shrink_to_fit();
+            }
+            __alloc() = __str.__alloc();
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
+        {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign(basic_string& __str, false_type)
+        _NOEXCEPT_(__alloc_traits::is_always_equal::value);
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign(basic_string& __str, true_type)
+#if _LIBCPP_STD_VER > 14
+        _NOEXCEPT;
+#else
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+#endif
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    void
+    __move_assign_alloc(basic_string& __str)
+        _NOEXCEPT_(
+            !__alloc_traits::propagate_on_container_move_assignment::value ||
+            is_nothrow_move_assignable<allocator_type>::value)
+    {__move_assign_alloc(__str, integral_constant<bool,
+                      __alloc_traits::propagate_on_container_move_assignment::value>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(basic_string& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+        {
+            __alloc() = _VSTD::move(__c.__alloc());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(basic_string&, false_type)
+        _NOEXCEPT
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
+    _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(size_type);
+
+    friend basic_string operator+<>(const basic_string&, const basic_string&);
+    friend basic_string operator+<>(const value_type*, const basic_string&);
+    friend basic_string operator+<>(value_type, const basic_string&);
+    friend basic_string operator+<>(const basic_string&, const value_type*);
+    friend basic_string operator+<>(const basic_string&, value_type);
+};
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators()
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__invalidate_all(this);
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
+#if _LIBCPP_DEBUG_LEVEL >= 2
+                                                                        __pos
+#endif
+                                                                      )
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __c_node* __c = __get_db()->__find_c_and_lock(this);
+    if (__c)
+    {
+        const_pointer __new_last = __get_pointer() + __pos;
+        for (__i_node** __p = __c->end_; __p != __c->beg_; )
+        {
+            --__p;
+            const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
+            if (__i->base() > __new_last)
+            {
+                (*__p)->__c_ = nullptr;
+                if (--__c->end_ != __p)
+                    memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+            }
+        }
+        __get_db()->unlock();
+    }
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string()
+    _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __zero();
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
+#if _LIBCPP_STD_VER <= 14
+        _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+#else
+        _NOEXCEPT
+#endif
+: __r_(__a)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+    __zero();
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+void
+basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve)
+{
+    if (__reserve > max_size())
+        this->__throw_length_error();
+    pointer __p;
+    if (__reserve < __min_cap)
+    {
+        __set_short_size(__sz);
+        __p = __get_short_pointer();
+    }
+    else
+    {
+        size_type __cap = __recommend(__reserve);
+        __p = __alloc_traits::allocate(__alloc(), __cap+1);
+        __set_long_pointer(__p);
+        __set_long_cap(__cap+1);
+        __set_long_size(__sz);
+    }
+    traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz);
+    traits_type::assign(__p[__sz], value_type());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+void
+basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz)
+{
+    if (__sz > max_size())
+        this->__throw_length_error();
+    pointer __p;
+    if (__sz < __min_cap)
+    {
+        __set_short_size(__sz);
+        __p = __get_short_pointer();
+    }
+    else
+    {
+        size_type __cap = __recommend(__sz);
+        __p = __alloc_traits::allocate(__alloc(), __cap+1);
+        __set_long_pointer(__p);
+        __set_long_cap(__cap+1);
+        __set_long_size(__sz);
+    }
+    traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz);
+    traits_type::assign(__p[__sz], value_type());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s)
+{
+    _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
+    __init(__s, traits_type::length(__s));
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, const allocator_type& __a)
+    : __r_(__a)
+{
+    _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
+    __init(__s, traits_type::length(__s));
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n)
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
+    __init(__s, __n);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n, const allocator_type& __a)
+    : __r_(__a)
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
+    __init(__s, __n);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
+    : __r_(__alloc_traits::select_on_container_copy_construction(__str.__alloc()))
+{
+    if (!__str.__is_long())
+        __r_.first().__r = __str.__r_.first().__r;
+    else
+        __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, const allocator_type& __a)
+    : __r_(__a)
+{
+    if (!__str.__is_long())
+        __r_.first().__r = __str.__r_.first().__r;
+    else
+        __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
+#if _LIBCPP_STD_VER <= 14
+        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+#else
+        _NOEXCEPT
+#endif
+    : __r_(_VSTD::move(__str.__r_))
+{
+    __str.__zero();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+    if (__is_long())
+        __get_db()->swap(this, &__str);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
+    : __r_(__a)
+{
+    if (__str.__is_long() && __a != __str.__alloc()) // copy, not move
+        __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
+    else
+    {
+        __r_.first().__r = __str.__r_.first().__r;
+        __str.__zero();
+    }
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+    if (__is_long())
+        __get_db()->swap(this, &__str);
+#endif
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+void
+basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
+{
+    if (__n > max_size())
+        this->__throw_length_error();
+    pointer __p;
+    if (__n < __min_cap)
+    {
+        __set_short_size(__n);
+        __p = __get_short_pointer();
+    }
+    else
+    {
+        size_type __cap = __recommend(__n);
+        __p = __alloc_traits::allocate(__alloc(), __cap+1);
+        __set_long_pointer(__p);
+        __set_long_cap(__cap+1);
+        __set_long_size(__n);
+    }
+    traits_type::assign(_VSTD::__to_raw_pointer(__p), __n, __c);
+    traits_type::assign(__p[__n], value_type());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c)
+{
+    __init(__n, __c);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c, const allocator_type& __a)
+    : __r_(__a)
+{
+    __init(__n, __c);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, size_type __n,
+                                                        const allocator_type& __a)
+    : __r_(__a)
+{
+    size_type __str_sz = __str.size();
+    if (__pos > __str_sz)
+        this->__throw_out_of_range();
+    __init(__str.data() + __pos, _VSTD::min(__n, __str_sz - __pos));
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+template <class _InputIterator>
+typename enable_if
+<
+     __is_input_iterator  <_InputIterator>::value &&
+    !__is_forward_iterator<_InputIterator>::value,
+    void
+>::type
+basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)
+{
+    __zero();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    for (; __first != __last; ++__first)
+        push_back(*__first);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    }
+    catch (...)
+    {
+        if (__is_long())
+            __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+        throw;
+    }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+template <class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value,
+    void
+>::type
+basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last)
+{
+    size_type __sz = static_cast<size_type>(_VSTD::distance(__first, __last));
+    if (__sz > max_size())
+        this->__throw_length_error();
+    pointer __p;
+    if (__sz < __min_cap)
+    {
+        __set_short_size(__sz);
+        __p = __get_short_pointer();
+    }
+    else
+    {
+        size_type __cap = __recommend(__sz);
+        __p = __alloc_traits::allocate(__alloc(), __cap+1);
+        __set_long_pointer(__p);
+        __set_long_cap(__cap+1);
+        __set_long_size(__sz);
+    }
+    for (; __first != __last; ++__first, (void) ++__p)
+        traits_type::assign(*__p, *__first);
+    traits_type::assign(*__p, value_type());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+template<class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)
+{
+    __init(__first, __last);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+template<class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
+                                                        const allocator_type& __a)
+    : __r_(__a)
+{
+    __init(__first, __last);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il)
+{
+    __init(__il.begin(), __il.end());
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il, const allocator_type& __a)
+    : __r_(__a)
+{
+    __init(__il.begin(), __il.end());
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>::~basic_string()
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__erase_c(this);
+#endif
+    if (__is_long())
+        __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+void
+basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
+    (size_type __old_cap, size_type __delta_cap, size_type __old_sz,
+     size_type __n_copy,  size_type __n_del,     size_type __n_add, const value_type* __p_new_stuff)
+{
+    size_type __ms = max_size();
+    if (__delta_cap > __ms - __old_cap - 1)
+        this->__throw_length_error();
+    pointer __old_p = __get_pointer();
+    size_type __cap = __old_cap < __ms / 2 - __alignment ?
+                          __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
+                          __ms - 1;
+    pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
+    __invalidate_all_iterators();
+    if (__n_copy != 0)
+        traits_type::copy(_VSTD::__to_raw_pointer(__p),
+                          _VSTD::__to_raw_pointer(__old_p), __n_copy);
+    if (__n_add != 0)
+        traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy, __p_new_stuff, __n_add);
+    size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
+    if (__sec_cp_sz != 0)
+        traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add,
+                          _VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del, __sec_cp_sz);
+    if (__old_cap+1 != __min_cap)
+        __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
+    __set_long_pointer(__p);
+    __set_long_cap(__cap+1);
+    __old_sz = __n_copy + __n_add + __sec_cp_sz;
+    __set_long_size(__old_sz);
+    traits_type::assign(__p[__old_sz], value_type());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+void
+basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
+                                                     size_type __n_copy,  size_type __n_del,     size_type __n_add)
+{
+    size_type __ms = max_size();
+    if (__delta_cap > __ms - __old_cap)
+        this->__throw_length_error();
+    pointer __old_p = __get_pointer();
+    size_type __cap = __old_cap < __ms / 2 - __alignment ?
+                          __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
+                          __ms - 1;
+    pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
+    __invalidate_all_iterators();
+    if (__n_copy != 0)
+        traits_type::copy(_VSTD::__to_raw_pointer(__p),
+                          _VSTD::__to_raw_pointer(__old_p), __n_copy);
+    size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
+    if (__sec_cp_sz != 0)
+        traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add,
+                          _VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del,
+                          __sec_cp_sz);
+    if (__old_cap+1 != __min_cap)
+        __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
+    __set_long_pointer(__p);
+    __set_long_cap(__cap+1);
+}
+
+// assign
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n)
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr");
+    size_type __cap = capacity();
+    if (__cap >= __n)
+    {
+        value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
+        traits_type::move(__p, __s, __n);
+        traits_type::assign(__p[__n], value_type());
+        __set_size(__n);
+        __invalidate_iterators_past(__n);
+    }
+    else
+    {
+        size_type __sz = size();
+        __grow_by_and_replace(__cap, __n - __cap, __sz, 0, __sz, __n, __s);
+    }
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
+{
+    size_type __cap = capacity();
+    if (__cap < __n)
+    {
+        size_type __sz = size();
+        __grow_by(__cap, __n - __cap, __sz, 0, __sz);
+    }
+    else
+        __invalidate_iterators_past(__n);
+    value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
+    traits_type::assign(__p, __n, __c);
+    traits_type::assign(__p[__n], value_type());
+    __set_size(__n);
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
+{
+    pointer __p;
+    if (__is_long())
+    {
+        __p = __get_long_pointer();
+        __set_long_size(1);
+    }
+    else
+    {
+        __p = __get_short_pointer();
+        __set_short_size(1);
+    }
+    traits_type::assign(*__p, __c);
+    traits_type::assign(*++__p, value_type());
+    __invalidate_iterators_past(1);
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
+{
+    if (this != &__str)
+    {
+        __copy_assign_alloc(__str);
+        assign(__str);
+    }
+    return *this;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
+    _NOEXCEPT_(__alloc_traits::is_always_equal::value)
+{
+    if (__alloc() != __str.__alloc())
+        assign(__str);
+    else
+        __move_assign(__str, true_type());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
+#if _LIBCPP_STD_VER > 14
+    _NOEXCEPT
+#else
+    _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+#endif
+{
+    clear();
+    shrink_to_fit();
+    __r_.first() = __str.__r_.first();
+    __move_assign_alloc(__str);
+    __str.__zero();
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
+    _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
+{
+    __move_assign(__str, integral_constant<bool,
+          __alloc_traits::propagate_on_container_move_assignment::value>());
+    return *this;
+}
+
+#endif
+
+template <class _CharT, class _Traits, class _Allocator>
+template<class _InputIterator>
+typename enable_if
+<
+     __is_input_iterator  <_InputIterator>::value &&
+    !__is_forward_iterator<_InputIterator>::value,
+    basic_string<_CharT, _Traits, _Allocator>&
+>::type
+basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
+{
+    clear();
+    for (; __first != __last; ++__first)
+        push_back(*__first);
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+template<class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value,
+    basic_string<_CharT, _Traits, _Allocator>&
+>::type
+basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
+{
+    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
+    size_type __cap = capacity();
+    if (__cap < __n)
+    {
+        size_type __sz = size();
+        __grow_by(__cap, __n - __cap, __sz, 0, __sz);
+    }
+    else
+        __invalidate_iterators_past(__n);
+    pointer __p = __get_pointer();
+    for (; __first != __last; ++__first, ++__p)
+        traits_type::assign(*__p, *__first);
+    traits_type::assign(*__p, value_type());
+    __set_size(__n);
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str)
+{
+    return assign(__str.data(), __str.size());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n)
+{
+    size_type __sz = __str.size();
+    if (__pos > __sz)
+        this->__throw_out_of_range();
+    return assign(__str.data() + __pos, _VSTD::min(__n, __sz - __pos));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr");
+    return assign(__s, traits_type::length(__s));
+}
+
+// append
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n)
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::append received nullptr");
+    size_type __cap = capacity();
+    size_type __sz = size();
+    if (__cap - __sz >= __n)
+    {
+        if (__n)
+        {
+            value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
+            traits_type::copy(__p + __sz, __s, __n);
+            __sz += __n;
+            __set_size(__sz);
+            traits_type::assign(__p[__sz], value_type());
+        }
+    }
+    else
+        __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s);
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
+{
+    if (__n)
+    {
+        size_type __cap = capacity();
+        size_type __sz = size();
+        if (__cap - __sz < __n)
+            __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
+        pointer __p = __get_pointer();
+        traits_type::assign(_VSTD::__to_raw_pointer(__p) + __sz, __n, __c);
+        __sz += __n;
+        __set_size(__sz);
+        traits_type::assign(__p[__sz], value_type());
+    }
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+void
+basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
+{
+    bool __is_short = !__is_long();
+    size_type __cap;
+    size_type __sz;
+    if (__is_short)
+    {
+        __cap = __min_cap - 1;
+        __sz = __get_short_size();
+    }
+    else
+    {
+        __cap = __get_long_cap() - 1;
+        __sz = __get_long_size();
+    }
+    if (__sz == __cap)
+    {
+        __grow_by(__cap, 1, __sz, __sz, 0);
+        __is_short = !__is_long();
+    }
+    pointer __p;
+    if (__is_short)
+    {
+        __p = __get_short_pointer() + __sz;
+        __set_short_size(__sz+1);
+    }
+    else
+    {
+        __p = __get_long_pointer() + __sz;
+        __set_long_size(__sz+1);
+    }
+    traits_type::assign(*__p, __c);
+    traits_type::assign(*++__p, value_type());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+template<class _InputIterator>
+typename enable_if
+<
+     __is_input_iterator  <_InputIterator>::value &&
+    !__is_forward_iterator<_InputIterator>::value,
+    basic_string<_CharT, _Traits, _Allocator>&
+>::type
+basic_string<_CharT, _Traits, _Allocator>::append(_InputIterator __first, _InputIterator __last)
+{
+    for (; __first != __last; ++__first)
+        push_back(*__first);
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+template<class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value,
+    basic_string<_CharT, _Traits, _Allocator>&
+>::type
+basic_string<_CharT, _Traits, _Allocator>::append(_ForwardIterator __first, _ForwardIterator __last)
+{
+    size_type __sz = size();
+    size_type __cap = capacity();
+    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
+    if (__n)
+    {
+        if (__cap - __sz < __n)
+            __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
+        pointer __p = __get_pointer() + __sz;
+        for (; __first != __last; ++__p, ++__first)
+            traits_type::assign(*__p, *__first);
+        traits_type::assign(*__p, value_type());
+        __set_size(__sz + __n);
+    }
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str)
+{
+    return append(__str.data(), __str.size());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n)
+{
+    size_type __sz = __str.size();
+    if (__pos > __sz)
+        this->__throw_out_of_range();
+    return append(__str.data() + __pos, _VSTD::min(__n, __sz - __pos));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::append received nullptr");
+    return append(__s, traits_type::length(__s));
+}
+
+// insert
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n)
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert received nullptr");
+    size_type __sz = size();
+    if (__pos > __sz)
+        this->__throw_out_of_range();
+    size_type __cap = capacity();
+    if (__cap - __sz >= __n)
+    {
+        if (__n)
+        {
+            value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
+            size_type __n_move = __sz - __pos;
+            if (__n_move != 0)
+            {
+                if (__p + __pos <= __s && __s < __p + __sz)
+                    __s += __n;
+                traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
+            }
+            traits_type::move(__p + __pos, __s, __n);
+            __sz += __n;
+            __set_size(__sz);
+            traits_type::assign(__p[__sz], value_type());
+        }
+    }
+    else
+        __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c)
+{
+    size_type __sz = size();
+    if (__pos > __sz)
+        this->__throw_out_of_range();
+    if (__n)
+    {
+        size_type __cap = capacity();
+        value_type* __p;
+        if (__cap - __sz >= __n)
+        {
+            __p = _VSTD::__to_raw_pointer(__get_pointer());
+            size_type __n_move = __sz - __pos;
+            if (__n_move != 0)
+                traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
+        }
+        else
+        {
+            __grow_by(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
+            __p = _VSTD::__to_raw_pointer(__get_long_pointer());
+        }
+        traits_type::assign(__p + __pos, __n, __c);
+        __sz += __n;
+        __set_size(__sz);
+        traits_type::assign(__p[__sz], value_type());
+    }
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+template<class _InputIterator>
+typename enable_if
+<
+     __is_input_iterator  <_InputIterator>::value &&
+    !__is_forward_iterator<_InputIterator>::value,
+    typename basic_string<_CharT, _Traits, _Allocator>::iterator
+>::type
+basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
+        "string::insert(iterator, range) called with an iterator not"
+        " referring to this string");
+#endif
+    size_type __old_sz = size();
+    difference_type __ip = __pos - begin();
+    for (; __first != __last; ++__first)
+        push_back(*__first);
+    pointer __p = __get_pointer();
+    _VSTD::rotate(__p + __ip, __p + __old_sz, __p + size());
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    return iterator(this, __p + __ip);
+#else
+    return iterator(__p + __ip);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+template<class _ForwardIterator>
+typename enable_if
+<
+    __is_forward_iterator<_ForwardIterator>::value,
+    typename basic_string<_CharT, _Traits, _Allocator>::iterator
+>::type
+basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
+        "string::insert(iterator, range) called with an iterator not"
+        " referring to this string");
+#endif
+    size_type __ip = static_cast<size_type>(__pos - begin());
+    size_type __sz = size();
+    size_type __cap = capacity();
+    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
+    if (__n)
+    {
+        value_type* __p;
+        if (__cap - __sz >= __n)
+        {
+            __p = _VSTD::__to_raw_pointer(__get_pointer());
+            size_type __n_move = __sz - __ip;
+            if (__n_move != 0)
+                traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
+        }
+        else
+        {
+            __grow_by(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);
+            __p = _VSTD::__to_raw_pointer(__get_long_pointer());
+        }
+        __sz += __n;
+        __set_size(__sz);
+        traits_type::assign(__p[__sz], value_type());
+        for (__p += __ip; __first != __last; ++__p, ++__first)
+            traits_type::assign(*__p, *__first);
+    }
+    return begin() + __ip;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str)
+{
+    return insert(__pos1, __str.data(), __str.size());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str,
+                                                  size_type __pos2, size_type __n)
+{
+    size_type __str_sz = __str.size();
+    if (__pos2 > __str_sz)
+        this->__throw_out_of_range();
+    return insert(__pos1, __str.data() + __pos2, _VSTD::min(__n, __str_sz - __pos2));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s)
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::insert received nullptr");
+    return insert(__pos, __s, traits_type::length(__s));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::iterator
+basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c)
+{
+    size_type __ip = static_cast<size_type>(__pos - begin());
+    size_type __sz = size();
+    size_type __cap = capacity();
+    value_type* __p;
+    if (__cap == __sz)
+    {
+        __grow_by(__cap, 1, __sz, __ip, 0, 1);
+        __p = _VSTD::__to_raw_pointer(__get_long_pointer());
+    }
+    else
+    {
+        __p = _VSTD::__to_raw_pointer(__get_pointer());
+        size_type __n_move = __sz - __ip;
+        if (__n_move != 0)
+            traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
+    }
+    traits_type::assign(__p[__ip], __c);
+    traits_type::assign(__p[++__sz], value_type());
+    __set_size(__sz);
+    return begin() + static_cast<difference_type>(__ip);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::iterator
+basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_type __n, value_type __c)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
+        "string::insert(iterator, n, value) called with an iterator not"
+        " referring to this string");
+#endif
+    difference_type __p = __pos - begin();
+    insert(static_cast<size_type>(__p), __n, __c);
+    return begin() + __p;
+}
+
+// replace
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
+{
+    _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
+    size_type __sz = size();
+    if (__pos > __sz)
+        this->__throw_out_of_range();
+    __n1 = _VSTD::min(__n1, __sz - __pos);
+    size_type __cap = capacity();
+    if (__cap - __sz + __n1 >= __n2)
+    {
+        value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
+        if (__n1 != __n2)
+        {
+            size_type __n_move = __sz - __pos - __n1;
+            if (__n_move != 0)
+            {
+                if (__n1 > __n2)
+                {
+                    traits_type::move(__p + __pos, __s, __n2);
+                    traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
+                    goto __finish;
+                }
+                if (__p + __pos < __s && __s < __p + __sz)
+                {
+                    if (__p + __pos + __n1 <= __s)
+                        __s += __n2 - __n1;
+                    else // __p + __pos < __s < __p + __pos + __n1
+                    {
+                        traits_type::move(__p + __pos, __s, __n1);
+                        __pos += __n1;
+                        __s += __n2;
+                        __n2 -= __n1;
+                        __n1 = 0;
+                    }
+                }
+                traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
+            }
+        }
+        traits_type::move(__p + __pos, __s, __n2);
+__finish:
+        __sz += __n2 - __n1;
+        __set_size(__sz);
+        __invalidate_iterators_past(__sz);
+        traits_type::assign(__p[__sz], value_type());
+    }
+    else
+        __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)
+{
+    size_type __sz = size();
+    if (__pos > __sz)
+        this->__throw_out_of_range();
+    __n1 = _VSTD::min(__n1, __sz - __pos);
+    size_type __cap = capacity();
+    value_type* __p;
+    if (__cap - __sz + __n1 >= __n2)
+    {
+        __p = _VSTD::__to_raw_pointer(__get_pointer());
+        if (__n1 != __n2)
+        {
+            size_type __n_move = __sz - __pos - __n1;
+            if (__n_move != 0)
+                traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
+        }
+    }
+    else
+    {
+        __grow_by(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);
+        __p = _VSTD::__to_raw_pointer(__get_long_pointer());
+    }
+    traits_type::assign(__p + __pos, __n2, __c);
+    __sz += __n2 - __n1;
+    __set_size(__sz);
+    __invalidate_iterators_past(__sz);
+    traits_type::assign(__p[__sz], value_type());
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+template<class _InputIterator>
+typename enable_if
+<
+    __is_input_iterator<_InputIterator>::value,
+    basic_string<_CharT, _Traits, _Allocator>&
+>::type
+basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
+                                                   _InputIterator __j1, _InputIterator __j2)
+{
+    for (; true; ++__i1, ++__j1)
+    {
+        if (__i1 == __i2)
+        {
+            if (__j1 != __j2)
+                insert(__i1, __j1, __j2);
+            break;
+        }
+        if (__j1 == __j2)
+        {
+            erase(__i1, __i2);
+            break;
+        }
+        traits_type::assign(const_cast<value_type&>(*__i1), *__j1);
+    }
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str)
+{
+    return replace(__pos1, __n1, __str.data(), __str.size());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str,
+                                                   size_type __pos2, size_type __n2)
+{
+    size_type __str_sz = __str.size();
+    if (__pos2 > __str_sz)
+        this->__throw_out_of_range();
+    return replace(__pos1, __n1, __str.data() + __pos2, _VSTD::min(__n2, __str_sz - __pos2));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s)
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::replace received nullptr");
+    return replace(__pos, __n1, __s, traits_type::length(__s));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str)
+{
+    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1),
+                   __str.data(), __str.size());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n)
+{
+    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s)
+{
+    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c)
+{
+    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c);
+}
+
+// erase
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n)
+{
+    size_type __sz = size();
+    if (__pos > __sz)
+        this->__throw_out_of_range();
+    if (__n)
+    {
+        value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
+        __n = _VSTD::min(__n, __sz - __pos);
+        size_type __n_move = __sz - __pos - __n;
+        if (__n_move != 0)
+            traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
+        __sz -= __n;
+        __set_size(__sz);
+        __invalidate_iterators_past(__sz);
+        traits_type::assign(__p[__sz], value_type());
+    }
+    return *this;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::iterator
+basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
+        "string::erase(iterator) called with an iterator not"
+        " referring to this string");
+#endif
+    _LIBCPP_ASSERT(__pos != end(),
+        "string::erase(iterator) called with a non-dereferenceable iterator");
+    iterator __b = begin();
+    size_type __r = static_cast<size_type>(__pos - __b);
+    erase(__r, 1);
+    return __b + static_cast<difference_type>(__r);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::iterator
+basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last)
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
+        "string::erase(iterator,  iterator) called with an iterator not"
+        " referring to this string");
+#endif
+    _LIBCPP_ASSERT(__first <= __last, "string::erase(first, last) called with invalid range");
+    iterator __b = begin();
+    size_type __r = static_cast<size_type>(__first - __b);
+    erase(__r, static_cast<size_type>(__last - __first));
+    return __b + static_cast<difference_type>(__r);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_string<_CharT, _Traits, _Allocator>::pop_back()
+{
+    _LIBCPP_ASSERT(!empty(), "string::pop_back(): string is already empty");
+    size_type __sz;
+    if (__is_long())
+    {
+        __sz = __get_long_size() - 1;
+        __set_long_size(__sz);
+        traits_type::assign(*(__get_long_pointer() + __sz), value_type());
+    }
+    else
+    {
+        __sz = __get_short_size() - 1;
+        __set_short_size(__sz);
+        traits_type::assign(*(__get_short_pointer() + __sz), value_type());
+    }
+    __invalidate_iterators_past(__sz);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT
+{
+    __invalidate_all_iterators();
+    if (__is_long())
+    {
+        traits_type::assign(*__get_long_pointer(), value_type());
+        __set_long_size(0);
+    }
+    else
+    {
+        traits_type::assign(*__get_short_pointer(), value_type());
+        __set_short_size(0);
+    }
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_string<_CharT, _Traits, _Allocator>::__erase_to_end(size_type __pos)
+{
+    if (__is_long())
+    {
+        traits_type::assign(*(__get_long_pointer() + __pos), value_type());
+        __set_long_size(__pos);
+    }
+    else
+    {
+        traits_type::assign(*(__get_short_pointer() + __pos), value_type());
+        __set_short_size(__pos);
+    }
+    __invalidate_iterators_past(__pos);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+void
+basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c)
+{
+    size_type __sz = size();
+    if (__n > __sz)
+        append(__n - __sz, __c);
+    else
+        __erase_to_end(__n);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT
+{
+    size_type __m = __alloc_traits::max_size(__alloc());
+#if _LIBCPP_BIG_ENDIAN
+    return (__m <= ~__long_mask ? __m : __m/2) - __alignment;
+#else
+    return __m - __alignment;
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+void
+basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
+{
+    if (__res_arg > max_size())
+        this->__throw_length_error();
+    size_type __cap = capacity();
+    size_type __sz = size();
+    __res_arg = _VSTD::max(__res_arg, __sz);
+    __res_arg = __recommend(__res_arg);
+    if (__res_arg != __cap)
+    {
+        pointer __new_data, __p;
+        bool __was_long, __now_long;
+        if (__res_arg == __min_cap - 1)
+        {
+            __was_long = true;
+            __now_long = false;
+            __new_data = __get_short_pointer();
+            __p = __get_long_pointer();
+        }
+        else
+        {
+            if (__res_arg > __cap)
+                __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
+            else
+            {
+            #ifndef _LIBCPP_NO_EXCEPTIONS
+                try
+                {
+            #endif  // _LIBCPP_NO_EXCEPTIONS
+                    __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
+            #ifndef _LIBCPP_NO_EXCEPTIONS
+                }
+                catch (...)
+                {
+                    return;
+                }
+            #else  // _LIBCPP_NO_EXCEPTIONS
+                if (__new_data == nullptr)
+                    return;
+            #endif  // _LIBCPP_NO_EXCEPTIONS
+            }
+            __now_long = true;
+            __was_long = __is_long();
+            __p = __get_pointer();
+        }
+        traits_type::copy(_VSTD::__to_raw_pointer(__new_data),
+                          _VSTD::__to_raw_pointer(__p), size()+1);
+        if (__was_long)
+            __alloc_traits::deallocate(__alloc(), __p, __cap+1);
+        if (__now_long)
+        {
+            __set_long_cap(__res_arg+1);
+            __set_long_size(__sz);
+            __set_long_pointer(__new_data);
+        }
+        else
+            __set_short_size(__sz);
+        __invalidate_all_iterators();
+    }
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::const_reference
+basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) const
+{
+    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds");
+    return *(data() + __pos);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::reference
+basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos)
+{
+    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds");
+    return *(__get_pointer() + __pos);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::const_reference
+basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const
+{
+    if (__n >= size())
+        this->__throw_out_of_range();
+    return (*this)[__n];
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::reference
+basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)
+{
+    if (__n >= size())
+        this->__throw_out_of_range();
+    return (*this)[__n];
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::reference
+basic_string<_CharT, _Traits, _Allocator>::front()
+{
+    _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");
+    return *__get_pointer();
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::const_reference
+basic_string<_CharT, _Traits, _Allocator>::front() const
+{
+    _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");
+    return *data();
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::reference
+basic_string<_CharT, _Traits, _Allocator>::back()
+{
+    _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
+    return *(__get_pointer() + size() - 1);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::const_reference
+basic_string<_CharT, _Traits, _Allocator>::back() const
+{
+    _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
+    return *(data() + size() - 1);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const
+{
+    size_type __sz = size();
+    if (__pos > __sz)
+        this->__throw_out_of_range();
+    size_type __rlen = _VSTD::min(__n, __sz - __pos);
+    traits_type::copy(__s, data() + __pos, __rlen);
+    return __rlen;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+basic_string<_CharT, _Traits, _Allocator>::substr(size_type __pos, size_type __n) const
+{
+    return basic_string(*this, __pos, __n, __alloc());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
+#if _LIBCPP_STD_VER >= 14
+        _NOEXCEPT
+#else
+        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+                    __is_nothrow_swappable<allocator_type>::value)
+#endif
+{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    if (!__is_long())
+        __get_db()->__invalidate_all(this);
+    if (!__str.__is_long())
+        __get_db()->__invalidate_all(&__str);
+    __get_db()->swap(this, &__str);
+#endif
+    _VSTD::swap(__r_.first(), __str.__r_.first());
+    __swap_allocator(__alloc(), __str.__alloc());
+}
+
+// find
+
+template <class _Traits>
+struct _LIBCPP_HIDDEN __traits_eq
+{
+    typedef typename _Traits::char_type char_type;
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator()(const char_type& __x, const char_type& __y) _NOEXCEPT
+        {return _Traits::eq(__x, __y);}
+};
+
+template<class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
+                                                size_type __pos,
+                                                size_type __n) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr");
+    return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, __n);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
+                                                size_type __pos) const _NOEXCEPT
+{
+    return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+        (data(), size(), __str.data(), __pos, __str.size());
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
+                                                size_type __pos) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr");
+    return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, traits_type::length(__s));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
+                                                size_type __pos) const _NOEXCEPT
+{
+    return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+        (data(), size(), __c, __pos);
+}
+
+// rfind
+
+template<class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
+                                                 size_type __pos,
+                                                 size_type __n) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
+    return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, __n);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
+                                                 size_type __pos) const _NOEXCEPT
+{
+    return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
+        (data(), size(), __str.data(), __pos, __str.size());
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
+                                                 size_type __pos) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr");
+    return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, traits_type::length(__s));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
+                                                 size_type __pos) const _NOEXCEPT
+{
+    return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
+        (data(), size(), __c, __pos);
+}
+
+// find_first_of
+
+template<class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
+                                                         size_type __pos,
+                                                         size_type __n) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
+    return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, __n);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str,
+                                                         size_type __pos) const _NOEXCEPT
+{
+    return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __str.data(), __pos, __str.size());
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
+                                                         size_type __pos) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr");
+    return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, traits_type::length(__s));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,
+                                                         size_type __pos) const _NOEXCEPT
+{
+    return find(__c, __pos);
+}
+
+// find_last_of
+
+template<class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
+                                                        size_type __pos,
+                                                        size_type __n) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
+    return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, __n);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str,
+                                                        size_type __pos) const _NOEXCEPT
+{
+    return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __str.data(), __pos, __str.size());
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
+                                                        size_type __pos) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr");
+    return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, traits_type::length(__s));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,
+                                                        size_type __pos) const _NOEXCEPT
+{
+    return rfind(__c, __pos);
+}
+
+// find_first_not_of
+
+template<class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
+                                                             size_type __pos,
+                                                             size_type __n) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
+    return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, __n);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str,
+                                                             size_type __pos) const _NOEXCEPT
+{
+    return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __str.data(), __pos, __str.size());
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
+                                                             size_type __pos) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr");
+    return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, traits_type::length(__s));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
+                                                             size_type __pos) const _NOEXCEPT
+{
+    return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __c, __pos);
+}
+
+// find_last_not_of
+
+template<class _CharT, class _Traits, class _Allocator>
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
+                                                            size_type __pos,
+                                                            size_type __n) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
+    return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, __n);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str,
+                                                            size_type __pos) const _NOEXCEPT
+{
+    return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __str.data(), __pos, __str.size());
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
+                                                            size_type __pos) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr");
+    return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __s, __pos, traits_type::length(__s));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
+                                                            size_type __pos) const _NOEXCEPT
+{
+    return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
+        (data(), size(), __c, __pos);
+}
+
+// compare
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+int
+basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
+{
+    size_t __lhs_sz = size();
+    size_t __rhs_sz = __str.size();
+    int __result = traits_type::compare(data(), __str.data(),
+                                        _VSTD::min(__lhs_sz, __rhs_sz));
+    if (__result != 0)
+        return __result;
+    if (__lhs_sz < __rhs_sz)
+        return -1;
+    if (__lhs_sz > __rhs_sz)
+        return 1;
+    return 0;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+int
+basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
+                                                   size_type __n1,
+                                                   const basic_string& __str) const
+{
+    return compare(__pos1, __n1, __str.data(), __str.size());
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+int
+basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
+                                                   size_type __n1,
+                                                   const basic_string& __str,
+                                                   size_type __pos2,
+                                                   size_type __n2) const
+{
+    size_type __sz = __str.size();
+    if (__pos2 > __sz)
+        this->__throw_out_of_range();
+    return compare(__pos1, __n1, __str.data() + __pos2, _VSTD::min(__n2,
+                                                                  __sz - __pos2));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+int
+basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr");
+    return compare(0, npos, __s, traits_type::length(__s));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+int
+basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
+                                                   size_type __n1,
+                                                   const value_type* __s) const
+{
+    _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr");
+    return compare(__pos1, __n1, __s, traits_type::length(__s));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+int
+basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
+                                                   size_type __n1,
+                                                   const value_type* __s,
+                                                   size_type __n2) const
+{
+    _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr");
+    size_type __sz = size();
+    if (__pos1 > __sz || __n2 == npos)
+        this->__throw_out_of_range();
+    size_type __rlen = _VSTD::min(__n1, __sz - __pos1);
+    int __r = traits_type::compare(data() + __pos1, __s, _VSTD::min(__rlen, __n2));
+    if (__r == 0)
+    {
+        if (__rlen < __n2)
+            __r = -1;
+        else if (__rlen > __n2)
+            __r = 1;
+    }
+    return __r;
+}
+
+// __invariants
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+basic_string<_CharT, _Traits, _Allocator>::__invariants() const
+{
+    if (size() > capacity())
+        return false;
+    if (capacity() < __min_cap - 1)
+        return false;
+    if (data() == 0)
+        return false;
+    if (data()[size()] != value_type(0))
+        return false;
+    return true;
+}
+
+// operator==
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    size_t __lhs_sz = __lhs.size();
+    return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(),
+                                                        __rhs.data(),
+                                                        __lhs_sz) == 0;
+}
+
+template<class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
+           const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
+{
+    size_t __lhs_sz = __lhs.size();
+    if (__lhs_sz != __rhs.size())
+        return false;
+    const char* __lp = __lhs.data();
+    const char* __rp = __rhs.data();
+    if (__lhs.__is_long())
+        return char_traits<char>::compare(__lp, __rp, __lhs_sz) == 0;
+    for (; __lhs_sz != 0; --__lhs_sz, ++__lp, ++__rp)
+        if (*__lp != *__rp)
+            return false;
+    return true;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const _CharT* __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return __rhs.compare(__lhs) == 0;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+           const _CharT* __rhs) _NOEXCEPT
+{
+    return __lhs.compare(__rhs) == 0;
+}
+
+// operator!=
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return !(__lhs == __rhs);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const _CharT* __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return !(__lhs == __rhs);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+           const _CharT* __rhs) _NOEXCEPT
+{
+    return !(__lhs == __rhs);
+}
+
+// operator<
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return __lhs.compare(__rhs) < 0;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+           const _CharT* __rhs) _NOEXCEPT
+{
+    return __lhs.compare(__rhs) < 0;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator< (const _CharT* __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return __rhs.compare(__lhs) > 0;
+}
+
+// operator>
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return __rhs < __lhs;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+           const _CharT* __rhs) _NOEXCEPT
+{
+    return __rhs < __lhs;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator> (const _CharT* __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return __rhs < __lhs;
+}
+
+// operator<=
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return !(__rhs < __lhs);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+           const _CharT* __rhs) _NOEXCEPT
+{
+    return !(__rhs < __lhs);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const _CharT* __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return !(__rhs < __lhs);
+}
+
+// operator>=
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return !(__lhs < __rhs);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+           const _CharT* __rhs) _NOEXCEPT
+{
+    return !(__lhs < __rhs);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const _CharT* __lhs,
+           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
+{
+    return !(__lhs < __rhs);
+}
+
+// operator +
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+          const basic_string<_CharT, _Traits, _Allocator>& __rhs)
+{
+    basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator());
+    typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size();
+    typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size();
+    __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + __rhs_sz);
+    __r.append(__rhs.data(), __rhs_sz);
+    return __r;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+{
+    basic_string<_CharT, _Traits, _Allocator> __r(__rhs.get_allocator());
+    typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = _Traits::length(__lhs);
+    typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size();
+    __r.__init(__lhs, __lhs_sz, __lhs_sz + __rhs_sz);
+    __r.append(__rhs.data(), __rhs_sz);
+    return __r;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+{
+    basic_string<_CharT, _Traits, _Allocator> __r(__rhs.get_allocator());
+    typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size();
+    __r.__init(&__lhs, 1, 1 + __rhs_sz);
+    __r.append(__rhs.data(), __rhs_sz);
+    return __r;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs)
+{
+    basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator());
+    typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size();
+    typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = _Traits::length(__rhs);
+    __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + __rhs_sz);
+    __r.append(__rhs, __rhs_sz);
+    return __r;
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)
+{
+    basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator());
+    typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size();
+    __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + 1);
+    __r.push_back(__rhs);
+    return __r;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs)
+{
+    return _VSTD::move(__lhs.append(__rhs));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)
+{
+    return _VSTD::move(__rhs.insert(0, __lhs));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)
+{
+    return _VSTD::move(__lhs.append(__rhs));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs)
+{
+    return _VSTD::move(__rhs.insert(0, __lhs));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs)
+{
+    __rhs.insert(__rhs.begin(), __lhs);
+    return _VSTD::move(__rhs);
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs)
+{
+    return _VSTD::move(__lhs.append(__rhs));
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs)
+{
+    __lhs.push_back(__rhs);
+    return _VSTD::move(__lhs);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+// swap
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(basic_string<_CharT, _Traits, _Allocator>& __lhs,
+     basic_string<_CharT, _Traits, _Allocator>& __rhs)
+     _NOEXCEPT_(_NOEXCEPT_(__lhs.swap(__rhs)))
+{
+    __lhs.swap(__rhs);
+}
+
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+
+typedef basic_string<char16_t> u16string;
+typedef basic_string<char32_t> u32string;
+
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+
+_LIBCPP_FUNC_VIS int                stoi  (const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS long               stol  (const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long      stoul (const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS long long          stoll (const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10);
+
+_LIBCPP_FUNC_VIS float       stof (const string& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS double      stod (const string& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS long double stold(const string& __str, size_t* __idx = 0);
+
+_LIBCPP_FUNC_VIS string to_string(int __val);
+_LIBCPP_FUNC_VIS string to_string(unsigned __val);
+_LIBCPP_FUNC_VIS string to_string(long __val);
+_LIBCPP_FUNC_VIS string to_string(unsigned long __val);
+_LIBCPP_FUNC_VIS string to_string(long long __val);
+_LIBCPP_FUNC_VIS string to_string(unsigned long long __val);
+_LIBCPP_FUNC_VIS string to_string(float __val);
+_LIBCPP_FUNC_VIS string to_string(double __val);
+_LIBCPP_FUNC_VIS string to_string(long double __val);
+
+_LIBCPP_FUNC_VIS int                stoi  (const wstring& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS long               stol  (const wstring& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long      stoul (const wstring& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS long long          stoll (const wstring& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long long stoull(const wstring& __str, size_t* __idx = 0, int __base = 10);
+
+_LIBCPP_FUNC_VIS float       stof (const wstring& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS double      stod (const wstring& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS long double stold(const wstring& __str, size_t* __idx = 0);
+
+_LIBCPP_FUNC_VIS wstring to_wstring(int __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(unsigned __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(long __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(unsigned long __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(long long __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(unsigned long long __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(float __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(double __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(long double __val);
+
+template<class _CharT, class _Traits, class _Allocator>
+    const typename basic_string<_CharT, _Traits, _Allocator>::size_type
+                   basic_string<_CharT, _Traits, _Allocator>::npos;
+
+template<class _CharT, class _Traits, class _Allocator>
+struct _LIBCPP_TYPE_VIS_ONLY hash<basic_string<_CharT, _Traits, _Allocator> >
+    : public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>
+{
+    size_t
+        operator()(const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT;
+};
+
+template<class _CharT, class _Traits, class _Allocator>
+size_t
+hash<basic_string<_CharT, _Traits, _Allocator> >::operator()(
+        const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT
+{
+    return __do_string_hash(__val.data(), __val.data() + __val.size());
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           const basic_string<_CharT, _Traits, _Allocator>& __str);
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is,
+           basic_string<_CharT, _Traits, _Allocator>& __str);
+
+template<class _CharT, class _Traits, class _Allocator>
+basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>& __is,
+        basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>& __is,
+        basic_string<_CharT, _Traits, _Allocator>& __str);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is,
+        basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
+
+template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is,
+        basic_string<_CharT, _Traits, _Allocator>& __str);
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+template<class _CharT, class _Traits, class _Allocator>
+bool
+basic_string<_CharT, _Traits, _Allocator>::__dereferenceable(const const_iterator* __i) const
+{
+    return this->data() <= _VSTD::__to_raw_pointer(__i->base()) &&
+           _VSTD::__to_raw_pointer(__i->base()) < this->data() + this->size();
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+bool
+basic_string<_CharT, _Traits, _Allocator>::__decrementable(const const_iterator* __i) const
+{
+    return this->data() < _VSTD::__to_raw_pointer(__i->base()) &&
+           _VSTD::__to_raw_pointer(__i->base()) <= this->data() + this->size();
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+bool
+basic_string<_CharT, _Traits, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const
+{
+    const value_type* __p = _VSTD::__to_raw_pointer(__i->base()) + __n;
+    return this->data() <= __p && __p <= this->data() + this->size();
+}
+
+template<class _CharT, class _Traits, class _Allocator>
+bool
+basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const
+{
+    const value_type* __p = _VSTD::__to_raw_pointer(__i->base()) + __n;
+    return this->data() <= __p && __p < this->data() + this->size();
+}
+
+#endif  // _LIBCPP_DEBUG_LEVEL >= 2
+
+#if _LIBCPP_STD_VER > 11 
+// Literal suffixes for basic_string [basic.string.literals]
+inline namespace literals
+{
+  inline namespace string_literals
+  {
+    inline _LIBCPP_INLINE_VISIBILITY
+    basic_string<char> operator "" s( const char *__str, size_t __len )
+    {
+        return basic_string<char> (__str, __len);
+    }
+
+    inline _LIBCPP_INLINE_VISIBILITY
+    basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len )
+    {
+        return basic_string<wchar_t> (__str, __len);
+    }
+
+    inline _LIBCPP_INLINE_VISIBILITY
+    basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len )
+    {
+        return basic_string<char16_t> (__str, __len);
+    }
+
+    inline _LIBCPP_INLINE_VISIBILITY
+    basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len )
+    {
+        return basic_string<char32_t> (__str, __len);
+    }
+  }
+}
+#endif
+
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_string<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_string<wchar_t>)
+_LIBCPP_EXTERN_TEMPLATE(string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_STRING

Property changes on: lab4/.minix-src/include/c++/string
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/thread
===================================================================
--- lab4/.minix-src/include/c++/thread	(nonexistent)
+++ lab4/.minix-src/include/c++/thread	(revision 13)
@@ -0,0 +1,474 @@
+// -*- C++ -*-
+//===--------------------------- thread -----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_THREAD
+#define _LIBCPP_THREAD
+
+/*
+
+    thread synopsis
+
+#define __STDCPP_THREADS__ __cplusplus
+
+namespace std
+{
+
+class thread
+{
+public:
+    class id;
+    typedef pthread_t native_handle_type;
+
+    thread() noexcept;
+    template <class F, class ...Args> explicit thread(F&& f, Args&&... args);
+    ~thread();
+
+    thread(const thread&) = delete;
+    thread(thread&& t) noexcept;
+
+    thread& operator=(const thread&) = delete;
+    thread& operator=(thread&& t) noexcept;
+
+    void swap(thread& t) noexcept;
+
+    bool joinable() const noexcept;
+    void join();
+    void detach();
+    id get_id() const noexcept;
+    native_handle_type native_handle();
+
+    static unsigned hardware_concurrency() noexcept;
+};
+
+void swap(thread& x, thread& y) noexcept;
+
+class thread::id
+{
+public:
+    id() noexcept;
+};
+
+bool operator==(thread::id x, thread::id y) noexcept;
+bool operator!=(thread::id x, thread::id y) noexcept;
+bool operator< (thread::id x, thread::id y) noexcept;
+bool operator<=(thread::id x, thread::id y) noexcept;
+bool operator> (thread::id x, thread::id y) noexcept;
+bool operator>=(thread::id x, thread::id y) noexcept;
+
+template<class charT, class traits>
+basic_ostream<charT, traits>&
+operator<<(basic_ostream<charT, traits>& out, thread::id id);
+
+namespace this_thread
+{
+
+thread::id get_id() noexcept;
+
+void yield() noexcept;
+
+template <class Clock, class Duration>
+void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
+
+template <class Rep, class Period>
+void sleep_for(const chrono::duration<Rep, Period>& rel_time);
+
+}  // this_thread
+
+}  // std
+
+*/
+
+#include <__config>
+#include <iosfwd>
+#include <__functional_base>
+#include <type_traits>
+#include <cstddef>
+#include <functional>
+#include <memory>
+#include <system_error>
+#include <chrono>
+#include <__mutex_base>
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+#include <tuple>
+#endif
+#include <pthread.h>
+#include <sched.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#define __STDCPP_THREADS__ __cplusplus
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error <thread> is not supported on this single threaded system
+#else // !_LIBCPP_HAS_NO_THREADS
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> class __thread_specific_ptr;
+class _LIBCPP_TYPE_VIS __thread_struct;
+class _LIBCPP_HIDDEN __thread_struct_imp;
+class __assoc_sub_state;
+
+_LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
+
+class _LIBCPP_TYPE_VIS __thread_struct
+{
+    __thread_struct_imp* __p_;
+
+    __thread_struct(const __thread_struct&);
+    __thread_struct& operator=(const __thread_struct&);
+public:
+    __thread_struct();
+    ~__thread_struct();
+
+    void notify_all_at_thread_exit(condition_variable*, mutex*);
+    void __make_ready_at_thread_exit(__assoc_sub_state*);
+};
+
+template <class _Tp>
+class __thread_specific_ptr
+{
+    pthread_key_t __key_;
+
+     // Only __thread_local_data() may construct a __thread_specific_ptr
+     // and only with _Tp == __thread_struct.
+    static_assert((is_same<_Tp, __thread_struct>::value), "");
+    __thread_specific_ptr();
+    friend _LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
+
+    __thread_specific_ptr(const __thread_specific_ptr&);
+    __thread_specific_ptr& operator=(const __thread_specific_ptr&);
+
+    static void __at_thread_exit(void*);
+public:
+    typedef _Tp* pointer;
+
+    ~__thread_specific_ptr();
+
+    _LIBCPP_INLINE_VISIBILITY
+    pointer get() const {return static_cast<_Tp*>(pthread_getspecific(__key_));}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator*() const {return *get();}
+    _LIBCPP_INLINE_VISIBILITY
+    pointer operator->() const {return get();}
+    pointer release();
+    void reset(pointer __p = nullptr);
+};
+
+template <class _Tp>
+void
+__thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
+{
+    delete static_cast<pointer>(__p);
+}
+
+template <class _Tp>
+__thread_specific_ptr<_Tp>::__thread_specific_ptr()
+{
+    int __ec = pthread_key_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    if (__ec)
+        throw system_error(error_code(__ec, system_category()),
+                           "__thread_specific_ptr construction failed");
+#endif
+}
+
+template <class _Tp>
+__thread_specific_ptr<_Tp>::~__thread_specific_ptr()
+{
+    // __thread_specific_ptr is only created with a static storage duration
+    // so this destructor is only invoked during program termination. Invoking
+    // pthread_key_delete(__key_) may prevent other threads from deleting their
+    // thread local data. For this reason we leak the key.
+}
+
+template <class _Tp>
+typename __thread_specific_ptr<_Tp>::pointer
+__thread_specific_ptr<_Tp>::release()
+{
+    pointer __p = get();
+    pthread_setspecific(__key_, 0);
+    return __p;
+}
+
+template <class _Tp>
+void
+__thread_specific_ptr<_Tp>::reset(pointer __p)
+{
+    pointer __p_old = get();
+    pthread_setspecific(__key_, __p);
+    delete __p_old;
+}
+
+class _LIBCPP_TYPE_VIS thread;
+class _LIBCPP_TYPE_VIS __thread_id;
+
+namespace this_thread
+{
+
+_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT;
+
+}  // this_thread
+
+template<> struct _LIBCPP_TYPE_VIS_ONLY hash<__thread_id>;
+
+class _LIBCPP_TYPE_VIS_ONLY __thread_id
+{
+    // FIXME: pthread_t is a pointer on Darwin but a long on Linux.
+    // NULL is the no-thread value on Darwin.  Someone needs to check
+    // on other platforms.  We assume 0 works everywhere for now.
+    pthread_t __id_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __thread_id() _NOEXCEPT : __id_(0) {}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT
+        {return __x.__id_ == __y.__id_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT
+        {return !(__x == __y);}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT
+        {return __x.__id_ < __y.__id_;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT
+        {return !(__y < __x);}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT
+        {return   __y < __x ;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT
+        {return !(__x < __y);}
+
+    template<class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id)
+        {return __os << __id.__id_;}
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    __thread_id(pthread_t __id) : __id_(__id) {}
+
+    friend __thread_id this_thread::get_id() _NOEXCEPT;
+    friend class _LIBCPP_TYPE_VIS thread;
+    friend struct _LIBCPP_TYPE_VIS_ONLY hash<__thread_id>;
+};
+
+template<>
+struct _LIBCPP_TYPE_VIS_ONLY hash<__thread_id>
+    : public unary_function<__thread_id, size_t>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(__thread_id __v) const
+    {
+        return hash<pthread_t>()(__v.__id_);
+    }
+};
+
+namespace this_thread
+{
+
+inline _LIBCPP_INLINE_VISIBILITY
+__thread_id
+get_id() _NOEXCEPT
+{
+    return pthread_self();
+}
+
+}  // this_thread
+
+class _LIBCPP_TYPE_VIS thread
+{
+    pthread_t __t_;
+
+    thread(const thread&);
+    thread& operator=(const thread&);
+public:
+    typedef __thread_id id;
+    typedef pthread_t native_handle_type;
+
+    _LIBCPP_INLINE_VISIBILITY
+    thread() _NOEXCEPT : __t_(0) {}
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class _Fp, class ..._Args,
+              class = typename enable_if
+              <
+                   !is_same<typename decay<_Fp>::type, thread>::value
+              >::type
+             >
+        explicit thread(_Fp&& __f, _Args&&... __args);
+#else  // _LIBCPP_HAS_NO_VARIADICS
+    template <class _Fp> explicit thread(_Fp __f);
+#endif
+    ~thread();
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
+    thread& operator=(thread&& __t) _NOEXCEPT;
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool joinable() const _NOEXCEPT {return __t_ != 0;}
+    void join();
+    void detach();
+    _LIBCPP_INLINE_VISIBILITY
+    id get_id() const _NOEXCEPT {return __t_;}
+    _LIBCPP_INLINE_VISIBILITY
+    native_handle_type native_handle() _NOEXCEPT {return __t_;}
+
+    static unsigned hardware_concurrency() _NOEXCEPT;
+};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Fp, class ..._Args, size_t ..._Indices>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__thread_execute(tuple<_Fp, _Args...>& __t, __tuple_indices<_Indices...>)
+{
+    __invoke(_VSTD::move(_VSTD::get<0>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
+}
+
+template <class _Fp>
+void*
+__thread_proxy(void* __vp)
+{
+    __thread_local_data().reset(new __thread_struct);
+    std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
+    typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
+    __thread_execute(*__p, _Index());
+    return nullptr;
+}
+
+template <class _Fp, class ..._Args,
+          class
+         >
+thread::thread(_Fp&& __f, _Args&&... __args)
+{
+    typedef tuple<typename decay<_Fp>::type, typename decay<_Args>::type...> _Gp;
+    _VSTD::unique_ptr<_Gp> __p(new _Gp(__decay_copy(_VSTD::forward<_Fp>(__f)),
+                                __decay_copy(_VSTD::forward<_Args>(__args))...));
+    int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Gp>, __p.get());
+    if (__ec == 0)
+        __p.release();
+    else
+        __throw_system_error(__ec, "thread constructor failed");
+}
+
+#else  // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Fp>
+void*
+__thread_proxy(void* __vp)
+{
+    __thread_local_data().reset(new __thread_struct);
+    std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
+    (*__p)();
+    return nullptr;
+}
+
+template <class _Fp>
+thread::thread(_Fp __f)
+{
+    std::unique_ptr<_Fp> __p(new _Fp(__f));
+    int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Fp>, __p.get());
+    if (__ec == 0)
+        __p.release();
+    else
+        __throw_system_error(__ec, "thread constructor failed");
+}
+
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+inline _LIBCPP_INLINE_VISIBILITY
+thread&
+thread::operator=(thread&& __t) _NOEXCEPT
+{
+    if (__t_ != 0)
+        terminate();
+    __t_ = __t.__t_;
+    __t.__t_ = 0;
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+inline _LIBCPP_INLINE_VISIBILITY
+void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
+
+namespace this_thread
+{
+
+_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& ns);
+
+template <class _Rep, class _Period>
+void
+sleep_for(const chrono::duration<_Rep, _Period>& __d)
+{
+    using namespace chrono;
+    if (__d > duration<_Rep, _Period>::zero())
+    {
+        _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
+        nanoseconds __ns;
+        if (__d < _Max)
+        {
+            __ns = duration_cast<nanoseconds>(__d);
+            if (__ns < __d)
+                ++__ns;
+        }
+        else
+            __ns = nanoseconds::max();
+        sleep_for(__ns);
+    }
+}
+
+template <class _Clock, class _Duration>
+void
+sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
+{
+    using namespace chrono;
+    mutex __mut;
+    condition_variable __cv;
+    unique_lock<mutex> __lk(__mut);
+    while (_Clock::now() < __t)
+        __cv.wait_until(__lk, __t);
+}
+
+template <class _Duration>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
+{
+    using namespace chrono;
+    sleep_for(__t - steady_clock::now());
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void yield() _NOEXCEPT {sched_yield();}
+
+}  // this_thread
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // !_LIBCPP_HAS_NO_THREADS
+
+#endif  // _LIBCPP_THREAD

Property changes on: lab4/.minix-src/include/c++/thread
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/typeinfo
===================================================================
--- lab4/.minix-src/include/c++/typeinfo	(nonexistent)
+++ lab4/.minix-src/include/c++/typeinfo	(revision 13)
@@ -0,0 +1,168 @@
+// -*- C++ -*-
+//===-------------------------- typeinfo ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __LIBCPP_TYPEINFO
+#define __LIBCPP_TYPEINFO
+
+/*
+
+    typeinfo synopsis
+
+namespace std {
+
+class type_info
+{
+public:
+    virtual ~type_info();
+
+    bool operator==(const type_info& rhs) const noexcept;
+    bool operator!=(const type_info& rhs) const noexcept;
+
+    bool before(const type_info& rhs) const noexcept;
+    size_t hash_code() const noexcept;
+    const char* name() const noexcept;
+
+    type_info(const type_info& rhs) = delete;
+    type_info& operator=(const type_info& rhs) = delete;
+};
+
+class bad_cast
+    : public exception
+{
+public:
+    bad_cast() noexcept;
+    bad_cast(const bad_cast&) noexcept;
+    bad_cast& operator=(const bad_cast&) noexcept;
+    virtual const char* what() const noexcept;
+};
+
+class bad_typeid
+    : public exception
+{
+public:
+    bad_typeid() noexcept;
+    bad_typeid(const bad_typeid&) noexcept;
+    bad_typeid& operator=(const bad_typeid&) noexcept;
+    virtual const char* what() const noexcept;
+};
+
+}  // std
+
+*/
+
+#include <__config>
+#include <exception>
+#include <cstddef>
+#include <cstdint>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+namespace std  // purposefully not using versioning namespace
+{
+
+class _LIBCPP_EXCEPTION_ABI type_info
+{
+    type_info& operator=(const type_info&);
+    type_info(const type_info&);
+protected:
+#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
+    const char* __type_name;
+#else
+    // A const char* with the non-unique RTTI bit possibly set.
+    uintptr_t __type_name;
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit type_info(const char* __n)
+#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
+        : __type_name(__n) {}
+#else
+        : __type_name(reinterpret_cast<uintptr_t>(__n)) {}
+#endif
+
+public:
+    virtual ~type_info();
+
+    _LIBCPP_INLINE_VISIBILITY
+    const char* name() const _NOEXCEPT
+#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
+        {return __type_name;}
+#else
+        {return reinterpret_cast<const char*>(__type_name & ~_LIBCPP_NONUNIQUE_RTTI_BIT);}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool before(const type_info& __arg) const _NOEXCEPT
+#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
+        {return __type_name < __arg.__type_name;}
+#else
+        {if (!((__type_name & __arg.__type_name) & _LIBCPP_NONUNIQUE_RTTI_BIT))
+           return __type_name < __arg.__type_name;
+         return __compare_nonunique_names(__arg) < 0;}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t hash_code() const _NOEXCEPT
+#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
+        {return *reinterpret_cast<const size_t*>(&__type_name);}
+#else
+        {if (!(__type_name & _LIBCPP_NONUNIQUE_RTTI_BIT)) return __type_name;
+         const char *__ptr = name();
+         size_t __hash = 5381;
+         while (unsigned char __c = static_cast<unsigned char>(*__ptr++))
+           __hash = (__hash * 33) ^ __c;
+         return __hash;}
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator==(const type_info& __arg) const _NOEXCEPT
+#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
+        {return __type_name == __arg.__type_name;}
+#else
+        {if (__type_name == __arg.__type_name) return true;
+         if (!((__type_name & __arg.__type_name) & _LIBCPP_NONUNIQUE_RTTI_BIT))
+           return false;
+         return __compare_nonunique_names(__arg) == 0;}
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    bool operator!=(const type_info& __arg) const _NOEXCEPT
+        {return !operator==(__arg);}
+
+#ifdef _LIBCPP_NONUNIQUE_RTTI_BIT
+  private:
+    _LIBCPP_INLINE_VISIBILITY
+    int __compare_nonunique_names(const type_info &__arg) const _NOEXCEPT
+        {return __builtin_strcmp(name(), __arg.name());}
+#endif
+};
+
+class _LIBCPP_EXCEPTION_ABI bad_cast
+    : public exception
+{
+public:
+    bad_cast() _NOEXCEPT;
+    virtual ~bad_cast() _NOEXCEPT;
+    virtual const char* what() const _NOEXCEPT;
+};
+
+class _LIBCPP_EXCEPTION_ABI bad_typeid
+    : public exception
+{
+public:
+    bad_typeid() _NOEXCEPT;
+    virtual ~bad_typeid() _NOEXCEPT;
+    virtual const char* what() const _NOEXCEPT;
+};
+
+}  // std
+
+#endif  // __LIBCPP_TYPEINFO

Property changes on: lab4/.minix-src/include/c++/typeinfo
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/c++/valarray
===================================================================
--- lab4/.minix-src/include/c++/valarray	(nonexistent)
+++ lab4/.minix-src/include/c++/valarray	(revision 13)
@@ -0,0 +1,4783 @@
+// -*- C++ -*-
+//===-------------------------- valarray ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_VALARRAY
+#define _LIBCPP_VALARRAY
+
+/*
+    valarray synopsis
+
+namespace std
+{
+
+template<class T>
+class valarray
+{
+public:
+    typedef T value_type;
+
+    // construct/destroy:
+    valarray();
+    explicit valarray(size_t n);
+    valarray(const value_type& x, size_t n);
+    valarray(const value_type* px, size_t n);
+    valarray(const valarray& v);
+    valarray(valarray&& v) noexcept;
+    valarray(const slice_array<value_type>& sa);
+    valarray(const gslice_array<value_type>& ga);
+    valarray(const mask_array<value_type>& ma);
+    valarray(const indirect_array<value_type>& ia);
+    valarray(initializer_list<value_type> il);
+    ~valarray();
+
+    // assignment:
+    valarray& operator=(const valarray& v);
+    valarray& operator=(valarray&& v) noexcept;
+    valarray& operator=(initializer_list<value_type> il);
+    valarray& operator=(const value_type& x);
+    valarray& operator=(const slice_array<value_type>& sa);
+    valarray& operator=(const gslice_array<value_type>& ga);
+    valarray& operator=(const mask_array<value_type>& ma);
+    valarray& operator=(const indirect_array<value_type>& ia);
+
+    // element access:
+    const value_type& operator[](size_t i) const;
+    value_type&       operator[](size_t i);
+
+    // subset operations:
+    valarray                   operator[](slice s) const;
+    slice_array<value_type>    operator[](slice s);
+    valarray                   operator[](const gslice& gs) const;
+    gslice_array<value_type>   operator[](const gslice& gs);
+    valarray                   operator[](const valarray<bool>& vb) const;
+    mask_array<value_type>     operator[](const valarray<bool>& vb);
+    valarray                   operator[](const valarray<size_t>& vs) const;
+    indirect_array<value_type> operator[](const valarray<size_t>& vs);
+
+    // unary operators:
+    valarray       operator+() const;
+    valarray       operator-() const;
+    valarray       operator~() const;
+    valarray<bool> operator!() const;
+
+    // computed assignment:
+    valarray& operator*= (const value_type& x);
+    valarray& operator/= (const value_type& x);
+    valarray& operator%= (const value_type& x);
+    valarray& operator+= (const value_type& x);
+    valarray& operator-= (const value_type& x);
+    valarray& operator^= (const value_type& x);
+    valarray& operator&= (const value_type& x);
+    valarray& operator|= (const value_type& x);
+    valarray& operator<<=(const value_type& x);
+    valarray& operator>>=(const value_type& x);
+
+    valarray& operator*= (const valarray& v);
+    valarray& operator/= (const valarray& v);
+    valarray& operator%= (const valarray& v);
+    valarray& operator+= (const valarray& v);
+    valarray& operator-= (const valarray& v);
+    valarray& operator^= (const valarray& v);
+    valarray& operator|= (const valarray& v);
+    valarray& operator&= (const valarray& v);
+    valarray& operator<<=(const valarray& v);
+    valarray& operator>>=(const valarray& v);
+
+    // member functions:
+    void swap(valarray& v) noexcept;
+
+    size_t size() const;
+
+    value_type sum() const;
+    value_type min() const;
+    value_type max() const;
+
+    valarray shift (int i) const;
+    valarray cshift(int i) const;
+    valarray apply(value_type f(value_type)) const;
+    valarray apply(value_type f(const value_type&)) const;
+    void resize(size_t n, value_type x = value_type());
+};
+
+class slice
+{
+public:
+    slice();
+    slice(size_t start, size_t size, size_t stride);
+
+    size_t start()  const;
+    size_t size()   const;
+    size_t stride() const;
+};
+
+template <class T>
+class slice_array
+{
+public:
+    typedef T value_type;
+
+    const slice_array& operator=(const slice_array& sa) const;
+    void operator=  (const valarray<value_type>& v) const;
+    void operator*= (const valarray<value_type>& v) const;
+    void operator/= (const valarray<value_type>& v) const;
+    void operator%= (const valarray<value_type>& v) const;
+    void operator+= (const valarray<value_type>& v) const;
+    void operator-= (const valarray<value_type>& v) const;
+    void operator^= (const valarray<value_type>& v) const;
+    void operator&= (const valarray<value_type>& v) const;
+    void operator|= (const valarray<value_type>& v) const;
+    void operator<<=(const valarray<value_type>& v) const;
+    void operator>>=(const valarray<value_type>& v) const;
+
+    void operator=(const value_type& x) const;
+
+    slice_array() = delete;
+};
+
+class gslice
+{
+public:
+    gslice();
+    gslice(size_t start, const valarray<size_t>& size,
+                         const valarray<size_t>& stride);
+
+    size_t           start()  const;
+    valarray<size_t> size()   const;
+    valarray<size_t> stride() const;
+};
+
+template <class T>
+class gslice_array
+{
+public:
+    typedef T value_type;
+
+    void operator=  (const valarray<value_type>& v) const;
+    void operator*= (const valarray<value_type>& v) const;
+    void operator/= (const valarray<value_type>& v) const;
+    void operator%= (const valarray<value_type>& v) const;
+    void operator+= (const valarray<value_type>& v) const;
+    void operator-= (const valarray<value_type>& v) const;
+    void operator^= (const valarray<value_type>& v) const;
+    void operator&= (const valarray<value_type>& v) const;
+    void operator|= (const valarray<value_type>& v) const;
+    void operator<<=(const valarray<value_type>& v) const;
+    void operator>>=(const valarray<value_type>& v) const;
+
+    gslice_array(const gslice_array& ga);
+    ~gslice_array();
+    const gslice_array& operator=(const gslice_array& ga) const;
+    void operator=(const value_type& x) const;
+
+    gslice_array() = delete;
+};
+
+template <class T>
+class mask_array
+{
+public:
+    typedef T value_type;
+
+    void operator=  (const valarray<value_type>& v) const;
+    void operator*= (const valarray<value_type>& v) const;
+    void operator/= (const valarray<value_type>& v) const;
+    void operator%= (const valarray<value_type>& v) const;
+    void operator+= (const valarray<value_type>& v) const;
+    void operator-= (const valarray<value_type>& v) const;
+    void operator^= (const valarray<value_type>& v) const;
+    void operator&= (const valarray<value_type>& v) const;
+    void operator|= (const valarray<value_type>& v) const;
+    void operator<<=(const valarray<value_type>& v) const;
+    void operator>>=(const valarray<value_type>& v) const;
+
+    mask_array(const mask_array& ma);
+    ~mask_array();
+    const mask_array& operator=(const mask_array& ma) const;
+    void operator=(const value_type& x) const;
+
+    mask_array() = delete;
+};
+
+template <class T>
+class indirect_array
+{
+public:
+    typedef T value_type;
+
+    void operator=  (const valarray<value_type>& v) const;
+    void operator*= (const valarray<value_type>& v) const;
+    void operator/= (const valarray<value_type>& v) const;
+    void operator%= (const valarray<value_type>& v) const;
+    void operator+= (const valarray<value_type>& v) const;
+    void operator-= (const valarray<value_type>& v) const;
+    void operator^= (const valarray<value_type>& v) const;
+    void operator&= (const valarray<value_type>& v) const;
+    void operator|= (const valarray<value_type>& v) const;
+    void operator<<=(const valarray<value_type>& v) const;
+    void operator>>=(const valarray<value_type>& v) const;
+
+    indirect_array(const indirect_array& ia);
+    ~indirect_array();
+    const indirect_array& operator=(const indirect_array& ia) const;
+    void operator=(const value_type& x) const;
+
+    indirect_array() = delete;
+};
+
+template<class T> void swap(valarray<T>& x, valarray<T>& y) noexcept;
+
+template<class T> valarray<T> operator* (const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> operator* (const valarray<T>& x, const T& y);
+template<class T> valarray<T> operator* (const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> operator/ (const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> operator/ (const valarray<T>& x, const T& y);
+template<class T> valarray<T> operator/ (const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> operator% (const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> operator% (const valarray<T>& x, const T& y);
+template<class T> valarray<T> operator% (const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> operator+ (const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> operator+ (const valarray<T>& x, const T& y);
+template<class T> valarray<T> operator+ (const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> operator- (const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> operator- (const valarray<T>& x, const T& y);
+template<class T> valarray<T> operator- (const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> operator^ (const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> operator^ (const valarray<T>& x, const T& y);
+template<class T> valarray<T> operator^ (const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> operator& (const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> operator& (const valarray<T>& x, const T& y);
+template<class T> valarray<T> operator& (const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> operator| (const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> operator| (const valarray<T>& x, const T& y);
+template<class T> valarray<T> operator| (const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> operator<<(const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> operator<<(const valarray<T>& x, const T& y);
+template<class T> valarray<T> operator<<(const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> operator>>(const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> operator>>(const valarray<T>& x, const T& y);
+template<class T> valarray<T> operator>>(const T& x, const valarray<T>& y);
+
+template<class T> valarray<bool> operator&&(const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<bool> operator&&(const valarray<T>& x, const T& y);
+template<class T> valarray<bool> operator&&(const T& x, const valarray<T>& y);
+
+template<class T> valarray<bool> operator||(const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<bool> operator||(const valarray<T>& x, const T& y);
+template<class T> valarray<bool> operator||(const T& x, const valarray<T>& y);
+
+template<class T> valarray<bool> operator==(const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<bool> operator==(const valarray<T>& x, const T& y);
+template<class T> valarray<bool> operator==(const T& x, const valarray<T>& y);
+
+template<class T> valarray<bool> operator!=(const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<bool> operator!=(const valarray<T>& x, const T& y);
+template<class T> valarray<bool> operator!=(const T& x, const valarray<T>& y);
+
+template<class T> valarray<bool> operator< (const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<bool> operator< (const valarray<T>& x, const T& y);
+template<class T> valarray<bool> operator< (const T& x, const valarray<T>& y);
+
+template<class T> valarray<bool> operator> (const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<bool> operator> (const valarray<T>& x, const T& y);
+template<class T> valarray<bool> operator> (const T& x, const valarray<T>& y);
+
+template<class T> valarray<bool> operator<=(const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<bool> operator<=(const valarray<T>& x, const T& y);
+template<class T> valarray<bool> operator<=(const T& x, const valarray<T>& y);
+
+template<class T> valarray<bool> operator>=(const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<bool> operator>=(const valarray<T>& x, const T& y);
+template<class T> valarray<bool> operator>=(const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> abs (const valarray<T>& x);
+template<class T> valarray<T> acos (const valarray<T>& x);
+template<class T> valarray<T> asin (const valarray<T>& x);
+template<class T> valarray<T> atan (const valarray<T>& x);
+
+template<class T> valarray<T> atan2(const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> atan2(const valarray<T>& x, const T& y);
+template<class T> valarray<T> atan2(const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> cos (const valarray<T>& x);
+template<class T> valarray<T> cosh (const valarray<T>& x);
+template<class T> valarray<T> exp (const valarray<T>& x);
+template<class T> valarray<T> log (const valarray<T>& x);
+template<class T> valarray<T> log10(const valarray<T>& x);
+
+template<class T> valarray<T> pow(const valarray<T>& x, const valarray<T>& y);
+template<class T> valarray<T> pow(const valarray<T>& x, const T& y);
+template<class T> valarray<T> pow(const T& x, const valarray<T>& y);
+
+template<class T> valarray<T> sin (const valarray<T>& x);
+template<class T> valarray<T> sinh (const valarray<T>& x);
+template<class T> valarray<T> sqrt (const valarray<T>& x);
+template<class T> valarray<T> tan (const valarray<T>& x);
+template<class T> valarray<T> tanh (const valarray<T>& x);
+
+template <class T> unspecified1 begin(valarray<T>& v);
+template <class T> unspecified2 begin(const valarray<T>& v);
+template <class T> unspecified1 end(valarray<T>& v);
+template <class T> unspecified2 end(const valarray<T>& v);
+
+}  // std
+
+*/
+
+#include <__config>
+#include <cstddef>
+#include <cmath>
+#include <initializer_list>
+#include <algorithm>
+#include <functional>
+#include <new>
+
+#include <__undef_min_max>
+#include <__undef___deallocate>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY valarray;
+
+class _LIBCPP_TYPE_VIS_ONLY slice
+{
+    size_t __start_;
+    size_t __size_;
+    size_t __stride_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    slice()
+        : __start_(0),
+          __size_(0),
+          __stride_(0)
+          {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    slice(size_t __start, size_t __size, size_t __stride)
+        : __start_(__start),
+          __size_(__size),
+          __stride_(__stride)
+          {}
+
+    _LIBCPP_INLINE_VISIBILITY size_t start()  const {return __start_;}
+    _LIBCPP_INLINE_VISIBILITY size_t size()   const {return __size_;}
+    _LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
+};
+
+template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY slice_array;
+class _LIBCPP_TYPE_VIS gslice;
+template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY gslice_array;
+template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY mask_array;
+template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY indirect_array;
+
+template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp*
+begin(valarray<_Tp>& __v);
+
+template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+const _Tp*
+begin(const valarray<_Tp>& __v);
+
+template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp*
+end(valarray<_Tp>& __v);
+
+template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+const _Tp*
+end(const valarray<_Tp>& __v);
+
+template <class _Op, class _A0>
+struct _UnaryOp
+{
+    typedef typename _Op::result_type result_type;
+    typedef typename _A0::value_type value_type;
+
+    _Op __op_;
+    _A0 __a0_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __a0_.size();}
+};
+
+template <class _Op, class _A0, class _A1>
+struct _BinaryOp
+{
+    typedef typename _Op::result_type result_type;
+    typedef typename _A0::value_type value_type;
+
+    _Op __op_;
+    _A0 __a0_;
+    _A1 __a1_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
+        : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __a0_.size();}
+};
+
+template <class _Tp>
+class __scalar_expr
+{
+public:
+    typedef _Tp        value_type;
+    typedef const _Tp& result_type;
+private:
+    const value_type& __t_;
+    size_t __s_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator[](size_t) const {return __t_;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __s_;}
+};
+
+template <class _Tp>
+struct __unary_plus : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return +__x;}
+};
+
+template <class _Tp>
+struct __bit_not  : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return ~__x;}
+};
+
+template <class _Tp>
+struct __bit_shift_left : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x << __y;}
+};
+
+template <class _Tp>
+struct __bit_shift_right : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return __x >> __y;}
+};
+
+template <class _Tp, class _Fp>
+struct __apply_expr   : unary_function<_Tp, _Tp>
+{
+private:
+    _Fp __f_;
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __apply_expr(_Fp __f) : __f_(__f) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return __f_(__x);}
+};
+
+template <class _Tp>
+struct __abs_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return abs(__x);}
+};
+
+template <class _Tp>
+struct __acos_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return acos(__x);}
+};
+
+template <class _Tp>
+struct __asin_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return asin(__x);}
+};
+
+template <class _Tp>
+struct __atan_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return atan(__x);}
+};
+
+template <class _Tp>
+struct __atan2_expr : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return atan2(__x, __y);}
+};
+
+template <class _Tp>
+struct __cos_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return cos(__x);}
+};
+
+template <class _Tp>
+struct __cosh_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return cosh(__x);}
+};
+
+template <class _Tp>
+struct __exp_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return exp(__x);}
+};
+
+template <class _Tp>
+struct __log_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return log(__x);}
+};
+
+template <class _Tp>
+struct __log10_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return log10(__x);}
+};
+
+template <class _Tp>
+struct __pow_expr : binary_function<_Tp, _Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x, const _Tp& __y) const
+        {return pow(__x, __y);}
+};
+
+template <class _Tp>
+struct __sin_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return sin(__x);}
+};
+
+template <class _Tp>
+struct __sinh_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return sinh(__x);}
+};
+
+template <class _Tp>
+struct __sqrt_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return sqrt(__x);}
+};
+
+template <class _Tp>
+struct __tan_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return tan(__x);}
+};
+
+template <class _Tp>
+struct __tanh_expr : unary_function<_Tp, _Tp>
+{
+    _LIBCPP_INLINE_VISIBILITY
+    _Tp operator()(const _Tp& __x) const
+        {return tanh(__x);}
+};
+
+template <class _ValExpr>
+class __slice_expr
+{
+    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
+public:
+    typedef typename _RmExpr::value_type value_type;
+    typedef value_type result_type;
+
+private:
+    _ValExpr __expr_;
+    size_t __start_;
+    size_t __size_;
+    size_t __stride_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __slice_expr(const slice& __sl, const _RmExpr& __e)
+        : __expr_(__e),
+          __start_(__sl.start()),
+          __size_(__sl.size()),
+          __stride_(__sl.stride())
+        {}
+public:
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator[](size_t __i) const
+        {return __expr_[__start_ + __i * __stride_];}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __size_;}
+
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
+};
+
+template <class _ValExpr>
+class __mask_expr;
+
+template <class _ValExpr>
+class __indirect_expr;
+
+template <class _ValExpr>
+class __shift_expr
+{
+    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
+public:
+    typedef typename _RmExpr::value_type value_type;
+    typedef value_type result_type;
+
+private:
+    _ValExpr __expr_;
+    size_t __size_;
+    ptrdiff_t __ul_;
+    ptrdiff_t __sn_;
+    ptrdiff_t __n_;
+    static const ptrdiff_t _Np = static_cast<ptrdiff_t>(
+                                    sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
+
+    _LIBCPP_INLINE_VISIBILITY
+    __shift_expr(int __n, const _RmExpr& __e)
+        : __expr_(__e),
+          __size_(__e.size()),
+          __n_(__n)
+        {
+            ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
+            __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
+            __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
+        }
+public:
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator[](size_t __j) const
+        {
+            ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
+            ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
+            return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __size_;}
+
+    template <class> friend class __val_expr;
+};
+
+template <class _ValExpr>
+class __cshift_expr
+{
+    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
+public:
+    typedef typename _RmExpr::value_type value_type;
+    typedef value_type result_type;
+
+private:
+    _ValExpr __expr_;
+    size_t __size_;
+    size_t __m_;
+    size_t __o1_;
+    size_t __o2_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __cshift_expr(int __n, const _RmExpr& __e)
+        : __expr_(__e),
+          __size_(__e.size())
+        {
+            __n %= static_cast<int>(__size_);
+            if (__n >= 0)
+            {
+                __m_ = __size_ - __n;
+                __o1_ = __n;
+                __o2_ = __n - __size_;
+            }
+            else
+            {
+                __m_ = -__n;
+                __o1_ = __n + __size_;
+                __o2_ = __n;
+            }
+        }
+public:
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator[](size_t __i) const
+        {
+            if (__i < __m_)
+                return __expr_[__i + __o1_];
+            return __expr_[__i + __o2_];
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __size_;}
+
+    template <class> friend class __val_expr;
+};
+
+template<class _ValExpr>
+class __val_expr;
+
+template<class _ValExpr>
+struct __is_val_expr : false_type {};
+
+template<class _ValExpr>
+struct __is_val_expr<__val_expr<_ValExpr> > : true_type {};
+
+template<class _Tp>
+struct __is_val_expr<valarray<_Tp> > : true_type {};
+
+template<class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY valarray
+{
+public:
+    typedef _Tp value_type;
+    typedef _Tp result_type;
+
+private:
+    value_type* __begin_;
+    value_type* __end_;
+
+public:
+    // construct/destroy:
+    _LIBCPP_INLINE_VISIBILITY
+    valarray() : __begin_(0), __end_(0) {}
+    explicit valarray(size_t __n);
+    valarray(const value_type& __x, size_t __n);
+    valarray(const value_type* __p, size_t __n);
+    valarray(const valarray& __v);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    valarray(valarray&& __v) _NOEXCEPT;
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    valarray(initializer_list<value_type> __il);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    valarray(const slice_array<value_type>& __sa);
+    valarray(const gslice_array<value_type>& __ga);
+    valarray(const mask_array<value_type>& __ma);
+    valarray(const indirect_array<value_type>& __ia);
+    ~valarray();
+
+    // assignment:
+    valarray& operator=(const valarray& __v);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    valarray& operator=(valarray&& __v) _NOEXCEPT;
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    valarray& operator=(initializer_list<value_type>);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    valarray& operator=(const value_type& __x);
+    valarray& operator=(const slice_array<value_type>& __sa);
+    valarray& operator=(const gslice_array<value_type>& __ga);
+    valarray& operator=(const mask_array<value_type>& __ma);
+    valarray& operator=(const indirect_array<value_type>& __ia);
+    template <class _ValExpr>
+        valarray& operator=(const __val_expr<_ValExpr>& __v);
+
+    // element access:
+    _LIBCPP_INLINE_VISIBILITY
+    const value_type& operator[](size_t __i) const {return __begin_[__i];}
+
+    _LIBCPP_INLINE_VISIBILITY
+    value_type&       operator[](size_t __i)       {return __begin_[__i];}
+
+    // subset operations:
+    __val_expr<__slice_expr<const valarray&> >    operator[](slice __s) const;
+    slice_array<value_type>                       operator[](slice __s);
+    __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
+    gslice_array<value_type>   operator[](const gslice& __gs);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
+    gslice_array<value_type>                      operator[](gslice&& __gs);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __val_expr<__mask_expr<const valarray&> >     operator[](const valarray<bool>& __vb) const;
+    mask_array<value_type>                        operator[](const valarray<bool>& __vb);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __val_expr<__mask_expr<const valarray&> >     operator[](valarray<bool>&& __vb) const;
+    mask_array<value_type>                        operator[](valarray<bool>&& __vb);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
+    indirect_array<value_type>                    operator[](const valarray<size_t>& __vs);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
+    indirect_array<value_type>                    operator[](valarray<size_t>&& __vs);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    // unary operators:
+    valarray       operator+() const;
+    valarray       operator-() const;
+    valarray       operator~() const;
+    valarray<bool> operator!() const;
+
+    // computed assignment:
+    valarray& operator*= (const value_type& __x);
+    valarray& operator/= (const value_type& __x);
+    valarray& operator%= (const value_type& __x);
+    valarray& operator+= (const value_type& __x);
+    valarray& operator-= (const value_type& __x);
+    valarray& operator^= (const value_type& __x);
+    valarray& operator&= (const value_type& __x);
+    valarray& operator|= (const value_type& __x);
+    valarray& operator<<=(const value_type& __x);
+    valarray& operator>>=(const value_type& __x);
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        valarray&
+    >::type
+    operator*= (const _Expr& __v);
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        valarray&
+    >::type
+    operator/= (const _Expr& __v);
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        valarray&
+    >::type
+    operator%= (const _Expr& __v);
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        valarray&
+    >::type
+    operator+= (const _Expr& __v);
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        valarray&
+    >::type
+    operator-= (const _Expr& __v);
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        valarray&
+    >::type
+    operator^= (const _Expr& __v);
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        valarray&
+    >::type
+    operator|= (const _Expr& __v);
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        valarray&
+    >::type
+    operator&= (const _Expr& __v);
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        valarray&
+    >::type
+    operator<<= (const _Expr& __v);
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        valarray&
+    >::type
+    operator>>= (const _Expr& __v);
+
+    // member functions:
+    void swap(valarray& __v) _NOEXCEPT;
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
+
+    value_type sum() const;
+    value_type min() const;
+    value_type max() const;
+
+    valarray shift (int __i) const;
+    valarray cshift(int __i) const;
+    valarray apply(value_type __f(value_type)) const;
+    valarray apply(value_type __f(const value_type&)) const;
+    void     resize(size_t __n, value_type __x = value_type());
+
+private:
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY slice_array;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY gslice_array;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY mask_array;
+    template <class> friend class __mask_expr;
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY indirect_array;
+    template <class> friend class __indirect_expr;
+    template <class> friend class __val_expr;
+
+    template <class _Up>
+    friend
+    _Up*
+    begin(valarray<_Up>& __v);
+
+    template <class _Up>
+    friend
+    const _Up*
+    begin(const valarray<_Up>& __v);
+
+    template <class _Up>
+    friend
+    _Up*
+    end(valarray<_Up>& __v);
+
+    template <class _Up>
+    friend
+    const _Up*
+    end(const valarray<_Up>& __v);
+};
+
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
+
+template <class _Op, class _Tp>
+struct _UnaryOp<_Op, valarray<_Tp> >
+{
+    typedef typename _Op::result_type result_type;
+    typedef _Tp value_type;
+
+    _Op __op_;
+    const valarray<_Tp>& __a0_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __a0_.size();}
+};
+
+template <class _Op, class _Tp, class _A1>
+struct _BinaryOp<_Op, valarray<_Tp>, _A1>
+{
+    typedef typename _Op::result_type result_type;
+    typedef _Tp value_type;
+
+    _Op __op_;
+    const valarray<_Tp>& __a0_;
+    _A1 __a1_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
+        : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __a0_.size();}
+};
+
+template <class _Op, class _A0, class _Tp>
+struct _BinaryOp<_Op, _A0, valarray<_Tp> >
+{
+    typedef typename _Op::result_type result_type;
+    typedef _Tp value_type;
+
+    _Op __op_;
+    _A0 __a0_;
+    const valarray<_Tp>& __a1_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
+        : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __a0_.size();}
+};
+
+template <class _Op, class _Tp>
+struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
+{
+    typedef typename _Op::result_type result_type;
+    typedef _Tp value_type;
+
+    _Op __op_;
+    const valarray<_Tp>& __a0_;
+    const valarray<_Tp>& __a1_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
+        : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    value_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __a0_.size();}
+};
+
+// slice_array
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY slice_array
+{
+public:
+    typedef _Tp value_type;
+
+private:
+    value_type* __vp_;
+    size_t __size_;
+    size_t __stride_;
+
+public:
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator*=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator/=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator%=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator+=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator-=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator^=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator&=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator|=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator<<=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator>>=(const _Expr& __v) const;
+
+    const slice_array& operator=(const slice_array& __sa) const;
+
+    void operator=(const value_type& __x) const;
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    slice_array(const slice& __sl, const valarray<value_type>& __v)
+        : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())),
+          __size_(__sl.size()),
+          __stride_(__sl.stride())
+        {}
+
+    template <class> friend class valarray;
+    template <class> friend class sliceExpr;
+};
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+const slice_array<_Tp>&
+slice_array<_Tp>::operator=(const slice_array& __sa) const
+{
+    value_type* __t = __vp_;
+    const value_type* __s = __sa.__vp_;
+    for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
+        *__t = *__s;
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t = __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator*=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t *= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator/=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t /= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator%=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t %= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator+=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t += __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator-=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t -= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator^=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t ^= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator&=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t &= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator|=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t |= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator<<=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t <<= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+slice_array<_Tp>::operator>>=(const _Expr& __v) const
+{
+    value_type* __t = __vp_;
+    for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+        *__t >>= __v[__i];
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+slice_array<_Tp>::operator=(const value_type& __x) const
+{
+    value_type* __t = __vp_;
+    for (size_t __n = __size_; __n; --__n, __t += __stride_)
+        *__t = __x;
+}
+
+// gslice
+
+class _LIBCPP_TYPE_VIS gslice
+{
+    valarray<size_t> __size_;
+    valarray<size_t> __stride_;
+    valarray<size_t> __1d_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    gslice() {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    gslice(size_t __start, const valarray<size_t>& __size,
+                           const valarray<size_t>& __stride)
+        : __size_(__size),
+          __stride_(__stride)
+        {__init(__start);}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    gslice(size_t __start, const valarray<size_t>&  __size,
+                                 valarray<size_t>&& __stride)
+        : __size_(__size),
+          __stride_(move(__stride))
+        {__init(__start);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    gslice(size_t __start,       valarray<size_t>&& __size,
+                           const valarray<size_t>&  __stride)
+        : __size_(move(__size)),
+          __stride_(__stride)
+        {__init(__start);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    gslice(size_t __start,       valarray<size_t>&& __size,
+                                 valarray<size_t>&& __stride)
+        : __size_(move(__size)),
+          __stride_(move(__stride))
+        {__init(__start);}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+//  gslice(const gslice&)            = default;
+//  gslice(gslice&&)                 = default;
+//  gslice& operator=(const gslice&) = default;
+//  gslice& operator=(gslice&&)      = default;
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t           start()  const {return __1d_.size() ? __1d_[0] : 0;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    valarray<size_t> size()   const {return __size_;}
+
+    _LIBCPP_INLINE_VISIBILITY
+    valarray<size_t> stride() const {return __stride_;}
+
+private:
+    void __init(size_t __start);
+
+    template <class> friend class gslice_array;
+    template <class> friend class valarray;
+    template <class> friend class __val_expr;
+};
+
+// gslice_array
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY gslice_array
+{
+public:
+    typedef _Tp value_type;
+
+private:
+    value_type*      __vp_;
+    valarray<size_t> __1d_;
+
+public:
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator*=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator/=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator%=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator+=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator-=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator^=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator&=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator|=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator<<=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator>>=(const _Expr& __v) const;
+
+    const gslice_array& operator=(const gslice_array& __ga) const;
+
+    void operator=(const value_type& __x) const;
+
+//  gslice_array(const gslice_array&)            = default;
+//  gslice_array(gslice_array&&)                 = default;
+//  gslice_array& operator=(const gslice_array&) = default;
+//  gslice_array& operator=(gslice_array&&)      = default;
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    gslice_array(const gslice& __gs, const valarray<value_type>& __v)
+        : __vp_(const_cast<value_type*>(__v.__begin_)),
+          __1d_(__gs.__1d_)
+        {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    gslice_array(gslice&& __gs, const valarray<value_type>& __v)
+        : __vp_(const_cast<value_type*>(__v.__begin_)),
+          __1d_(move(__gs.__1d_))
+        {}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    template <class> friend class valarray;
+};
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] = __v[__j];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator*=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] *= __v[__j];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator/=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] /= __v[__j];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator%=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] %= __v[__j];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator+=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] += __v[__j];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator-=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] -= __v[__j];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator^=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] ^= __v[__j];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator&=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] &= __v[__j];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator|=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] |= __v[__j];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator<<=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] <<= __v[__j];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+gslice_array<_Tp>::operator>>=(const _Expr& __v) const
+{
+    typedef const size_t* _Ip;
+    size_t __j = 0;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+        __vp_[*__i] >>= __v[__j];
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+const gslice_array<_Tp>&
+gslice_array<_Tp>::operator=(const gslice_array& __ga) const
+{
+    typedef const size_t* _Ip;
+    const value_type* __s = __ga.__vp_;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_;
+            __i != __e; ++__i, ++__j)
+        __vp_[*__i] = __s[*__j];
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+gslice_array<_Tp>::operator=(const value_type& __x) const
+{
+    typedef const size_t* _Ip;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
+        __vp_[*__i] = __x;
+}
+
+// mask_array
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY mask_array
+{
+public:
+    typedef _Tp value_type;
+
+private:
+    value_type*      __vp_;
+    valarray<size_t> __1d_;
+
+public:
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator*=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator/=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator%=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator+=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator-=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator^=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator&=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator|=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator<<=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator>>=(const _Expr& __v) const;
+
+    const mask_array& operator=(const mask_array& __ma) const;
+
+    void operator=(const value_type& __x) const;
+
+//  mask_array(const mask_array&)            = default;
+//  mask_array(mask_array&&)                 = default;
+//  mask_array& operator=(const mask_array&) = default;
+//  mask_array& operator=(mask_array&&)      = default;
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
+        : __vp_(const_cast<value_type*>(__v.__begin_)),
+          __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
+          {
+              size_t __j = 0;
+              for (size_t __i = 0; __i < __vb.size(); ++__i)
+                  if (__vb[__i])
+                      __1d_[__j++] = __i;
+          }
+
+    template <class> friend class valarray;
+};
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] = __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator*=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] *= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator/=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] /= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator%=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] %= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator+=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] += __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator-=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] -= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator^=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] ^= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator&=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] &= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator|=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] |= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator<<=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] <<= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+mask_array<_Tp>::operator>>=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] >>= __v[__i];
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+const mask_array<_Tp>&
+mask_array<_Tp>::operator=(const mask_array& __ma) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+mask_array<_Tp>::operator=(const value_type& __x) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] = __x;
+}
+
+template <class _ValExpr>
+class __mask_expr
+{
+    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
+public:
+    typedef typename _RmExpr::value_type value_type;
+    typedef value_type result_type;
+
+private:
+    _ValExpr __expr_;
+    valarray<size_t> __1d_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
+        : __expr_(__e),
+          __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
+          {
+              size_t __j = 0;
+              for (size_t __i = 0; __i < __vb.size(); ++__i)
+                  if (__vb[__i])
+                      __1d_[__j++] = __i;
+          }
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator[](size_t __i) const
+        {return __expr_[__1d_[__i]];}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __1d_.size();}
+
+    template <class> friend class valarray;
+};
+
+// indirect_array
+
+template <class _Tp>
+class _LIBCPP_TYPE_VIS_ONLY indirect_array
+{
+public:
+    typedef _Tp value_type;
+
+private:
+    value_type*      __vp_;
+    valarray<size_t> __1d_;
+
+public:
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator*=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator/=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator%=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator+=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator-=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator^=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator&=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator|=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator<<=(const _Expr& __v) const;
+
+    template <class _Expr>
+    typename enable_if
+    <
+        __is_val_expr<_Expr>::value,
+        void
+    >::type
+    operator>>=(const _Expr& __v) const;
+
+    const indirect_array& operator=(const indirect_array& __ia) const;
+
+    void operator=(const value_type& __x) const;
+
+//  indirect_array(const indirect_array&)            = default;
+//  indirect_array(indirect_array&&)                 = default;
+//  indirect_array& operator=(const indirect_array&) = default;
+//  indirect_array& operator=(indirect_array&&)      = default;
+
+private:
+     _LIBCPP_INLINE_VISIBILITY
+   indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
+        : __vp_(const_cast<value_type*>(__v.__begin_)),
+          __1d_(__ia)
+        {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
+        : __vp_(const_cast<value_type*>(__v.__begin_)),
+          __1d_(move(__ia))
+        {}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    template <class> friend class valarray;
+};
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] = __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator*=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] *= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator/=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] /= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator%=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] %= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator+=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] += __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator-=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] -= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator^=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] ^= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator&=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] &= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator|=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] |= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator<<=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] <<= __v[__i];
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    void
+>::type
+indirect_array<_Tp>::operator>>=(const _Expr& __v) const
+{
+    size_t __n = __1d_.size();
+    for (size_t __i = 0; __i < __n; ++__i)
+        __vp_[__1d_[__i]] >>= __v[__i];
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+const indirect_array<_Tp>&
+indirect_array<_Tp>::operator=(const indirect_array& __ia) const
+{
+    typedef const size_t* _Ip;
+    const value_type* __s = __ia.__vp_;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_;
+            __i != __e; ++__i, ++__j)
+        __vp_[*__i] = __s[*__j];
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+indirect_array<_Tp>::operator=(const value_type& __x) const
+{
+    typedef const size_t* _Ip;
+    for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
+        __vp_[*__i] = __x;
+}
+
+template <class _ValExpr>
+class __indirect_expr
+{
+    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
+public:
+    typedef typename _RmExpr::value_type value_type;
+    typedef value_type result_type;
+
+private:
+    _ValExpr __expr_;
+    valarray<size_t> __1d_;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e)
+        : __expr_(__e),
+          __1d_(__ia)
+          {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+    _LIBCPP_INLINE_VISIBILITY
+    __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
+        : __expr_(__e),
+          __1d_(move(__ia))
+          {}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator[](size_t __i) const
+        {return __expr_[__1d_[__i]];}
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __1d_.size();}
+
+    template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
+};
+
+template<class _ValExpr>
+class __val_expr
+{
+    typedef typename remove_reference<_ValExpr>::type  _RmExpr;
+
+    _ValExpr __expr_;
+public:
+    typedef typename _RmExpr::value_type value_type;
+    typedef typename _RmExpr::result_type result_type;
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type operator[](size_t __i) const
+        {return __expr_[__i];}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
+        {return __val_expr<__slice_expr<_ValExpr> >(__expr_, __s);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
+        {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __gs.__1d_);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
+        {return __val_expr<__mask_expr<_ValExpr> >(__expr_, __vb);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
+        {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __vs);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
+    operator+() const
+    {
+        typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
+        return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<_UnaryOp<negate<value_type>, _ValExpr> >
+    operator-() const
+    {
+        typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
+        return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> >
+    operator~() const
+    {
+        typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
+        return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> >
+    operator!() const
+    {
+        typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
+        return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
+    }
+
+    operator valarray<result_type>() const;
+
+    _LIBCPP_INLINE_VISIBILITY
+    size_t size() const {return __expr_.size();}
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type sum() const
+    {
+        size_t __n = __expr_.size();
+        result_type __r = __n ? __expr_[0] : result_type();
+        for (size_t __i = 1; __i < __n; ++__i)
+            __r += __expr_[__i];
+        return __r;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type min() const
+    {
+        size_t __n = size();
+        result_type __r = __n ? (*this)[0] : result_type();
+        for (size_t __i = 1; __i < __n; ++__i)
+        {
+            result_type __x = __expr_[__i];
+            if (__x < __r)
+                __r = __x;
+        }
+        return __r;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    result_type max() const
+    {
+        size_t __n = size();
+        result_type __r = __n ? (*this)[0] : result_type();
+        for (size_t __i = 1; __i < __n; ++__i)
+        {
+            result_type __x = __expr_[__i];
+            if (__r < __x)
+                __r = __x;
+        }
+        return __r;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<__shift_expr<_ValExpr> > shift (int __i) const
+        {return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const
+        {return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));}
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(value_type)>, _ValExpr> >
+    apply(value_type __f(value_type)) const
+    {
+        typedef __apply_expr<value_type, value_type(*)(value_type)> _Op;
+        typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
+        return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(const value_type&)>, _ValExpr> >
+    apply(value_type __f(const value_type&)) const
+    {
+        typedef __apply_expr<value_type, value_type(*)(const value_type&)> _Op;
+        typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
+        return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
+    }
+};
+
+template<class _ValExpr>
+__val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
+{
+    valarray<result_type> __r;
+    size_t __n = __expr_.size();
+    if (__n)
+    {
+        __r.__begin_ =
+            __r.__end_ =
+                static_cast<result_type*>(_VSTD::__allocate(__n * sizeof(result_type)));
+        for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
+            ::new (__r.__end_) result_type(__expr_[__i]);
+    }
+    return __r;
+}
+
+// valarray
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>::valarray(size_t __n)
+    : __begin_(0),
+      __end_(0)
+{
+    resize(__n);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>::valarray(const value_type& __x, size_t __n)
+    : __begin_(0),
+      __end_(0)
+{
+    resize(__n, __x);
+}
+
+template <class _Tp>
+valarray<_Tp>::valarray(const value_type* __p, size_t __n)
+    : __begin_(0),
+      __end_(0)
+{
+    if (__n)
+    {
+        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (; __n; ++__end_, ++__p, --__n)
+                ::new (__end_) value_type(*__p);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            resize(0);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+template <class _Tp>
+valarray<_Tp>::valarray(const valarray& __v)
+    : __begin_(0),
+      __end_(0)
+{
+    if (__v.size())
+    {
+        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__v.size() * sizeof(value_type)));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
+                ::new (__end_) value_type(*__p);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            resize(0);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
+    : __begin_(__v.__begin_),
+      __end_(__v.__end_)
+{
+    __v.__begin_ = __v.__end_ = nullptr;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp>
+valarray<_Tp>::valarray(initializer_list<value_type> __il)
+    : __begin_(0),
+      __end_(0)
+{
+    size_t __n = __il.size();
+    if (__n)
+    {
+        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (const value_type* __p = __il.begin(); __n; ++__end_, ++__p, --__n)
+                ::new (__end_) value_type(*__p);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            resize(0);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp>
+valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
+    : __begin_(0),
+      __end_(0)
+{
+    size_t __n = __sa.__size_;
+    if (__n)
+    {
+        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (const value_type* __p = __sa.__vp_; __n; ++__end_, __p += __sa.__stride_, --__n)
+                ::new (__end_) value_type(*__p);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            resize(0);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+template <class _Tp>
+valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
+    : __begin_(0),
+      __end_(0)
+{
+    size_t __n = __ga.__1d_.size();
+    if (__n)
+    {
+        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            typedef const size_t* _Ip;
+            const value_type* __s = __ga.__vp_;
+            for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
+                    __i != __e; ++__i, ++__end_)
+                ::new (__end_) value_type(__s[*__i]);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            resize(0);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+template <class _Tp>
+valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
+    : __begin_(0),
+      __end_(0)
+{
+    size_t __n = __ma.__1d_.size();
+    if (__n)
+    {
+        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            typedef const size_t* _Ip;
+            const value_type* __s = __ma.__vp_;
+            for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
+                    __i != __e; ++__i, ++__end_)
+                ::new (__end_) value_type(__s[*__i]);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            resize(0);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+template <class _Tp>
+valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
+    : __begin_(0),
+      __end_(0)
+{
+    size_t __n = __ia.__1d_.size();
+    if (__n)
+    {
+        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            typedef const size_t* _Ip;
+            const value_type* __s = __ia.__vp_;
+            for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
+                    __i != __e; ++__i, ++__end_)
+                ::new (__end_) value_type(__s[*__i]);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            resize(0);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>::~valarray()
+{
+    resize(0);
+}
+
+template <class _Tp>
+valarray<_Tp>&
+valarray<_Tp>::operator=(const valarray& __v)
+{
+    if (this != &__v)
+    {
+        if (size() != __v.size())
+            resize(__v.size());
+        _VSTD::copy(__v.__begin_, __v.__end_, __begin_);
+    }
+    return *this;
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
+{
+    resize(0);
+    __begin_ = __v.__begin_;
+    __end_ = __v.__end_;
+    __v.__begin_ = nullptr;
+    __v.__end_ = nullptr;
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator=(initializer_list<value_type> __il)
+{
+    if (size() != __il.size())
+        resize(__il.size());
+    _VSTD::copy(__il.begin(), __il.end(), __begin_);
+    return *this;
+}
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator=(const value_type& __x)
+{
+    _VSTD::fill(__begin_, __end_, __x);
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator=(const slice_array<value_type>& __sa)
+{
+    value_type* __t = __begin_;
+    const value_type* __s = __sa.__vp_;
+    for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
+        *__t = *__s;
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
+{
+    typedef const size_t* _Ip;
+    value_type* __t = __begin_;
+    const value_type* __s = __ga.__vp_;
+    for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
+                    __i != __e; ++__i, ++__t)
+        *__t = __s[*__i];
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator=(const mask_array<value_type>& __ma)
+{
+    typedef const size_t* _Ip;
+    value_type* __t = __begin_;
+    const value_type* __s = __ma.__vp_;
+    for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
+                    __i != __e; ++__i, ++__t)
+        *__t = __s[*__i];
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
+{
+    typedef const size_t* _Ip;
+    value_type* __t = __begin_;
+    const value_type* __s = __ia.__vp_;
+    for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
+                    __i != __e; ++__i, ++__t)
+        *__t = __s[*__i];
+    return *this;
+}
+
+template <class _Tp>
+template <class _ValExpr>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
+{
+    size_t __n = __v.size();
+    if (size() != __n)
+        resize(__n);
+    value_type* __t = __begin_;
+    for (size_t __i = 0; __i != __n; ++__t, ++__i)
+        *__t = result_type(__v[__i]);
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__val_expr<__slice_expr<const valarray<_Tp>&> >
+valarray<_Tp>::operator[](slice __s) const
+{
+    return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+slice_array<_Tp>
+valarray<_Tp>::operator[](slice __s)
+{
+    return slice_array<value_type>(__s, *this);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__val_expr<__indirect_expr<const valarray<_Tp>&> >
+valarray<_Tp>::operator[](const gslice& __gs) const
+{
+    return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+gslice_array<_Tp>
+valarray<_Tp>::operator[](const gslice& __gs)
+{
+    return gslice_array<value_type>(__gs, *this);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__val_expr<__indirect_expr<const valarray<_Tp>&> >
+valarray<_Tp>::operator[](gslice&& __gs) const
+{
+    return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__gs.__1d_), *this));
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+gslice_array<_Tp>
+valarray<_Tp>::operator[](gslice&& __gs)
+{
+    return gslice_array<value_type>(move(__gs), *this);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__val_expr<__mask_expr<const valarray<_Tp>&> >
+valarray<_Tp>::operator[](const valarray<bool>& __vb) const
+{
+    return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+mask_array<_Tp>
+valarray<_Tp>::operator[](const valarray<bool>& __vb)
+{
+    return mask_array<value_type>(__vb, *this);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__val_expr<__mask_expr<const valarray<_Tp>&> >
+valarray<_Tp>::operator[](valarray<bool>&& __vb) const
+{
+    return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(move(__vb), *this));
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+mask_array<_Tp>
+valarray<_Tp>::operator[](valarray<bool>&& __vb)
+{
+    return mask_array<value_type>(move(__vb), *this);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__val_expr<__indirect_expr<const valarray<_Tp>&> >
+valarray<_Tp>::operator[](const valarray<size_t>& __vs) const
+{
+    return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+indirect_array<_Tp>
+valarray<_Tp>::operator[](const valarray<size_t>& __vs)
+{
+    return indirect_array<value_type>(__vs, *this);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__val_expr<__indirect_expr<const valarray<_Tp>&> >
+valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
+{
+    return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__vs), *this));
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+indirect_array<_Tp>
+valarray<_Tp>::operator[](valarray<size_t>&& __vs)
+{
+    return indirect_array<value_type>(move(__vs), *this);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp>
+valarray<_Tp>
+valarray<_Tp>::operator+() const
+{
+    valarray<value_type> __r;
+    size_t __n = size();
+    if (__n)
+    {
+        __r.__begin_ =
+            __r.__end_ =
+                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
+            ::new (__r.__end_) value_type(+*__p);
+    }
+    return __r;
+}
+
+template <class _Tp>
+valarray<_Tp>
+valarray<_Tp>::operator-() const
+{
+    valarray<value_type> __r;
+    size_t __n = size();
+    if (__n)
+    {
+        __r.__begin_ =
+            __r.__end_ =
+                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
+            ::new (__r.__end_) value_type(-*__p);
+    }
+    return __r;
+}
+
+template <class _Tp>
+valarray<_Tp>
+valarray<_Tp>::operator~() const
+{
+    valarray<value_type> __r;
+    size_t __n = size();
+    if (__n)
+    {
+        __r.__begin_ =
+            __r.__end_ =
+                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
+            ::new (__r.__end_) value_type(~*__p);
+    }
+    return __r;
+}
+
+template <class _Tp>
+valarray<bool>
+valarray<_Tp>::operator!() const
+{
+    valarray<bool> __r;
+    size_t __n = size();
+    if (__n)
+    {
+        __r.__begin_ =
+            __r.__end_ =
+                static_cast<bool*>(_VSTD::__allocate(__n * sizeof(bool)));
+        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
+            ::new (__r.__end_) bool(!*__p);
+    }
+    return __r;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator*=(const value_type& __x)
+{
+    for (value_type* __p = __begin_; __p != __end_; ++__p)
+        *__p *= __x;
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator/=(const value_type& __x)
+{
+    for (value_type* __p = __begin_; __p != __end_; ++__p)
+        *__p /= __x;
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator%=(const value_type& __x)
+{
+    for (value_type* __p = __begin_; __p != __end_; ++__p)
+        *__p %= __x;
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator+=(const value_type& __x)
+{
+    for (value_type* __p = __begin_; __p != __end_; ++__p)
+        *__p += __x;
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator-=(const value_type& __x)
+{
+    for (value_type* __p = __begin_; __p != __end_; ++__p)
+        *__p -= __x;
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator^=(const value_type& __x)
+{
+    for (value_type* __p = __begin_; __p != __end_; ++__p)
+        *__p ^= __x;
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator&=(const value_type& __x)
+{
+    for (value_type* __p = __begin_; __p != __end_; ++__p)
+        *__p &= __x;
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator|=(const value_type& __x)
+{
+    for (value_type* __p = __begin_; __p != __end_; ++__p)
+        *__p |= __x;
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator<<=(const value_type& __x)
+{
+    for (value_type* __p = __begin_; __p != __end_; ++__p)
+        *__p <<= __x;
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+valarray<_Tp>&
+valarray<_Tp>::operator>>=(const value_type& __x)
+{
+    for (value_type* __p = __begin_; __p != __end_; ++__p)
+        *__p >>= __x;
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    valarray<_Tp>&
+>::type
+valarray<_Tp>::operator*=(const _Expr& __v)
+{
+    size_t __i = 0;
+    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
+        *__t *= __v[__i];
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    valarray<_Tp>&
+>::type
+valarray<_Tp>::operator/=(const _Expr& __v)
+{
+    size_t __i = 0;
+    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
+        *__t /= __v[__i];
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    valarray<_Tp>&
+>::type
+valarray<_Tp>::operator%=(const _Expr& __v)
+{
+    size_t __i = 0;
+    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
+        *__t %= __v[__i];
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    valarray<_Tp>&
+>::type
+valarray<_Tp>::operator+=(const _Expr& __v)
+{
+    size_t __i = 0;
+    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
+        *__t += __v[__i];
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    valarray<_Tp>&
+>::type
+valarray<_Tp>::operator-=(const _Expr& __v)
+{
+    size_t __i = 0;
+    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
+        *__t -= __v[__i];
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    valarray<_Tp>&
+>::type
+valarray<_Tp>::operator^=(const _Expr& __v)
+{
+    size_t __i = 0;
+    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
+        *__t ^= __v[__i];
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    valarray<_Tp>&
+>::type
+valarray<_Tp>::operator|=(const _Expr& __v)
+{
+    size_t __i = 0;
+    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
+        *__t |= __v[__i];
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    valarray<_Tp>&
+>::type
+valarray<_Tp>::operator&=(const _Expr& __v)
+{
+    size_t __i = 0;
+    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
+        *__t &= __v[__i];
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    valarray<_Tp>&
+>::type
+valarray<_Tp>::operator<<=(const _Expr& __v)
+{
+    size_t __i = 0;
+    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
+        *__t <<= __v[__i];
+    return *this;
+}
+
+template <class _Tp>
+template <class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    valarray<_Tp>&
+>::type
+valarray<_Tp>::operator>>=(const _Expr& __v)
+{
+    size_t __i = 0;
+    for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
+        *__t >>= __v[__i];
+    return *this;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+valarray<_Tp>::swap(valarray& __v) _NOEXCEPT
+{
+    _VSTD::swap(__begin_, __v.__begin_);
+    _VSTD::swap(__end_, __v.__end_);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+valarray<_Tp>::sum() const
+{
+    if (__begin_ == __end_)
+        return value_type();
+    const value_type* __p = __begin_;
+    _Tp __r = *__p;
+    for (++__p; __p != __end_; ++__p)
+        __r += *__p;
+    return __r;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+valarray<_Tp>::min() const
+{
+    if (__begin_ == __end_)
+        return value_type();
+    return *_VSTD::min_element(__begin_, __end_);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+valarray<_Tp>::max() const
+{
+    if (__begin_ == __end_)
+        return value_type();
+    return *_VSTD::max_element(__begin_, __end_);
+}
+
+template <class _Tp>
+valarray<_Tp>
+valarray<_Tp>::shift(int __i) const
+{
+    valarray<value_type> __r;
+    size_t __n = size();
+    if (__n)
+    {
+        __r.__begin_ =
+            __r.__end_ =
+                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+        const value_type* __sb;
+        value_type* __tb;
+        value_type* __te;
+        if (__i >= 0)
+        {
+            __i = _VSTD::min(__i, static_cast<int>(__n));
+            __sb = __begin_ + __i;
+            __tb = __r.__begin_;
+            __te = __r.__begin_ + (__n - __i);
+        }
+        else
+        {
+            __i = _VSTD::min(-__i, static_cast<int>(__n));
+            __sb = __begin_;
+            __tb = __r.__begin_ + __i;
+            __te = __r.__begin_ + __n;
+        }
+        for (; __r.__end_ != __tb; ++__r.__end_)
+            ::new (__r.__end_) value_type();
+        for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
+            ::new (__r.__end_) value_type(*__sb);
+        for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
+            ::new (__r.__end_) value_type();
+    }
+    return __r;
+}
+
+template <class _Tp>
+valarray<_Tp>
+valarray<_Tp>::cshift(int __i) const
+{
+    valarray<value_type> __r;
+    size_t __n = size();
+    if (__n)
+    {
+        __r.__begin_ =
+            __r.__end_ =
+                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+        __i %= static_cast<int>(__n);
+        const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
+        for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
+            ::new (__r.__end_) value_type(*__s);
+        for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
+            ::new (__r.__end_) value_type(*__s);
+    }
+    return __r;
+}
+
+template <class _Tp>
+valarray<_Tp>
+valarray<_Tp>::apply(value_type __f(value_type)) const
+{
+    valarray<value_type> __r;
+    size_t __n = size();
+    if (__n)
+    {
+        __r.__begin_ =
+            __r.__end_ =
+                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
+            ::new (__r.__end_) value_type(__f(*__p));
+    }
+    return __r;
+}
+
+template <class _Tp>
+valarray<_Tp>
+valarray<_Tp>::apply(value_type __f(const value_type&)) const
+{
+    valarray<value_type> __r;
+    size_t __n = size();
+    if (__n)
+    {
+        __r.__begin_ =
+            __r.__end_ =
+                static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+        for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
+            ::new (__r.__end_) value_type(__f(*__p));
+    }
+    return __r;
+}
+
+template <class _Tp>
+void
+valarray<_Tp>::resize(size_t __n, value_type __x)
+{
+    if (__begin_ != nullptr)
+    {
+        while (__end_ != __begin_)
+            (--__end_)->~value_type();
+        _VSTD::__deallocate(__begin_);
+        __begin_ = __end_ = nullptr;
+    }
+    if (__n)
+    {
+        __begin_ = __end_ = static_cast<value_type*>(_VSTD::__allocate(__n * sizeof(value_type)));
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            for (; __n; --__n, ++__end_)
+                ::new (__end_) value_type(__x);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            resize(0);
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT
+{
+    __x.swap(__y);
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator*(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator*(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(multiplies<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator*(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(multiplies<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator/(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator/(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(divides<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<divides<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator/(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(divides<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator%(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator%(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(modulus<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator%(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(modulus<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator+(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator+(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(plus<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<plus<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator+(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(plus<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator-(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator-(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(minus<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<minus<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator-(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(minus<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator^(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator^(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(bit_xor<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator^(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(bit_xor<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator&(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator&(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(bit_and<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator&(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(bit_and<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator|(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator|(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(bit_or<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator|(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(bit_or<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator<<(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator<<(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator<<(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator>>(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator>>(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator>>(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator&&(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator&&(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(logical_and<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator&&(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(logical_and<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator||(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator||(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(logical_or<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator||(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(logical_or<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator==(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator==(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(equal_to<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator==(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(equal_to<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator!=(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator!=(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator!=(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator<(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<less<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator<(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(less<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<less<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator<(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(less<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator>(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator>(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(greater<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<greater<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator>(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(greater<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator<=(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator<=(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(less_equal<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator<=(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(less_equal<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+operator>=(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+operator>=(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(greater_equal<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+operator>=(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(greater_equal<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
+>::type
+abs(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
+>::type
+acos(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
+>::type
+asin(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
+>::type
+atan(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+atan2(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+atan2(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+atan2(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
+>::type
+cos(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
+>::type
+cosh(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
+>::type
+exp(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
+>::type
+log(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
+>::type
+log10(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
+}
+
+template<class _Expr1, class _Expr2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value,
+    __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
+>::type
+pow(const _Expr1& __x, const _Expr2& __y)
+{
+    typedef typename _Expr1::value_type value_type;
+    typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
+    return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
+               _Expr, __scalar_expr<typename _Expr::value_type> > >
+>::type
+pow(const _Expr& __x, const typename _Expr::value_type& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+    return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
+                           __x, __scalar_expr<value_type>(__y, __x.size())));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
+               __scalar_expr<typename _Expr::value_type>, _Expr> >
+>::type
+pow(const typename _Expr::value_type& __x, const _Expr& __y)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
+                           __scalar_expr<value_type>(__x, __y.size()), __y));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
+>::type
+sin(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
+>::type
+sinh(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
+>::type
+sqrt(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
+>::type
+tan(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
+}
+
+template<class _Expr>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    __is_val_expr<_Expr>::value,
+    __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
+>::type
+tanh(const _Expr& __x)
+{
+    typedef typename _Expr::value_type value_type;
+    typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
+    return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+begin(valarray<_Tp>& __v)
+{
+    return __v.__begin_;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+const _Tp*
+begin(const valarray<_Tp>& __v)
+{
+    return __v.__begin_;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+end(valarray<_Tp>& __v)
+{
+    return __v.__end_;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+const _Tp*
+end(const valarray<_Tp>& __v)
+{
+    return __v.__end_;
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // _LIBCPP_VALARRAY

Property changes on: lab4/.minix-src/include/c++/valarray
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/adxintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/adxintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/adxintrin.h	(revision 13)
@@ -0,0 +1,83 @@
+/*===---- adxintrin.h - ADX intrinsics -------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef __ADXINTRIN_H
+#define __ADXINTRIN_H
+
+/* Intrinsics that are available only if __ADX__ defined */
+#ifdef __ADX__
+static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
+_addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
+               unsigned int *__p)
+{
+  return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
+}
+
+#ifdef __x86_64__
+static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
+_addcarryx_u64(unsigned char __cf, unsigned long long __x,
+               unsigned long long __y, unsigned long long  *__p)
+{
+  return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
+}
+#endif
+#endif
+
+/* Intrinsics that are also available if __ADX__ undefined */
+static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
+_addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
+              unsigned int *__p)
+{
+  return __builtin_ia32_addcarry_u32(__cf, __x, __y, __p);
+}
+
+#ifdef __x86_64__
+static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
+_addcarry_u64(unsigned char __cf, unsigned long long __x,
+              unsigned long long __y, unsigned long long  *__p)
+{
+  return __builtin_ia32_addcarry_u64(__cf, __x, __y, __p);
+}
+#endif
+
+static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
+_subborrow_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
+              unsigned int *__p)
+{
+  return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
+}
+
+#ifdef __x86_64__
+static __inline unsigned char __attribute__((__always_inline__, __nodebug__))
+_subborrow_u64(unsigned char __cf, unsigned long long __x,
+               unsigned long long __y, unsigned long long  *__p)
+{
+  return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
+}
+#endif
+
+#endif /* __ADXINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/adxintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/avx512erintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/avx512erintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/avx512erintrin.h	(revision 13)
@@ -0,0 +1,112 @@
+/*===---- avx512fintrin.h - AVX2 intrinsics -----------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+#ifndef __IMMINTRIN_H
+#error "Never use <avx512erintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef __AVX512ERINTRIN_H
+#define __AVX512ERINTRIN_H
+
+
+// rsqrt28
+static  __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_rsqrt28_round_pd (__m512d __A, int __R)
+{
+  return (__m512d)__builtin_ia32_rsqrt28pd_mask ((__v8df)__A,
+                                                 (__v8df)_mm512_setzero_pd(),
+                                                 (__mmask8)-1,
+                                                 __R);
+}
+static  __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_rsqrt28_round_ps(__m512 __A, int __R)
+{
+  return (__m512)__builtin_ia32_rsqrt28ps_mask ((__v16sf)__A,
+                                                (__v16sf)_mm512_setzero_ps(),
+                                                (__mmask16)-1,
+                                                __R);
+}
+
+static  __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_rsqrt28_round_ss(__m128 __A, __m128 __B, int __R)
+{
+  return (__m128) __builtin_ia32_rsqrt28ss_mask ((__v4sf) __A,
+             (__v4sf) __B,
+             (__v4sf)
+             _mm_setzero_ps (),
+             (__mmask8) -1,
+             __R);
+}
+
+static  __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_rsqrt28_round_sd (__m128d __A, __m128d __B, int __R)
+{
+  return (__m128d) __builtin_ia32_rsqrt28sd_mask ((__v2df) __A,
+              (__v2df) __B,
+              (__v2df)
+              _mm_setzero_pd (),
+              (__mmask8) -1,
+             __R);
+}
+
+
+// rcp28
+static  __inline__ __m512d __attribute__((__always_inline__, __nodebug__))
+_mm512_rcp28_round_pd (__m512d __A, int __R)
+{
+  return (__m512d)__builtin_ia32_rcp28pd_mask ((__v8df)__A,
+                                               (__v8df)_mm512_setzero_pd(),
+                                               (__mmask8)-1,
+                                               __R);
+}
+
+static  __inline__ __m512 __attribute__((__always_inline__, __nodebug__))
+_mm512_rcp28_round_ps (__m512 __A, int __R)
+{
+  return (__m512)__builtin_ia32_rcp28ps_mask ((__v16sf)__A,
+                                              (__v16sf)_mm512_setzero_ps (),
+                                              (__mmask16)-1,
+                                              __R);
+}
+
+static  __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_rcp28_round_ss (__m128 __A, __m128 __B, int __R)
+{
+  return (__m128) __builtin_ia32_rcp28ss_mask ((__v4sf) __A,
+             (__v4sf) __B,
+             (__v4sf)
+             _mm_setzero_ps (),
+             (__mmask8) -1,
+             __R);
+}
+static  __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_rcp28_round_sd (__m128d __A, __m128d __B, int __R)
+{
+  return (__m128d) __builtin_ia32_rcp28sd_mask ((__v2df) __A,
+              (__v2df) __B,
+              (__v2df)
+              _mm_setzero_pd (),
+              (__mmask8) -1,
+             __R);
+}
+
+#endif // __AVX512ERINTRIN_H

Property changes on: lab4/.minix-src/include/clang-3.6/avx512erintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/avx512vlintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/avx512vlintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/avx512vlintrin.h	(revision 13)
@@ -0,0 +1,83 @@
+/*===---- avx512vlintrin.h - AVX512VL intrinsics ---------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use <avx512vlintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef __AVX512VLINTRIN_H
+#define __AVX512VLINTRIN_H
+
+/* Integer compare */
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_epi32_mask(__m128i __a, __m128i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqd128_mask((__v4si)__a, (__v4si)__b,
+                                                  (__mmask8)-1);
+}
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm_mask_cmpeq_epi32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqd128_mask((__v4si)__a, (__v4si)__b,
+                                                  __u);
+}
+
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpeq_epi32_mask(__m256i __a, __m256i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqd256_mask((__v8si)__a, (__v8si)__b,
+                                                  (__mmask8)-1);
+}
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm256_mask_cmpeq_epi32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqd256_mask((__v8si)__a, (__v8si)__b,
+                                                  __u);
+}
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_epi64_mask(__m128i __a, __m128i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqq128_mask((__v2di)__a, (__v2di)__b,
+                                                  (__mmask8)-1);
+}
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm_mask_cmpeq_epi64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqq128_mask((__v2di)__a, (__v2di)__b,
+                                                  __u);
+}
+
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm256_cmpeq_epi64_mask(__m256i __a, __m256i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqq256_mask((__v4di)__a, (__v4di)__b,
+                                                  (__mmask8)-1);
+}
+
+static __inline__ __mmask8 __attribute__((__always_inline__, __nodebug__))
+_mm256_mask_cmpeq_epi64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
+  return (__mmask8)__builtin_ia32_pcmpeqq256_mask((__v4di)__a, (__v4di)__b,
+                                                  __u);
+}
+
+#endif /* __AVX512VLINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/avx512vlintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/cpuid.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/cpuid.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/cpuid.h	(revision 13)
@@ -0,0 +1,209 @@
+/*===---- cpuid.h - X86 cpu model detection --------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#if !(__x86_64__ || __i386__)
+#error this header is for x86 only
+#endif
+
+/* Responses identification request with %eax 0 */
+/* AMD:     "AuthenticAMD" */
+#define signature_AMD_ebx 0x68747541
+#define signature_AMD_edx 0x69746e65
+#define signature_AMD_ecx 0x444d4163
+/* CENTAUR: "CentaurHauls" */
+#define signature_CENTAUR_ebx 0x746e6543
+#define signature_CENTAUR_edx 0x48727561
+#define signature_CENTAUR_ecx 0x736c7561
+/* CYRIX:   "CyrixInstead" */
+#define signature_CYRIX_ebx 0x69727943
+#define signature_CYRIX_edx 0x736e4978
+#define signature_CYRIX_ecx 0x64616574
+/* INTEL:   "GenuineIntel" */
+#define signature_INTEL_ebx 0x756e6547
+#define signature_INTEL_edx 0x49656e69
+#define signature_INTEL_ecx 0x6c65746e
+/* TM1:     "TransmetaCPU" */
+#define signature_TM1_ebx 0x6e617254
+#define signature_TM1_edx 0x74656d73
+#define signature_TM1_ecx 0x55504361
+/* TM2:     "GenuineTMx86" */
+#define signature_TM2_ebx 0x756e6547
+#define signature_TM2_edx 0x54656e69
+#define signature_TM2_ecx 0x3638784d
+/* NSC:     "Geode by NSC" */
+#define signature_NSC_ebx 0x646f6547
+#define signature_NSC_edx 0x43534e20
+#define signature_NSC_ecx 0x79622065
+/* NEXGEN:  "NexGenDriven" */
+#define signature_NEXGEN_ebx 0x4778654e
+#define signature_NEXGEN_edx 0x72446e65
+#define signature_NEXGEN_ecx 0x6e657669
+/* RISE:    "RiseRiseRise" */
+#define signature_RISE_ebx 0x65736952
+#define signature_RISE_edx 0x65736952
+#define signature_RISE_ecx 0x65736952
+/* SIS:     "SiS SiS SiS " */
+#define signature_SIS_ebx 0x20536953
+#define signature_SIS_edx 0x20536953
+#define signature_SIS_ecx 0x20536953
+/* UMC:     "UMC UMC UMC " */
+#define signature_UMC_ebx 0x20434d55
+#define signature_UMC_edx 0x20434d55
+#define signature_UMC_ecx 0x20434d55
+/* VIA:     "VIA VIA VIA " */
+#define signature_VIA_ebx 0x20414956
+#define signature_VIA_edx 0x20414956
+#define signature_VIA_ecx 0x20414956
+/* VORTEX:  "Vortex86 SoC" */
+#define signature_VORTEX_ebx 0x74726f56
+#define signature_VORTEX_edx 0x36387865
+#define signature_VORTEX_ecx 0x436f5320
+
+/* Features in %ecx for level 1 */
+#define bit_SSE3        0x00000001
+#define bit_PCLMULQDQ   0x00000002
+#define bit_DTES64      0x00000004
+#define bit_MONITOR     0x00000008
+#define bit_DSCPL       0x00000010
+#define bit_VMX         0x00000020
+#define bit_SMX         0x00000040
+#define bit_EIST        0x00000080
+#define bit_TM2         0x00000100
+#define bit_SSSE3       0x00000200
+#define bit_CNXTID      0x00000400
+#define bit_FMA         0x00001000
+#define bit_CMPXCHG16B  0x00002000
+#define bit_xTPR        0x00004000
+#define bit_PDCM        0x00008000
+#define bit_PCID        0x00020000
+#define bit_DCA         0x00040000
+#define bit_SSE41       0x00080000
+#define bit_SSE42       0x00100000
+#define bit_x2APIC      0x00200000
+#define bit_MOVBE       0x00400000
+#define bit_POPCNT      0x00800000
+#define bit_TSCDeadline 0x01000000
+#define bit_AESNI       0x02000000
+#define bit_XSAVE       0x04000000
+#define bit_OSXSAVE     0x08000000
+#define bit_AVX         0x10000000
+#define bit_RDRND       0x40000000
+
+/* Features in %edx for level 1 */
+#define bit_FPU         0x00000001
+#define bit_VME         0x00000002
+#define bit_DE          0x00000004
+#define bit_PSE         0x00000008
+#define bit_TSC         0x00000010
+#define bit_MSR         0x00000020
+#define bit_PAE         0x00000040
+#define bit_MCE         0x00000080
+#define bit_CX8         0x00000100
+#define bit_APIC        0x00000200
+#define bit_SEP         0x00000800
+#define bit_MTRR        0x00001000
+#define bit_PGE         0x00002000
+#define bit_MCA         0x00004000
+#define bit_CMOV        0x00008000
+#define bit_PAT         0x00010000
+#define bit_PSE36       0x00020000
+#define bit_PSN         0x00040000
+#define bit_CLFSH       0x00080000
+#define bit_DS          0x00200000
+#define bit_ACPI        0x00400000
+#define bit_MMX         0x00800000
+#define bit_FXSR        0x01000000
+#define bit_FXSAVE      bit_FXSR    /* for gcc compat */
+#define bit_SSE         0x02000000
+#define bit_SSE2        0x04000000
+#define bit_SS          0x08000000
+#define bit_HTT         0x10000000
+#define bit_TM          0x20000000
+#define bit_PBE         0x80000000
+
+/* Features in %ebx for level 7 sub-leaf 0 */
+#define bit_FSGSBASE    0x00000001
+#define bit_SMEP        0x00000080
+#define bit_ENH_MOVSB   0x00000200
+
+#if __i386__
+#define __cpuid(__level, __eax, __ebx, __ecx, __edx) \
+    __asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
+                  : "0"(__level))
+
+#define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \
+    __asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
+                  : "0"(__level), "2"(__count))
+#else
+/* x86-64 uses %rbx as the base register, so preserve it. */
+#define __cpuid(__level, __eax, __ebx, __ecx, __edx) \
+    __asm("  xchgq  %%rbx,%q1\n" \
+          "  cpuid\n" \
+          "  xchgq  %%rbx,%q1" \
+        : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
+        : "0"(__level))
+
+#define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \
+    __asm("  xchgq  %%rbx,%q1\n" \
+          "  cpuid\n" \
+          "  xchgq  %%rbx,%q1" \
+        : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
+        : "0"(__level), "2"(__count))
+#endif
+
+static __inline int __get_cpuid (unsigned int __level, unsigned int *__eax,
+                                 unsigned int *__ebx, unsigned int *__ecx,
+                                 unsigned int *__edx) {
+    __cpuid(__level, *__eax, *__ebx, *__ecx, *__edx);
+    return 1;
+}
+
+static __inline int __get_cpuid_max (unsigned int __level, unsigned int *__sig)
+{
+    unsigned int __eax, __ebx, __ecx, __edx;
+#if __i386__
+    int __cpuid_supported;
+
+    __asm("  pushfl\n"
+          "  popl   %%eax\n"
+          "  movl   %%eax,%%ecx\n"
+          "  xorl   $0x00200000,%%eax\n"
+          "  pushl  %%eax\n"
+          "  popfl\n"
+          "  pushfl\n"
+          "  popl   %%eax\n"
+          "  movl   $0,%0\n"
+          "  cmpl   %%eax,%%ecx\n"
+          "  je     1f\n"
+          "  movl   $1,%0\n"
+          "1:"
+        : "=r" (__cpuid_supported) : : "eax", "ecx");
+    if (!__cpuid_supported)
+        return 0;
+#endif
+
+    __cpuid(__level, __eax, __ebx, __ecx, __edx);
+    if (__sig)
+        *__sig = __ebx;
+    return __eax;
+}

Property changes on: lab4/.minix-src/include/clang-3.6/cpuid.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/fmaintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/fmaintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/fmaintrin.h	(revision 13)
@@ -0,0 +1,229 @@
+/*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use <fmaintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef __FMAINTRIN_H
+#define __FMAINTRIN_H
+
+#ifndef __FMA__
+# error "FMA instruction set is not enabled"
+#else
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_fmadd_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmaddps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_fmadd_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmaddpd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_fmadd_ss(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmaddss(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_fmadd_sd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmaddsd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_fmsub_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmsubps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_fmsub_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmsubpd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_fmsub_ss(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmsubss(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_fmsub_sd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmsubsd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfnmaddps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfnmaddpd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_fnmadd_ss(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfnmaddss(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_fnmadd_sd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfnmaddsd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfnmsubps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfnmsubpd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_fnmsub_ss(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfnmsubss(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_fnmsub_sd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfnmsubsd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_fmaddsub_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmaddsubps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_fmaddsub_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmaddsubpd(__A, __B, __C);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_fmsubadd_ps(__m128 __A, __m128 __B, __m128 __C)
+{
+  return (__m128)__builtin_ia32_vfmsubaddps(__A, __B, __C);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_fmsubadd_pd(__m128d __A, __m128d __B, __m128d __C)
+{
+  return (__m128d)__builtin_ia32_vfmsubaddpd(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_fmadd_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfmaddps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_fmadd_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfmaddpd256(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_fmsub_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfmsubps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_fmsub_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfmsubpd256(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfnmaddps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfnmaddpd256(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfnmsubps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfnmsubpd256(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_fmaddsub_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfmaddsubps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_fmaddsub_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfmaddsubpd256(__A, __B, __C);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_fmsubadd_ps(__m256 __A, __m256 __B, __m256 __C)
+{
+  return (__m256)__builtin_ia32_vfmsubaddps256(__A, __B, __C);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_fmsubadd_pd(__m256d __A, __m256d __B, __m256d __C)
+{
+  return (__m256d)__builtin_ia32_vfmsubaddpd256(__A, __B, __C);
+}
+
+#endif /* __FMA__ */
+
+#endif /* __FMAINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/fmaintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/mm3dnow.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/mm3dnow.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/mm3dnow.h	(revision 13)
@@ -0,0 +1,162 @@
+/*===---- mm3dnow.h - 3DNow! intrinsics ------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef _MM3DNOW_H_INCLUDED
+#define _MM3DNOW_H_INCLUDED
+
+#include <mmintrin.h>
+#include <prfchwintrin.h>
+
+typedef float __v2sf __attribute__((__vector_size__(8)));
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_m_femms() {
+  __builtin_ia32_femms();
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pavgusb(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pavgusb((__v8qi)__m1, (__v8qi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pf2id(__m64 __m) {
+  return (__m64)__builtin_ia32_pf2id((__v2sf)__m);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfacc(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfacc((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfadd(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfadd((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfcmpeq(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfcmpeq((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfcmpge(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfcmpge((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfcmpgt(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfcmpgt((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfmax(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfmax((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfmin(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfmin((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfmul(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfmul((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfrcp(__m64 __m) {
+  return (__m64)__builtin_ia32_pfrcp((__v2sf)__m);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfrcpit1(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfrcpit1((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfrcpit2(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfrcpit2((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfrsqrt(__m64 __m) {
+  return (__m64)__builtin_ia32_pfrsqrt((__v2sf)__m);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfrsqrtit1(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfrsqit1((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfsub(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfsub((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfsubr(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfsubr((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pi2fd(__m64 __m) {
+  return (__m64)__builtin_ia32_pi2fd((__v2si)__m);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pmulhrw(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pmulhrw((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pf2iw(__m64 __m) {
+  return (__m64)__builtin_ia32_pf2iw((__v2sf)__m);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfnacc(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfnacc((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pfpnacc(__m64 __m1, __m64 __m2) {
+  return (__m64)__builtin_ia32_pfpnacc((__v2sf)__m1, (__v2sf)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pi2fw(__m64 __m) {
+  return (__m64)__builtin_ia32_pi2fw((__v2si)__m);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pswapdsf(__m64 __m) {
+  return (__m64)__builtin_ia32_pswapdsf((__v2sf)__m);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_m_pswapdsi(__m64 __m) {
+  return (__m64)__builtin_ia32_pswapdsi((__v2si)__m);
+}
+
+#endif

Property changes on: lab4/.minix-src/include/clang-3.6/mm3dnow.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/pmmintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/pmmintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/pmmintrin.h	(revision 13)
@@ -0,0 +1,117 @@
+/*===---- pmmintrin.h - SSE3 intrinsics ------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+ 
+#ifndef __PMMINTRIN_H
+#define __PMMINTRIN_H
+
+#ifndef __SSE3__
+#error "SSE3 instruction set not enabled"
+#else
+
+#include <emmintrin.h>
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_lddqu_si128(__m128i const *__p)
+{
+  return (__m128i)__builtin_ia32_lddqu((char const *)__p);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_addsub_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_addsubps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_hadd_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_haddps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_hsub_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_hsubps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_movehdup_ps(__m128 __a)
+{
+  return __builtin_shufflevector(__a, __a, 1, 1, 3, 3);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_moveldup_ps(__m128 __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 0, 2, 2);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_addsub_pd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_addsubpd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_hadd_pd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_haddpd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_hsub_pd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_hsubpd(__a, __b);
+}
+
+#define        _mm_loaddup_pd(dp)        _mm_load1_pd(dp)
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_movedup_pd(__m128d __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 0);
+}
+
+#define _MM_DENORMALS_ZERO_ON   (0x0040)
+#define _MM_DENORMALS_ZERO_OFF  (0x0000)
+
+#define _MM_DENORMALS_ZERO_MASK (0x0040)
+
+#define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
+#define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_monitor(void const *__p, unsigned __extensions, unsigned __hints)
+{
+  __builtin_ia32_monitor((void *)__p, __extensions, __hints);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_mwait(unsigned __extensions, unsigned __hints)
+{
+  __builtin_ia32_mwait(__extensions, __hints);
+}
+
+#endif /* __SSE3__ */
+
+#endif /* __PMMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/pmmintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/rtmintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/rtmintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/rtmintrin.h	(revision 13)
@@ -0,0 +1,54 @@
+/*===---- rtmintrin.h - RTM intrinsics -------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use <rtmintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef __RTMINTRIN_H
+#define __RTMINTRIN_H
+
+#define _XBEGIN_STARTED   (~0u)
+#define _XABORT_EXPLICIT  (1 << 0)
+#define _XABORT_RETRY     (1 << 1)
+#define _XABORT_CONFLICT  (1 << 2)
+#define _XABORT_CAPACITY  (1 << 3)
+#define _XABORT_DEBUG     (1 << 4)
+#define _XABORT_NESTED    (1 << 5)
+#define _XABORT_CODE(x)   (((x) >> 24) & 0xFF)
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_xbegin(void)
+{
+  return __builtin_ia32_xbegin();
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_xend(void)
+{
+  __builtin_ia32_xend();
+}
+
+#define _xabort(imm) __builtin_ia32_xabort((imm))
+
+#endif /* __RTMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/rtmintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/tbmintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/tbmintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/tbmintrin.h	(revision 13)
@@ -0,0 +1,158 @@
+/*===---- tbmintrin.h - TBM intrinsics -------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __TBM__
+#error "TBM instruction set is not enabled"
+#endif
+
+#ifndef __X86INTRIN_H
+#error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+#ifndef __TBMINTRIN_H
+#define __TBMINTRIN_H
+
+#define __bextri_u32(a, b) (__builtin_ia32_bextri_u32((a), (b)))
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__blcfill_u32(unsigned int a)
+{
+  return a & (a + 1);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__blci_u32(unsigned int a)
+{
+  return a | ~(a + 1);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__blcic_u32(unsigned int a)
+{
+  return ~a & (a + 1);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__blcmsk_u32(unsigned int a)
+{
+  return a ^ (a + 1);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__blcs_u32(unsigned int a)
+{
+  return a | (a + 1);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__blsfill_u32(unsigned int a)
+{
+  return a | (a - 1);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__blsic_u32(unsigned int a)
+{
+  return ~a | (a - 1);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__t1mskc_u32(unsigned int a)
+{
+  return ~a | (a + 1);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__tzmsk_u32(unsigned int a)
+{
+  return ~a & (a - 1);
+}
+
+#ifdef __x86_64__
+#define __bextri_u64(a, b) (__builtin_ia32_bextri_u64((a), (int)(b)))
+
+static __inline__ unsigned long long __attribute__((__always_inline__,
+                                                    __nodebug__))
+__blcfill_u64(unsigned long long a)
+{
+  return a & (a + 1);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__,
+                                                    __nodebug__))
+__blci_u64(unsigned long long a)
+{
+  return a | ~(a + 1);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__,
+                                                    __nodebug__))
+__blcic_u64(unsigned long long a)
+{
+  return ~a & (a + 1);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__,
+                                                    __nodebug__))
+__blcmsk_u64(unsigned long long a)
+{
+  return a ^ (a + 1);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__,
+                                                    __nodebug__))
+__blcs_u64(unsigned long long a)
+{
+  return a | (a + 1);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__,
+                                                    __nodebug__))
+__blsfill_u64(unsigned long long a)
+{
+  return a | (a - 1);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__,
+                                                    __nodebug__))
+__blsic_u64(unsigned long long a)
+{
+  return ~a | (a - 1);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__,
+                                                    __nodebug__))
+__t1mskc_u64(unsigned long long a)
+{
+  return ~a | (a + 1);
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__,
+                                                    __nodebug__))
+__tzmsk_u64(unsigned long long a)
+{
+  return ~a & (a - 1);
+}
+#endif
+
+#endif /* __TBMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/tbmintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/xmmintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/xmmintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/xmmintrin.h	(revision 13)
@@ -0,0 +1,1003 @@
+/*===---- xmmintrin.h - SSE intrinsics -------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+ 
+#ifndef __XMMINTRIN_H
+#define __XMMINTRIN_H
+ 
+#ifndef __SSE__
+#error "SSE instruction set not enabled"
+#else
+
+#include <mmintrin.h>
+
+typedef int __v4si __attribute__((__vector_size__(16)));
+typedef float __v4sf __attribute__((__vector_size__(16)));
+typedef float __m128 __attribute__((__vector_size__(16)));
+
+/* This header should only be included in a hosted environment as it depends on
+ * a standard library to provide allocation routines. */
+#if __STDC_HOSTED__
+#include <mm_malloc.h>
+#endif
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_add_ss(__m128 __a, __m128 __b)
+{
+  __a[0] += __b[0];
+  return __a;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_add_ps(__m128 __a, __m128 __b)
+{
+  return __a + __b;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_sub_ss(__m128 __a, __m128 __b)
+{
+  __a[0] -= __b[0];
+  return __a;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_sub_ps(__m128 __a, __m128 __b)
+{
+  return __a - __b;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_mul_ss(__m128 __a, __m128 __b)
+{
+  __a[0] *= __b[0];
+  return __a;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_mul_ps(__m128 __a, __m128 __b)
+{
+  return __a * __b;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_div_ss(__m128 __a, __m128 __b)
+{
+  __a[0] /= __b[0];
+  return __a;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_div_ps(__m128 __a, __m128 __b)
+{
+  return __a / __b;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_sqrt_ss(__m128 __a)
+{
+  __m128 __c = __builtin_ia32_sqrtss(__a);
+  return (__m128) { __c[0], __a[1], __a[2], __a[3] };
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_sqrt_ps(__m128 __a)
+{
+  return __builtin_ia32_sqrtps(__a);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_rcp_ss(__m128 __a)
+{
+  __m128 __c = __builtin_ia32_rcpss(__a);
+  return (__m128) { __c[0], __a[1], __a[2], __a[3] };
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_rcp_ps(__m128 __a)
+{
+  return __builtin_ia32_rcpps(__a);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_rsqrt_ss(__m128 __a)
+{
+  __m128 __c = __builtin_ia32_rsqrtss(__a);
+  return (__m128) { __c[0], __a[1], __a[2], __a[3] };
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_rsqrt_ps(__m128 __a)
+{
+  return __builtin_ia32_rsqrtps(__a);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_min_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_minss(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_min_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_minps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_max_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_maxss(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_max_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_maxps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_and_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)((__v4si)__a & (__v4si)__b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_andnot_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)(~(__v4si)__a & (__v4si)__b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_or_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)((__v4si)__a | (__v4si)__b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_xor_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)((__v4si)__a ^ (__v4si)__b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpeqss(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpeqps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmplt_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpltss(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmplt_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpltps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmple_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpless(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmple_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpleps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_shufflevector(__a,
+                                         __builtin_ia32_cmpltss(__b, __a),
+                                         4, 1, 2, 3);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpltps(__b, __a);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpge_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_shufflevector(__a,
+                                         __builtin_ia32_cmpless(__b, __a),
+                                         4, 1, 2, 3);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpge_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpleps(__b, __a);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpneq_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpneqss(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpneq_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpneqps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnlt_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpnltss(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnlt_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpnltps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnle_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpnless(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnle_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpnleps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpngt_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_shufflevector(__a,
+                                         __builtin_ia32_cmpnltss(__b, __a),
+                                         4, 1, 2, 3);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpngt_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpnltps(__b, __a);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnge_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_shufflevector(__a,
+                                         __builtin_ia32_cmpnless(__b, __a),
+                                         4, 1, 2, 3);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnge_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpnleps(__b, __a);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpord_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpordss(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpord_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpordps(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpunord_ss(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpunordss(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpunord_ps(__m128 __a, __m128 __b)
+{
+  return (__m128)__builtin_ia32_cmpunordps(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comieq_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_comieq(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comilt_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_comilt(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comile_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_comile(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comigt_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_comigt(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comige_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_comige(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comineq_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_comineq(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomieq_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_ucomieq(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomilt_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_ucomilt(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomile_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_ucomile(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomigt_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_ucomigt(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomige_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_ucomige(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomineq_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_ucomineq(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_cvtss_si32(__m128 __a)
+{
+  return __builtin_ia32_cvtss2si(__a);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_cvt_ss2si(__m128 __a)
+{
+  return _mm_cvtss_si32(__a);
+}
+
+#ifdef __x86_64__
+
+static __inline__ long long __attribute__((__always_inline__, __nodebug__))
+_mm_cvtss_si64(__m128 __a)
+{
+  return __builtin_ia32_cvtss2si64(__a);
+}
+
+#endif
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtps_pi32(__m128 __a)
+{
+  return (__m64)__builtin_ia32_cvtps2pi(__a);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cvt_ps2pi(__m128 __a)
+{
+  return _mm_cvtps_pi32(__a);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_cvttss_si32(__m128 __a)
+{
+  return __a[0];
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_cvtt_ss2si(__m128 __a)
+{
+  return _mm_cvttss_si32(__a);
+}
+
+static __inline__ long long __attribute__((__always_inline__, __nodebug__))
+_mm_cvttss_si64(__m128 __a)
+{
+  return __a[0];
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cvttps_pi32(__m128 __a)
+{
+  return (__m64)__builtin_ia32_cvttps2pi(__a);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtt_ps2pi(__m128 __a)
+{
+  return _mm_cvttps_pi32(__a);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi32_ss(__m128 __a, int __b)
+{
+  __a[0] = __b;
+  return __a;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvt_si2ss(__m128 __a, int __b)
+{
+  return _mm_cvtsi32_ss(__a, __b);
+}
+
+#ifdef __x86_64__
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi64_ss(__m128 __a, long long __b)
+{
+  __a[0] = __b;
+  return __a;
+}
+
+#endif
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtpi32_ps(__m128 __a, __m64 __b)
+{
+  return __builtin_ia32_cvtpi2ps(__a, (__v2si)__b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvt_pi2ps(__m128 __a, __m64 __b)
+{
+  return _mm_cvtpi32_ps(__a, __b);
+}
+
+static __inline__ float __attribute__((__always_inline__, __nodebug__))
+_mm_cvtss_f32(__m128 __a)
+{
+  return __a[0];
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_loadh_pi(__m128 __a, const __m64 *__p)
+{
+  typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8)));
+  struct __mm_loadh_pi_struct {
+    __mm_loadh_pi_v2f32 __u;
+  } __attribute__((__packed__, __may_alias__));
+  __mm_loadh_pi_v2f32 __b = ((struct __mm_loadh_pi_struct*)__p)->__u;
+  __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
+  return __builtin_shufflevector(__a, __bb, 0, 1, 4, 5);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_loadl_pi(__m128 __a, const __m64 *__p)
+{
+  typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8)));
+  struct __mm_loadl_pi_struct {
+    __mm_loadl_pi_v2f32 __u;
+  } __attribute__((__packed__, __may_alias__));
+  __mm_loadl_pi_v2f32 __b = ((struct __mm_loadl_pi_struct*)__p)->__u;
+  __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
+  return __builtin_shufflevector(__a, __bb, 4, 5, 2, 3);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_load_ss(const float *__p)
+{
+  struct __mm_load_ss_struct {
+    float __u;
+  } __attribute__((__packed__, __may_alias__));
+  float __u = ((struct __mm_load_ss_struct*)__p)->__u;
+  return (__m128){ __u, 0, 0, 0 };
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_load1_ps(const float *__p)
+{
+  struct __mm_load1_ps_struct {
+    float __u;
+  } __attribute__((__packed__, __may_alias__));
+  float __u = ((struct __mm_load1_ps_struct*)__p)->__u;
+  return (__m128){ __u, __u, __u, __u };
+}
+
+#define        _mm_load_ps1(p) _mm_load1_ps(p)
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_load_ps(const float *__p)
+{
+  return *(__m128*)__p;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_loadu_ps(const float *__p)
+{
+  struct __loadu_ps {
+    __m128 __v;
+  } __attribute__((__packed__, __may_alias__));
+  return ((struct __loadu_ps*)__p)->__v;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_loadr_ps(const float *__p)
+{
+  __m128 __a = _mm_load_ps(__p);
+  return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_set_ss(float __w)
+{
+  return (__m128){ __w, 0, 0, 0 };
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_set1_ps(float __w)
+{
+  return (__m128){ __w, __w, __w, __w };
+}
+
+/* Microsoft specific. */
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_set_ps1(float __w)
+{
+    return _mm_set1_ps(__w);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_set_ps(float __z, float __y, float __x, float __w)
+{
+  return (__m128){ __w, __x, __y, __z };
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_setr_ps(float __z, float __y, float __x, float __w)
+{
+  return (__m128){ __z, __y, __x, __w };
+}
+
+static __inline__ __m128 __attribute__((__always_inline__))
+_mm_setzero_ps(void)
+{
+  return (__m128){ 0, 0, 0, 0 };
+}
+
+static __inline__ void __attribute__((__always_inline__))
+_mm_storeh_pi(__m64 *__p, __m128 __a)
+{
+  __builtin_ia32_storehps((__v2si *)__p, __a);
+}
+
+static __inline__ void __attribute__((__always_inline__))
+_mm_storel_pi(__m64 *__p, __m128 __a)
+{
+  __builtin_ia32_storelps((__v2si *)__p, __a);
+}
+
+static __inline__ void __attribute__((__always_inline__))
+_mm_store_ss(float *__p, __m128 __a)
+{
+  struct __mm_store_ss_struct {
+    float __u;
+  } __attribute__((__packed__, __may_alias__));
+  ((struct __mm_store_ss_struct*)__p)->__u = __a[0];
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_storeu_ps(float *__p, __m128 __a)
+{
+  __builtin_ia32_storeups(__p, __a);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_store1_ps(float *__p, __m128 __a)
+{
+  __a = __builtin_shufflevector(__a, __a, 0, 0, 0, 0);
+  _mm_storeu_ps(__p, __a);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_store_ps1(float *__p, __m128 __a)
+{
+    return _mm_store1_ps(__p, __a);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_store_ps(float *__p, __m128 __a)
+{
+  *(__m128 *)__p = __a;
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_storer_ps(float *__p, __m128 __a)
+{
+  __a = __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
+  _mm_store_ps(__p, __a);
+}
+
+#define _MM_HINT_T0 3
+#define _MM_HINT_T1 2
+#define _MM_HINT_T2 1
+#define _MM_HINT_NTA 0
+
+#ifndef _MSC_VER
+/* FIXME: We have to #define this because "sel" must be a constant integer, and
+   Sema doesn't do any form of constant propagation yet. */
+
+#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))
+#endif
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_stream_pi(__m64 *__p, __m64 __a)
+{
+  __builtin_ia32_movntq(__p, __a);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_stream_ps(float *__p, __m128 __a)
+{
+  __builtin_ia32_movntps(__p, __a);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_sfence(void)
+{
+  __builtin_ia32_sfence();
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_extract_pi16(__m64 __a, int __n)
+{
+  __v4hi __b = (__v4hi)__a;
+  return (unsigned short)__b[__n & 3];
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_insert_pi16(__m64 __a, int __d, int __n)
+{
+   __v4hi __b = (__v4hi)__a;
+   __b[__n & 3] = __d;
+   return (__m64)__b;
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_max_pi16(__m64 __a, __m64 __b)
+{
+  return (__m64)__builtin_ia32_pmaxsw((__v4hi)__a, (__v4hi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_max_pu8(__m64 __a, __m64 __b)
+{
+  return (__m64)__builtin_ia32_pmaxub((__v8qi)__a, (__v8qi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_min_pi16(__m64 __a, __m64 __b)
+{
+  return (__m64)__builtin_ia32_pminsw((__v4hi)__a, (__v4hi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_min_pu8(__m64 __a, __m64 __b)
+{
+  return (__m64)__builtin_ia32_pminub((__v8qi)__a, (__v8qi)__b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_movemask_pi8(__m64 __a)
+{
+  return __builtin_ia32_pmovmskb((__v8qi)__a);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_mulhi_pu16(__m64 __a, __m64 __b)
+{
+  return (__m64)__builtin_ia32_pmulhuw((__v4hi)__a, (__v4hi)__b);
+}
+
+#define _mm_shuffle_pi16(a, n) __extension__ ({ \
+  __m64 __a = (a); \
+  (__m64)__builtin_ia32_pshufw((__v4hi)__a, (n)); })
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_maskmove_si64(__m64 __d, __m64 __n, char *__p)
+{
+  __builtin_ia32_maskmovq((__v8qi)__d, (__v8qi)__n, __p);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_avg_pu8(__m64 __a, __m64 __b)
+{
+  return (__m64)__builtin_ia32_pavgb((__v8qi)__a, (__v8qi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_avg_pu16(__m64 __a, __m64 __b)
+{
+  return (__m64)__builtin_ia32_pavgw((__v4hi)__a, (__v4hi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sad_pu8(__m64 __a, __m64 __b)
+{
+  return (__m64)__builtin_ia32_psadbw((__v8qi)__a, (__v8qi)__b);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_mm_getcsr(void)
+{
+  return __builtin_ia32_stmxcsr();
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_setcsr(unsigned int __i)
+{
+  __builtin_ia32_ldmxcsr(__i);
+}
+
+#define _mm_shuffle_ps(a, b, mask) __extension__ ({ \
+  __m128 __a = (a); \
+  __m128 __b = (b); \
+  (__m128)__builtin_shufflevector((__v4sf)__a, (__v4sf)__b, \
+                                  (mask) & 0x3, ((mask) & 0xc) >> 2, \
+                                  (((mask) & 0x30) >> 4) + 4, \
+                                  (((mask) & 0xc0) >> 6) + 4); })
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_unpackhi_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_shufflevector(__a, __b, 2, 6, 3, 7);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_unpacklo_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_shufflevector(__a, __b, 0, 4, 1, 5);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_move_ss(__m128 __a, __m128 __b)
+{
+  return __builtin_shufflevector(__a, __b, 4, 1, 2, 3);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_movehl_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_shufflevector(__a, __b, 6, 7, 2, 3);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_movelh_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_shufflevector(__a, __b, 0, 1, 4, 5);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtpi16_ps(__m64 __a)
+{
+  __m64 __b, __c;
+  __m128 __r;
+
+  __b = _mm_setzero_si64();
+  __b = _mm_cmpgt_pi16(__b, __a);
+  __c = _mm_unpackhi_pi16(__a, __b);
+  __r = _mm_setzero_ps();
+  __r = _mm_cvtpi32_ps(__r, __c);
+  __r = _mm_movelh_ps(__r, __r);
+  __c = _mm_unpacklo_pi16(__a, __b);
+  __r = _mm_cvtpi32_ps(__r, __c);
+
+  return __r;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtpu16_ps(__m64 __a)
+{
+  __m64 __b, __c;
+  __m128 __r;
+
+  __b = _mm_setzero_si64();
+  __c = _mm_unpackhi_pi16(__a, __b);
+  __r = _mm_setzero_ps();
+  __r = _mm_cvtpi32_ps(__r, __c);
+  __r = _mm_movelh_ps(__r, __r);
+  __c = _mm_unpacklo_pi16(__a, __b);
+  __r = _mm_cvtpi32_ps(__r, __c);
+
+  return __r;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtpi8_ps(__m64 __a)
+{
+  __m64 __b;
+  
+  __b = _mm_setzero_si64();
+  __b = _mm_cmpgt_pi8(__b, __a);
+  __b = _mm_unpacklo_pi8(__a, __b);
+
+  return _mm_cvtpi16_ps(__b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtpu8_ps(__m64 __a)
+{
+  __m64 __b;
+  
+  __b = _mm_setzero_si64();
+  __b = _mm_unpacklo_pi8(__a, __b);
+
+  return _mm_cvtpi16_ps(__b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtpi32x2_ps(__m64 __a, __m64 __b)
+{
+  __m128 __c;
+  
+  __c = _mm_setzero_ps();
+  __c = _mm_cvtpi32_ps(__c, __b);
+  __c = _mm_movelh_ps(__c, __c);
+
+  return _mm_cvtpi32_ps(__c, __a);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtps_pi16(__m128 __a)
+{
+  __m64 __b, __c;
+  
+  __b = _mm_cvtps_pi32(__a);
+  __a = _mm_movehl_ps(__a, __a);
+  __c = _mm_cvtps_pi32(__a);
+  
+  return _mm_packs_pi32(__b, __c);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtps_pi8(__m128 __a)
+{
+  __m64 __b, __c;
+  
+  __b = _mm_cvtps_pi16(__a);
+  __c = _mm_setzero_si64();
+  
+  return _mm_packs_pi16(__b, __c);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_movemask_ps(__m128 __a)
+{
+  return __builtin_ia32_movmskps(__a);
+}
+
+#define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w))
+
+#define _MM_EXCEPT_INVALID    (0x0001)
+#define _MM_EXCEPT_DENORM     (0x0002)
+#define _MM_EXCEPT_DIV_ZERO   (0x0004)
+#define _MM_EXCEPT_OVERFLOW   (0x0008)
+#define _MM_EXCEPT_UNDERFLOW  (0x0010)
+#define _MM_EXCEPT_INEXACT    (0x0020)
+#define _MM_EXCEPT_MASK       (0x003f)
+
+#define _MM_MASK_INVALID      (0x0080)
+#define _MM_MASK_DENORM       (0x0100)
+#define _MM_MASK_DIV_ZERO     (0x0200)
+#define _MM_MASK_OVERFLOW     (0x0400)
+#define _MM_MASK_UNDERFLOW    (0x0800)
+#define _MM_MASK_INEXACT      (0x1000)
+#define _MM_MASK_MASK         (0x1f80)
+
+#define _MM_ROUND_NEAREST     (0x0000)
+#define _MM_ROUND_DOWN        (0x2000)
+#define _MM_ROUND_UP          (0x4000)
+#define _MM_ROUND_TOWARD_ZERO (0x6000)
+#define _MM_ROUND_MASK        (0x6000)
+
+#define _MM_FLUSH_ZERO_MASK   (0x8000)
+#define _MM_FLUSH_ZERO_ON     (0x8000)
+#define _MM_FLUSH_ZERO_OFF    (0x0000)
+
+#define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK)
+#define _MM_GET_EXCEPTION_STATE() (_mm_getcsr() & _MM_EXCEPT_MASK)
+#define _MM_GET_FLUSH_ZERO_MODE() (_mm_getcsr() & _MM_FLUSH_ZERO_MASK)
+#define _MM_GET_ROUNDING_MODE() (_mm_getcsr() & _MM_ROUND_MASK)
+
+#define _MM_SET_EXCEPTION_MASK(x) (_mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (x)))
+#define _MM_SET_EXCEPTION_STATE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | (x)))
+#define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | (x)))
+#define _MM_SET_ROUNDING_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | (x)))
+
+#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \
+do { \
+  __m128 tmp3, tmp2, tmp1, tmp0; \
+  tmp0 = _mm_unpacklo_ps((row0), (row1)); \
+  tmp2 = _mm_unpacklo_ps((row2), (row3)); \
+  tmp1 = _mm_unpackhi_ps((row0), (row1)); \
+  tmp3 = _mm_unpackhi_ps((row2), (row3)); \
+  (row0) = _mm_movelh_ps(tmp0, tmp2); \
+  (row1) = _mm_movehl_ps(tmp2, tmp0); \
+  (row2) = _mm_movelh_ps(tmp1, tmp3); \
+  (row3) = _mm_movehl_ps(tmp3, tmp1); \
+} while (0)
+
+/* Aliases for compatibility. */
+#define _m_pextrw _mm_extract_pi16
+#define _m_pinsrw _mm_insert_pi16
+#define _m_pmaxsw _mm_max_pi16
+#define _m_pmaxub _mm_max_pu8
+#define _m_pminsw _mm_min_pi16
+#define _m_pminub _mm_min_pu8
+#define _m_pmovmskb _mm_movemask_pi8
+#define _m_pmulhuw _mm_mulhi_pu16
+#define _m_pshufw _mm_shuffle_pi16
+#define _m_maskmovq _mm_maskmove_si64
+#define _m_pavgb _mm_avg_pu8
+#define _m_pavgw _mm_avg_pu16
+#define _m_psadbw _mm_sad_pu8
+#define _m_ _mm_
+#define _m_ _mm_
+
+/* Ugly hack for backwards-compatibility (compatible with gcc) */
+#ifdef __SSE2__
+#include <emmintrin.h>
+#endif
+
+#endif /* __SSE__ */
+
+#endif /* __XMMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/xmmintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/stdatomic.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/stdatomic.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/stdatomic.h	(revision 13)
@@ -0,0 +1,190 @@
+/*===---- stdatomic.h - Standard header for atomic types and operations -----===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __CLANG_STDATOMIC_H
+#define __CLANG_STDATOMIC_H
+
+/* If we're hosted, fall back to the system's stdatomic.h. FreeBSD, for
+ * example, already has a Clang-compatible stdatomic.h header.
+ */
+#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>)
+# include_next <stdatomic.h>
+#else
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* 7.17.1 Introduction */
+
+#define ATOMIC_BOOL_LOCK_FREE       __GCC_ATOMIC_BOOL_LOCK_FREE
+#define ATOMIC_CHAR_LOCK_FREE       __GCC_ATOMIC_CHAR_LOCK_FREE
+#define ATOMIC_CHAR16_T_LOCK_FREE   __GCC_ATOMIC_CHAR16_T_LOCK_FREE
+#define ATOMIC_CHAR32_T_LOCK_FREE   __GCC_ATOMIC_CHAR32_T_LOCK_FREE
+#define ATOMIC_WCHAR_T_LOCK_FREE    __GCC_ATOMIC_WCHAR_T_LOCK_FREE
+#define ATOMIC_SHORT_T_LOCK_FREE    __GCC_ATOMIC_SHORT_T_LOCK_FREE
+#define ATOMIC_INT_T_LOCK_FREE      __GCC_ATOMIC_INT_T_LOCK_FREE
+#define ATOMIC_LONG_T_LOCK_FREE     __GCC_ATOMIC_LONG_T_LOCK_FREE
+#define ATOMIC_LLONG_T_LOCK_FREE    __GCC_ATOMIC_LLONG_T_LOCK_FREE
+#define ATOMIC_POINTER_T_LOCK_FREE  __GCC_ATOMIC_POINTER_T_LOCK_FREE
+
+/* 7.17.2 Initialization */
+
+#define ATOMIC_VAR_INIT(value) (value)
+#define atomic_init __c11_atomic_init
+
+/* 7.17.3 Order and consistency */
+
+typedef enum memory_order {
+  memory_order_relaxed = __ATOMIC_RELAXED,
+  memory_order_consume = __ATOMIC_CONSUME,
+  memory_order_acquire = __ATOMIC_ACQUIRE,
+  memory_order_release = __ATOMIC_RELEASE,
+  memory_order_acq_rel = __ATOMIC_ACQ_REL,
+  memory_order_seq_cst = __ATOMIC_SEQ_CST
+} memory_order;
+
+#define kill_dependency(y) (y)
+
+/* 7.17.4 Fences */
+
+// These should be provided by the libc implementation.
+void atomic_thread_fence(memory_order);
+void atomic_signal_fence(memory_order);
+
+#define atomic_thread_fence(order) __c11_atomic_thread_fence(order)
+#define atomic_signal_fence(order) __c11_atomic_signal_fence(order)
+
+/* 7.17.5 Lock-free property */
+
+#define atomic_is_lock_free(obj) __c11_atomic_is_lock_free(sizeof(*(obj)))
+
+/* 7.17.6 Atomic integer types */
+
+#ifdef __cplusplus
+typedef _Atomic(bool)               atomic_bool;
+#else
+typedef _Atomic(_Bool)              atomic_bool;
+#endif
+typedef _Atomic(char)               atomic_char;
+typedef _Atomic(signed char)        atomic_schar;
+typedef _Atomic(unsigned char)      atomic_uchar;
+typedef _Atomic(short)              atomic_short;
+typedef _Atomic(unsigned short)     atomic_ushort;
+typedef _Atomic(int)                atomic_int;
+typedef _Atomic(unsigned int)       atomic_uint;
+typedef _Atomic(long)               atomic_long;
+typedef _Atomic(unsigned long)      atomic_ulong;
+typedef _Atomic(long long)          atomic_llong;
+typedef _Atomic(unsigned long long) atomic_ullong;
+typedef _Atomic(uint_least16_t)     atomic_char16_t;
+typedef _Atomic(uint_least32_t)     atomic_char32_t;
+typedef _Atomic(wchar_t)            atomic_wchar_t;
+typedef _Atomic(int_least8_t)       atomic_int_least8_t;
+typedef _Atomic(uint_least8_t)      atomic_uint_least8_t;
+typedef _Atomic(int_least16_t)      atomic_int_least16_t;
+typedef _Atomic(uint_least16_t)     atomic_uint_least16_t;
+typedef _Atomic(int_least32_t)      atomic_int_least32_t;
+typedef _Atomic(uint_least32_t)     atomic_uint_least32_t;
+typedef _Atomic(int_least64_t)      atomic_int_least64_t;
+typedef _Atomic(uint_least64_t)     atomic_uint_least64_t;
+typedef _Atomic(int_fast8_t)        atomic_int_fast8_t;
+typedef _Atomic(uint_fast8_t)       atomic_uint_fast8_t;
+typedef _Atomic(int_fast16_t)       atomic_int_fast16_t;
+typedef _Atomic(uint_fast16_t)      atomic_uint_fast16_t;
+typedef _Atomic(int_fast32_t)       atomic_int_fast32_t;
+typedef _Atomic(uint_fast32_t)      atomic_uint_fast32_t;
+typedef _Atomic(int_fast64_t)       atomic_int_fast64_t;
+typedef _Atomic(uint_fast64_t)      atomic_uint_fast64_t;
+typedef _Atomic(intptr_t)           atomic_intptr_t;
+typedef _Atomic(uintptr_t)          atomic_uintptr_t;
+typedef _Atomic(size_t)             atomic_size_t;
+typedef _Atomic(ptrdiff_t)          atomic_ptrdiff_t;
+typedef _Atomic(intmax_t)           atomic_intmax_t;
+typedef _Atomic(uintmax_t)          atomic_uintmax_t;
+
+/* 7.17.7 Operations on atomic types */
+
+#define atomic_store(object, desired) __c11_atomic_store(object, desired, __ATOMIC_SEQ_CST)
+#define atomic_store_explicit __c11_atomic_store
+
+#define atomic_load(object) __c11_atomic_load(object, __ATOMIC_SEQ_CST)
+#define atomic_load_explicit __c11_atomic_load
+
+#define atomic_exchange(object, desired) __c11_atomic_exchange(object, desired, __ATOMIC_SEQ_CST)
+#define atomic_exchange_explicit __c11_atomic_exchange
+
+#define atomic_compare_exchange_strong(object, expected, desired) __c11_atomic_compare_exchange_strong(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
+#define atomic_compare_exchange_strong_explicit __c11_atomic_compare_exchange_strong
+
+#define atomic_compare_exchange_weak(object, expected, desired) __c11_atomic_compare_exchange_weak(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
+#define atomic_compare_exchange_weak_explicit __c11_atomic_compare_exchange_weak
+
+#define atomic_fetch_add(object, operand) __c11_atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST)
+#define atomic_fetch_add_explicit __c11_atomic_fetch_add
+
+#define atomic_fetch_sub(object, operand) __c11_atomic_fetch_sub(object, operand, __ATOMIC_SEQ_CST)
+#define atomic_fetch_sub_explicit __c11_atomic_fetch_sub
+
+#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
+#define atomic_fetch_or_explicit __c11_atomic_fetch_or
+
+#define atomic_fetch_xor(object, operand) __c11_atomic_fetch_xor(object, operand, __ATOMIC_SEQ_CST)
+#define atomic_fetch_xor_explicit __c11_atomic_fetch_xor
+
+#define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
+#define atomic_fetch_and_explicit __c11_atomic_fetch_and
+
+/* 7.17.8 Atomic flag type and operations */
+
+typedef struct atomic_flag { atomic_bool _Value; } atomic_flag;
+
+#define ATOMIC_FLAG_INIT { 0 }
+
+// These should be provided by the libc implementation.
+#ifdef __cplusplus
+bool atomic_flag_test_and_set(volatile atomic_flag *);
+bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order);
+#else
+_Bool atomic_flag_test_and_set(volatile atomic_flag *);
+_Bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order);
+#endif
+void atomic_flag_clear(volatile atomic_flag *);
+void atomic_flag_clear_explicit(volatile atomic_flag *, memory_order);
+
+#define atomic_flag_test_and_set(object) __c11_atomic_exchange(&(object)->_Value, 1, __ATOMIC_SEQ_CST)
+#define atomic_flag_test_and_set_explicit(object, order) __c11_atomic_exchange(&(object)->_Value, 1, order)
+
+#define atomic_flag_clear(object) __c11_atomic_store(&(object)->_Value, 0, __ATOMIC_SEQ_CST)
+#define atomic_flag_clear_explicit(object, order) __c11_atomic_store(&(object)->_Value, 0, order)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STDC_HOSTED__ */
+#endif /* __CLANG_STDATOMIC_H */
+

Property changes on: lab4/.minix-src/include/clang-3.6/stdatomic.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/x86intrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/x86intrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/x86intrin.h	(revision 13)
@@ -0,0 +1,81 @@
+/*===---- x86intrin.h - X86 intrinsics -------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __X86INTRIN_H
+#define __X86INTRIN_H
+
+#include <ia32intrin.h>
+
+#include <immintrin.h>
+
+#ifdef __3dNOW__
+#include <mm3dnow.h>
+#endif
+
+#ifdef __BMI__
+#include <bmiintrin.h>
+#endif
+
+#ifdef __BMI2__
+#include <bmi2intrin.h>
+#endif
+
+#ifdef __LZCNT__
+#include <lzcntintrin.h>
+#endif
+
+#ifdef __POPCNT__
+#include <popcntintrin.h>
+#endif
+
+#ifdef __RDSEED__
+#include <rdseedintrin.h>
+#endif
+
+#ifdef __PRFCHW__
+#include <prfchwintrin.h>
+#endif
+
+#ifdef __SSE4A__
+#include <ammintrin.h>
+#endif
+
+#ifdef __FMA4__
+#include <fma4intrin.h>
+#endif
+
+#ifdef __XOP__
+#include <xopintrin.h>
+#endif
+
+#ifdef __TBM__
+#include <tbmintrin.h>
+#endif
+
+#ifdef __F16C__
+#include <f16cintrin.h>
+#endif
+
+/* FIXME: LWP */
+
+#endif /* __X86INTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/x86intrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/minix/pci.h
===================================================================
--- lab4/.minix-src/include/ddekit/minix/pci.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/minix/pci.h	(revision 13)
@@ -0,0 +1,4 @@
+#ifndef DDEKIT_MINIX_PCI
+#define DDEKIT_MINIX_PCI
+void ddekit_pci_init_only_one(int skip);
+#endif

Property changes on: lab4/.minix-src/include/ddekit/minix/pci.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/ddekit.h
===================================================================
--- lab4/.minix-src/include/ddekit/ddekit.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/ddekit.h	(revision 13)
@@ -0,0 +1,6 @@
+#ifndef _DDEKIT_DDEKIT_H
+#define _DDEKIT_DDEKIT_H
+void ddekit_init(void);
+
+#endif
+

Property changes on: lab4/.minix-src/include/ddekit/ddekit.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/interrupt.h
===================================================================
--- lab4/.minix-src/include/ddekit/interrupt.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/interrupt.h	(revision 13)
@@ -0,0 +1,47 @@
+/*-
+ * Copyright (c) 2006 TU Dresden, 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _DDEKIT_INTERUPT_H
+#define _DDEKIT_INTERUPT_H
+#include <ddekit/ddekit.h>
+#include <ddekit/thread.h>
+
+/** Attach to an interrupt */
+ddekit_thread_t *ddekit_interrupt_attach( int irq, int shared,
+	void(*thread_init)(void *), void(*handler)(void *), void *priv);
+
+/* Detach from a previously attached interrupt. */
+void ddekit_interrupt_detach(int irq);
+
+/* Block interrupt. */
+void ddekit_interrupt_disable(int irq);
+
+/* Enable interrupt */
+void ddekit_interrupt_enable(int irq);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/interrupt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/f16cintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/f16cintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/f16cintrin.h	(revision 13)
@@ -0,0 +1,58 @@
+/*===---- f16cintrin.h - F16C intrinsics -----------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
+#error "Never use <f16cintrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+#ifndef __F16C__
+# error "F16C instruction is not enabled"
+#endif /* __F16C__ */
+
+#ifndef __F16CINTRIN_H
+#define __F16CINTRIN_H
+
+typedef float __v8sf __attribute__ ((__vector_size__ (32)));
+typedef float __m256 __attribute__ ((__vector_size__ (32)));
+
+#define _mm_cvtps_ph(a, imm) __extension__ ({ \
+  __m128 __a = (a); \
+ (__m128i)__builtin_ia32_vcvtps2ph((__v4sf)__a, (imm)); })
+
+#define _mm256_cvtps_ph(a, imm) __extension__ ({ \
+  __m256 __a = (a); \
+ (__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)__a, (imm)); })
+
+static __inline __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtph_ps(__m128i __a)
+{
+  return (__m128)__builtin_ia32_vcvtph2ps((__v8hi)__a);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtph_ps(__m128i __a)
+{
+  return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a);
+}
+
+#endif /* __F16CINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/f16cintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/immintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/immintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/immintrin.h	(revision 13)
@@ -0,0 +1,194 @@
+/*===---- immintrin.h - Intel intrinsics -----------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __IMMINTRIN_H
+#define __IMMINTRIN_H
+
+#ifdef __MMX__
+#include <mmintrin.h>
+#endif
+
+#ifdef __SSE__
+#include <xmmintrin.h>
+#endif
+
+#ifdef __SSE2__
+#include <emmintrin.h>
+#endif
+
+#ifdef __SSE3__
+#include <pmmintrin.h>
+#endif
+
+#ifdef __SSSE3__
+#include <tmmintrin.h>
+#endif
+
+#if defined (__SSE4_2__) || defined (__SSE4_1__)
+#include <smmintrin.h>
+#endif
+
+#if defined (__AES__) || defined (__PCLMUL__)
+#include <wmmintrin.h>
+#endif
+
+#ifdef __AVX__
+#include <avxintrin.h>
+#endif
+
+#ifdef __AVX2__
+#include <avx2intrin.h>
+#endif
+
+#ifdef __BMI__
+#include <bmiintrin.h>
+#endif
+
+#ifdef __BMI2__
+#include <bmi2intrin.h>
+#endif
+
+#ifdef __LZCNT__
+#include <lzcntintrin.h>
+#endif
+
+#ifdef __FMA__
+#include <fmaintrin.h>
+#endif
+
+#ifdef __AVX512F__
+#include <avx512fintrin.h>
+#endif
+
+#ifdef __AVX512VL__
+#include <avx512vlintrin.h>
+#endif
+
+#ifdef __AVX512BW__
+#include <avx512bwintrin.h>
+#endif
+
+#if defined (__AVX512VL__) && defined (__AVX512BW__)
+#include <avx512vlbwintrin.h>
+#endif
+
+#ifdef __AVX512ER__
+#include <avx512erintrin.h>
+#endif
+
+#ifdef __RDRND__
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_rdrand16_step(unsigned short *__p)
+{
+  return __builtin_ia32_rdrand16_step(__p);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_rdrand32_step(unsigned int *__p)
+{
+  return __builtin_ia32_rdrand32_step(__p);
+}
+
+#ifdef __x86_64__
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_rdrand64_step(unsigned long long *__p)
+{
+  return __builtin_ia32_rdrand64_step(__p);
+}
+#endif
+#endif /* __RDRND__ */
+
+#ifdef __FSGSBASE__
+#ifdef __x86_64__
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_readfsbase_u32(void)
+{
+  return __builtin_ia32_rdfsbase32();
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+_readfsbase_u64(void)
+{
+  return __builtin_ia32_rdfsbase64();
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_readgsbase_u32(void)
+{
+  return __builtin_ia32_rdgsbase32();
+}
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+_readgsbase_u64(void)
+{
+  return __builtin_ia32_rdgsbase64();
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_writefsbase_u32(unsigned int __V)
+{
+  return __builtin_ia32_wrfsbase32(__V);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_writefsbase_u64(unsigned long long __V)
+{
+  return __builtin_ia32_wrfsbase64(__V);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_writegsbase_u32(unsigned int __V)
+{
+  return __builtin_ia32_wrgsbase32(__V);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_writegsbase_u64(unsigned long long __V)
+{
+  return __builtin_ia32_wrgsbase64(__V);
+}
+#endif
+#endif /* __FSGSBASE__ */
+
+#ifdef __RTM__
+#include <rtmintrin.h>
+#endif
+
+/* FIXME: check __HLE__ as well when HLE is supported. */
+#if defined (__RTM__)
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_xtest(void)
+{
+  return __builtin_ia32_xtest();
+}
+#endif
+
+#ifdef __SHA__
+#include <shaintrin.h>
+#endif
+
+/* Some intrinsics inside adxintrin.h are available only if __ADX__ defined,
+ * whereas others are also available if __ADX__ undefined */
+#include <adxintrin.h>
+
+#endif /* __IMMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/immintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/mmintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/mmintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/mmintrin.h	(revision 13)
@@ -0,0 +1,503 @@
+/*===---- mmintrin.h - MMX intrinsics --------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __MMINTRIN_H
+#define __MMINTRIN_H
+
+#ifndef __MMX__
+#error "MMX instruction set not enabled"
+#else
+
+typedef long long __m64 __attribute__((__vector_size__(8)));
+
+typedef int __v2si __attribute__((__vector_size__(8)));
+typedef short __v4hi __attribute__((__vector_size__(8)));
+typedef char __v8qi __attribute__((__vector_size__(8)));
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_empty(void)
+{
+    __builtin_ia32_emms();
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi32_si64(int __i)
+{
+    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi64_si32(__m64 __m)
+{
+    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi64_m64(long long __i)
+{
+    return (__m64)__i;
+}
+
+static __inline__ long long __attribute__((__always_inline__, __nodebug__))
+_mm_cvtm64_si64(__m64 __m)
+{
+    return (long long)__m;
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_packs_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_packs_pi32(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_packs_pu16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_unpackhi_pi8(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_unpackhi_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_unpackhi_pi32(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_unpacklo_pi8(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_unpacklo_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_unpacklo_pi32(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_add_pi8(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_add_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_add_pi32(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_adds_pi8(__m64 __m1, __m64 __m2) 
+{
+    return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_adds_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);    
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_adds_pu8(__m64 __m1, __m64 __m2) 
+{
+    return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2);
+}
+ 
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_adds_pu16(__m64 __m1, __m64 __m2) 
+{
+    return (__m64)__builtin_ia32_paddusw((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sub_pi8(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_psubb((__v8qi)__m1, (__v8qi)__m2);
+}
+ 
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sub_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2);
+}
+ 
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sub_pi32(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_psubd((__v2si)__m1, (__v2si)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_subs_pi8(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_psubsb((__v8qi)__m1, (__v8qi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_subs_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_psubsw((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_subs_pu8(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_psubusb((__v8qi)__m1, (__v8qi)__m2);
+}
+ 
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_subs_pu16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_psubusw((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_madd_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_pmaddwd((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_mulhi_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_pmulhw((__v4hi)__m1, (__v4hi)__m2);
+}
+ 
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_mullo_pi16(__m64 __m1, __m64 __m2) 
+{
+    return (__m64)__builtin_ia32_pmullw((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sll_pi16(__m64 __m, __m64 __count)
+{
+    return (__m64)__builtin_ia32_psllw((__v4hi)__m, __count);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_slli_pi16(__m64 __m, int __count)
+{
+    return (__m64)__builtin_ia32_psllwi((__v4hi)__m, __count);    
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sll_pi32(__m64 __m, __m64 __count)
+{
+    return (__m64)__builtin_ia32_pslld((__v2si)__m, __count);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_slli_pi32(__m64 __m, int __count)
+{
+    return (__m64)__builtin_ia32_pslldi((__v2si)__m, __count);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sll_si64(__m64 __m, __m64 __count)
+{
+    return (__m64)__builtin_ia32_psllq(__m, __count);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_slli_si64(__m64 __m, int __count)
+{
+    return (__m64)__builtin_ia32_psllqi(__m, __count);    
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sra_pi16(__m64 __m, __m64 __count)
+{
+    return (__m64)__builtin_ia32_psraw((__v4hi)__m, __count);    
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_srai_pi16(__m64 __m, int __count)
+{
+    return (__m64)__builtin_ia32_psrawi((__v4hi)__m, __count);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sra_pi32(__m64 __m, __m64 __count)
+{
+    return (__m64)__builtin_ia32_psrad((__v2si)__m, __count);    
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_srai_pi32(__m64 __m, int __count)
+{
+    return (__m64)__builtin_ia32_psradi((__v2si)__m, __count);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_srl_pi16(__m64 __m, __m64 __count)
+{
+    return (__m64)__builtin_ia32_psrlw((__v4hi)__m, __count);    
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_srli_pi16(__m64 __m, int __count)
+{
+    return (__m64)__builtin_ia32_psrlwi((__v4hi)__m, __count);    
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_srl_pi32(__m64 __m, __m64 __count)
+{
+    return (__m64)__builtin_ia32_psrld((__v2si)__m, __count);       
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_srli_pi32(__m64 __m, int __count)
+{
+    return (__m64)__builtin_ia32_psrldi((__v2si)__m, __count);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_srl_si64(__m64 __m, __m64 __count)
+{
+    return (__m64)__builtin_ia32_psrlq(__m, __count);    
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_srli_si64(__m64 __m, int __count)
+{
+    return (__m64)__builtin_ia32_psrlqi(__m, __count);    
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_and_si64(__m64 __m1, __m64 __m2)
+{
+    return __builtin_ia32_pand(__m1, __m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_andnot_si64(__m64 __m1, __m64 __m2)
+{
+    return __builtin_ia32_pandn(__m1, __m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_or_si64(__m64 __m1, __m64 __m2)
+{
+    return __builtin_ia32_por(__m1, __m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_xor_si64(__m64 __m1, __m64 __m2)
+{
+    return __builtin_ia32_pxor(__m1, __m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_pi8(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_pcmpeqb((__v8qi)__m1, (__v8qi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_pcmpeqw((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_pi32(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_pcmpeqd((__v2si)__m1, (__v2si)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_pi8(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_pcmpgtb((__v8qi)__m1, (__v8qi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_pi16(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_pcmpgtw((__v4hi)__m1, (__v4hi)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_pi32(__m64 __m1, __m64 __m2)
+{
+    return (__m64)__builtin_ia32_pcmpgtd((__v2si)__m1, (__v2si)__m2);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_setzero_si64(void)
+{
+    return (__m64){ 0LL };
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_set_pi32(int __i1, int __i0)
+{
+    return (__m64)__builtin_ia32_vec_init_v2si(__i0, __i1);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_set_pi16(short __s3, short __s2, short __s1, short __s0)
+{
+    return (__m64)__builtin_ia32_vec_init_v4hi(__s0, __s1, __s2, __s3);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_set_pi8(char __b7, char __b6, char __b5, char __b4, char __b3, char __b2,
+            char __b1, char __b0)
+{
+    return (__m64)__builtin_ia32_vec_init_v8qi(__b0, __b1, __b2, __b3,
+                                               __b4, __b5, __b6, __b7);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_set1_pi32(int __i)
+{
+    return _mm_set_pi32(__i, __i);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_set1_pi16(short __w)
+{
+    return _mm_set_pi16(__w, __w, __w, __w);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_set1_pi8(char __b)
+{
+    return _mm_set_pi8(__b, __b, __b, __b, __b, __b, __b, __b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_setr_pi32(int __i0, int __i1)
+{
+    return _mm_set_pi32(__i1, __i0);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_setr_pi16(short __w0, short __w1, short __w2, short __w3)
+{
+    return _mm_set_pi16(__w3, __w2, __w1, __w0);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_setr_pi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5,
+             char __b6, char __b7)
+{
+    return _mm_set_pi8(__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);
+}
+
+
+/* Aliases for compatibility. */
+#define _m_empty _mm_empty
+#define _m_from_int _mm_cvtsi32_si64
+#define _m_to_int _mm_cvtsi64_si32
+#define _m_packsswb _mm_packs_pi16
+#define _m_packssdw _mm_packs_pi32
+#define _m_packuswb _mm_packs_pu16
+#define _m_punpckhbw _mm_unpackhi_pi8
+#define _m_punpckhwd _mm_unpackhi_pi16
+#define _m_punpckhdq _mm_unpackhi_pi32
+#define _m_punpcklbw _mm_unpacklo_pi8
+#define _m_punpcklwd _mm_unpacklo_pi16
+#define _m_punpckldq _mm_unpacklo_pi32
+#define _m_paddb _mm_add_pi8
+#define _m_paddw _mm_add_pi16
+#define _m_paddd _mm_add_pi32
+#define _m_paddsb _mm_adds_pi8
+#define _m_paddsw _mm_adds_pi16
+#define _m_paddusb _mm_adds_pu8
+#define _m_paddusw _mm_adds_pu16
+#define _m_psubb _mm_sub_pi8
+#define _m_psubw _mm_sub_pi16
+#define _m_psubd _mm_sub_pi32
+#define _m_psubsb _mm_subs_pi8
+#define _m_psubsw _mm_subs_pi16
+#define _m_psubusb _mm_subs_pu8
+#define _m_psubusw _mm_subs_pu16
+#define _m_pmaddwd _mm_madd_pi16
+#define _m_pmulhw _mm_mulhi_pi16
+#define _m_pmullw _mm_mullo_pi16
+#define _m_psllw _mm_sll_pi16
+#define _m_psllwi _mm_slli_pi16
+#define _m_pslld _mm_sll_pi32
+#define _m_pslldi _mm_slli_pi32
+#define _m_psllq _mm_sll_si64
+#define _m_psllqi _mm_slli_si64
+#define _m_psraw _mm_sra_pi16
+#define _m_psrawi _mm_srai_pi16
+#define _m_psrad _mm_sra_pi32
+#define _m_psradi _mm_srai_pi32
+#define _m_psrlw _mm_srl_pi16
+#define _m_psrlwi _mm_srli_pi16
+#define _m_psrld _mm_srl_pi32
+#define _m_psrldi _mm_srli_pi32
+#define _m_psrlq _mm_srl_si64
+#define _m_psrlqi _mm_srli_si64
+#define _m_pand _mm_and_si64
+#define _m_pandn _mm_andnot_si64
+#define _m_por _mm_or_si64
+#define _m_pxor _mm_xor_si64
+#define _m_pcmpeqb _mm_cmpeq_pi8
+#define _m_pcmpeqw _mm_cmpeq_pi16
+#define _m_pcmpeqd _mm_cmpeq_pi32
+#define _m_pcmpgtb _mm_cmpgt_pi8
+#define _m_pcmpgtw _mm_cmpgt_pi16
+#define _m_pcmpgtd _mm_cmpgt_pi32
+
+#endif /* __MMX__ */
+
+#endif /* __MMINTRIN_H */
+

Property changes on: lab4/.minix-src/include/clang-3.6/mmintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/prfchwintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/prfchwintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/prfchwintrin.h	(revision 13)
@@ -0,0 +1,39 @@
+/*===---- prfchwintrin.h - PREFETCHW intrinsic -----------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#if !defined(__X86INTRIN_H) && !defined(_MM3DNOW_H_INCLUDED)
+#error "Never use <prfchwintrin.h> directly; include <x86intrin.h> or <mm3dnow.h> instead."
+#endif
+
+#ifndef __PRFCHWINTRIN_H
+#define __PRFCHWINTRIN_H
+
+#if defined(__PRFCHW__) || defined(__3dNOW__)
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_m_prefetchw(void *__P)
+{
+  __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
+}
+#endif
+
+#endif /* __PRFCHWINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/prfchwintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/smmintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/smmintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/smmintrin.h	(revision 13)
@@ -0,0 +1,482 @@
+/*===---- smmintrin.h - SSE4 intrinsics ------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef _SMMINTRIN_H
+#define _SMMINTRIN_H
+
+#ifndef __SSE4_1__
+#error "SSE4.1 instruction set not enabled"
+#else
+
+#include <tmmintrin.h>
+
+/* SSE4 Rounding macros. */
+#define _MM_FROUND_TO_NEAREST_INT    0x00
+#define _MM_FROUND_TO_NEG_INF        0x01
+#define _MM_FROUND_TO_POS_INF        0x02
+#define _MM_FROUND_TO_ZERO           0x03
+#define _MM_FROUND_CUR_DIRECTION     0x04
+
+#define _MM_FROUND_RAISE_EXC         0x00
+#define _MM_FROUND_NO_EXC            0x08
+
+#define _MM_FROUND_NINT      (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEAREST_INT)
+#define _MM_FROUND_FLOOR     (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEG_INF)
+#define _MM_FROUND_CEIL      (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_POS_INF)
+#define _MM_FROUND_TRUNC     (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_ZERO)
+#define _MM_FROUND_RINT      (_MM_FROUND_RAISE_EXC | _MM_FROUND_CUR_DIRECTION)
+#define _MM_FROUND_NEARBYINT (_MM_FROUND_NO_EXC | _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_ceil_ps(X)       _mm_round_ps((X), _MM_FROUND_CEIL)
+#define _mm_ceil_pd(X)       _mm_round_pd((X), _MM_FROUND_CEIL)
+#define _mm_ceil_ss(X, Y)    _mm_round_ss((X), (Y), _MM_FROUND_CEIL)
+#define _mm_ceil_sd(X, Y)    _mm_round_sd((X), (Y), _MM_FROUND_CEIL)
+
+#define _mm_floor_ps(X)      _mm_round_ps((X), _MM_FROUND_FLOOR)
+#define _mm_floor_pd(X)      _mm_round_pd((X), _MM_FROUND_FLOOR)
+#define _mm_floor_ss(X, Y)   _mm_round_ss((X), (Y), _MM_FROUND_FLOOR)
+#define _mm_floor_sd(X, Y)   _mm_round_sd((X), (Y), _MM_FROUND_FLOOR)
+
+#define _mm_round_ps(X, M) __extension__ ({ \
+  __m128 __X = (X); \
+  (__m128) __builtin_ia32_roundps((__v4sf)__X, (M)); })
+
+#define _mm_round_ss(X, Y, M) __extension__ ({ \
+  __m128 __X = (X); \
+  __m128 __Y = (Y); \
+  (__m128) __builtin_ia32_roundss((__v4sf)__X, (__v4sf)__Y, (M)); })
+
+#define _mm_round_pd(X, M) __extension__ ({ \
+  __m128d __X = (X); \
+  (__m128d) __builtin_ia32_roundpd((__v2df)__X, (M)); })
+
+#define _mm_round_sd(X, Y, M) __extension__ ({ \
+  __m128d __X = (X); \
+  __m128d __Y = (Y); \
+  (__m128d) __builtin_ia32_roundsd((__v2df)__X, (__v2df)__Y, (M)); })
+
+/* SSE4 Packed Blending Intrinsics.  */
+#define _mm_blend_pd(V1, V2, M) __extension__ ({ \
+  __m128d __V1 = (V1); \
+  __m128d __V2 = (V2); \
+  (__m128d)__builtin_shufflevector((__v2df)__V1, (__v2df)__V2, \
+                                   (((M) & 0x01) ? 2 : 0), \
+                                   (((M) & 0x02) ? 3 : 1)); })
+
+#define _mm_blend_ps(V1, V2, M) __extension__ ({ \
+  __m128 __V1 = (V1); \
+  __m128 __V2 = (V2); \
+  (__m128)__builtin_shufflevector((__v4sf)__V1, (__v4sf)__V2, \
+                                  (((M) & 0x01) ? 4 : 0), \
+                                  (((M) & 0x02) ? 5 : 1), \
+                                  (((M) & 0x04) ? 6 : 2), \
+                                  (((M) & 0x08) ? 7 : 3)); })
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_blendv_pd (__m128d __V1, __m128d __V2, __m128d __M)
+{
+  return (__m128d) __builtin_ia32_blendvpd ((__v2df)__V1, (__v2df)__V2,
+                                            (__v2df)__M);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_blendv_ps (__m128 __V1, __m128 __V2, __m128 __M)
+{
+  return (__m128) __builtin_ia32_blendvps ((__v4sf)__V1, (__v4sf)__V2,
+                                           (__v4sf)__M);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_blendv_epi8 (__m128i __V1, __m128i __V2, __m128i __M)
+{
+  return (__m128i) __builtin_ia32_pblendvb128 ((__v16qi)__V1, (__v16qi)__V2,
+                                               (__v16qi)__M);
+}
+
+#define _mm_blend_epi16(V1, V2, M) __extension__ ({ \
+  __m128i __V1 = (V1); \
+  __m128i __V2 = (V2); \
+  (__m128i)__builtin_shufflevector((__v8hi)__V1, (__v8hi)__V2, \
+                                   (((M) & 0x01) ?  8 : 0), \
+                                   (((M) & 0x02) ?  9 : 1), \
+                                   (((M) & 0x04) ? 10 : 2), \
+                                   (((M) & 0x08) ? 11 : 3), \
+                                   (((M) & 0x10) ? 12 : 4), \
+                                   (((M) & 0x20) ? 13 : 5), \
+                                   (((M) & 0x40) ? 14 : 6), \
+                                   (((M) & 0x80) ? 15 : 7)); })
+
+/* SSE4 Dword Multiply Instructions.  */
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_mullo_epi32 (__m128i __V1, __m128i __V2)
+{
+  return (__m128i) ((__v4si)__V1 * (__v4si)__V2);
+}
+
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_mul_epi32 (__m128i __V1, __m128i __V2)
+{
+  return (__m128i) __builtin_ia32_pmuldq128 ((__v4si)__V1, (__v4si)__V2);
+}
+
+/* SSE4 Floating Point Dot Product Instructions.  */
+#define _mm_dp_ps(X, Y, M) __extension__ ({ \
+  __m128 __X = (X); \
+  __m128 __Y = (Y); \
+  (__m128) __builtin_ia32_dpps((__v4sf)__X, (__v4sf)__Y, (M)); })
+
+#define _mm_dp_pd(X, Y, M) __extension__ ({\
+  __m128d __X = (X); \
+  __m128d __Y = (Y); \
+  (__m128d) __builtin_ia32_dppd((__v2df)__X, (__v2df)__Y, (M)); })
+
+/* SSE4 Streaming Load Hint Instruction.  */
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_stream_load_si128 (__m128i *__V)
+{
+  return (__m128i) __builtin_ia32_movntdqa ((__v2di *) __V);
+}
+
+/* SSE4 Packed Integer Min/Max Instructions.  */
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_min_epi8 (__m128i __V1, __m128i __V2)
+{
+  return (__m128i) __builtin_ia32_pminsb128 ((__v16qi) __V1, (__v16qi) __V2);
+}
+
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_max_epi8 (__m128i __V1, __m128i __V2)
+{
+  return (__m128i) __builtin_ia32_pmaxsb128 ((__v16qi) __V1, (__v16qi) __V2);
+}
+
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_min_epu16 (__m128i __V1, __m128i __V2)
+{
+  return (__m128i) __builtin_ia32_pminuw128 ((__v8hi) __V1, (__v8hi) __V2);
+}
+
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_max_epu16 (__m128i __V1, __m128i __V2)
+{
+  return (__m128i) __builtin_ia32_pmaxuw128 ((__v8hi) __V1, (__v8hi) __V2);
+}
+
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_min_epi32 (__m128i __V1, __m128i __V2)
+{
+  return (__m128i) __builtin_ia32_pminsd128 ((__v4si) __V1, (__v4si) __V2);
+}
+
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_max_epi32 (__m128i __V1, __m128i __V2)
+{
+  return (__m128i) __builtin_ia32_pmaxsd128 ((__v4si) __V1, (__v4si) __V2);
+}
+
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_min_epu32 (__m128i __V1, __m128i __V2)
+{
+  return (__m128i) __builtin_ia32_pminud128((__v4si) __V1, (__v4si) __V2);
+}
+
+static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_max_epu32 (__m128i __V1, __m128i __V2)
+{
+  return (__m128i) __builtin_ia32_pmaxud128((__v4si) __V1, (__v4si) __V2);
+}
+
+/* SSE4 Insertion and Extraction from XMM Register Instructions.  */
+#define _mm_insert_ps(X, Y, N) __builtin_ia32_insertps128((X), (Y), (N))
+#define _mm_extract_ps(X, N) (__extension__                      \
+                              ({ union { int __i; float __f; } __t;  \
+                                 __v4sf __a = (__v4sf)(X);       \
+                                 __t.__f = __a[(N) & 3];                 \
+                                 __t.__i;}))
+
+/* Miscellaneous insert and extract macros.  */
+/* Extract a single-precision float from X at index N into D.  */
+#define _MM_EXTRACT_FLOAT(D, X, N) (__extension__ ({ __v4sf __a = (__v4sf)(X); \
+                                                    (D) = __a[N]; }))
+                                                    
+/* Or together 2 sets of indexes (X and Y) with the zeroing bits (Z) to create
+   an index suitable for _mm_insert_ps.  */
+#define _MM_MK_INSERTPS_NDX(X, Y, Z) (((X) << 6) | ((Y) << 4) | (Z))
+                                           
+/* Extract a float from X at index N into the first index of the return.  */
+#define _MM_PICK_OUT_PS(X, N) _mm_insert_ps (_mm_setzero_ps(), (X),   \
+                                             _MM_MK_INSERTPS_NDX((N), 0, 0x0e))
+                                             
+/* Insert int into packed integer array at index.  */
+#define _mm_insert_epi8(X, I, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \
+                                                   __a[(N) & 15] = (I);             \
+                                                   __a;}))
+#define _mm_insert_epi32(X, I, N) (__extension__ ({ __v4si __a = (__v4si)(X); \
+                                                    __a[(N) & 3] = (I);           \
+                                                    __a;}))
+#ifdef __x86_64__
+#define _mm_insert_epi64(X, I, N) (__extension__ ({ __v2di __a = (__v2di)(X); \
+                                                    __a[(N) & 1] = (I);           \
+                                                    __a;}))
+#endif /* __x86_64__ */
+
+/* Extract int from packed integer array at index.  This returns the element
+ * as a zero extended value, so it is unsigned.
+ */
+#define _mm_extract_epi8(X, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \
+                                                 (int)(unsigned char) \
+                                                     __a[(N) & 15];}))
+#define _mm_extract_epi32(X, N) (__extension__ ({ __v4si __a = (__v4si)(X); \
+                                                  __a[(N) & 3];}))
+#ifdef __x86_64__
+#define _mm_extract_epi64(X, N) (__extension__ ({ __v2di __a = (__v2di)(X); \
+                                                  __a[(N) & 1];}))
+#endif /* __x86_64 */
+
+/* SSE4 128-bit Packed Integer Comparisons.  */
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_testz_si128(__m128i __M, __m128i __V)
+{
+  return __builtin_ia32_ptestz128((__v2di)__M, (__v2di)__V);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_testc_si128(__m128i __M, __m128i __V)
+{
+  return __builtin_ia32_ptestc128((__v2di)__M, (__v2di)__V);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_testnzc_si128(__m128i __M, __m128i __V)
+{
+  return __builtin_ia32_ptestnzc128((__v2di)__M, (__v2di)__V);
+}
+
+#define _mm_test_all_ones(V) _mm_testc_si128((V), _mm_cmpeq_epi32((V), (V)))
+#define _mm_test_mix_ones_zeros(M, V) _mm_testnzc_si128((M), (V))
+#define _mm_test_all_zeros(M, V) _mm_testz_si128 ((M), (V))
+
+/* SSE4 64-bit Packed Integer Comparisons.  */
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_epi64(__m128i __V1, __m128i __V2)
+{
+  return (__m128i)((__v2di)__V1 == (__v2di)__V2);
+}
+
+/* SSE4 Packed Integer Sign-Extension.  */
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepi8_epi16(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovsxbw128((__v16qi) __V);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepi8_epi32(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovsxbd128((__v16qi) __V);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepi8_epi64(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovsxbq128((__v16qi) __V);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepi16_epi32(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovsxwd128((__v8hi) __V); 
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepi16_epi64(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovsxwq128((__v8hi)__V);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepi32_epi64(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovsxdq128((__v4si)__V);
+}
+
+/* SSE4 Packed Integer Zero-Extension.  */
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepu8_epi16(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovzxbw128((__v16qi) __V);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepu8_epi32(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovzxbd128((__v16qi)__V);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepu8_epi64(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovzxbq128((__v16qi)__V);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepu16_epi32(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovzxwd128((__v8hi)__V);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepu16_epi64(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovzxwq128((__v8hi)__V);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepu32_epi64(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_pmovzxdq128((__v4si)__V);
+}
+
+/* SSE4 Pack with Unsigned Saturation.  */
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_packus_epi32(__m128i __V1, __m128i __V2)
+{
+  return (__m128i) __builtin_ia32_packusdw128((__v4si)__V1, (__v4si)__V2);
+}
+
+/* SSE4 Multiple Packed Sums of Absolute Difference.  */
+#define _mm_mpsadbw_epu8(X, Y, M) __extension__ ({ \
+  __m128i __X = (X); \
+  __m128i __Y = (Y); \
+  (__m128i) __builtin_ia32_mpsadbw128((__v16qi)__X, (__v16qi)__Y, (M)); })
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_minpos_epu16(__m128i __V)
+{
+  return (__m128i) __builtin_ia32_phminposuw128((__v8hi)__V);
+}
+
+/* These definitions are normally in nmmintrin.h, but gcc puts them in here
+   so we'll do the same.  */
+#ifdef __SSE4_2__
+
+/* These specify the type of data that we're comparing.  */
+#define _SIDD_UBYTE_OPS                 0x00
+#define _SIDD_UWORD_OPS                 0x01
+#define _SIDD_SBYTE_OPS                 0x02
+#define _SIDD_SWORD_OPS                 0x03
+
+/* These specify the type of comparison operation.  */
+#define _SIDD_CMP_EQUAL_ANY             0x00
+#define _SIDD_CMP_RANGES                0x04
+#define _SIDD_CMP_EQUAL_EACH            0x08
+#define _SIDD_CMP_EQUAL_ORDERED         0x0c
+
+/* These macros specify the polarity of the operation.  */
+#define _SIDD_POSITIVE_POLARITY         0x00
+#define _SIDD_NEGATIVE_POLARITY         0x10
+#define _SIDD_MASKED_POSITIVE_POLARITY  0x20
+#define _SIDD_MASKED_NEGATIVE_POLARITY  0x30
+
+/* These macros are used in _mm_cmpXstri() to specify the return.  */
+#define _SIDD_LEAST_SIGNIFICANT         0x00
+#define _SIDD_MOST_SIGNIFICANT          0x40
+
+/* These macros are used in _mm_cmpXstri() to specify the return.  */
+#define _SIDD_BIT_MASK                  0x00
+#define _SIDD_UNIT_MASK                 0x40
+
+/* SSE4.2 Packed Comparison Intrinsics.  */
+#define _mm_cmpistrm(A, B, M) __builtin_ia32_pcmpistrm128((A), (B), (M))
+#define _mm_cmpistri(A, B, M) __builtin_ia32_pcmpistri128((A), (B), (M))
+
+#define _mm_cmpestrm(A, LA, B, LB, M) \
+     __builtin_ia32_pcmpestrm128((A), (LA), (B), (LB), (M))
+#define _mm_cmpestri(A, LA, B, LB, M) \
+     __builtin_ia32_pcmpestri128((A), (LA), (B), (LB), (M))
+     
+/* SSE4.2 Packed Comparison Intrinsics and EFlag Reading.  */
+#define _mm_cmpistra(A, B, M) \
+     __builtin_ia32_pcmpistria128((A), (B), (M))
+#define _mm_cmpistrc(A, B, M) \
+     __builtin_ia32_pcmpistric128((A), (B), (M))
+#define _mm_cmpistro(A, B, M) \
+     __builtin_ia32_pcmpistrio128((A), (B), (M))
+#define _mm_cmpistrs(A, B, M) \
+     __builtin_ia32_pcmpistris128((A), (B), (M))
+#define _mm_cmpistrz(A, B, M) \
+     __builtin_ia32_pcmpistriz128((A), (B), (M))
+
+#define _mm_cmpestra(A, LA, B, LB, M) \
+     __builtin_ia32_pcmpestria128((A), (LA), (B), (LB), (M))
+#define _mm_cmpestrc(A, LA, B, LB, M) \
+     __builtin_ia32_pcmpestric128((A), (LA), (B), (LB), (M))
+#define _mm_cmpestro(A, LA, B, LB, M) \
+     __builtin_ia32_pcmpestrio128((A), (LA), (B), (LB), (M))
+#define _mm_cmpestrs(A, LA, B, LB, M) \
+     __builtin_ia32_pcmpestris128((A), (LA), (B), (LB), (M))
+#define _mm_cmpestrz(A, LA, B, LB, M) \
+     __builtin_ia32_pcmpestriz128((A), (LA), (B), (LB), (M))
+
+/* SSE4.2 Compare Packed Data -- Greater Than.  */
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_epi64(__m128i __V1, __m128i __V2)
+{
+  return (__m128i)((__v2di)__V1 > (__v2di)__V2);
+}
+
+/* SSE4.2 Accumulate CRC32.  */
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_mm_crc32_u8(unsigned int __C, unsigned char __D)
+{
+  return __builtin_ia32_crc32qi(__C, __D);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_mm_crc32_u16(unsigned int __C, unsigned short __D)
+{
+  return __builtin_ia32_crc32hi(__C, __D);
+}
+
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+_mm_crc32_u32(unsigned int __C, unsigned int __D)
+{
+  return __builtin_ia32_crc32si(__C, __D);
+}
+
+#ifdef __x86_64__
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+_mm_crc32_u64(unsigned long long __C, unsigned long long __D)
+{
+  return __builtin_ia32_crc32di(__C, __D);
+}
+#endif /* __x86_64__ */
+
+#ifdef __POPCNT__
+#include <popcntintrin.h>
+#endif
+
+#endif /* __SSE4_2__ */
+#endif /* __SSE4_1__ */
+
+#endif /* _SMMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/smmintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/wmmintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/wmmintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/wmmintrin.h	(revision 13)
@@ -0,0 +1,42 @@
+/*===---- wmmintrin.h - AES intrinsics ------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef _WMMINTRIN_H
+#define _WMMINTRIN_H
+
+#include <emmintrin.h>
+
+#if !defined (__AES__) && !defined (__PCLMUL__)
+# error "AES/PCLMUL instructions not enabled"
+#else
+
+#ifdef __AES__
+#include <__wmmintrin_aes.h>
+#endif /* __AES__ */
+
+#ifdef __PCLMUL__
+#include <__wmmintrin_pclmul.h>
+#endif /* __PCLMUL__ */
+
+#endif /* __AES__ || __PCLMUL__ */
+#endif /* _WMMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/wmmintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/minix/msg_queue.h
===================================================================
--- lab4/.minix-src/include/ddekit/minix/msg_queue.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/minix/msg_queue.h	(revision 13)
@@ -0,0 +1,21 @@
+#ifndef DDEKIT_SRC_MSG_QUEUE_H
+#define DDEKIT_SRC_MSG_QUEUE_H
+
+#include <ddekit/ddekit.h>
+#include <ddekit/thread.h> 
+#include <minix/ipc.h>
+
+struct ddekit_minix_msg_q; 
+
+void ddekit_minix_queue_msg(message *m, int ipc_status);
+
+void ddekit_minix_rcv 
+            (struct ddekit_minix_msg_q * mq, message *m, int *ipc_status);
+
+struct ddekit_minix_msg_q *ddekit_minix_create_msg_q(unsigned from,
+	unsigned to);
+
+void ddekit_minix_destroy_msg_q(struct ddekit_minix_msg_q *mq);
+
+
+#endif /* DDEKIT_SRC_MSG_QUEUE_H */

Property changes on: lab4/.minix-src/include/ddekit/minix/msg_queue.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/condvar.h
===================================================================
--- lab4/.minix-src/include/ddekit/condvar.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/condvar.h	(revision 13)
@@ -0,0 +1,31 @@
+#ifndef _ddekit_condvar_h
+#define _ddekit_condvar_h
+
+/** \file ddekit/condvar.h */
+#include <ddekit/ddekit.h>
+
+#include <ddekit/lock.h>
+
+struct ddekit_condvar;
+typedef struct ddekit_condvar ddekit_condvar_t;
+
+/* Initialize conditional variable. */
+ddekit_condvar_t * ddekit_condvar_init(void);
+
+/* Uninitialize conditional variable. */
+void ddekit_condvar_deinit(ddekit_condvar_t *cvp);
+
+/* Wait on a conditional variable. */
+void ddekit_condvar_waiti(ddekit_condvar_t *cvp, ddekit_lock_t *mp);
+
+/* Wait on a conditional variable at most until a timeout expires. (UNIMPL) */
+int ddekit_condvar_wait_timed(ddekit_condvar_t *cvp, ddekit_lock_t *mp,
+	int timo);
+
+/* Send signal to the next one waiting for condvar. */
+void ddekit_condvar_signal(ddekit_condvar_t *cvp);
+
+/* Send signal to all threads waiting for condvar. */
+void ddekit_condvar_broadcast(ddekit_condvar_t *cvp);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/condvar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/inline.h
===================================================================
--- lab4/.minix-src/include/ddekit/inline.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/inline.h	(revision 13)
@@ -0,0 +1,2 @@
+#define DDEKIT_INLINE __inline__ __attribute__((always_inline))
+

Property changes on: lab4/.minix-src/include/ddekit/inline.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/assert.h
===================================================================
--- lab4/.minix-src/include/ddekit/assert.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/assert.h	(revision 13)
@@ -0,0 +1,23 @@
+#ifndef _ddekit_assert_h
+#define _ddekit_assert_h
+#include <ddekit/ddekit.h>
+
+#include <ddekit/printf.h>
+#include <ddekit/panic.h>
+
+/** \file ddekit/assert.h */
+
+/** Assert that an expression is true and panic if not. 
+ * \ingroup DDEKit_util
+ */
+#define ddekit_assert(expr)	do 									\
+	{														\
+		if (!(expr)) {										\
+			ddekit_print("\033[31;1mDDE: Assertion failed: "#expr"\033[0m\n");	\
+			ddekit_printf("  File: %s:%d\n",__FILE__,__LINE__); 		\
+			ddekit_printf("  Function: %s()\n", __FUNCTION__);	\
+			ddekit_panic("Assertion failed.");				\
+		}} while (0);
+#define Assert ddekit_assert
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/assert.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/pci.h
===================================================================
--- lab4/.minix-src/include/ddekit/pci.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/pci.h	(revision 13)
@@ -0,0 +1,210 @@
+#ifndef _DDEKIT_PCI_H
+#define _DDEKIT_PCI_H
+#include <ddekit/ddekit.h>
+
+#include <ddekit/types.h>
+
+/** \defgroup DDEKit_pci */
+
+/** Our version of PCI_ANY_ID */
+#define DDEKIT_PCI_ANY_ID    (~0)
+
+/** Copy of L4IO_PCIDEV_RES */
+#define DDEKIT_PCIDEV_RES	 12
+
+struct ddekit_pci_dev;
+
+/** PCI resource descriptor. Copied from generic_io. 
+ *
+ * XXX!
+ */
+typedef struct ddekit_pci_resource {
+	unsigned long start;
+	unsigned long end;
+	unsigned long flags;
+} ddekit_pci_res_t;
+
+void ddekit_pci_init(void);
+
+int ddekit_pci_get_device(int nr, int *bus, int *slot, int *func);
+
+int ddekit_pci_read(int bus, int slot, int func, int pos, int len,
+	ddekit_uint32_t *val);
+int ddekit_pci_write(int bus, int slot, int func, int pos, int len,
+	ddekit_uint32_t val);
+
+/** Read byte from PCI config space.
+ *
+ * \ingroup DDEKit_pci
+ *
+ * \param bus      bus ID
+ * \param slot     slot #
+ * \param func     function #
+ * \param pos      offset in config space
+ * \retval val     read value
+ *
+ * \return 0       success
+ */
+int ddekit_pci_readb(int bus, int slot, int func, int pos,
+	ddekit_uint8_t *val);
+
+/** Read word from PCI config space.
+ *
+ * \ingroup DDEKit_pci
+ *
+ * \param bus      bus ID
+ * \param slot     slot #
+ * \param func     function #
+ * \param pos      offset in config space
+ * \retval val     read value
+ *
+ * \return 0       success
+ */
+int ddekit_pci_readw(int bus, int slot, int func, int pos,
+	ddekit_uint16_t *val);
+
+/** Read dword from PCI config space.
+ *
+ * \ingroup DDEKit_pci
+ *
+ * \param bus      bus ID
+ * \param slot     slot #
+ * \param func     function #
+ * \param pos      offset in config space
+ * \retval val     read value
+ *
+ * \return 0       success
+ */
+int ddekit_pci_readl(int bus, int slot, int func, int pos,
+	ddekit_uint32_t *val);
+
+/** Write byte to PCI config space.
+ *
+ * \ingroup DDEKit_pci
+ *
+ * \param bus      bus ID
+ * \param slot     slot #
+ * \param func     function #
+ * \param pos      offset in config space
+ * \retval val     value to write
+ *
+ * \return 0       success
+ */
+int ddekit_pci_writeb(int bus, int slot, int func, int pos,
+	ddekit_uint8_t val);
+
+/** Write word to PCI config space.
+ *
+ * \ingroup DDEKit_pci
+ *
+ * \param bus      bus ID
+ * \param slot     slot #
+ * \param func     function #
+ * \param pos      offset in config space
+ * \retval val     value to write
+ *
+ * \return 0       success
+ */
+int ddekit_pci_writew(int bus, int slot, int func, int pos,
+	ddekit_uint16_t val);
+
+/** Write word to PCI config space.
+ *
+ * \ingroup DDEKit_pci
+ *
+ * \param bus      bus ID
+ * \param slot     slot #
+ * \param func     function #
+ * \param pos      offset in config space
+ * \retval val     value to write
+ *
+ * \return 0       success
+ */
+int ddekit_pci_writel(int bus, int slot, int func, int pos,
+	ddekit_uint32_t val);
+
+/** Find a PCI device.
+ *
+ * \ingroup DDEKit_pci
+ *
+ * \param bus	pointer to bus number or \ref DDEKIT_PCI_ANY_ID
+ * \param slot  pointer to slot number (devfn >> DEVFN_SLOTSHIFT) or \ref DDEKIT_PCI_ANY_ID
+ * \param func  pointer to func number (devfc & DEVFN_FUNCMASK) or \ref DDEKIT_PCI_ANY_ID
+ * \param start search device list only behind this device (excluding it!), NULL
+ *              searches whole device list
+ *
+ * \retval bus      bus number
+ * \retval slot     slot number
+ * \retval func     function number
+ *
+ * \return device   a valid PCI device
+ * \return NULL     if no device found
+ */
+struct ddekit_pci_dev * ddekit_pci_find_device(int *bus, int *slot, int
+	*func, struct ddekit_pci_dev *start);
+
+/** Enable PCI device
+ * \ingroup DDEKit_pci
+ */
+int ddekit_pci_enable_device(struct ddekit_pci_dev *dev);
+
+/** Disable PCI device
+ * \ingroup DDEKit_pci
+ */
+int ddekit_pci_disable_device(struct ddekit_pci_dev *dev);
+
+/** Enable bus-mastering for device.
+ * \ingroup DDEKit_pci
+ */
+void ddekit_pci_set_master(struct ddekit_pci_dev *dev);
+
+/** Get device vendor ID.
+ * \ingroup DDEKit_pci
+ */
+unsigned short ddekit_pci_get_vendor(struct ddekit_pci_dev *dev);
+
+/** Get device ID.
+ * \ingroup DDEKit_pci
+ */
+unsigned short ddekit_pci_get_device_id(struct ddekit_pci_dev *dev);
+
+/** Get device subvendor ID.
+ * \ingroup DDEKit_pci
+ */
+unsigned short ddekit_pci_get_sub_vendor(struct ddekit_pci_dev *dev);
+
+/** Get subdevice ID.
+ * \ingroup DDEKit_pci
+ */
+unsigned short ddekit_pci_get_sub_device(struct ddekit_pci_dev *dev);
+
+/** Get device class ID.
+ * \ingroup DDEKit_pci
+ */
+unsigned ddekit_pci_get_dev_class(struct ddekit_pci_dev *dev);
+
+/** Get device's IRQ number.
+ * \ingroup DDEKit_pci
+ */
+unsigned long ddekit_pci_get_irq(struct ddekit_pci_dev *dev);
+
+/** Get device name.
+ * \ingroup DDEKit_pci
+ */
+char *ddekit_pci_get_name(struct ddekit_pci_dev *dev);
+
+/** Get device's slot name.
+ * \ingroup DDEKit_pci
+ */
+char *ddekit_pci_get_slot_name(struct ddekit_pci_dev *dev);
+
+/** Get one of the device's resources.
+ * \ingroup DDEKit_pci
+ */
+ddekit_pci_res_t *ddekit_pci_get_resource(struct ddekit_pci_dev *dev,
+	unsigned int idx);
+
+int ddekit_pci_irq_enable(int bus, int slot, int func, int pin, int
+	*irq);
+
+#endif 

Property changes on: lab4/.minix-src/include/ddekit/pci.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/debug.h
===================================================================
--- lab4/.minix-src/include/ddekit/debug.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/debug.h	(revision 13)
@@ -0,0 +1,41 @@
+#ifndef DDEKIT_DEBUG_H
+#define DDEKIT_DEBUG_H
+#include <ddekit/ddekit.h>
+#include <ddekit/printf.h>
+
+#define DDEBUG_QUIET 0
+#define DDEBUG_ERR 1
+#define DDEBUG_WARN 2
+#define DDEBUG_INFO 3
+#define DDEBUG_VERBOSE 4
+
+#define DDEBUG_MEM DDEBUG_INFO
+
+#define DDEBUG_MSG_ERR(fmt, ...)
+#define DDEBUG_MSG_WARN(fmt, ...)
+#define DDEBUG_MSG_INFO(fmt, ...)
+#define DDEBUG_MSG_VERBOSE(fmt, ...)
+
+#if DDEBUG >= DDEBUG_ERR
+#undef DDEBUG_MSG_ERR
+#define  DDEBUG_MSG_ERR(fmt, ...) ddekit_printf("%s : "fmt"\n", __func__, ##__VA_ARGS__ ) 
+#endif
+
+#if DDEBUG >= DDEBUG_WARN
+#undef DDEBUG_MSG_WARN
+#define  DDEBUG_MSG_WARN(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ )
+#endif
+
+#if DDEBUG >= DDEBUG_INFO
+#undef DDEBUG_MSG_INFO
+#define  DDEBUG_MSG_INFO(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ )
+#endif
+
+#if DDEBUG >= DDEBUG_VERBOSE
+#undef DDEBUG_MSG_VERBOSE
+#define  DDEBUG_MSG_VERBOSE(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ ) 
+#endif
+
+#endif
+
+

Property changes on: lab4/.minix-src/include/ddekit/debug.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/panic.h
===================================================================
--- lab4/.minix-src/include/ddekit/panic.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/panic.h	(revision 13)
@@ -0,0 +1,18 @@
+#ifndef _DDEKIT_PANIC_H
+#define _DDEKIT_PANIC_H
+#include <ddekit/ddekit.h>
+#include <stdarg.h>
+
+/** \defgroup DDEKit_util */
+
+/** Panic - print error message and enter the kernel debugger.
+ * \ingroup DDEKit_util
+ */
+void ddekit_panic(char *fmt, ...);
+
+/** Print a debug message.
+ * \ingroup DDEKit_util
+ */
+void ddekit_debug(char *fmt, ...);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/panic.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/lock.h
===================================================================
--- lab4/.minix-src/include/ddekit/lock.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/lock.h	(revision 13)
@@ -0,0 +1,33 @@
+#ifndef _DDEKIT_LOCK_H
+#define _DDEKIT_LOCK_H
+
+#include <ddekit/ddekit.h>
+
+struct ddekit_lock;
+typedef struct ddekit_lock *ddekit_lock_t;
+
+/* Initialize a DDEKit unlocked lock. */
+#define ddekit_lock_init	ddekit_lock_init_unlocked
+
+/* Initialize a DDEKit unlocked lock. */
+void ddekit_lock_init_unlocked(ddekit_lock_t *mtx);
+
+/* Initialize a DDEKit locked lock.  */
+void ddekit_lock_init_locked(ddekit_lock_t *mtx);
+
+/* Uninitialize a DDEKit lock. */
+void ddekit_lock_deinit(ddekit_lock_t *mtx);
+
+/* Acquire a lock. */
+void ddekit_lock_lock(ddekit_lock_t *mtx);
+
+/* Acquire a lock, non-blocking. */
+int ddekit_lock_try_lock(ddekit_lock_t *mtx);
+
+/* Unlock function. */
+void ddekit_lock_unlock(ddekit_lock_t *mtx);
+
+/* Get lock owner. */
+int ddekit_lock_owner(ddekit_lock_t *mtx);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/lock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/resources.h
===================================================================
--- lab4/.minix-src/include/ddekit/resources.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/resources.h	(revision 13)
@@ -0,0 +1,80 @@
+#ifndef _DDEKIT_RESOURCES_H
+#define _DDEKIT_RESOURCES_H
+
+#include <ddekit/ddekit.h>
+#include <ddekit/types.h>
+
+
+/*
+ * request/release an isa DMA-channel
+ */
+
+int ddekit_request_dma(int nr);
+int ddekit_release_dma(int nr);
+
+/*
+ * request/release an io-port range starting at addr start, lenght of count
+ */
+int ddekit_request_io(ddekit_addr_t start, ddekit_addr_t count);
+int ddekit_release_io(ddekit_addr_t start, ddekit_addr_t count);
+
+/*
+ * request an IO-Memory mapping from address start to vaddr of the length count
+ */
+int ddekit_request_mem(ddekit_addr_t start, ddekit_addr_t count,
+	ddekit_addr_t *vaddr);
+int ddekit_release_mem(ddekit_addr_t start, ddekit_addr_t count);
+
+/**
+ * Read I/O port (byte)
+ *
+ * \param port  port to read
+ *
+ * \return value read from port
+ */
+unsigned char ddekit_inb(ddekit_addr_t port);
+
+/**
+ * Read I/O port (2-byte)
+ *
+ * \param port  port to read
+ *
+ * \return value read from port
+ */
+unsigned short ddekit_inw(ddekit_addr_t port);
+
+/**
+ * Read I/O port (4-byte)
+ *
+ * \param port  port to read
+ *
+ * \return value read from port
+ */
+unsigned long ddekit_inl(ddekit_addr_t port);
+
+/**
+ * Write I/O port (byte)
+ *
+ * \param port  port to write
+ * \param val   value to write
+ */
+void ddekit_outb(ddekit_addr_t port, unsigned char val);
+
+/**
+ * Write I/O port (2-byte)
+ *
+ * \param port  port to write
+ * \param val   value to write
+ */
+void ddekit_outw(ddekit_addr_t port, unsigned short val);
+
+/**
+ * Write I/O port (4-byte)
+ *
+ * \param port  port to write
+ * \param val   value to write
+ */
+void ddekit_outl(ddekit_addr_t port, unsigned long val);
+
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/resources.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/semaphore.h
===================================================================
--- lab4/.minix-src/include/ddekit/semaphore.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/semaphore.h	(revision 13)
@@ -0,0 +1,53 @@
+#ifndef _DDEKIT_SEMAPHORE_H
+#define _DDEKIT_SEMAPHORE_H
+
+#include <ddekit/ddekit.h>
+
+
+/** \defgroup DDEKit_synchronization */
+
+struct ddekit_sem;
+typedef struct ddekit_sem ddekit_sem_t;
+
+/** Initialize DDEKit semaphore.
+ *
+ * \ingroup DDEKit_synchronization
+ *
+ * \param value  initial semaphore counter
+ */
+ddekit_sem_t *ddekit_sem_init(int value);
+
+/** Uninitialize semaphore.
+ *
+ * \ingroup DDEKit_synchronization
+ */
+void ddekit_sem_deinit(ddekit_sem_t *sem);
+
+/** Semaphore down method. */
+void ddekit_sem_down(ddekit_sem_t *sem);
+
+/** Semaphore down method, non-blocking.
+ *
+ * \ingroup DDEKit_synchronization
+ *
+ * \return 0   success
+ * \return !=0 would block
+ */
+int ddekit_sem_down_try(ddekit_sem_t *sem);
+
+/** Semaphore down with timeout.
+ *
+ * \ingroup DDEKit_synchronization
+ *
+ * \return 0   success
+ * \return !=0 would block
+ */
+int ddekit_sem_down_timed(ddekit_sem_t *sem, int timo);
+
+/** Semaphore up method. 
+ *
+ * \ingroup DDEKit_synchronization
+ */
+void ddekit_sem_up(ddekit_sem_t *sem);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/semaphore.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/avxintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/avxintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/avxintrin.h	(revision 13)
@@ -0,0 +1,1239 @@
+/*===---- avxintrin.h - AVX intrinsics -------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use <avxintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef __AVXINTRIN_H
+#define __AVXINTRIN_H
+
+typedef double __v4df __attribute__ ((__vector_size__ (32)));
+typedef float __v8sf __attribute__ ((__vector_size__ (32)));
+typedef long long __v4di __attribute__ ((__vector_size__ (32)));
+typedef int __v8si __attribute__ ((__vector_size__ (32)));
+typedef short __v16hi __attribute__ ((__vector_size__ (32)));
+typedef char __v32qi __attribute__ ((__vector_size__ (32)));
+
+typedef float __m256 __attribute__ ((__vector_size__ (32)));
+typedef double __m256d __attribute__((__vector_size__(32)));
+typedef long long __m256i __attribute__((__vector_size__(32)));
+
+/* Arithmetic */
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_add_pd(__m256d __a, __m256d __b)
+{
+  return __a+__b;
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_add_ps(__m256 __a, __m256 __b)
+{
+  return __a+__b;
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_sub_pd(__m256d __a, __m256d __b)
+{
+  return __a-__b;
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_sub_ps(__m256 __a, __m256 __b)
+{
+  return __a-__b;
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_addsub_pd(__m256d __a, __m256d __b)
+{
+  return (__m256d)__builtin_ia32_addsubpd256((__v4df)__a, (__v4df)__b);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_addsub_ps(__m256 __a, __m256 __b)
+{
+  return (__m256)__builtin_ia32_addsubps256((__v8sf)__a, (__v8sf)__b);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_div_pd(__m256d __a, __m256d __b)
+{
+  return __a / __b;
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_div_ps(__m256 __a, __m256 __b)
+{
+  return __a / __b;
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_max_pd(__m256d __a, __m256d __b)
+{
+  return (__m256d)__builtin_ia32_maxpd256((__v4df)__a, (__v4df)__b);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_max_ps(__m256 __a, __m256 __b)
+{
+  return (__m256)__builtin_ia32_maxps256((__v8sf)__a, (__v8sf)__b);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_min_pd(__m256d __a, __m256d __b)
+{
+  return (__m256d)__builtin_ia32_minpd256((__v4df)__a, (__v4df)__b);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_min_ps(__m256 __a, __m256 __b)
+{
+  return (__m256)__builtin_ia32_minps256((__v8sf)__a, (__v8sf)__b);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_mul_pd(__m256d __a, __m256d __b)
+{
+  return __a * __b;
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_mul_ps(__m256 __a, __m256 __b)
+{
+  return __a * __b;
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_sqrt_pd(__m256d __a)
+{
+  return (__m256d)__builtin_ia32_sqrtpd256((__v4df)__a);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_sqrt_ps(__m256 __a)
+{
+  return (__m256)__builtin_ia32_sqrtps256((__v8sf)__a);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_rsqrt_ps(__m256 __a)
+{
+  return (__m256)__builtin_ia32_rsqrtps256((__v8sf)__a);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_rcp_ps(__m256 __a)
+{
+  return (__m256)__builtin_ia32_rcpps256((__v8sf)__a);
+}
+
+#define _mm256_round_pd(V, M) __extension__ ({ \
+    __m256d __V = (V); \
+    (__m256d)__builtin_ia32_roundpd256((__v4df)__V, (M)); })
+
+#define _mm256_round_ps(V, M) __extension__ ({ \
+  __m256 __V = (V); \
+  (__m256)__builtin_ia32_roundps256((__v8sf)__V, (M)); })
+
+#define _mm256_ceil_pd(V)  _mm256_round_pd((V), _MM_FROUND_CEIL)
+#define _mm256_floor_pd(V) _mm256_round_pd((V), _MM_FROUND_FLOOR)
+#define _mm256_ceil_ps(V)  _mm256_round_ps((V), _MM_FROUND_CEIL)
+#define _mm256_floor_ps(V) _mm256_round_ps((V), _MM_FROUND_FLOOR)
+
+/* Logical */
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_and_pd(__m256d __a, __m256d __b)
+{
+  return (__m256d)((__v4di)__a & (__v4di)__b);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_and_ps(__m256 __a, __m256 __b)
+{
+  return (__m256)((__v8si)__a & (__v8si)__b);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_andnot_pd(__m256d __a, __m256d __b)
+{
+  return (__m256d)(~(__v4di)__a & (__v4di)__b);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_andnot_ps(__m256 __a, __m256 __b)
+{
+  return (__m256)(~(__v8si)__a & (__v8si)__b);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_or_pd(__m256d __a, __m256d __b)
+{
+  return (__m256d)((__v4di)__a | (__v4di)__b);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_or_ps(__m256 __a, __m256 __b)
+{
+  return (__m256)((__v8si)__a | (__v8si)__b);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_xor_pd(__m256d __a, __m256d __b)
+{
+  return (__m256d)((__v4di)__a ^ (__v4di)__b);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_xor_ps(__m256 __a, __m256 __b)
+{
+  return (__m256)((__v8si)__a ^ (__v8si)__b);
+}
+
+/* Horizontal arithmetic */
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_hadd_pd(__m256d __a, __m256d __b)
+{
+  return (__m256d)__builtin_ia32_haddpd256((__v4df)__a, (__v4df)__b);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_hadd_ps(__m256 __a, __m256 __b)
+{
+  return (__m256)__builtin_ia32_haddps256((__v8sf)__a, (__v8sf)__b);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_hsub_pd(__m256d __a, __m256d __b)
+{
+  return (__m256d)__builtin_ia32_hsubpd256((__v4df)__a, (__v4df)__b);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_hsub_ps(__m256 __a, __m256 __b)
+{
+  return (__m256)__builtin_ia32_hsubps256((__v8sf)__a, (__v8sf)__b);
+}
+
+/* Vector permutations */
+static __inline __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_permutevar_pd(__m128d __a, __m128i __c)
+{
+  return (__m128d)__builtin_ia32_vpermilvarpd((__v2df)__a, (__v2di)__c);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_permutevar_pd(__m256d __a, __m256i __c)
+{
+  return (__m256d)__builtin_ia32_vpermilvarpd256((__v4df)__a, (__v4di)__c);
+}
+
+static __inline __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_permutevar_ps(__m128 __a, __m128i __c)
+{
+  return (__m128)__builtin_ia32_vpermilvarps((__v4sf)__a, (__v4si)__c);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_permutevar_ps(__m256 __a, __m256i __c)
+{
+  return (__m256)__builtin_ia32_vpermilvarps256((__v8sf)__a,
+						  (__v8si)__c);
+}
+
+#define _mm_permute_pd(A, C) __extension__ ({ \
+  __m128d __A = (A); \
+  (__m128d)__builtin_shufflevector((__v2df)__A, (__v2df) _mm_setzero_pd(), \
+                                   (C) & 0x1, ((C) & 0x2) >> 1); })
+
+#define _mm256_permute_pd(A, C) __extension__ ({ \
+  __m256d __A = (A); \
+  (__m256d)__builtin_shufflevector((__v4df)__A, (__v4df) _mm256_setzero_pd(), \
+                                   (C) & 0x1, ((C) & 0x2) >> 1, \
+                                   2 + (((C) & 0x4) >> 2), \
+                                   2 + (((C) & 0x8) >> 3)); })
+
+#define _mm_permute_ps(A, C) __extension__ ({ \
+  __m128 __A = (A); \
+  (__m128)__builtin_shufflevector((__v4sf)__A, (__v4sf) _mm_setzero_ps(), \
+                                   (C) & 0x3, ((C) & 0xc) >> 2, \
+                                   ((C) & 0x30) >> 4, ((C) & 0xc0) >> 6); })
+
+#define _mm256_permute_ps(A, C) __extension__ ({ \
+  __m256 __A = (A); \
+  (__m256)__builtin_shufflevector((__v8sf)__A, (__v8sf) _mm256_setzero_ps(), \
+                                  (C) & 0x3, ((C) & 0xc) >> 2, \
+                                  ((C) & 0x30) >> 4, ((C) & 0xc0) >> 6, \
+                                  4 + (((C) & 0x03) >> 0), \
+                                  4 + (((C) & 0x0c) >> 2), \
+                                  4 + (((C) & 0x30) >> 4), \
+                                  4 + (((C) & 0xc0) >> 6)); })
+
+#define _mm256_permute2f128_pd(V1, V2, M) __extension__ ({ \
+  __m256d __V1 = (V1); \
+  __m256d __V2 = (V2); \
+  (__m256d)__builtin_ia32_vperm2f128_pd256((__v4df)__V1, (__v4df)__V2, (M)); })
+
+#define _mm256_permute2f128_ps(V1, V2, M) __extension__ ({ \
+  __m256 __V1 = (V1); \
+  __m256 __V2 = (V2); \
+  (__m256)__builtin_ia32_vperm2f128_ps256((__v8sf)__V1, (__v8sf)__V2, (M)); })
+
+#define _mm256_permute2f128_si256(V1, V2, M) __extension__ ({ \
+  __m256i __V1 = (V1); \
+  __m256i __V2 = (V2); \
+  (__m256i)__builtin_ia32_vperm2f128_si256((__v8si)__V1, (__v8si)__V2, (M)); })
+
+/* Vector Blend */
+#define _mm256_blend_pd(V1, V2, M) __extension__ ({ \
+  __m256d __V1 = (V1); \
+  __m256d __V2 = (V2); \
+  (__m256d)__builtin_shufflevector((__v4df)__V1, (__v4df)__V2, \
+                                   (((M) & 0x01) ? 4 : 0), \
+                                   (((M) & 0x02) ? 5 : 1), \
+                                   (((M) & 0x04) ? 6 : 2), \
+                                   (((M) & 0x08) ? 7 : 3)); })
+
+#define _mm256_blend_ps(V1, V2, M) __extension__ ({ \
+  __m256 __V1 = (V1); \
+  __m256 __V2 = (V2); \
+  (__m256)__builtin_shufflevector((__v8sf)__V1, (__v8sf)__V2, \
+                                  (((M) & 0x01) ?  8 : 0), \
+                                  (((M) & 0x02) ?  9 : 1), \
+                                  (((M) & 0x04) ? 10 : 2), \
+                                  (((M) & 0x08) ? 11 : 3), \
+                                  (((M) & 0x10) ? 12 : 4), \
+                                  (((M) & 0x20) ? 13 : 5), \
+                                  (((M) & 0x40) ? 14 : 6), \
+                                  (((M) & 0x80) ? 15 : 7)); })
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_blendv_pd(__m256d __a, __m256d __b, __m256d __c)
+{
+  return (__m256d)__builtin_ia32_blendvpd256(
+    (__v4df)__a, (__v4df)__b, (__v4df)__c);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
+{
+  return (__m256)__builtin_ia32_blendvps256(
+    (__v8sf)__a, (__v8sf)__b, (__v8sf)__c);
+}
+
+/* Vector Dot Product */
+#define _mm256_dp_ps(V1, V2, M) __extension__ ({ \
+  __m256 __V1 = (V1); \
+  __m256 __V2 = (V2); \
+  (__m256)__builtin_ia32_dpps256((__v8sf)__V1, (__v8sf)__V2, (M)); })
+
+/* Vector shuffle */
+#define _mm256_shuffle_ps(a, b, mask) __extension__ ({ \
+        __m256 __a = (a); \
+        __m256 __b = (b); \
+        (__m256)__builtin_shufflevector((__v8sf)__a, (__v8sf)__b, \
+        (mask) & 0x3,                ((mask) & 0xc) >> 2, \
+        (((mask) & 0x30) >> 4) + 8,  (((mask) & 0xc0) >> 6) + 8, \
+        ((mask) & 0x3) + 4,          (((mask) & 0xc) >> 2) + 4, \
+        (((mask) & 0x30) >> 4) + 12, (((mask) & 0xc0) >> 6) + 12); })
+
+#define _mm256_shuffle_pd(a, b, mask) __extension__ ({ \
+        __m256d __a = (a); \
+        __m256d __b = (b); \
+        (__m256d)__builtin_shufflevector((__v4df)__a, (__v4df)__b, \
+        (mask) & 0x1, \
+        (((mask) & 0x2) >> 1) + 4, \
+        (((mask) & 0x4) >> 2) + 2, \
+        (((mask) & 0x8) >> 3) + 6); })
+
+/* Compare */
+#define _CMP_EQ_OQ    0x00 /* Equal (ordered, non-signaling)  */
+#define _CMP_LT_OS    0x01 /* Less-than (ordered, signaling)  */
+#define _CMP_LE_OS    0x02 /* Less-than-or-equal (ordered, signaling)  */
+#define _CMP_UNORD_Q  0x03 /* Unordered (non-signaling)  */
+#define _CMP_NEQ_UQ   0x04 /* Not-equal (unordered, non-signaling)  */
+#define _CMP_NLT_US   0x05 /* Not-less-than (unordered, signaling)  */
+#define _CMP_NLE_US   0x06 /* Not-less-than-or-equal (unordered, signaling)  */
+#define _CMP_ORD_Q    0x07 /* Ordered (nonsignaling)   */
+#define _CMP_EQ_UQ    0x08 /* Equal (unordered, non-signaling)  */
+#define _CMP_NGE_US   0x09 /* Not-greater-than-or-equal (unord, signaling)  */
+#define _CMP_NGT_US   0x0a /* Not-greater-than (unordered, signaling)  */
+#define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling)  */
+#define _CMP_NEQ_OQ   0x0c /* Not-equal (ordered, non-signaling)  */
+#define _CMP_GE_OS    0x0d /* Greater-than-or-equal (ordered, signaling)  */
+#define _CMP_GT_OS    0x0e /* Greater-than (ordered, signaling)  */
+#define _CMP_TRUE_UQ  0x0f /* True (unordered, non-signaling)  */
+#define _CMP_EQ_OS    0x10 /* Equal (ordered, signaling)  */
+#define _CMP_LT_OQ    0x11 /* Less-than (ordered, non-signaling)  */
+#define _CMP_LE_OQ    0x12 /* Less-than-or-equal (ordered, non-signaling)  */
+#define _CMP_UNORD_S  0x13 /* Unordered (signaling)  */
+#define _CMP_NEQ_US   0x14 /* Not-equal (unordered, signaling)  */
+#define _CMP_NLT_UQ   0x15 /* Not-less-than (unordered, non-signaling)  */
+#define _CMP_NLE_UQ   0x16 /* Not-less-than-or-equal (unord, non-signaling)  */
+#define _CMP_ORD_S    0x17 /* Ordered (signaling)  */
+#define _CMP_EQ_US    0x18 /* Equal (unordered, signaling)  */
+#define _CMP_NGE_UQ   0x19 /* Not-greater-than-or-equal (unord, non-sign)  */
+#define _CMP_NGT_UQ   0x1a /* Not-greater-than (unordered, non-signaling)  */
+#define _CMP_FALSE_OS 0x1b /* False (ordered, signaling)  */
+#define _CMP_NEQ_OS   0x1c /* Not-equal (ordered, signaling)  */
+#define _CMP_GE_OQ    0x1d /* Greater-than-or-equal (ordered, non-signaling)  */
+#define _CMP_GT_OQ    0x1e /* Greater-than (ordered, non-signaling)  */
+#define _CMP_TRUE_US  0x1f /* True (unordered, signaling)  */
+
+#define _mm_cmp_pd(a, b, c) __extension__ ({ \
+  __m128d __a = (a); \
+  __m128d __b = (b); \
+  (__m128d)__builtin_ia32_cmppd((__v2df)__a, (__v2df)__b, (c)); })
+
+#define _mm_cmp_ps(a, b, c) __extension__ ({ \
+  __m128 __a = (a); \
+  __m128 __b = (b); \
+  (__m128)__builtin_ia32_cmpps((__v4sf)__a, (__v4sf)__b, (c)); })
+
+#define _mm256_cmp_pd(a, b, c) __extension__ ({ \
+  __m256d __a = (a); \
+  __m256d __b = (b); \
+  (__m256d)__builtin_ia32_cmppd256((__v4df)__a, (__v4df)__b, (c)); })
+
+#define _mm256_cmp_ps(a, b, c) __extension__ ({ \
+  __m256 __a = (a); \
+  __m256 __b = (b); \
+  (__m256)__builtin_ia32_cmpps256((__v8sf)__a, (__v8sf)__b, (c)); })
+
+#define _mm_cmp_sd(a, b, c) __extension__ ({ \
+  __m128d __a = (a); \
+  __m128d __b = (b); \
+  (__m128d)__builtin_ia32_cmpsd((__v2df)__a, (__v2df)__b, (c)); })
+
+#define _mm_cmp_ss(a, b, c) __extension__ ({ \
+  __m128 __a = (a); \
+  __m128 __b = (b); \
+  (__m128)__builtin_ia32_cmpss((__v4sf)__a, (__v4sf)__b, (c)); })
+
+/* Vector extract */
+#define _mm256_extractf128_pd(A, O) __extension__ ({ \
+  __m256d __A = (A); \
+  (__m128d)__builtin_ia32_vextractf128_pd256((__v4df)__A, (O)); })
+
+#define _mm256_extractf128_ps(A, O) __extension__ ({ \
+  __m256 __A = (A); \
+  (__m128)__builtin_ia32_vextractf128_ps256((__v8sf)__A, (O)); })
+
+#define _mm256_extractf128_si256(A, O) __extension__ ({ \
+  __m256i __A = (A); \
+  (__m128i)__builtin_ia32_vextractf128_si256((__v8si)__A, (O)); })
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_extract_epi32(__m256i __a, int const __imm)
+{
+  __v8si __b = (__v8si)__a;
+  return __b[__imm & 7];
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_extract_epi16(__m256i __a, int const __imm)
+{
+  __v16hi __b = (__v16hi)__a;
+  return __b[__imm & 15];
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_extract_epi8(__m256i __a, int const __imm)
+{
+  __v32qi __b = (__v32qi)__a;
+  return __b[__imm & 31];
+}
+
+#ifdef __x86_64__
+static __inline long long  __attribute__((__always_inline__, __nodebug__))
+_mm256_extract_epi64(__m256i __a, const int __imm)
+{
+  __v4di __b = (__v4di)__a;
+  return __b[__imm & 3];
+}
+#endif
+
+/* Vector insert */
+#define _mm256_insertf128_pd(V1, V2, O) __extension__ ({ \
+  __m256d __V1 = (V1); \
+  __m128d __V2 = (V2); \
+  (__m256d)__builtin_ia32_vinsertf128_pd256((__v4df)__V1, (__v2df)__V2, (O)); })
+
+#define _mm256_insertf128_ps(V1, V2, O) __extension__ ({ \
+  __m256 __V1 = (V1); \
+  __m128 __V2 = (V2); \
+  (__m256)__builtin_ia32_vinsertf128_ps256((__v8sf)__V1, (__v4sf)__V2, (O)); })
+
+#define _mm256_insertf128_si256(V1, V2, O) __extension__ ({ \
+  __m256i __V1 = (V1); \
+  __m128i __V2 = (V2); \
+  (__m256i)__builtin_ia32_vinsertf128_si256((__v8si)__V1, (__v4si)__V2, (O)); })
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_insert_epi32(__m256i __a, int __b, int const __imm)
+{
+  __v8si __c = (__v8si)__a;
+  __c[__imm & 7] = __b;
+  return (__m256i)__c;
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_insert_epi16(__m256i __a, int __b, int const __imm)
+{
+  __v16hi __c = (__v16hi)__a;
+  __c[__imm & 15] = __b;
+  return (__m256i)__c;
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_insert_epi8(__m256i __a, int __b, int const __imm)
+{
+  __v32qi __c = (__v32qi)__a;
+  __c[__imm & 31] = __b;
+  return (__m256i)__c;
+}
+
+#ifdef __x86_64__
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_insert_epi64(__m256i __a, int __b, int const __imm)
+{
+  __v4di __c = (__v4di)__a;
+  __c[__imm & 3] = __b;
+  return (__m256i)__c;
+}
+#endif
+
+/* Conversion */
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepi32_pd(__m128i __a)
+{
+  return (__m256d)__builtin_ia32_cvtdq2pd256((__v4si) __a);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtepi32_ps(__m256i __a)
+{
+  return (__m256)__builtin_ia32_cvtdq2ps256((__v8si) __a);
+}
+
+static __inline __m128 __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtpd_ps(__m256d __a)
+{
+  return (__m128)__builtin_ia32_cvtpd2ps256((__v4df) __a);
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtps_epi32(__m256 __a)
+{
+  return (__m256i)__builtin_ia32_cvtps2dq256((__v8sf) __a);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtps_pd(__m128 __a)
+{
+  return (__m256d)__builtin_ia32_cvtps2pd256((__v4sf) __a);
+}
+
+static __inline __m128i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvttpd_epi32(__m256d __a)
+{
+  return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) __a);
+}
+
+static __inline __m128i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvtpd_epi32(__m256d __a)
+{
+  return (__m128i)__builtin_ia32_cvtpd2dq256((__v4df) __a);
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cvttps_epi32(__m256 __a)
+{
+  return (__m256i)__builtin_ia32_cvttps2dq256((__v8sf) __a);
+}
+
+/* Vector replicate */
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_movehdup_ps(__m256 __a)
+{
+  return __builtin_shufflevector(__a, __a, 1, 1, 3, 3, 5, 5, 7, 7);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_moveldup_ps(__m256 __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 0, 2, 2, 4, 4, 6, 6);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_movedup_pd(__m256d __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 0, 2, 2);
+}
+
+/* Unpack and Interleave */
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_unpackhi_pd(__m256d __a, __m256d __b)
+{
+  return __builtin_shufflevector(__a, __b, 1, 5, 1+2, 5+2);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_unpacklo_pd(__m256d __a, __m256d __b)
+{
+  return __builtin_shufflevector(__a, __b, 0, 4, 0+2, 4+2);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_unpackhi_ps(__m256 __a, __m256 __b)
+{
+  return __builtin_shufflevector(__a, __b, 2, 10, 2+1, 10+1, 6, 14, 6+1, 14+1);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_unpacklo_ps(__m256 __a, __m256 __b)
+{
+  return __builtin_shufflevector(__a, __b, 0, 8, 0+1, 8+1, 4, 12, 4+1, 12+1);
+}
+
+/* Bit Test */
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm_testz_pd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_vtestzpd((__v2df)__a, (__v2df)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm_testc_pd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_vtestcpd((__v2df)__a, (__v2df)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm_testnzc_pd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_vtestnzcpd((__v2df)__a, (__v2df)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm_testz_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_vtestzps((__v4sf)__a, (__v4sf)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm_testc_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_vtestcps((__v4sf)__a, (__v4sf)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm_testnzc_ps(__m128 __a, __m128 __b)
+{
+  return __builtin_ia32_vtestnzcps((__v4sf)__a, (__v4sf)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_testz_pd(__m256d __a, __m256d __b)
+{
+  return __builtin_ia32_vtestzpd256((__v4df)__a, (__v4df)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_testc_pd(__m256d __a, __m256d __b)
+{
+  return __builtin_ia32_vtestcpd256((__v4df)__a, (__v4df)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_testnzc_pd(__m256d __a, __m256d __b)
+{
+  return __builtin_ia32_vtestnzcpd256((__v4df)__a, (__v4df)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_testz_ps(__m256 __a, __m256 __b)
+{
+  return __builtin_ia32_vtestzps256((__v8sf)__a, (__v8sf)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_testc_ps(__m256 __a, __m256 __b)
+{
+  return __builtin_ia32_vtestcps256((__v8sf)__a, (__v8sf)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_testnzc_ps(__m256 __a, __m256 __b)
+{
+  return __builtin_ia32_vtestnzcps256((__v8sf)__a, (__v8sf)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_testz_si256(__m256i __a, __m256i __b)
+{
+  return __builtin_ia32_ptestz256((__v4di)__a, (__v4di)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_testc_si256(__m256i __a, __m256i __b)
+{
+  return __builtin_ia32_ptestc256((__v4di)__a, (__v4di)__b);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_testnzc_si256(__m256i __a, __m256i __b)
+{
+  return __builtin_ia32_ptestnzc256((__v4di)__a, (__v4di)__b);
+}
+
+/* Vector extract sign mask */
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_movemask_pd(__m256d __a)
+{
+  return __builtin_ia32_movmskpd256((__v4df)__a);
+}
+
+static __inline int __attribute__((__always_inline__, __nodebug__))
+_mm256_movemask_ps(__m256 __a)
+{
+  return __builtin_ia32_movmskps256((__v8sf)__a);
+}
+
+/* Vector __zero */
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_zeroall(void)
+{
+  __builtin_ia32_vzeroall();
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_zeroupper(void)
+{
+  __builtin_ia32_vzeroupper();
+}
+
+/* Vector load with broadcast */
+static __inline __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_broadcast_ss(float const *__a)
+{
+  float __f = *__a;
+  return (__m128)(__v4sf){ __f, __f, __f, __f };
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcast_sd(double const *__a)
+{
+  double __d = *__a;
+  return (__m256d)(__v4df){ __d, __d, __d, __d };
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcast_ss(float const *__a)
+{
+  float __f = *__a;
+  return (__m256)(__v8sf){ __f, __f, __f, __f, __f, __f, __f, __f };
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcast_pd(__m128d const *__a)
+{
+  return (__m256d)__builtin_ia32_vbroadcastf128_pd256(__a);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_broadcast_ps(__m128 const *__a)
+{
+  return (__m256)__builtin_ia32_vbroadcastf128_ps256(__a);
+}
+
+/* SIMD load ops */
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_load_pd(double const *__p)
+{
+  return *(__m256d *)__p;
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_load_ps(float const *__p)
+{
+  return *(__m256 *)__p;
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_loadu_pd(double const *__p)
+{
+  struct __loadu_pd {
+    __m256d __v;
+  } __attribute__((packed, may_alias));
+  return ((struct __loadu_pd*)__p)->__v;
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_loadu_ps(float const *__p)
+{
+  struct __loadu_ps {
+    __m256 __v;
+  } __attribute__((packed, may_alias));
+  return ((struct __loadu_ps*)__p)->__v;
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_load_si256(__m256i const *__p)
+{
+  return *__p;
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_loadu_si256(__m256i const *__p)
+{
+  struct __loadu_si256 {
+    __m256i __v;
+  } __attribute__((packed, may_alias));
+  return ((struct __loadu_si256*)__p)->__v;
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_lddqu_si256(__m256i const *__p)
+{
+  return (__m256i)__builtin_ia32_lddqu256((char const *)__p);
+}
+
+/* SIMD store ops */
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_store_pd(double *__p, __m256d __a)
+{
+  *(__m256d *)__p = __a;
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_store_ps(float *__p, __m256 __a)
+{
+  *(__m256 *)__p = __a;
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_storeu_pd(double *__p, __m256d __a)
+{
+  __builtin_ia32_storeupd256(__p, (__v4df)__a);
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_storeu_ps(float *__p, __m256 __a)
+{
+  __builtin_ia32_storeups256(__p, (__v8sf)__a);
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_store_si256(__m256i *__p, __m256i __a)
+{
+  *__p = __a;
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_storeu_si256(__m256i *__p, __m256i __a)
+{
+  __builtin_ia32_storedqu256((char *)__p, (__v32qi)__a);
+}
+
+/* Conditional load ops */
+static __inline __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_maskload_pd(double const *__p, __m128d __m)
+{
+  return (__m128d)__builtin_ia32_maskloadpd((const __v2df *)__p, (__v2df)__m);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_maskload_pd(double const *__p, __m256d __m)
+{
+  return (__m256d)__builtin_ia32_maskloadpd256((const __v4df *)__p,
+                                               (__v4df)__m);
+}
+
+static __inline __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_maskload_ps(float const *__p, __m128 __m)
+{
+  return (__m128)__builtin_ia32_maskloadps((const __v4sf *)__p, (__v4sf)__m);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_maskload_ps(float const *__p, __m256 __m)
+{
+  return (__m256)__builtin_ia32_maskloadps256((const __v8sf *)__p, (__v8sf)__m);
+}
+
+/* Conditional store ops */
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_maskstore_ps(float *__p, __m256 __m, __m256 __a)
+{
+  __builtin_ia32_maskstoreps256((__v8sf *)__p, (__v8sf)__m, (__v8sf)__a);
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm_maskstore_pd(double *__p, __m128d __m, __m128d __a)
+{
+  __builtin_ia32_maskstorepd((__v2df *)__p, (__v2df)__m, (__v2df)__a);
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_maskstore_pd(double *__p, __m256d __m, __m256d __a)
+{
+  __builtin_ia32_maskstorepd256((__v4df *)__p, (__v4df)__m, (__v4df)__a);
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm_maskstore_ps(float *__p, __m128 __m, __m128 __a)
+{
+  __builtin_ia32_maskstoreps((__v4sf *)__p, (__v4sf)__m, (__v4sf)__a);
+}
+
+/* Cacheability support ops */
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_stream_si256(__m256i *__a, __m256i __b)
+{
+  __builtin_ia32_movntdq256((__v4di *)__a, (__v4di)__b);
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_stream_pd(double *__a, __m256d __b)
+{
+  __builtin_ia32_movntpd256(__a, (__v4df)__b);
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_stream_ps(float *__p, __m256 __a)
+{
+  __builtin_ia32_movntps256(__p, (__v8sf)__a);
+}
+
+/* Create vectors */
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_set_pd(double __a, double __b, double __c, double __d)
+{
+  return (__m256d){ __d, __c, __b, __a };
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_set_ps(float __a, float __b, float __c, float __d,
+	            float __e, float __f, float __g, float __h)
+{
+  return (__m256){ __h, __g, __f, __e, __d, __c, __b, __a };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_set_epi32(int __i0, int __i1, int __i2, int __i3,
+		             int __i4, int __i5, int __i6, int __i7)
+{
+  return (__m256i)(__v8si){ __i7, __i6, __i5, __i4, __i3, __i2, __i1, __i0 };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_set_epi16(short __w15, short __w14, short __w13, short __w12,
+		             short __w11, short __w10, short __w09, short __w08,
+		             short __w07, short __w06, short __w05, short __w04,
+		             short __w03, short __w02, short __w01, short __w00)
+{
+  return (__m256i)(__v16hi){ __w00, __w01, __w02, __w03, __w04, __w05, __w06,
+    __w07, __w08, __w09, __w10, __w11, __w12, __w13, __w14, __w15 };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_set_epi8(char __b31, char __b30, char __b29, char __b28,
+		            char __b27, char __b26, char __b25, char __b24,
+		            char __b23, char __b22, char __b21, char __b20,
+		            char __b19, char __b18, char __b17, char __b16,
+		            char __b15, char __b14, char __b13, char __b12,
+		            char __b11, char __b10, char __b09, char __b08,
+		            char __b07, char __b06, char __b05, char __b04,
+		            char __b03, char __b02, char __b01, char __b00)
+{
+  return (__m256i)(__v32qi){
+    __b00, __b01, __b02, __b03, __b04, __b05, __b06, __b07,
+    __b08, __b09, __b10, __b11, __b12, __b13, __b14, __b15,
+    __b16, __b17, __b18, __b19, __b20, __b21, __b22, __b23,
+    __b24, __b25, __b26, __b27, __b28, __b29, __b30, __b31
+  };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_set_epi64x(long long __a, long long __b, long long __c, long long __d)
+{
+  return (__m256i)(__v4di){ __d, __c, __b, __a };
+}
+
+/* Create vectors with elements in reverse order */
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_setr_pd(double __a, double __b, double __c, double __d)
+{
+  return (__m256d){ __a, __b, __c, __d };
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_setr_ps(float __a, float __b, float __c, float __d,
+		           float __e, float __f, float __g, float __h)
+{
+  return (__m256){ __a, __b, __c, __d, __e, __f, __g, __h };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_setr_epi32(int __i0, int __i1, int __i2, int __i3,
+		              int __i4, int __i5, int __i6, int __i7)
+{
+  return (__m256i)(__v8si){ __i0, __i1, __i2, __i3, __i4, __i5, __i6, __i7 };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_setr_epi16(short __w15, short __w14, short __w13, short __w12,
+		   short __w11, short __w10, short __w09, short __w08,
+		   short __w07, short __w06, short __w05, short __w04,
+		   short __w03, short __w02, short __w01, short __w00)
+{
+  return (__m256i)(__v16hi){ __w15, __w14, __w13, __w12, __w11, __w10, __w09,
+    __w08, __w07, __w06, __w05, __w04, __w03, __w02, __w01, __w00 };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_setr_epi8(char __b31, char __b30, char __b29, char __b28,
+		             char __b27, char __b26, char __b25, char __b24,
+		             char __b23, char __b22, char __b21, char __b20,
+		             char __b19, char __b18, char __b17, char __b16,
+		             char __b15, char __b14, char __b13, char __b12,
+		             char __b11, char __b10, char __b09, char __b08,
+		             char __b07, char __b06, char __b05, char __b04,
+		             char __b03, char __b02, char __b01, char __b00)
+{
+  return (__m256i)(__v32qi){
+    __b31, __b30, __b29, __b28, __b27, __b26, __b25, __b24,
+		__b23, __b22, __b21, __b20, __b19, __b18, __b17, __b16,
+		__b15, __b14, __b13, __b12, __b11, __b10, __b09, __b08,
+		__b07, __b06, __b05, __b04, __b03, __b02, __b01, __b00 };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_setr_epi64x(long long __a, long long __b, long long __c, long long __d)
+{
+  return (__m256i)(__v4di){ __a, __b, __c, __d };
+}
+
+/* Create vectors with repeated elements */
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_set1_pd(double __w)
+{
+  return (__m256d){ __w, __w, __w, __w };
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_set1_ps(float __w)
+{
+  return (__m256){ __w, __w, __w, __w, __w, __w, __w, __w };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_set1_epi32(int __i)
+{
+  return (__m256i)(__v8si){ __i, __i, __i, __i, __i, __i, __i, __i };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_set1_epi16(short __w)
+{
+  return (__m256i)(__v16hi){ __w, __w, __w, __w, __w, __w, __w, __w, __w, __w,
+    __w, __w, __w, __w, __w, __w };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_set1_epi8(char __b)
+{
+  return (__m256i)(__v32qi){ __b, __b, __b, __b, __b, __b, __b, __b, __b, __b,
+    __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b,
+    __b, __b, __b, __b, __b, __b, __b };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_set1_epi64x(long long __q)
+{
+  return (__m256i)(__v4di){ __q, __q, __q, __q };
+}
+
+/* Create __zeroed vectors */
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_setzero_pd(void)
+{
+  return (__m256d){ 0, 0, 0, 0 };
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_setzero_ps(void)
+{
+  return (__m256){ 0, 0, 0, 0, 0, 0, 0, 0 };
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_setzero_si256(void)
+{
+  return (__m256i){ 0LL, 0LL, 0LL, 0LL };
+}
+
+/* Cast between vector types */
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_castpd_ps(__m256d __a)
+{
+  return (__m256)__a;
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_castpd_si256(__m256d __a)
+{
+  return (__m256i)__a;
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_castps_pd(__m256 __a)
+{
+  return (__m256d)__a;
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_castps_si256(__m256 __a)
+{
+  return (__m256i)__a;
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_castsi256_ps(__m256i __a)
+{
+  return (__m256)__a;
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_castsi256_pd(__m256i __a)
+{
+  return (__m256d)__a;
+}
+
+static __inline __m128d __attribute__((__always_inline__, __nodebug__))
+_mm256_castpd256_pd128(__m256d __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 1);
+}
+
+static __inline __m128 __attribute__((__always_inline__, __nodebug__))
+_mm256_castps256_ps128(__m256 __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 1, 2, 3);
+}
+
+static __inline __m128i __attribute__((__always_inline__, __nodebug__))
+_mm256_castsi256_si128(__m256i __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 1);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_castpd128_pd256(__m128d __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 1, -1, -1);
+}
+
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_castps128_ps256(__m128 __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 1, 2, 3, -1, -1, -1, -1);
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_castsi128_si256(__m128i __a)
+{
+  return __builtin_shufflevector(__a, __a, 0, 1, -1, -1);
+}
+
+/* SIMD load ops (unaligned) */
+static __inline __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_loadu2_m128(float const *__addr_hi, float const *__addr_lo)
+{
+  struct __loadu_ps {
+    __m128 __v;
+  } __attribute__((__packed__, __may_alias__));
+
+  __m256 __v256 = _mm256_castps128_ps256(((struct __loadu_ps*)__addr_lo)->__v);
+  return _mm256_insertf128_ps(__v256, ((struct __loadu_ps*)__addr_hi)->__v, 1);
+}
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_loadu2_m128d(double const *__addr_hi, double const *__addr_lo)
+{
+  struct __loadu_pd {
+    __m128d __v;
+  } __attribute__((__packed__, __may_alias__));
+  
+  __m256d __v256 = _mm256_castpd128_pd256(((struct __loadu_pd*)__addr_lo)->__v);
+  return _mm256_insertf128_pd(__v256, ((struct __loadu_pd*)__addr_hi)->__v, 1);
+}
+
+static __inline __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_loadu2_m128i(__m128i const *__addr_hi, __m128i const *__addr_lo)
+{
+  struct __loadu_si128 {
+    __m128i __v;
+  } __attribute__((packed, may_alias));
+  __m256i __v256 = _mm256_castsi128_si256(
+    ((struct __loadu_si128*)__addr_lo)->__v);
+  return _mm256_insertf128_si256(__v256,
+                                 ((struct __loadu_si128*)__addr_hi)->__v, 1);
+}
+
+/* SIMD store ops (unaligned) */
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_storeu2_m128(float *__addr_hi, float *__addr_lo, __m256 __a)
+{
+  __m128 __v128;
+
+  __v128 = _mm256_castps256_ps128(__a);
+  __builtin_ia32_storeups(__addr_lo, __v128);
+  __v128 = _mm256_extractf128_ps(__a, 1);
+  __builtin_ia32_storeups(__addr_hi, __v128);
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_storeu2_m128d(double *__addr_hi, double *__addr_lo, __m256d __a)
+{
+  __m128d __v128;
+
+  __v128 = _mm256_castpd256_pd128(__a);
+  __builtin_ia32_storeupd(__addr_lo, __v128);
+  __v128 = _mm256_extractf128_pd(__a, 1);
+  __builtin_ia32_storeupd(__addr_hi, __v128);
+}
+
+static __inline void __attribute__((__always_inline__, __nodebug__))
+_mm256_storeu2_m128i(__m128i *__addr_hi, __m128i *__addr_lo, __m256i __a)
+{
+  __m128i __v128;
+
+  __v128 = _mm256_castsi256_si128(__a);
+  __builtin_ia32_storedqu((char *)__addr_lo, (__v16qi)__v128);
+  __v128 = _mm256_extractf128_si256(__a, 1);
+  __builtin_ia32_storedqu((char *)__addr_hi, (__v16qi)__v128);
+}
+
+#endif /* __AVXINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/avxintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/pgtab.h
===================================================================
--- lab4/.minix-src/include/ddekit/pgtab.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/pgtab.h	(revision 13)
@@ -0,0 +1,90 @@
+/*
+ * \brief   Virtual page-table facility
+ * \author  Thomas Friebel <tf13@os.inf.tu-dresden.de>
+ * \author  Christian Helmuth <ch12@os.inf.tu-dresden.de>
+ * \date    2006-11-03
+ */
+
+#ifndef _DDEKIT_PGTAB_H
+#define _DDEKIT_PGTAB_H
+
+#include <ddekit/ddekit.h>
+
+#include <ddekit/types.h>
+
+/* FIXME Region types may be defined by pgtab users. Do we really need them
+ * here? */
+enum ddekit_pgtab_type
+{
+	PTE_TYPE_OTHER, PTE_TYPE_LARGE, PTE_TYPE_UMA, PTE_TYPE_CONTIG
+};
+
+
+/**
+ * Set virtual->physical mapping for VM region
+ *
+ * \param virt      virtual start address for region
+ * \param phys      physical start address for region
+ * \param pages     number of pages in region
+ * \param type      pgtab type for region
+ */
+void ddekit_pgtab_set_region(void *virt, ddekit_addr_t phys, int pages,
+	int type);
+
+
+/**
+ * Set virtual->physical mapping for VM region given a specific size in bytes.
+ *
+ * Internally, DDEKit manages regions with pages. However, DDEs do not need to tangle
+ * with the underlying mechanism and therefore can use this function that takes care
+ * of translating a size to an amount of pages.
+ */
+void ddekit_pgtab_set_region_with_size(void *virt, ddekit_addr_t phys,
+	int size, int type);
+
+
+/**
+ * Clear virtual->physical mapping for VM region
+ *
+ * \param virt      virtual start address for region
+ * \param type      pgtab type for region
+ */
+void ddekit_pgtab_clear_region(void *virt, int type);
+
+/**
+ * Get physical address for virtual address
+ *
+ * \param virt     virtual address
+ *
+ * \return physical address
+ */
+ddekit_addr_t ddekit_pgtab_get_physaddr(const void *virt);
+
+/**
+ * Get virtual address for physical address
+ *
+ * \param physical  physical address
+ *
+ * \return virtual address
+ */
+ddekit_addr_t ddekit_pgtab_get_virtaddr(const ddekit_addr_t physical);
+
+/**
+ * Get type of VM region.
+ *
+ * \param virt      virtual address
+
+ * \return VM region type
+ */
+int ddekit_pgtab_get_type(const void *virt);
+
+/**
+ * Get size of VM region.
+ *
+ * \param virt      virtual address
+ *
+ * \return VM region size (in bytes)
+ */
+int ddekit_pgtab_get_size(const void *virt);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/pgtab.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/usb.h
===================================================================
--- lab4/.minix-src/include/ddekit/usb.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/usb.h	(revision 13)
@@ -0,0 +1,106 @@
+#ifndef _DDEKIT_USB_H
+#define _DDEKIT_USB_H
+
+#include <ddekit/ddekit.h>
+#include <ddekit/types.h>
+
+/** isochronous transfer */
+#define  DDEKIT_USB_TRANSFER_ISO 0
+/** interrupt transfer */
+#define  DDEKIT_USB_TRANSFER_INT 1
+ /** control transfer */
+#define  DDEKIT_USB_TRANSFER_CTL 2
+/** bulk transfer */
+#define  DDEKIT_USB_TRANSFER_BLK 3
+
+#define DDEKIT_USB_IN  1
+#define DDEKIT_USB_OUT 0
+
+struct ddekit_usb_dev;
+struct ddekit_usb_urb;
+
+struct ddekit_usb_device_id {
+	ddekit_uint16_t idVendor;
+	ddekit_uint16_t idProduct;
+	ddekit_uint32_t bcdDevice;
+
+	ddekit_uint8_t  bDeviceClass;
+	ddekit_uint8_t  bDeviceSubClass;
+	ddekit_uint8_t  bDeviceProtocol;
+
+	ddekit_uint8_t  bInterfaceClass;
+	ddekit_uint8_t  bInterfaceSubClass;
+	ddekit_uint8_t  bInterfaceProtocol;
+
+};
+
+struct ddekit_usb_iso_packet_desc {
+	ddekit_int32_t offset;
+	ddekit_int32_t length;		/* expected length */
+	ddekit_int32_t actual_length;
+	ddekit_int32_t status;
+};
+
+typedef void (*ddekit_usb_completion_cb)(void* priv);
+
+typedef void (*ddekit_usb_connect_cb)(struct ddekit_usb_dev *dev, 
+                                      unsigned int interfaces);
+
+typedef void (*ddekit_usb_disconnect_cb)(struct ddekit_usb_dev *dev);
+
+typedef void *(*ddekit_usb_malloc_fn)(unsigned size);
+typedef void (*ddekit_usb_free_fn)(void *ptr);
+
+struct ddekit_usb_driver {
+	ddekit_usb_completion_cb completion;
+	ddekit_usb_connect_cb    connect;
+	ddekit_usb_disconnect_cb    disconnect;
+};
+
+
+struct ddekit_usb_urb {
+	struct ddekit_usb_dev *dev;
+	ddekit_int32_t type;
+	ddekit_int32_t endpoint;
+	ddekit_int32_t direction;
+	ddekit_int32_t status;
+	ddekit_int32_t interval;
+	ddekit_uint32_t transfer_flags;
+	ddekit_uint32_t size;
+	ddekit_uint32_t actual_length;
+	ddekit_int32_t number_of_packets;
+	ddekit_int32_t error_count;
+	ddekit_int32_t start_frame;
+	char *setup_packet;
+	char *data;
+	struct ddekit_usb_iso_packet_desc *iso_desc;
+	void *priv;
+	void *ddekit_priv;
+};
+
+/* USB message types */
+typedef enum {
+
+	DDEKIT_HUB_PORT_LS_CONN,	/* Low speed device connected */
+	DDEKIT_HUB_PORT_FS_CONN,	/* Full speed device connected */
+	DDEKIT_HUB_PORT_HS_CONN,	/* High speed device connected */
+	DDEKIT_HUB_PORT_DISCONN		/* Device disconnected */
+}
+ddekit_msg_type_t;
+
+int ddekit_usb_dev_set_data(struct ddekit_usb_dev *dev, void *data);
+void *ddekit_usb_dev_get_data(struct ddekit_usb_dev *dev);
+void ddekit_usb_get_device_id(struct ddekit_usb_dev *dev, struct
+	ddekit_usb_device_id *id);
+int ddekit_usb_submit_urb(struct ddekit_usb_urb *d_urb);
+int ddekit_usb_cancle_urb(struct ddekit_usb_urb *d_urb);
+long ddekit_usb_info(struct ddekit_usb_dev *, long, long);
+
+/*
+ * This one is only implemented for the client side. For the server side is
+ * has to be implemented in the DDELinux/FBSD part.
+ */
+int ddekit_usb_init(struct ddekit_usb_driver *drv, ddekit_usb_malloc_fn
+	*_m, ddekit_usb_free_fn *_f);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/usb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/types.h
===================================================================
--- lab4/.minix-src/include/ddekit/types.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/types.h	(revision 13)
@@ -0,0 +1,22 @@
+/*
+ * \brief   Types for ddekit (x86 version)
+ * \author  Thomas Friebel <tf13@os.inf.tu-dresden.de>
+ * \author  Christian Helmuth <ch12@os.inf.tu-dresden.de>
+ * \date    2006-11-09
+ *
+ * FIXME This is definitely arch-dependent! Move to ARCH-something
+ */
+
+#ifndef _DDEKIT_TYPES_H
+#define _DDEKIT_TYPES_H
+
+typedef signed char        ddekit_int8_t;
+typedef unsigned char      ddekit_uint8_t;
+typedef signed short int   ddekit_int16_t;
+typedef unsigned short int ddekit_uint16_t;
+typedef signed int         ddekit_int32_t;
+typedef unsigned int       ddekit_uint32_t;
+
+typedef unsigned long      ddekit_addr_t;
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/types.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/thread.h
===================================================================
--- lab4/.minix-src/include/ddekit/thread.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/thread.h	(revision 13)
@@ -0,0 +1,163 @@
+#ifndef _DDEKIT_THREAD_H
+#define _DDEKIT_THREAD_H
+
+/** \defgroup DDEKit_threads */
+#include <ddekit/ddekit.h>
+#include <ddekit/lock.h>
+
+struct ddekit_thread;
+typedef struct ddekit_thread ddekit_thread_t;
+
+/** Create thread
+ *
+ * \ingroup DDEKit_threads
+ *
+ * Create a new thread running the specified thread function with the specified 
+ * arguments. The thread is assigned the given internal name. 
+ *
+ * Additionally, DDEKit threads possess a thread-local storage area where they
+ * may store arbitrary data.
+ *
+ * \param fun     thread function
+ * \param arg     optional argument to thread function, set to NULL if not needed
+ * \param name    internal thread name
+ */
+ddekit_thread_t *ddekit_thread_create(void (*fun)(void *), void *arg,
+	const char *name);
+
+/** Reference to own DDEKit thread id. 
+ *
+ * \ingroup DDEKit_threads
+ */
+ddekit_thread_t *ddekit_thread_myself(void);
+
+/** Initialize thread with given name. 
+ *
+ * \ingroup DDEKit_threads
+ *
+ * This function may be used by threads that were not created using
+ * \ref ddekit_thread_create. This enables such threads to be handled as if they
+ * were DDEKit threads.
+ */
+ddekit_thread_t *ddekit_thread_setup_myself(const char *name);
+
+/** Get TLS data for a specific thread.
+ *
+ * \ingroup DDEKit_threads
+ *
+ * \return Pointer to TLS data of this thread.
+ */
+void *ddekit_thread_get_data(ddekit_thread_t *thread);
+
+/** Get TLS data for current thread.
+ *
+ * \ingroup DDEKit_threads
+ *
+ * Same as calling \ref ddekit_thread_get_data with \ref ddekit_thread_myself
+ * as parameter.
+ *
+ * \return Pointer to TLS data of current thread.
+ */
+void *ddekit_thread_get_my_data(void);
+
+/** Set TLS data for specific thread.
+ *
+ * \ingroup DDEKit_threads
+ *
+ * \param thread     DDEKit thread
+ * \param data       pointer to thread data
+ */
+void ddekit_thread_set_data(ddekit_thread_t *thread, void *data);
+
+/** Set TLS data for current thread.
+ *
+ * \ingroup DDEKit_threads
+ *
+ * \param data       pointer to thread data
+ */
+void ddekit_thread_set_my_data(void *data);
+
+/** Sleep for some miliseconds.
+ *
+ * \ingroup DDEKit_threads
+ *
+ * \param msecs      time to sleep in ms.
+ */
+void ddekit_thread_msleep(unsigned long msecs);
+
+/** Sleep for some microseconds.
+ *
+ * \ingroup DDEKit_threads
+ *
+ * \param usecs      time to sleep in µs.
+ */
+void ddekit_thread_usleep(unsigned long usecs);
+
+/** Sleep for some nanoseconds.
+ *
+ * \ingroup DDEKit_threads
+ *
+ * \param usecs      time to sleep in ns.
+ */
+void ddekit_thread_nsleep(unsigned long nsecs);
+
+/** Sleep until a lock becomes unlocked.
+ *
+ * \ingroup DDEKit_threads
+ */
+void ddekit_thread_sleep(ddekit_lock_t *lock);
+
+/** Wakeup a waiting thread. 
+ *
+ * \ingroup DDEKit_threads
+ */
+void ddekit_thread_wakeup(ddekit_thread_t *thread);
+
+/** Terminate a thread 
+ *
+ * \ingroup DDEKit_threads
+ */
+void ddekit_thread_exit(void) __attribute__((noreturn));
+
+/** Terminate a thread 
+ *
+ * \ingroup DDEKit_threads
+ */
+void ddekit_thread_terminate(ddekit_thread_t *thread);
+
+/** Get the name, a thread registered with DDEKit. 
+ *
+ * \ingroup DDEKit_threads
+ */
+const char *ddekit_thread_get_name(ddekit_thread_t *thread);
+
+/** Get unique ID of a DDEKit thread.
+ *
+ * \ingroup DDEKit_threads
+ *
+ *  DDEKit does not allow direct access to the thread data
+ *  structure, since this struct contains L4-specific data types.
+ *  However, applications might want to get some kind of ID related
+ *  to a ddekit_thread, for instance to use it as a Linux-like PID.
+ */
+int ddekit_thread_get_id(ddekit_thread_t *thread);
+
+/** Hint that this thread is done and may be scheduled somehow. 
+ *
+ * \ingroup DDEKit_threads
+ */
+void ddekit_thread_schedule(void);
+
+/** Hint that this thread is done and may be scheduled somehow. 
+ *
+ * \ingroup DDEKit_threads
+ */
+void ddekit_yield(void);
+
+/** Initialize DDEKit thread subsystem. 
+ *
+ * \ingroup DDEKit_threads
+ */
+void ddekit_init_threads(void);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/thread.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/amrreg.h
===================================================================
--- lab4/.minix-src/include/dev/pci/amrreg.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/amrreg.h	(revision 13)
@@ -0,0 +1,433 @@
+/*	$NetBSD: amrreg.h,v 1.5 2008/09/08 23:36:54 gmcgarry Exp $	*/
+
+/*-
+ * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1999,2000 Michael Smith
+ * Copyright (c) 2000 BSDi
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from FreeBSD: amrreg.h,v 1.2 2000/08/30 07:52:40 msmith Exp
+ */
+
+#ifndef	_PCI_AMRREG_H_
+#define	_PCI_AMRREG_H_
+
+#ifdef AMR_CRASH_ME
+#define	AMR_MAX_CMDS		255		/* ident = 0 not allowed */
+#else
+#define	AMR_MAX_CMDS		120
+#endif
+#define	AMR_MAXLD      		40
+
+#define	AMR_MAX_CMDS_PU		63
+
+#define	AMR_MAX_SEGS		26
+#define	AMR_MAX_CHANNEL		3
+#define	AMR_MAX_TARGET		15
+#define	AMR_MAX_LUN		7
+
+#define	AMR_MAX_CDB_LEN		0x0a
+#define	AMR_MAX_REQ_SENSE_LEN	0x20
+
+#define	AMR_SECTOR_SIZE		512
+
+/* Mailbox commands.*/
+#define	AMR_CMD_LREAD		0x01
+#define	AMR_CMD_LWRITE		0x02
+#define	AMR_CMD_PASS		0x03
+#define	AMR_CMD_EXT_ENQUIRY	0x04
+#define	AMR_CMD_ENQUIRY		0x05
+#define	AMR_CMD_FLUSH		0x0a
+#define	AMR_CMD_EXT_ENQUIRY2	0x0c
+#define	AMR_CMD_GET_MACHINEID	0x36
+#define	AMR_CMD_GET_INITIATOR	0x7d	/* returns one byte */
+#define	AMR_CMD_CONFIG		0xa1
+#define	AMR_CONFIG_PRODUCT_INFO			0x0e
+#define	AMR_CONFIG_ENQ3				0x0f
+#define	AMR_CONFIG_ENQ3_SOLICITED_NOTIFY	0x01
+#define	AMR_CONFIG_ENQ3_SOLICITED_FULL		0x02
+#define	AMR_CONFIG_ENQ3_UNSOLICITED		0x03
+
+/* Command completion status. */
+#define	AMR_STATUS_SUCCESS	0x00
+#define	AMR_STATUS_ABORTED	0x02
+#define	AMR_STATUS_FAILED	0x80
+
+/* Physical/logical drive states. */
+#define	AMR_DRV_CURSTATE(x)	((x) & 0x0f)
+#define	AMR_DRV_PREVSTATE(x)	(((x) >> 4) & 0x0f)
+#define	AMR_DRV_OFFLINE		0x00
+#define	AMR_DRV_DEGRADED	0x01
+#define	AMR_DRV_OPTIMAL		0x02
+#define	AMR_DRV_ONLINE		0x03
+#define	AMR_DRV_FAILED		0x04
+#define	AMR_DRV_REBUILD		0x05
+#define	AMR_DRV_HOTSPARE	0x06
+
+/* Logical drive properties. */
+#define	AMR_DRV_RAID_MASK	0x0f	/* RAID level 0, 1, 3, 5, etc. */
+#define	AMR_DRV_WRITEBACK	0x10	/* write-back enabled */
+#define	AMR_DRV_READHEAD	0x20	/* readhead policy enabled */
+#define	AMR_DRV_ADAPTIVE	0x40	/* adaptive I/O policy enabled */
+
+/* Battery status. */
+#define	AMR_BATT_MODULE_MISSING		0x01
+#define	AMR_BATT_LOW_VOLTAGE		0x02
+#define	AMR_BATT_TEMP_HIGH		0x04
+#define	AMR_BATT_PACK_MISSING		0x08
+#define	AMR_BATT_CHARGE_MASK		0x30
+#define	AMR_BATT_CHARGE_DONE		0x00
+#define	AMR_BATT_CHARGE_INPROG		0x10
+#define	AMR_BATT_CHARGE_FAIL		0x20
+#define	AMR_BATT_CYCLES_EXCEEDED	0x40
+
+/*
+ * 8LD firmware interface.
+ */
+
+/* Array constraints. */
+#define	AMR_8LD_MAXDRIVES	8
+#define	AMR_8LD_MAXCHAN		5
+#define	AMR_8LD_MAXTARG		15
+#define	AMR_8LD_MAXPHYSDRIVES	(AMR_8LD_MAXCHAN * AMR_8LD_MAXTARG)
+
+/* Adapter information. */
+struct amr_adapter_info {
+	u_int8_t	aa_maxio;
+	u_int8_t	aa_rebuild_rate;
+	u_int8_t	aa_maxtargchan;
+	u_int8_t	aa_channels;
+	u_int8_t	aa_firmware[4];
+	u_int16_t	aa_flashage;
+	u_int8_t	aa_chipsetvalue;
+	u_int8_t	aa_memorysize;
+	u_int8_t	aa_cacheflush;
+	u_int8_t	aa_bios[4];
+	u_int8_t	aa_boardtype;
+	u_int8_t	aa_scsisensealert;
+	u_int8_t	aa_writeconfigcount;
+	u_int8_t	aa_driveinsertioncount;
+	u_int8_t	aa_inserteddrive;
+	u_int8_t	aa_batterystatus;
+	u_int8_t   	aa_res1;
+} __packed;
+
+/* Logical drive information. */
+struct amr_logdrive_info {
+	u_int8_t	al_numdrives;
+	u_int8_t	al_res1[3];
+	u_int32_t	al_size[AMR_8LD_MAXDRIVES];
+	u_int8_t	al_properties[AMR_8LD_MAXDRIVES];
+	u_int8_t	al_state[AMR_8LD_MAXDRIVES];
+} __packed;
+
+/* Physical drive information. */
+struct amr_physdrive_info {
+	/* Low nybble is current state, high nybble is previous state. */
+	u_int8_t	ap_state[AMR_8LD_MAXPHYSDRIVES];
+	u_int8_t	ap_predictivefailure;
+} __packed;
+
+/*
+ * Enquiry response structure for AMR_CMD_ENQUIRY (e), AMR_CMD_EXT_ENQUIRY (x)
+ * and AMR_CMD_EXT_ENQUIRY2 (2).
+ */
+struct amr_enquiry {
+	struct		amr_adapter_info ae_adapter;		/* e x 2 */
+	struct		amr_logdrive_info ae_ldrv;		/* e x 2 */
+	struct		amr_physdrive_info ae_pdrv;		/* e x 2 */
+	u_int8_t	ae_formatting[AMR_8LD_MAXDRIVES];	/*   x 2 */
+	u_int8_t	res1[AMR_8LD_MAXDRIVES];		/*   x 2 */
+	u_int32_t	ae_extlen;				/*     2 */
+	u_int16_t	ae_subsystem;				/*     2 */
+	u_int16_t	ae_subvendor;				/*     2 */
+	u_int32_t	ae_signature;				/*     2 */
+#define	AMR_SIG_431	0xfffe0001
+#define	AMR_SIG_438	0xfffd0002
+#define	AMR_SIG_762	0xfffc0003
+#define	AMR_SIG_T5	0xfffb0004
+#define	AMR_SIG_466	0xfffa0005
+#define	AMR_SIG_467	0xfff90006
+#define	AMR_SIG_T7	0xfff80007
+#define	AMR_SIG_490	0xfff70008
+	u_int8_t	res2[844];				/*     2 */
+} __packed;
+
+/*
+ * 40LD firmware interface.
+ */
+
+/* Array constraints. */
+#define	AMR_40LD_MAXDRIVES	40
+#define	AMR_40LD_MAXCHAN	16
+#define	AMR_40LD_MAXTARG	16
+#define	AMR_40LD_MAXPHYSDRIVES	256
+
+/* Product information structure. */
+struct amr_prodinfo {
+	u_int32_t	ap_size;		/* current size in bytes (not including resvd) */
+	u_int32_t	ap_configsig;		/* default is 0x00282008, indicating 0x28 maximum
+					 * logical drives, 0x20 maximum stripes and 0x08
+					 * maximum spans */
+	u_int8_t	ap_firmware[16];	/* printable identifiers */
+	u_int8_t	ap_bios[16];
+	u_int8_t	ap_product[80];
+	u_int8_t	ap_maxio;		/* maximum number of concurrent commands supported */
+	u_int8_t	ap_nschan;		/* number of SCSI channels present */
+	u_int8_t	ap_fcloops;		/* number of fibre loops present */
+	u_int8_t	ap_memtype;		/* memory type */
+	u_int32_t	ap_signature;
+	u_int16_t	ap_memsize;		/* onboard memory in MB */
+	u_int16_t	ap_subsystem;		/* subsystem identifier */
+	u_int16_t	ap_subvendor;		/* subsystem vendor ID */
+	u_int8_t	ap_numnotifyctr;	/* number of notify counters */
+} __packed;
+
+/* Notify structure. */
+struct amr_notify {
+	u_int32_t	an_globalcounter;	/* change counter */
+
+	u_int8_t	an_paramcounter;	/* parameter change counter */
+	u_int8_t	an_paramid;
+#define	AMR_PARAM_REBUILD_RATE		0x01	/* value = new rebuild rate */
+#define	AMR_PARAM_FLUSH_INTERVAL	0x02	/* value = new flush interval */
+#define	AMR_PARAM_SENSE_ALERT		0x03	/* value = last physical drive with check condition set */
+#define	AMR_PARAM_DRIVE_INSERTED	0x04	/* value = last physical drive inserted */
+#define	AMR_PARAM_BATTERY_STATUS	0x05	/* value = battery status */
+	u_int16_t	an_paramval;
+
+	u_int8_t	an_writeconfigcounter;	/* write config occurred */
+	u_int8_t	res1[3];
+
+	u_int8_t	an_ldrvopcounter;	/* logical drive operation started/completed */
+	u_int8_t	an_ldrvopid;
+	u_int8_t	an_ldrvopcmd;
+#define	AMR_LDRVOP_CHECK	0x01
+#define	AMR_LDRVOP_INIT		0x02
+#define	AMR_LDRVOP_REBUILD	0x03
+	u_int8_t	an_ldrvopstatus;
+#define	AMR_LDRVOP_SUCCESS	0x00
+#define	AMR_LDRVOP_FAILED	0x01
+#define	AMR_LDRVOP_ABORTED	0x02
+#define	AMR_LDRVOP_CORRECTED	0x03
+#define	AMR_LDRVOP_STARTED	0x04
+
+	u_int8_t	an_ldrvstatecounter;	/* logical drive state change occurred */
+	u_int8_t	an_ldrvstateid;
+	u_int8_t	an_ldrvstatenew;
+	u_int8_t	an_ldrvstateold;
+
+	u_int8_t	an_pdrvstatecounter;	/* physical drive state change occurred */
+	u_int8_t	an_pdrvstateid;
+	u_int8_t	an_pdrvstatenew;
+	u_int8_t	an_pdrvstateold;
+
+	u_int8_t	an_pdrvfmtcounter;
+	u_int8_t	an_pdrvfmtid;
+	u_int8_t	an_pdrvfmtval;
+#define	AMR_FORMAT_START	0x01
+#define	AMR_FORMAT_COMPLETE	0x02
+	u_int8_t	res2;
+
+	u_int8_t	an_targxfercounter;	/* scsi xfer rate change */
+	u_int8_t	an_targxferid;
+	u_int8_t	an_targxferval;
+	u_int8_t	res3;
+
+	u_int8_t	an_fcloopidcounter;	/* FC/AL loop ID changed */
+	u_int8_t	an_fcloopidpdrvid;
+	u_int8_t	an_fcloopid0;
+	u_int8_t	an_fcloopid1;
+
+	u_int8_t	an_fcloopstatecounter;	/* FC/AL loop status changed */
+	u_int8_t	an_fcloopstate0;
+	u_int8_t	an_fcloopstate1;
+	u_int8_t	res4;
+} __packed;
+
+/* Enquiry3 structure. */
+struct amr_enquiry3 {
+	u_int32_t	ae_datasize;		/* valid data size in this structure */
+	union {				/* event notify structure */
+	struct amr_notify	n;
+	u_int8_t		pad[0x80];
+	} 		ae_notify;
+	u_int8_t	ae_rebuildrate;		/* current rebuild rate in % */
+	u_int8_t	ae_cacheflush;		/* flush interval in seconds */
+	u_int8_t	ae_sensealert;
+	u_int8_t	ae_driveinsertcount;	/* count of inserted drives */
+	u_int8_t	ae_batterystatus;
+	u_int8_t	ae_numldrives;
+	u_int8_t	ae_reconstate[AMR_40LD_MAXDRIVES / 8];	/* reconstruction state */
+	u_int16_t	ae_opstatus[AMR_40LD_MAXDRIVES / 8];	/* operation status per drive */
+	u_int32_t	ae_drivesize[AMR_40LD_MAXDRIVES];	/* logical drive size */
+	u_int8_t	ae_driveprop[AMR_40LD_MAXDRIVES];	/* logical drive properties */
+	u_int8_t	ae_drivestate[AMR_40LD_MAXDRIVES];	/* physical drive state */
+	u_int8_t	ae_pdrivestate[AMR_40LD_MAXPHYSDRIVES]; /* physical drive state */
+	u_int16_t	ae_driveformat[AMR_40LD_MAXPHYSDRIVES];
+	u_int8_t	ae_targxfer[80];			/* physical drive transfer rates */
+
+	u_int8_t	res1[263];		/* pad to 1024 bytes */
+} __packed;
+
+/*
+ * Mailbox and command structures.
+ */
+
+struct amr_mailbox_cmd {
+	u_int8_t	mb_command;
+	u_int8_t	mb_ident;
+	u_int16_t	mb_blkcount;
+	u_int32_t	mb_lba;
+	u_int32_t	mb_physaddr;
+	u_int8_t	mb_drive;
+	u_int8_t	mb_nsgelem;
+	u_int8_t	res1;
+	u_int8_t	mb_busy;
+} __packed;
+
+struct amr_mailbox_resp {
+	u_int8_t	mb_nstatus;
+	u_int8_t	mb_status;
+	u_int8_t	mb_completed[46];
+}  __packed;
+
+struct amr_mailbox {
+	u_int32_t	mb_res1[3];
+	u_int32_t	mb_segment;
+	struct		amr_mailbox_cmd mb_cmd;
+	struct		amr_mailbox_resp mb_resp;
+	u_int8_t	mb_poll;
+	u_int8_t	mb_ack;
+	u_int8_t	res2[62];		/* Pad to 128+16 bytes. */
+} __packed;
+
+struct amr_mailbox_ioctl {
+	u_int8_t	mb_command;
+	u_int8_t	mb_ident;
+	u_int8_t	mb_channel;
+	u_int8_t	mb_param;
+	u_int8_t	mb_pad[4];
+	u_int32_t	mb_physaddr;
+	u_int8_t	mb_drive;
+	u_int8_t	mb_nsgelem;
+	u_int8_t	res1;
+	u_int8_t	mb_busy;
+	u_int8_t	mb_nstatus;
+	u_int8_t	mb_completed[46];
+	u_int8_t	mb_poll;
+	u_int8_t	mb_ack;
+	u_int8_t	res4[16];
+} __packed;
+
+struct amr_sgentry {
+	u_int32_t	sge_addr;
+	u_int32_t	sge_count;
+} __packed;
+
+struct amr_passthrough {
+	u_int8_t	ap_timeout:3;
+	u_int8_t	ap_ars:1;
+	u_int8_t	ap_dummy:3;
+	u_int8_t	ap_islogical:1;
+	u_int8_t	ap_logical_drive_no;
+	u_int8_t	ap_channel;
+	u_int8_t	ap_scsi_id;
+	u_int8_t	ap_queue_tag;
+	u_int8_t	ap_queue_action;
+	u_int8_t	ap_cdb[AMR_MAX_CDB_LEN];
+	u_int8_t	ap_cdb_length;
+	u_int8_t	ap_request_sense_length;
+	u_int8_t	ap_request_sense_area[AMR_MAX_REQ_SENSE_LEN];
+	u_int8_t	ap_no_sg_elements;
+	u_int8_t	ap_scsi_status;
+	u_int32_t	ap_data_transfer_address;
+	u_int32_t	ap_data_transfer_length;
+} __packed;
+
+/*
+ * "Quartz" i960 PCI bridge interface.
+ */
+
+#define	AMR_QUARTZ_SIG_REG	0xa0
+#define	AMR_QUARTZ_SIG0		0xcccc
+#define	AMR_QUARTZ_SIG1		0x3344
+
+/* Doorbell registers. */
+#define	AMR_QREG_IDB		0x20
+#define	AMR_QREG_ODB		0x2c
+
+#define	AMR_QIDB_SUBMIT		0x00000001	/* mailbox ready for work */
+#define	AMR_QIDB_ACK		0x00000002	/* mailbox done */
+#define	AMR_QODB_READY		0x10001234	/* work ready to be processed */
+
+/*
+ * Old-style ("standard") ASIC bridge interface.
+ */
+
+/* I/O registers. */
+#define	AMR_SREG_CMD		0x10	/* Command/ack register (w) */
+#define	AMR_SREG_MBOX_BUSY	0x10	/* Mailbox status (r) */
+#define	AMR_SREG_TOGL		0x11	/* Interrupt enable */
+#define	AMR_SREG_MBOX		0x14	/* Mailbox physical address */
+#define	AMR_SREG_MBOX_ENABLE	0x18	/* Atomic mailbox address enable */
+#define	AMR_SREG_INTR		0x1a	/* Interrupt status */
+
+/* I/O magic numbers. */
+#define	AMR_SCMD_POST		0x10	/* in SCMD to initiate action on mailbox */
+#define	AMR_SCMD_ACKINTR	0x08	/* in SCMD to ack mailbox retrieved */
+#define	AMR_STOGL_ENABLE	0xc0	/* in STOGL */
+#define	AMR_SINTR_VALID		0x40	/* in SINTR */
+#define	AMR_SMBOX_BUSY_FLAG	0x10	/* in SMBOX_BUSY */
+#define	AMR_SMBOX_ENABLE_ADDR	0x00	/* in SMBOX_ENABLE */
+
+#endif	/* !_PCI_AMRREG_H_ */

Property changes on: lab4/.minix-src/include/dev/pci/amrreg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/if_lmc.h
===================================================================
--- lab4/.minix-src/include/dev/pci/if_lmc.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/if_lmc.h	(revision 13)
@@ -0,0 +1,1393 @@
+/*-
+ * $NetBSD: if_lmc.h,v 1.22 2015/09/06 06:01:00 dholland Exp $
+ *
+ * Copyright (c) 2002-2006 David Boggs. (boggs@boggs.palo-alto.ca.us)
+ * All rights reserved.
+ *
+ * BSD LICENSE:
+ *
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * GNU GENERAL PUBLIC LICENSE:
+ *
+ * This program 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 of the License, or (at your option)
+ * any later version.
+ *
+ * This program 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
+ * this program; if not, write to the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#ifndef IF_LMC_H
+#define IF_LMC_H
+
+#include <sys/ioccom.h>
+
+
+#define DEVICE_NAME		"lmc"
+
+#define VER_YEAR		2006
+#define VER_MONTH		4
+#define VER_DAY			11
+
+/* netgraph stuff */
+#define NG_LMC_NODE_TYPE	"if_"DEVICE_NAME
+#define NGM_LMC_COOKIE		1144752198	/* date -u +'%s' */
+
+/* Tulip PCI configuration registers */
+#define TLP_CFID		0x00	/*  0: CFg ID register     */
+#define TLP_CFCS		0x04	/*  1: CFg Command/Status  */
+#define TLP_CFRV		0x08	/*  2: CFg ReVision        */
+#define TLP_CFLT		0x0C	/*  3: CFg Latency Timer   */
+#define TLP_CBIO		0x10	/*  4: Cfg Base IO address */
+#define TLP_CBMA		0x14	/*  5: Cfg Base Mem Addr   */
+#define TLP_CSID		0x2C	/* 11: Cfg Subsys ID reg   */
+#define TLP_CFIT		0x3C	/* 15: CFg InTerrupt       */
+#define TLP_CFDD		0x40	/* 16: CFg Driver Data     */
+
+#define TLP_CFID_TULIP		0x00091011	/* DEC 21140A Ethernet chip */
+
+#define TLP_CFCS_MSTR_ABORT	0x20000000
+#define TLP_CFCS_TARG_ABORT	0x10000000
+#define TLP_CFCS_SYS_ERROR	0x00000100
+#define TLP_CFCS_PAR_ERROR	0x00000040
+#define TLP_CFCS_MWI_ENABLE	0x00000010
+#define TLP_CFCS_BUS_MASTER	0x00000004
+#define TLP_CFCS_MEM_ENABLE	0x00000002
+#define TLP_CFCS_IO_ENABLE	0x00000001
+
+#define TLP_CFLT_LATENCY	0x0000FF00
+#define TLP_CFLT_CACHE		0x000000FF
+
+#define CSID_LMC_HSSI		0x00031376	/* LMC 5200 HSSI card */
+#define CSID_LMC_T3		0x00041376	/* LMC 5245 T3   card */
+#define CSID_LMC_SSI		0x00051376	/* LMC 1000 SSI  card */
+#define CSID_LMC_T1E1		0x00061376	/* LMC 1200 T1E1 card */
+#define CSID_LMC_HSSIc		0x00071376	/* LMC 5200 HSSI cPCI */
+#define CSID_LMC_SDSL		0x00081376	/* LMC 1168 SDSL card */
+
+#define TLP_CFIT_MAX_LAT	0xFF000000
+
+#define TLP_CFDD_SLEEP		0x80000000
+#define TLP_CFDD_SNOOZE		0x40000000
+
+/* Tulip Control and Status Registers */
+#define TLP_CSR_STRIDE		 8	/* 64 bits */
+#define TLP_BUS_MODE		 0 * TLP_CSR_STRIDE
+#define TLP_TX_POLL		 1 * TLP_CSR_STRIDE
+#define TLP_RX_POLL		 2 * TLP_CSR_STRIDE
+#define TLP_RX_LIST		 3 * TLP_CSR_STRIDE
+#define TLP_TX_LIST		 4 * TLP_CSR_STRIDE
+#define TLP_STATUS		 5 * TLP_CSR_STRIDE
+#define TLP_OP_MODE		 6 * TLP_CSR_STRIDE
+#define TLP_INT_ENBL		 7 * TLP_CSR_STRIDE
+#define TLP_MISSED		 8 * TLP_CSR_STRIDE
+#define TLP_SROM_MII		 9 * TLP_CSR_STRIDE
+#define TLP_BIOS_ROM		10 * TLP_CSR_STRIDE
+#define TLP_TIMER		11 * TLP_CSR_STRIDE
+#define TLP_GPIO		12 * TLP_CSR_STRIDE
+#define TLP_CSR13		13 * TLP_CSR_STRIDE
+#define TLP_CSR14		14 * TLP_CSR_STRIDE
+#define TLP_WDOG		15 * TLP_CSR_STRIDE
+#define TLP_CSR_SIZE		128	/* IO bus space size */
+
+/* CSR 0 - PCI Bus Mode Register */
+#define TLP_BUS_WRITE_INVAL	0x01000000	/* DONT USE! */
+#define TLP_BUS_READ_LINE	0x00800000
+#define TLP_BUS_READ_MULT	0x00200000
+#define TLP_BUS_DESC_BIGEND	0x00100000
+#define TLP_BUS_TAP		0x000E0000
+#define TLP_BUS_CAL		0x0000C000
+#define TLP_BUS_PBL		0x00003F00
+#define TLP_BUS_DATA_BIGEND	0x00000080
+#define TLP_BUS_DSL		0x0000007C
+#define TLP_BUS_ARB		0x00000002
+#define TLP_BUS_RESET		0x00000001
+#define TLP_BUS_CAL_SHIFT	14
+#define TLP_BUS_PBL_SHIFT	 8
+
+/* CSR 5 - Status Register */
+#define TLP_STAT_FATAL_BITS	0x03800000
+#define TLP_STAT_TX_FSM		0x00700000
+#define TLP_STAT_RX_FSM		0x000E0000
+#define TLP_STAT_FATAL_ERROR	0x00002000
+#define TLP_STAT_TX_UNDERRUN	0x00000020
+#define TLP_STAT_FATAL_SHIFT	23
+
+/* CSR 6 - Operating Mode Register */
+#define TLP_OP_RECEIVE_ALL	0x40000000
+#define TLP_OP_MUST_BE_ONE	0x02000000
+#define TLP_OP_NO_HEART_BEAT	0x00080000
+#define TLP_OP_PORT_SELECT	0x00040000
+#define TLP_OP_TX_THRESH	0x0000C000
+#define TLP_OP_TX_RUN		0x00002000
+#define TLP_OP_LOOP_MODE	0x00000C00
+#define TLP_OP_EXT_LOOP		0x00000800
+#define TLP_OP_INT_LOOP		0x00000400
+#define TLP_OP_FULL_DUPLEX	0x00000200
+#define TLP_OP_PROMISCUOUS	0x00000040
+#define TLP_OP_PASS_BAD_PKT	0x00000008
+#define TLP_OP_RX_RUN		0x00000002
+#define TLP_OP_TR_SHIFT		14
+#define TLP_OP_INIT		(TLP_OP_PORT_SELECT   | \
+				 TLP_OP_FULL_DUPLEX   | \
+				 TLP_OP_MUST_BE_ONE   | \
+				 TLP_OP_NO_HEART_BEAT | \
+				 TLP_OP_RECEIVE_ALL   | \
+				 TLP_OP_PROMISCUOUS   | \
+				 TLP_OP_PASS_BAD_PKT  | \
+				 TLP_OP_RX_RUN        | \
+				 TLP_OP_TX_RUN)
+
+/* CSR 7 - Interrupt Enable Register */
+#define TLP_INT_NORMAL_INTR	0x00010000
+#define TLP_INT_ABNRML_INTR	0x00008000
+#define TLP_INT_FATAL_ERROR	0x00002000
+#define TLP_INT_RX_NO_BUFS	0x00000080
+#define TLP_INT_RX_INTR		0x00000040
+#define TLP_INT_TX_UNDERRUN	0x00000020
+#define TLP_INT_TX_INTR		0x00000001
+#define TLP_INT_DISABLE		0
+#define TLP_INT_TX		(TLP_INT_NORMAL_INTR | \
+				 TLP_INT_ABNRML_INTR | \
+				 TLP_INT_FATAL_ERROR | \
+				 TLP_INT_TX_UNDERRUN | \
+				 TLP_INT_TX_INTR)
+#define TLP_INT_RX		(TLP_INT_NORMAL_INTR | \
+				 TLP_INT_ABNRML_INTR | \
+				 TLP_INT_FATAL_ERROR | \
+				 TLP_INT_RX_NO_BUFS  | \
+				 TLP_INT_RX_INTR)
+#define TLP_INT_TXRX		(TLP_INT_TX | TLP_INT_RX)
+
+/* CSR 8 - RX Missed Frames & Overrun Register */
+#define TLP_MISS_OCO		0x10000000
+#define TLP_MISS_OVERRUN	0x0FFE0000
+#define TLP_MISS_MFO		0x00010000
+#define TLP_MISS_MISSED		0x0000FFFF
+#define TLP_OVERRUN_SHIFT	17
+
+/* CSR 9 - SROM & MII & Boot ROM Register */
+#define TLP_MII_MDIN		0x00080000
+#define TLP_MII_MDOE		0x00040000
+#define TLP_MII_MDOUT		0x00020000
+#define TLP_MII_MDC		0x00010000
+
+#define TLP_BIOS_RD		0x00004000
+#define TLP_BIOS_WR		0x00002000
+#define TLP_BIOS_SEL		0x00001000
+
+#define TLP_SROM_RD		0x00004000
+#define TLP_SROM_SEL		0x00000800
+#define TLP_SROM_DOUT		0x00000008
+#define TLP_SROM_DIN		0x00000004
+#define TLP_SROM_CLK		0x00000002
+#define TLP_SROM_CS		0x00000001
+
+/* CSR 12 - General Purpose IO register */
+#define TLP_GPIO_DIR		0x00000100
+
+/* CSR 15 - Watchdog Timer Register */
+#define TLP_WDOG_RX_OFF		0x00000010
+#define TLP_WDOG_TX_OFF		0x00000001
+#define TLP_WDOG_INIT		(TLP_WDOG_TX_OFF | \
+				 TLP_WDOG_RX_OFF)
+
+/* GPIO bits common to all cards */
+#define GPIO_INIT		0x01	/*    from Xilinx                  */
+#define GPIO_RESET		0x02	/* to      Xilinx                  */
+/* bits 2 and 3 vary with card type -- see below */
+#define GPIO_MODE		0x10	/* to      Xilinx                  */
+#define GPIO_DP			0x20	/* to/from Xilinx                  */
+#define GPIO_DATA		0x40	/* serial data                     */
+#define GPIO_CLK		0x80	/* serial clock                    */
+
+/* HSSI GPIO bits */
+#define GPIO_HSSI_ST		0x04	/* send timing sense (deprecated)  */
+#define GPIO_HSSI_TXCLK		0x08	/* clock source                    */
+
+/* HSSIc GPIO bits */
+#define GPIO_HSSI_SYNTH		0x04	/* Synth osc chip select           */
+#define GPIO_HSSI_DCE		0x08	/* provide clock on TXCLOCK output */
+
+/* T3   GPIO bits */
+#define GPIO_T3_DAC		0x04	/* DAC chip select                 */
+#define GPIO_T3_INTEN		0x08	/* Framer Interupt enable          */
+
+/* SSI  GPIO bits */
+#define GPIO_SSI_SYNTH		0x04	/* Synth osc chip select           */
+#define GPIO_SSI_DCE		0x08	/* provide clock on TXCLOCK output */
+
+/* T1E1 GPIO bits */
+#define GPIO_T1_INTEN		0x08	/* Framer Interupt enable          */
+
+/* MII register 16 bits common to all cards */
+/* NB: LEDs  for HSSI & SSI are in DIFFERENT bits than for T1E1 & T3; oops */
+/* NB: CRC32 for HSSI & SSI is  in DIFFERENT bit  than for T1E1 & T3; oops */
+#define MII16_LED_ALL		0x0780	/* RW: LED bit mask                */
+#define MII16_FIFO		0x0800	/* RW: 1=reset, 0=not reset        */
+
+/* MII register 16 bits for HSSI */
+#define MII16_HSSI_TA		0x0001	/* RW: host ready;  host->modem    */
+#define MII16_HSSI_CA		0x0002	/* RO: modem ready; modem->host    */
+#define MII16_HSSI_LA		0x0004	/* RW: loopback A;  host->modem    */
+#define MII16_HSSI_LB		0x0008	/* RW: loopback B;  host->modem    */
+#define MII16_HSSI_LC		0x0010	/* RO: loopback C;  modem->host    */
+#define MII16_HSSI_TM		0x0020	/* RO: test mode;   modem->host    */
+#define MII16_HSSI_CRC32	0x0040	/* RW: CRC length 16/32            */
+#define MII16_HSSI_LED_LL	0x0080	/* RW: lower left  - green         */
+#define MII16_HSSI_LED_LR	0x0100	/* RW: lower right - green         */
+#define MII16_HSSI_LED_UL	0x0200	/* RW: upper left  - green         */
+#define MII16_HSSI_LED_UR	0x0400	/* RW: upper right - red           */
+#define MII16_HSSI_FIFO		0x0800	/* RW: reset fifos                 */
+#define MII16_HSSI_FORCECA	0x1000	/* RW: [cPCI] force CA on          */
+#define MII16_HSSI_CLKMUX	0x6000	/* RW: [cPCI] TX clock selection   */
+#define MII16_HSSI_LOOP		0x8000	/* RW: [cPCI] LOOP TX into RX      */
+#define MII16_HSSI_MODEM	0x003F	/* TA+CA+LA+LB+LC+TM               */
+
+/* MII register 16 bits for DS3 */
+#define MII16_DS3_ZERO		0x0001	/* RW: short/long cables           */
+#define MII16_DS3_TRLBK		0x0002	/* RW: loop towards host           */
+#define MII16_DS3_LNLBK		0x0004	/* RW: loop towards net            */
+#define MII16_DS3_RAIS		0x0008	/* RO: LIU receive AIS      (depr) */
+#define MII16_DS3_TAIS		0x0010	/* RW: LIU transmit AIS     (depr) */
+#define MII16_DS3_BIST		0x0020	/* RO: LIU QRSS patt match  (depr) */
+#define MII16_DS3_DLOS		0x0040	/* RO: LIU Digital LOS      (depr) */
+#define MII16_DS3_LED_BLU	0x0080	/* RW: lower right - blue          */
+#define MII16_DS3_LED_YEL	0x0100	/* RW: lower left  - yellow        */
+#define MII16_DS3_LED_RED	0x0200	/* RW: upper right - red           */
+#define MII16_DS3_LED_GRN	0x0400	/* RW: upper left  - green         */
+#define MII16_DS3_FIFO		0x0800	/* RW: reset fifos                 */
+#define MII16_DS3_CRC32		0x1000	/* RW: CRC length 16/32            */
+#define MII16_DS3_SCRAM		0x2000	/* RW: payload scrambler           */
+#define MII16_DS3_POLY		0x4000	/* RW: 1=Larse, 0=DigLink|Kentrox  */
+#define MII16_DS3_FRAME		0x8000	/* RW: 1=stop txframe pulses       */
+
+/* MII register 16 bits for SSI */
+#define MII16_SSI_DTR		0x0001	/* RW: DTR host->modem             */
+#define MII16_SSI_DSR		0x0002	/* RO: DSR modem->host             */
+#define MII16_SSI_RTS		0x0004	/* RW: RTS host->modem             */
+#define MII16_SSI_CTS		0x0008	/* RO: CTS modem->host             */
+#define MII16_SSI_DCD		0x0010	/* RW: DCD modem<->host            */
+#define MII16_SSI_RI		0x0020	/* RO: RI  modem->host             */
+#define MII16_SSI_CRC32		0x0040	/* RW: CRC length 16/32            */
+#define MII16_SSI_LED_LL	0x0080	/* RW: lower left  - green         */
+#define MII16_SSI_LED_LR	0x0100	/* RW: lower right - green         */
+#define MII16_SSI_LED_UL	0x0200	/* RW: upper left  - green         */
+#define MII16_SSI_LED_UR	0x0400	/* RW: upper right - red           */
+#define MII16_SSI_FIFO		0x0800	/* RW: reset fifos                 */
+#define MII16_SSI_LL		0x1000	/* RW: LL: host->modem             */
+#define MII16_SSI_RL		0x2000	/* RW: RL: host->modem             */
+#define MII16_SSI_TM		0x4000	/* RO: TM: modem->host             */
+#define MII16_SSI_LOOP		0x8000	/* RW: Loop at ext conn            */
+#define MII16_SSI_MODEM		0x703F	/* DTR+DSR+RTS+CTS+DCD+RI+LL+RL+TM */
+
+/* Mii register 17 has the SSI cable bits */
+#define MII17_SSI_CABLE_SHIFT	3	/* shift to get cable type         */
+#define MII17_SSI_CABLE_MASK	0x0038	/* RO: mask  to get cable type     */
+#define MII17_SSI_PRESCALE	0x0040	/* RW: divide by: 0=16; 1=512      */
+#define MII17_SSI_ITF		0x0100	/* RW: fill with: 0=flags; 1=ones  */
+#define MII17_SSI_NRZI		0x0400	/* RW: coding: NRZ= 0; NRZI=1      */
+
+/* MII register 16 bits for T1/E1 */
+#define MII16_T1_UNUSED1	0x0001
+#define MII16_T1_INVERT		0x0002	/* RW: invert data (for SF/AMI)    */
+#define MII16_T1_XOE		0x0004	/* RW: TX Output Enable; 0=disable */
+#define MII16_T1_RST		0x0008	/* RW: Bt8370 chip reset           */
+#define MII16_T1_Z		0x0010	/* RW: output impedance T1=1 E1=0  */
+#define MII16_T1_INTR		0x0020	/* RO: interrupt from Bt8370       */
+#define MII16_T1_ONESEC		0x0040	/* RO: one second square wave      */
+#define MII16_T1_LED_BLU	0x0080	/* RW: lower right - blue          */
+#define MII16_T1_LED_YEL	0x0100	/* RW: lower left  - yellow        */
+#define MII16_T1_LED_RED	0x0200	/* RW: upper right - red           */
+#define MII16_T1_LED_GRN	0x0400	/* RW: upper left  - green         */
+#define MII16_T1_FIFO		0x0800	/* RW: reset fifos                 */
+#define MII16_T1_CRC32		0x1000	/* RW: CRC length 16/32            */
+#define MII16_T1_UNUSED2	0xE000
+
+/* T3 framer:  RW=Read/Write;  RO=Read-Only;  RC=Read/Clr;  WO=Write-Only  */
+#define T3CSR_STAT0		0x00	/* RO: real-time status            */
+#define T3CSR_CTL1		0x01	/* RW: global control bits         */
+#define T3CSR_FEBE		0x02	/* RC: Far End Block Error Counter */
+#define T3CSR_CERR		0x03	/* RC: C-bit Parity Error Counter  */
+#define T3CSR_PERR		0x04	/* RC: P-bit Parity Error Counter  */
+#define T3CSR_TX_FEAC		0x05	/* RW: Far End Alarm & Control     */
+#define T3CSR_RX_FEAC		0x06	/* RO: Far End Alarm & Control     */
+#define T3CSR_STAT7		0x07	/* RL: latched real-time status    */
+#define T3CSR_CTL8		0x08	/* RW: extended global ctl bits    */
+#define T3CSR_STAT9		0x09	/* RL: extended status bits        */
+#define T3CSR_FERR		0x0A	/* RC: F-bit Error Counter         */
+#define T3CSR_MERR		0x0B	/* RC: M-bit Error Counter         */
+#define T3CSR_CTL12		0x0C	/* RW: more extended ctl bits      */
+#define T3CSR_DBL_FEAC		0x0D	/* RW: TX double FEAC              */
+#define T3CSR_CTL14		0x0E	/* RW: even more extended ctl bits */
+#define T3CSR_FEAC_STK		0x0F	/* RO: RX FEAC stack               */
+#define T3CSR_STAT16		0x10	/* RL: extended latched status     */
+#define T3CSR_INTEN		0x11	/* RW: interrupt enable            */
+#define T3CSR_CVLO		0x12	/* RC: coding violation cntr LSB   */
+#define T3CSR_CVHI		0x13	/* RC: coding violation cntr MSB   */
+#define T3CSR_CTL20		0x14	/* RW: yet more extended ctl bits  */
+
+#define CTL1_XTX		0x01	/* Transmit X-bit value            */
+#define CTL1_3LOOP		0x02	/* framer loop back                */
+#define CTL1_SER		0x04	/* SERial interface selected       */
+#define CTL1_M13MODE		0x08	/* M13 frame format                */
+#define CTL1_TXIDL		0x10	/* Transmit Idle signal            */
+#define CTL1_ENAIS		0x20	/* Enable AIS upon LOS             */
+#define CTL1_TXAIS		0x40	/* Transmit Alarm Indication Sig   */
+#define CTL1_NOFEBE		0x80	/* No Far End Block Errors         */
+
+#define CTL5_EMODE		0x80	/* rev B Extended features enabled */
+#define CTL5_START		0x40	/* transmit the FEAC msg now       */
+
+#define CTL8_FBEC		0x80	/* F-Bit Error Count control       */
+#define CTL8_TBLU		0x20	/* Transmit Blue signal            */
+#define CTL8_OUT_DIS		0x10	/* Output Disable                  */
+
+#define STAT9_SEF		0x80	/* Severely Errored Frame          */
+#define STAT9_RBLU		0x20	/* Receive Blue signal             */
+
+#define CTL12_RTPLLEN		0x80	/* Rx-to-Tx Payload Lpbk Lock ENbl */
+#define CTL12_RTPLOOP		0x40	/* Rx-to-Tx Payload Loopback       */
+#define CTL12_DLCB1		0x08	/* Data Link C-Bits forced to 1    */
+#define CTL12_C21		0x04	/* C2 forced to 1                  */
+#define CTL12_MCB1		0x02	/* Most C-Bits forced to 1         */
+
+#define CTL13_DFEXEC		0x40	/* Execute Double FEAC             */
+
+#define CTL14_FEAC10		0x80	/* Transmit FEAC word 10 times     */
+#define CTL14_RGCEN		0x20	/* Receive Gapped Clock Out Enbl   */
+#define CTL14_TGCEN		0x10	/* Timing Gen Gapped Clk Out Enbl  */
+
+#define FEAC_STK_MORE		0x80	/* FEAC stack has more FEACs       */
+#define FEAC_STK_VALID		0x40	/* FEAC stack is valid             */
+#define FEAC_STK_FEAC		0x3F	/* FEAC stack FEAC data            */
+
+#define STAT16_XERR		0x01	/* X-bit Error                     */
+#define STAT16_SEF		0x02	/* Severely Errored Frame          */
+#define STAT16_RTLOC		0x04	/* Rx/Tx Loss Of Clock             */
+#define STAT16_FEAC		0x08	/* new FEAC msg                    */
+#define STAT16_RIDL		0x10	/* channel IDLe signal             */
+#define STAT16_RAIS		0x20	/* Alarm Indication Signal         */
+#define STAT16_ROOF		0x40	/* Out Of Frame sync               */
+#define STAT16_RLOS		0x80	/* Loss Of Signal                  */
+
+#define CTL20_CVEN		0x01	/* Coding Violation Counter Enbl   */
+
+/* T1.107 Bit Oriented C-Bit Parity Far End Alarm Control and Status codes */
+#define T3BOP_OOF		0x00	/* Yellow alarm status             */
+#define T3BOP_LINE_UP		0x07	/* line loopback activate          */
+#define T3BOP_LINE_DOWN		0x1C	/* line loopback deactivate        */
+#define T3BOP_LOOP_DS3		0x1B	/* loopback full DS3               */
+#define T3BOP_IDLE		0x1A	/* IDLE alarm status               */
+#define T3BOP_AIS		0x16	/* AIS  alarm status               */
+#define T3BOP_LOS		0x0E	/* LOS  alarm status               */
+
+/* T1E1 regs;  RW=Read/Write;  RO=Read-Only;  RC=Read/Clr;  WO=Write-Only  */
+#define Bt8370_DID		0x000	/* RO: Device ID                   */
+#define Bt8370_CR0		0x001	/* RW; Primary Control Register    */
+#define Bt8370_JAT_CR		0x002	/* RW: Jitter Attenuator CR        */
+#define Bt8370_IRR		0x003	/* RO: Interrupt Request Reg       */
+#define Bt8370_ISR7		0x004	/* RC: Alarm 1 Interrupt Status    */
+#define Bt8370_ISR6		0x005	/* RC: Alarm 2 Interrupt Status    */
+#define Bt8370_ISR5		0x006	/* RC: Error Interrupt Status      */
+#define Bt8370_ISR4		0x007	/* RC; Cntr Ovfl Interrupt Status  */
+#define Bt8370_ISR3		0x008	/* RC: Timer Interrupt Status      */
+#define Bt8370_ISR2		0x009	/* RC: Data Link 1 Int Status      */
+#define Bt8370_ISR1		0x00A	/* RC: Data Link 2 Int Status      */
+#define Bt8370_ISR0		0x00B	/* RC: Pattrn Interrupt Status     */
+#define Bt8370_IER7		0x00C	/* RW: Alarm 1 Interrupt Enable    */
+#define Bt8370_IER6		0x00D	/* RW: Alarm 2 Interrupt Enable    */
+#define Bt8370_IER5		0x00E	/* RW: Error Interrupt Enable      */
+#define Bt8370_IER4		0x00F	/* RW: Cntr Ovfl Interrupt Enable  */
+
+#define Bt8370_IER3		0x010	/* RW: Timer Interrupt Enable      */
+#define Bt8370_IER2		0x011	/* RW: Data Link 1 Int Enable      */
+#define Bt8370_IER1		0x012	/* RW: Data Link 2 Int Enable      */
+#define Bt8370_IER0		0x013	/* RW: Pattern Interrupt Enable    */
+#define Bt8370_LOOP		0x014	/* RW: Loopback Config Reg         */
+#define Bt8370_DL3_TS		0x015	/* RW: External Data Link Channel  */
+#define Bt8370_DL3_BIT		0x016	/* RW: External Data Link Bit      */
+#define Bt8370_FSTAT		0x017	/* RO: Offline Framer Status       */
+#define Bt8370_PIO		0x018	/* RW: Programmable Input/Output   */
+#define Bt8370_POE		0x019	/* RW: Programmable Output Enable  */
+#define Bt8370_CMUX		0x01A	/* RW: Clock Input Mux             */
+#define Bt8370_TMUX		0x01B	/* RW: Test Mux Config             */
+#define Bt8370_TEST		0x01C	/* RW: Test Config                 */
+
+#define Bt8370_LIU_CR		0x020	/* RW: Line Intf Unit Config Reg   */
+#define Bt8370_RSTAT		0x021	/* RO; Receive LIU Status          */
+#define Bt8370_RLIU_CR		0x022	/* RW: Receive LIU Config          */
+#define Bt8370_LPF		0x023	/* RW: RPLL Low Pass Filter        */
+#define Bt8370_VGA_MAX		0x024	/* RW: Variable Gain Amplifier Max */
+#define Bt8370_EQ_DAT		0x025	/* RW: Equalizer Coeff Data Reg    */
+#define Bt8370_EQ_PTR		0x026	/* RW: Equzlizer Coeff Table Ptr   */
+#define Bt8370_DSLICE		0x027	/* RW: Data Slicer Threshold       */
+#define Bt8370_EQ_OUT		0x028	/* RW: Equalizer Output Levels     */
+#define Bt8370_VGA		0x029	/* RO: Variable Gain Ampl Status   */
+#define Bt8370_PRE_EQ		0x02A	/* RW: Pre-Equalizer               */
+
+#define Bt8370_COEFF0		0x030	/* RO: LMS Adj Eq Coeff Status     */
+#define Bt8370_GAIN0		0x038	/* RW: Equalizer Gain Thresh       */
+#define Bt8370_GAIN1		0x039	/* RW: Equalizer Gain Thresh       */
+#define Bt8370_GAIN2		0x03A	/* RW: Equalizer Gain Thresh       */
+#define Bt8370_GAIN3		0x03B	/* RW: Equalizer Gain Thresh       */
+#define Bt8370_GAIN4		0x03C	/* RW: Equalizer Gain Thresh       */
+
+#define Bt8370_RCR0		0x040	/* RW: Rx Configuration            */
+#define Bt8370_RPATT		0x041	/* RW: Rx Test Pattern Config      */
+#define Bt8370_RLB		0x042	/* RW: Rx Loopback Code Detr Conf  */
+#define Bt8370_LBA		0x043	/* RW: Loopback Activate Code Patt */
+#define Bt8370_LBD		0x044	/* RW: Loopback Deact Code Patt    */
+#define Bt8370_RALM		0x045	/* RW: Rx Alarm Signal Config      */
+#define Bt8370_LATCH		0x046	/* RW: Alarm/Err/Cntr Latch Config */
+#define Bt8370_ALM1		0x047	/* RO: Alarm 1 Status              */
+#define Bt8370_ALM2		0x048	/* RO: Alarm 2 Status              */
+#define Bt8370_ALM3		0x049	/* RO: Alarm 3 Status              */
+
+#define Bt8370_FERR_LO		0x050	/* RC: Framing Bit Error Cntr LSB  */
+#define Bt8370_FERR_HI		0x051	/* RC: Framing Bit Error Cntr MSB  */
+#define Bt8370_CRC_LO		0x052	/* RC: CRC    Error   Counter LSB  */
+#define Bt8370_CRC_HI		0x053	/* RC: CRC    Error   Counter MSB  */
+#define Bt8370_LCV_LO		0x054	/* RC: Line Code Viol Counter LSB  */
+#define Bt8370_LCV_HI		0x055	/* RC: Line Code Viol Counter MSB  */
+#define Bt8370_FEBE_LO		0x056	/* RC: Far End Block Err Cntr LSB  */
+#define Bt8370_FEBE_HI		0x057	/* RC: Far End Block Err Cntr MSB  */
+#define Bt8370_BERR_LO		0x058	/* RC: PRBS Bit Error Counter LSB  */
+#define Bt8370_BERR_HI		0x059	/* RC: PRBS Bit Error Counter MSB  */
+#define Bt8370_AERR		0x05A	/* RC: SEF/LOF/COFA counter        */
+#define Bt8370_RSA4		0x05B	/* RO: Rx Sa4 Byte Buffer          */
+#define Bt8370_RSA5		0x05C	/* RO: Rx Sa5 Byte Buffer          */
+#define Bt8370_RSA6		0x05D	/* RO: Rx Sa6 Byte Buffer          */
+#define Bt8370_RSA7		0x05E	/* RO: Rx Sa7 Byte Buffer          */
+#define Bt8370_RSA8		0x05F	/* RO: Rx Sa8 Byte Buffer          */
+
+#define Bt8370_SHAPE0		0x060	/* RW: Tx Pulse Shape Config       */
+#define Bt8370_TLIU_CR		0x068	/* RW: Tx LIU Config Reg           */
+
+#define Bt8370_TCR0		0x070	/* RW: Tx Framer Config            */
+#define Bt8370_TCR1		0x071	/* RW: Txter Configuration         */
+#define Bt8370_TFRM		0x072	/* RW: Tx Frame Format             */
+#define Bt8370_TERROR		0x073	/* RW: Tx Error Insert             */
+#define Bt8370_TMAN		0x074	/* RW: Tx Manual Sa/FEBE Config    */
+#define Bt8370_TALM		0x075	/* RW: Tx Alarm Signal Config      */
+#define Bt8370_TPATT		0x076	/* RW: Tx Test Pattern Config      */
+#define Bt8370_TLB		0x077	/* RW: Tx Inband Loopback Config   */
+#define Bt8370_LBP		0x078	/* RW: Tx Inband Loopback Patt     */
+#define Bt8370_TSA4		0x07B	/* RW: Tx Sa4 Byte Buffer          */
+#define Bt8370_TSA5		0x07C	/* RW: Tx Sa5 Byte Buffer          */
+#define Bt8370_TSA6		0x07D	/* RW: Tx Sa6 Byte Buffer          */
+#define Bt8370_TSA7		0x07E	/* RW: Tx Sa7 Byte Buffer          */
+#define Bt8370_TSA8		0x07F	/* RW: Tx Sa8 Byte Buffer          */
+
+#define Bt8370_CLAD_CR		0x090	/* RW: Clock Rate Adapter Config   */
+#define Bt8370_CSEL		0x091	/* RW: CLAD Frequency Select       */
+#define Bt8370_CPHASE		0x092	/* RW: CLAD Phase Det Scale Factor */
+#define Bt8370_CTEST		0x093	/* RW: CLAD Test                   */
+
+#define Bt8370_BOP		0x0A0	/* RW: Bit Oriented Protocol Xcvr  */
+#define Bt8370_TBOP		0x0A1	/* RW: Tx BOP Codeword             */
+#define Bt8370_RBOP		0x0A2	/* RO; Rx BOP Codeword             */
+#define Bt8370_BOP_STAT		0x0A3	/* RO: BOP Status                  */
+#define Bt8370_DL1_TS		0x0A4	/* RW: DL1 Time Slot Enable        */
+#define Bt8370_DL1_BIT		0x0A5	/* RW: DL1 Bit Enable              */
+#define Bt8370_DL1_CTL		0x0A6	/* RW: DL1 Control                 */
+#define Bt8370_RDL1_FFC		0x0A7	/* RW: RDL1 FIFO Fill Control      */
+#define Bt8370_RDL1		0x0A8	/* RO: RDL1 FIFO                   */
+#define Bt8370_RDL1_STAT	0x0A9	/* RO: RDL1 Status                 */
+#define Bt8370_PRM		0x0AA	/* RW: Performance Report Message  */
+#define Bt8370_TDL1_FEC		0x0AB	/* RW: TDL1 FIFO Empty Control     */
+#define Bt8370_TDL1_EOM		0x0AC	/* WO: TDL1 End Of Message Control */
+#define Bt8370_TDL1		0x0AD	/* RW: TDL1 FIFO                   */
+#define Bt8370_TDL1_STAT	0x0AE	/* RO: TDL1 Status                 */
+#define Bt8370_DL2_TS		0x0AF	/* RW: DL2 Time Slot Enable        */
+
+#define Bt8370_DL2_BIT		0x0B0	/* RW: DL2 Bit Enable              */
+#define Bt8370_DL2_CTL		0x0B1	/* RW: DL2 Control                 */
+#define Bt8370_RDL2_FFC		0x0B2	/* RW: RDL2 FIFO Fill Control      */
+#define Bt8370_RDL2		0x0B3	/* RO: RDL2 FIFO                   */
+#define Bt8370_RDL2_STAT	0x0B4	/* RO: RDL2 Status                 */
+#define Bt8370_TDL2_FEC		0x0B6	/* RW: TDL2 FIFO Empty Control     */
+#define Bt8370_TDL2_EOM		0x0B7	/* WO; TDL2 End Of Message Control */
+#define Bt8370_TDL2		0x0B8	/* RW: TDL2 FIFO                   */
+#define Bt8370_TDL2_STAT	0x0B9	/* RO: TDL2 Status                 */
+#define Bt8370_DL_TEST1		0x0BA	/* RW: DLINK Test Config           */
+#define Bt8370_DL_TEST2		0x0BB	/* RW: DLINK Test Status           */
+#define Bt8370_DL_TEST3		0x0BC	/* RW: DLINK Test Status           */
+#define Bt8370_DL_TEST4		0x0BD	/* RW: DLINK Test Control          */
+#define Bt8370_DL_TEST5		0x0BE	/* RW: DLINK Test Control          */
+
+#define Bt8370_SBI_CR		0x0D0	/* RW: System Bus Interface Config */
+#define Bt8370_RSB_CR		0x0D1	/* RW: Rx System Bus Config        */
+#define Bt8370_RSYNC_BIT	0x0D2	/* RW: Rx System Bus Sync Bit Offs */
+#define Bt8370_RSYNC_TS		0x0D3	/* RW: Rx System Bus Sync TS Offs  */
+#define Bt8370_TSB_CR		0x0D4	/* RW: Tx System Bus Config        */
+#define Bt8370_TSYNC_BIT	0x0D5	/* RW: Tx System Bus Sync Bit OFfs */
+#define Bt8370_TSYNC_TS		0x0D6	/* RW: Tx System Bus Sync TS Offs  */
+#define Bt8370_RSIG_CR		0x0D7	/* RW: Rx Siganalling Config       */
+#define Bt8370_RSYNC_FRM	0x0D8	/* RW: Sig Reinsertion Frame Offs  */
+#define Bt8370_SSTAT		0x0D9	/* RO: Slip Buffer Status          */
+#define Bt8370_STACK		0x0DA	/* RO: Rx Signalling Stack         */
+#define Bt8370_RPHASE		0x0DB	/* RO: RSLIP Phase Status          */
+#define Bt8370_TPHASE		0x0DC	/* RO: TSLIP Phase Status          */
+#define Bt8370_PERR		0x0DD	/* RO: RAM Parity Status           */
+
+#define Bt8370_SBCn		0x0E0	/* RW: System Bus Per-Channel Ctl  */
+#define Bt8370_TPCn		0x100	/* RW: Tx Per-Channel Control      */
+#define Bt8370_TSIGn		0x120	/* RW: Tx Signalling Buffer        */
+#define Bt8370_TSLIP_LOn	0x140	/* RW: Tx PCM Slip Buffer Lo       */
+#define Bt8370_TSLIP_HIn	0x160	/* RW: Tx PCM Slip Buffer Hi       */
+#define Bt8370_RPCn		0x180	/* RW: Rx Per-Channel Control      */
+#define Bt8370_RSIGn		0x1A0	/* RW: Rx Signalling Buffer        */
+#define Bt8370_RSLIP_LOn	0x1C0	/* RW: Rx PCM Slip Buffer Lo       */
+#define Bt8370_RSLIP_HIn	0x1E0	/* RW: Rx PCM Slip Buffer Hi       */
+
+/* Bt8370_LOOP (0x14) framer loopback control register bits */
+#define LOOP_ANALOG		0x01	/* inward  loop thru LIU           */
+#define LOOP_FRAMER		0x02	/* inward  loop thru framer        */
+#define LOOP_LINE		0x04	/* outward loop thru LIU           */
+#define LOOP_PAYLOAD		0x08	/* outward loop of payload         */
+#define LOOP_DUAL		0x06	/* inward framer + outward line    */
+
+/* Bt8370_ALM1 (0x47) receiver alarm status register bits */
+#define ALM1_SIGFRZ		0x01	/* Rx Signalling Freeze            */
+#define ALM1_RLOF		0x02	/* Rx loss of frame alignment      */
+#define ALM1_RLOS		0x04	/* Rx digital loss of signal       */
+#define ALM1_RALOS		0x08	/* Rx analog  loss of signal       */
+#define ALM1_RAIS		0x10	/* Rx Alarm Indication Signal      */
+#define ALM1_RYEL		0x40	/* Rx Yellow alarm indication      */
+#define ALM1_RMYEL		0x80	/* Rx multiframe YELLOW alarm      */
+
+/* Bt8370_ALM3 (0x49) receive framer status register bits */
+#define ALM3_FRED		0x04	/* Rx Out Of T1/FAS alignment      */
+#define ALM3_MRED		0x08	/* Rx Out Of MFAS alignment        */
+#define ALM3_SRED		0x10	/* Rx Out Of CAS alignment         */
+#define ALM3_SEF		0x20	/* Rx Severely Errored Frame       */
+#define ALM3_RMAIS		0x40	/* Rx TS16 AIS (CAS)               */
+
+/* Bt8370_TALM (0x75) transmit alarm control register bits */
+#define TALM_TAIS		0x01	/* Tx Alarm Indication Signal      */
+#define TALM_TYEL		0x02	/* Tx Yellow alarm                 */
+#define TALM_TMYEL		0x04	/* Tx Multiframe Yellow alarm      */
+#define TALM_AUTO_AIS		0x08	/* auto send AIS on LOS            */
+#define TALM_AUTO_YEL		0x10	/* auto send YEL on LOF            */
+#define TALM_AUTO_MYEL		0x20	/* auto send E1-Y16 on loss-of-CAS */
+
+/* 8370 BOP (Bit Oriented Protocol) command fragments */
+#define RBOP_OFF		0x00	/* BOP Rx disabled                 */
+#define RBOP_25			0xE0	/* BOP Rx requires 25 BOPs         */
+#define TBOP_OFF		0x00	/* BOP Tx disabled                 */
+#define TBOP_25			0x0B	/* BOP Tx sends 25 BOPs            */
+#define TBOP_CONT		0x0F	/* BOP Tx sends continuously       */
+
+/* T1.403 Bit-Oriented ESF Data-Link Message codes */
+#define T1BOP_OOF		0x00	/* Yellow alarm status             */
+#define T1BOP_LINE_UP		0x07	/* line loopback activate          */
+#define T1BOP_LINE_DOWN		0x1C	/* line loopback deactivate        */
+#define T1BOP_PAY_UP		0x0A	/* payload loopback activate       */
+#define T1BOP_PAY_DOWN		0x19	/* payload loopback deactivate     */
+#define T1BOP_NET_UP		0x09	/* network loopback activate       */
+#define T1BOP_NET_DOWN		0x12	/* network loopback deactivate     */
+
+/* Unix & Linux reserve 16 device-private IOCTLs */
+#if BSD
+# define LMCIOCGSTAT		_IOWR('i', 240, struct status)
+# define LMCIOCGCFG		_IOWR('i', 241, struct config)
+# define LMCIOCSCFG		 _IOW('i', 242, struct config)
+# define LMCIOCREAD		_IOWR('i', 243, struct ioctl)
+# define LMCIOCWRITE		 _IOW('i', 244, struct ioctl)
+# define LMCIOCTL		_IOWR('i', 245, struct ioctl)
+#endif
+
+struct iohdr				/* all LMCIOCs begin with this     */
+  {
+  char ifname[IFNAMSIZ];		/* interface name, e.g. "lmc0"     */
+  u_int32_t cookie;			/* interface version number        */
+  u_int16_t direction;			/* missing in Linux IOCTL          */
+  u_int16_t length;			/* missing in Linux IOCTL          */
+  struct iohdr *iohdr;			/* missing in Linux IOCTL          */
+  u_int32_t spare;			/* pad this struct to **32 bytes** */
+  };
+
+#define DIR_IO   0
+#define DIR_IOW  1			/* copy data user->kernel          */
+#define DIR_IOR  2			/* copy data kernel->user          */
+#define DIR_IOWR 3			/* copy data kernel<->user         */
+
+struct hssi_snmp
+  {
+  u_int16_t sigs;			/* MII16_HSSI & MII16_HSSI_MODEM   */
+  };
+
+struct ssi_snmp
+  {
+  u_int16_t sigs;			/* MII16_SSI & MII16_SSI_MODEM     */
+  };
+
+struct t3_snmp
+  {
+  u_int16_t febe;			/*  8 bits - Far End Block err cnt */
+  u_int16_t lcv;			/* 16 bits - BPV           err cnt */
+  u_int16_t pcv;			/*  8 bits - P-bit         err cnt */
+  u_int16_t ccv;			/*  8 bits - C-bit         err cnt */
+  u_int16_t line;			/* line status bit vector          */
+  u_int16_t loop;			/* loop status bit vector          */
+  };
+
+struct t1_snmp
+  {
+  u_int16_t prm[4];			/* T1.403 Performance Report Msg   */
+  u_int16_t febe;			/* 10 bits - E1 FAR CRC    err cnt */
+  u_int16_t lcv;			/* 16 bits - BPV + EXZ     err cnt */
+  u_int16_t fe;				/* 12 bits - Ft/Fs/FPS/FAS err cnt */
+  u_int16_t crc;			/* 10 bits - CRC6/CRC4     err cnt */
+  u_int16_t line;			/* line status bit vector          */
+  u_int16_t loop;			/* loop status bit vector          */
+  };
+
+/* SNMP trunk MIB Send codes */
+#define TSEND_NORMAL		   1	/* Send data (normal or looped)    */
+#define TSEND_LINE		   2	/* Send 'line loopback activate'   */
+#define TSEND_PAYLOAD		   3	/* Send 'payload loop activate'    */
+#define TSEND_RESET		   4	/* Send 'loopback deactivate'      */
+#define TSEND_QRS		   5	/* Send Quasi Random Signal        */
+
+/* ANSI T1.403 Performance Report Msg -- once a second from the far end    */
+#define T1PRM_FE		0x8000	/* Frame Sync Bit Error Event >= 1 */
+#define T1PRM_SE		0x4000	/* Severely Err Framing Event >= 1 */
+#define T1PRM_LB		0x2000	/* Payload Loopback Activated      */
+#define T1PRM_G1		0x1000	/* CRC Error Event = 1             */
+#define T1PRM_R			0x0800	/* Reserved                        */
+#define T1PRM_G2		0x0400	/* 1 < CRC Error Event <= 5        */
+#define T1PRM_SEQ		0x0300	/* modulo 4 counter                */
+#define T1PRM_G3		0x0080	/* 5 < CRC Error Event <= 10       */
+#define T1PRM_LV		0x0040	/* Line Code Violation Event >= 1  */
+#define T1PRM_G4		0x0020	/* 10 < CRC Error Event <= 100     */
+#define T1PRM_U			0x0018	/* Under study for synchronization */
+#define T1PRM_G5		0x0004	/* 100 < CRC Error Event <= 319    */
+#define T1PRM_SL		0x0002	/* Slip Event >= 1                 */
+#define T1PRM_G6		0x0001	/* CRC Error Event >= 320          */
+
+/* SNMP Line Status */
+#define TLINE_NORM		0x0001	/* no alarm present                */
+#define TLINE_RX_RAI		0x0002	/* receiving RAI = Yellow alarm    */
+#define TLINE_TX_RAI		0x0004	/* sending   RAI = Yellow alarm    */
+#define TLINE_RX_AIS		0x0008	/* receiving AIS =  blue  alarm    */
+#define TLINE_TX_AIS		0x0010	/* sending   AIS =  blue  alarm    */
+#define TLINE_LOF		0x0020	/* near end  LOF =   red  alarm    */
+#define TLINE_LOS		0x0040	/* near end loss of Signal         */
+#define TLINE_LOOP		0x0080	/* near end is looped              */
+#define T1LINE_RX_TS16_AIS	0x0100	/* near end receiving TS16 AIS     */
+#define T1LINE_RX_TS16_LOMF	0x0200	/* near end sending   TS16 LOMF    */
+#define T1LINE_TX_TS16_LOMF	0x0400	/* near end receiving TS16 LOMF    */
+#define T1LINE_RX_TEST		0x0800	/* near end receiving QRS Signal   */
+#define T1LINE_SEF		0x1000	/* near end severely errored frame */
+#define T3LINE_RX_IDLE		0x0100	/* near end receiving IDLE signal  */
+#define T3LINE_SEF		0x0200	/* near end severely errored frame */
+
+/* SNMP Loopback Status */
+#define TLOOP_NONE		0x01	/* no loopback                     */
+#define TLOOP_NEAR_PAYLOAD	0x02	/* near end payload loopback       */
+#define TLOOP_NEAR_LINE		0x04	/* near end line loopback          */
+#define TLOOP_NEAR_OTHER	0x08	/* near end looped somehow         */
+#define TLOOP_NEAR_INWARD	0x10	/* near end looped inward          */
+#define TLOOP_FAR_PAYLOAD	0x20	/* far  end payload loopback       */
+#define TLOOP_FAR_LINE		0x40	/* far  end line loopback          */
+
+/* event counters record interesting statistics */
+struct cntrs
+  {
+  struct timeval reset_time;		/* time when cntrs were reset      */
+  u_int64_t ibytes;			/* Rx bytes   with good status     */
+  u_int64_t obytes;			/* Tx bytes                        */
+  u_int64_t ipackets;			/* Rx packets with good status     */
+  u_int64_t opackets;			/* Tx packets                      */
+  u_int32_t ierrors;			/* Rx packets with bad status      */
+  u_int32_t oerrors;			/* Tx packets with bad status      */
+  u_int32_t idrops;			/* Rx packets dropped by SW        */
+  u_int32_t missed;			/* Rx pkts missed: no DMA descs    */
+  u_int32_t odrops;			/* Tx packets dropped by SW        */
+  u_int32_t fifo_over;			/* Rx fifo overruns  from DMA desc */
+  u_int32_t overruns;			/* Rx fifo overruns  from CSR      */
+  u_int32_t fifo_under;			/* Tx fifo underruns from DMA desc */
+  u_int32_t underruns;			/* Rx fifo underruns from CSR      */
+  u_int32_t fdl_pkts;			/* Rx T1 Facility Data Link pkts   */
+  u_int32_t crc_errs;			/* Rx T1 frame CRC errors          */
+  u_int32_t lcv_errs;			/* Rx T1 T3 Line Coding Violation  */
+  u_int32_t frm_errs;			/* Rx T1 T3 Frame bit errors       */
+  u_int32_t febe_errs;			/* Rx T1 T3 Far End Bit Errors     */
+  u_int32_t par_errs;			/* Rx T3 P-bit parity errors       */
+  u_int32_t cpar_errs;			/* Rx T3 C-bit parity errors       */
+  u_int32_t mfrm_errs;			/* Rx T3 Multi-frame bit errors    */
+  u_int32_t rxbuf;			/* Rx out of packet buffers        */
+  u_int32_t txdma;			/* Tx out of DMA desciptors        */
+  u_int32_t lck_watch;			/* lock conflict in watchdog       */
+  u_int32_t lck_intr;			/* lock conflict in interrupt      */
+  u_int32_t spare1;			/* debugging temp                  */
+  u_int32_t spare2;			/* debugging temp                  */
+  u_int32_t spare3;			/* debugging temp                  */
+  u_int32_t spare4;			/* debugging temp                  */
+  };
+
+/* sc->status is the READ ONLY status of the card.                         */
+/* Accessed using socket IO control calls or netgraph control messages.    */
+struct status
+  {
+  struct iohdr iohdr;			/* common ioctl header             */
+  u_int32_t card_type;			/* PCI device number               */
+  u_int16_t link_state;			/* actual state: up, down, test    */
+  u_int32_t tx_speed;			/* measured TX bits/sec            */
+  u_int32_t cable_type;			/* SSI only: cable type            */
+  u_int32_t time_slots;			/* T1E1 only: actual TSs in use    */
+  u_int32_t stack;			/* actual line stack in use        */
+  u_int32_t proto;			/* actual line proto in use        */
+  u_int32_t keep_alive;			/* actual keep-alive status        */
+  u_int32_t ticks;			/* incremented by watchdog @ 1 Hz  */
+  struct cntrs cntrs;			/* event counters                  */
+  union
+    {
+    struct hssi_snmp hssi;		/* data for RFC-???? HSSI MIB      */
+    struct t3_snmp t3;			/* data for RFC-2496 T3 MIB        */
+    struct ssi_snmp ssi;		/* data for RFC-1659 RS232 MIB     */
+    struct t1_snmp t1;			/* data for RFC-2495 T1 MIB        */
+    } snmp;
+  };
+
+/* protocol stack codes */
+#define STACK_NONE		   0	/* not set                   fnobl */
+#define STACK_RAWIP		   1	/* driver                    yyyyy */
+#define STACK_SPPP		   2	/* fbsd, nbsd, obsd          yyynn */
+#define STACK_P2P		   3	/* bsd/os                    nnnyn */
+#define STACK_GEN_HDLC		   4	/* linux                     nnnny */
+#define STACK_SYNC_PPP		   5	/* linux                     nnnny */
+#define STACK_NETGRAPH		   6	/* fbsd                      ynnnn */
+
+/* line protocol codes */
+#define PROTO_NONE		   0	/* not set                   fnobl */
+#define PROTO_IP_HDLC		   1	/* raw IP4/6 pkts in HDLC    yyyyy */
+#define PROTO_PPP		   2	/* Point-to-Point Protocol   yyyyy */
+#define PROTO_C_HDLC		   3	/* Cisco HDLC Protocol       yyyyy */
+#define PROTO_FRM_RLY		   4	/* Frame Relay Protocol      ynnyy */
+#define PROTO_ETH_HDLC		   5	/* raw Ether pkts in HDLC    nnnny */
+#define PROTO_X25		   6	/* X.25/LAPB Protocol        nnnny */
+
+/* oper_status codes (same as SNMP status codes) */
+#define STATE_UP		   1	/* may/will    tx/rx pkts          */
+#define STATE_DOWN		   2	/* can't/won't tx/rx pkts          */
+#define STATE_TEST		   3	/* currently not used              */
+
+struct synth				/* programmable oscillator params  */
+  {
+  unsigned n:7;				/*   numerator (3..127)            */
+  unsigned m:7;				/* denominator (3..127)            */
+  unsigned v:1;				/* mul by 1|8                      */
+  unsigned x:2;				/* div by 1|2|4|8                  */
+  unsigned r:2;				/* div by 1|2|4|8                  */
+  unsigned prescale:13;			/* log(final divisor): 2, 4 or 9   */
+  } __packed;
+
+#define SYNTH_FREF	        20e6	/* reference xtal =  20 MHz        */
+#define SYNTH_FMIN	        50e6	/* internal VCO min  50 MHz        */
+#define SYNTH_FMAX	       250e6	/* internal VCO max 250 MHz        */
+
+/* sc->config is the READ/WRITE configuration of the card.                 */
+/* Accessed using socket IO control calls or netgraph control messages.    */
+struct config
+  {
+  struct iohdr iohdr;			/* common ioctl header             */
+  u_int32_t crc_len;			/* ALL: CRC-16 or CRC-32 or none   */
+  u_int32_t loop_back;			/* ALL: many kinds of loopbacks    */
+  u_int32_t tx_clk_src;			/* T1, HSSI: ST, RT, int, ext      */
+  u_int32_t format;			/* T3, T1: ckt framing format      */
+  u_int32_t time_slots;			/* T1: 64Kb time slot config       */
+  u_int32_t cable_len;			/* T3, T1: cable length in meters  */
+  u_int32_t scrambler;			/* T3: payload scrambler config    */
+  u_int32_t dte_dce;			/* SSI, HSSIc: drive TXCLK         */
+  struct synth synth;			/* SSI, HSSIc: synth oscil params  */
+  u_int32_t rx_gain_max;		/* T1: receiver gain limit 0-50 dB */
+  u_int32_t tx_pulse;			/* T1: transmitter pulse shape     */
+  u_int32_t tx_lbo;			/* T1: transmitter atten 0-22.5 dB */
+  u_int32_t debug;			/* ALL: extra printout             */
+  u_int32_t stack;			/* ALL: use this line stack        */
+  u_int32_t proto;			/* ALL: use this line proto        */
+  u_int32_t keep_alive;			/* SPPP: use keep-alive packets    */
+  };
+
+#define CFG_CRC_0		   0	/* no CRC                          */
+#define CFG_CRC_16		   2	/* X^16+X^12+X^5+1 (default)       */
+#define CFG_CRC_32		   4	/* X^32+X^26+X^23+X^22+X^16+X^12+  */
+					/* X^11+X^10+X^8+X^7+X^5+X^4+X^2+X+1 */
+#define CFG_LOOP_NONE		   1	/* SNMP don't loop back anything   */
+#define CFG_LOOP_PAYLOAD	   2	/* SNMP loop outward thru framer   */
+#define CFG_LOOP_LINE		   3	/* SNMP loop outward thru LIU      */
+#define CFG_LOOP_OTHER		   4	/* SNMP loop  inward thru LIU      */
+#define CFG_LOOP_INWARD		   5	/* SNMP loop  inward thru framer   */
+#define CFG_LOOP_DUAL		   6	/* SNMP loop  inward & outward     */
+#define CFG_LOOP_TULIP		  16	/* ALL: loop  inward thru Tulip    */
+#define CFG_LOOP_PINS		  17	/* HSSIc, SSI: loop inward-pins    */
+#define CFG_LOOP_LL		  18	/* HSSI, SSI: assert LA/LL mdm pin */
+#define CFG_LOOP_RL		  19	/* HSSI, SSI: assert LB/RL mdm pin */
+
+#define CFG_CLKMUX_ST		   1	/* TX clk <- Send timing           */
+#define CFG_CLKMUX_INT		   2	/* TX clk <- internal source       */
+#define CFG_CLKMUX_RT		   3	/* TX clk <- Receive (loop) timing */
+#define CFG_CLKMUX_EXT		   4	/* TX clk <- ext connector         */
+
+/* values 0-31 are Bt8370 CR0 register values (LSB is zero if E1).         */
+/* values 32-99 are reserved for other T1E1 formats, (even number if E1)   */
+/* values 100 and up are used for T3 frame formats.                        */
+#define CFG_FORMAT_T1SF		   9	/* T1-SF          AMI              */
+#define CFG_FORMAT_T1ESF	  27	/* T1-ESF+CRC     B8ZS     X^6+X+1 */
+#define CFG_FORMAT_E1FAS	   0	/* E1-FAS         HDB3 TS0         */
+#define CFG_FORMAT_E1FASCRC	   8	/* E1-FAS+CRC     HDB3 TS0 X^4+X+1 */
+#define CFG_FORMAT_E1FASCAS	  16	/* E1-FAS    +CAS HDB3 TS0 & TS16  */
+#define CFG_FORMAT_E1FASCRCCAS	  24	/* E1-FAS+CRC+CAS HDB3 TS0 & TS16  */
+#define CFG_FORMAT_E1NONE	  32	/* E1-NO framing  HDB3             */
+#define CFG_FORMAT_T3CPAR	 100	/* T3-C-Bit par   B3ZS             */
+#define CFG_FORMAT_T3M13	 101	/* T3-M13 format  B3ZS             */
+
+/* format aliases that improve code readability */
+#define FORMAT_T1ANY		((sc->config.format & 1)==1)
+#define FORMAT_E1ANY		((sc->config.format & 1)==0)
+#define FORMAT_E1CAS		((sc->config.format & 0x11)==0x10)
+#define FORMAT_E1CRC		((sc->config.format & 0x09)==0x08)
+#define FORMAT_E1NONE		 (sc->config.format == CFG_FORMAT_E1NONE)
+#define FORMAT_T1ESF		 (sc->config.format == CFG_FORMAT_T1ESF)
+#define FORMAT_T1SF		 (sc->config.format == CFG_FORMAT_T1SF)
+#define FORMAT_T3CPAR		 (sc->config.format == CFG_FORMAT_T3CPAR)
+
+#define CFG_SCRAM_OFF		   1	/* DS3 payload scrambler off       */
+#define CFG_SCRAM_DL_KEN	   2	/* DS3 DigitalLink/Kentrox X^43+1  */
+#define CFG_SCRAM_LARS		   3	/* DS3 Larscom X^20+X^17+1 w/28ZS  */
+
+#define CFG_DTE			   1	/* HSSIc, SSI: rcv TXCLK; rcv DCD  */
+#define CFG_DCE			   2	/* HSSIc, SSI: drv TXCLK; drv DCD  */
+
+#define CFG_GAIN_SHORT		0x24	/* 0-20 dB of equalized gain       */
+#define CFG_GAIN_MEDIUM		0x2C	/* 0-30 dB of equalized gain       */
+#define CFG_GAIN_LONG		0x34	/* 0-40 dB of equalized gain       */
+#define CFG_GAIN_EXTEND		0x3F	/* 0-64 dB of equalized gain       */
+#define CFG_GAIN_AUTO		0xFF	/* auto-set based on cable length  */
+
+#define CFG_PULSE_T1DSX0	   0	/* T1 DSX   0- 40 meters           */
+#define CFG_PULSE_T1DSX1	   2	/* T1 DSX  40- 80 meters           */
+#define CFG_PULSE_T1DSX2	   4	/* T1 DSX  80-120 meters           */
+#define CFG_PULSE_T1DSX3	   6	/* T1 DSX 120-160 meters           */
+#define CFG_PULSE_T1DSX4	   8	/* T1 DSX 160-200 meters           */
+#define CFG_PULSE_E1COAX	  10	/* E1  75 ohm coax pair            */
+#define CFG_PULSE_E1TWIST	  12	/* E1 120 ohm twisted pairs        */
+#define CFG_PULSE_T1CSU		  14	/* T1 CSU 200-2000 meters; set LBO */
+#define CFG_PULSE_AUTO		0xFF	/* auto-set based on cable length  */
+
+#define CFG_LBO_0DB		   0	/* T1CSU LBO =  0.0 dB; FCC opt A  */
+#define CFG_LBO_7DB		  16	/* T1CSU LBO =  7.5 dB; FCC opt B  */
+#define CFG_LBO_15DB		  32	/* T1CSU LBO = 15.0 dB; FCC opt C  */
+#define CFG_LBO_22DB		  48	/* T1CSU LBO = 22.5 dB; final span */
+#define CFG_LBO_AUTO		0xFF	/* auto-set based on cable length  */
+
+struct ioctl
+  {
+  struct iohdr iohdr;			/* common ioctl header             */
+  u_int32_t cmd;			/* command                         */
+  u_int32_t address;			/* command address                 */
+  u_int32_t data;			/* command data                    */
+  char *ucode;				/* user-land address of ucode      */
+  };
+
+#define IOCTL_RW_PCI		   1	/* RW: Tulip PCI config registers  */
+#define IOCTL_RW_CSR		   2	/* RW: Tulip Control & Status Regs */
+#define IOCTL_RW_SROM		   3	/* RW: Tulip Serial Rom            */
+#define IOCTL_RW_BIOS		   4	/* RW: Tulip Boot rom              */
+#define IOCTL_RW_MII		   5	/* RW: MII registers               */
+#define IOCTL_RW_FRAME		   6	/* RW: Framer registers            */
+#define IOCTL_WO_SYNTH		   7	/* WO: Synthesized oscillator      */
+#define IOCTL_WO_DAC		   8	/* WO: Digital/Analog Converter    */
+
+#define IOCTL_XILINX_RESET	  16	/* reset Xilinx: all FFs set to 0  */
+#define IOCTL_XILINX_ROM	  17	/* load  Xilinx program from ROM   */
+#define IOCTL_XILINX_FILE	  18	/* load  Xilinx program from file  */
+
+#define IOCTL_SET_STATUS	  50	/* set mdm ctrl bits (internal)    */
+#define IOCTL_SNMP_SEND		  51	/* trunk MIB send code             */
+#define IOCTL_SNMP_LOOP		  52	/* trunk MIB loop configuration    */
+#define IOCTL_SNMP_SIGS		  53	/* RS232-like modem control sigs   */
+#define IOCTL_RESET_CNTRS	  54	/* reset event counters            */
+
+/* storage for these strings is allocated here! */
+const char *ssi_cables[] =
+  {
+  "V.10/EIA423",
+  "V.11/EIA530A",
+  "RESERVED",
+  "X.21",
+  "V.35",
+  "V.36/EIA449",
+  "V.28/EIA232",
+  "NO CABLE",
+  NULL,
+  };
+
+/***************************************************************************/
+/*    Declarations above here are shared with the user lmcconfig program.  */
+/*    Declarations below here are private to the kernel device driver.     */
+/***************************************************************************/
+
+#if KERNEL || _KERNEL || __KERNEL__
+
+/* Hide the minor differences between Operating Systems */
+
+typedef int intr_return_t;
+# define  READ_PCI_CFG(sc, addr)       pci_conf_read ((sc)->pa_pc, (sc)->pa_tag, addr)
+# define WRITE_PCI_CFG(sc, addr, data) pci_conf_write((sc)->pa_pc, (sc)->pa_tag, addr, data)
+# define  READ_CSR(sc, csr)	 bus_space_read_4 ((sc)->csr_tag, (sc)->csr_handle, csr)
+# define WRITE_CSR(sc, csr, val) bus_space_write_4((sc)->csr_tag, (sc)->csr_handle, csr, val)
+# define NAME_UNIT		device_xname(sc->sc_dev)
+# define BOOT_VERBOSE		(boothowto & AB_VERBOSE)
+# define TOP_LOCK(sc)		(mutex_spin_enter(&(sc)->top_lock), 0)
+# define TOP_TRYLOCK(sc)	mutex_tryenter(&(sc)->top_lock)
+# define TOP_UNLOCK(sc)		mutex_spin_exit(&(sc)->top_lock)
+# define BOTTOM_TRYLOCK(sc)	__cpu_simple_lock_try(&(sc)->bottom_lock)
+# define BOTTOM_UNLOCK(sc)	__cpu_simple_unlock  (&(sc)->bottom_lock)
+# define CHECK_CAP		kauth_authorize_network(curlwp->l_cred, KAUTH_NETWORK_INTERFACE, KAUTH_REQ_NETWORK_INTERFACE_FIRMWARE, sc->ifp, NULL, NULL)
+# define DISABLE_INTR		int spl = splnet()
+# define ENABLE_INTR		splx(spl)
+# define IRQ_NONE		0
+# define IRQ_HANDLED		1
+# define IFP2SC(ifp)		(ifp)->if_softc
+# define COPY_BREAK		MHLEN
+# define SLEEP(usecs)		tsleep(sc, PZERO, DEVICE_NAME, 1+(usecs/tick))
+# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, 0, size, flags)
+# define DMA_LOAD(map, addr, size)  bus_dmamap_load(ring->tag, map, addr, size, 0, BUS_DMA_NOWAIT)
+#  define LMC_BPF_MTAP(sc, mbuf)	bpf_mtap((sc)->ifp, mbuf)
+#  define LMC_BPF_ATTACH(sc, dlt, len)	bpf_attach((sc)->ifp, dlt, len)
+#  define LMC_BPF_DETACH(sc)		bpf_detach((sc)->ifp)
+
+static int driver_announced = 0;	/* print driver info once only */
+
+#define SNDQ_MAXLEN	32		/* packets awaiting transmission */
+#define DESCS_PER_PKT	 4		/* DMA descriptors per TX pkt */
+#define NUM_TX_DESCS	(DESCS_PER_PKT * SNDQ_MAXLEN)
+/* Increase DESCS_PER_PKT if status.cntrs.txdma increments. */
+
+/* A Tulip DMA descriptor can point to two chunks of memory.
+ * Each chunk has a max length of 2047 bytes (ask the VMS guys).
+ * 2047 isn't a multiple of a cache line size (32 bytes typically).
+ * So back off to 2048-32 = 2016 bytes per chunk (2 chunks per descr).
+ */
+#define MAX_CHUNK_LEN	(2048-32)
+#define MAX_DESC_LEN	(2 * MAX_CHUNK_LEN)
+
+/* Tulip DMA descriptor; THIS STRUCT MUST MATCH THE HARDWARE */
+struct dma_desc
+  {
+  u_int32_t status;			/* hardware->to->software */
+#if BYTE_ORDER == LITTLE_ENDIAN		/* left-to-right packing */
+  unsigned length1:11;			/* buffer1 length */
+  unsigned length2:11;			/* buffer2 length */
+  unsigned control:10;			/* software->to->hardware */
+#else					/* right-to-left packing */
+  unsigned control:10;			/* software->to->hardware */
+  unsigned length2:11;			/* buffer2 length */
+  unsigned length1:11;			/* buffer1 length */
+#endif
+  u_int32_t address1;			/* buffer1 bus address */
+  u_int32_t address2;			/* buffer2 bus address */
+  bus_dmamap_t map;			/* bus dmamap for this descriptor */
+# define TLP_BUS_DSL_VAL	(sizeof(bus_dmamap_t) & TLP_BUS_DSL)
+  } __packed;
+
+/* Tulip DMA descriptor status bits */
+#define TLP_DSTS_OWNER		0x80000000
+#define TLP_DSTS_RX_DESC_ERR	0x00004000
+#define TLP_DSTS_RX_FIRST_DESC	0x00000200
+#define TLP_DSTS_RX_LAST_DESC	0x00000100
+#define TLP_DSTS_RX_MII_ERR	0x00000008
+#define TLP_DSTS_RX_DRIBBLE	0x00000004
+#define TLP_DSTS_TX_UNDERRUN	0x00000002
+#define TLP_DSTS_RX_OVERRUN	0x00000001	/* not documented in rev AF */
+#define TLP_DSTS_RX_BAD		(TLP_DSTS_RX_MII_ERR  | \
+				 TLP_DSTS_RX_DRIBBLE  | \
+				 TLP_DSTS_RX_DESC_ERR | \
+				 TLP_DSTS_RX_OVERRUN)
+
+/* Tulip DMA descriptor control bits */
+#define TLP_DCTL_TX_INTERRUPT	0x0200
+#define TLP_DCTL_TX_LAST_SEG	0x0100
+#define TLP_DCTL_TX_FIRST_SEG	0x0080
+#define TLP_DCTL_TX_NO_CRC	0x0010
+#define TLP_DCTL_END_RING	0x0008
+#define TLP_DCTL_TX_NO_PAD	0x0002
+
+/* DMA descriptors are kept in a ring.
+ * Ring is empty when (read == write).
+ * Ring is full  when (read == wrap(write+1)),
+ * The ring also contains a tailq of data buffers.
+ */
+struct desc_ring
+  {
+  struct dma_desc *read;		/* next  descriptor to be read */
+  struct dma_desc *write;		/* next  descriptor to be written */
+  struct dma_desc *first;		/* first descriptor in ring */
+  struct dma_desc *last;		/* last  descriptor in ring */
+  struct dma_desc *temp;		/* temporary write pointer for tx */
+  u_int32_t dma_addr;			/* bus addr for desc array XXX */
+  int size_descs;			/* bus_dmamap_sync needs this */
+  int num_descs;			/* used to set rx quota */
+#if IFNET || NETGRAPH
+  struct mbuf *head;			/* tail-queue of mbufs */
+  struct mbuf *tail;
+#elif NETDEV
+  struct sk_buff *head;			/* tail-queue of skbuffs */
+  struct sk_buff *tail;
+#endif
+  bus_dma_tag_t tag;			/* bus_dma_tag for desc array */
+  bus_dmamap_t map;			/* bus_dmamap  for desc array */
+  bus_dma_segment_t segs[2];		/* bus_dmamap_load() or bus_dmamem_alloc() */
+  int nsegs;				/* bus_dmamap_load() or bus_dmamem_alloc() */
+  };
+
+/* break circular definition */
+typedef struct softc softc_t;
+
+struct card				/* an object */
+  {
+  void (*ident) (softc_t *);
+  void (*watchdog) (softc_t *);
+  int (*ioctl) (softc_t *, struct ioctl *);
+  void (*attach) (softc_t *, struct config *);
+  void (*detach) (softc_t *);
+  };
+
+struct stack				/* an object */
+  {
+#if IFNET || NETGRAPH
+  int (*ioctl) (softc_t *, u_long, void *);
+  void (*input) (softc_t *, struct mbuf *);
+  void (*output) (softc_t *);
+#elif NETDEV
+  int (*ioctl) (softc_t *, struct ifreq *, int);
+  int (*type) (softc_t *, struct sk_buff *);
+  int (*mtu) (softc_t *, int);
+#endif
+  void (*watchdog) (softc_t *);
+  int (*open) (softc_t *, struct config *);
+  int (*attach) (softc_t *, struct config *);
+  int (*detach) (softc_t *);
+  };
+
+/* This is the instance data, or "software context" for the device driver. */
+struct softc
+  {
+
+  device_t sc_dev;
+  pcitag_t pa_tag;
+  pci_chipset_tag_t pa_pc;
+  bus_dma_tag_t pa_dmat;
+  bus_space_tag_t csr_tag;
+  bus_space_handle_t csr_handle;
+  pci_intr_handle_t intr_handle;
+  void *irq_cookie;
+  void *sdh_cookie;
+  struct mbuf *tx_mbuf;			/* hang mbuf here while building dma descs */
+  kmutex_t top_lock;			/* lock card->watchdog vs ioctls           */
+  __cpu_simple_lock_t bottom_lock;	/* lock buf queues & descriptor rings   */
+
+  /* State for kernel-resident Line Protocols */
+#if IFNET
+# if SPPP
+  struct sppp spppcom;
+  struct sppp *sppp;
+# elif P2P
+  struct p2pcom p2pcom;
+  struct p2pcom *p2p;
+# else
+  struct ifnet ifnet;
+# endif
+  struct ifnet *ifp;
+  struct ifmedia ifm;
+#endif					/* IFNET */
+
+#if NETDEV
+# if GEN_HDLC
+  hdlc_device *hdlcdev;			/* contains struct net_device_stats */
+# else
+  struct net_device_stats netdev_stats;
+# endif
+# if SYNC_PPP
+  struct ppp_device *ppd;
+  struct ppp_device ppp_dev;		/* contains a struct sppp */
+  struct sppp *sppp;
+# endif
+  struct net_device *netdev;
+#endif					/* NETDEV */
+
+
+
+
+  /* State used by all card types; lock with top_lock.                     */
+  struct status status;			/* lmcconfig can read              */
+  struct config config;			/* lmcconfig can read/write        */
+  const char *dev_desc;			/* string describing card          */
+  struct card *card;			/* card methods                    */
+  struct stack *stack;			/* line methods                    */
+  u_int32_t gpio_dir;			/* s/w copy of GPIO direction reg  */
+  u_int16_t led_state;			/* last value written to mii16     */
+  int quota;				/* used for packet flow control    */
+
+  /* State used by card-specific watchdogs; lock with top_lock.            */
+  u_int32_t last_mii16;			/* SSI, HSSI: MII reg 16 one sec ago */
+  u_int32_t last_stat16;		/* T3:   framer reg 16 one sec ago */
+  u_int32_t last_alm1;			/* T1E1: framer reg 47 one sec ago */
+  u_int32_t last_link_state;		/* ALL: status.link_state 1 ec ago */
+  u_int32_t last_FEAC;			/* T3: last FEAC msg code received */
+  u_int32_t loop_timer;			/* T1E1, T3: secs until loop ends  */
+
+  /* State used by the interrupt code; lock with bottom_lock.              */
+  struct desc_ring txring;		/* tx descriptor ring state        */
+  struct desc_ring rxring;		/* rx descriptor ring state        */
+  };					/* end of softc */
+
+
+#define HSSI_DESC "LMC5200 HSSI Card"
+#define T3_DESC   "LMC5245 T3 Card"
+#define SSI_DESC  "LMC1000 SSI Card"
+#define T1E1_DESC "LMC1200 T1E1 Card"
+
+/* procedure prototypes */
+
+static void srom_shift_bits(softc_t *, u_int32_t, u_int32_t);
+static u_int16_t srom_read(softc_t *, u_int8_t);
+static void srom_write(softc_t *, u_int8_t, u_int16_t);
+
+static u_int8_t bios_read(softc_t *, u_int32_t);
+static void bios_write_phys(softc_t *, u_int32_t, u_int8_t);
+static void bios_write(softc_t *, u_int32_t, u_int8_t);
+static void bios_erase(softc_t *);
+
+static void mii_shift_bits(softc_t *, u_int32_t, u_int32_t);
+static u_int16_t mii_read(softc_t *, u_int8_t);
+static void mii_write(softc_t *, u_int8_t, u_int16_t);
+
+static void mii16_set_bits(softc_t *, u_int16_t);
+static void mii16_clr_bits(softc_t *, u_int16_t);
+static void mii17_set_bits(softc_t *, u_int16_t);
+static void mii17_clr_bits(softc_t *, u_int16_t);
+
+static void led_off(softc_t *, u_int16_t);
+static void led_on(softc_t *, u_int16_t);
+static void led_inv(softc_t *, u_int16_t);
+
+static void framer_write(softc_t *, u_int16_t, u_int8_t);
+static u_int8_t framer_read(softc_t *, u_int16_t);
+
+static void gpio_make_input(softc_t *, u_int32_t);
+static void gpio_make_output(softc_t *, u_int32_t);
+static u_int32_t gpio_read(softc_t *);
+static void gpio_set_bits(softc_t *, u_int32_t);
+static void gpio_clr_bits(softc_t *, u_int32_t);
+
+static void xilinx_reset(softc_t *);
+static void xilinx_load_from_rom(softc_t *);
+static int xilinx_load_from_file(softc_t *, char *, u_int32_t);
+
+static void synth_shift_bits(softc_t *, u_int32_t, u_int32_t);
+static void synth_write(softc_t *, struct synth *);
+
+static void dac_write(softc_t *, u_int16_t);
+
+static void hssi_ident(softc_t *);
+static void hssi_watchdog(softc_t *);
+static int hssi_ioctl(softc_t *, struct ioctl *);
+static void hssi_attach(softc_t *, struct config *);
+static void hssi_detach(softc_t *);
+
+static void t3_ident(softc_t *);
+static void t3_watchdog(softc_t *);
+static int t3_ioctl(softc_t *, struct ioctl *);
+static void t3_send_dbl_feac(softc_t *, int, int);
+static void t3_attach(softc_t *, struct config *);
+static void t3_detach(softc_t *);
+
+static void ssi_ident(softc_t *);
+static void ssi_watchdog(softc_t *);
+static int ssi_ioctl(softc_t *, struct ioctl *);
+static void ssi_attach(softc_t *, struct config *);
+static void ssi_detach(softc_t *);
+
+static void t1_ident(softc_t *);
+static void t1_watchdog(softc_t *);
+static int t1_ioctl(softc_t *, struct ioctl *);
+static void t1_send_bop(softc_t *, int);
+static void t1_attach(softc_t *, struct config *);
+static void t1_detach(softc_t *);
+
+
+#if SYNC_PPP
+static int sync_ppp_ioctl(softc_t *, struct ifreq *, int);
+static int sync_ppp_type(softc_t *, struct sk_buff *);
+static int sync_ppp_mtu(softc_t *, int);
+static void sync_ppp_watchdog(softc_t *);
+static int sync_ppp_open(softc_t *, struct config *);
+static int sync_ppp_attach(softc_t *, struct config *);
+static int sync_ppp_detach(softc_t *);
+#endif /* SYNC_PPP */
+
+#if GEN_HDLC
+static int gen_hdlc_ioctl(softc_t *, struct ifreq *, int);
+static int gen_hdlc_type(softc_t *, struct sk_buff *);
+static int gen_hdlc_mtu(softc_t *, int);
+static void gen_hdlc_watchdog(softc_t *);
+static int gen_hdlc_open(softc_t *, struct config *);
+static int gen_hdlc_attach(softc_t *, struct config *);
+static int gen_hdlc_detach(softc_t *);
+static int gen_hdlc_card_params(struct net_device *, unsigned short,
+				unsigned short);
+#endif /* GEN_HDLC */
+
+#if P2P
+static int p2p_stack_ioctl(softc_t *, u_long, void *);
+static void p2p_stack_input(softc_t *, struct mbuf *);
+static void p2p_stack_output(softc_t *);
+static void p2p_stack_watchdog(softc_t *);
+static int p2p_stack_open(softc_t *, struct config *);
+static int p2p_stack_attach(softc_t *, struct config *);
+static int p2p_stack_detach(softc_t *);
+static int p2p_getmdm(struct p2pcom *, void *);
+static int p2p_mdmctl(struct p2pcom *, int);
+#endif /* P2P */
+
+#if SPPP
+static int sppp_stack_ioctl(softc_t *, u_long, void *);
+static void sppp_stack_input(softc_t *, struct mbuf *);
+static void sppp_stack_output(softc_t *);
+static void sppp_stack_watchdog(softc_t *);
+static int sppp_stack_open(softc_t *, struct config *);
+static int sppp_stack_attach(softc_t *, struct config *);
+static int sppp_stack_detach(softc_t *);
+static void sppp_tls(struct sppp *);
+static void sppp_tlf(struct sppp *);
+#endif /* SPPP */
+
+#if IFNET
+static int rawip_ioctl(softc_t *, u_long, void *);
+static void rawip_input(softc_t *, struct mbuf *);
+static void rawip_output(softc_t *);
+#elif NETDEV
+static int rawip_ioctl(softc_t *, struct ifreq *, int);
+static int rawip_type(softc_t *, struct sk_buff *);
+static int rawip_mtu(softc_t *, int);
+#endif
+static void rawip_watchdog(softc_t *);
+static int rawip_open(softc_t *, struct config *);
+static int rawip_attach(softc_t *, struct config *);
+static int rawip_detach(softc_t *);
+
+#if IFNET
+static void ifnet_input(struct ifnet *, struct mbuf *);
+static int ifnet_output(struct ifnet *, struct mbuf *,
+			const struct sockaddr *, struct rtentry *);
+static int ifnet_ioctl(struct ifnet *, u_long, void *);
+static void ifnet_start(struct ifnet *);
+static void ifnet_watchdog(struct ifnet *);
+
+static void ifnet_setup(struct ifnet *);
+static int ifnet_attach(softc_t *);
+static void ifnet_detach(softc_t *);
+
+static void ifmedia_setup(softc_t *);
+static int lmc_ifmedia_change(struct ifnet *);
+static void ifmedia_status(struct ifnet *, struct ifmediareq *);
+#endif /* IFNET */
+
+#if NETDEV
+static int netdev_open(struct net_device *);
+static int netdev_stop(struct net_device *);
+static int netdev_start(struct sk_buff *, struct net_device *);
+# if NAPI
+static int netdev_poll(struct net_device *, int *);
+# endif
+static int netdev_ioctl(struct net_device *, struct ifreq *, int);
+static int netdev_mtu(struct net_device *, int);
+static void netdev_timeout(struct net_device *);
+static struct net_device_stats *netdev_stats(struct net_device *);
+static void netdev_watchdog(unsigned long);
+
+static void netdev_setup(struct net_device *);
+static int netdev_attach(softc_t *);
+static void netdev_detach(softc_t *);
+#endif /* NETDEV */
+
+
+#if BSD
+static int create_ring(softc_t *, struct desc_ring *, int);
+static void destroy_ring(softc_t *, struct desc_ring *);
+
+static void mbuf_enqueue(struct desc_ring *, struct mbuf *);
+static struct mbuf *mbuf_dequeue(struct desc_ring *);
+
+static int rxintr_cleanup(softc_t *);
+static int rxintr_setup(softc_t *);
+static int txintr_cleanup(softc_t *);
+static int txintr_setup_mbuf(softc_t *, struct mbuf *);
+static int txintr_setup(softc_t *);
+
+static intr_return_t bsd_interrupt(void *);
+# if DEVICE_POLLING
+static void bsd_poll(struct ifnet *, enum poll_cmd, int);
+# endif
+#endif /* BSD */
+
+static int open_proto(softc_t *, struct config *);
+static int attach_stack(softc_t *, struct config *);
+
+static int lmc_ioctl(softc_t *, u_long, void *);
+static void lmc_watchdog(softc_t *);
+
+static void set_ready(softc_t *, int);
+static void reset_cntrs(softc_t *);
+
+static void lmc_interrupt(void *, int, int);
+static void check_intr_status(softc_t *);
+
+static int lmc_attach(softc_t *);
+static void lmc_detach(softc_t *);
+
+static void tulip_loop(softc_t *, struct config *);
+static int tulip_attach(softc_t *);
+static void tulip_detach(void *);
+
+static void print_driver_info(void);
+
+static int nbsd_match(device_t, cfdata_t, void *);
+static void nbsd_attach(device_t, device_t, void *);
+static int nbsd_detach(device_t, int);
+
+#endif /* KERNEL */
+
+#endif /* IF_LMC_H */

Property changes on: lab4/.minix-src/include/dev/pci/if_lmc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/i2c/i2c_io.h
===================================================================
--- lab4/.minix-src/include/dev/i2c/i2c_io.h	(nonexistent)
+++ lab4/.minix-src/include/dev/i2c/i2c_io.h	(revision 13)
@@ -0,0 +1,111 @@
+/*	$NetBSD: i2c_io.h,v 1.3 2012/04/22 14:10:36 pgoyette Exp $	*/
+
+/*
+ * Copyright (c) 2003 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _DEV_I2C_I2C_IO_H_
+#define	_DEV_I2C_I2C_IO_H_
+
+#include <sys/ioccom.h>
+
+/* I2C bus address. */
+typedef uint16_t i2c_addr_t;
+
+/* High-level I2C operations. */
+#define	I2C_OPMASK_STOP		1
+#define	I2C_OPMASK_WRITE	2
+#define	I2C_OPMASK_BLKMODE	4
+
+#define	I2C_OP_STOP_P(x)	(((int)(x) & I2C_OPMASK_STOP) != 0)
+#define	I2C_OP_WRITE_P(x)	(((int)(x) & I2C_OPMASK_WRITE) != 0)
+#define	I2C_OP_READ_P(x)	(!I2C_OP_WRITE_P(x))
+#define	I2C_OP_BLKMODE_P(x)	(((int)(x) & I2C_OPMASK_BLKMODE) != 0)
+
+typedef enum {
+        I2C_OP_READ		= 0,
+        I2C_OP_READ_WITH_STOP	= I2C_OPMASK_STOP,
+        I2C_OP_WRITE		= I2C_OPMASK_WRITE,
+        I2C_OP_WRITE_WITH_STOP	= I2C_OPMASK_WRITE   | I2C_OPMASK_STOP,
+        I2C_OP_READ_BLOCK	= I2C_OPMASK_BLKMODE | I2C_OPMASK_STOP,
+        I2C_OP_WRITE_BLOCK	= I2C_OPMASK_BLKMODE | I2C_OPMASK_WRITE |
+					I2C_OPMASK_STOP,
+} i2c_op_t;
+
+/*
+ * This structure describes a single I2C control script fragment.
+ *
+ * Note that use of this scripted API allows for support of automated
+ * SMBus controllers.  The following table maps SMBus operations to
+ * script fragment configuration:
+ *
+ *	SMBus "write byte":		I2C_OP_WRITE_WITH_STOP
+ *					cmdlen = 1
+ *
+ *	SMBus "read byte":		I2C_OP_READ_WITH_STOP
+ *					cmdlen = 1
+ *
+ *	SMBus "receive byte":		I2C_OP_READ_WITH_STOP
+ *					cmdlen = 0
+ *
+ * Note that while each of these 3 SMBus operations implies a STOP
+ * (which an automated controller will likely perform automatically),
+ * non-SMBus clients may continue to function even if they issue
+ * I2C_OP_WRITE and I2C_OP_READ.
+ */
+
+/*
+ * I2C_IOCTL_EXEC:
+ *
+ *	User ioctl to execute an i2c operation.
+ */
+typedef struct i2c_ioctl_exec {
+	i2c_op_t iie_op;		/* operation to perform */
+	i2c_addr_t iie_addr;		/* address of device */
+	const void *iie_cmd;		/* pointer to command */
+	size_t iie_cmdlen;		/* length of command */
+	void *iie_buf;			/* pointer to data buffer */
+	size_t iie_buflen;		/* length of data buffer */
+} i2c_ioctl_exec_t;
+#if defined(__minix)
+#define	I2C_EXEC_MAX_CMDLEN	128
+#define	I2C_EXEC_MAX_BUFLEN	128
+#else
+#define	I2C_EXEC_MAX_CMDLEN	32
+#define	I2C_EXEC_MAX_BUFLEN	32
+#endif /* defined(__minix) */
+
+#define	I2C_IOCTL_EXEC		 _IOW('I', 0, i2c_ioctl_exec_t)
+
+#endif /* _DEV_I2C_I2C_IO_H_ */

Property changes on: lab4/.minix-src/include/dev/i2c/i2c_io.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/emmintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/emmintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/emmintrin.h	(revision 13)
@@ -0,0 +1,1451 @@
+/*===---- emmintrin.h - SSE2 intrinsics ------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __EMMINTRIN_H
+#define __EMMINTRIN_H
+
+#ifndef __SSE2__
+#error "SSE2 instruction set not enabled"
+#else
+
+#include <xmmintrin.h>
+
+typedef double __m128d __attribute__((__vector_size__(16)));
+typedef long long __m128i __attribute__((__vector_size__(16)));
+
+/* Type defines.  */
+typedef double __v2df __attribute__ ((__vector_size__ (16)));
+typedef long long __v2di __attribute__ ((__vector_size__ (16)));
+typedef short __v8hi __attribute__((__vector_size__(16)));
+typedef char __v16qi __attribute__((__vector_size__(16)));
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_add_sd(__m128d __a, __m128d __b)
+{
+  __a[0] += __b[0];
+  return __a;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_add_pd(__m128d __a, __m128d __b)
+{
+  return __a + __b;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_sub_sd(__m128d __a, __m128d __b)
+{
+  __a[0] -= __b[0];
+  return __a;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_sub_pd(__m128d __a, __m128d __b)
+{
+  return __a - __b;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_mul_sd(__m128d __a, __m128d __b)
+{
+  __a[0] *= __b[0];
+  return __a;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_mul_pd(__m128d __a, __m128d __b)
+{
+  return __a * __b;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_div_sd(__m128d __a, __m128d __b)
+{
+  __a[0] /= __b[0];
+  return __a;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_div_pd(__m128d __a, __m128d __b)
+{
+  return __a / __b;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_sqrt_sd(__m128d __a, __m128d __b)
+{
+  __m128d __c = __builtin_ia32_sqrtsd(__b);
+  return (__m128d) { __c[0], __a[1] };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_sqrt_pd(__m128d __a)
+{
+  return __builtin_ia32_sqrtpd(__a);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_min_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_minsd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_min_pd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_minpd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_max_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_maxsd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_max_pd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_maxpd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_and_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)((__v4si)__a & (__v4si)__b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_andnot_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)(~(__v4si)__a & (__v4si)__b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_or_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)((__v4si)__a | (__v4si)__b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_xor_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)((__v4si)__a ^ (__v4si)__b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpeqpd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmplt_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpltpd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmple_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmplepd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpltpd(__b, __a);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpge_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmplepd(__b, __a);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpord_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpordpd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpunord_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpunordpd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpneq_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpneqpd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnlt_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpnltpd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnle_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpnlepd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpngt_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpnltpd(__b, __a);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnge_pd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpnlepd(__b, __a);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_sd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpeqsd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmplt_sd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpltsd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmple_sd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmplesd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_sd(__m128d __a, __m128d __b)
+{
+  __m128d __c = __builtin_ia32_cmpltsd(__b, __a);
+  return (__m128d) { __c[0], __a[1] };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpge_sd(__m128d __a, __m128d __b)
+{
+  __m128d __c = __builtin_ia32_cmplesd(__b, __a);
+  return (__m128d) { __c[0], __a[1] };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpord_sd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpordsd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpunord_sd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpunordsd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpneq_sd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpneqsd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnlt_sd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpnltsd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnle_sd(__m128d __a, __m128d __b)
+{
+  return (__m128d)__builtin_ia32_cmpnlesd(__a, __b);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpngt_sd(__m128d __a, __m128d __b)
+{
+  __m128d __c = __builtin_ia32_cmpnltsd(__b, __a);
+  return (__m128d) { __c[0], __a[1] };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cmpnge_sd(__m128d __a, __m128d __b)
+{
+  __m128d __c = __builtin_ia32_cmpnlesd(__b, __a);
+  return (__m128d) { __c[0], __a[1] };
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comieq_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_comisdeq(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comilt_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_comisdlt(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comile_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_comisdle(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comigt_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_comisdgt(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comige_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_comisdge(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_comineq_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_comisdneq(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomieq_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_ucomisdeq(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomilt_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_ucomisdlt(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomile_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_ucomisdle(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomigt_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_ucomisdgt(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomige_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_ucomisdge(__a, __b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_ucomineq_sd(__m128d __a, __m128d __b)
+{
+  return __builtin_ia32_ucomisdneq(__a, __b);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtpd_ps(__m128d __a)
+{
+  return __builtin_ia32_cvtpd2ps(__a);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cvtps_pd(__m128 __a)
+{
+  return __builtin_ia32_cvtps2pd(__a);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepi32_pd(__m128i __a)
+{
+  return __builtin_ia32_cvtdq2pd((__v4si)__a);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtpd_epi32(__m128d __a)
+{
+  return __builtin_ia32_cvtpd2dq(__a);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsd_si32(__m128d __a)
+{
+  return __builtin_ia32_cvtsd2si(__a);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsd_ss(__m128 __a, __m128d __b)
+{
+  __a[0] = __b[0];
+  return __a;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi32_sd(__m128d __a, int __b)
+{
+  __a[0] = __b;
+  return __a;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cvtss_sd(__m128d __a, __m128 __b)
+{
+  __a[0] = __b[0];
+  return __a;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvttpd_epi32(__m128d __a)
+{
+  return (__m128i)__builtin_ia32_cvttpd2dq(__a);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_cvttsd_si32(__m128d __a)
+{
+  return __a[0];
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtpd_pi32(__m128d __a)
+{
+  return (__m64)__builtin_ia32_cvtpd2pi(__a);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_cvttpd_pi32(__m128d __a)
+{
+  return (__m64)__builtin_ia32_cvttpd2pi(__a);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cvtpi32_pd(__m64 __a)
+{
+  return __builtin_ia32_cvtpi2pd((__v2si)__a);
+}
+
+static __inline__ double __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsd_f64(__m128d __a)
+{
+  return __a[0];
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_load_pd(double const *__dp)
+{
+  return *(__m128d*)__dp;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_load1_pd(double const *__dp)
+{
+  struct __mm_load1_pd_struct {
+    double __u;
+  } __attribute__((__packed__, __may_alias__));
+  double __u = ((struct __mm_load1_pd_struct*)__dp)->__u;
+  return (__m128d){ __u, __u };
+}
+
+#define        _mm_load_pd1(dp)        _mm_load1_pd(dp)
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_loadr_pd(double const *__dp)
+{
+  __m128d __u = *(__m128d*)__dp;
+  return __builtin_shufflevector(__u, __u, 1, 0);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_loadu_pd(double const *__dp)
+{
+  struct __loadu_pd {
+    __m128d __v;
+  } __attribute__((packed, may_alias));
+  return ((struct __loadu_pd*)__dp)->__v;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_load_sd(double const *__dp)
+{
+  struct __mm_load_sd_struct {
+    double __u;
+  } __attribute__((__packed__, __may_alias__));
+  double __u = ((struct __mm_load_sd_struct*)__dp)->__u;
+  return (__m128d){ __u, 0 };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_loadh_pd(__m128d __a, double const *__dp)
+{
+  struct __mm_loadh_pd_struct {
+    double __u;
+  } __attribute__((__packed__, __may_alias__));
+  double __u = ((struct __mm_loadh_pd_struct*)__dp)->__u;
+  return (__m128d){ __a[0], __u };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_loadl_pd(__m128d __a, double const *__dp)
+{
+  struct __mm_loadl_pd_struct {
+    double __u;
+  } __attribute__((__packed__, __may_alias__));
+  double __u = ((struct __mm_loadl_pd_struct*)__dp)->__u;
+  return (__m128d){ __u, __a[1] };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_set_sd(double __w)
+{
+  return (__m128d){ __w, 0 };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_set1_pd(double __w)
+{
+  return (__m128d){ __w, __w };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_set_pd(double __w, double __x)
+{
+  return (__m128d){ __x, __w };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_setr_pd(double __w, double __x)
+{
+  return (__m128d){ __w, __x };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_setzero_pd(void)
+{
+  return (__m128d){ 0, 0 };
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_move_sd(__m128d __a, __m128d __b)
+{
+  return (__m128d){ __b[0], __a[1] };
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_store_sd(double *__dp, __m128d __a)
+{
+  struct __mm_store_sd_struct {
+    double __u;
+  } __attribute__((__packed__, __may_alias__));
+  ((struct __mm_store_sd_struct*)__dp)->__u = __a[0];
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_store1_pd(double *__dp, __m128d __a)
+{
+  struct __mm_store1_pd_struct {
+    double __u[2];
+  } __attribute__((__packed__, __may_alias__));
+  ((struct __mm_store1_pd_struct*)__dp)->__u[0] = __a[0];
+  ((struct __mm_store1_pd_struct*)__dp)->__u[1] = __a[0];
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_store_pd(double *__dp, __m128d __a)
+{
+  *(__m128d *)__dp = __a;
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_storeu_pd(double *__dp, __m128d __a)
+{
+  __builtin_ia32_storeupd(__dp, __a);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_storer_pd(double *__dp, __m128d __a)
+{
+  __a = __builtin_shufflevector(__a, __a, 1, 0);
+  *(__m128d *)__dp = __a;
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_storeh_pd(double *__dp, __m128d __a)
+{
+  struct __mm_storeh_pd_struct {
+    double __u;
+  } __attribute__((__packed__, __may_alias__));
+  ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[1];
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_storel_pd(double *__dp, __m128d __a)
+{
+  struct __mm_storeh_pd_struct {
+    double __u;
+  } __attribute__((__packed__, __may_alias__));
+  ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[0];
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_add_epi8(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v16qi)__a + (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_add_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v8hi)__a + (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_add_epi32(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v4si)__a + (__v4si)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_add_si64(__m64 __a, __m64 __b)
+{
+  return __a + __b;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_add_epi64(__m128i __a, __m128i __b)
+{
+  return __a + __b;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_adds_epi8(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_paddsb128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_adds_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_paddsw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_adds_epu8(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_paddusb128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_adds_epu16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_paddusw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_avg_epu8(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_pavgb128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_avg_epu16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_pavgw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_madd_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_pmaddwd128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_max_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_pmaxsw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_max_epu8(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_pmaxub128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_min_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_pminsw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_min_epu8(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_pminub128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_mulhi_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_pmulhw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_mulhi_epu16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_mullo_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v8hi)__a * (__v8hi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_mul_su32(__m64 __a, __m64 __b)
+{
+  return __builtin_ia32_pmuludq((__v2si)__a, (__v2si)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_mul_epu32(__m128i __a, __m128i __b)
+{
+  return __builtin_ia32_pmuludq128((__v4si)__a, (__v4si)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sad_epu8(__m128i __a, __m128i __b)
+{
+  return __builtin_ia32_psadbw128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sub_epi8(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v16qi)__a - (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sub_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v8hi)__a - (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sub_epi32(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v4si)__a - (__v4si)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sub_si64(__m64 __a, __m64 __b)
+{
+  return __a - __b;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sub_epi64(__m128i __a, __m128i __b)
+{
+  return __a - __b;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_subs_epi8(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_psubsb128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_subs_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_psubsw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_subs_epu8(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_psubusb128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_subs_epu16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_psubusw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_and_si128(__m128i __a, __m128i __b)
+{
+  return __a & __b;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_andnot_si128(__m128i __a, __m128i __b)
+{
+  return ~__a & __b;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_or_si128(__m128i __a, __m128i __b)
+{
+  return __a | __b;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_xor_si128(__m128i __a, __m128i __b)
+{
+  return __a ^ __b;
+}
+
+#define _mm_slli_si128(a, count) __extension__ ({ \
+  _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
+  __m128i __a = (a); \
+   _Pragma("clang diagnostic pop"); \
+  (__m128i)__builtin_ia32_pslldqi128(__a, (count)*8); })
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_slli_epi16(__m128i __a, int __count)
+{
+  return (__m128i)__builtin_ia32_psllwi128((__v8hi)__a, __count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sll_epi16(__m128i __a, __m128i __count)
+{
+  return (__m128i)__builtin_ia32_psllw128((__v8hi)__a, (__v8hi)__count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_slli_epi32(__m128i __a, int __count)
+{
+  return (__m128i)__builtin_ia32_pslldi128((__v4si)__a, __count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sll_epi32(__m128i __a, __m128i __count)
+{
+  return (__m128i)__builtin_ia32_pslld128((__v4si)__a, (__v4si)__count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_slli_epi64(__m128i __a, int __count)
+{
+  return __builtin_ia32_psllqi128(__a, __count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sll_epi64(__m128i __a, __m128i __count)
+{
+  return __builtin_ia32_psllq128(__a, __count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srai_epi16(__m128i __a, int __count)
+{
+  return (__m128i)__builtin_ia32_psrawi128((__v8hi)__a, __count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sra_epi16(__m128i __a, __m128i __count)
+{
+  return (__m128i)__builtin_ia32_psraw128((__v8hi)__a, (__v8hi)__count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srai_epi32(__m128i __a, int __count)
+{
+  return (__m128i)__builtin_ia32_psradi128((__v4si)__a, __count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sra_epi32(__m128i __a, __m128i __count)
+{
+  return (__m128i)__builtin_ia32_psrad128((__v4si)__a, (__v4si)__count);
+}
+
+
+#define _mm_srli_si128(a, count) __extension__ ({ \
+  _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
+  __m128i __a = (a); \
+  _Pragma("clang diagnostic pop"); \
+  (__m128i)__builtin_ia32_psrldqi128(__a, (count)*8); })
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srli_epi16(__m128i __a, int __count)
+{
+  return (__m128i)__builtin_ia32_psrlwi128((__v8hi)__a, __count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srl_epi16(__m128i __a, __m128i __count)
+{
+  return (__m128i)__builtin_ia32_psrlw128((__v8hi)__a, (__v8hi)__count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srli_epi32(__m128i __a, int __count)
+{
+  return (__m128i)__builtin_ia32_psrldi128((__v4si)__a, __count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srl_epi32(__m128i __a, __m128i __count)
+{
+  return (__m128i)__builtin_ia32_psrld128((__v4si)__a, (__v4si)__count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srli_epi64(__m128i __a, int __count)
+{
+  return __builtin_ia32_psrlqi128(__a, __count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srl_epi64(__m128i __a, __m128i __count)
+{
+  return __builtin_ia32_psrlq128(__a, __count);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_epi8(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v16qi)__a == (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v8hi)__a == (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmpeq_epi32(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v4si)__a == (__v4si)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_epi8(__m128i __a, __m128i __b)
+{
+  /* This function always performs a signed comparison, but __v16qi is a char
+     which may be signed or unsigned. */
+  typedef signed char __v16qs __attribute__((__vector_size__(16)));
+  return (__m128i)((__v16qs)__a > (__v16qs)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v8hi)__a > (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmpgt_epi32(__m128i __a, __m128i __b)
+{
+  return (__m128i)((__v4si)__a > (__v4si)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmplt_epi8(__m128i __a, __m128i __b)
+{
+  return _mm_cmpgt_epi8(__b, __a);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmplt_epi16(__m128i __a, __m128i __b)
+{
+  return _mm_cmpgt_epi16(__b, __a);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmplt_epi32(__m128i __a, __m128i __b)
+{
+  return _mm_cmpgt_epi32(__b, __a);
+}
+
+#ifdef __x86_64__
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi64_sd(__m128d __a, long long __b)
+{
+  __a[0] = __b;
+  return __a;
+}
+
+static __inline__ long long __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsd_si64(__m128d __a)
+{
+  return __builtin_ia32_cvtsd2si64(__a);
+}
+
+static __inline__ long long __attribute__((__always_inline__, __nodebug__))
+_mm_cvttsd_si64(__m128d __a)
+{
+  return __a[0];
+}
+#endif
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_cvtepi32_ps(__m128i __a)
+{
+  return __builtin_ia32_cvtdq2ps((__v4si)__a);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtps_epi32(__m128 __a)
+{
+  return (__m128i)__builtin_ia32_cvtps2dq(__a);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvttps_epi32(__m128 __a)
+{
+  return (__m128i)__builtin_ia32_cvttps2dq(__a);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi32_si128(int __a)
+{
+  return (__m128i)(__v4si){ __a, 0, 0, 0 };
+}
+
+#ifdef __x86_64__
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi64_si128(long long __a)
+{
+  return (__m128i){ __a, 0 };
+}
+#endif
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi128_si32(__m128i __a)
+{
+  __v4si __b = (__v4si)__a;
+  return __b[0];
+}
+
+#ifdef __x86_64__
+static __inline__ long long __attribute__((__always_inline__, __nodebug__))
+_mm_cvtsi128_si64(__m128i __a)
+{
+  return __a[0];
+}
+#endif
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_load_si128(__m128i const *__p)
+{
+  return *__p;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_loadu_si128(__m128i const *__p)
+{
+  struct __loadu_si128 {
+    __m128i __v;
+  } __attribute__((packed, may_alias));
+  return ((struct __loadu_si128*)__p)->__v;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_loadl_epi64(__m128i const *__p)
+{
+  struct __mm_loadl_epi64_struct {
+    long long __u;
+  } __attribute__((__packed__, __may_alias__));
+  return (__m128i) { ((struct __mm_loadl_epi64_struct*)__p)->__u, 0};
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_set_epi64x(long long q1, long long q0)
+{
+  return (__m128i){ q0, q1 };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_set_epi64(__m64 q1, __m64 q0)
+{
+  return (__m128i){ (long long)q0, (long long)q1 };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_set_epi32(int i3, int i2, int i1, int i0)
+{
+  return (__m128i)(__v4si){ i0, i1, i2, i3};
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_set_epi16(short w7, short w6, short w5, short w4, short w3, short w2, short w1, short w0)
+{
+  return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_set_epi8(char b15, char b14, char b13, char b12, char b11, char b10, char b9, char b8, char b7, char b6, char b5, char b4, char b3, char b2, char b1, char b0)
+{
+  return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_set1_epi64x(long long __q)
+{
+  return (__m128i){ __q, __q };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_set1_epi64(__m64 __q)
+{
+  return (__m128i){ (long long)__q, (long long)__q };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_set1_epi32(int __i)
+{
+  return (__m128i)(__v4si){ __i, __i, __i, __i };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_set1_epi16(short __w)
+{
+  return (__m128i)(__v8hi){ __w, __w, __w, __w, __w, __w, __w, __w };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_set1_epi8(char __b)
+{
+  return (__m128i)(__v16qi){ __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_setr_epi64(__m64 q0, __m64 q1)
+{
+  return (__m128i){ (long long)q0, (long long)q1 };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_setr_epi32(int i0, int i1, int i2, int i3)
+{
+  return (__m128i)(__v4si){ i0, i1, i2, i3};
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_setr_epi16(short w0, short w1, short w2, short w3, short w4, short w5, short w6, short w7)
+{
+  return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_setr_epi8(char b0, char b1, char b2, char b3, char b4, char b5, char b6, char b7, char b8, char b9, char b10, char b11, char b12, char b13, char b14, char b15)
+{
+  return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_setzero_si128(void)
+{
+  return (__m128i){ 0LL, 0LL };
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_store_si128(__m128i *__p, __m128i __b)
+{
+  *__p = __b;
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_storeu_si128(__m128i *__p, __m128i __b)
+{
+  __builtin_ia32_storedqu((char *)__p, (__v16qi)__b);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_maskmoveu_si128(__m128i __d, __m128i __n, char *__p)
+{
+  __builtin_ia32_maskmovdqu((__v16qi)__d, (__v16qi)__n, __p);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_storel_epi64(__m128i *__p, __m128i __a)
+{
+  struct __mm_storel_epi64_struct {
+    long long __u;
+  } __attribute__((__packed__, __may_alias__));
+  ((struct __mm_storel_epi64_struct*)__p)->__u = __a[0];
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_stream_pd(double *__p, __m128d __a)
+{
+  __builtin_ia32_movntpd(__p, __a);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_stream_si128(__m128i *__p, __m128i __a)
+{
+  __builtin_ia32_movntdq(__p, __a);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_stream_si32(int *__p, int __a)
+{
+  __builtin_ia32_movnti(__p, __a);
+}
+
+#ifdef __x86_64__
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_stream_si64(long long *__p, long long __a)
+{
+  __builtin_ia32_movnti64(__p, __a);
+}
+#endif
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_clflush(void const *__p)
+{
+  __builtin_ia32_clflush(__p);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_lfence(void)
+{
+  __builtin_ia32_lfence();
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_mfence(void)
+{
+  __builtin_ia32_mfence();
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_packs_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_packsswb128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_packs_epi32(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_packssdw128((__v4si)__a, (__v4si)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_packus_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_ia32_packuswb128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_extract_epi16(__m128i __a, int __imm)
+{
+  __v8hi __b = (__v8hi)__a;
+  return (unsigned short)__b[__imm & 7];
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_insert_epi16(__m128i __a, int __b, int __imm)
+{
+  __v8hi __c = (__v8hi)__a;
+  __c[__imm & 7] = __b;
+  return (__m128i)__c;
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_movemask_epi8(__m128i __a)
+{
+  return __builtin_ia32_pmovmskb128((__v16qi)__a);
+}
+
+#define _mm_shuffle_epi32(a, imm) __extension__ ({ \
+  _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
+  __m128i __a = (a); \
+  _Pragma("clang diagnostic pop"); \
+  (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si) _mm_set1_epi32(0), \
+                                   (imm) & 0x3, ((imm) & 0xc) >> 2, \
+                                   ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6); })
+
+#define _mm_shufflelo_epi16(a, imm) __extension__ ({ \
+  _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
+  __m128i __a = (a); \
+  _Pragma("clang diagnostic pop"); \
+  (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi) _mm_set1_epi16(0), \
+                                   (imm) & 0x3, ((imm) & 0xc) >> 2, \
+                                   ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \
+                                   4, 5, 6, 7); })
+
+#define _mm_shufflehi_epi16(a, imm) __extension__ ({ \
+  _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
+  __m128i __a = (a); \
+  _Pragma("clang diagnostic pop"); \
+  (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi) _mm_set1_epi16(0), \
+                                   0, 1, 2, 3, \
+                                   4 + (((imm) & 0x03) >> 0), \
+                                   4 + (((imm) & 0x0c) >> 2), \
+                                   4 + (((imm) & 0x30) >> 4), \
+                                   4 + (((imm) & 0xc0) >> 6)); })
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_unpackhi_epi8(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_unpackhi_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_unpackhi_epi32(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 2, 4+2, 3, 4+3);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_unpackhi_epi64(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_shufflevector(__a, __b, 1, 2+1);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_unpacklo_epi8(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_unpacklo_epi16(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_unpacklo_epi32(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 0, 4+0, 1, 4+1);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_unpacklo_epi64(__m128i __a, __m128i __b)
+{
+  return (__m128i)__builtin_shufflevector(__a, __b, 0, 2+0);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_movepi64_pi64(__m128i __a)
+{
+  return (__m64)__a[0];
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_movpi64_epi64(__m64 __a)
+{
+  return (__m128i){ (long long)__a, 0 };
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_move_epi64(__m128i __a)
+{
+  return __builtin_shufflevector(__a, (__m128i){ 0 }, 0, 2);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_unpackhi_pd(__m128d __a, __m128d __b)
+{
+  return __builtin_shufflevector(__a, __b, 1, 2+1);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_unpacklo_pd(__m128d __a, __m128d __b)
+{
+  return __builtin_shufflevector(__a, __b, 0, 2+0);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_movemask_pd(__m128d __a)
+{
+  return __builtin_ia32_movmskpd(__a);
+}
+
+#define _mm_shuffle_pd(a, b, i) __extension__ ({ \
+  _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
+  __m128d __a = (a); \
+  __m128d __b = (b); \
+  _Pragma("clang diagnostic pop"); \
+  __builtin_shufflevector(__a, __b, (i) & 1, (((i) & 2) >> 1) + 2); })
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_castpd_ps(__m128d __a)
+{
+  return (__m128)__a;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_castpd_si128(__m128d __a)
+{
+  return (__m128i)__a;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_castps_pd(__m128 __a)
+{
+  return (__m128d)__a;
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_castps_si128(__m128 __a)
+{
+  return (__m128i)__a;
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_castsi128_ps(__m128i __a)
+{
+  return (__m128)__a;
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_castsi128_pd(__m128i __a)
+{
+  return (__m128d)__a;
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_pause(void)
+{
+  __asm__ volatile ("pause");
+}
+
+#define _MM_SHUFFLE2(x, y) (((x) << 1) | (y))
+
+#endif /* __SSE2__ */
+
+#endif /* __EMMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/emmintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/mlyio.h
===================================================================
--- lab4/.minix-src/include/dev/pci/mlyio.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/mlyio.h	(revision 13)
@@ -0,0 +1,107 @@
+/*	$NetBSD: mlyio.h,v 1.5 2015/09/06 06:01:00 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran, Thor Lancelot Simon, and Eric Haszlakiewicz.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 2001 Michael Smith
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from FreeBSD: mlyio.h,v 1.2 2001/07/14 00:12:22 msmith Exp
+ */
+
+/*
+ * Control structures exchanged through the GAM interface with userland
+ * management tools.
+ *
+ * The member naming here is consistent with the Linux driver, with which this
+ * interface is basically compatible.
+ */
+
+#ifndef _PCI_MLYIO_H_
+#define	_PCI_MLYIO_H_
+
+#include <sys/ioccom.h>
+
+
+struct mly_user_command {
+	unsigned char	ControllerNumber;
+	union mly_cmd_packet	CommandMailbox;
+	int		DataTransferLength;
+	int		RequestSenseLength;
+	void		*DataTransferBuffer;
+	void		*RequestSenseBuffer;
+	int		CommandStatus;	/* not in the Linux structure */
+};
+
+#define	MLYIO_COMMAND	_IOWR('M', 200, struct mly_user_command)
+
+struct mly_user_health {
+	unsigned char	ControllerNumber;
+	void		*HealthStatusBuffer;
+};
+
+#define	MLYIO_HEALTH	_IOW('M', 201, struct mly_user_health)
+
+/*
+ * Command queue statistics
+ */
+
+#define	MLYQ_FREE	0
+#define	MLYQ_BUSY	1
+#define	MLYQ_COMPLETE	2
+#define	MLYQ_COUNT	3
+
+struct mly_qstat {
+	u_int32_t	q_length;
+	u_int32_t	q_max;
+};
+
+#endif	/* !defined _PCI_MLYIO_ */

Property changes on: lab4/.minix-src/include/dev/pci/mlyio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/pciio.h
===================================================================
--- lab4/.minix-src/include/dev/pci/pciio.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/pciio.h	(revision 13)
@@ -0,0 +1,137 @@
+/*	$NetBSD: pciio.h,v 1.4 2014/07/25 01:38:26 mrg Exp $	*/
+
+/*
+ * Copyright 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed for the NetBSD Project by
+ *	Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _DEV_PCI_PCIIO_H_
+#define	_DEV_PCI_PCIIO_H_
+
+/*
+ * User -> kernel interface for PCI bus access.
+ */
+
+#include <sys/ioccom.h>
+
+/*
+ * pciio_cfgreg:
+ *
+ *	Representation of a PCI config space register.
+ */
+struct pciio_cfgreg {
+	u_int	 reg;	/* offset into PCI configuration space */
+	uint32_t val;	/* value of the register */
+};
+
+/*
+ * Read and write PCI configuration space registers on a
+ * specific device.
+ */
+#define	PCI_IOC_CFGREAD		_IOWR('P', 0, struct pciio_cfgreg)
+#define	PCI_IOC_CFGWRITE	 _IOW('P', 1, struct pciio_cfgreg)
+
+/*
+ * pciio_bdf_cfgreg:
+ *
+ *	Like pciio_cfgreg, except for any bus/dev/func within
+ *	a given PCI domain.
+ */
+struct pciio_bdf_cfgreg {
+	u_int	bus;
+	u_int	device;
+	u_int	function;
+	struct pciio_cfgreg cfgreg;
+};
+
+/*
+ * Read and write PCI configuration space registers on any
+ * device within a given PCI domain.
+ */
+#define	PCI_IOC_BDF_CFGREAD	_IOWR('P', 2, struct pciio_bdf_cfgreg)
+#define	PCI_IOC_BDF_CFGWRITE	 _IOW('P', 3, struct pciio_bdf_cfgreg)
+
+/*
+ * pciio_businfo:
+ *
+ *	Information for a PCI bus (autoconfiguration node) instance.
+ */
+struct pciio_businfo {
+	u_int	busno;		/* bus number */
+	u_int	maxdevs;	/* max devices on bus */
+};
+
+#define	PCI_IOC_BUSINFO		 _IOR('P', 4, struct pciio_businfo)
+
+/*
+ * pciio_drvname:
+ *
+ *      Driver info for a PCI device (autoconfiguration node) instance.
+ *      Must be run on the correct bus.
+ */
+
+#define PCI_IO_DRVNAME_LEN	16
+struct pciio_drvname {
+	u_int	device;				/* in: device number */
+	u_int	function;			/* in: function number */
+	char	name[PCI_IO_DRVNAME_LEN];
+};
+
+#define	PCI_IOC_DRVNAME		_IOWR('P', 5, struct pciio_drvname)
+
+
+#if defined(__minix)
+struct pciio_map {
+	int	flags;		/* reserved, must be 0 */
+	u_int	phys_offset;
+	size_t	size;
+	int	readonly;
+	char	reserved[36];	/* reserved, must be 0 */
+	void	*vaddr;
+	void	*vaddr_ret;
+};
+
+#define	PCI_IOC_MAP		_IOWR('P', 100, struct pciio_map)
+#define	PCI_IOC_UNMAP		 _IOW('P', 101, struct pciio_map)
+
+struct pciio_acl {
+	u_int	domain;
+	u_int	bus;
+	u_int	device;
+	u_int	function;
+};
+
+#define	PCI_IOC_RESERVE		 _IOW('P', 102, struct pciio_acl)
+#define	PCI_IOC_RELEASE		 _IOW('P', 103, struct pciio_acl)
+#endif /* defined(__minix) */
+#endif /* _DEV_PCI_PCIIO_H_ */

Property changes on: lab4/.minix-src/include/dev/pci/pciio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/ia32intrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/ia32intrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/ia32intrin.h	(revision 13)
@@ -0,0 +1,101 @@
+/* ===-------- ia32intrin.h ---------------------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __X86INTRIN_H
+#error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+#ifndef __IA32INTRIN_H
+#define __IA32INTRIN_H
+
+#ifdef __x86_64__
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__readeflags(void)
+{
+  unsigned long long __res = 0;
+  __asm__ __volatile__ ("pushf\n\t"
+                        "popq %0\n"
+                        :"=r"(__res)
+                        :
+                        :
+                       );
+  return __res;
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+__writeeflags(unsigned long long __f)
+{
+  __asm__ __volatile__ ("pushq %0\n\t"
+                        "popf\n"
+                        :
+                        :"r"(__f)
+                        :"flags"
+                       );
+}
+
+#else /* !__x86_64__ */
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__readeflags(void)
+{
+  unsigned int __res = 0;
+  __asm__ __volatile__ ("pushf\n\t"
+                        "popl %0\n"
+                        :"=r"(__res)
+                        :
+                        :
+                       );
+  return __res;
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+__writeeflags(unsigned int __f)
+{
+  __asm__ __volatile__ ("pushl %0\n\t"
+                        "popf\n"
+                        :
+                        :"r"(__f)
+                        :"flags"
+                       );
+}
+#endif /* !__x86_64__ */
+
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__rdpmc(int __A) {
+  return __builtin_ia32_rdpmc(__A);
+}
+
+/* __rdtsc */
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__rdtsc(void) {
+  return __builtin_ia32_rdtsc();
+}
+
+/* __rdtscp */
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__rdtscp(unsigned int *__A) {
+  return __builtin_ia32_rdtscp(__A);
+}
+
+#define _rdtsc() __rdtsc()
+
+#endif /* __IA32INTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/ia32intrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/twereg.h
===================================================================
--- lab4/.minix-src/include/dev/pci/twereg.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/twereg.h	(revision 13)
@@ -0,0 +1,342 @@
+/*	$NetBSD: twereg.h,v 1.15 2008/09/08 23:36:54 gmcgarry Exp $	*/
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 2000 Michael Smith
+ * Copyright (c) 2000 BSDi
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from FreeBSD: twereg.h,v 1.1 2000/05/24 23:35:23 msmith Exp
+ */
+
+#ifndef _PCI_TWEREG_H_
+#define	_PCI_TWEREG_H_
+
+/* Board registers. */
+#define	TWE_REG_CTL			0x00
+#define	TWE_REG_STS			0x04
+#define	TWE_REG_CMD_QUEUE		0x08
+#define	TWE_REG_RESP_QUEUE		0x0c
+
+/* Control register bit definitions. */
+#define	TWE_CTL_CLEAR_HOST_INTR		0x00080000
+#define	TWE_CTL_CLEAR_ATTN_INTR		0x00040000
+#define	TWE_CTL_MASK_CMD_INTR		0x00020000
+#define	TWE_CTL_MASK_RESP_INTR		0x00010000
+#define	TWE_CTL_UNMASK_CMD_INTR		0x00008000
+#define	TWE_CTL_UNMASK_RESP_INTR	0x00004000
+#define	TWE_CTL_CLEAR_ERROR_STS		0x00000200
+#define	TWE_CTL_ISSUE_SOFT_RESET	0x00000100
+#define	TWE_CTL_ENABLE_INTRS		0x00000080
+#define	TWE_CTL_DISABLE_INTRS		0x00000040
+#define	TWE_CTL_ISSUE_HOST_INTR		0x00000020
+#define	TWE_CTL_CLEAR_PARITY_ERROR	0x00800000
+#define	TWE_CTL_CLEAR_PCI_ABORT		0x00100000
+
+/* Status register bit definitions. */
+#define	TWE_STS_MAJOR_VERSION_MASK	0xf0000000
+#define	TWE_STS_MINOR_VERSION_MASK	0x0f000000
+#define	TWE_STS_PCI_PARITY_ERROR	0x00800000
+#define	TWE_STS_QUEUE_ERROR		0x00400000
+#define	TWE_STS_MICROCONTROLLER_ERROR	0x00200000
+#define	TWE_STS_PCI_ABORT		0x00100000
+#define	TWE_STS_HOST_INTR		0x00080000
+#define	TWE_STS_ATTN_INTR		0x00040000
+#define	TWE_STS_CMD_INTR		0x00020000
+#define	TWE_STS_RESP_INTR		0x00010000
+#define	TWE_STS_CMD_QUEUE_FULL		0x00008000
+#define	TWE_STS_RESP_QUEUE_EMPTY	0x00004000
+#define	TWE_STS_MICROCONTROLLER_READY	0x00002000
+#define	TWE_STS_CMD_QUEUE_EMPTY		0x00001000
+
+#define	TWE_STS_ALL_INTRS		0x000f0000
+#define	TWE_STS_CLEARABLE_BITS		0x00d00000
+#define	TWE_STS_EXPECTED_BITS		0x00002000
+#define	TWE_STS_UNEXPECTED_BITS		0x00f80000
+
+/* Command packet opcodes. */
+#define TWE_OP_NOP			0x00
+#define TWE_OP_INIT_CONNECTION		0x01
+#define TWE_OP_READ			0x02
+#define TWE_OP_WRITE			0x03
+#define TWE_OP_READVERIFY		0x04
+#define TWE_OP_VERIFY			0x05
+#define TWE_OP_PROBE			0x06
+#define TWE_OP_PROBEUNIT		0x07
+#define TWE_OP_ZEROUNIT			0x08
+#define TWE_OP_REPLACEUNIT		0x09
+#define TWE_OP_HOTSWAP			0x0a
+#define TWE_OP_SETATAFEATURE		0x0c
+#define TWE_OP_FLUSH			0x0e
+#define TWE_OP_ABORT			0x0f
+#define TWE_OP_CHECKSTATUS		0x10
+#define	TWE_OP_ATA_PASSTHROUGH		0x11
+#define TWE_OP_GET_PARAM		0x12
+#define TWE_OP_SET_PARAM		0x13
+#define TWE_OP_CREATEUNIT		0x14
+#define TWE_OP_DELETEUNIT		0x15
+#define TWE_OP_REBUILDUNIT		0x17
+#define TWE_OP_SECTOR_INFO		0x1a
+#define TWE_OP_AEN_LISTEN		0x1c
+#define TWE_OP_CMD_PACKET		0x1d
+#define	TWE_OP_CMD_WITH_DATA		0x1f
+
+/* Response queue entries.  Masking and shifting yields request ID. */
+#define	TWE_RESP_MASK			0x00000ff0
+#define	TWE_RESP_SHIFT			4
+
+/* Miscellenous constants. */
+#define	TWE_ALIGNMENT			512
+#define	TWE_MAX_UNITS			16
+#define	TWE_INIT_CMD_PACKET_SIZE	0x3
+#define	TWE_SG_SIZE			62
+#define	TWE_MAX_CMDS			255
+#define	TWE_Q_START			0
+#define	TWE_UNIT_INFORMATION_TABLE_BASE	0x300
+#define	TWE_IOCTL			0x80
+#define	TWE_SECTOR_SIZE			512
+
+/* Scatter/gather block. */
+struct twe_sgb {
+	u_int32_t	tsg_address;
+	u_int32_t	tsg_length;
+} __packed;
+
+/*
+ * Command block.  This is 512 (really 508) bytes in size, and must be
+ * aligned on a 512 byte boundary.
+ */
+struct twe_cmd {
+	u_int8_t	tc_opcode;	/* high 3 bits is S/G list offset */
+	u_int8_t	tc_size;
+	u_int8_t	tc_cmdid;
+	u_int8_t	tc_unit;	/* high nybble is host ID */
+	u_int8_t	tc_status;
+	u_int8_t	tc_flags;
+	u_int16_t	tc_count;	/* block & param count, msg credits */
+	union {
+		struct {
+			u_int32_t	lba;
+			struct	twe_sgb sgl[TWE_SG_SIZE];
+		} io __packed;
+		struct {
+			struct	twe_sgb sgl[TWE_SG_SIZE];
+		} param;
+		struct {
+			u_int32_t	response_queue_pointer;
+		} init_connection  __packed;
+	} tc_args;
+	int32_t		tc_pad;
+} __packed;
+
+/* Get/set parameter block. */
+struct twe_param {
+	u_int16_t	tp_table_id;
+	u_int8_t	tp_param_id;
+	u_int8_t	tp_param_size;
+	u_int8_t	tp_data[1];
+} __packed;
+
+/*
+ * From 3ware's documentation:
+ *
+ *   All parameters maintained by the controller are grouped into related
+ *   tables.  Tables are are accessed indirectly via get and set parameter
+ *   commands.  To access a specific parameter in a table, the table ID and
+ *   parameter index are used to uniquely identify a parameter.  Table
+ *   0xffff is the directory table and provides a list of the table IDs and
+ *   sizes of all other tables.  Index zero in each table specifies the
+ *   entire table, and index one specifies the size of the table.  An entire
+ *   table can be read or set by using index zero.
+ */
+
+#define TWE_PARAM_PARAM_ALL	0
+#define TWE_PARAM_PARAM_SIZE	1
+
+#define TWE_PARAM_DIRECTORY			0xffff	/* size is 4 * number of tables */
+#define TWE_PARAM_DIRECTORY_TABLES		2	/* 16 bits * number of tables */
+#define TWE_PARAM_DIRECTORY_SIZES		3	/* 16 bits * number of tables */
+
+#define TWE_PARAM_DRIVESUMMARY			0x0002
+#define TWE_PARAM_DRIVESUMMARY_Num		2	/* number of physical drives [2] */
+#define TWE_PARAM_DRIVESUMMARY_Status		3	/* array giving drive status per aport */
+#define TWE_PARAM_DRIVESTATUS_Missing		0x00
+#define TWE_PARAM_DRIVESTATUS_NotSupp		0xfe
+#define TWE_PARAM_DRIVESTATUS_Present		0xff
+
+#define TWE_PARAM_UNITSUMMARY			0x0003
+#define TWE_PARAM_UNITSUMMARY_Num		2	/* number of logical units [2] */
+#define TWE_PARAM_UNITSUMMARY_Status		3	/* array giving unit status [16] */
+#define TWE_PARAM_UNITSTATUS_Online		(1<<0)
+#define TWE_PARAM_UNITSTATUS_Complete		(1<<1)
+#define TWE_PARAM_UNITSTATUS_MASK		0xfc
+#define TWE_PARAM_UNITSTATUS_Normal		0xfc
+#define TWE_PARAM_UNITSTATUS_Initialising	0xf4	/* cannot be incomplete */
+#define TWE_PARAM_UNITSTATUS_Degraded		0xec
+#define TWE_PARAM_UNITSTATUS_Rebuilding		0xdc	/* cannot be incomplete */
+#define TWE_PARAM_UNITSTATUS_Verifying		0xcc	/* cannot be incomplete */
+#define TWE_PARAM_UNITSTATUS_Corrupt		0xbc	/* cannot be complete */
+#define TWE_PARAM_UNITSTATUS_Missing		0x00	/* cannot be complete or online */
+
+#define TWE_PARAM_DRIVEINFO			0x0200	/* add drive number 0x00-0x0f XXX docco confused 0x0100 vs 0x0200 */
+#define TWE_PARAM_DRIVEINFO_Size		2	/* size in blocks [4] */
+#define TWE_PARAM_DRIVEINFO_Model		3	/* drive model string [40] */
+#define TWE_PARAM_DRIVEINFO_Serial		4	/* drive serial number [20] */
+#define TWE_PARAM_DRIVEINFO_PhysCylNum		5	/* physical geometry [2] */
+#define TWE_PARAM_DRIVEINFO_PhysHeadNum		6	/* [2] */
+#define TWE_PARAM_DRIVEINFO_PhysSectorNum	7	/* [2] */
+#define TWE_PARAM_DRIVEINFO_LogCylNum		8	/* logical geometry [2] */
+#define TWE_PARAM_DRIVEINFO_LogHeadNum		9	/* [2] */
+#define TWE_PARAM_DRIVEINFO_LogSectorNum	10	/* [2] */
+#define TWE_PARAM_DRIVEINFO_UnitNum		11	/* unit number this drive is associated with or 0xff [1] */
+#define TWE_PARAM_DRIVEINFO_DriveFlags		12	/* N/A [1] */
+
+#define TWE_PARAM_APORTTIMEOUT			0x02c0	/* add (aport_number * 3) to parameter index */
+#define TWE_PARAM_APORTTIMEOUT_READ		2	/* read timeouts last 24hrs [2] */
+#define TWE_PARAM_APORTTIMEOUT_WRITE		3	/* write timeouts last 24hrs [2] */
+#define TWE_PARAM_APORTTIMEOUT_DEGRADE		4	/* degrade threshold [2] */
+
+#define TWE_PARAM_UNITINFO			0x0300	/* add unit number 0x00-0x0f */
+#define TWE_PARAM_UNITINFO_Number		2	/* unit number [1] */
+#define TWE_PARAM_UNITINFO_Status		3	/* unit status [1] */
+#define TWE_PARAM_UNITINFO_Capacity		4	/* unit capacity in blocks [4] */
+#define TWE_PARAM_UNITINFO_DescriptorSize	5	/* unit descriptor size + 3 bytes [2] */
+#define TWE_PARAM_UNITINFO_Descriptor		6	/* unit descriptor, TWE_UnitDescriptor or TWE_Array_Descriptor */
+#define TWE_PARAM_UNITINFO_Flags		7	/* unit flags [1] */
+#define TWE_PARAM_UNITFLAGS_WCE			(1<<0)
+
+#define TWE_PARAM_AEN				0x0401
+#define TWE_PARAM_AEN_UnitCode			2	/* (unit number << 8) | AEN code [2] */
+#define TWE_AEN_QUEUE_EMPTY			0x00
+#define TWE_AEN_SOFT_RESET			0x01
+#define TWE_AEN_DEGRADED_MIRROR			0x02	/* reports unit */
+#define TWE_AEN_CONTROLLER_ERROR		0x03
+#define TWE_AEN_REBUILD_FAIL			0x04	/* reports unit */
+#define TWE_AEN_REBUILD_DONE			0x05	/* reports unit */
+#define TWE_AEN_INCOMP_UNIT			0x06	/* reports unit */
+#define TWE_AEN_INIT_DONE			0x07	/* reports unit */
+#define TWE_AEN_UNCLEAN_SHUTDOWN		0x08	/* reports unit */
+#define TWE_AEN_APORT_TIMEOUT			0x09	/* reports unit, rate limited to 1 per 2^16 errors */
+#define TWE_AEN_DRIVE_ERROR			0x0a	/* reports unit */
+#define TWE_AEN_REBUILD_STARTED			0x0b	/* reports unit */
+#define TWE_AEN_QUEUE_FULL			0xff
+#define TWE_AEN_TABLE_UNDEFINED			0x15
+#define TWE_AEN_CODE(x)				((x) & 0xff)
+#define TWE_AEN_UNIT(x)				((x) >> 8)
+
+#define TWE_PARAM_VERSION			0x0402
+#define TWE_PARAM_VERSION_Mon			2	/* monitor version [16] */
+#define TWE_PARAM_VERSION_FW			3	/* firmware version [16] */
+#define TWE_PARAM_VERSION_BIOS			4	/* BIOSs version [16] */
+#define TWE_PARAM_VERSION_PCB			5	/* PCB version [8] */
+#define TWE_PARAM_VERSION_ATA			6	/* A-chip version [8] */
+#define TWE_PARAM_VERSION_PCI			7	/* P-chip version [8] */
+#define TWE_PARAM_VERSION_CtrlModel		8	/* N/A */
+#define TWE_PARAM_VERSION_CtrlSerial		9	/* N/A */
+#define TWE_PARAM_VERSION_SBufSize		10	/* N/A */
+#define TWE_PARAM_VERSION_CompCode		11	/* compatibility code [4] */
+
+#define TWE_PARAM_CONTROLLER			0x0403
+#define TWE_PARAM_CONTROLLER_DCBSectors		2	/* # sectors reserved for DCB per drive [2] */
+#define TWE_PARAM_CONTROLLER_PortCount		3	/* number of drive ports [1] */
+
+#define TWE_PARAM_FEATURES			0x404
+#define TWE_PARAM_FEATURES_DriverShutdown	2	/* set to 1 if driver supports shutdown notification [1] */
+
+#define TWE_PARAM_PROC				0x406
+#define TWE_PARAM_PROC_PERCENT			2	/* Per-sub-unit % complete of init/verify/rebuild or 0xff [16] */
+
+struct twe_unit_descriptor {
+	u_int8_t	num_subunits;	/* must be zero */
+	u_int8_t	configuration;
+#define TWE_UD_CONFIG_CBOD	0x0c	/* JBOD with DCB, used for mirrors */
+#define TWE_UD_CONFIG_SPARE	0x0d	/* same as CBOD, but firmware will use as spare */
+#define TWE_UD_CONFIG_SUBUNIT	0x0e	/* drive is a subunit in an array */
+#define TWE_UD_CONFIG_JBOD	0x0f	/* plain drive */
+	u_int8_t	phys_drv_num;	/* may be 0xff if port can't be determined at runtime */
+	u_int8_t	log_drv_num;	/* must be zero for configuration == 0x0f */
+	u_int32_t	start_lba;
+	u_int32_t	block_count;	/* actual drive size if configuration == 0x0f, otherwise less DCB size */
+} __packed;
+
+struct twe_mirror_descriptor {
+	u_int8_t	flag;			/* must be 0xff */
+	u_int8_t	res1;
+	u_int8_t	mirunit_status[4];	/* bitmap of functional subunits in each mirror */
+	u_int8_t	res2[6];
+} __packed;
+
+struct twe_array_descriptor {
+	u_int8_t	num_subunits;	/* number of subunits, or number of mirror units in RAID10 */
+	u_int8_t	configuration;
+#define TWE_AD_CONFIG_RAID0	0x00
+#define TWE_AD_CONFIG_RAID1	0x01
+#define TWE_AD_CONFIG_TwinStor	0x02
+#define TWE_AD_CONFIG_RAID5	0x05
+#define TWE_AD_CONFIG_RAID10	0x06
+	u_int8_t		stripe_size;
+#define TWE_AD_STRIPE_4k	0x03
+#define TWE_AD_STRIPE_8k	0x04
+#define TWE_AD_STRIPE_16k	0x05
+#define TWE_AD_STRIPE_32k	0x06
+#define TWE_AD_STRIPE_64k	0x07
+#define TWE_AD_STRIPE_128k	0x08
+#define TWE_AD_STRIPE_256k	0x09
+#define TWE_AD_STRIPE_512k	0x0a
+#define TWE_AD_STRIPE_1024k	0x0b
+	u_int8_t		log_drv_status;	/* bitmap of functional subunits, or mirror units in RAID10 */
+	u_int32_t		start_lba;
+	u_int32_t		block_count;	/* actual drive size if configuration == 0x0f, otherwise less DCB size */
+	struct twe_unit_descriptor	subunit[1];
+} __packed;
+
+#endif	/* !_PCI_TWEREG_H_ */

Property changes on: lab4/.minix-src/include/dev/pci/twereg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/mm_malloc.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/mm_malloc.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/mm_malloc.h	(revision 13)
@@ -0,0 +1,75 @@
+/*===---- mm_malloc.h - Allocating and Freeing Aligned Memory Blocks -------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __MM_MALLOC_H
+#define __MM_MALLOC_H
+
+#include <stdlib.h>
+
+#ifdef _WIN32
+#include <malloc.h>
+#else
+#ifndef __cplusplus
+extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
+#else
+// Some systems (e.g. those with GNU libc) declare posix_memalign with an
+// exception specifier. Via an "egregious workaround" in
+// Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid
+// redeclaration of glibc's declaration.
+extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
+#endif
+#endif
+
+#if !(defined(_WIN32) && defined(_mm_malloc))
+static __inline__ void *__attribute__((__always_inline__, __nodebug__,
+                                       __malloc__))
+_mm_malloc(size_t __size, size_t __align)
+{
+  if (__align == 1) {
+    return malloc(__size);
+  }
+
+  if (!(__align & (__align - 1)) && __align < sizeof(void *))
+    __align = sizeof(void *);
+
+  void *__mallocedMemory;
+#if defined(__MINGW32__)
+  __mallocedMemory = __mingw_aligned_malloc(__size, __align);
+#elif defined(_WIN32)
+  __mallocedMemory = _aligned_malloc(__size, __align);
+#else
+  if (posix_memalign(&__mallocedMemory, __align, __size))
+    return 0;
+#endif
+
+  return __mallocedMemory;
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_free(void *__p)
+{
+  free(__p);
+}
+#endif
+
+#endif /* __MM_MALLOC_H */

Property changes on: lab4/.minix-src/include/clang-3.6/mm_malloc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/bufferevent.h
===================================================================
--- lab4/.minix-src/include/event2/bufferevent.h	(nonexistent)
+++ lab4/.minix-src/include/event2/bufferevent.h	(revision 13)
@@ -0,0 +1,823 @@
+/*	$NetBSD: bufferevent.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*	$NetBSD: bufferevent.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_BUFFEREVENT_H_
+#define _EVENT2_BUFFEREVENT_H_
+
+/**
+   @file event2/bufferevent.h
+
+  Functions for buffering data for network sending or receiving.  Bufferevents
+  are higher level than evbuffers: each has an underlying evbuffer for reading
+  and one for writing, and callbacks that are invoked under certain
+  circumstances.
+
+  A bufferevent provides input and output buffers that get filled and
+  drained automatically.  The user of a bufferevent no longer deals
+  directly with the I/O, but instead is reading from input and writing
+  to output buffers.
+
+  Once initialized, the bufferevent structure can be used repeatedly
+  with bufferevent_enable() and bufferevent_disable().
+
+  When reading is enabled, the bufferevent will try to read from the
+  file descriptor onto its input buffer, and call the read callback.
+  When writing is enabled, the bufferevent will try to write data onto its
+  file descriptor when the output buffer has enough data, and call the write
+  callback when the output buffer is sufficiently drained.
+
+  Bufferevents come in several flavors, including:
+
+  <dl>
+    <dt>Socket-based bufferevents</dt>
+      <dd>A bufferevent that reads and writes data onto a network
+          socket. Created with bufferevent_socket_new().</dd>
+
+    <dt>Paired bufferevents</dt>
+      <dd>A pair of bufferevents that send and receive data to one
+          another without touching the network.  Created with
+          bufferevent_pair_new().</dd>
+
+    <dt>Filtering bufferevents</dt>
+       <dd>A bufferevent that transforms data, and sends or receives it
+          over another underlying bufferevent.  Created with
+          bufferevent_filter_new().</dd>
+
+    <dt>SSL-backed bufferevents</dt>
+      <dd>A bufferevent that uses the openssl library to send and
+          receive data over an encrypted connection. Created with
+	  bufferevent_openssl_socket_new() or
+	  bufferevent_openssl_filter_new().</dd>
+  </dl>
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+/* For int types. */
+#include <event2/util.h>
+
+/** @name Bufferevent event codes
+
+    These flags are passed as arguments to a bufferevent's event callback.
+
+    @{
+*/
+#define BEV_EVENT_READING	0x01	/**< error encountered while reading */
+#define BEV_EVENT_WRITING	0x02	/**< error encountered while writing */
+#define BEV_EVENT_EOF		0x10	/**< eof file reached */
+#define BEV_EVENT_ERROR		0x20	/**< unrecoverable error encountered */
+#define BEV_EVENT_TIMEOUT	0x40	/**< user-specified timeout reached */
+#define BEV_EVENT_CONNECTED	0x80	/**< connect operation finished. */
+/**@}*/
+
+/**
+   An opaque type for handling buffered IO
+
+   @see event2/bufferevent.h
+ */
+struct bufferevent
+#ifdef _EVENT_IN_DOXYGEN
+{}
+#endif
+;
+struct event_base;
+struct evbuffer;
+struct sockaddr;
+
+/**
+   A read or write callback for a bufferevent.
+
+   The read callback is triggered when new data arrives in the input
+   buffer and the amount of readable data exceed the low watermark
+   which is 0 by default.
+
+   The write callback is triggered if the write buffer has been
+   exhausted or fell below its low watermark.
+
+   @param bev the bufferevent that triggered the callback
+   @param ctx the user-specified context for this bufferevent
+ */
+typedef void (*bufferevent_data_cb)(struct bufferevent *bev, void *ctx);
+
+/**
+   An event/error callback for a bufferevent.
+
+   The event callback is triggered if either an EOF condition or another
+   unrecoverable error was encountered.
+
+   @param bev the bufferevent for which the error condition was reached
+   @param what a conjunction of flags: BEV_EVENT_READING or BEV_EVENT_WRITING
+	  to indicate if the error was encountered on the read or write path,
+	  and one of the following flags: BEV_EVENT_EOF, BEV_EVENT_ERROR,
+	  BEV_EVENT_TIMEOUT, BEV_EVENT_CONNECTED.
+
+   @param ctx the user-specified context for this bufferevent
+*/
+typedef void (*bufferevent_event_cb)(struct bufferevent *bev, short what, void *ctx);
+
+/** Options that can be specified when creating a bufferevent */
+enum bufferevent_options {
+	/** If set, we close the underlying file
+	 * descriptor/bufferevent/whatever when this bufferevent is freed. */
+	BEV_OPT_CLOSE_ON_FREE = (1<<0),
+
+	/** If set, and threading is enabled, operations on this bufferevent
+	 * are protected by a lock */
+	BEV_OPT_THREADSAFE = (1<<1),
+
+	/** If set, callbacks are run deferred in the event loop. */
+	BEV_OPT_DEFER_CALLBACKS = (1<<2),
+
+	/** If set, callbacks are executed without locks being held on the
+	* bufferevent.  This option currently requires that
+	* BEV_OPT_DEFER_CALLBACKS also be set; a future version of Libevent
+	* might remove the requirement.*/
+	BEV_OPT_UNLOCK_CALLBACKS = (1<<3)
+};
+
+/**
+  Create a new socket bufferevent over an existing socket.
+
+  @param base the event base to associate with the new bufferevent.
+  @param fd the file descriptor from which data is read and written to.
+	    This file descriptor is not allowed to be a pipe(2).
+	    It is safe to set the fd to -1, so long as you later
+	    set it with bufferevent_setfd or bufferevent_socket_connect().
+  @param options Zero or more BEV_OPT_* flags
+  @return a pointer to a newly allocated bufferevent struct, or NULL if an
+	  error occurred
+  @see bufferevent_free()
+  */
+struct bufferevent *bufferevent_socket_new(struct event_base *base, evutil_socket_t fd, int options);
+
+/**
+   Launch a connect() attempt with a socket-based bufferevent.
+
+   When the connect succeeds, the eventcb will be invoked with
+   BEV_EVENT_CONNECTED set.
+
+   If the bufferevent does not already have a socket set, we allocate a new
+   socket here and make it nonblocking before we begin.
+
+   If no address is provided, we assume that the socket is already connecting,
+   and configure the bufferevent so that a BEV_EVENT_CONNECTED event will be
+   yielded when it is done connecting.
+
+   @param bufev an existing bufferevent allocated with
+       bufferevent_socket_new().
+   @param addr the address we should connect to
+   @param socklen The length of the address
+   @return 0 on success, -1 on failure.
+ */
+int bufferevent_socket_connect(struct bufferevent *, struct sockaddr *, int);
+
+struct evdns_base;
+/**
+   Resolve the hostname 'hostname' and connect to it as with
+   bufferevent_socket_connect().
+
+   @param bufev An existing bufferevent allocated with bufferevent_socket_new()
+   @param evdns_base Optionally, an evdns_base to use for resolving hostnames
+      asynchronously. May be set to NULL for a blocking resolve.
+   @param family A preferred address family to resolve addresses to, or
+      AF_UNSPEC for no preference.  Only AF_INET, AF_INET6, and AF_UNSPEC are
+      supported.
+   @param hostname The hostname to resolve; see below for notes on recognized
+      formats
+   @param port The port to connect to on the resolved address.
+   @return 0 if successful, -1 on failure.
+
+   Recognized hostname formats are:
+
+       www.example.com	(hostname)
+       1.2.3.4		(ipv4address)
+       ::1		(ipv6address)
+       [::1]		([ipv6address])
+
+   Performance note: If you do not provide an evdns_base, this function
+   may block while it waits for a DNS response.	 This is probably not
+   what you want.
+ */
+int bufferevent_socket_connect_hostname(struct bufferevent *,
+    struct evdns_base *, int, const char *, int);
+
+/**
+   Return the error code for the last failed DNS lookup attempt made by
+   bufferevent_socket_connect_hostname().
+
+   @param bev The bufferevent object.
+   @return DNS error code.
+   @see evutil_gai_strerror()
+*/
+int bufferevent_socket_get_dns_error(struct bufferevent *bev);
+
+/**
+  Assign a bufferevent to a specific event_base.
+
+  NOTE that only socket bufferevents support this function.
+
+  @param base an event_base returned by event_init()
+  @param bufev a bufferevent struct returned by bufferevent_new()
+     or bufferevent_socket_new()
+  @return 0 if successful, or -1 if an error occurred
+  @see bufferevent_new()
+ */
+int bufferevent_base_set(struct event_base *base, struct bufferevent *bufev);
+
+/**
+   Return the event_base used by a bufferevent
+*/
+struct event_base *bufferevent_get_base(struct bufferevent *bev);
+
+/**
+  Assign a priority to a bufferevent.
+
+  Only supported for socket bufferevents.
+
+  @param bufev a bufferevent struct
+  @param pri the priority to be assigned
+  @return 0 if successful, or -1 if an error occurred
+  */
+int bufferevent_priority_set(struct bufferevent *bufev, int pri);
+
+
+/**
+  Deallocate the storage associated with a bufferevent structure.
+
+  @param bufev the bufferevent structure to be freed.
+  */
+void bufferevent_free(struct bufferevent *bufev);
+
+
+/**
+  Changes the callbacks for a bufferevent.
+
+  @param bufev the bufferevent object for which to change callbacks
+  @param readcb callback to invoke when there is data to be read, or NULL if
+	 no callback is desired
+  @param writecb callback to invoke when the file descriptor is ready for
+	 writing, or NULL if no callback is desired
+  @param eventcb callback to invoke when there is an event on the file
+	 descriptor
+  @param cbarg an argument that will be supplied to each of the callbacks
+	 (readcb, writecb, and errorcb)
+  @see bufferevent_new()
+  */
+void bufferevent_setcb(struct bufferevent *bufev,
+    bufferevent_data_cb readcb, bufferevent_data_cb writecb,
+    bufferevent_event_cb eventcb, void *cbarg);
+
+/**
+  Changes the file descriptor on which the bufferevent operates.
+  Not supported for all bufferevent types.
+
+  @param bufev the bufferevent object for which to change the file descriptor
+  @param fd the file descriptor to operate on
+*/
+int bufferevent_setfd(struct bufferevent *bufev, evutil_socket_t fd);
+
+/**
+   Returns the file descriptor associated with a bufferevent, or -1 if
+   no file descriptor is associated with the bufferevent.
+ */
+evutil_socket_t bufferevent_getfd(struct bufferevent *bufev);
+
+/**
+   Returns the underlying bufferevent associated with a bufferevent (if
+   the bufferevent is a wrapper), or NULL if there is no underlying bufferevent.
+ */
+struct bufferevent *bufferevent_get_underlying(struct bufferevent *bufev);
+
+/**
+  Write data to a bufferevent buffer.
+
+  The bufferevent_write() function can be used to write data to the file
+  descriptor.  The data is appended to the output buffer and written to the
+  descriptor automatically as it becomes available for writing.
+
+  @param bufev the bufferevent to be written to
+  @param data a pointer to the data to be written
+  @param size the length of the data, in bytes
+  @return 0 if successful, or -1 if an error occurred
+  @see bufferevent_write_buffer()
+  */
+int bufferevent_write(struct bufferevent *bufev,
+    const void *data, size_t size);
+
+
+/**
+  Write data from an evbuffer to a bufferevent buffer.	The evbuffer is
+  being drained as a result.
+
+  @param bufev the bufferevent to be written to
+  @param buf the evbuffer to be written
+  @return 0 if successful, or -1 if an error occurred
+  @see bufferevent_write()
+ */
+int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer *buf);
+
+
+/**
+  Read data from a bufferevent buffer.
+
+  The bufferevent_read() function is used to read data from the input buffer.
+
+  @param bufev the bufferevent to be read from
+  @param data pointer to a buffer that will store the data
+  @param size the size of the data buffer, in bytes
+  @return the amount of data read, in bytes.
+ */
+size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size);
+
+/**
+  Read data from a bufferevent buffer into an evbuffer.	 This avoids
+  memory copies.
+
+  @param bufev the bufferevent to be read from
+  @param buf the evbuffer to which to add data
+  @return 0 if successful, or -1 if an error occurred.
+ */
+int bufferevent_read_buffer(struct bufferevent *bufev, struct evbuffer *buf);
+
+/**
+   Returns the input buffer.
+
+   The user MUST NOT set the callback on this buffer.
+
+   @param bufev the bufferevent from which to get the evbuffer
+   @return the evbuffer object for the input buffer
+ */
+
+struct evbuffer *bufferevent_get_input(struct bufferevent *bufev);
+
+/**
+   Returns the output buffer.
+
+   The user MUST NOT set the callback on this buffer.
+
+   When filters are being used, the filters need to be manually
+   triggered if the output buffer was manipulated.
+
+   @param bufev the bufferevent from which to get the evbuffer
+   @return the evbuffer object for the output buffer
+ */
+
+struct evbuffer *bufferevent_get_output(struct bufferevent *bufev);
+
+/**
+  Enable a bufferevent.
+
+  @param bufev the bufferevent to be enabled
+  @param event any combination of EV_READ | EV_WRITE.
+  @return 0 if successful, or -1 if an error occurred
+  @see bufferevent_disable()
+ */
+int bufferevent_enable(struct bufferevent *bufev, short event);
+
+/**
+  Disable a bufferevent.
+
+  @param bufev the bufferevent to be disabled
+  @param event any combination of EV_READ | EV_WRITE.
+  @return 0 if successful, or -1 if an error occurred
+  @see bufferevent_enable()
+ */
+int bufferevent_disable(struct bufferevent *bufev, short event);
+
+/**
+   Return the events that are enabled on a given bufferevent.
+
+   @param bufev the bufferevent to inspect
+   @return A combination of EV_READ | EV_WRITE
+ */
+short bufferevent_get_enabled(struct bufferevent *bufev);
+
+/**
+  Set the read and write timeout for a bufferevent.
+
+  A bufferevent's timeout will fire the first time that the indicated
+  amount of time has elapsed since a successful read or write operation,
+  during which the bufferevent was trying to read or write.
+
+  (In other words, if reading or writing is disabled, or if the
+  bufferevent's read or write operation has been suspended because
+  there's no data to write, or not enough banwidth, or so on, the
+  timeout isn't active.  The timeout only becomes active when we we're
+  willing to actually read or write.)
+
+  Calling bufferevent_enable or setting a timeout for a bufferevent
+  whose timeout is already pending resets its timeout.
+
+  If the timeout elapses, the corresponding operation (EV_READ or
+  EV_WRITE) becomes disabled until you re-enable it again.  The
+  bufferevent's event callback is called with the
+  BEV_EVENT_TIMEOUT|BEV_EVENT_READING or
+  BEV_EVENT_TIMEOUT|BEV_EVENT_WRITING.
+
+  @param bufev the bufferevent to be modified
+  @param timeout_read the read timeout, or NULL
+  @param timeout_write the write timeout, or NULL
+ */
+int bufferevent_set_timeouts(struct bufferevent *bufev,
+    const struct timeval *timeout_read, const struct timeval *timeout_write);
+
+/**
+  Sets the watermarks for read and write events.
+
+  On input, a bufferevent does not invoke the user read callback unless
+  there is at least low watermark data in the buffer.	If the read buffer
+  is beyond the high watermark, the bufferevent stops reading from the network.
+
+  On output, the user write callback is invoked whenever the buffered data
+  falls below the low watermark.  Filters that write to this bufev will try
+  not to write more bytes to this buffer than the high watermark would allow,
+  except when flushing.
+
+  @param bufev the bufferevent to be modified
+  @param events EV_READ, EV_WRITE or both
+  @param lowmark the lower watermark to set
+  @param highmark the high watermark to set
+*/
+
+void bufferevent_setwatermark(struct bufferevent *bufev, short events,
+    size_t lowmark, size_t highmark);
+
+/**
+   Acquire the lock on a bufferevent.  Has no effect if locking was not
+   enabled with BEV_OPT_THREADSAFE.
+ */
+void bufferevent_lock(struct bufferevent *bufev);
+
+/**
+   Release the lock on a bufferevent.  Has no effect if locking was not
+   enabled with BEV_OPT_THREADSAFE.
+ */
+void bufferevent_unlock(struct bufferevent *bufev);
+
+/**
+   Flags that can be passed into filters to let them know how to
+   deal with the incoming data.
+*/
+enum bufferevent_flush_mode {
+	/** usually set when processing data */
+	BEV_NORMAL = 0,
+
+	/** want to checkpoint all data sent. */
+	BEV_FLUSH = 1,
+
+	/** encountered EOF on read or done sending data */
+	BEV_FINISHED = 2
+};
+
+/**
+   Triggers the bufferevent to produce more data if possible.
+
+   @param bufev the bufferevent object
+   @param iotype either EV_READ or EV_WRITE or both.
+   @param mode either BEV_NORMAL or BEV_FLUSH or BEV_FINISHED
+   @return -1 on failure, 0 if no data was produces, 1 if data was produced
+ */
+int bufferevent_flush(struct bufferevent *bufev,
+    short iotype,
+    enum bufferevent_flush_mode mode);
+
+/**
+   @name Filtering support
+
+   @{
+*/
+/**
+   Values that filters can return.
+ */
+enum bufferevent_filter_result {
+	/** everything is okay */
+	BEV_OK = 0,
+
+	/** the filter needs to read more data before output */
+	BEV_NEED_MORE = 1,
+
+	/** the filter encountered a critical error, no further data
+	    can be processed. */
+	BEV_ERROR = 2
+};
+
+/** A callback function to implement a filter for a bufferevent.
+
+    @param src An evbuffer to drain data from.
+    @param dst An evbuffer to add data to.
+    @param limit A suggested upper bound of bytes to write to dst.
+       The filter may ignore this value, but doing so means that
+       it will overflow the high-water mark associated with dst.
+       -1 means "no limit".
+    @param mode Whether we should write data as may be convenient
+       (BEV_NORMAL), or flush as much data as we can (BEV_FLUSH),
+       or flush as much as we can, possibly including an end-of-stream
+       marker (BEV_FINISH).
+    @param ctx A user-supplied pointer.
+
+    @return BEV_OK if we wrote some data; BEV_NEED_MORE if we can't
+       produce any more output until we get some input; and BEV_ERROR
+       on an error.
+ */
+typedef enum bufferevent_filter_result (*bufferevent_filter_cb)(
+    struct evbuffer *src, struct evbuffer *dst, ev_ssize_t dst_limit,
+    enum bufferevent_flush_mode mode, void *ctx);
+
+/**
+   Allocate a new filtering bufferevent on top of an existing bufferevent.
+
+   @param underlying the underlying bufferevent.
+   @param input_filter The filter to apply to data we read from the underlying
+     bufferevent
+   @param output_filter The filer to apply to data we write to the underlying
+     bufferevent
+   @param options A bitfield of bufferevent options.
+   @param free_context A function to use to free the filter context when
+     this bufferevent is freed.
+   @param ctx A context pointer to pass to the filter functions.
+ */
+struct bufferevent *
+bufferevent_filter_new(struct bufferevent *underlying,
+		       bufferevent_filter_cb input_filter,
+		       bufferevent_filter_cb output_filter,
+		       int options,
+		       void (*free_context)(void *),
+		       void *ctx);
+/**@}*/
+
+/**
+   Allocate a pair of linked bufferevents.  The bufferevents behave as would
+   two bufferevent_sock instances connected to opposite ends of a
+   socketpair(), except that no internal socketpair is allocated.
+
+   @param base The event base to associate with the socketpair.
+   @param options A set of options for this bufferevent
+   @param pair A pointer to an array to hold the two new bufferevent objects.
+   @return 0 on success, -1 on failure.
+ */
+int bufferevent_pair_new(struct event_base *base, int options,
+    struct bufferevent *pair[2]);
+
+/**
+   Given one bufferevent returned by bufferevent_pair_new(), returns the
+   other one if it still exists.  Otherwise returns NULL.
+ */
+struct bufferevent *bufferevent_pair_get_partner(struct bufferevent *bev);
+
+/**
+   Abstract type used to configure rate-limiting on a bufferevent or a group
+   of bufferevents.
+ */
+struct ev_token_bucket_cfg;
+
+/**
+   A group of bufferevents which are configured to respect the same rate
+   limit.
+*/
+struct bufferevent_rate_limit_group;
+
+/** Maximum configurable rate- or burst-limit. */
+#define EV_RATE_LIMIT_MAX EV_SSIZE_MAX
+
+/**
+   Initialize and return a new object to configure the rate-limiting behavior
+   of bufferevents.
+
+   @param read_rate The maximum number of bytes to read per tick on
+     average.
+   @param read_burst The maximum number of bytes to read in any single tick.
+   @param write_rate The maximum number of bytes to write per tick on
+     average.
+   @param write_burst The maximum number of bytes to write in any single tick.
+   @param tick_len The length of a single tick.	 Defaults to one second.
+     Any fractions of a millisecond are ignored.
+
+   Note that all rate-limits hare are currently best-effort: future versions
+   of Libevent may implement them more tightly.
+ */
+struct ev_token_bucket_cfg *ev_token_bucket_cfg_new(
+	size_t read_rate, size_t read_burst,
+	size_t write_rate, size_t write_burst,
+	const struct timeval *tick_len);
+
+/** Free all storage held in 'cfg'.
+
+    Note: 'cfg' is not currently reference-counted; it is not safe to free it
+    until no bufferevent is using it.
+ */
+void ev_token_bucket_cfg_free(struct ev_token_bucket_cfg *cfg);
+
+/**
+   Set the rate-limit of a the bufferevent 'bev' to the one specified in
+   'cfg'.  If 'cfg' is NULL, disable any per-bufferevent rate-limiting on
+   'bev'.
+
+   Note that only some bufferevent types currently respect rate-limiting.
+   They are: socket-based bufferevents (normal and IOCP-based), and SSL-based
+   bufferevents.
+
+   Return 0 on sucess, -1 on failure.
+ */
+int bufferevent_set_rate_limit(struct bufferevent *bev,
+    struct ev_token_bucket_cfg *cfg);
+
+/**
+   Create a new rate-limit group for bufferevents.  A rate-limit group
+   constrains the maximum number of bytes sent and received, in toto,
+   by all of its bufferevents.
+
+   @param base An event_base to run any necessary timeouts for the group.
+      Note that all bufferevents in the group do not necessarily need to share
+      this event_base.
+   @param cfg The rate-limit for this group.
+
+   Note that all rate-limits hare are currently best-effort: future versions
+   of Libevent may implement them more tightly.
+
+   Note also that only some bufferevent types currently respect rate-limiting.
+   They are: socket-based bufferevents (normal and IOCP-based), and SSL-based
+   bufferevents.
+ */
+struct bufferevent_rate_limit_group *bufferevent_rate_limit_group_new(
+	struct event_base *base,
+	const struct ev_token_bucket_cfg *cfg);
+/**
+   Change the rate-limiting settings for a given rate-limiting group.
+
+   Return 0 on success, -1 on failure.
+*/
+int bufferevent_rate_limit_group_set_cfg(
+	struct bufferevent_rate_limit_group *,
+	const struct ev_token_bucket_cfg *);
+
+/**
+   Change the smallest quantum we're willing to allocate to any single
+   bufferevent in a group for reading or writing at a time.
+
+   The rationale is that, because of TCP/IP protocol overheads and kernel
+   behavior, if a rate-limiting group is so tight on bandwidth that you're
+   only willing to send 1 byte per tick per bufferevent, you might instead
+   want to batch up the reads and writes so that you send N bytes per
+   1/N of the bufferevents (chosen at random) each tick, so you still wind
+   up send 1 byte per tick per bufferevent on average, but you don't send
+   so many tiny packets.
+
+   The default min-share is currently 64 bytes.
+
+   Returns 0 on success, -1 on faulre.
+ */
+int bufferevent_rate_limit_group_set_min_share(
+	struct bufferevent_rate_limit_group *, size_t);
+
+/**
+   Free a rate-limiting group.  The group must have no members when
+   this function is called.
+*/
+void bufferevent_rate_limit_group_free(struct bufferevent_rate_limit_group *);
+
+/**
+   Add 'bev' to the list of bufferevents whose aggregate reading and writing
+   is restricted by 'g'.  If 'g' is NULL, remove 'bev' from its current group.
+
+   A bufferevent may belong to no more than one rate-limit group at a time.
+   If 'bev' is already a member of a group, it will be removed from its old
+   group before being added to 'g'.
+
+   Return 0 on success and -1 on failure.
+ */
+int bufferevent_add_to_rate_limit_group(struct bufferevent *bev,
+    struct bufferevent_rate_limit_group *g);
+
+/** Remove 'bev' from its current rate-limit group (if any). */
+int bufferevent_remove_from_rate_limit_group(struct bufferevent *bev);
+
+/**
+   @name Rate limit inspection
+
+   Return the current read or write bucket size for a bufferevent.
+   If it is not configured with a per-bufferevent ratelimit, return
+   EV_SSIZE_MAX.  This function does not inspect the group limit, if any.
+   Note that it can return a negative value if the bufferevent has been
+   made to read or write more than its limit.
+
+   @{
+ */
+ev_ssize_t bufferevent_get_read_limit(struct bufferevent *bev);
+ev_ssize_t bufferevent_get_write_limit(struct bufferevent *bev);
+/*@}*/
+
+ev_ssize_t bufferevent_get_max_to_read(struct bufferevent *bev);
+ev_ssize_t bufferevent_get_max_to_write(struct bufferevent *bev);
+
+/**
+   @name Group Rate limit inspection
+
+   Return the read or write bucket size for a bufferevent rate limit
+   group.  Note that it can return a negative value if bufferevents in
+   the group have been made to read or write more than their limits.
+
+   @{
+ */
+ev_ssize_t bufferevent_rate_limit_group_get_read_limit(
+	struct bufferevent_rate_limit_group *);
+ev_ssize_t bufferevent_rate_limit_group_get_write_limit(
+	struct bufferevent_rate_limit_group *);
+/*@}*/
+
+/**
+   @name Rate limit manipulation
+
+   Subtract a number of bytes from a bufferevent's read or write bucket.
+   The decrement value can be negative, if you want to manually refill
+   the bucket.	If the change puts the bucket above or below zero, the
+   bufferevent will resume or suspend reading writing as appropriate.
+   These functions make no change in the buckets for the bufferevent's
+   group, if any.
+
+   Returns 0 on success, -1 on internal error.
+
+   @{
+ */
+int bufferevent_decrement_read_limit(struct bufferevent *bev, ev_ssize_t decr);
+int bufferevent_decrement_write_limit(struct bufferevent *bev, ev_ssize_t decr);
+/*@}*/
+
+/**
+   @name Group rate limit manipulation
+
+   Subtract a number of bytes from a bufferevent rate-limiting group's
+   read or write bucket.  The decrement value can be negative, if you
+   want to manually refill the bucket.	If the change puts the bucket
+   above or below zero, the bufferevents in the group will resume or
+   suspend reading writing as appropriate.
+
+   Returns 0 on success, -1 on internal error.
+
+   @{
+ */
+int bufferevent_rate_limit_group_decrement_read(
+	struct bufferevent_rate_limit_group *, ev_ssize_t);
+int bufferevent_rate_limit_group_decrement_write(
+	struct bufferevent_rate_limit_group *, ev_ssize_t);
+/*@}*/
+
+
+/**
+ * Inspect the total bytes read/written on a group.
+ *
+ * Set the variable pointed to by total_read_out to the total number of bytes
+ * ever read on grp, and the variable pointed to by total_written_out to the
+ * total number of bytes ever written on grp. */
+void bufferevent_rate_limit_group_get_totals(
+    struct bufferevent_rate_limit_group *grp,
+    ev_uint64_t *total_read_out, ev_uint64_t *total_written_out);
+
+/**
+ * Reset the total bytes read/written on a group.
+ *
+ * Reset the number of bytes read or written on grp as given by
+ * bufferevent_rate_limit_group_reset_totals(). */
+void
+bufferevent_rate_limit_group_reset_totals(
+	struct bufferevent_rate_limit_group *grp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_BUFFEREVENT_H_ */

Property changes on: lab4/.minix-src/include/event2/bufferevent.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/popcntintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/popcntintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/popcntintrin.h	(revision 13)
@@ -0,0 +1,45 @@
+/*===---- popcntintrin.h - POPCNT intrinsics -------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __POPCNT__
+#error "POPCNT instruction set not enabled"
+#endif
+
+#ifndef _POPCNTINTRIN_H
+#define _POPCNTINTRIN_H
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__))
+_mm_popcnt_u32(unsigned int __A)
+{
+  return __builtin_popcount(__A);
+}
+
+#ifdef __x86_64__
+static __inline__ long long __attribute__((__always_inline__, __nodebug__))
+_mm_popcnt_u64(unsigned long long __A)
+{
+  return __builtin_popcountll(__A);
+}
+#endif /* __x86_64__ */
+
+#endif /* _POPCNTINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/popcntintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/dns.h
===================================================================
--- lab4/.minix-src/include/event2/dns.h	(nonexistent)
+++ lab4/.minix-src/include/event2/dns.h	(revision 13)
@@ -0,0 +1,645 @@
+/*	$NetBSD: dns.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*	$NetBSD: dns.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*
+ * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+/*
+ * The original DNS code is due to Adam Langley with heavy
+ * modifications by Nick Mathewson.  Adam put his DNS software in the
+ * public domain.  You can find his original copyright below.  Please,
+ * aware that the code as part of Libevent is governed by the 3-clause
+ * BSD license above.
+ *
+ * This software is Public Domain. To view a copy of the public domain dedication,
+ * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
+ * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
+ *
+ * I ask and expect, but do not require, that all derivative works contain an
+ * attribution similar to:
+ *     Parts developed by Adam Langley <agl@imperialviolet.org>
+ *
+ * You may wish to replace the word "Parts" with something else depending on
+ * the amount of original code.
+ *
+ * (Derivative works does not include programs which link against, run or include
+ * the source verbatim in their source distributions)
+ */
+
+/** @file event2/dns.h
+ *
+ * Welcome, gentle reader
+ *
+ * Async DNS lookups are really a whole lot harder than they should be,
+ * mostly stemming from the fact that the libc resolver has never been
+ * very good at them. Before you use this library you should see if libc
+ * can do the job for you with the modern async call getaddrinfo_a
+ * (see http://www.imperialviolet.org/page25.html#e498). Otherwise,
+ * please continue.
+ *
+ * The library keeps track of the state of nameservers and will avoid
+ * them when they go down. Otherwise it will round robin between them.
+ *
+ * Quick start guide:
+ *   #include "evdns.h"
+ *   void callback(int result, char type, int count, int ttl,
+ *		 void *addresses, void *arg);
+ *   evdns_resolv_conf_parse(DNS_OPTIONS_ALL, "/etc/resolv.conf");
+ *   evdns_resolve("www.hostname.com", 0, callback, NULL);
+ *
+ * When the lookup is complete the callback function is called. The
+ * first argument will be one of the DNS_ERR_* defines in evdns.h.
+ * Hopefully it will be DNS_ERR_NONE, in which case type will be
+ * DNS_IPv4_A, count will be the number of IP addresses, ttl is the time
+ * which the data can be cached for (in seconds), addresses will point
+ * to an array of uint32_t's and arg will be whatever you passed to
+ * evdns_resolve.
+ *
+ * Searching:
+ *
+ * In order for this library to be a good replacement for glibc's resolver it
+ * supports searching. This involves setting a list of default domains, in
+ * which names will be queried for. The number of dots in the query name
+ * determines the order in which this list is used.
+ *
+ * Searching appears to be a single lookup from the point of view of the API,
+ * although many DNS queries may be generated from a single call to
+ * evdns_resolve. Searching can also drastically slow down the resolution
+ * of names.
+ *
+ * To disable searching:
+ *   1. Never set it up. If you never call evdns_resolv_conf_parse or
+ *   evdns_search_add then no searching will occur.
+ *
+ *   2. If you do call evdns_resolv_conf_parse then don't pass
+ *   DNS_OPTION_SEARCH (or DNS_OPTIONS_ALL, which implies it).
+ *
+ *   3. When calling evdns_resolve, pass the DNS_QUERY_NO_SEARCH flag.
+ *
+ * The order of searches depends on the number of dots in the name. If the
+ * number is greater than the ndots setting then the names is first tried
+ * globally. Otherwise each search domain is appended in turn.
+ *
+ * The ndots setting can either be set from a resolv.conf, or by calling
+ * evdns_search_ndots_set.
+ *
+ * For example, with ndots set to 1 (the default) and a search domain list of
+ * ["myhome.net"]:
+ *  Query: www
+ *  Order: www.myhome.net, www.
+ *
+ *  Query: www.abc
+ *  Order: www.abc., www.abc.myhome.net
+ *
+ * Internals:
+ *
+ * Requests are kept in two queues. The first is the inflight queue. In
+ * this queue requests have an allocated transaction id and nameserver.
+ * They will soon be transmitted if they haven't already been.
+ *
+ * The second is the waiting queue. The size of the inflight ring is
+ * limited and all other requests wait in waiting queue for space. This
+ * bounds the number of concurrent requests so that we don't flood the
+ * nameserver. Several algorithms require a full walk of the inflight
+ * queue and so bounding its size keeps thing going nicely under huge
+ * (many thousands of requests) loads.
+ *
+ * If a nameserver loses too many requests it is considered down and we
+ * try not to use it. After a while we send a probe to that nameserver
+ * (a lookup for google.com) and, if it replies, we consider it working
+ * again. If the nameserver fails a probe we wait longer to try again
+ * with the next probe.
+ */
+
+#ifndef _EVENT2_DNS_H_
+#define _EVENT2_DNS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* For integer types. */
+#include <event2/util.h>
+
+/** Error codes 0-5 are as described in RFC 1035. */
+#define DNS_ERR_NONE 0
+/** The name server was unable to interpret the query */
+#define DNS_ERR_FORMAT 1
+/** The name server was unable to process this query due to a problem with the
+ * name server */
+#define DNS_ERR_SERVERFAILED 2
+/** The domain name does not exist */
+#define DNS_ERR_NOTEXIST 3
+/** The name server does not support the requested kind of query */
+#define DNS_ERR_NOTIMPL 4
+/** The name server refuses to reform the specified operation for policy
+ * reasons */
+#define DNS_ERR_REFUSED 5
+/** The reply was truncated or ill-formatted */
+#define DNS_ERR_TRUNCATED 65
+/** An unknown error occurred */
+#define DNS_ERR_UNKNOWN 66
+/** Communication with the server timed out */
+#define DNS_ERR_TIMEOUT 67
+/** The request was canceled because the DNS subsystem was shut down. */
+#define DNS_ERR_SHUTDOWN 68
+/** The request was canceled via a call to evdns_cancel_request */
+#define DNS_ERR_CANCEL 69
+/** There were no answers and no error condition in the DNS packet.
+ * This can happen when you ask for an address that exists, but a record
+ * type that doesn't. */
+#define DNS_ERR_NODATA 70
+
+#define DNS_IPv4_A 1
+#define DNS_PTR 2
+#define DNS_IPv6_AAAA 3
+
+#define DNS_QUERY_NO_SEARCH 1
+
+#define DNS_OPTION_SEARCH 1
+#define DNS_OPTION_NAMESERVERS 2
+#define DNS_OPTION_MISC 4
+#define DNS_OPTION_HOSTSFILE 8
+#define DNS_OPTIONS_ALL 15
+
+/* Obsolete name for DNS_QUERY_NO_SEARCH */
+#define DNS_NO_SEARCH DNS_QUERY_NO_SEARCH
+
+/**
+ * The callback that contains the results from a lookup.
+ * - result is one of the DNS_ERR_* values (DNS_ERR_NONE for success)
+ * - type is either DNS_IPv4_A or DNS_PTR or DNS_IPv6_AAAA
+ * - count contains the number of addresses of form type
+ * - ttl is the number of seconds the resolution may be cached for.
+ * - addresses needs to be cast according to type.  It will be an array of
+ *   4-byte sequences for ipv4, or an array of 16-byte sequences for ipv6,
+ *   or a nul-terminated string for PTR.
+ */
+typedef void (*evdns_callback_type) (int result, char type, int count, int ttl, void *addresses, void *arg);
+
+struct evdns_base;
+struct event_base;
+
+/**
+  Initialize the asynchronous DNS library.
+
+  This function initializes support for non-blocking name resolution by
+  calling evdns_resolv_conf_parse() on UNIX and
+  evdns_config_windows_nameservers() on Windows.
+
+  @param event_base the event base to associate the dns client with
+  @param initialize_nameservers 1 if resolve.conf processing should occur
+  @return evdns_base object if successful, or NULL if an error occurred.
+  @see evdns_base_free()
+ */
+struct evdns_base * evdns_base_new(struct event_base *event_base, int initialize_nameservers);
+
+
+/**
+  Shut down the asynchronous DNS resolver and terminate all active requests.
+
+  If the 'fail_requests' option is enabled, all active requests will return
+  an empty result with the error flag set to DNS_ERR_SHUTDOWN. Otherwise,
+  the requests will be silently discarded.
+
+  @param evdns_base the evdns base to free
+  @param fail_requests if zero, active requests will be aborted; if non-zero,
+		active requests will return DNS_ERR_SHUTDOWN.
+  @see evdns_base_new()
+ */
+void evdns_base_free(struct evdns_base *base, int fail_requests);
+
+/**
+  Convert a DNS error code to a string.
+
+  @param err the DNS error code
+  @return a string containing an explanation of the error code
+*/
+const char *evdns_err_to_string(int err);
+
+
+/**
+  Add a nameserver.
+
+  The address should be an IPv4 address in network byte order.
+  The type of address is chosen so that it matches in_addr.s_addr.
+
+  @param base the evdns_base to which to add the name server
+  @param address an IP address in network byte order
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_base_nameserver_ip_add()
+ */
+int evdns_base_nameserver_add(struct evdns_base *base,
+    unsigned long int address);
+
+/**
+  Get the number of configured nameservers.
+
+  This returns the number of configured nameservers (not necessarily the
+  number of running nameservers).  This is useful for double-checking
+  whether our calls to the various nameserver configuration functions
+  have been successful.
+
+  @param base the evdns_base to which to apply this operation
+  @return the number of configured nameservers
+  @see evdns_base_nameserver_add()
+ */
+int evdns_base_count_nameservers(struct evdns_base *base);
+
+/**
+  Remove all configured nameservers, and suspend all pending resolves.
+
+  Resolves will not necessarily be re-attempted until evdns_base_resume() is called.
+
+  @param base the evdns_base to which to apply this operation
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_base_resume()
+ */
+int evdns_base_clear_nameservers_and_suspend(struct evdns_base *base);
+
+
+/**
+  Resume normal operation and continue any suspended resolve requests.
+
+  Re-attempt resolves left in limbo after an earlier call to
+  evdns_base_clear_nameservers_and_suspend().
+
+  @param base the evdns_base to which to apply this operation
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_base_clear_nameservers_and_suspend()
+ */
+int evdns_base_resume(struct evdns_base *base);
+
+/**
+  Add a nameserver by string address.
+
+  This function parses a n IPv4 or IPv6 address from a string and adds it as a
+  nameserver.  It supports the following formats:
+  - [IPv6Address]:port
+  - [IPv6Address]
+  - IPv6Address
+  - IPv4Address:port
+  - IPv4Address
+
+  If no port is specified, it defaults to 53.
+
+  @param base the evdns_base to which to apply this operation
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_base_nameserver_add()
+ */
+int evdns_base_nameserver_ip_add(struct evdns_base *base,
+    const char *ip_as_string);
+
+/**
+   Add a nameserver by sockaddr.
+ **/
+int
+evdns_base_nameserver_sockaddr_add(struct evdns_base *base,
+    const struct sockaddr *sa, ev_socklen_t len, unsigned flags);
+
+struct evdns_request;
+
+/**
+  Lookup an A record for a given name.
+
+  @param base the evdns_base to which to apply this operation
+  @param name a DNS hostname
+  @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query.
+  @param callback a callback function to invoke when the request is completed
+  @param ptr an argument to pass to the callback function
+  @return an evdns_request object if successful, or NULL if an error occurred.
+  @see evdns_resolve_ipv6(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6(), evdns_cancel_request()
+ */
+struct evdns_request *evdns_base_resolve_ipv4(struct evdns_base *base, const char *name, int flags, evdns_callback_type callback, void *ptr);
+
+/**
+  Lookup an AAAA record for a given name.
+
+  @param base the evdns_base to which to apply this operation
+  @param name a DNS hostname
+  @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query.
+  @param callback a callback function to invoke when the request is completed
+  @param ptr an argument to pass to the callback function
+  @return an evdns_request object if successful, or NULL if an error occurred.
+  @see evdns_resolve_ipv4(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6(), evdns_cancel_request()
+ */
+struct evdns_request *evdns_base_resolve_ipv6(struct evdns_base *base, const char *name, int flags, evdns_callback_type callback, void *ptr);
+
+struct in_addr;
+struct in6_addr;
+
+/**
+  Lookup a PTR record for a given IP address.
+
+  @param base the evdns_base to which to apply this operation
+  @param in an IPv4 address
+  @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query.
+  @param callback a callback function to invoke when the request is completed
+  @param ptr an argument to pass to the callback function
+  @return an evdns_request object if successful, or NULL if an error occurred.
+  @see evdns_resolve_reverse_ipv6(), evdns_cancel_request()
+ */
+struct evdns_request *evdns_base_resolve_reverse(struct evdns_base *base, const struct in_addr *in, int flags, evdns_callback_type callback, void *ptr);
+
+
+/**
+  Lookup a PTR record for a given IPv6 address.
+
+  @param base the evdns_base to which to apply this operation
+  @param in an IPv6 address
+  @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query.
+  @param callback a callback function to invoke when the request is completed
+  @param ptr an argument to pass to the callback function
+  @return an evdns_request object if successful, or NULL if an error occurred.
+  @see evdns_resolve_reverse_ipv6(), evdns_cancel_request()
+ */
+struct evdns_request *evdns_base_resolve_reverse_ipv6(struct evdns_base *base, const struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr);
+
+/**
+  Cancels a pending DNS resolution request.
+
+  @param base the evdns_base that was used to make the request
+  @param req the evdns_request that was returned by calling a resolve function
+  @see evdns_base_resolve_ipv4(), evdns_base_resolve_ipv6, evdns_base_resolve_reverse
+*/
+void evdns_cancel_request(struct evdns_base *base, struct evdns_request *req);
+
+/**
+  Set the value of a configuration option.
+
+  The currently available configuration options are:
+
+    ndots, timeout, max-timeouts, max-inflight, attempts, randomize-case,
+    bind-to, initial-probe-timeout, getaddrinfo-allow-skew.
+
+  In versions before Libevent 2.0.3-alpha, the option name needed to end with
+  a colon.
+
+  @param base the evdns_base to which to apply this operation
+  @param option the name of the configuration option to be modified
+  @param val the value to be set
+  @return 0 if successful, or -1 if an error occurred
+ */
+int evdns_base_set_option(struct evdns_base *base, const char *option, const char *val);
+
+
+/**
+  Parse a resolv.conf file.
+
+  The 'flags' parameter determines what information is parsed from the
+  resolv.conf file. See the man page for resolv.conf for the format of this
+  file.
+
+  The following directives are not parsed from the file: sortlist, rotate,
+  no-check-names, inet6, debug.
+
+  If this function encounters an error, the possible return values are: 1 =
+  failed to open file, 2 = failed to stat file, 3 = file too large, 4 = out of
+  memory, 5 = short read from file, 6 = no nameservers listed in the file
+
+  @param base the evdns_base to which to apply this operation
+  @param flags any of DNS_OPTION_NAMESERVERS|DNS_OPTION_SEARCH|DNS_OPTION_MISC|
+    DNS_OPTION_HOSTSFILE|DNS_OPTIONS_ALL
+  @param filename the path to the resolv.conf file
+  @return 0 if successful, or various positive error codes if an error
+    occurred (see above)
+  @see resolv.conf(3), evdns_config_windows_nameservers()
+ */
+int evdns_base_resolv_conf_parse(struct evdns_base *base, int flags, const char *const filename);
+
+/**
+   Load an /etc/hosts-style file from 'hosts_fname' into 'base'.
+
+   If hosts_fname is NULL, add minimal entries for localhost, and nothing
+   else.
+
+   Note that only evdns_getaddrinfo uses the /etc/hosts entries.
+
+   Return 0 on success, negative on failure.
+*/
+int evdns_base_load_hosts(struct evdns_base *base, const char *hosts_fname);
+
+/**
+  Obtain nameserver information using the Windows API.
+
+  Attempt to configure a set of nameservers based on platform settings on
+  a win32 host.  Preferentially tries to use GetNetworkParams; if that fails,
+  looks in the registry.
+
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_resolv_conf_parse()
+ */
+#ifdef WIN32
+int evdns_base_config_windows_nameservers(struct evdns_base *);
+#define EVDNS_BASE_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
+#endif
+
+
+/**
+  Clear the list of search domains.
+ */
+void evdns_base_search_clear(struct evdns_base *base);
+
+
+/**
+  Add a domain to the list of search domains
+
+  @param domain the domain to be added to the search list
+ */
+void evdns_base_search_add(struct evdns_base *base, const char *domain);
+
+
+/**
+  Set the 'ndots' parameter for searches.
+
+  Sets the number of dots which, when found in a name, causes
+  the first query to be without any search domain.
+
+  @param ndots the new ndots parameter
+ */
+void evdns_base_search_ndots_set(struct evdns_base *base, const int ndots);
+
+/**
+  A callback that is invoked when a log message is generated
+
+  @param is_warning indicates if the log message is a 'warning'
+  @param msg the content of the log message
+ */
+typedef void (*evdns_debug_log_fn_type)(int is_warning, const char *msg);
+
+
+/**
+  Set the callback function to handle DNS log messages.  If this
+  callback is not set, evdns log messages are handled with the regular
+  Libevent logging system.
+
+  @param fn the callback to be invoked when a log message is generated
+ */
+void evdns_set_log_fn(evdns_debug_log_fn_type fn);
+
+/**
+   Set a callback that will be invoked to generate transaction IDs.  By
+   default, we pick transaction IDs based on the current clock time, which
+   is bad for security.
+
+   @param fn the new callback, or NULL to use the default.
+
+   NOTE: This function has no effect in Libevent 2.0.4-alpha and later,
+   since Libevent now provides its own secure RNG.
+ */
+void evdns_set_transaction_id_fn(ev_uint16_t (*fn)(void));
+
+/**
+   Set a callback used to generate random bytes.  By default, we use
+   the same function as passed to evdns_set_transaction_id_fn to generate
+   bytes two at a time.  If a function is provided here, it's also used
+   to generate transaction IDs.
+
+   NOTE: This function has no effect in Libevent 2.0.4-alpha and later,
+   since Libevent now provides its own secure RNG.
+*/
+void evdns_set_random_bytes_fn(void (*fn)(char *, size_t));
+
+/*
+ * Functions used to implement a DNS server.
+ */
+
+struct evdns_server_request;
+struct evdns_server_question;
+
+/**
+   A callback to implement a DNS server.  The callback function receives a DNS
+   request.  It should then optionally add a number of answers to the reply
+   using the evdns_server_request_add_*_reply functions, before calling either
+   evdns_server_request_respond to send the reply back, or
+   evdns_server_request_drop to decline to answer the request.
+
+   @param req A newly received request
+   @param user_data A pointer that was passed to
+      evdns_add_server_port_with_base().
+ */
+typedef void (*evdns_request_callback_fn_type)(struct evdns_server_request *, void *);
+#define EVDNS_ANSWER_SECTION 0
+#define EVDNS_AUTHORITY_SECTION 1
+#define EVDNS_ADDITIONAL_SECTION 2
+
+#define EVDNS_TYPE_A	   1
+#define EVDNS_TYPE_NS	   2
+#define EVDNS_TYPE_CNAME   5
+#define EVDNS_TYPE_SOA	   6
+#define EVDNS_TYPE_PTR	  12
+#define EVDNS_TYPE_MX	  15
+#define EVDNS_TYPE_TXT	  16
+#define EVDNS_TYPE_AAAA	  28
+
+#define EVDNS_QTYPE_AXFR 252
+#define EVDNS_QTYPE_ALL	 255
+
+#define EVDNS_CLASS_INET   1
+
+/* flags that can be set in answers; as part of the err parameter */
+#define EVDNS_FLAGS_AA	0x400
+#define EVDNS_FLAGS_RD	0x080
+
+/** Create a new DNS server port.
+
+    @param base The event base to handle events for the server port.
+    @param socket A UDP socket to accept DNS requests.
+    @param flags Always 0 for now.
+    @param callback A function to invoke whenever we get a DNS request
+      on the socket.
+    @param user_data Data to pass to the callback.
+    @return an evdns_server_port structure for this server port.
+ */
+struct evdns_server_port *evdns_add_server_port_with_base(struct event_base *base, evutil_socket_t socket, int flags, evdns_request_callback_fn_type callback, void *user_data);
+/** Close down a DNS server port, and free associated structures. */
+void evdns_close_server_port(struct evdns_server_port *port);
+
+/** Sets some flags in a reply we're building.
+    Allows setting of the AA or RD flags
+ */
+void evdns_server_request_set_flags(struct evdns_server_request *req, int flags);
+
+/* Functions to add an answer to an in-progress DNS reply.
+ */
+int evdns_server_request_add_reply(struct evdns_server_request *req, int section, const char *name, int type, int dns_class, int ttl, int datalen, int is_name, const char *data);
+int evdns_server_request_add_a_reply(struct evdns_server_request *req, const char *name, int n, const void *addrs, int ttl);
+int evdns_server_request_add_aaaa_reply(struct evdns_server_request *req, const char *name, int n, const void *addrs, int ttl);
+int evdns_server_request_add_ptr_reply(struct evdns_server_request *req, struct in_addr *in, const char *inaddr_name, const char *hostname, int ttl);
+int evdns_server_request_add_cname_reply(struct evdns_server_request *req, const char *name, const char *cname, int ttl);
+
+/**
+   Send back a response to a DNS request, and free the request structure.
+*/
+int evdns_server_request_respond(struct evdns_server_request *req, int err);
+/**
+   Free a DNS request without sending back a reply.
+*/
+int evdns_server_request_drop(struct evdns_server_request *req);
+struct sockaddr;
+/**
+    Get the address that made a DNS request.
+ */
+int evdns_server_request_get_requesting_addr(struct evdns_server_request *_req, struct sockaddr *sa, int addr_len);
+
+/** Callback for evdns_getaddrinfo. */
+typedef void (*evdns_getaddrinfo_cb)(int result, struct evutil_addrinfo *res, void *arg);
+
+struct evdns_base;
+struct evdns_getaddrinfo_request;
+/** Make a non-blocking getaddrinfo request using the dns_base in 'dns_base'.
+ *
+ * If we can answer the request immediately (with an error or not!), then we
+ * invoke cb immediately and return NULL.  Otherwise we return
+ * an evdns_getaddrinfo_request and invoke cb later.
+ *
+ * When the callback is invoked, we pass as its first argument the error code
+ * that getaddrinfo would return (or 0 for no error).  As its second argument,
+ * we pass the evutil_addrinfo structures we found (or NULL on error).  We
+ * pass 'arg' as the third argument.
+ *
+ * Limitations:
+ *
+ * - The AI_V4MAPPED and AI_ALL flags are not currently implemented.
+ * - For ai_socktype, we only handle SOCKTYPE_STREAM, SOCKTYPE_UDP, and 0.
+ * - For ai_protocol, we only handle IPPROTO_TCP, IPPROTO_UDP, and 0.
+ */
+struct evdns_getaddrinfo_request *evdns_getaddrinfo(
+    struct evdns_base *dns_base,
+    const char *nodename, const char *servname,
+    const struct evutil_addrinfo *hints_in,
+    evdns_getaddrinfo_cb cb, void *arg);
+
+/* Cancel an in-progress evdns_getaddrinfo.  This MUST NOT be called after the
+ * getaddrinfo's callback has been invoked.  The resolves will be canceled,
+ * and the callback will be invoked with the error EVUTIL_EAI_CANCEL. */
+void evdns_getaddrinfo_cancel(struct evdns_getaddrinfo_request *req);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* !_EVENT2_DNS_H_ */

Property changes on: lab4/.minix-src/include/event2/dns.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/shaintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/shaintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/shaintrin.h	(revision 13)
@@ -0,0 +1,74 @@
+/*===---- shaintrin.h - SHA intrinsics -------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use <shaintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef __SHAINTRIN_H
+#define __SHAINTRIN_H
+
+#if !defined (__SHA__)
+#  error "SHA instructions not enabled"
+#endif
+
+#define _mm_sha1rnds4_epu32(V1, V2, M) __extension__ ({ \
+  __builtin_ia32_sha1rnds4((V1), (V2), (M)); })
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha1nexte_epu32(__m128i __X, __m128i __Y)
+{
+  return (__m128i)__builtin_ia32_sha1nexte((__v4si)__X, (__v4si)__Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha1msg1_epu32(__m128i __X, __m128i __Y)
+{
+  return (__m128i)__builtin_ia32_sha1msg1((__v4si)__X, (__v4si)__Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha1msg2_epu32(__m128i __X, __m128i __Y)
+{
+  return (__m128i)__builtin_ia32_sha1msg2((__v4si)__X, (__v4si)__Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha256rnds2_epu32(__m128i __X, __m128i __Y, __m128i __Z)
+{
+  return (__m128i)__builtin_ia32_sha256rnds2((__v4si)__X, (__v4si)__Y, (__v4si)__Z);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha256msg1_epu32(__m128i __X, __m128i __Y)
+{
+  return (__m128i)__builtin_ia32_sha256msg1((__v4si)__X, (__v4si)__Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha256msg2_epu32(__m128i __X, __m128i __Y)
+{
+  return (__m128i)__builtin_ia32_sha256msg2((__v4si)__X, (__v4si)__Y);
+}
+
+#endif /* __SHAINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/shaintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/event.h
===================================================================
--- lab4/.minix-src/include/event2/event.h	(nonexistent)
+++ lab4/.minix-src/include/event2/event.h	(revision 13)
@@ -0,0 +1,1206 @@
+/*	$NetBSD: event.h,v 1.1.1.2 2015/01/29 06:38:26 spz Exp $	*/
+/*	$NetBSD: event.h,v 1.1.1.2 2015/01/29 06:38:26 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_EVENT_H_
+#define _EVENT2_EVENT_H_
+
+/**
+   @mainpage
+
+  @section intro Introduction
+
+  Libevent is an event notification library for developing scalable network
+  servers.  The Libevent API provides a mechanism to execute a callback
+  function when a specific event occurs on a file descriptor or after a
+  timeout has been reached. Furthermore, Libevent also support callbacks due
+  to signals or regular timeouts.
+
+  Libevent is meant to replace the event loop found in event driven network
+  servers. An application just needs to call event_dispatch() and then add or
+  remove events dynamically without having to change the event loop.
+
+
+  Currently, Libevent supports /dev/poll, kqueue(2), select(2), poll(2),
+  epoll(4), and evports. The internal event mechanism is completely
+  independent of the exposed event API, and a simple update of Libevent can
+  provide new functionality without having to redesign the applications. As a
+  result, Libevent allows for portable application development and provides
+  the most scalable event notification mechanism available on an operating
+  system.  Libevent can also be used for multithreaded programs.  Libevent
+  should compile on Linux, *BSD, Mac OS X, Solaris and, Windows.
+
+  @section usage Standard usage
+
+  Every program that uses Libevent must inclurde the <event2/event.h>
+  header, and pass the -levent flag to the linker.  (You can instead link
+  -levent_core if you only want the main event and buffered IO-based code,
+  and don't want to link any protocol code.)
+
+  @section setup Library setup
+
+  Before you call any other Libevent functions, you need to set up the
+  library.  If you're going to use Libevent from multiple threads in a
+  multithreaded application, you need to initialize thread support --
+  typically by using evthread_use_pthreads() or
+  evthread_use_windows_threads().  See <event2/thread.h> for more
+  information.
+
+  This is also the point where you can replace Libevent's memory
+  management functions with event_set_mem_functions, and enable debug mode
+  with event_enable_debug_mode().
+
+  @section base Creating an event base
+
+  Next, you need to create an event_base structure, using event_base_new()
+  or event_base_new_with_config().  The event_base is responsible for
+  keeping track of which events are "pending" (that is to say, being
+  watched to see if they become active) and which events are "active".
+  Every event is associated with a single event_base.
+
+  @section event Event notification
+
+  For each file descriptor that you wish to monitor, you must create an
+  event structure with event_new().  (You may also declare an event
+  structure and call event_assign() to initialize the members of the
+  structure.)  To enable notification, you add the structure to the list
+  of monitored events by calling event_add().  The event structure must
+  remain allocated as long as it is active, so it should generally be
+  allocated on the heap.
+
+  @section loop Dispaching evets.
+
+  Finally, you call event_base_dispatch() to loop and dispatch events.
+  You can also use event_base_loop() for more fine-grained control.
+
+  Currently, only one thread can be dispatching a given event_base at a
+  time.  If you want to run events in multiple threads at once, you can
+  either have a single event_base whose events add work to a work queue,
+  or you can create multiple event_base objects.
+
+  @section bufferevent I/O Buffers
+
+  Libevent provides a buffered I/O abstraction on top of the regular event
+  callbacks. This abstraction is called a bufferevent. A bufferevent
+  provides input and output buffers that get filled and drained
+  automatically. The user of a buffered event no longer deals directly
+  with the I/O, but instead is reading from input and writing to output
+  buffers.
+
+  Once initialized via bufferevent_socket_new(), the bufferevent structure
+  can be used repeatedly with bufferevent_enable() and
+  bufferevent_disable().  Instead of reading and writing directly to a
+  socket, you would call bufferevent_read() and bufferevent_write().
+
+  When read enabled the bufferevent will try to read from the file descriptor
+  and call the read callback. The write callback is executed whenever the
+  output buffer is drained below the write low watermark, which is 0 by
+  default.
+
+  See <event2/bufferevent*.h> for more information.
+
+  @section timers Timers
+
+  Libevent can also be used to create timers that invoke a callback after a
+  certain amount of time has expired. The evtimer_new() function returns
+  an event struct to use as a timer. To activate the timer, call
+  evtimer_add(). Timers can be deactivated by calling evtimer_del().
+
+  @section evdns Asynchronous DNS resolution
+
+  Libevent provides an asynchronous DNS resolver that should be used instead
+  of the standard DNS resolver functions.  See the <event2/dns.h>
+  functions for more detail.
+
+  @section evhttp Event-driven HTTP servers
+
+  Libevent provides a very simple event-driven HTTP server that can be
+  embedded in your program and used to service HTTP requests.
+
+  To use this capability, you need to include the <event2/http.h> header in your
+  program.  See that header for more information.
+
+  @section evrpc A framework for RPC servers and clients
+
+  Libevent provides a framework for creating RPC servers and clients.  It
+  takes care of marshaling and unmarshaling all data structures.
+
+  @section api API Reference
+
+  To browse the complete documentation of the libevent API, click on any of
+  the following links.
+
+  event2/event.h
+  The primary libevent header
+
+  event2/thread.h
+  Functions for use by multithreaded programs
+
+  event2/buffer.h and event2/bufferevent.h
+  Buffer management for network reading and writing
+
+  event2/util.h
+  Utility functions for portable nonblocking network code
+
+  event2/dns.h
+  Asynchronous DNS resolution
+
+  event2/http.h
+  An embedded libevent-based HTTP server
+
+  event2/rpc.h
+  A framework for creating RPC servers and clients
+
+ */
+
+/** @file event2/event.h
+
+  Core functions for waiting for and receiving events, and using event bases.
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <stdio.h>
+
+/* For int types. */
+#include <event2/util.h>
+
+/**
+ * Structure to hold information and state for a Libevent dispatch loop.
+ *
+ * The event_base lies at the center of Libevent; every application will
+ * have one.  It keeps track of all pending and active events, and
+ * notifies your application of the active ones.
+ *
+ * This is an opaque structure; you can allocate one using
+ * event_base_new() or event_base_new_with_config().
+ *
+ * @see event_base_new(), event_base_free(), event_base_loop(),
+ *    event_base_new_with_config()
+ */
+struct event_base
+#ifdef _EVENT_IN_DOXYGEN
+{/*Empty body so that doxygen will generate documentation here.*/}
+#endif
+;
+
+/**
+ * @struct event
+ *
+ * Structure to represent a single event.
+ *
+ * An event can have some underlying condition it represents: a socket
+ * becoming readable or writeable (or both), or a signal becoming raised.
+ * (An event that represents no underlying condition is still useful: you
+ * can use one to implement a timer, or to communicate between threads.)
+ *
+ * Generally, you can create events with event_new(), then make them
+ * pending with event_add().  As your event_base runs, it will run the
+ * callbacks of an events whose conditions are triggered.  When you
+ * longer want the event, free it with event_free().
+ *
+ * In more depth:
+ *
+ * An event may be "pending" (one whose condition we are watching),
+ * "active" (one whose condition has triggered and whose callback is about
+ * to run), neither, or both.  Events come into existence via
+ * event_assign() or event_new(), and are then neither active nor pending.
+ *
+ * To make an event pending, pass it to event_add().  When doing so, you
+ * can also set a timeout for the event.
+ *
+ * Events become active during an event_base_loop() call when either their
+ * condition has triggered, or when their timeout has elapsed.  You can
+ * also activate an event manually using event_active().  The even_base
+ * loop will run the callbacks of active events; after it has done so, it
+ * marks them as no longer active.
+ *
+ * You can make an event non-pending by passing it to event_del().  This
+ * also makes the event non-active.
+ *
+ * Events can be "persistent" or "non-persistent".  A non-persistent event
+ * becomes non-pending as soon as it is triggered: thus, it only runs at
+ * most once per call to event_add().  A persistent event remains pending
+ * even when it becomes active: you'll need to event_del() it manually in
+ * order to make it non-pending.  When a persistent event with a timeout
+ * becomes active, its timeout is reset: this means you can use persistent
+ * events to implement periodic timeouts.
+ *
+ * This should be treated as an opaque structure; you should never read or
+ * write any of its fields directly.  For backward compatibility with old
+ * code, it is defined in the event2/event_struct.h header; including this
+ * header may make your code incompatible with other versions of Libevent.
+ *
+ * @see event_new(), event_free(), event_assign(), event_get_assignment(),
+ *    event_add(), event_del(), event_active(), event_pending(),
+ *    event_get_fd(), event_get_base(), event_get_events(),
+ *    event_get_callback(), event_get_callback_arg(),
+ *    event_priority_set()
+ */
+struct event
+#ifdef _EVENT_IN_DOXYGEN
+{/*Empty body so that doxygen will generate documentation here.*/}
+#endif
+;
+
+/**
+ * Configuration for an event_base.
+ *
+ * There are many options that can be used to alter the behavior and
+ * implementation of an event_base.  To avoid having to pass them all in a
+ * complex many-argument constructor, we provide an abstract data type
+ * wrhere you set up configation information before passing it to
+ * event_base_new_with_config().
+ *
+ * @see event_config_new(), event_config_free(), event_base_new_with_config(),
+ *   event_config_avoid_method(), event_config_require_features(),
+ *   event_config_set_flag(), event_config_set_num_cpus_hint()
+ */
+struct event_config
+#ifdef _EVENT_IN_DOXYGEN
+{/*Empty body so that doxygen will generate documentation here.*/}
+#endif
+;
+
+/**
+ * Enable some relatively expensive debugging checks in Libevent that
+ * would normally be turned off.  Generally, these checks cause code that
+ * would otherwise crash mysteriously to fail earlier with an assertion
+ * failure.  Note that this method MUST be called before any events or
+ * event_bases have been created.
+ *
+ * Debug mode can currently catch the following errors:
+ *    An event is re-assigned while it is added
+ *    Any function is called on a non-assigned event
+ *
+ * Note that debugging mode uses memory to track every event that has been
+ * initialized (via event_assign, event_set, or event_new) but not yet
+ * released (via event_free or event_debug_unassign).  If you want to use
+ * debug mode, and you find yourself running out of memory, you will need
+ * to use event_debug_unassign to explicitly stop tracking events that
+ * are no longer considered set-up.
+ *
+ * @see event_debug_unassign()
+ */
+void event_enable_debug_mode(void);
+
+/**
+ * When debugging mode is enabled, informs Libevent that an event should no
+ * longer be considered as assigned. When debugging mode is not enabled, does
+ * nothing.
+ *
+ * This function must only be called on a non-added event.
+ *
+ * @see event_enable_debug_mode()
+ */
+void event_debug_unassign(struct event *);
+
+/**
+ * Create and return a new event_base to use with the rest of Libevent.
+ *
+ * @return a new event_base on success, or NULL on failure.
+ *
+ * @see event_base_free(), event_base_new_with_config()
+ */
+struct event_base *event_base_new(void);
+
+/**
+  Reinitialize the event base after a fork
+
+  Some event mechanisms do not survive across fork.   The event base needs
+  to be reinitialized with the event_reinit() function.
+
+  @param base the event base that needs to be re-initialized
+  @return 0 if successful, or -1 if some events could not be re-added.
+  @see event_base_new()
+*/
+int event_reinit(struct event_base *base);
+
+/**
+   Event dispatching loop
+
+  This loop will run the event base until either there are no more pending or
+  active, or until something calls event_base_loopbreak() or
+  event_base_loopexit().
+
+  @param base the event_base structure returned by event_base_new() or
+     event_base_new_with_config()
+  @return 0 if successful, -1 if an error occurred, or 1 if we exited because
+     no events were pending or active.
+  @see event_base_loop()
+ */
+int event_base_dispatch(struct event_base *);
+
+/**
+ Get the kernel event notification mechanism used by Libevent.
+
+ @param eb the event_base structure returned by event_base_new()
+ @return a string identifying the kernel event mechanism (kqueue, epoll, etc.)
+ */
+const char *event_base_get_method(const struct event_base *);
+
+/**
+   Gets all event notification mechanisms supported by Libevent.
+
+   This functions returns the event mechanism in order preferred by
+   Libevent.  Note that this list will include all backends that
+   Libevent has compiled-in support for, and will not necessarily check
+   your OS to see whether it has the required resources.
+
+   @return an array with pointers to the names of support methods.
+     The end of the array is indicated by a NULL pointer.  If an
+     error is encountered NULL is returned.
+*/
+const char **event_get_supported_methods(void);
+
+/**
+   Allocates a new event configuration object.
+
+   The event configuration object can be used to change the behavior of
+   an event base.
+
+   @return an event_config object that can be used to store configuration, or
+     NULL if an error is encountered.
+   @see event_base_new_with_config(), event_config_free(), event_config
+*/
+struct event_config *event_config_new(void);
+
+/**
+   Deallocates all memory associated with an event configuration object
+
+   @param cfg the event configuration object to be freed.
+*/
+void event_config_free(struct event_config *cfg);
+
+/**
+   Enters an event method that should be avoided into the configuration.
+
+   This can be used to avoid event mechanisms that do not support certain
+   file descriptor types, or for debugging to avoid certain event
+   mechanisms.  An application can make use of multiple event bases to
+   accommodate incompatible file descriptor types.
+
+   @param cfg the event configuration object
+   @param method the name of the event method to avoid
+   @return 0 on success, -1 on failure.
+*/
+int event_config_avoid_method(struct event_config *cfg, const char *method);
+
+/**
+   A flag used to describe which features an event_base (must) provide.
+
+   Because of OS limitations, not every Libevent backend supports every
+   possible feature.  You can use this type with
+   event_config_require_features() to tell Libevent to only proceed if your
+   event_base implements a given feature, and you can receive this type from
+   event_base_get_features() to see which features are available.
+*/
+enum event_method_feature {
+    /** Require an event method that allows edge-triggered events with EV_ET. */
+    EV_FEATURE_ET = 0x01,
+    /** Require an event method where having one event triggered among
+     * many is [approximately] an O(1) operation. This excludes (for
+     * example) select and poll, which are approximately O(N) for N
+     * equal to the total number of possible events. */
+    EV_FEATURE_O1 = 0x02,
+    /** Require an event method that allows file descriptors as well as
+     * sockets. */
+    EV_FEATURE_FDS = 0x04
+};
+
+/**
+   A flag passed to event_config_set_flag().
+
+    These flags change the behavior of an allocated event_base.
+
+    @see event_config_set_flag(), event_base_new_with_config(),
+       event_method_feature
+ */
+enum event_base_config_flag {
+	/** Do not allocate a lock for the event base, even if we have
+	    locking set up. */
+	EVENT_BASE_FLAG_NOLOCK = 0x01,
+	/** Do not check the EVENT_* environment variables when configuring
+	    an event_base  */
+	EVENT_BASE_FLAG_IGNORE_ENV = 0x02,
+	/** Windows only: enable the IOCP dispatcher at startup
+
+	    If this flag is set then bufferevent_socket_new() and
+	    evconn_listener_new() will use IOCP-backed implementations
+	    instead of the usual select-based one on Windows.
+	 */
+	EVENT_BASE_FLAG_STARTUP_IOCP = 0x04,
+	/** Instead of checking the current time every time the event loop is
+	    ready to run timeout callbacks, check after each timeout callback.
+	 */
+	EVENT_BASE_FLAG_NO_CACHE_TIME = 0x08,
+
+	/** If we are using the epoll backend, this flag says that it is
+	    safe to use Libevent's internal change-list code to batch up
+	    adds and deletes in order to try to do as few syscalls as
+	    possible.  Setting this flag can make your code run faster, but
+	    it may trigger a Linux bug: it is not safe to use this flag
+	    if you have any fds cloned by dup() or its variants.  Doing so
+	    will produce strange and hard-to-diagnose bugs.
+
+	    This flag can also be activated by settnig the
+	    EVENT_EPOLL_USE_CHANGELIST environment variable.
+
+	    This flag has no effect if you wind up using a backend other than
+	    epoll.
+	 */
+	EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST = 0x10
+};
+
+/**
+   Return a bitmask of the features implemented by an event base.  This
+   will be a bitwise OR of one or more of the values of
+   event_method_feature
+
+   @see event_method_feature
+ */
+int event_base_get_features(const struct event_base *base);
+
+/**
+   Enters a required event method feature that the application demands.
+
+   Note that not every feature or combination of features is supported
+   on every platform.  Code that requests features should be prepared
+   to handle the case where event_base_new_with_config() returns NULL, as in:
+   <pre>
+     event_config_require_features(cfg, EV_FEATURE_ET);
+     base = event_base_new_with_config(cfg);
+     if (base == NULL) {
+       // We can't get edge-triggered behavior here.
+       event_config_require_features(cfg, 0);
+       base = event_base_new_with_config(cfg);
+     }
+   </pre>
+
+   @param cfg the event configuration object
+   @param feature a bitfield of one or more event_method_feature values.
+          Replaces values from previous calls to this function.
+   @return 0 on success, -1 on failure.
+   @see event_method_feature, event_base_new_with_config()
+*/
+int event_config_require_features(struct event_config *cfg, int feature);
+
+/**
+ * Sets one or more flags to configure what parts of the eventual event_base
+ * will be initialized, and how they'll work.
+ *
+ * @see event_base_config_flags, event_base_new_with_config()
+ **/
+int event_config_set_flag(struct event_config *cfg, int flag);
+
+/**
+ * Records a hint for the number of CPUs in the system. This is used for
+ * tuning thread pools, etc, for optimal performance.  In Libevent 2.0,
+ * it is only on Windows, and only when IOCP is in use.
+ *
+ * @param cfg the event configuration object
+ * @param cpus the number of cpus
+ * @return 0 on success, -1 on failure.
+ */
+int event_config_set_num_cpus_hint(struct event_config *cfg, int cpus);
+
+/**
+  Initialize the event API.
+
+  Use event_base_new_with_config() to initialize a new event base, taking
+  the specified configuration under consideration.  The configuration object
+  can currently be used to avoid certain event notification mechanisms.
+
+  @param cfg the event configuration object
+  @return an initialized event_base that can be used to registering events,
+     or NULL if no event base can be created with the requested event_config.
+  @see event_base_new(), event_base_free(), event_init(), event_assign()
+*/
+struct event_base *event_base_new_with_config(const struct event_config *);
+
+/**
+  Deallocate all memory associated with an event_base, and free the base.
+
+  Note that this function will not close any fds or free any memory passed
+  to event_new as the argument to callback.
+
+  @param eb an event_base to be freed
+ */
+void event_base_free(struct event_base *);
+
+/** @name Log severities
+ */
+/**@{*/
+#define EVENT_LOG_DEBUG 0
+#define EVENT_LOG_MSG   1
+#define EVENT_LOG_WARN  2
+#define EVENT_LOG_ERR   3
+/**@}*/
+
+/* Obsolete names: these are deprecated, but older programs might use them.
+ * They violate the reserved-identifier namespace. */
+#define _EVENT_LOG_DEBUG EVENT_LOG_DEBUG
+#define _EVENT_LOG_MSG EVENT_LOG_MSG
+#define _EVENT_LOG_WARN EVENT_LOG_WARN
+#define _EVENT_LOG_ERR EVENT_LOG_ERR
+
+/**
+  A callback function used to intercept Libevent's log messages.
+
+  @see event_set_log_callback
+ */
+typedef void (*event_log_cb)(int severity, const char *msg);
+/**
+  Redirect Libevent's log messages.
+
+  @param cb a function taking two arguments: an integer severity between
+     _EVENT_LOG_DEBUG and _EVENT_LOG_ERR, and a string.  If cb is NULL,
+	 then the default log is used.
+
+  NOTE: The function you provide *must not* call any other libevent
+  functionality.  Doing so can produce undefined behavior.
+  */
+void event_set_log_callback(event_log_cb cb);
+
+/**
+   A function to be called if Libevent encounters a fatal internal error.
+
+   @see event_set_fatal_callback
+ */
+typedef void (*event_fatal_cb)(int err);
+
+/**
+ Override Libevent's behavior in the event of a fatal internal error.
+
+ By default, Libevent will call exit(1) if a programming error makes it
+ impossible to continue correct operation.  This function allows you to supply
+ another callback instead.  Note that if the function is ever invoked,
+ something is wrong with your program, or with Libevent: any subsequent calls
+ to Libevent may result in undefined behavior.
+
+ Libevent will (almost) always log an _EVENT_LOG_ERR message before calling
+ this function; look at the last log message to see why Libevent has died.
+ */
+void event_set_fatal_callback(event_fatal_cb cb);
+
+/**
+  Associate a different event base with an event.
+
+  The event to be associated must not be currently active or pending.
+
+  @param eb the event base
+  @param ev the event
+  @return 0 on success, -1 on failure.
+ */
+int event_base_set(struct event_base *, struct event *);
+
+/** @name Loop flags
+
+    These flags control the behavior of event_base_loop().
+ */
+/**@{*/
+/** Block until we have an active event, then exit once all active events
+ * have had their callbacks run. */
+#define EVLOOP_ONCE	0x01
+/** Do not block: see which events are ready now, run the callbacks
+ * of the highest-priority ones, then exit. */
+#define EVLOOP_NONBLOCK	0x02
+/**@}*/
+
+/**
+  Wait for events to become active, and run their callbacks.
+
+  This is a more flexible version of event_base_dispatch().
+
+  By default, this loop will run the event base until either there are no more
+  pending or active events, or until something calls event_base_loopbreak() or
+  event_base_loopexit().  You can override this behavior with the 'flags'
+  argument.
+
+  @param eb the event_base structure returned by event_base_new() or
+     event_base_new_with_config()
+  @param flags any combination of EVLOOP_ONCE | EVLOOP_NONBLOCK
+  @return 0 if successful, -1 if an error occurred, or 1 if we exited because
+     no events were pending or active.
+  @see event_base_loopexit(), event_base_dispatch(), EVLOOP_ONCE,
+     EVLOOP_NONBLOCK
+  */
+int event_base_loop(struct event_base *, int);
+
+/**
+  Exit the event loop after the specified time
+
+  The next event_base_loop() iteration after the given timer expires will
+  complete normally (handling all queued events) then exit without
+  blocking for events again.
+
+  Subsequent invocations of event_base_loop() will proceed normally.
+
+  @param eb the event_base structure returned by event_init()
+  @param tv the amount of time after which the loop should terminate,
+    or NULL to exit after running all currently active events.
+  @return 0 if successful, or -1 if an error occurred
+  @see event_base_loopbreak()
+ */
+int event_base_loopexit(struct event_base *, const struct timeval *);
+
+/**
+  Abort the active event_base_loop() immediately.
+
+  event_base_loop() will abort the loop after the next event is completed;
+  event_base_loopbreak() is typically invoked from this event's callback.
+  This behavior is analogous to the "break;" statement.
+
+  Subsequent invocations of event_loop() will proceed normally.
+
+  @param eb the event_base structure returned by event_init()
+  @return 0 if successful, or -1 if an error occurred
+  @see event_base_loopexit()
+ */
+int event_base_loopbreak(struct event_base *);
+
+/**
+  Checks if the event loop was told to exit by event_loopexit().
+
+  This function will return true for an event_base at every point after
+  event_loopexit() is called, until the event loop is next entered.
+
+  @param eb the event_base structure returned by event_init()
+  @return true if event_base_loopexit() was called on this event base,
+    or 0 otherwise
+  @see event_base_loopexit()
+  @see event_base_got_break()
+ */
+int event_base_got_exit(struct event_base *);
+
+/**
+  Checks if the event loop was told to abort immediately by event_loopbreak().
+
+  This function will return true for an event_base at every point after
+  event_loopbreak() is called, until the event loop is next entered.
+
+  @param eb the event_base structure returned by event_init()
+  @return true if event_base_loopbreak() was called on this event base,
+    or 0 otherwise
+  @see event_base_loopbreak()
+  @see event_base_got_exit()
+ */
+int event_base_got_break(struct event_base *);
+
+/**
+ * @name event flags
+ *
+ * Flags to pass to event_new(), event_assign(), event_pending(), and
+ * anything else with an argument of the form "short events"
+ */
+/**@{*/
+/** Indicates that a timeout has occurred.  It's not necessary to pass
+ * this flag to event_for new()/event_assign() to get a timeout. */
+#define EV_TIMEOUT	0x01
+/** Wait for a socket or FD to become readable */
+#define EV_READ		0x02
+/** Wait for a socket or FD to become writeable */
+#define EV_WRITE	0x04
+/** Wait for a POSIX signal to be raised*/
+#define EV_SIGNAL	0x08
+/**
+ * Persistent event: won't get removed automatically when activated.
+ *
+ * When a persistent event with a timeout becomes activated, its timeout
+ * is reset to 0.
+ */
+#define EV_PERSIST	0x10
+/** Select edge-triggered behavior, if supported by the backend. */
+#define EV_ET       0x20
+/**@}*/
+
+/**
+   @name evtimer_* macros
+
+    Aliases for working with one-shot timer events */
+/**@{*/
+#define evtimer_assign(ev, b, cb, arg) \
+	event_assign((ev), (b), -1, 0, (cb), (arg))
+#define evtimer_new(b, cb, arg)	       event_new((b), -1, 0, (cb), (arg))
+#define evtimer_add(ev, tv)		event_add((ev), (tv))
+#define evtimer_del(ev)			event_del(ev)
+#define evtimer_pending(ev, tv)		event_pending((ev), EV_TIMEOUT, (tv))
+#define evtimer_initialized(ev)		event_initialized(ev)
+/**@}*/
+
+/**
+   @name evsignal_* macros
+
+   Aliases for working with signal events
+ */
+/**@{*/
+#define evsignal_add(ev, tv)		event_add((ev), (tv))
+#define evsignal_assign(ev, b, x, cb, arg)			\
+	event_assign((ev), (b), (x), EV_SIGNAL|EV_PERSIST, cb, (arg))
+#define evsignal_new(b, x, cb, arg)				\
+	event_new((b), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
+#define evsignal_del(ev)		event_del(ev)
+#define evsignal_pending(ev, tv)	event_pending((ev), EV_SIGNAL, (tv))
+#define evsignal_initialized(ev)	event_initialized(ev)
+/**@}*/
+
+/**
+   A callback function for an event.
+
+   It receives three arguments:
+
+   @param fd An fd or signal
+   @param events One or more EV_* flags
+   @param arg A user-supplied argument.
+
+   @see event_new()
+ */
+typedef void (*event_callback_fn)(evutil_socket_t, short, void *);
+
+/**
+  Allocate and asssign a new event structure, ready to be added.
+
+  The function event_new() returns a new event that can be used in
+  future calls to event_add() and event_del().  The fd and events
+  arguments determine which conditions will trigger the event; the
+  callback and callback_arg arguments tell Libevent what to do when the
+  event becomes active.
+
+  If events contains one of EV_READ, EV_WRITE, or EV_READ|EV_WRITE, then
+  fd is a file descriptor or socket that should get monitored for
+  readiness to read, readiness to write, or readiness for either operation
+  (respectively).  If events contains EV_SIGNAL, then fd is a signal
+  number to wait for.  If events contains none of those flags, then the
+  event can be triggered only by a timeout or by manual activation with
+  event_active(): In this case, fd must be -1.
+
+  The EV_PERSIST flag can also be passed in the events argument: it makes
+  event_add() persistent until event_del() is called.
+
+  The EV_ET flag is compatible with EV_READ and EV_WRITE, and supported
+  only by certain backends.  It tells Libevent to use edge-triggered
+  events.
+
+  The EV_TIMEOUT flag has no effect here.
+
+  It is okay to have multiple events all listening on the same fds; but
+  they must either all be edge-triggered, or all not be edge triggerd.
+
+  When the event becomes active, the event loop will run the provided
+  callbuck function, with three arguments.  The first will be the provided
+  fd value.  The second will be a bitfield of the events that triggered:
+  EV_READ, EV_WRITE, or EV_SIGNAL.  Here the EV_TIMEOUT flag indicates
+  that a timeout occurred, and EV_ET indicates that an edge-triggered
+  event occurred.  The third event will be the callback_arg pointer that
+  you provide.
+
+  @param base the event base to which the event should be attached.
+  @param fd the file descriptor or signal to be monitored, or -1.
+  @param events desired events to monitor: bitfield of EV_READ, EV_WRITE,
+      EV_SIGNAL, EV_PERSIST, EV_ET.
+  @param callback callback function to be invoked when the event occurs
+  @param callback_arg an argument to be passed to the callback function
+
+  @return a newly allocated struct event that must later be freed with
+    event_free().
+  @see event_free(), event_add(), event_del(), event_assign()
+ */
+struct event *event_new(struct event_base *, evutil_socket_t, short, event_callback_fn, void *);
+
+
+/**
+  Prepare a new, already-allocated event structure to be added.
+
+  The function event_assign() prepares the event structure ev to be used
+  in future calls to event_add() and event_del().  Unlike event_new(), it
+  doesn't allocate memory itself: it requires that you have already
+  allocated a struct event, probably on the heap.  Doing this will
+  typically make your code depend on the size of the event structure, and
+  thereby create incompatibility with future versions of Libevent.
+
+  The easiest way to avoid this problem is just to use event_new() and
+  event_free() instead.
+
+  A slightly harder way to future-proof your code is to use
+  event_get_struct_event_size() to determine the required size of an event
+  at runtime.
+
+  Note that it is NOT safe to call this function on an event that is
+  active or pending.  Doing so WILL corrupt internal data structures in
+  Libevent, and lead to strange, hard-to-diagnose bugs.  You _can_ use
+  event_assign to change an existing event, but only if it is not active
+  or pending!
+
+  The arguments for this function, and the behavior of the events that it
+  makes, are as for event_new().
+
+  @param ev an event struct to be modified
+  @param base the event base to which ev should be attached.
+  @param fd the file descriptor to be monitored
+  @param events desired events to monitor; can be EV_READ and/or EV_WRITE
+  @param callback callback function to be invoked when the event occurs
+  @param callback_arg an argument to be passed to the callback function
+
+  @return 0 if success, or -1 on invalid arguments.
+
+  @see event_new(), event_add(), event_del(), event_base_once(),
+    event_get_struct_event_size()
+  */
+int event_assign(struct event *, struct event_base *, evutil_socket_t, short, event_callback_fn, void *);
+
+/**
+   Deallocate a struct event * returned by event_new().
+
+   If the event is pending or active, first make it non-pending and
+   non-active.
+ */
+void event_free(struct event *);
+
+/**
+  Schedule a one-time event
+
+  The function event_base_once() is similar to event_set().  However, it
+  schedules a callback to be called exactly once, and does not require the
+  caller to prepare an event structure.
+
+  Note that in Libevent 2.0 and earlier, if the event is never triggered,
+  the internal memory used to hold it will never be freed.  This may be
+  fixed in a later version of Libevent.
+
+  @param base an event_base
+  @param fd a file descriptor to monitor, or -1 for no fd.
+  @param events event(s) to monitor; can be any of EV_READ |
+         EV_WRITE, or EV_TIMEOUT
+  @param callback callback function to be invoked when the event occurs
+  @param arg an argument to be passed to the callback function
+  @param timeout the maximum amount of time to wait for the event. NULL
+         makes an EV_READ/EV_WRITE event make forever; NULL makes an
+        EV_TIMEOUT event succees immediately.
+  @return 0 if successful, or -1 if an error occurred
+ */
+int event_base_once(struct event_base *, evutil_socket_t, short, event_callback_fn, void *, const struct timeval *);
+
+/**
+  Add an event to the set of pending events.
+
+  The function event_add() schedules the execution of the ev event when the
+  event specified in event_assign()/event_new() occurs, or when the time
+  specified in timeout has elapesed.  If atimeout is NULL, no timeout
+  occurs and the function will only be
+  called if a matching event occurs.  The event in the
+  ev argument must be already initialized by event_assign() or event_new()
+  and may not be used
+  in calls to event_assign() until it is no longer pending.
+
+  If the event in the ev argument already has a scheduled timeout, calling
+  event_add() replaces the old timeout with the new one, or clears the old
+  timeout if the timeout argument is NULL.
+
+  @param ev an event struct initialized via event_set()
+  @param timeout the maximum amount of time to wait for the event, or NULL
+         to wait forever
+  @return 0 if successful, or -1 if an error occurred
+  @see event_del(), event_assign(), event_new()
+  */
+int event_add(struct event *ev, const struct timeval *timeout);
+
+/**
+  Remove an event from the set of monitored events.
+
+  The function event_del() will cancel the event in the argument ev.  If the
+  event has already executed or has never been added the call will have no
+  effect.
+
+  @param ev an event struct to be removed from the working set
+  @return 0 if successful, or -1 if an error occurred
+  @see event_add()
+ */
+int event_del(struct event *);
+
+
+/**
+  Make an event active.
+
+  You can use this function on a pending or a non-pending event to make it
+  active, so that its callback will be run by event_base_dispatch() or
+  event_base_loop().
+
+  One common use in multithreaded programs is to wake the thread running
+  event_base_loop() from another thread.
+
+  @param ev an event to make active.
+  @param res a set of flags to pass to the event's callback.
+  @param ncalls an obsolete argument: this is ignored.
+ **/
+void event_active(struct event *ev, int res, short ncalls);
+
+/**
+  Checks if a specific event is pending or scheduled.
+
+  @param ev an event struct previously passed to event_add()
+  @param events the requested event type; any of EV_TIMEOUT|EV_READ|
+         EV_WRITE|EV_SIGNAL
+  @param tv if this field is not NULL, and the event has a timeout,
+         this field is set to hold the time at which the timeout will
+	 expire.
+
+  @return true if the event is pending on any of the events in 'what', (that
+  is to say, it has been added), or 0 if the event is not added.
+ */
+int event_pending(const struct event *ev, short events, struct timeval *tv);
+
+
+/**
+  Test if an event structure might be initialized.
+
+  The event_initialized() function can be used to check if an event has been
+  initialized.
+
+  Warning: This function is only useful for distinguishing a a zeroed-out
+    piece of memory from an initialized event, it can easily be confused by
+    uninitialized memory.  Thus, it should ONLY be used to distinguish an
+    initialized event from zero.
+
+  @param ev an event structure to be tested
+  @return 1 if the structure might be initialized, or 0 if it has not been
+          initialized
+ */
+int event_initialized(const struct event *ev);
+
+/**
+   Get the signal number assigned to a signal event
+*/
+#define event_get_signal(ev) ((int)event_get_fd(ev))
+
+/**
+   Get the socket or signal assigned to an event, or -1 if the event has
+   no socket.
+*/
+evutil_socket_t event_get_fd(const struct event *ev);
+
+/**
+   Get the event_base associated with an event.
+*/
+struct event_base *event_get_base(const struct event *ev);
+
+/**
+   Return the events (EV_READ, EV_WRITE, etc) assigned to an event.
+*/
+short event_get_events(const struct event *ev);
+
+/**
+   Return the callback assigned to an event.
+*/
+event_callback_fn event_get_callback(const struct event *ev);
+
+/**
+   Return the callback argument assigned to an event.
+*/
+void *event_get_callback_arg(const struct event *ev);
+
+/**
+   Extract _all_ of arguments given to construct a given event.  The
+   event_base is copied into *base_out, the fd is copied into *fd_out, and so
+   on.
+
+   If any of the "_out" arguments is NULL, it will be ignored.
+ */
+void event_get_assignment(const struct event *event,
+    struct event_base **base_out, evutil_socket_t *fd_out, short *events_out,
+    event_callback_fn *callback_out, void **arg_out);
+
+/**
+   Return the size of struct event that the Libevent library was compiled
+   with.
+
+   This will be NO GREATER than sizeof(struct event) if you're running with
+   the same version of Libevent that your application was built with, but
+   otherwise might not.
+
+   Note that it might be SMALLER than sizeof(struct event) if some future
+   version of Libevent adds extra padding to the end of struct event.
+   We might do this to help ensure ABI-compatibility between different
+   versions of Libevent.
+ */
+size_t event_get_struct_event_size(void);
+
+/**
+   Get the Libevent version.
+
+   Note that this will give you the version of the library that you're
+   currently linked against, not the version of the headers that you've
+   compiled against.
+
+   @return a string containing the version number of Libevent
+*/
+const char *event_get_version(void);
+
+/**
+   Return a numeric representation of Libevent's version.
+
+   Note that this will give you the version of the library that you're
+   currently linked against, not the version of the headers you've used to
+   compile.
+
+   The format uses one byte each for the major, minor, and patchlevel parts of
+   the version number.  The low-order byte is unused.  For example, version
+   2.0.1-alpha has a numeric representation of 0x02000100
+*/
+ev_uint32_t event_get_version_number(void);
+
+/** As event_get_version, but gives the version of Libevent's headers. */
+#define LIBEVENT_VERSION _EVENT_VERSION
+/** As event_get_version_number, but gives the version number of Libevent's
+ * headers. */
+#define LIBEVENT_VERSION_NUMBER _EVENT_NUMERIC_VERSION
+
+/** Largest number of priorities that Libevent can support. */
+#define EVENT_MAX_PRIORITIES 256
+/**
+  Set the number of different event priorities
+
+  By default Libevent schedules all active events with the same priority.
+  However, some time it is desirable to process some events with a higher
+  priority than others.  For that reason, Libevent supports strict priority
+  queues.  Active events with a lower priority are always processed before
+  events with a higher priority.
+
+  The number of different priorities can be set initially with the
+  event_base_priority_init() function.  This function should be called
+  before the first call to event_base_dispatch().  The
+  event_priority_set() function can be used to assign a priority to an
+  event.  By default, Libevent assigns the middle priority to all events
+  unless their priority is explicitly set.
+
+  Note that urgent-priority events can starve less-urgent events: after
+  running all urgent-priority callbacks, Libevent checks for more urgent
+  events again, before running less-urgent events.  Less-urgent events
+  will not have their callbacks run until there are no events more urgent
+  than them that want to be active.
+
+  @param eb the event_base structure returned by event_base_new()
+  @param npriorities the maximum number of priorities
+  @return 0 if successful, or -1 if an error occurred
+  @see event_priority_set()
+ */
+int	event_base_priority_init(struct event_base *, int);
+
+/**
+  Assign a priority to an event.
+
+  @param ev an event struct
+  @param priority the new priority to be assigned
+  @return 0 if successful, or -1 if an error occurred
+  @see event_priority_init()
+  */
+int	event_priority_set(struct event *, int);
+
+/**
+   Prepare an event_base to use a large number of timeouts with the same
+   duration.
+
+   Libevent's default scheduling algorithm is optimized for having a large
+   number of timeouts with their durations more or less randomly
+   distributed.  But if you have a large number of timeouts that all have
+   the same duration (for example, if you have a large number of
+   connections that all have a 10-second timeout), then you can improve
+   Libevent's performance by telling Libevent about it.
+
+   To do this, call this function with the common duration.  It will return a
+   pointer to a different, opaque timeout value.  (Don't depend on its actual
+   contents!)  When you use this timeout value in event_add(), Libevent will
+   schedule the event more efficiently.
+
+   (This optimization probably will not be worthwhile until you have thousands
+   or tens of thousands of events with the same timeout.)
+ */
+const struct timeval *event_base_init_common_timeout(struct event_base *base,
+    const struct timeval *duration);
+
+#if !defined(_EVENT_DISABLE_MM_REPLACEMENT) || defined(_EVENT_IN_DOXYGEN)
+/**
+ Override the functions that Libevent uses for memory management.
+
+ Usually, Libevent uses the standard libc functions malloc, realloc, and
+ free to allocate memory.  Passing replacements for those functions to
+ event_set_mem_functions() overrides this behavior.
+
+ Note that all memory returned from Libevent will be allocated by the
+ replacement functions rather than by malloc() and realloc().  Thus, if you
+ have replaced those functions, it will not be appropriate to free() memory
+ that you get from Libevent.  Instead, you must use the free_fn replacement
+ that you provided.
+
+ Note also that if you are going to call this function, you should do so
+ before any call to any Libevent function that does allocation.
+ Otherwise, those funtions will allocate their memory using malloc(), but
+ then later free it using your provided free_fn.
+
+ @param malloc_fn A replacement for malloc.
+ @param realloc_fn A replacement for realloc
+ @param free_fn A replacement for free.
+ **/
+void event_set_mem_functions(
+	void *(*malloc_fn)(size_t sz),
+	void *(*realloc_fn)(void *ptr, size_t sz),
+	void (*free_fn)(void *ptr));
+/** This definition is present if Libevent was built with support for
+    event_set_mem_functions() */
+#define EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
+#endif
+
+void event_base_dump_events(struct event_base *, FILE *);
+
+/** Sets 'tv' to the current time (as returned by gettimeofday()),
+    looking at the cached value in 'base' if possible, and calling
+    gettimeofday() or clock_gettime() as appropriate if there is no
+    cached time.
+
+    Generally, this value will only be cached while actually
+    processing event callbacks, and may be very inaccuate if your
+    callbacks take a long time to execute.
+
+    Returns 0 on success, negative on failure.
+ */
+int event_base_gettimeofday_cached(struct event_base *base,
+    struct timeval *tv);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_EVENT_H_ */

Property changes on: lab4/.minix-src/include/event2/event.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/tmmintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/tmmintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/tmmintrin.h	(revision 13)
@@ -0,0 +1,225 @@
+/*===---- tmmintrin.h - SSSE3 intrinsics -----------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+ 
+#ifndef __TMMINTRIN_H
+#define __TMMINTRIN_H
+
+#ifndef __SSSE3__
+#error "SSSE3 instruction set not enabled"
+#else
+
+#include <pmmintrin.h>
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_abs_pi8(__m64 __a)
+{
+    return (__m64)__builtin_ia32_pabsb((__v8qi)__a);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_abs_epi8(__m128i __a)
+{
+    return (__m128i)__builtin_ia32_pabsb128((__v16qi)__a);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_abs_pi16(__m64 __a)
+{
+    return (__m64)__builtin_ia32_pabsw((__v4hi)__a);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_abs_epi16(__m128i __a)
+{
+    return (__m128i)__builtin_ia32_pabsw128((__v8hi)__a);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_abs_pi32(__m64 __a)
+{
+    return (__m64)__builtin_ia32_pabsd((__v2si)__a);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_abs_epi32(__m128i __a)
+{
+    return (__m128i)__builtin_ia32_pabsd128((__v4si)__a);
+}
+
+#define _mm_alignr_epi8(a, b, n) __extension__ ({ \
+  __m128i __a = (a); \
+  __m128i __b = (b); \
+  (__m128i)__builtin_ia32_palignr128((__v16qi)__a, (__v16qi)__b, (n)); })
+
+#define _mm_alignr_pi8(a, b, n) __extension__ ({ \
+  __m64 __a = (a); \
+  __m64 __b = (b); \
+  (__m64)__builtin_ia32_palignr((__v8qi)__a, (__v8qi)__b, (n)); })
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_hadd_epi16(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_phaddw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_hadd_epi32(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_phaddd128((__v4si)__a, (__v4si)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_hadd_pi16(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_phaddw((__v4hi)__a, (__v4hi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_hadd_pi32(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_phaddd((__v2si)__a, (__v2si)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_hadds_epi16(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_phaddsw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_hadds_pi16(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_phaddsw((__v4hi)__a, (__v4hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_hsub_epi16(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_phsubw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_hsub_epi32(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_phsubd128((__v4si)__a, (__v4si)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_hsub_pi16(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_phsubw((__v4hi)__a, (__v4hi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_hsub_pi32(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_phsubd((__v2si)__a, (__v2si)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_hsubs_epi16(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_phsubsw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_hsubs_pi16(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_phsubsw((__v4hi)__a, (__v4hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maddubs_epi16(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_pmaddubsw128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_maddubs_pi16(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_pmaddubsw((__v8qi)__a, (__v8qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_mulhrs_epi16(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_pmulhrsw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_mulhrs_pi16(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_pmulhrsw((__v4hi)__a, (__v4hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_shuffle_epi8(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_pshufb128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_shuffle_pi8(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_pshufb((__v8qi)__a, (__v8qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sign_epi8(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_psignb128((__v16qi)__a, (__v16qi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sign_epi16(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_psignw128((__v8hi)__a, (__v8hi)__b);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sign_epi32(__m128i __a, __m128i __b)
+{
+    return (__m128i)__builtin_ia32_psignd128((__v4si)__a, (__v4si)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sign_pi8(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_psignb((__v8qi)__a, (__v8qi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sign_pi16(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_psignw((__v4hi)__a, (__v4hi)__b);
+}
+
+static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
+_mm_sign_pi32(__m64 __a, __m64 __b)
+{
+    return (__m64)__builtin_ia32_psignd((__v2si)__a, (__v2si)__b);
+}
+
+#endif /* __SSSE3__ */
+
+#endif /* __TMMINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/tmmintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/clang-3.6/xopintrin.h
===================================================================
--- lab4/.minix-src/include/clang-3.6/xopintrin.h	(nonexistent)
+++ lab4/.minix-src/include/clang-3.6/xopintrin.h	(revision 13)
@@ -0,0 +1,804 @@
+/*===---- xopintrin.h - XOP intrinsics -------------------------------------===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __X86INTRIN_H
+#error "Never use <xopintrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+#ifndef __XOPINTRIN_H
+#define __XOPINTRIN_H
+
+#ifndef __XOP__
+# error "XOP instruction set is not enabled"
+#else
+
+#include <fma4intrin.h>
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maccs_epi16(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmacssww((__v8hi)__A, (__v8hi)__B, (__v8hi)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_macc_epi16(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmacsww((__v8hi)__A, (__v8hi)__B, (__v8hi)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maccsd_epi16(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmacsswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maccd_epi16(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmacswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maccs_epi32(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmacssdd((__v4si)__A, (__v4si)__B, (__v4si)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_macc_epi32(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmacsdd((__v4si)__A, (__v4si)__B, (__v4si)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maccslo_epi32(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmacssdql((__v4si)__A, (__v4si)__B, (__v2di)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_macclo_epi32(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmacsdql((__v4si)__A, (__v4si)__B, (__v2di)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maccshi_epi32(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmacssdqh((__v4si)__A, (__v4si)__B, (__v2di)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_macchi_epi32(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmacsdqh((__v4si)__A, (__v4si)__B, (__v2di)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maddsd_epi16(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmadcsswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maddd_epi16(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpmadcswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddw_epi8(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphaddbw((__v16qi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddd_epi8(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphaddbd((__v16qi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddq_epi8(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphaddbq((__v16qi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddd_epi16(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphaddwd((__v8hi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddq_epi16(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphaddwq((__v8hi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddq_epi32(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphadddq((__v4si)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddw_epu8(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphaddubw((__v16qi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddd_epu8(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphaddubd((__v16qi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddq_epu8(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphaddubq((__v16qi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddd_epu16(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphadduwd((__v8hi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddq_epu16(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphadduwq((__v8hi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_haddq_epu32(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphaddudq((__v4si)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_hsubw_epi8(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphsubbw((__v16qi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_hsubd_epi16(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphsubwd((__v8hi)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_hsubq_epi32(__m128i __A)
+{
+  return (__m128i)__builtin_ia32_vphsubdq((__v4si)__A);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_cmov_si128(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpcmov(__A, __B, __C);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_cmov_si256(__m256i __A, __m256i __B, __m256i __C)
+{
+  return (__m256i)__builtin_ia32_vpcmov_256(__A, __B, __C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_perm_epi8(__m128i __A, __m128i __B, __m128i __C)
+{
+  return (__m128i)__builtin_ia32_vpperm((__v16qi)__A, (__v16qi)__B, (__v16qi)__C);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_rot_epi8(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vprotb((__v16qi)__A, (__v16qi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_rot_epi16(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vprotw((__v8hi)__A, (__v8hi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_rot_epi32(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vprotd((__v4si)__A, (__v4si)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_rot_epi64(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vprotq((__v2di)__A, (__v2di)__B);
+}
+
+#define _mm_roti_epi8(A, N) __extension__ ({ \
+  __m128i __A = (A); \
+  (__m128i)__builtin_ia32_vprotbi((__v16qi)__A, (N)); })
+
+#define _mm_roti_epi16(A, N) __extension__ ({ \
+  __m128i __A = (A); \
+  (__m128i)__builtin_ia32_vprotwi((__v8hi)__A, (N)); })
+
+#define _mm_roti_epi32(A, N) __extension__ ({ \
+  __m128i __A = (A); \
+  (__m128i)__builtin_ia32_vprotdi((__v4si)__A, (N)); })
+
+#define _mm_roti_epi64(A, N) __extension__ ({ \
+  __m128i __A = (A); \
+  (__m128i)__builtin_ia32_vprotqi((__v2di)__A, (N)); })
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_shl_epi8(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshlb((__v16qi)__A, (__v16qi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_shl_epi16(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshlw((__v8hi)__A, (__v8hi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_shl_epi32(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshld((__v4si)__A, (__v4si)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_shl_epi64(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshlq((__v2di)__A, (__v2di)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha_epi8(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshab((__v16qi)__A, (__v16qi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha_epi16(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshaw((__v8hi)__A, (__v8hi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha_epi32(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshad((__v4si)__A, (__v4si)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha_epi64(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshaq((__v2di)__A, (__v2di)__B);
+}
+
+#define _mm_com_epu8(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomub((__v16qi)__A, (__v16qi)__B, (N)); })
+
+#define _mm_com_epu16(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomuw((__v8hi)__A, (__v8hi)__B, (N)); })
+
+#define _mm_com_epu32(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomud((__v4si)__A, (__v4si)__B, (N)); })
+
+#define _mm_com_epu64(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomuq((__v2di)__A, (__v2di)__B, (N)); })
+
+#define _mm_com_epi8(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomb((__v16qi)__A, (__v16qi)__B, (N)); })
+
+#define _mm_com_epi16(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomw((__v8hi)__A, (__v8hi)__B, (N)); })
+
+#define _mm_com_epi32(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomd((__v4si)__A, (__v4si)__B, (N)); })
+
+#define _mm_com_epi64(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomq((__v2di)__A, (__v2di)__B, (N)); })
+
+#define _MM_PCOMCTRL_LT    0
+#define _MM_PCOMCTRL_LE    1
+#define _MM_PCOMCTRL_GT    2
+#define _MM_PCOMCTRL_GE    3
+#define _MM_PCOMCTRL_EQ    4
+#define _MM_PCOMCTRL_NEQ   5
+#define _MM_PCOMCTRL_FALSE 6
+#define _MM_PCOMCTRL_TRUE  7
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comlt_epu8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_LT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comle_epu8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_LE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comgt_epu8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_GT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comge_epu8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_GE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comeq_epu8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_EQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comneq_epu8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_NEQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comfalse_epu8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_FALSE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comtrue_epu8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_TRUE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comlt_epu16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_LT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comle_epu16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_LE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comgt_epu16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_GT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comge_epu16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_GE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comeq_epu16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_EQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comneq_epu16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_NEQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comfalse_epu16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_FALSE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comtrue_epu16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_TRUE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comlt_epu32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_LT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comle_epu32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_LE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comgt_epu32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_GT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comge_epu32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_GE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comeq_epu32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_EQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comneq_epu32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_NEQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comfalse_epu32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_FALSE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comtrue_epu32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_TRUE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comlt_epu64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_LT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comle_epu64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_LE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comgt_epu64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_GT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comge_epu64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_GE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comeq_epu64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_EQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comneq_epu64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_NEQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comfalse_epu64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_FALSE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comtrue_epu64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_TRUE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comlt_epi8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_LT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comle_epi8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_LE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comgt_epi8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_GT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comge_epi8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_GE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comeq_epi8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_EQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comneq_epi8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_NEQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comfalse_epi8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_FALSE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comtrue_epi8(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_TRUE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comlt_epi16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_LT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comle_epi16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_LE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comgt_epi16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_GT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comge_epi16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_GE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comeq_epi16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_EQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comneq_epi16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_NEQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comfalse_epi16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_FALSE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comtrue_epi16(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_TRUE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comlt_epi32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_LT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comle_epi32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_LE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comgt_epi32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_GT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comge_epi32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_GE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comeq_epi32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_EQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comneq_epi32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_NEQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comfalse_epi32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_FALSE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comtrue_epi32(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_TRUE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comlt_epi64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_LT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comle_epi64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_LE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comgt_epi64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_GT);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comge_epi64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_GE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comeq_epi64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_EQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comneq_epi64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_NEQ);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comfalse_epi64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_FALSE);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_comtrue_epi64(__m128i __A, __m128i __B)
+{
+  return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_TRUE);
+}
+
+#define _mm_permute2_pd(X, Y, C, I) __extension__ ({ \
+  __m128d __X = (X); \
+  __m128d __Y = (Y); \
+  __m128i __C = (C); \
+  (__m128d)__builtin_ia32_vpermil2pd((__v2df)__X, (__v2df)__Y, \
+                                     (__v2di)__C, (I)); })
+
+#define _mm256_permute2_pd(X, Y, C, I) __extension__ ({ \
+  __m256d __X = (X); \
+  __m256d __Y = (Y); \
+  __m256i __C = (C); \
+  (__m256d)__builtin_ia32_vpermil2pd256((__v4df)__X, (__v4df)__Y, \
+                                        (__v4di)__C, (I)); })
+
+#define _mm_permute2_ps(X, Y, C, I) __extension__ ({ \
+  __m128 __X = (X); \
+  __m128 __Y = (Y); \
+  __m128i __C = (C); \
+  (__m128)__builtin_ia32_vpermil2ps((__v4sf)__X, (__v4sf)__Y, \
+                                    (__v4si)__C, (I)); })
+
+#define _mm256_permute2_ps(X, Y, C, I) __extension__ ({ \
+  __m256 __X = (X); \
+  __m256 __Y = (Y); \
+  __m256i __C = (C); \
+  (__m256)__builtin_ia32_vpermil2ps256((__v8sf)__X, (__v8sf)__Y, \
+                                       (__v8si)__C, (I)); })
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_frcz_ss(__m128 __A)
+{
+  return (__m128)__builtin_ia32_vfrczss((__v4sf)__A);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_frcz_sd(__m128d __A)
+{
+  return (__m128d)__builtin_ia32_vfrczsd((__v2df)__A);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_frcz_ps(__m128 __A)
+{
+  return (__m128)__builtin_ia32_vfrczps((__v4sf)__A);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_frcz_pd(__m128d __A)
+{
+  return (__m128d)__builtin_ia32_vfrczpd((__v2df)__A);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm256_frcz_ps(__m256 __A)
+{
+  return (__m256)__builtin_ia32_vfrczps256((__v8sf)__A);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm256_frcz_pd(__m256d __A)
+{
+  return (__m256d)__builtin_ia32_vfrczpd256((__v4df)__A);
+}
+
+#endif /* __XOP__ */
+
+#endif /* __XOPINTRIN_H */

Property changes on: lab4/.minix-src/include/clang-3.6/xopintrin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/http_compat.h
===================================================================
--- lab4/.minix-src/include/event2/http_compat.h	(nonexistent)
+++ lab4/.minix-src/include/event2/http_compat.h	(revision 13)
@@ -0,0 +1,92 @@
+/*	$NetBSD: http_compat.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*	$NetBSD: http_compat.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_HTTP_COMPAT_H_
+#define _EVENT2_HTTP_COMPAT_H_
+
+/** @file event2/http_compat.h
+
+  Potentially non-threadsafe versions of the functions in http.h: provided
+  only for backwards compatibility.
+
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+/* For int types. */
+#include <event2/util.h>
+
+/**
+ * Start an HTTP server on the specified address and port
+ *
+ * @deprecated It does not allow an event base to be specified
+ *
+ * @param address the address to which the HTTP server should be bound
+ * @param port the port number on which the HTTP server should listen
+ * @return an struct evhttp object
+ */
+struct evhttp *evhttp_start(const char *address, unsigned short port);
+
+/**
+ * A connection object that can be used to for making HTTP requests.  The
+ * connection object tries to establish the connection when it is given an
+ * http request object.
+ *
+ * @deprecated It does not allow an event base to be specified
+ */
+struct evhttp_connection *evhttp_connection_new(
+	const char *address, unsigned short port);
+
+/**
+ * Associates an event base with the connection - can only be called
+ * on a freshly created connection object that has not been used yet.
+ *
+ * @deprecated XXXX Why?
+ */
+void evhttp_connection_set_base(struct evhttp_connection *evcon,
+    struct event_base *base);
+
+
+/** Returns the request URI */
+#define evhttp_request_uri evhttp_request_get_uri
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_EVENT_COMPAT_H_ */

Property changes on: lab4/.minix-src/include/event2/http_compat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/pcidevs.h
===================================================================
--- lab4/.minix-src/include/dev/pci/pcidevs.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/pcidevs.h	(revision 13)
@@ -0,0 +1,6186 @@
+/*	$NetBSD: pcidevs.h,v 1.1229 2015/08/28 13:10:42 nonaka Exp $	*/
+
+/*
+ * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
+ *
+ * generated from:
+ *	NetBSD: pcidevs,v 1.1235 2015/08/28 13:09:48 nonaka Exp
+ */
+
+/*
+ * Copyright (c) 1995, 1996 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou
+ *	for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+/*
+ * NOTE: a fairly complete list of PCI codes can be found at:
+ *
+ *	http://www.pcidatabase.com/
+ *
+ * (but it doesn't always seem to match vendor documentation)
+ *
+ * NOTE: As per tron@NetBSD.org, the proper update procedure is
+ *
+ * 1.) Change "src/sys/dev/pci/pcidevs".
+ * 2.) Commit "src/sys/dev/pci/pcidevs".
+ * 3.) Execute "make -f Makefile.pcidevs" in "src/sys/dev/pci".
+ * 4.) Commit "src/sys/dev/pci/pcidevs.h" and "src/sys/dev/pci/pcidevs_data.h".
+ */
+
+/*
+ * Use "make -f Makefile.pcidevs" to regenerate pcidevs.h and pcidevs_data.h
+ */
+
+/*
+ * List of known PCI vendors
+ */
+
+#define	PCI_VENDOR_PEAK	0x001c		/* Peak System Technik */
+#define	PCI_VENDOR_MARTINMARIETTA	0x003d		/* Martin-Marietta */
+#define	PCI_VENDOR_HAUPPAUGE	0x0070		/* Hauppauge Computer Works */
+#define	PCI_VENDOR_DYNALINK	0x0675		/* Dynalink */
+#define	PCI_VENDOR_COMPAQ	0x0e11		/* Compaq */
+#define	PCI_VENDOR_SYMBIOS	0x1000		/* Symbios Logic */
+#define	PCI_VENDOR_ATI	0x1002		/* ATI Technologies */
+#define	PCI_VENDOR_ULSI	0x1003		/* ULSI Systems */
+#define	PCI_VENDOR_VLSI	0x1004		/* VLSI Technology */
+#define	PCI_VENDOR_AVANCE	0x1005		/* Avance Logic */
+#define	PCI_VENDOR_REPLY	0x1006		/* Reply Group */
+#define	PCI_VENDOR_NETFRAME	0x1007		/* NetFrame Systems */
+#define	PCI_VENDOR_EPSON	0x1008		/* Epson */
+#define	PCI_VENDOR_PHOENIX	0x100a		/* Phoenix Technologies */
+#define	PCI_VENDOR_NS	0x100b		/* National Semiconductor */
+#define	PCI_VENDOR_TSENG	0x100c		/* Tseng Labs */
+#define	PCI_VENDOR_AST	0x100d		/* AST Research */
+#define	PCI_VENDOR_WEITEK	0x100e		/* Weitek */
+#define	PCI_VENDOR_VIDEOLOGIC	0x1010		/* Video Logic */
+#define	PCI_VENDOR_DEC	0x1011		/* Digital Equipment */
+#define	PCI_VENDOR_MICRONICS	0x1012		/* Micronics Computers */
+#define	PCI_VENDOR_CIRRUS	0x1013		/* Cirrus Logic */
+#define	PCI_VENDOR_IBM	0x1014		/* IBM */
+#define	PCI_VENDOR_LSIL	0x1015		/* LSI Logic of Canada */
+#define	PCI_VENDOR_ICLPERSONAL	0x1016		/* ICL Personal Systems */
+#define	PCI_VENDOR_SPEA	0x1017		/* SPEA Software */
+#define	PCI_VENDOR_UNISYS	0x1018		/* Unisys Systems */
+#define	PCI_VENDOR_ELITEGROUP	0x1019		/* Elitegroup Computer Systems */
+#define	PCI_VENDOR_NCR	0x101a		/* AT&T Global Information Systems */
+#define	PCI_VENDOR_VITESSE	0x101b		/* Vitesse Semiconductor */
+#define	PCI_VENDOR_WD	0x101c		/* Western Digital */
+#define	PCI_VENDOR_AMI	0x101e		/* American Megatrends */
+#define	PCI_VENDOR_PICTURETEL	0x101f		/* PictureTel */
+#define	PCI_VENDOR_HITACHICOMP	0x1020		/* Hitachi Computer Products */
+#define	PCI_VENDOR_OKI	0x1021		/* OKI Electric Industry */
+#define	PCI_VENDOR_AMD	0x1022		/* AMD */
+#define	PCI_VENDOR_TRIDENT	0x1023		/* Trident Microsystems */
+#define	PCI_VENDOR_ZENITH	0x1024		/* Zenith Data Systems */
+#define	PCI_VENDOR_ACER	0x1025		/* Acer */
+#define	PCI_VENDOR_DELL	0x1028		/* Dell Computer */
+#define	PCI_VENDOR_SNI	0x1029		/* Siemens Nixdorf AG */
+#define	PCI_VENDOR_LSILOGIC	0x102a		/* LSI Logic, Headland div. */
+#define	PCI_VENDOR_MATROX	0x102b		/* Matrox */
+#define	PCI_VENDOR_CHIPS	0x102c		/* Chips and Technologies */
+#define	PCI_VENDOR_WYSE	0x102d		/* WYSE Technology */
+#define	PCI_VENDOR_OLIVETTI	0x102e		/* Olivetti Advanced Technology */
+#define	PCI_VENDOR_TOSHIBA	0x102f		/* Toshiba America */
+#define	PCI_VENDOR_TMCRESEARCH	0x1030		/* TMC Research */
+#define	PCI_VENDOR_MIRO	0x1031		/* Miro Computer Products */
+#define	PCI_VENDOR_COMPAQ2	0x1032		/* Compaq (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_NEC	0x1033		/* NEC */
+#define	PCI_VENDOR_BURNDY	0x1034		/* Burndy */
+#define	PCI_VENDOR_COMPCOMM	0x1035		/* Comp. & Comm. Research Lab */
+#define	PCI_VENDOR_FUTUREDOMAIN	0x1036		/* Future Domain */
+#define	PCI_VENDOR_HITACHIMICRO	0x1037		/* Hitach Microsystems */
+#define	PCI_VENDOR_AMP	0x1038		/* AMP */
+#define	PCI_VENDOR_SIS	0x1039		/* Silicon Integrated System */
+#define	PCI_VENDOR_SEIKOEPSON	0x103a		/* Seiko Epson */
+#define	PCI_VENDOR_TATUNGAMERICA	0x103b		/* Tatung of America */
+#define	PCI_VENDOR_HP	0x103c		/* Hewlett-Packard */
+#define	PCI_VENDOR_SOLLIDAY	0x103e		/* Solliday Engineering */
+#define	PCI_VENDOR_LOGICMODELLING	0x103f		/* Logic Modeling */
+#define	PCI_VENDOR_KPC	0x1040		/* Kubota Pacific */
+#define	PCI_VENDOR_COMPUTREND	0x1041		/* Computrend */
+#define	PCI_VENDOR_PCTECH	0x1042		/* PC Technology */
+#define	PCI_VENDOR_ASUSTEK	0x1043		/* Asustek Computer */
+#define	PCI_VENDOR_DPT	0x1044		/* Distributed Processing Technology */
+#define	PCI_VENDOR_OPTI	0x1045		/* Opti */
+#define	PCI_VENDOR_IPCCORP	0x1046		/* IPC */
+#define	PCI_VENDOR_GENOA	0x1047		/* Genoa Systems */
+#define	PCI_VENDOR_ELSA	0x1048		/* Elsa */
+#define	PCI_VENDOR_FOUNTAINTECH	0x1049		/* Fountain Technology */
+#define	PCI_VENDOR_SGSTHOMSON	0x104a		/* SGS-Thomson Microelectronics */
+#define	PCI_VENDOR_BUSLOGIC	0x104b		/* BusLogic */
+#define	PCI_VENDOR_TI	0x104c		/* Texas Instruments */
+#define	PCI_VENDOR_SONY	0x104d		/* Sony */
+#define	PCI_VENDOR_OAKTECH	0x104e		/* Oak Technology */
+#define	PCI_VENDOR_COTIME	0x104f		/* Co-time Computer */
+#define	PCI_VENDOR_WINBOND	0x1050		/* Winbond Electronics */
+#define	PCI_VENDOR_ANIGMA	0x1051		/* Anigma */
+#define	PCI_VENDOR_YOUNGMICRO	0x1052		/* Young Micro Systems */
+#define	PCI_VENDOR_HITACHI	0x1054		/* Hitachi */
+#define	PCI_VENDOR_EFARMICRO	0x1055		/* Efar Microsystems */
+#define	PCI_VENDOR_ICL	0x1056		/* ICL */
+#define	PCI_VENDOR_MOT	0x1057		/* Motorola */
+#define	PCI_VENDOR_ETR	0x1058		/* Electronics & Telec. RSH */
+#define	PCI_VENDOR_TEKNOR	0x1059		/* Teknor Microsystems */
+#define	PCI_VENDOR_PROMISE	0x105a		/* Promise Technology */
+#define	PCI_VENDOR_FOXCONN	0x105b		/* Foxconn International */
+#define	PCI_VENDOR_WIPRO	0x105c		/* Wipro Infotech */
+#define	PCI_VENDOR_NUMBER9	0x105d		/* Number 9 Computer Company */
+#define	PCI_VENDOR_VTECH	0x105e		/* Vtech Computers */
+#define	PCI_VENDOR_INFOTRONIC	0x105f		/* Infotronic America */
+#define	PCI_VENDOR_UMC	0x1060		/* United Microelectronics */
+#define	PCI_VENDOR_ITT	0x1061		/* I. T. T. */
+#define	PCI_VENDOR_MASPAR	0x1062		/* MasPar Computer */
+#define	PCI_VENDOR_OCEANOA	0x1063		/* Ocean Office Automation */
+#define	PCI_VENDOR_ALCATEL	0x1064		/* Alcatel CIT */
+#define	PCI_VENDOR_TEXASMICRO	0x1065		/* Texas Microsystems */
+#define	PCI_VENDOR_PICOPOWER	0x1066		/* Picopower Technology */
+#define	PCI_VENDOR_MITSUBISHI	0x1067		/* Mitsubishi Electronics */
+#define	PCI_VENDOR_DIVERSIFIED	0x1068		/* Diversified Technology */
+#define	PCI_VENDOR_MYLEX	0x1069		/* Mylex */
+#define	PCI_VENDOR_ATEN	0x106a		/* Aten Research */
+#define	PCI_VENDOR_APPLE	0x106b		/* Apple Computer */
+#define	PCI_VENDOR_HYUNDAI	0x106c		/* Hyundai Electronics America */
+#define	PCI_VENDOR_SEQUENT	0x106d		/* Sequent */
+#define	PCI_VENDOR_DFI	0x106e		/* DFI */
+#define	PCI_VENDOR_CITYGATE	0x106f		/* City Gate Development */
+#define	PCI_VENDOR_DAEWOO	0x1070		/* Daewoo Telecom */
+#define	PCI_VENDOR_MITAC	0x1071		/* Mitac */
+#define	PCI_VENDOR_GIT	0x1072		/* GIT */
+#define	PCI_VENDOR_YAMAHA	0x1073		/* Yamaha */
+#define	PCI_VENDOR_NEXGEN	0x1074		/* NexGen Microsystems */
+#define	PCI_VENDOR_AIR	0x1075		/* Advanced Integration Research */
+#define	PCI_VENDOR_CHAINTECH	0x1076		/* Chaintech Computer */
+#define	PCI_VENDOR_QLOGIC	0x1077		/* QLogic */
+#define	PCI_VENDOR_CYRIX	0x1078		/* Cyrix */
+#define	PCI_VENDOR_IBUS	0x1079		/* I-Bus */
+#define	PCI_VENDOR_NETWORTH	0x107a		/* NetWorth */
+#define	PCI_VENDOR_GATEWAY	0x107b		/* Gateway 2000 */
+#define	PCI_VENDOR_GOLDSTAR	0x107c		/* Goldstar */
+#define	PCI_VENDOR_LEADTEK	0x107d		/* LeadTek Research */
+#define	PCI_VENDOR_INTERPHASE	0x107e		/* Interphase */
+#define	PCI_VENDOR_DATATECH	0x107f		/* Data Technology */
+#define	PCI_VENDOR_CONTAQ	0x1080		/* Contaq Microsystems */
+#define	PCI_VENDOR_SUPERMAC	0x1081		/* Supermac Technology */
+#define	PCI_VENDOR_EFA	0x1082		/* EFA of America */
+#define	PCI_VENDOR_FOREX	0x1083		/* Forex Computer */
+#define	PCI_VENDOR_PARADOR	0x1084		/* Parador */
+#define	PCI_VENDOR_TULIP	0x1085		/* Tulip Computers */
+#define	PCI_VENDOR_JBOND	0x1086		/* J. Bond Computer Systems */
+#define	PCI_VENDOR_CACHECOMP	0x1087		/* Cache Computer */
+#define	PCI_VENDOR_MICROCOMP	0x1088		/* Microcomputer Systems */
+#define	PCI_VENDOR_DG	0x1089		/* Data General */
+#define	PCI_VENDOR_BIT3	0x108a		/* Bit3 Computer */
+#define	PCI_VENDOR_ELONEX	0x108c		/* Elonex PLC c/o Oakleigh Systems */
+#define	PCI_VENDOR_OLICOM	0x108d		/* Olicom */
+#define	PCI_VENDOR_SUN	0x108e		/* Sun Microsystems */
+#define	PCI_VENDOR_SYSTEMSOFT	0x108f		/* Systemsoft */
+#define	PCI_VENDOR_ENCORE	0x1090		/* Encore Computer */
+#define	PCI_VENDOR_INTERGRAPH	0x1091		/* Intergraph */
+#define	PCI_VENDOR_DIAMOND	0x1092		/* Diamond Computer Systems */
+#define	PCI_VENDOR_NATIONALINST	0x1093		/* National Instruments */
+#define	PCI_VENDOR_FICOMP	0x1094		/* First Int'l Computers */
+#define	PCI_VENDOR_CMDTECH	0x1095		/* CMD Technology */
+#define	PCI_VENDOR_ALACRON	0x1096		/* Alacron */
+#define	PCI_VENDOR_APPIAN	0x1097		/* Appian Technology */
+#define	PCI_VENDOR_QUANTUMDESIGNS	0x1098		/* Quantum Designs */
+#define	PCI_VENDOR_SAMSUNGELEC	0x1099		/* Samsung Electronics */
+#define	PCI_VENDOR_PACKARDBELL	0x109a		/* Packard Bell */
+#define	PCI_VENDOR_GEMLIGHT	0x109b		/* Gemlight Computer */
+#define	PCI_VENDOR_MEGACHIPS	0x109c		/* Megachips */
+#define	PCI_VENDOR_ZIDA	0x109d		/* Zida Technologies */
+#define	PCI_VENDOR_BROOKTREE	0x109e		/* Brooktree */
+#define	PCI_VENDOR_TRIGEM	0x109f		/* Trigem Computer */
+#define	PCI_VENDOR_MEIDENSHA	0x10a0		/* Meidensha */
+#define	PCI_VENDOR_JUKO	0x10a1		/* Juko Electronics */
+#define	PCI_VENDOR_QUANTUM	0x10a2		/* Quantum */
+#define	PCI_VENDOR_EVEREX	0x10a3		/* Everex Systems */
+#define	PCI_VENDOR_GLOBE	0x10a4		/* Globe Manufacturing Sales */
+#define	PCI_VENDOR_RACAL	0x10a5		/* Racal Interlan */
+#define	PCI_VENDOR_INFORMTECH	0x10a6		/* Informtech Industrial */
+#define	PCI_VENDOR_BENCHMARQ	0x10a7		/* Benchmarq Microelectronics */
+#define	PCI_VENDOR_SIERRA	0x10a8		/* Sierra Semiconductor */
+#define	PCI_VENDOR_SGI	0x10a9		/* Silicon Graphics */
+#define	PCI_VENDOR_ACC	0x10aa		/* ACC Microelectronics */
+#define	PCI_VENDOR_DIGICOM	0x10ab		/* Digicom */
+#define	PCI_VENDOR_HONEYWELL	0x10ac		/* Honeywell IASD */
+#define	PCI_VENDOR_SYMPHONY	0x10ad		/* Symphony Labs */
+#define	PCI_VENDOR_CORNERSTONE	0x10ae		/* Cornerstone Technology */
+#define	PCI_VENDOR_MICROCOMPSON	0x10af		/* Micro Computer Sysytems (M) SON */
+#define	PCI_VENDOR_CARDEXPER	0x10b0		/* CardExpert Technology */
+#define	PCI_VENDOR_CABLETRON	0x10b1		/* Cabletron Systems */
+#define	PCI_VENDOR_RAYETHON	0x10b2		/* Raytheon */
+#define	PCI_VENDOR_DATABOOK	0x10b3		/* Databook */
+#define	PCI_VENDOR_STB	0x10b4		/* STB Systems */
+#define	PCI_VENDOR_PLX	0x10b5		/* PLX Technology */
+#define	PCI_VENDOR_MADGE	0x10b6		/* Madge Networks */
+#define	PCI_VENDOR_3COM	0x10b7		/* 3Com */
+#define	PCI_VENDOR_SMC	0x10b8		/* Standard Microsystems */
+#define	PCI_VENDOR_ALI	0x10b9		/* Acer Labs */
+#define	PCI_VENDOR_MITSUBISHIELEC	0x10ba		/* Mitsubishi Electronics */
+#define	PCI_VENDOR_DAPHA	0x10bb		/* Dapha Electronics */
+#define	PCI_VENDOR_ALR	0x10bc		/* Advanced Logic Research */
+#define	PCI_VENDOR_SURECOM	0x10bd		/* Surecom Technology */
+#define	PCI_VENDOR_TSENGLABS	0x10be		/* Tseng Labs International */
+#define	PCI_VENDOR_MOST	0x10bf		/* Most */
+#define	PCI_VENDOR_BOCA	0x10c0		/* Boca Research */
+#define	PCI_VENDOR_ICM	0x10c1		/* ICM */
+#define	PCI_VENDOR_AUSPEX	0x10c2		/* Auspex Systems */
+#define	PCI_VENDOR_SAMSUNGSEMI	0x10c3		/* Samsung Semiconductors */
+#define	PCI_VENDOR_AWARD	0x10c4		/* Award Software Int'l */
+#define	PCI_VENDOR_XEROX	0x10c5		/* Xerox */
+#define	PCI_VENDOR_RAMBUS	0x10c6		/* Rambus */
+#define	PCI_VENDOR_MEDIAVIS	0x10c7		/* Media Vision */
+#define	PCI_VENDOR_NEOMAGIC	0x10c8		/* Neomagic */
+#define	PCI_VENDOR_DATAEXPERT	0x10c9		/* Dataexpert */
+#define	PCI_VENDOR_FUJITSU	0x10ca		/* Fujitsu */
+#define	PCI_VENDOR_OMRON	0x10cb		/* Omron */
+#define	PCI_VENDOR_MENTOR	0x10cc		/* Mentor ARC */
+#define	PCI_VENDOR_ADVSYS	0x10cd		/* Advanced System Products */
+#define	PCI_VENDOR_RADIUS	0x10ce		/* Radius */
+#define	PCI_VENDOR_FUJITSU4	0x10cf		/* Fujitsu (4th PCI Vendor ID) */
+#define	PCI_VENDOR_FUJITSU2	0x10d0		/* Fujitsu (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_FUTUREPLUS	0x10d1		/* Future+ Systems */
+#define	PCI_VENDOR_MOLEX	0x10d2		/* Molex */
+#define	PCI_VENDOR_JABIL	0x10d3		/* Jabil Circuit */
+#define	PCI_VENDOR_HAULON	0x10d4		/* Hualon Microelectronics */
+#define	PCI_VENDOR_AUTOLOGIC	0x10d5		/* Autologic */
+#define	PCI_VENDOR_CETIA	0x10d6		/* Cetia */
+#define	PCI_VENDOR_BCM	0x10d7		/* BCM Advanced */
+#define	PCI_VENDOR_APL	0x10d8		/* Advanced Peripherals Labs */
+#define	PCI_VENDOR_MACRONIX	0x10d9		/* Macronix */
+#define	PCI_VENDOR_THOMASCONRAD	0x10da		/* Thomas-Conrad */
+#define	PCI_VENDOR_ROHM	0x10db		/* Rohm Research */
+#define	PCI_VENDOR_CERN	0x10dc		/* CERN/ECP/EDU */
+#define	PCI_VENDOR_ES	0x10dd		/* Evans & Sutherland */
+#define	PCI_VENDOR_NVIDIA	0x10de		/* NVIDIA */
+#define	PCI_VENDOR_EMULEX	0x10df		/* Emulex */
+#define	PCI_VENDOR_IMS	0x10e0		/* Integrated Micro Solutions */
+#define	PCI_VENDOR_TEKRAM	0x10e1		/* Tekram Technology (1st PCI Vendor ID) */
+#define	PCI_VENDOR_APTIX	0x10e2		/* Aptix */
+#define	PCI_VENDOR_NEWBRIDGE	0x10e3		/* Newbridge Microsystems / Tundra Semiconductor */
+#define	PCI_VENDOR_TANDEM	0x10e4		/* Tandem Computers */
+#define	PCI_VENDOR_MICROINDUSTRIES	0x10e5		/* Micro Industries */
+#define	PCI_VENDOR_GAINBERY	0x10e6		/* Gainbery Computer Products */
+#define	PCI_VENDOR_VADEM	0x10e7		/* Vadem */
+#define	PCI_VENDOR_AMCIRCUITS	0x10e8		/* Applied Micro Circuits */
+#define	PCI_VENDOR_ALPSELECTIC	0x10e9		/* Alps Electric */
+#define	PCI_VENDOR_INTEGRAPHICS	0x10ea		/* Integraphics Systems */
+#define	PCI_VENDOR_ARTISTSGRAPHICS	0x10eb		/* Artists Graphics */
+#define	PCI_VENDOR_REALTEK	0x10ec		/* Realtek Semiconductor */
+#define	PCI_VENDOR_ASCIICORP	0x10ed		/* ASCII */
+#define	PCI_VENDOR_XILINX	0x10ee		/* Xilinx */
+#define	PCI_VENDOR_RACORE	0x10ef		/* Racore Computer Products */
+#define	PCI_VENDOR_PERITEK	0x10f0		/* Peritek */
+#define	PCI_VENDOR_TYAN	0x10f1		/* Tyan Computer */
+#define	PCI_VENDOR_ACHME	0x10f2		/* Achme Computer */
+#define	PCI_VENDOR_ALARIS	0x10f3		/* Alaris */
+#define	PCI_VENDOR_SMOS	0x10f4		/* S-MOS Systems */
+#define	PCI_VENDOR_NKK	0x10f5		/* NKK */
+#define	PCI_VENDOR_CREATIVE	0x10f6		/* Creative Electronic Systems */
+#define	PCI_VENDOR_MATSUSHITA	0x10f7		/* Matsushita */
+#define	PCI_VENDOR_ALTOS	0x10f8		/* Altos India */
+#define	PCI_VENDOR_PCDIRECT	0x10f9		/* PC Direct */
+#define	PCI_VENDOR_TRUEVISIO	0x10fa		/* Truevision */
+#define	PCI_VENDOR_THESYS	0x10fb		/* Thesys Ges. F. Mikroelektronik */
+#define	PCI_VENDOR_IODATA	0x10fc		/* I-O Data Device */
+#define	PCI_VENDOR_SOYO	0x10fd		/* Soyo Technology */
+#define	PCI_VENDOR_FAST	0x10fe		/* Fast Electronic */
+#define	PCI_VENDOR_NCUBE	0x10ff		/* NCube */
+#define	PCI_VENDOR_JAZZ	0x1100		/* Jazz Multimedia */
+#define	PCI_VENDOR_INITIO	0x1101		/* Initio */
+#define	PCI_VENDOR_CREATIVELABS	0x1102		/* Creative Labs */
+#define	PCI_VENDOR_TRIONES	0x1103		/* Triones Technologies */
+#define	PCI_VENDOR_RASTEROPS	0x1104		/* RasterOps */
+#define	PCI_VENDOR_SIGMA	0x1105		/* Sigma Designs */
+#define	PCI_VENDOR_VIATECH	0x1106		/* VIA Technologies */
+#define	PCI_VENDOR_STRATIS	0x1107		/* Stratus Computer */
+#define	PCI_VENDOR_PROTEON	0x1108		/* Proteon */
+#define	PCI_VENDOR_COGENT	0x1109		/* Cogent Data Technologies */
+#define	PCI_VENDOR_SIEMENS	0x110a		/* Siemens AG / Siemens Nixdorf AG */
+#define	PCI_VENDOR_XENON	0x110b		/* Xenon Microsystems */
+#define	PCI_VENDOR_MINIMAX	0x110c		/* Mini-Max Technology */
+#define	PCI_VENDOR_ZNYX	0x110d		/* Znyx Advanced Systems */
+#define	PCI_VENDOR_CPUTECH	0x110e		/* CPU Technology */
+#define	PCI_VENDOR_ROSS	0x110f		/* Ross Technology */
+#define	PCI_VENDOR_POWERHOUSE	0x1110		/* Powerhouse Systems */
+#define	PCI_VENDOR_SCO	0x1111		/* Santa Cruz Operation */
+#define	PCI_VENDOR_RNS	0x1112		/* RNS */
+#define	PCI_VENDOR_ACCTON	0x1113		/* Accton Technology */
+#define	PCI_VENDOR_ATMEL	0x1114		/* Atmel */
+#define	PCI_VENDOR_DUPONT	0x1115		/* DuPont Pixel Systems */
+#define	PCI_VENDOR_DATATRANSLATION	0x1116		/* Data Translation */
+#define	PCI_VENDOR_DATACUBE	0x1117		/* Datacube */
+#define	PCI_VENDOR_BERG	0x1118		/* Berg Electronics */
+#define	PCI_VENDOR_VORTEX	0x1119		/* Vortex Computer Systems */
+#define	PCI_VENDOR_EFFICIENTNETS	0x111a		/* Efficent Networks */
+#define	PCI_VENDOR_TELEDYNE	0x111b		/* Teledyne Electronic Systems */
+#define	PCI_VENDOR_TRICORD	0x111c		/* Tricord Systems */
+#define	PCI_VENDOR_IDT	0x111d		/* IDT */
+#define	PCI_VENDOR_ELDEC	0x111e		/* Eldec */
+#define	PCI_VENDOR_PDI	0x111f		/* Prescision Digital Images */
+#define	PCI_VENDOR_EMC	0x1120		/* Emc */
+#define	PCI_VENDOR_ZILOG	0x1121		/* Zilog */
+#define	PCI_VENDOR_MULTITECH	0x1122		/* Multi-tech Systems */
+#define	PCI_VENDOR_LEUTRON	0x1124		/* Leutron Vision */
+#define	PCI_VENDOR_EUROCORE	0x1125		/* Eurocore/Vigra */
+#define	PCI_VENDOR_VIGRA	0x1126		/* Vigra */
+#define	PCI_VENDOR_FORE	0x1127		/* FORE Systems */
+#define	PCI_VENDOR_FIRMWORKS	0x1129		/* Firmworks */
+#define	PCI_VENDOR_HERMES	0x112a		/* Hermes Electronics */
+#define	PCI_VENDOR_LINOTYPE	0x112b		/* Linotype */
+#define	PCI_VENDOR_RAVICAD	0x112d		/* Ravicad */
+#define	PCI_VENDOR_INFOMEDIA	0x112e		/* Infomedia Microelectronics */
+#define	PCI_VENDOR_IMAGINGTECH	0x112f		/* Imaging Technlogy */
+#define	PCI_VENDOR_COMPUTERVISION	0x1130		/* Computervision */
+#define	PCI_VENDOR_PHILIPS	0x1131		/* Philips */
+#define	PCI_VENDOR_MITEL	0x1132		/* Mitel */
+#define	PCI_VENDOR_EICON	0x1133		/* Eicon Technology */
+#define	PCI_VENDOR_MCS	0x1134		/* Mercury Computer Systems */
+#define	PCI_VENDOR_FUJIXEROX	0x1135		/* Fuji Xerox */
+#define	PCI_VENDOR_MOMENTUM	0x1136		/* Momentum Data Systems */
+#define	PCI_VENDOR_CISCO	0x1137		/* Cisco Systems */
+#define	PCI_VENDOR_ZIATECH	0x1138		/* Ziatech */
+#define	PCI_VENDOR_DYNPIC	0x1139		/* Dynamic Pictures */
+#define	PCI_VENDOR_FWB	0x113a		/* FWB */
+#define	PCI_VENDOR_CYCLONE	0x113c		/* Cyclone Micro */
+#define	PCI_VENDOR_LEADINGEDGE	0x113d		/* Leading Edge */
+#define	PCI_VENDOR_SANYO	0x113e		/* Sanyo Electric */
+#define	PCI_VENDOR_EQUINOX	0x113f		/* Equinox Systems */
+#define	PCI_VENDOR_INTERVOICE	0x1140		/* Intervoice */
+#define	PCI_VENDOR_CREST	0x1141		/* Crest Microsystem */
+#define	PCI_VENDOR_ALLIANCE	0x1142		/* Alliance Semiconductor */
+#define	PCI_VENDOR_NETPOWER	0x1143		/* NetPower */
+#define	PCI_VENDOR_CINMILACRON	0x1144		/* Cincinnati Milacron */
+#define	PCI_VENDOR_WORKBIT	0x1145		/* Workbit */
+#define	PCI_VENDOR_FORCE	0x1146		/* Force Computers */
+#define	PCI_VENDOR_INTERFACE	0x1147		/* Interface */
+#define	PCI_VENDOR_SCHNEIDERKOCH	0x1148		/* Schneider & Koch */
+#define	PCI_VENDOR_WINSYSTEM	0x1149		/* Win System */
+#define	PCI_VENDOR_VMIC	0x114a		/* VMIC */
+#define	PCI_VENDOR_CANOPUS	0x114b		/* Canopus */
+#define	PCI_VENDOR_ANNABOOKS	0x114c		/* Annabooks */
+#define	PCI_VENDOR_IC	0x114d		/* IC */
+#define	PCI_VENDOR_NIKON	0x114e		/* Nikon Systems */
+#define	PCI_VENDOR_DIGI	0x114f		/* Digi International */
+#define	PCI_VENDOR_TMC	0x1150		/* Thinking Machines */
+#define	PCI_VENDOR_JAE	0x1151		/* JAE Electronics */
+#define	PCI_VENDOR_MEGATEK	0x1152		/* Megatek */
+#define	PCI_VENDOR_LANDWIN	0x1153		/* Land Win Electronic */
+#define	PCI_VENDOR_MELCO	0x1154		/* Melco */
+#define	PCI_VENDOR_PINETECH	0x1155		/* Pine Technology */
+#define	PCI_VENDOR_PERISCOPE	0x1156		/* Periscope Engineering */
+#define	PCI_VENDOR_AVSYS	0x1157		/* Avsys */
+#define	PCI_VENDOR_VOARX	0x1158		/* Voarx R & D */
+#define	PCI_VENDOR_MUTECH	0x1159		/* Mutech */
+#define	PCI_VENDOR_HARLEQUIN	0x115a		/* Harlequin */
+#define	PCI_VENDOR_PARALLAX	0x115b		/* Parallax Graphics */
+#define	PCI_VENDOR_XIRCOM	0x115d		/* Xircom */
+#define	PCI_VENDOR_PEERPROTO	0x115e		/* Peer Protocols */
+#define	PCI_VENDOR_MAXTOR	0x115f		/* Maxtor */
+#define	PCI_VENDOR_MEGASOFT	0x1160		/* Megasoft */
+#define	PCI_VENDOR_PFU	0x1161		/* PFU Limited */
+#define	PCI_VENDOR_OALAB	0x1162		/* OA Laboratory */
+#define	PCI_VENDOR_RENDITION	0x1163		/* Rendition */
+#define	PCI_VENDOR_APT	0x1164		/* Advanced Peripherals Technologies */
+#define	PCI_VENDOR_IMAGRAPH	0x1165		/* Imagraph */
+#define	PCI_VENDOR_SERVERWORKS	0x1166		/* ServerWorks */
+#define	PCI_VENDOR_MUTOH	0x1167		/* Mutoh Industries */
+#define	PCI_VENDOR_THINE	0x1168		/* Thine Electronics */
+#define	PCI_VENDOR_CDAC	0x1169		/* Centre for Dev. of Advanced Computing */
+#define	PCI_VENDOR_POLARIS	0x116a		/* Polaris Communications */
+#define	PCI_VENDOR_CONNECTWARE	0x116b		/* Connectware */
+#define	PCI_VENDOR_WSTECH	0x116f		/* Workstation Technology */
+#define	PCI_VENDOR_INVENTEC	0x1170		/* Inventec */
+#define	PCI_VENDOR_LOUGHSOUND	0x1171		/* Loughborough Sound Images */
+#define	PCI_VENDOR_ALTERA	0x1172		/* Altera */
+#define	PCI_VENDOR_ADOBE	0x1173		/* Adobe Systems */
+#define	PCI_VENDOR_BRIDGEPORT	0x1174		/* Bridgeport Machines */
+#define	PCI_VENDOR_MIRTRON	0x1175		/* Mitron Computer */
+#define	PCI_VENDOR_SBE	0x1176		/* SBE */
+#define	PCI_VENDOR_SILICONENG	0x1177		/* Silicon Engineering */
+#define	PCI_VENDOR_ALFA	0x1178		/* Alfa */
+#define	PCI_VENDOR_TOSHIBA2	0x1179		/* Toshiba */
+#define	PCI_VENDOR_ATREND	0x117a		/* A-Trend Technology */
+#define	PCI_VENDOR_ATTO	0x117c		/* Atto Technology */
+#define	PCI_VENDOR_TR	0x117e		/* T/R Systems */
+#define	PCI_VENDOR_RICOH	0x1180		/* Ricoh */
+#define	PCI_VENDOR_TELEMATICS	0x1181		/* Telematics International */
+#define	PCI_VENDOR_FUJIKURA	0x1183		/* Fujikura */
+#define	PCI_VENDOR_FORKS	0x1184		/* Forks */
+#define	PCI_VENDOR_DATAWORLD	0x1185		/* Dataworld */
+#define	PCI_VENDOR_DLINK	0x1186		/* D-Link Systems */
+#define	PCI_VENDOR_ATL	0x1187		/* Advanced Techonoloy Labratories */
+#define	PCI_VENDOR_SHIMA	0x1188		/* Shima Seiki Manufacturing */
+#define	PCI_VENDOR_MATSUSHITA2	0x1189		/* Matsushita Electronics (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_HILEVEL	0x118a		/* HiLevel Technology */
+#define	PCI_VENDOR_COROLLARY	0x118c		/* Corrollary */
+#define	PCI_VENDOR_BITFLOW	0x118d		/* BitFlow */
+#define	PCI_VENDOR_HERMSTEDT	0x118e		/* Hermstedt */
+#define	PCI_VENDOR_ACARD	0x1191		/* Acard */
+#define	PCI_VENDOR_DENSAN	0x1192		/* Densan */
+#define	PCI_VENDOR_ZEINET	0x1193		/* Zeinet */
+#define	PCI_VENDOR_TOUCAN	0x1194		/* Toucan Technology */
+#define	PCI_VENDOR_RATOC	0x1195		/* Ratoc Systems */
+#define	PCI_VENDOR_HYTEC	0x1196		/* Hytec Electronic */
+#define	PCI_VENDOR_GAGE	0x1197		/* Gage Applied Sciences */
+#define	PCI_VENDOR_LAMBDA	0x1198		/* Lambda Systems */
+#define	PCI_VENDOR_DCA	0x1199		/* Digital Communications Associates */
+#define	PCI_VENDOR_MINDSHARE	0x119a		/* Mind Share */
+#define	PCI_VENDOR_OMEGA	0x119b		/* Omega Micro */
+#define	PCI_VENDOR_ITI	0x119c		/* Information Technology Institute */
+#define	PCI_VENDOR_BUG	0x119d		/* Bug Sapporo */
+#define	PCI_VENDOR_FUJITSU3	0x119e		/* Fujitsu (3th PCI Vendor ID) */
+#define	PCI_VENDOR_BULL	0x119f		/* Bull Hn Information Systems */
+#define	PCI_VENDOR_CONVEX	0x11a0		/* Convex Computer */
+#define	PCI_VENDOR_HAMAMATSU	0x11a1		/* Hamamatsu Photonics */
+#define	PCI_VENDOR_SIERRA2	0x11a2		/* Sierra Research & Technology (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_BARCO	0x11a4		/* Barco */
+#define	PCI_VENDOR_MICROUNITY	0x11a5		/* MicroUnity Systems Engineering */
+#define	PCI_VENDOR_PUREDATA	0x11a6		/* Pure Data */
+#define	PCI_VENDOR_POWERCC	0x11a7		/* Power Computing */
+#define	PCI_VENDOR_INNOSYS	0x11a9		/* InnoSys */
+#define	PCI_VENDOR_ACTEL	0x11aa		/* Actel */
+#define	PCI_VENDOR_MARVELL	0x11ab		/* Marvell */
+#define	PCI_VENDOR_CANNON	0x11ac		/* Cannon IS */
+#define	PCI_VENDOR_LITEON	0x11ad		/* Lite-On Communications */
+#define	PCI_VENDOR_SCITEX	0x11ae		/* Scitex */
+#define	PCI_VENDOR_AVID	0x11af		/* Avid Technology */
+#define	PCI_VENDOR_V3	0x11b0		/* V3 Semiconductor */
+#define	PCI_VENDOR_APRICOT	0x11b1		/* Apricot Computer */
+#define	PCI_VENDOR_KODAK	0x11b2		/* Eastman Kodak */
+#define	PCI_VENDOR_BARR	0x11b3		/* Barr Systems */
+#define	PCI_VENDOR_LEITECH	0x11b4		/* Leitch Technology */
+#define	PCI_VENDOR_RADSTONE	0x11b5		/* Radstone Technology */
+#define	PCI_VENDOR_UNITEDVIDEO	0x11b6		/* United Video */
+#define	PCI_VENDOR_MOT2	0x11b7		/* Motorola (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_XPOINT	0x11b8		/* Xpoint Technologies */
+#define	PCI_VENDOR_PATHLIGHT	0x11b9		/* Pathlight Technology */
+#define	PCI_VENDOR_VIDEOTRON	0x11ba		/* VideoTron */
+#define	PCI_VENDOR_PYRAMID	0x11bb		/* Pyramid Technologies */
+#define	PCI_VENDOR_NETPERIPH	0x11bc		/* Network Peripherals */
+#define	PCI_VENDOR_PINNACLE	0x11bd		/* Pinnacle Systems */
+#define	PCI_VENDOR_IMI	0x11be		/* International Microcircuts */
+#define	PCI_VENDOR_LUCENT	0x11c1		/* Lucent Technologies */
+#define	PCI_VENDOR_NEC2	0x11c3		/* NEC (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_DOCTECH	0x11c4		/* Document Technologies */
+#define	PCI_VENDOR_SHIVA	0x11c5		/* Shiva */
+#define	PCI_VENDOR_DCMDATA	0x11c7		/* DCM Data Systems */
+#define	PCI_VENDOR_DOLPHIN	0x11c8		/* Dolphin Interconnect Solutions */
+#define	PCI_VENDOR_MAGMA	0x11c9		/* Mesa Ridge Technologies (MAGMA) */
+#define	PCI_VENDOR_LSISYS	0x11ca		/* LSI Systems */
+#define	PCI_VENDOR_SPECIALIX	0x11cb		/* Specialix Research */
+#define	PCI_VENDOR_MKC	0x11cc		/* Michels & Kleberhoff Computer */
+#define	PCI_VENDOR_HAL	0x11cd		/* HAL Computer Systems */
+#define	PCI_VENDOR_AURAVISION	0x11d1		/* Auravision */
+#define	PCI_VENDOR_ANALOG	0x11d4		/* Analog Devices */
+#define	PCI_VENDOR_SEGA	0x11db		/* SEGA Enterprises */
+#define	PCI_VENDOR_ZORAN	0x11de		/* Zoran */
+#define	PCI_VENDOR_QUICKLOGIC	0x11e3		/* QuickLogic */
+#define	PCI_VENDOR_COMPEX	0x11f6		/* Compex */
+#define	PCI_VENDOR_PMCSIERRA	0x11f8		/* PMC-Sierra */
+#define	PCI_VENDOR_COMTROL	0x11fe		/* Comtrol */
+#define	PCI_VENDOR_CYCLADES	0x120e		/* Cyclades */
+#define	PCI_VENDOR_ESSENTIAL	0x120f		/* Essential Communications */
+#define	PCI_VENDOR_O2MICRO	0x1217		/* O2 Micro */
+#define	PCI_VENDOR_3DFX	0x121a		/* 3Dfx Interactive */
+#define	PCI_VENDOR_ARIEL	0x1220		/* Ariel */
+#define	PCI_VENDOR_HEURICON	0x1223		/* Heurikon/Computer Products */
+#define	PCI_VENDOR_AZTECH	0x122d		/* Aztech */
+#define	PCI_VENDOR_3DO	0x1239		/* The 3D0 Company */
+#define	PCI_VENDOR_CCUBE	0x123f		/* C-Cube Microsystems */
+#define	PCI_VENDOR_JNI	0x1242		/* JNI */
+#define	PCI_VENDOR_AVM	0x1244		/* AVM */
+#define	PCI_VENDOR_SAMSUNGELEC2	0x1249		/* Samsung Electronics (2nd vendor ID) */
+#define	PCI_VENDOR_STALLION	0x124d		/* Stallion Technologies */
+#define	PCI_VENDOR_LINEARSYS	0x1254		/* Linear Systems */
+#define	PCI_VENDOR_COREGA	0x1259		/* Corega */
+#define	PCI_VENDOR_ASIX	0x125b		/* ASIX Electronics */
+#define	PCI_VENDOR_AURORA	0x125c		/* Aurora Technologies */
+#define	PCI_VENDOR_ESSTECH	0x125d		/* ESS Technology */
+#define	PCI_VENDOR_INTERSIL	0x1260		/* Intersil */
+#define	PCI_VENDOR_NORTEL	0x126c		/* Nortel Networks (Northern Telecom) */
+#define	PCI_VENDOR_SILMOTION	0x126f		/* Silicon Motion */
+#define	PCI_VENDOR_ENSONIQ	0x1274		/* Ensoniq */
+#define	PCI_VENDOR_NETAPP	0x1275		/* Network Appliance */
+#define	PCI_VENDOR_TRANSMETA	0x1279		/* Transmeta */
+#define	PCI_VENDOR_ROCKWELL	0x127a		/* Rockwell Semiconductor Systems */
+#define	PCI_VENDOR_DAVICOM	0x1282		/* Davicom Semiconductor */
+#define	PCI_VENDOR_ITE	0x1283		/* Integrated Technology Express */
+#define	PCI_VENDOR_ESSTECH2	0x1285		/* ESS Technology */
+#define	PCI_VENDOR_TRITECH	0x1292		/* TriTech Microelectronics */
+#define	PCI_VENDOR_KOFAX	0x1296		/* Kofax Image Products */
+#define	PCI_VENDOR_ALTEON	0x12ae		/* Alteon */
+#define	PCI_VENDOR_RISCOM	0x12aa		/* RISCom */
+#define	PCI_VENDOR_USR	0x12b9		/* US Robotics (3Com) */
+#define	PCI_VENDOR_USR2	0x16ec		/* US Robotics */
+#define	PCI_VENDOR_PICTUREEL	0x12c5		/* Picture Elements */
+#define	PCI_VENDOR_NVIDIA_SGS	0x12d2		/* Nvidia & SGS-Thomson Microelectronics */
+#define	PCI_VENDOR_PERICOM	0x12d8		/* Pericom Semiconductors */
+#define	PCI_VENDOR_RAINBOW	0x12de		/* Rainbow Technologies */
+#define	PCI_VENDOR_DATUM	0x12e2		/* Datum Inc. Bancomm-Timing Division */
+#define	PCI_VENDOR_AUREAL	0x12eb		/* Aureal Semiconductor */
+#define	PCI_VENDOR_JUNIPER	0x1304		/* Juniper Networks */
+#define	PCI_VENDOR_ADMTEK	0x1317		/* ADMtek */
+#define	PCI_VENDOR_PACKETENGINES	0x1318		/* Packet Engines */
+#define	PCI_VENDOR_FORTEMEDIA	0x1319		/* Forte Media */
+#define	PCI_VENDOR_SIIG	0x131f		/* Siig */
+#define	PCI_VENDOR_MICROMEMORY	0x1332		/* Micro Memory */
+#define	PCI_VENDOR_DOMEX	0x134a		/* Domex */
+#define	PCI_VENDOR_QUATECH	0x135c		/* Quatech */
+#define	PCI_VENDOR_LMC	0x1376		/* LAN Media */
+#define	PCI_VENDOR_NETGEAR	0x1385		/* Netgear */
+#define	PCI_VENDOR_MOXA	0x1393		/* Moxa Technologies */
+#define	PCI_VENDOR_LEVELONE	0x1394		/* Level One */
+#define	PCI_VENDOR_COLOGNECHIP	0x1397		/* Cologne Chip Designs */
+#define	PCI_VENDOR_ALACRITECH	0x139a		/* Alacritech */
+#define	PCI_VENDOR_HIFN	0x13a3		/* Hifn */
+#define	PCI_VENDOR_EXAR	0x13a8		/* EXAR */
+#define	PCI_VENDOR_3WARE	0x13c1		/* 3ware */
+#define	PCI_VENDOR_ABOCOM	0x13d1		/* AboCom Systems */
+#define	PCI_VENDOR_PHOBOS	0x13d8		/* Phobos */
+#define	PCI_VENDOR_NETBOOST	0x13dc		/* NetBoost */
+#define	PCI_VENDOR_SUNDANCETI	0x13f0		/* Sundance Technology */
+#define	PCI_VENDOR_CMEDIA	0x13f6		/* C-Media Electronics */
+#define	PCI_VENDOR_ADVANTECH	0x13fe		/* Advantech */
+#define	PCI_VENDOR_LAVA	0x1407		/* Lava Semiconductor Manufacturing */
+#define	PCI_VENDOR_SUNIX	0x1409		/* SUNIX */
+#define	PCI_VENDOR_ICENSEMBLE	0x1412		/* IC Ensemble / VIA Technologies */
+#define	PCI_VENDOR_MICROSOFT	0x1414		/* Microsoft */
+#define	PCI_VENDOR_OXFORDSEMI	0x1415		/* Oxford Semiconductor */
+#define	PCI_VENDOR_CHELSIO	0x1425		/* Chelsio Communications */
+#define	PCI_VENDOR_TAMARACK	0x143d		/* Tamarack Microelectronics */
+#define	PCI_VENDOR_SAMSUNGELEC3	0x144d		/* Samsung Electronics (3rd vendor ID) */
+#define	PCI_VENDOR_ASKEY	0x144f		/* Askey Computer */
+#define	PCI_VENDOR_AVERMEDIA	0x1461		/* Avermedia Technologies */
+#define	PCI_VENDOR_SYSTEMBASE	0x14a1		/* System Base */
+#define	PCI_VENDOR_MARVELL2	0x1b4b		/* Marvell */
+#define	PCI_VENDOR_AIRONET	0x14b9		/* Aironet Wireless Communications */
+#define	PCI_VENDOR_COMPAL	0x14c0		/* COMPAL Electronics */
+#define	PCI_VENDOR_MYRICOM	0x14c1		/* Myricom */
+#define	PCI_VENDOR_TITAN	0x14d2		/* Titan Electronics */
+#define	PCI_VENDOR_AVLAB	0x14db		/* Avlab Technology */
+#define	PCI_VENDOR_INVERTEX	0x14e1		/* Invertex */
+#define	PCI_VENDOR_BROADCOM	0x14e4		/* Broadcom */
+#define	PCI_VENDOR_PLANEX	0x14ea		/* Planex Communications */
+#define	PCI_VENDOR_CONEXANT	0x14f1		/* Conexant Systems */
+#define	PCI_VENDOR_DELTA	0x1500		/* Delta Electronics */
+#define	PCI_VENDOR_ENE	0x1524		/* ENE Technology */
+#define	PCI_VENDOR_TERRATEC	0x153b		/* TerraTec Electronic */
+#define	PCI_VENDOR_PERLE	0x155f		/* Perle Systems */
+#define	PCI_VENDOR_SOLIDUM	0x1588		/* Solidum Systems */
+#define	PCI_VENDOR_HP2	0x1590		/* Hewlett-Packard */
+#define	PCI_VENDOR_SYBA	0x1592		/* Syba */
+#define	PCI_VENDOR_FARADAY	0x159b		/* Faraday Technology */
+#define	PCI_VENDOR_GEOCAST	0x15a1		/* Geocast Network Systems */
+#define	PCI_VENDOR_BLUESTEEL	0x15ab		/* Bluesteel Networks */
+#define	PCI_VENDOR_VMWARE	0x15ad		/* VMware */
+#define	PCI_VENDOR_AGILENT	0x15bc		/* Agilent Technologies */
+#define	PCI_VENDOR_EUMITCOM	0x1638		/* Eumitcom */
+#define	PCI_VENDOR_NETSEC	0x1660		/* NetSec */
+#define	PCI_VENDOR_SIBYTE	0x166d		/* Broadcom (SiByte) */
+#define	PCI_VENDOR_MYSON	0x1516		/* Myson-Century Technology */
+#define	PCI_VENDOR_MELLANOX	0x15b3		/* Mellanox Technologies */
+#define	PCI_VENDOR_NDC	0x15e8		/* National Datacomm */
+#define	PCI_VENDOR_ACTIONTEC	0x1668		/* Action Tec Electronics */
+#define	PCI_VENDOR_ATHEROS	0x168c		/* Atheros Communications */
+#define	PCI_VENDOR_GLOBALSUN	0x16ab		/* Global Sun Tech */
+#define	PCI_VENDOR_SAFENET	0x16ae		/* SafeNet */
+#define	PCI_VENDOR_MICREL	0x16c6		/* Micrel */
+#define	PCI_VENDOR_NETOCTAVE	0x170b		/* Netoctave */
+#define	PCI_VENDOR_LINKSYS	0x1737		/* Linksys */
+#define	PCI_VENDOR_ALTIMA	0x173b		/* Altima */
+#define	PCI_VENDOR_ANTARES	0x1754		/* Antares Microsystems */
+#define	PCI_VENDOR_CAVIUM	0x177d		/* Cavium */
+#define	PCI_VENDOR_FZJZEL	0x1796		/* FZ Juelich / ZEL */
+#define	PCI_VENDOR_BELKIN	0x1799		/* Belkin */
+#define	PCI_VENDOR_HAWKING	0x17b3		/* Hawking Technology */
+#define	PCI_VENDOR_SANDBURST	0x17ba		/* Sandburst */
+#define	PCI_VENDOR_NETCHIP	0x17cc		/* PLX Technology (NetChip) */
+#define	PCI_VENDOR_I4	0x17cf		/* I4 */
+#define	PCI_VENDOR_ARECA	0x17d3		/* Areca */
+#define	PCI_VENDOR_S2IO	0x17d5		/* S2io Technologies */
+#define	PCI_VENDOR_RDC	0x17F3		/* RDC Semiconductor */
+#define	PCI_VENDOR_LINKSYS2	0x17fe		/* Linksys */
+#define	PCI_VENDOR_RALINK	0x1814		/* Ralink Technologies */
+#define	PCI_VENDOR_RMI	0x182e		/* Raza Microelectronics Inc. (Broadcom) */
+#define	PCI_VENDOR_NETLOGIC	0x184e		/* Netlogic Microsystems (Broadcom) */
+#define	PCI_VENDOR_BBELEC	0x1896		/* B & B Electronics */
+#define	PCI_VENDOR_XGI	0x18ca		/* XGI Technology */
+#define	PCI_VENDOR_RENESAS	0x1912		/* Renesas Technologies */
+#define	PCI_VENDOR_FREESCALE	0x1957		/* Freescale Semiconductor */
+#define	PCI_VENDOR_ATTANSIC	0x1969		/* Attansic Technologies */
+#define	PCI_VENDOR_JMICRON	0x197b		/* JMicron Technology */
+#define	PCI_VENDOR_ASPEED	0x1a03		/* ASPEED Technology */
+#define	PCI_VENDOR_EVE	0x1adb		/* EVE */
+#define	PCI_VENDOR_QUMRANET	0x1af4		/* Qumranet */
+#define	PCI_VENDOR_ASMEDIA	0x1b21		/* ASMedia */
+#define	PCI_VENDOR_REDHAT	0x1b36		/* Red Hat */
+#define	PCI_VENDOR_FRESCO	0x1b73		/* Fresco Logic */
+#define	PCI_VENDOR_QINHENG2	0x1c00		/* Nanjing QinHeng Electronics (PCIe) */
+#define	PCI_VENDOR_SYMPHONY2	0x1c1c		/* Symphony Labs (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_TEKRAM2	0x1de1		/* Tekram Technology (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_SUNIX2	0x1fd4		/* SUNIX Co */
+#define	PCI_VENDOR_HINT	0x3388		/* HiNT */
+#define	PCI_VENDOR_3DLABS	0x3d3d		/* 3D Labs */
+#define	PCI_VENDOR_AVANCE2	0x4005		/* Avance Logic (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_ADDTRON	0x4033		/* Addtron Technology */
+#define	PCI_VENDOR_QINHENG	0x4348		/* Nanjing QinHeng Electronics */
+#define	PCI_VENDOR_ICOMPRESSION	0x4444		/* Conexant (iCompression) */
+#define	PCI_VENDOR_INDCOMPSRC	0x494f		/* Industrial Computer Source */
+#define	PCI_VENDOR_NETVIN	0x4a14		/* NetVin */
+#define	PCI_VENDOR_BUSLOGIC2	0x4b10		/* Buslogic (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_MEDIAQ	0x4d51		/* MediaQ */
+#define	PCI_VENDOR_GUILLEMOT	0x5046		/* Guillemot */
+#define	PCI_VENDOR_TURTLE_BEACH	0x5053		/* Turtle Beach */
+#define	PCI_VENDOR_S3	0x5333		/* S3 */
+#define	PCI_VENDOR_NETPOWER2	0x5700		/* NetPower (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_XENSOURCE	0x5853		/* XenSource, Inc. */
+#define	PCI_VENDOR_C4T	0x6374		/* c't Magazin */
+#define	PCI_VENDOR_DCI	0x6666		/* Decision Computer */
+#define	PCI_VENDOR_KURUSUGAWA	0x6809		/* Kurusugawa Electronics */
+#define	PCI_VENDOR_PCHDTV	0x7063		/* pcHDTV */
+#define	PCI_VENDOR_QUANCOM	0x8008		/* QUANCOM Electronic GmbH */
+#define	PCI_VENDOR_INTEL	0x8086		/* Intel */
+#define	PCI_VENDOR_VIRTUALBOX	0x80ee		/* VirtualBox */
+#define	PCI_VENDOR_TRIGEM2	0x8800		/* Trigem Computer (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_PROLAN	0x8c4a		/* ProLAN */
+#define	PCI_VENDOR_COMPUTONE	0x8e0e		/* Computone */
+#define	PCI_VENDOR_KTI	0x8e2e		/* KTI */
+#define	PCI_VENDOR_ADP	0x9004		/* Adaptec */
+#define	PCI_VENDOR_ADP2	0x9005		/* Adaptec (2nd PCI Vendor ID) */
+#define	PCI_VENDOR_ATRONICS	0x907f		/* Atronics */
+#define	PCI_VENDOR_NETMOS	0x9710		/* Netmos */
+#define	PCI_VENDOR_PARALLELS	0xaaaa		/* Parallels */
+#define	PCI_VENDOR_CHRYSALIS	0xcafe		/* Chrysalis-ITS */
+#define	PCI_VENDOR_MIDDLE_DIGITAL	0xdeaf		/* Middle Digital */
+#define	PCI_VENDOR_ARC	0xedd8		/* ARC Logic */
+#define	PCI_VENDOR_INVALID	0xffff		/* INVALID VENDOR ID */
+
+/*
+ * List of known products. Grouped by vendor.
+ */
+
+/* 3COM Products */
+#define	PCI_PRODUCT_3COM_3C985	0x0001		/* 3c985 Gigabit Ethernet */
+#define	PCI_PRODUCT_3COM_3C996	0x0003		/* 3c996 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_3COM_3C556MODEM	0x1007		/* 3c556 V.90 Mini-PCI Modem */
+#define	PCI_PRODUCT_3COM_3C940	0x1700		/* 3c940 Gigabit Ethernet */
+#define	PCI_PRODUCT_3COM_3C339	0x3390		/* 3c339 TokenLink Velocity */
+#define	PCI_PRODUCT_3COM_3C359	0x3590		/* 3c359 TokenLink Velocity XL */
+#define	PCI_PRODUCT_3COM_3C450TX	0x4500		/* 3c450-TX 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C575TX	0x5057		/* 3c575-TX 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C575BTX	0x5157		/* 3CCFE575BT 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C575CTX	0x5257		/* 3CCFE575CT 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C590	0x5900		/* 3c590 Ethernet */
+#define	PCI_PRODUCT_3COM_3C595TX	0x5950		/* 3c595-TX 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C595T4	0x5951		/* 3c595-T4 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C595MII	0x5952		/* 3c595-MII 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C555	0x5055		/* 3c555 10/100 Mini-PCI Ethernet */
+#define	PCI_PRODUCT_3COM_3C154G72	0x6001		/* 3CRWE154G72 Wireless LAN Adapter */
+#define	PCI_PRODUCT_3COM_3C556	0x6055		/* 3c556 10/100 Mini-PCI Ethernet */
+#define	PCI_PRODUCT_3COM_3C556B	0x6056		/* 3c556B 10/100 Mini-PCI Ethernet */
+#define	PCI_PRODUCT_3COM_3C656_E	0x6560		/* 3CCFEM656 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C656_M	0x6561		/* 3CCFEM656 56k Modem */
+#define	PCI_PRODUCT_3COM_3C656B_E	0x6562		/* 3CCFEM656B 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C656B_M	0x6563		/* 3CCFEM656B 56k Modem */
+#define	PCI_PRODUCT_3COM_3C656C_E	0x6564		/* 3CXFEM656C 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C656C_M	0x6565		/* 3CXFEM656C 56k Modem */
+#define	PCI_PRODUCT_3COM_3CSOHO100TX	0x7646		/* 3cSOHO100-TX 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3CRWE777A	0x7770		/* 3crwe777a AirConnect */
+#define	PCI_PRODUCT_3COM_3C804	0x7980		/* 3c804 FDDILink SAS */
+#define	PCI_PRODUCT_3COM_TOKEN	0x8811		/* Token Ring */
+#define	PCI_PRODUCT_3COM_3C900TPO	0x9000		/* 3c900-TPO Ethernet */
+#define	PCI_PRODUCT_3COM_3C900COMBO	0x9001		/* 3c900-COMBO Ethernet */
+#define	PCI_PRODUCT_3COM_3C905TX	0x9050		/* 3c905-TX 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C905T4	0x9051		/* 3c905-T4 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C900BTPO	0x9004		/* 3c900B-TPO Ethernet */
+#define	PCI_PRODUCT_3COM_3C900BCOMBO	0x9005		/* 3c900B-COMBO Ethernet */
+#define	PCI_PRODUCT_3COM_3C900BTPC	0x9006		/* 3c900B-TPC Ethernet */
+#define	PCI_PRODUCT_3COM_3C905BTX	0x9055		/* 3c905B-TX 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C905BT4	0x9056		/* 3c905B-T4 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C905BCOMBO	0x9058		/* 3c905B-COMBO 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C905BFX	0x905a		/* 3c905B-FX 100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C905CTX	0x9200		/* 3c905C-TX 10/100 Ethernet w/ mngmt */
+#define	PCI_PRODUCT_3COM_3C905CXTX	0x9201		/* 3c905CX-TX 10/100 Ethernet w/ mngmt */
+#define	PCI_PRODUCT_3COM_3C920BEMBW	0x9202		/* 3c920B-EMB-WNM Integrated Fast Ethernet */
+#define	PCI_PRODUCT_3COM_3C910SOHOB	0x9300		/* 3c910 OfficeConnect 10/100B Ethernet */
+#define	PCI_PRODUCT_3COM_3C980SRV	0x9800		/* 3c980 Server Adapter 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C980CTXM	0x9805		/* 3c980C-TXM 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3CR990	0x9900		/* 3c990-TX 10/100 Ethernet w/ 3XP */
+#define	PCI_PRODUCT_3COM_3CR990TX95	0x9902		/* 3CR990-TX-95 10/100 Ethernet w/ 3XP */
+#define	PCI_PRODUCT_3COM_3CR990TX97	0x9903		/* 3CR990-TX-97 10/100 Ethernet w/ 3XP */
+#define	PCI_PRODUCT_3COM_3C990B	0x9904		/* 3c990B 10/100 Ethernet w/ 3XP */
+#define	PCI_PRODUCT_3COM_3CR990FX	0x9905		/* 3CR990-FX 100 Ethernet w/ 3XP */
+#define	PCI_PRODUCT_3COM_3CR990SVR95	0x9908		/* 3CR990-SVR-95 10/100 Ethernet w/ 3XP */
+#define	PCI_PRODUCT_3COM_3CR990SVR97	0x9909		/* 3CR990-SVR-97 10/100 Ethernet w/ 3XP */
+#define	PCI_PRODUCT_3COM_3C990BSVR	0x990a		/* 3c990BSVR 10/100 Ethernet w/ 3XP */
+
+/* 3Dfx Interactive products */
+#define	PCI_PRODUCT_3DFX_VOODOO	0x0001		/* Voodoo */
+#define	PCI_PRODUCT_3DFX_VOODOO2	0x0002		/* Voodoo2 */
+#define	PCI_PRODUCT_3DFX_BANSHEE	0x0003		/* Banshee */
+#define	PCI_PRODUCT_3DFX_VOODOO3	0x0005		/* Voodoo3 */
+#define	PCI_PRODUCT_3DFX_VOODOO5	0x0009		/* Voodoo 4/5 */
+
+/* 3D Labs products */
+#define	PCI_PRODUCT_3DLABS_300SX	0x0001		/* GLINT 300SX */
+#define	PCI_PRODUCT_3DLABS_500TX	0x0002		/* GLINT 500TX */
+#define	PCI_PRODUCT_3DLABS_DELTA	0x0003		/* GLINT DELTA */
+#define	PCI_PRODUCT_3DLABS_PERMEDIA	0x0004		/* GLINT Permedia */
+#define	PCI_PRODUCT_3DLABS_500MX	0x0006		/* GLINT 500MX */
+#define	PCI_PRODUCT_3DLABS_PERMEDIA2	0x0007		/* GLINT Permedia 2 */
+#define	PCI_PRODUCT_3DLABS_GAMMA	0x0008		/* GLINT GAMMA */
+#define	PCI_PRODUCT_3DLABS_PERMEDIA2V	0x0009		/* GLINT Permedia 2V */
+#define	PCI_PRODUCT_3DLABS_PERMEDIA3	0x000a		/* GLINT Permedia 3 */
+#define	PCI_PRODUCT_3DLABS_WILDCAT5110	0x07a2		/* WILDCAT 5110 */
+
+/* 3ware products */
+#define	PCI_PRODUCT_3WARE_ESCALADE	0x1000		/* Escalade ATA RAID Controller */
+#define	PCI_PRODUCT_3WARE_ESCALADE_ASIC	0x1001		/* Escalade ATA RAID 7000/8000 Series Controller */
+#define	PCI_PRODUCT_3WARE_9000	0x1002		/* 9000 Series RAID */
+#define	PCI_PRODUCT_3WARE_9550	0x1003		/* 9550 Series RAID */
+#define	PCI_PRODUCT_3WARE_9650	0x1004		/* 9650 Series RAID */
+#define	PCI_PRODUCT_3WARE_9690	0x1005		/* 9690 Series RAID */
+#define	PCI_PRODUCT_3WARE_9750	0x1010		/* 9750 Series RAID */
+
+/* AboCom products */
+#define	PCI_PRODUCT_ABOCOM_FE2500	0xab02		/* FE2500 10/100 Ethernet */
+#define	PCI_PRODUCT_ABOCOM_PCM200	0xab03		/* PCM200 10/100 Ethernet */
+#define	PCI_PRODUCT_ABOCOM_FE2000VX	0xab06		/* FE2000VX 10/100 Ethernet (OEM) */
+#define	PCI_PRODUCT_ABOCOM_FE2500MX	0xab08		/* FE2500MX 10/100 Ethernet */
+
+/* ACC Products */
+#define	PCI_PRODUCT_ACC_2188	0x0000		/* ACCM 2188 VL-PCI Bridge */
+#define	PCI_PRODUCT_ACC_2051_HB	0x2051		/* 2051 PCI Single Chip Solution (host Bridge) */
+#define	PCI_PRODUCT_ACC_2051_ISA	0x5842		/* 2051 PCI Single Chip Solution (ISA Bridge) */
+
+/* Acard products */
+#define	PCI_PRODUCT_ACARD_ATP850U	0x0005		/* ATP850U/UF UDMA IDE Controller */
+#define	PCI_PRODUCT_ACARD_ATP860	0x0006		/* ATP860 UDMA IDE Controller */
+#define	PCI_PRODUCT_ACARD_ATP860A	0x0007		/* ATP860-A UDMA IDE Controller */
+#define	PCI_PRODUCT_ACARD_ATP865	0x0008		/* ATP865 UDMA IDE Controller */
+#define	PCI_PRODUCT_ACARD_ATP865A	0x0009		/* ATP865-A UDMA IDE Controller */
+#define	PCI_PRODUCT_ACARD_AEC6710	0x8002		/* AEC6710 SCSI */
+#define	PCI_PRODUCT_ACARD_AEC6712UW	0x8010		/* AEC6712UW SCSI */
+#define	PCI_PRODUCT_ACARD_AEC6712U	0x8020		/* AEC6712U SCSI */
+#define	PCI_PRODUCT_ACARD_AEC6712S	0x8030		/* AEC6712S SCSI */
+#define	PCI_PRODUCT_ACARD_AEC6710D	0x8040		/* AEC6710D SCSI */
+#define	PCI_PRODUCT_ACARD_AEC6715UW	0x8050		/* AEC6715UW SCSI */
+
+/* Accton products */
+#define	PCI_PRODUCT_ACCTON_MPX5030	0x1211		/* MPX 5030/5038 Ethernet */
+#define	PCI_PRODUCT_ACCTON_EN2242	0x1216		/* EN2242 10/100 Ethernet */
+
+/* Acer products */
+#define	PCI_PRODUCT_ACER_M1435	0x1435		/* M1435 VL-PCI Bridge */
+
+/* Advantech products */
+#define	PCI_PRODUCT_ADVANTECH_PCI1600	0x1600		/* PCI-16[12]0 serial */
+#define	PCI_PRODUCT_ADVANTECH_PCI1604	0x1604		/* PCI-1604 serial */
+#define	PCI_PRODUCT_ADVANTECH_PCI1610	0x1610		/* PCI-1610 4 port serial */
+#define	PCI_PRODUCT_ADVANTECH_PCI1612	0x1612		/* PCI-1612 4 port serial */
+#define	PCI_PRODUCT_ADVANTECH_PCI1620	0x1620		/* PCI-1620 8 port serial (1-4) */
+#define	PCI_PRODUCT_ADVANTECH_PCI1620_1	0x16ff		/* PCI-1620 8 port serial (5-8) */
+
+/* Acer Labs products */
+#define	PCI_PRODUCT_ALI_M1445	0x1445		/* M1445 VL-PCI Bridge */
+#define	PCI_PRODUCT_ALI_M1449	0x1449		/* M1449 PCI-ISA Bridge */
+#define	PCI_PRODUCT_ALI_M1451	0x1451		/* M1451 Host-PCI Bridge */
+#define	PCI_PRODUCT_ALI_M1461	0x1461		/* M1461 Host-PCI Bridge */
+#define	PCI_PRODUCT_ALI_M1531	0x1531		/* M1531 Host-PCI Bridge */
+#define	PCI_PRODUCT_ALI_M1533	0x1533		/* M1533 PCI-ISA Bridge */
+#define	PCI_PRODUCT_ALI_M1541	0x1541		/* M1541 Host-PCI Bridge */
+#define	PCI_PRODUCT_ALI_M1543	0x1543		/* M1543 PCI-ISA Bridge */
+#define	PCI_PRODUCT_ALI_M1563	0x1563		/* M1563 PCI-ISA Bridge */
+#define	PCI_PRODUCT_ALI_M1647	0x1647		/* M1647 Host-PCI Bridge */
+#define	PCI_PRODUCT_ALI_M1689	0x1689		/* M1689 Host-PCI Bridge */
+#define	PCI_PRODUCT_ALI_M3309	0x3309		/* M3309 MPEG Decoder */
+#define	PCI_PRODUCT_ALI_M4803	0x5215		/* M4803 */
+#define	PCI_PRODUCT_ALI_M5257	0x5257		/* M5257 PCI Software Modem */
+#define	PCI_PRODUCT_ALI_M5229	0x5229		/* M5229 UDMA IDE Controller */
+#define	PCI_PRODUCT_ALI_M5237	0x5237		/* M5237 USB 1.1 Host Controller */
+#define	PCI_PRODUCT_ALI_M5239	0x5239		/* M5239 USB 2.0 Host Controller */
+#define	PCI_PRODUCT_ALI_M5243	0x5243		/* M5243 PCI-AGP Bridge */
+#define	PCI_PRODUCT_ALI_M5247	0x5247		/* M5247 PCI-AGP Bridge */
+#define	PCI_PRODUCT_ALI_M5249	0x5249		/* M5249 Hypertransport to PCI Bridge */
+#define	PCI_PRODUCT_ALI_M5261	0x5261		/* M5261 Tulip Ethernet Controller */
+#define	PCI_PRODUCT_ALI_M5288	0x5288		/* M5288 SATA/Raid Controller */
+#define	PCI_PRODUCT_ALI_M5451	0x5451		/* M5451 AC-Link Controller Audio Device */
+#define	PCI_PRODUCT_ALI_M5453	0x5453		/* M5453 AC-Link Controller Modem Device */
+#define	PCI_PRODUCT_ALI_M5455	0x5455		/* M5455 AC-Link Controller Audio Device */
+#define	PCI_PRODUCT_ALI_M7101	0x7101		/* M7101 Power Management Controller */
+
+/* Adaptec products */
+#define	PCI_PRODUCT_ADP_AIC1160	0x1160		/* AIC-1160 */
+#define	PCI_PRODUCT_ADP_AIC7850	0x5078		/* AIC-7850 */
+#define	PCI_PRODUCT_ADP_AIC7855	0x5578		/* AIC-7855 */
+#define	PCI_PRODUCT_ADP_AIC5900	0x5900		/* AIC-5900 ATM */
+#define	PCI_PRODUCT_ADP_AIC5905	0x5905		/* AIC-5905 ATM */
+#define	PCI_PRODUCT_ADP_AIC6915	0x6915		/* AIC-6915 10/100 Ethernet */
+#define	PCI_PRODUCT_ADP_AIC7860	0x6078		/* AIC-7860 */
+#define	PCI_PRODUCT_ADP_APA1480	0x6075		/* APA-1480 Ultra */
+#define	PCI_PRODUCT_ADP_2940AU	0x6178		/* AHA-2940A Ultra */
+#define	PCI_PRODUCT_ADP_AIC7870	0x7078		/* AIC-7870 */
+#define	PCI_PRODUCT_ADP_2940	0x7178		/* AHA-2940 */
+#define	PCI_PRODUCT_ADP_3940	0x7278		/* AHA-3940 */
+#define	PCI_PRODUCT_ADP_3985	0x7378		/* AHA-3985 */
+#define	PCI_PRODUCT_ADP_2944	0x7478		/* AHA-2944 */
+#define	PCI_PRODUCT_ADP_AIC7895	0x7895		/* AIC-7895 Ultra */
+#define	PCI_PRODUCT_ADP_AIC7880	0x8078		/* AIC-7880 Ultra */
+#define	PCI_PRODUCT_ADP_2940U	0x8178		/* AHA-2940 Ultra */
+#define	PCI_PRODUCT_ADP_3940U	0x8278		/* AHA-3940 Ultra */
+#define	PCI_PRODUCT_ADP_389XU	0x8378		/* AHA-389X Ultra */
+#define	PCI_PRODUCT_ADP_2944U	0x8478		/* AHA-2944 Ultra */
+#define	PCI_PRODUCT_ADP_2940UP	0x8778		/* AHA-2940 Ultra Pro */
+
+#define	PCI_PRODUCT_ADP2_2940U2	0x0010		/* AHA-2940U2 U2 */
+#define	PCI_PRODUCT_ADP2_2930U2	0x0011		/* AHA-2930U2 U2 */
+#define	PCI_PRODUCT_ADP2_AIC7890	0x001f		/* AIC-7890/1 U2 */
+#define	PCI_PRODUCT_ADP2_3950U2B	0x0050		/* AHA-3950U2B U2 */
+#define	PCI_PRODUCT_ADP2_3950U2D	0x0051		/* AHA-3950U2D U2 */
+#define	PCI_PRODUCT_ADP2_AIC7896	0x005f		/* AIC-7896/7 U2 */
+#define	PCI_PRODUCT_ADP2_AIC7892A	0x0080		/* AIC-7892A U160 */
+#define	PCI_PRODUCT_ADP2_AIC7892B	0x0081		/* AIC-7892B U160 */
+#define	PCI_PRODUCT_ADP2_AIC7892D	0x0083		/* AIC-7892D U160 */
+#define	PCI_PRODUCT_ADP2_AIC7892P	0x008f		/* AIC-7892P U160 */
+#define	PCI_PRODUCT_ADP2_AIC7899A	0x00c0		/* AIC-7899A U160 */
+#define	PCI_PRODUCT_ADP2_AIC7899B	0x00c1		/* AIC-7899B U160 */
+#define	PCI_PRODUCT_ADP2_AIC7899D	0x00c3		/* AIC-7899D U160 */
+#define	PCI_PRODUCT_ADP2_AIC7899F	0x00c5		/* AIC-7899F RAID */
+#define	PCI_PRODUCT_ADP2_AIC7899P	0x00cf		/* AIC-7899P U160 */
+#define	PCI_PRODUCT_ADP2_1420SA	0x0241		/* RAID 1420SA */
+#define	PCI_PRODUCT_ADP2_1430SA	0x0243		/* RAID 1430SA */
+#define	PCI_PRODUCT_ADP2_AAC2622	0x0282		/* AAC-2622 */
+#define	PCI_PRODUCT_ADP2_ASR2200S	0x0285		/* ASR-2200S */
+#define	PCI_PRODUCT_ADP2_ASR2120S	0x0286		/* ASR-2120S */
+#define	PCI_PRODUCT_ADP2_ASR2200S_SUB2M	0x0287		/* ASR-2200S */
+#define	PCI_PRODUCT_ADP2_ASR2410SA	0x0290		/* ASR-2410SA */
+#define	PCI_PRODUCT_ADP2_AAR2810SA	0x0292		/* AAR-2810SA */
+#define	PCI_PRODUCT_ADP2_3405	0x02bb		/* RAID 3405 */
+#define	PCI_PRODUCT_ADP2_3805	0x02bc		/* RAID 3805 */
+#define	PCI_PRODUCT_ADP2_2405	0x02d5		/* RAID 2405 */
+#define	PCI_PRODUCT_ADP2_AAC364	0x0364		/* AAC-364 */
+#define	PCI_PRODUCT_ADP2_ASR5400S	0x0365		/* ASR-5400S */
+#define	PCI_PRODUCT_ADP2_PERC_2QC	0x1364		/* Dell PERC 2/QC */
+/* XXX guess */
+#define	PCI_PRODUCT_ADP2_PERC_3QC	0x1365		/* Dell PERC 3/QC */
+#define	PCI_PRODUCT_ADP2_HP_M110_G2	0x3227		/* HP M110 G2 / ASR-2610SA */
+#define	PCI_PRODUCT_ADP2_SERVERAID	0x0250		/* ServeRAID 6/7 (marco) */
+
+/* Addtron Products */
+#define	PCI_PRODUCT_ADDTRON_8139	0x1360		/* 8139 Ethernet */
+#define	PCI_PRODUCT_ADDTRON_RHINEII	0x1320		/* Rhine II 10/100 Ethernet */
+
+/* ADMtek products */
+#define	PCI_PRODUCT_ADMTEK_AL981	0x0981		/* AL981 (Comet) 10/100 Ethernet */
+#define	PCI_PRODUCT_ADMTEK_AN983	0x0985		/* AN983 (Centaur-P) 10/100 Ethernet */
+#define	PCI_PRODUCT_ADMTEK_AN985	0x1985		/* AN985 (Centaur-C) 10/100 Ethernet */
+#define	PCI_PRODUCT_ADMTEK_ADM5120	0x5120		/* Infineon ADM5120 PCI Host Bridge */
+#define	PCI_PRODUCT_ADMTEK_ADM8211	0x8201		/* ADM8211 11Mbps 802.11b WLAN */
+#define	PCI_PRODUCT_ADMTEK_ADM9511	0x9511		/* ADM9511 (Centaur-II) 10/100 Ethernet */
+#define	PCI_PRODUCT_ADMTEK_ADM9513	0x9513		/* ADM9513 (Centaur-II) 10/100 Ethernet */
+
+/* Advanced System Products */
+#define	PCI_PRODUCT_ADVSYS_1200A	0x1100
+#define	PCI_PRODUCT_ADVSYS_1200B	0x1200
+#define	PCI_PRODUCT_ADVSYS_ULTRA	0x1300		/* ABP-930/40UA */
+#define	PCI_PRODUCT_ADVSYS_WIDE	0x2300		/* ABP-940UW */
+#define	PCI_PRODUCT_ADVSYS_U2W	0x2500		/* ASB-3940U2W */
+#define	PCI_PRODUCT_ADVSYS_U3W	0x2700		/* ASB-3940U3W */
+
+/* Agilent Technologies Products */
+#define	PCI_PRODUCT_AGILENT_TACHYON_DX2	0x0100		/* Tachyon DX2 FC Controller */
+
+/* Aironet Wireless Communicasions products */
+#define	PCI_PRODUCT_AIRONET_PC4xxx	0x0001		/* PC4500/PC4800 Wireless LAN Adapter */
+#define	PCI_PRODUCT_AIRONET_PCI350	0x0350		/* PCI350 Wireless LAN Adapter */
+#define	PCI_PRODUCT_AIRONET_MPI350	0xa504		/* MPI350 Mini-PCI Wireless LAN Adapter */
+#define	PCI_PRODUCT_AIRONET_PC4500	0x4500		/* PC4500 Wireless LAN Adapter */
+#define	PCI_PRODUCT_AIRONET_PC4800	0x4800		/* PC4800 Wireless LAN Adapter */
+
+/* Alacritech products */
+#define	PCI_PRODUCT_ALACRITECH_SES1001T	0x0005		/* SES1001T iSCSI Accelerator */
+
+/* Alliance products */
+#define	PCI_PRODUCT_ALLIANCE_AT24	0x6424		/* AT24 */
+#define	PCI_PRODUCT_ALLIANCE_AT25	0x643d		/* AT25 */
+
+/* Alteon products */
+#define	PCI_PRODUCT_ALTEON_ACENIC	0x0001		/* ACEnic 1000baseSX Ethernet */
+#define	PCI_PRODUCT_ALTEON_ACENIC_COPPER	0x0002		/* ACEnic 1000baseT Ethernet */
+#define	PCI_PRODUCT_ALTEON_BCM5700	0x0003		/* ACEnic BCM5700 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_ALTEON_BCM5701	0x0004		/* ACEnic BCM5701 10/100/1000 Ethernet */
+
+/* Altera products */
+#define	PCI_PRODUCT_ALTERA_EP4CGX15BF14C8N	0x4c15		/* EP4CGX15BF14C8N */
+
+/* Altima products */
+#define	PCI_PRODUCT_ALTIMA_AC1000	0x03e8		/* AC1000 Gigabit Ethernet */
+#define	PCI_PRODUCT_ALTIMA_AC1001	0x03e9		/* AC1001 Gigabit Ethernet */
+#define	PCI_PRODUCT_ALTIMA_AC9100	0x03ea		/* AC9100 Gigabit Ethernet */
+#define	PCI_PRODUCT_ALTIMA_AC1003	0x03eb		/* AC1003 Gigabit Ethernet */
+
+/* AMD products */
+#define	PCI_PRODUCT_AMD_AMD64_HT	0x1100		/* K8 AMD64 HyperTransport Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_ADDR	0x1101		/* K8 AMD64 Address Map Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_DRAM	0x1102		/* K8 AMD64 DRAM Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_MISC	0x1103		/* K8 AMD64 Miscellaneous Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_F10_HT	0x1200		/* AMD64 Family10h HyperTransport Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_F10_ADDR	0x1201		/* AMD64 Family10h Address Map Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_F10_DRAM	0x1202		/* AMD64 Family10h DRAM Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_F10_MISC	0x1203		/* AMD64 Family10h Miscellaneous Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_F10_LINK	0x1204		/* AMD64 Family10h Link Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_F11_HT	0x1300		/* AMD64 Family11h HyperTransport Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_F11_ADDR	0x1301		/* AMD64 Family11h Address Map Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_F11_DRAM	0x1302		/* AMD64 Family11h DRAM Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_F11_MISC	0x1303		/* AMD64 Family11h Miscellaneous Configuration */
+#define	PCI_PRODUCT_AMD_AMD64_F11_LINK	0x1304		/* AMD64 Family11h Link Configuration */
+#define	PCI_PRODUCT_AMD_F14_RC	0x1510		/* Family14h Root Complex */
+#define	PCI_PRODUCT_AMD_F15_HT	0x1600		/* Family15h HyperTransport Configuration */
+#define	PCI_PRODUCT_AMD_F15_ADDR	0x1601		/* Family15h Address Map Configuration */
+#define	PCI_PRODUCT_AMD_F15_DRAM	0x1602		/* Family15h DRAM Configuration */
+#define	PCI_PRODUCT_AMD_F15_MISC	0x1603		/* Family15h Miscellaneous Configuration */
+#define	PCI_PRODUCT_AMD_F15_LINK	0x1604		/* Family15h Link Configuration */
+#define	PCI_PRODUCT_AMD_F15_NB	0x1605		/* Family15h North Bridge Configuration */
+#define	PCI_PRODUCT_AMD_F14_HT	0x1700		/* Family12h/14h HyperTransport Configuration */
+#define	PCI_PRODUCT_AMD_F14_ADDR	0x1701		/* Family12h/14h Address Map Configuration */
+#define	PCI_PRODUCT_AMD_F14_DRAM	0x1702		/* Family12h/14h DRAM Configuration */
+#define	PCI_PRODUCT_AMD_F14_NB	0x1703		/* Family12h/14h North Bridge Configuration */
+#define	PCI_PRODUCT_AMD_F14_CSTATE	0x1704		/* Family12h/14h CPU C-state Configuration */
+#define	PCI_PRODUCT_AMD_F12_RC	0x1705		/* Family12h Root Complex */
+#define	PCI_PRODUCT_AMD_F12_GPP0	0x1709		/* Family12h GPP0 Root Port */
+#define	PCI_PRODUCT_AMD_F14_MISC	0x1716		/* Family12h/14h Misc. Configuration */
+#define	PCI_PRODUCT_AMD_F14_HB18	0x1718		/* Family12h/14h Host Bridge */
+#define	PCI_PRODUCT_AMD_F14_HB19	0x1719		/* Family12h/14h Host Bridge */
+#define	PCI_PRODUCT_AMD_PCNET_PCI	0x2000		/* PCnet-PCI Ethernet */
+#define	PCI_PRODUCT_AMD_PCNET_HOME	0x2001		/* PCnet-Home HomePNA Ethernet */
+#define	PCI_PRODUCT_AMD_AM_1771_MBW	0x2003		/* Alchemy AM 1771 MBW */
+#define	PCI_PRODUCT_AMD_PCSCSI_PCI	0x2020		/* PCscsi-PCI SCSI */
+#define	PCI_PRODUCT_AMD_GEODELX_PCHB	0x2080		/* Geode LX Host-PCI Bridge */
+#define	PCI_PRODUCT_AMD_GEODELX_VGA	0x2081		/* Geode LX VGA Controller */
+#define	PCI_PRODUCT_AMD_GEODELX_AES	0x2082		/* Geode LX AES Security Block */
+#define	PCI_PRODUCT_AMD_CS5536_PCISB	0x208f		/* CS5536 GeodeLink PCI South Bridge */
+#define	PCI_PRODUCT_AMD_CS5536_PCIB	0x2090		/* CS5536 PCI-ISA Bridge */
+#define	PCI_PRODUCT_AMD_CS5536_FLASH	0x2091		/* CS5536 Flash */
+#define	PCI_PRODUCT_AMD_CS5536_AUDIO	0x2093		/* CS5536 Audio */
+#define	PCI_PRODUCT_AMD_CS5536_OHCI	0x2094		/* CS5536 OHCI USB Controller */
+#define	PCI_PRODUCT_AMD_CS5536_EHCI	0x2095		/* CS5536 EHCI USB Controller */
+#define	PCI_PRODUCT_AMD_CS5536_UDC	0x2096		/* CS5536 UDC */
+#define	PCI_PRODUCT_AMD_CS5536_UOC	0x2097		/* CS5536 UOC */
+#define	PCI_PRODUCT_AMD_CS5536_IDE	0x209a		/* CS5536 IDE Controller */
+#define	PCI_PRODUCT_AMD_SC520_SC	0x3000		/* Elan SC520 System Controller */
+#define	PCI_PRODUCT_AMD_SC751_SC	0x7006		/* AMD751 System Controller */
+#define	PCI_PRODUCT_AMD_SC751_PPB	0x7007		/* AMD751 PCI-PCI Bridge */
+#define	PCI_PRODUCT_AMD_IGR4_AGP	0x700a		/* AMD IGR4 AGP Bridge */
+#define	PCI_PRODUCT_AMD_IGR4_PPB	0x700b		/* AMD IGR4 PCI-PCI Bridge */
+#define	PCI_PRODUCT_AMD_SC762_NB	0x700c		/* AMD762 North Bridge */
+#define	PCI_PRODUCT_AMD_SC762_PPB	0x700d		/* AMD762 AGP Bridge */
+#define	PCI_PRODUCT_AMD_SC761_SC	0x700e		/* AMD761 System Controller */
+#define	PCI_PRODUCT_AMD_SC761_PPB	0x700f		/* AMD761 PCI-PCI Bridge */
+#define	PCI_PRODUCT_AMD_PBC755_ISA	0x7400		/* AMD755 PCI-ISA Bridge */
+#define	PCI_PRODUCT_AMD_PBC755_IDE	0x7401		/* AMD755 IDE Controller */
+#define	PCI_PRODUCT_AMD_PBC755_PMC	0x7403		/* AMD755 ACPI Controller */
+#define	PCI_PRODUCT_AMD_PBC755_USB	0x7404		/* AMD755 USB Host Controller */
+#define	PCI_PRODUCT_AMD_PBC756_ISA	0x7408		/* AMD756 PCI-ISA Bridge */
+#define	PCI_PRODUCT_AMD_PBC756_IDE	0x7409		/* AMD756 IDE Controller */
+#define	PCI_PRODUCT_AMD_PBC756_PMC	0x740b		/* AMD756 Power Management Controller */
+#define	PCI_PRODUCT_AMD_PBC756_USB	0x740c		/* AMD756 USB Host Controller */
+#define	PCI_PRODUCT_AMD_PBC766_ISA	0x7410		/* AMD766 South Bridge */
+#define	PCI_PRODUCT_AMD_PBC766_IDE	0x7411		/* AMD766 IDE Controller */
+#define	PCI_PRODUCT_AMD_PBC766_PMC	0x7413		/* AMD766 Power Management Controller */
+#define	PCI_PRODUCT_AMD_PBC766_USB	0x7414		/* AMD766 USB Host Controller */
+#define	PCI_PRODUCT_AMD_PBC768_ISA	0x7440		/* AMD768 PCI-ISA/LPC Bridge */
+#define	PCI_PRODUCT_AMD_PBC768_IDE	0x7441		/* AMD768 EIDE Controller */
+#define	PCI_PRODUCT_AMD_PBC768_PMC	0x7443		/* AMD768 Power Management Controller */
+#define	PCI_PRODUCT_AMD_PBC768_AC	0x7445		/* AMD768 AC97 Audio */
+#define	PCI_PRODUCT_AMD_PBC768_MD	0x7446		/* AMD768 AC97 Modem */
+#define	PCI_PRODUCT_AMD_PBC768_PPB	0x7448		/* AMD768 PCI-PCI Bridge */
+#define	PCI_PRODUCT_AMD_PBC768_USB	0x7449		/* AMD768 USB Controller */
+#define	PCI_PRODUCT_AMD_PCIX8131_PPB	0x7450		/* AMD8131 PCI-X Tunnel */
+#define	PCI_PRODUCT_AMD_PCIX8131_APIC	0x7451		/* AMD8131 IO Apic */
+#define	PCI_PRODUCT_AMD_AGP8151_DEV	0x7454		/* AMD8151 AGP Device */
+#define	PCI_PRODUCT_AMD_AGP8151_PPB	0x7455		/* AMD8151 AGP Bridge */
+#define	PCI_PRODUCT_AMD_PCIX_PPB	0x7458		/* AMD8123 PCI-X Bridge */
+#define	PCI_PRODUCT_AMD_PCIX_APIC	0x7459		/* AMD8132 PCI-X IOAPIC */
+#define	PCI_PRODUCT_AMD_PBC8111	0x7460		/* AMD8111 I/O Hub */
+#define	PCI_PRODUCT_AMD_PBC8111_USB_7461	0x7461		/* AMD8111 7461 USB Host Controller */
+#define	PCI_PRODUCT_AMD_PBC8111_ETHER	0x7462		/* AMD8111 Ethernet */
+#define	PCI_PRODUCT_AMD_PBC8111_USB	0x7464		/* AMD8111 USB Host Controller */
+#define	PCI_PRODUCT_AMD_PBC8111_LPC	0x7468		/* AMD8111 LPC Controller */
+#define	PCI_PRODUCT_AMD_PBC8111_IDE	0x7469		/* AMD8111 IDE Controller */
+#define	PCI_PRODUCT_AMD_PBC8111_SMB	0x746a		/* AMD8111 SMBus Controller */
+#define	PCI_PRODUCT_AMD_PBC8111_ACPI	0x746b		/* AMD8111 ACPI Controller */
+#define	PCI_PRODUCT_AMD_PBC8111_AC	0x746d		/* AMD8111 AC97 Audio */
+#define	PCI_PRODUCT_AMD_PBC8111_MC97	0x746e		/* AMD8111 MC97 Modem */
+#define	PCI_PRODUCT_AMD_PBC8111_AC_756b	0x756b		/* AMD8111 756b ACPI Controller */
+#define	PCI_PRODUCT_AMD_HUDSON_SATA	0x7800		/* Hudson SATA Controller */
+#define	PCI_PRODUCT_AMD_HUDSON_SATA_AHCI	0x7801		/* Hudson AHCI SATA Controller */
+#define	PCI_PRODUCT_AMD_HUDSON_SDHC	0x7806		/* Hudson SD Flash Controller */
+#define	PCI_PRODUCT_AMD_HUDSON_OHCI	0x7807		/* Hudson USB OHCI Controller */
+#define	PCI_PRODUCT_AMD_HUDSON_EHCI	0x7808		/* Hudson USB EHCI Controller */
+#define	PCI_PRODUCT_AMD_HUDSON_OHCI_2	0x7809		/* Hudson USB OHCI Controller */
+#define	PCI_PRODUCT_AMD_HUDSON_SMB	0x780b		/* Hudson SMBus Controller */
+#define	PCI_PRODUCT_AMD_HUDSON_IDE	0x780c		/* Hudson IDE Controller */
+#define	PCI_PRODUCT_AMD_HUDSON_HDAUDIO	0x780d		/* Hudson HD Audio Controller */
+#define	PCI_PRODUCT_AMD_HUDSON_LPC	0x780e		/* Hudson LPC Bridge */
+#define	PCI_PRODUCT_AMD_HUDSON_PCI	0x780f		/* Hudson PCI Bridge */
+#define	PCI_PRODUCT_AMD_HUDSON_XHCI	0x7812		/* Hudson USB xHCI Controller */
+#define	PCI_PRODUCT_AMD_RS780_HB	0x9600		/* RS780 Host Bridge */
+#define	PCI_PRODUCT_AMD_RS880_HB	0x9601		/* RS785/RS880 Host Bridge */
+#define	PCI_PRODUCT_AMD_RS780_PPB_GFX	0x9602		/* RS780/RS880 PCI-PCI Bridge (int gfx) */
+#define	PCI_PRODUCT_AMD_RS780_PPB_GFX0	0x9603		/* RS780 PCI-PCI Bridge (ext gfx port 0) */
+#define	PCI_PRODUCT_AMD_RS780_PPB0	0x9604		/* RS780/RS880 PCI-PCIE Bridge (port 0) */
+#define	PCI_PRODUCT_AMD_RS780_PPB1	0x9605		/* RS780/RS880 PCI-PCIE Bridge (port 1) */
+#define	PCI_PRODUCT_AMD_RS780_PPB2	0x9606		/* RS780 PCI-PCIE Bridge (port 2) */
+#define	PCI_PRODUCT_AMD_RS780_PPB3	0x9607		/* RS780 PCI-PCIE Bridge (port 3) */
+#define	PCI_PRODUCT_AMD_RS780_PPB4	0x9608		/* RS780/RS880 PCI-PCIE Bridge (port 4) */
+#define	PCI_PRODUCT_AMD_RS780_PPB5	0x9609		/* RS780/RS880 PCI-PCIE Bridge (port 5) */
+#define	PCI_PRODUCT_AMD_RS780_PPB6	0x960a		/* RS780 PCI-PCIE Bridge (NB-SB link) */
+#define	PCI_PRODUCT_AMD_RS780_PPB7	0x960b		/* RS780 PCI-PCIE Bridge (ext gfx port 1) */
+
+/* American Megatrends products */
+#define	PCI_PRODUCT_AMI_MEGARAID	0x9010		/* MegaRAID */
+#define	PCI_PRODUCT_AMI_MEGARAID2	0x9060		/* MegaRAID 2 */
+#define	PCI_PRODUCT_AMI_MEGARAID3	0x1960		/* MegaRAID 3 */
+
+/* Analog Devices products */
+#define	PCI_PRODUCT_ANALOG_AD1889	0x1889		/* AD1889 PCI SoundMAX Controller */
+#define	PCI_PRODUCT_ANALOG_SAFENET	0x2f44		/* SafeNet Crypto Accelerator ADSP-2141 */
+
+/* Antares Microsystems products */
+#define	PCI_PRODUCT_ANTARES_TC9021	0x1021		/* Antares Gigabit Ethernet */
+
+/* Apple products */
+#define	PCI_PRODUCT_APPLE_BANDIT	0x0001		/* Bandit Host-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_GC	0x0002		/* Grand Central I/O Controller */
+#define	PCI_PRODUCT_APPLE_CONTROL	0x0003		/* Control */
+#define	PCI_PRODUCT_APPLE_PLANB	0x0004		/* PlanB */
+#define	PCI_PRODUCT_APPLE_OHARE	0x0007		/* OHare I/O Controller */
+#define	PCI_PRODUCT_APPLE_BANDIT2	0x0008		/* Bandit Host-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_HEATHROW	0x0010		/* Heathrow I/O Controller */
+#define	PCI_PRODUCT_APPLE_PADDINGTON	0x0017		/* Paddington I/O Controller */
+#define	PCI_PRODUCT_APPLE_PBG3_FW	0x0018		/* PowerBook G3 Firewire */
+#define	PCI_PRODUCT_APPLE_KEYLARGO_USB	0x0019		/* KeyLargo USB Controller */
+#define	PCI_PRODUCT_APPLE_UNINORTH1	0x001e		/* UniNorth Host-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_UNINORTH2	0x001f		/* UniNorth Host-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_UNINORTH_AGP	0x0020		/* UniNorth AGP Interface */
+#define	PCI_PRODUCT_APPLE_GMAC	0x0021		/* GMAC Ethernet */
+#define	PCI_PRODUCT_APPLE_KEYLARGO	0x0022		/* KeyLargo I/O Controller */
+#define	PCI_PRODUCT_APPLE_GMAC2	0x0024		/* GMAC Ethernet */
+#define	PCI_PRODUCT_APPLE_PANGEA_MACIO	0x0025		/* Pangea I/O Controller */
+#define	PCI_PRODUCT_APPLE_PANGEA_USB	0x0026		/* Pangea USB Controller */
+#define	PCI_PRODUCT_APPLE_PANGEA_AGP	0x0027		/* Pangea AGP Interface */
+#define	PCI_PRODUCT_APPLE_PANGEA_PCI1	0x0028		/* Pangea Host-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_PANGEA_PCI2	0x0029		/* Pangea Host-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_UNINORTH_AGP2	0x002d		/* UniNorth AGP Interface */
+#define	PCI_PRODUCT_APPLE_UNINORTH3	0x002e		/* UniNorth Host-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_UNINORTH4	0x002f		/* UniNorth Host-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_PANGEA_FW	0x0030		/* Pangea Firewire */
+#define	PCI_PRODUCT_APPLE_UNINORTH_FW	0x0031		/* UniNorth Firewire */
+#define	PCI_PRODUCT_APPLE_GMAC3	0x0032		/* GMAC Ethernet */
+#define	PCI_PRODUCT_APPLE_UNINORTH_ATA	0x0033		/* UniNorth ATA/100 Controller */
+#define	PCI_PRODUCT_APPLE_UNINORTH_AGP3	0x0034		/* UniNorth AGP Bridge */
+#define	PCI_PRODUCT_APPLE_UNINORTH5	0x0035		/* UniNorth Host-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_UNINORTH6	0x0036		/* UniNorth Host-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_KAUAI	0x003b		/* Kauai ATA Controller */
+#define	PCI_PRODUCT_APPLE_INTREPID	0x003e		/* Intrepid I/O Controller */
+#define	PCI_PRODUCT_APPLE_INTREPID_USB	0x003f		/* Intrepid USB Controller */
+#define	PCI_PRODUCT_APPLE_K2_USB	0x0040		/* K2 USB Controller */
+#define	PCI_PRODUCT_APPLE_K2	0x0041		/* K2 MAC-IO Controller */
+#define	PCI_PRODUCT_APPLE_K2_FW	0x0042		/* K2 Firewire */
+#define	PCI_PRODUCT_APPLE_K2_UATA	0x0043		/* K2 UATA Controller */
+#define	PCI_PRODUCT_APPLE_U3_PPB1	0x0045		/* U3 PCI-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_U3_PPB2	0x0046		/* U3 PCI-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_U3_PPB3	0x0047		/* U3 PCI-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_U3_PPB4	0x0048		/* U3 PCI-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_U3_PPB5	0x0049		/* U3 PCI-PCI Bridge */
+#define	PCI_PRODUCT_APPLE_U3_AGP	0x004b		/* U3 AGP Interface */
+#define	PCI_PRODUCT_APPLE_K2_GMAC	0x004c		/* GMAC Ethernet */
+#define	PCI_PRODUCT_APPLE_SHASTA	0x004f		/* Shasta */
+#define	PCI_PRODUCT_APPLE_SHASTA_ATA	0x0050		/* Shasta ATA */
+#define	PCI_PRODUCT_APPLE_SHASTA_GMAC	0x0051		/* Shasta GMAC */
+#define	PCI_PRODUCT_APPLE_SHASTA_FW	0x0052		/* Shasta Firewire */
+#define	PCI_PRODUCT_APPLE_SHASTA_PCI1	0x0053		/* Shasta PCI */
+#define	PCI_PRODUCT_APPLE_SHASTA_PCI2	0x0054		/* Shasta PCI */
+#define	PCI_PRODUCT_APPLE_SHASTA_PCI3	0x0055		/* Shasta PCI */
+#define	PCI_PRODUCT_APPLE_SHASTA_HT	0x0056		/* Shasta HyperTransport */
+#define	PCI_PRODUCT_APPLE_INTREPID2_AGP	0x0066		/* Intrepid 2 AGP */
+#define	PCI_PRODUCT_APPLE_INTREPID2_PCI1	0x0067		/* Intrepid 2 PCI */
+#define	PCI_PRODUCT_APPLE_INTREPID2_PCI2	0x0068		/* Intrepid 2 PCI */
+#define	PCI_PRODUCT_APPLE_INTREPID2_ATA	0x0069		/* Intrepid 2 ATA */
+#define	PCI_PRODUCT_APPLE_INTREPID2_FW	0x006a		/* Intrepid 2 FireWire */
+#define	PCI_PRODUCT_APPLE_INTREPID2_GMAC	0x006b		/* Intrepid 2 GMAC */
+#define	PCI_PRODUCT_APPLE_BCM5701	0x1645		/* BCM5701 */
+
+/* ARC Logic products */
+#define	PCI_PRODUCT_ARC_1000PV	0xa091		/* 1000PV */
+#define	PCI_PRODUCT_ARC_2000PV	0xa099		/* 2000PV */
+#define	PCI_PRODUCT_ARC_2000MT	0xa0a1		/* 2000MT */
+
+/* Areca products */
+#define	PCI_PRODUCT_ARECA_ARC1110	0x1110		/* ARC-1110 */
+#define	PCI_PRODUCT_ARECA_ARC1120	0x1120		/* ARC-1120 */
+#define	PCI_PRODUCT_ARECA_ARC1130	0x1130		/* ARC-1130 */
+#define	PCI_PRODUCT_ARECA_ARC1160	0x1160		/* ARC-1160 */
+#define	PCI_PRODUCT_ARECA_ARC1170	0x1170		/* ARC-1170 */
+#define	PCI_PRODUCT_ARECA_ARC1200	0x1200		/* ARC-1200 */
+#define	PCI_PRODUCT_ARECA_ARC1200_B	0x1201		/* ARC-1200 rev B */
+#define	PCI_PRODUCT_ARECA_ARC1202	0x1202		/* ARC-1202 */
+#define	PCI_PRODUCT_ARECA_ARC1210	0x1210		/* ARC-1210 */
+#define	PCI_PRODUCT_ARECA_ARC1220	0x1220		/* ARC-1220 */
+#define	PCI_PRODUCT_ARECA_ARC1230	0x1230		/* ARC-1230 */
+#define	PCI_PRODUCT_ARECA_ARC1260	0x1260		/* ARC-1260 */
+#define	PCI_PRODUCT_ARECA_ARC1270	0x1270		/* ARC-1270 */
+#define	PCI_PRODUCT_ARECA_ARC1280	0x1280		/* ARC-1280 */
+#define	PCI_PRODUCT_ARECA_ARC1380	0x1380		/* ARC-1380 */
+#define	PCI_PRODUCT_ARECA_ARC1381	0x1381		/* ARC-1381 */
+#define	PCI_PRODUCT_ARECA_ARC1680	0x1680		/* ARC-1680 */
+#define	PCI_PRODUCT_ARECA_ARC1681	0x1681		/* ARC-1681 */
+
+/* ASIX Electronics products */
+#define	PCI_PRODUCT_ASIX_AX88140A	0x1400		/* AX88140A 10/100 Ethernet */
+
+/* ASMedia products */
+#define	PCI_PRODUCT_ASMEDIA_ASM1061_01	0x0601		/* ASM1061 AHCI SATA III Controller */
+#define	PCI_PRODUCT_ASMEDIA_ASM1061_02	0x0602		/* ASM1061 AHCI SATA III Controller */
+#define	PCI_PRODUCT_ASMEDIA_ASM1061_11	0x0611		/* ASM1061 AHCI SATA III Controller */
+#define	PCI_PRODUCT_ASMEDIA_ASM1061_12	0x0612		/* ASM1061 AHCI SATA III Controller */
+#define	PCI_PRODUCT_ASMEDIA_ASM1042	0x1042		/* ASM1042 USB 3.0 Host Controller */
+#define	PCI_PRODUCT_ASMEDIA_ASM1042A	0x1142		/* ASM1042A USB 3.0 Host Controller */
+
+/* Asustek products */
+#define	PCI_PRODUCT_ASUSTEK_HFCPCI	0x0675		/* ISDN */
+
+/* Attansic Technology Corp. */
+#define	PCI_PRODUCT_ATTANSIC_ETHERNET_L1E	0x1026		/* L1E Gigabit Ethernet Adapter */
+#define	PCI_PRODUCT_ATTANSIC_ETHERNET_GIGA	0x1048		/* L1 Gigabit Ethernet Adapter */
+#define	PCI_PRODUCT_ATTANSIC_AR8132	0x1062		/* AR8132 Fast Ethernet Adapter */
+#define	PCI_PRODUCT_ATTANSIC_AR8131	0x1063		/* AR8131 Gigabit Ethernet Adapter */
+#define	PCI_PRODUCT_ATTANSIC_AR8151	0x1073		/* AR8151 v1.0 Gigabit Ethernet Adapter */
+#define	PCI_PRODUCT_ATTANSIC_AR8151_V2	0x1083		/* AR8151 v2.0 Gigabit Ethernet Adapter */
+#define	PCI_PRODUCT_ATTANSIC_AR8162	0x1090		/* AR8162 */
+#define	PCI_PRODUCT_ATTANSIC_AR8161	0x1091		/* AR8161 */
+#define	PCI_PRODUCT_ATTANSIC_AR8172	0x10a0		/* AR8172 */
+#define	PCI_PRODUCT_ATTANSIC_AR8171	0x10a1		/* AR8171 */
+#define	PCI_PRODUCT_ATTANSIC_ETHERNET_100	0x2048		/* L2 100 Mbit Ethernet Adapter */
+#define	PCI_PRODUCT_ATTANSIC_AR8152_B	0x2060		/* AR8152 v1.1 Fast Ethernet Adapter */
+#define	PCI_PRODUCT_ATTANSIC_AR8152_B2	0x2062		/* AR8152 v2.0 Fast Ethernet Adapter */
+#define	PCI_PRODUCT_ATTANSIC_E2200	0xe091		/* E2200 */
+
+/* ATI products */
+/* See http://www.x.org/wiki/Radeon%20ASICs */
+#define	PCI_PRODUCT_ATI_RADEON_WRESTLER_HDMI	0x1314		/* Wrestler HDMI Audio */
+#define	PCI_PRODUCT_ATI_RADEON_BEAVERCREEK_HDMI	0x1714		/* BeaverCreek HDMI Audio */
+#define	PCI_PRODUCT_ATI_RADEON_RV380_3150	0x3150		/* Radeon Mobility X600 (M24) 3150 */
+#define	PCI_PRODUCT_ATI_RADEON_RV380_3154	0x3154		/* FireGL M24 GL 3154 */
+#define	PCI_PRODUCT_ATI_RADEON_RV380_3E50	0x3e50		/* Radeon X600 (RV380) 3E50 */
+#define	PCI_PRODUCT_ATI_RADEON_RV380_3E54	0x3e54		/* FireGL V3200 (RV380) 3E54 */
+#define	PCI_PRODUCT_ATI_RADEON_RS100_4136	0x4136		/* Radeon IGP320 (A3) 4136 */
+#define	PCI_PRODUCT_ATI_RADEON_RS200_A7	0x4137		/* Radeon IGP330/340/350 (A4) 4137 */
+#define	PCI_PRODUCT_ATI_RADEON_R300_AD	0x4144		/* Radeon 9500 AD */
+#define	PCI_PRODUCT_ATI_RADEON_R300_AE	0x4145		/* Radeon 9500 AE */
+#define	PCI_PRODUCT_ATI_RADEON_R300_AF	0x4146		/* Radeon 9600TX AF */
+#define	PCI_PRODUCT_ATI_RADEON_R300_AG	0x4147		/* FireGL Z1 AG */
+#define	PCI_PRODUCT_ATI_RADEON_R350_AH	0x4148		/* Radeon 9800SE AH */
+#define	PCI_PRODUCT_ATI_RADEON_R350_AI	0x4149		/* Radeon 9800 AI */
+#define	PCI_PRODUCT_ATI_RADEON_R350_AJ	0x414a		/* Radeon 9800 AJ */
+#define	PCI_PRODUCT_ATI_RADEON_R350_AK	0x414b		/* FireGL X2 AK */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_AP	0x4150		/* Radeon 9600 AP */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_AQ	0x4151		/* Radeon 9600SE AQ */
+#define	PCI_PRODUCT_ATI_RADEON_RV360_AR	0x4152		/* Radeon 9600XT AR */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_AS	0x4153		/* Radeon 9600 AS */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_AT	0x4154		/* FireGL T2 AT */
+/* RV350 and RV360 FireFL T2 have same PCI id */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_AV	0x4154		/* FireGL RV360 AV */
+#define	PCI_PRODUCT_ATI_MACH32	0x4158		/* Mach32 */
+#define	PCI_PRODUCT_ATI_RADEON_9600_LE_S	0x4171		/* Radeon 9600 LE Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_9600_XT_S	0x4172		/* Radeon 9600 XT Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_RS250_B7	0x4237		/* Radeon 7000 IGP (A4+) */
+#define	PCI_PRODUCT_ATI_RADEON_R200_BB	0x4242		/* Radeon 8500 AIW BB */
+#define	PCI_PRODUCT_ATI_RADEON_R200_BC	0x4243		/* Radeon 8500 AIW BC */
+#define	PCI_PRODUCT_ATI_RADEON_RS100_4336	0x4336		/* Radeon IGP320M (U1) 4336 */
+#define	PCI_PRODUCT_ATI_RADEON_RS200_4337	0x4337		/* Radeon IGP330M/340M/350M (U2) 4337 */
+#define	PCI_PRODUCT_ATI_IXP_AUDIO_200	0x4341		/* IXP AC'97 Audio Controller */
+#define	PCI_PRODUCT_ATI_SB200_PPB	0x4342		/* SB200 PCI-PCI Bridge */
+#define	PCI_PRODUCT_ATI_SB200_EHCI	0x4345		/* SB200 USB2 Host Controller */
+#define	PCI_PRODUCT_ATI_SB200_OHCI_1	0x4347		/* SB200 USB Host Controller */
+#define	PCI_PRODUCT_ATI_SB200_OHCI_2	0x4348		/* SB200 USB Host Controller */
+#define	PCI_PRODUCT_ATI_IXP_IDE_200	0x4349		/* SB200 IXP IDE Controller */
+#define	PCI_PRODUCT_ATI_SB200_ISA	0x434c		/* SB200 PCI-ISA Bridge */
+#define	PCI_PRODUCT_ATI_SB200_MODEM	0x434d		/* SB200 Modem */
+#define	PCI_PRODUCT_ATI_SB200_SMB	0x4353		/* SB200 SMBus Controller */
+#define	PCI_PRODUCT_ATI_IXP_AUDIO_300	0x4361		/* IXP AC'97 Audio Controller */
+#define	PCI_PRODUCT_ATI_SB300_SMB	0x4363		/* SB300 SMBus Controller */
+#define	PCI_PRODUCT_ATI_IXP_IDE_300	0x4369		/* SB300 IXP IDE Controller */
+#define	PCI_PRODUCT_ATI_IXP_SATA_300	0x436e		/* IXP300 SATA Controller */
+#define	PCI_PRODUCT_ATI_IXP_AUDIO_400	0x4370		/* IXP AC'97 Audio Controller */
+#define	PCI_PRODUCT_ATI_SB400_PPB	0x4371		/* SB400 PCI-PCI Bridge */
+#define	PCI_PRODUCT_ATI_SB400_SMB	0x4372		/* SB400 SMBus Controller */
+#define	PCI_PRODUCT_ATI_SB400_EHCI	0x4373		/* SB400 USB2 Host Controller */
+#define	PCI_PRODUCT_ATI_SB400_OHCI_1	0x4374		/* SB400 USB Host Controller */
+#define	PCI_PRODUCT_ATI_SB400_OHCI_2	0x4375		/* SB400 USB Host Controller */
+#define	PCI_PRODUCT_ATI_IXP_IDE_400	0x4376		/* SB400 IXP IDE Controller */
+#define	PCI_PRODUCT_ATI_SB400_ISA	0x4377		/* SB400 PCI-ISA Bridge */
+#define	PCI_PRODUCT_ATI_SB400_MODEM	0x4378		/* SB400 Modem */
+#define	PCI_PRODUCT_ATI_SB400_SATA_1	0x4379		/* SB400 SATA Controller */
+#define	PCI_PRODUCT_ATI_SB400_SATA_2	0x437a		/* SB400 SATA Controller */
+#define	PCI_PRODUCT_ATI_SB600_SATA_1	0x4380		/* SB600 SATA Controller */
+#define	PCI_PRODUCT_ATI_SB600_SATA_2	0x4381		/* SB600 SATA Controller */
+#define	PCI_PRODUCT_ATI_SB600_AC97_AUDIO	0x4382		/* SB600 AC97 Audio */
+#define	PCI_PRODUCT_ATI_SB600_AZALIA	0x4383		/* SBx00 Azalia */
+#define	PCI_PRODUCT_ATI_SB600_PPB	0x4384		/* SBx00 PCI to PCI Bridge */
+#define	PCI_PRODUCT_ATI_SB600_SMB	0x4385		/* SBx00 SMBus Controller */
+#define	PCI_PRODUCT_ATI_SB600_USB_EHCI	0x4386		/* SB600 USB EHCI Controller */
+#define	PCI_PRODUCT_ATI_SB600_USB_OHCI0	0x4387		/* SB600 USB OHCI0 Controller */
+#define	PCI_PRODUCT_ATI_SB600_USB_OHCI1	0x4388		/* SB600 USB OHCI1 Controller */
+#define	PCI_PRODUCT_ATI_SB600_USB_OHCI2	0x4389		/* SB600 USB OHCI2 Controller */
+#define	PCI_PRODUCT_ATI_SB600_USB_OHCI3	0x438a		/* SB600 USB OHCI3 Controller */
+#define	PCI_PRODUCT_ATI_SB600_USB_OHCI4	0x438b		/* SB600 USB OHCI4 Controller */
+#define	PCI_PRODUCT_ATI_SB600_AC97_MODEM	0x438e		/* SB600 AC97 Modem */
+#define	PCI_PRODUCT_ATI_IXP_IDE_600	0x438c		/* SB600 IXP IDE Controller */
+#define	PCI_PRODUCT_ATI_SB600_PLB_438D	0x438d		/* SB600 PCI to LPC Bridge */
+#define	PCI_PRODUCT_ATI_SB700_SATA_IDE	0x4390		/* SB700-SB900 SATA Controller (IDE mode) */
+#define	PCI_PRODUCT_ATI_SB700_SATA_AHCI	0x4391		/* SB700-SB900 SATA Controller (AHCI mode) */
+#define	PCI_PRODUCT_ATI_SB700_SATA_RAID	0x4392		/* SB700-SB900 RAID SATA Controller */
+#define	PCI_PRODUCT_ATI_SB700_SATA_RAID5	0x4393		/* SB700-SB900 RAID5 SATA Controller */
+#define	PCI_PRODUCT_ATI_SB700_SATA_FC	0x4394		/* SB700-SB900 FC SATA Controller */
+#define	PCI_PRODUCT_ATI_SB700_SATA_AHCI2	0x4395		/* SB700-SB900 SATA Controller (AHCI mode) */
+#define	PCI_PRODUCT_ATI_SB700_USB_EHCI	0x4396		/* SB700-SB900 USB EHCI Controller */
+#define	PCI_PRODUCT_ATI_SB800_SATA	0x4395		/* SB800/SB900 SATA Controller */
+#define	PCI_PRODUCT_ATI_SB700_USB_OHCI0	0x4397		/* SB700-SB900 USB OHCI Controller */
+#define	PCI_PRODUCT_ATI_SB700_USB_OHCI1	0x4398		/* SB700-SB900 USB OHCI Controller */
+#define	PCI_PRODUCT_ATI_SB700_USB_OHCI2	0x4399		/* SB700-SB900 USB OHCI Controller */
+#define	PCI_PRODUCT_ATI_SB700_IDE	0x439c		/* SB700-SB900 IDE Controller */
+#define	PCI_PRODUCT_ATI_SB700_LPC	0x439d		/* SB700-SB900 LPC Host Controller */
+#define	PCI_PRODUCT_ATI_SB700_PCIE0	0x43a0		/* SB700-SB900 PCI to PCI bridge (PCIe 0) */
+#define	PCI_PRODUCT_ATI_SB700_PCIE1	0x43a1		/* SB700-SB900 PCI to PCI bridge (PCIe 1) */
+#define	PCI_PRODUCT_ATI_SB900_PCIE2	0x43a2		/* SB900 PCI to PCI bridge (PCIe 2) */
+#define	PCI_PRODUCT_ATI_SB900_PCIE3	0x43a3		/* SB900 PCI to PCI bridge (PCIe 3) */
+#define	PCI_PRODUCT_ATI_MACH64_CT	0x4354		/* Mach64 CT */
+#define	PCI_PRODUCT_ATI_MACH64_CX	0x4358		/* Mach64 CX */
+#define	PCI_PRODUCT_ATI_RADEON_RS250_D7	0x4437		/* Radeon Mobility 7000 IGP */
+#define	PCI_PRODUCT_ATI_RAGE_PRO_AGP	0x4742		/* 3D Rage Pro (AGP) */
+#define	PCI_PRODUCT_ATI_RAGE_PRO_AGP1X	0x4744		/* 3D Rage Pro (AGP 1x) */
+#define	PCI_PRODUCT_ATI_RAGE_PRO_PCI_B	0x4749		/* 3D Rage Pro Turbo */
+#define	PCI_PRODUCT_ATI_RAGE_XC_PCI66	0x474c		/* Rage XC (PCI66) */
+#define	PCI_PRODUCT_ATI_RAGE_XL_AGP	0x474d		/* Rage XL (AGP) */
+#define	PCI_PRODUCT_ATI_RAGE_XC_AGP	0x474e		/* Rage XC (AGP) */
+#define	PCI_PRODUCT_ATI_RAGE_XL_PCI66	0x474f		/* Rage XL (PCI66) */
+#define	PCI_PRODUCT_ATI_RAGE_PRO_PCI_P	0x4750		/* 3D Rage Pro */
+#define	PCI_PRODUCT_ATI_RAGE_PRO_PCI_L	0x4751		/* 3D Rage Pro (limited 3D) */
+#define	PCI_PRODUCT_ATI_RAGE_XL_PCI	0x4752		/* Rage XL */
+#define	PCI_PRODUCT_ATI_RAGE_XC_PCI	0x4753		/* Rage XC */
+#define	PCI_PRODUCT_ATI_RAGE_II	0x4754		/* 3D Rage I/II */
+#define	PCI_PRODUCT_ATI_RAGE_IIP	0x4755		/* 3D Rage II+ */
+#define	PCI_PRODUCT_ATI_RAGE_IIC_PCI	0x4756		/* 3D Rage IIC */
+#define	PCI_PRODUCT_ATI_RAGE_IIC_AGP_B	0x4757		/* 3D Rage IIC (AGP) */
+#define	PCI_PRODUCT_ATI_MACH64_GX	0x4758		/* Mach64 GX */
+#define	PCI_PRODUCT_ATI_RAGE_IIC	0x4759		/* 3D Rage IIC */
+#define	PCI_PRODUCT_ATI_RAGE_IIC_AGP_P	0x475a		/* 3D Rage IIC (AGP) */
+#define	PCI_PRODUCT_ATI_RADEON_RV250_4966	0x4966		/* Radeon 9000/PRO If */
+#define	PCI_PRODUCT_ATI_RADEON_RV250_4967	0x4967		/* Radeon 9000 Ig */
+#define	PCI_PRODUCT_ATI_RADEON_R420_JH	0x4a48		/* Radeon X800 (R420) JH */
+#define	PCI_PRODUCT_ATI_RADEON_R420_JI	0x4a49		/* Radeon X800PRO (R420) JI */
+/* XXX 4a4a is generic, the SE should be 4a4f */
+#define	PCI_PRODUCT_ATI_RADEON_R420_JJ	0x4a4a		/* Radeon X800SE (R420) JJ */
+/* XXX 4a4b should be the XT */
+#define	PCI_PRODUCT_ATI_RADEON_R420_JK	0x4a4b		/* Radeon X800 (R420) JK */
+#define	PCI_PRODUCT_ATI_RADEON_R420_JL	0x4a4c		/* Radeon X800 (R420) JL */
+#define	PCI_PRODUCT_ATI_RADEON_R420_JM	0x4a4d		/* FireGL X3 (R420) JM */
+#define	PCI_PRODUCT_ATI_RADEON_R420_JN	0x4a4e		/* Radeon Mobility 9800 (M18) JN */
+/* Duplicate, maybe this entry should be 4a50, XT Platinum */
+#define	PCI_PRODUCT_ATI_RADEON_R420_JP	0x4a4e		/* Radeon X800XT (R420) JP */
+#define	PCI_PRODUCT_ATI_RAGE_LT_PRO_AGP	0x4c42		/* 3D Rage LT Pro (AGP 133MHz) */
+#define	PCI_PRODUCT_ATI_RAGE_LT_PRO_AGP66	0x4c44		/* 3D Rage LT Pro (AGP 66MHz) */
+#define	PCI_PRODUCT_ATI_RAGE_MOB_M3_PCI	0x4c45		/* Rage Mobility M3 */
+#define	PCI_PRODUCT_ATI_RAGE_MOB_M3_AGP	0x4c46		/* Rage Mobility M3 (AGP) */
+#define	PCI_PRODUCT_ATI_RAGE_LT	0x4c47		/* 3D Rage LT */
+#define	PCI_PRODUCT_ATI_RAGE_LT_PRO_PCI	0x4c49		/* 3D Rage LT Pro */
+#define	PCI_PRODUCT_ATI_RAGE_MOBILITY	0x4c4d		/* Rage Mobility */
+#define	PCI_PRODUCT_ATI_RAGE_L_MOBILITY	0x4c4e		/* Rage L Mobility */
+#define	PCI_PRODUCT_ATI_RAGE_LT_PRO	0x4c50		/* 3D Rage LT Pro */
+#define	PCI_PRODUCT_ATI_RAGE_LT_PRO2	0x4c51		/* 3D Rage LT Pro */
+#define	PCI_PRODUCT_ATI_RAGE_MOB_M1_PCI	0x4c52		/* Rage Mobility M1 (PCI) */
+#define	PCI_PRODUCT_ATI_RAGE_L_MOB_M1_PCI	0x4c53		/* Rage L Mobility (PCI) */
+#define	PCI_PRODUCT_ATI_RADEON_RV200_LW	0x4c57		/* Radeon Mobility M7 LW */
+#define	PCI_PRODUCT_ATI_RADEON_RV200_LX	0x4c58		/* FireGL Mobility 7800 M7 LX */
+#define	PCI_PRODUCT_ATI_RADEON_RV100_LY	0x4c59		/* Radeon Mobility M6 LY */
+#define	PCI_PRODUCT_ATI_RADEON_RV100_LZ	0x4c5a		/* Radeon Mobility M6 LZ */
+#define	PCI_PRODUCT_ATI_RADEON_RV250_4C64	0x4c64		/* FireGL Mobility 9000 (M9) Ld */
+#define	PCI_PRODUCT_ATI_RADEON_RV250_4C66	0x4c66		/* Radeon Mobility 9000 (M9) Lf */
+#define	PCI_PRODUCT_ATI_RADEON_RV250_4C67	0x4c67		/* Radeon Mobility 9000 (M9) Lg */
+#define	PCI_PRODUCT_ATI_RADEON_128_AGP4X	0x4d46		/* Radeon Mobility 128 AGP 4x */
+#define	PCI_PRODUCT_ATI_RADEON_128_AGP2X	0x4d4c		/* Radeon Mobility 128 AGP 2x */
+#define	PCI_PRODUCT_ATI_RADEON_R300_ND	0x4e44		/* Radeon 9700 ND */
+#define	PCI_PRODUCT_ATI_RADEON_R300_NE	0x4e45		/* Radeon 9700/9500Pro NE */
+#define	PCI_PRODUCT_ATI_RADEON_R300_NF	0x4e46		/* Radeon 9700 NF */
+#define	PCI_PRODUCT_ATI_RADEON_R300_NG	0x4e47		/* FireGL X1 NG */
+#define	PCI_PRODUCT_ATI_RADEON_R350_NH	0x4e48		/* Radeon 9800PRO NH */
+#define	PCI_PRODUCT_ATI_RADEON_R350_NI	0x4e49		/* Radeon 9800 NI */
+#define	PCI_PRODUCT_ATI_RADEON_R360_NJ	0x4e4a		/* Radeon 9800XT NJ */
+#define	PCI_PRODUCT_ATI_RADEON_R350_NK	0x4e4b		/* FireGL X2 NK */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_NP	0x4e50		/* Radeon Mobility 9600/9700 (M10/11) NP */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_NQ	0x4e41		/* Radeon Mobility 9600 (M10) NQ */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_NR	0x4e52		/* Radeon Mobility 9600 (M11) NR */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_NS	0x4e53		/* Radeon Mobility 9600 (M10) NS */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_NT	0x4e54		/* FireGL Mobility T2 (M10) NT */
+#define	PCI_PRODUCT_ATI_RADEON_RV350_NV	0x4e56		/* FireGL Mobility T2e (M11) NV */
+#define	PCI_PRODUCT_ATI_RADEON_9700_9500_S	0x4e64		/* Radeon 9700/9500 Series Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_9700_9500_S2	0x4e65		/* Radeon 9700/9500 Series Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_9600_2	0x4e66		/* Radeon 9600TX Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_9800_PRO_2	0x4e68		/* Radeon 9800 Pro Secondary */
+#define	PCI_PRODUCT_ATI_RAGE1PCI	0x5041		/* Rage 128 Pro PCI */
+#define	PCI_PRODUCT_ATI_RAGE1AGP2X	0x5042		/* Rage 128 Pro AGP 2x */
+#define	PCI_PRODUCT_ATI_RAGE1AGP4X	0x5043		/* Rage 128 Pro AGP 4x */
+#define	PCI_PRODUCT_ATI_RAGE1PCIT	0x5044		/* Rage 128 Pro PCI (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE1AGP2XT	0x5045		/* Rage 128 Pro AGP 2x (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE1AGP4XT	0x5046		/* Rage Fury MAXX AGP 4x (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE2PCI	0x5047		/* Rage 128 Pro PCI */
+#define	PCI_PRODUCT_ATI_RAGE2AGP2X	0x5048		/* Rage 128 Pro AGP 2x */
+#define	PCI_PRODUCT_ATI_RAGE2AGP4X	0x5049		/* Rage 128 Pro AGP 4x */
+#define	PCI_PRODUCT_ATI_RAGE2PCIT	0x504a		/* Rage 128 Pro PCI (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE2AGP2XT	0x504b		/* Rage 128 Pro AGP 2x (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE2AGP4XT	0x504c		/* Rage 128 Pro AGP 4x (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE3PCI	0x504d		/* Rage 128 Pro PCI */
+#define	PCI_PRODUCT_ATI_RAGE3AGP2X	0x504e		/* Rage 128 Pro AGP 2x */
+#define	PCI_PRODUCT_ATI_RAGE3AGP4X	0x504f		/* Rage 128 Pro AGP 4x */
+#define	PCI_PRODUCT_ATI_RAGE3PCIT	0x5050		/* Rage 128 Pro PCI (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE3AGP2XT	0x5051		/* Rage 128 Pro AGP 2x (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE3AGP4XT	0x5052		/* Rage 128 Pro AGP 4x (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE4PCI	0x5053		/* Rage 128 Pro PCI */
+#define	PCI_PRODUCT_ATI_RAGE4AGP2X	0x5054		/* Rage 128 Pro AGP 2x */
+#define	PCI_PRODUCT_ATI_RAGE4AGP4X	0x5055		/* Rage 128 Pro AGP 4x */
+#define	PCI_PRODUCT_ATI_RAGE4PCIT	0x5056		/* Rage 128 Pro PCI (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE4AGP2XT	0x5057		/* Rage 128 Pro AGP 2x (TMDS) */
+#define	PCI_PRODUCT_ATI_RAGE4AGP4XT	0x5058		/* Rage 128 Pro AGP 4x (TMDS) */
+#define	PCI_PRODUCT_ATI_RADEON_R100_QD	0x5144		/* Radeon QD */
+#define	PCI_PRODUCT_ATI_RADEON_R100_QE	0x5145		/* Radeon QE */
+#define	PCI_PRODUCT_ATI_RADEON_R100_QF	0x5146		/* Radeon QF */
+#define	PCI_PRODUCT_ATI_RADEON_R100_QG	0x5147		/* Radeon QG */
+#define	PCI_PRODUCT_ATI_RADEON_R200_QH	0x5148		/* FireGL 8700/8800 QH */
+#define	PCI_PRODUCT_ATI_RADEON_R200_QL	0x514c		/* Radeon 8500 QL */
+#define	PCI_PRODUCT_ATI_RADEON_R200_QM	0x514d		/* Radeon 9100 QM */
+#define	PCI_PRODUCT_ATI_RADEON_RV200_QW	0x5157		/* Radeon 7500 QW */
+#define	PCI_PRODUCT_ATI_RADEON_RV200_QX	0x5158		/* Radeon 7500 QX */
+#define	PCI_PRODUCT_ATI_RADEON_RV100_QY	0x5159		/* Radeon 7000/VE QY */
+#define	PCI_PRODUCT_ATI_RADEON_RV100_QZ	0x515a		/* Radeon 7000/VE QZ */
+#define	PCI_PRODUCT_ATI_ES1000	0x515e		/* ES1000 */
+#define	PCI_PRODUCT_ATI_RADEON_9100_S	0x516d		/* Radeon 9100 Series Secondary */
+#define	PCI_PRODUCT_ATI_RAGEGLPCI	0x5245		/* Rage 128 GL PCI */
+#define	PCI_PRODUCT_ATI_RAGEGLAGP	0x5246		/* Rage 128 GL AGP 2x */
+#define	PCI_PRODUCT_ATI_RAGEVRPCI	0x524b		/* Rage 128 VR PCI */
+#define	PCI_PRODUCT_ATI_RAGEVRAGP	0x524c		/* Rage 128 VR AGP 2x */
+#define	PCI_PRODUCT_ATI_RAGE4XPCI	0x5345		/* Rage 128 4x PCI */
+#define	PCI_PRODUCT_ATI_RAGE4XA2X	0x5346		/* Rage 128 4x AGP 2x */
+#define	PCI_PRODUCT_ATI_RAGE4XA4X	0x5347		/* Rage 128 4x AGP 4x */
+#define	PCI_PRODUCT_ATI_RAGE4X	0x5348		/* Rage 128 4x */
+#define	PCI_PRODUCT_ATI_RAGE24XPCI	0x534b		/* Rage 128 4x PCI */
+#define	PCI_PRODUCT_ATI_RAGE24XA2X	0x534c		/* Rage 128 4x AGP 2x */
+#define	PCI_PRODUCT_ATI_RAGE24XA4X	0x534d		/* Rage 128 4x AGP 4x */
+#define	PCI_PRODUCT_ATI_RAGE24X	0x534e		/* Rage 128 4x */
+#define	PCI_PRODUCT_ATI_RAGE128PROULTRATF	0x5446		/* Rage 128 Pro Ultra TF AGP */
+#define	PCI_PRODUCT_ATI_RADEON_RV370_5460	0x5460		/* Radeon Mobility M300 (M22) 5460 */
+#define	PCI_PRODUCT_ATI_RADEON_RV370_5464	0x5464		/* FireGL M22 GL 5464 */
+#define	PCI_PRODUCT_ATI_RADEON_R423_UH	0x5548		/* Radeon X800 (R423) UH */
+#define	PCI_PRODUCT_ATI_RADEON_R423_UI	0x5549		/* Radeon X800PRO (R423) UI */
+#define	PCI_PRODUCT_ATI_RADEON_R423_UJ	0x554a		/* Radeon X800LE (R423) UJ */
+#define	PCI_PRODUCT_ATI_RADEON_R423_UK	0x554b		/* Radeon X800SE (R423) UK */
+#define	PCI_PRODUCT_ATI_RADEON_R430_554F	0x554f		/* Radeon X800 GTO (R430) 554F */
+#define	PCI_PRODUCT_ATI_RADEON_R423_UQ	0x5551		/* FireGL V7200 (R423) UQ */
+#define	PCI_PRODUCT_ATI_RADEON_R423_UR	0x5552		/* FireGL V5100 (R423) UR */
+#define	PCI_PRODUCT_ATI_RADEON_R423_UT	0x5554		/* FireGL V7100 (R423) UT */
+#define	PCI_PRODUCT_ATI_RADEON_R430_556F	0x556f		/* Radeon X800 GTO (R430) Secondary */
+#define	PCI_PRODUCT_ATI_MACH64_VT	0x5654		/* Mach64 VT */
+#define	PCI_PRODUCT_ATI_MACH64_VTB	0x5655		/* Mach64 VTB */
+#define	PCI_PRODUCT_ATI_MACH64_VT4	0x5656		/* Mach64 VT4 */
+#define	PCI_PRODUCT_ATI_RS300_HB	0x5833		/* RS300 Host Bridge */
+#define	PCI_PRODUCT_ATI_RADEON_RS300_X4	0x5834		/* Radeon 9100 IGP (A4) */
+#define	PCI_PRODUCT_ATI_RADEON_RS300_X5	0x5835		/* Radeon Mobility 9100 IGP (U3) */
+#define	PCI_PRODUCT_ATI_RS300_AGP	0x5838		/* RS300 AGP Interface */
+#define	PCI_PRODUCT_ATI_RADEON_9200_PRO_S	0x5940		/* Radeon 9200 Pro Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_9200_S	0x5941		/* Radeon 9200 Secondary */
+#define	PCI_PRODUCT_ATI_RS480_HB	0x5950		/* RS480 Host Bridge */
+#define	PCI_PRODUCT_ATI_RD580	0x5952		/* RD580 CrossFire Xpress 3200 Host Bridge */
+#define	PCI_PRODUCT_ATI_RADEON_RV370_5954	0x5954		/* Radeon Xpress 200G Series */
+#define	PCI_PRODUCT_ATI_RD790_NB	0x5956		/* RD790 North Bridge (Dual Slot) */
+#define	PCI_PRODUCT_ATI_RX780_790_HB	0x5957		/* RX780/RX790 Chipset Host Bridge */
+#define	PCI_PRODUCT_ATI_RADEON_RV280_5960	0x5960		/* Radeon 9200PRO 5960 */
+#define	PCI_PRODUCT_ATI_RADEON_RV280_5961	0x5961		/* Radeon 9200 5961 */
+#define	PCI_PRODUCT_ATI_RADEON_RV280_5962	0x5962		/* Radeon 9200 5962 */
+#define	PCI_PRODUCT_ATI_RADEON_RV280_5963	0x5963		/* Radeon 9200 5963 */
+#define	PCI_PRODUCT_ATI_RADEON_RV280_5964	0x5964		/* Radeon 9200SE 5964 */
+#define	PCI_PRODUCT_ATI_RS482M	0x5975		/* Radeon Xpress Series (RS482M) */
+#define	PCI_PRODUCT_ATI_RD790_PPB_GFX0_A	0x5978		/* RD790 PCI Bridge GFX0 Port A */
+#define	PCI_PRODUCT_ATI_RD790_PPB_GFX0_B	0x5979		/* RD790 PCI Bridge GFX0 Port B */
+#define	PCI_PRODUCT_ATI_RD790_PPB_GPP_A	0x597a		/* RD790 PCI Express Bridge GPP Port A */
+#define	PCI_PRODUCT_ATI_RD790_PPB_GPP_B	0x597b		/* RD790 PCI Express Bridge GPP Port B */
+#define	PCI_PRODUCT_ATI_RD790_PPB_GPP_C	0x597c		/* RD790 PCI Express Bridge GPP Port C */
+#define	PCI_PRODUCT_ATI_RD790_PPB_GPP_D	0x597d		/* RD790 PCI Express Bridge GPP Port D */
+#define	PCI_PRODUCT_ATI_RD790_PPB_GPP_E	0x597e		/* RD790 PCI Express Bridge GPP Port E */
+#define	PCI_PRODUCT_ATI_RD790_PPB_GPP_F	0x597f		/* RD790 PCI Express Bridge GPP Port F */
+#define	PCI_PRODUCT_ATI_RD790_PPB_GFX1_A	0x5980		/* RD790 PCI Bridge GFX1 Port A */
+#define	PCI_PRODUCT_ATI_RD790_PPB_GFX1_B	0x5981		/* RD790 PCI Bridge GFX1 Port B */
+#define	PCI_PRODUCT_ATI_RD790_PPB_NBSB	0x5982		/* RD790 PCI Bridge (NB-SB Link) */
+#define	PCI_PRODUCT_ATI_RD890_NB_DS16	0x5a10		/* RD890 North Bridge Dual Slot 2x16 GFX */
+#define	PCI_PRODUCT_ATI_RD890_NB_SS	0x5a11		/* RD890 North Bridge Single Slot GFX */
+#define	PCI_PRODUCT_ATI_RD890_NB_DS8	0x5a12		/* RD890 North Bridge Dual Slot 2x8 GFX */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GFX0_A	0x5a13		/* RD890 PCI Bridge GFX0 Port A */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GFX0_B	0x5a14		/* RD890 PCI Bridge GFX0 Port B */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GPP_A	0x5a15		/* RD890 PCI Express Bridge GPP Port A */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GPP_B	0x5a16		/* RD890 PCI Express Bridge GPP Port B */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GPP_C	0x5a17		/* RD890 PCI Express Bridge GPP Port C */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GPP_D	0x5a18		/* RD890 PCI Express Bridge GPP Port D */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GPP_E	0x5a19		/* RD890 PCI Express Bridge GPP Port E */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GPP_F	0x5a1a		/* RD890 PCI Express Bridge GPP Port F */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GPP_G	0x5a1b		/* RD890 PCI Express Bridge GPP Port G */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GPP_H	0x5a1c		/* RD890 PCI Express Bridge GPP Port H */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GFX1_A	0x5a1d		/* RD890 PCI Bridge GFX1 Port A */
+#define	PCI_PRODUCT_ATI_RD890_PPB_GFX1_B	0x5a1e		/* RD890 PCI Bridge GFX1 Port B */
+#define	PCI_PRODUCT_ATI_RD890_PPB_NBSB	0x5a1f		/* RD890 PCI Bridge (NB-SB Link) */
+#define	PCI_PRODUCT_ATI_RD890_IOMMU	0x5a23		/* RD890 IOMMU */
+#define	PCI_PRODUCT_ATI_RADEON_XPRESS_200	0x5a33		/* Radeon Xpress 200 */
+#define	PCI_PRODUCT_ATI_RS480_XRP	0x5a34		/* RS480 PCI Express Root Port */
+#define	PCI_PRODUCT_ATI_RS480_PPB_5A36	0x5a36		/* RS480 PCI Express Bridge */
+#define	PCI_PRODUCT_ATI_RS480_PPB_5A37	0x5a37		/* RS480 PCI Express Bridge */
+#define	PCI_PRODUCT_ATI_RS480_PPB_5A38	0x5a38		/* RS480 PCI Express Bridge */
+#define	PCI_PRODUCT_ATI_RS480_PPB_5A3F	0x5a3f		/* RS480 PCI Express Bridge */
+#define	PCI_PRODUCT_ATI_RADEON_RV370_5B60	0x5b60		/* Radeon X300 (RV370) 5B60 */
+#define	PCI_PRODUCT_ATI_RADEON_RV380_5B62	0x5b62		/* Radeon X600 PCI Express */
+#define	PCI_PRODUCT_ATI_RADEON_RV370_5B63	0x5b63		/* Radeon Sapphire X550 Silent */
+#define	PCI_PRODUCT_ATI_RADEON_RV370_5B64	0x5b64		/* FireGL V3100 (RV370) 5B64 */
+#define	PCI_PRODUCT_ATI_RADEON_RV370_5B65	0x5b65		/* FireGL D1100 (RV370) 5B65 */
+#define	PCI_PRODUCT_ATI_RADEON_X300_S	0x5b70		/* Radeon X300 Series Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_RV370_5B73	0x5b73		/* Radeon RV370 Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_RV280_5C61	0x5c61		/* Radeon Mobility 9200 (M9+) */
+#define	PCI_PRODUCT_ATI_RADEON_RV280_5C63	0x5c63		/* Radeon Mobility 9200 (M9+) */
+#define	PCI_PRODUCT_ATI_RADEON_9200SE_S	0x5d44		/* Radeon 9200SE Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_X850XT	0x5d52		/* Radeon X850 XT */
+#define	PCI_PRODUCT_ATI_RADEON_R423_5D57	0x5d57		/* Radeon X800XT (R423) 5D57 */
+#define	PCI_PRODUCT_ATI_RADEON_X850XT_S	0x5d72		/* Radeon X850 XT Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_X700	0x5e4b		/* Radeon X700 Pro */
+#define	PCI_PRODUCT_ATI_RADEON_X700_S	0x5e6b		/* Radeon X700 Pro Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_HD5870	0x6898		/* Radeon HD 5870 Cypress */
+#define	PCI_PRODUCT_ATI_RADEON_HD5600_RD	0x68c1		/* Radeon HD 5600 Redwood */
+#define	PCI_PRODUCT_ATI_RADEON_HD5450	0x68f9		/* Radeon HD 5450 */
+#define	PCI_PRODUCT_ATI_RADEON_X1300	0x7146		/* Radeon X1300 Series (RV515) */
+#define	PCI_PRODUCT_ATI_RADEON_X1300_S	0x7166		/* Radeon X1300 Series (RV515) Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_X1600XT	0x71c0		/* Radeon X1600 XT */
+#define	PCI_PRODUCT_ATI_RADEON_X1600	0x71c5		/* Radeon Mobility X1600 */
+#define	PCI_PRODUCT_ATI_RADEON_X1600XT_S	0x71e0		/* Radeon X1600 XT Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_X1950	0x7280		/* Radeon X1950 PRO */
+#define	PCI_PRODUCT_ATI_RADEON_X1950_S	0x72a0		/* Radeon X1950 PRO Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_RS300_7834	0x7834		/* Radeon 9100 PRO IGP */
+#define	PCI_PRODUCT_ATI_RADEON_RS300_7835	0x7835		/* Radeon 9200 IGP */
+#define	PCI_PRODUCT_ATI_RS690_HB_7910	0x7910		/* RS690 Host Bridge */
+#define	PCI_PRODUCT_ATI_RS690_HB_7911	0x7911		/* RS740 Host Bridge */
+#define	PCI_PRODUCT_ATI_RS690_PPB_7912	0x7912		/* RS690 GFX Bridge */
+#define	PCI_PRODUCT_ATI_RS690_PPB_7913	0x7913		/* RS690 PCI Express Bridge GFX */
+#define	PCI_PRODUCT_ATI_RS690_PPB_7914	0x7914		/* RS690 PCI Express Bridge GPP Port A */
+#define	PCI_PRODUCT_ATI_RS690_PPB_7915	0x7915		/* RS690 PCI Express Bridge GPP Port B */
+#define	PCI_PRODUCT_ATI_RS690_PPB_7916	0x7916		/* RS690 PCI Express Bridge GPP Port C */
+#define	PCI_PRODUCT_ATI_RS690_PPB_7917	0x7917		/* RS690 PCI Express Bridge GPP Port D */
+#define	PCI_PRODUCT_ATI_RADEON_HD4850	0x9442		/* Radeon HD4850 */
+#define	PCI_PRODUCT_ATI_RADEON_HD4650	0x9498		/* Radeon HD4650 */
+#define	PCI_PRODUCT_ATI_RADEON_HD2400_XT	0x94c1		/* Radeon HD2400 XT */
+#define	PCI_PRODUCT_ATI_RADEON_HD2400_PRO	0x94c3		/* Radeon HD2400 Pro */
+#define	PCI_PRODUCT_ATI_RADEON_HD2400_M72	0x94c9		/* Mobility Radeon HD 2400 */
+#define	PCI_PRODUCT_ATI_RADEON_HD3870	0x9501		/* Radeon HD3870 */
+#define	PCI_PRODUCT_ATI_RADEON_HD4350	0x954f		/* Radeon HD4350 */
+#define	PCI_PRODUCT_ATI_RADEON_HD4500_M93	0x9555		/* Mobility Radeon HD 4500 */
+#define	PCI_PRODUCT_ATI_RADEON_HD2600_M76	0x9581		/* Mobility Radeon HD 2600 */
+#define	PCI_PRODUCT_ATI_RADEON_HD2600PROAGP	0x9587		/* Radeon HD2600 Pro AGP */
+#define	PCI_PRODUCT_ATI_RADEON_HD2600_XT	0x9588		/* Radeon HD2600 XT GDDR3 */
+#define	PCI_PRODUCT_ATI_RADEON_HD2600_PRO	0x9589		/* Radeon HD 2600 Pro */
+#define	PCI_PRODUCT_ATI_RADEON_HD3650_M	0x9591		/* Mobility Radeon HD 3650 */
+#define	PCI_PRODUCT_ATI_RADEON_HD3650_AGP	0x9596		/* Radeon HD3650 AGP */
+#define	PCI_PRODUCT_ATI_RADEON_HD3650	0x9598		/* Radeon HD3650 */
+#define	PCI_PRODUCT_ATI_RADEON_HD3400_M82	0x95c4		/* Mobility Radeon HD 3400 Series (M82) */
+#define	PCI_PRODUCT_ATI_RADEON_HD4250_S	0x95c5		/* Radeon HD4250 GPU (RV610) Secondary */
+#define	PCI_PRODUCT_ATI_RADEON_HD6520G	0x9647		/* Radeon HD6520G */
+#define	PCI_PRODUCT_ATI_RADEON_HD4200	0x9712		/* Radeon HD4200 Mobility */
+#define	PCI_PRODUCT_ATI_RADEON_HD4250	0x9715		/* Radeon HD4250 GPU (RS880) */
+#define	PCI_PRODUCT_ATI_RADEON_HD6310	0x9802		/* Radeon HD6310 Graphics */
+#define	PCI_PRODUCT_ATI_RADEON_HD6320	0x9806		/* Radeon HD6320 Graphics */
+#define	PCI_PRODUCT_ATI_RADEON_HD7340	0x9808		/* Radeon HD7340 Graphics */
+#define	PCI_PRODUCT_ATI_RADEON_HD2600_HD	0xaa08		/* Radeon HD2600 HD Audio Controller */
+#define	PCI_PRODUCT_ATI_RADEON_HD4350_HD	0xaa38		/* Radeon HD4350 HD Audio Controller */
+#define	PCI_PRODUCT_ATI_RADEON_HD5600_HDMI	0xaa60		/* Redwood HDMI Audio */
+#define	PCI_PRODUCT_ATI_RADEON_HD54XX_HDA	0xaa68		/* Radeon HD 54xx Audio */
+
+/* Auravision products */
+#define	PCI_PRODUCT_AURAVISION_VXP524	0x01f7		/* VxP524 PCI Video Processor */
+
+/* Aureal Semiconductor */
+#define	PCI_PRODUCT_AUREAL_AU8820	0x0001		/* AU8820 Vortex Digital Audio Processor */
+#define	PCI_PRODUCT_AUREAL_AU8830	0x0002		/* AU8830 Vortex 3D Digital Audio Processor */
+
+/* Applied Micro Circuts products */
+#define	PCI_PRODUCT_AMCIRCUITS_S5933	0x4750		/* S5933 PCI Matchmaker */
+#define	PCI_PRODUCT_AMCIRCUITS_LANAI	0x8043		/* Myrinet LANai Interface */
+#define	PCI_PRODUCT_AMCIRCUITS_CAMAC	0x812d		/* FZJ/ZEL CAMAC Controller */
+#define	PCI_PRODUCT_AMCIRCUITS_VICBUS	0x812e		/* FZJ/ZEL VICBUS Interface */
+#define	PCI_PRODUCT_AMCIRCUITS_PCISYNC	0x812f		/* FZJ/ZEL Synchronisation Module */
+#define	PCI_PRODUCT_AMCIRCUITS_ADDI7800	0x818e		/* ADDI-DATA APCI-7800 8-port Serial */
+#define	PCI_PRODUCT_AMCIRCUITS_S5920	0x5920		/* S5920 PCI Target */
+
+/* ASPEED Technology products */
+#define	PCI_PRODUCT_ASPEED_AST1150	0x1150		/* AST1150 PCIe-to-PCI bridge */
+#define	PCI_PRODUCT_ASPEED_AST1180	0x1180		/* AST1180 */
+#define	PCI_PRODUCT_ASPEED_AST2000	0x2000		/* ASPEED Graphics Family */
+
+/* Atheros Communications products */
+#define	PCI_PRODUCT_ATHEROS_AR5201	0x0007		/* AR5201 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR5311	0x0011		/* AR5211 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR5211	0x0012		/* AR5211 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR5212	0x0013		/* AR5212 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR5212_2	0x0014		/* AR5212 */
+#define	PCI_PRODUCT_ATHEROS_AR5212_3	0x0015		/* AR5212 */
+#define	PCI_PRODUCT_ATHEROS_AR5212_4	0x0016		/* AR5212 */
+#define	PCI_PRODUCT_ATHEROS_AR5212_5	0x0017		/* AR5212 */
+#define	PCI_PRODUCT_ATHEROS_AR5212_6	0x0018		/* AR5212 */
+#define	PCI_PRODUCT_ATHEROS_AR5212_7	0x0019		/* AR5212 */
+#define	PCI_PRODUCT_ATHEROS_AR2413	0x001a		/* AR2413 */
+#define	PCI_PRODUCT_ATHEROS_AR5413	0x001b		/* AR5413 */
+#define	PCI_PRODUCT_ATHEROS_AR5424	0x001c		/* AR5424 */
+#define	PCI_PRODUCT_ATHEROS_AR5416	0x0023		/* AR5416 */
+#define	PCI_PRODUCT_ATHEROS_AR5418	0x0024		/* AR5418 */
+#define	PCI_PRODUCT_ATHEROS_AR9160	0x0027		/* AR9160 */
+#define	PCI_PRODUCT_ATHEROS_AR9280	0x0029		/* AR9280 */
+#define	PCI_PRODUCT_ATHEROS_AR9281	0x002a		/* AR9281 */
+#define	PCI_PRODUCT_ATHEROS_AR9285	0x002b		/* AR9285 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR2427	0x002c		/* AR2427 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR9227	0x002d		/* AR9227 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR9287	0x002e		/* AR9287 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR9300	0x0030		/* AR9300 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR9485	0x0032		/* AR9485 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR9462	0x0034		/* AR9462 Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_QCA988X	0x003c		/* QCA986x/988x Wireless LAN */
+#define	PCI_PRODUCT_ATHEROS_AR5201_AP	0x0207		/* AR5201 Wireless LAN Reference Card (Early AP11) */
+#define	PCI_PRODUCT_ATHEROS_AR5201_DEFAULT	0x1107		/* AR5201 Wireless LAN (no eeprom) */
+#define	PCI_PRODUCT_ATHEROS_AR5212_DEFAULT	0x1113		/* AR5212 Wireless LAN (no eeprom) */
+#define	PCI_PRODUCT_ATHEROS_AR5211_DEFAULT	0x1112		/* AR5211 Wireless LAN (no eeprom) */
+#define	PCI_PRODUCT_ATHEROS_AR5212_FPGA	0xf013		/* AR5212 Wireless LAN Reference Card (emulation board) */
+#define	PCI_PRODUCT_ATHEROS_AR5211_FPGA11B	0xf11b		/* AR5211 Wireless LAN Reference Card (11b emulation board) */
+#define	PCI_PRODUCT_ATHEROS_AR5211_LEGACY	0xff12		/* AR5211 Wireless LAN Reference Card (original emulation board) */
+
+/* Atronics products */
+#define	PCI_PRODUCT_ATRONICS_IDE_2015PL	0x2015		/* IDE-2015PL */
+
+/* Avance Logic products */
+#define	PCI_PRODUCT_AVANCE_AVL2301	0x2301		/* AVL2301 */
+#define	PCI_PRODUCT_AVANCE_AVG2302	0x2302		/* AVG2302 */
+#define	PCI_PRODUCT_AVANCE2_ALG2301	0x2301		/* ALG2301 */
+#define	PCI_PRODUCT_AVANCE2_ALG2302	0x2302		/* ALG2302 */
+#define	PCI_PRODUCT_AVANCE2_ALS4000	0x4000		/* ALS4000 Audio */
+
+/* Avlab Technology products */
+#define	PCI_PRODUCT_AVLAB_PCI2S	0x2130		/* Low Profile PCI 4 Serial */
+#define	PCI_PRODUCT_AVLAB_LPPCI4S	0x2150		/* Low Profile PCI 4 Serial */
+#define	PCI_PRODUCT_AVLAB_LPPCI4S_2	0x2152		/* Low Profile PCI 4 Serial */
+
+/* CCUBE products */
+#define	PCI_PRODUCT_CCUBE_CINEMASTER	0x8888		/* Cinemaster C 3.0 DVD Decoder */
+
+/* AVM products */
+#define	PCI_PRODUCT_AVM_FRITZ_CARD	0x0a00		/* Fritz! Card ISDN Interface */
+#define	PCI_PRODUCT_AVM_FRITZ_PCI_V2_ISDN	0x0e00		/* Fritz!PCI v2.0 ISDN Interface */
+#define	PCI_PRODUCT_AVM_B1	0x0700		/* Basic Rate B1 ISDN Interface */
+#define	PCI_PRODUCT_AVM_T1	0x1200		/* Primary Rate T1 ISDN Interface */
+
+/* RMI products */
+#define	PCI_PRODUCT_RMI_XLR_PCIX	0x000b		/* XLR PCI-X bridge */
+#define	PCI_PRODUCT_RMI_XLS_PCIE	0xabcd		/* XLS PCIe-PCIe bridge */
+
+/* B & B Electronics Products */
+#define	PCI_PRODUCT_BBELEC_NON_ISOLATED_1_PORT	0x4201		/* single-channel RS-485 PCI UART */
+#define	PCI_PRODUCT_BBELEC_NON_ISOLATED_2_PORT	0x4202		/* dual-channel RS-485 PCI UART */
+#define	PCI_PRODUCT_BBELEC_NON_ISOLATED_4_PORT	0x4204		/* quad-channel RS-485 PCI UART */
+#define	PCI_PRODUCT_BBELEC_NON_ISOLATED_8_PORT	0x4208		/* octal-channel RS-485 PCI UART */
+#define	PCI_PRODUCT_BBELEC_ISOLATED_1_PORT	0x4211		/* single-channel Isolated RS-485 PCI UART */
+#define	PCI_PRODUCT_BBELEC_ISOLATED_2_PORT	0x4212		/* dual-channel Isolated RS-485 PCI UART */
+#define	PCI_PRODUCT_BBELEC_ISOLATED_4_PORT	0x4214		/* quad-channel Isolated RS-485 PCI UART */
+#define	PCI_PRODUCT_BBELEC_ISOLATED_8_PORT	0x4218		/* octal-channel Isolated RS-485 PCI UART */
+
+/* Belkin products */
+#define	PCI_PRODUCT_BELKIN_F5D6001	0x6001		/* F5D6001 */
+#define	PCI_PRODUCT_BELKIN_F5D6020V3	0x6020		/* F5D6020v3 802.11b */
+#define	PCI_PRODUCT_BELKIN_F5D7010	0x701f		/* F5D7010 */
+
+/* Stallion products */
+#define	PCI_PRODUCT_STALLION_EC8_32	0x0000		/* EC8/32 */
+#define	PCI_PRODUCT_STALLION_EC8_64	0x0002		/* EC8/64 */
+#define	PCI_PRODUCT_STALLION_EASYIO	0x0003		/* EasyIO */
+
+/* Bit3 products */
+#define	PCI_PRODUCT_BIT3_PCIVME617	0x0001		/* PCI-VME Interface Mod. 617 */
+#define	PCI_PRODUCT_BIT3_PCIVME618	0x0010		/* PCI-VME Interface Mod. 618 */
+#define	PCI_PRODUCT_BIT3_PCIVME2706	0x0300		/* PCI-VME Interface Mod. 2706 */
+
+/* Bluesteel Networks */
+#define	PCI_PRODUCT_BLUESTEEL_5501	0x0000		/* 5501 */
+#define	PCI_PRODUCT_BLUESTEEL_5601	0x5601		/* 5601 */
+
+/* Broadcom products */
+#define	PCI_PRODUCT_BROADCOM_BCM5752	0x1600		/* BCM5752 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5752M	0x1601		/* BCM5752M NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5709	0x1639		/* BCM5709 NetXtreme II 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5709S	0x163a		/* BCM5709 NetXtreme II 1000baseSX Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5716	0x163b		/* BCM5716 NetXtreme II 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5716S	0x163c		/* BCM5716 NetXtreme II 1000baseSX Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5700	0x1644		/* BCM5700 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5701	0x1645		/* BCM5701 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5702	0x1646		/* BCM5702 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5703	0x1647		/* BCM5703 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5704C	0x1648		/* BCM5704C 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5704S_ALT	0x1649		/* BCM5704S 1000baseSX Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5706	0x164a		/* BCM5706 NetXtreme II 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5708	0x164c		/* BCM5708 NetXtreme II 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5702FE	0x164d		/* BCM5702FE 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57710	0x164e		/* BCM57710 NetXtreme II 10Gb Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57711	0x164f		/* BCM57711 NetXtreme II 10Gb Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57711E	0x1650		/* BCM57711E NetXtreme II 10Gb Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5705	0x1653		/* BCM5705 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5705K	0x1654		/* BCM5705K 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5717	0x1655		/* BCM5717 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5718	0x1656		/* BCM5718 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5719	0x1657		/* BCM5719 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5721	0x1659		/* BCM5721 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5722	0x165a		/* BCM5722 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5723	0x165b		/* BCM5723 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5724	0x165c		/* BCM5724 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5705M	0x165d		/* BCM5705M 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5705M_ALT	0x165e		/* BCM5705M 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5720	0x165f		/* BCM5720 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57712	0x1662		/* BCM57712 NetXtreme II 10Gb Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57712E	0x1663		/* BCM57712E NetXtreme II 10Gb Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5714	0x1668		/* BCM5714 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5714S	0x1669		/* BCM5714S 1000baseSX Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5780	0x166a		/* BCM5780 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5780S	0x166b		/* BCM5780S NetXtreme 1000baseSX Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5705F	0x166e		/* BCM5705F 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5754M	0x1672		/* BCM5754M NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5755M	0x1673		/* BCM5755M NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5756	0x1674		/* BCM5756 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5750	0x1676		/* BCM5750 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5751	0x1677		/* BCM5751 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5715	0x1678		/* BCM5715 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5715S	0x1679		/* BCM5715S 1000baseSX Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5754	0x167a		/* BCM5754 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5755	0x167b		/* BCM5755 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5750M	0x167c		/* BCM5750M 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5751M	0x167d		/* BCM5751M 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5751F	0x167e		/* BCM5751F 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5787F	0x167f		/* BCM5787F 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5761E	0x1680		/* BCM5761E 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5761	0x1681		/* BCM5761 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57762	0x1682		/* BCM57762 Gigabit Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5764	0x1684		/* BCM5764 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57766	0x1686		/* BCM57766 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5761S	0x1688		/* BCM5761S 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5761SE	0x1689		/* BCM5761SE 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57760	0x1690		/* BCM57760 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57788	0x1691		/* BCM57788 NetLink 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57780	0x1692		/* BCM57780 NetXtreme 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5787M	0x1693		/* BCM5787M 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57790	0x1694		/* BCM57790 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5782	0x1696		/* BCM5782 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5784M	0x1698		/* BCM5784M NetLink 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5785G	0x1699		/* BCM5785G 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5786	0x169a		/* BCM5786 NetLink 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5787	0x169b		/* BCM5787 NetLink 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5788	0x169c		/* BCM5788 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5789	0x169d		/* BCM5789 NetLink 1000baseT Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5785F	0x16a0		/* BCM5785F 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5702X	0x16a6		/* BCM5702X 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5703X	0x16a7		/* BCM5703X 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5704S	0x16a8		/* BCM5704S 1000baseSX Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5706S	0x16aa		/* BCM5706 NetXtreme II 1000baseSX */
+#define	PCI_PRODUCT_BROADCOM_BCM5708S	0x16ac		/* BCM5708 NetXtreme II 1000baseSX */
+#define	PCI_PRODUCT_BROADCOM_BCM57761	0x16b0		/* BCM57761 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57781	0x16b1		/* BCM57781 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57791	0x16b2		/* BCM57791 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57786	0x16b3		/* BCM57786 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57765	0x16b4		/* BCM57765 Integrated Gigabit Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57785	0x16b5		/* BCM57785 Integrated Gigabit Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57795	0x16b6		/* BCM57795 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM57782	0x16b7		/* BCM57782 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5702_ALT	0x16c6		/* BCM5702 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5703_ALT	0x16c7		/* BCM5703 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5781	0x16dd		/* BCM5781 Integrated Gigabit Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5753	0x16f7		/* BCM5753 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5753M	0x16fd		/* BCM5753M 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5753F	0x16fe		/* BCM5753F 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5903M	0x16ff		/* BCM5903M 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM4401_B0	0x170c		/* BCM4401-B0 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5901	0x170d		/* BCM5901 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5901A2	0x170e		/* BCM5901A 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5906	0x1712		/* BCM5906 NetLink Fast Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM5906M	0x1713		/* BCM5906M NetLink Fast Ethernet */
+#define	PCI_PRODUCT_BROADCOM_BCM4303	0x4301		/* BCM4303 */
+#define	PCI_PRODUCT_BROADCOM_BCM4307	0x4307		/* BCM4307 */
+#define	PCI_PRODUCT_BROADCOM_BCM4311	0x4311		/* BCM4311 2.4GHz */
+#define	PCI_PRODUCT_BROADCOM_BCM4312	0x4312		/* BCM4312 Dualband */
+#define	PCI_PRODUCT_BROADCOM_BCM4313	0x4313		/* BCM4313 5GHz */
+#define	PCI_PRODUCT_BROADCOM_BCM4315	0x4315		/* BCM4315 2.4GHz */
+#define	PCI_PRODUCT_BROADCOM_BCM4318	0x4318		/* BCM4318 AirForce One 54g */
+#define	PCI_PRODUCT_BROADCOM_BCM4319	0x4319		/* BCM4319 */
+#define	PCI_PRODUCT_BROADCOM_BCM4306	0x4320		/* BCM4306 */
+#define	PCI_PRODUCT_BROADCOM_BCM4306_2	0x4321		/* BCM4306 */
+#define	PCI_PRODUCT_BROADCOM_BCM4322	0x4322		/* BCM4322 */
+#define	PCI_PRODUCT_BROADCOM_BCM4309	0x4324		/* BCM4309 */
+#define	PCI_PRODUCT_BROADCOM_BCM43XG	0x4325		/* BCM43XG */
+#define	PCI_PRODUCT_BROADCOM_BCM4328	0x4328		/* BCM4328 802.11a/b/g/n */
+#define	PCI_PRODUCT_BROADCOM_BCM4329	0x4329		/* BCM4329 802.11b/g/n */
+#define	PCI_PRODUCT_BROADCOM_BCM432A	0x432a		/* BCM432A 802.11 */
+#define	PCI_PRODUCT_BROADCOM_BCM432B	0x432b		/* BCM432B 802.11a/b/g/n */
+#define	PCI_PRODUCT_BROADCOM_BCM432C	0x432c		/* BCM432C 802.11b/g/n */
+#define	PCI_PRODUCT_BROADCOM_BCM432D	0x432d		/* BCM432D 802.11 */
+#define	PCI_PRODUCT_BROADCOM_BCM43224	0x4353		/* BCM43224 Dualband 802.11 */
+#define	PCI_PRODUCT_BROADCOM_BCM43225	0x4357		/* BCM43225 2.4GHz 802.11 */
+#define	PCI_PRODUCT_BROADCOM_BCM43227	0x4358		/* BCM43227 2.4GHz 802.11 */
+#define	PCI_PRODUCT_BROADCOM_BCM43228	0x4359		/* BCM43228 Dualband 802.11 */
+#define	PCI_PRODUCT_BROADCOM_BCM4401	0x4401		/* BCM4401 10/100 Ethernet */
+#define	PCI_PRODUCT_BROADCOM_5801	0x5801		/* 5801 Security Processor */
+#define	PCI_PRODUCT_BROADCOM_5802	0x5802		/* 5802 Security Processor */
+#define	PCI_PRODUCT_BROADCOM_5805	0x5805		/* 5805 Security Processor */
+#define	PCI_PRODUCT_BROADCOM_5820	0x5820		/* 5820 Security Processor */
+#define	PCI_PRODUCT_BROADCOM_5821	0x5821		/* 5821 Security Processor */
+#define	PCI_PRODUCT_BROADCOM_5822	0x5822		/* 5822 Security Processor */
+#define	PCI_PRODUCT_BROADCOM_5823	0x5823		/* 5823 Security Processor */
+#define	PCI_PRODUCT_BROADCOM_5825	0x5825		/* 5825 Security Processor */
+#define	PCI_PRODUCT_BROADCOM_5860	0x5860		/* 5860 Security Processor */
+#define	PCI_PRODUCT_BROADCOM_5861	0x5861		/* 5861 Security Processor */
+#define	PCI_PRODUCT_BROADCOM_5862	0x5862		/* 5862 Security Processor */
+
+/* Brooktree products */
+#define	PCI_PRODUCT_BROOKTREE_BT848	0x0350		/* Bt848 Video Capture */
+#define	PCI_PRODUCT_BROOKTREE_BT849	0x0351		/* Bt849 Video Capture */
+#define	PCI_PRODUCT_BROOKTREE_BT878	0x036e		/* Bt878 Video Capture */
+#define	PCI_PRODUCT_BROOKTREE_BT879	0x036f		/* Bt879 Video Capture */
+#define	PCI_PRODUCT_BROOKTREE_BT880	0x0370		/* Bt880 Video Capture */
+#define	PCI_PRODUCT_BROOKTREE_BT878A	0x0878		/* Bt878 Video Capture (Audio Section) */
+#define	PCI_PRODUCT_BROOKTREE_BT879A	0x0879		/* Bt879 Video Capture (Audio Section) */
+#define	PCI_PRODUCT_BROOKTREE_BT880A	0x0880		/* Bt880 Video Capture (Audio Section) */
+#define	PCI_PRODUCT_BROOKTREE_BT8474	0x8474		/* Bt8474 Multichannel HDLC Controller */
+
+/* BusLogic products */
+#define	PCI_PRODUCT_BUSLOGIC_MULTIMASTER_NC	0x0140		/* MultiMaster NC */
+#define	PCI_PRODUCT_BUSLOGIC_MULTIMASTER	0x1040		/* MultiMaster */
+#define	PCI_PRODUCT_BUSLOGIC_FLASHPOINT	0x8130		/* FlashPoint */
+
+/* c't Magazin products */
+#define	PCI_PRODUCT_C4T_GPPCI	0x6773		/* GPPCI */
+
+/* Cavium products */
+#define	PCI_PRODUCT_CAVIUM_NITROX	0x0001		/* Nitrox XL */
+
+/* Chelsio products */
+#define	PCI_PRODUCT_CHELSIO_T302E	0x0021		/* T302e */
+#define	PCI_PRODUCT_CHELSIO_T310E	0x0022		/* T310e */
+#define	PCI_PRODUCT_CHELSIO_T320X	0x0023		/* T320x */
+#define	PCI_PRODUCT_CHELSIO_T302X	0x0024		/* T302x */
+#define	PCI_PRODUCT_CHELSIO_T320E	0x0025		/* T320e */
+#define	PCI_PRODUCT_CHELSIO_T310X	0x0026		/* T310x */
+#define	PCI_PRODUCT_CHELSIO_T3B10	0x0030		/* T3B10 */
+#define	PCI_PRODUCT_CHELSIO_T3B20	0x0031		/* T3B20 */
+#define	PCI_PRODUCT_CHELSIO_T3B02	0x0032		/* T3B02 */
+
+/* Chips and Technologies products */
+#define	PCI_PRODUCT_CHIPS_64310	0x00b8		/* 64310 */
+#define	PCI_PRODUCT_CHIPS_69000	0x00c0		/* 69000 */
+#define	PCI_PRODUCT_CHIPS_65545	0x00d8		/* 65545 */
+#define	PCI_PRODUCT_CHIPS_65548	0x00dc		/* 65548 */
+#define	PCI_PRODUCT_CHIPS_65550	0x00e0		/* 65550 */
+#define	PCI_PRODUCT_CHIPS_65554	0x00e4		/* 65554 */
+#define	PCI_PRODUCT_CHIPS_69030	0x0c30		/* 69030 */
+
+/* Chrysalis products */
+#define	PCI_PRODUCT_CHRYSALIS_LUNAVPN	0x0001		/* LunaVPN */
+
+/* Cirrus Logic products */
+#define	PCI_PRODUCT_CIRRUS_CL_GD7548	0x0038		/* CL-GD7548 */
+#define	PCI_PRODUCT_CIRRUS_CL_GD5430	0x00a0		/* CL-GD5430 */
+#define	PCI_PRODUCT_CIRRUS_CL_GD5434_4	0x00a4		/* CL-GD5434-4 */
+#define	PCI_PRODUCT_CIRRUS_CL_GD5434_8	0x00a8		/* CL-GD5434-8 */
+#define	PCI_PRODUCT_CIRRUS_CL_GD5436	0x00ac		/* CL-GD5436 */
+#define	PCI_PRODUCT_CIRRUS_CL_GD5446	0x00b8		/* CL-GD5446 */
+#define	PCI_PRODUCT_CIRRUS_CL_GD5480	0x00bc		/* CL-GD5480 */
+#define	PCI_PRODUCT_CIRRUS_CL_PD6729	0x1100		/* CL-PD6729 */
+#define	PCI_PRODUCT_CIRRUS_CL_PD6832	0x1110		/* CL-PD6832 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_CIRRUS_CL_PD6833	0x1113		/* CL-PD6833 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_CIRRUS_CL_GD7542	0x1200		/* CL-GD7542 */
+#define	PCI_PRODUCT_CIRRUS_CL_GD7543	0x1202		/* CL-GD7543 */
+#define	PCI_PRODUCT_CIRRUS_CL_GD7541	0x1204		/* CL-GD7541 */
+#define	PCI_PRODUCT_CIRRUS_CL_CD4400	0x4400		/* CL-CD4400 Communications Controller */
+#define	PCI_PRODUCT_CIRRUS_CS4610	0x6001		/* CS4610 SoundFusion Audio Accelerator */
+#define	PCI_PRODUCT_CIRRUS_CS4280	0x6003		/* CS4280 CrystalClear Audio Interface */
+#define	PCI_PRODUCT_CIRRUS_CS4615	0x6004		/* CS4615 */
+#define	PCI_PRODUCT_CIRRUS_CS4281	0x6005		/* CS4281 CrystalClear Audio Interface */
+
+/* Adaptec's AAR-1210SA serial ATA RAID controller uses the CMDTECH chip */
+#define	PCI_PRODUCT_CMDTECH_AAR_1210SA	0x0240		/* AAR-1210SA SATA RAID Controller */
+/* CMD Technology products -- info gleaned from their web site */
+#define	PCI_PRODUCT_CMDTECH_640	0x0640		/* PCI0640 */
+/* No data on the CMD Tech. web site for the following as of Mar. 3 '98 */
+#define	PCI_PRODUCT_CMDTECH_642	0x0642		/* PCI0642 */
+/* datasheets available from www.cmd.com for the followings */
+#define	PCI_PRODUCT_CMDTECH_643	0x0643		/* PCI0643 */
+#define	PCI_PRODUCT_CMDTECH_646	0x0646		/* PCI0646 */
+#define	PCI_PRODUCT_CMDTECH_647	0x0647		/* PCI0647 */
+#define	PCI_PRODUCT_CMDTECH_648	0x0648		/* PCI0648 */
+#define	PCI_PRODUCT_CMDTECH_649	0x0649		/* PCI0649 */
+
+/* Inclusion of 'A' in the following entry is probably wrong. */
+/* No data on the CMD Tech. web site for the following as of Mar. 3 '98 */
+#define	PCI_PRODUCT_CMDTECH_240	0x0240		/* Sil240 SATALink */
+#define	PCI_PRODUCT_CMDTECH_650A	0x0650		/* PCI0650A */
+#define	PCI_PRODUCT_CMDTECH_670	0x0670		/* USB0670 */
+#define	PCI_PRODUCT_CMDTECH_673	0x0673		/* USB0673 */
+#define	PCI_PRODUCT_CMDTECH_680	0x0680		/* SiI0680 */
+#define	PCI_PRODUCT_CMDTECH_3112	0x3112		/* SiI3112 SATALink */
+#define	PCI_PRODUCT_CMDTECH_3114	0x3114		/* SiI3114 SATALink */
+#define	PCI_PRODUCT_CMDTECH_3124	0x3124		/* SiI3124 SATALink */
+#define	PCI_PRODUCT_CMDTECH_3132	0x3132		/* SiI3132 SATALink */
+#define	PCI_PRODUCT_CMDTECH_3512	0x3512		/* SiI3512 SATALink */
+#define	PCI_PRODUCT_CMDTECH_3531	0x3531		/* SiI3531 SATALink */
+
+/* C-Media products */
+#define	PCI_PRODUCT_CMEDIA_CMI8338A	0x0100		/* CMI8338A PCI Audio Device */
+#define	PCI_PRODUCT_CMEDIA_CMI8338B	0x0101		/* CMI8338B PCI Audio Device */
+#define	PCI_PRODUCT_CMEDIA_CMI8738	0x0111		/* CMI8738/C3DX PCI Audio Device */
+#define	PCI_PRODUCT_CMEDIA_CMI8738B	0x0112		/* CMI8738B PCI Audio Device */
+#define	PCI_PRODUCT_CMEDIA_HSP56	0x0211		/* HSP56 Audiomodem Riser */
+
+/* Cogent Data Technologies products */
+#define	PCI_PRODUCT_COGENT_EM110TX	0x1400		/* EX110TX PCI Fast Ethernet Adapter */
+
+/* Cologne Chip Designs */
+#define	PCI_PRODUCT_COLOGNECHIP_HFC	0x2bd0		/* HFC-S */
+
+/* COMPAL products */
+#define	PCI_PRODUCT_COMPAL_38W2	0x0011		/* 38W2 OEM Notebook */
+
+/* Compaq products */
+#define	PCI_PRODUCT_COMPAQ_PCI_EISA_BRIDGE	0x0001		/* PCI-EISA Bridge */
+#define	PCI_PRODUCT_COMPAQ_PCI_ISA_BRIDGE	0x0002		/* PCI-ISA Bridge */
+#define	PCI_PRODUCT_COMPAQ_TRIFLEX1	0x1000		/* Triflex Host-PCI Bridge */
+#define	PCI_PRODUCT_COMPAQ_TRIFLEX2	0x2000		/* Triflex Host-PCI Bridge */
+#define	PCI_PRODUCT_COMPAQ_QVISION_V0	0x3032		/* QVision */
+#define	PCI_PRODUCT_COMPAQ_QVISION_1280P	0x3033		/* QVision 1280/p */
+#define	PCI_PRODUCT_COMPAQ_QVISION_V2	0x3034		/* QVision */
+#define	PCI_PRODUCT_COMPAQ_TRIFLEX4	0x4000		/* Triflex Host-PCI Bridge */
+#define	PCI_PRODUCT_COMPAQ_CSA5300	0x4070		/* Smart Array 5300 */
+#define	PCI_PRODUCT_COMPAQ_CSA5i	0x4080		/* Smart Array 5i */
+#define	PCI_PRODUCT_COMPAQ_CSA532	0x4082		/* Smart Array 532 */
+#define	PCI_PRODUCT_COMPAQ_CSA5312	0x4083		/* Smart Array 5312 */
+#define	PCI_PRODUCT_COMPAQ_CSA6i	0x4091		/* Smart Array 6i */
+#define	PCI_PRODUCT_COMPAQ_CSA641	0x409a		/* Smart Array 641 */
+#define	PCI_PRODUCT_COMPAQ_CSA642	0x409b		/* Smart Array 642 */
+#define	PCI_PRODUCT_COMPAQ_CSA6400	0x409c		/* Smart Array 6400 */
+#define	PCI_PRODUCT_COMPAQ_CSA6400EM	0x409d		/* Smart Array 6400 EM */
+#define	PCI_PRODUCT_COMPAQ_CSA6422	0x409e		/* Smart Array 6422 */
+#define	PCI_PRODUCT_COMPAQ_CSA64XX	0x0046		/* Smart Array 64xx */
+#define	PCI_PRODUCT_COMPAQ_USB	0x7020		/* USB Controller */
+#define	PCI_PRODUCT_COMPAQ_ASMC	0xa0f0		/* Advanced Systems Management Controller */
+/* MediaGX Cx55x0 built-in OHCI seems to have this ID */
+#define	PCI_PRODUCT_COMPAQ_USB_MEDIAGX	0xa0f8		/* USB Controller */
+#define	PCI_PRODUCT_COMPAQ_SMART2P	0xae10		/* SMART2P RAID */
+#define	PCI_PRODUCT_COMPAQ_N100TX	0xae32		/* Netelligent 10/100 TX */
+#define	PCI_PRODUCT_COMPAQ_N10T2	0xb012		/* Netelligent 10 T/2 UTP/Coax */
+#define	PCI_PRODUCT_COMPAQ_INT100TX	0xb030		/* Integrated Netelligent 10/100 TX */
+#define	PCI_PRODUCT_COMPAQ_N10T	0xae34		/* Netelligent 10 T */
+#define	PCI_PRODUCT_COMPAQ_IntNF3P	0xae35		/* Integrated NetFlex 3/P */
+#define	PCI_PRODUCT_COMPAQ_DPNet100TX	0xae40		/* Dual Port Netelligent 10/100 TX */
+#define	PCI_PRODUCT_COMPAQ_IntPL100TX	0xae43		/* ProLiant Integrated Netelligent 10/100 TX */
+#define	PCI_PRODUCT_COMPAQ_DP4000	0xb011		/* Deskpro 4000 5233MMX */
+#define	PCI_PRODUCT_COMPAQ_CSA5300_2	0xb060		/* Smart Array 5300 rev. 2 */
+#define	PCI_PRODUCT_COMPAQ_PRESARIO56XX	0xb0b8		/* Presario 56xx */
+#define	PCI_PRODUCT_COMPAQ_M700	0xb112		/* Armada M700 */
+#define	PCI_PRODUCT_COMPAQ_CSA5i_2	0xb178		/* Smart Array 5i/532 rev. 2 */
+#define	PCI_PRODUCT_COMPAQ_ILO_1	0xb203		/* iLO */
+#define	PCI_PRODUCT_COMPAQ_ILO_2	0xb204		/* iLO */
+#define	PCI_PRODUCT_COMPAQ_NF3P_BNC	0xf150		/* NetFlex 3/P w/ BNC */
+#define	PCI_PRODUCT_COMPAQ_NF3P	0xf130		/* NetFlex 3/P */
+
+/* Compex products - XXX better descriptions */
+#define	PCI_PRODUCT_COMPEX_NE2KETHER	0x1401		/* Ethernet */
+#define	PCI_PRODUCT_COMPEX_RL100ATX	0x2011		/* RL100-ATX 10/100 Ethernet */
+#define	PCI_PRODUCT_COMPEX_RL100TX	0x9881		/* RL100-TX 10/100 Ethernet */
+
+/* Comtrol products */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT32EXT	0x0001		/* RocketPort 32 Port External */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT8EXT	0x0002		/* RocketPort 8 Port External */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT16EXT	0x0003		/* RocketPort 16 Port External */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT4QUAD	0x0004		/* RocketPort 4 Port w/ Quad Cable */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT8OCTA	0x0005		/* RocketPort 8 Port w/ Octa Cable */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT8RJ	0x0006		/* RocketPort 8 Port w/ RJ11s */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT4RJ	0x0007		/* RocketPort 4 Port w/ RJ11s */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT8DB	0x0008		/* RocketPort 8 Port w/ DB78 */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT16DB	0x0009		/* RocketPort 16 Port w/ DB78 */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORTP4	0x000a		/* RocketPort Plus 4 Port */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORTP8	0x000b		/* RocketPort Plus 8 Port */
+#define	PCI_PRODUCT_COMTROL_ROCKETMODEM6	0x000c		/* RocketModem 6 Port */
+#define	PCI_PRODUCT_COMTROL_ROCKETMODEM4	0x000d		/* RocketModem 4 Port */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORTP232	0x000e		/* RocketPort 2 Port RS232 */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORTP422	0x000f		/* RocketPort 2 Port RS422 */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT550811A	0x8010		/* RocketPort 550/8 RJ11 part A */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT550811B	0x8011		/* RocketPort 550/8 RJ11 part B */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT5508OA	0x8012		/* RocketPort 550/8 Octa part A */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT5508OB	0x8013		/* RocketPort 550/8 Octa part B */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT5504	0x8014		/* RocketPort 550/4 */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT550Q	0x8015		/* RocketPort 550/Quad */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT55016A	0x8016		/* RocketPort 550/16 part A */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT55016B	0x8017		/* RocketPort 550/16 part B */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT5508A	0x8018		/* RocketPort 550/8 part A */
+#define	PCI_PRODUCT_COMTROL_ROCKETPORT5508B	0x8019		/* RocketPort 550/8 part B */
+
+/* Conexant Systems products */
+#define	PCI_PRODUCT_CONEXANT_SOFTK56	0x2443		/* SoftK56 PCI Software Modem */
+#define	PCI_PRODUCT_CONEXANT_56KFAXMODEM	0x1085		/* HW 56K Fax Modem */
+#define	PCI_PRODUCT_CONEXANT_LANFINITY	0x1803		/* LANfinity MiniPCI 10/100 Ethernet */
+#define	PCI_PRODUCT_CONEXANT_CX2388X	0x8800		/* CX23880/1/2/3 PCI Video/Audio Decoder */
+#define	PCI_PRODUCT_CONEXANT_CX2388XAUDIO	0x8801		/* CX23880/1/2/3 PCI Audio Port */
+#define	PCI_PRODUCT_CONEXANT_CX2388XMPEG	0x8802		/* CX23880/1/2/3 PCI MPEG Port */
+#define	PCI_PRODUCT_CONEXANT_CX2388XIR	0x8804		/* CX23880/1/2/3 PCI IR Port */
+#define	PCI_PRODUCT_CONEXANT_CX23885	0x8852		/* CX23885 */
+
+/* Contaq Microsystems products */
+#define	PCI_PRODUCT_CONTAQ_82C599	0x0600		/* 82C599 PCI-VLB Bridge */
+#define	PCI_PRODUCT_CONTAQ_82C693	0xc693		/* 82C693 PCI-ISA Bridge */
+
+/* Corega products */
+#define	PCI_PRODUCT_COREGA_CB_TXD	0xa117		/* FEther CB-TXD 10/100 Ethernet */
+#define	PCI_PRODUCT_COREGA_2CB_TXD	0xa11e		/* FEther II CB-TXD 10/100 Ethernet */
+#define	PCI_PRODUCT_COREGA_LAPCIGT	0xc107		/* CG-LAPCIGT */
+
+/* Corollary Products */
+#define	PCI_PRODUCT_COROLLARY_CBUSII_PCIB	0x0014		/* \"C-Bus II\"-PCI Bridge */
+
+/* Creative Labs products */
+#define	PCI_PRODUCT_CREATIVELABS_SBLIVE	0x0002		/* SBLive! EMU 10000 */
+#define	PCI_PRODUCT_CREATIVELABS_AWE64D	0x0003		/* SoundBlaster AWE64D */
+#define	PCI_PRODUCT_CREATIVELABS_AUDIGY	0x0004		/* SB Audigy EMU 10000 */
+#define	PCI_PRODUCT_CREATIVELABS_XFI	0x0005		/* SoundBlaster X-Fi */
+#define	PCI_PRODUCT_CREATIVELABS_SBLIVE2	0x0006		/* SBLive! EMU 10000 */
+#define	PCI_PRODUCT_CREATIVELABS_SBAUDIGYLS	0x0007		/* SB Audigy LS */
+#define	PCI_PRODUCT_CREATIVELABS_SBAUDIGY4	0x0008		/* SB Audigy 4 */
+#define	PCI_PRODUCT_CREATIVELABS_FIWIRE	0x4001		/* Firewire */
+#define	PCI_PRODUCT_CREATIVELABS_SBJOY	0x7002		/* PCI Gameport Joystick */
+#define	PCI_PRODUCT_CREATIVELABS_AUDIGIN	0x7003		/* SoundBlaster Audigy Digital */
+#define	PCI_PRODUCT_CREATIVELABS_SBJOY2	0x7004		/* PCI Gameport Joystick */
+#define	PCI_PRODUCT_CREATIVELABS_SBJOY3	0x7005		/* PCI Gameport Joystick */
+#define	PCI_PRODUCT_CREATIVELABS_EV1938	0x8938		/* Ectiva 1938 */
+
+/* Cyclades products */
+#define	PCI_PRODUCT_CYCLADES_CYCLOMY_1	0x0100		/* Cyclom-Y below 1M */
+#define	PCI_PRODUCT_CYCLADES_CYCLOMY_2	0x0101		/* Cyclom-Y above 1M */
+#define	PCI_PRODUCT_CYCLADES_CYCLOM4Y_1	0x0102		/* Cyclom-4Y below 1M */
+#define	PCI_PRODUCT_CYCLADES_CYCLOM4Y_2	0x0103		/* Cyclom-4Y above 1M */
+#define	PCI_PRODUCT_CYCLADES_CYCLOM8Y_1	0x0104		/* Cyclom-8Y below 1M */
+#define	PCI_PRODUCT_CYCLADES_CYCLOM8Y_2	0x0105		/* Cyclom-8Y above 1M */
+#define	PCI_PRODUCT_CYCLADES_CYCLOMZ_1	0x0200		/* Cyclom-Z below 1M */
+#define	PCI_PRODUCT_CYCLADES_CYCLOMZ_2	0x0201		/* Cyclom-Z above 1M */
+
+/* Cyclone Microsystems products */
+#define	PCI_PRODUCT_CYCLONE_PCI_700	0x0700		/* IQ80310 (PCI-700) */
+
+/* Cyrix (now National) products */
+#define	PCI_PRODUCT_CYRIX_MEDIAGX_PCHB	0x0001		/* MediaGX Built-in PCI Host Controller */
+#define	PCI_PRODUCT_CYRIX_CX5520_PCIB	0x0002		/* Cx5520 I/O Companion */
+#define	PCI_PRODUCT_CYRIX_CX5530_PCIB	0x0100		/* Cx5530 I/O Companion Multi-Function South Bridge */
+#define	PCI_PRODUCT_CYRIX_CX5530_SMI	0x0101		/* Cx5530 I/O Companion (SMI Status and ACPI Timer) */
+#define	PCI_PRODUCT_CYRIX_CX5530_IDE	0x0102		/* Cx5530 I/O Companion (IDE Controller) */
+#define	PCI_PRODUCT_CYRIX_CX5530_AUDIO	0x0103		/* Cx5530 I/O Companion (XpressAUDIO) */
+#define	PCI_PRODUCT_CYRIX_CX5530_VIDEO	0x0104		/* Cx5530 I/O Companion (Video Controller) */
+
+/* Datum Inc. Bancomm-Timing Division products */
+#define	PCI_PRODUCT_DATUM_BC635PCI_U	0x4013		/* BC635PCI-U TC & FREQ. Processor */
+
+/* Davicom Semiconductor products */
+#define	PCI_PRODUCT_DAVICOM_DM9102	0x9102		/* DM9102 10/100 Ethernet */
+
+/* Decision Computer Inc */
+#define	PCI_PRODUCT_DCI_APCI4	0x0001		/* PCCOM 4-port */
+#define	PCI_PRODUCT_DCI_APCI8	0x0002		/* PCCOM 8-port */
+#define	PCI_PRODUCT_DCI_APCI2	0x0004		/* PCCOM 2-port */
+
+/* DEC products */
+#define	PCI_PRODUCT_DEC_21050	0x0001		/* DC21050 PCI-PCI Bridge */
+#define	PCI_PRODUCT_DEC_21040	0x0002		/* DC21040 (\"Tulip\") Ethernet */
+#define	PCI_PRODUCT_DEC_21030	0x0004		/* DC21030 (\"TGA\") */
+#define	PCI_PRODUCT_DEC_NVRAM	0x0007		/* Zephyr NV-RAM */
+#define	PCI_PRODUCT_DEC_KZPSA	0x0008		/* KZPSA */
+#define	PCI_PRODUCT_DEC_21140	0x0009		/* DC21140 (\"FasterNet\") 10/100 Ethernet */
+#define	PCI_PRODUCT_DEC_PBXGB	0x000d		/* TGA2 */
+#define	PCI_PRODUCT_DEC_DEFPA	0x000f		/* DEFPA */
+/* product DEC ???	0x0010	??? VME Interface */
+#define	PCI_PRODUCT_DEC_21041	0x0014		/* DC21041 (\"Tulip Plus\") Ethernet */
+#define	PCI_PRODUCT_DEC_DGLPB	0x0016		/* DGLPB (\"OPPO\") */
+#define	PCI_PRODUCT_DEC_21142	0x0019		/* DC21142/21143 10/100 Ethernet */
+#define	PCI_PRODUCT_DEC_21052	0x0021		/* DC21052 PCI-PCI Bridge */
+#define	PCI_PRODUCT_DEC_21150	0x0022		/* DC21150 PCI-PCI Bridge */
+#define	PCI_PRODUCT_DEC_21152	0x0024		/* DC21152 PCI-PCI Bridge */
+#define	PCI_PRODUCT_DEC_21153	0x0025		/* DC21153 PCI-PCI Bridge */
+#define	PCI_PRODUCT_DEC_21154	0x0026		/* DC21154 PCI-PCI Bridge */
+#define	PCI_PRODUCT_DEC_21554	0x0046		/* DC21554 PCI-PCI Bridge */
+#define	PCI_PRODUCT_DEC_SWXCR	0x1065		/* SWXCR RAID */
+
+/* Dell Computer products */
+#define	PCI_PRODUCT_DELL_PERC_2SI	0x0001		/* PERC 2/Si */
+#define	PCI_PRODUCT_DELL_PERC_3DI	0x0002		/* PERC 3/Di */
+#define	PCI_PRODUCT_DELL_PERC_3SI	0x0003		/* PERC 3/Si */
+#define	PCI_PRODUCT_DELL_PERC_3SI_2	0x0004		/* PERC 3/Si */
+#define	PCI_PRODUCT_DELL_PERC_3DI_2	0x0008		/* PERC 3/Di */
+#define	PCI_PRODUCT_DELL_PERC_3DI_3	0x000a		/* PERC 3/Di */
+#define	PCI_PRODUCT_DELL_PERC_4DI	0x000e		/* PERC 4/Di */
+#define	PCI_PRODUCT_DELL_PERC_4DI_2	0x000f		/* PERC 4/Di */
+#define	PCI_PRODUCT_DELL_DRAC_4	0x0011		/* DRAC 4 */
+#define	PCI_PRODUCT_DELL_DRAC_4_VUART	0x0012		/* DRAC 4 Virtual UART */
+#define	PCI_PRODUCT_DELL_PERC_4ESI	0x0013		/* PERC 4e/Si */
+#define	PCI_PRODUCT_DELL_DRAC_4_SMIC	0x0014		/* DRAC 4 SMIC */
+#define	PCI_PRODUCT_DELL_PERC_5	0x0015		/* PERC 5 */
+#define	PCI_PRODUCT_DELL_PERC_6	0x0060		/* PERC 6 */
+#define	PCI_PRODUCT_DELL_PERC_3DI_2_SUB	0x00cf		/* PERC 3/Di */
+#define	PCI_PRODUCT_DELL_PERC_3SI_2_SUB	0x00d0		/* PERC 3/Si */
+#define	PCI_PRODUCT_DELL_PERC_3DI_SUB2	0x00d1		/* PERC 3/Di */
+#define	PCI_PRODUCT_DELL_PERC_3DI_SUB3	0x00d9		/* PERC 3/Di */
+#define	PCI_PRODUCT_DELL_PERC_3DI_3_SUB	0x0106		/* PERC 3/Di */
+#define	PCI_PRODUCT_DELL_PERC_3DI_3_SUB2	0x011b		/* PERC 3/Di */
+#define	PCI_PRODUCT_DELL_PERC_3DI_3_SUB3	0x0121		/* PERC 3/Di */
+#define	PCI_PRODUCT_DELL_PERC_5_1	0x1f01		/* PERC 5/e */
+#define	PCI_PRODUCT_DELL_PERC_5_2	0x1f02		/* PERC 5/i */
+#define	PCI_PRODUCT_DELL_CERC_1_5	0x0291		/* CERC SATA RAID 1.5/6ch */
+
+/* Delta products */
+#define	PCI_PRODUCT_DELTA_8139	0x1360		/* 8139 Ethernet */
+#define	PCI_PRODUCT_DELTA_RHINEII	0x1320		/* Rhine II 10/100 Ethernet */
+
+/* Diamond products */
+#define	PCI_PRODUCT_DIAMOND_VIPER	0x9001		/* Viper/PCI */
+
+/* Digi International Products */
+#define	PCI_PRODUCT_DIGI_ACCELEPORT8R920	0x0027		/* AccelePort 8r 920 8-port serial */
+#define	PCI_PRODUCT_DIGI_NEO4	0x00b0		/* Neo 4-port */
+#define	PCI_PRODUCT_DIGI_NEO8	0x00b1		/* Neo 8-port */
+#define	PCI_PRODUCT_DIGI_NEO8_PCIE	0x00f0		/* Neo 8-port (PCIe) */
+
+/* D-Link Systems products */
+#define	PCI_PRODUCT_DLINK_DL1002	0x1002		/* DL-1002 10/100 Ethernet */
+#define	PCI_PRODUCT_DLINK_DFE530TXPLUS	0x1300		/* DFE-530TXPLUS 10/100 Ethernet */
+#define	PCI_PRODUCT_DLINK_DFE690TXD	0x1340		/* DFE-690TXD 10/100 Ethernet */
+#define	PCI_PRODUCT_DLINK_DWL610	0x3300		/* DWL-610 802.11b WLAN */
+#define	PCI_PRODUCT_DLINK_DL4000	0x4000		/* DL-4000 Gigabit Ethernet */
+#define	PCI_PRODUCT_DLINK_DGE550SX	0x4001		/* DGE-550SX */
+#define	PCI_PRODUCT_DLINK_DFE520TX	0x4200		/* DFE-520TX 10/100 Ethernet */
+#define	PCI_PRODUCT_DLINK_DGE528T	0x4300		/* DGE-528T Gigabit Ethernet */
+#define	PCI_PRODUCT_DLINK_DGE560T	0x4b00		/* DGE-560T Gigabit Ethernet */
+#define	PCI_PRODUCT_DLINK_DGE560T_2	0x4b01		/* DGE-560T_2 Gigabit Ethernet */
+#define	PCI_PRODUCT_DLINK_DGE560SX	0x4b02		/* DGE-560SX */
+#define	PCI_PRODUCT_DLINK_DGE530T	0x4c00		/* DGE-530T Gigabit Ethernet */
+
+/* Distributed Processing Technology products */
+#define	PCI_PRODUCT_DPT_SC_RAID	0xa400		/* SmartCache/SmartRAID (EATA) */
+#define	PCI_PRODUCT_DPT_I960_PPB	0xa500		/* PCI-PCI Bridge */
+#define	PCI_PRODUCT_DPT_RAID_I2O	0xa501		/* SmartRAID (I2O) */
+#define	PCI_PRODUCT_DPT_RAID_2005S	0xa511		/* Zero Channel SmartRAID (I2O) */
+#define	PCI_PRODUCT_DPT_MEMCTLR	0x1012		/* Memory Controller */
+
+/* Dolphin products */
+#define	PCI_PRODUCT_DOLPHIN_PCISCI32	0x0658		/* PCI-SCI Bridge (32-bit, 33 MHz) */
+#define	PCI_PRODUCT_DOLPHIN_PCISCI64	0xd665		/* PCI-SCI Bridge (64-bit, 33 MHz) */
+#define	PCI_PRODUCT_DOLPHIN_PCISCI66	0xd667		/* PCI-SCI Bridge (64-bit, 66 MHz) */
+
+/* Domex products */
+#define	PCI_PRODUCT_DOMEX_PCISCSI	0x0001		/* DMX-3191D */
+
+/* Dynalink products */
+#define	PCI_PRODUCT_DYNALINK_IS64PH	0x1702		/* IS64PH ISDN Adapter */
+
+/* ELSA products */
+#define	PCI_PRODUCT_ELSA_QS1PCI	0x1000		/* QuickStep 1000 ISDN Card */
+#define	PCI_PRODUCT_ELSA_GLORIAXL	0x8901		/* Gloria XL 1624 */
+
+/* Emulex products */
+#define	PCI_PRODUCT_EMULEX_LP6000	0x1ae5		/* LP6000 FibreChannel Adapter */
+#define	PCI_PRODUCT_EMULEX_LP952	0xf095		/* LP952 FibreChannel Adapter */
+#define	PCI_PRODUCT_EMULEX_LP982	0xf098		/* LP982 FibreChannel Adapter */
+#define	PCI_PRODUCT_EMULEX_LP101	0xf0a1		/* LP101 FibreChannel Adapter */
+#define	PCI_PRODUCT_EMULEX_LP7000	0xf700		/* LP7000 FibreChannel Adapter */
+#define	PCI_PRODUCT_EMULEX_LP8000	0xf800		/* LP8000 FibreChannel Adapter */
+#define	PCI_PRODUCT_EMULEX_LP9000	0xf900		/* LP9000 FibreChannel Adapter */
+#define	PCI_PRODUCT_EMULEX_LP9802	0xf980		/* LP9802 FibreChannel Adapter */
+#define	PCI_PRODUCT_EMULEX_LP10000	0xfa00		/* LP10000 FibreChannel Adapter */
+
+/* ENE Technology products */
+#define	PCI_PRODUCT_ENE_MCR510	0x0510		/* MCR510 PCI Memory Card Reader Controller */
+#define	PCI_PRODUCT_ENE_CB712	0x0550		/* CB712/714/810 PCI SD Card Reader Controller */
+#define	PCI_PRODUCT_ENE_CB1211	0x1211		/* CB1211 CardBus Controller */
+#define	PCI_PRODUCT_ENE_CB1225	0x1225		/* CB1225 CardBus Controller */
+#define	PCI_PRODUCT_ENE_CB1410	0x1410		/* CB1410 CardBus Controller */
+#define	PCI_PRODUCT_ENE_CB710	0x1411		/* CB710 CardBus Controller */
+#define	PCI_PRODUCT_ENE_CB1420	0x1420		/* CB1420 CardBus Controller */
+#define	PCI_PRODUCT_ENE_CB720	0x1421		/* CB720 CardBus Controller */
+
+/* Ensoniq products */
+#define	PCI_PRODUCT_ENSONIQ_AUDIOPCI	0x5000		/* AudioPCI */
+#define	PCI_PRODUCT_ENSONIQ_AUDIOPCI97	0x1371		/* AudioPCI 97 */
+#define	PCI_PRODUCT_ENSONIQ_CT5880	0x5880		/* CT5880 */
+
+/* Equinox Systems product */
+#define	PCI_PRODUCT_EQUINOX_SST64P	0x0808		/* SST-64P Adapter */
+#define	PCI_PRODUCT_EQUINOX_SST128P	0x1010		/* SST-128P Adapter */
+#define	PCI_PRODUCT_EQUINOX_SST16P_1	0x80c0		/* SST-16P Adapter */
+#define	PCI_PRODUCT_EQUINOX_SST16P_2	0x80c4		/* SST-16P Adapter */
+#define	PCI_PRODUCT_EQUINOX_SST16P_3	0x80c8		/* SST-16P Adapter */
+#define	PCI_PRODUCT_EQUINOX_SST4P	0x8888		/* SST-4P Adapter */
+#define	PCI_PRODUCT_EQUINOX_SST8P	0x9090		/* SST-8P Adapter */
+
+/* Essential Communications products */
+#define	PCI_PRODUCT_ESSENTIAL_RR_HIPPI	0x0001		/* RoadRunner HIPPI Interface */
+#define	PCI_PRODUCT_ESSENTIAL_RR_GIGE	0x0005		/* RoadRunner Gig-E Interface */
+
+/* ESS Technology products */
+#define	PCI_PRODUCT_ESSTECH_MAESTRO1	0x0100		/* Maestro 1 PCI Audio Accelerator */
+#define	PCI_PRODUCT_ESSTECH_MAESTRO2	0x1968		/* Maestro 2 PCI Audio Accelerator */
+#define	PCI_PRODUCT_ESSTECH_SOLO1	0x1969		/* Solo-1 PCI AudioDrive */
+#define	PCI_PRODUCT_ESSTECH_MAESTRO2E	0x1978		/* Maestro 2E PCI Audio Accelerator */
+#define	PCI_PRODUCT_ESSTECH_ALLEGRO1	0x1988		/* Allegro-1 PCI Audio Accelerator */
+#define	PCI_PRODUCT_ESSTECH_MAESTRO3	0x1998		/* Maestro 3 PCI Audio Accelerator */
+#define	PCI_PRODUCT_ESSTECH_MAESTRO3MODEM	0x1999		/* Maestro 3 Modem */
+#define	PCI_PRODUCT_ESSTECH_MAESTRO3_2	0x199a		/* Maestro 3 PCI Audio Accelerator */
+
+/* ESS Technology products */
+#define	PCI_PRODUCT_ESSTECH2_MAESTRO1	0x0100		/* Maestro 1 PCI Audio Accelerator */
+
+/* Eumitcom products */
+#define	PCI_PRODUCT_EUMITCOM_WL11000P	0x1100		/* WL11000P PCI WaveLAN/IEEE 802.11 */
+
+/* O2 Micro */
+#define	PCI_PRODUCT_O2MICRO_00F7	0x00f7		/* Integrated OHCI IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_O2MICRO_OZ6729	0x6729		/* OZ6729 PCI-PCMCIA Bridge */
+#define	PCI_PRODUCT_O2MICRO_OZ6730	0x673A		/* OZ6730 PCI-PCMCIA Bridge */
+#define	PCI_PRODUCT_O2MICRO_OZ6832	0x6832		/* OZ6832/OZ6833 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_O2MICRO_OZ6836	0x6836		/* OZ6836/OZ6860 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_O2MICRO_OZ6872	0x6872		/* OZ6812/OZ6872 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_O2MICRO_OZ6922	0x6925		/* OZ6922 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_O2MICRO_OZ6933	0x6933		/* OZ6933 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_O2MICRO_OZ6972	0x6972		/* OZ6912/OZ6972 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_O2MICRO_7120	0x7120		/* OZ7120 Integrated MMC/SD Controller */
+#define	PCI_PRODUCT_O2MICRO_7130	0x7130		/* OZ7130 Integrated MS/xD/SM Controller */
+#define	PCI_PRODUCT_O2MICRO_7223	0x7223		/* OZ711E0 PCI-CardBus Bridge */
+
+/* Evans & Sutherland products */
+#define	PCI_PRODUCT_ES_FREEDOM	0x0001		/* Freedom PCI-GBus Interface */
+
+/* EXAR products */
+#define	PCI_PRODUCT_EXAR_XR17D152	0x0152		/* dual-channel Universal PCI UART */
+#define	PCI_PRODUCT_EXAR_XR17D154	0x0154		/* quad-channel Universal PCI UART */
+#define	PCI_PRODUCT_EXAR_XR17D158	0x0158		/* octal-channel Universal PCI UART */
+
+/* FORE products */
+#define	PCI_PRODUCT_FORE_PCA200	0x0210		/* ATM PCA-200 */
+#define	PCI_PRODUCT_FORE_PCA200E	0x0300		/* ATM PCA-200e */
+
+/* Forte Media products */
+#define	PCI_PRODUCT_FORTEMEDIA_FM801	0x0801		/* 801 Sound */
+#define	PCI_PRODUCT_FORTEMEDIA_PCIJOY	0x0802		/* PCI Gameport Joystick */
+
+/* Fresco Logic products */
+#define	PCI_PRODUCT_FRESCO_FL1000	0x1000		/* FL1000 USB3 Host Controller */
+#define	PCI_PRODUCT_FRESCO_FL1009	0x1009		/* FL1009 USB3 Host Controller */
+
+/* Future Domain products */
+#define	PCI_PRODUCT_FUTUREDOMAIN_TMC_18C30	0x0000		/* TMC-18C30 (36C70) */
+
+/* Fujitsu products */
+#define	PCI_PRODUCT_FUJITSU4_PW008GE5	0x11a1		/* PW008GE5 */
+#define	PCI_PRODUCT_FUJITSU4_PW008GE4	0x11a2		/* PW008GE4 */
+#define	PCI_PRODUCT_FUJITSU4_PP250_450_LAN	0x11cc		/* PRIMEPOWER250/450 LAN */
+
+/* FZ Juelich / ZEL products */
+#define	PCI_PRODUCT_FZJZEL_GIGALINK	0x0001		/* Gigabit Link / STR1100 */
+#define	PCI_PRODUCT_FZJZEL_PLXHOTLINK	0x0002		/* HOTlink Interface */
+#define	PCI_PRODUCT_FZJZEL_COUNTTIME	0x0003		/* Counter / Timer */
+#define	PCI_PRODUCT_FZJZEL_PLXCAMAC	0x0004		/* CAMAC Controller */
+#define	PCI_PRODUCT_FZJZEL_PROFIBUS	0x0005		/* PROFIBUS Interface */
+#define	PCI_PRODUCT_FZJZEL_AMCCHOTLINK	0x0006		/* old HOTlink Interface */
+
+/* Efficient Networks products */
+#define	PCI_PRODUCT_EFFICIENTNETS_ENI155PF	0x0000		/* 155P-MF1 ATM (FPGA) */
+#define	PCI_PRODUCT_EFFICIENTNETS_ENI155PA	0x0002		/* 155P-MF1 ATM (ASIC) */
+#define	PCI_PRODUCT_EFFICIENTNETS_ENI25P	0x0003		/* SpeedStream ENI-25p */
+#define	PCI_PRODUCT_EFFICIENTNETS_SS3000	0x0005		/* SpeedStream 3000 */
+
+/* Freescale Semiconductor products */
+#define	PCI_PRODUCT_FREESCALE_MPC8548E	0x0012		/* MPC8548E */
+#define	PCI_PRODUCT_FREESCALE_MPC8548	0x0013		/* MPC8548 */
+#define	PCI_PRODUCT_FREESCALE_MPC8543E	0x0014		/* MPC8543E */
+#define	PCI_PRODUCT_FREESCALE_MPC8543	0x0015		/* MPC8543 */
+#define	PCI_PRODUCT_FREESCALE_MPC8547E	0x0018		/* MPC8547E */
+#define	PCI_PRODUCT_FREESCALE_MPC8545E	0x0019		/* MPC8545E */
+#define	PCI_PRODUCT_FREESCALE_MPC8545	0x001a		/* MPC8545 */
+#define	PCI_PRODUCT_FREESCALE_MPC8544E	0x0032		/* MPC8544E */
+#define	PCI_PRODUCT_FREESCALE_MPC8544	0x0033		/* MPC8544 */
+#define	PCI_PRODUCT_FREESCALE_MPC8572E	0x0040		/* MPC8572E */
+#define	PCI_PRODUCT_FREESCALE_MPC8572	0x0041		/* MPC8572 */
+#define	PCI_PRODUCT_FREESCALE_MPC8536E	0x0050		/* MPC8536E */
+#define	PCI_PRODUCT_FREESCALE_MPC8536	0x0051		/* MPC8536 */
+#define	PCI_PRODUCT_FREESCALE_P2020E	0x0070		/* P2020E */
+#define	PCI_PRODUCT_FREESCALE_P2020	0x0071		/* P2020 */
+#define	PCI_PRODUCT_FREESCALE_P2010E	0x0078		/* P2010E */
+#define	PCI_PRODUCT_FREESCALE_P2010	0x0079		/* P2010 */
+#define	PCI_PRODUCT_FREESCALE_P1020E	0x0100		/* P1021E */
+#define	PCI_PRODUCT_FREESCALE_P1020	0x0101		/* P1020 */
+#define	PCI_PRODUCT_FREESCALE_P1021E	0x0102		/* P1021E */
+#define	PCI_PRODUCT_FREESCALE_P1021	0x0103		/* P1021 */
+#define	PCI_PRODUCT_FREESCALE_P1024E	0x0104		/* P1024E */
+#define	PCI_PRODUCT_FREESCALE_P1024	0x0105		/* P1024 */
+#define	PCI_PRODUCT_FREESCALE_P1025E	0x0106		/* P1025E */
+#define	PCI_PRODUCT_FREESCALE_P1025	0x0107		/* P1025 */
+#define	PCI_PRODUCT_FREESCALE_P1011E	0x0108		/* P1011E */
+#define	PCI_PRODUCT_FREESCALE_P1011	0x0109		/* P1011 */
+#define	PCI_PRODUCT_FREESCALE_P1022E	0x0110		/* P1022E */
+#define	PCI_PRODUCT_FREESCALE_P1022	0x0111		/* P1022 */
+#define	PCI_PRODUCT_FREESCALE_P1013E	0x0118		/* P1013E */
+#define	PCI_PRODUCT_FREESCALE_P1013	0x0119		/* P1013 */
+#define	PCI_PRODUCT_FREESCALE_P4080E	0x0400		/* P4080E */
+#define	PCI_PRODUCT_FREESCALE_P4080	0x0401		/* P4080 */
+#define	PCI_PRODUCT_FREESCALE_P4040E	0x0408		/* P4040E */
+#define	PCI_PRODUCT_FREESCALE_P4040	0x0409		/* P4040 */
+#define	PCI_PRODUCT_FREESCALE_P2040E	0x0410		/* P2040E */
+#define	PCI_PRODUCT_FREESCALE_P2040	0x0411		/* P2040 */
+#define	PCI_PRODUCT_FREESCALE_P3041E	0x041e		/* P3041E */
+#define	PCI_PRODUCT_FREESCALE_P3041	0x041f		/* P3041 */
+#define	PCI_PRODUCT_FREESCALE_P5020E	0x0420		/* P5020E */
+#define	PCI_PRODUCT_FREESCALE_P5020	0x0421		/* P5020 */
+#define	PCI_PRODUCT_FREESCALE_P5010E	0x0428		/* P5010E */
+#define	PCI_PRODUCT_FREESCALE_P5010	0x0429		/* P5010 */
+
+/* Marvell products */
+#define	PCI_PRODUCT_MARVELL_GT64010A	0x0146		/* GT-64010A System Controller */
+#define	PCI_PRODUCT_MARVELL_88F1181	0x1181		/* 88F1181 */
+#define	PCI_PRODUCT_MARVELL_88F1281	0x1281		/* 88F1281 SoC Orion2 */
+#define	PCI_PRODUCT_MARVELL_88W8300_1	0x1fa6		/* Libertas 88W8300 */
+#define	PCI_PRODUCT_MARVELL_88W8310	0x1fa7		/* Libertas 88W8310 */
+#define	PCI_PRODUCT_MARVELL_88W8335_1	0x1faa		/* Libertas 88W8335 */
+#define	PCI_PRODUCT_MARVELL_88W8335_2	0x1fab		/* Libertas 88W8335 */
+#define	PCI_PRODUCT_MARVELL_88SB2211	0x2211		/* 88SB2211 x1 PCIe-PCI Bridge */
+#define	PCI_PRODUCT_MARVELL_88W8300_2	0x2a01		/* Libertas 88W8300 */
+#define	PCI_PRODUCT_MARVELL_GT64115	0x4111		/* GT-64115 System Controller */
+#define	PCI_PRODUCT_MARVELL_GT64011	0x4146		/* GT-64011 System Controller */
+#define	PCI_PRODUCT_MARVELL_SKNET	0x4320		/* SK-NET Gigabit Ethernet */
+#define	PCI_PRODUCT_MARVELL_YUKONII_8021CU	0x4340		/* Yukon-II 88E8021CU */
+#define	PCI_PRODUCT_MARVELL_YUKONII_8022CU	0x4341		/* Yukon-II 88E8022CU */
+#define	PCI_PRODUCT_MARVELL_YUKONII_8061CU	0x4342		/* Yukon-II 88E8061CU */
+#define	PCI_PRODUCT_MARVELL_YUKONII_8062CU	0x4343		/* Yukon-II 88E8062CU */
+#define	PCI_PRODUCT_MARVELL_YUKONII_8021X	0x4344		/* Yukon-II 88E8021X */
+#define	PCI_PRODUCT_MARVELL_YUKONII_8022X	0x4345		/* Yukon-II 88E8022X */
+#define	PCI_PRODUCT_MARVELL_YUKONII_8061X	0x4346		/* Yukon-II 88E8061X */
+#define	PCI_PRODUCT_MARVELL_YUKONII_8062X	0x4347		/* Yukon-II 88E8062X */
+#define	PCI_PRODUCT_MARVELL_YUKON_8035	0x4350		/* Yukon 88E8035 */
+#define	PCI_PRODUCT_MARVELL_YUKON_8036	0x4351		/* Yukon 88E8036 */
+#define	PCI_PRODUCT_MARVELL_YUKON_8038	0x4352		/* Yukon 88E8038 */
+#define	PCI_PRODUCT_MARVELL_YUKON_8039	0x4353		/* Yukon 88E8039 */
+#define	PCI_PRODUCT_MARVELL_YUKON_8040	0x4354		/* Yukon 88E8040 */
+#define	PCI_PRODUCT_MARVELL_YUKON_C033	0x4356		/* Yukon 88EC033 */
+#define	PCI_PRODUCT_MARVELL_YUKON_8052	0x4360		/* Yukon 88E8052 */
+#define	PCI_PRODUCT_MARVELL_YUKON_8050	0x4361		/* Yukon 88E8050 */
+#define	PCI_PRODUCT_MARVELL_YUKON_8053	0x4362		/* Yukon 88E8053 */
+#define	PCI_PRODUCT_MARVELL_YUKON_8055	0x4363		/* Yukon 88E8055 */
+#define	PCI_PRODUCT_MARVELL_YUKON_8056	0x4364		/* Yukon 88E8056 */
+#define	PCI_PRODUCT_MARVELL_YUKON_1	0x4365		/* Yukon */
+#define	PCI_PRODUCT_MARVELL_YUKON_C036	0x4366		/* Yukon 88EC036 */
+#define	PCI_PRODUCT_MARVELL_YUKON_C032	0x4367		/* Yukon 88EC032 */
+#define	PCI_PRODUCT_MARVELL_YUKON_C034	0x4368		/* Yukon 88EC034 */
+#define	PCI_PRODUCT_MARVELL_YUKON_C042	0x4369		/* Yukon 88EC042 */
+#define	PCI_PRODUCT_MARVELL_YUKON_C055	0x436a		/* Yukon 88EC055 */
+#define	PCI_PRODUCT_MARVELL_GT64120	0x4620		/* GT-64120 System Controller */
+#define	PCI_PRODUCT_MARVELL_BELKIN	0x5005		/* Belkin Gigabit Ethernet */
+#define	PCI_PRODUCT_MARVELL_88SX5040	0x5040		/* 88SX5040 SATA */
+#define	PCI_PRODUCT_MARVELL_88SX5041	0x5041		/* 88SX5041 SATA */
+#define	PCI_PRODUCT_MARVELL_88SX5080	0x5080		/* 88SX5080 SATA */
+#define	PCI_PRODUCT_MARVELL_88SX5081	0x5081		/* 88SX5081 SATA */
+#define	PCI_PRODUCT_MARVELL_88F5082	0x5082		/* 88F5082 SoC Orion1 */
+#define	PCI_PRODUCT_MARVELL_88F5180N	0x5180		/* 88F5180N SoC Orion1 */
+#define	PCI_PRODUCT_MARVELL_88F5181	0x5181		/* 88F5181 SoC Orion1 */
+#define	PCI_PRODUCT_MARVELL_88F5182	0x5182		/* 88F5182 SoC Orion1 */
+#define	PCI_PRODUCT_MARVELL_88F5281	0x5281		/* 88F5281 SoC Orion2 */
+#define	PCI_PRODUCT_MARVELL_88SX6040	0x6040		/* 88SX6040 SATA II */
+#define	PCI_PRODUCT_MARVELL_88SX6041	0x6041		/* 88SX6041 SATA II */
+#define	PCI_PRODUCT_MARVELL_88SX6042	0x6042		/* 88SX6042 SATA IIe */
+#define	PCI_PRODUCT_MARVELL_88SX6080	0x6080		/* 88SX6080 SATA II */
+#define	PCI_PRODUCT_MARVELL_88SX6081	0x6081		/* 88SX6081 SATA II */
+#define	PCI_PRODUCT_MARVELL_88F6082	0x6082		/* 88F6082 SoC Orion1 */
+#define	PCI_PRODUCT_MARVELL_88SE6101	0x6101		/* 88SE6101 Single Port PATA133 Controller */
+#define	PCI_PRODUCT_MARVELL_88SE6121	0x6121		/* 88SE6121 SATA II Controller */
+#define	PCI_PRODUCT_MARVELL_88SE614X	0x6141		/* 88SE614X SATA II PCI-E Controller */
+#define	PCI_PRODUCT_MARVELL_88SE6145	0x6145		/* 88SE6145 SATA II PCI-E Controller */
+#define	PCI_PRODUCT_MARVELL_88F6180	0x6180		/* 88F6180 SoC Kirkwood */
+#define	PCI_PRODUCT_MARVELL_88F6183	0x6183		/* 88F6183 SoC Orion1 */
+#define	PCI_PRODUCT_MARVELL_88F6192	0x6192		/* 88F6192 SoC Kirkwood */
+#define	PCI_PRODUCT_MARVELL_88F6281	0x6281		/* 88F6281 SoC Kirkwood */
+#define	PCI_PRODUCT_MARVELL_88F6282	0x6282		/* 88F6282 SoC Kirkwood */
+#define	PCI_PRODUCT_MARVELL_GT64130	0x6320		/* GT-64130 System Controller */
+#define	PCI_PRODUCT_MARVELL_GT64260	0x6430		/* GT-64260 System Controller */
+#define	PCI_PRODUCT_MARVELL_MV64360	0x6460		/* MV6436x System Controller */
+#define	PCI_PRODUCT_MARVELL_MV64460	0x6480		/* MV6446x System Controller */
+#define	PCI_PRODUCT_MARVELL_MV6707	0x6707		/* MV6707 SoC Armada 370 */
+#define	PCI_PRODUCT_MARVELL_MV6710	0x6710		/* MV6710 SoC Armada 370 */
+#define	PCI_PRODUCT_MARVELL_MV6W11	0x6711		/* MV6W11 SoC Armada 370 */
+#define	PCI_PRODUCT_MARVELL_88SX7042	0x7042		/* 88SX7042 SATA IIe */
+#define	PCI_PRODUCT_MARVELL_MV78100	0x7810		/* MV78100 SoC Discovery Innovation */
+#define	PCI_PRODUCT_MARVELL_MV78130	0x7813		/* MV78130 SoC Armada XP */
+#define	PCI_PRODUCT_MARVELL_MV78160	0x7816		/* MV78160 SoC Armada XP */
+#define	PCI_PRODUCT_MARVELL_MV78200	0x7820		/* MV78200 SoC Discovery Innovation */
+#define	PCI_PRODUCT_MARVELL_MV78230	0x7823		/* MV78230 SoC Armada XP */
+#define	PCI_PRODUCT_MARVELL_MV78260	0x7826		/* MV78260 SoC Armada XP */
+#define	PCI_PRODUCT_MARVELL_MV78460	0x7846		/* MV78460 SoC Armada XP */
+#define	PCI_PRODUCT_MARVELL_88F6810	0x6810		/* 88F6810 SoC Armada 38x */
+#define	PCI_PRODUCT_MARVELL_88F6820	0x6820		/* 88F6820 SoC Armada 38x */
+#define	PCI_PRODUCT_MARVELL_88F6828	0x6828		/* 88F6828 SoC Armada 38x */
+#define	PCI_PRODUCT_MARVELL_88W8660	0x8660		/* 88W8660 SoC Orion1 */
+
+#define	PCI_PRODUCT_MARVELL2_88SE9120	0x9120		/* 88SE9120 SATA */
+#define	PCI_PRODUCT_MARVELL2_88SE912X	0x9123		/* 88SE912[38] SATA II or III PCI-E AHCI Controller */
+#define	PCI_PRODUCT_MARVELL2_88SE9125	0x9125		/* 88SE9125 SATA III PCI-E AHCI Controller */
+#define	PCI_PRODUCT_MARVELL2_88SE9172	0x9172		/* 88SE9172 SATA */
+#define	PCI_PRODUCT_MARVELL2_88SE9182	0x9182		/* 88SE9182 SATA */
+#define	PCI_PRODUCT_MARVELL2_88SE9183	0x9183		/* 88SE9183 SATA */
+#define	PCI_PRODUCT_MARVELL2_88SE91XX	0x91a3		/* 88SE91XX SATA */
+#define	PCI_PRODUCT_MARVELL2_88SE9215	0x9215		/* 88SE9215 SATA */
+#define	PCI_PRODUCT_MARVELL2_88SE9220	0x9220		/* 88SE9220 SATA */
+#define	PCI_PRODUCT_MARVELL2_88SE9230	0x9230		/* 88SE9230 SATA */
+#define	PCI_PRODUCT_MARVELL2_88SE9235	0x9235		/* 88SE9235 SATA */
+
+/* Global Sun Tech products */
+#define	PCI_PRODUCT_GLOBALSUN_GL24110P	0x1101		/* GL24110P PCI IEEE 802.11b */
+#define	PCI_PRODUCT_GLOBALSUN_GL24110P02	0x1102		/* GL24110P PCI IEEE 802.11b */
+
+/* Guillemot products */
+#define	PCI_PRODUCT_GUILLEMOT_MAXIRADIO	0x1001		/* MAXIRADIO */
+
+/* Hawking products */
+#define	PCI_PRODUCT_HAWKING_PN672TX	0xab08		/* PN672TX 10/100 Ethernet */
+
+/* Heuricon products */
+#define	PCI_PRODUCT_HEURICON_PMPPC	0x000e		/* PM/PPC */
+
+/* Hewlett-Packard products */
+#define	PCI_PRODUCT_HP_VISUALIZE_EG	0x1005		/* A4977A Visualize EG */
+#define	PCI_PRODUCT_HP_VISUALIZE_FX6	0x1006		/* Visualize FX6 */
+#define	PCI_PRODUCT_HP_VISUALIZE_FX4	0x1008		/* Visualize FX4 */
+#define	PCI_PRODUCT_HP_VISUALIZE_FX2	0x100a		/* Visualize FX2 */
+#define	PCI_PRODUCT_HP_TACHYON_TL	0x1028		/* Tachyon TL FC Controller */
+#define	PCI_PRODUCT_HP_TACHYON_XL2	0x1029		/* Tachyon XL2 FC Controller */
+#define	PCI_PRODUCT_HP_TACHYON_TS	0x102A		/* Tachyon TS FC Controller */
+#define	PCI_PRODUCT_HP_J2585A	0x1030		/* J2585A */
+#define	PCI_PRODUCT_HP_J2585B	0x1031		/* J2585B */
+#define	PCI_PRODUCT_HP_DIVA	0x1048		/* Diva Serial Multiport */
+#define	PCI_PRODUCT_HP_ELROY	0x1054		/* Elroy Ropes-PCI */
+#define	PCI_PRODUCT_HP_VISUALIZE_FXE	0x108b		/* Visualize FXe */
+#define	PCI_PRODUCT_HP_TOPTOOLS	0x10c1		/* TopTools Communications Port */
+#define	PCI_PRODUCT_HP_NETRAID_4M	0x10c2		/* NetRaid-4M */
+#define	PCI_PRODUCT_HP_SMARTIRQ	0x10ed		/* NetServer SmartIRQ */
+#define	PCI_PRODUCT_HP_82557B	0x1200		/* 82557B 10/100 NIC */
+#define	PCI_PRODUCT_HP_PLUTO	0x1229		/* Pluto MIO */
+#define	PCI_PRODUCT_HP_ZX1_IOC	0x122a		/* zx1 IOC */
+#define	PCI_PRODUCT_HP_MERCURY	0x122e		/* Mercury Ropes-PCI */
+#define	PCI_PRODUCT_HP_QUICKSILVER	0x12b4		/* QuickSilver Ropes-PCI */
+
+#define	PCI_PRODUCT_HP_HPSAV100	0x3210		/* Smart Array V100 */
+#define	PCI_PRODUCT_HP_HPSAE200I_1	0x3211		/* Smart Array E200i */
+#define	PCI_PRODUCT_HP_HPSAE200	0x3212		/* Smart Array E200 */
+#define	PCI_PRODUCT_HP_HPSAE200I_2	0x3213		/* Smart Array E200i */
+#define	PCI_PRODUCT_HP_HPSAE200I_3	0x3214		/* Smart Array E200i */
+#define	PCI_PRODUCT_HP_HPSAE200I_4	0x3215		/* Smart Array E200i */
+#define	PCI_PRODUCT_HP_HPSA_1	0x3220		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSA_2	0x3222		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSAP800	0x3223		/* Smart Array P600 */
+#define	PCI_PRODUCT_HP_HPSAP600	0x3225		/* Smart Array P600 */
+#define	PCI_PRODUCT_HP_HPSA_3	0x3230		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSA_4	0x3231		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSA_5	0x3232		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSA_6	0x3233		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSAP400	0x3234		/* Smart Array P400 */
+#define	PCI_PRODUCT_HP_HPSAP400I	0x3235		/* Smart Array P400i */
+#define	PCI_PRODUCT_HP_HPSA_7	0x3236		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSA_8	0x3237		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSA_9	0x3238		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSA_10	0x3239		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSA_11	0x323a		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSA_12	0x323b		/* Smart Array */
+#define	PCI_PRODUCT_HP_HPSA_13	0x323c		/* Smart Array */
+#define	PCI_PRODUCT_HP_USB	0x3300		/* iLO3 Virtual USB */
+#define	PCI_PRODUCT_HP_IPMI	0x3302		/* IPMI */
+#define	PCI_PRODUCT_HP_ILO3_SLAVE	0x3306		/* iLO3 Slave */
+#define	PCI_PRODUCT_HP_ILO3_MGMT	0x3307		/* iLO3 Management */
+#define	PCI_PRODUCT_HP_RS780_PPB_GFX	0x9602		/* (AMD) RS780 PCI-PCI Bridge (int gfx) */
+
+/* Hifn products */
+#define	PCI_PRODUCT_HIFN_7751	0x0005		/* 7751 */
+#define	PCI_PRODUCT_HIFN_6500	0x0006		/* 6500 */
+#define	PCI_PRODUCT_HIFN_7811	0x0007		/* 7811 */
+#define	PCI_PRODUCT_HIFN_7951	0x0012		/* 7951 */
+#define	PCI_PRODUCT_HIFN_7955	0x0020		/* 7954/7955 */
+#define	PCI_PRODUCT_HIFN_7956	0x001d		/* 7956 */
+#define	PCI_PRODUCT_HIFN_78XX	0x0014		/* 7814/7851/7854 */
+#define	PCI_PRODUCT_HIFN_8065	0x0016		/* 8065 */
+#define	PCI_PRODUCT_HIFN_8165	0x0017		/* 8165 */
+#define	PCI_PRODUCT_HIFN_8154	0x0018		/* 8154 */
+
+/* HiNT products */
+#define	PCI_PRODUCT_HINT_HB1	0x0021		/* HB1 PCI-PCI Bridge */
+#define	PCI_PRODUCT_HINT_HB4	0x0022		/* HB4 PCI-PCI Bridge */
+
+/* Hitachi products */
+#define	PCI_PRODUCT_HITACHI_SWC	0x0101		/* MSVCC01/02/03/04 Video Capture Cards */
+#define	PCI_PRODUCT_HITACHI_SH7751	0x3505		/* SH7751 PCI Controller */
+#define	PCI_PRODUCT_HITACHI_SH7751R	0x350e		/* SH7751R PCI Controller */
+
+/* IBM products */
+#define	PCI_PRODUCT_IBM_MCABRIDGE	0x0002		/* MCA Bridge */
+#define	PCI_PRODUCT_IBM_ALTALITE	0x0005		/* CPU Bridge - Alta Lite */
+#define	PCI_PRODUCT_IBM_ALTAMP	0x0007		/* CPU Bridge - Alta MP */
+#define	PCI_PRODUCT_IBM_ISABRIDGE	0x000a		/* Fire Coral ISA Bridge w/ PnP */
+#define	PCI_PRODUCT_IBM_POWERWAVE	0x0013		/* PowerWave Graphics Adapter */
+#define	PCI_PRODUCT_IBM_IDAHO	0x0015		/* Idaho PCI Bridge */
+#define	PCI_PRODUCT_IBM_CPUBRIDGE	0x0017		/* CPU Bridge */
+#define	PCI_PRODUCT_IBM_LANSTREAMER	0x0018		/* Auto LANStreamer */
+#define	PCI_PRODUCT_IBM_GXT150P	0x001b		/* GXT-150P 2D Accelerator */
+#define	PCI_PRODUCT_IBM_CARRERA	0x001c		/* Carrera PCI Bridge */
+#define	PCI_PRODUCT_IBM_82G2675	0x001d		/* 82G2675 SCSI-2 Fast Controller */
+#define	PCI_PRODUCT_IBM_MCABRIDGE2	0x0020		/* MCA Bridge */
+#define	PCI_PRODUCT_IBM_82351	0x0022		/* 82351 PCI-PCI Bridge */
+#define	PCI_PRODUCT_IBM_MONNAV	0x002c		/* Montana/Nevada PCI Bridge and Memory Controller */
+#define	PCI_PRODUCT_IBM_PYTHON	0x002d		/* Python PCI-PCI Bridge */
+#define	PCI_PRODUCT_IBM_SERVERAID	0x002e		/* ServeRAID (copperhead) */
+#define	PCI_PRODUCT_IBM_GXT250P	0x003c		/* GXT-250P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_OLYMPIC	0x003e		/* 16/4 Token Ring */
+#define	PCI_PRODUCT_IBM_MIAMI	0x0036		/* Miami/PCI */
+#define	PCI_PRODUCT_IBM_82660	0x0037		/* 82660 PowerPC to PCI Bridge and Memory Controller */
+#define	PCI_PRODUCT_IBM_MPIC	0x0046		/* MPIC */
+#define	PCI_PRODUCT_IBM_TURBOWAYS25	0x0053		/* Turboways 25 ATM */
+#define	PCI_PRODUCT_IBM_GXT500P	0x0054		/* GXT-500P/GXT550P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_I82557B	0x005c		/* i82557B 10/100 Ethernet */
+#define	PCI_PRODUCT_IBM_GXT800P	0x005e		/* GXT-800P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_EADSPCI	0x008b		/* EADS PCI-PCI Bridge */
+#define	PCI_PRODUCT_IBM_GXT3000P	0x008e		/* GXT-3000P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_GXT3000P2	0x0090		/* GXT-3000P Graphics Adapter(2) */
+#define	PCI_PRODUCT_IBM_GXT2000P	0x00b8		/* GXT-2000P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_OLYMPIC2	0x00ce		/* Olympic 2 Token Ring */
+#define	PCI_PRODUCT_IBM_CPC71064	0x00fc		/* CPC710 Dual Bridge and Memory Controller (PCI64) */
+#define	PCI_PRODUCT_IBM_CPC71032	0x0105		/* CPC710 Dual Bridge and Memory Controller (PCI32) */
+#define	PCI_PRODUCT_IBM_TPAUDIO	0x0153		/* ThinkPad 600X/A20/T20/T22 Audio */
+#define	PCI_PRODUCT_IBM_405GP	0x0156		/* PPC 405GP PCI Bridge */
+#define	PCI_PRODUCT_IBM_GXT4000P	0x016e		/* GXT-4000P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_GXT6000P	0x0170		/* GXT-6000P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_GXT300P	0x017d		/* GXT-300P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_133PCIX	0x01a7		/* 133 PCI-X Bridge */
+#define	PCI_PRODUCT_IBM_SERVERAID4	0x01bd		/* ServeRAID 4/5 (morpheus) */
+#define	PCI_PRODUCT_IBM_440GP	0x01ef		/* PPC 440GP PCI Bridge */
+#define	PCI_PRODUCT_IBM_IBMETHER	0x01ff		/* 10/100 Ethernet */
+#define	PCI_PRODUCT_IBM_GXT6500P	0x021b		/* GXT-6500P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_GXT4500P	0x021c		/* GXT-4500P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_GXT135P	0x0233		/* GXT-135P Graphics Adapter */
+#define	PCI_PRODUCT_IBM_4810_BSP	0x0295		/* 4810 BSP */
+#define	PCI_PRODUCT_IBM_4810_SCC	0x0297		/* 4810 SCC */
+#define	PCI_PRODUCT_IBM_SERVERAID8K	0x9580		/* ServeRAID 8k */
+#define	PCI_PRODUCT_IBM_MPIC2	0xffff		/* MPIC-II */
+
+/* IC Ensemble / VIA Technologies products */
+#define	PCI_PRODUCT_ICENSEMBLE_ICE1712	0x1712		/* Envy24 Multichannel Audio Controller */
+#define	PCI_PRODUCT_ICENSEMBLE_VT1720	0x1724		/* Envy24PT/HT Multi-Channel Audio Controller */
+
+/* Conexant (iCompression, GlobeSpan) products */
+#define	PCI_PRODUCT_ICOMPRESSION_ITVC15	0x0803		/* iTVC15 MPEG2 Codec */
+
+/* IDT products */
+#define	PCI_PRODUCT_IDT_77201	0x0001		/* 77201/77211 ATM (\"NICStAR\") */
+#define	PCI_PRODUCT_IDT_RC32334	0x0204		/* RC32334 System Controller */
+#define	PCI_PRODUCT_IDT_RC32332	0x0205		/* RC32332 System Controller */
+
+/* Industrial Computer Source */
+#define	PCI_PRODUCT_INDCOMPSRC_WDT50x	0x22c0		/* PCI-WDT50x Watchdog Timer */
+
+/* Initio products */
+#define	PCI_PRODUCT_INITIO_1622	0x1622		/* INIC-1622 SATA */
+#define	PCI_PRODUCT_INITIO_I920	0x0002		/* INIC-920 SCSI */
+#define	PCI_PRODUCT_INITIO_I850	0x0850		/* INIC-850 SCSI */
+#define	PCI_PRODUCT_INITIO_I1060	0x1060		/* INIC-1060 SCSI */
+#define	PCI_PRODUCT_INITIO_I940	0x9400		/* INIC-940 SCSI */
+#define	PCI_PRODUCT_INITIO_I935	0x9401		/* INIC-935 SCSI */
+#define	PCI_PRODUCT_INITIO_I950	0x9500		/* INIC-950 SCSI */
+
+/* Integraphics Systems products */
+#define	PCI_PRODUCT_INTEGRAPHICS_IGA1680	0x1680		/* IGA 1680 */
+#define	PCI_PRODUCT_INTEGRAPHICS_IGA1682	0x1682		/* IGA 1682 */
+#define	PCI_PRODUCT_INTEGRAPHICS_CYBERPRO2000	0x2000		/* CyberPro 2000 */
+#define	PCI_PRODUCT_INTEGRAPHICS_CYBERPRO2010	0x2010		/* CyberPro 2010 */
+
+/* Integrated Micro Solutions products */
+#define	PCI_PRODUCT_IMS_8849	0x8849		/* 8849 */
+#define	PCI_PRODUCT_IMS_TT128M	0x9128		/* TwinTurbo 128M */
+
+/* Intel products */
+#define	PCI_PRODUCT_INTEL_IRONLAKE_D_HB	0x0040		/* Iron Lake Host Bridge */
+#define	PCI_PRODUCT_INTEL_IRONLAKE_D_IGD	0x0042		/* Iron Lake Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_IRONLAKE_M_HB	0x0044		/* Iron Lake Host Bridge */
+#define	PCI_PRODUCT_INTEL_IRONLAKE_M_IGD	0x0046		/* Iron Lake Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_IRONLAKE_MA_HB	0x0062		/* Iron Lake Host Bridge */
+#define	PCI_PRODUCT_INTEL_IRONLAKE_MC2_HB	0x006a		/* Iron Lake Host Bridge */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6005_2X2_1	0x0082		/* Centrino Advanced-N 6205 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_1000_1	0x0083		/* WiFi Link 1000 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_1000_2	0x0084		/* WiFi Link 1000 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6005_2X2_2	0x0085		/* Centrino Advanced-N 6205 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6050_2X2_1	0x0087		/* Centrino Advanced-N 6250 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6050_2X2_2	0x0089		/* Centrino Advanced-N 6250 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_1030_1	0x008a		/* Centrino Wireless-N 1030 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_1030_2	0x008b		/* Centrino Wireless-N 1030 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6230_1	0x0090		/* Centrino Advanced-N 6230 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6230_2	0x0091		/* Centrino Advanced-N 6230 */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_HB	0x0100		/* Sandy Bridge Host Bridge */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_PCIE	0x0101		/* Sandy Bridge PCIe Root port */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_IGD	0x0102		/* Sandy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_PCIE_1	0x0105		/* Sandy Bridge PCIe Root port */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_PCIE_2	0x0109		/* Sandy Bridge PCIe Root port */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_IGD_1	0x0112		/* Sandy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_IGD_2	0x0122		/* Sandy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_M_HB	0x0104		/* Sandy Bridge Host Bridge */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_M_IGD	0x0106		/* Sandy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_M_IGD_1	0x0116		/* Sandy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_M_IGD_2	0x0126		/* Sandy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_S_HB	0x0108		/* Sandy Bridge Host Bridge */
+#define	PCI_PRODUCT_INTEL_SANDYBRIDGE_S_IGD	0x010A		/* Sandy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_HB	0x0150		/* Ivy Bridge Host Bridge */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_PCIE	0x0151		/* Ivy Bridge PCI Express Root Port */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_IGD	0x0152		/* Ivy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_M_HB	0x0154		/* Ivy Bridge Host Bridge */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_PCIE_1	0x0155		/* Ivy Bridge PCI Express Root Port */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_M_IGD	0x0156		/* Ivy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_S_HB	0x0158		/* Ivy Bridge Host Bridge */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_PCIE_2	0x0159		/* Ivy Bridge PCI Express Root Port */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_S_IGD	0x015a		/* Ivy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_PCIE_3	0x015d		/* Ivy Bridge PCI Express Root Port */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_IGD_1	0x0162		/* Ivy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_M_IGD_1	0x0166		/* Ivy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_IVYBRIDGE_S_IGD_1	0x016a		/* Ivy Bridge Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_80312	0x030d		/* 80312 I/O Companion Chip */
+#define	PCI_PRODUCT_INTEL_80321	0x0319		/* 80321 I/O Processor */
+#define	PCI_PRODUCT_INTEL_6700PXH_IOXAPIC	0x0326		/* 6700PXH IOxAPIC */
+#define	PCI_PRODUCT_INTEL_6700PXH_PCIE0	0x0329		/* 6700PXH PCI Express-to-PCI Bridge #0 */
+#define	PCI_PRODUCT_INTEL_6700PXH_PCIE1	0x032a		/* 6700PXH PCI Express-to-PCI Bridge #1 */
+#define	PCI_PRODUCT_INTEL_6702PXH_PCIX	0x032c		/* 6702PXH PCI Express-to-PCIX */
+#define	PCI_PRODUCT_INTEL_IOP332_A	0x0330		/* IOP332 PCI Express-to-PCI Bridge #0 */
+#define	PCI_PRODUCT_INTEL_IOP332_B	0x0332		/* IOP332 PCI Express-to-PCI Bridge #1 */
+#define	PCI_PRODUCT_INTEL_80331	0x0335		/* Lindsay I/O Processor PCI-X Bridge */
+#define	PCI_PRODUCT_INTEL_41210A	0x0340		/* Serial to Parallel PCI Bridge A */
+#define	PCI_PRODUCT_INTEL_41210B	0x0341		/* Serial to Parallel PCI Bridge B */
+#define	PCI_PRODUCT_INTEL_IOP333_A	0x0370		/* IOP333 PCI Express-to-PCI Bridge #0 */
+#define	PCI_PRODUCT_INTEL_IOP333_B	0x0372		/* IOP333 PCI Express-to-PCI Bridge #1 */
+#define	PCI_PRODUCT_INTEL_SRCZCRX	0x0407		/* RAID Controller */
+#define	PCI_PRODUCT_INTEL_SRCU42E	0x0408		/* SCSI RAID Controller */
+#define	PCI_PRODUCT_INTEL_SRCS28X	0x0409		/* SATA RAID Controller */
+#define	PCI_PRODUCT_INTEL_HASWELL_IGD	0x0402		/* Haswell Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_HASWELL_IGD_1	0x0412		/* Haswell Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_IQIA	0x0434		/* DH89xxCC PCIe Endpoint and QuickAssist */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_IQIA	0x0435		/* DH89xxCL PCIe Endpoint and QuickAssist */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_SGMII	0x0438		/* DH89XXCC SGMII */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_SERDES	0x043a		/* DH89XXCC SerDes */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_BPLANE	0x043c		/* DH89XXCC backplane */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_SFP	0x0440		/* DH89XXCC SFP */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_IQIA_VF	0x0442		/* DH89XXCC QuickAssist Virtual Function */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_IQIA_VF	0x0443		/* DH89XXCL QuickAssist Virtual Function */
+#define	PCI_PRODUCT_INTEL_PCEB	0x0482		/* 82375EB/SB PCI-EISA Bridge */
+#define	PCI_PRODUCT_INTEL_CDC	0x0483		/* 82424ZX Cache and DRAM Controller */
+#define	PCI_PRODUCT_INTEL_SIO	0x0484		/* 82378ZB System I/O */
+#define	PCI_PRODUCT_INTEL_82426EX	0x0486		/* 82426EX PCI-ISA Bridge */
+#define	PCI_PRODUCT_INTEL_PCMC	0x04a3		/* 82434LX/NX PCI, Cache and Memory Controller (PCMC) */
+#define	PCI_PRODUCT_INTEL_GDT_RAID1	0x0600		/* GDT RAID */
+#define	PCI_PRODUCT_INTEL_GDT_RAID2	0x061f		/* GDT RAID */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6150_1	0x0885		/* Centrino Wireless-N 6150 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6150_2	0x0886		/* Centrino Wireless-N 6150 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_2230_1	0x0887		/* Centrino Wireless-N 2230 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_2230_2	0x0888		/* Centrino Wireless-N 2230 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6235	0x088e		/* Centrino Advanced-N 6235 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6235_2	0x088f		/* Centrino Advanced-N 6235 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_2200_1	0x0890		/* Centrino Wireless-N 2200 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_2200_2	0x0891		/* Centrino Wireless-N 2200 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_135_1	0x0892		/* Centrino Wireless-N 135 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_135_2	0x0893		/* Centrino Wireless-N 135 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_105_1	0x0894		/* Centrino Wireless-N 105 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_105_2	0x0895		/* Centrino Wireless-N 105 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_130_1	0x0896		/* Centrino Wireless-N 130 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_130_2	0x0897		/* Centrino Wireless-N 130 */
+#define	PCI_PRODUCT_INTEL_X1000_SDIO_EMMC	0x08a7		/* Quark X1000 SDIO/eMMC */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_100_1	0x08ae		/* Centrino Wireless-N 100 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_100_2	0x08af		/* Centrino Wireless-N 100 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_7260_1	0x08b1		/* Dual Band Wireless AC 7260 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_7260_2	0x08b2		/* Dual Band Wireless AC 7260 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_3160_1	0x08b3		/* Dual Band Wireless AC 3160 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_3160_2	0x08b4		/* Dual Band Wireless AC 3160 */
+#define	PCI_PRODUCT_INTEL_X1000_I2C_GPIO	0x0934		/* Quark X1000 I2C and GPIO */
+#define	PCI_PRODUCT_INTEL_X1000_SPI	0x0935		/* Quark X1000 SPI */
+#define	PCI_PRODUCT_INTEL_X1000_HS_UART	0x0936		/* Quark X1000 HS-UART */
+#define	PCI_PRODUCT_INTEL_X1000_MAC	0x0937		/* Quark X1000 10/100 Ethernet MAC */
+#define	PCI_PRODUCT_INTEL_X1000_EHCI	0x0939		/* Quark X1000 EHCI */
+#define	PCI_PRODUCT_INTEL_X1000_OHCI	0x093a		/* Quark X1000 OHCI */
+#define	PCI_PRODUCT_INTEL_PCIE_NVME_SSD	0x0953		/* PCIe NVMe SSD */
+#define	PCI_PRODUCT_INTEL_X1000_HB	0x0958		/* Quark X1000 Host Bridge */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_7265_1	0x095a		/* Dual Band Wireless AC 7265 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_7265_2	0x095b		/* Dual Band Wireless AC 7265 */
+#define	PCI_PRODUCT_INTEL_X1000_LB	0x095e		/* Quark X1000 Legacy Bridge */
+#define	PCI_PRODUCT_INTEL_80960RM	0x0962		/* i960 RM PCI-PCI */
+#define	PCI_PRODUCT_INTEL_80960RN	0x0964		/* i960 RN PCI-PCI */
+#define	PCI_PRODUCT_INTEL_CORE4G_D_ULT_GT1	0x0a02		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_HOST_DRAM	0x0a04		/* Core 4G (mobile) Host Bridge, DRAM */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_ULT_GT1	0x0a06		/* HD Graphics (GT1) */
+#define	PCI_PRODUCT_INTEL_CORE4G_S_ULT_GT1	0x0a0a		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT1_1	0x0a0b		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_MINI_HDA	0x0a0c		/* Core 4G (mobile) Mini HD audio */
+#define	PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT1_2	0x0a0e		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_D_ULT_GT2	0x0a12		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_ULT_GT2	0x0a16		/* HD Graphics (GT2) */
+#define	PCI_PRODUCT_INTEL_CORE4G_S_ULT_GT2	0x0a1a		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT2_1	0x0a1b		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT2_2	0x0a1e		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_D_ULT_GT3	0x0a22		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_ULT_GT3	0x0a26		/* HD Graphics 5000 (GT3) */
+#define	PCI_PRODUCT_INTEL_CORE4G_S_ULT_GT3	0x0a2a		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT3_1	0x0a2b		/* HD Graphics */
+#define	PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT3_2	0x0a2e		/* Iris Graphics 5100 */
+#define	PCI_PRODUCT_INTEL_HASWELL_HOST_DRAM	0x0c00		/* Haswell Host Bridge, DRAM */
+#define	PCI_PRODUCT_INTEL_HASWELL_PCIE16	0x0c01		/* Haswell PCI-E x16 Controller */
+#define	PCI_PRODUCT_INTEL_HASWELL_PCIE8	0x0c05		/* Haswell PCI-E x8 Controller */
+#define	PCI_PRODUCT_INTEL_XE3_12KV3_HOST_DRAM	0x0c08		/* Xeon E3-1200 v3 Host Bridge, DRAM */
+#define	PCI_PRODUCT_INTEL_HASWELL_PCIE4	0x0c09		/* Haswell PCI-E x4 Controller */
+#define	PCI_PRODUCT_INTEL_HASWELL_MINI_HDA	0x0c0c		/* Haswell Mini HD Audio Controller */
+#define	PCI_PRODUCT_INTEL_S1200_PCIE_1	0x0c46		/* Atom S1200 PCIe Root Port 1 */
+#define	PCI_PRODUCT_INTEL_S1200_PCIE_2	0x0c47		/* Atom S1200 PCIe Root Port 2 */
+#define	PCI_PRODUCT_INTEL_S1200_PCIE_3	0x0c48		/* Atom S1200 PCIe Root Port 3 */
+#define	PCI_PRODUCT_INTEL_S1200_PCIE_4	0x0c49		/* Atom S1200 PCIe Root Port 4 */
+#define	PCI_PRODUCT_INTEL_S1200_INTERNALMNG	0x0c54		/* Atom S1200 Internal management */
+#define	PCI_PRODUCT_INTEL_S1200_DFX1	0x0c55		/* Atom S1200 Debug function 1 */
+#define	PCI_PRODUCT_INTEL_S1200_DFX2	0x0c56		/* Atom S1200 Debug function 2 */
+#define	PCI_PRODUCT_INTEL_S1200_SMBUS_0	0x0c59		/* Atom S1200 SMBus 0 (PCIe mass-storage) */
+#define	PCI_PRODUCT_INTEL_S1200_SMBUS_1	0x0c5a		/* Atom S1200 SMBus 1 (enclosure maintain) */
+#define	PCI_PRODUCT_INTEL_S1200_SMBUS_2	0x0c5b		/* Atom S1200 SMBus 2 */
+#define	PCI_PRODUCT_INTEL_S1200_SMBUS_3	0x0c5c		/* Atom S1200 SMBus 3 */
+#define	PCI_PRODUCT_INTEL_S1200_SMBUS_4	0x0c5d		/* Atom S1200 SMBus 4 */
+#define	PCI_PRODUCT_INTEL_S1200_SMBUS_5	0x0c5e		/* Atom S1200 SMBus 5 */
+#define	PCI_PRODUCT_INTEL_S1200_UART	0x0c5f		/* Atom S1200 High-Speed UART */
+#define	PCI_PRODUCT_INTEL_S1200_ILB	0x0c60		/* Atom S1200 LPC bridge */
+#define	PCI_PRODUCT_INTEL_S1200_S1220	0x0c72		/* Atom S1220 Internal */
+#define	PCI_PRODUCT_INTEL_S1200_S1240	0x0c73		/* Atom S1240 Internal */
+#define	PCI_PRODUCT_INTEL_S1200_S1260	0x0c75		/* Atom S1260 Internal */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_HB	0x0f00		/* Bay Trail Processor Transaction Router */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_HDA	0x0f04		/* Bay Trail HD Audio */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_DMA	0x0f06		/* Bay Trail Serial IO (DMA) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_PWM1	0x0f08		/* Bay Trail Serial IO (PWM) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_PWM2	0x0f09		/* Bay Trail Serial IO (PWM) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_UART1	0x0f0a		/* Bay Trail Serial IO (HSUART) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_UART2	0x0f0c		/* Bay Trail Serial IO (HSUART) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_SPI	0x0f0e		/* Bay Trail Serial IO (SPI) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_PCU_SMB	0x0f12		/* Bay Trail PCU SMBus */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SCC_MMC	0x0f14		/* Bay Trail Storage Control Cluster(MMC) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SCC_SDIO	0x0f15		/* Bay Trail Storage Control Cluster(SDIO) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SCC	0x0f16		/* Bay Trail Storage Control Cluster(SD) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_TXE	0x0f18		/* Bay Trail Trusted Execution Engine */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_PCU_LPC	0x0f1c		/* Bay Trail LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SATA_IDE_0	0x0f20		/* Bay Trail SATA (IDE) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SATA_IDE_1	0x0f21		/* Bay Trail SATA (IDE) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SATA_AHCI_0	0x0f22		/* Bay Trail SATA (AHCI) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SATA_AHCI_1	0x0f23		/* Bay Trail SATA (AHCI) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_LPEA	0x0f28		/* Bay Trail Low Power Engine Audio */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_IGD	0x0f31		/* Bay Trail Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_EHCI	0x0f34		/* Bay Trail USB EHCI */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_XHCI	0x0f35		/* Bay Trail USB xHCI */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_USB_DEV	0x0f37		/* Bay Trail USB device */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_CISP	0x0f38		/* Bay Trail Camera Image Signal Processor */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO_DMA	0x0f40		/* Bay Trail Serial IO (DMA) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C1	0x0f41		/* Bay Trail Serial IO (I2C) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C2	0x0f42		/* Bay Trail Serial IO (I2C) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C3	0x0f43		/* Bay Trail Serial IO (I2C) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C4	0x0f44		/* Bay Trail Serial IO (I2C) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C5	0x0f45		/* Bay Trail Serial IO (I2C) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C6	0x0f46		/* Bay Trail Serial IO (I2C) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C7	0x0f47		/* Bay Trail Serial IO (I2C) */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_PCIE_1	0x0f48		/* Bay Trail PCIE Root Port */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_PCIE_2	0x0f4a		/* Bay Trail PCIE Root Port */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_PCIE_3	0x0f4c		/* Bay Trail PCIE Root Port */
+#define	PCI_PRODUCT_INTEL_BAYTRAIL_PCIE_4	0x0f4e		/* Bay Trail PCIE Root Port */
+#define	PCI_PRODUCT_INTEL_82542	0x1000		/* i82542 Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82543GC_FIBER	0x1001		/* i82453GC 1000baseX Ethernet */
+#define	PCI_PRODUCT_INTEL_MODEM56	0x1002		/* 56k Modem */
+#define	PCI_PRODUCT_INTEL_82543GC_COPPER	0x1004		/* i82543GC 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82544EI_COPPER	0x1008		/* i82544EI 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82544EI_FIBER	0x1009		/* i82544EI 1000baseX Ethernet */
+#define	PCI_PRODUCT_INTEL_82544GC_COPPER	0x100c		/* i82544GC 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82544GC_LOM	0x100d		/* i82544GC (LOM) Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82540EM	0x100e		/* i82540EM 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82545EM_COPPER	0x100f		/* i82545EM 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82546EB_COPPER	0x1010		/* i82546EB 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82545EM_FIBER	0x1011		/* i82545EM 1000baseX Ethernet */
+#define	PCI_PRODUCT_INTEL_82546EB_FIBER	0x1012		/* i82546EB 1000baseX Ethernet */
+#define	PCI_PRODUCT_INTEL_82541EI	0x1013		/* i82541EI Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82541ER_LOM	0x1014		/* i82541ER (LOM) Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82540EM_LOM	0x1015		/* i82540EM (LOM) Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82540EP_LOM	0x1016		/* i82540EP (LOM) Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82540EP	0x1017		/* i82540EP Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82541EI_MOBILE	0x1018		/* i82541EI Mobile Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82547EI	0x1019		/* i82547EI Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82547EI_MOBILE	0x101a		/* i82547EI Mobile Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82546EB_QUAD	0x101d		/* i82546EB 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82540EP_LP	0x101e		/* i82540EP Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82545GM_COPPER	0x1026		/* i82545GM 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82545GM_FIBER	0x1027		/* i82545GM 1000baseX Ethernet */
+#define	PCI_PRODUCT_INTEL_82545GM_SERDES	0x1028		/* i82545GM Gigabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_PRO_100	0x1029		/* PRO/100 Ethernet */
+#define	PCI_PRODUCT_INTEL_IN_BUSINESS	0x1030		/* InBusiness Fast Ethernet LAN Controller */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_0	0x1031		/* PRO/100 VE Network Controller */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_1	0x1032		/* PRO/100 VE Network Controller */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_0	0x1033		/* PRO/100 VM Network Controller */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_1	0x1034		/* PRO/100 VM Network Controller */
+#define	PCI_PRODUCT_INTEL_82562EH_HPNA_0	0x1035		/* 82562EH HomePNA Network Controller */
+#define	PCI_PRODUCT_INTEL_82562EH_HPNA_1	0x1036		/* 82562EH HomePNA Network Controller */
+#define	PCI_PRODUCT_INTEL_82562EH_HPNA_2	0x1037		/* 82562EH HomePNA Network Controller */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_2	0x1038		/* PRO/100 VM Network Controller */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_2	0x1039		/* PRO/100 VE Network Controller w/ 82562ET/EZ PHY */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_3	0x103a		/* PRO/100 VE Network Controller w/ 82562ET/EZ (CNR) PHY */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_3	0x103b		/* PRO/100 VM Network Controller w/ 82562EM/EX PHY */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_4	0x103c		/* PRO/100 VM Network Controller w/ 82562EM/EX (CNR) PHY */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_4	0x103d		/* PRO/100 VE (MOB) Network Controller */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_5	0x103e		/* PRO/100 VM (MOB) Network Controller */
+#define	PCI_PRODUCT_INTEL_PRO_WL_2100	0x1043		/* PRO/Wireless LAN 2100 3B Mini-PCI Adapter */
+#define	PCI_PRODUCT_INTEL_82597EX	0x1048		/* PRO/10GbE LR Server Adapter */
+#define	PCI_PRODUCT_INTEL_82801H_M_AMT	0x1049		/* i82801H (M_AMT) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801H_AMT	0x104a		/* i82801H (AMT) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801H_LAN	0x104b		/* i82801H LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801H_IFE_LAN	0x104c		/* i82801H (IFE) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801H_M_LAN	0x104d		/* i82801H (M) LAN Controller */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_6	0x1050		/* PRO/100 VM Network Controller w/ 82562ET/EZ PHY */
+#define	PCI_PRODUCT_INTEL_82801EB_LAN	0x1051		/* 82801EB/ER 10/100 Ethernet */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_7	0x1052		/* PRO/100 VM Network Connection */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_8	0x1053		/* PRO/100 VM Network Connection */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_9	0x1054		/* PRO/100 VM Network Connection */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_10	0x1055		/* PRO/100 VM Network Connection */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_11	0x1056		/* PRO/100 VM Network Connection */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_12	0x1057		/* PRO/100 VM Network Connection */
+#define	PCI_PRODUCT_INTEL_PRO_100_M	0x1059		/* PRO/100 M Network Controller */
+#define	PCI_PRODUCT_INTEL_82571EB_COPPER	0x105e		/* i82571EB 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82571EB_FIBER	0x105f		/* i82571EB 1000baseX Ethernet */
+#define	PCI_PRODUCT_INTEL_82571EB_SERDES	0x1060		/* i82571EB Gigabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82801FB_LAN_2	0x1064		/* 82801FB 10/100 Ethernet */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_9	0x1065		/* PRO/100 VE Ethernet */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_13	0x1066		/* PRO/100 VM Network Connection */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_14	0x1067		/* PRO/100 VM Network Connection */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_5	0x1068		/* PRO/100 VE (LOM) Network Controller */
+#define	PCI_PRODUCT_INTEL_82801GB_LAN	0x1069		/* 82801GB 10/100 Ethernet */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_10	0x106a		/* PRO/100 VE Ethernet */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_11	0x106b		/* PRO/100 VE Ethernet */
+#define	PCI_PRODUCT_INTEL_82547GI	0x1075		/* i82547GI Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82541GI	0x1076		/* i82541GI Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82541GI_MOBILE	0x1077		/* i82541GI Mobile Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82541ER	0x1078		/* i82541ER Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82546GB_COPPER	0x1079		/* i82546GB 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82546GB_FIBER	0x107a		/* i82546GB 1000baseX Ethernet */
+#define	PCI_PRODUCT_INTEL_82546GB_SERDES	0x107b		/* i82546GB Gigabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82541PI	0x107c		/* i82541PI Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82572EI_COPPER	0x107d		/* i82572EI 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82572EI_FIBER	0x107e		/* i82572EI 1000baseX Ethernet */
+#define	PCI_PRODUCT_INTEL_82572EI_SERDES	0x107f		/* i82572EI Gigabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82546GB_PCIE	0x108a		/* PRO/1000MT (82546GB) */
+#define	PCI_PRODUCT_INTEL_82573E	0x108b		/* i82573E Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82573E_IAMT	0x108c		/* i82573E Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_15	0x1091		/* PRO/100 VM Network Connection */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_6	0x1092		/* PRO/100 VE Network Controller */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_8	0x1093		/* PRO/100 VE Network Controller */
+#define	PCI_PRODUCT_INTEL_PRO_100_VE_7	0x1094		/* PRO/100 VE Network Controller w/ 82562G PHY */
+#define	PCI_PRODUCT_INTEL_PRO_100_VM_16	0x1095		/* PRO/100 VM Network Connection */
+#define	PCI_PRODUCT_INTEL_80K3LAN_CPR_DPT	0x1096		/* i80003 Dual 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_80K3LAN_FIB_DPT	0x1097		/* i80003 Dual 1000baseX Ethernet */
+#define	PCI_PRODUCT_INTEL_80K3LAN_SDS_DPT	0x1098		/* i80003 Dual Gigabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82546GB_QUAD_COPPER	0x1099		/* i82546GB Quad Port Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82573L	0x109a		/* i82573L Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82597EX_CX4	0x109e		/* 82597EX CX4 */
+#define	PCI_PRODUCT_INTEL_82571EB_QUAD_COPPER	0x10a4		/* i82571EB Quad Port Gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82571EB_QUAD_FIBER	0x10a5		/* i82571EB Quad Port Gigabit Fiber Ethernet */
+#define	PCI_PRODUCT_INTEL_82575EB_COPPER	0x10a7		/* i82575EB dual-1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82575EB_FIBER_SERDES	0x10a9		/* i82575EB dual-1000baseX Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82546GB_QUAD_COPPER_KSP3	0x10b5		/* i82546GB Quad Port Gigabit Ethernet (KSP3) */
+#define	PCI_PRODUCT_INTEL_82598	0x10b6		/* 82598 10G Ethernet */
+#define	PCI_PRODUCT_INTEL_82572EI	0x10b9		/* i82572EI 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_80K3LAN_CPR_SPT	0x10ba		/* i80003 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_80K3LAN_SDS_SPT	0x10bb		/* i80003 Gigabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82571GB_QUAD_COPPER	0x10bc		/* i82571GB Quad 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82801I_IGP_AMT	0x10bd		/* 82801I (AMT) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801I_IGP_M	0x10bf		/* 82801I Mobile LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801I_IFE	0x10c0		/* 82801I LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801I_IFE_G	0x10c2		/* 82801I (G) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801I_IFE_GT	0x10c3		/* 82801I (GT) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801H_IFE_GT	0x10c4		/* i82801H IFE (GT) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801H_IFE_G	0x10c5		/* i82801H IFE (G) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82598AF_DUAL	0x10c6		/* 82598 10 Gigabit AF Dual Port */
+#define	PCI_PRODUCT_INTEL_82598AF	0x10c7		/* 82598 10 Gigabit AF */
+#define	PCI_PRODUCT_INTEL_82598AT	0x10c8		/* 82598 10 Gigabit AT */
+#define	PCI_PRODUCT_INTEL_82576_COPPER	0x10c9		/* 82576 1000BaseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82576_VF	0x10ca		/* 82576 1000BaseT Ethernet Virtual Function */
+#define	PCI_PRODUCT_INTEL_82801H_IGP_M_V	0x10cb		/* i82801H IGP (MV) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801J_R_BM_LM	0x10cc		/* i82567LM-2 LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801J_R_BM_LF	0x10cd		/* i82567LF-2 LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801J_R_BM_V	0x10ce		/* i82567V-2 LAN Controller */
+#define	PCI_PRODUCT_INTEL_82574L	0x10d3		/* i82574L 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82571PT_QUAD_COPPER	0x10d5		/* i82571PT quad-1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82575GB_QUAD_COPPER	0x10d6		/* i82575GB quad-1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82571EB_DUAL_SERDES	0x10d9		/* i82571EB dual giabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82571EB_QUAD_SERDES	0x10da		/* i82571EB qual giabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82598EB_SFP	0x10db		/* 82598EB 10 Gigabit SFP */
+#define	PCI_PRODUCT_INTEL_82598EB_CX4	0x10dd		/* 82598EB 10 Gigabit CX4 */
+#define	PCI_PRODUCT_INTEL_82801J_D_BM_LM	0x10de		/* i82567LM-3 LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801J_D_BM_LF	0x10df		/* i82567LF-3 LAN Controller */
+#define	PCI_PRODUCT_INTEL_82598_SR_DUAL_EM	0x10e1		/* 82598 10 Gigabit SR Dual Port */
+#define	PCI_PRODUCT_INTEL_82575GB_QUAD_COPPER_PM	0x10e2		/* i82575GB Quad-1000baseT Ethernet (PM) */
+#define	PCI_PRODUCT_INTEL_82801I_BM	0x10e5		/* i82567LM-4 LAN Controller */
+#define	PCI_PRODUCT_INTEL_82576_FIBER	0x10e6		/* 82576 1000BaseX Ethernet */
+#define	PCI_PRODUCT_INTEL_82576_SERDES	0x10e7		/* 82576 gigabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82576_QUAD_COPPER	0x10e8		/* 82576 quad-1000BaseT Ethernet */
+#define	PCI_PRODUCT_INTEL_PCH_M_LM	0x10ea		/* PCH LAN (82577LM) Controller */
+#define	PCI_PRODUCT_INTEL_PCH_M_LC	0x10eb		/* PCH LAN (82577LC) Controller */
+#define	PCI_PRODUCT_INTEL_82598_CX4_DUAL	0x10ec		/* 82598 10 Gigabit CX4 Dual Port */
+#define	PCI_PRODUCT_INTEL_82599_VF	0x10ed		/* 82599 10 Gigabit Ethernet Virtual Function */
+#define	PCI_PRODUCT_INTEL_PCH_D_DM	0x10ef		/* PCH LAN (82578DM) Controller */
+#define	PCI_PRODUCT_INTEL_PCH_D_DC	0x10f0		/* PCH LAN (82578DC) Controller */
+#define	PCI_PRODUCT_INTEL_82598_DA_DUAL	0x10f1		/* 82598 10 Gigabit DA Dual Port */
+#define	PCI_PRODUCT_INTEL_82598EB_XF_LR	0x10f4		/* 82598EB 10 Gigabit XF LR */
+#define	PCI_PRODUCT_INTEL_82801I_IGP_M_AMT	0x10f5		/* 82801I Mobile (AMT) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82574LA	0x10f6		/* 82574L 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82599_KX4	0x10F7		/* 82599 (KX/KX4) 10 GbE Controller */
+#define	PCI_PRODUCT_INTEL_82599_COMBO_BACKPLANE	0x10F8		/* 82599 (combined backplane; KR/KX4/KX) 10 GbE Controller */
+#define	PCI_PRODUCT_INTEL_82599_CX4	0x10F9		/* 82599 (CX4) 10 GbE Controller */
+#define	PCI_PRODUCT_INTEL_82599_SFP	0x10FB		/* 82599 (SFI/SFP+) 10 GbE Controller */
+#define	PCI_PRODUCT_INTEL_82599_XAUI_LOM	0x10FC		/* 82599 (XAUI/BX4) 10 GbE Controller */
+#define	PCI_PRODUCT_INTEL_82552	0x10fe		/* 82552 10/100 Network Connection */
+#define	PCI_PRODUCT_INTEL_82815_DC100_HUB	0x1100		/* 82815 Hub */
+#define	PCI_PRODUCT_INTEL_82815_DC100_AGP	0x1101		/* 82815 AGP */
+#define	PCI_PRODUCT_INTEL_82815_DC100_GRAPH	0x1102		/* 82815 Graphics */
+#define	PCI_PRODUCT_INTEL_82815_NOAGP_HUB	0x1110		/* 82815 Hub */
+#define	PCI_PRODUCT_INTEL_82815_NOAGP_GRAPH	0x1112		/* 82815 Graphics */
+#define	PCI_PRODUCT_INTEL_82815_NOGRAPH_HUB	0x1120		/* 82815 Hub */
+#define	PCI_PRODUCT_INTEL_82815_NOGRAPH_AGP	0x1121		/* 82815 AGP */
+#define	PCI_PRODUCT_INTEL_82815_FULL_HUB	0x1130		/* 82815 Hub */
+#define	PCI_PRODUCT_INTEL_82815_FULL_AGP	0x1131		/* 82815 AGP */
+#define	PCI_PRODUCT_INTEL_82815_FULL_GRAPH	0x1132		/* 82815 Graphics */
+#define	PCI_PRODUCT_INTEL_82806AA	0x1161		/* 82806AA PCI64 Hub Advanced Programmable Interrupt Controller */
+#define	PCI_PRODUCT_INTEL_ADI_BECC	0x1162		/* ADI i80200 Big Endian Companion Chip */
+#define	PCI_PRODUCT_INTEL_X1000_PCIE_0	0x11c3		/* Quark X1000 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_X1000_PCIE_1	0x11c4		/* Quark X1000 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_IXP1200	0x1200		/* IXP1200 Network Processor */
+#define	PCI_PRODUCT_INTEL_82559ER	0x1209		/* 82559ER Fast Ethernet LAN Controller */
+#define	PCI_PRODUCT_INTEL_82092AA	0x1222		/* 82092AA IDE Controller */
+#define	PCI_PRODUCT_INTEL_SAA7116	0x1223		/* SAA7116 */
+#define	PCI_PRODUCT_INTEL_82452_PB	0x1225		/* 82452KX/GX Orion Extended Express Processor to PCI Bridge */
+#define	PCI_PRODUCT_INTEL_82596	0x1226		/* 82596 LAN Controller */
+#define	PCI_PRODUCT_INTEL_EEPRO100	0x1227		/* EE Pro 100 10/100 Fast Ethernet */
+#define	PCI_PRODUCT_INTEL_EEPRO100S	0x1228		/* EE Pro 100 Smart 10/100 Fast Ethernet */
+#define	PCI_PRODUCT_INTEL_8255X	0x1229		/* 8255x Fast Ethernet LAN Controller */
+#define	PCI_PRODUCT_INTEL_82437FX	0x122d		/* 82437FX (TSC) System Controller */
+#define	PCI_PRODUCT_INTEL_82371FB_ISA	0x122e		/* 82371FB (PIIX) PCI-ISA Bridge */
+#define	PCI_PRODUCT_INTEL_82371FB_IDE	0x1230		/* 82371FB (PIIX) IDE Controller */
+#define	PCI_PRODUCT_INTEL_82371MX	0x1234		/* 82371MX (MPIIX) Mobile PCI I/O IDE Xcelerator */
+#define	PCI_PRODUCT_INTEL_82437MX	0x1235		/* 82437MX (MTSC) Mobile System Controller */
+#define	PCI_PRODUCT_INTEL_82441FX	0x1237		/* 82441FX (PMC) PCI and Memory Controller */
+#define	PCI_PRODUCT_INTEL_82380AB	0x123c		/* 82380AB (MISA) Mobile PCI-ISA Bridge */
+#define	PCI_PRODUCT_INTEL_82380FB	0x124b		/* 82380FB (MPCI2) Mobile PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_82439HX	0x1250		/* 82439HX (TXC) System Controller */
+#define	PCI_PRODUCT_INTEL_82870P2_PPB	0x1460		/* 82870P2 P64H2 PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_82870P2_IOxAPIC	0x1461		/* 82870P2 P64H2 IOxAPIC */
+#define	PCI_PRODUCT_INTEL_82870P2_HPLUG	0x1462		/* 82870P2 P64H2 Hot Plug Controller */
+#define	PCI_PRODUCT_INTEL_82801I_82567V_3	0x1501		/* i82567V-3 LAN Controller */
+#define	PCI_PRODUCT_INTEL_PCH2_LV_LM	0x1502		/* 82579LM Gigabit Network Connection */
+#define	PCI_PRODUCT_INTEL_PCH2_LV_V	0x1503		/* 82579V Gigabit Network Connection */
+#define	PCI_PRODUCT_INTEL_82599_SFP_EM	0x1507		/* 82599 10G Ethernet Express Module */
+#define	PCI_PRODUCT_INTEL_82598_BX	0x1508		/* 82598 10G Ethernet BX */
+#define	PCI_PRODUCT_INTEL_82576_NS	0x150a		/* 82576 gigabit Ethernet */
+#define	PCI_PRODUCT_INTEL_82598AT2	0x150b		/* 82598 10G AT2 Ethernet */
+#define	PCI_PRODUCT_INTEL_82583V	0x150c		/* i82583V 1000baseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82576_SERDES_QUAD	0x150d		/* 82576 quad-gigabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82580_COPPER	0x150e		/* 82580 1000BaseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82580_FIBER	0x150f		/* 82580 1000BaseX Ethernet */
+#define	PCI_PRODUCT_INTEL_82580_SERDES	0x1510		/* 82580 1000BaseT Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82580_SGMII	0x1511		/* 82580 gigabit Ethernet (SGMII) */
+#define	PCI_PRODUCT_INTEL_82599_KX4_MEZZ	0x1514		/* 82599 10G KX4 Ethernet Mezzanine */
+#define	PCI_PRODUCT_INTEL_X540_VF	0x1515		/* X540 10G Ethernet Virtual Function */
+#define	PCI_PRODUCT_INTEL_82580_COPPER_DUAL	0x1516		/* 82580 dual-1000BaseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82599_KR	0x1517		/* 82599 10G Ethernet KR */
+#define	PCI_PRODUCT_INTEL_82576_NS_SERDES	0x1518		/* 82576 gigabit Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_82599_T3_LOM	0x151c		/* 82599 10G Ethernet */
+#define	PCI_PRODUCT_INTEL_82580_ER	0x151d		/* 82580 1000BaseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82580_ER_DUAL	0x151e		/* 82580 dual-1000BaseT Ethernet */
+#define	PCI_PRODUCT_INTEL_I350_VF	0x1520		/* I350 Gigabit Network Connection Virtual Function */
+#define	PCI_PRODUCT_INTEL_I350_COPPER	0x1521		/* I350 Gigabit Network Connection */
+#define	PCI_PRODUCT_INTEL_I350_FIBER	0x1522		/* I350 Gigabit Fiber Network Connection */
+#define	PCI_PRODUCT_INTEL_I350_SERDES	0x1523		/* I350 Gigabit Backplane Connection */
+#define	PCI_PRODUCT_INTEL_I350_SGMII	0x1524		/* I350 Gigabit Connection */
+#define	PCI_PRODUCT_INTEL_82801J_D_BM_V	0x1525		/* 82567V LAN Controller */
+#define	PCI_PRODUCT_INTEL_82576_QUAD_COPPER_ET2	0x1526		/* 82576 quad-1000BaseT Ethernet */
+#define	PCI_PRODUCT_INTEL_82580_QUAD_FIBER	0x1527		/* 82580 quad-1000BaseX Ethernet */
+#define	PCI_PRODUCT_INTEL_X540_AT2	0x1528		/* X540-AT2 10Gbase-T Ethernet */
+#define	PCI_PRODUCT_INTEL_82599_SFP_FCOE	0x1529		/* 82599 10 GbE FCoE */
+#define	PCI_PRODUCT_INTEL_82599_BPLANE_FCOE	0x152a		/* 82599 10 GbE Backplane FCoE */
+#define	PCI_PRODUCT_INTEL_82576_VF_HV	0x152d		/* 82576 1000BaseT Ethernet Virtual Function */
+#define	PCI_PRODUCT_INTEL_82599_VF_HV	0x152e		/* 82599 10 GbE Virtual Function */
+#define	PCI_PRODUCT_INTEL_I350_VF_HV	0x152f		/* I350 Gigabit Network Connection Virtual Function */
+#define	PCI_PRODUCT_INTEL_X540_VF_HV	0x1530		/* X540 10 GbE Virtual Function */
+#define	PCI_PRODUCT_INTEL_I210_T1	0x1533		/* I210-T1 Ethernet Server Adapter */
+#define	PCI_PRODUCT_INTEL_I210_COPPER_OEM1	0x1534		/* I210 Ethernet (COPPER OEM) */
+#define	PCI_PRODUCT_INTEL_I210_COPPER_IT	0x1535		/* I210 Ethernet (COPPER IT) */
+#define	PCI_PRODUCT_INTEL_I210_FIBER	0x1536		/* I210 Ethernet (FIBER) */
+#define	PCI_PRODUCT_INTEL_I210_SERDES	0x1537		/* I210 Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_I210_SGMII	0x1538		/* I210 Ethernet (SGMII) */
+#define	PCI_PRODUCT_INTEL_I211_COPPER	0x1539		/* I211 Ethernet (COPPER) */
+#define	PCI_PRODUCT_INTEL_I217_LM	0x153a		/* I217-LM Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_I217_V	0x153b		/* I217-V Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_I350_DA4	0x1546		/* I350 Quad port Gigabit Connection */
+#define	PCI_PRODUCT_INTEL_82599_SFP_SF_QP	0x154a		/* 82599 10 GbE Controller */
+#define	PCI_PRODUCT_INTEL_XL710_VF	0x154c		/* XL710 Ethernet Virtual Function */
+#define	PCI_PRODUCT_INTEL_82599_SFP_SF2	0x154d		/* 82599 (SFP+) 10 GbE Controller */
+#define	PCI_PRODUCT_INTEL_82599EN_SFP	0x1557		/* 82599 10 GbE Controller */
+#define	PCI_PRODUCT_INTEL_I218_V	0x1559		/* I218-V Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_I218_LM	0x155a		/* I218-LM Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_X540_BYPASS	0x155c		/* X540 10 GbE Bypass */
+#define	PCI_PRODUCT_INTEL_82599_BYPASS	0x155d		/* 82599 10 GbE Bypass */
+#define	PCI_PRODUCT_INTEL_XL710_VF_HV	0x1571		/* XL710 Ethernet Virtual Function */
+#define	PCI_PRODUCT_INTEL_XL710_SFP	0x1572		/* XL710 SFP+ Ethernet */
+#define	PCI_PRODUCT_INTEL_I210_COPPER_WOF	0x157b		/* I210 Ethernet (COPPER) */
+#define	PCI_PRODUCT_INTEL_I210_SERDES_WOF	0x157c		/* I210 Ethernet (SERDES) */
+#define	PCI_PRODUCT_INTEL_XL710_KX_A	0x157f		/* XL710 KX Ethernet */
+#define	PCI_PRODUCT_INTEL_XL710_KX_B	0x1580		/* XL710 KX Ethernet */
+#define	PCI_PRODUCT_INTEL_XL710_KX_C	0x1581		/* XL710 KX Ethernet */
+#define	PCI_PRODUCT_INTEL_XL710_QSFP_A	0x1583		/* XL710 40GbE QSFP+ */
+#define	PCI_PRODUCT_INTEL_XL710_QSFP_B	0x1584		/* XL710 40GbE QSFP+ */
+#define	PCI_PRODUCT_INTEL_XL710_QSFP_C	0x1585		/* XL710 40GbE QSFP+ */
+#define	PCI_PRODUCT_INTEL_X710_10G_T	0x1586		/* X710 10GBaseT Ethernet */
+#define	PCI_PRODUCT_INTEL_I218_LM2	0x15a0		/* I218-LM Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_I218_V2	0x15a1		/* I218-V Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_I218_LM3	0x15a2		/* I218-LM Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_I218_V3	0x15a3		/* I218-V Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_CORE5G_HB_1	0x1604		/* Core 5G Host Bridge */
+#define	PCI_PRODUCT_INTEL_CORE5G_HDA_1	0x160c		/* Core 5G HD Audio */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_GT1	0x1606		/* HD Graphics (GT1) */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_GT2_1	0x1616		/* HD Graphics 5500 */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_GT2_2	0x161e		/* HD Graphics 5300 */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_GT3_15W	0x1626		/* HD Graphics 6000 */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_GT3_28W	0x162b		/* Iris Graphics 6100 */
+#define	PCI_PRODUCT_INTEL_80960_RP	0x1960		/* ROB-in i960RP Microprocessor */
+#define	PCI_PRODUCT_INTEL_80960RM_2	0x1962		/* i960 RM PCI-PCI */
+#define	PCI_PRODUCT_INTEL_82840_HB	0x1a21		/* 82840 Host */
+#define	PCI_PRODUCT_INTEL_82840_AGP	0x1a23		/* 82840 AGP */
+#define	PCI_PRODUCT_INTEL_82840_PCI	0x1a24		/* 82840 PCI */
+#define	PCI_PRODUCT_INTEL_82845_HB	0x1a30		/* 82845 Host */
+#define	PCI_PRODUCT_INTEL_82845_AGP	0x1a31		/* 82845 AGP */
+#define	PCI_PRODUCT_INTEL_5000_DMA	0x1a38		/* 5000 Series Chipset DMA Engine */
+#define	PCI_PRODUCT_INTEL_6SERIES_SATA_1	0x1c00		/* 6 Series SATA */
+#define	PCI_PRODUCT_INTEL_6SERIES_SATA_2	0x1c01		/* 6 Series SATA */
+#define	PCI_PRODUCT_INTEL_6SERIES_AHCI_1	0x1c02		/* 6 Series AHCI */
+#define	PCI_PRODUCT_INTEL_6SERIES_AHCI_2	0x1c03		/* 6 Series AHCI */
+#define	PCI_PRODUCT_INTEL_6SERIES_RAID_1	0x1c04		/* 6 Series RAID */
+#define	PCI_PRODUCT_INTEL_6SERIES_RAID_2	0x1c05		/* 6 Series RAID */
+#define	PCI_PRODUCT_INTEL_6SERIES_RAID_3	0x1c06		/* 6 Series RAID */
+#define	PCI_PRODUCT_INTEL_6SERIES_SATA_3	0x1c08		/* 6 Series SATA */
+#define	PCI_PRODUCT_INTEL_6SERIES_SATA_4	0x1c09		/* 6 Series SATA */
+#define	PCI_PRODUCT_INTEL_6SERIES_PCIE_1	0x1c10		/* 6 Series PCIE */
+#define	PCI_PRODUCT_INTEL_6SERIES_PCIE_2	0x1c12		/* 6 Series PCIE */
+#define	PCI_PRODUCT_INTEL_6SERIES_PCIE_3	0x1c14		/* 6 Series PCIE */
+#define	PCI_PRODUCT_INTEL_6SERIES_PCIE_4	0x1c16		/* 6 Series PCIE */
+#define	PCI_PRODUCT_INTEL_6SERIES_PCIE_5	0x1c18		/* 6 Series PCIE */
+#define	PCI_PRODUCT_INTEL_6SERIES_PCIE_6	0x1c1a		/* 6 Series PCIE */
+#define	PCI_PRODUCT_INTEL_6SERIES_PCIE_7	0x1c1c		/* 6 Series PCIE */
+#define	PCI_PRODUCT_INTEL_6SERIES_PCIE_8	0x1c1e		/* 6 Series PCIE */
+#define	PCI_PRODUCT_INTEL_6SERIES_HDA	0x1c20		/* 6 Series HD Audio */
+#define	PCI_PRODUCT_INTEL_6SERIES_SMB	0x1c22		/* 6 Series SMBus Controller */
+#define	PCI_PRODUCT_INTEL_6SERIES_THERM	0x1c24		/* 6 Series Thermal */
+#define	PCI_PRODUCT_INTEL_6SERIES_DMI	0x1c25		/* 6 Series DMI-PCI */
+#define	PCI_PRODUCT_INTEL_6SERIES_EHCI_1	0x1c26		/* 6 Series USB */
+#define	PCI_PRODUCT_INTEL_6SERIES_EHCI_2	0x1c2d		/* 6 Series USB */
+#define	PCI_PRODUCT_INTEL_6SERIES_MEI	0x1c3a		/* 6 Series MEI */
+#define	PCI_PRODUCT_INTEL_6SERIES_KT	0x1c3d		/* 6 Series KT */
+#define	PCI_PRODUCT_INTEL_Z68_LPC	0x1c44		/* Z68 LPC */
+#define	PCI_PRODUCT_INTEL_P67_LPC	0x1c46		/* P67 LPC */
+#define	PCI_PRODUCT_INTEL_UM67_LPC	0x1c47		/* UM67 LPC */
+#define	PCI_PRODUCT_INTEL_HM65_LPC	0x1c49		/* HM65 LPC */
+#define	PCI_PRODUCT_INTEL_H67_LPC	0x1c4a		/* H67 LPC */
+#define	PCI_PRODUCT_INTEL_HM67_LPC	0x1c4b		/* HM67 LPC */
+#define	PCI_PRODUCT_INTEL_Q65_LPC	0x1c4c		/* Q65 LPC */
+#define	PCI_PRODUCT_INTEL_QS67_LPC	0x1c4d		/* QS67 LPC */
+#define	PCI_PRODUCT_INTEL_Q67_LPC	0x1c4e		/* Q67 LPC */
+#define	PCI_PRODUCT_INTEL_QM67_LPC	0x1c4f		/* QM67 LPC */
+#define	PCI_PRODUCT_INTEL_B65_LPC	0x1c50		/* B65 LPC */
+#define	PCI_PRODUCT_INTEL_C202_LPC	0x1c52		/* C202 LPC */
+#define	PCI_PRODUCT_INTEL_C204_LPC	0x1c54		/* C204 LPC */
+#define	PCI_PRODUCT_INTEL_C206_LPC	0x1c56		/* C206 LPC */
+#define	PCI_PRODUCT_INTEL_H61_LPC	0x1c5c		/* H61 LPC */
+#define	PCI_PRODUCT_INTEL_C600_SATA_1	0x1d00		/* C600/X79 SATA */
+#define	PCI_PRODUCT_INTEL_C600_AHCI	0x1d02		/* C600/X79 AHCI */
+#define	PCI_PRODUCT_INTEL_C600_RAID_1	0x1d04		/* C600/X79 RAID */
+#define	PCI_PRODUCT_INTEL_C600_RAID_2	0x1d06		/* C600/X79 Premium RAID */
+#define	PCI_PRODUCT_INTEL_C600_SATA_2	0x1d08		/* C600/X79 SATA */
+#define	PCI_PRODUCT_INTEL_C600_PCIE_1	0x1d10		/* C600/X79 PCIE */
+#define	PCI_PRODUCT_INTEL_C600_PCIE_2	0x1d12		/* C600/X79 PCIE */
+#define	PCI_PRODUCT_INTEL_C600_PCIE_3	0x1d14		/* C600/X79 PCIE */
+#define	PCI_PRODUCT_INTEL_C600_PCIE_4	0x1d16		/* C600/X79 PCIE */
+#define	PCI_PRODUCT_INTEL_C600_PCIE_5	0x1d18		/* C600/X79 PCIE */
+#define	PCI_PRODUCT_INTEL_C600_PCIE_6	0x1d1a		/* C600/X79 PCIE */
+#define	PCI_PRODUCT_INTEL_C600_PCIE_7	0x1d1c		/* C600/X79 PCIE */
+#define	PCI_PRODUCT_INTEL_C600_PCIE_8	0x1d1e		/* C600/X79 PCIE */
+#define	PCI_PRODUCT_INTEL_C600_HDA	0x1d20		/* C600 HD Audio */
+#define	PCI_PRODUCT_INTEL_C600_SMBUS	0x1d22		/* C600 SMBus Controller */
+#define	PCI_PRODUCT_INTEL_C600_THERM	0x1d24		/* C600 Thermal Management Controller */
+#define	PCI_PRODUCT_INTEL_C600_EHCI_1	0x1d26		/* C600 USB */
+#define	PCI_PRODUCT_INTEL_C600_EHCI_2	0x1d2d		/* C600 USB */
+#define	PCI_PRODUCT_INTEL_C600_LAN	0x1d33		/* C600 LAN */
+#define	PCI_PRODUCT_INTEL_C600_MEI_1	0x1d3a		/* C600 MEI */
+#define	PCI_PRODUCT_INTEL_C600_MEI_2	0x1d3b		/* C600 MEI */
+#define	PCI_PRODUCT_INTEL_C600_KT	0x1d3d		/* C600 KT */
+#define	PCI_PRODUCT_INTEL_C600_VPCIE	0x1d3e		/* C600 Virtual PCIE */
+#define	PCI_PRODUCT_INTEL_C600_LPC	0x1d41		/* C600 LPC */
+#define	PCI_PRODUCT_INTEL_C600_SAS_1	0x1d60		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_SATA_1	0x1d61		/* C600 SAS Controller (SATA) */
+#define	PCI_PRODUCT_INTEL_C600_SAS_2	0x1d62		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_3	0x1d63		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_4	0x1d64		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_5	0x1d65		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_6	0x1d66		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_7	0x1d67		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_8	0x1d68		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_9	0x1d69		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_SATA_2	0x1d6a		/* C600 SAS Controller (SATA) */
+#define	PCI_PRODUCT_INTEL_C600_SAS_SATA_3	0x1d6b		/* C600/X79 SAS Controller (SATA) */
+#define	PCI_PRODUCT_INTEL_C600_SAS_10	0x1d6c		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_11	0x1d6d		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_12	0x1d6e		/* C600 SAS Controller */
+#define	PCI_PRODUCT_INTEL_C600_SAS_SATA_4	0x1d6f		/* C600 SAS Controller (SATA) */
+#define	PCI_PRODUCT_INTEL_C600_SMB_0	0x1d70		/* C600/X79 Series SMBus Controller */
+#define	PCI_PRODUCT_INTEL_C600_SMB_1	0x1d71		/* C606/C608 SMBus Controller */
+#define	PCI_PRODUCT_INTEL_C600_SMB_2	0x1d72		/* C608 SMBus Controller */
+#define	PCI_PRODUCT_INTEL_7SER_DT_SATA_1	0x1e00		/* 7 Series (desktop) SATA Controller */
+#define	PCI_PRODUCT_INTEL_7SER_MO_SATA_1	0x1e01		/* 7 Series (mobile) SATA Controller */
+#define	PCI_PRODUCT_INTEL_7SER_DT_SATA_AHCI	0x1e02		/* 7 Series (desktop) SATA Controller (AHCI) */
+#define	PCI_PRODUCT_INTEL_7SER_MO_SATA_AHCI	0x1e03		/* 7 Series (mobile) SATA Controller (AHCI) */
+#define	PCI_PRODUCT_INTEL_7SER_DT_SATA_RAID_2	0x1e04		/* 7 Series (desktop) SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_7SER_DT_SATA_RAID_3	0x1e06		/* 7 Series (desktop) SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_7SER_MO_SATA_RAID	0x1e07		/* 7 Series (mobile) SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_7SER_DT_SATA_2	0x1e08		/* 7 Series (desktop) SATA Controller */
+#define	PCI_PRODUCT_INTEL_7SER_MO_SATA_2	0x1e09		/* 7 Series (mobile) SATA Controller */
+#define	PCI_PRODUCT_INTEL_7SER_DT_SATA_RAID_1	0x1e0e		/* 7 Series (desktop) SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_7SERIES_PCIE_1	0x1e10		/* 7 Series PCIE */
+#define	PCI_PRODUCT_INTEL_7SERIES_PCIE_2	0x1e12		/* 7 Series PCIE */
+#define	PCI_PRODUCT_INTEL_7SERIES_PCIE_3	0x1e14		/* 7 Series PCIE */
+#define	PCI_PRODUCT_INTEL_7SERIES_PCIE_4	0x1e16		/* 7 Series PCIE */
+#define	PCI_PRODUCT_INTEL_7SERIES_PCIE_5	0x1e18		/* 7 Series PCIE */
+#define	PCI_PRODUCT_INTEL_7SERIES_PCIE_6	0x1e1a		/* 7 Series PCIE */
+#define	PCI_PRODUCT_INTEL_7SERIES_PCIE_7	0x1e1c		/* 7 Series PCIE */
+#define	PCI_PRODUCT_INTEL_7SERIES_PCIE_8	0x1e1e		/* 7 Series PCIE */
+#define	PCI_PRODUCT_INTEL_7SERIES_HDA	0x1e20		/* 7 Series HD Audio */
+#define	PCI_PRODUCT_INTEL_7SERIES_SMB	0x1e22		/* 7 Series SMBus Controller */
+#define	PCI_PRODUCT_INTEL_7SERIES_PPB	0x1e25		/* 7 Series PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_7SERIES_EHCI_1	0x1e26		/* 7 Series USB EHCI */
+#define	PCI_PRODUCT_INTEL_7SERIES_EHCI_2	0x1e2d		/* 7 Series USB EHCI */
+#define	PCI_PRODUCT_INTEL_7SERIES_XHCI	0x1e31		/* 7 Series USB xHCI */
+#define	PCI_PRODUCT_INTEL_7SERIES_MEI_1	0x1e3a		/* 7 Series MEI Controller */
+#define	PCI_PRODUCT_INTEL_7SERIES_MEI_2	0x1e3b		/* 7 Series MEI Controller */
+#define	PCI_PRODUCT_INTEL_7SERIES_IDE_R	0x1e3c		/* 7 Series IDE-R */
+#define	PCI_PRODUCT_INTEL_7SERIES_KT	0x1e3d		/* 7 Series KT */
+#define	PCI_PRODUCT_INTEL_Z77_LPC	0x1e44		/* Z77 LPC */
+#define	PCI_PRODUCT_INTEL_Z75_LPC	0x1e46		/* Z75 LPC */
+#define	PCI_PRODUCT_INTEL_Q77_LPC	0x1e47		/* Q77 LPC */
+#define	PCI_PRODUCT_INTEL_Q75_LPC	0x1e48		/* Q75 LPC */
+#define	PCI_PRODUCT_INTEL_B75_LPC	0x1e49		/* B75 LPC */
+#define	PCI_PRODUCT_INTEL_H77_LPC	0x1e4a		/* H77 LPC */
+#define	PCI_PRODUCT_INTEL_C216_LPC	0x1e53		/* C216 LPC */
+#define	PCI_PRODUCT_INTEL_MOBILE_QM77_LPC	0x1e55		/* Mobile QM77 LPC */
+#define	PCI_PRODUCT_INTEL_MOBILE_QS77_LPC	0x1e56		/* Mobile QS77 LPC */
+#define	PCI_PRODUCT_INTEL_MOBILE_HM77_LPC	0x1e57		/* Mobile HM77 LPC */
+#define	PCI_PRODUCT_INTEL_MOBILE_UM77_LPC	0x1e58		/* Mobile UM77 LPC */
+#define	PCI_PRODUCT_INTEL_MOBILE_HM76_LPC	0x1e59		/* Mobile HM76 LPC */
+#define	PCI_PRODUCT_INTEL_MOBILE_HM75_LPC	0x1e5d		/* Mobile HM75 LPC */
+#define	PCI_PRODUCT_INTEL_MOBILE_HM70_LPC	0x1e5e		/* Mobile HM70 LPC */
+#define	PCI_PRODUCT_INTEL_NM70_LPC	0x1e5f		/* NM70 LPC */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_0	0x1f00		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_1	0x1f01		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_2	0x1f02		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_3	0x1f03		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_4	0x1f04		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_5	0x1f05		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_6	0x1f06		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_7	0x1f07		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_8	0x1f08		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_9	0x1f09		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_A	0x1f0a		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_B	0x1f0b		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_C	0x1f0c		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_D	0x1f0d		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_E	0x1f0e		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_TROUTER_F	0x1f0f		/* C2000 Transaction Router */
+#define	PCI_PRODUCT_INTEL_C2000_PCIE_1	0x1f10		/* C2000 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_C2000_PCIE_2	0x1f11		/* C2000 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_C2000_PCIE_3	0x1f12		/* C2000 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_C2000_PCIE_4	0x1f13		/* C2000 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_C2000_RAS	0x1f14		/* C2000 RAS */
+#define	PCI_PRODUCT_INTEL_C2000_SMBUS	0x1f15		/* C2000 SMBus 2.0 */
+#define	PCI_PRODUCT_INTEL_C2000_RCEC	0x1f16		/* C2000 RCEC */
+#define	PCI_PRODUCT_INTEL_C2000_IQIA_PHYS	0x1f18		/* C2000 IQIA Physical Function */
+#define	PCI_PRODUCT_INTEL_C2000_IQIA_VF	0x1f19		/* C2000 IQIA Virtual Function */
+#define	PCI_PRODUCT_INTEL_C2000_SATA2	0x1f22		/* C2000 SATA2 */
+#define	PCI_PRODUCT_INTEL_C2000_USB	0x1f2c		/* C2000 USB 2.0 */
+#define	PCI_PRODUCT_INTEL_C2000_SATA3	0x1f32		/* C2000 SATA3 */
+#define	PCI_PRODUCT_INTEL_C2000_PCU_1	0x1f38		/* C2000 PCU */
+#define	PCI_PRODUCT_INTEL_C2000_PCU_2	0x1f39		/* C2000 PCU */
+#define	PCI_PRODUCT_INTEL_C2000_PCU_3	0x1f3a		/* C2000 PCU */
+#define	PCI_PRODUCT_INTEL_C2000_PCU_4	0x1f3b		/* C2000 PCU */
+#define	PCI_PRODUCT_INTEL_C2000_PCU_SMBUS	0x1f3c		/* C2000 PCU SMBus */
+#define	PCI_PRODUCT_INTEL_C2000_1000KX	0x1f40		/* C2000 Ethernet(1000BASE-KX) */
+#define	PCI_PRODUCT_INTEL_C2000_SGMII	0x1f41		/* C2000 Ethernet(SGMII) */
+#define	PCI_PRODUCT_INTEL_C2000_DUMMYGBE	0x1f42		/* C2000 Ethernet(Dummy function) */
+#define	PCI_PRODUCT_INTEL_C2000_25GBE	0x1f45		/* C2000 Ethernet(2.5Gbe) */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_LPC	0x2310		/* DH89xxCC LPC Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_SATA_1	0x2323		/* DH89xxCC SATA Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_SATA_2	0x2326		/* DH89xxCC SATA Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_SMB	0x2330		/* DH89xxCC SMBus Host Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_THERMAL	0x2332		/* DH89xxCC Thermal Subsystem */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_USB_1	0x2334		/* DH89xxCC USB EHCI */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_USB_2	0x2335		/* DH89xxCC USB EHCI */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_PCIE_1_1	0x2342		/* DH89xxCC PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_PCIE_1_2	0x2343		/* DH89xxCC PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_PCIE_2_1	0x2344		/* DH89xxCC PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_PCIE_2_2	0x2345		/* DH89xxCC PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_PCIE_3_1	0x2346		/* DH89xxCC PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_PCIE_3_2	0x2347		/* DH89xxCC PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_PCIE_4_1	0x2348		/* DH89xxCC PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_PCIE_4_2	0x2349		/* DH89xxCC PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_WDT	0x2360		/* DH89xxCC Watchdog Timer for Core Reset */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_MEI_1	0x2364		/* DH89xxCC MEI Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCC_MEI_2	0x2365		/* DH89xxCC MEI Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_LPC	0x2390		/* DH89xxCL LPC Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_SATA_1	0x23a3		/* DH89xxCL SATA Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_SATA_2	0x23a6		/* DH89xxCL SATA Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_SMB	0x23b0		/* DH89xxCL SMBus Host Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_THERMAL	0x23b2		/* DH89xxCL Thermal Subsystem */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_USB_1	0x23b4		/* DH89xxCL USB EHCI */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_USB_2	0x23b4		/* DH89xxCL USB EHCI */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_PCIE_1_1	0x23c2		/* DH89xxCL PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_PCIE_1_2	0x23c3		/* DH89xxCL PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_PCIE_2_1	0x23c4		/* DH89xxCL PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_PCIE_2_2	0x23c5		/* DH89xxCL PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_PCIE_3_1	0x23c6		/* DH89xxCL PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_PCIE_3_2	0x23c7		/* DH89xxCL PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_PCIE_4_1	0x23c8		/* DH89xxCL PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_PCIE_4_2	0x23c9		/* DH89xxCL PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_WDT	0x23e0		/* DH89xxCL Watchdog Timer for Core Reset */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_MEI_1	0x23e4		/* DH89xxCL MEI Controller */
+#define	PCI_PRODUCT_INTEL_DH89XXCL_MEI_2	0x23e5		/* DH89xxCL MEI Controller */
+#define	PCI_PRODUCT_INTEL_82801AA_LPC	0x2410		/* 82801AA LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801AA_IDE	0x2411		/* 82801AA IDE Controller */
+#define	PCI_PRODUCT_INTEL_82801AA_USB	0x2412		/* 82801AA USB Controller */
+#define	PCI_PRODUCT_INTEL_82801AA_SMB	0x2413		/* 82801AA SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801AA_ACA	0x2415		/* 82801AA AC-97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801AA_ACM	0x2416		/* 82801AA AC-97 PCI Modem */
+#define	PCI_PRODUCT_INTEL_82801AA_HPB	0x2418		/* 82801AA Hub-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_82801AB_LPC	0x2420		/* 82801AB LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801AB_IDE	0x2421		/* 82801AB IDE Controller */
+#define	PCI_PRODUCT_INTEL_82801AB_USB	0x2422		/* 82801AB USB Controller */
+#define	PCI_PRODUCT_INTEL_82801AB_SMB	0x2423		/* 82801AB SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801AB_ACA	0x2425		/* 82801AB AC-97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801AB_ACM	0x2426		/* 82801AB AC-97 PCI Modem */
+#define	PCI_PRODUCT_INTEL_82801AB_HPB	0x2428		/* 82801AB Hub-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_82801BA_LPC	0x2440		/* 82801BA LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801BA_USB1	0x2442		/* 82801BA USB Controller */
+#define	PCI_PRODUCT_INTEL_82801BA_SMB	0x2443		/* 82801BA SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801BA_USB2	0x2444		/* 82801BA USB Controller */
+#define	PCI_PRODUCT_INTEL_82801BA_ACA	0x2445		/* 82801BA AC-97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801BA_ACM	0x2446		/* 82801BA AC-97 PCI Modem */
+#define	PCI_PRODUCT_INTEL_82801BAM_HPB	0x2448		/* 82801BAM Hub-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_82801BA_LAN	0x2449		/* 82801BA LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801BAM_IDE	0x244a		/* 82801BAM IDE Controller */
+#define	PCI_PRODUCT_INTEL_82801BA_IDE	0x244b		/* 82801BA IDE Controller */
+#define	PCI_PRODUCT_INTEL_82801BAM_LPC	0x244c		/* 82801BAM LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801BA_HPB	0x244e		/* 82801BA Hub-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_82801E_LPC	0x2450		/* 82801E LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801E_SMB	0x2453		/* 82801E SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801E_LAN_1	0x2459		/* 82801E LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801E_LAN_2	0x245d		/* 82801E LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801CA_LPC	0x2480		/* 82801CA LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801CA_USB_1	0x2482		/* 82801CA USB Controller */
+#define	PCI_PRODUCT_INTEL_82801CA_SMB	0x2483		/* 82801CA SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801CA_USB_2	0x2484		/* 82801CA USB Controller */
+#define	PCI_PRODUCT_INTEL_82801CA_AC	0x2485		/* 82801CA AC'97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801CA_MOD	0x2486		/* 82801CA AC'97 Modem Controller */
+#define	PCI_PRODUCT_INTEL_82801CA_USBC	0x2487		/* 82801CA USB Controller */
+#define	PCI_PRODUCT_INTEL_82801CA_IDE_1	0x248A		/* 82801CA IDE Controller */
+#define	PCI_PRODUCT_INTEL_82801CA_IDE_2	0x248B		/* 82801CA IDE Controller */
+#define	PCI_PRODUCT_INTEL_82801CAM_LPC	0x248C		/* 82801CAM LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801DB_LPC	0x24C0		/* 82801DB LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801DB_USB_1	0x24C2		/* 82801DB USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801DB_SMB	0x24C3		/* 82801DB SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801DB_USB_2	0x24C4		/* 82801DB USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801DB_AC	0x24C5		/* 82801DB AC97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801DB_MOD	0x24C6		/* 82801DB AC97 Modem Controller */
+#define	PCI_PRODUCT_INTEL_82801DB_USB_3	0x24C7		/* 82801DB USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801DBM_IDE	0x24CA		/* 82801DBM IDE Controller */
+#define	PCI_PRODUCT_INTEL_82801DB_IDE	0x24CB		/* 82801DB IDE Controller (UltraATA/100) */
+#define	PCI_PRODUCT_INTEL_82801DBM_LPC	0x24CC		/* 82801DB LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801DB_USBC	0x24CD		/* 82801DB USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801EB_LPC	0x24D0		/* 82801EB LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801EB_SATA	0x24D1		/* 82801EB Serial ATA Controller */
+#define	PCI_PRODUCT_INTEL_82801EB_USB_0	0x24D2		/* 82801EB/ER USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801EB_SMB	0x24D3		/* 82801EB/ER SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801EB_USB_1	0x24D4		/* 82801EB/ER USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801EB_AC	0x24D5		/* 82801EB/ER AC'97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801EB_MOD	0x24D6		/* 82801EB/ER AC'97 Modem Controller */
+#define	PCI_PRODUCT_INTEL_82801EB_USB_2	0x24D7		/* 82801EB/ER USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801EB_IDE	0x24DB		/* 82801EB/ER IDE Controller */
+#define	PCI_PRODUCT_INTEL_82801EB_EHCI	0x24DD		/* 82801EB/ER USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801EB_USB_3	0x24DE		/* 82801EB/ER USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801ER_SATA	0x24DF		/* 82801ER Serial ATA Controller */
+#define	PCI_PRODUCT_INTEL_82820_MCH	0x2501		/* 82820 MCH (Camino) */
+#define	PCI_PRODUCT_INTEL_82820_AGP	0x250f		/* 82820 AGP */
+#define	PCI_PRODUCT_INTEL_82850_HB	0x2530		/* 82850 Host */
+#define	PCI_PRODUCT_INTEL_82860_HB	0x2531		/* 82860 Host */
+#define	PCI_PRODUCT_INTEL_82850_AGP	0x2532		/* 82850/82860 AGP */
+#define	PCI_PRODUCT_INTEL_82860_PCI1	0x2533		/* 82860 PCI-PCI */
+#define	PCI_PRODUCT_INTEL_82860_PCI2	0x2534		/* 82860 PCI-PCI */
+#define	PCI_PRODUCT_INTEL_82860_PCI3	0x2535		/* 82860 PCI-PCI */
+#define	PCI_PRODUCT_INTEL_82860_PCI4	0x2536		/* 82860 PCI-PCI */
+#define	PCI_PRODUCT_INTEL_E7500_HB	0x2540		/* E7500 MCH Host */
+#define	PCI_PRODUCT_INTEL_E7500_DRAM	0x2541		/* E7500 MCH DRAM Controller */
+#define	PCI_PRODUCT_INTEL_E7500_HI_B1	0x2543		/* E7500 MCH HI_B vppb 1 */
+#define	PCI_PRODUCT_INTEL_E7500_HI_B2	0x2544		/* E7500 MCH HI_B vppb 2 */
+#define	PCI_PRODUCT_INTEL_E7500_HI_C1	0x2545		/* E7500 MCH HI_C vppb 1 */
+#define	PCI_PRODUCT_INTEL_E7500_HI_C2	0x2546		/* E7500 MCH HI_C vppb 2 */
+#define	PCI_PRODUCT_INTEL_E7500_HI_D1	0x2547		/* E7500 MCH HI_D vppb 1 */
+#define	PCI_PRODUCT_INTEL_E7500_HI_D2	0x2548		/* E7500 MCH HI_D vppb 2 */
+#define	PCI_PRODUCT_INTEL_E7501_HB	0x254c		/* E7501 MCH Host */
+#define	PCI_PRODUCT_INTEL_E7505_HB	0x2550		/* E7505 MCH Host */
+#define	PCI_PRODUCT_INTEL_E7505_RAS	0x2551		/* E7505 MCH RAS Controller */
+#define	PCI_PRODUCT_INTEL_E7505_AGP	0x2552		/* E7505 MCH Host-AGP Bridge */
+#define	PCI_PRODUCT_INTEL_E7505_HI_B1	0x2553		/* E7505 MCH HI_B PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_E7505_HI_B2	0x2554		/* E7505 MCH HI_B PCI-PCI Error Reporting */
+#define	PCI_PRODUCT_INTEL_82845G_DRAM	0x2560		/* 82845G/GL DRAM Controller / Host-Hub I/F Bridge */
+#define	PCI_PRODUCT_INTEL_82845G_AGP	0x2561		/* 82845G/GL Host-AGP Bridge */
+#define	PCI_PRODUCT_INTEL_82845G_IGD	0x2562		/* 82845G/GL Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82865_HB	0x2570		/* 82865 Host */
+#define	PCI_PRODUCT_INTEL_82865_AGP	0x2571		/* 82865 AGP */
+#define	PCI_PRODUCT_INTEL_82865_IGD	0x2572		/* 82865G Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82801EB_HPB	0x2573		/* 82801EB Hub-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_82875P_HB	0x2578		/* 82875P Host */
+#define	PCI_PRODUCT_INTEL_82875P_AGP	0x2579		/* 82875P AGP */
+#define	PCI_PRODUCT_INTEL_82875P_CSA	0x257b		/* 82875P PCI-CSA Bridge */
+#define	PCI_PRODUCT_INTEL_82915G_HB	0x2580		/* 82915P/G/GL Host */
+#define	PCI_PRODUCT_INTEL_82915G_EX	0x2581		/* 82915P/G/GL PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82915G_IGD	0x2582		/* 82915G/GL Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82925X_HB	0x2584		/* 82925X Host */
+#define	PCI_PRODUCT_INTEL_82925X_EX	0x2585		/* 82925X PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_E7221_HB	0x2588		/* E7221 Host Bridge */
+#define	PCI_PRODUCT_INTEL_E7221_IGD	0x258a		/* E7221 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82915GM_HB	0x2590		/* 82915PM/GM/GMS,82910GML Host Bridge */
+#define	PCI_PRODUCT_INTEL_82915GM_EX	0x2591		/* 82915PM/GM PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82915GM_IGD	0x2592		/* 82915GM/GMS,82910GML Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_6300ESB_LPC	0x25a1		/* 6300ESB LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_6300ESB_IDE	0x25a2		/* 6300ESB IDE Controller */
+#define	PCI_PRODUCT_INTEL_6300ESB_SATA	0x25a3		/* 6300ESB SATA Controller */
+#define	PCI_PRODUCT_INTEL_6300ESB_SMB	0x25a4		/* 6300ESB SMBus Controller */
+#define	PCI_PRODUCT_INTEL_6300ESB_ACA	0x25a6		/* 6300ESB AC'97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_6300ESB_ACM	0x25a7		/* 6300ESB AC'97 Modem Controller */
+#define	PCI_PRODUCT_INTEL_6300ESB_USB_0	0x25a9		/* 6300ESB USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_6300ESB_USB_1	0x25aa		/* 6300ESB USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_6300ESB_WDT	0x25ab		/* 6300ESB Watchdog Timer */
+#define	PCI_PRODUCT_INTEL_6300ESB_APIC	0x25ac		/* 6300ESB Advanced Interrupt Controller */
+#define	PCI_PRODUCT_INTEL_6300ESB_EHCI	0x25ad		/* 6300ESB USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_6300ESB_PCIX	0x25ae		/* 6300ESB PCI-X Bridge */
+#define	PCI_PRODUCT_INTEL_6300ESB_RAID	0x25b0		/* 6300ESB SATA RAID Controller */
+#define	PCI_PRODUCT_INTEL_5000X_MCH	0x25c0		/* 5000X Memory Controller Hub */
+#define	PCI_PRODUCT_INTEL_5000Z_HB	0x25d0		/* 5000Z ESI */
+#define	PCI_PRODUCT_INTEL_5000V_HB	0x25d4		/* 5000V ESI */
+#define	PCI_PRODUCT_INTEL_5000P_HB	0x25d8		/* 5000P ESI */
+#define	PCI_PRODUCT_INTEL_5000_PCIE_1	0x25e2		/* 5000 Series Chipset PCI Express x4 Port 2 */
+#define	PCI_PRODUCT_INTEL_5000_PCIE_2	0x25e3		/* 5000 Series Chipset PCI Express x4 Port 3 */
+#define	PCI_PRODUCT_INTEL_5000_PCIE_3	0x25e4		/* 5000 Series Chipset PCI Express x4 Port 4 */
+#define	PCI_PRODUCT_INTEL_5000_PCIE_4	0x25e5		/* 5000 Series Chipset PCI Express x4 Port 5 */
+#define	PCI_PRODUCT_INTEL_5000_PCIE_5	0x25e6		/* 5000 Series Chipset PCI Express x4 Port 6 */
+#define	PCI_PRODUCT_INTEL_5000_PCIE_6	0x25e7		/* 5000 Series Chipset PCI Express x4 Port 7 */
+#define	PCI_PRODUCT_INTEL_5000_FSB_REG	0x25f0		/* 5000 Series Chipset FSB Registers */
+#define	PCI_PRODUCT_INTEL_5000_RESERVED_1	0x25f1		/* 5000 Series Chipset Reserved Registers */
+#define	PCI_PRODUCT_INTEL_5000_RESERVED_2	0x25f3		/* 5000 Series Chipset Reserved Registers */
+#define	PCI_PRODUCT_INTEL_5000_FBD_1	0x25f5		/* 5000 Series Chipset FBD Registers */
+#define	PCI_PRODUCT_INTEL_5000_FBD_2	0x25f6		/* 5000 Series Chipset FBD Registers */
+#define	PCI_PRODUCT_INTEL_5000_PCIE_7	0x25f7		/* 5000 Series Chipset PCI Express x8 Port 2-3 */
+#define	PCI_PRODUCT_INTEL_5000_PCIE_8	0x25f8		/* 5000 Series Chipset PCI Express x8 Port 4-5 */
+#define	PCI_PRODUCT_INTEL_5000_PCIE_9	0x25f9		/* 5000 Series Chipset PCI Express x8 Port 6-7 */
+#define	PCI_PRODUCT_INTEL_5000X_PCIE	0x25fa		/* 5000X PCI Express x16 Port 4-7 */
+#define	PCI_PRODUCT_INTEL_82801FB_LPC	0x2640		/* 82801FB LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801FBM_LPC	0x2641		/* 82801FBM ICH6M LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801FB_SATA	0x2651		/* 82801FB Serial ATA Controller */
+#define	PCI_PRODUCT_INTEL_82801FR_SATA	0x2652		/* 82801FR Serial ATA Controller */
+#define	PCI_PRODUCT_INTEL_82801FBM_SATA	0x2653		/* 82801FBM Serial ATA Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_USB_0	0x2658		/* 82801FB/FR USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_USB_1	0x2659		/* 82801FB/FR USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_USB_2	0x265a		/* 82801FB/FR USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_USB_3	0x265b		/* 82801FB/FR USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_EHCI	0x265c		/* 82801FB/FR USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_EXP_0	0x2660		/* 82801FB/FR PCI Express Port #0 */
+#define	PCI_PRODUCT_INTEL_82801FB_EXP_1	0x2662		/* 82801FB/FR PCI Express Port #1 */
+#define	PCI_PRODUCT_INTEL_82801FB_EXP_2	0x2664		/* 82801FB/FR PCI Express Port #2 */
+#define	PCI_PRODUCT_INTEL_82801FB_HDA	0x2668		/* 82801FB/FR High Definition Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_SMB	0x266a		/* 82801FB/FR SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_LAN	0x266c		/* 82801FB LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_ACM	0x266d		/* 82801FB/FR AC'97 Modem Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_AC	0x266e		/* 82801FB/FR AC'97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801FB_IDE	0x266f		/* 82801FB/FR IDE Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_LPC	0x2670		/* 63xxESB LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_63XXESB_SATA	0x2680		/* 63xxESB Serial ATA Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_SATA_AHCI	0x2681		/* 63xxESB AHCI Serial ATA Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_USB_0	0x2688		/* 63xxESB USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_USB_1	0x2689		/* 63xxESB USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_USB_2	0x268a		/* 63xxESB USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_USB_3	0x268b		/* 63xxESB USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_EHCI	0x268c		/* 63xxESB USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_EXP_1	0x2690		/* 63xxESB PCI Express Port #1 */
+#define	PCI_PRODUCT_INTEL_63XXESB_EXP_2	0x2692		/* 63xxESB PCI Express Port #2 */
+#define	PCI_PRODUCT_INTEL_63XXESB_EXP_3	0x2694		/* 63xxESB PCI Express Port #3 */
+#define	PCI_PRODUCT_INTEL_63XXESB_EXP_4	0x2696		/* 63xxESB PCI Express Port #4 */
+#define	PCI_PRODUCT_INTEL_63XXESB_ACA	0x2698		/* 63xxESB AC'97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_HDA	0x269a		/* 63xxESB High Definition Audio Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_SMB	0x269b		/* 63xxESB SMBus Controller */
+#define	PCI_PRODUCT_INTEL_63XXESB_IDE	0x269e		/* 63xxESB IDE Controller */
+#define	PCI_PRODUCT_INTEL_82945P_MCH	0x2770		/* 82945G/P Memory Controller Hub */
+#define	PCI_PRODUCT_INTEL_82945P_EXP	0x2771		/* 82945G/P PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82945P_IGD	0x2772		/* 82945G/P Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82955X_HB	0x2774		/* 82955X Host */
+#define	PCI_PRODUCT_INTEL_82955X_EXP	0x2775		/* 82955X PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_E7230_HB	0x2778		/* E7230 Host */
+#define	PCI_PRODUCT_INTEL_E7230_EXP	0x2779		/* E7230 PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82975X_EXP_2	0x277a		/* 82975X PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82975X_HB	0x277c		/* 82975X Host */
+#define	PCI_PRODUCT_INTEL_82975X_EXP	0x277d		/* 82975X PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82915G_IGDC	0x2782		/* 82915G/GL IGD Companion */
+#define	PCI_PRODUCT_INTEL_82915GM_IGDC	0x2792		/* 82915GM/GMS IGD Companion */
+#define	PCI_PRODUCT_INTEL_82945GM_HB	0x27a0		/* 82945GM/PM/GMS Host Bridge */
+#define	PCI_PRODUCT_INTEL_82945GM_IGD	0x27a2		/* 82945GM/PM/GMS Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82945GM_IGD_1	0x27a6		/* 82945GM/PM/GMS Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82945GME_HB	0x27ac		/* 82945GME Host Bridge */
+#define	PCI_PRODUCT_INTEL_82945GME_IGD	0x27ae		/* 82945GME Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82801GH_LPC	0x27b0		/* 82801GH LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801G_LPC	0x27b8		/* 82801GB/GR LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801GBM_LPC	0x27b9		/* 82801GBM LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_NM10_LPC	0x27bc		/* NM10 Family LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801GHM_LPC	0x27bd		/* 82801GHM LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801G_SATA	0x27c0		/* 82801GB/GR SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801G_SATA_AHCI	0x27c1		/* 82801GB/GR AHCI SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801G_SATA_RAID	0x27c3		/* 82801GB/GR RAID SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801GBM_SATA	0x27c4		/* 82801GBM/GHM SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801GBM_AHCI	0x27c5		/* 82801GBM AHCI SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801GHM_RAID	0x27c6		/* 82801GHM SATA RAID Controller */
+#define	PCI_PRODUCT_INTEL_82801G_USB_1	0x27c8		/* 82801GB/GR USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801G_USB_2	0x27c9		/* 82801GB/GR USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801G_USB_3	0x27ca		/* 82801GB/GR USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801G_USB_4	0x27cb		/* 82801GB/GR USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801G_EHCI	0x27cc		/* 82801GB/GR USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801G_EXP_1	0x27d0		/* 82801GB/GR PCI Express Port #1 */
+#define	PCI_PRODUCT_INTEL_82801G_EXP_2	0x27d2		/* 82801GB/GR PCI Express Port #2 */
+#define	PCI_PRODUCT_INTEL_82801G_EXP_3	0x27d4		/* 82801GB/GR PCI Express Port #3 */
+#define	PCI_PRODUCT_INTEL_82801G_EXP_4	0x27d6		/* 82801GB/GR PCI Express Port #4 */
+#define	PCI_PRODUCT_INTEL_82801G_HDA	0x27d8		/* 82801GB/GR High Definition Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801G_SMB	0x27da		/* 82801GB/GR SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801G_LAN	0x27dc		/* 82801GB/GR LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801G_ACM	0x27dd		/* 82801GB/GR AC'97 Modem Controller */
+#define	PCI_PRODUCT_INTEL_82801G_ACA	0x27de		/* 82801GB/GR AC'97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801G_IDE	0x27df		/* 82801GB/GR IDE Controller */
+#define	PCI_PRODUCT_INTEL_82801G_EXP_5	0x27e0		/* 82801GB/GR PCI Express Port #5 */
+#define	PCI_PRODUCT_INTEL_82801G_EXP_6	0x27e2		/* 82801GB/GR PCI Express Port #6 */
+#define	PCI_PRODUCT_INTEL_82801H_LPC	0x2810		/* 82801H LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801HEM_LPC	0x2811		/* 82801HEM LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801HH_LPC	0x2812		/* 82801HH LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801HO_LPC	0x2814		/* 82801HO LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801HBM_LPC	0x2815		/* 82801HBM LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801H_SATA_1	0x2820		/* 82801H SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801H_SATA_AHCI6	0x2821		/* 82801H AHCI SATA Controller w/ 6 ports */
+#define	PCI_PRODUCT_INTEL_82801H_SATA_RAID	0x2822		/* 82801H RAID SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801H_SATA_AHCI4	0x2824		/* 82801H AHCI SATA Controller w/ 4 ports */
+#define	PCI_PRODUCT_INTEL_82801H_SATA_2	0x2825		/* 82801H SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801HEM_SATA	0x2828		/* 82801HEM SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801HBM_SATA_1	0x2829		/* 82801HBM SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801HBM_SATA_2	0x282a		/* 82081HBM SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801H_USB_1	0x2830		/* 82801H USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801H_USB_2	0x2831		/* 82801H USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801H_USB_3	0x2832		/* 82801H USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801H_USB_4	0x2834		/* 82801H USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801H_USB_5	0x2835		/* 82801H USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801H_EHCI_1	0x2836		/* 82801H USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801H_EHCI_2	0x283a		/* 82801H USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801H_SMB	0x283e		/* 82801H SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801H_EXP_1	0x283f		/* 82801H PCI Express Port #1 */
+#define	PCI_PRODUCT_INTEL_82801H_EXP_2	0x2841		/* 82801H PCI Express Port #2 */
+#define	PCI_PRODUCT_INTEL_82801H_EXP_3	0x2843		/* 82801H PCI Express Port #3 */
+#define	PCI_PRODUCT_INTEL_82801H_EXP_4	0x2845		/* 82801H PCI Express Port #4 */
+#define	PCI_PRODUCT_INTEL_82801H_EXP_5	0x2847		/* 82801H PCI Express Port #5 */
+#define	PCI_PRODUCT_INTEL_82801H_EXP_6	0x2849		/* 82801H PCI Express Port #6 */
+#define	PCI_PRODUCT_INTEL_82801H_HDA	0x284b		/* 82801H High Definition Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801H_THERMAL	0x284f		/* 82801H Thermal Controller */
+#define	PCI_PRODUCT_INTEL_82801HBM_IDE	0x2850		/* 82801H IDE Controller */
+#define	PCI_PRODUCT_INTEL_82801IH_LPC	0x2912		/* 82801IH LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801IO_LPC	0x2914		/* 82801IO LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801IR_LPC	0x2916		/* 82801IR LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801IEM_LPC	0x2917		/* 82801IEM LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801IB_LPC	0x2918		/* 82801IB LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801IM_LPC	0x2919		/* 82801IM LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801I_SATA_1	0x2920		/* 82801I SATA Controller w/ 4 ports */
+#define	PCI_PRODUCT_INTEL_82801I_SATA_2	0x2921		/* 82801I SATA Controller w/ 2 ports */
+#define	PCI_PRODUCT_INTEL_82801I_SATA_AHCI6	0x2922		/* 82801I AHCI SATA Controller w/ 6 ports */
+#define	PCI_PRODUCT_INTEL_82801I_SATA_AHCI4	0x2923		/* 82801I AHCI SATA Controller w/ 4 ports */
+#define	PCI_PRODUCT_INTEL_82801I_SATA_3	0x2926		/* 82801I SATA Controller w/ 2 ports */
+#define	PCI_PRODUCT_INTEL_82801I_SATA_4	0x2928		/* 82801I Mobile AHCI SATA Controller with 2 ports */
+#define	PCI_PRODUCT_INTEL_82801I_SATA_5	0x2929		/* 82801I Mobile AHCI SATA Controller with 4 ports */
+#define	PCI_PRODUCT_INTEL_82801I_SATA_6	0x292d		/* 82801I Mobile AHCI SATA Controller with 2 ports */
+#define	PCI_PRODUCT_INTEL_82801I_SATA_7	0x292e		/* 82801I Mobile AHCI SATA Controller */
+#define	PCI_PRODUCT_INTEL_82801I_SMB	0x2930		/* 82801I SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801I_THERMAL	0x2932		/* 82801I Thermal Controller */
+#define	PCI_PRODUCT_INTEL_82801I_USB_1	0x2934		/* 82801I USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801I_USB_2	0x2935		/* 82801I USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801I_USB_3	0x2936		/* 82801I USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801I_USB_4	0x2937		/* 82801I USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801I_USB_5	0x2938		/* 82801I USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801I_USB_6	0x2939		/* 82801I USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801I_EHCI_1	0x293a		/* 82801I USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801I_EHCI_2	0x293c		/* 82801I USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801I_HDA	0x293e		/* 82801I High Definition Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801I_EXP_1	0x2940		/* 82801I PCI Express Port #1 */
+#define	PCI_PRODUCT_INTEL_82801I_EXP_2	0x2942		/* 82801I PCI Express Port #2 */
+#define	PCI_PRODUCT_INTEL_82801I_EXP_3	0x2944		/* 82801I PCI Express Port #3 */
+#define	PCI_PRODUCT_INTEL_82801I_EXP_4	0x2946		/* 82801I PCI Express Port #4 */
+#define	PCI_PRODUCT_INTEL_82801I_EXP_5	0x2948		/* 82801I PCI Express Port #5 */
+#define	PCI_PRODUCT_INTEL_82801I_EXP_6	0x294a		/* 82801I PCI Express Port #6 */
+#define	PCI_PRODUCT_INTEL_82801I_IGP_C	0x294c		/* 82801I (C) LAN Controller */
+#define	PCI_PRODUCT_INTEL_82946GZ_HB	0x2970		/* 82946GZ Host Bridge */
+#define	PCI_PRODUCT_INTEL_82946GZ_IGD	0x2972		/* 82946GZ Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82946GZ_KT	0x2977		/* 82946GZ KT */
+#define	PCI_PRODUCT_INTEL_82G35_HB	0x2980		/* 82G35 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82G35_IGD	0x2982		/* 82G35 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82G35_IGD_1	0x2983		/* 82G35 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82965Q_HB	0x2990		/* 82965Q Host Bridge */
+#define	PCI_PRODUCT_INTEL_82965Q_EXP	0x2991		/* 82965Q PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82965Q_IGD	0x2992		/* 82965Q Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82965Q_IGD_1	0x2993		/* 82965Q Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82Q965_KT	0x2997		/* 82Q965 KT */
+#define	PCI_PRODUCT_INTEL_82965G_HB	0x29a0		/* 82965G Host Bridge */
+#define	PCI_PRODUCT_INTEL_82965G_EXP	0x29a1		/* 82965G PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82965G_IGD	0x29a2		/* 82965G Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82965G_IGD_1	0x29a3		/* 82965G Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82P965_KT	0x29a7		/* 82P965/G965 KT */
+#define	PCI_PRODUCT_INTEL_82Q35_HB	0x29b0		/* 82Q35 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82Q35_EXP	0x29b1		/* 82Q35 PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82Q35_IGD	0x29b2		/* 82Q35 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82Q35_IGD_1	0x29b3		/* 82Q35 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82Q35_KT	0x29b7		/* 82Q35 KT */
+#define	PCI_PRODUCT_INTEL_82G33_HB	0x29c0		/* 82G33/P35 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82G33_EXP	0x29c1		/* 82G33 PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82G33_IGD	0x29c2		/* 82G33 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82G33_IGD_1	0x29c3		/* 82G33 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82801I_LAN	0x29c4		/* 82801I LAN Controller */
+#define	PCI_PRODUCT_INTEL_82G33_KT	0x29c7		/* 82G33/G31/P35/P31 KT */
+#define	PCI_PRODUCT_INTEL_82Q33_HB	0x29d0		/* 82Q35 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82Q33_EXP	0x29d1		/* 82Q35 PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82Q33_IGD	0x29d2		/* 82Q35 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82Q33_IGD_1	0x29d3		/* 82Q35 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82Q33_KT	0x29d7		/* 82Q33 KT */
+#define	PCI_PRODUCT_INTEL_82X38_HB	0x29e0		/* 82X38 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82X38_PCIE_1	0x29e1		/* 82X38 Host-Primary PCIe Bridge */
+#define	PCI_PRODUCT_INTEL_82X38_HECI	0x29e4		/* 82X38 HECI */
+#define	PCI_PRODUCT_INTEL_82X38_KT	0x29e7		/* 82X38 KT */
+#define	PCI_PRODUCT_INTEL_82X38_PCIE_2	0x29e9		/* 82X38 Host-Secondary PCIe Bridge */
+#define	PCI_PRODUCT_INTEL_3200_HB	0x29f0		/* 3200/3210 Host */
+#define	PCI_PRODUCT_INTEL_3200_PCIE	0x29f1		/* 3200/3210 PCIE */
+#define	PCI_PRODUCT_INTEL_3200_KT	0x29f7		/* 3200 KT */
+#define	PCI_PRODUCT_INTEL_82965PM_HB	0x2a00		/* 82965PM Host Bridge */
+#define	PCI_PRODUCT_INTEL_80862A01	0x2a01		/* 80862A01 Mobile PCI Express Root Port */
+#define	PCI_PRODUCT_INTEL_82965PM_IGD	0x2a02		/* 82965PM Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82965PM_IGD_1	0x2a03		/* 82965PM Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82965PM_MEI	0x2a04		/* 82965PM MEI Controller */
+#define	PCI_PRODUCT_INTEL_82965PM_IDE	0x2a06		/* 82965PM IDE Interface */
+#define	PCI_PRODUCT_INTEL_82965PM_KT	0x2a07		/* 82965PM/GM KT */
+#define	PCI_PRODUCT_INTEL_82965GME_HB	0x2a10		/* 82965GME Host Bridge */
+#define	PCI_PRODUCT_INTEL_82965GME_IGD	0x2a12		/* 82965GME Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82965GME_KT	0x2a17		/* 82965GME KT */
+#define	PCI_PRODUCT_INTEL_82GM45_HB	0x2a40		/* 82GM45 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82GM45_IGD	0x2a42		/* 82GM45 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82GM45_IGD_1	0x2a43		/* 82GM45 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82GM45_KT	0x2a47		/* 82GM45 KT */
+#define	PCI_PRODUCT_INTEL_82IGD_E_HB	0x2e00		/* 82IGD_E Host Bridge */
+#define	PCI_PRODUCT_INTEL_82IGD_E_IGD	0x2e02		/* 82IGD_E Integrated Graphics */
+#define	PCI_PRODUCT_INTEL_82Q45_KT	0x2e07		/* 82Q45 KT */
+#define	PCI_PRODUCT_INTEL_82Q45_HB	0x2e10		/* 82Q45 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82Q45_EXP	0x2e11		/* 82Q45 PCI Express Bridge */
+#define	PCI_PRODUCT_INTEL_82Q45_IGD	0x2e12		/* 82Q45 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82Q45_IGD_1	0x2e13		/* 82Q45 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82Q45_KT_1	0x2e17		/* 82Q45 KT */
+#define	PCI_PRODUCT_INTEL_82G45_HB	0x2e20		/* 82G45 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82G45_IGD	0x2e22		/* 82G45 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82G41_HB	0x2e30		/* 82G41 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82G41_IGD	0x2e32		/* 82G41 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82B43_HB	0x2e40		/* 82B43 Host Bridge */
+#define	PCI_PRODUCT_INTEL_82B43_IGD	0x2e42		/* 82B43 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_XE5_V3_DMI2	0x2f00		/* Xeon E5 v3 DMI2 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCIE_1	0x2f01		/* Xeon E5 v3 PCIe Root Port in DMI2 Mode */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCIE_2_1	0x2f04		/* Xeon E5 v3 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCIE_2_2	0x2f05		/* Xeon E5 v3 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCIE_2_3	0x2f06		/* Xeon E5 v3 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCIE_2_4	0x2f07		/* Xeon E5 v3 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCIE_3_1	0x2f08		/* Xeon E5 v3 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCIE_3_2	0x2f09		/* Xeon E5 v3 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCIE_3_3	0x2f0a		/* Xeon E5 v3 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCIE_3_4	0x2f0b		/* Xeon E5 v3 PCIe Root Port */
+#define	PCI_PRODUCT_INTEL_XE5_V3_R2PCIE_1	0x2f1d		/* Xeon E5 v3 Integrated IO Ring Interface */
+#define	PCI_PRODUCT_INTEL_XE5_V3_UBOX_1	0x2f1e		/* Xeon E5 v3 Scratchpad and Semaphores */
+#define	PCI_PRODUCT_INTEL_XE5_V3_UBOX_3	0x2f1f		/* Xeon E5 v3 Scratchpad and Semaphores */
+#define	PCI_PRODUCT_INTEL_XE5_V3_QDT_CH0	0x2f20		/* Xeon E5 v3 QDT DMA Channel 0 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_QDT_CH1	0x2f21		/* Xeon E5 v3 QDT DMA Channel 1 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_QDT_CH2	0x2f22		/* Xeon E5 v3 QDT DMA Channel 2 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_QDT_CH3	0x2f23		/* Xeon E5 v3 QDT DMA Channel 3 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_QDT_CH4	0x2f24		/* Xeon E5 v3 QDT DMA Channel 4 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_QDT_CH5	0x2f25		/* Xeon E5 v3 QDT DMA Channel 5 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_QDT_CH6	0x2f26		/* Xeon E5 v3 QDT DMA Channel 6 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_QDT_CH7	0x2f27		/* Xeon E5 v3 QDT DMA Channel 7 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IIO_AM	0x2f28		/* Xeon E5 v3 Address Map, VTd, SMM */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IIO_RAM	0x2f2a		/* Xeon E5 v3 RAS, CS, Global Errors */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IIO_IOAPIC	0x2f2c		/* Xeon E5 v3 I/O APIC */
+#define	PCI_PRODUCT_INTEL_XE5_V3_R2PCIE_2	0x2f34		/* Xeon E5 v3 PCIe Ring Performance Monitoring */
+#define	PCI_PRODUCT_INTEL_XE5_V3_RQPI_PM_1	0x2f36		/* Xeon E5 v3 QPI Ring Performance Monitoring */
+#define	PCI_PRODUCT_INTEL_XE5_V3_RQPI_PM_2	0x2f37		/* Xeon E5 v3 QPI Ring Interface Monitoring */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_MAIN	0x2f68		/* Xeon E5 v3 IMC Main */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_TADR1	0x2f6a		/* Xeon E5 v3 IMC Ch 0-1 Target Address Decode Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_TADR2	0x2f6b		/* Xeon E5 v3 IMC Ch 0-1 Target Address Decode Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_RAS	0x2f71		/* Xeon E5 v3 IMC RAS Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_RAS	0x2f79		/* Xeon E5 v3 IMC Ras Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_UBOX_2	0x2f7d		/* Xeon E5 v3 Scratchpad and Semaphores */
+#define	PCI_PRODUCT_INTEL_XE5_V3_QPI_LINK0	0x2f80		/* Xeon E5 v3 QPI Link 0 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_RQPI_RING	0x2f81		/* Xeon E5 v3 QPI Ring Interface */
+#define	PCI_PRODUCT_INTEL_XE5_V3_QPI_LINK1	0x2f90		/* Xeon E5 v3 QPI Link 1 */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCU_1	0x2f98		/* Xeon E5 v3 Power Control Unit */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCU_2	0x2f99		/* Xeon E5 v3 Power Control Unit */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCU_3	0x2f9a		/* Xeon E5 v3 Power Control Unit */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCU_5	0x2f9c		/* Xeon E5 v3 Power Control Unit */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_MAIN	0x2fa8		/* Xeon E5 v3 IMC Main */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_TADR1	0x2faa		/* Xeon E5 v3 IMC Ch 0-1 Target Address Decode Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_TADR2	0x2fab		/* Xeon E5 v3 IMC Ch 0-1 Target Address Decode Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_TADR3	0x2fac		/* Xeon E5 v3 IMC Ch 2-3 Target Address Decode Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_TADR4	0x2fad		/* Xeon E5 v3 IMC Ch 2-3 Target Address Decode Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG1	0x2fb0		/* Xeon E5 v3 IMC Ch 0-1 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG2	0x2fb1		/* Xeon E5 v3 IMC Ch 0-1 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG3	0x2fb2		/* Xeon E5 v3 IMC Ch 2-3 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG4	0x2fb3		/* Xeon E5 v3 IMC Ch 2-3 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG5	0x2fb4		/* Xeon E5 v3 IMC Ch 0-1 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG6	0x2fb5		/* Xeon E5 v3 IMC Ch 0-1 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG7	0x2fb6		/* Xeon E5 v3 IMC Ch 2-3 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG8	0x2fb7		/* Xeon E5 v3 IMC Ch 2-3 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_1	0x2fba		/* Xeon E5 v3 IMC DDRIO Multicast */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_2	0x2fbb		/* Xeon E5 v3 IMC DDRIO Multicast */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_5	0x2fbc		/* Xeon E5 v3 IMC DDRIO */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_6	0x2fbd		/* Xeon E5 v3 IMC DDRIO */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_7	0x2fbe		/* Xeon E5 v3 IMC DDRIO Multicast */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_8	0x2fbf		/* Xeon E5 v3 IMC DDRIO Multicast */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_3	0x2fbe		/* Xeon E5 v3 IMC DDRIO Multicast */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_4	0x2fbf		/* Xeon E5 v3 IMC DDRIO Multicast */
+#define	PCI_PRODUCT_INTEL_XE5_V3_PCU_4	0x2fc0		/* Xeon E5 v3 Power Control Unit */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_REG5	0x2fd4		/* Xeon E5 v3 IMC Ch 0-1 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_REG6	0x2fd5		/* Xeon E5 v3 IMC Ch 0-1 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_REG7	0x2fd6		/* Xeon E5 v3 IMC Ch 0-1 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC1_REG8	0x2fd7		/* Xeon E5 v3 IMC Ch 0-1 Registers */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_9	0x2fd8		/* Xeon E5 v3 IMC DDRIO */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_A	0x2fd9		/* Xeon E5 v3 IMC DDRIO */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_B	0x2fda		/* Xeon E5 v3 IMC DDRIO */
+#define	PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_C	0x2fdb		/* Xeon E5 v3 IMC DDRIO */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_3165_1	0x3165		/* Dual Band Wireless AC 3165 */
+#define	PCI_PRODUCT_INTEL_31244	0x3200		/* 31244 Serial ATA Controller */
+#define	PCI_PRODUCT_INTEL_82855PM_DDR	0x3340		/* 82855PM MCH Host Controller */
+#define	PCI_PRODUCT_INTEL_82855PM_AGP	0x3341		/* 82855PM Host-AGP Bridge */
+#define	PCI_PRODUCT_INTEL_82855PM_PM	0x3342		/* 82855PM Power Management Controller */
+#define	PCI_PRODUCT_INTEL_3400_HB	0x3403		/* X58 DMI port */
+#define	PCI_PRODUCT_INTEL_5500_HB	0x3403		/* 5500 ESI Port */
+#define	PCI_PRODUCT_INTEL_82X58_HB	0x3405		/* X58 Host */
+#define	PCI_PRODUCT_INTEL_825520_HB	0x3406		/* 5520 ESI Port */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_1	0x3408		/* 5520/5500/X58 PCIE Root Port 1 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_2	0x3409		/* 5520/5500/X58 PCIE Root Port 2 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_3	0x340a		/* 5520/5500/X58 PCIE Root Port 3 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_4	0x340b		/* 5520/5500/X58 PCIE Root Port 4 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_5	0x340c		/* 5520/5500/X58 PCIE Root Port 5 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_6	0x340d		/* 5520/5500/X58 PCIE Root Port 6 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_7	0x340e		/* 5520/5500/X58 PCIE Root Port 7 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_8	0x340f		/* 5520/5500/X58 PCIE Root Port 8 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_9	0x3410		/* 5520/5500/X58 PCIE Root Port 9 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_10	0x3411		/* 5520/5500/X58 PCIE Root Port 10 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_0_0	0x3420		/* 5520/5500/X58 PCIE Root Port 0 */
+#define	PCI_PRODUCT_INTEL_82X58_PCIE_0_1	0x3420		/* 5520/5500/X58 PCIE Root Port 0 */
+#define	PCI_PRODUCT_INTEL_82X58_GPIO	0x3422		/* 5520/5500/X58 Scratchpads and GPIO */
+#define	PCI_PRODUCT_INTEL_82X58_RAS	0x3423		/* 5520/5500/X58 Control Status and RAS */
+#define	PCI_PRODUCT_INTEL_82X58_QP0_P0	0x3425		/* 5520/5500/X58 QuickPath Port 0 */
+#define	PCI_PRODUCT_INTEL_82X58_QP0_P1	0x3426		/* 5520/5500/X58 QuickPath Port 0 */
+#define	PCI_PRODUCT_INTEL_82X58_QP1_P0	0x3427		/* 5520/5500/X58 QuickPath Port 1 */
+#define	PCI_PRODUCT_INTEL_82X58_QP1_P1	0x3428		/* 5520/5500/X58 QuickPath Port 1 */
+#define	PCI_PRODUCT_INTEL_82X58_IOXAPIC	0x342d		/* 5520/5500/X58 IOxAPIC */
+#define	PCI_PRODUCT_INTEL_82X58_MISC	0x342e		/* 5520/5500/X58 Misc */
+#define	PCI_PRODUCT_INTEL_82X58_THROTTLE	0x3438		/* 5520/5500/X58 Throttling */
+#define	PCI_PRODUCT_INTEL_63XXESB_EXP_UP	0x3500		/* 63xxESB PCI Express Upstream Port */
+#define	PCI_PRODUCT_INTEL_63XXESB_PCIX	0x350c		/* 63xxESB PCI Express to PCI-X Bridge */
+#define	PCI_PRODUCT_INTEL_63XXESB_EXP_DN_1	0x3510		/* 63xxESB PCI Express Downstream Port #1 */
+#define	PCI_PRODUCT_INTEL_63XXESB_EXP_DN_2	0x3514		/* 63xxESB PCI Express Downstream Port #2 */
+#define	PCI_PRODUCT_INTEL_63XXESB_EXP_DN_3	0x3518		/* 63xxESB PCI Express Downstream Port #3 */
+#define	PCI_PRODUCT_INTEL_82830MP_IO_1	0x3575		/* 82830MP CPU to I/O Bridge 1 */
+#define	PCI_PRODUCT_INTEL_82830MP_AGP	0x3576		/* 82830MP CPU to AGP Bridge */
+#define	PCI_PRODUCT_INTEL_82830MP_IV	0x3577		/* 82830MP Integrated Video */
+#define	PCI_PRODUCT_INTEL_82830MP_IO_2	0x3578		/* 82830MP CPU to I/O Bridge 2 */
+#define	PCI_PRODUCT_INTEL_82855GM_MCH	0x3580		/* 82855GM Host-Hub Controller */
+#define	PCI_PRODUCT_INTEL_82855GM_AGP	0x3581		/* 82855GM Host-AGP Bridge */
+#define	PCI_PRODUCT_INTEL_82855GM_IGD	0x3582		/* 82855GM GMCH Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82855GM_MC	0x3584		/* 82855GM GMCH Memory Controller */
+#define	PCI_PRODUCT_INTEL_82855GM_CP	0x3585		/* 82855GM GMCH Configuration Process */
+#define	PCI_PRODUCT_INTEL_E7525_MCH	0x3590		/* E7525 Memory Controller Hub */
+#define	PCI_PRODUCT_INTEL_E7525_MCHER	0x3591		/* E7525 Error Reporting Device */
+#define	PCI_PRODUCT_INTEL_E7520_DMA	0x3594		/* E7520 DMA Controller */
+#define	PCI_PRODUCT_INTEL_E7525_PCIE_A	0x3595		/* E7525 PCI Express Port A */
+#define	PCI_PRODUCT_INTEL_E7525_PCIE_A1	0x3596		/* E7525 PCI Express Port A1 */
+#define	PCI_PRODUCT_INTEL_E7525_PCIE_B	0x3597		/* E7525 PCI Express Port B */
+#define	PCI_PRODUCT_INTEL_E7520_PCIE_B1	0x3598		/* E7520 PCI Express Port B1 */
+#define	PCI_PRODUCT_INTEL_E7520_PCIE_C	0x3599		/* E7520 PCI Express Port C */
+#define	PCI_PRODUCT_INTEL_E7520_PCIE_C1	0x359a		/* E7520 PCI Express Port C1 */
+#define	PCI_PRODUCT_INTEL_E7520_CFG	0x359b		/* E7520 Extended Configuration */
+#define	PCI_PRODUCT_INTEL_82801JD_SATA_IDE	0x3a00		/* 82801JD SATA Controller (IDE mode) */
+#define	PCI_PRODUCT_INTEL_82801JD_SATA_AHCI	0x3a02		/* 82801JD SATA Controller (AHCI mode) */
+#define	PCI_PRODUCT_INTEL_82801JD_SATA_RAID	0x3a02		/* 82801JD SATA Controller (RAID mode) */
+#define	PCI_PRODUCT_INTEL_82801JD_SATA_IDE2	0x3a06		/* 82801JD SATA Controller (IDE mode) */
+#define	PCI_PRODUCT_INTEL_82801JDO_LPC	0x3a14		/* 82801JDO LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801JIR_LPC	0x3a16		/* 82801JIR LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801JIB_LPC	0x3a18		/* 82801JIB LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801JD_LPC	0x3a1a		/* 82801JD LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_82801JI_SATA_IDE	0x3a20		/* 82801JI SATA Controller (IDE mode) */
+#define	PCI_PRODUCT_INTEL_82801JI_SATA_AHCI	0x3a22		/* 82801JI SATA Controller (AHCI mode) */
+#define	PCI_PRODUCT_INTEL_82801JI_SATA_RAID	0x3a25		/* 82801JI SATA Controller (RAID mode) */
+#define	PCI_PRODUCT_INTEL_82801JI_SATA_IDE2	0x3a26		/* 82801JI SATA Controller (IDE mode) */
+#define	PCI_PRODUCT_INTEL_82801JI_SMB	0x3a30		/* 82801JI SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_THERMAL	0x3a30		/* 82801JI Thermal Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_USB_1	0x3a34		/* 82801JI USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_USB_2	0x3a35		/* 82801JI USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_USB_3	0x3a36		/* 82801JI USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_USB_4	0x3a37		/* 82801JI USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_USB_5	0x3a38		/* 82801JI USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_USB_6	0x3a39		/* 82801JI USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_EHCI_1	0x3a3a		/* 82801JI USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_EHCI_2	0x3a3c		/* 82801JI USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_HDA	0x3a3e		/* 82801JI High Definition Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801JI_PCIE_1	0x3a40		/* 82801JI PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JI_PCIE_2	0x3a42		/* 82801JI PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JI_PCIE_3	0x3a44		/* 82801JI PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JI_PCIE_4	0x3a46		/* 82801JI PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JI_PCIE_5	0x3a48		/* 82801JI PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JI_PCIE_6	0x3a4a		/* 82801JI PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JI_LAN	0x3a4c		/* 82801JI LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_SMB	0x3a60		/* 82801JD SMBus Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_THERMAL	0x3a62		/* 82801JD Thermal Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_USB_1	0x3a64		/* 82801JD USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_USB_2	0x3a65		/* 82801JD USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_USB_3	0x3a66		/* 82801JD USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_USB_4	0x3a67		/* 82801JD USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_USB_5	0x3a68		/* 82801JD USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_USB_6	0x3a69		/* 82801JD USB UHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_EHCI_1	0x3a6a		/* 82801JD USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_EHCI_2	0x3a6c		/* 82801JD USB EHCI Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_HDA	0x3a6e		/* 82801JD High Definition Audio Controller */
+#define	PCI_PRODUCT_INTEL_82801JD_PCIE_1	0x3a70		/* 82801JD PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JD_PCIE_2	0x3a72		/* 82801JD PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JD_PCIE_3	0x3a74		/* 82801JD PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JD_PCIE_4	0x3a76		/* 82801JD PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JD_PCIE_5	0x3a78		/* 82801JD PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JD_PCIE_6	0x3a7a		/* 82801JD PCI Express Port */
+#define	PCI_PRODUCT_INTEL_82801JD_LAN	0x3a7c		/* 82801JD LAN Controller */
+#define	PCI_PRODUCT_INTEL_P55_LPC	0x3b02		/* P55 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_PM55_LPC	0x3b03		/* PM55 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_H55_LPC	0x3b06		/* H55 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_QM57_LPC	0x3b07		/* QM57 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_H57_LPC	0x3b08		/* H57 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_HM55_LPC	0x3b09		/* HM55 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_Q57_LPC	0x3b0a		/* Q57 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_HM57_LPC	0x3b0b		/* HM57 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_QS57_LPC	0x3b0f		/* QS57 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_3400_LPC	0x3b12		/* 3400 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_3420_LPC	0x3b14		/* 3420 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_3450_LPC	0x3b16		/* 3450 LPC Interface Bridge */
+#define	PCI_PRODUCT_INTEL_3400_SATA_1	0x3b20		/* 3400 SATA */
+#define	PCI_PRODUCT_INTEL_3400_SATA_2	0x3b21		/* 3400 SATA */
+#define	PCI_PRODUCT_INTEL_3400_AHCI_1	0x3b22		/* 3400 AHCI */
+#define	PCI_PRODUCT_INTEL_3400_AHCI_2	0x3b23		/* 3400 AHCI */
+#define	PCI_PRODUCT_INTEL_3400_RAID_1	0x3b25		/* 3400 RAID */
+#define	PCI_PRODUCT_INTEL_3400_SATA_3	0x3b26		/* 3400 SATA */
+#define	PCI_PRODUCT_INTEL_3400_SATA_4	0x3b28		/* 3400 SATA */
+#define	PCI_PRODUCT_INTEL_3400_AHCI_3	0x3b29		/* 3400 AHCI */
+#define	PCI_PRODUCT_INTEL_3400_RAID_2	0x3b2c		/* 3400 RAID */
+#define	PCI_PRODUCT_INTEL_3400_SATA_5	0x3b2d		/* 3400 SATA */
+#define	PCI_PRODUCT_INTEL_3400_SATA_6	0x3b2e		/* 3400 SATA */
+#define	PCI_PRODUCT_INTEL_3400_AHCI_4	0x3b2f		/* 3400 AHCI */
+#define	PCI_PRODUCT_INTEL_3400_SMB	0x3b30		/* 3400 SMBus */
+#define	PCI_PRODUCT_INTEL_3400_THERMAL	0x3b32		/* 3400 Thermal */
+#define	PCI_PRODUCT_INTEL_3400_EHCI_1	0x3b34		/* 3400 USB EHCI */
+#define	PCI_PRODUCT_INTEL_3400_UHCI_1	0x3b36		/* 3400 USB */
+#define	PCI_PRODUCT_INTEL_3400_UHCI_2	0x3b37		/* 3400 USB */
+#define	PCI_PRODUCT_INTEL_3400_UHCI_3	0x3b38		/* 3400 USB */
+#define	PCI_PRODUCT_INTEL_3400_UHCI_4	0x3b39		/* 3400 USB */
+#define	PCI_PRODUCT_INTEL_3400_UHCI_5	0x3b3a		/* 3400 USB */
+#define	PCI_PRODUCT_INTEL_3400_UHCI_6	0x3b3b		/* 3400 USB */
+#define	PCI_PRODUCT_INTEL_3400_EHCI_2	0x3b3c		/* 3400 USB ECHI */
+#define	PCI_PRODUCT_INTEL_3400_UHCI_7	0x3b3e		/* 3400 USB */
+#define	PCI_PRODUCT_INTEL_3400_UHCI_8	0x3b3f		/* 3400 USB */
+#define	PCI_PRODUCT_INTEL_3400_PCIE_1	0x3b42		/* 3400 PCIE */
+#define	PCI_PRODUCT_INTEL_3400_PCIE_2	0x3b44		/* 3400 PCIE */
+#define	PCI_PRODUCT_INTEL_3400_PCIE_3	0x3b46		/* 3400 PCIE */
+#define	PCI_PRODUCT_INTEL_3400_PCIE_4	0x3b48		/* 3400 PCIE */
+#define	PCI_PRODUCT_INTEL_3400_PCIE_5	0x3b4a		/* 3400 PCIE */
+#define	PCI_PRODUCT_INTEL_3400_PCIE_6	0x3b4c		/* 3400 PCIE */
+#define	PCI_PRODUCT_INTEL_3400_PCIE_7	0x3b4e		/* 3400 PCIE */
+#define	PCI_PRODUCT_INTEL_3400_PCIE_8	0x3b50		/* 3400 PCIE */
+#define	PCI_PRODUCT_INTEL_3400_HDA	0x3b56		/* 3400 HD Audio */
+#define	PCI_PRODUCT_INTEL_QS57_HDA	0x3b57		/* QS57 HD Audio */
+#define	PCI_PRODUCT_INTEL_3400_MEI_1	0x3b64		/* 3400 MEI */
+#define	PCI_PRODUCT_INTEL_3400_MEI_2	0x3b65		/* 3400 MEI */
+#define	PCI_PRODUCT_INTEL_3400_PT_IDER	0x3b66		/* 3400 PT IDER */
+#define	PCI_PRODUCT_INTEL_3400_KT	0x3b67		/* 3400 KT */
+#define	PCI_PRODUCT_INTEL_E5_HB	0x3c00		/* E5 Host */
+#define	PCI_PRODUCT_INTEL_E5_PCIE_1	0x3c02		/* E5 PCIE */
+#define	PCI_PRODUCT_INTEL_E5_PCIE_2	0x3c03		/* E5 PCIE */
+#define	PCI_PRODUCT_INTEL_E5_PCIE_3	0x3c04		/* E5 PCIE */
+#define	PCI_PRODUCT_INTEL_E5_PCIE_4	0x3c05		/* E5 PCIE */
+#define	PCI_PRODUCT_INTEL_E5_PCIE_5	0x3c06		/* E5 PCIE */
+#define	PCI_PRODUCT_INTEL_E5_PCIE_6	0x3c07		/* E5 PCIE */
+#define	PCI_PRODUCT_INTEL_E5_PCIE_7	0x3c08		/* E5 PCIE */
+#define	PCI_PRODUCT_INTEL_E5_PCIE_8	0x3c09		/* E5 PCIE */
+#define	PCI_PRODUCT_INTEL_E5_PCIE_9	0x3c0a		/* E5 PCIE */
+#define	PCI_PRODUCT_INTEL_E5_PCIE_10	0x3c0b		/* E5 PCIE */
+#define	PCI_PRODUCT_INTEL_E5_DMA_1	0x3c20		/* E5 DMA */
+#define	PCI_PRODUCT_INTEL_E5_DMA_2	0x3c21		/* E5 DMA */
+#define	PCI_PRODUCT_INTEL_E5_DMA_3	0x3c22		/* E5 DMA */
+#define	PCI_PRODUCT_INTEL_E5_DMA_4	0x3c23		/* E5 DMA */
+#define	PCI_PRODUCT_INTEL_E5_DMA_5	0x3c24		/* E5 DMA */
+#define	PCI_PRODUCT_INTEL_E5_DMA_6	0x3c25		/* E5 DMA */
+#define	PCI_PRODUCT_INTEL_E5_DMA_7	0x3c26		/* E5 DMA */
+#define	PCI_PRODUCT_INTEL_E5_DMA_8	0x3c27		/* E5 DMA */
+#define	PCI_PRODUCT_INTEL_E5_ADDRMAP	0x3c28		/* E5 Address Map */
+#define	PCI_PRODUCT_INTEL_E5_ERR	0x3c2a		/* E5 Error Reporting */
+#define	PCI_PRODUCT_INTEL_E5_IOAPIC	0x3c2c		/* E5 I/O APIC */
+#define	PCI_PRODUCT_INTEL_5400_HB	0x4000		/* 5400 Host */
+#define	PCI_PRODUCT_INTEL_5400A_HB	0x4001		/* 5400A Host */
+#define	PCI_PRODUCT_INTEL_5400B_HB	0x4003		/* 5400B Host */
+#define	PCI_PRODUCT_INTEL_5400_PCIE_1	0x4021		/* 5400 PCIE */
+#define	PCI_PRODUCT_INTEL_5400_PCIE_2	0x4022		/* 5400 PCIE */
+#define	PCI_PRODUCT_INTEL_5400_PCIE_3	0x4023		/* 5400 PCIE */
+#define	PCI_PRODUCT_INTEL_5400_PCIE_4	0x4024		/* 5400 PCIE */
+#define	PCI_PRODUCT_INTEL_5400_PCIE_5	0x4025		/* 5400 PCIE */
+#define	PCI_PRODUCT_INTEL_5400_PCIE_6	0x4026		/* 5400 PCIE */
+#define	PCI_PRODUCT_INTEL_5400_PCIE_7	0x4027		/* 5400 PCIE */
+#define	PCI_PRODUCT_INTEL_5400_PCIE_8	0x4028		/* 5400 PCIE */
+#define	PCI_PRODUCT_INTEL_5400_PCIE_9	0x4029		/* 5400 PCIE */
+#define	PCI_PRODUCT_INTEL_IOAT_SNB	0x402f		/* I/OAT SNB */
+#define	PCI_PRODUCT_INTEL_5400_FSBINT	0x4030		/* 5400 FSB/Boot/Interrupt */
+#define	PCI_PRODUCT_INTEL_5400_CE	0x4031		/* 5400 Coherency Engine */
+#define	PCI_PRODUCT_INTEL_5400_IOAPIC	0x4032		/* 5400 IOAPIC */
+#define	PCI_PRODUCT_INTEL_5400_RAS_0	0x4035		/* 5400 RAS */
+#define	PCI_PRODUCT_INTEL_5400_RAS_1	0x4036		/* 5400 RAS */
+#define	PCI_PRODUCT_INTEL_E600_VGA	0x4108		/* E600 Integrated VGA */
+#define	PCI_PRODUCT_INTEL_E600_HB	0x4114		/* E600 Host */
+#define	PCI_PRODUCT_INTEL_PRO_WL_2200BG	0x4220		/* PRO/Wireless LAN 2200BG Mini-PCI Adapter */
+#define	PCI_PRODUCT_INTEL_PRO_WL_2225BG	0x4221		/* PRO/Wireless LAN 2225BG Mini-PCI Adapter */
+#define	PCI_PRODUCT_INTEL_PRO_WL_3945ABG_1	0x4222		/* PRO/Wireless LAN 3945ABG Mini-PCI Adapter */
+#define	PCI_PRODUCT_INTEL_PRO_WL_2915ABG_1	0x4223		/* PRO/Wireless LAN 2915ABG Mini-PCI Adapter */
+#define	PCI_PRODUCT_INTEL_PRO_WL_2915ABG_2	0x4224		/* PRO/Wireless LAN 2915ABG Mini-PCI Adapter */
+#define	PCI_PRODUCT_INTEL_PRO_WL_3945ABG_2	0x4227		/* PRO/Wireless LAN 3945ABG Mini-PCI Adapter */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_4965_1	0x4229		/* Wireless WiFi Link 4965 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6000_3X3_1	0x422b		/* Centrino Ultimate-N 6300 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6000_IPA_1	0x422c		/* Centrino Advanced-N 6200 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_4965_3	0x422d		/* Wireless WiFi Link 4965 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_4965_2	0x4230		/* Wireless WiFi Link 4965 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_5100_1	0x4232		/* WiFi Link 5100 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_4965_4	0x4233		/* Wireless WiFi Link 4965 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_5300_1	0x4235		/* WiFi Link 5300 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_5300_2	0x4236		/* WiFi Link 5300 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_5100_2	0x4237		/* WiFi Link 5100 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6000_3X3_2	0x4238		/* Centrino Ultimate-N 6300 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_6000_IPA_2	0x4239		/* Centrino Advanced-N 6200 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_5350_1	0x423a		/* WiFi Link 5350 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_5350_2	0x423b		/* WiFi Link 5350 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_5150_1	0x423c		/* WiFi Link 5150 */
+#define	PCI_PRODUCT_INTEL_WIFI_LINK_5150_2	0x423d		/* WiFi Link 5150 */
+#define	PCI_PRODUCT_INTEL_EP80579_HB	0x5020		/* EP80579 Host */
+#define	PCI_PRODUCT_INTEL_EP80579_MEM	0x5021		/* EP80579 Memory */
+#define	PCI_PRODUCT_INTEL_EP80579_EDMA	0x5023		/* EP80579 EDMA */
+#define	PCI_PRODUCT_INTEL_EP80579_PCIE_1	0x5024		/* EP80579 PCIE */
+#define	PCI_PRODUCT_INTEL_EP80579_PCIE_2	0x5025		/* EP80579 PCIE */
+#define	PCI_PRODUCT_INTEL_EP80579_SATA	0x5028		/* EP80579 SATA */
+#define	PCI_PRODUCT_INTEL_EP80579_AHCI	0x5029		/* EP80579 AHCI */
+#define	PCI_PRODUCT_INTEL_EP80579_ASU	0x502c		/* EP80579 ASU */
+#define	PCI_PRODUCT_INTEL_EP80579_RESERVED1	0x5030		/* EP80579 Reserved */
+#define	PCI_PRODUCT_INTEL_EP80579_LPC	0x5031		/* EP80579 LPC */
+#define	PCI_PRODUCT_INTEL_EP80579_SMB	0x5032		/* EP80579 SMBus */
+#define	PCI_PRODUCT_INTEL_EP80579_UHCI	0x5033		/* EP80579 USB */
+#define	PCI_PRODUCT_INTEL_EP80579_EHCI	0x5035		/* EP80579 USB */
+#define	PCI_PRODUCT_INTEL_EP80579_PPB	0x5037		/* EP80579 PCI-PCI bridge */
+#define	PCI_PRODUCT_INTEL_EP80579_CAN_1	0x5039		/* EP80579 CANbus */
+#define	PCI_PRODUCT_INTEL_EP80579_CAN_2	0x503a		/* EP80579 CANbus */
+#define	PCI_PRODUCT_INTEL_EP80579_SERIAL	0x503b		/* EP80579 Serial */
+#define	PCI_PRODUCT_INTEL_EP80579_1588	0x503c		/* EP80579 1588 */
+#define	PCI_PRODUCT_INTEL_EP80579_LEB	0x503d		/* EP80579 LEB */
+#define	PCI_PRODUCT_INTEL_EP80579_GCU	0x503e		/* EP80579 GCU */
+#define	PCI_PRODUCT_INTEL_EP80579_RESERVED2	0x503f		/* EP80579 Reserved */
+#define	PCI_PRODUCT_INTEL_EP80579_LAN_1	0x5040		/* EP80579 LAN */
+#define	PCI_PRODUCT_INTEL_EP80579_LAN_2	0x5044		/* EP80579 LAN */
+#define	PCI_PRODUCT_INTEL_EP80579_LAN_3	0x5048		/* EP80579 LAN */
+#define	PCI_PRODUCT_INTEL_80312_ATU	0x530d		/* 80310 ATU */
+#define	PCI_PRODUCT_INTEL_82371SB_ISA	0x7000		/* 82371SB (PIIX3) PCI-ISA Bridge */
+#define	PCI_PRODUCT_INTEL_82371SB_IDE	0x7010		/* 82371SB (PIIX3) IDE Interface */
+#define	PCI_PRODUCT_INTEL_82371SB_USB	0x7020		/* 82371SB (PIIX3) USB Host Controller */
+#define	PCI_PRODUCT_INTEL_82437VX	0x7030		/* 82437VX (TVX) System Controller */
+#define	PCI_PRODUCT_INTEL_82439TX	0x7100		/* 82439TX (MTXC) System Controller */
+#define	PCI_PRODUCT_INTEL_82371AB_ISA	0x7110		/* 82371AB (PIIX4) PCI-ISA Bridge */
+#define	PCI_PRODUCT_INTEL_82371AB_IDE	0x7111		/* 82371AB (PIIX4) IDE Controller */
+#define	PCI_PRODUCT_INTEL_82371AB_USB	0x7112		/* 82371AB (PIIX4) USB Host Controller */
+#define	PCI_PRODUCT_INTEL_82371AB_PMC	0x7113		/* 82371AB (PIIX4) Power Management Controller */
+#define	PCI_PRODUCT_INTEL_82810_MCH	0x7120		/* 82810 Memory Controller Hub */
+#define	PCI_PRODUCT_INTEL_82810_GC	0x7121		/* 82810 Graphics Controller */
+#define	PCI_PRODUCT_INTEL_82810_DC100_MCH	0x7122		/* 82810-DC100 Memory Controller Hub */
+#define	PCI_PRODUCT_INTEL_82810_DC100_GC	0x7123		/* 82810-DC100 Graphics Controller */
+#define	PCI_PRODUCT_INTEL_82810E_MCH	0x7124		/* 82810E Memory Controller Hub */
+#define	PCI_PRODUCT_INTEL_82810E_GC	0x7125		/* 82810E Graphics Controller */
+#define	PCI_PRODUCT_INTEL_82443LX	0x7180		/* 82443LX PCI AGP Controller */
+#define	PCI_PRODUCT_INTEL_82443LX_AGP	0x7181		/* 82443LX AGP Interface */
+#define	PCI_PRODUCT_INTEL_82443BX	0x7190		/* 82443BX Host Bridge/Controller */
+#define	PCI_PRODUCT_INTEL_82443BX_AGP	0x7191		/* 82443BX AGP Interface */
+#define	PCI_PRODUCT_INTEL_82443BX_NOAGP	0x7192		/* 82443BX Host Bridge/Controller (AGP disabled) */
+#define	PCI_PRODUCT_INTEL_82440MX	0x7194		/* 82443MX Host Bridge/Controller */
+#define	PCI_PRODUCT_INTEL_82440MX_ACA	0x7195		/* 82443MX AC-97 Audio Controller */
+#define	PCI_PRODUCT_INTEL_82440MX_ISA	0x7198		/* 82443MX PCI-ISA Bridge */
+#define	PCI_PRODUCT_INTEL_82440MX_IDE	0x7199		/* 82443MX IDE Controller */
+#define	PCI_PRODUCT_INTEL_82440MX_USB	0x719a		/* 82443MX USB Host Controller */
+#define	PCI_PRODUCT_INTEL_82440MX_PMC	0x719b		/* 82443MX Power Management Controller */
+#define	PCI_PRODUCT_INTEL_82443GX	0x71a0		/* 82443GX Host Bridge/Controller */
+#define	PCI_PRODUCT_INTEL_82443GX_AGP	0x71a1		/* 82443GX AGP Interface */
+#define	PCI_PRODUCT_INTEL_82443GX_NOAGP	0x71a2		/* 82443GX Host Bridge/Controller (AGP disabled) */
+#define	PCI_PRODUCT_INTEL_I740	0x7800		/* i740 Graphics Accelerator */
+#define	PCI_PRODUCT_INTEL_SCH_IDE	0x811a		/* SCH IDE Controller */
+#define	PCI_PRODUCT_INTEL_E600_HDA	0x811b		/* E600 HD Audio */
+#define	PCI_PRODUCT_INTEL_E600_PCIB_0	0x8180		/* E600 Virtual PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_E600_PCIB_1	0x8181		/* E600 Virtual PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_E600_GVD	0x8182		/* E600 Integrated Graphic Video Display */
+#define	PCI_PRODUCT_INTEL_E600_PCIB_2	0x8184		/* E600 Virtual PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_E600_PCIB_3	0x8185		/* E600 Virtual PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_E600_LPC	0x8186		/* Atom Processor E6xx LPC Bridge */
+#define	PCI_PRODUCT_INTEL_PCI450_PB	0x84c4		/* 82454KX/GX PCI Bridge (PB) */
+#define	PCI_PRODUCT_INTEL_PCI450_MC	0x84c5		/* 82451KX/GX Memory Controller (MC) */
+#define	PCI_PRODUCT_INTEL_82451NX_MIOC	0x84ca		/* 82451NX Memory & I/O Controller (MIOC) */
+#define	PCI_PRODUCT_INTEL_82451NX_PXB	0x84cb		/* 82451NX PCI Expander Bridge (PXB) */
+
+#define	PCI_PRODUCT_INTEL_EG20T_PCIB	0x8800		/* EG20T PCH PCIExpress Bridge */
+#define	PCI_PRODUCT_INTEL_EG20T_PCTHUB	0x8801		/* EG20T PCH Packet Hub */
+#define	PCI_PRODUCT_INTEL_EG20T_GBE	0x8802		/* EG20T PCH Gigabit Ether */
+#define	PCI_PRODUCT_INTEL_EG20T_GPIO	0x8803		/* EG20T PCH GPIO */
+#define	PCI_PRODUCT_INTEL_EG20T_OHCI1_0	0x8804		/* EG20T PCH USB OHCI Host Controller #1 */
+#define	PCI_PRODUCT_INTEL_EG20T_OHCI1_1	0x8805		/* EG20T PCH USB OHCI Host Controller #1 */
+#define	PCI_PRODUCT_INTEL_EG20T_OHCI1_2	0x8806		/* EG20T PCH USB OHCI Host Controller #1 */
+#define	PCI_PRODUCT_INTEL_EG20T_EHCI1	0x8807		/* EG20T PCH USB EHCI Host Controller #1 */
+#define	PCI_PRODUCT_INTEL_EG20T_USB_DEV	0x8808		/* EG20T PCH USB Device */
+#define	PCI_PRODUCT_INTEL_EG20T_SDIO_0	0x8809		/* EG20T PCH SDIO Controller #0 */
+#define	PCI_PRODUCT_INTEL_EG20T_SDIO_1	0x880a		/* EG20T PCH SDIO Controller #1 */
+#define	PCI_PRODUCT_INTEL_EG20T_AHCI	0x880b		/* EG20T PCH AHCI SATA Controller */
+#define	PCI_PRODUCT_INTEL_EG20T_OHCI0_0	0x880c		/* EG20T PCH USB OHCI Host Controller #0 */
+#define	PCI_PRODUCT_INTEL_EG20T_OHCI0_1	0x880d		/* EG20T PCH USB OHCI Host Controller #0 */
+#define	PCI_PRODUCT_INTEL_EG20T_OHCI0_2	0x880e		/* EG20T PCH USB OHCI Host Controller #0 */
+#define	PCI_PRODUCT_INTEL_EG20T_EHCI0	0x880f		/* EG20T PCH USB EHCI Host Controller #0 */
+#define	PCI_PRODUCT_INTEL_EG20T_DMA_0	0x8810		/* EG20T PCH DMAC #0 */
+#define	PCI_PRODUCT_INTEL_EG20T_UART_0	0x8811		/* EG20T PCH UART #0 */
+#define	PCI_PRODUCT_INTEL_EG20T_UART_1	0x8812		/* EG20T PCH UART #1 */
+#define	PCI_PRODUCT_INTEL_EG20T_UART_2	0x8813		/* EG20T PCH UART #2 */
+#define	PCI_PRODUCT_INTEL_EG20T_UART_3	0x8814		/* EG20T PCH UART #3 */
+#define	PCI_PRODUCT_INTEL_EG20T_DMA_1	0x8815		/* EG20T PCH DMAC #1 */
+#define	PCI_PRODUCT_INTEL_EG20T_SPI	0x8816		/* EG20T PCH SPI */
+#define	PCI_PRODUCT_INTEL_EG20T_I2C	0x8817		/* EG20T PCH I2C Interface */
+#define	PCI_PRODUCT_INTEL_EG20T_CAN	0x8818		/* EG20T PCH CAN Controller */
+#define	PCI_PRODUCT_INTEL_EG20T_IEEE1588	0x8819		/* EG20T PCH IEEE1588 */
+#define	PCI_PRODUCT_INTEL_8SER_DT_SATA	0x8c00		/* 8 Series (desktop) SATA Controller */
+#define	PCI_PRODUCT_INTEL_8SER_MO_SATA	0x8c01		/* 8 Series (mobile) SATA Controller */
+#define	PCI_PRODUCT_INTEL_8SER_DT_SATA_AHCI	0x8c02		/* 8 Series (desktop) SATA Controller (AHCI) */
+#define	PCI_PRODUCT_INTEL_8SER_MO_SATA_AHCI	0x8c03		/* 8 Series (mobile) SATA Controller (AHCI) */
+#define	PCI_PRODUCT_INTEL_8SER_DT_SATA_RAID	0x8c04		/* 8 Series (desktop) SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_8SER_MO_SATA_RAID	0x8c05		/* 8 Series (mobile) SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_8SER_DT_SATA_RAID_SR	0x8c06		/* 8 Series (desktop) SATA Controller (RAID) + Smart Response */
+#define	PCI_PRODUCT_INTEL_8SER_MO_SATA_RAID_SR	0x8c07		/* 8 Series (mobile) SATA Controller (RAID) + Smart Response */
+#define	PCI_PRODUCT_INTEL_8SER_DT_SATA_2	0x8c08		/* 8 Series (desktop) SATA Controller */
+#define	PCI_PRODUCT_INTEL_8SER_MO_SATA_2	0x8c09		/* 8 Series (mobile) SATA Controller */
+#define	PCI_PRODUCT_INTEL_8SER_DT_SATA_RAID1	0x8c0e		/* 8 Series (desktop) SATA Controller (RAID1) */
+#define	PCI_PRODUCT_INTEL_8SER_MO_SATA_RAID1	0x8c0f		/* 8 Series (mobile) SATA Controller (RAID1) */
+#define	PCI_PRODUCT_INTEL_8SERIES_PCIE_1	0x8c10		/* 8 Series PCIE */
+#define	PCI_PRODUCT_INTEL_8SERIES_PCIE_2	0x8c12		/* 8 Series PCIE */
+#define	PCI_PRODUCT_INTEL_8SERIES_PCIE_3	0x8c14		/* 8 Series PCIE */
+#define	PCI_PRODUCT_INTEL_8SERIES_PCIE_4	0x8c16		/* 8 Series PCIE */
+#define	PCI_PRODUCT_INTEL_8SERIES_PCIE_5	0x8c18		/* 8 Series PCIE */
+#define	PCI_PRODUCT_INTEL_8SERIES_PCIE_6	0x8c1a		/* 8 Series PCIE */
+#define	PCI_PRODUCT_INTEL_8SERIES_PCIE_7	0x8c1c		/* 8 Series PCIE */
+#define	PCI_PRODUCT_INTEL_8SERIES_PCIE_8	0x8c1e		/* 8 Series PCIE */
+#define	PCI_PRODUCT_INTEL_8SERIES_HDA	0x8c20		/* 8 Series HD Audio */
+#define	PCI_PRODUCT_INTEL_8SERIES_SMB	0x8c22		/* 8 Series SMBus Controller */
+#define	PCI_PRODUCT_INTEL_8SERIES_THERM	0x8c24		/* 8 Series Thermal */
+#define	PCI_PRODUCT_INTEL_8SERIES_EHCI_1	0x8c26		/* 8 Series USB EHCI */
+#define	PCI_PRODUCT_INTEL_8SERIES_EHCI_2	0x8c2d		/* 8 Series USB EHCI */
+#define	PCI_PRODUCT_INTEL_8SERIES_XHCI	0x8c31		/* 8 Series USB xHCI */
+#define	PCI_PRODUCT_INTEL_8SERIES_LAN	0x8c33		/* 8 Series LAN */
+#define	PCI_PRODUCT_INTEL_8SERIES_MEI_1	0x8c3a		/* 8 Series MEI Controller */
+#define	PCI_PRODUCT_INTEL_8SERIES_MEI_2	0x8c3b		/* 8 Series MEI Controller */
+#define	PCI_PRODUCT_INTEL_8SERIES_IDE_R	0x8c3c		/* 8 Series IDE-R */
+#define	PCI_PRODUCT_INTEL_8SERIES_KT	0x8c3d		/* 8 Series KT */
+#define	PCI_PRODUCT_INTEL_8SERIES_M_LPC	0x8c41		/* 8 Series Mobile Full Featured ES LPC */
+#define	PCI_PRODUCT_INTEL_8SERIES_D_LPC	0x8c42		/* 8 Series Desktop Full Featured ES LPC */
+#define	PCI_PRODUCT_INTEL_Z87_LPC	0x8c44		/* Z87 LPC */
+#define	PCI_PRODUCT_INTEL_Z85_LPC	0x8c46		/* Z85 LPC */
+#define	PCI_PRODUCT_INTEL_HM86_LPC	0x8c49		/* HM86 LPC */
+#define	PCI_PRODUCT_INTEL_H87_LPC	0x8c4a		/* H87 LPC */
+#define	PCI_PRODUCT_INTEL_HM87_LPC	0x8c4b		/* HM87 LPC */
+#define	PCI_PRODUCT_INTEL_Q85_LPC	0x8c4c		/* Q85 LPC */
+#define	PCI_PRODUCT_INTEL_Q87_LPC	0x8c4e		/* Q87 LPC */
+#define	PCI_PRODUCT_INTEL_QM87_LPC	0x8c4f		/* QM87 LPC */
+#define	PCI_PRODUCT_INTEL_B85_LPC	0x8c50		/* B85 LPC */
+#define	PCI_PRODUCT_INTEL_C222_LPC	0x8c52		/* C222 LPC */
+#define	PCI_PRODUCT_INTEL_C224_LPC	0x8c54		/* C224 LPC */
+#define	PCI_PRODUCT_INTEL_C226_LPC	0x8c56		/* C226 LPC */
+#define	PCI_PRODUCT_INTEL_H81_LPC	0x8c5c		/* H81 LPC */
+#define	PCI_PRODUCT_INTEL_9SERIES_SATA	0x8c80		/* 9 Series SATA Controller */
+#define	PCI_PRODUCT_INTEL_9SERIES_SATA_AHCI	0x8c82		/* 9 Series SATA Controller (AHCI) */
+#define	PCI_PRODUCT_INTEL_9SERIES_SATA_RAID	0x8c84		/* 9 Series SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_9SERIES_SATA_RAID_SR	0x8c86		/* 9 Series SATA Controller (RAID) + Smart Response */
+#define	PCI_PRODUCT_INTEL_9SERIES_SATA_2	0x8c88		/* 9 Series SATA Controller */
+#define	PCI_PRODUCT_INTEL_9SERIES_SATA_RAID1	0x8c8e		/* 9 Series SATA Controller (RAID1) */
+#define	PCI_PRODUCT_INTEL_9SERIES_PCIE_1	0x8c90		/* 9 Series PCIE */
+#define	PCI_PRODUCT_INTEL_9SERIES_PCIE_2	0x8c92		/* 9 Series PCIE */
+#define	PCI_PRODUCT_INTEL_9SERIES_PCIE_3	0x8c94		/* 9 Series PCIE */
+#define	PCI_PRODUCT_INTEL_9SERIES_PCIE_4	0x8c96		/* 9 Series PCIE */
+#define	PCI_PRODUCT_INTEL_9SERIES_PCIE_5	0x8c98		/* 9 Series PCIE */
+#define	PCI_PRODUCT_INTEL_9SERIES_PCIE_6	0x8c9a		/* 9 Series PCIE */
+#define	PCI_PRODUCT_INTEL_9SERIES_PCIE_7	0x8c9c		/* 9 Series PCIE */
+#define	PCI_PRODUCT_INTEL_9SERIES_PCIE_8	0x8c9e		/* 9 Series PCIE */
+#define	PCI_PRODUCT_INTEL_9SERIES_HDA	0x8ca0		/* 9 Series HD Audio */
+#define	PCI_PRODUCT_INTEL_9SERIES_SMB	0x8ca2		/* 9 Series SMBus Controller */
+#define	PCI_PRODUCT_INTEL_9SERIES_THERM	0x8ca4		/* 9 Series Thermal */
+#define	PCI_PRODUCT_INTEL_9SERIES_EHCI_1	0x8ca6		/* 9 Series USB EHCI */
+#define	PCI_PRODUCT_INTEL_9SERIES_EHCI_2	0x8cad		/* 9 Series USB EHCI */
+#define	PCI_PRODUCT_INTEL_9SERIES_XHCI	0x8cb1		/* 9 Series USB xHCI */
+#define	PCI_PRODUCT_INTEL_9SERIES_LAN	0x8cb3		/* 9 Series LAN */
+#define	PCI_PRODUCT_INTEL_9SERIES_MEI_1	0x8cba		/* 9 Series MEI Controller */
+#define	PCI_PRODUCT_INTEL_9SERIES_MEI_2	0x8cbb		/* 9 Series MEI Controller */
+#define	PCI_PRODUCT_INTEL_9SERIES_IDE_R	0x8cbc		/* 9 Series IDE-R */
+#define	PCI_PRODUCT_INTEL_9SERIES_KT	0x8cbd		/* 9 Series KT */
+#define	PCI_PRODUCT_INTEL_9SERIES_LPC_ES	0x8cc2		/* 9 Series Full Featured ES LPC */
+#define	PCI_PRODUCT_INTEL_Z97_LPC	0x8cc4		/* Z97 LPC */
+#define	PCI_PRODUCT_INTEL_H97_LPC	0x8cc6		/* H97 LPC */
+#define	PCI_PRODUCT_INTEL_C610_SATA	0x8d00		/* C61x/X99 SATA Controller */
+#define	PCI_PRODUCT_INTEL_C610_SATA_AHCI	0x8d02		/* C61x/X99 SATA Controller (AHCI) */
+#define	PCI_PRODUCT_INTEL_C610_SATA_RAID	0x2822		/* C61x/X99 SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_C610_SATA_RAID_2	0x8d06		/* C61x/X99 SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_C610_SATA_RAID_3	0x2826		/* C61x/X99 SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_C610_SATA_2	0x8d08		/* C61x/X99 SATA Controller */
+#define	PCI_PRODUCT_INTEL_C610_SSATA	0x8d60		/* C61x/X99 sSATA Controller */
+#define	PCI_PRODUCT_INTEL_C610_SSATA_AHCI	0x8d62		/* C61x/X99 sSATA Controller (AHCI) */
+#define	PCI_PRODUCT_INTEL_C610_SSATA_RAID	0x8d66		/* C61x/X99 sSATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_C610_SSATA_RAID_2	0x2827		/* C61x/X99 sSATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_1_1	0x8d10		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_1_2	0x8d11		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_1_3	0x244e		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_2_1	0x8d12		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_2_2	0x8d13		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_3_1	0x8d14		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_3_2	0x8d15		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_4_1	0x8d16		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_4_2	0x8d17		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_5_1	0x8d18		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_5_2	0x8d19		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_6_1	0x8d1a		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_6_2	0x8d1b		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_7_1	0x8d1c		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_7_2	0x8d1d		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_8_1	0x8d1e		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_PCIE_8_2	0x8d1f		/* C61x/X99 PCIE */
+#define	PCI_PRODUCT_INTEL_C610_HDA	0x8d20		/* C61x/X99 HD Audio */
+#define	PCI_PRODUCT_INTEL_C610_HDA_2	0x8d21		/* C61x/X99 HD Audio */
+#define	PCI_PRODUCT_INTEL_C610_SMB	0x8d22		/* C61x/X99 SMBus Controller */
+#define	PCI_PRODUCT_INTEL_C610_THERM	0x8d24		/* C61x/X99 Thermal */
+#define	PCI_PRODUCT_INTEL_C610_EHCI	0x8d26		/* C61x/X99 USB EHCI */
+#define	PCI_PRODUCT_INTEL_C610_EHCI_2	0x8d2d		/* C61x/X99 USB EHCI */
+#define	PCI_PRODUCT_INTEL_C610_XHCI	0x8d31		/* C61x/X99 USB xHCI */
+#define	PCI_PRODUCT_INTEL_C610_LAN	0x8d33		/* C61x/X99 LAN */
+#define	PCI_PRODUCT_INTEL_C610_MEI	0x8d3a		/* C61x/X99 MEI Controller */
+#define	PCI_PRODUCT_INTEL_C610_MEI_2	0x8d3b		/* C61x/X99 MEI Controller */
+#define	PCI_PRODUCT_INTEL_C610_IDE_R	0x8d3c		/* C61x/X99 IDE-R */
+#define	PCI_PRODUCT_INTEL_C610_KT	0x8d3d		/* C61x/X99 KT */
+#define	PCI_PRODUCT_INTEL_X99_LPC	0x8d44		/* X99 LPC */
+#define	PCI_PRODUCT_INTEL_X99_LPC_2	0x8d47		/* X99 LPC */
+#define	PCI_PRODUCT_INTEL_C610_SPSR	0x8d7c		/* C61x/X99 SPSR */
+#define	PCI_PRODUCT_INTEL_C610_MS_SMB0	0x8d7d		/* C61x/X99 MS SMbus */
+#define	PCI_PRODUCT_INTEL_C610_MS_SMB1	0x8d7e		/* C61x/X99 MS SMbus */
+#define	PCI_PRODUCT_INTEL_C610_MS_SMB2	0x8d7f		/* C61x/X99 MS SMbus */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_AHCI	0x9c03		/* Core 4G (mobile) SATA Controller (AHCI) */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_RAID_1	0x9c05		/* Core 4G (mobile) SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_RAID_2	0x9c07		/* Core 4G (mobile) SATA Controller (RAID) Premium */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_RAID_3	0x9c0f		/* Core 4G (mobile) SATA Controller (RAID) Premium */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_PCIE_1	0x9c10		/* Core 4G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_PCIE_2	0x9c12		/* Core 4G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_PCIE_3	0x9c14		/* Core 4G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_PCIE_4	0x9c16		/* Core 4G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_PCIE_5	0x9c18		/* Core 4G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_PCIE_6	0x9c1a		/* Core 4G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_HDA	0x9c20		/* Core 4G (mobile) HD Audio */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_SMB	0x9c22		/* Core 4G (mobile) SMBus */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_THERM	0x9c24		/* Core 4G (mobile) Thermal */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_EHCI	0x9c26		/* Core 4G (mobile) USB EHCI */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_XHCI	0x9c31		/* Core 4G (mobile) USB xHCI */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_SDIO	0x9c35		/* Core 4G (mobile) SDIO */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_SSOUND	0x9c36		/* Core 4G (mobile) Smart Sound */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_MEI_1	0x9c3a		/* Core 4G (mobile) MEI */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_MEI_2	0x9c3b		/* Core 4G (mobile) MEI */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_IDE_R	0x9c3c		/* Core 4G (mobile) IDE-R */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_KT	0x9c3d		/* Core 4G (mobile) KT */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_LPC_1	0x9c41		/* Core 4G (mobile) LPC */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_LPC_2	0x9c43		/* Core 4G (mobile) LPC */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_LPC_3	0x9c45		/* Core 4G (mobile) LPC */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_S_DMA	0x9c60		/* Core 4G (mobile) Serial I/O DMA */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_S_I2C_0	0x9c61		/* Core 4G (mobile) Serial I/O I2C */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_S_I2C_1	0x9c62		/* Core 4G (mobile) Serial I/O I2C */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_S_UART_0	0x9c63		/* Core 4G (mobile) Serial I/O UART */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_S_UART_1	0x9c64		/* Core 4G (mobile) Serial I/O UART */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_S_GSPI_0	0x9c65		/* Core 4G (mobile) Serial I/O GSPI */
+#define	PCI_PRODUCT_INTEL_CORE4G_M_S_GSPI_1	0x9c66		/* Core 4G (mobile) Serial I/O GSPI */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_AHCI	0x9c83		/* Core 5G (mobile) SATA Controller (AHCI) */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_RAID_1	0x9c85		/* Core 5G (mobile) SATA Controller (RAID) */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_RAID_2	0x9c87		/* Core 5G (mobile) SATA Controller (RAID) Premium */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_RAID_3	0x9c8f		/* Core 5G (mobile) SATA Controller (RAID) RRT Only */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_PCIE_1	0x9c90		/* Core 5G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_PCIE_2	0x9c92		/* Core 5G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_PCIE_3	0x9c94		/* Core 5G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_PCIE_4	0x9c96		/* Core 5G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_PCIE_5	0x9c98		/* Core 5G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_PCIE_6	0x9c9a		/* Core 5G (mobile) PCIE */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_HDA	0x9ca0		/* Core 5G (mobile) HD Audio */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_SMB	0x9ca2		/* Core 5G (mobile) SMBus */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_THERM	0x9ca4		/* Core 5G (mobile) Thermal */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_EHCI	0x9ca6		/* Core 5G (mobile) USB EHCI */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_XHCI	0x9cb1		/* Core 5G (mobile) USB xHCI */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_SDIO	0x9cb5		/* Core 5G (mobile) SDIO */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_SSOUND	0x9cb6		/* Core 5G (mobile) Smart Sound */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_MEI_1	0x9cba		/* Core 5G (mobile) ME Interface */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_MEI_2	0x9cbb		/* Core 5G (mobile) ME Interface */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_IDE_R	0x9cbc		/* Core 5G (mobile) IDE-R */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_KT	0x9cbd		/* Core 5G (mobile) KT */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_LPC_1	0x9cc1		/* Core 5G (mobile) LPC */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_LPC_2	0x9cc2		/* Core 5G (mobile) LPC */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_LPC_3	0x9cc3		/* Core 5G (mobile) LPC */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_LPC_4	0x9cc5		/* Core 5G (mobile) LPC */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_LPC_5	0x9cc6		/* Core 5G (mobile) LPC */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_LPC_6	0x9cc7		/* Core 5G (mobile) LPC */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_LPC_7	0x9cc9		/* Core 5G (mobile) LPC */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_S_DMA	0x9ce0		/* Core 5G (mobile) Serial I/O DMA */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_S_I2C_0	0x9ce1		/* Core 5G (mobile) Serial I/O I2C */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_S_I2C_1	0x9ce2		/* Core 5G (mobile) Serial I/O I2C */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_S_UART_0	0x9ce3		/* Core 5G (mobile) Serial I/O UART */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_S_UART_1	0x9ce4		/* Core 5G (mobile) Serial I/O UART */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_S_GSPI_0	0x9ce5		/* Core 5G (mobile) Serial I/O GSPI */
+#define	PCI_PRODUCT_INTEL_CORE5G_M_S_GSPI_1	0x9ce6		/* Core 5G (mobile) Serial I/O GSPI */
+#define	PCI_PRODUCT_INTEL_PINEVIEW_HB	0xa000		/* Pineview Host Bridge */
+#define	PCI_PRODUCT_INTEL_PINEVIEW_IGD	0xa001		/* Pineview Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_PINEVIEW_IGD_1	0xa002		/* Pineview Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_PINEVIEW_M_HB	0xa010		/* Pineview Host Bridge */
+#define	PCI_PRODUCT_INTEL_PINEVIEW_M_IGD	0xa011		/* Pineview Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_21152	0xb152		/* S21152BB PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_21154	0xb154		/* S21152BA,S21154AE/BE PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_21555	0xb555		/* 21555 Non-Transparent PCI-PCI Bridge */
+#define	PCI_PRODUCT_INTEL_CP_DMI_1	0xd131		/* Core Processor DMI */
+#define	PCI_PRODUCT_INTEL_CP_DMI_2	0xd132		/* Core Processor DMI */
+#define	PCI_PRODUCT_INTEL_CP_PCIE_1	0xd138		/* Core Processor PCIe Root Port (x16 or x8 max) */
+#define	PCI_PRODUCT_INTEL_CP_PCIE_2	0xd13a		/* Core Processor PCIe Root Port (x8 max) */
+#define	PCI_PRODUCT_INTEL_CP_QPI_LINK	0xd150		/* Core Processor QPI Link */
+#define	PCI_PRODUCT_INTEL_CP_QPI_RPREGS	0xd151		/* Core Processor QPI Routing and Protocol Registers */
+#define	PCI_PRODUCT_INTEL_CP_SYS_MREGS	0xd155		/* Core Processor System Management Registers */
+#define	PCI_PRODUCT_INTEL_CP_SS_REGS	0xd156		/* Core Processor Semaphore and Scratchpad Registers */
+#define	PCI_PRODUCT_INTEL_CP_SCS_REGS	0xd157		/* Core Processor System Control and Status Registers */
+#define	PCI_PRODUCT_INTEL_CP_MISC_REGS	0xd158		/* Core Processor Miscellaneous Registers */
+#define	PCI_PRODUCT_INTEL_HANKSVILLE	0xf0fe		/* HANKSVILLE LAN Controller */
+
+
+/* Intergraph products */
+#define	PCI_PRODUCT_INTERGRAPH_4D50T	0x00e4		/* Powerstorm 4D50T */
+#define	PCI_PRODUCT_INTERGRAPH_4D60T	0x00e3		/* Powerstorm 4D60T */
+
+/* Intersil products */
+#define	PCI_PRODUCT_INTERSIL_MINI_PCI_WLAN	0x3873		/* PRISM2.5 Mini-PCI WLAN */
+#define	PCI_PRODUCT_INTERSIL_MINI_PCI_3877	0x3877		/* PRISM Indigo Mini-PCI WLAN */
+#define	PCI_PRODUCT_INTERSIL_MINI_PCI_3890	0x3890		/* PRISM Duette Mini-PCI WLAN */
+
+/* Invertex */
+#define	PCI_PRODUCT_INVERTEX_AEON	0x0005		/* AEON */
+
+/* IO Data products */
+#define	PCI_PRODUCT_IODATA_CBIDE2	0x0003		/* CBIDE2/CI-iCN NinjaATA-32Bi IDE */
+#define	PCI_PRODUCT_IODATA_CBSCII	0x0005		/* CBSCII NinjaSCSI-32Bi SCSI */
+#define	PCI_PRODUCT_IODATA_RSAPCI	0x0007		/* RSA-PCI 2-port Serial */
+#define	PCI_PRODUCT_IODATA_GVBCTV5DL	0xd012		/* GV-BCTV5DL/PCI TV tuner */
+
+/* ITE products */
+#define	PCI_PRODUCT_ITE_IT8152	0x8152		/* IT8152 Host Bridge */
+#define	PCI_PRODUCT_ITE_IT8211	0x8211		/* IT8211 IDE Controller */
+#define	PCI_PRODUCT_ITE_IT8212	0x8212		/* IT8212 IDE Controller */
+#define	PCI_PRODUCT_ITE_IT8213	0x8213		/* IT8213 IDE Controller */
+#define	PCI_PRODUCT_ITE_IT8888	0x8888		/* PCI-ISA Bridge */
+#define	PCI_PRODUCT_ITE_IT8892	0x8892		/* PCIe-PCI Bridge */
+
+/* I. T. T. products */
+#define	PCI_PRODUCT_ITT_AGX016	0x0001		/* AGX016 */
+#define	PCI_PRODUCT_ITT_ITT3204	0x0002		/* ITT3204 MPEG Decoder */
+
+/* JMicron products */
+#define	PCI_PRODUCT_JMICRON_JMB360	0x2360		/* JMB360 SATA Controller */
+#define	PCI_PRODUCT_JMICRON_JMB361	0x2361		/* JMB361 SATA/PATA Controller */
+#define	PCI_PRODUCT_JMICRON_JMB362	0x2362		/* JMB362 SATA Controller */
+#define	PCI_PRODUCT_JMICRON_JMB363	0x2363		/* JMB363 SATA/PATA Controller */
+#define	PCI_PRODUCT_JMICRON_JMB365	0x2365		/* JMB365 SATA/PATA Controller */
+#define	PCI_PRODUCT_JMICRON_JMB366	0x2366		/* JMB366 SATA/PATA Controller */
+#define	PCI_PRODUCT_JMICRON_JMB368	0x2368		/* JMB368 PATA Controller */
+#define	PCI_PRODUCT_JMICRON_JMB38X_SD	0x2381		/* JMB38X SD Host Controller */
+#define	PCI_PRODUCT_JMICRON_JMB38X_MMC	0x2382		/* JMB38X SD/MMC Host Controller */
+#define	PCI_PRODUCT_JMICRON_JMB38X_MS	0x2383		/* JMB38X Memory Stick Host Controller */
+#define	PCI_PRODUCT_JMICRON_JMB38X_XD	0x2384		/* JMB38X xD Host Controller */
+#define	PCI_PRODUCT_JMICRON_JMB388_SD	0x2391		/* JMB388 SD Host Controller */
+#define	PCI_PRODUCT_JMICRON_JMB388_MMC	0x2392		/* JMB388 SD/MMC Host Controller */
+#define	PCI_PRODUCT_JMICRON_JMB388_MS	0x2393		/* JMB388 Memory Stick Host Controller */
+#define	PCI_PRODUCT_JMICRON_JMB388_XD	0x2394		/* JMB388 xD Host Controller */
+#define	PCI_PRODUCT_JMICRON_JMC250	0x0250		/* JMC250 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_JMICRON_JMC260	0x0260		/* JMC260 Fast Ethernet Controller */
+
+/* JNI products */
+#define	PCI_PRODUCT_JNI_JNIC1460	0x1460		/* JNIC-1460 Fibre-Channel Adapter */
+#define	PCI_PRODUCT_JNI_JNIC1560	0x1560		/* JNIC-1560 Dual Fibre-Channel Adapter */
+#define	PCI_PRODUCT_JNI_FCI1063	0x4643		/* FCI-1063 Fibre-Channel Adapter */
+#define	PCI_PRODUCT_JNI_FCX26562	0x6562		/* FCX2-6562 Dual Fibre-Channel Adapter */
+#define	PCI_PRODUCT_JNI_FCX6562	0x656a		/* FCX-6562 Fibre-Channel Adapter */
+
+/* Juniper Networks products */
+#define	PCI_PRODUCT_JUNIPER_XCLK0	0x0030		/* Experimental Clock Version 0 */
+
+/* KTI products - XXX better descriptions */
+#define	PCI_PRODUCT_KTI_NE2KETHER	0x3000		/* Ethernet */
+
+/* LAN Media */
+#define	PCI_PRODUCT_LMC_HSSI	0x0003		/* HSSI Interface */
+#define	PCI_PRODUCT_LMC_DS3	0x0004		/* DS3 Interface */
+#define	PCI_PRODUCT_LMC_SSI	0x0005		/* SSI */
+#define	PCI_PRODUCT_LMC_DS1	0x0006		/* DS1 */
+
+/* Lava products */
+#define	PCI_PRODUCT_LAVA_TWOSP_2S	0x0100		/* Dual Serial */
+#define	PCI_PRODUCT_LAVA_QUATTRO_AB	0x0101		/* Dual Serial */
+#define	PCI_PRODUCT_LAVA_QUATTRO_CD	0x0102		/* Dual Serial */
+#define	PCI_PRODUCT_LAVA_IOFLEX_2S_0	0x0110		/* Serial */
+#define	PCI_PRODUCT_LAVA_IOFLEX_2S_1	0x0111		/* Serial */
+#define	PCI_PRODUCT_LAVA_QUATTRO_AB2	0x0120		/* Dual Serial */
+#define	PCI_PRODUCT_LAVA_QUATTRO_CD2	0x0121		/* Dual Serial */
+#define	PCI_PRODUCT_LAVA_OCTOPUS550_0	0x0180		/* Quad Serial */
+#define	PCI_PRODUCT_LAVA_OCTOPUS550_1	0x0181		/* Quad Serial */
+#define	PCI_PRODUCT_LAVA_LAVAPORT_2	0x0200		/* Serial */
+#define	PCI_PRODUCT_LAVA_LAVAPORT_0	0x0201		/* Serial */
+#define	PCI_PRODUCT_LAVA_LAVAPORT_1	0x0202		/* Serial */
+#define	PCI_PRODUCT_LAVA_SSERIAL	0x0500		/* Single Serial */
+#define	PCI_PRODUCT_LAVA_650	0x0600		/* Serial */
+#define	PCI_PRODUCT_LAVA_TWOSP_1P	0x8000		/* Parallel */
+#define	PCI_PRODUCT_LAVA_PARALLEL2	0x8001		/* Dual Parallel */
+#define	PCI_PRODUCT_LAVA_PARALLEL2A	0x8002		/* Dual Parallel */
+#define	PCI_PRODUCT_LAVA_PARALLELB	0x8003		/* Dual Parallel */
+
+/* LeadTek Research */
+#define	PCI_PRODUCT_LEADTEK_S3_805	0x0000		/* S3 805 */
+
+/* Level One products */
+#define	PCI_PRODUCT_LEVELONE_LXT1001	0x0001		/* LXT-1001 10/100/1000 Ethernet */
+
+/* Linear Systems / CompuModules */
+#define	PCI_PRODUCT_LINEARSYS_DVB_TX	0x7629		/* DVB Transmitter */
+#define	PCI_PRODUCT_LINEARSYS_DVB_RX	0x7630		/* DVB Receiver */
+
+/* Linksys products */
+#define	PCI_PRODUCT_LINKSYS_EG1032	0x1032		/* EG1032 v2 Instant Gigabit Network Adapter */
+#define	PCI_PRODUCT_LINKSYS_EG1064	0x1064		/* EG1064 v2 Instant Gigabit Network Adapter */
+#define	PCI_PRODUCT_LINKSYS_PCMPC200	0xab08		/* PCMPC200 */
+#define	PCI_PRODUCT_LINKSYS_PCM200	0xab09		/* PCM200 */
+#define	PCI_PRODUCT_LINKSYS2_IPN2220	0x2220		/* IPN 2220 Wireless LAN Adapter (rev 01) */
+
+/* Lite-On products */
+#define	PCI_PRODUCT_LITEON_82C168	0x0002		/* 82C168/82C169 (PNIC) 10/100 Ethernet */
+#define	PCI_PRODUCT_LITEON_82C115	0xc115		/* 82C115 (PNIC II) 10/100 Ethernet */
+
+/* Lucent Technologies products */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0440	0x0440		/* K56flex DSVD LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0441	0x0441		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0442	0x0442		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0443	0x0443		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0444	0x0444		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0445	0x0445		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0446	0x0446		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0447	0x0447		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0448	0x0448		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0449	0x0449		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_044a	0x044a		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_044b	0x044b		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_044c	0x044c		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_044d	0x044d		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_044e	0x044e		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0450	0x0450		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0451	0x0451		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0452	0x0452		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0453	0x0453		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0454	0x0454		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0455	0x0455		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0456	0x0456		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0457	0x0457		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0458	0x0458		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_0459	0x0459		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_LTMODEM_045a	0x045a		/* LTMODEM */
+#define	PCI_PRODUCT_LUCENT_VENUSMODEM	0x0480		/* Venus Modem */
+#define	PCI_PRODUCT_LUCENT_OR3LP26	0x5400		/* ORCA FPGA w/ 32-bit PCI ASIC Core */
+#define	PCI_PRODUCT_LUCENT_OR3TP12	0x5401		/* ORCA FPGA w/ 64-bit PCI ASIC Core */
+#define	PCI_PRODUCT_LUCENT_USBHC	0x5801		/* USB Host Controller */
+#define	PCI_PRODUCT_LUCENT_USBHC2	0x5802		/* 2-port USB Host Controller */
+#define	PCI_PRODUCT_LUCENT_FW322_323	0x5811		/* FW322/323 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_LUCENT_FW643_PCIE	0x5901		/* FW643 PCIE IEEE 1394b Host Controller */
+#define	PCI_PRODUCT_LUCENT_ET1310	0xed00		/* ET1310 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_LUCENT_ET1301	0xed01		/* ET1301 10/100 Ethernet */
+
+/* Macronix */
+#define	PCI_PRODUCT_MACRONIX_MX98713	0x0512		/* MX98713 (PMAC) 10/100 Ethernet */
+#define	PCI_PRODUCT_MACRONIX_MX987x5	0x0531		/* MX987x5 (PMAC) 10/100 Ethernet */
+
+/* Madge Networks products */
+#define	PCI_PRODUCT_MADGE_SMARTRN2	0x0002		/* Smart 16/4 PCI Ringnode Mk2 */
+#define	PCI_PRODUCT_MADGE_COLLAGE25	0x1000		/* Collage 25 ATM Adapter */
+#define	PCI_PRODUCT_MADGE_COLLAGE155	0x1001		/* Collage 155 ATM Adapter */
+
+/* MAGMA products */
+#define	PCI_PRODUCT_MAGMA_SERIAL16	0x0010		/* 16 DMA PCI-SLRS */
+#define	PCI_PRODUCT_MAGMA_SERIAL4	0x0011		/* 4 DMA PCI-SLRS */
+
+/* Matrox products */
+#define	PCI_PRODUCT_MATROX_ATLAS	0x0518		/* MGA PX2085 (\"Atlas\") */
+#define	PCI_PRODUCT_MATROX_MILLENNIUM	0x0519		/* MGA Millennium 2064W (\"Storm\") */
+#define	PCI_PRODUCT_MATROX_MYSTIQUE	0x051a		/* MGA Mystique 1064SG */
+#define	PCI_PRODUCT_MATROX_MILLENNIUM2	0x051b		/* MGA Millennium II 2164W */
+#define	PCI_PRODUCT_MATROX_MILLENNIUM2_AGP	0x051f		/* MGA Millennium II 2164WA-B AGP */
+#define	PCI_PRODUCT_MATROX_G200_PCI	0x0520		/* MGA G200 PCI */
+#define	PCI_PRODUCT_MATROX_G200_AGP	0x0521		/* MGA G200 AGP */
+#define	PCI_PRODUCT_MATROX_G200E_SE	0x0522		/* MGA G200e (ServerEngines) */
+#define	PCI_PRODUCT_MATROX_G400_AGP	0x0525		/* MGA G400 AGP */
+#define	PCI_PRODUCT_MATROX_G200EW	0x0532		/* MGA G200eW */
+#define	PCI_PRODUCT_MATROX_G200EH	0x0533		/* MGA G200eH */
+#define	PCI_PRODUCT_MATROX_IMPRESSION	0x0d10		/* MGA Impression */
+#define	PCI_PRODUCT_MATROX_G100_PCI	0x1000		/* MGA G100 PCI */
+#define	PCI_PRODUCT_MATROX_G100_AGP	0x1001		/* MGA G100 AGP */
+#define	PCI_PRODUCT_MATROX_G550_AGP	0x2527		/* MGA G550 AGP */
+
+/* MediaQ products */
+#define	PCI_PRODUCT_MEDIAQ_MQ200	0x0200		/* MQ200 */
+
+/* Mellanox Technologies */
+#define	PCI_PRODUCT_MELLANOX_MT23108	0x5a44		/* InfiniHost (Tavor) */
+#define	PCI_PRODUCT_MELLANOX_MT23108_PCI	0x5a46		/* InfiniHost PCI Bridge (Tavor) */
+#define	PCI_PRODUCT_MELLANOX_MT25204_OLD	0x5e8c		/* InfiniHost III Lx (old Sinai) */
+#define	PCI_PRODUCT_MELLANOX_MT25204	0x6274		/* InfiniHost III Lx (Sinai) */
+#define	PCI_PRODUCT_MELLANOX_MT25208_COMPAT	0x6278		/* InfiniHost III Ex (Arbel in Tavor compatility) */
+#define	PCI_PRODUCT_MELLANOX_MT25208	0x6282		/* InfiniHost III Ex (Arbel) */
+#define	PCI_PRODUCT_MELLANOX_MT25408_SDR	0x6340		/* ConnectX SDR (Hermon) */
+#define	PCI_PRODUCT_MELLANOX_MT25408_DDR	0x634a		/* ConnectX DDR (Hermon) */
+#define	PCI_PRODUCT_MELLANOX_MT25408_QDR	0x6354		/* ConnectX QDR PCIe 2.0 2.5GT/s (Hermon) */
+#define	PCI_PRODUCT_MELLANOX_MT25408_EN	0x6368		/* ConnectX EN 10GigE PCIe 2.0 2.5GT/s (Hermon) */
+#define	PCI_PRODUCT_MELLANOX_MT25408_DDR_2	0x6732		/* ConnectX DDR PCIe 2.0 5GT/s (Hermon) */
+#define	PCI_PRODUCT_MELLANOX_MT25408_QDR_2	0x673c		/* ConnectX QDR PCIe 2.0 5GT/s (Hermon) */
+#define	PCI_PRODUCT_MELLANOX_MT25408_EN_2	0x6750		/* ConnectX EN 10GigE PCIe 2.0 5GT/s (Hermon) */
+
+/* Micro Memory products */
+#define	PCI_PRODUCT_MICROMEMORY_5415CN	0x5415		/* MM-5415CN Memory Module */
+#define	PCI_PRODUCT_MICROMEMORY_5425CN	0x5425		/* MM-5425CN Memory Module */
+
+/* Microsoft products */
+#define	PCI_PRODUCT_MICROSOFT_MN120	0x0001		/* MN-120 10/100 Ethernet Notebook Adapter */
+
+/* Micrel products */
+#define	PCI_PRODUCT_MICREL_KSZ8841	0x8841		/* 10/100 Ethernet */
+#define	PCI_PRODUCT_MICREL_KSZ8842	0x8842		/* Switched 2 Port 10/100 Ethernet */
+
+/* Middle Digital products */
+#define	PCI_PRODUCT_MIDDLE_DIGITAL_WEASEL_VGA	0x9050		/* Weasel Virtual VGA */
+#define	PCI_PRODUCT_MIDDLE_DIGITAL_WEASEL_SERIAL	0x9051		/* Weasel Serial Port */
+#define	PCI_PRODUCT_MIDDLE_DIGITAL_WEASEL_CONTROL	0x9052		/* Weasel Control */
+
+/* Mitsubishi products */
+#define	PCI_PRODUCT_MITSUBISHIELEC_TORNADO	0x0308		/* Tornado 3000 AGP */
+
+/* Motorola products */
+#define	PCI_PRODUCT_MOT_MPC105	0x0001		/* MPC105 \"Eagle\" Host Bridge */
+#define	PCI_PRODUCT_MOT_MPC106	0x0002		/* MPC106 \"Grackle\" Host Bridge */
+#define	PCI_PRODUCT_MOT_MPC8240	0x0003		/* MPC8240 \"Kahlua\" Host Bridge */
+#define	PCI_PRODUCT_MOT_MPC107	0x0004		/* MPC107 \"Chaparral\" Host Bridge */
+#define	PCI_PRODUCT_MOT_MPC8245	0x0006		/* MPC8245 \"Kahlua II\" Host Bridge */
+#define	PCI_PRODUCT_MOT_MPC8555E	0x000a		/* MPC8555E */
+#define	PCI_PRODUCT_MOT_MPC8541	0x000c		/* MPC8541 */
+#define	PCI_PRODUCT_MOT_MPC8548E	0x0012		/* MPC8548E */
+#define	PCI_PRODUCT_MOT_MPC8548	0x0013		/* MPC8548 */
+#define	PCI_PRODUCT_MOT_RAVEN	0x4801		/* Raven Host Bridge & Multi-Processor Interrupt Controller */
+#define	PCI_PRODUCT_MOT_FALCON	0x4802		/* Falcon ECC Memory Controller Chip Set */
+#define	PCI_PRODUCT_MOT_HAWK	0x4803		/* Hawk System Memory Controller & PCI Host Bridge */
+#define	PCI_PRODUCT_MOT_MPC5200B	0x5809		/* MPC5200B Host Bridge */
+
+/* Moxa Technologies products */
+#define	PCI_PRODUCT_MOXA_CP102U	0x1022		/* CP102U */
+#define	PCI_PRODUCT_MOXA_C104H	0x1040		/* C104H */
+#define	PCI_PRODUCT_MOXA_CP104	0x1041		/* CP104UL */
+#define	PCI_PRODUCT_MOXA_CP104V2	0x1042		/* CP104V2 */
+#define	PCI_PRODUCT_MOXA_CP104EL	0x1043		/* CP104EL */
+#define	PCI_PRODUCT_MOXA_CP114	0x1141		/* CP114 */
+#define	PCI_PRODUCT_MOXA_C168H	0x1680		/* C168H */
+#define	PCI_PRODUCT_MOXA_C168U	0x1681		/* C168U */
+#define	PCI_PRODUCT_MOXA_C168EL	0x1682		/* C168EL */
+#define	PCI_PRODUCT_MOXA_C168ELA	0x1683		/* C168EL A */
+
+/* Mutech products */
+#define	PCI_PRODUCT_MUTECH_MV1000	0x0001		/* MV1000 */
+
+/* Mylex products */
+#define	PCI_PRODUCT_MYLEX_RAID_V2	0x0001		/* DAC960 RAID (v2 Interface) */
+#define	PCI_PRODUCT_MYLEX_RAID_V3	0x0002		/* DAC960 RAID (v3 Interface) */
+#define	PCI_PRODUCT_MYLEX_RAID_V4	0x0010		/* DAC960 RAID (v4 Interface) */
+#define	PCI_PRODUCT_MYLEX_RAID_V5	0x0020		/* DAC960 RAID (v5 Interface) */
+#define	PCI_PRODUCT_MYLEX_EXTREMERAID_3000	0x0030		/* eXtremeRAID 3000 */
+#define	PCI_PRODUCT_MYLEX_EXTREMERAID_2000	0x0040		/* eXtremeRAID 2000 */
+#define	PCI_PRODUCT_MYLEX_ACCELERAID	0x0050		/* AcceleRAID 352 */
+#define	PCI_PRODUCT_MYLEX_ACCELERAID_170	0x0052		/* AcceleRAID 170 */
+#define	PCI_PRODUCT_MYLEX_ACCELERAID_160	0x0054		/* AcceleRAID 160 */
+#define	PCI_PRODUCT_MYLEX_EXTREMERAID1100	0xba55		/* eXtremeRAID 1100 */
+#define	PCI_PRODUCT_MYLEX_EXTREMERAID	0xba56		/* eXtremeRAID 2000/3000 */
+
+/* Myricom products */
+#define	PCI_PRODUCT_MYRICOM_MYRINET	0x8043		/* Myrinet */
+
+/* Myson-Century Technology products */
+#define	PCI_PRODUCT_MYSON_MTD803	0x0803		/* MTD803 3-in-1 Fast Ethernet Controller */
+
+/* National Datacomm products */
+#define	PCI_PRODUCT_NDC_NCP130	0x0130		/* NCP130 Wireless NIC */
+#define	PCI_PRODUCT_NDC_NCP130A2	0x0131		/* NCP130 rev A2 Wireless NIC */
+
+/* Netoctave */
+#define	PCI_PRODUCT_NETOCTAVE_NSP2K	0x0100		/* NSP2K */
+
+/* NetBoost (now Intel) products */
+#define	PCI_PRODUCT_NETBOOST_POLICY	0x0000		/* Policy Accelerator */
+
+/* NetLogic (now Broadcom?) products */
+#define	PCI_PRODUCT_NETLOGIC_XLP_SBC	0x1001		/* XLP System Bridge controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_ICI	0x1002		/* XLP Inter-Chip interconnect */
+#define	PCI_PRODUCT_NETLOGIC_XLP_PIC	0x1003		/* XLP Programmable Interrupt controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_PCIROOT	0x1004		/* XLP PCI-Express RootComplex/Endpoint port */
+#define	PCI_PRODUCT_NETLOGIC_XLP_INTERLAKEN	0x1005		/* XLP Interlaken LA interface */
+#define	PCI_PRODUCT_NETLOGIC_XLP_DEVUSB	0x1006		/* XLP Device USB controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_EHCIUSB	0x1007		/* XLP EHCI USB controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_OHCIUSB	0x1008		/* XLP OHCI USB controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_NAE	0x1009		/* XLP Network Acceleration engine */
+#define	PCI_PRODUCT_NETLOGIC_XLP_POE	0x100A		/* XLP Packet Ordering engine */
+#define	PCI_PRODUCT_NETLOGIC_XLP_FMN	0x100B		/* XLP Fast Messaging Network */
+#define	PCI_PRODUCT_NETLOGIC_XLP_DMA	0x100C		/* XLP Data Transfer and RAID engine */
+#define	PCI_PRODUCT_NETLOGIC_XLP_SAE	0x100D		/* XLP Security accelerator */
+#define	PCI_PRODUCT_NETLOGIC_XLP_PKE	0x100E		/* XLP RSA/ECC accelerator */
+#define	PCI_PRODUCT_NETLOGIC_XLP_CDE	0x100F		/* XLP Compress/Decompression engine */
+#define	PCI_PRODUCT_NETLOGIC_XLP_UART	0x1010		/* XLP UART controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_I2C	0x1011		/* XLP I2C controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_GPIO	0x1012		/* XLP GPIO controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_SYSTEM	0x1013		/* XLP System controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_JTAG	0x1014		/* XLP JTAG interface */
+#define	PCI_PRODUCT_NETLOGIC_XLP_NOR	0x1015		/* XLP NOR flash controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_NAND	0x1016		/* XLP NAND flash controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_SPI	0x1017		/* XLP SPI controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_SDHC	0x1018		/* XLP eMMC/SD/SDIO controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_RXE	0x1019		/* XLP Regular Expression accelerator */
+#define	PCI_PRODUCT_NETLOGIC_XLP_AHCISATA	0x101a		/* XLP AHCI SATA controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_SRIO	0x101b		/* XLP SRIO (Serial Rapid IO) controller */
+
+/* NetVin products - XXX better descriptions */
+#define	PCI_PRODUCT_NETVIN_5000	0x5000		/* 5000 Ethernet */
+
+/* Newbridge / Tundra products */
+#define	PCI_PRODUCT_NEWBRIDGE_CA91CX42	0x0000		/* Universe VME Bridge */
+#define	PCI_PRODUCT_NEWBRIDGE_CA91L826A	0x0826		/* QSpan II PCI Bridge */
+#define	PCI_PRODUCT_NEWBRIDGE_CA91L8260	0x8260		/* PowerSpan PCI Bridge */
+#define	PCI_PRODUCT_NEWBRIDGE_CA91L8261	0x8261		/* PowerSpan II PCI Bridge */
+
+/* National Instruments products */
+#define	PCI_PRODUCT_NATIONALINST_MXI3	0x2c30		/* MXI-3 PCI Extender */
+
+/* National Semiconductor products */
+#define	PCI_PRODUCT_NS_DP83810	0x0001		/* DP83810 10/100 Ethernet */
+#define	PCI_PRODUCT_NS_PC87415	0x0002		/* PC87415 IDE */
+#define	PCI_PRODUCT_NS_PC87560	0x000e		/* 87560 Legacy I/O */
+#define	PCI_PRODUCT_NS_USB	0x0012		/* USB */
+#define	PCI_PRODUCT_NS_DP83815	0x0020		/* DP83815 10/100 Ethernet */
+#define	PCI_PRODUCT_NS_DP83820	0x0022		/* DP83820 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_NS_CS5535_HB	0x0028		/* CS5535 Host-PCI Bridge */
+#define	PCI_PRODUCT_NS_CS5535_ISA	0x002b		/* CS5535 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NS_CS5535_IDE	0x002d		/* CS5535 IDE Controller */
+#define	PCI_PRODUCT_NS_CS5535_AUDIO	0x002e		/* CS5535 Audio Controller */
+#define	PCI_PRODUCT_NS_CS5535_USB	0x002f		/* CS5535 USB Host Controller */
+#define	PCI_PRODUCT_NS_CS5535_VIDEO	0x0030		/* CS5535 Video Controller */
+#define	PCI_PRODUCT_NS_SATURN	0x0035		/* Saturn */
+#define	PCI_PRODUCT_NS_SC1100_IDE	0x0502		/* SC1100 PCI IDE */
+#define	PCI_PRODUCT_NS_SC1100_AUDIO	0x0503		/* SC1100 XpressAUDIO */
+#define	PCI_PRODUCT_NS_SC1100_ISA	0x0510		/* SC1100 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NS_SC1100_ACPI	0x0511		/* SC1100 SMI/ACPI */
+#define	PCI_PRODUCT_NS_SC1100_XBUS	0x0515		/* SC1100 X-Bus */
+#define	PCI_PRODUCT_NS_NS87410	0xd001		/* NS87410 */
+
+/* Philips products */
+#define	PCI_PRODUCT_PHILIPS_SAA7130HL	0x7130		/* SAA7130HL PCI Video Broadcast Decoder */
+#define	PCI_PRODUCT_PHILIPS_SAA7133HL	0x7133		/* SAA7133HL PCI A/V Broadcast Decoder */
+#define	PCI_PRODUCT_PHILIPS_SAA7134HL	0x7134		/* SAA7134HL PCI A/V Broadcast Decoder */
+#define	PCI_PRODUCT_PHILIPS_SAA7135HL	0x7135		/* SAA7135HL PCI A/V Broadcast Decoder */
+#define	PCI_PRODUCT_PHILIPS_SAA7146AH	0x7146		/* SAA7146AH PCI Multimedia Bridge */
+
+/* NCR/Symbios Logic products */
+#define	PCI_PRODUCT_SYMBIOS_810	0x0001		/* 53c810 */
+#define	PCI_PRODUCT_SYMBIOS_820	0x0002		/* 53c820 */
+#define	PCI_PRODUCT_SYMBIOS_825	0x0003		/* 53c825 */
+#define	PCI_PRODUCT_SYMBIOS_815	0x0004		/* 53c815 */
+#define	PCI_PRODUCT_SYMBIOS_810AP	0x0005		/* 53c810AP */
+#define	PCI_PRODUCT_SYMBIOS_860	0x0006		/* 53c860 */
+#define	PCI_PRODUCT_SYMBIOS_1510D	0x000a		/* 53c1510D */
+#define	PCI_PRODUCT_SYMBIOS_896	0x000b		/* 53c896 */
+#define	PCI_PRODUCT_SYMBIOS_895	0x000c		/* 53c895 */
+#define	PCI_PRODUCT_SYMBIOS_885	0x000d		/* 53c885 */
+#define	PCI_PRODUCT_SYMBIOS_875	0x000f		/* 53c875/876 */
+#define	PCI_PRODUCT_SYMBIOS_1510	0x0010		/* 53c1510 */
+#define	PCI_PRODUCT_SYMBIOS_895A	0x0012		/* 53c895A */
+#define	PCI_PRODUCT_SYMBIOS_875A	0x0013		/* 53c875A */
+#define	PCI_PRODUCT_SYMBIOS_1010	0x0020		/* 53c1010 */
+#define	PCI_PRODUCT_SYMBIOS_1010_2	0x0021		/* 53c1010 (66MHz) */
+#define	PCI_PRODUCT_SYMBIOS_1030	0x0030		/* 53c1020/53c1030 */
+#define	PCI_PRODUCT_SYMBIOS_1030R	0x1030		/* 53c1030R */
+#define	PCI_PRODUCT_SYMBIOS_1030ZC	0x0031		/* 53c1030ZC */
+#define	PCI_PRODUCT_SYMBIOS_1035	0x0040		/* 53c1035 */
+#define	PCI_PRODUCT_SYMBIOS_1035ZC	0x0041		/* 53c1035ZC */
+#define	PCI_PRODUCT_SYMBIOS_SAS1064	0x0050		/* SAS1064 */
+#define	PCI_PRODUCT_SYMBIOS_SAS1068	0x0054		/* SAS1068 */
+#define	PCI_PRODUCT_SYMBIOS_SAS1068_2	0x0055		/* SAS1068 */
+#define	PCI_PRODUCT_SYMBIOS_SAS1064E	0x0056		/* SAS1064E */
+#define	PCI_PRODUCT_SYMBIOS_SAS1064E_2	0x0057		/* SAS1064E */
+#define	PCI_PRODUCT_SYMBIOS_SAS1068E	0x0058		/* SAS1068E */
+#define	PCI_PRODUCT_SYMBIOS_SAS1068E_2	0x0059		/* SAS1068E */
+#define	PCI_PRODUCT_SYMBIOS_SAS1066E	0x005A		/* SAS1066E */
+#define	PCI_PRODUCT_SYMBIOS_MEGARAID_2208	0x005B		/* MegaRAID SAS2208 */
+#define	PCI_PRODUCT_SYMBIOS_SAS1064A	0x005C		/* SAS1064A */
+#define	PCI_PRODUCT_SYMBIOS_MEGARAID_3108	0x005d		/* MegaRAID SAS3108 */
+#define	PCI_PRODUCT_SYMBIOS_SAS1066	0x005E		/* SAS1066 */
+#define	PCI_PRODUCT_SYMBIOS_SAS1078	0x0060		/* SAS1078 PCI */
+#define	PCI_PRODUCT_SYMBIOS_SAS1078_PCIE	0x0062		/* SAS1078 PCI Express */
+#define	PCI_PRODUCT_SYMBIOS_SAS2116_1	0x0064		/* SAS2116 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2116_2	0x0065		/* SAS2116 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2308_3	0x006e		/* SAS2308 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2004	0x0070		/* SAS2004 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2008	0x0072		/* SAS2008 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2008_1	0x0073		/* MegaRAID SAS2008 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2108_3	0x0074		/* SAS2108 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2108_4	0x0076		/* SAS2108 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2108_5	0x0077		/* SAS2108 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2108_1	0x0078		/* MegaRAID SAS2108 CRYPTO GEN2 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2108_2	0x0079		/* MegaRAID SAS2108 GEN2 */
+#define	PCI_PRODUCT_SYMBIOS_SAS1078DE	0x007c		/* SAS1078DE */
+#define	PCI_PRODUCT_SYMBIOS_SAS2208_1	0x0080		/* SAS2208 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2208_2	0x0081		/* SAS2208 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2208_3	0x0082		/* SAS2208 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2208_4	0x0083		/* SAS2208 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2208_5	0x0084		/* SAS2208 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2208_6	0x0085		/* SAS2208 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2308_1	0x0086		/* SAS2308 */
+#define	PCI_PRODUCT_SYMBIOS_SAS2308_2	0x0087		/* SAS2308 */
+#define	PCI_PRODUCT_SYMBIOS_875J	0x008f		/* 53c875J */
+#define	PCI_PRODUCT_SYMBIOS_FC909	0x0620		/* FC909 */
+#define	PCI_PRODUCT_SYMBIOS_FC909A	0x0621		/* FC909A */
+#define	PCI_PRODUCT_SYMBIOS_FC929	0x0622		/* FC929 */
+#define	PCI_PRODUCT_SYMBIOS_FC929_1	0x0623		/* FC929 */
+#define	PCI_PRODUCT_SYMBIOS_FC919	0x0624		/* FC919 */
+#define	PCI_PRODUCT_SYMBIOS_FC919_1	0x0625		/* FC919 */
+#define	PCI_PRODUCT_SYMBIOS_FC929X	0x0626		/* FC929X */
+#define	PCI_PRODUCT_SYMBIOS_FC919X	0x0628		/* FC919X */
+#define	PCI_PRODUCT_SYMBIOS_FC949X	0x0640		/* FC949X */
+#define	PCI_PRODUCT_SYMBIOS_FC939X	0x0642		/* FC939X */
+#define	PCI_PRODUCT_SYMBIOS_FC949E	0x0646		/* FC949E */
+#define	PCI_PRODUCT_SYMBIOS_MEGARAID_320X	0x0407		/* LSI Megaraid SCSI 320-X */
+#define	PCI_PRODUCT_SYMBIOS_MEGARAID_320E	0x0408		/* LSI Megaraid SCSI 320-E */
+#define	PCI_PRODUCT_SYMBIOS_MEGARAID_300X	0x0409		/* LSI Megaraid SATA (300-6X/300-8X) */
+#define	PCI_PRODUCT_SYMBIOS_MEGARAID_SAS	0x0411		/* MegaRAID SAS */
+#define	PCI_PRODUCT_SYMBIOS_MEGARAID_VERDE_ZCR	0x0413		/* MegaRAID Verde ZCR */
+#define	PCI_PRODUCT_SYMBIOS_PERC_4SC	0x1960		/* PERC 4/SC */
+
+/* Packet Engines products */
+#define	PCI_PRODUCT_SYMBIOS_PE_GNIC	0x0702		/* Packet Engines G-NIC Ethernet */
+
+/* Parallels products */
+#define	PCI_PRODUCT_PARALLELS_TOOLS	0x1112		/* Tools */
+#define	PCI_PRODUCT_PARALLELS_VIDEO	0x1121		/* Video */
+#define	PCI_PRODUCT_PARALLELS_VIDEO2	0x1131		/* Video II */
+
+/* NEC products */
+#define	PCI_PRODUCT_NEC_USB	0x0035		/* USB Host Controller */
+#define	PCI_PRODUCT_NEC_VRC4173_CARDU	0x003e		/* VRC4173 PC-Card Unit */
+#define	PCI_PRODUCT_NEC_POWERVR2	0x0046		/* PowerVR PCX2 */
+#define	PCI_PRODUCT_NEC_PD72872	0x0063		/* uPD72872 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_NEC_PKUGX001	0x0074		/* PK-UG-X001 K56flex Modem */
+#define	PCI_PRODUCT_NEC_PKUGX008	0x007d		/* PK-UG-X008 */
+#define	PCI_PRODUCT_NEC_VRC4173_BCU	0x00a5		/* VRC4173 Bus Control Unit */
+#define	PCI_PRODUCT_NEC_VRC4173_AC97U	0x00a6		/* VRC4173 AC97 Unit */
+#define	PCI_PRODUCT_NEC_PD72870	0x00cd		/* uPD72870 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_NEC_PD72871	0x00ce		/* uPD72871 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_NEC_PD720100A	0x00e0		/* USB2 Host Controller */
+#define	PCI_PRODUCT_NEC_PD720400	0x0125		/* uPD720400 PCI Express - PCI/PCI-X Bridge */
+#define	PCI_PRODUCT_NEC_PD720200	0x0194		/* USB3 Host Controller */
+#define	PCI_PRODUCT_NEC_VA26D	0x803c		/* Versa Pro LX VA26D */
+#define	PCI_PRODUCT_NEC_VERSALX	0x8058		/* Versa LX */
+
+/* Neomagic products */
+#define	PCI_PRODUCT_NEOMAGIC_NMMG2070	0x0001		/* MagicGraph NM2070 */
+#define	PCI_PRODUCT_NEOMAGIC_NMMG128V	0x0002		/* MagicGraph 128V */
+#define	PCI_PRODUCT_NEOMAGIC_NMMG128ZV	0x0003		/* MagicGraph 128ZV */
+#define	PCI_PRODUCT_NEOMAGIC_NMMG2160	0x0004		/* MagicGraph 128XD */
+#define	PCI_PRODUCT_NEOMAGIC_NMMM256AV_VGA	0x0005		/* MagicMedia 256AV VGA */
+#define	PCI_PRODUCT_NEOMAGIC_NMMM256ZX_VGA	0x0006		/* MagicMedia 256ZX VGA */
+#define	PCI_PRODUCT_NEOMAGIC_NMMM256XLP_AU	0x0016		/* MagicMedia 256XL+ Audio */
+#define	PCI_PRODUCT_NEOMAGIC_NMMM256AV_AU	0x8005		/* MagicMedia 256AV Audio */
+#define	PCI_PRODUCT_NEOMAGIC_NMMM256ZX_AU	0x8006		/* MagicMedia 256ZX Audio */
+
+/* NetChip (now PLX) products */
+#define	PCI_PRODUCT_NETCHIP_NET2280	0x2280		/* NET2280 USB Device Controller */
+#define	PCI_PRODUCT_NETCHIP_NET2282	0x2282		/* NET2282 USB Device Controller */
+
+/* Netgear products */
+#define	PCI_PRODUCT_NETGEAR_GA620	0x620a		/* GA620 1000baseSX Ethernet */
+#define	PCI_PRODUCT_NETGEAR_GA620T	0x630a		/* GA620 1000baseT Ethernet */
+#define	PCI_PRODUCT_NETGEAR_MA301	0x4100		/* MA301 PCI IEEE 802.11b */
+
+/* Netmos products */
+#define	PCI_PRODUCT_NETMOS_NM9805	0x9805		/* 1284 Printer Port */
+#define	PCI_PRODUCT_NETMOS_NM9815	0x9815		/* Dual 1284 Printer Port */
+#define	PCI_PRODUCT_NETMOS_NM9820	0x9820		/* Single UART */
+#define	PCI_PRODUCT_NETMOS_NM9835	0x9835		/* Dual UART and 1284 Printer Port */
+#define	PCI_PRODUCT_NETMOS_NM9845	0x9845		/* Quad UART and 1284 Printer Port */
+#define	PCI_PRODUCT_NETMOS_NM9855	0x9855		/* 9855 Quad UART and 1284 Printer Port */
+#define	PCI_PRODUCT_NETMOS_NM9865	0x9865		/* 9865 Quad UART and 1284 Printer Port */
+#define	PCI_PRODUCT_NETMOS_MCS9990	0x9990		/* MCS9990 Quad USB 2.0 Port */
+#define	PCI_PRODUCT_NETMOS_NM9900	0x9900		/* Single PCI-E UART */
+#define	PCI_PRODUCT_NETMOS_NM9901	0x9901		/* Dual PCI-E UART */
+#define	PCI_PRODUCT_NETMOS_NM9904	0x9904		/* Quad PCI-E UART */
+#define	PCI_PRODUCT_NETMOS_NM9912	0x9912		/* Dual PCI-E UART and 1284 Printer Port */
+#define	PCI_PRODUCT_NETMOS_NM9922	0x9922		/* Dual PCI-E UART */
+
+/* Network Security Technologies */
+#define	PCI_PRODUCT_NETSEC_7751	0x7751		/* 7751 */
+
+/* NexGen products */
+#define	PCI_PRODUCT_NEXGEN_NX82C501	0x4e78		/* NX82C501 Host-PCI Bridge */
+
+/* NKK products */
+#define	PCI_PRODUCT_NKK_NDR4600	0xa001		/* NDR4600 Host-PCI Bridge */
+
+/* Nortel products */
+#define	PCI_PRODUCT_NORTEL_BAYSTACK_21	0x1211		/* Baystack 21 (Accton MPX EN5038) */
+
+/* Number Nine products */
+#define	PCI_PRODUCT_NUMBER9_I128	0x2309		/* Imagine-128 */
+#define	PCI_PRODUCT_NUMBER9_I128_2	0x2339		/* Imagine-128 II */
+
+/* Nvidia products */
+#define	PCI_PRODUCT_NVIDIA_RIVATNT	0x0020		/* RIVA TNT */
+#define	PCI_PRODUCT_NVIDIA_RIVATNT2	0x0028		/* RIVA TNT2 */
+#define	PCI_PRODUCT_NVIDIA_RIVATNT2U	0x0029		/* RIVA TNT2 Ultra */
+#define	PCI_PRODUCT_NVIDIA_VANTA	0x002c		/* Vanta */
+#define	PCI_PRODUCT_NVIDIA_RIVATNT2M64	0x002d		/* RIVA TNT2 Model 64 */
+#define	PCI_PRODUCT_NVIDIA_MCP04_PCIB	0x0030		/* MCP04 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP04_SMBUS	0x0034		/* MCP04 SMBus */
+#define	PCI_PRODUCT_NVIDIA_MCP04_IDE	0x0035		/* MCP04 IDE */
+#define	PCI_PRODUCT_NVIDIA_MCP04_SATA	0x0036		/* MCP04 SATA */
+#define	PCI_PRODUCT_NVIDIA_MCP04_LAN1	0x0037		/* MCP04 Ethernet */
+#define	PCI_PRODUCT_NVIDIA_MCP04_LAN2	0x0038		/* MCP04 Ethernet */
+#define	PCI_PRODUCT_NVIDIA_MCP04_SATA2	0x003e		/* MCP04 SATA */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_6800U	0x0040		/* GeForce 6800 Ultra */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_6800	0x0041		/* GeForce 6800 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_6800LE	0x0042		/* GeForce 6800 LE */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_6800GT	0x0045		/* GeForce 6800 GT */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_PCIB1	0x0050		/* nForce4 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_PCIB2	0x0051		/* nForce4 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_SMBUS	0x0052		/* nForce4 SMBus */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_ATA133	0x0053		/* nForce4 ATA133 IDE */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_SATA1	0x0054		/* nForce4 Serial ATA 1 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_SATA2	0x0055		/* nForce4 Serial ATA 2 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_LAN1	0x0056		/* nForce4 Ethernet */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_LAN2	0x0057		/* nForce4 Ethernet */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_AC	0x0059		/* nForce4 AC-97 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_USB	0x005a		/* nForce4 USB Host Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_USB2	0x005b		/* nForce4 USB2 Host Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_PCI	0x005c		/* nForce4 PCI Host Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_PCIE	0x005d		/* nForce4 PCIe Host Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE4_MEM	0x005e		/* nForce4 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_PCIB	0x0060		/* nForce2 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_SMBUS	0x0064		/* nForce2 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_ATA133	0x0065		/* nForce2 ATA133 IDE */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_LAN	0x0066		/* nForce2 Ethernet */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_OHCI	0x0067		/* nForce2 USB Host Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_EHCI	0x0068		/* nForce2 USB2 Host Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_MCPT_AC	0x006a		/* nForce2 MCP-T AC-97 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_MCPT_AP	0x006b		/* nForce2 MCP-T Audio Processing Unit */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_PPB	0x006c		/* nForce2 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_FW	0x006e		/* nForce2 Firewire Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_400_PCIB	0x0080		/* nForce2 Ultra 400 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_400_SMBUS	0x0084		/* nForce2 Ultra 400 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_400_ATA133	0x0085		/* nForce2 Ultra 400 ATA133 IDE */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN1	0x0086		/* nForce2 Ultra 400 Ethernet */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_400_OHCI	0x0087		/* nForce2 Ultra 400 USB Host Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_400_EHCI	0x0088		/* nForce2 Ultra 400 USB2 Host Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_400_MCPT_AC	0x008a		/* nForce2 Ultra 400 AC-97 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_400_PPB	0x008b		/* nForce2 Ultra 400 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN2	0x008c		/* nForce2 Ultra 400 Ethernet */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_400_SATA	0x008e		/* nForce2 Ultra 400 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_ALADDINTNT2	0x00a0		/* Aladdin TNT2 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_PCIB	0x00d0		/* nForce3 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_PCHB	0x00d1		/* nForce3 Host-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_PPB2	0x00d2		/* nForce3 PCI-PCI */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_SMBUS	0x00d4		/* nForce3 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_ATA133	0x00d5		/* nForce3 ATA133 IDE */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_LAN1	0x00d6		/* nForce3 Ethernet */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_OHCI	0x00d7		/* nForce3 USB Host Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_EHCI	0x00d8		/* nForce3 USB2 Host Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_MCPT_AC	0x00da		/* nForce3 MCP-T AC-97 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_PPB	0x00dd		/* nForce3 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_LAN4	0x00df		/* nForce3 Ethernet #4 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_PCIB	0x00e0		/* nForce3 250 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_PCHB	0x00e1		/* nForce3 250 Host-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_AGP	0x00e2		/* nForce3 250 AGP */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_SATA	0x00e3		/* nForce3 250 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_SMBUS	0x00e4		/* nForce3 250 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_ATA133	0x00e5		/* nForce3 250 ATA133 IDE */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_LAN	0x00e6		/* nForce3 250 Ethernet */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_OHCI	0x00e7		/* nForce3 250 USB Host Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_EHCI	0x00e8		/* nForce3 250 USB2 Host Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_MCPT_AC	0x00ea		/* nForce3 250 MCP-T AC-97 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_PPB	0x00ed		/* nForce3 250 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE3_250_SATA2	0x00ee		/* nForce3 250 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_QUADROFX3400	0x00f8		/* Quadro FX 3400 */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_280NVS2	0x00fd		/* Quadro4 280 NVS */
+#define	PCI_PRODUCT_NVIDIA_QUADROFX1300	0x00fe		/* Quadro FX 1300 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCEPCX4300	0x00ff		/* GeForce PCX 4300 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE256	0x0100		/* GeForce 256 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCEDDR	0x0101		/* GeForce DDR */
+#define	PCI_PRODUCT_NVIDIA_QUADRO	0x0103		/* Quadro */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE2MX	0x0110		/* GeForce2 MX */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE2MX200	0x0111		/* GeForce2 MX 100/200 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE2GO	0x0112		/* GeForce2 Go */
+#define	PCI_PRODUCT_NVIDIA_QUADRO2_MXR	0x0113		/* Quadro2 MXR/EX */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE6600GT	0x0140		/* GeForce 6600 GT */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE6600	0x0141		/* GeForce 6600 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE6600_2	0x0142		/* GeForce 6600 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE6600GO	0x0144		/* GeForce 6600 Go */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE6610XL	0x0145		/* GeForce 6610 XL */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE6600GO_2	0x0146		/* GeForce 6600 Go */
+#define	PCI_PRODUCT_NVIDIA_QUADROFX5500	0x014d		/* Quadro FX 5500 */
+#define	PCI_PRODUCT_NVIDIA_QUADROFX540	0x014e		/* Quadro FX 540 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE6200	0x014f		/* GeForce 6200 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE2	0x0150		/* GeForce2 GTS */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE2DDR	0x0151		/* GeForce2 GTS (DDR) */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE2BR	0x0152		/* GeForce2 GTS */
+#define	PCI_PRODUCT_NVIDIA_QUADRO2	0x0153		/* Quadro2 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE6200TC	0x0161		/* GeForce 6200TC */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE6200LE	0x0163		/* GeForce 6200LE */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE4_MX460	0x0170		/* GeForce4 MX 460 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE4_MX440	0x0171		/* GeForce4 MX 440 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE4_MX420	0x0172		/* GeForce4 MX 420 */
+#define	PCI_PRODUCT_NVIDIA_GF4_MX440_SE	0x0173		/* GeForce4 MX 440 SE */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_500XGL	0x0178		/* Quadro4 500XGL */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_200NVS	0x017a		/* Quadro4 200/400NVS */
+#define	PCI_PRODUCT_NVIDIA_GF4_MX440_8X	0x0181		/* GeForce4 MX 440 (AGP8X) */
+#define	PCI_PRODUCT_NVIDIA_GF4_MX440_SE_8X	0x0182		/* GeForce4 MX 440 SE (AGP8X) */
+#define	PCI_PRODUCT_NVIDIA_GF4_MX420_8X	0x0183		/* GeForce4 MX 420 (AGP8X) */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_580XGL	0x0188		/* Quadro4 580 XGL */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_280NVS	0x018a		/* Quadro4 280 NVS */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_380XGL	0x018b		/* Quadro4 380 XGL */
+#define	PCI_PRODUCT_NVIDIA_QUADROFX4600	0x019e		/* Quadro FX 4600 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE2_IGP	0x01a0		/* GeForce2 Integrated GPU */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_PCHB	0x01a4		/* nForce PCI Host */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_DDR2	0x01aa		/* nForce 220 DDR */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_DDR	0x01ab		/* nForce 420 DDR */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_MEM	0x01ac		/* nForce 220/420 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_MEM1	0x01ad		/* nForce 220/420 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_APU	0x01b0		/* nForce Audio Processing Unit */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_MCP_AC	0x01b1		/* nForce MCP AC-97 */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_ISA	0x01b2		/* nForce ISA */
+#define	PCI_PRODUCT_NVIDIA_XBOX_SMBUS	0x01b4		/* Xbox nForce SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_AGP	0x01b7		/* nForce AGP */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_PPB	0x01b8		/* nForce PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_ATA100	0x01bc		/* nForce ATA100 IDE */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_USB	0x01c2		/* nForce USB */
+#define	PCI_PRODUCT_NVIDIA_NFORCE_LAN	0x01c3		/* nForce Ethernet */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_7300LE	0x01d1		/* GeForce 7300 LE */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_PCHB	0x01e0		/* nForce2 Host-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_PPB2	0x01e8		/* nForce2 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_MEM1	0x01eb		/* nForce2 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_MEM2	0x01ec		/* nForce2 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_MEM3	0x01ed		/* nForce2 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_MEM4	0x01ee		/* nForce2 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE2_MEM5	0x01ef		/* nForce2 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_GF4_MX_IGP	0x01f0		/* GeForce4 MX Integrated GPU */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE3	0x0200		/* GeForce3 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE3_TI200	0x0201		/* GeForce3 Ti 200 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE3_TI500	0x0202		/* GeForce3 Ti 500 */
+#define	PCI_PRODUCT_NVIDIA_QUADRO_DCC	0x0203		/* Quadro DCC */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_6150	0x0240		/* GeForce 6150 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_6150LE	0x0241		/* GeForce 6150 LE */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE4_TI4600	0x0250		/* GeForce4 Ti 4600 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE4_TI4400	0x0251		/* GeForce4 Ti 4400 */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE4_TI4200	0x0253		/* GeForce4 Ti 4200 */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_900XGL	0x0258		/* Quadro4 900XGL */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_750XGL	0x0259		/* Quadro4 750XGL */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_700XGL	0x025b		/* Quadro4 700XGL */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_PCIB	0x0260		/* nForce430 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_SMBUS	0x0264		/* nForce430 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_ATA133	0x0265		/* nForce430 ATA133 IDE Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_SATA1	0x0266		/* nForce430 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_SATA2	0x0267		/* nForce430 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_LAN1	0x0268		/* nForce430 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_LAN2	0x0269		/* nForce430 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_AC	0x026b		/* nForce430 AC-97 Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_HDA	0x026c		/* nForce430 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_OHCI	0x026d		/* nForce430 USB Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_EHCI	0x026e		/* nForce430 USB2 Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_PPB	0x026f		/* nForce430 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_HB	0x0270		/* nForce430 Host Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_MC	0x0272		/* nForce430 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_C51_MC2	0x027e		/* C51 Memory Controller 2 */
+#define	PCI_PRODUCT_NVIDIA_C51_MC3	0x027f		/* C51 Memory Controller 3 */
+#define	PCI_PRODUCT_NVIDIA_GF4_TI_4800	0x0280		/* GeForce4 Ti 4800 */
+#define	PCI_PRODUCT_NVIDIA_GF4_TI_4200_8X	0x0281		/* GeForce4 Ti 4200 (AGP8X) */
+#define	PCI_PRODUCT_NVIDIA_GF4_TI_4800_SE	0x0282		/* GeForce4 Ti 4800 SE */
+#define	PCI_PRODUCT_NVIDIA_GF4_TI_4200_GO	0x0286		/* GeForce4 Ti 4200 Go AGP 8x */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_980_XGL	0x0288		/* Quadro4 980 XGL */
+#define	PCI_PRODUCT_NVIDIA_QUADRO4_780_XGL	0x0289		/* Quadro4 780 XGL */
+#define	PCI_PRODUCT_NVIDIA_QUADRO_FX_1500	0x029e		/* Quadro FX 1500 */
+#define	PCI_PRODUCT_NVIDIA_XBOXFB	0x02a0		/* Xbox Frame Buffer */
+#define	PCI_PRODUCT_NVIDIA_XBOX_PCHB	0x02a5		/* Xbox nForce Host-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_C51_HB_02F0	0x02f0		/* C51 Host Bridge (0x02f0) */
+#define	PCI_PRODUCT_NVIDIA_C51_HB_02F1	0x02f1		/* C51 Host Bridge (0x02f1) */
+#define	PCI_PRODUCT_NVIDIA_C51_HB_02F2	0x02f2		/* C51 Host Bridge (0x02f2) */
+#define	PCI_PRODUCT_NVIDIA_C51_HB_02F3	0x02f3		/* C51 Host Bridge (0x02f3) */
+#define	PCI_PRODUCT_NVIDIA_C51_HB_02F4	0x02f4		/* C51 Host Bridge (0x02f4) */
+#define	PCI_PRODUCT_NVIDIA_C51_HB_02F5	0x02f5		/* C51 Host Bridge (0x02f5) */
+#define	PCI_PRODUCT_NVIDIA_C51_HB_02F6	0x02f6		/* C51 Host Bridge (0x02f6) */
+#define	PCI_PRODUCT_NVIDIA_C51_HB_02F7	0x02f7		/* C51 Host Bridge (0x02f7) */
+#define	PCI_PRODUCT_NVIDIA_C51_MC5	0x02f8		/* C51 Memory Controller 5 */
+#define	PCI_PRODUCT_NVIDIA_C51_MC4	0x02f9		/* C51 Memory Controller 4 */
+#define	PCI_PRODUCT_NVIDIA_C51_MC0	0x02fa		/* C51 Memory Controller 0 */
+#define	PCI_PRODUCT_NVIDIA_C51_PPB_02FB	0x02fb		/* C51 PCI Express Bridge (0x02fb) */
+#define	PCI_PRODUCT_NVIDIA_C51_PPB_02FC	0x02fc		/* C51 PCI Express Bridge (0x02fc) */
+#define	PCI_PRODUCT_NVIDIA_C51_PPB_02FD	0x02fd		/* C51 PCI Express Bridge (0x02fd) */
+#define	PCI_PRODUCT_NVIDIA_C51_MC1	0x02fe		/* C51 Memory Controller 1 */
+#define	PCI_PRODUCT_NVIDIA_C51_HB_02FF	0x02ff		/* C51 Host Bridge (0x02ff) */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_FX5800U	0x0301		/* GeForce FX 5800 Ultra */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_FX5800	0x0302		/* GeForce FX 5800 */
+#define	PCI_PRODUCT_NVIDIA_QUADRO_FX_2000	0x0308		/* Quadro FX 2000 */
+#define	PCI_PRODUCT_NVIDIA_QUADRO_FX_1000	0x0309		/* Quadro FX 1000 */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5600U	0x0311		/* GeForce FX 5600 Ultra */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5600	0x0312		/* GeForce FX 5600 */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5600_SE	0x0314		/* GeForce FX 5600 SE */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5200U	0x0321		/* GeForce FX 5200 Ultra */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5200	0x0322		/* GeForce FX 5200 */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5200SE	0x0323		/* GeForce FX 5200SE */
+#define	PCI_PRODUCT_NVIDIA_QUADRO_FX_500	0x032B		/* Quadro FX 500 */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5900U	0x0330		/* GeForce FX 5900 Ultra */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5900	0x0331		/* GeForce FX 5900 */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5900XT	0x0332		/* GeForce FX 5900XT */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5950U	0x0333		/* GeForce FX 5950 Ultra */
+#define	PCI_PRODUCT_NVIDIA_QUADRO_FX_3000	0x0338		/* Quadro FX 3000 */
+#define	PCI_PRODUCT_NVIDIA_GF_FX5700_LE	0x0343		/* GeForce FX 5700 LE */
+#define	PCI_PRODUCT_NVIDIA_MCP55_LPC2	0x0361		/* nForce MCP55 LPC Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP55_ISA	0x0362		/* nForce MCP55 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP55_LPC	0x0364		/* nForce MCP55 LPC Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP55_SMB	0x0368		/* nForce MCP55 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP55_MEM	0x0369		/* nForce MCP55 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP55_MEM2	0x036a		/* nForce MCP55 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP55_IDE	0x036e		/* nForce MCP55 ATA133 IDE Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP55_OHCI	0x036c		/* nForce MCP55 OHCI USB Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP55_EHCI	0x036d		/* nForce MCP55 EHCI USB Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP55_PPB	0x0370		/* nForce MCP55 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP55_HDA	0x0371		/* nForce MCP55 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP55_LAN1	0x0372		/* nForce MCP55 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP55_LAN2	0x0373		/* nForce MCP55 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP55_PCIE	0x0377		/* nForce MCP55 PCI-Express 16x Port */
+#define	PCI_PRODUCT_NVIDIA_MCP55_PCIE2	0x0378		/* nForce MCP55 PCI-Express 16x Port */
+#define	PCI_PRODUCT_NVIDIA_MCP55_SATA	0x037e		/* nForce MCP55 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP55_SATA2	0x037f		/* nForce MCP55 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_GF_GO_7600	0x0398		/* GeForce Go 7600 */
+#define	PCI_PRODUCT_NVIDIA_MCP61_ISA	0x03e0		/* nForce MCP61 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP61_HDA	0x03e4		/* nForce MCP61 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_LAN1	0x03e5		/* nForce MCP61 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_LAN2	0x03e6		/* nForce MCP61 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_SATA	0x03e7		/* nForce MCP61 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_PPB_1	0x03e8		/* nForce MCP61 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP61_PPB_2	0x03e9		/* nForce MCP61 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP61_MEM	0x03ea		/* nForce MCP61 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_SMB	0x03eb		/* nForce MCP61 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_IDE	0x03ec		/* nForce MCP61 ATA133 IDE Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_LAN3	0x03ee		/* nForce MCP61 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_LAN4	0x03ef		/* nForce MCP61 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_HDA2	0x03f0		/* nForce MCP61 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_OHCI	0x03f1		/* nForce MCP61 OHCI USB Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_EHCI	0x03f2		/* nForce MCP61 EHCI USB Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_PCI	0x03f3		/* nForce MCP61 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP61_SMC	0x03f4		/* nForce MCP61 System Management Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_MEM2	0x03f5		/* nForce MCP61 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_SATA2	0x03f6		/* nForce MCP61 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP61_SATA3	0x03f7		/* nForce MCP61 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_8600GTS	0x0400		/* GeForce 8600 GTS */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_8600GT	0x0402		/* GeForce 8600 GT */
+#define	PCI_PRODUCT_NVIDIA_GF_8500_GT	0x0421		/* GeForce 8500 GT */
+#define	PCI_PRODUCT_NVIDIA_GF_8400M_GS	0x0427		/* GeForce 8400M GS */
+#define	PCI_PRODUCT_NVIDIA_QUADRO_NVS140M	0x0429		/* Quadro NVS 140M */
+#define	PCI_PRODUCT_NVIDIA_MCP65_ISA	0x0440		/* nForce MCP65 PCI-ISA Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP65_LPC1	0x0441		/* nForce MCP65 PCI-LPC Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP65_LPC2	0x0442		/* nForce MCP65 PCI-LPC Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP65_LPC3	0x0443		/* nForce MCP65 PCI-LPC Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP65_MEM	0x0444		/* nForce MCP65 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_MEM2	0x0445		/* nForce MCP65 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_SMB	0x0446		/* nForce MCP65 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_SMU	0x0447		/* nForce MCP65 System Management Unit */
+#define	PCI_PRODUCT_NVIDIA_MCP65_IDE	0x0448		/* nForce MCP65 ATA133 IDE Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_PCI	0x0449		/* nForce MCP65 PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP65_HDA_1	0x044a		/* nForce MCP65 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_HDA_2	0x044b		/* nForce MCP65 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_AHCI_1	0x044c		/* nForce MCP65 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_AHCI_2	0x044d		/* nForce MCP65 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_AHCI_3	0x044e		/* nForce MCP65 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_AHCI_4	0x044f		/* nForce MCP65 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_LAN1	0x0450		/* nForce MCP65 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_LAN2	0x0451		/* nForce MCP65 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_LAN3	0x0452		/* nForce MCP65 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_LAN4	0x0453		/* nForce MCP65 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_USB_1	0x0454		/* nForce MCP65 USB Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_USB_2	0x0455		/* nForce MCP65 USB Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_USB_3	0x0456		/* nForce MCP65 USB Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_USB_4	0x0457		/* nForce MCP65 USB Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_PPB_1	0x0458		/* nForce MCP65 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP65_PPB_2	0x0459		/* nForce MCP65 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP65_PPB_3	0x045a		/* nForce MCP65 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_MCP65_SATA	0x045c		/* nForce MCP65 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_SATA2	0x045d		/* nForce MCP65 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_SATA3	0x045e		/* nForce MCP65 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP65_SATA4	0x045f		/* nForce MCP65 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_SMB	0x0542		/* nForce MCP67 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_LAN1	0x054c		/* nForce MCP67 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_LAN2	0x054d		/* nForce MCP67 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_LAN3	0x054e		/* nForce MCP67 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_LAN4	0x054f		/* nForce MCP67 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_SATA	0x0550		/* nForce MCP67 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_SATA2	0x0551		/* nForce MCP67 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_SATA3	0x0552		/* nForce MCP67 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_SATA4	0x0553		/* nForce MCP67 Serial ATA Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_AHCI_1	0x0554		/* nForce MCP67 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_AHCI_2	0x0555		/* nForce MCP67 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_AHCI_3	0x0556		/* nForce MCP67 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_AHCI_4	0x0557		/* nForce MCP67 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_AHCI_5	0x0558		/* nForce MCP67 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_AHCI_6	0x0559		/* nForce MCP67 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_AHCI_7	0x055a		/* nForce MCP67 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_AHCI_8	0x055b		/* nForce MCP67 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_HDA_1	0x055c		/* nForce MCP67 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_HDA_2	0x055d		/* nForce MCP67 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP67_IDE	0x0560		/* nForce MCP67 ATA133 IDE Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_IDE	0x056c		/* nForce MCP73 ATA133 IDE Controller */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_8800_GT	0x0611		/* GeForce 8800 GT */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_9800_GT	0x0614		/* GeForce 9800 GT */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_9600_GT	0x0622		/* GeForce 9600 GT */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_9500_GT	0x0640		/* GeForce 9500 GT */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_9300_GE_1	0x06e0		/* GeForce 9300 GE */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE8400GS	0x06e4		/* GeForce 8400 GS */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE9300M_GS	0x06e9		/* GeForce 9300M GS */
+#define	PCI_PRODUCT_NVIDIA_QUADRONVS150	0x06ea		/* Quadro NVS 150m */
+#define	PCI_PRODUCT_NVIDIA_QUADRONVS160	0x06eb		/* Quadro NVS 160m */
+#define	PCI_PRODUCT_NVIDIA_MCP77_IDE	0x0759		/* nForce MCP77 ATA133 IDE Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_LAN1	0x0760		/* nForce MCP77 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_LAN2	0x0761		/* nForce MCP77 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_LAN3	0x0762		/* nForce MCP77 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_LAN4	0x0763		/* nForce MCP77 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_HDA_1	0x0774		/* nForce MCP77 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_HDA_2	0x0775		/* nForce MCP77 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_HDA_3	0x0776		/* nForce MCP77 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_HDA_4	0x0777		/* nForce MCP77 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_SMB	0x07d8		/* nForce MCP73 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_LAN1	0x07dc		/* nForce MCP73 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_LAN2	0x07dd		/* nForce MCP73 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_LAN3	0x07de		/* nForce MCP73 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_LAN4	0x07df		/* nForce MCP73 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_1	0x07f0		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_2	0x07f1		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_3	0x07f2		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_4	0x07f3		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_5	0x07f4		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_6	0x07f5		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_7	0x07f6		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_8	0x07f7		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_9	0x07f8		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_10	0x07f9		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_11	0x07fa		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_AHCI_12	0x07fb		/* nForce MCP73 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_HDA_1	0x07fc		/* nForce MCP73 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP73_HDA_2	0x07fd		/* nForce MCP73 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP78S_SMB	0x0752		/* nForce MCP78S SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_210	0x0a65		/* GeForce 210 */
+#define	PCI_PRODUCT_NVIDIA_MCP79_SMB	0x0aa2		/* nForce MCP79 SMBus Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_LAN1	0x0ab0		/* nForce MCP79 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_LAN2	0x0ab1		/* nForce MCP79 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_LAN3	0x0ab2		/* nForce MCP79 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_LAN4	0x0ab3		/* nForce MCP79 Gigabit Ethernet Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_1	0x0ad0		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_2	0x0ad1		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_3	0x0ad2		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_4	0x0ad3		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_5	0x0ad4		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_6	0x0ad5		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_7	0x0ad6		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_8	0x0ad7		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_9	0x0ad8		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_10	0x0ad9		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_11	0x0ada		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP77_AHCI_12	0x0adb		/* nForce MCP77 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_1	0x0ab4		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_2	0x0ab5		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_3	0x0ab6		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_4	0x0ab7		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_5	0x0ab8		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_6	0x0ab9		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_7	0x0aba		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_8	0x0abb		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_9	0x0abc		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_10	0x0abd		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_11	0x0abe		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_MCP79_AHCI_12	0x0abf		/* nForce MCP79 AHCI Controller */
+#define	PCI_PRODUCT_NVIDIA_GEFORCE_210_HDA	0x0be3		/* GeForce 210 High Definition Audio Controller */
+#define	PCI_PRODUCT_NVIDIA_GF_GT640M	0x0fd2		/* GeForce GT 640M */
+#define	PCI_PRODUCT_NVIDIA_GF116	0x1244		/* GeForce GTX 550 Ti */
+
+/* Nvidia & SGS-Thomson Microelectronics */
+#define	PCI_PRODUCT_NVIDIA_SGS_RIVA128	0x0018		/* Riva 128 */
+
+/* Oak Technologies products */
+#define	PCI_PRODUCT_OAKTECH_OTI1007	0x0107		/* OTI107 */
+
+/* Olicom products */
+#define	PCI_PRODUCT_OLICOM_OC3136	0x0001		/* OC-3136/3137 Token-Ring 16/4 */
+#define	PCI_PRODUCT_OLICOM_OC3139	0x0002		/* OC-3139f Fastload 16/4 Token Ring */
+#define	PCI_PRODUCT_OLICOM_OC3140	0x0004		/* OC-3139/3140 RapidFire Token Ring 16/4 */
+#define	PCI_PRODUCT_OLICOM_OC3250	0x0005		/* OC-3250 GoCard Token Ring 16/4 */
+#define	PCI_PRODUCT_OLICOM_OC3530	0x0006		/* OC-3530 RapidFire Token Ring 100 */
+#define	PCI_PRODUCT_OLICOM_OC3141	0x0007		/* OC-3141 RapidFire Token Ring 16/4 */
+#define	PCI_PRODUCT_OLICOM_OC3540	0x0008		/* OC-3540 RapidFire HSTR 100/16/4 */
+#define	PCI_PRODUCT_OLICOM_OC3150	0x000a		/* OC-3150 RapidFire Token-Ring 16/4 */
+#define	PCI_PRODUCT_OLICOM_OC2805	0x0011		/* OC-2805 Ethernet */
+#define	PCI_PRODUCT_OLICOM_OC2325	0x0012		/* OC-2325 Ethernet 10/100 */
+#define	PCI_PRODUCT_OLICOM_OC2183	0x0013		/* OC-2183/2185 Ethernet */
+#define	PCI_PRODUCT_OLICOM_OC2326	0x0014		/* OC-2326 10/100-TX Ethernet */
+#define	PCI_PRODUCT_OLICOM_OC2327	0x0019		/* OC-2327/2350 10/100 Ethernet */
+#define	PCI_PRODUCT_OLICOM_OC6151	0x0021		/* OC-6151/6152 155 Mbit ATM */
+#define	PCI_PRODUCT_OLICOM_OCATM	0x0022		/* ATM */
+
+/* Opti products */
+#define	PCI_PRODUCT_OPTI_82C557	0xc557		/* 82C557 */
+#define	PCI_PRODUCT_OPTI_82C558	0xc558		/* 82C558 */
+#define	PCI_PRODUCT_OPTI_82C568	0xc568		/* 82C568 */
+#define	PCI_PRODUCT_OPTI_82D568	0xd568		/* 82D568 */
+#define	PCI_PRODUCT_OPTI_82C621	0xc621		/* 82C621 */
+#define	PCI_PRODUCT_OPTI_82C822	0xc822		/* 82C822 */
+#define	PCI_PRODUCT_OPTI_82C861	0xc861		/* 82C861 */
+#define	PCI_PRODUCT_OPTI_82C700	0xc700		/* 82C700 */
+#define	PCI_PRODUCT_OPTI_82C701	0xc701		/* 82C701 */
+
+/* Oxford Semiconductor products */
+#define	PCI_PRODUCT_OXFORDSEMI_VSCOM_PCI011H	0x8403		/* 011H */
+#define	PCI_PRODUCT_OXFORDSEMI_OX16PCI954	0x9501		/* OX16PCI954 */
+#define	PCI_PRODUCT_OXFORDSEMI_OX16PCI954K	0x9504		/* OX16PCI954K */
+#define	PCI_PRODUCT_OXFORDSEMI_OXUPCI952	0x9505		/* OXuPCI952 */
+#define	PCI_PRODUCT_OXFORDSEMI_EXSYS_EX41092	0x950a		/* Exsys EX-41092 */
+#define	PCI_PRODUCT_OXFORDSEMI_OXCB950	0x950b		/* OXCB950 */
+#define	PCI_PRODUCT_OXFORDSEMI_OXMPCI954	0x950c		/* OXmPCI954 */
+#define	PCI_PRODUCT_OXFORDSEMI_OXMPCI954D	0x9510		/* OXmPCI954 Disabled */
+#define	PCI_PRODUCT_OXFORDSEMI_EXSYS_EX41098	0x9511		/* Exsys EX-41098 */
+#define	PCI_PRODUCT_OXFORDSEMI_OX16PCI954P	0x9513		/* OX16PCI954 Parallel */
+#define	PCI_PRODUCT_OXFORDSEMI_OX16PCI952	0x9521		/* OX16PCI952 */
+#define	PCI_PRODUCT_OXFORDSEMI_OX16PCI952P	0x9523		/* OX16PCI952 Parallel */
+#define	PCI_PRODUCT_OXFORDSEMI_OX16PCI958	0x9538		/* OX16PCI958 */
+#define	PCI_PRODUCT_OXFORDSEMI_OXPCIE952_0	0xc101		/* OXPCIe952 */
+#define	PCI_PRODUCT_OXFORDSEMI_OXPCIE952_1	0xc105		/* OXPCIe952 */
+#define	PCI_PRODUCT_OXFORDSEMI_OXPCIE952P	0xc110		/* OXPCIe952 Parallel */
+#define	PCI_PRODUCT_OXFORDSEMI_OXPCIE952_2S	0xc120		/* OXPCIe952 2 Serial */
+#define	PCI_PRODUCT_OXFORDSEMI_OXPCIE952_2	0xc124		/* OXPCIe952 */
+#define	PCI_PRODUCT_OXFORDSEMI_OXPCIE952_3	0xc140		/* OXPCIe952 */
+#define	PCI_PRODUCT_OXFORDSEMI_OXPCIE952_4	0xc141		/* OXPCIe952 */
+#define	PCI_PRODUCT_OXFORDSEMI_OXPCIE952_5	0xc144		/* OXPCIe952 */
+#define	PCI_PRODUCT_OXFORDSEMI_OXPCIE952_6	0xc145		/* OXPCIe952 */
+
+/* Packet Engines products */
+#define	PCI_PRODUCT_PACKETENGINES_GNICII	0x0911		/* G-NIC II Ethernet */
+
+/* pcHDTV products */
+#define	PCI_PRODUCT_PCHDTV_HD2000	0x2000		/* HD-2000 HDTV Video Capture */
+#define	PCI_PRODUCT_PCHDTV_HD5500	0x5500		/* HD-5500 HDTV Video Capture */
+
+/* PC Tech products */
+#define	PCI_PRODUCT_PCTECH_RZ1000	0x1000		/* RZ1000 */
+
+/* Peak System Technik products */
+#define	PCI_PRODUCT_PEAK_PCAN	0x0001		/* PCAN CAN Controller */
+
+/* Pericom Semiconductor products */
+#define	PCI_PRODUCT_PERICOM_P17C9X110	0xe110		/* P17C9X110 PCIe to PCI Bridge */
+#define	PCI_PRODUCT_PERICOM_P17C9X	0xe111		/* P17C9X PCIe to PCI Bridge */
+
+/* Phobos products */
+#define	PCI_PRODUCT_PHOBOS_P1000	0x1000		/* P1000 Gigabit Ethernet */
+
+/* Planex products */
+#define	PCI_PRODUCT_PLANEX_FNW_3603_TX	0xab06		/* FNW-3603-TX 10/100 Ethernet */
+#define	PCI_PRODUCT_PLANEX_FNW_3800_TX	0xab07		/* FNW-3800-TX 10/100 Ethernet */
+
+/* PLX Technology products */
+#define	PCI_PRODUCT_PLX_PCI_400	0x1077		/* VScom PCI-400 4 port serial */
+#define	PCI_PRODUCT_PLX_PCI_800	0x1076		/* VScom PCI-800 8 port serial */
+#define	PCI_PRODUCT_PLX_PCI_200	0x1103		/* VScom PCI-200 2 port serial */
+#define	PCI_PRODUCT_PLX_PEX_8111	0x8111		/* PEX 8111 PCIe-to-PCI Bridge */
+#define	PCI_PRODUCT_PLX_PEX_8112	0x8112		/* PEX 8112 PCIe-to-PCI Bridge */
+#define	PCI_PRODUCT_PLX_PEX_8114	0x8114		/* PEX 8114 PCIe-to-PCI/PCI-X Bridge */
+#define	PCI_PRODUCT_PLX_9030	0x9030		/* 9030 I/O Accelrator */
+#define	PCI_PRODUCT_PLX_9050	0x9050		/* 9050 I/O Accelrator */
+#define	PCI_PRODUCT_PLX_9054	0x9054		/* 9054 I/O Accelerator */
+#define	PCI_PRODUCT_PLX_9060ES	0x906e		/* 9060ES PCI Bus Controller */
+#define	PCI_PRODUCT_PLX_9656	0x9656		/* 9656 I/O Accelerator */
+#define	PCI_PRODUCT_PLX_9656FPBGA	0x5601		/* 9656 I/O Accelerator FPBGA */
+
+/* Powerhouse Systems products */
+#define	PCI_PRODUCT_POWERHOUSE_POWERTOP	0x6037		/* PowerTop PowerPC System Controller */
+#define	PCI_PRODUCT_POWERHOUSE_POWERPRO	0x6073		/* PowerPro PowerPC System Controller */
+
+/* ProLAN products - XXX better descriptions */
+#define	PCI_PRODUCT_PROLAN_NE2KETHER	0x1980		/* Ethernet */
+
+/* Promise products */
+#define	PCI_PRODUCT_PROMISE_PDC20265	0x0d30		/* PDC20265 Ultra/66 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20263	0x0d38		/* PDC20263 Ultra/66 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20275	0x1275		/* PDC20275 Ultra/133 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20318	0x3318		/* PDC20318 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20319	0x3319		/* PDC20319 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20371	0x3371		/* PDC20371 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20379	0x3372		/* PDC20379 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20378	0x3373		/* PDC20378 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20375	0x3375		/* PDC20375 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20376	0x3376		/* PDC20376 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20377	0x3377		/* PDC20377 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC40719	0x3515		/* PDC40719 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC40519	0x3519		/* PDC40519 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20771	0x3570		/* PDC20771 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20571	0x3571		/* PDC20571 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20579	0x3574		/* PDC20579 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC40779	0x3577		/* PDC40779 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC40718	0x3d17		/* PDC40718 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC40518	0x3d18		/* PDC40518 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20775	0x3d73		/* PDC20775 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20575	0x3d75		/* PDC20575 Serial ATA Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20267	0x4d30		/* PDC20267 Ultra/100 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20246	0x4d33		/* PDC20246 Ultra/33 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20262	0x4d38		/* PDC20262 Ultra/66 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20268	0x4d68		/* PDC20268 Ultra/100 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20269	0x4d69		/* PDC20269 Ultra/133 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20276	0x5275		/* PDC20276 Ultra/133 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_DC5030	0x5300		/* DC5030 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20270	0x6268		/* PDC20270 Ultra/100 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20271	0x6269		/* PDC20271 Ultra/133 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20617	0x6617		/* PDC20617 Dual Ultra/133 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20620	0x6620		/* PDC20620 Dual Ultra/133 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20621	0x6621		/* PDC20621 Dual Ultra/133 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20618	0x6626		/* PDC20618 Dual Ultra/133 IDE Controler */
+#define	PCI_PRODUCT_PROMISE_PDC20619	0x6629		/* PDC20619 Dual Ultra/133 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20277	0x7275		/* PDC20277 Ultra/133 IDE Controller */
+
+/* Nanjing QinHeng Electronics */
+#define	PCI_PRODUCT_QINHENG_CH352_2S	0x3253		/* CH352 2S */
+#define	PCI_PRODUCT_QINHENG_CH353_4S	0x3453		/* CH353 4S */
+#define	PCI_PRODUCT_QINHENG_CH356_8S	0x3853		/* CH356 8S */
+#define	PCI_PRODUCT_QINHENG_CH356_6S	0x3873		/* CH356 6S */
+#define	PCI_PRODUCT_QINHENG_CH353_2S1PAR	0x5046		/* CH353 2S, 1P (fixed address) */
+#define	PCI_PRODUCT_QINHENG_CH352_1S1P	0x5053		/* CH352 1S, 1P */
+#define	PCI_PRODUCT_QINHENG_CH357_4S	0x5334		/* CH357 4S */
+#define	PCI_PRODUCT_QINHENG_CH358_4S1P	0x5334		/* CH358 4S, 1P */
+#define	PCI_PRODUCT_QINHENG_CH358_8S	0x5338		/* CH358 8S */
+#define	PCI_PRODUCT_QINHENG_CH359_16S	0x5838		/* CH359 16S */
+#define	PCI_PRODUCT_QINHENG_CH353_2S1P	0x7053		/* CH353 2S, 1P */
+#define	PCI_PRODUCT_QINHENG_CH356_4S1P	0x7073		/* CH356 4S, 1P */
+#define	PCI_PRODUCT_QINHENG_CH355_4S	0x7173		/* CH355 4S */
+
+/* Nanjing QinHeng Electronics (PCIe) */
+#define	PCI_PRODUCT_QINHENG2_CH384_4S1P	0x3450		/* CH384 4S, 1P */
+#define	PCI_PRODUCT_QINHENG2_CH384_4S	0x3470		/* CH384 4S */
+#define	PCI_PRODUCT_QINHENG2_CH382_2S1P	0x3250		/* CH382 2S, 1P */
+#define	PCI_PRODUCT_QINHENG2_CH382_2S	0x3253		/* CH382 2S */
+#define	PCI_PRODUCT_QINHENG2_CH384_8S	0x3853		/* CH384 8S */
+#define	PCI_PRODUCT_QINHENG2_CH384_28S	0x4353		/* CH384 28S */
+
+/* QLogic products */
+#define	PCI_PRODUCT_QLOGIC_QLA200	0x0119		/* QLA200 */
+#define	PCI_PRODUCT_QLOGIC_ISP1020	0x1020		/* ISP1020 */
+#define	PCI_PRODUCT_QLOGIC_ISP1022	0x1022		/* ISP1022 */
+#define	PCI_PRODUCT_QLOGIC_ISP1080	0x1080		/* ISP1080 */
+#define	PCI_PRODUCT_QLOGIC_ISP1240	0x1240		/* ISP1240 */
+#define	PCI_PRODUCT_QLOGIC_ISP1280	0x1280		/* ISP1280 */
+#define	PCI_PRODUCT_QLOGIC_ISP2100	0x2100		/* ISP2100 */
+#define	PCI_PRODUCT_QLOGIC_ISP3022	0x3022		/* ISP4022 iSCSI TOE */
+#define	PCI_PRODUCT_QLOGIC_ISP4022	0x4022		/* ISP4022 iSCSI TOE */
+
+/* QUANCOM Electronic GmbH products */
+#define	PCI_PRODUCT_QUANCOM_PWDOG1	0x0010		/* PWDOG1 */
+
+/* Quantum Designs products */
+#define	PCI_PRODUCT_QUANTUMDESIGNS_8500	0x0001		/* 8500 */
+#define	PCI_PRODUCT_QUANTUMDESIGNS_8580	0x0002		/* 8580 */
+
+/* QuickLogic products */
+#define	PCI_PRODUCT_QUICKLOGIC_PCWATCHDOG	0x5030		/* PC Watchdog */
+
+/* Qumranet products */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1000	0x1000		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1001	0x1001		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1002	0x1002		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1003	0x1003		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1004	0x1004		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1005	0x1005		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1006	0x1006		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1007	0x1007		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1008	0x1008		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1009	0x1009		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_100A	0x100a		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_100B	0x100b		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_100C	0x100c		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_100D	0x100d		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_100E	0x100e		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_100F	0x100f		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1010	0x1010		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1011	0x1011		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1012	0x1012		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1013	0x1013		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1014	0x1014		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1015	0x1015		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1016	0x1016		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1017	0x1017		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1018	0x1018		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1019	0x1019		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_101A	0x101a		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_101B	0x101b		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_101C	0x101c		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_101D	0x101d		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_101E	0x101e		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_101F	0x101f		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1020	0x1020		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1021	0x1021		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1022	0x1022		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1023	0x1023		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1024	0x1024		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1025	0x1025		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1026	0x1026		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1027	0x1027		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1028	0x1028		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1029	0x1029		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_102A	0x102a		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_102B	0x102b		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_102C	0x102c		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_102D	0x102d		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_102E	0x102e		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_102F	0x102f		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1030	0x1030		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1031	0x1031		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1032	0x1032		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1033	0x1033		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1034	0x1034		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1035	0x1035		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1036	0x1036		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1037	0x1037		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1038	0x1038		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_1039	0x1039		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_103A	0x103a		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_103B	0x103b		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_103C	0x103c		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_103D	0x103d		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_103E	0x103e		/* Virtio */
+#define	PCI_PRODUCT_QUMRANET_VIRTIO_103F	0x103f		/* Virtio */
+
+/* Rainbow Technologies products */
+#define	PCI_PRODUCT_RAINBOW_CS200	0x0200		/* CryptoSwift 200 PKI Accelerator */
+
+/* Ralink Technologies products */
+#define	PCI_PRODUCT_RALINK_RT2460A	0x0101		/* RT2460A 802.11b */
+#define	PCI_PRODUCT_RALINK_RT2560	0x0201		/* RT2560 802.11b/g */
+#define	PCI_PRODUCT_RALINK_RT2561S	0x0301		/* RT2561S 802.11b/g */
+#define	PCI_PRODUCT_RALINK_RT2561	0x0302		/* RT2561 802.11b/g */
+#define	PCI_PRODUCT_RALINK_RT2661	0x0401		/* RT2661 802.11b/g/n */
+#define	PCI_PRODUCT_RALINK_RT3090	0x3090		/* RT3090 802.11b/g/n */
+
+/* RATOC Systems products */
+#define	PCI_PRODUCT_RATOC_REXPCI31	0x0853		/* REX PCI-31/33 SCSI */
+
+/* RDC Semiconductor products */
+#define	PCI_PRODUCT_RDC_R1010_IDE	0x1010		/* R1010 IDE controller */
+#define	PCI_PRODUCT_RDC_R1011_IDE	0x1011		/* R1011 IDE controller */
+#define	PCI_PRODUCT_RDC_R1012_IDE	0x1012		/* R1012 IDE controller */
+#define	PCI_PRODUCT_RDC_R6021_HB	0x6021		/* R6021 Host */
+#define	PCI_PRODUCT_RDC_R6025_HB	0x6025		/* R6025 Host */
+#define	PCI_PRODUCT_RDC_R6031_ISA	0x6031		/* R6031 PCI-ISA bridge */
+#define	PCI_PRODUCT_RDC_PCIB	0x6036		/* R6036 PCI-ISA bridge */
+#define	PCI_PRODUCT_RDC_R6040	0x6040		/* R6040 10/100 Ethernet */
+#define	PCI_PRODUCT_RDC_R6060_OHCI	0x6060		/* R6060 USB OHCI */
+#define	PCI_PRODUCT_RDC_R6061_EHCI	0x6061		/* R6061 USB EHCI */
+
+/* Realtek products */
+#define	PCI_PRODUCT_REALTEK_RTS5209	0x5209		/* RTS5209 PCI-E Card Reader */
+#define	PCI_PRODUCT_REALTEK_RTS5227	0x5227		/* RTS5227 PCI-E Card Reader */
+#define	PCI_PRODUCT_REALTEK_RTS5229	0x5229		/* RTS5229 PCI-E Card Reader */
+#define	PCI_PRODUCT_REALTEK_RTS5249	0x5249		/* RTS5249 PCI-E Card Reader */
+#define	PCI_PRODUCT_REALTEK_RTL8402	0x5286		/* RTL8402 PCI-E Card Reader */
+#define	PCI_PRODUCT_REALTEK_RTL8411B	0x5287		/* RTL8411B PCI-E Card Reader */
+#define	PCI_PRODUCT_REALTEK_RTL8411	0x5289		/* RTL8411 PCI-E Card Reader */
+#define	PCI_PRODUCT_REALTEK_RT8029	0x8029		/* 8029 Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8139D	0x8039		/* 8139D 10/100 Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8100	0x8100		/* 8100 10/100 Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8129	0x8129		/* 8129 10/100 Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8101E	0x8136		/* 8100E/8101E/8102E 10/100 Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8138	0x8138		/* 8138 10/100 Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8139	0x8139		/* 8139 10/100 Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8169SC	0x8167		/* 8169SC/8110SC 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8168	0x8168		/* 8168/8111 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8169	0x8169		/* 8169/8110 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_REALTEK_RTL8188CE	0x8176		/* RTL8188CE Wireless LAN 802.11n PCI-E NIC */
+#define	PCI_PRODUCT_REALTEK_RTL8192CE	0x8178		/* RTL8192CE Wireless LAN 802.11n PCI-E NIC */
+#define	PCI_PRODUCT_REALTEK_RTL8188EE	0x8179		/* RTL8188EE Wireless LAN 802.11n PCI-E NIC */
+#define	PCI_PRODUCT_REALTEK_RT8180	0x8180		/* 8180 802.11b */
+#define	PCI_PRODUCT_REALTEK_RT8185	0x8185		/* 8185 802.11a/b/g */
+
+/* Red Hat products */
+#define	PCI_PRODUCT_REDHAT_PPB	0x0001		/* Qemu PCI-PCI */
+#define	PCI_PRODUCT_REDHAT_QXL	0x0100		/* QXL Video */
+
+/* Renesas products */
+#define	PCI_PRODUCT_RENESAS_SH7780	0x0002		/* SH7780 PCI Controller */
+#define	PCI_PRODUCT_RENESAS_SH7785	0x0007		/* SH7785 PCI Controller */
+#define	PCI_PRODUCT_RENESAS_SH7757_PBI	0x0011		/* SH7757 PCIe End-Point [PBI] */
+#define	PCI_PRODUCT_RENESAS_SH7757_PPB	0x0012		/* SH7757 PCIe-PCI Bridge [PPB] */
+#define	PCI_PRODUCT_RENESAS_SH7757_PS	0x0013		/* SH7757 PCIe Switch [PS] */
+#define	PCI_PRODUCT_RENESAS_PD720201	0x0014		/* uPD720201 USB 3.0 Host Controller */
+#define	PCI_PRODUCT_RENESAS_PD720202	0x0015		/* uPD720202 USB 3.0 Host Controller */
+
+/* Ricoh products */
+#define	PCI_PRODUCT_RICOH_Rx5C465	0x0465		/* 5C465 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_RICOH_Rx5C466	0x0466		/* 5C466 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_RICOH_Rx5C475	0x0475		/* 5C475 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_RICOH_RL5C476	0x0476		/* 5C476 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_RICOH_Rx5C477	0x0477		/* 5C477 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_RICOH_Rx5C478	0x0478		/* 5C478 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_RICOH_Rx5C551	0x0551		/* 5C551 PCI-CardBus Bridge/Firewire */
+#define	PCI_PRODUCT_RICOH_Rx5C552	0x0552		/* 5C552 PCI-CardBus Bridge/Firewire */
+#define	PCI_PRODUCT_RICOH_Rx5C592	0x0592		/* 5C592 PCI-CardBus Bridge/MS/SD/Firewire */
+#define	PCI_PRODUCT_RICOH_Rx5C593	0x0593		/* 5C593 PCI-CardBus Bridge/MS/SD/Firewire */
+#define	PCI_PRODUCT_RICOH_Rx5C821	0x0821		/* 5C821 PCI-CardBus Bridge/MS/SD/MMC/SC */
+#define	PCI_PRODUCT_RICOH_Rx5C822	0x0822		/* 5C822 PCI-CardBus Bridge/MS/SD/MMC/SC */
+#define	PCI_PRODUCT_RICOH_Rx5C832	0x0832		/* 5C832 PCI-SD/MMC/MMC+/MS/xD/Firewire */
+#define	PCI_PRODUCT_RICOH_Rx5C843	0x0843		/* 5C843 PCI-CardBus Bridge/SD/MMC/MMC+/MS/xD/Firewire */
+#define	PCI_PRODUCT_RICOH_Rx5C847	0x0847		/* 5C847 PCI-CardBus Bridge/SD/MMC/MMC+/MS/xD/Firewire */
+#define	PCI_PRODUCT_RICOH_RxDPCC	0x0852		/* xD-Picture Card Controller */
+#define	PCI_PRODUCT_RICOH_Rx5C853	0x0853		/* 5C853 PCI-CardBus Bridge/SD/MMC/MMC+/MS/xD/SC/Firewire */
+#define	PCI_PRODUCT_RICOH_Rx5U230	0xe230		/* 5U230 FireWire/SD/MMC/xD/MS Controller */
+#define	PCI_PRODUCT_RICOH_Rx5U822	0xe822		/* 5U822 SD/MMC Controller */
+#define	PCI_PRODUCT_RICOH_Rx5U823	0xe823		/* 5U823 SD/MMC Controller */
+#define	PCI_PRODUCT_RICOH_Rx5U832	0xe832		/* 5U832 Firewire Controller */
+#define	PCI_PRODUCT_RICOH_Rx5C852	0xe852		/* 5C852 xD Controller */
+
+/* RISCom (SDL Communications?) products */
+#define	PCI_PRODUCT_RISCOM_N2	0x5568		/* N2 */
+
+/* RNS products */
+#define	PCI_PRODUCT_RNS_FDDI	0x2200		/* 2200 FDDI */
+
+/* S2io products */
+#define	PCI_PRODUCT_S2IO_XFRAME	0x5831		/* Xframe 10 Gigabit Ethernet Adapter */
+#define	PCI_PRODUCT_S2IO_XFRAME2	0x5832		/* Xframe2 10 Gigabit Ethernet Adapter */
+#define	PCI_PRODUCT_S2IO_XFRAME3	0x5833		/* Xframe3 10 Gigabit Ethernet Adapter */
+
+/* S3 products */
+#define	PCI_PRODUCT_S3_VIRGE	0x5631		/* ViRGE */
+#define	PCI_PRODUCT_S3_TRIO32	0x8810		/* Trio32 */
+#define	PCI_PRODUCT_S3_TRIO64	0x8811		/* Trio32/64 */
+#define	PCI_PRODUCT_S3_AURORA64P	0x8812		/* Aurora64V+ */
+#define	PCI_PRODUCT_S3_TRIO64UVP	0x8814		/* Trio64UV+ */
+#define	PCI_PRODUCT_S3_VIRGE_VX	0x883d		/* ViRGE/VX */
+#define	PCI_PRODUCT_S3_868	0x8880		/* 868 */
+#define	PCI_PRODUCT_S3_928	0x88b0		/* 86C928 */
+#define	PCI_PRODUCT_S3_864_0	0x88c0		/* 86C864-0 (\"Vision864\") */
+#define	PCI_PRODUCT_S3_864_1	0x88c1		/* 86C864-1 (\"Vision864\") */
+#define	PCI_PRODUCT_S3_864_2	0x88c2		/* 86C864-2 (\"Vision864\") */
+#define	PCI_PRODUCT_S3_864_3	0x88c3		/* 86C864-3 (\"Vision864\") */
+#define	PCI_PRODUCT_S3_964_0	0x88d0		/* 86C964-0 (\"Vision964\") */
+#define	PCI_PRODUCT_S3_964_1	0x88d1		/* 86C964-1 (\"Vision964\") */
+#define	PCI_PRODUCT_S3_964_2	0x88d2		/* 86C964-2 (\"Vision964\") */
+#define	PCI_PRODUCT_S3_964_3	0x88d3		/* 86C964-3 (\"Vision964\") */
+#define	PCI_PRODUCT_S3_968_0	0x88f0		/* 86C968-0 (\"Vision968\") */
+#define	PCI_PRODUCT_S3_968_1	0x88f1		/* 86C968-1 (\"Vision968\") */
+#define	PCI_PRODUCT_S3_968_2	0x88f2		/* 86C968-2 (\"Vision968\") */
+#define	PCI_PRODUCT_S3_968_3	0x88f3		/* 86C968-3 (\"Vision968\") */
+#define	PCI_PRODUCT_S3_TRIO64V2_DX	0x8901		/* Trio64V2/DX */
+/* pcidatbase.com has this as 0x0551, I'd rather believe linux's 8902 */
+#define	PCI_PRODUCT_S3_PLATO_PX	0x8902		/* Plato/PX */
+#define	PCI_PRODUCT_S3_TRIO3D	0x8904		/* 86C365 Trio3D */
+#define	PCI_PRODUCT_S3_VIRGE_DX	0x8a01		/* ViRGE/DX */
+#define	PCI_PRODUCT_S3_VIRGE_GX2	0x8a10		/* ViRGE/GX2 */
+#define	PCI_PRODUCT_S3_TRIO3D2X	0x8a13		/* Trio3D/2X */
+#define	PCI_PRODUCT_S3_SAVAGE3D	0x8a20		/* Savage3D */
+#define	PCI_PRODUCT_S3_SAVAGE3D_MV	0x8a21		/* Savage3D+MV */
+#define	PCI_PRODUCT_S3_SAVAGE4	0x8a22		/* Savage4 */
+#define	PCI_PRODUCT_S3_PROSAVAGE_KM133	0x8a26		/* ProSavage KM133 */
+#define	PCI_PRODUCT_S3_VIRGE_MX	0x8c01		/* ViRGE/MX */
+#define	PCI_PRODUCT_S3_VIRGE_MXP	0x8c03		/* ViRGE/MXP */
+#define	PCI_PRODUCT_S3_SAVAGE_MX_MV	0x8c10		/* Savage/MX+MV */
+#define	PCI_PRODUCT_S3_SAVAGE_MX	0x8c11		/* Savage/MX */
+#define	PCI_PRODUCT_S3_SAVAGE_IX_MV	0x8c12		/* Savage/IX+MV */
+#define	PCI_PRODUCT_S3_SAVAGE_IX	0x8c13		/* Savage/IX */
+#define	PCI_PRODUCT_S3_SAVAGE_IXC	0x8c2e		/* Savage/IXC */
+#define	PCI_PRODUCT_S3_SAVAGE2000	0x9102		/* Savage2000 */
+#define	PCI_PRODUCT_S3_SONICVIBES	0xca00		/* SonicVibes */
+
+/* SafeNet products */
+#define	PCI_PRODUCT_SAFENET_SAFEXCEL	0x1141		/* SafeXcel */
+
+/* Samsung Electronics products */
+#define	PCI_PRODUCT_SAMSUNGELEC3_XP941	0xa800		/* XP941 M.2 SSD */
+#define	PCI_PRODUCT_SAMSUNGELEC3_SM951	0xa801		/* SM951 M.2 SSD */
+
+/* Samsung Semiconductor products */
+#define	PCI_PRODUCT_SAMSUNGSEMI_KS8920	0x8920		/* KS8920 10/100 Ethernet */
+
+/* Sandburst products */
+#define	PCI_PRODUCT_SANDBURST_QE1000	0x0180		/* QE1000 */
+#define	PCI_PRODUCT_SANDBURST_FE1000	0x0200		/* FE1000 */
+/*product SANDBURST	SE1600	0x0100	SE1600*/
+
+/* SEGA Enterprises products */
+#define	PCI_PRODUCT_SEGA_BROADBAND	0x1234		/* Broadband Adapter */
+
+/* ServerWorks products */
+#define	PCI_PRODUCT_SERVERWORKS_CNB20_LE_AGP	0x0005		/* CNB20-LE PCI/AGP Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CNB30_LE_PCI	0x0006		/* CNB30-LE PCI Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CNB20_LE_PCI	0x0007		/* CNB20-LE PCI Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CNB20_HE_PCI	0x0008		/* CNB20-HE PCI Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CNB20_HE_AGP	0x0009		/* CNB20-HE PCI/AGP Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CIOB_X	0x0010		/* CIOB-X PCI-X Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CMIC_HE	0x0011		/* CMIC-HE PCI/AGP Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CNB30_HE	0x0012		/* CNB30-HE PCI Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CNB20_HE_PCI2	0x0013		/* CNB20-HE PCI/AGP Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CMIC_LE	0x0014		/* CMIC-LE PCI/AGP Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CMIC_SL	0x0017		/* CMIC-SL PCI/AGP Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_HT1000_PPB0	0x0036		/* HT1000 PCI/PCI-X Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CIOB_X2	0x0101		/* CIOB-X2 PCI-X Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_BCM5714	0x0103		/* BCM5714/BCM5715 Integral PCI-E to PCI-X Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_HT1000_PPB1	0x0104		/* HT1000 PCI/PCI-X Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CIOB_E	0x0110		/* CIOB-E PCI-X Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_HT2100_PPB0	0x0140		/* HT2100 PCI-Express Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_HT2100_PPB1	0x0141		/* HT2100 PCI-Express Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_HT2100_PPB2	0x0142		/* HT2100 PCI-Express Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_HT2100_PPB3	0x0144		/* HT2100 PCI-Express Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_OSB4	0x0200		/* OSB4 South Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CSB5	0x0201		/* CSB5 South Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CSB6	0x0203		/* CSB6 South Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_HT1000SB	0x0205		/* HT1000SB South Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_OSB4_IDE	0x0211		/* OSB4 IDE */
+#define	PCI_PRODUCT_SERVERWORKS_CSB5_IDE	0x0212		/* CSB5 IDE */
+#define	PCI_PRODUCT_SERVERWORKS_HT1000_IDE	0x0214		/* HT-1000 IDE Controller */
+#define	PCI_PRODUCT_SERVERWORKS_CSB6_RAID	0x0213		/* CSB6 IDE/RAID */
+#define	PCI_PRODUCT_SERVERWORKS_CSB6_IDE	0x0217		/* CSB6 IDE/RAID */
+#define	PCI_PRODUCT_SERVERWORKS_OSB4_USB	0x0220		/* OSB4/CSB5 USB Host Controller */
+#define	PCI_PRODUCT_SERVERWORKS_CSB6_USB	0x0221		/* CSB6 USB Host Controller */
+#define	PCI_PRODUCT_SERVERWORKS_HT1000_USB	0x0223		/* HT1000 USB */
+#define	PCI_PRODUCT_SERVERWORKS_CSB5_LPC	0x0225		/* CSB5 ISA/LPC Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_CSB6_LPC	0x0227		/* CSB6 ISA/LPC Bridge */
+#define	PCI_PRODUCT_SERVERWORKS_HT1000_LPC	0x0234		/* HT1000 LPC */
+#define	PCI_PRODUCT_SERVERWORKS_HT1000_XIOAPIC	0x0235		/* HT1000 XIOAPIC */
+#define	PCI_PRODUCT_SERVERWORKS_HT1000_WDTIMER	0x0238		/* HT1000 Watchdog Timer */
+#define	PCI_PRODUCT_SERVERWORKS_K2_SATA	0x0240		/* K2 SATA */
+#define	PCI_PRODUCT_SERVERWORKS_FRODO4_SATA	0x0241		/* Frodo4 SATA */
+#define	PCI_PRODUCT_SERVERWORKS_FRODO8_SATA	0x0242		/* Frodo8 SATA */
+#define	PCI_PRODUCT_SERVERWORKS_HT1000_SATA_1	0x024a		/* HT-1000 SATA */
+#define	PCI_PRODUCT_SERVERWORKS_HT1000_SATA_2	0x024b		/* HT-1000 SATA */
+
+/* SGI products */
+#define	PCI_PRODUCT_SGI_IOC3	0x0003		/* IOC3 */
+#define	PCI_PRODUCT_SGI_RAD1	0x0005		/* PsiTech RAD1 */
+#define	PCI_PRODUCT_SGI_TIGON	0x0009		/* Tigon Gigabit Ethernet */
+
+/* SGS-Thomson products */
+#define	PCI_PRODUCT_SGSTHOMSON_2000	0x0008		/* STG 2000X */
+#define	PCI_PRODUCT_SGSTHOMSON_1764	0x1746		/* STG 1764X */
+
+/* Broadcom (SiByte) products */
+#define	PCI_PRODUCT_SIBYTE_BCM1250_PCIHB	0x0001		/* BCM1250 PCI Host Bridge */
+#define	PCI_PRODUCT_SIBYTE_BCM1250_LDTHB	0x0002		/* BCM1250 LDT Host Bridge */
+
+/* Sigma Designs products */
+#define	PCI_PRODUCT_SIGMA_HOLLYWOODPLUS	0x8300		/* REALmagic Hollywood-Plus MPEG-2 Decoder */
+
+/* SIIG Inc products */
+#define	PCI_PRODUCT_SIIG_CYBER10_S550	0x1000		/* Cyber10x Serial 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_S650	0x1001		/* Cyber10x Serial 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_S850	0x1002		/* Cyber10x Serial 16850 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_IO550	0x1010		/* Cyber10x I/O 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_IO650	0x1011		/* Cyber10x I/O 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_IO850	0x1012		/* Cyber10x I/O 16850 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_P	0x1020		/* Cyber10x Parallel PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_2P	0x1021		/* Cyber10x Parallel Dual PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_2S550	0x1030		/* Cyber10x Serial Dual 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_2S650	0x1031		/* Cyber10x Serial Dual 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_2S850	0x1032		/* Cyber10x Serial Dual 16850 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_2S1P550	0x1034		/* Cyber10x 2S1P 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_2S1P650	0x1035		/* Cyber10x 2S1P 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_2S1P850	0x1036		/* Cyber10x 2S1P 16850 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_4S550	0x1050		/* Cyber10x 4S 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_4S650	0x1051		/* Cyber10x 4S 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER10_4S850	0x1052		/* Cyber10x 4S 16850 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_S550	0x2000		/* Cyber20x Serial 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_S650	0x2001		/* Cyber20x Serial 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_S850	0x2002		/* Cyber20x Serial 16850 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_IO550	0x2010		/* Cyber20x I/O 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_IO650	0x2011		/* Cyber20x I/O 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_IO850	0x2012		/* Cyber20x I/O 16850 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_P	0x2020		/* Cyber20x Parallel PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_2P	0x2021		/* Cyber20x Parallel Dual PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_2S550	0x2030		/* Cyber20x Serial Dual 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_2S650	0x2031		/* Cyber20x Serial Dual 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_2S850	0x2032		/* Cyber20x Serial Dual 16850 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_2P1S550	0x2040		/* Cyber20x 2P1S 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_2P1S650	0x2041		/* Cyber20x 2P1S 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_2P1S850	0x2042		/* Cyber20x 2P1S 16850 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_4S550	0x2050		/* Cyber20x 4S 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_4S650	0x2051		/* Cyber20x 4S 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_4S850	0x2052		/* Cyber20x 4S 16850 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_2S1P550	0x2060		/* Cyber20x 2S1P 16550 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_2S1P650	0x2061		/* Cyber20x 2S1P 16650 PCI */
+#define	PCI_PRODUCT_SIIG_CYBER20_2S1P850	0x2062		/* Cyber20x 2S1P 16850 PCI */
+#define	PCI_PRODUCT_SIIG_PS8000P550	0x2080		/* PCI Serial 8000 Plus 16550 */
+#define	PCI_PRODUCT_SIIG_PS8000P650	0x2081		/* PCI Serial 8000 Plus 16650 */
+#define	PCI_PRODUCT_SIIG_PS8000P850	0x2082		/* PCI Serial 8000 Plus 16850 */
+
+/* Silicon Integrated System products */
+#define	PCI_PRODUCT_SIS_86C201	0x0001		/* 86C201 */
+#define	PCI_PRODUCT_SIS_86C202	0x0002		/* 86C202 */
+#define	PCI_PRODUCT_SIS_86C205	0x0005		/* 86C205 */
+#define	PCI_PRODUCT_SIS_85C503	0x0008		/* 85C503 or 5597/5598 ISA Bridge */
+#define	PCI_PRODUCT_SIS_600PMC	0x0009		/* 600 Power Mngmt Controller */
+#define	PCI_PRODUCT_SIS_180_SATA	0x0180		/* 180 SATA Controller */
+#define	PCI_PRODUCT_SIS_181_SATA	0x0181		/* 181 SATA Controller */
+#define	PCI_PRODUCT_SIS_182_SATA	0x0182		/* 182 SATA Controller */
+#define	PCI_PRODUCT_SIS_183_SATA	0x0183		/* 183 SATA controller */
+#define	PCI_PRODUCT_SIS_190	0x0190		/* 190 Ethernet */
+#define	PCI_PRODUCT_SIS_191	0x0191		/* 191 Gigabit Ethernet */
+#define	PCI_PRODUCT_SIS_5597_VGA	0x0200		/* 5597/5598 Integrated VGA */
+#define	PCI_PRODUCT_SIS_300	0x0300		/* 300/305 AGP VGA */
+#define	PCI_PRODUCT_SIS_315PRO_VGA	0x0325		/* 315 Pro VGA */
+#define	PCI_PRODUCT_SIS_85C501	0x0406		/* 85C501 */
+#define	PCI_PRODUCT_SIS_85C496	0x0496		/* 85C496 */
+#define	PCI_PRODUCT_SIS_530HB	0x0530		/* 530 Host-PCI Bridge */
+#define	PCI_PRODUCT_SIS_540HB	0x0540		/* 540 Host-PCI Bridge */
+#define	PCI_PRODUCT_SIS_550HB	0x0550		/* 550 Host-PCI Bridge */
+#define	PCI_PRODUCT_SIS_85C601	0x0601		/* 85C601 */
+#define	PCI_PRODUCT_SIS_620	0x0620		/* 620 Host Bridge */
+#define	PCI_PRODUCT_SIS_630	0x0630		/* 630 Host Bridge */
+#define	PCI_PRODUCT_SIS_633	0x0633		/* 633 Host Bridge */
+#define	PCI_PRODUCT_SIS_635	0x0635		/* 635 Host Bridge */
+#define	PCI_PRODUCT_SIS_640	0x0640		/* 640 Host Bridge */
+#define	PCI_PRODUCT_SIS_645	0x0645		/* 645 Host Bridge */
+#define	PCI_PRODUCT_SIS_646	0x0646		/* 646 Host Bridge */
+#define	PCI_PRODUCT_SIS_648	0x0648		/* 648 Host Bridge */
+#define	PCI_PRODUCT_SIS_650	0x0650		/* 650 Host Bridge */
+#define	PCI_PRODUCT_SIS_651	0x0651		/* 651 Host Bridge */
+#define	PCI_PRODUCT_SIS_652	0x0652		/* 652 Host Bridge */
+#define	PCI_PRODUCT_SIS_655	0x0655		/* 655 Host Bridge */
+#define	PCI_PRODUCT_SIS_658	0x0658		/* 658 Host Bridge */
+#define	PCI_PRODUCT_SIS_661	0x0661		/* 661 Host Bridge */
+#define	PCI_PRODUCT_SIS_671	0x0671		/* 671 Host Bridge */
+#define	PCI_PRODUCT_SIS_730	0x0730		/* 730 Host Bridge */
+#define	PCI_PRODUCT_SIS_733	0x0733		/* 733 Host Bridge */
+#define	PCI_PRODUCT_SIS_735	0x0735		/* 735 Host Bridge */
+#define	PCI_PRODUCT_SIS_740	0x0740		/* 740 Host Bridge */
+#define	PCI_PRODUCT_SIS_741	0x0741		/* 741 Host Bridge */
+#define	PCI_PRODUCT_SIS_745	0x0745		/* 745 Host Bridge */
+#define	PCI_PRODUCT_SIS_746	0x0746		/* 746 Host Bridge */
+#define	PCI_PRODUCT_SIS_748	0x0748		/* 748 Host Bridge */
+#define	PCI_PRODUCT_SIS_750	0x0750		/* 750 Host Bridge */
+#define	PCI_PRODUCT_SIS_751	0x0751		/* 751 Host Bridge */
+#define	PCI_PRODUCT_SIS_752	0x0752		/* 752 Host Bridge */
+#define	PCI_PRODUCT_SIS_755	0x0755		/* 755 Host Bridge */
+#define	PCI_PRODUCT_SIS_756	0x0756		/* 756 Host Bridge */
+#define	PCI_PRODUCT_SIS_760	0x0760		/* 760 Host Bridge */
+#define	PCI_PRODUCT_SIS_761	0x0761		/* 761 Host Bridge */
+#define	PCI_PRODUCT_SIS_900	0x0900		/* 900 10/100 Ethernet */
+#define	PCI_PRODUCT_SIS_961	0x0961		/* 961 Host Bridge */
+#define	PCI_PRODUCT_SIS_962	0x0962		/* 962 Host Bridge */
+#define	PCI_PRODUCT_SIS_963	0x0963		/* 963 Host Bridge */
+#define	PCI_PRODUCT_SIS_964	0x0964		/* 964 Host Bridge */
+#define	PCI_PRODUCT_SIS_965	0x0965		/* 965 Host Bridge */
+#define	PCI_PRODUCT_SIS_966	0x0966		/* 966 Host Bridge */
+#define	PCI_PRODUCT_SIS_968	0x0968		/* 968 Host Bridge */
+#define	PCI_PRODUCT_SIS_5597_IDE	0x5513		/* 5597/5598 IDE Controller */
+#define	PCI_PRODUCT_SIS_5597_HB	0x5597		/* 5597/5598 Host Bridge */
+#define	PCI_PRODUCT_SIS_530VGA	0x6306		/* 530 GUI Accelerator+3D */
+#define	PCI_PRODUCT_SIS_6325	0x6325		/* 6325 AGP VGA */
+#define	PCI_PRODUCT_SIS_6326	0x6326		/* 6326 AGP VGA */
+#define	PCI_PRODUCT_SIS_5597_USB	0x7001		/* 5597/5598 USB Host Controller */
+#define	PCI_PRODUCT_SIS_7002	0x7002		/* 7002 USB 2.0 Host Controller */
+#define	PCI_PRODUCT_SIS_7012_AC	0x7012		/* 7012 AC-97 Sound */
+#define	PCI_PRODUCT_SIS_7016	0x7016		/* 7016 10/100 Ethernet */
+#define	PCI_PRODUCT_SIS_7018	0x7018		/* 7018 Sound */
+#define	PCI_PRODUCT_SIS_7502	0x7502		/* 7502 HD audio */
+
+/* Silicon Motion products */
+#define	PCI_PRODUCT_SILMOTION_SM502	0x0501		/* Voyager GX */
+#define	PCI_PRODUCT_SILMOTION_SM710	0x0710		/* LynxEM */
+#define	PCI_PRODUCT_SILMOTION_SM712	0x0712		/* LynxEM+ */
+#define	PCI_PRODUCT_SILMOTION_SM720	0x0720		/* Lynx3DM */
+#define	PCI_PRODUCT_SILMOTION_SM810	0x0810		/* LynxE */
+#define	PCI_PRODUCT_SILMOTION_SM811	0x0811		/* LynxE */
+#define	PCI_PRODUCT_SILMOTION_SM820	0x0820		/* Lynx3D */
+#define	PCI_PRODUCT_SILMOTION_SM910	0x0910		/* Lynx */
+
+/* SMC products */
+#define	PCI_PRODUCT_SMC_37C665	0x1000		/* FDC37C665 */
+#define	PCI_PRODUCT_SMC_37C922	0x1001		/* FDC37C922 */
+#define	PCI_PRODUCT_SMC_83C170	0x0005		/* 83C170 (\"EPIC/100\") Fast Ethernet */
+#define	PCI_PRODUCT_SMC_83C175	0x0006		/* 83C175 (\"EPIC/100\") Fast Ethernet */
+
+/* Solidum Systems */
+#define	PCI_PRODUCT_SOLIDUM_AMD971	0x2000		/* SNP8023: AMD 971 */
+#define	PCI_PRODUCT_SOLIDUM_CLASS802	0x8023		/* SNP8023: Classifier Engine */
+#define	PCI_PRODUCT_SOLIDUM_PAXWARE1100	0x1100		/* PAX.ware 1100 Dual Gb Classifier Engine */
+
+/* Sony products */
+#define	PCI_PRODUCT_SONY_CXD1947A	0x8009		/* CXD1947A IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_SONY_CXD3222	0x8039		/* CXD3222 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_SONY_MEMSTICK	0x808a		/* Memory Stick I/F Controller */
+
+/* Sun Microsystems products */
+#define	PCI_PRODUCT_SUN_EBUS	0x1000		/* PCIO Ebus2 */
+#define	PCI_PRODUCT_SUN_HMENETWORK	0x1001		/* PCIO Happy Meal Ethernet */
+#define	PCI_PRODUCT_SUN_EBUSIII	0x1100		/* PCIO Ebus2 (US III) */
+#define	PCI_PRODUCT_SUN_ERINETWORK	0x1101		/* ERI Ethernet */
+#define	PCI_PRODUCT_SUN_FIREWIRE	0x1102		/* FireWire Controller */
+#define	PCI_PRODUCT_SUN_USB	0x1103		/* USB Controller */
+#define	PCI_PRODUCT_SUN_GEMNETWORK	0x2bad		/* GEM Gigabit Ethernet */
+#define	PCI_PRODUCT_SUN_SIMBA	0x5000		/* Simba PCI Bridge */
+#define	PCI_PRODUCT_SUN_5821	0x5454		/* BCM5821 */
+#define	PCI_PRODUCT_SUN_SCA1K	0x5455		/* Crypto Accelerator 1000 */
+#define	PCI_PRODUCT_SUN_PSYCHO	0x8000		/* psycho PCI Controller */
+#define	PCI_PRODUCT_SUN_MS_IIep	0x9000		/* microSPARC IIep PCI */
+#define	PCI_PRODUCT_SUN_US_IIi	0xa000		/* UltraSPARC IIi PCI */
+#define	PCI_PRODUCT_SUN_US_IIe	0xa001		/* UltraSPARC IIe PCI */
+#define	PCI_PRODUCT_SUN_CASSINI	0xabba		/* Cassini Gigabit Ethernet */
+
+/* Sundance Technology products */
+#define	PCI_PRODUCT_SUNDANCETI_IP100A	0x0200		/* IP100A 10/100 Ethernet */
+#define	PCI_PRODUCT_SUNDANCETI_ST201	0x0201		/* ST201 10/100 Ethernet */
+#define	PCI_PRODUCT_SUNDANCETI_ST1023	0x1023		/* ST1023 Gigabit Ethernet */
+#define	PCI_PRODUCT_SUNDANCETI_ST2021	0x2021		/* ST2021 Gigabit Ethernet */
+
+/* SUNIX products */
+#define	PCI_PRODUCT_SUNIX2_0001	0x0001		/* Matrix serial adapter */
+#define	PCI_PRODUCT_SUNIX2_SER5XXXX	0x1999		/* SER5xxx multiport serial */
+#define	PCI_PRODUCT_SUNIX_PCI2S550	0x7168		/* PCI2S550 multiport serial */
+#define	PCI_PRODUCT_SUNIX_SUN1888	0x7268		/* SUN1888 multiport parallel */
+
+/* Surecom Technology products */
+#define	PCI_PRODUCT_SURECOM_NE34	0x0e34		/* NE-34 Ethernet */
+
+/* Syba */
+#define	PCI_PRODUCT_SYBA_4S2P	0x0781		/* 4S2P */
+#define	PCI_PRODUCT_SYBA_4S	0x0786		/* 4S */
+
+/* Symphony Labs products */
+#define	PCI_PRODUCT_SYMPHONY_82C101	0x0001		/* 82C101 */
+#define	PCI_PRODUCT_SYMPHONY_82C103	0x0103		/* 82C103 */
+#define	PCI_PRODUCT_SYMPHONY_82C105	0x0105		/* 82C105 */
+#define	PCI_PRODUCT_SYMPHONY2_82C101	0x0001		/* 82C101 */
+#define	PCI_PRODUCT_SYMPHONY_83C553	0x0565		/* 83C553 PCI-ISA Bridge */
+
+/* System Base products */
+#define	PCI_PRODUCT_SYSTEMBASE_SB16C1054	0x0004		/* SB16C1054 UARTs */
+#define	PCI_PRODUCT_SYSTEMBASE_SB16C1058	0x0008		/* SB16C1058 UARTs */
+#define	PCI_PRODUCT_SYSTEMBASE_SB16C1050	0x4d02		/* SB16C1050 UARTs */
+
+/* Schneider & Koch (really SysKonnect) products */
+#define	PCI_PRODUCT_SCHNEIDERKOCH_SKNET_FDDI	0x4000		/* SK-NET FDDI-xP */
+#define	PCI_PRODUCT_SCHNEIDERKOCH_SKNET_GE	0x4300		/* SK-NET GE */
+#define	PCI_PRODUCT_SCHNEIDERKOCH_SK9821v2	0x4320		/* SK-9821 v2.0 */
+#define	PCI_PRODUCT_SCHNEIDERKOCH_SK_9DX1	0x4400		/* SK-NET SK-9DX1 Gigabit Ethernet */
+/* These next two are are really subsystem IDs */
+#define	PCI_PRODUCT_SCHNEIDERKOCH_SK_9D21	0x4421		/* SK-9D21 1000BASE-T */
+#define	PCI_PRODUCT_SCHNEIDERKOCH_SK_9D41	0x4441		/* SK-9D41 1000BASE-X */
+
+#define	PCI_PRODUCT_SCHNEIDERKOCH_SK_9SXX	0x9000		/* SK-9Sxx Gigabit Ethernet */
+/* This next entry is used for both single-port (SK-9E21D) and dual-port
+ * (SK-9E22) gig-e based on Marvell Yukon-2, with PCI revision	0x17 for
+ * the single-port and 0x12 for the	dual-port.
+ */
+#define	PCI_PRODUCT_SCHNEIDERKOCH_SK_9E21	0x9e00		/* SK-9E21D/SK-9E22 1000base-T */
+
+/* Tamarack Microelectronics */
+#define	PCI_PRODUCT_TAMARACK_TC9021	0x1021		/* TC9021 Gigabit Ethernet */
+#define	PCI_PRODUCT_TAMARACK_TC9021_ALT	0x9021		/* TC9021 Gigabit Ethernet (alt ID) */
+
+/* Tandem Computers */
+#define	PCI_PRODUCT_TANDEM_SERVERNETII	0x0005		/* ServerNet II VIA Adapter */
+
+/* Tekram Technology products (1st PCI Vendor ID) */
+#define	PCI_PRODUCT_TEKRAM_DC290	0xdc29		/* DC-290(M) */
+
+/* Tekram Technology products (2nd PCI Vendor ID) */
+#define	PCI_PRODUCT_TEKRAM2_DC690C	0x690c		/* DC-690C */
+#define	PCI_PRODUCT_TEKRAM2_DC315	0x0391		/* DC-315/DC-395 */
+
+/* Texas Instruments products */
+#define	PCI_PRODUCT_TI_TLAN	0x0500		/* TLAN */
+#define	PCI_PRODUCT_TI_TVP4020	0x3d07		/* TVP4020 Permedia 2 */
+#define	PCI_PRODUCT_TI_TSB12LV21	0x8000		/* TSB12LV21 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_TSB12LV22	0x8009		/* TSB12LV22 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI4450LYNX	0x8011		/* PCI4450 IEEE 1394 Host Controller w/ PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI4410LYNX	0x8017		/* PCI4410 IEEE 1394 Host Controller w/ PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_TSB12LV23	0x8019		/* TSB12LV23 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_TSB12LV26	0x8020		/* TSB12LV26 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_TSB43AA22	0x8021		/* TSB43AA22 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_TSB43AA22A	0x8023		/* TSB43AA22/A IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_TSB43AA23	0x8024		/* TSB43AA23 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_TSB43AB21	0x8026		/* TSB43AA21 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI4451LYNX	0x8027		/* PCI4451 IEEE 1394 Host Controller w/ PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI4510LYNX	0x8029		/* PCI4510 IEEE 1394 Host Controller w/ PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI4520LYNX	0x802A		/* PCI4520 IEEE 1394 Host Controller w/ PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI7410LYNX	0x802B		/* PCI7[4-6]10 IEEE 1394 Host Controller w/ PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI72111CB	0x8031		/* PCI7x21/7x11 Cardbus Controller */
+#define	PCI_PRODUCT_TI_PCI72111FW	0x8032		/* PCI7x21/7x11 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI72111FM	0x8033		/* PCI7x21/7x11 Integrated FlashMedia Controller */
+#define	PCI_PRODUCT_TI_PCI72111SD	0x8034		/* PCI7x21/7x11 SD Card Controller */
+#define	PCI_PRODUCT_TI_PCI72111SM	0x8035		/* PCI7x21/7x11 SM Card Controller */
+#define	PCI_PRODUCT_TI_PCI6515A	0x8036		/* PCI6515A Cardbus Controller */
+#define	PCI_PRODUCT_TI_PCI6515ASM	0x8038		/* PCI6515A Cardbus Controller (Smart Card mode) */
+#define	PCI_PRODUCT_TI_PCIXX12CB	0x8039		/* PCIXX12 Cardbus Controller */
+#define	PCI_PRODUCT_TI_PCIXX12FW	0x803a		/* PCIXX12 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCIXX12FM	0x803b		/* PCIXX12 Integrated FlashMedia Controller */
+#define	PCI_PRODUCT_TI_PCIXX12SD	0x803c		/* PCIXX12 Secure Digital Host Controller */
+#define	PCI_PRODUCT_TI_PCIXX12SM	0x803d		/* PCIXX12 Smart Card */
+#define	PCI_PRODUCT_TI_ACX100A	0x8400		/* ACX100A 802.11b */
+#define	PCI_PRODUCT_TI_ACX100B	0x8401		/* ACX100B 802.11b */
+#define	PCI_PRODUCT_TI_ACX111	0x9066		/* ACX111 802.11b/g */
+#define	PCI_PRODUCT_TI_PCI1130	0xac12		/* PCI1130 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1031	0xac13		/* PCI1031 PCI-PCMCIA Bridge */
+#define	PCI_PRODUCT_TI_PCI1131	0xac15		/* PCI1131 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1250	0xac16		/* PCI1250 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1220	0xac17		/* PCI1220 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1221	0xac19		/* PCI1221 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1210	0xac1a		/* PCI1210 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1450	0xac1b		/* PCI1450 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1225	0xac1c		/* PCI1225 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1251	0xac1d		/* PCI1251 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1211	0xac1e		/* PCI1211 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1251B	0xac1f		/* PCI1251B PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI2030	0xac20		/* PCI2030 PCI-PCI Bridge */
+#define	PCI_PRODUCT_TI_PCI2050	0xac28		/* PCI2050 PCI-PCI Bridge */
+#define	PCI_PRODUCT_TI_PCI4450YENTA	0xac40		/* PCI4450 PCI-CardBus Bridge w/ IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI4410YENTA	0xac41		/* PCI4410 PCI-CardBus Bridge w/ IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI4451YENTA	0xac42		/* PCI4451 PCI-CardBus Bridge w/ IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI4510YENTA	0xac44		/* PCI4510 PCI-CardBus Bridge w/ IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI4520YENTA	0xac46		/* PCI4520 PCI-CardBus Bridge w/ IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI7510YENTA	0xac47		/* PCI7510 PCI-CardBus Bridge w/ IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI7610YENTA	0xac48		/* PCI7610 PCI-CardBus Bridge w/ IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI7410YENTA	0xac49		/* PCI7410 PCI-CardBus Bridge w/ IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_TI_PCI7610SM	0xac4A		/* PCI7610 PCI-CardBus Bridge (Smart Card Mode) */
+#define	PCI_PRODUCT_TI_PCI7410SD	0xac4B		/* PCI7[46]10 PCI-CardBus Bridge (SD/MMC Mode) */
+#define	PCI_PRODUCT_TI_PCI7410MS	0xac4C		/* PCI7[46]10 PCI-CardBus Bridge (Memory Stick Mode) */
+#define	PCI_PRODUCT_TI_PCI1410	0xac50		/* PCI1410 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1420	0xac51		/* PCI1420 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1451	0xac52		/* PCI1451 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1421	0xac53		/* PCI1421 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1620	0xac54		/* PCI1620 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1520	0xac55		/* PCI1520 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1510	0xac56		/* PCI1510 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1530	0xac57		/* PCI1530 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI1515	0xac58		/* PCI1515 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TI_PCI2040	0xac60		/* PCI2040 PCI-DSP Bridge */
+#define	PCI_PRODUCT_TI_PCI7420YENTA	0xac8e		/* PCI7420 PCI-Cardbus Bridge w/ IEEE 1394 Host Controller */
+
+/* Titan Electronics products */
+
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI010L	0x8001		/* PCI-010L */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI100L	0x8010		/* PCI-100L */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI110L	0x8011		/* PCI-110L */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI200L	0x8020		/* PCI-200L */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI210L	0x8021		/* PCI-210L */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI200LI	0x8028		/* PCI-200Li */
+#define	PCI_PRODUCT_MOLEX_VSCOM_PCI400L	0x8040		/* PCI-400L */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI800L	0x8080		/* PCI-800L */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI011H	0x8403		/* PCI-011H */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCIx10H	0xa000		/* PCI-x10H */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI100H	0xa001		/* PCI-100H */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI800H	0xa003		/* PCI-800H */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI800H_1	0xa004		/* PCI-800H_1 */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI200H	0xa005		/* PCI-200H */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI010HV2	0xe001		/* PCI-010HV2 */
+#define	PCI_PRODUCT_TITAN_VSCOM_PCI200HV2	0xe020		/* PCI-200HV2 */
+
+
+/* Toshiba America products */
+#define	PCI_PRODUCT_TOSHIBA_R4X00	0x0009		/* R4x00 Host-PCI Bridge */
+#define	PCI_PRODUCT_TOSHIBA_TC35856F	0x0020		/* TC35856F ATM (\"Meteor\") */
+
+/* Toshiba products */
+#define	PCI_PRODUCT_TOSHIBA2_PORTEGE	0x0001		/* Portege Notebook */
+#define	PCI_PRODUCT_TOSHIBA2_PICCOLO	0x0101		/* Piccolo IDE Controller */
+#define	PCI_PRODUCT_TOSHIBA2_PICCOLO2	0x0102		/* Piccolo 2 IDE Controller */
+#define	PCI_PRODUCT_TOSHIBA2_PICCOLO3	0x0103		/* Piccolo 3 IDE Controller */
+#define	PCI_PRODUCT_TOSHIBA2_PICCOLO5	0x0105		/* Piccolo 5 IDE Controller */
+#define	PCI_PRODUCT_TOSHIBA2_HOST	0x0601		/* Host Bridge/Controller */
+#define	PCI_PRODUCT_TOSHIBA2_ISA	0x0602		/* PCI-ISA Bridge */
+#define	PCI_PRODUCT_TOSHIBA2_ToPIC95	0x0603		/* ToPIC95 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TOSHIBA2_ToPIC95B	0x060a		/* ToPIC95B PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TOSHIBA2_ToPIC97	0x060f		/* ToPIC97 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TOSHIBA2_SANREMO	0x0618		/* SanRemo? Triangle Host Bridge */
+#define	PCI_PRODUCT_TOSHIBA2_SMCARD	0x0804		/* Smart Media Controller */
+#define	PCI_PRODUCT_TOSHIBA2_SDCARD	0x0805		/* Secure Digital Card Controller Type-A */
+#define	PCI_PRODUCT_TOSHIBA2_ToPIC100	0x0617		/* ToPIC100 PCI-CardBus Bridge */
+#define	PCI_PRODUCT_TOSHIBA2_OBOE	0x0701		/* Fast Infrared Type O */
+#define	PCI_PRODUCT_TOSHIBA2_DONAUOBOE	0x0d01		/* Fast Infrared Type DO */
+
+/* Transmeta products */
+#define	PCI_PRODUCT_TRANSMETA_TM8000NB	0x0061		/* TM8000 Integrated North Bridge */
+#define	PCI_PRODUCT_TRANSMETA_NORTHBRIDGE	0x0295		/* Virtual North Bridge */
+#define	PCI_PRODUCT_TRANSMETA_LONGRUN	0x0395		/* LongRun North Bridge */
+#define	PCI_PRODUCT_TRANSMETA_SDRAM	0x0396		/* SDRAM Controller */
+#define	PCI_PRODUCT_TRANSMETA_BIOS_SCRATCH	0x0397		/* BIOS Scratchpad */
+
+/* Trident products */
+#define	PCI_PRODUCT_TRIDENT_4DWAVE_DX	0x2000		/* 4DWAVE DX */
+#define	PCI_PRODUCT_TRIDENT_4DWAVE_NX	0x2001		/* 4DWAVE NX */
+#define	PCI_PRODUCT_TRIDENT_CYBERBLADE_I7	0x8420		/* CyberBlade i7 */
+#define	PCI_PRODUCT_TRIDENT_TGUI_9320	0x9320		/* TGUI 9320 */
+#define	PCI_PRODUCT_TRIDENT_TGUI_9350	0x9350		/* TGUI 9350 */
+#define	PCI_PRODUCT_TRIDENT_TGUI_9360	0x9360		/* TGUI 9360 */
+#define	PCI_PRODUCT_TRIDENT_CYBER_9397	0x9397		/* CYBER 9397 */
+#define	PCI_PRODUCT_TRIDENT_CYBER_9397DVD	0x939a		/* CYBER 9397DVD */
+#define	PCI_PRODUCT_TRIDENT_CYBER_9525	0x9525		/* CYBER 9525 */
+#define	PCI_PRODUCT_TRIDENT_TGUI_9420	0x9420		/* TGUI 9420 */
+#define	PCI_PRODUCT_TRIDENT_TGUI_9440	0x9440		/* TGUI 9440 */
+#define	PCI_PRODUCT_TRIDENT_TGUI_9660	0x9660		/* TGUI 9660 */
+#define	PCI_PRODUCT_TRIDENT_TGUI_9680	0x9680		/* TGUI 9680 */
+#define	PCI_PRODUCT_TRIDENT_TGUI_9682	0x9682		/* TGUI 9682 */
+#define	PCI_PRODUCT_TRIDENT_CYBERBLADE	0x9910		/* CyberBlade */
+
+/* Triones Technologies products */
+/* The 366 and 370 controllers have the same product ID */
+#define	PCI_PRODUCT_TRIONES_HPT343	0x0003		/* HPT343/345 IDE Controller */
+#define	PCI_PRODUCT_TRIONES_HPT366	0x0004		/* HPT366/370/372 IDE Controller */
+#define	PCI_PRODUCT_TRIONES_HPT372A	0x0005		/* HPT372A IDE Controller */
+#define	PCI_PRODUCT_TRIONES_HPT302	0x0006		/* HPT302 IDE Controller */
+#define	PCI_PRODUCT_TRIONES_HPT371	0x0007		/* HPT371 IDE Controller */
+#define	PCI_PRODUCT_TRIONES_HPT374	0x0008		/* HPT374 IDE Controller */
+#define	PCI_PRODUCT_TRIONES_HPT372N	0x0009		/* HPT372N IDE Controller */
+#define	PCI_PRODUCT_TRIONES_ROCKETRAID_2310	0x2310		/* RocketRAID 2310 RAID card */
+#define	PCI_PRODUCT_TRIONES_ROCKETRAID_2720	0x2720		/* RocketRAID 2720 RAID card */
+
+/* TriTech Microelectronics products*/
+#define	PCI_PRODUCT_TRITECH_TR25202	0xfc02		/* Pyramid3D TR25202 */
+
+/* Tseng Labs products */
+#define	PCI_PRODUCT_TSENG_ET4000_W32P_A	0x3202		/* ET4000w32p rev A */
+#define	PCI_PRODUCT_TSENG_ET4000_W32P_B	0x3205		/* ET4000w32p rev B */
+#define	PCI_PRODUCT_TSENG_ET4000_W32P_C	0x3206		/* ET4000w32p rev C */
+#define	PCI_PRODUCT_TSENG_ET4000_W32P_D	0x3207		/* ET4000w32p rev D */
+#define	PCI_PRODUCT_TSENG_ET6000	0x3208		/* ET6000 */
+
+/* Turtle Beach products */
+#define	PCI_PRODUCT_TURTLE_BEACH_SANTA_CRUZ	0x3357		/* Santa Cruz */
+
+/* UMC products */
+#define	PCI_PRODUCT_UMC_UM82C881	0x0001		/* UM82C881 486 Chipset */
+#define	PCI_PRODUCT_UMC_UM82C886	0x0002		/* UM82C886 PCI-ISA Bridge */
+#define	PCI_PRODUCT_UMC_UM8673F	0x0101		/* UM8673F EIDE Controller */
+#define	PCI_PRODUCT_UMC_UM8881	0x0881		/* UM8881 HB4 486 PCI Chipset */
+#define	PCI_PRODUCT_UMC_UM82C891	0x0891		/* UM82C891 */
+#define	PCI_PRODUCT_UMC_UM886A	0x1001		/* UM886A */
+#define	PCI_PRODUCT_UMC_UM8886BF	0x673a		/* UM8886BF */
+#define	PCI_PRODUCT_UMC_UM8710	0x8710		/* UM8710 */
+#define	PCI_PRODUCT_UMC_UM8886	0x886a		/* UM8886 */
+#define	PCI_PRODUCT_UMC_UM8881F	0x8881		/* UM8881F PCI-Host Bridge */
+#define	PCI_PRODUCT_UMC_UM8886F	0x8886		/* UM8886F PCI-ISA Bridge */
+#define	PCI_PRODUCT_UMC_UM8886A	0x888a		/* UM8886A */
+#define	PCI_PRODUCT_UMC_UM8891A	0x8891		/* UM8891A */
+#define	PCI_PRODUCT_UMC_UM9017F	0x9017		/* UM9017F */
+#define	PCI_PRODUCT_UMC_UM8886N	0xe88a		/* UM8886N */
+#define	PCI_PRODUCT_UMC_UM8891N	0xe891		/* UM8891N */
+
+/* ULSI Systems products */
+#define	PCI_PRODUCT_ULSI_US201	0x0201		/* US201 */
+
+/* US Robotics products */
+#define	PCI_PRODUCT_USR_3C2884A	0x1007		/* 56K Voice Internal PCI Modem (WinModem) */
+#define	PCI_PRODUCT_USR_3CP5609	0x1008		/* 3CP5609 PCI 16550 Modem */
+#define	PCI_PRODUCT_USR2_USR997902	0x0116		/* USR997902 Gigabit Ethernet */
+#define	PCI_PRODUCT_USR2_2415	0x3685		/* Wireless PCI-PCMCIA Adapter */
+
+/* V3 Semiconductor products */
+#define	PCI_PRODUCT_V3_V292PBCPSC	0x0010		/* V292PBCPSC Am29K Local Bus to PCI Bridge */
+#define	PCI_PRODUCT_V3_V292PBC	0x0292		/* V292PBC AMD290x0 Host-PCI Bridge */
+#define	PCI_PRODUCT_V3_V960PBC	0x0960		/* V960PBC i960 Host-PCI Bridge */
+#define	PCI_PRODUCT_V3_V96DPC	0xc960		/* V96DPC i960 (Dual) Host-PCI Bridge */
+
+/* VIA Technologies products, from http://www.via.com.tw/ */
+#define	PCI_PRODUCT_VIATECH_VT6305	0x0130		/* VT6305 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_VIATECH_K8M800_0	0x0204		/* K8M800 Host */
+#define	PCI_PRODUCT_VIATECH_K8T890_0	0x0238		/* K8T890 Host */
+#define	PCI_PRODUCT_VIATECH_KT880	0x0269		/* KT880 CPU to PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_K8HTB_0	0x0282		/* K8HTB Host */
+#define	PCI_PRODUCT_VIATECH_VT8363_HB	0x0305		/* VT8363 (Apollo KT133) Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VT3351_HB_0351	0x0351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_P4M900	0x0364		/* CN896/P4M900 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8371_HB	0x0391		/* VT8371 (Apollo KX133) Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VX900_HB	0x0410		/* VX900 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8501_MVP4	0x0501		/* VT8501 (Apollo MVP4) Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C505	0x0505		/* VT82C505 (Pluto) */
+#define	PCI_PRODUCT_VIATECH_VT82C561	0x0561		/* VT82C561 */
+#define	PCI_PRODUCT_VIATECH_VT82C586A_IDE	0x0571		/* VT82C586A IDE Controller */
+#define	PCI_PRODUCT_VIATECH_VT82C576	0x0576		/* VT82C576 3V */
+#define	PCI_PRODUCT_VIATECH_CX700_IDE	0x0581		/* CX700 IDE Controller */
+#define	PCI_PRODUCT_VIATECH_VT82C580VP	0x0585		/* VT82C580 (Apollo VP) Host-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C586_ISA	0x0586		/* VT82C586 PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8237A_SATA	0x0591		/* VT8237A Integrated SATA Controller */
+#define	PCI_PRODUCT_VIATECH_VT82C595	0x0595		/* VT82C595 (Apollo VP2) Host-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C596A	0x0596		/* VT82C596A PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C597	0x0597		/* VT82C597 (Apollo VP3) Host-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C598PCI	0x0598		/* VT82C598 (Apollo MVP3) Host-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8605PCI	0x0605		/* VT8605 (Apollo ProMedia 133) Host-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C686A_ISA	0x0686		/* VT82C686A PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C691	0x0691		/* VT82C691 (Apollo Pro) Host-PCI */
+#define	PCI_PRODUCT_VIATECH_VT82C693	0x0693		/* VT82C693 (Apollo Pro Plus) Host-PCI */
+#define	PCI_PRODUCT_VIATECH_VT86C926	0x0926		/* VT86C926 Amazon PCI-Ethernet Controller */
+#define	PCI_PRODUCT_VIATECH_VT82C570M	0x1000		/* VT82C570M (Apollo) Host-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C570MV	0x1006		/* VT82C570M (Apollo) PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_KT880_1	0x1269		/* KT880 CPU to PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT3351_HB_1351	0x1351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_P4M900_1	0x1364		/* CN896/P4M900 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C586_IDE	0x1571		/* VT82C586 IDE Controller */
+#define	PCI_PRODUCT_VIATECH_VT82C595_2	0x1595		/* VT82C595 (Apollo VP2) Host-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_KT880_2	0x2269		/* KT880 CPU to PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT3351_HB_2351	0x2351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_P4M900_2	0x2364		/* CN896/P4M900 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8251_PPB_287A	0x287a		/* VT8251 PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8251_PCIE1	0x287c		/* VT8251 PCIE Root Port1 */
+#define	PCI_PRODUCT_VIATECH_VT8251_PCIE2	0x287d		/* VT8251 PCIE Root Port2 */
+#define	PCI_PRODUCT_VIATECH_VT8251_VLINK	0x287e		/* VT8251 Ultra VLINK Controller */
+#define	PCI_PRODUCT_VIATECH_VT83C572	0x3038		/* VT83C572 USB Controller */
+#define	PCI_PRODUCT_VIATECH_VT82C586_PWR	0x3040		/* VT82C586 Power Management Controller */
+#define	PCI_PRODUCT_VIATECH_VT3043	0x3043		/* VT3043 (Rhine) 10/100 Ethernet */
+#define	PCI_PRODUCT_VIATECH_VT6306	0x3044		/* VT6306 IEEE 1394 Host Controller */
+#define	PCI_PRODUCT_VIATECH_VT6105M	0x3053		/* VT6105M (Rhine III) 10/100 Ethernet */
+#define	PCI_PRODUCT_VIATECH_VT82C686A_SMB	0x3057		/* VT82C686A SMBus Controller */
+#define	PCI_PRODUCT_VIATECH_VT82C686A_AC97	0x3058		/* VT82C686A AC-97 Audio Controller */
+#define	PCI_PRODUCT_VIATECH_VT8233_AC97	0x3059		/* VT8233/VT8235 AC-97 Audio Controller */
+#define	PCI_PRODUCT_VIATECH_VT6102	0x3065		/* VT6102 (Rhine II) 10/100 Ethernet */
+#define	PCI_PRODUCT_VIATECH_VT82C686A_MC97	0x3068		/* VT82C686A MC-97 Modem Controller */
+#define	PCI_PRODUCT_VIATECH_VT8233	0x3074		/* VT8233 PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8366	0x3099		/* VT8366 (Apollo KT266) CPU-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8653	0x3101		/* VT8653 (Apollo Pro 266T) CPU-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8237_EHCI	0x3104		/* VT8237 EHCI USB Controller */
+#define	PCI_PRODUCT_VIATECH_VT6105	0x3106		/* VT6105 (Rhine III) 10/100 Ethernet */
+#define	PCI_PRODUCT_VIATECH_VT612X	0x3119		/* VT612X (Velocity) 10/100/1000 Ethernet */
+#define	PCI_PRODUCT_VIATECH_VT8623_VGA	0x3122		/* VT8623 (Apollo CLE266) VGA Controller */
+#define	PCI_PRODUCT_VIATECH_VT8623	0x3123		/* VT8623 (Apollo CLE266) CPU-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8233A	0x3147		/* VT8233A PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8237_SATA	0x3149		/* VT8237 Integrated SATA Controller */
+#define	PCI_PRODUCT_VIATECH_VT6410_RAID	0x3164		/* VT6410 ATA133 RAID Controller */
+#define	PCI_PRODUCT_VIATECH_VT8235	0x3177		/* VT8235 (Apollo KT400) PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_K8HTB	0x3188		/* K8HTB Host */
+#define	PCI_PRODUCT_VIATECH_VT8377	0x3189		/* VT8377 Apollo KT400 CPU to PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8378	0x3205		/* VT8378 Apollo KM400 CPU to PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8237	0x3227		/* VT8237 PCI-LPC Bridge */
+#define	PCI_PRODUCT_VIATECH_VT6421_RAID	0x3249		/* VT6421 Serial RAID Controller */
+#define	PCI_PRODUCT_VIATECH_KT880_3	0x3269		/* KT880 CPU to PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8251	0x3287		/* VT8251 PCI-LPC Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8237A_HDA	0x3288		/* VT8237A/VT8251 High Definition Audio Controller */
+#define	PCI_PRODUCT_VIATECH_VT8237A_ISA	0x3337		/* VT8237A/VT82C586A PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_VT3314_IG	0x3344		/* VT3314 CN900 UniChrome Integrated Graphics */
+#define	PCI_PRODUCT_VIATECH_VT8237R_SATA	0x3349		/* VT8237R Integrated SATA Controller */
+#define	PCI_PRODUCT_VIATECH_VT3351_HB_3351	0x3351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_P4M900_3	0x3364		/* CN896/P4M900 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_CHROME9_HC	0x3371		/* Chrome9 HC IGP */
+#define	PCI_PRODUCT_VIATECH_VT8237S_ISA	0x3372		/* VT8237S PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8237A_PPB	0x337a		/* VT8237A PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8237A_HB	0x337b		/* VT8237A Host Bridge */
+#define	PCI_PRODUCT_VIATECH_KT880_4	0x4269		/* KT880 CPU to PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT3351_HB_4351	0x4351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_P4M900_4	0x4364		/* CN896/P4M900 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_CX700M2_IDE	0x5324		/* CX700M2/VX700 IDE Controller */
+#define	PCI_PRODUCT_VIATECH_VT8237A_SATA_2	0x5337		/* VT8237A Integrated SATA Controller */
+#define	PCI_PRODUCT_VIATECH_VT3351_IOAPIC	0x5351		/* VT3351 I/O APIC Interrupt Controller */
+#define	PCI_PRODUCT_VIATECH_P4M900_IOAPIC	0x5364		/* CN896/P4M900 IOAPIC */
+#define	PCI_PRODUCT_VIATECH_VT8237S_SATA	0x5372		/* VT8237S Integrated SATA Controller */
+#define	PCI_PRODUCT_VIATECH_VT86C100A	0x6100		/* VT86C100A (Rhine-II) 10/100 Ethernet */
+#define	PCI_PRODUCT_VIATECH_VT8251_SATA	0x6287		/* VT8251 Integrated SATA Controller */
+#define	PCI_PRODUCT_VIATECH_P4M900_6	0x6364		/* CN896/P4M900 Security Device */
+#define	PCI_PRODUCT_VIATECH_VT8378_IG	0x7205		/* VT8378 KM400 UniChrome Integrated Graphics */
+#define	PCI_PRODUCT_VIATECH_KT880_5	0x7269		/* KT880 CPU to PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT3351_HB_7351	0x7351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_P4M900_7	0x7364		/* CN896/P4M900 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8231	0x8231		/* VT8231 PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8231_PWR	0x8235		/* VT8231 Power Management Controller */
+#define	PCI_PRODUCT_VIATECH_VT8363_PPB	0x8305		/* VT8363 (Apollo KT133) PCI to AGP Bridge */
+#define	PCI_PRODUCT_VIATECH_CX700	0x8324		/* CX700 PCI-LPC Bridge */
+#define	PCI_PRODUCT_VIATECH_VX800	0x8353		/* VX800/VX820 PCI-LPC Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8371_PPB	0x8391		/* VT8371 (Apollo KX133) PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8501AGP	0x8501		/* VT8501 (Apollo MVP4) CPU-AGP Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C597AGP	0x8597		/* VT82C597 (Apollo VP3) CPU-AGP Bridge */
+#define	PCI_PRODUCT_VIATECH_VT82C598AGP	0x8598		/* VT82C598 (Apollo MVP3) CPU-AGP Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8605AGP	0x8605		/* VT8605 (Apollo ProMedia 133) Host-AGP Bridge */
+#define	PCI_PRODUCT_VIATECH_VX900_IDE	0x9001		/* VX900 IDE Controller */
+#define	PCI_PRODUCT_VIATECH_K8T890_PPB_A238	0xa238		/* K8T890 PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_P4M900_PPB_1	0xa364		/* CN896/P4M900 PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8633AGP	0xb091		/* VT8633 (Apollo Pro 266) CPU-AGP Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8366AGP	0xb099		/* VT8366 (Apollo KT266) CPU-AGP Bridge */
+#define	PCI_PRODUCT_VIATECH_VT8377AGP	0xb168		/* VT8377 CPU-AGP Bridge */
+#define	PCI_PRODUCT_VIATECH_K8HTB_AGP	0xb188		/* K8HTB AGP */
+#define	PCI_PRODUCT_VIATECH_VT8377CEAGP	0xb198		/* VT8377CE CPU-AGP Bridge */
+#define	PCI_PRODUCT_VIATECH_VT3237_PPB	0xb999		/* K8T890 North / VT8237 South PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_K8T890_PPB_C238	0xc238		/* K8T890 PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_P4M900_PPB_2	0xc364		/* CN896/P4M900 PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_K8T890_PPB_D238	0xd238		/* K8T890 PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_K8T890_PPB_E238	0xe238		/* K8T890 PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_K8T890_PPB_F238	0xf238		/* K8T890 PCI-PCI Bridge */
+
+/* VirtualBox products */
+#define	PCI_PRODUCT_VIRTUALBOX_GRAPHICS	0xbeef		/* Graphics */
+#define	PCI_PRODUCT_VIRTUALBOX_GUEST	0xcafe		/* Guest Service */
+
+/* Vortex Computer Systems products */
+#define	PCI_PRODUCT_VORTEX_GDT_60x0	0x0000		/* GDT6000/6020/6050 */
+#define	PCI_PRODUCT_VORTEX_GDT_6000B	0x0001		/* GDT6000B/6010 */
+#define	PCI_PRODUCT_VORTEX_GDT_6x10	0x0002		/* GDT6110/6510 */
+#define	PCI_PRODUCT_VORTEX_GDT_6x20	0x0003		/* GDT6120/6520 */
+#define	PCI_PRODUCT_VORTEX_GDT_6530	0x0004		/* GDT6530 */
+#define	PCI_PRODUCT_VORTEX_GDT_6550	0x0005		/* GDT6550 */
+#define	PCI_PRODUCT_VORTEX_GDT_6x17	0x0006		/* GDT6117/6517 */
+#define	PCI_PRODUCT_VORTEX_GDT_6x27	0x0007		/* GDT6127/6527 */
+#define	PCI_PRODUCT_VORTEX_GDT_6537	0x0008		/* GDT6537 */
+#define	PCI_PRODUCT_VORTEX_GDT_6557	0x0009		/* GDT6557/6557-ECC */
+#define	PCI_PRODUCT_VORTEX_GDT_6x15	0x000a		/* GDT6115/6515 */
+#define	PCI_PRODUCT_VORTEX_GDT_6x25	0x000b		/* GDT6125/6525 */
+#define	PCI_PRODUCT_VORTEX_GDT_6535	0x000c		/* GDT6535 */
+#define	PCI_PRODUCT_VORTEX_GDT_6555	0x000d		/* GDT6555/6555-ECC */
+#define	PCI_PRODUCT_VORTEX_GDT_6x17RP	0x0100		/* GDT6[15]17RP */
+#define	PCI_PRODUCT_VORTEX_GDT_6x27RP	0x0101		/* GDT6[15]27RP */
+#define	PCI_PRODUCT_VORTEX_GDT_6537RP	0x0102		/* GDT6537RP */
+#define	PCI_PRODUCT_VORTEX_GDT_6557RP	0x0103		/* GDT6557RP */
+#define	PCI_PRODUCT_VORTEX_GDT_6x11RP	0x0104		/* GDT6[15]11RP */
+#define	PCI_PRODUCT_VORTEX_GDT_6x21RP	0x0105		/* GDT6[15]21RP */
+#define	PCI_PRODUCT_VORTEX_GDT_6x17RD	0x0110		/* GDT6[15]17RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6x27RD	0x0111		/* GDT6[5]127RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6537RD	0x0112		/* GDT6537RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6557RD	0x0113		/* GDT6557RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6x11RD	0x0114		/* GDT6[15]11RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6x21RD	0x0115		/* GDT6[15]21RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6x18RD	0x0118		/* GDT6[156]18RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6x28RD	0x0119		/* GDT6[156]28RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6x38RD	0x011a		/* GDT6[56]38RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6x58RD	0x011b		/* GDT6[56]58RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6x17RP2	0x0120		/* GDT6[15]17RP2 */
+#define	PCI_PRODUCT_VORTEX_GDT_6x27RP2	0x0121		/* GDT6[15]27RP2 */
+#define	PCI_PRODUCT_VORTEX_GDT_6537RP2	0x0123		/* GDT6537RP2 */
+#define	PCI_PRODUCT_VORTEX_GDT_6x11RP2	0x0124		/* GDT6[15]11RP2 */
+#define	PCI_PRODUCT_VORTEX_GDT_6x21RP2	0x0125		/* GDT6[15]21RP2 */
+#define	PCI_PRODUCT_VORTEX_GDT_6x13RS	0x0136		/* GDT6513RS */
+#define	PCI_PRODUCT_VORTEX_GDT_6x23RS	0x0137		/* GDT6523RS */
+#define	PCI_PRODUCT_VORTEX_GDT_6518RS	0x0138		/* GDT6518RS */
+#define	PCI_PRODUCT_VORTEX_GDT_6x28RS	0x0139		/* GDT6x28RS */
+#define	PCI_PRODUCT_VORTEX_GDT_6x38RS	0x013a		/* GDT6x38RS */
+#define	PCI_PRODUCT_VORTEX_GDT_6x58RS	0x013b		/* GDT6x58RS */
+#define	PCI_PRODUCT_VORTEX_GDT_6x33RS	0x013c		/* GDT6x33RS */
+#define	PCI_PRODUCT_VORTEX_GDT_6x43RS	0x013d		/* GDT6x43RS */
+#define	PCI_PRODUCT_VORTEX_GDT_6x53RS	0x013e		/* GDT6x53RS */
+#define	PCI_PRODUCT_VORTEX_GDT_6x63RS	0x013f		/* GDT6x63RS */
+#define	PCI_PRODUCT_VORTEX_GDT_7x13RN	0x0166		/* GDT7x13RN */
+#define	PCI_PRODUCT_VORTEX_GDT_7x23RN	0x0167		/* GDT7x23RN */
+#define	PCI_PRODUCT_VORTEX_GDT_7x18RN	0x0168		/* GDT7[156]18RN */
+#define	PCI_PRODUCT_VORTEX_GDT_7x28RN	0x0169		/* GDT7[156]28RN */
+#define	PCI_PRODUCT_VORTEX_GDT_7x38RN	0x016a		/* GDT7[56]38RN */
+#define	PCI_PRODUCT_VORTEX_GDT_7x58RN	0x016b		/* GDT7[56]58RN */
+#define	PCI_PRODUCT_VORTEX_GDT_7x43RN	0x016d		/* GDT7[56]43RN */
+#define	PCI_PRODUCT_VORTEX_GDT_7x53RN	0x016E		/* GDT7x53RN */
+#define	PCI_PRODUCT_VORTEX_GDT_7x63RN	0x016F		/* GDT7x63RN */
+#define	PCI_PRODUCT_VORTEX_GDT_4x13RZ	0x01D6		/* GDT4x13RZ */
+#define	PCI_PRODUCT_VORTEX_GDT_4x23RZ	0x01D7		/* GDT4x23RZ */
+#define	PCI_PRODUCT_VORTEX_GDT_8x13RZ	0x01F6		/* GDT8x13RZ */
+#define	PCI_PRODUCT_VORTEX_GDT_8x23RZ	0x01F7		/* GDT8x23RZ */
+#define	PCI_PRODUCT_VORTEX_GDT_8x33RZ	0x01FC		/* GDT8x33RZ */
+#define	PCI_PRODUCT_VORTEX_GDT_8x43RZ	0x01FD		/* GDT8x43RZ */
+#define	PCI_PRODUCT_VORTEX_GDT_8x53RZ	0x01FE		/* GDT8x53RZ */
+#define	PCI_PRODUCT_VORTEX_GDT_8x63RZ	0x01FF		/* GDT8x63RZ */
+#define	PCI_PRODUCT_VORTEX_GDT_6x19RD	0x0210		/* GDT6[56]19RD */
+#define	PCI_PRODUCT_VORTEX_GDT_6x29RD	0x0211		/* GDT6[56]29RD */
+#define	PCI_PRODUCT_VORTEX_GDT_7x19RN	0x0260		/* GDT7[56]19RN */
+#define	PCI_PRODUCT_VORTEX_GDT_7x29RN	0x0261		/* GDT7[56]29RN */
+#define	PCI_PRODUCT_VORTEX_GDT_ICP	0x0300		/* ICP */
+
+/* VLSI products */
+#define	PCI_PRODUCT_VLSI_82C592	0x0005		/* 82C592 CPU Bridge */
+#define	PCI_PRODUCT_VLSI_82C593	0x0006		/* 82C593 ISA Bridge */
+#define	PCI_PRODUCT_VLSI_82C594	0x0007		/* 82C594 Wildcat System Controller */
+#define	PCI_PRODUCT_VLSI_82C596597	0x0008		/* 82C596/597 Wildcat ISA Bridge */
+#define	PCI_PRODUCT_VLSI_82C541	0x000c		/* 82C541 */
+#define	PCI_PRODUCT_VLSI_82C543	0x000d		/* 82C543 */
+#define	PCI_PRODUCT_VLSI_82C532	0x0101		/* 82C532 */
+#define	PCI_PRODUCT_VLSI_82C534	0x0102		/* 82C534 */
+#define	PCI_PRODUCT_VLSI_82C535	0x0104		/* 82C535 */
+#define	PCI_PRODUCT_VLSI_82C147	0x0105		/* 82C147 */
+#define	PCI_PRODUCT_VLSI_82C975	0x0200		/* 82C975 */
+#define	PCI_PRODUCT_VLSI_82C925	0x0280		/* 82C925 */
+
+/* VMware products */
+#define	PCI_PRODUCT_VMWARE_VIRTUAL2	0x0405		/* Virtual SVGA II */
+#define	PCI_PRODUCT_VMWARE_VIRTUAL	0x0710		/* Virtual SVGA */
+#define	PCI_PRODUCT_VMWARE_VMXNET	0x0720		/* Virtual Network */
+#define	PCI_PRODUCT_VMWARE_VMSCSI	0x0730		/* Virtual SCSI */
+#define	PCI_PRODUCT_VMWARE_VMCI	0x0740		/* Virtual Machine Communication Interface */
+#define	PCI_PRODUCT_VMWARE_VMEM	0x0750		/* Virtual 82545EM */
+#define	PCI_PRODUCT_VMWARE_VMEB	0x0760		/* Virtual 82546EB */
+#define	PCI_PRODUCT_VMWARE_VMUSB	0x0770		/* Virtual USB */
+#define	PCI_PRODUCT_VMWARE_VM1394	0x0780		/* Virtual Firewire */
+#define	PCI_PRODUCT_VMWARE_VMPCIB	0x0790		/* Virtual PCI Bridge */
+#define	PCI_PRODUCT_VMWARE_VMPCIE	0x07a0		/* Virtual PCI Express Root Port */
+#define	PCI_PRODUCT_VMWARE_VMXNET3	0x07b0		/* Virtual Network 3 */
+#define	PCI_PRODUCT_VMWARE_PVSCSI	0x07c0		/* PVSCSI */
+#define	PCI_PRODUCT_VMWARE_VMI3	0x0801		/* VMI option ROM */
+
+/* Weitek products */
+#define	PCI_PRODUCT_WEITEK_P9000	0x9001		/* P9000 */
+#define	PCI_PRODUCT_WEITEK_P9100	0x9100		/* P9100 */
+
+/* Western Digital products */
+#define	PCI_PRODUCT_WD_WD33C193A	0x0193		/* WD33C193A */
+#define	PCI_PRODUCT_WD_WD33C196A	0x0196		/* WD33C196A */
+#define	PCI_PRODUCT_WD_WD33C197A	0x0197		/* WD33C197A */
+#define	PCI_PRODUCT_WD_WD7193	0x3193		/* WD7193 */
+#define	PCI_PRODUCT_WD_WD7197	0x3197		/* WD7197 */
+#define	PCI_PRODUCT_WD_WD33C296A	0x3296		/* WD33C296A */
+#define	PCI_PRODUCT_WD_WD34C296	0x4296		/* WD34C296 */
+#define	PCI_PRODUCT_WD_90C	0xc24a		/* 90C */
+
+/* Winbond Electronics products */
+#define	PCI_PRODUCT_WINBOND_W83769F	0x0001		/* W83769F */
+#define	PCI_PRODUCT_WINBOND_W83C553F_0	0x0565		/* W83C553F PCI-ISA Bridge */
+#define	PCI_PRODUCT_WINBOND_W83628F	0x0628		/* W83628F PCI-ISA Bridge */
+#define	PCI_PRODUCT_WINBOND_W83C553F_1	0x0105		/* W83C553F IDE Controller */
+#define	PCI_PRODUCT_WINBOND_W89C840F	0x0840		/* W89C840F 10/100 Ethernet */
+#define	PCI_PRODUCT_WINBOND_W89C940F	0x0940		/* W89C940F Ethernet */
+#define	PCI_PRODUCT_WINBOND_W89C940F_1	0x5a5a		/* W89C940F Ethernet */
+#define	PCI_PRODUCT_WINBOND_W6692	0x6692		/* W6692 ISDN */
+
+/* Workbit products */
+#define	PCI_PRODUCT_WORKBIT_NJSC32BI	0x8007		/* NinjaSCSI-32Bi SCSI */
+#define	PCI_PRODUCT_WORKBIT_NJATA32BI	0x8008		/* NinjaATA-32Bi IDE */
+#define	PCI_PRODUCT_WORKBIT_NJSC32UDE	0x8009		/* NinjaSCSI-32UDE SCSI */
+#define	PCI_PRODUCT_WORKBIT_NJSC32BI_KME	0xf007		/* NinjaSCSI-32Bi SCSI (KME) */
+#define	PCI_PRODUCT_WORKBIT_NJATA32BI_KME	0xf008		/* NinjaATA-32Bi IDE (KME) */
+#define	PCI_PRODUCT_WORKBIT_NJSC32UDE_IODATA	0xf010		/* NinjaSCSI-32UDE SCSI (IODATA) */
+#define	PCI_PRODUCT_WORKBIT_NJSC32UDE_LOGITEC	0xf012		/* NinjaSCSI-32UDE SCSI (LOGITEC) */
+#define	PCI_PRODUCT_WORKBIT_NJSC32UDE_LOGITEC2	0xf013		/* NinjaSCSI-32UDE SCSI (LOGITEC2) */
+#define	PCI_PRODUCT_WORKBIT_NJSC32UDE_BUFFALO	0xf015		/* NinjaSCSI-32UDE SCSI (BUFFALO) */
+#define	PCI_PRODUCT_WORKBIT_NPATA32_CF32A	0xf021		/* CF32A CompactFlash Adapter */
+#define	PCI_PRODUCT_WORKBIT_NPATA32_CF32A_BUFFALO	0xf024		/* CF32A CF Adapter (BUFFALO) */
+#define	PCI_PRODUCT_WORKBIT_NPATA32_KME	0xf02c		/* NPATA-32 IDE (KME) */
+
+/* XenSource products */
+#define	PCI_PRODUCT_XENSOURCE_XENPLATFORM	0x0001		/* Xen Platform Device */
+
+/* XGI Technology products */
+#define	PCI_PRODUCT_XGI_VOLARI_Z7	0x0020		/* Volari Z7/Z9/Z9s */
+#define	PCI_PRODUCT_XGI_VOLARI_Z9M	0x0021		/* Volari Z9m */
+#define	PCI_PRODUCT_XGI_VOLARI_Z11	0x0027		/* Volari Z11/Z11M */
+#define	PCI_PRODUCT_XGI_VOLARI_V3XT	0x0040		/* Volari V3XT/V5/V8 */
+#define	PCI_PRODUCT_XGI_VOLARI_XP10	0x0047		/* Volari XP10 */
+
+/* Xircom products */
+/* is the `-3' here just indicating revision 3, or is it really part
+   of the device name? */
+#define	PCI_PRODUCT_XIRCOM_X3201_3	0x0002		/* X3201-3 Fast Ethernet Controller */
+/* this is the device id `indicating 21143 driver compatibility' */
+#define	PCI_PRODUCT_XIRCOM_X3201_3_21143	0x0003		/* X3201-3 Fast Ethernet Controller (21143) */
+#define	PCI_PRODUCT_XIRCOM_WINGLOBAL	0x000c		/* WinGlobal Modem */
+#define	PCI_PRODUCT_XIRCOM_MODEM56	0x0103		/* 56k Modem */
+
+/* Yamaha products */
+#define	PCI_PRODUCT_YAMAHA_YMF724	0x0004		/* 724 Audio */
+#define	PCI_PRODUCT_YAMAHA_YMF740	0x000a		/* 740 Audio */
+#define	PCI_PRODUCT_YAMAHA_YMF740C	0x000c		/* 740C (DS-1) Audio */
+#define	PCI_PRODUCT_YAMAHA_YMF724F	0x000d		/* 724F (DS-1) Audio */
+#define	PCI_PRODUCT_YAMAHA_YMF744B	0x0010		/* 744 (DS-1S) Audio */
+#define	PCI_PRODUCT_YAMAHA_YMF754	0x0012		/* 754 (DS-1E) Audio */
+
+/* Zeinet products */
+#define	PCI_PRODUCT_ZEINET_1221	0x0001		/* 1221 */
+
+/* Ziatech products */
+#define	PCI_PRODUCT_ZIATECH_ZT8905	0x8905		/* PCI-ST32 Bridge */
+
+/* Zoran products */
+#define	PCI_PRODUCT_ZORAN_ZR36057	0x6057		/* ZR36057 Multimedia Controller */
+#define	PCI_PRODUCT_ZORAN_ZR36120	0x6120		/* ZR36120 Video Controller */

Property changes on: lab4/.minix-src/include/dev/pci/pcidevs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/attribs.h
===================================================================
--- lab4/.minix-src/include/ddekit/attribs.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/attribs.h	(revision 13)
@@ -0,0 +1,16 @@
+#ifndef _DDEKIT_ATTRIBS_H
+#define _DDEKIT_ATTRIBS_H
+
+#ifdef __ACK__
+
+
+#else
+
+#define DDEKIT_USED        __attribute__((used))
+#define DDEKIT_CONSTRUCTOR __attribute__((constructor))
+
+
+#define DDEKIT_PUBLIC PUBLIC
+#define DDEKIT_PRIVATE static 
+#endif
+#endif

Property changes on: lab4/.minix-src/include/ddekit/attribs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/initcall.h
===================================================================
--- lab4/.minix-src/include/ddekit/initcall.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/initcall.h	(revision 13)
@@ -0,0 +1,30 @@
+#ifndef _DDEKIT_INITCALL_H
+#define _DDEKIT_INITCALL_H
+#include <ddekit/ddekit.h>
+#include <ddekit/attribs.h>
+
+typedef void (*ddekit_initcall_t)(void);
+
+struct __ddekit_initcall_s { 
+	ddekit_initcall_t func;
+	int prio;
+	struct __ddekit_initcall_s *next;	
+};
+
+void __ddekit_add_initcall(struct __ddekit_initcall_s *dis);
+
+/* Define a function to be a DDEKit initcall. 
+ * This is the right place to place Linux' module_init functions & Co.
+ */
+#define DDEKIT_INITCALL(fn)	DDEKIT_CTOR(fn, 1)
+
+#define DDEKIT_CTOR(fn, prio) \
+	 static void __attribute__((used)) __attribute__((constructor))\
+	__ddekit_initcall_##fn() { \
+	static struct __ddekit_initcall_s dis = {(ddekit_initcall_t)fn, prio, 0}; \
+	__ddekit_add_initcall(&dis); }
+
+/* Runs all registered initcalls. */
+void ddekit_do_initcalls(void);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/initcall.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/memory.h
===================================================================
--- lab4/.minix-src/include/ddekit/memory.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/memory.h	(revision 13)
@@ -0,0 +1,143 @@
+/*-
+ * Copyright (c) 2006 Thomas Friebel    <tf13@os.inf.tu-dresden.de>
+ * Copyright (c) 2006 Christian Helmuth <ch12@os.inf.tu-dresden.de>
+ * Copyright (c) 2010 Dirk Vogt <dvogt@few.vu.nl>.
+ * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _DDEKIT_MEMORY_H
+#define _DDEKIT_MEMORY_H
+
+#include <ddekit/ddekit.h>
+
+/*******************
+ ** Slab facility **
+ *******************/
+
+struct ddekit_slab;
+
+/* Store user pointer in slab cache */
+void ddekit_slab_set_data(struct ddekit_slab * slab, void *data);
+
+/* Read user pointer from slab cache */
+void *ddekit_slab_get_data(struct ddekit_slab * slab);
+
+/* Allocate slab in slab cache */
+void *ddekit_slab_alloc(struct ddekit_slab * slab);
+
+/* Allocate slab in slab cache */
+void ddekit_slab_free(struct ddekit_slab * slab, void *objp);
+
+/*
+ * Setup page cache for all slabs
+ *
+ * pages:  maximal number of memory pages
+ *
+ * If 'pages' is too low, memory pages may be given back to the memory server
+ * (dm_phys) and just to be allocated again later. This hits performance (but
+ * saves memory). Increase 'pages' to avoid this thrashing-like effect.
+ *
+ * If the maximal number of unused pages is exceeded, subsequent deallocation
+ * will be freed at the memory server. This page cache caches pages from all
+ * slabs.
+ */
+void ddekit_slab_setup_page_cache(unsigned pages);
+
+/*
+ * Destroy slab cache
+ *
+ * slab:  pointer to slab cache structure
+ */
+void ddekit_slab_destroy(struct ddekit_slab * slab);
+
+/**
+ * Initialize slab cache
+ *
+ * \param size          size of cache objects
+ * \param contiguous    make this slab use physically contiguous memory
+ *
+ * \return pointer to new slab cache or 0 on error
+ */
+struct ddekit_slab * ddekit_slab_init(unsigned size, int contiguous);
+
+
+/**********************
+ ** Memory allocator **
+ **********************/
+
+/*
+ * Allocate large memory block
+ *
+ * \param size  block size
+ * \return pointer to new memory block
+ *
+ * Allocations via this allocator may be slow (because memory servers are
+ * involved) and should be used only for large (i.e., > page size) blocks. If
+ * allocations/deallocations are relatively dynamic this may not be what you
+ * want.
+ *
+ * Allocated blocks have valid virt->phys mappings and are physically
+ * contiguous.
+ */
+void *ddekit_large_malloc(int size);
+
+/**
+ * Free large memory block
+ *
+ * \param p  pointer to memory block
+ */
+void ddekit_large_free(void *p);
+
+/** FIXME
+ * contig_malloc() is the lowest-level allocator interface one could implement.
+ * we should consider to provide vmalloc() too. */
+void *ddekit_contig_malloc(unsigned long size, unsigned long low,
+	unsigned long high, unsigned long alignment, unsigned long boundary);
+
+
+/*****************************
+ ** Simple memory allocator **
+ *****************************/
+
+/**
+ * Allocate memory block via simple allocator
+ *
+ * \param size  block size
+ * \return pointer to new memory block
+ *
+ * The blocks allocated via this allocator CANNOT be used for DMA or other
+ * device operations, i.e., there exists no virt->phys mapping.
+ */
+void *ddekit_simple_malloc(unsigned size);
+
+/**
+ * Free memory block via simple allocator
+ *
+ * \param p  pointer to memory block
+ */
+void ddekit_simple_free(void *p);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/memory.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/rpc.h
===================================================================
--- lab4/.minix-src/include/event2/rpc.h	(nonexistent)
+++ lab4/.minix-src/include/event2/rpc.h	(revision 13)
@@ -0,0 +1,597 @@
+/*	$NetBSD: rpc.h,v 1.3 2015/01/29 07:26:02 spz Exp $	*/
+/*
+ * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_RPC_H_
+#define _EVENT2_RPC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file rpc.h
+ *
+ * This header files provides basic support for an RPC server and client.
+ *
+ * To support RPCs in a server, every supported RPC command needs to be
+ * defined and registered.
+ *
+ * EVRPC_HEADER(SendCommand, Request, Reply);
+ *
+ *  SendCommand is the name of the RPC command.
+ *  Request is the name of a structure generated by event_rpcgen.py.
+ *    It contains all parameters relating to the SendCommand RPC.  The
+ *    server needs to fill in the Reply structure.
+ *  Reply is the name of a structure generated by event_rpcgen.py.  It
+ *    contains the answer to the RPC.
+ *
+ * To register an RPC with an HTTP server, you need to first create an RPC
+ * base with:
+ *
+ *   struct evrpc_base *base = evrpc_init(http);
+ *
+ * A specific RPC can then be registered with
+ *
+ * EVRPC_REGISTER(base, SendCommand, Request, Reply,  FunctionCB, arg);
+ *
+ * when the server receives an appropriately formatted RPC, the user callback
+ * is invoked.   The callback needs to fill in the reply structure.
+ *
+ * void FunctionCB(EVRPC_STRUCT(SendCommand)* rpc, void *arg);
+ *
+ * To send the reply, call EVRPC_REQUEST_DONE(rpc);
+ *
+ * See the regression test for an example.
+ */
+
+/**
+   Determines if the member has been set in the message
+
+   @param msg the message to inspect
+   @param member the member variable to test for presences
+   @return 1 if it's present or 0 otherwise.
+*/
+#define EVTAG_HAS(msg, member) \
+	((msg)->member##_set == 1)
+
+#ifndef _EVENT2_RPC_COMPAT_H_
+
+/**
+   Assigns a value to the member in the message.
+
+   @param msg the message to which to assign a value
+   @param member the name of the member variable
+   @param value the value to assign
+*/
+#define EVTAG_ASSIGN(msg, member, value) \
+	(*(msg)->base->member##_assign)((msg), (value))
+/**
+   Assigns a value to the member in the message.
+
+   @param msg the message to which to assign a value
+   @param member the name of the member variable
+   @param value the value to assign
+   @param len the length of the value
+*/
+#define EVTAG_ASSIGN_WITH_LEN(msg, member, value, len)	\
+	(*(msg)->base->member##_assign)((msg), (value), (len))
+/**
+   Returns the value for a member.
+
+   @param msg the message from which to get the value
+   @param member the name of the member variable
+   @param pvalue a pointer to the variable to hold the value
+   @return 0 on success, -1 otherwise.
+*/
+#define EVTAG_GET(msg, member, pvalue) \
+	(*(msg)->base->member##_get)((msg), (pvalue))
+/**
+   Returns the value for a member.
+
+   @param msg the message from which to get the value
+   @param member the name of the member variable
+   @param pvalue a pointer to the variable to hold the value
+   @param plen a pointer to the length of the value
+   @return 0 on success, -1 otherwise.
+*/
+#define EVTAG_GET_WITH_LEN(msg, member, pvalue, plen)	\
+	(*(msg)->base->member##_get)((msg), (pvalue), (plen))
+
+#endif  /* _EVENT2_RPC_COMPAT_H_ */
+
+/**
+   Adds a value to an array.
+*/
+#define EVTAG_ARRAY_ADD_VALUE(msg, member, value) \
+	(*(msg)->base->member##_add)((msg), (value))
+/**
+   Allocates a new entry in the array and returns it.
+*/
+#define EVTAG_ARRAY_ADD(msg, member) \
+	(*(msg)->base->member##_add)(msg)
+/**
+   Gets a variable at the specified offset from the array.
+*/
+#define EVTAG_ARRAY_GET(msg, member, offset, pvalue)	\
+	(*(msg)->base->member##_get)((msg), (offset), (pvalue))
+/**
+   Returns the number of entries in the array.
+*/
+#define EVTAG_ARRAY_LEN(msg, member) ((msg)->member##_length)
+
+
+struct evbuffer;
+struct event_base;
+struct evrpc_req_generic;
+struct evrpc_request_wrapper;
+struct evrpc;
+
+/** The type of a specific RPC Message
+ *
+ * @param rpcname the name of the RPC message
+ */
+#define EVRPC_STRUCT(rpcname) struct evrpc_req__##rpcname
+
+struct evhttp_request;
+struct evrpc_status;
+struct evrpc_hook_meta;
+
+/** Creates the definitions and prototypes for an RPC
+ *
+ * You need to use EVRPC_HEADER to create structures and function prototypes
+ * needed by the server and client implementation.  The structures have to be
+ * defined in an .rpc file and converted to source code via event_rpcgen.py
+ *
+ * @param rpcname the name of the RPC
+ * @param reqstruct the name of the RPC request structure
+ * @param replystruct the name of the RPC reply structure
+ * @see EVRPC_GENERATE()
+ */
+#define EVRPC_HEADER(rpcname, reqstruct, rplystruct) \
+EVRPC_STRUCT(rpcname) {	\
+	struct evrpc_hook_meta *hook_meta; \
+	struct reqstruct* request; \
+	struct rplystruct* reply; \
+	struct evrpc* rpc; \
+	struct evhttp_request* http_req; \
+	struct evbuffer* rpc_data; \
+};								     \
+int evrpc_send_request_##rpcname(struct evrpc_pool *, \
+    struct reqstruct *, struct rplystruct *, \
+    void (*)(struct evrpc_status *, \
+	struct reqstruct *, struct rplystruct *, void *cbarg),	\
+    void *);
+
+struct evrpc_pool;
+
+/** use EVRPC_GENERATE instead */
+struct evrpc_request_wrapper *evrpc_make_request_ctx(
+	struct evrpc_pool *pool, void *request, void *reply,
+	const char *rpcname,
+	void (*req_marshal)(struct evbuffer*, void *),
+	void (*rpl_clear)(void *),
+	int (*rpl_unmarshal)(void *, struct evbuffer *),
+	void (*cb)(struct evrpc_status *, void *, void *, void *),
+	void *cbarg);
+
+/** Creates a context structure that contains rpc specific information.
+ *
+ * EVRPC_MAKE_CTX is used to populate a RPC specific context that
+ * contains information about marshaling the RPC data types.
+ *
+ * @param rpcname the name of the RPC
+ * @param reqstruct the name of the RPC request structure
+ * @param replystruct the name of the RPC reply structure
+ * @param pool the evrpc_pool over which to make the request
+ * @param request a pointer to the RPC request structure object
+ * @param reply a pointer to the RPC reply structure object
+ * @param cb the callback function to call when the RPC has completed
+ * @param cbarg the argument to supply to the callback
+ */
+#define EVRPC_MAKE_CTX(rpcname, reqstruct, rplystruct, \
+    pool, request, reply, cb, cbarg)					\
+	evrpc_make_request_ctx(pool, request, reply,			\
+	    #rpcname,							\
+	    (void (*)(struct evbuffer *, void *))reqstruct##_marshal,	\
+	    (void (*)(void *))rplystruct##_clear,			\
+	    (int (*)(void *, struct evbuffer *))rplystruct##_unmarshal, \
+	    (void (*)(struct evrpc_status *, void *, void *, void *))cb, \
+	    cbarg)
+
+/** Generates the code for receiving and sending an RPC message
+ *
+ * EVRPC_GENERATE is used to create the code corresponding to sending
+ * and receiving a particular RPC message
+ *
+ * @param rpcname the name of the RPC
+ * @param reqstruct the name of the RPC request structure
+ * @param replystruct the name of the RPC reply structure
+ * @see EVRPC_HEADER()
+ */
+#define EVRPC_GENERATE(rpcname, reqstruct, rplystruct)			\
+	int evrpc_send_request_##rpcname(struct evrpc_pool *pool,	\
+	    struct reqstruct *request, struct rplystruct *reply,	\
+	    void (*cb)(struct evrpc_status *,				\
+		struct reqstruct *, struct rplystruct *, void *cbarg),	\
+	    void *cbarg) {						\
+	return evrpc_send_request_generic(pool, request, reply,	\
+	    (void (*)(struct evrpc_status *, void *, void *, void *))cb, \
+	    cbarg,							\
+	    #rpcname,							\
+	    (void (*)(struct evbuffer *, void *))reqstruct##_marshal,	\
+	    (void (*)(void *))rplystruct##_clear,			\
+	    (int (*)(void *, struct evbuffer *))rplystruct##_unmarshal); \
+}
+
+/** Provides access to the HTTP request object underlying an RPC
+ *
+ * Access to the underlying http object; can be used to look at headers or
+ * for getting the remote ip address
+ *
+ * @param rpc_req the rpc request structure provided to the server callback
+ * @return an struct evhttp_request object that can be inspected for
+ * HTTP headers or sender information.
+ */
+#define EVRPC_REQUEST_HTTP(rpc_req) (rpc_req)->http_req
+
+/** completes the server response to an rpc request */
+void evrpc_request_done(struct evrpc_req_generic *req);
+
+/** accessors for request and reply */
+void *evrpc_get_request(struct evrpc_req_generic *req);
+void *evrpc_get_reply(struct evrpc_req_generic *req);
+
+/** Creates the reply to an RPC request
+ *
+ * EVRPC_REQUEST_DONE is used to answer a request; the reply is expected
+ * to have been filled in.  The request and reply pointers become invalid
+ * after this call has finished.
+ *
+ * @param rpc_req the rpc request structure provided to the server callback
+ */
+#define EVRPC_REQUEST_DONE(rpc_req) do { \
+  struct evrpc_req_generic *_req = (struct evrpc_req_generic *)(rpc_req); \
+  evrpc_request_done(_req);					\
+} while (/*CONSTCOND*/0)
+
+
+struct evrpc_base;
+struct evhttp;
+
+/* functions to start up the rpc system */
+
+/** Creates a new rpc base from which RPC requests can be received
+ *
+ * @param server a pointer to an existing HTTP server
+ * @return a newly allocated evrpc_base struct
+ * @see evrpc_free()
+ */
+struct evrpc_base *evrpc_init(struct evhttp *server);
+
+/**
+ * Frees the evrpc base
+ *
+ * For now, you are responsible for making sure that no rpcs are ongoing.
+ *
+ * @param base the evrpc_base object to be freed
+ * @see evrpc_init
+ */
+void evrpc_free(struct evrpc_base *base);
+
+/** register RPCs with the HTTP Server
+ *
+ * registers a new RPC with the HTTP server, each RPC needs to have
+ * a unique name under which it can be identified.
+ *
+ * @param base the evrpc_base structure in which the RPC should be
+ *   registered.
+ * @param name the name of the RPC
+ * @param request the name of the RPC request structure
+ * @param reply the name of the RPC reply structure
+ * @param callback the callback that should be invoked when the RPC
+ * is received.  The callback has the following prototype
+ *   void (*callback)(EVRPC_STRUCT(Message)* rpc, void *arg)
+ * @param cbarg an additional parameter that can be passed to the callback.
+ *   The parameter can be used to carry around state.
+ */
+#define EVRPC_REGISTER(base, name, request, reply, callback, cbarg)	\
+	evrpc_register_generic(base, #name,				\
+	    (void (*)(struct evrpc_req_generic *, void *))callback, cbarg, \
+	    (void *(*)(void *))request##_new, NULL,			\
+	    (void (*)(void *))request##_free,				\
+	    (int (*)(void *, struct evbuffer *))request##_unmarshal,	\
+	    (void *(*)(void *))reply##_new, NULL,			\
+	    (void (*)(void *))reply##_free, \
+	    (int (*)(void *))reply##_complete, \
+	    (void (*)(struct evbuffer *, void *))reply##_marshal)
+
+/**
+   Low level function for registering an RPC with a server.
+
+   Use EVRPC_REGISTER() instead.
+
+   @see EVRPC_REGISTER()
+*/
+int evrpc_register_rpc(struct evrpc_base *, struct evrpc *,
+    void (*)(struct evrpc_req_generic*, void *), void *);
+
+/**
+ * Unregisters an already registered RPC
+ *
+ * @param base the evrpc_base object from which to unregister an RPC
+ * @param name the name of the rpc to unregister
+ * @return -1 on error or 0 when successful.
+ * @see EVRPC_REGISTER()
+ */
+#define EVRPC_UNREGISTER(base, name) evrpc_unregister_rpc((base), #name)
+
+int evrpc_unregister_rpc(struct evrpc_base *base, const char *name);
+
+/*
+ * Client-side RPC support
+ */
+
+struct evhttp_connection;
+struct evrpc_status;
+
+/** launches an RPC and sends it to the server
+ *
+ * EVRPC_MAKE_REQUEST() is used by the client to send an RPC to the server.
+ *
+ * @param name the name of the RPC
+ * @param pool the evrpc_pool that contains the connection objects over which
+ *   the request should be sent.
+ * @param request a pointer to the RPC request structure - it contains the
+ *   data to be sent to the server.
+ * @param reply a pointer to the RPC reply structure.  It is going to be filled
+ *   if the request was answered successfully
+ * @param cb the callback to invoke when the RPC request has been answered
+ * @param cbarg an additional argument to be passed to the client
+ * @return 0 on success, -1 on failure
+ */
+#define EVRPC_MAKE_REQUEST(name, pool, request, reply, cb, cbarg)	\
+	evrpc_send_request_##name((pool), (request), (reply), (cb), (cbarg))
+
+/**
+   Makes an RPC request based on the provided context.
+
+   This is a low-level function and should not be used directly
+   unless a custom context object is provided.  Use EVRPC_MAKE_REQUEST()
+   instead.
+
+   @param ctx a context from EVRPC_MAKE_CTX()
+   @returns 0 on success, -1 otherwise.
+   @see EVRPC_MAKE_REQUEST(), EVRPC_MAKE_CTX()
+*/
+int evrpc_make_request(struct evrpc_request_wrapper *ctx);
+
+/** creates an rpc connection pool
+ *
+ * a pool has a number of connections associated with it.
+ * rpc requests are always made via a pool.
+ *
+ * @param base a pointer to an struct event_based object; can be left NULL
+ *   in singled-threaded applications
+ * @return a newly allocated struct evrpc_pool object
+ * @see evrpc_pool_free()
+ */
+struct evrpc_pool *evrpc_pool_new(struct event_base *base);
+/** frees an rpc connection pool
+ *
+ * @param pool a pointer to an evrpc_pool allocated via evrpc_pool_new()
+ * @see evrpc_pool_new()
+ */
+void evrpc_pool_free(struct evrpc_pool *pool);
+
+/**
+ * Adds a connection over which rpc can be dispatched to the pool.
+ *
+ * The connection object must have been newly created.
+ *
+ * @param pool the pool to which to add the connection
+ * @param evcon the connection to add to the pool.
+ */
+void evrpc_pool_add_connection(struct evrpc_pool *pool,
+    struct evhttp_connection *evcon);
+
+/**
+ * Removes a connection from the pool.
+ *
+ * The connection object must have been newly created.
+ *
+ * @param pool the pool from which to remove the connection
+ * @param evcon the connection to remove from the pool.
+ */
+void evrpc_pool_remove_connection(struct evrpc_pool *pool,
+    struct evhttp_connection *evcon);
+
+/**
+ * Sets the timeout in secs after which a request has to complete.  The
+ * RPC is completely aborted if it does not complete by then.  Setting
+ * the timeout to 0 means that it never timeouts and can be used to
+ * implement callback type RPCs.
+ *
+ * Any connection already in the pool will be updated with the new
+ * timeout.  Connections added to the pool after set_timeout has be
+ * called receive the pool timeout only if no timeout has been set
+ * for the connection itself.
+ *
+ * @param pool a pointer to a struct evrpc_pool object
+ * @param timeout_in_secs the number of seconds after which a request should
+ *   timeout and a failure be returned to the callback.
+ */
+void evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs);
+
+/**
+ * Hooks for changing the input and output of RPCs; this can be used to
+ * implement compression, authentication, encryption, ...
+ */
+
+enum EVRPC_HOOK_TYPE {
+	EVRPC_INPUT,		/**< apply the function to an input hook */
+	EVRPC_OUTPUT		/**< apply the function to an output hook */
+};
+
+#ifndef WIN32
+/** Deprecated alias for EVRPC_INPUT.  Not available on windows, where it
+ * conflicts with platform headers. */
+#define INPUT EVRPC_INPUT
+/** Deprecated alias for EVRPC_OUTPUT.  Not available on windows, where it
+ * conflicts with platform headers. */
+#define OUTPUT EVRPC_OUTPUT
+#endif
+
+/**
+ * Return value from hook processing functions
+ */
+
+enum EVRPC_HOOK_RESULT {
+	EVRPC_TERMINATE = -1,	/**< indicates the rpc should be terminated */
+	EVRPC_CONTINUE = 0,	/**< continue processing the rpc */
+	EVRPC_PAUSE = 1		/**< pause processing request until resumed */
+};
+
+/** adds a processing hook to either an rpc base or rpc pool
+ *
+ * If a hook returns TERMINATE, the processing is aborted. On CONTINUE,
+ * the request is immediately processed after the hook returns.  If the
+ * hook returns PAUSE, request processing stops until evrpc_resume_request()
+ * has been called.
+ *
+ * The add functions return handles that can be used for removing hooks.
+ *
+ * @param vbase a pointer to either struct evrpc_base or struct evrpc_pool
+ * @param hook_type either INPUT or OUTPUT
+ * @param cb the callback to call when the hook is activated
+ * @param cb_arg an additional argument for the callback
+ * @return a handle to the hook so it can be removed later
+ * @see evrpc_remove_hook()
+ */
+void *evrpc_add_hook(void *vbase,
+    enum EVRPC_HOOK_TYPE hook_type,
+    int (*cb)(void *, struct evhttp_request *, struct evbuffer *, void *),
+    void *cb_arg);
+
+/** removes a previously added hook
+ *
+ * @param vbase a pointer to either struct evrpc_base or struct evrpc_pool
+ * @param hook_type either INPUT or OUTPUT
+ * @param handle a handle returned by evrpc_add_hook()
+ * @return 1 on success or 0 on failure
+ * @see evrpc_add_hook()
+ */
+int evrpc_remove_hook(void *vbase,
+    enum EVRPC_HOOK_TYPE hook_type,
+    void *handle);
+
+/** resume a paused request
+ *
+ * @param vbase a pointer to either struct evrpc_base or struct evrpc_pool
+ * @param ctx the context pointer provided to the original hook call
+ */
+int
+evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res);
+
+/** adds meta data to request
+ *
+ * evrpc_hook_add_meta() allows hooks to add meta data to a request. for
+ * a client request, the meta data can be inserted by an outgoing request hook
+ * and retrieved by the incoming request hook.
+ *
+ * @param ctx the context provided to the hook call
+ * @param key a NUL-terminated c-string
+ * @param data the data to be associated with the key
+ * @param data_size the size of the data
+ */
+void evrpc_hook_add_meta(void *ctx, const char *key,
+    const void *data, size_t data_size);
+
+/** retrieves meta data previously associated
+ *
+ * evrpc_hook_find_meta() can be used to retrieve meta data associated to a
+ * request by a previous hook.
+ * @param ctx the context provided to the hook call
+ * @param key a NUL-terminated c-string
+ * @param data pointer to a data pointer that will contain the retrieved data
+ * @param data_size pointer to the size of the data
+ * @return 0 on success or -1 on failure
+ */
+int evrpc_hook_find_meta(void *ctx, const char *key,
+    void **data, size_t *data_size);
+
+/**
+ * returns the connection object associated with the request
+ *
+ * @param ctx the context provided to the hook call
+ * @return a pointer to the evhttp_connection object
+ */
+struct evhttp_connection *evrpc_hook_get_connection(void *ctx);
+
+/**
+   Function for sending a generic RPC request.
+
+   Do not call this function directly, use EVRPC_MAKE_REQUEST() instead.
+
+   @see EVRPC_MAKE_REQUEST()
+ */
+int evrpc_send_request_generic(struct evrpc_pool *pool,
+    void *request, void *reply,
+    void (*cb)(struct evrpc_status *, void *, void *, void *),
+    void *cb_arg,
+    const char *rpcname,
+    void (*req_marshal)(struct evbuffer *, void *),
+    void (*rpl_clear)(void *),
+    int (*rpl_unmarshal)(void *, struct evbuffer *));
+
+/**
+   Function for registering a generic RPC with the RPC base.
+
+   Do not call this function directly, use EVRPC_REGISTER() instead.
+
+   @see EVRPC_REGISTER()
+ */
+int
+evrpc_register_generic(struct evrpc_base *base, const char *name,
+    void (*callback)(struct evrpc_req_generic *, void *), void *cbarg,
+    void *(*req_new)(void *), void *req_new_arg, void (*req_free)(void *),
+    int (*req_unmarshal)(void *, struct evbuffer *),
+    void *(*rpl_new)(void *), void *rpl_new_arg, void (*rpl_free)(void *),
+    int (*rpl_complete)(void *),
+    void (*rpl_marshal)(struct evbuffer *, void *));
+
+/** accessors for obscure and undocumented functionality */
+struct evrpc_pool* evrpc_request_get_pool(struct evrpc_request_wrapper *ctx);
+void evrpc_request_set_pool(struct evrpc_request_wrapper *ctx,
+    struct evrpc_pool *pool);
+void evrpc_request_set_cb(struct evrpc_request_wrapper *ctx,
+    void (*cb)(struct evrpc_status*, void *request, void *reply, void *arg),
+    void *cb_arg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_RPC_H_ */

Property changes on: lab4/.minix-src/include/event2/rpc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/tag_compat.h
===================================================================
--- lab4/.minix-src/include/event2/tag_compat.h	(nonexistent)
+++ lab4/.minix-src/include/event2/tag_compat.h	(revision 13)
@@ -0,0 +1,51 @@
+/*	$NetBSD: tag_compat.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*	$NetBSD: tag_compat.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_TAG_COMPAT_H_
+#define _EVENT2_TAG_COMPAT_H_
+
+/** @file event2/tag_compat.h
+
+    Obsolete/deprecated functions from tag.h; provided only for backwards
+    compatibility.
+ */
+
+/**
+   @name Misnamed functions
+
+   @deprecated These macros are deprecated because their names don't follow
+     Libevent's naming conventions.  Use evtag_encode_int and
+     evtag_encode_int64 instead.
+
+   @{
+*/
+#define encode_int(evbuf, number) evtag_encode_int((evbuf), (number))
+#define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number))
+/**@}*/
+
+#endif /* _EVENT2_TAG_H_ */

Property changes on: lab4/.minix-src/include/event2/tag_compat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/printf.h
===================================================================
--- lab4/.minix-src/include/ddekit/printf.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/printf.h	(revision 13)
@@ -0,0 +1,34 @@
+#ifndef _DDEKIT_PRINTF_H
+#define _DDEKIT_PRINTF_H
+
+#include <ddekit/ddekit.h>
+#include <stdarg.h>
+
+/** Print message.
+ * \ingroup DDEKit_util
+ */
+int ddekit_print(const char *);
+
+/** Print message with format.
+ * \ingroup DDEKit_util
+ */
+int ddekit_printf(const char *fmt, ...);
+
+/** Print message with format list.
+ * \ingroup DDEKit_util
+ */
+int ddekit_vprintf(const char *fmt, va_list va);
+
+/** Log function and message.
+ * \ingroup DDEKit_util
+ */
+#define ddekit_log(doit, msg...) \
+	do {                                       \
+		if (doit) {                            \
+			ddekit_printf("%s(): ", __func__); \
+			ddekit_printf(msg);                \
+			ddekit_printf("\n");               \
+		}                                      \
+	} while(0);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/printf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fs/udf/ecma167-udf.h
===================================================================
--- lab4/.minix-src/include/fs/udf/ecma167-udf.h	(nonexistent)
+++ lab4/.minix-src/include/fs/udf/ecma167-udf.h	(revision 13)
@@ -0,0 +1,835 @@
+/* $NetBSD: ecma167-udf.h,v 1.14 2011/07/07 17:45:38 reinoud Exp $ */
+
+/*-
+ * Copyright (c) 2003, 2004, 2005, 2006, 2008, 2009
+ * 	Reinoud Zandijk * <reinoud@NetBSD.org>
+ * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * 
+ * Extended and adapted for UDFv2.50+ bij Reinoud Zandijk based on the
+ * original by Scott Long.
+ * 
+ * 20030508 Made some small typo and explanatory comments
+ * 20030510 Added UDF 2.01 structures
+ * 20030519 Added/correct comments on multi-partitioned logical volume space
+ * 20050616 Added pseudo overwrite
+ * 20050624 Added the missing extended attribute types and `magic values'.
+ * 20051106 Reworked some implementation use parts
+ *
+ */
+
+
+#ifndef _FS_UDF_ECMA167_UDF_H_
+#define _FS_UDF_ECMA167_UDF_H_
+
+
+/*
+ * in case of an older gcc versions, define the __packed as explicit
+ * attribute
+ */
+
+/*
+ * You may specify the `aligned' and `transparent_union' attributes either in
+ * a `typedef' declaration or just past the closing curly brace of a complete
+ * enum, struct or union type _definition_ and the `packed' attribute only
+ * past the closing brace of a definition.  You may also specify attributes
+ * between the enum, struct or union tag and the name of the type rather than
+ * after the closing brace.
+*/
+
+#ifndef __packed
+#define __packed __attribute__((packed))
+#endif
+
+
+/* ecma167-udf.h */
+
+/* Volume recognition sequence ECMA 167 rev. 3 16.1 */
+struct vrs_desc {
+	uint8_t			struct_type;
+	uint8_t			identifier[5];
+	uint8_t			version;
+	uint8_t			data[2041];
+} __packed;
+
+
+#define VRS_NSR02		"NSR02"
+#define VRS_NSR03		"NSR03"
+#define VRS_BEA01		"BEA01"
+#define VRS_TEA01		"TEA01"
+#define VRS_CD001		"CD001"
+#define VRS_CDW02		"CDW02"
+
+
+/* Structure/definitions/constants a la ECMA 167 rev. 3 */
+
+
+#define MAX_TAGID_VOLUMES 9
+/* Tag identifiers */
+enum {
+	TAGID_SPARING_TABLE = 	  0,
+	TAGID_PRI_VOL =		  1,
+	TAGID_ANCHOR =		  2,
+	TAGID_VOL = 		  3,
+	TAGID_IMP_VOL =		  4,
+	TAGID_PARTITION =	  5,
+	TAGID_LOGVOL =		  6,
+	TAGID_UNALLOC_SPACE =	  7,
+	TAGID_TERM =		  8,
+	TAGID_LOGVOL_INTEGRITY=	  9,
+	TAGID_FSD =		256,
+	TAGID_FID =		257,
+	TAGID_ALLOCEXTENT = 	258,
+	TAGID_INDIRECTENTRY =	259,
+	TAGID_ICB_TERM =	260,
+	TAGID_FENTRY =		261,
+	TAGID_EXTATTR_HDR =	262,
+	TAGID_UNALL_SP_ENTRY =	263,
+	TAGID_SPACE_BITMAP = 	264,
+	TAGID_PART_INTEGRITY = 	265,
+	TAGID_EXTFENTRY =	266,
+	TAGID_MAX =		266
+};
+
+
+enum {
+	UDF_DOMAIN_FLAG_HARD_WRITE_PROTECT = 1,
+	UDF_DOMAIN_FLAG_SOFT_WRITE_PROTECT = 2
+};
+
+
+enum {
+	UDF_ACCESSTYPE_NOT_SPECIFIED   = 0,	/* unknown				*/
+	UDF_ACCESSTYPE_PSEUDO_OVERWITE = 0,	/* pseudo overwritable, e.g. BD-R's LOW */
+	UDF_ACCESSTYPE_READ_ONLY       = 1,	/* really only readable			*/
+	UDF_ACCESSTYPE_WRITE_ONCE      = 2,	/* write once and you're done		*/
+	UDF_ACCESSTYPE_REWRITEABLE     = 3,	/* may need extra work to rewrite	*/
+	UDF_ACCESSTYPE_OVERWRITABLE    = 4	/* no limits on rewriting; e.g. harddisc*/
+};
+
+
+/* Descriptor tag [3/7.2] */
+struct desc_tag {
+	uint16_t	id;
+	uint16_t	descriptor_ver;
+	uint8_t		cksum;
+	uint8_t		reserved;
+	uint16_t	serial_num;
+	uint16_t	desc_crc;
+	uint16_t	desc_crc_len;
+	uint32_t	tag_loc;
+} __packed;
+#define UDF_DESC_TAG_LENGTH 16
+
+
+/* Recorded Address [4/7.1] */
+struct lb_addr {			/* within partition space */
+	uint32_t	lb_num;
+	uint16_t	part_num;
+} __packed;
+
+
+/* Extent Descriptor [3/7.1] */
+struct extent_ad {
+	uint32_t	len;
+	uint32_t	loc;
+} __packed;
+
+
+/* Short Allocation Descriptor [4/14.14.1] */
+struct short_ad {
+	uint32_t	len;
+	uint32_t	lb_num;
+} __packed;
+
+
+/* Long Allocation Descriptor [4/14.14.2] */
+struct UDF_ADImp_use {
+	uint16_t	flags;
+	uint32_t	unique_id;
+} __packed;
+#define UDF_ADIMP_FLAGS_EXTENT_ERASED 1
+
+
+struct long_ad {
+	uint32_t	len;
+	struct lb_addr	loc;			/* within a logical volume mapped partition space !! */
+	union {
+		uint8_t	bytes[6];
+		struct UDF_ADImp_use im_used;
+	} impl;
+} __packed;
+#define longad_uniqueid impl.im_used.unique_id
+
+
+/* Extended Allocation Descriptor [4/14.14.3] ; identifies an extent of allocation descriptors ; also in UDF ? */
+struct ext_ad {
+	uint32_t	ex_len;
+	uint32_t	rec_len;
+	uint32_t	inf_len;
+	struct lb_addr	ex_loc;
+	uint8_t		reserved[2];
+} __packed;
+
+
+/* ICB : Information Control Block; positioning */
+union icb {
+	struct short_ad	s_ad;
+	struct long_ad	l_ad;
+	struct ext_ad	e_ad;
+};
+
+
+/* short/long/ext extent have flags encoded in length */
+#define UDF_EXT_ALLOCATED              (0<<30)
+#define UDF_EXT_FREED                  (1<<30)
+#define UDF_EXT_ALLOCATED_BUT_NOT_USED (1<<30)
+#define UDF_EXT_FREE                   (2<<30)
+#define UDF_EXT_REDIRECT               (3<<30)
+#define UDF_EXT_FLAGS(len) ((len) & (3<<30))
+#define UDF_EXT_LEN(len)   ((len) & ((1<<30)-1))
+#define UDF_EXT_MAXLEN     ((1<<30)-1)
+
+
+/* Character set spec [1/7.2.1] */
+struct charspec {
+	uint8_t		type;
+	uint8_t		inf[63];
+} __packed;
+
+
+struct pathcomp {
+	uint8_t		type;
+	uint8_t		l_ci;
+	uint16_t	comp_filever;
+	uint8_t		ident[256];
+} __packed;
+#define	UDF_PATH_COMP_SIZE 4
+#define UDF_PATH_COMP_RESERVED		0
+#define UDF_PATH_COMP_ROOT		1
+#define UDF_PATH_COMP_MOUNTROOT		2
+#define UDF_PATH_COMP_PARENTDIR		3
+#define UDF_PATH_COMP_CURDIR		4
+#define UDF_PATH_COMP_NAME		5
+
+
+/* Timestamp [1/7.3] */
+struct timestamp {
+	uint16_t	type_tz;
+	uint16_t	year;
+	uint8_t		month;
+	uint8_t		day;
+	uint8_t		hour;
+	uint8_t		minute;
+	uint8_t		second;
+	uint8_t		centisec;
+	uint8_t		hund_usec;
+	uint8_t		usec;
+} __packed;
+#define UDF_TIMESTAMP_SIZE 12
+
+
+/* Entity Identifier [1/7.4] */
+#define	UDF_REGID_ID_SIZE	23
+struct regid {
+	uint8_t		flags;
+	uint8_t		id[UDF_REGID_ID_SIZE];
+	uint8_t		id_suffix[8];
+} __packed;
+
+
+/* ICB Tag [4/14.6] */
+struct icb_tag {
+	uint32_t	prev_num_dirs;
+	uint16_t	strat_type;
+	uint8_t		strat_param[2];
+	uint16_t	max_num_entries;
+	uint8_t		reserved;
+	uint8_t		file_type;
+	struct lb_addr	parent_icb;
+	uint16_t	flags;
+} __packed;
+#define UDF_ICB_TAG_FLAGS_ALLOC_MASK	0x03
+#define UDF_ICB_SHORT_ALLOC		0x00
+#define UDF_ICB_LONG_ALLOC		0x01
+#define UDF_ICB_EXT_ALLOC		0x02
+#define UDF_ICB_INTERN_ALLOC		0x03
+
+#define UDF_ICB_TAG_FLAGS_DIRORDERED	(1<< 3)
+#define UDF_ICB_TAG_FLAGS_NONRELOC	(1<< 4)
+#define UDF_ICB_TAG_FLAGS_CONTIGUES	(1<< 9)
+#define UDF_ICB_TAG_FLAGS_MULTIPLEVERS	(1<<12)
+
+#define	UDF_ICB_TAG_FLAGS_SETUID	(1<< 6)
+#define	UDF_ICB_TAG_FLAGS_SETGID	(1<< 7)
+#define	UDF_ICB_TAG_FLAGS_STICKY	(1<< 8)
+
+#define UDF_ICB_FILETYPE_UNKNOWN	  0
+#define UDF_ICB_FILETYPE_UNALLOCSPACE	  1
+#define UDF_ICB_FILETYPE_PARTINTEGRITY    2
+#define UDF_ICB_FILETYPE_INDIRECTENTRY	  3
+#define UDF_ICB_FILETYPE_DIRECTORY	  4
+#define UDF_ICB_FILETYPE_RANDOMACCESS	  5
+#define UDF_ICB_FILETYPE_BLOCKDEVICE	  6
+#define UDF_ICB_FILETYPE_CHARDEVICE	  7
+#define UDF_ICB_FILETYPE_EXTATTRREC	  8
+#define UDF_ICB_FILETYPE_FIFO		  9
+#define UDF_ICB_FILETYPE_SOCKET		 10
+#define UDF_ICB_FILETYPE_TERM		 11
+#define UDF_ICB_FILETYPE_SYMLINK	 12
+#define UDF_ICB_FILETYPE_STREAMDIR	 13
+#define UDF_ICB_FILETYPE_VAT		248
+#define UDF_ICB_FILETYPE_REALTIME	249
+#define UDF_ICB_FILETYPE_META_MAIN	250
+#define UDF_ICB_FILETYPE_META_MIRROR	251
+#define UDF_ICB_FILETYPE_META_BITMAP	252
+
+
+/* Anchor Volume Descriptor Pointer [3/10.2] */
+struct anchor_vdp {
+	struct desc_tag		tag;
+	struct extent_ad	main_vds_ex;		/* to main volume descriptor set      ; 16 sectors min */
+	struct extent_ad	reserve_vds_ex;		/* copy of main volume descriptor set ; 16 sectors min */
+} __packed;
+
+
+/* Volume Descriptor Pointer [3/10.3] */
+struct vol_desc_ptr {
+	struct desc_tag		tag;			/* use for extending the volume descriptor space */
+	uint32_t		vds_number;
+	struct extent_ad	next_vds_ex;		/* points to the next block for volume descriptor space */
+} __packed;
+
+
+/* Primary Volume Descriptor [3/10.1] */
+struct pri_vol_desc {
+	struct desc_tag		tag;
+	uint32_t		seq_num;		/* MAX prevail */
+	uint32_t		pvd_num;		/* assigned by author; 0 is special as in it may only occur once */
+	char			vol_id[32];		/* KEY ; main identifier of this disc */
+	uint16_t		vds_num;		/* volume descriptor number; i.e. what volume number is it */
+	uint16_t		max_vol_seq;		/* maximum volume descriptor number known */
+	uint16_t		ichg_lvl;
+	uint16_t		max_ichg_lvl;
+	uint32_t		charset_list;
+	uint32_t		max_charset_list;
+	char			volset_id[128];		/* KEY ; if part of a multi-disc set or a band of volumes */
+	struct charspec		desc_charset;		/* KEY according to ECMA 167 */
+	struct charspec		explanatory_charset;
+	struct extent_ad	vol_abstract;
+	struct extent_ad	vol_copyright;
+	struct regid		app_id;
+	struct timestamp	time;
+	struct regid		imp_id;
+	uint8_t			imp_use[64];
+	uint32_t		prev_vds_loc;		/* location of predecessor _lov ? */
+	uint16_t		flags;			/* bit 0 : if set indicates volume set name is meaningful */
+	uint8_t			reserved[22];
+} __packed;
+
+
+/* UDF specific implementation use part of the implementation use volume descriptor */
+struct udf_lv_info {
+	struct charspec		lvi_charset;
+	char			logvol_id[128];
+
+	char			lvinfo1[36];
+	char			lvinfo2[36];
+	char			lvinfo3[36];
+
+	struct regid		impl_id;
+	uint8_t			impl_use[128];
+} __packed;
+
+
+/* Implementation use Volume Descriptor */
+struct impvol_desc {
+	struct desc_tag		tag;
+	uint32_t		seq_num;
+	struct regid		impl_id;
+	union {
+		struct udf_lv_info	lv_info;
+		char			impl_use[460];
+	} _impl_use;
+} __packed;
+
+
+/* Logical Volume Descriptor [3/10.6] */
+struct logvol_desc {
+	struct desc_tag		tag;
+	uint32_t		seq_num;		/* MAX prevail */
+	struct charspec		desc_charset;		/* KEY */
+	char			logvol_id[128];		/* KEY */
+	uint32_t		lb_size;
+	struct regid		domain_id;
+	union {
+		struct long_ad	fsd_loc;		/* to fileset descriptor SEQUENCE */
+		uint8_t		logvol_content_use[16];
+	} _lvd_use;
+	uint32_t		mt_l;			/* Partition map length */
+	uint32_t		n_pm;			/* Number of partition maps */
+	struct regid		imp_id;
+	uint8_t			imp_use[128];
+	struct extent_ad	integrity_seq_loc;
+	uint8_t			maps[1];
+} __packed;
+#define lv_fsd_loc _lvd_use.fsd_loc
+
+#define UDF_INTEGRITY_OPEN	0
+#define UDF_INTEGRITY_CLOSED	1
+
+
+#define	UDF_PMAP_SIZE	64
+
+/* Type 1 Partition Map [3/10.7.2] */
+struct part_map_1 {
+	uint8_t			type;
+	uint8_t			len;
+	uint16_t		vol_seq_num;
+	uint16_t		part_num;
+} __packed;
+
+
+/* Type 2 Partition Map [3/10.7.3] */
+struct part_map_2 {
+	uint8_t			type;
+	uint8_t			len;
+	uint8_t			reserved[2];
+	struct regid		part_id;
+	uint16_t		vol_seq_num;
+	uint16_t		part_num;
+	uint8_t			reserved2[24];
+} __packed;
+
+
+/* Virtual Partition Map [UDF 2.01/2.2.8] */
+struct part_map_virt {
+	uint8_t			type;
+	uint8_t			len;
+	uint8_t			reserved[2];
+	struct regid		id;
+	uint16_t		vol_seq_num;
+	uint16_t		part_num;
+	uint8_t			reserved1[24];
+} __packed;
+
+
+/* Sparable Partition Map [UDF 2.01/2.2.9] */
+struct part_map_spare {
+	uint8_t			type;
+	uint8_t			len;
+	uint8_t			reserved[2];
+	struct regid		id;
+	uint16_t		vol_seq_num;
+	uint16_t		part_num;
+	uint16_t		packet_len;
+	uint8_t			n_st;		/* Number of redundant sparing tables range 1-4 */
+	uint8_t			reserved1;
+	uint32_t		st_size;	/* size of EACH sparing table  */
+	uint32_t		st_loc[1];	/* locations of sparing tables */
+} __packed;
+
+
+/* Metadata Partition Map [UDF 2.50/2.2.10] */
+struct part_map_meta {
+	uint8_t			type;
+	uint8_t			len;
+	uint8_t			reserved[2];
+	struct regid		id;
+	uint16_t		vol_seq_num;
+	uint16_t		part_num;
+	uint32_t		meta_file_lbn;		/* logical block number for file entry within part_num */
+	uint32_t		meta_mirror_file_lbn;
+	uint32_t		meta_bitmap_file_lbn;
+	uint32_t		alloc_unit_size;	/* allocation unit size in blocks */
+	uint16_t		alignment_unit_size;	/* alignment necessary in blocks  */
+	uint8_t			flags;
+	uint8_t			reserved1[5];
+} __packed;
+#define METADATA_DUPLICATED	1
+
+
+union udf_pmap {
+	uint8_t			data[UDF_PMAP_SIZE];
+	struct part_map_1	pm1;
+	struct part_map_2	pm2;
+	struct part_map_virt	pmv;
+	struct part_map_spare	pms;
+	struct part_map_meta	pmm;
+};
+
+
+/* Sparing Map Entry [UDF 2.01/2.2.11] */
+struct spare_map_entry {
+	uint32_t		org;			/* partition relative address  */
+	uint32_t		map;			/* absolute disc address (!) can be in partition, but doesn't have to be */
+} __packed;
+
+
+/* Sparing Table [UDF 2.01/2.2.11] */
+struct udf_sparing_table {
+	struct desc_tag		tag;
+	struct regid		id;
+	uint16_t		rt_l;			/* Relocation Table len */
+	uint8_t			reserved[2];
+	uint32_t		seq_num;
+	struct spare_map_entry	entries[1];
+} __packed;
+
+
+#define UDF_NO_PREV_VAT		0xffffffff
+/* UDF 1.50 VAT suffix [UDF 2.2.10 (UDF 1.50 spec)] */
+struct udf_oldvat_tail {
+	struct regid		id;			/* "*UDF Virtual Alloc Tbl" */
+	uint32_t		prev_vat;
+} __packed;
+
+
+/* VAT table [UDF 2.0.1/2.2.10] */
+struct udf_vat {
+	uint16_t		header_len;
+	uint16_t		impl_use_len;
+	char			logvol_id[128];		/* newer version of the LVD one */
+	uint32_t		prev_vat;
+	uint32_t		num_files;
+	uint32_t		num_directories;
+	uint16_t		min_udf_readver;
+	uint16_t		min_udf_writever;
+	uint16_t		max_udf_writever;
+	uint16_t		reserved;
+	uint8_t			data[1];		/* impl.use followed by VAT entries (uint32_t) */
+} __packed;
+
+
+/* Space bitmap descriptor as found in the partition header descriptor */
+struct space_bitmap_desc {
+	struct desc_tag		tag;			/* TagId 264			*/
+	uint32_t		num_bits;		/* number of bits		*/
+	uint32_t		num_bytes;		/* bytes that contain it	*/
+	uint8_t			data[1];
+} __packed;
+
+
+/* Unalloc space entry as found in the partition header descriptor */
+struct space_entry_desc {
+	struct desc_tag		tag;			/* TagId 263			*/
+	struct icb_tag		icbtag;			/* type 1			*/
+	uint32_t		l_ad;			/* in bytes			*/
+	uint8_t			entry[1];
+} __packed;
+
+
+/* Partition header descriptor; in the contents_use of part_desc */
+struct part_hdr_desc {
+	struct short_ad		unalloc_space_table;
+	struct short_ad		unalloc_space_bitmap;
+	struct short_ad		part_integrity_table;	/* has to be ZERO for UDF */
+	struct short_ad		freed_space_table;
+	struct short_ad		freed_space_bitmap;
+	uint8_t			reserved[88];
+} __packed;
+
+
+/* Partition Descriptor [3/10.5] */
+struct part_desc {
+	struct desc_tag		tag;
+	uint32_t		seq_num;		/* MAX prevailing */
+	uint16_t		flags;			/* bit 0 : if set the space is allocated */
+	uint16_t		part_num;		/* KEY */
+	struct regid		contents;
+	union {
+		struct part_hdr_desc	part_hdr;
+		uint8_t			contents_use[128];
+	} _impl_use;
+	uint32_t		access_type;		/* R/W, WORM etc. */
+	uint32_t		start_loc;		/* start of partition with given length */
+	uint32_t		part_len;
+	struct regid		imp_id;
+	uint8_t			imp_use[128];
+	uint8_t			reserved[156];
+} __packed;
+#define pd_part_hdr _impl_use.part_hdr
+#define UDF_PART_FLAG_ALLOCATED		1
+
+
+/* Unallocated Space Descriptor (UDF 2.01/2.2.5) */
+struct unalloc_sp_desc {
+	struct desc_tag		tag;
+	uint32_t		seq_num;	/* MAX prevailing */
+	uint32_t		alloc_desc_num;
+	struct extent_ad	alloc_desc[1];
+} __packed;
+
+
+/* Logical Volume Integrity Descriptor [3/30.10] */
+struct logvolhdr {
+	uint64_t		next_unique_id;
+	/* rest reserved */
+} __packed;
+
+
+struct udf_logvol_info {
+	struct regid		impl_id;
+	uint32_t		num_files;
+	uint32_t		num_directories;
+	uint16_t		min_udf_readver;
+	uint16_t		min_udf_writever;
+	uint16_t		max_udf_writever;
+} __packed;
+
+
+struct logvol_int_desc {
+	struct desc_tag		tag;
+	struct timestamp	time;
+	uint32_t		integrity_type;
+	struct extent_ad	next_extent;
+	union {
+		struct logvolhdr  logvolhdr;
+		int8_t		  reserved[32];
+	} _impl_use;
+	uint32_t		num_part;
+	uint32_t		l_iu;
+	uint32_t		tables[1];	/* Freespace table, Sizetable, Implementation use */
+} __packed;
+#define lvint_next_unique_id _impl_use.logvolhdr.next_unique_id
+
+
+/* File Set Descriptor [4/14.1] */
+struct fileset_desc {
+	struct desc_tag		tag;
+	struct timestamp	time;
+	uint16_t		ichg_lvl;
+	uint16_t		max_ichg_lvl;
+	uint32_t		charset_list;
+	uint32_t		max_charset_list;
+	uint32_t		fileset_num;			/* key! */
+	uint32_t		fileset_desc_num;
+	struct charspec		logvol_id_charset;
+	char			logvol_id[128];			/* for recovery			*/
+	struct charspec		fileset_charset;
+	char			fileset_id[32];			/* Mountpoint !!		*/
+	char			copyright_file_id[32];
+	char			abstract_file_id[32];
+	struct long_ad		rootdir_icb;			/* to rootdir; icb->virtual ?	*/
+	struct regid		domain_id;
+	struct long_ad		next_ex;			/* to the next fileset_desc extent */
+	struct long_ad		streamdir_icb;			/* streamdir; needed?		*/
+	uint8_t			reserved[32];
+} __packed;
+
+
+/* File Identifier Descriptor [4/14.4] */
+struct fileid_desc {
+	struct desc_tag		tag;
+	uint16_t		file_version_num;
+	uint8_t			file_char;
+	uint8_t			l_fi;	/* Length of file identifier area */
+	struct long_ad		icb;
+	uint16_t		l_iu;	/* Length of implementation use area */
+	uint8_t			data[0];
+} __packed;
+#define	UDF_FID_SIZE	38
+#define	UDF_FILE_CHAR_VIS	(1 << 0) /* Invisible */
+#define	UDF_FILE_CHAR_DIR	(1 << 1) /* Directory */
+#define	UDF_FILE_CHAR_DEL	(1 << 2) /* Deleted */
+#define	UDF_FILE_CHAR_PAR	(1 << 3) /* Parent Directory */
+#define	UDF_FILE_CHAR_META	(1 << 4) /* Stream metadata */
+
+
+/* Extended attributes [4/14.10.1] */
+struct extattrhdr_desc {
+	struct desc_tag		tag;
+	uint32_t		impl_attr_loc;	/* offsets within this descriptor */
+	uint32_t		appl_attr_loc;	/* ditto */
+} __packed;
+#define UDF_IMPL_ATTR_LOC_NOT_PRESENT 0xffffffff
+#define UDF_APPL_ATTR_LOC_NOT_PRESENT 0xffffffff
+
+
+/* Extended attribute entry [4/48.10.2] */
+struct extattr_entry {
+	uint32_t		type;
+	uint8_t			subtype;
+	uint8_t			reserved[3];
+	uint32_t		a_l;
+} __packed;
+
+
+/* Extended attribute entry; type 2048 [4/48.10.8] */
+struct impl_extattr_entry {
+	struct extattr_entry    hdr;
+	uint32_t		iu_l;
+	struct regid		imp_id;
+	uint8_t			data[1];
+} __packed;
+
+
+/* Extended attribute entry; type 65 536 [4/48.10.9] */
+struct appl_extattr_entry {
+	struct extattr_entry    hdr;
+	uint32_t		au_l;
+	struct regid		appl_id;
+	uint8_t			data[1];
+} __packed;
+
+
+/* File Times attribute entry; type 5 or type 6 [4/48.10.5], [4/48.10.6] */
+struct filetimes_extattr_entry {
+	struct extattr_entry    hdr;
+	uint32_t		d_l;		/* length of times[] data following */
+	uint32_t		existence;	/* bitmask */
+	struct timestamp	times[1];	/* in order of ascending bits */
+} __packed;
+#define UDF_FILETIMES_ATTR_NO	5
+#define UDF_FILETIMES_FILE_CREATION	1
+#define UDF_FILETIMES_FILE_DELETION	4
+#define UDF_FILETIMES_FILE_EFFECTIVE	8
+#define UDF_FILETIMES_FILE_BACKUPED	16
+#define UDF_FILETIMES_ATTR_SIZE(no)	(20 + (no)*sizeof(struct timestamp))
+
+
+/* Device Specification Extended Attribute [4/4.10.7] */
+struct device_extattr_entry {
+	struct extattr_entry	hdr;
+	uint32_t		iu_l;		/* length of implementation use */
+	uint32_t		major;
+	uint32_t		minor;
+	uint8_t			data[1];	/* UDF: if nonzero length, contain developer ID regid */
+} __packed;
+#define UDF_DEVICESPEC_ATTR_NO	12
+
+
+/* VAT LV extension Extended Attribute [UDF 3.3.4.5.1.3] 1.50 errata */
+struct vatlvext_extattr_entry {
+	uint64_t		unique_id_chk;	/* needs to be copy of ICB's */
+	uint32_t		num_files;
+	uint32_t		num_directories;
+	char			logvol_id[128];	/* replaces logvol name */
+} __packed;
+
+
+/* File Entry [4/14.9] */
+struct file_entry {
+	struct desc_tag		tag;
+	struct icb_tag		icbtag;
+	uint32_t		uid;
+	uint32_t		gid;
+	uint32_t		perm;
+	uint16_t		link_cnt;
+	uint8_t			rec_format;
+	uint8_t			rec_disp_attr;
+	uint32_t		rec_len;
+	uint64_t		inf_len;
+	uint64_t		logblks_rec;
+	struct timestamp	atime;
+	struct timestamp	mtime;
+	struct timestamp	attrtime;
+	uint32_t		ckpoint;
+	struct long_ad		ex_attr_icb;
+	struct regid		imp_id;
+	uint64_t		unique_id;
+	uint32_t		l_ea;	/* Length of extended attribute area */
+	uint32_t		l_ad;	/* Length of allocation descriptors */
+	uint8_t			data[1];
+} __packed;
+#define	UDF_FENTRY_SIZE	176
+#define	UDF_FENTRY_PERM_USER_MASK	0x07
+#define	UDF_FENTRY_PERM_GRP_MASK	0xE0
+#define	UDF_FENTRY_PERM_OWNER_MASK	0x1C00
+
+
+/* Extended File Entry [4/48.17] */
+struct extfile_entry {
+	struct desc_tag		tag;
+	struct icb_tag		icbtag;
+	uint32_t		uid;
+	uint32_t		gid;
+	uint32_t		perm;
+	uint16_t		link_cnt;
+	uint8_t			rec_format;
+	uint8_t			rec_disp_attr;
+	uint32_t		rec_len;
+	uint64_t		inf_len;
+	uint64_t		obj_size;
+	uint64_t		logblks_rec;
+	struct timestamp	atime;
+	struct timestamp	mtime;
+	struct timestamp	ctime;
+	struct timestamp	attrtime;
+	uint32_t		ckpoint;
+	uint32_t		reserved1;
+	struct long_ad		ex_attr_icb;
+	struct long_ad		streamdir_icb;
+	struct regid		imp_id;
+	uint64_t		unique_id;
+	uint32_t		l_ea;	/* Length of extended attribute area */
+	uint32_t		l_ad;	/* Length of allocation descriptors */
+	uint8_t			data[1];
+} __packed;
+#define	UDF_EXTFENTRY_SIZE	216
+
+
+/* Indirect entry [ecma 48.7] */
+struct indirect_entry {
+	struct desc_tag		tag;
+	struct icb_tag		icbtag;
+	struct long_ad		indirect_icb;
+} __packed;
+
+
+/* Allocation extent descriptor [ecma 48.5] */
+struct alloc_ext_entry {
+	struct desc_tag		tag;
+	uint32_t		prev_entry;
+	uint32_t		l_ad;
+	uint8_t			data[1];
+} __packed;
+
+
+union dscrptr {
+	struct desc_tag		 tag;
+	struct anchor_vdp	 avdp;
+	struct vol_desc_ptr	 vdp;
+	struct pri_vol_desc	 pvd;
+	struct logvol_desc	 lvd;
+	struct unalloc_sp_desc	 usd;
+	struct logvol_int_desc	 lvid;
+	struct impvol_desc	 ivd;
+	struct part_desc	 pd;
+	struct fileset_desc	 fsd;
+	struct fileid_desc	 fid;
+	struct file_entry	 fe;
+	struct extfile_entry	 efe;
+	struct extattrhdr_desc	 eahd;
+	struct indirect_entry	 inde;
+	struct alloc_ext_entry	 aee;
+	struct udf_sparing_table spt;
+	struct space_bitmap_desc sbd;
+	struct space_entry_desc	 sed;
+};
+
+
+#endif /* !_FS_UDF_ECMA167_UDF_H_ */
+

Property changes on: lab4/.minix-src/include/fs/udf/ecma167-udf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/tgareg.h
===================================================================
--- lab4/.minix-src/include/dev/pci/tgareg.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/tgareg.h	(revision 13)
@@ -0,0 +1,182 @@
+/* $NetBSD: tgareg.h,v 1.6 2005/12/11 12:22:50 christos Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _ALPHA_INCLUDE_TGAREG_H_
+#define _ALPHA_INCLUDE_TGAREG_H_
+
+/*
+ * Device-specific PCI register offsets and contents.
+ */
+
+#define	TGA_PCIREG_PVRR	0x40		/* PCI Address Extension Register */
+
+#define	TGA_PCIREG_PAER	0x44		/* PCI VGA Redirect Register */
+
+/*
+ * TGA Memory Space offsets
+ */
+
+#define	TGA_MEM_ALTROM	0x0000000	/* 0MB -- Alternate ROM space */
+#define TGA2_MEM_EXTDEV	0x0000000	/* 0MB -- External Device Access */
+#define	TGA_MEM_CREGS	0x0100000	/* 1MB -- Core Registers */
+#define TGA_CREGS_SIZE	0x0100000 	/* Core registers occupy 1MB */
+#define TGA_CREGS_ALIAS	0x0000400	/* Register copies every 1kB */
+
+#define TGA2_MEM_CLOCK	0x0060000	/* TGA2 Clock access */
+#define TGA2_MEM_RAMDAC	0x0080000	/* TGA2 RAMDAC access */
+
+/* Display and Back Buffers mapped at config-dependent addresses */
+
+/*
+ * TGA Core Space register numbers and contents.
+ */
+
+typedef u_int32_t tga_reg_t;
+
+#define	TGA_REG_GCBR0	0x000		/* Copy buffer 0 */
+#define	TGA_REG_GCBR1	0x001		/* Copy buffer 1 */
+#define	TGA_REG_GCBR2	0x002		/* Copy buffer 2 */
+#define	TGA_REG_GCBR3	0x003		/* Copy buffer 3 */
+#define	TGA_REG_GCBR4	0x004		/* Copy buffer 4 */
+#define	TGA_REG_GCBR5	0x005		/* Copy buffer 5 */
+#define	TGA_REG_GCBR6	0x006		/* Copy buffer 6 */
+#define	TGA_REG_GCBR7	0x007		/* Copy buffer 7 */
+
+#define	TGA_REG_GFGR	0x008		/* Foreground */
+#define	TGA_REG_GBGR	0x009		/* Background */
+#define	TGA_REG_GPMR	0x00a		/* Plane Mask */
+#define	TGA_REG_GPXR_S	0x00b		/* Pixel Mask (one-shot) */
+#define	TGA_REG_GMOR	0x00c		/* Mode */
+#define	TGA_REG_GOPR	0x00d		/* Raster Operation */
+#define	TGA_REG_GPSR	0x00e		/* Pixel Shift */
+#define	TGA_REG_GADR	0x00f		/* Address */
+
+#define	TGA_REG_GB1R	0x010		/* Bresenham 1 */
+#define	TGA_REG_GB2R	0x011		/* Bresenham 2 */
+#define	TGA_REG_GB3R	0x012		/* Bresenham 3 */
+
+#define	TGA_REG_GCTR	0x013		/* Continue */
+#define	TGA_REG_GDER	0x014		/* Deep */
+#define TGA_REG_GREV	0x015		/* Start/Version on TGA,
+					 * Revision on TGA2 */
+#define	TGA_REG_GSMR	0x016		/* Stencil Mode */
+#define	TGA_REG_GPXR_P	0x017		/* Pixel Mask (persistent) */
+#define	TGA_REG_CCBR	0x018		/* Cursor Base Address */
+#define	TGA_REG_VHCR	0x019		/* Horizontal Control */
+#define	TGA_REG_VVCR	0x01a		/* Vertical Control */
+#define	TGA_REG_VVBR	0x01b		/* Video Base Address */
+#define	TGA_REG_VVVR	0x01c		/* Video Valid */
+#define	TGA_REG_CXYR	0x01d		/* Cursor XY */
+#define	TGA_REG_VSAR	0x01e		/* Video Shift Address */
+#define	TGA_REG_SISR	0x01f		/* Interrupt Status */
+#define	TGA_REG_GDAR	0x020		/* Data */
+#define	TGA_REG_GRIR	0x021		/* Red Increment */
+#define	TGA_REG_GGIR	0x022		/* Green Increment */
+#define	TGA_REG_GBIR	0x023		/* Blue Increment */
+#define	TGA_REG_GZIR_L	0x024		/* Z-increment Low */
+#define	TGA_REG_GZIR_H	0x025		/* Z-Increment High */
+#define	TGA_REG_GDBR	0x026		/* DMA Base Address */
+#define	TGA_REG_GBWR	0x027		/* Bresenham Width */
+#define	TGA_REG_GZVR_L	0x028		/* Z-value Low */
+#define	TGA_REG_GZVR_H	0x029		/* Z-value High */
+#define	TGA_REG_GZBR	0x02a		/* Z-base address */
+/*	GADR alias	0x02b */
+#define	TGA_REG_GRVR	0x02c		/* Red Value */
+#define	TGA_REG_GGVR	0x02d		/* Green Value */
+#define	TGA_REG_GBVR	0x02e		/* Blue Value */
+#define	TGA_REG_GSWR	0x02f		/* Span Width */
+#define	TGA_REG_EPSR	0x030		/* Pallete and DAC Setup */
+
+/*	reserved	0x031 - 0x3f */
+
+#define	TGA_REG_GSNR0	0x040		/* Slope-no-go 0 */
+#define	TGA_REG_GSNR1	0x041		/* Slope-no-go 1 */
+#define	TGA_REG_GSNR2	0x042		/* Slope-no-go 2 */
+#define	TGA_REG_GSNR3	0x043		/* Slope-no-go 3 */
+#define	TGA_REG_GSNR4	0x044		/* Slope-no-go 4 */
+#define	TGA_REG_GSNR5	0x045		/* Slope-no-go 5 */
+#define	TGA_REG_GSNR6	0x046		/* Slope-no-go 6 */
+#define	TGA_REG_GSNR7	0x047		/* Slope-no-go 7 */
+
+#define	TGA_REG_GSLR0	0x048		/* Slope 0 */
+#define	TGA_REG_GSLR1	0x049		/* Slope 1 */
+#define	TGA_REG_GSLR2	0x04a		/* Slope 2 */
+#define	TGA_REG_GSLR3	0x04b		/* Slope 3 */
+#define	TGA_REG_GSLR4	0x04c		/* Slope 4 */
+#define	TGA_REG_GSLR5	0x04d		/* Slope 5 */
+#define	TGA_REG_GSLR6	0x04e		/* Slope 6 */
+#define	TGA_REG_GSLR7	0x04f		/* Slope 7 */
+
+#define	TGA_REG_GBCR0	0x050		/* Block Color 0 */
+#define	TGA_REG_GBCR1	0x051		/* Block Color 1 */
+#define	TGA_REG_GBCR2	0x052		/* Block Color 2 */
+#define	TGA_REG_GBCR3	0x053		/* Block Color 3 */
+#define	TGA_REG_GBCR4	0x054		/* Block Color 4 */
+#define	TGA_REG_GBCR5	0x055		/* Block Color 5 */
+#define	TGA_REG_GBCR6	0x056		/* Block Color 6 */
+#define	TGA_REG_GBCR7	0x057		/* Block Color 7 */
+
+#define	TGA_REG_GCSR	0x058		/* Copy 64 Source */
+#define	TGA_REG_GCDR	0x059		/* Copy 64 Destination */
+/*	GC[SD]R aliases 0x05a - 0x05f */
+
+/*	reserved	0x060 - 0x077 */
+
+#define	TGA_REG_ERWR	0x078		/* EEPROM write */
+
+/*	reserved	0x079 */
+
+#define	TGA_REG_ECGR	0x07a		/* Clock */
+
+/*	reserved	0x07b */
+
+#define	TGA_REG_EPDR	0x07c		/* Pallete and DAC Data */
+
+/*	reserved	0x07d */
+
+#define	TGA_REG_SCSR	0x07e		/* Command Status */
+
+/*	reserved	0x07f */
+
+/*
+ * Video Valid Register
+ */
+#define	VVR_VIDEOVALID	0x00000001	/* 0 VGA, 1 TGA2 (TGA2 only) */
+#define	VVR_BLANK	0x00000002	/* 0 active, 1 blank */
+#define	VVR_CURSOR	0x00000004	/* 0 disable, 1 enable (TGA2 R/O) */
+#define	VVR_INTERLACE	0x00000008	/* 0 N/Int, 1 Int. (TGA2 R/O) */
+#define	VVR_DPMS_MASK	0x00000030	/* See "DMPS mask" below */
+#define	VVR_DPMS_SHIFT	4
+#define	VVR_DDC		0x00000040	/* DDC-in pin value (R/O) */
+#define	VVR_TILED	0x00000400	/* 0 linear, 1 tiled (not on TGA2) */
+#define	VVR_LDDLY_MASK	0x01ff0000	/* load delay in quad pixel clock ticks
+					   (not on TGA2) */
+#define	VVR_LDDLY_SHIFT	16
+
+#endif /* _ALPHA_INCLUDE_TGAREG_H_ */

Property changes on: lab4/.minix-src/include/dev/pci/tgareg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ddekit/timer.h
===================================================================
--- lab4/.minix-src/include/ddekit/timer.h	(nonexistent)
+++ lab4/.minix-src/include/ddekit/timer.h	(revision 13)
@@ -0,0 +1,52 @@
+#ifndef _DDEKIT_TIMER_H
+#define _DDEKIT_TIMER_H
+
+#include <ddekit/ddekit.h>
+#include <ddekit/thread.h>
+
+/** \defgroup DDEKit_timer 
+ *
+ * Timer subsystem
+ *
+ * DDEKit provides a generic timer implementation that enables users
+ * to execute a function with some arguments after a certain period
+ * of time. DDEKit therefore starts a timer thread that executes these
+ * functions and keeps track of the currently running timers.
+ */
+
+/** Add a timer event. After the absolute timeout has expired, function fn
+ * is called with args as arguments.
+ *
+ *  \ingroup DDEKit_timer
+ *
+ *	\return		>=0	valid timer ID 
+ *  \return		< 0	error
+ */
+int ddekit_add_timer(void (*fn)(void *), void *args, unsigned long
+	timeout);
+
+/** Delete timer with the corresponding timer id.
+ *
+ *  \ingroup DDEKit_timer
+ */
+int ddekit_del_timer(int timer);
+
+/** Check whether a timer is pending 
+ *
+ *  \ingroup DDEKit_timer
+ *
+ * Linux needs this.
+ */
+int ddekit_timer_pending(int timer);
+
+/** Initialization function, startup timer thread
+ *
+ *  \ingroup DDEKit_timer
+ */
+void ddekit_init_timers(void);
+
+/** Get the timer thread.
+ */
+ddekit_thread_t *ddekit_get_timer_thread(void);
+
+#endif

Property changes on: lab4/.minix-src/include/ddekit/timer.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/g++/FlexLexer.h
===================================================================
--- lab4/.minix-src/include/g++/FlexLexer.h	(nonexistent)
+++ lab4/.minix-src/include/g++/FlexLexer.h	(revision 13)
@@ -0,0 +1,208 @@
+/*	$NetBSD: FlexLexer.h,v 1.2 2014/10/29 18:28:36 christos Exp $	*/
+
+// -*-C++-*-
+// FlexLexer.h -- define interfaces for lexical analyzer classes generated
+// by flex
+
+// Copyright (c) 1993 The Regents of the University of California.
+// All rights reserved.
+//
+// This code is derived from software contributed to Berkeley by
+// Kent Williams and Tom Epperly.
+//
+//  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.
+
+//  Neither the name of the University nor the names of its contributors
+//  may be used to endorse or promote products derived from this software
+//  without specific prior written permission.
+
+//  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+//  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+//  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+//  PURPOSE.
+
+// This file defines FlexLexer, an abstract class which specifies the
+// external interface provided to flex C++ lexer objects, and yyFlexLexer,
+// which defines a particular lexer class.
+//
+// If you want to create multiple lexer classes, you use the -P flag
+// to rename each yyFlexLexer to some other xxFlexLexer.  You then
+// include <FlexLexer.h> in your other sources once per lexer class:
+//
+//	#undef yyFlexLexer
+//	#define yyFlexLexer xxFlexLexer
+//	#include <FlexLexer.h>
+//
+//	#undef yyFlexLexer
+//	#define yyFlexLexer zzFlexLexer
+//	#include <FlexLexer.h>
+//	...
+
+#ifndef __FLEX_LEXER_H
+// Never included before - need to define base class.
+#define __FLEX_LEXER_H
+
+#include <iostream>
+#  ifndef FLEX_STD
+#    define FLEX_STD std::
+#  endif
+
+extern "C++" {
+
+struct yy_buffer_state;
+typedef int yy_state_type;
+
+class FlexLexer {
+public:
+	virtual ~FlexLexer()	{ }
+
+	const char* YYText() const	{ return yytext; }
+	int YYLeng()	const	{ return yyleng; }
+
+	virtual void
+		yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
+	virtual struct yy_buffer_state*
+		yy_create_buffer( FLEX_STD istream* s, int size ) = 0;
+	virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
+	virtual void yyrestart( FLEX_STD istream* s ) = 0;
+
+	virtual int yylex() = 0;
+
+	// Call yylex with new input/output sources.
+	int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 )
+		{
+		switch_streams( new_in, new_out );
+		return yylex();
+		}
+
+	// Switch to new input/output streams.  A nil stream pointer
+	// indicates "keep the current one".
+	virtual void switch_streams( FLEX_STD istream* new_in = 0,
+					FLEX_STD ostream* new_out = 0 ) = 0;
+
+	int lineno() const		{ return yylineno; }
+
+	int debug() const		{ return yy_flex_debug; }
+	void set_debug( int flag )	{ yy_flex_debug = flag; }
+
+protected:
+	char* yytext;
+	int yyleng;
+	int yylineno;		// only maintained if you use %option yylineno
+	int yy_flex_debug;	// only has effect with -d or "%option debug"
+};
+
+}
+#endif // FLEXLEXER_H
+
+#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
+// Either this is the first time through (yyFlexLexerOnce not defined),
+// or this is a repeated include to define a different flavor of
+// yyFlexLexer, as discussed in the flex manual.
+#define yyFlexLexerOnce
+
+extern "C++" {
+
+class yyFlexLexer : public FlexLexer {
+public:
+	// arg_yyin and arg_yyout default to the cin and cout, but we
+	// only make that assignment when initializing in yylex().
+	yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 );
+
+	virtual ~yyFlexLexer();
+
+	void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
+	struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size );
+	void yy_delete_buffer( struct yy_buffer_state* b );
+	void yyrestart( FLEX_STD istream* s );
+
+	void yypush_buffer_state( struct yy_buffer_state* new_buffer );
+	void yypop_buffer_state();
+
+	virtual int yylex();
+	virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 );
+	virtual int yywrap();
+
+protected:
+	virtual int LexerInput( char* buf, int max_size );
+	virtual void LexerOutput( const char* buf, int size );
+	virtual void LexerError( const char* msg );
+
+	void yyunput( int c, char* buf_ptr );
+	int yyinput();
+
+	void yy_load_buffer_state();
+	void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s );
+	void yy_flush_buffer( struct yy_buffer_state* b );
+
+	int yy_start_stack_ptr;
+	int yy_start_stack_depth;
+	int* yy_start_stack;
+
+	void yy_push_state( int new_state );
+	void yy_pop_state();
+	int yy_top_state();
+
+	yy_state_type yy_get_previous_state();
+	yy_state_type yy_try_NUL_trans( yy_state_type current_state );
+	int yy_get_next_buffer();
+
+	FLEX_STD istream* yyin;	// input source for default LexerInput
+	FLEX_STD ostream* yyout;	// output sink for default LexerOutput
+
+	// yy_hold_char holds the character lost when yytext is formed.
+	char yy_hold_char;
+
+	// Number of characters read into yy_ch_buf.
+	int yy_n_chars;
+
+	// Points to current character in buffer.
+	char* yy_c_buf_p;
+
+	int yy_init;		// whether we need to initialize
+	int yy_start;		// start state number
+
+	// Flag which is used to allow yywrap()'s to do buffer switches
+	// instead of setting up a fresh yyin.  A bit of a hack ...
+	int yy_did_buffer_switch_on_eof;
+
+
+	size_t yy_buffer_stack_top; /**< index of top of stack. */
+	size_t yy_buffer_stack_max; /**< capacity of stack. */
+	struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
+	void yyensure_buffer_stack(void);
+
+	// The following are not always needed, but may be depending
+	// on use of certain flex features (like REJECT or yymore()).
+
+	yy_state_type yy_last_accepting_state;
+	char* yy_last_accepting_cpos;
+
+	yy_state_type* yy_state_buf;
+	yy_state_type* yy_state_ptr;
+
+	char* yy_full_match;
+	int* yy_full_state;
+	int yy_full_lp;
+
+	int yy_lp;
+	int yy_looking_for_trail_begin;
+
+	int yy_more_flag;
+	int yy_more_len;
+	int yy_more_offset;
+	int yy_prev_more_offset;
+};
+
+}
+
+#endif // yyFlexLexer || ! yyFlexLexerOnce
+

Property changes on: lab4/.minix-src/include/g++/FlexLexer.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/amrio.h
===================================================================
--- lab4/.minix-src/include/dev/pci/amrio.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/amrio.h	(revision 13)
@@ -0,0 +1,124 @@
+/* $NetBSD: amrio.h,v 1.1 2006/07/23 12:01:26 bouyer Exp $ */
+
+/*-
+ * Copyright (c) 1999 Michael Smith
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Copyright (c) 2002 Eric Moore
+ * Copyright (c) 2002 LSI Logic Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The party using or redistributing the source code and binary forms
+ *    agrees to the disclaimer below and the terms and conditions set forth
+ *    herein.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ *	FreeBSD: src/sys/dev/amr/amrio.h,v 1.7 2005/12/14 03:26:49 scottl Exp
+ */
+
+/*
+ * ioctl interface
+ */
+
+#include <sys/ioccom.h>
+#include <sys/param.h>
+
+/*
+ * Fetch the driver's interface version.
+ */
+#define AMR_IO_VERSION_NUMBER	153
+#define AMR_IO_VERSION	_IOR('A', 0x200, int)
+
+/*
+ * Pass a command from userspace through to the adapter.
+ *
+ * Note that in order to be code-compatible with the Linux
+ * interface where possible, the formatting of the au_cmd field is
+ * somewhat Interesting.
+ *
+ * For normal commands, the layout is (fields from struct amr_mailbox_ioctl):
+ *
+ * 0		mb_command
+ * 1		mb_channel
+ * 2		mb_param
+ * 3		mb_pad[0]
+ * 4		mb_drive
+ *
+ * For SCSI passthrough commands, the layout is:
+ *
+ * 0		AMR_CMD_PASS	(0x3)
+ * 1		reserved, 0
+ * 2		cdb length
+ * 3		cdb data
+ * 3+cdb_len	passthrough control byte (timeout, ars, islogical)
+ * 4+cdb_len	reserved, 0
+ * 5+cdb_len	channel
+ * 6+cdb_len	target
+ */
+
+struct amr_user_ioctl {
+    unsigned char	au_cmd[32];	/* command text from userspace */
+    void		*au_buffer;	/* data buffer in userspace */
+    unsigned long	au_length;	/* data buffer size (0 == no data) */
+    int			au_direction;	/* data transfer direction */
+#define AMR_IO_NODATA	0
+#define AMR_IO_READ	1
+#define AMR_IO_WRITE	2
+    int			au_status;	/* command status returned by adapter */
+};
+
+#define AMR_IO_COMMAND	_IOWR('A', 0x201, struct amr_user_ioctl)
+
+#if 0 /* defined(__amd64__) || defined(__ia64__) */
+
+struct amr_user_ioctl32 {
+    unsigned char	au_cmd[32];	/* command text from userspace */
+    u_int32_t		au_buffer;	/* 32-bit pointer to uspace buf */
+    u_int32_t		au_length;	/* length of the uspace buffer */
+    int32_t		au_direction;	/* data transfer direction */
+    int32_t		au_status;	/* command status returned by adapter */
+};
+
+#	define AMR_IO_COMMAND32	_IOWR('A', 0x201, struct amr_user_ioctl32)
+#endif

Property changes on: lab4/.minix-src/include/dev/pci/amrio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/mlyreg.h
===================================================================
--- lab4/.minix-src/include/dev/pci/mlyreg.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/mlyreg.h	(revision 13)
@@ -0,0 +1,1306 @@
+/*	$NetBSD: mlyreg.h,v 1.5 2008/09/08 23:36:54 gmcgarry Exp $	*/
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran, Thor Lancelot Simon, and Eric Haszlakiewicz.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 2000 Michael Smith
+ * Copyright (c) 2000 BSDi
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from FreeBSD: mlyreg.h,v 1.1 2000/08/23 03:22:39 msmith Exp
+ */
+
+/*
+ * Section numbers in this document refer to the Mylex "Firmware Software Interface"
+ * document ('FSI'), revision 0.11 04/11/00 unless otherwise qualified.
+ *
+ * Reference is made to the Mylex "Programming Guide for 6.x Controllers" document
+ * ('PG6'), document #771242 revision 0.02, 04/11/00
+ *
+ * Note that fields marked N/A are not supported by the PCI controllers, but are
+ * defined here to hold place in datastructures that are shared with the SCSI
+ * controllers.  Items not relevant to PCI controllers are not described here.
+ *
+ * Ordering of items in this file is a little odd due to the constraints of
+ * nested declarations.
+ */
+
+#ifndef _PCI_MLYREG_H_
+#define	_PCI_MLYREG_H_
+
+/*
+ * 2.1 (Scatter Gather List Format)
+ */
+struct mly_sg_entry {
+	u_int64_t	physaddr;
+	u_int64_t	length;
+} __packed;
+
+/*
+ * 5.2 System Device Access
+ *
+ * This is corroborated by the layout of the MDACIOCTL_GETCONTROLLERINFO data
+ * in 21.8
+ */
+#define	MLY_MAX_CHANNELS	6
+#define	MLY_MAX_TARGETS		16
+#define	MLY_MAX_LUNS		1
+
+/*
+ * 8.1 Different Device States
+ */
+#define	MLY_DEVICE_STATE_OFFLINE	0x08	/* DEAD/OFFLINE */
+#define	MLY_DEVICE_STATE_UNCONFIGURED	0x00
+#define	MLY_DEVICE_STATE_ONLINE		0x01
+#define	MLY_DEVICE_STATE_CRITICAL	0x09
+#define	MLY_DEVICE_STATE_WRITEONLY	0x03
+#define	MLY_DEVICE_STATE_STANDBY	0x21
+#define	MLY_DEVICE_STATE_MISSING	0x04	/* or-ed with (ONLINE or WRITEONLY or STANDBY) */
+
+/*
+ * 8.2 Device Type Field definitions
+ */
+#define	MLY_DEVICE_TYPE_RAID0		0x0	/* RAID 0 */
+#define	MLY_DEVICE_TYPE_RAID1		0x1	/* RAID 1 */
+#define	MLY_DEVICE_TYPE_RAID3		0x3	/* RAID 3 right asymmetric parity */
+#define	MLY_DEVICE_TYPE_RAID5		0x5	/* RAID 5 right asymmetric parity */
+#define	MLY_DEVICE_TYPE_RAID6		0x6	/* RAID 6 (Mylex RAID 6) */
+#define	MLY_DEVICE_TYPE_RAID7		0x7	/* RAID 7 (JBOD) */
+#define	MLY_DEVICE_TYPE_NEWSPAN		0x8	/* New Mylex SPAN */
+#define	MLY_DEVICE_TYPE_RAID3F		0x9	/* RAID 3 fixed parity */
+#define	MLY_DEVICE_TYPE_RAID3L		0xb	/* RAID 3 left symmetric parity */
+#define	MLY_DEVICE_TYPE_SPAN		0xc	/* current spanning implementation */
+#define	MLY_DEVICE_TYPE_RAID5L		0xd	/* RAID 5 left symmetric parity */
+#define	MLY_DEVICE_TYPE_RAIDE		0xe	/* RAID E (concatenation) */
+#define	MLY_DEVICE_TYPE_PHYSICAL	0xf	/* physical device */
+
+/*
+ * 8.3 Stripe Size
+ */
+#define	MLY_STRIPE_ZERO		0x0	/* no stripe (RAID 1, RAID 7, etc) */
+#define	MLY_STRIPE_512b		0x1
+#define	MLY_STRIPE_1k		0x2
+#define	MLY_STRIPE_2k		0x3
+#define	MLY_STRIPE_4k		0x4
+#define	MLY_STRIPE_8k		0x5
+#define	MLY_STRIPE_16k		0x6
+#define	MLY_STRIPE_32k		0x7
+#define	MLY_STRIPE_64k		0x8
+#define	MLY_STRIPE_128k		0x9
+#define	MLY_STRIPE_256k		0xa
+#define	MLY_STRIPE_512k		0xb
+#define	MLY_STRIPE_1m		0xc
+
+/*
+ * 8.4 Cacheline Size
+ */
+#define	MLY_CACHELINE_ZERO	0x0	/* caching cannot be enabled */
+#define	MLY_CACHELINE_512b	0x1
+#define	MLY_CACHELINE_1k	0x2
+#define	MLY_CACHELINE_2k	0x3
+#define	MLY_CACHELINE_4k	0x4
+#define	MLY_CACHELINE_8k	0x5
+#define	MLY_CACHELINE_16k	0x6
+#define	MLY_CACHELINE_32k	0x7
+#define	MLY_CACHELINE_64k	0x8
+
+/*
+ * 8.5 Read/Write control
+ */
+#define	MLY_RWCtl_INITTED	(1<<7)	/* if set, the logical device is initialised */
+			/* write control */
+#define	MLY_RWCtl_WCD		(0)	/* write cache disabled */
+#define	MLY_RWCtl_WDISABLE	(1<<3)	/* writing disabled */
+#define	MLY_RWCtl_WCE		(2<<3)	/* write cache enabled */
+#define	MLY_RWCtl_IWCE		(3<<3)	/* intelligent write cache enabled */
+			/* read control */
+#define	MLY_RWCtl_RCD		(0)	/* read cache is disabled */
+#define	MLY_RWCtl_RCE		(1)	/* read cache enabled */
+#define	MLY_RWCtl_RAHEAD	(2)	/* readahead enabled */
+#define	MLY_RWCtl_IRAHEAD	(3)	/* intelligent readahead enabled */
+
+/*
+ * 9.0 LUN Map Format
+ */
+struct mly_lun_map {
+	u_int8_t	res1:4;
+	u_int8_t	host_port_mapped:1;	/* this system drive visibile to host on this controller/port combination */
+	u_int8_t	tid_valid:1;		/* target ID valid */
+	u_int8_t	hid_valid:1;		/* host ID valid */
+	u_int8_t	lun_valid:1;		/* LUN valid */
+	u_int8_t	res2;
+	u_int8_t	lun;			/* LUN */
+	u_int8_t	tid;			/* TID */
+	u_int8_t	hid[32];		/* HID (one bit for each host) */
+} __packed;
+
+/*
+ * 10.1 Controller Parameters
+ */
+struct mly_param_controller {
+	u_int8_t	rdahen:1;				/* N/A */
+	u_int8_t	bilodly:1;				/* N/A */
+	u_int8_t   	fua_disable:1;
+	u_int8_t	reass1s:1;				/* N/A */
+	u_int8_t	truvrfy:1;				/* N/A */
+	u_int8_t	dwtvrfy:1;				/* N/A */
+	u_int8_t	background_initialisation:1;
+	u_int8_t	clustering:1;				/* N/A */
+
+	u_int8_t	bios_disable:1;
+	u_int8_t   	boot_from_cdrom:1;
+	u_int8_t	drive_coercion:1;
+	u_int8_t	write_same_disable:1;
+	u_int8_t	hba_mode:1;				/* N/A */
+	u_int8_t	bios_geometry:2;
+#define	MLY_BIOSGEOM_2G	0x0
+#define	MLY_BIOSGEOM_8G	0x1
+	u_int8_t	res1:1;					/* N/A */
+
+	u_int8_t	res2[2];				/* N/A */
+
+	u_int8_t	v_dec:1;
+	u_int8_t	safte:1;				/* N/A */
+	u_int8_t	ses:1;					/* N/A */
+	u_int8_t	res3:2;					/* N/A */
+	u_int8_t	v_arm:1;
+	u_int8_t	v_ofm:1;
+	u_int8_t	res4:1;					/* N/A */
+
+	u_int8_t	rebuild_check_rate;
+	u_int8_t	cache_line_size;			/* see 8.4 */
+	u_int8_t	oem_code;
+#define	MLY_OEM_MYLEX	0x00
+#define	MLY_OEM_IBM	0x08
+#define	MLY_OEM_HP	0x0a
+#define	MLY_OEM_DEC	0x0c
+#define	MLY_OEM_SIEMENS	0x10
+#define	MLY_OEM_INTEL	0x12
+	u_int8_t	spinup_mode;
+#define	MLY_SPIN_AUTO		0
+#define	MLY_SPIN_PWRSPIN	1
+#define	MLY_SPIN_WSSUSPIN	2
+	u_int8_t	spinup_devices;
+	u_int8_t	spinup_interval;
+	u_int8_t	spinup_wait_time;
+
+	u_int8_t	res5:3;					/* N/A */
+	u_int8_t	vutursns:1;				/* N/A */
+	u_int8_t	dccfil:1;				/* N/A */
+	u_int8_t	nopause:1;				/* N/A */
+	u_int8_t	disqfull:1;				/* N/A */
+	u_int8_t	disbusy:1;				/* N/A */
+
+	u_int8_t	res6:2;					/* N/A */
+	u_int8_t	failover_node_name;			/* N/A */
+	u_int8_t	res7:1;					/* N/A */
+	u_int8_t	ftopo:3;				/* N/A */
+	u_int8_t	disable_ups:1;				/* N/A */
+
+	u_int8_t	res8:1;					/* N/A */
+	u_int8_t	propagate_reset:1;			/* N/A */
+	u_int8_t	nonstd_mp_reset:1;			/* N/A */
+	u_int8_t	res9:5;					/* N/A */
+
+	u_int8_t	res10;					/* N/A */
+	u_int8_t	serial_port_baud_rate;			/* N/A */
+	u_int8_t	serial_port_control;			/* N/A */
+	u_int8_t	change_stripe_ok_developer_flag_only;	/* N/A */
+
+	u_int8_t	small_large_host_transfers:2;		/* N/A */
+	u_int8_t	frame_control:2;			/* N/A */
+	u_int8_t	pci_latency_control:2;			/* N/A */
+	u_int8_t	treat_lip_as_reset:1;			/* N/A */
+	u_int8_t	res11:1;				/* N/A */
+
+	u_int8_t	ms_autorest:1;				/* N/A */
+	u_int8_t	res12:7;				/* N/A */
+
+	u_int8_t	ms_aa_fsim:1;				/* N/A */
+	u_int8_t	ms_aa_ccach:1;				/* N/A */
+	u_int8_t	ms_aa_fault_signals:1;			/* N/A */
+	u_int8_t	ms_aa_c4_faults:1;			/* N/A */
+	u_int8_t	ms_aa_host_reset_delay_mask:4;		/* N/A */
+
+	u_int8_t	ms_flg_simplex_no_rstcom:1;		/* N/A */
+	u_int8_t	res13:7;				/* N/A */
+
+	u_int8_t	res14;					/* N/A */
+	u_int8_t	hardloopid[2][2];			/* N/A */
+	u_int8_t	ctrlname[2][16+1];			/* N/A */
+	u_int8_t	initiator_id;
+	u_int8_t	startup_option;
+#define	MLY_STARTUP_IF_NO_CHANGE	0x0
+#define	MLY_STARTUP_IF_NO_LUN_CHANGE	0x1
+#define	MLY_STARTUP_IF_NO_LUN_OFFLINE	0x2
+#define	MLY_STARTUP_IF_LUN0_NO_CHANGE	0x3
+#define	MLY_STARTUP_IF_LUN0_NOT_OFFLINE	0x4
+#define	MLY_STARTUP_ALWAYS		0x5
+
+	u_int8_t	res15[62];
+} __packed__;
+
+/*
+ * 10.2 Physical Device Parameters
+ */
+struct mly_param_physical_device {
+	u_int16_t	tags;
+	u_int16_t	speed;
+	u_int8_t	width;
+	u_int8_t	combing:1;
+	u_int8_t	res1:7;
+	u_int8_t	res2[3];
+} __packed;
+
+/*
+ * 10.3 Logical Device Parameters
+ */
+struct mly_param_logical_device {
+	u_int8_t	type;			/* see 8.2 */
+	u_int8_t	state;			/* see 8.1 */
+	u_int16_t	raid_device;
+	u_int8_t	res1;
+	u_int8_t	bios_geometry;		/* BIOS control word? */
+	u_int8_t	stripe_size;		/* see 8.3 */
+	u_int8_t	read_write_control;	/* see 8.5 */
+	u_int8_t	res2[8];
+} __packed;
+
+/*
+ * 12.3 Health Status Buffer
+ *
+ * Pad to 128 bytes.
+ */
+struct mly_health_status {
+	u_int32_t	uptime_us;				/* N/A */
+	u_int32_t	uptime_ms;				/* N/A */
+	u_int32_t	realtime;				/* N/A */
+	u_int32_t	res1;					/* N/A */
+	u_int32_t	change_counter;
+	u_int32_t	res2;					/* N/A */
+	u_int32_t	debug_message_index;			/* N/A */
+	u_int32_t	bios_message_index;			/* N/A */
+	u_int32_t	trace_page;				/* N/A */
+	u_int32_t	profiler_page;				/* N/A */
+	u_int32_t	next_event;
+	u_int8_t	res3[4 + 16 + 64];			/* N/A */
+} __packed;
+
+/*
+ * 14.2 Timeout Bit Format
+ */
+#define	MLY_TIMEOUT_SECONDS	0x00
+#define	MLY_TIMEOUT_MINUTES	0x40
+#define	MLY_TIMEOUT_HOURS	0x80
+
+/*
+ * 14.3 Operation Device
+ */
+#define	MLY_OPDEVICE_PHYSICAL_DEVICE		0x0
+#define	MLY_OPDEVICE_RAID_DEVICE		0x1
+#define	MLY_OPDEVICE_PHYSICAL_CHANNEL		0x2
+#define	MLY_OPDEVICE_RAID_CHANNEL		0x3
+#define	MLY_OPDEVICE_PHYSICAL_CONTROLLER	0x4
+#define	MLY_OPDEVICE_RAID_CONTROLLER		0x5
+#define	MLY_OPDEVICE_CONFIGURATION_GROUP	0x10
+
+/*
+ * 14.4 Status Bit Format
+ *
+ * AKA Status Mailbox Format
+ *
+ * XXX format conflict between FSI and PG6 over the ordering of the
+ * status and sense length fields.
+ */
+struct mly_status {
+	u_int16_t	command_id;
+	u_int8_t	status;
+	u_int8_t	sense_length;
+	int32_t		residue;
+} __packed;
+
+/*
+ * 14.5 Command Control Bit (CCB) format
+ *
+ * This byte is unfortunately named.
+ */
+#define	MLY_CMDCTL_FORCE_UNIT_ACCESS	0x01
+#define	MLY_CMDCTL_DISABLE_PAGE_OUT	0x02
+#define	MLY_CMDCTL_EXTENDED_SG_TABLE	0x08
+#define	MLY_CMDCTL_DATA_DIRECTION	0x10
+#define	MLY_CMDCTL_NO_AUTO_SENSE	0x40
+#define	MLY_CMDCTL_DISABLE_DISCONNECT	0x80
+
+/*
+ * 15.0 Commands
+ *
+ * We use the command names as given by Mylex
+ */
+#define	MDACMD_MEMCOPY		0x1	/* memory to memory copy */
+#define	MDACMD_SCSIPT		0x2	/* SCSI passthrough (small command) */
+#define	MDACMD_SCSILCPT		0x3	/* SCSI passthrough (large command) */
+#define	MDACMD_SCSI		0x4	/* SCSI command for logical/phyiscal device (small command) */
+#define	MDACMD_SCSILC		0x5	/* SCSI command for logical/phyiscal device (large command) */
+#define	MDACMD_IOCTL		0x20	/* Management command */
+#define	MDACMD_IOCTLCHECK	0x23	/* Validate management command (not implemented) */
+
+/*
+ * 16.0 IOCTL command
+ *
+ * We use the IOCTL names as given by Mylex
+ * Note that only ioctls supported by the PCI controller family are listed
+ */
+#define	MDACIOCTL_GETCONTROLLERINFO		0x1
+#define	MDACIOCTL_GETLOGDEVINFOVALID		0x3
+#define	MDACIOCTL_GETPHYSDEVINFOVALID		0x5
+#define	MDACIOCTL_GETCONTROLLERSTATISTICS	0xb
+#define	MDACIOCTL_GETLOGDEVSTATISTICS		0xd
+#define	MDACIOCTL_GETPHYSDEVSTATISTICS		0xf
+#define	MDACIOCTL_GETHEALTHSTATUS		0x11
+#define	MDACIOCTL_GETEVENT			0x15
+/* flash update */
+#define	MDACIOCTL_STOREIMAGE			0x2c
+#define	MDACIOCTL_READIMAGE			0x2d
+#define	MDACIOCTL_FLASHIMAGES			0x2e
+/* battery backup unit */
+#define	MDACIOCTL_GET_SUBSYSTEM_DATA		0x70
+#define	MDACIOCTL_SET_SUBSYSTEM_DATA		0x71
+/* non-data commands */
+#define	MDACIOCTL_STARTDISOCVERY		0x81
+#define	MDACIOCTL_SETRAIDDEVSTATE		0x82
+#define	MDACIOCTL_INITPHYSDEVSTART		0x84
+#define	MDACIOCTL_INITPHYSDEVSTOP		0x85
+#define	MDACIOCTL_INITRAIDDEVSTART		0x86
+#define	MDACIOCTL_INITRAIDDEVSTOP		0x87
+#define	MDACIOCTL_REBUILDRAIDDEVSTART		0x88
+#define	MDACIOCTL_REBUILDRAIDDEVSTOP		0x89
+#define	MDACIOCTL_MAKECONSISTENTDATASTART	0x8a
+#define	MDACIOCTL_MAKECONSISTENTDATASTOP	0x8b
+#define	MDACIOCTL_CONSISTENCYCHECKSTART		0x8c
+#define	MDACIOCTL_CONSISTENCYCHECKSTOP		0x8d
+#define	MDACIOCTL_SETMEMORYMAILBOX		0x8e
+#define	MDACIOCTL_RESETDEVICE			0x90
+#define	MDACIOCTL_FLUSHDEVICEDATA		0x91
+#define	MDACIOCTL_PAUSEDEVICE			0x92
+#define	MDACIOCTL_UNPAUSEDEVICE			0x93
+#define	MDACIOCTL_LOCATEDEVICE			0x94
+#define	MDACIOCTL_SETMASTERSLAVEMODE		0x95
+#define	MDACIOCTL_SETREALTIMECLOCK		0xac
+/* RAID configuration */
+#define	MDACIOCTL_CREATENEWCONF			0xc0
+#define	MDACIOCTL_DELETERAIDDEV			0xc1
+#define	MDACIOCTL_REPLACEINTERNALDEV		0xc2
+#define	MDACIOCTL_RENAMERAIDDEV			0xc3
+#define	MDACIOCTL_ADDNEWCONF			0xc4
+#define	MDACIOCTL_XLATEPHYSDEVTORAIDDEV		0xc5
+#define	MDACIOCTL_MORE				0xc6
+#define	MDACIOCTL_SETPHYSDEVPARAMETER		0xc8
+#define	MDACIOCTL_GETPHYSDEVPARAMETER		0xc9
+#define	MDACIOCTL_CLEARCONF			0xca
+#define	MDACIOCTL_GETDEVCONFINFO		0xcb
+#define	MDACIOCTL_GETGROUPCONFINFO		0xcc
+#define	MDACIOCTL_GETFREESPACELIST		0xcd
+#define	MDACIOCTL_GETLOGDEVPARAMETER		0xce
+#define	MDACIOCTL_SETLOGDEVPARAMETER		0xcf
+#define	MDACIOCTL_GETCONTROLLERPARAMETER	0xd0
+#define	MDACIOCTL_SETCONTRLLERPARAMETER		0xd1
+#define	MDACIOCTL_CLEARCONFSUSPMODE		0xd2
+#define	MDACIOCTL_GETBDT_FOR_SYSDRIVE		0xe0
+
+/*
+ * 17.1.4 Data Transfer Memory Address Without SG List
+ */
+struct mly_short_transfer {
+	struct mly_sg_entry	sg[2];
+} __packed;
+
+/*
+ * 17.1.5 Data Transfer Memory Address With SG List
+ *
+ * Note that only the first s/g table is currently used.
+ */
+struct mly_sg_transfer {
+	u_int16_t	entries[3];
+	u_int16_t	res1;
+	u_int64_t	table_physaddr[3];
+} __packed;
+
+/*
+ * 17.1.3 Data Transfer Memory Address Format
+ */
+union mly_cmd_transfer {
+	struct mly_short_transfer	direct;
+	struct mly_sg_transfer	indirect;
+};
+
+/*
+ * 21.1  MDACIOCTL_SETREALTIMECLOCK
+ * 21.7  MDACIOCTL_GETHEALTHSTATUS
+ * 21.8  MDACIOCTL_GETCONTROLLERINFO
+ * 21.9  MDACIOCTL_GETLOGDEVINFOVALID
+ * 21.10 MDACIOCTL_GETPHYSDEVINFOVALID
+ * 21.11 MDACIOCTL_GETPHYSDEVSTATISTICS
+ * 21.12 MDACIOCTL_GETLOGDEVSTATISTICS
+ * 21.13 MDACIOCTL_GETCONTROLLERSTATISTICS
+ * 21.27 MDACIOCTL_GETBDT_FOR_SYSDRIVE
+ * 23.4  MDACIOCTL_CREATENEWCONF
+ * 23.5  MDACIOCTL_ADDNEWCONF
+ * 23.8  MDACIOCTL_GETDEVCONFINFO
+ * 23.9  MDACIOCTL_GETFREESPACELIST
+ * 24.1  MDACIOCTL_MORE
+ * 25.1  MDACIOCTL_GETPHYSDEVPARAMETER
+ * 25.2  MDACIOCTL_SETPHYSDEVPARAMETER
+ * 25.3  MDACIOCTL_GETLOGDEVPARAMETER
+ * 25.4  MDACIOCTL_SETLOGDEVPARAMETER
+ * 25.5  MDACIOCTL_GETCONTROLLERPARAMETER
+ * 25.6  MDACIOCTL_SETCONTROLLERPARAMETER
+ *
+ * These commands just transfer data
+ */
+struct mly_ioctl_param_data {
+	u_int8_t	param[10];
+	union mly_cmd_transfer	transfer;
+} __packed;
+
+/*
+ * 21.2 MDACIOCTL_SETMEMORYMAILBOX
+ */
+struct mly_ioctl_param_setmemorymailbox {
+	u_int8_t	health_buffer_size;
+	u_int8_t	res1;
+	u_int64_t	health_buffer_physaddr;
+	u_int64_t	command_mailbox_physaddr;
+	u_int64_t	status_mailbox_physaddr;
+	u_int64_t	res2[2];
+} __packed;
+
+/*
+ * 21.8.2 MDACIOCTL_GETCONTROLLERINFO: Data Format
+ */
+struct mly_ioctl_getcontrollerinfo {
+	u_int8_t	res1;					/* N/A */
+	u_int8_t	interface_type;
+	u_int8_t	controller_type;
+	u_int8_t	res2;					/* N/A */
+	u_int16_t	interface_speed;
+	u_int8_t	interface_width;
+	u_int8_t	res3[9];				/* N/A */
+	char		interface_name[16];
+	char		controller_name[16];
+	u_int8_t	res4[16];				/* N/A */
+	/* firmware release information */
+	u_int8_t	fw_major;
+	u_int8_t	fw_minor;
+	u_int8_t	fw_turn;
+	u_int8_t	fw_build;
+	u_int8_t	fw_day;
+	u_int8_t	fw_month;
+	u_int8_t	fw_century;
+	u_int8_t	fw_year;
+	/* hardware release information */
+	u_int8_t	hw_revision;				/* N/A */
+	u_int8_t	res5[3];				/* N/A */
+	u_int8_t	hw_release_day;				/* N/A */
+	u_int8_t	hw_release_month;			/* N/A */
+	u_int8_t	hw_release_century;			/* N/A */
+	u_int8_t	hw_release_year;			/* N/A */
+	/* hardware manufacturing information */
+	u_int8_t	batch_number;				/* N/A */
+	u_int8_t	res6;					/* N/A */
+	u_int8_t	plant_number;
+	u_int8_t	res7;
+	u_int8_t	hw_manuf_day;
+	u_int8_t	hw_manuf_month;
+	u_int8_t	hw_manuf_century;
+	u_int8_t	hw_manuf_year;
+	u_int8_t	max_pdd_per_xldd;
+	u_int8_t	max_ildd_per_xldd;
+	u_int16_t	nvram_size;
+	u_int8_t	max_number_of_xld;			/* N/A */
+	u_int8_t	res8[3];				/* N/A */
+	/* unique information per controller */
+	char		serial_number[16];
+	u_int8_t	res9[16];				/* N/A */
+	/* vendor information */
+	u_int8_t	res10[3];				/* N/A */
+	u_int8_t	oem_information;
+	char		vendor_name[16];			/* N/A */
+	/* other physical/controller/operation information */
+	u_int8_t	bbu_present:1;
+	u_int8_t	active_clustering:1;
+	u_int8_t	res11:6;				/* N/A */
+	u_int8_t	res12[3];				/* N/A */
+	/* physical device scan information */
+	u_int8_t	physical_scan_active:1;
+	u_int8_t	res13:7;				/* N/A */
+	u_int8_t	physical_scan_channel;
+	u_int8_t	physical_scan_target;
+	u_int8_t	physical_scan_lun;
+	/* maximum command data transfer size */
+	u_int16_t	maximum_block_count;
+	u_int16_t	maximum_sg_entries;
+	/* logical/physical device counts */
+	u_int16_t	logical_devices_present;
+	u_int16_t	logical_devices_critical;
+	u_int16_t	logical_devices_offline;
+	u_int16_t	physical_devices_present;
+	u_int16_t	physical_disks_present;
+	u_int16_t	physical_disks_critical;		/* N/A */
+	u_int16_t	physical_disks_offline;
+	u_int16_t	maximum_parallel_commands;
+	/* channel and target ID information */
+	u_int8_t	physical_channels_present;
+	u_int8_t	virtual_channels_present;
+	u_int8_t	physical_channels_possible;
+	u_int8_t	virtual_channels_possible;
+	u_int8_t	maximum_targets_possible[16];		/* N/A (6 and up) */
+	u_int8_t	res14[12];				/* N/A */
+	/* memory/cache information */
+	u_int16_t	memory_size;
+	u_int16_t	cache_size;
+	u_int32_t	valid_cache_size;			/* N/A */
+	u_int32_t	dirty_cache_size;			/* N/A */
+	u_int16_t	memory_speed;
+	u_int8_t	memory_width;
+	u_int8_t	memory_type:5;
+	u_int8_t	res15:1;				/* N/A */
+	u_int8_t	memory_parity:1;
+	u_int8_t	memory_ecc:1;
+	char		memory_information[16];			/* N/A */
+	/* execution memory information */
+	u_int16_t	exmemory_size;
+	u_int16_t	l2cache_size;				/* N/A */
+	u_int8_t	res16[8];				/* N/A */
+	u_int16_t	exmemory_speed;
+	u_int8_t	exmemory_width;
+	u_int8_t	exmemory_type:5;
+	u_int8_t	res17:1;				/* N/A */
+	u_int8_t	exmemory_parity:1;
+	u_int8_t	exmemory_ecc:1;
+	char		exmemory_name[16];			/* N/A */
+	/* CPU information */
+	struct {
+		u_int16_t	speed;
+		u_int8_t	type;
+		u_int8_t	number;
+		u_int8_t	res1[12];			/* N/A */
+		char		name[16];			/* N/A */
+	} cpu[2] __packed;
+	/* debugging/profiling/command time tracing information */
+	u_int16_t	profiling_page;				/* N/A */
+	u_int16_t	profiling_programs;			/* N/A */
+	u_int16_t	time_trace_page;			/* N/A */
+	u_int16_t	time_trace_programs;			/* N/A */
+	u_int8_t	res18[8];				/* N/A */
+	/* error counters on physical devices */
+	u_int16_t	physical_device_bus_resets;		/* N/A */
+	u_int16_t	physical_device_parity_errors;		/* N/A */
+	u_int16_t	physical_device_soft_errors;		/* N/A */
+	u_int16_t	physical_device_commands_failed;	/* N/A */
+	u_int16_t	physical_device_miscellaneous_errors;	/* N/A */
+	u_int16_t	physical_device_command_timeouts;	/* N/A */
+	u_int16_t	physical_device_selection_timeouts;	/* N/A */
+	u_int16_t	physical_device_retries;		/* N/A */
+	u_int16_t	physical_device_aborts;			/* N/A */
+	u_int16_t	physical_device_host_command_aborts;	/* N/A */
+	u_int16_t	physical_device_PFAs_detected;		/* N/A */
+	u_int16_t	physical_device_host_commands_failed;	/* N/A */
+	u_int8_t	res19[8];				/* N/A */
+	/* error counters on logical devices */
+	u_int16_t	logical_device_soft_errors;		/* N/A */
+	u_int16_t	logical_device_commands_failed;		/* N/A */
+	u_int16_t	logical_device_host_command_aborts;	/* N/A */
+	u_int16_t	res20;					/* N/A */
+	/* error counters on controller */
+	u_int16_t	controller_parity_ecc_errors;
+	u_int16_t	controller_host_command_aborts;		/* N/A */
+	u_int8_t	res21[4];				/* N/A */
+	/* long duration activity information */
+	u_int16_t	background_inits_active;
+	u_int16_t	logical_inits_active;
+	u_int16_t	physical_inits_active;
+	u_int16_t	consistency_checks_active;
+	u_int16_t	rebuilds_active;
+	u_int16_t	MORE_active;
+	u_int16_t	patrol_active;				/* N/A */
+	u_int8_t	long_operation_status;			/* N/A */
+	u_int8_t	res22;					/* N/A */
+	/* flash ROM information */
+	u_int8_t	flash_type;				/* N/A */
+	u_int8_t	res23;					/* N/A */
+	u_int16_t	flash_size;
+	u_int32_t	flash_maximum_age;
+	u_int32_t	flash_age;
+	u_int8_t	res24[4];				/* N/A */
+	char		flash_name[16];				/* N/A */
+	/* firmware runtime information */
+	u_int8_t	rebuild_rate;
+	u_int8_t	background_init_rate;
+	u_int8_t	init_rate;
+	u_int8_t	consistency_check_rate;
+	u_int8_t	res25[4];				/* N/A */
+	u_int32_t	maximum_dp;
+	u_int32_t	free_dp;
+	u_int32_t	maximum_iop;
+	u_int32_t	free_iop;
+	u_int16_t	maximum_comb_length;
+	u_int16_t	maximum_configuration_groups;
+	u_int8_t	installation_abort:1;
+	u_int8_t	maintenance:1;
+	u_int8_t	res26:6;				/* N/A */
+	u_int8_t	res27[3];				/* N/A */
+	u_int8_t	res28[32 + 512];			/* N/A */
+} __packed;
+
+/*
+ * 21.9.2 MDACIOCTL_GETLOGDEVINFOVALID
+ */
+struct mly_ioctl_getlogdevinfovalid {
+	u_int8_t	res1;					/* N/A */
+	u_int8_t	channel;
+	u_int8_t	target;
+	u_int8_t	lun;
+	u_int8_t	state;					/* see 8.1 */
+	u_int8_t	raid_level;				/* see 8.2 */
+	u_int8_t	stripe_size;				/* see 8.3 */
+	u_int8_t	cache_line_size;			/* see 8.4 */
+	u_int8_t	read_write_control;			/* see 8.5 */
+	u_int8_t	consistency_check:1;
+	u_int8_t	rebuild:1;
+	u_int8_t	make_consistent:1;
+	u_int8_t	initialisation:1;
+	u_int8_t	migration:1;
+	u_int8_t	patrol:1;
+	u_int8_t	res2:2;					/* N/A */
+	u_int8_t	ar5_limit;
+	u_int8_t	ar5_algo;
+	u_int16_t	logical_device_number;
+	u_int16_t	bios_control;
+	/* erorr counters */
+	u_int16_t	soft_errors;				/* N/A */
+	u_int16_t	commands_failed;			/* N/A */
+	u_int16_t	host_command_aborts;			/* N/A */
+	u_int16_t	deferred_write_errors;			/* N/A */
+	u_int8_t	res3[8];				/* N/A */
+	/* device size information */
+	u_int8_t	res4[2];				/* N/A */
+	u_int16_t	device_block_size;
+	u_int32_t	original_device_size;			/* N/A */
+	u_int32_t	device_size;		/* XXX "blocks or MB" Huh? */
+	u_int8_t	res5[4];				/* N/A */
+	char		device_name[32];			/* N/A */
+	u_int8_t	inquiry[36];
+	u_int8_t	res6[12];				/* N/A */
+	u_int64_t	last_read_block;			/* N/A */
+	u_int64_t	last_written_block;			/* N/A */
+	u_int64_t	consistency_check_block;
+	u_int64_t	rebuild_block;
+	u_int64_t	make_consistent_block;
+	u_int64_t	initialisation_block;
+	u_int64_t	migration_block;
+	u_int64_t	patrol_block;				/* N/A */
+	u_int8_t	res7[64];				/* N/A */
+} __packed;
+
+/*
+ * 21.10.2 MDACIOCTL_GETPHYSDEVINFOVALID: Data Format
+ */
+struct mly_ioctl_getphysdevinfovalid {
+	u_int8_t	res1;
+	u_int8_t	channel;
+	u_int8_t	target;
+	u_int8_t	lun;
+	u_int8_t	raid_ft:1;			/* configuration status */
+	u_int8_t	res2:1;					/* N/A */
+	u_int8_t	local:1;
+	u_int8_t	res3:5;
+	u_int8_t	host_dead:1;			/* multiple host/controller status *//* N/A */
+	u_int8_t	host_connection_dead:1;			/* N/A */
+	u_int8_t	res4:6;					/* N/A */
+	u_int8_t	state;				/* see 8.1 */
+	u_int8_t	width;
+	u_int16_t	speed;
+	/* multiported physical device information */
+	u_int8_t	ports_available;			/* N/A */
+	u_int8_t	ports_inuse;				/* N/A */
+	u_int8_t	res5[4];
+	u_int8_t	ether_address[16];			/* N/A */
+	u_int16_t	command_tags;
+	u_int8_t	consistency_check:1;			/* N/A */
+	u_int8_t	rebuild:1;				/* N/A */
+	u_int8_t	make_consistent:1;			/* N/A */
+	u_int8_t	initialisation:1;
+	u_int8_t	migration:1;				/* N/A */
+	u_int8_t	patrol:1;				/* N/A */
+	u_int8_t	res6:2;
+	u_int8_t	long_operation_status;			/* N/A */
+	u_int8_t	parity_errors;
+	u_int8_t	soft_errors;
+	u_int8_t	hard_errors;
+	u_int8_t	miscellaneous_errors;
+	u_int8_t	command_timeouts;			/* N/A */
+	u_int8_t	retries;				/* N/A */
+	u_int8_t	aborts;					/* N/A */
+	u_int8_t	PFAs_detected;				/* N/A */
+	u_int8_t	res7[6];
+	u_int16_t	block_size;
+	u_int32_t	original_device_size;		/* XXX "blocks or MB" Huh? */
+	u_int32_t	device_size;			/* XXX "blocks or MB" Huh? */
+	u_int8_t	res8[4];
+	char		name[16];				/* N/A */
+	u_int8_t	res9[16 + 32];
+	u_int8_t	inquiry[36];
+	u_int8_t	res10[12 + 16];
+	u_int64_t	last_read_block;			/* N/A */
+	u_int64_t	last_written_block;			/* N/A */
+	u_int64_t	consistency_check_block;		/* N/A */
+	u_int64_t	rebuild_block;				/* N/A */
+	u_int64_t	make_consistent_block;			/* N/A */
+	u_int64_t	initialisation_block;			/* N/A */
+	u_int64_t	migration_block;			/* N/A */
+	u_int64_t	patrol_block;				/* N/A */
+	u_int8_t	res11[256];
+} __packed;
+
+union mly_devinfo {
+	struct mly_ioctl_getlogdevinfovalid	logdev;
+	struct mly_ioctl_getphysdevinfovalid	physdev;
+};
+
+/*
+ * 21.11.2 MDACIOCTL_GETPHYSDEVSTATISTICS: Data Format
+ * 21.12.2 MDACIOCTL_GETLOGDEVSTATISTICS: Data Format
+ */
+struct mly_ioctl_getdevstatistics {
+	u_int32_t	uptime_ms;			/* getphysedevstatistics only */
+	u_int8_t	res1[5];				/* N/A */
+	u_int8_t	channel;
+	u_int8_t	target;
+	u_int8_t	lun;
+	u_int16_t	raid_device;			/* getlogdevstatistics only */
+	u_int8_t	res2[2];				/* N/A */
+	/* total read/write performance including cache data */
+	u_int32_t	total_reads;
+	u_int32_t	total_writes;
+	u_int32_t	total_read_size;
+	u_int32_t	total_write_size;
+	/* cache read/write performance */
+	u_int32_t	cache_reads;				/* N/A */
+	u_int32_t	cache_writes;				/* N/A */
+	u_int32_t	cache_read_size;			/* N/A */
+	u_int32_t	cache_write_size;			/* N/A */
+	/* commands active/wait information */
+	u_int32_t	command_waits_done;			/* N/A */
+	u_int16_t	active_commands;			/* N/A */
+	u_int16_t	waiting_commands;			/* N/A */
+	u_int8_t	res3[8];				/* N/A */
+} __packed;
+
+/*
+ * 21.13.2 MDACIOCTL_GETCONTROLLERSTATISTICS: Data Format
+ */
+struct mly_ioctl_getcontrollerstatistics {
+	u_int32_t	uptime_ms;				/* N/A */
+	u_int8_t	res1[12];				/* N/A */
+	/* target physical device performance data information */
+	u_int32_t	target_physical_device_interrupts;	/* N/A */
+	u_int32_t	target_physical_device_stray_interrupts;/* N/A */
+	u_int8_t	res2[8];				/* N/A */
+	u_int32_t	target_physical_device_reads;		/* N/A */
+	u_int32_t	target_physical_device_writes;		/* N/A */
+	u_int32_t	target_physical_device_read_size;	/* N/A */
+	u_int32_t	target_physical_device_write_size;	/* N/A */
+	/* host system performance data information */
+	u_int32_t	host_system_interrupts;			/* N/A */
+	u_int32_t	host_system_stray_interrupts;		/* N/A */
+	u_int32_t	host_system_sent_interrupts;		/* N/A */
+	u_int8_t	res3[4];				/* N/A */
+	u_int32_t	physical_device_reads;			/* N/A */
+	u_int32_t	physical_device_writes;			/* N/A */
+	u_int32_t	physical_device_read_size;		/* N/A */
+	u_int32_t	physical_device_write_size;		/* N/A */
+	u_int32_t	physical_device_cache_reads;		/* N/A */
+	u_int32_t	physical_device_cache_writes;		/* N/A */
+	u_int32_t	physical_device_cache_read_size;	/* N/A */
+	u_int32_t	physical_device_cache_write_size;	/* N/A */
+	u_int32_t	logical_device_reads;			/* N/A */
+	u_int32_t	logical_device_writes;			/* N/A */
+	u_int32_t	logical_device_read_size;		/* N/A */
+	u_int32_t	logical_device_write_size;		/* N/A */
+	u_int32_t	logical_device_cache_reads;		/* N/A */
+	u_int32_t	logical_device_cache_writes;		/* N/A */
+	u_int32_t	logical_device_cache_read_size;		/* N/A */
+	u_int32_t	logical_device_cache_write_size;	/* N/A */
+	u_int16_t	target_physical_device_commands_active;	/* N/A */
+	u_int16_t	target_physical_device_commands_waiting;/* N/A */
+	u_int16_t	host_system_commands_active;		/* N/A */
+	u_int16_t	host_system_commands_waiting;		/* N/A */
+	u_int8_t	res4[48 + 64];				/* N/A */
+} __packed;
+
+/*
+ * 21.2 MDACIOCTL_SETRAIDDEVSTATE
+ */
+struct mly_ioctl_param_setraiddevstate {
+	u_int8_t	state;
+} __packed;
+
+/*
+ * 21.27.2 MDACIOCTL_GETBDT_FOR_SYSDRIVE: Data Format
+ */
+#define	MLY_MAX_BDT_ENTRIES	1022
+struct mly_ioctl_getbdt_for_sysdrive {
+	u_int32_t	num_of_bdt_entries;
+	u_int32_t	bad_data_block_address[MLY_MAX_BDT_ENTRIES];
+} __packed;
+
+/*
+ * 22.1 Physical Device Definition (PDD)
+ */
+struct mly_pdd {
+	u_int8_t	type;				/* see 8.2 */
+	u_int8_t	state;				/* see 8.1 */
+	u_int16_t	raid_device;
+	u_int32_t	device_size;			/* XXX "block or MB" Huh? */
+	u_int8_t	controller;
+	u_int8_t	channel;
+	u_int8_t	target;
+	u_int8_t	lun;
+	u_int32_t	start_address;
+} __packed;
+
+/*
+ * 22.2 RAID Device Use Definition (UDD)
+ */
+struct mly_udd {
+	u_int8_t	res1;
+	u_int8_t	state;				/* see 8.1 */
+	u_int16_t	raid_device;
+	u_int32_t	start_address;
+} __packed;
+
+/*
+ * RAID Device Definition (LDD)
+ */
+struct mly_ldd {
+	u_int8_t	type;				/* see 8.2 */
+	u_int8_t	state;				/* see 8.1 */
+	u_int16_t	raid_device;
+	u_int32_t	device_size;			/* XXX "block or MB" Huh? */
+	u_int8_t	devices_used_count;
+	u_int8_t	stripe_size;			/* see 8.3 */
+	u_int8_t	cache_line_size;		/* see 8.4 */
+	u_int8_t	read_write_control;		/* see 8.5 */
+	u_int32_t	devices_used_size;		/* XXX "block or MB" Huh? */
+	u_int16_t	devices_used[32];		/* XXX actual size of this field unknown! */
+} __packed;
+
+/*
+ * Define a datastructure giving the smallest allocation that will hold
+ * a PDD, UDD or LDD for MDACIOCTL_GETDEVCONFINFO.
+ */
+struct mly_devconf_hdr {
+	u_int8_t	type;				/* see 8.2 */
+	u_int8_t	state;				/* see 8.1 */
+	u_int16_t	raid_device;
+};
+
+union mly_ioctl_devconfinfo {
+	struct mly_pdd		pdd;
+	struct mly_udd		udd;
+	struct mly_ldd		ldd;
+	struct mly_devconf_hdr	hdr;
+};
+
+/*
+ * 22.3 MDACIOCTL_RENAMERAIDDEV
+ *
+ * XXX this command is listed as transferring data, but does not define the data.
+ */
+struct mly_ioctl_param_renameraiddev {
+	u_int8_t	new_raid_device;
+} __packed;
+
+/*
+ * 23.6.2 MDACIOCTL_XLATEPHYSDEVTORAIDDEV
+ *
+ * XXX documentation suggests this format will change
+ */
+struct mly_ioctl_param_xlatephysdevtoraiddev {
+	u_int16_t	raid_device;
+	u_int8_t	res1[2];
+	u_int8_t	controller;
+	u_int8_t	channel;
+	u_int8_t	target;
+	u_int8_t	lun;
+} __packed;
+
+/*
+ * 23.7 MDACIOCTL_GETGROUPCONFINFO
+ */
+struct mly_ioctl_param_getgroupconfinfo {
+	u_int16_t			group;
+	u_int8_t			res1[8];
+	union mly_cmd_transfer	transfer;
+} __packed;
+
+/*
+ * 23.9.2 MDACIOCTL_GETFREESPACELIST: Data Format
+ *
+ * The controller will populate as much of this structure as is provided,
+ * or as is required to fully list the free space available.
+ */
+struct mly_ioctl_getfreespacelist_entry {
+	u_int16_t	raid_device;
+	u_int8_t	res1[6];
+	u_int32_t	address;		/* XXX "blocks or MB" Huh? */
+	u_int32_t	size;			/* XXX "blocks or MB" Huh? */
+} __packed;
+
+struct mly_ioctl_getfrespacelist {
+	u_int16_t	returned_entries;
+	u_int16_t	total_entries;
+	u_int8_t	res1[12];
+	struct mly_ioctl_getfreespacelist_entry space[];	/* expand to suit */
+} __packed;
+
+/*
+ * 27.1 MDACIOCTL_GETSUBSYSTEMDATA
+ * 27.2 MDACIOCTL_SETSUBSYSTEMDATA
+ *
+ * PCI controller only supports a limited subset of the possible operations.
+ *
+ * XXX where does the status end up? (the command transfers no data)
+ */
+struct mly_ioctl_param_subsystemdata {
+	u_int8_t	operation:4;
+#define	MLY_BBU_GETSTATUS	0x00
+#define	MLY_BBU_SET_THRESHOLD	0x00	/* minutes in param[0,1] */
+	u_int8_t	subsystem:4;
+#define	MLY_SUBSYSTEM_BBU	0x01
+	u_int	parameter[3];		/* only for SETSUBSYSTEMDATA */
+} __packed;
+
+struct mly_ioctl_getsubsystemdata_bbustatus {
+	u_int16_t	current_power;
+	u_int16_t	maximum_power;
+	u_int16_t	power_threshold;
+	u_int8_t	charge_level;
+	u_int8_t	hardware_version;
+	u_int8_t	battery_type;
+#define	MLY_BBU_TYPE_UNKNOWN	0x00
+#define	MLY_BBU_TYPE_NICAD	0x01
+#define	MLY_BBU_TYPE_MISSING	0xfe
+	u_int8_t	res1;
+	u_int8_t	operation_status;
+#define	MLY_BBU_STATUS_NO_SYNC		0x01
+#define	MLY_BBU_STATUS_OUT_OF_SYNC	0x02
+#define	MLY_BBU_STATUS_FIRST_WARNING	0x04
+#define	MLY_BBU_STATUS_SECOND_WARNING	0x08
+#define	MLY_BBU_STATUS_RECONDITIONING	0x10
+#define	MLY_BBU_STATUS_DISCHARGING	0x20
+#define	MLY_BBU_STATUS_FASTCHARGING	0x40
+	u_int8_t	res2;
+} __packed;
+
+/*
+ * 28.9  MDACIOCTL_RESETDEVICE
+ * 28.10 MDACIOCTL_FLUSHDEVICEDATA
+ * 28.11 MDACIOCTL_PAUSEDEVICE
+ * 28.12 MDACIOCTL_UNPAUSEDEVICE
+ */
+struct mly_ioctl_param_deviceoperation {
+	u_int8_t	operation_device;		/* see 14.3 */
+} __packed;
+
+/*
+ * 31.1 Event Data Format
+ */
+struct mly_event {
+	u_int32_t	sequence_number;
+	u_int32_t	timestamp;
+	u_int32_t	code;
+	u_int8_t	controller;
+	u_int8_t	channel;
+	u_int8_t	target;				/* also enclosure */
+	u_int8_t	lun;				/* also enclosure unit */
+	u_int8_t   	res1[4];
+	u_int32_t	param;
+	u_int8_t	sense[40];
+} __packed;
+
+/*
+ * 31.2 MDACIOCTL_GETEVENT
+ */
+struct mly_ioctl_param_getevent {
+	u_int16_t		sequence_number_low;
+	u_int8_t		res1[8];
+	union mly_cmd_transfer	transfer;
+} __packed;
+
+union mly_ioctl_param {
+	struct mly_ioctl_param_data			data;
+	struct mly_ioctl_param_setmemorymailbox		setmemorymailbox;
+	struct mly_ioctl_param_setraiddevstate		setraiddevstate;
+	struct mly_ioctl_param_renameraiddev		renameraiddev;
+	struct mly_ioctl_param_xlatephysdevtoraiddev	xlatephysdevtoraiddev;
+	struct mly_ioctl_param_getgroupconfinfo		getgroupconfinfo;
+	struct mly_ioctl_param_subsystemdata		subsystemdata;
+	struct mly_ioctl_param_deviceoperation		deviceoperation;
+	struct mly_ioctl_param_getevent			getevent;
+};
+
+/*
+ * 19 SCSI Command Format
+ */
+#define	MLY_PHYADDR(c, b, t, l)	\
+	((l) | ((t) << 8) | ((b) << 16) | ((c) << 19))
+#define	MLY_LOGADDR(c, u)	\
+	((u) | ((c) << 19))
+
+#define	MLY_LOGADDR_DEV(a)		(a & 0xffff)
+#define	MLY_LOGADDR_CTLR(a)		(a >> 19)
+
+#define	MLY_PHYADDR_LUN(a)		(a & 0xff)
+#define	MLY_PHYADDR_TARGET(a)		((a >> 8) & 0xff)
+#define	MLY_PHYADDR_CHANNEL(a)		((a >> 16) & 0x07)
+#define	MLY_PHYADDR_CTLR(a)		((a >> 19) & 0x1f)
+
+/*
+ * struct mly_cmd_address_physical {
+ *	u_int8_t			lun;
+ *	u_int8_t			target;
+ *	u_int8_t			channel:3;
+ *	u_int8_t			controller:5;
+ * } __packed;
+ *
+ * struct mly_cmd_address_logical {
+ *	u_int16_t			logdev;
+ *	u_int8_t			res1:3;
+ *	u_int8_t			controller:5;
+ * } __packed;
+ */
+
+struct mly_cmd_generic {
+	u_int16_t			command_id;
+	u_int8_t			opcode;
+	u_int8_t			command_control;
+	u_int32_t			data_size;
+	u_int64_t			sense_buffer_address;
+	u_int8_t			addr[3];
+	u_int8_t			timeout;
+	u_int8_t			maximum_sense_size;
+	u_int8_t			res1[11];
+	union mly_cmd_transfer	transfer;
+} __packed;
+
+
+/*
+ * 19.1 MDACMD_SCSI & MDACMD_SCSIPT
+ */
+#define	MLY_CMD_SCSI_SMALL_CDB	10
+struct mly_cmd_scsi_small {
+	u_int16_t			command_id;
+	u_int8_t			opcode;
+	u_int8_t			command_control;
+	u_int32_t			data_size;
+	u_int64_t			sense_buffer_address;
+	u_int8_t			addr[3];
+	u_int8_t			timeout;
+	u_int8_t			maximum_sense_size;
+	u_int8_t			cdb_length;
+	u_int8_t			cdb[MLY_CMD_SCSI_SMALL_CDB];
+	union mly_cmd_transfer	transfer;
+} __packed;
+
+/*
+ * 19.2 MDACMD_SCSILC & MDACMD_SCSILCPT
+ */
+struct mly_cmd_scsi_large {
+	u_int16_t			command_id;
+	u_int8_t			opcode;
+	u_int8_t			command_control;
+	u_int32_t			data_size;
+	u_int64_t			sense_buffer_address;
+	u_int8_t			addr[3];
+	u_int8_t			timeout;
+	u_int8_t			maximum_sense_size;
+	u_int8_t			cdb_length;
+	u_int16_t			res1;
+	u_int64_t			cdb_physaddr;
+	union mly_cmd_transfer	transfer;
+} __packed;
+
+/*
+ * 20.1 IOCTL Command Format: Internal Bus
+ */
+struct mly_cmd_ioctl {
+	u_int16_t			command_id;
+	u_int8_t			opcode;
+	u_int8_t			command_control;
+	u_int32_t			data_size;
+	u_int64_t			sense_buffer_address;
+	u_int8_t			addr[3];
+	u_int8_t			timeout;
+	u_int8_t			maximum_sense_size;
+	u_int8_t			sub_ioctl;
+	union mly_ioctl_param		param;
+} __packed;
+
+/*
+ * PG6: 8.2.2
+ */
+struct mly_cmd_mmbox {
+	u_int32_t			flag;
+	u_int8_t			data[60];
+} __packed;
+
+union mly_cmd_packet {
+	struct mly_cmd_generic		generic;
+	struct mly_cmd_scsi_small	scsi_small;
+	struct mly_cmd_scsi_large	scsi_large;
+	struct mly_cmd_ioctl		ioctl;
+	struct mly_cmd_mmbox		mmbox;
+};
+
+/*
+ * PG6: 5.3
+ */
+#define	MLY_I960RX_COMMAND_MAILBOX	0x10
+#define	MLY_I960RX_STATUS_MAILBOX	0x18
+#define	MLY_I960RX_IDBR			0x20
+#define	MLY_I960RX_ODBR			0x2c
+#define	MLY_I960RX_ERROR_STATUS		0x2e
+#define	MLY_I960RX_INTERRUPT_STATUS	0x30
+#define	MLY_I960RX_INTERRUPT_MASK	0x34
+
+#define	MLY_STRONGARM_COMMAND_MAILBOX	0x50
+#define	MLY_STRONGARM_STATUS_MAILBOX	0x58
+#define	MLY_STRONGARM_IDBR		0x60
+#define	MLY_STRONGARM_ODBR		0x61
+#define	MLY_STRONGARM_ERROR_STATUS	0x63
+#define	MLY_STRONGARM_INTERRUPT_STATUS	0x30
+#define	MLY_STRONGARM_INTERRUPT_MASK	0x34
+
+/*
+ * PG6: 5.4.3 Doorbell 0
+ */
+#define	MLY_HM_CMDSENT			(1<<0)
+#define	MLY_HM_STSACK			(1<<1)
+#define	MLY_SOFT_RST			(1<<3)
+#define	MLY_AM_CMDSENT			(1<<4)
+
+/*
+ * PG6: 5.4.4 Doorbell 1
+ *
+ * Note that the documentation claims that these bits are set when the
+ * status queue(s) are empty, wheras the Linux driver and experience
+ * suggest they are set when there is status available.
+ */
+#define	MLY_HM_STSREADY			(1<<0)
+#define	MLY_AM_STSREADY			(1<<1)
+
+/*
+ * PG6: 5.4.6 Doorbell 3
+ */
+#define	MLY_MSG_EMPTY			(1<<3)
+#define	MLY_MSG_SPINUP			0x08
+#define	MLY_MSG_RACE_RECOVERY_FAIL	0x60
+#define	MLY_MSG_RACE_IN_PROGRESS	0x70
+#define	MLY_MSG_RACE_ON_CRITICAL	0xb0
+#define	MLY_MSG_PARITY_ERROR		0xf0
+
+/*
+ * PG6: 5.4.8 Outbound Interrupt Mask
+ */
+#define	MLY_INTERRUPT_MASK_DISABLE	0xff
+#define	MLY_INTERRUPT_MASK_ENABLE	(0xff & ~(1<<2))
+
+/*
+ * PG6: 8.2 Advanced Mailbox Scheme
+ *
+ * Note that this must be allocated on a 4k boundary, and all internal
+ * fields must also reside on a 4k boundary.
+ * We could dynamically size this structure, but the extra effort
+ * is probably unjustified.  Note that these buffers do not need to be
+ * adjacent - we just group them to simplify allocation of the bus-visible
+ * buffer.
+ *
+ * XXX Note that for some reason, if MLY_MMBOX_COMMANDS is > 64, the controller
+ * fails to respond to the command at (MLY_MMBOX_COMMANDS - 64).  It's not
+ * wrapping to 0 at this point (determined by experimentation).  This is not
+ * consistent with the Linux driver's implementation.
+ * Whilst it's handy to have lots of room for status returns in case we end up
+ * being slow getting back to completed commands, it seems unlikely that we
+ * would get 64 commands ahead of the controller on the submissions side, so
+ * the current workaround is to simply limit the command ring to 64 entries.
+ */
+union mly_status_packet {
+	 struct mly_status		status;
+	 struct {
+		 u_int32_t		flag;
+		 u_int8_t		data[4];
+	 } __packed mmbox;
+};
+union mly_health_region {
+	struct mly_health_status	status;
+	u_int8_t			pad[1024];
+};
+
+#define	MLY_MMBOX_COMMANDS		64
+#define	MLY_MMBOX_STATUS		512
+struct mly_mmbox {
+	union mly_cmd_packet	mmm_command[MLY_MMBOX_COMMANDS];
+	union mly_status_packet	mmm_status[MLY_MMBOX_STATUS];
+	union mly_health_region	mmm_health;
+} __packed;
+
+#endif	/* !defined _PCI_MLYREG_H_ */

Property changes on: lab4/.minix-src/include/dev/pci/mlyreg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/buffer.h
===================================================================
--- lab4/.minix-src/include/event2/buffer.h	(nonexistent)
+++ lab4/.minix-src/include/event2/buffer.h	(revision 13)
@@ -0,0 +1,844 @@
+/*	$NetBSD: buffer.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*	$NetBSD: buffer.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_BUFFER_H_
+#define _EVENT2_BUFFER_H_
+
+/** @file event2/buffer.h
+
+  Functions for buffering data for network sending or receiving.
+
+  An evbuffer can be used for preparing data before sending it to
+  the network or conversely for reading data from the network.
+  Evbuffers try to avoid memory copies as much as possible.  As a
+  result, evbuffers can be used to pass data around without actually
+  incurring the overhead of copying the data.
+
+  A new evbuffer can be allocated with evbuffer_new(), and can be
+  freed with evbuffer_free().  Most users will be using evbuffers via
+  the bufferevent interface.  To access a bufferevent's evbuffers, use
+  bufferevent_get_input() and bufferevent_get_output().
+
+  There are several guidelines for using evbuffers.
+
+  - if you already know how much data you are going to add as a result
+    of calling evbuffer_add() multiple times, it makes sense to use
+    evbuffer_expand() first to make sure that enough memory is allocated
+    before hand.
+
+  - evbuffer_add_buffer() adds the contents of one buffer to the other
+    without incurring any unnecessary memory copies.
+
+  - evbuffer_add() and evbuffer_add_buffer() do not mix very well:
+    if you use them, you will wind up with fragmented memory in your
+	buffer.
+
+  - For high-performance code, you may want to avoid copying data into and out
+    of buffers.  You can skip the copy step by using
+    evbuffer_reserve_space()/evbuffer_commit_space() when writing into a
+    buffer, and evbuffer_peek() when reading.
+
+  In Libevent 2.0 and later, evbuffers are represented using a linked
+  list of memory chunks, with pointers to the first and last chunk in
+  the chain.
+
+  As the contents of an evbuffer can be stored in multiple different
+  memory blocks, it cannot be accessed directly.  Instead, evbuffer_pullup()
+  can be used to force a specified number of bytes to be contiguous. This
+  will cause memory reallocation and memory copies if the data is split
+  across multiple blocks.  It is more efficient, however, to use
+  evbuffer_peek() if you don't require that the memory to be contiguous.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#include <stdarg.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+#include <event2/util.h>
+
+/**
+   An evbuffer is an opaque data type for efficiently buffering data to be
+   sent or received on the network.
+
+   @see event2/event.h for more information
+*/
+struct evbuffer
+#ifdef _EVENT_IN_DOXYGEN
+{}
+#endif
+;
+
+/**
+    Pointer to a position within an evbuffer.
+
+    Used when repeatedly searching through a buffer.  Calling any function
+    that modifies or re-packs the buffer contents may invalidate all
+    evbuffer_ptrs for that buffer.  Do not modify these values except with
+    evbuffer_ptr_set.
+ */
+struct evbuffer_ptr {
+	ev_ssize_t pos;
+
+	/* Do not alter the values of fields. */
+	struct {
+		void *chain;
+		size_t pos_in_chain;
+	} _internal;
+};
+
+/** Describes a single extent of memory inside an evbuffer.  Used for
+    direct-access functions.
+
+    @see evbuffer_reserve_space, evbuffer_commit_space, evbuffer_peek
+ */
+#ifdef _EVENT_HAVE_SYS_UIO_H
+#define evbuffer_iovec iovec
+/* Internal use -- defined only if we are using the native struct iovec */
+#define _EVBUFFER_IOVEC_IS_NATIVE
+#else
+struct evbuffer_iovec {
+	/** The start of the extent of memory. */
+	void *iov_base;
+	/** The length of the extent of memory. */
+	size_t iov_len;
+};
+#endif
+
+/**
+  Allocate storage for a new evbuffer.
+
+  @return a pointer to a newly allocated evbuffer struct, or NULL if an error
+	occurred
+ */
+struct evbuffer *evbuffer_new(void);
+/**
+  Deallocate storage for an evbuffer.
+
+  @param buf pointer to the evbuffer to be freed
+ */
+void evbuffer_free(struct evbuffer *buf);
+
+/**
+   Enable locking on an evbuffer so that it can safely be used by multiple
+   threads at the same time.
+
+   NOTE: when locking is enabled, the lock will be held when callbacks are
+   invoked.  This could result in deadlock if you aren't careful.  Plan
+   accordingly!
+
+   @param buf An evbuffer to make lockable.
+   @param lock A lock object, or NULL if we should allocate our own.
+   @return 0 on success, -1 on failure.
+ */
+int evbuffer_enable_locking(struct evbuffer *buf, void *lock);
+
+/**
+   Acquire the lock on an evbuffer.  Has no effect if locking was not enabled
+   with evbuffer_enable_locking.
+*/
+void evbuffer_lock(struct evbuffer *buf);
+
+/**
+   Release the lock on an evbuffer.  Has no effect if locking was not enabled
+   with evbuffer_enable_locking.
+*/
+void evbuffer_unlock(struct evbuffer *buf);
+
+
+/** If this flag is set, then we will not use evbuffer_peek(),
+ * evbuffer_remove(), evbuffer_remove_buffer(), and so on to read bytes
+ * from this buffer: we'll only take bytes out of this buffer by
+ * writing them to the network (as with evbuffer_write_atmost), by
+ * removing them without observing them (as with evbuffer_drain),
+ * or by copying them all out at once (as with evbuffer_add_buffer).
+ *
+ * Using this option allows the implementation to use sendfile-based
+ * operations for evbuffer_add_file(); see that function for more
+ * information.
+ *
+ * This flag is on by default for bufferevents that can take advantage
+ * of it; you should never actually need to set it on a bufferevent's
+ * output buffer.
+ */
+#define EVBUFFER_FLAG_DRAINS_TO_FD 1
+
+/** Change the flags that are set for an evbuffer by adding more.
+ *
+ * @param buffer the evbuffer that the callback is watching.
+ * @param cb the callback whose status we want to change.
+ * @param flags One or more EVBUFFER_FLAG_* options
+ * @return 0 on success, -1 on failure.
+ */
+int evbuffer_set_flags(struct evbuffer *buf, ev_uint64_t flags);
+/** Change the flags that are set for an evbuffer by removing some.
+ *
+ * @param buffer the evbuffer that the callback is watching.
+ * @param cb the callback whose status we want to change.
+ * @param flags One or more EVBUFFER_FLAG_* options
+ * @return 0 on success, -1 on failure.
+ */
+int evbuffer_clear_flags(struct evbuffer *buf, ev_uint64_t flags);
+
+/**
+  Returns the total number of bytes stored in the evbuffer
+
+  @param buf pointer to the evbuffer
+  @return the number of bytes stored in the evbuffer
+*/
+size_t evbuffer_get_length(const struct evbuffer *buf);
+
+/**
+   Returns the number of contiguous available bytes in the first buffer chain.
+
+   This is useful when processing data that might be split into multiple
+   chains, or that might all be in the first chain.  Calls to
+   evbuffer_pullup() that cause reallocation and copying of data can thus be
+   avoided.
+
+   @param buf pointer to the evbuffer
+   @return 0 if no data is available, otherwise the number of available bytes
+     in the first buffer chain.
+*/
+size_t evbuffer_get_contiguous_space(const struct evbuffer *buf);
+
+/**
+  Expands the available space in an evbuffer.
+
+  Expands the available space in the evbuffer to at least datlen, so that
+  appending datlen additional bytes will not require any new allocations.
+
+  @param buf the evbuffer to be expanded
+  @param datlen the new minimum length requirement
+  @return 0 if successful, or -1 if an error occurred
+*/
+int evbuffer_expand(struct evbuffer *buf, size_t datlen);
+
+/**
+   Reserves space in the last chain or chains of an evbuffer.
+
+   Makes space available in the last chain or chains of an evbuffer that can
+   be arbitrarily written to by a user.  The space does not become
+   available for reading until it has been committed with
+   evbuffer_commit_space().
+
+   The space is made available as one or more extents, represented by
+   an initial pointer and a length.  You can force the memory to be
+   available as only one extent.  Allowing more extents, however, makes the
+   function more efficient.
+
+   Multiple subsequent calls to this function will make the same space
+   available until evbuffer_commit_space() has been called.
+
+   It is an error to do anything that moves around the buffer's internal
+   memory structures before committing the space.
+
+   NOTE: The code currently does not ever use more than two extents.
+   This may change in future versions.
+
+   @param buf the evbuffer in which to reserve space.
+   @param size how much space to make available, at minimum.  The
+      total length of the extents may be greater than the requested
+      length.
+   @param vec an array of one or more evbuffer_iovec structures to
+      hold pointers to the reserved extents of memory.
+   @param n_vec The length of the vec array.  Must be at least 1;
+       2 is more efficient.
+   @return the number of provided extents, or -1 on error.
+   @see evbuffer_commit_space()
+*/
+int
+evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size,
+    struct evbuffer_iovec *vec, int n_vec);
+
+/**
+   Commits previously reserved space.
+
+   Commits some of the space previously reserved with
+   evbuffer_reserve_space().  It then becomes available for reading.
+
+   This function may return an error if the pointer in the extents do
+   not match those returned from evbuffer_reserve_space, or if data
+   has been added to the buffer since the space was reserved.
+
+   If you want to commit less data than you got reserved space for,
+   modify the iov_len pointer of the appropriate extent to a smaller
+   value.  Note that you may have received more space than you
+   requested if it was available!
+
+   @param buf the evbuffer in which to reserve space.
+   @param vec one or two extents returned by evbuffer_reserve_space.
+   @param n_vecs the number of extents.
+   @return 0 on success, -1 on error
+   @see evbuffer_reserve_space()
+*/
+int evbuffer_commit_space(struct evbuffer *buf,
+    struct evbuffer_iovec *vec, int n_vecs);
+
+/**
+  Append data to the end of an evbuffer.
+
+  @param buf the evbuffer to be appended to
+  @param data pointer to the beginning of the data buffer
+  @param datlen the number of bytes to be copied from the data buffer
+  @return 0 on success, -1 on failure.
+ */
+int evbuffer_add(struct evbuffer *buf, const void *data, size_t datlen);
+
+
+/**
+  Read data from an evbuffer and drain the bytes read.
+
+  If more bytes are requested than are available in the evbuffer, we
+  only extract as many bytes as were available.
+
+  @param buf the evbuffer to be read from
+  @param data the destination buffer to store the result
+  @param datlen the maximum size of the destination buffer
+  @return the number of bytes read, or -1 if we can't drain the buffer.
+ */
+int evbuffer_remove(struct evbuffer *buf, void *data, size_t datlen);
+
+/**
+  Read data from an evbuffer, and leave the buffer unchanged.
+
+  If more bytes are requested than are available in the evbuffer, we
+  only extract as many bytes as were available.
+
+  @param buf the evbuffer to be read from
+  @param data_out the destination buffer to store the result
+  @param datlen the maximum size of the destination buffer
+  @return the number of bytes read, or -1 if we can't drain the buffer.
+ */
+ev_ssize_t evbuffer_copyout(struct evbuffer *buf, void *data_out, size_t datlen);
+
+/**
+  Read data from an evbuffer into another evbuffer, draining
+  the bytes from the source buffer.  This function avoids copy
+  operations to the extent possible.
+
+  If more bytes are requested than are available in src, the src
+  buffer is drained completely.
+
+  @param src the evbuffer to be read from
+  @param dst the destination evbuffer to store the result into
+  @param datlen the maximum numbers of bytes to transfer
+  @return the number of bytes read
+ */
+int evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst,
+    size_t datlen);
+
+/** Used to tell evbuffer_readln what kind of line-ending to look for.
+ */
+enum evbuffer_eol_style {
+	/** Any sequence of CR and LF characters is acceptable as an
+	 * EOL.
+	 *
+	 * Note that this style can produce ambiguous results: the
+	 * sequence "CRLF" will be treated as a single EOL if it is
+	 * all in the buffer at once, but if you first read a CR from
+	 * the network and later read an LF from the network, it will
+	 * be treated as two EOLs.
+	 */
+	EVBUFFER_EOL_ANY,
+	/** An EOL is an LF, optionally preceded by a CR.  This style is
+	 * most useful for implementing text-based internet protocols. */
+	EVBUFFER_EOL_CRLF,
+	/** An EOL is a CR followed by an LF. */
+	EVBUFFER_EOL_CRLF_STRICT,
+	/** An EOL is a LF. */
+	EVBUFFER_EOL_LF
+};
+
+/**
+ * Read a single line from an evbuffer.
+ *
+ * Reads a line terminated by an EOL as determined by the evbuffer_eol_style
+ * argument.  Returns a newly allocated nul-terminated string; the caller must
+ * free the returned value.  The EOL is not included in the returned string.
+ *
+ * @param buffer the evbuffer to read from
+ * @param n_read_out if non-NULL, points to a size_t that is set to the
+ *       number of characters in the returned string.  This is useful for
+ *       strings that can contain NUL characters.
+ * @param eol_style the style of line-ending to use.
+ * @return pointer to a single line, or NULL if an error occurred
+ */
+char *evbuffer_readln(struct evbuffer *buffer, size_t *n_read_out,
+    enum evbuffer_eol_style eol_style);
+
+/**
+  Move all data from one evbuffer into another evbuffer.
+
+  This is a destructive add.  The data from one buffer moves into
+  the other buffer.  However, no unnecessary memory copies occur.
+
+  @param outbuf the output buffer
+  @param inbuf the input buffer
+  @return 0 if successful, or -1 if an error occurred
+
+  @see evbuffer_remove_buffer()
+ */
+int evbuffer_add_buffer(struct evbuffer *outbuf, struct evbuffer *inbuf);
+
+/**
+   A cleanup function for a piece of memory added to an evbuffer by
+   reference.
+
+   @see evbuffer_add_reference()
+ */
+typedef void (*evbuffer_ref_cleanup_cb)(const void *data,
+    size_t datalen, void *extra);
+
+/**
+  Reference memory into an evbuffer without copying.
+
+  The memory needs to remain valid until all the added data has been
+  read.  This function keeps just a reference to the memory without
+  actually incurring the overhead of a copy.
+
+  @param outbuf the output buffer
+  @param data the memory to reference
+  @param datlen how memory to reference
+  @param cleanupfn callback to be invoked when the memory is no longer
+	referenced by this evbuffer.
+  @param cleanupfn_arg optional argument to the cleanup callback
+  @return 0 if successful, or -1 if an error occurred
+ */
+int evbuffer_add_reference(struct evbuffer *outbuf,
+    const void *data, size_t datlen,
+    evbuffer_ref_cleanup_cb cleanupfn, void *cleanupfn_arg);
+
+/**
+  Copy data from a file into the evbuffer for writing to a socket.
+
+  This function avoids unnecessary data copies between userland and
+  kernel.  If sendfile is available and the EVBUFFER_FLAG_DRAINS_TO_FD
+  flag is set, it uses those functions.  Otherwise, it tries to use
+  mmap (or CreateFileMapping on Windows).
+
+  The function owns the resulting file descriptor and will close it
+  when finished transferring data.
+
+  The results of using evbuffer_remove() or evbuffer_pullup() on
+  evbuffers whose data was added using this function are undefined.
+
+  @param outbuf the output buffer
+  @param fd the file descriptor
+  @param offset the offset from which to read data
+  @param length how much data to read
+  @return 0 if successful, or -1 if an error occurred
+*/
+
+int evbuffer_add_file(struct evbuffer *outbuf, int fd, ev_off_t offset,
+    ev_off_t length);
+
+/**
+  Append a formatted string to the end of an evbuffer.
+
+  The string is formated as printf.
+
+  @param buf the evbuffer that will be appended to
+  @param fmt a format string
+  @param ... arguments that will be passed to printf(3)
+  @return The number of bytes added if successful, or -1 if an error occurred.
+
+  @see evutil_printf(), evbuffer_add_vprintf()
+ */
+int evbuffer_add_printf(struct evbuffer *buf, const char *fmt, ...)
+#ifdef __GNUC__
+  __attribute__((format(printf, 2, 3)))
+#endif
+;
+
+/**
+  Append a va_list formatted string to the end of an evbuffer.
+
+  @param buf the evbuffer that will be appended to
+  @param fmt a format string
+  @param ap a varargs va_list argument array that will be passed to vprintf(3)
+  @return The number of bytes added if successful, or -1 if an error occurred.
+ */
+int evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
+#ifdef __GNUC__
+	__attribute__((format(printf, 2, 0)))
+#endif
+;
+
+
+/**
+  Remove a specified number of bytes data from the beginning of an evbuffer.
+
+  @param buf the evbuffer to be drained
+  @param len the number of bytes to drain from the beginning of the buffer
+  @return 0 on success, -1 on failure.
+ */
+int evbuffer_drain(struct evbuffer *buf, size_t len);
+
+
+/**
+  Write the contents of an evbuffer to a file descriptor.
+
+  The evbuffer will be drained after the bytes have been successfully written.
+
+  @param buffer the evbuffer to be written and drained
+  @param fd the file descriptor to be written to
+  @return the number of bytes written, or -1 if an error occurred
+  @see evbuffer_read()
+ */
+int evbuffer_write(struct evbuffer *buffer, evutil_socket_t fd);
+
+/**
+  Write some of the contents of an evbuffer to a file descriptor.
+
+  The evbuffer will be drained after the bytes have been successfully written.
+
+  @param buffer the evbuffer to be written and drained
+  @param fd the file descriptor to be written to
+  @param howmuch the largest allowable number of bytes to write, or -1
+	to write as many bytes as we can.
+  @return the number of bytes written, or -1 if an error occurred
+  @see evbuffer_read()
+ */
+int evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
+						  ev_ssize_t howmuch);
+
+/**
+  Read from a file descriptor and store the result in an evbuffer.
+
+  @param buffer the evbuffer to store the result
+  @param fd the file descriptor to read from
+  @param howmuch the number of bytes to be read
+  @return the number of bytes read, or -1 if an error occurred
+  @see evbuffer_write()
+ */
+int evbuffer_read(struct evbuffer *buffer, evutil_socket_t fd, int howmuch);
+
+/**
+   Search for a string within an evbuffer.
+
+   @param buffer the evbuffer to be searched
+   @param what the string to be searched for
+   @param len the length of the search string
+   @param start NULL or a pointer to a valid struct evbuffer_ptr.
+   @return a struct evbuffer_ptr whose 'pos' field has the offset of the
+     first occurrence of the string in the buffer after 'start'.  The 'pos'
+     field of the result is -1 if the string was not found.
+ */
+struct evbuffer_ptr evbuffer_search(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start);
+
+/**
+   Search for a string within part of an evbuffer.
+
+   @param buffer the evbuffer to be searched
+   @param what the string to be searched for
+   @param len the length of the search string
+   @param start NULL or a pointer to a valid struct evbuffer_ptr that
+     indicates where we should start searching.
+   @param end NULL or a pointer to a valid struct evbuffer_ptr that
+     indicates where we should stop searching.
+   @return a struct evbuffer_ptr whose 'pos' field has the offset of the
+     first occurrence of the string in the buffer after 'start'.  The 'pos'
+     field of the result is -1 if the string was not found.
+ */
+struct evbuffer_ptr evbuffer_search_range(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start, const struct evbuffer_ptr *end);
+
+/**
+   Defines how to adjust an evbuffer_ptr by evbuffer_ptr_set()
+
+   @see evbuffer_ptr_set() */
+enum evbuffer_ptr_how {
+	/** Sets the pointer to the position; can be called on with an
+	    uninitialized evbuffer_ptr. */
+	EVBUFFER_PTR_SET,
+	/** Advances the pointer by adding to the current position. */
+	EVBUFFER_PTR_ADD
+};
+
+/**
+   Sets the search pointer in the buffer to position.
+
+   If evbuffer_ptr is not initialized.  This function can only be called
+   with EVBUFFER_PTR_SET.
+
+   @param buffer the evbuffer to be search
+   @param ptr a pointer to a struct evbuffer_ptr
+   @param position the position at which to start the next search
+   @param how determines how the pointer should be manipulated.
+   @returns 0 on success or -1 otherwise
+*/
+int
+evbuffer_ptr_set(struct evbuffer *buffer, struct evbuffer_ptr *ptr,
+    size_t position, enum evbuffer_ptr_how how);
+
+/**
+   Search for an end-of-line string within an evbuffer.
+
+   @param buffer the evbuffer to be searched
+   @param start NULL or a pointer to a valid struct evbuffer_ptr to start
+      searching at.
+   @param eol_len_out If non-NULL, the pointed-to value will be set to
+      the length of the end-of-line string.
+   @param eol_style The kind of EOL to look for; see evbuffer_readln() for
+      more information
+   @return a struct evbuffer_ptr whose 'pos' field has the offset of the
+     first occurrence EOL in the buffer after 'start'.  The 'pos'
+     field of the result is -1 if the string was not found.
+ */
+struct evbuffer_ptr evbuffer_search_eol(struct evbuffer *buffer,
+    struct evbuffer_ptr *start, size_t *eol_len_out,
+    enum evbuffer_eol_style eol_style);
+
+/** Function to peek at data inside an evbuffer without removing it or
+    copying it out.
+
+    Pointers to the data are returned by filling the 'vec_out' array
+    with pointers to one or more extents of data inside the buffer.
+
+    The total data in the extents that you get back may be more than
+    you requested (if there is more data last extent than you asked
+    for), or less (if you do not provide enough evbuffer_iovecs, or if
+    the buffer does not have as much data as you asked to see).
+
+    @param buffer the evbuffer to peek into,
+    @param len the number of bytes to try to peek.  If len is negative, we
+       will try to fill as much of vec_out as we can.  If len is negative
+       and vec_out is not provided, we return the number of evbuffer_iovecs
+       that would be needed to get all the data in the buffer.
+    @param start_at an evbuffer_ptr indicating the point at which we
+       should start looking for data.  NULL means, "At the start of the
+       buffer."
+    @param vec_out an array of evbuffer_iovec
+    @param n_vec the length of vec_out.  If 0, we only count how many
+       extents would be necessary to point to the requested amount of
+       data.
+    @return The number of extents needed.  This may be less than n_vec
+       if we didn't need all the evbuffer_iovecs we were given, or more
+       than n_vec if we would need more to return all the data that was
+       requested.
+ */
+int evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len,
+    struct evbuffer_ptr *start_at,
+    struct evbuffer_iovec *vec_out, int n_vec);
+
+
+/** Structure passed to an evbuffer_cb_func evbuffer callback
+
+    @see evbuffer_cb_func, evbuffer_add_cb()
+ */
+struct evbuffer_cb_info {
+	/** The number of bytes in this evbuffer when callbacks were last
+	 * invoked. */
+	size_t orig_size;
+	/** The number of bytes added since callbacks were last invoked. */
+	size_t n_added;
+	/** The number of bytes removed since callbacks were last invoked. */
+	size_t n_deleted;
+};
+
+/** Type definition for a callback that is invoked whenever data is added or
+    removed from an evbuffer.
+
+    An evbuffer may have one or more callbacks set at a time.  The order
+    in which they are executed is undefined.
+
+    A callback function may add more callbacks, or remove itself from the
+    list of callbacks, or add or remove data from the buffer.  It may not
+    remove another callback from the list.
+
+    If a callback adds or removes data from the buffer or from another
+    buffer, this can cause a recursive invocation of your callback or
+    other callbacks.  If you ask for an infinite loop, you might just get
+    one: watch out!
+
+    @param buffer the buffer whose size has changed
+    @param info a structure describing how the buffer changed.
+    @param arg a pointer to user data
+*/
+typedef void (*evbuffer_cb_func)(struct evbuffer *buffer, const struct evbuffer_cb_info *info, void *arg);
+
+struct evbuffer_cb_entry;
+/** Add a new callback to an evbuffer.
+
+  Subsequent calls to evbuffer_add_cb() add new callbacks.  To remove this
+  callback, call evbuffer_remove_cb or evbuffer_remove_cb_entry.
+
+  @param buffer the evbuffer to be monitored
+  @param cb the callback function to invoke when the evbuffer is modified,
+	or NULL to remove all callbacks.
+  @param cbarg an argument to be provided to the callback function
+  @return a handle to the callback on success, or NULL on failure.
+ */
+struct evbuffer_cb_entry *evbuffer_add_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg);
+
+/** Remove a callback from an evbuffer, given a handle returned from
+    evbuffer_add_cb.
+
+    Calling this function invalidates the handle.
+
+    @return 0 if a callback was removed, or -1 if no matching callback was
+    found.
+ */
+int evbuffer_remove_cb_entry(struct evbuffer *buffer,
+			     struct evbuffer_cb_entry *ent);
+
+/** Remove a callback from an evbuffer, given the function and argument
+    used to add it.
+
+    @return 0 if a callback was removed, or -1 if no matching callback was
+    found.
+ */
+int evbuffer_remove_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg);
+
+/** If this flag is not set, then a callback is temporarily disabled, and
+ * should not be invoked.
+ *
+ * @see evbuffer_cb_set_flags(), evbuffer_cb_clear_flags()
+ */
+#define EVBUFFER_CB_ENABLED 1
+
+/** Change the flags that are set for a callback on a buffer by adding more.
+
+    @param buffer the evbuffer that the callback is watching.
+    @param cb the callback whose status we want to change.
+    @param flags EVBUFFER_CB_ENABLED to re-enable the callback.
+    @return 0 on success, -1 on failure.
+ */
+int evbuffer_cb_set_flags(struct evbuffer *buffer,
+			  struct evbuffer_cb_entry *cb, ev_uint32_t flags);
+
+/** Change the flags that are set for a callback on a buffer by removing some
+
+    @param buffer the evbuffer that the callback is watching.
+    @param cb the callback whose status we want to change.
+    @param flags EVBUFFER_CB_ENABLED to disable the callback.
+    @return 0 on success, -1 on failure.
+ */
+int evbuffer_cb_clear_flags(struct evbuffer *buffer,
+			  struct evbuffer_cb_entry *cb, ev_uint32_t flags);
+
+#if 0
+/** Postpone calling a given callback until unsuspend is called later.
+
+    This is different from disabling the callback, since the callback will get
+	invoked later if the buffer size changes between now and when we unsuspend
+	it.
+
+	@param the buffer that the callback is watching.
+	@param cb the callback we want to suspend.
+ */
+void evbuffer_cb_suspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
+/** Stop postponing a callback that we postponed with evbuffer_cb_suspend.
+
+	If data was added to or removed from the buffer while the callback was
+	suspended, the callback will get called once now.
+
+	@param the buffer that the callback is watching.
+	@param cb the callback we want to stop suspending.
+ */
+void evbuffer_cb_unsuspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
+#endif
+
+/**
+  Makes the data at the beginning of an evbuffer contiguous.
+
+  @param buf the evbuffer to make contiguous
+  @param size the number of bytes to make contiguous, or -1 to make the
+	entire buffer contiguous.
+  @return a pointer to the contiguous memory array
+*/
+
+unsigned char *evbuffer_pullup(struct evbuffer *buf, ev_ssize_t size);
+
+/**
+  Prepends data to the beginning of the evbuffer
+
+  @param buf the evbuffer to which to prepend data
+  @param data a pointer to the memory to prepend
+  @param size the number of bytes to prepend
+  @return 0 if successful, or -1 otherwise
+*/
+
+int evbuffer_prepend(struct evbuffer *buf, const void *data, size_t size);
+
+/**
+  Prepends all data from the src evbuffer to the beginning of the dst
+  evbuffer.
+
+  @param dst the evbuffer to which to prepend data
+  @param src the evbuffer to prepend; it will be emptied as a result
+  @return 0 if successful, or -1 otherwise
+*/
+int evbuffer_prepend_buffer(struct evbuffer *dst, struct evbuffer* src);
+
+/**
+   Prevent calls that modify an evbuffer from succeeding. A buffer may
+   frozen at the front, at the back, or at both the front and the back.
+
+   If the front of a buffer is frozen, operations that drain data from
+   the front of the buffer, or that prepend data to the buffer, will
+   fail until it is unfrozen.   If the back a buffer is frozen, operations
+   that append data from the buffer will fail until it is unfrozen.
+
+   @param buf The buffer to freeze
+   @param at_front If true, we freeze the front of the buffer.  If false,
+      we freeze the back.
+   @return 0 on success, -1 on failure.
+*/
+int evbuffer_freeze(struct evbuffer *buf, int at_front);
+/**
+   Re-enable calls that modify an evbuffer.
+
+   @param buf The buffer to un-freeze
+   @param at_front If true, we unfreeze the front of the buffer.  If false,
+      we unfreeze the back.
+   @return 0 on success, -1 on failure.
+ */
+int evbuffer_unfreeze(struct evbuffer *buf, int at_front);
+
+struct event_base;
+/**
+   Force all the callbacks on an evbuffer to be run, not immediately after
+   the evbuffer is altered, but instead from inside the event loop.
+
+   This can be used to serialize all the callbacks to a single thread
+   of execution.
+ */
+int evbuffer_defer_callbacks(struct evbuffer *buffer, struct event_base *base);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_BUFFER_H_ */

Property changes on: lab4/.minix-src/include/event2/buffer.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/archconst.h
===================================================================
--- lab4/.minix-src/include/i386/archconst.h	(nonexistent)
+++ lab4/.minix-src/include/i386/archconst.h	(revision 13)
@@ -0,0 +1,6 @@
+#ifndef _I386_CONST_H
+#define _I386_CONST_H
+
+#define DEFAULT_HZ        60	/* clock freq (software settable on IBM-PC) */
+
+#endif /* #ifndef _I386_CONST_H */

Property changes on: lab4/.minix-src/include/i386/archconst.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/pcireg.h
===================================================================
--- lab4/.minix-src/include/dev/pci/pcireg.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/pcireg.h	(revision 13)
@@ -0,0 +1,1832 @@
+/*	$NetBSD: pcireg.h,v 1.104 2015/10/02 05:22:53 msaitoh Exp $	*/
+
+/*
+ * Copyright (c) 1995, 1996, 1999, 2000
+ *     Christopher G. Demetriou.  All rights reserved.
+ * Copyright (c) 1994, 1996 Charles M. Hannum.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by Charles M. Hannum.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+#ifndef _DEV_PCI_PCIREG_H_
+#define	_DEV_PCI_PCIREG_H_
+
+/*
+ * Standardized PCI configuration information
+ *
+ * XXX This is not complete.
+ */
+
+/*
+ * Size of each function's configuration space.
+ */
+
+#define	PCI_CONF_SIZE			0x100
+#define	PCI_EXTCONF_SIZE		0x1000
+
+/*
+ * Device identification register; contains a vendor ID and a device ID.
+ */
+#define	PCI_ID_REG			0x00
+
+typedef u_int16_t pci_vendor_id_t;
+typedef u_int16_t pci_product_id_t;
+
+#define	PCI_VENDOR_SHIFT			0
+#define	PCI_VENDOR_MASK				0xffff
+#define	PCI_VENDOR(id) \
+	    (((id) >> PCI_VENDOR_SHIFT) & PCI_VENDOR_MASK)
+
+#define	PCI_PRODUCT_SHIFT			16
+#define	PCI_PRODUCT_MASK			0xffff
+#define	PCI_PRODUCT(id) \
+	    (((id) >> PCI_PRODUCT_SHIFT) & PCI_PRODUCT_MASK)
+
+#define PCI_ID_CODE(vid,pid)					\
+	((((vid) & PCI_VENDOR_MASK) << PCI_VENDOR_SHIFT) |	\
+	 (((pid) & PCI_PRODUCT_MASK) << PCI_PRODUCT_SHIFT))	\
+
+/*
+ * Command and status register.
+ */
+#define	PCI_COMMAND_STATUS_REG			0x04
+#define	PCI_COMMAND_SHIFT			0
+#define	PCI_COMMAND_MASK			0xffff
+#define	PCI_STATUS_SHIFT			16
+#define	PCI_STATUS_MASK				0xffff
+
+#define PCI_COMMAND_STATUS_CODE(cmd,stat)			\
+	((((cmd) & PCI_COMMAND_MASK) << PCI_COMMAND_SHIFT) |	\
+	 (((stat) & PCI_STATUS_MASK) << PCI_STATUS_SHIFT))	\
+
+#define	PCI_COMMAND_IO_ENABLE			0x00000001
+#define	PCI_COMMAND_MEM_ENABLE			0x00000002
+#define	PCI_COMMAND_MASTER_ENABLE		0x00000004
+#define	PCI_COMMAND_SPECIAL_ENABLE		0x00000008
+#define	PCI_COMMAND_INVALIDATE_ENABLE		0x00000010
+#define	PCI_COMMAND_PALETTE_ENABLE		0x00000020
+#define	PCI_COMMAND_PARITY_ENABLE		0x00000040
+#define	PCI_COMMAND_STEPPING_ENABLE		0x00000080
+#define	PCI_COMMAND_SERR_ENABLE			0x00000100
+#define	PCI_COMMAND_BACKTOBACK_ENABLE		0x00000200
+#define	PCI_COMMAND_INTERRUPT_DISABLE		0x00000400
+
+#define	PCI_STATUS_INT_STATUS			0x00080000
+#define	PCI_STATUS_CAPLIST_SUPPORT		0x00100000
+#define	PCI_STATUS_66MHZ_SUPPORT		0x00200000
+#define	PCI_STATUS_UDF_SUPPORT			0x00400000
+#define	PCI_STATUS_BACKTOBACK_SUPPORT		0x00800000
+#define	PCI_STATUS_PARITY_ERROR			0x01000000
+#define	PCI_STATUS_DEVSEL_FAST			0x00000000
+#define	PCI_STATUS_DEVSEL_MEDIUM		0x02000000
+#define	PCI_STATUS_DEVSEL_SLOW			0x04000000
+#define	PCI_STATUS_DEVSEL_MASK			0x06000000
+#define	PCI_STATUS_TARGET_TARGET_ABORT		0x08000000
+#define	PCI_STATUS_MASTER_TARGET_ABORT		0x10000000
+#define	PCI_STATUS_MASTER_ABORT			0x20000000
+#define	PCI_STATUS_SPECIAL_ERROR		0x40000000
+#define	PCI_STATUS_PARITY_DETECT		0x80000000
+
+/*
+ * PCI Class and Revision Register; defines type and revision of device.
+ */
+#define	PCI_CLASS_REG			0x08
+
+typedef u_int8_t pci_class_t;
+typedef u_int8_t pci_subclass_t;
+typedef u_int8_t pci_interface_t;
+typedef u_int8_t pci_revision_t;
+
+#define	PCI_CLASS_SHIFT				24
+#define	PCI_CLASS_MASK				0xff
+#define	PCI_CLASS(cr) \
+	    (((cr) >> PCI_CLASS_SHIFT) & PCI_CLASS_MASK)
+
+#define	PCI_SUBCLASS_SHIFT			16
+#define	PCI_SUBCLASS_MASK			0xff
+#define	PCI_SUBCLASS(cr) \
+	    (((cr) >> PCI_SUBCLASS_SHIFT) & PCI_SUBCLASS_MASK)
+
+#define	PCI_INTERFACE_SHIFT			8
+#define	PCI_INTERFACE_MASK			0xff
+#define	PCI_INTERFACE(cr) \
+	    (((cr) >> PCI_INTERFACE_SHIFT) & PCI_INTERFACE_MASK)
+
+#define	PCI_REVISION_SHIFT			0
+#define	PCI_REVISION_MASK			0xff
+#define	PCI_REVISION(cr) \
+	    (((cr) >> PCI_REVISION_SHIFT) & PCI_REVISION_MASK)
+
+#define	PCI_CLASS_CODE(mainclass, subclass, interface) \
+	    ((((mainclass) & PCI_CLASS_MASK) << PCI_CLASS_SHIFT) | \
+	     (((subclass) & PCI_SUBCLASS_MASK) << PCI_SUBCLASS_SHIFT) | \
+	     (((interface) & PCI_INTERFACE_MASK) << PCI_INTERFACE_SHIFT))
+
+/* base classes */
+#define	PCI_CLASS_PREHISTORIC			0x00
+#define	PCI_CLASS_MASS_STORAGE			0x01
+#define	PCI_CLASS_NETWORK			0x02
+#define	PCI_CLASS_DISPLAY			0x03
+#define	PCI_CLASS_MULTIMEDIA			0x04
+#define	PCI_CLASS_MEMORY			0x05
+#define	PCI_CLASS_BRIDGE			0x06
+#define	PCI_CLASS_COMMUNICATIONS		0x07
+#define	PCI_CLASS_SYSTEM			0x08
+#define	PCI_CLASS_INPUT				0x09
+#define	PCI_CLASS_DOCK				0x0a
+#define	PCI_CLASS_PROCESSOR			0x0b
+#define	PCI_CLASS_SERIALBUS			0x0c
+#define	PCI_CLASS_WIRELESS			0x0d
+#define	PCI_CLASS_I2O				0x0e
+#define	PCI_CLASS_SATCOM			0x0f
+#define	PCI_CLASS_CRYPTO			0x10
+#define	PCI_CLASS_DASP				0x11
+#define	PCI_CLASS_UNDEFINED			0xff
+
+/* 0x00 prehistoric subclasses */
+#define	PCI_SUBCLASS_PREHISTORIC_MISC		0x00
+#define	PCI_SUBCLASS_PREHISTORIC_VGA		0x01
+
+/* 0x01 mass storage subclasses */
+#define	PCI_SUBCLASS_MASS_STORAGE_SCSI		0x00
+#define	PCI_SUBCLASS_MASS_STORAGE_IDE		0x01
+#define	PCI_SUBCLASS_MASS_STORAGE_FLOPPY	0x02
+#define	PCI_SUBCLASS_MASS_STORAGE_IPI		0x03
+#define	PCI_SUBCLASS_MASS_STORAGE_RAID		0x04
+#define	PCI_SUBCLASS_MASS_STORAGE_ATA		0x05
+#define		PCI_INTERFACE_ATA_SINGLEDMA		0x20
+#define		PCI_INTERFACE_ATA_CHAINEDDMA		0x30
+#define	PCI_SUBCLASS_MASS_STORAGE_SATA		0x06
+#define		PCI_INTERFACE_SATA_VND			0x00
+#define		PCI_INTERFACE_SATA_AHCI10		0x01
+#define		PCI_INTERFACE_SATA_SSBI			0x02
+#define	PCI_SUBCLASS_MASS_STORAGE_SAS		0x07
+#define	PCI_SUBCLASS_MASS_STORAGE_NVM		0x08
+#define		PCI_INTERFACE_NVM_VND			0x00
+#define		PCI_INTERFACE_NVM_NVMHCI10		0x01
+#define		PCI_INTERFACE_NVM_NVME			0x02
+#define	PCI_SUBCLASS_MASS_STORAGE_MISC		0x80
+
+/* 0x02 network subclasses */
+#define	PCI_SUBCLASS_NETWORK_ETHERNET		0x00
+#define	PCI_SUBCLASS_NETWORK_TOKENRING		0x01
+#define	PCI_SUBCLASS_NETWORK_FDDI		0x02
+#define	PCI_SUBCLASS_NETWORK_ATM		0x03
+#define	PCI_SUBCLASS_NETWORK_ISDN		0x04
+#define	PCI_SUBCLASS_NETWORK_WORLDFIP		0x05
+#define	PCI_SUBCLASS_NETWORK_PCIMGMULTICOMP	0x06
+#define	PCI_SUBCLASS_NETWORK_INFINIBAND		0x07
+#define	PCI_SUBCLASS_NETWORK_MISC		0x80
+
+/* 0x03 display subclasses */
+#define	PCI_SUBCLASS_DISPLAY_VGA		0x00
+#define		PCI_INTERFACE_VGA_VGA			0x00
+#define		PCI_INTERFACE_VGA_8514			0x01
+#define	PCI_SUBCLASS_DISPLAY_XGA		0x01
+#define	PCI_SUBCLASS_DISPLAY_3D			0x02
+#define	PCI_SUBCLASS_DISPLAY_MISC		0x80
+
+/* 0x04 multimedia subclasses */
+#define	PCI_SUBCLASS_MULTIMEDIA_VIDEO		0x00
+#define	PCI_SUBCLASS_MULTIMEDIA_AUDIO		0x01
+#define	PCI_SUBCLASS_MULTIMEDIA_TELEPHONY	0x02
+#define	PCI_SUBCLASS_MULTIMEDIA_HDAUDIO		0x03
+#define	PCI_SUBCLASS_MULTIMEDIA_MISC		0x80
+
+/* 0x05 memory subclasses */
+#define	PCI_SUBCLASS_MEMORY_RAM			0x00
+#define	PCI_SUBCLASS_MEMORY_FLASH		0x01
+#define	PCI_SUBCLASS_MEMORY_MISC		0x80
+
+/* 0x06 bridge subclasses */
+#define	PCI_SUBCLASS_BRIDGE_HOST		0x00
+#define	PCI_SUBCLASS_BRIDGE_ISA			0x01
+#define	PCI_SUBCLASS_BRIDGE_EISA		0x02
+#define	PCI_SUBCLASS_BRIDGE_MC			0x03	/* XXX _MCA */
+#define	PCI_SUBCLASS_BRIDGE_PCI			0x04
+#define		PCI_INTERFACE_BRIDGE_PCI_PCI		0x00
+#define		PCI_INTERFACE_BRIDGE_PCI_SUBDEC		0x01
+#define	PCI_SUBCLASS_BRIDGE_PCMCIA		0x05
+#define	PCI_SUBCLASS_BRIDGE_NUBUS		0x06
+#define	PCI_SUBCLASS_BRIDGE_CARDBUS		0x07
+#define	PCI_SUBCLASS_BRIDGE_RACEWAY		0x08
+		/* bit0 == 0 ? "transparent mode" : "endpoint mode" */
+#define	PCI_SUBCLASS_BRIDGE_STPCI		0x09
+#define		PCI_INTERFACE_STPCI_PRIMARY		0x40
+#define		PCI_INTERFACE_STPCI_SECONDARY		0x80
+#define	PCI_SUBCLASS_BRIDGE_INFINIBAND		0x0a
+#define	PCI_SUBCLASS_BRIDGE_ADVSW		0x0b
+#define		PCI_INTERFACE_ADVSW_CUSTOM		0x00
+#define		PCI_INTERFACE_ADVSW_ASISIG		0x01
+#define	PCI_SUBCLASS_BRIDGE_MISC		0x80
+
+/* 0x07 communications subclasses */
+#define	PCI_SUBCLASS_COMMUNICATIONS_SERIAL	0x00
+#define		PCI_INTERFACE_SERIAL_XT			0x00
+#define		PCI_INTERFACE_SERIAL_16450		0x01
+#define		PCI_INTERFACE_SERIAL_16550		0x02
+#define		PCI_INTERFACE_SERIAL_16650		0x03
+#define		PCI_INTERFACE_SERIAL_16750		0x04
+#define		PCI_INTERFACE_SERIAL_16850		0x05
+#define		PCI_INTERFACE_SERIAL_16950		0x06
+#define	PCI_SUBCLASS_COMMUNICATIONS_PARALLEL	0x01
+#define		PCI_INTERFACE_PARALLEL			0x00
+#define		PCI_INTERFACE_PARALLEL_BIDIRECTIONAL	0x01
+#define		PCI_INTERFACE_PARALLEL_ECP1X		0x02
+#define		PCI_INTERFACE_PARALLEL_IEEE1284_CNTRL	0x03
+#define		PCI_INTERFACE_PARALLEL_IEEE1284_TGT	0xfe
+#define	PCI_SUBCLASS_COMMUNICATIONS_MPSERIAL	0x02
+#define	PCI_SUBCLASS_COMMUNICATIONS_MODEM	0x03
+#define		PCI_INTERFACE_MODEM			0x00
+#define		PCI_INTERFACE_MODEM_HAYES16450		0x01
+#define		PCI_INTERFACE_MODEM_HAYES16550		0x02
+#define		PCI_INTERFACE_MODEM_HAYES16650		0x03
+#define		PCI_INTERFACE_MODEM_HAYES16750		0x04
+#define	PCI_SUBCLASS_COMMUNICATIONS_GPIB	0x04
+#define	PCI_SUBCLASS_COMMUNICATIONS_SMARTCARD	0x05
+#define	PCI_SUBCLASS_COMMUNICATIONS_MISC	0x80
+
+/* 0x08 system subclasses */
+#define	PCI_SUBCLASS_SYSTEM_PIC			0x00
+#define		PCI_INTERFACE_PIC_8259			0x00
+#define		PCI_INTERFACE_PIC_ISA			0x01
+#define		PCI_INTERFACE_PIC_EISA			0x02
+#define		PCI_INTERFACE_PIC_IOAPIC		0x10
+#define		PCI_INTERFACE_PIC_IOXAPIC		0x20
+#define	PCI_SUBCLASS_SYSTEM_DMA			0x01
+#define		PCI_INTERFACE_DMA_8237			0x00
+#define		PCI_INTERFACE_DMA_ISA			0x01
+#define		PCI_INTERFACE_DMA_EISA			0x02
+#define	PCI_SUBCLASS_SYSTEM_TIMER		0x02
+#define		PCI_INTERFACE_TIMER_8254		0x00
+#define		PCI_INTERFACE_TIMER_ISA			0x01
+#define		PCI_INTERFACE_TIMER_EISA		0x02
+#define		PCI_INTERFACE_TIMER_HPET		0x03
+#define	PCI_SUBCLASS_SYSTEM_RTC			0x03
+#define		PCI_INTERFACE_RTC_GENERIC		0x00
+#define		PCI_INTERFACE_RTC_ISA			0x01
+#define	PCI_SUBCLASS_SYSTEM_PCIHOTPLUG		0x04
+#define	PCI_SUBCLASS_SYSTEM_SDHC		0x05
+#define	PCI_SUBCLASS_SYSTEM_IOMMU		0x06 /* or RCEC in old spec */
+#define	PCI_SUBCLASS_SYSTEM_RCEC		0x07
+#define	PCI_SUBCLASS_SYSTEM_MISC		0x80
+
+/* 0x09 input subclasses */
+#define	PCI_SUBCLASS_INPUT_KEYBOARD		0x00
+#define	PCI_SUBCLASS_INPUT_DIGITIZER		0x01
+#define	PCI_SUBCLASS_INPUT_MOUSE		0x02
+#define	PCI_SUBCLASS_INPUT_SCANNER		0x03
+#define	PCI_SUBCLASS_INPUT_GAMEPORT		0x04
+#define		PCI_INTERFACE_GAMEPORT_GENERIC		0x00
+#define		PCI_INTERFACE_GAMEPORT_LEGACY		0x10
+#define	PCI_SUBCLASS_INPUT_MISC			0x80
+
+/* 0x0a dock subclasses */
+#define	PCI_SUBCLASS_DOCK_GENERIC		0x00
+#define	PCI_SUBCLASS_DOCK_MISC			0x80
+
+/* 0x0b processor subclasses */
+#define	PCI_SUBCLASS_PROCESSOR_386		0x00
+#define	PCI_SUBCLASS_PROCESSOR_486		0x01
+#define	PCI_SUBCLASS_PROCESSOR_PENTIUM		0x02
+#define	PCI_SUBCLASS_PROCESSOR_ALPHA		0x10
+#define	PCI_SUBCLASS_PROCESSOR_POWERPC		0x20
+#define	PCI_SUBCLASS_PROCESSOR_MIPS		0x30
+#define	PCI_SUBCLASS_PROCESSOR_COPROC		0x40
+#define	PCI_SUBCLASS_PROCESSOR_MISC		0x80
+
+/* 0x0c serial bus subclasses */
+#define	PCI_SUBCLASS_SERIALBUS_FIREWIRE		0x00
+#define		PCI_INTERFACE_IEEE1394_FIREWIRE		0x00
+#define		PCI_INTERFACE_IEEE1394_OPENHCI		0x10
+#define	PCI_SUBCLASS_SERIALBUS_ACCESS		0x01
+#define	PCI_SUBCLASS_SERIALBUS_SSA		0x02
+#define	PCI_SUBCLASS_SERIALBUS_USB		0x03
+#define		PCI_INTERFACE_USB_UHCI			0x00
+#define		PCI_INTERFACE_USB_OHCI			0x10
+#define		PCI_INTERFACE_USB_EHCI			0x20
+#define		PCI_INTERFACE_USB_XHCI			0x30
+#define		PCI_INTERFACE_USB_OTHERHC		0x80
+#define		PCI_INTERFACE_USB_DEVICE		0xfe
+#define	PCI_SUBCLASS_SERIALBUS_FIBER		0x04	/* XXX _FIBRECHANNEL */
+#define	PCI_SUBCLASS_SERIALBUS_SMBUS		0x05
+#define	PCI_SUBCLASS_SERIALBUS_INFINIBAND	0x06	/* Deprecated */
+#define	PCI_SUBCLASS_SERIALBUS_IPMI		0x07
+#define		PCI_INTERFACE_IPMI_SMIC			0x00
+#define		PCI_INTERFACE_IPMI_KBD			0x01
+#define		PCI_INTERFACE_IPMI_BLOCKXFER		0x02
+#define	PCI_SUBCLASS_SERIALBUS_SERCOS		0x08
+#define	PCI_SUBCLASS_SERIALBUS_CANBUS		0x09
+#define	PCI_SUBCLASS_SERIALBUS_MISC		0x80
+
+/* 0x0d wireless subclasses */
+#define	PCI_SUBCLASS_WIRELESS_IRDA		0x00
+#define	PCI_SUBCLASS_WIRELESS_CONSUMERIR	0x01
+#define		PCI_INTERFACE_CONSUMERIR		0x00
+#define		PCI_INTERFACE_UWB			0x10
+#define	PCI_SUBCLASS_WIRELESS_RF		0x10
+#define	PCI_SUBCLASS_WIRELESS_BLUETOOTH		0x11
+#define	PCI_SUBCLASS_WIRELESS_BROADBAND		0x12
+#define	PCI_SUBCLASS_WIRELESS_802_11A		0x20
+#define	PCI_SUBCLASS_WIRELESS_802_11B		0x21
+#define	PCI_SUBCLASS_WIRELESS_MISC		0x80
+
+/* 0x0e I2O (Intelligent I/O) subclasses */
+#define	PCI_SUBCLASS_I2O_STANDARD		0x00
+#define		PCI_INTERFACE_I2O_FIFOAT40		0x00
+		/* others for I2O spec */
+#define	PCI_SUBCLASS_I2O_MISC			0x80
+
+/* 0x0f satellite communication subclasses */
+/*	PCI_SUBCLASS_SATCOM_???			0x00	/ * XXX ??? */
+#define	PCI_SUBCLASS_SATCOM_TV			0x01
+#define	PCI_SUBCLASS_SATCOM_AUDIO		0x02
+#define	PCI_SUBCLASS_SATCOM_VOICE		0x03
+#define	PCI_SUBCLASS_SATCOM_DATA		0x04
+#define	PCI_SUBCLASS_SATCOM_MISC		0x80
+
+/* 0x10 encryption/decryption subclasses */
+#define	PCI_SUBCLASS_CRYPTO_NETCOMP		0x00
+#define	PCI_SUBCLASS_CRYPTO_ENTERTAINMENT	0x10
+#define	PCI_SUBCLASS_CRYPTO_MISC		0x80
+
+/* 0x11 data acquisition and signal processing subclasses */
+#define	PCI_SUBCLASS_DASP_DPIO			0x00
+#define	PCI_SUBCLASS_DASP_TIMEFREQ		0x01 /* performance counters */
+#define	PCI_SUBCLASS_DASP_SYNC			0x10
+#define	PCI_SUBCLASS_DASP_MGMT			0x20
+#define	PCI_SUBCLASS_DASP_MISC			0x80
+
+/*
+ * PCI BIST/Header Type/Latency Timer/Cache Line Size Register.
+ */
+#define	PCI_BHLC_REG			0x0c
+
+#define	PCI_BIST_SHIFT				24
+#define	PCI_BIST_MASK				0xff
+#define	PCI_BIST(bhlcr) \
+	    (((bhlcr) >> PCI_BIST_SHIFT) & PCI_BIST_MASK)
+
+#define	PCI_HDRTYPE_SHIFT			16
+#define	PCI_HDRTYPE_MASK			0xff
+#define	PCI_HDRTYPE(bhlcr) \
+	    (((bhlcr) >> PCI_HDRTYPE_SHIFT) & PCI_HDRTYPE_MASK)
+
+#define	PCI_HDRTYPE_TYPE(bhlcr) \
+	    (PCI_HDRTYPE(bhlcr) & 0x7f)
+#define	PCI_HDRTYPE_MULTIFN(bhlcr) \
+	    ((PCI_HDRTYPE(bhlcr) & 0x80) != 0)
+
+#define	PCI_LATTIMER_SHIFT			8
+#define	PCI_LATTIMER_MASK			0xff
+#define	PCI_LATTIMER(bhlcr) \
+	    (((bhlcr) >> PCI_LATTIMER_SHIFT) & PCI_LATTIMER_MASK)
+
+#define	PCI_CACHELINE_SHIFT			0
+#define	PCI_CACHELINE_MASK			0xff
+#define	PCI_CACHELINE(bhlcr) \
+	    (((bhlcr) >> PCI_CACHELINE_SHIFT) & PCI_CACHELINE_MASK)
+
+#define PCI_BHLC_CODE(bist,type,multi,latency,cacheline)		\
+	    ((((bist) & PCI_BIST_MASK) << PCI_BIST_SHIFT) |		\
+	     (((type) & PCI_HDRTYPE_MASK) << PCI_HDRTYPE_SHIFT) |	\
+	     (((multi)?0x80:0) << PCI_HDRTYPE_SHIFT) |			\
+	     (((latency) & PCI_LATTIMER_MASK) << PCI_LATTIMER_SHIFT) |	\
+	     (((cacheline) & PCI_CACHELINE_MASK) << PCI_CACHELINE_SHIFT))
+
+/*
+ * PCI header type
+ */
+#define PCI_HDRTYPE_DEVICE	0	/* PCI/PCIX/Cardbus */
+#define PCI_HDRTYPE_PPB		1	/* PCI/PCIX/Cardbus */
+#define PCI_HDRTYPE_PCB		2	/* PCI/PCIX/Cardbus */
+#define PCI_HDRTYPE_EP		0	/* PCI Express */
+#define PCI_HDRTYPE_RC		1	/* PCI Express */
+
+
+/*
+ * Mapping registers
+ */
+#define	PCI_MAPREG_START		0x10
+#define	PCI_MAPREG_END			0x28
+#define	PCI_MAPREG_ROM			0x30
+#define	PCI_MAPREG_PPB_END		0x18
+#define	PCI_MAPREG_PCB_END		0x14
+
+#define PCI_BAR0		0x10
+#define PCI_BAR1		0x14
+#define PCI_BAR2		0x18
+#define PCI_BAR3		0x1C
+#define PCI_BAR4		0x20
+#define PCI_BAR5		0x24
+
+#define	PCI_BAR(__n)		(PCI_MAPREG_START + 4 * (__n))
+
+#define	PCI_MAPREG_TYPE(mr)						\
+	    ((mr) & PCI_MAPREG_TYPE_MASK)
+#define	PCI_MAPREG_TYPE_MASK			0x00000001
+
+#define	PCI_MAPREG_TYPE_MEM			0x00000000
+#define	PCI_MAPREG_TYPE_ROM			0x00000000
+#define	PCI_MAPREG_TYPE_IO			0x00000001
+#define	PCI_MAPREG_ROM_ENABLE			0x00000001
+
+#define	PCI_MAPREG_MEM_TYPE(mr)						\
+	    ((mr) & PCI_MAPREG_MEM_TYPE_MASK)
+#define	PCI_MAPREG_MEM_TYPE_MASK		0x00000006
+
+#define	PCI_MAPREG_MEM_TYPE_32BIT		0x00000000
+#define	PCI_MAPREG_MEM_TYPE_32BIT_1M		0x00000002
+#define	PCI_MAPREG_MEM_TYPE_64BIT		0x00000004
+
+#define	PCI_MAPREG_MEM_PREFETCHABLE(mr)				\
+	    (((mr) & PCI_MAPREG_MEM_PREFETCHABLE_MASK) != 0)
+#define	PCI_MAPREG_MEM_PREFETCHABLE_MASK	0x00000008
+
+#define	PCI_MAPREG_MEM_ADDR(mr)						\
+	    ((mr) & PCI_MAPREG_MEM_ADDR_MASK)
+#define	PCI_MAPREG_MEM_SIZE(mr)						\
+	    (PCI_MAPREG_MEM_ADDR(mr) & -PCI_MAPREG_MEM_ADDR(mr))
+#define	PCI_MAPREG_MEM_ADDR_MASK		0xfffffff0
+
+#define	PCI_MAPREG_MEM64_ADDR(mr)					\
+	    ((mr) & PCI_MAPREG_MEM64_ADDR_MASK)
+#define	PCI_MAPREG_MEM64_SIZE(mr)					\
+	    (PCI_MAPREG_MEM64_ADDR(mr) & -PCI_MAPREG_MEM64_ADDR(mr))
+#define	PCI_MAPREG_MEM64_ADDR_MASK		0xfffffffffffffff0ULL
+
+#define	PCI_MAPREG_IO_ADDR(mr)						\
+	    ((mr) & PCI_MAPREG_IO_ADDR_MASK)
+#define	PCI_MAPREG_IO_SIZE(mr)						\
+	    (PCI_MAPREG_IO_ADDR(mr) & -PCI_MAPREG_IO_ADDR(mr))
+#define	PCI_MAPREG_IO_ADDR_MASK			0xfffffffc
+
+#define PCI_MAPREG_SIZE_TO_MASK(size)					\
+	    (-(size))
+
+#define PCI_MAPREG_NUM(offset)						\
+	    (((unsigned)(offset)-PCI_MAPREG_START)/4)
+
+
+/*
+ * Cardbus CIS pointer (PCI rev. 2.1)
+ */
+#define PCI_CARDBUS_CIS_REG 0x28
+
+/*
+ * Subsystem identification register; contains a vendor ID and a device ID.
+ * Types/macros for PCI_ID_REG apply.
+ * (PCI rev. 2.1)
+ */
+#define PCI_SUBSYS_ID_REG 0x2c
+
+#define	PCI_SUBSYS_VENDOR_MASK	__BITS(15, 0)
+#define	PCI_SUBSYS_ID_MASK		__BITS(31, 16)
+
+#define	PCI_SUBSYS_VENDOR(__subsys_id)	\
+    __SHIFTOUT(__subsys_id, PCI_SUBSYS_VENDOR_MASK)
+
+#define	PCI_SUBSYS_ID(__subsys_id)	\
+    __SHIFTOUT(__subsys_id, PCI_SUBSYS_ID_MASK)
+
+/*
+ * Capabilities link list (PCI rev. 2.2)
+ */
+#define	PCI_CAPLISTPTR_REG		0x34	/* header type 0 */
+#define	PCI_CARDBUS_CAPLISTPTR_REG	0x14	/* header type 2 */
+#define	PCI_CAPLIST_PTR(cpr)	((cpr) & 0xff)
+#define	PCI_CAPLIST_NEXT(cr)	(((cr) >> 8) & 0xff)
+#define	PCI_CAPLIST_CAP(cr)	((cr) & 0xff)
+
+#define	PCI_CAP_RESERVED0	0x00
+#define	PCI_CAP_PWRMGMT		0x01
+#define	PCI_CAP_AGP		0x02
+#define PCI_CAP_AGP_MAJOR(cr)	(((cr) >> 20) & 0xf)
+#define PCI_CAP_AGP_MINOR(cr)	(((cr) >> 16) & 0xf)
+#define	PCI_CAP_VPD		0x03
+#define	PCI_CAP_SLOTID		0x04
+#define	PCI_CAP_MSI		0x05
+#define	PCI_CAP_CPCI_HOTSWAP	0x06
+#define	PCI_CAP_PCIX		0x07
+#define	PCI_CAP_LDT		0x08	/* HyperTransport */
+#define	PCI_CAP_VENDSPEC	0x09
+#define	PCI_CAP_DEBUGPORT	0x0a
+#define	PCI_CAP_CPCI_RSRCCTL	0x0b
+#define	PCI_CAP_HOTPLUG		0x0c
+#define	PCI_CAP_SUBVENDOR	0x0d
+#define	PCI_CAP_AGP8		0x0e
+#define	PCI_CAP_SECURE		0x0f
+#define	PCI_CAP_PCIEXPRESS     	0x10
+#define	PCI_CAP_MSIX		0x11
+#define	PCI_CAP_SATA		0x12
+#define	PCI_CAP_PCIAF		0x13
+
+/*
+ * Capability ID: 0x01
+ * Power Management Capability; access via capability pointer.
+ */
+
+/* Power Management Capability Register */
+#define PCI_PMCR_SHIFT		16
+#define PCI_PMCR		0x02
+#define PCI_PMCR_VERSION_MASK	0x0007
+#define PCI_PMCR_VERSION_10	0x0001
+#define PCI_PMCR_VERSION_11	0x0002
+#define PCI_PMCR_VERSION_12	0x0003
+#define PCI_PMCR_PME_CLOCK	0x0008
+#define PCI_PMCR_DSI		0x0020
+#define PCI_PMCR_AUXCUR_MASK	0x01c0
+#define PCI_PMCR_AUXCUR_0	0x0000
+#define PCI_PMCR_AUXCUR_55	0x0040
+#define PCI_PMCR_AUXCUR_100	0x0080
+#define PCI_PMCR_AUXCUR_160	0x00c0
+#define PCI_PMCR_AUXCUR_220	0x0100
+#define PCI_PMCR_AUXCUR_270	0x0140
+#define PCI_PMCR_AUXCUR_320	0x0180
+#define PCI_PMCR_AUXCUR_375	0x01c0
+#define PCI_PMCR_D1SUPP		0x0200
+#define PCI_PMCR_D2SUPP		0x0400
+#define PCI_PMCR_PME_D0		0x0800
+#define PCI_PMCR_PME_D1		0x1000
+#define PCI_PMCR_PME_D2		0x2000
+#define PCI_PMCR_PME_D3HOT	0x4000
+#define PCI_PMCR_PME_D3COLD	0x8000
+/*
+ * Power Management Control Status Register, Bridge Support Extensions Register
+ * and Data Register.
+ */
+#define PCI_PMCSR		0x04
+#define PCI_PMCSR_STATE_MASK	0x00000003
+#define PCI_PMCSR_STATE_D0	0x00000000
+#define PCI_PMCSR_STATE_D1	0x00000001
+#define PCI_PMCSR_STATE_D2	0x00000002
+#define PCI_PMCSR_STATE_D3	0x00000003
+#define PCI_PMCSR_NO_SOFTRST	0x00000008
+#define	PCI_PMCSR_PME_EN	0x00000100
+#define PCI_PMCSR_DATASEL_MASK	0x00001e00
+#define PCI_PMCSR_DATASCL_MASK	0x00006000
+#define PCI_PMCSR_PME_STS	0x00008000
+#define PCI_PMCSR_B2B3_SUPPORT	0x00400000
+#define PCI_PMCSR_BPCC_EN	0x00800000
+
+
+/*
+ * Capability ID: 0x02
+ * AGP
+ */
+
+/*
+ * Capability ID: 0x03
+ * Vital Product Data; access via capability pointer (PCI rev 2.2).
+ */
+#define	PCI_VPD_ADDRESS_MASK	0x7fff
+#define	PCI_VPD_ADDRESS_SHIFT	16
+#define	PCI_VPD_ADDRESS(ofs)	\
+	(((ofs) & PCI_VPD_ADDRESS_MASK) << PCI_VPD_ADDRESS_SHIFT)
+#define	PCI_VPD_DATAREG(ofs)	((ofs) + 4)
+#define	PCI_VPD_OPFLAG		0x80000000
+
+/*
+ * Capability ID: 0x04
+ * Slot ID
+ */
+
+/*
+ * Capability ID: 0x05
+ * MSI
+ */
+
+#define	PCI_MSI_CTL		0x0	/* Message Control Register offset */
+#define	PCI_MSI_MADDR		0x4	/* Message Address Register (least
+					 * significant bits) offset
+					 */
+#define	PCI_MSI_MADDR64_LO	0x4	/* 64-bit Message Address Register
+					 * (least significant bits) offset
+					 */
+#define	PCI_MSI_MADDR64_HI	0x8	/* 64-bit Message Address Register
+					 * (most significant bits) offset
+					 */
+#define	PCI_MSI_MDATA		0x8	/* Message Data Register offset */
+#define	PCI_MSI_MDATA64		0xC	/* 64-bit Message Data Register
+					 * offset
+					 */
+#define	PCI_MSI_MASK		0x10	/* Vector Mask register */
+#define	PCI_MSI_PENDING		0x14	/* Vector Pending register */
+
+#define	PCI_MSI_CTL_MASK	__BITS(31, 16)
+#define	PCI_MSI_CTL_PERVEC_MASK	__SHIFTIN(__BIT(8), PCI_MSI_CTL_MASK)
+#define	PCI_MSI_CTL_64BIT_ADDR	__SHIFTIN(__BIT(7), PCI_MSI_CTL_MASK)
+#define	PCI_MSI_CTL_MME_MASK	__SHIFTIN(__BITS(6, 4), PCI_MSI_CTL_MASK)
+#define	PCI_MSI_CTL_MME(reg)	__SHIFTOUT(reg, PCI_MSI_CTL_MME_MASK)
+#define	PCI_MSI_CTL_MMC_MASK	__SHIFTIN(__BITS(3, 1), PCI_MSI_CTL_MASK)
+#define	PCI_MSI_CTL_MMC(reg)	__SHIFTOUT(reg, PCI_MSI_CTL_MMC_MASK)
+#define	PCI_MSI_CTL_MSI_ENABLE	__SHIFTIN(__BIT(0), PCI_MSI_CTL_MASK)
+
+/*
+ * MSI Message Address is at offset 4.
+ * MSI Message Upper Address (if 64bit) is at offset 8.
+ * MSI Message data is at offset 8 or 12 and is 16 bits.
+ * [16 bit reserved field]
+ * MSI Mask Bits (32 bit field)
+ * MSI Pending Bits (32 bit field)
+ */
+
+ /* Max number of MSI vectors. See PCI-SIG specification. */
+#define	PCI_MSI_MAX_VECTORS	32
+
+/*
+ * Capability ID: 0x07
+ * PCI-X capability.
+ *
+ * PCI-X capability register has two different layouts. One is for bridge
+ * function. Another is for non-bridge functions.
+ */
+
+
+/* For non-bridge functions */
+
+/*
+ * Command. 16 bits at offset 2 (e.g. upper 16 bits of the first 32-bit
+ * word at the capability; the lower 16 bits are the capability ID and
+ * next capability pointer).
+ *
+ * Since we always read PCI config space in 32-bit words, we define these
+ * as 32-bit values, offset and shifted appropriately.  Make sure you perform
+ * the appropriate R/M/W cycles!
+ */
+#define PCIX_CMD		0x00
+#define PCIX_CMD_PERR_RECOVER	0x00010000
+#define PCIX_CMD_RELAXED_ORDER	0x00020000
+#define PCIX_CMD_BYTECNT_MASK	0x000c0000
+#define	PCIX_CMD_BYTECNT_SHIFT	18
+#define	PCIX_CMD_BYTECNT(reg)	\
+	(512 << (((reg) & PCIX_CMD_BYTECNT_MASK) >> PCIX_CMD_BYTECNT_SHIFT))
+#define		PCIX_CMD_BCNT_512	0x00000000
+#define		PCIX_CMD_BCNT_1024	0x00040000
+#define		PCIX_CMD_BCNT_2048	0x00080000
+#define		PCIX_CMD_BCNT_4096	0x000c0000
+#define PCIX_CMD_SPLTRANS_MASK	0x00700000
+#define	PCIX_CMD_SPLTRANS_SHIFT	20
+#define		PCIX_CMD_SPLTRANS_1	0x00000000
+#define		PCIX_CMD_SPLTRANS_2	0x00100000
+#define		PCIX_CMD_SPLTRANS_3	0x00200000
+#define		PCIX_CMD_SPLTRANS_4	0x00300000
+#define		PCIX_CMD_SPLTRANS_8	0x00400000
+#define		PCIX_CMD_SPLTRANS_12	0x00500000
+#define		PCIX_CMD_SPLTRANS_16	0x00600000
+#define		PCIX_CMD_SPLTRANS_32	0x00700000
+
+/*
+ * Status. 32 bits at offset 4.
+ */
+#define PCIX_STATUS		0x04
+#define PCIX_STATUS_FN_MASK	0x00000007
+#define PCIX_STATUS_DEV_MASK	0x000000f8
+#define PCIX_STATUS_DEV_SHIFT	3
+#define PCIX_STATUS_BUS_MASK	0x0000ff00
+#define PCIX_STATUS_BUS_SHIFT	8
+#define PCIX_STATUS_FN(val)	((val) & PCIX_STATUS_FN_MASK)
+#define PCIX_STATUS_DEV(val)	\
+	(((val) & PCIX_STATUS_DEV_MASK) >> PCIX_STATUS_DEV_SHIFT)
+#define PCIX_STATUS_BUS(val)	\
+	(((val) & PCIX_STATUS_BUS_MASK) >> PCIX_STATUS_BUS_SHIFT)
+#define PCIX_STATUS_64BIT	0x00010000	/* 64bit device */
+#define PCIX_STATUS_133		0x00020000	/* 133MHz capable */
+#define PCIX_STATUS_SPLDISC	0x00040000	/* Split completion discarded*/
+#define PCIX_STATUS_SPLUNEX	0x00080000	/* Unexpected split complet. */
+#define PCIX_STATUS_DEVCPLX	0x00100000	/* Device Complexity */
+#define PCIX_STATUS_MAXB_MASK	0x00600000	/* MAX memory read Byte count*/
+#define	PCIX_STATUS_MAXB_SHIFT	21
+#define		PCIX_STATUS_MAXB_512	0x00000000
+#define		PCIX_STATUS_MAXB_1024	0x00200000
+#define		PCIX_STATUS_MAXB_2048	0x00400000
+#define		PCIX_STATUS_MAXB_4096	0x00600000
+#define PCIX_STATUS_MAXST_MASK	0x03800000	/* MAX outstand. Split Trans.*/
+#define	PCIX_STATUS_MAXST_SHIFT	23
+#define		PCIX_STATUS_MAXST_1	0x00000000
+#define		PCIX_STATUS_MAXST_2	0x00800000
+#define		PCIX_STATUS_MAXST_3	0x01000000
+#define		PCIX_STATUS_MAXST_4	0x01800000
+#define		PCIX_STATUS_MAXST_8	0x02000000
+#define		PCIX_STATUS_MAXST_12	0x02800000
+#define		PCIX_STATUS_MAXST_16	0x03000000
+#define		PCIX_STATUS_MAXST_32	0x03800000
+#define PCIX_STATUS_MAXRS_MASK	0x1c000000	/* MAX cumulative Read Size */
+#define PCIX_STATUS_MAXRS_SHIFT	26
+#define		PCIX_STATUS_MAXRS_1K	0x00000000
+#define		PCIX_STATUS_MAXRS_2K	0x04000000
+#define		PCIX_STATUS_MAXRS_4K	0x08000000
+#define		PCIX_STATUS_MAXRS_8K	0x0c000000
+#define		PCIX_STATUS_MAXRS_16K	0x10000000
+#define		PCIX_STATUS_MAXRS_32K	0x14000000
+#define		PCIX_STATUS_MAXRS_64K	0x18000000
+#define		PCIX_STATUS_MAXRS_128K	0x1c000000
+#define PCIX_STATUS_SCERR	0x20000000	/* rcv. Split Completion ERR.*/
+#define PCIX_STATUS_266		0x40000000	/* 266MHz capable */
+#define PCIX_STATUS_533		0x80000000	/* 533MHz capable */
+
+/* For bridge function */
+
+#define PCIX_BRIDGE_2ND_STATUS	0x00
+#define PCIX_BRIDGE_ST_64BIT	0x00010000	/* Same as PCIX_STATUS (nonb)*/
+#define PCIX_BRIDGE_ST_133	0x00020000	/* Same as PCIX_STATUS (nonb)*/
+#define PCIX_BRIDGE_ST_SPLDISC	0x00040000	/* Same as PCIX_STATUS (nonb)*/
+#define PCIX_BRIDGE_ST_SPLUNEX	0x00080000	/* Same as PCIX_STATUS (nonb)*/
+#define PCIX_BRIDGE_ST_SPLOVRN	0x00100000	/* Split completion overrun */
+#define PCIX_BRIDGE_ST_SPLRQDL	0x00200000	/* Split request delayed */
+#define PCIX_BRIDGE_2NDST_CLKF	0x03c00000	/* Secondary clock frequency */
+#define PCIX_BRIDGE_2NDST_CLKF_SHIFT 22
+#define PCIX_BRIDGE_2NDST_VER_MASK 0x30000000	/* Version */
+#define PCIX_BRIDGE_2NDST_VER_SHIFT 28
+#define PCIX_BRIDGE_ST_266	0x40000000	/* Same as PCIX_STATUS (nonb)*/
+#define PCIX_BRIDGE_ST_533	0x80000000	/* Same as PCIX_STATUS (nonb)*/
+
+#define PCIX_BRIDGE_PRI_STATUS	0x04
+/* Bit 0 to 15 are the same as PCIX_STATUS */
+/* Bit 16 to 21 are the same as PCIX_BRIDGE_2ND_STATUS */
+/* Bit 30 and 31 are the same as PCIX_BRIDGE_2ND_STATUS */
+
+#define PCIX_BRIDGE_UP_STCR	0x08 /* Upstream Split Transaction Control */
+#define PCIX_BRIDGE_DOWN_STCR	0x0c /* Downstream Split Transaction Control */
+/* The layouts of above two registers are the same */
+#define PCIX_BRIDGE_STCAP	0x0000ffff	/* Sp. Tr. Capacity */
+#define PCIX_BRIDGE_STCLIM	0xffff0000	/* Sp. Tr. Commitment Limit */
+#define PCIX_BRIDGE_STCLIM_SHIFT 16
+
+/*
+ * Capability ID: 0x08
+ * HyperTransport
+ */
+
+#define PCI_HT_CMD	0x00	/* Capability List & Command Register */
+#define	PCI_HT_CMD_MASK		__BITS(31, 16)
+#define PCI_HT_MSI_ENABLED	__BIT(16)
+#define PCI_HT_MSI_FIXED	__BIT(17)
+#define PCI_HT_CAP(cr) ((((cr) >> 27) < 0x08) ?				      \
+    (((cr) >> 27) & 0x1c) : (((cr) >> 27) & 0x1f))
+#define PCI_HT_CAPMASK		__BITS(31, 27)
+#define PCI_HT_CAP_SLAVE	__SHIFTIN(0b00000, PCI_HT_CAPMASK) /* 000xx */
+#define PCI_HT_CAP_HOST		__SHIFTIN(0b00100, PCI_HT_CAPMASK) /* 001xx */
+#define PCI_HT_CAP_SWITCH	__SHIFTIN(0b01000, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_INTERRUPT	__SHIFTIN(0b10000, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_REVID	__SHIFTIN(0b10001, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_UNITID_CLUMP	__SHIFTIN(0b10010, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_EXTCNFSPACE	__SHIFTIN(0b10011, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_ADDRMAP	__SHIFTIN(0b10100, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_MSIMAP	__SHIFTIN(0b10101, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_DIRECTROUTE	__SHIFTIN(0b10110, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_VCSET	__SHIFTIN(0b10111, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_RETRYMODE	__SHIFTIN(0b11000, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_X86ENCODE	__SHIFTIN(0b11001, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_GEN3		__SHIFTIN(0b11010, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_FLE		__SHIFTIN(0b11011, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_PM		__SHIFTIN(0b11100, PCI_HT_CAPMASK)
+#define PCI_HT_CAP_HIGHNODECNT	__SHIFTIN(0b11101, PCI_HT_CAPMASK)
+
+#define PCI_HT_MSI_ADDR_LO	0x04
+#define PCI_HT_MSI_ADDR_HI	0x08
+#define PCI_HT_MSI_FIXED_ADDR	0xfee00000UL
+
+/*
+ * Capability ID: 0x09
+ * Vendor Specific
+ */
+#define PCI_VENDORSPECIFIC_SHIFT	16
+#define PCI_VENDORSPECIFIC		0x02
+
+/*
+ * Capability ID: 0x0a
+ * Debug Port
+ */
+#define PCI_DEBUG_BASER		0x00	/* Debug Base Register */
+#define PCI_DEBUG_BASER_SHIFT	16
+#define PCI_DEBUG_PORTOFF_SHIFT	16
+#define	PCI_DEBUG_PORTOFF_MASK	0x1fff0000	/* Debug port offset */
+#define PCI_DEBUG_BARNUM_SHIFT	29
+#define	PCI_DEBUG_BARNUM_MASK	0xe0000000	/* BAR number */
+
+/*
+ * Capability ID: 0x0b
+ * Compact PCI
+ */
+
+/*
+ * Capability ID: 0x0c
+ * Hotplug
+ */
+
+/*
+ * Capability ID: 0x0d
+ * Subsystem
+ */
+#define PCI_CAP_SUBSYS_ID 0x04
+/* bit field layout is the same as PCI_SUBSYS_ID_REG's one */
+
+/*
+ * Capability ID: 0x0e
+ * AGP8
+ */
+
+/*
+ * Capability ID: 0x0f
+ * Secure
+ */
+
+/*
+ * Capability ID: 0x10
+ * PCI Express; access via capability pointer.
+ */
+#define PCIE_XCAP	0x00	/* Capability List & Capabilities Register */
+#define	PCIE_XCAP_MASK		__BITS(31, 16)
+/* Capability Version */
+#define PCIE_XCAP_VER_MASK	__SHIFTIN(__BITS(3, 0), PCIE_XCAP_MASK)
+#define	 PCIE_XCAP_VER_1	__SHIFTIN(1, PCIE_XCAP_VER_MASK)
+#define	 PCIE_XCAP_VER_2	__SHIFTIN(2, PCIE_XCAP_VER_MASK)
+#define	PCIE_XCAP_TYPE_MASK	__SHIFTIN(__BITS(7, 4), PCIE_XCAP_MASK)
+#define	 PCIE_XCAP_TYPE_PCIE_DEV __SHIFTIN(0x0, PCIE_XCAP_TYPE_MASK)
+#define	 PCIE_XCAP_TYPE_PCI_DEV	__SHIFTIN(0x1, PCIE_XCAP_TYPE_MASK)
+#define	 PCIE_XCAP_TYPE_ROOT	__SHIFTIN(0x4, PCIE_XCAP_TYPE_MASK)
+#define	 PCIE_XCAP_TYPE_UP	__SHIFTIN(0x5, PCIE_XCAP_TYPE_MASK)
+#define	 PCIE_XCAP_TYPE_DOWN	__SHIFTIN(0x6, PCIE_XCAP_TYPE_MASK)
+#define	 PCIE_XCAP_TYPE_PCIE2PCI __SHIFTIN(0x7, PCIE_XCAP_TYPE_MASK)
+#define	 PCIE_XCAP_TYPE_PCI2PCIE __SHIFTIN(0x8, PCIE_XCAP_TYPE_MASK)
+#define	 PCIE_XCAP_TYPE_ROOT_INTEP __SHIFTIN(0x9, PCIE_XCAP_TYPE_MASK)
+#define	 PCIE_XCAP_TYPE_ROOT_EVNTC __SHIFTIN(0xa, PCIE_XCAP_TYPE_MASK)
+#define PCIE_XCAP_SI		__SHIFTIN(__BIT(8), PCIE_XCAP_MASK) /* Slot Implemented */
+#define PCIE_XCAP_IRQ		__SHIFTIN(__BITS(13, 9), PCIE_XCAP_MASK)
+#define PCIE_DCAP	0x04	/* Device Capabilities Register */
+#define PCIE_DCAP_MAX_PAYLOAD	__BITS(2, 0)   /* Max Payload Size Supported */
+#define PCIE_DCAP_PHANTOM_FUNCS	__BITS(4, 3)   /* Phantom Functions Supported*/
+#define PCIE_DCAP_EXT_TAG_FIELD	__BIT(5)       /* Extended Tag Field Support */
+#define PCIE_DCAP_L0S_LATENCY	__BITS(8, 6)   /* Endpoint L0 Accptbl Latency*/
+#define PCIE_DCAP_L1_LATENCY	__BITS(11, 9)  /* Endpoint L1 Accptbl Latency*/
+#define PCIE_DCAP_ATTN_BUTTON	__BIT(12)      /* Attention Indicator Button */
+#define PCIE_DCAP_ATTN_IND	__BIT(13)      /* Attention Indicator Present*/
+#define PCIE_DCAP_PWR_IND	__BIT(14)      /* Power Indicator Present */
+#define PCIE_DCAP_ROLE_ERR_RPT	__BIT(15)      /* Role-Based Error Reporting */
+#define PCIE_DCAP_SLOT_PWR_LIM_VAL __BITS(25, 18) /* Cap. Slot PWR Limit Val */
+#define PCIE_DCAP_SLOT_PWR_LIM_SCALE __BITS(27, 26) /* Cap. SlotPWRLimit Scl */
+#define PCIE_DCAP_FLR		__BIT(28)      /* Function-Level Reset Cap. */
+#define PCIE_DCSR	0x08	/* Device Control & Status Register */
+#define PCIE_DCSR_ENA_COR_ERR	__BIT(0)       /* Correctable Error Report En*/
+#define PCIE_DCSR_ENA_NFER	__BIT(1)       /* Non-Fatal Error Report En. */
+#define PCIE_DCSR_ENA_FER	__BIT(2)       /* Fatal Error Reporting Enabl*/
+#define PCIE_DCSR_ENA_URR	__BIT(3)       /* Unsupported Request Rpt En */
+#define PCIE_DCSR_ENA_RELAX_ORD	__BIT(4)       /* Enable Relaxed Ordering */
+#define PCIE_DCSR_MAX_PAYLOAD	__BITS(7, 5)   /* Max Payload Size */
+#define PCIE_DCSR_EXT_TAG_FIELD	__BIT(8)       /* Extended Tag Field Enable */
+#define PCIE_DCSR_PHANTOM_FUNCS	__BIT(9)       /* Phantom Functions Enable */
+#define PCIE_DCSR_AUX_POWER_PM	__BIT(10)      /* Aux Power PM Enable */
+#define PCIE_DCSR_ENA_NO_SNOOP	__BIT(11)      /* Enable No Snoop */
+#define PCIE_DCSR_MAX_READ_REQ	__BITS(14, 12) /* Max Read Request Size */
+#define PCIE_DCSR_BRDG_CFG_RETRY __BIT(15)     /* Bridge Config Retry Enable */
+#define PCIE_DCSR_INITIATE_FLR	__BIT(15)      /* Initiate Function-Level Rst*/
+#define PCIE_DCSR_CED		__BIT(0 + 16)  /* Correctable Error Detected */
+#define PCIE_DCSR_NFED		__BIT(1 + 16)  /* Non-Fatal Error Detected */
+#define PCIE_DCSR_FED		__BIT(2 + 16)  /* Fatal Error Detected */
+#define PCIE_DCSR_URD		__BIT(3 + 16)  /* Unsupported Req. Detected */
+#define PCIE_DCSR_AUX_PWR	__BIT(4 + 16)  /* Aux Power Detected */
+#define PCIE_DCSR_TRANSACTION_PND __BIT(5 + 16) /* Transaction Pending */
+#define PCIE_LCAP	0x0c	/* Link Capabilities Register */
+#define PCIE_LCAP_MAX_SPEED	__BITS(3, 0)   /* Max Link Speed */
+#define PCIE_LCAP_MAX_WIDTH	__BITS(9, 4)   /* Maximum Link Width */
+#define PCIE_LCAP_ASPM		__BITS(11, 10) /* Active State Link PM Supp. */
+#define PCIE_LCAP_L0S_EXIT	__BITS(14, 12) /* L0s Exit Latency */
+#define PCIE_LCAP_L1_EXIT	__BITS(17, 15) /* L1 Exit Latency */
+#define PCIE_LCAP_CLOCK_PM	__BIT(18)      /* Clock Power Management */
+#define PCIE_LCAP_SURPRISE_DOWN	__BIT(19)      /* Surprise Down Err Rpt Cap. */
+#define PCIE_LCAP_DL_ACTIVE	__BIT(20)      /* Data Link Layer Link Active*/
+#define PCIE_LCAP_LINK_BW_NOTIFY __BIT(21)     /* Link BW Notification Capabl*/
+#define PCIE_LCAP_ASPM_COMPLIANCE __BIT(22)    /* ASPM Optionally Compliance */
+#define PCIE_LCAP_PORT		__BITS(31, 24) /* Port Number */
+#define PCIE_LCSR	0x10	/* Link Control & Status Register */
+#define PCIE_LCSR_ASPM_L0S	__BIT(0)       /* Active State PM Control L0s*/
+#define PCIE_LCSR_ASPM_L1	__BIT(1)       /* Active State PM Control L1 */
+#define PCIE_LCSR_RCB		__BIT(3)       /* Read Completion Boundry Ctl*/
+#define PCIE_LCSR_LINK_DIS	__BIT(4)       /* Link Disable */
+#define PCIE_LCSR_RETRAIN	__BIT(5)       /* Retrain Link */
+#define PCIE_LCSR_COMCLKCFG	__BIT(6)       /* Common Clock Configuration */
+#define PCIE_LCSR_EXTNDSYNC	__BIT(7)       /* Extended Synch */
+#define PCIE_LCSR_ENCLKPM	__BIT(8)       /* Enable Clock Power Managmt */
+#define PCIE_LCSR_HAWD		__BIT(9)       /* HW Autonomous Width Disable*/
+#define PCIE_LCSR_LBMIE		__BIT(10)      /* Link BW Management Intr En */
+#define PCIE_LCSR_LABIE		__BIT(11)      /* Link Autonomous BW Intr En */
+#define	PCIE_LCSR_LINKSPEED	__BITS(19, 16) /* Link Speed */
+#define	PCIE_LCSR_NLW		__BITS(25, 20) /* Negotiated Link Width */
+#define	PCIE_LCSR_LINKTRAIN_ERR	__BIT(10 + 16) /* Link Training Error */
+#define	PCIE_LCSR_LINKTRAIN	__BIT(11 + 16) /* Link Training */
+#define	PCIE_LCSR_SLOTCLKCFG 	__BIT(12 + 16) /* Slot Clock Configuration */
+#define	PCIE_LCSR_DLACTIVE	__BIT(13 + 16) /* Data Link Layer Link Active*/
+#define	PCIE_LCSR_LINK_BW_MGMT	__BIT(14 + 16) /* Link BW Management Status */
+#define	PCIE_LCSR_LINK_AUTO_BW	__BIT(15 + 16) /* Link Autonomous BW Status */
+#define PCIE_SLCAP	0x14	/* Slot Capabilities Register */
+#define PCIE_SLCAP_ABP		__BIT(0)       /* Attention Button Present */
+#define PCIE_SLCAP_PCP		__BIT(1)       /* Power Controller Present */
+#define PCIE_SLCAP_MSP		__BIT(2)       /* MRL Sensor Present */
+#define PCIE_SLCAP_AIP		__BIT(3)       /* Attention Indicator Present*/
+#define PCIE_SLCAP_PIP		__BIT(4)       /* Power Indicator Present */
+#define PCIE_SLCAP_HPS		__BIT(5)       /* Hot-Plug Surprise */
+#define PCIE_SLCAP_HPC		__BIT(6)       /* Hot-Plug Capable */
+#define	PCIE_SLCAP_SPLV		__BITS(14, 7)  /* Slot Power Limit Value */
+#define	PCIE_SLCAP_SPLS		__BITS(16, 15) /* Slot Power Limit Scale */
+#define	PCIE_SLCAP_EIP		__BIT(17)      /* Electromechanical Interlock*/
+#define	PCIE_SLCAP_NCCS		__BIT(18)      /* No Command Completed Supp. */
+#define	PCIE_SLCAP_PSN		__BITS(31, 19) /* Physical Slot Number */
+#define PCIE_SLCSR	0x18	/* Slot Control & Status Register */
+#define PCIE_SLCSR_ABE		__BIT(0)       /* Attention Button Pressed En*/
+#define PCIE_SLCSR_PFE		__BIT(1)       /* Power Button Pressed Enable*/
+#define PCIE_SLCSR_MSE		__BIT(2)       /* MRL Sensor Changed Enable */
+#define PCIE_SLCSR_PDE		__BIT(3)       /* Presence Detect Changed Ena*/
+#define PCIE_SLCSR_CCE		__BIT(4)       /* Command Completed Intr. En */
+#define PCIE_SLCSR_HPE		__BIT(5)       /* Hot Plug Interrupt Enable */
+#define PCIE_SLCSR_AIC		__BITS(7, 6)   /* Attention Indicator Control*/
+#define PCIE_SLCSR_PIC		__BITS(9, 8)   /* Power Indicator Control */
+#define PCIE_SLCSR_PCC		__BIT(10)      /* Power Controller Control */
+#define PCIE_SLCSR_EIC		__BIT(11)      /* Electromechanical Interlock*/
+#define PCIE_SLCSR_DLLSCE	__BIT(12)      /* DataLinkLayer State Changed*/
+#define PCIE_SLCSR_ABP		__BIT(0 + 16)  /* Attention Button Pressed */
+#define PCIE_SLCSR_PFD		__BIT(1 + 16)  /* Power Fault Detected */
+#define PCIE_SLCSR_MSC		__BIT(2 + 16)  /* MRL Sensor Changed */
+#define PCIE_SLCSR_PDC		__BIT(3 + 16)  /* Presence Detect Changed */
+#define PCIE_SLCSR_CC		__BIT(4 + 16)  /* Command Completed */
+#define PCIE_SLCSR_MS		__BIT(5 + 16)  /* MRL Sensor State */
+#define PCIE_SLCSR_PDS		__BIT(6 + 16)  /* Presence Detect State */
+#define PCIE_SLCSR_EIS		__BIT(7 + 16)  /* Electromechanical Interlock*/
+#define PCIE_SLCSR_LACS		__BIT(8 + 16)  /* Data Link Layer State Chg. */
+#define PCIE_RCR	0x1c	/* Root Control & Capabilities Reg. */
+#define PCIE_RCR_SERR_CER	__BIT(0)       /* SERR on Correctable Err. En*/
+#define PCIE_RCR_SERR_NFER	__BIT(1)       /* SERR on Non-Fatal Error En */
+#define PCIE_RCR_SERR_FER	__BIT(2)       /* SERR on Fatal Error Enable */
+#define PCIE_RCR_PME_IE		__BIT(3)       /* PME Interrupt Enable */
+#define PCIE_RCR_CRS_SVE	__BIT(4)       /* CRS Software Visibility En */
+#define PCIE_RCR_CRS_SV		__BIT(16)      /* CRS Software Visibility */
+#define PCIE_RSR	0x20	/* Root Status Register */
+#define PCIE_RSR_PME_REQESTER	__BITS(15, 0)  /* PME Requester ID */
+#define PCIE_RSR_PME_STAT	__BIT(16)      /* PME Status */
+#define PCIE_RSR_PME_PEND	__BIT(17)      /* PME Pending */
+#define PCIE_DCAP2	0x24	/* Device Capabilities 2 Register */
+#define PCIE_DCAP2_COMPT_RANGE	__BITS(3,0)    /* Compl. Timeout Ranges Supp */
+#define PCIE_DCAP2_COMPT_DIS	__BIT(4)       /* Compl. Timeout Disable Supp*/
+#define PCIE_DCAP2_ARI_FWD	__BIT(5)       /* ARI Forward Supported */
+#define PCIE_DCAP2_ATOM_ROUT	__BIT(6)       /* AtomicOp Routing Supported */
+#define PCIE_DCAP2_32ATOM	__BIT(7)       /* 32bit AtomicOp Compl. Supp */
+#define PCIE_DCAP2_64ATOM	__BIT(8)       /* 64bit AtomicOp Compl. Supp */
+#define PCIE_DCAP2_128CAS	__BIT(9)       /* 128bit Cas Completer Supp. */
+#define PCIE_DCAP2_NO_ROPR_PASS	__BIT(10)      /* No RO-enabled PR-PR Passng */
+#define PCIE_DCAP2_LTR_MEC	__BIT(11)      /* LTR Mechanism Supported */
+#define PCIE_DCAP2_TPH_COMP	__BITS(13, 12) /* TPH Completer Supported */
+#define PCIE_DCAP2_OBFF		__BITS(19, 18) /* OBPF */
+#define PCIE_DCAP2_EXTFMT_FLD	__BIT(20)      /* Extended Fmt Field Support */
+#define PCIE_DCAP2_EETLP_PREF	__BIT(21)      /* End-End TLP Prefix Support */
+#define PCIE_DCAP2_MAX_EETLP	__BITS(23, 22) /* Max End-End TLP Prefix Sup */
+#define PCIE_DCSR2	0x28	/* Device Control & Status 2 Register */
+#define PCIE_DCSR2_COMPT_VAL	__BITS(3, 0)   /* Completion Timeout Value */
+#define PCIE_DCSR2_COMPT_DIS	__BIT(4)       /* Completion Timeout Disable */
+#define PCIE_DCSR2_ARI_FWD	__BIT(5)       /* ARI Forwarding Enable */
+#define PCIE_DCSR2_ATOM_REQ	__BIT(6)       /* AtomicOp Requester Enable */
+#define PCIE_DCSR2_ATOM_EBLK	__BIT(7)       /* AtomicOp Egress Blocking */
+#define PCIE_DCSR2_IDO_REQ	__BIT(8)       /* IDO Request Enable */
+#define PCIE_DCSR2_IDO_COMP	__BIT(9)       /* IDO Completion Enable */
+#define PCIE_DCSR2_LTR_MEC	__BIT(10)      /* LTR Mechanism Enable */
+#define PCIE_DCSR2_OBFF_EN	__BITS(14, 13) /* OBPF Enable */
+#define PCIE_DCSR2_EETLP	__BIT(15)      /* End-End TLP Prefix Blcking */
+#define PCIE_LCAP2	0x2c	/* Link Capabilities 2 Register */
+#define PCIE_LCAP2_SUP_LNKSV	__BITS(7, 1)   /* Supported Link Speeds Vect */
+#define PCIE_LCAP2_CROSSLNK	__BIT(8)       /* Crosslink Supported */
+#define PCIE_LCSR2	0x30	/* Link Control & Status 2 Register */
+#define PCIE_LCSR2_TGT_LSPEED	__BITS(3, 0)   /* Target Link Speed */
+#define PCIE_LCSR2_ENT_COMPL	__BIT(4)       /* Enter Compliance */
+#define PCIE_LCSR2_HW_AS_DIS	__BIT(5)       /* HW Autonomous Speed Disabl */
+#define PCIE_LCSR2_SEL_DEEMP	__BIT(6)       /* Selectable De-emphasis */
+#define PCIE_LCSR2_TX_MARGIN	__BITS(9, 7)   /* Transmit Margin */
+#define PCIE_LCSR2_EN_MCOMP	__BIT(10)      /* Enter Modified Compliance */
+#define PCIE_LCSR2_COMP_SOS	__BIT(11)      /* Compliance SOS */
+#define PCIE_LCSR2_COMP_DEEMP	__BITS(15, 12) /* Compliance Present/De-emph */
+#define PCIE_LCSR2_DEEMP_LVL	__BIT(0 + 16)  /* Current De-emphasis Level */
+#define PCIE_LCSR2_EQ_COMPL	__BIT(1 + 16)  /* Equalization Complete */
+#define PCIE_LCSR2_EQP1_SUC	__BIT(2 + 16)  /* Equaliz Phase 1 Successful */
+#define PCIE_LCSR2_EQP2_SUC	__BIT(3 + 16)  /* Equaliz Phase 2 Successful */
+#define PCIE_LCSR2_EQP3_SUC	__BIT(4 + 16)  /* Equaliz Phase 3 Successful */
+#define PCIE_LCSR2_LNKEQ_REQ	__BIT(5 + 16)  /* Link Equalization Request */
+
+#define PCIE_SLCAP2	0x34	/* Slot Capabilities 2 Register */
+#define PCIE_SLCSR2	0x38	/* Slot Control & Status 2 Register */
+
+/*
+ * Capability ID: 0x11
+ * MSIX
+ */
+
+#define PCI_MSIX_CTL	0x00
+#define	PCI_MSIX_CTL_ENABLE	0x80000000
+#define	PCI_MSIX_CTL_FUNCMASK	0x40000000
+#define	PCI_MSIX_CTL_TBLSIZE_MASK 0x07ff0000
+#define	PCI_MSIX_CTL_TBLSIZE_SHIFT 16
+#define	PCI_MSIX_CTL_TBLSIZE(ofs)	((((ofs) & PCI_MSIX_CTL_TBLSIZE_MASK) \
+		>> PCI_MSIX_CTL_TBLSIZE_SHIFT) + 1)
+/*
+ * 2nd DWORD is the Table Offset
+ */
+#define	PCI_MSIX_TBLOFFSET	0x04
+#define	PCI_MSIX_TBLOFFSET_MASK	0xfffffff8
+#define	PCI_MSIX_TBLBIR_MASK	0x00000007
+/*
+ * 3rd DWORD is the Pending Bitmap Array Offset
+ */
+#define	PCI_MSIX_PBAOFFSET	0x08
+#define	PCI_MSIX_PBAOFFSET_MASK	0xfffffff8
+#define	PCI_MSIX_PBABIR_MASK	0x00000007
+
+#define PCI_MSIX_TABLE_ENTRY_SIZE	16
+#define PCI_MSIX_TABLE_ENTRY_ADDR_LO	0x0
+#define PCI_MSIX_TABLE_ENTRY_ADDR_HI	0x4
+#define PCI_MSIX_TABLE_ENTRY_DATA	0x8
+#define PCI_MSIX_TABLE_ENTRY_VECTCTL	0xc
+struct pci_msix_table_entry {
+	uint32_t pci_msix_addr_lo;
+	uint32_t pci_msix_addr_hi;
+	uint32_t pci_msix_value;
+	uint32_t pci_msix_vector_control;
+};
+#define	PCI_MSIX_VECTCTL_HWMASK_MASK	0x00000001
+
+ /* Max number of MSI-X vectors. See PCI-SIG specification. */
+#define	PCI_MSIX_MAX_VECTORS		2048
+
+/*
+ * Capability ID: 0x12
+ * SATA
+ */
+
+/*
+ * Capability ID: 0x13
+ * Advanced Feature
+ */
+#define PCI_AFCAPR		0x00	/* Capabilities */
+#define	PCI_AFCAPR_MASK		__BITS(31, 24)
+#define	PCI_AF_TP_CAP		__BIT(24)	/* Transaction Pending */
+#define	PCI_AF_FLR_CAP		__BIT(25)	/* Function Level Reset */
+#define PCI_AFCSR		0x04	/* Control & Status register */
+#define PCI_AFCR_INITIATE_FLR	__BIT(0)	/* Initiate Function LVL RST */
+#define PCI_AFSR_TP		__BIT(8)	/* Transaction Pending */
+
+
+/*
+ * Interrupt Configuration Register; contains interrupt pin and line.
+ */
+#define	PCI_INTERRUPT_REG		0x3c
+
+typedef u_int8_t pci_intr_latency_t;
+typedef u_int8_t pci_intr_grant_t;
+typedef u_int8_t pci_intr_pin_t;
+typedef u_int8_t pci_intr_line_t;
+
+#define PCI_MAX_LAT_SHIFT			24
+#define	PCI_MAX_LAT_MASK			0xff
+#define	PCI_MAX_LAT(icr) \
+	    (((icr) >> PCI_MAX_LAT_SHIFT) & PCI_MAX_LAT_MASK)
+
+#define PCI_MIN_GNT_SHIFT			16
+#define	PCI_MIN_GNT_MASK			0xff
+#define	PCI_MIN_GNT(icr) \
+	    (((icr) >> PCI_MIN_GNT_SHIFT) & PCI_MIN_GNT_MASK)
+
+#define	PCI_INTERRUPT_GRANT_SHIFT		24
+#define	PCI_INTERRUPT_GRANT_MASK		0xff
+#define	PCI_INTERRUPT_GRANT(icr) \
+	    (((icr) >> PCI_INTERRUPT_GRANT_SHIFT) & PCI_INTERRUPT_GRANT_MASK)
+
+#define	PCI_INTERRUPT_LATENCY_SHIFT		16
+#define	PCI_INTERRUPT_LATENCY_MASK		0xff
+#define	PCI_INTERRUPT_LATENCY(icr) \
+	    (((icr) >> PCI_INTERRUPT_LATENCY_SHIFT) & PCI_INTERRUPT_LATENCY_MASK)
+
+#define	PCI_INTERRUPT_PIN_SHIFT			8
+#define	PCI_INTERRUPT_PIN_MASK			0xff
+#define	PCI_INTERRUPT_PIN(icr) \
+	    (((icr) >> PCI_INTERRUPT_PIN_SHIFT) & PCI_INTERRUPT_PIN_MASK)
+
+#define	PCI_INTERRUPT_LINE_SHIFT		0
+#define	PCI_INTERRUPT_LINE_MASK			0xff
+#define	PCI_INTERRUPT_LINE(icr) \
+	    (((icr) >> PCI_INTERRUPT_LINE_SHIFT) & PCI_INTERRUPT_LINE_MASK)
+
+#define PCI_INTERRUPT_CODE(lat,gnt,pin,line)		\
+	  ((((lat)&PCI_INTERRUPT_LATENCY_MASK)<<PCI_INTERRUPT_LATENCY_SHIFT)| \
+	   (((gnt)&PCI_INTERRUPT_GRANT_MASK)  <<PCI_INTERRUPT_GRANT_SHIFT)  | \
+	   (((pin)&PCI_INTERRUPT_PIN_MASK)    <<PCI_INTERRUPT_PIN_SHIFT)    | \
+	   (((line)&PCI_INTERRUPT_LINE_MASK)  <<PCI_INTERRUPT_LINE_SHIFT))
+
+#define	PCI_INTERRUPT_PIN_NONE			0x00
+#define	PCI_INTERRUPT_PIN_A			0x01
+#define	PCI_INTERRUPT_PIN_B			0x02
+#define	PCI_INTERRUPT_PIN_C			0x03
+#define	PCI_INTERRUPT_PIN_D			0x04
+#define	PCI_INTERRUPT_PIN_MAX			0x04
+
+/* Header Type 1 (Bridge) configuration registers */
+#define PCI_BRIDGE_BUS_REG		0x18
+#define   PCI_BRIDGE_BUS_EACH_MASK		0xff
+#define   PCI_BRIDGE_BUS_PRIMARY_SHIFT		0
+#define   PCI_BRIDGE_BUS_SECONDARY_SHIFT	8
+#define   PCI_BRIDGE_BUS_SUBORDINATE_SHIFT	16
+#define   PCI_BRIDGE_BUS_SEC_LATTIMER_SHIFT	24
+#define   PCI_BRIDGE_BUS_PRIMARY(reg) \
+	(((reg) >> PCI_BRIDGE_BUS_PRIMARY_SHIFT) & PCI_BRIDGE_BUS_EACH_MASK)
+#define   PCI_BRIDGE_BUS_SECONDARY(reg) \
+	(((reg) >> PCI_BRIDGE_BUS_SECONDARY_SHIFT) & PCI_BRIDGE_BUS_EACH_MASK)
+#define   PCI_BRIDGE_BUS_SUBORDINATE(reg) \
+	(((reg) >> PCI_BRIDGE_BUS_SUBORDINATE_SHIFT) &PCI_BRIDGE_BUS_EACH_MASK)
+#define   PCI_BRIDGE_BUS_SEC_LATTIMER(reg) \
+	(((reg) >> PCI_BRIDGE_BUS_SEC_LATTIMER_SHIFT)&PCI_BRIDGE_BUS_EACH_MASK)
+
+
+#define PCI_BRIDGE_STATIO_REG		0x1C
+#define	  PCI_BRIDGE_STATIO_IOBASE_SHIFT	0
+#define	  PCI_BRIDGE_STATIO_IOLIMIT_SHIFT	8
+#define	  PCI_BRIDGE_STATIO_STATUS_SHIFT	16
+#define	  PCI_BRIDGE_STATIO_IOBASE_MASK		0xf0
+#define	  PCI_BRIDGE_STATIO_IOLIMIT_MASK	0xf0
+#define	  PCI_BRIDGE_STATIO_STATUS_MASK		0xffff
+#define	  PCI_BRIDGE_IO_32BITS(reg)		(((reg) & 0xf) == 1)
+
+#define PCI_BRIDGE_MEMORY_REG		0x20
+#define	  PCI_BRIDGE_MEMORY_BASE_SHIFT		4
+#define	  PCI_BRIDGE_MEMORY_LIMIT_SHIFT		20
+#define	  PCI_BRIDGE_MEMORY_BASE_MASK		0x0fff
+#define	  PCI_BRIDGE_MEMORY_LIMIT_MASK		0x0fff
+
+#define PCI_BRIDGE_PREFETCHMEM_REG	0x24
+#define	  PCI_BRIDGE_PREFETCHMEM_BASE_SHIFT	4
+#define	  PCI_BRIDGE_PREFETCHMEM_LIMIT_SHIFT	20
+#define	  PCI_BRIDGE_PREFETCHMEM_BASE_MASK	0x0fff
+#define	  PCI_BRIDGE_PREFETCHMEM_LIMIT_MASK	0x0fff
+#define	  PCI_BRIDGE_PREFETCHMEM_64BITS(reg)	((reg) & 0xf)
+
+#define PCI_BRIDGE_PREFETCHBASE32_REG	0x28
+#define PCI_BRIDGE_PREFETCHLIMIT32_REG	0x2C
+
+#define PCI_BRIDGE_IOHIGH_REG		0x30
+#define	  PCI_BRIDGE_IOHIGH_BASE_SHIFT		0
+#define	  PCI_BRIDGE_IOHIGH_LIMIT_SHIFT		16
+#define	  PCI_BRIDGE_IOHIGH_BASE_MASK		0xffff
+#define	  PCI_BRIDGE_IOHIGH_LIMIT_MASK		0xffff
+
+#define PCI_BRIDGE_CONTROL_REG		0x3C
+#define	  PCI_BRIDGE_CONTROL_SHIFT		16
+#define	  PCI_BRIDGE_CONTROL_MASK		0xffff
+#define   PCI_BRIDGE_CONTROL_PERE		(1 <<  0)
+#define   PCI_BRIDGE_CONTROL_SERR		(1 <<  1)
+#define   PCI_BRIDGE_CONTROL_ISA		(1 <<  2)
+#define   PCI_BRIDGE_CONTROL_VGA		(1 <<  3)
+/* Reserved					(1 <<  4) */
+#define   PCI_BRIDGE_CONTROL_MABRT		(1 <<  5)
+#define   PCI_BRIDGE_CONTROL_SECBR		(1 <<  6)
+#define   PCI_BRIDGE_CONTROL_SECFASTB2B		(1 <<  7)
+#define   PCI_BRIDGE_CONTROL_PRI_DISC_TIMER	(1 <<  8)
+#define   PCI_BRIDGE_CONTROL_SEC_DISC_TIMER	(1 <<  9)
+#define   PCI_BRIDGE_CONTROL_DISC_TIMER_STAT	(1 << 10)
+#define   PCI_BRIDGE_CONTROL_DISC_TIMER_SERR	(1 << 11)
+/* Reserved					(1 << 12) - (1 << 15) */
+
+/*
+ * Vital Product Data resource tags.
+ */
+struct pci_vpd_smallres {
+	uint8_t		vpdres_byte0;		/* length of data + tag */
+	/* Actual data. */
+} __packed;
+
+struct pci_vpd_largeres {
+	uint8_t		vpdres_byte0;
+	uint8_t		vpdres_len_lsb;		/* length of data only */
+	uint8_t		vpdres_len_msb;
+	/* Actual data. */
+} __packed;
+
+#define	PCI_VPDRES_ISLARGE(x)			((x) & 0x80)
+
+#define	PCI_VPDRES_SMALL_LENGTH(x)		((x) & 0x7)
+#define	PCI_VPDRES_SMALL_NAME(x)		(((x) >> 3) & 0xf)
+
+#define	PCI_VPDRES_LARGE_NAME(x)		((x) & 0x7f)
+
+#define	PCI_VPDRES_TYPE_COMPATIBLE_DEVICE_ID	0x3	/* small */
+#define	PCI_VPDRES_TYPE_VENDOR_DEFINED		0xe	/* small */
+#define	PCI_VPDRES_TYPE_END_TAG			0xf	/* small */
+
+#define	PCI_VPDRES_TYPE_IDENTIFIER_STRING	0x02	/* large */
+#define	PCI_VPDRES_TYPE_VPD			0x10	/* large */
+
+struct pci_vpd {
+	uint8_t		vpd_key0;
+	uint8_t		vpd_key1;
+	uint8_t		vpd_len;		/* length of data only */
+	/* Actual data. */
+} __packed;
+
+/*
+ * Recommended VPD fields:
+ *
+ *	PN		Part number of assembly
+ *	FN		FRU part number
+ *	EC		EC level of assembly
+ *	MN		Manufacture ID
+ *	SN		Serial Number
+ *
+ * Conditionally recommended VPD fields:
+ *
+ *	LI		Load ID
+ *	RL		ROM Level
+ *	RM		Alterable ROM Level
+ *	NA		Network Address
+ *	DD		Device Driver Level
+ *	DG		Diagnostic Level
+ *	LL		Loadable Microcode Level
+ *	VI		Vendor ID/Device ID
+ *	FU		Function Number
+ *	SI		Subsystem Vendor ID/Subsystem ID
+ *
+ * Additional VPD fields:
+ *
+ *	Z0-ZZ		User/Product Specific
+ */
+
+/*
+ * PCI Expansion Rom
+ */
+
+struct pci_rom_header {
+	uint16_t		romh_magic;	/* 0xAA55 little endian */
+	uint8_t			romh_reserved[22];
+	uint16_t		romh_data_ptr;	/* pointer to pci_rom struct */
+} __packed;
+
+#define	PCI_ROM_HEADER_MAGIC	0xAA55		/* little endian */
+
+struct pci_rom {
+	uint32_t		rom_signature;
+	pci_vendor_id_t		rom_vendor;
+	pci_product_id_t	rom_product;
+	uint16_t		rom_vpd_ptr;	/* reserved in PCI 2.2 */
+	uint16_t		rom_data_len;
+	uint8_t			rom_data_rev;
+	pci_interface_t		rom_interface;	/* the class reg is 24-bits */
+	pci_subclass_t		rom_subclass;	/* in little endian */
+	pci_class_t		rom_class;
+	uint16_t		rom_len;	/* code length / 512 byte */
+	uint16_t		rom_rev;	/* code revision level */
+	uint8_t			rom_code_type;	/* type of code */
+	uint8_t			rom_indicator;
+	uint16_t		rom_reserved;
+	/* Actual data. */
+} __packed;
+
+#define	PCI_ROM_SIGNATURE	0x52494350	/* "PCIR", endian reversed */
+#define	PCI_ROM_CODE_TYPE_X86	0		/* Intel x86 BIOS */
+#define	PCI_ROM_CODE_TYPE_OFW	1		/* Open Firmware */
+#define	PCI_ROM_CODE_TYPE_HPPA	2		/* HP PA/RISC */
+#define	PCI_ROM_CODE_TYPE_EFI	3		/* EFI Image */
+
+#define	PCI_ROM_INDICATOR_LAST	0x80
+
+/*
+ * Threshold below which 32bit PCI DMA needs bouncing.
+ */
+#define PCI32_DMA_BOUNCE_THRESHOLD	0x100000000ULL
+
+/*
+ * PCI-X 2.0/ PCI-express Extended Capability List
+ */
+
+#define	PCI_EXTCAPLIST_BASE		0x100
+
+#define	PCI_EXTCAPLIST_CAP(ecr)		((ecr) & 0xffff)
+#define	PCI_EXTCAPLIST_VERSION(ecr)	(((ecr) >> 16) & 0xf)
+#define	PCI_EXTCAPLIST_NEXT(ecr)	(((ecr) >> 20) & 0xfff)
+
+/* Extended Capability Identification Numbers */
+
+#define	PCI_EXTCAP_AER		0x0001	/* Advanced Error Reporting */
+#define	PCI_EXTCAP_VC		0x0002	/* Virtual Channel if MFVC Ext Cap not set */
+#define	PCI_EXTCAP_SERNUM	0x0003	/* Device Serial Number */
+#define	PCI_EXTCAP_PWRBDGT	0x0004	/* Power Budgeting */
+#define	PCI_EXTCAP_RCLINK_DCL	0x0005	/* Root Complex Link Declaration */
+#define	PCI_EXTCAP_RCLINK_CTL	0x0006	/* Root Complex Internal Link Control */
+#define	PCI_EXTCAP_RCEC_ASSOC	0x0007	/* Root Complex Event Collector Association */
+#define	PCI_EXTCAP_MFVC		0x0008	/* Multi-Function Virtual Channel */
+#define	PCI_EXTCAP_VC2		0x0009	/* Virtual Channel if MFVC Ext Cap set */
+#define	PCI_EXTCAP_RCRB		0x000a	/* RCRB Header */
+#define	PCI_EXTCAP_VENDOR	0x000b	/* Vendor Unique */
+#define	PCI_EXTCAP_CAC		0x000c	/* Configuration Access Correction -- obsolete */
+#define	PCI_EXTCAP_ACS		0x000d	/* Access Control Services */
+#define	PCI_EXTCAP_ARI		0x000e	/* Alternative Routing-ID Interpretation */
+#define	PCI_EXTCAP_ATS		0x000f	/* Address Translation Services */
+#define	PCI_EXTCAP_SRIOV	0x0010	/* Single Root IO Virtualization */
+#define	PCI_EXTCAP_MRIOV	0x0011	/* Multiple Root IO Virtualization */
+#define	PCI_EXTCAP_MULTICAST	0x0012	/* Multicast */
+#define	PCI_EXTCAP_PAGE_REQ	0x0013	/* Page Request */
+#define	PCI_EXTCAP_AMD		0x0014	/* Reserved for AMD */
+#define	PCI_EXTCAP_RESIZE_BAR	0x0015	/* Resizable BAR */
+#define	PCI_EXTCAP_DPA		0x0016	/* Dynamic Power Allocation */
+#define	PCI_EXTCAP_TPH_REQ	0x0017	/* TPH Requester */
+#define	PCI_EXTCAP_LTR		0x0018	/* Latency Tolerance Reporting */
+#define	PCI_EXTCAP_SEC_PCIE	0x0019	/* Secondary PCI Express */
+#define	PCI_EXTCAP_PMUX		0x001a	/* Protocol Multiplexing */
+#define	PCI_EXTCAP_PASID	0x001b	/* Process Address Space ID */
+#define	PCI_EXTCAP_LN_REQ	0x001c	/* LN Requester */
+#define	PCI_EXTCAP_DPC		0x001d	/* Downstream Port Containment */
+#define	PCI_EXTCAP_L1PM		0x001e	/* L1 PM Substates */
+#define	PCI_EXTCAP_PTM		0x001f	/* Precision Time Management */
+#define	PCI_EXTCAP_MPCIE	0x0020	/* M-PCIe */
+#define	PCI_EXTCAP_FRSQ		0x0021	/* Function Reading Status Queueing */
+#define	PCI_EXTCAP_RTR		0x0022	/* Readiness Time Reporting */
+#define	PCI_EXTCAP_DESIGVNDSP	0x0023	/* Designated Vendor-Specific */
+
+/*
+ * Extended capability ID: 0x0001
+ * Advanced Error Reporting
+ */
+#define	PCI_AER_UC_STATUS	0x04	/* Uncorrectable Error Status Register */
+#define	  PCI_AER_UC_UNDEFINED			__BIT(0)
+#define	  PCI_AER_UC_DL_PROTOCOL_ERROR		__BIT(4)
+#define	  PCI_AER_UC_SURPRISE_DOWN_ERROR	__BIT(5)
+#define	  PCI_AER_UC_POISONED_TLP		__BIT(12)
+#define	  PCI_AER_UC_FC_PROTOCOL_ERROR		__BIT(13)
+#define	  PCI_AER_UC_COMPLETION_TIMEOUT		__BIT(14)
+#define	  PCI_AER_UC_COMPLETER_ABORT		__BIT(15)
+#define	  PCI_AER_UC_UNEXPECTED_COMPLETION	__BIT(16)
+#define	  PCI_AER_UC_RECEIVER_OVERFLOW		__BIT(17)
+#define	  PCI_AER_UC_MALFORMED_TLP		__BIT(18)
+#define	  PCI_AER_UC_ECRC_ERROR			__BIT(19)
+#define	  PCI_AER_UC_UNSUPPORTED_REQUEST_ERROR	__BIT(20)
+#define	  PCI_AER_UC_ACS_VIOLATION		__BIT(21)
+#define	  PCI_AER_UC_INTERNAL_ERROR		__BIT(22)
+#define	  PCI_AER_UC_MC_BLOCKED_TLP		__BIT(23)
+#define	  PCI_AER_UC_ATOMIC_OP_EGRESS_BLOCKED	__BIT(24)
+#define	  PCI_AER_UC_TLP_PREFIX_BLOCKED_ERROR	__BIT(25)
+#define	PCI_AER_UC_MASK		0x08	/* Uncorrectable Error Mask Register */
+	  /* Shares bits with UC_STATUS */
+#define	PCI_AER_UC_SEVERITY	0x0c	/* Uncorrectable Error Severity Register */
+	  /* Shares bits with UC_STATUS */
+#define	PCI_AER_COR_STATUS	0x10	/* Correctable Error Status Register */
+#define	  PCI_AER_COR_RECEIVER_ERROR		__BIT(0)
+#define	  PCI_AER_COR_BAD_TLP			__BIT(6)
+#define	  PCI_AER_COR_BAD_DLLP			__BIT(7)
+#define	  PCI_AER_COR_REPLAY_NUM_ROLLOVER	__BIT(8)
+#define	  PCI_AER_COR_REPLAY_TIMER_TIMEOUT	__BIT(12)
+#define	  PCI_AER_COR_ADVISORY_NF_ERROR		__BIT(13)
+#define	  PCI_AER_COR_INTERNAL_ERROR		__BIT(14)
+#define	  PCI_AER_COR_HEADER_LOG_OVERFLOW	__BIT(15)
+#define	PCI_AER_COR_MASK	0x14	/* Correctable Error Mask Register */
+	  /* Shares bits with COR_STATUS */
+#define	PCI_AER_CAP_CONTROL	0x18	/* Advanced Error Capabilities and Control Register */
+#define	  PCI_AER_FIRST_ERROR_PTR		__BITS(4, 0)
+#define	  PCI_AER_FIRST_ERROR_PTR_S		0
+#define	  PCI_AER_FIRST_ERROR_PTR_M		0x1f
+#define	  PCI_AER_ECRC_GEN_CAPABLE		__BIT(5)
+#define	  PCI_AER_ECRC_GEN_ENABLE		__BIT(6)
+#define	  PCI_AER_ECRC_CHECK_CAPABLE		__BIT(7)
+#define	  PCI_AER_ECRC_CHECK_ENABLE		__BIT(8)
+#define	  PCI_AER_MULT_HDR_CAPABLE		__BIT(9)
+#define	  PCI_AER_MULT_HDR_ENABLE		__BIT(10)
+#define	  PCI_AER_TLP_PREFIX_LOG_PRESENT	__BIT(11)
+#define	PCI_AER_HEADER_LOG	0x1c	/* Header Log Register */
+#define	PCI_AER_ROOTERR_CMD	0x2c	/* Root Error Command Register */
+					/* Only for root complex ports */
+#define	  PCI_AER_ROOTERR_COR_ENABLE		__BIT(0)
+#define	  PCI_AER_ROOTERR_NF_ENABLE		__BIT(1)
+#define	  PCI_AER_ROOTERR_F_ENABLE		__BIT(2)
+#define	PCI_AER_ROOTERR_STATUS	0x30	/* Root Error Status Register */
+					/* Only for root complex ports */
+#define	  PCI_AER_ROOTERR_COR_ERR		__BIT(0)
+#define	  PCI_AER_ROOTERR_MULTI_COR_ERR		__BIT(1)
+#define	  PCI_AER_ROOTERR_UC_ERR		__BIT(2)
+#define	  PCI_AER_ROOTERR_MULTI_UC_ERR		__BIT(3)
+#define	  PCI_AER_ROOTERR_FIRST_UC_FATAL	__BIT(4)
+#define	  PCI_AER_ROOTERR_NF_ERR		__BIT(5)
+#define	  PCI_AER_ROOTERR_F_ERR			__BIT(6)
+#define	  PCI_AER_ROOTERR_INT_MESSAGE		__BITS(31, 27)
+#define	  PCI_AER_ROOTERR_INT_MESSAGE_S		27
+#define	  PCI_AER_ROOTERR_INT_MESSAGE_M		0x1f
+#define	PCI_AER_ERRSRC_ID	0x34	/* Error Source Identification Register */
+#define	  PCI_AER_ERRSRC_ID_ERR_COR		__BITS(15, 0)
+#define	  PCI_AER_ERRSRC_ID_ERR_COR_S		0
+#define	  PCI_AER_ERRSRC_ID_ERR_COR_M		0xffff
+#define	  PCI_AER_ERRSRC_ID_ERR_UC		__BITS(31, 16)
+#define	  PCI_AER_ERRSRC_ID_ERR_UC_S		16
+#define	  PCI_AER_ERRSRC_ID_ERR_UC_M		0xffff
+					/* Only for root complex ports */
+#define	PCI_AER_TLP_PREFIX_LOG	0x38	/*TLP Prefix Log Register */
+					/* Only for TLP prefix functions */
+
+/*
+ * Extended capability ID: 0x0002, 0x0009
+ * Virtual Channel
+ */
+#define	PCI_VC_CAP1		0x04	/* Port VC Capability Register 1 */
+#define	  PCI_VC_CAP1_EXT_COUNT			__BITS(2, 0)
+#define	  PCI_VC_CAP1_EXT_COUNT_S		0
+#define	  PCI_VC_CAP1_EXT_COUNT_M		0x7
+#define	  PCI_VC_CAP1_LOWPRI_EXT_COUNT		__BITS(6, 4)
+#define	  PCI_VC_CAP1_LOWPRI_EXT_COUNT_S	4
+#define	  PCI_VC_CAP1_LOWPRI_EXT_COUNT_M	0x7
+#define	  PCI_VC_CAP1_REFCLK			__BITS(9, 8)
+#define	  PCI_VC_CAP1_REFCLK_S			8
+#define	  PCI_VC_CAP1_REFCLK_M			0x3
+#define	  PCI_VC_CAP1_REFCLK_100NS		0x0
+#define	  PCI_VC_CAP1_PORT_ARB_TABLE_SIZE	__BITS(11, 10)
+#define	  PCI_VC_CAP1_PORT_ARB_TABLE_SIZE_S	10
+#define	  PCI_VC_CAP1_PORT_ARB_TABLE_SIZE_M	0x3
+#define	PCI_VC_CAP2		0x08	/* Port VC Capability Register 2 */
+#define	  PCI_VC_CAP2_ARB_CAP_HW_FIXED_SCHEME	__BIT(0)
+#define	  PCI_VC_CAP2_ARB_CAP_WRR_32		__BIT(1)
+#define	  PCI_VC_CAP2_ARB_CAP_WRR_64		__BIT(2)
+#define	  PCI_VC_CAP2_ARB_CAP_WRR_128		__BIT(3)
+#define	  PCI_VC_CAP2_ARB_TABLE_OFFSET		__BITS(31, 24)
+#define	  PCI_VC_CAP2_ARB_TABLE_OFFSET_S	24
+#define	  PCI_VC_CAP2_ARB_TABLE_OFFSET_M	0xff
+#define	PCI_VC_CONTROL		0x0c	/* Port VC Control Register (16bit) */
+#define	  PCI_VC_CONTROL_LOAD_VC_ARB_TABLE	__BIT(0)
+#define	  PCI_VC_CONTROL_VC_ARB_SELECT		__BITS(3, 1)
+#define	  PCI_VC_CONTROL_VC_ARB_SELECT_S	1
+#define	  PCI_VC_CONTROL_VC_ARB_SELECT_M	0x7
+#define	PCI_VC_STATUS		0x0e	/* Port VC Status Register (16bit) */
+#define	  PCI_VC_STATUS_LOAD_VC_ARB_TABLE	__BIT(0)
+#define	PCI_VC_RESOURCE_CAP(n)	(0x10 + ((n) * 0x0c))	/* VC Resource Capability Register */
+#define	  PCI_VC_RESOURCE_CAP_PORT_ARB_CAP_HW_FIXED_SCHEME __BIT(0)
+#define	  PCI_VC_RESOURCE_CAP_PORT_ARB_CAP_WRR_32          __BIT(1)
+#define	  PCI_VC_RESOURCE_CAP_PORT_ARB_CAP_WRR_64          __BIT(2)
+#define	  PCI_VC_RESOURCE_CAP_PORT_ARB_CAP_WRR_128         __BIT(3)
+#define	  PCI_VC_RESOURCE_CAP_PORT_ARB_CAP_TWRR_128        __BIT(4)
+#define	  PCI_VC_RESOURCE_CAP_PORT_ARB_CAP_WRR_256         __BIT(5)
+#define	  PCI_VC_RESOURCE_CAP_ADV_PKT_SWITCH	__BIT(14)
+#define	  PCI_VC_RESOURCE_CAP_REJCT_SNOOP_TRANS	__BIT(15)
+#define	  PCI_VC_RESOURCE_CAP_MAX_TIME_SLOTS	__BITS(22, 16)
+#define	  PCI_VC_RESOURCE_CAP_MAX_TIME_SLOTS_S	16
+#define	  PCI_VC_RESOURCE_CAP_MAX_TIME_SLOTS_M	0x7f
+#define	  PCI_VC_RESOURCE_CAP_PORT_ARB_TABLE_OFFSET   __BITS(31, 24)
+#define	  PCI_VC_RESOURCE_CAP_PORT_ARB_TABLE_OFFSET_S 24
+#define	  PCI_VC_RESOURCE_CAP_PORT_ARB_TABLE_OFFSET_M 0xff
+#define	PCI_VC_RESOURCE_CTL(n)	(0x14 + ((n) * 0x0c))	/* VC Resource Control Register */
+#define	  PCI_VC_RESOURCE_CTL_TCVC_MAP		__BITS(7, 0)
+#define	  PCI_VC_RESOURCE_CTL_TCVC_MAP_S	0
+#define	  PCI_VC_RESOURCE_CTL_TCVC_MAP_M	0xff
+#define	  PCI_VC_RESOURCE_CTL_LOAD_PORT_ARB_TABLE __BIT(16)
+#define	  PCI_VC_RESOURCE_CTL_PORT_ARB_SELECT	__BITS(19, 17)
+#define	  PCI_VC_RESOURCE_CTL_PORT_ARB_SELECT_S	17
+#define	  PCI_VC_RESOURCE_CTL_PORT_ARB_SELECT_M	0x7
+#define	  PCI_VC_RESOURCE_CTL_VC_ID		__BITS(26, 24)
+#define	  PCI_VC_RESOURCE_CTL_VC_ID_S		24
+#define	  PCI_VC_RESOURCE_CTL_VC_ID_M		0x7
+#define	  PCI_VC_RESOURCE_CTL_VC_ENABLE		__BIT(31)
+#define	PCI_VC_RESOURCE_STA(n)	(0x18 + ((n) * 0x0c))	/* VC Resource Status Register */
+#define	  PCI_VC_RESOURCE_STA_PORT_ARB_TABLE	__BIT(0)
+#define	  PCI_VC_RESOURCE_STA_VC_NEG_PENDING	__BIT(1)
+
+/*
+ * Extended capability ID: 0x0003
+ * Serial Number
+ */
+#define	PCI_SERIAL_LOW		0x04
+#define	PCI_SERIAL_HIGH		0x08
+
+/*
+ * Extended capability ID: 0x0004
+ * Power Budgeting
+ */
+#define	PCI_PWRBDGT_DSEL	0x04	/* Data Select */
+#define	PCI_PWRBDGT_DATA	0x08	/* Data */
+#define	PCI_PWRBDGT_DATA_BASEPWR	__BITS(7, 0)	/* Base Power */
+#define	PCI_PWRBDGT_DATA_SCALE		__BITS(9, 8)	/* Data Scale */
+#define	PCI_PWRBDGT_PM_SUBSTAT		__BITS(12, 10)	/* PM Sub State */
+#define	PCI_PWRBDGT_PM_STAT		__BITS(14, 13)	/* PM State */
+#define	PCI_PWRBDGT_TYPE		__BITS(17, 15)	/* Type */
+#define	PCI_PWRBDGT_PWRRAIL		__BITS(20, 18)	/* Power Rail */
+#define	PCI_PWRBDGT_CAP		0x0c	/* Capability */
+#define	PCI_PWRBDGT_CAP_SYSALLOC	__BIT(0)	/* System Allocated */
+
+/*
+ * Extended capability ID: 0x0005
+ * Root Complex Link Declaration
+ */
+#define	PCI_RCLINK_DCL_ESDESC	0x04	/* Element Self Description */
+#define	PCI_RCLINK_DCL_ESDESC_ELMTYPE __BITS(3, 0)	/* Element Type */
+#define	PCI_RCLINK_DCL_ESDESC_NUMLINKENT __BITS(15, 8) /* Num of Link Entries*/
+#define	PCI_RCLINK_DCL_ESDESC_COMPID  __BITS(23, 16)	/* Component ID */
+#define	PCI_RCLINK_DCL_ESDESC_PORTNUM __BITS(31, 24)	/* Port Number */
+#define	PCI_RCLINK_DCL_LINKENTS	0x10	/* Link Entries */
+#define	PCI_RCLINK_DCL_LINKDESC(x)	/* Link Description */	\
+	(PCI_RCLINK_DCL_LINKENTS + ((x) * 16))
+#define	PCI_RCLINK_DCL_LINKDESC_LVALID	__BIT(0)	/* Link Valid */
+#define	PCI_RCLINK_DCL_LINKDESC_LTYPE	__BIT(1)	/* Link Type */
+#define	PCI_RCLINK_DCL_LINKDESC_ARCRBH	__BIT(2)    /* Associate RCRB Header */
+#define	PCI_RCLINK_DCL_LINKDESC_TCOMPID	__BITS(23, 16) /* Target Component ID*/
+#define	PCI_RCLINK_DCL_LINKDESC_TPNUM	__BITS(31, 24) /* Target Port Number */
+#define	PCI_RCLINK_DCL_LINKADDR_LT0_LO(x) /* LT0: Link Address Low */	\
+	(PCI_RCLINK_DCL_LINKENTS + ((x) * 16) + 0x08)
+#define	PCI_RCLINK_DCL_LINKADDR_LT0_HI(x) /* LT0: Link Address High */	\
+	(PCI_RCLINK_DCL_LINKENTS + ((x) * 16) + 0x0c)
+#define	PCI_RCLINK_DCL_LINKADDR_LT1_LO(x) /* LT1: Config Space (low) */	\
+	(PCI_RCLINK_DCL_LINKENTS + ((x) * 16) + 0x08)
+#define	PCI_RCLINK_DCL_LINKADDR_LT1_N	__BITS(2, 0)	/* N */
+#define	PCI_RCLINK_DCL_LINKADDR_LT1_FUNC __BITS(14, 12)	/* Function Number */
+#define	PCI_RCLINK_DCL_LINKADDR_LT1_DEV	__BITS(19, 15)	/* Device Number */
+#define	PCI_RCLINK_DCL_LINKADDR_LT1_BUS(N) __BITS(19 + (N), 20) /* Bus Number*/
+#define	PCI_RCLINK_DCL_LINKADDR_LT1_BAL(N) __BITS(31, 20 + (N)) /* BAddr(L) */
+#define	PCI_RCLINK_DCL_LINKADDR_LT1_HI(x) /* LT1: Config Space Base Addr(H) */\
+	(PCI_RCLINK_DCL_LINKENTS + ((x) * 16) + 0x0c)
+
+/*
+ * Extended capability ID: 0x0006
+ * Root Complex Internal Link Control
+ */
+
+/*
+ * Extended capability ID: 0x0007
+ * Root Complex Event Collector Association
+ */
+#define	PCI_RCEC_ASSOC_ASSOCBITMAP 0x04
+
+/*
+ * Extended capability ID: 0x0008
+ * Multi-Function Virtual Channel
+ */
+
+/*
+ * Extended capability ID: 0x0009
+ * Virtual Channel if MFVC Ext Cap set
+ */
+
+/*
+ * Extended capability ID: 0x000a
+ * RCRB Header
+ */
+
+/*
+ * Extended capability ID: 0x000b
+ * Vendor Unique
+ */
+
+/*
+ * Extended capability ID: 0x000c
+ * Configuration Access Correction
+ */
+
+/*
+ * Extended capability ID: 0x000d
+ * Access Control Services
+ */
+#define	PCI_ACS_CAP	0x04	/* Capability Register */
+#define PCI_ACS_CAP_V	__BIT(0)	/* Source Validation */
+#define PCI_ACS_CAP_B	__BIT(1)	/* Transaction Blocking */
+#define PCI_ACS_CAP_R	__BIT(2)	/* P2P Request Redirect */
+#define PCI_ACS_CAP_C	__BIT(3)	/* P2P Completion Redirect */
+#define PCI_ACS_CAP_U	__BIT(4)	/* Upstream Forwarding */
+#define PCI_ACS_CAP_E	__BIT(5)	/* Egress Control */
+#define PCI_ACS_CAP_T	__BIT(6)	/* Direct Translated P2P */
+#define PCI_ACS_CAP_ECVSIZE __BITS(15, 8) /* Egress Control Vector Size */
+#define	PCI_ACS_CTL	0x04	/* Control Register */
+#define PCI_ACS_CTL_V	__BIT(0 + 16)	/* Source Validation Enable */
+#define PCI_ACS_CTL_B	__BIT(1 + 16)	/* Transaction Blocking Enable */
+#define PCI_ACS_CTL_R	__BIT(2 + 16)	/* P2P Request Redirect Enable */
+#define PCI_ACS_CTL_C	__BIT(3 + 16)	/* P2P Completion Redirect Enable */
+#define PCI_ACS_CTL_U	__BIT(4 + 16)	/* Upstream Forwarding Enable */
+#define PCI_ACS_CTL_E	__BIT(5 + 16)	/* Egress Control Enable */
+#define PCI_ACS_CTL_T	__BIT(6 + 16)	/* Direct Translated P2P Enable */
+#define	PCI_ACS_ECV	0x08	/* Egress Control Vector */
+
+/*
+ * Extended capability ID: 0x000e
+ * ARI
+ */
+#define PCI_ARI_CAP	0x04	/* Capability Register */
+#define PCI_ARI_CAP_M		__BIT(0)	/* MFVC Function Groups Cap. */
+#define PCI_ARI_CAP_A		__BIT(1)	/* ACS Function Groups Cap. */
+#define PCI_ARI_CAP_NXTFN	__BITS(15, 8)	/* Next Function Number */
+#define PCI_ARI_CTL	0x04	/* Control Register */
+#define PCI_ARI_CTL_M		__BIT(16)	/* MFVC Function Groups Ena. */
+#define PCI_ARI_CTL_A		__BIT(17)	/* ACS Function Groups Ena. */
+#define PCI_ARI_CTL_FUNCGRP	__BITS(31, 24)	/* Function Group */
+
+/*
+ * Extended capability ID: 0x000f
+ * Address Translation Services
+ */
+#define	PCI_ATS_CAP	0x04	/* Capability Register */
+#define	PCI_ATS_CAP_INVQDEPTH	__BITS(4, 0)	/* Invalidate Queue Depth */
+#define	PCI_ATS_CAP_PALIGNREQ	__BIT(5)	/* Page Aligned Request */
+#define	PCI_ATS_CTL	0x04	/* Control Register */
+#define	PCI_ATS_CTL_STU		__BITS(20, 16)	/* Smallest Translation Unit */
+#define	PCI_ATS_CTL_EN		__BIT(31)	/* Enable */
+
+/*
+ * Extended capability ID: 0x0010
+ * SR-IOV
+ */
+#define	PCI_SRIOV_CAP		0x04	/* SR-IOV Capabilities */
+#define	  PCI_SRIOV_CAP_VF_MIGRATION		__BIT(0)
+#define	  PCI_SRIOV_CAP_ARI_CAP_HIER_PRESERVED	__BIT(1)
+#define	  PCI_SRIOV_CAP_VF_MIGRATION_INTMSG_N	__BITS(31, 21)
+#define	  PCI_SRIOV_CAP_VF_MIGRATION_INTMSG_N_S	21
+#define	  PCI_SRIOV_CAP_VF_MIGRATION_INTMSG_N_M	0x7ff
+#define	PCI_SRIOV_CTL		0x08	/* SR-IOV Control (16bit) */
+#define	  PCI_SRIOV_CTL_VF_ENABLE		__BIT(0)
+#define	  PCI_SRIOV_CTL_VF_MIGRATION_SUPPORT	__BIT(1)
+#define	  PCI_SRIOV_CTL_VF_MIGRATION_INT_ENABLE	__BIT(2)
+#define	  PCI_SRIOV_CTL_VF_MSE			__BIT(3)
+#define	  PCI_SRIOV_CTL_ARI_CAP_HIER		__BIT(4)
+#define	PCI_SRIOV_STA		0x0a	/* SR-IOV Status (16bit) */
+#define	  PCI_SRIOV_STA_VF_MIGRATION		__BIT(0)
+#define	PCI_SRIOV_INITIAL_VFS	0x0c	/* InitialVFs (16bit) */
+#define	PCI_SRIOV_TOTAL_VFS	0x0e	/* TotalVFs (16bit) */
+#define	PCI_SRIOV_NUM_VFS	0x10	/* NumVFs (16bit) */
+#define	PCI_SRIOV_FUNC_DEP_LINK	0x12	/* Function Dependency Link (16bit) */
+#define	PCI_SRIOV_VF_OFF	0x14	/* First VF Offset (16bit) */
+#define	PCI_SRIOV_VF_STRIDE	0x16	/* VF Stride (16bit) */
+#define	PCI_SRIOV_VF_DID	0x1a	/* VF Device ID (16bit) */
+#define	PCI_SRIOV_PAGE_CAP	0x1c	/* Supported Page Sizes */
+#define	PCI_SRIOV_PAGE_SIZE	0x20	/* System Page Size */
+#define	  PCI_SRIOV_BASE_PAGE_SHIFT	12
+#define	PCI_SRIOV_BARS		0x24	/* VF BAR0-5 */
+#define	PCI_SRIOV_BAR(x)	(PCI_SRIOV_BARS + ((x) * 4))
+#define	PCI_SRIOV_VF_MIG_STA_AR	0x3c	/* VF Migration State Array Offset */
+#define	  PCI_SRIOV_VF_MIG_STA_OFFSET	__BITS(31, 3)
+#define	  PCI_SRIOV_VF_MIG_STA_OFFSET_S	3
+#define	  PCI_SRIOV_VF_MIG_STA_OFFSET_M	0x1fffffff
+#define	  PCI_SRIOV_VF_MIG_STA_BIR		__BITS(2, 0)
+#define	  PCI_SRIOV_VF_MIG_STA_BIR_S		0
+#define	  PCI_SRIOV_VF_MIG_STA_BIR_M		0x7
+
+/*
+ * Extended capability ID: 0x0011
+ * Multiple Root IO Virtualization
+ */
+
+/*
+ * Extended capability ID: 0x0012
+ * Multicast
+ */
+
+/*
+ * Extended capability ID: 0x0013
+ * Page Request
+ */
+#define	PCI_PAGE_REQ_CTL	0x04	/* Control Register */
+#define	PCI_PAGE_REQ_CTL_E	__BIT(0)	/* Enalbe */
+#define	PCI_PAGE_REQ_CTL_R	__BIT(1)	/* Reset */
+#define	PCI_PAGE_REQ_STA	0x04	/* Status Register */
+#define	PCI_PAGE_REQ_STA_RF	__BIT(0+16)	/* Response Failure */
+#define	PCI_PAGE_REQ_STA_UPRGI	__BIT(1+16)   /* Unexpected Page Req Grp Idx */
+#define	PCI_PAGE_REQ_STA_S	__BIT(8+16)	/* Stopped */
+#define	PCI_PAGE_REQ_OUTSTCAPA	0x08	/* Outstanding Page Request Capacity */
+#define	PCI_PAGE_REQ_OUTSTALLOC	0x0c  /* Outstanding Page Request Allocation */
+
+/*
+ * Extended capability ID: 0x0014
+ * (Reserved for AMD)
+ */
+
+/*
+ * Extended capability ID: 0x0015
+ * Resizable BAR
+ */
+
+/*
+ * Extended capability ID: 0x0016
+ * Dynamic Power Allocation
+ */
+
+/*
+ * Extended capability ID: 0x0017
+ * TPH Requester
+ */
+#define	PCI_TPH_REQ_CAP	0x04	/* TPH Requester Capability */
+#define	PCI_TPH_REQ_CAP_NOST	__BIT(0)	/* No ST Mode Supported */
+#define	PCI_TPH_REQ_CAP_INTVEC	__BIT(1)	/* Intr Vec Mode Supported */
+#define	PCI_TPH_REQ_CAP_DEVSPEC	__BIT(2)   /* Device Specific Mode Supported */
+#define	PCI_TPH_REQ_CAP_XTPHREQ	__BIT(8)    /* Extend TPH Reqester Supported */
+#define	PCI_TPH_REQ_CAP_STTBLLOC __BITS(10, 9)	/* ST Table Location */
+#define	PCI_TPH_REQ_CAP_STTBLSIZ __BITS(26, 16)	/* ST Table Size */
+#define	PCI_TPH_REQ_CTL	0x08	/* TPH Requester Control */
+#define	PCI_TPH_REQ_CTL_STSEL	_BITS(2, 0)	/* ST Mode Select */
+#define	PCI_TPH_REQ_CTL_TPHREQEN _BITS(9, 8)	/* TPH Requester Enable */
+#define	PCI_TPH_REQ_STTBL 0x0c	/* TPH ST Table */
+
+/*
+ * Extended capability ID: 0x0018
+ * Latency Tolerance Reporting
+ */
+#define	PCI_LTR_MAXSNOOPLAT	0x04	/* Max Snoop Latency */
+#define	PCI_LTR_MAXSNOOPLAT_VAL	__BITS(9, 0)	/* Max Snoop LatencyValue */
+#define	PCI_LTR_MAXSNOOPLAT_SCALE __BITS(12, 10) /* Max Snoop LatencyScale */
+#define	PCI_LTR_MAXNOSNOOPLAT	0x04	/* Max No-Snoop Latency */
+#define	PCI_LTR_MAXNOSNOOPLAT_VAL __BITS(25, 16) /* Max No-Snoop LatencyValue*/
+#define	PCI_LTR_MAXNOSNOOPLAT_SCALE __BITS(28, 26) /*Max NoSnoop LatencyScale*/
+#define	PCI_LTR_SCALETONS(x) ((32 << (x)) / 32)
+
+/*
+ * Extended capability ID: 0x0019
+ * Seconday PCI Express Extended Capability
+ */
+#define PCI_SECPCIE_LCTL3	0x04	/* Link Control 3 */
+#define PCI_SECPCIE_LCTL3_PERFEQ	__BIT(0) /* Perform Equalization */
+#define PCI_SECPCIE_LCTL3_LINKEQREQ_IE	__BIT(1) /* Link Eq. Req. Int. Ena. */
+#define PCI_SECPCIE_LANEERR_STA 0x08	/* Lane Error Status */
+#define PCI_SECPCIE_EQCTLS	0x0c	/* Equalization Control [0-maxlane] */
+#define	PCI_SECPCIE_EQCTL(x)	(PCI_SECPCIE_EQCTLS + ((x) * 2))
+#define	PCI_SECPCIE_EQCTL_DP_XMIT_PRESET __BITS(3, 0) /* DwnStPort Xmit Pres */
+#define	PCI_SECPCIE_EQCTL_DP_RCV_HINT	__BITS(6, 4) /* DwnStPort Rcv PreHnt */
+#define	PCI_SECPCIE_EQCTL_UP_XMIT_PRESET __BITS(11, 8) /* UpStPort Xmit Pres */
+#define	PCI_SECPCIE_EQCTL_UP_RCV_HINT	__BITS(14, 12) /* UpStPort Rcv PreHnt*/
+
+/*
+ * Extended capability ID: 0x001a
+ * Protocol Multiplexing
+ */
+
+/*
+ * Extended capability ID: 0x001b
+ * Process Address Space ID
+ */
+#define	PCI_PASID_CAP	0x04	/* Capability Register */
+#define	PCI_PASID_CAP_XPERM	__BIT(1)     /* Execute Permission Supported */
+#define	PCI_PASID_CAP_PRIVMODE	__BIT(2)	/* Privileged Mode Supported */
+#define	PCI_PASID_CAP_MAXPASIDW	__BITS(12, 8)	/* Max PASID Width */
+#define	PCI_PASID_CTL	0x04	/* Control Register */
+#define	PCI_PASID_CTL_PASID_EN	__BIT(0)	/* PASID Enable */
+#define	PCI_PASID_CTL_XPERM_EN	__BIT(1)	/* Execute Permission Enable */
+#define	PCI_PASID_CTL_PRIVMODE_EN __BIT(2)	/* Privileged Mode Enable */
+
+/*
+ * Extended capability ID: 0x001c
+ * LN Requester
+ */
+#define	PCI_LNR_CAP	0x04	/* Capability Register */
+#define	PCI_LNR_CAP_64		__BIT(0)	/* LNR-64 Supported */
+#define	PCI_LNR_CAP_128		__BIT(1)	/* LNR-128 Supported */
+#define	PCI_LNR_CAP_REGISTMAX	__BITS(12, 8)	/* LNR Registration MAX */
+#define	PCI_LNR_CTL	0x04	/* Control Register */
+#define	PCI_LNR_CTL_EN		__BIT(0+16)	/* LNR Enable */
+#define	PCI_LNR_CTL_CLS		__BIT(1+16)	/* LNR CLS */
+#define	PCI_LNR_CTL_REGISTLIM	__BITS(28, 24)	/* LNR Registration Limit */
+
+/*
+ * Extended capability ID: 0x001d
+ * Downstream Port Containment
+ */
+
+/*
+ * Extended capability ID: 0x001e
+ * L1 PM Substates
+ */
+#define	PCI_L1PM_CAP	0x04	/* Capabilities Register */
+#define	PCI_L1PM_CAP_PCIPM12	__BIT(0)	/* PCI-PM L1.2 Supported */
+#define	PCI_L1PM_CAP_PCIPM11	__BIT(1)	/* PCI-PM L1.1 Supported */
+#define	PCI_L1PM_CAP_ASPM12	__BIT(2)	/* ASPM L1.2 Supported */
+#define	PCI_L1PM_CAP_ASPM11	__BIT(3)	/* ASPM L1.1 Supported */
+#define	PCI_L1PM_CAP_L1PM	__BIT(4)	/* L1 PM Substates Supported */
+#define	PCI_L1PM_CAP_PCMRT	__BITS(15, 8) /*Port Common Mode Restore Time*/
+#define	PCI_L1PM_CAP_PTPOSCALE	__BITS(17, 16)	/* Port T_POWER_ON Scale */
+#define	PCI_L1PM_CAP_PTPOVAL	__BITS(23, 19)	/* Port T_POWER_ON Value */
+#define	PCI_L1PM_CTL1	0x08	/* Control Register 1 */
+#define	PCI_L1PM_CTL1_PCIPM12_EN __BIT(0)	/* PCI-PM L1.2 Enable */
+#define	PCI_L1PM_CTL1_PCIPM11_EN __BIT(1)	/* PCI-PM L1.1 Enable */
+#define	PCI_L1PM_CTL1_ASPM12_EN	__BIT(2)	/* ASPM L1.2 Enable */
+#define	PCI_L1PM_CTL1_ASPM11_EN	__BIT(3)	/* ASPM L1.1 Enable */
+#define	PCI_L1PM_CTL1_CMRT	__BITS(15, 8)	/* Common Mode Restore Time */
+#define	PCI_L1PM_CTL1_LTRTHVAL	__BITS(25, 16)	/* LTR L1.2 THRESHOLD Value */
+#define	PCI_L1PM_CTL1_LTRTHSCALE __BITS(31, 29)	/* LTR L1.2 THRESHOLD Scale */
+#define	PCI_L1PM_CTL2	0x0c	/* Control Register 2 */
+#define	PCI_L1PM_CTL2_TPOSCALE	__BITS(1, 0)	/* T_POWER_ON Scale */
+#define	PCI_L1PM_CTL2_TPOVAL	__BITS(7, 3)	/* T_POWER_ON Value */
+
+/*
+ * Local constants
+ */
+#define PCI_INTRSTR_LEN			64
+
+#endif /* _DEV_PCI_PCIREG_H_ */

Property changes on: lab4/.minix-src/include/dev/pci/pcireg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/bioscall.h
===================================================================
--- lab4/.minix-src/include/i386/bioscall.h	(nonexistent)
+++ lab4/.minix-src/include/i386/bioscall.h	(revision 13)
@@ -0,0 +1,102 @@
+/*	$NetBSD: bioscall.h,v 1.11 2008/04/28 20:23:24 martin Exp $ */
+
+/*-
+ * Copyright (c) 1997, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by John Kohl and Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __I386_BIOSCALL_H__
+#define __I386_BIOSCALL_H__
+
+/*
+ * virtual & physical address of the trampoline
+ * that we use: page 1.
+ */
+#define BIOSTRAMP_BASE	PAGE_SIZE
+
+#ifndef _LOCORE
+#define	BIOSREG_LO	0
+#define	BIOSREG_HI	1
+
+typedef	union {
+	u_char biosreg_quarter[4];
+	u_short biosreg_half[2];
+	u_int biosreg_long;
+} bios_reg;
+
+struct bioscallregs {
+    bios_reg r_ax;
+    bios_reg r_bx;
+    bios_reg r_cx;
+    bios_reg r_dx;
+    bios_reg r_si;
+    bios_reg r_di;
+    bios_reg r_flags;
+    bios_reg r_es;
+};
+
+#define	AL	r_ax.biosreg_quarter[BIOSREG_LO]
+#define	AH	r_ax.biosreg_quarter[BIOSREG_HI]
+#define	AX	r_ax.biosreg_half[BIOSREG_LO]
+#define	AX_HI	r_ax.biosreg_half[BIOSREG_HI]
+#define	EAX	r_ax.biosreg_long
+
+#define	BL	r_bx.biosreg_quarter[BIOSREG_LO]
+#define	BH	r_bx.biosreg_quarter[BIOSREG_HI]
+#define	BX	r_bx.biosreg_half[BIOSREG_LO]
+#define	BX_HI	r_bx.biosreg_half[BIOSREG_HI]
+#define	EBX	r_bx.biosreg_long
+
+#define	CL	r_cx.biosreg_quarter[BIOSREG_LO]
+#define	CH	r_cx.biosreg_quarter[BIOSREG_HI]
+#define	CX	r_cx.biosreg_half[BIOSREG_LO]
+#define	CX_HI	r_cx.biosreg_half[BIOSREG_HI]
+#define	ECX	r_cx.biosreg_long
+
+#define	DL	r_dx.biosreg_quarter[BIOSREG_LO]
+#define	DH	r_dx.biosreg_quarter[BIOSREG_HI]
+#define	DX	r_dx.biosreg_half[BIOSREG_LO]
+#define	DX_HI	r_dx.biosreg_half[BIOSREG_HI]
+#define	EDX	r_dx.biosreg_long
+
+#define	SI	r_si.biosreg_half[BIOSREG_LO]
+#define	SI_HI	r_si.biosreg_half[BIOSREG_HI]
+#define	ESI	r_si.biosreg_long
+
+#define	DI	r_di.biosreg_half[BIOSREG_LO]
+#define	DI_HI	r_di.biosreg_half[BIOSREG_HI]
+#define	EDI	r_di.biosreg_long
+
+#define	FLAGS	 r_flags.biosreg_half[BIOSREG_LO]
+#define	FLAGS_HI r_flags.biosreg_half[BIOSREG_HI]
+#define	EFLAGS	 r_flags.biosreg_long
+
+#define ES	r_es.biosreg_half[BIOSREG_LO]
+
+void bioscall(int /* function*/ , struct bioscallregs * /* regs */);
+#endif
+#endif /* __I386_BIOSCALL_H__ */

Property changes on: lab4/.minix-src/include/i386/bioscall.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/bufferevent_ssl.h
===================================================================
--- lab4/.minix-src/include/event2/bufferevent_ssl.h	(nonexistent)
+++ lab4/.minix-src/include/event2/bufferevent_ssl.h	(revision 13)
@@ -0,0 +1,109 @@
+/*	$NetBSD: bufferevent_ssl.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*	$NetBSD: bufferevent_ssl.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*
+ * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_BUFFEREVENT_SSL_H_
+#define _EVENT2_BUFFEREVENT_SSL_H_
+
+/** @file event2/bufferevent_ssl.h
+
+    OpenSSL support for bufferevents.
+ */
+
+#include <event2/event-config.h>
+#include <event2/bufferevent.h>
+#include <event2/util.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* This is what openssl's SSL objects are underneath. */
+struct ssl_st;
+
+/**
+   The state of an SSL object to be used when creating a new
+   SSL bufferevent.
+ */
+enum bufferevent_ssl_state {
+	BUFFEREVENT_SSL_OPEN = 0,
+	BUFFEREVENT_SSL_CONNECTING = 1,
+	BUFFEREVENT_SSL_ACCEPTING = 2
+};
+
+#if defined(_EVENT_HAVE_OPENSSL) || defined(_EVENT_IN_DOXYGEN)
+/**
+   Create a new SSL bufferevent to send its data over another bufferevent.
+
+   @param base An event_base to use to detect reading and writing.  It
+      must also be the base for the underlying bufferevent.
+   @param underlying A socket to use for this SSL
+   @param ssl A SSL* object from openssl.
+   @param state The current state of the SSL connection
+   @param options One or more bufferevent_options
+   @return A new bufferevent on success, or NULL on failure
+*/
+struct bufferevent *
+bufferevent_openssl_filter_new(struct event_base *base,
+    struct bufferevent *underlying,
+    struct ssl_st *ssl,
+    enum bufferevent_ssl_state state,
+    int options);
+
+/**
+   Create a new SSL bufferevent to send its data over an SSL * on a socket.
+
+   @param base An event_base to use to detect reading and writing
+   @param fd A socket to use for this SSL
+   @param ssl A SSL* object from openssl.
+   @param state The current state of the SSL connection
+   @param options One or more bufferevent_options
+   @return A new bufferevent on success, or NULL on failure.
+*/
+struct bufferevent *
+bufferevent_openssl_socket_new(struct event_base *base,
+    evutil_socket_t fd,
+    struct ssl_st *ssl,
+    enum bufferevent_ssl_state state,
+    int options);
+
+/** Return the underlying openssl SSL * object for an SSL bufferevent. */
+struct ssl_st *
+bufferevent_openssl_get_ssl(struct bufferevent *bufev);
+
+/** Tells a bufferevent to begin SSL renegotiation. */
+int bufferevent_ssl_renegotiate(struct bufferevent *bev);
+
+/** Return the most recent OpenSSL error reported on an SSL bufferevent. */
+unsigned long bufferevent_get_openssl_error(struct bufferevent *bev);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_BUFFEREVENT_SSL_H_ */

Property changes on: lab4/.minix-src/include/event2/bufferevent_ssl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/cdefs.h
===================================================================
--- lab4/.minix-src/include/i386/cdefs.h	(nonexistent)
+++ lab4/.minix-src/include/i386/cdefs.h	(revision 13)
@@ -0,0 +1,12 @@
+/*	$NetBSD: cdefs.h,v 1.9 2012/01/20 14:08:06 joerg Exp $	*/
+
+#ifndef	_I386_CDEFS_H_
+#define	_I386_CDEFS_H_
+
+#if defined(_STANDALONE)
+#define	__compactcall	__attribute__((__regparm__(3)))
+#endif
+
+#define __ALIGNBYTES	(sizeof(int) - 1)
+
+#endif /* !_I386_CDEFS_H_ */

Property changes on: lab4/.minix-src/include/i386/cdefs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/dns_struct.h
===================================================================
--- lab4/.minix-src/include/event2/dns_struct.h	(nonexistent)
+++ lab4/.minix-src/include/event2/dns_struct.h	(revision 13)
@@ -0,0 +1,82 @@
+/*	$NetBSD: dns_struct.h,v 1.1.1.2 2015/01/29 06:38:26 spz Exp $	*/
+/*	$NetBSD: dns_struct.h,v 1.1.1.2 2015/01/29 06:38:26 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_DNS_STRUCT_H_
+#define _EVENT2_DNS_STRUCT_H_
+
+/** @file event2/dns_struct.h
+
+  Data structures for dns.  Using these structures may hurt forward
+  compatibility with later versions of Libevent: be careful!
+
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+/* For int types. */
+#include <event2/util.h>
+
+/*
+ * Structures used to implement a DNS server.
+ */
+
+struct evdns_server_request {
+	int flags;
+	int nquestions;
+	struct evdns_server_question **questions;
+};
+struct evdns_server_question {
+	int type;
+#ifdef __cplusplus
+	int dns_question_class;
+#else
+	/* You should refer to this field as "dns_question_class".  The
+	 * name "class" works in C for backward compatibility, and will be
+	 * removed in a future version. (1.5 or later). */
+	int class;
+#define dns_question_class class
+#endif
+	char name[1];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_DNS_STRUCT_H_ */
+

Property changes on: lab4/.minix-src/include/event2/dns_struct.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/pcidevs_data.h
===================================================================
--- lab4/.minix-src/include/dev/pci/pcidevs_data.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/pcidevs_data.h	(revision 13)
@@ -0,0 +1,14886 @@
+/*	$NetBSD: pcidevs_data.h,v 1.1228 2015/08/28 13:10:42 nonaka Exp $	*/
+
+/*
+ * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
+ *
+ * generated from:
+ *	NetBSD: pcidevs,v 1.1235 2015/08/28 13:09:48 nonaka Exp
+ */
+
+/*
+ * Copyright (c) 1995, 1996 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou
+ *	for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+static const uint16_t pci_vendors[] = {
+	    PCI_VENDOR_PEAK, 1, 6, 13, 0,
+	    PCI_VENDOR_MARTINMARIETTA, 21, 0,
+	    PCI_VENDOR_HAUPPAUGE, 37, 47, 56, 0,
+	    PCI_VENDOR_DYNALINK, 62, 0,
+	    PCI_VENDOR_COMPAQ, 71, 0,
+	    PCI_VENDOR_SYMBIOS, 78, 86, 0,
+	    PCI_VENDOR_ATI, 92, 96, 0,
+	    PCI_VENDOR_ULSI, 109, 114, 0,
+	    PCI_VENDOR_VLSI, 122, 127, 0,
+	    PCI_VENDOR_AVANCE, 138, 86, 0,
+	    PCI_VENDOR_REPLY, 145, 151, 0,
+	    PCI_VENDOR_NETFRAME, 157, 114, 0,
+	    PCI_VENDOR_EPSON, 166, 0,
+	    PCI_VENDOR_PHOENIX, 172, 96, 0,
+	    PCI_VENDOR_NS, 180, 189, 0,
+	    PCI_VENDOR_TSENG, 203, 209, 0,
+	    PCI_VENDOR_AST, 214, 218, 0,
+	    PCI_VENDOR_WEITEK, 227, 0,
+	    PCI_VENDOR_VIDEOLOGIC, 234, 86, 0,
+	    PCI_VENDOR_DEC, 240, 248, 0,
+	    PCI_VENDOR_MICRONICS, 258, 268, 0,
+	    PCI_VENDOR_CIRRUS, 278, 86, 0,
+	    PCI_VENDOR_IBM, 285, 0,
+	    PCI_VENDOR_LSIL, 289, 86, 293, 296, 0,
+	    PCI_VENDOR_ICLPERSONAL, 303, 307, 114, 0,
+	    PCI_VENDOR_SPEA, 316, 321, 0,
+	    PCI_VENDOR_UNISYS, 330, 114, 0,
+	    PCI_VENDOR_ELITEGROUP, 337, 47, 114, 0,
+	    PCI_VENDOR_NCR, 348, 353, 360, 114, 0,
+	    PCI_VENDOR_VITESSE, 372, 189, 0,
+	    PCI_VENDOR_WD, 380, 240, 0,
+	    PCI_VENDOR_AMI, 388, 397, 0,
+	    PCI_VENDOR_PICTURETEL, 408, 0,
+	    PCI_VENDOR_HITACHICOMP, 419, 47, 427, 0,
+	    PCI_VENDOR_OKI, 436, 440, 449, 0,
+	    PCI_VENDOR_AMD, 458, 0,
+	    PCI_VENDOR_TRIDENT, 462, 470, 0,
+	    PCI_VENDOR_ZENITH, 483, 490, 114, 0,
+	    PCI_VENDOR_ACER, 495, 0,
+	    PCI_VENDOR_DELL, 500, 47, 0,
+	    PCI_VENDOR_SNI, 505, 513, 521, 0,
+	    PCI_VENDOR_LSILOGIC, 289, 524, 531, 540, 0,
+	    PCI_VENDOR_MATROX, 545, 0,
+	    PCI_VENDOR_CHIPS, 552, 558, 96, 0,
+	    PCI_VENDOR_WYSE, 562, 127, 0,
+	    PCI_VENDOR_OLIVETTI, 567, 576, 127, 0,
+	    PCI_VENDOR_TOSHIBA, 585, 593, 0,
+	    PCI_VENDOR_TMCRESEARCH, 601, 218, 0,
+	    PCI_VENDOR_MIRO, 605, 47, 427, 0,
+	    PCI_VENDOR_COMPAQ2, 71, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_NEC, 630, 0,
+	    PCI_VENDOR_BURNDY, 634, 0,
+	    PCI_VENDOR_COMPCOMM, 641, 647, 649, 218, 655, 0,
+	    PCI_VENDOR_FUTUREDOMAIN, 659, 666, 0,
+	    PCI_VENDOR_HITACHIMICRO, 673, 470, 0,
+	    PCI_VENDOR_AMP, 680, 0,
+	    PCI_VENDOR_SIS, 684, 692, 6, 0,
+	    PCI_VENDOR_SEIKOEPSON, 703, 166, 0,
+	    PCI_VENDOR_TATUNGAMERICA, 709, 293, 593, 0,
+	    PCI_VENDOR_HP, 716, 0,
+	    PCI_VENDOR_SOLLIDAY, 732, 741, 0,
+	    PCI_VENDOR_LOGICMODELLING, 86, 753, 0,
+	    PCI_VENDOR_KPC, 762, 769, 0,
+	    PCI_VENDOR_COMPUTREND, 777, 0,
+	    PCI_VENDOR_PCTECH, 788, 127, 0,
+	    PCI_VENDOR_ASUSTEK, 791, 47, 0,
+	    PCI_VENDOR_DPT, 799, 811, 127, 0,
+	    PCI_VENDOR_OPTI, 822, 0,
+	    PCI_VENDOR_IPCCORP, 827, 0,
+	    PCI_VENDOR_GENOA, 831, 114, 0,
+	    PCI_VENDOR_ELSA, 837, 0,
+	    PCI_VENDOR_FOUNTAINTECH, 842, 127, 0,
+	    PCI_VENDOR_SGSTHOMSON, 851, 863, 0,
+	    PCI_VENDOR_BUSLOGIC, 880, 0,
+	    PCI_VENDOR_TI, 889, 895, 0,
+	    PCI_VENDOR_SONY, 907, 0,
+	    PCI_VENDOR_OAKTECH, 912, 127, 0,
+	    PCI_VENDOR_COTIME, 916, 47, 0,
+	    PCI_VENDOR_WINBOND, 924, 932, 0,
+	    PCI_VENDOR_ANIGMA, 944, 0,
+	    PCI_VENDOR_YOUNGMICRO, 951, 957, 114, 0,
+	    PCI_VENDOR_HITACHI, 419, 0,
+	    PCI_VENDOR_EFARMICRO, 963, 470, 0,
+	    PCI_VENDOR_ICL, 303, 0,
+	    PCI_VENDOR_MOT, 968, 0,
+	    PCI_VENDOR_ETR, 932, 647, 977, 984, 0,
+	    PCI_VENDOR_TEKNOR, 988, 470, 0,
+	    PCI_VENDOR_PROMISE, 995, 127, 0,
+	    PCI_VENDOR_FOXCONN, 1003, 1011, 0,
+	    PCI_VENDOR_WIPRO, 1025, 1031, 0,
+	    PCI_VENDOR_NUMBER9, 1040, 1047, 47, 1049, 0,
+	    PCI_VENDOR_VTECH, 1057, 268, 0,
+	    PCI_VENDOR_INFOTRONIC, 1063, 593, 0,
+	    PCI_VENDOR_UMC, 1074, 863, 0,
+	    PCI_VENDOR_ITT, 1081, 1084, 1084, 0,
+	    PCI_VENDOR_MASPAR, 1087, 47, 0,
+	    PCI_VENDOR_OCEANOA, 1094, 1100, 1107, 0,
+	    PCI_VENDOR_ALCATEL, 1118, 1126, 0,
+	    PCI_VENDOR_TEXASMICRO, 889, 470, 0,
+	    PCI_VENDOR_PICOPOWER, 1130, 127, 0,
+	    PCI_VENDOR_MITSUBISHI, 1140, 932, 0,
+	    PCI_VENDOR_DIVERSIFIED, 1151, 127, 0,
+	    PCI_VENDOR_MYLEX, 1163, 0,
+	    PCI_VENDOR_ATEN, 1169, 218, 0,
+	    PCI_VENDOR_APPLE, 1174, 47, 0,
+	    PCI_VENDOR_HYUNDAI, 1180, 932, 593, 0,
+	    PCI_VENDOR_SEQUENT, 1188, 0,
+	    PCI_VENDOR_DFI, 1196, 0,
+	    PCI_VENDOR_CITYGATE, 1200, 1205, 1210, 0,
+	    PCI_VENDOR_DAEWOO, 1222, 1229, 0,
+	    PCI_VENDOR_MITAC, 1237, 0,
+	    PCI_VENDOR_GIT, 1243, 0,
+	    PCI_VENDOR_YAMAHA, 1247, 0,
+	    PCI_VENDOR_NEXGEN, 1254, 470, 0,
+	    PCI_VENDOR_AIR, 576, 1261, 218, 0,
+	    PCI_VENDOR_CHAINTECH, 1273, 47, 0,
+	    PCI_VENDOR_QLOGIC, 1283, 0,
+	    PCI_VENDOR_CYRIX, 1290, 0,
+	    PCI_VENDOR_IBUS, 1296, 0,
+	    PCI_VENDOR_NETWORTH, 1302, 0,
+	    PCI_VENDOR_GATEWAY, 1311, 1319, 0,
+	    PCI_VENDOR_GOLDSTAR, 1324, 0,
+	    PCI_VENDOR_LEADTEK, 1333, 218, 0,
+	    PCI_VENDOR_INTERPHASE, 1341, 0,
+	    PCI_VENDOR_DATATECH, 490, 127, 0,
+	    PCI_VENDOR_CONTAQ, 1352, 470, 0,
+	    PCI_VENDOR_SUPERMAC, 1359, 127, 0,
+	    PCI_VENDOR_EFA, 1368, 293, 593, 0,
+	    PCI_VENDOR_FOREX, 1372, 47, 0,
+	    PCI_VENDOR_PARADOR, 1378, 0,
+	    PCI_VENDOR_TULIP, 1386, 268, 0,
+	    PCI_VENDOR_JBOND, 1392, 1395, 47, 114, 0,
+	    PCI_VENDOR_CACHECOMP, 1400, 47, 0,
+	    PCI_VENDOR_MICROCOMP, 1406, 114, 0,
+	    PCI_VENDOR_DG, 490, 1420, 0,
+	    PCI_VENDOR_BIT3, 1428, 47, 0,
+	    PCI_VENDOR_ELONEX, 1433, 1440, 1444, 1448, 114, 0,
+	    PCI_VENDOR_OLICOM, 1457, 0,
+	    PCI_VENDOR_SUN, 1464, 470, 0,
+	    PCI_VENDOR_SYSTEMSOFT, 1468, 0,
+	    PCI_VENDOR_ENCORE, 1479, 47, 0,
+	    PCI_VENDOR_INTERGRAPH, 1486, 0,
+	    PCI_VENDOR_DIAMOND, 1497, 47, 114, 0,
+	    PCI_VENDOR_NATIONALINST, 180, 895, 0,
+	    PCI_VENDOR_FICOMP, 1505, 1511, 268, 0,
+	    PCI_VENDOR_CMDTECH, 1517, 127, 0,
+	    PCI_VENDOR_ALACRON, 1521, 0,
+	    PCI_VENDOR_APPIAN, 1529, 127, 0,
+	    PCI_VENDOR_QUANTUMDESIGNS, 1536, 1544, 0,
+	    PCI_VENDOR_SAMSUNGELEC, 1552, 932, 0,
+	    PCI_VENDOR_PACKARDBELL, 1560, 1568, 0,
+	    PCI_VENDOR_GEMLIGHT, 1573, 47, 0,
+	    PCI_VENDOR_MEGACHIPS, 1582, 0,
+	    PCI_VENDOR_ZIDA, 1592, 96, 0,
+	    PCI_VENDOR_BROOKTREE, 1597, 0,
+	    PCI_VENDOR_TRIGEM, 1607, 47, 0,
+	    PCI_VENDOR_MEIDENSHA, 1614, 0,
+	    PCI_VENDOR_JUKO, 1624, 932, 0,
+	    PCI_VENDOR_QUANTUM, 1536, 0,
+	    PCI_VENDOR_EVEREX, 1629, 114, 0,
+	    PCI_VENDOR_GLOBE, 1636, 1642, 1656, 0,
+	    PCI_VENDOR_RACAL, 1662, 1668, 0,
+	    PCI_VENDOR_INFORMTECH, 1677, 1688, 0,
+	    PCI_VENDOR_BENCHMARQ, 1699, 863, 0,
+	    PCI_VENDOR_SIERRA, 1709, 189, 0,
+	    PCI_VENDOR_SGI, 684, 1716, 0,
+	    PCI_VENDOR_ACC, 1725, 863, 0,
+	    PCI_VENDOR_DIGICOM, 1729, 0,
+	    PCI_VENDOR_HONEYWELL, 1737, 1747, 0,
+	    PCI_VENDOR_SYMPHONY, 1752, 209, 0,
+	    PCI_VENDOR_CORNERSTONE, 1761, 127, 0,
+	    PCI_VENDOR_MICROCOMPSON, 957, 47, 1773, 1782, 1786, 0,
+	    PCI_VENDOR_CARDEXPER, 1790, 127, 0,
+	    PCI_VENDOR_CABLETRON, 1801, 114, 0,
+	    PCI_VENDOR_RAYETHON, 1811, 0,
+	    PCI_VENDOR_DATABOOK, 1820, 0,
+	    PCI_VENDOR_STB, 1829, 114, 0,
+	    PCI_VENDOR_PLX, 1833, 127, 0,
+	    PCI_VENDOR_MADGE, 1837, 1843, 0,
+	    PCI_VENDOR_3COM, 1852, 0,
+	    PCI_VENDOR_SMC, 1857, 470, 0,
+	    PCI_VENDOR_ALI, 495, 209, 0,
+	    PCI_VENDOR_MITSUBISHIELEC, 1140, 932, 0,
+	    PCI_VENDOR_DAPHA, 1866, 932, 0,
+	    PCI_VENDOR_ALR, 576, 86, 218, 0,
+	    PCI_VENDOR_SURECOM, 1872, 127, 0,
+	    PCI_VENDOR_TSENGLABS, 203, 209, 1011, 0,
+	    PCI_VENDOR_MOST, 1880, 0,
+	    PCI_VENDOR_BOCA, 1885, 218, 0,
+	    PCI_VENDOR_ICM, 1890, 0,
+	    PCI_VENDOR_AUSPEX, 1894, 114, 0,
+	    PCI_VENDOR_SAMSUNGSEMI, 1552, 1901, 0,
+	    PCI_VENDOR_AWARD, 1916, 321, 1511, 0,
+	    PCI_VENDOR_XEROX, 1922, 0,
+	    PCI_VENDOR_RAMBUS, 1928, 0,
+	    PCI_VENDOR_MEDIAVIS, 1935, 1941, 0,
+	    PCI_VENDOR_NEOMAGIC, 1948, 0,
+	    PCI_VENDOR_DATAEXPERT, 1957, 0,
+	    PCI_VENDOR_FUJITSU, 1968, 0,
+	    PCI_VENDOR_OMRON, 1976, 0,
+	    PCI_VENDOR_MENTOR, 1982, 1989, 0,
+	    PCI_VENDOR_ADVSYS, 576, 6, 427, 0,
+	    PCI_VENDOR_RADIUS, 1993, 0,
+	    PCI_VENDOR_FUJITSU4, 1968, 2000, 615, 619, 626, 0,
+	    PCI_VENDOR_FUJITSU2, 1968, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_FUTUREPLUS, 2005, 114, 0,
+	    PCI_VENDOR_MOLEX, 2013, 0,
+	    PCI_VENDOR_JABIL, 2019, 2025, 0,
+	    PCI_VENDOR_HAULON, 2033, 863, 0,
+	    PCI_VENDOR_AUTOLOGIC, 2040, 0,
+	    PCI_VENDOR_CETIA, 2050, 0,
+	    PCI_VENDOR_BCM, 2056, 576, 0,
+	    PCI_VENDOR_APL, 576, 2060, 209, 0,
+	    PCI_VENDOR_MACRONIX, 2072, 0,
+	    PCI_VENDOR_THOMASCONRAD, 2081, 0,
+	    PCI_VENDOR_ROHM, 2095, 218, 0,
+	    PCI_VENDOR_CERN, 2100, 0,
+	    PCI_VENDOR_ES, 2113, 647, 2119, 0,
+	    PCI_VENDOR_NVIDIA, 2130, 0,
+	    PCI_VENDOR_EMULEX, 2137, 0,
+	    PCI_VENDOR_IMS, 692, 957, 2144, 0,
+	    PCI_VENDOR_TEKRAM, 2154, 127, 2161, 615, 619, 626, 0,
+	    PCI_VENDOR_APTIX, 2166, 0,
+	    PCI_VENDOR_NEWBRIDGE, 2172, 470, 2182, 2184, 189, 0,
+	    PCI_VENDOR_TANDEM, 2191, 268, 0,
+	    PCI_VENDOR_MICROINDUSTRIES, 957, 2198, 0,
+	    PCI_VENDOR_GAINBERY, 2209, 47, 427, 0,
+	    PCI_VENDOR_VADEM, 2218, 0,
+	    PCI_VENDOR_AMCIRCUITS, 2224, 957, 2232, 0,
+	    PCI_VENDOR_ALPSELECTIC, 2241, 440, 0,
+	    PCI_VENDOR_INTEGRAPHICS, 2246, 114, 0,
+	    PCI_VENDOR_ARTISTSGRAPHICS, 2259, 1716, 0,
+	    PCI_VENDOR_REALTEK, 2267, 189, 0,
+	    PCI_VENDOR_ASCIICORP, 2275, 0,
+	    PCI_VENDOR_XILINX, 2281, 0,
+	    PCI_VENDOR_RACORE, 2288, 47, 427, 0,
+	    PCI_VENDOR_PERITEK, 2295, 0,
+	    PCI_VENDOR_TYAN, 2303, 47, 0,
+	    PCI_VENDOR_ACHME, 2308, 47, 0,
+	    PCI_VENDOR_ALARIS, 2314, 0,
+	    PCI_VENDOR_SMOS, 2321, 114, 0,
+	    PCI_VENDOR_NKK, 2327, 0,
+	    PCI_VENDOR_CREATIVE, 2331, 2340, 114, 0,
+	    PCI_VENDOR_MATSUSHITA, 2351, 0,
+	    PCI_VENDOR_ALTOS, 2362, 2368, 0,
+	    PCI_VENDOR_PCDIRECT, 788, 2374, 0,
+	    PCI_VENDOR_TRUEVISIO, 2381, 0,
+	    PCI_VENDOR_THESYS, 2392, 2399, 2404, 2407, 0,
+	    PCI_VENDOR_IODATA, 2423, 490, 2427, 0,
+	    PCI_VENDOR_SOYO, 2434, 127, 0,
+	    PCI_VENDOR_FAST, 2439, 2340, 0,
+	    PCI_VENDOR_NCUBE, 2444, 0,
+	    PCI_VENDOR_JAZZ, 2450, 2455, 0,
+	    PCI_VENDOR_INITIO, 2466, 0,
+	    PCI_VENDOR_CREATIVELABS, 2331, 209, 0,
+	    PCI_VENDOR_TRIONES, 2473, 96, 0,
+	    PCI_VENDOR_RASTEROPS, 2481, 0,
+	    PCI_VENDOR_SIGMA, 2491, 1544, 0,
+	    PCI_VENDOR_VIATECH, 2497, 96, 0,
+	    PCI_VENDOR_STRATIS, 2501, 47, 0,
+	    PCI_VENDOR_PROTEON, 2509, 0,
+	    PCI_VENDOR_COGENT, 2517, 490, 96, 0,
+	    PCI_VENDOR_SIEMENS, 505, 521, 2182, 505, 513, 521, 0,
+	    PCI_VENDOR_XENON, 2524, 470, 0,
+	    PCI_VENDOR_MINIMAX, 2530, 127, 0,
+	    PCI_VENDOR_ZNYX, 2539, 576, 114, 0,
+	    PCI_VENDOR_CPUTECH, 2544, 127, 0,
+	    PCI_VENDOR_ROSS, 2548, 127, 0,
+	    PCI_VENDOR_POWERHOUSE, 2553, 114, 0,
+	    PCI_VENDOR_SCO, 2564, 2570, 2575, 0,
+	    PCI_VENDOR_RNS, 2585, 0,
+	    PCI_VENDOR_ACCTON, 2589, 127, 0,
+	    PCI_VENDOR_ATMEL, 2596, 0,
+	    PCI_VENDOR_DUPONT, 2602, 2609, 114, 0,
+	    PCI_VENDOR_DATATRANSLATION, 490, 2615, 0,
+	    PCI_VENDOR_DATACUBE, 2627, 0,
+	    PCI_VENDOR_BERG, 2636, 932, 0,
+	    PCI_VENDOR_VORTEX, 2641, 47, 114, 0,
+	    PCI_VENDOR_EFFICIENTNETS, 2648, 1843, 0,
+	    PCI_VENDOR_TELEDYNE, 2657, 2340, 114, 0,
+	    PCI_VENDOR_TRICORD, 2666, 114, 0,
+	    PCI_VENDOR_IDT, 2674, 0,
+	    PCI_VENDOR_ELDEC, 2678, 0,
+	    PCI_VENDOR_PDI, 2684, 240, 2695, 0,
+	    PCI_VENDOR_EMC, 2702, 0,
+	    PCI_VENDOR_ZILOG, 2706, 0,
+	    PCI_VENDOR_MULTITECH, 2712, 114, 0,
+	    PCI_VENDOR_LEUTRON, 2723, 1941, 0,
+	    PCI_VENDOR_EUROCORE, 2731, 0,
+	    PCI_VENDOR_VIGRA, 2746, 0,
+	    PCI_VENDOR_FORE, 2752, 114, 0,
+	    PCI_VENDOR_FIRMWORKS, 2757, 0,
+	    PCI_VENDOR_HERMES, 2767, 932, 0,
+	    PCI_VENDOR_LINOTYPE, 2774, 0,
+	    PCI_VENDOR_RAVICAD, 2783, 0,
+	    PCI_VENDOR_INFOMEDIA, 2791, 863, 0,
+	    PCI_VENDOR_IMAGINGTECH, 2801, 2809, 0,
+	    PCI_VENDOR_COMPUTERVISION, 2819, 0,
+	    PCI_VENDOR_PHILIPS, 2834, 0,
+	    PCI_VENDOR_MITEL, 2842, 0,
+	    PCI_VENDOR_EICON, 2848, 127, 0,
+	    PCI_VENDOR_MCS, 2854, 47, 114, 0,
+	    PCI_VENDOR_FUJIXEROX, 2862, 1922, 0,
+	    PCI_VENDOR_MOMENTUM, 2867, 490, 114, 0,
+	    PCI_VENDOR_CISCO, 2876, 114, 0,
+	    PCI_VENDOR_ZIATECH, 2882, 0,
+	    PCI_VENDOR_DYNPIC, 2890, 2898, 0,
+	    PCI_VENDOR_FWB, 2907, 0,
+	    PCI_VENDOR_CYCLONE, 2911, 957, 0,
+	    PCI_VENDOR_LEADINGEDGE, 2919, 2927, 0,
+	    PCI_VENDOR_SANYO, 2932, 440, 0,
+	    PCI_VENDOR_EQUINOX, 2938, 114, 0,
+	    PCI_VENDOR_INTERVOICE, 2946, 0,
+	    PCI_VENDOR_CREST, 2957, 2963, 0,
+	    PCI_VENDOR_ALLIANCE, 2975, 189, 0,
+	    PCI_VENDOR_NETPOWER, 2984, 0,
+	    PCI_VENDOR_CINMILACRON, 2993, 3004, 0,
+	    PCI_VENDOR_WORKBIT, 3013, 0,
+	    PCI_VENDOR_FORCE, 3021, 268, 0,
+	    PCI_VENDOR_INTERFACE, 3027, 0,
+	    PCI_VENDOR_SCHNEIDERKOCH, 3037, 647, 3047, 0,
+	    PCI_VENDOR_WINSYSTEM, 3052, 6, 0,
+	    PCI_VENDOR_VMIC, 3056, 0,
+	    PCI_VENDOR_CANOPUS, 3061, 0,
+	    PCI_VENDOR_ANNABOOKS, 3069, 0,
+	    PCI_VENDOR_IC, 3079, 0,
+	    PCI_VENDOR_NIKON, 3082, 114, 0,
+	    PCI_VENDOR_DIGI, 3088, 1011, 0,
+	    PCI_VENDOR_TMC, 3093, 3102, 0,
+	    PCI_VENDOR_JAE, 3111, 932, 0,
+	    PCI_VENDOR_MEGATEK, 3115, 0,
+	    PCI_VENDOR_LANDWIN, 3123, 3052, 2340, 0,
+	    PCI_VENDOR_MELCO, 3128, 0,
+	    PCI_VENDOR_PINETECH, 3134, 127, 0,
+	    PCI_VENDOR_PERISCOPE, 3139, 741, 0,
+	    PCI_VENDOR_AVSYS, 3149, 0,
+	    PCI_VENDOR_VOARX, 3155, 3161, 647, 3163, 0,
+	    PCI_VENDOR_MUTECH, 3165, 0,
+	    PCI_VENDOR_HARLEQUIN, 3172, 0,
+	    PCI_VENDOR_PARALLAX, 3182, 1716, 0,
+	    PCI_VENDOR_XIRCOM, 3191, 0,
+	    PCI_VENDOR_PEERPROTO, 3198, 3203, 0,
+	    PCI_VENDOR_MAXTOR, 3213, 0,
+	    PCI_VENDOR_MEGASOFT, 3220, 0,
+	    PCI_VENDOR_PFU, 3229, 3233, 0,
+	    PCI_VENDOR_OALAB, 3241, 3244, 0,
+	    PCI_VENDOR_RENDITION, 3255, 0,
+	    PCI_VENDOR_APT, 576, 2060, 96, 0,
+	    PCI_VENDOR_IMAGRAPH, 3265, 0,
+	    PCI_VENDOR_SERVERWORKS, 3274, 0,
+	    PCI_VENDOR_MUTOH, 3286, 2198, 0,
+	    PCI_VENDOR_THINE, 3292, 932, 0,
+	    PCI_VENDOR_CDAC, 3298, 3305, 3309, 293, 576, 3314, 0,
+	    PCI_VENDOR_POLARIS, 3324, 3332, 0,
+	    PCI_VENDOR_CONNECTWARE, 3347, 0,
+	    PCI_VENDOR_WSTECH, 3359, 127, 0,
+	    PCI_VENDOR_INVENTEC, 3371, 0,
+	    PCI_VENDOR_LOUGHSOUND, 3380, 3393, 2695, 0,
+	    PCI_VENDOR_ALTERA, 3399, 0,
+	    PCI_VENDOR_ADOBE, 3406, 114, 0,
+	    PCI_VENDOR_BRIDGEPORT, 3412, 3102, 0,
+	    PCI_VENDOR_MIRTRON, 3423, 47, 0,
+	    PCI_VENDOR_SBE, 3430, 0,
+	    PCI_VENDOR_SILICONENG, 684, 741, 0,
+	    PCI_VENDOR_ALFA, 3434, 0,
+	    PCI_VENDOR_TOSHIBA2, 585, 0,
+	    PCI_VENDOR_ATREND, 3439, 127, 0,
+	    PCI_VENDOR_ATTO, 3447, 127, 0,
+	    PCI_VENDOR_TR, 3452, 114, 0,
+	    PCI_VENDOR_RICOH, 3456, 0,
+	    PCI_VENDOR_TELEMATICS, 3462, 1011, 0,
+	    PCI_VENDOR_FUJIKURA, 3473, 0,
+	    PCI_VENDOR_FORKS, 3482, 0,
+	    PCI_VENDOR_DATAWORLD, 3488, 0,
+	    PCI_VENDOR_DLINK, 3498, 114, 0,
+	    PCI_VENDOR_ATL, 576, 3505, 3516, 0,
+	    PCI_VENDOR_SHIMA, 3528, 3534, 1642, 0,
+	    PCI_VENDOR_MATSUSHITA2, 2351, 932, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_HILEVEL, 3540, 127, 0,
+	    PCI_VENDOR_COROLLARY, 3548, 0,
+	    PCI_VENDOR_BITFLOW, 3559, 0,
+	    PCI_VENDOR_HERMSTEDT, 3567, 0,
+	    PCI_VENDOR_ACARD, 3577, 0,
+	    PCI_VENDOR_DENSAN, 3583, 0,
+	    PCI_VENDOR_ZEINET, 3590, 0,
+	    PCI_VENDOR_TOUCAN, 3597, 127, 0,
+	    PCI_VENDOR_RATOC, 3604, 114, 0,
+	    PCI_VENDOR_HYTEC, 3610, 2340, 0,
+	    PCI_VENDOR_GAGE, 3616, 2224, 3621, 0,
+	    PCI_VENDOR_LAMBDA, 3630, 114, 0,
+	    PCI_VENDOR_DCA, 240, 3332, 3637, 0,
+	    PCI_VENDOR_MINDSHARE, 3648, 3653, 0,
+	    PCI_VENDOR_OMEGA, 3659, 957, 0,
+	    PCI_VENDOR_ITI, 360, 127, 3665, 0,
+	    PCI_VENDOR_BUG, 3675, 3679, 0,
+	    PCI_VENDOR_FUJITSU3, 1968, 3687, 615, 619, 626, 0,
+	    PCI_VENDOR_BULL, 3692, 3697, 360, 114, 0,
+	    PCI_VENDOR_CONVEX, 3700, 47, 0,
+	    PCI_VENDOR_HAMAMATSU, 3707, 3717, 0,
+	    PCI_VENDOR_SIERRA2, 1709, 218, 647, 127, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_BARCO, 3727, 0,
+	    PCI_VENDOR_MICROUNITY, 3733, 114, 741, 0,
+	    PCI_VENDOR_PUREDATA, 3744, 490, 0,
+	    PCI_VENDOR_POWERCC, 3749, 3314, 0,
+	    PCI_VENDOR_INNOSYS, 3755, 0,
+	    PCI_VENDOR_ACTEL, 3763, 0,
+	    PCI_VENDOR_MARVELL, 3769, 0,
+	    PCI_VENDOR_CANNON, 3777, 3784, 0,
+	    PCI_VENDOR_LITEON, 3787, 3332, 0,
+	    PCI_VENDOR_SCITEX, 3795, 0,
+	    PCI_VENDOR_AVID, 3802, 127, 0,
+	    PCI_VENDOR_V3, 3807, 189, 0,
+	    PCI_VENDOR_APRICOT, 3810, 47, 0,
+	    PCI_VENDOR_KODAK, 3818, 3826, 0,
+	    PCI_VENDOR_BARR, 3832, 114, 0,
+	    PCI_VENDOR_LEITECH, 3837, 127, 0,
+	    PCI_VENDOR_RADSTONE, 3844, 127, 0,
+	    PCI_VENDOR_UNITEDVIDEO, 1074, 234, 0,
+	    PCI_VENDOR_MOT2, 968, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_XPOINT, 3853, 96, 0,
+	    PCI_VENDOR_PATHLIGHT, 3860, 127, 0,
+	    PCI_VENDOR_VIDEOTRON, 3870, 0,
+	    PCI_VENDOR_PYRAMID, 3880, 96, 0,
+	    PCI_VENDOR_NETPERIPH, 3888, 2060, 0,
+	    PCI_VENDOR_PINNACLE, 3896, 114, 0,
+	    PCI_VENDOR_IMI, 1011, 3905, 0,
+	    PCI_VENDOR_LUCENT, 3918, 96, 0,
+	    PCI_VENDOR_NEC2, 630, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_DOCTECH, 3925, 96, 0,
+	    PCI_VENDOR_SHIVA, 3934, 0,
+	    PCI_VENDOR_DCMDATA, 3940, 490, 114, 0,
+	    PCI_VENDOR_DOLPHIN, 3944, 3952, 2144, 0,
+	    PCI_VENDOR_MAGMA, 3965, 3970, 96, 3976, 0,
+	    PCI_VENDOR_LSISYS, 289, 114, 0,
+	    PCI_VENDOR_SPECIALIX, 3984, 218, 0,
+	    PCI_VENDOR_MKC, 3994, 647, 4002, 47, 0,
+	    PCI_VENDOR_HAL, 4013, 47, 114, 0,
+	    PCI_VENDOR_AURAVISION, 4017, 0,
+	    PCI_VENDOR_ANALOG, 4028, 4035, 0,
+	    PCI_VENDOR_SEGA, 4043, 4048, 0,
+	    PCI_VENDOR_ZORAN, 4060, 0,
+	    PCI_VENDOR_QUICKLOGIC, 4066, 0,
+	    PCI_VENDOR_COMPEX, 4077, 0,
+	    PCI_VENDOR_PMCSIERRA, 4084, 0,
+	    PCI_VENDOR_COMTROL, 4095, 0,
+	    PCI_VENDOR_CYCLADES, 4103, 0,
+	    PCI_VENDOR_ESSENTIAL, 4112, 3332, 0,
+	    PCI_VENDOR_O2MICRO, 4122, 957, 0,
+	    PCI_VENDOR_3DFX, 4125, 4130, 0,
+	    PCI_VENDOR_ARIEL, 4142, 0,
+	    PCI_VENDOR_HEURICON, 4148, 427, 0,
+	    PCI_VENDOR_AZTECH, 4166, 0,
+	    PCI_VENDOR_3DO, 4173, 4177, 1049, 0,
+	    PCI_VENDOR_CCUBE, 4181, 470, 0,
+	    PCI_VENDOR_JNI, 4188, 0,
+	    PCI_VENDOR_AVM, 4192, 0,
+	    PCI_VENDOR_SAMSUNGELEC2, 1552, 932, 610, 4196, 626, 0,
+	    PCI_VENDOR_STALLION, 4203, 96, 0,
+	    PCI_VENDOR_LINEARSYS, 4212, 114, 0,
+	    PCI_VENDOR_COREGA, 4219, 0,
+	    PCI_VENDOR_ASIX, 4226, 932, 0,
+	    PCI_VENDOR_AURORA, 4231, 96, 0,
+	    PCI_VENDOR_ESSTECH, 4238, 127, 0,
+	    PCI_VENDOR_INTERSIL, 4242, 0,
+	    PCI_VENDOR_NORTEL, 4251, 1843, 4258, 4268, 0,
+	    PCI_VENDOR_SILMOTION, 684, 4277, 0,
+	    PCI_VENDOR_ENSONIQ, 4284, 0,
+	    PCI_VENDOR_NETAPP, 3888, 4292, 0,
+	    PCI_VENDOR_TRANSMETA, 4302, 0,
+	    PCI_VENDOR_ROCKWELL, 4312, 189, 114, 0,
+	    PCI_VENDOR_DAVICOM, 4321, 189, 0,
+	    PCI_VENDOR_ITE, 692, 127, 4329, 0,
+	    PCI_VENDOR_ESSTECH2, 4238, 127, 0,
+	    PCI_VENDOR_TRITECH, 4337, 863, 0,
+	    PCI_VENDOR_KOFAX, 4345, 4351, 427, 0,
+	    PCI_VENDOR_ALTEON, 4357, 0,
+	    PCI_VENDOR_RISCOM, 4364, 0,
+	    PCI_VENDOR_USR, 4371, 4374, 4383, 0,
+	    PCI_VENDOR_USR2, 4371, 4374, 0,
+	    PCI_VENDOR_PICTUREEL, 4390, 4398, 0,
+	    PCI_VENDOR_NVIDIA_SGS, 4407, 647, 851, 863, 0,
+	    PCI_VENDOR_PERICOM, 4414, 1901, 0,
+	    PCI_VENDOR_RAINBOW, 4422, 96, 0,
+	    PCI_VENDOR_DATUM, 4430, 4436, 4441, 4456, 0,
+	    PCI_VENDOR_AUREAL, 4465, 189, 0,
+	    PCI_VENDOR_JUNIPER, 4472, 1843, 0,
+	    PCI_VENDOR_ADMTEK, 4480, 0,
+	    PCI_VENDOR_PACKETENGINES, 4487, 4494, 0,
+	    PCI_VENDOR_FORTEMEDIA, 4502, 1935, 0,
+	    PCI_VENDOR_SIIG, 4508, 0,
+	    PCI_VENDOR_MICROMEMORY, 957, 4513, 0,
+	    PCI_VENDOR_DOMEX, 4520, 0,
+	    PCI_VENDOR_QUATECH, 4526, 0,
+	    PCI_VENDOR_LMC, 4534, 1935, 0,
+	    PCI_VENDOR_NETGEAR, 4538, 0,
+	    PCI_VENDOR_MOXA, 4546, 96, 0,
+	    PCI_VENDOR_LEVELONE, 4551, 4557, 0,
+	    PCI_VENDOR_COLOGNECHIP, 4561, 4569, 1544, 0,
+	    PCI_VENDOR_ALACRITECH, 4574, 0,
+	    PCI_VENDOR_HIFN, 4585, 0,
+	    PCI_VENDOR_EXAR, 4590, 0,
+	    PCI_VENDOR_3WARE, 4595, 0,
+	    PCI_VENDOR_ABOCOM, 4601, 114, 0,
+	    PCI_VENDOR_PHOBOS, 4608, 0,
+	    PCI_VENDOR_NETBOOST, 4615, 0,
+	    PCI_VENDOR_SUNDANCETI, 4624, 127, 0,
+	    PCI_VENDOR_CMEDIA, 4633, 932, 0,
+	    PCI_VENDOR_ADVANTECH, 4641, 0,
+	    PCI_VENDOR_LAVA, 4651, 189, 1642, 0,
+	    PCI_VENDOR_SUNIX, 4656, 0,
+	    PCI_VENDOR_ICENSEMBLE, 3079, 4662, 2182, 2497, 96, 0,
+	    PCI_VENDOR_MICROSOFT, 4671, 0,
+	    PCI_VENDOR_OXFORDSEMI, 4681, 189, 0,
+	    PCI_VENDOR_CHELSIO, 4688, 3332, 0,
+	    PCI_VENDOR_TAMARACK, 4696, 863, 0,
+	    PCI_VENDOR_SAMSUNGELEC3, 1552, 932, 4705, 4196, 626, 0,
+	    PCI_VENDOR_ASKEY, 4710, 47, 0,
+	    PCI_VENDOR_AVERMEDIA, 4716, 96, 0,
+	    PCI_VENDOR_SYSTEMBASE, 6, 4726, 0,
+	    PCI_VENDOR_MARVELL2, 3769, 0,
+	    PCI_VENDOR_AIRONET, 4731, 4739, 3332, 0,
+	    PCI_VENDOR_COMPAL, 4748, 932, 0,
+	    PCI_VENDOR_MYRICOM, 4755, 0,
+	    PCI_VENDOR_TITAN, 4763, 932, 0,
+	    PCI_VENDOR_AVLAB, 4769, 127, 0,
+	    PCI_VENDOR_INVERTEX, 4775, 0,
+	    PCI_VENDOR_BROADCOM, 4784, 0,
+	    PCI_VENDOR_PLANEX, 4793, 3332, 0,
+	    PCI_VENDOR_CONEXANT, 4800, 114, 0,
+	    PCI_VENDOR_DELTA, 4809, 932, 0,
+	    PCI_VENDOR_ENE, 4815, 127, 0,
+	    PCI_VENDOR_TERRATEC, 4819, 2340, 0,
+	    PCI_VENDOR_PERLE, 4828, 114, 0,
+	    PCI_VENDOR_SOLIDUM, 4834, 114, 0,
+	    PCI_VENDOR_HP2, 716, 0,
+	    PCI_VENDOR_SYBA, 4842, 0,
+	    PCI_VENDOR_FARADAY, 4847, 127, 0,
+	    PCI_VENDOR_GEOCAST, 4855, 3888, 114, 0,
+	    PCI_VENDOR_BLUESTEEL, 4863, 1843, 0,
+	    PCI_VENDOR_VMWARE, 4873, 0,
+	    PCI_VENDOR_AGILENT, 4880, 96, 0,
+	    PCI_VENDOR_EUMITCOM, 4888, 0,
+	    PCI_VENDOR_NETSEC, 4897, 0,
+	    PCI_VENDOR_SIBYTE, 4784, 4904, 0,
+	    PCI_VENDOR_MYSON, 4913, 127, 0,
+	    PCI_VENDOR_MELLANOX, 4927, 96, 0,
+	    PCI_VENDOR_NDC, 180, 4936, 0,
+	    PCI_VENDOR_ACTIONTEC, 4945, 4952, 932, 0,
+	    PCI_VENDOR_ATHEROS, 4956, 3332, 0,
+	    PCI_VENDOR_GLOBALSUN, 353, 1464, 4964, 0,
+	    PCI_VENDOR_SAFENET, 4969, 0,
+	    PCI_VENDOR_MICREL, 4977, 0,
+	    PCI_VENDOR_NETOCTAVE, 4984, 0,
+	    PCI_VENDOR_LINKSYS, 4994, 0,
+	    PCI_VENDOR_ALTIMA, 5002, 0,
+	    PCI_VENDOR_ANTARES, 5009, 470, 0,
+	    PCI_VENDOR_CAVIUM, 5017, 0,
+	    PCI_VENDOR_FZJZEL, 5024, 5027, 2182, 5035, 0,
+	    PCI_VENDOR_BELKIN, 5039, 0,
+	    PCI_VENDOR_HAWKING, 5046, 127, 0,
+	    PCI_VENDOR_SANDBURST, 5054, 0,
+	    PCI_VENDOR_NETCHIP, 1833, 127, 5064, 0,
+	    PCI_VENDOR_I4, 5074, 0,
+	    PCI_VENDOR_ARECA, 5077, 0,
+	    PCI_VENDOR_S2IO, 5083, 96, 0,
+	    PCI_VENDOR_RDC, 5088, 189, 0,
+	    PCI_VENDOR_LINKSYS2, 4994, 0,
+	    PCI_VENDOR_RALINK, 5092, 96, 0,
+	    PCI_VENDOR_RMI, 5099, 863, 4436, 5104, 0,
+	    PCI_VENDOR_NETLOGIC, 5115, 470, 5104, 0,
+	    PCI_VENDOR_BBELEC, 5124, 647, 5124, 932, 0,
+	    PCI_VENDOR_XGI, 5126, 127, 0,
+	    PCI_VENDOR_RENESAS, 5130, 96, 0,
+	    PCI_VENDOR_FREESCALE, 5138, 189, 0,
+	    PCI_VENDOR_ATTANSIC, 5148, 96, 0,
+	    PCI_VENDOR_JMICRON, 5157, 127, 0,
+	    PCI_VENDOR_ASPEED, 5165, 127, 0,
+	    PCI_VENDOR_EVE, 5172, 0,
+	    PCI_VENDOR_QUMRANET, 5176, 0,
+	    PCI_VENDOR_ASMEDIA, 5185, 0,
+	    PCI_VENDOR_REDHAT, 5193, 5197, 0,
+	    PCI_VENDOR_FRESCO, 5201, 86, 0,
+	    PCI_VENDOR_QINHENG2, 5208, 5216, 932, 5224, 0,
+	    PCI_VENDOR_SYMPHONY2, 1752, 209, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_TEKRAM2, 2154, 127, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_SUNIX2, 4656, 5231, 0,
+	    PCI_VENDOR_HINT, 5234, 0,
+	    PCI_VENDOR_3DLABS, 5239, 209, 0,
+	    PCI_VENDOR_AVANCE2, 138, 86, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_ADDTRON, 5242, 127, 0,
+	    PCI_VENDOR_QINHENG, 5208, 5216, 932, 0,
+	    PCI_VENDOR_ICOMPRESSION, 4800, 5250, 0,
+	    PCI_VENDOR_INDCOMPSRC, 1688, 47, 5265, 0,
+	    PCI_VENDOR_NETVIN, 5272, 0,
+	    PCI_VENDOR_BUSLOGIC2, 5279, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_MEDIAQ, 5288, 0,
+	    PCI_VENDOR_GUILLEMOT, 5295, 0,
+	    PCI_VENDOR_TURTLE_BEACH, 5305, 5312, 0,
+	    PCI_VENDOR_S3, 5318, 0,
+	    PCI_VENDOR_NETPOWER2, 2984, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_XENSOURCE, 5321, 4436, 0,
+	    PCI_VENDOR_C4T, 5332, 5336, 0,
+	    PCI_VENDOR_DCI, 5344, 47, 0,
+	    PCI_VENDOR_KURUSUGAWA, 5353, 932, 0,
+	    PCI_VENDOR_PCHDTV, 5364, 0,
+	    PCI_VENDOR_QUANCOM, 5371, 2340, 5379, 0,
+	    PCI_VENDOR_INTEL, 5384, 0,
+	    PCI_VENDOR_VIRTUALBOX, 5390, 0,
+	    PCI_VENDOR_TRIGEM2, 1607, 47, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_PROLAN, 5401, 0,
+	    PCI_VENDOR_COMPUTONE, 5408, 0,
+	    PCI_VENDOR_KTI, 5418, 0,
+	    PCI_VENDOR_ADP, 5422, 0,
+	    PCI_VENDOR_ADP2, 5422, 610, 615, 619, 626, 0,
+	    PCI_VENDOR_ATRONICS, 5430, 0,
+	    PCI_VENDOR_NETMOS, 5439, 0,
+	    PCI_VENDOR_PARALLELS, 5446, 0,
+	    PCI_VENDOR_CHRYSALIS, 5456, 0,
+	    PCI_VENDOR_MIDDLE_DIGITAL, 5470, 240, 0,
+	    PCI_VENDOR_ARC, 1989, 86, 0,
+	    PCI_VENDOR_INVALID, 5477, 5485, 5492, 0,
+};
+
+static const uint16_t pci_products[] = {
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C985, 
+	    5495, 5501, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C996, 
+	    5518, 5524, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C556MODEM, 
+	    5536, 5542, 5547, 5556, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C940, 
+	    5562, 5501, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C339, 
+	    5568, 5574, 5584, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C359, 
+	    5593, 5574, 5584, 5599, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C450TX, 
+	    5602, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C575TX, 
+	    5618, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C575BTX, 
+	    5627, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C575CTX, 
+	    5638, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C590, 
+	    5649, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595TX, 
+	    5655, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595T4, 
+	    5664, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595MII, 
+	    5673, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C555, 
+	    5683, 5611, 5547, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C154G72, 
+	    5689, 4739, 4534, 5701, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C556, 
+	    5536, 5611, 5547, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C556B, 
+	    5709, 5611, 5547, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C656_E, 
+	    5716, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C656_M, 
+	    5716, 5726, 5556, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C656B_E, 
+	    5730, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C656B_M, 
+	    5730, 5726, 5556, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C656C_E, 
+	    5741, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C656C_M, 
+	    5741, 5726, 5556, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CSOHO100TX, 
+	    5752, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CRWE777A, 
+	    5765, 5775, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C804, 
+	    5786, 5792, 5801, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_TOKEN, 
+	    5805, 5811, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900TPO, 
+	    5816, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900COMBO, 
+	    5826, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905TX, 
+	    5838, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905T4, 
+	    5847, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900BTPO, 
+	    5856, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900BCOMBO, 
+	    5867, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900BTPC, 
+	    5880, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BTX, 
+	    5891, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BT4, 
+	    5901, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BCOMBO, 
+	    5911, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BFX, 
+	    5924, 5934, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905CTX, 
+	    5938, 5611, 5509, 5948, 5951, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905CXTX, 
+	    5957, 5611, 5509, 5948, 5951, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C920BEMBW, 
+	    5968, 692, 2439, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C910SOHOB, 
+	    5983, 5989, 6003, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C980SRV, 
+	    6011, 6017, 5701, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C980CTXM, 
+	    6024, 5611, 5509, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990, 
+	    6035, 5611, 5509, 5948, 6044, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990TX95, 
+	    6048, 5611, 5509, 5948, 6044, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990TX97, 
+	    6061, 5611, 5509, 5948, 6044, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C990B, 
+	    6074, 5611, 5509, 5948, 6044, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990FX, 
+	    6081, 5934, 5509, 5948, 6044, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990SVR95, 
+	    6091, 5611, 5509, 5948, 6044, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990SVR97, 
+	    6105, 5611, 5509, 5948, 6044, 0,
+	    PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C990BSVR, 
+	    6119, 5611, 5509, 5948, 6044, 0,
+	    PCI_VENDOR_3DFX, PCI_PRODUCT_3DFX_VOODOO, 
+	    6129, 0,
+	    PCI_VENDOR_3DFX, PCI_PRODUCT_3DFX_VOODOO2, 
+	    6136, 0,
+	    PCI_VENDOR_3DFX, PCI_PRODUCT_3DFX_BANSHEE, 
+	    6144, 0,
+	    PCI_VENDOR_3DFX, PCI_PRODUCT_3DFX_VOODOO3, 
+	    6152, 0,
+	    PCI_VENDOR_3DFX, PCI_PRODUCT_3DFX_VOODOO5, 
+	    6129, 6160, 0,
+	    PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_300SX, 
+	    6164, 6170, 0,
+	    PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_500TX, 
+	    6164, 6176, 0,
+	    PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_DELTA, 
+	    6164, 6182, 0,
+	    PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_PERMEDIA, 
+	    6164, 6188, 0,
+	    PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_500MX, 
+	    6164, 6197, 0,
+	    PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_PERMEDIA2, 
+	    6164, 6188, 6203, 0,
+	    PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_GAMMA, 
+	    6164, 6205, 0,
+	    PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_PERMEDIA2V, 
+	    6164, 6188, 6211, 0,
+	    PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_PERMEDIA3, 
+	    6164, 6188, 6214, 0,
+	    PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT5110, 
+	    6216, 6224, 0,
+	    PCI_VENDOR_3WARE, PCI_PRODUCT_3WARE_ESCALADE, 
+	    6229, 6238, 6242, 6247, 0,
+	    PCI_VENDOR_3WARE, PCI_PRODUCT_3WARE_ESCALADE_ASIC, 
+	    6229, 6238, 6242, 6258, 6268, 6247, 0,
+	    PCI_VENDOR_3WARE, PCI_PRODUCT_3WARE_9000, 
+	    6275, 6268, 6242, 0,
+	    PCI_VENDOR_3WARE, PCI_PRODUCT_3WARE_9550, 
+	    6280, 6268, 6242, 0,
+	    PCI_VENDOR_3WARE, PCI_PRODUCT_3WARE_9650, 
+	    6285, 6268, 6242, 0,
+	    PCI_VENDOR_3WARE, PCI_PRODUCT_3WARE_9690, 
+	    6290, 6268, 6242, 0,
+	    PCI_VENDOR_3WARE, PCI_PRODUCT_3WARE_9750, 
+	    6295, 6268, 6242, 0,
+	    PCI_VENDOR_ABOCOM, PCI_PRODUCT_ABOCOM_FE2500, 
+	    6300, 5611, 5509, 0,
+	    PCI_VENDOR_ABOCOM, PCI_PRODUCT_ABOCOM_PCM200, 
+	    6307, 5611, 5509, 0,
+	    PCI_VENDOR_ABOCOM, PCI_PRODUCT_ABOCOM_FE2000VX, 
+	    6314, 5611, 5509, 6323, 0,
+	    PCI_VENDOR_ABOCOM, PCI_PRODUCT_ABOCOM_FE2500MX, 
+	    6329, 5611, 5509, 0,
+	    PCI_VENDOR_ACC, PCI_PRODUCT_ACC_2188, 
+	    6338, 6343, 6348, 6355, 0,
+	    PCI_VENDOR_ACC, PCI_PRODUCT_ACC_2051_HB, 
+	    6362, 615, 6367, 4569, 6374, 6383, 6389, 0,
+	    PCI_VENDOR_ACC, PCI_PRODUCT_ACC_2051_ISA, 
+	    6362, 615, 6367, 4569, 6374, 6397, 6389, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_ATP850U, 
+	    6402, 6413, 6418, 6247, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_ATP860, 
+	    6422, 6413, 6418, 6247, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_ATP860A, 
+	    6429, 6413, 6418, 6247, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_ATP865, 
+	    6438, 6413, 6418, 6247, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_ATP865A, 
+	    6445, 6413, 6418, 6247, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6710, 
+	    6454, 6462, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6712UW, 
+	    6467, 6462, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6712U, 
+	    6477, 6462, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6712S, 
+	    6486, 6462, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6710D, 
+	    6495, 6462, 0,
+	    PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6715UW, 
+	    6504, 6462, 0,
+	    PCI_VENDOR_ACCTON, PCI_PRODUCT_ACCTON_MPX5030, 
+	    6514, 6518, 5509, 0,
+	    PCI_VENDOR_ACCTON, PCI_PRODUCT_ACCTON_EN2242, 
+	    6528, 5611, 5509, 0,
+	    PCI_VENDOR_ACER, PCI_PRODUCT_ACER_M1435, 
+	    6535, 6348, 6355, 0,
+	    PCI_VENDOR_ADVANTECH, PCI_PRODUCT_ADVANTECH_PCI1600, 
+	    6541, 6553, 0,
+	    PCI_VENDOR_ADVANTECH, PCI_PRODUCT_ADVANTECH_PCI1604, 
+	    6560, 6553, 0,
+	    PCI_VENDOR_ADVANTECH, PCI_PRODUCT_ADVANTECH_PCI1610, 
+	    6569, 6578, 6580, 6553, 0,
+	    PCI_VENDOR_ADVANTECH, PCI_PRODUCT_ADVANTECH_PCI1612, 
+	    6585, 6578, 6580, 6553, 0,
+	    PCI_VENDOR_ADVANTECH, PCI_PRODUCT_ADVANTECH_PCI1620, 
+	    6594, 6603, 6580, 6553, 6605, 0,
+	    PCI_VENDOR_ADVANTECH, PCI_PRODUCT_ADVANTECH_PCI1620_1, 
+	    6594, 6603, 6580, 6553, 6611, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1445, 
+	    6617, 6348, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1449, 
+	    6623, 6629, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1451, 
+	    6637, 6643, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1461, 
+	    6652, 6643, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1531, 
+	    6658, 6643, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1533, 
+	    6664, 6629, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1541, 
+	    6670, 6643, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1543, 
+	    6676, 6629, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1563, 
+	    6682, 6629, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1647, 
+	    6688, 6643, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1689, 
+	    6694, 6643, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M3309, 
+	    6700, 6706, 6711, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M4803, 
+	    6719, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5257, 
+	    6725, 615, 321, 5556, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5229, 
+	    6731, 6413, 6418, 6247, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5237, 
+	    6737, 6743, 6747, 6751, 6247, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5239, 
+	    6756, 6743, 6762, 6751, 6247, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5243, 
+	    6766, 6772, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5247, 
+	    6780, 6772, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5249, 
+	    6786, 6792, 6807, 615, 6355, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5261, 
+	    6810, 1386, 5509, 6247, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5288, 
+	    6816, 6822, 6247, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5451, 
+	    6832, 6838, 6247, 6846, 2427, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5453, 
+	    6852, 6838, 6247, 5556, 2427, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5455, 
+	    6858, 6838, 6247, 6846, 2427, 0,
+	    PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M7101, 
+	    6864, 3749, 6870, 6247, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC1160, 
+	    6881, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7850, 
+	    6890, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7855, 
+	    6899, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC5900, 
+	    6908, 6917, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC5905, 
+	    6921, 6917, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC6915, 
+	    6930, 5611, 5509, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7860, 
+	    6939, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_APA1480, 
+	    6948, 6957, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940AU, 
+	    6963, 6957, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7870, 
+	    6973, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940, 
+	    6982, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_3940, 
+	    6991, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_3985, 
+	    7000, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2944, 
+	    7009, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7895, 
+	    7018, 6957, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7880, 
+	    7027, 6957, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940U, 
+	    6982, 6957, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_3940U, 
+	    6991, 6957, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_389XU, 
+	    7036, 6957, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2944U, 
+	    7009, 6957, 0,
+	    PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940UP, 
+	    6982, 6957, 7045, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_2940U2, 
+	    7049, 7060, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_2930U2, 
+	    7063, 7060, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7890, 
+	    7074, 7060, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_3950U2B, 
+	    7085, 7060, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_3950U2D, 
+	    7097, 7060, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7896, 
+	    7109, 7060, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7892A, 
+	    7120, 7130, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7892B, 
+	    7135, 7130, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7892D, 
+	    7145, 7130, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7892P, 
+	    7155, 7130, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7899A, 
+	    7165, 7130, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7899B, 
+	    7175, 7130, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7899D, 
+	    7185, 7130, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7899F, 
+	    7195, 6242, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7899P, 
+	    7205, 7130, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_1420SA, 
+	    6242, 7215, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_1430SA, 
+	    6242, 7222, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AAC2622, 
+	    7229, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_ASR2200S, 
+	    7238, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_ASR2120S, 
+	    7248, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_ASR2200S_SUB2M, 
+	    7238, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_ASR2410SA, 
+	    7258, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AAR2810SA, 
+	    7269, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_3405, 
+	    6242, 7280, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_3805, 
+	    6242, 7285, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_2405, 
+	    6242, 7290, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AAC364, 
+	    7295, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_ASR5400S, 
+	    7303, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_PERC_2QC, 
+	    500, 7313, 7318, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_PERC_3QC, 
+	    500, 7313, 7323, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_HP_M110_G2, 
+	    7328, 7331, 7336, 2182, 7339, 0,
+	    PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_SERVERAID, 
+	    7350, 7360, 7364, 0,
+	    PCI_VENDOR_ADDTRON, PCI_PRODUCT_ADDTRON_8139, 
+	    7372, 5509, 0,
+	    PCI_VENDOR_ADDTRON, PCI_PRODUCT_ADDTRON_RHINEII, 
+	    7377, 7383, 5611, 5509, 0,
+	    PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_AL981, 
+	    7386, 7392, 5611, 5509, 0,
+	    PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_AN983, 
+	    7400, 7406, 5611, 5509, 0,
+	    PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_AN985, 
+	    7418, 7424, 5611, 5509, 0,
+	    PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_ADM5120, 
+	    7436, 7445, 615, 6751, 6355, 0,
+	    PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_ADM8211, 
+	    7453, 7461, 7468, 7476, 0,
+	    PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_ADM9511, 
+	    7481, 7489, 5611, 5509, 0,
+	    PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_ADM9513, 
+	    7502, 7489, 5611, 5509, 0,
+	    PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_1200A, 
+	    0,
+	    PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_1200B, 
+	    0,
+	    PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_ULTRA, 
+	    7510, 0,
+	    PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_WIDE, 
+	    7523, 0,
+	    PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_U2W, 
+	    7533, 0,
+	    PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_U3W, 
+	    7545, 0,
+	    PCI_VENDOR_AGILENT, PCI_PRODUCT_AGILENT_TACHYON_DX2, 
+	    7557, 7565, 7569, 6247, 0,
+	    PCI_VENDOR_AIRONET, PCI_PRODUCT_AIRONET_PC4xxx, 
+	    7572, 4739, 4534, 5701, 0,
+	    PCI_VENDOR_AIRONET, PCI_PRODUCT_AIRONET_PCI350, 
+	    7586, 4739, 4534, 5701, 0,
+	    PCI_VENDOR_AIRONET, PCI_PRODUCT_AIRONET_MPI350, 
+	    7593, 5547, 4739, 4534, 5701, 0,
+	    PCI_VENDOR_AIRONET, PCI_PRODUCT_AIRONET_PC4500, 
+	    7600, 4739, 4534, 5701, 0,
+	    PCI_VENDOR_AIRONET, PCI_PRODUCT_AIRONET_PC4800, 
+	    7607, 4739, 4534, 5701, 0,
+	    PCI_VENDOR_ALACRITECH, PCI_PRODUCT_ALACRITECH_SES1001T, 
+	    7614, 7623, 7629, 0,
+	    PCI_VENDOR_ALLIANCE, PCI_PRODUCT_ALLIANCE_AT24, 
+	    7641, 0,
+	    PCI_VENDOR_ALLIANCE, PCI_PRODUCT_ALLIANCE_AT25, 
+	    7646, 0,
+	    PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_ACENIC, 
+	    7651, 7658, 5509, 0,
+	    PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_ACENIC_COPPER, 
+	    7651, 7669, 5509, 0,
+	    PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_BCM5700, 
+	    7651, 7679, 5524, 5509, 0,
+	    PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_BCM5701, 
+	    7651, 7687, 5524, 5509, 0,
+	    PCI_VENDOR_ALTERA, PCI_PRODUCT_ALTERA_EP4CGX15BF14C8N, 
+	    7695, 0,
+	    PCI_VENDOR_ALTIMA, PCI_PRODUCT_ALTIMA_AC1000, 
+	    7711, 5501, 5509, 0,
+	    PCI_VENDOR_ALTIMA, PCI_PRODUCT_ALTIMA_AC1001, 
+	    7718, 5501, 5509, 0,
+	    PCI_VENDOR_ALTIMA, PCI_PRODUCT_ALTIMA_AC9100, 
+	    7725, 5501, 5509, 0,
+	    PCI_VENDOR_ALTIMA, PCI_PRODUCT_ALTIMA_AC1003, 
+	    7732, 5501, 5509, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_HT, 
+	    7739, 7742, 7748, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_ADDR, 
+	    7739, 7742, 7777, 7785, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_DRAM, 
+	    7739, 7742, 7789, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_MISC, 
+	    7739, 7742, 7794, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_F10_HT, 
+	    7742, 7808, 7748, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_F10_ADDR, 
+	    7742, 7808, 7777, 7785, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_F10_DRAM, 
+	    7742, 7808, 7789, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_F10_MISC, 
+	    7742, 7808, 7794, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_F10_LINK, 
+	    7742, 7808, 7818, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_F11_HT, 
+	    7742, 7823, 7748, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_F11_ADDR, 
+	    7742, 7823, 7777, 7785, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_F11_DRAM, 
+	    7742, 7823, 7789, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_F11_MISC, 
+	    7742, 7823, 7794, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_F11_LINK, 
+	    7742, 7823, 7818, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F14_RC, 
+	    7833, 7843, 7848, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F15_HT, 
+	    7856, 7748, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F15_ADDR, 
+	    7856, 7777, 7785, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F15_DRAM, 
+	    7856, 7789, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F15_MISC, 
+	    7856, 7794, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F15_LINK, 
+	    7856, 7818, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F15_NB, 
+	    7856, 7866, 6355, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F14_HT, 
+	    7872, 7748, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F14_ADDR, 
+	    7872, 7777, 7785, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F14_DRAM, 
+	    7872, 7789, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F14_NB, 
+	    7872, 7866, 6355, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F14_CSTATE, 
+	    7872, 2544, 7886, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F12_RC, 
+	    7894, 7843, 7848, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F12_GPP0, 
+	    7894, 7904, 7843, 7909, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F14_MISC, 
+	    7872, 7914, 7763, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F14_HB18, 
+	    7872, 6751, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_F14_HB19, 
+	    7872, 6751, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCNET_PCI, 
+	    7920, 5509, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCNET_HOME, 
+	    7930, 7941, 5509, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AM_1771_MBW, 
+	    7949, 7957, 7960, 7965, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCSCSI_PCI, 
+	    7969, 6462, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_GEODELX_PCHB, 
+	    7980, 7986, 6643, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_GEODELX_VGA, 
+	    7980, 7986, 7989, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_GEODELX_AES, 
+	    7980, 7986, 7993, 7997, 8006, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_CS5536_PCISB, 
+	    8012, 8019, 615, 8029, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_CS5536_PCIB, 
+	    8012, 6629, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_CS5536_FLASH, 
+	    8012, 8035, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_CS5536_AUDIO, 
+	    8012, 6846, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_CS5536_OHCI, 
+	    8012, 8041, 6743, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_CS5536_EHCI, 
+	    8012, 8046, 6743, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_CS5536_UDC, 
+	    8012, 8051, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_CS5536_UOC, 
+	    8012, 8055, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_CS5536_IDE, 
+	    8012, 6418, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_SC520_SC, 
+	    8059, 8064, 6, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_SC751_SC, 
+	    8070, 6, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_SC751_PPB, 
+	    8070, 8077, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_IGR4_AGP, 
+	    458, 8085, 8090, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_IGR4_PPB, 
+	    458, 8085, 8077, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_SC762_NB, 
+	    8094, 7866, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_SC762_PPB, 
+	    8094, 8090, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_SC761_SC, 
+	    8101, 6, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_SC761_PPB, 
+	    8101, 8077, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC755_ISA, 
+	    8108, 6629, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC755_IDE, 
+	    8108, 6418, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC755_PMC, 
+	    8108, 8115, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC755_USB, 
+	    8108, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC756_ISA, 
+	    8120, 6629, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC756_IDE, 
+	    8120, 6418, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC756_PMC, 
+	    8120, 3749, 6870, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC756_USB, 
+	    8120, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC766_ISA, 
+	    8127, 8029, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC766_IDE, 
+	    8127, 6418, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC766_PMC, 
+	    8127, 3749, 6870, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC766_USB, 
+	    8127, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC768_ISA, 
+	    8134, 8141, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC768_IDE, 
+	    8134, 8153, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC768_PMC, 
+	    8134, 3749, 6870, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC768_AC, 
+	    8134, 8158, 6846, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC768_MD, 
+	    8134, 8158, 5556, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC768_PPB, 
+	    8134, 8077, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC768_USB, 
+	    8134, 6743, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCIX8131_PPB, 
+	    8163, 8171, 8177, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCIX8131_APIC, 
+	    8163, 8184, 8187, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AGP8151_DEV, 
+	    8192, 8090, 2427, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AGP8151_PPB, 
+	    8192, 8090, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCIX_PPB, 
+	    8200, 8171, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCIX_APIC, 
+	    8208, 8171, 8216, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111, 
+	    8223, 8231, 8235, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_USB_7461, 
+	    8223, 8239, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_ETHER, 
+	    8223, 5509, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_USB, 
+	    8223, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_LPC, 
+	    8223, 8244, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_IDE, 
+	    8223, 6418, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_SMB, 
+	    8223, 8248, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_ACPI, 
+	    8223, 8115, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_AC, 
+	    8223, 8158, 6846, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_MC97, 
+	    8223, 8254, 5556, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_AC_756b, 
+	    8223, 8259, 8115, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_SATA, 
+	    8264, 8271, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_SATA_AHCI, 
+	    8264, 8276, 8271, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_SDHC, 
+	    8264, 8281, 8035, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_OHCI, 
+	    8264, 6743, 8041, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_EHCI, 
+	    8264, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_OHCI_2, 
+	    8264, 6743, 8041, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_SMB, 
+	    8264, 8248, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_IDE, 
+	    8264, 6418, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_HDAUDIO, 
+	    8264, 8284, 6846, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_LPC, 
+	    8264, 8244, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_PCI, 
+	    8264, 615, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON_XHCI, 
+	    8264, 6743, 8287, 6247, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_HB, 
+	    8292, 6751, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS880_HB, 
+	    8298, 6751, 6355, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_PPB_GFX, 
+	    8310, 8077, 6355, 8322, 8327, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_PPB_GFX0, 
+	    8292, 8077, 6355, 8332, 8337, 6580, 8341, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_PPB0, 
+	    8310, 8344, 6355, 8353, 8341, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_PPB1, 
+	    8310, 8344, 6355, 8353, 8359, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_PPB2, 
+	    8292, 8344, 6355, 8353, 8362, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_PPB3, 
+	    8292, 8344, 6355, 8353, 8365, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_PPB4, 
+	    8310, 8344, 6355, 8353, 8368, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_PPB5, 
+	    8310, 8344, 6355, 8353, 8371, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_PPB6, 
+	    8292, 8344, 6355, 8374, 8381, 0,
+	    PCI_VENDOR_AMD, PCI_PRODUCT_AMD_RS780_PPB7, 
+	    8292, 8344, 6355, 8332, 8337, 6580, 8359, 0,
+	    PCI_VENDOR_AMI, PCI_PRODUCT_AMI_MEGARAID, 
+	    8387, 0,
+	    PCI_VENDOR_AMI, PCI_PRODUCT_AMI_MEGARAID2, 
+	    8387, 6203, 0,
+	    PCI_VENDOR_AMI, PCI_PRODUCT_AMI_MEGARAID3, 
+	    8387, 6214, 0,
+	    PCI_VENDOR_ANALOG, PCI_PRODUCT_ANALOG_AD1889, 
+	    8396, 615, 8403, 6247, 0,
+	    PCI_VENDOR_ANALOG, PCI_PRODUCT_ANALOG_SAFENET, 
+	    4969, 8412, 7629, 8419, 0,
+	    PCI_VENDOR_ANTARES, PCI_PRODUCT_ANTARES_TC9021, 
+	    5009, 5501, 5509, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_BANDIT, 
+	    8429, 6643, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_GC, 
+	    8436, 8442, 8231, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_CONTROL, 
+	    8450, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PLANB, 
+	    8458, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_OHARE, 
+	    8464, 8231, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_BANDIT2, 
+	    8429, 6643, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_HEATHROW, 
+	    8470, 8231, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PADDINGTON, 
+	    8479, 8231, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PBG3_FW, 
+	    8490, 8500, 8503, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_KEYLARGO_USB, 
+	    8512, 6743, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH1, 
+	    8521, 6643, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH2, 
+	    8521, 6643, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH_AGP, 
+	    8521, 8090, 3027, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_GMAC, 
+	    8530, 5509, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_KEYLARGO, 
+	    8512, 8231, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_GMAC2, 
+	    8530, 5509, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PANGEA_MACIO, 
+	    8535, 8231, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PANGEA_USB, 
+	    8535, 6743, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PANGEA_AGP, 
+	    8535, 8090, 3027, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PANGEA_PCI1, 
+	    8535, 6643, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PANGEA_PCI2, 
+	    8535, 6643, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH_AGP2, 
+	    8521, 8090, 3027, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH3, 
+	    8521, 6643, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH4, 
+	    8521, 6643, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PANGEA_FW, 
+	    8535, 8503, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH_FW, 
+	    8521, 8503, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_GMAC3, 
+	    8530, 5509, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH_ATA, 
+	    8521, 8542, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH_AGP3, 
+	    8521, 8090, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH5, 
+	    8521, 6643, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH6, 
+	    8521, 6643, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_KAUAI, 
+	    8550, 6238, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_INTREPID, 
+	    8556, 8231, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_INTREPID_USB, 
+	    8556, 6743, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_K2_USB, 
+	    8565, 6743, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_K2, 
+	    8565, 8568, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_K2_FW, 
+	    8565, 8503, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_K2_UATA, 
+	    8565, 8575, 6247, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_U3_PPB1, 
+	    8580, 8077, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_U3_PPB2, 
+	    8580, 8077, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_U3_PPB3, 
+	    8580, 8077, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_U3_PPB4, 
+	    8580, 8077, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_U3_PPB5, 
+	    8580, 8077, 6355, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_U3_AGP, 
+	    8580, 8090, 3027, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_K2_GMAC, 
+	    8530, 5509, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_SHASTA, 
+	    8583, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_SHASTA_ATA, 
+	    8583, 6238, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_SHASTA_GMAC, 
+	    8583, 8530, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_SHASTA_FW, 
+	    8583, 8503, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_SHASTA_PCI1, 
+	    8583, 615, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_SHASTA_PCI2, 
+	    8583, 615, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_SHASTA_PCI3, 
+	    8583, 615, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_SHASTA_HT, 
+	    8583, 7748, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_INTREPID2_AGP, 
+	    8556, 6203, 8090, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_INTREPID2_PCI1, 
+	    8556, 6203, 615, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_INTREPID2_PCI2, 
+	    8556, 6203, 615, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_INTREPID2_ATA, 
+	    8556, 6203, 6238, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_INTREPID2_FW, 
+	    8556, 6203, 8590, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_INTREPID2_GMAC, 
+	    8556, 6203, 8530, 0,
+	    PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_BCM5701, 
+	    7687, 0,
+	    PCI_VENDOR_ARC, PCI_PRODUCT_ARC_1000PV, 
+	    8599, 0,
+	    PCI_VENDOR_ARC, PCI_PRODUCT_ARC_2000PV, 
+	    8606, 0,
+	    PCI_VENDOR_ARC, PCI_PRODUCT_ARC_2000MT, 
+	    8613, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1110, 
+	    8620, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1120, 
+	    8629, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1130, 
+	    8638, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1160, 
+	    8647, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1170, 
+	    8656, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1200, 
+	    8665, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1200_B, 
+	    8665, 8674, 5124, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1202, 
+	    8678, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1210, 
+	    8687, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1220, 
+	    8696, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1230, 
+	    8705, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1260, 
+	    8714, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1270, 
+	    8723, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1280, 
+	    8732, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1380, 
+	    8741, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1381, 
+	    8750, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1680, 
+	    8759, 0,
+	    PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1681, 
+	    8768, 0,
+	    PCI_VENDOR_ASIX, PCI_PRODUCT_ASIX_AX88140A, 
+	    8777, 5611, 5509, 0,
+	    PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_01, 
+	    8786, 8276, 8271, 8794, 6247, 0,
+	    PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_02, 
+	    8786, 8276, 8271, 8794, 6247, 0,
+	    PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_11, 
+	    8786, 8276, 8271, 8794, 6247, 0,
+	    PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_12, 
+	    8786, 8276, 8271, 8794, 6247, 0,
+	    PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1042, 
+	    8798, 6743, 8806, 6751, 6247, 0,
+	    PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1042A, 
+	    8810, 6743, 8806, 6751, 6247, 0,
+	    PCI_VENDOR_ASUSTEK, PCI_PRODUCT_ASUSTEK_HFCPCI, 
+	    8819, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_ETHERNET_L1E, 
+	    8824, 5501, 5509, 5701, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_ETHERNET_GIGA, 
+	    8828, 5501, 5509, 5701, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_AR8132, 
+	    8831, 2439, 5509, 5701, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_AR8131, 
+	    8838, 5501, 5509, 5701, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_AR8151, 
+	    8845, 8852, 5501, 5509, 5701, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_AR8151_V2, 
+	    8845, 8857, 5501, 5509, 5701, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_AR8162, 
+	    8862, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_AR8161, 
+	    8869, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_AR8172, 
+	    8876, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_AR8171, 
+	    8883, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_ETHERNET_100, 
+	    8890, 5934, 8893, 5509, 5701, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_AR8152_B, 
+	    8898, 8905, 2439, 5509, 5701, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_AR8152_B2, 
+	    8898, 8857, 2439, 5509, 5701, 0,
+	    PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_E2200, 
+	    8910, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_WRESTLER_HDMI, 
+	    8916, 8925, 6846, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_BEAVERCREEK_HDMI, 
+	    8930, 8925, 6846, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV380_3150, 
+	    8942, 8949, 8958, 8963, 8969, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV380_3154, 
+	    8974, 8981, 8985, 8988, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV380_3E50, 
+	    8942, 8958, 8993, 9001, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV380_3E54, 
+	    8974, 9006, 8993, 9012, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RS100_4136, 
+	    8942, 9017, 9024, 9029, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RS200_A7, 
+	    8942, 9034, 9049, 9054, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R300_AD, 
+	    8942, 9059, 9064, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R300_AE, 
+	    8942, 9059, 9067, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R300_AF, 
+	    8942, 9070, 9077, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R300_AG, 
+	    8974, 9080, 521, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R350_AH, 
+	    8942, 9083, 9090, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R350_AI, 
+	    8942, 9093, 9098, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R350_AJ, 
+	    8942, 9093, 9101, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R350_AK, 
+	    8974, 9104, 9107, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_AP, 
+	    8942, 9110, 9115, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_AQ, 
+	    8942, 9118, 9125, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV360_AR, 
+	    8942, 9128, 9135, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_AS, 
+	    8942, 9110, 9138, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_AT, 
+	    8974, 9141, 9144, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_AV, 
+	    8974, 9147, 9153, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH32, 
+	    9156, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_9600_LE_S, 
+	    8942, 9110, 9163, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_9600_XT_S, 
+	    8942, 9110, 9176, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RS250_B7, 
+	    8942, 9179, 9184, 9188, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R200_BB, 
+	    8942, 9194, 9199, 9203, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R200_BC, 
+	    8942, 9194, 9199, 9206, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RS100_4336, 
+	    8942, 9209, 9217, 9222, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RS200_4337, 
+	    8942, 9227, 9245, 9250, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_IXP_AUDIO_200, 
+	    9255, 9259, 6846, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB200_PPB, 
+	    9265, 8077, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB200_EHCI, 
+	    9265, 9271, 6751, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB200_OHCI_1, 
+	    9265, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB200_OHCI_2, 
+	    9265, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_IXP_IDE_200, 
+	    9265, 9255, 6418, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB200_ISA, 
+	    9265, 6629, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB200_MODEM, 
+	    9265, 5556, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB200_SMB, 
+	    9265, 8248, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_IXP_AUDIO_300, 
+	    9255, 9259, 6846, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB300_SMB, 
+	    9276, 8248, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_IXP_IDE_300, 
+	    9276, 9255, 6418, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_IXP_SATA_300, 
+	    9282, 8271, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_IXP_AUDIO_400, 
+	    9255, 9259, 6846, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB400_PPB, 
+	    9289, 8077, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB400_SMB, 
+	    9289, 8248, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB400_EHCI, 
+	    9289, 9271, 6751, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB400_OHCI_1, 
+	    9289, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB400_OHCI_2, 
+	    9289, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_IXP_IDE_400, 
+	    9289, 9255, 6418, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB400_ISA, 
+	    9289, 6629, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB400_MODEM, 
+	    9289, 5556, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB400_SATA_1, 
+	    9289, 8271, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB400_SATA_2, 
+	    9289, 8271, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_SATA_1, 
+	    9295, 8271, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_SATA_2, 
+	    9295, 8271, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_AC97_AUDIO, 
+	    9295, 8158, 6846, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_AZALIA, 
+	    9301, 9307, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_PPB, 
+	    9301, 615, 6807, 615, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_SMB, 
+	    9301, 8248, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_USB_EHCI, 
+	    9295, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_USB_OHCI0, 
+	    9295, 6743, 9314, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_USB_OHCI1, 
+	    9295, 6743, 9320, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_USB_OHCI2, 
+	    9295, 6743, 9326, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_USB_OHCI3, 
+	    9295, 6743, 9332, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_USB_OHCI4, 
+	    9295, 6743, 9338, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_AC97_MODEM, 
+	    9295, 8158, 5556, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_IXP_IDE_600, 
+	    9295, 9255, 6418, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_PLB_438D, 
+	    9295, 615, 6807, 8244, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_IDE, 
+	    9344, 8271, 6247, 9356, 9361, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_AHCI, 
+	    9344, 8271, 6247, 9367, 9361, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_RAID, 
+	    9344, 6242, 8271, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_RAID5, 
+	    9344, 9373, 8271, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_FC, 
+	    9344, 7569, 8271, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_AHCI2, 
+	    9344, 8271, 6247, 9367, 9361, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_USB_EHCI, 
+	    9344, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB800_SATA, 
+	    9379, 8271, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_USB_OHCI0, 
+	    9344, 6743, 8041, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_USB_OHCI1, 
+	    9344, 6743, 8041, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_USB_OHCI2, 
+	    9344, 6743, 8041, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_IDE, 
+	    9344, 6418, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_LPC, 
+	    9344, 8244, 6751, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_PCIE0, 
+	    9344, 615, 6807, 615, 9391, 9398, 8341, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_PCIE1, 
+	    9344, 615, 6807, 615, 9391, 9398, 8359, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB900_PCIE2, 
+	    9404, 615, 6807, 615, 9391, 9398, 8362, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB900_PCIE3, 
+	    9404, 615, 6807, 615, 9391, 9398, 8365, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_CT, 
+	    9410, 9417, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_CX, 
+	    9410, 9420, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RS250_D7, 
+	    8942, 8949, 9179, 9184, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_PRO_AGP, 
+	    5239, 9423, 7045, 9428, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_PRO_AGP1X, 
+	    5239, 9423, 7045, 9434, 9439, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_PRO_PCI_B, 
+	    5239, 9423, 7045, 9443, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_XC_PCI66, 
+	    9423, 9449, 9452, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_XL_AGP, 
+	    9423, 5599, 9428, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_XC_AGP, 
+	    9423, 9449, 9428, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_XL_PCI66, 
+	    9423, 5599, 9452, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_PRO_PCI_P, 
+	    5239, 9423, 7045, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_PRO_PCI_L, 
+	    5239, 9423, 7045, 9460, 9469, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_XL_PCI, 
+	    9423, 5599, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_XC_PCI, 
+	    9423, 9449, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_II, 
+	    5239, 9423, 9473, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_IIP, 
+	    5239, 9423, 9478, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_IIC_PCI, 
+	    5239, 9423, 9482, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_IIC_AGP_B, 
+	    5239, 9423, 9482, 9428, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GX, 
+	    9410, 9486, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_IIC, 
+	    5239, 9423, 9482, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_IIC_AGP_P, 
+	    5239, 9423, 9482, 9428, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV250_4966, 
+	    8942, 9489, 9498, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV250_4967, 
+	    8942, 6275, 9501, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R420_JH, 
+	    8942, 9504, 9509, 9516, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R420_JI, 
+	    8942, 9519, 9509, 9527, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R420_JJ, 
+	    8942, 9530, 9509, 9537, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R420_JK, 
+	    8942, 9504, 9509, 9540, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R420_JL, 
+	    8942, 9504, 9509, 9543, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R420_JM, 
+	    8974, 9546, 9509, 9549, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R420_JN, 
+	    8942, 8949, 9093, 9552, 9558, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R420_JP, 
+	    8942, 9561, 9509, 9568, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_LT_PRO_AGP, 
+	    5239, 9423, 9571, 7045, 9434, 9574, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_LT_PRO_AGP66, 
+	    5239, 9423, 9571, 7045, 9434, 9582, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_MOB_M3_PCI, 
+	    9423, 8949, 9589, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_MOB_M3_AGP, 
+	    9423, 8949, 9589, 9428, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_LT, 
+	    5239, 9423, 9571, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_LT_PRO_PCI, 
+	    5239, 9423, 9571, 7045, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_MOBILITY, 
+	    9423, 8949, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_L_MOBILITY, 
+	    9423, 9592, 8949, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_LT_PRO, 
+	    5239, 9423, 9571, 7045, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_LT_PRO2, 
+	    5239, 9423, 9571, 7045, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_MOB_M1_PCI, 
+	    9423, 8949, 9594, 9597, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_L_MOB_M1_PCI, 
+	    9423, 9592, 8949, 9597, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV200_LW, 
+	    8942, 8949, 9603, 9606, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV200_LX, 
+	    8974, 8949, 9609, 9603, 7986, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV100_LY, 
+	    8942, 8949, 9614, 9617, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV100_LZ, 
+	    8942, 8949, 9614, 9620, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV250_4C64, 
+	    8974, 8949, 6275, 9623, 9628, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV250_4C66, 
+	    8942, 8949, 6275, 9623, 9631, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV250_4C67, 
+	    8942, 8949, 6275, 9623, 9634, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_128_AGP4X, 
+	    8942, 8949, 9637, 8090, 9641, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_128_AGP2X, 
+	    8942, 8949, 9637, 8090, 9644, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R300_ND, 
+	    8942, 9647, 9652, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R300_NE, 
+	    8942, 9655, 9668, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R300_NF, 
+	    8942, 9647, 9671, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R300_NG, 
+	    8974, 9674, 9677, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R350_NH, 
+	    8942, 9680, 9688, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R350_NI, 
+	    8942, 9093, 9691, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R360_NJ, 
+	    8942, 9694, 9701, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R350_NK, 
+	    8974, 9104, 9704, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_NP, 
+	    8942, 8949, 9707, 9717, 9726, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_NQ, 
+	    8942, 8949, 9110, 9729, 9735, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_NR, 
+	    8942, 8949, 9110, 9738, 9744, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_NS, 
+	    8942, 8949, 9110, 9729, 9747, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_NT, 
+	    8974, 8949, 9141, 9729, 9750, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV350_NV, 
+	    8974, 8949, 9753, 9738, 9757, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_9700_9500_S, 
+	    8942, 9760, 6268, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_9700_9500_S2, 
+	    8942, 9760, 6268, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_9600_2, 
+	    8942, 9070, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_9800_PRO_2, 
+	    8942, 9093, 7045, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE1PCI, 
+	    9423, 9637, 7045, 615, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE1AGP2X, 
+	    9423, 9637, 7045, 8090, 9644, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE1AGP4X, 
+	    9423, 9637, 7045, 8090, 9641, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE1PCIT, 
+	    9423, 9637, 7045, 615, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE1AGP2XT, 
+	    9423, 9637, 7045, 8090, 9644, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE1AGP4XT, 
+	    9423, 9777, 9782, 8090, 9641, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE2PCI, 
+	    9423, 9637, 7045, 615, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE2AGP2X, 
+	    9423, 9637, 7045, 8090, 9644, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE2AGP4X, 
+	    9423, 9637, 7045, 8090, 9641, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE2PCIT, 
+	    9423, 9637, 7045, 615, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE2AGP2XT, 
+	    9423, 9637, 7045, 8090, 9644, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE2AGP4XT, 
+	    9423, 9637, 7045, 8090, 9641, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE3PCI, 
+	    9423, 9637, 7045, 615, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE3AGP2X, 
+	    9423, 9637, 7045, 8090, 9644, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE3AGP4X, 
+	    9423, 9637, 7045, 8090, 9641, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE3PCIT, 
+	    9423, 9637, 7045, 615, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE3AGP2XT, 
+	    9423, 9637, 7045, 8090, 9644, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE3AGP4XT, 
+	    9423, 9637, 7045, 8090, 9641, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE4PCI, 
+	    9423, 9637, 7045, 615, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE4AGP2X, 
+	    9423, 9637, 7045, 8090, 9644, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE4AGP4X, 
+	    9423, 9637, 7045, 8090, 9641, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE4PCIT, 
+	    9423, 9637, 7045, 615, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE4AGP2XT, 
+	    9423, 9637, 7045, 8090, 9644, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE4AGP4XT, 
+	    9423, 9637, 7045, 8090, 9641, 9770, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R100_QD, 
+	    8942, 9787, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R100_QE, 
+	    8942, 9790, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R100_QF, 
+	    8942, 9793, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R100_QG, 
+	    8942, 9796, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R200_QH, 
+	    8974, 9799, 9809, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R200_QL, 
+	    8942, 9194, 9812, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R200_QM, 
+	    8942, 9815, 9820, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV200_QW, 
+	    8942, 9823, 9828, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV200_QX, 
+	    8942, 9823, 9831, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV100_QY, 
+	    8942, 9834, 9842, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV100_QZ, 
+	    8942, 9834, 9845, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_ES1000, 
+	    9848, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_9100_S, 
+	    8942, 9815, 6268, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGEGLPCI, 
+	    9423, 9637, 8985, 615, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGEGLAGP, 
+	    9423, 9637, 8985, 8090, 9644, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGEVRPCI, 
+	    9423, 9637, 9855, 615, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGEVRAGP, 
+	    9423, 9637, 9855, 8090, 9644, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE4XPCI, 
+	    9423, 9637, 9641, 615, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE4XA2X, 
+	    9423, 9637, 9641, 8090, 9644, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE4XA4X, 
+	    9423, 9637, 9641, 8090, 9641, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE4X, 
+	    9423, 9637, 9641, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE24XPCI, 
+	    9423, 9637, 9641, 615, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE24XA2X, 
+	    9423, 9637, 9641, 8090, 9644, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE24XA4X, 
+	    9423, 9637, 9641, 8090, 9641, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE24X, 
+	    9423, 9637, 9641, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE128PROULTRATF, 
+	    9423, 9637, 7045, 6957, 9858, 8090, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV370_5460, 
+	    8942, 8949, 9861, 9866, 9872, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV370_5464, 
+	    8974, 9877, 8985, 9881, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R423_UH, 
+	    8942, 9504, 9886, 9893, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R423_UI, 
+	    8942, 9519, 9886, 9896, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R423_UJ, 
+	    8942, 9899, 9886, 9906, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R423_UK, 
+	    8942, 9530, 9886, 9909, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R430_554F, 
+	    8942, 9504, 9912, 9916, 9923, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R423_UQ, 
+	    8974, 9928, 9886, 9934, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R423_UR, 
+	    8974, 9937, 9886, 9943, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R423_UT, 
+	    8974, 9946, 9886, 9952, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R430_556F, 
+	    8942, 9504, 9912, 9916, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_VT, 
+	    9410, 9955, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_VTB, 
+	    9410, 9958, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_VT4, 
+	    9410, 9962, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS300_HB, 
+	    9966, 6751, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RS300_X4, 
+	    8942, 9815, 9184, 9049, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RS300_X5, 
+	    8942, 8949, 9815, 9184, 9972, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS300_AGP, 
+	    9966, 8090, 3027, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_9200_PRO_S, 
+	    8942, 9977, 7045, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_9200_S, 
+	    8942, 9977, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS480_HB, 
+	    9982, 6751, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD580, 
+	    9988, 9994, 10004, 10011, 6751, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV370_5954, 
+	    8942, 10004, 10016, 6268, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_NB, 
+	    10021, 7866, 6355, 10027, 10033, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RX780_790_HB, 
+	    10039, 10051, 6751, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV280_5960, 
+	    8942, 10059, 10067, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV280_5961, 
+	    8942, 9977, 10072, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV280_5962, 
+	    8942, 9977, 10077, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV280_5963, 
+	    8942, 9977, 10082, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV280_5964, 
+	    8942, 10087, 10094, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS482M, 
+	    8942, 10004, 6268, 10099, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_GFX0_A, 
+	    10021, 615, 6355, 10108, 7909, 10113, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_GFX0_B, 
+	    10021, 615, 6355, 10108, 7909, 5124, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_GPP_A, 
+	    10021, 615, 4329, 6355, 10115, 7909, 10113, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_GPP_B, 
+	    10021, 615, 4329, 6355, 10115, 7909, 5124, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_GPP_C, 
+	    10021, 615, 4329, 6355, 10115, 7909, 10119, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_GPP_D, 
+	    10021, 615, 4329, 6355, 10115, 7909, 3163, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_GPP_E, 
+	    10021, 615, 4329, 6355, 10115, 7909, 10121, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_GPP_F, 
+	    10021, 615, 4329, 6355, 10115, 7909, 10123, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_GFX1_A, 
+	    10021, 615, 6355, 10125, 7909, 10113, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_GFX1_B, 
+	    10021, 615, 6355, 10125, 7909, 5124, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD790_PPB_NBSB, 
+	    10021, 615, 6355, 8374, 10130, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_NB_DS16, 
+	    10136, 7866, 6355, 10142, 10147, 10152, 10157, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_NB_SS, 
+	    10136, 7866, 6355, 6367, 10147, 10157, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_NB_DS8, 
+	    10136, 7866, 6355, 10142, 10147, 10161, 10157, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GFX0_A, 
+	    10136, 615, 6355, 10108, 7909, 10113, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GFX0_B, 
+	    10136, 615, 6355, 10108, 7909, 5124, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GPP_A, 
+	    10136, 615, 4329, 6355, 10115, 7909, 10113, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GPP_B, 
+	    10136, 615, 4329, 6355, 10115, 7909, 5124, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GPP_C, 
+	    10136, 615, 4329, 6355, 10115, 7909, 10119, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GPP_D, 
+	    10136, 615, 4329, 6355, 10115, 7909, 3163, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GPP_E, 
+	    10136, 615, 4329, 6355, 10115, 7909, 10121, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GPP_F, 
+	    10136, 615, 4329, 6355, 10115, 7909, 10123, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GPP_G, 
+	    10136, 615, 4329, 6355, 10115, 7909, 10165, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GPP_H, 
+	    10136, 615, 4329, 6355, 10115, 7909, 10167, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GFX1_A, 
+	    10136, 615, 6355, 10125, 7909, 10113, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_GFX1_B, 
+	    10136, 615, 6355, 10125, 7909, 5124, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_PPB_NBSB, 
+	    10136, 615, 6355, 8374, 10130, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RD890_IOMMU, 
+	    10136, 10169, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_XPRESS_200, 
+	    8942, 10004, 10175, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS480_XRP, 
+	    9982, 615, 4329, 7843, 7909, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS480_PPB_5A36, 
+	    9982, 615, 4329, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS480_PPB_5A37, 
+	    9982, 615, 4329, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS480_PPB_5A38, 
+	    9982, 615, 4329, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS480_PPB_5A3F, 
+	    9982, 615, 4329, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV370_5B60, 
+	    8942, 10179, 10184, 10192, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV380_5B62, 
+	    8942, 8958, 615, 4329, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV370_5B63, 
+	    8942, 10197, 10206, 10211, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV370_5B64, 
+	    8974, 10218, 10184, 10224, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV370_5B65, 
+	    8974, 10229, 10184, 10235, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X300_S, 
+	    8942, 10179, 6268, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV370_5B73, 
+	    8942, 10240, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV280_5C61, 
+	    8942, 8949, 9977, 10246, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RV280_5C63, 
+	    8942, 8949, 9977, 10246, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_9200SE_S, 
+	    8942, 10087, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X850XT, 
+	    8942, 10252, 9176, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_R423_5D57, 
+	    8942, 9561, 9886, 10257, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X850XT_S, 
+	    8942, 10252, 9176, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X700, 
+	    8942, 10262, 7045, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X700_S, 
+	    8942, 10262, 7045, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD5870, 
+	    8942, 8284, 10267, 10272, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD5600_RD, 
+	    8942, 8284, 10280, 10285, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD5450, 
+	    8942, 8284, 10293, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X1300, 
+	    8942, 10298, 6268, 10304, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X1300_S, 
+	    8942, 10298, 6268, 10304, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X1600XT, 
+	    8942, 10312, 9176, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X1600, 
+	    8942, 8949, 10312, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X1600XT_S, 
+	    8942, 10312, 9176, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X1950, 
+	    8942, 10318, 10324, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_X1950_S, 
+	    8942, 10318, 10324, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RS300_7834, 
+	    8942, 9815, 10324, 9184, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_RS300_7835, 
+	    8942, 9977, 9184, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS690_HB_7910, 
+	    10328, 6751, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS690_HB_7911, 
+	    10334, 6751, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS690_PPB_7912, 
+	    10328, 10157, 6355, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS690_PPB_7913, 
+	    10328, 615, 4329, 6355, 10157, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS690_PPB_7914, 
+	    10328, 615, 4329, 6355, 10115, 7909, 10113, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS690_PPB_7915, 
+	    10328, 615, 4329, 6355, 10115, 7909, 5124, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS690_PPB_7916, 
+	    10328, 615, 4329, 6355, 10115, 7909, 10119, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RS690_PPB_7917, 
+	    10328, 615, 4329, 6355, 10115, 7909, 3163, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD4850, 
+	    8942, 10340, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD4650, 
+	    8942, 10347, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD2400_XT, 
+	    8942, 10354, 9176, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD2400_PRO, 
+	    8942, 10354, 7045, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD2400_M72, 
+	    8949, 8942, 8284, 10361, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD3870, 
+	    8942, 10366, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD4350, 
+	    8942, 10373, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD4500_M93, 
+	    8949, 8942, 8284, 10380, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD2600_M76, 
+	    8949, 8942, 8284, 10385, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD2600PROAGP, 
+	    8942, 10390, 7045, 8090, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD2600_XT, 
+	    8942, 10390, 9176, 10397, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD2600_PRO, 
+	    8942, 8284, 10385, 7045, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD3650_M, 
+	    8949, 8942, 8284, 10403, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD3650_AGP, 
+	    8942, 10408, 8090, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD3650, 
+	    8942, 10408, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD3400_M82, 
+	    8949, 8942, 8284, 10415, 6268, 10420, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD4250_S, 
+	    8942, 10426, 10433, 10437, 9166, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD6520G, 
+	    8942, 10445, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD4200, 
+	    8942, 10453, 8949, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD4250, 
+	    8942, 10426, 10433, 10460, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD6310, 
+	    8942, 10468, 1716, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD6320, 
+	    8942, 10475, 1716, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD7340, 
+	    8942, 10482, 1716, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD2600_HD, 
+	    8942, 10390, 8284, 6846, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD4350_HD, 
+	    8942, 10373, 8284, 6846, 6247, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD5600_HDMI, 
+	    10285, 8925, 6846, 0,
+	    PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RADEON_HD54XX_HDA, 
+	    8942, 8284, 10489, 6846, 0,
+	    PCI_VENDOR_AURAVISION, PCI_PRODUCT_AURAVISION_VXP524, 
+	    10494, 615, 234, 10501, 0,
+	    PCI_VENDOR_AUREAL, PCI_PRODUCT_AUREAL_AU8820, 
+	    10511, 2641, 240, 6846, 10501, 0,
+	    PCI_VENDOR_AUREAL, PCI_PRODUCT_AUREAL_AU8830, 
+	    10518, 2641, 5239, 240, 6846, 10501, 0,
+	    PCI_VENDOR_AMCIRCUITS, PCI_PRODUCT_AMCIRCUITS_S5933, 
+	    10525, 615, 10531, 0,
+	    PCI_VENDOR_AMCIRCUITS, PCI_PRODUCT_AMCIRCUITS_LANAI, 
+	    10542, 10550, 3027, 0,
+	    PCI_VENDOR_AMCIRCUITS, PCI_PRODUCT_AMCIRCUITS_CAMAC, 
+	    10556, 10564, 6247, 0,
+	    PCI_VENDOR_AMCIRCUITS, PCI_PRODUCT_AMCIRCUITS_VICBUS, 
+	    10556, 10570, 3027, 0,
+	    PCI_VENDOR_AMCIRCUITS, PCI_PRODUCT_AMCIRCUITS_PCISYNC, 
+	    10556, 10577, 10593, 0,
+	    PCI_VENDOR_AMCIRCUITS, PCI_PRODUCT_AMCIRCUITS_ADDI7800, 
+	    10600, 10610, 10620, 10627, 0,
+	    PCI_VENDOR_AMCIRCUITS, PCI_PRODUCT_AMCIRCUITS_S5920, 
+	    10634, 615, 10640, 0,
+	    PCI_VENDOR_ASPEED, PCI_PRODUCT_ASPEED_AST1150, 
+	    10647, 10655, 9391, 0,
+	    PCI_VENDOR_ASPEED, PCI_PRODUCT_ASPEED_AST1180, 
+	    10667, 0,
+	    PCI_VENDOR_ASPEED, PCI_PRODUCT_ASPEED_AST2000, 
+	    5165, 1716, 10675, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5201, 
+	    10682, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5311, 
+	    10689, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5211, 
+	    10689, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5212, 
+	    10696, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5212_2, 
+	    10696, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5212_3, 
+	    10696, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5212_4, 
+	    10696, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5212_5, 
+	    10696, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5212_6, 
+	    10696, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5212_7, 
+	    10696, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR2413, 
+	    10703, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5413, 
+	    10710, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5424, 
+	    10717, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5416, 
+	    10724, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5418, 
+	    10731, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9160, 
+	    10738, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9280, 
+	    10745, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9281, 
+	    10752, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9285, 
+	    10759, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR2427, 
+	    10766, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9227, 
+	    10773, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9287, 
+	    10780, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9300, 
+	    10787, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9485, 
+	    10794, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9462, 
+	    10801, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_QCA988X, 
+	    10808, 4739, 4534, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5201_AP, 
+	    10682, 4739, 4534, 10821, 10831, 10836, 10843, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5201_DEFAULT, 
+	    10682, 4739, 4534, 10849, 10853, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5212_DEFAULT, 
+	    10696, 4739, 4534, 10849, 10853, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5211_DEFAULT, 
+	    10689, 4739, 4534, 10849, 10853, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5212_FPGA, 
+	    10696, 4739, 4534, 10821, 10831, 10861, 10872, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5211_FPGA11B, 
+	    10689, 4739, 4534, 10821, 10831, 10879, 10884, 10872, 0,
+	    PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5211_LEGACY, 
+	    10689, 4739, 4534, 10821, 10831, 10894, 10884, 10872, 0,
+	    PCI_VENDOR_ATRONICS, PCI_PRODUCT_ATRONICS_IDE_2015PL, 
+	    10904, 0,
+	    PCI_VENDOR_AVANCE, PCI_PRODUCT_AVANCE_AVL2301, 
+	    10915, 0,
+	    PCI_VENDOR_AVANCE, PCI_PRODUCT_AVANCE_AVG2302, 
+	    10923, 0,
+	    PCI_VENDOR_AVANCE2, PCI_PRODUCT_AVANCE2_ALG2301, 
+	    10931, 0,
+	    PCI_VENDOR_AVANCE2, PCI_PRODUCT_AVANCE2_ALG2302, 
+	    10939, 0,
+	    PCI_VENDOR_AVANCE2, PCI_PRODUCT_AVANCE2_ALS4000, 
+	    10947, 6846, 0,
+	    PCI_VENDOR_AVLAB, PCI_PRODUCT_AVLAB_PCI2S, 
+	    10955, 10959, 615, 6578, 10627, 0,
+	    PCI_VENDOR_AVLAB, PCI_PRODUCT_AVLAB_LPPCI4S, 
+	    10955, 10959, 615, 6578, 10627, 0,
+	    PCI_VENDOR_AVLAB, PCI_PRODUCT_AVLAB_LPPCI4S_2, 
+	    10955, 10959, 615, 6578, 10627, 0,
+	    PCI_VENDOR_CCUBE, PCI_PRODUCT_CCUBE_CINEMASTER, 
+	    10967, 10119, 8806, 10978, 6711, 0,
+	    PCI_VENDOR_AVM, PCI_PRODUCT_AVM_FRITZ_CARD, 
+	    10982, 10831, 8819, 3027, 0,
+	    PCI_VENDOR_AVM, PCI_PRODUCT_AVM_FRITZ_PCI_V2_ISDN, 
+	    10989, 8857, 8819, 3027, 0,
+	    PCI_VENDOR_AVM, PCI_PRODUCT_AVM_B1, 
+	    10999, 11005, 11010, 8819, 3027, 0,
+	    PCI_VENDOR_AVM, PCI_PRODUCT_AVM_T1, 
+	    11013, 11005, 11021, 8819, 3027, 0,
+	    PCI_VENDOR_RMI, PCI_PRODUCT_RMI_XLR_PCIX, 
+	    11024, 8171, 9391, 0,
+	    PCI_VENDOR_RMI, PCI_PRODUCT_RMI_XLS_PCIE, 
+	    11028, 11032, 9391, 0,
+	    PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_NON_ISOLATED_1_PORT, 
+	    11042, 11057, 615, 11064, 0,
+	    PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_NON_ISOLATED_2_PORT, 
+	    11069, 11057, 615, 11064, 0,
+	    PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_NON_ISOLATED_4_PORT, 
+	    11082, 11057, 615, 11064, 0,
+	    PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_NON_ISOLATED_8_PORT, 
+	    11095, 11057, 615, 11064, 0,
+	    PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_ISOLATED_1_PORT, 
+	    11042, 11109, 11057, 615, 11064, 0,
+	    PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_ISOLATED_2_PORT, 
+	    11069, 11109, 11057, 615, 11064, 0,
+	    PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_ISOLATED_4_PORT, 
+	    11082, 11109, 11057, 615, 11064, 0,
+	    PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_ISOLATED_8_PORT, 
+	    11095, 11109, 11057, 615, 11064, 0,
+	    PCI_VENDOR_BELKIN, PCI_PRODUCT_BELKIN_F5D6001, 
+	    11118, 0,
+	    PCI_VENDOR_BELKIN, PCI_PRODUCT_BELKIN_F5D6020V3, 
+	    11126, 7468, 0,
+	    PCI_VENDOR_BELKIN, PCI_PRODUCT_BELKIN_F5D7010, 
+	    11136, 0,
+	    PCI_VENDOR_STALLION, PCI_PRODUCT_STALLION_EC8_32, 
+	    11144, 0,
+	    PCI_VENDOR_STALLION, PCI_PRODUCT_STALLION_EC8_64, 
+	    11151, 0,
+	    PCI_VENDOR_STALLION, PCI_PRODUCT_STALLION_EASYIO, 
+	    11158, 0,
+	    PCI_VENDOR_BIT3, PCI_PRODUCT_BIT3_PCIVME617, 
+	    11165, 3027, 11173, 11178, 0,
+	    PCI_VENDOR_BIT3, PCI_PRODUCT_BIT3_PCIVME618, 
+	    11165, 3027, 11173, 11182, 0,
+	    PCI_VENDOR_BIT3, PCI_PRODUCT_BIT3_PCIVME2706, 
+	    11165, 3027, 11173, 11186, 0,
+	    PCI_VENDOR_BLUESTEEL, PCI_PRODUCT_BLUESTEEL_5501, 
+	    11191, 0,
+	    PCI_VENDOR_BLUESTEEL, PCI_PRODUCT_BLUESTEEL_5601, 
+	    11196, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5752, 
+	    11201, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5752M, 
+	    11219, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5709, 
+	    11228, 11209, 7383, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5709S, 
+	    11228, 11209, 7383, 7658, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5716, 
+	    11236, 11209, 7383, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5716S, 
+	    11236, 11209, 7383, 7658, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5700, 
+	    7679, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5701, 
+	    7687, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5702, 
+	    11244, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5703, 
+	    11252, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5704C, 
+	    11260, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5704S_ALT, 
+	    11269, 7658, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5706, 
+	    11278, 11209, 7383, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5708, 
+	    11286, 11209, 7383, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5702FE, 
+	    11294, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57710, 
+	    11304, 11209, 7383, 11313, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57711, 
+	    11318, 11209, 7383, 11313, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57711E, 
+	    11327, 11209, 7383, 11313, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5705, 
+	    11337, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5705K, 
+	    11345, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5717, 
+	    11354, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5718, 
+	    11362, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5719, 
+	    11370, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5721, 
+	    11378, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5722, 
+	    11386, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5723, 
+	    11394, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5724, 
+	    11402, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5705M, 
+	    11410, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5705M_ALT, 
+	    11410, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5720, 
+	    11419, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57712, 
+	    11427, 11209, 7383, 11313, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57712E, 
+	    11436, 11209, 7383, 11313, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5714, 
+	    11446, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5714S, 
+	    11454, 7658, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5780, 
+	    11463, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5780S, 
+	    11471, 11209, 7658, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5705F, 
+	    11480, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5754M, 
+	    11489, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5755M, 
+	    11498, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5756, 
+	    11507, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5750, 
+	    11515, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5751, 
+	    11523, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5715, 
+	    11531, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5715S, 
+	    11539, 7658, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5754, 
+	    11548, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5755, 
+	    11556, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5750M, 
+	    11564, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5751M, 
+	    11573, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5751F, 
+	    11582, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5787F, 
+	    11591, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5761E, 
+	    11600, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5761, 
+	    11609, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57762, 
+	    11617, 5501, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5764, 
+	    11626, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57766, 
+	    11634, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5761S, 
+	    11643, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5761SE, 
+	    11652, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57760, 
+	    11662, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57788, 
+	    11671, 11680, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57780, 
+	    11688, 11209, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5787M, 
+	    11697, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57790, 
+	    11706, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5782, 
+	    11715, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5784M, 
+	    11723, 11680, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5785G, 
+	    11732, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5786, 
+	    11741, 11680, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5787, 
+	    11749, 11680, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5788, 
+	    11757, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5789, 
+	    11765, 11680, 7669, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5785F, 
+	    11773, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5702X, 
+	    11782, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5703X, 
+	    11791, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5704S, 
+	    11269, 7658, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5706S, 
+	    11278, 11209, 7383, 7658, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5708S, 
+	    11286, 11209, 7383, 7658, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57761, 
+	    11800, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57781, 
+	    11809, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57791, 
+	    11818, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57786, 
+	    11827, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57765, 
+	    11836, 692, 5501, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57785, 
+	    11845, 692, 5501, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57795, 
+	    11854, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM57782, 
+	    11863, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5702_ALT, 
+	    11244, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5703_ALT, 
+	    11252, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5781, 
+	    11872, 692, 5501, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5753, 
+	    11880, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5753M, 
+	    11888, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5753F, 
+	    11897, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5903M, 
+	    11906, 5524, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4401_B0, 
+	    11915, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5901, 
+	    11926, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5901A2, 
+	    11934, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5906, 
+	    11943, 11680, 2439, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5906M, 
+	    11951, 11680, 2439, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4303, 
+	    11960, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4307, 
+	    11968, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4311, 
+	    11976, 11984, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4312, 
+	    11991, 11999, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4313, 
+	    12008, 12016, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4315, 
+	    12021, 11984, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4318, 
+	    12029, 12037, 4557, 12046, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4319, 
+	    12050, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4306, 
+	    12058, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4306_2, 
+	    12058, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4322, 
+	    12066, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4309, 
+	    12074, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM43XG, 
+	    12082, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4328, 
+	    12090, 12098, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4329, 
+	    12112, 12120, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM432A, 
+	    12132, 12140, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM432B, 
+	    12147, 12098, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM432C, 
+	    12155, 12120, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM432D, 
+	    12163, 12140, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM43224, 
+	    12171, 11999, 12140, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM43225, 
+	    12180, 11984, 12140, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM43227, 
+	    12189, 11984, 12140, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM43228, 
+	    12198, 11999, 12140, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4401, 
+	    12207, 5611, 5509, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5801, 
+	    12215, 7997, 10501, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5802, 
+	    12220, 7997, 10501, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5805, 
+	    12225, 7997, 10501, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5820, 
+	    12230, 7997, 10501, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5821, 
+	    12235, 7997, 10501, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5822, 
+	    12240, 7997, 10501, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5823, 
+	    12245, 7997, 10501, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5825, 
+	    12250, 7997, 10501, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5860, 
+	    12255, 7997, 10501, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5861, 
+	    12260, 7997, 10501, 0,
+	    PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5862, 
+	    12265, 7997, 10501, 0,
+	    PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT848, 
+	    12270, 234, 12276, 0,
+	    PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT849, 
+	    12284, 234, 12276, 0,
+	    PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT878, 
+	    12290, 234, 12276, 0,
+	    PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT879, 
+	    12296, 234, 12276, 0,
+	    PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT880, 
+	    12302, 234, 12276, 0,
+	    PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT878A, 
+	    12290, 234, 12276, 12308, 12315, 0,
+	    PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT879A, 
+	    12296, 234, 12276, 12308, 12315, 0,
+	    PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT880A, 
+	    12302, 234, 12276, 12308, 12315, 0,
+	    PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT8474, 
+	    12324, 12331, 12344, 6247, 0,
+	    PCI_VENDOR_BUSLOGIC, PCI_PRODUCT_BUSLOGIC_MULTIMASTER_NC, 
+	    12349, 12361, 0,
+	    PCI_VENDOR_BUSLOGIC, PCI_PRODUCT_BUSLOGIC_MULTIMASTER, 
+	    12349, 0,
+	    PCI_VENDOR_BUSLOGIC, PCI_PRODUCT_BUSLOGIC_FLASHPOINT, 
+	    12364, 0,
+	    PCI_VENDOR_C4T, PCI_PRODUCT_C4T_GPPCI, 
+	    12375, 0,
+	    PCI_VENDOR_CAVIUM, PCI_PRODUCT_CAVIUM_NITROX, 
+	    12381, 5599, 0,
+	    PCI_VENDOR_CHELSIO, PCI_PRODUCT_CHELSIO_T302E, 
+	    12388, 0,
+	    PCI_VENDOR_CHELSIO, PCI_PRODUCT_CHELSIO_T310E, 
+	    12394, 0,
+	    PCI_VENDOR_CHELSIO, PCI_PRODUCT_CHELSIO_T320X, 
+	    12400, 0,
+	    PCI_VENDOR_CHELSIO, PCI_PRODUCT_CHELSIO_T302X, 
+	    12406, 0,
+	    PCI_VENDOR_CHELSIO, PCI_PRODUCT_CHELSIO_T320E, 
+	    12412, 0,
+	    PCI_VENDOR_CHELSIO, PCI_PRODUCT_CHELSIO_T310X, 
+	    12418, 0,
+	    PCI_VENDOR_CHELSIO, PCI_PRODUCT_CHELSIO_T3B10, 
+	    12424, 0,
+	    PCI_VENDOR_CHELSIO, PCI_PRODUCT_CHELSIO_T3B20, 
+	    12430, 0,
+	    PCI_VENDOR_CHELSIO, PCI_PRODUCT_CHELSIO_T3B02, 
+	    12436, 0,
+	    PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_64310, 
+	    12442, 0,
+	    PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_69000, 
+	    12448, 0,
+	    PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_65545, 
+	    12454, 0,
+	    PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_65548, 
+	    12460, 0,
+	    PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_65550, 
+	    12466, 0,
+	    PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_65554, 
+	    12472, 0,
+	    PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_69030, 
+	    12478, 0,
+	    PCI_VENDOR_CHRYSALIS, PCI_PRODUCT_CHRYSALIS_LUNAVPN, 
+	    12484, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD7548, 
+	    12492, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5430, 
+	    12502, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5434_4, 
+	    12512, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5434_8, 
+	    12524, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5436, 
+	    12536, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5446, 
+	    12546, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5480, 
+	    12556, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_PD6729, 
+	    12566, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_PD6832, 
+	    12576, 12586, 6355, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_PD6833, 
+	    12598, 12586, 6355, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD7542, 
+	    12608, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD7543, 
+	    12618, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD7541, 
+	    12628, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_CD4400, 
+	    12638, 3332, 6247, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CS4610, 
+	    12648, 12655, 6846, 7629, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CS4280, 
+	    12667, 12674, 6846, 3027, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CS4615, 
+	    12687, 0,
+	    PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CS4281, 
+	    12694, 12674, 6846, 3027, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_AAR_1210SA, 
+	    12701, 8271, 6242, 6247, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_640, 
+	    12712, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_642, 
+	    12720, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_643, 
+	    12728, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_646, 
+	    12736, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_647, 
+	    12744, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_648, 
+	    12752, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_649, 
+	    12760, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_240, 
+	    12768, 12775, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_650A, 
+	    12784, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_670, 
+	    12793, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_673, 
+	    12801, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_680, 
+	    12809, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_3112, 
+	    12817, 12775, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_3114, 
+	    12825, 12775, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_3124, 
+	    12833, 12775, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_3132, 
+	    12841, 12775, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_3512, 
+	    12849, 12775, 0,
+	    PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_3531, 
+	    12857, 12775, 0,
+	    PCI_VENDOR_CMEDIA, PCI_PRODUCT_CMEDIA_CMI8338A, 
+	    12865, 615, 6846, 2427, 0,
+	    PCI_VENDOR_CMEDIA, PCI_PRODUCT_CMEDIA_CMI8338B, 
+	    12874, 615, 6846, 2427, 0,
+	    PCI_VENDOR_CMEDIA, PCI_PRODUCT_CMEDIA_CMI8738, 
+	    12883, 615, 6846, 2427, 0,
+	    PCI_VENDOR_CMEDIA, PCI_PRODUCT_CMEDIA_CMI8738B, 
+	    12896, 615, 6846, 2427, 0,
+	    PCI_VENDOR_CMEDIA, PCI_PRODUCT_CMEDIA_HSP56, 
+	    12905, 12911, 12922, 0,
+	    PCI_VENDOR_COGENT, PCI_PRODUCT_COGENT_EM110TX, 
+	    12928, 615, 2439, 5509, 5701, 0,
+	    PCI_VENDOR_COLOGNECHIP, PCI_PRODUCT_COLOGNECHIP_HFC, 
+	    12936, 0,
+	    PCI_VENDOR_COMPAL, PCI_PRODUCT_COMPAL_38W2, 
+	    12942, 12947, 12951, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_PCI_EISA_BRIDGE, 
+	    12960, 6355, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_PCI_ISA_BRIDGE, 
+	    6629, 6355, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_TRIFLEX1, 
+	    12969, 6643, 6355, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_TRIFLEX2, 
+	    12969, 6643, 6355, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_QVISION_V0, 
+	    12977, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_QVISION_1280P, 
+	    12977, 12985, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_QVISION_V2, 
+	    12977, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_TRIFLEX4, 
+	    12969, 6643, 6355, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA5300, 
+	    12992, 12998, 13004, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA5i, 
+	    12992, 12998, 13009, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA532, 
+	    12992, 12998, 13012, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA5312, 
+	    12992, 12998, 13016, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA6i, 
+	    12992, 12998, 13021, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA641, 
+	    12992, 12998, 13024, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA642, 
+	    12992, 12998, 13028, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA6400, 
+	    12992, 12998, 13032, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA6400EM, 
+	    12992, 12998, 13032, 13037, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA6422, 
+	    12992, 12998, 13040, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA64XX, 
+	    12992, 12998, 13045, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_USB, 
+	    6743, 6247, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_ASMC, 
+	    576, 114, 6870, 6247, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_USB_MEDIAGX, 
+	    6743, 6247, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_SMART2P, 
+	    13050, 6242, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_N100TX, 
+	    13058, 5611, 13070, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_N10T2, 
+	    13058, 13073, 13076, 13080, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_INT100TX, 
+	    692, 13058, 5611, 13070, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_N10T, 
+	    13058, 13073, 13089, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_IntNF3P, 
+	    692, 13091, 13099, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_DPNet100TX, 
+	    10142, 7909, 13058, 5611, 13070, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_IntPL100TX, 
+	    13103, 692, 13058, 5611, 13070, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_DP4000, 
+	    13112, 13120, 13125, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA5300_2, 
+	    12992, 12998, 13004, 13133, 6203, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_PRESARIO56XX, 
+	    13138, 13147, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_M700, 
+	    13152, 13159, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_CSA5i_2, 
+	    12992, 12998, 13164, 13133, 6203, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_ILO_1, 
+	    13171, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_ILO_2, 
+	    13171, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_NF3P_BNC, 
+	    13091, 13099, 5948, 13175, 0,
+	    PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_NF3P, 
+	    13091, 13099, 0,
+	    PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_NE2KETHER, 
+	    5509, 0,
+	    PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_RL100ATX, 
+	    13179, 5611, 5509, 0,
+	    PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_RL100TX, 
+	    13189, 5611, 5509, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT32EXT, 
+	    13198, 13209, 7909, 13212, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT8EXT, 
+	    13198, 6603, 7909, 13212, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT16EXT, 
+	    13198, 13221, 7909, 13212, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT4QUAD, 
+	    13198, 6578, 7909, 5948, 13224, 13229, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT8OCTA, 
+	    13198, 6603, 7909, 5948, 13235, 13229, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT8RJ, 
+	    13198, 6603, 7909, 5948, 13240, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT4RJ, 
+	    13198, 6578, 7909, 5948, 13240, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT8DB, 
+	    13198, 6603, 7909, 5948, 13246, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT16DB, 
+	    13198, 13221, 7909, 5948, 13246, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORTP4, 
+	    13198, 13251, 6578, 7909, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORTP8, 
+	    13198, 13251, 6603, 7909, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETMODEM6, 
+	    13256, 13268, 7909, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETMODEM4, 
+	    13256, 6578, 7909, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORTP232, 
+	    13198, 6203, 7909, 13270, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORTP422, 
+	    13198, 6203, 7909, 13276, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT550811A, 
+	    13198, 13282, 13288, 13293, 10113, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT550811B, 
+	    13198, 13282, 13288, 13293, 5124, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT5508OA, 
+	    13198, 13282, 13235, 13293, 10113, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT5508OB, 
+	    13198, 13282, 13235, 13293, 5124, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT5504, 
+	    13198, 13298, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT550Q, 
+	    13198, 13304, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT55016A, 
+	    13198, 13313, 13293, 10113, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT55016B, 
+	    13198, 13313, 13293, 5124, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT5508A, 
+	    13198, 13282, 13293, 10113, 0,
+	    PCI_VENDOR_COMTROL, PCI_PRODUCT_COMTROL_ROCKETPORT5508B, 
+	    13198, 13282, 13293, 5124, 0,
+	    PCI_VENDOR_CONEXANT, PCI_PRODUCT_CONEXANT_SOFTK56, 
+	    13320, 615, 321, 5556, 0,
+	    PCI_VENDOR_CONEXANT, PCI_PRODUCT_CONEXANT_56KFAXMODEM, 
+	    13328, 13331, 13335, 5556, 0,
+	    PCI_VENDOR_CONEXANT, PCI_PRODUCT_CONEXANT_LANFINITY, 
+	    13339, 13349, 5611, 5509, 0,
+	    PCI_VENDOR_CONEXANT, PCI_PRODUCT_CONEXANT_CX2388X, 
+	    13357, 615, 13371, 6711, 0,
+	    PCI_VENDOR_CONEXANT, PCI_PRODUCT_CONEXANT_CX2388XAUDIO, 
+	    13357, 615, 6846, 7909, 0,
+	    PCI_VENDOR_CONEXANT, PCI_PRODUCT_CONEXANT_CX2388XMPEG, 
+	    13357, 615, 6706, 7909, 0,
+	    PCI_VENDOR_CONEXANT, PCI_PRODUCT_CONEXANT_CX2388XIR, 
+	    13357, 615, 13383, 7909, 0,
+	    PCI_VENDOR_CONEXANT, PCI_PRODUCT_CONEXANT_CX23885, 
+	    13386, 0,
+	    PCI_VENDOR_CONTAQ, PCI_PRODUCT_CONTAQ_82C599, 
+	    13394, 13401, 6355, 0,
+	    PCI_VENDOR_CONTAQ, PCI_PRODUCT_CONTAQ_82C693, 
+	    13409, 6629, 6355, 0,
+	    PCI_VENDOR_COREGA, PCI_PRODUCT_COREGA_CB_TXD, 
+	    13416, 13423, 5611, 5509, 0,
+	    PCI_VENDOR_COREGA, PCI_PRODUCT_COREGA_2CB_TXD, 
+	    13416, 7383, 13423, 5611, 5509, 0,
+	    PCI_VENDOR_COREGA, PCI_PRODUCT_COREGA_LAPCIGT, 
+	    13430, 0,
+	    PCI_VENDOR_COROLLARY, PCI_PRODUCT_COROLLARY_CBUSII_PCIB, 
+	    13441, 13448, 6355, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_SBLIVE, 
+	    13456, 13464, 13468, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_AWE64D, 
+	    13474, 13487, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_AUDIGY, 
+	    13494, 13497, 13464, 13468, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_XFI, 
+	    13474, 13504, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_SBLIVE2, 
+	    13456, 13464, 13468, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_SBAUDIGYLS, 
+	    13494, 13497, 13509, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_SBAUDIGY4, 
+	    13494, 13497, 6578, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_FIWIRE, 
+	    8503, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_SBJOY, 
+	    615, 13512, 13521, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_AUDIGIN, 
+	    13474, 13497, 240, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_SBJOY2, 
+	    615, 13512, 13521, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_SBJOY3, 
+	    615, 13512, 13521, 0,
+	    PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_EV1938, 
+	    13530, 13537, 0,
+	    PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOMY_1, 
+	    13542, 13551, 13557, 0,
+	    PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOMY_2, 
+	    13542, 13560, 13557, 0,
+	    PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM4Y_1, 
+	    13566, 13551, 13557, 0,
+	    PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM4Y_2, 
+	    13566, 13560, 13557, 0,
+	    PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM8Y_1, 
+	    13576, 13551, 13557, 0,
+	    PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM8Y_2, 
+	    13576, 13560, 13557, 0,
+	    PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOMZ_1, 
+	    13586, 13551, 13557, 0,
+	    PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOMZ_2, 
+	    13586, 13560, 13557, 0,
+	    PCI_VENDOR_CYCLONE, PCI_PRODUCT_CYCLONE_PCI_700, 
+	    13595, 13603, 0,
+	    PCI_VENDOR_CYRIX, PCI_PRODUCT_CYRIX_MEDIAGX_PCHB, 
+	    13613, 13621, 615, 6751, 6247, 0,
+	    PCI_VENDOR_CYRIX, PCI_PRODUCT_CYRIX_CX5520_PCIB, 
+	    13630, 8231, 13637, 0,
+	    PCI_VENDOR_CYRIX, PCI_PRODUCT_CYRIX_CX5530_PCIB, 
+	    13647, 8231, 13637, 13654, 8029, 6355, 0,
+	    PCI_VENDOR_CYRIX, PCI_PRODUCT_CYRIX_CX5530_SMI, 
+	    13647, 8231, 13637, 13669, 13674, 558, 8115, 13681, 0,
+	    PCI_VENDOR_CYRIX, PCI_PRODUCT_CYRIX_CX5530_IDE, 
+	    13647, 8231, 13637, 9356, 13688, 0,
+	    PCI_VENDOR_CYRIX, PCI_PRODUCT_CYRIX_CX5530_AUDIO, 
+	    13647, 8231, 13637, 13700, 0,
+	    PCI_VENDOR_CYRIX, PCI_PRODUCT_CYRIX_CX5530_VIDEO, 
+	    13647, 8231, 13637, 13714, 13688, 0,
+	    PCI_VENDOR_DATUM, PCI_PRODUCT_DATUM_BC635PCI_U, 
+	    13721, 13732, 647, 13735, 10501, 0,
+	    PCI_VENDOR_DAVICOM, PCI_PRODUCT_DAVICOM_DM9102, 
+	    13741, 5611, 5509, 0,
+	    PCI_VENDOR_DCI, PCI_PRODUCT_DCI_APCI4, 
+	    13748, 13754, 0,
+	    PCI_VENDOR_DCI, PCI_PRODUCT_DCI_APCI8, 
+	    13748, 10620, 0,
+	    PCI_VENDOR_DCI, PCI_PRODUCT_DCI_APCI2, 
+	    13748, 13761, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21050, 
+	    13768, 8077, 6355, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21040, 
+	    13776, 13784, 5509, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21030, 
+	    13794, 13802, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_NVRAM, 
+	    13810, 13817, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_KZPSA, 
+	    13824, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21140, 
+	    13830, 13838, 5611, 5509, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_PBXGB, 
+	    13852, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_DEFPA, 
+	    13857, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21041, 
+	    13863, 13871, 13879, 5509, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_DGLPB, 
+	    13886, 13892, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21142, 
+	    13901, 5611, 5509, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21052, 
+	    13915, 8077, 6355, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21150, 
+	    13923, 8077, 6355, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21152, 
+	    13931, 8077, 6355, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21153, 
+	    13939, 8077, 6355, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21154, 
+	    13947, 8077, 6355, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21554, 
+	    13955, 8077, 6355, 0,
+	    PCI_VENDOR_DEC, PCI_PRODUCT_DEC_SWXCR, 
+	    13963, 6242, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_2SI, 
+	    7313, 13969, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3DI, 
+	    7313, 13974, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3SI, 
+	    7313, 13979, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3SI_2, 
+	    7313, 13979, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3DI_2, 
+	    7313, 13974, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3DI_3, 
+	    7313, 13974, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_4DI, 
+	    7313, 13984, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_4DI_2, 
+	    7313, 13984, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_DRAC_4, 
+	    13989, 6578, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_DRAC_4_VUART, 
+	    13989, 6578, 13994, 11064, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_4ESI, 
+	    7313, 14002, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_DRAC_4_SMIC, 
+	    13989, 6578, 14008, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_5, 
+	    7313, 14013, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_6, 
+	    7313, 13268, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3DI_2_SUB, 
+	    7313, 13974, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3SI_2_SUB, 
+	    7313, 13979, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3DI_SUB2, 
+	    7313, 13974, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3DI_SUB3, 
+	    7313, 13974, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3DI_3_SUB, 
+	    7313, 13974, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3DI_3_SUB2, 
+	    7313, 13974, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_3DI_3_SUB3, 
+	    7313, 13974, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_5_1, 
+	    7313, 14015, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_5_2, 
+	    7313, 14019, 0,
+	    PCI_VENDOR_DELL, PCI_PRODUCT_DELL_CERC_1_5, 
+	    14023, 8271, 6242, 14028, 0,
+	    PCI_VENDOR_DELTA, PCI_PRODUCT_DELTA_8139, 
+	    7372, 5509, 0,
+	    PCI_VENDOR_DELTA, PCI_PRODUCT_DELTA_RHINEII, 
+	    7377, 7383, 5611, 5509, 0,
+	    PCI_VENDOR_DIAMOND, PCI_PRODUCT_DIAMOND_VIPER, 
+	    14036, 0,
+	    PCI_VENDOR_DIGI, PCI_PRODUCT_DIGI_ACCELEPORT8R920, 
+	    14046, 14057, 14060, 10620, 6553, 0,
+	    PCI_VENDOR_DIGI, PCI_PRODUCT_DIGI_NEO4, 
+	    14064, 13754, 0,
+	    PCI_VENDOR_DIGI, PCI_PRODUCT_DIGI_NEO8, 
+	    14064, 10620, 0,
+	    PCI_VENDOR_DIGI, PCI_PRODUCT_DIGI_NEO8_PCIE, 
+	    14064, 10620, 5224, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DL1002, 
+	    14068, 5611, 5509, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DFE530TXPLUS, 
+	    14076, 5611, 5509, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DFE690TXD, 
+	    14090, 5611, 5509, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DWL610, 
+	    14101, 7468, 7476, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DL4000, 
+	    14109, 5501, 5509, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DGE550SX, 
+	    14117, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DFE520TX, 
+	    14127, 5611, 5509, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DGE528T, 
+	    14137, 5501, 5509, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DGE560T, 
+	    14146, 5501, 5509, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DGE560T_2, 
+	    14155, 5501, 5509, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DGE560SX, 
+	    14166, 0,
+	    PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DGE530T, 
+	    14176, 5501, 5509, 0,
+	    PCI_VENDOR_DPT, PCI_PRODUCT_DPT_SC_RAID, 
+	    14185, 14206, 0,
+	    PCI_VENDOR_DPT, PCI_PRODUCT_DPT_I960_PPB, 
+	    8077, 6355, 0,
+	    PCI_VENDOR_DPT, PCI_PRODUCT_DPT_RAID_I2O, 
+	    14213, 14223, 0,
+	    PCI_VENDOR_DPT, PCI_PRODUCT_DPT_RAID_2005S, 
+	    14229, 14234, 14213, 14223, 0,
+	    PCI_VENDOR_DPT, PCI_PRODUCT_DPT_MEMCTLR, 
+	    4513, 6247, 0,
+	    PCI_VENDOR_DOLPHIN, PCI_PRODUCT_DOLPHIN_PCISCI32, 
+	    14242, 6355, 14250, 14259, 14262, 0,
+	    PCI_VENDOR_DOLPHIN, PCI_PRODUCT_DOLPHIN_PCISCI64, 
+	    14242, 6355, 14267, 14259, 14262, 0,
+	    PCI_VENDOR_DOLPHIN, PCI_PRODUCT_DOLPHIN_PCISCI66, 
+	    14242, 6355, 14267, 14276, 14262, 0,
+	    PCI_VENDOR_DOMEX, PCI_PRODUCT_DOMEX_PCISCSI, 
+	    14279, 0,
+	    PCI_VENDOR_DYNALINK, PCI_PRODUCT_DYNALINK_IS64PH, 
+	    14289, 8819, 5701, 0,
+	    PCI_VENDOR_ELSA, PCI_PRODUCT_ELSA_QS1PCI, 
+	    14296, 14306, 8819, 10831, 0,
+	    PCI_VENDOR_ELSA, PCI_PRODUCT_ELSA_GLORIAXL, 
+	    14311, 5599, 14318, 0,
+	    PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LP6000, 
+	    14323, 14330, 5701, 0,
+	    PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LP952, 
+	    14343, 14330, 5701, 0,
+	    PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LP982, 
+	    14349, 14330, 5701, 0,
+	    PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LP101, 
+	    14355, 14330, 5701, 0,
+	    PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LP7000, 
+	    14361, 14330, 5701, 0,
+	    PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LP8000, 
+	    14368, 14330, 5701, 0,
+	    PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LP9000, 
+	    14375, 14330, 5701, 0,
+	    PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LP9802, 
+	    14382, 14330, 5701, 0,
+	    PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LP10000, 
+	    14389, 14330, 5701, 0,
+	    PCI_VENDOR_ENE, PCI_PRODUCT_ENE_MCR510, 
+	    14397, 615, 4513, 10831, 14404, 6247, 0,
+	    PCI_VENDOR_ENE, PCI_PRODUCT_ENE_CB712, 
+	    14411, 615, 8281, 10831, 14404, 6247, 0,
+	    PCI_VENDOR_ENE, PCI_PRODUCT_ENE_CB1211, 
+	    14425, 14432, 6247, 0,
+	    PCI_VENDOR_ENE, PCI_PRODUCT_ENE_CB1225, 
+	    14440, 14432, 6247, 0,
+	    PCI_VENDOR_ENE, PCI_PRODUCT_ENE_CB1410, 
+	    14447, 14432, 6247, 0,
+	    PCI_VENDOR_ENE, PCI_PRODUCT_ENE_CB710, 
+	    14454, 14432, 6247, 0,
+	    PCI_VENDOR_ENE, PCI_PRODUCT_ENE_CB1420, 
+	    14460, 14432, 6247, 0,
+	    PCI_VENDOR_ENE, PCI_PRODUCT_ENE_CB720, 
+	    14467, 14432, 6247, 0,
+	    PCI_VENDOR_ENSONIQ, PCI_PRODUCT_ENSONIQ_AUDIOPCI, 
+	    14473, 0,
+	    PCI_VENDOR_ENSONIQ, PCI_PRODUCT_ENSONIQ_AUDIOPCI97, 
+	    14473, 14482, 0,
+	    PCI_VENDOR_ENSONIQ, PCI_PRODUCT_ENSONIQ_CT5880, 
+	    14485, 0,
+	    PCI_VENDOR_EQUINOX, PCI_PRODUCT_EQUINOX_SST64P, 
+	    14492, 5701, 0,
+	    PCI_VENDOR_EQUINOX, PCI_PRODUCT_EQUINOX_SST128P, 
+	    14500, 5701, 0,
+	    PCI_VENDOR_EQUINOX, PCI_PRODUCT_EQUINOX_SST16P_1, 
+	    14509, 5701, 0,
+	    PCI_VENDOR_EQUINOX, PCI_PRODUCT_EQUINOX_SST16P_2, 
+	    14509, 5701, 0,
+	    PCI_VENDOR_EQUINOX, PCI_PRODUCT_EQUINOX_SST16P_3, 
+	    14509, 5701, 0,
+	    PCI_VENDOR_EQUINOX, PCI_PRODUCT_EQUINOX_SST4P, 
+	    14517, 5701, 0,
+	    PCI_VENDOR_EQUINOX, PCI_PRODUCT_EQUINOX_SST8P, 
+	    14524, 5701, 0,
+	    PCI_VENDOR_ESSENTIAL, PCI_PRODUCT_ESSENTIAL_RR_HIPPI, 
+	    14531, 14542, 3027, 0,
+	    PCI_VENDOR_ESSENTIAL, PCI_PRODUCT_ESSENTIAL_RR_GIGE, 
+	    14531, 14548, 3027, 0,
+	    PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO1, 
+	    14554, 14562, 615, 6846, 7629, 0,
+	    PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO2, 
+	    14554, 6203, 615, 6846, 7629, 0,
+	    PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_SOLO1, 
+	    14564, 615, 14571, 0,
+	    PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO2E, 
+	    14554, 14582, 615, 6846, 7629, 0,
+	    PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_ALLEGRO1, 
+	    14585, 615, 6846, 7629, 0,
+	    PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO3, 
+	    14554, 6214, 615, 6846, 7629, 0,
+	    PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO3MODEM, 
+	    14554, 6214, 5556, 0,
+	    PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO3_2, 
+	    14554, 6214, 615, 6846, 7629, 0,
+	    PCI_VENDOR_ESSTECH2, PCI_PRODUCT_ESSTECH2_MAESTRO1, 
+	    14554, 14562, 615, 6846, 7629, 0,
+	    PCI_VENDOR_EUMITCOM, PCI_PRODUCT_EUMITCOM_WL11000P, 
+	    14595, 615, 14604, 12140, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_00F7, 
+	    692, 8041, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_OZ6729, 
+	    14627, 14634, 6355, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_OZ6730, 
+	    14645, 14634, 6355, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_OZ6832, 
+	    14652, 12586, 6355, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_OZ6836, 
+	    14666, 12586, 6355, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_OZ6872, 
+	    14680, 12586, 6355, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_OZ6922, 
+	    14694, 12586, 6355, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_OZ6933, 
+	    14701, 12586, 6355, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_OZ6972, 
+	    14708, 12586, 6355, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_7120, 
+	    14722, 692, 14729, 6247, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_7130, 
+	    14736, 692, 14743, 6247, 0,
+	    PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_7223, 
+	    14752, 12586, 6355, 0,
+	    PCI_VENDOR_ES, PCI_PRODUCT_ES_FREEDOM, 
+	    14760, 14768, 3027, 0,
+	    PCI_VENDOR_EXAR, PCI_PRODUCT_EXAR_XR17D152, 
+	    11069, 14777, 615, 11064, 0,
+	    PCI_VENDOR_EXAR, PCI_PRODUCT_EXAR_XR17D154, 
+	    11082, 14777, 615, 11064, 0,
+	    PCI_VENDOR_EXAR, PCI_PRODUCT_EXAR_XR17D158, 
+	    11095, 14777, 615, 11064, 0,
+	    PCI_VENDOR_FORE, PCI_PRODUCT_FORE_PCA200, 
+	    6917, 14787, 0,
+	    PCI_VENDOR_FORE, PCI_PRODUCT_FORE_PCA200E, 
+	    6917, 14795, 0,
+	    PCI_VENDOR_FORTEMEDIA, PCI_PRODUCT_FORTEMEDIA_FM801, 
+	    14804, 3393, 0,
+	    PCI_VENDOR_FORTEMEDIA, PCI_PRODUCT_FORTEMEDIA_PCIJOY, 
+	    615, 13512, 13521, 0,
+	    PCI_VENDOR_FRESCO, PCI_PRODUCT_FRESCO_FL1000, 
+	    14808, 14815, 6751, 6247, 0,
+	    PCI_VENDOR_FRESCO, PCI_PRODUCT_FRESCO_FL1009, 
+	    14820, 14815, 6751, 6247, 0,
+	    PCI_VENDOR_FUTUREDOMAIN, PCI_PRODUCT_FUTUREDOMAIN_TMC_18C30, 
+	    14827, 14837, 0,
+	    PCI_VENDOR_FUJITSU4, PCI_PRODUCT_FUJITSU4_PW008GE5, 
+	    14845, 0,
+	    PCI_VENDOR_FUJITSU4, PCI_PRODUCT_FUJITSU4_PW008GE4, 
+	    14854, 0,
+	    PCI_VENDOR_FUJITSU4, PCI_PRODUCT_FUJITSU4_PP250_450_LAN, 
+	    14863, 4534, 0,
+	    PCI_VENDOR_FZJZEL, PCI_PRODUCT_FZJZEL_GIGALINK, 
+	    5501, 7818, 2182, 14881, 0,
+	    PCI_VENDOR_FZJZEL, PCI_PRODUCT_FZJZEL_PLXHOTLINK, 
+	    14889, 3027, 0,
+	    PCI_VENDOR_FZJZEL, PCI_PRODUCT_FZJZEL_COUNTTIME, 
+	    14897, 2182, 14905, 0,
+	    PCI_VENDOR_FZJZEL, PCI_PRODUCT_FZJZEL_PLXCAMAC, 
+	    10564, 6247, 0,
+	    PCI_VENDOR_FZJZEL, PCI_PRODUCT_FZJZEL_PROFIBUS, 
+	    14911, 3027, 0,
+	    PCI_VENDOR_FZJZEL, PCI_PRODUCT_FZJZEL_AMCCHOTLINK, 
+	    14920, 14889, 3027, 0,
+	    PCI_VENDOR_EFFICIENTNETS, PCI_PRODUCT_EFFICIENTNETS_ENI155PF, 
+	    14924, 6917, 14933, 0,
+	    PCI_VENDOR_EFFICIENTNETS, PCI_PRODUCT_EFFICIENTNETS_ENI155PA, 
+	    14924, 6917, 14940, 0,
+	    PCI_VENDOR_EFFICIENTNETS, PCI_PRODUCT_EFFICIENTNETS_ENI25P, 
+	    14947, 14959, 0,
+	    PCI_VENDOR_EFFICIENTNETS, PCI_PRODUCT_EFFICIENTNETS_SS3000, 
+	    14947, 14967, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8548E, 
+	    14972, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8548, 
+	    14981, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8543E, 
+	    14989, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8543, 
+	    14998, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8547E, 
+	    15006, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8545E, 
+	    15015, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8545, 
+	    15024, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8544E, 
+	    15032, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8544, 
+	    15041, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8572E, 
+	    15049, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8572, 
+	    15058, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8536E, 
+	    15066, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_MPC8536, 
+	    15075, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P2020E, 
+	    15083, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P2020, 
+	    15090, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P2010E, 
+	    15096, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P2010, 
+	    15103, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1020E, 
+	    15109, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1020, 
+	    15116, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1021E, 
+	    15109, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1021, 
+	    15122, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1024E, 
+	    15128, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1024, 
+	    15135, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1025E, 
+	    15141, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1025, 
+	    15148, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1011E, 
+	    15154, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1011, 
+	    15161, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1022E, 
+	    15167, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1022, 
+	    15174, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1013E, 
+	    15180, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P1013, 
+	    15187, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P4080E, 
+	    15193, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P4080, 
+	    15200, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P4040E, 
+	    15206, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P4040, 
+	    15213, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P2040E, 
+	    15219, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P2040, 
+	    15226, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P3041E, 
+	    15232, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P3041, 
+	    15239, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P5020E, 
+	    15245, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P5020, 
+	    15252, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P5010E, 
+	    15258, 0,
+	    PCI_VENDOR_FREESCALE, PCI_PRODUCT_FREESCALE_P5010, 
+	    15265, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_GT64010A, 
+	    15271, 6, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F1181, 
+	    15281, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F1281, 
+	    15289, 15297, 15301, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88W8300_1, 
+	    15308, 15317, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88W8310, 
+	    15308, 15325, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88W8335_1, 
+	    15308, 15333, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88W8335_2, 
+	    15308, 15333, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SB2211, 
+	    15341, 15350, 15353, 6355, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88W8300_2, 
+	    15308, 15317, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_GT64115, 
+	    15362, 6, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_GT64011, 
+	    15371, 6, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_SKNET, 
+	    15380, 5501, 5509, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKONII_8021CU, 
+	    15387, 15396, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKONII_8022CU, 
+	    15387, 15406, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKONII_8061CU, 
+	    15387, 15416, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKONII_8062CU, 
+	    15387, 15426, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKONII_8021X, 
+	    15387, 15436, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKONII_8022X, 
+	    15387, 15445, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKONII_8061X, 
+	    15387, 15454, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKONII_8062X, 
+	    15387, 15463, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8035, 
+	    15472, 15478, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8036, 
+	    15472, 15486, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8038, 
+	    15472, 15494, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8039, 
+	    15472, 15502, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8040, 
+	    15472, 15510, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_C033, 
+	    15472, 15518, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8052, 
+	    15472, 15526, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8050, 
+	    15472, 15534, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8053, 
+	    15472, 15542, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8055, 
+	    15472, 15550, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_8056, 
+	    15472, 15558, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_1, 
+	    15472, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_C036, 
+	    15472, 15566, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_C032, 
+	    15472, 15574, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_C034, 
+	    15472, 15582, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_C042, 
+	    15472, 15590, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_YUKON_C055, 
+	    15472, 15598, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_GT64120, 
+	    15606, 6, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_BELKIN, 
+	    5039, 5501, 5509, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SX5040, 
+	    15615, 8271, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SX5041, 
+	    15624, 8271, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SX5080, 
+	    15633, 8271, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SX5081, 
+	    15642, 8271, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F5082, 
+	    15651, 15297, 15659, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F5180N, 
+	    15666, 15297, 15659, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F5181, 
+	    15675, 15297, 15659, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F5182, 
+	    15683, 15297, 15659, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F5281, 
+	    15691, 15297, 15301, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SX6040, 
+	    15699, 8271, 7383, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SX6041, 
+	    15708, 8271, 7383, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SX6042, 
+	    15717, 8271, 15726, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SX6080, 
+	    15730, 8271, 7383, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SX6081, 
+	    15739, 8271, 7383, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6082, 
+	    15748, 15297, 15659, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SE6101, 
+	    15756, 6367, 7909, 15765, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SE6121, 
+	    15773, 8271, 7383, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SE614X, 
+	    15782, 8271, 7383, 15791, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SE6145, 
+	    15797, 8271, 7383, 15791, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6180, 
+	    15806, 15297, 15814, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6183, 
+	    15823, 15297, 15659, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6192, 
+	    15831, 15297, 15814, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6281, 
+	    15839, 15297, 15814, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6282, 
+	    15847, 15297, 15814, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_GT64130, 
+	    15855, 6, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_GT64260, 
+	    15864, 6, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV64360, 
+	    15873, 6, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV64460, 
+	    15881, 6, 6247, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV6707, 
+	    15889, 15297, 13152, 15896, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV6710, 
+	    15900, 15297, 13152, 15896, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV6W11, 
+	    15907, 15297, 13152, 15896, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88SX7042, 
+	    15914, 8271, 15726, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78100, 
+	    15923, 15297, 15931, 15941, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78130, 
+	    15952, 15297, 13152, 15960, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78160, 
+	    15963, 15297, 13152, 15960, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78200, 
+	    15971, 15297, 15931, 15941, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78230, 
+	    15979, 15297, 13152, 15960, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78260, 
+	    15987, 15297, 13152, 15960, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78460, 
+	    15995, 15297, 13152, 15960, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6810, 
+	    16003, 15297, 13152, 16011, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6820, 
+	    16015, 15297, 13152, 16011, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6828, 
+	    16023, 15297, 13152, 16011, 0,
+	    PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88W8660, 
+	    16031, 15297, 15659, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE9120, 
+	    16039, 8271, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE912X, 
+	    16048, 8271, 7383, 16060, 8794, 15791, 8276, 6247, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE9125, 
+	    16063, 8271, 8794, 15791, 8276, 6247, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE9172, 
+	    16072, 8271, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE9182, 
+	    16081, 8271, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE9183, 
+	    16090, 8271, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE91XX, 
+	    16099, 8271, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE9215, 
+	    16108, 8271, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE9220, 
+	    16117, 8271, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE9230, 
+	    16126, 8271, 0,
+	    PCI_VENDOR_MARVELL2, PCI_PRODUCT_MARVELL2_88SE9235, 
+	    16135, 8271, 0,
+	    PCI_VENDOR_GLOBALSUN, PCI_PRODUCT_GLOBALSUN_GL24110P, 
+	    16144, 615, 14617, 7468, 0,
+	    PCI_VENDOR_GLOBALSUN, PCI_PRODUCT_GLOBALSUN_GL24110P02, 
+	    16144, 615, 14617, 7468, 0,
+	    PCI_VENDOR_GUILLEMOT, PCI_PRODUCT_GUILLEMOT_MAXIRADIO, 
+	    16153, 0,
+	    PCI_VENDOR_HAWKING, PCI_PRODUCT_HAWKING_PN672TX, 
+	    16163, 5611, 5509, 0,
+	    PCI_VENDOR_HEURICON, PCI_PRODUCT_HEURICON_PMPPC, 
+	    16171, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_VISUALIZE_EG, 
+	    16178, 16185, 16195, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_VISUALIZE_FX6, 
+	    16185, 16198, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_VISUALIZE_FX4, 
+	    16185, 16202, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_VISUALIZE_FX2, 
+	    16185, 16206, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_TACHYON_TL, 
+	    7557, 16210, 7569, 6247, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_TACHYON_XL2, 
+	    7557, 16213, 7569, 6247, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_TACHYON_TS, 
+	    7557, 16217, 7569, 6247, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_J2585A, 
+	    16220, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_J2585B, 
+	    16227, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_DIVA, 
+	    16234, 10627, 16239, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_ELROY, 
+	    16249, 16255, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_VISUALIZE_FXE, 
+	    16185, 16265, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_TOPTOOLS, 
+	    16269, 3332, 7909, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_NETRAID_4M, 
+	    16278, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_SMARTIRQ, 
+	    16289, 16299, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_82557B, 
+	    16308, 5611, 16315, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_PLUTO, 
+	    16319, 16325, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_ZX1_IOC, 
+	    16329, 16333, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_MERCURY, 
+	    2854, 16255, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_QUICKSILVER, 
+	    16337, 16255, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSAV100, 
+	    12992, 12998, 16349, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSAE200I_1, 
+	    12992, 12998, 16354, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSAE200, 
+	    12992, 12998, 16360, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSAE200I_2, 
+	    12992, 12998, 16354, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSAE200I_3, 
+	    12992, 12998, 16354, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSAE200I_4, 
+	    12992, 12998, 16354, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_1, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_2, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSAP800, 
+	    12992, 12998, 16365, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSAP600, 
+	    12992, 12998, 16365, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_3, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_4, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_5, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_6, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSAP400, 
+	    12992, 12998, 16370, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSAP400I, 
+	    12992, 12998, 16375, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_7, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_8, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_9, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_10, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_11, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_12, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_HPSA_13, 
+	    12992, 12998, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_USB, 
+	    16381, 13994, 6743, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_IPMI, 
+	    16386, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_ILO3_SLAVE, 
+	    16381, 16391, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_ILO3_MGMT, 
+	    16381, 6870, 0,
+	    PCI_VENDOR_HP, PCI_PRODUCT_HP_RS780_PPB_GFX, 
+	    16397, 8292, 8077, 6355, 8322, 8327, 0,
+	    PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_7751, 
+	    16403, 0,
+	    PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_6500, 
+	    16408, 0,
+	    PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_7811, 
+	    16413, 0,
+	    PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_7951, 
+	    16418, 0,
+	    PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_7955, 
+	    16423, 0,
+	    PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_7956, 
+	    16433, 0,
+	    PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_78XX, 
+	    16438, 0,
+	    PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_8065, 
+	    16453, 0,
+	    PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_8165, 
+	    16458, 0,
+	    PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_8154, 
+	    16463, 0,
+	    PCI_VENDOR_HINT, PCI_PRODUCT_HINT_HB1, 
+	    16468, 8077, 6355, 0,
+	    PCI_VENDOR_HINT, PCI_PRODUCT_HINT_HB4, 
+	    16472, 8077, 6355, 0,
+	    PCI_VENDOR_HITACHI, PCI_PRODUCT_HITACHI_SWC, 
+	    16476, 234, 12276, 16493, 0,
+	    PCI_VENDOR_HITACHI, PCI_PRODUCT_HITACHI_SH7751, 
+	    16499, 615, 6247, 0,
+	    PCI_VENDOR_HITACHI, PCI_PRODUCT_HITACHI_SH7751R, 
+	    16506, 615, 6247, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_MCABRIDGE, 
+	    16514, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_ALTALITE, 
+	    2544, 6355, 16518, 16520, 16525, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_ALTAMP, 
+	    2544, 6355, 16518, 16520, 16530, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_ISABRIDGE, 
+	    16533, 16538, 16544, 6355, 5948, 16548, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_POWERWAVE, 
+	    16552, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_IDAHO, 
+	    16562, 615, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_CPUBRIDGE, 
+	    2544, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_LANSTREAMER, 
+	    16568, 16573, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT150P, 
+	    16585, 16594, 7629, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_CARRERA, 
+	    16597, 615, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_82G2675, 
+	    16605, 16613, 2439, 6247, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_MCABRIDGE2, 
+	    16514, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_82351, 
+	    16620, 8077, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_MONNAV, 
+	    16626, 615, 6355, 558, 4513, 6247, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_PYTHON, 
+	    16641, 8077, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_SERVERAID, 
+	    7350, 16648, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT250P, 
+	    16661, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_OLYMPIC, 
+	    16670, 5805, 5811, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_MIAMI, 
+	    16675, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_82660, 
+	    16685, 16691, 6807, 615, 6355, 558, 4513, 6247, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_MPIC, 
+	    16699, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_TURBOWAYS25, 
+	    16704, 16714, 6917, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT500P, 
+	    16717, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_I82557B, 
+	    16734, 5611, 5509, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT800P, 
+	    16742, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_EADSPCI, 
+	    16751, 8077, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT3000P, 
+	    16756, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT3000P2, 
+	    16756, 1716, 16766, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT2000P, 
+	    16777, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_OLYMPIC2, 
+	    16787, 6203, 5805, 5811, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_CPC71064, 
+	    16795, 10142, 6355, 558, 4513, 6247, 16802, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_CPC71032, 
+	    16795, 10142, 6355, 558, 4513, 6247, 16810, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_TPAUDIO, 
+	    16818, 16827, 6846, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_405GP, 
+	    16844, 16848, 615, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT4000P, 
+	    16854, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT6000P, 
+	    16864, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT300P, 
+	    16874, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_133PCIX, 
+	    16883, 8171, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_SERVERAID4, 
+	    7350, 6160, 16887, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_440GP, 
+	    16844, 16898, 615, 6355, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_IBMETHER, 
+	    5611, 5509, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT6500P, 
+	    16904, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT4500P, 
+	    16914, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT135P, 
+	    16924, 1716, 5701, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_4810_BSP, 
+	    16933, 16938, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_4810_SCC, 
+	    16933, 16942, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_SERVERAID8K, 
+	    7350, 16946, 0,
+	    PCI_VENDOR_IBM, PCI_PRODUCT_IBM_MPIC2, 
+	    16949, 0,
+	    PCI_VENDOR_ICENSEMBLE, PCI_PRODUCT_ICENSEMBLE_ICE1712, 
+	    16957, 12331, 6846, 6247, 0,
+	    PCI_VENDOR_ICENSEMBLE, PCI_PRODUCT_ICENSEMBLE_VT1720, 
+	    16964, 16976, 6846, 6247, 0,
+	    PCI_VENDOR_ICOMPRESSION, PCI_PRODUCT_ICOMPRESSION_ITVC15, 
+	    16990, 16997, 17003, 0,
+	    PCI_VENDOR_IDT, PCI_PRODUCT_IDT_77201, 
+	    17009, 6917, 17021, 0,
+	    PCI_VENDOR_IDT, PCI_PRODUCT_IDT_RC32334, 
+	    17033, 6, 6247, 0,
+	    PCI_VENDOR_IDT, PCI_PRODUCT_IDT_RC32332, 
+	    17041, 6, 6247, 0,
+	    PCI_VENDOR_INDCOMPSRC, PCI_PRODUCT_INDCOMPSRC_WDT50x, 
+	    17049, 17060, 14905, 0,
+	    PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_1622, 
+	    17069, 8271, 0,
+	    PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_I920, 
+	    17079, 6462, 0,
+	    PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_I850, 
+	    17088, 6462, 0,
+	    PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_I1060, 
+	    17097, 6462, 0,
+	    PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_I940, 
+	    17107, 6462, 0,
+	    PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_I935, 
+	    17116, 6462, 0,
+	    PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_I950, 
+	    17125, 6462, 0,
+	    PCI_VENDOR_INTEGRAPHICS, PCI_PRODUCT_INTEGRAPHICS_IGA1680, 
+	    17134, 17138, 0,
+	    PCI_VENDOR_INTEGRAPHICS, PCI_PRODUCT_INTEGRAPHICS_IGA1682, 
+	    17134, 17143, 0,
+	    PCI_VENDOR_INTEGRAPHICS, PCI_PRODUCT_INTEGRAPHICS_CYBERPRO2000, 
+	    17148, 1319, 0,
+	    PCI_VENDOR_INTEGRAPHICS, PCI_PRODUCT_INTEGRAPHICS_CYBERPRO2010, 
+	    17148, 17157, 0,
+	    PCI_VENDOR_IMS, PCI_PRODUCT_IMS_8849, 
+	    17162, 0,
+	    PCI_VENDOR_IMS, PCI_PRODUCT_IMS_TT128M, 
+	    17167, 17177, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IRONLAKE_D_HB, 
+	    17182, 17187, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IRONLAKE_D_IGD, 
+	    17182, 17187, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IRONLAKE_M_HB, 
+	    17182, 17187, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IRONLAKE_M_IGD, 
+	    17182, 17187, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IRONLAKE_MA_HB, 
+	    17182, 17187, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IRONLAKE_MC2_HB, 
+	    17182, 17187, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6005_2X2_1, 
+	    17192, 17201, 17212, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_1000_1, 
+	    17217, 7818, 14306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_1000_2, 
+	    17217, 7818, 14306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6005_2X2_2, 
+	    17192, 17201, 17212, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6050_2X2_1, 
+	    17192, 17201, 17222, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6050_2X2_2, 
+	    17192, 17201, 17222, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_1030_1, 
+	    17192, 17227, 17238, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_1030_2, 
+	    17192, 17227, 17238, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6230_1, 
+	    17192, 17201, 17243, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6230_2, 
+	    17192, 17201, 17243, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_HB, 
+	    17248, 6355, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_PCIE, 
+	    17248, 6355, 17254, 7843, 6580, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_IGD, 
+	    17248, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_PCIE_1, 
+	    17248, 6355, 17254, 7843, 6580, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_PCIE_2, 
+	    17248, 6355, 17254, 7843, 6580, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_IGD_1, 
+	    17248, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_IGD_2, 
+	    17248, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_M_HB, 
+	    17248, 6355, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_M_IGD, 
+	    17248, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_M_IGD_1, 
+	    17248, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_M_IGD_2, 
+	    17248, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_S_HB, 
+	    17248, 6355, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SANDYBRIDGE_S_IGD, 
+	    17248, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_HB, 
+	    17259, 6355, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_PCIE, 
+	    17259, 6355, 615, 4329, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_IGD, 
+	    17259, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_M_HB, 
+	    17259, 6355, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_PCIE_1, 
+	    17259, 6355, 615, 4329, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_M_IGD, 
+	    17259, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_S_HB, 
+	    17259, 6355, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_PCIE_2, 
+	    17259, 6355, 615, 4329, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_S_IGD, 
+	    17259, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_PCIE_3, 
+	    17259, 6355, 615, 4329, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_IGD_1, 
+	    17259, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_M_IGD_1, 
+	    17259, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IVYBRIDGE_S_IGD_1, 
+	    17259, 6355, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80312, 
+	    17263, 8231, 13637, 4569, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80321, 
+	    17269, 8231, 10501, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6700PXH_IOXAPIC, 
+	    17275, 17283, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6700PXH_PCIE0, 
+	    17275, 615, 17291, 6355, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6700PXH_PCIE1, 
+	    17275, 615, 17291, 6355, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6702PXH_PCIX, 
+	    17312, 615, 17320, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IOP332_A, 
+	    17336, 615, 17291, 6355, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IOP332_B, 
+	    17336, 615, 17291, 6355, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80331, 
+	    17343, 8231, 10501, 8171, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_41210A, 
+	    10627, 6807, 17351, 615, 6355, 10113, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_41210B, 
+	    10627, 6807, 17351, 615, 6355, 5124, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IOP333_A, 
+	    17360, 615, 17291, 6355, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IOP333_B, 
+	    17360, 615, 17291, 6355, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SRCZCRX, 
+	    6242, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SRCU42E, 
+	    6462, 6242, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SRCS28X, 
+	    8271, 6242, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HASWELL_IGD, 
+	    17367, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HASWELL_IGD_1, 
+	    17367, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_IQIA, 
+	    17375, 17254, 17384, 558, 17393, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_IQIA, 
+	    17405, 17254, 17384, 558, 17393, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_SGMII, 
+	    17414, 17423, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_SERDES, 
+	    17414, 17429, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_BPLANE, 
+	    17414, 17436, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_SFP, 
+	    17414, 17446, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_IQIA_VF, 
+	    17414, 17393, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_IQIA_VF, 
+	    17459, 17393, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCEB, 
+	    17468, 12960, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CDC, 
+	    17479, 1400, 558, 7789, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SIO, 
+	    17487, 6, 8231, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82426EX, 
+	    17495, 6629, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCMC, 
+	    17503, 17514, 1400, 558, 4513, 6247, 17519, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_GDT_RAID1, 
+	    17526, 6242, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_GDT_RAID2, 
+	    17526, 6242, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6150_1, 
+	    17192, 17227, 17530, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6150_2, 
+	    17192, 17227, 17530, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_2230_1, 
+	    17192, 17227, 17535, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_2230_2, 
+	    17192, 17227, 17535, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6235, 
+	    17192, 17201, 17540, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6235_2, 
+	    17192, 17201, 17540, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_2200_1, 
+	    17192, 17227, 17545, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_2200_2, 
+	    17192, 17227, 17545, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_135_1, 
+	    17192, 17227, 17550, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_135_2, 
+	    17192, 17227, 17550, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_105_1, 
+	    17192, 17227, 17554, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_105_2, 
+	    17192, 17227, 17554, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_130_1, 
+	    17192, 17227, 17558, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_130_2, 
+	    17192, 17227, 17558, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_SDIO_EMMC, 
+	    17562, 17568, 17574, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_100_1, 
+	    17192, 17227, 5934, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_100_2, 
+	    17192, 17227, 5934, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_7260_1, 
+	    10142, 17584, 4739, 17589, 17592, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_7260_2, 
+	    10142, 17584, 4739, 17589, 17592, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_3160_1, 
+	    10142, 17584, 4739, 17589, 17597, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_3160_2, 
+	    10142, 17584, 4739, 17589, 17597, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_I2C_GPIO, 
+	    17562, 17568, 17602, 558, 17606, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_SPI, 
+	    17562, 17568, 17611, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_HS_UART, 
+	    17562, 17568, 17615, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_MAC, 
+	    17562, 17568, 5611, 5509, 17623, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_EHCI, 
+	    17562, 17568, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_OHCI, 
+	    17562, 17568, 8041, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCIE_NVME_SSD, 
+	    17254, 17627, 17632, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_HB, 
+	    17562, 17568, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_7265_1, 
+	    10142, 17584, 4739, 17589, 17636, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_7265_2, 
+	    10142, 17584, 4739, 17589, 17636, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_LB, 
+	    17562, 17568, 17641, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80960RM, 
+	    17648, 17653, 8077, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80960RN, 
+	    17648, 17656, 8077, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_D_ULT_GT1, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_HOST_DRAM, 
+	    17659, 17664, 17667, 6751, 17676, 7789, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_ULT_GT1, 
+	    8284, 1716, 17684, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_S_ULT_GT1, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT1_1, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_MINI_HDA, 
+	    17659, 17664, 17667, 17690, 8284, 17695, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT1_2, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_D_ULT_GT2, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_ULT_GT2, 
+	    8284, 1716, 17701, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_S_ULT_GT2, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT2_1, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT2_2, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_D_ULT_GT3, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_ULT_GT3, 
+	    8284, 1716, 17707, 17712, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_S_ULT_GT3, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT3_1, 
+	    8284, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_R_ULT_GT3_2, 
+	    17718, 1716, 17723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HASWELL_HOST_DRAM, 
+	    17367, 6751, 17676, 7789, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HASWELL_PCIE16, 
+	    17367, 15791, 17728, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HASWELL_PCIE8, 
+	    17367, 15791, 17732, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE3_12KV3_HOST_DRAM, 
+	    17735, 17740, 17748, 6751, 17676, 7789, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HASWELL_PCIE4, 
+	    17367, 15791, 17751, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HASWELL_MINI_HDA, 
+	    17367, 17690, 8284, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_PCIE_1, 
+	    17754, 17759, 17254, 7843, 7909, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_PCIE_2, 
+	    17754, 17759, 17254, 7843, 7909, 6203, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_PCIE_3, 
+	    17754, 17759, 17254, 7843, 7909, 6214, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_PCIE_4, 
+	    17754, 17759, 17254, 7843, 7909, 6578, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_INTERNALMNG, 
+	    17754, 17759, 17765, 17774, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_DFX1, 
+	    17754, 17759, 17785, 17791, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_DFX2, 
+	    17754, 17759, 17785, 17791, 6203, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_SMBUS_0, 
+	    17754, 17759, 8248, 17800, 9398, 17802, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_SMBUS_1, 
+	    17754, 17759, 8248, 14562, 17816, 17827, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_SMBUS_2, 
+	    17754, 17759, 8248, 6203, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_SMBUS_3, 
+	    17754, 17759, 8248, 6214, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_SMBUS_4, 
+	    17754, 17759, 8248, 6578, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_SMBUS_5, 
+	    17754, 17759, 8248, 14013, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_UART, 
+	    17754, 17759, 17837, 11064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_ILB, 
+	    17754, 17759, 8244, 9391, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_S1220, 
+	    17754, 17848, 17765, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_S1240, 
+	    17754, 17854, 17765, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_S1200_S1260, 
+	    17754, 17860, 17765, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_HB, 
+	    17866, 17870, 10501, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_HDA, 
+	    17866, 17870, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_DMA, 
+	    17866, 17870, 10627, 8184, 17895, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_PWM1, 
+	    17866, 17870, 10627, 8184, 17901, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_PWM2, 
+	    17866, 17870, 10627, 8184, 17901, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_UART1, 
+	    17866, 17870, 10627, 8184, 17907, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_UART2, 
+	    17866, 17870, 10627, 8184, 17907, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO2_SPI, 
+	    17866, 17870, 10627, 8184, 17916, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_PCU_SMB, 
+	    17866, 17870, 17922, 8248, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SCC_MMC, 
+	    17866, 17870, 17926, 8450, 17934, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SCC_SDIO, 
+	    17866, 17870, 17926, 8450, 17947, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SCC, 
+	    17866, 17870, 17926, 8450, 17961, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_TXE, 
+	    17866, 17870, 17973, 17981, 17991, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_PCU_LPC, 
+	    17866, 17870, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SATA_IDE_0, 
+	    17866, 17870, 8271, 17998, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SATA_IDE_1, 
+	    17866, 17870, 8271, 17998, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SATA_AHCI_0, 
+	    17866, 17870, 8271, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SATA_AHCI_1, 
+	    17866, 17870, 8271, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_LPEA, 
+	    17866, 17870, 10955, 3749, 17991, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_IGD, 
+	    17866, 17870, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_EHCI, 
+	    17866, 17870, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_XHCI, 
+	    17866, 17870, 6743, 8287, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_USB_DEV, 
+	    17866, 17870, 6743, 18011, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_CISP, 
+	    17866, 17870, 18018, 4351, 18025, 10501, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO_DMA, 
+	    17866, 17870, 10627, 8184, 17895, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C1, 
+	    17866, 17870, 10627, 8184, 18032, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C2, 
+	    17866, 17870, 10627, 8184, 18032, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C3, 
+	    17866, 17870, 10627, 8184, 18032, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C4, 
+	    17866, 17870, 10627, 8184, 18032, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C5, 
+	    17866, 17870, 10627, 8184, 18032, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C6, 
+	    17866, 17870, 10627, 8184, 18032, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SIO_I2C7, 
+	    17866, 17870, 10627, 8184, 18032, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_PCIE_1, 
+	    17866, 17870, 18038, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_PCIE_2, 
+	    17866, 17870, 18038, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_PCIE_3, 
+	    17866, 17870, 18038, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_PCIE_4, 
+	    17866, 17870, 18038, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82542, 
+	    18043, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82543GC_FIBER, 
+	    18050, 18059, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MODEM56, 
+	    5726, 5556, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82543GC_COPPER, 
+	    18069, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544EI_COPPER, 
+	    18078, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544EI_FIBER, 
+	    18078, 18059, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544GC_COPPER, 
+	    18087, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544GC_LOM, 
+	    18087, 18096, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82540EM, 
+	    18102, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545EM_COPPER, 
+	    18111, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546EB_COPPER, 
+	    18120, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545EM_FIBER, 
+	    18111, 18059, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546EB_FIBER, 
+	    18120, 18059, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82541EI, 
+	    18129, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82541ER_LOM, 
+	    18138, 18096, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82540EM_LOM, 
+	    18102, 18096, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82540EP_LOM, 
+	    18147, 18096, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82540EP, 
+	    18147, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82541EI_MOBILE, 
+	    18129, 18156, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82547EI, 
+	    18163, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82547EI_MOBILE, 
+	    18163, 18156, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546EB_QUAD, 
+	    18120, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82540EP_LP, 
+	    18147, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545GM_COPPER, 
+	    18172, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545GM_FIBER, 
+	    18172, 18059, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545GM_SERDES, 
+	    18172, 5501, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100, 
+	    18190, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IN_BUSINESS, 
+	    18198, 2439, 5509, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_0, 
+	    18190, 18209, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_1, 
+	    18190, 18209, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_0, 
+	    18190, 18212, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_1, 
+	    18190, 18212, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82562EH_HPNA_0, 
+	    18215, 7941, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82562EH_HPNA_1, 
+	    18215, 7941, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82562EH_HPNA_2, 
+	    18215, 7941, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_2, 
+	    18190, 18212, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_2, 
+	    18190, 18209, 3888, 6247, 5948, 18223, 18234, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_3, 
+	    18190, 18209, 3888, 6247, 5948, 18223, 18238, 18234, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_3, 
+	    18190, 18212, 3888, 6247, 5948, 18244, 18234, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_4, 
+	    18190, 18212, 3888, 6247, 5948, 18244, 18238, 18234, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_4, 
+	    18190, 18209, 18255, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_5, 
+	    18190, 18212, 18255, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_2100, 
+	    18261, 4534, 18274, 18279, 5547, 5701, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82597EX, 
+	    18282, 18292, 6017, 5701, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_M_AMT, 
+	    18295, 18303, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_AMT, 
+	    18295, 18311, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_LAN, 
+	    18295, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_IFE_LAN, 
+	    18295, 18317, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_M_LAN, 
+	    18295, 1782, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_6, 
+	    18190, 18212, 3888, 6247, 5948, 18223, 18234, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_LAN, 
+	    18323, 5611, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_7, 
+	    18190, 18212, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_8, 
+	    18190, 18212, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_9, 
+	    18190, 18212, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_10, 
+	    18190, 18212, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_11, 
+	    18190, 18212, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_12, 
+	    18190, 18212, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_M, 
+	    18190, 18345, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_COPPER, 
+	    18347, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_FIBER, 
+	    18347, 18059, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_SERDES, 
+	    18347, 5501, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_LAN_2, 
+	    18356, 5611, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_9, 
+	    18190, 18209, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_13, 
+	    18190, 18212, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_14, 
+	    18190, 18212, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_5, 
+	    18190, 18209, 18096, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801GB_LAN, 
+	    18364, 5611, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_10, 
+	    18190, 18209, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_11, 
+	    18190, 18209, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82547GI, 
+	    18372, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82541GI, 
+	    18381, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82541GI_MOBILE, 
+	    18381, 18156, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82541ER, 
+	    18138, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546GB_COPPER, 
+	    18390, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546GB_FIBER, 
+	    18390, 18059, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546GB_SERDES, 
+	    18390, 5501, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82541PI, 
+	    18399, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82572EI_COPPER, 
+	    18408, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82572EI_FIBER, 
+	    18408, 18059, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82572EI_SERDES, 
+	    18408, 5501, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546GB_PCIE, 
+	    18417, 18428, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82573E, 
+	    18438, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82573E_IAMT, 
+	    18438, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_15, 
+	    18190, 18212, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_6, 
+	    18190, 18209, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_8, 
+	    18190, 18209, 3888, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_7, 
+	    18190, 18209, 3888, 6247, 5948, 18446, 18234, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_16, 
+	    18190, 18212, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80K3LAN_CPR_DPT, 
+	    18453, 10142, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80K3LAN_FIB_DPT, 
+	    18453, 10142, 18059, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80K3LAN_SDS_DPT, 
+	    18453, 10142, 5501, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546GB_QUAD_COPPER, 
+	    18390, 13224, 7909, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82573L, 
+	    18460, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82597EX_CX4, 
+	    18468, 18476, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_QUAD_COPPER, 
+	    18347, 13224, 7909, 5501, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_QUAD_FIBER, 
+	    18347, 13224, 7909, 5501, 18480, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82575EB_COPPER, 
+	    18486, 18495, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82575EB_FIBER_SERDES, 
+	    18486, 18510, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546GB_QUAD_COPPER_KSP3, 
+	    18390, 13224, 7909, 5501, 5509, 18525, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598, 
+	    18532, 18538, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82572EI, 
+	    18408, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80K3LAN_CPR_SPT, 
+	    18453, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80K3LAN_SDS_SPT, 
+	    18453, 5501, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571GB_QUAD_COPPER, 
+	    18542, 13224, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_IGP_AMT, 
+	    18551, 18311, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_IGP_M, 
+	    18551, 18156, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_IFE, 
+	    18551, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_IFE_G, 
+	    18551, 18558, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_IFE_GT, 
+	    18551, 18562, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_IFE_GT, 
+	    18295, 18567, 18562, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_IFE_G, 
+	    18295, 18567, 18558, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598AF_DUAL, 
+	    18532, 13073, 5501, 9077, 10142, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598AF, 
+	    18532, 13073, 5501, 9077, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598AT, 
+	    18532, 13073, 5501, 9144, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82576_COPPER, 
+	    18571, 18577, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82576_VF, 
+	    18571, 18577, 5509, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_IGP_M_V, 
+	    18295, 9184, 18587, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801J_R_BM_LM, 
+	    18592, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801J_R_BM_LF, 
+	    18603, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801J_R_BM_V, 
+	    18614, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82574L, 
+	    18624, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571PT_QUAD_COPPER, 
+	    18632, 18641, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82575GB_QUAD_COPPER, 
+	    18656, 18641, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_DUAL_SERDES, 
+	    18347, 18665, 18670, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_QUAD_SERDES, 
+	    18347, 18677, 18670, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598EB_SFP, 
+	    18682, 13073, 5501, 17446, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598EB_CX4, 
+	    18682, 13073, 5501, 18476, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801J_D_BM_LM, 
+	    18690, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801J_D_BM_LF, 
+	    18701, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598_SR_DUAL_EM, 
+	    18532, 13073, 5501, 18712, 10142, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82575GB_QUAD_COPPER_PM, 
+	    18656, 18715, 5509, 18730, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_BM, 
+	    18735, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82576_FIBER, 
+	    18571, 18746, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82576_SERDES, 
+	    18571, 18756, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82576_QUAD_COPPER, 
+	    18571, 18764, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCH_M_LM, 
+	    18779, 4534, 18783, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCH_M_LC, 
+	    18779, 4534, 18793, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598_CX4_DUAL, 
+	    18532, 13073, 5501, 18476, 10142, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_VF, 
+	    18803, 13073, 5501, 5509, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCH_D_DM, 
+	    18779, 4534, 18809, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCH_D_DC, 
+	    18779, 4534, 18819, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598_DA_DUAL, 
+	    18532, 13073, 5501, 18829, 10142, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598EB_XF_LR, 
+	    18682, 13073, 5501, 18832, 18292, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_IGP_M_AMT, 
+	    18551, 18156, 18311, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82574LA, 
+	    18835, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_KX4, 
+	    18803, 18842, 13073, 18851, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_COMBO_BACKPLANE, 
+	    18803, 18855, 18865, 18876, 13073, 18851, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_CX4, 
+	    18803, 18887, 13073, 18851, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_SFP, 
+	    18803, 18893, 13073, 18851, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_XAUI_LOM, 
+	    18803, 18904, 13073, 18851, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82552, 
+	    18915, 5611, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_DC100_HUB, 
+	    18921, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_DC100_AGP, 
+	    18921, 8090, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_DC100_GRAPH, 
+	    18921, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_NOAGP_HUB, 
+	    18921, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_NOAGP_GRAPH, 
+	    18921, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_NOGRAPH_HUB, 
+	    18921, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_NOGRAPH_AGP, 
+	    18921, 8090, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_FULL_HUB, 
+	    18921, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_FULL_AGP, 
+	    18921, 8090, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_FULL_GRAPH, 
+	    18921, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82806AA, 
+	    18927, 18935, 8235, 576, 18941, 18954, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADI_BECC, 
+	    18964, 18968, 18975, 18979, 13637, 4569, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_PCIE_0, 
+	    17562, 17568, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X1000_PCIE_1, 
+	    17562, 17568, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IXP1200, 
+	    18986, 3888, 10501, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82559ER, 
+	    18994, 2439, 5509, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82092AA, 
+	    19002, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SAA7116, 
+	    19010, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82452_PB, 
+	    19018, 19029, 19035, 4329, 10501, 6807, 615, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82596, 
+	    19044, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EEPRO100, 
+	    19050, 7045, 5934, 5611, 2439, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EEPRO100S, 
+	    19050, 7045, 5934, 12992, 5611, 2439, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8255X, 
+	    19053, 2439, 5509, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82437FX, 
+	    19059, 19067, 6, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371FB_ISA, 
+	    19073, 19081, 6629, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371FB_IDE, 
+	    19073, 19081, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371MX, 
+	    19088, 19096, 18156, 615, 8231, 6418, 19104, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82437MX, 
+	    19115, 19123, 18156, 6, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82441FX, 
+	    19130, 19138, 615, 558, 4513, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82380AB, 
+	    19144, 19152, 18156, 6629, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82380FB, 
+	    19159, 19167, 18156, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82439HX, 
+	    19175, 19183, 6, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82870P2_PPB, 
+	    19189, 19197, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82870P2_IOxAPIC, 
+	    19189, 19197, 17283, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82870P2_HPLUG, 
+	    19189, 19197, 19203, 19207, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_82567V_3, 
+	    19212, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCH2_LV_LM, 
+	    19222, 5501, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCH2_LV_V, 
+	    19230, 5501, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_SFP_EM, 
+	    18803, 18538, 5509, 4329, 10593, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598_BX, 
+	    18532, 18538, 5509, 19237, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82576_NS, 
+	    18571, 18756, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82598AT2, 
+	    18532, 18538, 19240, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82583V, 
+	    19244, 7669, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82576_SERDES_QUAD, 
+	    18571, 19252, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_COPPER, 
+	    19265, 18577, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_FIBER, 
+	    19265, 18746, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_SERDES, 
+	    19265, 18577, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_SGMII, 
+	    19265, 18756, 5509, 19271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_KX4_MEZZ, 
+	    18803, 18538, 19279, 5509, 19283, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X540_VF, 
+	    19293, 18538, 5509, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_COPPER_DUAL, 
+	    19265, 19298, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_KR, 
+	    18803, 18538, 5509, 19313, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82576_NS_SERDES, 
+	    18571, 18756, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_T3_LOM, 
+	    18803, 18538, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_ER, 
+	    19265, 18577, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_ER_DUAL, 
+	    19265, 19298, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I350_VF, 
+	    19316, 5501, 3888, 18334, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I350_COPPER, 
+	    19316, 5501, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I350_FIBER, 
+	    19316, 5501, 18480, 3888, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I350_SERDES, 
+	    19316, 5501, 19321, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I350_SGMII, 
+	    19316, 5501, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801J_D_BM_V, 
+	    19331, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82576_QUAD_COPPER_ET2, 
+	    18571, 18764, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_QUAD_FIBER, 
+	    19265, 19338, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X540_AT2, 
+	    19353, 19362, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_SFP_FCOE, 
+	    18803, 13073, 18851, 19372, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_BPLANE_FCOE, 
+	    18803, 13073, 18851, 19321, 19372, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82576_VF_HV, 
+	    18571, 18577, 5509, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_VF_HV, 
+	    18803, 13073, 18851, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I350_VF_HV, 
+	    19316, 5501, 3888, 18334, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X540_VF_HV, 
+	    19293, 13073, 18851, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I210_T1, 
+	    19377, 5509, 6017, 5701, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I210_COPPER_OEM1, 
+	    19385, 5509, 19390, 19398, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I210_COPPER_IT, 
+	    19385, 5509, 19390, 19403, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I210_FIBER, 
+	    19385, 5509, 19407, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I210_SERDES, 
+	    19385, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I210_SGMII, 
+	    19385, 5509, 19271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I211_COPPER, 
+	    19415, 5509, 19420, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I217_LM, 
+	    19429, 5509, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I217_V, 
+	    19437, 5509, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I350_DA4, 
+	    19316, 13224, 6580, 5501, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_SFP_SF_QP, 
+	    18803, 13073, 18851, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XL710_VF, 
+	    19444, 5509, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_SFP_SF2, 
+	    18803, 19450, 13073, 18851, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599EN_SFP, 
+	    18803, 13073, 18851, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I218_V, 
+	    19457, 5509, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I218_LM, 
+	    19464, 5509, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X540_BYPASS, 
+	    19293, 13073, 18851, 19472, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82599_BYPASS, 
+	    18803, 13073, 18851, 19472, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XL710_VF_HV, 
+	    19444, 5509, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XL710_SFP, 
+	    19444, 19479, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I210_COPPER_WOF, 
+	    19385, 5509, 19420, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I210_SERDES_WOF, 
+	    19385, 5509, 18181, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XL710_KX_A, 
+	    19444, 19484, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XL710_KX_B, 
+	    19444, 19484, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XL710_KX_C, 
+	    19444, 19484, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XL710_QSFP_A, 
+	    19444, 19487, 19493, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XL710_QSFP_B, 
+	    19444, 19487, 19493, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XL710_QSFP_C, 
+	    19444, 19487, 19493, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X710_10G_T, 
+	    19499, 19504, 5509, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I218_LM2, 
+	    19464, 5509, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I218_V2, 
+	    19457, 5509, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I218_LM3, 
+	    19464, 5509, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I218_V3, 
+	    19457, 5509, 18334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_HB_1, 
+	    17659, 19513, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_HDA_1, 
+	    17659, 19513, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_GT1, 
+	    8284, 1716, 17684, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_GT2_1, 
+	    8284, 1716, 19516, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_GT2_2, 
+	    8284, 1716, 13004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_GT3_15W, 
+	    8284, 1716, 19521, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_GT3_28W, 
+	    17718, 1716, 19526, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80960_RP, 
+	    19531, 19538, 19545, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80960RM_2, 
+	    17648, 17653, 8077, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82840_HB, 
+	    19560, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82840_AGP, 
+	    19560, 8090, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82840_PCI, 
+	    19560, 615, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82845_HB, 
+	    19566, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82845_AGP, 
+	    19566, 8090, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_DMA, 
+	    17707, 6268, 10051, 19572, 17991, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_SATA_1, 
+	    13268, 6268, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_SATA_2, 
+	    13268, 6268, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_AHCI_1, 
+	    13268, 6268, 8276, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_AHCI_2, 
+	    13268, 6268, 8276, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_RAID_1, 
+	    13268, 6268, 6242, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_RAID_2, 
+	    13268, 6268, 6242, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_RAID_3, 
+	    13268, 6268, 6242, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_SATA_3, 
+	    13268, 6268, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_SATA_4, 
+	    13268, 6268, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_PCIE_1, 
+	    13268, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_PCIE_2, 
+	    13268, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_PCIE_3, 
+	    13268, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_PCIE_4, 
+	    13268, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_PCIE_5, 
+	    13268, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_PCIE_6, 
+	    13268, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_PCIE_7, 
+	    13268, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_PCIE_8, 
+	    13268, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_HDA, 
+	    13268, 6268, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_SMB, 
+	    13268, 6268, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_THERM, 
+	    13268, 6268, 19576, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_DMI, 
+	    13268, 6268, 19584, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_EHCI_1, 
+	    13268, 6268, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_EHCI_2, 
+	    13268, 6268, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_MEI, 
+	    13268, 6268, 19592, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6SERIES_KT, 
+	    13268, 6268, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Z68_LPC, 
+	    19599, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_P67_LPC, 
+	    19603, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_UM67_LPC, 
+	    19607, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HM65_LPC, 
+	    19612, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_H67_LPC, 
+	    19617, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HM67_LPC, 
+	    19621, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Q65_LPC, 
+	    19626, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_QS67_LPC, 
+	    19630, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Q67_LPC, 
+	    19635, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_QM67_LPC, 
+	    19639, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_B65_LPC, 
+	    19644, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C202_LPC, 
+	    19648, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C204_LPC, 
+	    19653, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C206_LPC, 
+	    19658, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_H61_LPC, 
+	    19663, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SATA_1, 
+	    19667, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_AHCI, 
+	    19667, 8276, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_RAID_1, 
+	    19667, 6242, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_RAID_2, 
+	    19667, 19676, 6242, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SATA_2, 
+	    19667, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_PCIE_1, 
+	    19667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_PCIE_2, 
+	    19667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_PCIE_3, 
+	    19667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_PCIE_4, 
+	    19667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_PCIE_5, 
+	    19667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_PCIE_6, 
+	    19667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_PCIE_7, 
+	    19667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_PCIE_8, 
+	    19667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_HDA, 
+	    19684, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SMBUS, 
+	    19684, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_THERM, 
+	    19684, 19576, 6870, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_EHCI_1, 
+	    19684, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_EHCI_2, 
+	    19684, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_LAN, 
+	    19684, 4534, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_MEI_1, 
+	    19684, 19592, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_MEI_2, 
+	    19684, 19592, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_KT, 
+	    19684, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_VPCIE, 
+	    19684, 13994, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_LPC, 
+	    19684, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_1, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_SATA_1, 
+	    19684, 5801, 6247, 19689, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_2, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_3, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_4, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_5, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_6, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_7, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_8, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_9, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_SATA_2, 
+	    19684, 5801, 6247, 19689, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_SATA_3, 
+	    19667, 5801, 6247, 19689, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_10, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_11, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_12, 
+	    19684, 5801, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SAS_SATA_4, 
+	    19684, 5801, 6247, 19689, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SMB_0, 
+	    19667, 6268, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SMB_1, 
+	    19696, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SMB_2, 
+	    19706, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SER_DT_SATA_1, 
+	    19711, 6268, 19713, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SER_MO_SATA_1, 
+	    19711, 6268, 17667, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SER_DT_SATA_AHCI, 
+	    19711, 6268, 19713, 8271, 6247, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SER_MO_SATA_AHCI, 
+	    19711, 6268, 17667, 8271, 6247, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SER_DT_SATA_RAID_2, 
+	    19711, 6268, 19713, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SER_DT_SATA_RAID_3, 
+	    19711, 6268, 19713, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SER_MO_SATA_RAID, 
+	    19711, 6268, 17667, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SER_DT_SATA_2, 
+	    19711, 6268, 19713, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SER_MO_SATA_2, 
+	    19711, 6268, 17667, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SER_DT_SATA_RAID_1, 
+	    19711, 6268, 19713, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_PCIE_1, 
+	    19711, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_PCIE_2, 
+	    19711, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_PCIE_3, 
+	    19711, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_PCIE_4, 
+	    19711, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_PCIE_5, 
+	    19711, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_PCIE_6, 
+	    19711, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_PCIE_7, 
+	    19711, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_PCIE_8, 
+	    19711, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_HDA, 
+	    19711, 6268, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_SMB, 
+	    19711, 6268, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_PPB, 
+	    19711, 6268, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_EHCI_1, 
+	    19711, 6268, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_EHCI_2, 
+	    19711, 6268, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_XHCI, 
+	    19711, 6268, 6743, 8287, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_MEI_1, 
+	    19711, 6268, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_MEI_2, 
+	    19711, 6268, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_IDE_R, 
+	    19711, 6268, 19730, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_7SERIES_KT, 
+	    19711, 6268, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Z77_LPC, 
+	    19736, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Z75_LPC, 
+	    19740, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Q77_LPC, 
+	    19744, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Q75_LPC, 
+	    19748, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_B75_LPC, 
+	    19752, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_H77_LPC, 
+	    19756, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C216_LPC, 
+	    19760, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MOBILE_QM77_LPC, 
+	    18156, 19765, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MOBILE_QS77_LPC, 
+	    18156, 19770, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MOBILE_HM77_LPC, 
+	    18156, 19775, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MOBILE_UM77_LPC, 
+	    18156, 19780, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MOBILE_HM76_LPC, 
+	    18156, 19785, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MOBILE_HM75_LPC, 
+	    18156, 19790, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MOBILE_HM70_LPC, 
+	    18156, 19795, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_NM70_LPC, 
+	    19800, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_0, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_1, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_2, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_3, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_4, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_5, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_6, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_7, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_8, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_9, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_A, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_B, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_C, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_D, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_E, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_TROUTER_F, 
+	    19805, 17876, 17888, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_PCIE_1, 
+	    19805, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_PCIE_2, 
+	    19805, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_PCIE_3, 
+	    19805, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_PCIE_4, 
+	    19805, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_RAS, 
+	    19805, 19811, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_SMBUS, 
+	    19805, 8248, 6762, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_RCEC, 
+	    19805, 19815, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_IQIA_PHYS, 
+	    19805, 19820, 19825, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_IQIA_VF, 
+	    19805, 19820, 13994, 17450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_SATA2, 
+	    19805, 19834, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_USB, 
+	    19805, 6743, 6762, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_SATA3, 
+	    19805, 19840, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_PCU_1, 
+	    19805, 17922, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_PCU_2, 
+	    19805, 17922, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_PCU_3, 
+	    19805, 17922, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_PCU_4, 
+	    19805, 17922, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_PCU_SMBUS, 
+	    19805, 17922, 8248, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_1000KX, 
+	    19805, 19846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_SGMII, 
+	    19805, 19868, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_DUMMYGBE, 
+	    19805, 19884, 19899, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_25GBE, 
+	    19805, 19909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_LPC, 
+	    17375, 8244, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_SATA_1, 
+	    17375, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_SATA_2, 
+	    17375, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_SMB, 
+	    17375, 8248, 6751, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_THERMAL, 
+	    17375, 19576, 19926, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_USB_1, 
+	    17375, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_USB_2, 
+	    17375, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_PCIE_1_1, 
+	    17375, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_PCIE_1_2, 
+	    17375, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_PCIE_2_1, 
+	    17375, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_PCIE_2_2, 
+	    17375, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_PCIE_3_1, 
+	    17375, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_PCIE_3_2, 
+	    17375, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_PCIE_4_1, 
+	    17375, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_PCIE_4_2, 
+	    17375, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_WDT, 
+	    17375, 17060, 14905, 3305, 17659, 19936, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_MEI_1, 
+	    17375, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCC_MEI_2, 
+	    17375, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_LPC, 
+	    17405, 8244, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_SATA_1, 
+	    17405, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_SATA_2, 
+	    17405, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_SMB, 
+	    17405, 8248, 6751, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_THERMAL, 
+	    17405, 19576, 19926, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_USB_1, 
+	    17405, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_USB_2, 
+	    17405, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_PCIE_1_1, 
+	    17405, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_PCIE_1_2, 
+	    17405, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_PCIE_2_1, 
+	    17405, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_PCIE_2_2, 
+	    17405, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_PCIE_3_1, 
+	    17405, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_PCIE_3_2, 
+	    17405, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_PCIE_4_1, 
+	    17405, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_PCIE_4_2, 
+	    17405, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_WDT, 
+	    17405, 17060, 14905, 3305, 17659, 19936, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_MEI_1, 
+	    17405, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH89XXCL_MEI_2, 
+	    17405, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_LPC, 
+	    19942, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_IDE, 
+	    19942, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_USB, 
+	    19942, 6743, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_SMB, 
+	    19942, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_ACA, 
+	    19942, 19950, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_ACM, 
+	    19942, 19950, 615, 5556, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_HPB, 
+	    19942, 19956, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_LPC, 
+	    19964, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_IDE, 
+	    19964, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_USB, 
+	    19964, 6743, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_SMB, 
+	    19964, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_ACA, 
+	    19964, 19950, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_ACM, 
+	    19964, 19950, 615, 5556, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_HPB, 
+	    19964, 19956, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_LPC, 
+	    19972, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_USB1, 
+	    19972, 6743, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_SMB, 
+	    19972, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_USB2, 
+	    19972, 6743, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_ACA, 
+	    19972, 19950, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_ACM, 
+	    19972, 19950, 615, 5556, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BAM_HPB, 
+	    19980, 19956, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_LAN, 
+	    19972, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BAM_IDE, 
+	    19980, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_IDE, 
+	    19972, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BAM_LPC, 
+	    19980, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_HPB, 
+	    19972, 19956, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801E_LPC, 
+	    19989, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801E_SMB, 
+	    19989, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801E_LAN_1, 
+	    19989, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801E_LAN_2, 
+	    19989, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CA_LPC, 
+	    19996, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CA_USB_1, 
+	    19996, 6743, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CA_SMB, 
+	    19996, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CA_USB_2, 
+	    19996, 6743, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CA_AC, 
+	    19996, 9259, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CA_MOD, 
+	    19996, 9259, 5556, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CA_USBC, 
+	    19996, 6743, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CA_IDE_1, 
+	    19996, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CA_IDE_2, 
+	    19996, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CAM_LPC, 
+	    20004, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DB_LPC, 
+	    20013, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DB_USB_1, 
+	    20013, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DB_SMB, 
+	    20013, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DB_USB_2, 
+	    20013, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DB_AC, 
+	    20013, 8158, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DB_MOD, 
+	    20013, 8158, 5556, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DB_USB_3, 
+	    20013, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DBM_IDE, 
+	    20026, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DB_IDE, 
+	    20013, 6418, 6247, 20035, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DBM_LPC, 
+	    20013, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801DB_USBC, 
+	    20013, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_LPC, 
+	    20050, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_SATA, 
+	    20050, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_USB_0, 
+	    18323, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_SMB, 
+	    18323, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_USB_1, 
+	    18323, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_AC, 
+	    18323, 9259, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_MOD, 
+	    18323, 9259, 5556, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_USB_2, 
+	    18323, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_IDE, 
+	    18323, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_EHCI, 
+	    18323, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_USB_3, 
+	    18323, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801ER_SATA, 
+	    20058, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82820_MCH, 
+	    20066, 20072, 20076, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82820_AGP, 
+	    20066, 8090, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82850_HB, 
+	    20085, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82860_HB, 
+	    20091, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82850_AGP, 
+	    20097, 8090, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82860_PCI1, 
+	    20091, 8077, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82860_PCI2, 
+	    20091, 8077, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82860_PCI3, 
+	    20091, 8077, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82860_PCI4, 
+	    20091, 8077, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7500_HB, 
+	    20109, 20072, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7500_DRAM, 
+	    20109, 20072, 7789, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7500_HI_B1, 
+	    20109, 20072, 20115, 20120, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7500_HI_B2, 
+	    20109, 20072, 20115, 20120, 6203, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7500_HI_C1, 
+	    20109, 20072, 20125, 20120, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7500_HI_C2, 
+	    20109, 20072, 20125, 20120, 6203, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7500_HI_D1, 
+	    20109, 20072, 20130, 20120, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7500_HI_D2, 
+	    20109, 20072, 20130, 20120, 6203, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7501_HB, 
+	    20135, 20072, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7505_HB, 
+	    20141, 20072, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7505_RAS, 
+	    20141, 20072, 19811, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7505_AGP, 
+	    20141, 20072, 20147, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7505_HI_B1, 
+	    20141, 20072, 20115, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7505_HI_B2, 
+	    20141, 20072, 20115, 8077, 20156, 20162, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82845G_DRAM, 
+	    20172, 7789, 6247, 2182, 20182, 20191, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82845G_AGP, 
+	    20172, 20147, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82845G_IGD, 
+	    20172, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82865_HB, 
+	    20195, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82865_AGP, 
+	    20195, 8090, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82865_IGD, 
+	    20201, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801EB_HPB, 
+	    20050, 19956, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82875P_HB, 
+	    20208, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82875P_AGP, 
+	    20208, 8090, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82875P_CSA, 
+	    20208, 20215, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915G_HB, 
+	    20223, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915G_EX, 
+	    20223, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915G_IGD, 
+	    20235, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82925X_HB, 
+	    20245, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82925X_EX, 
+	    20245, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7221_HB, 
+	    20252, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7221_IGD, 
+	    20252, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915GM_HB, 
+	    20258, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915GM_EX, 
+	    20282, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915GM_IGD, 
+	    20293, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_LPC, 
+	    20314, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_IDE, 
+	    20314, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_SATA, 
+	    20314, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_SMB, 
+	    20314, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_ACA, 
+	    20314, 9259, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_ACM, 
+	    20314, 9259, 5556, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_USB_0, 
+	    20314, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_USB_1, 
+	    20314, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_WDT, 
+	    20314, 17060, 14905, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_APIC, 
+	    20314, 576, 18954, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_EHCI, 
+	    20314, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_PCIX, 
+	    20314, 8171, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_6300ESB_RAID, 
+	    20314, 8271, 6242, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000X_MCH, 
+	    20322, 4513, 6247, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000Z_HB, 
+	    20328, 20334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000V_HB, 
+	    20338, 20334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000P_HB, 
+	    20344, 20334, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_PCIE_1, 
+	    17707, 6268, 10051, 615, 4329, 17751, 7909, 6203, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_PCIE_2, 
+	    17707, 6268, 10051, 615, 4329, 17751, 7909, 6214, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_PCIE_3, 
+	    17707, 6268, 10051, 615, 4329, 17751, 7909, 6578, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_PCIE_4, 
+	    17707, 6268, 10051, 615, 4329, 17751, 7909, 14013, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_PCIE_5, 
+	    17707, 6268, 10051, 615, 4329, 17751, 7909, 13268, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_PCIE_6, 
+	    17707, 6268, 10051, 615, 4329, 17751, 7909, 19711, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_FSB_REG, 
+	    17707, 6268, 10051, 20350, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_RESERVED_1, 
+	    17707, 6268, 10051, 20364, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_RESERVED_2, 
+	    17707, 6268, 10051, 20364, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_FBD_1, 
+	    17707, 6268, 10051, 20373, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_FBD_2, 
+	    17707, 6268, 10051, 20373, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_PCIE_7, 
+	    17707, 6268, 10051, 615, 4329, 17732, 7909, 20377, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_PCIE_8, 
+	    17707, 6268, 10051, 615, 4329, 17732, 7909, 20381, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000_PCIE_9, 
+	    17707, 6268, 10051, 615, 4329, 17732, 7909, 20385, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5000X_PCIE, 
+	    20322, 615, 4329, 17728, 7909, 20389, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_LPC, 
+	    18356, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FBM_LPC, 
+	    20393, 20402, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_SATA, 
+	    18356, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FR_SATA, 
+	    20408, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FBM_SATA, 
+	    20393, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_USB_0, 
+	    20416, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_USB_1, 
+	    20416, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_USB_2, 
+	    20416, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_USB_3, 
+	    20416, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_EHCI, 
+	    20416, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_EXP_0, 
+	    20416, 615, 4329, 7909, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_EXP_1, 
+	    20416, 615, 4329, 7909, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_EXP_2, 
+	    20416, 615, 4329, 7909, 20427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_HDA, 
+	    20416, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_SMB, 
+	    20416, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_LAN, 
+	    18356, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_ACM, 
+	    20416, 9259, 5556, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_AC, 
+	    20416, 9259, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801FB_IDE, 
+	    20416, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_LPC, 
+	    20446, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_SATA, 
+	    20446, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_SATA_AHCI, 
+	    20446, 8276, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_USB_0, 
+	    20446, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_USB_1, 
+	    20446, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_USB_2, 
+	    20446, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_USB_3, 
+	    20446, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_EHCI, 
+	    20446, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_EXP_1, 
+	    20446, 615, 4329, 7909, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_EXP_2, 
+	    20446, 615, 4329, 7909, 20427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_EXP_3, 
+	    20446, 615, 4329, 7909, 20454, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_EXP_4, 
+	    20446, 615, 4329, 7909, 20457, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_ACA, 
+	    20446, 9259, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_HDA, 
+	    20446, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_SMB, 
+	    20446, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_IDE, 
+	    20446, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945P_MCH, 
+	    20460, 4513, 6247, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945P_EXP, 
+	    20460, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945P_IGD, 
+	    20460, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82955X_HB, 
+	    20469, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82955X_EXP, 
+	    20469, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7230_HB, 
+	    20476, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7230_EXP, 
+	    20476, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82975X_EXP_2, 
+	    20482, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82975X_HB, 
+	    20482, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82975X_EXP, 
+	    20482, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915G_IGDC, 
+	    20235, 20489, 13637, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915GM_IGDC, 
+	    20493, 20489, 13637, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945GM_HB, 
+	    20505, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945GM_IGD, 
+	    20505, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945GM_IGD_1, 
+	    20505, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945GME_HB, 
+	    20520, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945GME_IGD, 
+	    20520, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801GH_LPC, 
+	    20529, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_LPC, 
+	    20537, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801GBM_LPC, 
+	    20548, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_NM10_LPC, 
+	    20557, 10675, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801GHM_LPC, 
+	    20562, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_SATA, 
+	    20537, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_SATA_AHCI, 
+	    20537, 8276, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_SATA_RAID, 
+	    20537, 6242, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801GBM_SATA, 
+	    20571, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801GBM_AHCI, 
+	    20548, 8276, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801GHM_RAID, 
+	    20562, 8271, 6242, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_USB_1, 
+	    20537, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_USB_2, 
+	    20537, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_USB_3, 
+	    20537, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_USB_4, 
+	    20537, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_EHCI, 
+	    20537, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_EXP_1, 
+	    20537, 615, 4329, 7909, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_EXP_2, 
+	    20537, 615, 4329, 7909, 20427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_EXP_3, 
+	    20537, 615, 4329, 7909, 20454, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_EXP_4, 
+	    20537, 615, 4329, 7909, 20457, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_HDA, 
+	    20537, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_SMB, 
+	    20537, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_LAN, 
+	    20537, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_ACM, 
+	    20537, 9259, 5556, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_ACA, 
+	    20537, 9259, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_IDE, 
+	    20537, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_EXP_5, 
+	    20537, 615, 4329, 7909, 20584, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801G_EXP_6, 
+	    20537, 615, 4329, 7909, 20587, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_LPC, 
+	    20590, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HEM_LPC, 
+	    20597, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HH_LPC, 
+	    20606, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HO_LPC, 
+	    20614, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HBM_LPC, 
+	    20622, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_SATA_1, 
+	    20590, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_SATA_AHCI6, 
+	    20590, 8276, 8271, 6247, 5948, 13268, 20631, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_SATA_RAID, 
+	    20590, 6242, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_SATA_AHCI4, 
+	    20590, 8276, 8271, 6247, 5948, 6578, 20631, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_SATA_2, 
+	    20590, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HEM_SATA, 
+	    20597, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HBM_SATA_1, 
+	    20622, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HBM_SATA_2, 
+	    20637, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_USB_1, 
+	    20590, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_USB_2, 
+	    20590, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_USB_3, 
+	    20590, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_USB_4, 
+	    20590, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_USB_5, 
+	    20590, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_EHCI_1, 
+	    20590, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_EHCI_2, 
+	    20590, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_SMB, 
+	    20590, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_EXP_1, 
+	    20590, 615, 4329, 7909, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_EXP_2, 
+	    20590, 615, 4329, 7909, 20427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_EXP_3, 
+	    20590, 615, 4329, 7909, 20454, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_EXP_4, 
+	    20590, 615, 4329, 7909, 20457, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_EXP_5, 
+	    20590, 615, 4329, 7909, 20584, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_EXP_6, 
+	    20590, 615, 4329, 7909, 20587, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_HDA, 
+	    20590, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_THERMAL, 
+	    20590, 19576, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HBM_IDE, 
+	    20590, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IH_LPC, 
+	    20646, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IO_LPC, 
+	    20654, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IR_LPC, 
+	    20662, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IEM_LPC, 
+	    20670, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IB_LPC, 
+	    20679, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IM_LPC, 
+	    20687, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_SATA_1, 
+	    18551, 8271, 6247, 5948, 6578, 20631, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_SATA_2, 
+	    18551, 8271, 6247, 5948, 6203, 20631, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_SATA_AHCI6, 
+	    18551, 8276, 8271, 6247, 5948, 13268, 20631, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_SATA_AHCI4, 
+	    18551, 8276, 8271, 6247, 5948, 6578, 20631, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_SATA_3, 
+	    18551, 8271, 6247, 5948, 6203, 20631, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_SATA_4, 
+	    18551, 18156, 8276, 8271, 6247, 20695, 6203, 20631, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_SATA_5, 
+	    18551, 18156, 8276, 8271, 6247, 20695, 6578, 20631, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_SATA_6, 
+	    18551, 18156, 8276, 8271, 6247, 20695, 6203, 20631, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_SATA_7, 
+	    18551, 18156, 8276, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_SMB, 
+	    18551, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_THERMAL, 
+	    18551, 19576, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_USB_1, 
+	    18551, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_USB_2, 
+	    18551, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_USB_3, 
+	    18551, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_USB_4, 
+	    18551, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_USB_5, 
+	    18551, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_USB_6, 
+	    18551, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_EHCI_1, 
+	    18551, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_EHCI_2, 
+	    18551, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_HDA, 
+	    18551, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_EXP_1, 
+	    18551, 615, 4329, 7909, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_EXP_2, 
+	    18551, 615, 4329, 7909, 20427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_EXP_3, 
+	    18551, 615, 4329, 7909, 20454, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_EXP_4, 
+	    18551, 615, 4329, 7909, 20457, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_EXP_5, 
+	    18551, 615, 4329, 7909, 20584, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_EXP_6, 
+	    18551, 615, 4329, 7909, 20587, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_IGP_C, 
+	    18551, 20700, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82946GZ_HB, 
+	    20704, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82946GZ_IGD, 
+	    20704, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82946GZ_KT, 
+	    20704, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G35_HB, 
+	    20712, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G35_IGD, 
+	    20712, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G35_IGD_1, 
+	    20712, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965Q_HB, 
+	    20718, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965Q_EXP, 
+	    20718, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965Q_IGD, 
+	    20718, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965Q_IGD_1, 
+	    20718, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q965_KT, 
+	    20725, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965G_HB, 
+	    20732, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965G_EXP, 
+	    20732, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965G_IGD, 
+	    20732, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965G_IGD_1, 
+	    20732, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82P965_KT, 
+	    20739, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q35_HB, 
+	    20751, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q35_EXP, 
+	    20751, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q35_IGD, 
+	    20751, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q35_IGD_1, 
+	    20751, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q35_KT, 
+	    20751, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G33_HB, 
+	    20757, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G33_EXP, 
+	    20767, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G33_IGD, 
+	    20767, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G33_IGD_1, 
+	    20767, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_LAN, 
+	    18551, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G33_KT, 
+	    20773, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q33_HB, 
+	    20751, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q33_EXP, 
+	    20751, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q33_IGD, 
+	    20751, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q33_IGD_1, 
+	    20751, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q33_KT, 
+	    20791, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X38_HB, 
+	    20797, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X38_PCIE_1, 
+	    20797, 20803, 17254, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X38_HECI, 
+	    20797, 20816, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X38_KT, 
+	    20797, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X38_PCIE_2, 
+	    20797, 20821, 17254, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3200_HB, 
+	    20836, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3200_PCIE, 
+	    20836, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3200_KT, 
+	    10011, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965PM_HB, 
+	    20846, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80862A01, 
+	    20854, 18156, 615, 4329, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965PM_IGD, 
+	    20846, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965PM_IGD_1, 
+	    20846, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965PM_MEI, 
+	    20846, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965PM_IDE, 
+	    20846, 6418, 3027, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965PM_KT, 
+	    20863, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965GME_HB, 
+	    20874, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965GME_IGD, 
+	    20874, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965GME_KT, 
+	    20874, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_HB, 
+	    20883, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_IGD, 
+	    20883, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_IGD_1, 
+	    20883, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82GM45_KT, 
+	    20883, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82IGD_E_HB, 
+	    20890, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82IGD_E_IGD, 
+	    20890, 692, 1716, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_KT, 
+	    20898, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_HB, 
+	    20898, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_EXP, 
+	    20898, 615, 4329, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_IGD, 
+	    20898, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_IGD_1, 
+	    20898, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_KT_1, 
+	    20898, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G45_HB, 
+	    20904, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G45_IGD, 
+	    20904, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G41_HB, 
+	    20910, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G41_IGD, 
+	    20910, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82B43_HB, 
+	    20916, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82B43_IGD, 
+	    20916, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_DMI2, 
+	    17735, 20922, 17748, 20925, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_1, 
+	    17735, 20922, 17748, 17254, 7843, 7909, 20930, 20925, 20933, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_2_1, 
+	    17735, 20922, 17748, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_2_2, 
+	    17735, 20922, 17748, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_2_3, 
+	    17735, 20922, 17748, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_2_4, 
+	    17735, 20922, 17748, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_3_1, 
+	    17735, 20922, 17748, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_3_2, 
+	    17735, 20922, 17748, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_3_3, 
+	    17735, 20922, 17748, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_3_4, 
+	    17735, 20922, 17748, 17254, 7843, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_R2PCIE_1, 
+	    17735, 20922, 17748, 692, 8184, 5811, 3027, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_UBOX_1, 
+	    17735, 20922, 17748, 20938, 558, 20949, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_UBOX_3, 
+	    17735, 20922, 17748, 20938, 558, 20949, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH0, 
+	    17735, 20922, 17748, 20960, 19572, 14234, 17800, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH1, 
+	    17735, 20922, 17748, 20960, 19572, 14234, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH2, 
+	    17735, 20922, 17748, 20960, 19572, 14234, 6203, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH3, 
+	    17735, 20922, 17748, 20960, 19572, 14234, 6214, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH4, 
+	    17735, 20922, 17748, 20960, 19572, 14234, 6578, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH5, 
+	    17735, 20922, 17748, 20960, 19572, 14234, 14013, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH6, 
+	    17735, 20922, 17748, 20960, 19572, 14234, 13268, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH7, 
+	    17735, 20922, 17748, 20960, 19572, 14234, 19711, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IIO_AM, 
+	    17735, 20922, 17748, 7777, 20964, 20969, 20974, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IIO_RAM, 
+	    17735, 20922, 17748, 20978, 20983, 353, 20987, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IIO_IOAPIC, 
+	    17735, 20922, 17748, 8231, 20994, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_R2PCIE_2, 
+	    17735, 20922, 17748, 17254, 5811, 20999, 21011, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_RQPI_PM_1, 
+	    17735, 20922, 17748, 21022, 5811, 20999, 21011, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_RQPI_PM_2, 
+	    17735, 20922, 17748, 21022, 5811, 3027, 21011, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_MAIN, 
+	    17735, 20922, 17748, 21026, 21030, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_TADR1, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 10640, 7777, 21042, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_TADR2, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 10640, 7777, 21042, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_RAS, 
+	    17735, 20922, 17748, 21026, 19811, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_RAS, 
+	    17735, 20922, 17748, 21026, 21049, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_UBOX_2, 
+	    17735, 20922, 17748, 20938, 558, 20949, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QPI_LINK0, 
+	    17735, 20922, 17748, 21022, 7818, 17800, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_RQPI_RING, 
+	    17735, 20922, 17748, 21022, 5811, 3027, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QPI_LINK1, 
+	    17735, 20922, 17748, 21022, 7818, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCU_1, 
+	    17735, 20922, 17748, 3749, 8450, 21053, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCU_2, 
+	    17735, 20922, 17748, 3749, 8450, 21053, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCU_3, 
+	    17735, 20922, 17748, 3749, 8450, 21053, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCU_5, 
+	    17735, 20922, 17748, 3749, 8450, 21053, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_MAIN, 
+	    17735, 20922, 17748, 21026, 21030, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_TADR1, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 10640, 7777, 21042, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_TADR2, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 10640, 7777, 21042, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_TADR3, 
+	    17735, 20922, 17748, 21026, 21035, 20377, 10640, 7777, 21042, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_TADR4, 
+	    17735, 20922, 17748, 21026, 21035, 20377, 10640, 7777, 21042, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG1, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG2, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG3, 
+	    17735, 20922, 17748, 21026, 21035, 20377, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG4, 
+	    17735, 20922, 17748, 21026, 21035, 20377, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG5, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG6, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG7, 
+	    17735, 20922, 17748, 21026, 21035, 20377, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_REG8, 
+	    17735, 20922, 17748, 21026, 21035, 20377, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_1, 
+	    17735, 20922, 17748, 21026, 21058, 21064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_2, 
+	    17735, 20922, 17748, 21026, 21058, 21064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_5, 
+	    17735, 20922, 17748, 21026, 21058, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_6, 
+	    17735, 20922, 17748, 21026, 21058, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_7, 
+	    17735, 20922, 17748, 21026, 21058, 21064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_8, 
+	    17735, 20922, 17748, 21026, 21058, 21064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_3, 
+	    17735, 20922, 17748, 21026, 21058, 21064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_DDRIO_4, 
+	    17735, 20922, 17748, 21026, 21058, 21064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCU_4, 
+	    17735, 20922, 17748, 3749, 8450, 21053, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_REG5, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_REG6, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_REG7, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC1_REG8, 
+	    17735, 20922, 17748, 21026, 21035, 21038, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_9, 
+	    17735, 20922, 17748, 21026, 21058, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_A, 
+	    17735, 20922, 17748, 21026, 21058, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_B, 
+	    17735, 20922, 17748, 21026, 21058, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_IMC0_DDRIO_C, 
+	    17735, 20922, 17748, 21026, 21058, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_3165_1, 
+	    10142, 17584, 4739, 17589, 21074, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_31244, 
+	    21079, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82855PM_DDR, 
+	    21085, 20072, 6751, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82855PM_AGP, 
+	    21085, 20147, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82855PM_PM, 
+	    21085, 3749, 6870, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_HB, 
+	    21093, 21097, 6580, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5500_HB, 
+	    19516, 20334, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_HB, 
+	    21093, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_825520_HB, 
+	    21101, 20334, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_1, 
+	    21106, 18038, 7843, 7909, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_2, 
+	    21106, 18038, 7843, 7909, 6203, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_3, 
+	    21106, 18038, 7843, 7909, 6214, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_4, 
+	    21106, 18038, 7843, 7909, 6578, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_5, 
+	    21106, 18038, 7843, 7909, 14013, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_6, 
+	    21106, 18038, 7843, 7909, 13268, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_7, 
+	    21106, 18038, 7843, 7909, 19711, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_8, 
+	    21106, 18038, 7843, 7909, 6603, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_9, 
+	    21106, 18038, 7843, 7909, 1047, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_10, 
+	    21106, 18038, 7843, 7909, 13073, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_0_0, 
+	    21106, 18038, 7843, 7909, 17800, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_PCIE_0_1, 
+	    21106, 18038, 7843, 7909, 17800, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_GPIO, 
+	    21106, 21120, 558, 17606, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_RAS, 
+	    21106, 8450, 13674, 558, 19811, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_QP0_P0, 
+	    21106, 21132, 7909, 17800, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_QP0_P1, 
+	    21106, 21132, 7909, 17800, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_QP1_P0, 
+	    21106, 21132, 7909, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_QP1_P1, 
+	    21106, 21132, 7909, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_IOXAPIC, 
+	    21106, 17283, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_MISC, 
+	    21106, 21142, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82X58_THROTTLE, 
+	    21106, 21147, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_EXP_UP, 
+	    20446, 615, 4329, 21158, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_PCIX, 
+	    20446, 615, 4329, 6807, 8171, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_EXP_DN_1, 
+	    20446, 615, 4329, 21167, 7909, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_EXP_DN_2, 
+	    20446, 615, 4329, 21167, 7909, 20427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_63XXESB_EXP_DN_3, 
+	    20446, 615, 4329, 21167, 7909, 20454, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82830MP_IO_1, 
+	    21178, 2544, 6807, 8231, 6355, 14562, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82830MP_AGP, 
+	    21178, 2544, 6807, 8090, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82830MP_IV, 
+	    21178, 692, 234, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82830MP_IO_2, 
+	    21178, 2544, 6807, 8231, 6355, 6203, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82855GM_MCH, 
+	    21186, 20182, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82855GM_AGP, 
+	    21186, 20147, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82855GM_IGD, 
+	    21186, 21194, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82855GM_MC, 
+	    21186, 21194, 4513, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82855GM_CP, 
+	    21186, 21194, 7763, 21199, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7525_MCH, 
+	    21207, 4513, 6247, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7525_MCHER, 
+	    21207, 20156, 20162, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7520_DMA, 
+	    21213, 19572, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7525_PCIE_A, 
+	    21207, 615, 4329, 7909, 10113, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7525_PCIE_A1, 
+	    21207, 615, 4329, 7909, 21219, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7525_PCIE_B, 
+	    21207, 615, 4329, 7909, 5124, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7520_PCIE_B1, 
+	    21213, 615, 4329, 7909, 11010, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7520_PCIE_C, 
+	    21213, 615, 4329, 7909, 10119, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7520_PCIE_C1, 
+	    21213, 615, 4329, 7909, 21222, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7520_CFG, 
+	    21213, 19035, 7763, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_SATA_IDE, 
+	    21225, 8271, 6247, 9356, 9361, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_SATA_AHCI, 
+	    21225, 8271, 6247, 9367, 9361, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_SATA_RAID, 
+	    21225, 8271, 6247, 21233, 9361, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_SATA_IDE2, 
+	    21225, 8271, 6247, 9356, 9361, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JDO_LPC, 
+	    21239, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JIR_LPC, 
+	    21248, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JIB_LPC, 
+	    21257, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_LPC, 
+	    21225, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_SATA_IDE, 
+	    21266, 8271, 6247, 9356, 9361, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_SATA_AHCI, 
+	    21266, 8271, 6247, 9367, 9361, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_SATA_RAID, 
+	    21266, 8271, 6247, 21233, 9361, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_SATA_IDE2, 
+	    21266, 8271, 6247, 9356, 9361, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_SMB, 
+	    21266, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_THERMAL, 
+	    21266, 19576, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_USB_1, 
+	    21266, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_USB_2, 
+	    21266, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_USB_3, 
+	    21266, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_USB_4, 
+	    21266, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_USB_5, 
+	    21266, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_USB_6, 
+	    21266, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_EHCI_1, 
+	    21266, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_EHCI_2, 
+	    21266, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_HDA, 
+	    21266, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_PCIE_1, 
+	    21266, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_PCIE_2, 
+	    21266, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_PCIE_3, 
+	    21266, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_PCIE_4, 
+	    21266, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_PCIE_5, 
+	    21266, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_PCIE_6, 
+	    21266, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_LAN, 
+	    21266, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_SMB, 
+	    21225, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_THERMAL, 
+	    21225, 19576, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_USB_1, 
+	    21225, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_USB_2, 
+	    21225, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_USB_3, 
+	    21225, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_USB_4, 
+	    21225, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_USB_5, 
+	    21225, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_USB_6, 
+	    21225, 6743, 20021, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_EHCI_1, 
+	    21225, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_EHCI_2, 
+	    21225, 6743, 8046, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_HDA, 
+	    21225, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_PCIE_1, 
+	    21225, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_PCIE_2, 
+	    21225, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_PCIE_3, 
+	    21225, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_PCIE_4, 
+	    21225, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_PCIE_5, 
+	    21225, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_PCIE_6, 
+	    21225, 615, 4329, 7909, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_LAN, 
+	    21225, 4534, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_P55_LPC, 
+	    21274, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PM55_LPC, 
+	    21278, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_H55_LPC, 
+	    21283, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_QM57_LPC, 
+	    21287, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_H57_LPC, 
+	    21292, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HM55_LPC, 
+	    21296, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Q57_LPC, 
+	    21301, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HM57_LPC, 
+	    21305, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_QS57_LPC, 
+	    21310, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_LPC, 
+	    10415, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3420_LPC, 
+	    21315, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3450_LPC, 
+	    21320, 8244, 3027, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_SATA_1, 
+	    10415, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_SATA_2, 
+	    10415, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_AHCI_1, 
+	    10415, 8276, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_AHCI_2, 
+	    10415, 8276, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_RAID_1, 
+	    10415, 6242, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_SATA_3, 
+	    10415, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_SATA_4, 
+	    10415, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_AHCI_3, 
+	    10415, 8276, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_RAID_2, 
+	    10415, 6242, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_SATA_5, 
+	    10415, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_SATA_6, 
+	    10415, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_AHCI_4, 
+	    10415, 8276, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_SMB, 
+	    10415, 8248, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_THERMAL, 
+	    10415, 19576, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_EHCI_1, 
+	    10415, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_UHCI_1, 
+	    10415, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_UHCI_2, 
+	    10415, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_UHCI_3, 
+	    10415, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_UHCI_4, 
+	    10415, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_UHCI_5, 
+	    10415, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_UHCI_6, 
+	    10415, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_EHCI_2, 
+	    10415, 6743, 21325, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_UHCI_7, 
+	    10415, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_UHCI_8, 
+	    10415, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_PCIE_1, 
+	    10415, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_PCIE_2, 
+	    10415, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_PCIE_3, 
+	    10415, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_PCIE_4, 
+	    10415, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_PCIE_5, 
+	    10415, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_PCIE_6, 
+	    10415, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_PCIE_7, 
+	    10415, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_PCIE_8, 
+	    10415, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_HDA, 
+	    10415, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_QS57_HDA, 
+	    21310, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_MEI_1, 
+	    10415, 19592, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_MEI_2, 
+	    10415, 19592, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_PT_IDER, 
+	    10415, 21330, 21333, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3400_KT, 
+	    10415, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_HB, 
+	    20922, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_PCIE_1, 
+	    20922, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_PCIE_2, 
+	    20922, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_PCIE_3, 
+	    20922, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_PCIE_4, 
+	    20922, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_PCIE_5, 
+	    20922, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_PCIE_6, 
+	    20922, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_PCIE_7, 
+	    20922, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_PCIE_8, 
+	    20922, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_PCIE_9, 
+	    20922, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_PCIE_10, 
+	    20922, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_DMA_1, 
+	    20922, 19572, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_DMA_2, 
+	    20922, 19572, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_DMA_3, 
+	    20922, 19572, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_DMA_4, 
+	    20922, 19572, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_DMA_5, 
+	    20922, 19572, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_DMA_6, 
+	    20922, 19572, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_DMA_7, 
+	    20922, 19572, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_DMA_8, 
+	    20922, 19572, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_ADDRMAP, 
+	    20922, 7777, 7785, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_ERR, 
+	    20922, 20156, 20162, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5_IOAPIC, 
+	    20922, 8231, 20994, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_HB, 
+	    21338, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400A_HB, 
+	    21343, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400B_HB, 
+	    21349, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_PCIE_1, 
+	    21338, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_PCIE_2, 
+	    21338, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_PCIE_3, 
+	    21338, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_PCIE_4, 
+	    21338, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_PCIE_5, 
+	    21338, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_PCIE_6, 
+	    21338, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_PCIE_7, 
+	    21338, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_PCIE_8, 
+	    21338, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_PCIE_9, 
+	    21338, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IOAT_SNB, 
+	    21355, 21361, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_FSBINT, 
+	    21338, 21365, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_CE, 
+	    21338, 21384, 17991, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_IOAPIC, 
+	    21338, 8216, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_RAS_0, 
+	    21338, 19811, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5400_RAS_1, 
+	    21338, 19811, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E600_VGA, 
+	    21394, 692, 7989, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E600_HB, 
+	    21394, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_2200BG, 
+	    18261, 4534, 21399, 5547, 5701, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_2225BG, 
+	    18261, 4534, 21406, 5547, 5701, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_3945ABG_1, 
+	    18261, 4534, 21413, 5547, 5701, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_2915ABG_1, 
+	    18261, 4534, 21421, 5547, 5701, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_2915ABG_2, 
+	    18261, 4534, 21421, 5547, 5701, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_3945ABG_2, 
+	    18261, 4534, 21413, 5547, 5701, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_4965_1, 
+	    4739, 17217, 7818, 21429, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6000_3X3_1, 
+	    17192, 21434, 21445, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6000_IPA_1, 
+	    17192, 17201, 21450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_4965_3, 
+	    4739, 17217, 7818, 21429, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_4965_2, 
+	    4739, 17217, 7818, 21429, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_5100_1, 
+	    17217, 7818, 17723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_4965_4, 
+	    4739, 17217, 7818, 21429, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_5300_1, 
+	    17217, 7818, 13004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_5300_2, 
+	    17217, 7818, 13004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_5100_2, 
+	    17217, 7818, 17723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6000_3X3_2, 
+	    17192, 21434, 21445, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_6000_IPA_2, 
+	    17192, 17201, 21450, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_5350_1, 
+	    17217, 7818, 21455, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_5350_2, 
+	    17217, 7818, 21455, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_5150_1, 
+	    17217, 7818, 21460, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WIFI_LINK_5150_2, 
+	    17217, 7818, 21460, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_HB, 
+	    21465, 6751, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_MEM, 
+	    21465, 4513, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_EDMA, 
+	    21465, 21473, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_PCIE_1, 
+	    21465, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_PCIE_2, 
+	    21465, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_SATA, 
+	    21465, 8271, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_AHCI, 
+	    21465, 8276, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_ASU, 
+	    21465, 21478, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_RESERVED1, 
+	    21465, 20364, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_LPC, 
+	    21465, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_SMB, 
+	    21465, 8248, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_UHCI, 
+	    21465, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_EHCI, 
+	    21465, 6743, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_PPB, 
+	    21465, 8077, 9391, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_CAN_1, 
+	    21465, 21482, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_CAN_2, 
+	    21465, 21482, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_SERIAL, 
+	    21465, 10627, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_1588, 
+	    21465, 21489, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_LEB, 
+	    21465, 21494, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_GCU, 
+	    21465, 21498, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_RESERVED2, 
+	    21465, 20364, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_LAN_1, 
+	    21465, 4534, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_LAN_2, 
+	    21465, 4534, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_LAN_3, 
+	    21465, 4534, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80312_ATU, 
+	    21502, 21508, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371SB_ISA, 
+	    21512, 21520, 6629, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371SB_IDE, 
+	    21512, 21520, 6418, 3027, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371SB_USB, 
+	    21512, 21520, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82437VX, 
+	    21528, 21536, 6, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82439TX, 
+	    21542, 21550, 6, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371AB_ISA, 
+	    21557, 21565, 6629, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371AB_IDE, 
+	    21557, 21565, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371AB_USB, 
+	    21557, 21565, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371AB_PMC, 
+	    21557, 21565, 3749, 6870, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_MCH, 
+	    21573, 4513, 6247, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_GC, 
+	    21573, 1716, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_DC100_MCH, 
+	    21579, 4513, 6247, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_DC100_GC, 
+	    21579, 1716, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810E_MCH, 
+	    21591, 4513, 6247, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810E_GC, 
+	    21591, 1716, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443LX, 
+	    21598, 615, 8090, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443LX_AGP, 
+	    21598, 8090, 3027, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443BX, 
+	    21606, 6751, 21614, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443BX_AGP, 
+	    21606, 8090, 3027, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443BX_NOAGP, 
+	    21606, 6751, 21614, 9434, 21632, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX, 
+	    21642, 6751, 21614, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_ACA, 
+	    21642, 19950, 6846, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_ISA, 
+	    21642, 6629, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_IDE, 
+	    21642, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_USB, 
+	    21642, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_PMC, 
+	    21642, 3749, 6870, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443GX, 
+	    21650, 6751, 21614, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443GX_AGP, 
+	    21650, 8090, 3027, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443GX_NOAGP, 
+	    21650, 6751, 21614, 9434, 21632, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I740, 
+	    21658, 1716, 7629, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SCH_IDE, 
+	    21663, 6418, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E600_HDA, 
+	    21394, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E600_PCIB_0, 
+	    21394, 13994, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E600_PCIB_1, 
+	    21394, 13994, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E600_GVD, 
+	    21394, 692, 21667, 234, 21675, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E600_PCIB_2, 
+	    21394, 13994, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E600_PCIB_3, 
+	    21394, 13994, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E600_LPC, 
+	    17754, 10501, 21683, 8244, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCI450_PB, 
+	    21688, 615, 6355, 21699, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCI450_MC, 
+	    21704, 4513, 6247, 21715, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82451NX_MIOC, 
+	    21720, 4513, 647, 8231, 6247, 21728, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82451NX_PXB, 
+	    21720, 615, 21735, 6355, 21744, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_PCIB, 
+	    21750, 18779, 21756, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_PCTHUB, 
+	    21750, 18779, 4487, 8235, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_GBE, 
+	    21750, 18779, 5501, 21767, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_GPIO, 
+	    21750, 18779, 17606, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_OHCI1_0, 
+	    21750, 18779, 6743, 8041, 6751, 6247, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_OHCI1_1, 
+	    21750, 18779, 6743, 8041, 6751, 6247, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_OHCI1_2, 
+	    21750, 18779, 6743, 8041, 6751, 6247, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_EHCI1, 
+	    21750, 18779, 6743, 8046, 6751, 6247, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_USB_DEV, 
+	    21750, 18779, 6743, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_SDIO_0, 
+	    21750, 18779, 21773, 6247, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_SDIO_1, 
+	    21750, 18779, 21773, 6247, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_AHCI, 
+	    21750, 18779, 8276, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_OHCI0_0, 
+	    21750, 18779, 6743, 8041, 6751, 6247, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_OHCI0_1, 
+	    21750, 18779, 6743, 8041, 6751, 6247, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_OHCI0_2, 
+	    21750, 18779, 6743, 8041, 6751, 6247, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_EHCI0, 
+	    21750, 18779, 6743, 8046, 6751, 6247, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_DMA_0, 
+	    21750, 18779, 21778, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_UART_0, 
+	    21750, 18779, 11064, 17306, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_UART_1, 
+	    21750, 18779, 11064, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_UART_2, 
+	    21750, 18779, 11064, 20427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_UART_3, 
+	    21750, 18779, 11064, 20454, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_DMA_1, 
+	    21750, 18779, 21778, 17309, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_SPI, 
+	    21750, 18779, 17611, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_I2C, 
+	    21750, 18779, 17602, 3027, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_CAN, 
+	    21750, 18779, 21783, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_IEEE1588, 
+	    21750, 18779, 21787, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_DT_SATA, 
+	    6603, 6268, 19713, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_MO_SATA, 
+	    6603, 6268, 17667, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_DT_SATA_AHCI, 
+	    6603, 6268, 19713, 8271, 6247, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_MO_SATA_AHCI, 
+	    6603, 6268, 17667, 8271, 6247, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_DT_SATA_RAID, 
+	    6603, 6268, 19713, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_MO_SATA_RAID, 
+	    6603, 6268, 17667, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_DT_SATA_RAID_SR, 
+	    6603, 6268, 19713, 8271, 6247, 19723, 21796, 12992, 21798, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_MO_SATA_RAID_SR, 
+	    6603, 6268, 17667, 8271, 6247, 19723, 21796, 12992, 21798, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_DT_SATA_2, 
+	    6603, 6268, 19713, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_MO_SATA_2, 
+	    6603, 6268, 17667, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_DT_SATA_RAID1, 
+	    6603, 6268, 19713, 8271, 6247, 21807, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SER_MO_SATA_RAID1, 
+	    6603, 6268, 17667, 8271, 6247, 21807, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_PCIE_1, 
+	    6603, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_PCIE_2, 
+	    6603, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_PCIE_3, 
+	    6603, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_PCIE_4, 
+	    6603, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_PCIE_5, 
+	    6603, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_PCIE_6, 
+	    6603, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_PCIE_7, 
+	    6603, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_PCIE_8, 
+	    6603, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_HDA, 
+	    6603, 6268, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_SMB, 
+	    6603, 6268, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_THERM, 
+	    6603, 6268, 19576, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_EHCI_1, 
+	    6603, 6268, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_EHCI_2, 
+	    6603, 6268, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_XHCI, 
+	    6603, 6268, 6743, 8287, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_LAN, 
+	    6603, 6268, 4534, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_MEI_1, 
+	    6603, 6268, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_MEI_2, 
+	    6603, 6268, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_IDE_R, 
+	    6603, 6268, 19730, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_KT, 
+	    6603, 6268, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_M_LPC, 
+	    6603, 6268, 18156, 21815, 21820, 21829, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_8SERIES_D_LPC, 
+	    6603, 6268, 21832, 21815, 21820, 21829, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Z87_LPC, 
+	    21840, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Z85_LPC, 
+	    21844, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HM86_LPC, 
+	    21848, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_H87_LPC, 
+	    21853, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HM87_LPC, 
+	    21857, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Q85_LPC, 
+	    21862, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Q87_LPC, 
+	    21866, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_QM87_LPC, 
+	    21870, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_B85_LPC, 
+	    21875, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C222_LPC, 
+	    21879, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C224_LPC, 
+	    21884, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C226_LPC, 
+	    21889, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_H81_LPC, 
+	    21894, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_SATA, 
+	    1047, 6268, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_SATA_AHCI, 
+	    1047, 6268, 8271, 6247, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_SATA_RAID, 
+	    1047, 6268, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_SATA_RAID_SR, 
+	    1047, 6268, 8271, 6247, 19723, 21796, 12992, 21798, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_SATA_2, 
+	    1047, 6268, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_SATA_RAID1, 
+	    1047, 6268, 8271, 6247, 21807, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_PCIE_1, 
+	    1047, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_PCIE_2, 
+	    1047, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_PCIE_3, 
+	    1047, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_PCIE_4, 
+	    1047, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_PCIE_5, 
+	    1047, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_PCIE_6, 
+	    1047, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_PCIE_7, 
+	    1047, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_PCIE_8, 
+	    1047, 6268, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_HDA, 
+	    1047, 6268, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_SMB, 
+	    1047, 6268, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_THERM, 
+	    1047, 6268, 19576, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_EHCI_1, 
+	    1047, 6268, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_EHCI_2, 
+	    1047, 6268, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_XHCI, 
+	    1047, 6268, 6743, 8287, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_LAN, 
+	    1047, 6268, 4534, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_MEI_1, 
+	    1047, 6268, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_MEI_2, 
+	    1047, 6268, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_IDE_R, 
+	    1047, 6268, 19730, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_KT, 
+	    1047, 6268, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_LPC_ES, 
+	    1047, 6268, 21815, 21820, 21829, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Z97_LPC, 
+	    21898, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_H97_LPC, 
+	    21902, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SATA, 
+	    21906, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SATA_AHCI, 
+	    21906, 8271, 6247, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SATA_RAID, 
+	    21906, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SATA_RAID_2, 
+	    21906, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SATA_RAID_3, 
+	    21906, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SATA_2, 
+	    21906, 8271, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SSATA, 
+	    21906, 21915, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SSATA_AHCI, 
+	    21906, 21915, 6247, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SSATA_RAID, 
+	    21906, 21915, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SSATA_RAID_2, 
+	    21906, 21915, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_1_1, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_1_2, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_1_3, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_2_1, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_2_2, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_3_1, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_3_2, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_4_1, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_4_2, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_5_1, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_5_2, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_6_1, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_6_2, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_7_1, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_7_2, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_8_1, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_PCIE_8_2, 
+	    21906, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_HDA, 
+	    21906, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_HDA_2, 
+	    21906, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SMB, 
+	    21906, 8248, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_THERM, 
+	    21906, 19576, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_EHCI, 
+	    21906, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_EHCI_2, 
+	    21906, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_XHCI, 
+	    21906, 6743, 8287, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_LAN, 
+	    21906, 4534, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_MEI, 
+	    21906, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_MEI_2, 
+	    21906, 19592, 6247, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_IDE_R, 
+	    21906, 19730, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_KT, 
+	    21906, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X99_LPC, 
+	    21921, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X99_LPC_2, 
+	    21921, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_SPSR, 
+	    21906, 21925, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_MS_SMB0, 
+	    21906, 21930, 21933, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_MS_SMB1, 
+	    21906, 21930, 21933, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C610_MS_SMB2, 
+	    21906, 21930, 21933, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_AHCI, 
+	    17659, 17664, 17667, 8271, 6247, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_RAID_1, 
+	    17659, 17664, 17667, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_RAID_2, 
+	    17659, 17664, 17667, 8271, 6247, 19723, 19676, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_RAID_3, 
+	    17659, 17664, 17667, 8271, 6247, 19723, 19676, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_PCIE_1, 
+	    17659, 17664, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_PCIE_2, 
+	    17659, 17664, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_PCIE_3, 
+	    17659, 17664, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_PCIE_4, 
+	    17659, 17664, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_PCIE_5, 
+	    17659, 17664, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_PCIE_6, 
+	    17659, 17664, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_HDA, 
+	    17659, 17664, 17667, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_SMB, 
+	    17659, 17664, 17667, 8248, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_THERM, 
+	    17659, 17664, 17667, 19576, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_EHCI, 
+	    17659, 17664, 17667, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_XHCI, 
+	    17659, 17664, 17667, 6743, 8287, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_SDIO, 
+	    17659, 17664, 17667, 21773, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_SSOUND, 
+	    17659, 17664, 17667, 12992, 3393, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_MEI_1, 
+	    17659, 17664, 17667, 19592, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_MEI_2, 
+	    17659, 17664, 17667, 19592, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_IDE_R, 
+	    17659, 17664, 17667, 19730, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_KT, 
+	    17659, 17664, 17667, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_LPC_1, 
+	    17659, 17664, 17667, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_LPC_2, 
+	    17659, 17664, 17667, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_LPC_3, 
+	    17659, 17664, 17667, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_S_DMA, 
+	    17659, 17664, 17667, 10627, 8231, 19572, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_S_I2C_0, 
+	    17659, 17664, 17667, 10627, 8231, 17602, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_S_I2C_1, 
+	    17659, 17664, 17667, 10627, 8231, 17602, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_S_UART_0, 
+	    17659, 17664, 17667, 10627, 8231, 11064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_S_UART_1, 
+	    17659, 17664, 17667, 10627, 8231, 11064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_S_GSPI_0, 
+	    17659, 17664, 17667, 10627, 8231, 21939, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE4G_M_S_GSPI_1, 
+	    17659, 17664, 17667, 10627, 8231, 21939, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_AHCI, 
+	    17659, 19513, 17667, 8271, 6247, 18004, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_RAID_1, 
+	    17659, 19513, 17667, 8271, 6247, 19723, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_RAID_2, 
+	    17659, 19513, 17667, 8271, 6247, 19723, 19676, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_RAID_3, 
+	    17659, 19513, 17667, 8271, 6247, 19723, 21944, 21948, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_PCIE_1, 
+	    17659, 19513, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_PCIE_2, 
+	    17659, 19513, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_PCIE_3, 
+	    17659, 19513, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_PCIE_4, 
+	    17659, 19513, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_PCIE_5, 
+	    17659, 19513, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_PCIE_6, 
+	    17659, 19513, 17667, 18038, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_HDA, 
+	    17659, 19513, 17667, 8284, 6846, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_SMB, 
+	    17659, 19513, 17667, 8248, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_THERM, 
+	    17659, 19513, 17667, 19576, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_EHCI, 
+	    17659, 19513, 17667, 6743, 8046, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_XHCI, 
+	    17659, 19513, 17667, 6743, 8287, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_SDIO, 
+	    17659, 19513, 17667, 21773, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_SSOUND, 
+	    17659, 19513, 17667, 12992, 3393, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_MEI_1, 
+	    17659, 19513, 17667, 21953, 3027, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_MEI_2, 
+	    17659, 19513, 17667, 21953, 3027, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_IDE_R, 
+	    17659, 19513, 17667, 19730, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_KT, 
+	    17659, 19513, 17667, 19596, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_LPC_1, 
+	    17659, 19513, 17667, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_LPC_2, 
+	    17659, 19513, 17667, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_LPC_3, 
+	    17659, 19513, 17667, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_LPC_4, 
+	    17659, 19513, 17667, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_LPC_5, 
+	    17659, 19513, 17667, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_LPC_6, 
+	    17659, 19513, 17667, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_LPC_7, 
+	    17659, 19513, 17667, 8244, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_S_DMA, 
+	    17659, 19513, 17667, 10627, 8231, 19572, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_S_I2C_0, 
+	    17659, 19513, 17667, 10627, 8231, 17602, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_S_I2C_1, 
+	    17659, 19513, 17667, 10627, 8231, 17602, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_S_UART_0, 
+	    17659, 19513, 17667, 10627, 8231, 11064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_S_UART_1, 
+	    17659, 19513, 17667, 10627, 8231, 11064, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_S_GSPI_0, 
+	    17659, 19513, 17667, 10627, 8231, 21939, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_S_GSPI_1, 
+	    17659, 19513, 17667, 10627, 8231, 21939, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PINEVIEW_HB, 
+	    21956, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PINEVIEW_IGD, 
+	    21956, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PINEVIEW_IGD_1, 
+	    21956, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PINEVIEW_M_HB, 
+	    21956, 6751, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PINEVIEW_M_IGD, 
+	    21956, 692, 1716, 2427, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_21152, 
+	    21965, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_21154, 
+	    21974, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_21555, 
+	    21995, 22001, 8077, 6355, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CP_DMI_1, 
+	    17659, 10501, 21097, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CP_DMI_2, 
+	    17659, 10501, 21097, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CP_PCIE_1, 
+	    17659, 10501, 17254, 7843, 7909, 22017, 16060, 17732, 22022, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CP_PCIE_2, 
+	    17659, 10501, 17254, 7843, 7909, 22027, 22022, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CP_QPI_LINK, 
+	    17659, 10501, 21022, 7818, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CP_QPI_RPREGS, 
+	    17659, 10501, 21022, 22031, 558, 22039, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CP_SYS_MREGS, 
+	    17659, 10501, 6, 6870, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CP_SS_REGS, 
+	    17659, 10501, 22048, 558, 20938, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CP_SCS_REGS, 
+	    17659, 10501, 6, 8450, 558, 13674, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CP_MISC_REGS, 
+	    17659, 10501, 7794, 20354, 0,
+	    PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_HANKSVILLE, 
+	    22058, 4534, 6247, 0,
+	    PCI_VENDOR_INTERGRAPH, PCI_PRODUCT_INTERGRAPH_4D50T, 
+	    22069, 22080, 0,
+	    PCI_VENDOR_INTERGRAPH, PCI_PRODUCT_INTERGRAPH_4D60T, 
+	    22069, 22086, 0,
+	    PCI_VENDOR_INTERSIL, PCI_PRODUCT_INTERSIL_MINI_PCI_WLAN, 
+	    22092, 5547, 7476, 0,
+	    PCI_VENDOR_INTERSIL, PCI_PRODUCT_INTERSIL_MINI_PCI_3877, 
+	    22101, 22107, 5547, 7476, 0,
+	    PCI_VENDOR_INTERSIL, PCI_PRODUCT_INTERSIL_MINI_PCI_3890, 
+	    22101, 22114, 5547, 7476, 0,
+	    PCI_VENDOR_INVERTEX, PCI_PRODUCT_INVERTEX_AEON, 
+	    22121, 0,
+	    PCI_VENDOR_IODATA, PCI_PRODUCT_IODATA_CBIDE2, 
+	    22126, 22140, 6418, 0,
+	    PCI_VENDOR_IODATA, PCI_PRODUCT_IODATA_CBSCII, 
+	    22154, 22161, 6462, 0,
+	    PCI_VENDOR_IODATA, PCI_PRODUCT_IODATA_RSAPCI, 
+	    22176, 13761, 10627, 0,
+	    PCI_VENDOR_IODATA, PCI_PRODUCT_IODATA_GVBCTV5DL, 
+	    22184, 22199, 22202, 0,
+	    PCI_VENDOR_ITE, PCI_PRODUCT_ITE_IT8152, 
+	    22208, 6751, 6355, 0,
+	    PCI_VENDOR_ITE, PCI_PRODUCT_ITE_IT8211, 
+	    22215, 6418, 6247, 0,
+	    PCI_VENDOR_ITE, PCI_PRODUCT_ITE_IT8212, 
+	    22222, 6418, 6247, 0,
+	    PCI_VENDOR_ITE, PCI_PRODUCT_ITE_IT8213, 
+	    22229, 6418, 6247, 0,
+	    PCI_VENDOR_ITE, PCI_PRODUCT_ITE_IT8888, 
+	    6629, 6355, 0,
+	    PCI_VENDOR_ITE, PCI_PRODUCT_ITE_IT8892, 
+	    15353, 6355, 0,
+	    PCI_VENDOR_ITT, PCI_PRODUCT_ITT_AGX016, 
+	    22236, 0,
+	    PCI_VENDOR_ITT, PCI_PRODUCT_ITT_ITT3204, 
+	    22243, 6706, 6711, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB360, 
+	    22251, 8271, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB361, 
+	    22258, 22265, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB362, 
+	    22275, 8271, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB363, 
+	    22282, 22265, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB365, 
+	    22289, 22265, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB366, 
+	    22296, 22265, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB368, 
+	    22303, 22310, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB38X_SD, 
+	    22315, 8281, 6751, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB38X_MMC, 
+	    22315, 22322, 6751, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB38X_MS, 
+	    22315, 4513, 22329, 6751, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB38X_XD, 
+	    22315, 22335, 6751, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB388_SD, 
+	    22338, 8281, 6751, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB388_MMC, 
+	    22338, 22322, 6751, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB388_MS, 
+	    22338, 4513, 22329, 6751, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB388_XD, 
+	    22338, 22335, 6751, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMC250, 
+	    22345, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMC260, 
+	    22352, 2439, 5509, 6247, 0,
+	    PCI_VENDOR_JNI, PCI_PRODUCT_JNI_JNIC1460, 
+	    22359, 22369, 5701, 0,
+	    PCI_VENDOR_JNI, PCI_PRODUCT_JNI_JNIC1560, 
+	    22383, 10142, 22369, 5701, 0,
+	    PCI_VENDOR_JNI, PCI_PRODUCT_JNI_FCI1063, 
+	    22393, 22369, 5701, 0,
+	    PCI_VENDOR_JNI, PCI_PRODUCT_JNI_FCX26562, 
+	    22402, 10142, 22369, 5701, 0,
+	    PCI_VENDOR_JNI, PCI_PRODUCT_JNI_FCX6562, 
+	    22412, 22369, 5701, 0,
+	    PCI_VENDOR_JUNIPER, PCI_PRODUCT_JUNIPER_XCLK0, 
+	    22421, 22434, 22440, 17800, 0,
+	    PCI_VENDOR_KTI, PCI_PRODUCT_KTI_NE2KETHER, 
+	    5509, 0,
+	    PCI_VENDOR_LMC, PCI_PRODUCT_LMC_HSSI, 
+	    22448, 3027, 0,
+	    PCI_VENDOR_LMC, PCI_PRODUCT_LMC_DS3, 
+	    22453, 3027, 0,
+	    PCI_VENDOR_LMC, PCI_PRODUCT_LMC_SSI, 
+	    22457, 0,
+	    PCI_VENDOR_LMC, PCI_PRODUCT_LMC_DS1, 
+	    22461, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_TWOSP_2S, 
+	    10142, 10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_QUATTRO_AB, 
+	    10142, 10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_QUATTRO_CD, 
+	    10142, 10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_IOFLEX_2S_0, 
+	    10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_IOFLEX_2S_1, 
+	    10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_QUATTRO_AB2, 
+	    10142, 10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_QUATTRO_CD2, 
+	    10142, 10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_OCTOPUS550_0, 
+	    13224, 10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_OCTOPUS550_1, 
+	    13224, 10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_LAVAPORT_2, 
+	    10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_LAVAPORT_0, 
+	    10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_LAVAPORT_1, 
+	    10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_SSERIAL, 
+	    6367, 10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_650, 
+	    10627, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_TWOSP_1P, 
+	    17351, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_PARALLEL2, 
+	    10142, 17351, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_PARALLEL2A, 
+	    10142, 17351, 0,
+	    PCI_VENDOR_LAVA, PCI_PRODUCT_LAVA_PARALLELB, 
+	    10142, 17351, 0,
+	    PCI_VENDOR_LEADTEK, PCI_PRODUCT_LEADTEK_S3_805, 
+	    5318, 22465, 0,
+	    PCI_VENDOR_LEVELONE, PCI_PRODUCT_LEVELONE_LXT1001, 
+	    22469, 5524, 5509, 0,
+	    PCI_VENDOR_LINEARSYS, PCI_PRODUCT_LINEARSYS_DVB_TX, 
+	    22478, 22482, 0,
+	    PCI_VENDOR_LINEARSYS, PCI_PRODUCT_LINEARSYS_DVB_RX, 
+	    22478, 22494, 0,
+	    PCI_VENDOR_LINKSYS, PCI_PRODUCT_LINKSYS_EG1032, 
+	    22503, 22510, 22513, 5501, 3888, 5701, 0,
+	    PCI_VENDOR_LINKSYS, PCI_PRODUCT_LINKSYS_EG1064, 
+	    22521, 22510, 22513, 5501, 3888, 5701, 0,
+	    PCI_VENDOR_LINKSYS, PCI_PRODUCT_LINKSYS_PCMPC200, 
+	    22528, 0,
+	    PCI_VENDOR_LINKSYS, PCI_PRODUCT_LINKSYS_PCM200, 
+	    6307, 0,
+	    PCI_VENDOR_LINKSYS2, PCI_PRODUCT_LINKSYS2_IPN2220, 
+	    22537, 22541, 4739, 4534, 5701, 22546, 22551, 0,
+	    PCI_VENDOR_LITEON, PCI_PRODUCT_LITEON_82C168, 
+	    22555, 22569, 5611, 5509, 0,
+	    PCI_VENDOR_LITEON, PCI_PRODUCT_LITEON_82C115, 
+	    22576, 22583, 22589, 5611, 5509, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0440, 
+	    22593, 22601, 22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0441, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0442, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0443, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0444, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0445, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0446, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0447, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0448, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0449, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_044a, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_044b, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_044c, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_044d, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_044e, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0450, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0451, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0452, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0453, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0454, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0455, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0456, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0457, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0458, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0459, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_045a, 
+	    22606, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_VENUSMODEM, 
+	    22614, 5556, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_OR3LP26, 
+	    22620, 22625, 5948, 22630, 615, 22637, 17659, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_OR3TP12, 
+	    22620, 22625, 5948, 22642, 615, 22637, 17659, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_USBHC, 
+	    6743, 6751, 6247, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_USBHC2, 
+	    13761, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_FW322_323, 
+	    22649, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_FW643_PCIE, 
+	    22659, 18038, 14617, 22665, 6751, 6247, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_ET1310, 
+	    22671, 5524, 5509, 0,
+	    PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_ET1301, 
+	    22678, 5611, 5509, 0,
+	    PCI_VENDOR_MACRONIX, PCI_PRODUCT_MACRONIX_MX98713, 
+	    22685, 22693, 5611, 5509, 0,
+	    PCI_VENDOR_MACRONIX, PCI_PRODUCT_MACRONIX_MX987x5, 
+	    22700, 22693, 5611, 5509, 0,
+	    PCI_VENDOR_MADGE, PCI_PRODUCT_MADGE_SMARTRN2, 
+	    12992, 16670, 615, 22708, 22717, 0,
+	    PCI_VENDOR_MADGE, PCI_PRODUCT_MADGE_COLLAGE25, 
+	    22721, 16714, 6917, 5701, 0,
+	    PCI_VENDOR_MADGE, PCI_PRODUCT_MADGE_COLLAGE155, 
+	    22721, 22729, 6917, 5701, 0,
+	    PCI_VENDOR_MAGMA, PCI_PRODUCT_MAGMA_SERIAL16, 
+	    13221, 19572, 22733, 0,
+	    PCI_VENDOR_MAGMA, PCI_PRODUCT_MAGMA_SERIAL4, 
+	    6578, 19572, 22733, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_ATLAS, 
+	    22742, 22746, 22753, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_MILLENNIUM, 
+	    22742, 22763, 22774, 22780, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_MYSTIQUE, 
+	    22742, 22790, 22799, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_MILLENNIUM2, 
+	    22742, 22763, 7383, 22806, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_MILLENNIUM2_AGP, 
+	    22742, 22763, 7383, 22812, 8090, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200_PCI, 
+	    22742, 22821, 615, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200_AGP, 
+	    22742, 22821, 8090, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200E_SE, 
+	    22742, 22826, 22832, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G400_AGP, 
+	    22742, 22848, 8090, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EW, 
+	    22742, 22853, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EH, 
+	    22742, 22860, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_IMPRESSION, 
+	    22742, 22867, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G100_PCI, 
+	    22742, 22878, 615, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G100_AGP, 
+	    22742, 22878, 8090, 0,
+	    PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G550_AGP, 
+	    22742, 22883, 8090, 0,
+	    PCI_VENDOR_MEDIAQ, PCI_PRODUCT_MEDIAQ_MQ200, 
+	    22888, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT23108, 
+	    22894, 22905, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT23108_PCI, 
+	    22894, 615, 6355, 22905, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25204_OLD, 
+	    22894, 8794, 22913, 22916, 22921, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25204, 
+	    22894, 8794, 22913, 22928, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25208_COMPAT, 
+	    22894, 8794, 22936, 22939, 20930, 22946, 22952, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25208, 
+	    22894, 8794, 22936, 22965, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25408_SDR, 
+	    22973, 22982, 22986, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25408_DDR, 
+	    22973, 22995, 22986, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25408_QDR, 
+	    22973, 22999, 17254, 6762, 23003, 22986, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25408_EN, 
+	    22973, 23011, 23014, 17254, 6762, 23003, 22986, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25408_DDR_2, 
+	    22973, 22995, 17254, 6762, 23021, 22986, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25408_QDR_2, 
+	    22973, 22999, 17254, 6762, 23021, 22986, 0,
+	    PCI_VENDOR_MELLANOX, PCI_PRODUCT_MELLANOX_MT25408_EN_2, 
+	    22973, 23011, 23014, 17254, 6762, 23021, 22986, 0,
+	    PCI_VENDOR_MICROMEMORY, PCI_PRODUCT_MICROMEMORY_5415CN, 
+	    23027, 4513, 10593, 0,
+	    PCI_VENDOR_MICROMEMORY, PCI_PRODUCT_MICROMEMORY_5425CN, 
+	    23037, 4513, 10593, 0,
+	    PCI_VENDOR_MICROSOFT, PCI_PRODUCT_MICROSOFT_MN120, 
+	    23047, 5611, 5509, 12951, 5701, 0,
+	    PCI_VENDOR_MICREL, PCI_PRODUCT_MICREL_KSZ8841, 
+	    5611, 5509, 0,
+	    PCI_VENDOR_MICREL, PCI_PRODUCT_MICREL_KSZ8842, 
+	    23054, 6203, 7909, 5611, 5509, 0,
+	    PCI_VENDOR_MIDDLE_DIGITAL, PCI_PRODUCT_MIDDLE_DIGITAL_WEASEL_VGA, 
+	    23063, 13994, 7989, 0,
+	    PCI_VENDOR_MIDDLE_DIGITAL, PCI_PRODUCT_MIDDLE_DIGITAL_WEASEL_SERIAL, 
+	    23063, 10627, 7909, 0,
+	    PCI_VENDOR_MIDDLE_DIGITAL, PCI_PRODUCT_MIDDLE_DIGITAL_WEASEL_CONTROL, 
+	    23063, 8450, 0,
+	    PCI_VENDOR_MITSUBISHIELEC, PCI_PRODUCT_MITSUBISHIELEC_TORNADO, 
+	    23070, 14967, 8090, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC105, 
+	    23078, 23085, 6751, 6355, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC106, 
+	    23093, 23100, 6751, 6355, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC8240, 
+	    23110, 23118, 6751, 6355, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC107, 
+	    23127, 23134, 6751, 6355, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC8245, 
+	    23146, 23154, 23162, 6751, 6355, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC8555E, 
+	    23166, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC8541, 
+	    23175, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC8548E, 
+	    14972, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC8548, 
+	    14981, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_RAVEN, 
+	    23183, 6751, 6355, 647, 23189, 18954, 6247, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_FALCON, 
+	    23205, 23212, 4513, 6247, 4569, 23216, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_HAWK, 
+	    23220, 6, 4513, 6247, 647, 615, 6751, 6355, 0,
+	    PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC5200B, 
+	    23225, 6751, 6355, 0,
+	    PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_CP102U, 
+	    23234, 0,
+	    PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_C104H, 
+	    23241, 0,
+	    PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_CP104, 
+	    23247, 0,
+	    PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_CP104V2, 
+	    23255, 0,
+	    PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_CP104EL, 
+	    23263, 0,
+	    PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_CP114, 
+	    23271, 0,
+	    PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_C168H, 
+	    23277, 0,
+	    PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_C168U, 
+	    23283, 0,
+	    PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_C168EL, 
+	    23289, 0,
+	    PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_C168ELA, 
+	    23289, 10113, 0,
+	    PCI_VENDOR_MUTECH, PCI_PRODUCT_MUTECH_MV1000, 
+	    23296, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_RAID_V2, 
+	    23303, 6242, 23310, 23314, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_RAID_V3, 
+	    23303, 6242, 23325, 23314, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_RAID_V4, 
+	    23303, 6242, 23329, 23314, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_RAID_V5, 
+	    23303, 6242, 23333, 23314, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_EXTREMERAID_3000, 
+	    23337, 14967, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_EXTREMERAID_2000, 
+	    23337, 1319, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_ACCELERAID, 
+	    23349, 23360, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_ACCELERAID_170, 
+	    23349, 23364, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_ACCELERAID_160, 
+	    23349, 23368, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_EXTREMERAID1100, 
+	    23337, 23372, 0,
+	    PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_EXTREMERAID, 
+	    23337, 23377, 0,
+	    PCI_VENDOR_MYRICOM, PCI_PRODUCT_MYRICOM_MYRINET, 
+	    10542, 0,
+	    PCI_VENDOR_MYSON, PCI_PRODUCT_MYSON_MTD803, 
+	    23387, 23394, 2439, 5509, 6247, 0,
+	    PCI_VENDOR_NDC, PCI_PRODUCT_NDC_NCP130, 
+	    23401, 4739, 16315, 0,
+	    PCI_VENDOR_NDC, PCI_PRODUCT_NDC_NCP130A2, 
+	    23401, 8674, 23408, 4739, 16315, 0,
+	    PCI_VENDOR_NETOCTAVE, PCI_PRODUCT_NETOCTAVE_NSP2K, 
+	    23411, 0,
+	    PCI_VENDOR_NETBOOST, PCI_PRODUCT_NETBOOST_POLICY, 
+	    23417, 7629, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_SBC, 
+	    23424, 6, 6355, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_ICI, 
+	    23424, 23439, 23450, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_PIC, 
+	    23424, 18941, 18954, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_PCIROOT, 
+	    23424, 23463, 23475, 6580, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_INTERLAKEN, 
+	    23424, 23496, 23507, 23510, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_DEVUSB, 
+	    23424, 2427, 6743, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_EHCIUSB, 
+	    23424, 8046, 6743, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_OHCIUSB, 
+	    23424, 8041, 6743, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_NAE, 
+	    23424, 3888, 23520, 23533, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_POE, 
+	    23424, 4487, 23540, 23533, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_FMN, 
+	    23424, 2439, 23549, 3888, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_DMA, 
+	    23424, 490, 23559, 558, 6242, 23533, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_SAE, 
+	    23424, 7997, 23568, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_PKE, 
+	    23424, 23580, 23568, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_CDE, 
+	    23424, 23588, 23533, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_UART, 
+	    23424, 11064, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_I2C, 
+	    23424, 17602, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_GPIO, 
+	    23424, 17606, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_SYSTEM, 
+	    23424, 6, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_JTAG, 
+	    23424, 23611, 23510, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_NOR, 
+	    23424, 23616, 23620, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_NAND, 
+	    23424, 23626, 23620, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_SPI, 
+	    23424, 17611, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_SDHC, 
+	    23424, 23631, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_RXE, 
+	    23424, 23644, 23652, 23568, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_AHCISATA, 
+	    23424, 8276, 8271, 23428, 0,
+	    PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_SRIO, 
+	    23424, 23663, 23668, 23676, 23682, 23428, 0,
+	    PCI_VENDOR_NETVIN, PCI_PRODUCT_NETVIN_5000, 
+	    17707, 5509, 0,
+	    PCI_VENDOR_NEWBRIDGE, PCI_PRODUCT_NEWBRIDGE_CA91CX42, 
+	    23686, 23695, 6355, 0,
+	    PCI_VENDOR_NEWBRIDGE, PCI_PRODUCT_NEWBRIDGE_CA91L826A, 
+	    23699, 7383, 615, 6355, 0,
+	    PCI_VENDOR_NEWBRIDGE, PCI_PRODUCT_NEWBRIDGE_CA91L8260, 
+	    23705, 615, 6355, 0,
+	    PCI_VENDOR_NEWBRIDGE, PCI_PRODUCT_NEWBRIDGE_CA91L8261, 
+	    23705, 7383, 615, 6355, 0,
+	    PCI_VENDOR_NATIONALINST, PCI_PRODUCT_NATIONALINST_MXI3, 
+	    23715, 615, 23721, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_DP83810, 
+	    23730, 5611, 5509, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_PC87415, 
+	    23738, 6418, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_PC87560, 
+	    23746, 17641, 8231, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_USB, 
+	    6743, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_DP83815, 
+	    23752, 5611, 5509, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_DP83820, 
+	    23760, 5524, 5509, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_CS5535_HB, 
+	    23768, 6643, 6355, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_CS5535_ISA, 
+	    23768, 6629, 6355, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_CS5535_IDE, 
+	    23768, 6418, 6247, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_CS5535_AUDIO, 
+	    23768, 6846, 6247, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_CS5535_USB, 
+	    23768, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_CS5535_VIDEO, 
+	    23768, 234, 6247, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_SATURN, 
+	    23775, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_SC1100_IDE, 
+	    23782, 615, 6418, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_SC1100_AUDIO, 
+	    23782, 23789, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_SC1100_ISA, 
+	    23782, 6629, 6355, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_SC1100_ACPI, 
+	    23782, 23801, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_SC1100_XBUS, 
+	    23782, 23810, 0,
+	    PCI_VENDOR_NS, PCI_PRODUCT_NS_NS87410, 
+	    23816, 0,
+	    PCI_VENDOR_PHILIPS, PCI_PRODUCT_PHILIPS_SAA7130HL, 
+	    23824, 615, 234, 23834, 6711, 0,
+	    PCI_VENDOR_PHILIPS, PCI_PRODUCT_PHILIPS_SAA7133HL, 
+	    23844, 615, 23854, 23834, 6711, 0,
+	    PCI_VENDOR_PHILIPS, PCI_PRODUCT_PHILIPS_SAA7134HL, 
+	    23858, 615, 23854, 23834, 6711, 0,
+	    PCI_VENDOR_PHILIPS, PCI_PRODUCT_PHILIPS_SAA7135HL, 
+	    23868, 615, 23854, 23834, 6711, 0,
+	    PCI_VENDOR_PHILIPS, PCI_PRODUCT_PHILIPS_SAA7146AH, 
+	    23878, 615, 2455, 6355, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_810, 
+	    23888, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_820, 
+	    23895, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_825, 
+	    23902, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_815, 
+	    23909, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_810AP, 
+	    23916, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_860, 
+	    23925, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1510D, 
+	    23932, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_896, 
+	    23941, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_895, 
+	    23948, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_885, 
+	    23955, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_875, 
+	    23962, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1510, 
+	    23973, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_895A, 
+	    23981, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_875A, 
+	    23989, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1010, 
+	    23997, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1010_2, 
+	    23997, 24005, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1030, 
+	    24013, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1030R, 
+	    24029, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1030ZC, 
+	    24038, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1035, 
+	    24048, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1035ZC, 
+	    24056, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1064, 
+	    24066, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1068, 
+	    24074, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1068_2, 
+	    24074, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1064E, 
+	    24082, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1064E_2, 
+	    24082, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1068E, 
+	    24091, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1068E_2, 
+	    24091, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1066E, 
+	    24100, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_2208, 
+	    8387, 24109, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1064A, 
+	    24117, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_3108, 
+	    8387, 24126, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1066, 
+	    24134, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1078, 
+	    24142, 615, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1078_PCIE, 
+	    24142, 615, 4329, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2116_1, 
+	    24150, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2116_2, 
+	    24150, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2308_3, 
+	    24158, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2004, 
+	    24166, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2008, 
+	    24174, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2008_1, 
+	    8387, 24174, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_3, 
+	    24182, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_4, 
+	    24182, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_5, 
+	    24182, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_1, 
+	    8387, 24182, 24190, 24197, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_2, 
+	    8387, 24182, 24197, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1078DE, 
+	    24202, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_1, 
+	    24109, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_2, 
+	    24109, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_3, 
+	    24109, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_4, 
+	    24109, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_5, 
+	    24109, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_6, 
+	    24109, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2308_1, 
+	    24158, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2308_2, 
+	    24158, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_875J, 
+	    24212, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC909, 
+	    24220, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC909A, 
+	    24226, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC929, 
+	    24233, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC929_1, 
+	    24233, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC919, 
+	    24239, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC919_1, 
+	    24239, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC929X, 
+	    24245, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC919X, 
+	    24252, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC949X, 
+	    24259, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC939X, 
+	    24266, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC949E, 
+	    24273, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_320X, 
+	    289, 24280, 6462, 24289, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_320E, 
+	    289, 24280, 6462, 24295, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_300X, 
+	    289, 24280, 8271, 24301, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_SAS, 
+	    8387, 5801, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_VERDE_ZCR, 
+	    8387, 24317, 24323, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_PERC_4SC, 
+	    7313, 24327, 0,
+	    PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_PE_GNIC, 
+	    4487, 4494, 24332, 5509, 0,
+	    PCI_VENDOR_PARALLELS, PCI_PRODUCT_PARALLELS_TOOLS, 
+	    24338, 0,
+	    PCI_VENDOR_PARALLELS, PCI_PRODUCT_PARALLELS_VIDEO, 
+	    234, 0,
+	    PCI_VENDOR_PARALLELS, PCI_PRODUCT_PARALLELS_VIDEO2, 
+	    234, 7383, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_USB, 
+	    6743, 6751, 6247, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_VRC4173_CARDU, 
+	    24344, 24352, 21053, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_POWERVR2, 
+	    24360, 24368, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PD72872, 
+	    24373, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PKUGX001, 
+	    24382, 22593, 5556, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PKUGX008, 
+	    24393, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_VRC4173_BCU, 
+	    24344, 24404, 8450, 21053, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_VRC4173_AC97U, 
+	    24344, 8158, 21053, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PD72870, 
+	    24408, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PD72871, 
+	    24417, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PD720100A, 
+	    9271, 6751, 6247, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PD720400, 
+	    24426, 615, 4329, 16518, 24436, 6355, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PD720200, 
+	    14815, 6751, 6247, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_VA26D, 
+	    24446, 7045, 7986, 24452, 0,
+	    PCI_VENDOR_NEC, PCI_PRODUCT_NEC_VERSALX, 
+	    24446, 7986, 0,
+	    PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMG2070, 
+	    24458, 24469, 0,
+	    PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMG128V, 
+	    24458, 24476, 0,
+	    PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMG128ZV, 
+	    24458, 24481, 0,
+	    PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMG2160, 
+	    24458, 24487, 0,
+	    PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMM256AV_VGA, 
+	    24493, 24504, 7989, 0,
+	    PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMM256ZX_VGA, 
+	    24493, 24510, 7989, 0,
+	    PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMM256XLP_AU, 
+	    24493, 24516, 6846, 0,
+	    PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMM256AV_AU, 
+	    24493, 24504, 6846, 0,
+	    PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMM256ZX_AU, 
+	    24493, 24510, 6846, 0,
+	    PCI_VENDOR_NETCHIP, PCI_PRODUCT_NETCHIP_NET2280, 
+	    24523, 6743, 2427, 6247, 0,
+	    PCI_VENDOR_NETCHIP, PCI_PRODUCT_NETCHIP_NET2282, 
+	    24531, 6743, 2427, 6247, 0,
+	    PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_GA620, 
+	    24539, 7658, 5509, 0,
+	    PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_GA620T, 
+	    24539, 7669, 5509, 0,
+	    PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_MA301, 
+	    24545, 615, 14617, 7468, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9805, 
+	    24551, 24556, 7909, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9815, 
+	    10142, 24551, 24556, 7909, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9820, 
+	    6367, 11064, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9835, 
+	    10142, 11064, 558, 24551, 24556, 7909, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9845, 
+	    13224, 11064, 558, 24551, 24556, 7909, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9855, 
+	    24564, 13224, 11064, 558, 24551, 24556, 7909, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9865, 
+	    24569, 13224, 11064, 558, 24551, 24556, 7909, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_MCS9990, 
+	    24574, 13224, 6743, 6762, 7909, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9900, 
+	    6367, 15791, 11064, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9901, 
+	    10142, 15791, 11064, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9904, 
+	    13224, 15791, 11064, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9912, 
+	    10142, 15791, 11064, 558, 24551, 24556, 7909, 0,
+	    PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9922, 
+	    10142, 15791, 11064, 0,
+	    PCI_VENDOR_NETSEC, PCI_PRODUCT_NETSEC_7751, 
+	    16403, 0,
+	    PCI_VENDOR_NEXGEN, PCI_PRODUCT_NEXGEN_NX82C501, 
+	    24582, 6643, 6355, 0,
+	    PCI_VENDOR_NKK, PCI_PRODUCT_NKK_NDR4600, 
+	    24591, 6643, 6355, 0,
+	    PCI_VENDOR_NORTEL, PCI_PRODUCT_NORTEL_BAYSTACK_21, 
+	    24599, 24608, 24611, 6514, 24619, 0,
+	    PCI_VENDOR_NUMBER9, PCI_PRODUCT_NUMBER9_I128, 
+	    24627, 0,
+	    PCI_VENDOR_NUMBER9, PCI_PRODUCT_NUMBER9_I128_2, 
+	    24627, 7383, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_RIVATNT, 
+	    24639, 24644, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_RIVATNT2, 
+	    24639, 24648, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_RIVATNT2U, 
+	    24639, 24648, 6957, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_VANTA, 
+	    24653, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_RIVATNT2M64, 
+	    24639, 24648, 24659, 24665, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_PCIB, 
+	    24668, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_SMBUS, 
+	    24668, 8248, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_IDE, 
+	    24668, 6418, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_SATA, 
+	    24668, 8271, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_LAN1, 
+	    24668, 5509, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_LAN2, 
+	    24668, 5509, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP04_SATA2, 
+	    24668, 8271, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_6800U, 
+	    24674, 24682, 6957, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_6800, 
+	    24674, 24682, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_6800LE, 
+	    24674, 24682, 9163, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_6800GT, 
+	    24674, 24682, 24687, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_PCIB1, 
+	    24690, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_PCIB2, 
+	    24690, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_SMBUS, 
+	    24690, 8248, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_ATA133, 
+	    24690, 24698, 6418, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_SATA1, 
+	    24690, 10627, 6238, 14562, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_SATA2, 
+	    24690, 10627, 6238, 6203, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_LAN1, 
+	    24690, 5509, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_LAN2, 
+	    24690, 5509, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_AC, 
+	    24690, 19950, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_USB, 
+	    24690, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_USB2, 
+	    24690, 9271, 6751, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_PCI, 
+	    24690, 615, 6751, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_PCIE, 
+	    24690, 17254, 6751, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE4_MEM, 
+	    24690, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_PCIB, 
+	    24705, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_SMBUS, 
+	    24705, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_ATA133, 
+	    24705, 24698, 6418, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_LAN, 
+	    24705, 5509, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_OHCI, 
+	    24705, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_EHCI, 
+	    24705, 9271, 6751, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_MCPT_AC, 
+	    24705, 24713, 19950, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_MCPT_AP, 
+	    24705, 24713, 6846, 811, 21053, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_PPB, 
+	    24705, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_FW, 
+	    24705, 8503, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_PCIB, 
+	    24705, 6957, 24719, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_SMBUS, 
+	    24705, 6957, 24719, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_ATA133, 
+	    24705, 6957, 24719, 24698, 6418, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN1, 
+	    24705, 6957, 24719, 5509, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_OHCI, 
+	    24705, 6957, 24719, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_EHCI, 
+	    24705, 6957, 24719, 9271, 6751, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_MCPT_AC, 
+	    24705, 6957, 24719, 19950, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_PPB, 
+	    24705, 6957, 24719, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN2, 
+	    24705, 6957, 24719, 5509, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_400_SATA, 
+	    24705, 6957, 24719, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_ALADDINTNT2, 
+	    24723, 24648, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_PCIB, 
+	    24731, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_PCHB, 
+	    24731, 6643, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_PPB2, 
+	    24731, 8077, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_SMBUS, 
+	    24731, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_ATA133, 
+	    24731, 24698, 6418, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_LAN1, 
+	    24731, 5509, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_OHCI, 
+	    24731, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_EHCI, 
+	    24731, 9271, 6751, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_MCPT_AC, 
+	    24731, 24713, 19950, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_PPB, 
+	    24731, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_LAN4, 
+	    24731, 5509, 20457, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_PCIB, 
+	    24731, 24739, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_PCHB, 
+	    24731, 24739, 6643, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_AGP, 
+	    24731, 24739, 8090, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_SATA, 
+	    24731, 24739, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_SMBUS, 
+	    24731, 24739, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_ATA133, 
+	    24731, 24739, 24698, 6418, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_LAN, 
+	    24731, 24739, 5509, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_OHCI, 
+	    24731, 24739, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_EHCI, 
+	    24731, 24739, 9271, 6751, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_MCPT_AC, 
+	    24731, 24739, 24713, 19950, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_PPB, 
+	    24731, 24739, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE3_250_SATA2, 
+	    24731, 24739, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADROFX3400, 
+	    24743, 24750, 10415, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_280NVS2, 
+	    24753, 24761, 24765, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADROFX1300, 
+	    24743, 24750, 24769, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCEPCX4300, 
+	    24674, 24774, 24778, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE256, 
+	    24674, 24783, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCEDDR, 
+	    24674, 22995, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO, 
+	    24743, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE2MX, 
+	    24787, 24796, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE2MX200, 
+	    24787, 24796, 24799, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE2GO, 
+	    24787, 24807, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO2_MXR, 
+	    24810, 24818, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE6600GT, 
+	    24674, 24825, 24687, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE6600, 
+	    24674, 24825, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE6600_2, 
+	    24674, 24825, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE6600GO, 
+	    24674, 24825, 24807, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE6610XL, 
+	    24674, 24830, 5599, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE6600GO_2, 
+	    24674, 24825, 24807, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADROFX5500, 
+	    24743, 24750, 19516, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADROFX540, 
+	    24743, 24750, 24835, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE6200, 
+	    24674, 21450, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE2, 
+	    24787, 24839, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE2DDR, 
+	    24787, 24839, 24843, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE2BR, 
+	    24787, 24839, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO2, 
+	    24810, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE6200TC, 
+	    24674, 24849, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE6200LE, 
+	    24674, 24856, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE4_MX460, 
+	    24863, 24796, 24872, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE4_MX440, 
+	    24863, 24796, 24876, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE4_MX420, 
+	    24863, 24796, 24880, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_MX440_SE, 
+	    24863, 24796, 24876, 24884, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_500XGL, 
+	    24753, 24887, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_200NVS, 
+	    24753, 24894, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_MX440_8X, 
+	    24863, 24796, 24876, 24905, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_MX440_SE_8X, 
+	    24863, 24796, 24876, 24884, 24905, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_MX420_8X, 
+	    24863, 24796, 24880, 24905, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_580XGL, 
+	    24753, 24913, 24917, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_280NVS, 
+	    24753, 24761, 24765, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_380XGL, 
+	    24753, 24921, 24917, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADROFX4600, 
+	    24743, 24750, 24925, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE2_IGP, 
+	    24787, 692, 10433, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_PCHB, 
+	    24930, 615, 6751, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_DDR2, 
+	    24930, 24937, 22995, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_DDR, 
+	    24930, 24880, 22995, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_MEM, 
+	    24930, 24941, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_MEM1, 
+	    24930, 24941, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_APU, 
+	    24930, 6846, 811, 21053, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_MCP_AC, 
+	    24930, 24949, 19950, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_ISA, 
+	    24930, 16544, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_XBOX_SMBUS, 
+	    24953, 24930, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_AGP, 
+	    24930, 8090, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_PPB, 
+	    24930, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_ATA100, 
+	    24930, 24958, 6418, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_USB, 
+	    24930, 6743, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE_LAN, 
+	    24930, 5509, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_7300LE, 
+	    24674, 24965, 9163, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_PCHB, 
+	    24705, 6643, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_PPB2, 
+	    24705, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_MEM1, 
+	    24705, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_MEM2, 
+	    24705, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_MEM3, 
+	    24705, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_MEM4, 
+	    24705, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE2_MEM5, 
+	    24705, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_MX_IGP, 
+	    24863, 24796, 692, 10433, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE3, 
+	    24970, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE3_TI200, 
+	    24970, 24979, 10175, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE3_TI500, 
+	    24970, 24979, 24982, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO_DCC, 
+	    24743, 24986, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_6150, 
+	    24674, 17530, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_6150LE, 
+	    24674, 17530, 9163, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE4_TI4600, 
+	    24863, 24979, 24925, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE4_TI4400, 
+	    24863, 24979, 24990, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE4_TI4200, 
+	    24863, 24979, 24995, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_900XGL, 
+	    24753, 25000, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_750XGL, 
+	    24753, 25007, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_700XGL, 
+	    24753, 25014, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_PCIB, 
+	    25021, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_SMBUS, 
+	    25021, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_ATA133, 
+	    25021, 24698, 6418, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_SATA1, 
+	    25021, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_SATA2, 
+	    25021, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_LAN1, 
+	    25021, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_LAN2, 
+	    25021, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_AC, 
+	    25021, 19950, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_HDA, 
+	    25021, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_OHCI, 
+	    25021, 6743, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_EHCI, 
+	    25021, 9271, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_PPB, 
+	    25021, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_HB, 
+	    25021, 6751, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_MC, 
+	    25021, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_MC2, 
+	    25031, 4513, 6247, 6203, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_MC3, 
+	    25031, 4513, 6247, 6214, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_TI_4800, 
+	    24863, 24979, 25035, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_TI_4200_8X, 
+	    24863, 24979, 24995, 24905, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_TI_4800_SE, 
+	    24863, 24979, 25035, 24884, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_TI_4200_GO, 
+	    24863, 24979, 24995, 24807, 8090, 25040, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_980_XGL, 
+	    24753, 25043, 24917, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_780_XGL, 
+	    24753, 25047, 24917, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO_FX_1500, 
+	    24743, 24750, 25051, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_XBOXFB, 
+	    24953, 25056, 25062, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_XBOX_PCHB, 
+	    24953, 24930, 6643, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F0, 
+	    25031, 6751, 6355, 25069, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F1, 
+	    25031, 6751, 6355, 25078, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F2, 
+	    25031, 6751, 6355, 25087, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F3, 
+	    25031, 6751, 6355, 25096, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F4, 
+	    25031, 6751, 6355, 25105, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F5, 
+	    25031, 6751, 6355, 25114, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F6, 
+	    25031, 6751, 6355, 25123, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F7, 
+	    25031, 6751, 6355, 25132, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_MC5, 
+	    25031, 4513, 6247, 14013, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_MC4, 
+	    25031, 4513, 6247, 6578, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_MC0, 
+	    25031, 4513, 6247, 17800, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_PPB_02FB, 
+	    25031, 615, 4329, 6355, 25141, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_PPB_02FC, 
+	    25031, 615, 4329, 6355, 25150, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_PPB_02FD, 
+	    25031, 615, 4329, 6355, 25159, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_MC1, 
+	    25031, 4513, 6247, 14562, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02FF, 
+	    25031, 6751, 6355, 25168, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_FX5800U, 
+	    24674, 24750, 25177, 6957, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_FX5800, 
+	    24674, 24750, 25177, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO_FX_2000, 
+	    24743, 24750, 1319, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO_FX_1000, 
+	    24743, 24750, 14306, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5600U, 
+	    24674, 24750, 10280, 6957, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5600, 
+	    24674, 24750, 10280, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5600_SE, 
+	    24674, 24750, 10280, 24884, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5200U, 
+	    24674, 24750, 25182, 6957, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5200, 
+	    24674, 24750, 25182, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5200SE, 
+	    24674, 24750, 25187, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO_FX_500, 
+	    24743, 24750, 24982, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5900U, 
+	    24674, 24750, 25194, 6957, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5900, 
+	    24674, 24750, 25194, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5900XT, 
+	    24674, 24750, 25199, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5950U, 
+	    24674, 24750, 25206, 6957, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO_FX_3000, 
+	    24743, 24750, 14967, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_FX5700_LE, 
+	    24674, 24750, 25211, 9163, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_LPC2, 
+	    24930, 25216, 8244, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_ISA, 
+	    24930, 25216, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_LPC, 
+	    24930, 25216, 8244, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_SMB, 
+	    24930, 25216, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_MEM, 
+	    24930, 25216, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_MEM2, 
+	    24930, 25216, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_IDE, 
+	    24930, 25216, 24698, 6418, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_OHCI, 
+	    24930, 25216, 8041, 6743, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_EHCI, 
+	    24930, 25216, 8046, 6743, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_PPB, 
+	    24930, 25216, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_HDA, 
+	    24930, 25216, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_LAN1, 
+	    24930, 25216, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_LAN2, 
+	    24930, 25216, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_PCIE, 
+	    24930, 25216, 23463, 25222, 7909, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_PCIE2, 
+	    24930, 25216, 23463, 25222, 7909, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_SATA, 
+	    24930, 25216, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_SATA2, 
+	    24930, 25216, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_GO_7600, 
+	    24674, 24807, 25226, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_ISA, 
+	    24930, 25231, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_HDA, 
+	    24930, 25231, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_LAN1, 
+	    24930, 25231, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_LAN2, 
+	    24930, 25231, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_SATA, 
+	    24930, 25231, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_PPB_1, 
+	    24930, 25231, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_PPB_2, 
+	    24930, 25231, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_MEM, 
+	    24930, 25231, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_SMB, 
+	    24930, 25231, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_IDE, 
+	    24930, 25231, 24698, 6418, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_LAN3, 
+	    24930, 25231, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_LAN4, 
+	    24930, 25231, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_HDA2, 
+	    24930, 25231, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_OHCI, 
+	    24930, 25231, 8041, 6743, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_EHCI, 
+	    24930, 25231, 8046, 6743, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_PCI, 
+	    24930, 25231, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_SMC, 
+	    24930, 25231, 6, 6870, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_MEM2, 
+	    24930, 25231, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_SATA2, 
+	    24930, 25231, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_SATA3, 
+	    24930, 25231, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_8600GTS, 
+	    24674, 25237, 24839, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_8600GT, 
+	    24674, 25237, 24687, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_8500_GT, 
+	    24674, 9194, 24687, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_8400M_GS, 
+	    24674, 25242, 25248, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO_NVS140M, 
+	    24743, 24765, 25251, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_ISA, 
+	    24930, 25256, 6629, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LPC1, 
+	    24930, 25256, 25262, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LPC2, 
+	    24930, 25256, 25262, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LPC3, 
+	    24930, 25256, 25262, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_MEM, 
+	    24930, 25256, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_MEM2, 
+	    24930, 25256, 4513, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_SMB, 
+	    24930, 25256, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_SMU, 
+	    24930, 25256, 6, 6870, 21053, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_IDE, 
+	    24930, 25256, 24698, 6418, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_PCI, 
+	    24930, 25256, 615, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_HDA_1, 
+	    24930, 25256, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_HDA_2, 
+	    24930, 25256, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_AHCI_1, 
+	    24930, 25256, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_AHCI_2, 
+	    24930, 25256, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_AHCI_3, 
+	    24930, 25256, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_AHCI_4, 
+	    24930, 25256, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LAN1, 
+	    24930, 25256, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LAN2, 
+	    24930, 25256, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LAN3, 
+	    24930, 25256, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LAN4, 
+	    24930, 25256, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_USB_1, 
+	    24930, 25256, 6743, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_USB_2, 
+	    24930, 25256, 6743, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_USB_3, 
+	    24930, 25256, 6743, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_USB_4, 
+	    24930, 25256, 6743, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_PPB_1, 
+	    24930, 25256, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_PPB_2, 
+	    24930, 25256, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_PPB_3, 
+	    24930, 25256, 8077, 6355, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_SATA, 
+	    24930, 25256, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_SATA2, 
+	    24930, 25256, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_SATA3, 
+	    24930, 25256, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_SATA4, 
+	    24930, 25256, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_SMB, 
+	    24930, 25270, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_LAN1, 
+	    24930, 25270, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_LAN2, 
+	    24930, 25270, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_LAN3, 
+	    24930, 25270, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_LAN4, 
+	    24930, 25270, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_SATA, 
+	    24930, 25270, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_SATA2, 
+	    24930, 25270, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_SATA3, 
+	    24930, 25270, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_SATA4, 
+	    24930, 25270, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_AHCI_1, 
+	    24930, 25270, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_AHCI_2, 
+	    24930, 25270, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_AHCI_3, 
+	    24930, 25270, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_AHCI_4, 
+	    24930, 25270, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_AHCI_5, 
+	    24930, 25270, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_AHCI_6, 
+	    24930, 25270, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_AHCI_7, 
+	    24930, 25270, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_AHCI_8, 
+	    24930, 25270, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_HDA_1, 
+	    24930, 25270, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_HDA_2, 
+	    24930, 25270, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP67_IDE, 
+	    24930, 25270, 24698, 6418, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_IDE, 
+	    24930, 25276, 24698, 6418, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_8800_GT, 
+	    24674, 25282, 24687, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_9800_GT, 
+	    24674, 9093, 24687, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_9600_GT, 
+	    24674, 9110, 24687, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_9500_GT, 
+	    24674, 9059, 24687, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_9300_GE_1, 
+	    24674, 25287, 25292, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE8400GS, 
+	    24674, 25295, 25248, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE9300M_GS, 
+	    24674, 25300, 25248, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRONVS150, 
+	    24743, 24765, 25306, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRONVS160, 
+	    24743, 24765, 25311, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_IDE, 
+	    24930, 25316, 24698, 6418, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_LAN1, 
+	    24930, 25316, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_LAN2, 
+	    24930, 25316, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_LAN3, 
+	    24930, 25316, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_LAN4, 
+	    24930, 25316, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_HDA_1, 
+	    24930, 25316, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_HDA_2, 
+	    24930, 25316, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_HDA_3, 
+	    24930, 25316, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_HDA_4, 
+	    24930, 25316, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_SMB, 
+	    24930, 25276, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_LAN1, 
+	    24930, 25276, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_LAN2, 
+	    24930, 25276, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_LAN3, 
+	    24930, 25276, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_LAN4, 
+	    24930, 25276, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_1, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_2, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_3, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_4, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_5, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_6, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_7, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_8, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_9, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_10, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_11, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_AHCI_12, 
+	    24930, 25276, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_HDA_1, 
+	    24930, 25276, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP73_HDA_2, 
+	    24930, 25276, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP78S_SMB, 
+	    24930, 25322, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_210, 
+	    24674, 25329, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_SMB, 
+	    24930, 25333, 8248, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_LAN1, 
+	    24930, 25333, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_LAN2, 
+	    24930, 25333, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_LAN3, 
+	    24930, 25333, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_LAN4, 
+	    24930, 25333, 5501, 5509, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_1, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_2, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_3, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_4, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_5, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_6, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_7, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_8, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_9, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_10, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_11, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP77_AHCI_12, 
+	    24930, 25316, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_1, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_2, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_3, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_4, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_5, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_6, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_7, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_8, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_9, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_10, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_11, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP79_AHCI_12, 
+	    24930, 25333, 8276, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE_210_HDA, 
+	    24674, 25329, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF_GT640M, 
+	    24674, 24687, 25339, 0,
+	    PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF116, 
+	    24674, 25344, 25348, 24979, 0,
+	    PCI_VENDOR_NVIDIA_SGS, PCI_PRODUCT_NVIDIA_SGS_RIVA128, 
+	    25352, 9637, 0,
+	    PCI_VENDOR_OAKTECH, PCI_PRODUCT_OAKTECH_OTI1007, 
+	    25357, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC3136, 
+	    25364, 25377, 16670, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC3139, 
+	    25388, 25397, 16670, 5805, 5811, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC3140, 
+	    25406, 25419, 5805, 5811, 16670, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC3250, 
+	    25429, 25437, 5805, 5811, 16670, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC3530, 
+	    25444, 25419, 5805, 5811, 5934, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC3141, 
+	    25452, 25419, 5805, 5811, 16670, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC3540, 
+	    25460, 25419, 25468, 25473, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC3150, 
+	    25482, 25419, 25377, 16670, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC2805, 
+	    25490, 5509, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC2325, 
+	    25498, 5509, 5611, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC2183, 
+	    25506, 5509, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC2326, 
+	    25519, 25527, 5509, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC2327, 
+	    25537, 5611, 5509, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC6151, 
+	    25550, 22729, 8893, 6917, 0,
+	    PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OCATM, 
+	    6917, 0,
+	    PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C557, 
+	    25563, 0,
+	    PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C558, 
+	    25570, 0,
+	    PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C568, 
+	    25577, 0,
+	    PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82D568, 
+	    25584, 0,
+	    PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C621, 
+	    25591, 0,
+	    PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C822, 
+	    25598, 0,
+	    PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C861, 
+	    25605, 0,
+	    PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C700, 
+	    25612, 0,
+	    PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C701, 
+	    25619, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_VSCOM_PCI011H, 
+	    25626, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OX16PCI954, 
+	    25631, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OX16PCI954K, 
+	    25642, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXUPCI952, 
+	    25654, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_EXSYS_EX41092, 
+	    25664, 25670, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXCB950, 
+	    25679, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXMPCI954, 
+	    25687, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXMPCI954D, 
+	    25687, 25697, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_EXSYS_EX41098, 
+	    25664, 25706, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OX16PCI954P, 
+	    25631, 17351, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OX16PCI952, 
+	    25715, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OX16PCI952P, 
+	    25715, 17351, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OX16PCI958, 
+	    25726, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE952_0, 
+	    25737, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE952_1, 
+	    25737, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE952P, 
+	    25737, 17351, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE952_2S, 
+	    25737, 6203, 10627, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE952_2, 
+	    25737, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE952_3, 
+	    25737, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE952_4, 
+	    25737, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE952_5, 
+	    25737, 0,
+	    PCI_VENDOR_OXFORDSEMI, PCI_PRODUCT_OXFORDSEMI_OXPCIE952_6, 
+	    25737, 0,
+	    PCI_VENDOR_PACKETENGINES, PCI_PRODUCT_PACKETENGINES_GNICII, 
+	    24332, 7383, 5509, 0,
+	    PCI_VENDOR_PCHDTV, PCI_PRODUCT_PCHDTV_HD2000, 
+	    25747, 25755, 234, 12276, 0,
+	    PCI_VENDOR_PCHDTV, PCI_PRODUCT_PCHDTV_HD5500, 
+	    25760, 25755, 234, 12276, 0,
+	    PCI_VENDOR_PCTECH, PCI_PRODUCT_PCTECH_RZ1000, 
+	    25768, 0,
+	    PCI_VENDOR_PEAK, PCI_PRODUCT_PEAK_PCAN, 
+	    25775, 21783, 6247, 0,
+	    PCI_VENDOR_PERICOM, PCI_PRODUCT_PERICOM_P17C9X110, 
+	    25780, 17254, 6807, 615, 6355, 0,
+	    PCI_VENDOR_PERICOM, PCI_PRODUCT_PERICOM_P17C9X, 
+	    25790, 17254, 6807, 615, 6355, 0,
+	    PCI_VENDOR_PHOBOS, PCI_PRODUCT_PHOBOS_P1000, 
+	    25797, 5501, 5509, 0,
+	    PCI_VENDOR_PLANEX, PCI_PRODUCT_PLANEX_FNW_3603_TX, 
+	    25803, 5611, 5509, 0,
+	    PCI_VENDOR_PLANEX, PCI_PRODUCT_PLANEX_FNW_3800_TX, 
+	    25815, 5611, 5509, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_PCI_400, 
+	    25827, 25833, 6578, 6580, 6553, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_PCI_800, 
+	    25827, 25841, 6603, 6580, 6553, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_PCI_200, 
+	    25827, 25849, 6203, 6580, 6553, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_PEX_8111, 
+	    25857, 25861, 10655, 6355, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_PEX_8112, 
+	    25857, 25866, 10655, 6355, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_PEX_8114, 
+	    25857, 25871, 25876, 6355, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_9030, 
+	    25894, 8231, 25899, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_9050, 
+	    25910, 8231, 25899, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_9054, 
+	    25915, 8231, 7629, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_9060ES, 
+	    25920, 615, 24404, 6247, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_9656, 
+	    25927, 8231, 7629, 0,
+	    PCI_VENDOR_PLX, PCI_PRODUCT_PLX_9656FPBGA, 
+	    25927, 8231, 7629, 25932, 0,
+	    PCI_VENDOR_POWERHOUSE, PCI_PRODUCT_POWERHOUSE_POWERTOP, 
+	    25938, 16691, 6, 6247, 0,
+	    PCI_VENDOR_POWERHOUSE, PCI_PRODUCT_POWERHOUSE_POWERPRO, 
+	    25947, 16691, 6, 6247, 0,
+	    PCI_VENDOR_PROLAN, PCI_PRODUCT_PROLAN_NE2KETHER, 
+	    5509, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20265, 
+	    25956, 25965, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20263, 
+	    25974, 25965, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20275, 
+	    25983, 25992, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20318, 
+	    26002, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20319, 
+	    26011, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20371, 
+	    26020, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20379, 
+	    26029, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20378, 
+	    26038, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20375, 
+	    26047, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20376, 
+	    26056, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20377, 
+	    26065, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC40719, 
+	    26074, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC40519, 
+	    26083, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20771, 
+	    26092, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20571, 
+	    26101, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20579, 
+	    26110, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC40779, 
+	    26119, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC40718, 
+	    26128, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC40518, 
+	    26137, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20775, 
+	    26146, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20575, 
+	    26155, 10627, 6238, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20267, 
+	    26164, 26173, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20246, 
+	    26183, 26192, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20262, 
+	    26201, 25965, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20268, 
+	    26210, 26173, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20269, 
+	    26219, 25992, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20276, 
+	    26228, 25992, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_DC5030, 
+	    26237, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20270, 
+	    26244, 26173, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20271, 
+	    26253, 25992, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20617, 
+	    26262, 10142, 25992, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20620, 
+	    26271, 10142, 25992, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20621, 
+	    26280, 10142, 25992, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20618, 
+	    26289, 10142, 25992, 6418, 26298, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20619, 
+	    26308, 10142, 25992, 6418, 6247, 0,
+	    PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20277, 
+	    26317, 25992, 6418, 6247, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH352_2S, 
+	    26326, 26332, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH353_4S, 
+	    26335, 26341, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH356_8S, 
+	    26344, 26350, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH356_6S, 
+	    26344, 26353, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH353_2S1PAR, 
+	    26335, 26356, 26360, 26363, 26370, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH352_1S1P, 
+	    26326, 26379, 26360, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH357_4S, 
+	    26383, 26341, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH358_4S1P, 
+	    26389, 26395, 26360, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH358_8S, 
+	    26389, 26350, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH359_16S, 
+	    26399, 26405, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH353_2S1P, 
+	    26335, 26356, 26360, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH356_4S1P, 
+	    26344, 26395, 26360, 0,
+	    PCI_VENDOR_QINHENG, PCI_PRODUCT_QINHENG_CH355_4S, 
+	    26409, 26341, 0,
+	    PCI_VENDOR_QINHENG2, PCI_PRODUCT_QINHENG2_CH384_4S1P, 
+	    26415, 26395, 26360, 0,
+	    PCI_VENDOR_QINHENG2, PCI_PRODUCT_QINHENG2_CH384_4S, 
+	    26415, 26341, 0,
+	    PCI_VENDOR_QINHENG2, PCI_PRODUCT_QINHENG2_CH382_2S1P, 
+	    26421, 26356, 26360, 0,
+	    PCI_VENDOR_QINHENG2, PCI_PRODUCT_QINHENG2_CH382_2S, 
+	    26421, 26332, 0,
+	    PCI_VENDOR_QINHENG2, PCI_PRODUCT_QINHENG2_CH384_8S, 
+	    26415, 26350, 0,
+	    PCI_VENDOR_QINHENG2, PCI_PRODUCT_QINHENG2_CH384_28S, 
+	    26415, 26427, 0,
+	    PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_QLA200, 
+	    26431, 0,
+	    PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP1020, 
+	    26438, 0,
+	    PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP1022, 
+	    26446, 0,
+	    PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP1080, 
+	    26454, 0,
+	    PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP1240, 
+	    26462, 0,
+	    PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP1280, 
+	    26470, 0,
+	    PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP2100, 
+	    26478, 0,
+	    PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP3022, 
+	    26486, 7623, 26494, 0,
+	    PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP4022, 
+	    26486, 7623, 26494, 0,
+	    PCI_VENDOR_QUANCOM, PCI_PRODUCT_QUANCOM_PWDOG1, 
+	    26498, 0,
+	    PCI_VENDOR_QUANTUMDESIGNS, PCI_PRODUCT_QUANTUMDESIGNS_8500, 
+	    9194, 0,
+	    PCI_VENDOR_QUANTUMDESIGNS, PCI_PRODUCT_QUANTUMDESIGNS_8580, 
+	    26505, 0,
+	    PCI_VENDOR_QUICKLOGIC, PCI_PRODUCT_QUICKLOGIC_PCWATCHDOG, 
+	    788, 17060, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1000, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1001, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1002, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1003, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1004, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1005, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1006, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1007, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1008, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1009, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_100A, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_100B, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_100C, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_100D, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_100E, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_100F, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1010, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1011, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1012, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1013, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1014, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1015, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1016, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1017, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1018, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1019, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_101A, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_101B, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_101C, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_101D, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_101E, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_101F, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1020, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1021, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1022, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1023, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1024, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1025, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1026, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1027, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1028, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1029, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_102A, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_102B, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_102C, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_102D, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_102E, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_102F, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1030, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1031, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1032, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1033, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1034, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1035, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1036, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1037, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1038, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_1039, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_103A, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_103B, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_103C, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_103D, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_103E, 
+	    26510, 0,
+	    PCI_VENDOR_QUMRANET, PCI_PRODUCT_QUMRANET_VIRTIO_103F, 
+	    26510, 0,
+	    PCI_VENDOR_RAINBOW, PCI_PRODUCT_RAINBOW_CS200, 
+	    26517, 10175, 26529, 7629, 0,
+	    PCI_VENDOR_RALINK, PCI_PRODUCT_RALINK_RT2460A, 
+	    26533, 7468, 0,
+	    PCI_VENDOR_RALINK, PCI_PRODUCT_RALINK_RT2560, 
+	    26541, 26548, 0,
+	    PCI_VENDOR_RALINK, PCI_PRODUCT_RALINK_RT2561S, 
+	    26558, 26548, 0,
+	    PCI_VENDOR_RALINK, PCI_PRODUCT_RALINK_RT2561, 
+	    26566, 26548, 0,
+	    PCI_VENDOR_RALINK, PCI_PRODUCT_RALINK_RT2661, 
+	    26573, 12120, 0,
+	    PCI_VENDOR_RALINK, PCI_PRODUCT_RALINK_RT3090, 
+	    26580, 12120, 0,
+	    PCI_VENDOR_RATOC, PCI_PRODUCT_RATOC_REXPCI31, 
+	    26587, 26591, 6462, 0,
+	    PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R1010_IDE, 
+	    26601, 6418, 23428, 0,
+	    PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R1011_IDE, 
+	    26607, 6418, 23428, 0,
+	    PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R1012_IDE, 
+	    26613, 6418, 23428, 0,
+	    PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6021_HB, 
+	    26619, 6751, 0,
+	    PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6025_HB, 
+	    26625, 6751, 0,
+	    PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6031_ISA, 
+	    26631, 6629, 9391, 0,
+	    PCI_VENDOR_RDC, PCI_PRODUCT_RDC_PCIB, 
+	    26637, 6629, 9391, 0,
+	    PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6040, 
+	    26643, 5611, 5509, 0,
+	    PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6060_OHCI, 
+	    26649, 6743, 8041, 0,
+	    PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6061_EHCI, 
+	    26655, 6743, 8046, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTS5209, 
+	    26661, 15791, 10831, 14404, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTS5227, 
+	    26669, 15791, 10831, 14404, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTS5229, 
+	    26677, 15791, 10831, 14404, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTS5249, 
+	    26685, 15791, 10831, 14404, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8402, 
+	    26693, 15791, 10831, 14404, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411B, 
+	    26701, 15791, 10831, 14404, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411, 
+	    26710, 15791, 10831, 14404, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8029, 
+	    26718, 5509, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139D, 
+	    26723, 5611, 5509, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8100, 
+	    26729, 5611, 5509, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8129, 
+	    26734, 5611, 5509, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8101E, 
+	    26739, 5611, 5509, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8138, 
+	    26757, 5611, 5509, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139, 
+	    7372, 5611, 5509, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169SC, 
+	    26762, 5524, 5509, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8168, 
+	    26776, 5524, 5509, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169, 
+	    26786, 5524, 5509, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188CE, 
+	    26796, 4739, 4534, 26806, 15791, 16315, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8192CE, 
+	    26814, 4739, 4534, 26806, 15791, 16315, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188EE, 
+	    26824, 4739, 4534, 26806, 15791, 16315, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8180, 
+	    26834, 7468, 0,
+	    PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8185, 
+	    26839, 26844, 0,
+	    PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_PPB, 
+	    26856, 8077, 0,
+	    PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_QXL, 
+	    26861, 234, 0,
+	    PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7780, 
+	    26865, 615, 6247, 0,
+	    PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7785, 
+	    26872, 615, 6247, 0,
+	    PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PBI, 
+	    26879, 17254, 26886, 26896, 0,
+	    PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PPB, 
+	    26879, 15353, 6355, 26902, 0,
+	    PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PS, 
+	    26879, 17254, 26908, 26915, 0,
+	    PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_PD720201, 
+	    26920, 6743, 8806, 6751, 6247, 0,
+	    PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_PD720202, 
+	    26930, 6743, 8806, 6751, 6247, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C465, 
+	    26940, 12586, 6355, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C466, 
+	    26946, 12586, 6355, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C475, 
+	    26952, 12586, 6355, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_RL5C476, 
+	    26958, 12586, 6355, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C477, 
+	    26964, 12586, 6355, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C478, 
+	    26970, 12586, 6355, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C551, 
+	    26976, 12586, 26982, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C552, 
+	    26998, 12586, 26982, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C592, 
+	    27004, 12586, 27010, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C593, 
+	    27032, 12586, 27010, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C821, 
+	    27038, 12586, 27044, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C822, 
+	    27064, 12586, 27044, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C832, 
+	    27070, 27076, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C843, 
+	    27107, 12586, 27113, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C847, 
+	    27147, 12586, 27113, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_RxDPCC, 
+	    27153, 10831, 6247, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C853, 
+	    27164, 12586, 27170, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5U230, 
+	    27207, 27213, 6247, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5U822, 
+	    27235, 22322, 6247, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5U823, 
+	    27241, 22322, 6247, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5U832, 
+	    27247, 8503, 6247, 0,
+	    PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C852, 
+	    27253, 22335, 6247, 0,
+	    PCI_VENDOR_RISCOM, PCI_PRODUCT_RISCOM_N2, 
+	    27259, 0,
+	    PCI_VENDOR_RNS, PCI_PRODUCT_RNS_FDDI, 
+	    17545, 27262, 0,
+	    PCI_VENDOR_S2IO, PCI_PRODUCT_S2IO_XFRAME, 
+	    27267, 13073, 5501, 5509, 5701, 0,
+	    PCI_VENDOR_S2IO, PCI_PRODUCT_S2IO_XFRAME2, 
+	    27274, 13073, 5501, 5509, 5701, 0,
+	    PCI_VENDOR_S2IO, PCI_PRODUCT_S2IO_XFRAME3, 
+	    27282, 13073, 5501, 5509, 5701, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE, 
+	    27290, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO32, 
+	    27296, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO64, 
+	    27303, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_AURORA64P, 
+	    27313, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO64UVP, 
+	    27324, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE_VX, 
+	    27334, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_868, 
+	    27343, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_928, 
+	    27347, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_864_0, 
+	    27354, 27363, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_864_1, 
+	    27377, 27363, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_864_2, 
+	    27386, 27363, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_864_3, 
+	    27395, 27363, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_964_0, 
+	    27404, 27413, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_964_1, 
+	    27427, 27413, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_964_2, 
+	    27436, 27413, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_964_3, 
+	    27445, 27413, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_968_0, 
+	    27454, 27463, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_968_1, 
+	    27477, 27463, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_968_2, 
+	    27486, 27463, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_968_3, 
+	    27495, 27463, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO64V2_DX, 
+	    27504, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_PLATO_PX, 
+	    27516, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO3D, 
+	    27525, 27532, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE_DX, 
+	    27539, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE_GX2, 
+	    27548, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO3D2X, 
+	    27558, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE3D, 
+	    27568, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE3D_MV, 
+	    27577, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE4, 
+	    27589, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_PROSAVAGE_KM133, 
+	    27597, 27607, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE_MX, 
+	    27613, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE_MXP, 
+	    27622, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE_MX_MV, 
+	    27632, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE_MX, 
+	    27645, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE_IX_MV, 
+	    27655, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE_IX, 
+	    27668, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE_IXC, 
+	    27678, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE2000, 
+	    27689, 0,
+	    PCI_VENDOR_S3, PCI_PRODUCT_S3_SONICVIBES, 
+	    27700, 0,
+	    PCI_VENDOR_SAFENET, PCI_PRODUCT_SAFENET_SAFEXCEL, 
+	    27711, 0,
+	    PCI_VENDOR_SAMSUNGELEC3, PCI_PRODUCT_SAMSUNGELEC3_XP941, 
+	    27720, 27726, 17632, 0,
+	    PCI_VENDOR_SAMSUNGELEC3, PCI_PRODUCT_SAMSUNGELEC3_SM951, 
+	    27730, 27726, 17632, 0,
+	    PCI_VENDOR_SAMSUNGSEMI, PCI_PRODUCT_SAMSUNGSEMI_KS8920, 
+	    27736, 5611, 5509, 0,
+	    PCI_VENDOR_SANDBURST, PCI_PRODUCT_SANDBURST_QE1000, 
+	    27743, 0,
+	    PCI_VENDOR_SANDBURST, PCI_PRODUCT_SANDBURST_FE1000, 
+	    27750, 0,
+	    PCI_VENDOR_SEGA, PCI_PRODUCT_SEGA_BROADBAND, 
+	    27757, 5701, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CNB20_LE_AGP, 
+	    27767, 27776, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CNB30_LE_PCI, 
+	    27784, 615, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CNB20_LE_PCI, 
+	    27767, 615, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CNB20_HE_PCI, 
+	    27793, 615, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CNB20_HE_AGP, 
+	    27793, 27776, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CIOB_X, 
+	    27802, 8171, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CMIC_HE, 
+	    27809, 27776, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CNB30_HE, 
+	    27817, 615, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CNB20_HE_PCI2, 
+	    27793, 27776, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CMIC_LE, 
+	    27826, 27776, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CMIC_SL, 
+	    27834, 27776, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT1000_PPB0, 
+	    27842, 24436, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CIOB_X2, 
+	    27849, 8171, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_BCM5714, 
+	    27857, 27873, 15791, 6807, 8171, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT1000_PPB1, 
+	    27842, 24436, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CIOB_E, 
+	    27882, 8171, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT2100_PPB0, 
+	    27889, 23463, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT2100_PPB1, 
+	    27889, 23463, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT2100_PPB2, 
+	    27889, 23463, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT2100_PPB3, 
+	    27889, 23463, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_OSB4, 
+	    27896, 8029, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CSB5, 
+	    27901, 8029, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CSB6, 
+	    27906, 8029, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT1000SB, 
+	    27911, 8029, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_OSB4_IDE, 
+	    27896, 6418, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CSB5_IDE, 
+	    27901, 6418, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT1000_IDE, 
+	    27920, 6418, 6247, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CSB6_RAID, 
+	    27906, 27928, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CSB6_IDE, 
+	    27906, 27928, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_OSB4_USB, 
+	    27937, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CSB6_USB, 
+	    27906, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT1000_USB, 
+	    27842, 6743, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CSB5_LPC, 
+	    27901, 27947, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_CSB6_LPC, 
+	    27906, 27947, 6355, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT1000_LPC, 
+	    27842, 8244, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT1000_XIOAPIC, 
+	    27842, 27955, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT1000_WDTIMER, 
+	    27842, 17060, 14905, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_K2_SATA, 
+	    8565, 8271, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_FRODO4_SATA, 
+	    27963, 8271, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_FRODO8_SATA, 
+	    27970, 8271, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT1000_SATA_1, 
+	    27920, 8271, 0,
+	    PCI_VENDOR_SERVERWORKS, PCI_PRODUCT_SERVERWORKS_HT1000_SATA_2, 
+	    27920, 8271, 0,
+	    PCI_VENDOR_SGI, PCI_PRODUCT_SGI_IOC3, 
+	    27977, 0,
+	    PCI_VENDOR_SGI, PCI_PRODUCT_SGI_RAD1, 
+	    27982, 27990, 0,
+	    PCI_VENDOR_SGI, PCI_PRODUCT_SGI_TIGON, 
+	    27995, 5501, 5509, 0,
+	    PCI_VENDOR_SGSTHOMSON, PCI_PRODUCT_SGSTHOMSON_2000, 
+	    28001, 28005, 0,
+	    PCI_VENDOR_SGSTHOMSON, PCI_PRODUCT_SGSTHOMSON_1764, 
+	    28001, 28011, 0,
+	    PCI_VENDOR_SIBYTE, PCI_PRODUCT_SIBYTE_BCM1250_PCIHB, 
+	    28017, 615, 6751, 6355, 0,
+	    PCI_VENDOR_SIBYTE, PCI_PRODUCT_SIBYTE_BCM1250_LDTHB, 
+	    28017, 28025, 6751, 6355, 0,
+	    PCI_VENDOR_SIGMA, PCI_PRODUCT_SIGMA_HOLLYWOODPLUS, 
+	    28029, 28039, 28054, 6711, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_S550, 
+	    28061, 10627, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_S650, 
+	    28061, 10627, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_S850, 
+	    28061, 10627, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_IO550, 
+	    28061, 8231, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_IO650, 
+	    28061, 8231, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_IO850, 
+	    28061, 8231, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_P, 
+	    28061, 17351, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_2P, 
+	    28061, 17351, 10142, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_2S550, 
+	    28061, 10627, 10142, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_2S650, 
+	    28061, 10627, 10142, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_2S850, 
+	    28061, 10627, 10142, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_2S1P550, 
+	    28061, 28088, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_2S1P650, 
+	    28061, 28088, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_2S1P850, 
+	    28061, 28088, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_4S550, 
+	    28061, 26341, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_4S650, 
+	    28061, 26341, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER10_4S850, 
+	    28061, 26341, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_S550, 
+	    28093, 10627, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_S650, 
+	    28093, 10627, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_S850, 
+	    28093, 10627, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_IO550, 
+	    28093, 8231, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_IO650, 
+	    28093, 8231, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_IO850, 
+	    28093, 8231, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_P, 
+	    28093, 17351, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_2P, 
+	    28093, 17351, 10142, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_2S550, 
+	    28093, 10627, 10142, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_2S650, 
+	    28093, 10627, 10142, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_2S850, 
+	    28093, 10627, 10142, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_2P1S550, 
+	    28093, 28102, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_2P1S650, 
+	    28093, 28102, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_2P1S850, 
+	    28093, 28102, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_4S550, 
+	    28093, 26341, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_4S650, 
+	    28093, 26341, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_4S850, 
+	    28093, 26341, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_2S1P550, 
+	    28093, 28088, 28070, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_2S1P650, 
+	    28093, 28088, 28076, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_CYBER20_2S1P850, 
+	    28093, 28088, 28082, 615, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_PS8000P550, 
+	    615, 10627, 28107, 13251, 28070, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_PS8000P650, 
+	    615, 10627, 28107, 13251, 28076, 0,
+	    PCI_VENDOR_SIIG, PCI_PRODUCT_SIIG_PS8000P850, 
+	    615, 10627, 28107, 13251, 28082, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_86C201, 
+	    28112, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_86C202, 
+	    28119, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_86C205, 
+	    28126, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_85C503, 
+	    28133, 16060, 28140, 16544, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_600PMC, 
+	    28150, 3749, 28154, 6247, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_180_SATA, 
+	    28160, 8271, 6247, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_181_SATA, 
+	    28164, 8271, 6247, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_182_SATA, 
+	    28168, 8271, 6247, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_183_SATA, 
+	    28172, 8271, 23428, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_190, 
+	    28176, 5509, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_191, 
+	    28180, 5501, 5509, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_5597_VGA, 
+	    28140, 692, 7989, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_300, 
+	    28184, 8090, 7989, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_315PRO_VGA, 
+	    28192, 7045, 7989, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_85C501, 
+	    28196, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_85C496, 
+	    28203, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_530HB, 
+	    28210, 6643, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_540HB, 
+	    24835, 6643, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_550HB, 
+	    25348, 6643, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_85C601, 
+	    28214, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_620, 
+	    28221, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_630, 
+	    28225, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_633, 
+	    28229, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_635, 
+	    28233, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_640, 
+	    28237, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_645, 
+	    28241, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_646, 
+	    28245, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_648, 
+	    28249, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_650, 
+	    28253, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_651, 
+	    28257, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_652, 
+	    28261, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_655, 
+	    28265, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_658, 
+	    28269, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_661, 
+	    28273, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_671, 
+	    28277, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_730, 
+	    28281, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_733, 
+	    28285, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_735, 
+	    28289, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_740, 
+	    28293, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_741, 
+	    28297, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_745, 
+	    28301, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_746, 
+	    28305, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_748, 
+	    28309, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_750, 
+	    28313, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_751, 
+	    28317, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_752, 
+	    28321, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_755, 
+	    28325, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_756, 
+	    28329, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_760, 
+	    28333, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_761, 
+	    28337, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_900, 
+	    28341, 5611, 5509, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_961, 
+	    28345, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_962, 
+	    28349, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_963, 
+	    28353, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_964, 
+	    28357, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_965, 
+	    28361, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_966, 
+	    28365, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_968, 
+	    28369, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_5597_IDE, 
+	    28140, 6418, 6247, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_5597_HB, 
+	    28140, 6751, 6355, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_530VGA, 
+	    28210, 28373, 28377, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_6325, 
+	    28392, 8090, 7989, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_6326, 
+	    28397, 8090, 7989, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_5597_USB, 
+	    28140, 6743, 6751, 6247, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7002, 
+	    28402, 6743, 6762, 6751, 6247, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7012_AC, 
+	    28407, 19950, 3393, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7016, 
+	    28412, 5611, 5509, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7018, 
+	    28417, 3393, 0,
+	    PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7502, 
+	    28422, 8284, 17695, 0,
+	    PCI_VENDOR_SILMOTION, PCI_PRODUCT_SILMOTION_SM502, 
+	    28427, 9486, 0,
+	    PCI_VENDOR_SILMOTION, PCI_PRODUCT_SILMOTION_SM710, 
+	    28435, 0,
+	    PCI_VENDOR_SILMOTION, PCI_PRODUCT_SILMOTION_SM712, 
+	    28442, 0,
+	    PCI_VENDOR_SILMOTION, PCI_PRODUCT_SILMOTION_SM720, 
+	    28450, 0,
+	    PCI_VENDOR_SILMOTION, PCI_PRODUCT_SILMOTION_SM810, 
+	    28458, 0,
+	    PCI_VENDOR_SILMOTION, PCI_PRODUCT_SILMOTION_SM811, 
+	    28458, 0,
+	    PCI_VENDOR_SILMOTION, PCI_PRODUCT_SILMOTION_SM820, 
+	    28464, 0,
+	    PCI_VENDOR_SILMOTION, PCI_PRODUCT_SILMOTION_SM910, 
+	    28471, 0,
+	    PCI_VENDOR_SMC, PCI_PRODUCT_SMC_37C665, 
+	    28476, 0,
+	    PCI_VENDOR_SMC, PCI_PRODUCT_SMC_37C922, 
+	    28486, 0,
+	    PCI_VENDOR_SMC, PCI_PRODUCT_SMC_83C170, 
+	    28496, 28503, 2439, 5509, 0,
+	    PCI_VENDOR_SMC, PCI_PRODUCT_SMC_83C175, 
+	    28516, 28503, 2439, 5509, 0,
+	    PCI_VENDOR_SOLIDUM, PCI_PRODUCT_SOLIDUM_AMD971, 
+	    28523, 458, 28532, 0,
+	    PCI_VENDOR_SOLIDUM, PCI_PRODUCT_SOLIDUM_CLASS802, 
+	    28523, 28536, 17991, 0,
+	    PCI_VENDOR_SOLIDUM, PCI_PRODUCT_SOLIDUM_PAXWARE1100, 
+	    28547, 23372, 10142, 28556, 28536, 17991, 0,
+	    PCI_VENDOR_SONY, PCI_PRODUCT_SONY_CXD1947A, 
+	    28559, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_SONY, PCI_PRODUCT_SONY_CXD3222, 
+	    28568, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_SONY, PCI_PRODUCT_SONY_MEMSTICK, 
+	    4513, 22329, 20191, 6247, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_EBUS, 
+	    28576, 28581, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_HMENETWORK, 
+	    28576, 28587, 28593, 5509, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_EBUSIII, 
+	    28576, 28581, 28598, 28602, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_ERINETWORK, 
+	    28607, 5509, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_FIREWIRE, 
+	    8590, 6247, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_USB, 
+	    6743, 6247, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_GEMNETWORK, 
+	    28611, 5501, 5509, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_SIMBA, 
+	    28615, 615, 6355, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_5821, 
+	    28621, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_SCA1K, 
+	    8412, 7629, 14306, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_PSYCHO, 
+	    28629, 615, 6247, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_MS_IIep, 
+	    28636, 28647, 615, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_US_IIi, 
+	    28652, 28663, 615, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_US_IIe, 
+	    28652, 15726, 615, 0,
+	    PCI_VENDOR_SUN, PCI_PRODUCT_SUN_CASSINI, 
+	    28667, 5501, 5509, 0,
+	    PCI_VENDOR_SUNDANCETI, PCI_PRODUCT_SUNDANCETI_IP100A, 
+	    28675, 5611, 5509, 0,
+	    PCI_VENDOR_SUNDANCETI, PCI_PRODUCT_SUNDANCETI_ST201, 
+	    28682, 5611, 5509, 0,
+	    PCI_VENDOR_SUNDANCETI, PCI_PRODUCT_SUNDANCETI_ST1023, 
+	    28688, 5501, 5509, 0,
+	    PCI_VENDOR_SUNDANCETI, PCI_PRODUCT_SUNDANCETI_ST2021, 
+	    28695, 5501, 5509, 0,
+	    PCI_VENDOR_SUNIX2, PCI_PRODUCT_SUNIX2_0001, 
+	    28702, 6553, 28709, 0,
+	    PCI_VENDOR_SUNIX2, PCI_PRODUCT_SUNIX2_SER5XXXX, 
+	    28717, 28725, 6553, 0,
+	    PCI_VENDOR_SUNIX, PCI_PRODUCT_SUNIX_PCI2S550, 
+	    28735, 28725, 6553, 0,
+	    PCI_VENDOR_SUNIX, PCI_PRODUCT_SUNIX_SUN1888, 
+	    28744, 28725, 28752, 0,
+	    PCI_VENDOR_SURECOM, PCI_PRODUCT_SURECOM_NE34, 
+	    28761, 5509, 0,
+	    PCI_VENDOR_SYBA, PCI_PRODUCT_SYBA_4S2P, 
+	    28767, 0,
+	    PCI_VENDOR_SYBA, PCI_PRODUCT_SYBA_4S, 
+	    26341, 0,
+	    PCI_VENDOR_SYMPHONY, PCI_PRODUCT_SYMPHONY_82C101, 
+	    28772, 0,
+	    PCI_VENDOR_SYMPHONY, PCI_PRODUCT_SYMPHONY_82C103, 
+	    28779, 0,
+	    PCI_VENDOR_SYMPHONY, PCI_PRODUCT_SYMPHONY_82C105, 
+	    28786, 0,
+	    PCI_VENDOR_SYMPHONY2, PCI_PRODUCT_SYMPHONY2_82C101, 
+	    28772, 0,
+	    PCI_VENDOR_SYMPHONY, PCI_PRODUCT_SYMPHONY_83C553, 
+	    28793, 6629, 6355, 0,
+	    PCI_VENDOR_SYSTEMBASE, PCI_PRODUCT_SYSTEMBASE_SB16C1054, 
+	    28800, 28810, 0,
+	    PCI_VENDOR_SYSTEMBASE, PCI_PRODUCT_SYSTEMBASE_SB16C1058, 
+	    28816, 28810, 0,
+	    PCI_VENDOR_SYSTEMBASE, PCI_PRODUCT_SYSTEMBASE_SB16C1050, 
+	    28826, 28810, 0,
+	    PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SKNET_FDDI, 
+	    15380, 28836, 0,
+	    PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SKNET_GE, 
+	    15380, 25292, 0,
+	    PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SK9821v2, 
+	    28844, 8857, 0,
+	    PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SK_9DX1, 
+	    15380, 28852, 5501, 5509, 0,
+	    PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SK_9D21, 
+	    28860, 28868, 0,
+	    PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SK_9D41, 
+	    28879, 28887, 0,
+	    PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SK_9SXX, 
+	    28898, 5501, 5509, 0,
+	    PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SK_9E21, 
+	    28906, 28923, 0,
+	    PCI_VENDOR_TAMARACK, PCI_PRODUCT_TAMARACK_TC9021, 
+	    28934, 5501, 5509, 0,
+	    PCI_VENDOR_TAMARACK, PCI_PRODUCT_TAMARACK_TC9021_ALT, 
+	    28934, 5501, 5509, 28941, 626, 0,
+	    PCI_VENDOR_TANDEM, PCI_PRODUCT_TANDEM_SERVERNETII, 
+	    28946, 7383, 2497, 5701, 0,
+	    PCI_VENDOR_TEKRAM, PCI_PRODUCT_TEKRAM_DC290, 
+	    28956, 0,
+	    PCI_VENDOR_TEKRAM2, PCI_PRODUCT_TEKRAM2_DC690C, 
+	    28966, 0,
+	    PCI_VENDOR_TEKRAM2, PCI_PRODUCT_TEKRAM2_DC315, 
+	    28974, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_TLAN, 
+	    28988, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_TVP4020, 
+	    28993, 6188, 6203, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB12LV21, 
+	    29001, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB12LV22, 
+	    29011, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI4450LYNX, 
+	    29021, 14617, 14622, 6751, 6247, 5948, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI4410LYNX, 
+	    29029, 14617, 14622, 6751, 6247, 5948, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB12LV23, 
+	    29037, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB12LV26, 
+	    29047, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB43AA22, 
+	    29057, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB43AA22A, 
+	    29067, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB43AA23, 
+	    29079, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB43AB21, 
+	    29089, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI4451LYNX, 
+	    29099, 14617, 14622, 6751, 6247, 5948, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI4510LYNX, 
+	    29107, 14617, 14622, 6751, 6247, 5948, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI4520LYNX, 
+	    29115, 14617, 14622, 6751, 6247, 5948, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI7410LYNX, 
+	    29123, 14617, 14622, 6751, 6247, 5948, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI72111CB, 
+	    29135, 29148, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI72111FW, 
+	    29135, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI72111FM, 
+	    29135, 692, 29156, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI72111SD, 
+	    29135, 8281, 10831, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI72111SM, 
+	    29135, 29167, 10831, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI6515A, 
+	    29170, 29148, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI6515ASM, 
+	    29170, 29148, 6247, 29179, 10831, 9361, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCIXX12CB, 
+	    29186, 29148, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCIXX12FW, 
+	    29186, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCIXX12FM, 
+	    29186, 692, 29156, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCIXX12SD, 
+	    29186, 29194, 240, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCIXX12SM, 
+	    29186, 12992, 10831, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_ACX100A, 
+	    29201, 7468, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_ACX100B, 
+	    29209, 7468, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_ACX111, 
+	    29217, 26548, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1130, 
+	    29224, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1031, 
+	    29232, 14634, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1131, 
+	    29240, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1250, 
+	    29248, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1220, 
+	    29256, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1221, 
+	    29264, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1210, 
+	    29272, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1450, 
+	    29280, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1225, 
+	    29288, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1251, 
+	    29296, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1211, 
+	    29304, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1251B, 
+	    29312, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI2030, 
+	    29321, 8077, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI2050, 
+	    29329, 8077, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI4450YENTA, 
+	    29021, 12586, 6355, 5948, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI4410YENTA, 
+	    29029, 12586, 6355, 5948, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI4451YENTA, 
+	    29099, 12586, 6355, 5948, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI4510YENTA, 
+	    29107, 12586, 6355, 5948, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI4520YENTA, 
+	    29115, 12586, 6355, 5948, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI7510YENTA, 
+	    29337, 12586, 6355, 5948, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI7610YENTA, 
+	    29345, 12586, 6355, 5948, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI7410YENTA, 
+	    29353, 12586, 6355, 5948, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI7610SM, 
+	    29345, 12586, 6355, 29179, 10831, 29361, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI7410SD, 
+	    29367, 12586, 6355, 29378, 29361, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI7410MS, 
+	    29367, 12586, 6355, 29386, 22329, 29361, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1410, 
+	    29394, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1420, 
+	    29402, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1451, 
+	    29410, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1421, 
+	    29418, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1620, 
+	    29426, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1520, 
+	    29434, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1510, 
+	    29442, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1530, 
+	    29450, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1515, 
+	    29458, 12586, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI2040, 
+	    29466, 29474, 6355, 0,
+	    PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI7420YENTA, 
+	    29482, 29490, 6355, 5948, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI010L, 
+	    29502, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI100L, 
+	    29511, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI110L, 
+	    29520, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI200L, 
+	    29529, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI210L, 
+	    29538, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI200LI, 
+	    29547, 0,
+	    PCI_VENDOR_MOLEX, PCI_PRODUCT_MOLEX_VSCOM_PCI400L, 
+	    29557, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI800L, 
+	    29566, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI011H, 
+	    29575, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCIx10H, 
+	    29584, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI100H, 
+	    29593, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI800H, 
+	    29602, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI800H_1, 
+	    29611, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI200H, 
+	    29622, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI010HV2, 
+	    29631, 0,
+	    PCI_VENDOR_TITAN, PCI_PRODUCT_TITAN_VSCOM_PCI200HV2, 
+	    29642, 0,
+	    PCI_VENDOR_TOSHIBA, PCI_PRODUCT_TOSHIBA_R4X00, 
+	    29653, 6643, 6355, 0,
+	    PCI_VENDOR_TOSHIBA, PCI_PRODUCT_TOSHIBA_TC35856F, 
+	    29659, 6917, 29668, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_PORTEGE, 
+	    29679, 12951, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_PICCOLO, 
+	    29687, 6418, 6247, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_PICCOLO2, 
+	    29687, 6203, 6418, 6247, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_PICCOLO3, 
+	    29687, 6214, 6418, 6247, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_PICCOLO5, 
+	    29687, 14013, 6418, 6247, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_HOST, 
+	    6751, 21614, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_ISA, 
+	    6629, 6355, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_ToPIC95, 
+	    29695, 12586, 6355, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_ToPIC95B, 
+	    29703, 12586, 6355, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_ToPIC97, 
+	    29712, 12586, 6355, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_SANREMO, 
+	    29720, 29729, 6751, 6355, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_SMCARD, 
+	    12992, 1935, 6247, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_SDCARD, 
+	    29194, 240, 10831, 6247, 29738, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_ToPIC100, 
+	    29745, 12586, 6355, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_OBOE, 
+	    2439, 29754, 29763, 29768, 0,
+	    PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_DONAUOBOE, 
+	    2439, 29754, 29763, 29770, 0,
+	    PCI_VENDOR_TRANSMETA, PCI_PRODUCT_TRANSMETA_TM8000NB, 
+	    29773, 692, 7866, 6355, 0,
+	    PCI_VENDOR_TRANSMETA, PCI_PRODUCT_TRANSMETA_NORTHBRIDGE, 
+	    13994, 7866, 6355, 0,
+	    PCI_VENDOR_TRANSMETA, PCI_PRODUCT_TRANSMETA_LONGRUN, 
+	    29780, 7866, 6355, 0,
+	    PCI_VENDOR_TRANSMETA, PCI_PRODUCT_TRANSMETA_SDRAM, 
+	    29788, 6247, 0,
+	    PCI_VENDOR_TRANSMETA, PCI_PRODUCT_TRANSMETA_BIOS_SCRATCH, 
+	    29794, 20938, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_4DWAVE_DX, 
+	    29799, 29806, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_4DWAVE_NX, 
+	    29799, 29809, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_CYBERBLADE_I7, 
+	    29812, 29823, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9320, 
+	    29826, 29831, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9350, 
+	    29826, 29836, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9360, 
+	    29826, 29841, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_CYBER_9397, 
+	    29846, 29852, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_CYBER_9397DVD, 
+	    29846, 29857, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_CYBER_9525, 
+	    29846, 29865, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9420, 
+	    29826, 29870, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9440, 
+	    29826, 29875, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9660, 
+	    29826, 29880, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9680, 
+	    29826, 29885, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9682, 
+	    29826, 29890, 0,
+	    PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_CYBERBLADE, 
+	    29812, 0,
+	    PCI_VENDOR_TRIONES, PCI_PRODUCT_TRIONES_HPT343, 
+	    29895, 6418, 6247, 0,
+	    PCI_VENDOR_TRIONES, PCI_PRODUCT_TRIONES_HPT366, 
+	    29906, 6418, 6247, 0,
+	    PCI_VENDOR_TRIONES, PCI_PRODUCT_TRIONES_HPT372A, 
+	    29921, 6418, 6247, 0,
+	    PCI_VENDOR_TRIONES, PCI_PRODUCT_TRIONES_HPT302, 
+	    29929, 6418, 6247, 0,
+	    PCI_VENDOR_TRIONES, PCI_PRODUCT_TRIONES_HPT371, 
+	    29936, 6418, 6247, 0,
+	    PCI_VENDOR_TRIONES, PCI_PRODUCT_TRIONES_HPT374, 
+	    29943, 6418, 6247, 0,
+	    PCI_VENDOR_TRIONES, PCI_PRODUCT_TRIONES_HPT372N, 
+	    29950, 6418, 6247, 0,
+	    PCI_VENDOR_TRIONES, PCI_PRODUCT_TRIONES_ROCKETRAID_2310, 
+	    29958, 29969, 6242, 29974, 0,
+	    PCI_VENDOR_TRIONES, PCI_PRODUCT_TRIONES_ROCKETRAID_2720, 
+	    29958, 29979, 6242, 29974, 0,
+	    PCI_VENDOR_TRITECH, PCI_PRODUCT_TRITECH_TR25202, 
+	    29984, 29994, 0,
+	    PCI_VENDOR_TSENG, PCI_PRODUCT_TSENG_ET4000_W32P_A, 
+	    30002, 8674, 10113, 0,
+	    PCI_VENDOR_TSENG, PCI_PRODUCT_TSENG_ET4000_W32P_B, 
+	    30002, 8674, 5124, 0,
+	    PCI_VENDOR_TSENG, PCI_PRODUCT_TSENG_ET4000_W32P_C, 
+	    30002, 8674, 10119, 0,
+	    PCI_VENDOR_TSENG, PCI_PRODUCT_TSENG_ET4000_W32P_D, 
+	    30002, 8674, 3163, 0,
+	    PCI_VENDOR_TSENG, PCI_PRODUCT_TSENG_ET6000, 
+	    30013, 0,
+	    PCI_VENDOR_TURTLE_BEACH, PCI_PRODUCT_TURTLE_BEACH_SANTA_CRUZ, 
+	    2564, 2570, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM82C881, 
+	    30020, 30029, 10051, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM82C886, 
+	    30033, 6629, 6355, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8673F, 
+	    30042, 8153, 6247, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8881, 
+	    30050, 16472, 30029, 615, 10051, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM82C891, 
+	    30057, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM886A, 
+	    30066, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8886BF, 
+	    30073, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8710, 
+	    30082, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8886, 
+	    30089, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8881F, 
+	    30096, 30104, 6355, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8886F, 
+	    30113, 6629, 6355, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8886A, 
+	    30121, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8891A, 
+	    30129, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM9017F, 
+	    30137, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8886N, 
+	    30145, 0,
+	    PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8891N, 
+	    30153, 0,
+	    PCI_VENDOR_ULSI, PCI_PRODUCT_ULSI_US201, 
+	    30161, 0,
+	    PCI_VENDOR_USR, PCI_PRODUCT_USR_3C2884A, 
+	    13331, 30167, 17765, 615, 5556, 30173, 0,
+	    PCI_VENDOR_USR, PCI_PRODUCT_USR_3CP5609, 
+	    30184, 615, 28070, 5556, 0,
+	    PCI_VENDOR_USR2, PCI_PRODUCT_USR2_USR997902, 
+	    30192, 5501, 5509, 0,
+	    PCI_VENDOR_USR2, PCI_PRODUCT_USR2_2415, 
+	    4739, 14634, 5701, 0,
+	    PCI_VENDOR_V3, PCI_PRODUCT_V3_V292PBCPSC, 
+	    30202, 30213, 30219, 24404, 6807, 615, 6355, 0,
+	    PCI_VENDOR_V3, PCI_PRODUCT_V3_V292PBC, 
+	    30225, 30233, 6643, 6355, 0,
+	    PCI_VENDOR_V3, PCI_PRODUCT_V3_V960PBC, 
+	    30242, 17648, 6643, 6355, 0,
+	    PCI_VENDOR_V3, PCI_PRODUCT_V3_V96DPC, 
+	    30250, 17648, 30257, 6643, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT6305, 
+	    30264, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_K8M800_0, 
+	    30271, 6751, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_K8T890_0, 
+	    30278, 6751, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_KT880, 
+	    30285, 2544, 6807, 615, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_K8HTB_0, 
+	    30291, 6751, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8363_HB, 
+	    30297, 30304, 30312, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3351_HB_0351, 
+	    30319, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900, 
+	    30326, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8371_HB, 
+	    30339, 30304, 30346, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VX900_HB, 
+	    30353, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8501_MVP4, 
+	    30359, 30304, 30366, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C505, 
+	    30372, 30381, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C561, 
+	    30389, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C586A_IDE, 
+	    30398, 6418, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C576, 
+	    30408, 30417, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_CX700_IDE, 
+	    30420, 6418, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C580VP, 
+	    30426, 30304, 30435, 6643, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C586_ISA, 
+	    30439, 6629, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237A_SATA, 
+	    30448, 692, 8271, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C595, 
+	    30456, 30304, 30465, 6643, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C596A, 
+	    30470, 6629, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C597, 
+	    30480, 30304, 30489, 6643, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C598PCI, 
+	    30494, 30304, 30503, 6643, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8605PCI, 
+	    30509, 30304, 30516, 30525, 6643, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C686A_ISA, 
+	    30530, 6629, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C691, 
+	    30540, 30304, 30549, 6643, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C693, 
+	    30554, 30304, 7045, 30563, 6643, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT86C926, 
+	    30569, 30578, 30585, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C570M, 
+	    30598, 30608, 6643, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C570MV, 
+	    30598, 30608, 6629, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_KT880_1, 
+	    30285, 2544, 6807, 615, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3351_HB_1351, 
+	    30319, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_1, 
+	    30326, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C586_IDE, 
+	    30439, 6418, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C595_2, 
+	    30456, 30304, 30465, 6643, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_KT880_2, 
+	    30285, 2544, 6807, 615, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3351_HB_2351, 
+	    30319, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_2, 
+	    30326, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251_PPB_287A, 
+	    30617, 8077, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251_PCIE1, 
+	    30617, 18038, 7843, 30624, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251_PCIE2, 
+	    30617, 18038, 7843, 30630, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251_VLINK, 
+	    30617, 6957, 30636, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT83C572, 
+	    30642, 6743, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C586_PWR, 
+	    30439, 3749, 6870, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3043, 
+	    30651, 30658, 5611, 5509, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT6306, 
+	    30666, 14617, 14622, 6751, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT6105M, 
+	    30673, 30681, 28602, 5611, 5509, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C686A_SMB, 
+	    30530, 8248, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C686A_AC97, 
+	    30530, 19950, 6846, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8233_AC97, 
+	    30688, 19950, 6846, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT6102, 
+	    30702, 30681, 22589, 5611, 5509, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C686A_MC97, 
+	    30530, 30709, 5556, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8233, 
+	    30715, 6629, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8366, 
+	    30722, 30304, 30729, 30736, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8653, 
+	    30744, 30304, 7045, 30751, 30736, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237_EHCI, 
+	    30757, 8046, 6743, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT6105, 
+	    30764, 30681, 28602, 5611, 5509, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT612X, 
+	    30771, 30778, 5524, 5509, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8623_VGA, 
+	    30789, 30304, 30796, 7989, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8623, 
+	    30789, 30304, 30796, 30736, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8233A, 
+	    30804, 6629, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237_SATA, 
+	    30757, 692, 8271, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT6410_RAID, 
+	    30812, 24698, 6242, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8235, 
+	    30819, 30304, 30826, 6629, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_K8HTB, 
+	    30291, 6751, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8377, 
+	    30833, 30840, 30847, 2544, 6807, 615, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8378, 
+	    30853, 30840, 30860, 2544, 6807, 615, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237, 
+	    30757, 25262, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT6421_RAID, 
+	    30866, 10627, 6242, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_KT880_3, 
+	    30285, 2544, 6807, 615, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251, 
+	    30617, 25262, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237A_HDA, 
+	    30873, 20430, 20435, 6846, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237A_ISA, 
+	    30888, 6629, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3314_IG, 
+	    30906, 30913, 30919, 692, 1716, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237R_SATA, 
+	    30929, 692, 8271, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3351_HB_3351, 
+	    30319, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_3, 
+	    30326, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_CHROME9_HC, 
+	    30937, 30945, 9184, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237S_ISA, 
+	    30948, 6629, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237A_PPB, 
+	    30448, 8077, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237A_HB, 
+	    30448, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_KT880_4, 
+	    30285, 2544, 6807, 615, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3351_HB_4351, 
+	    30319, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_4, 
+	    30326, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_CX700M2_IDE, 
+	    30956, 6418, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237A_SATA_2, 
+	    30448, 692, 8271, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3351_IOAPIC, 
+	    30319, 8231, 20994, 18954, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_IOAPIC, 
+	    30326, 8216, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237S_SATA, 
+	    30948, 692, 8271, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT86C100A, 
+	    30970, 30980, 5611, 5509, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251_SATA, 
+	    30617, 692, 8271, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_6, 
+	    30326, 7997, 2427, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8378_IG, 
+	    30853, 30860, 30919, 692, 1716, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_KT880_5, 
+	    30285, 2544, 6807, 615, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3351_HB_7351, 
+	    30319, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_7, 
+	    30326, 6751, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8231, 
+	    30991, 6629, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8231_PWR, 
+	    30991, 3749, 6870, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8363_PPB, 
+	    30297, 30304, 30312, 615, 6807, 8090, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_CX700, 
+	    30420, 25262, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VX800, 
+	    30998, 25262, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8371_PPB, 
+	    30339, 30304, 30346, 8077, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8501AGP, 
+	    30359, 30304, 30366, 31010, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C597AGP, 
+	    30480, 30304, 30489, 31010, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C598AGP, 
+	    30494, 30304, 30503, 31010, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8605AGP, 
+	    30509, 30304, 30516, 30525, 20147, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VX900_IDE, 
+	    30353, 6418, 6247, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_K8T890_PPB_A238, 
+	    30278, 8077, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_PPB_1, 
+	    30326, 8077, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8633AGP, 
+	    31018, 30304, 7045, 31025, 31010, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8366AGP, 
+	    30722, 30304, 30729, 31010, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8377AGP, 
+	    30833, 31010, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_K8HTB_AGP, 
+	    30291, 8090, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8377CEAGP, 
+	    31030, 31010, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3237_PPB, 
+	    30278, 7866, 2182, 30757, 8029, 8077, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_K8T890_PPB_C238, 
+	    30278, 8077, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_PPB_2, 
+	    30326, 8077, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_K8T890_PPB_D238, 
+	    30278, 8077, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_K8T890_PPB_E238, 
+	    30278, 8077, 6355, 0,
+	    PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_K8T890_PPB_F238, 
+	    30278, 8077, 6355, 0,
+	    PCI_VENDOR_VIRTUALBOX, PCI_PRODUCT_VIRTUALBOX_GRAPHICS, 
+	    1716, 0,
+	    PCI_VENDOR_VIRTUALBOX, PCI_PRODUCT_VIRTUALBOX_GUEST, 
+	    31039, 31045, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_60x0, 
+	    31053, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6000B, 
+	    31071, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x10, 
+	    31085, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x20, 
+	    31098, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6530, 
+	    31111, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6550, 
+	    31119, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x17, 
+	    31127, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x27, 
+	    31140, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6537, 
+	    31153, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6557, 
+	    31161, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x15, 
+	    31178, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x25, 
+	    31191, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6535, 
+	    31204, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6555, 
+	    31212, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x17RP, 
+	    31229, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x27RP, 
+	    31242, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6537RP, 
+	    31255, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6557RP, 
+	    31265, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x11RP, 
+	    31275, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x21RP, 
+	    31288, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x17RD, 
+	    31301, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x27RD, 
+	    31314, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6537RD, 
+	    31327, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6557RD, 
+	    31337, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x11RD, 
+	    31347, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x21RD, 
+	    31360, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x18RD, 
+	    31373, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x28RD, 
+	    31387, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x38RD, 
+	    31401, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x58RD, 
+	    31414, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x17RP2, 
+	    31427, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x27RP2, 
+	    31441, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6537RP2, 
+	    31455, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x11RP2, 
+	    31466, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x21RP2, 
+	    31480, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x13RS, 
+	    31494, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x23RS, 
+	    31504, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6518RS, 
+	    31514, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x28RS, 
+	    31524, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x38RS, 
+	    31534, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x58RS, 
+	    31544, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x33RS, 
+	    31554, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x43RS, 
+	    31564, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x53RS, 
+	    31574, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x63RS, 
+	    31584, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x13RN, 
+	    31594, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x23RN, 
+	    31604, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x18RN, 
+	    31614, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x28RN, 
+	    31628, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x38RN, 
+	    31642, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x58RN, 
+	    31655, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x43RN, 
+	    31668, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x53RN, 
+	    31681, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x63RN, 
+	    31691, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_4x13RZ, 
+	    31701, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_4x23RZ, 
+	    31711, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_8x13RZ, 
+	    31721, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_8x23RZ, 
+	    31731, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_8x33RZ, 
+	    31741, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_8x43RZ, 
+	    31751, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_8x53RZ, 
+	    31761, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_8x63RZ, 
+	    31771, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x19RD, 
+	    31781, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x29RD, 
+	    31794, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x19RN, 
+	    31807, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x29RN, 
+	    31820, 0,
+	    PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_ICP, 
+	    31833, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C592, 
+	    31837, 2544, 6355, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C593, 
+	    31844, 16544, 6355, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C594, 
+	    31851, 31858, 6, 6247, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C596597, 
+	    31866, 31858, 16544, 6355, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C541, 
+	    31877, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C543, 
+	    31884, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C532, 
+	    31891, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C534, 
+	    31898, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C535, 
+	    31905, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C147, 
+	    31912, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C975, 
+	    31919, 0,
+	    PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C925, 
+	    31926, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VIRTUAL2, 
+	    13994, 31933, 7383, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VIRTUAL, 
+	    13994, 31933, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMXNET, 
+	    13994, 3888, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMSCSI, 
+	    13994, 6462, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMCI, 
+	    13994, 31938, 31946, 3027, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMEM, 
+	    13994, 31960, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMEB, 
+	    13994, 31968, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMUSB, 
+	    13994, 6743, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VM1394, 
+	    13994, 8503, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMPCIB, 
+	    13994, 615, 6355, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMPCIE, 
+	    13994, 615, 4329, 7843, 7909, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMXNET3, 
+	    13994, 3888, 6214, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_PVSCSI, 
+	    31976, 0,
+	    PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMI3, 
+	    31983, 31987, 31994, 0,
+	    PCI_VENDOR_WEITEK, PCI_PRODUCT_WEITEK_P9000, 
+	    31998, 0,
+	    PCI_VENDOR_WEITEK, PCI_PRODUCT_WEITEK_P9100, 
+	    32004, 0,
+	    PCI_VENDOR_WD, PCI_PRODUCT_WD_WD33C193A, 
+	    32010, 0,
+	    PCI_VENDOR_WD, PCI_PRODUCT_WD_WD33C196A, 
+	    32020, 0,
+	    PCI_VENDOR_WD, PCI_PRODUCT_WD_WD33C197A, 
+	    32030, 0,
+	    PCI_VENDOR_WD, PCI_PRODUCT_WD_WD7193, 
+	    32040, 0,
+	    PCI_VENDOR_WD, PCI_PRODUCT_WD_WD7197, 
+	    32047, 0,
+	    PCI_VENDOR_WD, PCI_PRODUCT_WD_WD33C296A, 
+	    32054, 0,
+	    PCI_VENDOR_WD, PCI_PRODUCT_WD_WD34C296, 
+	    32064, 0,
+	    PCI_VENDOR_WD, PCI_PRODUCT_WD_90C, 
+	    32073, 0,
+	    PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W83769F, 
+	    32077, 0,
+	    PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W83C553F_0, 
+	    32085, 6629, 6355, 0,
+	    PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W83628F, 
+	    32094, 6629, 6355, 0,
+	    PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W83C553F_1, 
+	    32085, 6418, 6247, 0,
+	    PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C840F, 
+	    32102, 5611, 5509, 0,
+	    PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C940F, 
+	    32111, 5509, 0,
+	    PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C940F_1, 
+	    32111, 5509, 0,
+	    PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W6692, 
+	    32120, 8819, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NJSC32BI, 
+	    22161, 6462, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NJATA32BI, 
+	    22140, 6418, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NJSC32UDE, 
+	    32126, 6462, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NJSC32BI_KME, 
+	    22161, 6462, 32142, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NJATA32BI_KME, 
+	    22140, 6418, 32142, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NJSC32UDE_IODATA, 
+	    32126, 6462, 32148, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NJSC32UDE_LOGITEC, 
+	    32126, 6462, 32157, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NJSC32UDE_LOGITEC2, 
+	    32126, 6462, 32167, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NJSC32UDE_BUFFALO, 
+	    32126, 6462, 32178, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NPATA32_CF32A, 
+	    32188, 32194, 5701, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NPATA32_CF32A_BUFFALO, 
+	    32188, 32207, 5701, 32178, 0,
+	    PCI_VENDOR_WORKBIT, PCI_PRODUCT_WORKBIT_NPATA32_KME, 
+	    32210, 6418, 32142, 0,
+	    PCI_VENDOR_XENSOURCE, PCI_PRODUCT_XENSOURCE_XENPLATFORM, 
+	    32219, 32223, 2427, 0,
+	    PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_Z7, 
+	    32232, 32239, 0,
+	    PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_Z9M, 
+	    32232, 32249, 0,
+	    PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_Z11, 
+	    32232, 32253, 0,
+	    PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_V3XT, 
+	    32232, 32262, 0,
+	    PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_XP10, 
+	    32232, 32273, 0,
+	    PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_X3201_3, 
+	    32278, 2439, 5509, 6247, 0,
+	    PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_X3201_3_21143, 
+	    32278, 2439, 5509, 6247, 32286, 0,
+	    PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_WINGLOBAL, 
+	    32294, 5556, 0,
+	    PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_MODEM56, 
+	    5726, 5556, 0,
+	    PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF724, 
+	    32304, 6846, 0,
+	    PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF740, 
+	    28293, 6846, 0,
+	    PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF740C, 
+	    32308, 32313, 6846, 0,
+	    PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF724F, 
+	    32320, 32313, 6846, 0,
+	    PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF744B, 
+	    32325, 32329, 6846, 0,
+	    PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF754, 
+	    32337, 32341, 6846, 0,
+	    PCI_VENDOR_ZEINET, PCI_PRODUCT_ZEINET_1221, 
+	    32349, 0,
+	    PCI_VENDOR_ZIATECH, PCI_PRODUCT_ZIATECH_ZT8905, 
+	    32354, 6355, 0,
+	    PCI_VENDOR_ZORAN, PCI_PRODUCT_ZORAN_ZR36057, 
+	    32363, 2455, 6247, 0,
+	    PCI_VENDOR_ZORAN, PCI_PRODUCT_ZORAN_ZR36120, 
+	    32371, 234, 6247, 0,
+};
+static const char pci_words[] = { "." 
+	    "Peak\0" /* 1 refs @ 1 */
+	    "System\0" /* 34 refs @ 6 */
+	    "Technik\0" /* 1 refs @ 13 */
+	    "Martin-Marietta\0" /* 1 refs @ 21 */
+	    "Hauppauge\0" /* 1 refs @ 37 */
+	    "Computer\0" /* 36 refs @ 47 */
+	    "Works\0" /* 1 refs @ 56 */
+	    "Dynalink\0" /* 1 refs @ 62 */
+	    "Compaq\0" /* 2 refs @ 71 */
+	    "Symbios\0" /* 1 refs @ 78 */
+	    "Logic\0" /* 10 refs @ 86 */
+	    "ATI\0" /* 1 refs @ 92 */
+	    "Technologies\0" /* 25 refs @ 96 */
+	    "ULSI\0" /* 1 refs @ 109 */
+	    "Systems\0" /* 54 refs @ 114 */
+	    "VLSI\0" /* 1 refs @ 122 */
+	    "Technology\0" /* 52 refs @ 127 */
+	    "Avance\0" /* 2 refs @ 138 */
+	    "Reply\0" /* 1 refs @ 145 */
+	    "Group\0" /* 1 refs @ 151 */
+	    "NetFrame\0" /* 1 refs @ 157 */
+	    "Epson\0" /* 2 refs @ 166 */
+	    "Phoenix\0" /* 1 refs @ 172 */
+	    "National\0" /* 3 refs @ 180 */
+	    "Semiconductor\0" /* 14 refs @ 189 */
+	    "Tseng\0" /* 2 refs @ 203 */
+	    "Labs\0" /* 8 refs @ 209 */
+	    "AST\0" /* 1 refs @ 214 */
+	    "Research\0" /* 11 refs @ 218 */
+	    "Weitek\0" /* 1 refs @ 227 */
+	    "Video\0" /* 22 refs @ 234 */
+	    "Digital\0" /* 10 refs @ 240 */
+	    "Equipment\0" /* 1 refs @ 248 */
+	    "Micronics\0" /* 1 refs @ 258 */
+	    "Computers\0" /* 6 refs @ 268 */
+	    "Cirrus\0" /* 1 refs @ 278 */
+	    "IBM\0" /* 1 refs @ 285 */
+	    "LSI\0" /* 6 refs @ 289 */
+	    "of\0" /* 4 refs @ 293 */
+	    "Canada\0" /* 1 refs @ 296 */
+	    "ICL\0" /* 2 refs @ 303 */
+	    "Personal\0" /* 1 refs @ 307 */
+	    "SPEA\0" /* 1 refs @ 316 */
+	    "Software\0" /* 4 refs @ 321 */
+	    "Unisys\0" /* 1 refs @ 330 */
+	    "Elitegroup\0" /* 1 refs @ 337 */
+	    "AT&T\0" /* 1 refs @ 348 */
+	    "Global\0" /* 3 refs @ 353 */
+	    "Information\0" /* 3 refs @ 360 */
+	    "Vitesse\0" /* 1 refs @ 372 */
+	    "Western\0" /* 1 refs @ 380 */
+	    "American\0" /* 1 refs @ 388 */
+	    "Megatrends\0" /* 1 refs @ 397 */
+	    "PictureTel\0" /* 1 refs @ 408 */
+	    "Hitachi\0" /* 2 refs @ 419 */
+	    "Products\0" /* 7 refs @ 427 */
+	    "OKI\0" /* 1 refs @ 436 */
+	    "Electric\0" /* 3 refs @ 440 */
+	    "Industry\0" /* 1 refs @ 449 */
+	    "AMD\0" /* 4 refs @ 458 */
+	    "Trident\0" /* 1 refs @ 462 */
+	    "Microsystems\0" /* 14 refs @ 470 */
+	    "Zenith\0" /* 1 refs @ 483 */
+	    "Data\0" /* 10 refs @ 490 */
+	    "Acer\0" /* 2 refs @ 495 */
+	    "Dell\0" /* 3 refs @ 500 */
+	    "Siemens\0" /* 3 refs @ 505 */
+	    "Nixdorf\0" /* 2 refs @ 513 */
+	    "AG\0" /* 4 refs @ 521 */
+	    "Logic,\0" /* 1 refs @ 524 */
+	    "Headland\0" /* 1 refs @ 531 */
+	    "div.\0" /* 1 refs @ 540 */
+	    "Matrox\0" /* 1 refs @ 545 */
+	    "Chips\0" /* 1 refs @ 552 */
+	    "and\0" /* 26 refs @ 558 */
+	    "WYSE\0" /* 1 refs @ 562 */
+	    "Olivetti\0" /* 1 refs @ 567 */
+	    "Advanced\0" /* 13 refs @ 576 */
+	    "Toshiba\0" /* 2 refs @ 585 */
+	    "America\0" /* 5 refs @ 593 */
+	    "TMC\0" /* 1 refs @ 601 */
+	    "Miro\0" /* 1 refs @ 605 */
+	    "(2nd\0" /* 14 refs @ 610 */
+	    "PCI\0" /* 333 refs @ 615 */
+	    "Vendor\0" /* 16 refs @ 619 */
+	    "ID)\0" /* 19 refs @ 626 */
+	    "NEC\0" /* 2 refs @ 630 */
+	    "Burndy\0" /* 1 refs @ 634 */
+	    "Comp.\0" /* 1 refs @ 641 */
+	    "&\0" /* 13 refs @ 647 */
+	    "Comm.\0" /* 1 refs @ 649 */
+	    "Lab\0" /* 1 refs @ 655 */
+	    "Future\0" /* 1 refs @ 659 */
+	    "Domain\0" /* 1 refs @ 666 */
+	    "Hitach\0" /* 1 refs @ 673 */
+	    "AMP\0" /* 1 refs @ 680 */
+	    "Silicon\0" /* 4 refs @ 684 */
+	    "Integrated\0" /* 86 refs @ 692 */
+	    "Seiko\0" /* 1 refs @ 703 */
+	    "Tatung\0" /* 1 refs @ 709 */
+	    "Hewlett-Packard\0" /* 2 refs @ 716 */
+	    "Solliday\0" /* 1 refs @ 732 */
+	    "Engineering\0" /* 4 refs @ 741 */
+	    "Modeling\0" /* 1 refs @ 753 */
+	    "Kubota\0" /* 1 refs @ 762 */
+	    "Pacific\0" /* 1 refs @ 769 */
+	    "Computrend\0" /* 1 refs @ 777 */
+	    "PC\0" /* 3 refs @ 788 */
+	    "Asustek\0" /* 1 refs @ 791 */
+	    "Distributed\0" /* 1 refs @ 799 */
+	    "Processing\0" /* 3 refs @ 811 */
+	    "Opti\0" /* 1 refs @ 822 */
+	    "IPC\0" /* 1 refs @ 827 */
+	    "Genoa\0" /* 1 refs @ 831 */
+	    "Elsa\0" /* 1 refs @ 837 */
+	    "Fountain\0" /* 1 refs @ 842 */
+	    "SGS-Thomson\0" /* 2 refs @ 851 */
+	    "Microelectronics\0" /* 10 refs @ 863 */
+	    "BusLogic\0" /* 1 refs @ 880 */
+	    "Texas\0" /* 2 refs @ 889 */
+	    "Instruments\0" /* 2 refs @ 895 */
+	    "Sony\0" /* 1 refs @ 907 */
+	    "Oak\0" /* 1 refs @ 912 */
+	    "Co-time\0" /* 1 refs @ 916 */
+	    "Winbond\0" /* 1 refs @ 924 */
+	    "Electronics\0" /* 25 refs @ 932 */
+	    "Anigma\0" /* 1 refs @ 944 */
+	    "Young\0" /* 1 refs @ 951 */
+	    "Micro\0" /* 9 refs @ 957 */
+	    "Efar\0" /* 1 refs @ 963 */
+	    "Motorola\0" /* 2 refs @ 968 */
+	    "Telec.\0" /* 1 refs @ 977 */
+	    "RSH\0" /* 1 refs @ 984 */
+	    "Teknor\0" /* 1 refs @ 988 */
+	    "Promise\0" /* 1 refs @ 995 */
+	    "Foxconn\0" /* 1 refs @ 1003 */
+	    "International\0" /* 5 refs @ 1011 */
+	    "Wipro\0" /* 1 refs @ 1025 */
+	    "Infotech\0" /* 1 refs @ 1031 */
+	    "Number\0" /* 1 refs @ 1040 */
+	    "9\0" /* 28 refs @ 1047 */
+	    "Company\0" /* 2 refs @ 1049 */
+	    "Vtech\0" /* 1 refs @ 1057 */
+	    "Infotronic\0" /* 1 refs @ 1063 */
+	    "United\0" /* 2 refs @ 1074 */
+	    "I.\0" /* 1 refs @ 1081 */
+	    "T.\0" /* 2 refs @ 1084 */
+	    "MasPar\0" /* 1 refs @ 1087 */
+	    "Ocean\0" /* 1 refs @ 1094 */
+	    "Office\0" /* 1 refs @ 1100 */
+	    "Automation\0" /* 1 refs @ 1107 */
+	    "Alcatel\0" /* 1 refs @ 1118 */
+	    "CIT\0" /* 1 refs @ 1126 */
+	    "Picopower\0" /* 1 refs @ 1130 */
+	    "Mitsubishi\0" /* 2 refs @ 1140 */
+	    "Diversified\0" /* 1 refs @ 1151 */
+	    "Mylex\0" /* 1 refs @ 1163 */
+	    "Aten\0" /* 1 refs @ 1169 */
+	    "Apple\0" /* 1 refs @ 1174 */
+	    "Hyundai\0" /* 1 refs @ 1180 */
+	    "Sequent\0" /* 1 refs @ 1188 */
+	    "DFI\0" /* 1 refs @ 1196 */
+	    "City\0" /* 1 refs @ 1200 */
+	    "Gate\0" /* 1 refs @ 1205 */
+	    "Development\0" /* 1 refs @ 1210 */
+	    "Daewoo\0" /* 1 refs @ 1222 */
+	    "Telecom\0" /* 1 refs @ 1229 */
+	    "Mitac\0" /* 1 refs @ 1237 */
+	    "GIT\0" /* 1 refs @ 1243 */
+	    "Yamaha\0" /* 1 refs @ 1247 */
+	    "NexGen\0" /* 1 refs @ 1254 */
+	    "Integration\0" /* 1 refs @ 1261 */
+	    "Chaintech\0" /* 1 refs @ 1273 */
+	    "QLogic\0" /* 1 refs @ 1283 */
+	    "Cyrix\0" /* 1 refs @ 1290 */
+	    "I-Bus\0" /* 1 refs @ 1296 */
+	    "NetWorth\0" /* 1 refs @ 1302 */
+	    "Gateway\0" /* 1 refs @ 1311 */
+	    "2000\0" /* 4 refs @ 1319 */
+	    "Goldstar\0" /* 1 refs @ 1324 */
+	    "LeadTek\0" /* 1 refs @ 1333 */
+	    "Interphase\0" /* 1 refs @ 1341 */
+	    "Contaq\0" /* 1 refs @ 1352 */
+	    "Supermac\0" /* 1 refs @ 1359 */
+	    "EFA\0" /* 1 refs @ 1368 */
+	    "Forex\0" /* 1 refs @ 1372 */
+	    "Parador\0" /* 1 refs @ 1378 */
+	    "Tulip\0" /* 2 refs @ 1386 */
+	    "J.\0" /* 1 refs @ 1392 */
+	    "Bond\0" /* 1 refs @ 1395 */
+	    "Cache\0" /* 3 refs @ 1400 */
+	    "Microcomputer\0" /* 1 refs @ 1406 */
+	    "General\0" /* 1 refs @ 1420 */
+	    "Bit3\0" /* 1 refs @ 1428 */
+	    "Elonex\0" /* 1 refs @ 1433 */
+	    "PLC\0" /* 1 refs @ 1440 */
+	    "c/o\0" /* 1 refs @ 1444 */
+	    "Oakleigh\0" /* 1 refs @ 1448 */
+	    "Olicom\0" /* 1 refs @ 1457 */
+	    "Sun\0" /* 2 refs @ 1464 */
+	    "Systemsoft\0" /* 1 refs @ 1468 */
+	    "Encore\0" /* 1 refs @ 1479 */
+	    "Intergraph\0" /* 1 refs @ 1486 */
+	    "Diamond\0" /* 1 refs @ 1497 */
+	    "First\0" /* 1 refs @ 1505 */
+	    "Int'l\0" /* 2 refs @ 1511 */
+	    "CMD\0" /* 1 refs @ 1517 */
+	    "Alacron\0" /* 1 refs @ 1521 */
+	    "Appian\0" /* 1 refs @ 1529 */
+	    "Quantum\0" /* 2 refs @ 1536 */
+	    "Designs\0" /* 3 refs @ 1544 */
+	    "Samsung\0" /* 4 refs @ 1552 */
+	    "Packard\0" /* 1 refs @ 1560 */
+	    "Bell\0" /* 1 refs @ 1568 */
+	    "Gemlight\0" /* 1 refs @ 1573 */
+	    "Megachips\0" /* 1 refs @ 1582 */
+	    "Zida\0" /* 1 refs @ 1592 */
+	    "Brooktree\0" /* 1 refs @ 1597 */
+	    "Trigem\0" /* 2 refs @ 1607 */
+	    "Meidensha\0" /* 1 refs @ 1614 */
+	    "Juko\0" /* 1 refs @ 1624 */
+	    "Everex\0" /* 1 refs @ 1629 */
+	    "Globe\0" /* 1 refs @ 1636 */
+	    "Manufacturing\0" /* 3 refs @ 1642 */
+	    "Sales\0" /* 1 refs @ 1656 */
+	    "Racal\0" /* 1 refs @ 1662 */
+	    "Interlan\0" /* 1 refs @ 1668 */
+	    "Informtech\0" /* 1 refs @ 1677 */
+	    "Industrial\0" /* 2 refs @ 1688 */
+	    "Benchmarq\0" /* 1 refs @ 1699 */
+	    "Sierra\0" /* 2 refs @ 1709 */
+	    "Graphics\0" /* 105 refs @ 1716 */
+	    "ACC\0" /* 1 refs @ 1725 */
+	    "Digicom\0" /* 1 refs @ 1729 */
+	    "Honeywell\0" /* 1 refs @ 1737 */
+	    "IASD\0" /* 1 refs @ 1747 */
+	    "Symphony\0" /* 2 refs @ 1752 */
+	    "Cornerstone\0" /* 1 refs @ 1761 */
+	    "Sysytems\0" /* 1 refs @ 1773 */
+	    "(M)\0" /* 2 refs @ 1782 */
+	    "SON\0" /* 1 refs @ 1786 */
+	    "CardExpert\0" /* 1 refs @ 1790 */
+	    "Cabletron\0" /* 1 refs @ 1801 */
+	    "Raytheon\0" /* 1 refs @ 1811 */
+	    "Databook\0" /* 1 refs @ 1820 */
+	    "STB\0" /* 1 refs @ 1829 */
+	    "PLX\0" /* 2 refs @ 1833 */
+	    "Madge\0" /* 1 refs @ 1837 */
+	    "Networks\0" /* 5 refs @ 1843 */
+	    "3Com\0" /* 1 refs @ 1852 */
+	    "Standard\0" /* 1 refs @ 1857 */
+	    "Dapha\0" /* 1 refs @ 1866 */
+	    "Surecom\0" /* 1 refs @ 1872 */
+	    "Most\0" /* 1 refs @ 1880 */
+	    "Boca\0" /* 1 refs @ 1885 */
+	    "ICM\0" /* 1 refs @ 1890 */
+	    "Auspex\0" /* 1 refs @ 1894 */
+	    "Semiconductors\0" /* 2 refs @ 1901 */
+	    "Award\0" /* 1 refs @ 1916 */
+	    "Xerox\0" /* 2 refs @ 1922 */
+	    "Rambus\0" /* 1 refs @ 1928 */
+	    "Media\0" /* 4 refs @ 1935 */
+	    "Vision\0" /* 2 refs @ 1941 */
+	    "Neomagic\0" /* 1 refs @ 1948 */
+	    "Dataexpert\0" /* 1 refs @ 1957 */
+	    "Fujitsu\0" /* 4 refs @ 1968 */
+	    "Omron\0" /* 1 refs @ 1976 */
+	    "Mentor\0" /* 1 refs @ 1982 */
+	    "ARC\0" /* 2 refs @ 1989 */
+	    "Radius\0" /* 1 refs @ 1993 */
+	    "(4th\0" /* 1 refs @ 2000 */
+	    "Future+\0" /* 1 refs @ 2005 */
+	    "Molex\0" /* 1 refs @ 2013 */
+	    "Jabil\0" /* 1 refs @ 2019 */
+	    "Circuit\0" /* 1 refs @ 2025 */
+	    "Hualon\0" /* 1 refs @ 2033 */
+	    "Autologic\0" /* 1 refs @ 2040 */
+	    "Cetia\0" /* 1 refs @ 2050 */
+	    "BCM\0" /* 1 refs @ 2056 */
+	    "Peripherals\0" /* 3 refs @ 2060 */
+	    "Macronix\0" /* 1 refs @ 2072 */
+	    "Thomas-Conrad\0" /* 1 refs @ 2081 */
+	    "Rohm\0" /* 1 refs @ 2095 */
+	    "CERN/ECP/EDU\0" /* 1 refs @ 2100 */
+	    "Evans\0" /* 1 refs @ 2113 */
+	    "Sutherland\0" /* 1 refs @ 2119 */
+	    "NVIDIA\0" /* 1 refs @ 2130 */
+	    "Emulex\0" /* 1 refs @ 2137 */
+	    "Solutions\0" /* 2 refs @ 2144 */
+	    "Tekram\0" /* 2 refs @ 2154 */
+	    "(1st\0" /* 1 refs @ 2161 */
+	    "Aptix\0" /* 1 refs @ 2166 */
+	    "Newbridge\0" /* 1 refs @ 2172 */
+	    "/\0" /* 9 refs @ 2182 */
+	    "Tundra\0" /* 1 refs @ 2184 */
+	    "Tandem\0" /* 1 refs @ 2191 */
+	    "Industries\0" /* 2 refs @ 2198 */
+	    "Gainbery\0" /* 1 refs @ 2209 */
+	    "Vadem\0" /* 1 refs @ 2218 */
+	    "Applied\0" /* 2 refs @ 2224 */
+	    "Circuits\0" /* 1 refs @ 2232 */
+	    "Alps\0" /* 1 refs @ 2241 */
+	    "Integraphics\0" /* 1 refs @ 2246 */
+	    "Artists\0" /* 1 refs @ 2259 */
+	    "Realtek\0" /* 1 refs @ 2267 */
+	    "ASCII\0" /* 1 refs @ 2275 */
+	    "Xilinx\0" /* 1 refs @ 2281 */
+	    "Racore\0" /* 1 refs @ 2288 */
+	    "Peritek\0" /* 1 refs @ 2295 */
+	    "Tyan\0" /* 1 refs @ 2303 */
+	    "Achme\0" /* 1 refs @ 2308 */
+	    "Alaris\0" /* 1 refs @ 2314 */
+	    "S-MOS\0" /* 1 refs @ 2321 */
+	    "NKK\0" /* 1 refs @ 2327 */
+	    "Creative\0" /* 2 refs @ 2331 */
+	    "Electronic\0" /* 7 refs @ 2340 */
+	    "Matsushita\0" /* 2 refs @ 2351 */
+	    "Altos\0" /* 1 refs @ 2362 */
+	    "India\0" /* 1 refs @ 2368 */
+	    "Direct\0" /* 1 refs @ 2374 */
+	    "Truevision\0" /* 1 refs @ 2381 */
+	    "Thesys\0" /* 1 refs @ 2392 */
+	    "Ges.\0" /* 1 refs @ 2399 */
+	    "F.\0" /* 1 refs @ 2404 */
+	    "Mikroelektronik\0" /* 1 refs @ 2407 */
+	    "I-O\0" /* 1 refs @ 2423 */
+	    "Device\0" /* 70 refs @ 2427 */
+	    "Soyo\0" /* 1 refs @ 2434 */
+	    "Fast\0" /* 23 refs @ 2439 */
+	    "NCube\0" /* 1 refs @ 2444 */
+	    "Jazz\0" /* 1 refs @ 2450 */
+	    "Multimedia\0" /* 3 refs @ 2455 */
+	    "Initio\0" /* 1 refs @ 2466 */
+	    "Triones\0" /* 1 refs @ 2473 */
+	    "RasterOps\0" /* 1 refs @ 2481 */
+	    "Sigma\0" /* 1 refs @ 2491 */
+	    "VIA\0" /* 3 refs @ 2497 */
+	    "Stratus\0" /* 1 refs @ 2501 */
+	    "Proteon\0" /* 1 refs @ 2509 */
+	    "Cogent\0" /* 1 refs @ 2517 */
+	    "Xenon\0" /* 1 refs @ 2524 */
+	    "Mini-Max\0" /* 1 refs @ 2530 */
+	    "Znyx\0" /* 1 refs @ 2539 */
+	    "CPU\0" /* 17 refs @ 2544 */
+	    "Ross\0" /* 1 refs @ 2548 */
+	    "Powerhouse\0" /* 1 refs @ 2553 */
+	    "Santa\0" /* 2 refs @ 2564 */
+	    "Cruz\0" /* 2 refs @ 2570 */
+	    "Operation\0" /* 1 refs @ 2575 */
+	    "RNS\0" /* 1 refs @ 2585 */
+	    "Accton\0" /* 1 refs @ 2589 */
+	    "Atmel\0" /* 1 refs @ 2596 */
+	    "DuPont\0" /* 1 refs @ 2602 */
+	    "Pixel\0" /* 1 refs @ 2609 */
+	    "Translation\0" /* 1 refs @ 2615 */
+	    "Datacube\0" /* 1 refs @ 2627 */
+	    "Berg\0" /* 1 refs @ 2636 */
+	    "Vortex\0" /* 3 refs @ 2641 */
+	    "Efficent\0" /* 1 refs @ 2648 */
+	    "Teledyne\0" /* 1 refs @ 2657 */
+	    "Tricord\0" /* 1 refs @ 2666 */
+	    "IDT\0" /* 1 refs @ 2674 */
+	    "Eldec\0" /* 1 refs @ 2678 */
+	    "Prescision\0" /* 1 refs @ 2684 */
+	    "Images\0" /* 2 refs @ 2695 */
+	    "Emc\0" /* 1 refs @ 2702 */
+	    "Zilog\0" /* 1 refs @ 2706 */
+	    "Multi-tech\0" /* 1 refs @ 2712 */
+	    "Leutron\0" /* 1 refs @ 2723 */
+	    "Eurocore/Vigra\0" /* 1 refs @ 2731 */
+	    "Vigra\0" /* 1 refs @ 2746 */
+	    "FORE\0" /* 1 refs @ 2752 */
+	    "Firmworks\0" /* 1 refs @ 2757 */
+	    "Hermes\0" /* 1 refs @ 2767 */
+	    "Linotype\0" /* 1 refs @ 2774 */
+	    "Ravicad\0" /* 1 refs @ 2783 */
+	    "Infomedia\0" /* 1 refs @ 2791 */
+	    "Imaging\0" /* 1 refs @ 2801 */
+	    "Technlogy\0" /* 1 refs @ 2809 */
+	    "Computervision\0" /* 1 refs @ 2819 */
+	    "Philips\0" /* 1 refs @ 2834 */
+	    "Mitel\0" /* 1 refs @ 2842 */
+	    "Eicon\0" /* 1 refs @ 2848 */
+	    "Mercury\0" /* 2 refs @ 2854 */
+	    "Fuji\0" /* 1 refs @ 2862 */
+	    "Momentum\0" /* 1 refs @ 2867 */
+	    "Cisco\0" /* 1 refs @ 2876 */
+	    "Ziatech\0" /* 1 refs @ 2882 */
+	    "Dynamic\0" /* 1 refs @ 2890 */
+	    "Pictures\0" /* 1 refs @ 2898 */
+	    "FWB\0" /* 1 refs @ 2907 */
+	    "Cyclone\0" /* 1 refs @ 2911 */
+	    "Leading\0" /* 1 refs @ 2919 */
+	    "Edge\0" /* 1 refs @ 2927 */
+	    "Sanyo\0" /* 1 refs @ 2932 */
+	    "Equinox\0" /* 1 refs @ 2938 */
+	    "Intervoice\0" /* 1 refs @ 2946 */
+	    "Crest\0" /* 1 refs @ 2957 */
+	    "Microsystem\0" /* 1 refs @ 2963 */
+	    "Alliance\0" /* 1 refs @ 2975 */
+	    "NetPower\0" /* 2 refs @ 2984 */
+	    "Cincinnati\0" /* 1 refs @ 2993 */
+	    "Milacron\0" /* 1 refs @ 3004 */
+	    "Workbit\0" /* 1 refs @ 3013 */
+	    "Force\0" /* 1 refs @ 3021 */
+	    "Interface\0" /* 84 refs @ 3027 */
+	    "Schneider\0" /* 1 refs @ 3037 */
+	    "Koch\0" /* 1 refs @ 3047 */
+	    "Win\0" /* 2 refs @ 3052 */
+	    "VMIC\0" /* 1 refs @ 3056 */
+	    "Canopus\0" /* 1 refs @ 3061 */
+	    "Annabooks\0" /* 1 refs @ 3069 */
+	    "IC\0" /* 2 refs @ 3079 */
+	    "Nikon\0" /* 1 refs @ 3082 */
+	    "Digi\0" /* 1 refs @ 3088 */
+	    "Thinking\0" /* 1 refs @ 3093 */
+	    "Machines\0" /* 2 refs @ 3102 */
+	    "JAE\0" /* 1 refs @ 3111 */
+	    "Megatek\0" /* 1 refs @ 3115 */
+	    "Land\0" /* 1 refs @ 3123 */
+	    "Melco\0" /* 1 refs @ 3128 */
+	    "Pine\0" /* 1 refs @ 3134 */
+	    "Periscope\0" /* 1 refs @ 3139 */
+	    "Avsys\0" /* 1 refs @ 3149 */
+	    "Voarx\0" /* 1 refs @ 3155 */
+	    "R\0" /* 1 refs @ 3161 */
+	    "D\0" /* 5 refs @ 3163 */
+	    "Mutech\0" /* 1 refs @ 3165 */
+	    "Harlequin\0" /* 1 refs @ 3172 */
+	    "Parallax\0" /* 1 refs @ 3182 */
+	    "Xircom\0" /* 1 refs @ 3191 */
+	    "Peer\0" /* 1 refs @ 3198 */
+	    "Protocols\0" /* 1 refs @ 3203 */
+	    "Maxtor\0" /* 1 refs @ 3213 */
+	    "Megasoft\0" /* 1 refs @ 3220 */
+	    "PFU\0" /* 1 refs @ 3229 */
+	    "Limited\0" /* 1 refs @ 3233 */
+	    "OA\0" /* 1 refs @ 3241 */
+	    "Laboratory\0" /* 1 refs @ 3244 */
+	    "Rendition\0" /* 1 refs @ 3255 */
+	    "Imagraph\0" /* 1 refs @ 3265 */
+	    "ServerWorks\0" /* 1 refs @ 3274 */
+	    "Mutoh\0" /* 1 refs @ 3286 */
+	    "Thine\0" /* 1 refs @ 3292 */
+	    "Centre\0" /* 1 refs @ 3298 */
+	    "for\0" /* 3 refs @ 3305 */
+	    "Dev.\0" /* 1 refs @ 3309 */
+	    "Computing\0" /* 2 refs @ 3314 */
+	    "Polaris\0" /* 1 refs @ 3324 */
+	    "Communications\0" /* 10 refs @ 3332 */
+	    "Connectware\0" /* 1 refs @ 3347 */
+	    "Workstation\0" /* 1 refs @ 3359 */
+	    "Inventec\0" /* 1 refs @ 3371 */
+	    "Loughborough\0" /* 1 refs @ 3380 */
+	    "Sound\0" /* 6 refs @ 3393 */
+	    "Altera\0" /* 1 refs @ 3399 */
+	    "Adobe\0" /* 1 refs @ 3406 */
+	    "Bridgeport\0" /* 1 refs @ 3412 */
+	    "Mitron\0" /* 1 refs @ 3423 */
+	    "SBE\0" /* 1 refs @ 3430 */
+	    "Alfa\0" /* 1 refs @ 3434 */
+	    "A-Trend\0" /* 1 refs @ 3439 */
+	    "Atto\0" /* 1 refs @ 3447 */
+	    "T/R\0" /* 1 refs @ 3452 */
+	    "Ricoh\0" /* 1 refs @ 3456 */
+	    "Telematics\0" /* 1 refs @ 3462 */
+	    "Fujikura\0" /* 1 refs @ 3473 */
+	    "Forks\0" /* 1 refs @ 3482 */
+	    "Dataworld\0" /* 1 refs @ 3488 */
+	    "D-Link\0" /* 1 refs @ 3498 */
+	    "Techonoloy\0" /* 1 refs @ 3505 */
+	    "Labratories\0" /* 1 refs @ 3516 */
+	    "Shima\0" /* 1 refs @ 3528 */
+	    "Seiki\0" /* 1 refs @ 3534 */
+	    "HiLevel\0" /* 1 refs @ 3540 */
+	    "Corrollary\0" /* 1 refs @ 3548 */
+	    "BitFlow\0" /* 1 refs @ 3559 */
+	    "Hermstedt\0" /* 1 refs @ 3567 */
+	    "Acard\0" /* 1 refs @ 3577 */
+	    "Densan\0" /* 1 refs @ 3583 */
+	    "Zeinet\0" /* 1 refs @ 3590 */
+	    "Toucan\0" /* 1 refs @ 3597 */
+	    "Ratoc\0" /* 1 refs @ 3604 */
+	    "Hytec\0" /* 1 refs @ 3610 */
+	    "Gage\0" /* 1 refs @ 3616 */
+	    "Sciences\0" /* 1 refs @ 3621 */
+	    "Lambda\0" /* 1 refs @ 3630 */
+	    "Associates\0" /* 1 refs @ 3637 */
+	    "Mind\0" /* 1 refs @ 3648 */
+	    "Share\0" /* 1 refs @ 3653 */
+	    "Omega\0" /* 1 refs @ 3659 */
+	    "Institute\0" /* 1 refs @ 3665 */
+	    "Bug\0" /* 1 refs @ 3675 */
+	    "Sapporo\0" /* 1 refs @ 3679 */
+	    "(3th\0" /* 1 refs @ 3687 */
+	    "Bull\0" /* 1 refs @ 3692 */
+	    "Hn\0" /* 1 refs @ 3697 */
+	    "Convex\0" /* 1 refs @ 3700 */
+	    "Hamamatsu\0" /* 1 refs @ 3707 */
+	    "Photonics\0" /* 1 refs @ 3717 */
+	    "Barco\0" /* 1 refs @ 3727 */
+	    "MicroUnity\0" /* 1 refs @ 3733 */
+	    "Pure\0" /* 1 refs @ 3744 */
+	    "Power\0" /* 17 refs @ 3749 */
+	    "InnoSys\0" /* 1 refs @ 3755 */
+	    "Actel\0" /* 1 refs @ 3763 */
+	    "Marvell\0" /* 2 refs @ 3769 */
+	    "Cannon\0" /* 1 refs @ 3777 */
+	    "IS\0" /* 1 refs @ 3784 */
+	    "Lite-On\0" /* 1 refs @ 3787 */
+	    "Scitex\0" /* 1 refs @ 3795 */
+	    "Avid\0" /* 1 refs @ 3802 */
+	    "V3\0" /* 1 refs @ 3807 */
+	    "Apricot\0" /* 1 refs @ 3810 */
+	    "Eastman\0" /* 1 refs @ 3818 */
+	    "Kodak\0" /* 1 refs @ 3826 */
+	    "Barr\0" /* 1 refs @ 3832 */
+	    "Leitch\0" /* 1 refs @ 3837 */
+	    "Radstone\0" /* 1 refs @ 3844 */
+	    "Xpoint\0" /* 1 refs @ 3853 */
+	    "Pathlight\0" /* 1 refs @ 3860 */
+	    "VideoTron\0" /* 1 refs @ 3870 */
+	    "Pyramid\0" /* 1 refs @ 3880 */
+	    "Network\0" /* 47 refs @ 3888 */
+	    "Pinnacle\0" /* 1 refs @ 3896 */
+	    "Microcircuts\0" /* 1 refs @ 3905 */
+	    "Lucent\0" /* 1 refs @ 3918 */
+	    "Document\0" /* 1 refs @ 3925 */
+	    "Shiva\0" /* 1 refs @ 3934 */
+	    "DCM\0" /* 1 refs @ 3940 */
+	    "Dolphin\0" /* 1 refs @ 3944 */
+	    "Interconnect\0" /* 1 refs @ 3952 */
+	    "Mesa\0" /* 1 refs @ 3965 */
+	    "Ridge\0" /* 1 refs @ 3970 */
+	    "(MAGMA)\0" /* 1 refs @ 3976 */
+	    "Specialix\0" /* 1 refs @ 3984 */
+	    "Michels\0" /* 1 refs @ 3994 */
+	    "Kleberhoff\0" /* 1 refs @ 4002 */
+	    "HAL\0" /* 1 refs @ 4013 */
+	    "Auravision\0" /* 1 refs @ 4017 */
+	    "Analog\0" /* 1 refs @ 4028 */
+	    "Devices\0" /* 1 refs @ 4035 */
+	    "SEGA\0" /* 1 refs @ 4043 */
+	    "Enterprises\0" /* 1 refs @ 4048 */
+	    "Zoran\0" /* 1 refs @ 4060 */
+	    "QuickLogic\0" /* 1 refs @ 4066 */
+	    "Compex\0" /* 1 refs @ 4077 */
+	    "PMC-Sierra\0" /* 1 refs @ 4084 */
+	    "Comtrol\0" /* 1 refs @ 4095 */
+	    "Cyclades\0" /* 1 refs @ 4103 */
+	    "Essential\0" /* 1 refs @ 4112 */
+	    "O2\0" /* 1 refs @ 4122 */
+	    "3Dfx\0" /* 1 refs @ 4125 */
+	    "Interactive\0" /* 1 refs @ 4130 */
+	    "Ariel\0" /* 1 refs @ 4142 */
+	    "Heurikon/Computer\0" /* 1 refs @ 4148 */
+	    "Aztech\0" /* 1 refs @ 4166 */
+	    "The\0" /* 1 refs @ 4173 */
+	    "3D0\0" /* 1 refs @ 4177 */
+	    "C-Cube\0" /* 1 refs @ 4181 */
+	    "JNI\0" /* 1 refs @ 4188 */
+	    "AVM\0" /* 1 refs @ 4192 */
+	    "vendor\0" /* 2 refs @ 4196 */
+	    "Stallion\0" /* 1 refs @ 4203 */
+	    "Linear\0" /* 1 refs @ 4212 */
+	    "Corega\0" /* 1 refs @ 4219 */
+	    "ASIX\0" /* 1 refs @ 4226 */
+	    "Aurora\0" /* 1 refs @ 4231 */
+	    "ESS\0" /* 2 refs @ 4238 */
+	    "Intersil\0" /* 1 refs @ 4242 */
+	    "Nortel\0" /* 1 refs @ 4251 */
+	    "(Northern\0" /* 1 refs @ 4258 */
+	    "Telecom)\0" /* 1 refs @ 4268 */
+	    "Motion\0" /* 1 refs @ 4277 */
+	    "Ensoniq\0" /* 1 refs @ 4284 */
+	    "Appliance\0" /* 1 refs @ 4292 */
+	    "Transmeta\0" /* 1 refs @ 4302 */
+	    "Rockwell\0" /* 1 refs @ 4312 */
+	    "Davicom\0" /* 1 refs @ 4321 */
+	    "Express\0" /* 111 refs @ 4329 */
+	    "TriTech\0" /* 1 refs @ 4337 */
+	    "Kofax\0" /* 1 refs @ 4345 */
+	    "Image\0" /* 2 refs @ 4351 */
+	    "Alteon\0" /* 1 refs @ 4357 */
+	    "RISCom\0" /* 1 refs @ 4364 */
+	    "US\0" /* 2 refs @ 4371 */
+	    "Robotics\0" /* 2 refs @ 4374 */
+	    "(3Com)\0" /* 1 refs @ 4383 */
+	    "Picture\0" /* 1 refs @ 4390 */
+	    "Elements\0" /* 1 refs @ 4398 */
+	    "Nvidia\0" /* 1 refs @ 4407 */
+	    "Pericom\0" /* 1 refs @ 4414 */
+	    "Rainbow\0" /* 1 refs @ 4422 */
+	    "Datum\0" /* 1 refs @ 4430 */
+	    "Inc.\0" /* 3 refs @ 4436 */
+	    "Bancomm-Timing\0" /* 1 refs @ 4441 */
+	    "Division\0" /* 1 refs @ 4456 */
+	    "Aureal\0" /* 1 refs @ 4465 */
+	    "Juniper\0" /* 1 refs @ 4472 */
+	    "ADMtek\0" /* 1 refs @ 4480 */
+	    "Packet\0" /* 4 refs @ 4487 */
+	    "Engines\0" /* 2 refs @ 4494 */
+	    "Forte\0" /* 1 refs @ 4502 */
+	    "Siig\0" /* 1 refs @ 4508 */
+	    "Memory\0" /* 45 refs @ 4513 */
+	    "Domex\0" /* 1 refs @ 4520 */
+	    "Quatech\0" /* 1 refs @ 4526 */
+	    "LAN\0" /* 85 refs @ 4534 */
+	    "Netgear\0" /* 1 refs @ 4538 */
+	    "Moxa\0" /* 1 refs @ 4546 */
+	    "Level\0" /* 1 refs @ 4551 */
+	    "One\0" /* 2 refs @ 4557 */
+	    "Cologne\0" /* 1 refs @ 4561 */
+	    "Chip\0" /* 6 refs @ 4569 */
+	    "Alacritech\0" /* 1 refs @ 4574 */
+	    "Hifn\0" /* 1 refs @ 4585 */
+	    "EXAR\0" /* 1 refs @ 4590 */
+	    "3ware\0" /* 1 refs @ 4595 */
+	    "AboCom\0" /* 1 refs @ 4601 */
+	    "Phobos\0" /* 1 refs @ 4608 */
+	    "NetBoost\0" /* 1 refs @ 4615 */
+	    "Sundance\0" /* 1 refs @ 4624 */
+	    "C-Media\0" /* 1 refs @ 4633 */
+	    "Advantech\0" /* 1 refs @ 4641 */
+	    "Lava\0" /* 1 refs @ 4651 */
+	    "SUNIX\0" /* 2 refs @ 4656 */
+	    "Ensemble\0" /* 1 refs @ 4662 */
+	    "Microsoft\0" /* 1 refs @ 4671 */
+	    "Oxford\0" /* 1 refs @ 4681 */
+	    "Chelsio\0" /* 1 refs @ 4688 */
+	    "Tamarack\0" /* 1 refs @ 4696 */
+	    "(3rd\0" /* 1 refs @ 4705 */
+	    "Askey\0" /* 1 refs @ 4710 */
+	    "Avermedia\0" /* 1 refs @ 4716 */
+	    "Base\0" /* 1 refs @ 4726 */
+	    "Aironet\0" /* 1 refs @ 4731 */
+	    "Wireless\0" /* 44 refs @ 4739 */
+	    "COMPAL\0" /* 1 refs @ 4748 */
+	    "Myricom\0" /* 1 refs @ 4755 */
+	    "Titan\0" /* 1 refs @ 4763 */
+	    "Avlab\0" /* 1 refs @ 4769 */
+	    "Invertex\0" /* 1 refs @ 4775 */
+	    "Broadcom\0" /* 2 refs @ 4784 */
+	    "Planex\0" /* 1 refs @ 4793 */
+	    "Conexant\0" /* 2 refs @ 4800 */
+	    "Delta\0" /* 1 refs @ 4809 */
+	    "ENE\0" /* 1 refs @ 4815 */
+	    "TerraTec\0" /* 1 refs @ 4819 */
+	    "Perle\0" /* 1 refs @ 4828 */
+	    "Solidum\0" /* 1 refs @ 4834 */
+	    "Syba\0" /* 1 refs @ 4842 */
+	    "Faraday\0" /* 1 refs @ 4847 */
+	    "Geocast\0" /* 1 refs @ 4855 */
+	    "Bluesteel\0" /* 1 refs @ 4863 */
+	    "VMware\0" /* 1 refs @ 4873 */
+	    "Agilent\0" /* 1 refs @ 4880 */
+	    "Eumitcom\0" /* 1 refs @ 4888 */
+	    "NetSec\0" /* 1 refs @ 4897 */
+	    "(SiByte)\0" /* 1 refs @ 4904 */
+	    "Myson-Century\0" /* 1 refs @ 4913 */
+	    "Mellanox\0" /* 1 refs @ 4927 */
+	    "Datacomm\0" /* 1 refs @ 4936 */
+	    "Action\0" /* 1 refs @ 4945 */
+	    "Tec\0" /* 1 refs @ 4952 */
+	    "Atheros\0" /* 1 refs @ 4956 */
+	    "Tech\0" /* 1 refs @ 4964 */
+	    "SafeNet\0" /* 2 refs @ 4969 */
+	    "Micrel\0" /* 1 refs @ 4977 */
+	    "Netoctave\0" /* 1 refs @ 4984 */
+	    "Linksys\0" /* 2 refs @ 4994 */
+	    "Altima\0" /* 1 refs @ 5002 */
+	    "Antares\0" /* 2 refs @ 5009 */
+	    "Cavium\0" /* 1 refs @ 5017 */
+	    "FZ\0" /* 1 refs @ 5024 */
+	    "Juelich\0" /* 1 refs @ 5027 */
+	    "ZEL\0" /* 1 refs @ 5035 */
+	    "Belkin\0" /* 2 refs @ 5039 */
+	    "Hawking\0" /* 1 refs @ 5046 */
+	    "Sandburst\0" /* 1 refs @ 5054 */
+	    "(NetChip)\0" /* 1 refs @ 5064 */
+	    "I4\0" /* 1 refs @ 5074 */
+	    "Areca\0" /* 1 refs @ 5077 */
+	    "S2io\0" /* 1 refs @ 5083 */
+	    "RDC\0" /* 1 refs @ 5088 */
+	    "Ralink\0" /* 1 refs @ 5092 */
+	    "Raza\0" /* 1 refs @ 5099 */
+	    "(Broadcom)\0" /* 2 refs @ 5104 */
+	    "Netlogic\0" /* 1 refs @ 5115 */
+	    "B\0" /* 17 refs @ 5124 */
+	    "XGI\0" /* 1 refs @ 5126 */
+	    "Renesas\0" /* 1 refs @ 5130 */
+	    "Freescale\0" /* 1 refs @ 5138 */
+	    "Attansic\0" /* 1 refs @ 5148 */
+	    "JMicron\0" /* 1 refs @ 5157 */
+	    "ASPEED\0" /* 2 refs @ 5165 */
+	    "EVE\0" /* 1 refs @ 5172 */
+	    "Qumranet\0" /* 1 refs @ 5176 */
+	    "ASMedia\0" /* 1 refs @ 5185 */
+	    "Red\0" /* 1 refs @ 5193 */
+	    "Hat\0" /* 1 refs @ 5197 */
+	    "Fresco\0" /* 1 refs @ 5201 */
+	    "Nanjing\0" /* 2 refs @ 5208 */
+	    "QinHeng\0" /* 2 refs @ 5216 */
+	    "(PCIe)\0" /* 2 refs @ 5224 */
+	    "Co\0" /* 1 refs @ 5231 */
+	    "HiNT\0" /* 1 refs @ 5234 */
+	    "3D\0" /* 19 refs @ 5239 */
+	    "Addtron\0" /* 1 refs @ 5242 */
+	    "(iCompression)\0" /* 1 refs @ 5250 */
+	    "Source\0" /* 1 refs @ 5265 */
+	    "NetVin\0" /* 1 refs @ 5272 */
+	    "Buslogic\0" /* 1 refs @ 5279 */
+	    "MediaQ\0" /* 1 refs @ 5288 */
+	    "Guillemot\0" /* 1 refs @ 5295 */
+	    "Turtle\0" /* 1 refs @ 5305 */
+	    "Beach\0" /* 1 refs @ 5312 */
+	    "S3\0" /* 2 refs @ 5318 */
+	    "XenSource,\0" /* 1 refs @ 5321 */
+	    "c't\0" /* 1 refs @ 5332 */
+	    "Magazin\0" /* 1 refs @ 5336 */
+	    "Decision\0" /* 1 refs @ 5344 */
+	    "Kurusugawa\0" /* 1 refs @ 5353 */
+	    "pcHDTV\0" /* 1 refs @ 5364 */
+	    "QUANCOM\0" /* 1 refs @ 5371 */
+	    "GmbH\0" /* 1 refs @ 5379 */
+	    "Intel\0" /* 1 refs @ 5384 */
+	    "VirtualBox\0" /* 1 refs @ 5390 */
+	    "ProLAN\0" /* 1 refs @ 5401 */
+	    "Computone\0" /* 1 refs @ 5408 */
+	    "KTI\0" /* 1 refs @ 5418 */
+	    "Adaptec\0" /* 2 refs @ 5422 */
+	    "Atronics\0" /* 1 refs @ 5430 */
+	    "Netmos\0" /* 1 refs @ 5439 */
+	    "Parallels\0" /* 1 refs @ 5446 */
+	    "Chrysalis-ITS\0" /* 1 refs @ 5456 */
+	    "Middle\0" /* 1 refs @ 5470 */
+	    "INVALID\0" /* 1 refs @ 5477 */
+	    "VENDOR\0" /* 1 refs @ 5485 */
+	    "ID\0" /* 1 refs @ 5492 */
+	    "3c985\0" /* 1 refs @ 5495 */
+	    "Gigabit\0" /* 119 refs @ 5501 */
+	    "Ethernet\0" /* 451 refs @ 5509 */
+	    "3c996\0" /* 1 refs @ 5518 */
+	    "10/100/1000\0" /* 48 refs @ 5524 */
+	    "3c556\0" /* 2 refs @ 5536 */
+	    "V.90\0" /* 1 refs @ 5542 */
+	    "Mini-PCI\0" /* 15 refs @ 5547 */
+	    "Modem\0" /* 31 refs @ 5556 */
+	    "3c940\0" /* 1 refs @ 5562 */
+	    "3c339\0" /* 1 refs @ 5568 */
+	    "TokenLink\0" /* 2 refs @ 5574 */
+	    "Velocity\0" /* 2 refs @ 5584 */
+	    "3c359\0" /* 1 refs @ 5593 */
+	    "XL\0" /* 7 refs @ 5599 */
+	    "3c450-TX\0" /* 1 refs @ 5602 */
+	    "10/100\0" /* 114 refs @ 5611 */
+	    "3c575-TX\0" /* 1 refs @ 5618 */
+	    "3CCFE575BT\0" /* 1 refs @ 5627 */
+	    "3CCFE575CT\0" /* 1 refs @ 5638 */
+	    "3c590\0" /* 1 refs @ 5649 */
+	    "3c595-TX\0" /* 1 refs @ 5655 */
+	    "3c595-T4\0" /* 1 refs @ 5664 */
+	    "3c595-MII\0" /* 1 refs @ 5673 */
+	    "3c555\0" /* 1 refs @ 5683 */
+	    "3CRWE154G72\0" /* 1 refs @ 5689 */
+	    "Adapter\0" /* 74 refs @ 5701 */
+	    "3c556B\0" /* 1 refs @ 5709 */
+	    "3CCFEM656\0" /* 2 refs @ 5716 */
+	    "56k\0" /* 5 refs @ 5726 */
+	    "3CCFEM656B\0" /* 2 refs @ 5730 */
+	    "3CXFEM656C\0" /* 2 refs @ 5741 */
+	    "3cSOHO100-TX\0" /* 1 refs @ 5752 */
+	    "3crwe777a\0" /* 1 refs @ 5765 */
+	    "AirConnect\0" /* 1 refs @ 5775 */
+	    "3c804\0" /* 1 refs @ 5786 */
+	    "FDDILink\0" /* 1 refs @ 5792 */
+	    "SAS\0" /* 18 refs @ 5801 */
+	    "Token\0" /* 8 refs @ 5805 */
+	    "Ring\0" /* 13 refs @ 5811 */
+	    "3c900-TPO\0" /* 1 refs @ 5816 */
+	    "3c900-COMBO\0" /* 1 refs @ 5826 */
+	    "3c905-TX\0" /* 1 refs @ 5838 */
+	    "3c905-T4\0" /* 1 refs @ 5847 */
+	    "3c900B-TPO\0" /* 1 refs @ 5856 */
+	    "3c900B-COMBO\0" /* 1 refs @ 5867 */
+	    "3c900B-TPC\0" /* 1 refs @ 5880 */
+	    "3c905B-TX\0" /* 1 refs @ 5891 */
+	    "3c905B-T4\0" /* 1 refs @ 5901 */
+	    "3c905B-COMBO\0" /* 1 refs @ 5911 */
+	    "3c905B-FX\0" /* 1 refs @ 5924 */
+	    "100\0" /* 8 refs @ 5934 */
+	    "3c905C-TX\0" /* 1 refs @ 5938 */
+	    "w/\0" /* 48 refs @ 5948 */
+	    "mngmt\0" /* 2 refs @ 5951 */
+	    "3c905CX-TX\0" /* 1 refs @ 5957 */
+	    "3c920B-EMB-WNM\0" /* 1 refs @ 5968 */
+	    "3c910\0" /* 1 refs @ 5983 */
+	    "OfficeConnect\0" /* 1 refs @ 5989 */
+	    "10/100B\0" /* 1 refs @ 6003 */
+	    "3c980\0" /* 1 refs @ 6011 */
+	    "Server\0" /* 3 refs @ 6017 */
+	    "3c980C-TXM\0" /* 1 refs @ 6024 */
+	    "3c990-TX\0" /* 1 refs @ 6035 */
+	    "3XP\0" /* 8 refs @ 6044 */
+	    "3CR990-TX-95\0" /* 1 refs @ 6048 */
+	    "3CR990-TX-97\0" /* 1 refs @ 6061 */
+	    "3c990B\0" /* 1 refs @ 6074 */
+	    "3CR990-FX\0" /* 1 refs @ 6081 */
+	    "3CR990-SVR-95\0" /* 1 refs @ 6091 */
+	    "3CR990-SVR-97\0" /* 1 refs @ 6105 */
+	    "3c990BSVR\0" /* 1 refs @ 6119 */
+	    "Voodoo\0" /* 2 refs @ 6129 */
+	    "Voodoo2\0" /* 1 refs @ 6136 */
+	    "Banshee\0" /* 1 refs @ 6144 */
+	    "Voodoo3\0" /* 1 refs @ 6152 */
+	    "4/5\0" /* 2 refs @ 6160 */
+	    "GLINT\0" /* 9 refs @ 6164 */
+	    "300SX\0" /* 1 refs @ 6170 */
+	    "500TX\0" /* 1 refs @ 6176 */
+	    "DELTA\0" /* 1 refs @ 6182 */
+	    "Permedia\0" /* 5 refs @ 6188 */
+	    "500MX\0" /* 1 refs @ 6197 */
+	    "2\0" /* 35 refs @ 6203 */
+	    "GAMMA\0" /* 1 refs @ 6205 */
+	    "2V\0" /* 1 refs @ 6211 */
+	    "3\0" /* 13 refs @ 6214 */
+	    "WILDCAT\0" /* 1 refs @ 6216 */
+	    "5110\0" /* 1 refs @ 6224 */
+	    "Escalade\0" /* 2 refs @ 6229 */
+	    "ATA\0" /* 51 refs @ 6238 */
+	    "RAID\0" /* 43 refs @ 6242 */
+	    "Controller\0" /* 912 refs @ 6247 */
+	    "7000/8000\0" /* 1 refs @ 6258 */
+	    "Series\0" /* 143 refs @ 6268 */
+	    "9000\0" /* 5 refs @ 6275 */
+	    "9550\0" /* 1 refs @ 6280 */
+	    "9650\0" /* 1 refs @ 6285 */
+	    "9690\0" /* 1 refs @ 6290 */
+	    "9750\0" /* 1 refs @ 6295 */
+	    "FE2500\0" /* 1 refs @ 6300 */
+	    "PCM200\0" /* 2 refs @ 6307 */
+	    "FE2000VX\0" /* 1 refs @ 6314 */
+	    "(OEM)\0" /* 1 refs @ 6323 */
+	    "FE2500MX\0" /* 1 refs @ 6329 */
+	    "ACCM\0" /* 1 refs @ 6338 */
+	    "2188\0" /* 1 refs @ 6343 */
+	    "VL-PCI\0" /* 3 refs @ 6348 */
+	    "Bridge\0" /* 634 refs @ 6355 */
+	    "2051\0" /* 2 refs @ 6362 */
+	    "Single\0" /* 7 refs @ 6367 */
+	    "Solution\0" /* 2 refs @ 6374 */
+	    "(host\0" /* 1 refs @ 6383 */
+	    "Bridge)\0" /* 2 refs @ 6389 */
+	    "(ISA\0" /* 1 refs @ 6397 */
+	    "ATP850U/UF\0" /* 1 refs @ 6402 */
+	    "UDMA\0" /* 6 refs @ 6413 */
+	    "IDE\0" /* 105 refs @ 6418 */
+	    "ATP860\0" /* 1 refs @ 6422 */
+	    "ATP860-A\0" /* 1 refs @ 6429 */
+	    "ATP865\0" /* 1 refs @ 6438 */
+	    "ATP865-A\0" /* 1 refs @ 6445 */
+	    "AEC6710\0" /* 1 refs @ 6454 */
+	    "SCSI\0" /* 26 refs @ 6462 */
+	    "AEC6712UW\0" /* 1 refs @ 6467 */
+	    "AEC6712U\0" /* 1 refs @ 6477 */
+	    "AEC6712S\0" /* 1 refs @ 6486 */
+	    "AEC6710D\0" /* 1 refs @ 6495 */
+	    "AEC6715UW\0" /* 1 refs @ 6504 */
+	    "MPX\0" /* 2 refs @ 6514 */
+	    "5030/5038\0" /* 1 refs @ 6518 */
+	    "EN2242\0" /* 1 refs @ 6528 */
+	    "M1435\0" /* 1 refs @ 6535 */
+	    "PCI-16[12]0\0" /* 1 refs @ 6541 */
+	    "serial\0" /* 13 refs @ 6553 */
+	    "PCI-1604\0" /* 1 refs @ 6560 */
+	    "PCI-1610\0" /* 1 refs @ 6569 */
+	    "4\0" /* 25 refs @ 6578 */
+	    "port\0" /* 15 refs @ 6580 */
+	    "PCI-1612\0" /* 1 refs @ 6585 */
+	    "PCI-1620\0" /* 2 refs @ 6594 */
+	    "8\0" /* 42 refs @ 6603 */
+	    "(1-4)\0" /* 1 refs @ 6605 */
+	    "(5-8)\0" /* 1 refs @ 6611 */
+	    "M1445\0" /* 1 refs @ 6617 */
+	    "M1449\0" /* 1 refs @ 6623 */
+	    "PCI-ISA\0" /* 49 refs @ 6629 */
+	    "M1451\0" /* 1 refs @ 6637 */
+	    "Host-PCI\0" /* 43 refs @ 6643 */
+	    "M1461\0" /* 1 refs @ 6652 */
+	    "M1531\0" /* 1 refs @ 6658 */
+	    "M1533\0" /* 1 refs @ 6664 */
+	    "M1541\0" /* 1 refs @ 6670 */
+	    "M1543\0" /* 1 refs @ 6676 */
+	    "M1563\0" /* 1 refs @ 6682 */
+	    "M1647\0" /* 1 refs @ 6688 */
+	    "M1689\0" /* 1 refs @ 6694 */
+	    "M3309\0" /* 1 refs @ 6700 */
+	    "MPEG\0" /* 3 refs @ 6706 */
+	    "Decoder\0" /* 9 refs @ 6711 */
+	    "M4803\0" /* 1 refs @ 6719 */
+	    "M5257\0" /* 1 refs @ 6725 */
+	    "M5229\0" /* 1 refs @ 6731 */
+	    "M5237\0" /* 1 refs @ 6737 */
+	    "USB\0" /* 193 refs @ 6743 */
+	    "1.1\0" /* 1 refs @ 6747 */
+	    "Host\0" /* 261 refs @ 6751 */
+	    "M5239\0" /* 1 refs @ 6756 */
+	    "2.0\0" /* 10 refs @ 6762 */
+	    "M5243\0" /* 1 refs @ 6766 */
+	    "PCI-AGP\0" /* 2 refs @ 6772 */
+	    "M5247\0" /* 1 refs @ 6780 */
+	    "M5249\0" /* 1 refs @ 6786 */
+	    "Hypertransport\0" /* 1 refs @ 6792 */
+	    "to\0" /* 28 refs @ 6807 */
+	    "M5261\0" /* 1 refs @ 6810 */
+	    "M5288\0" /* 1 refs @ 6816 */
+	    "SATA/Raid\0" /* 1 refs @ 6822 */
+	    "M5451\0" /* 1 refs @ 6832 */
+	    "AC-Link\0" /* 3 refs @ 6838 */
+	    "Audio\0" /* 102 refs @ 6846 */
+	    "M5453\0" /* 1 refs @ 6852 */
+	    "M5455\0" /* 1 refs @ 6858 */
+	    "M7101\0" /* 1 refs @ 6864 */
+	    "Management\0" /* 15 refs @ 6870 */
+	    "AIC-1160\0" /* 1 refs @ 6881 */
+	    "AIC-7850\0" /* 1 refs @ 6890 */
+	    "AIC-7855\0" /* 1 refs @ 6899 */
+	    "AIC-5900\0" /* 1 refs @ 6908 */
+	    "ATM\0" /* 13 refs @ 6917 */
+	    "AIC-5905\0" /* 1 refs @ 6921 */
+	    "AIC-6915\0" /* 1 refs @ 6930 */
+	    "AIC-7860\0" /* 1 refs @ 6939 */
+	    "APA-1480\0" /* 1 refs @ 6948 */
+	    "Ultra\0" /* 28 refs @ 6957 */
+	    "AHA-2940A\0" /* 1 refs @ 6963 */
+	    "AIC-7870\0" /* 1 refs @ 6973 */
+	    "AHA-2940\0" /* 3 refs @ 6982 */
+	    "AHA-3940\0" /* 2 refs @ 6991 */
+	    "AHA-3985\0" /* 1 refs @ 7000 */
+	    "AHA-2944\0" /* 2 refs @ 7009 */
+	    "AIC-7895\0" /* 1 refs @ 7018 */
+	    "AIC-7880\0" /* 1 refs @ 7027 */
+	    "AHA-389X\0" /* 1 refs @ 7036 */
+	    "Pro\0" /* 49 refs @ 7045 */
+	    "AHA-2940U2\0" /* 1 refs @ 7049 */
+	    "U2\0" /* 6 refs @ 7060 */
+	    "AHA-2930U2\0" /* 1 refs @ 7063 */
+	    "AIC-7890/1\0" /* 1 refs @ 7074 */
+	    "AHA-3950U2B\0" /* 1 refs @ 7085 */
+	    "AHA-3950U2D\0" /* 1 refs @ 7097 */
+	    "AIC-7896/7\0" /* 1 refs @ 7109 */
+	    "AIC-7892A\0" /* 1 refs @ 7120 */
+	    "U160\0" /* 8 refs @ 7130 */
+	    "AIC-7892B\0" /* 1 refs @ 7135 */
+	    "AIC-7892D\0" /* 1 refs @ 7145 */
+	    "AIC-7892P\0" /* 1 refs @ 7155 */
+	    "AIC-7899A\0" /* 1 refs @ 7165 */
+	    "AIC-7899B\0" /* 1 refs @ 7175 */
+	    "AIC-7899D\0" /* 1 refs @ 7185 */
+	    "AIC-7899F\0" /* 1 refs @ 7195 */
+	    "AIC-7899P\0" /* 1 refs @ 7205 */
+	    "1420SA\0" /* 1 refs @ 7215 */
+	    "1430SA\0" /* 1 refs @ 7222 */
+	    "AAC-2622\0" /* 1 refs @ 7229 */
+	    "ASR-2200S\0" /* 2 refs @ 7238 */
+	    "ASR-2120S\0" /* 1 refs @ 7248 */
+	    "ASR-2410SA\0" /* 1 refs @ 7258 */
+	    "AAR-2810SA\0" /* 1 refs @ 7269 */
+	    "3405\0" /* 1 refs @ 7280 */
+	    "3805\0" /* 1 refs @ 7285 */
+	    "2405\0" /* 1 refs @ 7290 */
+	    "AAC-364\0" /* 1 refs @ 7295 */
+	    "ASR-5400S\0" /* 1 refs @ 7303 */
+	    "PERC\0" /* 23 refs @ 7313 */
+	    "2/QC\0" /* 1 refs @ 7318 */
+	    "3/QC\0" /* 1 refs @ 7323 */
+	    "HP\0" /* 1 refs @ 7328 */
+	    "M110\0" /* 1 refs @ 7331 */
+	    "G2\0" /* 1 refs @ 7336 */
+	    "ASR-2610SA\0" /* 1 refs @ 7339 */
+	    "ServeRAID\0" /* 4 refs @ 7350 */
+	    "6/7\0" /* 1 refs @ 7360 */
+	    "(marco)\0" /* 1 refs @ 7364 */
+	    "8139\0" /* 3 refs @ 7372 */
+	    "Rhine\0" /* 2 refs @ 7377 */
+	    "II\0" /* 33 refs @ 7383 */
+	    "AL981\0" /* 1 refs @ 7386 */
+	    "(Comet)\0" /* 1 refs @ 7392 */
+	    "AN983\0" /* 1 refs @ 7400 */
+	    "(Centaur-P)\0" /* 1 refs @ 7406 */
+	    "AN985\0" /* 1 refs @ 7418 */
+	    "(Centaur-C)\0" /* 1 refs @ 7424 */
+	    "Infineon\0" /* 1 refs @ 7436 */
+	    "ADM5120\0" /* 1 refs @ 7445 */
+	    "ADM8211\0" /* 1 refs @ 7453 */
+	    "11Mbps\0" /* 1 refs @ 7461 */
+	    "802.11b\0" /* 10 refs @ 7468 */
+	    "WLAN\0" /* 5 refs @ 7476 */
+	    "ADM9511\0" /* 1 refs @ 7481 */
+	    "(Centaur-II)\0" /* 2 refs @ 7489 */
+	    "ADM9513\0" /* 1 refs @ 7502 */
+	    "ABP-930/40UA\0" /* 1 refs @ 7510 */
+	    "ABP-940UW\0" /* 1 refs @ 7523 */
+	    "ASB-3940U2W\0" /* 1 refs @ 7533 */
+	    "ASB-3940U3W\0" /* 1 refs @ 7545 */
+	    "Tachyon\0" /* 4 refs @ 7557 */
+	    "DX2\0" /* 1 refs @ 7565 */
+	    "FC\0" /* 5 refs @ 7569 */
+	    "PC4500/PC4800\0" /* 1 refs @ 7572 */
+	    "PCI350\0" /* 1 refs @ 7586 */
+	    "MPI350\0" /* 1 refs @ 7593 */
+	    "PC4500\0" /* 1 refs @ 7600 */
+	    "PC4800\0" /* 1 refs @ 7607 */
+	    "SES1001T\0" /* 1 refs @ 7614 */
+	    "iSCSI\0" /* 3 refs @ 7623 */
+	    "Accelerator\0" /* 18 refs @ 7629 */
+	    "AT24\0" /* 1 refs @ 7641 */
+	    "AT25\0" /* 1 refs @ 7646 */
+	    "ACEnic\0" /* 4 refs @ 7651 */
+	    "1000baseSX\0" /* 11 refs @ 7658 */
+	    "1000baseT\0" /* 47 refs @ 7669 */
+	    "BCM5700\0" /* 2 refs @ 7679 */
+	    "BCM5701\0" /* 3 refs @ 7687 */
+	    "EP4CGX15BF14C8N\0" /* 1 refs @ 7695 */
+	    "AC1000\0" /* 1 refs @ 7711 */
+	    "AC1001\0" /* 1 refs @ 7718 */
+	    "AC9100\0" /* 1 refs @ 7725 */
+	    "AC1003\0" /* 1 refs @ 7732 */
+	    "K8\0" /* 4 refs @ 7739 */
+	    "AMD64\0" /* 14 refs @ 7742 */
+	    "HyperTransport\0" /* 6 refs @ 7748 */
+	    "Configuration\0" /* 28 refs @ 7763 */
+	    "Address\0" /* 13 refs @ 7777 */
+	    "Map\0" /* 6 refs @ 7785 */
+	    "DRAM\0" /* 11 refs @ 7789 */
+	    "Miscellaneous\0" /* 5 refs @ 7794 */
+	    "Family10h\0" /* 5 refs @ 7808 */
+	    "Link\0" /* 21 refs @ 7818 */
+	    "Family11h\0" /* 5 refs @ 7823 */
+	    "Family14h\0" /* 1 refs @ 7833 */
+	    "Root\0" /* 68 refs @ 7843 */
+	    "Complex\0" /* 2 refs @ 7848 */
+	    "Family15h\0" /* 6 refs @ 7856 */
+	    "North\0" /* 11 refs @ 7866 */
+	    "Family12h/14h\0" /* 8 refs @ 7872 */
+	    "C-state\0" /* 1 refs @ 7886 */
+	    "Family12h\0" /* 2 refs @ 7894 */
+	    "GPP0\0" /* 1 refs @ 7904 */
+	    "Port\0" /* 192 refs @ 7909 */
+	    "Misc.\0" /* 1 refs @ 7914 */
+	    "PCnet-PCI\0" /* 1 refs @ 7920 */
+	    "PCnet-Home\0" /* 1 refs @ 7930 */
+	    "HomePNA\0" /* 4 refs @ 7941 */
+	    "Alchemy\0" /* 1 refs @ 7949 */
+	    "AM\0" /* 1 refs @ 7957 */
+	    "1771\0" /* 1 refs @ 7960 */
+	    "MBW\0" /* 1 refs @ 7965 */
+	    "PCscsi-PCI\0" /* 1 refs @ 7969 */
+	    "Geode\0" /* 3 refs @ 7980 */
+	    "LX\0" /* 6 refs @ 7986 */
+	    "VGA\0" /* 11 refs @ 7989 */
+	    "AES\0" /* 1 refs @ 7993 */
+	    "Security\0" /* 14 refs @ 7997 */
+	    "Block\0" /* 1 refs @ 8006 */
+	    "CS5536\0" /* 9 refs @ 8012 */
+	    "GeodeLink\0" /* 1 refs @ 8019 */
+	    "South\0" /* 8 refs @ 8029 */
+	    "Flash\0" /* 2 refs @ 8035 */
+	    "OHCI\0" /* 18 refs @ 8041 */
+	    "EHCI\0" /* 42 refs @ 8046 */
+	    "UDC\0" /* 1 refs @ 8051 */
+	    "UOC\0" /* 1 refs @ 8055 */
+	    "Elan\0" /* 1 refs @ 8059 */
+	    "SC520\0" /* 1 refs @ 8064 */
+	    "AMD751\0" /* 2 refs @ 8070 */
+	    "PCI-PCI\0" /* 76 refs @ 8077 */
+	    "IGR4\0" /* 2 refs @ 8085 */
+	    "AGP\0" /* 66 refs @ 8090 */
+	    "AMD762\0" /* 2 refs @ 8094 */
+	    "AMD761\0" /* 2 refs @ 8101 */
+	    "AMD755\0" /* 4 refs @ 8108 */
+	    "ACPI\0" /* 4 refs @ 8115 */
+	    "AMD756\0" /* 4 refs @ 8120 */
+	    "AMD766\0" /* 4 refs @ 8127 */
+	    "AMD768\0" /* 7 refs @ 8134 */
+	    "PCI-ISA/LPC\0" /* 1 refs @ 8141 */
+	    "EIDE\0" /* 2 refs @ 8153 */
+	    "AC97\0" /* 8 refs @ 8158 */
+	    "AMD8131\0" /* 2 refs @ 8163 */
+	    "PCI-X\0" /* 12 refs @ 8171 */
+	    "Tunnel\0" /* 1 refs @ 8177 */
+	    "IO\0" /* 16 refs @ 8184 */
+	    "Apic\0" /* 1 refs @ 8187 */
+	    "AMD8151\0" /* 2 refs @ 8192 */
+	    "AMD8123\0" /* 1 refs @ 8200 */
+	    "AMD8132\0" /* 1 refs @ 8208 */
+	    "IOAPIC\0" /* 3 refs @ 8216 */
+	    "AMD8111\0" /* 11 refs @ 8223 */
+	    "I/O\0" /* 51 refs @ 8231 */
+	    "Hub\0" /* 13 refs @ 8235 */
+	    "7461\0" /* 1 refs @ 8239 */
+	    "LPC\0" /* 120 refs @ 8244 */
+	    "SMBus\0" /* 61 refs @ 8248 */
+	    "MC97\0" /* 1 refs @ 8254 */
+	    "756b\0" /* 1 refs @ 8259 */
+	    "Hudson\0" /* 12 refs @ 8264 */
+	    "SATA\0" /* 164 refs @ 8271 */
+	    "AHCI\0" /* 76 refs @ 8276 */
+	    "SD\0" /* 5 refs @ 8281 */
+	    "HD\0" /* 48 refs @ 8284 */
+	    "xHCI\0" /* 8 refs @ 8287 */
+	    "RS780\0" /* 7 refs @ 8292 */
+	    "RS785/RS880\0" /* 1 refs @ 8298 */
+	    "RS780/RS880\0" /* 5 refs @ 8310 */
+	    "(int\0" /* 2 refs @ 8322 */
+	    "gfx)\0" /* 2 refs @ 8327 */
+	    "(ext\0" /* 2 refs @ 8332 */
+	    "gfx\0" /* 2 refs @ 8337 */
+	    "0)\0" /* 3 refs @ 8341 */
+	    "PCI-PCIE\0" /* 8 refs @ 8344 */
+	    "(port\0" /* 6 refs @ 8353 */
+	    "1)\0" /* 3 refs @ 8359 */
+	    "2)\0" /* 2 refs @ 8362 */
+	    "3)\0" /* 2 refs @ 8365 */
+	    "4)\0" /* 1 refs @ 8368 */
+	    "5)\0" /* 1 refs @ 8371 */
+	    "(NB-SB\0" /* 3 refs @ 8374 */
+	    "link)\0" /* 1 refs @ 8381 */
+	    "MegaRAID\0" /* 10 refs @ 8387 */
+	    "AD1889\0" /* 1 refs @ 8396 */
+	    "SoundMAX\0" /* 1 refs @ 8403 */
+	    "Crypto\0" /* 2 refs @ 8412 */
+	    "ADSP-2141\0" /* 1 refs @ 8419 */
+	    "Bandit\0" /* 2 refs @ 8429 */
+	    "Grand\0" /* 1 refs @ 8436 */
+	    "Central\0" /* 1 refs @ 8442 */
+	    "Control\0" /* 13 refs @ 8450 */
+	    "PlanB\0" /* 1 refs @ 8458 */
+	    "OHare\0" /* 1 refs @ 8464 */
+	    "Heathrow\0" /* 1 refs @ 8470 */
+	    "Paddington\0" /* 1 refs @ 8479 */
+	    "PowerBook\0" /* 1 refs @ 8490 */
+	    "G3\0" /* 1 refs @ 8500 */
+	    "Firewire\0" /* 9 refs @ 8503 */
+	    "KeyLargo\0" /* 2 refs @ 8512 */
+	    "UniNorth\0" /* 11 refs @ 8521 */
+	    "GMAC\0" /* 6 refs @ 8530 */
+	    "Pangea\0" /* 6 refs @ 8535 */
+	    "ATA/100\0" /* 1 refs @ 8542 */
+	    "Kauai\0" /* 1 refs @ 8550 */
+	    "Intrepid\0" /* 8 refs @ 8556 */
+	    "K2\0" /* 5 refs @ 8565 */
+	    "MAC-IO\0" /* 1 refs @ 8568 */
+	    "UATA\0" /* 1 refs @ 8575 */
+	    "U3\0" /* 6 refs @ 8580 */
+	    "Shasta\0" /* 8 refs @ 8583 */
+	    "FireWire\0" /* 2 refs @ 8590 */
+	    "1000PV\0" /* 1 refs @ 8599 */
+	    "2000PV\0" /* 1 refs @ 8606 */
+	    "2000MT\0" /* 1 refs @ 8613 */
+	    "ARC-1110\0" /* 1 refs @ 8620 */
+	    "ARC-1120\0" /* 1 refs @ 8629 */
+	    "ARC-1130\0" /* 1 refs @ 8638 */
+	    "ARC-1160\0" /* 1 refs @ 8647 */
+	    "ARC-1170\0" /* 1 refs @ 8656 */
+	    "ARC-1200\0" /* 2 refs @ 8665 */
+	    "rev\0" /* 6 refs @ 8674 */
+	    "ARC-1202\0" /* 1 refs @ 8678 */
+	    "ARC-1210\0" /* 1 refs @ 8687 */
+	    "ARC-1220\0" /* 1 refs @ 8696 */
+	    "ARC-1230\0" /* 1 refs @ 8705 */
+	    "ARC-1260\0" /* 1 refs @ 8714 */
+	    "ARC-1270\0" /* 1 refs @ 8723 */
+	    "ARC-1280\0" /* 1 refs @ 8732 */
+	    "ARC-1380\0" /* 1 refs @ 8741 */
+	    "ARC-1381\0" /* 1 refs @ 8750 */
+	    "ARC-1680\0" /* 1 refs @ 8759 */
+	    "ARC-1681\0" /* 1 refs @ 8768 */
+	    "AX88140A\0" /* 1 refs @ 8777 */
+	    "ASM1061\0" /* 4 refs @ 8786 */
+	    "III\0" /* 10 refs @ 8794 */
+	    "ASM1042\0" /* 1 refs @ 8798 */
+	    "3.0\0" /* 5 refs @ 8806 */
+	    "ASM1042A\0" /* 1 refs @ 8810 */
+	    "ISDN\0" /* 8 refs @ 8819 */
+	    "L1E\0" /* 1 refs @ 8824 */
+	    "L1\0" /* 1 refs @ 8828 */
+	    "AR8132\0" /* 1 refs @ 8831 */
+	    "AR8131\0" /* 1 refs @ 8838 */
+	    "AR8151\0" /* 2 refs @ 8845 */
+	    "v1.0\0" /* 1 refs @ 8852 */
+	    "v2.0\0" /* 4 refs @ 8857 */
+	    "AR8162\0" /* 1 refs @ 8862 */
+	    "AR8161\0" /* 1 refs @ 8869 */
+	    "AR8172\0" /* 1 refs @ 8876 */
+	    "AR8171\0" /* 1 refs @ 8883 */
+	    "L2\0" /* 1 refs @ 8890 */
+	    "Mbit\0" /* 2 refs @ 8893 */
+	    "AR8152\0" /* 2 refs @ 8898 */
+	    "v1.1\0" /* 1 refs @ 8905 */
+	    "E2200\0" /* 1 refs @ 8910 */
+	    "Wrestler\0" /* 1 refs @ 8916 */
+	    "HDMI\0" /* 3 refs @ 8925 */
+	    "BeaverCreek\0" /* 1 refs @ 8930 */
+	    "Radeon\0" /* 133 refs @ 8942 */
+	    "Mobility\0" /* 35 refs @ 8949 */
+	    "X600\0" /* 3 refs @ 8958 */
+	    "(M24)\0" /* 1 refs @ 8963 */
+	    "3150\0" /* 1 refs @ 8969 */
+	    "FireGL\0" /* 20 refs @ 8974 */
+	    "M24\0" /* 1 refs @ 8981 */
+	    "GL\0" /* 4 refs @ 8985 */
+	    "3154\0" /* 1 refs @ 8988 */
+	    "(RV380)\0" /* 2 refs @ 8993 */
+	    "3E50\0" /* 1 refs @ 9001 */
+	    "V3200\0" /* 1 refs @ 9006 */
+	    "3E54\0" /* 1 refs @ 9012 */
+	    "IGP320\0" /* 1 refs @ 9017 */
+	    "(A3)\0" /* 1 refs @ 9024 */
+	    "4136\0" /* 1 refs @ 9029 */
+	    "IGP330/340/350\0" /* 1 refs @ 9034 */
+	    "(A4)\0" /* 2 refs @ 9049 */
+	    "4137\0" /* 1 refs @ 9054 */
+	    "9500\0" /* 3 refs @ 9059 */
+	    "AD\0" /* 1 refs @ 9064 */
+	    "AE\0" /* 1 refs @ 9067 */
+	    "9600TX\0" /* 2 refs @ 9070 */
+	    "AF\0" /* 3 refs @ 9077 */
+	    "Z1\0" /* 1 refs @ 9080 */
+	    "9800SE\0" /* 1 refs @ 9083 */
+	    "AH\0" /* 1 refs @ 9090 */
+	    "9800\0" /* 6 refs @ 9093 */
+	    "AI\0" /* 1 refs @ 9098 */
+	    "AJ\0" /* 1 refs @ 9101 */
+	    "X2\0" /* 2 refs @ 9104 */
+	    "AK\0" /* 1 refs @ 9107 */
+	    "9600\0" /* 8 refs @ 9110 */
+	    "AP\0" /* 1 refs @ 9115 */
+	    "9600SE\0" /* 1 refs @ 9118 */
+	    "AQ\0" /* 1 refs @ 9125 */
+	    "9600XT\0" /* 1 refs @ 9128 */
+	    "AR\0" /* 1 refs @ 9135 */
+	    "AS\0" /* 1 refs @ 9138 */
+	    "T2\0" /* 2 refs @ 9141 */
+	    "AT\0" /* 2 refs @ 9144 */
+	    "RV360\0" /* 1 refs @ 9147 */
+	    "AV\0" /* 1 refs @ 9153 */
+	    "Mach32\0" /* 1 refs @ 9156 */
+	    "LE\0" /* 5 refs @ 9163 */
+	    "Secondary\0" /* 19 refs @ 9166 */
+	    "XT\0" /* 7 refs @ 9176 */
+	    "7000\0" /* 2 refs @ 9179 */
+	    "IGP\0" /* 8 refs @ 9184 */
+	    "(A4+)\0" /* 1 refs @ 9188 */
+	    "8500\0" /* 5 refs @ 9194 */
+	    "AIW\0" /* 2 refs @ 9199 */
+	    "BB\0" /* 1 refs @ 9203 */
+	    "BC\0" /* 1 refs @ 9206 */
+	    "IGP320M\0" /* 1 refs @ 9209 */
+	    "(U1)\0" /* 1 refs @ 9217 */
+	    "4336\0" /* 1 refs @ 9222 */
+	    "IGP330M/340M/350M\0" /* 1 refs @ 9227 */
+	    "(U2)\0" /* 1 refs @ 9245 */
+	    "4337\0" /* 1 refs @ 9250 */
+	    "IXP\0" /* 7 refs @ 9255 */
+	    "AC'97\0" /* 14 refs @ 9259 */
+	    "SB200\0" /* 8 refs @ 9265 */
+	    "USB2\0" /* 9 refs @ 9271 */
+	    "SB300\0" /* 2 refs @ 9276 */
+	    "IXP300\0" /* 1 refs @ 9282 */
+	    "SB400\0" /* 10 refs @ 9289 */
+	    "SB600\0" /* 12 refs @ 9295 */
+	    "SBx00\0" /* 3 refs @ 9301 */
+	    "Azalia\0" /* 1 refs @ 9307 */
+	    "OHCI0\0" /* 1 refs @ 9314 */
+	    "OHCI1\0" /* 1 refs @ 9320 */
+	    "OHCI2\0" /* 1 refs @ 9326 */
+	    "OHCI3\0" /* 1 refs @ 9332 */
+	    "OHCI4\0" /* 1 refs @ 9338 */
+	    "SB700-SB900\0" /* 14 refs @ 9344 */
+	    "(IDE\0" /* 6 refs @ 9356 */
+	    "mode)\0" /* 12 refs @ 9361 */
+	    "(AHCI\0" /* 4 refs @ 9367 */
+	    "RAID5\0" /* 1 refs @ 9373 */
+	    "SB800/SB900\0" /* 1 refs @ 9379 */
+	    "bridge\0" /* 11 refs @ 9391 */
+	    "(PCIe\0" /* 5 refs @ 9398 */
+	    "SB900\0" /* 2 refs @ 9404 */
+	    "Mach64\0" /* 6 refs @ 9410 */
+	    "CT\0" /* 1 refs @ 9417 */
+	    "CX\0" /* 1 refs @ 9420 */
+	    "Rage\0" /* 66 refs @ 9423 */
+	    "(AGP)\0" /* 6 refs @ 9428 */
+	    "(AGP\0" /* 5 refs @ 9434 */
+	    "1x)\0" /* 1 refs @ 9439 */
+	    "Turbo\0" /* 1 refs @ 9443 */
+	    "XC\0" /* 3 refs @ 9449 */
+	    "(PCI66)\0" /* 2 refs @ 9452 */
+	    "(limited\0" /* 1 refs @ 9460 */
+	    "3D)\0" /* 1 refs @ 9469 */
+	    "I/II\0" /* 1 refs @ 9473 */
+	    "II+\0" /* 1 refs @ 9478 */
+	    "IIC\0" /* 4 refs @ 9482 */
+	    "GX\0" /* 2 refs @ 9486 */
+	    "9000/PRO\0" /* 1 refs @ 9489 */
+	    "If\0" /* 1 refs @ 9498 */
+	    "Ig\0" /* 1 refs @ 9501 */
+	    "X800\0" /* 6 refs @ 9504 */
+	    "(R420)\0" /* 7 refs @ 9509 */
+	    "JH\0" /* 1 refs @ 9516 */
+	    "X800PRO\0" /* 2 refs @ 9519 */
+	    "JI\0" /* 1 refs @ 9527 */
+	    "X800SE\0" /* 2 refs @ 9530 */
+	    "JJ\0" /* 1 refs @ 9537 */
+	    "JK\0" /* 1 refs @ 9540 */
+	    "JL\0" /* 1 refs @ 9543 */
+	    "X3\0" /* 1 refs @ 9546 */
+	    "JM\0" /* 1 refs @ 9549 */
+	    "(M18)\0" /* 1 refs @ 9552 */
+	    "JN\0" /* 1 refs @ 9558 */
+	    "X800XT\0" /* 2 refs @ 9561 */
+	    "JP\0" /* 1 refs @ 9568 */
+	    "LT\0" /* 6 refs @ 9571 */
+	    "133MHz)\0" /* 1 refs @ 9574 */
+	    "66MHz)\0" /* 1 refs @ 9582 */
+	    "M3\0" /* 2 refs @ 9589 */
+	    "L\0" /* 2 refs @ 9592 */
+	    "M1\0" /* 1 refs @ 9594 */
+	    "(PCI)\0" /* 2 refs @ 9597 */
+	    "M7\0" /* 2 refs @ 9603 */
+	    "LW\0" /* 1 refs @ 9606 */
+	    "7800\0" /* 1 refs @ 9609 */
+	    "M6\0" /* 2 refs @ 9614 */
+	    "LY\0" /* 1 refs @ 9617 */
+	    "LZ\0" /* 1 refs @ 9620 */
+	    "(M9)\0" /* 3 refs @ 9623 */
+	    "Ld\0" /* 1 refs @ 9628 */
+	    "Lf\0" /* 1 refs @ 9631 */
+	    "Lg\0" /* 1 refs @ 9634 */
+	    "128\0" /* 39 refs @ 9637 */
+	    "4x\0" /* 19 refs @ 9641 */
+	    "2x\0" /* 13 refs @ 9644 */
+	    "9700\0" /* 2 refs @ 9647 */
+	    "ND\0" /* 1 refs @ 9652 */
+	    "9700/9500Pro\0" /* 1 refs @ 9655 */
+	    "NE\0" /* 1 refs @ 9668 */
+	    "NF\0" /* 1 refs @ 9671 */
+	    "X1\0" /* 1 refs @ 9674 */
+	    "NG\0" /* 1 refs @ 9677 */
+	    "9800PRO\0" /* 1 refs @ 9680 */
+	    "NH\0" /* 1 refs @ 9688 */
+	    "NI\0" /* 1 refs @ 9691 */
+	    "9800XT\0" /* 1 refs @ 9694 */
+	    "NJ\0" /* 1 refs @ 9701 */
+	    "NK\0" /* 1 refs @ 9704 */
+	    "9600/9700\0" /* 1 refs @ 9707 */
+	    "(M10/11)\0" /* 1 refs @ 9717 */
+	    "NP\0" /* 1 refs @ 9726 */
+	    "(M10)\0" /* 3 refs @ 9729 */
+	    "NQ\0" /* 1 refs @ 9735 */
+	    "(M11)\0" /* 2 refs @ 9738 */
+	    "NR\0" /* 1 refs @ 9744 */
+	    "NS\0" /* 1 refs @ 9747 */
+	    "NT\0" /* 1 refs @ 9750 */
+	    "T2e\0" /* 1 refs @ 9753 */
+	    "NV\0" /* 1 refs @ 9757 */
+	    "9700/9500\0" /* 2 refs @ 9760 */
+	    "(TMDS)\0" /* 12 refs @ 9770 */
+	    "Fury\0" /* 1 refs @ 9777 */
+	    "MAXX\0" /* 1 refs @ 9782 */
+	    "QD\0" /* 1 refs @ 9787 */
+	    "QE\0" /* 1 refs @ 9790 */
+	    "QF\0" /* 1 refs @ 9793 */
+	    "QG\0" /* 1 refs @ 9796 */
+	    "8700/8800\0" /* 1 refs @ 9799 */
+	    "QH\0" /* 1 refs @ 9809 */
+	    "QL\0" /* 1 refs @ 9812 */
+	    "9100\0" /* 5 refs @ 9815 */
+	    "QM\0" /* 1 refs @ 9820 */
+	    "7500\0" /* 2 refs @ 9823 */
+	    "QW\0" /* 1 refs @ 9828 */
+	    "QX\0" /* 1 refs @ 9831 */
+	    "7000/VE\0" /* 2 refs @ 9834 */
+	    "QY\0" /* 1 refs @ 9842 */
+	    "QZ\0" /* 1 refs @ 9845 */
+	    "ES1000\0" /* 1 refs @ 9848 */
+	    "VR\0" /* 2 refs @ 9855 */
+	    "TF\0" /* 1 refs @ 9858 */
+	    "M300\0" /* 1 refs @ 9861 */
+	    "(M22)\0" /* 1 refs @ 9866 */
+	    "5460\0" /* 1 refs @ 9872 */
+	    "M22\0" /* 1 refs @ 9877 */
+	    "5464\0" /* 1 refs @ 9881 */
+	    "(R423)\0" /* 8 refs @ 9886 */
+	    "UH\0" /* 1 refs @ 9893 */
+	    "UI\0" /* 1 refs @ 9896 */
+	    "X800LE\0" /* 1 refs @ 9899 */
+	    "UJ\0" /* 1 refs @ 9906 */
+	    "UK\0" /* 1 refs @ 9909 */
+	    "GTO\0" /* 2 refs @ 9912 */
+	    "(R430)\0" /* 2 refs @ 9916 */
+	    "554F\0" /* 1 refs @ 9923 */
+	    "V7200\0" /* 1 refs @ 9928 */
+	    "UQ\0" /* 1 refs @ 9934 */
+	    "V5100\0" /* 1 refs @ 9937 */
+	    "UR\0" /* 1 refs @ 9943 */
+	    "V7100\0" /* 1 refs @ 9946 */
+	    "UT\0" /* 1 refs @ 9952 */
+	    "VT\0" /* 1 refs @ 9955 */
+	    "VTB\0" /* 1 refs @ 9958 */
+	    "VT4\0" /* 1 refs @ 9962 */
+	    "RS300\0" /* 2 refs @ 9966 */
+	    "(U3)\0" /* 1 refs @ 9972 */
+	    "9200\0" /* 8 refs @ 9977 */
+	    "RS480\0" /* 6 refs @ 9982 */
+	    "RD580\0" /* 1 refs @ 9988 */
+	    "CrossFire\0" /* 1 refs @ 9994 */
+	    "Xpress\0" /* 4 refs @ 10004 */
+	    "3200\0" /* 2 refs @ 10011 */
+	    "200G\0" /* 1 refs @ 10016 */
+	    "RD790\0" /* 12 refs @ 10021 */
+	    "(Dual\0" /* 1 refs @ 10027 */
+	    "Slot)\0" /* 1 refs @ 10033 */
+	    "RX780/RX790\0" /* 1 refs @ 10039 */
+	    "Chipset\0" /* 18 refs @ 10051 */
+	    "9200PRO\0" /* 1 refs @ 10059 */
+	    "5960\0" /* 1 refs @ 10067 */
+	    "5961\0" /* 1 refs @ 10072 */
+	    "5962\0" /* 1 refs @ 10077 */
+	    "5963\0" /* 1 refs @ 10082 */
+	    "9200SE\0" /* 2 refs @ 10087 */
+	    "5964\0" /* 1 refs @ 10094 */
+	    "(RS482M)\0" /* 1 refs @ 10099 */
+	    "GFX0\0" /* 4 refs @ 10108 */
+	    "A\0" /* 15 refs @ 10113 */
+	    "GPP\0" /* 18 refs @ 10115 */
+	    "C\0" /* 6 refs @ 10119 */
+	    "E\0" /* 2 refs @ 10121 */
+	    "F\0" /* 2 refs @ 10123 */
+	    "GFX1\0" /* 4 refs @ 10125 */
+	    "Link)\0" /* 2 refs @ 10130 */
+	    "RD890\0" /* 17 refs @ 10136 */
+	    "Dual\0" /* 48 refs @ 10142 */
+	    "Slot\0" /* 3 refs @ 10147 */
+	    "2x16\0" /* 1 refs @ 10152 */
+	    "GFX\0" /* 5 refs @ 10157 */
+	    "2x8\0" /* 1 refs @ 10161 */
+	    "G\0" /* 1 refs @ 10165 */
+	    "H\0" /* 1 refs @ 10167 */
+	    "IOMMU\0" /* 1 refs @ 10169 */
+	    "200\0" /* 3 refs @ 10175 */
+	    "X300\0" /* 2 refs @ 10179 */
+	    "(RV370)\0" /* 3 refs @ 10184 */
+	    "5B60\0" /* 1 refs @ 10192 */
+	    "Sapphire\0" /* 1 refs @ 10197 */
+	    "X550\0" /* 1 refs @ 10206 */
+	    "Silent\0" /* 1 refs @ 10211 */
+	    "V3100\0" /* 1 refs @ 10218 */
+	    "5B64\0" /* 1 refs @ 10224 */
+	    "D1100\0" /* 1 refs @ 10229 */
+	    "5B65\0" /* 1 refs @ 10235 */
+	    "RV370\0" /* 1 refs @ 10240 */
+	    "(M9+)\0" /* 2 refs @ 10246 */
+	    "X850\0" /* 2 refs @ 10252 */
+	    "5D57\0" /* 1 refs @ 10257 */
+	    "X700\0" /* 2 refs @ 10262 */
+	    "5870\0" /* 1 refs @ 10267 */
+	    "Cypress\0" /* 1 refs @ 10272 */
+	    "5600\0" /* 4 refs @ 10280 */
+	    "Redwood\0" /* 2 refs @ 10285 */
+	    "5450\0" /* 1 refs @ 10293 */
+	    "X1300\0" /* 2 refs @ 10298 */
+	    "(RV515)\0" /* 2 refs @ 10304 */
+	    "X1600\0" /* 3 refs @ 10312 */
+	    "X1950\0" /* 2 refs @ 10318 */
+	    "PRO\0" /* 3 refs @ 10324 */
+	    "RS690\0" /* 7 refs @ 10328 */
+	    "RS740\0" /* 1 refs @ 10334 */
+	    "HD4850\0" /* 1 refs @ 10340 */
+	    "HD4650\0" /* 1 refs @ 10347 */
+	    "HD2400\0" /* 2 refs @ 10354 */
+	    "2400\0" /* 1 refs @ 10361 */
+	    "HD3870\0" /* 1 refs @ 10366 */
+	    "HD4350\0" /* 2 refs @ 10373 */
+	    "4500\0" /* 1 refs @ 10380 */
+	    "2600\0" /* 2 refs @ 10385 */
+	    "HD2600\0" /* 3 refs @ 10390 */
+	    "GDDR3\0" /* 1 refs @ 10397 */
+	    "3650\0" /* 1 refs @ 10403 */
+	    "HD3650\0" /* 2 refs @ 10408 */
+	    "3400\0" /* 40 refs @ 10415 */
+	    "(M82)\0" /* 1 refs @ 10420 */
+	    "HD4250\0" /* 2 refs @ 10426 */
+	    "GPU\0" /* 4 refs @ 10433 */
+	    "(RV610)\0" /* 1 refs @ 10437 */
+	    "HD6520G\0" /* 1 refs @ 10445 */
+	    "HD4200\0" /* 1 refs @ 10453 */
+	    "(RS880)\0" /* 1 refs @ 10460 */
+	    "HD6310\0" /* 1 refs @ 10468 */
+	    "HD6320\0" /* 1 refs @ 10475 */
+	    "HD7340\0" /* 1 refs @ 10482 */
+	    "54xx\0" /* 1 refs @ 10489 */
+	    "VxP524\0" /* 1 refs @ 10494 */
+	    "Processor\0" /* 32 refs @ 10501 */
+	    "AU8820\0" /* 1 refs @ 10511 */
+	    "AU8830\0" /* 1 refs @ 10518 */
+	    "S5933\0" /* 1 refs @ 10525 */
+	    "Matchmaker\0" /* 1 refs @ 10531 */
+	    "Myrinet\0" /* 2 refs @ 10542 */
+	    "LANai\0" /* 1 refs @ 10550 */
+	    "FZJ/ZEL\0" /* 3 refs @ 10556 */
+	    "CAMAC\0" /* 2 refs @ 10564 */
+	    "VICBUS\0" /* 1 refs @ 10570 */
+	    "Synchronisation\0" /* 1 refs @ 10577 */
+	    "Module\0" /* 4 refs @ 10593 */
+	    "ADDI-DATA\0" /* 1 refs @ 10600 */
+	    "APCI-7800\0" /* 1 refs @ 10610 */
+	    "8-port\0" /* 5 refs @ 10620 */
+	    "Serial\0" /* 115 refs @ 10627 */
+	    "S5920\0" /* 1 refs @ 10634 */
+	    "Target\0" /* 7 refs @ 10640 */
+	    "AST1150\0" /* 1 refs @ 10647 */
+	    "PCIe-to-PCI\0" /* 3 refs @ 10655 */
+	    "AST1180\0" /* 1 refs @ 10667 */
+	    "Family\0" /* 2 refs @ 10675 */
+	    "AR5201\0" /* 3 refs @ 10682 */
+	    "AR5211\0" /* 5 refs @ 10689 */
+	    "AR5212\0" /* 9 refs @ 10696 */
+	    "AR2413\0" /* 1 refs @ 10703 */
+	    "AR5413\0" /* 1 refs @ 10710 */
+	    "AR5424\0" /* 1 refs @ 10717 */
+	    "AR5416\0" /* 1 refs @ 10724 */
+	    "AR5418\0" /* 1 refs @ 10731 */
+	    "AR9160\0" /* 1 refs @ 10738 */
+	    "AR9280\0" /* 1 refs @ 10745 */
+	    "AR9281\0" /* 1 refs @ 10752 */
+	    "AR9285\0" /* 1 refs @ 10759 */
+	    "AR2427\0" /* 1 refs @ 10766 */
+	    "AR9227\0" /* 1 refs @ 10773 */
+	    "AR9287\0" /* 1 refs @ 10780 */
+	    "AR9300\0" /* 1 refs @ 10787 */
+	    "AR9485\0" /* 1 refs @ 10794 */
+	    "AR9462\0" /* 1 refs @ 10801 */
+	    "QCA986x/988x\0" /* 1 refs @ 10808 */
+	    "Reference\0" /* 4 refs @ 10821 */
+	    "Card\0" /* 22 refs @ 10831 */
+	    "(Early\0" /* 1 refs @ 10836 */
+	    "AP11)\0" /* 1 refs @ 10843 */
+	    "(no\0" /* 3 refs @ 10849 */
+	    "eeprom)\0" /* 3 refs @ 10853 */
+	    "(emulation\0" /* 1 refs @ 10861 */
+	    "board)\0" /* 3 refs @ 10872 */
+	    "(11b\0" /* 1 refs @ 10879 */
+	    "emulation\0" /* 2 refs @ 10884 */
+	    "(original\0" /* 1 refs @ 10894 */
+	    "IDE-2015PL\0" /* 1 refs @ 10904 */
+	    "AVL2301\0" /* 1 refs @ 10915 */
+	    "AVG2302\0" /* 1 refs @ 10923 */
+	    "ALG2301\0" /* 1 refs @ 10931 */
+	    "ALG2302\0" /* 1 refs @ 10939 */
+	    "ALS4000\0" /* 1 refs @ 10947 */
+	    "Low\0" /* 4 refs @ 10955 */
+	    "Profile\0" /* 3 refs @ 10959 */
+	    "Cinemaster\0" /* 1 refs @ 10967 */
+	    "DVD\0" /* 1 refs @ 10978 */
+	    "Fritz!\0" /* 1 refs @ 10982 */
+	    "Fritz!PCI\0" /* 1 refs @ 10989 */
+	    "Basic\0" /* 1 refs @ 10999 */
+	    "Rate\0" /* 2 refs @ 11005 */
+	    "B1\0" /* 2 refs @ 11010 */
+	    "Primary\0" /* 1 refs @ 11013 */
+	    "T1\0" /* 1 refs @ 11021 */
+	    "XLR\0" /* 1 refs @ 11024 */
+	    "XLS\0" /* 1 refs @ 11028 */
+	    "PCIe-PCIe\0" /* 1 refs @ 11032 */
+	    "single-channel\0" /* 2 refs @ 11042 */
+	    "RS-485\0" /* 8 refs @ 11057 */
+	    "UART\0" /* 32 refs @ 11064 */
+	    "dual-channel\0" /* 3 refs @ 11069 */
+	    "quad-channel\0" /* 3 refs @ 11082 */
+	    "octal-channel\0" /* 3 refs @ 11095 */
+	    "Isolated\0" /* 4 refs @ 11109 */
+	    "F5D6001\0" /* 1 refs @ 11118 */
+	    "F5D6020v3\0" /* 1 refs @ 11126 */
+	    "F5D7010\0" /* 1 refs @ 11136 */
+	    "EC8/32\0" /* 1 refs @ 11144 */
+	    "EC8/64\0" /* 1 refs @ 11151 */
+	    "EasyIO\0" /* 1 refs @ 11158 */
+	    "PCI-VME\0" /* 3 refs @ 11165 */
+	    "Mod.\0" /* 3 refs @ 11173 */
+	    "617\0" /* 1 refs @ 11178 */
+	    "618\0" /* 1 refs @ 11182 */
+	    "2706\0" /* 1 refs @ 11186 */
+	    "5501\0" /* 1 refs @ 11191 */
+	    "5601\0" /* 1 refs @ 11196 */
+	    "BCM5752\0" /* 1 refs @ 11201 */
+	    "NetXtreme\0" /* 29 refs @ 11209 */
+	    "BCM5752M\0" /* 1 refs @ 11219 */
+	    "BCM5709\0" /* 2 refs @ 11228 */
+	    "BCM5716\0" /* 2 refs @ 11236 */
+	    "BCM5702\0" /* 2 refs @ 11244 */
+	    "BCM5703\0" /* 2 refs @ 11252 */
+	    "BCM5704C\0" /* 1 refs @ 11260 */
+	    "BCM5704S\0" /* 2 refs @ 11269 */
+	    "BCM5706\0" /* 2 refs @ 11278 */
+	    "BCM5708\0" /* 2 refs @ 11286 */
+	    "BCM5702FE\0" /* 1 refs @ 11294 */
+	    "BCM57710\0" /* 1 refs @ 11304 */
+	    "10Gb\0" /* 5 refs @ 11313 */
+	    "BCM57711\0" /* 1 refs @ 11318 */
+	    "BCM57711E\0" /* 1 refs @ 11327 */
+	    "BCM5705\0" /* 1 refs @ 11337 */
+	    "BCM5705K\0" /* 1 refs @ 11345 */
+	    "BCM5717\0" /* 1 refs @ 11354 */
+	    "BCM5718\0" /* 1 refs @ 11362 */
+	    "BCM5719\0" /* 1 refs @ 11370 */
+	    "BCM5721\0" /* 1 refs @ 11378 */
+	    "BCM5722\0" /* 1 refs @ 11386 */
+	    "BCM5723\0" /* 1 refs @ 11394 */
+	    "BCM5724\0" /* 1 refs @ 11402 */
+	    "BCM5705M\0" /* 2 refs @ 11410 */
+	    "BCM5720\0" /* 1 refs @ 11419 */
+	    "BCM57712\0" /* 1 refs @ 11427 */
+	    "BCM57712E\0" /* 1 refs @ 11436 */
+	    "BCM5714\0" /* 1 refs @ 11446 */
+	    "BCM5714S\0" /* 1 refs @ 11454 */
+	    "BCM5780\0" /* 1 refs @ 11463 */
+	    "BCM5780S\0" /* 1 refs @ 11471 */
+	    "BCM5705F\0" /* 1 refs @ 11480 */
+	    "BCM5754M\0" /* 1 refs @ 11489 */
+	    "BCM5755M\0" /* 1 refs @ 11498 */
+	    "BCM5756\0" /* 1 refs @ 11507 */
+	    "BCM5750\0" /* 1 refs @ 11515 */
+	    "BCM5751\0" /* 1 refs @ 11523 */
+	    "BCM5715\0" /* 1 refs @ 11531 */
+	    "BCM5715S\0" /* 1 refs @ 11539 */
+	    "BCM5754\0" /* 1 refs @ 11548 */
+	    "BCM5755\0" /* 1 refs @ 11556 */
+	    "BCM5750M\0" /* 1 refs @ 11564 */
+	    "BCM5751M\0" /* 1 refs @ 11573 */
+	    "BCM5751F\0" /* 1 refs @ 11582 */
+	    "BCM5787F\0" /* 1 refs @ 11591 */
+	    "BCM5761E\0" /* 1 refs @ 11600 */
+	    "BCM5761\0" /* 1 refs @ 11609 */
+	    "BCM57762\0" /* 1 refs @ 11617 */
+	    "BCM5764\0" /* 1 refs @ 11626 */
+	    "BCM57766\0" /* 1 refs @ 11634 */
+	    "BCM5761S\0" /* 1 refs @ 11643 */
+	    "BCM5761SE\0" /* 1 refs @ 11652 */
+	    "BCM57760\0" /* 1 refs @ 11662 */
+	    "BCM57788\0" /* 1 refs @ 11671 */
+	    "NetLink\0" /* 7 refs @ 11680 */
+	    "BCM57780\0" /* 1 refs @ 11688 */
+	    "BCM5787M\0" /* 1 refs @ 11697 */
+	    "BCM57790\0" /* 1 refs @ 11706 */
+	    "BCM5782\0" /* 1 refs @ 11715 */
+	    "BCM5784M\0" /* 1 refs @ 11723 */
+	    "BCM5785G\0" /* 1 refs @ 11732 */
+	    "BCM5786\0" /* 1 refs @ 11741 */
+	    "BCM5787\0" /* 1 refs @ 11749 */
+	    "BCM5788\0" /* 1 refs @ 11757 */
+	    "BCM5789\0" /* 1 refs @ 11765 */
+	    "BCM5785F\0" /* 1 refs @ 11773 */
+	    "BCM5702X\0" /* 1 refs @ 11782 */
+	    "BCM5703X\0" /* 1 refs @ 11791 */
+	    "BCM57761\0" /* 1 refs @ 11800 */
+	    "BCM57781\0" /* 1 refs @ 11809 */
+	    "BCM57791\0" /* 1 refs @ 11818 */
+	    "BCM57786\0" /* 1 refs @ 11827 */
+	    "BCM57765\0" /* 1 refs @ 11836 */
+	    "BCM57785\0" /* 1 refs @ 11845 */
+	    "BCM57795\0" /* 1 refs @ 11854 */
+	    "BCM57782\0" /* 1 refs @ 11863 */
+	    "BCM5781\0" /* 1 refs @ 11872 */
+	    "BCM5753\0" /* 1 refs @ 11880 */
+	    "BCM5753M\0" /* 1 refs @ 11888 */
+	    "BCM5753F\0" /* 1 refs @ 11897 */
+	    "BCM5903M\0" /* 1 refs @ 11906 */
+	    "BCM4401-B0\0" /* 1 refs @ 11915 */
+	    "BCM5901\0" /* 1 refs @ 11926 */
+	    "BCM5901A\0" /* 1 refs @ 11934 */
+	    "BCM5906\0" /* 1 refs @ 11943 */
+	    "BCM5906M\0" /* 1 refs @ 11951 */
+	    "BCM4303\0" /* 1 refs @ 11960 */
+	    "BCM4307\0" /* 1 refs @ 11968 */
+	    "BCM4311\0" /* 1 refs @ 11976 */
+	    "2.4GHz\0" /* 4 refs @ 11984 */
+	    "BCM4312\0" /* 1 refs @ 11991 */
+	    "Dualband\0" /* 3 refs @ 11999 */
+	    "BCM4313\0" /* 1 refs @ 12008 */
+	    "5GHz\0" /* 1 refs @ 12016 */
+	    "BCM4315\0" /* 1 refs @ 12021 */
+	    "BCM4318\0" /* 1 refs @ 12029 */
+	    "AirForce\0" /* 1 refs @ 12037 */
+	    "54g\0" /* 1 refs @ 12046 */
+	    "BCM4319\0" /* 1 refs @ 12050 */
+	    "BCM4306\0" /* 2 refs @ 12058 */
+	    "BCM4322\0" /* 1 refs @ 12066 */
+	    "BCM4309\0" /* 1 refs @ 12074 */
+	    "BCM43XG\0" /* 1 refs @ 12082 */
+	    "BCM4328\0" /* 1 refs @ 12090 */
+	    "802.11a/b/g/n\0" /* 2 refs @ 12098 */
+	    "BCM4329\0" /* 1 refs @ 12112 */
+	    "802.11b/g/n\0" /* 4 refs @ 12120 */
+	    "BCM432A\0" /* 1 refs @ 12132 */
+	    "802.11\0" /* 7 refs @ 12140 */
+	    "BCM432B\0" /* 1 refs @ 12147 */
+	    "BCM432C\0" /* 1 refs @ 12155 */
+	    "BCM432D\0" /* 1 refs @ 12163 */
+	    "BCM43224\0" /* 1 refs @ 12171 */
+	    "BCM43225\0" /* 1 refs @ 12180 */
+	    "BCM43227\0" /* 1 refs @ 12189 */
+	    "BCM43228\0" /* 1 refs @ 12198 */
+	    "BCM4401\0" /* 1 refs @ 12207 */
+	    "5801\0" /* 1 refs @ 12215 */
+	    "5802\0" /* 1 refs @ 12220 */
+	    "5805\0" /* 1 refs @ 12225 */
+	    "5820\0" /* 1 refs @ 12230 */
+	    "5821\0" /* 1 refs @ 12235 */
+	    "5822\0" /* 1 refs @ 12240 */
+	    "5823\0" /* 1 refs @ 12245 */
+	    "5825\0" /* 1 refs @ 12250 */
+	    "5860\0" /* 1 refs @ 12255 */
+	    "5861\0" /* 1 refs @ 12260 */
+	    "5862\0" /* 1 refs @ 12265 */
+	    "Bt848\0" /* 1 refs @ 12270 */
+	    "Capture\0" /* 11 refs @ 12276 */
+	    "Bt849\0" /* 1 refs @ 12284 */
+	    "Bt878\0" /* 2 refs @ 12290 */
+	    "Bt879\0" /* 2 refs @ 12296 */
+	    "Bt880\0" /* 2 refs @ 12302 */
+	    "(Audio\0" /* 3 refs @ 12308 */
+	    "Section)\0" /* 3 refs @ 12315 */
+	    "Bt8474\0" /* 1 refs @ 12324 */
+	    "Multichannel\0" /* 2 refs @ 12331 */
+	    "HDLC\0" /* 1 refs @ 12344 */
+	    "MultiMaster\0" /* 2 refs @ 12349 */
+	    "NC\0" /* 1 refs @ 12361 */
+	    "FlashPoint\0" /* 1 refs @ 12364 */
+	    "GPPCI\0" /* 1 refs @ 12375 */
+	    "Nitrox\0" /* 1 refs @ 12381 */
+	    "T302e\0" /* 1 refs @ 12388 */
+	    "T310e\0" /* 1 refs @ 12394 */
+	    "T320x\0" /* 1 refs @ 12400 */
+	    "T302x\0" /* 1 refs @ 12406 */
+	    "T320e\0" /* 1 refs @ 12412 */
+	    "T310x\0" /* 1 refs @ 12418 */
+	    "T3B10\0" /* 1 refs @ 12424 */
+	    "T3B20\0" /* 1 refs @ 12430 */
+	    "T3B02\0" /* 1 refs @ 12436 */
+	    "64310\0" /* 1 refs @ 12442 */
+	    "69000\0" /* 1 refs @ 12448 */
+	    "65545\0" /* 1 refs @ 12454 */
+	    "65548\0" /* 1 refs @ 12460 */
+	    "65550\0" /* 1 refs @ 12466 */
+	    "65554\0" /* 1 refs @ 12472 */
+	    "69030\0" /* 1 refs @ 12478 */
+	    "LunaVPN\0" /* 1 refs @ 12484 */
+	    "CL-GD7548\0" /* 1 refs @ 12492 */
+	    "CL-GD5430\0" /* 1 refs @ 12502 */
+	    "CL-GD5434-4\0" /* 1 refs @ 12512 */
+	    "CL-GD5434-8\0" /* 1 refs @ 12524 */
+	    "CL-GD5436\0" /* 1 refs @ 12536 */
+	    "CL-GD5446\0" /* 1 refs @ 12546 */
+	    "CL-GD5480\0" /* 1 refs @ 12556 */
+	    "CL-PD6729\0" /* 1 refs @ 12566 */
+	    "CL-PD6832\0" /* 1 refs @ 12576 */
+	    "PCI-CardBus\0" /* 65 refs @ 12586 */
+	    "CL-PD6833\0" /* 1 refs @ 12598 */
+	    "CL-GD7542\0" /* 1 refs @ 12608 */
+	    "CL-GD7543\0" /* 1 refs @ 12618 */
+	    "CL-GD7541\0" /* 1 refs @ 12628 */
+	    "CL-CD4400\0" /* 1 refs @ 12638 */
+	    "CS4610\0" /* 1 refs @ 12648 */
+	    "SoundFusion\0" /* 1 refs @ 12655 */
+	    "CS4280\0" /* 1 refs @ 12667 */
+	    "CrystalClear\0" /* 2 refs @ 12674 */
+	    "CS4615\0" /* 1 refs @ 12687 */
+	    "CS4281\0" /* 1 refs @ 12694 */
+	    "AAR-1210SA\0" /* 1 refs @ 12701 */
+	    "PCI0640\0" /* 1 refs @ 12712 */
+	    "PCI0642\0" /* 1 refs @ 12720 */
+	    "PCI0643\0" /* 1 refs @ 12728 */
+	    "PCI0646\0" /* 1 refs @ 12736 */
+	    "PCI0647\0" /* 1 refs @ 12744 */
+	    "PCI0648\0" /* 1 refs @ 12752 */
+	    "PCI0649\0" /* 1 refs @ 12760 */
+	    "Sil240\0" /* 1 refs @ 12768 */
+	    "SATALink\0" /* 7 refs @ 12775 */
+	    "PCI0650A\0" /* 1 refs @ 12784 */
+	    "USB0670\0" /* 1 refs @ 12793 */
+	    "USB0673\0" /* 1 refs @ 12801 */
+	    "SiI0680\0" /* 1 refs @ 12809 */
+	    "SiI3112\0" /* 1 refs @ 12817 */
+	    "SiI3114\0" /* 1 refs @ 12825 */
+	    "SiI3124\0" /* 1 refs @ 12833 */
+	    "SiI3132\0" /* 1 refs @ 12841 */
+	    "SiI3512\0" /* 1 refs @ 12849 */
+	    "SiI3531\0" /* 1 refs @ 12857 */
+	    "CMI8338A\0" /* 1 refs @ 12865 */
+	    "CMI8338B\0" /* 1 refs @ 12874 */
+	    "CMI8738/C3DX\0" /* 1 refs @ 12883 */
+	    "CMI8738B\0" /* 1 refs @ 12896 */
+	    "HSP56\0" /* 1 refs @ 12905 */
+	    "Audiomodem\0" /* 1 refs @ 12911 */
+	    "Riser\0" /* 1 refs @ 12922 */
+	    "EX110TX\0" /* 1 refs @ 12928 */
+	    "HFC-S\0" /* 1 refs @ 12936 */
+	    "38W2\0" /* 1 refs @ 12942 */
+	    "OEM\0" /* 1 refs @ 12947 */
+	    "Notebook\0" /* 3 refs @ 12951 */
+	    "PCI-EISA\0" /* 2 refs @ 12960 */
+	    "Triflex\0" /* 3 refs @ 12969 */
+	    "QVision\0" /* 3 refs @ 12977 */
+	    "1280/p\0" /* 1 refs @ 12985 */
+	    "Smart\0" /* 45 refs @ 12992 */
+	    "Array\0" /* 36 refs @ 12998 */
+	    "5300\0" /* 5 refs @ 13004 */
+	    "5i\0" /* 1 refs @ 13009 */
+	    "532\0" /* 1 refs @ 13012 */
+	    "5312\0" /* 1 refs @ 13016 */
+	    "6i\0" /* 1 refs @ 13021 */
+	    "641\0" /* 1 refs @ 13024 */
+	    "642\0" /* 1 refs @ 13028 */
+	    "6400\0" /* 2 refs @ 13032 */
+	    "EM\0" /* 1 refs @ 13037 */
+	    "6422\0" /* 1 refs @ 13040 */
+	    "64xx\0" /* 1 refs @ 13045 */
+	    "SMART2P\0" /* 1 refs @ 13050 */
+	    "Netelligent\0" /* 6 refs @ 13058 */
+	    "TX\0" /* 4 refs @ 13070 */
+	    "10\0" /* 30 refs @ 13073 */
+	    "T/2\0" /* 1 refs @ 13076 */
+	    "UTP/Coax\0" /* 1 refs @ 13080 */
+	    "T\0" /* 1 refs @ 13089 */
+	    "NetFlex\0" /* 3 refs @ 13091 */
+	    "3/P\0" /* 3 refs @ 13099 */
+	    "ProLiant\0" /* 1 refs @ 13103 */
+	    "Deskpro\0" /* 1 refs @ 13112 */
+	    "4000\0" /* 1 refs @ 13120 */
+	    "5233MMX\0" /* 1 refs @ 13125 */
+	    "rev.\0" /* 2 refs @ 13133 */
+	    "Presario\0" /* 1 refs @ 13138 */
+	    "56xx\0" /* 1 refs @ 13147 */
+	    "Armada\0" /* 12 refs @ 13152 */
+	    "M700\0" /* 1 refs @ 13159 */
+	    "5i/532\0" /* 1 refs @ 13164 */
+	    "iLO\0" /* 2 refs @ 13171 */
+	    "BNC\0" /* 1 refs @ 13175 */
+	    "RL100-ATX\0" /* 1 refs @ 13179 */
+	    "RL100-TX\0" /* 1 refs @ 13189 */
+	    "RocketPort\0" /* 23 refs @ 13198 */
+	    "32\0" /* 1 refs @ 13209 */
+	    "External\0" /* 3 refs @ 13212 */
+	    "16\0" /* 3 refs @ 13221 */
+	    "Quad\0" /* 14 refs @ 13224 */
+	    "Cable\0" /* 2 refs @ 13229 */
+	    "Octa\0" /* 3 refs @ 13235 */
+	    "RJ11s\0" /* 2 refs @ 13240 */
+	    "DB78\0" /* 2 refs @ 13246 */
+	    "Plus\0" /* 5 refs @ 13251 */
+	    "RocketModem\0" /* 2 refs @ 13256 */
+	    "6\0" /* 32 refs @ 13268 */
+	    "RS232\0" /* 1 refs @ 13270 */
+	    "RS422\0" /* 1 refs @ 13276 */
+	    "550/8\0" /* 6 refs @ 13282 */
+	    "RJ11\0" /* 2 refs @ 13288 */
+	    "part\0" /* 8 refs @ 13293 */
+	    "550/4\0" /* 1 refs @ 13298 */
+	    "550/Quad\0" /* 1 refs @ 13304 */
+	    "550/16\0" /* 2 refs @ 13313 */
+	    "SoftK56\0" /* 1 refs @ 13320 */
+	    "HW\0" /* 1 refs @ 13328 */
+	    "56K\0" /* 2 refs @ 13331 */
+	    "Fax\0" /* 1 refs @ 13335 */
+	    "LANfinity\0" /* 1 refs @ 13339 */
+	    "MiniPCI\0" /* 1 refs @ 13349 */
+	    "CX23880/1/2/3\0" /* 4 refs @ 13357 */
+	    "Video/Audio\0" /* 1 refs @ 13371 */
+	    "IR\0" /* 1 refs @ 13383 */
+	    "CX23885\0" /* 1 refs @ 13386 */
+	    "82C599\0" /* 1 refs @ 13394 */
+	    "PCI-VLB\0" /* 1 refs @ 13401 */
+	    "82C693\0" /* 1 refs @ 13409 */
+	    "FEther\0" /* 2 refs @ 13416 */
+	    "CB-TXD\0" /* 2 refs @ 13423 */
+	    "CG-LAPCIGT\0" /* 1 refs @ 13430 */
+	    "\"C-Bus\0" /* 1 refs @ 13441 */
+	    "II\"-PCI\0" /* 1 refs @ 13448 */
+	    "SBLive!\0" /* 2 refs @ 13456 */
+	    "EMU\0" /* 3 refs @ 13464 */
+	    "10000\0" /* 3 refs @ 13468 */
+	    "SoundBlaster\0" /* 3 refs @ 13474 */
+	    "AWE64D\0" /* 1 refs @ 13487 */
+	    "SB\0" /* 3 refs @ 13494 */
+	    "Audigy\0" /* 4 refs @ 13497 */
+	    "X-Fi\0" /* 1 refs @ 13504 */
+	    "LS\0" /* 1 refs @ 13509 */
+	    "Gameport\0" /* 4 refs @ 13512 */
+	    "Joystick\0" /* 4 refs @ 13521 */
+	    "Ectiva\0" /* 1 refs @ 13530 */
+	    "1938\0" /* 1 refs @ 13537 */
+	    "Cyclom-Y\0" /* 2 refs @ 13542 */
+	    "below\0" /* 4 refs @ 13551 */
+	    "1M\0" /* 8 refs @ 13557 */
+	    "above\0" /* 4 refs @ 13560 */
+	    "Cyclom-4Y\0" /* 2 refs @ 13566 */
+	    "Cyclom-8Y\0" /* 2 refs @ 13576 */
+	    "Cyclom-Z\0" /* 2 refs @ 13586 */
+	    "IQ80310\0" /* 1 refs @ 13595 */
+	    "(PCI-700)\0" /* 1 refs @ 13603 */
+	    "MediaGX\0" /* 1 refs @ 13613 */
+	    "Built-in\0" /* 1 refs @ 13621 */
+	    "Cx5520\0" /* 1 refs @ 13630 */
+	    "Companion\0" /* 10 refs @ 13637 */
+	    "Cx5530\0" /* 5 refs @ 13647 */
+	    "Multi-Function\0" /* 1 refs @ 13654 */
+	    "(SMI\0" /* 1 refs @ 13669 */
+	    "Status\0" /* 3 refs @ 13674 */
+	    "Timer)\0" /* 1 refs @ 13681 */
+	    "Controller)\0" /* 2 refs @ 13688 */
+	    "(XpressAUDIO)\0" /* 1 refs @ 13700 */
+	    "(Video\0" /* 1 refs @ 13714 */
+	    "BC635PCI-U\0" /* 1 refs @ 13721 */
+	    "TC\0" /* 1 refs @ 13732 */
+	    "FREQ.\0" /* 1 refs @ 13735 */
+	    "DM9102\0" /* 1 refs @ 13741 */
+	    "PCCOM\0" /* 3 refs @ 13748 */
+	    "4-port\0" /* 2 refs @ 13754 */
+	    "2-port\0" /* 3 refs @ 13761 */
+	    "DC21050\0" /* 1 refs @ 13768 */
+	    "DC21040\0" /* 1 refs @ 13776 */
+	    "(\"Tulip\")\0" /* 1 refs @ 13784 */
+	    "DC21030\0" /* 1 refs @ 13794 */
+	    "(\"TGA\")\0" /* 1 refs @ 13802 */
+	    "Zephyr\0" /* 1 refs @ 13810 */
+	    "NV-RAM\0" /* 1 refs @ 13817 */
+	    "KZPSA\0" /* 1 refs @ 13824 */
+	    "DC21140\0" /* 1 refs @ 13830 */
+	    "(\"FasterNet\")\0" /* 1 refs @ 13838 */
+	    "TGA2\0" /* 1 refs @ 13852 */
+	    "DEFPA\0" /* 1 refs @ 13857 */
+	    "DC21041\0" /* 1 refs @ 13863 */
+	    "(\"Tulip\0" /* 1 refs @ 13871 */
+	    "Plus\")\0" /* 1 refs @ 13879 */
+	    "DGLPB\0" /* 1 refs @ 13886 */
+	    "(\"OPPO\")\0" /* 1 refs @ 13892 */
+	    "DC21142/21143\0" /* 1 refs @ 13901 */
+	    "DC21052\0" /* 1 refs @ 13915 */
+	    "DC21150\0" /* 1 refs @ 13923 */
+	    "DC21152\0" /* 1 refs @ 13931 */
+	    "DC21153\0" /* 1 refs @ 13939 */
+	    "DC21154\0" /* 1 refs @ 13947 */
+	    "DC21554\0" /* 1 refs @ 13955 */
+	    "SWXCR\0" /* 1 refs @ 13963 */
+	    "2/Si\0" /* 1 refs @ 13969 */
+	    "3/Di\0" /* 9 refs @ 13974 */
+	    "3/Si\0" /* 3 refs @ 13979 */
+	    "4/Di\0" /* 2 refs @ 13984 */
+	    "DRAC\0" /* 3 refs @ 13989 */
+	    "Virtual\0" /* 34 refs @ 13994 */
+	    "4e/Si\0" /* 1 refs @ 14002 */
+	    "SMIC\0" /* 1 refs @ 14008 */
+	    "5\0" /* 7 refs @ 14013 */
+	    "5/e\0" /* 1 refs @ 14015 */
+	    "5/i\0" /* 1 refs @ 14019 */
+	    "CERC\0" /* 1 refs @ 14023 */
+	    "1.5/6ch\0" /* 1 refs @ 14028 */
+	    "Viper/PCI\0" /* 1 refs @ 14036 */
+	    "AccelePort\0" /* 1 refs @ 14046 */
+	    "8r\0" /* 1 refs @ 14057 */
+	    "920\0" /* 1 refs @ 14060 */
+	    "Neo\0" /* 3 refs @ 14064 */
+	    "DL-1002\0" /* 1 refs @ 14068 */
+	    "DFE-530TXPLUS\0" /* 1 refs @ 14076 */
+	    "DFE-690TXD\0" /* 1 refs @ 14090 */
+	    "DWL-610\0" /* 1 refs @ 14101 */
+	    "DL-4000\0" /* 1 refs @ 14109 */
+	    "DGE-550SX\0" /* 1 refs @ 14117 */
+	    "DFE-520TX\0" /* 1 refs @ 14127 */
+	    "DGE-528T\0" /* 1 refs @ 14137 */
+	    "DGE-560T\0" /* 1 refs @ 14146 */
+	    "DGE-560T_2\0" /* 1 refs @ 14155 */
+	    "DGE-560SX\0" /* 1 refs @ 14166 */
+	    "DGE-530T\0" /* 1 refs @ 14176 */
+	    "SmartCache/SmartRAID\0" /* 1 refs @ 14185 */
+	    "(EATA)\0" /* 1 refs @ 14206 */
+	    "SmartRAID\0" /* 2 refs @ 14213 */
+	    "(I2O)\0" /* 2 refs @ 14223 */
+	    "Zero\0" /* 1 refs @ 14229 */
+	    "Channel\0" /* 9 refs @ 14234 */
+	    "PCI-SCI\0" /* 3 refs @ 14242 */
+	    "(32-bit,\0" /* 1 refs @ 14250 */
+	    "33\0" /* 2 refs @ 14259 */
+	    "MHz)\0" /* 3 refs @ 14262 */
+	    "(64-bit,\0" /* 2 refs @ 14267 */
+	    "66\0" /* 1 refs @ 14276 */
+	    "DMX-3191D\0" /* 1 refs @ 14279 */
+	    "IS64PH\0" /* 1 refs @ 14289 */
+	    "QuickStep\0" /* 1 refs @ 14296 */
+	    "1000\0" /* 5 refs @ 14306 */
+	    "Gloria\0" /* 1 refs @ 14311 */
+	    "1624\0" /* 1 refs @ 14318 */
+	    "LP6000\0" /* 1 refs @ 14323 */
+	    "FibreChannel\0" /* 9 refs @ 14330 */
+	    "LP952\0" /* 1 refs @ 14343 */
+	    "LP982\0" /* 1 refs @ 14349 */
+	    "LP101\0" /* 1 refs @ 14355 */
+	    "LP7000\0" /* 1 refs @ 14361 */
+	    "LP8000\0" /* 1 refs @ 14368 */
+	    "LP9000\0" /* 1 refs @ 14375 */
+	    "LP9802\0" /* 1 refs @ 14382 */
+	    "LP10000\0" /* 1 refs @ 14389 */
+	    "MCR510\0" /* 1 refs @ 14397 */
+	    "Reader\0" /* 9 refs @ 14404 */
+	    "CB712/714/810\0" /* 1 refs @ 14411 */
+	    "CB1211\0" /* 1 refs @ 14425 */
+	    "CardBus\0" /* 6 refs @ 14432 */
+	    "CB1225\0" /* 1 refs @ 14440 */
+	    "CB1410\0" /* 1 refs @ 14447 */
+	    "CB710\0" /* 1 refs @ 14454 */
+	    "CB1420\0" /* 1 refs @ 14460 */
+	    "CB720\0" /* 1 refs @ 14467 */
+	    "AudioPCI\0" /* 2 refs @ 14473 */
+	    "97\0" /* 1 refs @ 14482 */
+	    "CT5880\0" /* 1 refs @ 14485 */
+	    "SST-64P\0" /* 1 refs @ 14492 */
+	    "SST-128P\0" /* 1 refs @ 14500 */
+	    "SST-16P\0" /* 3 refs @ 14509 */
+	    "SST-4P\0" /* 1 refs @ 14517 */
+	    "SST-8P\0" /* 1 refs @ 14524 */
+	    "RoadRunner\0" /* 2 refs @ 14531 */
+	    "HIPPI\0" /* 1 refs @ 14542 */
+	    "Gig-E\0" /* 1 refs @ 14548 */
+	    "Maestro\0" /* 7 refs @ 14554 */
+	    "1\0" /* 16 refs @ 14562 */
+	    "Solo-1\0" /* 1 refs @ 14564 */
+	    "AudioDrive\0" /* 1 refs @ 14571 */
+	    "2E\0" /* 1 refs @ 14582 */
+	    "Allegro-1\0" /* 1 refs @ 14585 */
+	    "WL11000P\0" /* 1 refs @ 14595 */
+	    "WaveLAN/IEEE\0" /* 1 refs @ 14604 */
+	    "IEEE\0" /* 38 refs @ 14617 */
+	    "1394\0" /* 34 refs @ 14622 */
+	    "OZ6729\0" /* 1 refs @ 14627 */
+	    "PCI-PCMCIA\0" /* 4 refs @ 14634 */
+	    "OZ6730\0" /* 1 refs @ 14645 */
+	    "OZ6832/OZ6833\0" /* 1 refs @ 14652 */
+	    "OZ6836/OZ6860\0" /* 1 refs @ 14666 */
+	    "OZ6812/OZ6872\0" /* 1 refs @ 14680 */
+	    "OZ6922\0" /* 1 refs @ 14694 */
+	    "OZ6933\0" /* 1 refs @ 14701 */
+	    "OZ6912/OZ6972\0" /* 1 refs @ 14708 */
+	    "OZ7120\0" /* 1 refs @ 14722 */
+	    "MMC/SD\0" /* 1 refs @ 14729 */
+	    "OZ7130\0" /* 1 refs @ 14736 */
+	    "MS/xD/SM\0" /* 1 refs @ 14743 */
+	    "OZ711E0\0" /* 1 refs @ 14752 */
+	    "Freedom\0" /* 1 refs @ 14760 */
+	    "PCI-GBus\0" /* 1 refs @ 14768 */
+	    "Universal\0" /* 3 refs @ 14777 */
+	    "PCA-200\0" /* 1 refs @ 14787 */
+	    "PCA-200e\0" /* 1 refs @ 14795 */
+	    "801\0" /* 1 refs @ 14804 */
+	    "FL1000\0" /* 1 refs @ 14808 */
+	    "USB3\0" /* 3 refs @ 14815 */
+	    "FL1009\0" /* 1 refs @ 14820 */
+	    "TMC-18C30\0" /* 1 refs @ 14827 */
+	    "(36C70)\0" /* 1 refs @ 14837 */
+	    "PW008GE5\0" /* 1 refs @ 14845 */
+	    "PW008GE4\0" /* 1 refs @ 14854 */
+	    "PRIMEPOWER250/450\0" /* 1 refs @ 14863 */
+	    "STR1100\0" /* 1 refs @ 14881 */
+	    "HOTlink\0" /* 2 refs @ 14889 */
+	    "Counter\0" /* 1 refs @ 14897 */
+	    "Timer\0" /* 6 refs @ 14905 */
+	    "PROFIBUS\0" /* 1 refs @ 14911 */
+	    "old\0" /* 1 refs @ 14920 */
+	    "155P-MF1\0" /* 2 refs @ 14924 */
+	    "(FPGA)\0" /* 1 refs @ 14933 */
+	    "(ASIC)\0" /* 1 refs @ 14940 */
+	    "SpeedStream\0" /* 2 refs @ 14947 */
+	    "ENI-25p\0" /* 1 refs @ 14959 */
+	    "3000\0" /* 4 refs @ 14967 */
+	    "MPC8548E\0" /* 2 refs @ 14972 */
+	    "MPC8548\0" /* 2 refs @ 14981 */
+	    "MPC8543E\0" /* 1 refs @ 14989 */
+	    "MPC8543\0" /* 1 refs @ 14998 */
+	    "MPC8547E\0" /* 1 refs @ 15006 */
+	    "MPC8545E\0" /* 1 refs @ 15015 */
+	    "MPC8545\0" /* 1 refs @ 15024 */
+	    "MPC8544E\0" /* 1 refs @ 15032 */
+	    "MPC8544\0" /* 1 refs @ 15041 */
+	    "MPC8572E\0" /* 1 refs @ 15049 */
+	    "MPC8572\0" /* 1 refs @ 15058 */
+	    "MPC8536E\0" /* 1 refs @ 15066 */
+	    "MPC8536\0" /* 1 refs @ 15075 */
+	    "P2020E\0" /* 1 refs @ 15083 */
+	    "P2020\0" /* 1 refs @ 15090 */
+	    "P2010E\0" /* 1 refs @ 15096 */
+	    "P2010\0" /* 1 refs @ 15103 */
+	    "P1021E\0" /* 2 refs @ 15109 */
+	    "P1020\0" /* 1 refs @ 15116 */
+	    "P1021\0" /* 1 refs @ 15122 */
+	    "P1024E\0" /* 1 refs @ 15128 */
+	    "P1024\0" /* 1 refs @ 15135 */
+	    "P1025E\0" /* 1 refs @ 15141 */
+	    "P1025\0" /* 1 refs @ 15148 */
+	    "P1011E\0" /* 1 refs @ 15154 */
+	    "P1011\0" /* 1 refs @ 15161 */
+	    "P1022E\0" /* 1 refs @ 15167 */
+	    "P1022\0" /* 1 refs @ 15174 */
+	    "P1013E\0" /* 1 refs @ 15180 */
+	    "P1013\0" /* 1 refs @ 15187 */
+	    "P4080E\0" /* 1 refs @ 15193 */
+	    "P4080\0" /* 1 refs @ 15200 */
+	    "P4040E\0" /* 1 refs @ 15206 */
+	    "P4040\0" /* 1 refs @ 15213 */
+	    "P2040E\0" /* 1 refs @ 15219 */
+	    "P2040\0" /* 1 refs @ 15226 */
+	    "P3041E\0" /* 1 refs @ 15232 */
+	    "P3041\0" /* 1 refs @ 15239 */
+	    "P5020E\0" /* 1 refs @ 15245 */
+	    "P5020\0" /* 1 refs @ 15252 */
+	    "P5010E\0" /* 1 refs @ 15258 */
+	    "P5010\0" /* 1 refs @ 15265 */
+	    "GT-64010A\0" /* 1 refs @ 15271 */
+	    "88F1181\0" /* 1 refs @ 15281 */
+	    "88F1281\0" /* 1 refs @ 15289 */
+	    "SoC\0" /* 26 refs @ 15297 */
+	    "Orion2\0" /* 2 refs @ 15301 */
+	    "Libertas\0" /* 5 refs @ 15308 */
+	    "88W8300\0" /* 2 refs @ 15317 */
+	    "88W8310\0" /* 1 refs @ 15325 */
+	    "88W8335\0" /* 2 refs @ 15333 */
+	    "88SB2211\0" /* 1 refs @ 15341 */
+	    "x1\0" /* 1 refs @ 15350 */
+	    "PCIe-PCI\0" /* 3 refs @ 15353 */
+	    "GT-64115\0" /* 1 refs @ 15362 */
+	    "GT-64011\0" /* 1 refs @ 15371 */
+	    "SK-NET\0" /* 4 refs @ 15380 */
+	    "Yukon-II\0" /* 8 refs @ 15387 */
+	    "88E8021CU\0" /* 1 refs @ 15396 */
+	    "88E8022CU\0" /* 1 refs @ 15406 */
+	    "88E8061CU\0" /* 1 refs @ 15416 */
+	    "88E8062CU\0" /* 1 refs @ 15426 */
+	    "88E8021X\0" /* 1 refs @ 15436 */
+	    "88E8022X\0" /* 1 refs @ 15445 */
+	    "88E8061X\0" /* 1 refs @ 15454 */
+	    "88E8062X\0" /* 1 refs @ 15463 */
+	    "Yukon\0" /* 17 refs @ 15472 */
+	    "88E8035\0" /* 1 refs @ 15478 */
+	    "88E8036\0" /* 1 refs @ 15486 */
+	    "88E8038\0" /* 1 refs @ 15494 */
+	    "88E8039\0" /* 1 refs @ 15502 */
+	    "88E8040\0" /* 1 refs @ 15510 */
+	    "88EC033\0" /* 1 refs @ 15518 */
+	    "88E8052\0" /* 1 refs @ 15526 */
+	    "88E8050\0" /* 1 refs @ 15534 */
+	    "88E8053\0" /* 1 refs @ 15542 */
+	    "88E8055\0" /* 1 refs @ 15550 */
+	    "88E8056\0" /* 1 refs @ 15558 */
+	    "88EC036\0" /* 1 refs @ 15566 */
+	    "88EC032\0" /* 1 refs @ 15574 */
+	    "88EC034\0" /* 1 refs @ 15582 */
+	    "88EC042\0" /* 1 refs @ 15590 */
+	    "88EC055\0" /* 1 refs @ 15598 */
+	    "GT-64120\0" /* 1 refs @ 15606 */
+	    "88SX5040\0" /* 1 refs @ 15615 */
+	    "88SX5041\0" /* 1 refs @ 15624 */
+	    "88SX5080\0" /* 1 refs @ 15633 */
+	    "88SX5081\0" /* 1 refs @ 15642 */
+	    "88F5082\0" /* 1 refs @ 15651 */
+	    "Orion1\0" /* 7 refs @ 15659 */
+	    "88F5180N\0" /* 1 refs @ 15666 */
+	    "88F5181\0" /* 1 refs @ 15675 */
+	    "88F5182\0" /* 1 refs @ 15683 */
+	    "88F5281\0" /* 1 refs @ 15691 */
+	    "88SX6040\0" /* 1 refs @ 15699 */
+	    "88SX6041\0" /* 1 refs @ 15708 */
+	    "88SX6042\0" /* 1 refs @ 15717 */
+	    "IIe\0" /* 3 refs @ 15726 */
+	    "88SX6080\0" /* 1 refs @ 15730 */
+	    "88SX6081\0" /* 1 refs @ 15739 */
+	    "88F6082\0" /* 1 refs @ 15748 */
+	    "88SE6101\0" /* 1 refs @ 15756 */
+	    "PATA133\0" /* 1 refs @ 15765 */
+	    "88SE6121\0" /* 1 refs @ 15773 */
+	    "88SE614X\0" /* 1 refs @ 15782 */
+	    "PCI-E\0" /* 23 refs @ 15791 */
+	    "88SE6145\0" /* 1 refs @ 15797 */
+	    "88F6180\0" /* 1 refs @ 15806 */
+	    "Kirkwood\0" /* 4 refs @ 15814 */
+	    "88F6183\0" /* 1 refs @ 15823 */
+	    "88F6192\0" /* 1 refs @ 15831 */
+	    "88F6281\0" /* 1 refs @ 15839 */
+	    "88F6282\0" /* 1 refs @ 15847 */
+	    "GT-64130\0" /* 1 refs @ 15855 */
+	    "GT-64260\0" /* 1 refs @ 15864 */
+	    "MV6436x\0" /* 1 refs @ 15873 */
+	    "MV6446x\0" /* 1 refs @ 15881 */
+	    "MV6707\0" /* 1 refs @ 15889 */
+	    "370\0" /* 3 refs @ 15896 */
+	    "MV6710\0" /* 1 refs @ 15900 */
+	    "MV6W11\0" /* 1 refs @ 15907 */
+	    "88SX7042\0" /* 1 refs @ 15914 */
+	    "MV78100\0" /* 1 refs @ 15923 */
+	    "Discovery\0" /* 2 refs @ 15931 */
+	    "Innovation\0" /* 2 refs @ 15941 */
+	    "MV78130\0" /* 1 refs @ 15952 */
+	    "XP\0" /* 5 refs @ 15960 */
+	    "MV78160\0" /* 1 refs @ 15963 */
+	    "MV78200\0" /* 1 refs @ 15971 */
+	    "MV78230\0" /* 1 refs @ 15979 */
+	    "MV78260\0" /* 1 refs @ 15987 */
+	    "MV78460\0" /* 1 refs @ 15995 */
+	    "88F6810\0" /* 1 refs @ 16003 */
+	    "38x\0" /* 3 refs @ 16011 */
+	    "88F6820\0" /* 1 refs @ 16015 */
+	    "88F6828\0" /* 1 refs @ 16023 */
+	    "88W8660\0" /* 1 refs @ 16031 */
+	    "88SE9120\0" /* 1 refs @ 16039 */
+	    "88SE912[38]\0" /* 1 refs @ 16048 */
+	    "or\0" /* 3 refs @ 16060 */
+	    "88SE9125\0" /* 1 refs @ 16063 */
+	    "88SE9172\0" /* 1 refs @ 16072 */
+	    "88SE9182\0" /* 1 refs @ 16081 */
+	    "88SE9183\0" /* 1 refs @ 16090 */
+	    "88SE91XX\0" /* 1 refs @ 16099 */
+	    "88SE9215\0" /* 1 refs @ 16108 */
+	    "88SE9220\0" /* 1 refs @ 16117 */
+	    "88SE9230\0" /* 1 refs @ 16126 */
+	    "88SE9235\0" /* 1 refs @ 16135 */
+	    "GL24110P\0" /* 2 refs @ 16144 */
+	    "MAXIRADIO\0" /* 1 refs @ 16153 */
+	    "PN672TX\0" /* 1 refs @ 16163 */
+	    "PM/PPC\0" /* 1 refs @ 16171 */
+	    "A4977A\0" /* 1 refs @ 16178 */
+	    "Visualize\0" /* 5 refs @ 16185 */
+	    "EG\0" /* 1 refs @ 16195 */
+	    "FX6\0" /* 1 refs @ 16198 */
+	    "FX4\0" /* 1 refs @ 16202 */
+	    "FX2\0" /* 1 refs @ 16206 */
+	    "TL\0" /* 1 refs @ 16210 */
+	    "XL2\0" /* 1 refs @ 16213 */
+	    "TS\0" /* 1 refs @ 16217 */
+	    "J2585A\0" /* 1 refs @ 16220 */
+	    "J2585B\0" /* 1 refs @ 16227 */
+	    "Diva\0" /* 1 refs @ 16234 */
+	    "Multiport\0" /* 1 refs @ 16239 */
+	    "Elroy\0" /* 1 refs @ 16249 */
+	    "Ropes-PCI\0" /* 3 refs @ 16255 */
+	    "FXe\0" /* 1 refs @ 16265 */
+	    "TopTools\0" /* 1 refs @ 16269 */
+	    "NetRaid-4M\0" /* 1 refs @ 16278 */
+	    "NetServer\0" /* 1 refs @ 16289 */
+	    "SmartIRQ\0" /* 1 refs @ 16299 */
+	    "82557B\0" /* 1 refs @ 16308 */
+	    "NIC\0" /* 6 refs @ 16315 */
+	    "Pluto\0" /* 1 refs @ 16319 */
+	    "MIO\0" /* 1 refs @ 16325 */
+	    "zx1\0" /* 1 refs @ 16329 */
+	    "IOC\0" /* 1 refs @ 16333 */
+	    "QuickSilver\0" /* 1 refs @ 16337 */
+	    "V100\0" /* 1 refs @ 16349 */
+	    "E200i\0" /* 4 refs @ 16354 */
+	    "E200\0" /* 1 refs @ 16360 */
+	    "P600\0" /* 2 refs @ 16365 */
+	    "P400\0" /* 1 refs @ 16370 */
+	    "P400i\0" /* 1 refs @ 16375 */
+	    "iLO3\0" /* 3 refs @ 16381 */
+	    "IPMI\0" /* 1 refs @ 16386 */
+	    "Slave\0" /* 1 refs @ 16391 */
+	    "(AMD)\0" /* 1 refs @ 16397 */
+	    "7751\0" /* 2 refs @ 16403 */
+	    "6500\0" /* 1 refs @ 16408 */
+	    "7811\0" /* 1 refs @ 16413 */
+	    "7951\0" /* 1 refs @ 16418 */
+	    "7954/7955\0" /* 1 refs @ 16423 */
+	    "7956\0" /* 1 refs @ 16433 */
+	    "7814/7851/7854\0" /* 1 refs @ 16438 */
+	    "8065\0" /* 1 refs @ 16453 */
+	    "8165\0" /* 1 refs @ 16458 */
+	    "8154\0" /* 1 refs @ 16463 */
+	    "HB1\0" /* 1 refs @ 16468 */
+	    "HB4\0" /* 2 refs @ 16472 */
+	    "MSVCC01/02/03/04\0" /* 1 refs @ 16476 */
+	    "Cards\0" /* 1 refs @ 16493 */
+	    "SH7751\0" /* 1 refs @ 16499 */
+	    "SH7751R\0" /* 1 refs @ 16506 */
+	    "MCA\0" /* 2 refs @ 16514 */
+	    "-\0" /* 3 refs @ 16518 */
+	    "Alta\0" /* 2 refs @ 16520 */
+	    "Lite\0" /* 1 refs @ 16525 */
+	    "MP\0" /* 1 refs @ 16530 */
+	    "Fire\0" /* 1 refs @ 16533 */
+	    "Coral\0" /* 1 refs @ 16538 */
+	    "ISA\0" /* 5 refs @ 16544 */
+	    "PnP\0" /* 1 refs @ 16548 */
+	    "PowerWave\0" /* 1 refs @ 16552 */
+	    "Idaho\0" /* 1 refs @ 16562 */
+	    "Auto\0" /* 1 refs @ 16568 */
+	    "LANStreamer\0" /* 1 refs @ 16573 */
+	    "GXT-150P\0" /* 1 refs @ 16585 */
+	    "2D\0" /* 1 refs @ 16594 */
+	    "Carrera\0" /* 1 refs @ 16597 */
+	    "82G2675\0" /* 1 refs @ 16605 */
+	    "SCSI-2\0" /* 1 refs @ 16613 */
+	    "82351\0" /* 1 refs @ 16620 */
+	    "Montana/Nevada\0" /* 1 refs @ 16626 */
+	    "Python\0" /* 1 refs @ 16641 */
+	    "(copperhead)\0" /* 1 refs @ 16648 */
+	    "GXT-250P\0" /* 1 refs @ 16661 */
+	    "16/4\0" /* 8 refs @ 16670 */
+	    "Miami/PCI\0" /* 1 refs @ 16675 */
+	    "82660\0" /* 1 refs @ 16685 */
+	    "PowerPC\0" /* 3 refs @ 16691 */
+	    "MPIC\0" /* 1 refs @ 16699 */
+	    "Turboways\0" /* 1 refs @ 16704 */
+	    "25\0" /* 2 refs @ 16714 */
+	    "GXT-500P/GXT550P\0" /* 1 refs @ 16717 */
+	    "i82557B\0" /* 1 refs @ 16734 */
+	    "GXT-800P\0" /* 1 refs @ 16742 */
+	    "EADS\0" /* 1 refs @ 16751 */
+	    "GXT-3000P\0" /* 2 refs @ 16756 */
+	    "Adapter(2)\0" /* 1 refs @ 16766 */
+	    "GXT-2000P\0" /* 1 refs @ 16777 */
+	    "Olympic\0" /* 1 refs @ 16787 */
+	    "CPC710\0" /* 2 refs @ 16795 */
+	    "(PCI64)\0" /* 1 refs @ 16802 */
+	    "(PCI32)\0" /* 1 refs @ 16810 */
+	    "ThinkPad\0" /* 1 refs @ 16818 */
+	    "600X/A20/T20/T22\0" /* 1 refs @ 16827 */
+	    "PPC\0" /* 2 refs @ 16844 */
+	    "405GP\0" /* 1 refs @ 16848 */
+	    "GXT-4000P\0" /* 1 refs @ 16854 */
+	    "GXT-6000P\0" /* 1 refs @ 16864 */
+	    "GXT-300P\0" /* 1 refs @ 16874 */
+	    "133\0" /* 1 refs @ 16883 */
+	    "(morpheus)\0" /* 1 refs @ 16887 */
+	    "440GP\0" /* 1 refs @ 16898 */
+	    "GXT-6500P\0" /* 1 refs @ 16904 */
+	    "GXT-4500P\0" /* 1 refs @ 16914 */
+	    "GXT-135P\0" /* 1 refs @ 16924 */
+	    "4810\0" /* 2 refs @ 16933 */
+	    "BSP\0" /* 1 refs @ 16938 */
+	    "SCC\0" /* 1 refs @ 16942 */
+	    "8k\0" /* 1 refs @ 16946 */
+	    "MPIC-II\0" /* 1 refs @ 16949 */
+	    "Envy24\0" /* 1 refs @ 16957 */
+	    "Envy24PT/HT\0" /* 1 refs @ 16964 */
+	    "Multi-Channel\0" /* 1 refs @ 16976 */
+	    "iTVC15\0" /* 1 refs @ 16990 */
+	    "MPEG2\0" /* 1 refs @ 16997 */
+	    "Codec\0" /* 1 refs @ 17003 */
+	    "77201/77211\0" /* 1 refs @ 17009 */
+	    "(\"NICStAR\")\0" /* 1 refs @ 17021 */
+	    "RC32334\0" /* 1 refs @ 17033 */
+	    "RC32332\0" /* 1 refs @ 17041 */
+	    "PCI-WDT50x\0" /* 1 refs @ 17049 */
+	    "Watchdog\0" /* 6 refs @ 17060 */
+	    "INIC-1622\0" /* 1 refs @ 17069 */
+	    "INIC-920\0" /* 1 refs @ 17079 */
+	    "INIC-850\0" /* 1 refs @ 17088 */
+	    "INIC-1060\0" /* 1 refs @ 17097 */
+	    "INIC-940\0" /* 1 refs @ 17107 */
+	    "INIC-935\0" /* 1 refs @ 17116 */
+	    "INIC-950\0" /* 1 refs @ 17125 */
+	    "IGA\0" /* 2 refs @ 17134 */
+	    "1680\0" /* 1 refs @ 17138 */
+	    "1682\0" /* 1 refs @ 17143 */
+	    "CyberPro\0" /* 2 refs @ 17148 */
+	    "2010\0" /* 1 refs @ 17157 */
+	    "8849\0" /* 1 refs @ 17162 */
+	    "TwinTurbo\0" /* 1 refs @ 17167 */
+	    "128M\0" /* 1 refs @ 17177 */
+	    "Iron\0" /* 6 refs @ 17182 */
+	    "Lake\0" /* 6 refs @ 17187 */
+	    "Centrino\0" /* 28 refs @ 17192 */
+	    "Advanced-N\0" /* 10 refs @ 17201 */
+	    "6205\0" /* 2 refs @ 17212 */
+	    "WiFi\0" /* 14 refs @ 17217 */
+	    "6250\0" /* 2 refs @ 17222 */
+	    "Wireless-N\0" /* 16 refs @ 17227 */
+	    "1030\0" /* 2 refs @ 17238 */
+	    "6230\0" /* 2 refs @ 17243 */
+	    "Sandy\0" /* 13 refs @ 17248 */
+	    "PCIe\0" /* 56 refs @ 17254 */
+	    "Ivy\0" /* 13 refs @ 17259 */
+	    "80312\0" /* 1 refs @ 17263 */
+	    "80321\0" /* 1 refs @ 17269 */
+	    "6700PXH\0" /* 3 refs @ 17275 */
+	    "IOxAPIC\0" /* 3 refs @ 17283 */
+	    "Express-to-PCI\0" /* 6 refs @ 17291 */
+	    "#0\0" /* 11 refs @ 17306 */
+	    "#1\0" /* 16 refs @ 17309 */
+	    "6702PXH\0" /* 1 refs @ 17312 */
+	    "Express-to-PCIX\0" /* 1 refs @ 17320 */
+	    "IOP332\0" /* 2 refs @ 17336 */
+	    "Lindsay\0" /* 1 refs @ 17343 */
+	    "Parallel\0" /* 13 refs @ 17351 */
+	    "IOP333\0" /* 2 refs @ 17360 */
+	    "Haswell\0" /* 7 refs @ 17367 */
+	    "DH89xxCC\0" /* 19 refs @ 17375 */
+	    "Endpoint\0" /* 2 refs @ 17384 */
+	    "QuickAssist\0" /* 4 refs @ 17393 */
+	    "DH89xxCL\0" /* 19 refs @ 17405 */
+	    "DH89XXCC\0" /* 5 refs @ 17414 */
+	    "SGMII\0" /* 1 refs @ 17423 */
+	    "SerDes\0" /* 1 refs @ 17429 */
+	    "backplane\0" /* 1 refs @ 17436 */
+	    "SFP\0" /* 2 refs @ 17446 */
+	    "Function\0" /* 14 refs @ 17450 */
+	    "DH89XXCL\0" /* 1 refs @ 17459 */
+	    "82375EB/SB\0" /* 1 refs @ 17468 */
+	    "82424ZX\0" /* 1 refs @ 17479 */
+	    "82378ZB\0" /* 1 refs @ 17487 */
+	    "82426EX\0" /* 1 refs @ 17495 */
+	    "82434LX/NX\0" /* 1 refs @ 17503 */
+	    "PCI,\0" /* 1 refs @ 17514 */
+	    "(PCMC)\0" /* 1 refs @ 17519 */
+	    "GDT\0" /* 2 refs @ 17526 */
+	    "6150\0" /* 4 refs @ 17530 */
+	    "2230\0" /* 2 refs @ 17535 */
+	    "6235\0" /* 2 refs @ 17540 */
+	    "2200\0" /* 3 refs @ 17545 */
+	    "135\0" /* 2 refs @ 17550 */
+	    "105\0" /* 2 refs @ 17554 */
+	    "130\0" /* 2 refs @ 17558 */
+	    "Quark\0" /* 11 refs @ 17562 */
+	    "X1000\0" /* 11 refs @ 17568 */
+	    "SDIO/eMMC\0" /* 1 refs @ 17574 */
+	    "Band\0" /* 7 refs @ 17584 */
+	    "AC\0" /* 7 refs @ 17589 */
+	    "7260\0" /* 2 refs @ 17592 */
+	    "3160\0" /* 2 refs @ 17597 */
+	    "I2C\0" /* 7 refs @ 17602 */
+	    "GPIO\0" /* 4 refs @ 17606 */
+	    "SPI\0" /* 3 refs @ 17611 */
+	    "HS-UART\0" /* 1 refs @ 17615 */
+	    "MAC\0" /* 1 refs @ 17623 */
+	    "NVMe\0" /* 1 refs @ 17627 */
+	    "SSD\0" /* 3 refs @ 17632 */
+	    "7265\0" /* 2 refs @ 17636 */
+	    "Legacy\0" /* 2 refs @ 17641 */
+	    "i960\0" /* 5 refs @ 17648 */
+	    "RM\0" /* 2 refs @ 17653 */
+	    "RN\0" /* 1 refs @ 17656 */
+	    "Core\0" /* 84 refs @ 17659 */
+	    "4G\0" /* 33 refs @ 17664 */
+	    "(mobile)\0" /* 78 refs @ 17667 */
+	    "Bridge,\0" /* 3 refs @ 17676 */
+	    "(GT1)\0" /* 2 refs @ 17684 */
+	    "Mini\0" /* 2 refs @ 17690 */
+	    "audio\0" /* 2 refs @ 17695 */
+	    "(GT2)\0" /* 1 refs @ 17701 */
+	    "5000\0" /* 17 refs @ 17707 */
+	    "(GT3)\0" /* 1 refs @ 17712 */
+	    "Iris\0" /* 2 refs @ 17718 */
+	    "5100\0" /* 3 refs @ 17723 */
+	    "x16\0" /* 2 refs @ 17728 */
+	    "x8\0" /* 5 refs @ 17732 */
+	    "Xeon\0" /* 71 refs @ 17735 */
+	    "E3-1200\0" /* 1 refs @ 17740 */
+	    "v3\0" /* 71 refs @ 17748 */
+	    "x4\0" /* 7 refs @ 17751 */
+	    "Atom\0" /* 19 refs @ 17754 */
+	    "S1200\0" /* 15 refs @ 17759 */
+	    "Internal\0" /* 5 refs @ 17765 */
+	    "management\0" /* 1 refs @ 17774 */
+	    "Debug\0" /* 2 refs @ 17785 */
+	    "function\0" /* 2 refs @ 17791 */
+	    "0\0" /* 9 refs @ 17800 */
+	    "mass-storage)\0" /* 1 refs @ 17802 */
+	    "(enclosure\0" /* 1 refs @ 17816 */
+	    "maintain)\0" /* 1 refs @ 17827 */
+	    "High-Speed\0" /* 1 refs @ 17837 */
+	    "S1220\0" /* 1 refs @ 17848 */
+	    "S1240\0" /* 1 refs @ 17854 */
+	    "S1260\0" /* 1 refs @ 17860 */
+	    "Bay\0" /* 36 refs @ 17866 */
+	    "Trail\0" /* 36 refs @ 17870 */
+	    "Transaction\0" /* 17 refs @ 17876 */
+	    "Router\0" /* 17 refs @ 17888 */
+	    "(DMA)\0" /* 2 refs @ 17895 */
+	    "(PWM)\0" /* 2 refs @ 17901 */
+	    "(HSUART)\0" /* 2 refs @ 17907 */
+	    "(SPI)\0" /* 1 refs @ 17916 */
+	    "PCU\0" /* 6 refs @ 17922 */
+	    "Storage\0" /* 3 refs @ 17926 */
+	    "Cluster(MMC)\0" /* 1 refs @ 17934 */
+	    "Cluster(SDIO)\0" /* 1 refs @ 17947 */
+	    "Cluster(SD)\0" /* 1 refs @ 17961 */
+	    "Trusted\0" /* 1 refs @ 17973 */
+	    "Execution\0" /* 1 refs @ 17981 */
+	    "Engine\0" /* 6 refs @ 17991 */
+	    "(IDE)\0" /* 2 refs @ 17998 */
+	    "(AHCI)\0" /* 11 refs @ 18004 */
+	    "device\0" /* 1 refs @ 18011 */
+	    "Camera\0" /* 1 refs @ 18018 */
+	    "Signal\0" /* 1 refs @ 18025 */
+	    "(I2C)\0" /* 7 refs @ 18032 */
+	    "PCIE\0" /* 119 refs @ 18038 */
+	    "i82542\0" /* 1 refs @ 18043 */
+	    "i82453GC\0" /* 1 refs @ 18050 */
+	    "1000baseX\0" /* 9 refs @ 18059 */
+	    "i82543GC\0" /* 1 refs @ 18069 */
+	    "i82544EI\0" /* 2 refs @ 18078 */
+	    "i82544GC\0" /* 2 refs @ 18087 */
+	    "(LOM)\0" /* 5 refs @ 18096 */
+	    "i82540EM\0" /* 2 refs @ 18102 */
+	    "i82545EM\0" /* 2 refs @ 18111 */
+	    "i82546EB\0" /* 3 refs @ 18120 */
+	    "i82541EI\0" /* 2 refs @ 18129 */
+	    "i82541ER\0" /* 2 refs @ 18138 */
+	    "i82540EP\0" /* 3 refs @ 18147 */
+	    "Mobile\0" /* 22 refs @ 18156 */
+	    "i82547EI\0" /* 2 refs @ 18163 */
+	    "i82545GM\0" /* 3 refs @ 18172 */
+	    "(SERDES)\0" /* 15 refs @ 18181 */
+	    "PRO/100\0" /* 31 refs @ 18190 */
+	    "InBusiness\0" /* 1 refs @ 18198 */
+	    "VE\0" /* 12 refs @ 18209 */
+	    "VM\0" /* 17 refs @ 18212 */
+	    "82562EH\0" /* 3 refs @ 18215 */
+	    "82562ET/EZ\0" /* 3 refs @ 18223 */
+	    "PHY\0" /* 6 refs @ 18234 */
+	    "(CNR)\0" /* 2 refs @ 18238 */
+	    "82562EM/EX\0" /* 2 refs @ 18244 */
+	    "(MOB)\0" /* 2 refs @ 18255 */
+	    "PRO/Wireless\0" /* 7 refs @ 18261 */
+	    "2100\0" /* 1 refs @ 18274 */
+	    "3B\0" /* 1 refs @ 18279 */
+	    "PRO/10GbE\0" /* 1 refs @ 18282 */
+	    "LR\0" /* 2 refs @ 18292 */
+	    "i82801H\0" /* 8 refs @ 18295 */
+	    "(M_AMT)\0" /* 1 refs @ 18303 */
+	    "(AMT)\0" /* 3 refs @ 18311 */
+	    "(IFE)\0" /* 1 refs @ 18317 */
+	    "82801EB/ER\0" /* 10 refs @ 18323 */
+	    "Connection\0" /* 28 refs @ 18334 */
+	    "M\0" /* 1 refs @ 18345 */
+	    "i82571EB\0" /* 7 refs @ 18347 */
+	    "82801FB\0" /* 4 refs @ 18356 */
+	    "82801GB\0" /* 1 refs @ 18364 */
+	    "i82547GI\0" /* 1 refs @ 18372 */
+	    "i82541GI\0" /* 2 refs @ 18381 */
+	    "i82546GB\0" /* 5 refs @ 18390 */
+	    "i82541PI\0" /* 1 refs @ 18399 */
+	    "i82572EI\0" /* 4 refs @ 18408 */
+	    "PRO/1000MT\0" /* 1 refs @ 18417 */
+	    "(82546GB)\0" /* 1 refs @ 18428 */
+	    "i82573E\0" /* 2 refs @ 18438 */
+	    "82562G\0" /* 1 refs @ 18446 */
+	    "i80003\0" /* 5 refs @ 18453 */
+	    "i82573L\0" /* 1 refs @ 18460 */
+	    "82597EX\0" /* 1 refs @ 18468 */
+	    "CX4\0" /* 3 refs @ 18476 */
+	    "Fiber\0" /* 2 refs @ 18480 */
+	    "i82575EB\0" /* 2 refs @ 18486 */
+	    "dual-1000baseT\0" /* 1 refs @ 18495 */
+	    "dual-1000baseX\0" /* 1 refs @ 18510 */
+	    "(KSP3)\0" /* 1 refs @ 18525 */
+	    "82598\0" /* 9 refs @ 18532 */
+	    "10G\0" /* 8 refs @ 18538 */
+	    "i82571GB\0" /* 1 refs @ 18542 */
+	    "82801I\0" /* 34 refs @ 18551 */
+	    "(G)\0" /* 2 refs @ 18558 */
+	    "(GT)\0" /* 2 refs @ 18562 */
+	    "IFE\0" /* 2 refs @ 18567 */
+	    "82576\0" /* 10 refs @ 18571 */
+	    "1000BaseT\0" /* 6 refs @ 18577 */
+	    "(MV)\0" /* 1 refs @ 18587 */
+	    "i82567LM-2\0" /* 1 refs @ 18592 */
+	    "i82567LF-2\0" /* 1 refs @ 18603 */
+	    "i82567V-2\0" /* 1 refs @ 18614 */
+	    "i82574L\0" /* 1 refs @ 18624 */
+	    "i82571PT\0" /* 1 refs @ 18632 */
+	    "quad-1000baseT\0" /* 2 refs @ 18641 */
+	    "i82575GB\0" /* 2 refs @ 18656 */
+	    "dual\0" /* 1 refs @ 18665 */
+	    "giabit\0" /* 2 refs @ 18670 */
+	    "qual\0" /* 1 refs @ 18677 */
+	    "82598EB\0" /* 3 refs @ 18682 */
+	    "i82567LM-3\0" /* 1 refs @ 18690 */
+	    "i82567LF-3\0" /* 1 refs @ 18701 */
+	    "SR\0" /* 1 refs @ 18712 */
+	    "Quad-1000baseT\0" /* 1 refs @ 18715 */
+	    "(PM)\0" /* 1 refs @ 18730 */
+	    "i82567LM-4\0" /* 1 refs @ 18735 */
+	    "1000BaseX\0" /* 2 refs @ 18746 */
+	    "gigabit\0" /* 4 refs @ 18756 */
+	    "quad-1000BaseT\0" /* 2 refs @ 18764 */
+	    "PCH\0" /* 30 refs @ 18779 */
+	    "(82577LM)\0" /* 1 refs @ 18783 */
+	    "(82577LC)\0" /* 1 refs @ 18793 */
+	    "82599\0" /* 17 refs @ 18803 */
+	    "(82578DM)\0" /* 1 refs @ 18809 */
+	    "(82578DC)\0" /* 1 refs @ 18819 */
+	    "DA\0" /* 1 refs @ 18829 */
+	    "XF\0" /* 1 refs @ 18832 */
+	    "82574L\0" /* 1 refs @ 18835 */
+	    "(KX/KX4)\0" /* 1 refs @ 18842 */
+	    "GbE\0" /* 14 refs @ 18851 */
+	    "(combined\0" /* 1 refs @ 18855 */
+	    "backplane;\0" /* 1 refs @ 18865 */
+	    "KR/KX4/KX)\0" /* 1 refs @ 18876 */
+	    "(CX4)\0" /* 1 refs @ 18887 */
+	    "(SFI/SFP+)\0" /* 1 refs @ 18893 */
+	    "(XAUI/BX4)\0" /* 1 refs @ 18904 */
+	    "82552\0" /* 1 refs @ 18915 */
+	    "82815\0" /* 10 refs @ 18921 */
+	    "82806AA\0" /* 1 refs @ 18927 */
+	    "PCI64\0" /* 1 refs @ 18935 */
+	    "Programmable\0" /* 2 refs @ 18941 */
+	    "Interrupt\0" /* 5 refs @ 18954 */
+	    "ADI\0" /* 1 refs @ 18964 */
+	    "i80200\0" /* 1 refs @ 18968 */
+	    "Big\0" /* 1 refs @ 18975 */
+	    "Endian\0" /* 1 refs @ 18979 */
+	    "IXP1200\0" /* 1 refs @ 18986 */
+	    "82559ER\0" /* 1 refs @ 18994 */
+	    "82092AA\0" /* 1 refs @ 19002 */
+	    "SAA7116\0" /* 1 refs @ 19010 */
+	    "82452KX/GX\0" /* 1 refs @ 19018 */
+	    "Orion\0" /* 1 refs @ 19029 */
+	    "Extended\0" /* 2 refs @ 19035 */
+	    "82596\0" /* 1 refs @ 19044 */
+	    "EE\0" /* 2 refs @ 19050 */
+	    "8255x\0" /* 1 refs @ 19053 */
+	    "82437FX\0" /* 1 refs @ 19059 */
+	    "(TSC)\0" /* 1 refs @ 19067 */
+	    "82371FB\0" /* 2 refs @ 19073 */
+	    "(PIIX)\0" /* 2 refs @ 19081 */
+	    "82371MX\0" /* 1 refs @ 19088 */
+	    "(MPIIX)\0" /* 1 refs @ 19096 */
+	    "Xcelerator\0" /* 1 refs @ 19104 */
+	    "82437MX\0" /* 1 refs @ 19115 */
+	    "(MTSC)\0" /* 1 refs @ 19123 */
+	    "82441FX\0" /* 1 refs @ 19130 */
+	    "(PMC)\0" /* 1 refs @ 19138 */
+	    "82380AB\0" /* 1 refs @ 19144 */
+	    "(MISA)\0" /* 1 refs @ 19152 */
+	    "82380FB\0" /* 1 refs @ 19159 */
+	    "(MPCI2)\0" /* 1 refs @ 19167 */
+	    "82439HX\0" /* 1 refs @ 19175 */
+	    "(TXC)\0" /* 1 refs @ 19183 */
+	    "82870P2\0" /* 3 refs @ 19189 */
+	    "P64H2\0" /* 3 refs @ 19197 */
+	    "Hot\0" /* 1 refs @ 19203 */
+	    "Plug\0" /* 1 refs @ 19207 */
+	    "i82567V-3\0" /* 1 refs @ 19212 */
+	    "82579LM\0" /* 1 refs @ 19222 */
+	    "82579V\0" /* 1 refs @ 19230 */
+	    "BX\0" /* 1 refs @ 19237 */
+	    "AT2\0" /* 1 refs @ 19240 */
+	    "i82583V\0" /* 1 refs @ 19244 */
+	    "quad-gigabit\0" /* 1 refs @ 19252 */
+	    "82580\0" /* 8 refs @ 19265 */
+	    "(SGMII)\0" /* 2 refs @ 19271 */
+	    "KX4\0" /* 1 refs @ 19279 */
+	    "Mezzanine\0" /* 1 refs @ 19283 */
+	    "X540\0" /* 3 refs @ 19293 */
+	    "dual-1000BaseT\0" /* 2 refs @ 19298 */
+	    "KR\0" /* 1 refs @ 19313 */
+	    "I350\0" /* 7 refs @ 19316 */
+	    "Backplane\0" /* 2 refs @ 19321 */
+	    "82567V\0" /* 1 refs @ 19331 */
+	    "quad-1000BaseX\0" /* 1 refs @ 19338 */
+	    "X540-AT2\0" /* 1 refs @ 19353 */
+	    "10Gbase-T\0" /* 1 refs @ 19362 */
+	    "FCoE\0" /* 2 refs @ 19372 */
+	    "I210-T1\0" /* 1 refs @ 19377 */
+	    "I210\0" /* 7 refs @ 19385 */
+	    "(COPPER\0" /* 2 refs @ 19390 */
+	    "OEM)\0" /* 1 refs @ 19398 */
+	    "IT)\0" /* 1 refs @ 19403 */
+	    "(FIBER)\0" /* 1 refs @ 19407 */
+	    "I211\0" /* 1 refs @ 19415 */
+	    "(COPPER)\0" /* 2 refs @ 19420 */
+	    "I217-LM\0" /* 1 refs @ 19429 */
+	    "I217-V\0" /* 1 refs @ 19437 */
+	    "XL710\0" /* 9 refs @ 19444 */
+	    "(SFP+)\0" /* 1 refs @ 19450 */
+	    "I218-V\0" /* 3 refs @ 19457 */
+	    "I218-LM\0" /* 3 refs @ 19464 */
+	    "Bypass\0" /* 2 refs @ 19472 */
+	    "SFP+\0" /* 1 refs @ 19479 */
+	    "KX\0" /* 3 refs @ 19484 */
+	    "40GbE\0" /* 3 refs @ 19487 */
+	    "QSFP+\0" /* 3 refs @ 19493 */
+	    "X710\0" /* 1 refs @ 19499 */
+	    "10GBaseT\0" /* 1 refs @ 19504 */
+	    "5G\0" /* 37 refs @ 19513 */
+	    "5500\0" /* 3 refs @ 19516 */
+	    "6000\0" /* 1 refs @ 19521 */
+	    "6100\0" /* 1 refs @ 19526 */
+	    "ROB-in\0" /* 1 refs @ 19531 */
+	    "i960RP\0" /* 1 refs @ 19538 */
+	    "Microprocessor\0" /* 1 refs @ 19545 */
+	    "82840\0" /* 3 refs @ 19560 */
+	    "82845\0" /* 2 refs @ 19566 */
+	    "DMA\0" /* 22 refs @ 19572 */
+	    "Thermal\0" /* 14 refs @ 19576 */
+	    "DMI-PCI\0" /* 1 refs @ 19584 */
+	    "MEI\0" /* 20 refs @ 19592 */
+	    "KT\0" /* 22 refs @ 19596 */
+	    "Z68\0" /* 1 refs @ 19599 */
+	    "P67\0" /* 1 refs @ 19603 */
+	    "UM67\0" /* 1 refs @ 19607 */
+	    "HM65\0" /* 1 refs @ 19612 */
+	    "H67\0" /* 1 refs @ 19617 */
+	    "HM67\0" /* 1 refs @ 19621 */
+	    "Q65\0" /* 1 refs @ 19626 */
+	    "QS67\0" /* 1 refs @ 19630 */
+	    "Q67\0" /* 1 refs @ 19635 */
+	    "QM67\0" /* 1 refs @ 19639 */
+	    "B65\0" /* 1 refs @ 19644 */
+	    "C202\0" /* 1 refs @ 19648 */
+	    "C204\0" /* 1 refs @ 19653 */
+	    "C206\0" /* 1 refs @ 19658 */
+	    "H61\0" /* 1 refs @ 19663 */
+	    "C600/X79\0" /* 15 refs @ 19667 */
+	    "Premium\0" /* 4 refs @ 19676 */
+	    "C600\0" /* 26 refs @ 19684 */
+	    "(SATA)\0" /* 4 refs @ 19689 */
+	    "C606/C608\0" /* 1 refs @ 19696 */
+	    "C608\0" /* 1 refs @ 19706 */
+	    "7\0" /* 31 refs @ 19711 */
+	    "(desktop)\0" /* 12 refs @ 19713 */
+	    "(RAID)\0" /* 21 refs @ 19723 */
+	    "IDE-R\0" /* 6 refs @ 19730 */
+	    "Z77\0" /* 1 refs @ 19736 */
+	    "Z75\0" /* 1 refs @ 19740 */
+	    "Q77\0" /* 1 refs @ 19744 */
+	    "Q75\0" /* 1 refs @ 19748 */
+	    "B75\0" /* 1 refs @ 19752 */
+	    "H77\0" /* 1 refs @ 19756 */
+	    "C216\0" /* 1 refs @ 19760 */
+	    "QM77\0" /* 1 refs @ 19765 */
+	    "QS77\0" /* 1 refs @ 19770 */
+	    "HM77\0" /* 1 refs @ 19775 */
+	    "UM77\0" /* 1 refs @ 19780 */
+	    "HM76\0" /* 1 refs @ 19785 */
+	    "HM75\0" /* 1 refs @ 19790 */
+	    "HM70\0" /* 1 refs @ 19795 */
+	    "NM70\0" /* 1 refs @ 19800 */
+	    "C2000\0" /* 37 refs @ 19805 */
+	    "RAS\0" /* 6 refs @ 19811 */
+	    "RCEC\0" /* 1 refs @ 19815 */
+	    "IQIA\0" /* 2 refs @ 19820 */
+	    "Physical\0" /* 1 refs @ 19825 */
+	    "SATA2\0" /* 1 refs @ 19834 */
+	    "SATA3\0" /* 1 refs @ 19840 */
+	    "Ethernet(1000BASE-KX)\0" /* 1 refs @ 19846 */
+	    "Ethernet(SGMII)\0" /* 1 refs @ 19868 */
+	    "Ethernet(Dummy\0" /* 1 refs @ 19884 */
+	    "function)\0" /* 1 refs @ 19899 */
+	    "Ethernet(2.5Gbe)\0" /* 1 refs @ 19909 */
+	    "Subsystem\0" /* 2 refs @ 19926 */
+	    "Reset\0" /* 2 refs @ 19936 */
+	    "82801AA\0" /* 7 refs @ 19942 */
+	    "AC-97\0" /* 17 refs @ 19950 */
+	    "Hub-PCI\0" /* 5 refs @ 19956 */
+	    "82801AB\0" /* 7 refs @ 19964 */
+	    "82801BA\0" /* 9 refs @ 19972 */
+	    "82801BAM\0" /* 3 refs @ 19980 */
+	    "82801E\0" /* 4 refs @ 19989 */
+	    "82801CA\0" /* 9 refs @ 19996 */
+	    "82801CAM\0" /* 1 refs @ 20004 */
+	    "82801DB\0" /* 10 refs @ 20013 */
+	    "UHCI\0" /* 44 refs @ 20021 */
+	    "82801DBM\0" /* 1 refs @ 20026 */
+	    "(UltraATA/100)\0" /* 1 refs @ 20035 */
+	    "82801EB\0" /* 3 refs @ 20050 */
+	    "82801ER\0" /* 1 refs @ 20058 */
+	    "82820\0" /* 2 refs @ 20066 */
+	    "MCH\0" /* 16 refs @ 20072 */
+	    "(Camino)\0" /* 1 refs @ 20076 */
+	    "82850\0" /* 1 refs @ 20085 */
+	    "82860\0" /* 5 refs @ 20091 */
+	    "82850/82860\0" /* 1 refs @ 20097 */
+	    "E7500\0" /* 8 refs @ 20109 */
+	    "HI_B\0" /* 4 refs @ 20115 */
+	    "vppb\0" /* 6 refs @ 20120 */
+	    "HI_C\0" /* 2 refs @ 20125 */
+	    "HI_D\0" /* 2 refs @ 20130 */
+	    "E7501\0" /* 1 refs @ 20135 */
+	    "E7505\0" /* 5 refs @ 20141 */
+	    "Host-AGP\0" /* 5 refs @ 20147 */
+	    "Error\0" /* 3 refs @ 20156 */
+	    "Reporting\0" /* 3 refs @ 20162 */
+	    "82845G/GL\0" /* 3 refs @ 20172 */
+	    "Host-Hub\0" /* 2 refs @ 20182 */
+	    "I/F\0" /* 2 refs @ 20191 */
+	    "82865\0" /* 2 refs @ 20195 */
+	    "82865G\0" /* 1 refs @ 20201 */
+	    "82875P\0" /* 3 refs @ 20208 */
+	    "PCI-CSA\0" /* 1 refs @ 20215 */
+	    "82915P/G/GL\0" /* 2 refs @ 20223 */
+	    "82915G/GL\0" /* 2 refs @ 20235 */
+	    "82925X\0" /* 2 refs @ 20245 */
+	    "E7221\0" /* 2 refs @ 20252 */
+	    "82915PM/GM/GMS,82910GML\0" /* 1 refs @ 20258 */
+	    "82915PM/GM\0" /* 1 refs @ 20282 */
+	    "82915GM/GMS,82910GML\0" /* 1 refs @ 20293 */
+	    "6300ESB\0" /* 13 refs @ 20314 */
+	    "5000X\0" /* 2 refs @ 20322 */
+	    "5000Z\0" /* 1 refs @ 20328 */
+	    "ESI\0" /* 5 refs @ 20334 */
+	    "5000V\0" /* 1 refs @ 20338 */
+	    "5000P\0" /* 1 refs @ 20344 */
+	    "FSB\0" /* 1 refs @ 20350 */
+	    "Registers\0" /* 30 refs @ 20354 */
+	    "Reserved\0" /* 4 refs @ 20364 */
+	    "FBD\0" /* 2 refs @ 20373 */
+	    "2-3\0" /* 7 refs @ 20377 */
+	    "4-5\0" /* 1 refs @ 20381 */
+	    "6-7\0" /* 1 refs @ 20385 */
+	    "4-7\0" /* 1 refs @ 20389 */
+	    "82801FBM\0" /* 2 refs @ 20393 */
+	    "ICH6M\0" /* 1 refs @ 20402 */
+	    "82801FR\0" /* 1 refs @ 20408 */
+	    "82801FB/FR\0" /* 13 refs @ 20416 */
+	    "#2\0" /* 7 refs @ 20427 */
+	    "High\0" /* 23 refs @ 20430 */
+	    "Definition\0" /* 23 refs @ 20435 */
+	    "63xxESB\0" /* 21 refs @ 20446 */
+	    "#3\0" /* 6 refs @ 20454 */
+	    "#4\0" /* 5 refs @ 20457 */
+	    "82945G/P\0" /* 3 refs @ 20460 */
+	    "82955X\0" /* 2 refs @ 20469 */
+	    "E7230\0" /* 2 refs @ 20476 */
+	    "82975X\0" /* 3 refs @ 20482 */
+	    "IGD\0" /* 2 refs @ 20489 */
+	    "82915GM/GMS\0" /* 1 refs @ 20493 */
+	    "82945GM/PM/GMS\0" /* 3 refs @ 20505 */
+	    "82945GME\0" /* 2 refs @ 20520 */
+	    "82801GH\0" /* 1 refs @ 20529 */
+	    "82801GB/GR\0" /* 21 refs @ 20537 */
+	    "82801GBM\0" /* 2 refs @ 20548 */
+	    "NM10\0" /* 1 refs @ 20557 */
+	    "82801GHM\0" /* 2 refs @ 20562 */
+	    "82801GBM/GHM\0" /* 1 refs @ 20571 */
+	    "#5\0" /* 3 refs @ 20584 */
+	    "#6\0" /* 3 refs @ 20587 */
+	    "82801H\0" /* 23 refs @ 20590 */
+	    "82801HEM\0" /* 2 refs @ 20597 */
+	    "82801HH\0" /* 1 refs @ 20606 */
+	    "82801HO\0" /* 1 refs @ 20614 */
+	    "82801HBM\0" /* 2 refs @ 20622 */
+	    "ports\0" /* 10 refs @ 20631 */
+	    "82081HBM\0" /* 1 refs @ 20637 */
+	    "82801IH\0" /* 1 refs @ 20646 */
+	    "82801IO\0" /* 1 refs @ 20654 */
+	    "82801IR\0" /* 1 refs @ 20662 */
+	    "82801IEM\0" /* 1 refs @ 20670 */
+	    "82801IB\0" /* 1 refs @ 20679 */
+	    "82801IM\0" /* 1 refs @ 20687 */
+	    "with\0" /* 3 refs @ 20695 */
+	    "(C)\0" /* 1 refs @ 20700 */
+	    "82946GZ\0" /* 3 refs @ 20704 */
+	    "82G35\0" /* 3 refs @ 20712 */
+	    "82965Q\0" /* 4 refs @ 20718 */
+	    "82Q965\0" /* 1 refs @ 20725 */
+	    "82965G\0" /* 4 refs @ 20732 */
+	    "82P965/G965\0" /* 1 refs @ 20739 */
+	    "82Q35\0" /* 9 refs @ 20751 */
+	    "82G33/P35\0" /* 1 refs @ 20757 */
+	    "82G33\0" /* 3 refs @ 20767 */
+	    "82G33/G31/P35/P31\0" /* 1 refs @ 20773 */
+	    "82Q33\0" /* 1 refs @ 20791 */
+	    "82X38\0" /* 5 refs @ 20797 */
+	    "Host-Primary\0" /* 1 refs @ 20803 */
+	    "HECI\0" /* 1 refs @ 20816 */
+	    "Host-Secondary\0" /* 1 refs @ 20821 */
+	    "3200/3210\0" /* 2 refs @ 20836 */
+	    "82965PM\0" /* 5 refs @ 20846 */
+	    "80862A01\0" /* 1 refs @ 20854 */
+	    "82965PM/GM\0" /* 1 refs @ 20863 */
+	    "82965GME\0" /* 3 refs @ 20874 */
+	    "82GM45\0" /* 4 refs @ 20883 */
+	    "82IGD_E\0" /* 2 refs @ 20890 */
+	    "82Q45\0" /* 6 refs @ 20898 */
+	    "82G45\0" /* 2 refs @ 20904 */
+	    "82G41\0" /* 2 refs @ 20910 */
+	    "82B43\0" /* 2 refs @ 20916 */
+	    "E5\0" /* 92 refs @ 20922 */
+	    "DMI2\0" /* 2 refs @ 20925 */
+	    "in\0" /* 2 refs @ 20930 */
+	    "Mode\0" /* 1 refs @ 20933 */
+	    "Scratchpad\0" /* 5 refs @ 20938 */
+	    "Semaphores\0" /* 3 refs @ 20949 */
+	    "QDT\0" /* 8 refs @ 20960 */
+	    "Map,\0" /* 1 refs @ 20964 */
+	    "VTd,\0" /* 1 refs @ 20969 */
+	    "SMM\0" /* 1 refs @ 20974 */
+	    "RAS,\0" /* 1 refs @ 20978 */
+	    "CS,\0" /* 1 refs @ 20983 */
+	    "Errors\0" /* 1 refs @ 20987 */
+	    "APIC\0" /* 3 refs @ 20994 */
+	    "Performance\0" /* 2 refs @ 20999 */
+	    "Monitoring\0" /* 3 refs @ 21011 */
+	    "QPI\0" /* 7 refs @ 21022 */
+	    "IMC\0" /* 34 refs @ 21026 */
+	    "Main\0" /* 2 refs @ 21030 */
+	    "Ch\0" /* 18 refs @ 21035 */
+	    "0-1\0" /* 12 refs @ 21038 */
+	    "Decode\0" /* 6 refs @ 21042 */
+	    "Ras\0" /* 1 refs @ 21049 */
+	    "Unit\0" /* 11 refs @ 21053 */
+	    "DDRIO\0" /* 12 refs @ 21058 */
+	    "Multicast\0" /* 6 refs @ 21064 */
+	    "3165\0" /* 1 refs @ 21074 */
+	    "31244\0" /* 1 refs @ 21079 */
+	    "82855PM\0" /* 3 refs @ 21085 */
+	    "X58\0" /* 2 refs @ 21093 */
+	    "DMI\0" /* 3 refs @ 21097 */
+	    "5520\0" /* 1 refs @ 21101 */
+	    "5520/5500/X58\0" /* 21 refs @ 21106 */
+	    "Scratchpads\0" /* 1 refs @ 21120 */
+	    "QuickPath\0" /* 4 refs @ 21132 */
+	    "Misc\0" /* 1 refs @ 21142 */
+	    "Throttling\0" /* 1 refs @ 21147 */
+	    "Upstream\0" /* 1 refs @ 21158 */
+	    "Downstream\0" /* 3 refs @ 21167 */
+	    "82830MP\0" /* 4 refs @ 21178 */
+	    "82855GM\0" /* 5 refs @ 21186 */
+	    "GMCH\0" /* 3 refs @ 21194 */
+	    "Process\0" /* 1 refs @ 21199 */
+	    "E7525\0" /* 5 refs @ 21207 */
+	    "E7520\0" /* 5 refs @ 21213 */
+	    "A1\0" /* 1 refs @ 21219 */
+	    "C1\0" /* 1 refs @ 21222 */
+	    "82801JD\0" /* 23 refs @ 21225 */
+	    "(RAID\0" /* 2 refs @ 21233 */
+	    "82801JDO\0" /* 1 refs @ 21239 */
+	    "82801JIR\0" /* 1 refs @ 21248 */
+	    "82801JIB\0" /* 1 refs @ 21257 */
+	    "82801JI\0" /* 22 refs @ 21266 */
+	    "P55\0" /* 1 refs @ 21274 */
+	    "PM55\0" /* 1 refs @ 21278 */
+	    "H55\0" /* 1 refs @ 21283 */
+	    "QM57\0" /* 1 refs @ 21287 */
+	    "H57\0" /* 1 refs @ 21292 */
+	    "HM55\0" /* 1 refs @ 21296 */
+	    "Q57\0" /* 1 refs @ 21301 */
+	    "HM57\0" /* 1 refs @ 21305 */
+	    "QS57\0" /* 2 refs @ 21310 */
+	    "3420\0" /* 1 refs @ 21315 */
+	    "3450\0" /* 1 refs @ 21320 */
+	    "ECHI\0" /* 1 refs @ 21325 */
+	    "PT\0" /* 1 refs @ 21330 */
+	    "IDER\0" /* 1 refs @ 21333 */
+	    "5400\0" /* 15 refs @ 21338 */
+	    "5400A\0" /* 1 refs @ 21343 */
+	    "5400B\0" /* 1 refs @ 21349 */
+	    "I/OAT\0" /* 1 refs @ 21355 */
+	    "SNB\0" /* 1 refs @ 21361 */
+	    "FSB/Boot/Interrupt\0" /* 1 refs @ 21365 */
+	    "Coherency\0" /* 1 refs @ 21384 */
+	    "E600\0" /* 8 refs @ 21394 */
+	    "2200BG\0" /* 1 refs @ 21399 */
+	    "2225BG\0" /* 1 refs @ 21406 */
+	    "3945ABG\0" /* 2 refs @ 21413 */
+	    "2915ABG\0" /* 2 refs @ 21421 */
+	    "4965\0" /* 4 refs @ 21429 */
+	    "Ultimate-N\0" /* 2 refs @ 21434 */
+	    "6300\0" /* 2 refs @ 21445 */
+	    "6200\0" /* 3 refs @ 21450 */
+	    "5350\0" /* 2 refs @ 21455 */
+	    "5150\0" /* 2 refs @ 21460 */
+	    "EP80579\0" /* 24 refs @ 21465 */
+	    "EDMA\0" /* 1 refs @ 21473 */
+	    "ASU\0" /* 1 refs @ 21478 */
+	    "CANbus\0" /* 2 refs @ 21482 */
+	    "1588\0" /* 1 refs @ 21489 */
+	    "LEB\0" /* 1 refs @ 21494 */
+	    "GCU\0" /* 1 refs @ 21498 */
+	    "80310\0" /* 1 refs @ 21502 */
+	    "ATU\0" /* 1 refs @ 21508 */
+	    "82371SB\0" /* 3 refs @ 21512 */
+	    "(PIIX3)\0" /* 3 refs @ 21520 */
+	    "82437VX\0" /* 1 refs @ 21528 */
+	    "(TVX)\0" /* 1 refs @ 21536 */
+	    "82439TX\0" /* 1 refs @ 21542 */
+	    "(MTXC)\0" /* 1 refs @ 21550 */
+	    "82371AB\0" /* 4 refs @ 21557 */
+	    "(PIIX4)\0" /* 4 refs @ 21565 */
+	    "82810\0" /* 2 refs @ 21573 */
+	    "82810-DC100\0" /* 2 refs @ 21579 */
+	    "82810E\0" /* 2 refs @ 21591 */
+	    "82443LX\0" /* 2 refs @ 21598 */
+	    "82443BX\0" /* 3 refs @ 21606 */
+	    "Bridge/Controller\0" /* 6 refs @ 21614 */
+	    "disabled)\0" /* 2 refs @ 21632 */
+	    "82443MX\0" /* 6 refs @ 21642 */
+	    "82443GX\0" /* 3 refs @ 21650 */
+	    "i740\0" /* 1 refs @ 21658 */
+	    "SCH\0" /* 1 refs @ 21663 */
+	    "Graphic\0" /* 1 refs @ 21667 */
+	    "Display\0" /* 1 refs @ 21675 */
+	    "E6xx\0" /* 1 refs @ 21683 */
+	    "82454KX/GX\0" /* 1 refs @ 21688 */
+	    "(PB)\0" /* 1 refs @ 21699 */
+	    "82451KX/GX\0" /* 1 refs @ 21704 */
+	    "(MC)\0" /* 1 refs @ 21715 */
+	    "82451NX\0" /* 2 refs @ 21720 */
+	    "(MIOC)\0" /* 1 refs @ 21728 */
+	    "Expander\0" /* 1 refs @ 21735 */
+	    "(PXB)\0" /* 1 refs @ 21744 */
+	    "EG20T\0" /* 26 refs @ 21750 */
+	    "PCIExpress\0" /* 1 refs @ 21756 */
+	    "Ether\0" /* 1 refs @ 21767 */
+	    "SDIO\0" /* 4 refs @ 21773 */
+	    "DMAC\0" /* 2 refs @ 21778 */
+	    "CAN\0" /* 2 refs @ 21783 */
+	    "IEEE1588\0" /* 1 refs @ 21787 */
+	    "+\0" /* 3 refs @ 21796 */
+	    "Response\0" /* 3 refs @ 21798 */
+	    "(RAID1)\0" /* 3 refs @ 21807 */
+	    "Full\0" /* 3 refs @ 21815 */
+	    "Featured\0" /* 3 refs @ 21820 */
+	    "ES\0" /* 3 refs @ 21829 */
+	    "Desktop\0" /* 1 refs @ 21832 */
+	    "Z87\0" /* 1 refs @ 21840 */
+	    "Z85\0" /* 1 refs @ 21844 */
+	    "HM86\0" /* 1 refs @ 21848 */
+	    "H87\0" /* 1 refs @ 21853 */
+	    "HM87\0" /* 1 refs @ 21857 */
+	    "Q85\0" /* 1 refs @ 21862 */
+	    "Q87\0" /* 1 refs @ 21866 */
+	    "QM87\0" /* 1 refs @ 21870 */
+	    "B85\0" /* 1 refs @ 21875 */
+	    "C222\0" /* 1 refs @ 21879 */
+	    "C224\0" /* 1 refs @ 21884 */
+	    "C226\0" /* 1 refs @ 21889 */
+	    "H81\0" /* 1 refs @ 21894 */
+	    "Z97\0" /* 1 refs @ 21898 */
+	    "H97\0" /* 1 refs @ 21902 */
+	    "C61x/X99\0" /* 43 refs @ 21906 */
+	    "sSATA\0" /* 4 refs @ 21915 */
+	    "X99\0" /* 2 refs @ 21921 */
+	    "SPSR\0" /* 1 refs @ 21925 */
+	    "MS\0" /* 3 refs @ 21930 */
+	    "SMbus\0" /* 3 refs @ 21933 */
+	    "GSPI\0" /* 4 refs @ 21939 */
+	    "RRT\0" /* 1 refs @ 21944 */
+	    "Only\0" /* 1 refs @ 21948 */
+	    "ME\0" /* 2 refs @ 21953 */
+	    "Pineview\0" /* 5 refs @ 21956 */
+	    "S21152BB\0" /* 1 refs @ 21965 */
+	    "S21152BA,S21154AE/BE\0" /* 1 refs @ 21974 */
+	    "21555\0" /* 1 refs @ 21995 */
+	    "Non-Transparent\0" /* 1 refs @ 22001 */
+	    "(x16\0" /* 1 refs @ 22017 */
+	    "max)\0" /* 2 refs @ 22022 */
+	    "(x8\0" /* 1 refs @ 22027 */
+	    "Routing\0" /* 1 refs @ 22031 */
+	    "Protocol\0" /* 1 refs @ 22039 */
+	    "Semaphore\0" /* 1 refs @ 22048 */
+	    "HANKSVILLE\0" /* 1 refs @ 22058 */
+	    "Powerstorm\0" /* 2 refs @ 22069 */
+	    "4D50T\0" /* 1 refs @ 22080 */
+	    "4D60T\0" /* 1 refs @ 22086 */
+	    "PRISM2.5\0" /* 1 refs @ 22092 */
+	    "PRISM\0" /* 2 refs @ 22101 */
+	    "Indigo\0" /* 1 refs @ 22107 */
+	    "Duette\0" /* 1 refs @ 22114 */
+	    "AEON\0" /* 1 refs @ 22121 */
+	    "CBIDE2/CI-iCN\0" /* 1 refs @ 22126 */
+	    "NinjaATA-32Bi\0" /* 3 refs @ 22140 */
+	    "CBSCII\0" /* 1 refs @ 22154 */
+	    "NinjaSCSI-32Bi\0" /* 3 refs @ 22161 */
+	    "RSA-PCI\0" /* 1 refs @ 22176 */
+	    "GV-BCTV5DL/PCI\0" /* 1 refs @ 22184 */
+	    "TV\0" /* 1 refs @ 22199 */
+	    "tuner\0" /* 1 refs @ 22202 */
+	    "IT8152\0" /* 1 refs @ 22208 */
+	    "IT8211\0" /* 1 refs @ 22215 */
+	    "IT8212\0" /* 1 refs @ 22222 */
+	    "IT8213\0" /* 1 refs @ 22229 */
+	    "AGX016\0" /* 1 refs @ 22236 */
+	    "ITT3204\0" /* 1 refs @ 22243 */
+	    "JMB360\0" /* 1 refs @ 22251 */
+	    "JMB361\0" /* 1 refs @ 22258 */
+	    "SATA/PATA\0" /* 4 refs @ 22265 */
+	    "JMB362\0" /* 1 refs @ 22275 */
+	    "JMB363\0" /* 1 refs @ 22282 */
+	    "JMB365\0" /* 1 refs @ 22289 */
+	    "JMB366\0" /* 1 refs @ 22296 */
+	    "JMB368\0" /* 1 refs @ 22303 */
+	    "PATA\0" /* 1 refs @ 22310 */
+	    "JMB38X\0" /* 4 refs @ 22315 */
+	    "SD/MMC\0" /* 4 refs @ 22322 */
+	    "Stick\0" /* 4 refs @ 22329 */
+	    "xD\0" /* 3 refs @ 22335 */
+	    "JMB388\0" /* 4 refs @ 22338 */
+	    "JMC250\0" /* 1 refs @ 22345 */
+	    "JMC260\0" /* 1 refs @ 22352 */
+	    "JNIC-1460\0" /* 1 refs @ 22359 */
+	    "Fibre-Channel\0" /* 5 refs @ 22369 */
+	    "JNIC-1560\0" /* 1 refs @ 22383 */
+	    "FCI-1063\0" /* 1 refs @ 22393 */
+	    "FCX2-6562\0" /* 1 refs @ 22402 */
+	    "FCX-6562\0" /* 1 refs @ 22412 */
+	    "Experimental\0" /* 1 refs @ 22421 */
+	    "Clock\0" /* 1 refs @ 22434 */
+	    "Version\0" /* 1 refs @ 22440 */
+	    "HSSI\0" /* 1 refs @ 22448 */
+	    "DS3\0" /* 1 refs @ 22453 */
+	    "SSI\0" /* 1 refs @ 22457 */
+	    "DS1\0" /* 1 refs @ 22461 */
+	    "805\0" /* 1 refs @ 22465 */
+	    "LXT-1001\0" /* 1 refs @ 22469 */
+	    "DVB\0" /* 2 refs @ 22478 */
+	    "Transmitter\0" /* 1 refs @ 22482 */
+	    "Receiver\0" /* 1 refs @ 22494 */
+	    "EG1032\0" /* 1 refs @ 22503 */
+	    "v2\0" /* 2 refs @ 22510 */
+	    "Instant\0" /* 2 refs @ 22513 */
+	    "EG1064\0" /* 1 refs @ 22521 */
+	    "PCMPC200\0" /* 1 refs @ 22528 */
+	    "IPN\0" /* 1 refs @ 22537 */
+	    "2220\0" /* 1 refs @ 22541 */
+	    "(rev\0" /* 1 refs @ 22546 */
+	    "01)\0" /* 1 refs @ 22551 */
+	    "82C168/82C169\0" /* 1 refs @ 22555 */
+	    "(PNIC)\0" /* 1 refs @ 22569 */
+	    "82C115\0" /* 1 refs @ 22576 */
+	    "(PNIC\0" /* 1 refs @ 22583 */
+	    "II)\0" /* 2 refs @ 22589 */
+	    "K56flex\0" /* 2 refs @ 22593 */
+	    "DSVD\0" /* 1 refs @ 22601 */
+	    "LTMODEM\0" /* 26 refs @ 22606 */
+	    "Venus\0" /* 1 refs @ 22614 */
+	    "ORCA\0" /* 2 refs @ 22620 */
+	    "FPGA\0" /* 2 refs @ 22625 */
+	    "32-bit\0" /* 1 refs @ 22630 */
+	    "ASIC\0" /* 2 refs @ 22637 */
+	    "64-bit\0" /* 1 refs @ 22642 */
+	    "FW322/323\0" /* 1 refs @ 22649 */
+	    "FW643\0" /* 1 refs @ 22659 */
+	    "1394b\0" /* 1 refs @ 22665 */
+	    "ET1310\0" /* 1 refs @ 22671 */
+	    "ET1301\0" /* 1 refs @ 22678 */
+	    "MX98713\0" /* 1 refs @ 22685 */
+	    "(PMAC)\0" /* 2 refs @ 22693 */
+	    "MX987x5\0" /* 1 refs @ 22700 */
+	    "Ringnode\0" /* 1 refs @ 22708 */
+	    "Mk2\0" /* 1 refs @ 22717 */
+	    "Collage\0" /* 2 refs @ 22721 */
+	    "155\0" /* 2 refs @ 22729 */
+	    "PCI-SLRS\0" /* 2 refs @ 22733 */
+	    "MGA\0" /* 15 refs @ 22742 */
+	    "PX2085\0" /* 1 refs @ 22746 */
+	    "(\"Atlas\")\0" /* 1 refs @ 22753 */
+	    "Millennium\0" /* 3 refs @ 22763 */
+	    "2064W\0" /* 1 refs @ 22774 */
+	    "(\"Storm\")\0" /* 1 refs @ 22780 */
+	    "Mystique\0" /* 1 refs @ 22790 */
+	    "1064SG\0" /* 1 refs @ 22799 */
+	    "2164W\0" /* 1 refs @ 22806 */
+	    "2164WA-B\0" /* 1 refs @ 22812 */
+	    "G200\0" /* 2 refs @ 22821 */
+	    "G200e\0" /* 1 refs @ 22826 */
+	    "(ServerEngines)\0" /* 1 refs @ 22832 */
+	    "G400\0" /* 1 refs @ 22848 */
+	    "G200eW\0" /* 1 refs @ 22853 */
+	    "G200eH\0" /* 1 refs @ 22860 */
+	    "Impression\0" /* 1 refs @ 22867 */
+	    "G100\0" /* 2 refs @ 22878 */
+	    "G550\0" /* 1 refs @ 22883 */
+	    "MQ200\0" /* 1 refs @ 22888 */
+	    "InfiniHost\0" /* 6 refs @ 22894 */
+	    "(Tavor)\0" /* 2 refs @ 22905 */
+	    "Lx\0" /* 2 refs @ 22913 */
+	    "(old\0" /* 1 refs @ 22916 */
+	    "Sinai)\0" /* 1 refs @ 22921 */
+	    "(Sinai)\0" /* 1 refs @ 22928 */
+	    "Ex\0" /* 2 refs @ 22936 */
+	    "(Arbel\0" /* 1 refs @ 22939 */
+	    "Tavor\0" /* 1 refs @ 22946 */
+	    "compatility)\0" /* 1 refs @ 22952 */
+	    "(Arbel)\0" /* 1 refs @ 22965 */
+	    "ConnectX\0" /* 7 refs @ 22973 */
+	    "SDR\0" /* 1 refs @ 22982 */
+	    "(Hermon)\0" /* 7 refs @ 22986 */
+	    "DDR\0" /* 5 refs @ 22995 */
+	    "QDR\0" /* 2 refs @ 22999 */
+	    "2.5GT/s\0" /* 2 refs @ 23003 */
+	    "EN\0" /* 2 refs @ 23011 */
+	    "10GigE\0" /* 2 refs @ 23014 */
+	    "5GT/s\0" /* 3 refs @ 23021 */
+	    "MM-5415CN\0" /* 1 refs @ 23027 */
+	    "MM-5425CN\0" /* 1 refs @ 23037 */
+	    "MN-120\0" /* 1 refs @ 23047 */
+	    "Switched\0" /* 1 refs @ 23054 */
+	    "Weasel\0" /* 3 refs @ 23063 */
+	    "Tornado\0" /* 1 refs @ 23070 */
+	    "MPC105\0" /* 1 refs @ 23078 */
+	    "\"Eagle\"\0" /* 1 refs @ 23085 */
+	    "MPC106\0" /* 1 refs @ 23093 */
+	    "\"Grackle\"\0" /* 1 refs @ 23100 */
+	    "MPC8240\0" /* 1 refs @ 23110 */
+	    "\"Kahlua\"\0" /* 1 refs @ 23118 */
+	    "MPC107\0" /* 1 refs @ 23127 */
+	    "\"Chaparral\"\0" /* 1 refs @ 23134 */
+	    "MPC8245\0" /* 1 refs @ 23146 */
+	    "\"Kahlua\0" /* 1 refs @ 23154 */
+	    "II\"\0" /* 1 refs @ 23162 */
+	    "MPC8555E\0" /* 1 refs @ 23166 */
+	    "MPC8541\0" /* 1 refs @ 23175 */
+	    "Raven\0" /* 1 refs @ 23183 */
+	    "Multi-Processor\0" /* 1 refs @ 23189 */
+	    "Falcon\0" /* 1 refs @ 23205 */
+	    "ECC\0" /* 1 refs @ 23212 */
+	    "Set\0" /* 1 refs @ 23216 */
+	    "Hawk\0" /* 1 refs @ 23220 */
+	    "MPC5200B\0" /* 1 refs @ 23225 */
+	    "CP102U\0" /* 1 refs @ 23234 */
+	    "C104H\0" /* 1 refs @ 23241 */
+	    "CP104UL\0" /* 1 refs @ 23247 */
+	    "CP104V2\0" /* 1 refs @ 23255 */
+	    "CP104EL\0" /* 1 refs @ 23263 */
+	    "CP114\0" /* 1 refs @ 23271 */
+	    "C168H\0" /* 1 refs @ 23277 */
+	    "C168U\0" /* 1 refs @ 23283 */
+	    "C168EL\0" /* 2 refs @ 23289 */
+	    "MV1000\0" /* 1 refs @ 23296 */
+	    "DAC960\0" /* 4 refs @ 23303 */
+	    "(v2\0" /* 1 refs @ 23310 */
+	    "Interface)\0" /* 4 refs @ 23314 */
+	    "(v3\0" /* 1 refs @ 23325 */
+	    "(v4\0" /* 1 refs @ 23329 */
+	    "(v5\0" /* 1 refs @ 23333 */
+	    "eXtremeRAID\0" /* 4 refs @ 23337 */
+	    "AcceleRAID\0" /* 3 refs @ 23349 */
+	    "352\0" /* 1 refs @ 23360 */
+	    "170\0" /* 1 refs @ 23364 */
+	    "160\0" /* 1 refs @ 23368 */
+	    "1100\0" /* 2 refs @ 23372 */
+	    "2000/3000\0" /* 1 refs @ 23377 */
+	    "MTD803\0" /* 1 refs @ 23387 */
+	    "3-in-1\0" /* 1 refs @ 23394 */
+	    "NCP130\0" /* 2 refs @ 23401 */
+	    "A2\0" /* 1 refs @ 23408 */
+	    "NSP2K\0" /* 1 refs @ 23411 */
+	    "Policy\0" /* 1 refs @ 23417 */
+	    "XLP\0" /* 27 refs @ 23424 */
+	    "controller\0" /* 19 refs @ 23428 */
+	    "Inter-Chip\0" /* 1 refs @ 23439 */
+	    "interconnect\0" /* 1 refs @ 23450 */
+	    "PCI-Express\0" /* 7 refs @ 23463 */
+	    "RootComplex/Endpoint\0" /* 1 refs @ 23475 */
+	    "Interlaken\0" /* 1 refs @ 23496 */
+	    "LA\0" /* 1 refs @ 23507 */
+	    "interface\0" /* 2 refs @ 23510 */
+	    "Acceleration\0" /* 1 refs @ 23520 */
+	    "engine\0" /* 4 refs @ 23533 */
+	    "Ordering\0" /* 1 refs @ 23540 */
+	    "Messaging\0" /* 1 refs @ 23549 */
+	    "Transfer\0" /* 1 refs @ 23559 */
+	    "accelerator\0" /* 3 refs @ 23568 */
+	    "RSA/ECC\0" /* 1 refs @ 23580 */
+	    "Compress/Decompression\0" /* 1 refs @ 23588 */
+	    "JTAG\0" /* 1 refs @ 23611 */
+	    "NOR\0" /* 1 refs @ 23616 */
+	    "flash\0" /* 2 refs @ 23620 */
+	    "NAND\0" /* 1 refs @ 23626 */
+	    "eMMC/SD/SDIO\0" /* 1 refs @ 23631 */
+	    "Regular\0" /* 1 refs @ 23644 */
+	    "Expression\0" /* 1 refs @ 23652 */
+	    "SRIO\0" /* 1 refs @ 23663 */
+	    "(Serial\0" /* 1 refs @ 23668 */
+	    "Rapid\0" /* 1 refs @ 23676 */
+	    "IO)\0" /* 1 refs @ 23682 */
+	    "Universe\0" /* 1 refs @ 23686 */
+	    "VME\0" /* 1 refs @ 23695 */
+	    "QSpan\0" /* 1 refs @ 23699 */
+	    "PowerSpan\0" /* 2 refs @ 23705 */
+	    "MXI-3\0" /* 1 refs @ 23715 */
+	    "Extender\0" /* 1 refs @ 23721 */
+	    "DP83810\0" /* 1 refs @ 23730 */
+	    "PC87415\0" /* 1 refs @ 23738 */
+	    "87560\0" /* 1 refs @ 23746 */
+	    "DP83815\0" /* 1 refs @ 23752 */
+	    "DP83820\0" /* 1 refs @ 23760 */
+	    "CS5535\0" /* 6 refs @ 23768 */
+	    "Saturn\0" /* 1 refs @ 23775 */
+	    "SC1100\0" /* 5 refs @ 23782 */
+	    "XpressAUDIO\0" /* 1 refs @ 23789 */
+	    "SMI/ACPI\0" /* 1 refs @ 23801 */
+	    "X-Bus\0" /* 1 refs @ 23810 */
+	    "NS87410\0" /* 1 refs @ 23816 */
+	    "SAA7130HL\0" /* 1 refs @ 23824 */
+	    "Broadcast\0" /* 4 refs @ 23834 */
+	    "SAA7133HL\0" /* 1 refs @ 23844 */
+	    "A/V\0" /* 3 refs @ 23854 */
+	    "SAA7134HL\0" /* 1 refs @ 23858 */
+	    "SAA7135HL\0" /* 1 refs @ 23868 */
+	    "SAA7146AH\0" /* 1 refs @ 23878 */
+	    "53c810\0" /* 1 refs @ 23888 */
+	    "53c820\0" /* 1 refs @ 23895 */
+	    "53c825\0" /* 1 refs @ 23902 */
+	    "53c815\0" /* 1 refs @ 23909 */
+	    "53c810AP\0" /* 1 refs @ 23916 */
+	    "53c860\0" /* 1 refs @ 23925 */
+	    "53c1510D\0" /* 1 refs @ 23932 */
+	    "53c896\0" /* 1 refs @ 23941 */
+	    "53c895\0" /* 1 refs @ 23948 */
+	    "53c885\0" /* 1 refs @ 23955 */
+	    "53c875/876\0" /* 1 refs @ 23962 */
+	    "53c1510\0" /* 1 refs @ 23973 */
+	    "53c895A\0" /* 1 refs @ 23981 */
+	    "53c875A\0" /* 1 refs @ 23989 */
+	    "53c1010\0" /* 2 refs @ 23997 */
+	    "(66MHz)\0" /* 1 refs @ 24005 */
+	    "53c1020/53c1030\0" /* 1 refs @ 24013 */
+	    "53c1030R\0" /* 1 refs @ 24029 */
+	    "53c1030ZC\0" /* 1 refs @ 24038 */
+	    "53c1035\0" /* 1 refs @ 24048 */
+	    "53c1035ZC\0" /* 1 refs @ 24056 */
+	    "SAS1064\0" /* 1 refs @ 24066 */
+	    "SAS1068\0" /* 2 refs @ 24074 */
+	    "SAS1064E\0" /* 2 refs @ 24082 */
+	    "SAS1068E\0" /* 2 refs @ 24091 */
+	    "SAS1066E\0" /* 1 refs @ 24100 */
+	    "SAS2208\0" /* 7 refs @ 24109 */
+	    "SAS1064A\0" /* 1 refs @ 24117 */
+	    "SAS3108\0" /* 1 refs @ 24126 */
+	    "SAS1066\0" /* 1 refs @ 24134 */
+	    "SAS1078\0" /* 2 refs @ 24142 */
+	    "SAS2116\0" /* 2 refs @ 24150 */
+	    "SAS2308\0" /* 3 refs @ 24158 */
+	    "SAS2004\0" /* 1 refs @ 24166 */
+	    "SAS2008\0" /* 2 refs @ 24174 */
+	    "SAS2108\0" /* 5 refs @ 24182 */
+	    "CRYPTO\0" /* 1 refs @ 24190 */
+	    "GEN2\0" /* 2 refs @ 24197 */
+	    "SAS1078DE\0" /* 1 refs @ 24202 */
+	    "53c875J\0" /* 1 refs @ 24212 */
+	    "FC909\0" /* 1 refs @ 24220 */
+	    "FC909A\0" /* 1 refs @ 24226 */
+	    "FC929\0" /* 2 refs @ 24233 */
+	    "FC919\0" /* 2 refs @ 24239 */
+	    "FC929X\0" /* 1 refs @ 24245 */
+	    "FC919X\0" /* 1 refs @ 24252 */
+	    "FC949X\0" /* 1 refs @ 24259 */
+	    "FC939X\0" /* 1 refs @ 24266 */
+	    "FC949E\0" /* 1 refs @ 24273 */
+	    "Megaraid\0" /* 3 refs @ 24280 */
+	    "320-X\0" /* 1 refs @ 24289 */
+	    "320-E\0" /* 1 refs @ 24295 */
+	    "(300-6X/300-8X)\0" /* 1 refs @ 24301 */
+	    "Verde\0" /* 1 refs @ 24317 */
+	    "ZCR\0" /* 1 refs @ 24323 */
+	    "4/SC\0" /* 1 refs @ 24327 */
+	    "G-NIC\0" /* 2 refs @ 24332 */
+	    "Tools\0" /* 1 refs @ 24338 */
+	    "VRC4173\0" /* 3 refs @ 24344 */
+	    "PC-Card\0" /* 1 refs @ 24352 */
+	    "PowerVR\0" /* 1 refs @ 24360 */
+	    "PCX2\0" /* 1 refs @ 24368 */
+	    "uPD72872\0" /* 1 refs @ 24373 */
+	    "PK-UG-X001\0" /* 1 refs @ 24382 */
+	    "PK-UG-X008\0" /* 1 refs @ 24393 */
+	    "Bus\0" /* 3 refs @ 24404 */
+	    "uPD72870\0" /* 1 refs @ 24408 */
+	    "uPD72871\0" /* 1 refs @ 24417 */
+	    "uPD720400\0" /* 1 refs @ 24426 */
+	    "PCI/PCI-X\0" /* 3 refs @ 24436 */
+	    "Versa\0" /* 2 refs @ 24446 */
+	    "VA26D\0" /* 1 refs @ 24452 */
+	    "MagicGraph\0" /* 4 refs @ 24458 */
+	    "NM2070\0" /* 1 refs @ 24469 */
+	    "128V\0" /* 1 refs @ 24476 */
+	    "128ZV\0" /* 1 refs @ 24481 */
+	    "128XD\0" /* 1 refs @ 24487 */
+	    "MagicMedia\0" /* 5 refs @ 24493 */
+	    "256AV\0" /* 2 refs @ 24504 */
+	    "256ZX\0" /* 2 refs @ 24510 */
+	    "256XL+\0" /* 1 refs @ 24516 */
+	    "NET2280\0" /* 1 refs @ 24523 */
+	    "NET2282\0" /* 1 refs @ 24531 */
+	    "GA620\0" /* 2 refs @ 24539 */
+	    "MA301\0" /* 1 refs @ 24545 */
+	    "1284\0" /* 7 refs @ 24551 */
+	    "Printer\0" /* 7 refs @ 24556 */
+	    "9855\0" /* 1 refs @ 24564 */
+	    "9865\0" /* 1 refs @ 24569 */
+	    "MCS9990\0" /* 1 refs @ 24574 */
+	    "NX82C501\0" /* 1 refs @ 24582 */
+	    "NDR4600\0" /* 1 refs @ 24591 */
+	    "Baystack\0" /* 1 refs @ 24599 */
+	    "21\0" /* 1 refs @ 24608 */
+	    "(Accton\0" /* 1 refs @ 24611 */
+	    "EN5038)\0" /* 1 refs @ 24619 */
+	    "Imagine-128\0" /* 2 refs @ 24627 */
+	    "RIVA\0" /* 4 refs @ 24639 */
+	    "TNT\0" /* 1 refs @ 24644 */
+	    "TNT2\0" /* 4 refs @ 24648 */
+	    "Vanta\0" /* 1 refs @ 24653 */
+	    "Model\0" /* 1 refs @ 24659 */
+	    "64\0" /* 1 refs @ 24665 */
+	    "MCP04\0" /* 7 refs @ 24668 */
+	    "GeForce\0" /* 48 refs @ 24674 */
+	    "6800\0" /* 4 refs @ 24682 */
+	    "GT\0" /* 9 refs @ 24687 */
+	    "nForce4\0" /* 14 refs @ 24690 */
+	    "ATA133\0" /* 13 refs @ 24698 */
+	    "nForce2\0" /* 27 refs @ 24705 */
+	    "MCP-T\0" /* 4 refs @ 24713 */
+	    "400\0" /* 10 refs @ 24719 */
+	    "Aladdin\0" /* 1 refs @ 24723 */
+	    "nForce3\0" /* 23 refs @ 24731 */
+	    "250\0" /* 12 refs @ 24739 */
+	    "Quadro\0" /* 15 refs @ 24743 */
+	    "FX\0" /* 23 refs @ 24750 */
+	    "Quadro4\0" /* 11 refs @ 24753 */
+	    "280\0" /* 2 refs @ 24761 */
+	    "NVS\0" /* 5 refs @ 24765 */
+	    "1300\0" /* 1 refs @ 24769 */
+	    "PCX\0" /* 1 refs @ 24774 */
+	    "4300\0" /* 1 refs @ 24778 */
+	    "256\0" /* 1 refs @ 24783 */
+	    "GeForce2\0" /* 7 refs @ 24787 */
+	    "MX\0" /* 10 refs @ 24796 */
+	    "100/200\0" /* 1 refs @ 24799 */
+	    "Go\0" /* 5 refs @ 24807 */
+	    "Quadro2\0" /* 2 refs @ 24810 */
+	    "MXR/EX\0" /* 1 refs @ 24818 */
+	    "6600\0" /* 5 refs @ 24825 */
+	    "6610\0" /* 1 refs @ 24830 */
+	    "540\0" /* 2 refs @ 24835 */
+	    "GTS\0" /* 4 refs @ 24839 */
+	    "(DDR)\0" /* 1 refs @ 24843 */
+	    "6200TC\0" /* 1 refs @ 24849 */
+	    "6200LE\0" /* 1 refs @ 24856 */
+	    "GeForce4\0" /* 15 refs @ 24863 */
+	    "460\0" /* 1 refs @ 24872 */
+	    "440\0" /* 4 refs @ 24876 */
+	    "420\0" /* 3 refs @ 24880 */
+	    "SE\0" /* 4 refs @ 24884 */
+	    "500XGL\0" /* 1 refs @ 24887 */
+	    "200/400NVS\0" /* 1 refs @ 24894 */
+	    "(AGP8X)\0" /* 4 refs @ 24905 */
+	    "580\0" /* 1 refs @ 24913 */
+	    "XGL\0" /* 4 refs @ 24917 */
+	    "380\0" /* 1 refs @ 24921 */
+	    "4600\0" /* 2 refs @ 24925 */
+	    "nForce\0" /* 162 refs @ 24930 */
+	    "220\0" /* 1 refs @ 24937 */
+	    "220/420\0" /* 2 refs @ 24941 */
+	    "MCP\0" /* 1 refs @ 24949 */
+	    "Xbox\0" /* 3 refs @ 24953 */
+	    "ATA100\0" /* 1 refs @ 24958 */
+	    "7300\0" /* 1 refs @ 24965 */
+	    "GeForce3\0" /* 3 refs @ 24970 */
+	    "Ti\0" /* 10 refs @ 24979 */
+	    "500\0" /* 2 refs @ 24982 */
+	    "DCC\0" /* 1 refs @ 24986 */
+	    "4400\0" /* 1 refs @ 24990 */
+	    "4200\0" /* 3 refs @ 24995 */
+	    "900XGL\0" /* 1 refs @ 25000 */
+	    "750XGL\0" /* 1 refs @ 25007 */
+	    "700XGL\0" /* 1 refs @ 25014 */
+	    "nForce430\0" /* 14 refs @ 25021 */
+	    "C51\0" /* 18 refs @ 25031 */
+	    "4800\0" /* 2 refs @ 25035 */
+	    "8x\0" /* 1 refs @ 25040 */
+	    "980\0" /* 1 refs @ 25043 */
+	    "780\0" /* 1 refs @ 25047 */
+	    "1500\0" /* 1 refs @ 25051 */
+	    "Frame\0" /* 1 refs @ 25056 */
+	    "Buffer\0" /* 1 refs @ 25062 */
+	    "(0x02f0)\0" /* 1 refs @ 25069 */
+	    "(0x02f1)\0" /* 1 refs @ 25078 */
+	    "(0x02f2)\0" /* 1 refs @ 25087 */
+	    "(0x02f3)\0" /* 1 refs @ 25096 */
+	    "(0x02f4)\0" /* 1 refs @ 25105 */
+	    "(0x02f5)\0" /* 1 refs @ 25114 */
+	    "(0x02f6)\0" /* 1 refs @ 25123 */
+	    "(0x02f7)\0" /* 1 refs @ 25132 */
+	    "(0x02fb)\0" /* 1 refs @ 25141 */
+	    "(0x02fc)\0" /* 1 refs @ 25150 */
+	    "(0x02fd)\0" /* 1 refs @ 25159 */
+	    "(0x02ff)\0" /* 1 refs @ 25168 */
+	    "5800\0" /* 2 refs @ 25177 */
+	    "5200\0" /* 2 refs @ 25182 */
+	    "5200SE\0" /* 1 refs @ 25187 */
+	    "5900\0" /* 2 refs @ 25194 */
+	    "5900XT\0" /* 1 refs @ 25199 */
+	    "5950\0" /* 1 refs @ 25206 */
+	    "5700\0" /* 1 refs @ 25211 */
+	    "MCP55\0" /* 17 refs @ 25216 */
+	    "16x\0" /* 2 refs @ 25222 */
+	    "7600\0" /* 1 refs @ 25226 */
+	    "MCP61\0" /* 20 refs @ 25231 */
+	    "8600\0" /* 2 refs @ 25237 */
+	    "8400M\0" /* 1 refs @ 25242 */
+	    "GS\0" /* 3 refs @ 25248 */
+	    "140M\0" /* 1 refs @ 25251 */
+	    "MCP65\0" /* 31 refs @ 25256 */
+	    "PCI-LPC\0" /* 7 refs @ 25262 */
+	    "MCP67\0" /* 20 refs @ 25270 */
+	    "MCP73\0" /* 20 refs @ 25276 */
+	    "8800\0" /* 1 refs @ 25282 */
+	    "9300\0" /* 1 refs @ 25287 */
+	    "GE\0" /* 2 refs @ 25292 */
+	    "8400\0" /* 1 refs @ 25295 */
+	    "9300M\0" /* 1 refs @ 25300 */
+	    "150m\0" /* 1 refs @ 25306 */
+	    "160m\0" /* 1 refs @ 25311 */
+	    "MCP77\0" /* 21 refs @ 25316 */
+	    "MCP78S\0" /* 1 refs @ 25322 */
+	    "210\0" /* 2 refs @ 25329 */
+	    "MCP79\0" /* 17 refs @ 25333 */
+	    "640M\0" /* 1 refs @ 25339 */
+	    "GTX\0" /* 1 refs @ 25344 */
+	    "550\0" /* 2 refs @ 25348 */
+	    "Riva\0" /* 1 refs @ 25352 */
+	    "OTI107\0" /* 1 refs @ 25357 */
+	    "OC-3136/3137\0" /* 1 refs @ 25364 */
+	    "Token-Ring\0" /* 2 refs @ 25377 */
+	    "OC-3139f\0" /* 1 refs @ 25388 */
+	    "Fastload\0" /* 1 refs @ 25397 */
+	    "OC-3139/3140\0" /* 1 refs @ 25406 */
+	    "RapidFire\0" /* 5 refs @ 25419 */
+	    "OC-3250\0" /* 1 refs @ 25429 */
+	    "GoCard\0" /* 1 refs @ 25437 */
+	    "OC-3530\0" /* 1 refs @ 25444 */
+	    "OC-3141\0" /* 1 refs @ 25452 */
+	    "OC-3540\0" /* 1 refs @ 25460 */
+	    "HSTR\0" /* 1 refs @ 25468 */
+	    "100/16/4\0" /* 1 refs @ 25473 */
+	    "OC-3150\0" /* 1 refs @ 25482 */
+	    "OC-2805\0" /* 1 refs @ 25490 */
+	    "OC-2325\0" /* 1 refs @ 25498 */
+	    "OC-2183/2185\0" /* 1 refs @ 25506 */
+	    "OC-2326\0" /* 1 refs @ 25519 */
+	    "10/100-TX\0" /* 1 refs @ 25527 */
+	    "OC-2327/2350\0" /* 1 refs @ 25537 */
+	    "OC-6151/6152\0" /* 1 refs @ 25550 */
+	    "82C557\0" /* 1 refs @ 25563 */
+	    "82C558\0" /* 1 refs @ 25570 */
+	    "82C568\0" /* 1 refs @ 25577 */
+	    "82D568\0" /* 1 refs @ 25584 */
+	    "82C621\0" /* 1 refs @ 25591 */
+	    "82C822\0" /* 1 refs @ 25598 */
+	    "82C861\0" /* 1 refs @ 25605 */
+	    "82C700\0" /* 1 refs @ 25612 */
+	    "82C701\0" /* 1 refs @ 25619 */
+	    "011H\0" /* 1 refs @ 25626 */
+	    "OX16PCI954\0" /* 2 refs @ 25631 */
+	    "OX16PCI954K\0" /* 1 refs @ 25642 */
+	    "OXuPCI952\0" /* 1 refs @ 25654 */
+	    "Exsys\0" /* 2 refs @ 25664 */
+	    "EX-41092\0" /* 1 refs @ 25670 */
+	    "OXCB950\0" /* 1 refs @ 25679 */
+	    "OXmPCI954\0" /* 2 refs @ 25687 */
+	    "Disabled\0" /* 1 refs @ 25697 */
+	    "EX-41098\0" /* 1 refs @ 25706 */
+	    "OX16PCI952\0" /* 2 refs @ 25715 */
+	    "OX16PCI958\0" /* 1 refs @ 25726 */
+	    "OXPCIe952\0" /* 9 refs @ 25737 */
+	    "HD-2000\0" /* 1 refs @ 25747 */
+	    "HDTV\0" /* 2 refs @ 25755 */
+	    "HD-5500\0" /* 1 refs @ 25760 */
+	    "RZ1000\0" /* 1 refs @ 25768 */
+	    "PCAN\0" /* 1 refs @ 25775 */
+	    "P17C9X110\0" /* 1 refs @ 25780 */
+	    "P17C9X\0" /* 1 refs @ 25790 */
+	    "P1000\0" /* 1 refs @ 25797 */
+	    "FNW-3603-TX\0" /* 1 refs @ 25803 */
+	    "FNW-3800-TX\0" /* 1 refs @ 25815 */
+	    "VScom\0" /* 3 refs @ 25827 */
+	    "PCI-400\0" /* 1 refs @ 25833 */
+	    "PCI-800\0" /* 1 refs @ 25841 */
+	    "PCI-200\0" /* 1 refs @ 25849 */
+	    "PEX\0" /* 3 refs @ 25857 */
+	    "8111\0" /* 1 refs @ 25861 */
+	    "8112\0" /* 1 refs @ 25866 */
+	    "8114\0" /* 1 refs @ 25871 */
+	    "PCIe-to-PCI/PCI-X\0" /* 1 refs @ 25876 */
+	    "9030\0" /* 1 refs @ 25894 */
+	    "Accelrator\0" /* 2 refs @ 25899 */
+	    "9050\0" /* 1 refs @ 25910 */
+	    "9054\0" /* 1 refs @ 25915 */
+	    "9060ES\0" /* 1 refs @ 25920 */
+	    "9656\0" /* 2 refs @ 25927 */
+	    "FPBGA\0" /* 1 refs @ 25932 */
+	    "PowerTop\0" /* 1 refs @ 25938 */
+	    "PowerPro\0" /* 1 refs @ 25947 */
+	    "PDC20265\0" /* 1 refs @ 25956 */
+	    "Ultra/66\0" /* 3 refs @ 25965 */
+	    "PDC20263\0" /* 1 refs @ 25974 */
+	    "PDC20275\0" /* 1 refs @ 25983 */
+	    "Ultra/133\0" /* 10 refs @ 25992 */
+	    "PDC20318\0" /* 1 refs @ 26002 */
+	    "PDC20319\0" /* 1 refs @ 26011 */
+	    "PDC20371\0" /* 1 refs @ 26020 */
+	    "PDC20379\0" /* 1 refs @ 26029 */
+	    "PDC20378\0" /* 1 refs @ 26038 */
+	    "PDC20375\0" /* 1 refs @ 26047 */
+	    "PDC20376\0" /* 1 refs @ 26056 */
+	    "PDC20377\0" /* 1 refs @ 26065 */
+	    "PDC40719\0" /* 1 refs @ 26074 */
+	    "PDC40519\0" /* 1 refs @ 26083 */
+	    "PDC20771\0" /* 1 refs @ 26092 */
+	    "PDC20571\0" /* 1 refs @ 26101 */
+	    "PDC20579\0" /* 1 refs @ 26110 */
+	    "PDC40779\0" /* 1 refs @ 26119 */
+	    "PDC40718\0" /* 1 refs @ 26128 */
+	    "PDC40518\0" /* 1 refs @ 26137 */
+	    "PDC20775\0" /* 1 refs @ 26146 */
+	    "PDC20575\0" /* 1 refs @ 26155 */
+	    "PDC20267\0" /* 1 refs @ 26164 */
+	    "Ultra/100\0" /* 3 refs @ 26173 */
+	    "PDC20246\0" /* 1 refs @ 26183 */
+	    "Ultra/33\0" /* 1 refs @ 26192 */
+	    "PDC20262\0" /* 1 refs @ 26201 */
+	    "PDC20268\0" /* 1 refs @ 26210 */
+	    "PDC20269\0" /* 1 refs @ 26219 */
+	    "PDC20276\0" /* 1 refs @ 26228 */
+	    "DC5030\0" /* 1 refs @ 26237 */
+	    "PDC20270\0" /* 1 refs @ 26244 */
+	    "PDC20271\0" /* 1 refs @ 26253 */
+	    "PDC20617\0" /* 1 refs @ 26262 */
+	    "PDC20620\0" /* 1 refs @ 26271 */
+	    "PDC20621\0" /* 1 refs @ 26280 */
+	    "PDC20618\0" /* 1 refs @ 26289 */
+	    "Controler\0" /* 1 refs @ 26298 */
+	    "PDC20619\0" /* 1 refs @ 26308 */
+	    "PDC20277\0" /* 1 refs @ 26317 */
+	    "CH352\0" /* 2 refs @ 26326 */
+	    "2S\0" /* 2 refs @ 26332 */
+	    "CH353\0" /* 3 refs @ 26335 */
+	    "4S\0" /* 11 refs @ 26341 */
+	    "CH356\0" /* 3 refs @ 26344 */
+	    "8S\0" /* 3 refs @ 26350 */
+	    "6S\0" /* 1 refs @ 26353 */
+	    "2S,\0" /* 3 refs @ 26356 */
+	    "1P\0" /* 7 refs @ 26360 */
+	    "(fixed\0" /* 1 refs @ 26363 */
+	    "address)\0" /* 1 refs @ 26370 */
+	    "1S,\0" /* 1 refs @ 26379 */
+	    "CH357\0" /* 1 refs @ 26383 */
+	    "CH358\0" /* 2 refs @ 26389 */
+	    "4S,\0" /* 3 refs @ 26395 */
+	    "CH359\0" /* 1 refs @ 26399 */
+	    "16S\0" /* 1 refs @ 26405 */
+	    "CH355\0" /* 1 refs @ 26409 */
+	    "CH384\0" /* 4 refs @ 26415 */
+	    "CH382\0" /* 2 refs @ 26421 */
+	    "28S\0" /* 1 refs @ 26427 */
+	    "QLA200\0" /* 1 refs @ 26431 */
+	    "ISP1020\0" /* 1 refs @ 26438 */
+	    "ISP1022\0" /* 1 refs @ 26446 */
+	    "ISP1080\0" /* 1 refs @ 26454 */
+	    "ISP1240\0" /* 1 refs @ 26462 */
+	    "ISP1280\0" /* 1 refs @ 26470 */
+	    "ISP2100\0" /* 1 refs @ 26478 */
+	    "ISP4022\0" /* 2 refs @ 26486 */
+	    "TOE\0" /* 2 refs @ 26494 */
+	    "PWDOG1\0" /* 1 refs @ 26498 */
+	    "8580\0" /* 1 refs @ 26505 */
+	    "Virtio\0" /* 64 refs @ 26510 */
+	    "CryptoSwift\0" /* 1 refs @ 26517 */
+	    "PKI\0" /* 1 refs @ 26529 */
+	    "RT2460A\0" /* 1 refs @ 26533 */
+	    "RT2560\0" /* 1 refs @ 26541 */
+	    "802.11b/g\0" /* 4 refs @ 26548 */
+	    "RT2561S\0" /* 1 refs @ 26558 */
+	    "RT2561\0" /* 1 refs @ 26566 */
+	    "RT2661\0" /* 1 refs @ 26573 */
+	    "RT3090\0" /* 1 refs @ 26580 */
+	    "REX\0" /* 1 refs @ 26587 */
+	    "PCI-31/33\0" /* 1 refs @ 26591 */
+	    "R1010\0" /* 1 refs @ 26601 */
+	    "R1011\0" /* 1 refs @ 26607 */
+	    "R1012\0" /* 1 refs @ 26613 */
+	    "R6021\0" /* 1 refs @ 26619 */
+	    "R6025\0" /* 1 refs @ 26625 */
+	    "R6031\0" /* 1 refs @ 26631 */
+	    "R6036\0" /* 1 refs @ 26637 */
+	    "R6040\0" /* 1 refs @ 26643 */
+	    "R6060\0" /* 1 refs @ 26649 */
+	    "R6061\0" /* 1 refs @ 26655 */
+	    "RTS5209\0" /* 1 refs @ 26661 */
+	    "RTS5227\0" /* 1 refs @ 26669 */
+	    "RTS5229\0" /* 1 refs @ 26677 */
+	    "RTS5249\0" /* 1 refs @ 26685 */
+	    "RTL8402\0" /* 1 refs @ 26693 */
+	    "RTL8411B\0" /* 1 refs @ 26701 */
+	    "RTL8411\0" /* 1 refs @ 26710 */
+	    "8029\0" /* 1 refs @ 26718 */
+	    "8139D\0" /* 1 refs @ 26723 */
+	    "8100\0" /* 1 refs @ 26729 */
+	    "8129\0" /* 1 refs @ 26734 */
+	    "8100E/8101E/8102E\0" /* 1 refs @ 26739 */
+	    "8138\0" /* 1 refs @ 26757 */
+	    "8169SC/8110SC\0" /* 1 refs @ 26762 */
+	    "8168/8111\0" /* 1 refs @ 26776 */
+	    "8169/8110\0" /* 1 refs @ 26786 */
+	    "RTL8188CE\0" /* 1 refs @ 26796 */
+	    "802.11n\0" /* 3 refs @ 26806 */
+	    "RTL8192CE\0" /* 1 refs @ 26814 */
+	    "RTL8188EE\0" /* 1 refs @ 26824 */
+	    "8180\0" /* 1 refs @ 26834 */
+	    "8185\0" /* 1 refs @ 26839 */
+	    "802.11a/b/g\0" /* 1 refs @ 26844 */
+	    "Qemu\0" /* 1 refs @ 26856 */
+	    "QXL\0" /* 1 refs @ 26861 */
+	    "SH7780\0" /* 1 refs @ 26865 */
+	    "SH7785\0" /* 1 refs @ 26872 */
+	    "SH7757\0" /* 3 refs @ 26879 */
+	    "End-Point\0" /* 1 refs @ 26886 */
+	    "[PBI]\0" /* 1 refs @ 26896 */
+	    "[PPB]\0" /* 1 refs @ 26902 */
+	    "Switch\0" /* 1 refs @ 26908 */
+	    "[PS]\0" /* 1 refs @ 26915 */
+	    "uPD720201\0" /* 1 refs @ 26920 */
+	    "uPD720202\0" /* 1 refs @ 26930 */
+	    "5C465\0" /* 1 refs @ 26940 */
+	    "5C466\0" /* 1 refs @ 26946 */
+	    "5C475\0" /* 1 refs @ 26952 */
+	    "5C476\0" /* 1 refs @ 26958 */
+	    "5C477\0" /* 1 refs @ 26964 */
+	    "5C478\0" /* 1 refs @ 26970 */
+	    "5C551\0" /* 1 refs @ 26976 */
+	    "Bridge/Firewire\0" /* 2 refs @ 26982 */
+	    "5C552\0" /* 1 refs @ 26998 */
+	    "5C592\0" /* 1 refs @ 27004 */
+	    "Bridge/MS/SD/Firewire\0" /* 2 refs @ 27010 */
+	    "5C593\0" /* 1 refs @ 27032 */
+	    "5C821\0" /* 1 refs @ 27038 */
+	    "Bridge/MS/SD/MMC/SC\0" /* 2 refs @ 27044 */
+	    "5C822\0" /* 1 refs @ 27064 */
+	    "5C832\0" /* 1 refs @ 27070 */
+	    "PCI-SD/MMC/MMC+/MS/xD/Firewire\0" /* 1 refs @ 27076 */
+	    "5C843\0" /* 1 refs @ 27107 */
+	    "Bridge/SD/MMC/MMC+/MS/xD/Firewire\0" /* 2 refs @ 27113 */
+	    "5C847\0" /* 1 refs @ 27147 */
+	    "xD-Picture\0" /* 1 refs @ 27153 */
+	    "5C853\0" /* 1 refs @ 27164 */
+	    "Bridge/SD/MMC/MMC+/MS/xD/SC/Firewire\0" /* 1 refs @ 27170 */
+	    "5U230\0" /* 1 refs @ 27207 */
+	    "FireWire/SD/MMC/xD/MS\0" /* 1 refs @ 27213 */
+	    "5U822\0" /* 1 refs @ 27235 */
+	    "5U823\0" /* 1 refs @ 27241 */
+	    "5U832\0" /* 1 refs @ 27247 */
+	    "5C852\0" /* 1 refs @ 27253 */
+	    "N2\0" /* 1 refs @ 27259 */
+	    "FDDI\0" /* 1 refs @ 27262 */
+	    "Xframe\0" /* 1 refs @ 27267 */
+	    "Xframe2\0" /* 1 refs @ 27274 */
+	    "Xframe3\0" /* 1 refs @ 27282 */
+	    "ViRGE\0" /* 1 refs @ 27290 */
+	    "Trio32\0" /* 1 refs @ 27296 */
+	    "Trio32/64\0" /* 1 refs @ 27303 */
+	    "Aurora64V+\0" /* 1 refs @ 27313 */
+	    "Trio64UV+\0" /* 1 refs @ 27324 */
+	    "ViRGE/VX\0" /* 1 refs @ 27334 */
+	    "868\0" /* 1 refs @ 27343 */
+	    "86C928\0" /* 1 refs @ 27347 */
+	    "86C864-0\0" /* 1 refs @ 27354 */
+	    "(\"Vision864\")\0" /* 4 refs @ 27363 */
+	    "86C864-1\0" /* 1 refs @ 27377 */
+	    "86C864-2\0" /* 1 refs @ 27386 */
+	    "86C864-3\0" /* 1 refs @ 27395 */
+	    "86C964-0\0" /* 1 refs @ 27404 */
+	    "(\"Vision964\")\0" /* 4 refs @ 27413 */
+	    "86C964-1\0" /* 1 refs @ 27427 */
+	    "86C964-2\0" /* 1 refs @ 27436 */
+	    "86C964-3\0" /* 1 refs @ 27445 */
+	    "86C968-0\0" /* 1 refs @ 27454 */
+	    "(\"Vision968\")\0" /* 4 refs @ 27463 */
+	    "86C968-1\0" /* 1 refs @ 27477 */
+	    "86C968-2\0" /* 1 refs @ 27486 */
+	    "86C968-3\0" /* 1 refs @ 27495 */
+	    "Trio64V2/DX\0" /* 1 refs @ 27504 */
+	    "Plato/PX\0" /* 1 refs @ 27516 */
+	    "86C365\0" /* 1 refs @ 27525 */
+	    "Trio3D\0" /* 1 refs @ 27532 */
+	    "ViRGE/DX\0" /* 1 refs @ 27539 */
+	    "ViRGE/GX2\0" /* 1 refs @ 27548 */
+	    "Trio3D/2X\0" /* 1 refs @ 27558 */
+	    "Savage3D\0" /* 1 refs @ 27568 */
+	    "Savage3D+MV\0" /* 1 refs @ 27577 */
+	    "Savage4\0" /* 1 refs @ 27589 */
+	    "ProSavage\0" /* 1 refs @ 27597 */
+	    "KM133\0" /* 1 refs @ 27607 */
+	    "ViRGE/MX\0" /* 1 refs @ 27613 */
+	    "ViRGE/MXP\0" /* 1 refs @ 27622 */
+	    "Savage/MX+MV\0" /* 1 refs @ 27632 */
+	    "Savage/MX\0" /* 1 refs @ 27645 */
+	    "Savage/IX+MV\0" /* 1 refs @ 27655 */
+	    "Savage/IX\0" /* 1 refs @ 27668 */
+	    "Savage/IXC\0" /* 1 refs @ 27678 */
+	    "Savage2000\0" /* 1 refs @ 27689 */
+	    "SonicVibes\0" /* 1 refs @ 27700 */
+	    "SafeXcel\0" /* 1 refs @ 27711 */
+	    "XP941\0" /* 1 refs @ 27720 */
+	    "M.2\0" /* 2 refs @ 27726 */
+	    "SM951\0" /* 1 refs @ 27730 */
+	    "KS8920\0" /* 1 refs @ 27736 */
+	    "QE1000\0" /* 1 refs @ 27743 */
+	    "FE1000\0" /* 1 refs @ 27750 */
+	    "Broadband\0" /* 1 refs @ 27757 */
+	    "CNB20-LE\0" /* 2 refs @ 27767 */
+	    "PCI/AGP\0" /* 6 refs @ 27776 */
+	    "CNB30-LE\0" /* 1 refs @ 27784 */
+	    "CNB20-HE\0" /* 3 refs @ 27793 */
+	    "CIOB-X\0" /* 1 refs @ 27802 */
+	    "CMIC-HE\0" /* 1 refs @ 27809 */
+	    "CNB30-HE\0" /* 1 refs @ 27817 */
+	    "CMIC-LE\0" /* 1 refs @ 27826 */
+	    "CMIC-SL\0" /* 1 refs @ 27834 */
+	    "HT1000\0" /* 6 refs @ 27842 */
+	    "CIOB-X2\0" /* 1 refs @ 27849 */
+	    "BCM5714/BCM5715\0" /* 1 refs @ 27857 */
+	    "Integral\0" /* 1 refs @ 27873 */
+	    "CIOB-E\0" /* 1 refs @ 27882 */
+	    "HT2100\0" /* 4 refs @ 27889 */
+	    "OSB4\0" /* 2 refs @ 27896 */
+	    "CSB5\0" /* 3 refs @ 27901 */
+	    "CSB6\0" /* 5 refs @ 27906 */
+	    "HT1000SB\0" /* 1 refs @ 27911 */
+	    "HT-1000\0" /* 3 refs @ 27920 */
+	    "IDE/RAID\0" /* 2 refs @ 27928 */
+	    "OSB4/CSB5\0" /* 1 refs @ 27937 */
+	    "ISA/LPC\0" /* 2 refs @ 27947 */
+	    "XIOAPIC\0" /* 1 refs @ 27955 */
+	    "Frodo4\0" /* 1 refs @ 27963 */
+	    "Frodo8\0" /* 1 refs @ 27970 */
+	    "IOC3\0" /* 1 refs @ 27977 */
+	    "PsiTech\0" /* 1 refs @ 27982 */
+	    "RAD1\0" /* 1 refs @ 27990 */
+	    "Tigon\0" /* 1 refs @ 27995 */
+	    "STG\0" /* 2 refs @ 28001 */
+	    "2000X\0" /* 1 refs @ 28005 */
+	    "1764X\0" /* 1 refs @ 28011 */
+	    "BCM1250\0" /* 2 refs @ 28017 */
+	    "LDT\0" /* 1 refs @ 28025 */
+	    "REALmagic\0" /* 1 refs @ 28029 */
+	    "Hollywood-Plus\0" /* 1 refs @ 28039 */
+	    "MPEG-2\0" /* 1 refs @ 28054 */
+	    "Cyber10x\0" /* 17 refs @ 28061 */
+	    "16550\0" /* 13 refs @ 28070 */
+	    "16650\0" /* 12 refs @ 28076 */
+	    "16850\0" /* 12 refs @ 28082 */
+	    "2S1P\0" /* 6 refs @ 28088 */
+	    "Cyber20x\0" /* 20 refs @ 28093 */
+	    "2P1S\0" /* 3 refs @ 28102 */
+	    "8000\0" /* 3 refs @ 28107 */
+	    "86C201\0" /* 1 refs @ 28112 */
+	    "86C202\0" /* 1 refs @ 28119 */
+	    "86C205\0" /* 1 refs @ 28126 */
+	    "85C503\0" /* 1 refs @ 28133 */
+	    "5597/5598\0" /* 5 refs @ 28140 */
+	    "600\0" /* 1 refs @ 28150 */
+	    "Mngmt\0" /* 1 refs @ 28154 */
+	    "180\0" /* 1 refs @ 28160 */
+	    "181\0" /* 1 refs @ 28164 */
+	    "182\0" /* 1 refs @ 28168 */
+	    "183\0" /* 1 refs @ 28172 */
+	    "190\0" /* 1 refs @ 28176 */
+	    "191\0" /* 1 refs @ 28180 */
+	    "300/305\0" /* 1 refs @ 28184 */
+	    "315\0" /* 1 refs @ 28192 */
+	    "85C501\0" /* 1 refs @ 28196 */
+	    "85C496\0" /* 1 refs @ 28203 */
+	    "530\0" /* 2 refs @ 28210 */
+	    "85C601\0" /* 1 refs @ 28214 */
+	    "620\0" /* 1 refs @ 28221 */
+	    "630\0" /* 1 refs @ 28225 */
+	    "633\0" /* 1 refs @ 28229 */
+	    "635\0" /* 1 refs @ 28233 */
+	    "640\0" /* 1 refs @ 28237 */
+	    "645\0" /* 1 refs @ 28241 */
+	    "646\0" /* 1 refs @ 28245 */
+	    "648\0" /* 1 refs @ 28249 */
+	    "650\0" /* 1 refs @ 28253 */
+	    "651\0" /* 1 refs @ 28257 */
+	    "652\0" /* 1 refs @ 28261 */
+	    "655\0" /* 1 refs @ 28265 */
+	    "658\0" /* 1 refs @ 28269 */
+	    "661\0" /* 1 refs @ 28273 */
+	    "671\0" /* 1 refs @ 28277 */
+	    "730\0" /* 1 refs @ 28281 */
+	    "733\0" /* 1 refs @ 28285 */
+	    "735\0" /* 1 refs @ 28289 */
+	    "740\0" /* 2 refs @ 28293 */
+	    "741\0" /* 1 refs @ 28297 */
+	    "745\0" /* 1 refs @ 28301 */
+	    "746\0" /* 1 refs @ 28305 */
+	    "748\0" /* 1 refs @ 28309 */
+	    "750\0" /* 1 refs @ 28313 */
+	    "751\0" /* 1 refs @ 28317 */
+	    "752\0" /* 1 refs @ 28321 */
+	    "755\0" /* 1 refs @ 28325 */
+	    "756\0" /* 1 refs @ 28329 */
+	    "760\0" /* 1 refs @ 28333 */
+	    "761\0" /* 1 refs @ 28337 */
+	    "900\0" /* 1 refs @ 28341 */
+	    "961\0" /* 1 refs @ 28345 */
+	    "962\0" /* 1 refs @ 28349 */
+	    "963\0" /* 1 refs @ 28353 */
+	    "964\0" /* 1 refs @ 28357 */
+	    "965\0" /* 1 refs @ 28361 */
+	    "966\0" /* 1 refs @ 28365 */
+	    "968\0" /* 1 refs @ 28369 */
+	    "GUI\0" /* 1 refs @ 28373 */
+	    "Accelerator+3D\0" /* 1 refs @ 28377 */
+	    "6325\0" /* 1 refs @ 28392 */
+	    "6326\0" /* 1 refs @ 28397 */
+	    "7002\0" /* 1 refs @ 28402 */
+	    "7012\0" /* 1 refs @ 28407 */
+	    "7016\0" /* 1 refs @ 28412 */
+	    "7018\0" /* 1 refs @ 28417 */
+	    "7502\0" /* 1 refs @ 28422 */
+	    "Voyager\0" /* 1 refs @ 28427 */
+	    "LynxEM\0" /* 1 refs @ 28435 */
+	    "LynxEM+\0" /* 1 refs @ 28442 */
+	    "Lynx3DM\0" /* 1 refs @ 28450 */
+	    "LynxE\0" /* 2 refs @ 28458 */
+	    "Lynx3D\0" /* 1 refs @ 28464 */
+	    "Lynx\0" /* 1 refs @ 28471 */
+	    "FDC37C665\0" /* 1 refs @ 28476 */
+	    "FDC37C922\0" /* 1 refs @ 28486 */
+	    "83C170\0" /* 1 refs @ 28496 */
+	    "(\"EPIC/100\")\0" /* 2 refs @ 28503 */
+	    "83C175\0" /* 1 refs @ 28516 */
+	    "SNP8023:\0" /* 2 refs @ 28523 */
+	    "971\0" /* 1 refs @ 28532 */
+	    "Classifier\0" /* 2 refs @ 28536 */
+	    "PAX.ware\0" /* 1 refs @ 28547 */
+	    "Gb\0" /* 1 refs @ 28556 */
+	    "CXD1947A\0" /* 1 refs @ 28559 */
+	    "CXD3222\0" /* 1 refs @ 28568 */
+	    "PCIO\0" /* 3 refs @ 28576 */
+	    "Ebus2\0" /* 2 refs @ 28581 */
+	    "Happy\0" /* 1 refs @ 28587 */
+	    "Meal\0" /* 1 refs @ 28593 */
+	    "(US\0" /* 1 refs @ 28598 */
+	    "III)\0" /* 3 refs @ 28602 */
+	    "ERI\0" /* 1 refs @ 28607 */
+	    "GEM\0" /* 1 refs @ 28611 */
+	    "Simba\0" /* 1 refs @ 28615 */
+	    "BCM5821\0" /* 1 refs @ 28621 */
+	    "psycho\0" /* 1 refs @ 28629 */
+	    "microSPARC\0" /* 1 refs @ 28636 */
+	    "IIep\0" /* 1 refs @ 28647 */
+	    "UltraSPARC\0" /* 2 refs @ 28652 */
+	    "IIi\0" /* 1 refs @ 28663 */
+	    "Cassini\0" /* 1 refs @ 28667 */
+	    "IP100A\0" /* 1 refs @ 28675 */
+	    "ST201\0" /* 1 refs @ 28682 */
+	    "ST1023\0" /* 1 refs @ 28688 */
+	    "ST2021\0" /* 1 refs @ 28695 */
+	    "Matrix\0" /* 1 refs @ 28702 */
+	    "adapter\0" /* 1 refs @ 28709 */
+	    "SER5xxx\0" /* 1 refs @ 28717 */
+	    "multiport\0" /* 3 refs @ 28725 */
+	    "PCI2S550\0" /* 1 refs @ 28735 */
+	    "SUN1888\0" /* 1 refs @ 28744 */
+	    "parallel\0" /* 1 refs @ 28752 */
+	    "NE-34\0" /* 1 refs @ 28761 */
+	    "4S2P\0" /* 1 refs @ 28767 */
+	    "82C101\0" /* 2 refs @ 28772 */
+	    "82C103\0" /* 1 refs @ 28779 */
+	    "82C105\0" /* 1 refs @ 28786 */
+	    "83C553\0" /* 1 refs @ 28793 */
+	    "SB16C1054\0" /* 1 refs @ 28800 */
+	    "UARTs\0" /* 3 refs @ 28810 */
+	    "SB16C1058\0" /* 1 refs @ 28816 */
+	    "SB16C1050\0" /* 1 refs @ 28826 */
+	    "FDDI-xP\0" /* 1 refs @ 28836 */
+	    "SK-9821\0" /* 1 refs @ 28844 */
+	    "SK-9DX1\0" /* 1 refs @ 28852 */
+	    "SK-9D21\0" /* 1 refs @ 28860 */
+	    "1000BASE-T\0" /* 1 refs @ 28868 */
+	    "SK-9D41\0" /* 1 refs @ 28879 */
+	    "1000BASE-X\0" /* 1 refs @ 28887 */
+	    "SK-9Sxx\0" /* 1 refs @ 28898 */
+	    "SK-9E21D/SK-9E22\0" /* 1 refs @ 28906 */
+	    "1000base-T\0" /* 1 refs @ 28923 */
+	    "TC9021\0" /* 2 refs @ 28934 */
+	    "(alt\0" /* 1 refs @ 28941 */
+	    "ServerNet\0" /* 1 refs @ 28946 */
+	    "DC-290(M)\0" /* 1 refs @ 28956 */
+	    "DC-690C\0" /* 1 refs @ 28966 */
+	    "DC-315/DC-395\0" /* 1 refs @ 28974 */
+	    "TLAN\0" /* 1 refs @ 28988 */
+	    "TVP4020\0" /* 1 refs @ 28993 */
+	    "TSB12LV21\0" /* 1 refs @ 29001 */
+	    "TSB12LV22\0" /* 1 refs @ 29011 */
+	    "PCI4450\0" /* 2 refs @ 29021 */
+	    "PCI4410\0" /* 2 refs @ 29029 */
+	    "TSB12LV23\0" /* 1 refs @ 29037 */
+	    "TSB12LV26\0" /* 1 refs @ 29047 */
+	    "TSB43AA22\0" /* 1 refs @ 29057 */
+	    "TSB43AA22/A\0" /* 1 refs @ 29067 */
+	    "TSB43AA23\0" /* 1 refs @ 29079 */
+	    "TSB43AA21\0" /* 1 refs @ 29089 */
+	    "PCI4451\0" /* 2 refs @ 29099 */
+	    "PCI4510\0" /* 2 refs @ 29107 */
+	    "PCI4520\0" /* 2 refs @ 29115 */
+	    "PCI7[4-6]10\0" /* 1 refs @ 29123 */
+	    "PCI7x21/7x11\0" /* 5 refs @ 29135 */
+	    "Cardbus\0" /* 4 refs @ 29148 */
+	    "FlashMedia\0" /* 2 refs @ 29156 */
+	    "SM\0" /* 1 refs @ 29167 */
+	    "PCI6515A\0" /* 2 refs @ 29170 */
+	    "(Smart\0" /* 2 refs @ 29179 */
+	    "PCIXX12\0" /* 5 refs @ 29186 */
+	    "Secure\0" /* 2 refs @ 29194 */
+	    "ACX100A\0" /* 1 refs @ 29201 */
+	    "ACX100B\0" /* 1 refs @ 29209 */
+	    "ACX111\0" /* 1 refs @ 29217 */
+	    "PCI1130\0" /* 1 refs @ 29224 */
+	    "PCI1031\0" /* 1 refs @ 29232 */
+	    "PCI1131\0" /* 1 refs @ 29240 */
+	    "PCI1250\0" /* 1 refs @ 29248 */
+	    "PCI1220\0" /* 1 refs @ 29256 */
+	    "PCI1221\0" /* 1 refs @ 29264 */
+	    "PCI1210\0" /* 1 refs @ 29272 */
+	    "PCI1450\0" /* 1 refs @ 29280 */
+	    "PCI1225\0" /* 1 refs @ 29288 */
+	    "PCI1251\0" /* 1 refs @ 29296 */
+	    "PCI1211\0" /* 1 refs @ 29304 */
+	    "PCI1251B\0" /* 1 refs @ 29312 */
+	    "PCI2030\0" /* 1 refs @ 29321 */
+	    "PCI2050\0" /* 1 refs @ 29329 */
+	    "PCI7510\0" /* 1 refs @ 29337 */
+	    "PCI7610\0" /* 2 refs @ 29345 */
+	    "PCI7410\0" /* 1 refs @ 29353 */
+	    "Mode)\0" /* 3 refs @ 29361 */
+	    "PCI7[46]10\0" /* 2 refs @ 29367 */
+	    "(SD/MMC\0" /* 1 refs @ 29378 */
+	    "(Memory\0" /* 1 refs @ 29386 */
+	    "PCI1410\0" /* 1 refs @ 29394 */
+	    "PCI1420\0" /* 1 refs @ 29402 */
+	    "PCI1451\0" /* 1 refs @ 29410 */
+	    "PCI1421\0" /* 1 refs @ 29418 */
+	    "PCI1620\0" /* 1 refs @ 29426 */
+	    "PCI1520\0" /* 1 refs @ 29434 */
+	    "PCI1510\0" /* 1 refs @ 29442 */
+	    "PCI1530\0" /* 1 refs @ 29450 */
+	    "PCI1515\0" /* 1 refs @ 29458 */
+	    "PCI2040\0" /* 1 refs @ 29466 */
+	    "PCI-DSP\0" /* 1 refs @ 29474 */
+	    "PCI7420\0" /* 1 refs @ 29482 */
+	    "PCI-Cardbus\0" /* 1 refs @ 29490 */
+	    "PCI-010L\0" /* 1 refs @ 29502 */
+	    "PCI-100L\0" /* 1 refs @ 29511 */
+	    "PCI-110L\0" /* 1 refs @ 29520 */
+	    "PCI-200L\0" /* 1 refs @ 29529 */
+	    "PCI-210L\0" /* 1 refs @ 29538 */
+	    "PCI-200Li\0" /* 1 refs @ 29547 */
+	    "PCI-400L\0" /* 1 refs @ 29557 */
+	    "PCI-800L\0" /* 1 refs @ 29566 */
+	    "PCI-011H\0" /* 1 refs @ 29575 */
+	    "PCI-x10H\0" /* 1 refs @ 29584 */
+	    "PCI-100H\0" /* 1 refs @ 29593 */
+	    "PCI-800H\0" /* 1 refs @ 29602 */
+	    "PCI-800H_1\0" /* 1 refs @ 29611 */
+	    "PCI-200H\0" /* 1 refs @ 29622 */
+	    "PCI-010HV2\0" /* 1 refs @ 29631 */
+	    "PCI-200HV2\0" /* 1 refs @ 29642 */
+	    "R4x00\0" /* 1 refs @ 29653 */
+	    "TC35856F\0" /* 1 refs @ 29659 */
+	    "(\"Meteor\")\0" /* 1 refs @ 29668 */
+	    "Portege\0" /* 1 refs @ 29679 */
+	    "Piccolo\0" /* 4 refs @ 29687 */
+	    "ToPIC95\0" /* 1 refs @ 29695 */
+	    "ToPIC95B\0" /* 1 refs @ 29703 */
+	    "ToPIC97\0" /* 1 refs @ 29712 */
+	    "SanRemo?\0" /* 1 refs @ 29720 */
+	    "Triangle\0" /* 1 refs @ 29729 */
+	    "Type-A\0" /* 1 refs @ 29738 */
+	    "ToPIC100\0" /* 1 refs @ 29745 */
+	    "Infrared\0" /* 2 refs @ 29754 */
+	    "Type\0" /* 2 refs @ 29763 */
+	    "O\0" /* 1 refs @ 29768 */
+	    "DO\0" /* 1 refs @ 29770 */
+	    "TM8000\0" /* 1 refs @ 29773 */
+	    "LongRun\0" /* 1 refs @ 29780 */
+	    "SDRAM\0" /* 1 refs @ 29788 */
+	    "BIOS\0" /* 1 refs @ 29794 */
+	    "4DWAVE\0" /* 2 refs @ 29799 */
+	    "DX\0" /* 1 refs @ 29806 */
+	    "NX\0" /* 1 refs @ 29809 */
+	    "CyberBlade\0" /* 2 refs @ 29812 */
+	    "i7\0" /* 1 refs @ 29823 */
+	    "TGUI\0" /* 8 refs @ 29826 */
+	    "9320\0" /* 1 refs @ 29831 */
+	    "9350\0" /* 1 refs @ 29836 */
+	    "9360\0" /* 1 refs @ 29841 */
+	    "CYBER\0" /* 3 refs @ 29846 */
+	    "9397\0" /* 1 refs @ 29852 */
+	    "9397DVD\0" /* 1 refs @ 29857 */
+	    "9525\0" /* 1 refs @ 29865 */
+	    "9420\0" /* 1 refs @ 29870 */
+	    "9440\0" /* 1 refs @ 29875 */
+	    "9660\0" /* 1 refs @ 29880 */
+	    "9680\0" /* 1 refs @ 29885 */
+	    "9682\0" /* 1 refs @ 29890 */
+	    "HPT343/345\0" /* 1 refs @ 29895 */
+	    "HPT366/370/372\0" /* 1 refs @ 29906 */
+	    "HPT372A\0" /* 1 refs @ 29921 */
+	    "HPT302\0" /* 1 refs @ 29929 */
+	    "HPT371\0" /* 1 refs @ 29936 */
+	    "HPT374\0" /* 1 refs @ 29943 */
+	    "HPT372N\0" /* 1 refs @ 29950 */
+	    "RocketRAID\0" /* 2 refs @ 29958 */
+	    "2310\0" /* 1 refs @ 29969 */
+	    "card\0" /* 2 refs @ 29974 */
+	    "2720\0" /* 1 refs @ 29979 */
+	    "Pyramid3D\0" /* 1 refs @ 29984 */
+	    "TR25202\0" /* 1 refs @ 29994 */
+	    "ET4000w32p\0" /* 4 refs @ 30002 */
+	    "ET6000\0" /* 1 refs @ 30013 */
+	    "UM82C881\0" /* 1 refs @ 30020 */
+	    "486\0" /* 2 refs @ 30029 */
+	    "UM82C886\0" /* 1 refs @ 30033 */
+	    "UM8673F\0" /* 1 refs @ 30042 */
+	    "UM8881\0" /* 1 refs @ 30050 */
+	    "UM82C891\0" /* 1 refs @ 30057 */
+	    "UM886A\0" /* 1 refs @ 30066 */
+	    "UM8886BF\0" /* 1 refs @ 30073 */
+	    "UM8710\0" /* 1 refs @ 30082 */
+	    "UM8886\0" /* 1 refs @ 30089 */
+	    "UM8881F\0" /* 1 refs @ 30096 */
+	    "PCI-Host\0" /* 1 refs @ 30104 */
+	    "UM8886F\0" /* 1 refs @ 30113 */
+	    "UM8886A\0" /* 1 refs @ 30121 */
+	    "UM8891A\0" /* 1 refs @ 30129 */
+	    "UM9017F\0" /* 1 refs @ 30137 */
+	    "UM8886N\0" /* 1 refs @ 30145 */
+	    "UM8891N\0" /* 1 refs @ 30153 */
+	    "US201\0" /* 1 refs @ 30161 */
+	    "Voice\0" /* 1 refs @ 30167 */
+	    "(WinModem)\0" /* 1 refs @ 30173 */
+	    "3CP5609\0" /* 1 refs @ 30184 */
+	    "USR997902\0" /* 1 refs @ 30192 */
+	    "V292PBCPSC\0" /* 1 refs @ 30202 */
+	    "Am29K\0" /* 1 refs @ 30213 */
+	    "Local\0" /* 1 refs @ 30219 */
+	    "V292PBC\0" /* 1 refs @ 30225 */
+	    "AMD290x0\0" /* 1 refs @ 30233 */
+	    "V960PBC\0" /* 1 refs @ 30242 */
+	    "V96DPC\0" /* 1 refs @ 30250 */
+	    "(Dual)\0" /* 1 refs @ 30257 */
+	    "VT6305\0" /* 1 refs @ 30264 */
+	    "K8M800\0" /* 1 refs @ 30271 */
+	    "K8T890\0" /* 7 refs @ 30278 */
+	    "KT880\0" /* 6 refs @ 30285 */
+	    "K8HTB\0" /* 3 refs @ 30291 */
+	    "VT8363\0" /* 2 refs @ 30297 */
+	    "(Apollo\0" /* 24 refs @ 30304 */
+	    "KT133)\0" /* 2 refs @ 30312 */
+	    "VT3351\0" /* 7 refs @ 30319 */
+	    "CN896/P4M900\0" /* 10 refs @ 30326 */
+	    "VT8371\0" /* 2 refs @ 30339 */
+	    "KX133)\0" /* 2 refs @ 30346 */
+	    "VX900\0" /* 2 refs @ 30353 */
+	    "VT8501\0" /* 2 refs @ 30359 */
+	    "MVP4)\0" /* 2 refs @ 30366 */
+	    "VT82C505\0" /* 1 refs @ 30372 */
+	    "(Pluto)\0" /* 1 refs @ 30381 */
+	    "VT82C561\0" /* 1 refs @ 30389 */
+	    "VT82C586A\0" /* 1 refs @ 30398 */
+	    "VT82C576\0" /* 1 refs @ 30408 */
+	    "3V\0" /* 1 refs @ 30417 */
+	    "CX700\0" /* 2 refs @ 30420 */
+	    "VT82C580\0" /* 1 refs @ 30426 */
+	    "VP)\0" /* 1 refs @ 30435 */
+	    "VT82C586\0" /* 3 refs @ 30439 */
+	    "VT8237A\0" /* 4 refs @ 30448 */
+	    "VT82C595\0" /* 2 refs @ 30456 */
+	    "VP2)\0" /* 2 refs @ 30465 */
+	    "VT82C596A\0" /* 1 refs @ 30470 */
+	    "VT82C597\0" /* 2 refs @ 30480 */
+	    "VP3)\0" /* 2 refs @ 30489 */
+	    "VT82C598\0" /* 2 refs @ 30494 */
+	    "MVP3)\0" /* 2 refs @ 30503 */
+	    "VT8605\0" /* 2 refs @ 30509 */
+	    "ProMedia\0" /* 2 refs @ 30516 */
+	    "133)\0" /* 2 refs @ 30525 */
+	    "VT82C686A\0" /* 4 refs @ 30530 */
+	    "VT82C691\0" /* 1 refs @ 30540 */
+	    "Pro)\0" /* 1 refs @ 30549 */
+	    "VT82C693\0" /* 1 refs @ 30554 */
+	    "Plus)\0" /* 1 refs @ 30563 */
+	    "VT86C926\0" /* 1 refs @ 30569 */
+	    "Amazon\0" /* 1 refs @ 30578 */
+	    "PCI-Ethernet\0" /* 1 refs @ 30585 */
+	    "VT82C570M\0" /* 2 refs @ 30598 */
+	    "(Apollo)\0" /* 2 refs @ 30608 */
+	    "VT8251\0" /* 6 refs @ 30617 */
+	    "Port1\0" /* 1 refs @ 30624 */
+	    "Port2\0" /* 1 refs @ 30630 */
+	    "VLINK\0" /* 1 refs @ 30636 */
+	    "VT83C572\0" /* 1 refs @ 30642 */
+	    "VT3043\0" /* 1 refs @ 30651 */
+	    "(Rhine)\0" /* 1 refs @ 30658 */
+	    "VT6306\0" /* 1 refs @ 30666 */
+	    "VT6105M\0" /* 1 refs @ 30673 */
+	    "(Rhine\0" /* 3 refs @ 30681 */
+	    "VT8233/VT8235\0" /* 1 refs @ 30688 */
+	    "VT6102\0" /* 1 refs @ 30702 */
+	    "MC-97\0" /* 1 refs @ 30709 */
+	    "VT8233\0" /* 1 refs @ 30715 */
+	    "VT8366\0" /* 2 refs @ 30722 */
+	    "KT266)\0" /* 2 refs @ 30729 */
+	    "CPU-PCI\0" /* 3 refs @ 30736 */
+	    "VT8653\0" /* 1 refs @ 30744 */
+	    "266T)\0" /* 1 refs @ 30751 */
+	    "VT8237\0" /* 4 refs @ 30757 */
+	    "VT6105\0" /* 1 refs @ 30764 */
+	    "VT612X\0" /* 1 refs @ 30771 */
+	    "(Velocity)\0" /* 1 refs @ 30778 */
+	    "VT8623\0" /* 2 refs @ 30789 */
+	    "CLE266)\0" /* 2 refs @ 30796 */
+	    "VT8233A\0" /* 1 refs @ 30804 */
+	    "VT6410\0" /* 1 refs @ 30812 */
+	    "VT8235\0" /* 1 refs @ 30819 */
+	    "KT400)\0" /* 1 refs @ 30826 */
+	    "VT8377\0" /* 2 refs @ 30833 */
+	    "Apollo\0" /* 2 refs @ 30840 */
+	    "KT400\0" /* 1 refs @ 30847 */
+	    "VT8378\0" /* 2 refs @ 30853 */
+	    "KM400\0" /* 2 refs @ 30860 */
+	    "VT6421\0" /* 1 refs @ 30866 */
+	    "VT8237A/VT8251\0" /* 1 refs @ 30873 */
+	    "VT8237A/VT82C586A\0" /* 1 refs @ 30888 */
+	    "VT3314\0" /* 1 refs @ 30906 */
+	    "CN900\0" /* 1 refs @ 30913 */
+	    "UniChrome\0" /* 2 refs @ 30919 */
+	    "VT8237R\0" /* 1 refs @ 30929 */
+	    "Chrome9\0" /* 1 refs @ 30937 */
+	    "HC\0" /* 1 refs @ 30945 */
+	    "VT8237S\0" /* 2 refs @ 30948 */
+	    "CX700M2/VX700\0" /* 1 refs @ 30956 */
+	    "VT86C100A\0" /* 1 refs @ 30970 */
+	    "(Rhine-II)\0" /* 1 refs @ 30980 */
+	    "VT8231\0" /* 2 refs @ 30991 */
+	    "VX800/VX820\0" /* 1 refs @ 30998 */
+	    "CPU-AGP\0" /* 7 refs @ 31010 */
+	    "VT8633\0" /* 1 refs @ 31018 */
+	    "266)\0" /* 1 refs @ 31025 */
+	    "VT8377CE\0" /* 1 refs @ 31030 */
+	    "Guest\0" /* 1 refs @ 31039 */
+	    "Service\0" /* 1 refs @ 31045 */
+	    "GDT6000/6020/6050\0" /* 1 refs @ 31053 */
+	    "GDT6000B/6010\0" /* 1 refs @ 31071 */
+	    "GDT6110/6510\0" /* 1 refs @ 31085 */
+	    "GDT6120/6520\0" /* 1 refs @ 31098 */
+	    "GDT6530\0" /* 1 refs @ 31111 */
+	    "GDT6550\0" /* 1 refs @ 31119 */
+	    "GDT6117/6517\0" /* 1 refs @ 31127 */
+	    "GDT6127/6527\0" /* 1 refs @ 31140 */
+	    "GDT6537\0" /* 1 refs @ 31153 */
+	    "GDT6557/6557-ECC\0" /* 1 refs @ 31161 */
+	    "GDT6115/6515\0" /* 1 refs @ 31178 */
+	    "GDT6125/6525\0" /* 1 refs @ 31191 */
+	    "GDT6535\0" /* 1 refs @ 31204 */
+	    "GDT6555/6555-ECC\0" /* 1 refs @ 31212 */
+	    "GDT6[15]17RP\0" /* 1 refs @ 31229 */
+	    "GDT6[15]27RP\0" /* 1 refs @ 31242 */
+	    "GDT6537RP\0" /* 1 refs @ 31255 */
+	    "GDT6557RP\0" /* 1 refs @ 31265 */
+	    "GDT6[15]11RP\0" /* 1 refs @ 31275 */
+	    "GDT6[15]21RP\0" /* 1 refs @ 31288 */
+	    "GDT6[15]17RD\0" /* 1 refs @ 31301 */
+	    "GDT6[5]127RD\0" /* 1 refs @ 31314 */
+	    "GDT6537RD\0" /* 1 refs @ 31327 */
+	    "GDT6557RD\0" /* 1 refs @ 31337 */
+	    "GDT6[15]11RD\0" /* 1 refs @ 31347 */
+	    "GDT6[15]21RD\0" /* 1 refs @ 31360 */
+	    "GDT6[156]18RD\0" /* 1 refs @ 31373 */
+	    "GDT6[156]28RD\0" /* 1 refs @ 31387 */
+	    "GDT6[56]38RD\0" /* 1 refs @ 31401 */
+	    "GDT6[56]58RD\0" /* 1 refs @ 31414 */
+	    "GDT6[15]17RP2\0" /* 1 refs @ 31427 */
+	    "GDT6[15]27RP2\0" /* 1 refs @ 31441 */
+	    "GDT6537RP2\0" /* 1 refs @ 31455 */
+	    "GDT6[15]11RP2\0" /* 1 refs @ 31466 */
+	    "GDT6[15]21RP2\0" /* 1 refs @ 31480 */
+	    "GDT6513RS\0" /* 1 refs @ 31494 */
+	    "GDT6523RS\0" /* 1 refs @ 31504 */
+	    "GDT6518RS\0" /* 1 refs @ 31514 */
+	    "GDT6x28RS\0" /* 1 refs @ 31524 */
+	    "GDT6x38RS\0" /* 1 refs @ 31534 */
+	    "GDT6x58RS\0" /* 1 refs @ 31544 */
+	    "GDT6x33RS\0" /* 1 refs @ 31554 */
+	    "GDT6x43RS\0" /* 1 refs @ 31564 */
+	    "GDT6x53RS\0" /* 1 refs @ 31574 */
+	    "GDT6x63RS\0" /* 1 refs @ 31584 */
+	    "GDT7x13RN\0" /* 1 refs @ 31594 */
+	    "GDT7x23RN\0" /* 1 refs @ 31604 */
+	    "GDT7[156]18RN\0" /* 1 refs @ 31614 */
+	    "GDT7[156]28RN\0" /* 1 refs @ 31628 */
+	    "GDT7[56]38RN\0" /* 1 refs @ 31642 */
+	    "GDT7[56]58RN\0" /* 1 refs @ 31655 */
+	    "GDT7[56]43RN\0" /* 1 refs @ 31668 */
+	    "GDT7x53RN\0" /* 1 refs @ 31681 */
+	    "GDT7x63RN\0" /* 1 refs @ 31691 */
+	    "GDT4x13RZ\0" /* 1 refs @ 31701 */
+	    "GDT4x23RZ\0" /* 1 refs @ 31711 */
+	    "GDT8x13RZ\0" /* 1 refs @ 31721 */
+	    "GDT8x23RZ\0" /* 1 refs @ 31731 */
+	    "GDT8x33RZ\0" /* 1 refs @ 31741 */
+	    "GDT8x43RZ\0" /* 1 refs @ 31751 */
+	    "GDT8x53RZ\0" /* 1 refs @ 31761 */
+	    "GDT8x63RZ\0" /* 1 refs @ 31771 */
+	    "GDT6[56]19RD\0" /* 1 refs @ 31781 */
+	    "GDT6[56]29RD\0" /* 1 refs @ 31794 */
+	    "GDT7[56]19RN\0" /* 1 refs @ 31807 */
+	    "GDT7[56]29RN\0" /* 1 refs @ 31820 */
+	    "ICP\0" /* 1 refs @ 31833 */
+	    "82C592\0" /* 1 refs @ 31837 */
+	    "82C593\0" /* 1 refs @ 31844 */
+	    "82C594\0" /* 1 refs @ 31851 */
+	    "Wildcat\0" /* 2 refs @ 31858 */
+	    "82C596/597\0" /* 1 refs @ 31866 */
+	    "82C541\0" /* 1 refs @ 31877 */
+	    "82C543\0" /* 1 refs @ 31884 */
+	    "82C532\0" /* 1 refs @ 31891 */
+	    "82C534\0" /* 1 refs @ 31898 */
+	    "82C535\0" /* 1 refs @ 31905 */
+	    "82C147\0" /* 1 refs @ 31912 */
+	    "82C975\0" /* 1 refs @ 31919 */
+	    "82C925\0" /* 1 refs @ 31926 */
+	    "SVGA\0" /* 2 refs @ 31933 */
+	    "Machine\0" /* 1 refs @ 31938 */
+	    "Communication\0" /* 1 refs @ 31946 */
+	    "82545EM\0" /* 1 refs @ 31960 */
+	    "82546EB\0" /* 1 refs @ 31968 */
+	    "PVSCSI\0" /* 1 refs @ 31976 */
+	    "VMI\0" /* 1 refs @ 31983 */
+	    "option\0" /* 1 refs @ 31987 */
+	    "ROM\0" /* 1 refs @ 31994 */
+	    "P9000\0" /* 1 refs @ 31998 */
+	    "P9100\0" /* 1 refs @ 32004 */
+	    "WD33C193A\0" /* 1 refs @ 32010 */
+	    "WD33C196A\0" /* 1 refs @ 32020 */
+	    "WD33C197A\0" /* 1 refs @ 32030 */
+	    "WD7193\0" /* 1 refs @ 32040 */
+	    "WD7197\0" /* 1 refs @ 32047 */
+	    "WD33C296A\0" /* 1 refs @ 32054 */
+	    "WD34C296\0" /* 1 refs @ 32064 */
+	    "90C\0" /* 1 refs @ 32073 */
+	    "W83769F\0" /* 1 refs @ 32077 */
+	    "W83C553F\0" /* 2 refs @ 32085 */
+	    "W83628F\0" /* 1 refs @ 32094 */
+	    "W89C840F\0" /* 1 refs @ 32102 */
+	    "W89C940F\0" /* 2 refs @ 32111 */
+	    "W6692\0" /* 1 refs @ 32120 */
+	    "NinjaSCSI-32UDE\0" /* 5 refs @ 32126 */
+	    "(KME)\0" /* 3 refs @ 32142 */
+	    "(IODATA)\0" /* 1 refs @ 32148 */
+	    "(LOGITEC)\0" /* 1 refs @ 32157 */
+	    "(LOGITEC2)\0" /* 1 refs @ 32167 */
+	    "(BUFFALO)\0" /* 2 refs @ 32178 */
+	    "CF32A\0" /* 2 refs @ 32188 */
+	    "CompactFlash\0" /* 1 refs @ 32194 */
+	    "CF\0" /* 1 refs @ 32207 */
+	    "NPATA-32\0" /* 1 refs @ 32210 */
+	    "Xen\0" /* 1 refs @ 32219 */
+	    "Platform\0" /* 1 refs @ 32223 */
+	    "Volari\0" /* 5 refs @ 32232 */
+	    "Z7/Z9/Z9s\0" /* 1 refs @ 32239 */
+	    "Z9m\0" /* 1 refs @ 32249 */
+	    "Z11/Z11M\0" /* 1 refs @ 32253 */
+	    "V3XT/V5/V8\0" /* 1 refs @ 32262 */
+	    "XP10\0" /* 1 refs @ 32273 */
+	    "X3201-3\0" /* 2 refs @ 32278 */
+	    "(21143)\0" /* 1 refs @ 32286 */
+	    "WinGlobal\0" /* 1 refs @ 32294 */
+	    "724\0" /* 1 refs @ 32304 */
+	    "740C\0" /* 1 refs @ 32308 */
+	    "(DS-1)\0" /* 2 refs @ 32313 */
+	    "724F\0" /* 1 refs @ 32320 */
+	    "744\0" /* 1 refs @ 32325 */
+	    "(DS-1S)\0" /* 1 refs @ 32329 */
+	    "754\0" /* 1 refs @ 32337 */
+	    "(DS-1E)\0" /* 1 refs @ 32341 */
+	    "1221\0" /* 1 refs @ 32349 */
+	    "PCI-ST32\0" /* 1 refs @ 32354 */
+	    "ZR36057\0" /* 1 refs @ 32363 */
+	    "ZR36120\0" /* 1 refs @ 32371 */
+};
+const int pci_nwords = 4394;
+

Property changes on: lab4/.minix-src/include/dev/pci/pcidevs_data.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/pci/tweio.h
===================================================================
--- lab4/.minix-src/include/dev/pci/tweio.h	(nonexistent)
+++ lab4/.minix-src/include/dev/pci/tweio.h	(revision 13)
@@ -0,0 +1,110 @@
+/*	$NetBSD: tweio.h,v 1.5 2005/12/11 12:22:51 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2000 Michael Smith
+ * Copyright (c) 2000 BSDi
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from FreeBSD: tweio.h,v 1.1 2000/10/25 06:59:05 msmith Exp
+ */
+
+#ifndef _DEV_PCI_TWEIO_H_
+#define	_DEV_PCI_TWEIO_H_
+
+#include <sys/ioccom.h>
+#include <dev/pci/twereg.h>
+
+/*
+ * User-space command
+ *
+ * Note that the command's scatter/gather list will be computed by the
+ * driver, and cannot be filled in by the consumer.
+ */
+struct twe_usercommand {
+	struct twe_cmd	tu_cmd;		/* command ready for the controller */
+	void		*tu_data;	/* pointer to data in userspace */
+	size_t		tu_size;	/* userspace data length */
+};
+
+#define TWEIO_COMMAND	_IOWR('T', 100, struct twe_usercommand)
+
+/*
+ * Command queue statistics
+ */
+#define	TWEQ_FREE	0
+#define	TWEQ_BIO	1
+#define	TWEQ_READY	2
+#define	TWEQ_BUSY	3
+#define	TWEQ_COMPLETE	4
+#define	TWEQ_COUNT	5	/* total number of queues */
+
+struct twe_qstat {
+	u_int32_t	q_length;
+	u_int32_t	q_max;
+};
+
+/*
+ * Statistics request
+ */
+union twe_statrequest {
+	u_int32_t		ts_item;
+	struct twe_qstat	ts_qstat;
+};
+
+#define	TWEIO_STATS	_IOWR('T', 101, union twe_statrequest)
+
+/*
+ * AEN listen
+ */
+#define	TWEIO_AEN_POLL	_IOR('T', 102, int)
+#define	TWEIO_AEN_WAIT	_IOR('T', 103, int)
+
+/*
+ * Controller parameter access
+ */
+struct twe_paramcommand {
+	u_int16_t	tp_table_id;
+	u_int8_t	tp_param_id;
+	void		*tp_data;
+	u_int8_t	tp_size;
+};
+
+#define	TWEIO_SET_PARAM	_IOW('T', 104, struct twe_paramcommand)
+#define	TWEIO_GET_PARAM	_IOW('T', 105, struct twe_paramcommand)
+
+/*
+ * Request a controller soft-reset
+ */
+#define	TWEIO_RESET	_IO('T', 106)
+
+/*
+ * Request a drive addition or deletion
+ */
+struct twe_drivecommand {
+	int		td_unit;
+};
+#define	TWEIO_ADD_UNIT	_IOW('U', 107, struct twe_drivecommand)
+#define	TWEIO_DEL_UNIT	_IOW('U', 108, struct twe_drivecommand)
+
+#endif /* _DEV_PCI_TWEIO_H_ */

Property changes on: lab4/.minix-src/include/dev/pci/tweio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/buffer_compat.h
===================================================================
--- lab4/.minix-src/include/event2/buffer_compat.h	(nonexistent)
+++ lab4/.minix-src/include/event2/buffer_compat.h	(revision 13)
@@ -0,0 +1,112 @@
+/*	$NetBSD: buffer_compat.h,v 1.1.1.2 2015/01/29 06:38:25 spz Exp $	*/
+/*	$NetBSD: buffer_compat.h,v 1.1.1.2 2015/01/29 06:38:25 spz Exp $	*/
+/*
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+#ifndef _EVENT2_BUFFER_COMPAT_H_
+#define _EVENT2_BUFFER_COMPAT_H_
+
+/** @file event2/buffer_compat.h
+
+	Obsolete and deprecated versions of the functions in buffer.h: provided
+	only for backward compatibility.
+ */
+
+
+/**
+   Obsolete alias for evbuffer_readln(buffer, NULL, EOL_STYLE_ANY).
+
+   @deprecated This function is deprecated because its behavior is not correct
+      for almost any protocol, and also because it's wholly subsumed by
+      evbuffer_readln().
+
+   @param buffer the evbuffer to read from
+   @return pointer to a single line, or NULL if an error occurred
+
+*/
+char *evbuffer_readline(struct evbuffer *buffer);
+
+/** Type definition for a callback that is invoked whenever data is added or
+    removed from an evbuffer.
+
+    An evbuffer may have one or more callbacks set at a time.  The order
+    in which they are executed is undefined.
+
+    A callback function may add more callbacks, or remove itself from the
+    list of callbacks, or add or remove data from the buffer.  It may not
+    remove another callback from the list.
+
+    If a callback adds or removes data from the buffer or from another
+    buffer, this can cause a recursive invocation of your callback or
+    other callbacks.  If you ask for an infinite loop, you might just get
+    one: watch out!
+
+    @param buffer the buffer whose size has changed
+    @param old_len the previous length of the buffer
+    @param new_len the current length of the buffer
+    @param arg a pointer to user data
+*/
+typedef void (*evbuffer_cb)(struct evbuffer *buffer, size_t old_len, size_t new_len, void *arg);
+
+/**
+  Replace all callbacks on an evbuffer with a single new callback, or
+  remove them.
+
+  Subsequent calls to evbuffer_setcb() replace callbacks set by previous
+  calls.  Setting the callback to NULL removes any previously set callback.
+
+  @deprecated This function is deprecated because it clears all previous
+     callbacks set on the evbuffer, which can cause confusing behavior if
+     multiple parts of the code all want to add their own callbacks on a
+     buffer.  Instead, use evbuffer_add(), evbuffer_del(), and
+     evbuffer_setflags() to manage your own evbuffer callbacks without
+     interfering with callbacks set by others.
+
+  @param buffer the evbuffer to be monitored
+  @param cb the callback function to invoke when the evbuffer is modified,
+	 or NULL to remove all callbacks.
+  @param cbarg an argument to be provided to the callback function
+ */
+void evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
+
+
+/**
+  Find a string within an evbuffer.
+
+  @param buffer the evbuffer to be searched
+  @param what the string to be searched for
+  @param len the length of the search string
+  @return a pointer to the beginning of the search string, or NULL if the search failed.
+ */
+unsigned char *evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len);
+
+/** deprecated in favor of calling the functions directly */
+#define EVBUFFER_LENGTH(x)	evbuffer_get_length(x)
+/** deprecated in favor of calling the functions directly */
+#define EVBUFFER_DATA(x)	evbuffer_pullup((x), -1)
+
+#endif
+

Property changes on: lab4/.minix-src/include/event2/buffer_compat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/bufferevent_struct.h
===================================================================
--- lab4/.minix-src/include/event2/bufferevent_struct.h	(nonexistent)
+++ lab4/.minix-src/include/event2/bufferevent_struct.h	(revision 13)
@@ -0,0 +1,118 @@
+/*	$NetBSD: bufferevent_struct.h,v 1.1.1.2 2015/01/29 06:38:26 spz Exp $	*/
+/*	$NetBSD: bufferevent_struct.h,v 1.1.1.2 2015/01/29 06:38:26 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_BUFFEREVENT_STRUCT_H_
+#define _EVENT2_BUFFEREVENT_STRUCT_H_
+
+/** @file event2/bufferevent_struct.h
+
+  Data structures for bufferevents.  Using these structures may hurt forward
+  compatibility with later versions of Libevent: be careful!
+
+  @deprecated Use of bufferevent_struct.h is completely deprecated; these
+    structures are only exposed for backward compatibility with programs
+    written before Libevent 2.0 that used them.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+/* For int types. */
+#include <event2/util.h>
+/* For struct event */
+#include <event2/event_struct.h>
+
+struct event_watermark {
+	size_t low;
+	size_t high;
+};
+
+/**
+  Shared implementation of a bufferevent.
+
+  This type is exposed only because it was exposed in previous versions,
+  and some people's code may rely on manipulating it.  Otherwise, you
+  should really not rely on the layout, size, or contents of this structure:
+  it is fairly volatile, and WILL change in future versions of the code.
+**/
+struct bufferevent {
+	/** Event base for which this bufferevent was created. */
+	struct event_base *ev_base;
+	/** Pointer to a table of function pointers to set up how this
+	    bufferevent behaves. */
+	const struct bufferevent_ops *be_ops;
+
+	/** A read event that triggers when a timeout has happened or a socket
+	    is ready to read data.  Only used by some subtypes of
+	    bufferevent. */
+	struct event ev_read;
+	/** A write event that triggers when a timeout has happened or a socket
+	    is ready to write data.  Only used by some subtypes of
+	    bufferevent. */
+	struct event ev_write;
+
+	/** An input buffer. Only the bufferevent is allowed to add data to
+	    this buffer, though the user is allowed to drain it. */
+	struct evbuffer *input;
+
+	/** An input buffer. Only the bufferevent is allowed to drain data
+	    from this buffer, though the user is allowed to add it. */
+	struct evbuffer *output;
+
+	struct event_watermark wm_read;
+	struct event_watermark wm_write;
+
+	bufferevent_data_cb readcb;
+	bufferevent_data_cb writecb;
+	/* This should be called 'eventcb', but renaming it would break
+	 * backward compatibility */
+	bufferevent_event_cb errorcb;
+	void *cbarg;
+
+	struct timeval timeout_read;
+	struct timeval timeout_write;
+
+	/** Events that are currently enabled: currently EV_READ and EV_WRITE
+	    are supported. */
+	short enabled;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_BUFFEREVENT_STRUCT_H_ */

Property changes on: lab4/.minix-src/include/event2/bufferevent_struct.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/event_struct.h
===================================================================
--- lab4/.minix-src/include/event2/event_struct.h	(nonexistent)
+++ lab4/.minix-src/include/event2/event_struct.h	(revision 13)
@@ -0,0 +1,143 @@
+/*	$NetBSD: event_struct.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*	$NetBSD: event_struct.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_EVENT_STRUCT_H_
+#define _EVENT2_EVENT_STRUCT_H_
+
+/** @file event2/event_struct.h
+
+  Structures used by event.h.  Using these structures directly WILL harm
+  forward compatibility: be careful.
+
+  No field declared in this file should be used directly in user code.  Except
+  for historical reasons, these fields would not be exposed at all.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+/* For int types. */
+#include <event2/util.h>
+
+/* For evkeyvalq */
+#include <event2/keyvalq_struct.h>
+
+#define EVLIST_TIMEOUT	0x01
+#define EVLIST_INSERTED	0x02
+#define EVLIST_SIGNAL	0x04
+#define EVLIST_ACTIVE	0x08
+#define EVLIST_INTERNAL	0x10
+#define EVLIST_INIT	0x80
+
+/* EVLIST_X_ Private space: 0x1000-0xf000 */
+#define EVLIST_ALL	(0xf000 | 0x9f)
+
+/* Fix so that people don't have to run with <sys/queue.h> */
+#ifndef TAILQ_ENTRY
+#define _EVENT_DEFINED_TQENTRY
+#define TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+}
+#endif /* !TAILQ_ENTRY */
+
+#ifndef TAILQ_HEAD
+#define _EVENT_DEFINED_TQHEAD
+#define TAILQ_HEAD(name, type)			\
+struct name {					\
+	struct type *tqh_first;			\
+	struct type **tqh_last;			\
+}
+#endif
+
+struct event_base;
+struct event {
+	TAILQ_ENTRY(event) ev_active_next;
+	TAILQ_ENTRY(event) ev_next;
+	/* for managing timeouts */
+	union {
+		TAILQ_ENTRY(event) ev_next_with_common_timeout;
+		int min_heap_idx;
+	} ev_timeout_pos;
+	evutil_socket_t ev_fd;
+
+	struct event_base *ev_base;
+
+	union {
+		/* used for io events */
+		struct {
+			TAILQ_ENTRY(event) ev_io_next;
+			struct timeval ev_timeout;
+		} ev_io;
+
+		/* used by signal events */
+		struct {
+			TAILQ_ENTRY(event) ev_signal_next;
+			short ev_ncalls;
+			/* Allows deletes in callback */
+			short *ev_pncalls;
+		} ev_signal;
+	} _ev;
+
+	short ev_events;
+	short ev_res;		/* result passed to event callback */
+	short ev_flags;
+	ev_uint8_t ev_pri;	/* smaller numbers are higher priority */
+	ev_uint8_t ev_closure;
+	struct timeval ev_timeout;
+
+	/* allows us to adopt for different types of events */
+	void (*ev_callback)(evutil_socket_t, short, void *arg);
+	void *ev_arg;
+};
+
+TAILQ_HEAD (event_list, event);
+
+#ifdef _EVENT_DEFINED_TQENTRY
+#undef TAILQ_ENTRY
+#endif
+
+#ifdef _EVENT_DEFINED_TQHEAD
+#undef TAILQ_HEAD
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_EVENT_STRUCT_H_ */

Property changes on: lab4/.minix-src/include/event2/event_struct.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/keyvalq_struct.h
===================================================================
--- lab4/.minix-src/include/event2/keyvalq_struct.h	(nonexistent)
+++ lab4/.minix-src/include/event2/keyvalq_struct.h	(revision 13)
@@ -0,0 +1,82 @@
+/*	$NetBSD: keyvalq_struct.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*	$NetBSD: keyvalq_struct.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_EVENT_KEYVALQ_STRUCT_H_
+#define _EVENT2_EVENT_KEYVALQ_STRUCT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Fix so that people don't have to run with <sys/queue.h> */
+/* XXXX This code is duplicated with event_struct.h */
+#ifndef TAILQ_ENTRY
+#define _EVENT_DEFINED_TQENTRY
+#define TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+}
+#endif /* !TAILQ_ENTRY */
+
+#ifndef TAILQ_HEAD
+#define _EVENT_DEFINED_TQHEAD
+#define TAILQ_HEAD(name, type)			\
+struct name {					\
+	struct type *tqh_first;			\
+	struct type **tqh_last;			\
+}
+#endif
+
+/*
+ * Key-Value pairs.  Can be used for HTTP headers but also for
+ * query argument parsing.
+ */
+struct evkeyval {
+	TAILQ_ENTRY(evkeyval) next;
+
+	char *key;
+	char *value;
+};
+
+TAILQ_HEAD (evkeyvalq, evkeyval);
+
+/* XXXX This code is duplicated with event_struct.h */
+#ifdef _EVENT_DEFINED_TQENTRY
+#undef TAILQ_ENTRY
+#endif
+
+#ifdef _EVENT_DEFINED_TQHEAD
+#undef TAILQ_HEAD
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/event2/keyvalq_struct.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/rpc_struct.h
===================================================================
--- lab4/.minix-src/include/event2/rpc_struct.h	(nonexistent)
+++ lab4/.minix-src/include/event2/rpc_struct.h	(revision 13)
@@ -0,0 +1,102 @@
+/*	$NetBSD: rpc_struct.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*	$NetBSD: rpc_struct.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*
+ * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_RPC_STRUCT_H_
+#define _EVENT2_RPC_STRUCT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file event2/rpc_struct.h
+
+  Structures used by rpc.h.  Using these structures directly may harm
+  forward compatibility: be careful!
+
+ */
+
+/**
+ * provides information about the completed RPC request.
+ */
+struct evrpc_status {
+#define EVRPC_STATUS_ERR_NONE		0
+#define EVRPC_STATUS_ERR_TIMEOUT	1
+#define EVRPC_STATUS_ERR_BADPAYLOAD	2
+#define EVRPC_STATUS_ERR_UNSTARTED	3
+#define EVRPC_STATUS_ERR_HOOKABORTED	4
+	int error;
+
+	/* for looking at headers or other information */
+	struct evhttp_request *http_req;
+};
+
+/* the structure below needs to be synchronized with evrpc_req_generic */
+
+/* Encapsulates a request */
+struct evrpc {
+	TAILQ_ENTRY(evrpc) next;
+
+	/* the URI at which the request handler lives */
+	const char* uri;
+
+	/* creates a new request structure */
+	void *(*request_new)(void *);
+	void *request_new_arg;
+
+	/* frees the request structure */
+	void (*request_free)(void *);
+
+	/* unmarshals the buffer into the proper request structure */
+	int (*request_unmarshal)(void *, struct evbuffer *);
+
+	/* creates a new reply structure */
+	void *(*reply_new)(void *);
+	void *reply_new_arg;
+
+	/* frees the reply structure */
+	void (*reply_free)(void *);
+
+	/* verifies that the reply is valid */
+	int (*reply_complete)(void *);
+
+	/* marshals the reply into a buffer */
+	void (*reply_marshal)(struct evbuffer*, void *);
+
+	/* the callback invoked for each received rpc */
+	void (*cb)(struct evrpc_req_generic *, void *);
+	void *cb_arg;
+
+	/* reference for further configuration */
+	struct evrpc_base *base;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_RPC_STRUCT_H_ */

Property changes on: lab4/.minix-src/include/event2/rpc_struct.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/util.h
===================================================================
--- lab4/.minix-src/include/event2/util.h	(nonexistent)
+++ lab4/.minix-src/include/event2/util.h	(revision 13)
@@ -0,0 +1,714 @@
+/*	$NetBSD: util.h,v 1.3 2015/01/29 07:26:02 spz Exp $	*/
+/*
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_UTIL_H_
+#define _EVENT2_UTIL_H_
+
+/** @file event2/util.h
+
+  Common convenience functions for cross-platform portability and
+  related socket manipulations.
+
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef _EVENT_HAVE_STDINT_H
+#include <stdint.h>
+#elif defined(_EVENT_HAVE_INTTYPES_H)
+#include <inttypes.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+#ifdef _MSC_VER
+#include <BaseTsd.h>
+#endif
+#include <stdarg.h>
+#ifdef _EVENT_HAVE_NETDB_H
+#if !defined(_GNU_SOURCE)
+#define _GNU_SOURCE
+#endif
+#include <netdb.h>
+#endif
+
+#ifdef WIN32
+#include <winsock2.h>
+#else
+#include <sys/socket.h>
+#endif
+
+/* Some openbsd autoconf versions get the name of this macro wrong. */
+#if defined(_EVENT_SIZEOF_VOID__) && !defined(_EVENT_SIZEOF_VOID_P)
+#define _EVENT_SIZEOF_VOID_P _EVENT_SIZEOF_VOID__
+#endif
+
+/**
+ * @name Standard integer types.
+ *
+ * Integer type definitions for types that are supposed to be defined in the
+ * C99-specified stdint.h.  Shamefully, some platforms do not include
+ * stdint.h, so we need to replace it.  (If you are on a platform like this,
+ * your C headers are now over 10 years out of date.  You should bug them to
+ * do something about this.)
+ *
+ * We define:
+ *
+ * <dl>
+ *   <dt>ev_uint64_t, ev_uint32_t, ev_uint16_t, ev_uint8_t</dt>
+ *      <dd>unsigned integer types of exactly 64, 32, 16, and 8 bits
+ *          respectively.</dd>
+ *    <dt>ev_int64_t, ev_int32_t, ev_int16_t, ev_int8_t</dt>
+ *      <dd>signed integer types of exactly 64, 32, 16, and 8 bits
+ *          respectively.</dd>
+ *    <dt>ev_uintptr_t, ev_intptr_t</dt>
+ *      <dd>unsigned/signed integers large enough
+ *      to hold a pointer without loss of bits.</dd>
+ *    <dt>ev_ssize_t</dt>
+ *      <dd>A signed type of the same size as size_t</dd>
+ *    <dt>ev_off_t</dt>
+ *      <dd>A signed type typically used to represent offsets within a
+ *      (potentially large) file</dd>
+ *
+ * @{
+ */
+#ifdef _EVENT_HAVE_UINT64_T
+#define ev_uint64_t uint64_t
+#define ev_int64_t int64_t
+#elif defined(WIN32)
+#define ev_uint64_t unsigned __int64
+#define ev_int64_t signed __int64
+#elif _EVENT_SIZEOF_LONG_LONG == 8
+#define ev_uint64_t unsigned long long
+#define ev_int64_t long long
+#elif _EVENT_SIZEOF_LONG == 8
+#define ev_uint64_t unsigned long
+#define ev_int64_t long
+#elif defined(_EVENT_IN_DOXYGEN)
+#define ev_uint64_t ...
+#define ev_int64_t ...
+#else
+#error "No way to define ev_uint64_t"
+#endif
+
+#ifdef _EVENT_HAVE_UINT32_T
+#define ev_uint32_t uint32_t
+#define ev_int32_t int32_t
+#elif defined(WIN32)
+#define ev_uint32_t unsigned int
+#define ev_int32_t signed int
+#elif _EVENT_SIZEOF_LONG == 4
+#define ev_uint32_t unsigned long
+#define ev_int32_t signed long
+#elif _EVENT_SIZEOF_INT == 4
+#define ev_uint32_t unsigned int
+#define ev_int32_t signed int
+#elif defined(_EVENT_IN_DOXYGEN)
+#define ev_uint32_t ...
+#define ev_int32_t ...
+#else
+#error "No way to define ev_uint32_t"
+#endif
+
+#ifdef _EVENT_HAVE_UINT16_T
+#define ev_uint16_t uint16_t
+#define ev_int16_t  int16_t
+#elif defined(WIN32)
+#define ev_uint16_t unsigned short
+#define ev_int16_t  signed short
+#elif _EVENT_SIZEOF_INT == 2
+#define ev_uint16_t unsigned int
+#define ev_int16_t  signed int
+#elif _EVENT_SIZEOF_SHORT == 2
+#define ev_uint16_t unsigned short
+#define ev_int16_t  signed short
+#elif defined(_EVENT_IN_DOXYGEN)
+#define ev_uint16_t ...
+#define ev_int16_t ...
+#else
+#error "No way to define ev_uint16_t"
+#endif
+
+#ifdef _EVENT_HAVE_UINT8_T
+#define ev_uint8_t uint8_t
+#define ev_int8_t int8_t
+#elif defined(_EVENT_IN_DOXYGEN)
+#define ev_uint8_t ...
+#define ev_int8_t ...
+#else
+#define ev_uint8_t unsigned char
+#define ev_int8_t signed char
+#endif
+
+#ifdef _EVENT_HAVE_UINTPTR_T
+#define ev_uintptr_t uintptr_t
+#define ev_intptr_t intptr_t
+#elif _EVENT_SIZEOF_VOID_P <= 4
+#define ev_uintptr_t ev_uint32_t
+#define ev_intptr_t ev_int32_t
+#elif _EVENT_SIZEOF_VOID_P <= 8
+#define ev_uintptr_t ev_uint64_t
+#define ev_intptr_t ev_int64_t
+#elif defined(_EVENT_IN_DOXYGEN)
+#define ev_uintptr_t ...
+#define ev_intptr_t ...
+#else
+#error "No way to define ev_uintptr_t"
+#endif
+
+#ifdef _EVENT_ssize_t
+#define ev_ssize_t _EVENT_ssize_t
+#else
+#define ev_ssize_t ssize_t
+#endif
+
+#ifdef WIN32
+#define ev_off_t ev_int64_t
+#else
+#define ev_off_t off_t
+#endif
+/**@}*/
+
+/* Limits for integer types.
+
+   We're making two assumptions here:
+     - The compiler does constant folding properly.
+     - The platform does signed arithmetic in two's complement.
+*/
+
+/**
+   @name Limits for integer types
+
+   These macros hold the largest or smallest values possible for the
+   ev_[u]int*_t types.
+
+   @{
+*/
+#define EV_UINT64_MAX ((((ev_uint64_t)0xffffffffUL) << 32) | 0xffffffffUL)
+#define EV_INT64_MAX  ((((ev_int64_t) 0x7fffffffL) << 32) | 0xffffffffL)
+#define EV_INT64_MIN  ((-EV_INT64_MAX) - 1)
+#define EV_UINT32_MAX ((ev_uint32_t)0xffffffffUL)
+#define EV_INT32_MAX  ((ev_int32_t) 0x7fffffffL)
+#define EV_INT32_MIN  ((-EV_INT32_MAX) - 1)
+#define EV_UINT16_MAX ((ev_uint16_t)0xffffUL)
+#define EV_INT16_MAX  ((ev_int16_t) 0x7fffL)
+#define EV_INT16_MIN  ((-EV_INT16_MAX) - 1)
+#define EV_UINT8_MAX  255
+#define EV_INT8_MAX   127
+#define EV_INT8_MIN   ((-EV_INT8_MAX) - 1)
+/** @} */
+
+/**
+   @name Limits for SIZE_T and SSIZE_T
+
+   @{
+*/
+#if _EVENT_SIZEOF_SIZE_T == 8
+#define EV_SIZE_MAX EV_UINT64_MAX
+#define EV_SSIZE_MAX EV_INT64_MAX
+#elif _EVENT_SIZEOF_SIZE_T == 4
+#define EV_SIZE_MAX EV_UINT32_MAX
+#define EV_SSIZE_MAX EV_INT32_MAX
+#elif defined(_EVENT_IN_DOXYGEN)
+#define EV_SIZE_MAX ...
+#define EV_SSIZE_MAX ...
+#else
+#error "No way to define SIZE_MAX"
+#endif
+
+#define EV_SSIZE_MIN ((-EV_SSIZE_MAX) - 1)
+/**@}*/
+
+#ifdef WIN32
+#define ev_socklen_t int
+#elif defined(_EVENT_socklen_t)
+#define ev_socklen_t _EVENT_socklen_t
+#else
+#define ev_socklen_t socklen_t
+#endif
+
+#ifdef _EVENT_HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
+#if !defined(_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY) \
+ && !defined(ss_family)
+#define ss_family __ss_family
+#endif
+#endif
+
+/**
+ * A type wide enough to hold the output of "socket()" or "accept()".  On
+ * Windows, this is an intptr_t; elsewhere, it is an int. */
+#ifdef WIN32
+#define evutil_socket_t intptr_t
+#else
+#define evutil_socket_t int
+#endif
+
+/** Create two new sockets that are connected to each other.
+
+    On Unix, this simply calls socketpair().  On Windows, it uses the
+    loopback network interface on 127.0.0.1, and only
+    AF_INET,SOCK_STREAM are supported.
+
+    (This may fail on some Windows hosts where firewall software has cleverly
+    decided to keep 127.0.0.1 from talking to itself.)
+
+    Parameters and return values are as for socketpair()
+*/
+int evutil_socketpair(int d, int type, int protocol, evutil_socket_t sv[2]);
+/** Do platform-specific operations as needed to make a socket nonblocking.
+
+    @param sock The socket to make nonblocking
+    @return 0 on success, -1 on failure
+ */
+int evutil_make_socket_nonblocking(evutil_socket_t sock);
+
+/** Do platform-specific operations to make a listener socket reusable.
+
+    Specifically, we want to make sure that another program will be able
+    to bind this address right after we've closed the listener.
+
+    This differs from Windows's interpretation of "reusable", which
+    allows multiple listeners to bind the same address at the same time.
+
+    @param sock The socket to make reusable
+    @return 0 on success, -1 on failure
+ */
+int evutil_make_listen_socket_reuseable(evutil_socket_t sock);
+
+/** Do platform-specific operations as needed to close a socket upon a
+    successful execution of one of the exec*() functions.
+
+    @param sock The socket to be closed
+    @return 0 on success, -1 on failure
+ */
+int evutil_make_socket_closeonexec(evutil_socket_t sock);
+
+/** Do the platform-specific call needed to close a socket returned from
+    socket() or accept().
+
+    @param sock The socket to be closed
+    @return 0 on success, -1 on failure
+ */
+int evutil_closesocket(evutil_socket_t sock);
+#define EVUTIL_CLOSESOCKET(s) evutil_closesocket(s)
+
+
+#ifdef WIN32
+/** Return the most recent socket error.  Not idempotent on all platforms. */
+#define EVUTIL_SOCKET_ERROR() WSAGetLastError()
+/** Replace the most recent socket error with errcode */
+#define EVUTIL_SET_SOCKET_ERROR(errcode)		\
+	do { WSASetLastError(errcode); } while (0)
+/** Return the most recent socket error to occur on sock. */
+int evutil_socket_geterror(evutil_socket_t sock);
+/** Convert a socket error to a string. */
+const char *evutil_socket_error_to_string(int errcode);
+#elif defined(_EVENT_IN_DOXYGEN)
+/**
+   @name Socket error functions
+
+   These functions are needed for making programs compatible between
+   Windows and Unix-like platforms.
+
+   You see, Winsock handles socket errors differently from the rest of
+   the world.  Elsewhere, a socket error is like any other error and is
+   stored in errno.  But winsock functions require you to retrieve the
+   error with a special function, and don't let you use strerror for
+   the error codes.  And handling EWOULDBLOCK is ... different.
+
+   @{
+*/
+/** Return the most recent socket error.  Not idempotent on all platforms. */
+#define EVUTIL_SOCKET_ERROR() ...
+/** Replace the most recent socket error with errcode */
+#define EVUTIL_SET_SOCKET_ERROR(errcode) ...
+/** Return the most recent socket error to occur on sock. */
+#define evutil_socket_geterror(sock) ...
+/** Convert a socket error to a string. */
+#define evutil_socket_error_to_string(errcode) ...
+/**@}*/
+#else
+#define EVUTIL_SOCKET_ERROR() (errno)
+#define EVUTIL_SET_SOCKET_ERROR(errcode)		\
+		do { errno = (errcode); } while (0)
+#define evutil_socket_geterror(sock) (errno)
+#define evutil_socket_error_to_string(errcode) (strerror(errcode))
+#endif
+
+
+/**
+ * @name Manipulation macros for struct timeval.
+ *
+ * We define replacements
+ * for timeradd, timersub, timerclear, timercmp, and timerisset.
+ *
+ * @{
+ */
+#ifdef _EVENT_HAVE_TIMERADD
+#define evutil_timeradd(tvp, uvp, vvp) timeradd((tvp), (uvp), (vvp))
+#define evutil_timersub(tvp, uvp, vvp) timersub((tvp), (uvp), (vvp))
+#else
+#define evutil_timeradd(tvp, uvp, vvp)					\
+	do {								\
+		(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;		\
+		(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;       \
+		if ((vvp)->tv_usec >= 1000000) {			\
+			(vvp)->tv_sec++;				\
+			(vvp)->tv_usec -= 1000000;			\
+		}							\
+	} while (0)
+#define	evutil_timersub(tvp, uvp, vvp)					\
+	do {								\
+		(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;		\
+		(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;	\
+		if ((vvp)->tv_usec < 0) {				\
+			(vvp)->tv_sec--;				\
+			(vvp)->tv_usec += 1000000;			\
+		}							\
+	} while (0)
+#endif /* !_EVENT_HAVE_HAVE_TIMERADD */
+
+#ifdef _EVENT_HAVE_TIMERCLEAR
+#define evutil_timerclear(tvp) timerclear(tvp)
+#else
+#define	evutil_timerclear(tvp)	(tvp)->tv_sec = (tvp)->tv_usec = 0
+#endif
+/**@}*/
+
+/** Return true iff the tvp is related to uvp according to the relational
+ * operator cmp.  Recognized values for cmp are ==, <=, <, >=, and >. */
+#define	evutil_timercmp(tvp, uvp, cmp)					\
+	(((tvp)->tv_sec == (uvp)->tv_sec) ?				\
+	 ((tvp)->tv_usec cmp (uvp)->tv_usec) :				\
+	 ((tvp)->tv_sec cmp (uvp)->tv_sec))
+
+#ifdef _EVENT_HAVE_TIMERISSET
+#define evutil_timerisset(tvp) timerisset(tvp)
+#else
+#define	evutil_timerisset(tvp)	((tvp)->tv_sec || (tvp)->tv_usec)
+#endif
+
+/** Replacement for offsetof on platforms that don't define it. */
+#ifdef offsetof
+#define evutil_offsetof(type, field) offsetof(type, field)
+#else
+#define evutil_offsetof(type, field) ((off_t)(&((type *)0)->field))
+#endif
+
+/* big-int related functions */
+/** Parse a 64-bit value from a string.  Arguments are as for strtol. */
+ev_int64_t evutil_strtoll(const char *s, char **endptr, int base);
+
+/** Replacement for gettimeofday on platforms that lack it. */
+#ifdef _EVENT_HAVE_GETTIMEOFDAY
+#define evutil_gettimeofday(tv, tz) gettimeofday((tv), (tz))
+#else
+struct timezone;
+int evutil_gettimeofday(struct timeval *tv, struct timezone *tz);
+#endif
+
+/** Replacement for snprintf to get consistent behavior on platforms for
+    which the return value of snprintf does not conform to C99.
+ */
+int evutil_snprintf(char *buf, size_t buflen, const char *format, ...)
+#ifdef __GNUC__
+	__attribute__((format(printf, 3, 4)))
+#endif
+;
+/** Replacement for vsnprintf to get consistent behavior on platforms for
+    which the return value of snprintf does not conform to C99.
+ */
+int evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
+#ifdef __GNUC__
+	__attribute__((format(printf, 3, 0)))
+#endif
+;
+
+/** Replacement for inet_ntop for platforms which lack it. */
+const char *evutil_inet_ntop(int af, const void *src, char *dst, size_t len);
+/** Replacement for inet_pton for platforms which lack it. */
+int evutil_inet_pton(int af, const char *src, void *dst);
+struct sockaddr;
+
+/** Parse an IPv4 or IPv6 address, with optional port, from a string.
+
+    Recognized formats are:
+    - [IPv6Address]:port
+    - [IPv6Address]
+    - IPv6Address
+    - IPv4Address:port
+    - IPv4Address
+
+    If no port is specified, the port in the output is set to 0.
+
+    @param str The string to parse.
+    @param out A struct sockaddr to hold the result.  This should probably be
+       a struct sockaddr_storage.
+    @param outlen A pointer to the number of bytes that that 'out' can safely
+       hold.  Set to the number of bytes used in 'out' on success.
+    @return -1 if the address is not well-formed, if the port is out of range,
+       or if out is not large enough to hold the result.  Otherwise returns
+       0 on success.
+*/
+int evutil_parse_sockaddr_port(const char *str, struct sockaddr *out, int *outlen);
+
+/** Compare two sockaddrs; return 0 if they are equal, or less than 0 if sa1
+ * preceeds sa2, or greater than 0 if sa1 follows sa2.  If include_port is
+ * true, consider the port as well as the address.  Only implemented for
+ * AF_INET and AF_INET6 addresses. The ordering is not guaranteed to remain
+ * the same between Libevent versions. */
+int evutil_sockaddr_cmp(const struct sockaddr *sa1, const struct sockaddr *sa2,
+    int include_port);
+
+/** As strcasecmp, but always compares the characters in locale-independent
+    ASCII.  That's useful if you're handling data in ASCII-based protocols.
+ */
+int evutil_ascii_strcasecmp(const char *str1, const char *str2);
+/** As strncasecmp, but always compares the characters in locale-independent
+    ASCII.  That's useful if you're handling data in ASCII-based protocols.
+ */
+int evutil_ascii_strncasecmp(const char *str1, const char *str2, size_t n);
+
+/* Here we define evutil_addrinfo to the native addrinfo type, or redefine it
+ * if this system has no getaddrinfo(). */
+#ifdef _EVENT_HAVE_STRUCT_ADDRINFO
+#define evutil_addrinfo addrinfo
+#else
+/** A definition of struct addrinfo for systems that lack it.
+
+    (This is just an alias for struct addrinfo if the system defines
+    struct addrinfo.)
+*/
+struct evutil_addrinfo {
+	int     ai_flags;     /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
+	int     ai_family;    /* PF_xxx */
+	int     ai_socktype;  /* SOCK_xxx */
+	int     ai_protocol;  /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
+	size_t  ai_addrlen;   /* length of ai_addr */
+	char   *ai_canonname; /* canonical name for nodename */
+	struct sockaddr  *ai_addr; /* binary address */
+	struct evutil_addrinfo  *ai_next; /* next structure in linked list */
+};
+#endif
+/** @name evutil_getaddrinfo() error codes
+
+    These values are possible error codes for evutil_getaddrinfo() and
+    related functions.
+
+    @{
+*/
+#ifdef EAI_ADDRFAMILY
+#define EVUTIL_EAI_ADDRFAMILY EAI_ADDRFAMILY
+#else
+#define EVUTIL_EAI_ADDRFAMILY -901
+#endif
+#ifdef EAI_AGAIN
+#define EVUTIL_EAI_AGAIN EAI_AGAIN
+#else
+#define EVUTIL_EAI_AGAIN -902
+#endif
+#ifdef EAI_BADFLAGS
+#define EVUTIL_EAI_BADFLAGS EAI_BADFLAGS
+#else
+#define EVUTIL_EAI_BADFLAGS -903
+#endif
+#ifdef EAI_FAIL
+#define EVUTIL_EAI_FAIL EAI_FAIL
+#else
+#define EVUTIL_EAI_FAIL -904
+#endif
+#ifdef EAI_FAMILY
+#define EVUTIL_EAI_FAMILY EAI_FAMILY
+#else
+#define EVUTIL_EAI_FAMILY -905
+#endif
+#ifdef EAI_MEMORY
+#define EVUTIL_EAI_MEMORY EAI_MEMORY
+#else
+#define EVUTIL_EAI_MEMORY -906
+#endif
+/* This test is a bit complicated, since some MS SDKs decide to
+ * remove NODATA or redefine it to be the same as NONAME, in a
+ * fun interpretation of RFC 2553 and RFC 3493. */
+#if defined(EAI_NODATA) && (!defined(EAI_NONAME) || EAI_NODATA != EAI_NONAME)
+#define EVUTIL_EAI_NODATA EAI_NODATA
+#else
+#define EVUTIL_EAI_NODATA -907
+#endif
+#ifdef EAI_NONAME
+#define EVUTIL_EAI_NONAME EAI_NONAME
+#else
+#define EVUTIL_EAI_NONAME -908
+#endif
+#ifdef EAI_SERVICE
+#define EVUTIL_EAI_SERVICE EAI_SERVICE
+#else
+#define EVUTIL_EAI_SERVICE -909
+#endif
+#ifdef EAI_SOCKTYPE
+#define EVUTIL_EAI_SOCKTYPE EAI_SOCKTYPE
+#else
+#define EVUTIL_EAI_SOCKTYPE -910
+#endif
+#ifdef EAI_SYSTEM
+#define EVUTIL_EAI_SYSTEM EAI_SYSTEM
+#else
+#define EVUTIL_EAI_SYSTEM -911
+#endif
+
+#define EVUTIL_EAI_CANCEL -90001
+
+#ifdef AI_PASSIVE
+#define EVUTIL_AI_PASSIVE AI_PASSIVE
+#else
+#define EVUTIL_AI_PASSIVE 0x1000
+#endif
+#ifdef AI_CANONNAME
+#define EVUTIL_AI_CANONNAME AI_CANONNAME
+#else
+#define EVUTIL_AI_CANONNAME 0x2000
+#endif
+#ifdef AI_NUMERICHOST
+#define EVUTIL_AI_NUMERICHOST AI_NUMERICHOST
+#else
+#define EVUTIL_AI_NUMERICHOST 0x4000
+#endif
+#ifdef AI_NUMERICSERV
+#define EVUTIL_AI_NUMERICSERV AI_NUMERICSERV
+#else
+#define EVUTIL_AI_NUMERICSERV 0x8000
+#endif
+#ifdef AI_V4MAPPED
+#define EVUTIL_AI_V4MAPPED AI_V4MAPPED
+#else
+#define EVUTIL_AI_V4MAPPED 0x10000
+#endif
+#ifdef AI_ALL
+#define EVUTIL_AI_ALL AI_ALL
+#else
+#define EVUTIL_AI_ALL 0x20000
+#endif
+#ifdef AI_ADDRCONFIG
+#define EVUTIL_AI_ADDRCONFIG AI_ADDRCONFIG
+#else
+#define EVUTIL_AI_ADDRCONFIG 0x40000
+#endif
+/**@}*/
+
+struct evutil_addrinfo;
+/**
+ * This function clones getaddrinfo for systems that don't have it.  For full
+ * details, see RFC 3493, section 6.1.
+ *
+ * Limitations:
+ * - When the system has no getaddrinfo, we fall back to gethostbyname_r or
+ *   gethostbyname, with their attendant issues.
+ * - The AI_V4MAPPED and AI_ALL flags are not currently implemented.
+ *
+ * For a nonblocking variant, see evdns_getaddrinfo.
+ */
+int evutil_getaddrinfo(const char *nodename, const char *servname,
+    const struct evutil_addrinfo *hints_in, struct evutil_addrinfo **res);
+
+/** Release storage allocated by evutil_getaddrinfo or evdns_getaddrinfo. */
+void evutil_freeaddrinfo(struct evutil_addrinfo *ai);
+
+const char *evutil_gai_strerror(int err);
+
+/** Generate n bytes of secure pseudorandom data, and store them in buf.
+ *
+ * Current versions of Libevent use an ARC4-based random number generator,
+ * seeded using the platform's entropy source (/dev/urandom on Unix-like
+ * systems; CryptGenRandom on Windows).  This is not actually as secure as it
+ * should be: ARC4 is a pretty lousy cipher, and the current implementation
+ * provides only rudimentary prediction- and backtracking-resistance.  Don't
+ * use this for serious cryptographic applications.
+ */
+void evutil_secure_rng_get_bytes(void *buf, size_t n);
+
+/**
+ * Seed the secure random number generator if needed, and return 0 on
+ * success or -1 on failure.
+ *
+ * It is okay to call this function more than once; it will still return
+ * 0 if the RNG has been successfully seeded and -1 if it can't be
+ * seeded.
+ *
+ * Ordinarily you don't need to call this function from your own code;
+ * Libevent will seed the RNG itself the first time it needs good random
+ * numbers.  You only need to call it if (a) you want to double-check
+ * that one of the seeding methods did succeed, or (b) you plan to drop
+ * the capability to seed (by chrooting, or dropping capabilities, or
+ * whatever), and you want to make sure that seeding happens before your
+ * program loses the ability to do it.
+ */
+int evutil_secure_rng_init(void);
+
+/**
+ * Set a filename to use in place of /dev/urandom for seeding the secure
+ * PRNG. Return 0 on success, -1 on failure.
+ *
+ * Call this function BEFORE calling any other initialization or RNG
+ * functions.
+ *
+ * (This string will _NOT_ be copied internally. Do not free it while any
+ * user of the secure RNG might be running. Don't pass anything other than a
+ * real /dev/...random device file here, or you might lose security.)
+ *
+ * This API is unstable, and might change in a future libevent version.
+ */
+int evutil_secure_rng_set_urandom_device_file(char *fname);
+
+/** Seed the random number generator with extra random bytes.
+
+    You should almost never need to call this function; it should be
+    sufficient to invoke evutil_secure_rng_init(), or let Libevent take
+    care of calling evutil_secure_rng_init() on its own.
+
+    If you call this function as a _replacement_ for the regular
+    entropy sources, then you need to be sure that your input
+    contains a fairly large amount of strong entropy.  Doing so is
+    notoriously hard: most people who try get it wrong.  Watch out!
+
+    @param dat a buffer full of a strong source of random numbers
+    @param datlen the number of bytes to read from datlen
+ */
+void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVUTIL_H_ */

Property changes on: lab4/.minix-src/include/event2/util.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fs/v7fs/v7fs.h
===================================================================
--- lab4/.minix-src/include/fs/v7fs/v7fs.h	(nonexistent)
+++ lab4/.minix-src/include/fs/v7fs/v7fs.h	(revision 13)
@@ -0,0 +1,180 @@
+/*	$NetBSD: v7fs.h,v 1.2 2011/07/16 12:35:40 uch Exp $	*/
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by UCHIYAMA Yasushi.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _V7FS_H_
+/* 7th Edition of Unix(PDP-11) Filesystem definition. */
+#define	_V7FS_H_
+#include <sys/types.h>
+#ifndef _KERNEL
+#include <inttypes.h>
+#endif
+/*
+ *   V7 File System
+ *
+ *     +------------------
+ *     |Boot block (512byte)	sector [0]
+ *     |
+ *     +------------------
+ *     |Super block (512byte)	sector [1]
+ *     |
+ *     +------------------
+ *     |v7fs_inode(64byte       sector [2]
+ *         .
+ *         .
+ *     |
+ *     +------------------
+ *     |data block              sector [datablock_start_sector]
+ *     |
+ *         .
+ *         .
+ *     |
+ *     +------------------
+ *				 <-    [sector volume_size]
+ *
+ *     |
+ *     +------------------	volume size.
+ *
+ * Max volume size is 8GB (24bit daddr_t)
+ * Max file size is ~1GB
+ *
+ */
+
+/* V7 type. */
+typedef uint16_t v7fs_ino_t;
+typedef uint32_t v7fs_daddr_t;
+typedef int32_t v7fs_time_t;
+typedef uint32_t v7fs_off_t;
+typedef uint16_t v7fs_dev_t;
+typedef uint16_t v7fs_mode_t;
+#define	V7FS_DADDR_MAX		0x00ffffff
+#define	V7FS_INODE_MAX		0xffff
+
+#define	V7FS_BSIZE		512
+#define	V7FS_BSHIFT		9
+#define	V7FS_ROUND_BSIZE(x)					\
+	((((x) + (V7FS_BSIZE - 1)) & ~(V7FS_BSIZE - 1)))
+#define	V7FS_TRUNC_BSIZE(x)	((x) & ~(V7FS_BSIZE - 1))
+
+#define	V7FS_RESIDUE_BSIZE(x)					\
+	((x) - ((((x) - 1) >> V7FS_BSHIFT) << V7FS_BSHIFT))
+
+/* Disk location. */
+#define	V7FS_BOOTBLOCK_SECTOR	0
+#define	V7FS_SUPERBLOCK_SECTOR	1
+#define	V7FS_ILIST_SECTOR	2
+
+/* Superblock */
+/* cache. */
+#define	V7FS_MAX_FREEBLOCK	50
+#define	V7FS_MAX_FREEINODE	100
+struct v7fs_superblock {
+	/* [3 ... (datablock_start_sector-1)]are ilist */
+	uint16_t datablock_start_sector;
+	v7fs_daddr_t volume_size;
+	int16_t nfreeblock;	/* # of freeblock in superblock cache. */
+	v7fs_daddr_t freeblock[V7FS_MAX_FREEBLOCK];	/* cache. */
+	int16_t nfreeinode;	/* # of free inode in superblock cache. */
+	v7fs_ino_t freeinode[V7FS_MAX_FREEINODE];	/* cache. */
+	int8_t lock_freeblock;
+	int8_t lock_freeinode;
+	int8_t modified;
+	int8_t readonly;
+	v7fs_time_t update_time;
+	v7fs_daddr_t total_freeblock;
+	v7fs_ino_t total_freeinode;
+} __packed;
+
+/* Datablock */
+#define	V7FS_NADDR		13
+#define	V7FS_NADDR_DIRECT	10
+#define	V7FS_NADDR_INDEX1	10
+#define	V7FS_NADDR_INDEX2	11
+#define	V7FS_NADDR_INDEX3	12
+/* daddr index. */
+#define	V7FS_DADDR_PER_BLOCK	(V7FS_BSIZE / sizeof(v7fs_daddr_t))
+struct v7fs_freeblock {
+	int16_t nfreeblock;
+	v7fs_daddr_t freeblock[V7FS_MAX_FREEBLOCK];
+} __packed;
+
+
+/* Dirent */
+#define	V7FS_NAME_MAX		14
+#define	V7FS_PATH_MAX		PATH_MAX	/* No V7 limit. */
+#define	V7FS_LINK_MAX		LINK_MAX	/* No V7 limit. */
+struct v7fs_dirent {
+	v7fs_ino_t inode_number;
+	char name[V7FS_NAME_MAX];
+} __packed;	/*16byte */
+
+/* Inode */
+#define	V7FS_BALBLK_INODE	1	/* monument */
+#define	V7FS_ROOT_INODE		2
+#define	V7FS_MAX_INODE(s)						\
+	(((s)->datablock_start_sector -	V7FS_ILIST_SECTOR) *		\
+	V7FS_BSIZE / sizeof(struct v7fs_inode_diskimage))
+#define	V7FS_INODE_PER_BLOCK						\
+	(V7FS_BSIZE / sizeof(struct v7fs_inode_diskimage))
+#define	V7FS_ILISTBLK_MAX	(V7FS_INODE_MAX / V7FS_INODE_PER_BLOCK)
+
+struct v7fs_inode_diskimage {
+	int16_t mode;
+	int16_t nlink;	/* [DIR] # of child directories. [REG] link count. */
+	int16_t uid;
+	int16_t gid;
+	v7fs_off_t filesize;	/* byte */
+#define	V7FS_DINODE_ADDR_LEN	40
+	/* 39 used; 13 addresses of 3 byte each. */
+	uint8_t addr[V7FS_DINODE_ADDR_LEN];
+	/*for device node: addr[0] is major << 8 | minor. */
+	v7fs_time_t atime;
+	v7fs_time_t mtime;
+	v7fs_time_t ctime;
+} __packed;	/*64byte */
+
+/* File type */
+#define	V7FS_IFMT	0170000	/* File type mask */
+#define	V7FS_IFCHR	0020000	/* charcter device */
+#define	V7FS_IFDIR	0040000	/* directory */
+#define	V7FS_IFBLK	0060000	/* block device */
+#define	V7FS_IFREG	0100000	/* file. */
+/* Obsoleted file type. */
+#define	V7FS_IFMPC	0030000	/* multiplexed char special */
+#define	V7FS_IFMPB	0070000	/* multiplexed block special */
+/* Don't apear original V7 filesystem. Found at 2.10BSD. */
+#define	V7FSBSD_IFLNK	0120000	/* symbolic link */
+#define	V7FSBSD_IFSOCK	0140000	/* socket */
+/* Don't apear original V7 filesystem. NetBSD. */
+#define	V7FSBSD_IFFIFO	0010000	/* Named pipe. */
+
+#define	V7FSBSD_MAXSYMLINKLEN	V7FS_BSIZE
+
+#endif	/*!_V7FS_H_ */

Property changes on: lab4/.minix-src/include/fs/v7fs/v7fs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/aout_machdep.h
===================================================================
--- lab4/.minix-src/include/i386/aout_machdep.h	(nonexistent)
+++ lab4/.minix-src/include/i386/aout_machdep.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: aout_machdep.h,v 1.8 2003/02/26 21:28:59 fvdl Exp $	*/
+
+#include <x86/aout_machdep.h>

Property changes on: lab4/.minix-src/include/i386/aout_machdep.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/asm.h
===================================================================
--- lab4/.minix-src/include/i386/asm.h	(nonexistent)
+++ lab4/.minix-src/include/i386/asm.h	(revision 13)
@@ -0,0 +1,223 @@
+/*	$NetBSD: asm.h,v 1.41 2013/09/12 15:36:17 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)asm.h	5.5 (Berkeley) 5/7/91
+ */
+
+#ifndef _I386_ASM_H_
+#define _I386_ASM_H_
+
+#ifdef _KERNEL_OPT
+#include "opt_multiprocessor.h"
+#endif
+
+#ifdef __PIC__
+#define PIC_PROLOGUE	\
+	pushl	%ebx;	\
+	call	1f;	\
+1:			\
+	popl	%ebx;	\
+	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+#define PIC_EPILOGUE	\
+	popl	%ebx
+#define PIC_PLT(x)	x@PLT
+#define PIC_GOT(x)	x@GOT(%ebx)
+#define PIC_GOTOFF(x)	x@GOTOFF(%ebx)
+#else
+#define PIC_PROLOGUE
+#define PIC_EPILOGUE
+#define PIC_PLT(x)	x
+#define PIC_GOT(x)	x
+#define PIC_GOTOFF(x)	x
+#endif
+
+#ifdef __ELF__
+# define _C_LABEL(x)	x
+#else
+# ifdef __STDC__
+#  define _C_LABEL(x)	_ ## x
+# else
+#  define _C_LABEL(x)	_/**/x
+# endif
+#endif
+#define	_ASM_LABEL(x)	x
+
+#define CVAROFF(x, y)		_C_LABEL(x) + y
+
+#ifdef __STDC__
+# define __CONCAT(x,y)	x ## y
+# define __STRING(x)	#x
+#else
+# define __CONCAT(x,y)	x/**/y
+# define __STRING(x)	"x"
+#endif
+
+/* let kernels and others override entrypoint alignment */
+#if !defined(_ALIGN_TEXT) && !defined(_KERNEL)
+# ifdef _STANDALONE
+#  define _ALIGN_TEXT .align 1
+# elif defined __ELF__
+#  define _ALIGN_TEXT .align 16
+# else
+#  define _ALIGN_TEXT .align 4
+# endif
+#endif
+
+#define _ENTRY(x) \
+	.text; _ALIGN_TEXT; .globl x; .type x,@function; x:
+#define _LABEL(x) \
+	.globl x; x:
+
+#ifdef _KERNEL
+
+#define CPUVAR(off) %fs:__CONCAT(CPU_INFO_,off)
+
+/* XXX Can't use __CONCAT() here, as it would be evaluated incorrectly. */
+#ifdef __ELF__
+#ifdef __STDC__
+#define	IDTVEC(name) \
+	ALIGN_TEXT; .globl X ## name; .type X ## name,@function; X ## name:
+#define	IDTVEC_END(name) \
+	.size X ## name, . - X ## name
+#else 
+#define	IDTVEC(name) \
+	ALIGN_TEXT; .globl X/**/name; .type X/**/name,@function; X/**/name:
+#define	IDTVEC_END(name) \
+	.size X/**/name, . - X/**/name
+#endif /* __STDC__ */ 
+#else 
+#ifdef __STDC__
+#define	IDTVEC(name) \
+	ALIGN_TEXT; .globl _X ## name; .type _X ## name,@function; _X ## name: 
+#define	IDTVEC_END(name) \
+	.size _X ## name, . - _X ## name
+#else
+#define	IDTVEC(name) \
+	ALIGN_TEXT; .globl _X/**/name; .type _X/**/name,@function; _X/**/name:
+#define	IDTVEC_END(name) \
+	.size _X/**/name, . - _X/**/name
+#endif /* __STDC__ */
+#endif /* __ELF__ */
+
+#ifdef _STANDALONE
+#define ALIGN_DATA	.align	4
+#define ALIGN_TEXT	.align	4	/* 4-byte boundaries */
+#define SUPERALIGN_TEXT	.align	16	/* 15-byte boundaries */
+#elif defined __ELF__
+#define ALIGN_DATA	.align	4
+#define ALIGN_TEXT	.align	16	/* 16-byte boundaries */
+#define SUPERALIGN_TEXT	.align	16	/* 16-byte boundaries */
+#else
+#define ALIGN_DATA	.align	2
+#define ALIGN_TEXT	.align	4	/* 16-byte boundaries */
+#define SUPERALIGN_TEXT	.align	4	/* 16-byte boundaries */
+#endif /* __ELF__ */
+
+#define _ALIGN_TEXT ALIGN_TEXT
+
+#ifdef GPROF
+#ifdef __ELF__
+#define	MCOUNT_ASM	call	_C_LABEL(__mcount)
+#else /* __ELF__ */
+#define	MCOUNT_ASM	call	_C_LABEL(mcount)
+#endif /* __ELF__ */
+#else /* GPROF */
+#define	MCOUNT_ASM	/* nothing */
+#endif /* GPROF */
+
+#endif /* _KERNEL */
+
+
+
+#ifdef GPROF
+# ifdef __ELF__
+#  define _PROF_PROLOGUE	\
+	pushl %ebp; movl %esp,%ebp; call PIC_PLT(__mcount); popl %ebp
+# else 
+#  define _PROF_PROLOGUE	\
+	pushl %ebp; movl %esp,%ebp; call PIC_PLT(mcount); popl %ebp
+# endif
+#else
+# define _PROF_PROLOGUE
+#endif
+
+#define	ENTRY(y)	_ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
+#define	NENTRY(y)	_ENTRY(_C_LABEL(y))
+#define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
+#define	LABEL(y)	_LABEL(_C_LABEL(y))
+#define	END(y)		.size y, . - y
+
+#define	ASMSTR		.asciz
+
+#ifdef __ELF__
+#define RCSID(x)	.pushsection ".ident"; .asciz x; .popsection
+#else
+#define RCSID(x)	.text; .asciz x
+#endif
+
+#ifdef NO_KERNEL_RCSIDS
+#define	__KERNEL_RCSID(_n, _s)	/* nothing */
+#else
+#define	__KERNEL_RCSID(_n, _s)	RCSID(_s)
+#endif
+
+#ifdef __ELF__
+#define	WEAK_ALIAS(alias,sym)						\
+	.weak alias;							\
+	alias = sym
+#endif
+/*
+ * STRONG_ALIAS: create a strong alias.
+ */
+#define STRONG_ALIAS(alias,sym)						\
+	.globl alias;							\
+	alias = sym
+
+#ifdef __STDC__
+#define	WARN_REFERENCES(sym,msg)					\
+	.pushsection .gnu.warning. ## sym;				\
+	.ascii msg;							\
+	.popsection
+#else
+#define	WARN_REFERENCES(sym,msg)					\
+	.pushsection .gnu.warning./**/sym;				\
+	.ascii msg;							\
+	.popsection
+#endif /* __STDC__ */
+
+#if defined(__minix)
+#define IMPORT(sym)               \
+        .extern _C_LABEL(sym)
+#endif /* defined(__minix) */
+
+#endif /* !_I386_ASM_H_ */

Property changes on: lab4/.minix-src/include/i386/asm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dev/vndvar.h
===================================================================
--- lab4/.minix-src/include/dev/vndvar.h	(nonexistent)
+++ lab4/.minix-src/include/dev/vndvar.h	(revision 13)
@@ -0,0 +1,220 @@
+/*	$NetBSD: vndvar.h,v 1.35 2015/09/06 06:00:59 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: fdioctl.h 1.1 90/07/09$
+ *
+ *	@(#)vnioctl.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _SYS_DEV_VNDVAR_H_
+#define _SYS_DEV_VNDVAR_H_
+
+#include <sys/ioccom.h>
+#if !defined(__minix)
+#include <sys/pool.h>
+#endif /* defined(__minix) */
+
+/*
+ * Vnode disk pseudo-geometry information.
+ */
+struct vndgeom {
+	u_int32_t	vng_secsize;	/* # bytes per sector */
+	u_int32_t	vng_nsectors;	/* # data sectors per track */
+	u_int32_t	vng_ntracks;	/* # tracks per cylinder */
+	u_int32_t	vng_ncylinders;	/* # cylinders per unit */
+};
+
+/*
+ * Ioctl definitions for file (vnode) disk pseudo-device.
+ */
+struct vnd_ioctl {
+#if !defined(__minix)
+	char		*vnd_file;	/* pathname of file to mount */
+#else
+	int		vnd_fildes;	/* file descriptor of file to mount */
+#endif /* !defined(__minix)*/
+	int		vnd_flags;	/* flags; see below */
+	struct vndgeom	vnd_geom;	/* geometry to emulate */
+#if !defined(__minix)
+	unsigned int	vnd_osize;	/* (returned) size of disk */
+#endif /* !defined(__minix)*/
+	uint64_t	vnd_size;	/* (returned) size of disk */
+};
+
+/* vnd_flags */
+#define	VNDIOF_HASGEOM	0x01		/* use specified geometry */
+#define	VNDIOF_READONLY	0x02		/* as read-only device */
+#define	VNDIOF_FORCE	0x04		/* force close */
+
+#if !defined(__minix)
+#ifdef _KERNEL
+
+struct vnode;
+
+/*
+ * A vnode disk's state information.
+ */
+struct vnd_softc {
+	device_t	 sc_dev;
+	int		 sc_flags;	/* flags */
+	uint64_t	 sc_size;	/* size of vnd */
+	struct vnode	*sc_vp;		/* vnode */
+	kauth_cred_t	 sc_cred;	/* credentials */
+	int		 sc_maxactive;	/* max # of active requests */
+	struct bufq_state *sc_tab;	/* transfer queue */
+	int		 sc_pending;	/* number of pending transfers */
+	int		 sc_active;	/* number of active transfers */
+	struct disk	 sc_dkdev;	/* generic disk device info */
+	struct vndgeom	 sc_geom;	/* virtual geometry */
+	struct pool	 sc_vxpool;	/* vndxfer pool */
+	struct pool	 sc_vbpool;	/* vndbuf pool */
+	struct lwp 	*sc_kthread;	/* kernel thread */
+	u_int32_t	 sc_comp_blksz;	/* precompressed block size */
+	u_int32_t	 sc_comp_numoffs;/* count of compressed block offsets */
+	u_int64_t	*sc_comp_offsets;/* file idx's to compressed blocks */
+	unsigned char	*sc_comp_buff;	/* compressed data buffer */
+	unsigned char	*sc_comp_decombuf;/* decompressed data buffer */
+	int32_t		 sc_comp_buffblk;/*current decompressed block */
+	z_stream	 sc_comp_stream;/* decompress descriptor */
+};
+#endif
+
+/* sc_flags */
+#define	VNF_INITED	0x001	/* unit has been initialized */
+#define	VNF_WLABEL	0x002	/* label area is writable */
+#define	VNF_LABELLING	0x004	/* unit is currently being labelled */
+#define	VNF_WANTED	0x008	/* someone is waiting to obtain a lock */
+#define	VNF_LOCKED	0x010	/* unit is locked */
+#define	VNF_READONLY	0x020	/* unit is read-only */
+#define	VNF_KLABEL	0x040	/* keep label on close */
+#define	VNF_VLABEL	0x080	/* label is valid */
+#define	VNF_KTHREAD	0x100	/* thread is running */
+#define	VNF_VUNCONF	0x200	/* device is unconfiguring */
+#define VNF_COMP	0x400	/* file is compressed */
+#define VNF_CLEARING	0x800	/* unit is being torn down */
+#define VNF_USE_VN_RDWR	0x1000	/* have to use vn_rdwr() */
+
+/* structure of header in a compressed file */
+struct vnd_comp_header
+{
+	char preamble[128];
+	u_int32_t block_size;
+	u_int32_t num_blocks;
+};
+#endif /* !defined(__minix) */
+
+/*
+ * A simple structure for describing which vnd units are in use.
+ */
+
+struct vnd_user {
+	int		vnu_unit;	/* which vnd unit */
+	dev_t		vnu_dev;	/* file is on this device... */
+	ino_t		vnu_ino;	/* ...at this inode */
+};
+
+/*
+ * Before you can use a unit, it must be configured with VNDIOCSET.
+ * The configuration persists across opens and closes of the device;
+ * an VNDIOCCLR must be used to reset a configuration.  An attempt to
+ * VNDIOCSET an already active unit will return EBUSY.
+ */
+#define VNDIOCSET	_IOWR('F', 0, struct vnd_ioctl)	/* enable disk */
+#define VNDIOCCLR	_IOW('F', 1, struct vnd_ioctl)	/* disable disk */
+#define VNDIOCGET	_IOWR('F', 3, struct vnd_user)	/* get list */
+
+#ifdef _KERNEL
+/*
+ * Everything else is kernel-private, mostly exported for compat/netbsd32.
+ *
+ * NetBSD 3.0 had a 32-bit value for vnu_ino.
+ *
+ * NetBSD 5.0 had a 32-bit value for vnu_dev, and vnd_size.
+ */
+struct vnd_user30 {
+	int		vnu_unit;	/* which vnd unit */
+	uint32_t	vnu_dev;	/* file is on this device... */
+	uint32_t	vnu_ino;	/* ...at this inode */
+};
+#define VNDIOCGET30	_IOWR('F', 2, struct vnd_user30)	/* get list */
+
+struct vnd_user50 {
+	int		vnu_unit;	/* which vnd unit */
+	uint32_t	vnu_dev;	/* file is on this device... */
+	ino_t		vnu_ino;	/* ...at this inode */
+};
+#define VNDIOCGET50	_IOWR('F', 3, struct vnd_user50)	/* get list */
+
+struct vnd_ioctl50 {
+	char		*vnd_file;	/* pathname of file to mount */
+	int		vnd_flags;	/* flags; see below */
+	struct vndgeom	vnd_geom;	/* geometry to emulate */
+	unsigned int	vnd_size;	/* (returned) size of disk */
+};
+#define VNDIOCSET50	_IOWR('F', 0, struct vnd_ioctl50)
+#define VNDIOCCLR50	_IOW('F', 1, struct vnd_ioctl50)
+
+#endif /* _KERNEL */
+
+#endif /* _SYS_DEV_VNDVAR_H_ */

Property changes on: lab4/.minix-src/include/dev/vndvar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/bufferevent_compat.h
===================================================================
--- lab4/.minix-src/include/event2/bufferevent_compat.h	(nonexistent)
+++ lab4/.minix-src/include/event2/bufferevent_compat.h	(revision 13)
@@ -0,0 +1,102 @@
+/*	$NetBSD: bufferevent_compat.h,v 1.1.1.2 2015/01/29 06:38:26 spz Exp $	*/
+/*	$NetBSD: bufferevent_compat.h,v 1.1.1.2 2015/01/29 06:38:26 spz Exp $	*/
+/*
+ * Copyright (c) 2007-2012 Niels Provos, Nick Mathewson
+ * Copyright (c) 2000-2007 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.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_BUFFEREVENT_COMPAT_H_
+#define _EVENT2_BUFFEREVENT_COMPAT_H_
+
+#define evbuffercb bufferevent_data_cb
+#define everrorcb bufferevent_event_cb
+
+/**
+  Create a new bufferevent for an fd.
+
+  This function is deprecated.  Use bufferevent_socket_new and
+  bufferevent_set_callbacks instead.
+
+  Libevent provides an abstraction on top of the regular event callbacks.
+  This abstraction is called a buffered event.  A buffered event provides
+  input and output buffers that get filled and drained automatically.  The
+  user of a buffered event no longer deals directly with the I/O, but
+  instead is reading from input and writing to output buffers.
+
+  Once initialized, the bufferevent structure can be used repeatedly with
+  bufferevent_enable() and bufferevent_disable().
+
+  When read enabled the bufferevent will try to read from the file descriptor
+  and call the read callback.  The write callback is executed whenever the
+  output buffer is drained below the write low watermark, which is 0 by
+  default.
+
+  If multiple bases are in use, bufferevent_base_set() must be called before
+  enabling the bufferevent for the first time.
+
+  @deprecated This function is deprecated because it uses the current
+    event base, and as such can be error prone for multithreaded programs.
+    Use bufferevent_socket_new() instead.
+
+  @param fd the file descriptor from which data is read and written to.
+	 This file descriptor is not allowed to be a pipe(2).
+  @param readcb callback to invoke when there is data to be read, or NULL if
+	 no callback is desired
+  @param writecb callback to invoke when the file descriptor is ready for
+	 writing, or NULL if no callback is desired
+  @param errorcb callback to invoke when there is an error on the file
+	 descriptor
+  @param cbarg an argument that will be supplied to each of the callbacks
+	 (readcb, writecb, and errorcb)
+  @return a pointer to a newly allocated bufferevent struct, or NULL if an
+	  error occurred
+  @see bufferevent_base_set(), bufferevent_free()
+  */
+struct bufferevent *bufferevent_new(evutil_socket_t fd,
+    evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
+
+
+/**
+  Set the read and write timeout for a buffered event.
+
+  @param bufev the bufferevent to be modified
+  @param timeout_read the read timeout
+  @param timeout_write the write timeout
+ */
+void bufferevent_settimeout(struct bufferevent *bufev,
+    int timeout_read, int timeout_write);
+
+#define EVBUFFER_READ		BEV_EVENT_READING
+#define EVBUFFER_WRITE		BEV_EVENT_WRITING
+#define EVBUFFER_EOF		BEV_EVENT_EOF
+#define EVBUFFER_ERROR		BEV_EVENT_ERROR
+#define EVBUFFER_TIMEOUT	BEV_EVENT_TIMEOUT
+
+/** macro for getting access to the input buffer of a bufferevent */
+#define EVBUFFER_INPUT(x)	bufferevent_get_input(x)
+/** macro for getting access to the output buffer of a bufferevent */
+#define EVBUFFER_OUTPUT(x)	bufferevent_get_output(x)
+
+#endif

Property changes on: lab4/.minix-src/include/event2/bufferevent_compat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/dns_compat.h
===================================================================
--- lab4/.minix-src/include/event2/dns_compat.h	(nonexistent)
+++ lab4/.minix-src/include/event2/dns_compat.h	(revision 13)
@@ -0,0 +1,338 @@
+/*	$NetBSD: dns_compat.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*	$NetBSD: dns_compat.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*
+ * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_DNS_COMPAT_H_
+#define _EVENT2_DNS_COMPAT_H_
+
+/** @file event2/dns_compat.h
+
+  Potentially non-threadsafe versions of the functions in dns.h: provided
+  only for backwards compatibility.
+
+
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+/* For int types. */
+#include <event2/util.h>
+
+/**
+  Initialize the asynchronous DNS library.
+
+  This function initializes support for non-blocking name resolution by
+  calling evdns_resolv_conf_parse() on UNIX and
+  evdns_config_windows_nameservers() on Windows.
+
+  @deprecated This function is deprecated because it always uses the current
+    event base, and is easily confused by multiple calls to event_init(), and
+    so is not safe for multithreaded use.  Additionally, it allocates a global
+    structure that only one thread can use. The replacement is
+    evdns_base_new().
+
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_shutdown()
+ */
+int evdns_init(void);
+
+struct evdns_base;
+/**
+   Return the global evdns_base created by event_init() and used by the other
+   deprecated functions.
+
+   @deprecated This function is deprecated because use of the global
+     evdns_base is error-prone.
+ */
+struct evdns_base *evdns_get_global_base(void);
+
+/**
+  Shut down the asynchronous DNS resolver and terminate all active requests.
+
+  If the 'fail_requests' option is enabled, all active requests will return
+  an empty result with the error flag set to DNS_ERR_SHUTDOWN. Otherwise,
+  the requests will be silently discarded.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_shutdown().
+
+  @param fail_requests if zero, active requests will be aborted; if non-zero,
+		active requests will return DNS_ERR_SHUTDOWN.
+  @see evdns_init()
+ */
+void evdns_shutdown(int fail_requests);
+
+/**
+  Add a nameserver.
+
+  The address should be an IPv4 address in network byte order.
+  The type of address is chosen so that it matches in_addr.s_addr.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_nameserver_add().
+
+  @param address an IP address in network byte order
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_nameserver_ip_add()
+ */
+int evdns_nameserver_add(unsigned long int address);
+
+/**
+  Get the number of configured nameservers.
+
+  This returns the number of configured nameservers (not necessarily the
+  number of running nameservers).  This is useful for double-checking
+  whether our calls to the various nameserver configuration functions
+  have been successful.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_count_nameservers().
+
+  @return the number of configured nameservers
+  @see evdns_nameserver_add()
+ */
+int evdns_count_nameservers(void);
+
+/**
+  Remove all configured nameservers, and suspend all pending resolves.
+
+  Resolves will not necessarily be re-attempted until evdns_resume() is called.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_clear_nameservers_and_suspend().
+
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_resume()
+ */
+int evdns_clear_nameservers_and_suspend(void);
+
+/**
+  Resume normal operation and continue any suspended resolve requests.
+
+  Re-attempt resolves left in limbo after an earlier call to
+  evdns_clear_nameservers_and_suspend().
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_resume().
+
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_clear_nameservers_and_suspend()
+ */
+int evdns_resume(void);
+
+/**
+  Add a nameserver.
+
+  This wraps the evdns_nameserver_add() function by parsing a string as an IP
+  address and adds it as a nameserver.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_nameserver_ip_add().
+
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_nameserver_add()
+ */
+int evdns_nameserver_ip_add(const char *ip_as_string);
+
+/**
+  Lookup an A record for a given name.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_resolve_ipv4().
+
+  @param name a DNS hostname
+  @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query.
+  @param callback a callback function to invoke when the request is completed
+  @param ptr an argument to pass to the callback function
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_resolve_ipv6(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6()
+ */
+int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback, void *ptr);
+
+/**
+  Lookup an AAAA record for a given name.
+
+  @param name a DNS hostname
+  @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query.
+  @param callback a callback function to invoke when the request is completed
+  @param ptr an argument to pass to the callback function
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_resolve_ipv4(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6()
+ */
+int evdns_resolve_ipv6(const char *name, int flags, evdns_callback_type callback, void *ptr);
+
+struct in_addr;
+struct in6_addr;
+
+/**
+  Lookup a PTR record for a given IP address.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_resolve_reverse().
+
+  @param in an IPv4 address
+  @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query.
+  @param callback a callback function to invoke when the request is completed
+  @param ptr an argument to pass to the callback function
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_resolve_reverse_ipv6()
+ */
+int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_type callback, void *ptr);
+
+/**
+  Lookup a PTR record for a given IPv6 address.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_resolve_reverse_ipv6().
+
+  @param in an IPv6 address
+  @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query.
+  @param callback a callback function to invoke when the request is completed
+  @param ptr an argument to pass to the callback function
+  @return 0 if successful, or -1 if an error occurred
+  @see evdns_resolve_reverse_ipv6()
+ */
+int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr);
+
+/**
+  Set the value of a configuration option.
+
+  The currently available configuration options are:
+
+    ndots, timeout, max-timeouts, max-inflight, and attempts
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_set_option().
+
+  @param option the name of the configuration option to be modified
+  @param val the value to be set
+  @param flags Ignored.
+  @return 0 if successful, or -1 if an error occurred
+ */
+int evdns_set_option(const char *option, const char *val, int flags);
+
+/**
+  Parse a resolv.conf file.
+
+  The 'flags' parameter determines what information is parsed from the
+  resolv.conf file. See the man page for resolv.conf for the format of this
+  file.
+
+  The following directives are not parsed from the file: sortlist, rotate,
+  no-check-names, inet6, debug.
+
+  If this function encounters an error, the possible return values are: 1 =
+  failed to open file, 2 = failed to stat file, 3 = file too large, 4 = out of
+  memory, 5 = short read from file, 6 = no nameservers listed in the file
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_resolv_conf_parse().
+
+  @param flags any of DNS_OPTION_NAMESERVERS|DNS_OPTION_SEARCH|DNS_OPTION_MISC|
+    DNS_OPTIONS_ALL
+  @param filename the path to the resolv.conf file
+  @return 0 if successful, or various positive error codes if an error
+    occurred (see above)
+  @see resolv.conf(3), evdns_config_windows_nameservers()
+ */
+int evdns_resolv_conf_parse(int flags, const char *const filename);
+
+/**
+  Clear the list of search domains.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_search_clear().
+ */
+void evdns_search_clear(void);
+
+/**
+  Add a domain to the list of search domains
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_search_add().
+
+  @param domain the domain to be added to the search list
+ */
+void evdns_search_add(const char *domain);
+
+/**
+  Set the 'ndots' parameter for searches.
+
+  Sets the number of dots which, when found in a name, causes
+  the first query to be without any search domain.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which evdns_base it applies to.  The recommended
+    function is evdns_base_search_ndots_set().
+
+  @param ndots the new ndots parameter
+ */
+void evdns_search_ndots_set(const int ndots);
+
+/**
+   As evdns_server_new_with_base.
+
+  @deprecated This function is deprecated because it does not allow the
+    caller to specify which even_base it uses.  The recommended
+    function is evdns_add_server_port_with_base().
+
+*/
+struct evdns_server_port *evdns_add_server_port(evutil_socket_t socket, int flags, evdns_request_callback_fn_type callback, void *user_data);
+
+#ifdef WIN32
+int evdns_config_windows_nameservers(void);
+#define EVDNS_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_EVENT_COMPAT_H_ */

Property changes on: lab4/.minix-src/include/event2/dns_compat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/event_compat.h
===================================================================
--- lab4/.minix-src/include/event2/event_compat.h	(nonexistent)
+++ lab4/.minix-src/include/event2/event_compat.h	(revision 13)
@@ -0,0 +1,222 @@
+/*	$NetBSD: event_compat.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*	$NetBSD: event_compat.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_EVENT_COMPAT_H_
+#define _EVENT2_EVENT_COMPAT_H_
+
+/** @file event2/event_compat.h
+
+  Potentially non-threadsafe versions of the functions in event.h: provided
+  only for backwards compatibility.
+
+  In the oldest versions of Libevent, event_base was not a first-class
+  structure.  Instead, there was a single event base that every function
+  manipulated.  Later, when separate event bases were added, the old functions
+  that didn't take an event_base argument needed to work by manipulating the
+  "current" event base.  This could lead to thread-safety issues, and obscure,
+  hard-to-diagnose bugs.
+
+  @deprecated All functions in this file are by definition deprecated.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+/* For int types. */
+#include <event2/util.h>
+
+/**
+  Initialize the event API.
+
+  The event API needs to be initialized with event_init() before it can be
+  used.  Sets the global current base that gets used for events that have no
+  base associated with them.
+
+  @deprecated This function is deprecated because it replaces the "current"
+    event_base, and is totally unsafe for multithreaded use.  The replacement
+    is event_base_new().
+
+  @see event_base_set(), event_base_new()
+ */
+struct event_base *event_init(void);
+
+/**
+  Loop to process events.
+
+  Like event_base_dispatch(), but uses the "current" base.
+
+  @deprecated This function is deprecated because it is easily confused by
+    multiple calls to event_init(), and because it is not safe for
+    multithreaded use.  The replacement is event_base_dispatch().
+
+  @see event_base_dispatch(), event_init()
+ */
+int event_dispatch(void);
+
+/**
+  Handle events.
+
+  This function behaves like event_base_loop(), but uses the "current" base
+
+  @deprecated This function is deprecated because it uses the event base from
+    the last call to event_init, and is therefore not safe for multithreaded
+    use.  The replacement is event_base_loop().
+
+  @see event_base_loop(), event_init()
+*/
+int event_loop(int);
+
+
+/**
+  Exit the event loop after the specified time.
+
+  This function behaves like event_base_loopexit(), except that it uses the
+  "current" base.
+
+  @deprecated This function is deprecated because it uses the event base from
+    the last call to event_init, and is therefore not safe for multithreaded
+    use.  The replacement is event_base_loopexit().
+
+  @see event_init, event_base_loopexit()
+  */
+int event_loopexit(const struct timeval *);
+
+
+/**
+  Abort the active event_loop() immediately.
+
+  This function behaves like event_base_loopbreakt(), except that it uses the
+  "current" base.
+
+  @deprecated This function is deprecated because it uses the event base from
+    the last call to event_init, and is therefore not safe for multithreaded
+    use.  The replacement is event_base_loopbreak().
+
+  @see event_base_loopbreak(), event_init()
+ */
+int event_loopbreak(void);
+
+/**
+  Schedule a one-time event to occur.
+
+  @deprecated This function is obsolete, and has been replaced by
+    event_base_once(). Its use is deprecated because it relies on the
+    "current" base configured by event_init().
+
+  @see event_base_once()
+ */
+int event_once(evutil_socket_t , short,
+    void (*)(evutil_socket_t, short, void *), void *, const struct timeval *);
+
+
+/**
+  Get the kernel event notification mechanism used by Libevent.
+
+  @deprecated This function is obsolete, and has been replaced by
+    event_base_get_method(). Its use is deprecated because it relies on the
+    "current" base configured by event_init().
+
+  @see event_base_get_method()
+ */
+const char *event_get_method(void);
+
+
+/**
+  Set the number of different event priorities.
+
+  @deprecated This function is deprecated because it is easily confused by
+    multiple calls to event_init(), and because it is not safe for
+    multithreaded use.  The replacement is event_base_priority_init().
+
+  @see event_base_priority_init()
+ */
+int	event_priority_init(int);
+
+/**
+  Prepare an event structure to be added.
+
+  @deprecated event_set() is not recommended for new code, because it requires
+     a subsequent call to event_base_set() to be safe under most circumstances.
+     Use event_assign() or event_new() instead.
+ */
+void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t, short, void *), void *);
+
+#define evtimer_set(ev, cb, arg)	event_set((ev), -1, 0, (cb), (arg))
+#define evsignal_set(ev, x, cb, arg)	\
+	event_set((ev), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
+
+
+/**
+   @name timeout_* macros
+
+   @deprecated These macros are deprecated because their naming is inconsistent
+     with the rest of Libevent.  Use the evtimer_* macros instead.
+   @{
+ */
+#define timeout_add(ev, tv)		event_add((ev), (tv))
+#define timeout_set(ev, cb, arg)	event_set((ev), -1, 0, (cb), (arg))
+#define timeout_del(ev)			event_del(ev)
+#define timeout_pending(ev, tv)		event_pending((ev), EV_TIMEOUT, (tv))
+#define timeout_initialized(ev)		event_initialized(ev)
+/**@}*/
+
+/**
+   @name signal_* macros
+
+   @deprecated These macros are deprecated because their naming is inconsistent
+     with the rest of Libevent.  Use the evsignal_* macros instead.
+   @{
+ */
+#define signal_add(ev, tv)		event_add((ev), (tv))
+#define signal_set(ev, x, cb, arg)				\
+	event_set((ev), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
+#define signal_del(ev)			event_del(ev)
+#define signal_pending(ev, tv)		event_pending((ev), EV_SIGNAL, (tv))
+#define signal_initialized(ev)		event_initialized(ev)
+/**@}*/
+
+#ifndef EVENT_FD
+/* These macros are obsolete; use event_get_fd and event_get_signal instead. */
+#define EVENT_FD(ev)		((int)event_get_fd(ev))
+#define EVENT_SIGNAL(ev)	event_get_signal(ev)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_EVENT_COMPAT_H_ */

Property changes on: lab4/.minix-src/include/event2/event_compat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/http_struct.h
===================================================================
--- lab4/.minix-src/include/event2/http_struct.h	(nonexistent)
+++ lab4/.minix-src/include/event2/http_struct.h	(revision 13)
@@ -0,0 +1,132 @@
+/*	$NetBSD: http_struct.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*	$NetBSD: http_struct.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_HTTP_STRUCT_H_
+#define _EVENT2_HTTP_STRUCT_H_
+
+/** @file event2/http_struct.h
+
+  Data structures for http.  Using these structures may hurt forward
+  compatibility with later versions of Libevent: be careful!
+
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+/* For int types. */
+#include <event2/util.h>
+
+/**
+ * the request structure that a server receives.
+ * WARNING: expect this structure to change.  I will try to provide
+ * reasonable accessors.
+ */
+struct evhttp_request {
+#if defined(TAILQ_ENTRY)
+	TAILQ_ENTRY(evhttp_request) next;
+#else
+struct {
+	struct evhttp_request *tqe_next;
+	struct evhttp_request **tqe_prev;
+}       next;
+#endif
+
+	/* the connection object that this request belongs to */
+	struct evhttp_connection *evcon;
+	int flags;
+/** The request obj owns the evhttp connection and needs to free it */
+#define EVHTTP_REQ_OWN_CONNECTION	0x0001
+/** Request was made via a proxy */
+#define EVHTTP_PROXY_REQUEST		0x0002
+/** The request object is owned by the user; the user must free it */
+#define EVHTTP_USER_OWNED		0x0004
+/** The request will be used again upstack; freeing must be deferred */
+#define EVHTTP_REQ_DEFER_FREE		0x0008
+/** The request should be freed upstack */
+#define EVHTTP_REQ_NEEDS_FREE		0x0010
+
+	struct evkeyvalq *input_headers;
+	struct evkeyvalq *output_headers;
+
+	/* address of the remote host and the port connection came from */
+	char *remote_host;
+	ev_uint16_t remote_port;
+
+	/* cache of the hostname for evhttp_request_get_host */
+	char *host_cache;
+
+	enum evhttp_request_kind kind;
+	enum evhttp_cmd_type type;
+
+	size_t headers_size;
+	size_t body_size;
+
+	char *uri;			/* uri after HTTP request was parsed */
+	struct evhttp_uri *uri_elems;	/* uri elements */
+
+	char major;			/* HTTP Major number */
+	char minor;			/* HTTP Minor number */
+
+	int response_code;		/* HTTP Response code */
+	char *response_code_line;	/* Readable response */
+
+	struct evbuffer *input_buffer;	/* read data */
+	ev_int64_t ntoread;
+	unsigned chunked:1,		/* a chunked request */
+	    userdone:1;			/* the user has sent all data */
+
+	struct evbuffer *output_buffer;	/* outgoing post or data */
+
+	/* Callback */
+	void (*cb)(struct evhttp_request *, void *);
+	void *cb_arg;
+
+	/*
+	 * Chunked data callback - call for each completed chunk if
+	 * specified.  If not specified, all the data is delivered via
+	 * the regular callback.
+	 */
+	void (*chunk_cb)(struct evhttp_request *, void *);
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_HTTP_STRUCT_H_ */
+

Property changes on: lab4/.minix-src/include/event2/http_struct.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/rpc_compat.h
===================================================================
--- lab4/.minix-src/include/event2/rpc_compat.h	(nonexistent)
+++ lab4/.minix-src/include/event2/rpc_compat.h	(revision 13)
@@ -0,0 +1,63 @@
+/*	$NetBSD: rpc_compat.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*	$NetBSD: rpc_compat.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*
+ * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_RPC_COMPAT_H_
+#define _EVENT2_RPC_COMPAT_H_
+
+/** @file event2/rpc_compat.h
+
+  Deprecated versions of the functions in rpc.h: provided only for
+  backwards compatibility.
+
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** backwards compatible accessors that work only with gcc */
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+
+#undef EVTAG_ASSIGN
+#undef EVTAG_GET
+#undef EVTAG_ADD
+
+#define EVTAG_ASSIGN(msg, member, args...) \
+	(*(msg)->base->member##_assign)(msg, ## args)
+#define EVTAG_GET(msg, member, args...) \
+	(*(msg)->base->member##_get)(msg, ## args)
+#define EVTAG_ADD(msg, member, args...) \
+	(*(msg)->base->member##_add)(msg, ## args)
+#endif
+#define EVTAG_LEN(msg, member) ((msg)->member##_length)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_EVENT_COMPAT_H_ */

Property changes on: lab4/.minix-src/include/event2/rpc_compat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/thread.h
===================================================================
--- lab4/.minix-src/include/event2/thread.h	(nonexistent)
+++ lab4/.minix-src/include/event2/thread.h	(revision 13)
@@ -0,0 +1,238 @@
+/*	$NetBSD: thread.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*	$NetBSD: thread.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $	*/
+/*
+ * Copyright (c) 2008-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_THREAD_H_
+#define _EVENT2_THREAD_H_
+
+/** @file event2/thread.h
+
+  Functions for multi-threaded applications using Libevent.
+
+  When using a multi-threaded application in which multiple threads
+  add and delete events from a single event base, Libevent needs to
+  lock its data structures.
+
+  Like the memory-management function hooks, all of the threading functions
+  _must_ be set up before an event_base is created if you want the base to
+  use them.
+
+  Most programs will either be using Windows threads or Posix threads.  You
+  can configure Libevent to use one of these event_use_windows_threads() or
+  event_use_pthreads() respectively.  If you're using another threading
+  library, you'll need to configure threading functions manually using
+  evthread_set_lock_callbacks() and evthread_set_condition_callbacks().
+
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+
+/**
+   @name Flags passed to lock functions
+
+   @{
+*/
+/** A flag passed to a locking callback when the lock was allocated as a
+ * read-write lock, and we want to acquire or release the lock for writing. */
+#define EVTHREAD_WRITE	0x04
+/** A flag passed to a locking callback when the lock was allocated as a
+ * read-write lock, and we want to acquire or release the lock for reading. */
+#define EVTHREAD_READ	0x08
+/** A flag passed to a locking callback when we don't want to block waiting
+ * for the lock; if we can't get the lock immediately, we will instead
+ * return nonzero from the locking callback. */
+#define EVTHREAD_TRY    0x10
+/**@}*/
+
+#if !defined(_EVENT_DISABLE_THREAD_SUPPORT) || defined(_EVENT_IN_DOXYGEN)
+
+#define EVTHREAD_LOCK_API_VERSION 1
+
+/**
+   @name Types of locks
+
+   @{*/
+/** A recursive lock is one that can be acquired multiple times at once by the
+ * same thread.  No other process can allocate the lock until the thread that
+ * has been holding it has unlocked it as many times as it locked it. */
+#define EVTHREAD_LOCKTYPE_RECURSIVE 1
+/* A read-write lock is one that allows multiple simultaneous readers, but
+ * where any one writer excludes all other writers and readers. */
+#define EVTHREAD_LOCKTYPE_READWRITE 2
+/**@}*/
+
+/** This structure describes the interface a threading library uses for
+ * locking.   It's used to tell evthread_set_lock_callbacks() how to use
+ * locking on this platform.
+ */
+struct evthread_lock_callbacks {
+	/** The current version of the locking API.  Set this to
+	 * EVTHREAD_LOCK_API_VERSION */
+	int lock_api_version;
+	/** Which kinds of locks does this version of the locking API
+	 * support?  A bitfield of EVTHREAD_LOCKTYPE_RECURSIVE and
+	 * EVTHREAD_LOCKTYPE_READWRITE.
+	 *
+	 * (Note that RECURSIVE locks are currently mandatory, and
+	 * READWRITE locks are not currently used.)
+	 **/
+	unsigned supported_locktypes;
+	/** Function to allocate and initialize new lock of type 'locktype'.
+	 * Returns NULL on failure. */
+	void *(*alloc)(unsigned locktype);
+	/** Funtion to release all storage held in 'lock', which was created
+	 * with type 'locktype'. */
+	void (*free)(void *lock, unsigned locktype);
+	/** Acquire an already-allocated lock at 'lock' with mode 'mode'.
+	 * Returns 0 on success, and nonzero on failure. */
+	int (*lock)(unsigned mode, void *lock);
+	/** Release a lock at 'lock' using mode 'mode'.  Returns 0 on success,
+	 * and nonzero on failure. */
+	int (*unlock)(unsigned mode, void *lock);
+};
+
+/** Sets a group of functions that Libevent should use for locking.
+ * For full information on the required callback API, see the
+ * documentation for the individual members of evthread_lock_callbacks.
+ *
+ * Note that if you're using Windows or the Pthreads threading library, you
+ * probably shouldn't call this function; instead, use
+ * evthread_use_windows_threads() or evthread_use_posix_threads() if you can.
+ */
+int evthread_set_lock_callbacks(const struct evthread_lock_callbacks *);
+
+#define EVTHREAD_CONDITION_API_VERSION 1
+
+struct timeval;
+
+/** This structure describes the interface a threading library uses for
+ * condition variables.  It's used to tell evthread_set_condition_callbacks
+ * how to use locking on this platform.
+ */
+struct evthread_condition_callbacks {
+	/** The current version of the conditions API.  Set this to
+	 * EVTHREAD_CONDITION_API_VERSION */
+	int condition_api_version;
+	/** Function to allocate and initialize a new condition variable.
+	 * Returns the condition variable on success, and NULL on failure.
+	 * The 'condtype' argument will be 0 with this API version.
+	 */
+	void *(*alloc_condition)(unsigned condtype);
+	/** Function to free a condition variable. */
+	void (*free_condition)(void *cond);
+	/** Function to signal a condition variable.  If 'broadcast' is 1, all
+	 * threads waiting on 'cond' should be woken; otherwise, only on one
+	 * thread is worken.  Should return 0 on success, -1 on failure.
+	 * This function will only be called while holding the associated
+	 * lock for the condition.
+	 */
+	int (*signal_condition)(void *cond, int broadcast);
+	/** Function to wait for a condition variable.  The lock 'lock'
+	 * will be held when this function is called; should be released
+	 * while waiting for the condition to be come signalled, and
+	 * should be held again when this function returns.
+	 * If timeout is provided, it is interval of seconds to wait for
+	 * the event to become signalled; if it is NULL, the function
+	 * should wait indefinitely.
+	 *
+	 * The function should return -1 on error; 0 if the condition
+	 * was signalled, or 1 on a timeout. */
+	int (*wait_condition)(void *cond, void *lock,
+	    const struct timeval *timeout);
+};
+
+/** Sets a group of functions that Libevent should use for condition variables.
+ * For full information on the required callback API, see the
+ * documentation for the individual members of evthread_condition_callbacks.
+ *
+ * Note that if you're using Windows or the Pthreads threading library, you
+ * probably shouldn't call this function; instead, use
+ * evthread_use_windows_threads() or evthread_use_pthreads() if you can.
+ */
+int evthread_set_condition_callbacks(
+	const struct evthread_condition_callbacks *);
+
+/**
+   Sets the function for determining the thread id.
+
+   @param base the event base for which to set the id function
+   @param id_fn the identify function Libevent should invoke to
+     determine the identity of a thread.
+*/
+void evthread_set_id_callback(
+    unsigned long (*id_fn)(void));
+
+#if (defined(WIN32) && !defined(_EVENT_DISABLE_THREAD_SUPPORT)) || defined(_EVENT_IN_DOXYGEN)
+/** Sets up Libevent for use with Windows builtin locking and thread ID
+    functions.  Unavailable if Libevent is not built for Windows.
+
+    @return 0 on success, -1 on failure. */
+int evthread_use_windows_threads(void);
+/**
+   Defined if Libevent was built with support for evthread_use_windows_threads()
+*/
+#define EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED 1
+#endif
+
+#if defined(_EVENT_HAVE_PTHREADS) || defined(_EVENT_IN_DOXYGEN)
+/** Sets up Libevent for use with Pthreads locking and thread ID functions.
+    Unavailable if Libevent is not build for use with pthreads.  Requires
+    libraries to link against Libevent_pthreads as well as Libevent.
+
+    @return 0 on success, -1 on failure. */
+int evthread_use_pthreads(void);
+/** Defined if Libevent was built with support for evthread_use_pthreads() */
+#define EVTHREAD_USE_PTHREADS_IMPLEMENTED 1
+
+#endif
+
+/** Enable debugging wrappers around the current lock callbacks.  If Libevent
+ * makes one of several common locking errors, exit with an assertion failure.
+ *
+ * If you're going to call this function, you must do so before any locks are
+ * allocated.
+ **/
+void evthread_enable_lock_debuging(void);
+
+#endif /* _EVENT_DISABLE_THREAD_SUPPORT */
+
+struct event_base;
+/** Make sure it's safe to tell an event base to wake up from another thread
+    or a signal handler.
+
+    @return 0 on success, -1 on failure.
+ */
+int evthread_make_base_notifiable(struct event_base *base);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_THREAD_H_ */

Property changes on: lab4/.minix-src/include/event2/thread.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fs/udf/udf_mount.h
===================================================================
--- lab4/.minix-src/include/fs/udf/udf_mount.h	(nonexistent)
+++ lab4/.minix-src/include/fs/udf/udf_mount.h	(revision 13)
@@ -0,0 +1,70 @@
+/* $NetBSD: udf_mount.h,v 1.3 2006/02/02 15:52:23 reinoud Exp $ */
+
+/*
+ * Copyright (c) 2006 Reinoud Zandijk
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *          This product includes software developed for the
+ *          NetBSD Project.  See http://www.NetBSD.org/ for
+ *          information about NetBSD.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ * 
+ * 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.
+ * 
+ */
+
+
+#ifndef _FS_UDF_UDF_MOUNT_H_
+#define _FS_UDF_UDF_MOUNT_H_
+
+/*
+ * Arguments to mount UDF filingsystem.
+ */
+
+#define UDFMNT_VERSION	1
+struct udf_args {
+	uint32_t	 version;	/* version of this structure         */
+	char		*fspec;		/* mount specifier                   */
+	int32_t		 sessionnr;	/* session specifier, rel of abs     */
+	uint32_t	 udfmflags;	/* mount options                     */
+	int32_t		 gmtoff;	/* offset from UTC in seconds        */
+
+	uid_t		 anon_uid;	/* mapping of anonymous files uid    */
+	gid_t		 anon_gid;	/* mapping of anonymous files gid    */
+	uid_t		 nobody_uid;	/* nobody:nobody will map to -1:-1   */
+	gid_t		 nobody_gid;	/* nobody:nobody will map to -1:-1   */
+
+	uint32_t	 sector_size;	/* for mounting dumps/files          */
+
+	/* extendable */
+	uint8_t	 reserved[32];
+};
+
+
+/* udf mount options */
+
+#define UDFMNT_CLOSESESSION	0x00000001	/* close session on dismount */
+#define UDFMNT_BITS "\20\1CLOSESESSION"
+
+#endif /* !_FS_UDF_UDF_MOUNT_H_ */
+

Property changes on: lab4/.minix-src/include/fs/udf/udf_mount.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/disklabel.h
===================================================================
--- lab4/.minix-src/include/i386/disklabel.h	(nonexistent)
+++ lab4/.minix-src/include/i386/disklabel.h	(revision 13)
@@ -0,0 +1,75 @@
+/*	$NetBSD: disklabel.h,v 1.16 2011/08/30 12:39:55 bouyer Exp $	*/
+
+/*
+ * Copyright (c) 1994 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+#ifndef _I386_DISKLABEL_H_
+#define _I386_DISKLABEL_H_
+
+#define LABELUSESMBR		1	/* use MBR partitionning */
+#define	LABELSECTOR		1	/* sector containing label */
+#define	LABELOFFSET		0	/* offset of label in sector */
+#define	MAXPARTITIONS		16	/* number of partitions */
+#define	OLDMAXPARTITIONS 	8	/* number of partitions before 1.6 */
+#define	RAW_PART		3	/* raw partition: XX?d (XXX) */
+
+/*
+ * We use the highest bit of the minor number for the partition number.
+ * This maintains backward compatibility with device nodes created before
+ * MAXPARTITIONS was increased.
+ */
+#define __I386_MAXDISKS	((1 << 20) / MAXPARTITIONS)
+#define DISKUNIT(dev)	((minor(dev) / OLDMAXPARTITIONS) % __I386_MAXDISKS)
+#define DISKPART(dev)	((minor(dev) % OLDMAXPARTITIONS) + \
+    ((minor(dev) / (__I386_MAXDISKS * OLDMAXPARTITIONS)) * OLDMAXPARTITIONS))
+#define	DISKMINOR(unit, part) \
+    (((unit) * OLDMAXPARTITIONS) + ((part) % OLDMAXPARTITIONS) + \
+     ((part) / OLDMAXPARTITIONS) * (__I386_MAXDISKS * OLDMAXPARTITIONS))
+
+/* Pull in MBR partition definitions. */
+#if HAVE_NBTOOL_CONFIG_H
+#include <nbinclude/sys/bootblock.h>
+#else
+#include <sys/bootblock.h>
+#endif /* HAVE_NBTOOL_CONFIG_H */
+
+#ifndef __ASSEMBLER__
+#if HAVE_NBTOOL_CONFIG_H
+#include <nbinclude/sys/dkbad.h>
+#else
+#include <sys/dkbad.h>
+#endif /* HAVE_NBTOOL_CONFIG_H */
+struct cpu_disklabel {
+#define __HAVE_DISKLABEL_DKBAD
+	struct dkbad bad;
+};
+#endif
+
+#endif /* _I386_DISKLABEL_H_ */

Property changes on: lab4/.minix-src/include/i386/disklabel.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/endian.h
===================================================================
--- lab4/.minix-src/include/i386/endian.h	(nonexistent)
+++ lab4/.minix-src/include/i386/endian.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: endian.h,v 1.29 2000/03/17 00:09:20 mycroft Exp $	*/
+
+#include <sys/endian.h>

Property changes on: lab4/.minix-src/include/i386/endian.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/event-config.h
===================================================================
--- lab4/.minix-src/include/event2/event-config.h	(nonexistent)
+++ lab4/.minix-src/include/event2/event-config.h	(revision 13)
@@ -0,0 +1,486 @@
+/*	$NetBSD: event-config.h,v 1.2 2015/01/29 07:26:02 spz Exp $	*/
+/* event2/event-config.h
+ *
+ * This file was generated by autoconf when libevent was built, and post-
+ * processed by Libevent so that its macros would have a uniform prefix.
+ *
+ * DO NOT EDIT THIS FILE.
+ *
+ * Do not rely on macros in this file existing in later versions.
+ */
+
+#ifndef _EVENT2_EVENT_CONFIG_H_
+#define _EVENT2_EVENT_CONFIG_H_
+
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if libevent should build without support for a debug mode */
+/* #undef _EVENT_DISABLE_DEBUG_MODE */
+
+/* Define if libevent should not allow replacing the mm functions */
+/* #undef _EVENT_DISABLE_MM_REPLACEMENT */
+
+#if !defined(__minix)
+/* Define if libevent should not be compiled with thread support */
+/* #undef _EVENT_DISABLE_THREAD_SUPPORT */
+#else
+#define _EVENT_DISABLE_THREAD_SUPPORT 1
+#endif /* !defined(__minix) */
+
+/* Define to 1 if you have the `arc4random' function. */
+#define _EVENT_HAVE_ARC4RANDOM 1
+
+/* Define to 1 if you have the `arc4random_buf' function. */
+#define _EVENT_HAVE_ARC4RANDOM_BUF 1
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define _EVENT_HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define _EVENT_HAVE_CLOCK_GETTIME 1
+
+/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you
+   don't. */
+#define _EVENT_HAVE_DECL_CTL_KERN 1
+
+/* Define to 1 if you have the declaration of `KERN_ARND', and to 0 if you
+   don't. */
+#define _EVENT_HAVE_DECL_KERN_ARND 1
+
+/* Define to 1 if you have the declaration of `KERN_RANDOM', and to 0 if you
+   don't. */
+#define _EVENT_HAVE_DECL_KERN_RANDOM 0
+
+/* Define to 1 if you have the declaration of `RANDOM_UUID', and to 0 if you
+   don't. */
+#define _EVENT_HAVE_DECL_RANDOM_UUID 0
+
+/* Define if /dev/poll is available */
+/* #undef _EVENT_HAVE_DEVPOLL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define _EVENT_HAVE_DLFCN_H 1
+
+/* Define if your system supports the epoll system calls */
+/* #undef _EVENT_HAVE_EPOLL */
+
+/* Define to 1 if you have the `epoll_ctl' function. */
+/* #undef _EVENT_HAVE_EPOLL_CTL */
+
+/* Define to 1 if you have the `eventfd' function. */
+/* #undef _EVENT_HAVE_EVENTFD */
+
+/* Define if your system supports event ports */
+/* #undef _EVENT_HAVE_EVENT_PORTS */
+
+/* Define to 1 if you have the `fcntl' function. */
+#define _EVENT_HAVE_FCNTL 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define _EVENT_HAVE_FCNTL_H 1
+
+/* Define to 1 if the system has the type `fd_mask'. */
+#define _EVENT_HAVE_FD_MASK 1
+
+/* Do we have getaddrinfo()? */
+#define _EVENT_HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getegid' function. */
+#define _EVENT_HAVE_GETEGID 1
+
+/* Define to 1 if you have the `geteuid' function. */
+#define _EVENT_HAVE_GETEUID 1
+
+/* Define this if you have any gethostbyname_r() */
+/* #undef _EVENT_HAVE_GETHOSTBYNAME_R */
+
+/* Define this if gethostbyname_r takes 3 arguments */
+/* #undef _EVENT_HAVE_GETHOSTBYNAME_R_3_ARG */
+
+/* Define this if gethostbyname_r takes 5 arguments */
+/* #undef _EVENT_HAVE_GETHOSTBYNAME_R_5_ARG */
+
+/* Define this if gethostbyname_r takes 6 arguments */
+/* #undef _EVENT_HAVE_GETHOSTBYNAME_R_6_ARG */
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#define _EVENT_HAVE_GETNAMEINFO 1
+
+/* Define to 1 if you have the `getprotobynumber' function. */
+#define _EVENT_HAVE_GETPROTOBYNUMBER 1
+
+/* Define to 1 if you have the `getservbyname' function. */
+/* #undef _EVENT_HAVE_GETSERVBYNAME */
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define _EVENT_HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the `inet_aton' function. */
+#define _EVENT_HAVE_INET_ATON 1
+
+/* Define to 1 if you have the `inet_ntop' function. */
+#define _EVENT_HAVE_INET_NTOP 1
+
+/* Define to 1 if you have the `inet_pton' function. */
+#define _EVENT_HAVE_INET_PTON 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define _EVENT_HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `issetugid' function. */
+#define _EVENT_HAVE_ISSETUGID 1
+
+#if !defined(__minix)
+/* Define to 1 if you have the `kqueue' function. */
+#define _EVENT_HAVE_KQUEUE 1
+#endif /* !defined(__minix) */
+
+/* Define if the system has zlib */
+#define _EVENT_HAVE_LIBZ 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define _EVENT_HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mmap' function. */
+#define _EVENT_HAVE_MMAP 1
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define _EVENT_HAVE_NETDB_H 1
+
+/* Define to 1 if you have the <netinet/in6.h> header file. */
+/* #undef _EVENT_HAVE_NETINET_IN6_H */
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define _EVENT_HAVE_NETINET_IN_H 1
+
+/* Define if the system has openssl */
+#define _EVENT_HAVE_OPENSSL 1
+
+/* Define to 1 if you have the <openssl/bio.h> header file. */
+#define _EVENT_HAVE_OPENSSL_BIO_H 1
+
+/* Define to 1 if you have the `pipe' function. */
+#define _EVENT_HAVE_PIPE 1
+
+/* Define to 1 if you have the `poll' function. */
+#define _EVENT_HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define _EVENT_HAVE_POLL_H 1
+
+/* Define to 1 if you have the `port_create' function. */
+/* #undef _EVENT_HAVE_PORT_CREATE */
+
+/* Define to 1 if you have the <port.h> header file. */
+/* #undef _EVENT_HAVE_PORT_H */
+
+/* Define if you have POSIX threads libraries and header files. */
+/* #undef _EVENT_HAVE_PTHREAD */
+
+#if !defined(__minix)
+/* Define if we have pthreads on this system */
+#define _EVENT_HAVE_PTHREADS 1
+#endif /* !defined(__minix) */
+
+/* Define to 1 if you have the `putenv' function. */
+#define _EVENT_HAVE_PUTENV 1
+
+/* Define to 1 if the system has the type `sa_family_t'. */
+#define _EVENT_HAVE_SA_FAMILY_T 1
+
+/* Define to 1 if you have the `select' function. */
+#define _EVENT_HAVE_SELECT 1
+
+/* Define to 1 if you have the `sendfile' function. */
+/* #undef _EVENT_HAVE_SENDFILE */
+
+/* Define to 1 if you have the `setenv' function. */
+#define _EVENT_HAVE_SETENV 1
+
+/* Define if F_SETFD is defined in <fcntl.h> */
+#define _EVENT_HAVE_SETFD 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define _EVENT_HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `signal' function. */
+#define _EVENT_HAVE_SIGNAL 1
+
+/* Define to 1 if you have the `splice' function. */
+/* #undef _EVENT_HAVE_SPLICE */
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define _EVENT_HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define _EVENT_HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define _EVENT_HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define _EVENT_HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define _EVENT_HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define _EVENT_HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define _EVENT_HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define _EVENT_HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strtok_r' function. */
+#define _EVENT_HAVE_STRTOK_R 1
+
+/* Define to 1 if you have the `strtoll' function. */
+#define _EVENT_HAVE_STRTOLL 1
+
+/* Define to 1 if the system has the type `struct addrinfo'. */
+#define _EVENT_HAVE_STRUCT_ADDRINFO 1
+
+/* Define to 1 if the system has the type `struct in6_addr'. */
+#define _EVENT_HAVE_STRUCT_IN6_ADDR 1
+
+/* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */
+/* #undef _EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR16 */
+
+/* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */
+/* #undef _EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR32 */
+
+/* Define to 1 if the system has the type `struct sockaddr_in6'. */
+#define _EVENT_HAVE_STRUCT_SOCKADDR_IN6 1
+
+/* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */
+#define _EVENT_HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN 1
+
+/* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */
+#define _EVENT_HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
+
+/* Define to 1 if the system has the type `struct sockaddr_storage'. */
+#define _EVENT_HAVE_STRUCT_SOCKADDR_STORAGE 1
+
+/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
+#define _EVENT_HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
+
+/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
+/* #undef _EVENT_HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
+
+/* Define to 1 if you have the `sysctl' function. */
+#define _EVENT_HAVE_SYSCTL 1
+
+/* Define to 1 if you have the <sys/devpoll.h> header file. */
+/* #undef _EVENT_HAVE_SYS_DEVPOLL_H */
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+/* #undef _EVENT_HAVE_SYS_EPOLL_H */
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+/* #undef _EVENT_HAVE_SYS_EVENTFD_H */
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+#define _EVENT_HAVE_SYS_EVENT_H 1
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define _EVENT_HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define _EVENT_HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define _EVENT_HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#define _EVENT_HAVE_SYS_QUEUE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define _EVENT_HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/sendfile.h> header file. */
+/* #undef _EVENT_HAVE_SYS_SENDFILE_H */
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define _EVENT_HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define _EVENT_HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
+#define _EVENT_HAVE_SYS_SYSCTL_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define _EVENT_HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define _EVENT_HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define _EVENT_HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#define _EVENT_HAVE_SYS_WAIT_H 1
+
+/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
+#define _EVENT_HAVE_TAILQFOREACH 1
+
+/* Define if timeradd is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERADD 1
+
+/* Define if timerclear is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERCLEAR 1
+
+/* Define if timercmp is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERCMP 1
+
+/* Define if timerisset is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERISSET 1
+
+/* Define to 1 if the system has the type `uint16_t'. */
+#define _EVENT_HAVE_UINT16_T 1
+
+/* Define to 1 if the system has the type `uint32_t'. */
+#define _EVENT_HAVE_UINT32_T 1
+
+/* Define to 1 if the system has the type `uint64_t'. */
+#define _EVENT_HAVE_UINT64_T 1
+
+/* Define to 1 if the system has the type `uint8_t'. */
+#define _EVENT_HAVE_UINT8_T 1
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#define _EVENT_HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the `umask' function. */
+#define _EVENT_HAVE_UMASK 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define _EVENT_HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `unsetenv' function. */
+#define _EVENT_HAVE_UNSETENV 1
+
+/* Define to 1 if you have the `vasprintf' function. */
+#define _EVENT_HAVE_VASPRINTF 1
+
+/* Define if kqueue works correctly with pipes */
+#if !defined(__minix)
+#define _EVENT_HAVE_WORKING_KQUEUE 1
+#endif /* !defined(__minix) */
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#define _EVENT_HAVE_ZLIB_H 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define _EVENT_LT_OBJDIR ".libs/"
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef _EVENT_NO_MINUS_C_MINUS_O */
+
+/* Numeric representation of the version */
+#define _EVENT_NUMERIC_VERSION 0x02001600
+
+/* Name of package */
+#define _EVENT_PACKAGE "libevent"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define _EVENT_PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define _EVENT_PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define _EVENT_PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define _EVENT_PACKAGE_TARNAME ""
+
+/* Define to the home page for this package. */
+#define _EVENT_PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define _EVENT_PACKAGE_VERSION ""
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+/* #undef _EVENT_PTHREAD_CREATE_JOINABLE */
+
+/* The size of `int', as computed by sizeof. */
+#define _EVENT_SIZEOF_INT 4
+
+/* The size of `long', as computed by sizeof. */
+#ifdef _LP64
+#define _EVENT_SIZEOF_LONG 8
+#else
+#define _EVENT_SIZEOF_LONG 4
+#endif
+
+/* The size of `long long', as computed by sizeof. */
+#define _EVENT_SIZEOF_LONG_LONG 8
+
+/* The size of `off_t', as computed by sizeof. */
+#define _EVENT_SIZEOF_OFF_T 8
+
+#if !defined(__minix)
+/* The size of `pthread_t', as computed by sizeof. */
+#ifdef _LP64
+#define _EVENT_SIZEOF_PTHREAD_T 8
+#else
+#define _EVENT_SIZEOF_PTHREAD_T 4
+#endif
+#endif /* !defined(__minix) */
+/* The size of `short', as computed by sizeof. */
+#define _EVENT_SIZEOF_SHORT 2
+
+/* The size of `size_t', as computed by sizeof. */
+#ifdef _LP64
+#define _EVENT_SIZEOF_SIZE_T 8
+#else
+#define _EVENT_SIZEOF_SIZE_T 4
+#endif
+
+/* The size of `void *', as computed by sizeof. */
+#ifdef _LP64
+#define _EVENT_SIZEOF_VOID_P 8
+#else
+#define _EVENT_SIZEOF_VOID_P 4
+#endif
+
+/* Define to 1 if you have the ANSI C header files. */
+#define _EVENT_STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define _EVENT_TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define _EVENT_VERSION "2.0.22-stable"
+
+/* Define to appropriate substitue if compiler doesnt have __func__ */
+/* #undef _EVENT___func__ */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef _EVENT_const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef _EVENT___cplusplus
+/* #undef _EVENT_inline */
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef _EVENT_pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef _EVENT_size_t */
+
+/* Define to unsigned int if you dont have it */
+/* #undef _EVENT_socklen_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef _EVENT_ssize_t */
+
+#endif /* event2/event-config.h */

Property changes on: lab4/.minix-src/include/event2/event-config.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/http.h
===================================================================
--- lab4/.minix-src/include/event2/http.h	(nonexistent)
+++ lab4/.minix-src/include/event2/http.h	(revision 13)
@@ -0,0 +1,865 @@
+/*	$NetBSD: http.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*	$NetBSD: http.h,v 1.1.1.2 2015/01/29 06:38:28 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_HTTP_H_
+#define _EVENT2_HTTP_H_
+
+/* For int types. */
+#include <event2/util.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* In case we haven't included the right headers yet. */
+struct evbuffer;
+struct event_base;
+
+/** @file event2/http.h
+ *
+ * Basic support for HTTP serving.
+ *
+ * As Libevent is a library for dealing with event notification and most
+ * interesting applications are networked today, I have often found the
+ * need to write HTTP code.  The following prototypes and definitions provide
+ * an application with a minimal interface for making HTTP requests and for
+ * creating a very simple HTTP server.
+ */
+
+/* Response codes */
+#define HTTP_OK			200	/**< request completed ok */
+#define HTTP_NOCONTENT		204	/**< request does not have content */
+#define HTTP_MOVEPERM		301	/**< the uri moved permanently */
+#define HTTP_MOVETEMP		302	/**< the uri moved temporarily */
+#define HTTP_NOTMODIFIED	304	/**< page was not modified from last */
+#define HTTP_BADREQUEST		400	/**< invalid http request was made */
+#define HTTP_NOTFOUND		404	/**< could not find content for uri */
+#define HTTP_BADMETHOD		405 	/**< method not allowed for this uri */
+#define HTTP_ENTITYTOOLARGE	413	/**<  */
+#define HTTP_EXPECTATIONFAILED	417	/**< we can't handle this expectation */
+#define HTTP_INTERNAL           500     /**< internal error */
+#define HTTP_NOTIMPLEMENTED     501     /**< not implemented */
+#define HTTP_SERVUNAVAIL	503	/**< the server is not available */
+
+struct evhttp;
+struct evhttp_request;
+struct evkeyvalq;
+struct evhttp_bound_socket;
+struct evconnlistener;
+
+/**
+ * Create a new HTTP server.
+ *
+ * @param base (optional) the event base to receive the HTTP events
+ * @return a pointer to a newly initialized evhttp server structure
+ * @see evhttp_free()
+ */
+struct evhttp *evhttp_new(struct event_base *base);
+
+/**
+ * Binds an HTTP server on the specified address and port.
+ *
+ * Can be called multiple times to bind the same http server
+ * to multiple different ports.
+ *
+ * @param http a pointer to an evhttp object
+ * @param address a string containing the IP address to listen(2) on
+ * @param port the port number to listen on
+ * @return 0 on success, -1 on failure.
+ * @see evhttp_accept_socket()
+ */
+int evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t port);
+
+/**
+ * Like evhttp_bind_socket(), but returns a handle for referencing the socket.
+ *
+ * The returned pointer is not valid after \a http is freed.
+ *
+ * @param http a pointer to an evhttp object
+ * @param address a string containing the IP address to listen(2) on
+ * @param port the port number to listen on
+ * @return Handle for the socket on success, NULL on failure.
+ * @see evhttp_bind_socket(), evhttp_del_accept_socket()
+ */
+struct evhttp_bound_socket *evhttp_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint16_t port);
+
+/**
+ * Makes an HTTP server accept connections on the specified socket.
+ *
+ * This may be useful to create a socket and then fork multiple instances
+ * of an http server, or when a socket has been communicated via file
+ * descriptor passing in situations where an http servers does not have
+ * permissions to bind to a low-numbered port.
+ *
+ * Can be called multiple times to have the http server listen to
+ * multiple different sockets.
+ *
+ * @param http a pointer to an evhttp object
+ * @param fd a socket fd that is ready for accepting connections
+ * @return 0 on success, -1 on failure.
+ * @see evhttp_bind_socket()
+ */
+int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd);
+
+/**
+ * Like evhttp_accept_socket(), but returns a handle for referencing the socket.
+ *
+ * The returned pointer is not valid after \a http is freed.
+ *
+ * @param http a pointer to an evhttp object
+ * @param fd a socket fd that is ready for accepting connections
+ * @return Handle for the socket on success, NULL on failure.
+ * @see evhttp_accept_socket(), evhttp_del_accept_socket()
+ */
+struct evhttp_bound_socket *evhttp_accept_socket_with_handle(struct evhttp *http, evutil_socket_t fd);
+
+/**
+ * The most low-level evhttp_bind/accept method: takes an evconnlistener, and
+ * returns an evhttp_bound_socket.  The listener will be freed when the bound
+ * socket is freed.
+ */
+struct evhttp_bound_socket *evhttp_bind_listener(struct evhttp *http, struct evconnlistener *listener);
+
+/**
+ * Return the listener used to implement a bound socket.
+ */
+struct evconnlistener *evhttp_bound_socket_get_listener(struct evhttp_bound_socket *bound);
+
+/**
+ * Makes an HTTP server stop accepting connections on the specified socket
+ *
+ * This may be useful when a socket has been sent via file descriptor passing
+ * and is no longer needed by the current process.
+ *
+ * If you created this bound socket with evhttp_bind_socket_with_handle or
+ * evhttp_accept_socket_with_handle, this function closes the fd you provided.
+ * If you created this bound socket with evhttp_bind_listener, this function
+ * frees the listener you provided.
+ *
+ * \a bound_socket is an invalid pointer after this call returns.
+ *
+ * @param http a pointer to an evhttp object
+ * @param bound_socket a handle returned by evhttp_{bind,accept}_socket_with_handle
+ * @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle()
+ */
+void evhttp_del_accept_socket(struct evhttp *http, struct evhttp_bound_socket *bound_socket);
+
+/**
+ * Get the raw file descriptor referenced by an evhttp_bound_socket.
+ *
+ * @param bound_socket a handle returned by evhttp_{bind,accept}_socket_with_handle
+ * @return the file descriptor used by the bound socket
+ * @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle()
+ */
+evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound_socket);
+
+/**
+ * Free the previously created HTTP server.
+ *
+ * Works only if no requests are currently being served.
+ *
+ * @param http the evhttp server object to be freed
+ * @see evhttp_start()
+ */
+void evhttp_free(struct evhttp* http);
+
+/** XXX Document. */
+void evhttp_set_max_headers_size(struct evhttp* http, ev_ssize_t max_headers_size);
+/** XXX Document. */
+void evhttp_set_max_body_size(struct evhttp* http, ev_ssize_t max_body_size);
+
+/**
+  Sets the what HTTP methods are supported in requests accepted by this
+  server, and passed to user callbacks.
+
+  If not supported they will generate a "405 Method not allowed" response.
+
+  By default this includes the following methods: GET, POST, HEAD, PUT, DELETE
+
+  @param http the http server on which to set the methods
+  @param methods bit mask constructed from evhttp_cmd_type values
+*/
+void evhttp_set_allowed_methods(struct evhttp* http, ev_uint16_t methods);
+
+/**
+   Set a callback for a specified URI
+
+   @param http the http sever on which to set the callback
+   @param path the path for which to invoke the callback
+   @param cb the callback function that gets invoked on requesting path
+   @param cb_arg an additional context argument for the callback
+   @return 0 on success, -1 if the callback existed already, -2 on failure
+*/
+int evhttp_set_cb(struct evhttp *http, const char *path,
+    void (*cb)(struct evhttp_request *, void *), void *cb_arg);
+
+/** Removes the callback for a specified URI */
+int evhttp_del_cb(struct evhttp *, const char *);
+
+/**
+    Set a callback for all requests that are not caught by specific callbacks
+
+    Invokes the specified callback for all requests that do not match any of
+    the previously specified request paths.  This is catchall for requests not
+    specifically configured with evhttp_set_cb().
+
+    @param http the evhttp server object for which to set the callback
+    @param cb the callback to invoke for any unmatched requests
+    @param arg an context argument for the callback
+*/
+void evhttp_set_gencb(struct evhttp *http,
+    void (*cb)(struct evhttp_request *, void *), void *arg);
+
+/**
+   Adds a virtual host to the http server.
+
+   A virtual host is a newly initialized evhttp object that has request
+   callbacks set on it via evhttp_set_cb() or evhttp_set_gencb().  It
+   most not have any listing sockets associated with it.
+
+   If the virtual host has not been removed by the time that evhttp_free()
+   is called on the main http server, it will be automatically freed, too.
+
+   It is possible to have hierarchical vhosts.  For example: A vhost
+   with the pattern *.example.com may have other vhosts with patterns
+   foo.example.com and bar.example.com associated with it.
+
+   @param http the evhttp object to which to add a virtual host
+   @param pattern the glob pattern against which the hostname is matched.
+     The match is case insensitive and follows otherwise regular shell
+     matching.
+   @param vhost the virtual host to add the regular http server.
+   @return 0 on success, -1 on failure
+   @see evhttp_remove_virtual_host()
+*/
+int evhttp_add_virtual_host(struct evhttp* http, const char *pattern,
+    struct evhttp* vhost);
+
+/**
+   Removes a virtual host from the http server.
+
+   @param http the evhttp object from which to remove the virtual host
+   @param vhost the virtual host to remove from the regular http server.
+   @return 0 on success, -1 on failure
+   @see evhttp_add_virtual_host()
+*/
+int evhttp_remove_virtual_host(struct evhttp* http, struct evhttp* vhost);
+
+/**
+   Add a server alias to an http object. The http object can be a virtual
+   host or the main server.
+
+   @param http the evhttp object
+   @param alias the alias to add
+   @see evhttp_add_remove_alias()
+*/
+int evhttp_add_server_alias(struct evhttp *http, const char *alias);
+
+/**
+   Remove a server alias from an http object.
+
+   @param http the evhttp object
+   @param alias the alias to remove
+   @see evhttp_add_server_alias()
+*/
+int evhttp_remove_server_alias(struct evhttp *http, const char *alias);
+
+/**
+ * Set the timeout for an HTTP request.
+ *
+ * @param http an evhttp object
+ * @param timeout_in_secs the timeout, in seconds
+ */
+void evhttp_set_timeout(struct evhttp *http, int timeout_in_secs);
+
+/* Request/Response functionality */
+
+/**
+ * Send an HTML error message to the client.
+ *
+ * @param req a request object
+ * @param error the HTTP error code
+ * @param reason a brief explanation of the error.  If this is NULL, we'll
+ *    just use the standard meaning of the error code.
+ */
+void evhttp_send_error(struct evhttp_request *req, int error,
+    const char *reason);
+
+/**
+ * Send an HTML reply to the client.
+ *
+ * The body of the reply consists of the data in databuf.  After calling
+ * evhttp_send_reply() databuf will be empty, but the buffer is still
+ * owned by the caller and needs to be deallocated by the caller if
+ * necessary.
+ *
+ * @param req a request object
+ * @param code the HTTP response code to send
+ * @param reason a brief message to send with the response code
+ * @param databuf the body of the response
+ */
+void evhttp_send_reply(struct evhttp_request *req, int code,
+    const char *reason, struct evbuffer *databuf);
+
+/* Low-level response interface, for streaming/chunked replies */
+
+/**
+   Initiate a reply that uses Transfer-Encoding chunked.
+
+   This allows the caller to stream the reply back to the client and is
+   useful when either not all of the reply data is immediately available
+   or when sending very large replies.
+
+   The caller needs to supply data chunks with evhttp_send_reply_chunk()
+   and complete the reply by calling evhttp_send_reply_end().
+
+   @param req a request object
+   @param code the HTTP response code to send
+   @param reason a brief message to send with the response code
+*/
+void evhttp_send_reply_start(struct evhttp_request *req, int code,
+    const char *reason);
+
+/**
+   Send another data chunk as part of an ongoing chunked reply.
+
+   The reply chunk consists of the data in databuf.  After calling
+   evhttp_send_reply_chunk() databuf will be empty, but the buffer is
+   still owned by the caller and needs to be deallocated by the caller
+   if necessary.
+
+   @param req a request object
+   @param databuf the data chunk to send as part of the reply.
+*/
+void evhttp_send_reply_chunk(struct evhttp_request *req,
+    struct evbuffer *databuf);
+/**
+   Complete a chunked reply, freeing the request as appropriate.
+
+   @param req a request object
+*/
+void evhttp_send_reply_end(struct evhttp_request *req);
+
+/*
+ * Interfaces for making requests
+ */
+
+/** The different request types supported by evhttp.  These are as specified
+ * in RFC2616, except for PATCH which is specified by RFC5789.
+ *
+ * By default, only some of these methods are accepted and passed to user
+ * callbacks; use evhttp_set_allowed_methods() to change which methods
+ * are allowed.
+ */
+enum evhttp_cmd_type {
+	EVHTTP_REQ_GET     = 1 << 0,
+	EVHTTP_REQ_POST    = 1 << 1,
+	EVHTTP_REQ_HEAD    = 1 << 2,
+	EVHTTP_REQ_PUT     = 1 << 3,
+	EVHTTP_REQ_DELETE  = 1 << 4,
+	EVHTTP_REQ_OPTIONS = 1 << 5,
+	EVHTTP_REQ_TRACE   = 1 << 6,
+	EVHTTP_REQ_CONNECT = 1 << 7,
+	EVHTTP_REQ_PATCH   = 1 << 8
+};
+
+/** a request object can represent either a request or a reply */
+enum evhttp_request_kind { EVHTTP_REQUEST, EVHTTP_RESPONSE };
+
+/**
+ * Creates a new request object that needs to be filled in with the request
+ * parameters.  The callback is executed when the request completed or an
+ * error occurred.
+ */
+struct evhttp_request *evhttp_request_new(
+	void (*cb)(struct evhttp_request *, void *), void *arg);
+
+/**
+ * Enable delivery of chunks to requestor.
+ * @param cb will be called after every read of data with the same argument
+ *           as the completion callback. Will never be called on an empty
+ *           response. May drain the input buffer; it will be drained
+ *           automatically on return.
+ */
+void evhttp_request_set_chunked_cb(struct evhttp_request *,
+    void (*cb)(struct evhttp_request *, void *));
+
+/** Frees the request object and removes associated events. */
+void evhttp_request_free(struct evhttp_request *req);
+
+struct evdns_base;
+
+/**
+ * A connection object that can be used to for making HTTP requests.  The
+ * connection object tries to resolve address and establish the connection
+ * when it is given an http request object.
+ *
+ * @param base the event_base to use for handling the connection
+ * @param dnsbase the dns_base to use for resolving host names; if not
+ *     specified host name resolution will block.
+ * @param address the address to which to connect
+ * @param port the port to connect to
+ * @return an evhttp_connection object that can be used for making requests
+ */
+struct evhttp_connection *evhttp_connection_base_new(
+	struct event_base *base, struct evdns_base *dnsbase,
+	const char *address, unsigned short port);
+
+/**
+ * Return the bufferevent that an evhttp_connection is using.
+ */
+struct bufferevent *evhttp_connection_get_bufferevent(
+	struct evhttp_connection *evcon);
+
+/** Takes ownership of the request object
+ *
+ * Can be used in a request callback to keep onto the request until
+ * evhttp_request_free() is explicitly called by the user.
+ */
+void evhttp_request_own(struct evhttp_request *req);
+
+/** Returns 1 if the request is owned by the user */
+int evhttp_request_is_owned(struct evhttp_request *req);
+
+/**
+ * Returns the connection object associated with the request or NULL
+ *
+ * The user needs to either free the request explicitly or call
+ * evhttp_send_reply_end().
+ */
+struct evhttp_connection *evhttp_request_get_connection(struct evhttp_request *req);
+
+/**
+ * Returns the underlying event_base for this connection
+ */
+struct event_base *evhttp_connection_get_base(struct evhttp_connection *req);
+
+void evhttp_connection_set_max_headers_size(struct evhttp_connection *evcon,
+    ev_ssize_t new_max_headers_size);
+
+void evhttp_connection_set_max_body_size(struct evhttp_connection* evcon,
+    ev_ssize_t new_max_body_size);
+
+/** Frees an http connection */
+void evhttp_connection_free(struct evhttp_connection *evcon);
+
+/** sets the ip address from which http connections are made */
+void evhttp_connection_set_local_address(struct evhttp_connection *evcon,
+    const char *address);
+
+/** sets the local port from which http connections are made */
+void evhttp_connection_set_local_port(struct evhttp_connection *evcon,
+    ev_uint16_t port);
+
+/** Sets the timeout for events related to this connection */
+void evhttp_connection_set_timeout(struct evhttp_connection *evcon,
+    int timeout_in_secs);
+
+/** Sets the retry limit for this connection - -1 repeats indefinitely */
+void evhttp_connection_set_retries(struct evhttp_connection *evcon,
+    int retry_max);
+
+/** Set a callback for connection close. */
+void evhttp_connection_set_closecb(struct evhttp_connection *evcon,
+    void (*)(struct evhttp_connection *, void *), void *);
+
+/** Get the remote address and port associated with this connection. */
+void evhttp_connection_get_peer(struct evhttp_connection *evcon,
+    char **address, ev_uint16_t *port);
+
+/**
+    Make an HTTP request over the specified connection.
+
+    The connection gets ownership of the request.  On failure, the
+    request object is no longer valid as it has been freed.
+
+    @param evcon the evhttp_connection object over which to send the request
+    @param req the previously created and configured request object
+    @param type the request type EVHTTP_REQ_GET, EVHTTP_REQ_POST, etc.
+    @param uri the URI associated with the request
+    @return 0 on success, -1 on failure
+    @see evhttp_cancel_request()
+*/
+int evhttp_make_request(struct evhttp_connection *evcon,
+    struct evhttp_request *req,
+    enum evhttp_cmd_type type, const char *uri);
+
+/**
+   Cancels a pending HTTP request.
+
+   Cancels an ongoing HTTP request.  The callback associated with this request
+   is not executed and the request object is freed.  If the request is
+   currently being processed, e.g. it is ongoing, the corresponding
+   evhttp_connection object is going to get reset.
+
+   A request cannot be canceled if its callback has executed already. A request
+   may be canceled reentrantly from its chunked callback.
+
+   @param req the evhttp_request to cancel; req becomes invalid after this call.
+*/
+void evhttp_cancel_request(struct evhttp_request *req);
+
+/**
+ * A structure to hold a parsed URI or Relative-Ref conforming to RFC3986.
+ */
+struct evhttp_uri;
+
+/** Returns the request URI */
+const char *evhttp_request_get_uri(const struct evhttp_request *req);
+/** Returns the request URI (parsed) */
+const struct evhttp_uri *evhttp_request_get_evhttp_uri(const struct evhttp_request *req);
+/** Returns the request command */
+enum evhttp_cmd_type evhttp_request_get_command(const struct evhttp_request *req);
+
+int evhttp_request_get_response_code(const struct evhttp_request *req);
+
+/** Returns the input headers */
+struct evkeyvalq *evhttp_request_get_input_headers(struct evhttp_request *req);
+/** Returns the output headers */
+struct evkeyvalq *evhttp_request_get_output_headers(struct evhttp_request *req);
+/** Returns the input buffer */
+struct evbuffer *evhttp_request_get_input_buffer(struct evhttp_request *req);
+/** Returns the output buffer */
+struct evbuffer *evhttp_request_get_output_buffer(struct evhttp_request *req);
+/** Returns the host associated with the request. If a client sends an absolute
+    URI, the host part of that is preferred. Otherwise, the input headers are
+    searched for a Host: header. NULL is returned if no absolute URI or Host:
+    header is provided. */
+const char *evhttp_request_get_host(struct evhttp_request *req);
+
+/* Interfaces for dealing with HTTP headers */
+
+/**
+   Finds the value belonging to a header.
+
+   @param headers the evkeyvalq object in which to find the header
+   @param key the name of the header to find
+   @returns a pointer to the value for the header or NULL if the header
+     count not be found.
+   @see evhttp_add_header(), evhttp_remove_header()
+*/
+const char *evhttp_find_header(const struct evkeyvalq *headers,
+    const char *key);
+
+/**
+   Removes a header from a list of existing headers.
+
+   @param headers the evkeyvalq object from which to remove a header
+   @param key the name of the header to remove
+   @returns 0 if the header was removed, -1  otherwise.
+   @see evhttp_find_header(), evhttp_add_header()
+*/
+int evhttp_remove_header(struct evkeyvalq *headers, const char *key);
+
+/**
+   Adds a header to a list of existing headers.
+
+   @param headers the evkeyvalq object to which to add a header
+   @param key the name of the header
+   @param value the value belonging to the header
+   @returns 0 on success, -1  otherwise.
+   @see evhttp_find_header(), evhttp_clear_headers()
+*/
+int evhttp_add_header(struct evkeyvalq *headers, const char *key, const char *value);
+
+/**
+   Removes all headers from the header list.
+
+   @param headers the evkeyvalq object from which to remove all headers
+*/
+void evhttp_clear_headers(struct evkeyvalq *headers);
+
+/* Miscellaneous utility functions */
+
+
+/**
+   Helper function to encode a string for inclusion in a URI.  All
+   characters are replaced by their hex-escaped (%22) equivalents,
+   except for characters explicitly unreserved by RFC3986 -- that is,
+   ASCII alphanumeric characters, hyphen, dot, underscore, and tilde.
+
+   The returned string must be freed by the caller.
+
+   @param str an unencoded string
+   @return a newly allocated URI-encoded string or NULL on failure
+ */
+char *evhttp_encode_uri(const char *str);
+
+/**
+   As evhttp_encode_uri, but if 'size' is nonnegative, treat the string
+   as being 'size' bytes long.  This allows you to encode strings that
+   may contain 0-valued bytes.
+
+   The returned string must be freed by the caller.
+
+   @param str an unencoded string
+   @param size the length of the string to encode, or -1 if the string
+      is NUL-terminated
+   @param space_to_plus if true, space characters in 'str' are encoded
+      as +, not %20.
+   @return a newly allocate URI-encoded string, or NULL on failure.
+ */
+char *evhttp_uriencode(const char *str, ev_ssize_t size, int space_to_plus);
+
+/**
+  Helper function to sort of decode a URI-encoded string.  Unlike
+  evhttp_get_decoded_uri, it decodes all plus characters that appear
+  _after_ the first question mark character, but no plusses that occur
+  before.  This is not a good way to decode URIs in whole or in part.
+
+  The returned string must be freed by the caller
+
+  @deprecated  This function is deprecated; you probably want to use
+     evhttp_get_decoded_uri instead.
+
+  @param uri an encoded URI
+  @return a newly allocated unencoded URI or NULL on failure
+ */
+char *evhttp_decode_uri(const char *uri);
+
+/**
+  Helper function to decode a URI-escaped string or HTTP parameter.
+
+  If 'decode_plus' is 1, then we decode the string as an HTTP parameter
+  value, and convert all plus ('+') characters to spaces.  If
+  'decode_plus' is 0, we leave all plus characters unchanged.
+
+  The returned string must be freed by the caller.
+
+  @param uri a URI-encode encoded URI
+  @param decode_plus determines whether we convert '+' to sapce.
+  @param size_out if size_out is not NULL, *size_out is set to the size of the
+     returned string
+  @return a newly allocated unencoded URI or NULL on failure
+ */
+char *evhttp_uridecode(const char *uri, int decode_plus,
+    size_t *size_out);
+
+/**
+   Helper function to parse out arguments in a query.
+
+   Parsing a URI like
+
+      http://foo.com/?q=test&s=some+thing
+
+   will result in two entries in the key value queue.
+
+   The first entry is: key="q", value="test"
+   The second entry is: key="s", value="some thing"
+
+   @deprecated This function is deprecated as of Libevent 2.0.9.  Use
+     evhttp_uri_parse and evhttp_parse_query_str instead.
+
+   @param uri the request URI
+   @param headers the head of the evkeyval queue
+   @return 0 on success, -1 on failure
+ */
+int evhttp_parse_query(const char *uri, struct evkeyvalq *headers);
+
+/**
+   Helper function to parse out arguments from the query portion of an
+   HTTP URI.
+
+   Parsing a query string like
+
+     q=test&s=some+thing
+
+   will result in two entries in the key value queue.
+
+   The first entry is: key="q", value="test"
+   The second entry is: key="s", value="some thing"
+
+   @param query_parse the query portion of the URI
+   @param headers the head of the evkeyval queue
+   @return 0 on success, -1 on failure
+ */
+int evhttp_parse_query_str(const char *uri, struct evkeyvalq *headers);
+
+/**
+ * Escape HTML character entities in a string.
+ *
+ * Replaces <, >, ", ' and & with &lt;, &gt;, &quot;,
+ * &#039; and &amp; correspondingly.
+ *
+ * The returned string needs to be freed by the caller.
+ *
+ * @param html an unescaped HTML string
+ * @return an escaped HTML string or NULL on error
+ */
+char *evhttp_htmlescape(const char *html);
+
+/**
+ * Return a new empty evhttp_uri with no fields set.
+ */
+struct evhttp_uri *evhttp_uri_new(void);
+
+/**
+ * Changes the flags set on a given URI.  See EVHTTP_URI_* for
+ * a list of flags.
+ **/
+void evhttp_uri_set_flags(struct evhttp_uri *uri, unsigned flags);
+
+/** Return the scheme of an evhttp_uri, or NULL if there is no scheme has
+ * been set and the evhttp_uri contains a Relative-Ref. */
+const char *evhttp_uri_get_scheme(const struct evhttp_uri *uri);
+/**
+ * Return the userinfo part of an evhttp_uri, or NULL if it has no userinfo
+ * set.
+ */
+const char *evhttp_uri_get_userinfo(const struct evhttp_uri *uri);
+/**
+ * Return the host part of an evhttp_uri, or NULL if it has no host set.
+ * The host may either be a regular hostname (conforming to the RFC 3986
+ * "regname" production), or an IPv4 address, or the empty string, or a
+ * bracketed IPv6 address, or a bracketed 'IP-Future' address.
+ *
+ * Note that having a NULL host means that the URI has no authority
+ * section, but having an empty-string host means that the URI has an
+ * authority section with no host part.  For example,
+ * "mailto:user@example.com" has a host of NULL, but "file:///etc/motd"
+ * has a host of "".
+ */
+const char *evhttp_uri_get_host(const struct evhttp_uri *uri);
+/** Return the port part of an evhttp_uri, or -1 if there is no port set. */
+int evhttp_uri_get_port(const struct evhttp_uri *uri);
+/** Return the path part of an evhttp_uri, or NULL if it has no path set */
+const char *evhttp_uri_get_path(const struct evhttp_uri *uri);
+/** Return the query part of an evhttp_uri (excluding the leading "?"), or
+ * NULL if it has no query set */
+const char *evhttp_uri_get_query(const struct evhttp_uri *uri);
+/** Return the fragment part of an evhttp_uri (excluding the leading "#"),
+ * or NULL if it has no fragment set */
+const char *evhttp_uri_get_fragment(const struct evhttp_uri *uri);
+
+/** Set the scheme of an evhttp_uri, or clear the scheme if scheme==NULL.
+ * Returns 0 on success, -1 if scheme is not well-formed. */
+int evhttp_uri_set_scheme(struct evhttp_uri *uri, const char *scheme);
+/** Set the userinfo of an evhttp_uri, or clear the userinfo if userinfo==NULL.
+ * Returns 0 on success, -1 if userinfo is not well-formed. */
+int evhttp_uri_set_userinfo(struct evhttp_uri *uri, const char *userinfo);
+/** Set the host of an evhttp_uri, or clear the host if host==NULL.
+ * Returns 0 on success, -1 if host is not well-formed. */
+int evhttp_uri_set_host(struct evhttp_uri *uri, const char *host);
+/** Set the port of an evhttp_uri, or clear the port if port==-1.
+ * Returns 0 on success, -1 if port is not well-formed. */
+int evhttp_uri_set_port(struct evhttp_uri *uri, int port);
+/** Set the path of an evhttp_uri, or clear the path if path==NULL.
+ * Returns 0 on success, -1 if path is not well-formed. */
+int evhttp_uri_set_path(struct evhttp_uri *uri, const char *path);
+/** Set the query of an evhttp_uri, or clear the query if query==NULL.
+ * The query should not include a leading "?".
+ * Returns 0 on success, -1 if query is not well-formed. */
+int evhttp_uri_set_query(struct evhttp_uri *uri, const char *query);
+/** Set the fragment of an evhttp_uri, or clear the fragment if fragment==NULL.
+ * The fragment should not include a leading "#".
+ * Returns 0 on success, -1 if fragment is not well-formed. */
+int evhttp_uri_set_fragment(struct evhttp_uri *uri, const char *fragment);
+
+/**
+ * Helper function to parse a URI-Reference as specified by RFC3986.
+ *
+ * This function matches the URI-Reference production from RFC3986,
+ * which includes both URIs like
+ *
+ *    scheme://[[userinfo]@]foo.com[:port]]/[path][?query][#fragment]
+ *
+ *  and relative-refs like
+ *
+ *    [path][?query][#fragment]
+ *
+ * Any optional elements portions not present in the original URI are
+ * left set to NULL in the resulting evhttp_uri.  If no port is
+ * specified, the port is set to -1.
+ *
+ * Note that no decoding is performed on percent-escaped characters in
+ * the string; if you want to parse them, use evhttp_uridecode or
+ * evhttp_parse_query_str as appropriate.
+ *
+ * Note also that most URI schemes will have additional constraints that
+ * this function does not know about, and cannot check.  For example,
+ * mailto://www.example.com/cgi-bin/fortune.pl is not a reasonable
+ * mailto url, http://www.example.com:99999/ is not a reasonable HTTP
+ * URL, and ftp:username@example.com is not a reasonable FTP URL.
+ * Nevertheless, all of these URLs conform to RFC3986, and this function
+ * accepts all of them as valid.
+ *
+ * @param source_uri the request URI
+ * @param flags Zero or more EVHTTP_URI_* flags to affect the behavior
+ *              of the parser.
+ * @return uri container to hold parsed data, or NULL if there is error
+ * @see evhttp_uri_free()
+ */
+struct evhttp_uri *evhttp_uri_parse_with_flags(const char *source_uri,
+    unsigned flags);
+
+/** Tolerate URIs that do not conform to RFC3986.
+ *
+ * Unfortunately, some HTTP clients generate URIs that, according to RFC3986,
+ * are not conformant URIs.  If you need to support these URIs, you can
+ * do so by passing this flag to evhttp_uri_parse_with_flags.
+ *
+ * Currently, these changes are:
+ * <ul>
+ *   <li> Nonconformant URIs are allowed to contain otherwise unreasonable
+ *        characters in their path, query, and fragment components.
+ * </ul>
+ */
+#define EVHTTP_URI_NONCONFORMANT 0x01
+
+/** Alias for evhttp_uri_parse_with_flags(source_uri, 0) */
+struct evhttp_uri *evhttp_uri_parse(const char *source_uri);
+
+/**
+ * Free all memory allocated for a parsed uri.  Only use this for URIs
+ * generated by evhttp_uri_parse.
+ *
+ * @param uri container with parsed data
+ * @see evhttp_uri_parse()
+ */
+void evhttp_uri_free(struct evhttp_uri *uri);
+
+/**
+ * Join together the uri parts from parsed data to form a URI-Reference.
+ *
+ * Note that no escaping of reserved characters is done on the members
+ * of the evhttp_uri, so the generated string might not be a valid URI
+ * unless the members of evhttp_uri are themselves valid.
+ *
+ * @param uri container with parsed data
+ * @param buf destination buffer
+ * @param limit destination buffer size
+ * @return an joined uri as string or NULL on error
+ * @see evhttp_uri_parse()
+ */
+char *evhttp_uri_join(struct evhttp_uri *uri, char *buf, size_t limit);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_HTTP_H_ */

Property changes on: lab4/.minix-src/include/event2/http.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/listener.h
===================================================================
--- lab4/.minix-src/include/event2/listener.h	(nonexistent)
+++ lab4/.minix-src/include/event2/listener.h	(revision 13)
@@ -0,0 +1,145 @@
+/*	$NetBSD: listener.h,v 1.1.1.2 2015/01/29 06:38:25 spz Exp $	*/
+/*	$NetBSD: listener.h,v 1.1.1.2 2015/01/29 06:38:25 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_LISTENER_H_
+#define _EVENT2_LISTENER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event.h>
+
+struct sockaddr;
+struct evconnlistener;
+
+/**
+   A callback that we invoke when a listener has a new connection.
+
+   @param listener The evconnlistener
+   @param fd The new file descriptor
+   @param addr The source address of the connection
+   @param socklen The length of addr
+   @param user_arg the pointer passed to evconnlistener_new()
+ */
+typedef void (*evconnlistener_cb)(struct evconnlistener *, evutil_socket_t, struct sockaddr *, int socklen, void *);
+
+/**
+   A callback that we invoke when a listener encounters a non-retriable error.
+
+   @param listener The evconnlistener
+   @param user_arg the pointer passed to evconnlistener_new()
+ */
+typedef void (*evconnlistener_errorcb)(struct evconnlistener *, void *);
+
+/** Flag: Indicates that we should not make incoming sockets nonblocking
+ * before passing them to the callback. */
+#define LEV_OPT_LEAVE_SOCKETS_BLOCKING	(1u<<0)
+/** Flag: Indicates that freeing the listener should close the underlying
+ * socket. */
+#define LEV_OPT_CLOSE_ON_FREE		(1u<<1)
+/** Flag: Indicates that we should set the close-on-exec flag, if possible */
+#define LEV_OPT_CLOSE_ON_EXEC		(1u<<2)
+/** Flag: Indicates that we should disable the timeout (if any) between when
+ * this socket is closed and when we can listen again on the same port. */
+#define LEV_OPT_REUSEABLE		(1u<<3)
+/** Flag: Indicates that the listener should be locked so it's safe to use
+ * from multiple threadcs at once. */
+#define LEV_OPT_THREADSAFE		(1u<<4)
+
+/**
+   Allocate a new evconnlistener object to listen for incoming TCP connections
+   on a given file descriptor.
+
+   @param base The event base to associate the listener with.
+   @param cb A callback to be invoked when a new connection arrives.  If the
+      callback is NULL, the listener will be treated as disabled until the
+      callback is set.
+   @param ptr A user-supplied pointer to give to the callback.
+   @param flags Any number of LEV_OPT_* flags
+   @param backlog Passed to the listen() call to determine the length of the
+      acceptable connection backlog.  Set to -1 for a reasonable default.
+      Set to 0 if the socket is already listening.
+   @param fd The file descriptor to listen on.  It must be a nonblocking
+      file descriptor, and it should already be bound to an appropriate
+      port and address.
+*/
+struct evconnlistener *evconnlistener_new(struct event_base *base,
+    evconnlistener_cb cb, void *ptr, unsigned flags, int backlog,
+    evutil_socket_t fd);
+/**
+   Allocate a new evconnlistener object to listen for incoming TCP connections
+   on a given address.
+
+   @param base The event base to associate the listener with.
+   @param cb A callback to be invoked when a new connection arrives. If the
+      callback is NULL, the listener will be treated as disabled until the
+      callback is set.
+   @param ptr A user-supplied pointer to give to the callback.
+   @param flags Any number of LEV_OPT_* flags
+   @param backlog Passed to the listen() call to determine the length of the
+      acceptable connection backlog.  Set to -1 for a reasonable default.
+   @param addr The address to listen for connections on.
+   @param socklen The length of the address.
+ */
+struct evconnlistener *evconnlistener_new_bind(struct event_base *base,
+    evconnlistener_cb cb, void *ptr, unsigned flags, int backlog,
+    const struct sockaddr *sa, int socklen);
+/**
+   Disable and deallocate an evconnlistener.
+ */
+void evconnlistener_free(struct evconnlistener *lev);
+/**
+   Re-enable an evconnlistener that has been disabled.
+ */
+int evconnlistener_enable(struct evconnlistener *lev);
+/**
+   Stop listening for connections on an evconnlistener.
+ */
+int evconnlistener_disable(struct evconnlistener *lev);
+
+/** Return an evconnlistener's associated event_base. */
+struct event_base *evconnlistener_get_base(struct evconnlistener *lev);
+
+/** Return the socket that an evconnlistner is listening on. */
+evutil_socket_t evconnlistener_get_fd(struct evconnlistener *lev);
+
+/** Change the callback on the listener to cb and its user_data to arg.
+ */
+void evconnlistener_set_cb(struct evconnlistener *lev,
+    evconnlistener_cb cb, void *arg);
+
+/** Set an evconnlistener's error callback. */
+void evconnlistener_set_error_cb(struct evconnlistener *lev,
+    evconnlistener_errorcb errorcb);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/event2/listener.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event2/tag.h
===================================================================
--- lab4/.minix-src/include/event2/tag.h	(nonexistent)
+++ lab4/.minix-src/include/event2/tag.h	(revision 13)
@@ -0,0 +1,126 @@
+/*	$NetBSD: tag.h,v 1.1.1.2 2015/01/29 06:38:26 spz Exp $	*/
+/*	$NetBSD: tag.h,v 1.1.1.2 2015/01/29 06:38:26 spz Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT2_TAG_H_
+#define _EVENT2_TAG_H_
+
+/** @file event2/tag.h
+
+  Helper functions for reading and writing tagged data onto buffers.
+
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+/* For int types. */
+#include <event2/util.h>
+
+struct evbuffer;
+
+/*
+ * Marshaling tagged data - We assume that all tags are inserted in their
+ * numeric order - so that unknown tags will always be higher than the
+ * known ones - and we can just ignore the end of an event buffer.
+ */
+
+void evtag_init(void);
+
+/**
+   Unmarshals the header and returns the length of the payload
+
+   @param evbuf the buffer from which to unmarshal data
+   @param ptag a pointer in which the tag id is being stored
+   @returns -1 on failure or the number of bytes in the remaining payload.
+*/
+int evtag_unmarshal_header(struct evbuffer *evbuf, ev_uint32_t *ptag);
+
+void evtag_marshal(struct evbuffer *evbuf, ev_uint32_t tag, const void *data,
+    ev_uint32_t len);
+void evtag_marshal_buffer(struct evbuffer *evbuf, ev_uint32_t tag,
+    struct evbuffer *data);
+
+/**
+  Encode an integer and store it in an evbuffer.
+
+  We encode integers by nybbles; the first nibble contains the number
+  of significant nibbles - 1;  this allows us to encode up to 64-bit
+  integers.  This function is byte-order independent.
+
+  @param evbuf evbuffer to store the encoded number
+  @param number a 32-bit integer
+ */
+void evtag_encode_int(struct evbuffer *evbuf, ev_uint32_t number);
+void evtag_encode_int64(struct evbuffer *evbuf, ev_uint64_t number);
+
+void evtag_marshal_int(struct evbuffer *evbuf, ev_uint32_t tag,
+    ev_uint32_t integer);
+void evtag_marshal_int64(struct evbuffer *evbuf, ev_uint32_t tag,
+    ev_uint64_t integer);
+
+void evtag_marshal_string(struct evbuffer *buf, ev_uint32_t tag,
+    const char *string);
+
+void evtag_marshal_timeval(struct evbuffer *evbuf, ev_uint32_t tag,
+    struct timeval *tv);
+
+int evtag_unmarshal(struct evbuffer *src, ev_uint32_t *ptag,
+    struct evbuffer *dst);
+int evtag_peek(struct evbuffer *evbuf, ev_uint32_t *ptag);
+int evtag_peek_length(struct evbuffer *evbuf, ev_uint32_t *plength);
+int evtag_payload_length(struct evbuffer *evbuf, ev_uint32_t *plength);
+int evtag_consume(struct evbuffer *evbuf);
+
+int evtag_unmarshal_int(struct evbuffer *evbuf, ev_uint32_t need_tag,
+    ev_uint32_t *pinteger);
+int evtag_unmarshal_int64(struct evbuffer *evbuf, ev_uint32_t need_tag,
+    ev_uint64_t *pinteger);
+
+int evtag_unmarshal_fixed(struct evbuffer *src, ev_uint32_t need_tag,
+    void *data, size_t len);
+
+int evtag_unmarshal_string(struct evbuffer *evbuf, ev_uint32_t need_tag,
+    char **pstring);
+
+int evtag_unmarshal_timeval(struct evbuffer *evbuf, ev_uint32_t need_tag,
+    struct timeval *ptv);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT2_TAG_H_ */

Property changes on: lab4/.minix-src/include/event2/tag.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fs/puffs/puffs_msgif.h
===================================================================
--- lab4/.minix-src/include/fs/puffs/puffs_msgif.h	(nonexistent)
+++ lab4/.minix-src/include/fs/puffs/puffs_msgif.h	(revision 13)
@@ -0,0 +1,718 @@
+/*	$NetBSD: puffs_msgif.h,v 1.84 2015/02/15 20:21:29 manu Exp $	*/
+
+/*
+ * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
+ *
+ * Development of this software was supported by the
+ * Google Summer of Code program and the Ulla Tuominen Foundation.
+ * The Google SoC project was mentored by Bill Studenmund.
+ *
+ * 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 OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _FS_PUFFS_PUFFS_MSGIF_H_
+#define _FS_PUFFS_PUFFS_MSGIF_H_
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/ioccom.h>
+#include <sys/uio.h>
+#include <sys/vnode.h>
+#include <sys/ucred.h>
+#include <sys/statvfs.h>
+#include <sys/dirent.h>
+#include <sys/fcntl.h>
+
+#if !defined(__minix)
+#include <dev/putter/putter.h>
+#endif /* !defined(__minix) */
+
+#include <uvm/uvm_prot.h>
+
+#define PUFFSOP_VFS		0x01	/* kernel-> */
+#define PUFFSOP_VN		0x02	/* kernel-> */
+#define PUFFSOP_CACHE		0x03	/* only kernel-> */
+#define PUFFSOP_ERROR		0x04	/* only kernel-> */
+#define PUFFSOP_FLUSH		0x05	/* ->kernel */
+#define PUFFSOP_SUSPEND		0x06	/* ->kernel */
+#define PUFFSOP_UNMOUNT		0x07	/* ->kernel */
+
+#define PUFFSOPFLAG_FAF		0x10	/* fire-and-forget */
+#define PUFFSOPFLAG_ISRESPONSE	0x20	/* req is actually a resp */
+
+#define PUFFSOP_OPCMASK		0x07
+#define PUFFSOP_OPCLASS(a)	((a) & PUFFSOP_OPCMASK)
+#define PUFFSOP_WANTREPLY(a)	(((a) & PUFFSOPFLAG_FAF) == 0)
+
+enum {
+	PUFFS_VFS_MOUNT,	PUFFS_VFS_START,	PUFFS_VFS_UNMOUNT,
+	PUFFS_VFS_ROOT,		PUFFS_VFS_QUOTACTL,	PUFFS_VFS_STATVFS,
+	PUFFS_VFS_SYNC,		PUFFS_VFS_VGET,		PUFFS_VFS_FHTOVP,
+	PUFFS_VFS_VPTOFH,	PUFFS_VFS_INIT,		PUFFS_VFS_DONE,
+	PUFFS_VFS_SNAPSHOT,	PUFFS_VFS_EXTATTRCTL,	PUFFS_VFS_SUSPEND
+};
+#define PUFFS_VFS_MAX PUFFS_VFS_SUSPEND
+
+enum {
+	PUFFS_VN_LOOKUP,	PUFFS_VN_CREATE,	PUFFS_VN_MKNOD,
+	PUFFS_VN_OPEN,		PUFFS_VN_CLOSE,		PUFFS_VN_ACCESS,
+	PUFFS_VN_GETATTR,	PUFFS_VN_SETATTR,	PUFFS_VN_READ,
+	PUFFS_VN_WRITE,		PUFFS_VN_IOCTL,		PUFFS_VN_FCNTL,
+	PUFFS_VN_POLL,		PUFFS_VN_KQFILTER,	PUFFS_VN_REVOKE,
+	PUFFS_VN_MMAP,		PUFFS_VN_FSYNC,		PUFFS_VN_SEEK,
+	PUFFS_VN_REMOVE,	PUFFS_VN_LINK,		PUFFS_VN_RENAME,
+	PUFFS_VN_MKDIR,		PUFFS_VN_RMDIR,		PUFFS_VN_SYMLINK,
+	PUFFS_VN_READDIR,	PUFFS_VN_READLINK,	PUFFS_VN_ABORTOP,
+	PUFFS_VN_INACTIVE,	PUFFS_VN_RECLAIM,	PUFFS_VN_LOCK,
+	PUFFS_VN_UNLOCK,	PUFFS_VN_BMAP,		PUFFS_VN_STRATEGY,
+	PUFFS_VN_PRINT,		PUFFS_VN_ISLOCKED,	PUFFS_VN_PATHCONF,
+	PUFFS_VN_ADVLOCK,	PUFFS_VN_LEASE,		PUFFS_VN_WHITEOUT,
+	PUFFS_VN_GETPAGES,	PUFFS_VN_PUTPAGES,	PUFFS_VN_GETEXTATTR,
+	PUFFS_VN_LISTEXTATTR,	PUFFS_VN_OPENEXTATTR,	PUFFS_VN_DELETEEXTATTR,
+	PUFFS_VN_SETEXTATTR,	PUFFS_VN_CLOSEEXTATTR,	PUFFS_VN_FALLOCATE,
+	PUFFS_VN_FDISCARD,
+	/* NOTE: If you add an op, decrement PUFFS_VN_SPARE accordingly */
+};
+#define PUFFS_VN_MAX PUFFS_VN_FDISCARD
+#define PUFFS_VN_SPARE 30
+
+/*
+ * These signal invalid parameters the file system returned.
+ */
+enum {
+	PUFFS_ERR_ERROR,
+	PUFFS_ERR_MAKENODE,	PUFFS_ERR_LOOKUP,	PUFFS_ERR_READDIR,
+	PUFFS_ERR_READLINK,	PUFFS_ERR_READ,		PUFFS_ERR_WRITE,
+	PUFFS_ERR_VPTOFH,	PUFFS_ERR_GETEXTATTR,	PUFFS_ERR_LISTEXTATTR
+};
+#define PUFFS_ERR_MAX PUFFS_ERR_LISTEXTATTR
+
+#define PUFFSVERSION	30
+#define PUFFSNAMESIZE	32
+
+#define PUFFS_TYPEPREFIX "puffs|"
+
+#define PUFFS_TYPELEN (_VFS_NAMELEN - (sizeof(PUFFS_TYPEPREFIX)+1))
+#define PUFFS_NAMELEN (_VFS_MNAMELEN-1)
+
+/* 
+ * Just a weak typedef for code clarity.  Additionally, we have a
+ * more appropriate vanity type for puffs:
+ * <uep> it should be croissant, not cookie.
+ */
+typedef void *puffs_cookie_t;
+typedef puffs_cookie_t puffs_croissant_t;
+
+struct puffs_kargs {
+	unsigned int	pa_vers;
+	int		pa_fd;
+
+	uint32_t	pa_flags;
+
+	size_t		pa_maxmsglen;
+	int		pa_nhashbuckets;
+
+	size_t		pa_fhsize;
+	int		pa_fhflags;
+
+	uint8_t		pa_vnopmask[PUFFS_VN_MAX + PUFFS_VN_SPARE];
+
+	char		pa_typename[_VFS_NAMELEN];
+	char		pa_mntfromname[_VFS_MNAMELEN];
+
+	puffs_cookie_t	pa_root_cookie;
+	enum vtype	pa_root_vtype;
+	voff_t		pa_root_vsize;
+	union {
+		dev_t		dev;
+		uint64_t	container;
+	} devunion;
+
+	struct statvfs	pa_svfsb;
+
+	uint32_t	pa_time32;
+
+	uint32_t	pa_spare[127];
+};
+#define pa_root_rdev devunion.dev
+
+#define PUFFS_KFLAG_NOCACHE_NAME	0x001	/* don't use name cache     */
+#define PUFFS_KFLAG_NOCACHE_PAGE	0x002	/* don't use page cache	    */
+#define PUFFS_KFLAG_NOCACHE		0x003	/* no cache whatsoever      */
+#define PUFFS_KFLAG_ALLOPS		0x004	/* ignore pa_vnopmask       */
+#define PUFFS_KFLAG_WTCACHE		0x008	/* write-through page cache */
+#define PUFFS_KFLAG_IAONDEMAND		0x010	/* inactive only on demand  */
+#define PUFFS_KFLAG_LOOKUP_FULLPNBUF	0x020	/* full pnbuf in lookup     */
+#define PUFFS_KFLAG_NOCACHE_ATTR	0x040	/* no attrib cache (unused) */
+#define PUFFS_KFLAG_CACHE_FS_TTL	0x080	/* cache use TTL from FS    */
+#define PUFFS_KFLAG_CACHE_DOTDOT	0x100	/* don't send lookup for .. */
+#define PUFFS_KFLAG_NOFLUSH_META	0x200	/* don't flush metadata cache*/
+#define PUFFS_KFLAG_MASK		0x3bf
+
+#define PUFFS_FHFLAG_DYNAMIC		0x01
+#define PUFFS_FHFLAG_NFSV2		0x02
+#define PUFFS_FHFLAG_NFSV3		0x04
+#define PUFFS_FHFLAG_PROTOMASK		0x06
+#define PUFFS_FHFLAG_PASSTHROUGH	0x08
+#define PUFFS_FHFLAG_MASK		0x0f
+
+#define PUFFS_FHSIZE_MAX	1020	/* FHANDLE_SIZE_MAX - 4 */
+
+struct puffs_req {
+#if !defined(__minix)
+	struct putter_hdr	preq_pth;
+#endif /* ! defined(__minix) */
+
+	uint64_t		preq_id;
+	puffs_cookie_t		preq_cookie;
+
+	uint16_t		preq_opclass;
+	uint16_t		preq_optype;
+	int			preq_rv;
+
+	uint32_t		preq_setbacks;
+
+	/* Who is making the call?  Eventually host id is also needed. */
+	pid_t			preq_pid;
+	lwpid_t			preq_lid;
+
+	/*
+	 * the following helper pads the struct size to md alignment
+	 * multiple (should size_t not cut it).  it makes sure that
+	 * whatever comes after this struct is aligned
+	 */
+	size_t  		preq_buflen;
+	uint8_t	preq_buf[0] __aligned(ALIGNBYTES+1);
+};
+
+#define PUFFS_SETBACK_INACT_N1	0x01	/* set VOP_INACTIVE for node 1 */
+#define PUFFS_SETBACK_INACT_N2	0x02	/* set VOP_INACTIVE for node 2 */
+#define PUFFS_SETBACK_NOREF_N1	0x04	/* set pn PN_NOREFS for node 1 */
+#define PUFFS_SETBACK_NOREF_N2	0x08	/* set pn PN_NOREFS for node 2 */
+#define PUFFS_SETBACK_MASK	0x0f
+
+/*
+ * Flush operation.  This can be used to invalidate:
+ * 1) name cache for one node
+ * 2) name cache for all children 
+ * 3) name cache for the entire mount
+ * 4) page cache for a set of ranges in one node
+ * 5) page cache for one entire node
+ *
+ * It can be used to flush:
+ * 1) page cache for a set of ranges in one node
+ * 2) page cache for one entire node
+ */
+
+struct puffs_flush {
+	struct puffs_req	pf_req;
+
+	puffs_cookie_t		pf_cookie;
+
+	int			pf_op;
+	off_t			pf_start;
+	off_t			pf_end;
+};
+#define PUFFS_INVAL_NAMECACHE_NODE		0
+#define PUFFS_INVAL_NAMECACHE_DIR		1
+#define PUFFS_INVAL_NAMECACHE_ALL		2
+#define PUFFS_INVAL_PAGECACHE_NODE_RANGE	3
+#define PUFFS_FLUSH_PAGECACHE_NODE_RANGE	4
+
+/*
+ * Credentials for an operation.  Can be either struct uucred for
+ * ops called from a credential context or NOCRED/FSCRED for ops
+ * called from within the kernel.  It is up to the implementation
+ * if it makes a difference between these two and the super-user.
+ */
+struct puffs_kcred {
+	struct uucred	pkcr_uuc;
+	uint8_t		pkcr_type;
+	uint8_t		pkcr_internal;
+};
+#define PUFFCRED_TYPE_UUC	1
+#define PUFFCRED_TYPE_INTERNAL	2
+#define PUFFCRED_CRED_NOCRED	1
+#define PUFFCRED_CRED_FSCRED	2
+
+/*
+ * 2*MAXPHYS is the max size the system will attempt to copy,
+ * else treated as garbage
+ */
+#define PUFFS_MSG_MAXSIZE	2*MAXPHYS
+#define PUFFS_MSGSTRUCT_MAX	4096 /* approximate */
+
+#define PUFFS_EXTNAMELEN KERNEL_NAME_MAX /* currently same as EXTATTR_MAXNAMELEN */
+
+#define PUFFS_TOMOVE(a,b) (MIN((a), b->pmp_msg_maxsize - PUFFS_MSGSTRUCT_MAX))
+
+/* puffs struct componentname built by kernel */
+struct puffs_kcn {
+	/* args */
+	uint32_t		pkcn_nameiop;	/* namei operation	*/
+	uint32_t		pkcn_flags;	/* flags		*/
+
+	char pkcn_name[MAXPATHLEN];	/* nulterminated path component */
+	size_t pkcn_namelen;		/* current component length	*/
+	size_t pkcn_consume;		/* IN: extra chars server ate   */
+};
+
+
+/*
+ * Next come the individual requests.  They are all subclassed from
+ * puffs_req and contain request-specific fields in addition.  Note
+ * that there are some requests which have to handle arbitrary-length
+ * buffers.
+ *
+ * The division is the following: puffs_req is to be touched only
+ * by generic routines while the other stuff is supposed to be
+ * modified only by specific routines.
+ */
+
+/*
+ * aux structures for vfs operations.
+ */
+struct puffs_vfsmsg_unmount {
+	struct puffs_req	pvfsr_pr;
+
+	int			pvfsr_flags;
+};
+
+struct puffs_vfsmsg_statvfs {
+	struct puffs_req	pvfsr_pr;
+
+	struct statvfs		pvfsr_sb;
+};
+
+struct puffs_vfsmsg_sync {
+	struct puffs_req	pvfsr_pr;
+
+	struct puffs_kcred	pvfsr_cred;
+	int			pvfsr_waitfor;
+};
+
+struct puffs_vfsmsg_fhtonode {
+	struct puffs_req	pvfsr_pr;
+
+	void			*pvfsr_fhcookie;	/* IN	*/
+	enum vtype		pvfsr_vtype;		/* IN	*/
+	voff_t			pvfsr_size;		/* IN	*/
+	dev_t			pvfsr_rdev;		/* IN	*/
+
+	size_t			pvfsr_dsize;		/* OUT */
+	uint8_t			pvfsr_data[0]		/* OUT, XXX */
+				    __aligned(ALIGNBYTES+1);
+};
+
+struct puffs_vfsmsg_nodetofh {
+	struct puffs_req	pvfsr_pr;
+
+	void			*pvfsr_fhcookie;	/* OUT	*/
+
+	size_t			pvfsr_dsize;		/* OUT/IN  */
+	uint8_t			pvfsr_data[0]		/* IN, XXX */
+				    __aligned(ALIGNBYTES+1);
+};
+
+struct puffs_vfsmsg_suspend {
+	struct puffs_req	pvfsr_pr;
+
+	int			pvfsr_status;
+};
+#define PUFFS_SUSPEND_START	0
+#define PUFFS_SUSPEND_SUSPENDED	1
+#define PUFFS_SUSPEND_RESUME	2
+#define PUFFS_SUSPEND_ERROR	3
+
+#define PUFFS_EXTATTRCTL_HASNODE	0x01
+#define PUFFS_EXTATTRCTL_HASATTRNAME	0x02
+
+#define	PUFFS_OPEN_IO_DIRECT	0x01
+
+struct puffs_vfsmsg_extattrctl {
+	struct puffs_req	pvfsr_pr;
+
+	int			pvfsr_cmd;			  /* OUT */
+	int			pvfsr_attrnamespace;		  /* OUT */
+	int			pvfsr_flags;			  /* OUT */
+	char			pvfsr_attrname[PUFFS_EXTNAMELEN]; /* OUT */
+};
+
+/*
+ * aux structures for vnode operations.
+ */
+
+struct puffs_vnmsg_lookup {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcn	pvnr_cn;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_cred;		/* OUT	*/
+
+	puffs_cookie_t		pvnr_newnode;		/* IN	*/
+	enum vtype		pvnr_vtype;		/* IN	*/
+	voff_t			pvnr_size;		/* IN	*/
+	dev_t			pvnr_rdev;		/* IN	*/
+	/* Used only if PUFFS_KFLAG_CACHE_USE_TTL */
+	struct vattr		pvnr_va;		/* IN	*/
+	struct timespec		pvnr_va_ttl;		/* IN	*/
+	struct timespec		pvnr_cn_ttl;		/* IN	*/
+};
+
+struct puffs_vnmsg_create {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcn	pvnr_cn;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_cred;		/* OUT	*/
+
+	struct vattr		pvnr_va;		/* OUT	*/
+	puffs_cookie_t		pvnr_newnode;		/* IN	*/
+	/* Used only if PUFFS_KFLAG_CACHE_USE_TTL */
+	struct timespec		pvnr_va_ttl;		/* IN	*/
+	struct timespec		pvnr_cn_ttl;		/* IN	*/
+};
+
+struct puffs_vnmsg_mknod {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcn	pvnr_cn;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_cred;		/* OUT	*/
+
+	struct vattr		pvnr_va;		/* OUT	*/
+	puffs_cookie_t		pvnr_newnode;		/* IN	*/
+	/* Used only if PUFFS_KFLAG_CACHE_USE_TTL */
+	struct timespec		pvnr_va_ttl;		/* IN	*/
+	struct timespec		pvnr_cn_ttl;		/* IN	*/
+};
+
+struct puffs_vnmsg_open {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcred	pvnr_cred;		/* OUT	*/
+	int			pvnr_mode;		/* OUT	*/
+	int			pvnr_oflags;		/* IN	*/
+};
+
+struct puffs_vnmsg_close {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcred	pvnr_cred;		/* OUT	*/
+	int			pvnr_fflag;		/* OUT	*/
+};
+
+struct puffs_vnmsg_access {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcred	pvnr_cred;		/* OUT	*/
+	int			pvnr_mode;		/* OUT	*/
+};
+
+#define puffs_vnmsg_setattr puffs_vnmsg_setgetattr
+#define puffs_vnmsg_getattr puffs_vnmsg_setgetattr
+struct puffs_vnmsg_setgetattr {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcred	pvnr_cred;		/* OUT	*/
+	struct vattr		pvnr_va;		/* IN/OUT (op depend) */
+	/* Used only if PUFFS_KFLAG_CACHE_USE_TTL */
+	struct timespec		pvnr_va_ttl;		/* IN	*/
+};
+
+#define puffs_vnmsg_read puffs_vnmsg_rw
+#define puffs_vnmsg_write puffs_vnmsg_rw
+struct puffs_vnmsg_rw {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcred	pvnr_cred;		/* OUT	  */
+	off_t			pvnr_offset;		/* OUT	  */
+	size_t			pvnr_resid;		/* IN/OUT */
+	int			pvnr_ioflag;		/* OUT	  */
+
+	uint8_t			pvnr_data[0];		/* IN/OUT (wr/rd) */
+};
+
+#define puffs_vnmsg_ioctl puffs_vnreq_fcnioctl
+#define puffs_vnmsg_fcntl puffs_vnreq_fcnioctl
+struct puffs_vnmsg_fcnioctl {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcred	pvnr_cred;
+	u_long			pvnr_command;
+	pid_t			pvnr_pid;
+	int			pvnr_fflag;
+
+	void			*pvnr_data;
+	size_t			pvnr_datalen;
+	int			pvnr_copyback;
+};
+
+struct puffs_vnmsg_poll {
+	struct puffs_req	pvn_pr;
+
+	int			pvnr_events;		/* IN/OUT */
+};
+
+struct puffs_vnmsg_fsync {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcred	pvnr_cred;		/* OUT	*/
+	off_t			pvnr_offlo;		/* OUT	*/
+	off_t			pvnr_offhi;		/* OUT	*/
+	int			pvnr_flags;		/* OUT	*/
+};
+
+struct puffs_vnmsg_seek {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcred	pvnr_cred;		/* OUT	*/
+	off_t			pvnr_oldoff;		/* OUT	*/
+	off_t			pvnr_newoff;		/* OUT	*/
+};
+
+struct puffs_vnmsg_remove {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcn	pvnr_cn;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_cred;		/* OUT	*/
+
+	puffs_cookie_t		pvnr_cookie_targ;	/* OUT	*/
+};
+
+struct puffs_vnmsg_mkdir {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcn	pvnr_cn;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_cred;		/* OUT	*/
+
+	struct vattr		pvnr_va;		/* OUT	*/
+	puffs_cookie_t		pvnr_newnode;		/* IN	*/
+	/* Used only if PUFFS_KFLAG_CACHE_USE_TTL */
+	struct timespec		pvnr_va_ttl;		/* IN	*/
+	struct timespec		pvnr_cn_ttl;		/* IN	*/
+};
+
+struct puffs_vnmsg_rmdir {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcn	pvnr_cn;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_cred;		/* OUT	*/
+
+	puffs_cookie_t		pvnr_cookie_targ;	/* OUT	*/
+};
+
+struct puffs_vnmsg_link {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcn	pvnr_cn;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_cred;		/* OUT	*/
+
+	puffs_cookie_t		pvnr_cookie_targ;	/* OUT	*/
+};
+
+struct puffs_vnmsg_rename {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcn	pvnr_cn_src;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_src_cred;	/* OUT	*/
+	struct puffs_kcn	pvnr_cn_targ;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_targ_cred;	/* OUT	*/
+
+	puffs_cookie_t		pvnr_cookie_src;	/* OUT	*/
+	puffs_cookie_t		pvnr_cookie_targ;	/* OUT	*/
+	puffs_cookie_t		pvnr_cookie_targdir;	/* OUT	*/
+};
+
+struct puffs_vnmsg_symlink {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcn	pvnr_cn;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_cred;		/* OUT	*/
+
+	struct vattr		pvnr_va;		/* OUT	*/
+	puffs_cookie_t		pvnr_newnode;		/* IN	*/
+	char			pvnr_link[MAXPATHLEN];	/* OUT	*/
+	/* Used only if PUFFS_KFLAG_CACHE_USE_TTL */
+	struct timespec		pvnr_va_ttl;		/* IN	*/
+	struct timespec		pvnr_cn_ttl;		/* IN	*/
+};
+
+struct puffs_vnmsg_readdir {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcred	pvnr_cred;		/* OUT	  */
+	off_t			pvnr_offset;		/* IN/OUT */
+	size_t			pvnr_resid;		/* IN/OUT */
+	size_t			pvnr_ncookies;		/* IN/OUT */
+	int			pvnr_eofflag;		/* IN     */
+
+	size_t			pvnr_dentoff;		/* OUT    */
+	uint8_t			pvnr_data[0]		/* IN  	  */
+				    __aligned(ALIGNBYTES+1);
+};
+
+struct puffs_vnmsg_readlink {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcred	pvnr_cred;		/* OUT */
+	size_t			pvnr_linklen;		/* IN  */
+	char			pvnr_link[MAXPATHLEN];	/* IN  */
+};
+
+struct puffs_vnmsg_reclaim {
+	struct puffs_req	pvn_pr;
+
+	int			pvnr_nlookup;		/* OUT */
+};
+
+struct puffs_vnmsg_inactive {
+	struct puffs_req	pvn_pr;
+};
+
+struct puffs_vnmsg_print {
+	struct puffs_req	pvn_pr;
+
+	/* empty */
+};
+
+struct puffs_vnmsg_pathconf {
+	struct puffs_req	pvn_pr;
+
+	int			pvnr_name;		/* OUT	*/
+	register_t		pvnr_retval;		/* IN	*/
+};
+
+struct puffs_vnmsg_advlock {
+	struct puffs_req	pvn_pr;
+
+	struct flock		pvnr_fl;		/* OUT	*/
+	void			*pvnr_id;		/* OUT	*/
+	int			pvnr_op;		/* OUT	*/
+	int			pvnr_flags;		/* OUT	*/
+};
+
+struct puffs_vnmsg_mmap {
+	struct puffs_req	pvn_pr;
+
+	vm_prot_t		pvnr_prot;		/* OUT	*/
+	struct puffs_kcred	pvnr_cred;		/* OUT	*/
+};
+
+struct puffs_vnmsg_abortop {
+	struct puffs_req	pvn_pr;
+
+	struct puffs_kcn	pvnr_cn;		/* OUT	*/
+	struct puffs_kcred	pvnr_cn_cred;		/* OUT	*/
+};
+
+struct puffs_vnmsg_getextattr {
+	struct puffs_req	pvn_pr;
+
+	int			pvnr_attrnamespace;		/* OUT	  */
+	char			pvnr_attrname[PUFFS_EXTNAMELEN];/* OUT	  */
+
+	struct puffs_kcred	pvnr_cred;			/* OUT	  */
+	size_t			pvnr_datasize;			/* IN	  */
+
+	size_t			pvnr_resid;			/* IN/OUT */
+	uint8_t			pvnr_data[0]			/* IN	  */
+				    __aligned(ALIGNBYTES+1);
+};
+
+struct puffs_vnmsg_setextattr {
+	struct puffs_req	pvn_pr;
+
+	int			pvnr_attrnamespace;		/* OUT	  */
+	char			pvnr_attrname[PUFFS_EXTNAMELEN];/* OUT	  */
+
+	struct puffs_kcred	pvnr_cred;			/* OUT	*/
+
+	size_t			pvnr_resid;			/* IN/OUT */
+	uint8_t			pvnr_data[0]			/* OUT	  */
+				    __aligned(ALIGNBYTES+1);
+};
+
+struct puffs_vnmsg_listextattr {
+	struct puffs_req	pvn_pr;
+
+	int			pvnr_attrnamespace;		/* OUT	  */
+
+	struct puffs_kcred	pvnr_cred;			/* OUT	*/
+	size_t			pvnr_datasize;			/* IN	  */
+
+	size_t			pvnr_resid;			/* IN/OUT */
+	int			pvnr_flag;			/* OUT */
+	uint8_t			pvnr_data[0]			/* IN	  */
+				    __aligned(ALIGNBYTES+1);
+};
+
+struct puffs_vnmsg_deleteextattr {
+	struct puffs_req	pvn_pr;
+
+	int			pvnr_attrnamespace;		/* OUT	  */
+	char			pvnr_attrname[PUFFS_EXTNAMELEN];/* OUT	  */
+
+	struct puffs_kcred	pvnr_cred;			/* OUT	*/
+};
+
+#define PUFFS_HAVE_FALLOCATE 1
+struct puffs_vnmsg_fallocate {
+	struct puffs_req	pvn_pr;
+	off_t			pvnr_off;			/* OUT    */
+	off_t			pvnr_len;			/* OUT    */
+};
+
+struct puffs_vnmsg_fdiscard {
+	struct puffs_req	pvn_pr;
+	off_t			pvnr_off;			/* OUT    */
+	off_t			pvnr_len;			/* OUT    */
+};
+
+/*
+ * For cache reports.  Everything is always out-out-out, no replies
+ */
+
+struct puffs_cacherun {
+	off_t			pcache_runstart;
+	off_t			pcache_runend;
+};
+
+/* cache info.  old used for write now */
+struct puffs_cacheinfo {
+	struct puffs_req	pcache_pr;
+
+	int			pcache_type;
+	size_t			pcache_nruns;		
+	struct puffs_cacherun	pcache_runs[0];
+};
+#define PCACHE_TYPE_READ	0
+#define PCACHE_TYPE_WRITE	1
+
+/*
+ * Error notification.  Always outgoing, no response, no remorse.
+ */
+struct puffs_error {
+	struct puffs_req	perr_pr;
+
+	int			perr_error;
+	char			perr_str[256];
+};
+
+#endif /* _FS_PUFFS_PUFFS_MSGIF_H_ */

Property changes on: lab4/.minix-src/include/fs/puffs/puffs_msgif.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fs/v7fs/v7fs_args.h
===================================================================
--- lab4/.minix-src/include/fs/v7fs/v7fs_args.h	(nonexistent)
+++ lab4/.minix-src/include/fs/v7fs/v7fs_args.h	(revision 13)
@@ -0,0 +1,40 @@
+/*	$NetBSD: v7fs_args.h,v 1.1 2011/06/27 11:52:24 uch Exp $ */
+
+/*-
+ * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by UCHIYAMA Yasushi.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _FS_V7FS_V7FS_ARGS_H_
+#define	_FS_V7FS_V7FS_ARGS_H_
+
+struct v7fs_args {
+	char	*fspec;		/* blocks special holding the fs to mount */
+	int	endian;		/* target filesystem endian */
+};
+
+#endif /* _FS_V7FS_V7FS_ARGS_H_ */

Property changes on: lab4/.minix-src/include/fs/v7fs/v7fs_args.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/apmvar.h
===================================================================
--- lab4/.minix-src/include/i386/apmvar.h	(nonexistent)
+++ lab4/.minix-src/include/i386/apmvar.h	(revision 13)
@@ -0,0 +1,39 @@
+/*	$NetBSD: apmvar.h,v 1.26 2012/10/01 17:30:39 dsl Exp $	*/
+/*-
+ * Copyright (c) 1995 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by John Kohl.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __I386_APM_H__
+#define __I386_APM_H__
+
+#include <dev/apm/apmbios.h>
+
+#ifndef _LOCORE
+#include <dev/apm/apmio.h>
+#endif /* _LCORE */
+
+#endif /* __i386_apm_h__ */

Property changes on: lab4/.minix-src/include/i386/apmvar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/bswap.h
===================================================================
--- lab4/.minix-src/include/i386/bswap.h	(nonexistent)
+++ lab4/.minix-src/include/i386/bswap.h	(revision 13)
@@ -0,0 +1,13 @@
+/*      $NetBSD: bswap.h,v 1.4 2008/10/26 06:57:30 mrg Exp $      */
+
+/* Written by Manuel Bouyer. Public domain */
+
+#ifndef _I386_BSWAP_H_
+#define	_I386_BSWAP_H_
+
+#include <machine/byte_swap.h>
+
+#define __BSWAP_RENAME
+#include <sys/bswap.h>
+
+#endif /* !_I386_BSWAP_H_ */

Property changes on: lab4/.minix-src/include/i386/bswap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/cpu.h
===================================================================
--- lab4/.minix-src/include/i386/cpu.h	(nonexistent)
+++ lab4/.minix-src/include/i386/cpu.h	(revision 13)
@@ -0,0 +1,102 @@
+/*	$NetBSD: cpu.h,v 1.178 2011/12/30 17:57:49 cherry Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)cpu.h	5.4 (Berkeley) 5/9/91
+ */
+
+#ifndef _I386_CPU_H_
+#define _I386_CPU_H_
+
+#include <x86/cpu.h>
+
+#ifdef _KERNEL
+
+#if defined(__GNUC__) && !defined(_MODULE)
+static struct cpu_info *x86_curcpu(void);
+static lwp_t *x86_curlwp(void);
+
+__inline static struct cpu_info * __unused
+x86_curcpu(void)
+{
+	struct cpu_info *ci;
+
+	__asm volatile("movl %%fs:%1, %0" :
+	    "=r" (ci) :
+	    "m"
+	    (*(struct cpu_info * const *)offsetof(struct cpu_info, ci_self)));
+	return ci;
+}
+
+__inline static lwp_t * __attribute__ ((const))
+x86_curlwp(void)
+{
+	lwp_t *l;
+
+	__asm volatile("movl %%fs:%1, %0" :
+	    "=r" (l) :
+	    "m"
+	    (*(struct cpu_info * const *)offsetof(struct cpu_info, ci_curlwp)));
+	return l;
+}
+
+__inline static void __unused
+cpu_set_curpri(int pri)
+{
+
+	__asm volatile(
+	    "movl %1, %%fs:%0" :
+	    "=m" (*(struct cpu_info *)offsetof(struct cpu_info, ci_schedstate.spc_curpriority)) :
+	    "r" (pri)
+	);
+}
+#endif
+
+#define	CLKF_USERMODE(frame)	USERMODE((frame)->cf_if.if_cs, (frame)->cf_if.if_eflags)
+#define	CLKF_PC(frame)		((frame)->cf_if.if_eip)
+#define	CLKF_INTR(frame)	(curcpu()->ci_idepth > 0)
+#define	LWP_PC(l)		((l)->l_md.md_regs->tf_eip)
+
+#ifdef PAE
+void cpu_alloc_l3_page(struct cpu_info *);
+#endif /* PAE */
+
+#endif	/* _KERNEL */
+
+#if defined(__minix)
+#include <x86/psl.h>
+/* User flags are S (Status) and C (Control) flags. */
+#define X86_FLAGS_USER (PSL_C | PSL_PF | PSL_AF | PSL_Z | \
+	PSL_N | PSL_D | PSL_V)
+#endif /* defined(__minix) */
+
+#endif /* !_I386_CPU_H_ */

Property changes on: lab4/.minix-src/include/i386/cpu.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/elf.h
===================================================================
--- lab4/.minix-src/include/i386/elf.h	(nonexistent)
+++ lab4/.minix-src/include/i386/elf.h	(revision 13)
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 1996-1997 John D. Polstra.
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_ELF_H_
+#define	_MACHINE_ELF_H_ 1
+
+/*
+ * ELF definitions for the i386 architecture.
+ */
+
+/* Define "machine" characteristics */
+#define	ELF_TARG_CLASS	ELFCLASS32
+#define	ELF_TARG_DATA	ELFDATA2LSB
+#define	ELF_TARG_MACH	EM_386
+#define	ELF_TARG_VER	1
+
+#endif /* !_MACHINE_ELF_H_ */

Property changes on: lab4/.minix-src/include/i386/elf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/ansi.h
===================================================================
--- lab4/.minix-src/include/i386/ansi.h	(nonexistent)
+++ lab4/.minix-src/include/i386/ansi.h	(revision 13)
@@ -0,0 +1,71 @@
+/*	$NetBSD: ansi.h,v 1.27 2015/06/17 14:32:31 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ansi.h	8.2 (Berkeley) 1/4/94
+ */
+
+#ifndef	_I386_ANSI_H_
+#define	_I386_ANSI_H_
+
+#include <sys/cdefs.h>
+
+#include <machine/int_types.h>
+
+/*
+ * Types which are fundamental to the implementation and may appear in
+ * more than one standard header are defined here.  Standard headers
+ * then use:
+ *	#ifdef	_BSD_SIZE_T_
+ *	typedef	_BSD_SIZE_T_ size_t;
+ *	#undef	_BSD_SIZE_T_
+ *	#endif
+ */
+#define	_BSD_CLOCK_T_		unsigned int	/* clock() */
+#define	_BSD_PTRDIFF_T_		int		/* ptr1 - ptr2 */
+#define	_BSD_SIZE_T_		unsigned int	/* sizeof() */
+#define	_BSD_SSIZE_T_		int		/* byte count or error */
+#define	_BSD_TIME_T_		__int64_t	/* time() */
+#define	_BSD_CLOCKID_T_		int		/* clockid_t */
+#define	_BSD_TIMER_T_		int		/* timer_t */
+#define	_BSD_SUSECONDS_T_	int		/* suseconds_t */
+#define	_BSD_USECONDS_T_	unsigned int	/* useconds_t */
+
+#if defined(__WCHAR_TYPE__)
+#define	_BSD_WCHAR_T_		__WCHAR_TYPE__	/* wchar_t */
+#else
+#define	_BSD_WCHAR_T_		int		/* wchar_t */
+#endif
+#if defined(__WINT_TYPE__)
+#define	_BSD_WINT_T_		__WINT_TYPE__	/* wint_t */
+#else
+#define	_BSD_WINT_T_		int		/* wint_t */
+#endif
+
+#endif	/* _I386_ANSI_H_ */

Property changes on: lab4/.minix-src/include/i386/ansi.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/archtypes.h
===================================================================
--- lab4/.minix-src/include/i386/archtypes.h	(nonexistent)
+++ lab4/.minix-src/include/i386/archtypes.h	(revision 13)
@@ -0,0 +1,51 @@
+
+#ifndef _I386_TYPES_H
+#define _I386_TYPES_H
+
+#include <minix/sys_config.h>
+#include <machine/stackframe.h>
+#include <machine/fpu.h>
+#include <sys/cdefs.h>
+
+struct segdesc_s {		/* segment descriptor for protected mode */
+  u16_t limit_low;
+  u16_t base_low;
+  u8_t base_middle;
+  u8_t access;		/* |P|DL|1|X|E|R|A| */
+  u8_t granularity;	/* |G|X|0|A|LIMT| */
+  u8_t base_high;
+} __attribute__((packed));
+
+struct gatedesc_s {
+  u16_t offset_low;
+  u16_t selector;
+  u8_t pad;                     /* |000|XXXXX| ig & trpg, |XXXXXXXX| task g */
+  u8_t p_dpl_type;              /* |P|DL|0|TYPE| */
+  u16_t offset_high;
+} __attribute__((packed));
+
+struct desctableptr_s {
+  u16_t limit;
+  u32_t base;
+} __attribute__((packed));
+
+typedef struct segframe {
+	reg_t	p_cr3;		/* page table root */
+	u32_t	*p_cr3_v;
+	char	*fpu_state;
+	int	p_kern_trap_style;
+} segframe_t;
+
+struct cpu_info {
+	u8_t	vendor;
+	u8_t	family;
+	u8_t	model;
+	u8_t	stepping;
+	u32_t	freq;		/* in MHz */
+	u32_t	flags[2];
+};
+
+typedef u32_t atomic_t;	/* access to an aligned 32bit value is atomic on i386 */
+
+#endif /* #ifndef _I386_TYPES_H */
+

Property changes on: lab4/.minix-src/include/i386/archtypes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/bios.h
===================================================================
--- lab4/.minix-src/include/i386/bios.h	(nonexistent)
+++ lab4/.minix-src/include/i386/bios.h	(revision 13)
@@ -0,0 +1,125 @@
+/* Definitions of several known BIOS addresses. The addresses listed here 
+ * are found in three memory areas that have been defined in <ibm/memory.h>.
+ *  - the BIOS interrupt vectors
+ *  - the BIOS data area
+ *  - the motherboard BIOS memory
+ * 
+ * Created: March 2005, Jorrit N. Herder	
+ */
+
+#ifndef _BIOS_H
+#define _BIOS_H
+
+/* PART I --
+ * The BIOS interrupt vector table (IVT) area (1024 B as of address 0x0000). 
+ * Although this area holds 256 interrupt vectors (with jump addresses), some 
+ * vectors actually contain important BIOS data. Some addresses are below. 
+ */
+#define BIOS_EQUIP_CHECK_ADDR      0x0044 
+#define BIOS_EQUIP_CHECK_SIZE      4L
+
+#define BIOS_VIDEO_PARAMS_ADDR     0x0074        
+#define BIOS_VIDEO_PARAMS_SIZE     4L
+
+#define BIOS_FLOP_PARAMS_ADDR      0x0078     
+#define BIOS_FLOP_PARAMS_SIZE      4L
+ 
+#define BIOS_HD0_PARAMS_ADDR       0x0104 /* disk 0 parameters */
+#define BIOS_HD0_PARAMS_SIZE       4L
+
+#define BIOS_HD1_PARAMS_ADDR       0x0118 /* disk 1 parameters */
+#define BIOS_HD1_PARAMS_SIZE       4L
+
+/* PART I -- 
+ * Addresses in the BIOS data area (256 B as of address 0x0400). The addresses 
+ * listed below are the most important ones, and the ones that are currently 
+ * used. Other addresses may be defined below when new features are added. 
+ */
+
+/* Serial ports (COM1-COM4). */
+#define COM1_IO_PORT_ADDR       0x400   /* COM1 port address */
+#define COM1_IO_PORT_SIZE       2L    
+#define COM2_IO_PORT_ADDR       0x402   /* COM2 port address */
+#define COM2_IO_PORT_SIZE       2L    
+#define COM3_IO_PORT_ADDR       0x404   /* COM3 port address */
+#define COM3_IO_PORT_SIZE       2L    
+#define COM4_IO_PORT_ADDR       0x406   /* COM4 port address */
+#define COM4_IO_PORT_SIZE       2L    
+        
+/* Parallel ports (LPT1-LPT4). */
+#define LPT1_IO_PORT_ADDR       0x408   /* LPT1 port address */
+#define LPT1_IO_PORT_SIZE       2L    
+#define LPT2_IO_PORT_ADDR       0x40A   /* LPT2 port address */
+#define LPT2_IO_PORT_SIZE       2L    
+#define LPT3_IO_PORT_ADDR       0x40C   /* LPT3 port address */
+#define LPT3_IO_PORT_SIZE       2L    
+#define LPT4_IO_PORT_ADDR       0x40E   /* LPT4 port (except on PS/2) */
+#define LPT4_IO_PORT_SIZE       2L    
+        
+/* Video controller (VDU). */
+#define VDU_SCREEN_COLS_ADDR    0x44A   /* VDU nr of screen columns */
+#define VDU_SCREEN_COLS_SIZE    2L  
+
+/* Base I/O port address for active 6845 CRT controller. */
+#define VDU_CRT_BASE_ADDR       0x463   /* 3B4h = mono, 3D4h = color */
+#define VDU_CRT_BASE_SIZE       2L
+
+/* Soft reset flags to control shutdown. */
+#define SOFT_RESET_FLAG_ADDR    0x472   /* soft reset flag on Ctl-Alt-Del */
+#define SOFT_RESET_FLAG_SIZE    2L  
+#define   STOP_MEM_CHECK        0x1234  /* bypass memory tests & CRT init */
+#define   PRESERVE_MEMORY       0x4321  /* preserve memory */
+#define   SYSTEM_SUSPEND        0x5678  /* system suspend */
+#define   MANUFACTURER_TEST     0x9ABC  /* manufacturer test */
+#define   CONVERTIBLE_POST      0xABCD  /* convertible POST loop */
+                            /* ... many other values are used during POST */
+
+/* Hard disk parameters. (Also see BIOS interrupt vector table above.) */
+#define NR_HD_DRIVES_ADDR       0x475  /* number of hard disk drives */ 
+#define NR_HD_DRIVES_SIZE       1L
+
+/* Parallel ports (LPT1-LPT4) timeout values. */
+#define LPT1_TIMEOUT_ADDR       0x478   /* time-out value for LPT1 */
+#define LPT1_TIMEOUT_SIZE       1L  
+#define LPT2_TIMEOUT_ADDR       0x479   /* time-out value for LPT2 */
+#define LPT2_TIMEOUT_SIZE       1L  
+#define LPT3_TIMEOUT_ADDR       0x47A   /* time-out value for LPT3 */
+#define LPT3_TIMEOUT_SIZE       1L  
+#define LPT4_TIMEOUT_ADDR       0x47B   /* time-out for LPT4 (except PS/2) */
+#define LPT4_TIMEOUT_SIZE       1L  
+
+/* Serial ports (COM1-COM4) timeout values. */
+#define COM1_TIMEOUT_ADDR       0x47C   /* time-out value for COM1 */
+#define COM1_TIMEOUT_SIZE       1L  
+#define COM2_TIMEOUT_ADDR       0x47D   /* time-out value for COM2 */
+#define COM2_TIMEOUT_SIZE       1L  
+#define COM3_TIMEOUT_ADDR       0x47E   /* time-out value for COM3 */
+#define COM3_TIMEOUT_SIZE       1L  
+#define COM4_TIMEOUT_ADDR       0x47F   /* time-out value for COM4 */
+#define COM4_TIMEOUT_SIZE       1L  
+
+/* Video controller (VDU). */
+#define VDU_SCREEN_ROWS_ADDR    0x484   /* screen rows (less 1, EGA+)*/
+#define VDU_SCREEN_ROWS_SIZE    1L  
+#define VDU_FONTLINES_ADDR      0x485   /* point height of char matrix */
+#define VDU_FONTLINES_SIZE      2L 
+
+/* Video controller (VDU). */
+#define VDU_VIDEO_MODE_ADDR     0x49A   /* current video mode */
+#define VDU_VIDEO_MODE_SIZE     1L  
+
+/* PART III --
+ * The motherboard BIOS memory contains some known values that are currently 
+ * in use. Other sections in the upper memory area (UMA) addresses vary in 
+ * size and locus and are not further defined here. A rough map is given in 
+ * <ibm/memory.h>. 
+ */
+
+/* Machine ID (we're interested in PS/2 and AT models). */
+#define MACHINE_ID_ADDR         0xFFFFE /* BIOS machine ID byte */
+#define MACHINE_ID_SIZE         1L
+#define   PS_386_MACHINE        0xF8    /* ID byte for PS/2 modela 70/80 */
+#define   PC_AT_MACHINE         0xFC    /* PC/AT, PC/XT286, PS/2 models 50/60 */
+
+#endif /* _BIOS_H */
+

Property changes on: lab4/.minix-src/include/i386/bios.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/fpu.h
===================================================================
--- lab4/.minix-src/include/i386/fpu.h	(nonexistent)
+++ lab4/.minix-src/include/i386/fpu.h	(revision 13)
@@ -0,0 +1,50 @@
+#ifndef FPU_H
+#define FPU_H
+
+/* x87 FPU state, MMX Technolodgy.
+ * 108 bytes.*/
+struct fpu_regs_s {
+	u16_t fp_control;     /* control */
+	u16_t fp_unused_1;
+	u16_t fp_status;      /* status */
+	u16_t fp_unused_2;
+	u16_t fp_tag;         /* register tags */
+	u16_t fp_unused_3;
+	u32_t fp_eip;         /* eip at failed instruction */
+	u16_t fp_cs;          /* cs at failed instruction */
+	u16_t fp_opcode;      /* opcode of failed instruction */
+	u32_t fp_dp;          /* data address */
+	u16_t fp_ds;          /* data segment */
+	u16_t fp_unused_4;
+	u16_t fp_st_regs[8][5]; /* 8 80-bit FP registers */
+};
+
+/* x87 FPU, MMX Technolodgy and SSE state.
+ * 512 bytes (if you need size use FPU_XFP_SIZE). */
+struct xfp_save {
+	u16_t fp_control;       /* control */
+	u16_t fp_status;        /* status */
+	u16_t fp_tag;           /* register tags */
+	u16_t fp_opcode;        /* opcode of failed instruction */
+	u32_t fp_eip;           /* eip at failed instruction */
+	u16_t fp_cs;            /* cs at failed instruction */
+	u16_t fp_unused_1;
+	u32_t fp_dp;            /* data address */
+	u16_t fp_ds;            /* data segment */
+	u16_t fp_unused_2;
+	u32_t fp_mxcsr;         /* MXCSR */
+	u32_t fp_mxcsr_mask;    /* MXCSR_MASK */
+	u16_t fp_st_regs[8][8];   /* 128 bytes for ST/MM regs */
+	u32_t fp_xreg_word[32]; /* space for 8 128-bit XMM registers */
+	u32_t fp_padding[56];
+};
+
+/* Size of xfp_save structure. */
+#define FPU_XFP_SIZE		512
+
+union fpu_state_u {
+	struct fpu_regs_s fpu_regs;
+	struct xfp_save xfp_regs;
+};
+
+#endif /* #ifndef FPU_H */

Property changes on: lab4/.minix-src/include/i386/fpu.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/ibcs2_machdep.h
===================================================================
--- lab4/.minix-src/include/i386/ibcs2_machdep.h	(nonexistent)
+++ lab4/.minix-src/include/i386/ibcs2_machdep.h	(revision 13)
@@ -0,0 +1,50 @@
+/*	$NetBSD: ibcs2_machdep.h,v 1.17 2009/12/10 14:13:50 matt Exp $	*/
+
+/*-
+ * Copyright (c) 1997, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_IBCS2_MACHDEP_H_
+#define _I386_IBCS2_MACHDEP_H_
+
+#define COFF_MAGIC_I386	0x14c
+#define	COFF_BADMAG(ex)	(ex->f_magic != COFF_MAGIC_I386)
+#define	COFF_LDPGSZ	4096
+
+#ifdef _KERNEL
+struct exec_package;
+struct exec_vmcmd;
+
+void	ibcs2_setregs(struct lwp *, struct exec_package *, vaddr_t);
+struct	ibcs2_sys_sysmachine_args;
+int	ibcs2_sys_sysmachine(struct lwp *, const struct ibcs2_sys_sysmachine_args *, register_t *retval);
+
+void	ibcs2_syscall_intern(struct proc *);
+#endif /* _KERNEL */
+
+#endif /* !_I386_IBCS2_MACHDEP_H_ */

Property changes on: lab4/.minix-src/include/i386/ibcs2_machdep.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/fenv.h
===================================================================
--- lab4/.minix-src/include/i386/fenv.h	(nonexistent)
+++ lab4/.minix-src/include/i386/fenv.h	(revision 13)
@@ -0,0 +1,129 @@
+/*	$NetBSD: fenv.h,v 1.2 2014/02/12 23:04:43 dsl Exp $	*/
+/*-
+ * Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef	_X86_FENV_H_
+#define	_X86_FENV_H_
+
+#ifndef _KERNEL
+#include <sys/stdint.h>
+#endif
+
+/* Default x87 control word. */
+#define __INITIAL_NPXCW__       0x037f  
+/* Modern NetBSD uses the default control word.. */
+#define __NetBSD_NPXCW__        __INITIAL_NPXCW__
+/* NetBSD before 6.99.26 forced IEEE double precision. */
+#define __NetBSD_COMPAT_NPXCW__ 0x127f
+
+/* Default values for the mxcsr. All traps masked. */
+#define __INITIAL_MXCSR__       0x1f80
+
+#ifndef _KERNEL
+/*
+ * Each symbol representing a floating point exception expands to an integer
+ * constant expression with values, such that bitwise-inclusive ORs of _all
+ * combinations_ of the constants result in distinct values.
+ *
+ * We use such values that allow direct bitwise operations on FPU/SSE registers.
+ */
+#define	FE_INVALID	0x01	/* 000000000001 */
+#define	FE_DENORMAL	0x02	/* 000000000010 */
+#define	FE_DIVBYZERO	0x04	/* 000000000100 */
+#define	FE_OVERFLOW	0x08	/* 000000001000 */
+#define	FE_UNDERFLOW	0x10	/* 000000010000 */
+#define	FE_INEXACT	0x20	/* 000000100000 */
+
+/*
+ * The following symbol is simply the bitwise-inclusive OR of all floating-point
+ * exception constants defined above.
+ */
+#define FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \
+			 FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+
+/*
+ * Each symbol representing the rounding direction, expands to an integer
+ * constant expression whose value is distinct non-negative value.
+ *
+ * We use such values that allow direct bitwise operations on FPU/SSE registers.
+ */
+#define	FE_TONEAREST	0x000	/* 000000000000 */
+#define	FE_DOWNWARD	0x400	/* 010000000000 */
+#define	FE_UPWARD	0x800	/* 100000000000 */
+#define	FE_TOWARDZERO	0xC00	/* 110000000000 */
+
+/*
+ * As compared to the x87 control word, the SSE unit's control has the rounding
+ * control bits offset by 3 and the exception mask bits offset by 7
+ */
+#define	__X87_ROUND_MASK	0xC00		/* 110000000000 */
+#define	__SSE_ROUND_SHIFT	3
+#define	__SSE_EMASK_SHIFT	7
+
+/*
+ * fenv_t represents the entire floating-point environment
+ */
+typedef struct {
+	struct {
+		uint16_t control;	/* Control word register */
+		uint16_t unused1;
+		uint16_t status;	/* Status word register */
+		uint16_t unused2;
+		uint16_t tag;		/* Tag word register */
+		uint16_t unused3;
+		uint32_t others[4];	/* EIP, Pointer Selector, etc */
+	} x87;
+		
+	uint32_t mxcsr;			/* Control and status register */
+} fenv_t;
+
+/*
+ * The following constant represents the default floating-point environment
+ * (that is, the one installed at program startup) and has type pointer to
+ * const-qualified fenv_t.
+ *
+ * It can be used as an argument to the functions within the <fenv.h> header
+ * that manage the floating-point environment.
+ */
+extern  fenv_t		__fe_dfl_env;
+#define FE_DFL_ENV      ((const fenv_t *) &__fe_dfl_env)
+
+/*
+ * fexcept_t represents the floating-point status flags collectively, including
+ * any status the implementation associates with the flags.
+ *
+ * A floating-point status flag is a system variable whose value is set (but
+ * never cleared) when a floating-point exception is raised, which occurs as a
+ * side effect of exceptional floating-point arithmetic to provide auxiliary
+ * information.
+ *
+ * A floating-point control mode is a system variable whose value may be set by
+ * the user to affect the subsequent behavior of floating-point arithmetic.
+ */
+typedef uint32_t fexcept_t;
+#endif
+
+#endif	/* ! _X86_FENV_H_ */

Property changes on: lab4/.minix-src/include/i386/fenv.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/byte_swap.h
===================================================================
--- lab4/.minix-src/include/i386/byte_swap.h	(nonexistent)
+++ lab4/.minix-src/include/i386/byte_swap.h	(revision 13)
@@ -0,0 +1,68 @@
+/*	$NetBSD: byte_swap.h,v 1.15 2008/04/28 20:23:24 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_BYTE_SWAP_H_
+#define	_I386_BYTE_SWAP_H_
+
+#include <sys/types.h>
+
+#ifdef  __GNUC__
+__BEGIN_DECLS
+
+#define	__BYTE_SWAP_U32_VARIABLE __byte_swap_u32_variable
+static __inline uint32_t __byte_swap_u32_variable(uint32_t);
+static __inline uint32_t
+__byte_swap_u32_variable(uint32_t x)
+{
+	__asm volatile (
+	    "bswap %1"
+	    : "=r" (x) : "0" (x));
+	return (x);
+}
+
+#define	__BYTE_SWAP_U16_VARIABLE __byte_swap_u16_variable
+static __inline uint16_t __byte_swap_u16_variable(uint16_t);
+static __inline uint16_t
+__byte_swap_u16_variable(uint16_t x)
+{
+	__asm volatile ("rorw $8, %w1" : "=r" (x) : "0" (x)); 
+	return (x);
+}
+
+__END_DECLS
+#elif defined(_KERNEL) || defined(_LKM)
+#define	__BYTE_SWAP_U32_VARIABLE __byte_swap_u32_variable
+#define	__BYTE_SWAP_U16_VARIABLE __byte_swap_u16_variable
+uint32_t	__byte_swap_u32_variable(uint32_t);
+uint16_t	__byte_swap_u16_variable(uint16_t);
+#endif
+
+#endif /* !_I386_BYTE_SWAP_H_ */

Property changes on: lab4/.minix-src/include/i386/byte_swap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/bootinfo.h
===================================================================
--- lab4/.minix-src/include/i386/bootinfo.h	(nonexistent)
+++ lab4/.minix-src/include/i386/bootinfo.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: bootinfo.h,v 1.14 2003/02/26 21:28:59 fvdl Exp $	*/
+
+#include <x86/bootinfo.h>

Property changes on: lab4/.minix-src/include/i386/bootinfo.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/int_const.h
===================================================================
--- lab4/.minix-src/include/i386/int_const.h	(nonexistent)
+++ lab4/.minix-src/include/i386/int_const.h	(revision 13)
@@ -0,0 +1,62 @@
+/*	$NetBSD: int_const.h,v 1.4 2014/07/25 21:43:13 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_INT_CONST_H_
+#define _I386_INT_CONST_H_
+
+#ifdef __INTMAX_C_SUFFIX__
+#include <sys/common_int_const.h>
+#else
+
+/*
+ * 7.18.4 Macros for integer constants
+ */
+
+/* 7.18.4.1 Macros for minimum-width integer constants */
+
+#define	INT8_C(c)	c
+#define	INT16_C(c)	c
+#define	INT32_C(c)	c
+#define	INT64_C(c)	c ## LL
+
+#define	UINT8_C(c)	c
+#define	UINT16_C(c)	c
+#define	UINT32_C(c)	c ## U
+#define	UINT64_C(c)	c ## ULL
+
+/* 7.18.4.2 Macros for greatest-width integer constants */
+
+#define	INTMAX_C(c)	c ## LL
+#define	UINTMAX_C(c)	c ## ULL
+
+#endif
+
+#endif /* !_I386_INT_CONST_H_ */

Property changes on: lab4/.minix-src/include/i386/int_const.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/cputypes.h
===================================================================
--- lab4/.minix-src/include/i386/cputypes.h	(nonexistent)
+++ lab4/.minix-src/include/i386/cputypes.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: cputypes.h,v 1.15 2007/01/01 20:56:59 ad Exp $	*/
+
+#include <x86/cputypes.h>

Property changes on: lab4/.minix-src/include/i386/cputypes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/int_types.h
===================================================================
--- lab4/.minix-src/include/i386/int_types.h	(nonexistent)
+++ lab4/.minix-src/include/i386/int_types.h	(revision 13)
@@ -0,0 +1,76 @@
+/*	$NetBSD: int_types.h,v 1.11 2014/07/25 21:43:13 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	from: @(#)types.h	7.5 (Berkeley) 3/9/91
+ */
+
+#ifndef	_I386_INT_TYPES_H_
+#define	_I386_INT_TYPES_H_
+
+#ifdef __UINTPTR_TYPE__
+#include <sys/common_int_types.h>
+#else
+
+#include <sys/cdefs.h>
+
+/*
+ * 7.18.1 Integer types
+ */
+
+/* 7.18.1.1 Exact-width integer types */
+
+typedef	signed char		 __int8_t;
+typedef	unsigned char		__uint8_t;
+typedef	short int		__int16_t;
+typedef	unsigned short int     __uint16_t;
+typedef	int			__int32_t;
+typedef	unsigned int	       __uint32_t;
+#ifdef __COMPILER_INT64__
+typedef	__COMPILER_INT64__	__int64_t;
+typedef	__COMPILER_UINT64__    __uint64_t;
+#else
+/* LONGLONG */
+typedef	long long int		__int64_t;
+/* LONGLONG */
+typedef	unsigned long long int __uint64_t;
+#endif
+
+#if !defined(__minix)
+#define	__BIT_TYPES_DEFINED__
+#endif /* !defined(__minix) */
+
+/* 7.18.1.4 Integer types capable of holding object pointers */
+
+typedef	int		       __intptr_t;
+typedef	unsigned int	      __uintptr_t;
+
+#endif
+
+#endif	/* !_I386_INT_TYPES_H_ */

Property changes on: lab4/.minix-src/include/i386/int_types.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/elf_machdep.h
===================================================================
--- lab4/.minix-src/include/i386/elf_machdep.h	(nonexistent)
+++ lab4/.minix-src/include/i386/elf_machdep.h	(revision 13)
@@ -0,0 +1,63 @@
+/*	$NetBSD: elf_machdep.h,v 1.10 2009/05/30 05:56:52 skrll Exp $	*/
+
+#define	ELF32_MACHDEP_ENDIANNESS	ELFDATA2LSB
+#define	ELF32_MACHDEP_ID_CASES						\
+		case EM_386:						\
+		case EM_486:						\
+			break;
+
+#define	ELF64_MACHDEP_ENDIANNESS	XXX	/* break compilation */
+#define	ELF64_MACHDEP_ID_CASES						\
+		/* no 64-bit ELF machine types supported */
+
+#define	ELF32_MACHDEP_ID		EM_386
+
+#define ARCH_ELFSIZE		32	/* MD native binary size */
+
+/* i386 relocations */
+#define	R_386_NONE	0
+#define	R_386_32	1
+#define	R_386_PC32	2
+#define	R_386_GOT32	3
+#define	R_386_PLT32	4
+#define	R_386_COPY	5
+#define	R_386_GLOB_DAT	6
+#define	R_386_JMP_SLOT	7
+#define	R_386_RELATIVE	8
+#define	R_386_GOTOFF	9
+#define	R_386_GOTPC	10
+
+/* TLS relocations */
+#define	R_386_TLS_TPOFF	14
+#define	R_386_TLS_IE	15
+#define	R_386_TLS_GOTIE	16
+#define	R_386_TLS_LE	17
+#define	R_386_TLS_GD	18
+#define	R_386_TLS_LDM	19
+
+/* The following relocations are GNU extensions. */
+#define	R_386_16	20
+#define	R_386_PC16	21
+#define	R_386_8		22
+#define	R_386_PC8	23
+
+/* More TLS relocations */
+#define	R_386_TLS_GD_32		24
+#define	R_386_TLS_GD_PUSH	25
+#define	R_386_TLS_GD_CALL	26
+#define	R_386_TLS_GD_POP	27
+#define	R_386_TLS_LDM_32	28
+#define	R_386_TLS_LDM_PUSH	29
+#define	R_386_TLS_LDM_CALL	30
+#define	R_386_TLS_LDM_POP	31
+#define	R_386_TLS_LDO_32	32
+#define	R_386_TLS_IE_32		33
+#define	R_386_TLS_LE_32		34
+#define	R_386_TLS_DTPMOD32	35
+#define	R_386_TLS_DTPOFF32	36
+#define	R_386_TLS_TPOFF32	37
+#define	R_386_TLS_GOTDESC	39
+#define	R_386_TLS_DESC_CALL	40
+#define	R_386_TLS_DESC		41
+
+#define	R_TYPE(name)	__CONCAT(R_386_,name)

Property changes on: lab4/.minix-src/include/i386/elf_machdep.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/ipcconst.h
===================================================================
--- lab4/.minix-src/include/i386/ipcconst.h	(nonexistent)
+++ lab4/.minix-src/include/i386/ipcconst.h	(revision 13)
@@ -0,0 +1,12 @@
+#ifndef _I386_IPCCONST_H_
+#define _I386_IPCCONST_H_
+
+#define KERVEC_INTR 32     /* syscall trap to kernel */
+#define IPCVEC_INTR 33     /* ipc trap to kernel  */
+
+#define KERVEC_UM 34     /* syscall trap to kernel, user-mapped code */
+#define IPCVEC_UM 35     /* ipc trap to kernel, user-mapped code  */
+
+#define IPC_STATUS_REG		bx
+
+#endif  /* _I386_IPCCONST_H_ */

Property changes on: lab4/.minix-src/include/i386/ipcconst.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/cmos.h
===================================================================
--- lab4/.minix-src/include/i386/cmos.h	(nonexistent)
+++ lab4/.minix-src/include/i386/cmos.h	(revision 13)
@@ -0,0 +1,85 @@
+/*
+ibm/cmos.h
+
+Created:	Dec 1998 by Philip Homburg <philip@cs.vu.nl>
+
+Definitions for the CMOS/realtime clock. Based on the datasheet for the
+Dallas DS12887, compatible with the Motorola MC146818
+*/
+
+#define RTC_INDEX	0x70	/* Bit 7 = NMI enable (1) / disable (0)
+				 * bits 0..6 index
+				 */
+#define RTC_IO		0x71	/* Data register, 
+				 * Note: the operation following a write to
+				 * RTC_INDEX should an access (read or write)
+				 * to RTC_IO
+				 */
+
+#define RTC_SEC		0x0	/* Seconds register */
+#define RTC_SEC_ALRM	0x1	/* Seconds register for alarm */
+#define RTC_MIN		0x2	/* Minutes register */
+#define RTC_MIN_ALRM	0x3	/* Minutes register for alarm */
+#define RTC_HOUR	0x4	/* Hours register */
+#define RTC_HOUR_ALRM	0x5	/* Hours register for alarm */
+#define RTC_WDAY	0x6	/* Day of the week, 1..7, Sunday = 1 */
+#define RTC_MDAY	0x7	/* Day of the month, 1..31 */
+#define RTC_MONTH	0x8	/* Month, 1..12 */
+#define RTC_YEAR	0x9	/* Year, 0..99 */
+#define RTC_REG_A	0xA
+#define		RTC_A_UIP	0x80	/* Update in progress. When clear,
+					 * no update will occur for 244
+					 * micro seconds.
+					 */
+#define		RTC_A_DV	0x70	/* Divider bits, valid values are: */
+#define		    RTC_A_DV_OK	    0x20	/* Normal */
+#define		    RTC_A_DV_STOP   0x70	/* Stop, a re-start starts
+						 * halfway through a cycle,
+						 * i.e. the update occurs after
+						 * 500ms.
+						 */
+#define		RTC_A_RS	0x0F	/* Int. freq */
+				    /*  0	None 
+				     *  1	 256 Hz
+				     *  2	 128 Hz
+				     *  3	8192 Hz
+				     *  4	4096 Hz
+				     *  5	2048 Hz
+				     *  6	1024 Hz
+				     *  7	 512 Hz
+				     *  8	 256 Hz
+				     *  9	 128 Hz
+				     * 10	  64 Hz
+				     * 11	  32 Hz
+				     * 12	  16 Hz
+				     * 13	   8 Hz
+				     * 14	   4 Hz
+				     * 15	   2 Hz
+				     */
+#define		    RTC_A_RS_DEF    6	/* Default freq. */
+#define RTC_REG_B	0xB
+#define		RTC_B_SET	0x80	/* Inhibit updates */
+#define		RTC_B_PIE	0x40	/* Enable periodic interrupts */
+#define		RTC_B_AIE	0x20	/* Enable alarm interrupts */
+#define		RTC_B_UIE	0x10	/* Enable update ended interrupts */
+#define		RTC_B_SQWE	0x08	/* Enable square wave output */
+#define		RTC_B_DM_BCD	0x04	/* Data is in BCD (otherwise binary) */
+#define		RTC_B_24	0x02	/* Count hours in 24-hour mode */
+#define		RTC_B_DSE	0x01	/* Automatic (wrong) daylight savings
+					 * updates
+					 */
+#define RTC_REG_C	0xC
+
+/* Contents of the general purpose CMOS RAM (source IBM reference manual) */
+#define CMOS_STATUS	0xE
+#define		CS_LOST_POWER	0x80	/* Chip lost power */
+#define		CS_BAD_CHKSUM	0x40	/* Checksum is incorrect */
+#define		CS_BAD_CONFIG	0x20	/* Bad configuration info */
+#define		CS_BAD_MEMSIZE	0x10	/* Wrong memory size of CMOS */
+#define		CS_BAD_HD	0x08	/* Harddisk failed */
+#define		CS_BAD_TIME	0x04	/* CMOS time is invalid */
+					/* bits 0 and 1 are reserved */
+
+/*
+ * $PchId: cmos.h,v 1.1 1998/12/16 09:14:21 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/i386/cmos.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/float.h
===================================================================
--- lab4/.minix-src/include/i386/float.h	(nonexistent)
+++ lab4/.minix-src/include/i386/float.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: float.h,v 1.12 2003/02/26 21:29:00 fvdl Exp $	*/
+
+#include <x86/float.h>

Property changes on: lab4/.minix-src/include/i386/float.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/freebsd_machdep.h
===================================================================
--- lab4/.minix-src/include/i386/freebsd_machdep.h	(nonexistent)
+++ lab4/.minix-src/include/i386/freebsd_machdep.h	(revision 13)
@@ -0,0 +1,118 @@
+/*	$NetBSD: freebsd_machdep.h,v 1.13 2014/02/12 23:24:09 dsl Exp $	*/
+
+/*
+ * Copyright (c) 1986, 1989, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	from: @(#)signal.h	8.1 (Berkeley) 6/11/93
+ *	from: Id: signal.h,v 1.4 1994/08/21 04:55:30 paul Exp 
+ *
+ *	from: @(#)frame.h	5.2 (Berkeley) 1/18/91
+ *	from: Id: frame.h,v 1.10 1995/03/16 18:11:42 bde Exp 
+ */
+#ifndef _FREEBSD_MACHDEP_H
+#define _FREEBSD_MACHDEP_H
+
+#include <compat/sys/sigtypes.h>
+
+/*
+ * signal support
+ */
+
+struct freebsd_osigcontext {
+	int	sc_onstack;	/* sigstack state to restore */
+	sigset13_t sc_mask;	/* signal mask to restore */
+	int	sc_esp;		/* machine state */
+	int	sc_ebp;
+	int	sc_isp;
+	int	sc_eip;
+	int	sc_eflags;
+	int	sc_es;
+	int	sc_ds;
+	int	sc_cs;
+	int	sc_ss;
+	int	sc_edi;
+	int	sc_esi;
+	int	sc_ebx;
+	int	sc_edx;
+	int	sc_ecx;
+	int	sc_eax;
+};
+
+/*
+ * The sequence of the fields/registers in struct sigcontext should match
+ * those in mcontext_t.
+ */
+struct freebsd_sigcontext {
+	sigset_t sc_mask;		/* signal mask to restore */
+	int	sc_onstack;		/* sigstack state to restore */
+	int	sc_gs;			/* machine state (struct trapframe): */
+	int	sc_fs;
+	int	sc_es;
+	int	sc_ds;
+	int	sc_edi;
+	int	sc_esi;
+	int	sc_ebp;
+	int	sc_isp;
+	int	sc_ebx;
+	int	sc_edx;
+	int	sc_ecx;
+	int	sc_eax;
+	int	sc_trapno;
+	int	sc_err;
+	int	sc_eip;
+	int	sc_cs;
+	int	sc_efl;
+	int	sc_esp;
+	int	sc_ss;
+	/*
+	 * XXX FPU state is 27 * 4 bytes h/w, 1 * 4 bytes s/w (probably not
+	 * needed here), or that + 16 * 4 bytes for emulators (probably all
+	 * needed here).  The "spare" bytes are mostly not spare.
+	 */
+	int	sc_fpregs[28];		/* machine state (FPU): */
+	int	sc_spare[17];
+};
+
+struct freebsd_sigframe {
+	int	sf_signum;
+	int	sf_code;
+	struct	freebsd_sigcontext *sf_scp;
+	char	*sf_addr;
+	sig_t	sf_handler;
+	struct	freebsd_sigcontext sf_sc;
+};
+
+/* sys/i386/include/exec.h */
+#define FREEBSD___LDPGSZ	4096
+
+void freebsd_syscall_intern(struct proc *);
+
+#endif /* _FREEBSD_MACHDEP_H */

Property changes on: lab4/.minix-src/include/i386/freebsd_machdep.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/lock.h
===================================================================
--- lab4/.minix-src/include/i386/lock.h	(nonexistent)
+++ lab4/.minix-src/include/i386/lock.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: lock.h,v 1.9 2003/02/27 00:12:22 fvdl Exp $	*/
+
+#include <x86/lock.h>

Property changes on: lab4/.minix-src/include/i386/lock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/mtrr.h
===================================================================
--- lab4/.minix-src/include/i386/mtrr.h	(nonexistent)
+++ lab4/.minix-src/include/i386/mtrr.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: mtrr.h,v 1.8 2003/02/26 21:29:02 fvdl Exp $	*/
+
+#include <x86/mtrr.h>

Property changes on: lab4/.minix-src/include/i386/mtrr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/gdt.h
===================================================================
--- lab4/.minix-src/include/i386/gdt.h	(nonexistent)
+++ lab4/.minix-src/include/i386/gdt.h	(revision 13)
@@ -0,0 +1,51 @@
+/*	$NetBSD: gdt.h,v 1.13 2008/04/28 20:23:24 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by John T. Kohl and Charles M. Hannum.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(_LOCORE)
+
+struct proc;
+struct pmap;
+
+void gdt_init(void);
+void gdt_init_cpu(struct cpu_info *);
+void gdt_reload_cpu(struct cpu_info *);
+int gdt_get_slot(void);
+void gdt_put_slot(int);
+void gdt_alloc_cpu(struct cpu_info *);
+int tss_alloc(const struct i386tss *);
+void tss_free(int);
+int ldt_alloc(union descriptor *, size_t);
+void ldt_free(int);
+
+#endif /* LOCORE */
+
+#define	MINGDTSIZ	512
+#define	MAXGDTSIZ	8192

Property changes on: lab4/.minix-src/include/i386/gdt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/ieeefp.h
===================================================================
--- lab4/.minix-src/include/i386/ieeefp.h	(nonexistent)
+++ lab4/.minix-src/include/i386/ieeefp.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: ieeefp.h,v 1.3 2003/02/26 21:29:01 fvdl Exp $	*/
+
+#include <x86/ieeefp.h>

Property changes on: lab4/.minix-src/include/i386/ieeefp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/diskparm.h
===================================================================
--- lab4/.minix-src/include/i386/diskparm.h	(nonexistent)
+++ lab4/.minix-src/include/i386/diskparm.h	(revision 13)
@@ -0,0 +1,20 @@
+/* PC (and AT) BIOS structure to hold disk parameters.  Under Minix, it is
+ * used mainly for formatting.
+ */
+
+#ifndef _DISKPARM_H
+#define _DISKPARM_H
+struct disk_parameter_s {
+  char spec1;
+  char spec2;
+  char motor_turnoff_sec;
+  char sector_size_code;
+  char sectors_per_cylinder;
+  char gap_length;
+  char dtl;
+  char gap_length_for_format;
+  char fill_byte_for_format;
+  char head_settle_msec;
+  char motor_start_eigth_sec;
+};
+#endif /* _DISKPARM_H */

Property changes on: lab4/.minix-src/include/i386/diskparm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/int86.h
===================================================================
--- lab4/.minix-src/include/i386/int86.h	(nonexistent)
+++ lab4/.minix-src/include/i386/int86.h	(revision 13)
@@ -0,0 +1,71 @@
+#ifndef _INT86_H
+#define _INT86_H
+
+#if defined(__i386__)
+
+#  include <sys/types.h>
+
+/* registers used in an PC real mode call for BIOS services */
+typedef struct reg86 {
+  union {
+    /* 32-bit (double word [dword] or long word) access */
+    struct {
+      u32_t ef;   /* 32-bit flags (output only) */
+      u32_t vec;  /* Driver vector (input only) */
+      u32_t : 32; /* unused */
+      u32_t eax;  /* 32-bit general register */
+      u32_t ebx;  /* 32-bit general register */
+      u32_t ecx;  /* 32-bit general register */
+      u32_t edx;  /* 32-bit general register */
+      u32_t esi;  /* 32-bit index register */
+      u32_t edi;  /* 32-bit index register */
+      u32_t ebp;  /* 32-bit pointer register */
+    };
+
+    /* 16-bit (word) access */
+    struct {
+      u16_t f;        /* 16-bit flags (output only) */
+      u16_t : 16;     /* unused */
+      u16_t off, seg; /* Driver vector (input only) */
+      u16_t ds, es;   /* DS and ES real mode segment registers */
+      u16_t ax;       /* 16-bit general register */
+      u16_t : 16;     /* unused */
+      u16_t bx;       /* 16-bit general register */
+      u16_t : 16;     /* unused */
+      u16_t cx;       /* 16-bit general register */
+      u16_t : 16;     /* unused */
+      u16_t dx;       /* 16-bit general register */
+      u16_t : 16;     /*unused */
+      u16_t si;       /* 16-bit index register */
+      u16_t : 16;     /*unused */
+      u16_t di;       /* 16-bit index register */
+      u16_t : 16;     /* unused */
+      u16_t bp;       /* 16-bit pointer register */
+      u16_t : 16;     /*unused */
+    };
+
+    /* 8-bit (byte) access */
+    struct {
+      u8_t intno;  /* Interrupt number (input only) */
+      u8_t : 8;    /* unused */
+      u16_t : 16;  /* unused */
+      u32_t : 32;  /* unused */
+      u32_t : 32;  /* unused */
+      u8_t al, ah; /* 8-bit general registers */
+      u16_t : 16;  /* unused */
+      u8_t bl, bh; /* 8-bit general registers */
+      u16_t : 16;  /* unused */
+      u8_t cl, ch; /* 8-bit general registers */
+      u16_t : 16;  /* unused */
+      u8_t dl, dh; /* 8-bit general registers */
+      u16_t : 16;  /* unused */
+      u32_t : 32;  /* unused */
+      u32_t : 32;  /* unused */
+      u32_t : 32;  /* unused */
+    };
+  };
+} reg86_t;
+
+#endif
+
+#endif /* _INT86_H */

Property changes on: lab4/.minix-src/include/i386/int86.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/partition.h
===================================================================
--- lab4/.minix-src/include/i386/partition.h	(nonexistent)
+++ lab4/.minix-src/include/i386/partition.h	(revision 13)
@@ -0,0 +1,28 @@
+/* Description of entry in partition table.  */
+#ifndef _PARTITION_H
+#define _PARTITION_H
+
+#include <stdint.h>
+
+struct part_entry {
+  uint8_t bootind;	/* boot indicator 0/ACTIVE_FLAG	 */
+  uint8_t start_head;	/* head value for first sector	 */
+  uint8_t start_sec;	/* sector value + cyl bits for first sector */
+  uint8_t start_cyl;	/* track value for first sector	 */
+  uint8_t sysind;		/* system indicator		 */
+  uint8_t last_head;	/* head value for last sector	 */
+  uint8_t last_sec;	/* sector value + cyl bits for last sector */
+  uint8_t last_cyl;	/* track value for last sector	 */
+  uint32_t lowsec;		/* logical first sector		 */
+  uint32_t size;		/* size of partition in sectors	 */
+};
+
+#define ACTIVE_FLAG	0x80	/* value for active in bootind field (hd0) */
+#define NR_PARTITIONS	4	/* number of entries in partition table */
+#define	PART_TABLE_OFF	0x1BE	/* offset of partition table in boot sector */
+
+/* Partition types. */
+#define NO_PART		0x00	/* unused entry */
+#define MINIX_PART	0x81	/* Minix partition type */
+
+#endif /* _PARTITION_H */

Property changes on: lab4/.minix-src/include/i386/partition.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/int_limits.h
===================================================================
--- lab4/.minix-src/include/i386/int_limits.h	(nonexistent)
+++ lab4/.minix-src/include/i386/int_limits.h	(revision 13)
@@ -0,0 +1,133 @@
+/*	$NetBSD: int_limits.h,v 1.9 2014/07/25 21:43:13 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_INT_LIMITS_H_
+#define _I386_INT_LIMITS_H_
+
+#ifdef __SIG_ATOMIC_MAX__
+#include <sys/common_int_limits.h>
+#else
+
+/*
+ * 7.18.2 Limits of specified-width integer types
+ */
+
+/* 7.18.2.1 Limits of exact-width integer types */
+
+/* minimum values of exact-width signed integer types */
+#define	INT8_MIN	(-0x7f-1)			/* int8_t	  */
+#define	INT16_MIN	(-0x7fff-1)			/* int16_t	  */
+#define	INT32_MIN	(-0x7fffffff-1)			/* int32_t	  */
+#define	INT64_MIN	(-0x7fffffffffffffffLL-1)	/* int64_t	  */
+
+/* maximum values of exact-width signed integer types */
+#define	INT8_MAX	0x7f				/* int8_t	  */
+#define	INT16_MAX	0x7fff				/* int16_t	  */
+#define	INT32_MAX	0x7fffffff			/* int32_t	  */
+#define	INT64_MAX	0x7fffffffffffffffLL		/* int64_t	  */
+
+/* maximum values of exact-width unsigned integer types */
+#define	UINT8_MAX	0xff				/* uint8_t	  */
+#define	UINT16_MAX	0xffff				/* uint16_t	  */
+#define	UINT32_MAX	0xffffffffU			/* uint32_t	  */
+#define	UINT64_MAX	0xffffffffffffffffULL		/* uint64_t	  */
+
+/* 7.18.2.2 Limits of minimum-width integer types */
+
+/* minimum values of minimum-width signed integer types */
+#define	INT_LEAST8_MIN	(-0x7f-1)			/* int_least8_t	  */
+#define	INT_LEAST16_MIN	(-0x7fff-1)			/* int_least16_t  */
+#define	INT_LEAST32_MIN	(-0x7fffffff-1)			/* int_least32_t  */
+#define	INT_LEAST64_MIN	(-0x7fffffffffffffffLL-1)	/* int_least64_t  */
+
+/* maximum values of minimum-width signed integer types */
+#define	INT_LEAST8_MAX	0x7f				/* int_least8_t	  */
+#define	INT_LEAST16_MAX	0x7fff				/* int_least16_t  */
+#define	INT_LEAST32_MAX	0x7fffffff			/* int_least32_t  */
+#define	INT_LEAST64_MAX	0x7fffffffffffffffLL		/* int_least64_t  */
+
+/* maximum values of minimum-width unsigned integer types */
+#define	UINT_LEAST8_MAX	 0xff				/* uint_least8_t  */
+#define	UINT_LEAST16_MAX 0xffff				/* uint_least16_t */
+#define	UINT_LEAST32_MAX 0xffffffffU			/* uint_least32_t */
+#define	UINT_LEAST64_MAX 0xffffffffffffffffULL		/* uint_least64_t */
+
+/* 7.18.2.3 Limits of fastest minimum-width integer types */
+ 
+/* minimum values of fastest minimum-width signed integer types */
+#define	INT_FAST8_MIN	(-0x7f-1)			/* int_fast8_t	  */
+#define	INT_FAST16_MIN	(-0x7fffffff-1)			/* int_fast16_t	  */
+#define	INT_FAST32_MIN	(-0x7fffffff-1)			/* int_fast32_t	  */
+#define	INT_FAST64_MIN	(-0x7fffffffffffffffLL-1)	/* int_fast64_t	  */
+
+/* maximum values of fastest minimum-width signed integer types */
+#define	INT_FAST8_MAX	0x7f				/* int_fast8_t	  */
+#define	INT_FAST16_MAX	0x7fffffff			/* int_fast16_t	  */
+#define	INT_FAST32_MAX	0x7fffffff			/* int_fast32_t	  */
+#define	INT_FAST64_MAX	0x7fffffffffffffffLL		/* int_fast64_t	  */
+
+/* maximum values of fastest minimum-width unsigned integer types */
+#define	UINT_FAST8_MAX	0xff				/* uint_fast8_t	  */
+#define	UINT_FAST16_MAX	0xffffffffU			/* uint_fast16_t  */
+#define	UINT_FAST32_MAX	0xffffffffU			/* uint_fast32_t  */
+#define	UINT_FAST64_MAX	0xffffffffffffffffULL		/* uint_fast64_t  */
+
+/* 7.18.2.4 Limits of integer types capable of holding object pointers */
+
+#define	INTPTR_MIN	(-0x7fffffff-1)			/* intptr_t	  */
+#define	INTPTR_MAX	0x7fffffff			/* intptr_t	  */
+#define	UINTPTR_MAX	0xffffffffU			/* uintptr_t	  */
+
+/* 7.18.2.5 Limits of greatest-width integer types */
+
+#define	INTMAX_MIN	(-0x7fffffffffffffffLL-1)	/* intmax_t	  */
+#define	INTMAX_MAX	0x7fffffffffffffffLL		/* intmax_t	  */
+#define	UINTMAX_MAX	0xffffffffffffffffULL		/* uintmax_t	  */
+
+
+/*
+ * 7.18.3 Limits of other integer types
+ */
+
+/* limits of ptrdiff_t */
+#define	PTRDIFF_MIN	(-0x7fffffff-1)			/* ptrdiff_t	  */
+#define	PTRDIFF_MAX	0x7fffffff			/* ptrdiff_t	  */
+
+/* limits of sig_atomic_t */
+#define	SIG_ATOMIC_MIN	(-0x7fffffff-1)			/* sig_atomic_t	  */
+#define	SIG_ATOMIC_MAX	0x7fffffff			/* sig_atomic_t	  */
+
+/* limit of size_t */
+#define	SIZE_MAX	0xffffffffU			/* size_t	  */
+
+#endif
+
+#endif /* !_I386_INT_LIMITS_H_ */

Property changes on: lab4/.minix-src/include/i386/int_limits.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/int_mwgwtypes.h
===================================================================
--- lab4/.minix-src/include/i386/int_mwgwtypes.h	(nonexistent)
+++ lab4/.minix-src/include/i386/int_mwgwtypes.h	(revision 13)
@@ -0,0 +1,93 @@
+/*	$NetBSD: int_mwgwtypes.h,v 1.8 2014/07/28 11:22:46 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_INT_MWGWTYPES_H_
+#define _I386_INT_MWGWTYPES_H_
+
+#ifdef __UINT_FAST64_TYPE__
+#include <sys/common_int_mwgwtypes.h>
+#else
+
+/*
+ * 7.18.1 Integer types
+ */
+
+/* 7.18.1.2 Minimum-width integer types */
+
+typedef	signed char		  int_least8_t;
+typedef	unsigned char		 uint_least8_t;
+typedef	short int		 int_least16_t;
+typedef	unsigned short int	uint_least16_t;
+typedef	int			 int_least32_t;
+typedef	unsigned int		uint_least32_t;
+#ifdef __COMPILER_INT64__
+typedef	__COMPILER_INT64__	 int_least64_t;
+typedef	__COMPILER_UINT64__	uint_least64_t;
+#else
+/* LONGLONG */
+typedef	long long int		 int_least64_t;
+/* LONGLONG */
+typedef	unsigned long long int	uint_least64_t;
+#endif
+
+/* 7.18.1.3 Fastest minimum-width integer types */
+
+typedef	int			   int_fast8_t;
+typedef	unsigned int		  uint_fast8_t;
+typedef	int			  int_fast16_t;
+typedef	unsigned int		 uint_fast16_t;
+typedef	int			  int_fast32_t;
+typedef	unsigned int		 uint_fast32_t;
+#ifdef __COMPILER_INT64__
+typedef	__COMPILER_INT64__	  int_fast64_t;
+typedef	__COMPILER_UINT64__	 uint_fast64_t;
+#else
+/* LONGLONG */
+typedef	long long int		  int_fast64_t;
+/* LONGLONG */
+typedef	unsigned long long int	 uint_fast64_t;
+#endif
+
+/* 7.18.1.5 Greatest-width integer types */
+
+#ifdef __COMPILER_INT64__
+typedef	__COMPILER_INT64__	      intmax_t;
+typedef	unsigned __COMPILER_INT64__  uintmax_t;
+#else
+/* LONGLONG */
+typedef	long long int		      intmax_t;
+/* LONGLONG */
+typedef	unsigned long long int	     uintmax_t;
+#endif
+
+#endif
+
+#endif /* !_I386_INT_MWGWTYPES_H_ */

Property changes on: lab4/.minix-src/include/i386/int_mwgwtypes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/pci_intel.h
===================================================================
--- lab4/.minix-src/include/i386/pci_intel.h	(nonexistent)
+++ lab4/.minix-src/include/i386/pci_intel.h	(revision 13)
@@ -0,0 +1,58 @@
+/*
+pci_intel.h
+
+Created:	Jan 2000 by Philip Homburg <philip@cs.vu.nl>
+*/
+
+#define PCII_CONFADD	0xCF8
+#define		PCIIC_CODE		0x80000000
+#define		PCIIC_BUSNUM_MASK	  0xff0000
+#define		PCIIC_BUSNUM_SHIFT	        16
+#define		PCIIC_DEVNUM_MASK	    0xf800
+#define		PCIIC_DEVNUM_SHIFT	        11
+#define		PCIIC_FUNCNUM_MASK	     0x700
+#define		PCIIC_FUNCNUM_SHIFT	         8
+#define		PCIIC_REGNUM_MASK	      0xfc
+#define		PCIIC_REGNUM_SHIFT	         2
+#define PCII_CONFDATA	0xCFC
+
+#define PCII_SELREG_(bus, dev, func, reg) \
+	(PCIIC_CODE | \
+	    (((bus) << PCIIC_BUSNUM_SHIFT) & PCIIC_BUSNUM_MASK) | \
+	    (((dev) << PCIIC_DEVNUM_SHIFT) & PCIIC_DEVNUM_MASK) | \
+	    (((func) << PCIIC_FUNCNUM_SHIFT) & PCIIC_FUNCNUM_MASK) | \
+	    ((((reg)/4) << PCIIC_REGNUM_SHIFT) & PCIIC_REGNUM_MASK))
+#define PCII_UNSEL 	(0)
+
+#define PCII_RREG8_(bus, dev, func, reg) \
+	(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
+	pci_inb(PCII_CONFDATA+((reg)&3)))
+#define PCII_RREG16_(bus, dev, func, reg) \
+	(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
+	pci_inw(PCII_CONFDATA+((reg)&2)))
+#define PCII_RREG32_(bus, dev, func, reg) \
+	(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
+	pci_inl(PCII_CONFDATA))
+
+#define PCII_WREG8_(bus, dev, func, reg, val) \
+	(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
+	pci_outb(PCII_CONFDATA+((reg)&3), (val)))
+#define PCII_WREG16_(bus, dev, func, reg, val) \
+	(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
+	pci_outw(PCII_CONFDATA+((reg)&2), (val)))
+#define PCII_WREG32_(bus, dev, func, reg, val) \
+	(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
+	pci_outl(PCII_CONFDATA, (val)))
+
+/* PIIX configuration registers */
+#define PIIX_PIRQRCA	0x60
+#define 	PIIX_IRQ_DI	0x80
+#define 	PIIX_IRQ_MASK	0x0F
+
+/* PIIX extensions to the PIC */
+#define PIIX_ELCR1	0x4D0
+#define PIIX_ELCR2	0x4D1
+
+/*
+ * $PchId: pci_intel.h,v 1.1 2000/08/12 11:20:17 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/i386/pci_intel.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/endian_machdep.h
===================================================================
--- lab4/.minix-src/include/i386/endian_machdep.h	(nonexistent)
+++ lab4/.minix-src/include/i386/endian_machdep.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: endian_machdep.h,v 1.3 2006/01/30 21:52:38 dsl Exp $	*/
+
+#define _BYTE_ORDER _LITTLE_ENDIAN

Property changes on: lab4/.minix-src/include/i386/endian_machdep.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/intr.h
===================================================================
--- lab4/.minix-src/include/i386/intr.h	(nonexistent)
+++ lab4/.minix-src/include/i386/intr.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: intr.h,v 1.37 2003/02/26 21:29:01 fvdl Exp $	*/
+
+#include <x86/intr.h>

Property changes on: lab4/.minix-src/include/i386/intr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/intrdefs.h
===================================================================
--- lab4/.minix-src/include/i386/intrdefs.h	(nonexistent)
+++ lab4/.minix-src/include/i386/intrdefs.h	(revision 13)
@@ -0,0 +1,6 @@
+/*	$NetBSD: intrdefs.h,v 1.4 2011/08/10 06:30:59 cherry Exp $	*/
+
+#include <x86/intrdefs.h>
+#ifdef XEN
+#include <xen/intrdefs.h>
+#endif /* XEN */

Property changes on: lab4/.minix-src/include/i386/intrdefs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/kcore.h
===================================================================
--- lab4/.minix-src/include/i386/kcore.h	(nonexistent)
+++ lab4/.minix-src/include/i386/kcore.h	(revision 13)
@@ -0,0 +1,62 @@
+/*	$NetBSD: kcore.h,v 1.5 2010/10/05 23:48:16 jym Exp $	*/
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Modified for NetBSD/i386 by Jason R. Thorpe, Numerical Aerospace
+ * Simulation Facility, NASA Ames Research Center.
+ */
+
+#ifndef _I386_KCORE_H_
+#define _I386_KCORE_H_
+
+typedef struct cpu_kcore_hdr {
+	uint32_t	pdppaddr;		/* PA of PDP */
+	uint32_t	nmemsegs;		/* Number of RAM segments */
+#if 0
+	phys_ram_seg_t  memsegs[];		/* RAM segments */
+#endif
+} cpu_kcore_hdr_t;
+
+/*
+ * Used to indicate that PAE should be used for virtual address
+ * translation. As PDPpaddr is expected to be PAGE_SIZE aligned,
+ * this can be safely OR'ed in pdppaddr.
+ * To avoid any kind of conflict with existing MMU bits, we chose one
+ * ignored by hardware
+ */
+#define I386_KCORE_PAE	PG_AVAIL1
+
+#ifdef _KERNEL
+void	dumpsys(void);
+
+extern struct pcb dumppcb;
+extern int	sparse_dump;
+#endif
+
+#endif /* _I386_KCORE_H_ */

Property changes on: lab4/.minix-src/include/i386/kcore.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/pmap.h
===================================================================
--- lab4/.minix-src/include/i386/pmap.h	(nonexistent)
+++ lab4/.minix-src/include/i386/pmap.h	(revision 13)
@@ -0,0 +1,421 @@
+/*	$NetBSD: pmap.h,v 1.117 2014/04/21 19:12:11 christos Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Frank van der Linden for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_I386_PMAP_H_
+#define	_I386_PMAP_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_user_ldt.h"
+#include "opt_xen.h"
+#endif
+
+#include <sys/atomic.h>
+
+#include <i386/pte.h>
+#include <machine/segments.h>
+#if defined(_KERNEL)
+#include <machine/cpufunc.h>
+#endif
+
+#include <uvm/uvm_object.h>
+#ifdef XEN
+#include <xen/xenfunc.h>
+#include <xen/xenpmap.h>
+#endif /* XEN */
+
+/*
+ * see pte.h for a description of i386 MMU terminology and hardware
+ * interface.
+ *
+ * a pmap describes a processes' 4GB virtual address space.  when PAE
+ * is not in use, this virtual address space can be broken up into 1024 4MB
+ * regions which are described by PDEs in the PDP.  the PDEs are defined as
+ * follows:
+ *
+ * (ranges are inclusive -> exclusive, just like vm_map_entry start/end)
+ * (the following assumes that KERNBASE is 0xc0000000)
+ *
+ * PDE#s	VA range		usage
+ * 0->766	0x0 -> 0xbfc00000	user address space
+ * 767		0xbfc00000->		recursive mapping of PDP (used for
+ *			0xc0000000	linear mapping of PTPs)
+ * 768->1023	0xc0000000->		kernel address space (constant
+ *			0xffc00000	across all pmap's/processes)
+ *			<end>
+ *
+ *
+ * note: a recursive PDP mapping provides a way to map all the PTEs for
+ * a 4GB address space into a linear chunk of virtual memory.  in other
+ * words, the PTE for page 0 is the first int mapped into the 4MB recursive
+ * area.  the PTE for page 1 is the second int.  the very last int in the
+ * 4MB range is the PTE that maps VA 0xfffff000 (the last page in a 4GB
+ * address).
+ *
+ * all pmap's PD's must have the same values in slots 768->1023 so that
+ * the kernel is always mapped in every process.  these values are loaded
+ * into the PD at pmap creation time.
+ *
+ * at any one time only one pmap can be active on a processor.  this is
+ * the pmap whose PDP is pointed to by processor register %cr3.  this pmap
+ * will have all its PTEs mapped into memory at the recursive mapping
+ * point (slot #767 as show above).  when the pmap code wants to find the
+ * PTE for a virtual address, all it has to do is the following:
+ *
+ * address of PTE = (767 * 4MB) + (VA / PAGE_SIZE) * sizeof(pt_entry_t)
+ *                = 0xbfc00000 + (VA / 4096) * 4
+ *
+ * what happens if the pmap layer is asked to perform an operation
+ * on a pmap that is not the one which is currently active?  in that
+ * case we temporarily load this pmap, perform the operation, and mark
+ * the currently active one as pending lazy reload.
+ *
+ * the following figure shows the effects of the recursive PDP mapping:
+ *
+ *   PDP (%cr3)
+ *   +----+
+ *   |   0| -> PTP#0 that maps VA 0x0 -> 0x400000
+ *   |    |
+ *   |    |
+ *   | 767| -> points back to PDP (%cr3) mapping VA 0xbfc00000 -> 0xc0000000
+ *   | 768| -> first kernel PTP (maps 0xc0000000 -> 0xc0400000)
+ *   |    |
+ *   +----+
+ *
+ * note that the PDE#767 VA (0xbfc00000) is defined as "PTE_BASE"
+ *
+ * starting at VA 0xbfc00000 the current active PDP (%cr3) acts as a
+ * PTP:
+ *
+ * PTP#767 == PDP(%cr3) => maps VA 0xbfc00000 -> 0xc0000000
+ *   +----+
+ *   |   0| -> maps the contents of PTP#0 at VA 0xbfc00000->0xbfc01000
+ *   |    |
+ *   |    |
+ *   | 767| -> maps contents of PTP#767 (the PDP) at VA 0xbfeff000
+ *   | 768| -> maps contents of first kernel PTP
+ *   |    |
+ *   |1023|
+ *   +----+
+ *
+ * note that mapping of the PDP at PTP#767's VA (0xbfeff000) is
+ * defined as "PDP_BASE".... within that mapping there are two
+ * defines:
+ *   "PDP_PDE" (0xbfeffbfc) is the VA of the PDE in the PDP
+ *      which points back to itself.
+ *
+ * - PAE support -
+ * ---------------
+ *
+ * PAE adds another layer of indirection during address translation, breaking
+ * up the translation process in 3 different levels:
+ * - L3 page directory, containing 4 * 64-bits addresses (index determined by
+ * bits [31:30] from the virtual address). This breaks up the address space
+ * in 4 1GB regions.
+ * - the PD (L2), containing 512 64-bits addresses, breaking each L3 region
+ * in 512 * 2MB regions.
+ * - the PT (L1), also containing 512 64-bits addresses (at L1, the size of
+ * the pages is still 4K).
+ *
+ * The kernel virtual space is mapped by the last entry in the L3 page,
+ * the first 3 entries mapping the user VA space.
+ *
+ * Because the L3 has only 4 entries of 1GB each, we can't use recursive
+ * mappings at this level for PDP_PDE (this would eat up 2 of the 4GB
+ * virtual space). There are also restrictions imposed by Xen on the
+ * last entry of the L3 PD (reference count to this page cannot be
+ * bigger than 1), which makes it hard to use one L3 page per pmap to
+ * switch between pmaps using %cr3.
+ *
+ * As such, each CPU gets its own L3 page that is always loaded into its %cr3
+ * (ci_pae_l3_pd in the associated cpu_info struct). We claim that the VM has
+ * only a 2-level PTP (similar to the non-PAE case). L2 PD is now 4 contiguous
+ * pages long (corresponding to the 4 entries of the L3), and the different
+ * index/slots (like PDP_PDE) are adapted accordingly.
+ * 
+ * Kernel space remains in L3[3], L3[0-2] maps the user VA space. Switching
+ * between pmaps consists in modifying the first 3 entries of the CPU's L3 page.
+ *
+ * PTE_BASE will need 4 entries in the L2 PD pages to map the L2 pages
+ * recursively.
+ *
+ * In addition, for Xen, we can't recursively map L3[3] (Xen wants the ref
+ * count on this page to be exactly one), so we use a shadow PD page for
+ * the last L2 PD. The shadow page could be static too, but to make pm_pdir[]
+ * contiguous we'll allocate/copy one page per pmap.
+ */
+
+/*
+ * Mask to get rid of the sign-extended part of addresses.
+ */
+#define VA_SIGN_MASK		0
+#define VA_SIGN_NEG(va)		((va) | VA_SIGN_MASK)
+/*
+ * XXXfvdl this one's not right.
+ */
+#define VA_SIGN_POS(va)		((va) & ~VA_SIGN_MASK)
+
+/*
+ * the following defines identify the slots used as described above.
+ */
+#ifdef PAE
+#define L2_SLOT_PTE	(KERNBASE/NBPD_L2-4) /* 1532: for recursive PDP map */
+#define L2_SLOT_KERN	(KERNBASE/NBPD_L2)   /* 1536: start of kernel space */
+#else /* PAE */
+#define L2_SLOT_PTE	(KERNBASE/NBPD_L2-1) /* 767: for recursive PDP map */
+#define L2_SLOT_KERN	(KERNBASE/NBPD_L2)   /* 768: start of kernel space */
+#endif /* PAE */
+
+#define	L2_SLOT_KERNBASE L2_SLOT_KERN
+
+#define PDIR_SLOT_KERN	L2_SLOT_KERN
+#define PDIR_SLOT_PTE	L2_SLOT_PTE
+
+/*
+ * the following defines give the virtual addresses of various MMU
+ * data structures:
+ * PTE_BASE: the base VA of the linear PTE mappings
+ * PDP_BASE: the base VA of the recursive mapping of the PDP
+ * PDP_PDE: the VA of the PDE that points back to the PDP
+ */
+
+#define PTE_BASE  ((pt_entry_t *) (PDIR_SLOT_PTE * NBPD_L2))
+
+#define L1_BASE		PTE_BASE
+
+#define L2_BASE ((pd_entry_t *)((char *)L1_BASE + L2_SLOT_PTE * NBPD_L1))
+
+#define PDP_PDE		(L2_BASE + PDIR_SLOT_PTE)
+
+#define PDP_BASE	L2_BASE
+
+/* largest value (-1 for APTP space) */
+#define NKL2_MAX_ENTRIES	(NTOPLEVEL_PDES - (KERNBASE/NBPD_L2) - 1)
+#define NKL1_MAX_ENTRIES	(unsigned long)(NKL2_MAX_ENTRIES * NPDPG)
+
+#define NKL2_KIMG_ENTRIES	0	/* XXX unused */
+
+#define NKL2_START_ENTRIES	0	/* XXX computed on runtime */
+#define NKL1_START_ENTRIES	0	/* XXX unused */
+
+#ifndef XEN
+#define NTOPLEVEL_PDES		(PAGE_SIZE * PDP_SIZE / (sizeof (pd_entry_t)))
+#else	/* !XEN */
+#ifdef  PAE
+#define NTOPLEVEL_PDES		1964	/* 1964-2047 reserved by Xen */
+#else	/* PAE */
+#define NTOPLEVEL_PDES		1008	/* 1008-1023 reserved by Xen */
+#endif	/* PAE */
+#endif  /* !XEN */
+#define NPDPG			(PAGE_SIZE / sizeof (pd_entry_t))
+
+#define PTP_MASK_INITIALIZER	{ L1_FRAME, L2_FRAME }
+#define PTP_SHIFT_INITIALIZER	{ L1_SHIFT, L2_SHIFT }
+#define NKPTP_INITIALIZER	{ NKL1_START_ENTRIES, NKL2_START_ENTRIES }
+#define NKPTPMAX_INITIALIZER	{ NKL1_MAX_ENTRIES, NKL2_MAX_ENTRIES }
+#define NBPD_INITIALIZER	{ NBPD_L1, NBPD_L2 }
+#define PDES_INITIALIZER	{ L2_BASE }
+
+#define PTP_LEVELS	2
+
+/*
+ * PG_AVAIL usage: we make use of the ignored bits of the PTE
+ */
+
+#define PG_W		PG_AVAIL1	/* "wired" mapping */
+#define PG_PVLIST	PG_AVAIL2	/* mapping has entry on pvlist */
+#define PG_X		PG_AVAIL3	/* executable mapping */
+
+/*
+ * Number of PTE's per cache line.  4 byte pte, 32-byte cache line
+ * Used to avoid false sharing of cache lines.
+ */
+#ifdef PAE
+#define NPTECL		4
+#else
+#define NPTECL		8
+#endif
+
+#include <x86/pmap.h>
+
+#ifndef XEN
+#define pmap_pa2pte(a)			(a)
+#define pmap_pte2pa(a)			((a) & PG_FRAME)
+#define pmap_pte_set(p, n)		do { *(p) = (n); } while (0)
+#define pmap_pte_flush()		/* nothing */
+
+#ifdef PAE
+#define pmap_pte_cas(p, o, n)		atomic_cas_64((p), (o), (n))
+#define pmap_pte_testset(p, n)		\
+    atomic_swap_64((volatile uint64_t *)p, n)
+#define pmap_pte_setbits(p, b)		\
+    atomic_or_64((volatile uint64_t *)p, b)
+#define pmap_pte_clearbits(p, b)	\
+    atomic_and_64((volatile uint64_t *)p, ~(b))
+#else /* PAE */
+#define pmap_pte_cas(p, o, n)		atomic_cas_32((p), (o), (n))
+#define pmap_pte_testset(p, n)		\
+    atomic_swap_ulong((volatile unsigned long *)p, n)
+#define pmap_pte_setbits(p, b)		\
+    atomic_or_ulong((volatile unsigned long *)p, b)
+#define pmap_pte_clearbits(p, b)	\
+    atomic_and_ulong((volatile unsigned long *)p, ~(b))
+#endif /* PAE */
+
+#else /* XEN */
+extern kmutex_t pte_lock;
+
+static __inline pt_entry_t
+pmap_pa2pte(paddr_t pa)
+{
+	return (pt_entry_t)xpmap_ptom_masked(pa);
+}
+
+static __inline paddr_t
+pmap_pte2pa(pt_entry_t pte)
+{
+	return xpmap_mtop_masked(pte & PG_FRAME);
+}
+static __inline void
+pmap_pte_set(pt_entry_t *pte, pt_entry_t npte)
+{
+	int s = splvm();
+	xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
+	splx(s);
+}
+
+static __inline pt_entry_t
+pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n)
+{
+	pt_entry_t opte;
+
+	mutex_enter(&pte_lock);
+	opte = *ptep;
+	if (opte == o) {
+		xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n);
+		xpq_flush_queue();
+	}
+	mutex_exit(&pte_lock);
+	return opte;
+}
+
+static __inline pt_entry_t
+pmap_pte_testset(volatile pt_entry_t *pte, pt_entry_t npte)
+{
+	pt_entry_t opte;
+
+	mutex_enter(&pte_lock);
+	opte = *pte;
+	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
+	    npte);
+	xpq_flush_queue();
+	mutex_exit(&pte_lock);
+	return opte;
+}
+
+static __inline void
+pmap_pte_setbits(volatile pt_entry_t *pte, pt_entry_t bits)
+{
+	mutex_enter(&pte_lock);
+	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), (*pte) | bits);
+	xpq_flush_queue();
+	mutex_exit(&pte_lock);
+}
+
+static __inline void
+pmap_pte_clearbits(volatile pt_entry_t *pte, pt_entry_t bits)
+{	
+	mutex_enter(&pte_lock);
+	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
+	    (*pte) & ~bits);
+	xpq_flush_queue();
+	mutex_exit(&pte_lock);
+}
+
+static __inline void
+pmap_pte_flush(void)
+{
+	int s = splvm();
+	xpq_flush_queue();
+	splx(s);
+}
+
+#endif
+
+struct vm_map;
+struct trapframe;
+struct pcb;
+
+int	pmap_exec_fixup(struct vm_map *, struct trapframe *, struct pcb *);
+void	pmap_ldt_cleanup(struct lwp *);
+
+#include <x86/pmap_pv.h>
+
+#define	__HAVE_VM_PAGE_MD
+#define	VM_MDPAGE_INIT(pg) \
+	memset(&(pg)->mdpage, 0, sizeof((pg)->mdpage)); \
+	PMAP_PAGE_INIT(&(pg)->mdpage.mp_pp)
+
+struct vm_page_md {
+	struct pmap_page mp_pp;
+};
+
+#endif	/* _I386_PMAP_H_ */

Property changes on: lab4/.minix-src/include/i386/pmap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/limits.h
===================================================================
--- lab4/.minix-src/include/i386/limits.h	(nonexistent)
+++ lab4/.minix-src/include/i386/limits.h	(revision 13)
@@ -0,0 +1,92 @@
+/*	$NetBSD: limits.h,v 1.25 2014/04/21 10:53:47 matt Exp $	*/
+
+/*
+ * Copyright (c) 1988 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)limits.h	7.2 (Berkeley) 6/28/90
+ */
+
+#ifndef	_I386_LIMITS_H_
+#define	_I386_LIMITS_H_
+
+#include <sys/featuretest.h>
+
+#define	CHAR_BIT	8		/* number of bits in a char */
+
+#define	UCHAR_MAX	0xff		/* max value for an unsigned char */
+#define	SCHAR_MAX	0x7f		/* max value for a signed char */
+#define SCHAR_MIN	(-0x7f-1)	/* min value for a signed char */
+
+#define	USHRT_MAX	0xffff		/* max value for an unsigned short */
+#define	SHRT_MAX	0x7fff		/* max value for a short */
+#define SHRT_MIN        (-0x7fff-1)     /* min value for a short */
+
+#define	UINT_MAX	0xffffffffU	/* max value for an unsigned int */
+#define	INT_MAX		0x7fffffff	/* max value for an int */
+#define	INT_MIN		(-0x7fffffff-1)	/* min value for an int */
+
+#define	ULONG_MAX	0xffffffffUL	/* max value for an unsigned long */
+#define	LONG_MAX	0x7fffffffL	/* max value for a long */
+#define	LONG_MIN	(-0x7fffffffL-1)	/* min value for a long */
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define	SSIZE_MAX	INT_MAX		/* max value for a ssize_t */
+
+#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
+    defined(_NETBSD_SOURCE)
+#define	ULLONG_MAX	0xffffffffffffffffULL	/* max unsigned long long */
+#define	LLONG_MAX	0x7fffffffffffffffLL	/* max signed long long */
+#define	LLONG_MIN	(-0x7fffffffffffffffLL-1) /* min signed long long */
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#define	SSIZE_MIN	INT_MIN		/* min value for a ssize_t */
+#define	SIZE_T_MAX	UINT_MAX	/* max value for a size_t */
+
+#define	UQUAD_MAX	0xffffffffffffffffULL		/* max unsigned quad */
+#define	QUAD_MAX	0x7fffffffffffffffLL		/* max signed quad */
+#define	QUAD_MIN	(-0x7fffffffffffffffLL-1)	/* min signed quad */
+
+#endif /* _NETBSD_SOURCE */
+#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define LONG_BIT	32
+#define WORD_BIT	32
+
+#define DBL_DIG		__DBL_DIG__
+#define DBL_MAX		__DBL_MAX__
+#define DBL_MIN		__DBL_MIN__
+
+#define FLT_DIG		__FLT_DIG__
+#define FLT_MAX		__FLT_MAX__
+#define FLT_MIN		__FLT_MIN__
+#endif
+
+#endif /* _I386_LIMITS_H_ */

Property changes on: lab4/.minix-src/include/i386/limits.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/frame.h
===================================================================
--- lab4/.minix-src/include/i386/frame.h	(nonexistent)
+++ lab4/.minix-src/include/i386/frame.h	(revision 13)
@@ -0,0 +1,189 @@
+/*	$NetBSD: frame.h,v 1.35 2012/02/19 21:06:11 rmind Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)frame.h	5.2 (Berkeley) 1/18/91
+ */
+
+#ifndef _I386_FRAME_H_
+#define _I386_FRAME_H_
+
+#include <sys/signal.h>
+
+/*
+ * System stack frames.
+ */
+
+/*
+ * Exception/Trap Stack Frame
+ */
+struct trapframe {
+	uint16_t	tf_gs;
+	uint16_t	tf_gs_pad;
+	uint16_t	tf_fs;
+	uint16_t	tf_fs_pad;
+	uint16_t	tf_es;
+	uint16_t	tf_es_pad;
+	uint16_t	tf_ds;
+	uint16_t	tf_ds_pad;
+	int	tf_edi;
+	int	tf_esi;
+	int	tf_ebp;
+	int	tf_ebx;
+	int	tf_edx;
+	int	tf_ecx;
+	int	tf_eax;
+	int	tf_trapno;
+	/* below portion defined in 386 hardware */
+	int	tf_err;
+	int	tf_eip;
+	int	tf_cs;
+	int	tf_eflags;
+	/* below used when transitting rings (e.g. user to kernel) */
+	int	tf_esp;
+	int	tf_ss;
+	/* below used when switching out of VM86 mode */
+	int	tf_vm86_es;
+	int	tf_vm86_ds;
+	int	tf_vm86_fs;
+	int	tf_vm86_gs;
+};
+
+/*
+ * Interrupt stack frame
+ */
+struct intrframe {
+	int	if_ppl;
+	int	if_gs;
+	int	if_fs;
+	int	if_es;
+	int	if_ds;
+	int	if_edi;
+	int	if_esi;
+	int	if_ebp;
+	int	if_ebx;
+	int	if_edx;
+	int	if_ecx;
+	int	if_eax;
+	uint32_t __if_trapno;	/* for compat with trap frame - trapno */
+	uint32_t __if_err;	/* for compat with trap frame - err */
+	/* below portion defined in 386 hardware */
+	int	if_eip;
+	int	if_cs;
+	int	if_eflags;
+	/* below only when transitting rings (e.g. user to kernel) */
+	int	if_esp;
+	int	if_ss;
+};
+
+/*
+ * Stack frame inside cpu_switchto()
+ */
+struct switchframe {
+	int	sf_edi;
+	int	sf_esi;
+	int	sf_ebx;
+	int	sf_eip;
+};
+
+#if defined(_KERNEL) || defined(__minix)
+/*
+ * Old-style signal frame
+ */
+struct sigframe_sigcontext {
+#if defined(__minix)
+	/* ret addr + stackframe for handler */
+	int	sf_ra_sigreturn;	/* first return to sigreturn */
+#else
+	int	sf_ra;			/* return address for handler */
+#endif /* defined(__minix) */
+	int	sf_signum;		/* "signum" argument for handler */
+	int	sf_code;		/* "code" argument for handler */
+	struct	sigcontext *sf_scp;	/* "scp" argument for handler */
+#if defined(__minix)
+	/* ret addr + stackframe for sigreturn */
+	uint32_t sf_fp;			/* saved FP */
+	int	sf_ra;			/* actual return address for handler */
+	struct	sigcontext *sf_scpcopy;	/* minix scp copy */
+#endif /* defined(__minix) */
+	struct	sigcontext sf_sc;	/* actual saved context */
+};
+#endif
+
+/*
+ * New-style signal frame
+ */
+struct sigframe_siginfo {
+	int		sf_ra;		/* return address for handler */
+	int		sf_signum;	/* "signum" argument for handler */
+	siginfo_t	*sf_sip;	/* "sip" argument for handler */
+	ucontext_t	*sf_ucp;	/* "ucp" argument for handler */
+	siginfo_t	sf_si;		/* actual saved siginfo */
+	ucontext_t	sf_uc;		/* actual saved ucontext */
+};
+
+#ifdef _KERNEL
+void *getframe(struct lwp *, int, int *);
+void buildcontext(struct lwp *, int, void *, void *);
+void sendsig_sigcontext(const ksiginfo_t *, const sigset_t *);
+#endif
+
+#endif  /* _I386_FRAME_H_ */

Property changes on: lab4/.minix-src/include/i386/frame.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/mcontext.h
===================================================================
--- lab4/.minix-src/include/i386/mcontext.h	(nonexistent)
+++ lab4/.minix-src/include/i386/mcontext.h	(revision 13)
@@ -0,0 +1,158 @@
+/*	$NetBSD: mcontext.h,v 1.12 2014/02/15 22:20:42 dsl Exp $	*/
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_MCONTEXT_H_
+#define _I386_MCONTEXT_H_
+
+
+/*
+ * mcontext extensions to handle signal delivery.
+ */
+#define _UC_SETSTACK	0x00010000
+#define _UC_CLRSTACK	0x00020000
+#define _UC_VM		0x00040000
+#define	_UC_TLSBASE	0x00080000
+
+/*
+ * Layout of mcontext_t according to the System V Application Binary Interface,
+ * Intel386(tm) Architecture Processor Supplement, Fourth Edition.
+ */  
+
+/*
+ * General register state
+ */
+#define _NGREG		19
+typedef	int		__greg_t;
+typedef	__greg_t	__gregset_t[_NGREG];
+
+#define _REG_GS		0
+#define _REG_FS		1
+#define _REG_ES		2
+#define _REG_DS		3
+#define _REG_EDI	4
+#define _REG_ESI	5
+#define _REG_EBP	6
+#define _REG_ESP	7
+#define _REG_EBX	8
+#define _REG_EDX	9
+#define _REG_ECX	10
+#define _REG_EAX	11
+#define _REG_TRAPNO	12
+#define _REG_ERR	13
+#define _REG_EIP	14
+#define _REG_CS		15
+#define _REG_EFL	16
+#define _REG_UESP	17
+#define _REG_SS		18
+
+/*
+ * Floating point register state
+ */
+typedef struct {
+	union {
+		struct {
+			int	__fp_state[27];	/* Environment and registers */
+		} __fpchip_state;	/* x87 regs in fsave format */
+		struct {
+			char	__fp_xmm[512];
+		} __fp_xmm_state;	/* x87 and xmm regs in fxsave format */
+		int	__fp_fpregs[128];
+	} __fp_reg_set;
+	int 	__fp_pad[33];			/* Historic padding */
+} __fpregset_t;
+__CTASSERT(sizeof (__fpregset_t) == 512 + 33 * 4);
+
+typedef struct {
+	__gregset_t	__gregs;
+	__fpregset_t	__fpregs;
+	__greg_t	_mc_tlsbase;
+#ifdef __minix
+	int	mc_magic;
+	int	mc_flags;
+#endif
+} mcontext_t;
+
+#define _UC_FXSAVE	0x20	/* FP state is in FXSAVE format in XMM space */
+
+#define _UC_MACHINE_PAD	4	/* Padding appended to ucontext_t */
+
+#define _UC_UCONTEXT_ALIGN	(~0xf)
+
+#ifdef _KERNEL_OPT
+#include "opt_vm86.h"
+#ifdef VM86
+/*#include <machine/psl.h>*/
+#define PSL_VM 0x00020000
+#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_UESP] + \
+	((uc)->uc_mcontext.__gregs[_REG_EFL] & PSL_VM ? \
+	 ((uc)->uc_mcontext.__gregs[_REG_SS] << 4) : 0))
+#endif /* VM86 */
+#endif /* _KERNEL_OPT */
+
+#ifndef _UC_MACHINE_SP
+#define _UC_MACHINE_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_UESP])
+#endif
+#define _UC_MACHINE_PC(uc)	((uc)->uc_mcontext.__gregs[_REG_EIP])
+#define _UC_MACHINE_INTRV(uc)	((uc)->uc_mcontext.__gregs[_REG_EAX])
+
+#define	_UC_MACHINE_SET_PC(uc, pc)	_UC_MACHINE_PC(uc) = (pc)
+
+#if defined(__minix)
+#define	_UC_MACHINE_STACK(uc)		((uc)->uc_mcontext.__gregs[_REG_ESP])
+#define	_UC_MACHINE_SET_STACK(uc, esp)	_UC_MACHINE_STACK(uc) = (esp)
+
+#define	_UC_MACHINE_EBP(uc)		((uc)->uc_mcontext.__gregs[_REG_EBP])
+#define	_UC_MACHINE_SET_EBP(uc, ebp)	_UC_MACHINE_EBP(uc) = (ebp)
+
+#define	_UC_MACHINE_ESI(uc)		((uc)->uc_mcontext.__gregs[_REG_ESI])
+#define	_UC_MACHINE_SET_ESI(uc, esi)	_UC_MACHINE_ESI(uc) = (esi)
+
+int setmcontext(const mcontext_t *mcp);
+int getmcontext(mcontext_t *mcp);
+
+#define MCF_MAGIC 0xc0ffee
+#define _MC_FPU_SAVED	0x001
+
+#endif /* defined(__minix) */
+
+#define	__UCONTEXT_SIZE	776
+
+static __inline void *
+__lwp_getprivate_fast(void)
+{
+	void *__tmp;
+
+	__asm volatile("movl %%gs:0, %0" : "=r" (__tmp));
+
+	return __tmp;
+}
+
+#endif	/* !_I386_MCONTEXT_H_ */

Property changes on: lab4/.minix-src/include/i386/mcontext.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/memory.h
===================================================================
--- lab4/.minix-src/include/i386/memory.h	(nonexistent)
+++ lab4/.minix-src/include/i386/memory.h	(revision 13)
@@ -0,0 +1,171 @@
+/* Physical memory layout on IBM compatible PCs. Only the major, fixed memory 
+ * areas are detailed here. Known addresses of the BIOS data area are defined
+ * in <ibm/bios.h>. The map upper memory area (UMA) is only roughly defined 
+ * since the UMA sections may vary in size and locus. 
+ *
+ * Created: March 2005, Jorrit N. Herder
+ */
+
+/* I/O-mapped peripherals. I/O addresses are different from memory addresses 
+ * due to the I/O signal on the ISA bus. Individual I/O ports are defined by 
+ * the drivers that use them or looked up with help of the BIOS. 
+ */
+#define IO_MEMORY_BEGIN             0x0000
+#define IO_MEMORY_END               0xFFFF  
+
+  
+/* Physical memory layout. Design decisions made for the earliest PCs, caused
+ * memory to be broken broken into the following four basic pieces:
+ *  - Conventional or base memory: first 640 KB (incl. BIOS data, see below);
+ *    The top of conventional memory is often used by the BIOS to store data.
+ *  - Upper Memory Area (UMA): upper 384 KB of the first megabyte of memory;
+ *  - High Memory Area (HMA): ~ first 64 KB of the second megabyte of memory;
+ *  - Extended Memory: all the memory above first megabyte of memory.
+ * The high memory area overlaps with the first 64 KB of extended memory, but
+ * is different from the rest of extended memory because it can be accessed 
+ * when the processor is in real mode. 
+ */
+#define BASE_MEM_BEGIN            0x000000
+#define BASE_MEM_TOP		  0x090000	
+#define BASE_MEM_END              0x09FFFF
+
+#define UPPER_MEM_BEGIN           0x0A0000
+#define UPPER_MEM_END             0x0FFFFF
+
+#define HIGH_MEM_BEGIN            0x100000
+#define HIGH_MEM_END              0x10FFEF
+
+#define EXTENDED_MEM_BEGIN        0x100000
+#define EXTENDED_MEM_END    ((unsigned) -1)
+  
+
+/* The logical memory map of the first 1.5 MB is as follows (hexadecimals): 
+ *
+ * offset [size]  (id) = memory usage
+ * ------------------------------------------------------------------------
+ * 000000 [00400] (I) = Real-Mode Interrupt Vector Table (1024 B)
+ * 000400 [00100] (B) = BIOS Data Area (256 B)
+ * 000800 [00066] (W) = 80286 Loadall workspace
+ * 010000 [10000] (c) = Real-Mode Compatibility Segment (64 KB)
+ * 020000 [70000] (.) = Program-accessible memory (free)
+ * 090000 [10000] (E) = BIOS Extension
+ * 0A0000 [10000] (G) = Graphics Mode Video RAM
+ * 0B0000 [08000] (M) = Monochrome Text Mode Video RAM
+ * 0B8000 [08000] (C) = Color Text Mode Video RAM
+ * 0C0000 [08000] (V) = Video ROM BIOS (would be "a" in PS/2)
+ * 0C8000 [18000] (a) = Adapter ROM + special-purpose RAM (free UMA space)
+ * 0E0000 [10000] (r) = PS/2 Motherboard ROM BIOS (free UMA in non-PS/2)
+ * 0F0000 [06000] (R) = Motherboard ROM BIOS
+ * 0F6000 [08000] (b) = IBM Cassette BASIC ROM ("R" in IBM compatibles)
+ * 0FD000 [02000] (R) = Motherboard ROM BIOS
+ * 100000 [.....] (.) = Extended memory, program-accessible (free) 
+ * 100000 [0FFEF] (h) = High Memory Area (HMA)
+ *
+ * 
+ * Conventional (Base) Memory:
+ *
+ *       : [~~~~~16 KB~~~~][~~~~~16 KB~~~~][~~~~~16 KB~~~~][~~~~~16 KB~~~~]
+ *       : 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
+ * 000000: IBW.............................................................
+ * 010000: cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+ * 020000: ................................................................
+ * 030000: ................................................................
+ * 040000: ................................................................
+ * 050000: ................................................................
+ * 060000: ................................................................
+ * 070000: ................................................................
+ * 080000: ................................................................
+ * 090000: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
+ * 
+ * Upper Memory Area (UMA):
+ *
+ *       : 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
+ * 0A0000: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
+ * 0B0000: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+ * 0C0000: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ * 0D0000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ * 0E0000: rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
+ * 0F0000: RRRRRRRRRRRRRRRRRRRRRRRRbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbRRRRRRRR
+ *
+ * Extended Memory:
+ * 
+ *       : 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
+ * 100000: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.
+ * 110000: ................................................................
+ * 120000: ................................................................
+ * 130000: ................................................................
+ * 140000: ................................................................
+ * 150000: ................................................................
+ * 160000: ................................................................
+ * 170000: ................................................................
+ *
+ * Source: The logical memory map was partly taken from the book "Upgrading 
+ *         & Repairing PCs Eight Edition", Macmillan Computer Publishing.
+ */ 
+
+ 
+/* The bottom part of conventional or base memory is occupied by BIOS data. 
+ * The BIOS memory can be distinguished in two parts:
+ * o The first the first 1024 bytes of addressable memory contains the BIOS 
+ *   real-mode interrupt vector table (IVT). The table is used to access BIOS
+ *   hardware services in real-mode by loading a interrupt vector and issuing 
+ *   an INT instruction. Some vectors contain BIOS data that can be retrieved 
+ *   directly and are useful in protected-mode as well. 
+ * o The BIOS data area is located directly above the interrupt vectors. It
+ *   comprises 256 bytes of memory. These data are used by the device drivers
+ *   to retrieve hardware details, such as I/O ports to be used. 
+ */  
+#define BIOS_MEM_BEGIN             0x00000      /* all BIOS memory */
+#define BIOS_MEM_END               0x004FF
+#define   BIOS_IVT_BEGIN           0x00000      /* BIOS interrupt vectors */
+#define   BIOS_IVT_END             0x003FF
+#define   BIOS_DATA_BEGIN          0x00400      /* BIOS data area */
+#define   BIOS_DATA_END            0x004FF
+
+/* The base memory is followed by 384 KB reserved memory located at the top of
+ * the first MB of physical memory. This memory is known as the upper memory 
+ * area (UMA). It is used for memory-mapped peripherals, such as video RAM, 
+ * adapter BIOS (adapter ROM and special purpose RAM), and the motherboard 
+ * BIOS (I/O system, Power-On Self Test, bootstrap loader). The upper memory
+ * can roughly be distinguished in three parts:
+ * 
+ * o The first 128K of the upper memory area (A0000-BFFFF) is reserved for use 
+ *   by memory-mapped video adapters. Hence, it is also called Video RAM. The
+ *   display driver can directly write to this memory and request the hardware
+ *   to show the data on the screen.
+ */ 
+#define UMA_VIDEO_RAM_BEGIN        0xA0000      /* video RAM */
+#define UMA_VIDEO_RAM_END          0xBFFFF
+#define   UMA_GRAPHICS_RAM_BEGIN   0xA0000      /* graphics RAM */
+#define   UMA_GRAPHICS_RAM_END     0xAFFFF
+#define   UMA_MONO_TEXT_BEGIN      0xB0000      /* monochrome text */
+#define   UMA_MONO_TEXT_END        0xB7FFF
+#define   UMA_COLOR_TEXT_BEGIN     0xB8000      /* color text */
+#define   UMA_COLOR_TEXT_END       0xBFFFF
+
+/* o The next 128K (the memory range C0000-DFFFF) is reserved for the adapter 
+ *   BIOS that resides in the ROM on some adapter boards. Most VGA-compatible 
+ *   video adapters use the first 32 KB of this area for their on-board BIOS. 
+ *   The rest can be used by any other adapters. The IDE controller often 
+ *   occupies the second 32 KB. 
+ */
+#define UMA_ADAPTER_BIOS_BEGIN     0xC0000      /* adapter BIOS */
+#define UMA_ADAPTER_BIOS_END       0xDFFFF
+#define   UMA_VIDEO_BIOS_BEGIN     0xC0000      /* video adapter */
+#define   UMA_VIDEO_BIOS_END       0xC7FFF
+#define   UMA_IDE_HD_BIOS_BEGIN    0xC8000      /* IDE hard disk */
+#define   UMA_IDE_HD_BIOS_END      0xCBFFF
+
+/* o The last 128K of the upper memory area (E0000-FFFFF) is reserved for 
+ *   motherboard BIOS (Basic I/O System). The POST (Power-On Self Test) and 
+ *   bootstrap loader also reside in  this space. The memory falls apart in 
+ *   two areas: Plug & Play BIOS data and the system BIOS data. 
+ */ 
+#define UMA_MB_BIOS_BEGIN          0xE0000      /* motherboard BIOS */
+#define UMA_MB_BIOS_END            0xFFFFF
+#define   UMA_PNP_ESCD_BIOS_BEGIN  0xE0000      /* PnP extended data */
+#define   UMA_PNP_ESCD_BIOS_END    0xEFFFF
+#define   UMA_SYSTEM_BIOS_BEGIN    0xF0000      /* system BIOS */
+#define   UMA_SYSTEM_BIOS_END      0xFFFFF
+
+ 

Property changes on: lab4/.minix-src/include/i386/memory.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/mutex.h
===================================================================
--- lab4/.minix-src/include/i386/mutex.h	(nonexistent)
+++ lab4/.minix-src/include/i386/mutex.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: mutex.h,v 1.2 2007/02/09 21:55:05 ad Exp $	*/
+
+#include <x86/mutex.h>

Property changes on: lab4/.minix-src/include/i386/mutex.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/ieee.h
===================================================================
--- lab4/.minix-src/include/i386/ieee.h	(nonexistent)
+++ lab4/.minix-src/include/i386/ieee.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: ieee.h,v 1.2 2003/02/26 21:29:01 fvdl Exp $	*/
+
+#include <x86/ieee.h>

Property changes on: lab4/.minix-src/include/i386/ieee.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/profile.h
===================================================================
--- lab4/.minix-src/include/i386/profile.h	(nonexistent)
+++ lab4/.minix-src/include/i386/profile.h	(revision 13)
@@ -0,0 +1,137 @@
+/*	$NetBSD: profile.h,v 1.33 2007/12/20 23:46:13 ad Exp $	*/
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)profile.h	8.1 (Berkeley) 6/11/93
+ */
+
+#ifdef _KERNEL_OPT
+#include "opt_multiprocessor.h"
+#endif
+
+#ifdef _KERNEL
+#include <machine/cpufunc.h>
+#include <machine/lock.h>
+#endif
+
+#define	_MCOUNT_DECL static __inline void _mcount
+
+#ifdef __ELF__
+#define MCOUNT_ENTRY	"__mcount"
+#define MCOUNT_COMPAT	__weak_alias(mcount, __mcount)
+#else
+#define MCOUNT_ENTRY	"mcount"
+#define MCOUNT_COMPAT	/* nothing */
+#endif
+
+#define	MCOUNT \
+MCOUNT_COMPAT								\
+extern void mcount(void) __asm(MCOUNT_ENTRY)				\
+	__attribute__((__no_instrument_function__));			\
+void									\
+mcount(void)								\
+{									\
+	int selfpc, frompcindex;					\
+	int eax, ecx, edx;						\
+									\
+	__asm volatile("movl %%eax,%0" : "=g" (eax));			\
+	__asm volatile("movl %%ecx,%0" : "=g" (ecx));			\
+	__asm volatile("movl %%edx,%0" : "=g" (edx));			\
+	/*								\
+	 * find the return address for mcount,				\
+	 * and the return address for mcount's caller.			\
+	 *								\
+	 * selfpc = pc pushed by mcount call				\
+	 */								\
+	__asm volatile("movl 4(%%ebp),%0" : "=r" (selfpc));		\
+	/*								\
+	 * frompcindex = pc pushed by call into self.			\
+	 */								\
+	__asm volatile("movl (%%ebp),%0;movl 4(%0),%0"			\
+	    : "=r" (frompcindex));					\
+	_mcount((u_long)frompcindex, (u_long)selfpc);			\
+									\
+	__asm volatile("movl %0,%%edx" : : "g" (edx));			\
+	__asm volatile("movl %0,%%ecx" : : "g" (ecx));			\
+	__asm volatile("movl %0,%%eax" : : "g" (eax));			\
+}
+
+#ifdef _KERNEL
+#ifdef MULTIPROCESSOR
+__cpu_simple_lock_t __mcount_lock;
+
+static inline void
+MCOUNT_ENTER_MP(void)
+{
+	__cpu_simple_lock(&__mcount_lock);
+	__insn_barrier();
+}
+
+static inline void
+MCOUNT_EXIT_MP(void)
+{
+	__insn_barrier();
+	__mcount_lock = __SIMPLELOCK_UNLOCKED;
+}
+#else
+#define MCOUNT_ENTER_MP()
+#define MCOUNT_EXIT_MP()
+#endif
+
+static inline void
+mcount_disable_intr(void)
+{
+	__asm volatile("cli");
+}
+
+static inline u_long
+mcount_read_psl(void)
+{
+	u_long	ef;
+
+	__asm volatile("pushfl; popl %0" : "=r" (ef));
+	return (ef);
+}
+
+static inline void
+mcount_write_psl(u_long ef)
+{
+	__asm volatile("pushl %0; popfl" : : "r" (ef));
+}
+
+#define	MCOUNT_ENTER							\
+	s = (int)mcount_read_psl();					\
+	mcount_disable_intr();						\
+	MCOUNT_ENTER_MP();
+
+#define	MCOUNT_EXIT							\
+	MCOUNT_EXIT_MP();						\
+	mcount_write_psl(s);
+
+#endif /* _KERNEL */

Property changes on: lab4/.minix-src/include/i386/profile.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/param.h
===================================================================
--- lab4/.minix-src/include/i386/param.h	(nonexistent)
+++ lab4/.minix-src/include/i386/param.h	(revision 13)
@@ -0,0 +1,154 @@
+/*	$NetBSD: param.h,v 1.77 2012/04/20 22:23:24 rmind Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)param.h	5.8 (Berkeley) 6/28/91
+ */
+
+#ifndef _I386_PARAM_H_
+#define _I386_PARAM_H_
+
+/*
+ * Machine dependent constants for Intel 386.
+ */
+
+/*
+ * MAXCPUS must be defined before cpu.h inclusion.  Note: i386 might
+ * support more CPUs, but due to the limited KVA space available on
+ * i386, such support would be inefficient.  Use amd64 instead.
+ */
+#define	MAXCPUS		32
+
+#ifdef _KERNEL
+#include <machine/cpu.h>
+#endif
+
+#define	_MACHINE	i386
+#define	MACHINE		"i386"
+#define	_MACHINE_ARCH	i386
+#define	MACHINE_ARCH	"i386"
+#define	MID_MACHINE	MID_I386
+
+#define ALIGNED_POINTER(p,t)	1
+
+#define	PGSHIFT		12		/* LOG2(NBPG) */
+#define	NBPG		(1 << PGSHIFT)	/* bytes/page */
+#define	PGOFSET		(NBPG-1)	/* byte offset into page */
+#define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
+
+#if defined(_KERNEL_OPT)
+#include "opt_kernbase.h"
+#endif /* defined(_KERNEL_OPT) */
+
+#ifdef KERNBASE_LOCORE
+#error "You should only re-define KERNBASE"
+#endif
+
+#ifndef	KERNBASE
+#define	KERNBASE	0xc0000000UL	/* start of kernel virtual space */
+#endif
+
+#define	KERNTEXTOFF	(KERNBASE + 0x100000) /* start of kernel text */
+#define	BTOPKERNBASE	(KERNBASE >> PGSHIFT)
+
+#define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
+#define	DEV_BSIZE	(1 << DEV_BSHIFT)
+#define	BLKDEV_IOSIZE	2048
+#ifndef	MAXPHYS
+#define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
+#endif
+
+#define	SSIZE		1		/* initial stack size/NBPG */
+#define	SINCR		1		/* increment of stack/NBPG */
+
+#ifndef UPAGES
+# ifdef DIAGNOSTIC
+#  define	UPAGES		3	/* 2 + 1 page for redzone */
+# else
+#  define	UPAGES		2	/* normal pages of u-area */
+# endif /* DIAGNOSTIC */
+#endif /* !defined(UPAGES) */
+#define	USPACE		(UPAGES * NBPG)	/* total size of u-area */
+#define	INTRSTACKSIZE	8192
+
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE	8*NBPG		/* default message buffer size */
+#endif
+
+/*
+ * Constants related to network buffer management.
+ * MCLBYTES must be no larger than NBPG (the software page size), and,
+ * on machines that exchange pages of input or output buffers with mbuf
+ * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
+ * of the hardware page size.
+ */
+#define	MSIZE		256		/* size of an mbuf */
+
+#ifndef MCLSHIFT
+#define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
+					/* 2K cluster can hold Ether frame */
+#endif	/* MCLSHIFT */
+
+#define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
+
+#ifndef NMBCLUSTERS_MAX
+#define	NMBCLUSTERS_MAX	(0x2000000 / MCLBYTES)	/* Limit to 64MB for clusters */
+#endif
+
+#ifndef NFS_RSIZE
+#define NFS_RSIZE	32768
+#endif
+#ifndef NFS_WSIZE
+#define NFS_WSIZE	32768
+#endif
+
+/*
+ * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * logical pages.
+ */
+#define	NKMEMPAGES_MIN_DEFAULT	((16 * 1024 * 1024) >> PAGE_SHIFT)
+#define	NKMEMPAGES_MAX_DEFAULT	((360 * 1024 * 1024) >> PAGE_SHIFT)
+
+/*
+ * Mach derived conversion macros
+ */
+#define	x86_round_pdr(x) \
+	((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1))
+#define	x86_trunc_pdr(x)	((unsigned long)(x) & ~(NBPD_L2 - 1))
+#define	x86_btod(x)		((unsigned long)(x) >> L2_SHIFT)
+#define	x86_dtob(x)		((unsigned long)(x) << L2_SHIFT)
+#define	x86_round_page(x)	((((paddr_t)(x)) + PGOFSET) & ~PGOFSET)
+#define	x86_trunc_page(x)	((paddr_t)(x) & ~PGOFSET)
+#define	x86_btop(x)		((paddr_t)(x) >> PGSHIFT)
+#define	x86_ptob(x)		((paddr_t)(x) << PGSHIFT)
+
+#endif /* _I386_PARAM_H_ */

Property changes on: lab4/.minix-src/include/i386/param.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/pci.h
===================================================================
--- lab4/.minix-src/include/i386/pci.h	(nonexistent)
+++ lab4/.minix-src/include/i386/pci.h	(revision 13)
@@ -0,0 +1,147 @@
+/*
+pci.h
+
+Created:	Jan 2000 by Philip Homburg <philip@cs.vu.nl>
+*/
+
+/* Header type 00, normal PCI devices */
+#define PCI_VID		0x00	/* Vendor ID, 16-bit */
+#define PCI_DID		0x02	/* Device ID, 16-bit */
+#define PCI_CR		0x04	/* Command Register, 16-bit */
+#define		PCI_CR_MAST_EN	0x0004	/* Enable Busmaster Access */
+#define		PCI_CR_MEM_EN	0x0002	/* Enable Mem Cycles */
+#define		PCI_CR_IO_EN	0x0001	/* Enable I/O Cycles */
+#define PCI_SR		0x06	/* PCI status, 16-bit */
+#define		 PSR_SSE	0x4000	/* Signaled System Error */
+#define		 PSR_RMAS	0x2000	/* Received Master Abort Status */
+#define		 PSR_RTAS	0x1000	/* Received Target Abort Status */
+#define		 PSR_CAPPTR	0x0010	/* Capabilities list */
+#define PCI_REV		0x08	/* Revision ID */
+#define PCI_PIFR	0x09	/* Prog. Interface Register */
+#define PCI_SCR		0x0A	/* Sub-Class Register */
+#define PCI_BCR		0x0B	/* Base-Class Register */
+#define PCI_CLS		0x0C	/* Cache Line Size */
+#define PCI_LT		0x0D	/* Latency Timer */
+#define PCI_HEADT	0x0E	/* Header type, 8-bit */
+#define	    PHT_MASK		0x7F	/* Header type mask */
+#define	    	PHT_NORMAL		0x00
+#define	    	PHT_BRIDGE		0x01
+#define	    	PHT_CARDBUS		0x02
+#define	    PHT_MULTIFUNC	0x80	/* Multiple functions */
+#define PCI_BIST	0x0F	/* Built-in Self Test */
+#define PCI_BAR		0x10	/* Base Address Register */
+#define	    PCI_BAR_IO		0x00000001	/* Reg. refers to I/O space */
+#define	    PCI_BAR_TYPE	0x00000006	/* Memory BAR type */
+#define	        PCI_TYPE_32	0x00000000	/* 32-bit BAR */
+#define	        PCI_TYPE_32_1M	0x00000002	/* 32-bit below 1MB (legacy) */
+#define	        PCI_TYPE_64	0x00000004	/* 64-bit BAR */
+#define	    PCI_BAR_PREFETCH	0x00000008	/* Memory is prefetchable */
+#define	    PCI_BAR_IO_MASK	0xFFFFFFFC	/* I/O address mask */
+#define	    PCI_BAR_MEM_MASK	0xFFFFFFF0	/* Memory address mask */
+#define PCI_BAR_2	0x14	/* Base Address Register */
+#define PCI_BAR_3	0x18	/* Base Address Register */
+#define PCI_BAR_4	0x1C	/* Base Address Register */
+#define PCI_BAR_5	0x20	/* Base Address Register */
+#define PCI_BAR_6	0x24	/* Base Address Register */
+#define PCI_CBCISPTR	0x28	/* Cardbus CIS Pointer */
+#define PCI_SUBVID	0x2C	/* Subsystem Vendor ID */
+#define PCI_SUBDID	0x2E	/* Subsystem Device ID */
+#define PCI_EXPROM	0x30	/* Expansion ROM Base Address */
+#define PCI_CAPPTR	0x34	/* Capabilities Pointer */
+#define		PCI_CP_MASK	0xfc	/* Lower 2 bits should be ignored */
+#define PCI_ILR		0x3C	/* Interrupt Line Register */
+#define		PCI_ILR_UNKNOWN	0xFF	/* IRQ is unassigned or unknown */
+#define PCI_IPR		0x3D	/* Interrupt Pin Register */
+#define PCI_MINGNT	0x3E	/* Min Grant */
+#define PCI_MAXLAT	0x3F	/* Max Latency */
+
+/* Header type 01, PCI-to-PCI bridge devices */
+/* The following registers are in common with type 00:
+ * PCI_VID, PCI_DID, PCI_CR, PCI_SR, PCI_REV, PCI_PIFR, PCI_SCR, PCI_BCR,
+ * PCI_CLS, PCI_LT, PCI_HEADT, PCI_BIST, PCI_BAR, PCI_BAR2, PCI_CAPPTR,
+ * PCI_ILR, PCI_IPR.
+ */
+#define PPB_PRIMBN	0x18	/* Primary Bus Number */
+#define PPB_SECBN	0x19	/* Secondary Bus Number */
+#define PPB_SUBORDBN	0x1A	/* Subordinate Bus Number */
+#define PPB_SECBLT	0x1B	/* Secondary Bus Latency Timer */
+#define PPB_IOBASE	0x1C	/* I/O Base */
+#define		PPB_IOB_MASK	0xf0
+#define PPB_IOLIMIT	0x1D	/* I/O Limit */
+#define		PPB_IOL_MASK	0xf0
+#define PPB_SSTS	0x1E	/* Secondary Status Register */
+#define PPB_MEMBASE	0x20	/* Memory Base */
+#define		PPB_MEMB_MASK	0xfff0
+#define PPB_MEMLIMIT	0x22	/* Memory Limit */
+#define		PPB_MEML_MASK	0xfff0
+#define PPB_PFMEMBASE	0x24	/* Prefetchable Memory Base */
+#define		PPB_PFMEMB_MASK	0xfff0
+#define PPB_PFMEMLIMIT	0x26	/* Prefetchable Memory Limit */
+#define		PPB_PFMEML_MASK	0xfff0
+#define PPB_PFMBU32	0x28	/* Prefetchable Memory Base Upper 32 */
+#define PPB_PFMLU32	0x2C	/* Prefetchable Memory Limit Upper 32 */
+#define PPB_IOBASEU16	0x30	/* I/O Base Upper 16 */
+#define PPB_IOLIMITU16	0x32	/* I/O Limit Upper 16 */
+#define PPB_EXPROM	0x38	/* Expansion ROM Base Address */
+#define PPB_BRIDGECTRL	0x3E	/* Bridge Control */
+#define		PPB_BC_CRST	0x40	/* Assert reset line */
+
+/* Header type 02, Cardbus bridge devices */
+/* The following registers are in common with type 00:
+ * PCI_VID, PCI_DID, PCI_CR, PCI_SR, PCI_REV, PCI_PIFR, PCI_SCR, PCI_BCR,
+ * PCI_CLS, PCI_LT, PCI_HEADT, PCI_BIST, PCI_BAR, PCI_ILR, PCI_IPR.
+ */
+/* The following registers are in common with type 01:
+ * PPB_PRIMBN, PPB_SECBN, PPB_SUBORDBN, PPB_SECBLT.
+ */
+#define CBB_CAPPTR	0x14	/* Capability Pointer */
+#define CBB_SSTS	0x16	/* Secondary Status Register */
+#define CBB_MEMBASE_0	0x1C	/* Memory Base 0 */
+#define CBB_MEMLIMIT_0	0x20	/* Memory Limit 0 */
+#define 	CBB_MEML_MASK	0xfffff000	
+#define CBB_MEMBASE_1	0x24	/* Memory Base 1 */
+#define CBB_MEMLIMIT_1	0x28	/* Memory Limit 1 */
+#define CBB_IOBASE_0	0x2C	/* I/O Base 0 */
+#define CBB_IOLIMIT_0	0x30	/* I/O Limit 0 */
+#define 	CBB_IOL_MASK	0xfffffffc	
+#define CBB_IOBASE_1	0x34	/* I/O Base 1 */
+#define CBB_IOLIMIT_1	0x38	/* I/O Limit 1 */
+#define CBB_BRIDGECTRL	0x3E	/* Bridge Control */
+#define		CBB_BC_INTEXCA	0x80	/* Interrupt are routed to ExCAs */
+#define		CBB_BC_CRST	0x40	/* Assert reset line */
+
+#define CAP_TYPE	0x00	/* Type field in capability */
+#define CAP_NEXT	0x01	/* Next field in capability */
+
+#define PCI_BCR_MASS_STORAGE	0x01	/* Mass Storage class */
+#define 	PCI_MS_IDE		0x01	/* IDE storage class */
+#define			PCI_IDE_PRI_NATIVE	0x01	/* Primary channel is
+							 * in native mode.
+							 */
+#define			PCI_IDE_SEC_NATIVE	0x04	/* Secondary channel is
+							 * in native mode.
+							 */
+
+/* Device type values as ([PCI_BCR] << 16) | ([PCI_SCR] << 8) | [PCI_PIFR] */
+#define PCI_T3_VGA_OLD		0x000100	/* OLD VGA class code */
+#define	PCI_T3_RAID		0x010400	/* RAID controller */
+#define PCI_T3_AHCI		0x010601	/* AHCI controller */
+#define PCI_T3_VGA		0x030000	/* VGA-compatible video card */
+#define PCI_T3_ISA		0x060100	/* ISA bridge */
+#define	PCI_T3_PCI2PCI		0x060400	/* PCI-to-PCI Bridge device */
+#define	PCI_T3_PCI2PCI_SUBTR	0x060401	/* Subtr. PCI-to-PCI Bridge */
+#define	PCI_T3_CARDBUS		0x060700	/* Bardbus Bridge */
+
+#define NO_VID		0xffff	/* No PCI card present */
+
+/* Capabilities */
+#define CAP_T_SECURE_DEV	0x0f		/* (AMD) Secure device
+						 * capability
+						 */
+#define CAP_SD_INFO		2		/* Offset from CAP ptr */
+#define 	CAP_SD_SUBTYPE_MASK	0x0f	/* Mask for subtype */
+#define			CAP_T_SD_DEV		0 /* AMD DEV */
+
+/*
+ * $PchId: pci.h,v 1.4 2001/12/06 20:21:22 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/i386/pci.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/reg.h
===================================================================
--- lab4/.minix-src/include/i386/reg.h	(nonexistent)
+++ lab4/.minix-src/include/i386/reg.h	(revision 13)
@@ -0,0 +1,110 @@
+/*	$NetBSD: reg.h,v 1.19 2008/01/16 09:37:08 ad Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)reg.h	5.5 (Berkeley) 1/18/91
+ */
+
+#ifndef _I386_REG_H_
+#define _I386_REG_H_
+
+#include <machine/frame.h>
+
+/*
+ * Location of the users' stored
+ * registers within appropriate frame of 'trap' and 'syscall', relative to
+ * base of stack frame.
+ *
+ * XXX these should be nuked. They used to be used in the NetBSD/i386 bits
+ * of gdb, but no more.
+ */
+
+/* When referenced during a trap/exception, registers are at these offsets */
+
+#define	tES	(offsetof(struct trapframe, tf_es) / sizeof (int))
+#define	tDS	(offsetof(struct trapframe, tf_ds) / sizeof (int))
+#define	tEDI	(offsetof(struct trapframe, tf_edi) / sizeof (int))
+#define	tESI	(offsetof(struct trapframe, tf_esi) / sizeof (int))
+#define	tEBP	(offsetof(struct trapframe, tf_ebp) / sizeof (int))
+#define	tEBX	(offsetof(struct trapframe, tf_ebx) / sizeof (int))
+#define	tEDX	(offsetof(struct trapframe, tf_edx) / sizeof (int))
+#define	tECX	(offsetof(struct trapframe, tf_ecx) / sizeof (int))
+#define	tEAX	(offsetof(struct trapframe, tf_eax) / sizeof (int))
+
+#define	tEIP	(offsetof(struct trapframe, tf_eip) / sizeof (int))
+#define	tCS	(offsetof(struct trapframe, tf_cs) / sizeof (int))
+#define	tEFLAGS	(offsetof(struct trapframe, tf_eflags) / sizeof (int))
+#define	tESP	(offsetof(struct trapframe, tf_esp) / sizeof (int))
+#define	tSS	(offsetof(struct trapframe, tf_ss) / sizeof (int))
+
+/*
+ * Registers accessible to ptrace(2) syscall for debugger
+ * The machine-dependent code for PT_{SET,GET}REGS needs to
+ * use whichver order, defined above, is correct, so that it
+ * is all invisible to the user.
+ */
+struct reg {
+	int	r_eax;
+	int	r_ecx;
+	int	r_edx;
+	int	r_ebx;
+	int	r_esp;
+	int	r_ebp;
+	int	r_esi;
+	int	r_edi;
+	int	r_eip;
+	int	r_eflags;
+	int	r_cs;
+	int	r_ss;
+	int	r_ds;
+	int	r_es;
+	int	r_fs;
+	int	r_gs;
+};
+
+struct fpreg {
+	/*
+	 * XXX
+	 * Fill this in with real info.
+	 */
+	char	__data[108];
+};
+
+struct xmmregs {
+	/*
+	 * XXX
+	 * Fill this in with real info.
+	 */
+	char	__data[512];
+};
+
+#endif /* !_I386_REG_H_ */

Property changes on: lab4/.minix-src/include/i386/reg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/int_fmtio.h
===================================================================
--- lab4/.minix-src/include/i386/int_fmtio.h	(nonexistent)
+++ lab4/.minix-src/include/i386/int_fmtio.h	(revision 13)
@@ -0,0 +1,218 @@
+/*	$NetBSD: int_fmtio.h,v 1.9 2014/07/28 11:22:46 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_INT_FMTIO_H_
+#define _I386_INT_FMTIO_H_
+
+#ifdef __INTPTR_FMTd__
+#include <sys/common_int_fmtio.h>
+#else
+
+/*
+ * 7.8.1 Macros for format specifiers
+ */
+
+/* fprintf macros for signed integers */
+
+#define	PRId8		"d"	/* int8_t		*/
+#define	PRId16		"d"	/* int16_t		*/
+#define	PRId32		"d"	/* int32_t		*/
+#define	PRId64		"lld"	/* int64_t		*/
+#define	PRIdLEAST8	"d"	/* int_least8_t		*/
+#define	PRIdLEAST16	"d"	/* int_least16_t	*/
+#define	PRIdLEAST32	"d"	/* int_least32_t	*/
+#define	PRIdLEAST64	"lld"	/* int_least64_t	*/
+#define	PRIdFAST8	"d"	/* int_fast8_t		*/
+#define	PRIdFAST16	"d"	/* int_fast16_t		*/
+#define	PRIdFAST32	"d"	/* int_fast32_t		*/
+#define	PRIdFAST64	"lld"	/* int_fast64_t		*/
+#define	PRIdMAX		"lld"	/* intmax_t		*/
+#define	PRIdPTR		"d"	/* intptr_t		*/
+
+#define	PRIi8		"i"	/* int8_t		*/
+#define	PRIi16		"i"	/* int16_t		*/
+#define	PRIi32		"i"	/* int32_t		*/
+#define	PRIi64		"lli"	/* int64_t		*/
+#define	PRIiLEAST8	"i"	/* int_least8_t		*/
+#define	PRIiLEAST16	"i"	/* int_least16_t	*/
+#define	PRIiLEAST32	"i"	/* int_least32_t	*/
+#define	PRIiLEAST64	"lli"	/* int_least64_t	*/
+#define	PRIiFAST8	"i"	/* int_fast8_t		*/
+#define	PRIiFAST16	"i"	/* int_fast16_t		*/
+#define	PRIiFAST32	"i"	/* int_fast32_t		*/
+#define	PRIiFAST64	"lli"	/* int_fast64_t		*/
+#define	PRIiMAX		"lli"	/* intmax_t		*/
+#define	PRIiPTR		"i"	/* intptr_t		*/
+
+/* fprintf macros for unsigned integers */
+
+#define	PRIo8		"o"	/* uint8_t		*/
+#define	PRIo16		"o"	/* uint16_t		*/
+#define	PRIo32		"o"	/* uint32_t		*/
+#define	PRIo64		"llo"	/* uint64_t		*/
+#define	PRIoLEAST8	"o"	/* uint_least8_t	*/
+#define	PRIoLEAST16	"o"	/* uint_least16_t	*/
+#define	PRIoLEAST32	"o"	/* uint_least32_t	*/
+#define	PRIoLEAST64	"llo"	/* uint_least64_t	*/
+#define	PRIoFAST8	"o"	/* uint_fast8_t		*/
+#define	PRIoFAST16	"o"	/* uint_fast16_t	*/
+#define	PRIoFAST32	"o"	/* uint_fast32_t	*/
+#define	PRIoFAST64	"llo"	/* uint_fast64_t	*/
+#define	PRIoMAX		"llo"	/* uintmax_t		*/
+#define	PRIoPTR		"o"	/* uintptr_t		*/
+
+#define	PRIu8		"u"	/* uint8_t		*/
+#define	PRIu16		"u"	/* uint16_t		*/
+#define	PRIu32		"u"	/* uint32_t		*/
+#define	PRIu64		"llu"	/* uint64_t		*/
+#define	PRIuLEAST8	"u"	/* uint_least8_t	*/
+#define	PRIuLEAST16	"u"	/* uint_least16_t	*/
+#define	PRIuLEAST32	"u"	/* uint_least32_t	*/
+#define	PRIuLEAST64	"llu"	/* uint_least64_t	*/
+#define	PRIuFAST8	"u"	/* uint_fast8_t		*/
+#define	PRIuFAST16	"u"	/* uint_fast16_t	*/
+#define	PRIuFAST32	"u"	/* uint_fast32_t	*/
+#define	PRIuFAST64	"llu"	/* uint_fast64_t	*/
+#define	PRIuMAX		"llu"	/* uintmax_t		*/
+#define	PRIuPTR		"u"	/* uintptr_t		*/
+
+#define	PRIx8		"x"	/* uint8_t		*/
+#define	PRIx16		"x"	/* uint16_t		*/
+#define	PRIx32		"x"	/* uint32_t		*/
+#define	PRIx64		"llx"	/* uint64_t		*/
+#define	PRIxLEAST8	"x"	/* uint_least8_t	*/
+#define	PRIxLEAST16	"x"	/* uint_least16_t	*/
+#define	PRIxLEAST32	"x"	/* uint_least32_t	*/
+#define	PRIxLEAST64	"llx"	/* uint_least64_t	*/
+#define	PRIxFAST8	"x"	/* uint_fast8_t		*/
+#define	PRIxFAST16	"x"	/* uint_fast16_t	*/
+#define	PRIxFAST32	"x"	/* uint_fast32_t	*/
+#define	PRIxFAST64	"llx"	/* uint_fast64_t	*/
+#define	PRIxMAX		"llx"	/* uintmax_t		*/
+#define	PRIxPTR		"x"	/* uintptr_t		*/
+
+#define	PRIX8		"X"	/* uint8_t		*/
+#define	PRIX16		"X"	/* uint16_t		*/
+#define	PRIX32		"X"	/* uint32_t		*/
+#define	PRIX64		"llX"	/* uint64_t		*/
+#define	PRIXLEAST8	"X"	/* uint_least8_t	*/
+#define	PRIXLEAST16	"X"	/* uint_least16_t	*/
+#define	PRIXLEAST32	"X"	/* uint_least32_t	*/
+#define	PRIXLEAST64	"llX"	/* uint_least64_t	*/
+#define	PRIXFAST8	"X"	/* uint_fast8_t		*/
+#define	PRIXFAST16	"X"	/* uint_fast16_t	*/
+#define	PRIXFAST32	"X"	/* uint_fast32_t	*/
+#define	PRIXFAST64	"llX"	/* uint_fast64_t	*/
+#define	PRIXMAX		"llX"	/* uintmax_t		*/
+#define	PRIXPTR		"X"	/* uintptr_t		*/
+
+/* fscanf macros for signed integers */
+
+#define	SCNd8		"hhd"	/* int8_t		*/
+#define	SCNd16		"hd"	/* int16_t		*/
+#define	SCNd32		"d"	/* int32_t		*/
+#define	SCNd64		"lld"	/* int64_t		*/
+#define	SCNdLEAST8	"hhd"	/* int_least8_t		*/
+#define	SCNdLEAST16	"hd"	/* int_least16_t	*/
+#define	SCNdLEAST32	"d"	/* int_least32_t	*/
+#define	SCNdLEAST64	"lld"	/* int_least64_t	*/
+#define	SCNdFAST8	"d"	/* int_fast8_t		*/
+#define	SCNdFAST16	"d"	/* int_fast16_t		*/
+#define	SCNdFAST32	"d"	/* int_fast32_t		*/
+#define	SCNdFAST64	"lld"	/* int_fast64_t		*/
+#define	SCNdMAX		"lld"	/* intmax_t		*/
+#define	SCNdPTR		"d"	/* intptr_t		*/
+
+#define	SCNi8		"hhi"	/* int8_t		*/
+#define	SCNi16		"hi"	/* int16_t		*/
+#define	SCNi32		"i"	/* int32_t		*/
+#define	SCNi64		"lli"	/* int64_t		*/
+#define	SCNiLEAST8	"hhi"	/* int_least8_t		*/
+#define	SCNiLEAST16	"hi"	/* int_least16_t	*/
+#define	SCNiLEAST32	"i"	/* int_least32_t	*/
+#define	SCNiLEAST64	"lli"	/* int_least64_t	*/
+#define	SCNiFAST8	"i"	/* int_fast8_t		*/
+#define	SCNiFAST16	"i"	/* int_fast16_t		*/
+#define	SCNiFAST32	"i"	/* int_fast32_t		*/
+#define	SCNiFAST64	"lli"	/* int_fast64_t		*/
+#define	SCNiMAX		"lli"	/* intmax_t		*/
+#define	SCNiPTR		"i"	/* intptr_t		*/
+
+/* fscanf macros for unsigned integers */
+
+#define	SCNo8		"hho"	/* uint8_t		*/
+#define	SCNo16		"ho"	/* uint16_t		*/
+#define	SCNo32		"o"	/* uint32_t		*/
+#define	SCNo64		"llo"	/* uint64_t		*/
+#define	SCNoLEAST8	"hho"	/* uint_least8_t	*/
+#define	SCNoLEAST16	"ho"	/* uint_least16_t	*/
+#define	SCNoLEAST32	"o"	/* uint_least32_t	*/
+#define	SCNoLEAST64	"llo"	/* uint_least64_t	*/
+#define	SCNoFAST8	"o"	/* uint_fast8_t		*/
+#define	SCNoFAST16	"o"	/* uint_fast16_t	*/
+#define	SCNoFAST32	"o"	/* uint_fast32_t	*/
+#define	SCNoFAST64	"llo"	/* uint_fast64_t	*/
+#define	SCNoMAX		"llo"	/* uintmax_t		*/
+#define	SCNoPTR		"o"	/* uintptr_t		*/
+
+#define	SCNu8		"hhu"	/* uint8_t		*/
+#define	SCNu16		"hu"	/* uint16_t		*/
+#define	SCNu32		"u"	/* uint32_t		*/
+#define	SCNu64		"llu"	/* uint64_t		*/
+#define	SCNuLEAST8	"hhu"	/* uint_least8_t	*/
+#define	SCNuLEAST16	"hu"	/* uint_least16_t	*/
+#define	SCNuLEAST32	"u"	/* uint_least32_t	*/
+#define	SCNuLEAST64	"llu"	/* uint_least64_t	*/
+#define	SCNuFAST8	"u"	/* uint_fast8_t		*/
+#define	SCNuFAST16	"u"	/* uint_fast16_t	*/
+#define	SCNuFAST32	"u"	/* uint_fast32_t	*/
+#define	SCNuFAST64	"llu"	/* uint_fast64_t	*/
+#define	SCNuMAX		"llu"	/* uintmax_t		*/
+#define	SCNuPTR		"u"	/* uintptr_t		*/
+
+#define	SCNx8		"hhx"	/* uint8_t		*/
+#define	SCNx16		"hx"	/* uint16_t		*/
+#define	SCNx32		"x"	/* uint32_t		*/
+#define	SCNx64		"llx"	/* uint64_t		*/
+#define	SCNxLEAST8	"hhx"	/* uint_least8_t	*/
+#define	SCNxLEAST16	"hx"	/* uint_least16_t	*/
+#define	SCNxLEAST32	"x"	/* uint_least32_t	*/
+#define	SCNxLEAST64	"llx"	/* uint_least64_t	*/
+#define	SCNxFAST8	"x"	/* uint_fast8_t		*/
+#define	SCNxFAST16	"x"	/* uint_fast16_t	*/
+#define	SCNxFAST32	"x"	/* uint_fast32_t	*/
+#define	SCNxFAST64	"llx"	/* uint_fast64_t	*/
+#define	SCNxMAX		"llx"	/* uintmax_t		*/
+#define	SCNxPTR		"x"	/* uintptr_t		*/
+
+#endif
+
+#endif /* !_I386_INT_FMTIO_H_ */

Property changes on: lab4/.minix-src/include/i386/int_fmtio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/pci_amd.h
===================================================================
--- lab4/.minix-src/include/i386/pci_amd.h	(nonexistent)
+++ lab4/.minix-src/include/i386/pci_amd.h	(revision 13)
@@ -0,0 +1,21 @@
+/*
+pci_amd.h
+
+Created:	Nov 2001 by Philip Homburg <philip@cs.vu.nl>
+*/
+
+#define AMD_ISABR_FUNC 3	/* Registers are in function 3 */
+#define		AMD_ISABR_PCIIRQ_LEV	0x54
+#define			AMD_PCILEV_INTA		0x1
+#define			AMD_PCILEV_INTB		0x2
+#define			AMD_PCILEV_INTC		4x2
+#define			AMD_PCILEV_INTD		4x8
+#define		AMD_ISABR_PCIIRQ_ROUTE	0x56
+#define			AMD_PCIIRQ_INTA_MASK	0x000F
+#define			AMD_PCIIRQ_INTB_MASK	0x00F0
+#define			AMD_PCIIRQ_INTC_MASK	0x0F00
+#define			AMD_PCIIRQ_INTD_MASK	0xF000
+
+/*
+ * $PchId: pci_amd.h,v 1.1 2001/11/09 19:57:37 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/i386/pci_amd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/pci_via.h
===================================================================
--- lab4/.minix-src/include/i386/pci_via.h	(nonexistent)
+++ lab4/.minix-src/include/i386/pci_via.h	(revision 13)
@@ -0,0 +1,27 @@
+/*
+pci_via.h
+
+Created:	Jun 2001 by Philip Homburg <philip@cs.vu.nl>
+*/
+
+#define VIA_ISABR_EL	0x54	/* Edge or level triggered */
+#define		VIA_ISABR_EL_INTA	0x08	/* Edge (1) or level (0) */
+#define		VIA_ISABR_EL_INTB	0x04
+#define		VIA_ISABR_EL_INTC	0x02
+#define		VIA_ISABR_EL_INTD	0x01
+
+#define VIA_ISABR_IRQ_R1 0x55	/* IRQ routing 1 */
+#define		VIA_ISABR_IRQ_INTD	0xf0	/* routing for INTD */
+#define		VIA_ISABR_IRQ_INT0	0x0f	/* routing for INT0 */
+#define VIA_ISABR_IRQ_R2 0x56	/* IRQ routing 2 */
+#define		VIA_ISABR_IRQ_INTA	0xf0	/* routing for INTA */
+#define		VIA_ISABR_IRQ_INTB	0x0f	/* routing for INTB */
+#define VIA_ISABR_IRQ_R3 0x57	/* IRQ routing 3 */
+#define		VIA_ISABR_IRQ_INTC	0xf0	/* routing for INTC */
+#define		VIA_ISABR_IRQ_INT1	0x0f	/* routing for INT1 */
+#define VIA_ISABR_IRQ_R4 0x58	/* IRQ routing 4 */
+#define		VIA_ISABR_IRQ_INT2	0x0f	/* routing for INT2 */
+
+/*
+ * $PchId: pci_via.h,v 1.1 2001/06/20 15:50:25 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/i386/pci_via.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/pio.h
===================================================================
--- lab4/.minix-src/include/i386/pio.h	(nonexistent)
+++ lab4/.minix-src/include/i386/pio.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: pio.h,v 1.20 2003/02/26 21:29:02 fvdl Exp $	*/
+
+#include <x86/pio.h>

Property changes on: lab4/.minix-src/include/i386/pio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/signal.h
===================================================================
--- lab4/.minix-src/include/i386/signal.h	(nonexistent)
+++ lab4/.minix-src/include/i386/signal.h	(revision 13)
@@ -0,0 +1,128 @@
+/*	$NetBSD: signal.h,v 1.29 2008/11/19 18:35:59 ad Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)signal.h	7.16 (Berkeley) 3/17/91
+ */
+
+#ifndef _I386_SIGNAL_H_
+#define _I386_SIGNAL_H_
+
+#include <sys/featuretest.h>
+
+#if defined(__minix) && (defined(_LIBMINC) || ! defined(_STANDALONE))
+#include <machine/fpu.h>
+#endif /* defined(__minix) ... */
+
+typedef int sig_atomic_t;
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Get the "code" values
+ */
+#include <machine/trap.h>
+
+#if defined(_KERNEL) || defined(__minix)
+/*
+ * Information pushed on stack when a signal is delivered.
+ * This is used by the kernel to restore state following
+ * execution of the signal handler.  It is also made available
+ * to the handler to allow it to restore state properly if
+ * a non-standard exit is performed.
+ */
+struct sigcontext13 {
+	int	sc_gs;
+	int	sc_fs;
+	int	sc_es;
+	int	sc_ds;
+	int	sc_edi;
+	int	sc_esi;
+	int	sc_ebp;
+	int	sc_ebx;
+	int	sc_edx;
+	int	sc_ecx;
+	int	sc_eax;
+	/* XXX */
+	int	sc_eip;
+	int	sc_cs;
+	int	sc_eflags;
+	int	sc_esp;
+	int	sc_ss;
+
+	int	sc_onstack;		/* sigstack state to restore */
+	int	sc_mask;		/* signal mask to restore (old style) */
+
+	int	sc_trapno;		/* XXX should be above */
+	int	sc_err;
+};
+
+struct sigcontext {
+	int	sc_gs;
+	int	sc_fs;
+	int	sc_es;
+	int	sc_ds;
+	int	sc_edi;
+	int	sc_esi;
+	int	sc_ebp;
+	int	sc_ebx;
+	int	sc_edx;
+	int	sc_ecx;
+	int	sc_eax;
+	/* XXX */
+	int	sc_eip;
+	int	sc_cs;
+	int	sc_eflags;
+	int	sc_esp;
+	int	sc_ss;
+
+	int	sc_onstack;		/* sigstack state to restore */
+	int	__sc_mask13;		/* signal mask to restore (old style) */
+
+	int	sc_trapno;		/* XXX should be above */
+	int	sc_err;
+
+	sigset_t sc_mask;		/* signal mask to restore (new style) */
+#if defined(__minix) && (defined(_LIBMINC) || ! defined(_STANDALONE))
+	union fpu_state_u sc_fpu_state;
+	int trap_style;		/* KTS_* method of entering kernel */
+	int sc_flags;			/* MF_FPU_INITIALIZED if fpu state valid */
+#define SC_MAGIC 0xc0ffee1
+	int sc_magic;
+#endif /* defined(__minix) ... */
+};
+#endif /* _KERNEL */
+
+#if defined(__minix) && (defined(_LIBMINC) || ! defined(_STANDALONE))
+__BEGIN_DECLS
+int sigreturn(struct sigcontext *_scp);
+__END_DECLS
+#endif /* defined(__minix) */
+
+#endif	/* _NETBSD_SOURCE */
+#endif	/* !_I386_SIGNAL_H_ */

Property changes on: lab4/.minix-src/include/i386/signal.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/ports.h
===================================================================
--- lab4/.minix-src/include/i386/ports.h	(nonexistent)
+++ lab4/.minix-src/include/i386/ports.h	(revision 13)
@@ -0,0 +1,17 @@
+/* Addresses and magic numbers for miscellaneous ports. */
+
+#ifndef _PORTS_H
+#define _PORTS_H
+
+#if defined(__i386__)
+
+/* Miscellaneous ports. */
+#define PCR		0x65	/* Planar Control Register */
+#define PORT_B          0x61	/* I/O port for 8255 port B (kbd, beeper...) */
+#define TIMER0          0x40	/* I/O port for timer channel 0 */
+#define TIMER2          0x42	/* I/O port for timer channel 2 */
+#define TIMER_MODE      0x43	/* I/O port for timer mode control */
+
+#endif /* defined(__i386__) */
+
+#endif /* _PORTS_H */

Property changes on: lab4/.minix-src/include/i386/ports.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/interrupt.h
===================================================================
--- lab4/.minix-src/include/i386/interrupt.h	(nonexistent)
+++ lab4/.minix-src/include/i386/interrupt.h	(revision 13)
@@ -0,0 +1,59 @@
+/* Interrupt numbers and hardware vectors. */
+
+#ifndef _INTERRUPT_H
+#define _INTERRUPT_H
+
+#if defined(__i386__)
+
+/* 8259A interrupt controller ports. */
+#define INT_CTL         0x20	/* I/O port for interrupt controller */
+#define INT_CTLMASK     0x21	/* setting bits in this port disables ints */
+#define INT2_CTL        0xA0	/* I/O port for second interrupt controller */
+#define INT2_CTLMASK    0xA1	/* setting bits in this port disables ints */
+
+/* Magic numbers for interrupt controller. */
+#define END_OF_INT      0x20	/* code used to re-enable after an interrupt */
+
+#define IRQ0_VECTOR     0x50   /* nice vectors to relocate IRQ0-7 to */
+#define IRQ8_VECTOR     0x70   /* no need to move IRQ8-15 */
+
+/* Interrupt vectors defined/reserved by processor. */
+#define DIVIDE_VECTOR      0	/* divide error */
+#define DEBUG_VECTOR       1	/* single step (trace) */
+#define NMI_VECTOR         2	/* non-maskable interrupt */
+#define BREAKPOINT_VECTOR  3	/* software breakpoint */
+#define OVERFLOW_VECTOR    4	/* from INTO */
+
+/* Fixed system call vector. */
+#define KERN_CALL_VECTOR_ORIG  32 /* system calls are made with int SYSVEC */
+#define IPC_VECTOR_ORIG        33 /* interrupt vector for ipc */
+#define KERN_CALL_VECTOR_UM    34 /* user-mapped equivalent */
+#define IPC_VECTOR_UM          35 /* user-mapped equivalent */
+
+/* Hardware interrupt numbers. */
+#ifndef USE_APIC
+#define NR_IRQ_VECTORS    16
+#else
+#define NR_IRQ_VECTORS    64
+#endif
+#define CLOCK_IRQ          0
+#define KEYBOARD_IRQ       1
+#define CASCADE_IRQ        2	/* cascade enable for 2nd AT controller */
+#define ETHER_IRQ          3	/* default ethernet interrupt vector */
+#define SECONDARY_IRQ      3	/* RS232 interrupt vector for port 2 */
+#define RS232_IRQ          4	/* RS232 interrupt vector for port 1 */
+#define XT_WINI_IRQ        5	/* xt winchester */
+#define FLOPPY_IRQ         6	/* floppy disk */
+#define PRINTER_IRQ        7
+#define SPURIOUS_IRQ       7
+#define CMOS_CLOCK_IRQ     8
+#define KBD_AUX_IRQ       12	/* AUX (PS/2 mouse) port in kbd controller */
+#define AT_WINI_0_IRQ     14	/* at winchester controller 0 */
+#define AT_WINI_1_IRQ     15	/* at winchester controller 1 */
+
+#define VECTOR(irq)    \
+       (((irq) < 8 ? IRQ0_VECTOR : IRQ8_VECTOR) + ((irq) & 0x07))
+
+#endif /* (CHIP == INTEL) */
+
+#endif /* _INTERRUPT_H */

Property changes on: lab4/.minix-src/include/i386/interrupt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/proc.h
===================================================================
--- lab4/.minix-src/include/i386/proc.h	(nonexistent)
+++ lab4/.minix-src/include/i386/proc.h	(revision 13)
@@ -0,0 +1,66 @@
+/*	$NetBSD: proc.h,v 1.42 2014/02/20 18:19:10 dsl Exp $	*/
+
+/*
+ * Copyright (c) 1991 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)proc.h	7.1 (Berkeley) 5/15/91
+ */
+
+#ifndef _I386_PROC_H_
+#define _I386_PROC_H_
+
+#include <machine/frame.h>
+#include <machine/pcb.h>
+
+/*
+ * Machine-dependent part of the lwp structure for i386.
+ */
+struct pmap;
+struct vm_page;
+
+struct mdlwp {
+	struct	trapframe *md_regs;	/* registers on current frame */
+	int	md_flags;		/* machine-dependent flags */
+	volatile int md_astpending;	/* AST pending for this process */
+	struct pmap *md_gc_pmap;	/* pmap being garbage collected */
+	struct vm_page *md_gc_ptp;	/* pages from pmap g/c */
+};
+
+/* md_flags */
+#define	MDL_IOPL	0x0002	/* XEN: i/o privilege */
+
+struct mdproc {
+	int	md_flags;
+	void	(*md_syscall)(struct trapframe *);
+					/* Syscall handling function */
+};
+
+/* md_flags */
+#define MDP_USEDMTRR	0x0002	/* has set volatile MTRRs */
+
+#endif /* _I386_PROC_H_ */

Property changes on: lab4/.minix-src/include/i386/proc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/joystick.h
===================================================================
--- lab4/.minix-src/include/i386/joystick.h	(nonexistent)
+++ lab4/.minix-src/include/i386/joystick.h	(revision 13)
@@ -0,0 +1,3 @@
+/* $NetBSD: joystick.h,v 1.2 2004/07/02 17:15:10 drochner Exp $ */
+
+#include <sys/joystick.h>

Property changes on: lab4/.minix-src/include/i386/joystick.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/pte.h
===================================================================
--- lab4/.minix-src/include/i386/pte.h	(nonexistent)
+++ lab4/.minix-src/include/i386/pte.h	(revision 13)
@@ -0,0 +1,270 @@
+/*	$NetBSD: pte.h,v 1.27 2011/02/01 20:09:08 chuck Exp $	*/
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Frank van der Linden for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ */
+
+/*
+ * pte.h rewritten by chuck based on the jolitz version, plus random
+ * info on the pentium and other processors found on the net.   the
+ * goal of this rewrite is to provide enough documentation on the MMU
+ * hardware that the reader will be able to understand it without having
+ * to refer to a hardware manual.
+ */
+
+#ifndef _I386_PTE_H_
+#define _I386_PTE_H_
+#ifdef _KERNEL_OPT
+#include "opt_xen.h"
+#endif
+
+/*
+ * i386 MMU hardware structure (without PAE extension):
+ *
+ * the i386 MMU is a two-level MMU which maps 4GB of virtual memory.
+ * the pagesize is 4K (4096 [0x1000] bytes), although newer pentium
+ * processors can support a 4MB pagesize as well.
+ *
+ * the first level table (segment table?) is called a "page directory"
+ * and it contains 1024 page directory entries (PDEs).   each PDE is
+ * 4 bytes (an int), so a PD fits in a single 4K page.   this page is
+ * the page directory page (PDP).  each PDE in a PDP maps 4MB of space 
+ * (1024 * 4MB = 4GB).   a PDE contains the physical address of the 
+ * second level table: the page table.   or, if 4MB pages are being used,
+ * then the PDE contains the PA of the 4MB page being mapped.
+ *
+ * a page table consists of 1024 page table entries (PTEs).  each PTE is
+ * 4 bytes (an int), so a page table also fits in a single 4K page.  a
+ * 4K page being used as a page table is called a page table page (PTP).
+ * each PTE in a PTP maps one 4K page (1024 * 4K = 4MB).   a PTE contains
+ * the physical address of the page it maps and some flag bits (described
+ * below).
+ * 
+ * the processor has a special register, "cr3", which points to the
+ * the PDP which is currently controlling the mappings of the virtual
+ * address space.
+ *
+ * the following picture shows the translation process for a 4K page:
+ *
+ * %cr3 register [PA of PDP]
+ *      |
+ *      |
+ *      |   bits <31-22> of VA         bits <21-12> of VA   bits <11-0>
+ *      |   index the PDP (0 - 1023)   index the PTP        are the page offset
+ *      |         |                           |                  |
+ *      |         v                           |                  |
+ *      +--->+----------+                     |                  |
+ *           | PD Page  |   PA of             v                  |
+ *           |          |---PTP-------->+------------+           |
+ *           | 1024 PDE |               | page table |--PTE--+   |
+ *           | entries  |               | (aka PTP)  |       |   |
+ *           +----------+               | 1024 PTE   |       |   |
+ *                                      | entries    |       |   |
+ *                                      +------------+       |   |
+ *                                                           |   |
+ *                                                bits <31-12>   bits <11-0>
+ *                                                p h y s i c a l  a d d r
+ *
+ * the i386 caches PTEs in a TLB.   it is important to flush out old
+ * TLB mappings when making a change to a mappings.   writing to the 
+ * %cr3 will flush the entire TLB.    newer processors also have an
+ * instruction that will invalidate the mapping of a single page (which
+ * is useful if you are changing a single mappings because it preserves
+ * all the cached TLB entries).
+ *
+ * as shows, bits 31-12 of the PTE contain PA of the page being mapped.
+ * the rest of the PTE is defined as follows:
+ *   bit#	name	use
+ *   11		n/a	available for OS use, hardware ignores it
+ *   10		n/a	available for OS use, hardware ignores it
+ *   9		n/a	available for OS use, hardware ignores it
+ *   8		G	global bit (see discussion below)
+ *   7		PS	page size [for PDEs] (0=4k, 1=4M <if supported>) 
+ *   6		D	dirty (modified) page
+ *   5		A	accessed (referenced) page
+ *   4		PCD	cache disable
+ *   3		PWT	prevent write through (cache)
+ *   2		U/S	user/supervisor bit (0=supervisor only, 1=both u&s)
+ *   1		R/W	read/write bit (0=read only, 1=read-write)
+ *   0		P	present (valid)
+ *
+ * notes: 
+ *  - PS is only supported on newer processors
+ *  - PTEs with the G bit are global in the sense that they are not 
+ *    flushed from the TLB when %cr3 is written (to flush, use the 
+ *    "flush single page" instruction).   this is only supported on
+ *    newer processors.    this bit can be used to keep the kernel's
+ *    TLB entries around while context switching.   since the kernel
+ *    is mapped into all processes at the same place it does not make 
+ *    sense to flush these entries when switching from one process'
+ *    pmap to another.
+ *
+ * The PAE extension extends the size of the PTE to 64 bits (52bits physical
+ * address) and is compatible with the amd64 PTE format. The first level
+ * maps 2M, the second 1G, so a third level page table is introduced to
+ * map the 4GB virtual address space. This PD has only 4 entries.
+ * We can't use recursive mapping at level 3 to map the PD pages, as this
+ * would eat one GB of address space. In addition, Xen imposes restrictions
+ * on the entries we put in the L3 page (for example, the page pointed to by
+ * the last slot can't be shared among different L3 pages), which makes 
+ * handling this L3 page in the same way we do for L2 on i386 (or L4 on amd64)
+ * difficult. For most things we'll just pretend to have only 2 levels,
+ * with the 2 high bits of the L2 index being in fact the index in the
+ * L3.
+ */
+
+#if !defined(_LOCORE)
+
+/*
+ * here we define the data types for PDEs and PTEs
+ */
+#ifdef PAE
+typedef uint64_t pd_entry_t;		/* PDE */
+typedef uint64_t pt_entry_t;		/* PTE */
+#else
+typedef uint32_t pd_entry_t;		/* PDE */
+typedef uint32_t pt_entry_t;		/* PTE */
+#endif
+
+#endif
+
+/*
+ * now we define various for playing with virtual addresses
+ */
+
+#ifdef PAE
+#define	L1_SHIFT	12
+#define	L2_SHIFT	21
+#define	L3_SHIFT	30
+#define	NBPD_L1		(1ULL << L1_SHIFT) /* # bytes mapped by L1 ent (4K) */
+#define	NBPD_L2		(1ULL << L2_SHIFT) /* # bytes mapped by L2 ent (2MB) */
+#define	NBPD_L3		(1ULL << L3_SHIFT) /* # bytes mapped by L3 ent (1GB) */
+
+#define	L3_MASK		0xc0000000
+#define	L2_REALMASK	0x3fe00000
+#define	L2_MASK		(L2_REALMASK | L3_MASK)
+#define	L1_MASK		0x001ff000
+
+#define	L3_FRAME	(L3_MASK)
+#define	L2_FRAME	(L3_FRAME | L2_MASK)
+#define	L1_FRAME	(L2_FRAME|L1_MASK)
+
+#define	PG_FRAME	0x000ffffffffff000ULL /* page frame mask */
+#define	PG_LGFRAME	0x000fffffffe00000ULL /* large (2MB) page frame mask */
+
+/* macros to get real L2 and L3 index, from our "extended" L2 index */
+#define l2tol3(idx)	((idx) >> (L3_SHIFT - L2_SHIFT))
+#define l2tol2(idx)	((idx) & (L2_REALMASK >>  L2_SHIFT))
+
+#else /* PAE */
+
+#define	L1_SHIFT	12
+#define	L2_SHIFT	22
+#define	NBPD_L1		(1UL << L1_SHIFT) /* # bytes mapped by L1 ent (4K) */
+#define	NBPD_L2		(1UL << L2_SHIFT) /* # bytes mapped by L2 ent (4MB) */
+
+#define L2_MASK		0xffc00000
+#define L1_MASK		0x003ff000
+
+#define L2_FRAME	(L2_MASK)
+#define L1_FRAME	(L2_FRAME|L1_MASK)
+
+#define	PG_FRAME	0xfffff000	/* page frame mask */
+#define	PG_LGFRAME	0xffc00000	/* large (4MB) page frame mask */
+
+#endif /* PAE */
+/*
+ * here we define the bits of the PDE/PTE, as described above:
+ *
+ * XXXCDC: need to rename these (PG_u == ugly).
+ */
+
+#define	PG_V		0x00000001	/* valid entry */
+#define	PG_RO		0x00000000	/* read-only page */
+#define	PG_RW		0x00000002	/* read-write page */
+#define	PG_u		0x00000004	/* user accessible page */
+#define	PG_PROT		0x00000806	/* all protection bits */
+#define PG_WT		0x00000008	/* write through */
+#define	PG_N		0x00000010	/* non-cacheable */
+#define	PG_U		0x00000020	/* has been used */
+#define	PG_M		0x00000040	/* has been modified */
+#define PG_PAT		0x00000080	/* PAT (on pte) */
+#define PG_PS		0x00000080	/* 4MB page size (2MB for PAE) */
+#define PG_G		0x00000100	/* global, don't TLB flush */
+#define PG_AVAIL1	0x00000200	/* ignored by hardware */
+#define PG_AVAIL2	0x00000400	/* ignored by hardware */
+#define PG_AVAIL3	0x00000800	/* ignored by hardware */
+#define PG_LGPAT	0x00001000	/* PAT on large pages */
+
+/*
+ * various short-hand protection codes
+ */
+
+#define	PG_KR		0x00000000	/* kernel read-only */
+#define	PG_KW		0x00000002	/* kernel read-write */
+
+#ifdef PAE
+#define	PG_NX		0x8000000000000000ULL /* No-execute */
+#else
+#define	PG_NX		0		/* dummy */
+#endif
+
+#include <x86/pte.h>
+
+#endif /* _I386_PTE_H_ */

Property changes on: lab4/.minix-src/include/i386/pte.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/stackframe.h
===================================================================
--- lab4/.minix-src/include/i386/stackframe.h	(nonexistent)
+++ lab4/.minix-src/include/i386/stackframe.h	(revision 13)
@@ -0,0 +1,38 @@
+#ifndef STACK_FRAME_H
+#define STACK_FRAME_H
+
+#include <sys/types.h>
+
+typedef unsigned reg_t;         /* machine register */
+typedef reg_t segdesc_t;
+
+/* The stack frame layout is determined by the software, but for efficiency
+ * it is laid out so the assembly code to use it is as simple as possible.
+ * 80286 protected mode and all real modes use the same frame, built with
+ * 16-bit registers.  Real mode lacks an automatic stack switch, so little
+ * is lost by using the 286 frame for it.  The 386 frame differs only in
+ * having 32-bit registers and more segment registers.  The same names are
+ * used for the larger registers to avoid differences in the code.
+ */
+struct stackframe_s {
+	u16_t gs;                     /* last item pushed by save */
+	u16_t fs;                     /*  ^ */
+	u16_t es;                     /*  | */
+	u16_t ds;                     /*  | */
+	reg_t di;                     /* di through cx are not accessed in C */
+	reg_t si;                     /* order is to match pusha/popa */
+	reg_t fp;                     /* bp */
+/*	reg_t st; */                     /* hole for another copy of sp */
+	reg_t bx;                     /*  | */
+	reg_t dx;                     /*  | */
+	reg_t cx;                     /*  | */
+	reg_t retreg;                 /* ax and above are all pushed by save */
+/*	reg_t retadr; */                 /* return address for assembly code save() */
+	reg_t pc;                     /*  ^  last item pushed by interrupt */
+	reg_t cs;                     /*  | */
+	reg_t psw;                    /*  | */
+	reg_t sp;                     /*  | */
+	reg_t ss;                     /* these are pushed by CPU during interrupt */
+};
+
+#endif /* #ifndef STACK_FRAME_H */

Property changes on: lab4/.minix-src/include/i386/stackframe.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/ptrace.h
===================================================================
--- lab4/.minix-src/include/i386/ptrace.h	(nonexistent)
+++ lab4/.minix-src/include/i386/ptrace.h	(revision 13)
@@ -0,0 +1,159 @@
+/*	$NetBSD: ptrace.h,v 1.15 2015/09/25 16:05:17 christos Exp $	*/
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed for the NetBSD Project by
+ *	Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+/*
+ * Copyright (c) 1993 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+#ifndef _I386_PTRACE_H_
+#define	_I386_PTRACE_H_
+
+/*
+ * i386-dependent ptrace definitions
+ */
+#define	PT_STEP		(PT_FIRSTMACH + 0)
+#define	PT_GETREGS	(PT_FIRSTMACH + 1)
+#define	PT_SETREGS	(PT_FIRSTMACH + 2)
+#define	PT_GETFPREGS	(PT_FIRSTMACH + 3)
+#define	PT_SETFPREGS	(PT_FIRSTMACH + 4)
+
+/* We have machine-dependent process tracing needs. */
+#define	__HAVE_PTRACE_MACHDEP
+
+/* We have machine-dependent procfs nodes. */
+#define	__HAVE_PROCFS_MACHDEP
+
+/* The machine-dependent ptrace(2) requests. */
+#define	PT_GETXMMREGS	(PT_FIRSTMACH + 5)
+#define	PT_SETXMMREGS	(PT_FIRSTMACH + 6)
+
+#define PT_MACHDEP_STRINGS \
+	"PT_STEP", \
+	"PT_GETREGS", \
+	"PT_SETREGS", \
+	"PT_GETFPREGS", \
+	"PT_SETFPREGS", \
+	"PT_GETXMMREGS", \
+	"PT_SETXMMREGS",
+
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)	(r)->r_eip
+#define PTRACE_REG_SET_PC(r, v)	(r)->r_eip = (v)
+#define PTRACE_REG_SP(r)	(r)->r_esp
+#define PTRACE_REG_INTRV(r)	(r)->r_eax
+
+#define PTRACE_BREAKPOINT	((const uint8_t[]) { 0xcc })
+#define PTRACE_BREAKPOINT_SIZE	1
+#define PTRACE_BREAKPOINT_ADJ	sizeof(PTRACE_BREAKPOINT)
+
+#ifdef _KERNEL
+
+/*
+ * These are used in sys_ptrace() to find good ptrace(2) requests.
+ */
+#define	PTRACE_MACHDEP_REQUEST_CASES					\
+	case PT_GETXMMREGS:						\
+	case PT_SETXMMREGS:
+
+/*
+ * These are used to define machine-dependent procfs node types.
+ */
+#define	PROCFS_MACHDEP_NODE_TYPES					\
+	Pmachdep_xmmregs,	/* extended FP register set */
+
+/*
+ * These are used in switch statements to catch machine-dependent
+ * procfs node types.
+ */
+#define	PROCFS_MACHDEP_NODETYPE_CASES					\
+	case Pmachdep_xmmregs:
+
+/*
+ * These are used to protect a privileged process's state.
+ */
+#define	PROCFS_MACHDEP_PROTECT_CASES					\
+	case Pmachdep_xmmregs:
+
+/*
+ * These are used to define the machine-dependent procfs nodes.
+ */
+#define	PROCFS_MACHDEP_NODETYPE_DEFNS					\
+	{ DT_REG, N("xmmregs"), Pmachdep_xmmregs,			\
+	  procfs_machdep_validxmmregs },
+
+struct xmmregs;
+
+/* Functions used by both ptrace(2) and procfs. */
+int	process_machdep_doxmmregs(struct lwp *, struct lwp *, struct uio *);
+int	process_machdep_validxmmregs(struct proc *);
+
+/* Functions used by procfs. */
+struct mount;
+struct pfsnode;
+int	procfs_machdep_doxmmregs(struct lwp *, struct lwp *,
+	    struct pfsnode *, struct uio *);
+int	procfs_machdep_validxmmregs(struct lwp *, struct mount *);
+
+#endif /* _KERNEL */
+
+#endif /* _I386_PTRACE_H_ */

Property changes on: lab4/.minix-src/include/i386/ptrace.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/segments.h
===================================================================
--- lab4/.minix-src/include/i386/segments.h	(nonexistent)
+++ lab4/.minix-src/include/i386/segments.h	(revision 13)
@@ -0,0 +1,340 @@
+/*	$NetBSD: segments.h,v 1.54 2011/04/26 15:51:23 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)segments.h	7.1 (Berkeley) 5/9/91
+ */
+
+/*-
+ * Copyright (c) 1995, 1997
+ *	Charles M. Hannum.  All rights reserved.
+ * Copyright (c) 1989, 1990 William F. Jolitz
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)segments.h	7.1 (Berkeley) 5/9/91
+ */
+
+/*
+ * 386 Segmentation Data Structures and definitions
+ *	William F. Jolitz (william@ernie.berkeley.edu) 6/20/1989
+ */
+
+#ifndef _I386_SEGMENTS_H_
+#define _I386_SEGMENTS_H_
+#ifdef _KERNEL_OPT
+#include "opt_xen.h"
+#endif
+
+/*
+ * Selectors
+ */
+
+#define	ISPL(s)		((s) & SEL_RPL)	/* what is the priority level of a selector */
+#ifndef XEN
+#define	SEL_KPL		0		/* kernel privilege level */
+#else
+#define	SEL_XEN		0		/* Xen privilege level */
+#define	SEL_KPL		1		/* kernel privilege level */
+#endif /* XEN */
+#define	SEL_UPL		3		/* user privilege level */
+#define	SEL_RPL		3		/* requester's privilege level mask */
+#ifdef XEN
+#define	CHK_UPL		2		/* user privilege level mask */
+#else
+#define CHK_UPL		SEL_RPL
+#endif /* XEN */
+#define	ISLDT(s)	((s) & SEL_LDT)	/* is it local or global */
+#define	SEL_LDT		4		/* local descriptor table */
+#define	IDXSEL(s)	(((s) >> 3) & 0x1fff)		/* index of selector */
+#define	IDXSELN(s)	(((s) >> 3))			/* index of selector */
+#define	GSEL(s,r)	(((s) << 3) | r)		/* a global selector */
+#define	LSEL(s,r)	(((s) << 3) | r | SEL_LDT)	/* a local selector */
+#define	GSYSSEL(s,r)	GSEL(s,r)	/* compat with amd64 */
+
+#if defined(_KERNEL_OPT)
+#include "opt_vm86.h"
+#endif
+
+#ifdef VM86
+#define	USERMODE(c, f)		(ISPL(c) == SEL_UPL || ((f) & PSL_VM) != 0)
+#define	KERNELMODE(c, f)	(ISPL(c) == SEL_KPL && ((f) & PSL_VM) == 0)
+#else
+#define	USERMODE(c, f)		(ISPL(c) == SEL_UPL)
+#define	KERNELMODE(c, f)	(ISPL(c) == SEL_KPL)
+#endif
+
+#ifndef _LOCORE
+
+#if __GNUC__ == 2 && __GNUC_MINOR__ < 7
+#pragma pack(1)
+#endif
+
+/*
+ * Memory and System segment descriptors
+ */
+struct segment_descriptor {
+	unsigned sd_lolimit:16;		/* segment extent (lsb) */
+	unsigned sd_lobase:24;		/* segment base address (lsb) */
+	unsigned sd_type:5;		/* segment type */
+	unsigned sd_dpl:2;		/* segment descriptor priority level */
+	unsigned sd_p:1;		/* segment descriptor present */
+	unsigned sd_hilimit:4;		/* segment extent (msb) */
+	unsigned sd_xx:2;		/* unused */
+	unsigned sd_def32:1;		/* default 32 vs 16 bit size */
+	unsigned sd_gran:1;		/* limit granularity (byte/page) */
+	unsigned sd_hibase:8;		/* segment base address (msb) */
+} __packed;
+
+/*
+ * Gate descriptors (e.g. indirect descriptors)
+ */
+struct gate_descriptor {
+	unsigned gd_looffset:16;	/* gate offset (lsb) */
+	unsigned gd_selector:16;	/* gate segment selector */
+	unsigned gd_stkcpy:5;		/* number of stack wds to cpy */
+	unsigned gd_xx:3;		/* unused */
+	unsigned gd_type:5;		/* segment type */
+	unsigned gd_dpl:2;		/* segment descriptor priority level */
+	unsigned gd_p:1;		/* segment descriptor present */
+	unsigned gd_hioffset:16;	/* gate offset (msb) */
+} __packed;
+
+struct ldt_descriptor {
+	vaddr_t ld_base;
+	uint32_t ld_entries;
+} __packed;
+
+/*
+ * Generic descriptor
+ */
+union descriptor {
+	struct segment_descriptor sd;
+	struct gate_descriptor gd;
+	struct ldt_descriptor ld;
+	uint32_t raw[2];
+	uint64_t raw64;
+} __packed;
+
+/*
+ * region descriptors, used to load gdt/idt tables before segments yet exist.
+ */
+struct region_descriptor {
+	unsigned rd_limit:16;		/* segment extent */
+	unsigned rd_base:32;		/* base address  */
+} __packed;
+
+#if __GNUC__ == 2 && __GNUC_MINOR__ < 7
+#pragma pack(4)
+#endif
+
+#ifdef _KERNEL
+extern union descriptor *gdt, *ldt;
+extern struct gate_descriptor *idt;
+
+void setgate(struct gate_descriptor *, void *, int, int, int, int);
+void setregion(struct region_descriptor *, void *, size_t);
+void setsegment(struct segment_descriptor *, const void *, size_t, int, int,
+    int, int);
+void setgdt(int, const void *, size_t, int, int, int, int);
+void unsetgate(struct gate_descriptor *);
+void cpu_init_idt(void);
+void update_descriptor(union descriptor *, union descriptor *);
+
+#if !defined(XEN)
+void idt_init(void);
+void idt_vec_reserve(int);
+int idt_vec_alloc(int, int);
+void idt_vec_set(int, void (*)(void));
+void idt_vec_free(int);
+#endif
+
+#endif /* _KERNEL */
+
+#endif /* !_LOCORE */
+
+/* system segments and gate types */
+#define	SDT_SYSNULL	 0	/* system null */
+#define	SDT_SYS286TSS	 1	/* system 286 TSS available */
+#define	SDT_SYSLDT	 2	/* system local descriptor table */
+#define	SDT_SYS286BSY	 3	/* system 286 TSS busy */
+#define	SDT_SYS286CGT	 4	/* system 286 call gate */
+#define	SDT_SYSTASKGT	 5	/* system task gate */
+#define	SDT_SYS286IGT	 6	/* system 286 interrupt gate */
+#define	SDT_SYS286TGT	 7	/* system 286 trap gate */
+#define	SDT_SYSNULL2	 8	/* system null again */
+#define	SDT_SYS386TSS	 9	/* system 386 TSS available */
+#define	SDT_SYSNULL3	10	/* system null again */
+#define	SDT_SYS386BSY	11	/* system 386 TSS busy */
+#define	SDT_SYS386CGT	12	/* system 386 call gate */
+#define	SDT_SYSNULL4	13	/* system null again */
+#define	SDT_SYS386IGT	14	/* system 386 interrupt gate */
+#define	SDT_SYS386TGT	15	/* system 386 trap gate */
+
+/* memory segment types */
+#define	SDT_MEMRO	16	/* memory read only */
+#define	SDT_MEMROA	17	/* memory read only accessed */
+#define	SDT_MEMRW	18	/* memory read write */
+#define	SDT_MEMRWA	19	/* memory read write accessed */
+#define	SDT_MEMROD	20	/* memory read only expand dwn limit */
+#define	SDT_MEMRODA	21	/* memory read only expand dwn limit accessed */
+#define	SDT_MEMRWD	22	/* memory read write expand dwn limit */
+#define	SDT_MEMRWDA	23	/* memory read write expand dwn limit acessed */
+#define	SDT_MEME	24	/* memory execute only */
+#define	SDT_MEMEA	25	/* memory execute only accessed */
+#define	SDT_MEMER	26	/* memory execute read */
+#define	SDT_MEMERA	27	/* memory execute read accessed */
+#define	SDT_MEMEC	28	/* memory execute only conforming */
+#define	SDT_MEMEAC	29	/* memory execute only accessed conforming */
+#define	SDT_MEMERC	30	/* memory execute read conforming */
+#define	SDT_MEMERAC	31	/* memory execute read accessed conforming */
+
+#define SDTYPE(p)	(((const struct segment_descriptor *)(p))->sd_type)
+/* is memory segment descriptor pointer ? */
+#define ISMEMSDP(s)	(SDTYPE(s) >= SDT_MEMRO && \
+			 SDTYPE(s) <= SDT_MEMERAC)
+
+/* is 286 gate descriptor pointer ? */
+#define IS286GDP(s)	(SDTYPE(s) >= SDT_SYS286CGT && \
+			 SDTYPE(s) < SDT_SYS286TGT)
+
+/* is 386 gate descriptor pointer ? */
+#define IS386GDP(s)	(SDTYPE(s) >= SDT_SYS386CGT && \
+			 SDTYPE(s) < SDT_SYS386TGT)
+
+/* is gate descriptor pointer ? */
+#define ISGDP(s)	(IS286GDP(s) || IS386GDP(s))
+
+/* is segment descriptor pointer ? */
+#define ISSDP(s)	(ISMEMSDP(s) || !ISGDP(s))
+
+/* is system segment descriptor pointer ? */
+#define ISSYSSDP(s)	(!ISMEMSDP(s) && !ISGDP(s))
+
+/*
+ * Segment Protection Exception code bits
+ */
+#define	SEGEX_EXT	0x01	/* recursive or externally induced */
+#define	SEGEX_IDT	0x02	/* interrupt descriptor table */
+#define	SEGEX_TI	0x04	/* local descriptor table */
+
+/*
+ * Entries in the Interrupt Descriptor Table (IDT)
+ */
+#define	NIDT	256
+#define	NRSVIDT	32		/* reserved entries for CPU exceptions */
+
+/*
+ * Entries in the Global Descriptor Table (GDT).
+ *
+ * NB: If you change GBIOSCODE/GBIOSDATA, you *must* rebuild arch/i386/
+ * bioscall/biostramp.inc, as that relies on GBIOSCODE/GBIOSDATA and a
+ * normal kernel build does not rebuild it (it's merely included whole-
+ * sale from i386/bioscall.s)
+ *
+ * Also, note that the GEXTBIOSDATA_SEL selector is special, as it maps
+ * to the value 0x0040 (when created as a KPL global selector).  Some
+ * BIOSes reference the extended BIOS data area at segment 0040 in a non
+ * relocatable fashion (even when in protected mode); mapping the zero page
+ * via the GEXTBIOSDATA_SEL allows these buggy BIOSes to continue to work
+ * under NetBSD.
+ *
+ * The order if the first 5 descriptors is special; the sysenter/sysexit
+ * instructions depend on them.
+ */
+#define	GNULL_SEL	0	/* Null descriptor */
+#define	GCODE_SEL	1	/* Kernel code descriptor */
+#define	GDATA_SEL	2	/* Kernel data descriptor */
+#define	GUCODE_SEL	3	/* User code descriptor */
+#define	GUDATA_SEL	4	/* User data descriptor */
+#define	GLDT_SEL	5	/* Default LDT descriptor */
+#define GCPU_SEL	6	/* per-CPU segment */
+#define	GEXTBIOSDATA_SEL 8	/* magic to catch BIOS refs to EBDA */
+#define	GAPM32CODE_SEL	9	/* 3 APM segments must be consecutive */
+#define	GAPM16CODE_SEL	10	/* and in the specified order: code32 */
+#define	GAPMDATA_SEL	11	/* code16 and then data per APM spec */
+#define	GBIOSCODE_SEL	12
+#define	GBIOSDATA_SEL	13
+#define	GPNPBIOSCODE_SEL 14
+#define	GPNPBIOSDATA_SEL 15
+#define	GPNPBIOSSCRATCH_SEL 16
+#define	GPNPBIOSTRAMP_SEL 17
+#define GTRAPTSS_SEL	18
+#define GIPITSS_SEL	19
+#define GUCODEBIG_SEL	20	/* User code with executable stack */
+#define	GUFS_SEL	21	/* Per-thread %fs */
+#define	GUGS_SEL	22	/* Per-thread %gs */
+#define	NGDT		23
+
+/*
+ * Entries in the Local Descriptor Table (LDT).
+ * DO NOT ADD KERNEL DATA/CODE SEGMENTS TO THIS TABLE.
+ */
+#define	LSYS5CALLS_SEL	0	/* iBCS system call gate */
+#define	LSYS5SIGR_SEL	1	/* iBCS sigreturn gate */
+#define	LUCODE_SEL	2	/* User code descriptor */
+#define	LUDATA_SEL	3	/* User data descriptor */
+#define	LSOL26CALLS_SEL	4	/* Solaris 2.6 system call gate */
+#define	LUCODEBIG_SEL	5	/* User code with executable stack */
+#define	LBSDICALLS_SEL	16	/* BSDI system call gate */
+#define	NLDT		17
+
+#endif /* _I386_SEGMENTS_H_ */

Property changes on: lab4/.minix-src/include/i386/segments.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/math.h
===================================================================
--- lab4/.minix-src/include/i386/math.h	(nonexistent)
+++ lab4/.minix-src/include/i386/math.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: math.h,v 1.5 2003/10/22 11:54:23 kleink Exp $	*/
+
+#include <x86/math.h>

Property changes on: lab4/.minix-src/include/i386/math.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/setjmp.h
===================================================================
--- lab4/.minix-src/include/i386/setjmp.h	(nonexistent)
+++ lab4/.minix-src/include/i386/setjmp.h	(revision 13)
@@ -0,0 +1,7 @@
+/*	$NetBSD: setjmp.h,v 1.2 1998/09/14 21:31:52 thorpej Exp $	*/
+
+/*
+ * machine/setjmp.h: machine dependent setjmp-related information.
+ */
+
+#define	_JBLEN	13		/* size, in longs, of a jmp_buf */

Property changes on: lab4/.minix-src/include/i386/setjmp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/tss.h
===================================================================
--- lab4/.minix-src/include/i386/tss.h	(nonexistent)
+++ lab4/.minix-src/include/i386/tss.h	(revision 13)
@@ -0,0 +1,79 @@
+/*	$NetBSD: tss.h,v 1.10 2008/01/05 21:45:00 yamt Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tss.h	5.4 (Berkeley) 1/18/91
+ */
+
+#ifndef _I386_TSS_H_
+#define _I386_TSS_H_
+
+/*
+ * Intel 386 Context Data Type
+ */
+
+struct i386tss {
+	int	__tss_link;
+	int	tss_esp0; 	/* kernel stack pointer at privilege level 0 */
+	int	tss_ss0;	/* kernel stack segment at privilege level 0 */
+	int	__tss_esp1;
+	int	__tss_ss1;
+	int	__tss_esp2;
+	int	__tss_ss2;
+	int	tss_cr3;	/* page directory paddr */
+	int	__tss_eip;
+	int	__tss_eflags;
+	int	__tss_eax; 
+	int	__tss_ecx; 
+	int	__tss_edx; 
+	int	__tss_ebx; 
+	int	tss_esp;	/* saved stack pointer */
+	int	tss_ebp;	/* saved frame pointer */
+	int	__tss_esi; 
+	int	__tss_edi; 
+	int	__tss_es;
+	int	__tss_cs;
+	int	__tss_ss;
+	int	__tss_ds;
+	int	tss_fs;		/* saved segment register */
+	int	tss_gs;		/* saved segment register */
+	int	tss_ldt;	/* LDT selector */
+	int	tss_iobase;	/* options and I/O permission map offset */
+};
+
+/*
+ * I/O bitmap offset beyond TSS's segment limit means no bitmaps.
+ * (i.e. any I/O attempt generates an exception.)
+ */
+#define	IOMAP_INVALOFF	0xffff
+
+#endif /* #ifndef _I386_TSS_H_ */

Property changes on: lab4/.minix-src/include/i386/tss.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/spkr.h
===================================================================
--- lab4/.minix-src/include/i386/spkr.h	(nonexistent)
+++ lab4/.minix-src/include/i386/spkr.h	(revision 13)
@@ -0,0 +1,13 @@
+/*	$NetBSD: spkr.h,v 1.4 1998/04/15 21:40:27 drochner Exp $	*/
+
+/*
+ * spkr.h -- interface definitions for speaker ioctl()
+ */
+
+#ifndef _I386_SPKR_H_
+#define _I386_SPKR_H_
+
+#include <sys/ioctl.h>
+#include <dev/isa/spkrio.h>
+
+#endif /* _I386_SPKR_H_ */

Property changes on: lab4/.minix-src/include/i386/spkr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/specialreg.h
===================================================================
--- lab4/.minix-src/include/i386/specialreg.h	(nonexistent)
+++ lab4/.minix-src/include/i386/specialreg.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: specialreg.h,v 1.29 2003/02/26 21:29:03 fvdl Exp $	*/
+
+#include <x86/specialreg.h>

Property changes on: lab4/.minix-src/include/i386/specialreg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/multiboot.h
===================================================================
--- lab4/.minix-src/include/i386/multiboot.h	(nonexistent)
+++ lab4/.minix-src/include/i386/multiboot.h	(revision 13)
@@ -0,0 +1,276 @@
+#ifndef _MACHINE_MULTIBOOT_H /* LSC: FIXME: In MINIX this header is included everywhere... */
+#define _MACHINE_MULTIBOOT_H 1
+
+/*	$NetBSD: multiboot.h,v 1.8 2009/02/22 18:05:42 ahoka Exp $	*/
+
+/*-
+ * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Julio M. Merino Vidal.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Multiboot header structure.
+ */
+#define MULTIBOOT_HEADER_MAGIC		0x1BADB002
+#define MULTIBOOT_HEADER_MODS_ALIGNED	0x00000001
+#define MULTIBOOT_HEADER_WANT_MEMORY	0x00000002
+#define MULTIBOOT_HEADER_HAS_VBE	0x00000004
+#define MULTIBOOT_HEADER_HAS_ADDR	0x00010000
+
+#if defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))
+
+#if !defined(_LOCORE)
+
+#include <machine/types.h>
+
+struct multiboot_header {
+	uint32_t	mh_magic;
+	uint32_t	mh_flags;
+	uint32_t	mh_checksum;
+
+	/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
+	paddr_t		mh_header_addr;
+	paddr_t		mh_load_addr;
+	paddr_t		mh_load_end_addr;
+	paddr_t		mh_bss_end_addr;
+	paddr_t		mh_entry_addr;
+
+	/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */
+	uint32_t	mh_mode_type;
+	uint32_t	mh_width;
+	uint32_t	mh_height;
+	uint32_t	mh_depth;
+};
+#endif /* !defined(_LOCORE) */
+
+/*
+ * Symbols defined in locore.S.
+ */
+#if !defined(_LOCORE) && defined(_KERNEL)
+extern struct multiboot_header *Multiboot_Header;
+#endif /* !defined(_LOCORE) && defined(_KERNEL) */
+
+#endif /* defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))*/
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Multiboot information structure.
+ */
+#define MULTIBOOT_INFO_MAGIC			0x2BADB002
+#define MULTIBOOT_INFO_HAS_MEMORY		0x00000001
+#define MULTIBOOT_INFO_HAS_BOOT_DEVICE	0x00000002
+#define MULTIBOOT_INFO_HAS_CMDLINE		0x00000004
+#define MULTIBOOT_INFO_HAS_MODS		0x00000008
+#define MULTIBOOT_INFO_HAS_AOUT_SYMS	0x00000010
+#define MULTIBOOT_INFO_HAS_ELF_SYMS		0x00000020
+#define MULTIBOOT_INFO_HAS_MMAP		0x00000040
+#define MULTIBOOT_INFO_HAS_DRIVES		0x00000080
+#define MULTIBOOT_INFO_HAS_CONFIG_TABLE	0x00000100
+#define MULTIBOOT_INFO_HAS_LOADER_NAME	0x00000200
+#define MULTIBOOT_INFO_HAS_APM_TABLE	0x00000400
+#define MULTIBOOT_INFO_HAS_VBE			0x00000800
+#define MULTIBOOT_INFO_HAS_FRAMEBUFFER	0x00001000
+
+#if defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))
+
+#if !defined(_LOCORE)
+struct multiboot_info {
+	uint32_t	mi_flags;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */
+	uint32_t	mi_mem_lower;
+	uint32_t	mi_mem_upper;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */
+	uint8_t		mi_boot_device_part3;
+	uint8_t		mi_boot_device_part2;
+	uint8_t		mi_boot_device_part1;
+	uint8_t		mi_boot_device_drive;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */
+	char *		mi_cmdline;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */
+	uint32_t	mi_mods_count;
+	vaddr_t		mi_mods_addr;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */
+	uint32_t	mi_elfshdr_num;
+	uint32_t	mi_elfshdr_size;
+	vaddr_t		mi_elfshdr_addr;
+	uint32_t	mi_elfshdr_shndx;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */
+	uint32_t	mi_mmap_length;
+	vaddr_t		mi_mmap_addr;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */
+	uint32_t	mi_drives_length;
+	vaddr_t		mi_drives_addr;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */
+	void *		unused_mi_config_table;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */
+	char *		mi_loader_name;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */
+	void *		unused_mi_apm_table;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */
+	uint32_t vbe_control_info;
+	uint32_t vbe_mode_info;
+	uint16_t vbe_mode;
+	uint16_t vbe_interface_seg;
+	uint16_t vbe_interface_off;
+	uint16_t vbe_interface_len;
+
+	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_FRAMEBUFFER. */
+	uint64_t framebuffer_addr;
+	uint32_t framebuffer_pitch;
+	uint32_t framebuffer_width;
+	uint32_t framebuffer_height;
+	uint8_t framebuffer_bpp;
+#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
+#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB     1
+#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT	2
+	uint8_t framebuffer_type;
+	union
+	{
+		struct
+		{
+			uint32_t framebuffer_palette_addr;
+			uint16_t framebuffer_palette_num_colors;
+		};
+		struct
+		{
+			uint8_t framebuffer_red_field_position;
+			uint8_t framebuffer_red_mask_size;
+			uint8_t framebuffer_green_field_position;
+			uint8_t framebuffer_green_mask_size;
+			uint8_t framebuffer_blue_field_position;
+			uint8_t framebuffer_blue_mask_size;
+	    };
+	};
+};
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Drive information.  This describes an entry in the drives table as
+ * pointed to by mi_drives_addr.
+ */
+struct multiboot_drive {
+	uint32_t	md_length;
+	uint8_t		md_number;
+	uint8_t		md_mode;
+	uint16_t	md_cylinders;
+	uint8_t		md_heads;
+	uint8_t		md_sectors;
+
+	/* The variable-sized 'ports' field comes here, so this structure
+	 * can be longer. */
+};
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Memory mapping.  This describes an entry in the memory mappings table
+ * as pointed to by mi_mmap_addr.
+ *
+ * Be aware that mm_size specifies the size of all other fields *except*
+ * for mm_size.  In order to jump between two different entries, you
+ * have to count mm_size + 4 bytes.
+ */
+struct multiboot_mmap {
+	uint32_t	mm_size;
+	uint64_t	mm_base_addr;
+	uint64_t	mm_length;
+	uint32_t	mm_type;
+};
+
+/*
+ * Modules. This describes an entry in the modules table as pointed
+ * to by mi_mods_addr.
+ */
+
+struct multiboot_module {
+	uint32_t	mmo_start;
+	uint32_t	mmo_end;
+	char *		mmo_string;
+	uint32_t	mmo_reserved;
+};
+
+#endif /* !defined(_LOCORE) */
+
+#endif /* defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))*/
+
+#if defined(__minix)
+
+#ifndef __ASSEMBLY__
+typedef struct multiboot_info multiboot_info_t;
+typedef struct multiboot_module multiboot_module_t;
+typedef struct multiboot_mmap multiboot_memory_map_t;
+#endif
+
+#define MULTIBOOT_MEMORY_AVAILABLE              1
+#define MULTIBOOT_MAX_MODS     20
+
+#define mod_start mmo_start
+#define mod_end mmo_end
+
+#define mmap_addr mi_mmap_addr
+#define mmap_length mi_mmap_length
+
+#define MULTIBOOT_VIDEO_MODE 0x00000004
+#define MULTIBOOT_VIDEO_MODE_EGA 1
+#define MULTIBOOT_VIDEO_BUFFER 0xB8000
+
+#define MULTIBOOT_CONSOLE_LINES 25
+#define MULTIBOOT_CONSOLE_COLS 80
+
+#define MULTIBOOT_PARAM_BUF_SIZE 1024
+#endif /* defined(__minix) */
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Prototypes for public functions defined in multiboot.c.
+ */
+#if !defined(_LOCORE) && defined(_KERNEL)
+void		multiboot_pre_reloc(struct multiboot_info *);
+void		multiboot_post_reloc(void);
+void		multiboot_print_info(void);
+bool		multiboot_ksyms_addsyms_elf(void);
+#endif /* !defined(_LOCORE) */
+
+/* --------------------------------------------------------------------- */
+
+#endif /* _MACHINE_MULTIBOOT_H */

Property changes on: lab4/.minix-src/include/i386/multiboot.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/vmparam.h
===================================================================
--- lab4/.minix-src/include/i386/vmparam.h	(nonexistent)
+++ lab4/.minix-src/include/i386/vmparam.h	(revision 13)
@@ -0,0 +1,145 @@
+/*	$NetBSD: vmparam.h,v 1.81 2014/07/24 13:42:28 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vmparam.h	5.9 (Berkeley) 5/12/91
+ */
+
+#ifndef _I386_VMPARAM_H_
+#define _I386_VMPARAM_H_
+
+#include <sys/tree.h>
+#include <sys/mutex.h>
+
+/*
+ * Machine dependent constants for 386.
+ */
+
+/*
+ * Page size on the IA-32 is not variable in the traditional sense.
+ * We override the PAGE_* definitions to compile-time constants.
+ */
+#define	PAGE_SHIFT	12
+#define	PAGE_SIZE	(1 << PAGE_SHIFT)
+#define	PAGE_MASK	(PAGE_SIZE - 1)
+
+/*
+ * Virtual address space arrangement. On 386, both user and kernel
+ * share the address space, not unlike the vax.
+ * USRSTACK is the top (end) of the user stack. Immediately above the
+ * user stack is the page table map, and then kernel address space.
+ */
+#define	USRSTACK	VM_MAXUSER_ADDRESS
+
+/*
+ * Virtual memory related constants, all in bytes
+ */
+#define	MAXTSIZ		(256*1024*1024)		/* max text size */
+#ifndef DFLDSIZ
+#define	DFLDSIZ		(256*1024*1024)		/* initial data size limit */
+#endif
+#ifndef MAXDSIZ
+#define	MAXDSIZ		(3U*1024*1024*1024)	/* 3G max data size */
+#endif
+#ifndef MAXDSIZ_BU
+#define	MAXDSIZ_BU	(2U*1024*1024*1024 +	/* 2.5G max data size for */ \
+			 1U* 512*1024*1024)	/* bottom-up allocation */ \
+						/* could be a bit more */
+#endif
+#ifndef	DFLSSIZ
+#define	DFLSSIZ		(2*1024*1024)		/* initial stack size limit */
+#endif
+#ifndef	MAXSSIZ
+#define	MAXSSIZ		(64*1024*1024)		/* max stack size */
+#endif
+
+/*
+ * IA-32 can't do per-page execute permission, so instead we implement
+ * two executable segments for %cs, one that covers everything and one
+ * that excludes some of the address space (currently just the stack).
+ * I386_MAX_EXE_ADDR is the upper boundary for the smaller segment.
+ */
+#define I386_MAX_EXE_ADDR	(USRSTACK - MAXSSIZ)
+
+/*
+ * Size of User Raw I/O map
+ */
+#define	USRIOSIZE 	300
+
+/*
+ * Mach derived constants
+ */
+
+/* user/kernel map constants */
+#define VM_MIN_ADDRESS		((vaddr_t)0)
+#define	VM_MAXUSER_ADDRESS	((vaddr_t)(PDIR_SLOT_PTE << L2_SHIFT))
+#define	VM_MAX_ADDRESS		\
+	((vaddr_t)((PDIR_SLOT_PTE << L2_SHIFT) + (PDIR_SLOT_PTE << L1_SHIFT)))
+#define	VM_MIN_KERNEL_ADDRESS	((vaddr_t)(PDIR_SLOT_KERN << L2_SHIFT))
+#define	VM_MAX_KERNEL_ADDRESS	((vaddr_t)((PDIR_SLOT_KERN + NKL2_MAX_ENTRIES) << L2_SHIFT))
+
+/*
+ * The address to which unspecified mapping requests default
+ */
+#ifdef _KERNEL_OPT
+#include "opt_uvm.h"
+#include "opt_xen.h"
+#endif
+#define __USE_TOPDOWN_VM
+#define VM_DEFAULT_ADDRESS_TOPDOWN(da, sz) \
+    trunc_page(USRSTACK - MAXSSIZ - (sz))
+#define VM_DEFAULT_ADDRESS_BOTTOMUP(da, sz) \
+    round_page((vaddr_t)(da) + (vsize_t)MIN(maxdmap, MAXDSIZ_BU))
+
+/* XXX max. amount of KVM to be used by buffers. */
+#ifndef VM_MAX_KERNEL_BUF
+#define VM_MAX_KERNEL_BUF	(384 * 1024 * 1024)
+#endif
+
+/* virtual sizes (bytes) for various kernel submaps */
+#define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
+
+#define VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
+
+#ifdef XEN
+#define	VM_PHYSSEG_MAX		1
+#define	VM_NFREELIST		1
+#else
+#define	VM_PHYSSEG_MAX		32	/* 1 "hole" + 31 free lists */
+#define	VM_NFREELIST		4
+#define	VM_FREELIST_FIRST16	3
+#define	VM_FREELIST_FIRST1G	2
+#define	VM_FREELIST_FIRST4G	1
+#endif /* XEN */
+#define	VM_FREELIST_DEFAULT	0
+
+#endif /* _I386_VMPARAM_H_ */

Property changes on: lab4/.minix-src/include/i386/vmparam.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/trap.h
===================================================================
--- lab4/.minix-src/include/i386/trap.h	(nonexistent)
+++ lab4/.minix-src/include/i386/trap.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: trap.h,v 1.7 2003/02/26 21:29:03 fvdl Exp $	*/
+
+#include <x86/trap.h>

Property changes on: lab4/.minix-src/include/i386/trap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/sysarch.h
===================================================================
--- lab4/.minix-src/include/i386/sysarch.h	(nonexistent)
+++ lab4/.minix-src/include/i386/sysarch.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: sysarch.h,v 1.18 2007/04/16 19:12:19 ad Exp $	*/
+
+#include <x86/sysarch.h>

Property changes on: lab4/.minix-src/include/i386/sysarch.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/pcb.h
===================================================================
--- lab4/.minix-src/include/i386/pcb.h	(nonexistent)
+++ lab4/.minix-src/include/i386/pcb.h	(revision 13)
@@ -0,0 +1,110 @@
+/*	$NetBSD: pcb.h,v 1.54 2014/04/21 19:13:22 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1998, 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum, and by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)pcb.h	5.10 (Berkeley) 5/12/91
+ */
+
+/*
+ * Intel 386 process control block
+ */
+
+#ifndef _I386_PCB_H_
+#define _I386_PCB_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_multiprocessor.h"
+#endif
+
+#include <machine/segments.h>
+#include <x86/cpu_extended_state.h>
+
+struct pcb {
+	int	pcb_esp0;		/* ring0 esp */
+	int	pcb_esp;		/* kernel esp */
+	int	pcb_ebp;		/* kernel ebp */
+	int	pcb_cr0;		/* saved image of CR0 */
+	int	pcb_cr2;		/* page fault address (CR2) */
+	int	pcb_cr3;		/* page directory pointer */
+	int	pcb_iopl;		/* i/o privilege level */
+
+	struct segment_descriptor pcb_fsd;	/* %fs descriptor */
+	struct segment_descriptor pcb_gsd; 	/* %gs descriptor */
+	void 	*pcb_onfault;		/* copyin/out fault recovery */
+	int	vm86_eflags;		/* virtual eflags for vm86 mode */
+	int	vm86_flagmask;		/* flag mask for vm86 mode */
+	void	*vm86_userp;		/* XXX performance hack */
+	char	*pcb_iomap;		/* I/O permission bitmap */
+
+	int	not_used[15];
+
+	/* floating point state */
+	struct cpu_info	*pcb_fpcpu;	/* cpu holding our fp state. */
+	union savefpu	pcb_savefpu __aligned(64);
+	/* **** DO NOT ADD ANYTHING HERE **** */
+
+};
+#ifndef __lint__
+/* This doesn't really matter, but there is a lot of implied padding */
+__CTASSERT(sizeof(struct pcb) - sizeof (union savefpu) == 128);
+#endif
+
+#endif /* _I386_PCB_H_ */

Property changes on: lab4/.minix-src/include/i386/pcb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/isofs/cd9660/cd9660_node.h
===================================================================
--- lab4/.minix-src/include/isofs/cd9660/cd9660_node.h	(nonexistent)
+++ lab4/.minix-src/include/isofs/cd9660/cd9660_node.h	(revision 13)
@@ -0,0 +1,134 @@
+/*	$NetBSD: cd9660_node.h,v 1.16 2014/06/16 09:55:49 hannken Exp $	*/
+
+/*-
+ * Copyright (c) 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley
+ * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
+ * Support code is derived from software contributed to Berkeley
+ * by Atsushi Murai (amurai@spec.co.jp).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)cd9660_node.h	8.6 (Berkeley) 5/14/95
+ */
+
+#ifndef _ISOFS_CD9660_CD9660_NODE_H_
+#define _ISOFS_CD9660_CD9660_NODE_H_
+
+#include <miscfs/genfs/genfs_node.h>
+
+/*
+ * Theoretically, directories can be more than 2Gb in length,
+ * however, in practice this seems unlikely. So, we define
+ * the type doff_t as a long to keep down the cost of doing
+ * lookup on a 32-bit machine. If you are porting to a 64-bit
+ * architecture, you should make doff_t the same as off_t.
+ */
+#define doff_t	long
+
+typedef	struct	{
+	struct timespec	iso_atime;	/* time of last access */
+	struct timespec	iso_mtime;	/* time of last modification */
+	struct timespec	iso_ctime;	/* time file changed */
+	u_short		iso_mode;	/* files access mode and type */
+	uid_t		iso_uid;	/* owner user id */
+	gid_t		iso_gid;	/* owner group id */
+	short		iso_links;	/* links of file */
+	dev_t		iso_rdev;	/* Major/Minor number for special */
+} ISO_RRIP_INODE;
+
+struct iso_node {
+	struct	genfs_node i_gnode;
+	struct	vnode *i_vnode;	/* vnode associated with this inode */
+	struct	vnode *i_devvp;	/* vnode for block I/O */
+	u_long	i_flag;		/* see below */
+	dev_t	i_dev;		/* device where inode resides */
+	ino_t	i_number;	/* the identity of the inode */
+				/* we use the actual starting block of the file */
+	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */
+	struct	lockf *i_lockf;	/* head of byte-level lock list */
+	doff_t	i_endoff;	/* end of useful stuff in directory */
+	doff_t	i_diroff;	/* offset in dir, where we found last entry */
+	doff_t	i_offset;	/* offset of free space in directory */
+	ino_t	i_ino;		/* inode number of found directory */
+
+	unsigned long iso_extent;	/* extent of file */
+	unsigned long i_size;
+	unsigned long iso_start;		/* actual start of data of file (may be different */
+				/* from iso_extent, if file has extended attributes) */
+	ISO_RRIP_INODE  inode;
+};
+
+#define	i_forw		i_chain[0]
+#define	i_back		i_chain[1]
+
+/* flags */
+#define	IN_ACCESS	0x0020		/* inode access time to be updated */
+
+#define VTOI(vp) ((struct iso_node *)(vp)->v_data)
+#define ITOV(ip) ((ip)->i_vnode)
+
+#ifdef _KERNEL
+/*
+ * Prototypes for ISOFS vnode operations
+ */
+int	cd9660_lookup(void *);
+#define	cd9660_open	genfs_nullop
+#define	cd9660_close	genfs_nullop
+int	cd9660_access(void *);
+int	cd9660_getattr(void *);
+int	cd9660_read(void *);
+#define	cd9660_ioctl	genfs_enoioctl
+#define	cd9660_poll	genfs_poll
+#define	cd9660_mmap	genfs_mmap
+#define	cd9660_seek	genfs_seek
+int	cd9660_readdir(void *);
+int	cd9660_readlink(void *);
+#define	cd9660_abortop	genfs_abortop
+int	cd9660_inactive(void *);
+int	cd9660_reclaim(void *);
+int	cd9660_link(void *);
+int	cd9660_symlink(void *);
+int	cd9660_bmap(void *);
+int	cd9660_lock(void *);
+int	cd9660_unlock(void *);
+int	cd9660_strategy(void *);
+int	cd9660_print(void *);
+int	cd9660_islocked(void *);
+int	cd9660_pathconf(void *);
+int	cd9660_setattr(void *);
+
+int	cd9660_blkatoff(struct vnode *, off_t, char **, struct buf **);
+void	cd9660_defattr(struct iso_directory_record *,
+			struct iso_node *, struct buf *);
+void	cd9660_deftstamp(struct iso_directory_record *,
+			struct iso_node *, struct buf *);
+int	cd9660_tstamp_conv7(const u_char *, struct timespec *);
+int	cd9660_tstamp_conv17(const u_char *, struct timespec *);
+
+#endif /* _KERNEL */
+#endif /* _ISOFS_CD9660_CD9660_NODE_H_ */

Property changes on: lab4/.minix-src/include/isofs/cd9660/cd9660_node.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/vm86.h
===================================================================
--- lab4/.minix-src/include/i386/vm86.h	(nonexistent)
+++ lab4/.minix-src/include/i386/vm86.h	(revision 13)
@@ -0,0 +1,167 @@
+/*	$NetBSD: vm86.h,v 1.19 2009/11/21 03:11:01 rmind Exp $	*/
+
+#undef	VM86_USE_VIF
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by John T. Kohl and Charles M. Hannum.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define SETFLAGS(targ, new, newmask) (targ) = ((targ) & ~(newmask)) | ((new) & (newmask))
+
+#define VM86_TYPE(x)	((x) & 0xff)
+#define VM86_ARG(x)	(((x) & 0xff00) >> 8)
+#define	VM86_MAKEVAL(type,arg) ((type) | (((arg) & 0xff) << 8))
+#define		VM86_STI	0
+#define		VM86_INTx	1
+#define		VM86_SIGNAL	2
+#define		VM86_UNKNOWN	3
+
+#define	VM86_REALFLAGS	(~PSL_USERSTATIC)
+#define	VM86_VIRTFLAGS	(PSL_USERSTATIC & ~(PSL_MBO | PSL_MBZ))
+
+struct vm86_kern {			/* kernel uses this stuff */
+	__gregset_t regs;
+	unsigned long ss_cpu_type;
+};
+#define cpu_type substr.ss_cpu_type
+
+/*
+ * Kernel keeps copy of user-mode address of this, but doesn't copy it in.
+ */
+struct vm86_struct {
+	struct vm86_kern substr;
+	unsigned long screen_bitmap;	/* not used/supported (yet) */
+	unsigned long flags;		/* not used/supported (yet) */
+	unsigned char int_byuser[32];	/* 256 bits each: pass control to user */
+	unsigned char int21_byuser[32];	/* otherwise, handle directly */
+};
+
+#define VCPU_086		0
+#define VCPU_186		1
+#define VCPU_286		2
+#define VCPU_386		3
+#define VCPU_486		4
+#define VCPU_586		5
+
+#ifdef _KERNEL
+int x86_vm86(struct lwp *, char *, register_t *);
+int compat_16_x86_vm86(struct lwp *, char *, register_t *);
+void vm86_gpfault(struct lwp *, int);
+void vm86_return(struct lwp *, int);
+static __inline void clr_vif(struct lwp *);
+static __inline void set_vif(struct lwp *);
+static __inline void set_vflags(struct lwp *, int);
+static __inline int get_vflags(struct lwp *);
+static __inline void set_vflags_short(struct lwp *, int);
+static __inline int get_vflags_short(struct lwp *);
+
+static __inline void
+clr_vif(struct lwp *l)
+{
+	struct pcb *pcb = lwp_getpcb(l);
+
+#ifndef VM86_USE_VIF
+	pcb->vm86_eflags &= ~PSL_I;
+#else
+	pcb->vm86_eflags &= ~PSL_VIF;
+#endif
+}
+
+static __inline void
+set_vif(struct lwp *l)
+{
+	struct pcb *pcb = lwp_getpcb(l);
+
+#ifndef VM86_USE_VIF
+	pcb->vm86_eflags |= PSL_I;
+	if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP))
+#else
+	pcb->vm86_eflags |= PSL_VIF;
+	if ((pcb->vm86_eflags & (PSL_VIF|PSL_VIP)) == (PSL_VIF|PSL_VIP))
+#endif
+		vm86_return(l, VM86_STI);
+}
+
+static __inline void
+set_vflags(struct lwp *l, int flags)
+{
+	struct trapframe *tf = l->l_md.md_regs;
+	struct pcb *pcb = lwp_getpcb(l);
+
+	flags &= ~pcb->vm86_flagmask;
+	SETFLAGS(pcb->vm86_eflags, flags, VM86_VIRTFLAGS);
+	SETFLAGS(tf->tf_eflags, flags, VM86_REALFLAGS);
+#ifndef VM86_USE_VIF
+	if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP))
+#else
+	if ((pcb->vm86_eflags & (PSL_VIF|PSL_VIP)) == (PSL_VIF|PSL_VIP))
+#endif
+		vm86_return(l, VM86_STI);
+}
+
+static __inline int
+get_vflags(struct lwp *l)
+{
+	struct trapframe *tf = l->l_md.md_regs;
+	struct pcb *pcb = lwp_getpcb(l);
+	int flags = PSL_MBO;
+
+	SETFLAGS(flags, pcb->vm86_eflags, VM86_VIRTFLAGS);
+	SETFLAGS(flags, tf->tf_eflags, VM86_REALFLAGS);
+	return (flags);
+}
+
+static __inline void
+set_vflags_short(struct lwp *l, int flags)
+{
+	struct trapframe *tf = l->l_md.md_regs;
+	struct pcb *pcb = lwp_getpcb(l);
+
+	flags &= ~pcb->vm86_flagmask;
+	SETFLAGS(pcb->vm86_eflags, flags, VM86_VIRTFLAGS & 0xffff);
+	SETFLAGS(tf->tf_eflags, flags, VM86_REALFLAGS & 0xffff);
+#ifndef VM86_USE_VIF
+	if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP))
+		vm86_return(l, VM86_STI);
+#endif
+}
+
+static __inline int
+get_vflags_short(struct lwp *l)
+{
+	struct trapframe *tf = l->l_md.md_regs;
+	struct pcb *pcb = lwp_getpcb(l);
+	int flags = PSL_MBO;
+
+	SETFLAGS(flags, pcb->vm86_eflags, VM86_VIRTFLAGS & 0xffff);
+	SETFLAGS(flags, tf->tf_eflags, VM86_REALFLAGS & 0xffff);
+	return (flags);
+}
+#else
+int i386_vm86(struct vm86_struct *vmcp);
+#endif

Property changes on: lab4/.minix-src/include/i386/vm86.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/vm.h
===================================================================
--- lab4/.minix-src/include/i386/vm.h	(nonexistent)
+++ lab4/.minix-src/include/i386/vm.h	(revision 13)
@@ -0,0 +1,103 @@
+#ifndef __SYS_VM_386_H__
+#define __SYS_VM_386_H__
+/*
+i386/vm.h
+*/
+
+#define I386_PAGE_SIZE		4096
+#define I386_BIG_PAGE_SIZE	(I386_PAGE_SIZE*I386_VM_PT_ENTRIES)
+
+/* i386 paging constants */
+#define I386_VM_PRESENT	0x001	/* Page is present */
+#define I386_VM_WRITE	0x002	/* Read/write access allowed */
+#define I386_VM_READ	0x000	/* Read access only */
+#define I386_VM_USER	0x004	/* User access allowed */
+#define I386_VM_PWT	0x008	/* Write through */
+#define I386_VM_PCD	0x010	/* Cache disable */
+#define I386_VM_ACC	0x020	/* Accessed */
+#define I386_VM_ADDR_MASK 0xFFFFF000 /* physical address */
+#define I386_VM_ADDR_MASK_4MB 0xFFC00000 /* physical address */
+#define I386_VM_OFFSET_MASK_4MB 0x003FFFFF /* physical address */
+
+/* Page directory specific flags. */
+#define I386_VM_BIGPAGE	0x080	/* 4MB page */
+
+/* Page table specific flags. */
+#define I386_VM_DIRTY    (1L<< 6)	/* Dirty */
+#define I386_VM_PS  	 (1L<< 7)	/* Page size. */
+#define I386_VM_GLOBAL   (1L<< 8)	/* Global. */
+#define I386_VM_PTAVAIL1 (1L<< 9)	/* Available for use. */
+#define I386_VM_PTAVAIL2 (1L<<10)	/* Available for use. */
+#define I386_VM_PTAVAIL3 (1L<<11)	/* Available for use. */
+
+#define I386_VM_PT_ENT_SIZE	4	/* Size of a page table entry */
+#define I386_VM_DIR_ENTRIES	1024	/* Number of entries in a page dir */
+#define I386_VM_DIR_ENT_SHIFT	22	/* Shift to get entry in page dir. */
+#define I386_VM_PT_ENT_SHIFT	12	/* Shift to get entry in page table */
+#define I386_VM_PT_ENT_MASK	0x3FF	/* Mask to get entry in page table */
+#define I386_VM_PT_ENTRIES	1024	/* Number of entries in a page table */
+#define I386_VM_PFA_SHIFT	22	/* Page frame address shift */
+
+/* CR0 bits */
+#define I386_CR0_PE		0x00000001	/* Protected mode  */
+#define I386_CR0_MP		0x00000002	/* Monitor Coprocessor  */
+#define I386_CR0_EM		0x00000004	/* Emulate  */
+#define I386_CR0_TS		0x00000008	/* Task Switched  */
+#define I386_CR0_ET		0x00000010	/* Extension Type  */
+#define I386_CR0_WP		0x00010000	/* Enable paging */
+#define I386_CR0_PG		0x80000000	/* Enable paging */
+
+/* some CR4 bits */
+#define I386_CR4_VME		0x00000001	/* Virtual 8086 */
+#define I386_CR4_PVI		0x00000002	/* Virtual ints */
+#define I386_CR4_TSD		0x00000004	/* RDTSC privileged */
+#define I386_CR4_DE		0x00000008	/* Debugging extensions */
+#define I386_CR4_PSE		0x00000010	/* Page size extensions */
+#define I386_CR4_PAE		0x00000020	/* Physical addr extens. */
+#define I386_CR4_MCE		0x00000040	/* Machine check enable */
+#define I386_CR4_PGE		0x00000080	/* Global page flag enable */
+
+/* i386 paging 'functions' */
+#define I386_VM_PTE(v)	(((v) >> I386_VM_PT_ENT_SHIFT) & I386_VM_PT_ENT_MASK)
+#define I386_VM_PDE(v)	( (v) >> I386_VM_DIR_ENT_SHIFT)
+#define I386_VM_PFA(e)	( (e) & I386_VM_ADDR_MASK)
+#define I386_VM_PAGE(v)	( (v) >> I386_VM_PFA_SHIFT)
+
+/* i386 pagefault error code bits */
+#define I386_VM_PFE_P	0x01	/* Pagefault caused by non-present page.
+				 * (otherwise protection violation.)
+				 */
+#define I386_VM_PFE_W	0x02	/* Caused by write (otherwise read) */
+#define I386_VM_PFE_U	0x04	/* CPU in user mode (otherwise supervisor) */
+
+/* CPUID flags */
+#define CPUID1_EDX_FPU		(1L)		/* FPU presence */
+#define CPUID1_EDX_PSE 		(1L <<  3)	/* Page Size Extension */
+#define CPUID1_EDX_SYSENTER	(1L << 11)	/* Intel SYSENTER */
+#define CPUID1_EDX_PAE 		(1L << 6)	/* Physical Address Extension */
+#define CPUID1_EDX_PGE 		(1L << 13)	/* Page Global (bit) Enable */
+#define CPUID1_EDX_APIC_ON_CHIP (1L << 9)	/* APIC is present on the chip */
+#define CPUID1_EDX_TSC		(1L << 4)	/* Timestamp counter present */
+#define CPUID1_EDX_HTT		(1L << 28)	/* Supports HTT */
+#define CPUID1_EDX_FXSR		(1L << 24)
+#define CPUID1_EDX_SSE		(1L << 25)
+#define CPUID1_EDX_SSE2		(1L << 26)
+#define CPUID1_ECX_SSE3		(1L)
+#define CPUID1_ECX_SSSE3	(1L << 9)
+#define CPUID1_ECX_SSE4_1	(1L << 19)
+#define CPUID1_ECX_SSE4_2	(1L << 20)
+
+#define CPUID_EF_EDX_SYSENTER	(1L << 11)	/* Intel SYSENTER */
+
+#ifndef __ASSEMBLY__
+
+#include <minix/type.h>
+
+/* structure used by VM to pass data to the kernel while enabling paging */
+struct vm_ep_data {
+	struct mem_map	* mem_map;
+	vir_bytes	data_seg_limit;
+};
+#endif
+
+#endif /* __SYS_VM_386_H__ */

Property changes on: lab4/.minix-src/include/i386/vm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/isofs/cd9660/cd9660_extern.h
===================================================================
--- lab4/.minix-src/include/isofs/cd9660/cd9660_extern.h	(nonexistent)
+++ lab4/.minix-src/include/isofs/cd9660/cd9660_extern.h	(revision 13)
@@ -0,0 +1,115 @@
+/*	$NetBSD: cd9660_extern.h,v 1.26 2013/06/23 07:28:36 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley
+ * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
+ * Support code is derived from software contributed to Berkeley
+ * by Atsushi Murai (amurai@spec.co.jp).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)iso.h	8.4 (Berkeley) 12/5/94
+ */
+
+/*
+ * Definitions used in the kernel for cd9660 file system support.
+ */
+#ifndef _ISOFS_CD9660_CD9660_EXTERN_H_
+#define _ISOFS_CD9660_CD9660_EXTERN_H_
+
+/*
+ * Sysctl values for the cd9660 filesystem.
+ */
+#define CD9660_UTF8_JOLIET	1	/* UTF-8 encode Joliet file names */
+
+#define CD9660_NAMES { \
+        { 0, 0 }, \
+        { "utf8_joliet", CTLTYPE_INT }, \
+}
+
+
+/* CD-ROM Format type */
+enum ISO_FTYPE  { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP, ISO_FTYPE_ECMA };
+
+#ifndef	ISOFSMNT_ROOT
+#define	ISOFSMNT_ROOT	0
+#endif
+
+struct iso_mnt {
+	int im_flags;
+	int im_joliet_level;
+
+	struct mount *im_mountp;
+	dev_t im_dev;
+	struct vnode *im_devvp;
+
+	int logical_block_size;
+	int im_bshift;
+	int im_bmask;
+
+	int volume_space_size;
+
+	char root[ISODCL (157, 190)];
+	int root_extent;
+	int root_size;
+	enum ISO_FTYPE  iso_ftype;
+
+	int rr_skip;
+	int rr_skip0;
+};
+
+#define VFSTOISOFS(mp)	((struct iso_mnt *)((mp)->mnt_data))
+
+#define cd9660_blkoff(imp, loc)		((loc) & (imp)->im_bmask)
+#define cd9660_lblktosize(imp, blk)	((blk) << (imp)->im_bshift)
+#define cd9660_lblkno(imp, loc)	((loc) >> (imp)->im_bshift)
+#define cd9660_blksize(imp, ip, lbn)	((imp)->logical_block_size)
+
+#ifdef _KERNEL
+
+VFS_PROTOS(cd9660);
+
+#include <sys/mallocvar.h>
+MALLOC_DECLARE(M_ISOFSMNT);
+
+extern struct pool cd9660_node_pool;
+extern int cd9660_utf8_joliet;
+
+int cd9660_mountroot(void);
+
+extern int (**cd9660_vnodeop_p)(void *);
+extern int (**cd9660_specop_p)(void *);
+extern int (**cd9660_fifoop_p)(void *);
+
+int isochar(const u_char *, const u_char *, int, u_int16_t *);
+int isofncmp(const u_char *, size_t, const u_char *, size_t, int);
+void isofntrans(const u_char *, int, u_char *, u_short *, int, int, int, int);
+ino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
+#endif /* _KERNEL */
+
+#endif /* _ISOFS_CD9660_CD9660_EXTERN_H_ */

Property changes on: lab4/.minix-src/include/isofs/cd9660/cd9660_extern.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/isofs/cd9660/cd9660_mount.h
===================================================================
--- lab4/.minix-src/include/isofs/cd9660/cd9660_mount.h	(nonexistent)
+++ lab4/.minix-src/include/isofs/cd9660/cd9660_mount.h	(revision 13)
@@ -0,0 +1,59 @@
+/*	$NetBSD: cd9660_mount.h,v 1.6 2005/12/03 17:34:43 christos Exp $	*/
+/*
+ * Copyright (c) 1995
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley
+ * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
+ * Support code is derived from software contributed to Berkeley
+ * by Atsushi Murai (amurai@spec.co.jp).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)cd9660_mount.h	8.1 (Berkeley) 5/24/95
+ */
+
+#ifndef _ISOFS_CD9660_CD9660_MOUNT_H_
+#define _ISOFS_CD9660_CD9660_MOUNT_H_
+
+/*
+ * Arguments to mount ISO 9660 filesystems.
+ */
+struct iso_args {
+	const char	*fspec;		/* block special device to mount */
+	struct	export_args30 _pad1; /* compat with old userland tools */
+	int	flags;			/* mounting flags, see below */
+};
+#define	ISOFSMNT_NORRIP		0x00000001 /* disable Rock Ridge Ext.*/
+#define	ISOFSMNT_GENS		0x00000002 /* enable generation numbers */
+#define	ISOFSMNT_EXTATT		0x00000004 /* enable extended attributes */
+#define	ISOFSMNT_NOJOLIET	0x00000008 /* disable Joliet extensions */
+#define	ISOFSMNT_NOCASETRANS	0x00000010 /* do not make names lower case */
+#define	ISOFSMNT_RRCASEINS	0x00000020 /* case insensitive Rock Ridge */
+
+#define ISOFSMNT_BITS "\177\20" \
+    "b\00norrip\0b\01gens\0b\02extatt\0b\03nojoliet\0" \
+    "b\04nocasetrans\0b\05rrcaseins\0"
+#endif /* _ISOFS_CD9660_CD9660_MOUNT_H_ */

Property changes on: lab4/.minix-src/include/isofs/cd9660/cd9660_mount.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lcom/lab2.h
===================================================================
--- lab4/.minix-src/include/lcom/lab2.h	(nonexistent)
+++ lab4/.minix-src/include/lcom/lab2.h	(revision 13)
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <stdint.h>
+
+#include "timer.h"
+#include "utils.h"
+
+/**
+ * @brief Tests display of timer config
+ *
+ * Just calls timer_get_conf() followed by timer_display_conf()
+ *
+ * @param timer Timer whose config to read (Ranges from 0 to 2)
+ * @param field  Configuration field to display
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (timer_test_read_config)(uint8_t timer, enum timer_status_field field);
+
+/**
+ * @brief Tests change of Timer O interrupt frequency
+ *
+ * Programs Timer 0 to generate interrupts with input frequency
+ *
+ * @param timer Timer whose time-base should be changed (Ranges from 0 to 2)
+ * @param freq Frequency of interrupts to generate
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (timer_test_time_base)(uint8_t timer, uint32_t freq);
+
+/**
+ * @brief Tests Timer 0 interrupt handling
+ *
+ * Subscribes Timer 0 interrupts and prints a message once
+ *  per second for the specified time interval
+ *
+ * @param time Length of time interval while interrupts are subscribed
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (timer_test_int)(uint8_t time);

Property changes on: lab4/.minix-src/include/lcom/lab2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lcom/liblm.h
===================================================================
--- lab4/.minix-src/include/lcom/liblm.h	(nonexistent)
+++ lab4/.minix-src/include/lcom/liblm.h	(revision 13)
@@ -0,0 +1,62 @@
+#pragma once
+
+/** @defgroup liblm liblm
+ * @{
+ *
+ * Functions related to low memory (first 1 MB of physical memory), required for BIOS
+ */
+
+#include <stdbool.h>
+
+#include <minix/syslib.h>
+
+#define PB2BASE(x) (((x) >> 4) & 0x0F000) // phys_bytes to segment base
+#define PB2OFF(x) ((x) & (0x0FFFF))       // phys_bytes to segment offset
+
+/** @name Memory Map Struct*/
+/**@{
+ *
+ * Struct that keeps info regarding the mapping of physical memory to virtual memory
+ */
+typedef struct {
+  phys_bytes phys; /**< @brief physical address */
+  void *virt;      /**< @brief virtual address */
+  size_t size;     /**< @brief size of mapped memory region */
+} mmap_t;
+
+/** @} end of Memory Map Struct */
+
+/**
+ * @brief Initializes the low memory area, the region up to the 1 MByte physical address, by mapping it on the process' physical memory address
+ * 
+ * @param enable_logging set whether log messages should be printed or not
+ *
+ * @return virtual address on which the first 1 MB was mapped, NULL upon failure
+ */
+void *lm_init(bool enable_logging);
+
+/**
+ * @brief Allocates a memory block in low memory area with the specified size
+ * 
+ * Allocates a memory block in the region up to the 1 MByte physical address with the input size,
+ *  and initializes the input mmap_t struct with the mapping information.
+ * 
+ * @param size size of the memory block to allocate
+ * @param map pointer to mmap_t data structure, which represents the memory map
+ * @return the virtual address of the memory block on success, NULL otherwise
+ */
+void *lm_alloc(size_t size, mmap_t *map);
+
+/**
+ * @brief Frees a memory block in the low memory area, previously allocated using lm_alloc()
+ * 
+ * Frees a memory block in the region up to the 1 MByte physical address, previously
+ *  allocated using lm_alloc(). Takes as input the address of the mmap_t structure that
+ *  was passed to lm_alloc(), and that must have not been modified since.
+ * 
+ * @param map pointer to mmap_t data structure of the block being freed
+ * @return a boolean indicating whether memory deallocation succeeded
+ */
+bool lm_free(const mmap_t *map);
+
+/** @} end of liblm */

Property changes on: lab4/.minix-src/include/lcom/liblm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/isofs/cd9660/iso.h
===================================================================
--- lab4/.minix-src/include/isofs/cd9660/iso.h	(nonexistent)
+++ lab4/.minix-src/include/isofs/cd9660/iso.h	(revision 13)
@@ -0,0 +1,245 @@
+/*	$NetBSD: iso.h,v 1.10 2011/09/27 01:01:44 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley
+ * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
+ * Support code is derived from software contributed to Berkeley
+ * by Atsushi Murai (amurai@spec.co.jp).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)iso.h	8.6 (Berkeley) 5/10/95
+ */
+
+/*
+ * Definitions describing ISO9660 file system structure, as well as
+ * the functions necessary to access fields of ISO9660 file system
+ * structures.
+ */
+
+#ifndef _ISOFS_CD9660_ISO_H_
+#define _ISOFS_CD9660_ISO_H_
+
+#define ISODCL(from, to) (to - from + 1)
+
+struct iso_volume_descriptor {
+	char type[ISODCL(1,1)]; /* 711 */
+	char id[ISODCL(2,6)];
+	char version[ISODCL(7,7)];
+	char data[ISODCL(8,2048)];
+};
+
+/* volume descriptor types */
+#define ISO_VD_PRIMARY 1
+#define ISO_VD_SUPPLEMENTARY 2
+#define ISO_VD_END 255
+
+#define ISO_STANDARD_ID "CD001"
+#define ISO_ECMA_ID     "CDW01"
+
+#define	ISO_MAXNAMLEN	255
+
+struct iso_primary_descriptor {
+	char type			[ISODCL (  1,   1)]; /* 711 */
+	char id				[ISODCL (  2,   6)];
+	char version			[ISODCL (  7,   7)]; /* 711 */
+	char unused1			[ISODCL (  8,   8)];
+	char system_id			[ISODCL (  9,  40)]; /* achars */
+	char volume_id			[ISODCL ( 41,  72)]; /* dchars */
+	char unused2			[ISODCL ( 73,  80)];
+	char volume_space_size		[ISODCL ( 81,  88)]; /* 733 */
+	char unused3			[ISODCL ( 89, 120)];
+	char volume_set_size		[ISODCL (121, 124)]; /* 723 */
+	char volume_sequence_number	[ISODCL (125, 128)]; /* 723 */
+	char logical_block_size		[ISODCL (129, 132)]; /* 723 */
+	char path_table_size		[ISODCL (133, 140)]; /* 733 */
+	char type_l_path_table		[ISODCL (141, 144)]; /* 731 */
+	char opt_type_l_path_table	[ISODCL (145, 148)]; /* 731 */
+	char type_m_path_table		[ISODCL (149, 152)]; /* 732 */
+	char opt_type_m_path_table	[ISODCL (153, 156)]; /* 732 */
+	char root_directory_record	[ISODCL (157, 190)]; /* 9.1 */
+	char volume_set_id		[ISODCL (191, 318)]; /* dchars */
+	char publisher_id		[ISODCL (319, 446)]; /* achars */
+	char preparer_id		[ISODCL (447, 574)]; /* achars */
+	char application_id		[ISODCL (575, 702)]; /* achars */
+	char copyright_file_id		[ISODCL (703, 739)]; /* 7.5 dchars */
+	char abstract_file_id		[ISODCL (740, 776)]; /* 7.5 dchars */
+	char bibliographic_file_id	[ISODCL (777, 813)]; /* 7.5 dchars */
+	char creation_date		[ISODCL (814, 830)]; /* 8.4.26.1 */
+	char modification_date		[ISODCL (831, 847)]; /* 8.4.26.1 */
+	char expiration_date		[ISODCL (848, 864)]; /* 8.4.26.1 */
+	char effective_date		[ISODCL (865, 881)]; /* 8.4.26.1 */
+	char file_structure_version	[ISODCL (882, 882)]; /* 711 */
+	char unused4			[ISODCL (883, 883)];
+	char application_data		[ISODCL (884, 1395)];
+	char unused5			[ISODCL (1396, 2048)];
+};
+#define ISO_DEFAULT_BLOCK_SIZE		2048
+
+struct iso_supplementary_descriptor {
+	char type			[ISODCL (  1,	1)]; /* 711 */
+	char id				[ISODCL (  2,	6)];
+	char version			[ISODCL (  7,	7)]; /* 711 */
+	char flags			[ISODCL (  8,	8)]; /* 711? */
+	char system_id			[ISODCL (  9,  40)]; /* achars */
+	char volume_id			[ISODCL ( 41,  72)]; /* dchars */
+	char unused2			[ISODCL ( 73,  80)];
+	char volume_space_size		[ISODCL ( 81,  88)]; /* 733 */
+	char escape			[ISODCL ( 89, 120)];
+	char volume_set_size		[ISODCL (121, 124)]; /* 723 */
+	char volume_sequence_number	[ISODCL (125, 128)]; /* 723 */
+	char logical_block_size		[ISODCL (129, 132)]; /* 723 */
+	char path_table_size		[ISODCL (133, 140)]; /* 733 */
+	char type_l_path_table		[ISODCL (141, 144)]; /* 731 */
+	char opt_type_l_path_table	[ISODCL (145, 148)]; /* 731 */
+	char type_m_path_table		[ISODCL (149, 152)]; /* 732 */
+	char opt_type_m_path_table	[ISODCL (153, 156)]; /* 732 */
+	char root_directory_record	[ISODCL (157, 190)]; /* 9.1 */
+	char volume_set_id		[ISODCL (191, 318)]; /* dchars */
+	char publisher_id		[ISODCL (319, 446)]; /* achars */
+	char preparer_id		[ISODCL (447, 574)]; /* achars */
+	char application_id		[ISODCL (575, 702)]; /* achars */
+	char copyright_file_id		[ISODCL (703, 739)]; /* 7.5 dchars */
+	char abstract_file_id		[ISODCL (740, 776)]; /* 7.5 dchars */
+	char bibliographic_file_id	[ISODCL (777, 813)]; /* 7.5 dchars */
+	char creation_date		[ISODCL (814, 830)]; /* 8.4.26.1 */
+	char modification_date		[ISODCL (831, 847)]; /* 8.4.26.1 */
+	char expiration_date		[ISODCL (848, 864)]; /* 8.4.26.1 */
+	char effective_date		[ISODCL (865, 881)]; /* 8.4.26.1 */
+	char file_structure_version	[ISODCL (882, 882)]; /* 711 */
+	char unused4			[ISODCL (883, 883)];
+	char application_data		[ISODCL (884, 1395)];
+	char unused5			[ISODCL (1396, 2048)];
+};
+
+struct iso_directory_record {
+	char length			[ISODCL (1, 1)]; /* 711 */
+	char ext_attr_length		[ISODCL (2, 2)]; /* 711 */
+	u_char extent			[ISODCL (3, 10)]; /* 733 */
+	u_char size			[ISODCL (11, 18)]; /* 733 */
+	char date			[ISODCL (19, 25)]; /* 7 by 711 */
+	char flags			[ISODCL (26, 26)];
+	char file_unit_size		[ISODCL (27, 27)]; /* 711 */
+	char interleave			[ISODCL (28, 28)]; /* 711 */
+	char volume_sequence_number	[ISODCL (29, 32)]; /* 723 */
+	char name_len			[ISODCL (33, 33)]; /* 711 */
+	char name			[1];			/* XXX */
+};
+/* can't take sizeof(iso_directory_record), because of possible alignment
+   of the last entry (34 instead of 33) */
+#define ISO_DIRECTORY_RECORD_SIZE	33
+
+struct iso_extended_attributes {
+	u_char owner			[ISODCL (1, 4)]; /* 723 */
+	u_char group			[ISODCL (5, 8)]; /* 723 */
+	u_char perm			[ISODCL (9, 10)]; /* 9.5.3 */
+	char ctime			[ISODCL (11, 27)]; /* 8.4.26.1 */
+	char mtime			[ISODCL (28, 44)]; /* 8.4.26.1 */
+	char xtime			[ISODCL (45, 61)]; /* 8.4.26.1 */
+	char ftime			[ISODCL (62, 78)]; /* 8.4.26.1 */
+	char recfmt			[ISODCL (79, 79)]; /* 711 */
+	char recattr			[ISODCL (80, 80)]; /* 711 */
+	u_char reclen			[ISODCL (81, 84)]; /* 723 */
+	char system_id			[ISODCL (85, 116)]; /* achars */
+	char system_use			[ISODCL (117, 180)];
+	char version			[ISODCL (181, 181)]; /* 711 */
+	char len_esc			[ISODCL (182, 182)]; /* 711 */
+	char reserved			[ISODCL (183, 246)];
+	u_char len_au			[ISODCL (247, 250)]; /* 723 */
+};
+
+/* 7.1.1: unsigned char */
+static __inline __unused int
+isonum_711(const u_char *p)
+{
+	return *p;
+}
+
+/* 7.1.2: signed char */
+static __inline __unused int
+isonum_712(const u_char *p)
+{
+	return (signed char) *p;
+}
+
+/* 7.2.1: unsigned little-endian 16-bit value.  NOT USED IN KERNEL. */
+static __inline __unused uint16_t
+isonum_721(const u_char *p)
+{
+	return le16dec(p);
+}
+
+/* 7.2.2: unsigned big-endian 16-bit value.  NOT USED IN KERNEL. */
+static __inline __unused uint16_t
+isonum_722(const u_char *p)
+{
+	return be16dec(p);
+}
+
+/* 7.2.3: unsigned both-endian (little, then big) 16-bit value */
+static __inline __unused uint16_t
+isonum_723(const u_char *p)
+{
+#if BYTE_ORDER == BIG_ENDIAN
+	return be16dec(p + 2);
+#else
+	return le16dec(p);
+#endif
+}
+
+/* 7.3.1: unsigned little-endian 32-bit value.  NOT USED IN KERNEL. */
+static __inline __unused uint32_t
+isonum_731(const u_char *p)
+{
+	return le32dec(p);
+}
+
+/* 7.3.2: unsigned big-endian 32-bit value.  NOT USED IN KERNEL. */
+static __inline __unused uint32_t
+isonum_732(const u_char *p)
+{
+	return be32dec(p);
+}
+
+/* 7.3.3: unsigned both-endian (little, then big) 32-bit value */
+static __inline __unused uint32_t
+isonum_733(const u_char *p)
+{
+#if BYTE_ORDER == BIG_ENDIAN
+	return be32dec(p + 4);
+#else
+	return le32dec(p);
+#endif
+}
+
+/*
+ * Associated files have a leading '='.
+ */
+#define	ASSOCCHAR	'='
+
+#endif /* _ISOFS_CD9660_ISO_H_ */

Property changes on: lab4/.minix-src/include/isofs/cd9660/iso.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/isofs/cd9660/iso_rrip.h
===================================================================
--- lab4/.minix-src/include/isofs/cd9660/iso_rrip.h	(nonexistent)
+++ lab4/.minix-src/include/isofs/cd9660/iso_rrip.h	(revision 13)
@@ -0,0 +1,85 @@
+/*	$NetBSD: iso_rrip.h,v 1.4 2005/12/03 17:34:43 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley
+ * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
+ * Support code is derived from software contributed to Berkeley
+ * by Atsushi Murai (amurai@spec.co.jp).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)iso_rrip.h	8.2 (Berkeley) 1/23/94
+ */
+
+#ifndef _ISOFS_CD9660_ISO_RRIP_H_
+#define _ISOFS_CD9660_ISO_RRIP_H_
+
+/*
+ *	Analyze function flag (similar to RR field bits)
+ */
+#define	ISO_SUSP_ATTR		0x0001
+#define	ISO_SUSP_DEVICE		0x0002
+#define	ISO_SUSP_SLINK		0x0004
+#define	ISO_SUSP_ALTNAME	0x0008
+#define	ISO_SUSP_CLINK		0x0010
+#define	ISO_SUSP_PLINK		0x0020
+#define	ISO_SUSP_RELDIR		0x0040
+#define	ISO_SUSP_TSTAMP		0x0080
+#define	ISO_SUSP_IDFLAG		0x0100
+#define	ISO_SUSP_EXTREF		0x0200
+#define	ISO_SUSP_CONT		0x0400
+#define	ISO_SUSP_OFFSET		0x0800
+#define	ISO_SUSP_STOP		0x1000
+#define	ISO_SUSP_UNKNOWN	0x8000
+
+typedef struct {
+	struct iso_node	*inop;
+	int		fields;		/* interesting fields in this analysis */
+	daddr_t		iso_ce_blk;	/* block of continuation area */
+	off_t		iso_ce_off;	/* offset of continuation area */
+	int		iso_ce_len;	/* length of continuation area */
+	struct iso_mnt	*imp;		/* mount structure */
+	ino_t		*inump;		/* inode number pointer */
+	char		*outbuf;	/* name/symbolic link output area */
+	u_short		*outlen;	/* length of above */
+	u_short		maxlen;		/* maximum length of above */
+	int		cont;		/* continuation of above */
+} ISO_RRIP_ANALYZE;
+
+int cd9660_rrip_analyze(struct iso_directory_record *isodir,
+			    struct iso_node *inop, struct iso_mnt *imp);
+int cd9660_rrip_getname(struct iso_directory_record *isodir,
+			    char *outbuf, u_short *outlen,
+			    ino_t *inump, struct iso_mnt *imp);
+int cd9660_rrip_getsymname(struct iso_directory_record *isodir,
+			       char *outbuf, u_short *outlen,
+			       struct iso_mnt *imp);
+int cd9660_rrip_offset(struct iso_directory_record *isodir,
+			   struct iso_mnt *imp);
+
+#endif /* _ISOFS_CD9660_ISO_RRIP_H_ */

Property changes on: lab4/.minix-src/include/isofs/cd9660/iso_rrip.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/libdde/usb_server.h
===================================================================
--- lab4/.minix-src/include/libdde/usb_server.h	(nonexistent)
+++ lab4/.minix-src/include/libdde/usb_server.h	(revision 13)
@@ -0,0 +1,7 @@
+#ifndef __LIBDDE_USB_SERVER_H__
+#define __LIBDDE_USB_SERVER_H__
+/*****************************************************************************
+ *         ddekit_usb_server_init                                            *
+ ****************************************************************************/
+void ddekit_usb_server_init();
+#endif /* __LIBDDE_USB_SERVER_H__ */

Property changes on: lab4/.minix-src/include/libdde/usb_server.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lcom/lab4.h
===================================================================
--- lab4/.minix-src/include/lcom/lab4.h	(nonexistent)
+++ lab4/.minix-src/include/lcom/lab4.h	(revision 13)
@@ -0,0 +1,136 @@
+#pragma once
+
+#include <stdint.h>
+
+struct packet {
+  uint8_t bytes[3]; // mouse packet raw bytes
+  bool rb, mb, lb;  // right, middle and left mouse buttons pressed
+  int16_t delta_x;  // mouse x-displacement: rightwards is positive
+  int16_t delta_y;  // mouse y-displacement: upwards is positive
+  bool x_ov, y_ov;  // mouse x-displacement and y-displacement overflows
+};
+
+enum mouse_ev_t { LB_PRESSED,
+                  LB_RELEASED,
+                  RB_PRESSED,
+                  RB_RELEASED,
+                  BUTTON_EV,
+                  MOUSE_MOV };
+
+struct mouse_ev {
+  enum mouse_ev_t type;
+  int16_t delta_x, delta_y;
+};
+
+struct mouse_ev *(mouse_detect_event)(struct packet *pp);
+
+/** 
+ * @brief To test packet reception via interrupts 
+ * 
+ * Displays the packets received from the mouse
+ * Exits after receiving the number of packets specified in argument
+ * 
+ * @param cnt Number of packets to receive and display before exiting
+ * 
+ * @return Return 0 upon success and non-zero otherwise
+ */
+
+int (mouse_test_packet)(uint32_t cnt);
+
+/** 
+ * @brief To test PS/2 remote mode operation 
+ * 
+ * Configures the PS/2 to operate in remote mode
+ * 
+ * Periodically requests a packet from the mouse,
+ * and displays the packets received from the mouse
+ * 
+ * Exits after receiving the number of packets specified in argument
+ * 
+ * @param period Period in milliseconds 
+ * @param cnt Number of packets to receive and display before exiting
+ * 
+ * @return Return 0 upon success and non-zero otherwise
+ */
+
+int (mouse_test_remote)(uint16_t period, uint8_t cnt);
+
+/** 
+ * @brief To test handling of more than one interrupt
+ * 
+ *  Similar test_packet() except that it 
+ *  should terminate if no packets are received for idle_time seconds
+ * 
+ * @param idle_time Number of seconds without packets before exiting
+ * 
+ * @return Return 0 upon success and non-zero otherwise
+ */
+
+int (mouse_test_async)(uint8_t idle_time);
+
+/** 
+ * @brief To test state machine implementation
+ * 
+ *  Similar to mouse_test_packet() except that it 
+ *  should terminate if a gesture is detected.
+ *
+ * @return Return 0 upon success and non-zero otherwise
+ */
+
+int (mouse_test_gesture)(uint8_t x_len, uint8_t tolerance);
+
+/** 
+ * @brief Handles mouse interrupts
+ * 
+ * Reads the status register and the output buffer (OB).
+ * 
+ * If there was some error, the byte read from the OB should be discarded.
+ * 
+ * Must be defined using parenthesis around the function name:
+ *
+ *   void (mouse_ih)(void) {
+ * 
+ * @param IH's take no arguments
+ * 
+ * @return IH's take no values
+ */
+
+void (mouse_ih)(void);
+
+/** 
+ * @brief To print a mouse packet 
+ * 
+ * Displays a mouse packet in a human readable way
+ * 
+ * This function needs not be implemented: it is provided with the LCF
+ * 
+ * @param pp Pointer to a struct which contains both the packet bytes 
+ * 				   and the parsed information.
+ */
+
+void (mouse_print_packet)(struct packet *pp);
+
+/**
+ * @brief Enables stream mode data reporting.
+ *
+ * Enables stream mode data reporting, by sending the respective command to the mouse.
+ * 
+ * This function is provided by the LCF.
+ *
+ * In order to score points for your Lab 4 grade, you should implement this functionality yourself. * This can be done by defining your own function with the same functionality, or just by adding
+ * this functionality somewhere in your code.
+ *
+ * @return Returns O on success, and non-zero otherwise
+ */
+
+int (mouse_enable_data_reporting)(void);
+
+/**
+ * @brief Returns Minix's default KBC command byte.
+ *
+ * This function is already implemented by the LCF: you must not implement it.
+ *
+ * @return Returns Minix's default KBC command byte
+ */
+
+uint8_t (minix_get_dflt_kbc_cmd_byte)(void);

Property changes on: lab4/.minix-src/include/lcom/lab4.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lutok/operations.hpp
===================================================================
--- lab4/.minix-src/include/lutok/operations.hpp	(nonexistent)
+++ lab4/.minix-src/include/lutok/operations.hpp	(revision 13)
@@ -0,0 +1,53 @@
+// Copyright 2011 Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+//   notice, this list of conditions and the following disclaimer.
+// * 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.
+// * Neither the name of Google Inc. nor the names of its contributors
+//   may be used to endorse or promote products derived from this software
+//   without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/// \file operations.hpp
+/// Extra generic functions to interact with Lua.
+
+#if !defined(LUTOK_OPERATIONS_HPP)
+#define LUTOK_OPERATIONS_HPP
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include <lutok/state.hpp>
+
+namespace lutok {
+
+
+void create_module(state&, const std::string&,
+                   const std::map< std::string, cxx_function >&);
+unsigned int do_file(state&, const std::string&, const int = 0);
+unsigned int do_string(state&, const std::string&, const int = 0);
+void eval(state&, const std::string&, const int = 1);
+
+
+}  // namespace lutok
+
+#endif  // !defined(LUTOK_OPERATIONS_HPP)

Property changes on: lab4/.minix-src/include/lutok/operations.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lcom/lcf.h
===================================================================
--- lab4/.minix-src/include/lcom/lcf.h	(nonexistent)
+++ lab4/.minix-src/include/lcom/lcf.h	(revision 13)
@@ -0,0 +1,379 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <machine/int86.h>
+#include <minix/const.h>
+#include <minix/driver.h>
+#include <minix/endpoint.h>
+#include <minix/sef.h>
+#include <minix/syslib.h>
+#include <minix/sysutil.h>
+#include <minix/type.h>
+#include <minix/vm.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/timespec.h>
+#include <sys/types.h>
+
+#include <lcom/liblm.h>
+
+#include "lab2.h"
+#include "lab3.h"
+#include "lab4.h"
+#include "types.h"
+
+#ifdef __LCOM__
+
+// undef all MINIX functions defined as macros
+
+#  undef driver_receive
+#  undef sys_inb
+#  undef sys_irqdisable
+#  undef sys_irqenable
+#  undef sys_irqrmpolicy
+#  undef sys_irqsetpolicy
+#  undef sys_outb
+
+/*
+ * 
+ * Macros used to replace the set of functions being wrapped / "intercepted".
+ *
+ */
+
+// not a wrapper, just a way to solve pseudo-random number generation issue in Minix 3.4.0-rc6
+#  define rand() rand_()
+
+//
+// Minix / C library functions
+//
+
+#  define driver_receive(src, m_ptr, status_ptr) \
+    driver_receive_(src, m_ptr, status_ptr, CTX_INFO(#src "\0" #m_ptr "\0" #status_ptr))
+
+#  define micros_to_ticks(micros) \
+    micros_to_ticks_(micros, CTX_INFO(#micros))
+
+#  define nanosleep(req, rem) \
+    nanosleep_(req, rem, CTX_INFO(#req "\0" #rem))
+
+// printf is a variadic function, therefore it is treated differently:
+//   1) format argument is included within variadic argument list to avoid any warnings;
+//   2) the code string is set as a single argument;
+//   3) context information is the first argument, not the last one.
+#  define printf(...) \
+    printf_(CTX_INFO(#__VA_ARGS__), __VA_ARGS__)
+
+#  define sleep(seconds) \
+    sleep_(seconds, CTX_INFO(#seconds))
+
+#  define sys_enable_iop(proc_ep) \
+    sys_enable_iop_(proc_ep, CTX_INFO(#proc_ep))
+
+#  define sys_inb(port, value) \
+    sys_inb_(port, value, CTX_INFO(#port "\0" #value))
+
+#  define sys_int86(reg86p) \
+    sys_int86_(reg86p, CTX_INFO(#reg86p))
+
+#  define sys_irqdisable(irq_hook_id) \
+    sys_irqdisable_(irq_hook_id, CTX_INFO(#irq_hook_id))
+
+#  define sys_irqenable(irq_hook_id) \
+    sys_irqenable_(irq_hook_id, CTX_INFO(#irq_hook_id))
+
+#  define sys_irqrmpolicy(irq_hook_id) \
+    sys_irqrmpolicy_(irq_hook_id, CTX_INFO(#irq_hook_id))
+
+#  define sys_irqsetpolicy(irq_vec, policy, hook_id) sys_irqsetpolicy_( \
+    irq_vec, policy, hook_id, CTX_INFO(#  irq_vec "\0" #  policy "\0" #  hook_id))
+
+#  define sys_outb(port, value) \
+    sys_outb_(port, value, CTX_INFO(#port "\0" #value))
+
+#  define sys_privctl(proc_ep, req, p) \
+    sys_privctl_(proc_ep, req, p, CTX_INFO(#proc_ep "\0" #req "\0" #p))
+
+#  define tickdelay(ticks) \
+    tickdelay_(ticks, CTX_INFO(#ticks))
+
+#  define usleep(useconds) \
+    usleep_(useconds, CTX_INFO(#useconds))
+
+#  define vm_map_phys(who, physaddr, len) \
+    vm_map_phys_(who, physaddr, len, CTX_INFO(#who "\0" #physaddr "\0" #len))
+
+#  define vm_unmap_phys(who, vaddr, len) \
+    vm_unmap_phys_(who, vaddr, len, CTX_INFO(#who "\0" #vaddr "\0" #len))
+
+//
+// LCOM liblm
+//
+
+#  define lm_init(enable_logging) \
+    lm_init_(enable_logging, CTX_INFO(#enable_logging))
+
+#  define lm_alloc(size, map) \
+    lm_alloc_(size, map, CTX_INFO(#size "\0" #map))
+
+#  define lm_free(map) \
+    lm_free_(map, CTX_INFO(#map))
+
+//
+// LCOM Lab 2 functions
+//
+
+#  define timer_test_read_config(timer, field) \
+    timer_test_read_config_(timer, field, CTX_INFO(#timer "\0" #field))
+
+#  define timer_test_time_base(timer, freq) \
+    timer_test_time_base_(timer, freq, CTX_INFO(#timer "\0" #freq))
+
+#  define timer_test_int(time) \
+    timer_test_int_(time, CTX_INFO(#time))
+
+#  define util_get_LSB(val, lsb) \
+    util_get_LSB_(val, lsb, CTX_INFO(#val "\0" #lsb))
+
+#  define util_get_MSB(val, msb) \
+    util_get_MSB_(val, msb, CTX_INFO(#val "\0" #msb))
+
+#  define timer_set_frequency(timer, freq) \
+    timer_set_frequency_(timer, freq, CTX_INFO(#timer "\0" #freq))
+
+#  define timer_subscribe_int(bit_no) \
+    timer_subscribe_int_(bit_no, CTX_INFO(#bit_no))
+
+#  define timer_unsubscribe_int() \
+    timer_unsubscribe_int_(CTX_INFO(""))
+
+#  define timer_int_handler() \
+    timer_int_handler_(CTX_INFO(""))
+
+#  define timer_get_conf(timer, st) \
+    timer_get_conf_(timer, st, CTX_INFO(#timer "\0" #st))
+
+#  define timer_display_conf(timer, st, field) \
+    timer_display_conf_(timer, st, field, CTX_INFO(#timer "\0" #st "\0" #field))
+
+#  define timer_print_config(timer, field, val) \
+    timer_print_config_(timer, field, val, CTX_INFO(#timer "\0" #field "\0" #val))
+
+#  define timer_print_elapsed_time() \
+    timer_print_elapsed_time_(CTX_INFO(""))
+
+//
+// LCOM Lab 3 functions
+//
+
+#  define kbd_test_scan() \
+    kbd_test_scan_(CTX_INFO(""))
+
+#  define kbd_test_poll() \
+    kbd_test_poll_(CTX_INFO(""))
+
+#  define kbd_test_timed_scan(n) \
+    kbd_test_timed_scan_(n, CTX_INFO(#n))
+
+#  define kbc_ih() \
+    kbc_ih_(CTX_INFO(""))
+
+#  define kbd_print_scancode(make, size, bytes) \
+    kbd_print_scancode_(make, size, bytes, CTX_INFO(#make "\0" #size "\0" #bytes))
+
+#  define kbd_print_no_sysinb(cnt) \
+    kbd_print_no_sysinb_(cnt, CTX_INFO(#cnt))
+
+//
+// LCOM Lab 4 functions
+//
+
+#  define mouse_test_packet(cnt) \
+    mouse_test_packet_(cnt, CTX_INFO(#cnt))
+
+#  define mouse_test_async(idle_time) \
+    mouse_test_async_(idle_time, CTX_INFO(#idle_time))
+
+#  define mouse_test_remote(period, cnt) \
+    mouse_test_remote_(period, cnt, CTX_INFO(#period "\0" #cnt))
+
+#  define mouse_test_gesture(x_len, tolerance) \
+    mouse_test_gesture_(x_len, tolerance, CTX_INFO(#x_len "\0" #tolerance))
+
+#  define mouse_ih() \
+    mouse_ih_(CTX_INFO(""))
+
+#  define mouse_print_packet(pp) \
+    mouse_print_packet_(pp, CTX_INFO(#pp))
+
+#  define mouse_enable_data_reporting() \
+    mouse_enable_data_reporting_(CTX_INFO(""))
+
+/*
+ *
+ * Wrappers entry point.
+ * 
+ */
+
+// not a wrapper, used as a way to solve pseudo-random number generation in Minix 3.4.0-rc6
+int rand_();
+
+//
+// Minix / C library functions
+//
+
+int driver_receive_(endpoint_t src, message *m_ptr, int *status_ptr, const ctx_t ctx);
+
+u32_t micros_to_ticks_(u32_t micros, const ctx_t ctx);
+
+int nanosleep_(const struct timespec *req, struct timespec *rem, const ctx_t ctx);
+
+int printf_(const ctx_t ctx, const char *__restrict format, ...);
+
+// void sef_startup_(const ctx_t ctx);
+
+unsigned int sleep_(unsigned int seconds, const ctx_t ctx);
+
+int sys_enable_iop_(endpoint_t proc_ep, const ctx_t ctx);
+
+int sys_inb_(int port, u32_t *value, const ctx_t ctx);
+
+#  if defined(__i386__)
+int sys_int86_(reg86_t *reg86p, const ctx_t ctx);
+#  endif
+
+int sys_irqdisable_(int *irq_hook_id, const ctx_t ctx);
+
+int sys_irqenable_(int *irq_hook_id, const ctx_t ctx);
+
+int sys_irqrmpolicy_(int *irq_hook_id, const ctx_t ctx);
+
+int sys_irqsetpolicy_(int irq_vec, int policy, int *irq_hook_id, const ctx_t ctx);
+
+int sys_outb_(int port, u32_t value, const ctx_t ctx);
+
+int sys_privctl_(endpoint_t proc_ep, int req, void *p, const ctx_t ctx);
+
+int tickdelay_(clock_t ticks, const ctx_t ctx);
+
+int usleep_(useconds_t useconds, const ctx_t ctx);
+
+void *vm_map_phys_(endpoint_t who, void *physaddr, size_t len, const ctx_t ctx);
+
+int vm_unmap_phys_(endpoint_t who, void *vaddr, size_t len, const ctx_t ctx);
+
+//
+// LCOM liblm
+//
+
+void *lm_init_(bool enable_logging, const ctx_t ctx);
+
+void *lm_alloc_(size_t size, mmap_t *map, const ctx_t ctx);
+
+bool lm_free_(mmap_t *map, const ctx_t ctx);
+
+//
+// LCOM Lab 2
+//
+
+int timer_test_read_config_(uint8_t timer, enum timer_status_field field, const ctx_t ctx);
+
+int timer_test_time_base_(uint8_t timer, uint32_t freq, const ctx_t ctx);
+
+int timer_test_int_(uint8_t time, const ctx_t ctx);
+
+int util_get_LSB_(uint16_t val, uint8_t *lsb, const ctx_t ctx);
+
+int util_get_MSB_(uint16_t val, uint8_t *msb, const ctx_t ctx);
+
+int timer_set_frequency_(uint8_t timer, uint32_t freq, const ctx_t ctx);
+
+int timer_subscribe_int_(uint8_t *bit_no, const ctx_t ctx);
+
+int timer_unsubscribe_int_(const ctx_t ctx);
+
+void timer_int_handler_(const ctx_t ctx);
+
+int timer_get_conf_(uint8_t timer, uint8_t *st, const ctx_t ctx);
+
+int timer_display_conf_(uint8_t timer, uint8_t st, enum timer_status_field field, const ctx_t ctx);
+
+int timer_print_config_(uint8_t timer, enum timer_status_field field,
+                        union timer_status_field_val val, const ctx_t ctx);
+
+uint32_t timer_print_elapsed_time_(const ctx_t ctx);
+
+//
+// LCOM Lab 3
+//
+
+int kbd_test_scan_(const ctx_t ctx);
+
+int kbd_test_poll_(const ctx_t ctx);
+
+int kbd_test_timed_scan_(uint8_t n, const ctx_t ctx);
+
+void kbc_ih_(const ctx_t ctx);
+
+int kbd_print_scancode_(bool make, uint8_t size, uint8_t *bytes, const ctx_t ctx);
+
+int kbd_print_no_sysinb_(uint32_t cnt, const ctx_t ctx);
+
+//
+// LCOM Lab 4
+//
+
+int mouse_test_packet_(uint32_t cnt, const ctx_t ctx);
+
+int mouse_test_remote_(uint16_t period, uint8_t cnt, const ctx_t ctx);
+
+int mouse_test_async_(uint8_t idle_time, const ctx_t ctx);
+
+int mouse_test_gesture_(uint8_t x_len, uint8_t tolerance, const ctx_t ctx);
+
+void mouse_ih_(const ctx_t ctx);
+
+void mouse_print_packet_(struct packet *pp, const ctx_t ctx);
+
+int mouse_enable_data_reporting_(const ctx_t ctx);
+
+//
+// LCF library functions
+//
+
+#  define lcf_start(argc, argv) \
+    lcf_start_(argc, argv, CTX_INFO(#argc "\0" #argv))
+
+#  define lcf_cleanup() \
+    lcf_cleanup_(true, CTX_INFO(""))
+
+#  define lcf_log_output(output) \
+    lcf_log_output_(output, CTX_INFO(#output))
+
+#  define lcf_trace_calls(syslog) \
+    lcf_trace_calls_(syslog, CTX_INFO(#syslog))
+
+#  define lcf_set_language(lang) \
+    lcf_set_language_(lang, CTX_INFO(#lang))
+
+// initialize LCF library by passing the command line arguments
+// [sef_startup() is invoked internally]
+int lcf_start_(int argc, char *argv[], const ctx_t ctx);
+
+// LCF library clean up operations (invoked immediately before exiting)
+int lcf_cleanup_(bool usercall, const ctx_t ctx);
+
+// if set, creates a file to save all the output
+bool lcf_log_output_(const char *output, const ctx_t ctx);
+
+// if set, creates a file to save the invocations of all functions being wrapped / "intercepted"
+bool lcf_trace_calls_(const char *syslog, const ctx_t ctx);
+
+// enables to set the language for LCF messages
+bool lcf_set_language_(const char *lang, const ctx_t ctx);
+
+#endif // __LCOM__

Property changes on: lab4/.minix-src/include/lcom/lcf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lcom/types.h
===================================================================
--- lab4/.minix-src/include/lcom/types.h	(nonexistent)
+++ lab4/.minix-src/include/lcom/types.h	(revision 13)
@@ -0,0 +1,18 @@
+#pragma once
+
+// context information
+typedef struct lcf_ctx_info_t {
+  const char *file;   // filename
+  const int line;     // line number
+  const char *caller; // function from where it was called
+  const char *code;   // "code" written in between parentheses for each argument (null separated)
+} ctx_t;
+
+// macro to ease capturing the content information
+#ifdef __cplusplus
+#  define CTX_INFO(code) \
+    { __FILE__, __LINE__, __FUNCTION__, code "\0" }
+#else
+#  define CTX_INFO(code) \
+    (const ctx_t) { __FILE__, __LINE__, __func__, code "\0" }
+#endif

Property changes on: lab4/.minix-src/include/lcom/types.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lutok/test_utils.hpp
===================================================================
--- lab4/.minix-src/include/lutok/test_utils.hpp	(nonexistent)
+++ lab4/.minix-src/include/lutok/test_utils.hpp	(revision 13)
@@ -0,0 +1,141 @@
+// Copyright 2011 Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+//   notice, this list of conditions and the following disclaimer.
+// * 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.
+// * Neither the name of Google Inc. nor the names of its contributors
+//   may be used to endorse or promote products derived from this software
+//   without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/// \file test_utils.hpp
+/// Utilities for tests of the lua modules.
+///
+/// This file is intended to be included once, and only once, for every test
+/// program that needs it.  All the code is herein contained to simplify the
+/// dependency chain in the build rules.
+
+#if !defined(LUTOK_TEST_UTILS_HPP)
+#   define LUTOK_TEST_UTILS_HPP
+#else
+#   error "test_utils.hpp can only be included once"
+#endif
+
+#include <atf-c++.hpp>
+
+#include "c_gate.hpp"
+#include "exceptions.hpp"
+#include "state.hpp"
+
+
+namespace {
+
+
+/// Checks that a given expression raises a particular lutok::api_error.
+///
+/// We cannot make any assumptions regarding the error text provided by Lua, so
+/// we resort to checking only which API function raised the error (because our
+/// code is the one hardcoding these strings).
+///
+/// \param exp_api_function The name of the Lua C API function that causes the
+///     error.
+/// \param statement The statement to execute.
+#define REQUIRE_API_ERROR(exp_api_function, statement) \
+    do { \
+        try { \
+            statement; \
+            ATF_FAIL("api_error not raised by " #statement); \
+        } catch (const lutok::api_error& api_error) { \
+            ATF_REQUIRE_EQ(exp_api_function, api_error.api_function()); \
+        } \
+    } while (0)
+
+
+/// Gets the pointer to the internal lua_State of a state object.
+///
+/// This is pure syntactic sugar to simplify typing in the test cases.
+///
+/// \param state The Lua state.
+///
+/// \return The internal lua_State of the input Lua state.
+static inline lua_State*
+raw(lutok::state& state)
+{
+    return lutok::state_c_gate(state).c_state();
+}
+
+
+/// Ensures that the Lua stack maintains its original height upon exit.
+///
+/// Use an instance of this class to check that a piece of code does not have
+/// side-effects on the Lua stack.
+///
+/// To be used within a test case only.
+class stack_balance_checker {
+    /// The Lua state.
+    lutok::state& _state;
+
+    /// Whether to install a sentinel on the stack for balance enforcement.
+    bool _with_sentinel;
+
+    /// The height of the stack on creation.
+    unsigned int _old_count;
+
+public:
+    /// Constructs a new stack balance checker.
+    ///
+    /// \param state_ The Lua state to validate.
+    /// \param with_sentinel_ If true, insert a sentinel item into the stack and
+    ///     validate upon exit that the item is still there.  This is an attempt
+    ///     to ensure that already-existing items are not removed from the stack
+    ///     by the code under test.
+    stack_balance_checker(lutok::state& state_,
+                          const bool with_sentinel_ = true) :
+        _state(state_),
+        _with_sentinel(with_sentinel_),
+        _old_count(_state.get_top())
+    {
+        if (_with_sentinel)
+            _state.push_integer(987654321);
+    }
+
+    /// Destructor for the object.
+    ///
+    /// If the stack height does not match the height when the instance was
+    /// created, this fails the test case.
+    ~stack_balance_checker(void)
+    {
+        if (_with_sentinel) {
+            if (!_state.is_number() || _state.to_integer() != 987654321)
+                ATF_FAIL("Stack corrupted: sentinel not found");
+            _state.pop(1);
+        }
+
+        unsigned int new_count = _state.get_top();
+        if (_old_count != new_count)
+            //ATF_FAIL(F("Stack not balanced: before %d, after %d") %
+            //         _old_count % new_count);
+            ATF_FAIL("Stack not balanced");
+    }
+};
+
+
+}  // anonymous namespace

Property changes on: lab4/.minix-src/include/lutok/test_utils.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lcom/utils.h
===================================================================
--- lab4/.minix-src/include/lcom/utils.h	(nonexistent)
+++ lab4/.minix-src/include/lcom/utils.h	(revision 13)
@@ -0,0 +1,34 @@
+#pragma once
+
+#include <stdint.h>
+
+#ifndef BIT
+#  define BIT(n) (1 << (n))
+#endif
+
+/**
+ * @brief Returns the LSB of a 2 byte integer
+ *
+ * @param val input 2 byte integer
+ * @param lsb address of memory location to be updated with val's LSB
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (util_get_LSB)(uint16_t val, uint8_t *lsb);
+
+/**
+ * @brief Returns the MSB of a 2 byte integer
+ *
+ * @param val input 2 byte integer
+ * @param msb address of memory location to be updated with val's LSB
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (util_get_MSB)(uint16_t val, uint8_t *msb);
+
+/**
+ * @brief Invokes sys_inb() system call but reads the value into a uint8_t variable.
+ *
+ * @param port the input port that is to be read
+ * @param value a pointer to the variable that is to be update with the value read
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (util_sys_inb)(int port, uint8_t *value);

Property changes on: lab4/.minix-src/include/lcom/utils.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lutok/debug.hpp
===================================================================
--- lab4/.minix-src/include/lutok/debug.hpp	(nonexistent)
+++ lab4/.minix-src/include/lutok/debug.hpp	(revision 13)
@@ -0,0 +1,90 @@
+// Copyright 2011 Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+//   notice, this list of conditions and the following disclaimer.
+// * 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.
+// * Neither the name of Google Inc. nor the names of its contributors
+//   may be used to endorse or promote products derived from this software
+//   without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/// \file debug.hpp
+/// Provides the debug wrapper class for the Lua C debug state.
+
+#if !defined(LUTOK_DEBUG_HPP)
+#define LUTOK_DEBUG_HPP
+
+#include <string>
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+#include <memory>
+#else
+#include <tr1/memory>
+#endif
+
+namespace lutok {
+
+
+class state;
+
+
+/// A model for the Lua debug state.
+///
+/// This extremely-simple class provides a mechanism to hide the internals of
+/// the C native lua_Debug type, exposing its internal fields using friendlier
+/// C++ types.
+///
+/// This class also acts as a complement to the state class by exposing any
+/// state-related functions as methods of this function.  For example, while it
+/// might seem that get_info() belongs in state, we expose it from here because
+/// its result is really mutating a debug object, not the state object.
+class debug {
+    struct impl;
+
+    /// Pointer to the shared internal implementation.
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+    std::shared_ptr< impl > _pimpl;
+#else
+    std::tr1::shared_ptr< impl > _pimpl;
+#endif
+
+public:
+    debug(void);
+    ~debug(void);
+
+    void get_info(state&, const std::string&);
+    void get_stack(state&, const int);
+
+    int event(void) const;
+    std::string name(void) const;
+    std::string name_what(void) const;
+    std::string what(void) const;
+    std::string source(void) const;
+    int current_line(void) const;
+    int n_ups(void) const;
+    int line_defined(void) const;
+    int last_line_defined(void) const;
+    std::string short_src(void) const;
+};
+
+
+}  // namespace lutok
+
+#endif  // !defined(LUTOK_DEBUG_HPP)

Property changes on: lab4/.minix-src/include/lutok/debug.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/pci_sis.h
===================================================================
--- lab4/.minix-src/include/i386/pci_sis.h	(nonexistent)
+++ lab4/.minix-src/include/i386/pci_sis.h	(revision 13)
@@ -0,0 +1,17 @@
+/*
+pci_sis.h
+
+Created:	Nov 2001 by Philip Homburg <philip@cs.vu.nl>
+*/
+
+/* Constants are taken from pci-irq.c in the Linux kernel source */
+#define SIS_ISABR_IRQ_A 0x41	/* IRQA routing */
+#define SIS_ISABR_IRQ_B 0x42	/* IRQB routing */
+#define SIS_ISABR_IRQ_C 0x43	/* IRQC routing */
+#define SIS_ISABR_IRQ_D 0x44	/* IRQD routing */
+#define 	SIS_IRQ_DISABLED	0x80
+#define		SIS_IRQ_MASK		0x0F
+
+/*
+ * $PchId: pci_sis.h,v 1.1 2001/12/06 20:22:52 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/i386/pci_sis.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/check.h
===================================================================
--- lab4/.minix-src/include/lzma/check.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/check.h	(revision 13)
@@ -0,0 +1,150 @@
+/**
+ * \file        lzma/check.h
+ * \brief       Integrity checks
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/**
+ * \brief       Type of the integrity check (Check ID)
+ *
+ * The .xz format supports multiple types of checks that are calculated
+ * from the uncompressed data. They vary in both speed and ability to
+ * detect errors.
+ */
+typedef enum {
+	LZMA_CHECK_NONE     = 0,
+		/**<
+		 * No Check is calculated.
+		 *
+		 * Size of the Check field: 0 bytes
+		 */
+
+	LZMA_CHECK_CRC32    = 1,
+		/**<
+		 * CRC32 using the polynomial from the IEEE 802.3 standard
+		 *
+		 * Size of the Check field: 4 bytes
+		 */
+
+	LZMA_CHECK_CRC64    = 4,
+		/**<
+		 * CRC64 using the polynomial from the ECMA-182 standard
+		 *
+		 * Size of the Check field: 8 bytes
+		 */
+
+	LZMA_CHECK_SHA256   = 10
+		/**<
+		 * SHA-256
+		 *
+		 * Size of the Check field: 32 bytes
+		 */
+} lzma_check;
+
+
+/**
+ * \brief       Maximum valid Check ID
+ *
+ * The .xz file format specification specifies 16 Check IDs (0-15). Some
+ * of them are only reserved, that is, no actual Check algorithm has been
+ * assigned. When decoding, liblzma still accepts unknown Check IDs for
+ * future compatibility. If a valid but unsupported Check ID is detected,
+ * liblzma can indicate a warning; see the flags LZMA_TELL_NO_CHECK,
+ * LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_TELL_ANY_CHECK in container.h.
+ */
+#define LZMA_CHECK_ID_MAX 15
+
+
+/**
+ * \brief       Test if the given Check ID is supported
+ *
+ * Return true if the given Check ID is supported by this liblzma build.
+ * Otherwise false is returned. It is safe to call this with a value that
+ * is not in the range [0, 15]; in that case the return value is always false.
+ *
+ * You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always
+ * supported (even if liblzma is built with limited features).
+ */
+extern LZMA_API(lzma_bool) lzma_check_is_supported(lzma_check check)
+		lzma_nothrow lzma_attr_const;
+
+
+/**
+ * \brief       Get the size of the Check field with the given Check ID
+ *
+ * Although not all Check IDs have a check algorithm associated, the size of
+ * every Check is already frozen. This function returns the size (in bytes) of
+ * the Check field with the specified Check ID. The values are:
+ * { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 }
+ *
+ * If the argument is not in the range [0, 15], UINT32_MAX is returned.
+ */
+extern LZMA_API(uint32_t) lzma_check_size(lzma_check check)
+		lzma_nothrow lzma_attr_const;
+
+
+/**
+ * \brief       Maximum size of a Check field
+ */
+#define LZMA_CHECK_SIZE_MAX 64
+
+
+/**
+ * \brief       Calculate CRC32
+ *
+ * Calculate CRC32 using the polynomial from the IEEE 802.3 standard.
+ *
+ * \param       buf     Pointer to the input buffer
+ * \param       size    Size of the input buffer
+ * \param       crc     Previously returned CRC value. This is used to
+ *                      calculate the CRC of a big buffer in smaller chunks.
+ *                      Set to zero when starting a new calculation.
+ *
+ * \return      Updated CRC value, which can be passed to this function
+ *              again to continue CRC calculation.
+ */
+extern LZMA_API(uint32_t) lzma_crc32(
+		const uint8_t *buf, size_t size, uint32_t crc)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Calculate CRC64
+ *
+ * Calculate CRC64 using the polynomial from the ECMA-182 standard.
+ *
+ * This function is used similarly to lzma_crc32(). See its documentation.
+ */
+extern LZMA_API(uint64_t) lzma_crc64(
+		const uint8_t *buf, size_t size, uint64_t crc)
+		lzma_nothrow lzma_attr_pure;
+
+
+/*
+ * SHA-256 functions are currently not exported to public API.
+ * Contact Lasse Collin if you think it should be.
+ */
+
+
+/**
+ * \brief       Get the type of the integrity check
+ *
+ * This function can be called only immediately after lzma_code() has
+ * returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK.
+ * Calling this function in any other situation has undefined behavior.
+ */
+extern LZMA_API(lzma_check) lzma_get_check(const lzma_stream *strm)
+		lzma_nothrow;

Property changes on: lab4/.minix-src/include/lzma/check.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/pmc.h
===================================================================
--- lab4/.minix-src/include/i386/pmc.h	(nonexistent)
+++ lab4/.minix-src/include/i386/pmc.h	(revision 13)
@@ -0,0 +1,99 @@
+/*	$NetBSD: pmc.h,v 1.8 2007/04/16 19:12:18 ad Exp $	*/
+
+/*-
+ * Copyright (c) 2000 Zembu Labs, Inc.
+ * All rights reserved.
+ *
+ * Author: Jason R. Thorpe <thorpej@zembu.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by Zembu Labs, Inc.
+ * 4. Neither the name of Zembu Labs nor the names of its employees may
+ *    be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ZEMBU LABS, INC. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR-
+ * RANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS-
+ * CLAIMED.  IN NO EVENT SHALL ZEMBU LABS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_PMC_H_
+#define	_I386_PMC_H_
+
+#define	PMC_CLASS_I586		0x10000		/* i586-compatible */
+#define	PMC_TYPE_I586_TSC	0x10001		/* cycle counter */
+#define	PMC_TYPE_I586_PMCx	0x10002		/* performance counter */
+
+#define	PMC_CLASS_I686		0x20000		/* i686-compatible */
+#define	PMC_TYPE_I686_TSC	0x20001		/* cycle counter */
+#define	PMC_TYPE_I686_PMCx	0x20002		/* performance counter */
+
+#define	PMC_CLASS_K7		0x30000		/* K7-compatible */
+#define	PMC_TYPE_K7_TSC		0x30001		/* cycle counter */
+#define	PMC_TYPE_K7_PMCx	0x30002		/* performance counter */
+
+/*
+ * Each PMC event on the x86 is associated with a processor unit.  We
+ * encode the unit in the upper 16 bits of the event ID.
+ */
+#define	__PMC_EVID_EVENT_MASK	0x0000ffff
+#define	__PMC_EVID_UNIT_MASK	0xffff0000
+
+#define	__PMC_UNIT(x)		((x) << 16)
+#define	__PMC_GET_UNIT(x)	(((x) & __PMC_EVID_UNIT_MASK) >> 16)
+#define	__PMC_GET_EVENT(x)	((x) & __PMC_EVID_EVENT_MASK)
+
+#if defined(_KERNEL)
+/*
+ * LEGACY PMC support
+ */
+struct x86_pmc_info_args;
+struct x86_pmc_startstop_args;
+struct x86_pmc_read_args;
+int	pmc_info(struct lwp *, struct x86_pmc_info_args *,
+	    register_t *);
+int	pmc_startstop(struct lwp *, struct x86_pmc_startstop_args *,
+	    register_t *);
+int	pmc_read(struct lwp *, struct x86_pmc_read_args *,
+	    register_t *);
+/* END LEGACY PMC SUPPORT */
+
+#define pmc_md_fork(p1,p2)
+#define pmc_get_num_counters()			(0)
+#define pmc_get_counter_type(c)			(0)
+#define pmc_save_context(p)
+#define pmc_restore_context(p)
+#define pmc_enable_counter(p,c)
+#define pmc_disable_counter(p,c)
+#define pmc_accumulate(p1,p2)
+#define pmc_process_exit(p1)
+#define pmc_counter_isconfigured(p,c)		(0)
+#define pmc_counter_isrunning(p,c)		(0)
+#define pmc_start_profiling(c,f)		(0)
+#define pmc_stop_profiling(c)			(0)
+#define pmc_alloc_kernel_counter(c,f)		(0)
+#define pmc_free_kernel_counter(c)		(0)
+#define pmc_configure_counter(p,c,f)		(0)
+#define pmc_get_counter_value(p,c,f,pv)		(0)
+
+#define PMC_ENABLED(p)		(0)
+
+#endif /* _KERNEL */
+
+#endif /* _I386_PMC_H_ */

Property changes on: lab4/.minix-src/include/i386/pmc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lutok/state.hpp
===================================================================
--- lab4/.minix-src/include/lutok/state.hpp	(nonexistent)
+++ lab4/.minix-src/include/lutok/state.hpp	(revision 13)
@@ -0,0 +1,144 @@
+// Copyright 2011 Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+//   notice, this list of conditions and the following disclaimer.
+// * 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.
+// * Neither the name of Google Inc. nor the names of its contributors
+//   may be used to endorse or promote products derived from this software
+//   without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/// \file state.hpp
+/// Provides the state wrapper class for the Lua C state.
+
+#if !defined(LUTOK_STATE_HPP)
+#define LUTOK_STATE_HPP
+
+#include <string>
+
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+#include <memory>
+#else
+#include <tr1/memory>
+#endif
+
+namespace lutok {
+
+
+class debug;
+class state;
+
+
+/// The type of a C++ function that can be bound into Lua.
+///
+/// Functions of this type are free to raise exceptions.  These will not
+/// propagate into the Lua C API.  However, any such exceptions will be reported
+/// as a Lua error and their type will be lost.
+typedef int (*cxx_function)(state&);
+
+
+/// Stack index constant pointing to the registry table.
+extern const int registry_index;
+
+
+/// A RAII model for the Lua state.
+///
+/// This class holds the state of the Lua interpreter during its existence and
+/// provides wrappers around several Lua library functions that operate on such
+/// state.
+///
+/// These wrapper functions differ from the C versions in that they use the
+/// implicit state hold by the class, they use C++ types where appropriate and
+/// they use exceptions to report errors.
+///
+/// The wrappers intend to be as lightweight as possible but, in some
+/// situations, they are pretty complex because they need to do extra work to
+/// capture the errors reported by the Lua C API.  We prefer having fine-grained
+/// error control rather than efficiency, so this is OK.
+class state {
+    struct impl;
+
+    /// Pointer to the shared internal implementation.
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+    std::shared_ptr< impl > _pimpl;
+#else
+    std::tr1::shared_ptr< impl > _pimpl;
+#endif
+
+    void* new_userdata_voidp(const size_t);
+    void* to_userdata_voidp(const int);
+
+    friend class state_c_gate;
+    explicit state(void*);
+    void* raw_state(void);
+
+public:
+    state(void);
+    ~state(void);
+
+    void close(void);
+    void get_global(const std::string&);
+    void get_global_table(void);
+    bool get_metafield(const int, const std::string&);
+    bool get_metatable(const int = -1);
+    void get_table(const int = -2);
+    int get_top(void);
+    void insert(const int);
+    bool is_boolean(const int = -1);
+    bool is_function(const int = -1);
+    bool is_nil(const int = -1);
+    bool is_number(const int = -1);
+    bool is_string(const int = -1);
+    bool is_table(const int = -1);
+    bool is_userdata(const int = -1);
+    void load_file(const std::string&);
+    void load_string(const std::string&);
+    void new_table(void);
+    template< typename Type > Type* new_userdata(void);
+    bool next(const int = -2);
+    void open_base(void);
+    void open_string(void);
+    void open_table(void);
+    void pcall(const int, const int, const int);
+    void pop(const int);
+    void push_boolean(const bool);
+    void push_cxx_closure(cxx_function, const int);
+    void push_cxx_function(cxx_function);
+    void push_integer(const int);
+    void push_nil(void);
+    void push_string(const std::string&);
+    void push_value(const int = -1);
+    void raw_get(const int = -2);
+    void raw_set(const int = -3);
+    void set_global(const std::string&);
+    void set_metatable(const int = -2);
+    void set_table(const int = -3);
+    bool to_boolean(const int = -1);
+    long to_integer(const int = -1);
+    template< typename Type > Type* to_userdata(const int = -1);
+    std::string to_string(const int = -1);
+    int upvalue_index(const int);
+};
+
+
+}  // namespace lutok
+
+#endif  // !defined(LUTOK_STATE_HPP)

Property changes on: lab4/.minix-src/include/lutok/state.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lutok/exceptions.hpp
===================================================================
--- lab4/.minix-src/include/lutok/exceptions.hpp	(nonexistent)
+++ lab4/.minix-src/include/lutok/exceptions.hpp	(revision 13)
@@ -0,0 +1,83 @@
+// Copyright 2011 Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+//   notice, this list of conditions and the following disclaimer.
+// * 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.
+// * Neither the name of Google Inc. nor the names of its contributors
+//   may be used to endorse or promote products derived from this software
+//   without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/// \file exceptions.hpp
+/// Exception types raised by lutok.
+
+#if !defined(LUTOK_EXCEPTIONS_HPP)
+#define LUTOK_EXCEPTIONS_HPP
+
+#include <stdexcept>
+#include <string>
+
+namespace lutok {
+
+
+class state;
+
+
+/// Base exception for lua errors.
+class error : public std::runtime_error {
+public:
+    explicit error(const std::string&);
+    virtual ~error(void) throw();
+};
+
+
+/// Exception for errors raised by the Lua API library.
+class api_error : public error {
+    /// Name of the Lua C API function that caused the error.
+    std::string _api_function;
+
+public:
+    explicit api_error(const std::string&, const std::string&);
+    virtual ~api_error(void) throw();
+
+    static api_error from_stack(state&, const std::string&);
+
+    const std::string& api_function(void) const;
+};
+
+
+/// File not found error.
+class file_not_found_error : public error {
+    /// Name of the not-found file.
+    std::string _filename;
+
+public:
+    explicit file_not_found_error(const std::string&);
+    virtual ~file_not_found_error(void) throw();
+
+    const std::string& filename(void) const;
+};
+
+
+}  // namespace lutok
+
+
+#endif  // !defined(LUTOK_EXCEPTIONS_HPP)

Property changes on: lab4/.minix-src/include/lutok/exceptions.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/psl.h
===================================================================
--- lab4/.minix-src/include/i386/psl.h	(nonexistent)
+++ lab4/.minix-src/include/i386/psl.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: psl.h,v 1.35 2003/02/26 21:29:03 fvdl Exp $	*/
+
+#include <x86/psl.h>

Property changes on: lab4/.minix-src/include/i386/psl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lutok/state.ipp
===================================================================
--- lab4/.minix-src/include/lutok/state.ipp	(nonexistent)
+++ lab4/.minix-src/include/lutok/state.ipp	(revision 13)
@@ -0,0 +1,67 @@
+// Copyright 2011 Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+//   notice, this list of conditions and the following disclaimer.
+// * 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.
+// * Neither the name of Google Inc. nor the names of its contributors
+//   may be used to endorse or promote products derived from this software
+//   without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#if !defined(LUTOK_STATE_IPP)
+#define LUTOK_STATE_IPP
+
+#include <lutok/state.hpp>
+
+namespace lutok {
+
+
+/// Wrapper around lua_newuserdata.
+///
+/// This allocates an object as big as the size of the provided Type.
+///
+/// \return The pointer to the allocated userdata object.
+///
+/// \warning Terminates execution if there is not enough memory.
+template< typename Type >
+Type*
+state::new_userdata(void)
+{
+    return static_cast< Type* >(new_userdata_voidp(sizeof(Type)));
+}
+
+
+/// Wrapper around lua_touserdata.
+///
+/// \param index The second parameter to lua_touserdata.
+///
+/// \return The return value of lua_touserdata.
+template< typename Type >
+Type*
+state::to_userdata(const int index)
+{
+    return static_cast< Type* >(to_userdata_voidp(index));
+}
+
+
+}  // namespace lutok
+
+#endif  // !defined(LUTOK_STATE_IPP)

Property changes on: lab4/.minix-src/include/lutok/state.ipp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/bcj.h
===================================================================
--- lab4/.minix-src/include/lzma/bcj.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/bcj.h	(revision 13)
@@ -0,0 +1,90 @@
+/**
+ * \file        lzma/bcj.h
+ * \brief       Branch/Call/Jump conversion filters
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/* Filter IDs for lzma_filter.id */
+
+#define LZMA_FILTER_X86         LZMA_VLI_C(0x04)
+	/**<
+	 * Filter for x86 binaries
+	 */
+
+#define LZMA_FILTER_POWERPC     LZMA_VLI_C(0x05)
+	/**<
+	 * Filter for Big endian PowerPC binaries
+	 */
+
+#define LZMA_FILTER_IA64        LZMA_VLI_C(0x06)
+	/**<
+	 * Filter for IA-64 (Itanium) binaries.
+	 */
+
+#define LZMA_FILTER_ARM         LZMA_VLI_C(0x07)
+	/**<
+	 * Filter for ARM binaries.
+	 */
+
+#define LZMA_FILTER_ARMTHUMB    LZMA_VLI_C(0x08)
+	/**<
+	 * Filter for ARM-Thumb binaries.
+	 */
+
+#define LZMA_FILTER_SPARC       LZMA_VLI_C(0x09)
+	/**<
+	 * Filter for SPARC binaries.
+	 */
+
+
+/**
+ * \brief       Options for BCJ filters
+ *
+ * The BCJ filters never change the size of the data. Specifying options
+ * for them is optional: if pointer to options is NULL, default value is
+ * used. You probably never need to specify options to BCJ filters, so just
+ * set the options pointer to NULL and be happy.
+ *
+ * If options with non-default values have been specified when encoding,
+ * the same options must also be specified when decoding.
+ *
+ * \note        At the moment, none of the BCJ filters support
+ *              LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified,
+ *              LZMA_OPTIONS_ERROR will be returned. If there is need,
+ *              partial support for LZMA_SYNC_FLUSH can be added in future.
+ *              Partial means that flushing would be possible only at
+ *              offsets that are multiple of 2, 4, or 16 depending on
+ *              the filter, except x86 which cannot be made to support
+ *              LZMA_SYNC_FLUSH predictably.
+ */
+typedef struct {
+	/**
+	 * \brief       Start offset for conversions
+	 *
+	 * This setting is useful only when the same filter is used
+	 * _separately_ for multiple sections of the same executable file,
+	 * and the sections contain cross-section branch/call/jump
+	 * instructions. In that case it is beneficial to set the start
+	 * offset of the non-first sections so that the relative addresses
+	 * of the cross-section branch/call/jump instructions will use the
+	 * same absolute addresses as in the first section.
+	 *
+	 * When the pointer to options is NULL, the default value (zero)
+	 * is used.
+	 */
+	uint32_t start_offset;
+
+} lzma_options_bcj;

Property changes on: lab4/.minix-src/include/lzma/bcj.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/rwlock.h
===================================================================
--- lab4/.minix-src/include/i386/rwlock.h	(nonexistent)
+++ lab4/.minix-src/include/i386/rwlock.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: rwlock.h,v 1.2 2007/02/09 21:55:05 ad Exp $	*/
+
+#include <x86/rwlock.h>

Property changes on: lab4/.minix-src/include/i386/rwlock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/block.h
===================================================================
--- lab4/.minix-src/include/lzma/block.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/block.h	(revision 13)
@@ -0,0 +1,581 @@
+/**
+ * \file        lzma/block.h
+ * \brief       .xz Block handling
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/**
+ * \brief       Options for the Block and Block Header encoders and decoders
+ *
+ * Different Block handling functions use different parts of this structure.
+ * Some read some members, other functions write, and some do both. Only the
+ * members listed for reading need to be initialized when the specified
+ * functions are called. The members marked for writing will be assigned
+ * new values at some point either by calling the given function or by
+ * later calls to lzma_code().
+ */
+typedef struct {
+	/**
+	 * \brief       Block format version
+	 *
+	 * To prevent API and ABI breakages when new features are needed,
+	 * a version number is used to indicate which fields in this
+	 * structure are in use:
+	 *   - liblzma >= 5.0.0: version = 0 is supported.
+	 *   - liblzma >= 5.1.4beta: Support for version = 1 was added,
+	 *     which adds the ignore_check field.
+	 *
+	 * If version is greater than one, most Block related functions
+	 * will return LZMA_OPTIONS_ERROR (lzma_block_header_decode() works
+	 * with any version value).
+	 *
+	 * Read by:
+	 *  - All functions that take pointer to lzma_block as argument,
+	 *    including lzma_block_header_decode().
+	 *
+	 * Written by:
+	 *  - lzma_block_header_decode()
+	 */
+	uint32_t version;
+
+	/**
+	 * \brief       Size of the Block Header field
+	 *
+	 * This is always a multiple of four.
+	 *
+	 * Read by:
+	 *  - lzma_block_header_encode()
+	 *  - lzma_block_header_decode()
+	 *  - lzma_block_compressed_size()
+	 *  - lzma_block_unpadded_size()
+	 *  - lzma_block_total_size()
+	 *  - lzma_block_decoder()
+	 *  - lzma_block_buffer_decode()
+	 *
+	 * Written by:
+	 *  - lzma_block_header_size()
+	 *  - lzma_block_buffer_encode()
+	 */
+	uint32_t header_size;
+#	define LZMA_BLOCK_HEADER_SIZE_MIN 8
+#	define LZMA_BLOCK_HEADER_SIZE_MAX 1024
+
+	/**
+	 * \brief       Type of integrity Check
+	 *
+	 * The Check ID is not stored into the Block Header, thus its value
+	 * must be provided also when decoding.
+	 *
+	 * Read by:
+	 *  - lzma_block_header_encode()
+	 *  - lzma_block_header_decode()
+	 *  - lzma_block_compressed_size()
+	 *  - lzma_block_unpadded_size()
+	 *  - lzma_block_total_size()
+	 *  - lzma_block_encoder()
+	 *  - lzma_block_decoder()
+	 *  - lzma_block_buffer_encode()
+	 *  - lzma_block_buffer_decode()
+	 */
+	lzma_check check;
+
+	/**
+	 * \brief       Size of the Compressed Data in bytes
+	 *
+	 * Encoding: If this is not LZMA_VLI_UNKNOWN, Block Header encoder
+	 * will store this value to the Block Header. Block encoder doesn't
+	 * care about this value, but will set it once the encoding has been
+	 * finished.
+	 *
+	 * Decoding: If this is not LZMA_VLI_UNKNOWN, Block decoder will
+	 * verify that the size of the Compressed Data field matches
+	 * compressed_size.
+	 *
+	 * Usually you don't know this value when encoding in streamed mode,
+	 * and thus cannot write this field into the Block Header.
+	 *
+	 * In non-streamed mode you can reserve space for this field before
+	 * encoding the actual Block. After encoding the data, finish the
+	 * Block by encoding the Block Header. Steps in detail:
+	 *
+	 *  - Set compressed_size to some big enough value. If you don't know
+	 *    better, use LZMA_VLI_MAX, but remember that bigger values take
+	 *    more space in Block Header.
+	 *
+	 *  - Call lzma_block_header_size() to see how much space you need to
+	 *    reserve for the Block Header.
+	 *
+	 *  - Encode the Block using lzma_block_encoder() and lzma_code().
+	 *    It sets compressed_size to the correct value.
+	 *
+	 *  - Use lzma_block_header_encode() to encode the Block Header.
+	 *    Because space was reserved in the first step, you don't need
+	 *    to call lzma_block_header_size() anymore, because due to
+	 *    reserving, header_size has to be big enough. If it is "too big",
+	 *    lzma_block_header_encode() will add enough Header Padding to
+	 *    make Block Header to match the size specified by header_size.
+	 *
+	 * Read by:
+	 *  - lzma_block_header_size()
+	 *  - lzma_block_header_encode()
+	 *  - lzma_block_compressed_size()
+	 *  - lzma_block_unpadded_size()
+	 *  - lzma_block_total_size()
+	 *  - lzma_block_decoder()
+	 *  - lzma_block_buffer_decode()
+	 *
+	 * Written by:
+	 *  - lzma_block_header_decode()
+	 *  - lzma_block_compressed_size()
+	 *  - lzma_block_encoder()
+	 *  - lzma_block_decoder()
+	 *  - lzma_block_buffer_encode()
+	 *  - lzma_block_buffer_decode()
+	 */
+	lzma_vli compressed_size;
+
+	/**
+	 * \brief       Uncompressed Size in bytes
+	 *
+	 * This is handled very similarly to compressed_size above.
+	 *
+	 * uncompressed_size is needed by fewer functions than
+	 * compressed_size. This is because uncompressed_size isn't
+	 * needed to validate that Block stays within proper limits.
+	 *
+	 * Read by:
+	 *  - lzma_block_header_size()
+	 *  - lzma_block_header_encode()
+	 *  - lzma_block_decoder()
+	 *  - lzma_block_buffer_decode()
+	 *
+	 * Written by:
+	 *  - lzma_block_header_decode()
+	 *  - lzma_block_encoder()
+	 *  - lzma_block_decoder()
+	 *  - lzma_block_buffer_encode()
+	 *  - lzma_block_buffer_decode()
+	 */
+	lzma_vli uncompressed_size;
+
+	/**
+	 * \brief       Array of filters
+	 *
+	 * There can be 1-4 filters. The end of the array is marked with
+	 * .id = LZMA_VLI_UNKNOWN.
+	 *
+	 * Read by:
+	 *  - lzma_block_header_size()
+	 *  - lzma_block_header_encode()
+	 *  - lzma_block_encoder()
+	 *  - lzma_block_decoder()
+	 *  - lzma_block_buffer_encode()
+	 *  - lzma_block_buffer_decode()
+	 *
+	 * Written by:
+	 *  - lzma_block_header_decode(): Note that this does NOT free()
+	 *    the old filter options structures. All unused filters[] will
+	 *    have .id == LZMA_VLI_UNKNOWN and .options == NULL. If
+	 *    decoding fails, all filters[] are guaranteed to be
+	 *    LZMA_VLI_UNKNOWN and NULL.
+	 *
+	 * \note        Because of the array is terminated with
+	 *              .id = LZMA_VLI_UNKNOWN, the actual array must
+	 *              have LZMA_FILTERS_MAX + 1 members or the Block
+	 *              Header decoder will overflow the buffer.
+	 */
+	lzma_filter *filters;
+
+	/**
+	 * \brief       Raw value stored in the Check field
+	 *
+	 * After successful coding, the first lzma_check_size(check) bytes
+	 * of this array contain the raw value stored in the Check field.
+	 *
+	 * Note that CRC32 and CRC64 are stored in little endian byte order.
+	 * Take it into account if you display the Check values to the user.
+	 *
+	 * Written by:
+	 *  - lzma_block_encoder()
+	 *  - lzma_block_decoder()
+	 *  - lzma_block_buffer_encode()
+	 *  - lzma_block_buffer_decode()
+	 */
+	uint8_t raw_check[LZMA_CHECK_SIZE_MAX];
+
+	/*
+	 * Reserved space to allow possible future extensions without
+	 * breaking the ABI. You should not touch these, because the names
+	 * of these variables may change. These are and will never be used
+	 * with the currently supported options, so it is safe to leave these
+	 * uninitialized.
+	 */
+	void *reserved_ptr1;
+	void *reserved_ptr2;
+	void *reserved_ptr3;
+	uint32_t reserved_int1;
+	uint32_t reserved_int2;
+	lzma_vli reserved_int3;
+	lzma_vli reserved_int4;
+	lzma_vli reserved_int5;
+	lzma_vli reserved_int6;
+	lzma_vli reserved_int7;
+	lzma_vli reserved_int8;
+	lzma_reserved_enum reserved_enum1;
+	lzma_reserved_enum reserved_enum2;
+	lzma_reserved_enum reserved_enum3;
+	lzma_reserved_enum reserved_enum4;
+
+	/**
+	 * \brief       A flag to Block decoder to not verify the Check field
+	 *
+	 * This field is supported by liblzma >= 5.1.4beta if .version >= 1.
+	 *
+	 * If this is set to true, the integrity check won't be calculated
+	 * and verified. Unless you know what you are doing, you should
+	 * leave this to false. (A reason to set this to true is when the
+	 * file integrity is verified externally anyway and you want to
+	 * speed up the decompression, which matters mostly when using
+	 * SHA-256 as the integrity check.)
+	 *
+	 * If .version >= 1, read by:
+	 *   - lzma_block_decoder()
+	 *   - lzma_block_buffer_decode()
+	 *
+	 * Written by (.version is ignored):
+	 *   - lzma_block_header_decode() always sets this to false
+	 */
+	lzma_bool ignore_check;
+
+	lzma_bool reserved_bool2;
+	lzma_bool reserved_bool3;
+	lzma_bool reserved_bool4;
+	lzma_bool reserved_bool5;
+	lzma_bool reserved_bool6;
+	lzma_bool reserved_bool7;
+	lzma_bool reserved_bool8;
+
+} lzma_block;
+
+
+/**
+ * \brief       Decode the Block Header Size field
+ *
+ * To decode Block Header using lzma_block_header_decode(), the size of the
+ * Block Header has to be known and stored into lzma_block.header_size.
+ * The size can be calculated from the first byte of a Block using this macro.
+ * Note that if the first byte is 0x00, it indicates beginning of Index; use
+ * this macro only when the byte is not 0x00.
+ *
+ * There is no encoding macro, because Block Header encoder is enough for that.
+ */
+#define lzma_block_header_size_decode(b) (((uint32_t)(b) + 1) * 4)
+
+
+/**
+ * \brief       Calculate Block Header Size
+ *
+ * Calculate the minimum size needed for the Block Header field using the
+ * settings specified in the lzma_block structure. Note that it is OK to
+ * increase the calculated header_size value as long as it is a multiple of
+ * four and doesn't exceed LZMA_BLOCK_HEADER_SIZE_MAX. Increasing header_size
+ * just means that lzma_block_header_encode() will add Header Padding.
+ *
+ * \return      - LZMA_OK: Size calculated successfully and stored to
+ *                block->header_size.
+ *              - LZMA_OPTIONS_ERROR: Unsupported version, filters or
+ *                filter options.
+ *              - LZMA_PROG_ERROR: Invalid values like compressed_size == 0.
+ *
+ * \note        This doesn't check that all the options are valid i.e. this
+ *              may return LZMA_OK even if lzma_block_header_encode() or
+ *              lzma_block_encoder() would fail. If you want to validate the
+ *              filter chain, consider using lzma_memlimit_encoder() which as
+ *              a side-effect validates the filter chain.
+ */
+extern LZMA_API(lzma_ret) lzma_block_header_size(lzma_block *block)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Encode Block Header
+ *
+ * The caller must have calculated the size of the Block Header already with
+ * lzma_block_header_size(). If a value larger than the one calculated by
+ * lzma_block_header_size() is used, the Block Header will be padded to the
+ * specified size.
+ *
+ * \param       out         Beginning of the output buffer. This must be
+ *                          at least block->header_size bytes.
+ * \param       block       Block options to be encoded.
+ *
+ * \return      - LZMA_OK: Encoding was successful. block->header_size
+ *                bytes were written to output buffer.
+ *              - LZMA_OPTIONS_ERROR: Invalid or unsupported options.
+ *              - LZMA_PROG_ERROR: Invalid arguments, for example
+ *                block->header_size is invalid or block->filters is NULL.
+ */
+extern LZMA_API(lzma_ret) lzma_block_header_encode(
+		const lzma_block *block, uint8_t *out)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Decode Block Header
+ *
+ * block->version should (usually) be set to the highest value supported
+ * by the application. If the application sets block->version to a value
+ * higher than supported by the current liblzma version, this function will
+ * downgrade block->version to the highest value supported by it. Thus one
+ * should check the value of block->version after calling this function if
+ * block->version was set to a non-zero value and the application doesn't
+ * otherwise know that the liblzma version being used is new enough to
+ * support the specified block->version.
+ *
+ * The size of the Block Header must have already been decoded with
+ * lzma_block_header_size_decode() macro and stored to block->header_size.
+ *
+ * The integrity check type from Stream Header must have been stored
+ * to block->check.
+ *
+ * block->filters must have been allocated, but they don't need to be
+ * initialized (possible existing filter options are not freed).
+ *
+ * \param       block       Destination for Block options.
+ * \param       allocator   lzma_allocator for custom allocator functions.
+ *                          Set to NULL to use malloc() (and also free()
+ *                          if an error occurs).
+ * \param       in          Beginning of the input buffer. This must be
+ *                          at least block->header_size bytes.
+ *
+ * \return      - LZMA_OK: Decoding was successful. block->header_size
+ *                bytes were read from the input buffer.
+ *              - LZMA_OPTIONS_ERROR: The Block Header specifies some
+ *                unsupported options such as unsupported filters. This can
+ *                happen also if block->version was set to a too low value
+ *                compared to what would be required to properly represent
+ *                the information stored in the Block Header.
+ *              - LZMA_DATA_ERROR: Block Header is corrupt, for example,
+ *                the CRC32 doesn't match.
+ *              - LZMA_PROG_ERROR: Invalid arguments, for example
+ *                block->header_size is invalid or block->filters is NULL.
+ */
+extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block,
+		const lzma_allocator *allocator, const uint8_t *in)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Validate and set Compressed Size according to Unpadded Size
+ *
+ * Block Header stores Compressed Size, but Index has Unpadded Size. If the
+ * application has already parsed the Index and is now decoding Blocks,
+ * it can calculate Compressed Size from Unpadded Size. This function does
+ * exactly that with error checking:
+ *
+ *  - Compressed Size calculated from Unpadded Size must be positive integer,
+ *    that is, Unpadded Size must be big enough that after Block Header and
+ *    Check fields there's still at least one byte for Compressed Size.
+ *
+ *  - If Compressed Size was present in Block Header, the new value
+ *    calculated from Unpadded Size is compared against the value
+ *    from Block Header.
+ *
+ * \note        This function must be called _after_ decoding the Block Header
+ *              field so that it can properly validate Compressed Size if it
+ *              was present in Block Header.
+ *
+ * \return      - LZMA_OK: block->compressed_size was set successfully.
+ *              - LZMA_DATA_ERROR: unpadded_size is too small compared to
+ *                block->header_size and lzma_check_size(block->check).
+ *              - LZMA_PROG_ERROR: Some values are invalid. For example,
+ *                block->header_size must be a multiple of four and
+ *                between 8 and 1024 inclusive.
+ */
+extern LZMA_API(lzma_ret) lzma_block_compressed_size(
+		lzma_block *block, lzma_vli unpadded_size)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Calculate Unpadded Size
+ *
+ * The Index field stores Unpadded Size and Uncompressed Size. The latter
+ * can be taken directly from the lzma_block structure after coding a Block,
+ * but Unpadded Size needs to be calculated from Block Header Size,
+ * Compressed Size, and size of the Check field. This is where this function
+ * is needed.
+ *
+ * \return      Unpadded Size on success, or zero on error.
+ */
+extern LZMA_API(lzma_vli) lzma_block_unpadded_size(const lzma_block *block)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Calculate the total encoded size of a Block
+ *
+ * This is equivalent to lzma_block_unpadded_size() except that the returned
+ * value includes the size of the Block Padding field.
+ *
+ * \return      On success, total encoded size of the Block. On error,
+ *              zero is returned.
+ */
+extern LZMA_API(lzma_vli) lzma_block_total_size(const lzma_block *block)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Initialize .xz Block encoder
+ *
+ * Valid actions for lzma_code() are LZMA_RUN, LZMA_SYNC_FLUSH (only if the
+ * filter chain supports it), and LZMA_FINISH.
+ *
+ * \return      - LZMA_OK: All good, continue with lzma_code().
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_UNSUPPORTED_CHECK: block->check specifies a Check ID
+ *                that is not supported by this buid of liblzma. Initializing
+ *                the encoder failed.
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_block_encoder(
+		lzma_stream *strm, lzma_block *block)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Initialize .xz Block decoder
+ *
+ * Valid actions for lzma_code() are LZMA_RUN and LZMA_FINISH. Using
+ * LZMA_FINISH is not required. It is supported only for convenience.
+ *
+ * \return      - LZMA_OK: All good, continue with lzma_code().
+ *              - LZMA_UNSUPPORTED_CHECK: Initialization was successful, but
+ *                the given Check ID is not supported, thus Check will be
+ *                ignored.
+ *              - LZMA_PROG_ERROR
+ *              - LZMA_MEM_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_block_decoder(
+		lzma_stream *strm, lzma_block *block)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Calculate maximum output size for single-call Block encoding
+ *
+ * This is equivalent to lzma_stream_buffer_bound() but for .xz Blocks.
+ * See the documentation of lzma_stream_buffer_bound().
+ */
+extern LZMA_API(size_t) lzma_block_buffer_bound(size_t uncompressed_size)
+		lzma_nothrow;
+
+
+/**
+ * \brief       Single-call .xz Block encoder
+ *
+ * In contrast to the multi-call encoder initialized with
+ * lzma_block_encoder(), this function encodes also the Block Header. This
+ * is required to make it possible to write appropriate Block Header also
+ * in case the data isn't compressible, and different filter chain has to be
+ * used to encode the data in uncompressed form using uncompressed chunks
+ * of the LZMA2 filter.
+ *
+ * When the data isn't compressible, header_size, compressed_size, and
+ * uncompressed_size are set just like when the data was compressible, but
+ * it is possible that header_size is too small to hold the filter chain
+ * specified in block->filters, because that isn't necessarily the filter
+ * chain that was actually used to encode the data. lzma_block_unpadded_size()
+ * still works normally, because it doesn't read the filters array.
+ *
+ * \param       block       Block options: block->version, block->check,
+ *                          and block->filters must have been initialized.
+ * \param       allocator   lzma_allocator for custom allocator functions.
+ *                          Set to NULL to use malloc() and free().
+ * \param       in          Beginning of the input buffer
+ * \param       in_size     Size of the input buffer
+ * \param       out         Beginning of the output buffer
+ * \param       out_pos     The next byte will be written to out[*out_pos].
+ *                          *out_pos is updated only if encoding succeeds.
+ * \param       out_size    Size of the out buffer; the first byte into
+ *                          which no data is written to is out[out_size].
+ *
+ * \return      - LZMA_OK: Encoding was successful.
+ *              - LZMA_BUF_ERROR: Not enough output buffer space.
+ *              - LZMA_UNSUPPORTED_CHECK
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_DATA_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_block_buffer_encode(
+		lzma_block *block, const lzma_allocator *allocator,
+		const uint8_t *in, size_t in_size,
+		uint8_t *out, size_t *out_pos, size_t out_size)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Single-call uncompressed .xz Block encoder
+ *
+ * This is like lzma_block_buffer_encode() except this doesn't try to
+ * compress the data and instead encodes the data using LZMA2 uncompressed
+ * chunks. The required output buffer size can be determined with
+ * lzma_block_buffer_bound().
+ *
+ * Since the data won't be compressed, this function ignores block->filters.
+ * This function doesn't take lzma_allocator because this function doesn't
+ * allocate any memory from the heap.
+ */
+extern LZMA_API(lzma_ret) lzma_block_uncomp_encode(lzma_block *block,
+		const uint8_t *in, size_t in_size,
+		uint8_t *out, size_t *out_pos, size_t out_size)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Single-call .xz Block decoder
+ *
+ * This is single-call equivalent of lzma_block_decoder(), and requires that
+ * the caller has already decoded Block Header and checked its memory usage.
+ *
+ * \param       block       Block options just like with lzma_block_decoder().
+ * \param       allocator   lzma_allocator for custom allocator functions.
+ *                          Set to NULL to use malloc() and free().
+ * \param       in          Beginning of the input buffer
+ * \param       in_pos      The next byte will be read from in[*in_pos].
+ *                          *in_pos is updated only if decoding succeeds.
+ * \param       in_size     Size of the input buffer; the first byte that
+ *                          won't be read is in[in_size].
+ * \param       out         Beginning of the output buffer
+ * \param       out_pos     The next byte will be written to out[*out_pos].
+ *                          *out_pos is updated only if encoding succeeds.
+ * \param       out_size    Size of the out buffer; the first byte into
+ *                          which no data is written to is out[out_size].
+ *
+ * \return      - LZMA_OK: Decoding was successful.
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_DATA_ERROR
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_BUF_ERROR: Output buffer was too small.
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_block_buffer_decode(
+		lzma_block *block, const lzma_allocator *allocator,
+		const uint8_t *in, size_t *in_pos, size_t in_size,
+		uint8_t *out, size_t *out_pos, size_t out_size)
+		lzma_nothrow;

Property changes on: lab4/.minix-src/include/lzma/block.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/delta.h
===================================================================
--- lab4/.minix-src/include/lzma/delta.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/delta.h	(revision 13)
@@ -0,0 +1,77 @@
+/**
+ * \file        lzma/delta.h
+ * \brief       Delta filter
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/**
+ * \brief       Filter ID
+ *
+ * Filter ID of the Delta filter. This is used as lzma_filter.id.
+ */
+#define LZMA_FILTER_DELTA       LZMA_VLI_C(0x03)
+
+
+/**
+ * \brief       Type of the delta calculation
+ *
+ * Currently only byte-wise delta is supported. Other possible types could
+ * be, for example, delta of 16/32/64-bit little/big endian integers, but
+ * these are not currently planned since byte-wise delta is almost as good.
+ */
+typedef enum {
+	LZMA_DELTA_TYPE_BYTE
+} lzma_delta_type;
+
+
+/**
+ * \brief       Options for the Delta filter
+ *
+ * These options are needed by both encoder and decoder.
+ */
+typedef struct {
+	/** For now, this must always be LZMA_DELTA_TYPE_BYTE. */
+	lzma_delta_type type;
+
+	/**
+	 * \brief       Delta distance
+	 *
+	 * With the only currently supported type, LZMA_DELTA_TYPE_BYTE,
+	 * the distance is as bytes.
+	 *
+	 * Examples:
+	 *  - 16-bit stereo audio: distance = 4 bytes
+	 *  - 24-bit RGB image data: distance = 3 bytes
+	 */
+	uint32_t dist;
+#	define LZMA_DELTA_DIST_MIN 1
+#	define LZMA_DELTA_DIST_MAX 256
+
+	/*
+	 * Reserved space to allow possible future extensions without
+	 * breaking the ABI. You should not touch these, because the names
+	 * of these variables may change. These are and will never be used
+	 * when type is LZMA_DELTA_TYPE_BYTE, so it is safe to leave these
+	 * uninitialized.
+	 */
+	uint32_t reserved_int1;
+	uint32_t reserved_int2;
+	uint32_t reserved_int3;
+	uint32_t reserved_int4;
+	void *reserved_ptr1;
+	void *reserved_ptr2;
+
+} lzma_options_delta;

Property changes on: lab4/.minix-src/include/lzma/delta.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/sljit_machdep.h
===================================================================
--- lab4/.minix-src/include/i386/sljit_machdep.h	(nonexistent)
+++ lab4/.minix-src/include/i386/sljit_machdep.h	(revision 13)
@@ -0,0 +1,40 @@
+/*	$NetBSD: sljit_machdep.h,v 1.1 2014/07/23 18:19:44 alnsn Exp $	*/
+
+/*-
+ * Copyright (c) 2012-2013 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_SLJITARCH_H
+#define _I386_SLJITARCH_H
+
+#define SLJIT_CONFIG_X86_32 1
+
+/* No call attributes. */
+#define SLJIT_CALL
+#define SLJIT_X86_32_FASTCALL 0
+
+#define SLJIT_CACHE_FLUSH(from, to)
+
+#endif

Property changes on: lab4/.minix-src/include/i386/sljit_machdep.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/index_hash.h
===================================================================
--- lab4/.minix-src/include/lzma/index_hash.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/index_hash.h	(revision 13)
@@ -0,0 +1,107 @@
+/**
+ * \file        lzma/index_hash.h
+ * \brief       Validate Index by using a hash function
+ *
+ * Hashing makes it possible to use constant amount of memory to validate
+ * Index of arbitrary size.
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+/**
+ * \brief       Opaque data type to hold the Index hash
+ */
+typedef struct lzma_index_hash_s lzma_index_hash;
+
+
+/**
+ * \brief       Allocate and initialize a new lzma_index_hash structure
+ *
+ * If index_hash is NULL, a new lzma_index_hash structure is allocated,
+ * initialized, and a pointer to it returned. If allocation fails, NULL
+ * is returned.
+ *
+ * If index_hash is non-NULL, it is reinitialized and the same pointer
+ * returned. In this case, return value cannot be NULL or a different
+ * pointer than the index_hash that was given as an argument.
+ */
+extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(
+		lzma_index_hash *index_hash, const lzma_allocator *allocator)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Deallocate lzma_index_hash structure
+ */
+extern LZMA_API(void) lzma_index_hash_end(
+		lzma_index_hash *index_hash, const lzma_allocator *allocator)
+		lzma_nothrow;
+
+
+/**
+ * \brief       Add a new Record to an Index hash
+ *
+ * \param       index             Pointer to a lzma_index_hash structure
+ * \param       unpadded_size     Unpadded Size of a Block
+ * \param       uncompressed_size Uncompressed Size of a Block
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_DATA_ERROR: Compressed or uncompressed size of the
+ *                Stream or size of the Index field would grow too big.
+ *              - LZMA_PROG_ERROR: Invalid arguments or this function is being
+ *                used when lzma_index_hash_decode() has already been used.
+ */
+extern LZMA_API(lzma_ret) lzma_index_hash_append(lzma_index_hash *index_hash,
+		lzma_vli unpadded_size, lzma_vli uncompressed_size)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Decode and validate the Index field
+ *
+ * After telling the sizes of all Blocks with lzma_index_hash_append(),
+ * the actual Index field is decoded with this function. Specifically,
+ * once decoding of the Index field has been started, no more Records
+ * can be added using lzma_index_hash_append().
+ *
+ * This function doesn't use lzma_stream structure to pass the input data.
+ * Instead, the input buffer is specified using three arguments. This is
+ * because it matches better the internal APIs of liblzma.
+ *
+ * \param       index_hash      Pointer to a lzma_index_hash structure
+ * \param       in              Pointer to the beginning of the input buffer
+ * \param       in_pos          in[*in_pos] is the next byte to process
+ * \param       in_size         in[in_size] is the first byte not to process
+ *
+ * \return      - LZMA_OK: So far good, but more input is needed.
+ *              - LZMA_STREAM_END: Index decoded successfully and it matches
+ *                the Records given with lzma_index_hash_append().
+ *              - LZMA_DATA_ERROR: Index is corrupt or doesn't match the
+ *                information given with lzma_index_hash_append().
+ *              - LZMA_BUF_ERROR: Cannot progress because *in_pos >= in_size.
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_index_hash_decode(lzma_index_hash *index_hash,
+		const uint8_t *in, size_t *in_pos, size_t in_size)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Get the size of the Index field as bytes
+ *
+ * This is needed to verify the Backward Size field in the Stream Footer.
+ */
+extern LZMA_API(lzma_vli) lzma_index_hash_size(
+		const lzma_index_hash *index_hash)
+		lzma_nothrow lzma_attr_pure;

Property changes on: lab4/.minix-src/include/lzma/index_hash.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/svr4_machdep.h
===================================================================
--- lab4/.minix-src/include/i386/svr4_machdep.h	(nonexistent)
+++ lab4/.minix-src/include/i386/svr4_machdep.h	(revision 13)
@@ -0,0 +1,126 @@
+/*	$NetBSD: svr4_machdep.h,v 1.16 2008/04/28 20:23:24 martin Exp $	 */
+
+/*-
+ * Copyright (c) 1994 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_I386_SVR4_MACHDEP_H_
+#define	_I386_SVR4_MACHDEP_H_
+
+#include <compat/svr4/svr4_types.h>
+
+/*
+ * Machine dependent portions [X86]
+ */
+
+#define SVR4_X86_GS	0
+#define SVR4_X86_FS	1
+#define SVR4_X86_ES	2
+#define SVR4_X86_DS	3
+#define SVR4_X86_EDI	4
+#define SVR4_X86_ESI	5
+#define SVR4_X86_EBP	6
+#define SVR4_X86_ESP	7
+#define SVR4_X86_EBX	8
+#define SVR4_X86_EDX	9
+#define SVR4_X86_ECX	10
+#define SVR4_X86_EAX	11
+#define SVR4_X86_TRAPNO	12
+#define SVR4_X86_ERR	13
+#define SVR4_X86_EIP	14
+#define SVR4_X86_CS	15
+#define SVR4_X86_EFL	16
+#define SVR4_X86_UESP	17
+#define SVR4_X86_SS	18
+#define SVR4_X86_MAXREG	19
+
+
+typedef int svr4_greg_t;
+typedef svr4_greg_t svr4_gregset_t[SVR4_X86_MAXREG];
+
+typedef struct {
+    int		f_x87[62];	/* x87 registers */
+    long	f_weitek[33]; 	/* weitek */
+} svr4_fregset_t;
+
+struct svr4_mcontext;
+
+typedef struct svr4_mcontext {
+	svr4_gregset_t	greg;
+	svr4_fregset_t	freg;
+} svr4_mcontext_t;
+
+#define SVR4_UC_MACHINE_PAD	5
+
+/*
+ * SYSARCH numbers
+ */
+#define SVR4_SYSARCH_FPHW	40
+#define SVR4_SYSARCH_DSCR	75
+
+struct svr4_ssd {
+	unsigned int selector;
+	unsigned int base;
+	unsigned int limit;
+	unsigned int access1;
+	unsigned int access2;
+};
+
+/*
+ * Processor traps
+ */
+#define	SVR4_T_DIVIDE		0
+#define	SVR4_T_TRCTRAP		1
+#define	SVR4_T_NMI		2
+#define	SVR4_T_BPTFLT		3
+#define	SVR4_T_OFLOW		4
+#define	SVR4_T_BOUND		5
+#define	SVR4_T_PRIVINFLT	6
+#define	SVR4_T_DNA		7
+#define	SVR4_T_DOUBLEFLT	8
+#define	SVR4_T_FPOPFLT		9
+#define	SVR4_T_TSSFLT		10
+#define	SVR4_T_SEGNPFLT		11
+#define	SVR4_T_STKFLT		12
+#define	SVR4_T_PROTFLT		13
+#define	SVR4_T_PAGEFLT		14
+#define	SVR4_T_ALIGNFLT		17
+
+/*
+ * Fast syscall gate traps.
+ */
+#define	SVR4_TRAP_FNULL		0	/* Null trap, for testing */
+#define	SVR4_TRAP_FGETFP	1	/* Get emulated FP context */
+#define	SVR4_TRAP_FSETFP	2	/* Set emulated FP context */
+#define	SVR4_TRAP_GETHRTIME	3	/* implements gethrtime(2) */
+#define	SVR4_TRAP_GETHRVTIME	4	/* implements gethrvtime(2) */
+#define	SVR4_TRAP_GETHRESTIME	5	/* clock_gettime(CLOCK_REALTIME, tp) */
+
+void svr4_syscall_intern(struct proc *);
+
+#endif /* !_I386_SVR4_MACHDEP_H_ */

Property changes on: lab4/.minix-src/include/i386/svr4_machdep.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/filter.h
===================================================================
--- lab4/.minix-src/include/lzma/filter.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/filter.h	(revision 13)
@@ -0,0 +1,425 @@
+/**
+ * \file        lzma/filter.h
+ * \brief       Common filter related types and functions
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/**
+ * \brief       Maximum number of filters in a chain
+ *
+ * A filter chain can have 1-4 filters, of which three are allowed to change
+ * the size of the data. Usually only one or two filters are needed.
+ */
+#define LZMA_FILTERS_MAX 4
+
+
+/**
+ * \brief       Filter options
+ *
+ * This structure is used to pass Filter ID and a pointer filter's
+ * options to liblzma. A few functions work with a single lzma_filter
+ * structure, while most functions expect a filter chain.
+ *
+ * A filter chain is indicated with an array of lzma_filter structures.
+ * The array is terminated with .id = LZMA_VLI_UNKNOWN. Thus, the filter
+ * array must have LZMA_FILTERS_MAX + 1 elements (that is, five) to
+ * be able to hold any arbitrary filter chain. This is important when
+ * using lzma_block_header_decode() from block.h, because too small
+ * array would make liblzma write past the end of the filters array.
+ */
+typedef struct {
+	/**
+	 * \brief       Filter ID
+	 *
+	 * Use constants whose name begin with `LZMA_FILTER_' to specify
+	 * different filters. In an array of lzma_filter structures, use
+	 * LZMA_VLI_UNKNOWN to indicate end of filters.
+	 *
+	 * \note        This is not an enum, because on some systems enums
+	 *              cannot be 64-bit.
+	 */
+	lzma_vli id;
+
+	/**
+	 * \brief       Pointer to filter-specific options structure
+	 *
+	 * If the filter doesn't need options, set this to NULL. If id is
+	 * set to LZMA_VLI_UNKNOWN, options is ignored, and thus
+	 * doesn't need be initialized.
+	 */
+	void *options;
+
+} lzma_filter;
+
+
+/**
+ * \brief       Test if the given Filter ID is supported for encoding
+ *
+ * Return true if the give Filter ID is supported for encoding by this
+ * liblzma build. Otherwise false is returned.
+ *
+ * There is no way to list which filters are available in this particular
+ * liblzma version and build. It would be useless, because the application
+ * couldn't know what kind of options the filter would need.
+ */
+extern LZMA_API(lzma_bool) lzma_filter_encoder_is_supported(lzma_vli id)
+		lzma_nothrow lzma_attr_const;
+
+
+/**
+ * \brief       Test if the given Filter ID is supported for decoding
+ *
+ * Return true if the give Filter ID is supported for decoding by this
+ * liblzma build. Otherwise false is returned.
+ */
+extern LZMA_API(lzma_bool) lzma_filter_decoder_is_supported(lzma_vli id)
+		lzma_nothrow lzma_attr_const;
+
+
+/**
+ * \brief       Copy the filters array
+ *
+ * Copy the Filter IDs and filter-specific options from src to dest.
+ * Up to LZMA_FILTERS_MAX filters are copied, plus the terminating
+ * .id == LZMA_VLI_UNKNOWN. Thus, dest should have at least
+ * LZMA_FILTERS_MAX + 1 elements space unless the caller knows that
+ * src is smaller than that.
+ *
+ * Unless the filter-specific options is NULL, the Filter ID has to be
+ * supported by liblzma, because liblzma needs to know the size of every
+ * filter-specific options structure. The filter-specific options are not
+ * validated. If options is NULL, any unsupported Filter IDs are copied
+ * without returning an error.
+ *
+ * Old filter-specific options in dest are not freed, so dest doesn't
+ * need to be initialized by the caller in any way.
+ *
+ * If an error occurs, memory possibly already allocated by this function
+ * is always freed.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_OPTIONS_ERROR: Unsupported Filter ID and its options
+ *                is not NULL.
+ *              - LZMA_PROG_ERROR: src or dest is NULL.
+ */
+extern LZMA_API(lzma_ret) lzma_filters_copy(
+		const lzma_filter *src, lzma_filter *dest,
+		const lzma_allocator *allocator) lzma_nothrow;
+
+
+/**
+ * \brief       Calculate approximate memory requirements for raw encoder
+ *
+ * This function can be used to calculate the memory requirements for
+ * Block and Stream encoders too because Block and Stream encoders don't
+ * need significantly more memory than raw encoder.
+ *
+ * \param       filters     Array of filters terminated with
+ *                          .id == LZMA_VLI_UNKNOWN.
+ *
+ * \return      Number of bytes of memory required for the given
+ *              filter chain when encoding. If an error occurs,
+ *              for example due to unsupported filter chain,
+ *              UINT64_MAX is returned.
+ */
+extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Calculate approximate memory requirements for raw decoder
+ *
+ * This function can be used to calculate the memory requirements for
+ * Block and Stream decoders too because Block and Stream decoders don't
+ * need significantly more memory than raw decoder.
+ *
+ * \param       filters     Array of filters terminated with
+ *                          .id == LZMA_VLI_UNKNOWN.
+ *
+ * \return      Number of bytes of memory required for the given
+ *              filter chain when decoding. If an error occurs,
+ *              for example due to unsupported filter chain,
+ *              UINT64_MAX is returned.
+ */
+extern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter *filters)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Initialize raw encoder
+ *
+ * This function may be useful when implementing custom file formats.
+ *
+ * \param       strm    Pointer to properly prepared lzma_stream
+ * \param       filters Array of lzma_filter structures. The end of the
+ *                      array must be marked with .id = LZMA_VLI_UNKNOWN.
+ *
+ * The `action' with lzma_code() can be LZMA_RUN, LZMA_SYNC_FLUSH (if the
+ * filter chain supports it), or LZMA_FINISH.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_raw_encoder(
+		lzma_stream *strm, const lzma_filter *filters)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Initialize raw decoder
+ *
+ * The initialization of raw decoder goes similarly to raw encoder.
+ *
+ * The `action' with lzma_code() can be LZMA_RUN or LZMA_FINISH. Using
+ * LZMA_FINISH is not required, it is supported just for convenience.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_raw_decoder(
+		lzma_stream *strm, const lzma_filter *filters)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Update the filter chain in the encoder
+ *
+ * This function is for advanced users only. This function has two slightly
+ * different purposes:
+ *
+ *  - After LZMA_FULL_FLUSH when using Stream encoder: Set a new filter
+ *    chain, which will be used starting from the next Block.
+ *
+ *  - After LZMA_SYNC_FLUSH using Raw, Block, or Stream encoder: Change
+ *    the filter-specific options in the middle of encoding. The actual
+ *    filters in the chain (Filter IDs) cannot be changed. In the future,
+ *    it might become possible to change the filter options without
+ *    using LZMA_SYNC_FLUSH.
+ *
+ * While rarely useful, this function may be called also when no data has
+ * been compressed yet. In that case, this function will behave as if
+ * LZMA_FULL_FLUSH (Stream encoder) or LZMA_SYNC_FLUSH (Raw or Block
+ * encoder) had been used right before calling this function.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_MEMLIMIT_ERROR
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_filters_update(
+		lzma_stream *strm, const lzma_filter *filters) lzma_nothrow;
+
+
+/**
+ * \brief       Single-call raw encoder
+ *
+ * \param       filters     Array of lzma_filter structures. The end of the
+ *                          array must be marked with .id = LZMA_VLI_UNKNOWN.
+ * \param       allocator   lzma_allocator for custom allocator functions.
+ *                          Set to NULL to use malloc() and free().
+ * \param       in          Beginning of the input buffer
+ * \param       in_size     Size of the input buffer
+ * \param       out         Beginning of the output buffer
+ * \param       out_pos     The next byte will be written to out[*out_pos].
+ *                          *out_pos is updated only if encoding succeeds.
+ * \param       out_size    Size of the out buffer; the first byte into
+ *                          which no data is written to is out[out_size].
+ *
+ * \return      - LZMA_OK: Encoding was successful.
+ *              - LZMA_BUF_ERROR: Not enough output buffer space.
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_DATA_ERROR
+ *              - LZMA_PROG_ERROR
+ *
+ * \note        There is no function to calculate how big output buffer
+ *              would surely be big enough. (lzma_stream_buffer_bound()
+ *              works only for lzma_stream_buffer_encode(); raw encoder
+ *              won't necessarily meet that bound.)
+ */
+extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
+		const lzma_filter *filters, const lzma_allocator *allocator,
+		const uint8_t *in, size_t in_size, uint8_t *out,
+		size_t *out_pos, size_t out_size) lzma_nothrow;
+
+
+/**
+ * \brief       Single-call raw decoder
+ *
+ * \param       filters     Array of lzma_filter structures. The end of the
+ *                          array must be marked with .id = LZMA_VLI_UNKNOWN.
+ * \param       allocator   lzma_allocator for custom allocator functions.
+ *                          Set to NULL to use malloc() and free().
+ * \param       in          Beginning of the input buffer
+ * \param       in_pos      The next byte will be read from in[*in_pos].
+ *                          *in_pos is updated only if decoding succeeds.
+ * \param       in_size     Size of the input buffer; the first byte that
+ *                          won't be read is in[in_size].
+ * \param       out         Beginning of the output buffer
+ * \param       out_pos     The next byte will be written to out[*out_pos].
+ *                          *out_pos is updated only if encoding succeeds.
+ * \param       out_size    Size of the out buffer; the first byte into
+ *                          which no data is written to is out[out_size].
+ */
+extern LZMA_API(lzma_ret) lzma_raw_buffer_decode(
+		const lzma_filter *filters, const lzma_allocator *allocator,
+		const uint8_t *in, size_t *in_pos, size_t in_size,
+		uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
+
+
+/**
+ * \brief       Get the size of the Filter Properties field
+ *
+ * This function may be useful when implementing custom file formats
+ * using the raw encoder and decoder.
+ *
+ * \param       size    Pointer to uint32_t to hold the size of the properties
+ * \param       filter  Filter ID and options (the size of the properties may
+ *                      vary depending on the options)
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_PROG_ERROR
+ *
+ * \note        This function validates the Filter ID, but does not
+ *              necessarily validate the options. Thus, it is possible
+ *              that this returns LZMA_OK while the following call to
+ *              lzma_properties_encode() returns LZMA_OPTIONS_ERROR.
+ */
+extern LZMA_API(lzma_ret) lzma_properties_size(
+		uint32_t *size, const lzma_filter *filter) lzma_nothrow;
+
+
+/**
+ * \brief       Encode the Filter Properties field
+ *
+ * \param       filter  Filter ID and options
+ * \param       props   Buffer to hold the encoded options. The size of
+ *                      buffer must have been already determined with
+ *                      lzma_properties_size().
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_PROG_ERROR
+ *
+ * \note        Even this function won't validate more options than actually
+ *              necessary. Thus, it is possible that encoding the properties
+ *              succeeds but using the same options to initialize the encoder
+ *              will fail.
+ *
+ * \note        If lzma_properties_size() indicated that the size
+ *              of the Filter Properties field is zero, calling
+ *              lzma_properties_encode() is not required, but it
+ *              won't do any harm either.
+ */
+extern LZMA_API(lzma_ret) lzma_properties_encode(
+		const lzma_filter *filter, uint8_t *props) lzma_nothrow;
+
+
+/**
+ * \brief       Decode the Filter Properties field
+ *
+ * \param       filter      filter->id must have been set to the correct
+ *                          Filter ID. filter->options doesn't need to be
+ *                          initialized (it's not freed by this function). The
+ *                          decoded options will be stored to filter->options.
+ *                          filter->options is set to NULL if there are no
+ *                          properties or if an error occurs.
+ * \param       allocator   Custom memory allocator used to allocate the
+ *                          options. Set to NULL to use the default malloc(),
+ *                          and in case of an error, also free().
+ * \param       props       Input buffer containing the properties.
+ * \param       props_size  Size of the properties. This must be the exact
+ *                          size; giving too much or too little input will
+ *                          return LZMA_OPTIONS_ERROR.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_MEM_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_properties_decode(
+		lzma_filter *filter, const lzma_allocator *allocator,
+		const uint8_t *props, size_t props_size) lzma_nothrow;
+
+
+/**
+ * \brief       Calculate encoded size of a Filter Flags field
+ *
+ * Knowing the size of Filter Flags is useful to know when allocating
+ * memory to hold the encoded Filter Flags.
+ *
+ * \param       size    Pointer to integer to hold the calculated size
+ * \param       filter  Filter ID and associated options whose encoded
+ *                      size is to be calculated
+ *
+ * \return      - LZMA_OK: *size set successfully. Note that this doesn't
+ *                guarantee that filter->options is valid, thus
+ *                lzma_filter_flags_encode() may still fail.
+ *              - LZMA_OPTIONS_ERROR: Unknown Filter ID or unsupported options.
+ *              - LZMA_PROG_ERROR: Invalid options
+ *
+ * \note        If you need to calculate size of List of Filter Flags,
+ *              you need to loop over every lzma_filter entry.
+ */
+extern LZMA_API(lzma_ret) lzma_filter_flags_size(
+		uint32_t *size, const lzma_filter *filter)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Encode Filter Flags into given buffer
+ *
+ * In contrast to some functions, this doesn't allocate the needed buffer.
+ * This is due to how this function is used internally by liblzma.
+ *
+ * \param       filter      Filter ID and options to be encoded
+ * \param       out         Beginning of the output buffer
+ * \param       out_pos     out[*out_pos] is the next write position. This
+ *                          is updated by the encoder.
+ * \param       out_size    out[out_size] is the first byte to not write.
+ *
+ * \return      - LZMA_OK: Encoding was successful.
+ *              - LZMA_OPTIONS_ERROR: Invalid or unsupported options.
+ *              - LZMA_PROG_ERROR: Invalid options or not enough output
+ *                buffer space (you should have checked it with
+ *                lzma_filter_flags_size()).
+ */
+extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter,
+		uint8_t *out, size_t *out_pos, size_t out_size)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Decode Filter Flags from given buffer
+ *
+ * The decoded result is stored into *filter. The old value of
+ * filter->options is not free()d.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_filter_flags_decode(
+		lzma_filter *filter, const lzma_allocator *allocator,
+		const uint8_t *in, size_t *in_pos, size_t in_size)
+		lzma_nothrow lzma_attr_warn_unused_result;

Property changes on: lab4/.minix-src/include/lzma/filter.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/vli.h
===================================================================
--- lab4/.minix-src/include/lzma/vli.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/vli.h	(revision 13)
@@ -0,0 +1,166 @@
+/**
+ * \file        lzma/vli.h
+ * \brief       Variable-length integer handling
+ *
+ * In the .xz format, most integers are encoded in a variable-length
+ * representation, which is sometimes called little endian base-128 encoding.
+ * This saves space when smaller values are more likely than bigger values.
+ *
+ * The encoding scheme encodes seven bits to every byte, using minimum
+ * number of bytes required to represent the given value. Encodings that use
+ * non-minimum number of bytes are invalid, thus every integer has exactly
+ * one encoded representation. The maximum number of bits in a VLI is 63,
+ * thus the vli argument must be less than or equal to UINT64_MAX / 2. You
+ * should use LZMA_VLI_MAX for clarity.
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/**
+ * \brief       Maximum supported value of a variable-length integer
+ */
+#define LZMA_VLI_MAX (UINT64_MAX / 2)
+
+/**
+ * \brief       VLI value to denote that the value is unknown
+ */
+#define LZMA_VLI_UNKNOWN UINT64_MAX
+
+/**
+ * \brief       Maximum supported encoded length of variable length integers
+ */
+#define LZMA_VLI_BYTES_MAX 9
+
+/**
+ * \brief       VLI constant suffix
+ */
+#define LZMA_VLI_C(n) UINT64_C(n)
+
+
+/**
+ * \brief       Variable-length integer type
+ *
+ * Valid VLI values are in the range [0, LZMA_VLI_MAX]. Unknown value is
+ * indicated with LZMA_VLI_UNKNOWN, which is the maximum value of the
+ * underlaying integer type.
+ *
+ * lzma_vli will be uint64_t for the foreseeable future. If a bigger size
+ * is needed in the future, it is guaranteed that 2 * LZMA_VLI_MAX will
+ * not overflow lzma_vli. This simplifies integer overflow detection.
+ */
+typedef uint64_t lzma_vli;
+
+
+/**
+ * \brief       Validate a variable-length integer
+ *
+ * This is useful to test that application has given acceptable values
+ * for example in the uncompressed_size and compressed_size variables.
+ *
+ * \return      True if the integer is representable as VLI or if it
+ *              indicates unknown value.
+ */
+#define lzma_vli_is_valid(vli) \
+	((vli) <= LZMA_VLI_MAX || (vli) == LZMA_VLI_UNKNOWN)
+
+
+/**
+ * \brief       Encode a variable-length integer
+ *
+ * This function has two modes: single-call and multi-call. Single-call mode
+ * encodes the whole integer at once; it is an error if the output buffer is
+ * too small. Multi-call mode saves the position in *vli_pos, and thus it is
+ * possible to continue encoding if the buffer becomes full before the whole
+ * integer has been encoded.
+ *
+ * \param       vli       Integer to be encoded
+ * \param       vli_pos   How many VLI-encoded bytes have already been written
+ *                        out. When starting to encode a new integer in
+ *                        multi-call mode, *vli_pos must be set to zero.
+ *                        To use single-call encoding, set vli_pos to NULL.
+ * \param       out       Beginning of the output buffer
+ * \param       out_pos   The next byte will be written to out[*out_pos].
+ * \param       out_size  Size of the out buffer; the first byte into
+ *                        which no data is written to is out[out_size].
+ *
+ * \return      Slightly different return values are used in multi-call and
+ *              single-call modes.
+ *
+ *              Single-call (vli_pos == NULL):
+ *              - LZMA_OK: Integer successfully encoded.
+ *              - LZMA_PROG_ERROR: Arguments are not sane. This can be due
+ *                to too little output space; single-call mode doesn't use
+ *                LZMA_BUF_ERROR, since the application should have checked
+ *                the encoded size with lzma_vli_size().
+ *
+ *              Multi-call (vli_pos != NULL):
+ *              - LZMA_OK: So far all OK, but the integer is not
+ *                completely written out yet.
+ *              - LZMA_STREAM_END: Integer successfully encoded.
+ *              - LZMA_BUF_ERROR: No output space was provided.
+ *              - LZMA_PROG_ERROR: Arguments are not sane.
+ */
+extern LZMA_API(lzma_ret) lzma_vli_encode(lzma_vli vli, size_t *vli_pos,
+		uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
+
+
+/**
+ * \brief       Decode a variable-length integer
+ *
+ * Like lzma_vli_encode(), this function has single-call and multi-call modes.
+ *
+ * \param       vli       Pointer to decoded integer. The decoder will
+ *                        initialize it to zero when *vli_pos == 0, so
+ *                        application isn't required to initialize *vli.
+ * \param       vli_pos   How many bytes have already been decoded. When
+ *                        starting to decode a new integer in multi-call
+ *                        mode, *vli_pos must be initialized to zero. To
+ *                        use single-call decoding, set vli_pos to NULL.
+ * \param       in        Beginning of the input buffer
+ * \param       in_pos    The next byte will be read from in[*in_pos].
+ * \param       in_size   Size of the input buffer; the first byte that
+ *                        won't be read is in[in_size].
+ *
+ * \return      Slightly different return values are used in multi-call and
+ *              single-call modes.
+ *
+ *              Single-call (vli_pos == NULL):
+ *              - LZMA_OK: Integer successfully decoded.
+ *              - LZMA_DATA_ERROR: Integer is corrupt. This includes hitting
+ *                the end of the input buffer before the whole integer was
+ *                decoded; providing no input at all will use LZMA_DATA_ERROR.
+ *              - LZMA_PROG_ERROR: Arguments are not sane.
+ *
+ *              Multi-call (vli_pos != NULL):
+ *              - LZMA_OK: So far all OK, but the integer is not
+ *                completely decoded yet.
+ *              - LZMA_STREAM_END: Integer successfully decoded.
+ *              - LZMA_DATA_ERROR: Integer is corrupt.
+ *              - LZMA_BUF_ERROR: No input was provided.
+ *              - LZMA_PROG_ERROR: Arguments are not sane.
+ */
+extern LZMA_API(lzma_ret) lzma_vli_decode(lzma_vli *vli, size_t *vli_pos,
+		const uint8_t *in, size_t *in_pos, size_t in_size)
+		lzma_nothrow;
+
+
+/**
+ * \brief       Get the number of bytes required to encode a VLI
+ *
+ * \return      Number of bytes on success (1-9). If vli isn't valid,
+ *              zero is returned.
+ */
+extern LZMA_API(uint32_t) lzma_vli_size(lzma_vli vli)
+		lzma_nothrow lzma_attr_pure;

Property changes on: lab4/.minix-src/include/lzma/vli.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/types.h
===================================================================
--- lab4/.minix-src/include/i386/types.h	(nonexistent)
+++ lab4/.minix-src/include/i386/types.h	(revision 13)
@@ -0,0 +1,140 @@
+/*	$NetBSD: types.h,v 1.83 2015/08/27 12:30:51 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)types.h	7.5 (Berkeley) 3/9/91
+ */
+
+#ifndef	_I386_MACHTYPES_H_
+#define	_I386_MACHTYPES_H_
+
+#ifdef _KERNEL_OPT
+#include "opt_xen.h"
+#endif
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <machine/int_types.h>
+
+#if defined(_KERNEL)
+typedef struct label_t {
+	int val[6];
+} label_t;
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL)
+
+/*
+ * XXX JYM for now, in kernel paddr_t can be 32 or 64 bits, depending
+ * on PAE. Revisit when paddr_t becomes 64 bits for !PAE systems.
+ */
+#ifdef PAE
+typedef __uint64_t	paddr_t;
+typedef __uint64_t	psize_t;
+#define	PRIxPADDR	"llx"
+#define	PRIxPSIZE	"llx"
+#define	PRIuPSIZE	"llu"
+#else /* PAE */
+typedef unsigned long	paddr_t;
+typedef unsigned long	psize_t;
+#define	PRIxPADDR	"lx"
+#define	PRIxPSIZE	"lx"
+#define	PRIuPSIZE	"lu"
+#endif /* PAE */
+
+#else /* _KERNEL */
+/* paddr_t is always 64 bits for userland */
+typedef __uint64_t	paddr_t;
+typedef __uint64_t	psize_t;
+#define	PRIxPADDR	"llx"
+#define	PRIxPSIZE	"llx"
+#define	PRIuPSIZE	"llu"
+
+#endif /* _KERNEL */
+
+typedef unsigned long	vaddr_t;
+typedef unsigned long	vsize_t;
+#define	PRIxVADDR	"lx"
+#define	PRIxVSIZE	"lx"
+#define	PRIuVSIZE	"lu"
+#endif /* _NETBSD_SOURCE */
+
+typedef int		pmc_evid_t;
+typedef __uint64_t	pmc_ctr_t;
+typedef int		register_t;
+#define	PRIxREGISTER	"x"
+
+typedef	unsigned char		__cpu_simple_lock_nv_t;
+
+/* __cpu_simple_lock_t used to be a full word. */
+#define	__CPU_SIMPLE_LOCK_PAD
+
+#define	__SIMPLELOCK_LOCKED	1
+#define	__SIMPLELOCK_UNLOCKED	0
+
+/* The x86 does not have strict alignment requirements. */
+#define	__NO_STRICT_ALIGNMENT
+
+#define	__HAVE_NEW_STYLE_BUS_H
+#define	__HAVE_CPU_DATA_FIRST
+#define	__HAVE_CPU_COUNTER
+#define	__HAVE_CPU_BOOTCONF
+#define	__HAVE_MD_CPU_OFFLINE
+#define	__HAVE_SYSCALL_INTERN
+#define	__HAVE_MINIMAL_EMUL
+#define	__HAVE_OLD_DISKLABEL
+#if defined(_KERNEL)
+/*
+ * Processors < i586 do not have cmpxchg8b, and we compile for i486
+ * by default. The kernel tsc driver uses them though, and handles < i586
+ * by patching.  E.g. rump kernels and crash(8) and a selection of
+ * other run-in-userspace code defines _KERNEL, but is careful not to
+ * build anything using 64bit atomic ops by default.
+ */
+#define __HAVE_ATOMIC64_OPS
+#endif
+#define	__HAVE_ATOMIC_AS_MEMBAR
+#define	__HAVE_CPU_LWP_SETPRIVATE
+#define	__HAVE_INTR_CONTROL
+#define	__HAVE_MM_MD_OPEN
+#define	__HAVE___LWP_GETPRIVATE_FAST
+#if !defined(__minix)
+#define	__HAVE_TLS_VARIANT_II
+#endif /* !defined(__minix) */
+#define	__HAVE_COMMON___TLS_GET_ADDR
+
+#if defined(_KERNEL)
+#define	__HAVE_RAS
+
+#if !defined(XEN) && !defined(NO_PCI_MSI_MSIX)
+#define __HAVE_PCI_MSI_MSIX
+#endif
+#endif
+
+#endif	/* _I386_MACHTYPES_H_ */

Property changes on: lab4/.minix-src/include/i386/types.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/lzma12.h
===================================================================
--- lab4/.minix-src/include/lzma/lzma12.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/lzma12.h	(revision 13)
@@ -0,0 +1,420 @@
+/**
+ * \file        lzma/lzma12.h
+ * \brief       LZMA1 and LZMA2 filters
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/**
+ * \brief       LZMA1 Filter ID
+ *
+ * LZMA1 is the very same thing as what was called just LZMA in LZMA Utils,
+ * 7-Zip, and LZMA SDK. It's called LZMA1 here to prevent developers from
+ * accidentally using LZMA when they actually want LZMA2.
+ *
+ * LZMA1 shouldn't be used for new applications unless you _really_ know
+ * what you are doing. LZMA2 is almost always a better choice.
+ */
+#define LZMA_FILTER_LZMA1       LZMA_VLI_C(0x4000000000000001)
+
+/**
+ * \brief       LZMA2 Filter ID
+ *
+ * Usually you want this instead of LZMA1. Compared to LZMA1, LZMA2 adds
+ * support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion
+ * when trying to compress uncompressible data), possibility to change
+ * lc/lp/pb in the middle of encoding, and some other internal improvements.
+ */
+#define LZMA_FILTER_LZMA2       LZMA_VLI_C(0x21)
+
+
+/**
+ * \brief       Match finders
+ *
+ * Match finder has major effect on both speed and compression ratio.
+ * Usually hash chains are faster than binary trees.
+ *
+ * If you will use LZMA_SYNC_FLUSH often, the hash chains may be a better
+ * choice, because binary trees get much higher compression ratio penalty
+ * with LZMA_SYNC_FLUSH.
+ *
+ * The memory usage formulas are only rough estimates, which are closest to
+ * reality when dict_size is a power of two. The formulas are  more complex
+ * in reality, and can also change a little between liblzma versions. Use
+ * lzma_raw_encoder_memusage() to get more accurate estimate of memory usage.
+ */
+typedef enum {
+	LZMA_MF_HC3     = 0x03,
+		/**<
+		 * \brief       Hash Chain with 2- and 3-byte hashing
+		 *
+		 * Minimum nice_len: 3
+		 *
+		 * Memory usage:
+		 *  - dict_size <= 16 MiB: dict_size * 7.5
+		 *  - dict_size > 16 MiB: dict_size * 5.5 + 64 MiB
+		 */
+
+	LZMA_MF_HC4     = 0x04,
+		/**<
+		 * \brief       Hash Chain with 2-, 3-, and 4-byte hashing
+		 *
+		 * Minimum nice_len: 4
+		 *
+		 * Memory usage:
+		 *  - dict_size <= 32 MiB: dict_size * 7.5
+		 *  - dict_size > 32 MiB: dict_size * 6.5
+		 */
+
+	LZMA_MF_BT2     = 0x12,
+		/**<
+		 * \brief       Binary Tree with 2-byte hashing
+		 *
+		 * Minimum nice_len: 2
+		 *
+		 * Memory usage: dict_size * 9.5
+		 */
+
+	LZMA_MF_BT3     = 0x13,
+		/**<
+		 * \brief       Binary Tree with 2- and 3-byte hashing
+		 *
+		 * Minimum nice_len: 3
+		 *
+		 * Memory usage:
+		 *  - dict_size <= 16 MiB: dict_size * 11.5
+		 *  - dict_size > 16 MiB: dict_size * 9.5 + 64 MiB
+		 */
+
+	LZMA_MF_BT4     = 0x14
+		/**<
+		 * \brief       Binary Tree with 2-, 3-, and 4-byte hashing
+		 *
+		 * Minimum nice_len: 4
+		 *
+		 * Memory usage:
+		 *  - dict_size <= 32 MiB: dict_size * 11.5
+		 *  - dict_size > 32 MiB: dict_size * 10.5
+		 */
+} lzma_match_finder;
+
+
+/**
+ * \brief       Test if given match finder is supported
+ *
+ * Return true if the given match finder is supported by this liblzma build.
+ * Otherwise false is returned. It is safe to call this with a value that
+ * isn't listed in lzma_match_finder enumeration; the return value will be
+ * false.
+ *
+ * There is no way to list which match finders are available in this
+ * particular liblzma version and build. It would be useless, because
+ * a new match finder, which the application developer wasn't aware,
+ * could require giving additional options to the encoder that the older
+ * match finders don't need.
+ */
+extern LZMA_API(lzma_bool) lzma_mf_is_supported(lzma_match_finder match_finder)
+		lzma_nothrow lzma_attr_const;
+
+
+/**
+ * \brief       Compression modes
+ *
+ * This selects the function used to analyze the data produced by the match
+ * finder.
+ */
+typedef enum {
+	LZMA_MODE_FAST = 1,
+		/**<
+		 * \brief       Fast compression
+		 *
+		 * Fast mode is usually at its best when combined with
+		 * a hash chain match finder.
+		 */
+
+	LZMA_MODE_NORMAL = 2
+		/**<
+		 * \brief       Normal compression
+		 *
+		 * This is usually notably slower than fast mode. Use this
+		 * together with binary tree match finders to expose the
+		 * full potential of the LZMA1 or LZMA2 encoder.
+		 */
+} lzma_mode;
+
+
+/**
+ * \brief       Test if given compression mode is supported
+ *
+ * Return true if the given compression mode is supported by this liblzma
+ * build. Otherwise false is returned. It is safe to call this with a value
+ * that isn't listed in lzma_mode enumeration; the return value will be false.
+ *
+ * There is no way to list which modes are available in this particular
+ * liblzma version and build. It would be useless, because a new compression
+ * mode, which the application developer wasn't aware, could require giving
+ * additional options to the encoder that the older modes don't need.
+ */
+extern LZMA_API(lzma_bool) lzma_mode_is_supported(lzma_mode mode)
+		lzma_nothrow lzma_attr_const;
+
+
+/**
+ * \brief       Options specific to the LZMA1 and LZMA2 filters
+ *
+ * Since LZMA1 and LZMA2 share most of the code, it's simplest to share
+ * the options structure too. For encoding, all but the reserved variables
+ * need to be initialized unless specifically mentioned otherwise.
+ * lzma_lzma_preset() can be used to get a good starting point.
+ *
+ * For raw decoding, both LZMA1 and LZMA2 need dict_size, preset_dict, and
+ * preset_dict_size (if preset_dict != NULL). LZMA1 needs also lc, lp, and pb.
+ */
+typedef struct {
+	/**
+	 * \brief       Dictionary size in bytes
+	 *
+	 * Dictionary size indicates how many bytes of the recently processed
+	 * uncompressed data is kept in memory. One method to reduce size of
+	 * the uncompressed data is to store distance-length pairs, which
+	 * indicate what data to repeat from the dictionary buffer. Thus,
+	 * the bigger the dictionary, the better the compression ratio
+	 * usually is.
+	 *
+	 * Maximum size of the dictionary depends on multiple things:
+	 *  - Memory usage limit
+	 *  - Available address space (not a problem on 64-bit systems)
+	 *  - Selected match finder (encoder only)
+	 *
+	 * Currently the maximum dictionary size for encoding is 1.5 GiB
+	 * (i.e. (UINT32_C(1) << 30) + (UINT32_C(1) << 29)) even on 64-bit
+	 * systems for certain match finder implementation reasons. In the
+	 * future, there may be match finders that support bigger
+	 * dictionaries.
+	 *
+	 * Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
+	 * UINT32_MAX), so increasing the maximum dictionary size of the
+	 * encoder won't cause problems for old decoders.
+	 *
+	 * Because extremely small dictionaries sizes would have unneeded
+	 * overhead in the decoder, the minimum dictionary size is 4096 bytes.
+	 *
+	 * \note        When decoding, too big dictionary does no other harm
+	 *              than wasting memory.
+	 */
+	uint32_t dict_size;
+#	define LZMA_DICT_SIZE_MIN       UINT32_C(4096)
+#	define LZMA_DICT_SIZE_DEFAULT   (UINT32_C(1) << 23)
+
+	/**
+	 * \brief       Pointer to an initial dictionary
+	 *
+	 * It is possible to initialize the LZ77 history window using
+	 * a preset dictionary. It is useful when compressing many
+	 * similar, relatively small chunks of data independently from
+	 * each other. The preset dictionary should contain typical
+	 * strings that occur in the files being compressed. The most
+	 * probable strings should be near the end of the preset dictionary.
+	 *
+	 * This feature should be used only in special situations. For
+	 * now, it works correctly only with raw encoding and decoding.
+	 * Currently none of the container formats supported by
+	 * liblzma allow preset dictionary when decoding, thus if
+	 * you create a .xz or .lzma file with preset dictionary, it
+	 * cannot be decoded with the regular decoder functions. In the
+	 * future, the .xz format will likely get support for preset
+	 * dictionary though.
+	 */
+	const uint8_t *preset_dict;
+
+	/**
+	 * \brief       Size of the preset dictionary
+	 *
+	 * Specifies the size of the preset dictionary. If the size is
+	 * bigger than dict_size, only the last dict_size bytes are
+	 * processed.
+	 *
+	 * This variable is read only when preset_dict is not NULL.
+	 * If preset_dict is not NULL but preset_dict_size is zero,
+	 * no preset dictionary is used (identical to only setting
+	 * preset_dict to NULL).
+	 */
+	uint32_t preset_dict_size;
+
+	/**
+	 * \brief       Number of literal context bits
+	 *
+	 * How many of the highest bits of the previous uncompressed
+	 * eight-bit byte (also known as `literal') are taken into
+	 * account when predicting the bits of the next literal.
+	 *
+	 * E.g. in typical English text, an upper-case letter is
+	 * often followed by a lower-case letter, and a lower-case
+	 * letter is usually followed by another lower-case letter.
+	 * In the US-ASCII character set, the highest three bits are 010
+	 * for upper-case letters and 011 for lower-case letters.
+	 * When lc is at least 3, the literal coding can take advantage of
+	 * this property in the uncompressed data.
+	 *
+	 * There is a limit that applies to literal context bits and literal
+	 * position bits together: lc + lp <= 4. Without this limit the
+	 * decoding could become very slow, which could have security related
+	 * results in some cases like email servers doing virus scanning.
+	 * This limit also simplifies the internal implementation in liblzma.
+	 *
+	 * There may be LZMA1 streams that have lc + lp > 4 (maximum possible
+	 * lc would be 8). It is not possible to decode such streams with
+	 * liblzma.
+	 */
+	uint32_t lc;
+#	define LZMA_LCLP_MIN    0
+#	define LZMA_LCLP_MAX    4
+#	define LZMA_LC_DEFAULT  3
+
+	/**
+	 * \brief       Number of literal position bits
+	 *
+	 * lp affects what kind of alignment in the uncompressed data is
+	 * assumed when encoding literals. A literal is a single 8-bit byte.
+	 * See pb below for more information about alignment.
+	 */
+	uint32_t lp;
+#	define LZMA_LP_DEFAULT  0
+
+	/**
+	 * \brief       Number of position bits
+	 *
+	 * pb affects what kind of alignment in the uncompressed data is
+	 * assumed in general. The default means four-byte alignment
+	 * (2^ pb =2^2=4), which is often a good choice when there's
+	 * no better guess.
+	 *
+	 * When the aligment is known, setting pb accordingly may reduce
+	 * the file size a little. E.g. with text files having one-byte
+	 * alignment (US-ASCII, ISO-8859-*, UTF-8), setting pb=0 can
+	 * improve compression slightly. For UTF-16 text, pb=1 is a good
+	 * choice. If the alignment is an odd number like 3 bytes, pb=0
+	 * might be the best choice.
+	 *
+	 * Even though the assumed alignment can be adjusted with pb and
+	 * lp, LZMA1 and LZMA2 still slightly favor 16-byte alignment.
+	 * It might be worth taking into account when designing file formats
+	 * that are likely to be often compressed with LZMA1 or LZMA2.
+	 */
+	uint32_t pb;
+#	define LZMA_PB_MIN      0
+#	define LZMA_PB_MAX      4
+#	define LZMA_PB_DEFAULT  2
+
+	/** Compression mode */
+	lzma_mode mode;
+
+	/**
+	 * \brief       Nice length of a match
+	 *
+	 * This determines how many bytes the encoder compares from the match
+	 * candidates when looking for the best match. Once a match of at
+	 * least nice_len bytes long is found, the encoder stops looking for
+	 * better candidates and encodes the match. (Naturally, if the found
+	 * match is actually longer than nice_len, the actual length is
+	 * encoded; it's not truncated to nice_len.)
+	 *
+	 * Bigger values usually increase the compression ratio and
+	 * compression time. For most files, 32 to 128 is a good value,
+	 * which gives very good compression ratio at good speed.
+	 *
+	 * The exact minimum value depends on the match finder. The maximum
+	 * is 273, which is the maximum length of a match that LZMA1 and
+	 * LZMA2 can encode.
+	 */
+	uint32_t nice_len;
+
+	/** Match finder ID */
+	lzma_match_finder mf;
+
+	/**
+	 * \brief       Maximum search depth in the match finder
+	 *
+	 * For every input byte, match finder searches through the hash chain
+	 * or binary tree in a loop, each iteration going one step deeper in
+	 * the chain or tree. The searching stops if
+	 *  - a match of at least nice_len bytes long is found;
+	 *  - all match candidates from the hash chain or binary tree have
+	 *    been checked; or
+	 *  - maximum search depth is reached.
+	 *
+	 * Maximum search depth is needed to prevent the match finder from
+	 * wasting too much time in case there are lots of short match
+	 * candidates. On the other hand, stopping the search before all
+	 * candidates have been checked can reduce compression ratio.
+	 *
+	 * Setting depth to zero tells liblzma to use an automatic default
+	 * value, that depends on the selected match finder and nice_len.
+	 * The default is in the range [4, 200] or so (it may vary between
+	 * liblzma versions).
+	 *
+	 * Using a bigger depth value than the default can increase
+	 * compression ratio in some cases. There is no strict maximum value,
+	 * but high values (thousands or millions) should be used with care:
+	 * the encoder could remain fast enough with typical input, but
+	 * malicious input could cause the match finder to slow down
+	 * dramatically, possibly creating a denial of service attack.
+	 */
+	uint32_t depth;
+
+	/*
+	 * Reserved space to allow possible future extensions without
+	 * breaking the ABI. You should not touch these, because the names
+	 * of these variables may change. These are and will never be used
+	 * with the currently supported options, so it is safe to leave these
+	 * uninitialized.
+	 */
+	uint32_t reserved_int1;
+	uint32_t reserved_int2;
+	uint32_t reserved_int3;
+	uint32_t reserved_int4;
+	uint32_t reserved_int5;
+	uint32_t reserved_int6;
+	uint32_t reserved_int7;
+	uint32_t reserved_int8;
+	lzma_reserved_enum reserved_enum1;
+	lzma_reserved_enum reserved_enum2;
+	lzma_reserved_enum reserved_enum3;
+	lzma_reserved_enum reserved_enum4;
+	void *reserved_ptr1;
+	void *reserved_ptr2;
+
+} lzma_options_lzma;
+
+
+/**
+ * \brief       Set a compression preset to lzma_options_lzma structure
+ *
+ * 0 is the fastest and 9 is the slowest. These match the switches -0 .. -9
+ * of the xz command line tool. In addition, it is possible to bitwise-or
+ * flags to the preset. Currently only LZMA_PRESET_EXTREME is supported.
+ * The flags are defined in container.h, because the flags are used also
+ * with lzma_easy_encoder().
+ *
+ * The preset values are subject to changes between liblzma versions.
+ *
+ * This function is available only if LZMA1 or LZMA2 encoder has been enabled
+ * when building liblzma.
+ *
+ * \return      On success, false is returned. If the preset is not
+ *              supported, true is returned.
+ */
+extern LZMA_API(lzma_bool) lzma_lzma_preset(
+		lzma_options_lzma *options, uint32_t preset) lzma_nothrow;

Property changes on: lab4/.minix-src/include/lzma/lzma12.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/bitmap.h
===================================================================
--- lab4/.minix-src/include/minix/bitmap.h	(nonexistent)
+++ lab4/.minix-src/include/minix/bitmap.h	(revision 13)
@@ -0,0 +1,34 @@
+#ifndef _BITMAP_H
+#define _BITMAP_H
+
+/* Bit map operations to manipulate bits of a simple mask variable. */
+#define bit_set(mask, n)	((mask) |= (1 << (n)))
+#define bit_unset(mask, n)	((mask) &= ~(1 << (n)))
+#define bit_isset(mask, n)	((mask) & (1 << (n)))
+#define bit_empty(mask)		((mask) = 0)
+#define bit_fill(mask)		((mask) = ~0)
+
+/* Definitions previously in kernel/const.h */
+#define BITCHUNK_BITS   (sizeof(bitchunk_t) * CHAR_BIT)
+#define BITMAP_CHUNKS(nr_bits) (((nr_bits)+BITCHUNK_BITS-1)/BITCHUNK_BITS)
+#define MAP_CHUNK(map,bit) (map)[((bit)/BITCHUNK_BITS)]
+#define CHUNK_OFFSET(bit) ((bit)%BITCHUNK_BITS)
+#define GET_BIT(map,bit) ( MAP_CHUNK(map,bit) & (1 << CHUNK_OFFSET(bit) ))
+#define SET_BIT(map,bit) ( MAP_CHUNK(map,bit) |= (1 << CHUNK_OFFSET(bit) ))
+#define UNSET_BIT(map,bit) ( MAP_CHUNK(map,bit) &= ~(1 << CHUNK_OFFSET(bit) ))
+
+#if defined(CONFIG_SMP) && defined(__GNUC__)
+#ifndef __ASSEMBLY__
+static inline void bits_fill(bitchunk_t * chunks, unsigned bits)
+{
+	unsigned c, cnt;
+
+	cnt = BITMAP_CHUNKS(bits);
+	for (c = 0; c < cnt; c++)
+		bit_fill(chunks[c]);
+}
+#endif
+#endif
+
+
+#endif	/* _BITMAP_H */

Property changes on: lab4/.minix-src/include/minix/bitmap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/hardware.h
===================================================================
--- lab4/.minix-src/include/lzma/hardware.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/hardware.h	(revision 13)
@@ -0,0 +1,64 @@
+/**
+ * \file        lzma/hardware.h
+ * \brief       Hardware information
+ *
+ * Since liblzma can consume a lot of system resources, it also provides
+ * ways to limit the resource usage. Applications linking against liblzma
+ * need to do the actual decisions how much resources to let liblzma to use.
+ * To ease making these decisions, liblzma provides functions to find out
+ * the relevant capabilities of the underlaying hardware. Currently there
+ * is only a function to find out the amount of RAM, but in the future there
+ * will be also a function to detect how many concurrent threads the system
+ * can run.
+ *
+ * \note        On some operating systems, these function may temporarily
+ *              load a shared library or open file descriptor(s) to find out
+ *              the requested hardware information. Unless the application
+ *              assumes that specific file descriptors are not touched by
+ *              other threads, this should have no effect on thread safety.
+ *              Possible operations involving file descriptors will restart
+ *              the syscalls if they return EINTR.
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/**
+ * \brief       Get the total amount of physical memory (RAM) in bytes
+ *
+ * This function may be useful when determining a reasonable memory
+ * usage limit for decompressing or how much memory it is OK to use
+ * for compressing.
+ *
+ * \return      On success, the total amount of physical memory in bytes
+ *              is returned. If the amount of RAM cannot be determined,
+ *              zero is returned. This can happen if an error occurs
+ *              or if there is no code in liblzma to detect the amount
+ *              of RAM on the specific operating system.
+ */
+extern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow;
+
+
+/**
+ * \brief       Get the number of processor cores or threads
+ *
+ * This function may be useful when determining how many threads to use.
+ * If the hardware supports more than one thread per CPU core, the number
+ * of hardware threads is returned if that information is available.
+ *
+ * \brief       On success, the number of available CPU threads or cores is
+ *              returned. If this information isn't available or an error
+ *              occurs, zero is returned.
+ */
+extern LZMA_API(uint32_t) lzma_cputhreads(void) lzma_nothrow;

Property changes on: lab4/.minix-src/include/lzma/hardware.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/i386/wchar_limits.h
===================================================================
--- lab4/.minix-src/include/i386/wchar_limits.h	(nonexistent)
+++ lab4/.minix-src/include/i386/wchar_limits.h	(revision 13)
@@ -0,0 +1,47 @@
+/*	$NetBSD: wchar_limits.h,v 1.2 2008/04/28 20:23:24 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_WCHAR_LIMITS_H_
+#define _I386_WCHAR_LIMITS_H_
+
+/*
+ * 7.18.3 Limits of other integer types
+ */
+
+/* limits of wchar_t */
+#define	WCHAR_MIN	(-0x7fffffff-1)			/* wchar_t	  */
+#define	WCHAR_MAX	0x7fffffff			/* wchar_t	  */
+
+/* limits of wint_t */
+#define	WINT_MIN	(-0x7fffffff-1)			/* wint_t	  */
+#define	WINT_MAX	0x7fffffff			/* wint_t	  */
+
+#endif /* !_I386_WCHAR_LIMITS_H_ */

Property changes on: lab4/.minix-src/include/i386/wchar_limits.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/acpi.h
===================================================================
--- lab4/.minix-src/include/minix/acpi.h	(nonexistent)
+++ lab4/.minix-src/include/minix/acpi.h	(revision 13)
@@ -0,0 +1,48 @@
+#include <sys/types.h>
+#include <minix/ipc.h>
+
+#define ACPI_REQ_GET_IRQ			1
+#define ACPI_REQ_MAP_BRIDGE			2
+
+struct acpi_request_hdr {
+	endpoint_t 	m_source; /* message header */
+	u32_t		request;
+};
+
+/*
+ * Message to request dev/pin translation to IRQ by acpi using the acpi routing
+ * tables
+ */
+struct acpi_get_irq_req {
+	struct acpi_request_hdr	hdr;
+	u32_t			bus;
+	u32_t			dev;
+	u32_t			pin;
+	u32_t			__padding[4];
+};
+
+/* response from acpi to acpi_get_irq_req */
+struct acpi_get_irq_resp {
+	endpoint_t 	m_source; /* message header */
+	i32_t		irq;
+	u32_t		__padding[7];
+};
+
+/* message format for pci bridge mappings to acpi */
+struct acpi_map_bridge_req {
+	struct acpi_request_hdr	hdr;
+	u32_t	primary_bus;
+	u32_t	secondary_bus;
+	u32_t	device;
+	u32_t	__padding[4];
+};
+
+struct acpi_map_bridge_resp {
+	endpoint_t 	m_source; /* message header */
+	int		err;
+	u32_t		__padding[7];
+};
+
+int acpi_init(void);
+int acpi_get_irq(unsigned bus, unsigned dev, unsigned pin);
+void acpi_map_bridge(unsigned int pbnr, unsigned int dev, unsigned int sbnr);

Property changes on: lab4/.minix-src/include/minix/acpi.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/bpf.h
===================================================================
--- lab4/.minix-src/include/minix/bpf.h	(nonexistent)
+++ lab4/.minix-src/include/minix/bpf.h	(revision 13)
@@ -0,0 +1,42 @@
+#ifndef _MINIX_BPF_H
+#define _MINIX_BPF_H
+
+#include <net/bpf.h>
+
+/*
+ * MINIX3-specific extensions to the NetBSD Berkeley Packet Filter header.
+ * These extensions are necessary because NetBSD BPF uses a few ioctl(2)
+ * structure formats that contain pointers--something that MINIX3 has to avoid,
+ * due to its memory granting mechanisms.  Thus, those ioctl(2) calls have to
+ * be converted from NetBSD to MINIX3 format.  We currently do that in libc.
+ * This header specifies the numbers and formats for the MINIX3 versions.
+ *
+ * See <minix/if.h> for details on how things work here.
+ */
+
+/* BIOCSETF: set BPF filter program. */
+/*
+ * This ioctl is an exception, as it is write-only, so we do not need the
+ * original structure.  Also, the size of this structure is currently slightly
+ * over 4KB, which makes it too big for a regular ioctl call.  Thus, we have to
+ * use a big ioctl call.  Note that future changes of BPF_MAXINSNS will
+ * unfortunately (necessarily) change the ioctl call number.
+ */
+struct minix_bpf_program {
+	u_int mbf_len;
+	struct bpf_insn mbf_insns[BPF_MAXINSNS];
+};
+
+#define MINIX_BIOCSETF		_IOW_BIG(2, struct minix_bpf_program)
+
+/* BIOCGDLTLIST: retrieve list of possible data link types. */
+#define MINIX_BPF_MAXDLT	256
+
+struct minix_bpf_dltlist {
+	struct bpf_dltlist mbfl_dltlist;		/* MUST be first */
+	u_int mbfl_list[MINIX_BPF_MAXDLT];
+};
+
+#define MINIX_BIOCGDLTLIST	_IOWR('B', 119, struct minix_bpf_dltlist)
+
+#endif /* !_MINIX_BPF_H */

Property changes on: lab4/.minix-src/include/minix/bpf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/isofs/cd9660/cd9660_rrip.h
===================================================================
--- lab4/.minix-src/include/isofs/cd9660/cd9660_rrip.h	(nonexistent)
+++ lab4/.minix-src/include/isofs/cd9660/cd9660_rrip.h	(revision 13)
@@ -0,0 +1,143 @@
+/*	$NetBSD: cd9660_rrip.h,v 1.3 2005/12/03 17:34:43 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley
+ * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
+ * Support code is derived from software contributed to Berkeley
+ * by Atsushi Murai (amurai@spec.co.jp).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)cd9660_rrip.h	8.2 (Berkeley) 12/5/94
+ */
+
+#ifndef _ISOFS_CD9660_CD9660_RRIP_H_
+#define _ISOFS_CD9660_CD9660_RRIP_H_
+
+typedef struct {
+	char   type			[ISODCL (  0,    1)];
+	u_char length			[ISODCL (  2,    2)]; /* 711 */
+	u_char version			[ISODCL (  3,    3)];
+} ISO_SUSP_HEADER;
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	char mode			[ISODCL (  4,   11)]; /* 733 */
+	char links			[ISODCL ( 12,   19)]; /* 733 */
+	char uid			[ISODCL ( 20,   27)]; /* 733 */
+	char gid			[ISODCL ( 28,   35)]; /* 733 */
+} ISO_RRIP_ATTR;
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	char dev_t_high			[ISODCL (  4,   11)]; /* 733 */
+	char dev_t_low			[ISODCL ( 12,   19)]; /* 733 */
+} ISO_RRIP_DEVICE;
+
+#define	ISO_SUSP_CFLAG_CONTINUE	0x01
+#define	ISO_SUSP_CFLAG_CURRENT	0x02
+#define	ISO_SUSP_CFLAG_PARENT	0x04
+#define	ISO_SUSP_CFLAG_ROOT	0x08
+#define	ISO_SUSP_CFLAG_VOLROOT	0x10
+#define	ISO_SUSP_CFLAG_HOST	0x20
+
+typedef struct {
+	u_char cflag			[ISODCL (  1,    1)];
+	u_char clen			[ISODCL (  2,    2)];
+	u_char name			[1];			/* XXX */
+} ISO_RRIP_SLINK_COMPONENT;
+#define	ISO_RRIP_SLSIZ	2
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	u_char flags			[ISODCL (  4,    4)];
+	u_char component		[ISODCL (  5,    5)];
+} ISO_RRIP_SLINK;
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	char flags			[ISODCL (  4,    4)];
+} ISO_RRIP_ALTNAME;
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	char dir_loc			[ISODCL (  4,    11)]; /* 733 */
+} ISO_RRIP_CLINK;
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	char dir_loc			[ISODCL (  4,    11)]; /* 733 */
+} ISO_RRIP_PLINK;
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+} ISO_RRIP_RELDIR;
+
+#define	ISO_SUSP_TSTAMP_FORM17	0x80
+#define	ISO_SUSP_TSTAMP_FORM7	0x00
+#define	ISO_SUSP_TSTAMP_CREAT	0x01
+#define	ISO_SUSP_TSTAMP_MODIFY	0x02
+#define	ISO_SUSP_TSTAMP_ACCESS	0x04
+#define	ISO_SUSP_TSTAMP_ATTR	0x08
+#define	ISO_SUSP_TSTAMP_BACKUP	0x10
+#define	ISO_SUSP_TSTAMP_EXPIRE	0x20
+#define	ISO_SUSP_TSTAMP_EFFECT	0x40
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	u_char flags			[ISODCL (  4,    4)];
+	u_char time			[ISODCL (  5,    5)];
+} ISO_RRIP_TSTAMP;
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	u_char flags			[ISODCL (  4,    4)];
+} ISO_RRIP_IDFLAG;
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	char len_id			[ISODCL (  4,    4)];
+	char len_des			[ISODCL (  5,	 5)];
+	char len_src			[ISODCL (  6,	 6)];
+	char version			[ISODCL (  7,	 7)];
+} ISO_RRIP_EXTREF;
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	char check			[ISODCL (  4,	 5)];
+	char skip			[ISODCL (  6,	 6)];
+} ISO_RRIP_OFFSET;
+
+typedef struct {
+	ISO_SUSP_HEADER			h;
+	char location			[ISODCL (  4,	11)];
+	char offset			[ISODCL ( 12,	19)];
+	char length			[ISODCL ( 20,	27)];
+} ISO_RRIP_CONT;
+
+#endif /* _ISOFS_CD9660_CD9660_RRIP_H_ */

Property changes on: lab4/.minix-src/include/isofs/cd9660/cd9660_rrip.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/blockdriver.h
===================================================================
--- lab4/.minix-src/include/minix/blockdriver.h	(nonexistent)
+++ lab4/.minix-src/include/minix/blockdriver.h	(revision 13)
@@ -0,0 +1,62 @@
+#ifndef _MINIX_BLOCKDRIVER_H
+#define _MINIX_BLOCKDRIVER_H
+
+#include <minix/driver.h>
+
+typedef int device_id_t;
+typedef int thread_id_t;
+
+/* Types supported for the 'type' field of struct blockdriver. */
+typedef enum {
+  BLOCKDRIVER_TYPE_DISK,		/* handle partition requests */
+  BLOCKDRIVER_TYPE_OTHER		/* do not handle partition requests */
+} blockdriver_type_t;
+
+/* Entry points into the device dependent code of block drivers. */
+struct blockdriver {
+  blockdriver_type_t bdr_type;
+  int (*bdr_open)(devminor_t minor, int access);
+  int (*bdr_close)(devminor_t minor);
+  ssize_t (*bdr_transfer)(devminor_t minor, int do_write, u64_t pos,
+	  endpoint_t endpt, iovec_t *iov, unsigned int count, int flags);
+  int (*bdr_ioctl)(devminor_t minor, unsigned long request, endpoint_t endpt,
+	  cp_grant_id_t grant, endpoint_t user_endpt);
+  void (*bdr_cleanup)(void);
+  struct device *(*bdr_part)(devminor_t minor);
+  void (*bdr_geometry)(devminor_t minor, struct part_geom *part);
+  void (*bdr_intr)(unsigned int mask);
+  void (*bdr_alarm)(clock_t stamp);
+  void (*bdr_other)(message *m_ptr, int ipc_status);
+  int (*bdr_device)(devminor_t minor, device_id_t *id);
+};
+
+/* Functions defined by libblockdriver. These can be used for both
+ * singlethreaded and multithreaded drivers.
+ */
+void blockdriver_announce(int type);
+
+#ifndef _BLOCKDRIVER_MT_API
+/* Additional functions for the singlethreaded version. These allow the driver
+ * to either use the stock driver_task(), or implement its own message loop.
+ * To avoid accidents, these functions are not exposed when minix/driver_mt.h
+ * has been included previously.
+ */
+int blockdriver_receive_mq(message *m_ptr, int *status_ptr);
+void blockdriver_process(struct blockdriver *dp, message *m_ptr, int
+	ipc_status);
+void blockdriver_terminate(void);
+void blockdriver_task(struct blockdriver *bdp);
+int blockdriver_mq_queue(message *m_ptr, int status);
+#endif /* !_BLOCKDRIVER_MT_API */
+
+/* Parameters for the disk drive. */
+#define SECTOR_SIZE      512	/* physical sector size in bytes */
+#define SECTOR_SHIFT       9	/* for division */
+#define SECTOR_MASK      511	/* and remainder */
+
+#define CD_SECTOR_SIZE  2048	/* sector size of a CD-ROM in bytes */
+
+/* Size of the DMA buffer buffer in bytes. */
+#define DMA_BUF_SIZE	(DMA_SECTORS * SECTOR_SIZE)
+
+#endif /* _MINIX_BLOCKDRIVER_H */

Property changes on: lab4/.minix-src/include/minix/blockdriver.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/clkconf.h
===================================================================
--- lab4/.minix-src/include/minix/clkconf.h	(nonexistent)
+++ lab4/.minix-src/include/minix/clkconf.h	(revision 13)
@@ -0,0 +1,18 @@
+#ifndef _CLKCONF_H
+#define _CLKCONF_H
+
+/* Clock configuration */
+#define CM_FCLKEN1_CORE 0xA00
+#define CM_ICLKEN1_CORE 0xA10
+#define CM_FCLKEN_WKUP 0xC00
+#define CM_ICLKEN_WKUP 0xC10
+
+#define CM_PER_I2C2_CLKCTRL 0x044
+#define CM_PER_I2C1_CLKCTRL 0x048
+#define CM_WKUP_I2C0_CLKCTRL 0x4B8
+
+int clkconf_init(void);
+int clkconf_set(u32_t clk, u32_t mask, u32_t value);
+int clkconf_release(void);
+
+#endif

Property changes on: lab4/.minix-src/include/minix/clkconf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/stream_flags.h
===================================================================
--- lab4/.minix-src/include/lzma/stream_flags.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/stream_flags.h	(revision 13)
@@ -0,0 +1,223 @@
+/**
+ * \file        lzma/stream_flags.h
+ * \brief       .xz Stream Header and Stream Footer encoder and decoder
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/**
+ * \brief       Size of Stream Header and Stream Footer
+ *
+ * Stream Header and Stream Footer have the same size and they are not
+ * going to change even if a newer version of the .xz file format is
+ * developed in future.
+ */
+#define LZMA_STREAM_HEADER_SIZE 12
+
+
+/**
+ * \brief       Options for encoding/decoding Stream Header and Stream Footer
+ */
+typedef struct {
+	/**
+	 * \brief       Stream Flags format version
+	 *
+	 * To prevent API and ABI breakages if new features are needed in
+	 * Stream Header or Stream Footer, a version number is used to
+	 * indicate which fields in this structure are in use. For now,
+	 * version must always be zero. With non-zero version, the
+	 * lzma_stream_header_encode() and lzma_stream_footer_encode()
+	 * will return LZMA_OPTIONS_ERROR.
+	 *
+	 * lzma_stream_header_decode() and lzma_stream_footer_decode()
+	 * will always set this to the lowest value that supports all the
+	 * features indicated by the Stream Flags field. The application
+	 * must check that the version number set by the decoding functions
+	 * is supported by the application. Otherwise it is possible that
+	 * the application will decode the Stream incorrectly.
+	 */
+	uint32_t version;
+
+	/**
+	 * \brief       Backward Size
+	 *
+	 * Backward Size must be a multiple of four bytes. In this Stream
+	 * format version, Backward Size is the size of the Index field.
+	 *
+	 * Backward Size isn't actually part of the Stream Flags field, but
+	 * it is convenient to include in this structure anyway. Backward
+	 * Size is present only in the Stream Footer. There is no need to
+	 * initialize backward_size when encoding Stream Header.
+	 *
+	 * lzma_stream_header_decode() always sets backward_size to
+	 * LZMA_VLI_UNKNOWN so that it is convenient to use
+	 * lzma_stream_flags_compare() when both Stream Header and Stream
+	 * Footer have been decoded.
+	 */
+	lzma_vli backward_size;
+#	define LZMA_BACKWARD_SIZE_MIN 4
+#	define LZMA_BACKWARD_SIZE_MAX (LZMA_VLI_C(1) << 34)
+
+	/**
+	 * \brief       Check ID
+	 *
+	 * This indicates the type of the integrity check calculated from
+	 * uncompressed data.
+	 */
+	lzma_check check;
+
+	/*
+	 * Reserved space to allow possible future extensions without
+	 * breaking the ABI. You should not touch these, because the
+	 * names of these variables may change.
+	 *
+	 * (We will never be able to use all of these since Stream Flags
+	 * is just two bytes plus Backward Size of four bytes. But it's
+	 * nice to have the proper types when they are needed.)
+	 */
+	lzma_reserved_enum reserved_enum1;
+	lzma_reserved_enum reserved_enum2;
+	lzma_reserved_enum reserved_enum3;
+	lzma_reserved_enum reserved_enum4;
+	lzma_bool reserved_bool1;
+	lzma_bool reserved_bool2;
+	lzma_bool reserved_bool3;
+	lzma_bool reserved_bool4;
+	lzma_bool reserved_bool5;
+	lzma_bool reserved_bool6;
+	lzma_bool reserved_bool7;
+	lzma_bool reserved_bool8;
+	uint32_t reserved_int1;
+	uint32_t reserved_int2;
+
+} lzma_stream_flags;
+
+
+/**
+ * \brief       Encode Stream Header
+ *
+ * \param       options     Stream Header options to be encoded.
+ *                          options->backward_size is ignored and doesn't
+ *                          need to be initialized.
+ * \param       out         Beginning of the output buffer of
+ *                          LZMA_STREAM_HEADER_SIZE bytes.
+ *
+ * \return      - LZMA_OK: Encoding was successful.
+ *              - LZMA_OPTIONS_ERROR: options->version is not supported by
+ *                this liblzma version.
+ *              - LZMA_PROG_ERROR: Invalid options.
+ */
+extern LZMA_API(lzma_ret) lzma_stream_header_encode(
+		const lzma_stream_flags *options, uint8_t *out)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Encode Stream Footer
+ *
+ * \param       options     Stream Footer options to be encoded.
+ * \param       out         Beginning of the output buffer of
+ *                          LZMA_STREAM_HEADER_SIZE bytes.
+ *
+ * \return      - LZMA_OK: Encoding was successful.
+ *              - LZMA_OPTIONS_ERROR: options->version is not supported by
+ *                this liblzma version.
+ *              - LZMA_PROG_ERROR: Invalid options.
+ */
+extern LZMA_API(lzma_ret) lzma_stream_footer_encode(
+		const lzma_stream_flags *options, uint8_t *out)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Decode Stream Header
+ *
+ * \param       options     Target for the decoded Stream Header options.
+ * \param       in          Beginning of the input buffer of
+ *                          LZMA_STREAM_HEADER_SIZE bytes.
+ *
+ * options->backward_size is always set to LZMA_VLI_UNKNOWN. This is to
+ * help comparing Stream Flags from Stream Header and Stream Footer with
+ * lzma_stream_flags_compare().
+ *
+ * \return      - LZMA_OK: Decoding was successful.
+ *              - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given
+ *                buffer cannot be Stream Header.
+ *              - LZMA_DATA_ERROR: CRC32 doesn't match, thus the header
+ *                is corrupt.
+ *              - LZMA_OPTIONS_ERROR: Unsupported options are present
+ *                in the header.
+ *
+ * \note        When decoding .xz files that contain multiple Streams, it may
+ *              make sense to print "file format not recognized" only if
+ *              decoding of the Stream Header of the _first_ Stream gives
+ *              LZMA_FORMAT_ERROR. If non-first Stream Header gives
+ *              LZMA_FORMAT_ERROR, the message used for LZMA_DATA_ERROR is
+ *              probably more appropriate.
+ *
+ *              For example, Stream decoder in liblzma uses LZMA_DATA_ERROR if
+ *              LZMA_FORMAT_ERROR is returned by lzma_stream_header_decode()
+ *              when decoding non-first Stream.
+ */
+extern LZMA_API(lzma_ret) lzma_stream_header_decode(
+		lzma_stream_flags *options, const uint8_t *in)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Decode Stream Footer
+ *
+ * \param       options     Target for the decoded Stream Header options.
+ * \param       in          Beginning of the input buffer of
+ *                          LZMA_STREAM_HEADER_SIZE bytes.
+ *
+ * \return      - LZMA_OK: Decoding was successful.
+ *              - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given
+ *                buffer cannot be Stream Footer.
+ *              - LZMA_DATA_ERROR: CRC32 doesn't match, thus the Stream Footer
+ *                is corrupt.
+ *              - LZMA_OPTIONS_ERROR: Unsupported options are present
+ *                in Stream Footer.
+ *
+ * \note        If Stream Header was already decoded successfully, but
+ *              decoding Stream Footer returns LZMA_FORMAT_ERROR, the
+ *              application should probably report some other error message
+ *              than "file format not recognized", since the file more likely
+ *              is corrupt (possibly truncated). Stream decoder in liblzma
+ *              uses LZMA_DATA_ERROR in this situation.
+ */
+extern LZMA_API(lzma_ret) lzma_stream_footer_decode(
+		lzma_stream_flags *options, const uint8_t *in)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Compare two lzma_stream_flags structures
+ *
+ * backward_size values are compared only if both are not
+ * LZMA_VLI_UNKNOWN.
+ *
+ * \return      - LZMA_OK: Both are equal. If either had backward_size set
+ *                to LZMA_VLI_UNKNOWN, backward_size values were not
+ *                compared or validated.
+ *              - LZMA_DATA_ERROR: The structures differ.
+ *              - LZMA_OPTIONS_ERROR: version in either structure is greater
+ *                than the maximum supported version (currently zero).
+ *              - LZMA_PROG_ERROR: Invalid value, e.g. invalid check or
+ *                backward_size.
+ */
+extern LZMA_API(lzma_ret) lzma_stream_flags_compare(
+		const lzma_stream_flags *a, const lzma_stream_flags *b)
+		lzma_nothrow lzma_attr_pure;

Property changes on: lab4/.minix-src/include/lzma/stream_flags.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lcom/lab3.h
===================================================================
--- lab4/.minix-src/include/lcom/lab3.h	(nonexistent)
+++ lab4/.minix-src/include/lcom/lab3.h	(revision 13)
@@ -0,0 +1,73 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+
+/** @defgroup lab3 lab3
+ * @{
+ *
+ * Functions for testing the kbd code
+ */
+
+/** 
+ * @brief To test reading of scancodes via KBD interrupts 
+ * 
+ * Displays the scancodes received from the keyboard
+ * Exits upon release of the ESC key
+ * 
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (kbd_test_scan)();
+
+/**
+ * @brief To test reading of scancodes via polling
+ * 
+ * Displays the scancodes received from the keyboard
+ * Exits upon release of the ESC key
+ * 
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (kbd_test_poll)();
+
+/** 
+ * @brief To test handling of more than one interrupt
+ * 
+ *  Similar to kbd_test_scan() except that it 
+ *  should terminate also if no scancodes are received for n seconds
+ * 
+ * @param n Number of seconds without scancodes before exiting
+ * 
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (kbd_test_timed_scan)(uint8_t n);
+
+/** 
+ * @brief Interrupt handler to read scancodes in C.
+ */
+void (kbc_ih)(void);
+
+/**
+ * @brief To print the scancodes
+ * 
+ * Prints the scancodes via printf
+ * Provided via the LCF -- no need to implement it
+ * 
+ * @param make Whether this is a make or a break code
+ * @param size Size in bytes of the scancode
+ * @param bytes Array with size elements, with the scancode bytes
+ * 
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (kbd_print_scancode)(bool make, uint8_t size, uint8_t *bytes);
+
+/**
+ * @brief To print the no of sys_inb() calls
+ * 
+ * Prints the no of sys_inb() calls via printf
+ * Provided via the LCF -- no need to implement it
+ * 
+ * @param no_calls Number of sys_inb() calls via printf
+ * 
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int (kbd_print_no_sysinb)(uint32_t cnt);

Property changes on: lab4/.minix-src/include/lcom/lab3.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/btrace.h
===================================================================
--- lab4/.minix-src/include/minix/btrace.h	(nonexistent)
+++ lab4/.minix-src/include/minix/btrace.h	(revision 13)
@@ -0,0 +1,40 @@
+#ifndef _MINIX_BTRACE_H
+#define _MINIX_BTRACE_H
+
+/* Control directives. */
+enum {
+  BTCTL_START,
+  BTCTL_STOP
+};
+
+/* Request codes. */
+enum {
+  BTREQ_OPEN,
+  BTREQ_CLOSE,
+  BTREQ_READ,
+  BTREQ_WRITE,
+  BTREQ_GATHER,
+  BTREQ_SCATTER,
+  BTREQ_IOCTL
+};
+
+/* Special result codes. */
+#define BTRES_INPROGRESS	(-997)
+
+/* Block trace entry. */
+typedef struct {
+  u32_t request;		/* request code; one of BTR_xxx */
+  u32_t size;			/* request size, ioctl request, or access */
+  u64_t position;		/* starting disk position */
+  u32_t flags;			/* transfer flags */
+  i32_t result;			/* request result; OK, bytes, or error */
+  u32_t start_time;		/* request service start time (us) */
+  u32_t finish_time;		/* request service completion time (us) */
+} btrace_entry;			/* (32 bytes) */
+
+/* This is the number of btrace_entry structures copied out at once using the
+ * BIOCTRACEGET ioctl call.
+ */
+#define BTBUF_SIZE	1024
+
+#endif /* _MINIX_BTRACE_H */

Property changes on: lab4/.minix-src/include/minix/btrace.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/cpufeature.h
===================================================================
--- lab4/.minix-src/include/minix/cpufeature.h	(nonexistent)
+++ lab4/.minix-src/include/minix/cpufeature.h	(revision 13)
@@ -0,0 +1,32 @@
+
+#ifndef _MINIX_CPUFEATURE_H
+#define _MINIX_CPUFEATURE_H 1
+
+#define _CPUF_I386_FPU		0	/* FPU-x87 FPU on Chip */
+#define _CPUF_I386_PSE 		1	/* Page Size Extension */
+#define _CPUF_I386_PGE 		2	/* Page Global Enable */
+#define _CPUF_I386_APIC_ON_CHIP	3	/* APIC is present on the chip */
+#define _CPUF_I386_TSC		4	/* Timestamp counter present */
+#define _CPUF_I386_SSE1234_12	5	/* Support for SSE/SSE2/SSE3/SSSE3/SSE4
+					 * Extensions and FXSR
+					 */
+#define _CPUF_I386_FXSR		6
+#define _CPUF_I386_SSE		7
+#define _CPUF_I386_SSE2		8
+#define _CPUF_I386_SSE3		9
+#define _CPUF_I386_SSSE3	10
+#define _CPUF_I386_SSE4_1	11
+#define _CPUF_I386_SSE4_2	12
+
+#define _CPUF_I386_HTT		13	/* Supports HTT */
+#define _CPUF_I386_HTT_MAX_NUM	14	/* Maximal num of threads */
+
+#define _CPUF_I386_MTRR		15
+#define _CPUF_I386_SYSENTER	16	/* Intel SYSENTER instrs */
+#define _CPUF_I386_SYSCALL	17	/* AMD SYSCALL instrs */
+
+#define _CPUF_I386_PAE		18	/* Page Address Extension */
+
+int _cpufeature(int featureno);
+
+#endif

Property changes on: lab4/.minix-src/include/minix/cpufeature.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/audio_fw.h
===================================================================
--- lab4/.minix-src/include/minix/audio_fw.h	(nonexistent)
+++ lab4/.minix-src/include/minix/audio_fw.h	(revision 13)
@@ -0,0 +1,91 @@
+#ifndef AUDIO_FW_H
+#define AUDIO_FW_H
+
+#include <minix/drivers.h>
+#include <minix/chardriver.h>
+#include <sys/ioc_sound.h>
+
+
+int drv_init(void);
+int drv_init_hw(void);
+int drv_reset(void);
+int drv_start(int sub_dev, int DmaMode);
+int drv_stop(int sub_dev);
+int drv_set_dma(u32_t dma, u32_t length, int chan);
+int drv_reenable_int(int chan);
+int drv_int_sum(void);
+int drv_int(int sub_dev);
+int drv_pause(int chan);
+int drv_resume(int chan);
+int drv_io_ctl(unsigned long request, void * val, int * len, int sub_dev);
+int drv_get_irq(char *irq);
+int drv_get_frag_size(u32_t *frag_size, int sub_dev);
+
+
+
+/* runtime status fields */
+typedef struct {
+	int readable;
+	int writable;
+	int DmaSize;
+	int NrOfDmaFragments;
+	int MinFragmentSize;
+	int NrOfExtraBuffers;
+	int Nr;                                   /* sub device number */
+	int Opened;                               /* sub device opened */
+	int DmaBusy;                              /* is dma busy? */
+	int DmaMode;                              /* DEV_WRITE / DEV_READ */
+	int DmaReadNext;                          /* current dma buffer */
+	int DmaFillNext;                          /* next dma buffer to fill */
+	int DmaLength;
+	int BufReadNext;                          /* start of extra circular buffer */
+	int BufFillNext;                          /* end of extra circular buffer */
+	int BufLength;
+	int RevivePending;                        /* process waiting for this dev? */
+	endpoint_t ReviveProcNr;                  /* the process to unblock */
+	cdev_id_t ReviveId;                       /* request ID */
+	cp_grant_id_t ReviveGrant;		  /* grant id associated with io */
+	endpoint_t SourceProcNr;                  /* process to send notify to (FS) */
+	u32_t FragSize;                           /* dma fragment size */
+	char *DmaBuf;        /* the dma buffer; extra space for 
+												  page alignment */
+	phys_bytes DmaPhys;                       /* physical address of dma buffer */
+	char* DmaPtr;                             /* pointer to aligned dma buffer */
+	int OutOfData;                            /* all buffers empty? */
+	char *ExtraBuf;                           /* don't use extra buffer;just 
+											   declare a pointer to supress
+											   error messages */
+} sub_dev_t;
+
+typedef struct {
+	int minor_dev_nr;
+	int read_chan;
+	int write_chan;
+	int io_ctl;
+} special_file_t;
+
+typedef struct {
+	char* DriverName;
+	int NrOfSubDevices;
+	int NrOfSpecialFiles;
+} drv_t;
+
+EXTERN drv_t drv;
+EXTERN sub_dev_t sub_dev[];
+EXTERN special_file_t special_file[];
+
+/* Number of bytes you can DMA before hitting a 64K boundary: */
+#define dma_bytes_left(phys)    \
+   ((unsigned) (sizeof(int) == 2 ? 0 : 0x10000) - (unsigned) ((phys) & 0xFFFF))
+
+#define NO_CHANNEL -1
+
+#define NO_DMA 0
+#define READ_DMA 1
+#define WRITE_DMA 2
+
+EXTERN int sef_cb_lu_prepare(int state);
+EXTERN int sef_cb_lu_state_isvalid(int state, int flags);
+EXTERN void sef_cb_lu_state_dump(int state);
+
+#endif /* AUDIO_FW_H */

Property changes on: lab4/.minix-src/include/minix/audio_fw.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lcom/timer.h
===================================================================
--- lab4/.minix-src/include/lcom/timer.h	(nonexistent)
+++ lab4/.minix-src/include/lcom/timer.h	(revision 13)
@@ -0,0 +1,115 @@
+#ifndef __TIMER_H
+#define __TIMER_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+/** @defgroup timer timer
+ * @{
+ *
+ * Functions for using the i8254 timers
+ */
+
+/**
+ * @brief Enumerated type for specifying the timer value initialization
+ */
+enum timer_init {
+  INVAL_val,    /*!< Invalid initialization mode */
+  LSB_only,     /*!< Initialization only of the LSB */
+  MSB_only,     /*!< Initialization only of the MSB */
+  MSB_after_LSB /*!< Initialization of LSB and MSB, in this order */
+};
+
+/**
+ * @brief Enumerated type for identifying the timer status fields
+ */
+enum timer_status_field {
+  tsf_all,     /*!< configuration/status */
+  tsf_initial, /*!< timer initialization mode */
+  tsf_mode,    /*!< timer counting mode */
+  tsf_base     /*!< timer counting base */
+};
+
+/**
+ * @brief Union for storing values of timer status fields, including the full status byte
+ */
+union timer_status_field_val {
+  uint8_t byte;            /*!< status */
+  enum timer_init in_mode; /*!< initialization mode */
+  uint8_t count_mode;      /*!< counting mode: 0, 1,.., 5 */
+  bool bcd;                /*!< counting base, true if BCD */
+};
+
+/**
+ * @brief Changes the operating frequency of a timer
+ * 
+ * Must use the read-back command so that it does not change 
+ *   the 4 LSBs (mode and BCD/binary) of the timer's control word.
+ * 
+ * @param timer Timer to configure. (Ranges from 0 to 2)
+ * @param freq Timer operating frequency
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int(timer_set_frequency)(uint8_t timer, uint32_t freq);
+
+/**
+ * @brief Subscribes and enables Timer 0 interrupts
+ *
+ * @param bit_no address of memory to be initialized with the
+ *         bit number to be set in the mask returned upon an interrupt
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int(timer_subscribe_int)(uint8_t *bit_no);
+
+/**
+ * @brief Unsubscribes Timer 0 interrupts
+ *
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int(timer_unsubscribe_int)();
+
+/**
+ * @brief Timer 0 interrupt handler
+ *
+ * Increments counter
+ */
+void(timer_int_handler)();
+
+/**
+ * @brief Reads the input timer configuration (status) via read-back command
+ *
+ * @param timer Timer whose configuration to read (Ranges from 0 to 2)
+ * @param st    Address of memory position to be filled with the timer config
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int(timer_get_conf)(uint8_t timer, uint8_t *st);
+
+/**
+ * @brief Shows timer configuration
+ * 
+ * Displays, in a human friendly way, the specified field of a 
+ *  timer status, which was read via the read-back command
+ *
+ * @param timer timer whose configuration should be displayed (Ranges from 0 to 2)
+ * @param st status read via the read-back command
+ * @param field status field to display in human friendly way
+ * @return Return 0 upon success and non-zero otherwise
+ */
+int(timer_display_conf)(uint8_t timer, uint8_t st, enum timer_status_field field);
+
+/**
+ * @brief Prints a timer config field value
+ * 
+ * @return Returns 0 upon success and non-zero otherwise 
+ */
+int(timer_print_config)(uint8_t timer, enum timer_status_field field,
+                        union timer_status_field_val val);
+
+/**
+ * @brief Increments elapsed time count
+ * 
+ * @return Returns the current time count
+ */
+uint32_t(timer_print_elapsed_time)();
+
+#endif /* __TIMER_H */

Property changes on: lab4/.minix-src/include/lcom/timer.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/dmap.h
===================================================================
--- lab4/.minix-src/include/minix/dmap.h	(nonexistent)
+++ lab4/.minix-src/include/minix/dmap.h	(revision 13)
@@ -0,0 +1,115 @@
+#ifndef _DMAP_H
+#define _DMAP_H
+
+#include <minix/sys_config.h>
+#include <minix/ipc.h>
+
+/*===========================================================================*
+ *               	 Major and minor device numbers  		     *
+ *===========================================================================*/
+
+/* Major device numbers. */
+
+/* Note that NO_DEV is major 0, minor 0, and means "no device".  In contrast,
+ * NONE_MAJOR is used for file systems that do not have backing device (but are
+ * mounted on device 'none').  For administrative purposes, these file systems
+ * need to be assigned a pseudo device, and such pseudo devices are allocated
+ * with major number NONE_MAJOR.  Because of NO_DEV, the NONE_MAJOR devices
+ * start from minor number 1.  Otherwise, NONE_MAJOR is completely independent
+ * from NO_DEV, and it should be possible to set NONE_MAJOR to a nonzero value!
+ */
+#define NONE_MAJOR		   0	/*  0 = pseudo device for 'none' FSes */
+#define MEMORY_MAJOR  		   1	/*  1 = /dev/mem    (memory devices)  */
+#define FLOPPY_MAJOR	           2	/*  2 = /dev/fd0    (floppy disks)    */
+                                        /*  3 = /dev/c0                       */
+#define TTY_MAJOR		   4	/*  4 = /dev/tty00  (ttys)            */
+#define CTTY_MAJOR		   5	/*  5 = /dev/tty                      */
+#define PRINTER_MAJOR		   6	/*  6 = /dev/lp     (printer driver)  */
+#define TCPIP_MAJOR		   7	/*  7 = /dev/bpf    (TCP/IP service)  */
+					/*  8 = /dev/c1                       */
+#define PTY_MAJOR		   9	/*  9 = /dev/ptyp0  (pty driver)      */
+					/* 10 = /dev/c2                       */
+#define FILTER_MAJOR		  11	/* 11 = /dev/filter (filter driver)   */
+					/* 12 = /dev/c3                       */
+#define AUDIO_MAJOR		  13	/* 13 = /dev/audio  (audio driver)    */
+#define FBD_MAJOR		  14	/* 14 = /dev/fbd    (faulty block dev)*/
+#define LOG_MAJOR		  15	/* 15 = /dev/klog   (log driver)      */
+#define RANDOM_MAJOR		  16	/* 16 = /dev/random (random driver)   */
+#define HELLO_MAJOR		  17	/* 17 = /dev/hello  (hello driver)    */
+					/* 18 = (unused)                      */
+#define FB_MAJOR		  19	/* 19 = /dev/fb0    (fb driver)       */
+#define I2C0_MAJOR		  20	/* 20 = /dev/i2c-1  (i2c-dev)         */
+#define I2C1_MAJOR		  21	/* 21 = /dev/i2c-2  (i2c-dev)         */
+#define I2C2_MAJOR		  22	/* 22 = /dev/i2c-3  (i2c-dev)         */
+#define EEPROMB1S50_MAJOR	  23	/* 23 = /dev/eepromb1s50 (cat24c256)  */
+#define EEPROMB1S51_MAJOR	  24	/* 24 = /dev/eepromb1s51 (cat24c256)  */
+#define EEPROMB1S52_MAJOR	  25	/* 25 = /dev/eepromb1s52 (cat24c256)  */
+#define EEPROMB1S53_MAJOR	  26	/* 26 = /dev/eepromb1s53 (cat24c256)  */
+#define EEPROMB1S54_MAJOR	  27	/* 27 = /dev/eepromb1s54 (cat24c256)  */
+#define EEPROMB1S55_MAJOR	  28	/* 28 = /dev/eepromb1s55 (cat24c256)  */
+#define EEPROMB1S56_MAJOR	  29	/* 29 = /dev/eepromb1s56 (cat24c256)  */
+#define EEPROMB1S57_MAJOR	  30	/* 30 = /dev/eepromb1s57 (cat24c256)  */
+#define EEPROMB2S50_MAJOR	  31	/* 31 = /dev/eepromb2s50 (cat24c256)  */
+#define EEPROMB2S51_MAJOR	  32	/* 32 = /dev/eepromb2s51 (cat24c256)  */
+#define EEPROMB2S52_MAJOR	  33	/* 33 = /dev/eepromb2s52 (cat24c256)  */
+#define EEPROMB2S53_MAJOR	  34	/* 34 = /dev/eepromb2s53 (cat24c256)  */
+#define EEPROMB2S54_MAJOR	  35	/* 35 = /dev/eepromb2s54 (cat24c256)  */
+#define EEPROMB2S55_MAJOR	  36	/* 36 = /dev/eepromb2s55 (cat24c256)  */
+#define EEPROMB2S56_MAJOR	  37	/* 37 = /dev/eepromb2s56 (cat24c256)  */
+#define EEPROMB2S57_MAJOR	  38	/* 38 = /dev/eepromb2s57 (cat24c256)  */
+#define EEPROMB3S50_MAJOR	  39	/* 39 = /dev/eepromb3s50 (cat24c256)  */
+#define EEPROMB3S51_MAJOR	  40	/* 40 = /dev/eepromb3s51 (cat24c256)  */
+#define EEPROMB3S52_MAJOR	  41	/* 41 = /dev/eepromb3s52 (cat24c256)  */
+#define EEPROMB3S53_MAJOR	  42	/* 42 = /dev/eepromb3s53 (cat24c256)  */
+#define EEPROMB3S54_MAJOR	  43	/* 43 = /dev/eepromb3s54 (cat24c256)  */
+#define EEPROMB3S55_MAJOR	  44	/* 44 = /dev/eepromb3s55 (cat24c256)  */
+#define EEPROMB3S56_MAJOR	  45	/* 45 = /dev/eepromb3s56 (cat24c256)  */
+#define EEPROMB3S57_MAJOR	  46	/* 46 = /dev/eepromb3s57 (cat24c256)  */
+#define TSL2550B1S39_MAJOR	  47	/* 47 = /dev/tsl2550b1s39 (tsl2550)   */
+#define TSL2550B2S39_MAJOR	  48	/* 48 = /dev/tsl2550b2s39 (tsl2550)   */
+#define TSL2550B3S39_MAJOR	  49	/* 49 = /dev/tsl2550b3s39 (tsl2550)   */
+#define SHT21B1S40_MAJOR	  50	/* 50 = /dev/sht21b1s40 (sht21)       */
+#define SHT21B2S40_MAJOR	  51	/* 51 = /dev/sht21b2s40 (sht21)       */
+#define SHT21B3S40_MAJOR	  52	/* 52 = /dev/sht21b3s40 (sht21)       */
+#define BMP085B1S77_MAJOR	  53	/* 53 = /dev/bmp085b1s77 (bmp085)     */
+#define BMP085B2S77_MAJOR	  54	/* 54 = /dev/bmp085b2s77 (bmp085)     */
+#define BMP085B3S77_MAJOR	  55	/* 55 = /dev/bmp085b3s77 (bmp085)     */
+					/* 56-63 = /dev/vnd[0-7] (vnd)	      */
+#define INPUT_MAJOR		  64	/* 64 = /dev/input (input)            */
+#define USB_BASE_MAJOR		  65	/* 65-133 = USB major range	      */
+#define PCI_MAJOR		 134	/* 134 = /dev/pci (pci)            */
+
+#define NR_DEVICES   		 135	/* number of (major) devices */
+
+/* Minor device numbers for memory driver. */
+#  define RAM_DEV_OLD  		   0	/* minor device for /dev/ram */
+#  define MEM_DEV     		   1	/* minor device for /dev/mem */
+#  define KMEM_DEV    		   2	/* minor device for /dev/kmem */
+#  define NULL_DEV    		   3	/* minor device for /dev/null */
+#  define BOOT_DEV    		   4	/* minor device for /dev/boot */
+#  define ZERO_DEV    		   5	/* minor device for /dev/zero */
+#  define IMGRD_DEV   		   6	/* minor device for /dev/imgrd */
+#  define RAM_DEV_FIRST		   7	/* first minor device for /dev/ram* */
+
+/* Minor device numbers for the TTY driver. */
+#  define CONS_MINOR		   0	/* console device */
+
+/* Minor device numbers for the PTY driver. */
+#  define UNIX98_MINOR		  256	/* Base number of UNIX98 PTYs, which
+					 * are allocated in (master,slave)
+					 * pairs: 256=master#0, 257=slave#0,
+					 * 258=master#1, 259=slave#1, etc.
+					 * This logic is shared between the
+					 * PTY service and libc devname(3).
+					 */
+
+#define CTRLR(n) ((n)==0 ? 3 : (8 + 2*((n)-1)))	/* magic formula */
+
+/* Minor device numbers for log driver. */
+#  define IS_KLOG_DEV		   0	/* minor device for /dev/klog */
+
+/* Full device numbers that are special to the boot monitor and FS. */
+#  define DEV_RAM     ((dev_t) 0x0100)	/* device number of /dev/ram */
+#  define DEV_IMGRD   ((dev_t) 0x0106)	/* device number of /dev/imgrd */
+
+#endif /* _DMAP_H */

Property changes on: lab4/.minix-src/include/minix/dmap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/com.h
===================================================================
--- lab4/.minix-src/include/minix/com.h	(nonexistent)
+++ lab4/.minix-src/include/minix/com.h	(revision 13)
@@ -0,0 +1,1154 @@
+/* This file defines constants for use in message communication (mostly)
+ * between system processes.
+ *
+ * A number of protocol message request and response types are defined. For
+ * debugging purposes, each protocol is assigned its own unique number range.
+ * The following such message type ranges have been allocated:
+ *
+ *     0x00 -   0xFF	Process Manager (PM) requests (see callnr.h)
+ *    0x100 -  0x1FF	Virtual File System (VFS) requests (see callnr.h)
+ *    0x200 -  0x2FF	Data link layer requests and responses
+ *    0x300 -  0x3FF	Bus controller requests and responses
+ *    0x400 -  0x4FF	Character device requests and responses
+ *    0x500 -  0x5FF	Block device requests and responses
+ *    0x600 -  0x6FF	Kernel calls
+ *    0x700 -  0x7FF	Reincarnation Server (RS) requests
+ *    0x800 -  0x8FF	Data Store (DS) requests
+ *    0x900 -  0x9FF	Requests from PM to VFS, and responses
+ *    0xA00 -  0xAFF	Requests from VFS to file systems (see vfsif.h)
+ *    0xB00 -  0xBFF	Transaction IDs from VFS to file systems (see vfsif.h)
+ *    0xC00 -  0xCFF	Virtual Memory (VM) requests
+ *    0xD00 -  0xDFF	IPC server requests
+ *    0xE00 -  0xEFF	Common system messages (e.g. system signals)
+ *    0xF00 -  0xFFF	Scheduling messages
+ *   0x1000 - 0x10FF	Notify messages
+ *   0x1100 - 0x11FF	USB  
+ *   0x1200 - 0x12FF	Devman
+ *   0x1300 - 0x13FF	TTY requests
+ *   0x1400 - 0x14FF	Real Time Clock requests and responses
+ *   0x1500 - 0x15FF	Input server messages
+ *   0x1600 - 0x16FF	VirtualBox (VBOX) requests (see vboxif.h)
+ *   0x1700 - 0x17FF	PTYFS requests
+ *   0x1800 - 0x18FF	Management Information Base (MIB) requests
+ *   0x1900 - 0x19FF	Socket device requests and responses
+ *   0x1A00 - 0x1AFF	Network device requests and responses
+ *
+ * Zero and negative values are widely used for OK and error responses.
+ */
+
+#ifndef _MINIX_COM_H
+#define _MINIX_COM_H 
+
+/*===========================================================================*
+ *            	Process numbers of processes in the system image	     *
+ *===========================================================================*/
+
+/* Kernel tasks. These all run in the same address space. */
+#define ASYNCM	((endpoint_t) -5) /* notifies about finished async sends */
+#define IDLE    ((endpoint_t) -4) /* runs when no one else can run */
+#define CLOCK  	((endpoint_t) -3) /* alarms and other clock functions */
+#define SYSTEM  ((endpoint_t) -2) /* request system functionality */
+#define KERNEL  ((endpoint_t) -1) /* pseudo-process for IPC and scheduling */
+#define HARDWARE     KERNEL	/* for hardware interrupt handlers */
+
+/* Number of tasks. Note that NR_PROCS is defined in <minix/config.h>. */
+#define MAX_NR_TASKS	1023
+#define NR_TASKS	  5 
+
+/* User-space processes, that is, device drivers, servers, and INIT. */
+#define PM_PROC_NR   ((endpoint_t) 0)	/* process manager */
+#define VFS_PROC_NR  ((endpoint_t) 1)	/* file system */
+#define RS_PROC_NR   ((endpoint_t) 2)  	/* reincarnation server */
+#define MEM_PROC_NR  ((endpoint_t) 3)  	/* memory driver (RAM disk, null, etc.) */
+#define SCHED_PROC_NR ((endpoint_t) 4)	/* scheduler */
+#define TTY_PROC_NR  ((endpoint_t) 5)	/* terminal (TTY) driver */
+#define DS_PROC_NR   ((endpoint_t) 6)   /* data store server */
+#define MIB_PROC_NR  ((endpoint_t) 7)	/* management info base service */
+#define VM_PROC_NR   ((endpoint_t) 8)   /* memory server */
+#define PFS_PROC_NR  ((endpoint_t) 9)  /* pipe filesystem */
+#define MFS_PROC_NR  ((endpoint_t) 10)  /* minix root filesystem */
+#define LAST_SPECIAL_PROC_NR	11	/* An untyped version for
+                                           computation in macros.*/
+#define INIT_PROC_NR ((endpoint_t) LAST_SPECIAL_PROC_NR)  /* init
+                                                        -- goes multiuser */
+#define NR_BOOT_MODULES (INIT_PROC_NR+1)
+
+/* Root system process and root user process. */
+#define ROOT_SYS_PROC_NR  RS_PROC_NR
+#define ROOT_USR_PROC_NR  INIT_PROC_NR
+
+/*===========================================================================*
+ *                	   Kernel notification types                         *
+ *===========================================================================*/
+
+/* Kernel notification types. In principle, these can be sent to any process,
+ * so make sure that these types do not interfere with other message types.
+ * Notifications are prioritized because of the way they are unhold() and
+ * blocking notifications are delivered. The lowest numbers go first. The
+ * offset are used for the per-process notification bit maps. 
+ */
+#define NOTIFY_MESSAGE		  0x1000
+/* FIXME the old is_notify(a) should be replaced by is_ipc_notify(status). */
+#define is_ipc_notify(ipc_status) (IPC_STATUS_CALL(ipc_status) == NOTIFY)
+#define is_notify(a)		  ((unsigned) ((a) - NOTIFY_MESSAGE) < 0x100)
+#define is_ipc_asynch(ipc_status) \
+    (is_ipc_notify(ipc_status) || IPC_STATUS_CALL(ipc_status) == SENDA)
+
+/*===========================================================================*
+ *                Messages for BUS controller drivers 			     *
+ *===========================================================================*/
+#define BUSC_RQ_BASE	0x300	/* base for request types */
+#define BUSC_RS_BASE	0x380	/* base for response types */
+
+#define BUSC_PCI_INIT		(BUSC_RQ_BASE + 0)	/* First message to
+							 * PCI driver
+							 */
+#define BUSC_PCI_FIRST_DEV	(BUSC_RQ_BASE + 1)	/* Get index (and
+							 * vid/did) of the
+							 * first PCI device
+							 */
+#define BUSC_PCI_NEXT_DEV	(BUSC_RQ_BASE + 2)	/* Get index (and
+							 * vid/did) of the
+							 * next PCI device
+							 */
+#define BUSC_PCI_FIND_DEV	(BUSC_RQ_BASE + 3)	/* Get index of a
+							 * PCI device based on
+							 * bus/dev/function
+							 */
+#define BUSC_PCI_IDS		(BUSC_RQ_BASE + 4)	/* Get vid/did from an
+							 * index
+							 */
+#define BUSC_PCI_RESERVE	(BUSC_RQ_BASE + 7)	/* Reserve a PCI dev */
+#define BUSC_PCI_ATTR_R8	(BUSC_RQ_BASE + 8)	/* Read 8-bit
+							 * attribute value
+							 */
+#define BUSC_PCI_ATTR_R16	(BUSC_RQ_BASE + 9)	/* Read 16-bit
+							 * attribute value
+							 */
+#define BUSC_PCI_ATTR_R32	(BUSC_RQ_BASE + 10)	/* Read 32-bit
+							 * attribute value
+							 */
+#define BUSC_PCI_ATTR_W8	(BUSC_RQ_BASE + 11)	/* Write 8-bit
+							 * attribute value
+							 */
+#define BUSC_PCI_ATTR_W16	(BUSC_RQ_BASE + 12)	/* Write 16-bit
+							 * attribute value
+							 */
+#define BUSC_PCI_ATTR_W32	(BUSC_RQ_BASE + 13)	/* Write 32-bit
+							 * attribute value
+							 */
+#define BUSC_PCI_RESCAN		(BUSC_RQ_BASE + 14)	/* Rescan bus */
+#define BUSC_PCI_DEV_NAME_S	(BUSC_RQ_BASE + 15)	/* Get the name of a
+							 * PCI device
+							 * (safecopy)
+							 */
+#define BUSC_PCI_SLOT_NAME_S	(BUSC_RQ_BASE + 16)	/* Get the name of a
+							 * PCI slot (safecopy)
+							 */
+#define BUSC_PCI_SET_ACL	(BUSC_RQ_BASE + 17)	/* Set the ACL for a
+							 * driver (safecopy)
+							 */
+#define BUSC_PCI_DEL_ACL	(BUSC_RQ_BASE + 18)	/* Delete the ACL of a
+							 * driver 
+							 */
+#define BUSC_PCI_GET_BAR	(BUSC_RQ_BASE + 19)	/* Get Base Address
+							 * Register properties
+							 */
+#define IOMMU_MAP		(BUSC_RQ_BASE + 32)	/* Ask IOMMU to map
+							 * a segment of memory
+							 */
+
+#define BUSC_I2C_RESERVE	(BUSC_RQ_BASE + 64)	/* reserve i2c device */
+#define BUSC_I2C_EXEC		(BUSC_RQ_BASE + 65)	/* perform i2c action */
+
+/*===========================================================================*
+ *                  	   Messages for networking layer		     *
+ *===========================================================================*/
+
+/* Base type for data link layer requests and responses. */
+#define DL_RQ_BASE	0x200		
+#define DL_RS_BASE	0x280		
+
+#define IS_DL_RQ(type) (((type) & ~0x7f) == DL_RQ_BASE)
+#define IS_DL_RS(type) (((type) & ~0x7f) == DL_RS_BASE)
+
+/* Message types for data link layer requests. */
+#define DL_CONF		(DL_RQ_BASE + 0)
+#define DL_GETSTAT_S	(DL_RQ_BASE + 1)
+#define DL_WRITEV_S	(DL_RQ_BASE + 2)
+#define DL_READV_S	(DL_RQ_BASE + 3)
+
+/* Message type for data link layer replies. */
+#define DL_CONF_REPLY	(DL_RS_BASE + 0)
+#define DL_STAT_REPLY	(DL_RS_BASE + 1)
+#define DL_TASK_REPLY	(DL_RS_BASE + 2)
+
+/* Bits in 'flags' field of DL replies. */
+#  define DL_NOFLAGS		0x00
+#  define DL_PACK_SEND		0x01
+#  define DL_PACK_RECV		0x02
+
+/* Bits in 'DL_MODE' field of DL requests. */
+#  define DL_NOMODE		0x0
+#  define DL_PROMISC_REQ	0x1
+#  define DL_MULTI_REQ		0x2
+#  define DL_BROAD_REQ		0x4
+
+/*===========================================================================*
+ *                  SYSTASK request types and field names                    *
+ *===========================================================================*/
+
+/* System library calls are dispatched via a call vector, so be careful when 
+ * modifying the system call numbers. The numbers here determine which call
+ * is made from the call vector.
+ */ 
+#define KERNEL_CALL	0x600	/* base for kernel calls to SYSTEM */ 
+
+#  define SYS_FORK       (KERNEL_CALL + 0)	/* sys_fork() */
+#  define SYS_EXEC       (KERNEL_CALL + 1)	/* sys_exec() */
+#  define SYS_CLEAR	 (KERNEL_CALL + 2)	/* sys_clear() */
+#  define SYS_SCHEDULE 	 (KERNEL_CALL + 3)	/* sys_schedule() */
+#  define SYS_PRIVCTL    (KERNEL_CALL + 4)	/* sys_privctl() */
+#  define SYS_TRACE      (KERNEL_CALL + 5)	/* sys_trace() */
+#  define SYS_KILL       (KERNEL_CALL + 6)	/* sys_kill() */
+
+#  define SYS_GETKSIG    (KERNEL_CALL + 7)	/* sys_getsig() */
+#  define SYS_ENDKSIG    (KERNEL_CALL + 8)	/* sys_endsig() */
+#  define SYS_SIGSEND    (KERNEL_CALL + 9)	/* sys_sigsend() */
+#  define SYS_SIGRETURN  (KERNEL_CALL + 10)	/* sys_sigreturn() */
+
+#  define SYS_MEMSET     (KERNEL_CALL + 13)	/* sys_memset() */
+
+#  define SYS_UMAP       (KERNEL_CALL + 14)	/* sys_umap() */
+#  define SYS_VIRCOPY    (KERNEL_CALL + 15)	/* sys_vircopy() */
+#  define SYS_PHYSCOPY   (KERNEL_CALL + 16) 	/* sys_physcopy() */
+#  define SYS_UMAP_REMOTE (KERNEL_CALL + 17)	/* sys_umap_remote() */
+#  define SYS_VUMAP      (KERNEL_CALL + 18)	/* sys_vumap() */
+
+#  define SYS_IRQCTL     (KERNEL_CALL + 19)	/* sys_irqctl() */
+
+#  define SYS_DEVIO      (KERNEL_CALL + 21)	/* sys_devio() */
+#  define SYS_SDEVIO     (KERNEL_CALL + 22)	/* sys_sdevio() */
+#  define SYS_VDEVIO     (KERNEL_CALL + 23)	/* sys_vdevio() */
+
+#  define SYS_SETALARM	 (KERNEL_CALL + 24)	/* sys_setalarm() */
+#  define SYS_TIMES	 (KERNEL_CALL + 25)	/* sys_times() */
+#  define SYS_GETINFO    (KERNEL_CALL + 26) 	/* sys_getinfo() */
+#  define SYS_ABORT      (KERNEL_CALL + 27)	/* sys_abort() */
+#  define SYS_IOPENABLE  (KERNEL_CALL + 28)	/* sys_enable_iop() */
+#  define SYS_SAFECOPYFROM (KERNEL_CALL + 31)	/* sys_safecopyfrom() */
+#  define SYS_SAFECOPYTO   (KERNEL_CALL + 32)	/* sys_safecopyto() */
+#  define SYS_VSAFECOPY  (KERNEL_CALL + 33)	/* sys_vsafecopy() */
+#  define SYS_SETGRANT   (KERNEL_CALL + 34)	/* sys_setgrant() */
+#  define SYS_READBIOS   (KERNEL_CALL + 35)	/* sys_readbios() */
+
+#  define SYS_SPROF      (KERNEL_CALL + 36)     /* sys_sprof() */ 
+
+#  define SYS_STIME      (KERNEL_CALL + 39)	/* sys_stime() */
+#  define SYS_SETTIME    (KERNEL_CALL + 40)	/* sys_settime() */
+
+#  define SYS_VMCTL      (KERNEL_CALL + 43)	/* sys_vmctl() */
+
+#  define SYS_DIAGCTL    (KERNEL_CALL + 44)	/* sys_diagctl() */
+
+#  define SYS_VTIMER     (KERNEL_CALL + 45)	/* sys_vtimer() */
+#  define SYS_RUNCTL     (KERNEL_CALL + 46)	/* sys_runctl() */
+#  define SYS_GETMCONTEXT (KERNEL_CALL + 50)    /* sys_getmcontext() */
+#  define SYS_SETMCONTEXT (KERNEL_CALL + 51)    /* sys_setmcontext() */
+
+#  define SYS_UPDATE	 (KERNEL_CALL + 52)	/* sys_update() */
+#  define SYS_EXIT	 (KERNEL_CALL + 53)	/* sys_exit() */
+
+#  define SYS_SCHEDCTL (KERNEL_CALL + 54)	/* sys_schedctl() */
+#  define SYS_STATECTL (KERNEL_CALL + 55)	/* sys_statectl() */
+
+#  define SYS_SAFEMEMSET (KERNEL_CALL + 56)	/* sys_safememset() */
+
+#  define SYS_PADCONF (KERNEL_CALL + 57)	/* sys_padconf() */
+
+/* Total */
+#define NR_SYS_CALLS	58	/* number of kernel calls */
+
+#define SYS_CALL_MASK_SIZE BITMAP_CHUNKS(NR_SYS_CALLS)
+
+/* Basic kernel calls allowed to every system process. */
+#define SYS_BASIC_CALLS \
+    SYS_EXIT, SYS_SAFECOPYFROM, SYS_SAFECOPYTO, SYS_VSAFECOPY, SYS_GETINFO, \
+    SYS_TIMES, SYS_SETALARM, SYS_SETGRANT, \
+    SYS_DIAGCTL, SYS_STATECTL, SYS_SAFEMEMSET
+
+/* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
+#   define _DIO_INPUT		0x001
+#   define _DIO_OUTPUT		0x002
+#   define _DIO_DIRMASK		0x00f
+#   define _DIO_BYTE		0x010
+#   define _DIO_WORD		0x020
+#   define _DIO_LONG		0x030
+#   define _DIO_TYPEMASK	0x0f0
+#   define _DIO_SAFE		0x100
+#   define _DIO_SAFEMASK	0xf00
+#   define DIO_INPUT_BYTE	    (_DIO_INPUT|_DIO_BYTE)
+#   define DIO_INPUT_WORD	    (_DIO_INPUT|_DIO_WORD)
+#   define DIO_INPUT_LONG	    (_DIO_INPUT|_DIO_LONG)
+#   define DIO_OUTPUT_BYTE	    (_DIO_OUTPUT|_DIO_BYTE)
+#   define DIO_OUTPUT_WORD	    (_DIO_OUTPUT|_DIO_WORD)
+#   define DIO_OUTPUT_LONG	    (_DIO_OUTPUT|_DIO_LONG)
+#   define DIO_SAFE_INPUT_BYTE      (_DIO_INPUT|_DIO_BYTE|_DIO_SAFE)
+#   define DIO_SAFE_INPUT_WORD      (_DIO_INPUT|_DIO_WORD|_DIO_SAFE)
+#   define DIO_SAFE_INPUT_LONG      (_DIO_INPUT|_DIO_LONG|_DIO_SAFE)
+#   define DIO_SAFE_OUTPUT_BYTE     (_DIO_OUTPUT|_DIO_BYTE|_DIO_SAFE)
+#   define DIO_SAFE_OUTPUT_WORD     (_DIO_OUTPUT|_DIO_WORD|_DIO_SAFE)
+#   define DIO_SAFE_OUTPUT_LONG     (_DIO_OUTPUT|_DIO_LONG|_DIO_SAFE)
+
+/* Field names for SYS_IRQCTL. */
+#  define IRQ_SETPOLICY     1	/* manage a slot of the IRQ table */
+#  define IRQ_RMPOLICY      2	/* remove a slot of the IRQ table */
+#  define IRQ_ENABLE        3	/* enable interrupts */
+#  define IRQ_DISABLE       4	/* disable interrupts */
+#  define IRQ_REENABLE  0x001	/* reenable IRQ line after interrupt */
+#  define IRQ_EXCLUSIVE 0x002	/* exclusive IRQ: disables active handlers */
+#  define IRQ_BYTE      0x100	/* byte values */      
+#  define IRQ_WORD      0x200	/* word values */
+#  define IRQ_LONG      0x400	/* long values */
+
+#define CP_FLAG_TRY	0x01	/* do not transparently map */
+
+/* Field names for SYS_GETINFO. */
+#   define GET_KINFO	   0	/* get kernel information structure */
+#   define GET_IMAGE	   1	/* get system image table */
+#   define GET_PROCTAB	   2	/* get kernel process table */
+#   define GET_RANDOMNESS  3	/* get randomness buffer */
+#   define GET_MONPARAMS   4	/* get monitor parameters */
+#   define GET_KENV	   5	/* get kernel environment string */
+#   define GET_IRQHOOKS	   6	/* get the IRQ table */
+#   define GET_PRIVTAB	   8	/* get kernel privileges table */
+#   define GET_KADDRESSES  9	/* get various kernel addresses */
+#   define GET_SCHEDINFO  10	/* get scheduling queues */
+#   define GET_PROC 	  11	/* get process slot if given process */
+#   define GET_MACHINE 	  12	/* get machine information */
+#   define GET_LOCKTIMING 13	/* get lock()/unlock() latency timing */
+#   define GET_BIOSBUFFER 14	/* get a buffer for BIOS calls */
+#   define GET_LOADINFO   15	/* get load average information */
+#   define GET_IRQACTIDS  16	/* get the IRQ masks */
+#   define GET_PRIV	  17	/* get privilege structure */
+#   define GET_HZ	  18	/* get HZ value */
+#   define GET_WHOAMI	  19	/* get own name, endpoint, and privileges */
+#   define GET_RANDOMNESS_BIN 20 /* get one randomness bin */
+#   define GET_IDLETSC	  21	/* get cumulative idle time stamp counter */
+#   define GET_CPUINFO    23    /* get information about cpus */
+#   define GET_REGS	  24	/* get general process registers */
+#   define GET_CPUTICKS	  25	/* get per-state ticks for a cpu */
+
+/* Subfunctions for SYS_PRIVCTL */
+#define SYS_PRIV_ALLOW		1	/* Allow process to run */
+#define SYS_PRIV_DISALLOW	2	/* Disallow process to run */
+#define SYS_PRIV_SET_SYS	3	/* Set a system privilege structure */
+#define SYS_PRIV_SET_USER	4	/* Set a user privilege structure */
+#define SYS_PRIV_ADD_IO 	5	/* Add I/O range (struct io_range) */
+#define SYS_PRIV_ADD_MEM	6	/* Add memory range (struct mem_range)
+					 */
+#define SYS_PRIV_ADD_IRQ	7	/* Add IRQ */
+#define SYS_PRIV_QUERY_MEM	8	/* Verify memory privilege. */
+#define SYS_PRIV_UPDATE_SYS	9	/* Update a sys privilege structure. */
+#define SYS_PRIV_YIELD	       10	/* Allow process to run and suspend */
+#define SYS_PRIV_CLEAR_IPC_REFS 11	/* Clear pending IPC for the process */
+
+/* Constants for exec. FIXME: these do not belong here. */
+#define PMEF_AUXVECTORS	20
+#define PMEF_EXECNAMELEN1 PATH_MAX
+
+/* Flags for PR_FORK_FLAGS. */
+#define PFF_VMINHIBIT	0x01	/* Don't schedule until release by VM. */
+
+/* SYS_SAFEMEMSET */
+#define SMS_DST		m2_i1	/* dst endpoint */
+#define SMS_GID		m2_i3	/* grant id */
+#define SMS_OFFSET	m2_l1	/* offset within grant */
+#define SMS_BYTES	m2_l2	/* bytes from offset */
+#define SMS_PATTERN	m2_i2	/* memset() pattern */
+
+/* Field names for SYS_VMCTL. */
+#define SVMCTL_WHO	m1_i1
+#define SVMCTL_PARAM	m1_i2	/* All SYS_VMCTL requests. */
+#define SVMCTL_VALUE	m1_i3
+#define	SVMCTL_MRG_TARGET	m2_i1	/* MEMREQ_GET reply: target process */
+#define	SVMCTL_MRG_ADDR		m2_i2	/* MEMREQ_GET reply: address */
+#define	SVMCTL_MRG_LENGTH	m2_i3	/* MEMREQ_GET reply: length */
+#define	SVMCTL_MRG_FLAG		m2_s1	/* MEMREQ_GET reply: flag */
+#define	SVMCTL_MRG_EP2		m2_l1	/* MEMREQ_GET reply: source process */
+#define	SVMCTL_MRG_ADDR2	m2_l2	/* MEMREQ_GET reply: source address */
+#define SVMCTL_MRG_REQUESTOR	m2_p1	/* MEMREQ_GET reply: requestor */
+#define SVMCTL_MAP_VIR_ADDR	m1_p1
+#define SVMCTL_PTROOT		m1_i3
+#define SVMCTL_PTROOT_V		m1_p1
+
+/* Reply message for VMCTL_KERN_PHYSMAP */
+#define SVMCTL_MAP_FLAGS	m2_i1	/* VMMF_* */
+#define SVMCTL_MAP_PHYS_ADDR	m2_l1
+#define SVMCTL_MAP_PHYS_LEN	m2_l2
+
+#define VMMF_UNCACHED		(1L << 0)
+#define VMMF_USER		(1L << 1)
+#define VMMF_WRITE		(1L << 2)
+#define VMMF_GLO		(1L << 3)
+
+/* Values for SVMCTL_PARAM. */
+#define VMCTL_CLEAR_PAGEFAULT	12
+#define VMCTL_GET_PDBR		13
+#define VMCTL_MEMREQ_GET 	14
+#define VMCTL_MEMREQ_REPLY	15
+#define VMCTL_NOPAGEZERO	18
+#define VMCTL_I386_KERNELLIMIT	19
+#define VMCTL_I386_INVLPG	25
+#define VMCTL_FLUSHTLB		26
+#define VMCTL_KERN_PHYSMAP	27
+#define VMCTL_KERN_MAP_REPLY	28
+#define VMCTL_SETADDRSPACE	29
+#define VMCTL_VMINHIBIT_SET	30
+#define VMCTL_VMINHIBIT_CLEAR	31
+#define VMCTL_CLEARMAPCACHE	32
+#define VMCTL_BOOTINHIBIT_CLEAR	33
+
+/* Codes and field names for SYS_DIAGCTL. */
+#define DIAGCTL_CODE_DIAG	1	/* Print diagnostics. */
+#define DIAGCTL_CODE_STACKTRACE	2	/* Print process stack. */
+#define DIAGCTL_CODE_REGISTER	3	/* Register for diagnostic signals */
+#define DIAGCTL_CODE_UNREGISTER	4	/* Unregister for diagnostic signals */
+#define DIAG_BUFSIZE	(80*25)
+
+/* Field names for SYS_VTIMER. */
+#define VT_WHICH	m2_i1	/* which timer to set/retrieve */
+#  define VT_VIRTUAL        1	/* the ITIMER_VIRTUAL timer */
+#  define VT_PROF           2	/* the ITIMER_PROF timer */
+#define VT_SET		m2_i2	/* 1 for setting a timer, 0 retrieval only */
+#define VT_VALUE	m2_l1	/* new/previous value of the timer */
+#define VT_ENDPT	m2_l2	/* process to set/retrieve the timer for */
+
+/* Field names for SYS_RUNCTL. */
+#define RC_ENDPT	m1_i1	/* which process to stop or resume */
+#define RC_ACTION	m1_i2	/* set or clear stop flag */
+#  define RC_STOP           0	/* stop the process */
+#  define RC_RESUME         1	/* clear the stop flag */
+#define RC_FLAGS	m1_i3	/* request flags */
+#  define RC_DELAY          1	/* delay stop if process is sending */
+
+/* Field names for SYS_UPDATE. */
+#define SYS_UPD_SRC_ENDPT	m1_i1	/* source endpoint */
+#define SYS_UPD_DST_ENDPT	m1_i2	/* destination endpoint */
+#define SYS_UPD_FLAGS		m1_i3	/* update flags */
+#  define SYS_UPD_ROLLBACK        0x1	/* update is rollback */
+
+
+/* Subfunctions for SYS_STATECTL */
+#define SYS_STATE_CLEAR_IPC_REFS    1	/* clear IPC references */
+#define SYS_STATE_SET_STATE_TABLE   2	/* set state map */
+#define SYS_STATE_ADD_IPC_BL_FILTER 3	/* set IPC blacklist filter */
+#define SYS_STATE_ADD_IPC_WL_FILTER 4	/* set IPC whitelist filter */
+#define SYS_STATE_CLEAR_IPC_FILTERS 5	/* clear IPC filters */
+
+/* Subfunctions for SYS_SCHEDCTL */
+#  define SCHEDCTL_FLAG_KERNEL	1	/* mark kernel scheduler and remove 
+					 * RTS_NO_QUANTUM; otherwise caller is 
+					 * marked scheduler 
+					 */
+
+/* Field names for SYS_PADCONF */
+#define PADCONF_PADCONF		m2_i1	/* pad to configure */
+#define PADCONF_MASK		m2_i2	/* mask to apply */
+#define PADCONF_VALUE		m2_i3	/* value to write */
+
+/*===========================================================================*
+ *                Messages for the Reincarnation Server 		     *
+ *===========================================================================*/
+
+#define RS_RQ_BASE		0x700
+
+#define RS_UP		(RS_RQ_BASE + 0)	/* start system service */
+#define RS_DOWN		(RS_RQ_BASE + 1)	/* stop system service */
+#define RS_REFRESH	(RS_RQ_BASE + 2)	/* refresh system service */
+#define RS_RESTART	(RS_RQ_BASE + 3)	/* restart system service */
+#define RS_SHUTDOWN	(RS_RQ_BASE + 4)	/* alert about shutdown */
+#define RS_UPDATE	(RS_RQ_BASE + 5)	/* update system service */
+#define RS_CLONE	(RS_RQ_BASE + 6)	/* clone system service */
+#define RS_UNCLONE	(RS_RQ_BASE + 7)	/* unclone system service */
+
+#define RS_LOOKUP	(RS_RQ_BASE + 8)	/* lookup server name */
+
+#define RS_GETSYSINFO	(RS_RQ_BASE + 9)	/* get system information */
+
+#define RS_INIT 	(RS_RQ_BASE + 20)	/* service init message */
+#define RS_LU_PREPARE	(RS_RQ_BASE + 21)	/* prepare to update message */
+#define RS_EDIT		(RS_RQ_BASE + 22)	/* edit system service */
+#define RS_SYSCTL	(RS_RQ_BASE + 23)	/* perform system ctl action */
+#define RS_FI		(RS_RQ_BASE + 24)	/* inject fault into service */
+
+/* Subfunctions for RS_SYSCTL. */
+#define RS_SYSCTL_SRV_STATUS    1
+#define RS_SYSCTL_UPD_START     2
+#define RS_SYSCTL_UPD_RUN       3
+#define RS_SYSCTL_UPD_STOP      4
+#define RS_SYSCTL_UPD_STATUS    5
+
+/* Subfunctions for RS_FI. */
+#define RS_FI_CRASH             1
+
+/*===========================================================================*
+ *                Messages for the Data Store Server			     *
+ *===========================================================================*/
+
+#define DS_RQ_BASE		0x800
+
+#define DS_PUBLISH	(DS_RQ_BASE + 0)	/* publish data */
+#define DS_RETRIEVE	(DS_RQ_BASE + 1)	/* retrieve data by name */
+#define DS_SUBSCRIBE	(DS_RQ_BASE + 2)	/* subscribe to data updates */
+#define DS_CHECK	(DS_RQ_BASE + 3)	/* retrieve updated data */
+#define DS_DELETE	(DS_RQ_BASE + 4)	/* delete data */
+#define DS_SNAPSHOT	(DS_RQ_BASE + 5)	/* take a snapshot */
+#define DS_RETRIEVE_LABEL  (DS_RQ_BASE + 6)	/* retrieve label's name */
+#define DS_GETSYSINFO	(DS_RQ_BASE + 7)	/* get system information */
+
+/*===========================================================================*
+ *                Messages used between PM and VFS			     *
+ *===========================================================================*/
+
+#define VFS_PM_RQ_BASE	0x900
+#define VFS_PM_RS_BASE	0x980
+
+#define IS_VFS_PM_RQ(type) (((type) & ~0x7f) == VFS_PM_RQ_BASE)
+#define IS_VFS_PM_RS(type) (((type) & ~0x7f) == VFS_PM_RS_BASE)
+
+/* Requests from PM to VFS. */
+#define VFS_PM_INIT	(VFS_PM_RQ_BASE + 0)	/* Process table exchange */
+#define VFS_PM_SETUID	(VFS_PM_RQ_BASE + 1)	/* Set new user ID */
+#define VFS_PM_SETGID	(VFS_PM_RQ_BASE + 2)	/* Set group ID */
+#define VFS_PM_SETSID	(VFS_PM_RQ_BASE + 3)	/* Set session leader */
+#define VFS_PM_EXIT	(VFS_PM_RQ_BASE + 4)	/* Process exits */
+#define VFS_PM_DUMPCORE	(VFS_PM_RQ_BASE + 5)	/* Process is to dump core */
+#define VFS_PM_EXEC	(VFS_PM_RQ_BASE + 6)	/* Forwarded exec call */
+#define VFS_PM_FORK	(VFS_PM_RQ_BASE + 7)	/* Newly forked process */
+#define VFS_PM_SRV_FORK	(VFS_PM_RQ_BASE + 8)	/* fork for system services */
+#define VFS_PM_UNPAUSE	(VFS_PM_RQ_BASE + 9)	/* Interrupt process call */
+#define VFS_PM_REBOOT	(VFS_PM_RQ_BASE + 10)	/* System reboot */
+#define VFS_PM_SETGROUPS	(VFS_PM_RQ_BASE + 11)	/* Set groups */
+
+/* Replies from VFS to PM */
+#define VFS_PM_SETUID_REPLY	(VFS_PM_RS_BASE + 1)
+#define VFS_PM_SETGID_REPLY	(VFS_PM_RS_BASE + 2)
+#define VFS_PM_SETSID_REPLY	(VFS_PM_RS_BASE + 3)
+#define VFS_PM_EXIT_REPLY	(VFS_PM_RS_BASE + 4)
+#define VFS_PM_CORE_REPLY	(VFS_PM_RS_BASE + 5)
+#define VFS_PM_EXEC_REPLY	(VFS_PM_RS_BASE + 6)
+#define VFS_PM_FORK_REPLY	(VFS_PM_RS_BASE + 7)
+#define VFS_PM_SRV_FORK_REPLY	(VFS_PM_RS_BASE + 8)
+#define VFS_PM_UNPAUSE_REPLY	(VFS_PM_RS_BASE + 9)
+#define VFS_PM_REBOOT_REPLY	(VFS_PM_RS_BASE + 10)
+#define VFS_PM_SETGROUPS_REPLY	(VFS_PM_RS_BASE + 11)
+
+/* Standard parameters for all requests and replies, except PM_REBOOT */
+#  define VFS_PM_ENDPT		m7_i1	/* process endpoint */
+
+/* Additional parameters for PM_INIT */
+#  define VFS_PM_SLOT		m7_i2	/* process slot number */
+#  define VFS_PM_PID		m7_i3	/* process pid */
+
+/* Additional parameters for PM_SETUID and PM_SETGID */
+#  define VFS_PM_EID		m7_i2	/* effective user/group id */
+#  define VFS_PM_RID		m7_i3	/* real user/group id */
+
+/* Additional parameter for PM_SETGROUPS */
+#  define VFS_PM_GROUP_NO	m7_i2	/* number of groups */
+#  define VFS_PM_GROUP_ADDR	m7_p1	/* struct holding group data */
+
+/* Additional parameters for PM_EXEC */
+#  define VFS_PM_PATH		m7_p1	/* executable */
+#  define VFS_PM_PATH_LEN	m7_i2	/* length of path including
+					 * terminating null character
+					 */
+#  define VFS_PM_FRAME		m7_p2	/* arguments and environment */
+#  define VFS_PM_FRAME_LEN	m7_i3	/* size of frame */
+#  define VFS_PM_PS_STR		m7_i5	/* ps_strings pointer */
+
+/* Additional parameters for PM_EXEC_REPLY and PM_CORE_REPLY */
+#  define VFS_PM_STATUS		m7_i2	/* OK or failure */
+#  define VFS_PM_PC		m7_p1	/* program counter */
+#  define VFS_PM_NEWSP		m7_p2	/* possibly-changed stack ptr */
+#  define VFS_PM_NEWPS_STR	m7_i5	/* possibly-changed ps_strings ptr */
+
+/* Additional parameters for PM_FORK and PM_SRV_FORK */
+#  define VFS_PM_PENDPT		m7_i2	/* parent process endpoint */
+#  define VFS_PM_CPID		m7_i3	/* child pid */
+#  define VFS_PM_REUID		m7_i4	/* real and effective uid */
+#  define VFS_PM_REGID		m7_i5	/* real and effective gid */
+
+/* Additional parameters for PM_DUMPCORE */
+#  define VFS_PM_TERM_SIG	m7_i2	/* process's termination signal */
+
+/*===========================================================================*
+ *                Messages used from VFS to file servers		     *
+ *===========================================================================*/
+
+#define FS_BASE		0xA00		/* Requests sent by VFS to filesystem
+					 * implementations. See <minix/vfsif.h>
+					 */
+
+/*===========================================================================*
+ *                Common requests and miscellaneous field names		     *
+ *===========================================================================*/
+
+#define COMMON_RQ_BASE		0xE00
+#define COMMON_RS_BASE		0xE80
+
+/* Field names for system signals (sent by a signal manager). */
+#define SIGS_SIGNAL_RECEIVED (COMMON_RQ_BASE+0)
+
+/* Common request to all processes: gcov data. */
+#define COMMON_REQ_GCOV_DATA (COMMON_RQ_BASE+1)
+
+/* Common fault injection ctl request to all processes. */
+#define COMMON_REQ_FI_CTL (COMMON_RQ_BASE+2)
+
+/* Process event message from PM. */
+#define PROC_EVENT		(COMMON_RQ_BASE+3)
+
+/* MIB information request for the root node of a registered subtree. */
+#define COMMON_MIB_INFO		(COMMON_RQ_BASE+4)
+
+/* MIB sysctl request on a registered subtree. */
+#define COMMON_MIB_CALL		(COMMON_RQ_BASE+5)
+
+/* Reply to process event message to PM. */
+#define PROC_EVENT_REPLY	(COMMON_RS_BASE+0)
+
+/* Reply to MIB information or sysctl request. */
+#define COMMON_MIB_REPLY	(COMMON_RS_BASE+1)
+
+/*===========================================================================*
+ *                Messages for VM server				     *
+ *===========================================================================*/
+#define VM_RQ_BASE		0xC00
+
+/* Calls from PM */
+#define VM_EXIT			(VM_RQ_BASE+0)
+#	define VME_ENDPOINT		m1_i1
+#define VM_FORK			(VM_RQ_BASE+1)
+#	define VMF_ENDPOINT		m1_i1
+#	define VMF_SLOTNO		m1_i2
+#	define VMF_CHILD_ENDPOINT	m1_i3	/* result */
+#define VM_BRK			(VM_RQ_BASE+2)
+#define VM_EXEC_NEWMEM		(VM_RQ_BASE+3)
+#	define VMEN_ENDPOINT		m1_i1
+#	define VMEN_ARGSPTR		m1_p1
+#	define VMEN_ARGSSIZE		m1_i2
+#	define VMEN_FLAGS		m1_i3	/* result */
+#	define VMEN_STACK_TOP		m1_p2	/* result */
+#define VM_WILLEXIT		(VM_RQ_BASE+5)
+#	define VMWE_ENDPOINT		m1_i1
+
+/* General calls. */
+#define VM_MMAP			(VM_RQ_BASE+10)
+
+#define VM_MUNMAP		(VM_RQ_BASE+17)
+#	define VMUM_ADDR		m_mmap.addr
+#	define VMUM_LEN			m_mmap.len
+
+/* to VM: inform VM about a region of memory that is used for
+ * bus-master DMA
+ */
+#define VM_ADDDMA	(VM_RQ_BASE+12)
+#	define VMAD_EP			m2_i1
+#	define VMAD_START		m2_l1
+#	define VMAD_SIZE		m2_l2
+
+/* to VM: inform VM that a region of memory that is no longer
+ * used for bus-master DMA
+ */
+#define VM_DELDMA       (VM_RQ_BASE+13)
+#	define VMDD_EP			m2_i1
+#	define VMDD_START		m2_l1
+#	define VMDD_SIZE		m2_l2
+
+/* to VM: ask VM for a region of memory that should not
+ * be used for bus-master DMA any longer
+ */
+#define VM_GETDMA       (VM_RQ_BASE+14)
+#	define VMGD_PROCP		m2_i1
+#	define VMGD_BASEP		m2_l1
+#	define VMGD_SIZEP		m2_l2
+
+#define VM_MAP_PHYS		(VM_RQ_BASE+15)
+
+#define VM_UNMAP_PHYS		(VM_RQ_BASE+16)
+
+/* To VM: map in cache block by FS */
+#define VM_MAPCACHEPAGE		(VM_RQ_BASE+26)
+
+/* To VM: identify cache block in FS */
+#define VM_SETCACHEPAGE		(VM_RQ_BASE+27)
+
+/* To VM: forget cache block in FS */
+#define VM_FORGETCACHEPAGE	(VM_RQ_BASE+28)
+
+/* To VM: clear all cache blocks for a device */
+#define VM_CLEARCACHE		(VM_RQ_BASE+29)
+
+/* To VFS: fields for request from VM. */
+#	define VFS_VMCALL_REQ		m10_i1
+#	define VFS_VMCALL_FD		m10_i2
+#	define VFS_VMCALL_REQID		m10_i3
+#	define VFS_VMCALL_ENDPOINT	m10_i4
+#	define VFS_VMCALL_OFFSET	m10_ull1
+#	define VFS_VMCALL_LENGTH	m10_l3
+
+/* Request codes to from VM to VFS */
+#define VMVFSREQ_FDLOOKUP		101
+#define VMVFSREQ_FDCLOSE		102
+#define VMVFSREQ_FDIO			103
+
+/* Calls from VFS. */
+#define VM_VFS_REPLY		(VM_RQ_BASE+30)
+#	define VMV_ENDPOINT		m10_i1
+#	define VMV_RESULT		m10_i2
+#	define VMV_REQID		m10_i3
+#	define VMV_DEV			m10_i4
+#	define VMV_INO			m10_l1
+#	define VMV_FD			m10_l2
+#	define VMV_SIZE_PAGES		m10_l3
+
+#define VM_REMAP		(VM_RQ_BASE+33)
+
+#define VM_SHM_UNMAP		(VM_RQ_BASE+34)
+
+#define VM_GETPHYS		(VM_RQ_BASE+35)
+
+#define VM_GETREF		(VM_RQ_BASE+36)
+
+#define VM_RS_SET_PRIV		(VM_RQ_BASE+37)
+#	define VM_RS_NR			m2_i1
+#	define VM_RS_BUF		m2_l1
+#	define VM_RS_SYS		m2_i2
+
+#define VM_INFO			(VM_RQ_BASE+40)
+
+/* VM_INFO 'what' values. */
+#define VMIW_STATS			1
+#define VMIW_USAGE			2
+#define VMIW_REGION			3
+
+#define VM_RS_UPDATE		(VM_RQ_BASE+41)
+
+#define VM_RS_MEMCTL		(VM_RQ_BASE+42)
+#	define VM_RS_CTL_ENDPT		m1_i1
+#	define VM_RS_CTL_REQ		m1_i2
+#		define VM_RS_MEM_PIN	    0	/* pin memory */
+#		define VM_RS_MEM_MAKE_VM    1	/* make VM instance */
+#		define VM_RS_MEM_HEAP_PREALLOC 2 /* preallocate heap regions */
+#		define VM_RS_MEM_MAP_PREALLOC  3 /* preallocate mmaped regions */
+#		define VM_RS_MEM_GET_PREALLOC_MAP  4 /* get preallocated mmaped regions */
+#	define VM_RS_CTL_ADDR		m2_p1
+#	define VM_RS_CTL_LEN		m2_i3
+
+#define VM_REMAP_RO		(VM_RQ_BASE+44)
+/* same args as VM_REMAP */
+
+#define VM_PROCCTL		(VM_RQ_BASE+45)
+#define VMPCTL_PARAM		m9_l1
+#define VMPCTL_WHO		m9_l2
+#define VMPCTL_M1		m9_l3
+#define VMPCTL_LEN		m9_l4
+#define VMPCTL_FLAGS		m9_l5
+
+#define VMPPARAM_CLEAR		1	/* values for VMPCTL_PARAM */
+#define VMPPARAM_HANDLEMEM	2
+
+#define VM_VFS_MMAP             (VM_RQ_BASE+46)
+
+#define VM_GETRUSAGE		(VM_RQ_BASE+47)
+
+#define VM_RS_PREPARE		(VM_RQ_BASE+48)
+
+/* Total. */
+#define NR_VM_CALLS				49
+#define VM_CALL_MASK_SIZE			BITMAP_CHUNKS(NR_VM_CALLS)
+
+/* not handled as a normal VM call, thus at the end of the reserved rage */
+#define VM_PAGEFAULT		(VM_RQ_BASE+0xff)
+#	define VPF_ADDR		m1_i1
+#	define VPF_FLAGS	m1_i2
+
+/* Basic vm calls allowed to every process. */
+#define VM_BASIC_CALLS \
+    VM_BRK, VM_MMAP, VM_MUNMAP, VM_MAP_PHYS, VM_UNMAP_PHYS, VM_INFO, \
+    VM_GETRUSAGE /* VM_GETRUSAGE is to be removed from this list ASAP */
+
+/*===========================================================================*
+ *                Messages for IPC server				     *
+ *===========================================================================*/
+#define IPC_BASE	0xD00
+
+/* Shared Memory */
+#define IPC_SHMGET	(IPC_BASE+1)
+#define IPC_SHMAT	(IPC_BASE+2)
+#define IPC_SHMDT	(IPC_BASE+3)
+#define IPC_SHMCTL	(IPC_BASE+4)
+
+/* Semaphore */
+#define IPC_SEMGET	(IPC_BASE+5)
+#define IPC_SEMCTL	(IPC_BASE+6)
+#define IPC_SEMOP	(IPC_BASE+7)
+
+/*===========================================================================*
+ *                Messages for Scheduling				     *
+ *===========================================================================*/
+#define SCHEDULING_BASE	0xF00
+
+#define SCHEDULING_NO_QUANTUM	(SCHEDULING_BASE+1)
+#define SCHEDULING_START	(SCHEDULING_BASE+2)
+#define SCHEDULING_STOP		(SCHEDULING_BASE+3)
+#define SCHEDULING_SET_NICE	(SCHEDULING_BASE+4)
+#define SCHEDULING_INHERIT	(SCHEDULING_BASE+5)
+
+/*===========================================================================*
+ *              Messages for USB                                             *
+ *===========================================================================*/
+
+#define USB_BASE 0x1100
+
+/* those are from driver to USBD */
+#define USB_RQ_INIT          (USB_BASE +  0) /* First message to HCD driver */
+#define USB_RQ_DEINIT        (USB_BASE +  1) /* Quit the session */
+#define USB_RQ_SEND_URB      (USB_BASE +  2) /* Send URB */
+#define USB_RQ_CANCEL_URB    (USB_BASE +  3) /* Cancel URB */
+#define USB_RQ_SEND_INFO     (USB_BASE +  4) /* Sends various information */
+#define USB_REPLY            (USB_BASE +  5)
+
+
+/* those are from USBD to driver */
+#define USB_COMPLETE_URB    (USB_BASE +  6)
+#define USB_ANNOUCE_DEV     (USB_BASE +  7) /* Announce a new USB Device */
+#define USB_WITHDRAW_DEV    (USB_BASE +  8) /* Withdraw a allready anncounced
+                                              USB device*/
+#   define USB_GRANT_ID     m4_l1
+#   define USB_GRANT_SIZE   m4_l2
+
+#   define USB_URB_ID       m4_l1
+#   define USB_RESULT       m4_l2
+#   define USB_DEV_ID       m4_l1
+#   define USB_DRIVER_EP    m4_l2
+#   define USB_INTERFACES   m4_l3
+#   define USB_RB_INIT_NAME m3_ca1
+
+#   define USB_INFO_TYPE    m4_l1
+#   define USB_INFO_VALUE   m4_l2
+
+/*===========================================================================*
+ *              Messages for DeviceManager (s/t like SysFS)                  *
+ *===========================================================================*/
+
+#define DEVMAN_BASE 0x1200
+
+#define DEVMAN_ADD_DEV     (DEVMAN_BASE + 0)
+#define DEVMAN_DEL_DEV     (DEVMAN_BASE + 1)
+#define DEVMAN_ADD_BUS     (DEVMAN_BASE + 2)
+#define DEVMAN_DEL_BUS     (DEVMAN_BASE + 3)
+#define DEVMAN_ADD_DEVFILE (DEVMAN_BASE + 4)
+#define DEVMAN_DEL_DEVFILE (DEVMAN_BASE + 5)
+
+#define DEVMAN_REQUEST     (DEVMAN_BASE + 6)
+#define DEVMAN_REPLY       (DEVMAN_BASE + 7)
+
+#define DEVMAN_BIND        (DEVMAN_BASE + 8)
+#define DEVMAN_UNBIND      (DEVMAN_BASE + 9)
+
+#   define DEVMAN_GRANT_ID       m4_l1
+#   define DEVMAN_GRANT_SIZE     m4_l2
+
+#   define DEVMAN_ENDPOINT       m4_l3
+#   define DEVMAN_DEVICE_ID      m4_l2
+#   define DEVMAN_RESULT         m4_l1
+
+/*===========================================================================*
+ *			Messages for TTY				     *
+ *===========================================================================*/
+
+#define TTY_RQ_BASE 0x1300
+
+#define TTY_FKEY_CONTROL	(TTY_RQ_BASE + 1) /* control an F-key at TTY */
+#  define    FKEY_MAP		10	/* observe function key */
+#  define    FKEY_UNMAP		11	/* stop observing function key */
+#  define    FKEY_EVENTS	12	/* request open key presses */
+
+#define TTY_INPUT_UP		(TTY_RQ_BASE + 2) /* input server is up */
+#define TTY_INPUT_EVENT		(TTY_RQ_BASE + 3) /* relayed input event */
+
+/*===========================================================================*
+ *			Messages for input server and drivers		     *
+ *===========================================================================*/
+
+/* The input protocol has no real replies. All messages are one-way. */
+#define INPUT_RQ_BASE 0x1500	/* from TTY to server, or server to driver */
+#define INPUT_RS_BASE 0x1580	/* from input driver to input server */
+
+#define INPUT_CONF		(INPUT_RQ_BASE + 0)	/* configure driver */
+#define INPUT_SETLEDS		(INPUT_RQ_BASE + 1)	/* set keyboard LEDs */
+
+#define INPUT_EVENT		(INPUT_RS_BASE + 0)	/* send input event */
+
+/*===========================================================================*
+ *			Messages for PTYFS				     *
+ *===========================================================================*/
+
+#define PTYFS_BASE 0x1700
+
+#define PTYFS_SET		(PTYFS_BASE + 0)	/* add/update node */
+#define PTYFS_CLEAR		(PTYFS_BASE + 1)	/* delete node */
+#define PTYFS_NAME		(PTYFS_BASE + 2)	/* get node name */
+
+/*===========================================================================*
+ *			VFS-FS TRANSACTION IDs				     *
+ *===========================================================================*/
+
+#define VFS_TRANSACTION_BASE 0xB00
+
+#define VFS_TRANSID	(VFS_TRANSACTION_BASE + 1)
+#define IS_VFS_FS_TRANSID(type) (((type) & ~0xff) == VFS_TRANSACTION_BASE)
+
+/*===========================================================================*
+ *			Messages for character devices			     *
+ *===========================================================================*/
+
+/* Base type for character device requests and responses. */
+#define CDEV_RQ_BASE	0x400
+#define CDEV_RS_BASE	0x480
+
+#define IS_CDEV_RQ(type) (((type) & ~0x7f) == CDEV_RQ_BASE)
+#define IS_CDEV_RS(type) (((type) & ~0x7f) == CDEV_RS_BASE)
+
+/* Message types for character device requests. */
+#define CDEV_OPEN	(CDEV_RQ_BASE + 0)	/* open a minor device */
+#define CDEV_CLOSE	(CDEV_RQ_BASE + 1)	/* close a minor device */
+#define CDEV_READ	(CDEV_RQ_BASE + 2)	/* read into a buffer */
+#define CDEV_WRITE	(CDEV_RQ_BASE + 3)	/* write from a buffer */
+#define CDEV_IOCTL	(CDEV_RQ_BASE + 4)	/* I/O control operation */
+#define CDEV_CANCEL	(CDEV_RQ_BASE + 5)	/* cancel suspended request */
+#define CDEV_SELECT	(CDEV_RQ_BASE + 6)	/* test for ready operations */
+
+/* Message types for character device responses. */
+#define CDEV_REPLY	(CDEV_RS_BASE + 0)	/* general reply code */
+#define CDEV_SEL1_REPLY	(CDEV_RS_BASE + 1)	/* immediate select reply */
+#define CDEV_SEL2_REPLY	(CDEV_RS_BASE + 2)	/* select notification reply */
+
+/* Bits in 'CDEV_ACCESS' field of block device open requests. */
+#  define CDEV_R_BIT		0x01	/* open with read access */
+#  define CDEV_W_BIT		0x02	/* open with write access */
+#  define CDEV_NOCTTY		0x04	/* not to become the controlling TTY */
+
+/* Bits in 'CDEV_FLAGS' field of block device transfer requests. */
+#  define CDEV_NOFLAGS		0x00	/* no flags are set */
+#  define CDEV_NONBLOCK		0x01	/* do not suspend I/O request */
+
+/* Bits in 'CDEV_OPS', 'CDEV_STATUS' fields of block device select messages. */
+#  define CDEV_OP_RD		0x01	/* selected for read operation */
+#  define CDEV_OP_WR		0x02	/* selected for write operation */
+#  define CDEV_OP_ERR		0x04	/* selected for error operation */
+#  define CDEV_NOTIFY		0x08	/* notification requested */
+
+/* Bits in 'CDEV_STATUS' field of block device open responses. */
+#  define CDEV_CLONED		0x20000000	/* device is cloned */
+#  define CDEV_CTTY		0x40000000	/* device is controlling TTY */
+
+/*===========================================================================*
+ *			Messages for block devices			     *
+ *===========================================================================*/
+
+/* Base type for block device requests and responses. */
+#define BDEV_RQ_BASE	0x500
+#define BDEV_RS_BASE	0x580
+
+#define IS_BDEV_RQ(type) (((type) & ~0x7f) == BDEV_RQ_BASE)
+#define IS_BDEV_RS(type) (((type) & ~0x7f) == BDEV_RS_BASE)
+
+/* Message types for block device requests. */
+#define BDEV_OPEN	(BDEV_RQ_BASE + 0)	/* open a minor device */
+#define BDEV_CLOSE	(BDEV_RQ_BASE + 1)	/* close a minor device */
+#define BDEV_READ	(BDEV_RQ_BASE + 2)	/* read into a buffer */
+#define BDEV_WRITE	(BDEV_RQ_BASE + 3)	/* write from a buffer */
+#define BDEV_GATHER	(BDEV_RQ_BASE + 4)	/* read into a vector */
+#define BDEV_SCATTER	(BDEV_RQ_BASE + 5)	/* write from a vector */
+#define BDEV_IOCTL	(BDEV_RQ_BASE + 6)	/* I/O control operation */
+
+/* Message types for block device responses. */
+#define BDEV_REPLY	(BDEV_RS_BASE + 0)	/* general reply code */
+
+/* Bits in 'BDEV_ACCESS' field of block device open requests. */
+#  define BDEV_R_BIT		0x01	/* open with read access */
+#  define BDEV_W_BIT		0x02	/* open with write access */
+
+/* Bits in 'BDEV_FLAGS' field of block device transfer requests. */
+#  define BDEV_NOFLAGS		0x00	/* no flags are set */
+#  define BDEV_FORCEWRITE	0x01	/* force write to disk immediately */
+#  define BDEV_NOPAGE		0x02	/* eeprom: don't send page address */
+
+/*===========================================================================*
+ *			Messages for Real Time Clocks			     *
+ *===========================================================================*/
+
+/* Base type for real time clock requests and responses. */
+#define RTCDEV_RQ_BASE	0x1400
+#define RTCDEV_RS_BASE	0x1480
+
+#define IS_RTCDEV_RQ(type) (((type) & ~0x7f) == RTCDEV_RQ_BASE)
+#define IS_RTCDEV_RS(type) (((type) & ~0x7f) == RTCDEV_RS_BASE)
+
+/* Message types for real time clock requests. */
+#define RTCDEV_GET_TIME	(RTCDEV_RQ_BASE + 0)	/* get time from hw clock */
+#define RTCDEV_SET_TIME	(RTCDEV_RQ_BASE + 1)	/* set time in hw clock */
+#define RTCDEV_PWR_OFF	(RTCDEV_RQ_BASE + 2)	/* set time to cut the power */
+
+/* Same as GET/SET above but using grants */
+#define RTCDEV_GET_TIME_G (RTCDEV_RQ_BASE + 3)	/* get time from hw clock */
+#define RTCDEV_SET_TIME_G (RTCDEV_RQ_BASE + 4)	/* set time in hw clock */
+
+/* Message types for real time clock responses. */
+#define RTCDEV_REPLY	(RTCDEV_RS_BASE + 0)	/* general reply code */
+
+/* Bits in 'lc_readclock_rtcdev.flags' field of real time clock requests. */
+#define RTCDEV_NOFLAGS	0x00	/* no flags are set */
+#define RTCDEV_Y2KBUG	0x01	/* Interpret 1980 as 2000 for RTC w/Y2K bug */
+#define RTCDEV_CMOSREG	0x02	/* Also set the CMOS clock register bits. */
+
+/*===========================================================================*
+ *				Calls to MIB				     *
+ *===========================================================================*/
+
+#define MIB_BASE		0x1800
+
+#define IS_MIB_CALL(type)	(((type) & ~0xff) == MIB_BASE)
+
+#define MIB_SYSCTL		(MIB_BASE + 0)		/* sysctl(2) */
+#define MIB_REGISTER		(MIB_BASE + 1)		/* mount subtree */
+#define MIB_DEREGISTER		(MIB_BASE + 2)		/* unmount subtree */
+
+#define NR_MIB_CALLS		3	/* highest number from base plus one */
+
+/*===========================================================================*
+ *			Messages for socket devices			     *
+ *===========================================================================*/
+
+/* Base type for socket device requests and responses. */
+#define SDEV_RQ_BASE		0x1900
+#define SDEV_RS_BASE		0x1980
+
+#define IS_SDEV_RQ(type)	(((type) & ~0x7f) == SDEV_RQ_BASE)
+#define IS_SDEV_RS(type)	(((type) & ~0x7f) == SDEV_RS_BASE)
+
+/* Message types for socket device requests. */
+#define SDEV_SOCKET		(SDEV_RQ_BASE + 0)	/* create socket */
+#define SDEV_SOCKETPAIR		(SDEV_RQ_BASE + 1)	/* make socket pair */
+#define SDEV_BIND		(SDEV_RQ_BASE + 2)	/* bind to address */
+#define SDEV_CONNECT		(SDEV_RQ_BASE + 3)	/* start connection */
+#define SDEV_LISTEN		(SDEV_RQ_BASE + 4)	/* enter listen mode */
+#define SDEV_ACCEPT		(SDEV_RQ_BASE + 5)	/* accept connection */
+#define SDEV_SEND		(SDEV_RQ_BASE + 6)	/* send data */
+#define SDEV_RECV		(SDEV_RQ_BASE + 7)	/* receive data */
+#define SDEV_IOCTL		(SDEV_RQ_BASE + 8)	/* I/O control */
+#define SDEV_SETSOCKOPT		(SDEV_RQ_BASE + 9)	/* set socket option */
+#define SDEV_GETSOCKOPT		(SDEV_RQ_BASE + 10)	/* get socket option */
+#define SDEV_GETSOCKNAME	(SDEV_RQ_BASE + 11)	/* get socket name */
+#define SDEV_GETPEERNAME	(SDEV_RQ_BASE + 12)	/* get peer name */
+#define SDEV_SHUTDOWN		(SDEV_RQ_BASE + 13)	/* shut down I/O */
+#define SDEV_CLOSE		(SDEV_RQ_BASE + 14)	/* close socket */
+#define SDEV_CANCEL		(SDEV_RQ_BASE + 15)	/* cancel request */
+#define SDEV_SELECT		(SDEV_RQ_BASE + 16)	/* select on socket */
+
+/* Message types for socket device responses. */
+#define SDEV_REPLY		(SDEV_RS_BASE + 0)	/* generic reply */
+#define SDEV_SOCKET_REPLY	(SDEV_RS_BASE + 1)	/* socket reply */
+#define SDEV_ACCEPT_REPLY	(SDEV_RS_BASE + 2)	/* accept reply */
+#define SDEV_RECV_REPLY		(SDEV_RS_BASE + 3)	/* receive reply */
+#define SDEV_SELECT1_REPLY	(SDEV_RS_BASE + 4)	/* select reply 1 */
+#define SDEV_SELECT2_REPLY	(SDEV_RS_BASE + 5)	/* select reply 2 */
+
+/* Bits in the 'sflags' field of socket device transfer requests. */
+#  define SDEV_NOFLAGS		0x00	/* no flags are set */
+#  define SDEV_NONBLOCK		0x01	/* do not suspend I/O request */
+
+/* Bits in the 'ops', 'status' fields of socket device select messages. */
+#  define SDEV_OP_RD		0x01	/* selected for read operation */
+#  define SDEV_OP_WR		0x02	/* selected for write operation */
+#  define SDEV_OP_ERR		0x04	/* selected for error operation */
+#  define SDEV_NOTIFY		0x08	/* notification requested */
+
+/*===========================================================================*
+ *			Messages for network devices			     *
+ *===========================================================================*/
+
+/* Base type for network device requests and responses. */
+#define NDEV_RQ_BASE		0x1A00		/* ndev -> netdriver */
+#define NDEV_RS_BASE		0x1A80		/* netdriver -> ndev */
+
+#define IS_NDEV_RQ(type)	(((type) & ~0x7f) == NDEV_RQ_BASE)
+#define IS_NDEV_RS(type)	(((type) & ~0x7f) == NDEV_RS_BASE)
+
+/*
+ * Status requests and responses travel in the opposite direction, so we group
+ * them with their sending party, so that the IS_NDEV_R[QS] macros can be used
+ * by either side to see whether the message is indeed for them.
+ */
+#define NDEV_INIT		(NDEV_RQ_BASE + 0)	/* initialize driver */
+#define NDEV_CONF		(NDEV_RQ_BASE + 1)	/* configure driver */
+#define NDEV_SEND		(NDEV_RQ_BASE + 2)	/* send a packet */
+#define NDEV_RECV		(NDEV_RQ_BASE + 3)	/* receive a packet */
+#define NDEV_IOCTL		(NDEV_RQ_BASE + 4)	/* (reserved) */
+#define NDEV_STATUS_REPLY	(NDEV_RQ_BASE + 5)	/* status reply */
+
+#define NDEV_INIT_REPLY		(NDEV_RS_BASE + 0)	/* initialize reply */
+#define NDEV_CONF_REPLY		(NDEV_RS_BASE + 1)	/* configure reply */
+#define NDEV_SEND_REPLY		(NDEV_RS_BASE + 2)	/* send reply */
+#define NDEV_RECV_REPLY		(NDEV_RS_BASE + 3)	/* receive reply */
+#define NDEV_IOCTL_REPLY	(NDEV_RS_BASE + 4)	/* (reserved) */
+#define NDEV_STATUS		(NDEV_RS_BASE + 5)	/* status report */
+
+/* Bits in the 'set' field of configuration requests. */
+#  define NDEV_SET_MODE		0x01	/* set I/O mode and multicast list */
+#  define NDEV_SET_CAPS		0x02	/* enable or disable capabilities */
+#  define NDEV_SET_FLAGS	0x04	/* set driver-specific flags */
+#  define NDEV_SET_MEDIA	0x08	/* set media type */
+#  define NDEV_SET_HWADDR	0x10	/* change the hardware address */
+
+/* Bits in the 'mode' field of configuration requests. */
+#  define NDEV_MODE_DOWN	0x00	/* transmission and receipt disabled */
+#  define NDEV_MODE_UP		0x01	/* receive unicast packets for me */
+#  define NDEV_MODE_BCAST	0x02	/* receive broadcast packets */
+#  define NDEV_MODE_MCAST_LIST	0x04	/* receive certain multicast packets */
+#  define NDEV_MODE_MCAST_ALL	0x08	/* receive all multicast packets */
+#  define NDEV_MODE_PROMISC	0x10	/* receive all packets */
+
+/* Bits in the 'caps' field of initialization and configuration requests. */
+#  define NDEV_CAP_CS_IP4_TX	0x01	/* IPv4 header checksum generation */
+#  define NDEV_CAP_CS_IP4_RX	0x02	/* IPv4 header checksum verification */
+#  define NDEV_CAP_CS_UDP_TX	0x04	/* UDP header checksum generation */
+#  define NDEV_CAP_CS_UDP_RX	0x08	/* UDP header checksum verification */
+#  define NDEV_CAP_CS_TCP_TX	0x10	/* TCP header checksum generation */
+#  define NDEV_CAP_CS_TCP_RX	0x20	/* TCP header checksum verification */
+#  define NDEV_CAP_MCAST	0x20000000	/* init only: mcast capable */
+#  define NDEV_CAP_BCAST	0x40000000	/* init only: bcast capable */
+#  define NDEV_CAP_HWADDR	0x80000000	/* init only: can set hwaddr */
+
+/* Values for the 'flags' field of configuration requests. */
+#  define NDEV_FLAG_DEBUG	0x01	/* enable driver-specific debug mode */
+#  define NDEV_FLAG_LINK0	0x02	/* enable driver-specific LINK0 flag */
+#  define NDEV_FLAG_LINK1	0x04	/* enable driver-specific LINK1 flag */
+#  define NDEV_FLAG_LINK2	0x08	/* enable driver-specific LINK2 flag */
+
+/* Values for the 'link' field of initialization and status replies. */
+#  define NDEV_LINK_UNKNOWN	0	/* link status is unknown, assume up */
+#  define NDEV_LINK_UP		1	/* link is up */
+#  define NDEV_LINK_DOWN	2	/* link is down */
+
+/*===========================================================================*
+ *		Internal codes used by several services			     *
+ *===========================================================================*/
+
+#define SUSPEND 	 -998 	/* status to suspend caller, reply later */
+
+#endif /* !_MINIX_COM_H */

Property changes on: lab4/.minix-src/include/minix/com.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/blockdriver_mt.h
===================================================================
--- lab4/.minix-src/include/minix/blockdriver_mt.h	(nonexistent)
+++ lab4/.minix-src/include/minix/blockdriver_mt.h	(revision 13)
@@ -0,0 +1,18 @@
+#ifndef _MINIX_BLOCKDRIVER_MT_H
+#define _MINIX_BLOCKDRIVER_MT_H
+
+#define BLOCKDRIVER_MT_API 1	/* do not expose the singlethreaded API */
+#include <minix/blockdriver.h>
+
+#define BLOCKDRIVER_MAX_DEVICES		32
+
+void blockdriver_mt_task(struct blockdriver *driver_tab);
+void blockdriver_mt_sleep(void);
+void blockdriver_mt_wakeup(thread_id_t id);
+void blockdriver_mt_terminate(void);
+void blockdriver_mt_set_workers(device_id_t id, unsigned int workers);
+thread_id_t blockdriver_mt_get_tid(void);
+
+void blockdriver_mt_support_lu(void);
+
+#endif /* _MINIX_BLOCKDRIVER_MT_H */

Property changes on: lab4/.minix-src/include/minix/blockdriver_mt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/ds.h
===================================================================
--- lab4/.minix-src/include/minix/ds.h	(nonexistent)
+++ lab4/.minix-src/include/minix/ds.h	(revision 13)
@@ -0,0 +1,74 @@
+/* Prototypes and definitions for DS interface. */
+
+#ifndef _MINIX_DS_H
+#define _MINIX_DS_H
+
+#ifdef _MINIX_SYSTEM
+
+#include <sys/types.h>
+#include <minix/endpoint.h>
+
+/* Flags. */
+#define DSF_IN_USE		0x001	/* entry is in use */
+#define DSF_PRIV_RETRIEVE	0x002	/* only owner can retrieve */
+#define DSF_PRIV_OVERWRITE	0x004	/* only owner can overwrite */
+#define DSF_PRIV_SNAPSHOT	0x004	/* only owner can take a snapshot */
+#define DSF_PRIV_SUBSCRIBE	0x008	/* only owner can subscribe */
+#define DSF_TYPE_U32		0x010	/* u32 data type */
+#define DSF_TYPE_STR		0x020	/* string data type */
+#define DSF_TYPE_MEM		0x040	/* memory range data type */
+#define DSF_TYPE_LABEL		0x100	/* label data type */
+
+#define DSF_MASK_TYPE		0xFF0	/* mask for type flags. */
+#define DSF_MASK_INTERNAL	0xFFF	/* mask for internal flags. */
+
+#define DSF_OVERWRITE		0x01000	/* overwrite if entry exists */
+#define DSF_INITIAL		0x02000	/* check subscriptions immediately */
+
+/* DS constants. */
+#define DS_MAX_KEYLEN 80        /* Max length of a key, including '\0'. */
+
+/* DS events. */
+#define DS_DRIVER_UP		1
+
+/* ds.c */
+
+/* U32 */
+int ds_publish_u32(const char *name, u32_t val, int flags);
+int ds_retrieve_u32(const char *name, u32_t *val);
+int ds_delete_u32(const char *ds_name);
+
+/* STRING */
+int ds_publish_str(const char *name, char *val, int flags);
+int ds_retrieve_str(const char *name, char *val, size_t len);
+int ds_delete_str(const char *ds_name);
+
+/* MEM */
+int ds_publish_mem(const char *ds_name, void *vaddr, size_t length, int
+	flags);
+int ds_retrieve_mem(const char *ds_name, char *vaddr, size_t *length);
+int ds_delete_mem(const char *ds_name);
+
+/* MAP */
+int ds_publish_map(const char *ds_name, void *vaddr, size_t length, int
+	flags);
+int ds_snapshot_map(const char *ds_name, int *nr_snapshot);
+int ds_retrieve_map(const char *ds_name, char *vaddr, size_t *length,
+	int nr_snapshot, int flags);
+int ds_delete_map(const char *ds_name);
+
+/* LABEL */
+int ds_publish_label(const char *ds_name, endpoint_t endpoint, int
+	flags);
+int ds_retrieve_label_name(char *ds_name, endpoint_t endpoint);
+int ds_retrieve_label_endpt(const char *ds_name, endpoint_t *endpoint);
+int ds_delete_label(const char *ds_name);
+
+/* Subscribe and check. */
+int ds_subscribe(const char *regex, int flags);
+int ds_check(char *ds_name, int *type, endpoint_t *owner_e);
+
+#endif /* _MINIX_SYSTEM */
+
+#endif /* _MINIX_DS_H */
+

Property changes on: lab4/.minix-src/include/minix/ds.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lutok/c_gate.hpp
===================================================================
--- lab4/.minix-src/include/lutok/c_gate.hpp	(nonexistent)
+++ lab4/.minix-src/include/lutok/c_gate.hpp	(revision 13)
@@ -0,0 +1,71 @@
+// Copyright 2011 Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+//   notice, this list of conditions and the following disclaimer.
+// * 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.
+// * Neither the name of Google Inc. nor the names of its contributors
+//   may be used to endorse or promote products derived from this software
+//   without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/// \file c_gate.hpp
+/// Provides direct access to the C state of the Lua wrappers.
+
+#if !defined(LUTOK_C_GATE_HPP)
+#define LUTOK_C_GATE_HPP
+
+#include <lua.hpp>
+
+namespace lutok {
+
+
+class state;
+
+
+/// Gateway to the raw C state of Lua.
+///
+/// This class provides a mechanism to muck with the internals of the state
+/// wrapper class.  Client code may wish to do so if Lutok is missing some
+/// features of the performance of Lutok in a particular situation is not
+/// reasonable.
+///
+/// \warning The use of this class is discouraged.  By using this class, you are
+/// entering the world of unsafety.  Anything you do through the objects exposed
+/// through this class will not be controlled by RAII patterns not validated in
+/// any other way, so you can end up corrupting the Lua state and later get
+/// crashes on otherwise perfectly-valid C++ code.
+class state_c_gate {
+    /// The C++ state that this class wraps.
+    state& _state;
+
+public:
+    state_c_gate(state&);
+    ~state_c_gate(void);
+
+    static state connect(lua_State*);
+
+    lua_State* c_state(void);
+};
+
+
+}  // namespace lutok
+
+#endif  // !defined(LUTOK_C_GATE_HPP)

Property changes on: lab4/.minix-src/include/lutok/c_gate.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/fslib.h
===================================================================
--- lab4/.minix-src/include/minix/fslib.h	(nonexistent)
+++ lab4/.minix-src/include/minix/fslib.h	(revision 13)
@@ -0,0 +1,6 @@
+/* V1 and V2 file system disk to/from memory support functions. */
+
+int bitmapsize(bit_t _nr_bits, int block_size);
+unsigned conv2(int _norm, int _w);
+long conv4(int _norm, long _x);
+void new_icopy(struct inode *_rip, d2_inode *_dip, int _direction, int _norm);

Property changes on: lab4/.minix-src/include/minix/fslib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/debug.h
===================================================================
--- lab4/.minix-src/include/minix/debug.h	(nonexistent)
+++ lab4/.minix-src/include/minix/debug.h	(revision 13)
@@ -0,0 +1,22 @@
+#ifndef _MINIX_DEBUG_H
+#define _MINIX_DEBUG_H 1
+
+/* For reminders of things to be fixed. */
+#define FIXME(str) { static int fixme_warned = 0; \
+	if(!fixme_warned) { \
+		printf("FIXME: %s:%d: %s\n", __FILE__, __LINE__, str);\
+		fixme_warned = 1; \
+	} \
+}
+
+#define NOT_REACHABLE	do {						\
+	panic("NOT_REACHABLE at %s:%d", __FILE__, __LINE__);	\
+	for(;;);							\
+} while(0)
+
+#define NOT_IMPLEMENTED do {	\
+		panic("NOT_IMPLEMENTED at %s:%d", __FILE__, __LINE__); \
+} while(0)
+
+#endif /* _MINIX_DEBUG_H */
+

Property changes on: lab4/.minix-src/include/minix/debug.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lutok/stack_cleaner.hpp
===================================================================
--- lab4/.minix-src/include/lutok/stack_cleaner.hpp	(nonexistent)
+++ lab4/.minix-src/include/lutok/stack_cleaner.hpp	(revision 13)
@@ -0,0 +1,93 @@
+// Copyright 2011 Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+//   notice, this list of conditions and the following disclaimer.
+// * 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.
+// * Neither the name of Google Inc. nor the names of its contributors
+//   may be used to endorse or promote products derived from this software
+//   without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/// \file stack_cleaner.hpp
+/// Provides the stack_cleaner class.
+
+#if !defined(LUTOK_STACK_CLEANER_HPP)
+#define LUTOK_STACK_CLEANER_HPP
+
+#include <memory>
+
+#include <lutok/state.hpp>
+
+namespace lutok {
+
+
+/// A RAII model for values on the Lua stack.
+///
+/// At creation time, the object records the current depth of the Lua stack and,
+/// during destruction, restores the recorded depth by popping as many stack
+/// entries as required.  As a corollary, the stack can only grow during the
+/// lifetime of a stack_cleaner object (or shrink, but cannot become shorter
+/// than the depth recorded at creation time).
+///
+/// Use this class as follows:
+///
+/// state s;
+/// {
+///     stack_cleaner cleaner1(s);
+///     s.push_integer(3);
+///     s.push_integer(5);
+///     ... do stuff here ...
+///     for (...) {
+///         stack_cleaner cleaner2(s);
+///         s.load_string("...");
+///         s.pcall(0, 1, 0);
+///         ... do stuff here ...
+///     }
+///     // cleaner2 destroyed; the result of pcall is gone.
+/// }
+/// // cleaner1 destroyed; the integers 3 and 5 are gone.
+///
+/// You must give a name to the instantiated objects even if they cannot be
+/// accessed later.  Otherwise, the instance will be destroyed right away and
+/// will not have the desired effect.
+class stack_cleaner {
+    struct impl;
+
+    /// Pointer to the shared internal implementation.
+    std::auto_ptr< impl > _pimpl;
+
+    /// Disallow copies.
+    stack_cleaner(const stack_cleaner&);
+
+    /// Disallow assignment.
+    stack_cleaner& operator=(const stack_cleaner&);
+
+public:
+    stack_cleaner(state&);
+    ~stack_cleaner(void);
+
+    void forget(void);
+};
+
+
+}  // namespace lutok
+
+#endif  // !defined(LUTOK_STACK_CLEANER_HPP)

Property changes on: lab4/.minix-src/include/lutok/stack_cleaner.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/base.h
===================================================================
--- lab4/.minix-src/include/lzma/base.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/base.h	(revision 13)
@@ -0,0 +1,654 @@
+/**
+ * \file        lzma/base.h
+ * \brief       Data types and functions used in many places in liblzma API
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/**
+ * \brief       Boolean
+ *
+ * This is here because C89 doesn't have stdbool.h. To set a value for
+ * variables having type lzma_bool, you can use
+ *   - C99's `true' and `false' from stdbool.h;
+ *   - C++'s internal `true' and `false'; or
+ *   - integers one (true) and zero (false).
+ */
+typedef unsigned char lzma_bool;
+
+
+/**
+ * \brief       Type of reserved enumeration variable in structures
+ *
+ * To avoid breaking library ABI when new features are added, several
+ * structures contain extra variables that may be used in future. Since
+ * sizeof(enum) can be different than sizeof(int), and sizeof(enum) may
+ * even vary depending on the range of enumeration constants, we specify
+ * a separate type to be used for reserved enumeration variables. All
+ * enumeration constants in liblzma API will be non-negative and less
+ * than 128, which should guarantee that the ABI won't break even when
+ * new constants are added to existing enumerations.
+ */
+typedef enum {
+	LZMA_RESERVED_ENUM      = 0
+} lzma_reserved_enum;
+
+
+/**
+ * \brief       Return values used by several functions in liblzma
+ *
+ * Check the descriptions of specific functions to find out which return
+ * values they can return. With some functions the return values may have
+ * more specific meanings than described here; those differences are
+ * described per-function basis.
+ */
+typedef enum {
+	LZMA_OK                 = 0,
+		/**<
+		 * \brief       Operation completed successfully
+		 */
+
+	LZMA_STREAM_END         = 1,
+		/**<
+		 * \brief       End of stream was reached
+		 *
+		 * In encoder, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or
+		 * LZMA_FINISH was finished. In decoder, this indicates
+		 * that all the data was successfully decoded.
+		 *
+		 * In all cases, when LZMA_STREAM_END is returned, the last
+		 * output bytes should be picked from strm->next_out.
+		 */
+
+	LZMA_NO_CHECK           = 2,
+		/**<
+		 * \brief       Input stream has no integrity check
+		 *
+		 * This return value can be returned only if the
+		 * LZMA_TELL_NO_CHECK flag was used when initializing
+		 * the decoder. LZMA_NO_CHECK is just a warning, and
+		 * the decoding can be continued normally.
+		 *
+		 * It is possible to call lzma_get_check() immediately after
+		 * lzma_code has returned LZMA_NO_CHECK. The result will
+		 * naturally be LZMA_CHECK_NONE, but the possibility to call
+		 * lzma_get_check() may be convenient in some applications.
+		 */
+
+	LZMA_UNSUPPORTED_CHECK  = 3,
+		/**<
+		 * \brief       Cannot calculate the integrity check
+		 *
+		 * The usage of this return value is different in encoders
+		 * and decoders.
+		 *
+		 * Encoders can return this value only from the initialization
+		 * function. If initialization fails with this value, the
+		 * encoding cannot be done, because there's no way to produce
+		 * output with the correct integrity check.
+		 *
+		 * Decoders can return this value only from lzma_code() and
+		 * only if the LZMA_TELL_UNSUPPORTED_CHECK flag was used when
+		 * initializing the decoder. The decoding can still be
+		 * continued normally even if the check type is unsupported,
+		 * but naturally the check will not be validated, and possible
+		 * errors may go undetected.
+		 *
+		 * With decoder, it is possible to call lzma_get_check()
+		 * immediately after lzma_code() has returned
+		 * LZMA_UNSUPPORTED_CHECK. This way it is possible to find
+		 * out what the unsupported Check ID was.
+		 */
+
+	LZMA_GET_CHECK          = 4,
+		/**<
+		 * \brief       Integrity check type is now available
+		 *
+		 * This value can be returned only by the lzma_code() function
+		 * and only if the decoder was initialized with the
+		 * LZMA_TELL_ANY_CHECK flag. LZMA_GET_CHECK tells the
+		 * application that it may now call lzma_get_check() to find
+		 * out the Check ID. This can be used, for example, to
+		 * implement a decoder that accepts only files that have
+		 * strong enough integrity check.
+		 */
+
+	LZMA_MEM_ERROR          = 5,
+		/**<
+		 * \brief       Cannot allocate memory
+		 *
+		 * Memory allocation failed, or the size of the allocation
+		 * would be greater than SIZE_MAX.
+		 *
+		 * Due to internal implementation reasons, the coding cannot
+		 * be continued even if more memory were made available after
+		 * LZMA_MEM_ERROR.
+		 */
+
+	LZMA_MEMLIMIT_ERROR     = 6,
+		/**
+		 * \brief       Memory usage limit was reached
+		 *
+		 * Decoder would need more memory than allowed by the
+		 * specified memory usage limit. To continue decoding,
+		 * the memory usage limit has to be increased with
+		 * lzma_memlimit_set().
+		 */
+
+	LZMA_FORMAT_ERROR       = 7,
+		/**<
+		 * \brief       File format not recognized
+		 *
+		 * The decoder did not recognize the input as supported file
+		 * format. This error can occur, for example, when trying to
+		 * decode .lzma format file with lzma_stream_decoder,
+		 * because lzma_stream_decoder accepts only the .xz format.
+		 */
+
+	LZMA_OPTIONS_ERROR      = 8,
+		/**<
+		 * \brief       Invalid or unsupported options
+		 *
+		 * Invalid or unsupported options, for example
+		 *  - unsupported filter(s) or filter options; or
+		 *  - reserved bits set in headers (decoder only).
+		 *
+		 * Rebuilding liblzma with more features enabled, or
+		 * upgrading to a newer version of liblzma may help.
+		 */
+
+	LZMA_DATA_ERROR         = 9,
+		/**<
+		 * \brief       Data is corrupt
+		 *
+		 * The usage of this return value is different in encoders
+		 * and decoders. In both encoder and decoder, the coding
+		 * cannot continue after this error.
+		 *
+		 * Encoders return this if size limits of the target file
+		 * format would be exceeded. These limits are huge, thus
+		 * getting this error from an encoder is mostly theoretical.
+		 * For example, the maximum compressed and uncompressed
+		 * size of a .xz Stream is roughly 8 EiB (2^63 bytes).
+		 *
+		 * Decoders return this error if the input data is corrupt.
+		 * This can mean, for example, invalid CRC32 in headers
+		 * or invalid check of uncompressed data.
+		 */
+
+	LZMA_BUF_ERROR          = 10,
+		/**<
+		 * \brief       No progress is possible
+		 *
+		 * This error code is returned when the coder cannot consume
+		 * any new input and produce any new output. The most common
+		 * reason for this error is that the input stream being
+		 * decoded is truncated or corrupt.
+		 *
+		 * This error is not fatal. Coding can be continued normally
+		 * by providing more input and/or more output space, if
+		 * possible.
+		 *
+		 * Typically the first call to lzma_code() that can do no
+		 * progress returns LZMA_OK instead of LZMA_BUF_ERROR. Only
+		 * the second consecutive call doing no progress will return
+		 * LZMA_BUF_ERROR. This is intentional.
+		 *
+		 * With zlib, Z_BUF_ERROR may be returned even if the
+		 * application is doing nothing wrong, so apps will need
+		 * to handle Z_BUF_ERROR specially. The above hack
+		 * guarantees that liblzma never returns LZMA_BUF_ERROR
+		 * to properly written applications unless the input file
+		 * is truncated or corrupt. This should simplify the
+		 * applications a little.
+		 */
+
+	LZMA_PROG_ERROR         = 11,
+		/**<
+		 * \brief       Programming error
+		 *
+		 * This indicates that the arguments given to the function are
+		 * invalid or the internal state of the decoder is corrupt.
+		 *   - Function arguments are invalid or the structures
+		 *     pointed by the argument pointers are invalid
+		 *     e.g. if strm->next_out has been set to NULL and
+		 *     strm->avail_out > 0 when calling lzma_code().
+		 *   - lzma_* functions have been called in wrong order
+		 *     e.g. lzma_code() was called right after lzma_end().
+		 *   - If errors occur randomly, the reason might be flaky
+		 *     hardware.
+		 *
+		 * If you think that your code is correct, this error code
+		 * can be a sign of a bug in liblzma. See the documentation
+		 * how to report bugs.
+		 */
+} lzma_ret;
+
+
+/**
+ * \brief       The `action' argument for lzma_code()
+ *
+ * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, LZMA_FULL_BARRIER,
+ * or LZMA_FINISH, the same `action' must is used until lzma_code() returns
+ * LZMA_STREAM_END. Also, the amount of input (that is, strm->avail_in) must
+ * not be modified by the application until lzma_code() returns
+ * LZMA_STREAM_END. Changing the `action' or modifying the amount of input
+ * will make lzma_code() return LZMA_PROG_ERROR.
+ */
+typedef enum {
+	LZMA_RUN = 0,
+		/**<
+		 * \brief       Continue coding
+		 *
+		 * Encoder: Encode as much input as possible. Some internal
+		 * buffering will probably be done (depends on the filter
+		 * chain in use), which causes latency: the input used won't
+		 * usually be decodeable from the output of the same
+		 * lzma_code() call.
+		 *
+		 * Decoder: Decode as much input as possible and produce as
+		 * much output as possible.
+		 */
+
+	LZMA_SYNC_FLUSH = 1,
+		/**<
+		 * \brief       Make all the input available at output
+		 *
+		 * Normally the encoder introduces some latency.
+		 * LZMA_SYNC_FLUSH forces all the buffered data to be
+		 * available at output without resetting the internal
+		 * state of the encoder. This way it is possible to use
+		 * compressed stream for example for communication over
+		 * network.
+		 *
+		 * Only some filters support LZMA_SYNC_FLUSH. Trying to use
+		 * LZMA_SYNC_FLUSH with filters that don't support it will
+		 * make lzma_code() return LZMA_OPTIONS_ERROR. For example,
+		 * LZMA1 doesn't support LZMA_SYNC_FLUSH but LZMA2 does.
+		 *
+		 * Using LZMA_SYNC_FLUSH very often can dramatically reduce
+		 * the compression ratio. With some filters (for example,
+		 * LZMA2), fine-tuning the compression options may help
+		 * mitigate this problem significantly (for example,
+		 * match finder with LZMA2).
+		 *
+		 * Decoders don't support LZMA_SYNC_FLUSH.
+		 */
+
+	LZMA_FULL_FLUSH = 2,
+		/**<
+		 * \brief       Finish encoding of the current Block
+		 *
+		 * All the input data going to the current Block must have
+		 * been given to the encoder (the last bytes can still be
+		 * pending in *next_in). Call lzma_code() with LZMA_FULL_FLUSH
+		 * until it returns LZMA_STREAM_END. Then continue normally
+		 * with LZMA_RUN or finish the Stream with LZMA_FINISH.
+		 *
+		 * This action is currently supported only by Stream encoder
+		 * and easy encoder (which uses Stream encoder). If there is
+		 * no unfinished Block, no empty Block is created.
+		 */
+
+	LZMA_FULL_BARRIER = 4,
+		/**<
+		 * \brief       Finish encoding of the current Block
+		 *
+		 * This is like LZMA_FULL_FLUSH except that this doesn't
+		 * necessarily wait until all the input has been made
+		 * available via the output buffer. That is, lzma_code()
+		 * might return LZMA_STREAM_END as soon as all the input
+		 * has been consumed (avail_in == 0).
+		 *
+		 * LZMA_FULL_BARRIER is useful with a threaded encoder if
+		 * one wants to split the .xz Stream into Blocks at specific
+		 * offsets but doesn't care if the output isn't flushed
+		 * immediately. Using LZMA_FULL_BARRIER allows keeping
+		 * the threads busy while LZMA_FULL_FLUSH would make
+		 * lzma_code() wait until all the threads have finished
+		 * until more data could be passed to the encoder.
+		 *
+		 * With a lzma_stream initialized with the single-threaded
+		 * lzma_stream_encoder() or lzma_easy_encoder(),
+		 * LZMA_FULL_BARRIER is an alias for LZMA_FULL_FLUSH.
+		 */
+
+	LZMA_FINISH = 3
+		/**<
+		 * \brief       Finish the coding operation
+		 *
+		 * All the input data must have been given to the encoder
+		 * (the last bytes can still be pending in next_in).
+		 * Call lzma_code() with LZMA_FINISH until it returns
+		 * LZMA_STREAM_END. Once LZMA_FINISH has been used,
+		 * the amount of input must no longer be changed by
+		 * the application.
+		 *
+		 * When decoding, using LZMA_FINISH is optional unless the
+		 * LZMA_CONCATENATED flag was used when the decoder was
+		 * initialized. When LZMA_CONCATENATED was not used, the only
+		 * effect of LZMA_FINISH is that the amount of input must not
+		 * be changed just like in the encoder.
+		 */
+} lzma_action;
+
+
+/**
+ * \brief       Custom functions for memory handling
+ *
+ * A pointer to lzma_allocator may be passed via lzma_stream structure
+ * to liblzma, and some advanced functions take a pointer to lzma_allocator
+ * as a separate function argument. The library will use the functions
+ * specified in lzma_allocator for memory handling instead of the default
+ * malloc() and free(). C++ users should note that the custom memory
+ * handling functions must not throw exceptions.
+ *
+ * Single-threaded mode only: liblzma doesn't make an internal copy of
+ * lzma_allocator. Thus, it is OK to change these function pointers in
+ * the middle of the coding process, but obviously it must be done
+ * carefully to make sure that the replacement `free' can deallocate
+ * memory allocated by the earlier `alloc' function(s).
+ *
+ * Multithreaded mode: liblzma might internally store pointers to the
+ * lzma_allocator given via the lzma_stream structure. The application
+ * must not change the allocator pointer in lzma_stream or the contents
+ * of the pointed lzma_allocator structure until lzma_end() has been used
+ * to free the memory associated with that lzma_stream. The allocation
+ * functions might be called simultaneously from multiple threads, and
+ * thus they must be thread safe.
+ */
+typedef struct {
+	/**
+	 * \brief       Pointer to a custom memory allocation function
+	 *
+	 * If you don't want a custom allocator, but still want
+	 * custom free(), set this to NULL and liblzma will use
+	 * the standard malloc().
+	 *
+	 * \param       opaque  lzma_allocator.opaque (see below)
+	 * \param       nmemb   Number of elements like in calloc(). liblzma
+	 *                      will always set nmemb to 1, so it is safe to
+	 *                      ignore nmemb in a custom allocator if you like.
+	 *                      The nmemb argument exists only for
+	 *                      compatibility with zlib and libbzip2.
+	 * \param       size    Size of an element in bytes.
+	 *                      liblzma never sets this to zero.
+	 *
+	 * \return      Pointer to the beginning of a memory block of
+	 *              `size' bytes, or NULL if allocation fails
+	 *              for some reason. When allocation fails, functions
+	 *              of liblzma return LZMA_MEM_ERROR.
+	 *
+	 * The allocator should not waste time zeroing the allocated buffers.
+	 * This is not only about speed, but also memory usage, since the
+	 * operating system kernel doesn't necessarily allocate the requested
+	 * memory in physical memory until it is actually used. With small
+	 * input files, liblzma may actually need only a fraction of the
+	 * memory that it requested for allocation.
+	 *
+	 * \note        LZMA_MEM_ERROR is also used when the size of the
+	 *              allocation would be greater than SIZE_MAX. Thus,
+	 *              don't assume that the custom allocator must have
+	 *              returned NULL if some function from liblzma
+	 *              returns LZMA_MEM_ERROR.
+	 */
+	void *(LZMA_API_CALL *alloc)(void *opaque, size_t nmemb, size_t size);
+
+	/**
+	 * \brief       Pointer to a custom memory freeing function
+	 *
+	 * If you don't want a custom freeing function, but still
+	 * want a custom allocator, set this to NULL and liblzma
+	 * will use the standard free().
+	 *
+	 * \param       opaque  lzma_allocator.opaque (see below)
+	 * \param       ptr     Pointer returned by lzma_allocator.alloc(),
+	 *                      or when it is set to NULL, a pointer returned
+	 *                      by the standard malloc().
+	 */
+	void (LZMA_API_CALL *free)(void *opaque, void *ptr);
+
+	/**
+	 * \brief       Pointer passed to .alloc() and .free()
+	 *
+	 * opaque is passed as the first argument to lzma_allocator.alloc()
+	 * and lzma_allocator.free(). This intended to ease implementing
+	 * custom memory allocation functions for use with liblzma.
+	 *
+	 * If you don't need this, you should set this to NULL.
+	 */
+	void *opaque;
+
+} lzma_allocator;
+
+
+/**
+ * \brief       Internal data structure
+ *
+ * The contents of this structure is not visible outside the library.
+ */
+typedef struct lzma_internal_s lzma_internal;
+
+
+/**
+ * \brief       Passing data to and from liblzma
+ *
+ * The lzma_stream structure is used for
+ *  - passing pointers to input and output buffers to liblzma;
+ *  - defining custom memory hander functions; and
+ *  - holding a pointer to coder-specific internal data structures.
+ *
+ * Typical usage:
+ *
+ *  - After allocating lzma_stream (on stack or with malloc()), it must be
+ *    initialized to LZMA_STREAM_INIT (see LZMA_STREAM_INIT for details).
+ *
+ *  - Initialize a coder to the lzma_stream, for example by using
+ *    lzma_easy_encoder() or lzma_auto_decoder(). Some notes:
+ *      - In contrast to zlib, strm->next_in and strm->next_out are
+ *        ignored by all initialization functions, thus it is safe
+ *        to not initialize them yet.
+ *      - The initialization functions always set strm->total_in and
+ *        strm->total_out to zero.
+ *      - If the initialization function fails, no memory is left allocated
+ *        that would require freeing with lzma_end() even if some memory was
+ *        associated with the lzma_stream structure when the initialization
+ *        function was called.
+ *
+ *  - Use lzma_code() to do the actual work.
+ *
+ *  - Once the coding has been finished, the existing lzma_stream can be
+ *    reused. It is OK to reuse lzma_stream with different initialization
+ *    function without calling lzma_end() first. Old allocations are
+ *    automatically freed.
+ *
+ *  - Finally, use lzma_end() to free the allocated memory. lzma_end() never
+ *    frees the lzma_stream structure itself.
+ *
+ * Application may modify the values of total_in and total_out as it wants.
+ * They are updated by liblzma to match the amount of data read and
+ * written but aren't used for anything else except as a possible return
+ * values from lzma_get_progress().
+ */
+typedef struct {
+	const uint8_t *next_in; /**< Pointer to the next input byte. */
+	size_t avail_in;    /**< Number of available input bytes in next_in. */
+	uint64_t total_in;  /**< Total number of bytes read by liblzma. */
+
+	uint8_t *next_out;  /**< Pointer to the next output position. */
+	size_t avail_out;   /**< Amount of free space in next_out. */
+	uint64_t total_out; /**< Total number of bytes written by liblzma. */
+
+	/**
+	 * \brief       Custom memory allocation functions
+	 *
+	 * In most cases this is NULL which makes liblzma use
+	 * the standard malloc() and free().
+	 *
+	 * \note        In 5.0.x this is not a const pointer.
+	 */
+	const lzma_allocator *allocator;
+
+	/** Internal state is not visible to applications. */
+	lzma_internal *internal;
+
+	/*
+	 * Reserved space to allow possible future extensions without
+	 * breaking the ABI. Excluding the initialization of this structure,
+	 * you should not touch these, because the names of these variables
+	 * may change.
+	 */
+	void *reserved_ptr1;
+	void *reserved_ptr2;
+	void *reserved_ptr3;
+	void *reserved_ptr4;
+	uint64_t reserved_int1;
+	uint64_t reserved_int2;
+	size_t reserved_int3;
+	size_t reserved_int4;
+	lzma_reserved_enum reserved_enum1;
+	lzma_reserved_enum reserved_enum2;
+
+} lzma_stream;
+
+
+/**
+ * \brief       Initialization for lzma_stream
+ *
+ * When you declare an instance of lzma_stream, you can immediately
+ * initialize it so that initialization functions know that no memory
+ * has been allocated yet:
+ *
+ *     lzma_stream strm = LZMA_STREAM_INIT;
+ *
+ * If you need to initialize a dynamically allocated lzma_stream, you can use
+ * memset(strm_pointer, 0, sizeof(lzma_stream)). Strictly speaking, this
+ * violates the C standard since NULL may have different internal
+ * representation than zero, but it should be portable enough in practice.
+ * Anyway, for maximum portability, you can use something like this:
+ *
+ *     lzma_stream tmp = LZMA_STREAM_INIT;
+ *     *strm = tmp;
+ */
+#define LZMA_STREAM_INIT \
+	{ NULL, 0, 0, NULL, 0, 0, NULL, NULL, \
+	NULL, NULL, NULL, NULL, 0, 0, 0, 0, \
+	LZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM }
+
+
+/**
+ * \brief       Encode or decode data
+ *
+ * Once the lzma_stream has been successfully initialized (e.g. with
+ * lzma_stream_encoder()), the actual encoding or decoding is done
+ * using this function. The application has to update strm->next_in,
+ * strm->avail_in, strm->next_out, and strm->avail_out to pass input
+ * to and get output from liblzma.
+ *
+ * See the description of the coder-specific initialization function to find
+ * out what `action' values are supported by the coder.
+ */
+extern LZMA_API(lzma_ret) lzma_code(lzma_stream *strm, lzma_action action)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Free memory allocated for the coder data structures
+ *
+ * \param       strm    Pointer to lzma_stream that is at least initialized
+ *                      with LZMA_STREAM_INIT.
+ *
+ * After lzma_end(strm), strm->internal is guaranteed to be NULL. No other
+ * members of the lzma_stream structure are touched.
+ *
+ * \note        zlib indicates an error if application end()s unfinished
+ *              stream structure. liblzma doesn't do this, and assumes that
+ *              application knows what it is doing.
+ */
+extern LZMA_API(void) lzma_end(lzma_stream *strm) lzma_nothrow;
+
+
+/**
+ * \brief       Get progress information
+ *
+ * In single-threaded mode, applications can get progress information from
+ * strm->total_in and strm->total_out. In multi-threaded mode this is less
+ * useful because a significant amount of both input and output data gets
+ * buffered internally by liblzma. This makes total_in and total_out give
+ * misleading information and also makes the progress indicator updates
+ * non-smooth.
+ *
+ * This function gives realistic progress information also in multi-threaded
+ * mode by taking into account the progress made by each thread. In
+ * single-threaded mode *progress_in and *progress_out are set to
+ * strm->total_in and strm->total_out, respectively.
+ */
+extern LZMA_API(void) lzma_get_progress(lzma_stream *strm,
+		uint64_t *progress_in, uint64_t *progress_out) lzma_nothrow;
+
+
+/**
+ * \brief       Get the memory usage of decoder filter chain
+ *
+ * This function is currently supported only when *strm has been initialized
+ * with a function that takes a memlimit argument. With other functions, you
+ * should use e.g. lzma_raw_encoder_memusage() or lzma_raw_decoder_memusage()
+ * to estimate the memory requirements.
+ *
+ * This function is useful e.g. after LZMA_MEMLIMIT_ERROR to find out how big
+ * the memory usage limit should have been to decode the input. Note that
+ * this may give misleading information if decoding .xz Streams that have
+ * multiple Blocks, because each Block can have different memory requirements.
+ *
+ * \return      How much memory is currently allocated for the filter
+ *              decoders. If no filter chain is currently allocated,
+ *              some non-zero value is still returned, which is less than
+ *              or equal to what any filter chain would indicate as its
+ *              memory requirement.
+ *
+ *              If this function isn't supported by *strm or some other error
+ *              occurs, zero is returned.
+ */
+extern LZMA_API(uint64_t) lzma_memusage(const lzma_stream *strm)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Get the current memory usage limit
+ *
+ * This function is supported only when *strm has been initialized with
+ * a function that takes a memlimit argument.
+ *
+ * \return      On success, the current memory usage limit is returned
+ *              (always non-zero). On error, zero is returned.
+ */
+extern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Set the memory usage limit
+ *
+ * This function is supported only when *strm has been initialized with
+ * a function that takes a memlimit argument.
+ *
+ * \return      - LZMA_OK: New memory usage limit successfully set.
+ *              - LZMA_MEMLIMIT_ERROR: The new limit is too small.
+ *                The limit was not changed.
+ *              - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't
+ *                support memory usage limit or memlimit was zero.
+ */
+extern LZMA_API(lzma_ret) lzma_memlimit_set(
+		lzma_stream *strm, uint64_t memlimit) lzma_nothrow;

Property changes on: lab4/.minix-src/include/lzma/base.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/callnr.h
===================================================================
--- lab4/.minix-src/include/minix/callnr.h	(nonexistent)
+++ lab4/.minix-src/include/minix/callnr.h	(revision 13)
@@ -0,0 +1,139 @@
+/* This header file defines the calls to PM and VFS. */
+#ifndef _MINIX_CALLNR_H
+#define _MINIX_CALLNR_H
+
+/*===========================================================================*
+ *				Calls to PM				     *
+ *===========================================================================*/
+
+#define PM_BASE			0x000
+
+#define IS_PM_CALL(type)	(((type) & ~0xff) == PM_BASE)
+
+/* Message type 0 is traditionally reserved. */
+#define PM_EXIT			(PM_BASE + 1)
+#define PM_FORK			(PM_BASE + 2)
+#define PM_WAIT4		(PM_BASE + 3)
+#define PM_GETPID		(PM_BASE + 4)
+#define PM_SETUID		(PM_BASE + 5)
+#define PM_GETUID		(PM_BASE + 6)
+#define PM_STIME		(PM_BASE + 7)
+#define PM_PTRACE		(PM_BASE + 8)
+#define PM_SETGROUPS		(PM_BASE + 9)
+#define PM_GETGROUPS		(PM_BASE + 10)
+#define PM_KILL			(PM_BASE + 11)
+#define PM_SETGID		(PM_BASE + 12)
+#define PM_GETGID		(PM_BASE + 13)
+#define PM_EXEC			(PM_BASE + 14)
+#define PM_SETSID		(PM_BASE + 15)
+#define PM_GETPGRP		(PM_BASE + 16)
+#define PM_ITIMER		(PM_BASE + 17)
+#define PM_GETMCONTEXT		(PM_BASE + 18)
+#define PM_SETMCONTEXT		(PM_BASE + 19)
+#define PM_SIGACTION		(PM_BASE + 20)
+#define PM_SIGSUSPEND		(PM_BASE + 21)
+#define PM_SIGPENDING		(PM_BASE + 22)
+#define PM_SIGPROCMASK		(PM_BASE + 23)
+#define PM_SIGRETURN		(PM_BASE + 24)
+#define PM_SYSUNAME		(PM_BASE + 25)		/* obsolete */
+#define PM_GETPRIORITY		(PM_BASE + 26)
+#define PM_SETPRIORITY		(PM_BASE + 27)
+#define PM_GETTIMEOFDAY		(PM_BASE + 28)
+#define PM_SETEUID		(PM_BASE + 29)
+#define PM_SETEGID		(PM_BASE + 30)
+#define PM_ISSETUGID		(PM_BASE + 31)
+#define PM_GETSID		(PM_BASE + 32)
+#define PM_CLOCK_GETRES		(PM_BASE + 33)
+#define PM_CLOCK_GETTIME	(PM_BASE + 34)
+#define PM_CLOCK_SETTIME	(PM_BASE + 35)
+#define PM_GETRUSAGE		(PM_BASE + 36)
+#define PM_REBOOT		(PM_BASE + 37)
+#define PM_SVRCTL		(PM_BASE + 38)
+#define PM_SPROF		(PM_BASE + 39)
+#define PM_PROCEVENTMASK	(PM_BASE + 40)
+#define PM_SRV_FORK		(PM_BASE + 41)
+#define PM_SRV_KILL		(PM_BASE + 42)
+#define PM_EXEC_NEW		(PM_BASE + 43)
+#define PM_EXEC_RESTART		(PM_BASE + 44)
+#define PM_GETEPINFO		(PM_BASE + 45)
+#define PM_GETPROCNR		(PM_BASE + 46)
+#define PM_GETSYSINFO		(PM_BASE + 47)
+
+#define NR_PM_CALLS		48	/* highest number from base plus one */
+
+/*===========================================================================*
+ *				Calls to VFS				     *
+ *===========================================================================*/
+
+#define VFS_BASE		0x100
+
+#define IS_VFS_CALL(type)	(((type) & ~0xff) == VFS_BASE)
+
+#define VFS_READ		(VFS_BASE + 0)
+#define VFS_WRITE		(VFS_BASE + 1)
+#define VFS_LSEEK		(VFS_BASE + 2)
+#define VFS_OPEN		(VFS_BASE + 3)
+#define VFS_CREAT		(VFS_BASE + 4)
+#define VFS_CLOSE		(VFS_BASE + 5)
+#define VFS_LINK		(VFS_BASE + 6)
+#define VFS_UNLINK		(VFS_BASE + 7)
+#define VFS_CHDIR		(VFS_BASE + 8)
+#define VFS_MKDIR		(VFS_BASE + 9)
+#define VFS_MKNOD		(VFS_BASE + 10)
+#define VFS_CHMOD		(VFS_BASE + 11)
+#define VFS_CHOWN		(VFS_BASE + 12)
+#define VFS_MOUNT		(VFS_BASE + 13)
+#define VFS_UMOUNT		(VFS_BASE + 14)
+#define VFS_ACCESS		(VFS_BASE + 15)
+#define VFS_SYNC		(VFS_BASE + 16)
+#define VFS_RENAME		(VFS_BASE + 17)
+#define VFS_RMDIR		(VFS_BASE + 18)
+#define VFS_SYMLINK		(VFS_BASE + 19)
+#define VFS_READLINK		(VFS_BASE + 20)
+#define VFS_STAT		(VFS_BASE + 21)
+#define VFS_FSTAT		(VFS_BASE + 22)
+#define VFS_LSTAT		(VFS_BASE + 23)
+#define VFS_IOCTL		(VFS_BASE + 24)
+#define VFS_FCNTL		(VFS_BASE + 25)
+#define VFS_PIPE2		(VFS_BASE + 26)
+#define VFS_UMASK		(VFS_BASE + 27)
+#define VFS_CHROOT		(VFS_BASE + 28)
+#define VFS_GETDENTS		(VFS_BASE + 29)
+#define VFS_SELECT		(VFS_BASE + 30)
+#define VFS_FCHDIR		(VFS_BASE + 31)
+#define VFS_FSYNC		(VFS_BASE + 32)
+#define VFS_TRUNCATE		(VFS_BASE + 33)
+#define VFS_FTRUNCATE		(VFS_BASE + 34)
+#define VFS_FCHMOD		(VFS_BASE + 35)
+#define VFS_FCHOWN		(VFS_BASE + 36)
+#define VFS_UTIMENS		(VFS_BASE + 37)
+#define VFS_VMCALL		(VFS_BASE + 38)
+#define VFS_GETVFSSTAT		(VFS_BASE + 39)
+#define VFS_STATVFS1 	 	(VFS_BASE + 40)
+#define VFS_FSTATVFS1		(VFS_BASE + 41)
+#define VFS_GETRUSAGE		(VFS_BASE + 42)		/* obsolete */
+#define VFS_SVRCTL		(VFS_BASE + 43)
+#define VFS_GCOV_FLUSH		(VFS_BASE + 44)
+#define VFS_MAPDRIVER		(VFS_BASE + 45)
+#define VFS_COPYFD		(VFS_BASE + 46)
+#define VFS_SOCKETPATH		(VFS_BASE + 47)
+#define VFS_GETSYSINFO		(VFS_BASE + 48)
+#define VFS_SOCKET		(VFS_BASE + 49)
+#define VFS_SOCKETPAIR		(VFS_BASE + 50)
+#define VFS_BIND		(VFS_BASE + 51)
+#define VFS_CONNECT		(VFS_BASE + 52)
+#define VFS_LISTEN		(VFS_BASE + 53)
+#define VFS_ACCEPT		(VFS_BASE + 54)
+#define VFS_SENDTO		(VFS_BASE + 55)
+#define VFS_SENDMSG		(VFS_BASE + 56)
+#define VFS_RECVFROM		(VFS_BASE + 57)
+#define VFS_RECVMSG		(VFS_BASE + 58)
+#define VFS_SETSOCKOPT		(VFS_BASE + 59)
+#define VFS_GETSOCKOPT		(VFS_BASE + 60)
+#define VFS_GETSOCKNAME		(VFS_BASE + 61)
+#define VFS_GETPEERNAME		(VFS_BASE + 62)
+#define VFS_SHUTDOWN		(VFS_BASE + 63)
+
+#define NR_VFS_CALLS		64	/* highest number from base plus one */
+
+#endif /* !_MINIX_CALLNR_H */

Property changes on: lab4/.minix-src/include/minix/callnr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/driver.h
===================================================================
--- lab4/.minix-src/include/minix/driver.h	(nonexistent)
+++ lab4/.minix-src/include/minix/driver.h	(revision 13)
@@ -0,0 +1,43 @@
+#ifndef _MINIX_DRIVER_H
+#define _MINIX_DRIVER_H
+
+/* Types and constants shared between block and character drivers. */
+
+#define _POSIX_SOURCE	1	/* tell headers to include POSIX stuff */
+#define _NETBSD_SOURCE	1	/* tell headers to include MINIX stuff */
+#define _SYSTEM		1	/* get negative error number in <errno.h> */
+
+/* The following are so basic, all the *.c files get them automatically. */
+#include <minix/config.h>	/* MUST be first */
+#include <minix/type.h>
+#include <minix/ipc.h>
+#include <minix/com.h>
+#include <minix/callnr.h>
+#include <sys/types.h>
+#include <minix/const.h>
+#include <minix/syslib.h>
+#include <minix/sysutil.h>
+#include <minix/endpoint.h>
+#include <string.h>
+#include <limits.h>
+#include <stddef.h>
+#include <errno.h>
+#include <sys/param.h>
+#include <minix/u64.h>
+#include <minix/partition.h>
+
+/* Base and size of a partition in bytes. */
+struct device {
+	u64_t dv_base;
+	u64_t dv_size;
+};
+
+/* Generic receive function for all drivers. */
+#ifndef driver_receive
+#define driver_receive sef_receive_status
+#endif
+
+/* Maximum supported number of concurrently opened minor devices. */
+#define MAX_NR_OPEN_DEVICES 256
+
+#endif /* _MINIX_DRIVER_H */

Property changes on: lab4/.minix-src/include/minix/driver.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/config.h
===================================================================
--- lab4/.minix-src/include/minix/config.h	(nonexistent)
+++ lab4/.minix-src/include/minix/config.h	(revision 13)
@@ -0,0 +1,106 @@
+#ifndef _CONFIG_H
+#define _CONFIG_H
+
+/* Minix release and version numbers. */
+#define OS_NAME "Minix"
+#define OS_RELEASE "3.4.0"	/* 3.m.p */
+#define OS_REV 304000000	/* see NetBSD sys/param.h: 3mm00pp00 */
+#define OS_CONFIG "GENERIC"
+#define OS_VERSION OS_NAME " " OS_RELEASE " (" OS_CONFIG ")"
+
+/* This file sets configuration parameters for the MINIX kernel, FS, and PM.
+ * It is divided up into two main sections.  The first section contains
+ * user-settable parameters.  In the second section, various internal system
+ * parameters are set based on the user-settable parameters.
+ *
+ * Parts of config.h have been moved to sys_config.h, which can be included
+ * by other include files that wish to get at the configuration data, but
+ * don't want to pollute the users namespace. Some editable values have
+ * gone there.
+ *
+ */
+
+#include <minix/sys_config.h>
+
+/* Number of slots in the process table for non-kernel processes. The number
+ * of system processes defines how many processes with special privileges 
+ * there can be. User processes share the same properties and count for one. 
+ *
+ * These can be changed in sys_config.h.
+ */
+#define NR_PROCS 	  _NR_PROCS 
+#define NR_SYS_PROCS      _NR_SYS_PROCS
+#define NR_SYS_CHUNKS	  BITMAP_CHUNKS(NR_SYS_PROCS)
+
+/* Number of controller tasks (/dev/cN device classes). */
+#define NR_CTRLRS          2
+
+/* DMA_SECTORS may be increased to speed up DMA based drivers. */
+#define DMA_SECTORS        1	/* DMA buffer size (must be >= 1) */
+
+/* NR_CONS, NR_RS_LINES, and NR_PTYS determine the number of terminals the
+ * system can handle.
+ */
+#define NR_CONS            4	/* # system consoles (1 to 8) */
+#define	NR_RS_LINES	   4	/* # rs232 terminals (0 to 3) */
+#define	NR_PTYS		   32	/* # pseudo terminals (0 to 64) */
+
+/* This feature enable the counting of system calls in PM and FS */
+#define ENABLE_SYSCALL_STATS	0
+
+/* Max. number of I/O ranges that can be assigned to a process */
+#define NR_IO_RANGE	64
+
+/* Max. number of device memory ranges that can be assigned to a process */
+#define NR_MEM_RANGE	20
+
+/* Max. number of IRQs that can be assigned to a process */
+#define NR_IRQ	16
+
+/* Max. number of domains (protocol families) per socket driver */
+#define NR_DOMAIN	8
+
+/* Scheduling priorities. Values must start at zero (highest
+ * priority) and increment.
+ */
+#define NR_SCHED_QUEUES   16	/* MUST equal minimum priority + 1 */
+#define TASK_Q		   0	/* highest, used for kernel tasks */
+#define MAX_USER_Q  	   0    /* highest priority for user processes */   
+#define USER_Q  	  ((MIN_USER_Q - MAX_USER_Q) / 2 + MAX_USER_Q) /* default
+						(should correspond to nice 0) */
+#define MIN_USER_Q	  (NR_SCHED_QUEUES - 1)	/* minimum priority for user
+						   processes */
+/* default scheduling quanta */
+#define USER_QUANTUM 200
+
+/* defualt user process cpu */
+#define USER_DEFAULT_CPU	-1 /* use the default cpu or do not change the
+				      current one */
+
+/*===========================================================================*
+ *	There are no user-settable parameters after this line		     *
+ *===========================================================================*/
+/* Set the FP_FORMAT type based on the machine selected, either hw or sw    */
+#define FP_NONE	 _FP_NONE	/* no floating point support                */
+#define FP_IEEE	 _FP_IEEE	/* conform IEEE floating point standard     */
+
+/* _MINIX_FP_FORMAT is defined in sys_config.h. */
+#define FP_FORMAT	_MINIX_FP_FORMAT
+
+/* _ASKDEV and _FASTLOAD are defined in sys_config.h. */
+#define ASKDEV _ASKDEV
+#define FASTLOAD _FASTLOAD
+
+/* Enable or disable system profiling. */
+#define SPROFILE          0    /* statistical profiling */
+
+/* PCI configuration parameters */
+#define NR_PCIBUS 40
+#define NR_PCIDEV 50
+
+/* Network device driver protocol parameters. */
+#define NDEV_NAME_MAX	16	/* max network driver name length (incl nul) */
+#define NDEV_HWADDR_MAX	6	/* max network hardware address length */
+#define NDEV_IOV_MAX	8	/* max number of elements in I/O vector */
+
+#endif /* _CONFIG_H */

Property changes on: lab4/.minix-src/include/minix/config.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/container.h
===================================================================
--- lab4/.minix-src/include/lzma/container.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/container.h	(revision 13)
@@ -0,0 +1,619 @@
+/**
+ * \file        lzma/container.h
+ * \brief       File formats
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/************
+ * Encoding *
+ ************/
+
+/**
+ * \brief       Default compression preset
+ *
+ * It's not straightforward to recommend a default preset, because in some
+ * cases keeping the resource usage relatively low is more important that
+ * getting the maximum compression ratio.
+ */
+#define LZMA_PRESET_DEFAULT     UINT32_C(6)
+
+
+/**
+ * \brief       Mask for preset level
+ *
+ * This is useful only if you need to extract the level from the preset
+ * variable. That should be rare.
+ */
+#define LZMA_PRESET_LEVEL_MASK  UINT32_C(0x1F)
+
+
+/*
+ * Preset flags
+ *
+ * Currently only one flag is defined.
+ */
+
+/**
+ * \brief       Extreme compression preset
+ *
+ * This flag modifies the preset to make the encoding significantly slower
+ * while improving the compression ratio only marginally. This is useful
+ * when you don't mind wasting time to get as small result as possible.
+ *
+ * This flag doesn't affect the memory usage requirements of the decoder (at
+ * least not significantly). The memory usage of the encoder may be increased
+ * a little but only at the lowest preset levels (0-3).
+ */
+#define LZMA_PRESET_EXTREME       (UINT32_C(1) << 31)
+
+
+/**
+ * \brief       Multithreading options
+ */
+typedef struct {
+	/**
+	 * \brief       Flags
+	 *
+	 * Set this to zero if no flags are wanted.
+	 *
+	 * No flags are currently supported.
+	 */
+	uint32_t flags;
+
+	/**
+	 * \brief       Number of worker threads to use
+	 */
+	uint32_t threads;
+
+	/**
+	 * \brief       Maximum uncompressed size of a Block
+	 *
+	 * The encoder will start a new .xz Block every block_size bytes.
+	 * Using LZMA_FULL_FLUSH or LZMA_FULL_BARRIER with lzma_code()
+	 * the caller may tell liblzma to start a new Block earlier.
+	 *
+	 * With LZMA2, a recommended block size is 2-4 times the LZMA2
+	 * dictionary size. With very small dictionaries, it is recommended
+	 * to use at least 1 MiB block size for good compression ratio, even
+	 * if this is more than four times the dictionary size. Note that
+	 * these are only recommendations for typical use cases; feel free
+	 * to use other values. Just keep in mind that using a block size
+	 * less than the LZMA2 dictionary size is waste of RAM.
+	 *
+	 * Set this to 0 to let liblzma choose the block size depending
+	 * on the compression options. For LZMA2 it will be 3*dict_size
+	 * or 1 MiB, whichever is more.
+	 *
+	 * For each thread, about 3 * block_size bytes of memory will be
+	 * allocated. This may change in later liblzma versions. If so,
+	 * the memory usage will probably be reduced, not increased.
+	 */
+	uint64_t block_size;
+
+	/**
+	 * \brief       Timeout to allow lzma_code() to return early
+	 *
+	 * Multithreading can make liblzma to consume input and produce
+	 * output in a very bursty way: it may first read a lot of input
+	 * to fill internal buffers, then no input or output occurs for
+	 * a while.
+	 *
+	 * In single-threaded mode, lzma_code() won't return until it has
+	 * either consumed all the input or filled the output buffer. If
+	 * this is done in multithreaded mode, it may cause a call
+	 * lzma_code() to take even tens of seconds, which isn't acceptable
+	 * in all applications.
+	 *
+	 * To avoid very long blocking times in lzma_code(), a timeout
+	 * (in milliseconds) may be set here. If lzma_code() would block
+	 * longer than this number of milliseconds, it will return with
+	 * LZMA_OK. Reasonable values are 100 ms or more. The xz command
+	 * line tool uses 300 ms.
+	 *
+	 * If long blocking times are fine for you, set timeout to a special
+	 * value of 0, which will disable the timeout mechanism and will make
+	 * lzma_code() block until all the input is consumed or the output
+	 * buffer has been filled.
+	 *
+	 * \note        Even with a timeout, lzma_code() might sometimes take
+	 *              somewhat long time to return. No timing guarantees
+	 *              are made.
+	 */
+	uint32_t timeout;
+
+	/**
+	 * \brief       Compression preset (level and possible flags)
+	 *
+	 * The preset is set just like with lzma_easy_encoder().
+	 * The preset is ignored if filters below is non-NULL.
+	 */
+	uint32_t preset;
+
+	/**
+	 * \brief       Filter chain (alternative to a preset)
+	 *
+	 * If this is NULL, the preset above is used. Otherwise the preset
+	 * is ignored and the filter chain specified here is used.
+	 */
+	const lzma_filter *filters;
+
+	/**
+	 * \brief       Integrity check type
+	 *
+	 * See check.h for available checks. The xz command line tool
+	 * defaults to LZMA_CHECK_CRC64, which is a good choice if you
+	 * are unsure.
+	 */
+	lzma_check check;
+
+	/*
+	 * Reserved space to allow possible future extensions without
+	 * breaking the ABI. You should not touch these, because the names
+	 * of these variables may change. These are and will never be used
+	 * with the currently supported options, so it is safe to leave these
+	 * uninitialized.
+	 */
+	lzma_reserved_enum reserved_enum1;
+	lzma_reserved_enum reserved_enum2;
+	lzma_reserved_enum reserved_enum3;
+	uint32_t reserved_int1;
+	uint32_t reserved_int2;
+	uint32_t reserved_int3;
+	uint32_t reserved_int4;
+	uint64_t reserved_int5;
+	uint64_t reserved_int6;
+	uint64_t reserved_int7;
+	uint64_t reserved_int8;
+	void *reserved_ptr1;
+	void *reserved_ptr2;
+	void *reserved_ptr3;
+	void *reserved_ptr4;
+
+} lzma_mt;
+
+
+/**
+ * \brief       Calculate approximate memory usage of easy encoder
+ *
+ * This function is a wrapper for lzma_raw_encoder_memusage().
+ *
+ * \param       preset  Compression preset (level and possible flags)
+ *
+ * \return      Number of bytes of memory required for the given
+ *              preset when encoding. If an error occurs, for example
+ *              due to unsupported preset, UINT64_MAX is returned.
+ */
+extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Calculate approximate decoder memory usage of a preset
+ *
+ * This function is a wrapper for lzma_raw_decoder_memusage().
+ *
+ * \param       preset  Compression preset (level and possible flags)
+ *
+ * \return      Number of bytes of memory required to decompress a file
+ *              that was compressed using the given preset. If an error
+ *              occurs, for example due to unsupported preset, UINT64_MAX
+ *              is returned.
+ */
+extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Initialize .xz Stream encoder using a preset number
+ *
+ * This function is intended for those who just want to use the basic features
+ * if liblzma (that is, most developers out there).
+ *
+ * \param       strm    Pointer to lzma_stream that is at least initialized
+ *                      with LZMA_STREAM_INIT.
+ * \param       preset  Compression preset to use. A preset consist of level
+ *                      number and zero or more flags. Usually flags aren't
+ *                      used, so preset is simply a number [0, 9] which match
+ *                      the options -0 ... -9 of the xz command line tool.
+ *                      Additional flags can be be set using bitwise-or with
+ *                      the preset level number, e.g. 6 | LZMA_PRESET_EXTREME.
+ * \param       check   Integrity check type to use. See check.h for available
+ *                      checks. The xz command line tool defaults to
+ *                      LZMA_CHECK_CRC64, which is a good choice if you are
+ *                      unsure. LZMA_CHECK_CRC32 is good too as long as the
+ *                      uncompressed file is not many gigabytes.
+ *
+ * \return      - LZMA_OK: Initialization succeeded. Use lzma_code() to
+ *                encode your data.
+ *              - LZMA_MEM_ERROR: Memory allocation failed.
+ *              - LZMA_OPTIONS_ERROR: The given compression preset is not
+ *                supported by this build of liblzma.
+ *              - LZMA_UNSUPPORTED_CHECK: The given check type is not
+ *                supported by this liblzma build.
+ *              - LZMA_PROG_ERROR: One or more of the parameters have values
+ *                that will never be valid. For example, strm == NULL.
+ *
+ * If initialization fails (return value is not LZMA_OK), all the memory
+ * allocated for *strm by liblzma is always freed. Thus, there is no need
+ * to call lzma_end() after failed initialization.
+ *
+ * If initialization succeeds, use lzma_code() to do the actual encoding.
+ * Valid values for `action' (the second argument of lzma_code()) are
+ * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future,
+ * there may be compression levels or flags that don't support LZMA_SYNC_FLUSH.
+ */
+extern LZMA_API(lzma_ret) lzma_easy_encoder(
+		lzma_stream *strm, uint32_t preset, lzma_check check)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Single-call .xz Stream encoding using a preset number
+ *
+ * The maximum required output buffer size can be calculated with
+ * lzma_stream_buffer_bound().
+ *
+ * \param       preset      Compression preset to use. See the description
+ *                          in lzma_easy_encoder().
+ * \param       check       Type of the integrity check to calculate from
+ *                          uncompressed data.
+ * \param       allocator   lzma_allocator for custom allocator functions.
+ *                          Set to NULL to use malloc() and free().
+ * \param       in          Beginning of the input buffer
+ * \param       in_size     Size of the input buffer
+ * \param       out         Beginning of the output buffer
+ * \param       out_pos     The next byte will be written to out[*out_pos].
+ *                          *out_pos is updated only if encoding succeeds.
+ * \param       out_size    Size of the out buffer; the first byte into
+ *                          which no data is written to is out[out_size].
+ *
+ * \return      - LZMA_OK: Encoding was successful.
+ *              - LZMA_BUF_ERROR: Not enough output buffer space.
+ *              - LZMA_UNSUPPORTED_CHECK
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_DATA_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_easy_buffer_encode(
+		uint32_t preset, lzma_check check,
+		const lzma_allocator *allocator,
+		const uint8_t *in, size_t in_size,
+		uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
+
+
+/**
+ * \brief       Initialize .xz Stream encoder using a custom filter chain
+ *
+ * \param       strm    Pointer to properly prepared lzma_stream
+ * \param       filters Array of filters. This must be terminated with
+ *                      filters[n].id = LZMA_VLI_UNKNOWN. See filter.h for
+ *                      more information.
+ * \param       check   Type of the integrity check to calculate from
+ *                      uncompressed data.
+ *
+ * \return      - LZMA_OK: Initialization was successful.
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_UNSUPPORTED_CHECK
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm,
+		const lzma_filter *filters, lzma_check check)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Calculate approximate memory usage of multithreaded .xz encoder
+ *
+ * Since doing the encoding in threaded mode doesn't affect the memory
+ * requirements of single-threaded decompressor, you can use
+ * lzma_easy_decoder_memusage(options->preset) or
+ * lzma_raw_decoder_memusage(options->filters) to calculate
+ * the decompressor memory requirements.
+ *
+ * \param       options Compression options
+ *
+ * \return      Number of bytes of memory required for encoding with the
+ *              given options. If an error occurs, for example due to
+ *              unsupported preset or filter chain, UINT64_MAX is returned.
+ */
+extern LZMA_API(uint64_t) lzma_stream_encoder_mt_memusage(
+		const lzma_mt *options) lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Initialize multithreaded .xz Stream encoder
+ *
+ * This provides the functionality of lzma_easy_encoder() and
+ * lzma_stream_encoder() as a single function for multithreaded use.
+ *
+ * The supported actions for lzma_code() are LZMA_RUN, LZMA_FULL_FLUSH,
+ * LZMA_FULL_BARRIER, and LZMA_FINISH. Support for LZMA_SYNC_FLUSH might be
+ * added in the future.
+ *
+ * \param       strm    Pointer to properly prepared lzma_stream
+ * \param       options Pointer to multithreaded compression options
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_UNSUPPORTED_CHECK
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_stream_encoder_mt(
+		lzma_stream *strm, const lzma_mt *options)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Initialize .lzma encoder (legacy file format)
+ *
+ * The .lzma format is sometimes called the LZMA_Alone format, which is the
+ * reason for the name of this function. The .lzma format supports only the
+ * LZMA1 filter. There is no support for integrity checks like CRC32.
+ *
+ * Use this function if and only if you need to create files readable by
+ * legacy LZMA tools such as LZMA Utils 4.32.x. Moving to the .xz format
+ * is strongly recommended.
+ *
+ * The valid action values for lzma_code() are LZMA_RUN and LZMA_FINISH.
+ * No kind of flushing is supported, because the file format doesn't make
+ * it possible.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_alone_encoder(
+		lzma_stream *strm, const lzma_options_lzma *options)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Calculate output buffer size for single-call Stream encoder
+ *
+ * When trying to compress uncompressible data, the encoded size will be
+ * slightly bigger than the input data. This function calculates how much
+ * output buffer space is required to be sure that lzma_stream_buffer_encode()
+ * doesn't return LZMA_BUF_ERROR.
+ *
+ * The calculated value is not exact, but it is guaranteed to be big enough.
+ * The actual maximum output space required may be slightly smaller (up to
+ * about 100 bytes). This should not be a problem in practice.
+ *
+ * If the calculated maximum size doesn't fit into size_t or would make the
+ * Stream grow past LZMA_VLI_MAX (which should never happen in practice),
+ * zero is returned to indicate the error.
+ *
+ * \note        The limit calculated by this function applies only to
+ *              single-call encoding. Multi-call encoding may (and probably
+ *              will) have larger maximum expansion when encoding
+ *              uncompressible data. Currently there is no function to
+ *              calculate the maximum expansion of multi-call encoding.
+ */
+extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size)
+		lzma_nothrow;
+
+
+/**
+ * \brief       Single-call .xz Stream encoder
+ *
+ * \param       filters     Array of filters. This must be terminated with
+ *                          filters[n].id = LZMA_VLI_UNKNOWN. See filter.h
+ *                          for more information.
+ * \param       check       Type of the integrity check to calculate from
+ *                          uncompressed data.
+ * \param       allocator   lzma_allocator for custom allocator functions.
+ *                          Set to NULL to use malloc() and free().
+ * \param       in          Beginning of the input buffer
+ * \param       in_size     Size of the input buffer
+ * \param       out         Beginning of the output buffer
+ * \param       out_pos     The next byte will be written to out[*out_pos].
+ *                          *out_pos is updated only if encoding succeeds.
+ * \param       out_size    Size of the out buffer; the first byte into
+ *                          which no data is written to is out[out_size].
+ *
+ * \return      - LZMA_OK: Encoding was successful.
+ *              - LZMA_BUF_ERROR: Not enough output buffer space.
+ *              - LZMA_UNSUPPORTED_CHECK
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_DATA_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
+		lzma_filter *filters, lzma_check check,
+		const lzma_allocator *allocator,
+		const uint8_t *in, size_t in_size,
+		uint8_t *out, size_t *out_pos, size_t out_size)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/************
+ * Decoding *
+ ************/
+
+/**
+ * This flag makes lzma_code() return LZMA_NO_CHECK if the input stream
+ * being decoded has no integrity check. Note that when used with
+ * lzma_auto_decoder(), all .lzma files will trigger LZMA_NO_CHECK
+ * if LZMA_TELL_NO_CHECK is used.
+ */
+#define LZMA_TELL_NO_CHECK              UINT32_C(0x01)
+
+
+/**
+ * This flag makes lzma_code() return LZMA_UNSUPPORTED_CHECK if the input
+ * stream has an integrity check, but the type of the integrity check is not
+ * supported by this liblzma version or build. Such files can still be
+ * decoded, but the integrity check cannot be verified.
+ */
+#define LZMA_TELL_UNSUPPORTED_CHECK     UINT32_C(0x02)
+
+
+/**
+ * This flag makes lzma_code() return LZMA_GET_CHECK as soon as the type
+ * of the integrity check is known. The type can then be got with
+ * lzma_get_check().
+ */
+#define LZMA_TELL_ANY_CHECK             UINT32_C(0x04)
+
+
+/**
+ * This flag makes lzma_code() not calculate and verify the integrity check
+ * of the compressed data in .xz files. This means that invalid integrity
+ * check values won't be detected and LZMA_DATA_ERROR won't be returned in
+ * such cases.
+ *
+ * This flag only affects the checks of the compressed data itself; the CRC32
+ * values in the .xz headers will still be verified normally.
+ *
+ * Don't use this flag unless you know what you are doing. Possible reasons
+ * to use this flag:
+ *
+ *   - Trying to recover data from a corrupt .xz file.
+ *
+ *   - Speeding up decompression, which matters mostly with SHA-256
+ *     or with files that have compressed extremely well. It's recommended
+ *     to not use this flag for this purpose unless the file integrity is
+ *     verified externally in some other way.
+ *
+ * Support for this flag was added in liblzma 5.1.4beta.
+ */
+#define LZMA_IGNORE_CHECK               UINT32_C(0x10)
+
+
+/**
+ * This flag enables decoding of concatenated files with file formats that
+ * allow concatenating compressed files as is. From the formats currently
+ * supported by liblzma, only the .xz format allows concatenated files.
+ * Concatenated files are not allowed with the legacy .lzma format.
+ *
+ * This flag also affects the usage of the `action' argument for lzma_code().
+ * When LZMA_CONCATENATED is used, lzma_code() won't return LZMA_STREAM_END
+ * unless LZMA_FINISH is used as `action'. Thus, the application has to set
+ * LZMA_FINISH in the same way as it does when encoding.
+ *
+ * If LZMA_CONCATENATED is not used, the decoders still accept LZMA_FINISH
+ * as `action' for lzma_code(), but the usage of LZMA_FINISH isn't required.
+ */
+#define LZMA_CONCATENATED               UINT32_C(0x08)
+
+
+/**
+ * \brief       Initialize .xz Stream decoder
+ *
+ * \param       strm        Pointer to properly prepared lzma_stream
+ * \param       memlimit    Memory usage limit as bytes. Use UINT64_MAX
+ *                          to effectively disable the limiter.
+ * \param       flags       Bitwise-or of zero or more of the decoder flags:
+ *                          LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
+ *                          LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED
+ *
+ * \return      - LZMA_OK: Initialization was successful.
+ *              - LZMA_MEM_ERROR: Cannot allocate memory.
+ *              - LZMA_OPTIONS_ERROR: Unsupported flags
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_stream_decoder(
+		lzma_stream *strm, uint64_t memlimit, uint32_t flags)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Decode .xz Streams and .lzma files with autodetection
+ *
+ * This decoder autodetects between the .xz and .lzma file formats, and
+ * calls lzma_stream_decoder() or lzma_alone_decoder() once the type
+ * of the input file has been detected.
+ *
+ * \param       strm        Pointer to properly prepared lzma_stream
+ * \param       memlimit    Memory usage limit as bytes. Use UINT64_MAX
+ *                          to effectively disable the limiter.
+ * \param       flags       Bitwise-or of flags, or zero for no flags.
+ *
+ * \return      - LZMA_OK: Initialization was successful.
+ *              - LZMA_MEM_ERROR: Cannot allocate memory.
+ *              - LZMA_OPTIONS_ERROR: Unsupported flags
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_auto_decoder(
+		lzma_stream *strm, uint64_t memlimit, uint32_t flags)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Initialize .lzma decoder (legacy file format)
+ *
+ * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
+ * There is no need to use LZMA_FINISH, but allowing it may simplify
+ * certain types of applications.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_alone_decoder(
+		lzma_stream *strm, uint64_t memlimit)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Single-call .xz Stream decoder
+ *
+ * \param       memlimit    Pointer to how much memory the decoder is allowed
+ *                          to allocate. The value pointed by this pointer is
+ *                          modified if and only if LZMA_MEMLIMIT_ERROR is
+ *                          returned.
+ * \param       flags       Bitwise-or of zero or more of the decoder flags:
+ *                          LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
+ *                          LZMA_CONCATENATED. Note that LZMA_TELL_ANY_CHECK
+ *                          is not allowed and will return LZMA_PROG_ERROR.
+ * \param       allocator   lzma_allocator for custom allocator functions.
+ *                          Set to NULL to use malloc() and free().
+ * \param       in          Beginning of the input buffer
+ * \param       in_pos      The next byte will be read from in[*in_pos].
+ *                          *in_pos is updated only if decoding succeeds.
+ * \param       in_size     Size of the input buffer; the first byte that
+ *                          won't be read is in[in_size].
+ * \param       out         Beginning of the output buffer
+ * \param       out_pos     The next byte will be written to out[*out_pos].
+ *                          *out_pos is updated only if decoding succeeds.
+ * \param       out_size    Size of the out buffer; the first byte into
+ *                          which no data is written to is out[out_size].
+ *
+ * \return      - LZMA_OK: Decoding was successful.
+ *              - LZMA_FORMAT_ERROR
+ *              - LZMA_OPTIONS_ERROR
+ *              - LZMA_DATA_ERROR
+ *              - LZMA_NO_CHECK: This can be returned only if using
+ *                the LZMA_TELL_NO_CHECK flag.
+ *              - LZMA_UNSUPPORTED_CHECK: This can be returned only if using
+ *                the LZMA_TELL_UNSUPPORTED_CHECK flag.
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached.
+ *                The minimum required memlimit value was stored to *memlimit.
+ *              - LZMA_BUF_ERROR: Output buffer was too small.
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
+		uint64_t *memlimit, uint32_t flags,
+		const lzma_allocator *allocator,
+		const uint8_t *in, size_t *in_pos, size_t in_size,
+		uint8_t *out, size_t *out_pos, size_t out_size)
+		lzma_nothrow lzma_attr_warn_unused_result;

Property changes on: lab4/.minix-src/include/lzma/container.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/endpoint.h
===================================================================
--- lab4/.minix-src/include/minix/endpoint.h	(nonexistent)
+++ lab4/.minix-src/include/minix/endpoint.h	(revision 13)
@@ -0,0 +1,71 @@
+
+#ifndef _MINIX_ENDPOINT_H
+#define _MINIX_ENDPOINT_H 1
+
+#include <minix/sys_config.h>
+#include <minix/com.h>
+#include <limits.h>
+#include <minix/type.h>
+
+/*
+ * Endpoints are split into two parts: a process slot and a generation number.
+ *
+ * The process slot number identifies the slot in various process tables.
+ * It is positive or zero for user processes, and negative for kernel tasks.
+ * Constants dictate that with the current endpoint layout, the maximum range
+ * of process slot numbers is [-MAX_NR_TASKS,MAX_NR_PROCS>.  The used part of
+ * the range is currently [-NR_TASKS,NR_PROCS> -- these two constants may be
+ * changed within the maximum range without changing the endpoint layout.
+ *
+ * The generation number is a per-slot number that gets increased by one every
+ * time a slot is reused for a new process.  The generation number minimizes
+ * the chance that the endpoint of a dead process can (accidentially) be used
+ * to communicate with a different, live process.  Preventing such accidents
+ * is essential for proper system service restartability support.
+ *
+ * The split between the two parts of the endpoint is such that when the
+ * generation number is zero, the endpoint number equals the process slot
+ * number, even for negative task numbers.  This is required for the endpoint
+ * numbers hardcoded in <minix/com.h>, and it makes endpoint numbers easy to
+ * read in general.
+ *
+ * There are three special endpoint numbers: ANY, NONE, and SELF.  These
+ * numbers are used to identify "any process", "no process at all", and
+ * "own process", respectively.  They fall outside the normal range of
+ * process slot numbers, and are always of generation zero.
+ */
+
+/*
+ * The following constant defines the split between the two parts of the
+ * endpoint numbers.  It can be adjusted to allow for either more processes
+ * or more per-process generation numbers.  Changing it will change the
+ * endpoint number layout, and thus break binary compatibility with existing
+ * processes.
+ */
+#define _ENDPOINT_GENERATION_SHIFT	15
+
+/* Derived constants. */
+#define _ENDPOINT_GENERATION_SIZE	(1 << _ENDPOINT_GENERATION_SHIFT)
+/* INT_MAX is used here to prevent signedness issues with the macros below. */
+#define _ENDPOINT_MAX_GENERATION	(INT_MAX/_ENDPOINT_GENERATION_SIZE-1)
+#define _ENDPOINT_SLOT_TOP	(_ENDPOINT_GENERATION_SIZE-MAX_NR_TASKS)
+
+/* The special endpoint numbers, and the resulting maximum slot number. */
+#define ANY		((endpoint_t) (_ENDPOINT_SLOT_TOP - 1))
+#define NONE		((endpoint_t) (_ENDPOINT_SLOT_TOP - 2))
+#define SELF		((endpoint_t) (_ENDPOINT_SLOT_TOP - 3))
+#define MAX_NR_PROCS		      (_ENDPOINT_SLOT_TOP - 3)	/* (int)SELF */
+
+/* Sanity check. */
+#if NR_PROCS > MAX_NR_PROCS
+#error "NR_PROCS exceeds MAX_NR_PROCS, increase _ENDPOINT_GENERATION_SHIFT"
+#endif
+
+/* Generation + Process slot number <-> endpoint. */
+#define _ENDPOINT(g, p) \
+	((endpoint_t)(((g) << _ENDPOINT_GENERATION_SHIFT) + (p)))
+#define _ENDPOINT_G(e) (((e)+MAX_NR_TASKS) >> _ENDPOINT_GENERATION_SHIFT)
+#define _ENDPOINT_P(e) \
+	((((e)+MAX_NR_TASKS) & (_ENDPOINT_GENERATION_SIZE - 1)) - MAX_NR_TASKS)
+
+#endif

Property changes on: lab4/.minix-src/include/minix/endpoint.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/devio.h
===================================================================
--- lab4/.minix-src/include/minix/devio.h	(nonexistent)
+++ lab4/.minix-src/include/minix/devio.h	(revision 13)
@@ -0,0 +1,68 @@
+/* This file provides basic types and some constants for the 
+ * SYS_DEVIO and SYS_VDEVIO system calls, which allow user-level 
+ * processes to perform device I/O. 
+ *
+ * Created: 
+ *	Apr 08, 2004 by Jorrit N. Herder
+ */
+
+#ifndef _DEVIO_H
+#define _DEVIO_H
+
+#include <minix/sys_config.h>     /* needed to include <minix/type.h> */
+#include <sys/types.h>        /* u8_t, u16_t, u32_t needed */
+
+typedef u16_t port_t;
+
+/* We have different granularities of port I/O: 8, 16, 32 bits.
+ * Also see <ibm/portio.h>, which has functions for bytes, words,  
+ * and longs. Hence, we need different (port,value)-pair types. 
+ */
+typedef struct { u16_t port;  u8_t value; } pvb_pair_t;
+typedef struct { u16_t port; u16_t value; } pvw_pair_t;
+typedef struct { u16_t port; u32_t value; } pvl_pair_t;
+
+/* Macro shorthand to set (port,value)-pair. */
+#define pv_set(pv, p, v) do {					\
+	u32_t _p = (p), _v = (v);				\
+	(pv).port = _p;						\
+	(pv).value = _v;					\
+	if((pv).port != _p || (pv).value != _v) {		\
+		printf("%s:%d: actual port: 0x%x != 0x%x || "	\
+			"actual value: 0x%x != 0x%x\n",	\
+			__FILE__, __LINE__, (pv).port, _p, (pv).value, _v); \
+		panic("pv_set(" #pv ", " #p ", " #v ")"); \
+	}							\
+} while(0)
+
+#if 0	/* no longer in use !!! */
+/* Define a number of flags to indicate granularity we are using. */
+#define MASK_GRANULARITY 0x000F  /* not in use! does not match flags */
+#define PVB_FLAG 'b'
+#define PVW_FLAG 'w'
+#define PVL_FLAG 'l'
+
+/* Flags indicating whether request wants to do input or output. */
+#define MASK_IN_OR_OUT 0x00F0
+#define DEVIO_INPUT 0x0010
+#define DEVIO_OUTPUT 0x0020
+#endif	/* 0 */
+
+#if 0	/* no longer used !!! */
+/* Define how large the (port,value)-pair buffer in the kernel is. 
+ * This buffer is used to copy the (port,value)-pairs in kernel space.
+ */
+#define PV_BUF_SIZE  64      /* creates char pv_buf[PV_BUF_SIZE] */
+
+/* Note that SYS_VDEVIO sends a pointer to a vector of (port,value)-pairs, 
+ * whereas SYS_DEVIO includes a single (port,value)-pair in the messages.
+ * Calculate maximum number of (port,value)-pairs that can be handled 
+ * in a single SYS_VDEVIO system call with above struct definitions. 
+ */
+#define MAX_PVB_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvb_pair_t))
+#define MAX_PVW_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvw_pair_t))
+#define MAX_PVL_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvl_pair_t))
+#endif /* 0 */
+	
+
+#endif  /* _DEVIO_H */

Property changes on: lab4/.minix-src/include/minix/devio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/index.h
===================================================================
--- lab4/.minix-src/include/lzma/index.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/index.h	(revision 13)
@@ -0,0 +1,682 @@
+/**
+ * \file        lzma/index.h
+ * \brief       Handling of .xz Index and related information
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/**
+ * \brief       Opaque data type to hold the Index(es) and other information
+ *
+ * lzma_index often holds just one .xz Index and possibly the Stream Flags
+ * of the same Stream and size of the Stream Padding field. However,
+ * multiple lzma_indexes can be concatenated with lzma_index_cat() and then
+ * there may be information about multiple Streams in the same lzma_index.
+ *
+ * Notes about thread safety: Only one thread may modify lzma_index at
+ * a time. All functions that take non-const pointer to lzma_index
+ * modify it. As long as no thread is modifying the lzma_index, getting
+ * information from the same lzma_index can be done from multiple threads
+ * at the same time with functions that take a const pointer to
+ * lzma_index or use lzma_index_iter. The same iterator must be used
+ * only by one thread at a time, of course, but there can be as many
+ * iterators for the same lzma_index as needed.
+ */
+typedef struct lzma_index_s lzma_index;
+
+
+/**
+ * \brief       Iterator to get information about Blocks and Streams
+ */
+typedef struct {
+	struct {
+		/**
+		 * \brief       Pointer to Stream Flags
+		 *
+		 * This is NULL if Stream Flags have not been set for
+		 * this Stream with lzma_index_stream_flags().
+		 */
+		const lzma_stream_flags *flags;
+
+		const void *reserved_ptr1;
+		const void *reserved_ptr2;
+		const void *reserved_ptr3;
+
+		/**
+		 * \brief       Stream number in the lzma_index
+		 *
+		 * The first Stream is 1.
+		 */
+		lzma_vli number;
+
+		/**
+		 * \brief       Number of Blocks in the Stream
+		 *
+		 * If this is zero, the block structure below has
+		 * undefined values.
+		 */
+		lzma_vli block_count;
+
+		/**
+		 * \brief       Compressed start offset of this Stream
+		 *
+		 * The offset is relative to the beginning of the lzma_index
+		 * (i.e. usually the beginning of the .xz file).
+		 */
+		lzma_vli compressed_offset;
+
+		/**
+		 * \brief       Uncompressed start offset of this Stream
+		 *
+		 * The offset is relative to the beginning of the lzma_index
+		 * (i.e. usually the beginning of the .xz file).
+		 */
+		lzma_vli uncompressed_offset;
+
+		/**
+		 * \brief       Compressed size of this Stream
+		 *
+		 * This includes all headers except the possible
+		 * Stream Padding after this Stream.
+		 */
+		lzma_vli compressed_size;
+
+		/**
+		 * \brief       Uncompressed size of this Stream
+		 */
+		lzma_vli uncompressed_size;
+
+		/**
+		 * \brief       Size of Stream Padding after this Stream
+		 *
+		 * If it hasn't been set with lzma_index_stream_padding(),
+		 * this defaults to zero. Stream Padding is always
+		 * a multiple of four bytes.
+		 */
+		lzma_vli padding;
+
+		lzma_vli reserved_vli1;
+		lzma_vli reserved_vli2;
+		lzma_vli reserved_vli3;
+		lzma_vli reserved_vli4;
+	} stream;
+
+	struct {
+		/**
+		 * \brief       Block number in the file
+		 *
+		 * The first Block is 1.
+		 */
+		lzma_vli number_in_file;
+
+		/**
+		 * \brief       Compressed start offset of this Block
+		 *
+		 * This offset is relative to the beginning of the
+		 * lzma_index (i.e. usually the beginning of the .xz file).
+		 * Normally this is where you should seek in the .xz file
+		 * to start decompressing this Block.
+		 */
+		lzma_vli compressed_file_offset;
+
+		/**
+		 * \brief       Uncompressed start offset of this Block
+		 *
+		 * This offset is relative to the beginning of the lzma_index
+		 * (i.e. usually the beginning of the .xz file).
+		 *
+		 * When doing random-access reading, it is possible that
+		 * the target offset is not exactly at Block boundary. One
+		 * will need to compare the target offset against
+		 * uncompressed_file_offset or uncompressed_stream_offset,
+		 * and possibly decode and throw away some amount of data
+		 * before reaching the target offset.
+		 */
+		lzma_vli uncompressed_file_offset;
+
+		/**
+		 * \brief       Block number in this Stream
+		 *
+		 * The first Block is 1.
+		 */
+		lzma_vli number_in_stream;
+
+		/**
+		 * \brief       Compressed start offset of this Block
+		 *
+		 * This offset is relative to the beginning of the Stream
+		 * containing this Block.
+		 */
+		lzma_vli compressed_stream_offset;
+
+		/**
+		 * \brief       Uncompressed start offset of this Block
+		 *
+		 * This offset is relative to the beginning of the Stream
+		 * containing this Block.
+		 */
+		lzma_vli uncompressed_stream_offset;
+
+		/**
+		 * \brief       Uncompressed size of this Block
+		 *
+		 * You should pass this to the Block decoder if you will
+		 * decode this Block. It will allow the Block decoder to
+		 * validate the uncompressed size.
+		 */
+		lzma_vli uncompressed_size;
+
+		/**
+		 * \brief       Unpadded size of this Block
+		 *
+		 * You should pass this to the Block decoder if you will
+		 * decode this Block. It will allow the Block decoder to
+		 * validate the unpadded size.
+		 */
+		lzma_vli unpadded_size;
+
+		/**
+		 * \brief       Total compressed size
+		 *
+		 * This includes all headers and padding in this Block.
+		 * This is useful if you need to know how many bytes
+		 * the Block decoder will actually read.
+		 */
+		lzma_vli total_size;
+
+		lzma_vli reserved_vli1;
+		lzma_vli reserved_vli2;
+		lzma_vli reserved_vli3;
+		lzma_vli reserved_vli4;
+
+		const void *reserved_ptr1;
+		const void *reserved_ptr2;
+		const void *reserved_ptr3;
+		const void *reserved_ptr4;
+	} block;
+
+	/*
+	 * Internal data which is used to store the state of the iterator.
+	 * The exact format may vary between liblzma versions, so don't
+	 * touch these in any way.
+	 */
+	union {
+		const void *p;
+		size_t s;
+		lzma_vli v;
+	} internal[6];
+} lzma_index_iter;
+
+
+/**
+ * \brief       Operation mode for lzma_index_iter_next()
+ */
+typedef enum {
+	LZMA_INDEX_ITER_ANY             = 0,
+		/**<
+		 * \brief       Get the next Block or Stream
+		 *
+		 * Go to the next Block if the current Stream has at least
+		 * one Block left. Otherwise go to the next Stream even if
+		 * it has no Blocks. If the Stream has no Blocks
+		 * (lzma_index_iter.stream.block_count == 0),
+		 * lzma_index_iter.block will have undefined values.
+		 */
+
+	LZMA_INDEX_ITER_STREAM          = 1,
+		/**<
+		 * \brief       Get the next Stream
+		 *
+		 * Go to the next Stream even if the current Stream has
+		 * unread Blocks left. If the next Stream has at least one
+		 * Block, the iterator will point to the first Block.
+		 * If there are no Blocks, lzma_index_iter.block will have
+		 * undefined values.
+		 */
+
+	LZMA_INDEX_ITER_BLOCK           = 2,
+		/**<
+		 * \brief       Get the next Block
+		 *
+		 * Go to the next Block if the current Stream has at least
+		 * one Block left. If the current Stream has no Blocks left,
+		 * the next Stream with at least one Block is located and
+		 * the iterator will be made to point to the first Block of
+		 * that Stream.
+		 */
+
+	LZMA_INDEX_ITER_NONEMPTY_BLOCK  = 3
+		/**<
+		 * \brief       Get the next non-empty Block
+		 *
+		 * This is like LZMA_INDEX_ITER_BLOCK except that it will
+		 * skip Blocks whose Uncompressed Size is zero.
+		 */
+
+} lzma_index_iter_mode;
+
+
+/**
+ * \brief       Calculate memory usage of lzma_index
+ *
+ * On disk, the size of the Index field depends on both the number of Records
+ * stored and how big values the Records store (due to variable-length integer
+ * encoding). When the Index is kept in lzma_index structure, the memory usage
+ * depends only on the number of Records/Blocks stored in the Index(es), and
+ * in case of concatenated lzma_indexes, the number of Streams. The size in
+ * RAM is almost always significantly bigger than in the encoded form on disk.
+ *
+ * This function calculates an approximate amount of memory needed hold
+ * the given number of Streams and Blocks in lzma_index structure. This
+ * value may vary between CPU architectures and also between liblzma versions
+ * if the internal implementation is modified.
+ */
+extern LZMA_API(uint64_t) lzma_index_memusage(
+		lzma_vli streams, lzma_vli blocks) lzma_nothrow;
+
+
+/**
+ * \brief       Calculate the memory usage of an existing lzma_index
+ *
+ * This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i),
+ * lzma_index_block_count(i)).
+ */
+extern LZMA_API(uint64_t) lzma_index_memused(const lzma_index *i)
+		lzma_nothrow;
+
+
+/**
+ * \brief       Allocate and initialize a new lzma_index structure
+ *
+ * \return      On success, a pointer to an empty initialized lzma_index is
+ *              returned. If allocation fails, NULL is returned.
+ */
+extern LZMA_API(lzma_index *) lzma_index_init(const lzma_allocator *allocator)
+		lzma_nothrow;
+
+
+/**
+ * \brief       Deallocate lzma_index
+ *
+ * If i is NULL, this does nothing.
+ */
+extern LZMA_API(void) lzma_index_end(
+		lzma_index *i, const lzma_allocator *allocator) lzma_nothrow;
+
+
+/**
+ * \brief       Add a new Block to lzma_index
+ *
+ * \param       i                 Pointer to a lzma_index structure
+ * \param       allocator         Pointer to lzma_allocator, or NULL to
+ *                                use malloc()
+ * \param       unpadded_size     Unpadded Size of a Block. This can be
+ *                                calculated with lzma_block_unpadded_size()
+ *                                after encoding or decoding the Block.
+ * \param       uncompressed_size Uncompressed Size of a Block. This can be
+ *                                taken directly from lzma_block structure
+ *                                after encoding or decoding the Block.
+ *
+ * Appending a new Block does not invalidate iterators. For example,
+ * if an iterator was pointing to the end of the lzma_index, after
+ * lzma_index_append() it is possible to read the next Block with
+ * an existing iterator.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_DATA_ERROR: Compressed or uncompressed size of the
+ *                Stream or size of the Index field would grow too big.
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_index_append(
+		lzma_index *i, const lzma_allocator *allocator,
+		lzma_vli unpadded_size, lzma_vli uncompressed_size)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Set the Stream Flags
+ *
+ * Set the Stream Flags of the last (and typically the only) Stream
+ * in lzma_index. This can be useful when reading information from the
+ * lzma_index, because to decode Blocks, knowing the integrity check type
+ * is needed.
+ *
+ * The given Stream Flags are copied into internal preallocated structure
+ * in the lzma_index, thus the caller doesn't need to keep the *stream_flags
+ * available after calling this function.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_OPTIONS_ERROR: Unsupported stream_flags->version.
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_index_stream_flags(
+		lzma_index *i, const lzma_stream_flags *stream_flags)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Get the types of integrity Checks
+ *
+ * If lzma_index_stream_flags() is used to set the Stream Flags for
+ * every Stream, lzma_index_checks() can be used to get a bitmask to
+ * indicate which Check types have been used. It can be useful e.g. if
+ * showing the Check types to the user.
+ *
+ * The bitmask is 1 << check_id, e.g. CRC32 is 1 << 1 and SHA-256 is 1 << 10.
+ */
+extern LZMA_API(uint32_t) lzma_index_checks(const lzma_index *i)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Set the amount of Stream Padding
+ *
+ * Set the amount of Stream Padding of the last (and typically the only)
+ * Stream in the lzma_index. This is needed when planning to do random-access
+ * reading within multiple concatenated Streams.
+ *
+ * By default, the amount of Stream Padding is assumed to be zero bytes.
+ *
+ * \return      - LZMA_OK
+ *              - LZMA_DATA_ERROR: The file size would grow too big.
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_index_stream_padding(
+		lzma_index *i, lzma_vli stream_padding)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Get the number of Streams
+ */
+extern LZMA_API(lzma_vli) lzma_index_stream_count(const lzma_index *i)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Get the number of Blocks
+ *
+ * This returns the total number of Blocks in lzma_index. To get number
+ * of Blocks in individual Streams, use lzma_index_iter.
+ */
+extern LZMA_API(lzma_vli) lzma_index_block_count(const lzma_index *i)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Get the size of the Index field as bytes
+ *
+ * This is needed to verify the Backward Size field in the Stream Footer.
+ */
+extern LZMA_API(lzma_vli) lzma_index_size(const lzma_index *i)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Get the total size of the Stream
+ *
+ * If multiple lzma_indexes have been combined, this works as if the Blocks
+ * were in a single Stream. This is useful if you are going to combine
+ * Blocks from multiple Streams into a single new Stream.
+ */
+extern LZMA_API(lzma_vli) lzma_index_stream_size(const lzma_index *i)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Get the total size of the Blocks
+ *
+ * This doesn't include the Stream Header, Stream Footer, Stream Padding,
+ * or Index fields.
+ */
+extern LZMA_API(lzma_vli) lzma_index_total_size(const lzma_index *i)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Get the total size of the file
+ *
+ * When no lzma_indexes have been combined with lzma_index_cat() and there is
+ * no Stream Padding, this function is identical to lzma_index_stream_size().
+ * If multiple lzma_indexes have been combined, this includes also the headers
+ * of each separate Stream and the possible Stream Padding fields.
+ */
+extern LZMA_API(lzma_vli) lzma_index_file_size(const lzma_index *i)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Get the uncompressed size of the file
+ */
+extern LZMA_API(lzma_vli) lzma_index_uncompressed_size(const lzma_index *i)
+		lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief       Initialize an iterator
+ *
+ * \param       iter    Pointer to a lzma_index_iter structure
+ * \param       i       lzma_index to which the iterator will be associated
+ *
+ * This function associates the iterator with the given lzma_index, and calls
+ * lzma_index_iter_rewind() on the iterator.
+ *
+ * This function doesn't allocate any memory, thus there is no
+ * lzma_index_iter_end(). The iterator is valid as long as the
+ * associated lzma_index is valid, that is, until lzma_index_end() or
+ * using it as source in lzma_index_cat(). Specifically, lzma_index doesn't
+ * become invalid if new Blocks are added to it with lzma_index_append() or
+ * if it is used as the destination in lzma_index_cat().
+ *
+ * It is safe to make copies of an initialized lzma_index_iter, for example,
+ * to easily restart reading at some particular position.
+ */
+extern LZMA_API(void) lzma_index_iter_init(
+		lzma_index_iter *iter, const lzma_index *i) lzma_nothrow;
+
+
+/**
+ * \brief       Rewind the iterator
+ *
+ * Rewind the iterator so that next call to lzma_index_iter_next() will
+ * return the first Block or Stream.
+ */
+extern LZMA_API(void) lzma_index_iter_rewind(lzma_index_iter *iter)
+		lzma_nothrow;
+
+
+/**
+ * \brief       Get the next Block or Stream
+ *
+ * \param       iter    Iterator initialized with lzma_index_iter_init()
+ * \param       mode    Specify what kind of information the caller wants
+ *                      to get. See lzma_index_iter_mode for details.
+ *
+ * \return      If next Block or Stream matching the mode was found, *iter
+ *              is updated and this function returns false. If no Block or
+ *              Stream matching the mode is found, *iter is not modified
+ *              and this function returns true. If mode is set to an unknown
+ *              value, *iter is not modified and this function returns true.
+ */
+extern LZMA_API(lzma_bool) lzma_index_iter_next(
+		lzma_index_iter *iter, lzma_index_iter_mode mode)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Locate a Block
+ *
+ * If it is possible to seek in the .xz file, it is possible to parse
+ * the Index field(s) and use lzma_index_iter_locate() to do random-access
+ * reading with granularity of Block size.
+ *
+ * \param       iter    Iterator that was earlier initialized with
+ *                      lzma_index_iter_init().
+ * \param       target  Uncompressed target offset which the caller would
+ *                      like to locate from the Stream
+ *
+ * If the target is smaller than the uncompressed size of the Stream (can be
+ * checked with lzma_index_uncompressed_size()):
+ *  - Information about the Stream and Block containing the requested
+ *    uncompressed offset is stored into *iter.
+ *  - Internal state of the iterator is adjusted so that
+ *    lzma_index_iter_next() can be used to read subsequent Blocks or Streams.
+ *  - This function returns false.
+ *
+ * If target is greater than the uncompressed size of the Stream, *iter
+ * is not modified, and this function returns true.
+ */
+extern LZMA_API(lzma_bool) lzma_index_iter_locate(
+		lzma_index_iter *iter, lzma_vli target) lzma_nothrow;
+
+
+/**
+ * \brief       Concatenate lzma_indexes
+ *
+ * Concatenating lzma_indexes is useful when doing random-access reading in
+ * multi-Stream .xz file, or when combining multiple Streams into single
+ * Stream.
+ *
+ * \param       dest      lzma_index after which src is appended
+ * \param       src       lzma_index to be appended after dest. If this
+ *                        function succeeds, the memory allocated for src
+ *                        is freed or moved to be part of dest, and all
+ *                        iterators pointing to src will become invalid.
+ * \param       allocator Custom memory allocator; can be NULL to use
+ *                        malloc() and free().
+ *
+ * \return      - LZMA_OK: lzma_indexes were concatenated successfully.
+ *                src is now a dangling pointer.
+ *              - LZMA_DATA_ERROR: *dest would grow too big.
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_index_cat(lzma_index *dest, lzma_index *src,
+		const lzma_allocator *allocator)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Duplicate lzma_index
+ *
+ * \return      A copy of the lzma_index, or NULL if memory allocation failed.
+ */
+extern LZMA_API(lzma_index *) lzma_index_dup(
+		const lzma_index *i, const lzma_allocator *allocator)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Initialize .xz Index encoder
+ *
+ * \param       strm        Pointer to properly prepared lzma_stream
+ * \param       i           Pointer to lzma_index which should be encoded.
+ *
+ * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
+ * It is enough to use only one of them (you can choose freely; use LZMA_RUN
+ * to support liblzma versions older than 5.0.0).
+ *
+ * \return      - LZMA_OK: Initialization succeeded, continue with lzma_code().
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_index_encoder(
+		lzma_stream *strm, const lzma_index *i)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Initialize .xz Index decoder
+ *
+ * \param       strm        Pointer to properly prepared lzma_stream
+ * \param       i           The decoded Index will be made available via
+ *                          this pointer. Initially this function will
+ *                          set *i to NULL (the old value is ignored). If
+ *                          decoding succeeds (lzma_code() returns
+ *                          LZMA_STREAM_END), *i will be set to point
+ *                          to a new lzma_index, which the application
+ *                          has to later free with lzma_index_end().
+ * \param       memlimit    How much memory the resulting lzma_index is
+ *                          allowed to require.
+ *
+ * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
+ * It is enough to use only one of them (you can choose freely; use LZMA_RUN
+ * to support liblzma versions older than 5.0.0).
+ *
+ * \return      - LZMA_OK: Initialization succeeded, continue with lzma_code().
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_MEMLIMIT_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_index_decoder(
+		lzma_stream *strm, lzma_index **i, uint64_t memlimit)
+		lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief       Single-call .xz Index encoder
+ *
+ * \param       i         lzma_index to be encoded
+ * \param       out       Beginning of the output buffer
+ * \param       out_pos   The next byte will be written to out[*out_pos].
+ *                        *out_pos is updated only if encoding succeeds.
+ * \param       out_size  Size of the out buffer; the first byte into
+ *                        which no data is written to is out[out_size].
+ *
+ * \return      - LZMA_OK: Encoding was successful.
+ *              - LZMA_BUF_ERROR: Output buffer is too small. Use
+ *                lzma_index_size() to find out how much output
+ *                space is needed.
+ *              - LZMA_PROG_ERROR
+ *
+ * \note        This function doesn't take allocator argument since all
+ *              the internal data is allocated on stack.
+ */
+extern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i,
+		uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
+
+
+/**
+ * \brief       Single-call .xz Index decoder
+ *
+ * \param       i           If decoding succeeds, *i will point to a new
+ *                          lzma_index, which the application has to
+ *                          later free with lzma_index_end(). If an error
+ *                          occurs, *i will be NULL. The old value of *i
+ *                          is always ignored and thus doesn't need to be
+ *                          initialized by the caller.
+ * \param       memlimit    Pointer to how much memory the resulting
+ *                          lzma_index is allowed to require. The value
+ *                          pointed by this pointer is modified if and only
+ *                          if LZMA_MEMLIMIT_ERROR is returned.
+ * \param       allocator   Pointer to lzma_allocator, or NULL to use malloc()
+ * \param       in          Beginning of the input buffer
+ * \param       in_pos      The next byte will be read from in[*in_pos].
+ *                          *in_pos is updated only if decoding succeeds.
+ * \param       in_size     Size of the input buffer; the first byte that
+ *                          won't be read is in[in_size].
+ *
+ * \return      - LZMA_OK: Decoding was successful.
+ *              - LZMA_MEM_ERROR
+ *              - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached.
+ *                The minimum required memlimit value was stored to *memlimit.
+ *              - LZMA_DATA_ERROR
+ *              - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i,
+		uint64_t *memlimit, const lzma_allocator *allocator,
+		const uint8_t *in, size_t *in_pos, size_t in_size)
+		lzma_nothrow;

Property changes on: lab4/.minix-src/include/lzma/index.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/gcov.h
===================================================================
--- lab4/.minix-src/include/minix/gcov.h	(nonexistent)
+++ lab4/.minix-src/include/minix/gcov.h	(revision 13)
@@ -0,0 +1,33 @@
+#ifndef _MINIX_GCOV_H
+#define _MINIX_GCOV_H
+
+#include <sys/types.h>
+#include <lib.h>
+#include <stdlib.h>
+#include <minix/syslib.h>
+
+/* opcodes for use in gcov buffer */
+#define GCOVOP_OPEN	23
+#define GCOVOP_WRITE	24
+#define GCOVOP_CLOSE	25
+#define GCOVOP_END	26
+
+/* More information on the GCOV Minix Wiki page. */
+
+int gcov_flush_svr(const char * label, char * buff, size_t buff_sz);
+
+#if _MINIX_SYSTEM
+extern void __gcov_flush(void);
+int do_gcov_flush_impl(message *msg);
+
+FILE *_gcov_fopen(const char *name, const char *mode);
+size_t _gcov_fread(void *ptr, size_t itemsize, size_t nitems,
+	FILE *stream);
+size_t _gcov_fwrite(const void *ptr, size_t itemsize, size_t nitems,
+	FILE *stream);
+int _gcov_fclose(FILE *stream);
+int _gcov_fseek(FILE *stream, long offset, int ptrname);
+char *_gcov_getenv(const char *name);
+#endif /* _MINIX_SYSTEM */
+
+#endif /* !_MINIX_GCOV_H */

Property changes on: lab4/.minix-src/include/minix/gcov.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/hgfs.h
===================================================================
--- lab4/.minix-src/include/minix/hgfs.h	(nonexistent)
+++ lab4/.minix-src/include/minix/hgfs.h	(revision 13)
@@ -0,0 +1,11 @@
+/* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
+
+#ifndef _MINIX_HGFS_H
+#define _MINIX_HGFS_H
+
+#include <minix/sffs.h>
+
+int hgfs_init(const struct sffs_table **tablep);
+void hgfs_cleanup(void);
+
+#endif /* _MINIX_HGFS_H */

Property changes on: lab4/.minix-src/include/minix/hgfs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/drivers.h
===================================================================
--- lab4/.minix-src/include/minix/drivers.h	(nonexistent)
+++ lab4/.minix-src/include/minix/drivers.h	(revision 13)
@@ -0,0 +1,45 @@
+/* This is the master header for all device drivers. It includes some other
+ * files and defines the principal constants.
+ */
+
+#ifndef _INC_DRIVERS_H
+#define _INC_DRIVERS_H
+
+#define _POSIX_SOURCE	1	/* tell headers to include POSIX stuff */
+#define _NETBSD_SOURCE	1	/* tell headers to include MINIX stuff */
+#define _SYSTEM		1	/* get negative error number in <errno.h> */
+
+/* The following are so basic, all the *.c files get them automatically. */
+#include <minix/config.h>	/* MUST be first */
+#include <minix/bitmap.h>
+#include <minix/callnr.h>
+#include <minix/com.h>
+#include <minix/const.h>
+#include <minix/devio.h>
+#include <minix/dmap.h>
+#include <minix/spin.h>
+#include <minix/syslib.h>
+#include <minix/sysutil.h>
+#include <minix/timers.h>
+#include <minix/type.h>
+#include <minix/ds.h>
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <machine/interrupt.h>	/* IRQ vectors and miscellaneous ports */
+#if defined(__i386__)
+#include <machine/bios.h>	/* BIOS index numbers */
+#include <machine/ports.h>	/* Well-known ports */
+#endif
+
+#include <errno.h>
+#include <lib.h>
+#include <limits.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <assert.h>
+
+#endif

Property changes on: lab4/.minix-src/include/minix/drivers.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/input.h
===================================================================
--- lab4/.minix-src/include/minix/input.h	(nonexistent)
+++ lab4/.minix-src/include/minix/input.h	(revision 13)
@@ -0,0 +1,333 @@
+#ifndef _MINIX_INPUT_H
+#define _MINIX_INPUT_H
+
+#include <sys/types.h>
+
+#ifdef _SYSTEM
+
+/* Device type. */
+#define INPUT_DEV_KBD		0x01	/* keyboard device */
+#define INPUT_DEV_MOUSE		0x02	/* mouse device */
+
+/* Known-invalid input device ID. */
+#define INVALID_INPUT_ID	(-1)
+
+#endif /* _SYSTEM */
+
+/*
+ * The input server heavily draws on the USB HID specification for events.
+ * Every driver should convert its event codes into this format.  This also
+ * implies that we use the U.S. keyboard layout for key events.  The mapping to
+ * localized keyboard layouts will be done at a different place (TTY, Xserver).
+ */
+
+/* A single event, as read from one of the input devices. */
+struct input_event {
+	uint16_t page;			/* event page (INPUT_PAGE_) */
+	uint16_t code;			/* page-specific event code */
+	int32_t value;			/* event value */
+	uint16_t flags;			/* event flags (INPUT_FLAG_) */
+	uint16_t devid;			/* identifier of source device */
+	uint32_t rsvd[2];		/* reserved for a future timestamp */
+};
+
+/* Event pages. */
+#define INPUT_PAGE_GD		0x0001	/* General Desktop page */
+#define INPUT_PAGE_KEY		0x0007	/* Keyboard/Keypad page */
+#define INPUT_PAGE_LED		0x0008	/* LED page */
+#define INPUT_PAGE_BUTTON	0x0009	/* Button page */
+#define INPUT_PAGE_CONS		0x000C	/* Consumer page */
+
+/* Event values.  Not exhaustive. */
+#define INPUT_RELEASE		0
+#define INPUT_PRESS		1
+
+/* Event flags. */
+#define INPUT_FLAG_ABS		0x00	/* absolute value (the default) */
+#define INPUT_FLAG_REL		0x04	/* relative value */
+
+/* Page-specific event codes. */
+enum {
+	INPUT_GD_X = 0x0030,
+	INPUT_GD_Y,
+
+	INPUT_GD_SYSTEM_POWER_DOWN = 0x0081,
+	INPUT_GD_SYSTEM_SLEEP,
+	INPUT_GD_SYSTEM_WAKE_UP
+};
+
+enum {
+	INPUT_KEY_A = 0x0004,
+	INPUT_KEY_B,
+	INPUT_KEY_C,
+	INPUT_KEY_D,
+	INPUT_KEY_E,
+	INPUT_KEY_F,
+	INPUT_KEY_G,
+	INPUT_KEY_H,
+	INPUT_KEY_I,
+	INPUT_KEY_J,
+	INPUT_KEY_K,
+	INPUT_KEY_L,
+	INPUT_KEY_M,
+	INPUT_KEY_N,
+	INPUT_KEY_O,
+	INPUT_KEY_P,
+	INPUT_KEY_Q,
+	INPUT_KEY_R,
+	INPUT_KEY_S,
+	INPUT_KEY_T,
+	INPUT_KEY_U,
+	INPUT_KEY_V,
+	INPUT_KEY_W,
+	INPUT_KEY_X,
+	INPUT_KEY_Y,
+	INPUT_KEY_Z,
+	INPUT_KEY_1,
+	INPUT_KEY_2,
+	INPUT_KEY_3,
+	INPUT_KEY_4,
+	INPUT_KEY_5,
+	INPUT_KEY_6,
+	INPUT_KEY_7,
+	INPUT_KEY_8,
+	INPUT_KEY_9,
+	INPUT_KEY_0,
+
+	INPUT_KEY_ENTER,
+	INPUT_KEY_ESCAPE,
+	INPUT_KEY_BACKSPACE,
+	INPUT_KEY_TAB,
+	INPUT_KEY_SPACEBAR,
+	INPUT_KEY_DASH,
+	INPUT_KEY_EQUAL,
+	INPUT_KEY_OPEN_BRACKET,
+	INPUT_KEY_CLOSE_BRACKET,
+	INPUT_KEY_BACKSLASH,
+	INPUT_KEY_EUROPE_1,
+	INPUT_KEY_SEMICOLON,
+	INPUT_KEY_APOSTROPH,
+	INPUT_KEY_GRAVE_ACCENT,
+	INPUT_KEY_COMMA,
+	INPUT_KEY_PERIOD,
+	INPUT_KEY_SLASH,
+	INPUT_KEY_CAPS_LOCK,
+
+	INPUT_KEY_F1,
+	INPUT_KEY_F2,
+	INPUT_KEY_F3,
+	INPUT_KEY_F4,
+	INPUT_KEY_F5,
+	INPUT_KEY_F6,
+	INPUT_KEY_F7,
+	INPUT_KEY_F8,
+	INPUT_KEY_F9,
+	INPUT_KEY_F10,
+	INPUT_KEY_F11,
+	INPUT_KEY_F12,
+
+	INPUT_KEY_PRINT_SCREEN,
+	INPUT_KEY_SCROLL_LOCK,
+	INPUT_KEY_PAUSE,
+	INPUT_KEY_INSERT,
+	INPUT_KEY_HOME,
+	INPUT_KEY_PAGE_UP,
+	INPUT_KEY_DELETE,
+	INPUT_KEY_END,
+	INPUT_KEY_PAGE_DOWN,
+	INPUT_KEY_RIGHT_ARROW,
+	INPUT_KEY_LEFT_ARROW,
+	INPUT_KEY_DOWN_ARROW,
+	INPUT_KEY_UP_ARROW,
+	INPUT_KEY_NUM_LOCK,
+
+	INPUT_KEY_KP_SLASH,
+	INPUT_KEY_KP_STAR,
+	INPUT_KEY_KP_DASH,
+	INPUT_KEY_KP_PLUS,
+	INPUT_KEY_KP_ENTER,
+	INPUT_KEY_KP_1,
+	INPUT_KEY_KP_2,
+	INPUT_KEY_KP_3,
+	INPUT_KEY_KP_4,
+	INPUT_KEY_KP_5,
+	INPUT_KEY_KP_6,
+	INPUT_KEY_KP_7,
+	INPUT_KEY_KP_8,
+	INPUT_KEY_KP_9,
+	INPUT_KEY_KP_0,
+	INPUT_KEY_KP_PERIOD,
+
+	INPUT_KEY_EUROPE_2,
+	INPUT_KEY_APPLICATION,
+	INPUT_KEY_POWER,
+	INPUT_KEY_KP_EQUAL,
+
+	INPUT_KEY_F13,
+	INPUT_KEY_F14,
+	INPUT_KEY_F15,
+	INPUT_KEY_F16,
+	INPUT_KEY_F17,
+	INPUT_KEY_F18,
+	INPUT_KEY_F19,
+	INPUT_KEY_F20,
+	INPUT_KEY_F21,
+	INPUT_KEY_F22,
+	INPUT_KEY_F23,
+	INPUT_KEY_F24,
+
+	INPUT_KEY_EXECUTE,
+	INPUT_KEY_HELP,
+	INPUT_KEY_MENU,
+	INPUT_KEY_SELECT,
+	INPUT_KEY_STOP,
+	INPUT_KEY_AGAIN,
+	INPUT_KEY_UNDO,
+	INPUT_KEY_CUT,
+	INPUT_KEY_COPY,
+	INPUT_KEY_PASTE,
+	INPUT_KEY_FIND,
+	INPUT_KEY_MUTE,
+	INPUT_KEY_VOLUME_UP,
+	INPUT_KEY_VOLUME_DOWN,
+	INPUT_KEY_LOCKING_CAPS_LOCK,
+	INPUT_KEY_LOCKING_NUM_LOCK,
+	INPUT_KEY_LOCKING_SCROLL_LOCK,
+	INPUT_KEY_KP_COMMA,
+	INPUT_KEY_EQUAL_SIGN,
+	INPUT_KEY_I10L_1,
+	INPUT_KEY_I10L_2,
+	INPUT_KEY_I10L_3,
+	INPUT_KEY_I10L_4,
+	INPUT_KEY_I10L_5,
+	INPUT_KEY_I10L_6,
+	INPUT_KEY_I10L_7,
+	INPUT_KEY_I10L_8,
+	INPUT_KEY_I10L_9,
+	INPUT_KEY_LANG_1,
+	INPUT_KEY_LANG_2,
+	INPUT_KEY_LANG_3,
+	INPUT_KEY_LANG_4,
+	INPUT_KEY_LANG_5,
+	INPUT_KEY_LANG_6,
+	INPUT_KEY_LANG_7,
+	INPUT_KEY_LANG_8,
+	INPUT_KEY_LANG_9,
+	INPUT_KEY_ALT_ERASE,
+	INPUT_KEY_SYSREQ,
+	INPUT_KEY_CANCEL,
+	INPUT_KEY_CLEAR,
+	INPUT_KEY_PRIOR,
+	INPUT_KEY_RETURN,
+	INPUT_KEY_SEPARATOR,
+	INPUT_KEY_OUT,
+	INPUT_KEY_OPER,
+	INPUT_KEY_CLEAR_AGAIN,
+	INPUT_KEY_CR_SEL,
+	INPUT_KEY_EX_SEL,
+
+	/* 0x00A5 -- 0x00AF RESERVED */
+
+	INPUT_KEY_KP_00 = 0x00B0,
+	INPUT_KEY_KP_000,
+	INPUT_KEY_THOUSANDS_SEP,
+	INPUT_KEY_DECIMAL_SEP,
+	INPUT_KEY_CURRENCY_UNIT,
+	INPUT_KEY_CURRENCY_SUBUNIT,
+	INPUT_KEY_KP_OPEN_PARENTHESIS,
+	INPUT_KEY_KP_CLOSE_PARENTHESIS,
+	INPUT_KEY_KP_OPEN_BRACE,
+	INPUT_KEY_KP_CLOSE_BRACE,
+	INPUT_KEY_KP_TAB,
+	INPUT_KEY_KP_BACKSPACE,
+	INPUT_KEY_KP_A,
+	INPUT_KEY_KP_B,
+	INPUT_KEY_KP_C,
+	INPUT_KEY_KP_D,
+	INPUT_KEY_KP_E,
+	INPUT_KEY_KP_F,
+	INPUT_KEY_KP_XOR,
+	INPUT_KEY_KP_CARET,
+	INPUT_KEY_KP_PERCENT,
+	INPUT_KEY_KP_SMALLER_THEN,
+	INPUT_KEY_KP_GREATER_THEN,
+	INPUT_KEY_KP_AMP,
+	INPUT_KEY_KP_DOUBLE_AMP,
+	INPUT_KEY_KP_PIPE,
+	INPUT_KEY_KP_DOUBLE_PIPE,
+	INPUT_KEY_KP_COLON,
+	INPUT_KEY_KP_NUMBER,
+	INPUT_KEY_KP_SPACE,
+	INPUT_KEY_KP_AT,
+	INPUT_KEY_KP_EXCLAMATION_MARK,
+	INPUT_KEY_KP_MEM_STORE,
+	INPUT_KEY_KP_MEM_RECALL,
+	INPUT_KEY_KP_MEM_CLEAR,
+	INPUT_KEY_KP_MEM_ADD,
+	INPUT_KEY_KP_MEM_SUBTRACT,
+	INPUT_KEY_KP_MEM_MULTIPLY,
+	INPUT_KEY_KP_MEM_DIVIDE,
+	INPUT_KEY_KP_PLUS_MINUS,
+	INPUT_KEY_KP_CLEAR,
+	INPUT_KEY_KP_CLEAR_ENTRY,
+	INPUT_KEY_KP_BIN,
+	INPUT_KEY_KP_OCT,
+	INPUT_KEY_KP_DEC,
+	INPUT_KEY_KP_HEX,
+
+	/* 0x00DE, 0x00DF RESERVED */
+
+	INPUT_KEY_LEFT_CTRL = 0x00E0,
+	INPUT_KEY_LEFT_SHIFT,
+	INPUT_KEY_LEFT_ALT,
+	INPUT_KEY_LEFT_GUI,
+	INPUT_KEY_RIGHT_CTRL,
+	INPUT_KEY_RIGHT_SHIFT,
+	INPUT_KEY_RIGHT_ALT,
+	INPUT_KEY_RIGHT_GUI
+
+	/* 0x00E8 -- 0xFFFF RESERVED */
+};
+
+enum {
+	INPUT_LED_NUMLOCK = 0x0001,
+	INPUT_LED_CAPSLOCK,
+	INPUT_LED_SCROLLLOCK
+};
+
+enum {
+	INPUT_BUTTON_1 = 0x0001,
+};
+
+enum {
+	INPUT_CONS_SCAN_NEXT_TRACK = 0x00B5,
+	INPUT_CONS_SCAN_PREVIOUS_TRACK,
+	INPUT_CONS_STOP,
+
+	INPUT_CONS_PLAY_PAUSE = 0x00CD,
+
+	INPUT_CONS_MUTE = 0x00E2,
+
+	INPUT_CONS_VOLUME_UP = 0x00E9,
+	INPUT_CONS_VOLUME_DOWN,
+
+	INPUT_CONS_AL_MEDIA_SELECT = 0x0183,
+
+	INPUT_CONS_AL_EMAIL_READER = 0x018A,
+
+	INPUT_CONS_AL_CALCULATOR = 0x0192,
+
+	INPUT_CONS_AL_LOCAL_BROWSER = 0x0194,
+
+	INPUT_CONS_AC_SEARCH = 0x0221,
+	INPUT_CONS_AC_GO_TO,
+	INPUT_CONS_AC_HOME,
+	INPUT_CONS_AC_BACK,
+	INPUT_CONS_AC_FORWARD,
+	INPUT_CONS_AC_STOP,
+	INPUT_CONS_AC_REFRESH,
+
+	INPUT_CONS_AC_BOOKMARKS = 0x022A
+};
+
+#endif

Property changes on: lab4/.minix-src/include/minix/input.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/ipc_filter.h
===================================================================
--- lab4/.minix-src/include/minix/ipc_filter.h	(nonexistent)
+++ lab4/.minix-src/include/minix/ipc_filter.h	(revision 13)
@@ -0,0 +1,30 @@
+/* IPC filter definitions. */
+
+#ifndef _MINIX_IPC_FILTER_H
+#define _MINIX_IPC_FILTER_H
+
+#include <minix/com.h>
+#include <minix/config.h>
+
+/* Special message sources, allowed in IPC filters only. */
+#define ANY_USR		_ENDPOINT(1, _ENDPOINT_P(ANY))
+#define ANY_SYS		_ENDPOINT(2, _ENDPOINT_P(ANY))
+#define ANY_TSK		_ENDPOINT(3, _ENDPOINT_P(ANY))
+
+/* IPC filter constants. */
+#define IPCF_MAX_ELEMENTS       (NR_SYS_PROCS * 2)
+
+/* IPC filter flags. */
+#define IPCF_MATCH_M_SOURCE    0x1
+#define IPCF_MATCH_M_TYPE      0x2
+#define IPCF_EL_BLACKLIST      0x4
+#define IPCF_EL_WHITELIST      0x8
+
+struct ipc_filter_el_s {
+    int flags;
+    endpoint_t m_source;
+    int m_type;
+};
+typedef struct ipc_filter_el_s ipc_filter_el_t;
+
+#endif /* _MINIX_IPC_FILTER_H */

Property changes on: lab4/.minix-src/include/minix/ipc_filter.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma/version.h
===================================================================
--- lab4/.minix-src/include/lzma/version.h	(nonexistent)
+++ lab4/.minix-src/include/lzma/version.h	(revision 13)
@@ -0,0 +1,121 @@
+/**
+ * \file        lzma/version.h
+ * \brief       Version number
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ *
+ * See ../lzma.h for information about liblzma as a whole.
+ */
+
+#ifndef LZMA_H_INTERNAL
+#	error Never include this file directly. Use <lzma.h> instead.
+#endif
+
+
+/*
+ * Version number split into components
+ */
+#define LZMA_VERSION_MAJOR 5
+#define LZMA_VERSION_MINOR 2
+#define LZMA_VERSION_PATCH 1
+#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
+
+#ifndef LZMA_VERSION_COMMIT
+#	define LZMA_VERSION_COMMIT ""
+#endif
+
+
+/*
+ * Map symbolic stability levels to integers.
+ */
+#define LZMA_VERSION_STABILITY_ALPHA 0
+#define LZMA_VERSION_STABILITY_BETA 1
+#define LZMA_VERSION_STABILITY_STABLE 2
+
+
+/**
+ * \brief       Compile-time version number
+ *
+ * The version number is of format xyyyzzzs where
+ *  - x = major
+ *  - yyy = minor
+ *  - zzz = revision
+ *  - s indicates stability: 0 = alpha, 1 = beta, 2 = stable
+ *
+ * The same xyyyzzz triplet is never reused with different stability levels.
+ * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta
+ * or 5.1.0 stable.
+ *
+ * \note        The version number of liblzma has nothing to with
+ *              the version number of Igor Pavlov's LZMA SDK.
+ */
+#define LZMA_VERSION (LZMA_VERSION_MAJOR * UINT32_C(10000000) \
+		+ LZMA_VERSION_MINOR * UINT32_C(10000) \
+		+ LZMA_VERSION_PATCH * UINT32_C(10) \
+		+ LZMA_VERSION_STABILITY)
+
+
+/*
+ * Macros to construct the compile-time version string
+ */
+#if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA
+#	define LZMA_VERSION_STABILITY_STRING "alpha"
+#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA
+#	define LZMA_VERSION_STABILITY_STRING "beta"
+#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE
+#	define LZMA_VERSION_STABILITY_STRING ""
+#else
+#	error Incorrect LZMA_VERSION_STABILITY
+#endif
+
+#define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \
+		#major "." #minor "." #patch stability commit
+
+#define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \
+		LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit)
+
+
+/**
+ * \brief       Compile-time version as a string
+ *
+ * This can be for example "4.999.5alpha", "4.999.8beta", or "5.0.0" (stable
+ * versions don't have any "stable" suffix). In future, a snapshot built
+ * from source code repository may include an additional suffix, for example
+ * "4.999.8beta-21-g1d92". The commit ID won't be available in numeric form
+ * in LZMA_VERSION macro.
+ */
+#define LZMA_VERSION_STRING LZMA_VERSION_STRING_C( \
+		LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, \
+		LZMA_VERSION_PATCH, LZMA_VERSION_STABILITY_STRING, \
+		LZMA_VERSION_COMMIT)
+
+
+/* #ifndef is needed for use with windres (MinGW or Cygwin). */
+#ifndef LZMA_H_INTERNAL_RC
+
+/**
+ * \brief       Run-time version number as an integer
+ *
+ * Return the value of LZMA_VERSION macro at the compile time of liblzma.
+ * This allows the application to compare if it was built against the same,
+ * older, or newer version of liblzma that is currently running.
+ */
+extern LZMA_API(uint32_t) lzma_version_number(void)
+		lzma_nothrow lzma_attr_const;
+
+
+/**
+ * \brief       Run-time version as a string
+ *
+ * This function may be useful if you want to display which version of
+ * liblzma your application is currently using.
+ */
+extern LZMA_API(const char *) lzma_version_string(void)
+		lzma_nothrow lzma_attr_const;
+
+#endif

Property changes on: lab4/.minix-src/include/lzma/version.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/i2c.h
===================================================================
--- lab4/.minix-src/include/minix/i2c.h	(nonexistent)
+++ lab4/.minix-src/include/minix/i2c.h	(revision 13)
@@ -0,0 +1,27 @@
+#ifndef __MINIX_I2C_H
+#define	__MINIX_I2C_H
+
+/*
+ * Minix I2C /dev Interface.
+ *
+ * Same as NetBSD/OpenBSD interface but with a flat struct (i.e. no pointers). 
+ * The NetBSD/OpenBSD interface can still be used on i2c device files. The
+ * ioctl(2) function will translate to/from the Minix version of the struct.
+ */
+
+#include <sys/types.h>
+#include <dev/i2c/i2c_io.h>
+#include <minix/ioctl.h>
+
+typedef struct minix_i2c_ioctl_exec {
+	i2c_op_t iie_op;		/* operation to perform */
+	i2c_addr_t iie_addr;		/* address of device */
+	uint8_t iie_cmd[I2C_EXEC_MAX_CMDLEN];	/* pointer to command */
+	size_t iie_cmdlen;		/* length of command */
+	uint8_t iie_buf[I2C_EXEC_MAX_BUFLEN];	/* pointer to data buffer */
+	size_t iie_buflen;		/* length of data buffer */
+} minix_i2c_ioctl_exec_t;
+
+#define	MINIX_I2C_IOCTL_EXEC		 _IOWR('I', 1, minix_i2c_ioctl_exec_t)
+
+#endif /* __MINIX_I2C_H */

Property changes on: lab4/.minix-src/include/minix/i2c.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/fb.h
===================================================================
--- lab4/.minix-src/include/minix/fb.h	(nonexistent)
+++ lab4/.minix-src/include/minix/fb.h	(revision 13)
@@ -0,0 +1,38 @@
+#ifndef __MINIX_FB_H_
+#define __MINIX_FB_H_
+
+#include <minix/type.h>
+
+struct fb_fix_screeninfo {
+	char id[16];		/* Identification string */
+	u16_t xpanstep;
+	u16_t ypanstep;
+	u16_t ywrapstep;
+	u32_t line_length;
+	phys_bytes mmio_start;
+	size_t mmio_len;
+	u16_t reserved[15];
+};
+
+struct fb_bitfield {
+	u32_t offset;
+	u32_t length;
+	u32_t msb_right;
+};
+
+struct fb_var_screeninfo {
+	u32_t xres;		/* visible resolution */
+	u32_t yres;
+	u32_t xres_virtual;	/* virtual resolution */
+	u32_t yres_virtual;
+	u32_t xoffset;		/* offset from virtual to visible */
+	u32_t yoffset;
+	u32_t bits_per_pixel;
+	struct fb_bitfield red;	/* bitfield in fb mem if true color */
+	struct fb_bitfield green;
+	struct fb_bitfield blue;
+	struct fb_bitfield transp;	/* transparency */
+	u16_t reserved[10];
+};
+
+#endif /* __MINIX_FB_H_ */

Property changes on: lab4/.minix-src/include/minix/fb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/bdev.h
===================================================================
--- lab4/.minix-src/include/minix/bdev.h	(nonexistent)
+++ lab4/.minix-src/include/minix/bdev.h	(revision 13)
@@ -0,0 +1,46 @@
+#ifndef _MINIX_BDEV_H
+#define _MINIX_BDEV_H
+
+/* Common API. */
+extern void bdev_driver(dev_t dev, char *label);
+
+/* Synchronous API. */
+extern int bdev_open(dev_t dev, int access);
+extern int bdev_close(dev_t dev);
+
+extern ssize_t bdev_read(dev_t dev, u64_t pos, char *buf, size_t count,
+	int flags);
+extern ssize_t bdev_write(dev_t dev, u64_t pos, char *buf, size_t count,
+	int flags);
+extern ssize_t bdev_gather(dev_t dev, u64_t pos, iovec_t *vec, int count,
+	int flags);
+extern ssize_t bdev_scatter(dev_t dev, u64_t pos, iovec_t *vec, int count,
+	int flags);
+extern int bdev_ioctl(dev_t dev, unsigned long request, void *buf,
+	endpoint_t user_endpt);
+
+/* Asynchronous API. */
+typedef int bdev_id_t;
+typedef void *bdev_param_t;
+
+typedef void (*bdev_callback_t)(dev_t dev, bdev_id_t id, bdev_param_t param,
+	int result);
+
+extern void bdev_flush_asyn(dev_t dev);
+
+extern bdev_id_t bdev_read_asyn(dev_t dev, u64_t pos, char *buf, size_t count,
+	int flags, bdev_callback_t callback, bdev_param_t param);
+extern bdev_id_t bdev_write_asyn(dev_t dev, u64_t pos, char *buf, size_t count,
+	int flags, bdev_callback_t callback, bdev_param_t param);
+extern bdev_id_t bdev_gather_asyn(dev_t dev, u64_t pos, iovec_t *vec,
+	int count, int flags, bdev_callback_t callback, bdev_param_t param);
+extern bdev_id_t bdev_scatter_asyn(dev_t dev, u64_t pos, iovec_t *vec,
+	int count, int flags, bdev_callback_t callback, bdev_param_t param);
+extern bdev_id_t bdev_ioctl_asyn(dev_t dev, unsigned long request, void *buf,
+	endpoint_t user_endpt, bdev_callback_t callback, bdev_param_t param);
+
+extern int bdev_wait_asyn(bdev_id_t id);
+
+extern void bdev_reply_asyn(message *m);
+
+#endif /* _MINIX_BDEV_H */

Property changes on: lab4/.minix-src/include/minix/bdev.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/log.h
===================================================================
--- lab4/.minix-src/include/minix/log.h	(nonexistent)
+++ lab4/.minix-src/include/minix/log.h	(revision 13)
@@ -0,0 +1,117 @@
+#ifndef __LOG_H__
+#define __LOG_H__
+/*
+ * Simple logging functions
+ */
+
+#include <stdarg.h>
+
+/*
+ * LEVEL_NONE  do not log anything.
+ * LEVEL_WARN  Information that needs to be known.
+ * LEVEL_INFO  Basic information like startup messages and occasional events.
+ * LEVEL_DEBUG debug statements about things happening that are less expected.
+ * LEVEL_TRACE Way to much information for anybody.
+ */
+
+#define LEVEL_NONE 0
+#define LEVEL_WARN 1
+#define LEVEL_INFO 2
+#define LEVEL_DEBUG 3
+#define LEVEL_TRACE 4
+
+static const char *level_string[5] = {
+	"none",
+	"warn",
+	"info",
+	"debug",
+	"trace"
+};
+
+/*
+ * struct to be initialized by the user of the logging system.
+ *
+ * name: The name attribute is used in logging statements do differentiate
+ * drivers
+ *
+ * log_level The level attribute describes the requested logging level. a level
+ * of 1 will only print warnings while a level of 4 will print all the trace
+ * information.
+ *
+ * log_func The logging function to use to log, log.h provides default_log
+ * to display information on the kernel output buffer. As a bonus if the
+ * requested log level is debug or trace the method , file and line number will
+ * be printed to the steam.
+ */
+struct log
+{
+	const char *name;
+	int log_level;
+
+	/* the logging function itself */
+	void (*log_func) (struct log * driver,
+	    int level,
+	    const char *file,
+	    const char *function, int line, const char *fmt, ...);
+
+};
+
+#define __log(driver,log_level, fmt, args...) \
+		((driver)->log_func(driver,log_level, \
+				__FILE__, __FUNCTION__, __LINE__,\
+				fmt, ## args))
+
+/* Log a warning */
+#define log_warn(driver, fmt, args...) \
+		__log(driver, LEVEL_WARN, fmt, ## args)
+
+/* Log an information message  */
+#define log_info(driver, fmt, args...) \
+		__log(driver, LEVEL_INFO, fmt, ## args)
+
+/* log debugging output  */
+#define log_debug(driver, fmt, args...) \
+		__log(driver, LEVEL_DEBUG, fmt, ## args)
+
+/* log trace output  */
+#define log_trace(driver, fmt, args...) \
+		__log(driver, LEVEL_TRACE, fmt, ## args)
+
+#endif /* __LOG_H__ */
+
+static void
+default_log(struct log *driver,
+    int level,
+    const char *file, const char *function, int line, const char *fmt, ...)
+{
+	va_list args;
+
+	if (level > driver->log_level) {
+		return;
+	}
+	/* If the wanted level is debug also display line/method information */
+	if (driver->log_level >= LEVEL_DEBUG) {
+		printf("%s(%s):%s+%d(%s):", driver->name,
+		    level_string[level], file, line, function);
+	} else {
+		printf("%s(%s)", driver->name, level_string[level]);
+	}
+
+	va_start(args, fmt);
+	vprintf(fmt, args);
+	va_end(args);
+}
+
+#ifdef hacks
+static void
+hexdump(unsigned char *d, unsigned int size)
+{
+	int s;
+	for (s = 0; s < size; s += 4) {
+		fprintf(stdout, "0x%04x 0x%02X%02X%02X%02X %c%c%c%c\n", s,
+		    (unsigned int) d[s], (unsigned int) d[s + 1],
+		    (unsigned int) d[s + 2], (unsigned int) d[s + 3], d[s],
+		    d[s + 1], d[s + 2], d[s + 3]);
+	}
+}
+#endif

Property changes on: lab4/.minix-src/include/minix/log.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/inputdriver.h
===================================================================
--- lab4/.minix-src/include/minix/inputdriver.h	(nonexistent)
+++ lab4/.minix-src/include/minix/inputdriver.h	(revision 13)
@@ -0,0 +1,24 @@
+#ifndef _MINIX_INPUTDRIVER_H
+#define _MINIX_INPUTDRIVER_H
+
+#include <minix/driver.h>
+#include <minix/input.h>
+
+/* Entry points into the device dependent code of input drivers. */
+struct inputdriver {
+	void (*idr_leds)(unsigned int leds);
+	void (*idr_intr)(unsigned int mask);
+	void (*idr_alarm)(clock_t stamp);
+	void (*idr_other)(message *m_ptr, int ipc_status);
+};
+
+/* Functions defined by libinputdriver. */
+void inputdriver_announce(unsigned int type);
+void inputdriver_send_event(int mouse, unsigned short page,
+	unsigned short code, int value, int flags);
+void inputdriver_process(struct inputdriver *idp, message *m_ptr,
+	int ipc_status);
+void inputdriver_terminate(void);
+void inputdriver_task(struct inputdriver *idp);
+
+#endif /* !_MINIX_INPUTDRIVER_H */

Property changes on: lab4/.minix-src/include/minix/inputdriver.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/netdriver.h
===================================================================
--- lab4/.minix-src/include/minix/netdriver.h	(nonexistent)
+++ lab4/.minix-src/include/minix/netdriver.h	(revision 13)
@@ -0,0 +1,75 @@
+#ifndef _MINIX_NETDRIVER_H
+#define _MINIX_NETDRIVER_H
+
+/*
+ * Prototypes and definitions for network drivers.
+ */
+#include <minix/config.h>
+#include <minix/endpoint.h>
+#include <minix/ipc.h>
+#include <minix/com.h>
+
+#include <net/if_media.h>
+
+/* Opaque data structure for copying in and out actual packet data. */
+struct netdriver_data;
+
+/* Network (ethernet) address structure. */
+typedef struct {
+	uint8_t na_addr[NDEV_HWADDR_MAX];
+} netdriver_addr_t;
+
+/* Information and function call table for network drivers. */
+struct netdriver {
+	const char *ndr_name;
+	int (* ndr_init)(unsigned int instance, netdriver_addr_t * hwaddr,
+	    uint32_t * caps, unsigned int * ticks);
+	void (* ndr_stop)(void);
+	void (* ndr_set_mode)(unsigned int mode,
+	    const netdriver_addr_t * mcast_list, unsigned int mcast_count);
+	void (* ndr_set_caps)(uint32_t caps);
+	void (* ndr_set_flags)(uint32_t flags);
+	void (* ndr_set_media)(uint32_t media);
+	void (* ndr_set_hwaddr)(const netdriver_addr_t * hwaddr);
+	ssize_t (* ndr_recv)(struct netdriver_data * data, size_t max);
+	int (* ndr_send)(struct netdriver_data * data, size_t size);
+	unsigned int (* ndr_get_link)(uint32_t * media);
+	void (* ndr_intr)(unsigned int mask);
+	void (* ndr_tick)(void);
+	void (* ndr_other)(const message * m_ptr, int ipc_status);
+};
+
+/* Functions defined by libnetdriver. */
+void netdriver_task(const struct netdriver * ndp);
+
+int netdriver_init(const struct netdriver * ndp);
+void netdriver_process(const struct netdriver * __restrict ndp,
+	const message * __restrict m_ptr, int ipc_status);
+void netdriver_terminate(void);
+
+const char *netdriver_name(void);
+
+void netdriver_recv(void);
+void netdriver_send(void);
+void netdriver_link(void);
+
+void netdriver_stat_oerror(uint32_t count);
+void netdriver_stat_coll(uint32_t count);
+void netdriver_stat_ierror(uint32_t count);
+void netdriver_stat_iqdrop(uint32_t count);
+
+void netdriver_copyin(struct netdriver_data * __restrict data, size_t off,
+	void * __restrict ptr, size_t size);
+void netdriver_copyout(struct netdriver_data * __restrict data, size_t off,
+	const void * __restrict ptr, size_t size);
+
+void netdriver_portinb(struct netdriver_data * data, size_t off, long port,
+	size_t size);
+void netdriver_portoutb(struct netdriver_data * data, size_t off, long port,
+	size_t size);
+void netdriver_portinw(struct netdriver_data * data, size_t off, long port,
+	size_t size);
+void netdriver_portoutw(struct netdriver_data * data, size_t off, long port,
+	size_t size);
+
+#endif /* _MINIX_NETDRIVER_H */

Property changes on: lab4/.minix-src/include/minix/netdriver.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/gpio.h
===================================================================
--- lab4/.minix-src/include/minix/gpio.h	(nonexistent)
+++ lab4/.minix-src/include/minix/gpio.h	(revision 13)
@@ -0,0 +1,34 @@
+#ifndef __INCLUDE_GPIO_H__
+#define __INCLUDE_GPIO_H__
+
+struct gpio
+{
+	int nr;			/* GPIO number */
+	int mode;		/* GPIO mode (input=0/output=1) */
+};
+
+#define GPIO_MODE_INPUT 0
+#define GPIO_MODE_OUTPUT 1
+
+int gpio_init(void);
+
+/* request access to a gpio */
+int gpio_claim(char *owner, int nr, struct gpio **gpio);
+
+/* Configure the GPIO for a certain purpose */
+int gpio_pin_mode(struct gpio *gpio, int mode);
+
+/* Set the value for a GPIO */
+int gpio_set(struct gpio *gpio, int value);
+
+/* Read the current value of the GPIO */
+int gpio_read(struct gpio *gpio, int *value);
+
+/* Read and clear the value interrupt value of the GPIO */
+int gpio_intr_read(struct gpio *gpio, int *value);
+
+/* Interrupt hook */
+int gpio_intr_message(message * m);
+
+int gpio_release(void);
+#endif /* __INCLUDE_GPIO_H__ */

Property changes on: lab4/.minix-src/include/minix/gpio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/board.h
===================================================================
--- lab4/.minix-src/include/minix/board.h	(nonexistent)
+++ lab4/.minix-src/include/minix/board.h	(revision 13)
@@ -0,0 +1,232 @@
+#ifndef __BOARD_H__
+#define __BOARD_H__
+#include <string.h>
+/* 
+  Utility functions to access/parse the board_id defined in the machine
+  struct in include/minix/type.h.
+
+   Identifier for the board 
+     [31:28] Architecture.  (MINIX_BOARD_ARCH)
+     [27:24] Architecture variant (MINIX_BOARD_ARCH_VARIANT) VERSION e.g. ARMV7 
+     [23:16] Vendor/Soc (EG TI )  (MINIX_BOARD_VENDOR) 
+     [15:8]  Board      (EG Beagle bone , beagle board ) (MINIX_BOARD)
+     [7:0]   Board variant (EG BealgeBone white v.s. BeagleBone black ) (MINIX_BOARD_VARIANT)
+*/
+
+#define MINIX_BOARD_ARCH_SHIFT         (28)
+#define MINIX_BOARD_ARCH_VARIANT_SHIFT (24)
+#define MINIX_BOARD_VENDOR_SHIFT       (16)
+#define MINIX_BOARD_SHIFT              (8)
+#define MINIX_BOARD_VARIANT_SHIFT      (0)
+
+/* 4 bits */
+#define MINIX_BOARD_ARCH_MASK \
+	(0XF << MINIX_BOARD_ARCH_SHIFT)
+/* 4 bits */
+#define MINIX_BOARD_ARCH_VARIANT_MASK \
+	(0XF << MINIX_BOARD_ARCH_VARIANT_SHIFT)
+/* 8 bits */
+#define MINIX_BOARD_VENDOR_MASK \
+	(0XFF << MINIX_BOARD_VENDOR_SHIFT)
+/* 8 bits */
+#define MINIX_BOARD_MASK \
+	(0XFF << MINIX_BOARD_SHIFT)
+/* 8 bits */
+#define MINIX_BOARD_VARIANT_MASK \
+	(0XFF << MINIX_BOARD_VARIANT_SHIFT)
+
+#define MINIX_MK_BOARD_ARCH(v) \
+	((v << MINIX_BOARD_ARCH_SHIFT ) & MINIX_BOARD_ARCH_MASK)
+#define MINIX_MK_BOARD_ARCH_VARIANT(v) \
+	(( v << MINIX_BOARD_ARCH_VARIANT_SHIFT) & MINIX_BOARD_ARCH_VARIANT_MASK )
+#define MINIX_MK_BOARD_VENDOR(v) \
+	(( v << MINIX_BOARD_VENDOR_SHIFT) & MINIX_BOARD_VENDOR_MASK )
+#define MINIX_MK_BOARD(v) \
+	(( v << MINIX_BOARD_SHIFT) & MINIX_BOARD_MASK )
+#define MINIX_MK_BOARD_VARIANT(v) \
+	(( v << MINIX_BOARD_VARIANT_SHIFT) & MINIX_BOARD_VARIANT_MASK )
+
+#define MINIX_BOARD_ARCH(v) \
+	((v & MINIX_BOARD_ARCH_MASK) >> MINIX_BOARD_ARCH_SHIFT )
+#define MINIX_BOARD_ARCH_VARIANT(v) \
+	(( v & MINIX_BOARD_ARCH_VARIANT_MASK) >> MINIX_BOARD_ARCH_VARIANT_SHIFT)
+#define MINIX_BOARD_VENDOR(v) \
+	(( v & MINIX_BOARD_VENDOR_MASK) >> MINIX_BOARD_VENDOR_SHIFT)
+#define MINIX_BOARD(v) \
+	(( v & MINIX_BOARD_MASK) >> MINIX_BOARD_SHIFT)
+#define MINIX_BOARD_VARIANT(v) \
+	(( v & MINIX_BOARD_VARIANT_MASK) >> MINIX_BOARD_VARIANT_SHIFT)
+
+/* We want to make it possible to use masks and therefore only try to use bits */
+#define MINIX_BOARD_ARCH_X86 MINIX_MK_BOARD_ARCH(1 << 0)
+#define MINIX_BOARD_ARCH_ARM MINIX_MK_BOARD_ARCH(1 << 1)
+
+#define MINIX_BOARD_ARCH_VARIANT_X86_GENERIC MINIX_MK_BOARD_ARCH_VARIANT(1<<0)
+#define MINIX_BOARD_ARCH_VARIANT_ARM_ARMV6 MINIX_MK_BOARD_ARCH_VARIANT(1<<1)
+#define MINIX_BOARD_ARCH_VARIANT_ARM_ARMV7 MINIX_MK_BOARD_ARCH_VARIANT(1<<2)
+
+#define MINIX_BOARD_VENDOR_INTEL MINIX_MK_BOARD_VENDOR(1<<0)
+#define MINIX_BOARD_VENDOR_TI MINIX_MK_BOARD_VENDOR(1<<1)
+
+#define MINIX_BOARD_GENERIC MINIX_MK_BOARD(1<<0)
+/* BeagleBoard XM */
+#define MINIX_BOARD_BBXM MINIX_MK_BOARD(1<<1)
+/* BeagleBone (Black and* white) */
+#define MINIX_BOARD_BB MINIX_MK_BOARD(1<<2)
+
+/* Only  one  of a kind */
+#define MINIX_BOARD_VARIANT_GENERIC MINIX_MK_BOARD_VARIANT(1<<0)
+/* BeagleBone White */
+#define MINIX_BOARD_VARIANT_BBW MINIX_MK_BOARD_VARIANT(1<<1)
+/* BeagleBone Black */
+#define MINIX_BOARD_VARIANT_BBB MINIX_MK_BOARD_VARIANT(1<<2)
+
+#define BOARD_ID_INTEL \
+	( MINIX_BOARD_ARCH_X86 \
+	| MINIX_BOARD_ARCH_VARIANT_X86_GENERIC \
+	| MINIX_BOARD_VENDOR_INTEL \
+	| MINIX_BOARD_GENERIC \
+	| MINIX_BOARD_VARIANT_GENERIC\
+	)
+
+#define BOARD_ID_BBXM \
+	( MINIX_BOARD_ARCH_ARM \
+	| MINIX_BOARD_ARCH_VARIANT_ARM_ARMV7 \
+	| MINIX_BOARD_VENDOR_TI \
+	| MINIX_BOARD_BBXM \
+	| MINIX_BOARD_VARIANT_GENERIC\
+	)
+
+#define BOARD_ID_BBW \
+	( MINIX_BOARD_ARCH_ARM \
+	| MINIX_BOARD_ARCH_VARIANT_ARM_ARMV7 \
+	| MINIX_BOARD_VENDOR_TI \
+	| MINIX_BOARD_BB \
+	| MINIX_BOARD_VARIANT_BBW\
+	)
+
+#define BOARD_ID_BBB \
+	( MINIX_BOARD_ARCH_ARM \
+	| MINIX_BOARD_ARCH_VARIANT_ARM_ARMV7 \
+	| MINIX_BOARD_VENDOR_TI \
+	| MINIX_BOARD_BB \
+	| MINIX_BOARD_VARIANT_BBB\
+	)
+
+#define BOARD_IS_BBXM(v) \
+		( (BOARD_ID_BBXM & ~MINIX_BOARD_VARIANT_MASK) == (v & ~MINIX_BOARD_VARIANT_MASK))
+/* Either one of the known BeagleBones */
+#define BOARD_IS_BB(v)   \
+		( (BOARD_ID_BBW & ~MINIX_BOARD_VARIANT_MASK) == (v & ~MINIX_BOARD_VARIANT_MASK))
+#define BOARD_IS_BBW(v)  ( v == BOARD_ID_BBW)
+#define BOARD_IS_BBB(v)  ( v == BOARD_ID_BBB)
+
+#define BOARD_FILTER_BBXM_VALUE (BOARD_ID_BBXM)
+#define BOARD_FILTER_BBXM_MASK  \
+		(MINIX_BOARD_ARCH_MASK \
+		| MINIX_BOARD_ARCH_VARIANT_MASK \
+		| MINIX_BOARD_VENDOR_MASK \
+		| MINIX_BOARD_MASK \
+		| MINIX_BOARD_VARIANT_MASK)
+
+#define BOARD_FILTER_BB_VALUE   (BOARD_ID_BBW & ~MINIX_BOARD_VARIANT_MASK)
+#define BOARD_FILTER_BB_MASK    \
+		(MINIX_BOARD_ARCH_MASK \
+		| MINIX_BOARD_ARCH_VARIANT_MASK \
+		| MINIX_BOARD_VENDOR_MASK \
+		| MINIX_BOARD_MASK )
+
+struct shortname2id
+{
+	const char name[15];
+	unsigned int id;
+};
+
+
+/* mapping from fields given by the bootloader to board id's */
+static struct shortname2id shortname2id[] = {
+	{.name = "BBXM",.id = BOARD_ID_BBXM},
+	{.name = "A335BONE",.id = BOARD_ID_BBW},
+	{.name = "A335BNLT",.id = BOARD_ID_BBB},
+};
+
+struct board_id2name
+{
+	unsigned int id;
+	const char name[40];
+};
+
+/* how to convert a BOARD id to a board name */
+static struct board_id2name board_id2name[] = {
+	{.id = BOARD_ID_INTEL,.name = "X86-I586-GENERIC-GENERIC-GENERIC"},
+	{.id = BOARD_ID_BBXM,.name = "ARM-ARMV7-TI-BBXM-GENERIC"},
+	{.id = BOARD_ID_BBW,.name = "ARM-ARMV7-TI-BB-WHITE"},
+	{.id = BOARD_ID_BBB,.name = "ARM-ARMV7-TI-BB-BLACK"},
+};
+
+struct board_arch2arch
+{
+	unsigned int board_arch;
+	const char arch[40];
+};
+/* Mapping from board_arch to arch */
+static struct board_arch2arch board_arch2arch[] = {
+	{.board_arch = MINIX_BOARD_ARCH_ARM ,.arch = "earm"},
+	{.board_arch = MINIX_BOARD_ARCH_X86 ,.arch = "i386"},
+};
+
+/* returns 0 if no board was found that match that id */
+static int
+get_board_id_by_short_name(const char *name)
+{
+	int x;
+	for (x = 0; x < sizeof(shortname2id) / sizeof(shortname2id[0]); x++) {
+		if (strncmp(name, shortname2id[x].name, 15) == 0) {
+			return shortname2id[x].id;
+		}
+	}
+	return 0;
+}
+
+/* returns 0 if no board was found that match that id */
+static int
+get_board_id_by_name(const char *name)
+{
+	int x;
+	for (x = 0; x < sizeof(board_id2name) / sizeof(board_id2name[0]); x++) {
+		if (strncmp(name, board_id2name[x].name, 40) == 0) {
+			return board_id2name[x].id;
+		}
+	}
+	return 0;
+}
+
+/* convert a board id to a board name to use later 
+   returns NULL if no board was found that match that id */
+static const char *
+get_board_name(unsigned int id)
+{
+	int x;
+	for (x = 0; x < sizeof(board_id2name) / sizeof(board_id2name[0]); x++) {
+		if (board_id2name[x].id == id) {
+			return board_id2name[x].name;
+		}
+	}
+	return NULL;
+}
+
+/* convert a board id to a board name to use later 
+   returns NULL if no board was found that match that id */
+static const char *
+get_board_arch_name(unsigned int id)
+{
+	int x;
+	for (x = 0; x < sizeof(board_arch2arch) / sizeof(board_arch2arch[0]); x++) {
+		if (board_arch2arch[x].board_arch == (id & MINIX_BOARD_ARCH_MASK) ) {
+			return board_arch2arch[x].arch;
+		}
+	}
+	return NULL;
+}
+
+#endif

Property changes on: lab4/.minix-src/include/minix/board.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/partition.h
===================================================================
--- lab4/.minix-src/include/minix/partition.h	(nonexistent)
+++ lab4/.minix-src/include/minix/partition.h	(revision 13)
@@ -0,0 +1,23 @@
+/*	minix/partition.h				Author: Kees J. Bot
+ *								7 Dec 1995
+ * Place of a partition on disk and the disk geometry,
+ * for use with the DIOCGETP and DIOCSETP ioctl's.
+ */
+#ifndef _MINIX__PARTITION_H
+#define _MINIX__PARTITION_H
+
+#include <sys/types.h>
+
+#include <minix/u64.h>
+
+int minix_sizeup(char *name, u64_t *bytes);
+
+struct part_geom {
+  u64_t base;		/* byte offset to the partition start */
+  u64_t size;		/* number of bytes in the partition */
+  unsigned cylinders;	/* disk geometry */
+  unsigned heads;
+  unsigned sectors;
+};
+
+#endif /* _MINIX__PARTITION_H */

Property changes on: lab4/.minix-src/include/minix/partition.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/i2cdriver.h
===================================================================
--- lab4/.minix-src/include/minix/i2cdriver.h	(nonexistent)
+++ lab4/.minix-src/include/minix/i2cdriver.h	(revision 13)
@@ -0,0 +1,32 @@
+/* Prototypes and definitions for i2c drivers. */
+
+#ifndef _MINIX_I2CDRIVER_H
+#define _MINIX_I2CDRIVER_H
+
+#include <minix/endpoint.h>
+#include <minix/i2c.h>
+#include <minix/ipc.h>
+
+/* Functions defined by i2cdriver.c: */
+int i2cdriver_env_parse(uint32_t * bus, i2c_addr_t * address,
+						i2c_addr_t * valid_addrs);
+void i2cdriver_announce(uint32_t bus);
+endpoint_t i2cdriver_bus_endpoint(uint32_t bus);
+int i2cdriver_subscribe_bus_updates(uint32_t bus);
+void i2cdriver_handle_bus_update(endpoint_t * bus_endpoint, uint32_t bus,
+							i2c_addr_t address);
+int i2cdriver_reserve_device(endpoint_t bus_endpoint, i2c_addr_t address);
+int i2cdriver_exec(endpoint_t bus_endpoint, minix_i2c_ioctl_exec_t *ioctl_exec);
+
+int i2creg_raw_read8(endpoint_t bus, i2c_addr_t addr, uint8_t * val);
+int i2creg_read8(endpoint_t bus, i2c_addr_t addr, uint8_t reg, uint8_t * val);
+int i2creg_read16(endpoint_t bus, i2c_addr_t addr, uint8_t reg, uint16_t * val);
+int i2creg_read24(endpoint_t bus, i2c_addr_t addr, uint8_t reg, uint32_t * val);
+int i2creg_raw_write8(endpoint_t bus, i2c_addr_t addr, uint8_t val);
+int i2creg_write8(endpoint_t bus, i2c_addr_t addr, uint8_t reg, uint8_t val);
+int i2creg_set_bits8(endpoint_t bus, i2c_addr_t addr, uint8_t reg,
+								uint8_t bits);
+int i2creg_clear_bits8(endpoint_t bus, i2c_addr_t addr, uint8_t reg,
+								uint8_t bits);
+
+#endif /* _MINIX_I2CDRIVER_H */

Property changes on: lab4/.minix-src/include/minix/i2cdriver.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/ipcconst.h
===================================================================
--- lab4/.minix-src/include/minix/ipcconst.h	(nonexistent)
+++ lab4/.minix-src/include/minix/ipcconst.h	(revision 13)
@@ -0,0 +1,36 @@
+#ifndef _IPC_CONST_H
+#define _IPC_CONST_H
+
+#include <machine/ipcconst.h>
+
+ /* System call numbers that are passed when trapping to the kernel. */
+#define SEND		   1	/* blocking send */
+#define RECEIVE		   2	/* blocking receive */
+#define SENDREC	 	   3  	/* SEND + RECEIVE */
+#define NOTIFY		   4	/* asynchronous notify */
+#define SENDNB             5    /* nonblocking send */
+#define MINIX_KERNINFO     6    /* request kernel info structure */
+#define SENDA		   16	/* asynchronous send */
+#define IPCNO_HIGHEST	SENDA
+/* Check that the message payload type doesn't grow past the maximum IPC payload size.
+ * This is a compile time check. */
+#define _ASSERT_MSG_SIZE(msg_type) \
+    typedef int _ASSERT_##msg_type[/* CONSTCOND */sizeof(msg_type) == 56 ? 1 : -1]
+
+/* Macros for IPC status code manipulation. */
+#define IPC_STATUS_CALL_SHIFT	0
+#define IPC_STATUS_CALL_MASK	0x3F
+#define IPC_STATUS_CALL(status)	\
+	(((status) >> IPC_STATUS_CALL_SHIFT) & IPC_STATUS_CALL_MASK)
+#define IPC_STATUS_CALL_TO(call) \
+	(((call) & IPC_STATUS_CALL_MASK) << IPC_STATUS_CALL_SHIFT)
+
+#define IPC_FLG_MSG_FROM_KERNEL	1 /* this message originated in the kernel on
+				     behalf of a process, this is a trusted
+				     message, never reply to the sender
+				 */
+#define IPC_STATUS_FLAGS_SHIFT	16
+#define IPC_STATUS_FLAGS(flgs)	((flgs) << IPC_STATUS_FLAGS_SHIFT)
+#define IPC_STATUS_FLAGS_TEST(status, flgs)	\
+		(((status) >> IPC_STATUS_FLAGS_SHIFT) & (flgs))
+#endif /* IPC_CONST_H */

Property changes on: lab4/.minix-src/include/minix/ipcconst.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/procfs.h
===================================================================
--- lab4/.minix-src/include/minix/procfs.h	(nonexistent)
+++ lab4/.minix-src/include/minix/procfs.h	(revision 13)
@@ -0,0 +1,26 @@
+#ifndef _MINIX_PROCFS_H
+#define _MINIX_PROCFS_H
+
+/*
+ * The compatibility model is as follows. The current format should be retained
+ * for as long as possible; new fields can be added at the end of the line,
+ * because ps/top only read as much as they know of from the start of the line.
+ * Once fields (really) have to be removed, or the whole line becomes too big
+ * of a mess, a completely new format string can be put in, but with an
+ * increased PSINFO_VERSION at the beginning. That way, older ps/top copies
+ * will not misinterpret the new fields, but rather fail cleanly.
+ */
+#define PSINFO_VERSION	1
+
+/* Process types. */
+#define TYPE_TASK	'T'
+#define TYPE_SYSTEM	'S'
+#define TYPE_USER	'U'
+
+/* General process states. */
+#define STATE_SLEEP	'S'
+#define STATE_ZOMBIE	'Z'
+#define STATE_RUN	'R'
+#define STATE_STOP	'T'
+
+#endif /* _MINIX_PROCFS_H */

Property changes on: lab4/.minix-src/include/minix/procfs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/chardriver.h
===================================================================
--- lab4/.minix-src/include/minix/chardriver.h	(nonexistent)
+++ lab4/.minix-src/include/minix/chardriver.h	(revision 13)
@@ -0,0 +1,36 @@
+#ifndef _MINIX_CHARDRIVER_H
+#define _MINIX_CHARDRIVER_H
+
+#include <minix/driver.h>
+
+typedef unsigned int cdev_id_t;
+
+/* Entry points into the device dependent code of character drivers. */
+struct chardriver {
+  int (*cdr_open)(devminor_t minor, int access, endpoint_t user_endpt);
+  int (*cdr_close)(devminor_t minor);
+  ssize_t (*cdr_read)(devminor_t minor, u64_t position, endpoint_t endpt,
+	cp_grant_id_t grant, size_t size, int flags, cdev_id_t id);
+  ssize_t (*cdr_write)(devminor_t minor, u64_t position, endpoint_t endpt,
+	cp_grant_id_t grant, size_t size, int flags, cdev_id_t id);
+  int (*cdr_ioctl)(devminor_t minor, unsigned long request, endpoint_t endpt,
+	cp_grant_id_t grant, int flags, endpoint_t user_endpt, cdev_id_t id);
+  int (*cdr_cancel)(devminor_t minor, endpoint_t endpt, cdev_id_t id);
+  int (*cdr_select)(devminor_t minor, unsigned int ops, endpoint_t endpt);
+  void (*cdr_intr)(unsigned int mask);
+  void (*cdr_alarm)(clock_t stamp);
+  void (*cdr_other)(message *m_ptr, int ipc_status);
+};
+
+/* Functions defined by libchardriver. */
+void chardriver_announce(void);
+int chardriver_get_minor(const message *m, devminor_t *minor);
+void chardriver_process(const struct chardriver *cdp, message *m_ptr,
+	int ipc_status);
+void chardriver_terminate(void);
+void chardriver_task(const struct chardriver *cdp);
+
+void chardriver_reply_task(endpoint_t endpt, cdev_id_t id, int r);
+void chardriver_reply_select(endpoint_t endpt, devminor_t minor, int ops);
+
+#endif /* _MINIX_CHARDRIVER_H */

Property changes on: lab4/.minix-src/include/minix/chardriver.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/safecopies.h
===================================================================
--- lab4/.minix-src/include/minix/safecopies.h	(nonexistent)
+++ lab4/.minix-src/include/minix/safecopies.h	(revision 13)
@@ -0,0 +1,109 @@
+#ifndef _MINIX_SAFECOPIES_H
+#define _MINIX_SAFECOPIES_H 1
+
+#include <minix/sys_config.h>
+#include <sys/types.h>
+#include <minix/vm.h>
+#include <stdint.h>
+
+typedef struct {
+	int cp_flags;					/* CPF_* below */
+	int cp_seq;					/* sequence number */
+	union ixfer_cp_u {
+		struct {
+			/* CPF_DIRECT */
+			endpoint_t	cp_who_to;	/* grantee */
+			vir_bytes	cp_start;	/* memory */
+			size_t		cp_len;		/* size in bytes */
+		} cp_direct;
+		struct {
+			/* CPF_INDIRECT */
+			endpoint_t	cp_who_to;	/* grantee */
+			endpoint_t	cp_who_from;	/* previous granter */
+			cp_grant_id_t	cp_grant;	/* previous grant */
+		} cp_indirect;
+		struct {
+			/* CPF_MAGIC */
+			endpoint_t	cp_who_from;	/* granter */
+			endpoint_t	cp_who_to;	/* grantee */
+			vir_bytes	cp_start;	/* memory */
+			size_t		cp_len;		/* size in bytes */
+		} cp_magic;
+		struct {
+			/* (free slot) */
+			int		cp_next;	/* next free or -1 */
+		} cp_free;
+	} cp_u;
+	cp_grant_id_t cp_faulted;	/* soft fault marker (CPF_TRY only) */
+} cp_grant_t;
+
+/* Vectored safecopy. */
+struct vscp_vec {
+        /* Exactly one of the following must be SELF. */
+        endpoint_t      v_from;         /* source */
+        endpoint_t      v_to;           /* destination */
+        cp_grant_id_t   v_gid;          /* grant id of other process */
+        size_t          v_offset;       /* offset in other grant */
+        vir_bytes       v_addr;         /* address in copier's space */
+        size_t          v_bytes;        /* no. of bytes */
+};
+
+/* Invalid grant number. */
+#define GRANT_INVALID	((cp_grant_id_t) -1)
+#define GRANT_VALID(g)	((g) > GRANT_INVALID)
+
+/* Grant index and sequence number split/merge/limits. */
+#define GRANT_SHIFT		20	/* seq: upper 11 bits, idx: lower 20 */
+#define GRANT_MAX_SEQ		(1 << (31 - GRANT_SHIFT))
+#define GRANT_MAX_IDX		(1 << GRANT_SHIFT)
+#define GRANT_ID(idx, seq)	((cp_grant_id_t)((seq << GRANT_SHIFT) | (idx)))
+#define GRANT_SEQ(g)		(((g) >> GRANT_SHIFT) & (GRANT_MAX_SEQ - 1))
+#define GRANT_IDX(g)		((g) & (GRANT_MAX_IDX - 1))
+
+/* Operations: any combination is ok. */
+#define CPF_READ	0x000001 /* Granted process may read. */
+#define CPF_WRITE	0x000002 /* Granted process may write. */
+
+/* Grant flags. */
+#define CPF_TRY		0x000010 /* Fail fast on unmapped memory. */
+
+/* Internal flags. */
+#define CPF_USED	0x000100 /* Grant slot in use. */
+#define CPF_DIRECT	0x000200 /* Grant from this process to another. */
+#define CPF_INDIRECT	0x000400 /* Grant from grant to another. */
+#define CPF_MAGIC	0x000800 /* Grant from any to any. */
+#define CPF_VALID	0x001000 /* Grant slot contains valid grant. */
+
+/* Special cpf_revoke() return values. */
+#define GRANT_FAULTED	1	/* CPF_TRY: a soft fault occurred */
+
+/* Prototypes for functions in libsys. */
+void cpf_prealloc(unsigned int count);
+cp_grant_id_t cpf_grant_direct(endpoint_t who_to, vir_bytes addr, size_t bytes,
+	int access);
+cp_grant_id_t cpf_grant_indirect(endpoint_t who_to, endpoint_t who_from,
+	cp_grant_id_t gr);
+cp_grant_id_t cpf_grant_magic(endpoint_t who_to, endpoint_t who_from,
+	vir_bytes addr, size_t bytes, int access);
+int cpf_revoke(cp_grant_id_t grant_id);
+
+/* START OF DEPRECATED API */
+int cpf_getgrants(cp_grant_id_t *grant_ids, int n);
+int cpf_setgrant_direct(cp_grant_id_t g, endpoint_t who, vir_bytes addr,
+	size_t size, int access);
+int cpf_setgrant_indirect(cp_grant_id_t g, endpoint_t who_to, endpoint_t
+	who_from, cp_grant_id_t his_g);
+int cpf_setgrant_magic(cp_grant_id_t g, endpoint_t who_to, endpoint_t
+	who_from, vir_bytes addr, size_t bytes, int access);
+int cpf_setgrant_disable(cp_grant_id_t grant_id);
+/* END OF DEPRECATED API */
+
+void cpf_reload(void);
+
+/* Set a process' grant table location and size (in-kernel only). */
+#define _K_SET_GRANT_TABLE(rp, ptr, entries)	\
+	priv(rp)->s_grant_table= (ptr);		\
+	priv(rp)->s_grant_entries= (entries);   \
+	priv(rp)->s_grant_endpoint= (rp)->p_endpoint;
+
+#endif	/* _MINIX_SAFECOPIES_H */

Property changes on: lab4/.minix-src/include/minix/safecopies.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/minlib.h
===================================================================
--- lab4/.minix-src/include/minix/minlib.h	(nonexistent)
+++ lab4/.minix-src/include/minix/minlib.h	(revision 13)
@@ -0,0 +1,33 @@
+#ifndef _MINLIB
+#define _MINLIB
+
+#include <sys/mount.h>
+
+/* Miscellaneous BSD. */
+char *itoa(int _n);
+
+/* Miscellaneous MINIX. */
+void std_err(const char *_s);
+void prints(const char *_s, ...);
+int fsversion(char *_dev, char *_prog);
+int getprocessor(void);
+void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx);
+int load_mtab(char *_prog_name);
+int get_mtab_entry(char dev[PATH_MAX], char mount_point[PATH_MAX],
+			char type[MNTNAMELEN], char flags[MNTFLAGLEN]);
+int servxcheck(unsigned long peer, const char *service,
+	void (*logf)(int pass, const char *name));
+const char *servxfile(const char *file);
+
+/* read_tsc() and friends */
+void read_tsc(u32_t *hi, u32_t *lo);
+void read_tsc_64(u64_t *t);
+
+/* return values for fsversion */
+#define FSVERSION_MFS1		0x00001
+#define FSVERSION_MFS2		0x00002
+#define FSVERSION_MFS3		0x00003
+#define FSVERSION_EXT2		0x10002
+#define FSVERSION_ISO9660	0x20001
+
+#endif

Property changes on: lab4/.minix-src/include/minix/minlib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/ioctl.h
===================================================================
--- lab4/.minix-src/include/minix/ioctl.h	(nonexistent)
+++ lab4/.minix-src/include/minix/ioctl.h	(revision 13)
@@ -0,0 +1 @@
+#include <sys/ioccom.h>

Property changes on: lab4/.minix-src/include/minix/ioctl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/const.h
===================================================================
--- lab4/.minix-src/include/minix/const.h	(nonexistent)
+++ lab4/.minix-src/include/minix/const.h	(revision 13)
@@ -0,0 +1,185 @@
+#ifndef _MINIX_CONST_H
+#define _MINIX_CONST_H
+
+#include <machine/archconst.h>
+
+/* The UNUSED annotation tells the compiler or lint not to complain
+ * about an unused variable or function parameter.
+ *
+ * A number of different annotations are used, depending on the
+ * compiler or checker that is looking at the code.
+ *
+ * Note that some variants rename the parameter, so if you use
+ * the parameter after all, you'll get a complaint about a missing
+ * variable.
+ *
+ * You use it like this:
+ *
+ *   void foo(int UNUSED(x)){}
+ */
+
+#ifndef UNUSED
+#if defined _lint
+# define UNUSED(v) /*lint -e(715,818)*/ v
+#elif defined(__GNUC__)
+# define UNUSED(v) UNUSED_ ## v __attribute((unused))
+#elif defined __LCLINT__
+# define UNUSED(v) /*@unused@*/ v
+#else
+# define UNUSED(v) _UNUSED_ ## v
+#endif
+#endif
+
+#ifndef _MINIX_MAGIC
+#define __ALIGNED(X) __aligned(X)
+#else
+#define __ALIGNED(X)
+#endif
+
+#define EXTERN        extern	/* used in *.h files */
+
+#define TRUE               1	/* used for turning integers into Booleans */
+#define FALSE              0	/* used for turning integers into Booleans */
+
+#define SUPER_USER ((uid_t) 0)	/* uid_t of superuser */
+
+#include <sys/null.h>      /* NULL Pointer */
+
+#define SCPVEC_NR	  64	/* max # of entries in a SYS_VSAFECOPY request */
+#define MAPVEC_NR	  64	/* max # of entries in a SYS_VUMAP request */
+#define NR_IOREQS	  64	/* maximum number of entries in an iorequest */
+
+#define VUA_READ	0x01	/* for SYS_VUMAP: read access */
+#define VUA_WRITE	0x02	/* for SYS_VUMAP: write access */
+
+/* Message passing constants. */
+#define MESS_SIZE (sizeof(message))	/* might need usizeof from FS here */
+
+/* Memory related constants. */
+#define SEGMENT_TYPE  0xFF00	/* bit mask to get segment type */
+#define SEGMENT_INDEX 0x00FF	/* bit mask to get segment index */
+
+#define PHYS_SEG      0x0400	/* flag indicating entire physical memory */
+
+#define LOCAL_VM_SEG  0x1000	/* same as LOCAL_SEG, but with vm lookup */
+#define MEM_GRANT	3
+#define VIR_ADDR	1
+#define VM_D		(LOCAL_VM_SEG | VIR_ADDR)
+#define VM_GRANT	(LOCAL_VM_SEG | MEM_GRANT)
+
+/* Labels used to disable code sections for different reasons. */
+#define DEAD_CODE	   0	/* unused code in normal configuration */
+#define FUTURE_CODE	   0	/* new code to be activated + tested later */
+#define TEMP_CODE	   1	/* active code to be removed later */
+
+/* Miscellaneous */
+#define BYTE            0377	/* mask for 8 bits */
+#define READING            0	/* copy data to user */
+#define WRITING            1	/* copy data from user */
+#define PEEKING            2	/* retrieve FS data without copying */
+#define HAVE_SCATTERED_IO  1	/* scattered I/O is now standard */
+
+/* Memory is allocated in clicks. */
+#if defined(__i386__) || defined(__arm__)
+#define CLICK_SIZE      4096	/* unit in which memory is allocated */
+#define CLICK_SHIFT       12	/* log2 of CLICK_SIZE */
+#else
+#error Unsupported arch
+#endif
+
+/* Click alignment macros. */
+#define CLICK_FLOOR(n)  (((vir_bytes)(n) / CLICK_SIZE) * CLICK_SIZE)
+#define CLICK_CEIL(n)   CLICK_FLOOR((vir_bytes)(n) + CLICK_SIZE-1)
+
+/* Sizes of memory tables. The boot monitor distinguishes three memory areas,
+ * namely low mem below 1M, 1M-16M, and mem after 16M. More chunks are needed
+ * for DOS MINIX.
+*/
+#define NR_MEMS            16
+
+#define CLICK2ABS(v) ((v) << CLICK_SHIFT)
+#define ABS2CLICK(a) ((a) >> CLICK_SHIFT)
+
+/* Flag bits for i_mode in the inode. */
+#define I_TYPE          0170000	/* this field gives inode type */
+#define I_UNIX_SOCKET	0140000 /* unix domain socket */
+#define I_SYMBOLIC_LINK 0120000	/* file is a symbolic link */
+#define I_REGULAR       0100000	/* regular file, not dir or special */
+#define I_BLOCK_SPECIAL 0060000	/* block special file */
+#define I_DIRECTORY     0040000	/* file is a directory */
+#define I_CHAR_SPECIAL  0020000	/* character special file */
+#define I_NAMED_PIPE    0010000	/* named pipe (FIFO) */
+#define I_SET_UID_BIT   0004000	/* set effective uid_t on exec */
+#define I_SET_GID_BIT   0002000	/* set effective gid_t on exec */
+#define I_SET_STCKY_BIT 0001000	/* sticky bit */ 
+#define ALL_MODES       0007777	/* all bits for user, group and others */
+#define RWX_MODES       0000777	/* mode bits for RWX only */
+#define R_BIT           0000004	/* Rwx protection bit */
+#define W_BIT           0000002	/* rWx protection bit */
+#define X_BIT           0000001	/* rwX protection bit */
+#define I_NOT_ALLOC     0000000	/* this inode is free */
+
+/* Some limits. */
+#define MAX_INODE_NR ((ino_t) 037777777777)	/* largest inode number */
+#define MAX_FILE_POS ((off_t) 0x7FFFFFFF)	/* largest legal file offset */
+#define UMAX_FILE_POS ((unsigned) 0x7FFFFFFF)	/* largest legal file offset */
+
+#define MAX_SYM_LOOPS	8	/* how many symbolic links are recursed */
+
+#define NO_BLOCK              ((block_t) 0)	/* absence of a block number */
+#define NO_ENTRY                ((ino_t) 0)	/* absence of a dir entry */
+#define NO_ZONE                ((zone_t) 0)	/* absence of a zone number */
+#define NO_DEV                  ((dev_t) 0)	/* absence of a device numb */
+#define NO_LINK		      ((nlink_t) 0)	/* absence of incoming links */
+#define INVAL_UID	       ((uid_t) -1)	/* invalid uid value */
+#define INVAL_GID	       ((gid_t) -1)	/* invalid gid value */
+
+#define SERVARNAME		"cttyline"
+#define ARCHVARNAME		"arch"
+#define BOARDVARNAME		"board"
+#define SERBAUDVARNAME		"cttybaud"
+
+/* Bits for s_flags in the privilege structure. */
+#define PREEMPTIBLE     0x002   /* kernel tasks are not preemptible */
+#define BILLABLE        0x004   /* some processes are not billable */
+#define DYN_PRIV_ID     0x008   /* privilege id assigned dynamically */
+ 
+#define SYS_PROC        0x010   /* system processes have own priv structure */
+#define CHECK_IO_PORT   0x020   /* check if I/O request is allowed */
+#define CHECK_IRQ       0x040   /* check if IRQ can be used */
+#define CHECK_MEM       0x080   /* check if (VM) mem map request is allowed */
+#define ROOT_SYS_PROC   0x100   /* this is a root system process instance */
+#define VM_SYS_PROC     0x200   /* this is a vm system process instance */
+#define LU_SYS_PROC     0x400   /* this is a live updated sys proc instance */
+#define RST_SYS_PROC    0x800   /* this is a restarted sys proc instance */
+
+/* Values for the "verbose" boot monitor variable */
+#define VERBOSEBOOT_QUIET 0
+#define VERBOSEBOOT_BASIC 1
+#define VERBOSEBOOT_EXTRA 2
+#define VERBOSEBOOT_MAX   3
+#define VERBOSEBOOTVARNAME "verbose"
+
+/* magic value to put in struct proc entries for sanity checks. */
+#define PMAGIC 0xC0FFEE1
+
+/* MINIX_KERNFLAGS flags */
+#define MKF_I386_INTEL_SYSENTER	(1L << 0) /* SYSENTER available and supported */
+#define MKF_I386_AMD_SYSCALL	(1L << 1) /* SYSCALL available and supported */
+
+/*
+ * Number of per-CPU states for which time will be accounted.  This *must* be
+ * the same value as NetBSD's CPUSTATES, which is defined in a rather
+ * unfortunate location (sys/sched.h).  If the NetBSD value changes, our kernel
+ * must be adapted accordingly.
+ */
+#define MINIX_CPUSTATES	5
+
+/* Network device driver constants.  TODO: move to a better location. */
+#define NDEV_ETH_PACKET_MIN	60	/* min network packet size, in bytes */
+#define NDEV_ETH_PACKET_MAX	1514	/* max network packet size, in bytes */
+#define NDEV_ETH_PACKET_TAG	4	/* ethernet VLAN tag size, in bytes */
+#define NDEV_ETH_PACKET_CRC	4	/* ethernet CRC size, in bytes */
+#define NDEV_ETH_PACKET_MAX_TAGGED (NDEV_ETH_PACKET_MAX + NDEV_ETH_PACKET_TAG)
+
+#endif /* _MINIX_CONST_H */

Property changes on: lab4/.minix-src/include/minix/const.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/devman.h
===================================================================
--- lab4/.minix-src/include/minix/devman.h	(nonexistent)
+++ lab4/.minix-src/include/minix/devman.h	(revision 13)
@@ -0,0 +1,72 @@
+#ifndef MINIX_LIBDEVMAN_H
+#define MINIX_LIBDEVMAN_H
+#include <minix/com.h>
+#include <minix/ipc.h>
+#include <minix/usb_ch9.h>
+
+/* used for serializing */
+struct devman_device_info {
+	int count;
+	int parent_dev_id;
+	unsigned name_offset;
+	unsigned subsystem_offset;
+};
+
+struct devman_device_info_entry {
+	unsigned type;
+	unsigned name_offset;
+	unsigned data_offset;
+	unsigned req_nr;
+};
+
+#ifndef DEVMAN_SERVER
+struct devman_usb_bind_cb_data {
+	int dev_id;
+	int interface;
+};
+
+struct devman_usb_interface {
+	struct devman_dev *dev;
+	struct devman_usb_dev *usb_dev;
+	usb_interface_descriptor_t *desc;
+	/* used by the lib */
+	struct devman_usb_bind_cb_data cb_data;
+};
+
+struct devman_usb_dev {
+	struct devman_dev *dev;
+	int    dev_id;            /* The ID identifying the device 
+									 on server side */
+	usb_device_descriptor_t *desc;
+
+	int    configuration;        /* the configuration used for this
+	                                device */
+	
+	char   *manufacturer;
+	char   *product;
+	char   *serial;
+
+	int    intf_count;          /* the number of interfaces in the current
+	                               configuration */
+
+	struct devman_usb_interface interfaces[32];
+	/* used by the lib */
+	struct devman_usb_bind_cb_data cb_data;
+};
+
+typedef int (*devman_usb_bind_cb_t)(struct devman_usb_bind_cb_data *data, endpoint_t ep);
+
+int devman_add_device(struct devman_dev *dev);
+int devman_del_device(struct devman_dev *dev);
+int devman_init(void);
+struct devman_usb_dev* devman_usb_device_new(int dev_id);
+int devman_usb_device_add(struct devman_usb_dev *dev);
+int devman_usb_device_remove(struct devman_usb_dev *dev);
+void devman_usb_device_delete(struct devman_usb_dev *udev);
+int devman_handle_msg(message *m);
+void devman_usb_init(devman_usb_bind_cb_t bind_cb, devman_usb_bind_cb_t
+	unbind_cb);
+
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/minix/devman.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/sockdriver.h
===================================================================
--- lab4/.minix-src/include/minix/sockdriver.h	(nonexistent)
+++ lab4/.minix-src/include/minix/sockdriver.h	(revision 13)
@@ -0,0 +1,172 @@
+#ifndef _MINIX_SOCKDRIVER_H
+#define _MINIX_SOCKDRIVER_H
+
+#include <sys/socket.h>
+
+/*
+ * The maximum sockaddr structure size.  All provided address buffers are of
+ * this size.  The socket driver writer must ensure that all the driver's
+ * sockaddr structures fit in this size, increasing this variable as necessary.
+ */
+#define SOCKADDR_MAX	(UINT8_MAX + 1)
+
+/*
+ * Convenience macro to perform static testing of the above assumption.  Usage:
+ *   STATIC_SOCKADDR_MAX_ASSERT(sockaddr_un);
+ */
+#define STATIC_SOCKADDR_MAX_ASSERT(t) \
+	typedef int _STATIC_SOCKADDR_MAX_ASSERT_##t[/* CONSTCOND */ \
+		(sizeof(struct t) <= SOCKADDR_MAX) ? 1 : -1]
+
+/*
+ * The maximum number of I/O vector elements that can be passed to the
+ * sockdriver_vcopy functions.
+ */
+#define SOCKDRIVER_IOV_MAX	SCPVEC_NR
+
+/* Socket identifier.  May also be a negative error code upon call return. */
+typedef int32_t sockid_t;
+
+/* Socket request identifier.  To be used in struct sockdriver_call only. */
+typedef int32_t sockreq_t;
+
+/*
+ * The following structures are all identity transfer (ixfer) safe, meaning
+ * that they are guaranteed not to contain pointers.
+ */
+
+/*
+ * Data structure with call information for later call resumption.  The socket
+ * driver may use the sc_endpt and sc_req fields to index and find suspended
+ * calls for the purpose of cancellation.  A provided sc_endpt value will never
+ * be NONE, so this value may be used to mark the structure as unused, if
+ * needed.  Otherwise, the structure should be copied around as is.  Upon
+ * cancellation, the original call structure must be used to resume the call,
+ * and not the call structure passed to sdr_cancel.
+ */
+struct sockdriver_call {
+	endpoint_t	sc_endpt;	/* endpoint of caller */
+	sockreq_t	sc_req;		/* request identifier */
+	cp_grant_id_t	_sc_grant;	/* address storage grant (private) */
+	size_t		_sc_len;	/* size of address storage (private) */
+};
+
+/*
+ * Data structure for the requesting party of select requests.  The socket
+ * driver may use the ss_endpt field to index and find suspended select calls.
+ * A provided ss_endpt value will never be NONE, so this value may be used to
+ * mark the structure as unused, if needed.  For future compatibility, the
+ * structure should be copied around in its entirety.
+ */
+struct sockdriver_select {
+	endpoint_t	ss_endpt;	/* endpoint of caller */
+};
+
+/* Opaque data structure for copying in and out data. */
+struct sockdriver_data {
+	endpoint_t	_sd_endpt;	/* endpoint of grant owner (private) */
+	cp_grant_id_t	_sd_grant;	/* safecopy grant (private) */
+	size_t		_sd_len;	/* size of granted area (private) */
+};
+
+/*
+ * Opaque data structure that may store the contents of sockdriver_data more
+ * compactly in cases where some of its fields are available through other
+ * means.  Practically, this can save memory when storing suspended calls.
+ */
+struct sockdriver_packed_data {
+	cp_grant_id_t	_spd_grant;	/* safecopy grant (private) */
+};
+
+/* Function call table for socket drivers. */
+struct sockdriver {
+	sockid_t (* sdr_socket)(int domain, int type, int protocol,
+	    endpoint_t user_endpt);
+	int (* sdr_socketpair)(int domain, int type, int protocol,
+	    endpoint_t user_endpt, sockid_t id[2]);
+	int (* sdr_bind)(sockid_t id, const struct sockaddr * __restrict addr,
+	    socklen_t addr_len, endpoint_t user_endpt,
+	    const struct sockdriver_call * __restrict call);
+	int (* sdr_connect)(sockid_t id,
+	    const struct sockaddr * __restrict addr, socklen_t addr_len,
+	    endpoint_t user_endpt,
+	    const struct sockdriver_call * __restrict call);
+	int (* sdr_listen)(sockid_t id, int backlog);
+	sockid_t (* sdr_accept)(sockid_t id, struct sockaddr * __restrict addr,
+	    socklen_t * __restrict addr_len, endpoint_t user_endpt,
+	    const struct sockdriver_call * __restrict call);
+	int (* sdr_send)(sockid_t id,
+	    const struct sockdriver_data * __restrict data, size_t len,
+	    const struct sockdriver_data * __restrict ctl_data,
+	    socklen_t ctl_len, const struct sockaddr * __restrict addr,
+	    socklen_t addr_len, endpoint_t user_endpt, int flags,
+	    const struct sockdriver_call * __restrict call);
+	int (* sdr_recv)(sockid_t id,
+	    const struct sockdriver_data * __restrict data, size_t len,
+	    const struct sockdriver_data * __restrict ctl_data,
+	    socklen_t * __restrict ctl_len, struct sockaddr * __restrict addr,
+	    socklen_t * __restrict addr_len, endpoint_t user_endpt,
+	    int * __restrict flags,
+	    const struct sockdriver_call * __restrict call);
+	int (* sdr_ioctl)(sockid_t id, unsigned long request,
+	    const struct sockdriver_data * __restrict data,
+	    endpoint_t user_endpt,
+	    const struct sockdriver_call * __restrict call);
+	int (* sdr_setsockopt)(sockid_t id, int level, int name,
+	    const struct sockdriver_data * data, socklen_t len);
+	int (* sdr_getsockopt)(sockid_t id, int level, int name,
+	    const struct sockdriver_data * __restrict data,
+	    socklen_t * __restrict len);
+	int (* sdr_getsockname)(sockid_t id, struct sockaddr * __restrict addr,
+	    socklen_t * __restrict addr_len);
+	int (* sdr_getpeername)(sockid_t id, struct sockaddr * __restrict addr,
+	    socklen_t * __restrict addr_len);
+	int (* sdr_shutdown)(sockid_t id, int how);
+	int (* sdr_close)(sockid_t id, const struct sockdriver_call * call);
+	void (* sdr_cancel)(sockid_t id, const struct sockdriver_call * call);
+	int (* sdr_select)(sockid_t id, unsigned int ops,
+	    const struct sockdriver_select * sel);
+	void (* sdr_alarm)(clock_t stamp);
+	void (* sdr_other)(const message * m_ptr, int ipc_status);
+};
+
+/* Functions defined by libsockdriver. */
+void sockdriver_announce(void);
+void sockdriver_process(const struct sockdriver * __restrict sdp,
+	const message * __restrict m_ptr, int ipc_status);
+void sockdriver_terminate(void);
+void sockdriver_task(const struct sockdriver * sdp);
+
+void sockdriver_reply_generic(const struct sockdriver_call * call, int reply);
+void sockdriver_reply_accept(const struct sockdriver_call * __restrict call,
+	sockid_t reply, struct sockaddr * __restrict addr, socklen_t addr_len);
+void sockdriver_reply_recv(const struct sockdriver_call * __restrict call,
+	int reply, socklen_t ctl_len, struct sockaddr * __restrict addr,
+	socklen_t addr_len, int flags);
+void sockdriver_reply_select(const struct sockdriver_select * sel, sockid_t id,
+	int ops);
+
+int sockdriver_copyin(const struct sockdriver_data * __restrict data,
+	size_t off, void * __restrict ptr, size_t len);
+int sockdriver_copyout(const struct sockdriver_data * __restrict data,
+	size_t off, const void * __restrict ptr, size_t len);
+
+int sockdriver_vcopyin(const struct sockdriver_data * __restrict data,
+	size_t off, const iovec_t * iov, unsigned int iovcnt);
+int sockdriver_vcopyout(const struct sockdriver_data * __restrict data,
+	size_t off, const iovec_t * iov, unsigned int iovcnt);
+
+int sockdriver_copyin_opt(const struct sockdriver_data * __restrict data,
+	void * __restrict ptr, size_t len, socklen_t optlen);
+int sockdriver_copyout_opt(const struct sockdriver_data * __restrict data,
+	const void * __restrict ptr, size_t len,
+	socklen_t * __restrict optlen);
+
+int sockdriver_pack_data(struct sockdriver_packed_data * pack,
+	const struct sockdriver_call * call,
+	const struct sockdriver_data * data, size_t len);
+void sockdriver_unpack_data(struct sockdriver_data * data,
+	const struct sockdriver_call * call,
+	const struct sockdriver_packed_data * pack, size_t len);
+
+#endif /* !_MINIX_SOCKDRIVER_H */

Property changes on: lab4/.minix-src/include/minix/sockdriver.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/sys_config.h
===================================================================
--- lab4/.minix-src/include/minix/sys_config.h	(nonexistent)
+++ lab4/.minix-src/include/minix/sys_config.h	(revision 13)
@@ -0,0 +1,27 @@
+#ifndef _MINIX_SYS_CONFIG_H
+#define _MINIX_SYS_CONFIG_H 1
+
+/*===========================================================================*
+ *		This section contains user-settable parameters		     *
+ *===========================================================================*/
+
+#define _NR_PROCS	256
+#define _NR_SYS_PROCS	64
+
+/* Set the FP_FORMAT type based on the machine selected, either hw or sw    */
+#define _FP_NONE		  0	/* no floating point support                */
+#define _FP_IEEE		  1	/* conform IEEE floating point standard     */
+
+#ifndef _MINIX_FP_FORMAT
+#define _MINIX_FP_FORMAT   _FP_NONE
+#endif
+
+/* Kernel debug checks */
+#define DEBUG_LOCK_CHECK 1	/* Interrupt Lock/unlock sanity checking. */
+
+#define _KMESS_BUF_SIZE  10000
+
+/* Default stack size (limit) */
+#define DEFAULT_STACK_LIMIT (4 * 1024 * 1024)
+
+#endif /* _MINIX_SYS_CONFIG_H */

Property changes on: lab4/.minix-src/include/minix/sys_config.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/keymap.h
===================================================================
--- lab4/.minix-src/include/minix/keymap.h	(nonexistent)
+++ lab4/.minix-src/include/minix/keymap.h	(revision 13)
@@ -0,0 +1,169 @@
+/*	keymap.h - defines for keymapping		Author: Marcus Hampel
+ */
+#ifndef _SYS__KEYMAP_H
+#define _SYS__KEYMAP_H
+
+#define K(k)	[INPUT_KEY_ ## k]	/* Map to key entry */
+
+#define	C(c)	((c) & 0x1F)	/* Map to control code		*/
+#define A(c)	((c) | 0x80)	/* Set eight bit (ALT)		*/
+#define CA(c)	A(C(c))		/* Control-Alt			*/
+#define	N(c)	((c) | HASNUM)	/* Add "Num Lock has effect" attribute */
+#define	L(c)	((c) | HASCAPS)	/* Add "Caps Lock has effect" attribute */
+
+#define EXT	0x0100		/* Normal function keys		*/
+#define CTRLKEY	0x0200		/* Control key			*/
+#define SHIFT	0x0400		/* Shift key			*/
+#define ALT	0x0800		/* Alternate key		*/
+#define HASNUM	0x4000		/* Num Lock has effect		*/
+#define HASCAPS	0x8000		/* Caps Lock has effect		*/
+
+/* The left and right versions for the actual keys in the keymap. */
+#define LCTRL	CTRLKEY
+#define RCTRL	(CTRLKEY | EXT)
+#define LSHIFT	SHIFT
+#define RSHIFT	(SHIFT | EXT)
+#define LALT	ALT
+#define RALT	(ALT | EXT)
+
+/* Delete key */
+#define DEL	0177
+
+/* Numeric keypad */
+#define HOME	(0x01 + EXT)
+#define END	(0x02 + EXT)
+#define UP	(0x03 + EXT)
+#define DOWN	(0x04 + EXT)
+#define LEFT	(0x05 + EXT)
+#define RIGHT	(0x06 + EXT)
+#define PGUP	(0x07 + EXT)
+#define PGDN	(0x08 + EXT)
+#define MID	(0x09 + EXT)
+/* UNUSED	(0x0A + EXT) */
+/* UNUSED	(0x0B + EXT) */
+#define INSRT	(0x0C + EXT)
+
+/* Keys affected by Num Lock */
+#define NHOME	N(HOME)
+#define NEND	N(END)
+#define NUP	N(UP)
+#define NDOWN	N(DOWN)
+#define NLEFT	N(LEFT)
+#define NRIGHT	N(RIGHT)
+#define NPGUP	N(PGUP)
+#define NPGDN	N(PGDN)
+#define NMID	N(MID)
+#define NINSRT	N(INSRT)
+#define NDEL	N(DEL)
+
+/* Alt + Numeric keypad */
+#define AHOME	(0x01 + ALT)
+#define AEND	(0x02 + ALT)
+#define AUP	(0x03 + ALT)
+#define ADOWN	(0x04 + ALT)
+#define ALEFT	(0x05 + ALT)
+#define ARIGHT	(0x06 + ALT)
+#define APGUP	(0x07 + ALT)
+#define APGDN	(0x08 + ALT)
+#define AMID	(0x09 + ALT)
+#define AMIN	(0x0A + ALT)
+#define APLUS	(0x0B + ALT)
+#define AINSRT	(0x0C + ALT)
+
+/* Ctrl + Numeric keypad */
+#define CHOME	(0x01 + CTRLKEY)
+#define CEND	(0x02 + CTRLKEY)
+#define CUP	(0x03 + CTRLKEY)
+#define CDOWN	(0x04 + CTRLKEY)
+#define CLEFT	(0x05 + CTRLKEY)
+#define CRIGHT	(0x06 + CTRLKEY)
+#define CPGUP	(0x07 + CTRLKEY)
+#define CPGDN	(0x08 + CTRLKEY)
+#define CMID	(0x09 + CTRLKEY)
+#define CNMIN	(0x0A + CTRLKEY)
+#define CPLUS	(0x0B + CTRLKEY)
+#define CINSRT	(0x0C + CTRLKEY)
+
+/* Lock keys */
+#define CALOCK	(0x0D + EXT)	/* caps lock	*/
+#define	NLOCK	(0x0E + EXT)	/* number lock	*/
+#define SLOCK	(0x0F + EXT)	/* scroll lock	*/
+
+/* Function keys */
+#define F1	(0x10 + EXT)
+#define F2	(0x11 + EXT)
+#define F3	(0x12 + EXT)
+#define F4	(0x13 + EXT)
+#define F5	(0x14 + EXT)
+#define F6	(0x15 + EXT)
+#define F7	(0x16 + EXT)
+#define F8	(0x17 + EXT)
+#define F9	(0x18 + EXT)
+#define F10	(0x19 + EXT)
+#define F11	(0x1A + EXT)
+#define F12	(0x1B + EXT)
+
+/* Alt+Fn */
+#define AF1	(0x10 + ALT)
+#define AF2	(0x11 + ALT)
+#define AF3	(0x12 + ALT)
+#define AF4	(0x13 + ALT)
+#define AF5	(0x14 + ALT)
+#define AF6	(0x15 + ALT)
+#define AF7	(0x16 + ALT)
+#define AF8	(0x17 + ALT)
+#define AF9	(0x18 + ALT)
+#define AF10	(0x19 + ALT)
+#define AF11	(0x1A + ALT)
+#define AF12	(0x1B + ALT)
+
+/* Ctrl+Fn */
+#define CF1	(0x10 + CTRLKEY)
+#define CF2	(0x11 + CTRLKEY)
+#define CF3	(0x12 + CTRLKEY)
+#define CF4	(0x13 + CTRLKEY)
+#define CF5	(0x14 + CTRLKEY)
+#define CF6	(0x15 + CTRLKEY)
+#define CF7	(0x16 + CTRLKEY)
+#define CF8	(0x17 + CTRLKEY)
+#define CF9	(0x18 + CTRLKEY)
+#define CF10	(0x19 + CTRLKEY)
+#define CF11	(0x1A + CTRLKEY)
+#define CF12	(0x1B + CTRLKEY)
+
+/* Shift+Fn */
+#define SF1	(0x10 + SHIFT)
+#define SF2	(0x11 + SHIFT)
+#define SF3	(0x12 + SHIFT)
+#define SF4	(0x13 + SHIFT)
+#define SF5	(0x14 + SHIFT)
+#define SF6	(0x15 + SHIFT)
+#define SF7	(0x16 + SHIFT)
+#define SF8	(0x17 + SHIFT)
+#define SF9	(0x18 + SHIFT)
+#define SF10	(0x19 + SHIFT)
+#define SF11	(0x1A + SHIFT)
+#define SF12	(0x1B + SHIFT)
+
+/* Alt+Shift+Fn */
+#define ASF1	(0x10 + ALT + SHIFT)
+#define ASF2	(0x11 + ALT + SHIFT)
+#define ASF3	(0x12 + ALT + SHIFT)
+#define ASF4	(0x13 + ALT + SHIFT)
+#define ASF5	(0x14 + ALT + SHIFT)
+#define ASF6	(0x15 + ALT + SHIFT)
+#define ASF7	(0x16 + ALT + SHIFT)
+#define ASF8	(0x17 + ALT + SHIFT)
+#define ASF9	(0x18 + ALT + SHIFT)
+#define ASF10	(0x19 + ALT + SHIFT)
+#define ASF11	(0x1A + ALT + SHIFT)
+#define ASF12	(0x1B + ALT + SHIFT)
+
+#define MAP_COLS	6	/* Number of columns in keymap */
+#define NR_SCAN_CODES	0xE8	/* Number of scan codes (rows in keymap) */
+
+typedef uint16_t keymap_t[NR_SCAN_CODES][MAP_COLS];
+
+#define KEY_MAGIC	"KMAZ"	/* Magic number of keymap file */
+
+#endif /* _SYS__KEYMAP_H */

Property changes on: lab4/.minix-src/include/minix/keymap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/mmio.h
===================================================================
--- lab4/.minix-src/include/minix/mmio.h	(nonexistent)
+++ lab4/.minix-src/include/minix/mmio.h	(revision 13)
@@ -0,0 +1,62 @@
+#ifndef __MMIO_H__
+#define __MMIO_H__
+
+#define REG16(x)(*((volatile uint16_t *)(x)))
+#define REG(x)(*((volatile uint32_t *)(x)))
+#define BIT(x)(0x1 << x)
+
+/* Write a uint32_t value to a memory address. */
+static inline void
+write32(uint32_t address, uint32_t value)
+{
+	REG(address) = value;
+}
+
+/* Read an uint32_t from a memory address */
+static inline uint32_t
+read32(uint32_t address)
+{
+	return REG(address);
+}
+
+/* Set a 32 bits value depending on a mask */
+static inline void
+set32(uint32_t address, uint32_t mask, uint32_t value)
+{
+	uint32_t val;
+	val = read32(address);
+	/* clear the bits */
+	val &= ~(mask);
+	/* apply the value using the mask */
+	val |= (value & mask);
+	write32(address, val);
+}
+
+/* Write a uint16_t value to a memory address. */
+static inline void
+write16(uint32_t address, uint16_t value)
+{
+	REG16(address) = value;
+}
+
+/* Read an uint16_t from a memory address */
+static inline uint16_t
+read16(uint32_t address)
+{
+	return REG16(address);
+}
+
+/* Set a 16 bits value depending on a mask */
+static inline void
+set16(uint32_t address, uint16_t mask, uint16_t value)
+{
+	uint16_t val;
+	val = read16(address);
+	/* clear the bits */
+	val &= ~(mask);
+	/* apply the value using the mask */
+	val |= (value & mask);
+	write16(address, val);
+}
+
+#endif /* __MMIO_H__ */

Property changes on: lab4/.minix-src/include/minix/mmio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/sysutil.h
===================================================================
--- lab4/.minix-src/include/minix/sysutil.h	(nonexistent)
+++ lab4/.minix-src/include/minix/sysutil.h	(revision 13)
@@ -0,0 +1,116 @@
+#ifndef _MINIX_SYSUTIL_H
+#define _MINIX_SYSUTIL_H 1
+
+#include <minix/ipc.h>
+#include <sys/cdefs.h>
+
+/* Extra system library definitions to support device drivers and servers.
+ *
+ * Created:
+ *	Mar 15, 2004 by Jorrit N. Herder
+ *
+ * Changes:
+ *	May 31, 2005: added printf, kputc (relocated from syslib)
+ *	May 31, 2005: added getuptime
+ *	Mar 18, 2005: added tickdelay
+ *	Oct 01, 2004: added env_parse, env_panic
+ *	Jul 13, 2004: added fkey_ctl
+ *	Apr 28, 2004: added report, panic 
+ *	Mar 31, 2004: setup like other libraries, such as syslib
+ */
+
+/*==========================================================================* 
+ * Miscellaneous helper functions.
+ *==========================================================================*/ 
+
+/* Environment parsing return values. */
+#define EP_BUF_SIZE   128	/* local buffer for env value */
+#define EP_UNSET	0	/* variable not set */
+#define EP_OFF		1	/* var = off */
+#define EP_ON		2	/* var = on (or field left blank) */
+#define EP_SET		3	/* var = 1:2:3 (nonblank field) */
+#define EP_EGETKENV	4	/* sys_getkenv() failed ... */
+
+extern int env_argc;
+extern char **env_argv;
+
+void env_setargs(int argc, char *argv[]);
+int env_get_param(const char *key, char *value, int max_size);
+void __dead env_panic(const char *key);
+int env_parse(const char *env, const char *fmt, int field,
+	long *param, long min, long max);
+
+#define fkey_map(fkeys, sfkeys) fkey_ctl(FKEY_MAP, (fkeys), (sfkeys))
+#define fkey_unmap(fkeys, sfkeys) fkey_ctl(FKEY_UNMAP, (fkeys), (sfkeys))
+#define fkey_events(fkeys, sfkeys) fkey_ctl(FKEY_EVENTS, (fkeys), (sfkeys))
+int fkey_ctl(int req, int *fkeys, int *sfkeys);
+
+struct timespec;
+
+int printf(const char *fmt, ...);
+void kputc(int c);
+__dead void panic(const char *fmt, ...)
+     __attribute__((__format__(__printf__,1,2)));
+void panic_hook(void);
+void __panic_hook(void);
+int getuptime(clock_t *ticks, clock_t *realtime, time_t *boottime);
+clock_t getticks(void);
+int tickdelay(clock_t ticks);
+int tsc_calibrate(void);
+u32_t sys_hz(void);
+double getidle(void);
+void util_stacktrace(void);
+int micro_delay(u32_t micros);
+u32_t tsc_64_to_micros(u64_t tsc);
+u32_t tsc_to_micros(u32_t low, u32_t high);
+u32_t tsc_get_khz(void);
+u32_t micros_to_ticks(u32_t micros);
+time_t clock_time(struct timespec *tv);
+#if defined(__arm__)
+void read_frclock(u32_t *frclk);
+u32_t delta_frclock(u32_t base, u32_t cur);
+#endif
+void read_frclock_64(u64_t *frclk);
+u64_t delta_frclock_64(u64_t base, u64_t cur);
+u32_t frclock_64_to_micros(u64_t tsc);
+void ser_putc(char c);
+void get_randomness(struct k_randomness *, int);
+u32_t sqrt_approx(u32_t);
+
+int stime(time_t *_top);
+
+void cpuavg_init(struct cpuavg *);
+void cpuavg_increment(struct cpuavg *, clock_t, clock_t);
+uint32_t cpuavg_getstats(const struct cpuavg *, uint32_t *, uint32_t *,
+	clock_t, clock_t);
+uint32_t cpuavg_getccpu(void);
+
+#define asynsend(ep, msg) asynsend3(ep, msg, 0)
+int asynsend3(endpoint_t ep, message *msg, int flags);
+int asyn_geterror(endpoint_t *dst, message *msg, int *err);
+int senda_reload(void);
+
+#define ASSERT(c) if(!(c)) { panic("%s:%d: assert %s failed", __FILE__, __LINE__, #c); }
+
+/* timing library */
+#define TIMING_CATEGORIES       20
+
+#define TIMING_POINTS           20      /* timing resolution */
+#define TIMING_CATEGORIES       20
+#define TIMING_NAME             10
+
+struct util_timingdata {
+        char names[TIMING_NAME];
+        unsigned long lock_timings[TIMING_POINTS]; 
+        unsigned long lock_timings_range[2];
+        unsigned long binsize, resets, misses, measurements;
+	unsigned long starttimes[2];	/* nonzero if running */
+};
+
+typedef struct util_timingdata util_timingdata_t;
+
+/* GCOV support (not always compiled in) */
+int gcov_flush(endpoint_t endpt, cp_grant_id_t grant, size_t bufsize);
+
+#endif /* _MINIX_SYSUTIL_H */
+

Property changes on: lab4/.minix-src/include/minix/sysutil.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/drvlib.h
===================================================================
--- lab4/.minix-src/include/minix/drvlib.h	(nonexistent)
+++ lab4/.minix-src/include/minix/drvlib.h	(revision 13)
@@ -0,0 +1,18 @@
+/* IBM device driver definitions			Author: Kees J. Bot
+ *								7 Dec 1995
+ */
+
+#include <machine/partition.h>
+
+void partition(struct blockdriver *bdr, int device, int style, int
+	atapi);
+
+#define DEV_PER_DRIVE	(1 + NR_PARTITIONS)
+#define SUB_PER_DRIVE	(NR_PARTITIONS * NR_PARTITIONS)
+#define MINOR_t0	64
+#define MINOR_r0	120
+#define MINOR_d0p0s0	128
+#define MINOR_fd0p0	(28<<2)
+#define P_FLOPPY	0
+#define P_PRIMARY	1
+#define P_SUB		2

Property changes on: lab4/.minix-src/include/minix/drvlib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/padconf.h
===================================================================
--- lab4/.minix-src/include/minix/padconf.h	(nonexistent)
+++ lab4/.minix-src/include/minix/padconf.h	(revision 13)
@@ -0,0 +1,322 @@
+#ifndef __MINIX_PADCONF_H
+#define __MINIX_PADCONF_H
+
+/* Define the start address of the padconf registers and the size of the block.
+ * The base must be page aligned, so we round down and the kernel adds the
+ * offset. The size must be a multiple of ARM_PAGE_SIZE, so we round up to 4KB.
+ */
+#define PADCONF_AM335X_REGISTERS_BASE 0x44E10000
+#define PADCONF_AM335X_REGISTERS_OFFSET 0x0000
+#define PADCONF_AM335X_REGISTERS_SIZE 0x1000 /* OFFSET + highest reg, rounded up */
+#define PADCONF_DM37XX_REGISTERS_BASE 0x48002000
+#define PADCONF_DM37XX_REGISTERS_OFFSET 0x0030
+#define PADCONF_DM37XX_REGISTERS_SIZE 0x1000 /* OFFSET + highest reg, rounded up */
+
+#define PADCONF_MUXMODE(X)  (X & 0x7)	/* mode 1 til 7 [2:0] */
+#define PADCONF_PULL_MODE(X)  ((X & 0x3) << 3)	/* 2 bits[4:3] */
+#define PADCONF_PULL_MODE_PD_DIS PADCONF_PULL_MODE(0)	/* pull down disabled */
+#define PADCONF_PULL_MODE_PD_EN PADCONF_PULL_MODE(1)	/* pull down enabled */
+#define PADCONF_PULL_MODE_PU_DIS PADCONF_PULL_MODE(2)	/* pull up disabled */
+#define PADCONF_PULL_MODE_PU_EN PADCONF_PULL_MODE(3)	/* pull up enabled */
+#define PADCONF_INPUT_ENABLE(X)  ((X & 0x1) << 8)	/* 1 bits[8] */
+#define PADCONF_OFF_MODE(X)  ((X & 0xFE) << 9)	/* 5 bits[13:9] */
+
+/* padconf pin definitions */
+#define CONTROL_PADCONF_SDRC_D0 (0x00000000)
+#define CONTROL_PADCONF_SDRC_D2 (0x00000004)
+#define CONTROL_PADCONF_SDRC_D4 (0x00000008)
+#define CONTROL_PADCONF_SDRC_D6 (0x0000000C)
+#define CONTROL_PADCONF_SDRC_D8 (0x00000010)
+#define CONTROL_PADCONF_SDRC_D10 (0x00000014)
+#define CONTROL_PADCONF_SDRC_D12 (0x00000018)
+#define CONTROL_PADCONF_SDRC_D14 (0x0000001C)
+#define CONTROL_PADCONF_SDRC_D16 (0x00000020)
+#define CONTROL_PADCONF_SDRC_D18 (0x00000024)
+#define CONTROL_PADCONF_SDRC_D20 (0x00000028)
+#define CONTROL_PADCONF_SDRC_D22 (0x0000002C)
+#define CONTROL_PADCONF_SDRC_D24 (0x00000030)
+#define CONTROL_PADCONF_SDRC_D26 (0x00000034)
+#define CONTROL_PADCONF_SDRC_D28 (0x00000038)
+#define CONTROL_PADCONF_SDRC_D30 (0x0000003C)
+#define CONTROL_PADCONF_SDRC_CLK (0x00000040)
+#define CONTROL_PADCONF_SDRC_DQS1 (0x00000044)
+#define CONTROL_PADCONF_SDRC_DQS3 (0x00000048)
+#define CONTROL_PADCONF_GPMC_A2 (0x0000004C)
+#define CONTROL_PADCONF_GPMC_A4 (0x00000050)
+#define CONTROL_PADCONF_GPMC_A6 (0x00000054)
+#define CONTROL_PADCONF_GPMC_A8 (0x00000058)
+#define CONTROL_PADCONF_GPMC_A10 (0x0000005C)
+#define CONTROL_PADCONF_GPMC_D1 (0x00000060)
+#define CONTROL_PADCONF_GPMC_D3 (0x00000064)
+#define CONTROL_PADCONF_GPMC_D5 (0x00000068)
+#define CONTROL_PADCONF_GPMC_D7 (0x0000006C)
+#define CONTROL_PADCONF_GPMC_D9 (0x00000070)
+#define CONTROL_PADCONF_GPMC_D11 (0x00000074)
+#define CONTROL_PADCONF_GPMC_D13 (0x00000078)
+#define CONTROL_PADCONF_GPMC_D15 (0x0000007C)
+#define CONTROL_PADCONF_GPMC_NCS1 (0x00000080)
+#define CONTROL_PADCONF_GPMC_NCS3 (0x00000084)
+#define CONTROL_PADCONF_GPMC_NCS5 (0x00000088)
+#define CONTROL_PADCONF_GPMC_NCS7 (0x0000008C)
+#define CONTROL_PADCONF_GPMC_NADV_ALE (0x00000090)
+#define CONTROL_PADCONF_GPMC_NWE (0x00000094)
+#define CONTROL_PADCONF_GPMC_NBE1 (0x00000098)
+#define CONTROL_PADCONF_GPMC_WAIT0 (0x0000009C)
+#define CONTROL_PADCONF_GPMC_WAIT2 (0x000000A0)
+#define CONTROL_PADCONF_DSS_PCLK (0x000000A4)
+#define CONTROL_PADCONF_DSS_VSYNC (0x000000A8)
+#define CONTROL_PADCONF_DSS_DATA0 (0x000000AC)
+#define CONTROL_PADCONF_DSS_DATA2 (0x000000B0)
+#define CONTROL_PADCONF_DSS_DATA4 (0x000000B4)
+#define CONTROL_PADCONF_DSS_DATA6 (0x000000B8)
+#define CONTROL_PADCONF_DSS_DATA8 (0x000000BC)
+#define CONTROL_PADCONF_DSS_DATA10 (0x000000C0)
+#define CONTROL_PADCONF_DSS_DATA12 (0x000000C4)
+#define CONTROL_PADCONF_DSS_DATA14 (0x000000C8)
+#define CONTROL_PADCONF_DSS_DATA16 (0x000000CC)
+#define CONTROL_PADCONF_DSS_DATA18 (0x000000D0)
+#define CONTROL_PADCONF_DSS_DATA20 (0x000000D4)
+#define CONTROL_PADCONF_DSS_DATA22 (0x000000D8)
+#define CONTROL_PADCONF_CAM_HS (0x000000DC)
+#define CONTROL_PADCONF_CAM_XCLKA (0x000000E0)
+#define CONTROL_PADCONF_CAM_FLD (0x000000E4)
+#define CONTROL_PADCONF_CAM_D1 (0x000000E8)
+#define CONTROL_PADCONF_CAM_D3 (0x000000EC)
+#define CONTROL_PADCONF_CAM_D5 (0x000000F0)
+#define CONTROL_PADCONF_CAM_D7 (0x000000F4)
+#define CONTROL_PADCONF_CAM_D9 (0x000000F8)
+#define CONTROL_PADCONF_CAM_D11 (0x000000FC)
+#define CONTROL_PADCONF_CAM_WEN (0x00000100)
+#define CONTROL_PADCONF_CSI2_DX0 (0x00000104)
+#define CONTROL_PADCONF_CSI2_DX1 (0x00000108)
+#define CONTROL_PADCONF_MCBSP2_FSX (0x0000010C)
+#define CONTROL_PADCONF_MCBSP2_DR (0x00000110)
+#define CONTROL_PADCONF_MMC1_CLK (0x00000114)
+#define CONTROL_PADCONF_MMC1_DAT0 (0x00000118)
+#define CONTROL_PADCONF_MMC1_DAT2 (0x0000011C)
+#define CONTROL_PADCONF_MMC2_CLK (0x00000128)
+#define CONTROL_PADCONF_MMC2_DAT0 (0x0000012C)
+#define CONTROL_PADCONF_MMC2_DAT2 (0x00000130)
+#define CONTROL_PADCONF_MMC2_DAT4 (0x00000134)
+#define CONTROL_PADCONF_MMC2_DAT6 (0x00000138)
+#define CONTROL_PADCONF_MCBSP3_DX (0x0000013C)
+#define CONTROL_PADCONF_MCBSP3_CLKX (0x00000140)
+#define CONTROL_PADCONF_UART2_CTS (0x00000144)
+#define CONTROL_PADCONF_UART2_TX (0x00000148)
+#define CONTROL_PADCONF_UART1_TX (0x0000014C)
+#define CONTROL_PADCONF_UART1_CTS (0x00000150)
+#define CONTROL_PADCONF_MCBSP4_CLKX (0x00000154)
+#define CONTROL_PADCONF_MCBSP4_DX (0x00000158)
+#define CONTROL_PADCONF_MCBSP1_CLKR (0x0000015C)
+#define CONTROL_PADCONF_MCBSP1_DX (0x00000160)
+#define CONTROL_PADCONF_MCBSP_CLKS (0x00000164)
+#define CONTROL_PADCONF_MCBSP1_CLKX (0x00000168)
+#define CONTROL_PADCONF_UART3_RTS_SD (0x0000016C)
+#define CONTROL_PADCONF_UART3_TX_IRTX (0x00000170)
+#define CONTROL_PADCONF_HSUSB0_STP (0x00000174)
+#define CONTROL_PADCONF_HSUSB0_NXT (0x00000178)
+#define CONTROL_PADCONF_HSUSB0_DATA1 (0x0000017C)
+#define CONTROL_PADCONF_HSUSB0_DATA3 (0x00000180)
+#define CONTROL_PADCONF_HSUSB0_DATA5 (0x00000184)
+#define CONTROL_PADCONF_HSUSB0_DATA7 (0x00000188)
+#define CONTROL_PADCONF_I2C1_SDA (0x0000018C)
+#define CONTROL_PADCONF_I2C2_SDA (0x00000190)
+#define CONTROL_PADCONF_I2C3_SDA (0x00000194)
+#define CONTROL_PADCONF_MCSPI1_CLK (0x00000198)
+#define CONTROL_PADCONF_MCSPI1_SOMI (0x0000019C)
+#define CONTROL_PADCONF_MCSPI1_CS1 (0x000001A0)
+#define CONTROL_PADCONF_MCSPI1_CS3 (0x000001A4)
+#define CONTROL_PADCONF_MCSPI2_SIMO (0x000001A8)
+#define CONTROL_PADCONF_MCSPI2_CS0 (0x000001AC)
+#define CONTROL_PADCONF_SYS_NIRQ (0x000001B0)
+#define CONTROL_PADCONF_SAD2D_MCAD0 (0x000001B4)
+#define CONTROL_PADCONF_SAD2D_MCAD2 (0x000001B8)
+#define CONTROL_PADCONF_SAD2D_MCAD4 (0x000001BC)
+#define CONTROL_PADCONF_SAD2D_MCAD6 (0x000001C0)
+#define CONTROL_PADCONF_SAD2D_MCAD8 (0x000001C4)
+#define CONTROL_PADCONF_SAD2D_MCAD10 (0x000001C8)
+#define CONTROL_PADCONF_SAD2D_MCAD12 (0x000001CC)
+#define CONTROL_PADCONF_SAD2D_MCAD14 (0x000001D0)
+#define CONTROL_PADCONF_SAD2D_MCAD16 (0x000001D4)
+#define CONTROL_PADCONF_SAD2D_MCAD18 (0x000001D8)
+#define CONTROL_PADCONF_SAD2D_MCAD20 (0x000001DC)
+#define CONTROL_PADCONF_SAD2D_MCAD22 (0x000001E0)
+#define CONTROL_PADCONF_SAD2D_MCAD24 (0x000001E4)
+#define CONTROL_PADCONF_SAD2D_MCAD26 (0x000001E8)
+#define CONTROL_PADCONF_SAD2D_MCAD28 (0x000001EC)
+#define CONTROL_PADCONF_SAD2D_MCAD30 (0x000001F0)
+#define CONTROL_PADCONF_SAD2D_MCAD32 (0x000001F4)
+#define CONTROL_PADCONF_SAD2D_MCAD34 (0x000001F8)
+#define CONTROL_PADCONF_SAD2D_MCAD36 (0x000001FC)
+#define CONTROL_PADCONF_SAD2D_NRESPWRON (0x00000200)
+#define CONTROL_PADCONF_SAD2D_ARMNIRQ (0x00000204)
+#define CONTROL_PADCONF_SAD2D_SPINT (0x00000208)
+#define CONTROL_PADCONF_SAD2D_DMAREQ0 (0x0000020C)
+#define CONTROL_PADCONF_SAD2D_DMAREQ2 (0x00000210)
+#define CONTROL_PADCONF_SAD2D_NTRST (0x00000214)
+#define CONTROL_PADCONF_SAD2D_TDO (0x00000218)
+#define CONTROL_PADCONF_SAD2D_TCK (0x0000021C)
+#define CONTROL_PADCONF_SAD2D_MSTDBY (0x00000220)
+#define CONTROL_PADCONF_SAD2D_IDLEACK (0x00000224)
+#define CONTROL_PADCONF_SAD2D_SWRITE (0x00000228)
+#define CONTROL_PADCONF_SAD2D_SREAD (0x0000022C)
+#define CONTROL_PADCONF_SAD2D_SBUSFLAG (0x00000230)
+#define CONTROL_PADCONF_SDRC_CKE1 (0x00000234)
+#define CONTROL_PADCONF_SDRC_BA0 (0x00000570)
+#define CONTROL_PADCONF_SDRC_A0 (0x00000574)
+#define CONTROL_PADCONF_SDRC_A2 (0x00000578)
+#define CONTROL_PADCONF_SDRC_A4 (0x0000057C)
+#define CONTROL_PADCONF_SDRC_A6 (0x00000580)
+#define CONTROL_PADCONF_SDRC_A8 (0x00000584)
+#define CONTROL_PADCONF_SDRC_A10 (0x00000588)
+#define CONTROL_PADCONF_SDRC_A12 (0x0000058C)
+#define CONTROL_PADCONF_SDRC_A14 (0x00000590)
+#define CONTROL_PADCONF_SDRC_NCS1 (0x00000594)
+#define CONTROL_PADCONF_SDRC_NRAS (0x00000598)
+#define CONTROL_PADCONF_SDRC_NWE (0x0000059C)
+#define CONTROL_PADCONF_SDRC_DM1 (0x000005A0)
+#define CONTROL_PADCONF_SDRC_DM3 (0x000005A4)
+#define CONTROL_PADCONF_ETK_CLK (0x000005A8)
+#define CONTROL_PADCONF_ETK_D0 (0x000005AC)
+#define CONTROL_PADCONF_ETK_D2 (0x000005B0)
+#define CONTROL_PADCONF_ETK_D4 (0x000005B4)
+#define CONTROL_PADCONF_ETK_D6 (0x000005B8)
+#define CONTROL_PADCONF_ETK_D8 (0x000005BC)
+#define CONTROL_PADCONF_ETK_D10 (0x000005C0)
+#define CONTROL_PADCONF_ETK_D12 (0x000005C4)
+#define CONTROL_PADCONF_ETK_D14 (0x000005C8)
+
+/* conf pin descriptions (am335x) */
+#define CONTROL_CONF_GPMC_AD0 (0x00000800)
+#define CONTROL_CONF_GPMC_AD1 (0x00000804)
+#define CONTROL_CONF_GPMC_AD2 (0x00000808)
+#define CONTROL_CONF_GPMC_AD3 (0x0000080C)
+#define CONTROL_CONF_GPMC_AD4 (0x00000810)
+#define CONTROL_CONF_GPMC_AD5 (0x00000814)
+#define CONTROL_CONF_GPMC_AD6 (0x00000818)
+#define CONTROL_CONF_GPMC_AD7 (0x0000081C)
+#define CONTROL_CONF_GPMC_AD8 (0x00000820)
+#define CONTROL_CONF_GPMC_AD9 (0x00000824)
+#define CONTROL_CONF_GPMC_AD10 (0x00000828)
+#define CONTROL_CONF_GPMC_AD11 (0x0000082C)
+#define CONTROL_CONF_GPMC_AD12 (0x00000830)
+#define CONTROL_CONF_GPMC_AD13 (0x00000834)
+#define CONTROL_CONF_GPMC_AD14 (0x00000838)
+#define CONTROL_CONF_GPMC_AD15 (0x0000083C)
+#define CONTROL_CONF_GPMC_A0 (0x00000840)
+#define CONTROL_CONF_GPMC_A1 (0x00000844)
+#define CONTROL_CONF_GPMC_A2 (0x00000848)
+#define CONTROL_CONF_GPMC_A3 (0x0000084C)
+#define CONTROL_CONF_GPMC_A4 (0x00000850)
+#define CONTROL_CONF_GPMC_A5 (0x00000854)
+#define CONTROL_CONF_GPMC_A6 (0x00000858)
+#define CONTROL_CONF_GPMC_A7 (0x0000085C)
+#define CONTROL_CONF_GPMC_A8 (0x00000860)
+#define CONTROL_CONF_GPMC_A9 (0x00000864)
+#define CONTROL_CONF_GPMC_A10 (0x00000868)
+#define CONTROL_CONF_GPMC_A11 (0x0000086C)
+#define CONTROL_CONF_GPMC_WAIT0 (0x00000870)
+#define CONTROL_CONF_GPMC_WPN (0x00000874)
+#define CONTROL_CONF_GPMC_BEN1 (0x00000878)
+#define CONTROL_CONF_GPMC_CSN0 (0x0000087C)
+#define CONTROL_CONF_GPMC_CSN1 (0x00000880)
+#define CONTROL_CONF_GPMC_CSN2 (0x00000884)
+#define CONTROL_CONF_GPMC_CSN3 (0x00000888)
+#define CONTROL_CONF_GPMC_CLK (0x0000088C)
+#define CONTROL_CONF_GPMC_ADVN_ALE (0x00000890)
+#define CONTROL_CONF_GPMC_OEN_REN (0x00000894)
+#define CONTROL_CONF_GPMC_WEN (0x00000898)
+#define CONTROL_CONF_GPMC_BEN0_CLE (0x0000089C)
+#define CONTROL_CONF_LCD_DATA0 (0x000008A0)
+#define CONTROL_CONF_LCD_DATA1 (0x000008A4)
+#define CONTROL_CONF_LCD_DATA2 (0x000008A8)
+#define CONTROL_CONF_LCD_DATA3 (0x000008AC)
+#define CONTROL_CONF_LCD_DATA4 (0x000008B0)
+#define CONTROL_CONF_LCD_DATA5 (0x000008B4)
+#define CONTROL_CONF_LCD_DATA6 (0x000008B8)
+#define CONTROL_CONF_LCD_DATA7 (0x000008BC)
+#define CONTROL_CONF_LCD_DATA8 (0x000008C0)
+#define CONTROL_CONF_LCD_DATA9 (0x000008C4)
+#define CONTROL_CONF_LCD_DATA10 (0x000008C8)
+#define CONTROL_CONF_LCD_DATA11 (0x000008CC)
+#define CONTROL_CONF_LCD_DATA12 (0x000008D0)
+#define CONTROL_CONF_LCD_DATA13 (0x000008D4)
+#define CONTROL_CONF_LCD_DATA14 (0x000008D8)
+#define CONTROL_CONF_LCD_DATA15 (0x000008DC)
+#define CONTROL_CONF_LCD_VSYNC (0x000008E0)
+#define CONTROL_CONF_LCD_HSYNC (0x000008E4)
+#define CONTROL_CONF_LCD_PCLK (0x000008E8)
+#define CONTROL_CONF_LCD_AC_BIAS_EN (0x000008EC)
+#define CONTROL_CONF_MMC0_DAT3 (0x000008F0)
+#define CONTROL_CONF_MMC0_DAT2 (0x000008F4)
+#define CONTROL_CONF_MMC0_DAT1 (0x000008F8)
+#define CONTROL_CONF_MMC0_DAT0 (0x000008FC)
+#define CONTROL_CONF_MMC0_CLK (0x00000900)
+#define CONTROL_CONF_MMC0_CMD (0x00000904)
+#define CONTROL_CONF_MII1_COL (0x00000908)
+#define CONTROL_CONF_MII1_CRS (0x0000090C)
+#define CONTROL_CONF_MII1_RX_ER (0x00000910)
+#define CONTROL_CONF_MII1_TX_EN (0x00000914)
+#define CONTROL_CONF_MII1_RX_DV (0x00000918)
+#define CONTROL_CONF_MII1_TXD3 (0x0000091C)
+#define CONTROL_CONF_MII1_TXD2 (0x00000920)
+#define CONTROL_CONF_MII1_TXD1 (0x00000924)
+#define CONTROL_CONF_MII1_TXD0 (0x00000928)
+#define CONTROL_CONF_MII1_TX_CLK (0x0000092C)
+#define CONTROL_CONF_MII1_RX_CLK (0x00000930)
+#define CONTROL_CONF_MII1_RXD3 (0x00000934)
+#define CONTROL_CONF_MII1_RXD2 (0x00000938)
+#define CONTROL_CONF_MII1_RXD1 (0x0000093C)
+#define CONTROL_CONF_MII1_RXD0 (0x00000940)
+#define CONTROL_CONF_RMII1_REF_CLK (0x00000944)
+#define CONTROL_CONF_MDIO (0x00000948)
+#define CONTROL_CONF_MDC (0x0000094C)
+#define CONTROL_CONF_SPI0_SCLK (0x00000950)
+#define CONTROL_CONF_SPI0_D0 (0x00000954)
+#define CONTROL_CONF_SPI0_D1 (0x00000958)
+#define CONTROL_CONF_SPI0_CS0 (0x0000095C)
+#define CONTROL_CONF_SPI0_CS1 (0x00000960)
+#define CONTROL_CONF_ECAP0_IN_PWM0_OUT (0x00000964)
+#define CONTROL_CONF_UART0_CTSN (0x00000968)
+#define CONTROL_CONF_UART0_RTSN (0x0000096C)
+#define CONTROL_CONF_UART0_RXD (0x00000970)
+#define CONTROL_CONF_UART0_TXD (0x00000974)
+#define CONTROL_CONF_UART1_CTSN (0x00000978)
+#define CONTROL_CONF_UART1_RTSN (0x0000097C)
+#define CONTROL_CONF_UART1_RXD (0x00000980)
+#define CONTROL_CONF_UART1_TXD (0x00000984)
+#define CONTROL_CONF_I2C0_SDA (0x00000988)
+#define CONTROL_CONF_I2C0_SCL (0x0000098C)
+#define CONTROL_CONF_MCASP0_ACLKX (0x00000990)
+#define CONTROL_CONF_MCASP0_FSX (0x00000994)
+#define CONTROL_CONF_MCASP0_AXR0 (0x00000998)
+#define CONTROL_CONF_MCASP0_AHCLKR (0x0000099C)
+#define CONTROL_CONF_MCASP0_ACLKR (0x000009A0)
+#define CONTROL_CONF_MCASP0_FSR (0x000009A4)
+#define CONTROL_CONF_MCASP0_AXR1 (0x000009A8)
+#define CONTROL_CONF_MCASP0_AHCLKX (0x000009AC)
+#define CONTROL_CONF_XDMA_EVENT_INTR0 (0x000009B0)
+#define CONTROL_CONF_XDMA_EVENT_INTR1 (0x000009B4)
+#define CONTROL_CONF_WARMRSTN (0x000009B8)
+#define CONTROL_CONF_NNMI (0x000009C0)
+#define CONTROL_CONF_TMS (0x000009D0)
+#define CONTROL_CONF_TDI (0x000009D4)
+#define CONTROL_CONF_TDO (0x000009D8)
+#define CONTROL_CONF_TCK (0x000009DC)
+#define CONTROL_CONF_TRSTN (0x000009E0)
+#define CONTROL_CONF_EMU0 (0x000009E4)
+#define CONTROL_CONF_EMU1 (0x000009E8)
+#define CONTROL_CONF_RTC_PWRONRSTN (0x000009F8)
+#define CONTROL_CONF_PMIC_POWER_EN (0x000009FC)
+#define CONTROL_CONF_EXT_WAKEUP (0x00000A00)
+#define CONTROL_CONF_RTC_KALDO_ENN (0x00000A04)
+#define CONTROL_CONF_USB0_DRVVBUS (0x00000A1C)
+#define CONTROL_CONF_USB1_DRVVBUS (0x00000A34)
+
+#define CONTROL_CONF_SLEWCTRL (1<<6)
+#define CONTROL_CONF_RXACTIVE (1<<5)
+#define CONTROL_CONF_PUTYPESEL (1<<4)
+#define CONTROL_CONF_PUDEN (1<<3)
+#define CONTROL_CONF_MUXMODE(X) (X&0x7)
+
+#endif /* __MINIX_PADCONF_H */

Property changes on: lab4/.minix-src/include/minix/padconf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/usb.h
===================================================================
--- lab4/.minix-src/include/minix/usb.h	(nonexistent)
+++ lab4/.minix-src/include/minix/usb.h	(revision 13)
@@ -0,0 +1,158 @@
+#ifndef _MINIX_USB_H
+#define _MINIX_USB_H
+
+#include <sys/types.h>
+#include <minix/com.h>
+#include <minix/ipc.h>
+#include <stdio.h>
+
+#define USB_URBSIZE(data_size, iso_count) \
+	(data_size + sizeof(struct usb_urb) + iso_count * \
+	sizeof(struct usb_iso_packet_desc))
+
+#define USB_PREPARE_URB(urb, data_size, iso_count) \
+	do { \
+		if(iso_count)\
+			urb->iso_data.iso_desc = data_size;\
+			urb->urb_size = data_size+sizeof(struct usb_urb)+iso_count * \
+			sizeof(struct usb_iso_packet_desc); \
+	} while (0)
+
+
+struct usb_urb;
+
+struct usb_driver {
+	void (*urb_completion)(struct usb_urb *urb);
+	void (*connect_device)(unsigned dev_id, unsigned int interfaces);
+	void (*disconnect_device)(unsigned dev_id);
+};
+
+struct usb_device_id {
+	u16_t idVendor;
+	u16_t idProduct;
+	u32_t bcdDevice;
+
+	u8_t  bDeviceClass;
+	u8_t  bDeviceSubClass;
+	u8_t  bDeviceProtocol;
+
+	u8_t  bInterfaceClass;
+	u8_t  bInterfaceSubClass;
+	u8_t  bInterfaceProtocol;
+};
+
+struct usb_iso_packet_desc {
+	unsigned int offset;
+	unsigned int length;		/* expected length */
+	unsigned int actual_length;
+	unsigned int status;
+};
+	
+/** isochronous transfer */
+#define USB_TRANSFER_ISO 0
+/** interrupt transfer */
+#define USB_TRANSFER_INT 1
+/** control transfer */
+#define USB_TRANSFER_CTL 2
+/** bulk transfer */
+#define USB_TRANSFER_BLK 3
+
+#define USB_IN  0
+#define USB_OUT 1
+
+#define USB_INVALID_URB_ID 0
+
+struct usb_urb {
+	/* private */
+	struct usb_urb *next;
+
+	/** ID identifying the device on HCD side */
+	int dev_id;
+	int type;
+	int endpoint;
+	int direction;
+	int status;
+	int error_count;
+	size_t size;
+	size_t actual_length;
+	void *priv;
+	int interval;
+
+	unsigned long transfer_flags;
+
+	
+	/* housekeeping information needed by usb library */
+	unsigned urb_id;
+	size_t urb_size;
+	cp_grant_id_t gid;
+
+	size_t iso_desc_offset;
+	int number_of_packets;
+	int start_frame;
+	char setup_packet[8];
+
+	/* data allways starts here */
+	char buffer[1];
+};
+
+struct usb_ctrlrequest {
+        u8_t bRequestType; 
+        u8_t bRequest;
+        u16_t wValue;
+		u16_t wIndex;
+        u16_t wLength;
+} __attribute__ ((packed));
+
+#ifdef DEBUG
+static void dump_urb(struct usb_urb *urb) {
+	printf("================\n");
+	printf("DUMP: urb (0x%p)\n", urb);
+	printf("================\n");
+	printf("= dev_id: %d\n", urb->dev_id);
+	printf("= type: %d\n", urb->type);
+	printf("= endpoint: %d\n", urb->endpoint);
+	printf("= direction: %d\n", urb->direction);
+	printf("= status: %d\n", urb->status);
+	printf("= error_count: %d\n", urb->error_count);
+	printf("= size: %d\n", urb->size);
+	printf("= actual_length: %d\n", urb->actual_length);
+	printf("= interval %d\n", urb->interval);
+	printf("= transfer_flags %x\n", urb->transfer_flags);
+	printf("= urb_id = %d\n", urb->urb_id);
+	printf("= urb_size = 0x%x\n", urb->urb_size);
+	printf("= setup_packet: \n");
+	printf("=   bRequestType: 0x%x \n",
+	    ((struct usb_ctrlrequest *)urb->setup_packet)->bRequestType);
+	printf("=   bRequest 0x%x \n",
+	    ((struct usb_ctrlrequest *)urb->setup_packet)->bRequest);
+	printf("=   wValue: 0x%x \n",
+	    ((struct usb_ctrlrequest *)urb->setup_packet)->wValue);
+	printf("=   wIndex: 0x%x \n",
+	    ((struct usb_ctrlrequest *)urb->setup_packet)->wIndex);
+	printf("=   wLength: 0x%x \n",
+	    ((struct usb_ctrlrequest *)urb->setup_packet)->wLength);
+	printf("===============\n");
+}
+#else
+#define dumb_urb(x) 
+#endif
+
+/** Submit a URB */
+int usb_send_urb(struct usb_urb* urb);
+
+/** Cancels an URB */ 
+int usb_cancle_urb(struct usb_urb* urb);
+
+/** Gets the USB device ID of an USB device **/
+int usb_get_device_id(int dev_id, struct usb_device_id *usb_device_id);
+
+/* this initializes a session with the HCD */
+int usb_init(char *name);
+
+/** This functions handles a message from the HCD */
+int usb_handle_msg(struct usb_driver *ubd, message *msg);
+
+/** Lets device driver send HCD various information */
+int usb_send_info(long, long);
+
+#endif /* _MINIX_USB_H */

Property changes on: lab4/.minix-src/include/minix/usb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/fsdriver.h
===================================================================
--- lab4/.minix-src/include/minix/fsdriver.h	(nonexistent)
+++ lab4/.minix-src/include/minix/fsdriver.h	(revision 13)
@@ -0,0 +1,127 @@
+#ifndef _MINIX_FSDRIVER_H
+#define _MINIX_FSDRIVER_H
+
+struct stat;
+struct statvfs;
+struct timespec;
+
+/* Resulting node properties. */
+struct fsdriver_node {
+	ino_t fn_ino_nr;		/* inode number */
+	mode_t fn_mode;			/* file mode */
+	off_t fn_size;			/* file size */
+	uid_t fn_uid;			/* owning user ID */
+	gid_t fn_gid;			/* owning group ID */
+	dev_t fn_dev;			/* device number, for block/char dev */
+};
+
+/* Opaque data structure for the fsdriver_copyin, _copyout, _zero functions. */
+struct fsdriver_data {
+	endpoint_t endpt;		/* source/destination endpoint */
+	union {
+		cp_grant_id_t grant;	/* grant, if endpt != SELF */
+		char *ptr;		/* local pointer, if endpt == SELF */
+	};
+	size_t size;			/* total buffer size (check only) */
+};
+
+/* Opaque data structure for the fsdriver_dentry_ functions. */
+struct fsdriver_dentry {
+	const struct fsdriver_data *data;
+	size_t data_size;
+	size_t data_off;
+	char *buf;
+	size_t buf_size;
+	size_t buf_off;
+};
+
+/*
+ * For a few groups of calls, the functions have the same signature, so that
+ * the file system can use a single implementation for multiple functions
+ * without requiring extra stubs.  Thus, we pass in an extra parameter that
+ * identifies the call; one of the values below.  For the same reason, the peek
+ * and bpeek calls have a "data" parameter which is always set to NULL.
+ */
+#define FSC_READ	0		/* read or bread call */
+#define FSC_WRITE	1		/* write or bwrite call */
+#define FSC_PEEK	2		/* peek or bpeek call */
+
+#define FSC_UNLINK	0		/* unlink call */
+#define FSC_RMDIR	1		/* rmdir call */
+
+/* Function call table for file system services. */
+struct fsdriver {
+	int (*fdr_mount)(dev_t dev, unsigned int flags,
+	    struct fsdriver_node *root_node, unsigned int *res_flags);
+	void (*fdr_unmount)(void);
+	int (*fdr_lookup)(ino_t dir_nr, char *name, struct fsdriver_node *node,
+	    int *is_mountpt);
+	int (*fdr_newnode)(mode_t mode, uid_t uid, gid_t gid, dev_t dev,
+	    struct fsdriver_node *node);
+	int (*fdr_putnode)(ino_t ino_nr, unsigned int count);
+	ssize_t (*fdr_read)(ino_t ino_nr, struct fsdriver_data *data,
+	    size_t bytes, off_t pos, int call);
+	ssize_t (*fdr_write)(ino_t ino_nr, struct fsdriver_data *data,
+	    size_t bytes, off_t pos, int call);
+	ssize_t (*fdr_peek)(ino_t ino_nr, struct fsdriver_data *data,
+	    size_t bytes, off_t pos, int call);
+	ssize_t (*fdr_getdents)(ino_t ino_nr, struct fsdriver_data *data,
+	    size_t bytes, off_t *pos);
+	int (*fdr_trunc)(ino_t ino_nr, off_t start_pos, off_t end_pos);
+	void (*fdr_seek)(ino_t ino);
+	int (*fdr_create)(ino_t dir_nr, char *name, mode_t mode, uid_t uid,
+	    gid_t gid, struct fsdriver_node *node);
+	int (*fdr_mkdir)(ino_t dir_nr, char *name, mode_t mode, uid_t uid,
+	    gid_t gid);
+	int (*fdr_mknod)(ino_t dir_nr, char *name, mode_t mode, uid_t uid,
+	    gid_t gid, dev_t rdev);
+	int (*fdr_link)(ino_t dir_nr, char *name, ino_t ino_nr);
+	int (*fdr_unlink)(ino_t dir_nr, char *name, int call);
+	int (*fdr_rmdir)(ino_t dir_nr, char *name, int call);
+	int (*fdr_rename)(ino_t old_dir_nr, char *old_name, ino_t new_dir_nr,
+	    char *new_name);
+	int (*fdr_slink)(ino_t dir_nr, char *name, uid_t uid, gid_t gid,
+	    struct fsdriver_data *data, size_t bytes);
+	ssize_t (*fdr_rdlink)(ino_t ino_nr, struct fsdriver_data *data,
+	    size_t bytes);
+	int (*fdr_stat)(ino_t ino_nr, struct stat *buf);
+	int (*fdr_chown)(ino_t ino_nr, uid_t uid, gid_t gid, mode_t *mode);
+	int (*fdr_chmod)(ino_t ino_nr, mode_t *mode);
+	int (*fdr_utime)(ino_t ino_nr, struct timespec *atime,
+	    struct timespec *mtime);
+	int (*fdr_mountpt)(ino_t ino_nr);
+	int (*fdr_statvfs)(struct statvfs *buf);
+	void (*fdr_sync)(void);
+	void (*fdr_driver)(dev_t dev, char *label);
+	ssize_t (*fdr_bread)(dev_t dev, struct fsdriver_data *data,
+	    size_t bytes, off_t pos, int call);
+	ssize_t (*fdr_bwrite)(dev_t dev, struct fsdriver_data *data,
+	    size_t bytes, off_t pos, int call);
+	ssize_t (*fdr_bpeek)(dev_t dev, struct fsdriver_data *data,
+	    size_t bytes, off_t pos, int call);
+	void (*fdr_bflush)(dev_t dev);
+	void (*fdr_postcall)(void);
+	void (*fdr_other)(const message *m_ptr, int ipc_status);
+};
+
+/* Functions defined by libfsdriver. */
+void fsdriver_process(const struct fsdriver * __restrict fdp,
+	const message * __restrict m_ptr, int ipc_status, int asyn_reply);
+void fsdriver_terminate(void);
+void fsdriver_task(struct fsdriver *fdp);
+
+int fsdriver_copyin(const struct fsdriver_data *data, size_t off, void *ptr,
+	size_t len);
+int fsdriver_copyout(const struct fsdriver_data *data, size_t off,
+	const void *ptr, size_t len);
+int fsdriver_zero(const struct fsdriver_data *data, size_t off, size_t len);
+
+void fsdriver_dentry_init(struct fsdriver_dentry * __restrict dentry,
+	const struct fsdriver_data * __restrict data, size_t bytes,
+	char * __restrict buf, size_t bufsize);
+ssize_t fsdriver_dentry_add(struct fsdriver_dentry * __restrict dentry,
+	ino_t ino_nr, const char * __restrict name, size_t namelen,
+	unsigned int type);
+ssize_t fsdriver_dentry_finish(struct fsdriver_dentry *dentry);
+
+#endif /* !_MINIX_FSDRIVER_H */

Property changes on: lab4/.minix-src/include/minix/fsdriver.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/portio.h
===================================================================
--- lab4/.minix-src/include/minix/portio.h	(nonexistent)
+++ lab4/.minix-src/include/minix/portio.h	(revision 13)
@@ -0,0 +1,21 @@
+/*
+minix/portio.h
+
+Created:	Jan 15, 1992 by Philip Homburg
+*/
+
+#ifndef _PORTIO_H_
+#define _PORTIO_H_
+
+#include <sys/types.h>
+
+unsigned inb(u16_t _port);
+unsigned inw(u16_t _port);
+unsigned inl(u16_t _port);
+void outb(u16_t _port, u8_t _value);
+void outw(u16_t _port, u16_t _value);
+void outl(u16_t _port, u32_t _value);
+void intr_disable(void);
+void intr_enable(void);
+
+#endif /* _PORTIO_H_ */

Property changes on: lab4/.minix-src/include/minix/portio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/vboxfs.h
===================================================================
--- lab4/.minix-src/include/minix/vboxfs.h	(nonexistent)
+++ lab4/.minix-src/include/minix/vboxfs.h	(revision 13)
@@ -0,0 +1,12 @@
+/* Part of libvboxfs - (c) 2012, D.C. van Moolenbroek */
+
+#ifndef _MINIX_VBOXFS_H
+#define _MINIX_VBOXFS_H
+
+#include <minix/sffs.h>
+
+int vboxfs_init(char *share, const struct sffs_table **tablep,
+	int *case_insens, int *read_only);
+void vboxfs_cleanup(void);
+
+#endif /* _MINIX_VBOXFS_H */

Property changes on: lab4/.minix-src/include/minix/vboxfs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/hash.h
===================================================================
--- lab4/.minix-src/include/minix/hash.h	(nonexistent)
+++ lab4/.minix-src/include/minix/hash.h	(revision 13)
@@ -0,0 +1,49 @@
+
+#ifndef _MINIX_HASH_H
+#define _MINIX_HASH_H 1
+
+#include <stdint.h>
+
+/* This code is taken from:
+ * lookup3.c, by Bob Jenkins, May 2006, Public Domain.
+ * (macro names modified)
+ */
+
+#define hash_rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
+
+#define hash_mix(a,b,c) \
+{ \
+  a -= c;  a ^= hash_rot(c, 4);  c += b; \
+  b -= a;  b ^= hash_rot(a, 6);  a += c; \
+  c -= b;  c ^= hash_rot(b, 8);  b += a; \
+  a -= c;  a ^= hash_rot(c,16);  c += b; \
+  b -= a;  b ^= hash_rot(a,19);  a += c; \
+  c -= b;  c ^= hash_rot(b, 4);  b += a; \
+}
+
+#define hash_final(a,b,c) \
+{ \
+  c ^= b; c -= hash_rot(b,14); \
+  a ^= c; a -= hash_rot(c,11); \
+  b ^= a; b -= hash_rot(a,25); \
+  c ^= b; c -= hash_rot(b,16); \
+  a ^= c; a -= hash_rot(c,4);  \
+  b ^= a; b -= hash_rot(a,14); \
+  c ^= b; c -= hash_rot(b,24); \
+}
+
+#define hash_i_64(a, u, v) {				\
+	u32_t i1 = (a), i2 = ex64lo(u), i3 = ex64hi(u);	\
+	hash_mix(i1, i2, i3);				\
+	hash_final(i1, i2, i3);				\
+	(v) = i3;					\
+}
+
+#define hash_32(n, v) {					\
+	u32_t i1 = 0xa5a5a5a5, i2 = 0x12345678, i3 = n;	\
+	hash_mix(i1, i2, i3);				\
+	hash_final(i1, i2, i3);				\
+	(v) = i3;					\
+}
+
+#endif

Property changes on: lab4/.minix-src/include/minix/hash.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/if.h
===================================================================
--- lab4/.minix-src/include/minix/if.h	(nonexistent)
+++ lab4/.minix-src/include/minix/if.h	(revision 13)
@@ -0,0 +1,51 @@
+#ifndef _MINIX_IF_H
+#define _MINIX_IF_H
+
+#include <net/if.h>
+#include <net/if_media.h>
+
+/*
+ * MINIX3-specific extensions to the network interface headers.  These
+ * extensions are necessary because NetBSD IF uses a few ioctl(2) structure
+ * formats that contain pointers--something that MINIX3 has to avoid, due to
+ * its memory granting mechanisms.  Thus, those ioctl(2) calls have to be
+ * converted from NetBSD to MINIX3 format.  We currently do that in libc.
+ * This header specifies the numbers and formats for the MINIX3 versions.
+ *
+ * The general idea is that we rewrite the ioctl request data to include both
+ * the original structure and a buffer for the array of values to which the
+ * original structure uses a pointer.  Important: in those cases, the original
+ * structure is expected to be the first element of the replacement structure.
+ *
+ * There is typically no configured upper bound for the maximum number of
+ * values in the array, and so we pick size values that are hopefully always
+ * oversized and yet keep the ioctl sizes within the range of regular ioctls
+ * (4095 bytes, as per sys/ioccom.h).  If there may be larger amounts of data,
+ * we have to use "big" ioctls.
+ *
+ * For the replacement ioctl codes, we use the original ioctl class and number
+ * with a different size.  That should virtually eliminate the possibility of
+ * accidental collisions.
+ */
+
+/* SIOCGIFMEDIA: retrieve interface media status and types. */
+#define MINIX_IF_MAXMEDIA	256
+
+struct minix_ifmediareq {
+	struct ifmediareq mifm_ifm;			/* MUST be first */
+	int mifm_list[MINIX_IF_MAXMEDIA];
+};
+
+#define MINIX_SIOCGIFMEDIA	_IOWR('i', 54, struct minix_ifmediareq)
+
+/* SIOCIFGCLONERS: retrieve interface "cloners" (virtual types). */
+#define MINIX_IF_MAXCLONERS	128
+
+struct minix_if_clonereq {
+	struct if_clonereq mifcr_ifcr;			/* MUST be first */
+	char mifcr_buffer[MINIX_IF_MAXCLONERS * IFNAMSIZ];
+};
+
+#define MINIX_SIOCIFGCLONERS	_IOWR('i', 120, struct minix_if_clonereq)
+
+#endif /* !_MINIX_IF_H */

Property changes on: lab4/.minix-src/include/minix/if.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/rmib.h
===================================================================
--- lab4/.minix-src/include/minix/rmib.h	(nonexistent)
+++ lab4/.minix-src/include/minix/rmib.h	(revision 13)
@@ -0,0 +1,188 @@
+#ifndef _MINIX_RMIB_H
+#define _MINIX_RMIB_H
+
+/*
+ * This header file is for use by services that use the remote MIB (RMIB)
+ * functionality of libsys.  RMIB allows services to mount and handle certain
+ * subtrees of the MIB service's sysctl tree.
+ */
+
+#include <sys/sysctl.h>
+
+/*
+ * The maximum number of I/O vector elements that can be passed to the
+ * rmib_vcopyout function.
+ */
+#define RMIB_IOV_MAX	SCPVEC_NR
+
+/*
+ * This structure contains a number of less heavily used parameters for handler
+ * functions, mainly to provide extensibility while limiting argument clutter.
+ */
+struct rmib_call {
+	endpoint_t call_endpt;		/* endpoint of the user process */
+	const int *call_oname;		/* original full name of the request */
+	const int *call_name;		/* remaining part of the name */
+	unsigned int call_namelen;	/* length of the remaining name part */
+	unsigned int call_flags;	/* RMIB_FLAG_ call flags */
+	uint32_t call_rootver;		/* version of all nodes in subtree */
+	uint32_t call_treever;		/* version of the entire MIB tree */
+};
+
+/*
+ * Call flags.
+ *
+ * TODO: this is effectively a flag used on the wire.  This should be turned
+ * into a proper definition shared with the MIB service.  As long as we have
+ * only one flag anyway, this is not exactly urgent though.
+ */
+#define RMIB_FLAG_AUTH	0x1	/* user has superuser privileges */
+
+struct rmib_node;
+struct rmib_oldp;
+struct rmib_newp;
+
+typedef ssize_t (*rmib_func_ptr)(struct rmib_call *, struct rmib_node *,
+	struct rmib_oldp *, struct rmib_newp *);
+
+/*
+ * Indirect node, used for sparse nodes.  Sparse nodes are node-type nodes with
+ * the CTLFLAG_SPARSE flag set.  A sparse node points not to an array of child
+ * nodes (using rnode_cptr), but to a array of {id,child pointer} elements
+ * (using rnode_icptr).  At the cost of O(n) lookups, sparse nodes save memory.
+ * Currently for presentation reasons only, indirect lists must be sorted
+ * ascending by node identifiers. They may also not have ID duplicates, may not
+ * have NULL node pointers, and may not point to nodes with zero flags fields.
+ */
+#define CTLFLAG_SPARSE	CTLFLAG_ROOT	/* overloaded NetBSD flag */
+
+struct rmib_indir {
+	unsigned int rindir_id;		/* node identifier */
+	struct rmib_node *rindir_node;	/* pointer to actual node */
+};
+
+/*
+ * The central structure for remote MIB nodes.  This is essentially a somewhat
+ * cut-down version of the node structure used within the MIB service.  See the
+ * source code of that service for several details that apply here as well.
+ * The 'rnode_' prefix makes it possible to include both this header file and
+ * the MIB service's internal header file at once--neat if useless.
+ */
+struct rmib_node {
+	uint32_t rnode_flags;		/* CTLTYPE_ type and CTLFLAG_ flags */
+	size_t rnode_size;		/* size of associated data */
+	union ixfer_rnode_val_u {
+		bool rvu_bool;		/* immediate boolean */
+		int rvu_int;		/* immediate integer */
+		u_quad_t rvu_quad;	/* immediate quad */
+		uint32_t rvu_clen;	/* number of actual children */
+	} rnode_val_u;
+	union pxfer_rnode_ptr_u {
+		void *rpu_data;		/* struct or string data pointer */
+		struct rmib_node *rpu_cptr;	/* child node array */
+		struct rmib_indir *rpu_icptr;	/* indirect child node array */
+	} rnode_ptr_u;
+	rmib_func_ptr rnode_func;	/* handler function */
+	const char *rnode_name;		/* node name string */
+	const char *rnode_desc;		/* node description (may be NULL) */
+};
+#define rnode_bool	rnode_val_u.rvu_bool
+#define rnode_int	rnode_val_u.rvu_int
+#define rnode_quad	rnode_val_u.rvu_quad
+#define rnode_clen	rnode_val_u.rvu_clen
+#define rnode_data	rnode_ptr_u.rpu_data
+#define rnode_cptr	rnode_ptr_u.rpu_cptr
+#define rnode_icptr	rnode_ptr_u.rpu_icptr
+
+/* Various macros to initialize nodes at compile time. */
+#define RMIB_NODE(f,t,n,d) {						\
+	.rnode_flags = CTLTYPE_NODE | CTLFLAG_READONLY |		\
+	    CTLFLAG_PERMANENT | f,					\
+	.rnode_size = __arraycount(t),					\
+	.rnode_cptr = t,						\
+	.rnode_name = n,						\
+	.rnode_desc = d							\
+}
+#define RMIB_SNODE(f,t,n,d) {						\
+	.rnode_flags = CTLTYPE_NODE | CTLFLAG_READONLY |		\
+	    CTLFLAG_PERMANENT | CTLFLAG_SPARSE | f,			\
+	.rnode_size = 0,						\
+	.rnode_icptr = t,						\
+	.rnode_name = n,						\
+	.rnode_desc = d							\
+}
+#define RMIB_FUNC(f,s,fp,n,d) {						\
+	.rnode_flags = CTLFLAG_PERMANENT | f,				\
+	.rnode_size = s,						\
+	.rnode_func = fp,						\
+	.rnode_name = n,						\
+	.rnode_desc = d							\
+}
+#define RMIB_BOOL(f,b,n,d) {						\
+	.rnode_flags = CTLTYPE_BOOL | CTLFLAG_PERMANENT | 		\
+	    CTLFLAG_IMMEDIATE | f,					\
+	.rnode_size = sizeof(bool),					\
+	.rnode_bool = b,						\
+	.rnode_name = n,						\
+	.rnode_desc = d							\
+}
+#define RMIB_INT(f,i,n,d) {						\
+	.rnode_flags = CTLTYPE_INT | CTLFLAG_PERMANENT | 		\
+	    CTLFLAG_IMMEDIATE | f,					\
+	.rnode_size = sizeof(int),					\
+	.rnode_int = i,							\
+	.rnode_name = n,						\
+	.rnode_desc = d							\
+}
+#define RMIB_QUAD(f,q,n,d) {						\
+	.rnode_flags = CTLTYPE_QUAD | CTLFLAG_PERMANENT | 		\
+	    CTLFLAG_IMMEDIATE | f,					\
+	.rnode_size = sizeof(u_quad_t),					\
+	.rnode_quad = q,						\
+	.rnode_name = n,						\
+	.rnode_desc = d							\
+}
+#define _RMIB_DATA(f,s,p,n,d) {						\
+	.rnode_flags = CTLFLAG_PERMANENT | f,				\
+	.rnode_size = s,						\
+	.rnode_data = __UNCONST(p),					\
+	.rnode_name = n,						\
+	.rnode_desc = d							\
+}
+/*
+ * The following macros really require a pointer to the proper data type; weird
+ * casts may not trigger compiler warnings but do allow for memory corruption.
+ * The first three need to be passed a pointer to a bool, int, and u_quad_t,
+ * respectively.  RMIB_STRING needs a pointer to a character array, so that
+ * sizeof(array) yields the proper size.  Since RMIB_STRUCT may be given a
+ * pointer to either a structure or an array, it must also be given a size.
+ */
+#define RMIB_BOOLPTR(f,p,n,d) _RMIB_DATA(CTLTYPE_BOOL | f, sizeof(*p), p, n, d)
+#define RMIB_INTPTR(f,p,n,d)  _RMIB_DATA(CTLTYPE_INT | f, sizeof(*p), p, n, d)
+#define RMIB_QUADPTR(f,p,n,d) _RMIB_DATA(CTLTYPE_QUAD | f, sizeof(*p), p, n, d)
+#define RMIB_STRING(f,p,n,d)  \
+	_RMIB_DATA(CTLTYPE_STRING | f, sizeof(p), p, n, d)
+#define RMIB_STRUCT(f,s,p,n,d)  _RMIB_DATA(CTLTYPE_STRUCT | f, s, p, n, d)
+
+/* Shortcut flag macros. */
+#define RMIB_RO	CTLFLAG_READONLY	/* shortcut for read-only nodes */
+#define RMIB_RW	CTLFLAG_READWRITE	/* shortcut for read-write nodes */
+
+/* Function prototypes. */
+int rmib_register(const int * name, unsigned int namelen, struct rmib_node *);
+int rmib_deregister(struct rmib_node *);
+void rmib_reregister(void);
+void rmib_reset(void);
+void rmib_process(const message *, int);
+
+int rmib_inrange(struct rmib_oldp *, size_t);
+size_t rmib_getoldlen(struct rmib_oldp *);
+ssize_t rmib_copyout(struct rmib_oldp *, size_t, const void * __restrict,
+	size_t);
+ssize_t rmib_vcopyout(struct rmib_oldp *, size_t, const iovec_t *,
+	unsigned int);
+int rmib_copyin(struct rmib_newp * __restrict, void * __restrict, size_t);
+ssize_t rmib_readwrite(struct rmib_call *, struct rmib_node *,
+	struct rmib_oldp *, struct rmib_newp *);
+
+#endif /* !_MINIX_RMIB_H */

Property changes on: lab4/.minix-src/include/minix/rmib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/sef.h
===================================================================
--- lab4/.minix-src/include/minix/sef.h	(nonexistent)
+++ lab4/.minix-src/include/minix/sef.h	(revision 13)
@@ -0,0 +1,387 @@
+/* Prototypes for System Event Framework (SEF) functions. */
+
+#ifndef _SEF_H
+#define _SEF_H
+
+#include <minix/ipc.h>
+
+/* SEF entry points for system processes. */
+void sef_startup(void);
+int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr);
+endpoint_t sef_self(void);
+void sef_cancel(void);
+void __dead sef_exit(int status);
+int sef_getrndseed (void);
+int sef_munmap(void *addrstart, vir_bytes len, int type);
+#define sef_receive(src, m_ptr) sef_receive_status(src, m_ptr, NULL)
+
+/* SEF global definitions. */
+#define SEF_STATE_TRANSFER_GID          0
+
+/* SEF Debug. */
+#include <stdio.h>
+#define sef_dprint                      printf
+#define sef_debug_begin()               (void)(NULL)
+#define sef_debug_end()                 (void)(NULL)
+
+/*===========================================================================*
+ *				  SEF Init				     *
+ *===========================================================================*/
+/* What to intercept. */
+#define INTERCEPT_SEF_INIT_REQUESTS 1
+#define SEF_INIT_REQUEST_TYPE RS_INIT
+#define IS_SEF_INIT_REQUEST(mp, status) ((mp)->m_type == RS_INIT \
+     && (mp)->m_source == RS_PROC_NR)
+
+#define SEF_COPY_OLD_TO_NEW     0x001
+#define SEF_COPY_NEW_TO_NEW     0x002
+#define SEF_COPY_DEST_OFFSET    0x004
+#define SEF_COPY_SRC_OFFSET     0X008
+
+/* Type definitions. */
+typedef struct {
+    int flags;
+    cp_grant_id_t rproctab_gid;
+    endpoint_t endpoint;
+    endpoint_t old_endpoint;
+    int restarts;
+    void* init_buff_start;
+    void* init_buff_cleanup_start;
+    size_t init_buff_len;
+    int copy_flags;
+    int prepare_state;
+} sef_init_info_t;
+
+/* Callback type definitions. */
+typedef int(*sef_cb_init_t)(int type, sef_init_info_t *info);
+typedef int(*sef_cb_init_response_t)(message *m_ptr);
+
+/* Callback registration helpers. */
+void sef_setcb_init_fresh(sef_cb_init_t cb);
+void sef_setcb_init_lu(sef_cb_init_t cb);
+void sef_setcb_init_restart(sef_cb_init_t cb);
+void sef_setcb_init_response(sef_cb_init_response_t cb);
+
+/* Predefined callback implementations. */
+int sef_cb_init_null(int type, sef_init_info_t *info);
+int sef_cb_init_response_null(message *m_ptr);
+
+int sef_cb_init_fail(int type, sef_init_info_t *info);
+int sef_cb_init_reset(int type, sef_init_info_t *info);
+int sef_cb_init_crash(int type, sef_init_info_t *info);
+int sef_cb_init_timeout(int type, sef_init_info_t *info);
+int sef_cb_init_restart_generic(int type, sef_init_info_t *info);
+int sef_cb_init_identity_state_transfer(int type, sef_init_info_t *info);
+int sef_cb_init_lu_identity_as_restart(int type, sef_init_info_t *info);
+int sef_cb_init_lu_generic(int type, sef_init_info_t *info);
+int sef_cb_init_response_rs_reply(message *m_ptr);
+int sef_cb_init_response_rs_asyn_once(message *m_ptr);
+
+/* Macros for predefined callback implementations. */
+#define SEF_CB_INIT_FRESH_NULL          sef_cb_init_null
+#define SEF_CB_INIT_LU_NULL             sef_cb_init_null
+#define SEF_CB_INIT_RESTART_NULL        sef_cb_init_null
+#define SEF_CB_INIT_RESPONSE_NULL       sef_cb_init_response_null
+#define SEF_CB_INIT_RESTART_STATEFUL    sef_cb_init_restart_generic
+
+#define SEF_CB_INIT_FRESH_DEFAULT       sef_cb_init_null
+#define SEF_CB_INIT_LU_DEFAULT          sef_cb_init_lu_generic
+#define SEF_CB_INIT_RESTART_DEFAULT     sef_cb_init_reset
+#define SEF_CB_INIT_RESPONSE_DEFAULT    sef_cb_init_response_rs_reply
+
+/* Init types. */
+#define SEF_INIT_FRESH                  0    /* init fresh */
+#define SEF_INIT_LU                     1    /* init after live update */
+#define SEF_INIT_RESTART                2    /* init after restart */
+
+/* Init flags (live update flags can be used as init flags as well). */
+#define SEF_INIT_CRASH	 	      0x1
+#define SEF_INIT_FAIL		      0x2
+#define SEF_INIT_TIMEOUT	      0x4
+#define SEF_INIT_DEFCB  	      0x8
+#define SEF_INIT_SCRIPT_RESTART	     0x10
+#define SEF_INIT_ST                  0x20    /* force state transfer init */
+
+/* Debug. */
+#define SEF_INIT_DEBUG_DEFAULT 		0
+#define SEF_INIT_ALLOW_DEBUG_INIT_FLAGS 1
+
+#ifndef SEF_INIT_DEBUG
+#define SEF_INIT_DEBUG                  SEF_INIT_DEBUG_DEFAULT
+#endif
+
+#define sef_init_dprint                 sef_dprint
+#define sef_init_debug_begin            sef_debug_begin
+#define sef_init_debug_end              sef_debug_end
+
+/*===========================================================================*
+ *				  SEF Ping				     *
+ *===========================================================================*/
+/* What to intercept. */
+#define INTERCEPT_SEF_PING_REQUESTS 1
+#define SEF_PING_REQUEST_TYPE NOTIFY_MESSAGE
+#define IS_SEF_PING_REQUEST(mp, status) (is_ipc_notify(status) \
+    && (mp)->m_source == RS_PROC_NR)
+
+/* Callback type definitions. */
+typedef void(*sef_cb_ping_reply_t)(endpoint_t source);
+
+/* Callback registration helpers. */
+void sef_setcb_ping_reply(sef_cb_ping_reply_t cb);
+
+/* Predefined callback implementations. */
+void sef_cb_ping_reply_null(endpoint_t source);
+
+void sef_cb_ping_reply_pong(endpoint_t source);
+
+/* Macros for predefined callback implementations. */
+#define SEF_CB_PING_REPLY_NULL          sef_cb_ping_reply_null
+
+#define SEF_CB_PING_REPLY_DEFAULT       sef_cb_ping_reply_pong
+
+/* Debug. */
+#define SEF_PING_DEBUG_DEFAULT 0
+
+#ifndef SEF_PING_DEBUG
+#define SEF_PING_DEBUG                  SEF_PING_DEBUG_DEFAULT
+#endif
+
+#define sef_ping_dprint                 sef_dprint
+#define sef_ping_debug_begin            sef_debug_begin
+#define sef_ping_debug_end              sef_debug_end
+
+/*===========================================================================*
+ *				SEF Live update				     *
+ *===========================================================================*/
+/* What to intercept. */
+#define INTERCEPT_SEF_LU_REQUESTS 1
+#define SEF_LU_REQUEST_TYPE RS_LU_PREPARE
+#define IS_SEF_LU_REQUEST(mp, status) ((mp)->m_type == RS_LU_PREPARE \
+    && (mp)->m_source == RS_PROC_NR)
+
+/* Callback type definitions. */
+typedef  int(*sef_cb_lu_prepare_t)(int);
+typedef  int(*sef_cb_lu_state_isvalid_t)(int, int);
+typedef void(*sef_cb_lu_state_changed_t)(int, int);
+typedef void(*sef_cb_lu_state_dump_t)(int);
+typedef  int(*sef_cb_lu_state_save_t)(int, int);
+typedef  int(*sef_cb_lu_response_t)(message *m_ptr);
+
+/* Callback registration helpers. */
+void sef_setcb_lu_prepare(sef_cb_lu_prepare_t cb);
+void sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_t cb);
+void sef_setcb_lu_state_changed(sef_cb_lu_state_changed_t cb);
+void sef_setcb_lu_state_dump(sef_cb_lu_state_dump_t cb);
+void sef_setcb_lu_state_save(sef_cb_lu_state_save_t cb);
+void sef_setcb_lu_response(sef_cb_lu_response_t cb);
+
+/* Predefined callback implementations. */
+int sef_cb_lu_prepare_null(int state);
+int sef_cb_lu_state_isvalid_null(int state, int flags);
+void sef_cb_lu_state_changed_null(int old_state, int state);
+void sef_cb_lu_state_dump_null(int state);
+int sef_cb_lu_state_save_null(int state, int flags);
+int sef_cb_lu_response_null(message *m_ptr);
+
+int sef_cb_lu_prepare_always_ready(int state);
+int sef_cb_lu_prepare_never_ready(int state);
+int sef_cb_lu_prepare_crash(int state);
+int sef_cb_lu_prepare_eval(int state);
+int sef_cb_lu_state_isvalid_standard(int state, int flags);
+int sef_cb_lu_state_isvalid_workfree(int state, int flags);
+int sef_cb_lu_state_isvalid_workfree_self(int state, int flags);
+int sef_cb_lu_state_isvalid_generic(int state, int flags);
+void sef_cb_lu_state_dump_eval(int state);
+int sef_cb_lu_response_rs_reply(message *m_ptr);
+
+/* Macros for predefined callback implementations. */
+#define SEF_CB_LU_PREPARE_NULL          sef_cb_lu_prepare_null
+#define SEF_CB_LU_STATE_ISVALID_NULL    sef_cb_lu_state_isvalid_null
+#define SEF_CB_LU_STATE_CHANGED_NULL    sef_cb_lu_state_changed_null
+#define SEF_CB_LU_STATE_DUMP_NULL       sef_cb_lu_state_dump_null
+#define SEF_CB_LU_STATE_SAVE_NULL       sef_cb_lu_state_save_null
+#define SEF_CB_LU_RESPONSE_NULL         sef_cb_lu_response_null
+
+#define SEF_CB_LU_PREPARE_DEFAULT       sef_cb_lu_prepare_null
+#define SEF_CB_LU_STATE_ISVALID_DEFAULT sef_cb_lu_state_isvalid_generic
+#define SEF_CB_LU_STATE_CHANGED_DEFAULT sef_cb_lu_state_changed_null
+#define SEF_CB_LU_STATE_DUMP_DEFAULT    sef_cb_lu_state_dump_eval
+#define SEF_CB_LU_STATE_SAVE_DEFAULT    sef_cb_lu_state_save_null
+#define SEF_CB_LU_RESPONSE_DEFAULT      sef_cb_lu_response_rs_reply
+
+/* Standard live update states. */
+#define SEF_LU_STATE_NULL               0    /* null state */
+#define SEF_LU_STATE_WORK_FREE          1    /* no work in progress */
+#define SEF_LU_STATE_REQUEST_FREE       2    /* no request in progress */
+#define SEF_LU_STATE_PROTOCOL_FREE      3    /* no protocol in progress */
+#define SEF_LU_STATE_EVAL               4    /* evaluate expression */
+
+#define SEF_LU_STATE_UNREACHABLE        5    /* unreachable state */
+#define SEF_LU_STATE_PREPARE_CRASH      6    /* crash at prepare time */
+
+#define SEF_LU_STATE_STD_BASE           (SEF_LU_STATE_WORK_FREE)
+#define SEF_LU_STATE_DEBUG_BASE         (SEF_LU_STATE_UNREACHABLE)
+#define SEF_LU_STATE_CUSTOM_BASE        (SEF_LU_STATE_PREPARE_CRASH+1)
+
+#define SEF_LU_STATE_IS_STANDARD(s)     ((s) >= SEF_LU_STATE_STD_BASE \
+    && (s) < SEF_LU_STATE_CUSTOM_BASE \
+    && (SEF_LU_ALWAYS_ALLOW_DEBUG_STATES || !SEF_LU_STATE_IS_DEBUG(s)))
+#define SEF_LU_STATE_IS_DEBUG(s)     ((s) >= SEF_LU_STATE_DEBUG_BASE \
+    && (s) < SEF_LU_STATE_CUSTOM_BASE)
+
+#define SEF_LU_STATE_EVAL_MAX_LEN          512
+
+/* Live update flags (can be used as init flags as well). */
+#define SEF_LU_SELF          	      0x0100    /* this is a self update */
+#define SEF_LU_ASR           	      0x0200    /* this is an ASR update */
+#define SEF_LU_MULTI         	      0x0400    /* this is a multi-component update */
+#define SEF_LU_INCLUDES_VM     	      0x0800    /* the update includes VM */
+#define SEF_LU_INCLUDES_RS     	      0x1000    /* the update includes RS */
+#define SEF_LU_PREPARE_ONLY           0x2000    /* prepare only, no actual update taking place */
+#define SEF_LU_NOMMAP	      	      0x4000    /* update doesn't inherit mmapped regions */
+#define SEF_LU_DETACHED      	      0x8000    /* update detaches the old instance */
+
+#define SEF_LU_IS_IDENTITY_UPDATE(F) (((F) & (SEF_LU_SELF|SEF_LU_NOMMAP|SEF_LU_ASR|SEF_INIT_ST)) == SEF_LU_SELF)
+
+/* Debug. */
+#define SEF_LU_DEBUG_DEFAULT             0
+#define SEF_LU_ALWAYS_ALLOW_DEBUG_STATES 1
+
+#ifndef SEF_LU_DEBUG
+#define SEF_LU_DEBUG            SEF_LU_DEBUG_DEFAULT
+#endif
+
+#define sef_lu_dprint           sef_dprint
+#define sef_lu_debug_begin      sef_debug_begin
+#define sef_lu_debug_end        sef_debug_end
+
+/*===========================================================================*
+ *				  SEF Signal				     *
+ *===========================================================================*/
+/* What to intercept. */
+#define INTERCEPT_SEF_SIGNAL_REQUESTS 1
+#define SEF_SIGNAL_REQUEST_TYPE SIGS_SIGNAL_RECEIVED
+#define IS_SEF_SIGNAL_REQUEST(mp, status) \
+    (((mp)->m_type == SIGS_SIGNAL_RECEIVED && (mp)->m_source < INIT_PROC_NR) \
+    || (is_ipc_notify(status) && (mp)->m_source == SYSTEM))
+
+/* Callback type definitions. */
+typedef void(*sef_cb_signal_handler_t)(int signo);
+typedef  int(*sef_cb_signal_manager_t)(endpoint_t target, int signo);
+
+/* Callback registration helpers. */
+void sef_setcb_signal_handler(sef_cb_signal_handler_t cb);
+void sef_setcb_signal_manager(sef_cb_signal_manager_t cb);
+
+/* Predefined callback implementations. */
+void sef_cb_signal_handler_null(int signo);
+int sef_cb_signal_manager_null(endpoint_t target, int signo);
+
+void sef_cb_signal_handler_term(int signo);
+void sef_cb_signal_handler_posix_default(int signo);
+
+/* Macros for predefined callback implementations. */
+#define SEF_CB_SIGNAL_HANDLER_NULL      sef_cb_signal_handler_null
+#define SEF_CB_SIGNAL_MANAGER_NULL      sef_cb_signal_manager_null
+
+#define SEF_CB_SIGNAL_HANDLER_DEFAULT   sef_cb_signal_handler_null
+#define SEF_CB_SIGNAL_MANAGER_DEFAULT   sef_cb_signal_manager_null
+
+/* Debug. */
+#define SEF_SIGNAL_DEBUG_DEFAULT 0
+
+#ifndef SEF_SIGNAL_DEBUG
+#define SEF_SIGNAL_DEBUG                SEF_SIGNAL_DEBUG_DEFAULT
+#endif
+
+#define sef_signal_dprint               sef_dprint
+#define sef_signal_debug_begin          sef_debug_begin
+#define sef_signal_debug_end            sef_debug_end
+
+/*===========================================================================*
+ *				  SEF GCOV				     *
+ *===========================================================================*/
+/* What to intercept. */
+#define INTERCEPT_SEF_GCOV_REQUESTS 1
+#define SEF_GCOV_REQUEST_TYPE COMMON_REQ_GCOV_DATA
+#define IS_SEF_GCOV_REQUEST(mp, status) \
+    ((mp)->m_type == COMMON_REQ_GCOV_DATA && (mp)->m_source == VFS_PROC_NR)
+
+/* Callback type definitions. */
+typedef  int(*sef_cb_gcov_t)(message *msg);
+
+/* Callback registration helpers. */
+void sef_setcb_gcov(sef_cb_gcov_t cb);
+
+/* Macros for predefined callback implementations. */
+#define SEF_CB_GCOV_FLUSH_DEFAULT        do_gcov_flush_impl
+
+/*===========================================================================*
+ *			     SEF Fault Injection			     *
+ *===========================================================================*/
+/* What to intercept. */
+#define INTERCEPT_SEF_FI_REQUESTS 1
+#define SEF_FI_REQUEST_TYPE COMMON_REQ_FI_CTL
+#define IS_SEF_FI_REQUEST(mp, status) \
+    (m_ptr->m_type == COMMON_REQ_FI_CTL)
+
+/* Fault injection tool support. */
+#define SEF_FI_ALLOW_EDFI               1
+
+/*===========================================================================*
+ *                          SEF State Transfer                               *
+ *===========================================================================*/
+#define SEF_LU_STATE_EVAL_MAX_LEN          512
+
+/* State transfer helpers. */
+int sef_copy_state_region_ctl(sef_init_info_t *info,
+    vir_bytes *src_address, vir_bytes *dst_address);
+int sef_copy_state_region(sef_init_info_t *info,
+    vir_bytes address, size_t size, vir_bytes dst_address, int may_have_holes);
+int sef_st_state_transfer(sef_init_info_t *info);
+
+/* Callback prototypes to be passed to the State Transfer framwork. */
+int sef_old_state_table_lookup(sef_init_info_t *info, void *addr);
+int sef_old_state_table_lookup_opaque(void *info_opaque, void *addr);
+int sef_copy_state_region_opaque(void *info_opaque, uint32_t address,
+    size_t size, uint32_t dst_address);
+
+/* Debug. */
+#define SEF_ST_DEBUG_DEFAULT 		0
+
+#ifndef SEF_ST_DEBUG
+#define SEF_ST_DEBUG                    SEF_ST_DEBUG_DEFAULT
+#endif
+
+/*===========================================================================*
+ *                               SEF LLVM                                    *
+ *===========================================================================*/
+/* LLVM helpers. */
+int sef_llvm_magic_enabled(void);
+int sef_llvm_real_brk(char *newbrk);
+int sef_llvm_state_cleanup(void);
+void sef_llvm_dump_eval(char *expr);
+int sef_llvm_eval_bool(char *expr, char *result);
+void *sef_llvm_state_table_addr(void);
+size_t sef_llvm_state_table_size(void);
+void sef_llvm_stack_refs_save(char *stack_buff);
+void sef_llvm_stack_refs_restore(char *stack_buff);
+int sef_llvm_state_transfer(sef_init_info_t *info);
+int sef_llvm_add_special_mem_region(void *addr, size_t len, const char* name);
+int sef_llvm_del_special_mem_region_by_addr(void *addr);
+void sef_llvm_ds_st_init(void);
+void *sef_llvm_ac_mmap(void *buf, size_t len, int prot, int flags, int fd,
+	off_t offset);
+int sef_llvm_ac_munmap(void *buf, size_t len);
+
+int sef_llvm_ltckpt_enabled(void);
+int sef_llvm_get_ltckpt_offset(void);
+int sef_llvm_ltckpt_restart(int type, sef_init_info_t *info);
+
+#if !defined(USE_LIVEUPDATE)
+#undef INTERCEPT_SEF_LU_REQUESTS
+#undef SEF_LU_DEBUG
+#endif
+
+#endif /* _SEF_H */
+

Property changes on: lab4/.minix-src/include/minix/sef.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/virtio.h
===================================================================
--- lab4/.minix-src/include/minix/virtio.h	(nonexistent)
+++ lab4/.minix-src/include/minix/virtio.h	(revision 13)
@@ -0,0 +1,140 @@
+/*
+ * Generic virtio library for MINIX 3
+ *
+ * Copyright (c) 2013, A. Welzel, <arne.welzel@gmail.com>
+ *
+ * This software is released under the BSD license. See the LICENSE file
+ * included in the main directory of this source distribution for the
+ * license terms and conditions.
+ */
+
+#ifndef _MINIX_VIRTIO_H
+#define _MINIX_VIRTIO_H 1
+
+#include <sys/types.h>
+
+#define VIRTIO_VENDOR_ID			0x1AF4
+
+#define VIRTIO_HOST_F_OFF			0x0000
+#define VIRTIO_GUEST_F_OFF			0x0004
+#define VIRTIO_QADDR_OFF			0x0008
+
+#define VIRTIO_QSIZE_OFF			0x000C
+#define VIRTIO_QSEL_OFF				0x000E
+#define VIRTIO_QNOTFIY_OFF			0x0010
+
+#define VIRTIO_DEV_STATUS_OFF			0x0012
+#define VIRTIO_ISR_STATUS_OFF			0x0013
+#define VIRTIO_DEV_SPECIFIC_OFF			0x0014
+/* if msi is enabled, device specific headers shift by 4 */
+#define VIRTIO_MSI_ADD_OFF			0x0004
+#define VIRTIO_STATUS_ACK			0x01
+#define VIRTIO_STATUS_DRV			0x02
+#define VIRTIO_STATUS_DRV_OK			0x04
+#define VIRTIO_STATUS_FAIL			0x80
+
+
+/* Feature description */
+struct virtio_feature {
+	const char *name;
+	u8_t bit;
+	u8_t host_support;
+	u8_t guest_support;
+};
+
+/* Forward declaration of struct virtio_device.
+ *
+ * This structure is opaque to the caller.
+ */
+struct virtio_device;
+
+/* Find a virtio device with subdevice id subdevid. Returns a pointer
+ * to an opaque virtio_device instance.
+ */
+struct virtio_device *virtio_setup_device(u16_t subdevid,
+		const char *name,
+		struct virtio_feature *features,
+		int feature_count,
+		int threads, int skip);
+
+/* Attempt to allocate queue_cnt memory for queues */
+int virtio_alloc_queues(struct virtio_device *dev, int num_queues);
+
+/* Register the IRQ policy and indicate to the host we are ready to go */
+void virtio_device_ready(struct virtio_device *dev);
+
+/* Unregister the IRQ and reset the device */
+void virtio_reset_device(struct virtio_device *dev);
+
+/* Free the memory used by all queues */
+void virtio_free_queues(struct virtio_device *dev);
+
+/* Free all memory allocated for the device (except the queue memory,
+ * which has to be freed before with virtio_free_queues()).
+ *
+ * Don't touch the device afterwards! This is like free(dev).
+ */
+void virtio_free_device(struct virtio_device *dev);
+
+
+/* Feature helpers */
+int virtio_guest_supports(struct virtio_device *dev, int bit);
+int virtio_host_supports(struct virtio_device *dev, int bit);
+
+/*
+ * Use num vumap_phys elements and chain these as vring_desc elements
+ * into the vring.
+ *
+ * Kick the queue if needed.
+ *
+ * data is opaque and returned by virtio_from_queue() when the host
+ * processed the descriptor chain.
+ *
+ * Note: The last bit of vp_addr is used to flag whether an iovec is
+ *	 writable. This implies that only word aligned buffers can be
+ *	 used.
+ */
+int virtio_to_queue(struct virtio_device *dev, int qidx,
+			struct vumap_phys *bufs, size_t num, void *data);
+
+/*
+ * If the host used a chain of descriptors, return 0, set data as was given to
+ * virtio_to_queue(), and if len is not NULL, set it to the resulting length.
+ * If the host has not processed any element, return -1.
+ */
+int virtio_from_queue(struct virtio_device *dev, int qidx, void **data,
+	size_t *len);
+
+/* IRQ related functions */
+void virtio_irq_enable(struct virtio_device *dev);
+void virtio_irq_disable(struct virtio_device *dev);
+
+/* Checks the ISR field of the device and returns true if
+ * the interrupt was for this device.
+ */
+int virtio_had_irq(struct virtio_device *dev);
+
+
+u32_t virtio_read32(struct virtio_device *dev, i32_t offset);
+u16_t virtio_read16(struct virtio_device *dev, i32_t offset);
+u8_t virtio_read8(struct virtio_device *dev, i32_t offset);
+void virtio_write32(struct virtio_device *dev, i32_t offset, u32_t val);
+void virtio_write16(struct virtio_device *dev, i32_t offset, u16_t val);
+void virtio_write8(struct virtio_device *dev, i32_t offset, u8_t val);
+
+
+/*
+ * Device specific reads take MSI offset into account and all reads
+ * are at offset 20.
+ *
+ * Something like:
+ * read(off) --> readX(20 + (msi ? 4 : 0) + off)
+ */
+u32_t virtio_sread32(struct virtio_device *dev, i32_t offset);
+u16_t virtio_sread16(struct virtio_device *dev, i32_t offset);
+u8_t virtio_sread8(struct virtio_device *dev, i32_t offset);
+void virtio_swrite32(struct virtio_device *dev, i32_t offset, u32_t val);
+void virtio_swrite16(struct virtio_device *dev, i32_t offset, u16_t val);
+void virtio_swrite8(struct virtio_device *dev, i32_t offset, u8_t val);
+
+#endif /* _MINIX_VIRTIO_H */

Property changes on: lab4/.minix-src/include/minix/virtio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/msdosfs/bpb.h
===================================================================
--- lab4/.minix-src/include/msdosfs/bpb.h	(nonexistent)
+++ lab4/.minix-src/include/msdosfs/bpb.h	(revision 13)
@@ -0,0 +1,197 @@
+/*	$NetBSD: bpb.h,v 1.7 2012/11/04 17:57:59 jakllsch Exp $	*/
+
+/*
+ * Written by Paul Popelka (paulp@uts.amdahl.com)
+ *
+ * You can do anything you want with this software, just don't say you wrote
+ * it, and don't remove this notice.
+ *
+ * This software is provided "as is".
+ *
+ * The author supplies this software to be publicly redistributed on the
+ * understanding that the author is not responsible for the correct
+ * functioning of this software in any circumstances and is not liable for
+ * any damages caused by this software.
+ *
+ * October 1992
+ */
+
+#ifndef _MSDOSFS_BPB_H_
+#define _MSDOSFS_BPB_H_
+
+/*
+ * BIOS Parameter Block (BPB) for DOS 3.3
+ */
+struct bpb33 {
+	u_int16_t	bpbBytesPerSec;	/* bytes per sector */
+	u_int8_t	bpbSecPerClust;	/* sectors per cluster */
+	u_int16_t	bpbResSectors;	/* number of reserved sectors */
+	u_int8_t	bpbFATs;	/* number of FATs */
+	u_int16_t	bpbRootDirEnts;	/* number of root directory entries */
+	u_int16_t	bpbSectors;	/* total number of sectors */
+	u_int8_t	bpbMedia;	/* media descriptor */
+	u_int16_t	bpbFATsecs;	/* number of sectors per FAT */
+	u_int16_t	bpbSecPerTrack;	/* sectors per track */
+	u_int16_t	bpbHeads;	/* number of heads */
+	u_int16_t	bpbHiddenSecs;	/* number of hidden sectors */
+};
+
+/*
+ * BPB for DOS 5.0 The difference is bpbHiddenSecs is a short for DOS 3.3,
+ * and bpbHugeSectors is not in the 3.3 bpb.
+ */
+struct bpb50 {
+	u_int16_t	bpbBytesPerSec;	/* bytes per sector */
+	u_int8_t	bpbSecPerClust;	/* sectors per cluster */
+	u_int16_t	bpbResSectors;	/* number of reserved sectors */
+	u_int8_t	bpbFATs;	/* number of FATs */
+	u_int16_t	bpbRootDirEnts;	/* number of root directory entries */
+	u_int16_t	bpbSectors;	/* total number of sectors */
+	u_int8_t	bpbMedia;	/* media descriptor */
+	u_int16_t	bpbFATsecs;	/* number of sectors per FAT */
+	u_int16_t	bpbSecPerTrack;	/* sectors per track */
+	u_int16_t	bpbHeads;	/* number of heads */
+	u_int32_t	bpbHiddenSecs;	/* # of hidden sectors */
+	u_int32_t	bpbHugeSectors;	/* # of sectors if bpbSectors == 0 */
+};
+
+/*
+ * BPB for DOS 7.10 (FAT32).  This one has a few extensions to bpb50.
+ */
+struct bpb710 {
+	u_int16_t	bpbBytesPerSec;	/* bytes per sector */
+	u_int8_t	bpbSecPerClust;	/* sectors per cluster */
+	u_int16_t	bpbResSectors;	/* number of reserved sectors */
+	u_int8_t	bpbFATs;	/* number of FATs */
+	u_int16_t	bpbRootDirEnts;	/* number of root directory entries */
+	u_int16_t	bpbSectors;	/* total number of sectors */
+	u_int8_t	bpbMedia;	/* media descriptor */
+	u_int16_t	bpbFATsecs;	/* number of sectors per FAT */
+	u_int16_t	bpbSecPerTrack;	/* sectors per track */
+	u_int16_t	bpbHeads;	/* number of heads */
+	u_int32_t	bpbHiddenSecs;	/* # of hidden sectors */
+	u_int32_t	bpbHugeSectors;	/* # of sectors if bpbSectors == 0 */
+	u_int32_t	bpbBigFATsecs;	/* like bpbFATsecs for FAT32 */
+	u_int16_t	bpbExtFlags;	/* extended flags: */
+#define	FATNUM		0xf		/* mask for numbering active FAT */
+#define	FATMIRROR	0x80		/* FAT is mirrored (like it always was) */
+	u_int16_t	bpbFSVers;	/* filesystem version */
+#define	FSVERS		0		/* currently only 0 is understood */
+	u_int32_t	bpbRootClust;	/* start cluster for root directory */
+	u_int16_t	bpbFSInfo;	/* filesystem info structure sector */
+	u_int16_t	bpbBackup;	/* backup boot sector */
+	u_int8_t	bpbReserved[12]; /* Reserved for future expansion */
+};
+
+#ifdef	atari
+/*
+ * BPB for GEMDOS filesystems. Atari leaves the obsolete stuff undefined.
+ * Currently there is no need for a separate BPB structure.
+ */
+#if 0
+struct bpb_a {
+	u_int16_t	bpbBytesPerSec;	/* bytes per sector		*/
+	u_int8_t	bpbSecPerClust;	/* sectors per cluster		*/
+	u_int16_t	bpbResSectors;	/* number of reserved sectors	*/
+	u_int8_t	bpbFATs;	/* number of FATs		*/
+	u_int16_t	bpbRootDirEnts;	/* number of root directory entries */
+	u_int16_t	bpbSectors;	/* total number of sectors	*/
+	u_int8_t	bpbUseless1;	/* meaningless on GEMDOS FS	*/
+	u_int16_t	bpbFATsecs;	/* number of sectors per FAT	*/
+	u_int16_t	bpbUseless2;	/* meaningless for harddisk fs	*/
+	u_int16_t	bpbUseless3;	/* meaningless for harddisk fs	*/
+	u_int16_t	bpbHiddenSecs;	/* the TOS-BIOS ignores this	*/
+};
+#endif
+#endif	/* atari */
+
+/*
+ * The following structures represent how the bpb's look on disk.  shorts
+ * and longs are just character arrays of the appropriate length.  This is
+ * because the compiler forces shorts and longs to align on word or
+ * halfword boundaries.
+ */
+
+#include <sys/endian.h>
+
+#define	getushort(p)	le16dec(p)
+#define	getulong(p)	le32dec(p)
+#define	putushort(p, v) le16enc((p), (v))
+#define	putulong(p, v)	le32enc((p), (v))
+
+/*
+ * BIOS Parameter Block (BPB) for DOS 3.3
+ */
+struct byte_bpb33 {
+	int8_t bpbBytesPerSec[2];	/* bytes per sector */
+	int8_t bpbSecPerClust;		/* sectors per cluster */
+	int8_t bpbResSectors[2];	/* number of reserved sectors */
+	int8_t bpbFATs;			/* number of FATs */
+	int8_t bpbRootDirEnts[2];	/* number of root directory entries */
+	int8_t bpbSectors[2];		/* total number of sectors */
+	int8_t bpbMedia;		/* media descriptor */
+	int8_t bpbFATsecs[2];		/* number of sectors per FAT */
+	int8_t bpbSecPerTrack[2];	/* sectors per track */
+	int8_t bpbHeads[2];		/* number of heads */
+	int8_t bpbHiddenSecs[2];	/* number of hidden sectors */
+};
+
+/*
+ * BPB for DOS 5.0 The difference is bpbHiddenSecs is a short for DOS 3.3,
+ * and bpbHugeSectors is not in the 3.3 bpb.
+ */
+struct byte_bpb50 {
+	int8_t bpbBytesPerSec[2];	/* bytes per sector */
+	int8_t bpbSecPerClust;		/* sectors per cluster */
+	int8_t bpbResSectors[2];	/* number of reserved sectors */
+	int8_t bpbFATs;			/* number of FATs */
+	int8_t bpbRootDirEnts[2];	/* number of root directory entries */
+	int8_t bpbSectors[2];		/* total number of sectors */
+	int8_t bpbMedia;		/* media descriptor */
+	int8_t bpbFATsecs[2];		/* number of sectors per FAT */
+	int8_t bpbSecPerTrack[2];	/* sectors per track */
+	int8_t bpbHeads[2];		/* number of heads */
+	int8_t bpbHiddenSecs[4];	/* number of hidden sectors */
+	int8_t bpbHugeSectors[4];	/* # of sectors if bpbSectors == 0 */
+};
+
+/*
+ * BPB for DOS 7.10 (FAT32).  This one has a few extensions to bpb50.
+ */
+struct byte_bpb710 {
+	u_int8_t bpbBytesPerSec[2];	/* bytes per sector */
+	u_int8_t bpbSecPerClust;	/* sectors per cluster */
+	u_int8_t bpbResSectors[2];	/* number of reserved sectors */
+	u_int8_t bpbFATs;		/* number of FATs */
+	u_int8_t bpbRootDirEnts[2];	/* number of root directory entries */
+	u_int8_t bpbSectors[2];		/* total number of sectors */
+	u_int8_t bpbMedia;		/* media descriptor */
+	u_int8_t bpbFATsecs[2];		/* number of sectors per FAT */
+	u_int8_t bpbSecPerTrack[2];	/* sectors per track */
+	u_int8_t bpbHeads[2];		/* number of heads */
+	u_int8_t bpbHiddenSecs[4];	/* # of hidden sectors */
+	u_int8_t bpbHugeSectors[4];	/* # of sectors if bpbSectors == 0 */
+	u_int8_t bpbBigFATsecs[4];	/* like bpbFATsecs for FAT32 */
+	u_int8_t bpbExtFlags[2];	/* extended flags: */
+	u_int8_t bpbFSVers[2];		/* filesystem version */
+	u_int8_t bpbRootClust[4];	/* start cluster for root directory */
+	u_int8_t bpbFSInfo[2];		/* filesystem info structure sector */
+	u_int8_t bpbBackup[2];		/* backup boot sector */
+	u_int8_t bpbReserved[12];	/* Reserved for future expansion */
+};
+
+/*
+ * FAT32 FSInfo block.
+ */
+struct fsinfo {
+	u_int8_t fsisig1[4];
+	u_int8_t fsifill1[480];
+	u_int8_t fsisig2[4];
+	u_int8_t fsinfree[4];
+	u_int8_t fsinxtfree[4];
+	u_int8_t fsifill2[12];
+	u_int8_t fsisig3[4];
+	u_int8_t fsifill3[508];
+	u_int8_t fsisig4[4];
+};
+#endif /* _MSDOSFS_BPB_H_ */

Property changes on: lab4/.minix-src/include/msdosfs/bpb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/optset.h
===================================================================
--- lab4/.minix-src/include/minix/optset.h	(nonexistent)
+++ lab4/.minix-src/include/minix/optset.h	(revision 13)
@@ -0,0 +1,30 @@
+#ifndef _MINIX_OPTSET_H
+#define _MINIX_OPTSET_H
+
+typedef enum {
+  OPT_BOOL,
+  OPT_STRING,
+  OPT_INT
+} optset_type;
+
+/* An entry for the parser of an options set. The 'os_name' field must point
+ * to a string, which is treated case-insensitively; the last entry of a table
+ * must have NULL name. The 'os_type' field must be set to one of the OPT_
+ * values defined above. The 'os_ptr' field must point to the field that is to
+ * receive the value of a recognized option. For OPT_STRING, it must point to a
+ * string of a size set in 'os_val'; the resulting string may be truncated, but
+ * will always be null-terminated. For OPT_BOOL, it must point to an int which
+ * will be set to the value in 'os_val' if the option is present. For OPT_INT,
+ * it must point to an int which will be set to the provided option value;
+ * 'os_val' is then a base passed to strtol().
+ */
+struct optset {
+  const char *os_name;
+  optset_type os_type;
+  void *os_ptr;
+  int os_val;
+};
+
+void optset_parse(struct optset *table, char *string);
+
+#endif /* _MINIX_OPTSET_H */

Property changes on: lab4/.minix-src/include/minix/optset.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/ipc.h
===================================================================
--- lab4/.minix-src/include/minix/ipc.h	(nonexistent)
+++ lab4/.minix-src/include/minix/ipc.h	(revision 13)
@@ -0,0 +1,2835 @@
+#ifndef _IPC_H
+#define _IPC_H
+
+#include <minix/ipcconst.h>
+#include <minix/type.h>
+#include <minix/const.h>
+#include <sys/signal.h>
+#include <sys/types.h>
+
+/*==========================================================================* 
+ * Types relating to messages. 						    *
+ *==========================================================================*/ 
+
+#define M_PATH_STRING_MAX  40
+#define CTL_SHORTNAME 8 /* max sysctl(2) name length that fits in message */
+
+typedef struct {
+	uint8_t data[56];
+} mess_u8;
+_ASSERT_MSG_SIZE(mess_u8);
+
+typedef struct {
+	uint16_t data[28];
+} mess_u16;
+_ASSERT_MSG_SIZE(mess_u16);
+
+typedef struct {
+	uint32_t data[14];
+} mess_u32;
+_ASSERT_MSG_SIZE(mess_u32);
+
+typedef struct {
+	uint64_t data[7];
+} mess_u64;
+_ASSERT_MSG_SIZE(mess_u64);
+
+typedef struct {
+	uint64_t m1ull1;
+	int m1i1, m1i2, m1i3;
+	char *m1p1, *m1p2, *m1p3, *m1p4;
+	uint8_t padding[20];
+} mess_1;
+_ASSERT_MSG_SIZE(mess_1);
+
+typedef struct {
+	int64_t m2ll1;
+	int m2i1, m2i2, m2i3;
+	long m2l1, m2l2;
+	char *m2p1;
+	sigset_t sigset;
+	short m2s1;
+	uint8_t padding[6];
+} mess_2;
+_ASSERT_MSG_SIZE(mess_2);
+
+typedef struct {
+	int m3i1, m3i2;
+	char *m3p1;
+	char m3ca1[44];
+} mess_3;
+_ASSERT_MSG_SIZE(mess_3);
+
+typedef struct {
+	int64_t m4ll1;
+	long m4l1, m4l2, m4l3, m4l4, m4l5;
+	uint8_t padding[28];
+} mess_4;
+_ASSERT_MSG_SIZE(mess_4);
+
+typedef struct {
+	int m7i1, m7i2, m7i3, m7i4, m7i5;
+	char *m7p1, *m7p2;
+	uint8_t padding[28];
+} mess_7;
+_ASSERT_MSG_SIZE(mess_7);
+
+typedef struct {
+	uint64_t m9ull1, m9ull2;
+	long m9l1, m9l2, m9l3, m9l4, m9l5;
+	short m9s1, m9s2, m9s3, m9s4;
+	uint8_t padding[12];
+} mess_9;
+_ASSERT_MSG_SIZE(mess_9);
+
+typedef struct {
+	u64_t m10ull1;
+	int m10i1, m10i2, m10i3, m10i4;
+	long m10l1, m10l2, m10l3;
+	uint8_t padding[20];
+} mess_10;
+_ASSERT_MSG_SIZE(mess_10);
+
+/* Helper union for DS messages */
+union	ds_val {
+	cp_grant_id_t	grant;
+	u32_t		u32;
+	endpoint_t	ep;
+};
+
+typedef struct {
+	union	ds_val 	val_out;
+	int	val_len;
+	uint8_t padding[48];
+} mess_ds_reply;
+_ASSERT_MSG_SIZE(mess_ds_reply);
+
+typedef struct {
+	cp_grant_id_t	key_grant;
+	int		key_len;
+	int		flags;
+	union ds_val 	val_in;
+	int		val_len;
+	endpoint_t	owner;
+	uint8_t padding[32];
+} mess_ds_req;
+_ASSERT_MSG_SIZE(mess_ds_req);
+
+typedef struct {
+	off_t seek_pos;
+
+	size_t nbytes;
+
+	uint8_t data[44];
+} mess_fs_vfs_breadwrite;
+_ASSERT_MSG_SIZE(mess_fs_vfs_breadwrite);
+
+typedef struct {
+	mode_t mode;
+
+	uint8_t data[52];
+} mess_fs_vfs_chmod;
+_ASSERT_MSG_SIZE(mess_fs_vfs_chmod);
+
+typedef struct {
+	mode_t mode;
+
+	uint8_t data[52];
+} mess_fs_vfs_chown;
+_ASSERT_MSG_SIZE(mess_fs_vfs_chown);
+
+typedef struct {
+	off_t file_size;
+	ino_t inode;
+
+	mode_t mode;
+	uid_t uid;
+	gid_t gid;
+
+	uint8_t data[28];
+} mess_fs_vfs_create;
+_ASSERT_MSG_SIZE(mess_fs_vfs_create);
+
+typedef struct {
+	off_t seek_pos;
+
+	size_t nbytes;
+
+	uint8_t data[44];
+} mess_fs_vfs_getdents;
+_ASSERT_MSG_SIZE(mess_fs_vfs_getdents);
+
+typedef struct {
+	off_t offset;
+	off_t file_size;
+	dev_t device;
+	ino_t inode;
+
+	mode_t mode;
+	uid_t uid;
+	gid_t gid;
+
+	uint16_t symloop;
+
+	uint8_t data[10];
+} mess_fs_vfs_lookup;
+_ASSERT_MSG_SIZE(mess_fs_vfs_lookup);
+
+typedef struct {
+	off_t file_size;
+	dev_t device;
+	ino_t inode;
+
+	mode_t mode;
+	uid_t uid;
+	gid_t gid;
+
+	uint8_t data[20];
+} mess_fs_vfs_newnode;
+_ASSERT_MSG_SIZE(mess_fs_vfs_newnode);
+
+typedef struct {
+	size_t nbytes;
+
+	uint8_t data[52];
+} mess_fs_vfs_rdlink;
+_ASSERT_MSG_SIZE(mess_fs_vfs_rdlink);
+
+typedef struct {
+	off_t file_size;
+	dev_t device;
+	ino_t inode;
+
+	uint32_t flags;
+	mode_t mode;
+	uid_t uid;
+	gid_t gid;
+
+	uint16_t con_reqs;
+
+	uint8_t data[14];
+} mess_fs_vfs_readsuper;
+_ASSERT_MSG_SIZE(mess_fs_vfs_readsuper);
+
+typedef struct {
+	off_t seek_pos;
+
+	size_t nbytes;
+
+	uint8_t data[44];
+} mess_fs_vfs_readwrite;
+_ASSERT_MSG_SIZE(mess_fs_vfs_readwrite);
+
+typedef struct {
+	uint8_t padding[56];
+} mess_i2c_li2cdriver_busc_i2c_exec;
+_ASSERT_MSG_SIZE(mess_i2c_li2cdriver_busc_i2c_exec);
+
+typedef struct {
+	uint8_t padding[56];
+} mess_i2c_li2cdriver_busc_i2c_reserve;
+_ASSERT_MSG_SIZE(mess_i2c_li2cdriver_busc_i2c_reserve);
+
+typedef struct {
+	int kbd_id;
+	int mouse_id;
+	int rsvd1_id;
+	int rsvd2_id;
+
+	uint8_t padding[40];
+} mess_input_linputdriver_input_conf;
+_ASSERT_MSG_SIZE(mess_input_linputdriver_input_conf);
+
+typedef struct {
+	uint32_t led_mask;
+
+	uint8_t padding[52];
+} mess_input_linputdriver_setleds;
+_ASSERT_MSG_SIZE(mess_input_linputdriver_setleds);
+
+typedef struct {
+	int id;
+	int page;
+	int code;
+	int value;
+	int flags;
+
+	uint8_t padding[36];
+} mess_input_tty_event;
+_ASSERT_MSG_SIZE(mess_input_tty_event);
+
+typedef struct {
+	time_t acnt_queue;
+
+	unsigned long acnt_deqs;
+	unsigned long acnt_ipc_sync;
+	unsigned long acnt_ipc_async;
+	unsigned long acnt_preempt;
+	uint32_t acnt_cpu;
+	uint32_t acnt_cpu_load;
+
+	uint8_t padding[24];
+} mess_krn_lsys_schedule;
+_ASSERT_MSG_SIZE(mess_krn_lsys_schedule);
+
+typedef struct {
+	uint32_t value;
+
+	uint8_t padding[52];
+} mess_krn_lsys_sys_devio;
+_ASSERT_MSG_SIZE(mess_krn_lsys_sys_devio);
+
+typedef struct {
+	endpoint_t endpt;
+	vir_bytes msgaddr;
+
+	uint8_t padding[48];
+} mess_krn_lsys_sys_fork;
+_ASSERT_MSG_SIZE(mess_krn_lsys_sys_fork);
+
+typedef struct {
+	endpoint_t endpt;
+	int privflags;
+	int initflags;
+	char name[44];
+
+} mess_krn_lsys_sys_getwhoami;
+_ASSERT_MSG_SIZE(mess_krn_lsys_sys_getwhoami);
+
+typedef struct {
+	int hook_id;
+
+	uint8_t padding[52];
+} mess_krn_lsys_sys_irqctl;
+_ASSERT_MSG_SIZE(mess_krn_lsys_sys_irqctl);
+
+typedef struct {
+	clock_t real_ticks;
+	clock_t boot_ticks;
+	clock_t user_time;
+	clock_t system_time;
+	time_t boot_time;
+
+	uint8_t padding[32];
+} mess_krn_lsys_sys_times;
+_ASSERT_MSG_SIZE(mess_krn_lsys_sys_times);
+
+typedef struct {
+	long int data;
+
+	uint8_t padding[52];
+} mess_krn_lsys_sys_trace;
+_ASSERT_MSG_SIZE(mess_krn_lsys_sys_trace);
+
+typedef struct {
+	phys_bytes dst_addr;
+
+	uint8_t padding[52];
+} mess_krn_lsys_sys_umap;
+_ASSERT_MSG_SIZE(mess_krn_lsys_sys_umap);
+
+typedef struct {
+	int pcount;
+
+	uint8_t padding[52];
+} mess_krn_lsys_sys_vumap;
+_ASSERT_MSG_SIZE(mess_krn_lsys_sys_vumap);
+
+typedef struct {
+	off_t pos;
+
+	int minor;
+	int id;
+	int access;
+
+	int count;
+	cp_grant_id_t grant;
+	int flags;
+
+	endpoint_t user;
+	unsigned long request;
+
+	uint8_t padding[16];
+} mess_lbdev_lblockdriver_msg;
+_ASSERT_MSG_SIZE(mess_lbdev_lblockdriver_msg);
+
+typedef struct {
+	int status;
+	int id;
+
+	uint8_t padding[48];
+} mess_lblockdriver_lbdev_reply;
+_ASSERT_MSG_SIZE(mess_lblockdriver_lbdev_reply);
+
+typedef struct {
+	int		id;
+	int		num;
+	int		cmd;
+	vir_bytes	opt;
+	int		ret;
+	uint8_t		padding[36];
+} mess_lc_ipc_semctl;
+_ASSERT_MSG_SIZE(mess_lc_ipc_semctl);
+
+typedef struct {
+	key_t		key;
+	int		nr;
+	int		flag;
+	int		retid;
+	uint8_t		padding[40];
+} mess_lc_ipc_semget;
+_ASSERT_MSG_SIZE(mess_lc_ipc_semget);
+
+typedef struct {
+	int		id;
+	void		*ops;
+	unsigned int	size;
+	uint8_t		padding[42];
+} mess_lc_ipc_semop;
+_ASSERT_MSG_SIZE(mess_lc_ipc_semop);
+
+typedef struct {
+	int		id;
+	const void	*addr;
+	int		flag;
+	void		*retaddr;
+	uint8_t		padding[40];
+} mess_lc_ipc_shmat;
+_ASSERT_MSG_SIZE(mess_lc_ipc_shmat);
+
+typedef struct {
+	int		id;
+	int		cmd;
+	void		*buf;
+	int		ret;
+	uint8_t		padding[40];
+} mess_lc_ipc_shmctl;
+_ASSERT_MSG_SIZE(mess_lc_ipc_shmctl);
+
+typedef struct {
+	const void	*addr;
+	uint8_t		padding[52];
+} mess_lc_ipc_shmdt;
+_ASSERT_MSG_SIZE(mess_lc_ipc_shmdt);
+
+typedef struct {
+	key_t		key;
+	size_t		size;
+	int		flag;
+	int		retid;
+	uint8_t		padding[40];
+} mess_lc_ipc_shmget;
+_ASSERT_MSG_SIZE(mess_lc_ipc_shmget);
+
+typedef struct {
+	vir_bytes	oldp;
+	size_t		oldlen;
+	vir_bytes	newp;
+	size_t		newlen;
+	unsigned int	namelen;
+	vir_bytes	namep;
+	int		name[CTL_SHORTNAME];
+} mess_lc_mib_sysctl;
+_ASSERT_MSG_SIZE(mess_lc_mib_sysctl);
+
+typedef struct {
+	vir_bytes name;
+	size_t namelen;
+	vir_bytes frame;
+	size_t framelen;
+	vir_bytes ps_str;
+
+	uint8_t padding[36];
+} mess_lc_pm_exec;
+_ASSERT_MSG_SIZE(mess_lc_pm_exec);
+
+typedef struct {
+	int status;
+
+	uint8_t padding[52];
+} mess_lc_pm_exit;
+_ASSERT_MSG_SIZE(mess_lc_pm_exit);
+
+typedef struct {
+	pid_t pid;
+
+	uint8_t padding[52];
+} mess_lc_pm_getsid;
+_ASSERT_MSG_SIZE(mess_lc_pm_getsid);
+
+typedef struct {
+	int num;
+	vir_bytes ptr;		/* gid_t * */
+
+	uint8_t padding[48];
+} mess_lc_pm_groups;
+_ASSERT_MSG_SIZE(mess_lc_pm_groups);
+
+typedef struct {
+	int which;
+	vir_bytes value;	/* const struct itimerval * */
+	vir_bytes ovalue;	/* struct itimerval * */
+
+	uint8_t padding[44];
+} mess_lc_pm_itimer;
+_ASSERT_MSG_SIZE(mess_lc_pm_itimer);
+
+typedef struct {
+	vir_bytes ctx;		/* mcontext_t * */
+
+	uint8_t padding[52];
+} mess_lc_pm_mcontext;
+_ASSERT_MSG_SIZE(mess_lc_pm_mcontext);
+
+typedef struct {
+	int which;
+	int who;
+	int prio;
+
+	uint8_t padding[44];
+} mess_lc_pm_priority;
+_ASSERT_MSG_SIZE(mess_lc_pm_priority);
+
+typedef struct {
+	pid_t pid;
+	int req;
+	vir_bytes addr;
+	long data;
+
+	uint8_t padding[40];
+} mess_lc_pm_ptrace;
+_ASSERT_MSG_SIZE(mess_lc_pm_ptrace);
+
+typedef struct {
+	int how;
+
+	uint8_t padding[52];
+} mess_lc_pm_reboot;
+_ASSERT_MSG_SIZE(mess_lc_pm_reboot);
+
+typedef struct {
+	endpoint_t who;
+	vir_bytes addr;
+
+	uint8_t padding[48];
+} mess_lc_pm_rusage;
+_ASSERT_MSG_SIZE(mess_lc_pm_rusage);
+
+typedef struct {
+	gid_t gid;
+
+	uint8_t padding[52];
+} mess_lc_pm_setgid;
+_ASSERT_MSG_SIZE(mess_lc_pm_setgid);
+
+typedef struct {
+	uid_t uid;
+
+	uint8_t padding[52];
+} mess_lc_pm_setuid;
+_ASSERT_MSG_SIZE(mess_lc_pm_setuid);
+
+typedef struct {
+	pid_t pid;
+	int nr;
+	vir_bytes act;		/* const struct sigaction * */
+	vir_bytes oact;		/* struct sigaction * */
+	vir_bytes ret;		/* int (*)(void) */
+
+	uint8_t padding[36];
+} mess_lc_pm_sig;
+_ASSERT_MSG_SIZE(mess_lc_pm_sig);
+
+typedef struct {
+	int how;
+	vir_bytes ctx;
+	sigset_t set;
+
+	uint8_t padding[32];
+} mess_lc_pm_sigset;
+_ASSERT_MSG_SIZE(mess_lc_pm_sigset);
+
+typedef struct {
+	int action;
+	int freq;
+	int intr_type;
+	vir_bytes ctl_ptr;
+	vir_bytes mem_ptr;
+	size_t mem_size;
+
+	uint8_t padding[32];
+} mess_lc_pm_sprof;
+_ASSERT_MSG_SIZE(mess_lc_pm_sprof);
+
+typedef struct {
+	int req;
+	int field;
+	size_t len;
+	vir_bytes value;
+
+	uint8_t padding[40];
+} mess_lc_pm_sysuname;
+_ASSERT_MSG_SIZE(mess_lc_pm_sysuname);
+
+typedef struct {
+	time_t sec;
+
+	clockid_t clk_id;
+	int now;
+	long nsec;
+
+	uint8_t padding[36];
+} mess_lc_pm_time;
+_ASSERT_MSG_SIZE(mess_lc_pm_time);
+
+typedef struct {
+	pid_t pid;
+	int options;
+	vir_bytes addr;			/* struct rusage * */
+
+	uint8_t padding[44];
+} mess_lc_pm_wait4;
+_ASSERT_MSG_SIZE(mess_lc_pm_wait4);
+
+typedef struct {
+	cp_grant_id_t grant;
+	vir_bytes tm;			/* struct tm * */
+	int flags;
+
+	uint8_t padding[44];
+} mess_lc_readclock_rtcdev;
+_ASSERT_MSG_SIZE(mess_lc_readclock_rtcdev);
+
+typedef struct {
+	unsigned long request;
+	vir_bytes arg;
+
+	uint8_t padding[48];
+} mess_lc_svrctl;
+_ASSERT_MSG_SIZE(mess_lc_svrctl);
+
+typedef struct {
+	vir_bytes name;
+	size_t len;
+	int fd;
+	uid_t owner;
+	gid_t group;
+
+	uint8_t padding[36];
+} mess_lc_vfs_chown;
+_ASSERT_MSG_SIZE(mess_lc_vfs_chown);
+
+typedef struct {
+	int fd;
+	int nblock;
+
+	uint8_t padding[48];
+} mess_lc_vfs_close;
+_ASSERT_MSG_SIZE(mess_lc_vfs_close);
+
+typedef struct {
+	vir_bytes name;
+	size_t len;
+	int flags;
+	mode_t mode;
+
+	uint8_t padding[40];
+} mess_lc_vfs_creat;
+_ASSERT_MSG_SIZE(mess_lc_vfs_creat);
+
+typedef struct {
+	int fd;
+
+	uint8_t padding[52];
+} mess_lc_vfs_fchdir;
+_ASSERT_MSG_SIZE(mess_lc_vfs_fchdir);
+
+typedef struct {
+	int fd;
+	mode_t mode;
+
+	uint8_t padding[48];
+} mess_lc_vfs_fchmod;
+_ASSERT_MSG_SIZE(mess_lc_vfs_fchmod);
+
+typedef struct {
+	int fd;
+	int cmd;
+	int arg_int;
+	vir_bytes arg_ptr;	/* struct flock * */
+
+	uint8_t padding[40];
+} mess_lc_vfs_fcntl;
+_ASSERT_MSG_SIZE(mess_lc_vfs_fcntl);
+
+typedef struct {
+	int fd;
+	vir_bytes buf;		/* struct stat * */
+
+	uint8_t padding[48];
+} mess_lc_vfs_fstat;
+_ASSERT_MSG_SIZE(mess_lc_vfs_fstat);
+
+typedef struct {
+	int fd;
+
+	uint8_t padding[52];
+} mess_lc_vfs_fsync;
+_ASSERT_MSG_SIZE(mess_lc_vfs_fsync);
+
+typedef struct {
+	size_t labellen;
+	size_t buflen;
+	vir_bytes label;
+	vir_bytes buf;
+
+	uint8_t padding[40];
+} mess_lc_vfs_gcov;
+_ASSERT_MSG_SIZE(mess_lc_vfs_gcov);
+
+typedef struct {
+	int32_t flags;
+	size_t len;
+	vir_bytes buf;		/* struct statvfs */
+
+	uint8_t padding[44];
+} mess_lc_vfs_getvfsstat;
+_ASSERT_MSG_SIZE(mess_lc_vfs_getvfsstat);
+
+typedef struct {
+	int fd;
+	unsigned long req;
+	vir_bytes arg;
+
+	uint8_t padding[44];
+} mess_lc_vfs_ioctl;
+_ASSERT_MSG_SIZE(mess_lc_vfs_ioctl);
+
+typedef struct {
+	vir_bytes name1;
+	vir_bytes name2;
+	size_t len1;
+	size_t len2;
+
+	uint8_t padding[40];
+} mess_lc_vfs_link;
+_ASSERT_MSG_SIZE(mess_lc_vfs_link);
+
+typedef struct {
+	int fd;
+	int backlog;
+
+	u8_t padding[48];
+} mess_lc_vfs_listen;
+_ASSERT_MSG_SIZE(mess_lc_vfs_listen);
+
+typedef struct {
+	off_t offset;
+
+	int fd;
+	int whence;
+
+	uint8_t padding[40];
+} mess_lc_vfs_lseek;
+_ASSERT_MSG_SIZE(mess_lc_vfs_lseek);
+
+typedef struct {
+	dev_t device;
+
+	vir_bytes name;
+	size_t len;
+	mode_t mode;
+
+	uint8_t padding[36];
+} mess_lc_vfs_mknod;
+_ASSERT_MSG_SIZE(mess_lc_vfs_mknod);
+
+typedef struct {
+	int flags;
+	size_t devlen;
+	size_t pathlen;
+	size_t typelen;
+	size_t labellen;
+	vir_bytes dev;
+	vir_bytes path;
+	vir_bytes type;
+	vir_bytes label;
+
+	uint8_t padding[20];
+} mess_lc_vfs_mount;
+_ASSERT_MSG_SIZE(mess_lc_vfs_mount);
+
+typedef struct {
+	vir_bytes name;
+	size_t len;
+	int flags;
+	mode_t mode;
+	char buf[M_PATH_STRING_MAX];
+} mess_lc_vfs_path;
+_ASSERT_MSG_SIZE(mess_lc_vfs_path);
+
+typedef struct {
+	/*
+	 * We are in the process of cleaning up this message, by moving the
+	 * flags value from the third integer into the first.  Once enough time
+	 * has passed, we can get rid of the second and third integer fields.
+	 */
+	int flags;
+	int _unused;
+	int oflags;
+
+	uint8_t padding[44];
+} mess_lc_vfs_pipe2;
+_ASSERT_MSG_SIZE(mess_lc_vfs_pipe2);
+
+typedef struct {
+	vir_bytes name;		/* const char * */
+	size_t namelen;
+	vir_bytes buf;
+	size_t bufsize;
+
+	uint8_t padding[40];
+} mess_lc_vfs_readlink;
+_ASSERT_MSG_SIZE(mess_lc_vfs_readlink);
+
+typedef struct {
+	int fd;
+	vir_bytes buf;
+	size_t len;
+	size_t cum_io;		/* reserved/internal, set to 0 */
+
+	uint8_t padding[40];
+} mess_lc_vfs_readwrite;
+_ASSERT_MSG_SIZE(mess_lc_vfs_readwrite);
+
+typedef struct {
+	uint32_t nfds;
+	fd_set *readfds;
+	fd_set *writefds;
+	fd_set *errorfds;
+	vir_bytes timeout;	/* user-provided 'struct timeval *' */
+
+	uint8_t padding[36];
+} mess_lc_vfs_select;
+_ASSERT_MSG_SIZE(mess_lc_vfs_select);
+
+typedef struct {
+	int fd;
+	vir_bytes buf;		/* void * */
+	size_t len;
+	int flags;
+	vir_bytes addr;		/* struct sockaddr * */
+	unsigned int addr_len;	/* socklen_t */
+
+	uint8_t padding[32];
+} mess_lc_vfs_sendrecv;
+_ASSERT_MSG_SIZE(mess_lc_vfs_sendrecv);
+
+typedef struct {
+	int fd;
+	int how;
+
+	uint8_t padding[48];
+} mess_lc_vfs_shutdown;
+_ASSERT_MSG_SIZE(mess_lc_vfs_shutdown);
+
+typedef struct {
+	int fd;
+	vir_bytes addr;		/* struct sockaddr * */
+	unsigned int addr_len;	/* socklen_t */
+
+	uint8_t padding[44];
+} mess_lc_vfs_sockaddr;
+_ASSERT_MSG_SIZE(mess_lc_vfs_sockaddr);
+
+typedef struct {
+	int domain;
+	int type;
+	int protocol;
+
+	uint8_t padding[44];
+} mess_lc_vfs_socket;
+_ASSERT_MSG_SIZE(mess_lc_vfs_socket);
+
+typedef struct {
+	int fd;
+	vir_bytes msgbuf;	/* struct msghdr * */
+	int flags;
+
+	uint8_t padding[44];
+} mess_lc_vfs_sockmsg;
+_ASSERT_MSG_SIZE(mess_lc_vfs_sockmsg);
+
+typedef struct {
+	int fd;
+	int level;
+	int name;
+	vir_bytes buf;		/* void * */
+	unsigned int len;	/* socklen_t */
+
+	uint8_t padding[36];
+} mess_lc_vfs_sockopt;
+_ASSERT_MSG_SIZE(mess_lc_vfs_sockopt);
+
+typedef struct {
+	size_t len;
+	vir_bytes name;		/* const char * */
+	vir_bytes buf;		/* struct stat * */
+
+	uint8_t padding[44];
+} mess_lc_vfs_stat;
+_ASSERT_MSG_SIZE(mess_lc_vfs_stat);
+
+typedef struct {
+	int fd;
+	int flags;
+	size_t len;
+	vir_bytes name;
+	vir_bytes buf;
+
+	uint8_t padding[36];
+} mess_lc_vfs_statvfs1;
+_ASSERT_MSG_SIZE(mess_lc_vfs_statvfs1);
+
+typedef struct {
+	off_t offset;
+
+	int fd;
+	vir_bytes name;
+	size_t len;
+
+	uint8_t padding[36];
+} mess_lc_vfs_truncate;
+_ASSERT_MSG_SIZE(mess_lc_vfs_truncate);
+
+typedef struct {
+	mode_t mask;
+
+	uint8_t padding[52];
+} mess_lc_vfs_umask;
+_ASSERT_MSG_SIZE(mess_lc_vfs_umask);
+
+typedef struct {
+	vir_bytes name;
+	size_t namelen;
+	vir_bytes label;
+	size_t labellen;
+
+	uint8_t padding[40];
+} mess_lc_vfs_umount;
+_ASSERT_MSG_SIZE(mess_lc_vfs_umount);
+
+typedef struct {
+	void		*addr;
+	uint8_t		padding[52];
+} mess_lc_vm_brk;
+_ASSERT_MSG_SIZE(mess_lc_vm_brk);
+
+typedef struct {
+	endpoint_t	endpt;
+	void		*addr;
+	void		*ret_addr;
+	uint8_t		padding[44];
+} mess_lc_vm_getphys;
+_ASSERT_MSG_SIZE(mess_lc_vm_getphys);
+
+typedef struct {
+	endpoint_t	forwhom;
+	void		*addr;
+	uint8_t		padding[48];
+} mess_lc_vm_shm_unmap;
+_ASSERT_MSG_SIZE(mess_lc_vm_shm_unmap);
+
+typedef struct {
+	int status;
+	uint32_t id;		/* should be cdev_id_t */
+
+	uint8_t padding[48];
+} mess_lchardriver_vfs_reply;
+_ASSERT_MSG_SIZE(mess_lchardriver_vfs_reply);
+
+typedef struct {
+	int status;
+	int32_t minor;
+
+	uint8_t padding[48];
+} mess_lchardriver_vfs_sel1;
+_ASSERT_MSG_SIZE(mess_lchardriver_vfs_sel1);
+
+typedef struct {
+	int status;
+	int32_t minor;
+
+	uint8_t padding[48];
+} mess_lchardriver_vfs_sel2;
+_ASSERT_MSG_SIZE(mess_lchardriver_vfs_sel2);
+
+typedef struct {
+	endpoint_t endpt;
+	vir_bytes ptr;		/* struct exec_info * */
+
+	uint8_t padding[48];
+} mess_lexec_pm_exec_new;
+_ASSERT_MSG_SIZE(mess_lexec_pm_exec_new);
+
+typedef struct {
+	cp_grant_id_t grant;
+
+	uint8_t padding[52];
+} mess_li2cdriver_i2c_busc_i2c_exec;
+_ASSERT_MSG_SIZE(mess_li2cdriver_i2c_busc_i2c_exec);
+
+typedef struct {
+	uint16_t addr; /* FIXME: strictly speaking this is an i2c_addr_t, but
+			  to get it I would need to include
+			  sys/dev/i2c/i2c_io.h, which I am not sure is a good
+			  idea to have everywhere. */
+
+	uint8_t padding[54];
+} mess_li2cdriver_i2c_busc_i2c_reserve;
+_ASSERT_MSG_SIZE(mess_li2cdriver_i2c_busc_i2c_reserve);
+
+typedef struct {
+	int id;
+	int page;
+	int code;
+	int value;
+	int flags;
+
+	uint8_t padding[36];
+} mess_linputdriver_input_event;
+_ASSERT_MSG_SIZE(mess_linputdriver_input_event);
+
+typedef struct {
+	int32_t req_id;
+	int32_t sock_id;
+	int status;
+	unsigned int len;
+
+	uint8_t padding[40];
+} mess_lsockdriver_vfs_accept_reply;
+_ASSERT_MSG_SIZE(mess_lsockdriver_vfs_accept_reply);
+
+typedef struct {
+	int32_t req_id;
+	int status;
+	unsigned int ctl_len;
+	unsigned int addr_len;
+	int flags;
+
+	uint8_t padding[36];
+} mess_lsockdriver_vfs_recv_reply;
+_ASSERT_MSG_SIZE(mess_lsockdriver_vfs_recv_reply);
+
+typedef struct {
+	int32_t req_id;
+	int status;
+
+	uint8_t padding[48];
+} mess_lsockdriver_vfs_reply;
+_ASSERT_MSG_SIZE(mess_lsockdriver_vfs_reply);
+
+typedef struct {
+	int32_t sock_id;
+	int status;
+
+	uint8_t padding[48];
+} mess_lsockdriver_vfs_select_reply;
+_ASSERT_MSG_SIZE(mess_lsockdriver_vfs_select_reply);
+
+typedef struct {
+	int32_t req_id;
+	int32_t sock_id;
+	int32_t sock_id2;
+
+	uint8_t padding[44];
+} mess_lsockdriver_vfs_socket_reply;
+_ASSERT_MSG_SIZE(mess_lsockdriver_vfs_socket_reply);
+
+typedef struct {
+        cp_grant_id_t gid;
+	size_t size;
+	int subtype;
+
+        uint8_t padding[44];
+} mess_lsys_fi_ctl;
+_ASSERT_MSG_SIZE(mess_lsys_fi_ctl);
+
+typedef struct {
+        int status;
+
+        uint8_t padding[52];
+} mess_lsys_fi_reply;
+_ASSERT_MSG_SIZE(mess_lsys_fi_reply);
+
+typedef struct {
+	int what;
+	vir_bytes where;
+	size_t size;
+
+	uint8_t padding[44];
+} mess_lsys_getsysinfo;
+_ASSERT_MSG_SIZE(mess_lsys_getsysinfo);
+
+typedef struct {
+	size_t size;
+	phys_bytes addr;
+	vir_bytes buf;
+
+	uint8_t padding[44];
+} mess_lsys_krn_readbios;
+_ASSERT_MSG_SIZE(mess_lsys_krn_readbios);
+
+typedef struct {
+	endpoint_t	from_to;
+	cp_grant_id_t	gid;
+	size_t		offset;
+	void		*address;
+	size_t		bytes;
+	uint8_t padding[36];
+} mess_lsys_kern_safecopy;
+_ASSERT_MSG_SIZE(mess_lsys_kern_safecopy);
+
+typedef struct {
+	uint32_t flags;
+	endpoint_t endpoint;
+	int priority;
+	int quantum;
+	int cpu;
+
+	uint8_t padding[36];
+} mess_lsys_krn_schedctl;
+_ASSERT_MSG_SIZE(mess_lsys_krn_schedctl);
+
+typedef struct {
+	endpoint_t endpoint;
+	int quantum;
+	int priority;
+	int cpu;
+	int niced;
+
+	uint8_t padding[36];
+} mess_lsys_krn_schedule;
+_ASSERT_MSG_SIZE(mess_lsys_krn_schedule);
+
+typedef struct {
+	int how;
+
+	uint8_t padding[52];
+} mess_lsys_krn_sys_abort;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_abort);
+
+typedef struct {
+	endpoint_t endpt;
+
+	uint8_t padding[52];
+} mess_lsys_krn_sys_clear;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_clear);
+
+typedef struct {
+	endpoint_t src_endpt;
+	vir_bytes src_addr;
+	endpoint_t dst_endpt;
+	vir_bytes dst_addr;
+	phys_bytes nr_bytes;
+	int flags;
+
+	uint8_t padding[32];
+} mess_lsys_krn_sys_copy;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_copy);
+
+typedef struct {
+	int request;
+	int port;
+	uint32_t value;
+
+	uint8_t padding[44];
+} mess_lsys_krn_sys_devio;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_devio);
+
+typedef struct {
+	int code;
+	vir_bytes buf;
+	int len;
+	endpoint_t endpt;
+
+	uint8_t padding[40];
+} mess_lsys_krn_sys_diagctl;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_diagctl);
+
+typedef struct {
+	endpoint_t endpt;
+	vir_bytes ip;
+	vir_bytes stack;
+	vir_bytes name;
+	vir_bytes ps_str;
+
+	uint8_t padding[36];
+} mess_lsys_krn_sys_exec;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_exec);
+
+typedef struct {
+	endpoint_t endpt;
+	endpoint_t slot;
+	uint32_t flags;
+
+	uint8_t padding[44];
+} mess_lsys_krn_sys_fork;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_fork);
+
+typedef struct {
+	int request;
+	endpoint_t endpt;
+	vir_bytes val_ptr;
+	int val_len;
+	vir_bytes val_ptr2;
+	int val_len2_e;
+
+	uint8_t padding[32];
+} mess_lsys_krn_sys_getinfo;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_getinfo);
+
+typedef struct {
+	endpoint_t endpt;
+	vir_bytes ctx_ptr;
+
+	uint8_t padding[48];
+} mess_lsys_krn_sys_getmcontext;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_getmcontext);
+
+typedef struct {
+	endpoint_t endpt;
+
+	uint8_t padding[52];
+} mess_lsys_krn_sys_iopenable;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_iopenable);
+
+typedef struct {
+	int request;
+	int vector;
+	int policy;
+	int hook_id;
+
+	uint8_t padding[40];
+} mess_lsys_krn_sys_irqctl;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_irqctl);
+
+typedef struct {
+	phys_bytes base;
+	phys_bytes count;
+	unsigned long pattern;
+	endpoint_t process;
+
+	uint8_t padding[40];
+} mess_lsys_krn_sys_memset;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_memset);
+
+typedef struct {
+	int request;
+	endpoint_t endpt;
+	vir_bytes arg_ptr;
+	phys_bytes phys_start;
+	phys_bytes phys_len;
+
+	uint8_t padding[36];
+} mess_lsys_krn_sys_privctl;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_privctl);
+
+typedef struct {
+	int request;
+	long int port;
+	endpoint_t vec_endpt;
+	phys_bytes vec_addr;
+	vir_bytes vec_size;
+	vir_bytes offset;
+
+	uint8_t padding[32];
+} mess_lsys_krn_sys_sdevio;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_sdevio);
+
+typedef struct {
+	clock_t exp_time;
+	clock_t time_left;
+	clock_t uptime;
+	int abs_time;
+
+	uint8_t padding[40];
+} mess_lsys_krn_sys_setalarm;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_setalarm);
+
+typedef struct {
+	vir_bytes addr;			/* cp_grant_t * */
+	int size;
+
+	uint8_t padding[48];
+} mess_lsys_krn_sys_setgrant;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_setgrant);
+
+typedef struct {
+	endpoint_t endpt;
+	vir_bytes ctx_ptr;
+
+	uint8_t padding[48];
+} mess_lsys_krn_sys_setmcontext;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_setmcontext);
+
+typedef struct {
+	time_t sec;		/* time in seconds since 1970 */
+	long int nsec;
+	int now;		/* non-zero for immediate, 0 for adjtime */
+	clockid_t clock_id;
+
+	uint8_t padding[36];
+} mess_lsys_krn_sys_settime;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_settime);
+
+typedef struct {
+	int action;
+	int freq;
+	int intr_type;
+	endpoint_t endpt;
+	vir_bytes ctl_ptr;
+	vir_bytes mem_ptr;
+	size_t mem_size;
+
+	uint8_t padding[28];
+} mess_lsys_krn_sys_sprof;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_sprof);
+
+typedef struct {
+	int request;
+	void *address;
+	int length;
+
+	uint8_t padding[44];
+} mess_lsys_krn_sys_statectl;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_statectl);
+
+typedef struct {
+	time_t boot_time;
+
+	uint8_t padding[48];
+} mess_lsys_krn_sys_stime;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_stime);
+
+typedef struct {
+	endpoint_t endpt;
+
+	uint8_t padding[52];
+} mess_lsys_krn_sys_times;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_times);
+
+typedef struct {
+	int request;
+	endpoint_t endpt;
+	vir_bytes address;
+	long int data;
+
+	uint8_t padding[40];
+} mess_lsys_krn_sys_trace;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_trace);
+
+typedef struct {
+	endpoint_t src_endpt;
+	int segment;
+	vir_bytes src_addr;
+	endpoint_t dst_endpt;
+	int nr_bytes;
+
+	uint8_t padding[36];
+} mess_lsys_krn_sys_umap;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_umap);
+
+
+typedef struct {
+	int request;
+	int vec_size;
+	vir_bytes vec_addr;		/* pv{b,w,l}_pair_t * */
+
+	uint8_t padding[44];
+} mess_lsys_krn_sys_vdevio;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_vdevio);
+
+typedef struct {
+	endpoint_t endpt;
+	vir_bytes vaddr;			/* struct vumap_vir * */
+	int vcount;
+	vir_bytes paddr;			/* struct vumap_phys * */
+	int pmax;
+	int access;
+	size_t offset;
+
+	uint8_t padding[28];
+} mess_lsys_krn_sys_vumap;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_vumap);
+
+typedef struct {
+	void		*vec_addr;
+	int		vec_size;
+	uint8_t padding[48];
+} mess_lsys_kern_vsafecopy;
+_ASSERT_MSG_SIZE(mess_lsys_kern_vsafecopy);
+
+typedef struct {
+	uint32_t	root_id;
+	uint32_t	flags;
+	unsigned int	csize;
+	unsigned int	clen;
+	unsigned int	miblen;
+	int		mib[CTL_SHORTNAME];
+	uint8_t		padding[4];
+} mess_lsys_mib_register;
+_ASSERT_MSG_SIZE(mess_lsys_mib_register);
+
+typedef struct {
+	uint32_t	req_id;
+	ssize_t		status;
+	uint8_t		padding[48];
+} mess_lsys_mib_reply;
+_ASSERT_MSG_SIZE(mess_lsys_mib_reply);
+
+typedef struct {
+	int devind;
+	int port;
+
+	uint8_t padding[48];
+} mess_lsys_pci_busc_get_bar;
+_ASSERT_MSG_SIZE(mess_lsys_pci_busc_get_bar);
+
+typedef struct {
+	endpoint_t endpt;
+	vir_bytes groups;
+	int ngroups;
+
+	uint8_t padding[44];
+} mess_lsys_pm_getepinfo;
+_ASSERT_MSG_SIZE(mess_lsys_pm_getepinfo);
+
+typedef struct {
+	pid_t pid;
+
+	uint8_t padding[52];
+} mess_lsys_pm_getprocnr;
+_ASSERT_MSG_SIZE(mess_lsys_pm_getprocnr);
+
+typedef struct {
+	unsigned int mask;
+
+	uint8_t padding[52];
+} mess_lsys_pm_proceventmask;
+_ASSERT_MSG_SIZE(mess_lsys_pm_proceventmask);
+
+typedef struct {
+	uid_t uid;
+	gid_t gid;
+
+	uint8_t padding[48];
+} mess_lsys_pm_srv_fork;
+_ASSERT_MSG_SIZE(mess_lsys_pm_srv_fork);
+
+typedef struct {
+	endpoint_t endpoint;
+	endpoint_t parent;
+	int maxprio;
+	int quantum;
+
+	uint8_t padding[40];
+} mess_lsys_sched_scheduling_start;
+_ASSERT_MSG_SIZE(mess_lsys_sched_scheduling_start);
+
+typedef struct {
+	endpoint_t endpoint;
+
+	uint8_t padding[52];
+} mess_lsys_sched_scheduling_stop;
+_ASSERT_MSG_SIZE(mess_lsys_sched_scheduling_stop);
+
+typedef struct {
+	int request;
+	int fkeys;
+	int sfkeys;
+
+	uint8_t padding[44];
+} mess_lsys_tty_fkey_ctl;
+_ASSERT_MSG_SIZE(mess_lsys_tty_fkey_ctl);
+
+typedef struct {
+	endpoint_t endpt;
+	int fd;
+	int what;
+
+	uint8_t padding[44];
+} mess_lsys_vfs_copyfd;
+_ASSERT_MSG_SIZE(mess_lsys_vfs_copyfd);
+
+typedef struct {
+	devmajor_t major;
+	size_t labellen;
+	vir_bytes label;
+	int ndomains;
+	int domains[NR_DOMAIN];
+
+	uint8_t padding[8];
+} mess_lsys_vfs_mapdriver;
+_ASSERT_MSG_SIZE(mess_lsys_vfs_mapdriver);
+
+typedef struct {
+	endpoint_t endpt;
+	cp_grant_id_t grant;
+	size_t count;
+	int what;
+
+	uint8_t padding[40];
+} mess_lsys_vfs_socketpath;
+_ASSERT_MSG_SIZE(mess_lsys_vfs_socketpath);
+
+typedef struct {
+	endpoint_t	endpt;
+	void		*addr;
+	int		retc;
+	uint8_t		padding[44];
+} mess_lsys_vm_getref;
+_ASSERT_MSG_SIZE(mess_lsys_vm_getref);
+
+typedef struct {
+	int		what;
+	endpoint_t	ep;
+	int		count;
+	void		*ptr;
+	vir_bytes	next;
+	uint8_t		padding[36];
+} mess_lsys_vm_info;
+_ASSERT_MSG_SIZE(mess_lsys_vm_info);
+
+typedef struct {
+	endpoint_t	ep;
+	phys_bytes	phaddr;
+	size_t		len;
+	void		*reply;
+	uint8_t		padding[40];
+} mess_lsys_vm_map_phys;
+_ASSERT_MSG_SIZE(mess_lsys_vm_map_phys);
+
+typedef struct {
+	endpoint_t	endpt;
+	vir_bytes	addr;
+	int		children;
+
+	uint8_t		padding[44];
+} mess_lsys_vm_rusage;
+_ASSERT_MSG_SIZE(mess_lsys_vm_rusage);
+
+typedef struct {
+	endpoint_t	ep;
+	void		*vaddr;
+	uint8_t		padding[48];
+} mess_lsys_vm_unmap_phys;
+_ASSERT_MSG_SIZE(mess_lsys_vm_unmap_phys);
+
+typedef struct {
+	endpoint_t src;
+	endpoint_t dst;
+	int flags;
+	uint8_t		padding[44];
+} mess_lsys_vm_update;
+_ASSERT_MSG_SIZE(mess_lsys_vm_update);
+
+typedef struct {
+	endpoint_t	destination;
+	endpoint_t	source;
+	void		*dest_addr;
+	void		*src_addr;
+	size_t		size;
+	void		*ret_addr;
+	uint8_t		padding[32];
+} mess_lsys_vm_vmremap;
+_ASSERT_MSG_SIZE(mess_lsys_vm_vmremap);
+
+typedef struct {
+	size_t		oldlen;
+	uint8_t		padding[52];
+} mess_mib_lc_sysctl;
+_ASSERT_MSG_SIZE(mess_mib_lc_sysctl);
+
+typedef struct {
+	uint32_t	req_id;
+	uint32_t	root_id;
+	cp_grant_id_t	name_grant;
+	unsigned int	name_len;
+	cp_grant_id_t	oldp_grant;
+	size_t		oldp_len;
+	cp_grant_id_t	newp_grant;
+	size_t		newp_len;
+	endpoint_t	user_endpt;
+	uint32_t	flags;
+	uint32_t	root_ver;
+	uint32_t	tree_ver;
+	uint8_t		padding[8];
+} mess_mib_lsys_call;
+_ASSERT_MSG_SIZE(mess_mib_lsys_call);
+
+typedef struct {
+	uint32_t	req_id;
+	uint32_t	root_id;
+	cp_grant_id_t	name_grant;
+	size_t		name_size;
+	cp_grant_id_t	desc_grant;
+	size_t		desc_size;
+	uint8_t		padding[32];
+} mess_mib_lsys_info;
+_ASSERT_MSG_SIZE(mess_mib_lsys_info);
+
+typedef struct {
+	off_t offset;
+	void *addr;
+	size_t len;
+	int prot;
+	int flags;
+	int fd;
+	endpoint_t forwhom;
+	void *retaddr;
+	u32_t padding[5];
+} mess_mmap;
+_ASSERT_MSG_SIZE(mess_mmap);
+
+typedef struct {
+	uint32_t id;
+
+	uint8_t padding[52];
+} mess_ndev_netdriver_init;
+_ASSERT_MSG_SIZE(mess_ndev_netdriver_init);
+
+typedef struct {
+	uint32_t id;
+	uint32_t set;
+	uint32_t mode;
+	cp_grant_id_t mcast_grant;
+	unsigned int mcast_count;
+	uint32_t caps;
+	uint32_t flags;
+	uint32_t media;
+	uint8_t hwaddr[NDEV_HWADDR_MAX];
+
+	uint8_t padding[18];
+} mess_ndev_netdriver_conf;
+_ASSERT_MSG_SIZE(mess_ndev_netdriver_conf);
+
+typedef struct {
+	uint32_t id;
+	uint32_t count;
+	cp_grant_id_t grant[NDEV_IOV_MAX];
+	uint16_t len[NDEV_IOV_MAX];
+} mess_ndev_netdriver_transfer;
+_ASSERT_MSG_SIZE(mess_ndev_netdriver_transfer);
+
+typedef struct {
+	uint32_t id;
+
+	uint8_t padding[52];
+} mess_ndev_netdriver_status_reply;
+_ASSERT_MSG_SIZE(mess_ndev_netdriver_status_reply);
+
+typedef struct {
+	uint32_t id;
+	uint32_t link;
+	uint32_t media;
+	uint32_t caps;
+	char name[NDEV_NAME_MAX];
+	uint8_t hwaddr[NDEV_HWADDR_MAX];
+	uint8_t hwaddr_len;
+	uint8_t max_send;
+	uint8_t max_recv;
+
+	uint8_t padding[15];
+} mess_netdriver_ndev_init_reply;
+_ASSERT_MSG_SIZE(mess_netdriver_ndev_init_reply);
+
+typedef struct {
+	uint32_t id;
+	int32_t result;
+
+	uint8_t padding[48];
+} mess_netdriver_ndev_reply;
+_ASSERT_MSG_SIZE(mess_netdriver_ndev_reply);
+
+typedef struct {
+	uint32_t id;
+	uint32_t link;
+	uint32_t media;
+	uint32_t oerror;
+	uint32_t coll;
+	uint32_t ierror;
+	uint32_t iqdrop;
+
+	uint8_t padding[28];
+} mess_netdriver_ndev_status;
+_ASSERT_MSG_SIZE(mess_netdriver_ndev_status);
+
+typedef struct {
+	int mode;
+
+	uint8_t padding[52];
+} mess_net_netdrv_dl_conf;
+_ASSERT_MSG_SIZE(mess_net_netdrv_dl_conf);
+
+typedef struct {
+	cp_grant_id_t grant;
+
+	uint8_t padding[52];
+} mess_net_netdrv_dl_getstat_s;
+_ASSERT_MSG_SIZE(mess_net_netdrv_dl_getstat_s);
+
+typedef struct {
+	cp_grant_id_t grant;
+	int count;
+
+	uint8_t padding[48];
+} mess_net_netdrv_dl_readv_s;
+_ASSERT_MSG_SIZE(mess_net_netdrv_dl_readv_s);
+
+typedef struct {
+	cp_grant_id_t grant;
+	int count;
+
+	uint8_t padding[48];
+} mess_net_netdrv_dl_writev_s;
+_ASSERT_MSG_SIZE(mess_net_netdrv_dl_writev_s);
+
+typedef struct {
+	int stat;
+	uint8_t hw_addr[6];
+
+	uint8_t padding[46];
+} mess_netdrv_net_dl_conf;
+_ASSERT_MSG_SIZE(mess_netdrv_net_dl_conf);
+
+typedef struct {
+	int count;
+	uint32_t flags;
+
+	uint8_t padding[48];
+} mess_netdrv_net_dl_task;
+_ASSERT_MSG_SIZE(mess_netdrv_net_dl_task);
+
+typedef struct {
+	u64_t timestamp;	/* valid for every notify msg */
+	u64_t interrupts;	/* raised interrupts; valid if from HARDWARE */
+	sigset_t sigset;	/* raised signals; valid if from SYSTEM */
+	uint8_t padding[24];
+} mess_notify;
+_ASSERT_MSG_SIZE(mess_notify);
+
+typedef struct {
+	int base;
+	size_t size;
+	uint32_t flags;
+
+	uint8_t padding[44];
+} mess_pci_lsys_busc_get_bar;
+_ASSERT_MSG_SIZE(mess_pci_lsys_busc_get_bar);
+
+typedef struct {
+	uid_t egid;
+
+	uint8_t padding[52];
+} mess_pm_lc_getgid;
+_ASSERT_MSG_SIZE(mess_pm_lc_getgid);
+
+typedef struct {
+	pid_t parent_pid;
+
+	uint8_t padding[52];
+} mess_pm_lc_getpid;
+_ASSERT_MSG_SIZE(mess_pm_lc_getpid);
+
+typedef struct {
+	uid_t euid;
+
+	uint8_t padding[52];
+} mess_pm_lc_getuid;
+_ASSERT_MSG_SIZE(mess_pm_lc_getuid);
+
+typedef struct {
+	long data;
+
+	uint8_t padding[52];
+} mess_pm_lc_ptrace;
+_ASSERT_MSG_SIZE(mess_pm_lc_ptrace);
+
+typedef struct {
+	sigset_t set;
+
+	uint8_t padding[40];
+} mess_pm_lc_sigset;
+_ASSERT_MSG_SIZE(mess_pm_lc_sigset);
+
+typedef struct {
+	time_t sec;
+
+	long nsec;
+
+	uint8_t padding[44];
+} mess_pm_lc_time;
+_ASSERT_MSG_SIZE(mess_pm_lc_time);
+
+typedef struct {
+	int status;
+
+	uint8_t padding[52];
+} mess_pm_lc_wait4;
+_ASSERT_MSG_SIZE(mess_pm_lc_wait4);
+
+typedef struct {
+	int suid;
+
+	uint8_t padding[52];
+} mess_pm_lexec_exec_new;
+_ASSERT_MSG_SIZE(mess_pm_lexec_exec_new);
+
+typedef struct {
+	uid_t uid;
+	uid_t euid;
+	gid_t gid;
+	gid_t egid;
+	int ngroups;
+
+	uint8_t padding[36];
+} mess_pm_lsys_getepinfo;
+_ASSERT_MSG_SIZE(mess_pm_lsys_getepinfo);
+
+typedef struct {
+	endpoint_t endpt;
+
+	uint8_t padding[52];
+} mess_pm_lsys_getprocnr;
+_ASSERT_MSG_SIZE(mess_pm_lsys_getprocnr);
+
+typedef struct {
+	endpoint_t endpt;
+	unsigned int event;
+
+	uint8_t padding[48];
+} mess_pm_lsys_proc_event;
+_ASSERT_MSG_SIZE(mess_pm_lsys_proc_event);
+
+typedef struct {
+	int num;
+
+	uint8_t padding[52];
+} mess_pm_lsys_sigs_signal;
+_ASSERT_MSG_SIZE(mess_pm_lsys_sigs_signal);
+
+typedef struct {
+	endpoint_t endpoint;
+	uint32_t maxprio;
+
+	uint8_t padding[48];
+} mess_pm_sched_scheduling_set_nice;
+_ASSERT_MSG_SIZE(mess_pm_sched_scheduling_set_nice);
+
+typedef struct {
+	dev_t dev;
+	mode_t mode;
+	uid_t uid;
+	gid_t gid;
+	uint32_t index;
+
+	uint8_t padding[32];
+} mess_pty_ptyfs_req;
+_ASSERT_MSG_SIZE(mess_pty_ptyfs_req);
+
+typedef struct {
+	char name[20];
+
+	uint8_t padding[36];
+} mess_ptyfs_pty_name;
+_ASSERT_MSG_SIZE(mess_ptyfs_pty_name);
+
+typedef struct {
+	int status;
+
+	uint8_t padding[52];
+} mess_readclock_lc_rtcdev;
+_ASSERT_MSG_SIZE(mess_readclock_lc_rtcdev);
+
+typedef struct {
+	int		result;
+	int		type;
+	cp_grant_id_t	rproctab_gid;
+	endpoint_t	old_endpoint;
+	int		restarts;
+	int		flags;
+	vir_bytes	buff_addr;
+	size_t		buff_len;
+	int		prepare_state;
+	uint8_t padding[20];
+} mess_rs_init;
+_ASSERT_MSG_SIZE(mess_rs_init);
+
+typedef struct {
+	endpoint_t endpt;
+	int result;
+	vir_bytes pc;
+	vir_bytes ps_str;
+
+	uint8_t padding[40];
+} mess_rs_pm_exec_restart;
+_ASSERT_MSG_SIZE(mess_rs_pm_exec_restart);
+
+typedef struct {
+	pid_t pid;
+	int nr;
+
+	uint8_t padding[48];
+} mess_rs_pm_srv_kill;
+_ASSERT_MSG_SIZE(mess_rs_pm_srv_kill);
+
+typedef struct {
+	int		len;
+	int		name_len;
+	endpoint_t	endpoint;
+	void		*addr;
+	const char	*name;
+	int		subtype;
+	uint8_t padding[32];
+} mess_rs_req;
+_ASSERT_MSG_SIZE(mess_rs_req);
+
+typedef struct {
+	int		result;
+	int		state;
+	int		prepare_maxtime;
+	int		flags;
+	gid_t		state_data_gid;
+	uint8_t padding[36];
+} mess_rs_update;
+_ASSERT_MSG_SIZE(mess_rs_update);
+
+typedef struct {
+	endpoint_t scheduler;
+
+	uint8_t padding[52];
+} mess_sched_lsys_scheduling_start;
+_ASSERT_MSG_SIZE(mess_sched_lsys_scheduling_start);
+
+/* For SYS_GETKSIG, _ENDKSIG, _KILL, _SIGSEND, _SIGRETURN. */
+typedef struct {
+	sigset_t map;		/* used to pass signal bit map */
+	endpoint_t endpt;	/* process number for inform */
+	int sig;		/* signal number to send */
+	void *sigctx;		/* pointer to signal context */
+	uint8_t padding[28];
+} mess_sigcalls;
+_ASSERT_MSG_SIZE(mess_sigcalls);
+
+typedef struct {
+	int fkeys;
+	int sfkeys;
+
+	uint8_t padding[48];
+} mess_tty_lsys_fkey_ctl;
+_ASSERT_MSG_SIZE(mess_tty_lsys_fkey_ctl);
+
+typedef struct {
+	dev_t device;
+	off_t seek_pos;
+
+	cp_grant_id_t grant;
+	size_t nbytes;
+
+	uint8_t data[32];
+} mess_vfs_fs_breadwrite;
+_ASSERT_MSG_SIZE(mess_vfs_fs_breadwrite);
+
+typedef struct {
+	ino_t inode;
+
+	mode_t mode;
+
+	uint8_t data[44];
+} mess_vfs_fs_chmod;
+_ASSERT_MSG_SIZE(mess_vfs_fs_chmod);
+
+typedef struct {
+	ino_t inode;
+
+	uid_t uid;
+	gid_t gid;
+
+	uint8_t data[40];
+} mess_vfs_fs_chown;
+_ASSERT_MSG_SIZE(mess_vfs_fs_chown);
+
+typedef struct {
+	ino_t inode;
+
+	mode_t mode;
+	uid_t uid;
+	gid_t gid;
+	cp_grant_id_t grant;
+	size_t path_len;
+
+	uint8_t data[28];
+} mess_vfs_fs_create;
+_ASSERT_MSG_SIZE(mess_vfs_fs_create);
+
+typedef struct {
+	dev_t device;
+
+	uint8_t data[48];
+} mess_vfs_fs_flush;
+_ASSERT_MSG_SIZE(mess_vfs_fs_flush);
+
+typedef struct {
+	ino_t inode;
+	off_t trc_start;
+	off_t trc_end;
+
+	uint8_t data[32];
+} mess_vfs_fs_ftrunc;
+_ASSERT_MSG_SIZE(mess_vfs_fs_ftrunc);
+
+typedef struct {
+	ino_t inode;
+	off_t seek_pos;
+
+	cp_grant_id_t grant;
+	size_t mem_size;
+
+	uint8_t data[32];
+} mess_vfs_fs_getdents;
+_ASSERT_MSG_SIZE(mess_vfs_fs_getdents);
+
+typedef struct {
+	ino_t inode;
+
+	uint8_t data[48];
+} mess_vfs_fs_inhibread;
+_ASSERT_MSG_SIZE(mess_vfs_fs_inhibread);
+
+typedef struct {
+	ino_t inode;
+	ino_t dir_ino;
+
+	cp_grant_id_t grant;
+	size_t path_len;
+
+	uint8_t data[32];
+} mess_vfs_fs_link;
+_ASSERT_MSG_SIZE(mess_vfs_fs_link);
+
+typedef struct {
+	ino_t dir_ino;
+	ino_t root_ino;
+
+	uint32_t flags;
+	size_t path_len;
+	size_t path_size;
+	size_t ucred_size;
+	cp_grant_id_t grant_path;
+	cp_grant_id_t grant_ucred;
+	uid_t uid;
+	gid_t gid;
+
+	uint8_t data[8];
+} mess_vfs_fs_lookup;
+_ASSERT_MSG_SIZE(mess_vfs_fs_lookup);
+
+typedef struct {
+	ino_t inode;
+
+	mode_t mode;
+	uid_t uid;
+	gid_t gid;
+	cp_grant_id_t grant;
+	size_t path_len;
+
+	uint8_t data[28];
+} mess_vfs_fs_mkdir;
+_ASSERT_MSG_SIZE(mess_vfs_fs_mkdir);
+
+typedef struct {
+	dev_t device;
+	ino_t inode;
+
+	mode_t mode;
+	uid_t uid;
+	gid_t gid;
+	cp_grant_id_t grant;
+	size_t path_len;
+
+	uint8_t data[20];
+} mess_vfs_fs_mknod;
+_ASSERT_MSG_SIZE(mess_vfs_fs_mknod);
+
+typedef struct {
+	ino_t inode;
+
+	uint8_t data[48];
+} mess_vfs_fs_mountpoint;
+_ASSERT_MSG_SIZE(mess_vfs_fs_mountpoint);
+
+typedef struct {
+	dev_t device;
+
+	cp_grant_id_t grant;
+	size_t path_len;
+
+	uint8_t data[40];
+} mess_vfs_fs_new_driver;
+_ASSERT_MSG_SIZE(mess_vfs_fs_new_driver);
+
+typedef struct {
+	dev_t device;
+
+	mode_t mode;
+	uid_t uid;
+	gid_t gid;
+
+	uint8_t data[36];
+} mess_vfs_fs_newnode;
+_ASSERT_MSG_SIZE(mess_vfs_fs_newnode);
+
+typedef struct {
+	ino_t inode;
+	unsigned int count;
+
+	uint8_t data[44];
+} mess_vfs_fs_putnode;
+_ASSERT_MSG_SIZE(mess_vfs_fs_putnode);
+
+typedef struct {
+	ino_t inode;
+
+	cp_grant_id_t grant;
+	size_t mem_size;
+
+	uint8_t data[40];
+} mess_vfs_fs_rdlink;
+_ASSERT_MSG_SIZE(mess_vfs_fs_rdlink);
+
+typedef struct {
+	dev_t device;
+
+	uint32_t flags;
+	size_t path_len;
+	cp_grant_id_t grant;
+
+	uint8_t data[36];
+} mess_vfs_fs_readsuper;
+_ASSERT_MSG_SIZE(mess_vfs_fs_readsuper);
+
+typedef struct {
+	ino_t inode;
+	off_t seek_pos;
+
+	cp_grant_id_t grant;
+	size_t nbytes;
+
+	uint8_t data[32];
+} mess_vfs_fs_readwrite;
+_ASSERT_MSG_SIZE(mess_vfs_fs_readwrite);
+
+typedef struct {
+	ino_t dir_old;
+	ino_t dir_new;
+
+	size_t len_old;
+	size_t len_new;
+	cp_grant_id_t grant_old;
+	cp_grant_id_t grant_new;
+
+	uint8_t data[24];
+} mess_vfs_fs_rename;
+_ASSERT_MSG_SIZE(mess_vfs_fs_rename);
+
+typedef struct {
+	ino_t inode;
+
+	size_t path_len;
+	size_t mem_size;
+	cp_grant_id_t grant_path;
+	cp_grant_id_t grant_target;
+	uid_t uid;
+	gid_t gid;
+
+	uint8_t data[24];
+} mess_vfs_fs_slink;
+_ASSERT_MSG_SIZE(mess_vfs_fs_slink);
+
+typedef struct {
+	ino_t inode;
+
+	cp_grant_id_t grant;
+
+	uint8_t data[44];
+} mess_vfs_fs_stat;
+_ASSERT_MSG_SIZE(mess_vfs_fs_stat);
+
+typedef struct {
+	cp_grant_id_t grant;
+
+	uint8_t data[52];
+} mess_vfs_fs_statvfs;
+_ASSERT_MSG_SIZE(mess_vfs_fs_statvfs);
+
+typedef struct {
+	ino_t inode;
+
+	cp_grant_id_t grant;
+	size_t path_len;
+
+	uint8_t data[40];
+} mess_vfs_fs_unlink;
+_ASSERT_MSG_SIZE(mess_vfs_fs_unlink);
+
+typedef struct {
+	ino_t inode;
+	time_t actime;
+	time_t modtime;
+
+	uint32_t acnsec;
+	uint32_t modnsec;
+
+	uint8_t data[24];
+} mess_vfs_fs_utime;
+_ASSERT_MSG_SIZE(mess_vfs_fs_utime);
+
+typedef struct {
+	int fd0;
+	int fd1;
+
+	uint8_t padding[48];
+} mess_vfs_lc_fdpair;
+_ASSERT_MSG_SIZE(mess_vfs_lc_fdpair);
+
+typedef struct {
+	off_t offset;
+
+	uint8_t padding[48];
+} mess_vfs_lc_lseek;
+_ASSERT_MSG_SIZE(mess_vfs_lc_lseek);
+
+typedef struct {
+	unsigned int len;	/* socklen_t */
+
+	uint8_t padding[52];
+} mess_vfs_lc_socklen;
+_ASSERT_MSG_SIZE(mess_vfs_lc_socklen);
+
+typedef struct {
+	endpoint_t id;
+	devminor_t minor;
+
+	uint8_t padding[48];
+} mess_vfs_lchardriver_cancel;
+_ASSERT_MSG_SIZE(mess_vfs_lchardriver_cancel);
+
+typedef struct {
+	endpoint_t id;
+	endpoint_t user;
+	devminor_t minor;
+	int access;
+
+	uint8_t padding[40];
+} mess_vfs_lchardriver_openclose;
+_ASSERT_MSG_SIZE(mess_vfs_lchardriver_openclose);
+
+typedef struct {
+	off_t pos;
+	cp_grant_id_t grant;
+	size_t count;
+	unsigned long request;
+	int flags;
+	endpoint_t id;
+	endpoint_t user;
+	devminor_t minor;
+
+	uint8_t padding[20];
+} mess_vfs_lchardriver_readwrite;
+_ASSERT_MSG_SIZE(mess_vfs_lchardriver_readwrite);
+
+typedef struct {
+	devminor_t minor;
+	int ops;
+
+	uint8_t padding[48];
+} mess_vfs_lchardriver_select;
+_ASSERT_MSG_SIZE(mess_vfs_lchardriver_select);
+
+typedef struct {
+	int32_t req_id;
+	int32_t sock_id;
+	cp_grant_id_t grant;
+	unsigned int len;
+	endpoint_t user_endpt;
+	int sflags;
+
+	uint8_t padding[32];
+} mess_vfs_lsockdriver_addr;
+_ASSERT_MSG_SIZE(mess_vfs_lsockdriver_addr);
+
+typedef struct {
+	int32_t req_id;
+	int32_t sock_id;
+	int level;
+	int name;
+	cp_grant_id_t grant;
+	unsigned int len;
+
+	uint8_t padding[32];
+} mess_vfs_lsockdriver_getset;
+_ASSERT_MSG_SIZE(mess_vfs_lsockdriver_getset);
+
+typedef struct {
+	int32_t req_id;
+	int32_t sock_id;
+	unsigned long request;
+	cp_grant_id_t grant;
+	endpoint_t user_endpt;
+	int sflags;
+
+	uint8_t padding[32];
+} mess_vfs_lsockdriver_ioctl;
+_ASSERT_MSG_SIZE(mess_vfs_lsockdriver_ioctl);
+
+typedef struct {
+	int32_t sock_id;
+	int ops;
+
+	uint8_t padding[48];
+} mess_vfs_lsockdriver_select;
+_ASSERT_MSG_SIZE(mess_vfs_lsockdriver_select);
+
+typedef struct {
+	int32_t req_id;
+	int32_t sock_id;
+	cp_grant_id_t data_grant;
+	size_t data_len;
+	cp_grant_id_t ctl_grant;
+	unsigned int ctl_len;
+	cp_grant_id_t addr_grant;
+	unsigned int addr_len;
+	endpoint_t user_endpt;
+	int flags;
+
+	uint8_t padding[16];
+} mess_vfs_lsockdriver_sendrecv;
+_ASSERT_MSG_SIZE(mess_vfs_lsockdriver_sendrecv);
+
+typedef struct {
+	int32_t req_id;
+	int32_t sock_id;
+	int param;
+
+	uint8_t padding[44];
+} mess_vfs_lsockdriver_simple;
+_ASSERT_MSG_SIZE(mess_vfs_lsockdriver_simple);
+
+typedef struct {
+	int32_t req_id;
+	int domain;
+	int type;
+	int protocol;
+	endpoint_t user_endpt;
+
+	uint8_t padding[36];
+} mess_vfs_lsockdriver_socket;
+_ASSERT_MSG_SIZE(mess_vfs_lsockdriver_socket);
+
+typedef struct {
+	cp_grant_id_t grant;
+	size_t size;
+
+	uint8_t padding[48];
+} mess_vfs_lsys_gcov;
+_ASSERT_MSG_SIZE(mess_vfs_lsys_gcov);
+
+typedef struct {
+	dev_t device;
+	ino_t inode;
+
+	uint8_t padding[40];
+} mess_vfs_lsys_socketpath;
+_ASSERT_MSG_SIZE(mess_vfs_lsys_socketpath);
+
+typedef struct {
+	time_t atime;
+	time_t mtime;
+	long ansec;
+	long mnsec;
+	size_t len;
+	char *name;
+	int fd;
+	int flags;
+	uint8_t padding[16];
+} mess_vfs_utimens;
+_ASSERT_MSG_SIZE(mess_vfs_utimens);
+
+typedef struct {
+	off_t offset;
+	dev_t dev;
+	ino_t ino;
+	endpoint_t who;
+	u32_t vaddr;
+	u32_t len;
+	u32_t flags;
+	u32_t fd;
+	u16_t clearend;
+	uint8_t padding[8];
+} mess_vm_vfs_mmap;
+_ASSERT_MSG_SIZE(mess_vm_vfs_mmap);
+
+typedef struct {
+	dev_t dev;	/* 64bits long. */
+	off_t dev_offset;
+	off_t ino_offset;
+	ino_t ino;
+	void *block;
+	u32_t *flags_ptr;
+	u8_t pages;
+	u8_t flags;
+	uint8_t padding[12];
+} mess_vmmcp;
+_ASSERT_MSG_SIZE(mess_vmmcp);
+
+typedef struct {
+	void *addr;
+	u8_t flags;
+	uint8_t padding[51];
+} mess_vmmcp_reply;
+_ASSERT_MSG_SIZE(mess_vmmcp_reply);
+
+typedef struct noxfer_message {
+	endpoint_t m_source;		/* who sent the message */
+	int m_type;			/* what kind of message is it */
+	union {
+		mess_u8			m_u8;
+		mess_u16		m_u16;
+		mess_u32		m_u32;
+		mess_u64		m_u64;
+
+		mess_1			m_m1;
+		mess_2			m_m2;
+		mess_3			m_m3;
+		mess_4			m_m4;
+		mess_7			m_m7;
+		mess_9			m_m9;
+		mess_10			m_m10;
+
+		mess_ds_reply		m_ds_reply;
+		mess_ds_req		m_ds_req;
+		mess_fs_vfs_breadwrite	m_fs_vfs_breadwrite;
+		mess_fs_vfs_chmod	m_fs_vfs_chmod;
+		mess_fs_vfs_chown	m_fs_vfs_chown;
+		mess_fs_vfs_create	m_fs_vfs_create;
+		mess_fs_vfs_getdents	m_fs_vfs_getdents;
+		mess_fs_vfs_lookup	m_fs_vfs_lookup;
+		mess_fs_vfs_newnode	m_fs_vfs_newnode;
+		mess_fs_vfs_rdlink	m_fs_vfs_rdlink;
+		mess_fs_vfs_readsuper	m_fs_vfs_readsuper;
+		mess_fs_vfs_readwrite	m_fs_vfs_readwrite;
+		mess_i2c_li2cdriver_busc_i2c_exec m_i2c_li2cdriver_busc_i2c_exec;
+		mess_i2c_li2cdriver_busc_i2c_reserve m_i2c_li2cdriver_busc_i2c_reserve;
+		mess_input_linputdriver_input_conf m_input_linputdriver_input_conf;
+		mess_input_linputdriver_setleds m_input_linputdriver_setleds;
+		mess_input_tty_event	m_input_tty_event;
+		mess_krn_lsys_schedule	m_krn_lsys_schedule;
+		mess_krn_lsys_sys_devio m_krn_lsys_sys_devio;
+		mess_krn_lsys_sys_fork m_krn_lsys_sys_fork;
+		mess_krn_lsys_sys_getwhoami m_krn_lsys_sys_getwhoami;
+		mess_krn_lsys_sys_irqctl m_krn_lsys_sys_irqctl;
+		mess_krn_lsys_sys_times	m_krn_lsys_sys_times;
+		mess_krn_lsys_sys_trace	m_krn_lsys_sys_trace;
+		mess_krn_lsys_sys_umap	m_krn_lsys_sys_umap;
+		mess_krn_lsys_sys_vumap	m_krn_lsys_sys_vumap;
+		mess_lbdev_lblockdriver_msg m_lbdev_lblockdriver_msg;
+		mess_lblockdriver_lbdev_reply m_lblockdriver_lbdev_reply;
+		mess_lc_ipc_semctl	m_lc_ipc_semctl;
+		mess_lc_ipc_semget	m_lc_ipc_semget;
+		mess_lc_ipc_semop	m_lc_ipc_semop;
+		mess_lc_ipc_shmat	m_lc_ipc_shmat;
+		mess_lc_ipc_shmctl	m_lc_ipc_shmctl;
+		mess_lc_ipc_shmdt	m_lc_ipc_shmdt;
+		mess_lc_ipc_shmget	m_lc_ipc_shmget;
+		mess_lc_mib_sysctl	m_lc_mib_sysctl;
+		mess_lc_pm_exec		m_lc_pm_exec;
+		mess_lc_pm_exit		m_lc_pm_exit;
+		mess_lc_pm_getsid	m_lc_pm_getsid;
+		mess_lc_pm_groups	m_lc_pm_groups;
+		mess_lc_pm_itimer	m_lc_pm_itimer;
+		mess_lc_pm_mcontext	m_lc_pm_mcontext;
+		mess_lc_pm_priority	m_lc_pm_priority;
+		mess_lc_pm_ptrace	m_lc_pm_ptrace;
+		mess_lc_pm_reboot	m_lc_pm_reboot;
+		mess_lc_pm_rusage	m_lc_pm_rusage;
+		mess_lc_pm_setgid	m_lc_pm_setgid;
+		mess_lc_pm_setuid	m_lc_pm_setuid;
+		mess_lc_pm_sig		m_lc_pm_sig;
+		mess_lc_pm_sigset	m_lc_pm_sigset;
+		mess_lc_pm_sprof	m_lc_pm_sprof;
+		mess_lc_pm_sysuname	m_lc_pm_sysuname;
+		mess_lc_pm_time		m_lc_pm_time;
+		mess_lc_pm_wait4	m_lc_pm_wait4;
+		mess_lc_readclock_rtcdev m_lc_readclock_rtcdev;
+		mess_lc_svrctl		m_lc_svrctl;
+		mess_lc_vfs_chown	m_lc_vfs_chown;
+		mess_lc_vfs_close	m_lc_vfs_close;
+		mess_lc_vfs_creat	m_lc_vfs_creat;
+		mess_lc_vfs_fchdir	m_lc_vfs_fchdir;
+		mess_lc_vfs_fchmod	m_lc_vfs_fchmod;
+		mess_lc_vfs_fcntl	m_lc_vfs_fcntl;
+		mess_lc_vfs_fstat	m_lc_vfs_fstat;
+		mess_lc_vfs_fsync	m_lc_vfs_fsync;
+		mess_lc_vfs_gcov	m_lc_vfs_gcov;
+		mess_lc_vfs_getvfsstat	m_lc_vfs_getvfsstat;
+		mess_lc_vfs_ioctl	m_lc_vfs_ioctl;
+		mess_lc_vfs_link	m_lc_vfs_link;
+		mess_lc_vfs_listen	m_lc_vfs_listen;
+		mess_lc_vfs_lseek	m_lc_vfs_lseek;
+		mess_lc_vfs_mknod	m_lc_vfs_mknod;
+		mess_lc_vfs_mount	m_lc_vfs_mount;
+		mess_lc_vfs_path	m_lc_vfs_path;
+		mess_lc_vfs_pipe2	m_lc_vfs_pipe2;
+		mess_lc_vfs_readlink	m_lc_vfs_readlink;
+		mess_lc_vfs_readwrite	m_lc_vfs_readwrite;
+		mess_lc_vfs_select	m_lc_vfs_select;
+		mess_lc_vfs_sendrecv	m_lc_vfs_sendrecv;
+		mess_lc_vfs_shutdown	m_lc_vfs_shutdown;
+		mess_lc_vfs_sockaddr	m_lc_vfs_sockaddr;
+		mess_lc_vfs_socket	m_lc_vfs_socket;
+		mess_lc_vfs_sockmsg	m_lc_vfs_sockmsg;
+		mess_lc_vfs_sockopt	m_lc_vfs_sockopt;
+		mess_lc_vfs_stat	m_lc_vfs_stat;
+		mess_lc_vfs_statvfs1	m_lc_vfs_statvfs1;
+		mess_lc_vfs_truncate	m_lc_vfs_truncate;
+		mess_lc_vfs_umask	m_lc_vfs_umask;
+		mess_lc_vfs_umount	m_lc_vfs_umount;
+		mess_lc_vm_brk		m_lc_vm_brk;
+		mess_lc_vm_getphys	m_lc_vm_getphys;
+		mess_lc_vm_shm_unmap	m_lc_vm_shm_unmap;
+		mess_lchardriver_vfs_reply m_lchardriver_vfs_reply;
+		mess_lchardriver_vfs_sel1 m_lchardriver_vfs_sel1;
+		mess_lchardriver_vfs_sel2 m_lchardriver_vfs_sel2;
+		mess_lexec_pm_exec_new	m_lexec_pm_exec_new;
+		mess_li2cdriver_i2c_busc_i2c_exec m_li2cdriver_i2c_busc_i2c_exec;
+		mess_li2cdriver_i2c_busc_i2c_reserve m_li2cdriver_i2c_busc_i2c_reserve;
+		mess_linputdriver_input_event m_linputdriver_input_event;
+		mess_lsockdriver_vfs_accept_reply
+		    m_lsockdriver_vfs_accept_reply;
+		mess_lsockdriver_vfs_recv_reply
+		    m_lsockdriver_vfs_recv_reply;
+		mess_lsockdriver_vfs_reply	m_lsockdriver_vfs_reply;
+		mess_lsockdriver_vfs_select_reply
+		    m_lsockdriver_vfs_select_reply;
+		mess_lsockdriver_vfs_socket_reply
+		    m_lsockdriver_vfs_socket_reply;
+		mess_lsys_fi_ctl	m_lsys_fi_ctl;
+		mess_lsys_fi_reply	m_lsys_fi_reply;
+		mess_lsys_getsysinfo	m_lsys_getsysinfo;
+		mess_lsys_krn_readbios	m_lsys_krn_readbios;
+		mess_lsys_kern_safecopy	m_lsys_kern_safecopy;
+		mess_lsys_krn_schedctl	m_lsys_krn_schedctl;
+		mess_lsys_krn_schedule	m_lsys_krn_schedule;
+		mess_lsys_krn_sys_abort m_lsys_krn_sys_abort;
+		mess_lsys_krn_sys_clear m_lsys_krn_sys_clear;
+		mess_lsys_krn_sys_copy	m_lsys_krn_sys_copy;
+		mess_lsys_krn_sys_devio m_lsys_krn_sys_devio;
+		mess_lsys_krn_sys_diagctl m_lsys_krn_sys_diagctl;
+		mess_lsys_krn_sys_exec	m_lsys_krn_sys_exec;
+		mess_lsys_krn_sys_fork	m_lsys_krn_sys_fork;
+		mess_lsys_krn_sys_getinfo m_lsys_krn_sys_getinfo;
+		mess_lsys_krn_sys_getmcontext m_lsys_krn_sys_getmcontext;
+		mess_lsys_krn_sys_iopenable m_lsys_krn_sys_iopenable;
+		mess_lsys_krn_sys_irqctl m_lsys_krn_sys_irqctl;
+		mess_lsys_krn_sys_memset m_lsys_krn_sys_memset;
+		mess_lsys_krn_sys_privctl m_lsys_krn_sys_privctl;
+		mess_lsys_krn_sys_sdevio m_lsys_krn_sys_sdevio;
+		mess_lsys_krn_sys_setalarm m_lsys_krn_sys_setalarm;
+		mess_lsys_krn_sys_setgrant m_lsys_krn_sys_setgrant;
+		mess_lsys_krn_sys_setmcontext m_lsys_krn_sys_setmcontext;
+		mess_lsys_krn_sys_settime m_lsys_krn_sys_settime;
+		mess_lsys_krn_sys_sprof m_lsys_krn_sys_sprof;
+		mess_lsys_krn_sys_statectl m_lsys_krn_sys_statectl;
+		mess_lsys_krn_sys_stime	m_lsys_krn_sys_stime;
+		mess_lsys_krn_sys_times	m_lsys_krn_sys_times;
+		mess_lsys_krn_sys_trace	m_lsys_krn_sys_trace;
+		mess_lsys_krn_sys_umap	m_lsys_krn_sys_umap;
+		mess_lsys_krn_sys_vdevio m_lsys_krn_sys_vdevio;
+		mess_lsys_krn_sys_vumap m_lsys_krn_sys_vumap;
+		mess_lsys_kern_vsafecopy m_lsys_kern_vsafecopy;
+		mess_lsys_mib_register	m_lsys_mib_register;
+		mess_lsys_mib_reply	m_lsys_mib_reply;
+		mess_lsys_pci_busc_get_bar m_lsys_pci_busc_get_bar;
+		mess_lsys_pm_getepinfo	m_lsys_pm_getepinfo;
+		mess_lsys_pm_getprocnr	m_lsys_pm_getprocnr;
+		mess_lsys_pm_proceventmask m_lsys_pm_proceventmask;
+		mess_lsys_pm_srv_fork	m_lsys_pm_srv_fork;
+		mess_lsys_sched_scheduling_start m_lsys_sched_scheduling_start;
+		mess_lsys_sched_scheduling_stop m_lsys_sched_scheduling_stop;
+		mess_lsys_tty_fkey_ctl	m_lsys_tty_fkey_ctl;
+		mess_lsys_vfs_copyfd	m_lsys_vfs_copyfd;
+		mess_lsys_vfs_mapdriver	m_lsys_vfs_mapdriver;
+		mess_lsys_vfs_socketpath m_lsys_vfs_socketpath;
+		mess_lsys_vm_getref	m_lsys_vm_getref;
+		mess_lsys_vm_info	m_lsys_vm_info;
+		mess_lsys_vm_map_phys	m_lsys_vm_map_phys;
+		mess_lsys_vm_rusage	m_lsys_vm_rusage;
+		mess_lsys_vm_unmap_phys	m_lsys_vm_unmap_phys;
+		mess_lsys_vm_update	m_lsys_vm_update;
+		mess_lsys_vm_vmremap	m_lsys_vm_vmremap;
+		mess_mib_lc_sysctl	m_mib_lc_sysctl;
+		mess_mib_lsys_call	m_mib_lsys_call;
+		mess_mib_lsys_info	m_mib_lsys_info;
+		mess_mmap		m_mmap;
+		mess_ndev_netdriver_init m_ndev_netdriver_init;
+		mess_ndev_netdriver_conf m_ndev_netdriver_conf;
+		mess_ndev_netdriver_transfer m_ndev_netdriver_transfer;
+		mess_ndev_netdriver_status_reply m_ndev_netdriver_status_reply;
+		mess_netdriver_ndev_init_reply m_netdriver_ndev_init_reply;
+		mess_netdriver_ndev_reply m_netdriver_ndev_reply;
+		mess_netdriver_ndev_status m_netdriver_ndev_status;
+		mess_net_netdrv_dl_conf m_net_netdrv_dl_conf;
+		mess_net_netdrv_dl_getstat_s m_net_netdrv_dl_getstat_s;
+		mess_net_netdrv_dl_readv_s m_net_netdrv_dl_readv_s;
+		mess_net_netdrv_dl_writev_s m_net_netdrv_dl_writev_s;
+		mess_netdrv_net_dl_conf m_netdrv_net_dl_conf;
+		mess_netdrv_net_dl_task m_netdrv_net_dl_task;
+		mess_notify		m_notify;
+		mess_pci_lsys_busc_get_bar m_pci_lsys_busc_get_bar;
+		mess_pm_lc_getgid	m_pm_lc_getgid;
+		mess_pm_lc_getpid	m_pm_lc_getpid;
+		mess_pm_lc_getuid	m_pm_lc_getuid;
+		mess_pm_lc_ptrace	m_pm_lc_ptrace;
+		mess_pm_lc_sigset	m_pm_lc_sigset;
+		mess_pm_lc_time		m_pm_lc_time;
+		mess_pm_lc_wait4	m_pm_lc_wait4;
+		mess_pm_lexec_exec_new	m_pm_lexec_exec_new;
+		mess_pm_lsys_getepinfo	m_pm_lsys_getepinfo;
+		mess_pm_lsys_getprocnr	m_pm_lsys_getprocnr;
+		mess_pm_lsys_proc_event	m_pm_lsys_proc_event;
+		mess_pm_lsys_sigs_signal m_pm_lsys_sigs_signal;
+		mess_pm_sched_scheduling_set_nice m_pm_sched_scheduling_set_nice;
+		mess_pty_ptyfs_req	m_pty_ptyfs_req;
+		mess_ptyfs_pty_name	m_ptyfs_pty_name;
+		mess_readclock_lc_rtcdev m_readclock_lc_rtcdev;
+		mess_rs_init		m_rs_init;
+		mess_rs_pm_exec_restart	m_rs_pm_exec_restart;
+		mess_rs_pm_srv_kill	m_rs_pm_srv_kill;
+		mess_rs_req		m_rs_req;
+		mess_rs_update		m_rs_update;
+		mess_sched_lsys_scheduling_start m_sched_lsys_scheduling_start;
+		mess_sigcalls		m_sigcalls;
+		mess_tty_lsys_fkey_ctl	m_tty_lsys_fkey_ctl;
+		mess_vfs_fs_breadwrite	m_vfs_fs_breadwrite;
+		mess_vfs_fs_chmod	m_vfs_fs_chmod;
+		mess_vfs_fs_chown	m_vfs_fs_chown;
+		mess_vfs_fs_create	m_vfs_fs_create;
+		mess_vfs_fs_flush	m_vfs_fs_flush;
+		mess_vfs_fs_ftrunc	m_vfs_fs_ftrunc;
+		mess_vfs_fs_getdents	m_vfs_fs_getdents;
+		mess_vfs_fs_inhibread	m_vfs_fs_inhibread;
+		mess_vfs_fs_link	m_vfs_fs_link;
+		mess_vfs_fs_lookup	m_vfs_fs_lookup;
+		mess_vfs_fs_mkdir	m_vfs_fs_mkdir;
+		mess_vfs_fs_mknod	m_vfs_fs_mknod;
+		mess_vfs_fs_mountpoint	m_vfs_fs_mountpoint;
+		mess_vfs_fs_new_driver	m_vfs_fs_new_driver;
+		mess_vfs_fs_newnode	m_vfs_fs_newnode;
+		mess_vfs_fs_putnode	m_vfs_fs_putnode;
+		mess_vfs_fs_rdlink	m_vfs_fs_rdlink;
+		mess_vfs_fs_readsuper	m_vfs_fs_readsuper;
+		mess_vfs_fs_readwrite	m_vfs_fs_readwrite;
+		mess_vfs_fs_rename	m_vfs_fs_rename;
+		mess_vfs_fs_slink	m_vfs_fs_slink;
+		mess_vfs_fs_stat	m_vfs_fs_stat;
+		mess_vfs_fs_statvfs	m_vfs_fs_statvfs;
+		mess_vfs_fs_unlink	m_vfs_fs_unlink;
+		mess_vfs_fs_utime	m_vfs_fs_utime;
+		mess_vfs_lc_fdpair	m_vfs_lc_fdpair;
+		mess_vfs_lc_lseek	m_vfs_lc_lseek;
+		mess_vfs_lc_socklen	m_vfs_lc_socklen;
+		mess_vfs_lchardriver_cancel	m_vfs_lchardriver_cancel;
+		mess_vfs_lchardriver_openclose	m_vfs_lchardriver_openclose;
+		mess_vfs_lchardriver_readwrite	m_vfs_lchardriver_readwrite;
+		mess_vfs_lchardriver_select	m_vfs_lchardriver_select;
+		mess_vfs_lsockdriver_addr	m_vfs_lsockdriver_addr;
+		mess_vfs_lsockdriver_getset	m_vfs_lsockdriver_getset;
+		mess_vfs_lsockdriver_ioctl	m_vfs_lsockdriver_ioctl;
+		mess_vfs_lsockdriver_select	m_vfs_lsockdriver_select;
+		mess_vfs_lsockdriver_sendrecv	m_vfs_lsockdriver_sendrecv;
+		mess_vfs_lsockdriver_simple	m_vfs_lsockdriver_simple;
+		mess_vfs_lsockdriver_socket	m_vfs_lsockdriver_socket;
+		mess_vfs_lsys_gcov	m_vfs_lsys_gcov;
+		mess_vfs_lsys_socketpath	m_vfs_lsys_socketpath;
+		mess_vfs_utimens	m_vfs_utimens;
+		mess_vm_vfs_mmap	m_vm_vfs_mmap;
+		mess_vmmcp		m_vmmcp;
+		mess_vmmcp_reply	m_vmmcp_reply;
+
+		u8_t size[56];	/* message payload may have 56 bytes at most */
+	};
+} message __ALIGNED(16);
+
+/* Ensure the complete union respects the IPC assumptions. */
+typedef int _ASSERT_message[/* CONSTCOND */sizeof(message) == 64 ? 1 : -1];
+
+/* The following defines provide names for useful members. */
+#define m1_i1  m_m1.m1i1
+#define m1_i2  m_m1.m1i2
+#define m1_i3  m_m1.m1i3
+#define m1_p1  m_m1.m1p1
+#define m1_p2  m_m1.m1p2
+#define m1_p3  m_m1.m1p3
+#define m1_p4  m_m1.m1p4
+#define m1_ull1  m_m1.m1ull1
+
+#define m2_ll1  m_m2.m2ll1
+#define m2_i1  m_m2.m2i1
+#define m2_i2  m_m2.m2i2
+#define m2_i3  m_m2.m2i3
+#define m2_l1  m_m2.m2l1
+#define m2_l2  m_m2.m2l2
+#define m2_p1  m_m2.m2p1
+#define m2_sigset  m_m2.sigset
+
+#define m2_s1  m_m2.m2s1
+
+#define m3_i1  m_m3.m3i1
+#define m3_i2  m_m3.m3i2
+#define m3_p1  m_m3.m3p1
+#define m3_ca1 m_m3.m3ca1
+
+#define m4_ll1  m_m4.m4ll1
+#define m4_l1  m_m4.m4l1
+#define m4_l2  m_m4.m4l2
+#define m4_l3  m_m4.m4l3
+#define m4_l4  m_m4.m4l4
+#define m4_l5  m_m4.m4l5
+
+#define m7_i1  m_m7.m7i1
+#define m7_i2  m_m7.m7i2
+#define m7_i3  m_m7.m7i3
+#define m7_i4  m_m7.m7i4
+#define m7_i5  m_m7.m7i5
+#define m7_p1  m_m7.m7p1
+#define m7_p2  m_m7.m7p2
+
+#define m9_l1  m_m9.m9l1
+#define m9_l2  m_m9.m9l2
+#define m9_l3  m_m9.m9l3
+#define m9_l4  m_m9.m9l4
+#define m9_l5  m_m9.m9l5
+#define m9_s1  m_m9.m9s1
+#define m9_s2  m_m9.m9s2
+#define m9_s3  m_m9.m9s3
+#define m9_s4  m_m9.m9s4
+#define m9_ull1  m_m9.m9ull1
+#define m9_ull2  m_m9.m9ull2
+
+#define m10_i1 m_m10.m10i1
+#define m10_i2 m_m10.m10i2
+#define m10_i3 m_m10.m10i3
+#define m10_i4 m_m10.m10i4
+#define m10_l1 m_m10.m10l1
+#define m10_l2 m_m10.m10l2
+#define m10_l3 m_m10.m10l3
+#define m10_ull1 m_m10.m10ull1
+
+
+/*==========================================================================* 
+ * Minix run-time system (IPC). 					    *
+ *==========================================================================*/ 
+
+/* Datastructure for asynchronous sends */
+typedef struct asynmsg
+{
+	unsigned flags;
+	endpoint_t dst;
+	int result;
+	message msg;
+} asynmsg_t;
+
+/* Defines for flags field */
+#define AMF_EMPTY	000	/* slot is not inuse */
+#define AMF_VALID	001	/* slot contains message */
+#define AMF_DONE	002	/* Kernel has processed the message. The
+				 * result is stored in 'result'
+				 */
+#define AMF_NOTIFY	004	/* Send a notification when AMF_DONE is set */
+#define AMF_NOREPLY	010	/* Not a reply message for a SENDREC */
+#define AMF_NOTIFY_ERR	020	/* Send a notification when AMF_DONE is set and
+				 * delivery of the message failed */
+
+int _ipc_send_intr(endpoint_t dest, message *m_ptr);
+int _ipc_receive_intr(endpoint_t src, message *m_ptr, int *status_ptr);
+int _ipc_sendrec_intr(endpoint_t src_dest, message *m_ptr);
+int _ipc_sendnb_intr(endpoint_t dest, message *m_ptr);
+int _ipc_notify_intr(endpoint_t dest);
+int _ipc_senda_intr(asynmsg_t *table, size_t count);
+
+int _do_kernel_call_intr(message *m_ptr);
+
+int ipc_minix_kerninfo(struct minix_kerninfo **);
+
+/* Hide names to avoid name space pollution. */
+#define ipc_notify	_ipc_notify
+#define ipc_sendrec	_ipc_sendrec
+#define ipc_receive	_ipc_receive
+#define ipc_receivenb	_ipc_receivenb
+#define ipc_send	_ipc_send
+#define ipc_sendnb	_ipc_sendnb
+#define ipc_senda	_ipc_senda
+
+#define do_kernel_call	_do_kernel_call
+
+struct minix_ipcvecs {
+	int (*send)(endpoint_t dest, message *m_ptr);
+	int (*receive)(endpoint_t src, message *m_ptr, int *st);
+	int (*sendrec)(endpoint_t src_dest, message *m_ptr);
+	int (*sendnb)(endpoint_t dest, message *m_ptr);
+	int (*notify)(endpoint_t dest);
+	int (*do_kernel_call)(message *m_ptr);
+	int (*senda)(asynmsg_t *table, size_t count);
+};
+
+/* kernel-set IPC vectors retrieved by a constructor in
+ * minix/lib/libc/sys/init.c */
+extern struct minix_ipcvecs _minix_ipcvecs;
+
+static inline int _ipc_send(endpoint_t dest, message *m_ptr)
+{
+	return _minix_ipcvecs.send(dest, m_ptr);
+}
+
+static inline int _ipc_receive(endpoint_t src, message *m_ptr, int *st)
+{
+	return _minix_ipcvecs.receive(src, m_ptr, st);
+}
+
+static inline int _ipc_sendrec(endpoint_t src_dest, message *m_ptr)
+{
+	return _minix_ipcvecs.sendrec(src_dest, m_ptr);
+}
+
+static inline int _ipc_sendnb(endpoint_t dest, message *m_ptr)
+{
+	return _minix_ipcvecs.sendnb(dest, m_ptr);
+}
+
+static inline int _ipc_notify(endpoint_t dest)
+{
+	return _minix_ipcvecs.notify(dest);
+}
+
+static inline int _do_kernel_call(message *m_ptr)
+{
+	return _minix_ipcvecs.do_kernel_call(m_ptr);
+}
+
+static inline int _ipc_senda(asynmsg_t *table, size_t count)
+{
+	return _minix_ipcvecs.senda(table, count);
+}
+
+#endif /* _IPC_H */

Property changes on: lab4/.minix-src/include/minix/ipc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/libminixfs.h
===================================================================
--- lab4/.minix-src/include/minix/libminixfs.h	(nonexistent)
+++ lab4/.minix-src/include/minix/libminixfs.h	(revision 13)
@@ -0,0 +1,65 @@
+/* Prototypes for -lminixfs. */
+
+#ifndef _MINIX_FSLIB_H
+#define _MINIX_FSLIB_H
+
+#include <minix/fsdriver.h>
+
+/* Maximum number of blocks that will be considered by lmfs_prefetch() */
+#define LMFS_MAX_PREFETCH	NR_IOREQS
+
+struct buf {
+  /* Data portion of the buffer. */
+  void *data;
+
+  /* Header portion of the buffer - internal to libminixfs. */
+  struct buf *lmfs_next;       /* used to link all free bufs in a chain */
+  struct buf *lmfs_prev;       /* used to link all free bufs the other way */
+  struct buf *lmfs_hash;       /* used to link bufs on hash chains */
+  dev_t lmfs_dev;              /* major | minor device where block resides */
+  block64_t lmfs_blocknr;      /* block number of its (minor) device */
+  char lmfs_count;             /* number of users of this buffer */
+  char lmfs_needsetcache;      /* to be identified to VM */
+  size_t lmfs_bytes;           /* size of this block (allocated and used) */
+  u32_t lmfs_flags;            /* Flags shared between VM and FS */
+
+  /* If any, which inode & offset does this block correspond to?
+   * If none, VMC_NO_INODE
+   */
+  ino_t lmfs_inode;
+  u64_t lmfs_inode_offset;
+};
+
+void lmfs_markdirty(struct buf *bp);
+void lmfs_markclean(struct buf *bp);
+int lmfs_isclean(struct buf *bp);
+void lmfs_flushall(void);
+void lmfs_flushdev(dev_t dev);
+size_t lmfs_fs_block_size(void);
+void lmfs_may_use_vmcache(int);
+void lmfs_set_blocksize(size_t blocksize);
+void lmfs_buf_pool(int new_nr_bufs);
+int lmfs_get_block(struct buf **bpp, dev_t dev, block64_t block, int how);
+int lmfs_get_block_ino(struct buf **bpp, dev_t dev, block64_t block, int how,
+	ino_t ino, u64_t off);
+void lmfs_put_block(struct buf *bp);
+void lmfs_free_block(dev_t dev, block64_t block);
+void lmfs_zero_block_ino(dev_t dev, ino_t ino, u64_t off);
+void lmfs_invalidate(dev_t device);
+void lmfs_prefetch(dev_t dev, const block64_t *blockset, unsigned int nblocks);
+void lmfs_setquiet(int q);
+void lmfs_set_blockusage(fsblkcnt_t btotal, fsblkcnt_t bused);
+void lmfs_change_blockusage(int delta);
+
+/* get_block arguments */
+#define NORMAL             0    /* forces get_block to do disk read */
+#define NO_READ            1    /* prevents get_block from doing disk read */
+#define PEEK               2    /* returns ENOENT if not in cache */
+
+/* Block I/O helper functions. */
+void lmfs_driver(dev_t dev, char *label);
+ssize_t lmfs_bio(dev_t dev, struct fsdriver_data *data, size_t bytes,
+	off_t pos, int call);
+void lmfs_bflush(dev_t dev);
+
+#endif /* _MINIX_FSLIB_H */

Property changes on: lab4/.minix-src/include/minix/libminixfs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/msdosfs/msdosfsmount.h
===================================================================
--- lab4/.minix-src/include/msdosfs/msdosfsmount.h	(nonexistent)
+++ lab4/.minix-src/include/msdosfs/msdosfsmount.h	(revision 13)
@@ -0,0 +1,259 @@
+/*	$NetBSD: msdosfsmount.h,v 1.20 2014/07/08 09:21:52 hannken Exp $	*/
+
+/*-
+ * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
+ * Copyright (C) 1994, 1995, 1997 TooLs GmbH.
+ * All rights reserved.
+ * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
+ */
+/*
+ * Written by Paul Popelka (paulp@uts.amdahl.com)
+ *
+ * You can do anything you want with this software, just don't say you wrote
+ * it, and don't remove this notice.
+ *
+ * This software is provided "as is".
+ *
+ * The author supplies this software to be publicly redistributed on the
+ * understanding that the author is not responsible for the correct
+ * functioning of this software in any circumstances and is not liable for
+ * any damages caused by this software.
+ *
+ * October 1992
+ */
+
+#ifndef _MSDOSFS_MSDOSFSMOUNT_H_
+#define _MSDOSFS_MSDOSFSMOUNT_H_
+
+#ifndef MAKEFS
+/*
+ *  Arguments to mount MSDOS filesystems.
+ */
+struct msdosfs_args {
+	char	*fspec;		/* blocks special holding the fs to mount */
+	struct	export_args30 _pad1; /* compat with old userland tools */
+	uid_t	uid;		/* uid that owns msdosfs files */
+	gid_t	gid;		/* gid that owns msdosfs files */
+	mode_t  mask;		/* mask to be applied for msdosfs perms */
+	int	flags;		/* see below */
+
+	/* Following items added after versioning support */
+	int	version;	/* version of the struct */
+#define MSDOSFSMNT_VERSION	3
+	mode_t  dirmask;	/* v2: mask to be applied for msdosfs perms */
+	int	gmtoff;		/* v3: offset from UTC in seconds */
+};
+#endif
+
+/*
+ * Msdosfs mount options:
+ */
+#define	MSDOSFSMNT_SHORTNAME	1	/* Force old DOS short names only */
+#define	MSDOSFSMNT_LONGNAME	2	/* Force Win'95 long names */
+#define	MSDOSFSMNT_NOWIN95	4	/* Completely ignore Win95 entries */
+#define	MSDOSFSMNT_GEMDOSFS	8	/* This is a GEMDOS-flavour */
+#define MSDOSFSMNT_VERSIONED	16	/* Struct is versioned */
+
+/* All flags above: */
+#define	MSDOSFSMNT_MNTOPT \
+	(MSDOSFSMNT_SHORTNAME|MSDOSFSMNT_LONGNAME|MSDOSFSMNT_NOWIN95 \
+	 |MSDOSFSMNT_GEMDOSFS|MSDOSFSMNT_VERSIONED)
+
+#define	MSDOSFSMNT_RONLY	0x80000000	/* mounted read-only	*/
+#define	MSDOSFSMNT_WAITONFAT	0x40000000	/* mounted synchronous	*/
+#define	MSDOSFS_FATMIRROR	0x20000000	/* FAT is mirrored */
+
+#define MSDOSFSMNT_BITS "\177\20" \
+    "b\00shortname\0b\01longname\0b\02nowin95\0b\03gemdosfs\0b\04mntversioned\0" \
+    "b\037ronly\0b\036waitonfat\0b\035fatmirror\0"
+
+#ifdef _KERNEL
+#include <sys/mallocvar.h>
+#ifdef MALLOC_DECLARE
+MALLOC_DECLARE(M_MSDOSFSMNT);
+MALLOC_DECLARE(M_MSDOSFSTMP);
+#endif
+#endif
+
+#if defined(_KERNEL) || defined(MAKEFS)
+/*
+ * Layout of the mount control block for a MSDOSFS file system.
+ */
+struct msdosfsmount {
+	struct mount *pm_mountp;/* vfs mount struct for this fs */
+	dev_t pm_dev;		/* block special device mounted */
+	uid_t pm_uid;		/* uid to set as owner of the files */
+	gid_t pm_gid;		/* gid to set as owner of the files */
+	mode_t pm_mask;		/* mask to and with file protection bits
+				   for files */
+	mode_t pm_dirmask;	/* mask to and with file protection bits
+				   for directories */
+	int pm_gmtoff;		/* offset from UTC in seconds */
+	struct vnode *pm_devvp;	/* vnode for block device mntd */
+	struct bpb50 pm_bpb;	/* BIOS parameter blk for this fs */
+	u_long pm_FATsecs;	/* actual number of FAT sectors */
+	u_long pm_fatblk;	/* sector # of first FAT */
+	u_long pm_rootdirblk;	/* sector # (cluster # for FAT32) of root directory number */
+	u_long pm_rootdirsize;	/* size in sectors (not clusters) */
+	u_long pm_firstcluster;	/* sector number of first cluster */
+	u_long pm_nmbrofclusters;	/* # of clusters in filesystem */
+	u_long pm_maxcluster;	/* maximum cluster number */
+	u_long pm_freeclustercount;	/* number of free clusters */
+	u_long pm_cnshift;	/* shift file offset right this amount to get a cluster number */
+	u_long pm_crbomask;	/* and a file offset with this mask to get cluster rel offset */
+	u_long pm_bnshift;	/* shift file offset right this amount to get a sector number */
+	u_long pm_bpcluster;	/* bytes per cluster */
+	u_long pm_fmod;		/* ~0 if fs is modified, this can rollover to 0	*/
+	u_long pm_fatblocksize;	/* size of FAT blocks in bytes */
+	u_long pm_fatblocksec;	/* size of FAT blocks in sectors */
+	u_long pm_fatsize;	/* size of FAT in bytes */
+	u_long pm_fatmask;	/* mask to use for FAT numbers */
+	u_long pm_fsinfo;	/* fsinfo block number */
+	u_long pm_nxtfree;	/* next free cluster in fsinfo block */
+	u_int pm_fatmult;	/* these 2 values are used in FAT */
+	u_int pm_fatdiv;	/*	offset computation */
+	u_int pm_curfat;	/* current FAT for FAT32 (0 otherwise) */
+	u_int *pm_inusemap;	/* ptr to bitmap of in-use clusters */
+	u_int pm_flags;		/* see below */
+};
+/* Byte offset in FAT on filesystem pmp, cluster cn */
+#define	FATOFS(pmp, cn)	((cn) * (pmp)->pm_fatmult / (pmp)->pm_fatdiv)
+
+#define	VFSTOMSDOSFS(mp)	((struct msdosfsmount *)mp->mnt_data)
+
+/* Number of bits in one pm_inusemap item: */
+#define	N_INUSEBITS	(8 * sizeof(u_int))
+
+/*
+ * Shorthand for fields in the bpb contained in the msdosfsmount structure.
+ */
+#define	pm_BytesPerSec	pm_bpb.bpbBytesPerSec
+#define	pm_ResSectors	pm_bpb.bpbResSectors
+#define	pm_FATs		pm_bpb.bpbFATs
+#define	pm_RootDirEnts	pm_bpb.bpbRootDirEnts
+#define	pm_Sectors	pm_bpb.bpbSectors
+#define	pm_Media	pm_bpb.bpbMedia
+#define	pm_SecPerTrack	pm_bpb.bpbSecPerTrack
+#define	pm_Heads	pm_bpb.bpbHeads
+#define	pm_HiddenSects	pm_bpb.bpbHiddenSecs
+#define	pm_HugeSectors	pm_bpb.bpbHugeSectors
+
+/*
+ * Convert pointer to buffer -> pointer to direntry
+ */
+#define	bptoep(pmp, bp, dirofs) \
+	((struct direntry *)(((char *)(bp)->b_data)	\
+	 + ((dirofs) & (pmp)->pm_crbomask)))
+
+/*
+ * Convert sector number to cluster number
+ */
+#define	de_bn2cn(pmp, bn) \
+	((bn) >> ((pmp)->pm_cnshift - (pmp)->pm_bnshift))
+
+/*
+ * Convert cluster number to sector number
+ */
+#define	de_cn2bn(pmp, cn) \
+	((cn) << ((pmp)->pm_cnshift - (pmp)->pm_bnshift))
+
+/*
+ * Convert sector number to kernel block number
+ */
+#define de_bn2kb(pmp, bn) \
+	((bn) << ((pmp)->pm_bnshift - DEV_BSHIFT))
+
+/*
+ * Convert kernel block number to sector number
+ */
+#define de_kb2bn(pmp, kb) \
+	((kb) >> ((pmp)->pm_bnshift - DEV_BSHIFT))
+
+/*
+ * Convert file offset to cluster number
+ */
+#define de_cluster(pmp, off) \
+	((off) >> (pmp)->pm_cnshift)
+
+/*
+ * Clusters required to hold size bytes
+ */
+#define	de_clcount(pmp, size) \
+	(((size) + (pmp)->pm_bpcluster - 1) >> (pmp)->pm_cnshift)
+
+/*
+ * Convert file offset to sector number
+ */
+#define de_blk(pmp, off) \
+	(de_cn2bn(pmp, de_cluster((pmp), (off))))
+
+/*
+ * Convert cluster number to file offset
+ */
+#define	de_cn2off(pmp, cn) \
+	((cn) << (pmp)->pm_cnshift)
+
+/*
+ * Convert sector number to file offset
+ */
+#define	de_bn2off(pmp, bn) \
+	((bn) << (pmp)->pm_bnshift)
+/*
+ * Map a cluster number into a filesystem relative sector number.
+ */
+#define	cntobn(pmp, cn) \
+	(de_cn2bn((pmp), (cn)-CLUST_FIRST) + (pmp)->pm_firstcluster)
+
+/*
+ * Calculate sector number for directory entry in root dir, offset dirofs
+ */
+#define	roottobn(pmp, dirofs) \
+	(de_blk((pmp), (dirofs)) + (pmp)->pm_rootdirblk)
+
+/*
+ * Calculate sector number for directory entry at cluster dirclu, offset
+ * dirofs
+ */
+#define	detobn(pmp, dirclu, dirofs) \
+	((dirclu) == MSDOSFSROOT \
+	 ? roottobn((pmp), (dirofs)) \
+	 : cntobn((pmp), (dirclu)))
+
+/*
+ * Prototypes for MSDOSFS virtual filesystem operations
+ */
+void msdosfs_init(void);
+void msdosfs_reinit(void);
+void msdosfs_done(void);
+
+#ifndef MAKEFS
+VFS_PROTOS(msdosfs);
+#endif
+
+#endif /* _KERNEL || MAKEFS */
+#endif /* _MSDOSFS_MSDOSFSMOUNT_H_ */

Property changes on: lab4/.minix-src/include/msdosfs/msdosfsmount.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/eth_io.h
===================================================================
--- lab4/.minix-src/include/net/gen/eth_io.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/eth_io.h	(revision 13)
@@ -0,0 +1,81 @@
+/*
+server/gen/ip/eth_io.h
+*/
+
+#ifndef __SERVER__IP__GEN__ETH_IO_H__
+#define __SERVER__IP__GEN__ETH_IO_H__
+
+#include <net/if_ether.h>
+
+typedef struct nwio_ethopt
+{
+	u32_t nweo_flags;
+	ether_addr_t nweo_multi, nweo_rem;
+	ether_type_t nweo_type;
+} nwio_ethopt_t;
+
+#define NWEO_NOFLAGS	0x0000L
+#define NWEO_ACC_MASK	0x0003L
+#	define NWEO_EXCL	0x00000001L
+#	define NWEO_SHARED	0x00000002L
+#	define NWEO_COPY	0x00000003L
+#define NWEO_LOC_MASK	0x0010L
+#	define NWEO_EN_LOC	0x00000010L
+#	define NWEO_DI_LOC	0x00100000L
+#define NWEO_BROAD_MASK	0x0020L
+#	define NWEO_EN_BROAD	0x00000020L
+#	define NWEO_DI_BROAD	0x00200000L
+#define NWEO_MULTI_MASK 0x0040L
+#	define NWEO_EN_MULTI	0x00000040L
+#	define NWEO_DI_MULTI	0x00400000L
+#define NWEO_PROMISC_MASK 0x0080L
+#	define NWEO_EN_PROMISC	0x00000080L
+#	define NWEO_DI_PROMISC	0x00800000L
+#define NWEO_REM_MASK	0x0100L
+#	define NWEO_REMSPEC	0x00000100L
+#	define NWEO_REMANY	0x01000000L
+#define NWEO_TYPE_MASK	0x0200L
+#	define NWEO_TYPESPEC	0x00000200L
+#	define NWEO_TYPEANY	0x02000000L
+#define NWEO_RW_MASK	0x1000L
+#	define NWEO_RWDATONLY	0x00001000L
+#	define NWEO_RWDATALL	0x10000000L
+
+typedef struct eth_stat
+{
+	unsigned long ets_recvErr,	/* # receive errors */
+		ets_sendErr,		/* # send error */
+		ets_OVW,		/* # buffer overwrite warnings,
+					   (packets arrive faster than
+					   can be processed) */
+		ets_CRCerr,		/* # crc errors of read */
+		ets_frameAll,		/* # frames not alligned (# bits
+					   not a mutiple of 8) */
+		ets_missedP,		/* # packets missed due to too
+					   slow packet processing */
+		ets_packetR,		/* # packets received */
+		ets_packetT,		/* # packets transmitted */
+		ets_transDef,		/* # transmission defered (there
+					   was a transmission of an
+					   other station in progress */
+		ets_collision,		/* # collissions */
+		ets_transAb,		/* # transmissions aborted due
+					   to accesive collisions */
+		ets_carrSense,		/* # carrier sense lost */
+		ets_fifoUnder,		/* # fifo underruns (processor
+					   is too busy) */
+		ets_fifoOver,		/* # fifo overruns (processor is
+					   too busy) */
+		ets_CDheartbeat,	/* # times unable to transmit
+					   collision signal */
+		ets_OWC;		/* # times out of window
+					   collision */
+} eth_stat_t;
+
+typedef struct nwio_ethstat
+{
+	ether_addr_t nwes_addr;
+	eth_stat_t nwes_stat;
+} nwio_ethstat_t;
+
+#endif /* __SERVER__IP__GEN__ETH_IO_H__ */

Property changes on: lab4/.minix-src/include/net/gen/eth_io.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/paths.h
===================================================================
--- lab4/.minix-src/include/minix/paths.h	(nonexistent)
+++ lab4/.minix-src/include/minix/paths.h	(revision 13)
@@ -0,0 +1,17 @@
+#ifndef _MINIX_PATHS_H_
+#define _MINIX_PATHS_H_
+
+#define _PATH_MINIX_SERVICE "/sbin/minix-service"
+#define _PATH_PROC	"/proc/"
+
+#define _PATH_SYSTEM_CONF "/etc/system.conf"
+#define _PATH_SYSTEM_CONF_DIR "/etc/system.conf.d"
+#define _PATH_SYSTEM_CONF_PKG_DIR       "/usr/pkg/etc/system.conf.d"
+
+#define _PATH_RAMDISK	"/dev/ram"
+
+#define _PATH_DRIVERS	"/service"
+
+#define _PATH_HOSTNAME_FILE "/etc/hostname.file"
+
+#endif /* _MINIX_PATHS_H_ */

Property changes on: lab4/.minix-src/include/minix/paths.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/profile.h
===================================================================
--- lab4/.minix-src/include/minix/profile.h	(nonexistent)
+++ lab4/.minix-src/include/minix/profile.h	(revision 13)
@@ -0,0 +1,40 @@
+#ifndef _PROFILE_H
+#define _PROFILE_H
+
+#include <minix/type.h>
+#include <sys/types.h>
+
+/*
+ * Types relating to system profiling.
+ */
+
+#  define PROF_START       0    /* start statistical profiling */
+#  define PROF_STOP        1    /* stop statistical profiling */
+
+#define PROF_RTC	0 /* RTC based profiling */
+#define PROF_NMI	1 /* NMI based profiling, profiles kernel too */
+
+/* Info struct to be copied to from kernel to user program. */
+struct sprof_info_s {
+  int mem_used;
+  int total_samples;
+  int idle_samples;
+  int system_samples;
+  int user_samples;
+};
+
+/* What a profiling sample looks like (used for sizeof()). */
+struct sprof_sample {
+	endpoint_t	proc;
+	void *		pc;
+};
+
+struct sprof_proc {
+	endpoint_t	proc;
+	char		name[PROC_NAME_LEN];
+};
+
+int sprofile(int action, int size, int freq, int type, void *ctl_ptr,
+	void *mem_ptr);
+
+#endif /* PROFILE_H */

Property changes on: lab4/.minix-src/include/minix/profile.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/mthread.h
===================================================================
--- lab4/.minix-src/include/minix/mthread.h	(nonexistent)
+++ lab4/.minix-src/include/minix/mthread.h	(revision 13)
@@ -0,0 +1,239 @@
+#ifndef _MTHREAD_H
+#define _MTHREAD_H
+
+#include <minix/config.h>	/* MUST be first */
+#include <minix/const.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <ucontext.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <sys/signal.h>
+
+typedef int mthread_thread_t;
+typedef int mthread_once_t;
+typedef int mthread_key_t;
+typedef void * mthread_condattr_t;
+typedef void * mthread_mutexattr_t;
+
+struct __mthread_tcb;
+typedef struct {
+  struct __mthread_tcb *mq_head;
+  struct __mthread_tcb *mq_tail;
+} mthread_queue_t;
+
+struct __mthread_mutex {
+  mthread_queue_t mm_queue;	/* Queue of threads blocked on this mutex */
+  mthread_thread_t mm_owner;	/* Thread ID that currently owns mutex */
+#ifdef MTHREAD_STRICT
+  struct __mthread_mutex *mm_prev;
+  struct __mthread_mutex *mm_next;
+#endif
+  unsigned int mm_magic;
+};
+typedef struct __mthread_mutex *mthread_mutex_t;
+
+struct __mthread_cond {
+  struct __mthread_mutex *mc_mutex;	/* Associate mutex with condition */
+#ifdef MTHREAD_STRICT
+  struct __mthread_cond *mc_prev;
+  struct __mthread_cond *mc_next;
+#endif
+  unsigned int mc_magic;
+};
+typedef struct __mthread_cond *mthread_cond_t;
+
+struct __mthread_attr {
+  size_t ma_stacksize;
+  char *ma_stackaddr;
+  int ma_detachstate;
+  struct __mthread_attr *ma_prev;
+  struct __mthread_attr *ma_next;
+}; 
+typedef struct __mthread_attr *mthread_attr_t;
+
+typedef struct {
+  mthread_mutex_t mutex;
+  mthread_cond_t cond;
+} mthread_event_t;
+
+typedef struct {
+  unsigned int readers;
+  mthread_thread_t writer;
+  mthread_mutex_t queue;
+  mthread_event_t drain;
+} mthread_rwlock_t; 
+
+#define MTHREAD_CREATE_JOINABLE 001
+#define MTHREAD_CREATE_DETACHED 002
+#define MTHREAD_ONCE_INIT 0
+#define MTHREAD_STACK_MIN MINSIGSTKSZ
+#define MTHREAD_KEYS_MAX 128
+
+__BEGIN_DECLS
+/* allocate.c */
+int mthread_create(mthread_thread_t *thread, mthread_attr_t *tattr, void
+	*(*proc)(void *), void *arg);
+int mthread_detach(mthread_thread_t thread);
+int mthread_equal(mthread_thread_t l, mthread_thread_t r);
+void mthread_exit(void *value);
+int mthread_join(mthread_thread_t thread, void **value);
+int mthread_once(mthread_once_t *once, void (*proc)(void));
+mthread_thread_t mthread_self(void);
+
+/* attribute.c */
+int mthread_attr_destroy(mthread_attr_t *tattr);
+int mthread_attr_getdetachstate(mthread_attr_t *tattr, int
+	*detachstate);
+int mthread_attr_getstack(mthread_attr_t *tattr, void **stackaddr,
+	size_t *stacksize);
+int mthread_attr_getstacksize(mthread_attr_t *tattr, size_t *stacksize);
+int mthread_attr_init(mthread_attr_t *tattr);
+int mthread_attr_setdetachstate(mthread_attr_t *tattr, int detachstate);
+int mthread_attr_setstack(mthread_attr_t *tattr, void *stackaddr, size_t
+	stacksize);
+int mthread_attr_setstacksize(mthread_attr_t *tattr, size_t stacksize);
+
+
+/* condition.c */
+int mthread_cond_broadcast(mthread_cond_t *cond);
+int mthread_cond_destroy(mthread_cond_t *cond);
+int mthread_cond_init(mthread_cond_t *cond, mthread_condattr_t *cattr);
+int mthread_cond_signal(mthread_cond_t *cond);
+int mthread_cond_wait(mthread_cond_t *cond, mthread_mutex_t *mutex);
+
+/* key.c */
+int mthread_key_create(mthread_key_t *key, void (*destructor)(void *));
+int mthread_key_delete(mthread_key_t key);
+void *mthread_getspecific(mthread_key_t key);
+int mthread_setspecific(mthread_key_t key, void *value);
+
+/* misc.c */
+void mthread_stats(void);
+void mthread_verify_f(char *f, int l);
+#define mthread_verify() mthread_verify_f(__FILE__, __LINE__)
+void mthread_stacktrace(mthread_thread_t t);
+void mthread_stacktraces(void);
+
+/* mutex.c */
+int mthread_mutex_destroy(mthread_mutex_t *mutex);
+int mthread_mutex_init(mthread_mutex_t *mutex, mthread_mutexattr_t
+	*mattr);
+int mthread_mutex_lock(mthread_mutex_t *mutex);
+int mthread_mutex_trylock(mthread_mutex_t *mutex);
+int mthread_mutex_unlock(mthread_mutex_t *mutex);
+
+/* event.c */
+int mthread_event_destroy(mthread_event_t *event);
+int mthread_event_init(mthread_event_t *event);
+int mthread_event_wait(mthread_event_t *event);
+int mthread_event_fire(mthread_event_t *event);
+int mthread_event_fire_all(mthread_event_t *event);
+
+/* rwlock.c */
+int mthread_rwlock_destroy(mthread_rwlock_t *rwlock);
+int mthread_rwlock_init(mthread_rwlock_t *rwlock);
+int mthread_rwlock_rdlock(mthread_rwlock_t *rwlock);
+int mthread_rwlock_wrlock(mthread_rwlock_t *rwlock);
+int mthread_rwlock_unlock(mthread_rwlock_t *rwlock);
+
+/* schedule.c */
+int mthread_yield(void);
+void mthread_yield_all(void);
+__END_DECLS
+
+#if defined(_MTHREADIFY_PTHREADS)
+typedef mthread_thread_t pthread_t;
+typedef mthread_once_t pthread_once_t;
+typedef mthread_key_t pthread_key_t;
+typedef mthread_cond_t pthread_cond_t;
+typedef mthread_mutex_t pthread_mutex_t;
+typedef mthread_condattr_t pthread_condattr_t;
+typedef mthread_mutexattr_t pthread_mutexattr_t;
+typedef mthread_attr_t pthread_attr_t;
+typedef mthread_event_t pthread_event_t;
+typedef mthread_rwlock_t pthread_rwlock_t;
+
+/* LSC: No equivalent, so void* for now. */
+typedef void *pthread_rwlockattr_t;
+
+#define PTHREAD_ONCE_INIT 0
+#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1)
+#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1)
+
+__BEGIN_DECLS
+/* allocate.c */
+int pthread_create(pthread_t *thread, pthread_attr_t *tattr, void
+	*(*proc)(void *), void *arg);
+int pthread_detach(pthread_t thread);
+int pthread_equal(pthread_t l, pthread_t r);
+void pthread_exit(void *value);
+int pthread_join(pthread_t thread, void **value);
+int pthread_once(pthread_once_t *once, void (*proc)(void));
+pthread_t pthread_self(void);
+
+/* attribute.c */
+int pthread_attr_destroy(pthread_attr_t *tattr);
+int pthread_attr_getdetachstate(pthread_attr_t *tattr, int
+	*detachstate);
+int pthread_attr_getstack(pthread_attr_t *tattr, void **stackaddr,
+	size_t *stacksize);
+int pthread_attr_getstacksize(pthread_attr_t *tattr, size_t *stacksize);
+int pthread_attr_init(pthread_attr_t *tattr);
+int pthread_attr_setdetachstate(pthread_attr_t *tattr, int detachstate);
+int pthread_attr_setstack(pthread_attr_t *tattr, void *stackaddr, size_t
+	stacksize);
+int pthread_attr_setstacksize(pthread_attr_t *tattr, size_t stacksize);
+
+/* condition.c */
+int pthread_cond_broadcast(pthread_cond_t *cond);
+int pthread_cond_destroy(pthread_cond_t *cond);
+int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *cattr);
+int pthread_cond_signal(pthread_cond_t *cond);
+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
+
+/* key.c */
+int pthread_key_create(pthread_key_t *key, void (*destructor)(void *));
+int pthread_key_delete(pthread_key_t key);
+void *pthread_getspecific(pthread_key_t key);
+int pthread_setspecific(pthread_key_t key, void *value);
+
+/* mutex.c */
+int pthread_mutex_destroy(pthread_mutex_t *mutex);
+int pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t
+	*mattr);
+int pthread_mutex_lock(pthread_mutex_t *mutex);
+int pthread_mutex_trylock(pthread_mutex_t *mutex);
+int pthread_mutex_unlock(pthread_mutex_t *mutex);
+
+/* event.c */
+int pthread_event_destroy(pthread_event_t *event);
+int pthread_event_init(pthread_event_t *event);
+int pthread_event_wait(pthread_event_t *event);
+int pthread_event_fire(pthread_event_t *event);
+int pthread_event_fire_all(pthread_event_t *event);
+
+/* rwlock.c */
+int pthread_rwlock_destroy(pthread_rwlock_t *rwlock);
+int pthread_rwlock_init(pthread_rwlock_t *rwlock,
+	pthread_rwlockattr_t *UNUSED(attr));
+int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock);
+int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock);
+int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
+
+/* schedule.c */
+int pthread_yield(void);
+int sched_yield(void);
+void pthread_yield_all(void);
+
+/* LSC: FIXME: Maybe we should really do something with those... */
+#define pthread_mutexattr_init(u) (0)
+#define pthread_mutexattr_destroy(u) (0)
+
+#define PTHREAD_MUTEX_RECURSIVE 0
+#define pthread_mutexattr_settype(x, y) (EINVAL)
+__END_DECLS
+
+#endif /* defined(_MTHREADIFY_PTHREADS) */
+#endif

Property changes on: lab4/.minix-src/include/minix/mthread.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/param.h
===================================================================
--- lab4/.minix-src/include/minix/param.h	(nonexistent)
+++ lab4/.minix-src/include/minix/param.h	(revision 13)
@@ -0,0 +1,50 @@
+
+#ifndef _MINIX_PARAM_H
+#define _MINIX_PARAM_H 1
+
+#include <minix/com.h>
+#include <minix/const.h>
+
+/* Number of processes contained in the system image. */
+#define NR_BOOT_PROCS   (NR_TASKS + LAST_SPECIAL_PROC_NR + 1)
+
+#ifdef _MINIX_SYSTEM
+/* This is used to obtain system information through SYS_GETINFO. */
+#define MAXMEMMAP 40
+typedef struct kinfo {
+        /* Straight multiboot-provided info */
+        multiboot_info_t        mbi;
+        multiboot_module_t      module_list[MULTIBOOT_MAX_MODS];
+        multiboot_memory_map_t  memmap[MAXMEMMAP]; /* free mem list */
+        phys_bytes              mem_high_phys;
+        int                     mmap_size;
+
+        /* Multiboot-derived */
+        int                     mods_with_kernel; /* no. of mods incl kernel */
+        int                     kern_mod; /* which one is kernel */
+
+        /* Minix stuff, started at bootstrap phase */
+        int                     freepde_start;  /* lowest pde unused kernel pde */
+        char                    param_buf[MULTIBOOT_PARAM_BUF_SIZE];
+
+        /* Minix stuff */
+        struct kmessages *kmessages;
+        int do_serial_debug;    /* system serial output */
+        int serial_debug_baud;  /* serial baud rate */
+        int minix_panicing;     /* are we panicing? */
+        vir_bytes               user_sp; /* where does kernel want stack set */
+        vir_bytes               user_end; /* upper proc limit */
+        vir_bytes               vir_kern_start; /* kernel addrspace starts */
+        vir_bytes               bootstrap_start, bootstrap_len;
+        struct boot_image       boot_procs[NR_BOOT_PROCS];
+        int nr_procs;           /* number of user processes */
+        int nr_tasks;           /* number of kernel tasks */
+        char release[6];        /* kernel release number */
+        char version[6];        /* kernel version number */
+	int vm_allocated_bytes; /* allocated by kernel to load vm */
+	int kernel_allocated_bytes;		/* used by kernel */
+	int kernel_allocated_bytes_dynamic;	/* used by kernel (runtime) */
+} kinfo_t;
+#endif /* _MINIX_SYSTEM */
+
+#endif

Property changes on: lab4/.minix-src/include/minix/param.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/priv.h
===================================================================
--- lab4/.minix-src/include/minix/priv.h	(nonexistent)
+++ lab4/.minix-src/include/minix/priv.h	(revision 13)
@@ -0,0 +1,105 @@
+/* Privilege-related definitions. */
+
+#ifndef _MINIX_PRIV_H
+#define _MINIX_PRIV_H
+
+#include <minix/com.h>
+#include <minix/config.h>
+
+/* Static privilege id definitions. */
+#define NR_STATIC_PRIV_IDS         NR_BOOT_PROCS
+#define is_static_priv_id(id)	   (id >= 0 && id < NR_STATIC_PRIV_IDS)
+#define static_priv_id(n)          (NR_TASKS + (n))
+
+/* Unprivileged user processes all share the privilege structure of the
+ * user processesess.
+ * This id must be fixed because it is used to check send mask entries.
+ */
+#define USER_PRIV_ID	static_priv_id(ROOT_USR_PROC_NR)
+/* Specifies a null privilege id.
+ */
+#define NULL_PRIV_ID	(-1)
+
+/* Allowed targets. */
+#define NO_M      (-1)              /* no targets allowed */
+#define ALL_M     (-2)              /* all targets allowed */
+
+/* Allowed calls. */
+#define NO_C      (-1)              /* no calls allowed */
+#define ALL_C     (-2)              /* all calls allowed */
+#define NULL_C    (-3)              /* null call entry */
+
+/*
+ * Default privilege settings used in the system
+ */
+/* privilege flags */
+#define IDL_F     (SYS_PROC | BILLABLE) /* idle task is not preemptible as we
+                                         * don't want it to interfere with the
+                                         * timer tick interrupt handler code.
+                                         * Unlike other processes idle task is
+                                         * handled in a special way and is
+                                         * preempted always if timer tick occurs
+                                         * and there is another runnable process
+                                         */
+#define TSK_F     (SYS_PROC)                       /* other kernel tasks */
+#define SRV_F     (SYS_PROC | PREEMPTIBLE)         /* system services */
+#define DSRV_F    (SRV_F | DYN_PRIV_ID)            /* dynamic system services */
+#define RSYS_F    (SRV_F | ROOT_SYS_PROC)          /* root sys proc */
+#define VM_F      (SYS_PROC | VM_SYS_PROC)         /* vm */
+#define USR_F     (BILLABLE | PREEMPTIBLE)         /* user processes */
+#define IMM_F     (ROOT_SYS_PROC | VM_SYS_PROC | PREEMPTIBLE) /* immutable */
+
+/* init flags */
+#define TSK_I     0                               /* all kernel tasks */
+#define SRV_I     0                               /* system services */
+#define DSRV_I    0                               /* dynamic system services */
+#define USR_I     0                               /* user processes */
+
+/* allowed traps */
+#define CSK_T     (1 << RECEIVE)                   /* clock and system */
+#define TSK_T     0                                /* other kernel tasks */
+#define SRV_T     (~0)                             /* system services */
+#define DSRV_T    (~0)                             /* dynamic system services */
+#define USR_T     (1 << SENDREC)                   /* user processes */
+
+/* allowed targets */
+#define TSK_M     NO_M                             /* all kernel tasks */
+#define SRV_M     ALL_M                            /* system services */
+#define DSRV_M    ALL_M                            /* dynamic system services */
+#define USR_M     ALL_M                            /* user processes */
+
+/* allowed kernel calls */
+#define TSK_KC    NO_C                             /* all kernel tasks */
+#define SRV_KC    ALL_C                            /* dynamic system services */
+#define DSRV_KC   ALL_C                            /* default sys proc */
+#define USR_KC    NO_C                             /* user processes */
+
+/* allowed vm calls */
+#define SRV_VC    ALL_C                            /* dynamic system services */
+#define DSRV_VC   ALL_C                            /* default sys proc */
+#define USR_VC    ALL_C                            /* user processes */
+
+/* signal manager */
+#define SRV_SM    ROOT_SYS_PROC_NR                 /* system services */
+#define DSRV_SM   ROOT_SYS_PROC_NR                 /* dynamic system services */
+#define USR_SM    PM_PROC_NR                       /* user processes */
+
+/* scheduler */
+#define SRV_SCH   KERNEL                           /* system services */
+#define DSRV_SCH  SCHED_PROC_NR                    /* dynamic system services */
+#define USR_SCH   NONE                             /* user processes */
+
+/* scheduling priority queue. */
+#define SRV_Q     USER_Q                           /* system services */
+#define DSRV_Q    USER_Q                           /* dynamic system services */
+#define USR_Q     USER_Q                           /* user processes */
+
+/* scheduling quantum. */
+#define SRV_QT    USER_QUANTUM                     /* system services */
+#define DSRV_QT   USER_QUANTUM                     /* dynamic system services */
+#define USR_QT    USER_QUANTUM                     /* user processes */
+
+/* default CPU */
+#define DSRV_CPU USER_DEFAULT_CPU
+
+#endif /* _MINIX_PRIV_H */

Property changes on: lab4/.minix-src/include/minix/priv.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/sound.h
===================================================================
--- lab4/.minix-src/include/minix/sound.h	(nonexistent)
+++ lab4/.minix-src/include/minix/sound.h	(revision 13)
@@ -0,0 +1,45 @@
+/* Definitions used by /dev/audio and /dev/mixer.
+ *
+ *  Feb 13 1995			Author: Michel R. Prevenier 
+ */
+
+#ifndef SOUND_H
+#define SOUND_H
+
+/* ------- Mixer stuff ------- */
+
+/* Available devices */
+enum Device
+{
+  Master,     /* Master volume */
+  Dac,        /* DSP, digitized sound */
+  Fm,         /* Fm synthesized sound */
+  Cd,         /* Compact */
+  Line,       /* Line in */
+  Mic,        /* Microphone */
+  Speaker,    /* Pc speaker */
+  Treble,     /* Treble */
+  Bass        /* Bass */
+};
+
+enum InputState
+{
+  ON, OFF
+};
+
+/* Volume levels range from 0 to 31, bass & treble range from 0 to 15 */
+struct volume_level
+{
+  enum Device	device; 
+  int 	 	left;   	
+  int 	 	right;
+};
+
+struct inout_ctrl
+{
+  enum Device   	device;
+  enum InputState 	left;
+  enum InputState 	right;
+};
+
+#endif /* SOUND_H */

Property changes on: lab4/.minix-src/include/minix/sound.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/sysinfo.h
===================================================================
--- lab4/.minix-src/include/minix/sysinfo.h	(nonexistent)
+++ lab4/.minix-src/include/minix/sysinfo.h	(revision 13)
@@ -0,0 +1,20 @@
+
+#ifndef _MINIX_SYSINFO_H
+#define _MINIX_SYSINFO_H
+
+#include <minix/endpoint.h>
+#include <minix/type.h>
+
+int getsysinfo(endpoint_t who, int what, void *where, size_t size);
+
+/* What system info to retrieve with sysgetinfo(). */
+#define SI_PROC_TAB	   2	/* copy of entire process table */
+#define SI_DMAP_TAB	   3	/* get device <-> driver mappings */
+#define SI_DATA_STORE	   5	/* get copy of data store mappings */
+#define SI_CALL_STATS	   9	/* system call statistics */
+#define SI_PROCPUB_TAB	   11	/* copy of public entries of process table */
+#define SI_PROCALL_TAB	   12	/* copy of both private and public entries */
+#define SI_PROCLIGHT_TAB   13	/* copy of light version of process table */
+
+#endif
+

Property changes on: lab4/.minix-src/include/minix/sysinfo.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/type.h
===================================================================
--- lab4/.minix-src/include/minix/type.h	(nonexistent)
+++ lab4/.minix-src/include/minix/type.h	(revision 13)
@@ -0,0 +1,249 @@
+#ifndef _TYPE_H
+#define _TYPE_H
+
+#include <sys/types.h>
+#include <sys/endian.h>
+
+#include <machine/multiboot.h>
+
+#ifndef _MINIX_SYS_CONFIG_H
+#include <minix/sys_config.h>
+#endif
+
+#include <sys/sigtypes.h>
+
+#include <stdint.h>
+#include <stddef.h>
+
+/* Type definitions. */
+typedef unsigned int vir_clicks; 	/*  virtual addr/length in clicks */
+typedef unsigned long phys_bytes;	/* physical addr/length in bytes */
+typedef unsigned int phys_clicks;	/* physical addr/length in clicks */
+typedef int endpoint_t;			/* process identifier */
+typedef int32_t cp_grant_id_t;		/* A grant ID. */
+typedef long unsigned int vir_bytes;	/* virtual addresses/lengths in bytes */
+
+/* Structure for virtual copying by means of a vector with requests. */
+struct vir_addr {
+  endpoint_t proc_nr_e; /* NONE for phys, otherwise process endpoint */
+  vir_bytes offset;
+};
+
+#define phys_cp_req vir_cp_req 
+struct vir_cp_req {
+  struct vir_addr src;
+  struct vir_addr dst;
+  phys_bytes count;
+};
+
+/* Structures for SYS_VUMAP. */
+struct vumap_vir {
+  union {
+	cp_grant_id_t u_grant;	/* grant identifier, for non-SELF endpoint */
+	vir_bytes u_addr;	/* local virtual address, for SELF endpoint */
+  } vv_u;
+  size_t vv_size;		/* size in bytes */
+};
+#define vv_grant	vv_u.u_grant
+#define vv_addr		vv_u.u_addr
+
+struct vumap_phys {
+  phys_bytes vp_addr;		/* physical address */
+  size_t vp_size;		/* size in bytes */
+};
+
+/* I/O vector structures used in protocols between services. */
+typedef struct {
+  vir_bytes iov_addr;		/* address of an I/O buffer */
+  vir_bytes iov_size;		/* sizeof an I/O buffer */
+} iovec_t;
+
+typedef struct {
+  cp_grant_id_t iov_grant;	/* grant ID of an I/O buffer */
+  vir_bytes iov_size;		/* sizeof an I/O buffer */
+} iovec_s_t;
+
+/* PM passes the address of a structure of this type to KERNEL when
+ * sys_sigsend() is invoked as part of the signal catching mechanism.
+ * The structure contain all the information that KERNEL needs to build
+ * the signal stack.
+ */
+struct sigmsg {
+  int sm_signo;			/* signal number being caught */
+  sigset_t sm_mask;		/* mask to restore when handler returns */
+  vir_bytes sm_sighandler;	/* address of handler */
+  vir_bytes sm_sigreturn;	/* address of _sigreturn in C library */
+  vir_bytes sm_stkptr;		/* user stack pointer */
+};
+
+/* Structure used for computing per-process average CPU utilization. */
+struct cpuavg {
+	clock_t ca_base;	/* start of current per-second slot, or 0 */
+	uint32_t ca_run;	/* running ticks since start of slot, FSCALE */
+	uint32_t ca_last;	/* running ticks during last second, FSCALE */
+	uint32_t ca_avg;	/* decaying CPU utilization average, FSCALE */
+};
+
+/* Load data accounted every this no. of seconds. */
+#define _LOAD_UNIT_SECS		 6 	/* Changing this breaks ABI. */
+
+/* Load data history is kept for this long. */
+#define _LOAD_HISTORY_MINUTES	15	/* Changing this breaks ABI. */
+#define _LOAD_HISTORY_SECONDS	(60*_LOAD_HISTORY_MINUTES)
+
+/* We need this many slots to store the load history. */
+#define _LOAD_HISTORY	(_LOAD_HISTORY_SECONDS/_LOAD_UNIT_SECS)
+
+/* Runnable processes and other load-average information. */
+struct loadinfo {
+  u16_t proc_load_history[_LOAD_HISTORY];	/* history of proc_s_cur */
+  u16_t proc_last_slot;
+  clock_t last_clock;
+};
+
+struct kclockinfo {
+  time_t boottime;		/* number of seconds since UNIX epoch */
+#if BYTE_ORDER == LITTLE_ENDIAN
+  clock_t uptime;		/* number of clock ticks since system boot */
+  uint32_t _rsvd1;		/* reserved for 64-bit uptime */
+  clock_t realtime;		/* real time in clock ticks since boot */
+  uint32_t _rsvd2;		/* reserved for 64-bit real time */
+#elif BYTE_ORDER == BIG_ENDIAN
+  uint32_t _rsvd1;		/* reserved for 64-bit uptime */
+  clock_t uptime;		/* number of clock ticks since system boot */
+  uint32_t _rsvd2;		/* reserved for 64-bit real time */
+  clock_t realtime;		/* real time in clock ticks since boot */
+#else
+#error "unknown endianness"
+#endif
+  uint32_t hz;			/* clock frequency in ticks per second */
+};
+
+struct machine {
+  unsigned processors_count;	/* how many cpus are available */
+  unsigned bsp_id;		/* id of the bootstrap cpu */
+  int padding;			/* used to be protected */
+  int apic_enabled; /* does the kernel use APIC or not? */
+  phys_bytes	acpi_rsdp; /* where is the acpi RSDP */
+  unsigned int board_id;   /* Identifier for the board see   */
+                           /* include/minix/board.h for more */
+                           /* information.                   */
+};
+
+struct io_range
+{
+	unsigned ior_base;	/* Lowest I/O port in range */
+	unsigned ior_limit;	/* Highest I/O port in range */
+};
+
+struct minix_mem_range
+{
+	phys_bytes mr_base;	/* Lowest memory address in range */
+	phys_bytes mr_limit;	/* Highest memory address in range */
+};
+
+#define PROC_NAME_LEN   16
+
+/* List of boot-time processes set in kernel/table.c. */
+struct boot_image {
+  int proc_nr;                    	/* process number to use */
+  char proc_name[PROC_NAME_LEN];        /* name in process table */
+  endpoint_t endpoint;                  /* endpoint number when started */
+  phys_bytes start_addr;		/* Where it's in memory */
+  phys_bytes len;
+};
+
+/* Memory chunks. */
+struct memory {
+	phys_bytes	base;
+	phys_bytes	size;
+};
+
+#define STATICINIT(v, n) \
+	if(!(v)) {	\
+		if(!((v) = alloc_contig(sizeof(*(v)) * (n), 0, NULL))) { \
+			panic("allocating " #v " failed: %d", n);	\
+		}	\
+	}
+
+/* The kernel outputs diagnostic messages in a circular buffer. */
+struct kmessages {
+  int km_next;                          /* next index to write */
+  int km_size;                          /* current size in buffer */
+  char km_buf[_KMESS_BUF_SIZE];          /* buffer for messages */
+  char kmess_buf[80*25];           /* printable copy of message buffer */
+  int blpos;				/* kmess_buf position */
+};
+
+#include <minix/config.h>
+#include <machine/interrupt.h>
+
+/* randomness struct: random sources after interrupts: */
+#define RANDOM_SOURCES			16
+#define RANDOM_ELEMENTS			64
+
+typedef unsigned short rand_t;
+
+struct k_randomness {
+  int random_elements, random_sources;
+  struct k_randomness_bin {
+        int r_next;                             /* next index to write */
+        int r_size;                             /* number of random elements */
+        rand_t r_buf[RANDOM_ELEMENTS]; /* buffer for random info */
+  } bin[RANDOM_SOURCES];
+};
+
+/* ARM free-running timer information. */
+struct arm_frclock {
+	u64_t hz;		/* tcrr frequency */
+	u32_t tcrr;		/* tcrr address */
+};
+
+/* The userland ABI portion of general information exposed by the kernel.
+ * This structure may only ever be extended with new fields!
+ */
+struct kuserinfo {
+	size_t kui_size;	/* size of this structure, for ABI testing */
+	vir_bytes kui_user_sp;	/* initial stack pointer for exec'd process */
+};
+
+/* If MINIX_KIF_USERINFO is set, use this to check for a particular field. */
+#define KUSERINFO_HAS_FIELD(kui,f) \
+	(kui->kui_size >= offsetof(struct kuserinfo, f) + sizeof(kui->f))
+
+struct minix_kerninfo {
+	/* Binaries will depend on the offsets etc. in this structure, so it
+	 * can't be changed willy-nilly. In other words, it is ABI-restricted.
+	 * However, various fields are to be used by services only, and are not
+	 * to be used by userland directly. For pointers to non-userland-ABI
+	 * structures, these structures themselves may be changed without
+	 * breaking the userland ABI.
+	 *
+	 * There is currently one important legacy exception: the 'kinfo'
+	 * structure should not be part of the userland ABI, but one of its
+	 * fields, "user_sp" at offset 2440, is used by legacy user binaries.
+	 * This field has since been moved into the 'kuserinfo' structure, but
+	 * it will take another major release before we can start changing the
+	 * layout of the 'kinfo' structure.
+	 */
+#define KERNINFO_MAGIC 0xfc3b84bf
+	u32_t kerninfo_magic;
+	u32_t minix_feature_flags;	/* features in minix kernel */
+	u32_t ki_flags;			/* what is present in this struct */
+	u32_t flags_unused2;
+	u32_t flags_unused3;
+	u32_t flags_unused4;
+	struct kinfo		*kinfo;			/* see note above! */
+	struct machine		*machine;		/* NOT userland ABI */
+	struct kmessages	*kmessages;		/* NOT userland ABI */
+	struct loadinfo		*loadinfo;		/* NOT userland ABI */
+	struct minix_ipcvecs	*minix_ipcvecs;		/* userland ABI */
+	struct kuserinfo	*kuserinfo;		/* userland ABI */
+	struct arm_frclock	*arm_frclock;		/* NOT userland ABI */
+	volatile struct kclockinfo	*kclockinfo;	/* NOT userland ABI */
+};
+
+#define MINIX_KIF_IPCVECS	(1L << 0)	/* minix_ipcvecs is valid */
+#define MINIX_KIF_USERINFO	(1L << 1)	/* kuserinfo is valid */
+
+#endif /* _TYPE_H */

Property changes on: lab4/.minix-src/include/minix/type.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/vassert.h
===================================================================
--- lab4/.minix-src/include/minix/vassert.h	(nonexistent)
+++ lab4/.minix-src/include/minix/vassert.h	(revision 13)
@@ -0,0 +1,139 @@
+#ifndef _VASSERT_H_
+#define _VASSERT_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /*__cplusplus*/
+
+#define ALIGNED(n) __attribute__((__aligned__(n)))
+#define VASSERT_TRIGGER_OFFSET 1221
+#define VASSERT_PAGE_SIZE      4096
+
+/* Need to align at 4K. */
+/* Ensure the inReplay flag is on its own page. */
+#pragma pack(1)
+typedef struct VAssert_StateWrapper {
+   char space1[VASSERT_TRIGGER_OFFSET];
+   volatile char inReplay;
+   char space[VASSERT_PAGE_SIZE - VASSERT_TRIGGER_OFFSET - sizeof(char)];
+} VAssert_StateWrapper;
+#pragma pack()
+
+extern VAssert_StateWrapper vassert_state;
+
+/*
+ * User-selectable standard functions.
+ * XXX: Document these, in coordination with the SDK docs.
+ */
+
+#if defined(__KERNEL__)
+#  define KERNEL_VASSERT
+#endif
+
+#ifdef KERNEL_VASSERT
+
+#  ifndef VASSERT_CUSTOM_ASSERT
+#     define VASSERT_CUSTOM_ASSERT(expr)
+#  endif
+
+#  ifndef VASSERT_CUSTOM_ABORT
+#     include <linux/kernel.h>
+#     define VASSERT_CUSTOM_ABORT() ((void)0) // printk(KERN_ALERT"VAssert abort at %s: %d", __FILE__, __LINE__)
+#  endif
+
+#  ifndef VASSERT_CUSTOM_LOG
+#     include <linux/kernel.h>
+#     define VASSERT_CUSTOM_LOG printk
+#  endif
+
+#else
+#  ifndef VASSERT_CUSTOM_ASSERT
+#     include <assert.h>
+#     define VASSERT_CUSTOM_ASSERT assert
+#  endif
+
+#  ifndef VASSERT_CUSTOM_ABORT
+#     include <stdlib.h>
+#     define VASSERT_CUSTOM_ABORT abort
+#  endif
+
+#  ifndef VASSERT_CUSTOM_LOG
+#     include <stdio.h>
+#     define VASSERT_CUSTOM_LOG printf
+#  endif
+#endif
+
+/* Results: 0 if successful, -1 if not. */
+// XXX need to automatic de-register trigger page when the program quits
+extern char VAssert_Init(void);
+extern char VAssert_Uninit(void);
+
+/*
+ * These functions should not be called directly; they need to be wrapped.
+ */
+extern void VAssert_LogMain(const char *format, ...)
+	__attribute__((__format__(__printf__, 1, 2)));
+extern void VAssert_GoLiveMain(void);
+extern void VAssert_ReturnToReplayMain(void);
+extern char VAssert_Trace(size_t max_size);
+
+#ifdef VASSERT_ALWAYS_EXECUTE
+
+#define VAssert_Assert(expr)              \
+do {                                      \
+   VASSERT_CUSTOM_ASSERT(expr);           \
+} while (0)
+
+#define VAssert_Log(args)                 \
+do {                                      \
+   VASSERT_CUSTOM_LOG args;               \
+} while (0)
+
+#define VAssert_BeginBlock
+#define VAssert_EndBlock
+
+#else /* VASSERT_ALWAYS_EXECUTE */
+
+#define VAssert_Assert(expr)              \
+do {                                      \
+   if (vassert_state.inReplay) {          \
+      if (!(expr)) {                      \
+         VAssert_GoLiveMain();            \
+         VASSERT_CUSTOM_ABORT();          \
+      } else {                            \
+         VAssert_ReturnToReplayMain();    \
+      }                                   \
+   }                                      \
+} while (0)
+
+#define VAssert_Log(args)                 \
+do {                                      \
+   if (vassert_state.inReplay) {          \
+      VAssert_LogMain args;               \
+      VAssert_ReturnToReplayMain();       \
+   }                                      \
+} while (0)
+
+#define VAssert_BeginBlock if (vassert_state.inReplay)
+#define VAssert_EndBlock VAssert_ReturnToReplayMain()
+
+#endif /* VASSERT_ALWAYS_EXECUTE */
+
+/* 
+ * Record/Replay functionality
+ */
+/*
+ * Results: True if successful, false if not.
+ * Input: True to start recording, false to stop.
+ */
+extern char VAssert_SetRecordingMain(char start);
+
+#define VAssert_StartRecording() VAssert_SetRecordingMain(1)
+#define VAssert_StopRecording() VAssert_SetRecordingMain(0)
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus*/
+
+#endif /*_VASSERT_H_*/

Property changes on: lab4/.minix-src/include/minix/vassert.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/vboxtype.h
===================================================================
--- lab4/.minix-src/include/minix/vboxtype.h	(nonexistent)
+++ lab4/.minix-src/include/minix/vboxtype.h	(revision 13)
@@ -0,0 +1,36 @@
+#ifndef _MINIX_VBOXTYPE_H
+#define _MINIX_VBOXTYPE_H
+
+/* This header declares the type definitions shared between VBOX driver, the
+ * interface in libsys, and any caller of those interface functions.
+ */
+
+/* Call parameter type. */
+typedef enum {
+  VBOX_TYPE_INVALID,		/* invalid type */
+  VBOX_TYPE_U32,		/* 32-bit value */
+  VBOX_TYPE_U64,		/* 64-bit value */
+  VBOX_TYPE_PTR			/* pointer to granted memory area */
+} vbox_type_t;
+
+/* Call parameter transfer direction. */
+#define VBOX_DIR_IN	0x01	/* from host to guest */
+#define VBOX_DIR_OUT	0x02	/* from guest to host */
+#define VBOX_DIR_INOUT	(VBOX_DIR_IN | VBOX_DIR_OUT)
+
+/* Call parameter. */
+typedef struct {
+  vbox_type_t type;
+  union {
+	u32_t u32;
+	u64_t u64;
+	struct {
+		cp_grant_id_t grant;
+		size_t off;
+		size_t size;
+		unsigned int dir;
+	} ptr;
+  };
+} vbox_param_t;
+
+#endif /*_MINIX_VBOXTYPE_H */

Property changes on: lab4/.minix-src/include/minix/vboxtype.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/vtreefs.h
===================================================================
--- lab4/.minix-src/include/minix/vtreefs.h	(nonexistent)
+++ lab4/.minix-src/include/minix/vtreefs.h	(revision 13)
@@ -0,0 +1,74 @@
+#ifndef _MINIX_VTREEFS_H
+#define _MINIX_VTREEFS_H
+
+struct inode;
+typedef int index_t;
+typedef void *cbdata_t;
+
+#define NO_INDEX	((index_t) -1)
+
+/* Maximum file name length, excluding terminating null character, for which
+ * the name will be allocated statically. Longer names will be allocated
+ * dynamically, and should not be used for system-critical file systems.
+ */
+#define PNAME_MAX	24
+
+struct inode_stat {
+	mode_t mode;		/* file mode (type and permissions) */
+	uid_t uid;		/* user ID */
+	gid_t gid;		/* group ID */
+	off_t size;		/* file size */
+	dev_t dev;		/* device number (for char/block type files) */
+};
+
+struct fs_hooks {
+	void (*init_hook)(void);
+	void (*cleanup_hook)(void);
+	int (*lookup_hook)(struct inode *inode, char *name, cbdata_t cbdata);
+	int (*getdents_hook)(struct inode *inode, cbdata_t cbdata);
+	ssize_t (*read_hook)(struct inode *inode, char *ptr, size_t len,
+	    off_t off, cbdata_t cbdata);
+	ssize_t (*write_hook)(struct inode *inode, char *ptr, size_t max,
+	    off_t off, cbdata_t cbdata);
+	int (*trunc_hook)(struct inode *inode, off_t offset, cbdata_t cbdata);
+	int (*mknod_hook)(struct inode *inode, char *name,
+	    struct inode_stat *stat, cbdata_t cbdata);
+	int (*unlink_hook)(struct inode *inode, cbdata_t cbdata);
+	int (*slink_hook)(struct inode *inode, char *name,
+	    struct inode_stat *stat, char *path, cbdata_t cbdata);
+	int (*rdlink_hook)(struct inode *inode, char *ptr, size_t max,
+	    cbdata_t cbdata);
+	int (*chstat_hook)(struct inode *inode, struct inode_stat *stat,
+	    cbdata_t cbdata);
+	void (*message_hook)(message *m, int ipc_status);
+};
+
+extern struct inode *add_inode(struct inode *parent, const char *name,
+	index_t index, const struct inode_stat *stat,
+	index_t nr_indexed_slots, cbdata_t cbdata);
+extern void delete_inode(struct inode *inode);
+
+extern struct inode *get_inode_by_name(const struct inode *parent,
+	const char *name);
+extern struct inode *get_inode_by_index(const struct inode *parent,
+	index_t index);
+
+extern const char *get_inode_name(const struct inode *inode);
+extern index_t get_inode_index(const struct inode *inode);
+extern index_t get_inode_slots(const struct inode *inode);
+extern cbdata_t get_inode_cbdata(const struct inode *inode);
+extern void *get_inode_extra(const struct inode *inode);
+
+extern struct inode *get_root_inode(void);
+extern struct inode *get_parent_inode(const struct inode *inode);
+extern struct inode *get_first_inode(const struct inode *parent);
+extern struct inode *get_next_inode(const struct inode *previous);
+
+extern void get_inode_stat(const struct inode *inode, struct inode_stat *stat);
+extern void set_inode_stat(struct inode *inode, struct inode_stat *stat);
+
+extern void run_vtreefs(struct fs_hooks *hooks, unsigned int nr_inodes,
+	size_t inode_extra, struct inode_stat *stat, index_t nr_indexed_slots,
+	size_t buf_size);
+
+#endif /* _MINIX_VTREEFS_H */

Property changes on: lab4/.minix-src/include/minix/vtreefs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/msdosfs/direntry.h
===================================================================
--- lab4/.minix-src/include/msdosfs/direntry.h	(nonexistent)
+++ lab4/.minix-src/include/msdosfs/direntry.h	(revision 13)
@@ -0,0 +1,146 @@
+/*	$NetBSD: direntry.h,v 1.7 2013/10/20 00:01:55 christos Exp $	*/
+
+/*-
+ * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
+ * Copyright (C) 1994, 1995, 1997 TooLs GmbH.
+ * All rights reserved.
+ * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
+ */
+/*
+ * Written by Paul Popelka (paulp@uts.amdahl.com)
+ *
+ * You can do anything you want with this software, just don't say you wrote
+ * it, and don't remove this notice.
+ *
+ * This software is provided "as is".
+ *
+ * The author supplies this software to be publicly redistributed on the
+ * understanding that the author is not responsible for the correct
+ * functioning of this software in any circumstances and is not liable for
+ * any damages caused by this software.
+ *
+ * October 1992
+ */
+#ifndef _MSDOSFS_DIRENTRY_H_
+#define _MSDOSFS_DIRENTRY_H_
+
+/*
+ * Structure of a dos directory entry.
+ */
+struct direntry {
+	u_int8_t	deName[8];	/* filename, blank filled */
+#define	SLOT_EMPTY	0x00		/* slot has never been used */
+#define	SLOT_E5		0x05		/* the real value is 0xe5 */
+#define	SLOT_DELETED	0xe5		/* file in this slot deleted */
+	u_int8_t	deExtension[3];	/* extension, blank filled */
+	u_int8_t	deAttributes;	/* file attributes */
+#define	ATTR_NORMAL	0x00		/* normal file */
+#define	ATTR_READONLY	0x01		/* file is readonly */
+#define	ATTR_HIDDEN	0x02		/* file is hidden */
+#define	ATTR_SYSTEM	0x04		/* file is a system file */
+#define	ATTR_VOLUME	0x08		/* entry is a volume label */
+#define	ATTR_DIRECTORY	0x10		/* entry is a directory name */
+#define	ATTR_ARCHIVE	0x20		/* file is new or modified */
+	u_int8_t	deReserved;	/* reserved */
+	u_int8_t	deCHundredth;	/* hundredth of seconds in CTime */
+	u_int8_t	deCTime[2];	/* create time */
+	u_int8_t	deCDate[2];	/* create date */
+	u_int8_t	deADate[2];	/* access date */
+	u_int8_t	deHighClust[2];	/* high bytes of cluster number */
+	u_int8_t	deMTime[2];	/* last update time */
+	u_int8_t	deMDate[2];	/* last update date */
+	u_int8_t	deStartCluster[2]; /* starting cluster of file */
+	u_int8_t	deFileSize[4];	/* size of file in bytes */
+};
+
+static __inline uint8_t
+msdos_dirchar(const struct direntry *de, size_t i) {
+	return i < sizeof(de->deName) ? de->deName[i] :
+	    de->deExtension[i - sizeof(de->deName)];
+}
+
+/*
+ * Structure of a Win95 long name directory entry
+ */
+struct winentry {
+	u_int8_t	weCnt;
+#define	WIN_LAST	0x40
+#define	WIN_CNT		0x3f
+	u_int8_t	wePart1[10];
+	u_int8_t	weAttributes;
+#define	ATTR_WIN95	0x0f
+	u_int8_t	weReserved1;
+	u_int8_t	weChksum;
+	u_int8_t	wePart2[12];
+	u_int16_t	weReserved2;
+	u_int8_t	wePart3[4];
+};
+#define	WIN_CHARS	13	/* Number of chars per winentry */
+
+/*
+ * This is the format of the contents of the deTime field in the direntry
+ * structure.
+ * We don't use bitfields because we don't know how compilers for
+ * arbitrary machines will lay them out.
+ */
+#define DT_2SECONDS_MASK	0x1F	/* seconds divided by 2 */
+#define DT_2SECONDS_SHIFT	0
+#define DT_MINUTES_MASK		0x7E0	/* minutes */
+#define DT_MINUTES_SHIFT	5
+#define DT_HOURS_MASK		0xF800	/* hours */
+#define DT_HOURS_SHIFT		11
+
+/*
+ * This is the format of the contents of the deDate field in the direntry
+ * structure.
+ */
+#define DD_DAY_MASK		0x1F	/* day of month */
+#define DD_DAY_SHIFT		0
+#define DD_MONTH_MASK		0x1E0	/* month */
+#define DD_MONTH_SHIFT		5
+#define DD_YEAR_MASK		0xFE00	/* year - 1980 */
+#define DD_YEAR_SHIFT		9
+
+#if defined(_KERNEL) || defined(MAKEFS)
+struct dirent;
+void	unix2dostime(const struct timespec *tsp, int gmtoff, u_int16_t *ddp,
+	    u_int16_t *dtp, u_int8_t *dhp);
+void	dos2unixtime(u_int dd, u_int dt, u_int dh, int gmtoff,
+	    struct timespec *tsp);
+int	dos2unixfn(u_char dn[11], u_char *un, int lower);
+int	unix2dosfn(const u_char *un, u_char dn[12], int unlen,
+	    u_int gen);
+int	unix2winfn(const u_char *un, int unlen, struct winentry *wep,
+	    int cnt, int chksum);
+int	winChkName(const u_char *un, int unlen, struct winentry *wep,
+	    int chksum);
+int	win2unixfn(struct winentry *wep, struct dirent *dp, int chksum);
+u_int8_t winChksum(u_int8_t *name);
+int	winSlotCnt(const u_char *un, int unlen);
+#endif /* _KERNEL || MAKEFS */
+#endif /* _MSDOSFS_DIRENTRY_H_ */

Property changes on: lab4/.minix-src/include/msdosfs/direntry.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/sched.h
===================================================================
--- lab4/.minix-src/include/minix/sched.h	(nonexistent)
+++ lab4/.minix-src/include/minix/sched.h	(revision 13)
@@ -0,0 +1,13 @@
+#ifndef _MINIX_SCHED_H
+#define _MINIX_SCHED_H
+
+#include <minix/ipc.h>
+
+int sched_stop(endpoint_t scheduler_e, endpoint_t schedulee_e);
+int sched_start(endpoint_t scheduler_e, endpoint_t schedulee_e,
+	endpoint_t parent_e, int maxprio, int quantum, int cpu, endpoint_t
+	*newscheduler_e);
+int sched_inherit(endpoint_t scheduler_e, endpoint_t schedulee_e,
+	endpoint_t parent_e, unsigned maxprio, endpoint_t *newscheduler_e);
+
+#endif /* _MINIX_SCHED_H */

Property changes on: lab4/.minix-src/include/minix/sched.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/sockevent.h
===================================================================
--- lab4/.minix-src/include/minix/sockevent.h	(nonexistent)
+++ lab4/.minix-src/include/minix/sockevent.h	(revision 13)
@@ -0,0 +1,120 @@
+#ifndef _MINIX_SOCKEVENT_H
+#define _MINIX_SOCKEVENT_H
+
+#include <minix/sockdriver.h>
+
+/* Socket events. */
+#define SEV_BIND	0x01	/* a pending bind operation has ended */
+#define SEV_CONNECT	0x02	/* a pending connect operation has ended */
+#define SEV_ACCEPT	0x04	/* pending accept operations may be resumed */
+#define SEV_SEND	0x08	/* pending send operations may be resumed */
+#define SEV_RECV	0x10	/* pending receive operations may be resumed */
+#define SEV_CLOSE	0x20	/* a pending close operation has ended */
+
+/* Socket flags. */
+#define SFL_SHUT_RD	0x01	/* socket has been shut down for reading */
+#define SFL_SHUT_WR	0x02	/* socket has been shut down for writing */
+#define SFL_CLOSING	0x04	/* socket close operation in progress */
+#define SFL_CLONED	0x08	/* socket has been cloned but not accepted */
+#define SFL_TIMER	0x10	/* socket is on list of timers */
+
+/*
+ * Special return value from sop_recv callback functions.  This pseudo-value
+ * is used to differentiate between zero-sized packets and actual EOF.
+ */
+#define SOCKEVENT_EOF	1
+
+struct sockevent_ops;
+struct sockevent_proc;
+
+/* Socket structure.  None of its fields must ever be accessed directly. */
+struct sock {
+	sockid_t sock_id;		/* socket identifier */
+	unsigned char sock_events;	/* pending events (SEV_) */
+	unsigned char sock_flags;	/* internal flags (SFL_) */
+	unsigned char sock_domain;	/* domain, address family (PF_, AF_) */
+	int sock_type;			/* type: stream, datagram.. (SOCK_) */
+	int sock_err;			/* pending error code < 0, 0 if none */
+	unsigned int sock_opt;		/* generic option flags (SO_) */
+	clock_t sock_linger;		/* SO_LINGER value, in ticks or time */
+	clock_t sock_stimeo;		/* SO_SNDTIMEO value, in clock ticks */
+	clock_t sock_rtimeo;		/* SO_RCVTIMEO value, in clock ticks */
+	size_t sock_slowat;		/* SO_SNDLOWAT value, in bytes */
+	size_t sock_rlowat;		/* SO_RCVLOWAT value, in bytes */
+	const struct sockevent_ops *sock_ops;	/* socket operations table */
+	SIMPLEQ_ENTRY(sock) sock_next;		/* list for pending events */
+	SLIST_ENTRY(sock) sock_hash;		/* list for hash table */
+	SLIST_ENTRY(sock) sock_timer;		/* list of socks with timers */
+	struct sockevent_proc *sock_proc;	/* list of suspended calls */
+	struct sockdriver_select sock_select;	/* pending select query */
+	unsigned int sock_selops;	/* pending select operations, or 0 */
+};
+
+/* Socket operations table. */
+struct sockevent_ops {
+	int (* sop_pair)(struct sock * sock1, struct sock * sock2,
+	    endpoint_t user_endpt);
+	int (* sop_bind)(struct sock * sock, const struct sockaddr * addr,
+	    socklen_t addr_len, endpoint_t user_endpt);
+	int (* sop_connect)(struct sock * sock, const struct sockaddr * addr,
+	    socklen_t addr_len, endpoint_t user_endpt);
+	int (* sop_listen)(struct sock * sock, int backlog);
+	sockid_t (* sop_accept)(struct sock * sock, struct sockaddr * addr,
+	    socklen_t * addr_len, endpoint_t user_endpt,
+	    struct sock ** newsockp);
+	int (* sop_test_accept)(struct sock * sock);
+	int (* sop_pre_send)(struct sock * sock, size_t len, socklen_t ctl_len,
+	    const struct sockaddr * addr, socklen_t addr_len,
+	    endpoint_t user_endpt, int flags);
+	int (* sop_send)(struct sock * sock,
+	    const struct sockdriver_data * data, size_t len, size_t * off,
+	    const struct sockdriver_data * ctl, socklen_t ctl_len,
+	    socklen_t * ctl_off, const struct sockaddr * addr,
+	    socklen_t addr_len, endpoint_t user_endpt, int flags, size_t min);
+	int (* sop_test_send)(struct sock * sock, size_t min);
+	int (* sop_pre_recv)(struct sock * sock, endpoint_t user_endpt,
+	    int flags);
+	int (* sop_recv)(struct sock * sock,
+	    const struct sockdriver_data * data, size_t len, size_t * off,
+	    const struct sockdriver_data * ctl, socklen_t ctl_len,
+	    socklen_t * ctl_off, struct sockaddr * addr, socklen_t * addr_len,
+	    endpoint_t user_endpt, int flags, size_t min, int * rflags);
+	int (* sop_test_recv)(struct sock * sock, size_t min, size_t * size);
+	int (* sop_ioctl)(struct sock * sock, unsigned long request,
+	    const struct sockdriver_data * data, endpoint_t user_endpt);
+	void (* sop_setsockmask)(struct sock * sock, unsigned int mask);
+	int (* sop_setsockopt)(struct sock * sock, int level, int name,
+	    const struct sockdriver_data * data, socklen_t len);
+	int (* sop_getsockopt)(struct sock * sock, int level, int name,
+	    const struct sockdriver_data * data, socklen_t * len);
+	int (* sop_getsockname)(struct sock * sock, struct sockaddr * addr,
+	    socklen_t * addr_len);
+	int (* sop_getpeername)(struct sock * sock, struct sockaddr * addr,
+	    socklen_t * addr_len);
+	int (* sop_shutdown)(struct sock * sock, unsigned int flags);
+	int (* sop_close)(struct sock * sock, int force);
+	void (* sop_free)(struct sock * sock);
+};
+
+typedef sockid_t (* sockevent_socket_cb_t)(int domain, int type, int protocol,
+	endpoint_t user_endpt, struct sock ** sock,
+	const struct sockevent_ops ** ops);
+
+void sockevent_init(sockevent_socket_cb_t socket_cb);
+void sockevent_process(const message * m_ptr, int ipc_status);
+
+void sockevent_clone(struct sock * sock, struct sock * newsock,
+	sockid_t newid);
+
+void sockevent_raise(struct sock * sock, unsigned int mask);
+void sockevent_set_error(struct sock * sock, int err);
+void sockevent_set_shutdown(struct sock * sock, unsigned int flags);
+
+#define sockevent_get_domain(sock)	((int)((sock)->sock_domain))
+#define sockevent_get_type(sock)	((sock)->sock_type)
+#define sockevent_get_opt(sock)		((sock)->sock_opt)
+#define sockevent_is_listening(sock)	(!!((sock)->sock_opt & SO_ACCEPTCONN))
+#define sockevent_is_shutdown(sock, mask)	((sock)->sock_flags & (mask))
+#define sockevent_is_closing(sock)	(!!((sock)->sock_flags & SFL_CLOSING))
+
+#endif /* !_MINIX_SOCKEVENT_H */

Property changes on: lab4/.minix-src/include/minix/sockevent.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/sysctl.h
===================================================================
--- lab4/.minix-src/include/minix/sysctl.h	(nonexistent)
+++ lab4/.minix-src/include/minix/sysctl.h	(revision 13)
@@ -0,0 +1,97 @@
+#ifndef _MINIX_SYSCTL_H
+#define _MINIX_SYSCTL_H
+
+/* MINIX3-specific sysctl(2) extensions. */
+
+#include <sys/sysctl.h>
+#include <minix/endpoint.h>
+
+/* Special values. */
+#define SYSCTL_NODE_FN	((sysctlfn)0x1)		/* node is function-driven */
+
+/*
+ * The top-level MINIX3 identifier is quite a bit beyond the last top-level
+ * identifier in use by NetBSD, because NetBSD may add more later, and we do
+ * not want conflicts: this definition is part of the MINIX3 ABI.
+ */
+#define CTL_MINIX	32
+
+#if CTL_MAXID > CTL_MINIX
+#error "CTL_MAXID has grown too large!"
+#endif
+
+/*
+ * The identifiers below follow the standard sysctl naming scheme, which means
+ * care should be taken not to introduce clashes with other definitions
+ * elsewhere.  On the upside, not many places need to include this header file.
+ */
+#define MINIX_TEST	0
+#define MINIX_MIB	1
+#define MINIX_PROC	2
+#define MINIX_LWIP	3
+
+/*
+ * These identifiers, under MINIX_TEST, are used by test87 to test the MIB
+ * service.
+ */
+#define TEST_INT	0
+#define TEST_BOOL	1
+#define TEST_QUAD	2
+#define TEST_STRING	3
+#define TEST_STRUCT	4
+#define TEST_PRIVATE	5
+#define TEST_ANYWRITE	6
+#define TEST_DYNAMIC	7
+#define TEST_SECRET	8
+#define TEST_PERM	9
+#define TEST_DESTROY1	10
+#define TEST_DESTROY2	11
+
+#define SECRET_VALUE	0
+
+/* Identifiers for subnodes of MINIX_MIB. */
+#define MIB_NODES	1
+#define MIB_OBJECTS	2
+#define MIB_REMOTES	3
+
+/* Identifiers for subnodes of MINIX_PROC. */
+#define PROC_LIST	1
+#define PROC_DATA	2
+
+/* Structure used for PROC_LIST.  Not part of the ABI.  Used by ProcFS only. */
+struct minix_proc_list {
+	uint32_t mpl_flags;		/* process flags (MPLF_) */
+	pid_t mpl_pid;			/* process PID */
+	uid_t mpl_uid;			/* effective user ID */
+	gid_t mpl_gid;			/* effective group ID */
+};
+#define MPLF_IN_USE	0x01		/* process slot is in use */
+#define MPLF_ZOMBIE	0x02		/* process is a zombie */
+
+/* Structure used for PROC_DATA.  Not part of the ABI.  Used by ProcFS only. */
+struct minix_proc_data {
+	endpoint_t mpd_endpoint;	/* process endpoint */
+	uint32_t mpd_flags;		/* procses flags (MPDF_) */
+	endpoint_t mpd_blocked_on;	/* blocked on other process, or NONE */
+	uint32_t mpd_priority;		/* current process priority */
+	uint32_t mpd_user_time;		/* user time, in clock ticks */
+	uint32_t mpd_sys_time;		/* system time, in clock ticks */
+	uint64_t mpd_cycles;		/* cycles spent by the process */
+	uint64_t mpd_kipc_cycles;	/* cycles spent on kernel IPC */
+	uint64_t mpd_kcall_cycles;	/* cycles spent on kernel calls */
+	uint32_t mpd_nice;		/* nice value */
+	char mpd_name[16];		/* short process name */
+};
+#define MPDF_SYSTEM	0x01		/* process is a system service */
+#define MPDF_ZOMBIE	0x02		/* process is a zombie */
+#define MPDF_RUNNABLE	0x04		/* process is runnable */
+#define MPDF_STOPPED	0x08		/* process is stopped */
+
+/*
+ * Expose sysctl(2) to system services (ProcFS in particular), so as to avoid
+ * including the CTL_USER subtree handling of sysctl(3) as well.
+ */
+int __sysctl(const int *, unsigned int, void *, size_t *, const void *,
+	size_t);
+
+#endif /* !_MINIX_SYSCTL_H */

Property changes on: lab4/.minix-src/include/minix/sysctl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/timers.h
===================================================================
--- lab4/.minix-src/include/minix/timers.h	(nonexistent)
+++ lab4/.minix-src/include/minix/timers.h	(revision 13)
@@ -0,0 +1,128 @@
+/* This library provides generic watchdog timer management functionality.
+ * The functions operate on a timer queue provided by the caller. Note that
+ * the timers must use absolute time to allow sorting. The library provides:
+ *
+ *    tmrs_settimer:     (re)set a new watchdog timer in the timers queue
+ *    tmrs_clrtimer:     remove a timer from both the timers queue
+ *    tmrs_exptimers:    check for expired timers and run watchdog functions
+ *
+ * Author:
+ *    Jorrit N. Herder <jnherder@cs.vu.nl>
+ *    Adapted from tmr_settimer and tmr_clrtimer in src/kernel/clock.c.
+ *    Last modified: September 30, 2004.
+ */
+#ifndef _MINIX_TIMERS_H
+#define _MINIX_TIMERS_H
+
+#include <limits.h>
+
+#include <sys/types.h>
+#include <minix/const.h>
+#include <minix/u64.h>
+#include <minix/minlib.h>
+#include <minix/endpoint.h>
+
+typedef void (*tmr_func_t)(int arg);
+
+/* A minix_timer_t variable must be declare for each distinct timer to be used.
+ * The timers watchdog function and expiration time are automatically set
+ * by the library function tmrs_settimer, but its argument is not.  In general,
+ * the timer is in use when it has a callback function.
+ */
+typedef struct minix_timer
+{
+  struct minix_timer	*tmr_next;	/* next in a timer chain */
+  clock_t 		tmr_exp_time;	/* expiration time (absolute) */
+  tmr_func_t		tmr_func;	/* function to call when expired */
+  int			tmr_arg;	/* integer argument */
+} minix_timer_t;
+
+/*
+ * Clock times may wrap.  Thus, we must only ever compare relative times, which
+ * means they must be no more than half the total maximum time value apart.
+ * The clock_t type is unsigned (int or long), thus we take half that.
+ */
+#define TMRDIFF_MAX		(INT_MAX)
+
+/* This value must be used only instead of a timer difference value. */
+#define TMR_NEVER		((clock_t)TMRDIFF_MAX + 1)
+
+/* These definitions can be used to set or get data from a timer variable. */
+#define tmr_exp_time(tp)	((tp)->tmr_exp_time)
+#define tmr_is_set(tp)		((tp)->tmr_func != NULL)
+/*
+ * tmr_is_first() returns TRUE iff the first given absolute time is sooner than
+ * or equal to the second given time.
+ */
+#define tmr_is_first(a,b)	((clock_t)(b) - (clock_t)(a) <= TMRDIFF_MAX)
+#define tmr_has_expired(tp,now)	tmr_is_first((tp)->tmr_exp_time, (now))
+
+/* Timers should be initialized once before they are being used. Be careful
+ * not to reinitialize a timer that is in a list of timers, or the chain
+ * will be broken.
+ */
+#define tmr_inittimer(tp) (void)((tp)->tmr_func = NULL, (tp)->tmr_next = NULL)
+
+/* The following generic timer management functions are available. They
+ * can be used to operate on the lists of timers. Adding a timer to a list
+ * automatically takes care of removing it.
+ */
+int tmrs_settimer(minix_timer_t **tmrs, minix_timer_t *tp, clock_t exp_time,
+	tmr_func_t watchdog, int arg, clock_t *old_head, clock_t *new_head);
+int tmrs_clrtimer(minix_timer_t **tmrs, minix_timer_t *tp, clock_t *old_head,
+	clock_t *new_head);
+int tmrs_exptimers(minix_timer_t **tmrs, clock_t now, clock_t *new_head);
+
+#define PRINT_STATS(cum_spenttime, cum_instances) {		\
+		if(ex64hi(cum_spenttime)) { util_stacktrace(); printf(" ( ??? %lu %lu)\n",	\
+			ex64hi(cum_spenttime), ex64lo(cum_spenttime)); } \
+		printf("%s:%d,%lu,%lu\n", \
+			__FILE__, __LINE__, cum_instances,	\
+			 ex64lo(cum_spenttime)); \
+	}
+
+#define RESET_STATS(starttime, cum_instances, cum_spenttime, cum_starttime) { \
+		cum_instances = 0;				\
+		cum_starttime = starttime;			\
+		cum_spenttime = make64(0,0);			\
+}
+
+#define TIME_BLOCK_VAR(timed_code_block, time_interval) do {	\
+	static u64_t _cum_spenttime, _cum_starttime;		\
+	static int _cum_instances;				\
+	u64_t _next_cum_spent, _starttime, _endtime, _dt, _cum_dt;	\
+	u32_t _dt_micros;					\
+	read_tsc_64(&_starttime);				\
+	do { timed_code_block } while(0);			\
+	read_tsc_64(&_endtime);					\
+	_dt = _endtime - _starttime;				\
+	if(_cum_instances == 0) {				\
+		RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
+	 }							\
+	_next_cum_spent = add64(_cum_spenttime, _dt);		\
+	if(ex64hi(_next_cum_spent)) { 				\
+		PRINT_STATS(_cum_spenttime, _cum_instances);	\
+		RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
+	} 							\
+	_cum_spenttime = add64(_cum_spenttime, _dt);		\
+	_cum_instances++;					\
+	_cum_dt = _endtime - _cum_starttime;			\
+	if(_cum_dt > make64(0, 120)) {				\
+		PRINT_STATS(_cum_spenttime, _cum_instances);	\
+		RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); 	\
+	} 							\
+} while(0)
+
+#define TIME_BLOCK(timed_code_block) TIME_BLOCK_VAR(timed_code_block, 100)
+#define TIME_BLOCK_T(timed_code_block, t) TIME_BLOCK_VAR(timed_code_block, t)
+
+/* Timers abstraction for system processes. This would be in minix/sysutil.h
+ * if it weren't for naming conflicts.
+ */
+
+void init_timer(minix_timer_t *tp);
+void set_timer(minix_timer_t *tp, clock_t ticks, tmr_func_t watchdog, int arg);
+void cancel_timer(minix_timer_t *tp);
+void expire_timers(clock_t now);
+
+#endif /* _MINIX_TIMERS_H */

Property changes on: lab4/.minix-src/include/minix/timers.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/usb_ch9.h
===================================================================
--- lab4/.minix-src/include/minix/usb_ch9.h	(nonexistent)
+++ lab4/.minix-src/include/minix/usb_ch9.h	(revision 13)
@@ -0,0 +1,217 @@
+#ifndef MINIX_USB_CH9_H
+#define MINIX_USB_CH9_H
+/*
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lennart@augustsson.net) at
+ * Carlstedt Research & Technology.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/* USB DESCRIPTORS */
+/*
+ * The USB records contain some unaligned little-endian word
+ * components.  The U[SG]ETW macros take care of both the alignment
+ * and endian problem and should always be used to access non-byte
+ * values.
+ */
+
+#include <sys/types.h>
+
+typedef u8_t uByte;
+typedef u8_t uWord[2];
+typedef u8_t uDWord[4];
+
+#define USETW2(w,h,l) ((w)[0] = (u_int8_t)(l), (w)[1] = (u_int8_t)(h))
+
+#if 1
+#define UGETW(w) ((w)[0] | ((w)[1] << 8))
+#define USETW(w,v) ((w)[0] = (u_int8_t)(v), (w)[1] = (u_int8_t)((v) >> 8))
+#define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24))
+#define USETDW(w,v) ((w)[0] = (u_int8_t)(v), \
+		     (w)[1] = (u_int8_t)((v) >> 8), \
+		     (w)[2] = (u_int8_t)((v) >> 16), \
+		     (w)[3] = (u_int8_t)((v) >> 24))
+#else
+/*
+ * On little-endian machines that can handle unanliged accesses
+ * (e.g. i386) these macros can be replaced by the following.
+ */
+#define UGETW(w) (*(u_int16_t *)(w))
+#define USETW(w,v) (*(u_int16_t *)(w) = (v))
+#define UGETDW(w) (*(u_int32_t *)(w))
+#define USETDW(w,v) (*(u_int32_t *)(w) = (v))
+#endif
+
+#define UPACKED __attribute__((__packed__))
+
+/* Requests */
+#define	UR_GET_STATUS		0x00
+#define	UR_CLEAR_FEATURE	0x01
+#define	UR_SET_FEATURE		0x03
+#define	UR_SET_ADDRESS		0x05
+#define	UR_GET_DESCRIPTOR	0x06
+#define	UDESC_DEVICE		0x01
+#define	UDESC_CONFIG		0x02
+#define	UDESC_STRING		0x03
+#define	USB_LANGUAGE_TABLE	0x00	/* language ID string index */
+#define	UDESC_INTERFACE		0x04
+#define	UDESC_ENDPOINT		0x05
+#define	UDESC_DEVICE_QUALIFIER	0x06
+#define	UDESC_OTHER_SPEED_CONFIGURATION 0x07
+#define	UDESC_INTERFACE_POWER	0x08
+#define	UDESC_OTG		0x09
+#define	UDESC_DEBUG		0x0A
+#define	UDESC_IFACE_ASSOC	0x0B	/* interface association */
+#define	UDESC_BOS		0x0F	/* binary object store */
+#define	UDESC_DEVICE_CAPABILITY	0x10
+#define	UDESC_CS_DEVICE		0x21	/* class specific */
+#define	UDESC_CS_CONFIG		0x22
+#define	UDESC_CS_STRING		0x23
+#define	UDESC_CS_INTERFACE	0x24
+#define	UDESC_CS_ENDPOINT	0x25
+#define	UDESC_HUB		0x29
+#define	UDESC_ENDPOINT_SS_COMP	0x30	/* super speed */
+#define	UR_SET_DESCRIPTOR	0x07
+#define	UR_GET_CONFIG		0x08
+#define	UR_SET_CONFIG		0x09
+#define	UR_GET_INTERFACE	0x0a
+#define	UR_SET_INTERFACE	0x0b
+#define	UR_SYNCH_FRAME		0x0c
+#define	UR_SET_SEL		0x30
+#define	UR_ISOCH_DELAY		0x31
+
+
+
+typedef struct {
+	uByte		bLength;
+	uByte		bDescriptorType;
+	uByte		bDescriptorSubtype;
+} UPACKED usb_descriptor_t;
+
+
+typedef struct {
+	uByte		bLength;
+	uByte		bDescriptorType;
+	uWord		bcdUSB;
+#define UD_USB_2_0		0x0200
+#define UD_IS_USB2(d) (UGETW((d)->bcdUSB) >= UD_USB_2_0)
+	uByte		bDeviceClass;
+	uByte		bDeviceSubClass;
+	uByte		bDeviceProtocol;
+	uByte		bMaxPacketSize;
+	/* The fields below are not part of the initial descriptor. */
+	uWord		idVendor;
+	uWord		idProduct;
+	uWord		bcdDevice;
+	uByte		iManufacturer;
+	uByte		iProduct;
+	uByte		iSerialNumber;
+	uByte		bNumConfigurations;
+} UPACKED usb_device_descriptor_t;
+#define USB_DEVICE_DESCRIPTOR_SIZE 18
+
+typedef struct {
+	uByte		bLength;
+	uByte		bDescriptorType;
+	uWord		wTotalLength;
+	uByte		bNumInterface;
+	uByte		bConfigurationValue;
+	uByte		iConfiguration;
+	uByte		bmAttributes;
+#define UC_BUS_POWERED		0x80
+#define UC_SELF_POWERED		0x40
+#define UC_REMOTE_WAKEUP	0x20
+	uByte		bMaxPower; /* max current in 2 mA units */
+#define UC_POWER_FACTOR 2
+} UPACKED usb_config_descriptor_t;
+#define USB_CONFIG_DESCRIPTOR_SIZE 9
+
+typedef struct {
+	uByte		bLength;
+	uByte		bDescriptorType;
+	uByte		bInterfaceNumber;
+	uByte		bAlternateSetting;
+	uByte		bNumEndpoints;
+	uByte		bInterfaceClass;
+	uByte		bInterfaceSubClass;
+	uByte		bInterfaceProtocol;
+	uByte		iInterface;
+} UPACKED usb_interface_descriptor_t;
+#define USB_INTERFACE_DESCRIPTOR_SIZE 9
+
+typedef struct {
+	uByte		bLength;
+	uByte		bDescriptorType;
+	uByte		bEndpointAddress;
+#define UE_GET_DIR(a)	((a) & 0x80)
+#define UE_SET_DIR(a,d)	((a) | (((d)&1) << 7))
+#define UE_DIR_IN	0x80
+#define UE_DIR_OUT	0x00
+#define UE_ADDR		0x0f
+#define UE_GET_ADDR(a)	((a) & UE_ADDR)
+	uByte		bmAttributes;
+#define UE_XFERTYPE	0x03
+#define  UE_CONTROL	0x00
+#define  UE_ISOCHRONOUS	0x01
+#define  UE_BULK	0x02
+#define  UE_INTERRUPT	0x03
+#define UE_GET_XFERTYPE(a)	((a) & UE_XFERTYPE)
+#define UE_ISO_TYPE	0x0c
+#define  UE_ISO_ASYNC	0x04
+#define  UE_ISO_ADAPT	0x08
+#define  UE_ISO_SYNC	0x0c
+#define UE_GET_ISO_TYPE(a)	((a) & UE_ISO_TYPE)
+	uWord		wMaxPacketSize;
+	uByte		bInterval;
+} UPACKED usb_endpoint_descriptor_t;
+#define USB_ENDPOINT_DESCRIPTOR_SIZE 7
+
+typedef struct {
+	uByte		bLength;
+	uByte		bDescriptorType;
+	uWord		bString[127];
+} UPACKED usb_string_descriptor_t;
+
+#define USB_MAX_STRING_LEN 128
+#define USB_MAX_ENCODED_STRING_LEN (USB_MAX_STRING_LEN * 3) /* UTF8 */
+
+struct usb_device_request {
+	uByte	bmRequestType;
+	uByte	bRequest;
+	uWord	wValue;
+	uWord	wIndex;
+	uWord	wLength;
+} UPACKED;
+typedef struct usb_device_request usb_device_request_t;
+
+
+#endif

Property changes on: lab4/.minix-src/include/minix/usb_ch9.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/vboxif.h
===================================================================
--- lab4/.minix-src/include/minix/vboxif.h	(nonexistent)
+++ lab4/.minix-src/include/minix/vboxif.h	(revision 13)
@@ -0,0 +1,33 @@
+#ifndef _MINIX_VBOXIF_H
+#define _MINIX_VBOXIF_H
+
+/*===========================================================================*
+ *			Messages for VBOX device			     *
+ *===========================================================================*/
+
+/* Base type for VBOX requests and responses. */
+#define VBOX_RQ_BASE	0x1600
+#define VBOX_RS_BASE	0x1680
+
+#define IS_VBOX_RQ(type) (((type) & ~0x7f) == VBOX_RQ_BASE)
+#define IS_VBOX_RS(type) (((type) & ~0x7f) == VBOX_RS_BASE)
+
+/* Message types for VBOX requests. */
+#define VBOX_OPEN	(VBOX_RQ_BASE + 0)	/* open a connection */
+#define VBOX_CLOSE	(VBOX_RQ_BASE + 1)	/* close a connection */
+#define VBOX_CALL	(VBOX_RQ_BASE + 2)	/* perform a call */
+#define VBOX_CANCEL	(VBOX_RQ_BASE + 3)	/* cancel an ongoing call */
+
+/* Message types for VBOX responses. */
+#define VBOX_REPLY	(VBOX_RS_BASE + 0)	/* general reply code */
+
+/* Field names for VBOX messages. */
+#define VBOX_CONN	m2_i1	/* connection identifier */
+#define VBOX_GRANT	m2_i2	/* grant ID of buffer or name */
+#define VBOX_COUNT	m2_i3	/* number of bytes or elements */
+#define VBOX_RESULT	m2_i1	/* result or error code */
+#define VBOX_CODE	m2_i2	/* VirtualBox result code */
+#define VBOX_FUNCTION	m2_l1	/* function call number */
+#define VBOX_ID		m2_l2	/* opaque request ID */
+
+#endif /* _MINIX_VBOXIF_H */

Property changes on: lab4/.minix-src/include/minix/vboxif.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/if_ether.h
===================================================================
--- lab4/.minix-src/include/net/gen/if_ether.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/if_ether.h	(revision 13)
@@ -0,0 +1 @@
+#include <net/if_ether.h>

Property changes on: lab4/.minix-src/include/net/gen/if_ether.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/ip_io.h
===================================================================
--- lab4/.minix-src/include/net/gen/ip_io.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/ip_io.h	(revision 13)
@@ -0,0 +1,68 @@
+/*
+server/ip/gen/ip_io.h
+*/
+
+#ifndef __SERVER__IP__GEN__IP_IO_H__
+#define __SERVER__IP__GEN__IP_IO_H__
+
+typedef struct nwio_ipconf2
+{
+	u32_t	nwic_flags;
+	ipaddr_t nwic_ipaddr;
+	ipaddr_t nwic_netmask;
+} nwio_ipconf2_t;
+
+typedef struct nwio_ipconf
+{
+	u32_t	nwic_flags;
+	ipaddr_t nwic_ipaddr;
+	ipaddr_t nwic_netmask;
+	u16_t nwic_mtu;
+} nwio_ipconf_t;
+
+#define NWIC_NOFLAGS		0x0
+#define NWIC_FLAGS		0x7
+#	define NWIC_IPADDR_SET		0x1
+#	define NWIC_NETMASK_SET		0x2
+#	define NWIC_MTU_SET		0x4
+
+typedef struct nwio_ipopt
+{
+	u32_t nwio_flags;
+	ipaddr_t nwio_rem;
+	ip_hdropt_t nwio_hdropt;
+	u8_t nwio_tos;
+	u8_t nwio_ttl;
+	u8_t nwio_df;
+	ipproto_t nwio_proto;
+} nwio_ipopt_t;
+
+#define NWIO_NOFLAGS	0x0000l
+#define NWIO_ACC_MASK	0x0003l
+#	define NWIO_EXCL	0x00000001l
+#	define NWIO_SHARED	0x00000002l
+#	define NWIO_COPY	0x00000003l
+#define NWIO_LOC_MASK	0x0010l
+#	define NWIO_EN_LOC	0x00000010l
+#	define NWIO_DI_LOC	0x00100000l
+#define NWIO_BROAD_MASK	0x0020l
+#	define NWIO_EN_BROAD	0x00000020l
+#	define NWIO_DI_BROAD	0x00200000l
+#define NWIO_REM_MASK	0x0100l
+#	define NWIO_REMSPEC	0x00000100l
+#	define NWIO_REMANY	0x01000000l
+#define NWIO_PROTO_MASK	0x0200l
+#	define NWIO_PROTOSPEC	0x00000200l
+#	define NWIO_PROTOANY	0x02000000l
+#define NWIO_HDR_O_MASK	0x0400l
+#	define NWIO_HDR_O_SPEC	0x00000400l
+#	define NWIO_HDR_O_ANY	0x04000000l
+#define NWIO_RW_MASK	0x1000l
+#	define NWIO_RWDATONLY	0x00001000l
+#	define NWIO_RWDATALL	0x10000000l
+
+#endif /* __SERVER__IP__GEN__IP_IO_H__ */
+
+/*
+ * $PchId: ip_io.h,v 1.5 2001/03/12 22:17:25 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/ip_io.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/rs.h
===================================================================
--- lab4/.minix-src/include/minix/rs.h	(nonexistent)
+++ lab4/.minix-src/include/minix/rs.h	(revision 13)
@@ -0,0 +1,210 @@
+#ifndef RS_H
+#define RS_H
+
+/*
+minix/rs.h
+
+Interface to the reincarnation server
+*/
+
+#include <minix/bitmap.h>
+#include <minix/com.h>
+#include <minix/ipc_filter.h>
+
+#define SERVICE_LOGIN	"service"	/* passwd file entry for services */
+
+/* The following definition should be kept in sync with the actual
+ * /etc/master.passwd value for SERVICE_LOGIN for now, and removed altogether
+ * once we are able to obtain its value dynamically everywhere.  The value has
+ * been chosen so as to avoid creating conflicts with future NetBSD additions
+ * to the password files, although one can never be sure.
+ */
+#define SERVICE_UID		999		/* user ID for services */
+
+/* RSS definitions. */
+#define RSS_NR_IRQ		16
+#define RSS_NR_IO		16
+#define RSS_IRQ_ALL		(RSS_NR_IRQ+1)
+#define RSS_IO_ALL		(RSS_NR_IO+1)
+#define RSS_IPC_ALL		"IPC_ALL"
+#define RSS_IPC_ALL_SYS		"IPC_ALL_SYS"
+
+/* RSS flags. */
+#define RSS_COPY	0x01	/* keep an in-memory copy of the binary */
+#define RSS_REUSE	0x04	/* Try to reuse previously copied binary */
+#define RSS_NOBLOCK	0x08	/* unblock caller immediately */
+#define RSS_REPLICA	0x10	/* keep a replica of the service */
+#define RSS_BATCH	0x20	/* batch mode */
+#define RSS_SELF_LU	0x40	/* perform self update */
+#define RSS_ASR_LU	0x80	/* perform ASR update */
+#define RSS_FORCE_SELF_LU	0x0100	/* force self update */
+#define RSS_PREPARE_ONLY_LU	0x0200	/* request prepare-only update */
+#define RSS_FORCE_INIT_CRASH    0x0400  /* force crash at initialization time (for debugging) */
+#define RSS_FORCE_INIT_FAIL     0x0800  /* force failure at initialization time (for debugging) */
+#define RSS_FORCE_INIT_TIMEOUT  0x1000  /* force timeout at initialization time (for debugging) */
+#define RSS_FORCE_INIT_DEFCB    0x2000  /* force default cb at initialization time (for debugging) */
+#define RSS_SYS_BASIC_CALLS	0x4000	/* include basic kernel calls */
+#define RSS_VM_BASIC_CALLS	0x8000	/* include basic vm calls */
+#define RSS_NOMMAP_LU          0x10000  /* don't inherit mmapped regions */
+#define RSS_DETACH             0x20000  /* detach on update/restart */
+#define RSS_NORESTART          0x40000  /* don't restart */
+#define RSS_FORCE_INIT_ST      0x80000  /* force state transfer at initialization time */
+#define RSS_NO_BIN_EXP        0x100000  /* suppress binary exponential offset */
+
+/* Common definitions. */
+#define RS_NR_CONTROL		 8
+#define RS_NR_PCI_DEVICE	32
+#define RS_NR_PCI_CLASS		 4
+#define RS_MAX_LABEL_LEN	16
+#define RS_MAX_IPCF_STR_LEN	 (RS_MAX_LABEL_LEN+12)
+#define RS_MAX_IPC_FILTERS	 4
+
+/* CPU special values */
+#define RS_CPU_DEFAULT		-1 /* use the default cpu or do not change the current one */
+#define RS_CPU_BSP		-2 /* use the bootstrap cpu */
+
+/* Labels are copied over separately. */
+struct rss_label
+{
+	char *l_addr;
+	size_t l_len;
+};
+
+struct rs_pci_id {
+	u16_t vid;
+	u16_t did;
+	u16_t sub_vid;
+	u16_t sub_did;
+};
+#define NO_SUB_VID	0xffff
+#define NO_SUB_DID	0xffff
+
+struct rs_pci_class {
+	u32_t pciclass;
+	u32_t mask;
+};
+
+/* State-related data. */
+struct rs_ipc_filter_el {
+	int flags;
+	char m_label[RS_MAX_LABEL_LEN];
+	int m_type;
+};
+struct rs_state_data {
+	size_t size;
+	void *ipcf_els;
+	size_t ipcf_els_size;
+	int ipcf_els_gid;
+	void *eval_addr;
+	size_t eval_len;
+	int eval_gid;
+};
+
+/* Arguments needed to start a new driver or server */
+struct rs_start
+{
+	unsigned rss_flags;
+	char *rss_cmd;
+	size_t rss_cmdlen;
+	uid_t rss_uid;
+	endpoint_t rss_sigmgr;
+	endpoint_t rss_scheduler;
+	int rss_priority;
+	int rss_quantum;
+	int rss_major;
+	long rss_period;
+	char *rss_script;
+	size_t rss_scriptlen;
+	long rss_asr_count;
+	long rss_restarts;
+	long rss_heap_prealloc_bytes;
+	long rss_map_prealloc_bytes;
+	int rss_nr_irq;
+	int rss_irq[RSS_NR_IRQ];
+	int rss_nr_io;
+	struct { unsigned base; unsigned len; } rss_io[RSS_NR_IO];
+	int rss_nr_pci_id;
+	struct rs_pci_id rss_pci_id[RS_NR_PCI_DEVICE];
+	int rss_nr_pci_class;
+	struct rs_pci_class rss_pci_class[RS_NR_PCI_CLASS];
+	bitchunk_t rss_system[SYS_CALL_MASK_SIZE];
+	struct rss_label rss_label;
+	struct rss_label rss_trg_label;
+	char *rss_ipc;
+	size_t rss_ipclen;
+	bitchunk_t rss_vm[VM_CALL_MASK_SIZE];
+	int rss_nr_control;
+	struct rss_label rss_control[RS_NR_CONTROL];
+	struct rs_state_data rss_state_data;
+	int devman_id;
+	char *rss_progname;
+	size_t rss_prognamelen;
+	int rss_nr_domain;
+	int rss_domain[NR_DOMAIN];
+	/*
+	 * SMP specific data
+	 *
+	 * must be at the end of the structure for binary compatibility with
+	 * non-smp sysytems
+	 */
+	int rss_cpu;
+};
+
+/* ACL information for access to PCI devices */
+struct rs_pci
+{
+	char rsp_label[RS_MAX_LABEL_LEN];
+	int rsp_endpoint;
+	int rsp_nr_device;
+	struct rs_pci_id rsp_device[RS_NR_PCI_DEVICE];
+	int rsp_nr_class;
+	struct rs_pci_class rsp_class[RS_NR_PCI_CLASS];
+};
+
+/* Definition of a public entry of the system process table. */
+struct rprocpub {
+  short in_use; 		  /* set when the entry is in use */
+  unsigned sys_flags; 		  /* sys flags */
+  endpoint_t endpoint;		  /* process endpoint number */
+  endpoint_t old_endpoint;	  /* old instance endpoint number (for VM, when updating) */
+  endpoint_t new_endpoint;	  /* new instance endpoint number (for VM, when updating) */
+
+  devmajor_t dev_nr;		  /* major device number or NO_DEV */
+  int nr_domain;		  /* number of socket driver domains */
+  int domain[NR_DOMAIN];	  /* set of socket driver domains */
+
+  char label[RS_MAX_LABEL_LEN];	  /* label of this service */
+  char proc_name[RS_MAX_LABEL_LEN]; /* process name of this service */
+
+  bitchunk_t vm_call_mask[VM_CALL_MASK_SIZE]; /* vm call mask */
+
+  struct rs_pci pci_acl;	  /* pci acl */
+  int devman_id;
+};
+
+/* Return whether the given boot process is a user process, as opposed to a
+ * system process. Only usable by core services during SEF initialization.
+ */
+#define IS_RPUB_BOOT_USR(rpub) ((rpub)->endpoint == INIT_PROC_NR)
+
+/* Sys flag values. */
+#define SF_CORE_SRV     0x001    /* set for core system services */
+#define SF_SYNCH_BOOT   0X002    /* set when process needs synch boot init */
+#define SF_NEED_COPY    0x004    /* set when process needs copy to start */
+#define SF_USE_COPY     0x008    /* set when process has a copy in memory */
+#define SF_NEED_REPL    0x010    /* set when process needs replica to start */
+#define SF_USE_REPL     0x020    /* set when process has a replica */
+#define SF_VM_UPDATE    0x040    /* set when process needs vm update */
+#define SF_VM_ROLLBACK  0x080    /* set when vm update is a rollback */
+#define SF_VM_NOMMAP    0x100    /* set when vm update ignores mmapped regions */
+#define SF_USE_SCRIPT   0x200    /* set when process has restart script */
+#define SF_DET_RESTART  0x400    /* set when process detaches on restart */
+#define SF_NORESTART    0x800    /* set when process should not be restarted */
+#define SF_NO_BIN_EXP  0x1000    /* set when we should ignore binary exp. offset */
+
+#define IMM_SF          \
+    (SF_NO_BIN_EXP | SF_CORE_SRV | SF_SYNCH_BOOT | SF_NEED_COPY | SF_NEED_REPL) /* immutable */
+
+int minix_rs_lookup(const char *name, endpoint_t *value);
+
+#endif

Property changes on: lab4/.minix-src/include/minix/rs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/sffs.h
===================================================================
--- lab4/.minix-src/include/minix/sffs.h	(nonexistent)
+++ lab4/.minix-src/include/minix/sffs.h	(revision 13)
@@ -0,0 +1,69 @@
+/* Part of libsffs - (c) 2012, D.C. van Moolenbroek */
+
+#ifndef _MINIX_SFFS_H
+#define _MINIX_SFFS_H
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <minix/u64.h>
+
+typedef void *sffs_file_t;		/* handle to open file */
+typedef void *sffs_dir_t;		/* handle to directory search */
+
+struct sffs_attr {
+  u32_t a_mask;				/* which fields to retrieve/set */
+  mode_t a_mode;			/* file type and permissions */
+  u64_t a_size;				/* file size */
+  struct timespec a_crtime;		/* file creation time */
+  struct timespec a_atime;		/* file access time */
+  struct timespec a_mtime;		/* file modification time */
+  struct timespec a_ctime;		/* file change time */
+};
+
+#define SFFS_ATTR_SIZE		0x01	/* get/set file size */
+#define SFFS_ATTR_CRTIME	0x02	/* get/set file creation time */
+#define SFFS_ATTR_ATIME		0x04	/* get/set file access time */
+#define SFFS_ATTR_MTIME		0x08	/* get/set file modification time */
+#define SFFS_ATTR_CTIME		0x10	/* get/set file change time */
+#define SFFS_ATTR_MODE		0x20	/* get/set file mode */
+
+struct sffs_table {
+  int (*t_open)(const char *path, int flags, int mode, sffs_file_t *handle);
+  ssize_t (*t_read)(sffs_file_t handle, char *buf, size_t size, u64_t pos);
+  ssize_t (*t_write)(sffs_file_t handle, char *buf, size_t size, u64_t pos);
+  int (*t_close)(sffs_file_t handle);
+
+  size_t (*t_readbuf)(char **ptr);
+  size_t (*t_writebuf)(char **ptr);
+
+  int (*t_opendir)(const char *path, sffs_dir_t *handle);
+  int (*t_readdir)(sffs_dir_t handle, unsigned int index, char *buf,
+	size_t size, struct sffs_attr *attr);
+  int (*t_closedir)(sffs_dir_t handle);
+
+  int (*t_getattr)(const char *path, struct sffs_attr *attr);
+  int (*t_setattr)(const char *path, struct sffs_attr *attr);
+
+  int (*t_mkdir)(const char *path, int mode);
+  int (*t_unlink)(const char *path);
+  int (*t_rmdir)(const char *path);
+  int (*t_rename)(const char *opath, const char *npath);
+
+  int (*t_queryvol)(const char *path, u64_t *free, u64_t *total);
+};
+
+struct sffs_params {
+  char p_prefix[PATH_MAX];	/* prefix for all paths used */
+  uid_t p_uid;			/* UID that owns all files */
+  gid_t p_gid;			/* GID that owns all files */
+  unsigned int p_file_mask;	/* AND-mask to apply to file permissions */
+  unsigned int p_dir_mask;	/* AND-mask to apply to directory perms */
+  int p_case_insens;		/* case insensitivity flag */
+};
+
+int sffs_init(char *name, const struct sffs_table *table,
+  struct sffs_params *params);
+void sffs_signal(int signo);
+void sffs_loop(void);
+
+#endif /* _MINIX_SFFS_H */

Property changes on: lab4/.minix-src/include/minix/sffs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/spin.h
===================================================================
--- lab4/.minix-src/include/minix/spin.h	(nonexistent)
+++ lab4/.minix-src/include/minix/spin.h	(revision 13)
@@ -0,0 +1,38 @@
+/* Prototypes for condition spinning helper functions (part of libsys). */
+#ifndef _MINIX_SPIN_H
+#define _MINIX_SPIN_H
+
+/* Opaque spin state structure. */
+typedef struct {
+	int s_state;
+	u32_t s_usecs;
+	u64_t s_base_tsc;
+	clock_t s_base_uptime;
+	int s_timeout;
+} spin_t;
+
+/* Functions. */
+void spin_init(spin_t *s, u32_t usecs);
+int spin_check(spin_t *s);
+
+/* Macros. */
+
+/* Execute a loop for at least 'u' microseconds, using spin object 's'.
+ * The body of the loop is guaranteed to be executed at least once.
+ */
+#define SPIN_FOR(s,u)							\
+	for (spin_init((s), (u)); spin_check((s)); )
+
+/* Return whether spin object 's' timed out after a loop. */
+#define SPIN_TIMEOUT(s) ((s)->s_timeout)
+
+/* Spin until the given condition becomes true, or 'u' microseconds expired.
+ * The condition is guaranteed to be checked at least once.
+ */
+#define SPIN_UNTIL(c,u) do {						\
+	spin_t s;							\
+	SPIN_FOR(&s,(u))						\
+		if (c) break;						\
+} while (0)
+
+#endif /* _MINIX_SPIN_H */

Property changes on: lab4/.minix-src/include/minix/spin.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/syslib.h
===================================================================
--- lab4/.minix-src/include/minix/syslib.h	(nonexistent)
+++ lab4/.minix-src/include/minix/syslib.h	(revision 13)
@@ -0,0 +1,299 @@
+/* Prototypes for system library functions. */
+
+#ifndef _SYSLIB_H
+#define _SYSLIB_H
+
+#include <sys/types.h>
+#include <sys/sigtypes.h>
+
+#include <minix/ipc.h>
+#include <minix/u64.h>
+#include <minix/devio.h>
+
+#include <minix/safecopies.h>
+#include <minix/sef.h>
+#include <machine/mcontext.h>
+
+/* Forward declaration */
+struct rs_pci;
+struct rusage;
+struct sockcred;
+struct reg86;
+
+#define SYSTASK SYSTEM
+
+/*==========================================================================* 
+ * Minix system library. 						    *
+ *==========================================================================*/ 
+int _taskcall(endpoint_t who, int syscallnr, message *msgptr);
+int _kernel_call(int syscallnr, message *msgptr);
+
+int sys_abort(int how);
+int sys_enable_iop(endpoint_t proc_ep);
+int sys_int86(struct reg86 *reg86p);
+int sys_exec(endpoint_t proc_ep, vir_bytes stack_ptr, vir_bytes progname,
+	vir_bytes pc, vir_bytes ps_str);
+int sys_fork(endpoint_t parent, endpoint_t child, endpoint_t *, 
+	u32_t vm, vir_bytes *);
+int sys_clear(endpoint_t proc_ep);
+int sys_exit(void);
+int sys_trace(int req, endpoint_t proc_ep, long addr, long *data_p);
+
+int sys_schedule(endpoint_t proc_ep, int priority, int quantum, int cpu,
+	int niced);
+int sys_schedctl(unsigned flags, endpoint_t proc_ep, int priority, int
+	quantum, int cpu);
+
+/* Shorthands for sys_runctl() system call. */
+#define sys_stop(proc_ep) sys_runctl(proc_ep, RC_STOP, 0)
+#define sys_delay_stop(proc_ep) sys_runctl(proc_ep, RC_STOP, RC_DELAY)
+#define sys_resume(proc_ep) sys_runctl(proc_ep, RC_RESUME, 0)
+int sys_runctl(endpoint_t proc_ep, int action, int flags);
+
+int sys_update(endpoint_t src_ep, endpoint_t dst_ep, int flags);
+int sys_statectl(int request, void* address, int length);
+int sys_privctl(endpoint_t proc_ep, int req, void *p);
+int sys_privquery_mem(endpoint_t proc_ep, phys_bytes physstart,
+	phys_bytes physlen);
+int sys_setgrant(cp_grant_t *grants, int ngrants);
+
+int sys_vm_setbuf(phys_bytes base, phys_bytes size, phys_bytes high);
+int sys_vm_map(endpoint_t proc_ep, int do_map, phys_bytes base,
+	phys_bytes size, phys_bytes offset);
+int sys_vmctl(endpoint_t who, int param, u32_t value);
+int sys_vmctl_get_pdbr(endpoint_t who, u32_t *pdbr);
+int sys_vmctl_get_memreq(endpoint_t *who, vir_bytes *mem, vir_bytes
+	*len, int *wrflag, endpoint_t *who_s, vir_bytes *mem_s, endpoint_t *);
+int sys_vmctl_enable_paging(void * data);
+
+int sys_readbios(phys_bytes address, void *buf, size_t size);
+int sys_settime(int now, clockid_t clk_id, time_t sec, long nsec);
+int sys_stime(time_t boottime);
+int sys_vmctl_get_mapping(int index, phys_bytes *addr, phys_bytes *len,
+	int *flags);
+int sys_vmctl_reply_mapping(int index, vir_bytes addr);
+int sys_vmctl_set_addrspace(endpoint_t who, phys_bytes ptroot, void
+	*ptroot_v);
+
+
+/* Shorthands for sys_sdevio() system call. */
+#define sys_insb(port, proc_ep, buffer, count) \
+  sys_sdevio(DIO_INPUT_BYTE, port, proc_ep, buffer, count, 0)
+#define sys_insw(port, proc_ep, buffer, count) \
+  sys_sdevio(DIO_INPUT_WORD, port, proc_ep, buffer, count, 0)
+#define sys_outsb(port, proc_ep, buffer, count) \
+  sys_sdevio(DIO_OUTPUT_BYTE, port, proc_ep, buffer, count, 0)
+#define sys_outsw(port, proc_ep, buffer, count) \
+  sys_sdevio(DIO_OUTPUT_WORD, port, proc_ep, buffer, count, 0)
+#define sys_safe_insb(port, ept, grant, offset, count) \
+  sys_sdevio(DIO_SAFE_INPUT_BYTE, port, ept, (void*)grant, count, offset)
+#define sys_safe_outsb(port, ept, grant, offset, count) \
+  sys_sdevio(DIO_SAFE_OUTPUT_BYTE, port, ept, (void*)grant, count, offset)
+#define sys_safe_insw(port, ept, grant, offset, count) \
+  sys_sdevio(DIO_SAFE_INPUT_WORD, port, ept, (void*)grant, count, offset)
+#define sys_safe_outsw(port, ept, grant, offset, count) \
+  sys_sdevio(DIO_SAFE_OUTPUT_WORD, port, ept, (void*)grant, count, offset)
+int sys_sdevio(int req, long port, endpoint_t proc_ep, void *buffer, int
+	count, vir_bytes offset);
+void *alloc_contig(size_t len, int flags, phys_bytes *phys);
+int free_contig(void *addr, size_t len);
+
+#define AC_ALIGN4K	0x01
+#define AC_LOWER16M	0x02
+#define AC_ALIGN64K	0x04
+#define AC_LOWER1M	0x08
+
+/* Clock functionality: get system times, (un)schedule an alarm call, or
+ * retrieve/set a process-virtual timer.
+ */
+int sys_times(endpoint_t proc_ep, clock_t *user_time, clock_t *sys_time,
+	clock_t *uptime, time_t *boottime);
+
+#define sys_setalarm(exp, abs) sys_setalarm2(exp, abs, NULL, NULL)
+int sys_setalarm2(clock_t exp_time, int abs_time, clock_t *time_left,
+	clock_t *uptime);
+
+int sys_vtimer(endpoint_t proc_nr, int which, clock_t *newval, clock_t
+	*oldval);
+
+/* Shorthands for sys_irqctl() system call. */
+#define sys_irqdisable(hook_id) \
+    sys_irqctl(IRQ_DISABLE, 0, 0, hook_id) 
+#define sys_irqenable(hook_id) \
+    sys_irqctl(IRQ_ENABLE, 0, 0, hook_id) 
+#define sys_irqsetpolicy(irq_vec, policy, hook_id) \
+    sys_irqctl(IRQ_SETPOLICY, irq_vec, policy, hook_id)
+#define sys_irqrmpolicy(hook_id) \
+    sys_irqctl(IRQ_RMPOLICY, 0, 0, hook_id)
+int sys_irqctl(int request, int irq_vec, int policy, int *irq_hook_id);
+
+/* Shorthands for sys_vircopy() and sys_physcopy() system calls. */
+#define sys_datacopy(p1, v1, p2, v2, len) sys_vircopy(p1, v1, p2, v2, len, 0)
+#define sys_datacopy_try(p1, v1, p2, v2, len) sys_vircopy(p1, v1, p2, v2, len, CP_FLAG_TRY)
+int sys_vircopy(endpoint_t src_proc, vir_bytes src_v,
+	endpoint_t dst_proc, vir_bytes dst_vir, phys_bytes bytes, int flags);
+
+#define sys_abscopy(src_phys, dst_phys, bytes) \
+	sys_physcopy(NONE, src_phys, NONE, dst_phys, bytes, 0)
+int sys_physcopy(endpoint_t src_proc, vir_bytes src_vir,
+	endpoint_t dst_proc, vir_bytes dst_vir, phys_bytes bytes, int flags);
+
+
+/* Grant-based copy functions. */
+int sys_safecopyfrom(endpoint_t source, cp_grant_id_t grant, vir_bytes
+	grant_offset, vir_bytes my_address, size_t bytes);
+int sys_safecopyto(endpoint_t dest, cp_grant_id_t grant, vir_bytes
+	grant_offset, vir_bytes my_address, size_t bytes);
+int sys_vsafecopy(struct vscp_vec *copyvec, int elements);
+
+int sys_safememset(endpoint_t source, cp_grant_id_t grant, vir_bytes
+	grant_offset, int pattern, size_t bytes);
+
+int sys_memset(endpoint_t who, unsigned long pattern,
+	phys_bytes base, phys_bytes bytes);
+
+int sys_vumap(endpoint_t endpt, struct vumap_vir *vvec,
+	int vcount, size_t offset, int access, struct vumap_phys *pvec,
+	int *pcount);
+int sys_umap(endpoint_t proc_ep, int seg, vir_bytes vir_addr, vir_bytes
+	bytes, phys_bytes *phys_addr);
+int sys_umap_data_fb(endpoint_t proc_ep, vir_bytes vir_addr, vir_bytes
+	bytes, phys_bytes *phys_addr);
+int sys_umap_remote(endpoint_t proc_ep, endpoint_t grantee, int seg,
+	vir_bytes vir_addr, vir_bytes bytes, phys_bytes *phys_addr);
+
+/* Shorthands for sys_diagctl() system call. */
+#define sys_diagctl_diag(buf,len) \
+	sys_diagctl(DIAGCTL_CODE_DIAG, buf, len)
+#define sys_diagctl_stacktrace(ep) \
+	sys_diagctl(DIAGCTL_CODE_STACKTRACE, NULL, ep)
+#define sys_diagctl_register()	\
+	sys_diagctl(DIAGCTL_CODE_REGISTER, NULL, 0)
+#define sys_diagctl_unregister() \
+	sys_diagctl(DIAGCTL_CODE_UNREGISTER, NULL, 0)
+int sys_diagctl(int ctl, char *arg1, int arg2);
+
+/* Shorthands for sys_getinfo() system call. */
+#define sys_getkinfo(dst)	sys_getinfo(GET_KINFO, dst, 0,0,0)
+#define sys_getloadinfo(dst)	sys_getinfo(GET_LOADINFO, dst, 0,0,0)
+#define sys_getmachine(dst)	sys_getinfo(GET_MACHINE, dst, 0,0,0)
+#define sys_getcpuinfo(dst)     sys_getinfo(GET_CPUINFO, dst, 0,0,0)
+#define sys_getproctab(dst)	sys_getinfo(GET_PROCTAB, dst, 0,0,0)
+#define sys_getprivtab(dst)	sys_getinfo(GET_PRIVTAB, dst, 0,0,0)
+#define sys_getproc(dst,nr)	sys_getinfo(GET_PROC, dst, 0,0, nr)
+#define sys_getrandomness(dst)	sys_getinfo(GET_RANDOMNESS, dst, 0,0,0)
+#define sys_getrandom_bin(d,b)	sys_getinfo(GET_RANDOMNESS_BIN, d, 0,0,b)
+#define sys_getimage(dst)	sys_getinfo(GET_IMAGE, dst, 0,0,0)
+#define sys_getirqhooks(dst)	sys_getinfo(GET_IRQHOOKS, dst, 0,0,0)
+#define sys_getirqactids(dst)	sys_getinfo(GET_IRQACTIDS, dst, 0,0,0)
+#define sys_getmonparams(v,vl)	sys_getinfo(GET_MONPARAMS, v,vl, 0,0)
+#define sys_getschedinfo(v1,v2)	sys_getinfo(GET_SCHEDINFO, v1,0, v2,0)
+#define sys_getpriv(dst, nr)	sys_getinfo(GET_PRIV, dst, 0,0, nr)
+#define sys_getidletsc(dst)	sys_getinfo(GET_IDLETSC, dst, 0,0,0)
+#define sys_getregs(dst,nr)	sys_getinfo(GET_REGS, dst, 0,0, nr)
+#define sys_getcputicks(dst,nr)	sys_getinfo(GET_CPUTICKS, dst, 0,0, nr)
+int sys_getinfo(int request, void *val_ptr, int val_len, void *val_ptr2,
+	int val_len2);
+int sys_whoami(endpoint_t *ep, char *name, int namelen, int
+	*priv_flags, int* init_flags);
+
+/* Signal control. */
+int sys_kill(endpoint_t proc_ep, int sig);
+int sys_sigsend(endpoint_t proc_ep, struct sigmsg *sig_ctxt);
+int sys_sigreturn(endpoint_t proc_ep, struct sigmsg *sig_ctxt);
+int sys_getksig(endpoint_t *proc_ep, sigset_t *k_sig_map);
+int sys_endksig(endpoint_t proc_ep);
+
+/* NOTE: two different approaches were used to distinguish the device I/O
+ * types 'byte', 'word', 'long': the latter uses #define and results in a
+ * smaller implementation, but looses the static type checking.
+ */
+int sys_voutb(pvb_pair_t *pvb_pairs, int nr_ports);
+int sys_voutw(pvw_pair_t *pvw_pairs, int nr_ports);
+int sys_voutl(pvl_pair_t *pvl_pairs, int nr_ports);
+int sys_vinb(pvb_pair_t *pvb_pairs, int nr_ports);
+int sys_vinw(pvw_pair_t *pvw_pairs, int nr_ports);
+int sys_vinl(pvl_pair_t *pvl_pairs, int nr_ports);
+
+/* Shorthands for sys_out() system call. */
+#define sys_outb(p,v)	sys_out((p), (u32_t) (v), _DIO_BYTE)
+#define sys_outw(p,v)	sys_out((p), (u32_t) (v), _DIO_WORD)
+#define sys_outl(p,v)	sys_out((p), (u32_t) (v), _DIO_LONG)
+int sys_out(int port, u32_t value, int type);
+
+/* Shorthands for sys_in() system call. */
+#define sys_inb(p,v)	sys_in((p), (v), _DIO_BYTE)
+#define sys_inw(p,v)	sys_in((p), (v), _DIO_WORD)
+#define sys_inl(p,v)	sys_in((p), (v), _DIO_LONG)
+int sys_in(int port, u32_t *value, int type);
+
+/* arm pinmux */
+int sys_padconf(u32_t padconf, u32_t mask, u32_t value);
+
+/* pci.c */
+void pci_init(void);
+int pci_first_dev(int *devindp, u16_t *vidp, u16_t *didp);
+int pci_next_dev(int *devindp, u16_t *vidp, u16_t *didp);
+int pci_find_dev(u8_t bus, u8_t dev, u8_t func, int *devindp);
+void pci_reserve(int devind);
+int pci_reserve_ok(int devind);
+void pci_ids(int devind, u16_t *vidp, u16_t *didp);
+void pci_rescan_bus(u8_t busnr);
+u8_t pci_attr_r8(int devind, int port);
+u16_t pci_attr_r16(int devind, int port);
+u32_t pci_attr_r32(int devind, int port);
+void pci_attr_w8(int devind, int port, u8_t value);
+void pci_attr_w16(int devind, int port, u16_t value);
+void pci_attr_w32(int devind, int port, u32_t value);
+char *pci_dev_name(u16_t vid, u16_t did);
+char *pci_slot_name(int devind);
+int pci_set_acl(struct rs_pci *rs_pci);
+int pci_del_acl(endpoint_t proc_ep);
+int pci_get_bar(int devind, int port, u32_t *base, u32_t *size, int
+	*ioflag);
+
+/* Profiling. */
+int sys_sprof(int action, int size, int freq, int type, endpoint_t
+	endpt, vir_bytes ctl_ptr, vir_bytes mem_ptr);
+
+/* machine context */
+int sys_getmcontext(endpoint_t proc, vir_bytes mcp);
+int sys_setmcontext(endpoint_t proc, vir_bytes mcp);
+
+/* input */
+int tty_input_inject(int type, int code, int val);
+
+/* Miscellaneous calls from servers and drivers. */
+pid_t srv_fork(uid_t reuid, gid_t regid);
+int srv_kill(pid_t pid, int sig);
+int getprocnr(pid_t pid, endpoint_t *proc_ep);
+int mapdriver(const char *label, devmajor_t major, const int *domains,
+	int nr_domains);
+pid_t getepinfo(endpoint_t proc_ep, uid_t *uidp, gid_t *gidp);
+pid_t getnpid(endpoint_t proc_ep);
+uid_t getnuid(endpoint_t proc_ep);
+gid_t getngid(endpoint_t proc_ep);
+int getsockcred(endpoint_t proc_ep, struct sockcred * sockcred, gid_t * groups,
+	int ngroups);
+int socketpath(endpoint_t endpt, const char *path, size_t size, int what,
+	dev_t *dev, ino_t *ino);
+#define SPATH_CHECK	0	/* check user permissions on socket path */
+#define SPATH_CREATE	1	/* create socket file at given path */
+int copyfd(endpoint_t endpt, int fd, int what);
+#define COPYFD_FROM	0	/* copy file descriptor from remote process */
+#define COPYFD_TO	1	/* copy file descriptor to remote process */
+#define COPYFD_CLOSE	2	/* close file descriptor in remote process */
+#define COPYFD_CLOEXEC	0x8000	/* with COPYFD_TO: set close-on-exec flag */
+#define COPYFD_FLAGS	0xF000	/* flags mask */
+int closenb(int fd);
+
+/*
+ * These are also the event numbers used in PROC_EVENT messages, but in order
+ * to allow for subscriptions to multiple events, they form a bit mask.
+ */
+#define PROC_EVENT_EXIT		0x01	/* process has exited */
+#define PROC_EVENT_SIGNAL	0x02	/* process has caught signal */
+int proceventmask(unsigned int mask);
+
+#endif /* _SYSLIB_H */
+

Property changes on: lab4/.minix-src/include/minix/syslib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/vm.h
===================================================================
--- lab4/.minix-src/include/minix/vm.h	(nonexistent)
+++ lab4/.minix-src/include/minix/vm.h	(revision 13)
@@ -0,0 +1,96 @@
+/* Prototypes and definitions for VM interface. */
+
+#ifndef _MINIX_VM_H
+#define _MINIX_VM_H
+
+#include <sys/types.h>
+#include <minix/endpoint.h>
+
+int vm_exit(endpoint_t ep);
+int vm_fork(endpoint_t ep, int slotno, endpoint_t *child_ep);
+int vm_getrusage(endpoint_t endpt, void *addr, int children);
+int vm_willexit(endpoint_t ep);
+int vm_adddma(endpoint_t proc_e, phys_bytes start, phys_bytes size);
+int vm_deldma(endpoint_t proc_e, phys_bytes start, phys_bytes size);
+int vm_getdma(endpoint_t *procp, phys_bytes *basep, phys_bytes *sizep);
+void *vm_map_phys(endpoint_t who, void *physaddr, size_t len);
+int vm_unmap_phys(endpoint_t who, void *vaddr, size_t len);
+
+int vm_set_priv(endpoint_t ep, void *buf, int sys_proc);
+int vm_update(endpoint_t src_e, endpoint_t dst_e, int flags);
+int vm_memctl(endpoint_t ep, int req, void** addr, size_t *len);
+int vm_prepare(endpoint_t src_e, endpoint_t dst_e, int flags);
+int minix_vfs_mmap(endpoint_t who, off_t offset, size_t len,
+        dev_t dev, ino_t ino, int fd, u32_t vaddr, u16_t clearend, u16_t
+	flags);
+
+void *minix_mmap_for(endpoint_t forwhom,
+        void *addr, size_t len, int prot, int flags, int fd, off_t offset);
+int minix_vfs_mmap(endpoint_t who, off_t offset, size_t len,
+        dev_t dev, ino_t ino, int fd, u32_t vaddr, u16_t clearend,
+        u16_t flags);
+
+/* minix vfs mmap flags */
+#define MVM_WRITABLE	0x8000
+
+/* VM kernel request types. */
+#define VMPTYPE_NONE		0
+#define VMPTYPE_CHECK		1
+
+struct vm_stats_info {
+  unsigned int vsi_pagesize;	/* page size */
+  unsigned long vsi_total;	/* total number of memory pages */
+  unsigned long vsi_free;	/* number of free pages */
+  unsigned long vsi_largest;	/* largest number of consecutive free pages */
+  unsigned long vsi_cached;	/* number of pages cached for file systems */
+};
+
+struct vm_usage_info {
+  vir_bytes vui_total;		/* total amount of mapped process memory */
+  vir_bytes vui_common;		/* part of memory mapped in more than once */
+  vir_bytes vui_shared;		/* shared (non-COW) part of common memory */
+  vir_bytes vui_virtual;	/* total size of virtual address space */
+  vir_bytes vui_mvirtual;	/* idem but minus unmapped stack pages */
+  uint64_t vui_maxrss;		/* maximum resident set size (in KB) */
+  uint64_t vui_minflt;		/* minor page faults */
+  uint64_t vui_majflt;		/* major page faults */
+};
+
+struct vm_region_info {
+  vir_bytes vri_addr;		/* base address of region */
+  vir_bytes vri_length;		/* length of region */
+  int vri_prot;			/* protection flags (PROT_) */
+  int vri_flags;		/* memory flags (subset of MAP_) */
+};
+
+#define MAX_VRI_COUNT	64	/* max. number of regions provided at once */
+
+int vm_info_stats(struct vm_stats_info *vfi);
+int vm_info_usage(endpoint_t who, struct vm_usage_info *vui);
+int vm_info_region(endpoint_t who, struct vm_region_info *vri, int
+	count, vir_bytes *next);
+int vm_procctl_clear(endpoint_t ep);
+int vm_procctl_handlemem(endpoint_t ep, vir_bytes m1, vir_bytes m2, int wr);
+
+int vm_set_cacheblock(void *block, dev_t dev, off_t dev_offset,
+        ino_t ino, off_t ino_offset, u32_t *flags, int blocksize,
+        int setflags);
+void *vm_map_cacheblock(dev_t dev, off_t dev_offset,
+        ino_t ino, off_t ino_offset, u32_t *flags, int blocksize);
+int vm_forget_cacheblock(dev_t dev, off_t dev_offset, int blocksize);
+int vm_clear_cache(dev_t dev);
+
+/* flags for vm cache functions */
+#define VMMC_FLAGS_LOCKED	0x01	/* someone is updating the flags; don't read/write */
+#define VMMC_DIRTY		0x02	/* dirty buffer and it may not be evicted */
+#define VMMC_EVICTED		0x04	/* VM has evicted the buffer and it's invalid */
+#define VMMC_BLOCK_LOCKED	0x08	/* client is using it and it may not be evicted */
+
+/* special inode number for vm cache functions */
+#define VMC_NO_INODE		0	/* to reference a disk block, no associated file */
+
+/* setflags for vm_set_cacheblock, also used internally in VM */
+#define VMSF_ONCE		0x01	/* discard block after one-time use */
+
+#endif /* _MINIX_VM_H */
+

Property changes on: lab4/.minix-src/include/minix/vm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/dhcp.h
===================================================================
--- lab4/.minix-src/include/net/gen/dhcp.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/dhcp.h	(revision 13)
@@ -0,0 +1,73 @@
+/*	net/gen/dhcp.h - DHCP packet format		Author: Kees J. Bot
+ *								1 Dec 2000
+ */
+
+#ifndef __NET__GEN__DHCP_H__
+#define __NET__GEN__DHCP_H__
+
+typedef struct dhcp {
+	u8_t		op;		/* Message opcode/type. */
+	u8_t		htype;		/* Hardware address type. */
+	u8_t		hlen;		/* Hardware address length. */
+	u8_t		hops;		/* Hop count when relaying. */
+	u32_t		xid;		/* Transaction ID. */
+	u16_t		secs;		/* Seconds past since client began. */
+	u16_t		flags;		/* Flags. */
+	ipaddr_t	ciaddr;		/* Client IP address. */
+	ipaddr_t	yiaddr;		/* "Your" IP address. */
+	ipaddr_t	siaddr;		/* Boot server IP address. */
+	ipaddr_t	giaddr;		/* Relay agent (gateway) IP address. */
+	u8_t		chaddr[16];	/* Client hardware address. */
+	u8_t		sname[64];	/* Server host name. */
+	u8_t		file[128];	/* Boot file. */
+	u32_t		magic;		/* Magic number. */
+	u8_t		options[308];	/* Optional parameters. */
+} dhcp_t;
+
+/* DHCP operations and stuff: */
+#define DHCP_BOOTREQUEST	 1	/* Boot request message. */
+#define DHCP_BOOTREPLY		 2	/* Boot reply message. */
+#define DHCP_HTYPE_ETH		 1	/* Ethernet hardware type. */
+#define DHCP_HLEN_ETH		 6	/* Ethernet hardware address length. */
+#define DHCP_FLAGS_BCAST    0x8000U	/* Reply must be broadcast to client. */
+
+					/* "Magic" first four option bytes. */
+#define DHCP_MAGIC	htonl(0x63825363UL)
+
+/* DHCP common tags: */
+#define DHCP_TAG_NETMASK	 1	/* Netmask. */
+#define DHCP_TAG_GATEWAY	 3	/* Gateway list. */
+#define DHCP_TAG_DNS		 6	/* DNS Nameserver list. */
+#define DHCP_TAG_HOSTNAME	12	/* Host name. */
+#define DHCP_TAG_DOMAIN		15	/* Domain. */
+#define DHCP_TAG_IPMTU		26	/* Interface MTU. */
+
+/* DHCP protocol tags: */
+#define DHCP_TAG_REQIP		50	/* Request this IP. */
+#define DHCP_TAG_LEASE		51	/* Lease time requested/offered. */
+#define DHCP_TAG_OVERLOAD	52	/* Options continued in file/sname. */
+#define DHCP_TAG_TYPE		53	/* DHCP message (values below). */
+#define DHCP_TAG_SERVERID	54	/* Server identifier. */
+#define DHCP_TAG_REQPAR		55	/* Parameters requested. */
+#define DHCP_TAG_MESSAGE	56	/* Error message. */
+#define DHCP_TAG_MAXDHCP	57	/* Max DHCP packet size. */
+#define DHCP_TAG_RENEWAL	58	/* Time to go into renewal state. */
+#define DHCP_TAG_REBINDING	59	/* Time to go into rebinding state. */
+#define DHCP_TAG_CLASSID	60	/* Class identifier. */
+#define DHCP_TAG_CLIENTID	61	/* Client identifier. */
+
+/* DHCP messages: */
+#define DHCP_DISCOVER		 1	/* Locate available servers. */
+#define DHCP_OFFER		 2	/* Parameters offered to client. */
+#define DHCP_REQUEST		 3	/* (Re)request offered parameters. */
+#define DHCP_DECLINE		 4	/* Client declines offer. */
+#define DHCP_ACK		 5	/* Server acknowlegdes request. */
+#define DHCP_NAK		 6	/* Server denies request. */
+#define DHCP_RELEASE		 7	/* Client relinguishes address. */
+#define DHCP_INFORM		 8	/* Client requests just local config. */
+
+void dhcp_init(dhcp_t *_dp);
+int dhcp_settag(dhcp_t *_dp, int _tag, void *_data, size_t _len);
+int dhcp_gettag(dhcp_t *_dp, int _searchtag, u8_t **_pdata, size_t *_plen);
+
+#endif /* __NET__GEN__DHCP_H__ */

Property changes on: lab4/.minix-src/include/net/gen/dhcp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/icmp.h
===================================================================
--- lab4/.minix-src/include/net/gen/icmp.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/icmp.h	(revision 13)
@@ -0,0 +1,49 @@
+/*
+server/ip/gen/icmp.h
+*/
+
+#ifndef __SERVER__IP__GEN__ICMP_H__
+#define __SERVER__IP__GEN__ICMP_H__
+
+#define ICMP_MIN_HDR_SIZE	4
+
+#define ICMP_TYPE_ECHO_REPL	0
+#define ICMP_TYPE_DST_UNRCH	3
+#	define ICMP_NET_UNRCH			0
+#	define ICMP_HOST_UNRCH			1
+#	define ICMP_PROTOCOL_UNRCH		2
+#	define ICMP_PORT_UNRCH			3
+#	define ICMP_FRAGM_AND_DF		4
+#	define ICMP_SOURCE_ROUTE_FAILED		5
+#define ICMP_TYPE_SRC_QUENCH	4
+#define ICMP_TYPE_REDIRECT	5
+#	define ICMP_REDIRECT_NET		0
+#	define ICMP_REDIRECT_HOST		1
+#	define ICMP_REDIRECT_TOS_AND_NET	2
+#	define ICMP_REDIRECT_TOS_AND_HOST	3
+#define ICMP_TYPE_ECHO_REQ	8
+#define ICMP_TYPE_ROUTER_ADVER	9
+#define ICMP_TYPE_ROUTE_SOL	10
+#define ICMP_TYPE_TIME_EXCEEDED	11
+#	define ICMP_TTL_EXC			0
+#	define ICMP_FRAG_REASSEM		1
+#define ICMP_TYPE_PARAM_PROBLEM	12
+#define ICMP_TYPE_TS_REQ	13
+#define ICMP_TYPE_TS_REPL	14
+#define ICMP_TYPE_INFO_REQ	15
+#define ICMP_TYPE_INFO_REPL	16
+
+/* Preferences for router advertisements. A router daemon installs itself
+ * as the default router in the router's interfaces by sending router
+ * advertisements to localhost with preference ICMP_RA_LOCAL_PREF.
+ */
+#define ICMP_RA_DEFAULT_PREF	0x00000000
+#define ICMP_RA_INVAL_PREF	0x80000000
+#define ICMP_RA_MAX_PREF	0x7fffffff
+#define ICMP_RA_LOCAL_PREF	0x10000000
+
+#endif /* __SERVER__IP__GEN__ICMP_H__ */
+
+/*
+ * $PchId: icmp.h,v 1.6 2002/06/10 07:10:26 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/icmp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/inet.h
===================================================================
--- lab4/.minix-src/include/net/gen/inet.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/inet.h	(revision 13)
@@ -0,0 +1,13 @@
+/*
+server/ip/gen/inet.h
+*/
+
+#ifndef __SERVER__IP__GEN__INET_H__
+#define __SERVER__IP__GEN__INET_H__
+
+#include <net/gen/in.h>
+
+ipaddr_t inet_addr( const char *addr );
+ipaddr_t inet_network( const char *addr );
+
+#endif /* __SERVER__IP__GEN__INET_H__ */

Property changes on: lab4/.minix-src/include/net/gen/inet.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/psip_hdr.h
===================================================================
--- lab4/.minix-src/include/net/gen/psip_hdr.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/psip_hdr.h	(revision 13)
@@ -0,0 +1,23 @@
+/*
+server/ip/gen/psip_hdr.h
+*/
+
+#ifndef __SERVER__IP__GEN__PSIP_HDR_H__
+#define __SERVER__IP__GEN__PSIP_HDR_H__
+
+typedef struct psip_io_hdr
+{
+	u8_t pih_flags;
+	u8_t pih_dummy[3];
+	u32_t pih_nexthop;
+} psip_io_hdr_t;
+
+#define PF_LOC_REM_MASK	1
+#define PF_LOC2REM		0
+#define PF_REM2LOC		1
+
+#endif /* __SERVER__IP__GEN__PSIP_HDR_H__ */
+
+/*
+ * $PchId: psip_hdr.h,v 1.3 2001/02/19 07:35:38 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/psip_hdr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/rip.h
===================================================================
--- lab4/.minix-src/include/net/gen/rip.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/rip.h	(revision 13)
@@ -0,0 +1,77 @@
+/*
+net/gen/rip.h
+
+Definitions for the Routing Information Protocol (RFC-1058).
+
+Created:	Aug 16, 1993 by Philip Homburg <philip@cs.vu.nl>
+*/
+
+#ifndef NET__GEN__RIP_H
+#define NET__GEN__RIP_H
+
+typedef struct rip_hdr
+{
+	u8_t rh_command;
+	u8_t rh_version;
+	u16_t rh_zero;
+} rip_hdr_t;
+
+#define RHC_REQUEST	1
+#define RHC_RESPONSE	2
+
+#define RIP_ENTRY_MAX	25
+
+typedef struct rip_entry
+{
+	union
+	{
+		struct rip_entry_v1
+		{
+			u16_t re_family;
+			u16_t re_zero0;
+			u32_t re_address;
+			u32_t re_zero1;
+			u32_t re_zero2;
+			u32_t re_metric;
+		} v1;
+		struct rip_entry_v2
+		{
+			u16_t re_family;
+			u16_t re_tag;
+			u32_t re_address;
+			u32_t re_mask;
+			u32_t re_nexthop;
+			u32_t re_metric;
+		} v2;
+	} u;
+} rip_entry_t;
+
+#define RIP_FAMILY_IP	2
+#define RIP_INFINITY	16
+
+#define RIP_UDP_PORT	520
+#define RIP_PERIOD	 30	/* A responce is sent once every
+				 * RIP_PERIOD seconds
+				 */
+#define RIP_FUZZ	 10	/* The actual value used is RIP_FREQUENCE -
+				 * a random number of at most RIP_FUZZ.
+				 */
+#define RIP_TIMEOUT	180	/* A route is dead after RIP_TIMEOUT seconds */
+#define RIP_DELETE_TO	120	/* A dead route is removed after RIP_DELETE_TO
+				 * seconds
+				 */
+
+#ifdef __RIP_DEBUG
+#undef RIP_PERIOD
+#define RIP_PERIOD	15
+#undef RIP_TIMEOUT
+#define RIP_TIMEOUT	10
+#undef RIP_DELETE_TO
+#define RIP_DELETE_TO	10
+#endif /* __RIP_DEBUG */
+
+#endif /* NET__GEN__RIP_H */
+
+/*
+ * $PchId: rip.h,v 1.3 1995/11/17 22:21:16 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/rip.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/tcp_hdr.h
===================================================================
--- lab4/.minix-src/include/net/gen/tcp_hdr.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/tcp_hdr.h	(revision 13)
@@ -0,0 +1,49 @@
+/*
+server/ip/gen/tcp_hdr.h
+*/
+
+#ifndef __SERVER__IP__GEN__TCP_HDR_H__
+#define __SERVER__IP__GEN__TCP_HDR_H__
+
+typedef struct tcp_hdr
+{
+	tcpport_t th_srcport;
+	tcpport_t th_dstport;
+	u32_t th_seq_nr;
+	u32_t th_ack_nr;
+	u8_t th_data_off;
+	u8_t th_flags;
+	u16_t th_window;
+	u16_t th_chksum;
+	u16_t th_urgptr;
+} tcp_hdr_t;
+
+#define TH_DO_MASK	0xf0
+
+#define TH_FLAGS_MASK	0x3f
+#define THF_FIN		0x1
+#define THF_SYN		0x2
+#define THF_RST		0x4
+#define THF_PSH		0x8
+#define THF_ACK		0x10
+#define THF_URG		0x20
+
+typedef struct tcp_hdropt
+{
+	int tho_opt_siz;
+	u8_t tho_data[TCP_MAX_HDR_SIZE-TCP_MIN_HDR_SIZE];
+} tcp_hdropt_t;
+
+#define TCP_OPT_EOL	 0
+#define TCP_OPT_NOP	 1
+#define TCP_OPT_MSS	 2
+#define TCP_OPT_WSOPT	 3	/* RFC-1323, window scale option */
+#define TCP_OPT_SACKOK	 4	/* RFC-2018, SACK permitted */
+#define TCP_OPT_TS	 8	/* RFC-1323, Timestamps option */
+#define TCP_OPT_CCNEW	12	/* RFC-1644, new connection count */
+
+#endif /* __SERVER__IP__GEN__TCP_HDR_H__ */
+
+/*
+ * $PchId: tcp_hdr.h,v 1.4 2002/06/10 07:12:22 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/tcp_hdr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/msdosfs/denode.h
===================================================================
--- lab4/.minix-src/include/msdosfs/denode.h	(nonexistent)
+++ lab4/.minix-src/include/msdosfs/denode.h	(revision 13)
@@ -0,0 +1,336 @@
+/*	$NetBSD: denode.h,v 1.24 2014/07/08 09:21:52 hannken Exp $	*/
+
+/*-
+ * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
+ * Copyright (C) 1994, 1995, 1997 TooLs GmbH.
+ * All rights reserved.
+ * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
+ */
+/*
+ * Written by Paul Popelka (paulp@uts.amdahl.com)
+ *
+ * You can do anything you want with this software, just don't say you wrote
+ * it, and don't remove this notice.
+ *
+ * This software is provided "as is".
+ *
+ * The author supplies this software to be publicly redistributed on the
+ * understanding that the author is not responsible for the correct
+ * functioning of this software in any circumstances and is not liable for
+ * any damages caused by this software.
+ *
+ * October 1992
+ */
+#ifndef _MSDOSFS_DENODE_H_
+#define _MSDOSFS_DENODE_H_
+
+#ifndef MAKEFS
+#include <miscfs/genfs/genfs_node.h>
+#else
+struct genfs_node {
+};
+struct vnode;
+struct msdosfsmount;
+struct buf;
+#endif
+
+/*
+ * This is the pc filesystem specific portion of the vnode structure.
+ *
+ * To describe a file uniquely the de_dirclust, de_diroffset, and
+ * de_StartCluster fields are used.
+ *
+ * de_dirclust contains the cluster number of the directory cluster
+ *	containing the entry for a file or directory.
+ * de_diroffset is the index into the cluster for the entry describing
+ *	a file or directory.
+ * de_StartCluster is the number of the first cluster of the file or directory.
+ *
+ * Now to describe the quirks of the pc filesystem.
+ * - Clusters 0 and 1 are reserved.
+ * - The first allocatable cluster is 2.
+ * - The root directory is of fixed size and all blocks that make it up
+ *   are contiguous.
+ * - Cluster 0 refers to the root directory when it is found in the
+ *   startcluster field of a directory entry that points to another directory.
+ * - Cluster 0 implies a 0 length file when found in the start cluster field
+ *   of a directory entry that points to a file.
+ * - You can't use the cluster number 0 to derive the address of the root
+ *   directory.
+ * - Multiple directory entries can point to a directory. The entry in the
+ *   parent directory points to a child directory.  Any directories in the
+ *   child directory contain a ".." entry that points back to the parent.
+ *   The child directory itself contains a "." entry that points to itself.
+ * - The root directory does not contain a "." or ".." entry.
+ * - Directory entries for directories are never changed once they are created
+ *   (except when removed).  The size stays 0, and the last modification time
+ *   is never changed.  This is because so many directory entries can point to
+ *   the physical clusters that make up a directory.  It would lead to an
+ *   update nightmare.
+ * - The length field in a directory entry pointing to a directory contains 0
+ *   (always).  The only way to find the end of a directory is to follow the
+ *   cluster chain until the "last cluster" marker is found.
+ *
+ * My extensions to make this house of cards work.  These apply only to the in
+ * memory copy of the directory entry.
+ * - A reference count for each denode will be kept since dos doesn't keep such
+ *   things.
+ */
+
+/*
+ * Internal pseudo-offset for (nonexistent) directory entry for the root
+ * dir in the root dir
+ */
+#define	MSDOSFSROOT_OFS	0x1fffffff
+
+/*
+ * The FAT cache structure. fc_fsrcn is the filesystem relative cluster
+ * number that corresponds to the file relative cluster number in this
+ * structure (fc_frcn).
+ */
+struct fatcache {
+	u_long fc_frcn;		/* file relative cluster number */
+	u_long fc_fsrcn;	/* filesystem relative cluster number */
+};
+
+/*
+ * The FAT entry cache as it stands helps make extending files a "quick"
+ * operation by avoiding having to scan the FAT to discover the last
+ * cluster of the file. The cache also helps sequential reads by
+ * remembering the last cluster read from the file.  This also prevents us
+ * from having to rescan the FAT to find the next cluster to read.  This
+ * cache is probably pretty worthless if a file is opened by multiple
+ * processes.
+ */
+#define	FC_SIZE		3	/* number of entries in the cache */
+#define	FC_LASTMAP	0	/* entry the last call to pcbmap() resolved
+				 * to */
+#define	FC_LASTFC	1	/* entry for the last cluster in the file */
+#define	FC_NEXTTOLASTFC	2	/* entry for a close to the last cluster in the file */
+
+#define	FCE_EMPTY	0xffffffff	/* doesn't represent an actual cluster # */
+
+/*
+ * Set a slot in the FAT cache.
+ */
+#define	fc_setcache(dep, slot, frcn, fsrcn) \
+	(dep)->de_fc[slot].fc_frcn = frcn; \
+	(dep)->de_fc[slot].fc_fsrcn = fsrcn;
+
+#define fc_last_to_nexttolast(dep) \
+	do {  \
+		(dep)->de_fc[FC_NEXTTOLASTFC].fc_frcn = (dep)->de_fc[FC_LASTFC].fc_frcn; \
+		(dep)->de_fc[FC_NEXTTOLASTFC].fc_fsrcn = (dep)->de_fc[FC_LASTFC].fc_fsrcn; \
+	} while (0)
+	 
+
+/*
+ * This is the in memory variant of a dos directory entry.  It is usually
+ * contained within a vnode.
+ */
+struct denode_key {
+	u_long dk_dirclust;	/* cluster of the directory file containing this entry */
+	u_long dk_diroffset;	/* offset of this entry in the directory cluster */
+	void *dk_dirgen;	/* non zero and unique for unlinked nodes */
+};
+struct denode {
+	struct genfs_node de_gnode;
+	struct vnode *de_vnode;	/* addr of vnode we are part of */
+	struct vnode *de_devvp;	/* vnode of blk dev we live on */
+	u_long de_flag;		/* flag bits */
+	dev_t de_dev;		/* device where direntry lives */
+	struct denode_key de_key;
+#define de_dirclust de_key.dk_dirclust
+#define de_diroffset de_key.dk_diroffset
+#define de_dirgen de_key.dk_dirgen
+	u_long de_fndoffset;	/* offset of found dir entry */
+	int de_fndcnt;		/* number of slots before de_fndoffset */
+	long de_refcnt;		/* reference count */
+	struct msdosfsmount *de_pmp;	/* addr of our mount struct */
+	struct lockf *de_lockf;	/* byte level lock list */
+	u_char de_Name[12];	/* name, from DOS directory entry */
+	u_char de_Attributes;	/* attributes, from directory entry */
+	u_char de_CHun;		/* Hundredth of second of CTime*/
+	u_short de_CTime;	/* creation time */
+	u_short de_CDate;	/* creation date */
+	u_short de_ADate;	/* access date */
+	u_short de_MTime;	/* modification time */
+	u_short de_MDate;	/* modification date */
+	u_long de_StartCluster; /* starting cluster of file */
+	u_long de_FileSize;	/* size of file in bytes */
+	struct fatcache de_fc[FC_SIZE];	/* FAT cache */
+};
+
+/*
+ * Values for the de_flag field of the denode.
+ */
+#define	DE_UPDATE	0x0001	/* Modification time update request. */
+#define	DE_CREATE	0x0002	/* Creation time update */
+#define	DE_ACCESS	0x0004	/* Access time update */
+#define	DE_MODIFIED	0x0008	/* Denode has been modified. */
+#define	DE_RENAME	0x0010	/* Denode is in the process of being renamed */
+
+/*
+ * Maximum filename length in Win95
+ * Note: Must be < sizeof(dirent.d_name)
+ */
+#define	WIN_MAXLEN	255
+
+/* Maximum size of a file on a FAT filesystem */
+#define MSDOSFS_FILESIZE_MAX	0xFFFFFFFFLL
+
+/*
+ * Transfer directory entries between internal and external form.
+ * dep is a struct denode * (internal form),
+ * dp is a struct direntry * (external form).
+ */
+#define DE_INTERNALIZE32(dep, dp)			\
+	 ((dep)->de_StartCluster |= getushort((dp)->deHighClust) << 16)
+#define DE_INTERNALIZE(dep, dp)				\
+	(memcpy((dep)->de_Name, (dp)->deName, 11),	\
+	 (dep)->de_Attributes = (dp)->deAttributes,	\
+	 (dep)->de_CHun = (dp)->deCHundredth,		\
+	 (dep)->de_CTime = getushort((dp)->deCTime),	\
+	 (dep)->de_CDate = getushort((dp)->deCDate),	\
+	 (dep)->de_ADate = getushort((dp)->deADate),	\
+	 (dep)->de_MTime = getushort((dp)->deMTime),	\
+	 (dep)->de_MDate = getushort((dp)->deMDate),	\
+	 (dep)->de_StartCluster = getushort((dp)->deStartCluster), \
+	 (dep)->de_FileSize = getulong((dp)->deFileSize), \
+	 (FAT32((dep)->de_pmp) ? DE_INTERNALIZE32((dep), (dp)) : 0))
+
+#define DE_EXTERNALIZE32(dp, dep)			\
+	 putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16)
+#define DE_EXTERNALIZE16(dp, dep)			\
+	 putushort((dp)->deHighClust, 0)
+#define DE_EXTERNALIZE(dp, dep)				\
+	(memcpy((dp)->deName, (dep)->de_Name, 11),	\
+	 (dp)->deAttributes = (dep)->de_Attributes,	\
+	 (dp)->deCHundredth = (dep)->de_CHun,		\
+	 putushort((dp)->deCTime, (dep)->de_CTime),	\
+	 putushort((dp)->deCDate, (dep)->de_CDate),	\
+	 putushort((dp)->deADate, (dep)->de_ADate),	\
+	 putushort((dp)->deMTime, (dep)->de_MTime),	\
+	 putushort((dp)->deMDate, (dep)->de_MDate),	\
+	 putushort((dp)->deStartCluster, (dep)->de_StartCluster), \
+	 putulong((dp)->deFileSize,			\
+	     ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \
+	 (FAT32((dep)->de_pmp) ? DE_EXTERNALIZE32((dp), (dep)) : DE_EXTERNALIZE16((dp), (dep))))
+
+#define	de_forw		de_chain[0]
+#define	de_back		de_chain[1]
+
+#if defined(_KERNEL) || defined(MAKEFS)
+
+#define	VTODE(vp)	((struct denode *)(vp)->v_data)
+#define	DETOV(de)	((de)->de_vnode)
+
+#define	DETIMES(dep, acc, mod, cre, gmtoff) \
+	while ((dep)->de_flag & (DE_UPDATE | DE_CREATE | DE_ACCESS)) \
+		msdosfs_detimes(dep, acc, mod, cre, gmtoff)
+
+/*
+ * This overlays the fid structure (see fstypes.h)
+ */
+struct defid {
+	u_int16_t defid_len;	/* length of structure */
+	u_int16_t defid_pad;	/* force 4-byte alignment */
+
+	u_int32_t defid_dirclust; /* cluster this dir entry came from */
+	u_int32_t defid_dirofs;	/* offset of entry within the cluster */
+	u_int32_t defid_gen;	/* generation number */
+};
+
+/*
+ * Prototypes for MSDOSFS vnode operations
+ */
+int	msdosfs_lookup		(void *);
+int	msdosfs_create		(void *);
+int	msdosfs_close		(void *);
+int	msdosfs_access		(void *);
+int	msdosfs_getattr		(void *);
+int	msdosfs_setattr		(void *);
+int	msdosfs_read		(void *);
+int	msdosfs_write		(void *);
+#define	msdosfs_lease_check	genfs_lease_check
+#define	msdosfs_ioctl		genfs_enoioctl
+#define	msdosfs_poll		genfs_poll
+#define	msdosfs_revoke		genfs_revoke
+#define	msdosfs_mmap		genfs_mmap
+int	msdosfs_fsync		(void *);
+#define	msdosfs_seek		genfs_seek
+int	msdosfs_remove		(void *);
+int	msdosfs_rename		(void *);
+int	msdosfs_mkdir		(void *);
+int	msdosfs_rmdir		(void *);
+int	msdosfs_readdir		(void *);
+#define	msdosfs_abortop		genfs_abortop
+int	msdosfs_inactive	(void *);
+int	msdosfs_reclaim		(void *);
+int	msdosfs_bmap		(void *);
+int	msdosfs_strategy	(void *);
+int	msdosfs_print		(void *);
+int	msdosfs_advlock		(void *);
+int	msdosfs_pathconf	(void *);
+
+/*
+ * Internal service routine prototypes.
+ */
+struct componentname;
+struct direntry;
+struct kauth_cred;
+int msdosfs_update(struct vnode *, const struct timespec *,
+	    const struct timespec *, int);
+int createde(struct denode *, struct denode *,
+		struct denode **, struct componentname *);
+int deextend(struct denode *, u_long, struct kauth_cred *);
+#ifdef MAKEFS
+int deget(struct msdosfsmount *, u_long, u_long, struct denode **);
+#else
+int deget(struct msdosfsmount *, u_long, u_long, struct vnode **);
+#endif
+int detrunc(struct denode *, u_long, int, struct kauth_cred *);
+int deupdat(struct denode *, int);
+int doscheckpath(struct denode *, struct denode *);
+int dosdirempty(struct denode *);
+int readde(struct denode *, struct buf **, struct direntry **);
+int readep(struct msdosfsmount *, u_long, u_long,
+		struct buf **, struct direntry **);
+int removede(struct denode *, struct denode *);
+int uniqdosname(struct denode *, struct componentname *, u_char *);
+int findwin95(struct denode *);
+int msdosfs_gop_alloc(struct vnode *, off_t, off_t, int, struct kauth_cred *);
+void msdosfs_gop_markupdate(struct vnode *, int);
+void msdosfs_detimes(struct denode *, const struct timespec *,
+    const struct timespec *, const struct timespec *, int);
+int msdosfs_fh_enter(struct msdosfsmount *, uint32_t, uint32_t, uint32_t *);
+int msdosfs_fh_remove(struct msdosfsmount *, uint32_t, uint32_t);
+int msdosfs_fh_lookup(struct msdosfsmount *, uint32_t, uint32_t, uint32_t *);
+void msdosfs_fh_destroy(struct msdosfsmount *);
+#endif	/* _KERNEL || MAKEFS */
+#endif /* _MSDOSFS_DENODE_H_ */

Property changes on: lab4/.minix-src/include/msdosfs/denode.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/arp_io.h
===================================================================
--- lab4/.minix-src/include/net/gen/arp_io.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/arp_io.h	(revision 13)
@@ -0,0 +1,23 @@
+/*
+net/gen/arp_io.h
+
+Created:	Jan 2001 by Philip Homburg <philip@f-mnx.phicoh.com>
+*/
+
+typedef struct nwio_arp
+{
+	int nwa_entno;
+	u32_t nwa_flags;
+	ipaddr_t nwa_ipaddr;
+	ether_addr_t nwa_ethaddr;
+} nwio_arp_t;
+
+#define NWAF_EMPTY	0
+#define NWAF_INCOMPLETE	1
+#define NWAF_DEAD	2
+#define NWAF_PERM	4
+#define NWAF_PUB	8
+
+/*
+ * $PchId: arp_io.h,v 1.2 2004/08/03 11:01:59 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/arp_io.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/ether.h
===================================================================
--- lab4/.minix-src/include/net/gen/ether.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/ether.h	(revision 13)
@@ -0,0 +1,29 @@
+/*
+server/ip/gen/ether.h
+*/
+
+#ifndef __SERVER__IP__GEN__ETHER_H__
+#define __SERVER__IP__GEN__ETHER_H__
+
+#define ETH_MIN_PACK_SIZE		  60
+#define ETH_MAX_PACK_SIZE		1514
+#define ETH_MAX_PACK_SIZE_TAGGED	1518
+#define ETH_HDR_SIZE			  14
+#define ETH_CRC_SIZE			   4
+
+typedef u16_t ether_type_t;
+
+#define ETH_ARP_PROTO	 0x806
+#define ETH_IP_PROTO	 0x800
+#define ETH_VLAN_PROTO	0x8100
+
+/* Tag Control Information field for VLAN and Priority tagging */
+#define ETH_TCI_PRIO_MASK	0xe000
+#define ETH_TCI_CFI		0x1000	/* Canonical Formal Indicator */
+#define ETH_TCI_VLAN_MASK	0x0fff	/* 12-bit vlan number */
+
+#endif /* __SERVER__IP__GEN__ETHER_H__ */
+
+/*
+ * $PchId: ether.h,v 1.6 2005/01/27 17:33:35 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/ether.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/udp_io.h
===================================================================
--- lab4/.minix-src/include/net/gen/udp_io.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/udp_io.h	(revision 13)
@@ -0,0 +1,45 @@
+/*
+server/ip/gen/udp_io.h
+*/
+
+#ifndef __SERVER__IP__GEN__UDP_IO_H__
+#define __SERVER__IP__GEN__UDP_IO_H__
+
+typedef struct nwio_udpopt
+{
+	unsigned long nwuo_flags;
+	udpport_t nwuo_locport;
+	udpport_t nwuo_remport;
+	ipaddr_t nwuo_locaddr;
+	ipaddr_t nwuo_remaddr;
+} nwio_udpopt_t;
+
+#define NWUO_NOFLAGS		0x0000L
+#define NWUO_ACC_MASK		0x0003L
+#define 	NWUO_EXCL		0x00000001L
+#define		NWUO_SHARED		0x00000002L
+#define		NWUO_COPY		0x00000003L
+#define NWUO_LOCPORT_MASK	0x000CL
+#define		NWUO_LP_SEL		0x00000004L
+#define		NWUO_LP_SET		0x00000008L
+#define		NWUO_LP_ANY		0x0000000CL
+#define NWUO_LOCADDR_MASK	0x0010L
+#define		NWUO_EN_LOC		0x00000010L
+#define		NWUO_DI_LOC		0x00100000L
+#define NWUO_BROAD_MASK		0x0020L
+#define 	NWUO_EN_BROAD		0x00000020L
+#define		NWUO_DI_BROAD		0x00200000L
+#define NWUO_REMPORT_MASK	0x0100L
+#define		NWUO_RP_SET		0x00000100L
+#define		NWUO_RP_ANY		0x01000000L
+#define NWUO_REMADDR_MASK	0x0200L
+#define 	NWUO_RA_SET		0x00000200L
+#define		NWUO_RA_ANY		0x02000000L
+#define NWUO_RW_MASK		0x1000L
+#define		NWUO_RWDATONLY		0x00001000L
+#define		NWUO_RWDATALL		0x10000000L
+#define NWUO_IPOPT_MASK		0x2000L
+#define		NWUO_EN_IPOPT		0x00002000L
+#define		NWUO_DI_IPOPT		0x20000000L
+
+#endif /* __SERVER__IP__GEN__UDP_IO_H__ */

Property changes on: lab4/.minix-src/include/net/gen/udp_io.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/bpfdesc.h
===================================================================
--- lab4/.minix-src/include/net/bpfdesc.h	(nonexistent)
+++ lab4/.minix-src/include/net/bpfdesc.h	(revision 13)
@@ -0,0 +1,148 @@
+/*	$NetBSD: bpfdesc.h,v 1.38 2013/11/15 00:12:44 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1990, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from the Stanford/CMU enet packet filter,
+ * (net/enet.c) distributed as part of 4.3BSD, and code contributed
+ * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
+ * Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)bpfdesc.h	8.1 (Berkeley) 6/10/93
+ *
+ * @(#) Header: bpfdesc.h,v 1.14 96/06/16 22:28:07 leres Exp  (LBL)
+ */
+
+#ifndef _NET_BPFDESC_H_
+#define _NET_BPFDESC_H_
+
+#include <sys/callout.h>
+#include <sys/selinfo.h>		/* for struct selinfo */
+#include <net/if.h>			/* for IFNAMSIZ */
+#include <net/bpfjit.h>			/* for bpfjit_function_t */
+
+/*
+ * Descriptor associated with each open bpf file.
+ */
+struct bpf_d {
+	struct bpf_d	*bd_next;	/* Linked list of descriptors */
+	/*
+	 * Buffer slots: two mbuf clusters buffer the incoming packets.
+	 *   The model has three slots.  Sbuf is always occupied.
+	 *   sbuf (store) - Receive interrupt puts packets here.
+	 *   hbuf (hold) - When sbuf is full, put cluster here and
+	 *                 wakeup read (replace sbuf with fbuf).
+	 *   fbuf (free) - When read is done, put cluster here.
+	 * On receiving, if sbuf is full and fbuf is 0, packet is dropped.
+	 */
+	void *		bd_sbuf;	/* store slot */
+	void *		bd_hbuf;	/* hold slot */
+	void *		bd_fbuf;	/* free slot */
+	int 		bd_slen;	/* current length of store buffer */
+	int 		bd_hlen;	/* current length of hold buffer */
+
+	int		bd_bufsize;	/* absolute length of buffers */
+
+	struct bpf_if *	bd_bif;		/* interface descriptor */
+	u_long		bd_rtout;	/* Read timeout in 'ticks' */
+	struct bpf_insn *bd_filter; 	/* filter code */
+	u_long		bd_rcount;	/* number of packets received */
+	u_long		bd_dcount;	/* number of packets dropped */
+	u_long		bd_ccount;	/* number of packets captured */
+
+	u_char		bd_promisc;	/* true if listening promiscuously */
+	u_char		bd_state;	/* idle, waiting, or timed out */
+	u_char		bd_immediate;	/* true to return on packet arrival */
+	int		bd_hdrcmplt;	/* false to fill in src lladdr */
+	int		bd_seesent;	/* true if bpf should see sent packets */
+	int 		bd_feedback;	/* true to feed back sent packets */
+	int		bd_async;	/* non-zero if packet reception should generate signal */
+	pid_t		bd_pgid;	/* process or group id for signal */
+#if BSD < 199103
+	u_char		bd_selcoll;	/* true if selects collide */
+	int		bd_timedout;
+	struct proc *	bd_selproc;	/* process that last selected us */
+#else
+	u_char		bd_pad;		/* explicit alignment */
+	struct selinfo	bd_sel;		/* bsd select info */
+#endif
+	callout_t	bd_callout;	/* for BPF timeouts with select */
+	pid_t		bd_pid;		/* corresponding PID */
+	LIST_ENTRY(bpf_d) bd_list;	/* list of all BPF's */
+	void		*bd_sih;	/* soft interrupt handle */
+	struct timespec bd_atime;	/* access time */
+	struct timespec bd_mtime;	/* modification time */
+	struct timespec bd_btime;	/* birth time */
+#ifdef _LP64
+	int		bd_compat32;	/* 32-bit stream on LP64 system */
+#endif
+	bpfjit_func_t	bd_jitcode;	/* compiled filter program */
+};
+
+
+/* Values for bd_state */
+#define BPF_IDLE	0		/* no select in progress */
+#define BPF_WAITING	1		/* waiting for read timeout in select */
+#define BPF_TIMED_OUT	2		/* read timeout has expired in select */
+
+/*
+ * Description associated with the external representation of each
+ * open bpf file.
+ */
+struct bpf_d_ext {
+	int32_t		bde_bufsize;
+	uint8_t		bde_promisc;
+	uint8_t		bde_state;
+	uint8_t		bde_immediate;
+	int32_t		bde_hdrcmplt;
+	int32_t		bde_seesent;
+	pid_t		bde_pid;
+	uint64_t	bde_rcount;		/* number of packets received */
+	uint64_t	bde_dcount;		/* number of packets dropped */
+	uint64_t	bde_ccount;		/* number of packets captured */
+	char		bde_ifname[IFNAMSIZ];
+};
+
+
+/*
+ * Descriptor associated with each attached hardware interface.
+ */
+struct bpf_if {
+	struct bpf_if *bif_next;	/* list of all interfaces */
+	struct bpf_d *bif_dlist;	/* descriptor list */
+	struct bpf_if **bif_driverp;	/* pointer into softc */
+	u_int bif_dlt;			/* link layer type */
+	u_int bif_hdrlen;		/* length of header (with padding) */
+	struct ifnet *bif_ifp;		/* corresponding interface */
+};
+
+#ifdef _KERNEL
+int	 bpf_setf(struct bpf_d *, struct bpf_program *);
+#endif
+
+#endif /* !_NET_BPFDESC_H_ */

Property changes on: lab4/.minix-src/include/net/bpfdesc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/hton.h
===================================================================
--- lab4/.minix-src/include/net/hton.h	(nonexistent)
+++ lab4/.minix-src/include/net/hton.h	(revision 13)
@@ -0,0 +1,5 @@
+/*
+ * Dummy file for Minix old includes compatibility.
+ */
+#include <sys/cdefs.h>
+#include <sys/endian.h>

Property changes on: lab4/.minix-src/include/net/hton.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/u64.h
===================================================================
--- lab4/.minix-src/include/minix/u64.h	(nonexistent)
+++ lab4/.minix-src/include/minix/u64.h	(revision 13)
@@ -0,0 +1,25 @@
+/*	minix/u64.h					Author: Kees J. Bot
+ *								7 Dec 1995
+ * Functions to manipulate 64 bit disk addresses.
+ */
+#ifndef _MINIX__U64_H
+#define _MINIX__U64_H
+
+#include <sys/types.h>
+
+static inline unsigned long ex64lo(u64_t i)
+{
+	return (unsigned long)i;
+}
+
+static inline unsigned long ex64hi(u64_t i)
+{
+	return (unsigned long)(i>>32);
+}
+
+static inline u64_t make64(unsigned long lo, unsigned long hi)
+{
+	return ((u64_t)hi << 32) | (u64_t)lo;
+}
+
+#endif /* _MINIX__U64_H */

Property changes on: lab4/.minix-src/include/minix/u64.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/vbox.h
===================================================================
--- lab4/.minix-src/include/minix/vbox.h	(nonexistent)
+++ lab4/.minix-src/include/minix/vbox.h	(revision 13)
@@ -0,0 +1,27 @@
+#ifndef _MINIX_VBOX_H
+#define _MINIX_VBOX_H
+
+#include <minix/vboxtype.h>
+
+typedef int vbox_conn_t;
+
+extern int vbox_init(void);
+
+extern vbox_conn_t vbox_open(const char *name);
+extern int vbox_close(vbox_conn_t conn);
+extern int vbox_call(vbox_conn_t conn, u32_t function, vbox_param_t *param,
+	int count, int *code);
+
+extern void vbox_set_u32(vbox_param_t *param, u32_t value);
+extern void vbox_set_u64(vbox_param_t *param, u64_t value);
+extern void vbox_set_ptr(vbox_param_t *param, void *ptr, size_t size,
+	unsigned int dir);
+extern void vbox_set_grant(vbox_param_t *param, endpoint_t endpt,
+	cp_grant_id_t grant, size_t off, size_t size, unsigned int dir);
+
+extern u32_t vbox_get_u32(vbox_param_t *param);
+extern u64_t vbox_get_u64(vbox_param_t *param);
+
+extern void vbox_put(vbox_param_t *param, int count);
+
+#endif /* _MINIX_VBOX_H */

Property changes on: lab4/.minix-src/include/minix/vbox.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/minix/vfsif.h
===================================================================
--- lab4/.minix-src/include/minix/vfsif.h	(nonexistent)
+++ lab4/.minix-src/include/minix/vfsif.h	(revision 13)
@@ -0,0 +1,84 @@
+#ifndef __MINIX_VFSIF_H
+#define __MINIX_VFSIF_H
+
+#include <sys/types.h>
+#include <limits.h>
+
+/* VFS/FS flags */
+#define REQ_RDONLY		001	/* FS is mounted read-only */
+#define REQ_ISROOT		002	/* FS is root file system */
+
+#define PATH_NOFLAGS		000
+#define PATH_RET_SYMLINK	010	/* Return a symlink object (i.e.
+					 * do not continue with the contents
+					 * of the symlink if it is the last
+					 * component in a path). */
+#define PATH_GET_UCRED		020	/* Request provides a grant ID in m9_l1
+					 * and struct ucred size in m9_s4 (as
+					 * opposed to a REQ_UID). */
+
+#define RES_NOFLAGS		000
+#define RES_THREADED		001	/* FS supports multithreading */
+#define RES_HASPEEK		002	/* FS implements REQ_PEEK/REQ_BPEEK */
+#define RES_64BIT		004	/* FS can handle 64-bit file sizes */
+
+/* VFS/FS error messages */
+#define EENTERMOUNT              (-301)
+#define ELEAVEMOUNT              (-302)
+#define ESYMLINK                 (-303)
+
+/* VFS/FS types */
+
+/* User credential structure */
+typedef struct {
+	uid_t vu_uid;
+	gid_t vu_gid;
+	int vu_ngroups;
+	gid_t vu_sgroups[NGROUPS_MAX];
+} vfs_ucred_t;
+
+/* Request numbers */
+#define REQ_GETNODE	(FS_BASE + 1)	/* Should be removed */
+#define REQ_PUTNODE	(FS_BASE + 2)
+#define REQ_SLINK	(FS_BASE + 3)
+#define REQ_FTRUNC	(FS_BASE + 4)
+#define REQ_CHOWN	(FS_BASE + 5)
+#define REQ_CHMOD	(FS_BASE + 6)
+#define REQ_INHIBREAD	(FS_BASE + 7)
+#define REQ_STAT	(FS_BASE + 8)
+#define REQ_UTIME	(FS_BASE + 9)
+#define REQ_STATVFS	(FS_BASE + 10)
+#define REQ_BREAD	(FS_BASE + 11)
+#define REQ_BWRITE	(FS_BASE + 12)
+#define REQ_UNLINK	(FS_BASE + 13)
+#define REQ_RMDIR	(FS_BASE + 14)
+#define REQ_UNMOUNT	(FS_BASE + 15)
+#define REQ_SYNC	(FS_BASE + 16)
+#define REQ_NEW_DRIVER	(FS_BASE + 17)
+#define REQ_FLUSH	(FS_BASE + 18)
+#define REQ_READ	(FS_BASE + 19)
+#define REQ_WRITE	(FS_BASE + 20)
+#define REQ_MKNOD	(FS_BASE + 21)
+#define REQ_MKDIR	(FS_BASE + 22)
+#define REQ_CREATE	(FS_BASE + 23)
+#define REQ_LINK	(FS_BASE + 24)
+#define REQ_RENAME	(FS_BASE + 25)
+#define REQ_LOOKUP	(FS_BASE + 26)
+#define REQ_MOUNTPOINT	(FS_BASE + 27)
+#define REQ_READSUPER	(FS_BASE + 28)
+#define REQ_NEWNODE	(FS_BASE + 29)
+#define REQ_RDLINK	(FS_BASE + 30)
+#define REQ_GETDENTS	(FS_BASE + 31)
+#define REQ_PEEK	(FS_BASE + 32)
+#define REQ_BPEEK	(FS_BASE + 33)
+
+#define NREQS			    34
+
+#define IS_FS_RQ(type) (((type) & ~0xff) == FS_BASE)
+
+#define TRNS_GET_ID(t)		((t) & 0xFFFF)
+#define TRNS_ADD_ID(t,id)	(((t) << 16) | ((id) & 0xFFFF))
+#define TRNS_DEL_ID(t)		((short)((t) >> 16))
+
+#endif
+

Property changes on: lab4/.minix-src/include/minix/vfsif.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/socket.h
===================================================================
--- lab4/.minix-src/include/net/gen/socket.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/socket.h	(revision 13)
@@ -0,0 +1,42 @@
+/*
+server/ip/gen/socket.h
+*/
+
+#ifndef __SERVER__IP__GEN__SOCKET_H__
+#define __SERVER__IP__GEN__SOCKET_H__
+
+/* From SunOS: /usr/include/sys/socketh */
+
+/*
+ * Address families.
+ */
+#define	AF_UNSPEC	0		/* unspecified */
+#define	AF_UNIX		1		/* local to host (pipes, portals) */
+#define	AF_INET		2		/* internetwork: UDP, TCP, etc. */
+#define	AF_IMPLINK	3		/* arpanet imp addresses */
+#define	AF_PUP		4		/* pup protocols: e.g. BSP */
+#define	AF_CHAOS	5		/* mit CHAOS protocols */
+#define	AF_NS		6		/* XEROX NS protocols */
+#define	AF_NBS		7		/* nbs protocols */
+#define	AF_ECMA		8		/* european computer manufacturers */
+#define	AF_DATAKIT	9		/* datakit protocols */
+#define	AF_CCITT	10		/* CCITT protocols, X.25 etc */
+#define	AF_SNA		11		/* IBM SNA */
+#define	AF_DECnet	12		/* DECnet */
+#define	AF_DLI		13		/* Direct data link interface */
+#define	AF_LAT		14		/* LAT */
+#define	AF_HYLINK	15		/* NSC Hyperchannel */
+#define	AF_APPLETALK	16		/* Apple Talk */
+
+#define	AF_NIT		17		/* Network Interface Tap */
+#define	AF_802		18		/* IEEE 802.2, also ISO 8802 */
+#define	AF_OSI		19		/* umbrella for all families used
+					 * by OSI (e.g. protosw lookup) */
+#define	AF_X25		20		/* CCITT X.25 in particular */
+#define	AF_OSINET	21		/* AFI = 47, IDI = 4 */
+#define	AF_GOSIP	22		/* U.S. Government OSI */
+#define	AF_INET6	23		/* IP version 6 */
+
+#define	AF_MAX		23
+
+#endif /* __SERVER__IP__GEN__SOCKET_H__ */

Property changes on: lab4/.minix-src/include/net/gen/socket.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/udp.h
===================================================================
--- lab4/.minix-src/include/net/gen/udp.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/udp.h	(revision 13)
@@ -0,0 +1,13 @@
+/*
+server/ip/gen/udp.h
+*/
+
+#ifndef __SERVER__IP__GEN__UDP_H__
+#define __SERVER__IP__GEN__UDP_H__
+
+typedef u16_t udpport_t;
+
+#define UDP_HDR_SIZE	8
+#define UDP_IO_HDR_SIZE	16
+
+#endif /* __SERVER__IP__GEN__UDP_H__ */

Property changes on: lab4/.minix-src/include/net/gen/udp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/vjhc.h
===================================================================
--- lab4/.minix-src/include/net/gen/vjhc.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/vjhc.h	(revision 13)
@@ -0,0 +1,85 @@
+/*
+net/gen/vjhc.h
+
+Defines for Van Jacobson TCP/IP Header Compression as defined in RFC-1144
+
+Created:	Nov 15, 1993 by Philip Homburg <philip@cs.vu.nl>
+*/
+
+#ifndef __NET__GEN__VJHC_H__
+#define __NET__GEN__VJHC_H__
+
+#define VJHC_FLAG_U	0x01
+#define VJHC_FLAG_W	0x02
+#define VJHC_FLAG_A	0x04
+#define VJHC_FLAG_S	0x08
+#define VJHC_FLAG_P	0x10
+#define VJHC_FLAG_I	0x20
+#define VJHC_FLAG_C	0x40
+
+#define VJHC_SPEC_I	(VJHC_FLAG_S | VJHC_FLAG_W | VJHC_FLAG_U)
+#define VJHC_SPEC_D	(VJHC_FLAG_S | VJHC_FLAG_A | VJHC_FLAG_W | VJHC_FLAG_U)
+#define VJHC_SPEC_MASK	(VJHC_FLAG_S | VJHC_FLAG_A | VJHC_FLAG_W | VJHC_FLAG_U)
+
+#define VJHC_ENCODE(cp, n) \
+{ \
+	if ((u16_t)(n) >= 256) \
+	{ \
+		*(cp)++= 0; \
+		*(cp)++= (n >> 8); \
+		*(cp)++= (n); \
+	} \
+	else \
+		*(cp)++= (n); \
+}
+
+#define VJHC_ENCODEZ(cp, n) \
+{ \
+	if ((u16_t)(n) == 0 || (u16_t)(n) >= 256) \
+	{ \
+		*(cp)++= 0; \
+		*(cp)++= (n >> 8); \
+		*(cp)++= (n); \
+	} \
+	else \
+		*(cp)++= (n); \
+}
+
+#define VJHC_DECODEL(cp, l) \
+{ \
+	if (*(cp) == 0) \
+	{ \
+		(l)= htonl(ntohl((l)) + (((cp)[1] << 8) | (cp)[2])); \
+		(cp) += 3; \
+	} \
+	else \
+		(l)= htonl(ntohl((l)) + (u32_t)*(cp)++); \
+}
+
+#define VJHC_DECODES(cp, s) \
+{ \
+	if (*(cp) == 0) \
+	{ \
+		(s)= htons(ntohs((s)) + (((cp)[1] << 8) | (cp)[2])); \
+		(cp) += 3; \
+	} \
+	else \
+		(s)= htons(ntohs((s)) + (u16_t)*(cp)++); \
+}
+
+#define VJHC_DECODEU(cp, s) \
+{ \
+	if (*(cp) == 0) \
+	{ \
+		(s)= htons(((cp)[1] << 8) | (cp)[2]); \
+		(cp) += 3; \
+	} \
+	else \
+		(s)= htons((u16_t)*(cp)++); \
+}
+
+#endif /* __NET__GEN__VJHC_H__ */
+
+/*
+ * $PchId: vjhc.h,v 1.2 1995/11/17 22:14:46 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/vjhc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/in.h
===================================================================
--- lab4/.minix-src/include/net/gen/in.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/in.h	(revision 13)
@@ -0,0 +1,40 @@
+/*
+server/ip/gen/in.h
+*/
+
+#ifndef __SERVER__IP__GEN__IN_H__
+#define __SERVER__IP__GEN__IN_H__
+
+#include <net/gen/in.h>
+#include <sys/types.h>
+
+#define IP_MIN_HDR_SIZE		20
+#define IP_MAX_HDR_SIZE		60		/* 15 * 4 */
+#define IP_VERSION		4
+#define IP_DEF_TTL		64
+#define IP_MAX_TTL		255
+#define IP_DEF_MTU		576
+#define IP_MIN_MTU		(IP_MAX_HDR_SIZE+8)
+#define IP_MAX_PACKSIZE		40000
+	/* Note: this restriction is not part of the IP-protocol but
+	   introduced by this implementation. */
+
+#define IPPROTO_ICMP		1
+#define IPPROTO_TCP		6
+#define IPPROTO_UDP		17
+
+#define IP_MC_ALL_SYSTEMS	0xE0000001	/* 224.0.0.1 */
+
+typedef u32_t ipaddr_t;
+typedef u8_t ipproto_t;
+typedef struct ip_hdropt
+{
+	u8_t iho_opt_siz;
+	u8_t iho_data[IP_MAX_HDR_SIZE-IP_MIN_HDR_SIZE];
+} ip_hdropt_t;
+
+#endif /* __SERVER__IP__GEN__IN_H__ */
+
+/*
+ * $PchId: in.h,v 1.6 2002/06/10 07:11:15 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/in.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/oneCsum.h
===================================================================
--- lab4/.minix-src/include/net/gen/oneCsum.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/oneCsum.h	(revision 13)
@@ -0,0 +1,10 @@
+/*
+server/ip/gen/oneCsum.h
+*/
+
+#ifndef __SERVER__IP__GEN__ONECSUM_H__
+#define __SERVER__IP__GEN__ONECSUM_H__
+
+u16_t oneC_sum( u16_t prev, void *data, size_t data_len );
+
+#endif /* __SERVER__IP__GEN__ONECSUM_H__ */

Property changes on: lab4/.minix-src/include/net/gen/oneCsum.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/if_ether.h
===================================================================
--- lab4/.minix-src/include/net/if_ether.h	(nonexistent)
+++ lab4/.minix-src/include/net/if_ether.h	(revision 13)
@@ -0,0 +1,362 @@
+/*	$NetBSD: if_ether.h,v 1.64 2014/07/28 14:24:48 ozaki-r Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)if_ether.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NET_IF_ETHER_H_
+#define _NET_IF_ETHER_H_
+
+#ifdef _KERNEL
+#ifdef _KERNEL_OPT
+#include "opt_mbuftrace.h"
+#endif
+#include <sys/mbuf.h>
+#endif
+
+#ifndef _STANDALONE
+#include <net/if.h>
+#endif
+
+/*
+ * Some basic Ethernet constants.
+ */
+#define	ETHER_ADDR_LEN	6	/* length of an Ethernet address */
+#define	ETHER_TYPE_LEN	2	/* length of the Ethernet type field */
+#define	ETHER_CRC_LEN	4	/* length of the Ethernet CRC */
+#define	ETHER_HDR_LEN	((ETHER_ADDR_LEN * 2) + ETHER_TYPE_LEN)
+#define	ETHER_MIN_LEN	64	/* minimum frame length, including CRC */
+#define	ETHER_MAX_LEN	1518	/* maximum frame length, including CRC */
+#define	ETHER_MAX_LEN_JUMBO 9018 /* maximum jumbo frame len, including CRC */
+
+/*
+ * Some Ethernet extensions.
+ */
+#define	ETHER_VLAN_ENCAP_LEN 4	/* length of 802.1Q VLAN encapsulation */
+#define	ETHER_PPPOE_ENCAP_LEN 8	/* length of PPPoE encapsulation */
+
+/*
+ * Ethernet address - 6 octets
+ * this is only used by the ethers(3) functions.
+ */
+struct ether_addr {
+	uint8_t ether_addr_octet[ETHER_ADDR_LEN];
+} __packed;
+
+#if defined(__minix)
+#define ea_addr ether_addr_octet
+typedef struct ether_addr ether_addr_t;
+#endif /* defined(__minix) */
+
+/*
+ * Structure of a 10Mb/s Ethernet header.
+ */
+struct ether_header {
+	uint8_t  ether_dhost[ETHER_ADDR_LEN];
+	uint8_t  ether_shost[ETHER_ADDR_LEN];
+	uint16_t ether_type;
+} __packed;
+
+#include <net/ethertypes.h>
+
+#define	ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
+#define	ETHER_IS_LOCAL(addr) (*(addr) & 0x02) /* is address local? */
+
+#define	ETHERMTU_JUMBO	(ETHER_MAX_LEN_JUMBO - ETHER_HDR_LEN - ETHER_CRC_LEN)
+#define	ETHERMTU	(ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+#define	ETHERMIN	(ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+
+/*
+ * Compute the maximum frame size based on ethertype (i.e. possible
+ * encapsulation) and whether or not an FCS is present.
+ */
+#define	ETHER_MAX_FRAME(ifp, etype, hasfcs)				\
+	((ifp)->if_mtu + ETHER_HDR_LEN +				\
+	 ((hasfcs) ? ETHER_CRC_LEN : 0) +				\
+	 (((etype) == ETHERTYPE_VLAN) ? ETHER_VLAN_ENCAP_LEN : 0) +	\
+	 (((etype) == ETHERTYPE_PPPOE) ? ETHER_PPPOE_ENCAP_LEN : 0))
+
+/*
+ * Ethernet CRC32 polynomials (big- and little-endian verions).
+ */
+#define	ETHER_CRC_POLY_LE	0xedb88320
+#define	ETHER_CRC_POLY_BE	0x04c11db6
+
+#ifndef _STANDALONE
+
+/*
+ * Ethernet-specific mbuf flags.
+ */
+#define	M_HASFCS	M_LINK0	/* FCS included at end of frame */
+#define	M_PROMISC	M_LINK1	/* this packet is not for us */
+
+#ifdef _KERNEL
+/*
+ * Macro to map an IP multicast address to an Ethernet multicast address.
+ * The high-order 25 bits of the Ethernet address are statically assigned,
+ * and the low-order 23 bits are taken from the low end of the IP address.
+ */
+#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr)				\
+	/* const struct in_addr *ipaddr; */				\
+	/* uint8_t enaddr[ETHER_ADDR_LEN]; */				\
+do {									\
+	(enaddr)[0] = 0x01;						\
+	(enaddr)[1] = 0x00;						\
+	(enaddr)[2] = 0x5e;						\
+	(enaddr)[3] = ((const uint8_t *)ipaddr)[1] & 0x7f;		\
+	(enaddr)[4] = ((const uint8_t *)ipaddr)[2];			\
+	(enaddr)[5] = ((const uint8_t *)ipaddr)[3];			\
+} while (/*CONSTCOND*/0)
+/*
+ * Macro to map an IP6 multicast address to an Ethernet multicast address.
+ * The high-order 16 bits of the Ethernet address are statically assigned,
+ * and the low-order 32 bits are taken from the low end of the IP6 address.
+ */
+#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr)			\
+	/* struct in6_addr *ip6addr; */					\
+	/* uint8_t enaddr[ETHER_ADDR_LEN]; */				\
+{                                                                       \
+	(enaddr)[0] = 0x33;						\
+	(enaddr)[1] = 0x33;						\
+	(enaddr)[2] = ((const uint8_t *)ip6addr)[12];			\
+	(enaddr)[3] = ((const uint8_t *)ip6addr)[13];			\
+	(enaddr)[4] = ((const uint8_t *)ip6addr)[14];			\
+	(enaddr)[5] = ((const uint8_t *)ip6addr)[15];			\
+}
+#endif
+
+struct mii_data;
+
+struct ethercom;
+
+typedef int (*ether_cb_t)(struct ethercom *);
+
+/*
+ * Structure shared between the ethernet driver modules and
+ * the multicast list code.  For example, each ec_softc or il_softc
+ * begins with this structure.
+ */
+struct ethercom {
+	struct	ifnet ec_if;			/* network-visible interface */
+	LIST_HEAD(, ether_multi) ec_multiaddrs;	/* list of ether multicast
+						   addrs */
+	int	ec_multicnt;			/* length of ec_multiaddrs
+						   list */
+	int	ec_capabilities;		/* capabilities, provided by
+						   driver */
+	int	ec_capenable;			/* tells hardware which
+						   capabilities to enable */
+
+	int	ec_nvlans;			/* # VLANs on this interface */
+	/* The device handle for the MII bus child device. */
+	struct mii_data				*ec_mii;
+	/* Called after a change to ec_if.if_flags.  Returns
+	 * ENETRESET if the device should be reinitialized with
+	 * ec_if.if_init, 0 on success, not 0 on failure.
+	 */
+	ether_cb_t				ec_ifflags_cb;
+#ifdef MBUFTRACE
+	struct	mowner ec_rx_mowner;		/* mbufs received */
+	struct	mowner ec_tx_mowner;		/* mbufs transmitted */
+#endif
+};
+
+#define	ETHERCAP_VLAN_MTU	0x00000001	/* VLAN-compatible MTU */
+#define	ETHERCAP_VLAN_HWTAGGING	0x00000002	/* hardware VLAN tag support */
+#define	ETHERCAP_JUMBO_MTU	0x00000004	/* 9000 byte MTU supported */
+#define	ETHERCAP_MASK		0x00000007
+
+#define	ECCAPBITS		\
+	"\020"			\
+	"\1VLAN_MTU"		\
+	"\2VLAN_HWTAGGING"	\
+	"\3JUMBO_MTU"
+
+/* ioctl() for Ethernet capabilities */
+struct eccapreq {
+	char		eccr_name[IFNAMSIZ];	/* if name, e.g. "en0" */
+	int		eccr_capabilities;	/* supported capabiliites */
+	int		eccr_capenable;		/* capabilities enabled */
+};
+
+#ifdef	_KERNEL
+extern const uint8_t etherbroadcastaddr[ETHER_ADDR_LEN];
+extern const uint8_t ethermulticastaddr_slowprotocols[ETHER_ADDR_LEN];
+extern const uint8_t ether_ipmulticast_min[ETHER_ADDR_LEN];
+extern const uint8_t ether_ipmulticast_max[ETHER_ADDR_LEN];
+
+void	ether_set_ifflags_cb(struct ethercom *, ether_cb_t);
+int	ether_ioctl(struct ifnet *, u_long, void *);
+int	ether_addmulti(const struct sockaddr *, struct ethercom *);
+int	ether_delmulti(const struct sockaddr *, struct ethercom *);
+int	ether_multiaddr(const struct sockaddr *, uint8_t[], uint8_t[]);
+void    ether_input(struct ifnet *, struct mbuf *);
+#endif /* _KERNEL */
+
+/*
+ * Ethernet multicast address structure.  There is one of these for each
+ * multicast address or range of multicast addresses that we are supposed
+ * to listen to on a particular interface.  They are kept in a linked list,
+ * rooted in the interface's ethercom structure.
+ */
+struct ether_multi {
+	uint8_t enm_addrlo[ETHER_ADDR_LEN]; /* low  or only address of range */
+	uint8_t enm_addrhi[ETHER_ADDR_LEN]; /* high or only address of range */
+	u_int	 enm_refcount;		/* no. claims to this addr/range */
+	LIST_ENTRY(ether_multi) enm_list;
+};
+
+struct ether_multi_sysctl {
+	u_int   enm_refcount;
+	uint8_t enm_addrlo[ETHER_ADDR_LEN];
+	uint8_t enm_addrhi[ETHER_ADDR_LEN];
+};
+
+/*
+ * Structure used by macros below to remember position when stepping through
+ * all of the ether_multi records.
+ */
+struct ether_multistep {
+	struct ether_multi  *e_enm;
+};
+
+/*
+ * Macro for looking up the ether_multi record for a given range of Ethernet
+ * multicast addresses connected to a given ethercom structure.  If no matching
+ * record is found, "enm" returns NULL.
+ */
+#define ETHER_LOOKUP_MULTI(addrlo, addrhi, ec, enm)			\
+	/* uint8_t addrlo[ETHER_ADDR_LEN]; */				\
+	/* uint8_t addrhi[ETHER_ADDR_LEN]; */				\
+	/* struct ethercom *ec; */					\
+	/* struct ether_multi *enm; */					\
+{									\
+	for ((enm) = LIST_FIRST(&(ec)->ec_multiaddrs);			\
+	    (enm) != NULL &&						\
+	    (memcmp((enm)->enm_addrlo, (addrlo), ETHER_ADDR_LEN) != 0 ||	\
+	     memcmp((enm)->enm_addrhi, (addrhi), ETHER_ADDR_LEN) != 0);	\
+		(enm) = LIST_NEXT((enm), enm_list));			\
+}
+
+/*
+ * Macro to step through all of the ether_multi records, one at a time.
+ * The current position is remembered in "step", which the caller must
+ * provide.  ETHER_FIRST_MULTI(), below, must be called to initialize "step"
+ * and get the first record.  Both macros return a NULL "enm" when there
+ * are no remaining records.
+ */
+#define ETHER_NEXT_MULTI(step, enm) \
+	/* struct ether_multistep step; */  \
+	/* struct ether_multi *enm; */  \
+{ \
+	if (((enm) = (step).e_enm) != NULL) \
+		(step).e_enm = LIST_NEXT((enm), enm_list); \
+}
+
+#define ETHER_FIRST_MULTI(step, ec, enm) \
+	/* struct ether_multistep step; */ \
+	/* struct ethercom *ec; */ \
+	/* struct ether_multi *enm; */ \
+{ \
+	(step).e_enm = LIST_FIRST(&(ec)->ec_multiaddrs); \
+	ETHER_NEXT_MULTI((step), (enm)); \
+}
+
+#ifdef _KERNEL
+
+/*
+ * Ethernet 802.1Q VLAN structures.
+ */
+
+/* add VLAN tag to input/received packet */
+static inline int vlan_input_tag(struct ifnet *, struct mbuf *, u_int);
+static inline int
+vlan_input_tag(struct ifnet *ifp, struct mbuf *m, u_int vlanid)
+{
+	struct m_tag *mtag;
+	mtag = m_tag_get(PACKET_TAG_VLAN, sizeof(u_int), M_NOWAIT);
+	if (mtag == NULL) {
+		ifp->if_ierrors++;
+		printf("%s: unable to allocate VLAN tag\n", ifp->if_xname);
+		m_freem(m);
+		return 1;
+	}
+	*(u_int *)(mtag + 1) = vlanid;
+	m_tag_prepend(m, mtag);
+	return 0;
+}
+
+#define VLAN_INPUT_TAG(ifp, m, vlanid, _errcase)		\
+    if (vlan_input_tag(ifp, m, vlanid) != 0) {	 		\
+	_errcase;						\
+    }
+
+/* extract VLAN tag from output/trasmit packet */
+#define VLAN_OUTPUT_TAG(ec, m0)			\
+	(VLAN_ATTACHED(ec) ? m_tag_find((m0), PACKET_TAG_VLAN, NULL) : NULL)
+
+/* extract VLAN ID value from a VLAN tag */
+#define VLAN_TAG_VALUE(mtag)	\
+	((*(u_int *)(mtag + 1)) & 4095)
+
+/* test if any VLAN is configured for this interface */
+#define VLAN_ATTACHED(ec)	((ec)->ec_nvlans > 0)
+
+void	etherinit(void);
+void	ether_ifattach(struct ifnet *, const uint8_t *);
+void	ether_ifdetach(struct ifnet *);
+int	ether_mediachange(struct ifnet *);
+void	ether_mediastatus(struct ifnet *, struct ifmediareq *);
+
+char	*ether_sprintf(const uint8_t *);
+char	*ether_snprintf(char *, size_t, const uint8_t *);
+
+uint32_t ether_crc32_le(const uint8_t *, size_t);
+uint32_t ether_crc32_be(const uint8_t *, size_t);
+
+int	ether_aton_r(u_char *, size_t, const char *);
+#else
+/*
+ * Prototype ethers(3) functions.
+ */
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+char *	ether_ntoa(const struct ether_addr *);
+struct ether_addr *
+	ether_aton(const char *);
+int	ether_ntohost(char *, const struct ether_addr *);
+int	ether_hostton(const char *, struct ether_addr *);
+int	ether_line(const char *, struct ether_addr *, char *);
+__END_DECLS
+#endif
+
+#endif /* _STANDALONE */
+
+#endif /* !_NET_IF_ETHER_H_ */

Property changes on: lab4/.minix-src/include/net/if_ether.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/if_types.h
===================================================================
--- lab4/.minix-src/include/net/if_types.h	(nonexistent)
+++ lab4/.minix-src/include/net/if_types.h	(revision 13)
@@ -0,0 +1,268 @@
+/*	$NetBSD: if_types.h,v 1.26 2012/08/05 21:21:41 wiz Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)if_types.h	8.3 (Berkeley) 4/28/95
+ */
+
+#ifndef _NET_IF_TYPES_H_
+#define _NET_IF_TYPES_H_
+
+/*
+ * Interface types for benefit of parsing media address headers.
+ * This list is derived from the SNMP list of ifTypes, originally
+ * documented in RFC1573, now maintained as:
+ *
+ * <URL:http://www.iana.org/assignments/smi-numbers>
+ */
+
+#define	IFT_OTHER	0x1		/* none of the following */
+#define	IFT_1822	0x2		/* old-style arpanet imp */
+#define	IFT_HDH1822	0x3		/* HDH arpanet imp */
+#define	IFT_X25DDN	0x4		/* x25 to imp */
+#define	IFT_X25		0x5		/* PDN X25 interface (RFC877) */
+#define	IFT_ETHER	0x6		/* Ethernet CSMA/CD */
+#define	IFT_ISO88023	0x7		/* CSMA/CD */
+#define	IFT_ISO88024	0x8		/* Token Bus */
+#define	IFT_ISO88025	0x9		/* Token Ring */
+#define	IFT_ISO88026	0xa		/* MAN */
+#define	IFT_STARLAN	0xb
+#define	IFT_P10		0xc		/* Proteon 10MBit ring */
+#define	IFT_P80		0xd		/* Proteon 80MBit ring */
+#define	IFT_HY		0xe		/* Hyperchannel */
+#define	IFT_FDDI	0xf
+#define	IFT_LAPB	0x10
+#define	IFT_SDLC	0x11
+#define	IFT_T1		0x12
+#define	IFT_CEPT	0x13		/* E1 - european T1 */
+#define	IFT_ISDNBASIC	0x14
+#define	IFT_ISDNPRIMARY	0x15
+#define	IFT_PTPSERIAL	0x16		/* Proprietary PTP serial */
+#define	IFT_PPP		0x17		/* RFC 1331 */
+#define	IFT_LOOP	0x18		/* loopback */
+#define	IFT_EON		0x19		/* ISO over IP */
+#define	IFT_XETHER	0x1a		/* obsolete 3MB experimental ethernet */
+#define	IFT_NSIP	0x1b		/* XNS over IP */
+#define	IFT_SLIP	0x1c		/* IP over generic TTY */
+#define	IFT_ULTRA	0x1d		/* Ultra Technologies */
+#define	IFT_DS3		0x1e		/* Generic T3 */
+#define	IFT_SIP		0x1f		/* SMDS */
+#define	IFT_FRELAY	0x20		/* Frame Relay DTE only */
+#define	IFT_RS232	0x21
+#define	IFT_PARA	0x22		/* parallel-port */
+#define	IFT_ARCNET	0x23
+#define	IFT_ARCNETPLUS	0x24
+#define	IFT_ATM		0x25		/* ATM cells */
+#define	IFT_MIOX25	0x26
+#define	IFT_SONET	0x27		/* SONET or SDH */
+#define	IFT_X25PLE	0x28
+#define	IFT_ISO88022LLC	0x29
+#define	IFT_LOCALTALK	0x2a
+#define	IFT_SMDSDXI	0x2b
+#define	IFT_FRELAYDCE	0x2c		/* Frame Relay DCE */
+#define	IFT_V35		0x2d
+#define	IFT_HSSI	0x2e
+#define	IFT_HIPPI	0x2f
+#define	IFT_MODEM	0x30		/* Generic Modem */
+#define	IFT_AAL5	0x31		/* AAL5 over ATM */
+#define	IFT_SONETPATH	0x32
+#define	IFT_SONETVT	0x33
+#define	IFT_SMDSICIP	0x34		/* SMDS InterCarrier Interface */
+#define	IFT_PROPVIRTUAL	0x35		/* Proprietary Virtual/internal */
+#define	IFT_PROPMUX	0x36		/* Proprietary Multiplexing */
+#define IFT_IEEE80212		   0x37 /* 100BaseVG */
+#define IFT_FIBRECHANNEL	   0x38 /* Fibre Channel */
+#define IFT_HIPPIINTERFACE	   0x39 /* HIPPI interfaces	 */
+#define IFT_FRAMERELAYINTERCONNECT 0x3a /* Obsolete, use either 0x20 or 0x2c */
+#define IFT_AFLANE8023		   0x3b /* ATM Emulated LAN for 802.3 */
+#define IFT_AFLANE8025		   0x3c /* ATM Emulated LAN for 802.5 */
+#define IFT_CCTEMUL		   0x3d /* ATM Emulated circuit		  */
+#define IFT_FASTETHER		   0x3e /* Fast Ethernet (100BaseT) */
+#define IFT_ISDN		   0x3f /* ISDN and X.25	    */
+#define IFT_V11			   0x40 /* CCITT V.11/X.21		*/
+#define IFT_V36			   0x41 /* CCITT V.36			*/
+#define IFT_G703AT64K		   0x42 /* CCITT G703 at 64Kbps */
+#define IFT_G703AT2MB		   0x43 /* Obsolete see DS1-MIB */
+#define IFT_QLLC		   0x44 /* SNA QLLC			*/
+#define IFT_FASTETHERFX		   0x45 /* Fast Ethernet (100BaseFX)	*/
+#define IFT_CHANNEL		   0x46 /* channel			*/
+#define IFT_IEEE80211		   0x47 /* radio spread spectrum	*/
+#define IFT_IBM370PARCHAN	   0x48 /* IBM System 360/370 OEMI Channel */
+#define IFT_ESCON		   0x49 /* IBM Enterprise Systems Connection */
+#define IFT_DLSW		   0x4a /* Data Link Switching */
+#define IFT_ISDNS		   0x4b /* ISDN S/T interface */
+#define IFT_ISDNU		   0x4c /* ISDN U interface */
+#define IFT_LAPD		   0x4d /* Link Access Protocol D */
+#define IFT_IPSWITCH		   0x4e /* IP Switching Objects */
+#define IFT_RSRB		   0x4f /* Remote Source Route Bridging */
+#define IFT_ATMLOGICAL		   0x50 /* ATM Logical Port */
+#define IFT_DS0			   0x51 /* Digital Signal Level 0 */
+#define IFT_DS0BUNDLE		   0x52 /* group of ds0s on the same ds1 */
+#define IFT_BSC			   0x53 /* Bisynchronous Protocol */
+#define IFT_ASYNC		   0x54 /* Asynchronous Protocol */
+#define IFT_CNR			   0x55 /* Combat Net Radio */
+#define IFT_ISO88025DTR		   0x56 /* ISO 802.5r DTR */
+#define IFT_EPLRS		   0x57 /* Ext Pos Loc Report Sys */
+#define IFT_ARAP		   0x58 /* Appletalk Remote Access Protocol */
+#define IFT_PROPCNLS		   0x59 /* Proprietary Connectionless Protocol*/
+#define IFT_HOSTPAD		   0x5a /* CCITT-ITU X.29 PAD Protocol */
+#define IFT_TERMPAD		   0x5b /* CCITT-ITU X.3 PAD Facility */
+#define IFT_FRAMERELAYMPI	   0x5c /* Multiproto Interconnect over FR */
+#define IFT_X213		   0x5d /* CCITT-ITU X213 */
+#define IFT_ADSL		   0x5e /* Asymmetric Digital Subscriber Loop */
+#define IFT_RADSL		   0x5f /* Rate-Adapt. Digital Subscriber Loop*/
+#define IFT_SDSL		   0x60 /* Symmetric Digital Subscriber Loop */
+#define IFT_VDSL		   0x61 /* Very H-Speed Digital Subscrib. Loop*/
+#define IFT_ISO88025CRFPINT	   0x62 /* ISO 802.5 CRFP */
+#define IFT_MYRINET		   0x63 /* Myricom Myrinet */
+#define IFT_VOICEEM		   0x64 /* voice recEive and transMit */
+#define IFT_VOICEFXO		   0x65 /* voice Foreign Exchange Office */
+#define IFT_VOICEFXS		   0x66 /* voice Foreign Exchange Station */
+#define IFT_VOICEENCAP		   0x67 /* voice encapsulation */
+#define IFT_VOICEOVERIP		   0x68 /* voice over IP encapsulation */
+#define IFT_ATMDXI		   0x69 /* ATM DXI */
+#define IFT_ATMFUNI		   0x6a /* ATM FUNI */
+#define IFT_ATMIMA		   0x6b /* ATM IMA		      */
+#define IFT_PPPMULTILINKBUNDLE	   0x6c /* PPP Multilink Bundle */
+#define IFT_IPOVERCDLC		   0x6d /* IBM ipOverCdlc */
+#define IFT_IPOVERCLAW		   0x6e /* IBM Common Link Access to Workstn */
+#define IFT_STACKTOSTACK	   0x6f /* IBM stackToStack */
+#define IFT_VIRTUALIPADDRESS	   0x70 /* IBM VIPA */
+#define IFT_MPC			   0x71 /* IBM multi-protocol channel support */
+#define IFT_IPOVERATM		   0x72 /* IBM ipOverAtm */
+#define IFT_ISO88025FIBER	   0x73 /* ISO 802.5j Fiber Token Ring */
+#define IFT_TDLC		   0x74 /* IBM twinaxial data link control */
+#define IFT_GIGABITETHERNET	   0x75 /* Gigabit Ethernet */
+#define IFT_HDLC		   0x76 /* HDLC */
+#define IFT_LAPF		   0x77 /* LAP F */
+#define IFT_V37			   0x78 /* V.37 */
+#define IFT_X25MLP		   0x79 /* Multi-Link Protocol */
+#define IFT_X25HUNTGROUP	   0x7a /* X25 Hunt Group */
+#define IFT_TRANSPHDLC		   0x7b /* Transp HDLC */
+#define IFT_INTERLEAVE		   0x7c /* Interleave channel */
+#define IFT_FAST		   0x7d /* Fast channel */
+#define IFT_IP			   0x7e /* IP (for APPN HPR in IP networks) */
+#define IFT_DOCSCABLEMACLAYER	   0x7f /* CATV Mac Layer */
+#define IFT_DOCSCABLEDOWNSTREAM	   0x80 /* CATV Downstream interface */
+#define IFT_DOCSCABLEUPSTREAM	   0x81 /* CATV Upstream interface */
+#define IFT_A12MPPSWITCH	   0x82	/* Avalon Parallel Processor */
+#define IFT_TUNNEL		   0x83	/* Encapsulation interface */
+#define IFT_COFFEE		   0x84	/* coffee pot */
+#define IFT_CES			   0x85	/* Circiut Emulation Service */
+#define IFT_ATMSUBINTERFACE	   0x86	/* (x)  ATM Sub Interface */
+#define IFT_L2VLAN		   0x87	/* Layer 2 Virtual LAN using 802.1Q */
+#define IFT_L3IPVLAN		   0x88	/* Layer 3 Virtual LAN - IP Protocol */
+#define IFT_L3IPXVLAN		   0x89	/* Layer 3 Virtual LAN - IPX Prot. */
+#define IFT_DIGITALPOWERLINE	   0x8a	/* IP over Power Lines */
+#define IFT_MEDIAMAILOVERIP	   0x8b	/* (xxx)  Multimedia Mail over IP */
+#define IFT_DTM			   0x8c	/* Dynamic synchronous Transfer Mode */
+#define IFT_DCN			   0x8d	/* Data Communications Network */
+#define IFT_IPFORWARD		   0x8e	/* IP Forwarding Interface */
+#define IFT_MSDSL		   0x8f	/* Multi-rate Symmetric DSL */
+#define IFT_IEEE1394		   0x90	/* IEEE1394 High Performance SerialBus*/
+#define IFT_IFGSN		   0x91	/* HIPPI-6400 */
+#define IFT_DVBRCCMACLAYER	   0x92	/* DVB-RCC MAC Layer */
+#define IFT_DVBRCCDOWNSTREAM	   0x93	/* DVB-RCC Downstream Channel */
+#define IFT_DVBRCCUPSTREAM	   0x94	/* DVB-RCC Upstream Channel */
+#define IFT_ATMVIRTUAL		   0x95	/* ATM Virtual Interface */
+#define IFT_MPLSTUNNEL		   0x96	/* MPLS Tunnel Virtual Interface */
+#define IFT_SRP			   0x97	/* Spatial Reuse Protocol */
+#define IFT_VOICEOVERATM	   0x98	/* Voice over ATM */
+#define IFT_VOICEOVERFRAMERELAY	   0x99	/* Voice Over Frame Relay */
+#define IFT_IDSL		   0x9a	/* Digital Subscriber Loop over ISDN */
+#define IFT_COMPOSITELINK	   0x9b	/* Avici Composite Link Interface */
+#define IFT_SS7SIGLINK		   0x9c	/* SS7 Signaling Link */
+#define IFT_PROPWIRELESSP2P	   0x9d	/* Prop. P2P wireless interface */
+#define IFT_FRFORWARD		   0x9e	/* Frame forward Interface */
+#define IFT_RFC1483		   0x9f	/* Multiprotocol over ATM AAL5 */
+#define IFT_USB			   0xa0	/* USB Interface */
+#define IFT_IEEE8023ADLAG	   0xa1	/* IEEE 802.3ad Link Aggregate*/
+#define IFT_BGPPOLICYACCOUNTING	   0xa2	/* BGP Policy Accounting */
+#define IFT_FRF16MFRBUNDLE	   0xa3	/* FRF.16 Multilik Frame Relay*/
+#define IFT_H323GATEKEEPER	   0xa4	/* H323 Gatekeeper */
+#define IFT_H323PROXY		   0xa5	/* H323 Voice and Video Proxy */
+#define IFT_MPLS		   0xa6	/* MPLS */
+#define IFT_MFSIGLINK		   0xa7	/* Multi-frequency signaling link */
+#define IFT_HDSL2		   0xa8	/* High Bit-Rate DSL, 2nd gen. */
+#define IFT_SHDSL		   0xa9	/* Multirate HDSL2 */
+#define IFT_DS1FDL		   0xaa	/* Facility Data Link (4Kbps) on a DS1*/
+#define IFT_POS			   0xab	/* Packet over SONET/SDH Interface */
+#define IFT_DVBASILN		   0xac	/* DVB-ASI Input */
+#define IFT_DVBASIOUT		   0xad	/* DVB-ASI Output */
+#define IFT_PLC			   0xae	/* Power Line Communications */
+#define IFT_NFAS		   0xaf	/* Non-Facility Associated Signaling */
+#define IFT_TR008		   0xb0	/* TROO8 */
+#define IFT_GR303RDT		   0xb1	/* Remote Digital Terminal */
+#define IFT_GR303IDT		   0xb2	/* Integrated Digital Terminal */
+#define IFT_ISUP		   0xb3	/* ISUP */
+#define IFT_PROPDOCSWIRELESSMACLAYER	   0xb4	/* prop/Wireless MAC Layer */
+#define IFT_PROPDOCSWIRELESSDOWNSTREAM	   0xb5	/* prop/Wireless Downstream */
+#define IFT_PROPDOCSWIRELESSUPSTREAM	   0xb6	/* prop/Wireless Upstream */
+#define IFT_HIPERLAN2		   0xb7	/* HIPERLAN Type 2 Radio Interface */
+#define IFT_PROPBWAP2MP		   0xb8	/* PropBroadbandWirelessAccess P2MP*/
+#define IFT_SONETOVERHEADCHANNEL   0xb9	/* SONET Overhead Channel */
+#define IFT_DIGITALWRAPPEROVERHEADCHANNEL  0xba	/* Digital Wrapper Overhead */
+#define IFT_AAL2		   0xbb	/* ATM adaptation layer 2 */
+#define IFT_RADIOMAC		   0xbc	/* MAC layer over radio links */
+#define IFT_ATMRADIO		   0xbd	/* ATM over radio links */
+#define IFT_IMT			   0xbe /* Inter-Machine Trunks */
+#define IFT_MVL			   0xbf /* Multiple Virtual Lines DSL */
+#define IFT_REACHDSL		   0xc0 /* Long Reach DSL */
+#define IFT_FRDLCIENDPT		   0xc1 /* Frame Relay DLCI End Point */
+#define IFT_ATMVCIENDPT		   0xc2 /* ATM VCI End Point */
+#define IFT_OPTICALCHANNEL	   0xc3 /* Optical Channel */
+#define IFT_OPTICALTRANSPORT	   0xc4 /* Optical Transport */
+#define IFT_PROPATM		   0xc5 /* Proprietary ATM */
+#define IFT_VOICEOVERCABLE	   0xc6 /* Voice Over Cable Interface */
+#define IFT_INFINIBAND		   0xc7 /* Infiniband */
+#define IFT_TELINK		   0xc8 /* TE Link */
+#define IFT_Q2931		   0xc9 /* Q.2931 */
+#define IFT_VIRTUALTG		   0xca /* Virtual Trunk Group */
+#define IFT_SIPTG		   0xcb /* SIP Trunk Group */
+#define IFT_SIPSIG		   0xcc /* SIP Signaling */
+#define IFT_DOCSCABLEUPSTREAMCHANNEL 0xcd /* CATV Upstream Channel */
+#define IFT_ECONET		   0xce /* Acorn Econet */
+#define IFT_PON155		   0xcf /* FSAN 155Mb Symetrical PON interface */
+#define IFT_PON622		   0xd0 /* FSAN 622Mb Symetrical PON interface */
+#define IFT_BRIDGE		   0xd1 /* Transparent bridge interface */
+#define IFT_LINEGROUP		   0xd2 /* Interface common to multiple lines */
+#define IFT_VOICEEMFGD		   0xd3 /* voice E&M Feature Group D */
+#define IFT_VOICEFGDEANA	   0xd4 /* voice FGD Exchange Access North American */
+#define IFT_VOICEDID		   0xd5 /* voice Direct Inward Dialing */
+#define IFT_STF			   0xd7	/* 6to4 interface */
+
+/* not based on IANA assignments - how should we treat these? */
+#define IFT_GIF		0xf0
+#define IFT_PVC		0xf1
+#define IFT_FAITH	0xf2
+#define IFT_PFLOG	0xf5		/* Packet filter logging */
+#define IFT_PFSYNC	0xf6		/* Packet filter state syncing */
+#define IFT_CARP	0xf8		/* Common Address Redundancy Protocol */
+
+#endif /* !_NET_IF_TYPES_H_ */

Property changes on: lab4/.minix-src/include/net/if_types.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/pfvar.h
===================================================================
--- lab4/.minix-src/include/net/pfvar.h	(nonexistent)
+++ lab4/.minix-src/include/net/pfvar.h	(revision 13)
@@ -0,0 +1,1834 @@
+/*	$NetBSD: pfvar.h,v 1.22 2014/06/05 23:48:16 rmind Exp $	*/
+/*	$OpenBSD: pfvar.h,v 1.254 2007/07/13 09:17:48 markus Exp $ */
+
+/*
+ * Copyright (c) 2001 Daniel Hartmeier
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *    - Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    - 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef _NET_PFVAR_H_
+#define _NET_PFVAR_H_
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/queue.h>
+#include <sys/tree.h>
+#include <sys/rwlock.h>
+
+#include <net/radix.h>
+#if !defined(__NetBSD__) && !defined(__minix)
+#include <net/route.h>
+#include <netinet/ip_ipsp.h>
+#else /* __NetBSD__ || __minix */
+/* files above include netinet/in.h so include it too for compatibility */
+#include <netinet/in.h>
+#endif /* __NetBSD__ || __minix */
+#include <netinet/tcp_fsm.h>
+
+#if defined(__NetBSD__) && defined(_KERNEL)
+#include <net/if_compat.h>
+#include <net/pf_mtag.h>
+#endif /* __NetBSD__ && _KERNEL */
+
+struct ip;
+struct ip6_hdr;
+
+#define	PF_TCPS_PROXY_SRC	((TCP_NSTATES)+0)
+#define	PF_TCPS_PROXY_DST	((TCP_NSTATES)+1)
+
+#define	PF_MD5_DIGEST_LENGTH	16
+#ifdef MD5_DIGEST_LENGTH
+#if PF_MD5_DIGEST_LENGTH != MD5_DIGEST_LENGTH
+#error
+#endif
+#endif
+
+enum	{ PF_INOUT, PF_IN, PF_OUT };
+enum	{ PF_LAN_EXT, PF_EXT_GWY, PF_ID };
+enum	{ PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT,
+	  PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP };
+enum	{ PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT,
+	  PF_RULESET_BINAT, PF_RULESET_RDR, PF_RULESET_MAX };
+enum	{ PF_OP_NONE, PF_OP_IRG, PF_OP_EQ, PF_OP_NE, PF_OP_LT,
+	  PF_OP_LE, PF_OP_GT, PF_OP_GE, PF_OP_XRG, PF_OP_RRG };
+enum	{ PF_DEBUG_NONE, PF_DEBUG_URGENT, PF_DEBUG_MISC, PF_DEBUG_NOISY };
+enum	{ PF_CHANGE_NONE, PF_CHANGE_ADD_HEAD, PF_CHANGE_ADD_TAIL,
+	  PF_CHANGE_ADD_BEFORE, PF_CHANGE_ADD_AFTER,
+	  PF_CHANGE_REMOVE, PF_CHANGE_GET_TICKET };
+enum	{ PF_GET_NONE, PF_GET_CLR_CNTR };
+
+/*
+ * Note about PFTM_*: real indices into pf_rule.timeout[] come before
+ * PFTM_MAX, special cases afterwards. See pf_state_expires().
+ */
+enum	{ PFTM_TCP_FIRST_PACKET, PFTM_TCP_OPENING, PFTM_TCP_ESTABLISHED,
+	  PFTM_TCP_CLOSING, PFTM_TCP_FIN_WAIT, PFTM_TCP_CLOSED,
+	  PFTM_UDP_FIRST_PACKET, PFTM_UDP_SINGLE, PFTM_UDP_MULTIPLE,
+	  PFTM_ICMP_FIRST_PACKET, PFTM_ICMP_ERROR_REPLY,
+	  PFTM_OTHER_FIRST_PACKET, PFTM_OTHER_SINGLE,
+	  PFTM_OTHER_MULTIPLE, PFTM_FRAG, PFTM_INTERVAL,
+	  PFTM_ADAPTIVE_START, PFTM_ADAPTIVE_END, PFTM_SRC_NODE,
+	  PFTM_TS_DIFF, PFTM_MAX, PFTM_PURGE, PFTM_UNLINKED,
+	  PFTM_UNTIL_PACKET };
+
+/* PFTM default values */
+#define PFTM_TCP_FIRST_PACKET_VAL	120	/* First TCP packet */
+#define PFTM_TCP_OPENING_VAL		30	/* No response yet */
+#define PFTM_TCP_ESTABLISHED_VAL	24*60*60/* Established */
+#define PFTM_TCP_CLOSING_VAL		15 * 60	/* Half closed */
+#define PFTM_TCP_FIN_WAIT_VAL		45	/* Got both FINs */
+#define PFTM_TCP_CLOSED_VAL		90	/* Got a RST */
+#define PFTM_UDP_FIRST_PACKET_VAL	60	/* First UDP packet */
+#define PFTM_UDP_SINGLE_VAL		30	/* Unidirectional */
+#define PFTM_UDP_MULTIPLE_VAL		60	/* Bidirectional */
+#define PFTM_ICMP_FIRST_PACKET_VAL	20	/* First ICMP packet */
+#define PFTM_ICMP_ERROR_REPLY_VAL	10	/* Got error response */
+#define PFTM_OTHER_FIRST_PACKET_VAL	60	/* First packet */
+#define PFTM_OTHER_SINGLE_VAL		30	/* Unidirectional */
+#define PFTM_OTHER_MULTIPLE_VAL		60	/* Bidirectional */
+#define PFTM_FRAG_VAL			30	/* Fragment expire */
+#define PFTM_INTERVAL_VAL		10	/* Expire interval */
+#define PFTM_SRC_NODE_VAL		0	/* Source tracking */
+#define PFTM_TS_DIFF_VAL		30	/* Allowed TS diff */
+
+enum	{ PF_NOPFROUTE, PF_FASTROUTE, PF_ROUTETO, PF_DUPTO, PF_REPLYTO };
+enum	{ PF_LIMIT_STATES, PF_LIMIT_SRC_NODES, PF_LIMIT_FRAGS,
+	  PF_LIMIT_TABLES, PF_LIMIT_TABLE_ENTRIES, PF_LIMIT_MAX };
+#define PF_POOL_IDMASK		0x0f
+enum	{ PF_POOL_NONE, PF_POOL_BITMASK, PF_POOL_RANDOM,
+	  PF_POOL_SRCHASH, PF_POOL_ROUNDROBIN };
+enum	{ PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL,
+	  PF_ADDR_TABLE, PF_ADDR_RTLABEL, PF_ADDR_URPFFAILED };
+#define PF_POOL_TYPEMASK	0x0f
+#define PF_POOL_STICKYADDR	0x20
+#define	PF_WSCALE_FLAG		0x80
+#define	PF_WSCALE_MASK		0x0f
+
+#define	PF_LOG			0x01
+#define	PF_LOG_ALL		0x02
+#define	PF_LOG_SOCKET_LOOKUP	0x04
+
+struct pf_addr {
+	union {
+		struct in_addr		v4;
+		struct in6_addr		v6;
+		u_int8_t		addr8[16];
+		u_int16_t		addr16[8];
+		u_int32_t		addr32[4];
+	} pfa;		    /* 128-bit address */
+#define v4	pfa.v4
+#define v6	pfa.v6
+#define addr8	pfa.addr8
+#define addr16	pfa.addr16
+#define addr32	pfa.addr32
+};
+
+#define	PF_TABLE_NAME_SIZE	 32
+
+#define PFI_AFLAG_NETWORK	0x01
+#define PFI_AFLAG_BROADCAST	0x02
+#define PFI_AFLAG_PEER		0x04
+#define PFI_AFLAG_MODEMASK	0x07
+#define PFI_AFLAG_NOALIAS	0x08
+
+#ifndef RTLABEL_LEN
+#define RTLABEL_LEN	32
+#endif
+
+struct pf_addr_wrap {
+	union {
+		struct {
+			struct pf_addr		 addr;
+			struct pf_addr		 mask;
+		}			 a;
+		char			 ifname[IFNAMSIZ];
+		char			 tblname[PF_TABLE_NAME_SIZE];
+		char			 rtlabelname[RTLABEL_LEN];
+		u_int32_t		 rtlabel;
+	}			 v;
+	union {
+		struct pfi_dynaddr	*dyn;
+		struct pfr_ktable	*tbl;
+		int			 dyncnt;
+		int			 tblcnt;
+	}			 p;
+	u_int8_t		 type;		/* PF_ADDR_* */
+	u_int8_t		 iflags;	/* PFI_AFLAG_* */
+};
+
+#ifdef _KERNEL
+
+struct pfi_dynaddr {
+	TAILQ_ENTRY(pfi_dynaddr)	 entry;
+	struct pf_addr			 pfid_addr4;
+	struct pf_addr			 pfid_mask4;
+	struct pf_addr			 pfid_addr6;
+	struct pf_addr			 pfid_mask6;
+	struct pfr_ktable		*pfid_kt;
+	struct pfi_kif			*pfid_kif;
+	void				*pfid_hook_cookie;
+	int				 pfid_net;	/* mask or 128 */
+	int				 pfid_acnt4;	/* address count IPv4 */
+	int				 pfid_acnt6;	/* address count IPv6 */
+	sa_family_t			 pfid_af;	/* rule af */
+	u_int8_t			 pfid_iflags;	/* PFI_AFLAG_* */
+};
+
+/*
+ * Address manipulation macros
+ */
+
+#ifdef INET
+#ifndef INET6
+#define PF_INET_ONLY
+#endif /* ! INET6 */
+#endif /* INET */
+
+#ifdef INET6
+#ifndef INET
+#define PF_INET6_ONLY
+#endif /* ! INET */
+#endif /* INET6 */
+
+#ifdef INET
+#ifdef INET6
+#define PF_INET_INET6
+#endif /* INET6 */
+#endif /* INET */
+
+#else
+
+#define PF_INET_INET6
+
+#endif /* _KERNEL */
+
+/* Both IPv4 and IPv6 */
+#ifdef PF_INET_INET6
+
+#define PF_AEQ(a, b, c) \
+	((c == AF_INET && (a)->addr32[0] == (b)->addr32[0]) || \
+	((a)->addr32[3] == (b)->addr32[3] && \
+	(a)->addr32[2] == (b)->addr32[2] && \
+	(a)->addr32[1] == (b)->addr32[1] && \
+	(a)->addr32[0] == (b)->addr32[0])) \
+
+#define PF_ANEQ(a, b, c) \
+	((c == AF_INET && (a)->addr32[0] != (b)->addr32[0]) || \
+	((a)->addr32[3] != (b)->addr32[3] || \
+	(a)->addr32[2] != (b)->addr32[2] || \
+	(a)->addr32[1] != (b)->addr32[1] || \
+	(a)->addr32[0] != (b)->addr32[0])) \
+
+#define PF_AZERO(a, c) \
+	((c == AF_INET && !(a)->addr32[0]) || \
+	(!(a)->addr32[0] && !(a)->addr32[1] && \
+	!(a)->addr32[2] && !(a)->addr32[3] )) \
+
+#define PF_MATCHA(n, a, m, b, f) \
+	pf_match_addr(n, a, m, b, f)
+
+#define PF_ACPY(a, b, f) \
+	pf_addrcpy(a, b, f)
+
+#define PF_AINC(a, f) \
+	pf_addr_inc(a, f)
+
+#define PF_POOLMASK(a, b, c, d, f) \
+	pf_poolmask(a, b, c, d, f)
+
+#else
+
+/* Just IPv6 */
+
+#ifdef PF_INET6_ONLY
+
+#define PF_AEQ(a, b, c) \
+	((a)->addr32[3] == (b)->addr32[3] && \
+	(a)->addr32[2] == (b)->addr32[2] && \
+	(a)->addr32[1] == (b)->addr32[1] && \
+	(a)->addr32[0] == (b)->addr32[0]) \
+
+#define PF_ANEQ(a, b, c) \
+	((a)->addr32[3] != (b)->addr32[3] || \
+	(a)->addr32[2] != (b)->addr32[2] || \
+	(a)->addr32[1] != (b)->addr32[1] || \
+	(a)->addr32[0] != (b)->addr32[0]) \
+
+#define PF_AZERO(a, c) \
+	(!(a)->addr32[0] && \
+	!(a)->addr32[1] && \
+	!(a)->addr32[2] && \
+	!(a)->addr32[3] ) \
+
+#define PF_MATCHA(n, a, m, b, f) \
+	pf_match_addr(n, a, m, b, f)
+
+#define PF_ACPY(a, b, f) \
+	pf_addrcpy(a, b, f)
+
+#define PF_AINC(a, f) \
+	pf_addr_inc(a, f)
+
+#define PF_POOLMASK(a, b, c, d, f) \
+	pf_poolmask(a, b, c, d, f)
+
+#else
+
+/* Just IPv4 */
+#ifdef PF_INET_ONLY
+
+#define PF_AEQ(a, b, c) \
+	((a)->addr32[0] == (b)->addr32[0])
+
+#define PF_ANEQ(a, b, c) \
+	((a)->addr32[0] != (b)->addr32[0])
+
+#define PF_AZERO(a, c) \
+	(!(a)->addr32[0])
+
+#define PF_MATCHA(n, a, m, b, f) \
+	pf_match_addr(n, a, m, b, f)
+
+#define PF_ACPY(a, b, f) \
+	(a)->v4.s_addr = (b)->v4.s_addr
+
+#define PF_AINC(a, f) \
+	do { \
+		(a)->addr32[0] = htonl(ntohl((a)->addr32[0]) + 1); \
+	} while (0)
+
+#define PF_POOLMASK(a, b, c, d, f) \
+	do { \
+		(a)->addr32[0] = ((b)->addr32[0] & (c)->addr32[0]) | \
+		(((c)->addr32[0] ^ 0xffffffff ) & (d)->addr32[0]); \
+	} while (0)
+
+#endif /* PF_INET_ONLY */
+#endif /* PF_INET6_ONLY */
+#endif /* PF_INET_INET6 */
+
+#define	PF_MISMATCHAW(aw, x, af, neg, ifp)				\
+	(								\
+		(((aw)->type == PF_ADDR_NOROUTE &&			\
+		    pf_routable((x), (af), NULL)) ||			\
+		(((aw)->type == PF_ADDR_URPFFAILED && (ifp) != NULL &&	\
+		    pf_routable((x), (af), (ifp))) ||			\
+		((aw)->type == PF_ADDR_RTLABEL &&			\
+		    !pf_rtlabel_match((x), (af), (aw))) ||		\
+		((aw)->type == PF_ADDR_TABLE &&				\
+		    !pfr_match_addr((aw)->p.tbl, (x), (af))) ||		\
+		((aw)->type == PF_ADDR_DYNIFTL &&			\
+		    !pfi_match_addr((aw)->p.dyn, (x), (af))) || 	\
+		((aw)->type == PF_ADDR_ADDRMASK &&			\
+		    !PF_AZERO(&(aw)->v.a.mask, (af)) &&			\
+		    !PF_MATCHA(0, &(aw)->v.a.addr,			\
+		    &(aw)->v.a.mask, (x), (af))))) !=			\
+		(neg)							\
+	)
+
+
+struct pf_rule_uid {
+	uid_t		 uid[2];
+	u_int8_t	 op;
+};
+
+struct pf_rule_gid {
+	uid_t		 gid[2];
+	u_int8_t	 op;
+};
+
+struct pf_rule_addr {
+	struct pf_addr_wrap	 addr;
+	u_int16_t		 port[2];
+	u_int8_t		 neg;
+	u_int8_t		 port_op;
+};
+
+struct pf_pooladdr {
+	struct pf_addr_wrap		 addr;
+	TAILQ_ENTRY(pf_pooladdr)	 entries;
+	char				 ifname[IFNAMSIZ];
+	struct pfi_kif			*kif;
+};
+
+TAILQ_HEAD(pf_palist, pf_pooladdr);
+
+struct pf_poolhashkey {
+	union {
+		u_int8_t		key8[16];
+		u_int16_t		key16[8];
+		u_int32_t		key32[4];
+	} pfk;		    /* 128-bit hash key */
+#define key8	pfk.key8
+#define key16	pfk.key16
+#define key32	pfk.key32
+};
+
+struct pf_pool {
+	struct pf_palist	 list;
+	struct pf_pooladdr	*cur;
+	struct pf_poolhashkey	 key;
+	struct pf_addr		 counter;
+	int			 tblidx;
+	u_int16_t		 proxy_port[2];
+	u_int8_t		 port_op;
+	u_int8_t		 opts;
+};
+
+
+/* A packed Operating System description for fingerprinting */
+typedef u_int32_t pf_osfp_t;
+#define PF_OSFP_ANY	((pf_osfp_t)0)
+#define PF_OSFP_UNKNOWN	((pf_osfp_t)-1)
+#define PF_OSFP_NOMATCH	((pf_osfp_t)-2)
+
+struct pf_osfp_entry {
+	SLIST_ENTRY(pf_osfp_entry) fp_entry;
+	pf_osfp_t		fp_os;
+	int			fp_enflags;
+#define PF_OSFP_EXPANDED	0x001		/* expanded entry */
+#define PF_OSFP_GENERIC		0x002		/* generic signature */
+#define PF_OSFP_NODETAIL	0x004		/* no p0f details */
+#define PF_OSFP_LEN	32
+	char			fp_class_nm[PF_OSFP_LEN];
+	char			fp_version_nm[PF_OSFP_LEN];
+	char			fp_subtype_nm[PF_OSFP_LEN];
+};
+#define PF_OSFP_ENTRY_EQ(a, b) \
+    ((a)->fp_os == (b)->fp_os && \
+    memcmp((a)->fp_class_nm, (b)->fp_class_nm, PF_OSFP_LEN) == 0 && \
+    memcmp((a)->fp_version_nm, (b)->fp_version_nm, PF_OSFP_LEN) == 0 && \
+    memcmp((a)->fp_subtype_nm, (b)->fp_subtype_nm, PF_OSFP_LEN) == 0)
+
+/* handle pf_osfp_t packing */
+#define _FP_RESERVED_BIT	1  /* For the special negative #defines */
+#define _FP_UNUSED_BITS		1
+#define _FP_CLASS_BITS		10 /* OS Class (Windows, Linux) */
+#define _FP_VERSION_BITS	10 /* OS version (95, 98, NT, 2.4.54, 3.2) */
+#define _FP_SUBTYPE_BITS	10 /* patch level (NT SP4, SP3, ECN patch) */
+#define PF_OSFP_UNPACK(osfp, class, version, subtype) do { \
+	(class) = ((osfp) >> (_FP_VERSION_BITS+_FP_SUBTYPE_BITS)) & \
+	    ((1 << _FP_CLASS_BITS) - 1); \
+	(version) = ((osfp) >> _FP_SUBTYPE_BITS) & \
+	    ((1 << _FP_VERSION_BITS) - 1);\
+	(subtype) = (osfp) & ((1 << _FP_SUBTYPE_BITS) - 1); \
+} while(0)
+#define PF_OSFP_PACK(osfp, class, version, subtype) do { \
+	(osfp) = ((class) & ((1 << _FP_CLASS_BITS) - 1)) << (_FP_VERSION_BITS \
+	    + _FP_SUBTYPE_BITS); \
+	(osfp) |= ((version) & ((1 << _FP_VERSION_BITS) - 1)) << \
+	    _FP_SUBTYPE_BITS; \
+	(osfp) |= (subtype) & ((1 << _FP_SUBTYPE_BITS) - 1); \
+} while(0)
+
+/* the fingerprint of an OSes TCP SYN packet */
+typedef u_int64_t	pf_tcpopts_t;
+struct pf_os_fingerprint {
+	SLIST_HEAD(pf_osfp_enlist, pf_osfp_entry) fp_oses; /* list of matches */
+	pf_tcpopts_t		fp_tcpopts;	/* packed TCP options */
+	u_int16_t		fp_wsize;	/* TCP window size */
+	u_int16_t		fp_psize;	/* ip->ip_len */
+	u_int16_t		fp_mss;		/* TCP MSS */
+	u_int16_t		fp_flags;
+#define PF_OSFP_WSIZE_MOD	0x0001		/* Window modulus */
+#define PF_OSFP_WSIZE_DC	0x0002		/* Window don't care */
+#define PF_OSFP_WSIZE_MSS	0x0004		/* Window multiple of MSS */
+#define PF_OSFP_WSIZE_MTU	0x0008		/* Window multiple of MTU */
+#define PF_OSFP_PSIZE_MOD	0x0010		/* packet size modulus */
+#define PF_OSFP_PSIZE_DC	0x0020		/* packet size don't care */
+#define PF_OSFP_WSCALE		0x0040		/* TCP window scaling */
+#define PF_OSFP_WSCALE_MOD	0x0080		/* TCP window scale modulus */
+#define PF_OSFP_WSCALE_DC	0x0100		/* TCP window scale dont-care */
+#define PF_OSFP_MSS		0x0200		/* TCP MSS */
+#define PF_OSFP_MSS_MOD		0x0400		/* TCP MSS modulus */
+#define PF_OSFP_MSS_DC		0x0800		/* TCP MSS dont-care */
+#define PF_OSFP_DF		0x1000		/* IPv4 don't fragment bit */
+#define PF_OSFP_TS0		0x2000		/* Zero timestamp */
+#define PF_OSFP_INET6		0x4000		/* IPv6 */
+	u_int8_t		fp_optcnt;	/* TCP option count */
+	u_int8_t		fp_wscale;	/* TCP window scaling */
+	u_int8_t		fp_ttl;		/* IPv4 TTL */
+#define PF_OSFP_MAXTTL_OFFSET	40
+/* TCP options packing */
+#define PF_OSFP_TCPOPT_NOP	0x0		/* TCP NOP option */
+#define PF_OSFP_TCPOPT_WSCALE	0x1		/* TCP window scaling option */
+#define PF_OSFP_TCPOPT_MSS	0x2		/* TCP max segment size opt */
+#define PF_OSFP_TCPOPT_SACK	0x3		/* TCP SACK OK option */
+#define PF_OSFP_TCPOPT_TS	0x4		/* TCP timestamp option */
+#define PF_OSFP_TCPOPT_BITS	3		/* bits used by each option */
+#define PF_OSFP_MAX_OPTS \
+    (sizeof(((struct pf_os_fingerprint *)0)->fp_tcpopts) * 8) \
+    / PF_OSFP_TCPOPT_BITS
+
+	SLIST_ENTRY(pf_os_fingerprint)	fp_next;
+};
+
+struct pf_osfp_ioctl {
+	struct pf_osfp_entry	fp_os;
+	pf_tcpopts_t		fp_tcpopts;	/* packed TCP options */
+	u_int16_t		fp_wsize;	/* TCP window size */
+	u_int16_t		fp_psize;	/* ip->ip_len */
+	u_int16_t		fp_mss;		/* TCP MSS */
+	u_int16_t		fp_flags;
+	u_int8_t		fp_optcnt;	/* TCP option count */
+	u_int8_t		fp_wscale;	/* TCP window scaling */
+	u_int8_t		fp_ttl;		/* IPv4 TTL */
+
+	int			fp_getnum;	/* DIOCOSFPGET number */
+};
+
+
+union pf_rule_ptr {
+	struct pf_rule		*ptr;
+	u_int32_t		 nr;
+};
+
+#define	PF_ANCHOR_NAME_SIZE	 64
+
+struct pf_rule {
+	struct pf_rule_addr	 src;
+	struct pf_rule_addr	 dst;
+#define PF_SKIP_IFP		0
+#define PF_SKIP_DIR		1
+#define PF_SKIP_AF		2
+#define PF_SKIP_PROTO		3
+#define PF_SKIP_SRC_ADDR	4
+#define PF_SKIP_SRC_PORT	5
+#define PF_SKIP_DST_ADDR	6
+#define PF_SKIP_DST_PORT	7
+#define PF_SKIP_COUNT		8
+	union pf_rule_ptr	 skip[PF_SKIP_COUNT];
+#define PF_RULE_LABEL_SIZE	 64
+	char			 label[PF_RULE_LABEL_SIZE];
+#define PF_QNAME_SIZE		 64
+	char			 ifname[IFNAMSIZ];
+	char			 qname[PF_QNAME_SIZE];
+	char			 pqname[PF_QNAME_SIZE];
+#define	PF_TAG_NAME_SIZE	 64
+	char			 tagname[PF_TAG_NAME_SIZE];
+	char			 match_tagname[PF_TAG_NAME_SIZE];
+
+	char			 overload_tblname[PF_TABLE_NAME_SIZE];
+
+	TAILQ_ENTRY(pf_rule)	 entries;
+	struct pf_pool		 rpool;
+
+	u_int64_t		 evaluations;
+	u_int64_t		 packets[2];
+	u_int64_t		 bytes[2];
+
+	struct pfi_kif		*kif;
+	struct pf_anchor	*anchor;
+	struct pfr_ktable	*overload_tbl;
+
+	pf_osfp_t		 os_fingerprint;
+
+	int			 rtableid;
+	u_int32_t		 timeout[PFTM_MAX];
+	u_int32_t		 states;
+	u_int32_t		 max_states;
+	u_int32_t		 src_nodes;
+	u_int32_t		 max_src_nodes;
+	u_int32_t		 max_src_states;
+	u_int32_t		 max_src_conn;
+	struct {
+		u_int32_t		limit;
+		u_int32_t		seconds;
+	}			 max_src_conn_rate;
+	u_int32_t		 qid;
+	u_int32_t		 pqid;
+	u_int32_t		 rt_listid;
+	u_int32_t		 nr;
+	u_int32_t		 prob;
+	uid_t			 cuid;
+	pid_t			 cpid;
+
+	u_int16_t		 return_icmp;
+	u_int16_t		 return_icmp6;
+	u_int16_t		 max_mss;
+	u_int16_t		 tag;
+	u_int16_t		 match_tag;
+
+	struct pf_rule_uid	 uid;
+	struct pf_rule_gid	 gid;
+
+	u_int32_t		 rule_flag;
+	u_int8_t		 action;
+	u_int8_t		 direction;
+	u_int8_t		 log;
+	u_int8_t		 logif;
+	u_int8_t		 quick;
+	u_int8_t		 ifnot;
+	u_int8_t		 match_tag_not;
+	u_int8_t		 natpass;
+
+#define PF_STATE_NORMAL		0x1
+#define PF_STATE_MODULATE	0x2
+#define PF_STATE_SYNPROXY	0x3
+	u_int8_t		 keep_state;
+	sa_family_t		 af;
+	u_int8_t		 proto;
+	u_int8_t		 type;
+	u_int8_t		 code;
+	u_int8_t		 flags;
+	u_int8_t		 flagset;
+	u_int8_t		 min_ttl;
+	u_int8_t		 allow_opts;
+	u_int8_t		 rt;
+	u_int8_t		 return_ttl;
+	u_int8_t		 tos;
+	u_int8_t		 anchor_relative;
+	u_int8_t		 anchor_wildcard;
+
+#define PF_FLUSH		0x01
+#define PF_FLUSH_GLOBAL		0x02
+	u_int8_t		 flush;
+};
+
+/* rule flags */
+#define	PFRULE_DROP		0x0000
+#define	PFRULE_RETURNRST	0x0001
+#define	PFRULE_FRAGMENT		0x0002
+#define	PFRULE_RETURNICMP	0x0004
+#define	PFRULE_RETURN		0x0008
+#define	PFRULE_NOSYNC		0x0010
+#define PFRULE_SRCTRACK		0x0020  /* track source states */
+#define PFRULE_RULESRCTRACK	0x0040  /* per rule */
+
+/* scrub flags */
+#define	PFRULE_NODF		0x0100
+#define	PFRULE_FRAGCROP		0x0200	/* non-buffering frag cache */
+#define	PFRULE_FRAGDROP		0x0400	/* drop funny fragments */
+#define PFRULE_RANDOMID		0x0800
+#define PFRULE_REASSEMBLE_TCP	0x1000
+
+/* rule flags again */
+#define PFRULE_IFBOUND		0x00010000	/* if-bound */
+
+#define PFSTATE_HIWAT		10000	/* default state table size */
+#define PFSTATE_ADAPT_START	6000	/* default adaptive timeout start */
+#define PFSTATE_ADAPT_END	12000	/* default adaptive timeout end */
+
+
+struct pf_threshold {
+	u_int32_t	limit;
+#define	PF_THRESHOLD_MULT	1000
+#define PF_THRESHOLD_MAX	0xffffffff / PF_THRESHOLD_MULT
+	u_int32_t	seconds;
+	u_int32_t	count;
+	u_int32_t	last;
+};
+
+struct pf_src_node {
+	RB_ENTRY(pf_src_node) entry;
+	struct pf_addr	 addr;
+	struct pf_addr	 raddr;
+	union pf_rule_ptr rule;
+	struct pfi_kif	*kif;
+	u_int64_t	 bytes[2];
+	u_int64_t	 packets[2];
+	u_int32_t	 states;
+	u_int32_t	 conn;
+	struct pf_threshold	conn_rate;
+	u_int32_t	 creation;
+	u_int32_t	 expire;
+	sa_family_t	 af;
+	u_int8_t	 ruletype;
+};
+
+#define PFSNODE_HIWAT		10000	/* default source node table size */
+
+struct pf_state_scrub {
+	struct timeval	pfss_last;	/* time received last packet	*/
+	u_int32_t	pfss_tsecr;	/* last echoed timestamp	*/
+	u_int32_t	pfss_tsval;	/* largest timestamp		*/
+	u_int32_t	pfss_tsval0;	/* original timestamp		*/
+	u_int16_t	pfss_flags;
+#define PFSS_TIMESTAMP	0x0001		/* modulate timestamp		*/
+#define PFSS_PAWS	0x0010		/* stricter PAWS checks		*/
+#define PFSS_PAWS_IDLED	0x0020		/* was idle too long.  no PAWS	*/
+#define PFSS_DATA_TS	0x0040		/* timestamp on data packets	*/
+#define PFSS_DATA_NOTS	0x0080		/* no timestamp on data packets	*/
+	u_int8_t	pfss_ttl;	/* stashed TTL			*/
+	u_int8_t	pad;
+	u_int32_t	pfss_ts_mod;	/* timestamp modulation		*/
+};
+
+struct pf_state_host {
+	struct pf_addr	addr;
+	u_int16_t	port;
+	u_int16_t	pad;
+};
+
+struct pf_state_peer {
+	u_int32_t	seqlo;		/* Max sequence number sent	*/
+	u_int32_t	seqhi;		/* Max the other end ACKd + win	*/
+	u_int32_t	seqdiff;	/* Sequence number modulator	*/
+	u_int16_t	max_win;	/* largest window (pre scaling)	*/
+	u_int8_t	state;		/* active state level		*/
+	u_int8_t	wscale;		/* window scaling factor	*/
+	u_int16_t	mss;		/* Maximum segment size option	*/
+	u_int8_t	tcp_est;	/* Did we reach TCPS_ESTABLISHED */
+	struct pf_state_scrub	*scrub;	/* state is scrubbed		*/
+	u_int8_t	pad[3];
+};
+
+TAILQ_HEAD(pf_state_queue, pf_state);
+
+/* keep synced with struct pf_state_key, used in RB_FIND */
+struct pf_state_key_cmp {
+	struct pf_state_host lan;
+	struct pf_state_host gwy;
+	struct pf_state_host ext;
+	sa_family_t	 af;
+	u_int8_t	 proto;
+	u_int8_t	 direction;
+	u_int8_t	 pad;
+};
+
+TAILQ_HEAD(pf_statelist, pf_state);
+
+struct pf_state_key {
+	struct pf_state_host lan;
+	struct pf_state_host gwy;
+	struct pf_state_host ext;
+	sa_family_t	 af;
+	u_int8_t	 proto;
+	u_int8_t	 direction;
+	u_int8_t	 pad;
+
+	RB_ENTRY(pf_state_key)	 entry_lan_ext;
+	RB_ENTRY(pf_state_key)	 entry_ext_gwy;
+	struct pf_statelist	 states;
+	u_short		 refcnt;	/* same size as if_index */	 
+};
+
+
+/* keep synced with struct pf_state, used in RB_FIND */
+struct pf_state_cmp {
+	u_int64_t	 id;
+	u_int32_t	 creatorid;
+	u_int32_t	 pad;
+};
+
+struct pf_state {
+	u_int64_t		 id;
+	u_int32_t		 creatorid;
+	u_int32_t		 pad;
+
+	TAILQ_ENTRY(pf_state)	 entry_list;
+	TAILQ_ENTRY(pf_state)	 next;
+	RB_ENTRY(pf_state)	 entry_id;
+	struct pf_state_peer	 src;
+	struct pf_state_peer	 dst;
+	union pf_rule_ptr	 rule;
+	union pf_rule_ptr	 anchor;
+	union pf_rule_ptr	 nat_rule;
+	struct pf_addr		 rt_addr;
+	struct pf_state_key	*state_key;
+	struct pfi_kif		*kif;
+	struct pfi_kif		*rt_kif;
+	struct pf_src_node	*src_node;
+	struct pf_src_node	*nat_src_node;
+	u_int64_t		 packets[2];
+	u_int64_t		 bytes[2];
+	u_int32_t		 creation;
+	u_int32_t		 expire;
+	u_int32_t		 pfsync_time;
+	u_int16_t		 tag;
+	u_int8_t		 log;
+	u_int8_t		 allow_opts;
+	u_int8_t		 timeout;
+	u_int8_t		 sync_flags;
+#define	PFSTATE_NOSYNC	 0x01
+#define	PFSTATE_FROMSYNC 0x02
+#define	PFSTATE_STALE	 0x04
+};
+
+/*
+ * Unified state structures for pulling states out of the kernel
+ * used by pfsync(4) and the pf(4) ioctl.
+ */
+struct pfsync_state_scrub {
+	u_int16_t	pfss_flags;
+	u_int8_t	pfss_ttl;	/* stashed TTL		*/
+#define PFSYNC_SCRUB_FLAG_VALID 	0x01
+	u_int8_t	scrub_flag;
+	u_int32_t	pfss_ts_mod;	/* timestamp modulation	*/
+} __packed;
+
+struct pfsync_state_host {
+	struct pf_addr	addr;
+	u_int16_t	port;
+	u_int16_t	pad[3];
+} __packed;
+
+struct pfsync_state_peer {
+	struct pfsync_state_scrub scrub;	/* state is scrubbed	*/
+	u_int32_t	seqlo;		/* Max sequence number sent	*/
+	u_int32_t	seqhi;		/* Max the other end ACKd + win	*/
+	u_int32_t	seqdiff;	/* Sequence number modulator	*/
+	u_int16_t	max_win;	/* largest window (pre scaling)	*/
+	u_int16_t	mss;		/* Maximum segment size option	*/
+	u_int8_t	state;		/* active state level		*/
+	u_int8_t	wscale;		/* window scaling factor	*/
+	u_int8_t	pad[6];
+} __packed;
+
+struct pfsync_state {
+	u_int32_t	 id[2];
+	char		 ifname[IFNAMSIZ];
+	struct pfsync_state_host lan;
+	struct pfsync_state_host gwy;
+	struct pfsync_state_host ext;
+	struct pfsync_state_peer src;
+	struct pfsync_state_peer dst;
+	struct pf_addr	 rt_addr;
+	u_int32_t	 rule;
+	u_int32_t	 anchor;
+	u_int32_t	 nat_rule;
+	u_int32_t	 creation;
+	u_int32_t	 expire;
+	u_int32_t	 packets[2][2];
+	u_int32_t	 bytes[2][2];
+	u_int32_t	 creatorid;
+	sa_family_t	 af;
+	u_int8_t	 proto;
+	u_int8_t	 direction;
+	u_int8_t	 log;
+	u_int8_t	 allow_opts;
+	u_int8_t	 timeout;
+	u_int8_t	 sync_flags;
+	u_int8_t	 updates;
+} __packed;
+
+#define PFSYNC_FLAG_COMPRESS 	0x01
+#define PFSYNC_FLAG_STALE	0x02
+#define PFSYNC_FLAG_SRCNODE	0x04
+#define PFSYNC_FLAG_NATSRCNODE	0x08
+
+/* for copies to/from userland via pf_ioctl() */
+#define pf_state_peer_to_pfsync(s,d) do {	\
+	(d)->seqlo = (s)->seqlo;		\
+	(d)->seqhi = (s)->seqhi;		\
+	(d)->seqdiff = (s)->seqdiff;		\
+	(d)->max_win = (s)->max_win;		\
+	(d)->mss = (s)->mss;			\
+	(d)->state = (s)->state;		\
+	(d)->wscale = (s)->wscale;		\
+	if ((s)->scrub) {						\
+		(d)->scrub.pfss_flags = 				\
+		    (s)->scrub->pfss_flags & PFSS_TIMESTAMP;		\
+		(d)->scrub.pfss_ttl = (s)->scrub->pfss_ttl;		\
+		(d)->scrub.pfss_ts_mod = (s)->scrub->pfss_ts_mod;	\
+		(d)->scrub.scrub_flag = PFSYNC_SCRUB_FLAG_VALID;	\
+	}								\
+} while (0)
+
+#define pf_state_peer_from_pfsync(s,d) do {	\
+	(d)->seqlo = (s)->seqlo;		\
+	(d)->seqhi = (s)->seqhi;		\
+	(d)->seqdiff = (s)->seqdiff;		\
+	(d)->max_win = (s)->max_win;		\
+	(d)->mss = ntohs((s)->mss);		\
+	(d)->state = (s)->state;		\
+	(d)->wscale = (s)->wscale;		\
+	if ((s)->scrub.scrub_flag == PFSYNC_SCRUB_FLAG_VALID && 	\
+	    (d)->scrub != NULL) {					\
+		(d)->scrub->pfss_flags =				\
+		    ntohs((s)->scrub.pfss_flags) & PFSS_TIMESTAMP;	\
+		(d)->scrub->pfss_ttl = (s)->scrub.pfss_ttl;		\
+		(d)->scrub->pfss_ts_mod = (s)->scrub.pfss_ts_mod;	\
+	}								\
+} while (0)
+
+#define pf_state_counter_to_pfsync(s,d) do {			\
+	d[0] = (s>>32)&0xffffffff;				\
+	d[1] = s&0xffffffff;					\
+} while (0)
+
+#define pf_state_counter_from_pfsync(s)		\
+	(((u_int64_t)(s[0])<<32) | (u_int64_t)(s[1]))
+
+
+
+TAILQ_HEAD(pf_rulequeue, pf_rule);
+
+struct pf_anchor;
+
+struct pf_ruleset {
+	struct {
+		struct pf_rulequeue	 queues[2];
+		struct {
+			struct pf_rulequeue	*ptr;
+			struct pf_rule		**ptr_array;
+			u_int32_t		 rcount;
+			u_int32_t		 ticket;
+			int			 open;
+		}			 active, inactive;
+	}			 rules[PF_RULESET_MAX];
+	struct pf_anchor	*anchor;
+	u_int32_t		 tticket;
+	int			 tables;
+	int			 topen;
+};
+
+RB_HEAD(pf_anchor_global, pf_anchor);
+RB_HEAD(pf_anchor_node, pf_anchor);
+struct pf_anchor {
+	RB_ENTRY(pf_anchor)	 entry_global;
+	RB_ENTRY(pf_anchor)	 entry_node;
+	struct pf_anchor	*parent;
+	struct pf_anchor_node	 children;
+	char			 name[PF_ANCHOR_NAME_SIZE];
+	char			 path[MAXPATHLEN];
+	struct pf_ruleset	 ruleset;
+	int			 refcnt;	/* anchor rules */
+	int			 match;
+};
+RB_PROTOTYPE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare);
+RB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare);
+
+#define PF_RESERVED_ANCHOR	"_pf"
+
+#define PFR_TFLAG_PERSIST	0x00000001
+#define PFR_TFLAG_CONST		0x00000002
+#define PFR_TFLAG_ACTIVE	0x00000004
+#define PFR_TFLAG_INACTIVE	0x00000008
+#define PFR_TFLAG_REFERENCED	0x00000010
+#define PFR_TFLAG_REFDANCHOR	0x00000020
+#define PFR_TFLAG_USRMASK	0x00000003
+#define PFR_TFLAG_SETMASK	0x0000003C
+#define PFR_TFLAG_ALLMASK	0x0000003F
+
+struct pfr_table {
+	char			 pfrt_anchor[MAXPATHLEN];
+	char			 pfrt_name[PF_TABLE_NAME_SIZE];
+	u_int32_t		 pfrt_flags;
+	u_int8_t		 pfrt_fback;
+};
+
+enum { PFR_FB_NONE, PFR_FB_MATCH, PFR_FB_ADDED, PFR_FB_DELETED,
+	PFR_FB_CHANGED, PFR_FB_CLEARED, PFR_FB_DUPLICATE,
+	PFR_FB_NOTMATCH, PFR_FB_CONFLICT, PFR_FB_MAX };
+
+struct pfr_addr {
+	union {
+		struct in_addr	 _pfra_ip4addr;
+		struct in6_addr	 _pfra_ip6addr;
+	}		 pfra_u;
+	u_int8_t	 pfra_af;
+	u_int8_t	 pfra_net;
+	u_int8_t	 pfra_not;
+	u_int8_t	 pfra_fback;
+};
+#define	pfra_ip4addr	pfra_u._pfra_ip4addr
+#define	pfra_ip6addr	pfra_u._pfra_ip6addr
+
+enum { PFR_DIR_IN, PFR_DIR_OUT, PFR_DIR_MAX };
+enum { PFR_OP_BLOCK, PFR_OP_PASS, PFR_OP_ADDR_MAX, PFR_OP_TABLE_MAX };
+#define PFR_OP_XPASS	PFR_OP_ADDR_MAX
+
+struct pfr_astats {
+	struct pfr_addr	 pfras_a;
+	u_int64_t	 pfras_packets[PFR_DIR_MAX][PFR_OP_ADDR_MAX];
+	u_int64_t	 pfras_bytes[PFR_DIR_MAX][PFR_OP_ADDR_MAX];
+	long		 pfras_tzero;
+};
+
+enum { PFR_REFCNT_RULE, PFR_REFCNT_ANCHOR, PFR_REFCNT_MAX };
+
+struct pfr_tstats {
+	struct pfr_table pfrts_t;
+	u_int64_t	 pfrts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX];
+	u_int64_t	 pfrts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX];
+	u_int64_t	 pfrts_match;
+	u_int64_t	 pfrts_nomatch;
+	long		 pfrts_tzero;
+	int		 pfrts_cnt;
+	int		 pfrts_refcnt[PFR_REFCNT_MAX];
+};
+#define	pfrts_name	pfrts_t.pfrt_name
+#define pfrts_flags	pfrts_t.pfrt_flags
+
+#ifndef _SOCKADDR_UNION_DEFINED
+#define _SOCKADDR_UNION_DEFINED
+union sockaddr_union {
+	struct sockaddr		sa;
+	struct sockaddr_in	sin;
+	struct sockaddr_in6	sin6;
+};
+#endif /* _SOCKADDR_UNION_DEFINED */
+
+SLIST_HEAD(pfr_kentryworkq, pfr_kentry);
+struct pfr_kentry {
+	struct radix_node	 pfrke_node[2];
+	union sockaddr_union	 pfrke_sa;
+	u_int64_t		 pfrke_packets[PFR_DIR_MAX][PFR_OP_ADDR_MAX];
+	u_int64_t		 pfrke_bytes[PFR_DIR_MAX][PFR_OP_ADDR_MAX];
+	SLIST_ENTRY(pfr_kentry)	 pfrke_workq;
+	long			 pfrke_tzero;
+	u_int8_t		 pfrke_af;
+	u_int8_t		 pfrke_net;
+	u_int8_t		 pfrke_not;
+	u_int8_t		 pfrke_mark;
+	u_int8_t		 pfrke_intrpool;
+};
+
+SLIST_HEAD(pfr_ktableworkq, pfr_ktable);
+RB_HEAD(pfr_ktablehead, pfr_ktable);
+struct pfr_ktable {
+	struct pfr_tstats	 pfrkt_ts;
+	RB_ENTRY(pfr_ktable)	 pfrkt_tree;
+	SLIST_ENTRY(pfr_ktable)	 pfrkt_workq;
+	struct radix_node_head	*pfrkt_ip4;
+	struct radix_node_head	*pfrkt_ip6;
+	struct pfr_ktable	*pfrkt_shadow;
+	struct pfr_ktable	*pfrkt_root;
+	struct pf_ruleset	*pfrkt_rs;
+	long			 pfrkt_larg;
+	int			 pfrkt_nflags;
+};
+#define pfrkt_t		pfrkt_ts.pfrts_t
+#define pfrkt_name	pfrkt_t.pfrt_name
+#define pfrkt_anchor	pfrkt_t.pfrt_anchor
+#define pfrkt_ruleset	pfrkt_t.pfrt_ruleset
+#define pfrkt_flags	pfrkt_t.pfrt_flags
+#define pfrkt_cnt	pfrkt_ts.pfrts_cnt
+#define pfrkt_refcnt	pfrkt_ts.pfrts_refcnt
+#define pfrkt_packets	pfrkt_ts.pfrts_packets
+#define pfrkt_bytes	pfrkt_ts.pfrts_bytes
+#define pfrkt_match	pfrkt_ts.pfrts_match
+#define pfrkt_nomatch	pfrkt_ts.pfrts_nomatch
+#define pfrkt_tzero	pfrkt_ts.pfrts_tzero
+
+RB_HEAD(pf_state_tree_lan_ext, pf_state_key);
+RB_PROTOTYPE(pf_state_tree_lan_ext, pf_state_key,
+    entry_lan_ext, pf_state_compare_lan_ext);
+
+RB_HEAD(pf_state_tree_ext_gwy, pf_state_key);
+RB_PROTOTYPE(pf_state_tree_ext_gwy, pf_state_key,
+    entry_ext_gwy, pf_state_compare_ext_gwy);
+
+RB_HEAD(pfi_ifhead, pfi_kif);
+
+/* state tables */
+extern struct pf_state_tree_lan_ext	 pf_statetbl_lan_ext;
+extern struct pf_state_tree_ext_gwy	 pf_statetbl_ext_gwy;
+
+/* keep synced with pfi_kif, used in RB_FIND */
+struct pfi_kif_cmp {
+	char				 pfik_name[IFNAMSIZ];
+};
+
+struct pfi_kif {
+	char				 pfik_name[IFNAMSIZ];
+	RB_ENTRY(pfi_kif)		 pfik_tree;
+	u_int64_t			 pfik_packets[2][2][2];
+	u_int64_t			 pfik_bytes[2][2][2];
+	u_int32_t			 pfik_tzero;
+	int				 pfik_flags;
+	void				*pfik_ah_cookie;
+	struct ifnet			*pfik_ifp;
+	struct ifg_group		*pfik_group;
+	int				 pfik_states;
+	int				 pfik_rules;
+	TAILQ_HEAD(, pfi_dynaddr)	 pfik_dynaddrs;
+};
+
+enum pfi_kif_refs {
+	PFI_KIF_REF_NONE,
+	PFI_KIF_REF_STATE,
+	PFI_KIF_REF_RULE
+};
+
+#define PFI_IFLAG_SKIP		0x0100	/* skip filtering on interface */
+
+struct pf_pdesc {
+	struct {
+		int	 done;
+		uid_t	 uid;
+		gid_t	 gid;
+		pid_t	 pid;
+	}		 lookup;
+	u_int64_t	 tot_len;	/* Make Mickey money */
+	union {
+		struct tcphdr		*tcp;
+		struct udphdr		*udp;
+		struct icmp		*icmp;
+#ifdef INET6
+		struct icmp6_hdr	*icmp6;
+#endif /* INET6 */
+		void			*any;
+	} hdr;
+	struct pf_addr	 baddr;		/* address before translation */
+	struct pf_addr	 naddr;		/* address after translation */
+	struct pf_rule	*nat_rule;	/* nat/rdr rule applied to packet */
+	struct pf_addr	*src;
+	struct pf_addr	*dst;
+	struct ether_header
+			*eh;
+	u_int16_t	*ip_sum;
+	u_int32_t	 p_len;		/* total length of payload */
+	u_int16_t	 flags;		/* Let SCRUB trigger behavior in
+					 * state code. Easier than tags */
+#define PFDESC_TCP_NORM	0x0001		/* TCP shall be statefully scrubbed */
+#define PFDESC_IP_REAS	0x0002		/* IP frags would've been reassembled */
+	sa_family_t	 af;
+	u_int8_t	 proto;
+	u_int8_t	 tos;
+};
+
+/* flags for RDR options */
+#define PF_DPORT_RANGE	0x01		/* Dest port uses range */
+#define PF_RPORT_RANGE	0x02		/* RDR'ed port uses range */
+
+/* Reasons code for passing/dropping a packet */
+#define PFRES_MATCH	0		/* Explicit match of a rule */
+#define PFRES_BADOFF	1		/* Bad offset for pull_hdr */
+#define PFRES_FRAG	2		/* Dropping following fragment */
+#define PFRES_SHORT	3		/* Dropping short packet */
+#define PFRES_NORM	4		/* Dropping by normalizer */
+#define PFRES_MEMORY	5		/* Dropped due to lacking mem */
+#define PFRES_TS	6		/* Bad TCP Timestamp (RFC1323) */
+#define PFRES_CONGEST	7		/* Congestion (of IP queue) */
+#define PFRES_IPOPTIONS 8		/* IP option */
+#define PFRES_PROTCKSUM 9		/* Protocol checksum invalid */
+#define PFRES_BADSTATE	10		/* State mismatch */
+#define PFRES_STATEINS	11		/* State insertion failure */
+#define PFRES_MAXSTATES	12		/* State limit */
+#define PFRES_SRCLIMIT	13		/* Source node/conn limit */
+#define PFRES_SYNPROXY	14		/* SYN proxy */
+#define PFRES_STATELOCKED 15    /* state table locked */
+#define PFRES_MAX	16		/* total+1 */
+
+#define PFRES_NAMES { \
+	"match", \
+	"bad-offset", \
+	"fragment", \
+	"short", \
+	"normalize", \
+	"memory", \
+	"bad-timestamp", \
+	"congestion", \
+	"ip-option", \
+	"proto-cksum", \
+	"state-mismatch", \
+	"state-insert", \
+	"state-limit", \
+	"src-limit", \
+	"synproxy", \
+	"state-locked", \
+	NULL \
+}
+
+/* Counters for other things we want to keep track of */
+#define LCNT_STATES		0	/* states */
+#define LCNT_SRCSTATES		1	/* max-src-states */
+#define LCNT_SRCNODES		2	/* max-src-nodes */
+#define LCNT_SRCCONN		3	/* max-src-conn */
+#define LCNT_SRCCONNRATE	4	/* max-src-conn-rate */
+#define LCNT_OVERLOAD_TABLE	5	/* entry added to overload table */
+#define LCNT_OVERLOAD_FLUSH	6	/* state entries flushed */
+#define LCNT_MAX		7	/* total+1 */
+
+#define LCNT_NAMES { \
+	"max states per rule", \
+	"max-src-states", \
+	"max-src-nodes", \
+	"max-src-conn", \
+	"max-src-conn-rate", \
+	"overload table insertion", \
+	"overload flush states", \
+	NULL \
+}
+
+/* UDP state enumeration */
+#define PFUDPS_NO_TRAFFIC	0
+#define PFUDPS_SINGLE		1
+#define PFUDPS_MULTIPLE		2
+
+#define PFUDPS_NSTATES		3	/* number of state levels */
+
+#define PFUDPS_NAMES { \
+	"NO_TRAFFIC", \
+	"SINGLE", \
+	"MULTIPLE", \
+	NULL \
+}
+
+/* Other protocol state enumeration */
+#define PFOTHERS_NO_TRAFFIC	0
+#define PFOTHERS_SINGLE		1
+#define PFOTHERS_MULTIPLE	2
+
+#define PFOTHERS_NSTATES	3	/* number of state levels */
+
+#define PFOTHERS_NAMES { \
+	"NO_TRAFFIC", \
+	"SINGLE", \
+	"MULTIPLE", \
+	NULL \
+}
+
+#define FCNT_STATE_SEARCH	0
+#define FCNT_STATE_INSERT	1
+#define FCNT_STATE_REMOVALS	2
+#define FCNT_MAX		3
+
+#define SCNT_SRC_NODE_SEARCH	0
+#define SCNT_SRC_NODE_INSERT	1
+#define SCNT_SRC_NODE_REMOVALS	2
+#define SCNT_MAX		3
+
+#define ACTION_SET(a, x) \
+	do { \
+		if ((a) != NULL) \
+			*(a) = (x); \
+	} while (0)
+
+#define REASON_SET(a, x) \
+	do { \
+		if ((a) != NULL) \
+			*(a) = (x); \
+		if (x < PFRES_MAX) \
+			pf_status.counters[x]++; \
+	} while (0)
+#define REASON_SET_NOPTR(a, x) \
+	do { \
+		*(a) = (x); \
+		if (x < PFRES_MAX) \
+			pf_status.counters[x]++; \
+	} while (0)
+
+struct pf_status {
+	u_int64_t	counters[PFRES_MAX];
+	u_int64_t	lcounters[LCNT_MAX];	/* limit counters */
+	u_int64_t	fcounters[FCNT_MAX];
+	u_int64_t	scounters[SCNT_MAX];
+	u_int64_t	pcounters[2][2][3];
+	u_int64_t	bcounters[2][2];
+	u_int64_t	stateid;
+	u_int32_t	running;
+	u_int32_t	states;
+	u_int32_t	src_nodes;
+	u_int32_t	since;
+	u_int32_t	debug;
+	u_int32_t	hostid;
+	char		ifname[IFNAMSIZ];
+	u_int8_t	pf_chksum[PF_MD5_DIGEST_LENGTH];
+};
+
+struct cbq_opts {
+	u_int		minburst;
+	u_int		maxburst;
+	u_int		pktsize;
+	u_int		maxpktsize;
+	u_int		ns_per_byte;
+	u_int		maxidle;
+	int		minidle;
+	u_int		offtime;
+	int		flags;
+};
+
+struct priq_opts {
+	int		flags;
+};
+
+struct hfsc_opts {
+	/* real-time service curve */
+	u_int		rtsc_m1;	/* slope of the 1st segment in bps */
+	u_int		rtsc_d;		/* the x-projection of m1 in msec */
+	u_int		rtsc_m2;	/* slope of the 2nd segment in bps */
+	/* link-sharing service curve */
+	u_int		lssc_m1;
+	u_int		lssc_d;
+	u_int		lssc_m2;
+	/* upper-limit service curve */
+	u_int		ulsc_m1;
+	u_int		ulsc_d;
+	u_int		ulsc_m2;
+	int		flags;
+};
+
+struct pf_altq {
+	char			 ifname[IFNAMSIZ];
+
+	void			*altq_disc;	/* discipline-specific state */
+	TAILQ_ENTRY(pf_altq)	 entries;
+
+	/* scheduler spec */
+	u_int8_t		 scheduler;	/* scheduler type */
+	u_int16_t		 tbrsize;	/* tokenbucket regulator size */
+	u_int32_t		 ifbandwidth;	/* interface bandwidth */
+
+	/* queue spec */
+	char			 qname[PF_QNAME_SIZE];	/* queue name */
+	char			 parent[PF_QNAME_SIZE];	/* parent name */
+	u_int32_t		 parent_qid;	/* parent queue id */
+	u_int32_t		 bandwidth;	/* queue bandwidth */
+	u_int8_t		 priority;	/* priority */
+	u_int16_t		 qlimit;	/* queue size limit */
+	u_int16_t		 flags;		/* misc flags */
+	union {
+		struct cbq_opts		 cbq_opts;
+		struct priq_opts	 priq_opts;
+		struct hfsc_opts	 hfsc_opts;
+	} pq_u;
+
+	u_int32_t		 qid;		/* return value */
+};
+
+struct pf_tag {
+	u_int16_t	tag;		/* tag id */
+};
+
+struct pf_tagname {
+	TAILQ_ENTRY(pf_tagname)	entries;
+	char			name[PF_TAG_NAME_SIZE];
+	u_int16_t		tag;
+	int			ref;
+};
+
+#define PFFRAG_FRENT_HIWAT	5000	/* Number of fragment entries */
+#define PFFRAG_FRAG_HIWAT	1000	/* Number of fragmented packets */
+#define PFFRAG_FRCENT_HIWAT	50000	/* Number of fragment cache entries */
+#define PFFRAG_FRCACHE_HIWAT	10000	/* Number of fragment descriptors */
+
+#define PFR_KTABLE_HIWAT	1000	/* Number of tables */
+#define PFR_KENTRY_HIWAT	200000	/* Number of table entries */
+#define PFR_KENTRY_HIWAT_SMALL	100000	/* Number of table entries (tiny hosts) */
+
+/*
+ * ioctl parameter structures
+ */
+
+struct pfioc_pooladdr {
+	u_int32_t		 action;
+	u_int32_t		 ticket;
+	u_int32_t		 nr;
+	u_int32_t		 r_num;
+	u_int8_t		 r_action;
+	u_int8_t		 r_last;
+	u_int8_t		 af;
+	char			 anchor[MAXPATHLEN];
+	struct pf_pooladdr	 addr;
+};
+
+struct pfioc_rule {
+	u_int32_t	 action;
+	u_int32_t	 ticket;
+	u_int32_t	 pool_ticket;
+	u_int32_t	 nr;
+	char		 anchor[MAXPATHLEN];
+	char		 anchor_call[MAXPATHLEN];
+	struct pf_rule	 rule;
+};
+
+struct pfioc_natlook {
+	struct pf_addr	 saddr;
+	struct pf_addr	 daddr;
+	struct pf_addr	 rsaddr;
+	struct pf_addr	 rdaddr;
+	u_int16_t	 sport;
+	u_int16_t	 dport;
+	u_int16_t	 rsport;
+	u_int16_t	 rdport;
+	sa_family_t	 af;
+	u_int8_t	 proto;
+	u_int8_t	 direction;
+};
+
+struct pfioc_state {
+	u_int32_t 	 nr;
+	void		*state;
+};
+
+struct pfioc_src_node_kill {
+	/* XXX returns the number of src nodes killed in psnk_af */
+	sa_family_t psnk_af;
+	struct pf_rule_addr psnk_src;
+	struct pf_rule_addr psnk_dst;
+};
+
+struct pfioc_state_kill {
+	/* XXX returns the number of states killed in psk_af */
+	sa_family_t		psk_af;
+	int			psk_proto;
+	struct pf_rule_addr	psk_src;
+	struct pf_rule_addr	psk_dst;
+	char			psk_ifname[IFNAMSIZ];
+};
+
+struct pfioc_states {
+	int	ps_len;
+	union {
+		void			*psu_buf;
+		struct pfsync_state	*psu_states;
+	} ps_u;
+#define ps_buf		ps_u.psu_buf
+#define ps_states	ps_u.psu_states
+};
+
+struct pfioc_src_nodes {
+	int	psn_len;
+	union {
+		void			*psu_buf;
+		struct pf_src_node	*psu_src_nodes;
+	} psn_u;
+#define psn_buf		psn_u.psu_buf
+#define psn_src_nodes	psn_u.psu_src_nodes
+};
+
+struct pfioc_if {
+	char		 ifname[IFNAMSIZ];
+};
+
+struct pfioc_tm {
+	int		 timeout;
+	int		 seconds;
+};
+
+struct pfioc_limit {
+	int		 index;
+	unsigned	 limit;
+};
+
+struct pfioc_altq {
+	u_int32_t	 action;
+	u_int32_t	 ticket;
+	u_int32_t	 nr;
+	struct pf_altq	 altq;
+};
+
+struct pfioc_qstats {
+	u_int32_t	 ticket;
+	u_int32_t	 nr;
+	void		*buf;
+	int		 nbytes;
+	u_int8_t	 scheduler;
+};
+
+struct pfioc_ruleset {
+	u_int32_t	 nr;
+	char		 path[MAXPATHLEN];
+	char		 name[PF_ANCHOR_NAME_SIZE];
+};
+
+#define PF_RULESET_ALTQ		(PF_RULESET_MAX)
+#define PF_RULESET_TABLE	(PF_RULESET_MAX+1)
+struct pfioc_trans {
+	int		 size;	/* number of elements */
+	int		 esize; /* size of each element in bytes */
+	struct pfioc_trans_e {
+		int		rs_num;
+		char		anchor[MAXPATHLEN];
+		u_int32_t	ticket;
+	}		*array;
+};
+
+#define PFR_FLAG_ATOMIC		0x00000001
+#define PFR_FLAG_DUMMY		0x00000002
+#define PFR_FLAG_FEEDBACK	0x00000004
+#define PFR_FLAG_CLSTATS	0x00000008
+#define PFR_FLAG_ADDRSTOO	0x00000010
+#define PFR_FLAG_REPLACE	0x00000020
+#define PFR_FLAG_ALLRSETS	0x00000040
+#define PFR_FLAG_ALLMASK	0x0000007F
+#ifdef _KERNEL
+#define PFR_FLAG_USERIOCTL	0x10000000
+#endif
+
+struct pfioc_table {
+	struct pfr_table	 pfrio_table;
+	void			*pfrio_buffer;
+	int			 pfrio_esize;
+	int			 pfrio_size;
+	int			 pfrio_size2;
+	int			 pfrio_nadd;
+	int			 pfrio_ndel;
+	int			 pfrio_nchange;
+	int			 pfrio_flags;
+	u_int32_t		 pfrio_ticket;
+};
+#define	pfrio_exists	pfrio_nadd
+#define	pfrio_nzero	pfrio_nadd
+#define	pfrio_nmatch	pfrio_nadd
+#define pfrio_naddr	pfrio_size2
+#define pfrio_setflag	pfrio_size2
+#define pfrio_clrflag	pfrio_nadd
+
+struct pfioc_iface {
+	char	 pfiio_name[IFNAMSIZ];
+	void	*pfiio_buffer;
+	int	 pfiio_esize;
+	int	 pfiio_size;
+	int	 pfiio_nzero;
+	int	 pfiio_flags;
+};
+
+
+/*
+ * ioctl operations
+ */
+
+#define DIOCSTART	_IO  ('D',  1)
+#define DIOCSTOP	_IO  ('D',  2)
+#define DIOCADDRULE	_IOWR('D',  4, struct pfioc_rule)
+#define DIOCGETRULES	_IOWR('D',  6, struct pfioc_rule)
+#define DIOCGETRULE	_IOWR('D',  7, struct pfioc_rule)
+#define DIOCSETLCK  _IOWR('D', 8, uint32_t)
+/* XXX cut 9 - 17 */
+#define DIOCCLRSTATES	_IOWR('D', 18, struct pfioc_state_kill)
+#define DIOCGETSTATE	_IOWR('D', 19, struct pfioc_state)
+#define DIOCSETSTATUSIF _IOWR('D', 20, struct pfioc_if)
+#define DIOCGETSTATUS	_IOWR('D', 21, struct pf_status)
+#define DIOCCLRSTATUS	_IO  ('D', 22)
+#define DIOCNATLOOK	_IOWR('D', 23, struct pfioc_natlook)
+#define DIOCSETDEBUG	_IOWR('D', 24, u_int32_t)
+#define DIOCGETSTATES	_IOWR('D', 25, struct pfioc_states)
+#define DIOCCHANGERULE	_IOWR('D', 26, struct pfioc_rule)
+/* XXX cut 26 - 28 */
+#define DIOCSETTIMEOUT	_IOWR('D', 29, struct pfioc_tm)
+#define DIOCGETTIMEOUT	_IOWR('D', 30, struct pfioc_tm)
+#define DIOCADDSTATE	_IOWR('D', 37, struct pfioc_state)
+#define DIOCCLRRULECTRS	_IO  ('D', 38)
+#define DIOCGETLIMIT	_IOWR('D', 39, struct pfioc_limit)
+#define DIOCSETLIMIT	_IOWR('D', 40, struct pfioc_limit)
+#define DIOCKILLSTATES	_IOWR('D', 41, struct pfioc_state_kill)
+#define DIOCSTARTALTQ	_IO  ('D', 42)
+#define DIOCSTOPALTQ	_IO  ('D', 43)
+#define DIOCADDALTQ	_IOWR('D', 45, struct pfioc_altq)
+#define DIOCGETALTQS	_IOWR('D', 47, struct pfioc_altq)
+#define DIOCGETALTQ	_IOWR('D', 48, struct pfioc_altq)
+#define DIOCCHANGEALTQ	_IOWR('D', 49, struct pfioc_altq)
+#define DIOCGETQSTATS	_IOWR('D', 50, struct pfioc_qstats)
+#define DIOCBEGINADDRS	_IOWR('D', 51, struct pfioc_pooladdr)
+#define DIOCADDADDR	_IOWR('D', 52, struct pfioc_pooladdr)
+#define DIOCGETADDRS	_IOWR('D', 53, struct pfioc_pooladdr)
+#define DIOCGETADDR	_IOWR('D', 54, struct pfioc_pooladdr)
+#define DIOCCHANGEADDR	_IOWR('D', 55, struct pfioc_pooladdr)
+#define DIOCADDSTATES   _IOWR('D', 56, struct pfioc_states)
+/* XXX cut 57 - 57 */
+#define	DIOCGETRULESETS	_IOWR('D', 58, struct pfioc_ruleset)
+#define	DIOCGETRULESET	_IOWR('D', 59, struct pfioc_ruleset)
+#define	DIOCRCLRTABLES	_IOWR('D', 60, struct pfioc_table)
+#define	DIOCRADDTABLES	_IOWR('D', 61, struct pfioc_table)
+#define	DIOCRDELTABLES	_IOWR('D', 62, struct pfioc_table)
+#define	DIOCRGETTABLES	_IOWR('D', 63, struct pfioc_table)
+#define	DIOCRGETTSTATS	_IOWR('D', 64, struct pfioc_table)
+#define DIOCRCLRTSTATS  _IOWR('D', 65, struct pfioc_table)
+#define	DIOCRCLRADDRS	_IOWR('D', 66, struct pfioc_table)
+#define	DIOCRADDADDRS	_IOWR('D', 67, struct pfioc_table)
+#define	DIOCRDELADDRS	_IOWR('D', 68, struct pfioc_table)
+#define	DIOCRSETADDRS	_IOWR('D', 69, struct pfioc_table)
+#define	DIOCRGETADDRS	_IOWR('D', 70, struct pfioc_table)
+#define	DIOCRGETASTATS	_IOWR('D', 71, struct pfioc_table)
+#define DIOCRCLRASTATS  _IOWR('D', 72, struct pfioc_table)
+#define	DIOCRTSTADDRS	_IOWR('D', 73, struct pfioc_table)
+#define	DIOCRSETTFLAGS	_IOWR('D', 74, struct pfioc_table)
+#define DIOCRINADEFINE	_IOWR('D', 77, struct pfioc_table)
+#define DIOCOSFPFLUSH	_IO('D', 78)
+#define DIOCOSFPADD	_IOWR('D', 79, struct pf_osfp_ioctl)
+#define DIOCOSFPGET	_IOWR('D', 80, struct pf_osfp_ioctl)
+#define DIOCXBEGIN      _IOWR('D', 81, struct pfioc_trans)
+#define DIOCXCOMMIT     _IOWR('D', 82, struct pfioc_trans)
+#define DIOCXROLLBACK   _IOWR('D', 83, struct pfioc_trans)
+#define DIOCGETSRCNODES	_IOWR('D', 84, struct pfioc_src_nodes)
+#define DIOCCLRSRCNODES	_IO('D', 85)
+#define DIOCSETHOSTID	_IOWR('D', 86, u_int32_t)
+#define DIOCIGETIFACES	_IOWR('D', 87, struct pfioc_iface)
+#define DIOCSETIFFLAG	_IOWR('D', 89, struct pfioc_iface)
+#define DIOCCLRIFFLAG	_IOWR('D', 90, struct pfioc_iface)
+#define DIOCKILLSRCNODES	_IOWR('D', 91, struct pfioc_src_node_kill)
+
+#ifdef _KERNEL
+RB_HEAD(pf_src_tree, pf_src_node);
+RB_PROTOTYPE(pf_src_tree, pf_src_node, entry, pf_src_compare);
+extern struct pf_src_tree tree_src_tracking;
+
+RB_HEAD(pf_state_tree_id, pf_state);
+RB_PROTOTYPE(pf_state_tree_id, pf_state,
+    entry_id, pf_state_compare_id);
+extern struct pf_state_tree_id tree_id;
+extern struct pf_state_queue state_list;
+
+TAILQ_HEAD(pf_poolqueue, pf_pool);
+extern struct pf_poolqueue		  pf_pools[2];
+TAILQ_HEAD(pf_altqqueue, pf_altq);
+extern struct pf_altqqueue		  pf_altqs[2];
+extern struct pf_palist			  pf_pabuf;
+
+extern u_int32_t		 ticket_altqs_active;
+extern u_int32_t		 ticket_altqs_inactive;
+extern int			 altqs_inactive_open;
+extern u_int32_t		 ticket_pabuf;
+extern struct pf_altqqueue	*pf_altqs_active;
+extern struct pf_altqqueue	*pf_altqs_inactive;
+extern struct pf_poolqueue	*pf_pools_active;
+extern struct pf_poolqueue	*pf_pools_inactive;
+extern int			 pf_tbladdr_setup(struct pf_ruleset *,
+				    struct pf_addr_wrap *);
+extern void			 pf_tbladdr_remove(struct pf_addr_wrap *);
+extern void			 pf_tbladdr_copyout(struct pf_addr_wrap *);
+extern void			 pf_calc_skip_steps(struct pf_rulequeue *);
+extern struct pool		 pf_src_tree_pl, pf_rule_pl;
+extern struct pool		 pf_state_pl, pf_state_key_pl, pf_altq_pl,
+				    pf_pooladdr_pl;
+extern struct pool		 pf_state_scrub_pl;
+extern void			 pf_purge_thread(void *);
+extern void			 pf_purge_expired_src_nodes(int);
+extern void			 pf_purge_expired_states(u_int32_t);
+extern void			 pf_unlink_state(struct pf_state *);
+extern void			 pf_free_state(struct pf_state *);
+extern int			 pf_insert_state(struct pfi_kif *,
+				    struct pf_state *);
+extern int			 pf_insert_src_node(struct pf_src_node **,
+				    struct pf_rule *, struct pf_addr *,
+				    sa_family_t);
+void				 pf_src_tree_remove_state(struct pf_state *);
+extern struct pf_state		*pf_find_state_byid(struct pf_state_cmp *);
+extern struct pf_state		*pf_find_state_all(struct pf_state_key_cmp *,
+				    u_int8_t, int *);
+extern void			 pf_print_state(struct pf_state *);
+extern void			 pf_print_flags(u_int8_t);
+extern u_int16_t		 pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t,
+				    u_int8_t);
+
+extern struct ifnet		*sync_ifp;
+extern struct pf_rule		 pf_default_rule;
+extern void			 pf_addrcpy(struct pf_addr *,
+				    const struct pf_addr *, u_int8_t);
+void				 pf_rm_rule(struct pf_rulequeue *,
+				    struct pf_rule *);
+
+#ifdef INET
+int	pf_test(int, struct ifnet *, struct mbuf **, struct ether_header *);
+#endif /* INET */
+
+#ifdef INET6
+int	pf_test6(int, struct ifnet *, struct mbuf **, struct ether_header *);
+void	pf_poolmask(struct pf_addr *, struct pf_addr*,
+	    struct pf_addr *, const struct pf_addr *, u_int8_t);
+void	pf_addr_inc(struct pf_addr *, sa_family_t);
+#endif /* INET6 */
+
+void   *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *,
+	    sa_family_t);
+void	pf_change_a(void *, u_int16_t *, u_int32_t, u_int8_t);
+int	pflog_packet(struct pfi_kif *, struct mbuf *, sa_family_t, u_int8_t,
+	    u_int8_t, struct pf_rule *, struct pf_rule *, struct pf_ruleset *,
+	    struct pf_pdesc *);
+int	pf_match_addr(u_int8_t, struct pf_addr *, struct pf_addr *,
+	    struct pf_addr *, sa_family_t);
+int	pf_match(u_int8_t, u_int32_t, u_int32_t, u_int32_t);
+int	pf_match_port(u_int8_t, u_int16_t, u_int16_t, u_int16_t);
+int	pf_match_uid(u_int8_t, uid_t, uid_t, uid_t);
+int	pf_match_gid(u_int8_t, gid_t, gid_t, gid_t);
+
+void	pf_normalize_init(void);
+#ifdef _MODULE
+void	pf_normalize_destroy(void);
+#endif /* _MODULE */
+int	pf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *,
+	    struct pf_pdesc *);
+int	pf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *,
+	    struct pf_pdesc *);
+int	pf_normalize_tcp(int, struct pfi_kif *, struct mbuf *, int, int, void *,
+	    struct pf_pdesc *);
+void	pf_normalize_tcp_cleanup(struct pf_state *);
+int	pf_normalize_tcp_init(struct mbuf *, int, struct pf_pdesc *,
+	    struct tcphdr *, struct pf_state_peer *, struct pf_state_peer *);
+int	pf_normalize_tcp_stateful(struct mbuf *, int, struct pf_pdesc *,
+	    u_short *, struct tcphdr *, struct pf_state *,
+	    struct pf_state_peer *, struct pf_state_peer *, int *);
+u_int32_t
+	pf_state_expires(const struct pf_state *);
+void	pf_purge_expired_fragments(void);
+int	pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *);
+int	pf_rtlabel_match(struct pf_addr *, sa_family_t, struct pf_addr_wrap *);
+int	pf_socket_lookup(int, struct pf_pdesc *);
+struct pf_state_key *
+	pf_alloc_state_key(struct pf_state *);
+void	pfr_initialize(void);
+#ifdef _MODULE
+void	pfr_destroy(void);
+#endif /* _MODULE */
+int	pfr_match_addr(struct pfr_ktable *, struct pf_addr *, sa_family_t);
+void	pfr_update_stats(struct pfr_ktable *, struct pf_addr *, sa_family_t,
+	    u_int64_t, int, int, int);
+int	pfr_pool_get(struct pfr_ktable *, int *, struct pf_addr *,
+	    struct pf_addr **, struct pf_addr **, sa_family_t);
+void	pfr_dynaddr_update(struct pfr_ktable *, struct pfi_dynaddr *);
+struct pfr_ktable *
+	pfr_attach_table(struct pf_ruleset *, char *);
+void	pfr_detach_table(struct pfr_ktable *);
+int	pfr_clr_tables(struct pfr_table *, int *, int);
+int	pfr_add_tables(struct pfr_table *, int, int *, int);
+int	pfr_del_tables(struct pfr_table *, int, int *, int);
+int	pfr_get_tables(struct pfr_table *, struct pfr_table *, int *, int);
+int	pfr_get_tstats(struct pfr_table *, struct pfr_tstats *, int *, int);
+int	pfr_clr_tstats(struct pfr_table *, int, int *, int);
+int	pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int);
+int	pfr_clr_addrs(struct pfr_table *, int *, int);
+int	pfr_insert_kentry(struct pfr_ktable *, struct pfr_addr *, long);
+int	pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *,
+	    int);
+int	pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *,
+	    int);
+int	pfr_set_addrs(struct pfr_table *, struct pfr_addr *, int, int *,
+	    int *, int *, int *, int, u_int32_t);
+int	pfr_get_addrs(struct pfr_table *, struct pfr_addr *, int *, int);
+int	pfr_get_astats(struct pfr_table *, struct pfr_astats *, int *, int);
+int	pfr_clr_astats(struct pfr_table *, struct pfr_addr *, int, int *,
+	    int);
+int	pfr_tst_addrs(struct pfr_table *, struct pfr_addr *, int, int *,
+	    int);
+int	pfr_ina_begin(struct pfr_table *, u_int32_t *, int *, int);
+int	pfr_ina_rollback(struct pfr_table *, u_int32_t, int *, int);
+int	pfr_ina_commit(struct pfr_table *, u_int32_t, int *, int *, int);
+int	pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *,
+	    int *, u_int32_t, int);
+
+extern struct pfi_kif		*pfi_all;
+
+void		 pfi_initialize(void);
+#ifdef _MODULE
+void		 pfi_destroy(void);
+#endif /* _MODULE */
+struct pfi_kif	*pfi_kif_get(const char *);
+void		 pfi_kif_ref(struct pfi_kif *, enum pfi_kif_refs);
+void		 pfi_kif_unref(struct pfi_kif *, enum pfi_kif_refs);
+int		 pfi_kif_match(struct pfi_kif *, struct pfi_kif *);
+void		 pfi_attach_ifnet(struct ifnet *);
+void		 pfi_detach_ifnet(struct ifnet *);
+void		 pfi_attach_ifgroup(struct ifg_group *);
+void		 pfi_detach_ifgroup(struct ifg_group *);
+void		 pfi_group_change(const char *);
+int		 pfi_match_addr(struct pfi_dynaddr *, struct pf_addr *,
+		    sa_family_t);
+int		 pfi_dynaddr_setup(struct pf_addr_wrap *, sa_family_t);
+void		 pfi_dynaddr_remove(struct pf_addr_wrap *);
+void		 pfi_dynaddr_copyout(struct pf_addr_wrap *);
+void		 pfi_fill_oldstatus(struct pf_status *);
+int		 pfi_clr_istats(const char *);
+int		 pfi_get_ifaces(const char *, struct pfi_kif *, int *);
+int		 pfi_set_flags(const char *, int);
+int		 pfi_clear_flags(const char *, int);
+
+u_int16_t	 pf_tagname2tag(char *);
+void		 pf_tag2tagname(u_int16_t, char *);
+void		 pf_tag_ref(u_int16_t);
+void		 pf_tag_unref(u_int16_t);
+int		 pf_tag_packet(struct mbuf *, int, int);
+u_int32_t	 pf_qname2qid(char *);
+void		 pf_qid2qname(u_int32_t, char *);
+void		 pf_qid_unref(u_int32_t);
+
+extern struct pf_status	pf_status;
+extern struct pool	pf_frent_pl, pf_frag_pl;
+#ifdef __NetBSD__
+extern krwlock_t	pf_consistency_lock;
+#else
+extern struct rwlock	pf_consistency_lock;
+#endif /* !__NetBSD__ */
+
+struct pf_pool_limit {
+	void		*pp;
+	unsigned	 limit;
+};
+extern struct pf_pool_limit	pf_pool_limits[PF_LIMIT_MAX];
+
+/*
+ * misc compatibility definitions
+ */
+#if !defined(PRIu32)
+#define	PRIu32	"u"	/* XXX */
+#endif
+
+#if !defined(NO_PID)
+#define NO_PID		(PID_MAX + 1)
+#endif
+
+#if defined(__NetBSD__)
+/* rwlock compatibility definitions */
+#define rw_enter_write(a)	rw_enter((a), (RW_WRITER))
+#define rw_exit_write(a)	rw_exit((a))
+#define rw_enter_read(a)	rw_enter((a), (RW_READER))
+#define rw_exit_read(a)		rw_exit((a))
+#endif /* __NetBSD__ */
+
+#endif /* _KERNEL */
+
+extern struct pf_anchor_global  pf_anchors;
+extern struct pf_anchor        pf_main_anchor;
+#define pf_main_ruleset	pf_main_anchor.ruleset
+
+/* these ruleset functions can be linked into userland programs (pfctl) */
+int			 pf_get_ruleset_number(u_int8_t);
+void			 pf_init_ruleset(struct pf_ruleset *);
+int			 pf_anchor_setup(struct pf_rule *,
+			    const struct pf_ruleset *, const char *);
+int			 pf_anchor_copyout(const struct pf_ruleset *,
+			    const struct pf_rule *, struct pfioc_rule *);
+void			 pf_anchor_remove(struct pf_rule *);
+void			 pf_remove_if_empty_ruleset(struct pf_ruleset *);
+struct pf_anchor	*pf_find_anchor(const char *);
+struct pf_ruleset	*pf_find_ruleset(const char *);
+struct pf_ruleset	*pf_find_or_create_ruleset(const char *);
+void			 pf_rs_initialize(void);
+
+#ifdef _KERNEL
+int			 pf_anchor_copyout(const struct pf_ruleset *,
+			    const struct pf_rule *, struct pfioc_rule *);
+void			 pf_anchor_remove(struct pf_rule *);
+
+#endif /* _KERNEL */
+
+/* The fingerprint functions can be linked into userland programs (tcpdump) */
+int	pf_osfp_add(struct pf_osfp_ioctl *);
+#ifdef _KERNEL
+struct pf_osfp_enlist *
+	pf_osfp_fingerprint(struct pf_pdesc *, struct mbuf *, int,
+	    const struct tcphdr *);
+#endif /* _KERNEL */
+struct pf_osfp_enlist *
+	pf_osfp_fingerprint_hdr(const struct ip *, const struct ip6_hdr *,
+	    const struct tcphdr *);
+void	pf_osfp_flush(void);
+int	pf_osfp_get(struct pf_osfp_ioctl *);
+void	pf_osfp_initialize(void);
+#ifdef _MODULE
+void	pf_osfp_destroy(void);
+#endif /* _MODULE */
+int	pf_osfp_match(struct pf_osfp_enlist *, pf_osfp_t);
+struct pf_os_fingerprint *
+	pf_osfp_validate(void);
+
+
+#endif /* _NET_PFVAR_H_ */

Property changes on: lab4/.minix-src/include/net/pfvar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/msdosfs/bootsect.h
===================================================================
--- lab4/.minix-src/include/msdosfs/bootsect.h	(nonexistent)
+++ lab4/.minix-src/include/msdosfs/bootsect.h	(revision 13)
@@ -0,0 +1,112 @@
+/*	$NetBSD: bootsect.h,v 1.5 2012/11/04 17:57:59 jakllsch Exp $	*/
+
+/*
+ * Written by Paul Popelka (paulp@uts.amdahl.com)
+ *
+ * You can do anything you want with this software, just don't say you wrote
+ * it, and don't remove this notice.
+ *
+ * This software is provided "as is".
+ *
+ * The author supplies this software to be publicly redistributed on the
+ * understanding that the author is not responsible for the correct
+ * functioning of this software in any circumstances and is not liable for
+ * any damages caused by this software.
+ *
+ * October 1992
+ */
+#ifndef _MSDOSFS_BOOTSECT_H_
+#define _MSDOSFS_BOOTSECT_H_
+
+/*
+ * Format of a boot sector.  This is the first sector on a DOS floppy disk
+ * or the fist sector of a partition on a hard disk.  But, it is not the
+ * first sector of a partitioned hard disk.
+ */
+struct bootsector33 {
+	u_int8_t	bsJump[3];		/* jump inst E9xxxx or EBxx90 */
+	int8_t		bsOemName[8];		/* OEM name and version */
+	int8_t		bsBPB[19];		/* BIOS parameter block */
+	int8_t		bsDriveNumber;		/* drive number (0x80) */
+	int8_t		bsBootCode[479];	/* pad so struct is 512b */
+	u_int8_t	bsBootSectSig0;
+	u_int8_t	bsBootSectSig1;
+#define	BOOTSIG0	0x55
+#define	BOOTSIG1	0xaa
+};
+
+struct extboot {
+	int8_t		exDriveNumber;		/* drive number (0x80) */
+	int8_t		exReserved1;		/* reserved */
+	int8_t		exBootSignature;	/* ext. boot signature (0x29) */
+#define	EXBOOTSIG	0x29
+	int8_t		exVolumeID[4];		/* volume ID number */
+	int8_t		exVolumeLabel[11];	/* volume label */
+	int8_t		exFileSysType[8];	/* fs type (FAT12 or FAT16) */
+};
+
+struct bootsector50 {
+	u_int8_t	bsJump[3];		/* jump inst E9xxxx or EBxx90 */
+	int8_t		bsOemName[8];		/* OEM name and version */
+	int8_t		bsBPB[25];		/* BIOS parameter block */
+	int8_t		bsExt[26];		/* Bootsector Extension */
+	int8_t		bsBootCode[448];	/* pad so structure is 512b */
+	u_int8_t	bsBootSectSig0;
+	u_int8_t	bsBootSectSig1;
+#define	BOOTSIG0	0x55
+#define	BOOTSIG1	0xaa
+};
+
+struct bootsector710 {
+	u_int8_t	bsJump[3];		/* jump inst E9xxxx or EBxx90 */
+	int8_t		bsOEMName[8];		/* OEM name and version */
+	int8_t		bsBPB[53];		/* BIOS parameter block */
+	int8_t		bsExt[26];		/* Bootsector Extension */
+	int8_t		bsBootCode[420];	/* pad so structure is 512b */
+	u_int8_t	bsBootSectSig0;
+	u_int8_t	bsBootSectSig1;
+#define	BOOTSIG0	0x55
+#define	BOOTSIG1	0xaa
+};
+#ifdef	atari
+/*
+ * The boot sector on a GEMDOS FS is a little bit different from the MSDOS FS
+ * format. Currently there is no need to declare a separate structure, the
+ * bootsector33 struct will do.
+ */
+#if 0
+struct bootsec_atari {
+	u_int8_t	bsBranch[2];		/* branch inst if auto-boot	*/
+	int8_t		bsFiller[6];		/* anything or nothing		*/
+	int8_t		bsSerial[3];		/* serial no. for mediachange	*/
+	int8_t		bsBPB[19];		/* BIOS parameter block		*/
+	int8_t		bsBootCode[482];	/* pad so struct is 512b	*/
+};
+#endif
+#endif /* atari */
+
+union bootsector {
+	struct bootsector33 bs33;
+	struct bootsector50 bs50;
+	struct bootsector710 bs710;
+};
+
+#if 0
+/*
+ * Shorthand for fields in the bpb.
+ */
+#define	bsBytesPerSec	bsBPB.bpbBytesPerSec
+#define	bsSectPerClust	bsBPB.bpbSectPerClust
+#define	bsResSectors	bsBPB.bpbResSectors
+#define	bsFATS		bsBPB.bpbFATS
+#define	bsRootDirEnts	bsBPB.bpbRootDirEnts
+#define	bsSectors	bsBPB.bpbSectors
+#define	bsMedia		bsBPB.bpbMedia
+#define	bsFATsecs	bsBPB.bpbFATsecs
+#define	bsSectPerTrack	bsBPB.bpbSectPerTrack
+#define	bsHeads		bsBPB.bpbHeads
+#define	bsHiddenSecs	bsBPB.bpbHiddenSecs
+#define	bsHugeSectors	bsBPB.bpbHugeSectors
+#endif
+
+#endif /* _MSDOSFS_BOOTSECT_H_ */

Property changes on: lab4/.minix-src/include/msdosfs/bootsect.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/msdosfs/fat.h
===================================================================
--- lab4/.minix-src/include/msdosfs/fat.h	(nonexistent)
+++ lab4/.minix-src/include/msdosfs/fat.h	(revision 13)
@@ -0,0 +1,119 @@
+/*	$NetBSD: fat.h,v 1.9 2014/10/18 08:33:28 snj Exp $	*/
+
+/*-
+ * Copyright (C) 1994, 1997 Wolfgang Solfrank.
+ * Copyright (C) 1994, 1997 TooLs GmbH.
+ * All rights reserved.
+ * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
+ */
+/*
+ * Written by Paul Popelka (paulp@uts.amdahl.com)
+ *
+ * You can do anything you want with this software, just don't say you wrote
+ * it, and don't remove this notice.
+ *
+ * This software is provided "as is".
+ *
+ * The author supplies this software to be publicly redistributed on the
+ * understanding that the author is not responsible for the correct
+ * functioning of this software in any circumstances and is not liable for
+ * any damages caused by this software.
+ *
+ * October 1992
+ */
+
+#ifndef _MSDOSFS_FAT_H_
+#define _MSDOSFS_FAT_H_
+/*
+ * Some useful cluster numbers.
+ */
+#define	MSDOSFSROOT	0		/* cluster 0 means the root dir */
+#define	CLUST_FREE	0		/* cluster 0 also means a free cluster */
+#define	MSDOSFSFREE	CLUST_FREE
+#define	CLUST_FIRST	2		/* first legal cluster number */
+#define	CLUST_RSRVD	0xfffffff6	/* reserved cluster range */
+#define	CLUST_BAD	0xfffffff7	/* a cluster with a defect */
+#define	CLUST_EOFS	0xfffffff8	/* start of eof cluster range */
+#define	CLUST_EOFE	0xffffffff	/* end of eof cluster range */
+#define	CLUST_END	CLUST_EOFE	/* bigger than any valid cluster */
+
+#define	FAT12_MASK	0x00000fff	/* mask for 12 bit cluster numbers */
+#define	FAT16_MASK	0x0000ffff	/* mask for 16 bit cluster numbers */
+#define	FAT32_MASK	0x0fffffff	/* mask for FAT32 cluster numbers */
+
+/*
+ * MSDOSFS:
+ * Return true if filesystem uses 12 bit FATs. Microsoft Programmer's
+ * Reference says if the maximum cluster number in a filesystem is greater
+ * than 4084 ((CLUST_RSRVD - CLUST_FIRST) & FAT12_MASK) then we've got a
+ * 16 bit FAT filesystem. While mounting, the result of this test is stored
+ * in pm_fatentrysize.
+ * GEMDOS-flavour (atari):
+ * If the filesystem is on floppy we've got a 12 bit FAT filesystem, otherwise
+ * 16 bit. We check the d_type field in the disklabel struct while mounting
+ * and store the result in the pm_fatentrysize. Note that this kind of
+ * detection gets flakey when mounting a vnd-device.
+ */
+#define	FAT12(pmp)	(pmp->pm_fatmask == FAT12_MASK)
+#define	FAT16(pmp)	(pmp->pm_fatmask == FAT16_MASK)
+#define	FAT32(pmp)	(pmp->pm_fatmask == FAT32_MASK)
+
+/*
+ * M$ in its unlimited wisdom decided that EOF mark is anything
+ * between 0xfffffff8 and 0xffffffff (masked by appropriate fatmask,
+ * of course).
+ * Note that cn is supposed to be already adjusted accordingly to FAT type.
+ */
+#define	MSDOSFSEOF(cn, fatmask)	\
+	(((cn) & CLUST_EOFS) == (CLUST_EOFS & (fatmask)))
+
+#if defined(_KERNEL) || defined(MAKEFS)
+/*
+ * These are the values for the function argument to the function
+ * fatentry().
+ */
+#define	FAT_GET		0x0001	/* get a FAT entry */
+#define	FAT_SET		0x0002	/* set a FAT entry */
+#define	FAT_GET_AND_SET	(FAT_GET | FAT_SET)
+
+/*
+ * Flags to extendfile:
+ */
+#define	DE_CLEAR	1	/* Zero out the blocks allocated */
+
+int pcbmap(struct denode *, u_long, daddr_t *, u_long *, int *);
+int clusterfree(struct msdosfsmount *, u_long, u_long *);
+int clusteralloc(struct msdosfsmount *, u_long, u_long,u_long *,u_long *);
+int extendfile(struct denode *, u_long, struct buf **, u_long *, int);
+int fatentry(int, struct msdosfsmount *, u_long, u_long *, u_long);
+void fc_purge(struct denode *, u_int);
+void fc_lookup(struct denode *, u_long, u_long *, u_long *);
+int fillinusemap(struct msdosfsmount *);
+int freeclusterchain(struct msdosfsmount *, u_long);
+#endif /* _KERNEL || MAKEFS */
+#endif /* _MSDOSFS_FAT_H_ */

Property changes on: lab4/.minix-src/include/msdosfs/fat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/eth_hdr.h
===================================================================
--- lab4/.minix-src/include/net/gen/eth_hdr.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/eth_hdr.h	(revision 13)
@@ -0,0 +1,17 @@
+/*
+server/ip/gen/eth_hdr.h
+*/
+
+#ifndef __SERVER__IP__GEN__ETH_HDR_H__
+#define __SERVER__IP__GEN__ETH_HDR_H__
+
+#include <net/if_ether.h>
+
+typedef struct eth_hdr
+{
+	ether_addr_t eh_dst;
+	ether_addr_t eh_src;
+	ether_type_t eh_proto;
+} eth_hdr_t;
+
+#endif /* __SERVER__IP__GEN__ETH_HDR_H__ */

Property changes on: lab4/.minix-src/include/net/gen/eth_hdr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/icmp_hdr.h
===================================================================
--- lab4/.minix-src/include/net/gen/icmp_hdr.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/icmp_hdr.h	(revision 13)
@@ -0,0 +1,62 @@
+/*
+server/ip/gen/icmp_hdr.h
+*/
+
+#ifndef __SERVER__IP__GEN__ICMP_HDR_H__
+#define __SERVER__IP__GEN__ICMP_HDR_H__
+
+typedef struct icmp_id_seq
+{
+	u16_t	iis_id, iis_seq;
+} icmp_id_seq_t;
+
+typedef struct icmp_ip_id
+{
+	ip_hdr_t iii_hdr;
+	/* ip_hdr_options and 64 bytes of data */
+} icmp_ip_id_t;
+
+typedef struct icmp_ram		/* RFC 1256 */
+{
+	u8_t	iram_na;
+	u8_t	iram_aes;
+	u16_t	iram_lt;
+} icmp_ram_t;
+
+typedef struct icmp_pp
+{
+	u8_t	ipp_ptr;
+	u8_t	ipp_unused[3];
+} icmp_pp_t;
+
+typedef struct icmp_mtu		/* RFC 1191 */
+{
+	u16_t	im_unused;
+	u16_t	im_mtu;
+} icmp_mtu_t;
+
+typedef struct icmp_hdr
+{
+	u8_t ih_type, ih_code;
+	u16_t ih_chksum;
+	union
+	{
+		u32_t ihh_unused;
+		icmp_id_seq_t ihh_idseq;
+		ipaddr_t ihh_gateway;
+		icmp_ram_t ihh_ram;
+		icmp_pp_t ihh_pp;
+		icmp_mtu_t ihh_mtu;
+	} ih_hun;
+	union
+	{
+		icmp_ip_id_t ihd_ipid;
+		u8_t uhd_data[1];
+	} ih_dun;
+} icmp_hdr_t;
+
+#endif /* __SERVER__IP__GEN__ICMP_HDR_H__ */
+
+/*
+ * $PchId: icmp_hdr.h,v 1.5 2002/06/10 07:10:48 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/icmp_hdr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/ip_hdr.h
===================================================================
--- lab4/.minix-src/include/net/gen/ip_hdr.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/ip_hdr.h	(revision 13)
@@ -0,0 +1,47 @@
+/*
+server/ip/gen/ip_hdr.h
+*/
+
+#ifndef __SERVER__IP__GEN__HDR_H__
+#define __SERVER__IP__GEN__HDR_H__
+
+typedef struct ip_hdr
+{
+	u8_t ih_vers_ihl,
+		ih_tos;
+	u16_t ih_length,
+		ih_id,
+		ih_flags_fragoff;
+	u8_t ih_ttl,
+		ih_proto;
+	u16_t ih_hdr_chk;
+	ipaddr_t ih_src,
+		ih_dst;
+} ip_hdr_t;
+
+#define IH_IHL_MASK	0xf
+#define IH_VERSION_MASK	0xf
+#define IH_FRAGOFF_MASK	0x1fff
+#define IH_MORE_FRAGS	0x2000
+#define IH_DONT_FRAG	0x4000
+#define IH_FLAGS_UNUSED	0x8000
+
+#define IP_OPT_COPIED	0x80
+#define IP_OPT_NUMBER	0x1f
+
+#define IP_OPT_EOL	0x00	/* End of Options List, RFC-791 */
+#define IP_OPT_NOP	0x01	/* No Operation, RFC-791 */
+#define IP_OPT_RR	0x07	/* Record Route, RFC-791 */
+#define IP_OPT_TS	0x44	/* Timestamp, RFC-791 */
+#define IP_OPT_SEC	0x82	/* Security, RFC-1108 */
+#define IP_OPT_LSRR	0x83	/* Loose Source Route, RFC-791 */
+#define IP_OPT_SSRR	0x89	/* Strict Source Route, RFC-791 */
+#define IP_OPT_RTRALT	0x94	/* Router Alert, RFC-2113 */
+
+#define IP_OPT_RR_MIN		4
+
+#endif /* __SERVER__IP__GEN__HDR_H__ */
+
+/*
+ * $PchId: ip_hdr.h,v 1.5 2002/06/10 07:11:46 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/ip_hdr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/route.h
===================================================================
--- lab4/.minix-src/include/net/gen/route.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/route.h	(revision 13)
@@ -0,0 +1,31 @@
+/*
+server/ip/gen/route.h
+*/
+
+#ifndef __SERVER__IP__GEN__ROUTE_H__
+#define __SERVER__IP__GEN__ROUTE_H__
+
+typedef struct nwio_route
+{
+	u32_t nwr_ent_no;
+	u32_t nwr_ent_count;
+	ipaddr_t nwr_dest;
+	ipaddr_t nwr_netmask;
+	ipaddr_t nwr_gateway;
+	u32_t nwr_dist;
+	u32_t nwr_flags;
+	u32_t nwr_pref;
+	u32_t nwr_mtu;		/* Ignored, compatibility with VMD */
+	ipaddr_t nwr_ifaddr;
+} nwio_route_t;
+
+#define NWRF_EMPTY		0
+#define NWRF_INUSE		1
+#define NWRF_STATIC		2
+#define NWRF_UNREACHABLE	4
+
+#endif /* __SERVER__IP__GEN__ROUTE_H__ */
+
+/*
+ * $PchId: route.h,v 1.3 1995/11/17 22:19:50 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/route.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/tcp_io.h
===================================================================
--- lab4/.minix-src/include/net/gen/tcp_io.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/tcp_io.h	(revision 13)
@@ -0,0 +1,82 @@
+/*
+server/ip/gen/tcp_io.h
+*/
+
+#ifndef __SERVER__IP__GEN__TCP_IO_H__
+#define __SERVER__IP__GEN__TCP_IO_H__
+
+typedef struct nwio_tcpconf
+{
+	u32_t nwtc_flags;
+	ipaddr_t nwtc_locaddr;
+	ipaddr_t nwtc_remaddr;
+	tcpport_t nwtc_locport;
+	tcpport_t nwtc_remport;
+} nwio_tcpconf_t;
+
+#define NWTC_NOFLAGS	0x0000L
+#define NWTC_ACC_MASK	0x0003L
+#	define NWTC_EXCL	0x00000001L
+#	define NWTC_SHARED	0x00000002L
+#	define NWTC_COPY	0x00000003L
+#define NWTC_LOCPORT_MASK	0x0030L
+#	define NWTC_LP_UNSET	0x00000010L
+#	define NWTC_LP_SET	0x00000020L
+#	define NWTC_LP_SEL	0x00000030L
+#define NWTC_REMADDR_MASK	0x0100L
+#	define NWTC_SET_RA	0x00000100L
+#	define NWTC_UNSET_RA	0x01000000L
+#define NWTC_REMPORT_MASK	0x0200L
+#	define NWTC_SET_RP	0x00000200L
+#	define NWTC_UNSET_RP	0x02000000L
+
+typedef struct nwio_tcpcl
+{
+	long nwtcl_flags;
+	long nwtcl_ttl;
+} nwio_tcpcl_t;
+
+#define TCF_DEFAULT	0	/* Default parameters */
+#define TCF_ASYNCH	1	/* Asynchronous connect for non-blocking
+				 * socket emulation.
+				 */
+
+typedef struct nwio_tcpatt
+{
+	long nwta_flags;
+} nwio_tcpatt_t;
+
+typedef struct nwio_tcpopt
+{
+	u32_t nwto_flags;
+} nwio_tcpopt_t;
+
+#define NWTO_NOFLAG		0x0000L
+#define NWTO_SND_URG_MASK	0x0001L
+#	define NWTO_SND_URG	0x00000001L
+#	define NWTO_SND_NOTURG	0x00010000L
+#define NWTO_RCV_URG_MASK	0x0002L
+#	define NWTO_RCV_URG	0x00000002L
+#	define NWTO_RCV_NOTURG	0x00020000L
+#define NWTO_BSD_URG_MASK	0x0004L
+#	define NWTO_BSD_URG	0x00000004L
+#	define NWTO_NOTBSD_URG	0x00040000L
+#define NWTO_DEL_RST_MASK	0x0008L
+#	define NWTO_DEL_RST	0x00000008L
+#define NWTO_BULK_MASK		0x0010L
+#	define NWTO_BULK	0x00000010L
+#	define NWTO_NOBULK	0x00100000L
+
+#define TC_SECRET_SIZE	12
+
+typedef struct tcp_cookie
+{
+	u32_t tc_ref;
+	u8_t tc_secret[TC_SECRET_SIZE];
+} tcp_cookie_t;
+
+#endif /* __SERVER__IP__GEN__TCP_IO_H__ */
+
+/*
+ * $PchId: tcp_io.h,v 1.5 2001/02/19 07:36:55 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/tcp_io.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/udp_io_hdr.h
===================================================================
--- lab4/.minix-src/include/net/gen/udp_io_hdr.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/udp_io_hdr.h	(revision 13)
@@ -0,0 +1,16 @@
+#ifndef __SERVER__IP__GEN__UDP_IO_HDR_H__
+#define __SERVER__IP__GEN__UDP_IO_HDR_H__
+
+
+typedef struct udp_io_hdr
+{
+	ipaddr_t uih_src_addr;
+	ipaddr_t uih_dst_addr;
+	udpport_t uih_src_port;
+	udpport_t uih_dst_port;
+	u16_t uih_ip_opt_len;
+	u16_t uih_data_len;
+} udp_io_hdr_t;
+
+
+#endif /* __SERVER__IP__GEN__UDP_IO_HDR_H__ */

Property changes on: lab4/.minix-src/include/net/gen/udp_io_hdr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/bpfjit.h
===================================================================
--- lab4/.minix-src/include/net/bpfjit.h	(nonexistent)
+++ lab4/.minix-src/include/net/bpfjit.h	(revision 13)
@@ -0,0 +1,71 @@
+/*	$NetBSD: bpfjit.h,v 1.4 2014/06/25 19:32:37 alnsn Exp $	*/
+
+/*-
+ * Copyright (c) 2011-2014 Alexander Nasonov.
+ * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _NET_BPFJIT_H_
+#define _NET_BPFJIT_H_
+
+#ifndef _KERNEL
+#include <stddef.h>
+#include <stdint.h>
+#endif
+
+#include <sys/types.h>
+
+#ifdef __linux
+#include <pcap-bpf.h>
+#else
+#include <net/bpf.h>
+#endif
+
+/*
+ * Return value of a function generated by sljit have sljit_uw type
+ * which can have a greater width. In such cases, we rely on the fact
+ * that calling conventions use same registers for smaller types.
+ * SLJIT_MOV_UI is passed to sljit_emit_return() to make sure that the
+ * return value is truncated to unsigned int.
+ */
+typedef unsigned int (*bpfjit_func_t)(const bpf_ctx_t *, bpf_args_t *);
+
+bpfjit_func_t bpfjit_generate_code(const bpf_ctx_t *,
+    const struct bpf_insn *, size_t);
+void bpfjit_free_code(bpfjit_func_t);
+
+#ifdef _KERNEL
+struct bpfjit_ops {
+	bpfjit_func_t (*bj_generate_code)(const bpf_ctx_t *,
+	    const struct bpf_insn *, size_t);
+	void (*bj_free_code)(bpfjit_func_t);
+};
+
+extern struct bpfjit_ops bpfjit_module_ops;
+#endif
+
+#endif /* !_NET_BPFJIT_H_ */

Property changes on: lab4/.minix-src/include/net/bpfjit.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net80211/ieee80211.h
===================================================================
--- lab4/.minix-src/include/net80211/ieee80211.h	(nonexistent)
+++ lab4/.minix-src/include/net80211/ieee80211.h	(revision 13)
@@ -0,0 +1,762 @@
+/*	$NetBSD: ieee80211.h,v 1.26 2013/03/30 14:14:31 christos Exp $	*/
+/*-
+ * Copyright (c) 2001 Atsushi Onoe
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * 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.
+ *
+ * $FreeBSD: src/sys/net80211/ieee80211.h,v 1.10 2005/07/22 16:55:27 sam Exp $
+ */
+#ifndef _NET80211_IEEE80211_H_
+#define _NET80211_IEEE80211_H_
+
+/*
+ * 802.11 protocol definitions.
+ */
+
+#define	IEEE80211_ADDR_LEN	6		/* size of 802.11 address */
+/* is 802.11 address multicast/broadcast? */
+#define	IEEE80211_IS_MULTICAST(_a)	(*(_a) & 0x01)
+
+/* IEEE 802.11 PLCP header */
+struct ieee80211_plcp_hdr {
+	u_int16_t	i_sfd;
+	u_int8_t	i_signal;
+	u_int8_t	i_service;
+	u_int16_t	i_length;
+	u_int16_t	i_crc;
+} __packed;
+
+#define IEEE80211_PLCP_SFD      0xF3A0
+#define IEEE80211_PLCP_SERVICE  0x00
+
+/*
+ * generic definitions for IEEE 802.11 frames
+ */
+struct ieee80211_frame {
+	u_int8_t	i_fc[2];
+	u_int8_t	i_dur[2];
+	u_int8_t	i_addr1[IEEE80211_ADDR_LEN];
+	u_int8_t	i_addr2[IEEE80211_ADDR_LEN];
+	u_int8_t	i_addr3[IEEE80211_ADDR_LEN];
+	u_int8_t	i_seq[2];
+	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
+	/* see below */
+} __packed;
+
+struct ieee80211_qosframe {
+	u_int8_t	i_fc[2];
+	u_int8_t	i_dur[2];
+	u_int8_t	i_addr1[IEEE80211_ADDR_LEN];
+	u_int8_t	i_addr2[IEEE80211_ADDR_LEN];
+	u_int8_t	i_addr3[IEEE80211_ADDR_LEN];
+	u_int8_t	i_seq[2];
+	u_int8_t	i_qos[2];
+	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
+	/* see below */
+} __packed;
+
+struct ieee80211_qoscntl {
+	u_int8_t	i_qos[2];
+};
+
+struct ieee80211_frame_addr4 {
+	u_int8_t	i_fc[2];
+	u_int8_t	i_dur[2];
+	u_int8_t	i_addr1[IEEE80211_ADDR_LEN];
+	u_int8_t	i_addr2[IEEE80211_ADDR_LEN];
+	u_int8_t	i_addr3[IEEE80211_ADDR_LEN];
+	u_int8_t	i_seq[2];
+	u_int8_t	i_addr4[IEEE80211_ADDR_LEN];
+} __packed;
+
+
+struct ieee80211_qosframe_addr4 {
+	u_int8_t	i_fc[2];
+	u_int8_t	i_dur[2];
+	u_int8_t	i_addr1[IEEE80211_ADDR_LEN];
+	u_int8_t	i_addr2[IEEE80211_ADDR_LEN];
+	u_int8_t	i_addr3[IEEE80211_ADDR_LEN];
+	u_int8_t	i_seq[2];
+	u_int8_t	i_addr4[IEEE80211_ADDR_LEN];
+	u_int8_t	i_qos[2];
+} __packed;
+
+#define	IEEE80211_FC0_VERSION_MASK		0x03
+#define	IEEE80211_FC0_VERSION_SHIFT		0
+#define	IEEE80211_FC0_VERSION_0			0x00
+#define	IEEE80211_FC0_TYPE_MASK			0x0c
+#define	IEEE80211_FC0_TYPE_SHIFT		2
+#define	IEEE80211_FC0_TYPE_MGT			0x00
+#define	IEEE80211_FC0_TYPE_CTL			0x04
+#define	IEEE80211_FC0_TYPE_DATA			0x08
+
+#define	IEEE80211_FC0_SUBTYPE_MASK		0xf0
+#define	IEEE80211_FC0_SUBTYPE_SHIFT		4
+/* for TYPE_MGT */
+#define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00
+#define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10
+#define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20
+#define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30
+#define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40
+#define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50
+#define	IEEE80211_FC0_SUBTYPE_BEACON		0x80
+#define	IEEE80211_FC0_SUBTYPE_ATIM		0x90
+#define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0
+#define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0
+#define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0
+/* for TYPE_CTL */
+#define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0
+#define	IEEE80211_FC0_SUBTYPE_RTS		0xb0
+#define	IEEE80211_FC0_SUBTYPE_CTS		0xc0
+#define	IEEE80211_FC0_SUBTYPE_ACK		0xd0
+#define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0
+#define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0
+/* for TYPE_DATA (bit combination) */
+#define	IEEE80211_FC0_SUBTYPE_DATA		0x00
+#define	IEEE80211_FC0_SUBTYPE_CF_ACK		0x10
+#define	IEEE80211_FC0_SUBTYPE_CF_POLL		0x20
+#define	IEEE80211_FC0_SUBTYPE_CF_ACPL		0x30
+#define	IEEE80211_FC0_SUBTYPE_NODATA		0x40
+#define	IEEE80211_FC0_SUBTYPE_CFACK		0x50
+#define	IEEE80211_FC0_SUBTYPE_CFPOLL		0x60
+#define	IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK	0x70
+#define	IEEE80211_FC0_SUBTYPE_QOS		0x80
+#define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0
+
+/*
+ * DS bit usage
+ *
+ * TA = transmitter address
+ * RA = receiver address
+ * DA = destination address
+ * SA = source address
+ *
+ * ToDS    FromDS  A1(RA)  A2(TA)  A3      A4      Use
+ * -----------------------------------------------------------------
+ *  0       0       DA      SA      BSSID   -       IBSS/DLS
+ *  0       1       DA      BSSID   SA      -       AP -> STA
+ *  1       0       BSSID   SA      DA      -       AP <- STA
+ *  1       1       RA      TA      DA      SA      unspecified (WDS)
+ */
+#define	IEEE80211_FC1_DIR_MASK			0x03
+#define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */
+#define	IEEE80211_FC1_DIR_TODS			0x01	/* STA->AP  */
+#define	IEEE80211_FC1_DIR_FROMDS		0x02	/* AP ->STA */
+#define	IEEE80211_FC1_DIR_DSTODS		0x03	/* AP ->AP  */
+
+#define	IEEE80211_FC1_MORE_FRAG			0x04
+#define	IEEE80211_FC1_RETRY			0x08
+#define	IEEE80211_FC1_PWR_MGT			0x10
+#define	IEEE80211_FC1_MORE_DATA			0x20
+#define	IEEE80211_FC1_PROTECTED			0x40
+#define	IEEE80211_FC1_WEP			0x40	/* pre-RSNA compat */
+#define	IEEE80211_FC1_ORDER			0x80
+
+#define	IEEE80211_SEQ_FRAG_MASK			0x000f
+#define	IEEE80211_SEQ_FRAG_SHIFT		0
+#define	IEEE80211_SEQ_SEQ_MASK			0xfff0
+#define	IEEE80211_SEQ_SEQ_SHIFT			4
+
+#define	IEEE80211_NWID_LEN			32
+
+/*
+ * QoS Control field (see 7.1.3.5).
+ */
+/* bit 8 is reserved */
+#define	IEEE80211_QOS_TXOP			0xff00
+#define	IEEE80211_QOS_AMSDU			0x0080  /* 11n */
+#define	IEEE80211_QOS_ACKPOLICY_NORMAL          0x0000
+#define	IEEE80211_QOS_ACKPOLICY_NOACK           0x0020
+#define	IEEE80211_QOS_ACKPOLICY_NOEXPLACK       0x0040
+#define	IEEE80211_QOS_ACKPOLICY			0x0060
+#define	IEEE80211_QOS_ACKPOLICY_S		5
+#define	IEEE80211_QOS_ACKPOLICY_MASK		0x0060
+#define	IEEE80211_QOS_ACKPOLICY_BA		0x0060
+#define	IEEE80211_QOS_ESOP			0x0010
+#define	IEEE80211_QOS_ESOP_S			4
+#define	IEEE80211_QOS_TID			0x000f
+
+/*
+ * WME/802.11e information element.
+ */
+struct ieee80211_wme_info {
+	u_int8_t	wme_id;		/* IEEE80211_ELEMID_VENDOR */
+	u_int8_t	wme_len;	/* length in bytes */
+	u_int8_t	wme_oui[3];	/* 0x00, 0x50, 0xf2 */
+	u_int8_t	wme_type;	/* OUI type */
+	u_int8_t	wme_subtype;	/* OUI subtype */
+	u_int8_t	wme_version;	/* spec revision */
+	u_int8_t	wme_info;	/* QoS info */
+} __packed;
+
+/*
+ * WME/802.11e Tspec Element
+ */
+struct ieee80211_wme_tspec {
+	u_int8_t	ts_id;
+	u_int8_t	ts_len;
+	u_int8_t	ts_oui[3];
+	u_int8_t	ts_oui_type;
+	u_int8_t	ts_oui_subtype;
+	u_int8_t	ts_version;
+	u_int8_t	ts_tsinfo[3];
+	u_int8_t	ts_nom_msdu[2];
+	u_int8_t	ts_max_msdu[2];
+	u_int8_t	ts_min_svc[4];
+	u_int8_t	ts_max_svc[4];
+	u_int8_t	ts_inactv_intv[4];
+	u_int8_t	ts_susp_intv[4];
+	u_int8_t	ts_start_svc[4];
+	u_int8_t	ts_min_rate[4];
+	u_int8_t	ts_mean_rate[4];
+	u_int8_t	ts_max_burst[4];
+	u_int8_t	ts_min_phy[4];
+	u_int8_t	ts_peak_rate[4];
+	u_int8_t	ts_delay[4];
+	u_int8_t	ts_surplus[2];
+	u_int8_t	ts_medium_time[2];
+} __packed;
+
+/*
+ * WME AC parameter field
+ */
+struct ieee80211_wme_acparams {
+	u_int8_t	acp_aci_aifsn;
+	u_int8_t	acp_logcwminmax;
+	u_int16_t	acp_txop;
+} __packed;
+
+/* WME stream classes */
+enum ieee80211_wme_ac {
+	WME_AC_BE	= 0,		/* best effort */
+	WME_AC_BK	= 1,		/* background */
+	WME_AC_VI	= 2,		/* video */
+	WME_AC_VO	= 3,		/* voice */
+};
+#define WME_NUM_AC	4		/* 4 AC categories */
+
+#define WME_PARAM_ACI		0x60	/* Mask for ACI field */
+#define WME_PARAM_ACI_S		5	/* Shift for ACI field */
+#define WME_PARAM_ACM		0x10	/* Mask for ACM bit */
+#define WME_PARAM_ACM_S		4	/* Shift for ACM bit */
+#define WME_PARAM_AIFSN		0x0f	/* Mask for aifsn field */
+#define WME_PARAM_AIFSN_S	0	/* Shift for aifsn field */
+#define WME_PARAM_LOGCWMIN	0x0f	/* Mask for CwMin field (in log) */
+#define WME_PARAM_LOGCWMIN_S	0	/* Shift for CwMin field */
+#define WME_PARAM_LOGCWMAX	0xf0	/* Mask for CwMax field (in log) */
+#define WME_PARAM_LOGCWMAX_S	4	/* Shift for CwMax field */
+
+#define WME_AC_TO_TID(_ac) (       \
+	((_ac) == WME_AC_VO) ? 6 : \
+	((_ac) == WME_AC_VI) ? 5 : \
+	((_ac) == WME_AC_BK) ? 1 : \
+	0)
+
+#define TID_TO_WME_AC(_tid) (      \
+	((_tid) < 1) ? WME_AC_BE : \
+	((_tid) < 3) ? WME_AC_BK : \
+	((_tid) < 6) ? WME_AC_VI : \
+	WME_AC_VO)
+
+/*
+ * WME Parameter Element
+ */
+struct ieee80211_wme_param {
+	u_int8_t	param_id;
+	u_int8_t	param_len;
+	u_int8_t	param_oui[3];
+	u_int8_t	param_oui_type;
+	u_int8_t	param_oui_sybtype;
+	u_int8_t	param_version;
+	u_int8_t	param_qosInfo;
+#define	WME_QOSINFO_COUNT	0x0f	/* Mask for param count field */
+	u_int8_t	param_reserved;
+	struct ieee80211_wme_acparams	params_acParams[WME_NUM_AC];
+} __packed;
+
+/*
+ * Management Notification Frame
+ */
+struct ieee80211_mnf {
+	u_int8_t	mnf_category;
+	u_int8_t	mnf_action;
+	u_int8_t	mnf_dialog;
+	u_int8_t	mnf_status;
+} __packed;
+#define	MNF_SETUP_REQ	0
+#define	MNF_SETUP_RESP	1
+#define	MNF_TEARDOWN	2
+
+/*
+ * Control frames.
+ */
+struct ieee80211_frame_min {
+	u_int8_t	i_fc[2];
+	u_int8_t	i_dur[2];
+	u_int8_t	i_addr1[IEEE80211_ADDR_LEN];
+	u_int8_t	i_addr2[IEEE80211_ADDR_LEN];
+	/* FCS */
+} __packed;
+
+struct ieee80211_frame_rts {
+	u_int8_t	i_fc[2];
+	u_int8_t	i_dur[2];
+	u_int8_t	i_ra[IEEE80211_ADDR_LEN];
+	u_int8_t	i_ta[IEEE80211_ADDR_LEN];
+	/* FCS */
+} __packed;
+
+struct ieee80211_frame_cts {
+	u_int8_t	i_fc[2];
+	u_int8_t	i_dur[2];
+	u_int8_t	i_ra[IEEE80211_ADDR_LEN];
+	/* FCS */
+} __packed;
+
+struct ieee80211_frame_ack {
+	u_int8_t	i_fc[2];
+	u_int8_t	i_dur[2];
+	u_int8_t	i_ra[IEEE80211_ADDR_LEN];
+	/* FCS */
+} __packed;
+
+struct ieee80211_frame_pspoll {
+	u_int8_t	i_fc[2];
+	u_int8_t	i_aid[2];
+	u_int8_t	i_bssid[IEEE80211_ADDR_LEN];
+	u_int8_t	i_ta[IEEE80211_ADDR_LEN];
+	/* FCS */
+} __packed;
+
+struct ieee80211_frame_cfend {		/* NB: also CF-End+CF-Ack */
+	u_int8_t	i_fc[2];
+	u_int8_t	i_dur[2];	/* should be zero */
+	u_int8_t	i_ra[IEEE80211_ADDR_LEN];
+	u_int8_t	i_bssid[IEEE80211_ADDR_LEN];
+	/* FCS */
+} __packed;
+
+static __inline int
+ieee80211_has_seq(const struct ieee80211_frame *wh)
+{
+	return (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) !=
+	    IEEE80211_FC0_TYPE_CTL;
+}
+
+static __inline int
+ieee80211_has_addr4(const struct ieee80211_frame *wh)
+{
+	return (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) ==
+	    IEEE80211_FC1_DIR_DSTODS;
+}
+
+static __inline int
+ieee80211_has_qos(const struct ieee80211_frame *wh)
+{
+	return (wh->i_fc[0] &
+	    (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) ==
+	    (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS);
+}
+
+static __inline int
+ieee80211_has_htc(const struct ieee80211_frame *wh)
+{
+	return (wh->i_fc[1] & IEEE80211_FC1_ORDER) &&
+	    (ieee80211_has_qos(wh) ||
+	     (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
+	     IEEE80211_FC0_TYPE_MGT);
+}
+
+static __inline u_int16_t
+ieee80211_get_qos(const struct ieee80211_frame *wh)
+{
+	const u_int8_t *frm;
+
+	if (ieee80211_has_addr4(wh))
+		frm = ((const struct ieee80211_qosframe_addr4 *)wh)->i_qos;
+	else
+		frm = ((const struct ieee80211_qosframe *)wh)->i_qos;
+
+	return le16toh(*(const u_int16_t *)frm);
+}
+
+/*
+ * BEACON management packets
+ *
+ *	octet timestamp[8]
+ *	octet beacon interval[2]
+ *	octet capability information[2]
+ *	information element
+ *		octet elemid
+ *		octet length
+ *		octet information[length]
+ */
+
+typedef u_int8_t *ieee80211_mgt_beacon_t;
+
+#define	IEEE80211_BEACON_INTERVAL(beacon) \
+	((beacon)[8] | ((beacon)[9] << 8))
+#define	IEEE80211_BEACON_CAPABILITY(beacon) \
+	((beacon)[10] | ((beacon)[11] << 8))
+
+#define	IEEE80211_CAPINFO_ESS			0x0001
+#define	IEEE80211_CAPINFO_IBSS			0x0002
+#define	IEEE80211_CAPINFO_CF_POLLABLE		0x0004
+#define	IEEE80211_CAPINFO_CF_POLLREQ		0x0008
+#define	IEEE80211_CAPINFO_PRIVACY		0x0010
+#define	IEEE80211_CAPINFO_SHORT_PREAMBLE	0x0020
+#define	IEEE80211_CAPINFO_PBCC			0x0040
+#define	IEEE80211_CAPINFO_CHNL_AGILITY		0x0080
+/* bits 8-9 are reserved */
+#define	IEEE80211_CAPINFO_SHORT_SLOTTIME	0x0400
+#define	IEEE80211_CAPINFO_RSN			0x0800
+/* bit 12 is reserved */
+#define	IEEE80211_CAPINFO_DSSSOFDM		0x2000
+/* bits 14-15 are reserved */
+
+/*
+ * 802.11i/WPA information element (maximally sized).
+ */
+struct ieee80211_ie_wpa {
+	u_int8_t	wpa_id;		/* IEEE80211_ELEMID_VENDOR */
+	u_int8_t	wpa_len;	/* length in bytes */
+	u_int8_t	wpa_oui[3];	/* 0x00, 0x50, 0xf2 */
+	u_int8_t	wpa_type;	/* OUI type */
+	u_int16_t	wpa_version;	/* spec revision */
+	u_int32_t	wpa_mcipher[1];	/* multicast/group key cipher */
+	u_int16_t	wpa_uciphercnt;	/* # pairwise key ciphers */
+	u_int32_t	wpa_uciphers[8];/* ciphers */
+	u_int16_t	wpa_authselcnt;	/* authentication selector cnt*/
+	u_int32_t	wpa_authsels[8];/* selectors */
+	u_int16_t	wpa_caps;	/* 802.11i capabilities */
+	u_int16_t	wpa_pmkidcnt;	/* 802.11i pmkid count */
+	u_int16_t	wpa_pmkids[8];	/* 802.11i pmkids */
+} __packed;
+
+/*
+ * Management information element payloads.
+ */
+
+enum {
+	IEEE80211_ELEMID_SSID		= 0,
+	IEEE80211_ELEMID_RATES		= 1,
+	IEEE80211_ELEMID_FHPARMS	= 2,
+	IEEE80211_ELEMID_DSPARMS	= 3,
+	IEEE80211_ELEMID_CFPARMS	= 4,
+	IEEE80211_ELEMID_TIM		= 5,
+	IEEE80211_ELEMID_IBSSPARMS	= 6,
+	IEEE80211_ELEMID_COUNTRY	= 7,
+	IEEE80211_ELEMID_EDCAPARMS	= 12,
+	IEEE80211_ELEMID_CHALLENGE	= 16,
+	/* 17-31 reserved for challenge text extension */
+	IEEE80211_ELEMID_PWRCNSTR	= 32,
+	IEEE80211_ELEMID_PWRCAP		= 33,
+	IEEE80211_ELEMID_TPCREQ		= 34,
+	IEEE80211_ELEMID_TPCREP		= 35,
+	IEEE80211_ELEMID_SUPPCHAN	= 36,
+	IEEE80211_ELEMID_CHANSWITCHANN	= 37,
+	IEEE80211_ELEMID_MEASREQ	= 38,
+	IEEE80211_ELEMID_MEASREP	= 39,
+	IEEE80211_ELEMID_QUIET		= 40,
+	IEEE80211_ELEMID_IBSSDFS	= 41,
+	IEEE80211_ELEMID_ERP		= 42,
+	IEEE80211_ELEMID_HTCAP		= 45,	/* 11n */
+	IEEE80211_ELEMID_QOS_CAP	= 46,
+	IEEE80211_ELEMID_RSN		= 48,
+	IEEE80211_ELEMID_XRATES		= 50,
+	IEEE80211_ELEMID_TIE		= 56,	/* 11r */
+	IEEE80211_ELEMID_HTINFO		= 61,	/* 11n */
+	IEEE80211_ELEMID_MMIE		= 76,	/* 11w */
+	IEEE80211_ELEMID_TPC		= 150,
+	IEEE80211_ELEMID_CCKM		= 156,
+	IEEE80211_ELEMID_VENDOR		= 221	/* vendor private */
+};
+
+struct ieee80211_tim_ie {
+	u_int8_t	tim_ie;			/* IEEE80211_ELEMID_TIM */
+	u_int8_t	tim_len;
+	u_int8_t	tim_count;		/* DTIM count */
+	u_int8_t	tim_period;		/* DTIM period */
+	u_int8_t	tim_bitctl;		/* bitmap control */
+	u_int8_t	tim_bitmap[1];		/* variable-length bitmap */
+} __packed;
+
+struct ieee80211_band {
+	u_int8_t schan;			/* starting channel */
+	u_int8_t nchan;			/* number channels */
+	u_int8_t maxtxpwr;		/* tx power cap */
+} __packed;
+
+struct ieee80211_country_ie {
+	u_int8_t	ie;			/* IEEE80211_ELEMID_COUNTRY */
+	u_int8_t	len;
+	u_int8_t	cc[3];			/* ISO CC+(I)ndoor/(O)utdoor */
+	struct ieee80211_band band[4];		/* up to 4 sub bands */
+} __packed;
+
+#define IEEE80211_CHALLENGE_LEN		128
+
+#define	IEEE80211_RATE_BASIC		0x80
+#define	IEEE80211_RATE_VAL		0x7f
+
+/* EPR information element flags */
+#define	IEEE80211_ERP_NON_ERP_PRESENT	0x01
+#define	IEEE80211_ERP_USE_PROTECTION	0x02
+#define	IEEE80211_ERP_LONG_PREAMBLE	0x04
+
+/* Atheros private advanced capabilities info */
+#define	ATHEROS_CAP_TURBO_PRIME		0x01
+#define	ATHEROS_CAP_COMPRESSION		0x02
+#define	ATHEROS_CAP_FAST_FRAME		0x04
+/* bits 3-6 reserved */
+#define	ATHEROS_CAP_BOOST		0x80
+
+#define	ATH_OUI			0x7f0300		/* Atheros OUI */
+#define	ATH_OUI_TYPE		0x01
+#define	ATH_OUI_VERSION		0x01
+
+#define	WPA_OUI			0xf25000
+#define	WPA_OUI_TYPE		0x01
+#define	WPA_VERSION		1		/* current supported version */
+
+#define	WPA_CSE_NULL		0x00
+#define	WPA_CSE_WEP40		0x01
+#define	WPA_CSE_TKIP		0x02
+#define	WPA_CSE_CCMP		0x04
+#define	WPA_CSE_WEP104		0x05
+
+#define	WPA_ASE_NONE		0x00
+#define	WPA_ASE_8021X_UNSPEC	0x01
+#define	WPA_ASE_8021X_PSK	0x02
+
+#define	RSN_OUI			0xac0f00
+#define	RSN_VERSION		1		/* current supported version */
+
+#define	RSN_CSE_NULL		0x00
+#define	RSN_CSE_WEP40		0x01
+#define	RSN_CSE_TKIP		0x02
+#define	RSN_CSE_WRAP		0x03
+#define	RSN_CSE_CCMP		0x04
+#define	RSN_CSE_WEP104		0x05
+
+#define	RSN_ASE_NONE		0x00
+#define	RSN_ASE_8021X_UNSPEC	0x01
+#define	RSN_ASE_8021X_PSK	0x02
+
+#define	RSN_CAP_PREAUTH		0x01
+
+#define	WME_OUI			0xf25000
+#define	WME_OUI_TYPE		0x02
+#define	WME_INFO_OUI_SUBTYPE	0x00
+#define	WME_PARAM_OUI_SUBTYPE	0x01
+#define	WME_VERSION		1
+
+/*
+ * AUTH management packets
+ *
+ *	octet algo[2]
+ *	octet seq[2]
+ *	octet status[2]
+ *	octet chal.id
+ *	octet chal.length
+ *	octet chal.text[253]
+ */
+
+typedef u_int8_t *ieee80211_mgt_auth_t;
+
+#define	IEEE80211_AUTH_ALGORITHM(auth) \
+	((auth)[0] | ((auth)[1] << 8))
+#define	IEEE80211_AUTH_TRANSACTION(auth) \
+	((auth)[2] | ((auth)[3] << 8))
+#define	IEEE80211_AUTH_STATUS(auth) \
+	((auth)[4] | ((auth)[5] << 8))
+
+#define	IEEE80211_AUTH_ALG_OPEN		0x0000
+#define	IEEE80211_AUTH_ALG_SHARED	0x0001
+#define	IEEE80211_AUTH_ALG_LEAP		0x0080
+
+enum {
+	IEEE80211_AUTH_OPEN_REQUEST		= 1,
+	IEEE80211_AUTH_OPEN_RESPONSE		= 2
+};
+
+enum {
+	IEEE80211_AUTH_SHARED_REQUEST		= 1,
+	IEEE80211_AUTH_SHARED_CHALLENGE		= 2,
+	IEEE80211_AUTH_SHARED_RESPONSE		= 3,
+	IEEE80211_AUTH_SHARED_PASS		= 4
+};
+
+/*
+ * Reason codes
+ *
+ * Unlisted codes are reserved
+ */
+
+enum {
+	IEEE80211_REASON_UNSPECIFIED		= 1,
+	IEEE80211_REASON_AUTH_EXPIRE		= 2,
+	IEEE80211_REASON_AUTH_LEAVE		= 3,
+	IEEE80211_REASON_ASSOC_EXPIRE		= 4,
+	IEEE80211_REASON_ASSOC_TOOMANY		= 5,
+	IEEE80211_REASON_NOT_AUTHED		= 6,
+	IEEE80211_REASON_NOT_ASSOCED		= 7,
+	IEEE80211_REASON_ASSOC_LEAVE		= 8,
+	IEEE80211_REASON_ASSOC_NOT_AUTHED	= 9,
+
+	IEEE80211_REASON_RSN_REQUIRED		= 11,
+	IEEE80211_REASON_RSN_INCONSISTENT	= 12,
+	IEEE80211_REASON_IE_INVALID		= 13,
+	IEEE80211_REASON_MIC_FAILURE		= 14,
+
+	IEEE80211_STATUS_SUCCESS		= 0,
+	IEEE80211_STATUS_UNSPECIFIED		= 1,
+	IEEE80211_STATUS_CAPINFO		= 10,
+	IEEE80211_STATUS_NOT_ASSOCED		= 11,
+	IEEE80211_STATUS_OTHER			= 12,
+	IEEE80211_STATUS_ALG			= 13,
+	IEEE80211_STATUS_SEQUENCE		= 14,
+	IEEE80211_STATUS_CHALLENGE		= 15,
+	IEEE80211_STATUS_TIMEOUT		= 16,
+	IEEE80211_STATUS_TOOMANY		= 17,
+	IEEE80211_STATUS_BASIC_RATE		= 18,
+	IEEE80211_STATUS_SP_REQUIRED		= 19,
+	IEEE80211_STATUS_PBCC_REQUIRED		= 20,
+	IEEE80211_STATUS_CA_REQUIRED		= 21,
+	IEEE80211_STATUS_TOO_MANY_STATIONS	= 22,
+	IEEE80211_STATUS_RATES			= 23,
+	IEEE80211_STATUS_SHORTSLOT_REQUIRED	= 25,
+	IEEE80211_STATUS_DSSSOFDM_REQUIRED	= 26
+};
+
+#define	IEEE80211_WEP_KEYLEN		5	/* 40bit */
+#define	IEEE80211_WEP_IVLEN		3	/* 24bit */
+#define	IEEE80211_WEP_KIDLEN		1	/* 1 octet */
+#define	IEEE80211_WEP_CRCLEN		4	/* CRC-32 */
+#define	IEEE80211_WEP_TOTLEN		(IEEE80211_WEP_IVLEN + \
+					 IEEE80211_WEP_KIDLEN + \
+					 IEEE80211_WEP_CRCLEN)
+#define	IEEE80211_WEP_NKID		4	/* number of key ids */
+
+/*
+ * 802.11i defines an extended IV for use with non-WEP ciphers.
+ * When the EXTIV bit is set in the key id byte an additional
+ * 4 bytes immediately follow the IV for TKIP.  For CCMP the
+ * EXTIV bit is likewise set but the 8 bytes represent the
+ * CCMP header rather than IV+extended-IV.
+ */
+#define	IEEE80211_WEP_EXTIV		0x20
+#define	IEEE80211_WEP_EXTIVLEN		4	/* extended IV length */
+#define	IEEE80211_WEP_MICLEN		8	/* trailing MIC */
+
+#define	IEEE80211_CRC_LEN		4
+
+/*
+ * Maximum acceptable MTU is:
+ *	IEEE80211_MAX_LEN - WEP overhead - CRC -
+ *		QoS overhead - RSN/WPA overhead
+ * Min is arbitrarily chosen > IEEE80211_MIN_LEN.  The default
+ * mtu is Ethernet-compatible; it's set by ether_ifattach.
+ */
+#define	IEEE80211_MTU_MAX		2290
+#define	IEEE80211_MTU_MIN		32
+
+#define	IEEE80211_MAX_LEN		(2300 + IEEE80211_CRC_LEN + \
+    (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
+#define	IEEE80211_ACK_LEN \
+	(sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
+#define	IEEE80211_MIN_LEN \
+	(sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
+
+/*
+ * The 802.11 spec says at most 2007 stations may be
+ * associated at once.  For most AP's this is way more
+ * than is feasible so we use a default of 128.  This
+ * number may be overridden by the driver and/or by
+ * user configuration.
+ */
+#define	IEEE80211_AID_MAX		2007
+#define	IEEE80211_AID_DEF		128
+
+#define	IEEE80211_AID(b)	((b) &~ 0xc000)
+
+/*
+ * RTS frame length parameters.  The default is specified in
+ * the 802.11 spec as 512; we treat it as implementation-dependent
+ * so it's defined in ieee80211_var.h.  The max may be wrong
+ * for jumbo frames.
+ */
+#define	IEEE80211_RTS_MIN		1
+#define	IEEE80211_RTS_MAX		2346
+
+/*
+ * TX fragmentation parameters.  As above for RTS, we treat
+ * default as implementation-dependent so define it elsewhere.
+ */
+#define	IEEE80211_FRAG_MIN		256
+#define	IEEE80211_FRAG_MAX		2346
+
+/*
+ * 802.11 frame duration definitions.
+ */
+
+struct ieee80211_duration {
+	uint16_t	d_rts_dur;
+	uint16_t	d_data_dur;
+	uint16_t	d_plcp_len;
+	uint8_t		d_residue;	/* unused octets in time slot */
+};
+
+/* One Time Unit (TU) is 1Kus = 1024 microseconds. */
+#define IEEE80211_DUR_TU		1024
+
+/* IEEE 802.11b durations for DSSS PHY in microseconds */
+#define IEEE80211_DUR_DS_LONG_PREAMBLE	144
+#define IEEE80211_DUR_DS_SHORT_PREAMBLE	72
+
+#define IEEE80211_DUR_DS_SLOW_PLCPHDR	48
+#define IEEE80211_DUR_DS_FAST_PLCPHDR	24
+#define IEEE80211_DUR_DS_SLOW_ACK	112
+#define IEEE80211_DUR_DS_FAST_ACK	56
+#define IEEE80211_DUR_DS_SLOW_CTS	112
+#define IEEE80211_DUR_DS_FAST_CTS	56
+
+#define IEEE80211_DUR_DS_SLOT		20
+#define IEEE80211_DUR_DS_SIFS		10
+#define IEEE80211_DUR_DS_PIFS	(IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT)
+#define IEEE80211_DUR_DS_DIFS	(IEEE80211_DUR_DS_SIFS + \
+				 2 * IEEE80211_DUR_DS_SLOT)
+#define IEEE80211_DUR_DS_EIFS	(IEEE80211_DUR_DS_SIFS + \
+				 IEEE80211_DUR_DS_SLOW_ACK + \
+				 IEEE80211_DUR_DS_LONG_PREAMBLE + \
+				 IEEE80211_DUR_DS_SLOW_PLCPHDR + \
+				 IEEE80211_DUR_DS_DIFS)
+
+
+#endif /* !_NET80211_IEEE80211_H_ */

Property changes on: lab4/.minix-src/include/net80211/ieee80211.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netatalk/at.h
===================================================================
--- lab4/.minix-src/include/netatalk/at.h	(nonexistent)
+++ lab4/.minix-src/include/netatalk/at.h	(revision 13)
@@ -0,0 +1,113 @@
+/*	$NetBSD: at.h,v 1.8 2014/12/02 19:33:44 christos Exp $	*/
+
+/*
+ * Copyright (c) 1990,1991 Regents of The University of Michigan.
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation, and that the name of The University
+ * of Michigan not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. This software is supplied as is without expressed or
+ * implied warranties of any kind.
+ *
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ *
+ *	Research Systems Unix Group
+ *	The University of Michigan
+ *	c/o Wesley Craig
+ *	535 W. William Street
+ *	Ann Arbor, Michigan
+ *	+1-313-764-2278
+ *	netatalk@umich.edu
+ */
+
+#ifndef _NETATALK_AT_H_
+#define _NETATALK_AT_H_
+
+#include <sys/ansi.h>
+
+#ifndef sa_family_t
+typedef __sa_family_t	sa_family_t;
+#define sa_family_t	__sa_family_t
+#endif
+
+/*
+ * Supported protocols
+ */
+#define ATPROTO_DDP	0
+#define ATPROTO_AARP	254
+
+#define DDP_MAXSZ	587
+
+/*
+ * If ATPORT_FIRST <= Port < ATPORT_RESERVED,
+ * Port was created by a privileged process.
+ * If ATPORT_RESERVED <= Port < ATPORT_LAST,
+ * Port was not necessarily created by a
+ * privileged process.
+ */
+#define ATPORT_FIRST	1
+#define ATPORT_RESERVED	128
+#define ATPORT_LAST	255
+
+/*
+ * AppleTalk address.
+ */
+struct at_addr {
+	uint16_t         s_net;
+	uint8_t          s_node;
+};
+
+#define ATADDR_ANYNET	(uint16_t)0x0000
+#define ATADDR_ANYNODE	(uint8_t)0x00
+#define ATADDR_ANYPORT	(uint8_t)0x00
+#define ATADDR_BCAST	(uint8_t)0xff	/* There is no BCAST for NET */
+
+struct netrange {
+	uint8_t		nr_phase;
+	uint16_t	nr_firstnet;
+	uint16_t	nr_lastnet;
+};
+
+/*
+ * Socket address, AppleTalk style.  We keep magic information in the
+ * zero bytes.  There are three types, NONE, CONFIG which has the phase
+ * and a net range, and IFACE which has the network address of an
+ * interface.  IFACE may be filled in by the client, and is filled in
+ * by the kernel.
+ */
+struct sockaddr_at {
+	uint8_t		sat_len;
+	sa_family_t	sat_family;
+	uint8_t		sat_port;
+	struct at_addr  sat_addr;
+	union {
+		struct netrange r_netrange;
+		char            r_zero[8];	/* Hide a struct netrange in
+						 * here */
+	} sat_range;
+};
+
+#define sat_zero sat_range.r_zero
+
+#ifdef _KERNEL
+#include <sys/protosw.h>
+
+extern struct domain atalkdomain;
+extern const struct protosw atalksw[];
+#endif
+
+#if defined(_KERNEL) || defined(_TEST)
+#define ATALK_ADDRSTRLEN 10
+
+extern struct domain atalkdomain;
+int at_print(char *, size_t, const struct at_addr *);
+int sat_print(char *, size_t, const void *);
+#endif
+
+#endif	/* !_NETATALK_AT_H_ */

Property changes on: lab4/.minix-src/include/netatalk/at.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/if_ether.h
===================================================================
--- lab4/.minix-src/include/netinet/if_ether.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/if_ether.h	(revision 13)
@@ -0,0 +1,87 @@
+/*	$NetBSD: if_ether.h,v 1.34 2007/12/25 18:33:46 perry Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)if_ether.h	8.3 (Berkeley) 5/2/95
+ */
+
+#ifndef _NETINET_IF_ETHER_H_
+#define _NETINET_IF_ETHER_H_
+
+
+#ifdef _KERNEL
+#error You should NOT be doing this.
+/*
+ * XXX This file is for compatibility to externally maintained packages
+ * ONLY, or to help porting them if the other way round is not possible.
+ * Kernel drivers should be properly ported.
+ */
+#endif
+
+
+#ifndef _netinet_if_ether_compat_h_
+#define _netinet_if_ether_compat_h_
+
+/* pull in Ethernet-specific definitions and packet structures */
+
+#include <net/if_ether.h>
+
+/* pull in ARP-specific definitions and packet structures */
+
+#include <net/if_arp.h>
+
+/* pull in ARP-over-Ethernet-specific definitions and packet structures */
+#include <netinet/if_inarp.h>
+
+/* ... and define some more which we don't need anymore: */
+
+/*
+ * Ethernet Address Resolution Protocol.
+ *
+ * See RFC 826 for protocol description.  Structure below is not
+ * used by our kernel!!! Only for userland programs which are externally
+ * maintained and need it.
+ */
+
+struct	ether_arp {
+	struct	 arphdr ea_hdr;			/* fixed-size header */
+	u_int8_t arp_sha[ETHER_ADDR_LEN];	/* sender hardware address */
+	u_int8_t arp_spa[4];			/* sender protocol address */
+	u_int8_t arp_tha[ETHER_ADDR_LEN];	/* target hardware address */
+	u_int8_t arp_tpa[4];			/* target protocol address */
+} __packed;
+#define	arp_hrd	ea_hdr.ar_hrd
+#define	arp_pro	ea_hdr.ar_pro
+#define	arp_hln	ea_hdr.ar_hln
+#define	arp_pln	ea_hdr.ar_pln
+#define	arp_op	ea_hdr.ar_op
+
+#endif /* _netinet_if_ether_compat_h_ */
+
+#endif /* !_NETINET_IF_ETHER_H_ */

Property changes on: lab4/.minix-src/include/netinet/if_ether.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/dlt.h
===================================================================
--- lab4/.minix-src/include/net/dlt.h	(nonexistent)
+++ lab4/.minix-src/include/net/dlt.h	(revision 13)
@@ -0,0 +1,1290 @@
+/*	$NetBSD: dlt.h,v 1.16 2015/03/31 21:42:16 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from the Stanford/CMU enet packet filter,
+ * (net/enet.c) distributed as part of 4.3BSD, and code contributed
+ * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
+ * Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by the University of
+ *      California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *      @(#)bpf.h       7.1 (Berkeley) 5/7/91
+ *
+ * @(#) Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.32 2008-12-23 20:13:29 guy Exp  (LBL)
+ */
+
+#ifndef _NET_DLT_H_
+#define _NET_DLT_H_
+/*
+ * Link-layer header type codes.
+ *
+ * Do *NOT* add new values to this list without asking
+ * "tcpdump-workers@lists.tcpdump.org" for a value.  Otherwise, you run
+ * the risk of using a value that's already being used for some other
+ * purpose, and of having tools that read libpcap-format captures not
+ * being able to handle captures with your new DLT_ value, with no hope
+ * that they will ever be changed to do so (as that would destroy their
+ * ability to read captures using that value for that other purpose).
+ *
+ * See
+ *
+ *	http://www.tcpdump.org/linktypes.html
+ *
+ * for detailed descriptions of some of these link-layer header types.
+ */
+
+/*
+ * These are the types that are the same on all platforms, and that
+ * have been defined by <net/bpf.h> for ages.
+ */
+#define DLT_NULL	0	/* BSD loopback encapsulation */
+#define DLT_EN10MB	1	/* Ethernet (10Mb) */
+#define DLT_EN3MB	2	/* Experimental Ethernet (3Mb) */
+#define DLT_AX25	3	/* Amateur Radio AX.25 */
+#define DLT_PRONET	4	/* Proteon ProNET Token Ring */
+#define DLT_CHAOS	5	/* Chaos */
+#define DLT_IEEE802	6	/* 802.5 Token Ring */
+#define DLT_ARCNET	7	/* ARCNET, with BSD-style header */
+#define DLT_SLIP	8	/* Serial Line IP */
+#define DLT_PPP		9	/* Point-to-point Protocol */
+#define DLT_FDDI	10	/* FDDI */
+
+/*
+ * These are types that are different on some platforms, and that
+ * have been defined by <net/bpf.h> for ages.  We use #ifdefs to
+ * detect the BSDs that define them differently from the traditional
+ * libpcap <net/bpf.h>
+ *
+ * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS,
+ * but I don't know what the right #define is for BSD/OS.
+ */
+#define DLT_ATM_RFC1483	11	/* LLC-encapsulated ATM */
+
+#ifdef __OpenBSD__
+#define DLT_RAW		14	/* raw IP */
+#else
+#define DLT_RAW		12	/* raw IP */
+#endif
+
+/*
+ * Given that the only OS that currently generates BSD/OS SLIP or PPP
+ * is, well, BSD/OS, arguably everybody should have chosen its values
+ * for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they
+ * didn't.  So it goes.
+ */
+#if defined(__NetBSD__) || defined(__FreeBSD__)
+#ifndef DLT_SLIP_BSDOS
+#define DLT_SLIP_BSDOS	13	/* BSD/OS Serial Line IP */
+#define DLT_PPP_BSDOS	14	/* BSD/OS Point-to-point Protocol */
+#define DLT_HIPPI	15	/* HIPPI */
+#define DLT_HDLC	16	/* HDLC framing */
+#endif
+#else
+#define DLT_SLIP_BSDOS	15	/* BSD/OS Serial Line IP */
+#define DLT_PPP_BSDOS	16	/* BSD/OS Point-to-point Protocol */
+#endif
+
+/*
+ * 17 was used for DLT_PFLOG in OpenBSD; it no longer is.
+ *
+ * It was DLT_LANE8023 in SuSE 6.3, so we defined LINKTYPE_PFLOG
+ * as 117 so that pflog captures would use a link-layer header type
+ * value that didn't collide with any other values.  On all
+ * platforms other than OpenBSD, we defined DLT_PFLOG as 117,
+ * and we mapped between LINKTYPE_PFLOG and DLT_PFLOG.
+ *
+ * OpenBSD eventually switched to using 117 for DLT_PFLOG as well.
+ *
+ * Don't use 17 for anything else.
+ */
+#if defined(__OpenBSD__) || defined(__NetBSD__)
+#define DLT_OLD_PFLOG	17
+#endif
+
+/*
+ * 18 is used for DLT_PFSYNC in OpenBSD, NetBSD, DragonFly BSD and
+ * Mac OS X; don't use it for anything else.  (FreeBSD uses 121,
+ * which collides with DLT_HHDLC, even though it doesn't use 18
+ * for anything and doesn't appear to have ever used it for anything.)
+ *
+ * We define it as 18 on those platforms; it is, unfortunately, used
+ * for DLT_CIP in Suse 6.3, so we don't define it as DLT_PFSYNC
+ * in general.  As the packet format for it, like that for
+ * DLT_PFLOG, is not only OS-dependent but OS-version-dependent,
+ * we don't support printing it in tcpdump except on OSes that
+ * have the relevant header files, so it's not that useful on
+ * other platforms.
+ */
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
+#define DLT_PFSYNC	18
+#endif
+
+#define DLT_ATM_CLIP	19	/* Linux Classical-IP over ATM */
+
+/*
+ * Apparently Redback uses this for its SmartEdge 400/800.  I hope
+ * nobody else decided to use it, too.
+ */
+#define DLT_REDBACK_SMARTEDGE	32
+
+/*
+ * These values are defined by NetBSD; other platforms should refrain from
+ * using them for other purposes, so that NetBSD savefiles with link
+ * types of 50 or 51 can be read as this type on all platforms.
+ */
+#define DLT_PPP_SERIAL	50	/* PPP over serial with HDLC encapsulation */
+#define DLT_PPP_ETHER	51	/* PPP over Ethernet */
+
+/*
+ * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses
+ * a link-layer type of 99 for the tcpdump it supplies.  The link-layer
+ * header has 6 bytes of unknown data, something that appears to be an
+ * Ethernet type, and 36 bytes that appear to be 0 in at least one capture
+ * I've seen.
+ */
+#define DLT_SYMANTEC_FIREWALL	99
+
+/*
+ * Values between 100 and 103 are used in capture file headers as
+ * link-layer header type LINKTYPE_ values corresponding to DLT_ types
+ * that differ between platforms; don't use those values for new DLT_
+ * new types.
+ */
+
+/*
+ * Values starting with 104 are used for newly-assigned link-layer
+ * header type values; for those link-layer header types, the DLT_
+ * value returned by pcap_datalink() and passed to pcap_open_dead(),
+ * and the LINKTYPE_ value that appears in capture files, are the
+ * same.
+ *
+ * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is
+ * the highest such value.
+ */
+#define DLT_MATCHING_MIN	104
+
+/*
+ * This value was defined by libpcap 0.5; platforms that have defined
+ * it with a different value should define it here with that value -
+ * a link type of 104 in a save file will be mapped to DLT_C_HDLC,
+ * whatever value that happens to be, so programs will correctly
+ * handle files with that link type regardless of the value of
+ * DLT_C_HDLC.
+ *
+ * The name DLT_C_HDLC was used by BSD/OS; we use that name for source
+ * compatibility with programs written for BSD/OS.
+ *
+ * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well,
+ * for source compatibility with programs written for libpcap 0.5.
+ */
+#define DLT_C_HDLC	104	/* Cisco HDLC */
+#define DLT_CHDLC	DLT_C_HDLC
+
+#define DLT_IEEE802_11	105	/* IEEE 802.11 wireless */
+
+/*
+ * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW,
+ * except when it isn't.  (I.e., sometimes it's just raw IP, and
+ * sometimes it isn't.)  We currently handle it as DLT_LINUX_SLL,
+ * so that we don't have to worry about the link-layer header.)
+ */
+
+/*
+ * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides
+ * with other values.
+ * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header
+ * (DLCI, etc.).
+ */
+#define DLT_FRELAY	107
+
+/*
+ * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except
+ * that the AF_ type in the link-layer header is in network byte order.
+ *
+ * DLT_LOOP is 12 in OpenBSD, but that's DLT_RAW in other OSes, so
+ * we don't use 12 for it in OSes other than OpenBSD.
+ */
+#ifdef __OpenBSD__
+#define DLT_LOOP	12
+#else
+#define DLT_LOOP	108
+#endif
+
+/*
+ * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's
+ * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other
+ * than OpenBSD.
+ */
+#ifdef __OpenBSD__
+#define DLT_ENC		13
+#else
+#define DLT_ENC		109
+#endif
+
+/*
+ * Values between 110 and 112 are reserved for use in capture file headers
+ * as link-layer types corresponding to DLT_ types that might differ
+ * between platforms; don't use those values for new DLT_ types
+ * other than the corresponding DLT_ types.
+ */
+
+/*
+ * This is for Linux cooked sockets.
+ */
+#define DLT_LINUX_SLL	113
+
+/*
+ * Apple LocalTalk hardware.
+ */
+#define DLT_LTALK	114
+
+/*
+ * Acorn Econet.
+ */
+#define DLT_ECONET	115
+
+/*
+ * Reserved for use with OpenBSD ipfilter.
+ */
+#define DLT_IPFILTER	116
+
+/*
+ * OpenBSD DLT_PFLOG.
+ */
+#define DLT_PFLOG	117
+
+/*
+ * Registered for Cisco-internal use.
+ */
+#define DLT_CISCO_IOS	118
+
+/*
+ * For 802.11 cards using the Prism II chips, with a link-layer
+ * header including Prism monitor mode information plus an 802.11
+ * header.
+ */
+#define DLT_PRISM_HEADER	119
+
+/*
+ * Reserved for Aironet 802.11 cards, with an Aironet link-layer header
+ * (see Doug Ambrisko's FreeBSD patches).
+ */
+#define DLT_AIRONET_HEADER	120
+
+/*
+ * Sigh.
+ *
+ * This was reserved for Siemens HiPath HDLC on 2002-01-25, as
+ * requested by Tomas Kukosa.
+ *
+ * On 2004-02-25, a FreeBSD checkin to sys/net/bpf.h was made that
+ * assigned 121 as DLT_PFSYNC.  Its libpcap does DLT_ <-> LINKTYPE_
+ * mapping, so it probably supports capturing on the pfsync device
+ * but not saving the captured data to a pcap file.
+ *
+ * OpenBSD, from which pf came, however, uses 18 for DLT_PFSYNC;
+ * their libpcap does no DLT_ <-> LINKTYPE_ mapping, so it would
+ * use 18 in pcap files as well.
+ *
+ * NetBSD and DragonFly BSD also use 18 for DLT_PFSYNC; their
+ * libpcaps do DLT_ <-> LINKTYPE_ mapping, and neither has an entry
+ * for DLT_PFSYNC, so it might not be able to write out dump files
+ * with 18 as the link-layer header type.  (Earlier versions might
+ * not have done mapping, in which case they'd work the same way
+ * OpenBSD does.)
+ *
+ * Mac OS X defines it as 18, but doesn't appear to use it as of
+ * Mac OS X 10.7.3.  Its libpcap does DLT_ <-> LINKTYPE_ mapping.
+ *
+ * We'll define DLT_PFSYNC as 121 on FreeBSD and define it as 18 on
+ * all other platforms.  We'll define DLT_HHDLC as 121 on everything
+ * except for FreeBSD; anybody who wants to compile, on FreeBSD, code
+ * that uses DLT_HHDLC is out of luck.
+ *
+ * We'll define LINKTYPE_PFSYNC as 18, *even on FreeBSD*, and map
+ * it, so that savefiles won't use 121 for PFSYNC - they'll all
+ * use 18.  Code that uses pcap_datalink() to determine the link-layer
+ * header type of a savefile won't, when built and run on FreeBSD,
+ * be able to distinguish between LINKTYPE_PFSYNC and LINKTYPE_HHDLC
+ * capture files; code that doesn't, such as the code in Wireshark,
+ * will be able to distinguish between them.
+ */
+#ifdef __FreeBSD__
+#define DLT_PFSYNC		121
+#else
+#define DLT_HHDLC		121
+#endif
+
+/*
+ * This is for RFC 2625 IP-over-Fibre Channel.
+ *
+ * This is not for use with raw Fibre Channel, where the link-layer
+ * header starts with a Fibre Channel frame header; it's for IP-over-FC,
+ * where the link-layer header starts with an RFC 2625 Network_Header
+ * field.
+ */
+#define DLT_IP_OVER_FC		122
+
+/*
+ * This is for Full Frontal ATM on Solaris with SunATM, with a
+ * pseudo-header followed by an AALn PDU.
+ *
+ * There may be other forms of Full Frontal ATM on other OSes,
+ * with different pseudo-headers.
+ *
+ * If ATM software returns a pseudo-header with VPI/VCI information
+ * (and, ideally, packet type information, e.g. signalling, ILMI,
+ * LANE, LLC-multiplexed traffic, etc.), it should not use
+ * DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump
+ * and the like don't have to infer the presence or absence of a
+ * pseudo-header and the form of the pseudo-header.
+ */
+#define DLT_SUNATM		123	/* Solaris+SunATM */
+
+/*
+ * Reserved as per request from Kent Dahlgren <kent@praesum.com>
+ * for private use.
+ */
+#define DLT_RIO                 124     /* RapidIO */
+#define DLT_PCI_EXP             125     /* PCI Express */
+#define DLT_AURORA              126     /* Xilinx Aurora link layer */
+
+/*
+ * Header for 802.11 plus a number of bits of link-layer information
+ * including radio information, used by some recent BSD drivers as
+ * well as the madwifi Atheros driver for Linux.
+ */
+#define DLT_IEEE802_11_RADIO	127	/* 802.11 plus radiotap radio header */
+
+/*
+ * Reserved for the TZSP encapsulation, as per request from
+ * Chris Waters <chris.waters@networkchemistry.com>
+ * TZSP is a generic encapsulation for any other link type,
+ * which includes a means to include meta-information
+ * with the packet, e.g. signal strength and channel
+ * for 802.11 packets.
+ */
+#define DLT_TZSP                128     /* Tazmen Sniffer Protocol */
+
+/*
+ * BSD's ARCNET headers have the source host, destination host,
+ * and type at the beginning of the packet; that's what's handed
+ * up to userland via BPF.
+ *
+ * Linux's ARCNET headers, however, have a 2-byte offset field
+ * between the host IDs and the type; that's what's handed up
+ * to userland via PF_PACKET sockets.
+ *
+ * We therefore have to have separate DLT_ values for them.
+ */
+#define DLT_ARCNET_LINUX	129	/* ARCNET */
+
+/*
+ * Juniper-private data link types, as per request from
+ * Hannes Gredler <hannes@juniper.net>.  The DLT_s are used
+ * for passing on chassis-internal metainformation such as
+ * QOS profiles, etc..
+ */
+#define DLT_JUNIPER_MLPPP       130
+#define DLT_JUNIPER_MLFR        131
+#define DLT_JUNIPER_ES          132
+#define DLT_JUNIPER_GGSN        133
+#define DLT_JUNIPER_MFR         134
+#define DLT_JUNIPER_ATM2        135
+#define DLT_JUNIPER_SERVICES    136
+#define DLT_JUNIPER_ATM1        137
+
+/*
+ * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund
+ * <dieter@apple.com>.  The header that's presented is an Ethernet-like
+ * header:
+ *
+ *	#define FIREWIRE_EUI64_LEN	8
+ *	struct firewire_header {
+ *		u_char  firewire_dhost[FIREWIRE_EUI64_LEN];
+ *		u_char  firewire_shost[FIREWIRE_EUI64_LEN];
+ *		u_short firewire_type;
+ *	};
+ *
+ * with "firewire_type" being an Ethernet type value, rather than,
+ * for example, raw GASP frames being handed up.
+ */
+#define DLT_APPLE_IP_OVER_IEEE1394	138
+
+/*
+ * Various SS7 encapsulations, as per a request from Jeff Morriss
+ * <jeff.morriss[AT]ulticom.com> and subsequent discussions.
+ */
+#define DLT_MTP2_WITH_PHDR	139	/* pseudo-header with various info, followed by MTP2 */
+#define DLT_MTP2		140	/* MTP2, without pseudo-header */
+#define DLT_MTP3		141	/* MTP3, without pseudo-header or MTP2 */
+#define DLT_SCCP		142	/* SCCP, without pseudo-header or MTP2 or MTP3 */
+
+/*
+ * DOCSIS MAC frames.
+ */
+#define DLT_DOCSIS		143
+
+/*
+ * Linux-IrDA packets. Protocol defined at http://www.irda.org.
+ * Those packets include IrLAP headers and above (IrLMP...), but
+ * don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy
+ * framing can be handled by the hardware and depend on the bitrate.
+ * This is exactly the format you would get capturing on a Linux-IrDA
+ * interface (irdaX), but not on a raw serial port.
+ * Note the capture is done in "Linux-cooked" mode, so each packet include
+ * a fake packet header (struct sll_header). This is because IrDA packet
+ * decoding is dependant on the direction of the packet (incomming or
+ * outgoing).
+ * When/if other platform implement IrDA capture, we may revisit the
+ * issue and define a real DLT_IRDA...
+ * Jean II
+ */
+#define DLT_LINUX_IRDA		144
+
+/*
+ * Reserved for IBM SP switch and IBM Next Federation switch.
+ */
+#define DLT_IBM_SP		145
+#define DLT_IBM_SN		146
+
+/*
+ * Reserved for private use.  If you have some link-layer header type
+ * that you want to use within your organization, with the capture files
+ * using that link-layer header type not ever be sent outside your
+ * organization, you can use these values.
+ *
+ * No libpcap release will use these for any purpose, nor will any
+ * tcpdump release use them, either.
+ *
+ * Do *NOT* use these in capture files that you expect anybody not using
+ * your private versions of capture-file-reading tools to read; in
+ * particular, do *NOT* use them in products, otherwise you may find that
+ * people won't be able to use tcpdump, or snort, or Ethereal, or... to
+ * read capture files from your firewall/intrusion detection/traffic
+ * monitoring/etc. appliance, or whatever product uses that DLT_ value,
+ * and you may also find that the developers of those applications will
+ * not accept patches to let them read those files.
+ *
+ * Also, do not use them if somebody might send you a capture using them
+ * for *their* private type and tools using them for *your* private type
+ * would have to read them.
+ *
+ * Instead, ask "tcpdump-workers@lists.tcpdump.org" for a new DLT_ value,
+ * as per the comment above, and use the type you're given.
+ */
+#define DLT_USER0		147
+#define DLT_USER1		148
+#define DLT_USER2		149
+#define DLT_USER3		150
+#define DLT_USER4		151
+#define DLT_USER5		152
+#define DLT_USER6		153
+#define DLT_USER7		154
+#define DLT_USER8		155
+#define DLT_USER9		156
+#define DLT_USER10		157
+#define DLT_USER11		158
+#define DLT_USER12		159
+#define DLT_USER13		160
+#define DLT_USER14		161
+#define DLT_USER15		162
+
+/*
+ * For future use with 802.11 captures - defined by AbsoluteValue
+ * Systems to store a number of bits of link-layer information
+ * including radio information:
+ *
+ *	http://www.shaftnet.org/~pizza/software/capturefrm.txt
+ *
+ * but it might be used by some non-AVS drivers now or in the
+ * future.
+ */
+#define DLT_IEEE802_11_RADIO_AVS 163	/* 802.11 plus AVS radio header */
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler <hannes@juniper.net>.  The DLT_s are used
+ * for passing on chassis-internal metainformation such as
+ * QOS profiles, etc..
+ */
+#define DLT_JUNIPER_MONITOR     164
+
+/*
+ * BACnet MS/TP frames.
+ */
+#define DLT_BACNET_MS_TP	165
+
+/*
+ * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>.
+ *
+ * This is used in some OSes to allow a kernel socket filter to distinguish
+ * between incoming and outgoing packets, on a socket intended to
+ * supply pppd with outgoing packets so it can do dial-on-demand and
+ * hangup-on-lack-of-demand; incoming packets are filtered out so they
+ * don't cause pppd to hold the connection up (you don't want random
+ * input packets such as port scans, packets from old lost connections,
+ * etc. to force the connection to stay up).
+ *
+ * The first byte of the PPP header (0xff03) is modified to accomodate
+ * the direction - 0x00 = IN, 0x01 = OUT.
+ */
+#define DLT_PPP_PPPD		166
+
+/*
+ * Names for backwards compatibility with older versions of some PPP
+ * software; new software should use DLT_PPP_PPPD.
+ */
+#define DLT_PPP_WITH_DIRECTION	DLT_PPP_PPPD
+#define DLT_LINUX_PPP_WITHDIRECTION	DLT_PPP_PPPD
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler <hannes@juniper.net>.  The DLT_s are used
+ * for passing on chassis-internal metainformation such as
+ * QOS profiles, cookies, etc..
+ */
+#define DLT_JUNIPER_PPPOE       167
+#define DLT_JUNIPER_PPPOE_ATM   168
+
+#define DLT_GPRS_LLC		169	/* GPRS LLC */
+#define DLT_GPF_T		170	/* GPF-T (ITU-T G.7041/Y.1303) */
+#define DLT_GPF_F		171	/* GPF-F (ITU-T G.7041/Y.1303) */
+
+/*
+ * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line
+ * monitoring equipment.
+ */
+#define DLT_GCOM_T1E1		172
+#define DLT_GCOM_SERIAL		173
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler <hannes@juniper.net>.  The DLT_ is used
+ * for internal communication to Physical Interface Cards (PIC)
+ */
+#define DLT_JUNIPER_PIC_PEER    174
+
+/*
+ * Link types requested by Gregor Maier <gregor@endace.com> of Endace
+ * Measurement Systems.  They add an ERF header (see
+ * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of
+ * the link-layer header.
+ */
+#define DLT_ERF_ETH		175	/* Ethernet */
+#define DLT_ERF_POS		176	/* Packet-over-SONET */
+
+/*
+ * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD
+ * for vISDN (http://www.orlandi.com/visdn/).  Its link-layer header
+ * includes additional information before the LAPD header, so it's
+ * not necessarily a generic LAPD header.
+ */
+#define DLT_LINUX_LAPD		177
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler <hannes@juniper.net>.
+ * The DLT_ are used for prepending meta-information
+ * like interface index, interface name
+ * before standard Ethernet, PPP, Frelay & C-HDLC Frames
+ */
+#define DLT_JUNIPER_ETHER       178
+#define DLT_JUNIPER_PPP         179
+#define DLT_JUNIPER_FRELAY      180
+#define DLT_JUNIPER_CHDLC       181
+
+/*
+ * Multi Link Frame Relay (FRF.16)
+ */
+#define DLT_MFR                 182
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler <hannes@juniper.net>.
+ * The DLT_ is used for internal communication with a
+ * voice Adapter Card (PIC)
+ */
+#define DLT_JUNIPER_VP          183
+
+/*
+ * Arinc 429 frames.
+ * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
+ * Every frame contains a 32bit A429 label.
+ * More documentation on Arinc 429 can be found at
+ * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
+ */
+#define DLT_A429                184
+
+/*
+ * Arinc 653 Interpartition Communication messages.
+ * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
+ * Please refer to the A653-1 standard for more information.
+ */
+#define DLT_A653_ICM            185
+
+/*
+ * USB packets, beginning with a USB setup header; requested by
+ * Paolo Abeni <paolo.abeni@email.it>.
+ */
+#define DLT_USB			186
+
+/*
+ * Bluetooth HCI UART transport layer (part H:4); requested by
+ * Paolo Abeni.
+ */
+#define DLT_BLUETOOTH_HCI_H4	187
+
+/*
+ * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz
+ * <cruz_petagay@bah.com>.
+ */
+#define DLT_IEEE802_16_MAC_CPS	188
+
+/*
+ * USB packets, beginning with a Linux USB header; requested by
+ * Paolo Abeni <paolo.abeni@email.it>.
+ */
+#define DLT_USB_LINUX		189
+
+/*
+ * Controller Area Network (CAN) v. 2.0B packets.
+ * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
+ * Used to dump CAN packets coming from a CAN Vector board.
+ * More documentation on the CAN v2.0B frames can be found at
+ * http://www.can-cia.org/downloads/?269
+ */
+#define DLT_CAN20B              190
+
+/*
+ * IEEE 802.15.4, with address fields padded, as is done by Linux
+ * drivers; requested by Juergen Schimmer.
+ */
+#define DLT_IEEE802_15_4_LINUX	191
+
+/*
+ * Per Packet Information encapsulated packets.
+ * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
+ */
+#define DLT_PPI			192
+
+/*
+ * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header;
+ * requested by Charles Clancy.
+ */
+#define DLT_IEEE802_16_MAC_CPS_RADIO	193
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler <hannes@juniper.net>.
+ * The DLT_ is used for internal communication with a
+ * integrated service module (ISM).
+ */
+#define DLT_JUNIPER_ISM         194
+
+/*
+ * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
+ * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>.
+ * For this one, we expect the FCS to be present at the end of the frame;
+ * if the frame has no FCS, DLT_IEEE802_15_4_NOFCS should be used.
+ */
+#define DLT_IEEE802_15_4	195
+
+/*
+ * Various link-layer types, with a pseudo-header, for SITA
+ * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com).
+ */
+#define DLT_SITA		196
+
+/*
+ * Various link-layer types, with a pseudo-header, for Endace DAG cards;
+ * encapsulates Endace ERF records.  Requested by Stephen Donnelly
+ * <stephen@endace.com>.
+ */
+#define DLT_ERF			197
+
+/*
+ * Special header prepended to Ethernet packets when capturing from a
+ * u10 Networks board.  Requested by Phil Mulholland
+ * <phil@u10networks.com>.
+ */
+#define DLT_RAIF1		198
+
+/*
+ * IPMB packet for IPMI, beginning with the I2C slave address, followed
+ * by the netFn and LUN, etc..  Requested by Chanthy Toeung
+ * <chanthy.toeung@ca.kontron.com>.
+ */
+#define DLT_IPMB		199
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler <hannes@juniper.net>.
+ * The DLT_ is used for capturing data on a secure tunnel interface.
+ */
+#define DLT_JUNIPER_ST          200
+
+/*
+ * Bluetooth HCI UART transport layer (part H:4), with pseudo-header
+ * that includes direction information; requested by Paolo Abeni.
+ */
+#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR	201
+
+/*
+ * AX.25 packet with a 1-byte KISS header; see
+ *
+ *	http://www.ax25.net/kiss.htm
+ *
+ * as per Richard Stearn <richard@rns-stearn.demon.co.uk>.
+ */
+#define DLT_AX25_KISS		202
+
+/*
+ * LAPD packets from an ISDN channel, starting with the address field,
+ * with no pseudo-header.
+ * Requested by Varuna De Silva <varunax@gmail.com>.
+ */
+#define DLT_LAPD		203
+
+/*
+ * Variants of various link-layer headers, with a one-byte direction
+ * pseudo-header prepended - zero means "received by this host",
+ * non-zero (any non-zero value) means "sent by this host" - as per
+ * Will Barker <w.barker@zen.co.uk>.
+ */
+#define DLT_PPP_WITH_DIR	204	/* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */
+#define DLT_C_HDLC_WITH_DIR	205	/* Cisco HDLC */
+#define DLT_FRELAY_WITH_DIR	206	/* Frame Relay */
+#define DLT_LAPB_WITH_DIR	207	/* LAPB */
+
+/*
+ * 208 is reserved for an as-yet-unspecified proprietary link-layer
+ * type, as requested by Will Barker.
+ */
+
+/*
+ * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman
+ * <avn@pigeonpoint.com>.
+ */
+#define DLT_IPMB_LINUX		209
+
+/*
+ * FlexRay automotive bus - http://www.flexray.com/ - as requested
+ * by Hannes Kaelber <hannes.kaelber@x2e.de>.
+ */
+#define DLT_FLEXRAY		210
+
+/*
+ * Media Oriented Systems Transport (MOST) bus for multimedia
+ * transport - http://www.mostcooperation.com/ - as requested
+ * by Hannes Kaelber <hannes.kaelber@x2e.de>.
+ */
+#define DLT_MOST		211
+
+/*
+ * Local Interconnect Network (LIN) bus for vehicle networks -
+ * http://www.lin-subbus.org/ - as requested by Hannes Kaelber
+ * <hannes.kaelber@x2e.de>.
+ */
+#define DLT_LIN			212
+
+/*
+ * X2E-private data link type used for serial line capture,
+ * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.
+ */
+#define DLT_X2E_SERIAL		213
+
+/*
+ * X2E-private data link type used for the Xoraya data logger
+ * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.
+ */
+#define DLT_X2E_XORAYA		214
+
+/*
+ * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
+ * nothing), but with the PHY-level data for non-ASK PHYs (4 octets
+ * of 0 as preamble, one octet of SFD, one octet of frame length+
+ * reserved bit, and then the MAC-layer data, starting with the
+ * frame control field).
+ *
+ * Requested by Max Filippov <jcmvbkbc@gmail.com>.
+ */
+#define DLT_IEEE802_15_4_NONASK_PHY	215
+
+/*
+ * David Gibson <david@gibson.dropbear.id.au> requested this for
+ * captures from the Linux kernel /dev/input/eventN devices. This
+ * is used to communicate keystrokes and mouse movements from the
+ * Linux kernel to display systems, such as Xorg.
+ */
+#define DLT_LINUX_EVDEV		216
+
+/*
+ * GSM Um and Abis interfaces, preceded by a "gsmtap" header.
+ *
+ * Requested by Harald Welte <laforge@gnumonks.org>.
+ */
+#define DLT_GSMTAP_UM		217
+#define DLT_GSMTAP_ABIS		218
+
+/*
+ * MPLS, with an MPLS label as the link-layer header.
+ * Requested by Michele Marchetto <michele@openbsd.org> on behalf
+ * of OpenBSD.
+ */
+#define DLT_MPLS		219
+
+/*
+ * USB packets, beginning with a Linux USB header, with the USB header
+ * padded to 64 bytes; required for memory-mapped access.
+ */
+#define DLT_USB_LINUX_MMAPPED	220
+
+/*
+ * DECT packets, with a pseudo-header; requested by
+ * Matthias Wenzel <tcpdump@mazzoo.de>.
+ */
+#define DLT_DECT		221
+
+/*
+ * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <eric.lidwa-1@nasa.gov>
+ * Date: Mon, 11 May 2009 11:18:30 -0500
+ *
+ * DLT_AOS. We need it for AOS Space Data Link Protocol.
+ *   I have already written dissectors for but need an OK from
+ *   legal before I can submit a patch.
+ *
+ */
+#define DLT_AOS                 222
+
+/*
+ * Wireless HART (Highway Addressable Remote Transducer)
+ * From the HART Communication Foundation
+ * IES/PAS 62591
+ *
+ * Requested by Sam Roberts <vieuxtech@gmail.com>.
+ */
+#define DLT_WIHART		223
+
+/*
+ * Fibre Channel FC-2 frames, beginning with a Frame_Header.
+ * Requested by Kahou Lei <kahou82@gmail.com>.
+ */
+#define DLT_FC_2		224
+
+/*
+ * Fibre Channel FC-2 frames, beginning with an encoding of the
+ * SOF, and ending with an encoding of the EOF.
+ *
+ * The encodings represent the frame delimiters as 4-byte sequences
+ * representing the corresponding ordered sets, with K28.5
+ * represented as 0xBC, and the D symbols as the corresponding
+ * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2,
+ * is represented as 0xBC 0xB5 0x55 0x55.
+ *
+ * Requested by Kahou Lei <kahou82@gmail.com>.
+ */
+#define DLT_FC_2_WITH_FRAME_DELIMS	225
+
+/*
+ * Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>.
+ *
+ * The pseudo-header starts with a one-byte version number; for version 2,
+ * the pseudo-header is:
+ *
+ * struct dl_ipnetinfo {
+ *     u_int8_t   dli_version;
+ *     u_int8_t   dli_family;
+ *     u_int16_t  dli_htype;
+ *     u_int32_t  dli_pktlen;
+ *     u_int32_t  dli_ifindex;
+ *     u_int32_t  dli_grifindex;
+ *     u_int32_t  dli_zsrc;
+ *     u_int32_t  dli_zdst;
+ * };
+ *
+ * dli_version is 2 for the current version of the pseudo-header.
+ *
+ * dli_family is a Solaris address family value, so it's 2 for IPv4
+ * and 26 for IPv6.
+ *
+ * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing
+ * packets, and 2 for packets arriving from another zone on the same
+ * machine.
+ *
+ * dli_pktlen is the length of the packet data following the pseudo-header
+ * (so the captured length minus dli_pktlen is the length of the
+ * pseudo-header, assuming the entire pseudo-header was captured).
+ *
+ * dli_ifindex is the interface index of the interface on which the
+ * packet arrived.
+ *
+ * dli_grifindex is the group interface index number (for IPMP interfaces).
+ *
+ * dli_zsrc is the zone identifier for the source of the packet.
+ *
+ * dli_zdst is the zone identifier for the destination of the packet.
+ *
+ * A zone number of 0 is the global zone; a zone number of 0xffffffff
+ * means that the packet arrived from another host on the network, not
+ * from another zone on the same machine.
+ *
+ * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates
+ * which of those it is.
+ */
+#define DLT_IPNET		226
+
+/*
+ * CAN (Controller Area Network) frames, with a pseudo-header as supplied
+ * by Linux SocketCAN.  See Documentation/networking/can.txt in the Linux
+ * source.
+ *
+ * Requested by Felix Obenhuber <felix@obenhuber.de>.
+ */
+#define DLT_CAN_SOCKETCAN	227
+
+/*
+ * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies
+ * whether it's v4 or v6.  Requested by Darren Reed <Darren.Reed@Sun.COM>.
+ */
+#define DLT_IPV4		228
+#define DLT_IPV6		229
+
+/*
+ * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
+ * nothing), and with no FCS at the end of the frame; requested by
+ * Jon Smirl <jonsmirl@gmail.com>.
+ */
+#define DLT_IEEE802_15_4_NOFCS	230
+
+/*
+ * Raw D-Bus:
+ *
+ *	http://www.freedesktop.org/wiki/Software/dbus
+ *
+ * messages:
+ *
+ *	http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
+ *
+ * starting with the endianness flag, followed by the message type, etc.,
+ * but without the authentication handshake before the message sequence:
+ *
+ *	http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
+ *
+ * Requested by Martin Vidner <martin@vidner.net>.
+ */
+#define DLT_DBUS		231
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler <hannes@juniper.net>.
+ */
+#define DLT_JUNIPER_VS			232
+#define DLT_JUNIPER_SRX_E2E		233
+#define DLT_JUNIPER_FIBRECHANNEL	234
+
+/*
+ * DVB-CI (DVB Common Interface for communication between a PC Card
+ * module and a DVB receiver).  See
+ *
+ *	http://www.kaiser.cx/pcap-dvbci.html
+ *
+ * for the specification.
+ *
+ * Requested by Martin Kaiser <martin@kaiser.cx>.
+ */
+#define DLT_DVB_CI		235
+
+/*
+ * Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but
+ * *not* the same as, 27.010).  Requested by Hans-Christoph Schemmel
+ * <hans-christoph.schemmel@cinterion.com>.
+ */
+#define DLT_MUX27010		236
+
+/*
+ * STANAG 5066 D_PDUs.  Requested by M. Baris Demiray
+ * <barisdemiray@gmail.com>.
+ */
+#define DLT_STANAG_5066_D_PDU	237
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler <hannes@juniper.net>.
+ */
+#define DLT_JUNIPER_ATM_CEMIC	238
+
+/*
+ * NetFilter LOG messages
+ * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
+ *
+ * Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl>
+ */
+#define DLT_NFLOG		239
+
+/*
+ * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
+ * for Ethernet packets with a 4-byte pseudo-header and always
+ * with the payload including the FCS, as supplied by their
+ * netANALYZER hardware and software.
+ *
+ * Requested by Holger P. Frommer <HPfrommer@hilscher.com>
+ */
+#define DLT_NETANALYZER		240
+
+/*
+ * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
+ * for Ethernet packets with a 4-byte pseudo-header and FCS and
+ * with the Ethernet header preceded by 7 bytes of preamble and
+ * 1 byte of SFD, as supplied by their netANALYZER hardware and
+ * software.
+ *
+ * Requested by Holger P. Frommer <HPfrommer@hilscher.com>
+ */
+#define DLT_NETANALYZER_TRANSPARENT	241
+
+/*
+ * IP-over-Infiniband, as specified by RFC 4391.
+ *
+ * Requested by Petr Sumbera <petr.sumbera@oracle.com>.
+ */
+#define DLT_IPOIB		242
+
+/*
+ * MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0).
+ *
+ * Requested by Guy Martin <gmsoft@tuxicoman.be>.
+ */
+#define DLT_MPEG_2_TS		243
+
+/*
+ * ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as
+ * used by their ng40 protocol tester.
+ *
+ * Requested by Jens Grimmer <jens.grimmer@ng4t.com>.
+ */
+#define DLT_NG40		244
+
+/*
+ * Pseudo-header giving adapter number and flags, followed by an NFC
+ * (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU,
+ * as specified by NFC Forum Logical Link Control Protocol Technical
+ * Specification LLCP 1.1.
+ *
+ * Requested by Mike Wakerly <mikey@google.com>.
+ */
+#define DLT_NFC_LLCP		245
+
+/*
+ * 245 is used as LINKTYPE_PFSYNC; do not use it for any other purpose.
+ *
+ * DLT_PFSYNC has different values on different platforms, and all of
+ * them collide with something used elsewhere.  On platforms that
+ * don't already define it, define it as 245.
+ */
+#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(__APPLE__)
+#define DLT_PFSYNC		246
+#endif
+
+
+/*
+ * Raw InfiniBand packets, starting with the Local Routing Header.
+ *
+ * Requested by Oren Kladnitsky <orenk@mellanox.com>.
+ */
+#define DLT_INFINIBAND		247
+
+/*
+ * SCTP, with no lower-level protocols (i.e., no IPv4 or IPv6).
+ *
+ * Requested by Michael Tuexen <Michael.Tuexen@lurchi.franken.de>.
+ */
+#define DLT_SCTP		248
+
+/*
+ * USB packets, beginning with a USBPcap header.
+ *
+ * Requested by Tomasz Mon <desowin@gmail.com>
+ */
+#define DLT_USBPCAP		249
+
+/*
+ * Schweitzer Engineering Laboratories "RTAC" product serial-line
+ * packets.
+ *
+ * Requested by Chris Bontje <chris_bontje@selinc.com>.
+ */
+#define DLT_RTAC_SERIAL		250
+
+/*
+ * Bluetooth Low Energy air interface link-layer packets.
+ *
+ * Requested by Mike Kershaw <dragorn@kismetwireless.net>.
+ */
+#define DLT_BLUETOOTH_LE_LL	251
+
+/*
+ * DLT type for upper-protocol layer PDU saves from wireshark.
+ * 
+ * the actual contents are determined by two TAGs stored with each
+ * packet:
+ *   EXP_PDU_TAG_LINKTYPE          the link type (LINKTYPE_ value) of the
+ *				   original packet.
+ *
+ *   EXP_PDU_TAG_PROTO_NAME        the name of the wireshark dissector
+ * 				   that can make sense of the data stored.
+ */
+#define DLT_WIRESHARK_UPPER_PDU	252
+
+/*
+ * DLT type for the netlink protocol (nlmon devices).
+ */
+#define DLT_NETLINK		253
+
+/*
+ * Bluetooth Linux Monitor headers for the BlueZ stack.
+ */
+#define DLT_BLUETOOTH_LINUX_MONITOR	254
+
+/*
+ * Bluetooth Basic Rate/Enhanced Data Rate baseband packets, as
+ * captured by Ubertooth.
+ */
+#define DLT_BLUETOOTH_BREDR_BB	255
+
+/*
+ * Bluetooth Low Energy link layer packets, as captured by Ubertooth.
+ */
+#define DLT_BLUETOOTH_LE_LL_WITH_PHDR	256
+
+/*
+ * PROFIBUS data link layer.
+ */
+#define DLT_PROFIBUS_DL		257
+
+/*
+ * Apple's DLT_PKTAP headers.
+ *
+ * Sadly, the folks at Apple either had no clue that the DLT_USERn values
+ * are for internal use within an organization and partners only, and
+ * didn't know that the right way to get a link-layer header type is to
+ * ask tcpdump.org for one, or knew and didn't care, so they just
+ * used DLT_USER2, which causes problems for everything except for
+ * their version of tcpdump.
+ *
+ * So I'll just give them one; hopefully this will show up in a
+ * libpcap release in time for them to get this into 10.10 Big Sur
+ * or whatever Mavericks' successor is called.  LINKTYPE_PKTAP
+ * will be 258 *even on OS X*; that is *intentional*, so that
+ * PKTAP files look the same on *all* OSes (different OSes can have
+ * different numerical values for a given DLT_, but *MUST NOT* have
+ * different values for what goes in a file, as files can be moved
+ * between OSes!).
+ *
+ * When capturing, on a system with a Darwin-based OS, on a device
+ * that returns 149 (DLT_USER2 and Apple's DLT_PKTAP) with this
+ * version of libpcap, the DLT_ value for the pcap_t  will be DLT_PKTAP,
+ * and that will continue to be DLT_USER2 on Darwin-based OSes. That way,
+ * binary compatibility with Mavericks is preserved for programs using
+ * this version of libpcap.  This does mean that if you were using
+ * DLT_USER2 for some capture device on OS X, you can't do so with
+ * this version of libpcap, just as you can't with Apple's libpcap -
+ * on OS X, they define DLT_PKTAP to be DLT_USER2, so programs won't
+ * be able to distinguish between PKTAP and whatever you were using
+ * DLT_USER2 for.
+ *
+ * If the program saves the capture to a file using this version of
+ * libpcap's pcap_dump code, the LINKTYPE_ value in the file will be
+ * LINKTYPE_PKTAP, which will be 258, even on Darwin-based OSes.
+ * That way, the file will *not* be a DLT_USER2 file.  That means
+ * that the latest version of tcpdump, when built with this version
+ * of libpcap, and sufficiently recent versions of Wireshark will
+ * be able to read those files and interpret them correctly; however,
+ * Apple's version of tcpdump in OS X 10.9 won't be able to handle
+ * them.  (Hopefully, Apple will pick up this version of libpcap,
+ * and the corresponding version of tcpdump, so that tcpdump will
+ * be able to handle the old LINKTYPE_USER2 captures *and* the new
+ * LINKTYPE_PKTAP captures.)
+ */
+#ifdef __APPLE__
+#define DLT_PKTAP	DLT_USER2
+#else
+#define DLT_PKTAP	258
+#endif
+
+/*
+ * Ethernet packets preceded by a header giving the last 6 octets
+ * of the preamble specified by 802.3-2012 Clause 65, section
+ * 65.1.3.2 "Transmit".
+ */
+#define DLT_EPON	259
+
+/*
+ * IPMI trace packets, as specified by Table 3-20 "Trace Data Block Format"
+ * in the PICMG HPM.2 specification.
+ */
+#define DLT_IPMI_HPM_2	260
+
+/*
+ * per  Joshua Wright <jwright@hasborg.com>, formats for Zwave captures.
+ */
+#define DLT_ZWAVE_R1_R2  261
+#define DLT_ZWAVE_R3     262
+
+/*
+ * per Steve Karg <skarg@users.sourceforge.net>, formats for Wattstopper
+ * Digital Lighting Management room bus serial protocol captures.
+ */
+#define DLT_WATTSTOPPER_DLM     263
+
+#define DLT_MATCHING_MAX	263	/* highest value in the "matching" range */
+
+/*
+ * DLT and savefile link type values are split into a class and
+ * a member of that class.  A class value of 0 indicates a regular
+ * DLT_/LINKTYPE_ value.
+ */
+#define DLT_CLASS(x)		((x) & 0x03ff0000)
+
+/*
+ * NetBSD-specific generic "raw" link type.  The class value indicates
+ * that this is the generic raw type, and the lower 16 bits are the
+ * address family we're dealing with.  Those values are NetBSD-specific;
+ * do not assume that they correspond to AF_ values for your operating
+ * system.
+ */
+#define	DLT_CLASS_NETBSD_RAWAF	0x02240000
+#define	DLT_NETBSD_RAWAF(af)	(DLT_CLASS_NETBSD_RAWAF | (af))
+#define	DLT_NETBSD_RAWAF_AF(x)	((x) & 0x0000ffff)
+#define	DLT_IS_NETBSD_RAWAF(x)	(DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF)
+
+#endif /* !_NET_DLT_H_ */

Property changes on: lab4/.minix-src/include/net/dlt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/if_arp.h
===================================================================
--- lab4/.minix-src/include/net/if_arp.h	(nonexistent)
+++ lab4/.minix-src/include/net/if_arp.h	(revision 13)
@@ -0,0 +1,132 @@
+/*	$NetBSD: if_arp.h,v 1.30 2015/08/31 08:05:20 ozaki-r Exp $	*/
+
+/*
+ * Copyright (c) 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)if_arp.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NET_IF_ARP_H_
+#define _NET_IF_ARP_H_
+/*
+ * Address Resolution Protocol.
+ *
+ * See RFC 826 for protocol description.  ARP packets are variable
+ * in size; the arphdr structure defines the fixed-length portion.
+ * Protocol type values are the same as those for 10 Mb/s Ethernet.
+ * It is followed by the variable-sized fields ar_sha, arp_spa,
+ * arp_tha and arp_tpa in that order, according to the lengths
+ * specified.  Field names used correspond to RFC 826.
+ */
+struct	arphdr {
+	uint16_t ar_hrd;	/* format of hardware address */
+#define ARPHRD_ETHER 	1	/* ethernet hardware format */
+#define ARPHRD_IEEE802 	6	/* IEEE 802 hardware format */
+#define ARPHRD_ARCNET 	7	/* ethernet hardware format */
+#define ARPHRD_FRELAY 	15	/* frame relay hardware format */
+#define ARPHRD_STRIP 	23	/* Ricochet Starmode Radio hardware format */
+#define	ARPHRD_IEEE1394	24	/* IEEE 1394 (FireWire) hardware format */
+	uint16_t ar_pro;	/* format of protocol address */
+	uint8_t  ar_hln;	/* length of hardware address */
+	uint8_t  ar_pln;	/* length of protocol address */
+	uint16_t ar_op;		/* one of: */
+#define	ARPOP_REQUEST	1	/* request to resolve address */
+#define	ARPOP_REPLY	2	/* response to previous request */
+#define	ARPOP_REVREQUEST 3	/* request protocol address given hardware */
+#define	ARPOP_REVREPLY	4	/* response giving protocol address */
+#define	ARPOP_INVREQUEST 8 	/* request to identify peer */
+#define	ARPOP_INVREPLY	9	/* response identifying peer */
+/*
+ * The remaining fields are variable in size,
+ * according to the sizes above.
+ */
+#ifdef COMMENT_ONLY
+	uint8_t  ar_sha[];	/* sender hardware address */
+	uint8_t  ar_spa[];	/* sender protocol address */
+	uint8_t  ar_tha[];	/* target hardware address */
+	uint8_t  ar_tpa[];	/* target protocol address */
+#endif
+#define ar_sha(ap) (((char *)((ap)+1))+0)
+#define ar_spa(ap) (((char *)((ap)+1))+(ap)->ar_hln)
+#define ar_tha(ap) \
+	(ntohs((ap)->ar_hrd) == ARPHRD_IEEE1394 \
+		? NULL : (((char *)((ap)+1))+(ap)->ar_hln+(ap)->ar_pln))
+#define ar_tpa(ap) \
+	(ntohs((ap)->ar_hrd) == ARPHRD_IEEE1394 \
+		? (((char *)((ap)+1))+(ap)->ar_hln+(ap)->ar_pln) \
+		: (((char *)((ap)+1))+(ap)->ar_hln+(ap)->ar_pln+(ap)->ar_hln))
+} __packed;
+
+
+/*
+ * ARP ioctl request
+ */
+struct arpreq {
+	struct	sockaddr arp_pa;		/* protocol address */
+	struct	sockaddr arp_ha;		/* hardware address */
+	int	arp_flags;			/* flags */
+};
+/*  arp_flags and at_flags field values */
+#define	ATF_INUSE	0x01	/* entry in use */
+#define ATF_COM		0x02	/* completed entry (enaddr valid) */
+#define	ATF_PERM	0x04	/* permanent entry */
+#define	ATF_PUBL	0x08	/* publish entry (respond for other host) */
+#define	ATF_USETRAILERS	0x10	/* has requested trailers */
+
+/*
+ * Kernel statistics about arp
+ */
+#define	ARP_STAT_SNDTOTAL	0	/* total packets sent */
+#define	ARP_STAT_SNDREPLY	1	/* replies sent */
+#define	ARP_STAT_SENDREQUEST	2	/* requests sent */
+#define	ARP_STAT_RCVTOTAL	3	/* total packets received */
+#define	ARP_STAT_RCVREQUEST	4	/* valid requests received */
+#define	ARP_STAT_RCVREPLY	5	/* replies received */
+#define	ARP_STAT_RCVMCAST	6	/* multicast/broadcast received */
+#define	ARP_STAT_RCVBADPROTO	7	/* unknown protocol type received */
+#define	ARP_STAT_RCVBADLEN	8	/* bad (short) length received */
+#define	ARP_STAT_RCVZEROTPA	9	/* received w/ null target ip */
+#define	ARP_STAT_RCVZEROSPA	10	/* received w/ null source ip */
+#define	ARP_STAT_RCVNOINT	11	/* couldn't map to interface */
+#define	ARP_STAT_RCVLOCALSHA	12	/* received from local hw address */
+#define	ARP_STAT_RCVBCASTSHA	13	/* received w/ broadcast src */
+#define	ARP_STAT_RCVLOCALSPA	14	/* received for a local ip [dup!] */
+#define	ARP_STAT_RCVOVERPERM	15	/* attempts to overwrite static info */
+#define	ARP_STAT_RCVOVERINT	16	/* attempts to overwrite wrong if */
+#define	ARP_STAT_RCVOVER	17	/* entries overwritten! */
+#define	ARP_STAT_RCVLENCHG	18	/* changes in hw address len */
+#define	ARP_STAT_DFRTOTAL	19	/* deferred pending ARP resolution */
+#define	ARP_STAT_DFRSENT	20	/* deferred, then sent */
+#define	ARP_STAT_DFRDROPPED	21	/* deferred, then dropped */
+#define	ARP_STAT_ALLOCFAIL	22	/* failures to allocate llinfo */
+
+#define	ARP_NSTATS		23
+
+void arp_stat_add(int, uint64_t);
+
+#endif /* !_NET_IF_ARP_H_ */

Property changes on: lab4/.minix-src/include/net/if_arp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/if_media.h
===================================================================
--- lab4/.minix-src/include/net/if_media.h	(nonexistent)
+++ lab4/.minix-src/include/net/if_media.h	(revision 13)
@@ -0,0 +1,648 @@
+/*	$NetBSD: if_media.h,v 1.56 2012/10/25 10:59:43 msaitoh Exp $	*/
+
+/*-
+ * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1997
+ *	Jonathan Stone and Jason R. Thorpe.  All rights reserved.
+ *
+ * This software is derived from information provided by Matt Thomas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by Jonathan Stone
+ *	and Jason R. Thorpe for the NetBSD Project.
+ * 4. The names of the authors may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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.
+ */
+
+#ifndef _NET_IF_MEDIA_H_
+#define _NET_IF_MEDIA_H_
+
+/*
+ * Prototypes and definitions for BSD/OS-compatible network interface
+ * media selection.
+ *
+ * Where it is safe to do so, this code strays slightly from the BSD/OS
+ * design.  Software which uses the API (device drivers, basically)
+ * shouldn't notice any difference.
+ *
+ * Many thanks to Matt Thomas for providing the information necessary
+ * to implement this interface.
+ */
+
+#ifdef _KERNEL
+
+#include <sys/queue.h>
+
+/*
+ * Driver callbacks for media status and change requests.
+ */
+typedef	int (*ifm_change_cb_t)(struct ifnet *);
+typedef	void (*ifm_stat_cb_t)(struct ifnet *, struct ifmediareq *);
+
+/*
+ * In-kernel representation of a single supported media type.
+ */
+struct ifmedia_entry {
+	TAILQ_ENTRY(ifmedia_entry) ifm_list;
+	u_int	ifm_media;	/* description of this media attachment */
+	u_int	ifm_data;	/* for driver-specific use */
+	void	*ifm_aux;	/* for driver-specific use */
+};
+
+/*
+ * One of these goes into a network interface's softc structure.
+ * It is used to keep general media state.
+ */
+struct ifmedia {
+	u_int	ifm_mask;	/* mask of changes we don't care about */
+	u_int	ifm_media;	/* current user-set media word */
+	struct ifmedia_entry *ifm_cur;	/* currently selected media */
+	TAILQ_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */
+	ifm_change_cb_t	ifm_change;	/* media change driver callback */
+	ifm_stat_cb_t	ifm_status;	/* media status driver callback */
+};
+
+/* Initialize an interface's struct if_media field. */
+void	ifmedia_init(struct ifmedia *, int, ifm_change_cb_t, ifm_stat_cb_t);
+
+int ifmedia_change(struct ifmedia *, struct ifnet *);
+
+/* Add one supported medium to a struct ifmedia. */
+void	ifmedia_add(struct ifmedia *, int, int, void *);
+
+/* Add an array (of ifmedia_entry) media to a struct ifmedia. */
+void	ifmedia_list_add(struct ifmedia *, struct ifmedia_entry *, int);
+
+/* Set default media type on initialization. */
+void	ifmedia_set(struct ifmedia *ifm, int mword);
+
+/* Common ioctl function for getting/setting media, called by driver. */
+int	ifmedia_ioctl(struct ifnet *, struct ifreq *, struct ifmedia *, u_long);
+
+/* Look up a media entry. */
+struct ifmedia_entry *ifmedia_match(struct ifmedia *, u_int, u_int);
+
+/* Delete all media for a given media instance */
+void	ifmedia_delete_instance(struct ifmedia *, u_int);
+
+/* Compute baudrate for a given media. */
+uint64_t	ifmedia_baudrate(int);
+
+/* Remove all media */
+void		ifmedia_removeall(struct ifmedia *);
+
+#endif /*_KERNEL */
+
+/*
+ * if_media Options word:
+ *	Bits	Use
+ *	----	-------
+ *	0-4	Media subtype		MAX SUBTYPE == 31!
+ *	5-7	Media type
+ *	8-15	Type specific options
+ *	16-18	Mode (for multi-mode devices)
+ *	19	RFU
+ *	20-27	Shared (global) options
+ *	28-31	Instance
+ */
+
+/*
+ * Ethernet
+ */
+#define	IFM_ETHER	0x00000020
+#define	IFM_10_T	3		/* 10BaseT - RJ45 */
+#define	IFM_10_2	4		/* 10Base2 - Thinnet */
+#define	IFM_10_5	5		/* 10Base5 - AUI */
+#define	IFM_100_TX	6		/* 100BaseTX - RJ45 */
+#define	IFM_100_FX	7		/* 100BaseFX - Fiber */
+#define	IFM_100_T4	8		/* 100BaseT4 - 4 pair cat 3 */
+#define	IFM_100_VG	9		/* 100VG-AnyLAN */
+#define	IFM_100_T2	10		/* 100BaseT2 */
+#define	IFM_1000_SX	11		/* 1000BaseSX - multi-mode fiber */
+#define	IFM_10_STP	12		/* 10BaseT over shielded TP */
+#define	IFM_10_FL	13		/* 10BaseFL - Fiber */
+#define	IFM_1000_LX	14		/* 1000baseLX - single-mode fiber */
+#define	IFM_1000_CX	15		/* 1000baseCX - 150ohm STP */
+#define	IFM_1000_T	16		/* 1000baseT - 4 pair cat 5 */
+#define	IFM_HPNA_1	17		/* HomePNA 1.0 (1Mb/s) */
+#define	IFM_10G_LR	18		/* 10GbaseLR - single-mode fiber */
+#define	IFM_10G_SR	19		/* 10GBase-SR 850nm Multi-mode */
+#define	IFM_10G_CX4	20		/* 10GBase CX4 copper */
+#define	IFM_2500_SX	21		/* 2500baseSX - multi-mode fiber */
+#define	IFM_1000_BX10	22		/* 1000base-BX10 */
+#define	IFM_10G_TWINAX	23		/* 10GBase Twinax copper */
+#define	IFM_10G_TWINAX_LONG	24	/* 10GBase Twinax Long copper */
+#define	IFM_10G_LRM	25		/* 10GBase-LRM 850nm Multi-mode */
+#define	IFM_10G_T	26		/* 10GBase-T - RJ45 */
+
+#define	IFM_ETH_MASTER	0x00000100	/* master mode (1000baseT) */
+#define	IFM_ETH_RXPAUSE	0x00000200	/* receive PAUSE frames */
+#define	IFM_ETH_TXPAUSE	0x00000400	/* transmit PAUSE frames */
+
+/*
+ * Token ring
+ */
+#define	IFM_TOKEN	0x00000040
+#define	IFM_TOK_STP4	3		/* Shielded twisted pair 4m - DB9 */
+#define	IFM_TOK_STP16	4		/* Shielded twisted pair 16m - DB9 */
+#define	IFM_TOK_UTP4	5		/* Unshielded twisted pair 4m - RJ45 */
+#define	IFM_TOK_UTP16	6		/* Unshielded twisted pair 16m - RJ45 */
+#define	IFM_TOK_ETR	0x00000200	/* Early token release */
+#define	IFM_TOK_SRCRT	0x00000400	/* Enable source routing features */
+#define	IFM_TOK_ALLR	0x00000800	/* All routes / Single route bcast */
+
+/*
+ * FDDI
+ */
+#define	IFM_FDDI	0x00000060
+#define	IFM_FDDI_SMF	3		/* Single-mode fiber */
+#define	IFM_FDDI_MMF	4		/* Multi-mode fiber */
+#define	IFM_FDDI_UTP	5		/* CDDI / UTP */
+#define	IFM_FDDI_DA	0x00000100	/* Dual attach / single attach */
+
+/*
+ * IEEE 802.11 Wireless
+ */
+#define	IFM_IEEE80211	0x00000080
+#define	IFM_IEEE80211_FH1	3	/* Frequency Hopping 1Mbps */
+#define	IFM_IEEE80211_FH2	4	/* Frequency Hopping 2Mbps */
+#define	IFM_IEEE80211_DS2	5	/* Direct Sequence 2Mbps */
+#define	IFM_IEEE80211_DS5	6	/* Direct Sequence 5Mbps*/
+#define	IFM_IEEE80211_DS11	7	/* Direct Sequence 11Mbps*/
+#define	IFM_IEEE80211_DS1	8	/* Direct Sequence 1Mbps */
+#define	IFM_IEEE80211_DS22	9	/* Direct Sequence 22Mbps */
+#define	IFM_IEEE80211_OFDM6	10	/* OFDM 6Mbps */
+#define	IFM_IEEE80211_OFDM9	11	/* OFDM 9Mbps */
+#define	IFM_IEEE80211_OFDM12	12	/* OFDM 12Mbps */
+#define	IFM_IEEE80211_OFDM18	13	/* OFDM 18Mbps */
+#define	IFM_IEEE80211_OFDM24	14	/* OFDM 24Mbps */
+#define	IFM_IEEE80211_OFDM36	15	/* OFDM 36Mbps */
+#define	IFM_IEEE80211_OFDM48	16	/* OFDM 48Mbps */
+#define	IFM_IEEE80211_OFDM54	17	/* OFDM 54Mbps */
+#define	IFM_IEEE80211_OFDM72	18	/* OFDM 72Mbps */
+#define	IFM_IEEE80211_DS354k	19	/* Direct Sequence 354Kbps */
+#define	IFM_IEEE80211_DS512k	20	/* Direct Sequence 512Kbps */
+#define	IFM_IEEE80211_OFDM3	21	/* OFDM 3Mbps */
+#define	IFM_IEEE80211_OFDM4	22	/* OFDM 4.5Mbps */
+#define	IFM_IEEE80211_OFDM27	23	/* OFDM 27Mbps */
+/* NB: not enough bits to express MCS fully */
+#define	IFM_IEEE80211_MCS	24	/* HT MCS rate */
+
+#define	IFM_IEEE80211_ADHOC	0x00000100	/* Operate in Adhoc mode */
+#define	IFM_IEEE80211_HOSTAP	0x00000200	/* Operate in Host AP mode */
+#define	IFM_IEEE80211_MONITOR	0x00000400	/* Operate in Monitor mode */
+#define	IFM_IEEE80211_TURBO	0x00000800	/* Operate in Turbo mode */
+#define	IFM_IEEE80211_IBSS	0x00001000	/* Operate in IBSS mode */
+#define	IFM_IEEE80211_WDS 	0x00002000	/* Operate as an WDS master */
+#define	IFM_IEEE80211_MBSS	0x00004000	/* Operate in MBSS mode */
+
+/* operating mode for multi-mode devices */
+#define	IFM_IEEE80211_11A	0x00010000	/* 5 GHz, OFDM mode */
+#define	IFM_IEEE80211_11B	0x00020000	/* Direct Sequence mode */
+#define	IFM_IEEE80211_11G	0x00030000	/* 2 GHz, CCK mode */
+#define	IFM_IEEE80211_FH	0x00040000	/* 2 GHz, GFSK mode */
+#define	IFM_IEEE80211_11NA	0x00050000	/* 5Ghz, HT mode */
+#define	IFM_IEEE80211_11NG	0x00060000	/* 2Ghz, HT mode */
+
+
+/*
+ * Common Address Redundancy Protocol
+ */
+#define	IFM_CARP		0x000000c0
+
+/*
+ * Shared media sub-types
+ */
+#define	IFM_AUTO	0		/* Autoselect best media */
+#define	IFM_MANUAL	1		/* Jumper/dipswitch selects media */
+#define	IFM_NONE	2		/* Deselect all media */
+
+/*
+ * Shared options
+ */
+#define	IFM_FDX		0x00100000	/* Force full duplex */
+#define	IFM_HDX		0x00200000	/* Force half duplex */
+#define	IFM_FLOW	0x00400000	/* enable hardware flow control */
+#define	IFM_FLAG0	0x01000000	/* Driver defined flag */
+#define	IFM_FLAG1	0x02000000	/* Driver defined flag */
+#define	IFM_FLAG2	0x04000000	/* Driver defined flag */
+#define	IFM_LOOP	0x08000000	/* Put hardware in loopback */
+
+/*
+ * Masks
+ */
+#define	IFM_NMASK	0x000000e0	/* Network type */
+#define	IFM_TMASK	0x0000001f	/* Media sub-type */
+#define	IFM_IMASK	0xf0000000	/* Instance */
+#define	IFM_ISHIFT	28		/* Instance shift */
+#define	IFM_OMASK	0x0000ff00	/* Type specific options */
+#define	IFM_MMASK	0x00070000	/* Mode */
+#define	IFM_MSHIFT	16		/* Mode shift */
+#define	IFM_GMASK	0x0ff00000	/* Global options */
+
+	/* Ethernet flow control mask */
+#define	IFM_ETH_FMASK	(IFM_FLOW | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE)
+
+#define	IFM_NMIN	IFM_ETHER	/* lowest Network type */
+#define	IFM_NMAX	IFM_NMASK	/* highest Network type */
+
+/*
+ * Status bits
+ */
+#define	IFM_AVALID	0x00000001	/* Active bit valid */
+#define	IFM_ACTIVE	0x00000002	/* Interface attached to working net */
+
+/* Mask of "status valid" bits, for ifconfig(8). */
+#define	IFM_STATUS_VALID IFM_AVALID
+
+/* List of "status valid" bits, for ifconfig(8). */
+#define	IFM_STATUS_VALID_LIST {						\
+	IFM_AVALID,							\
+	0,								\
+}
+
+/*
+ * Macros to extract various bits of information from the media word.
+ */
+#define	IFM_TYPE(x)	((x) & IFM_NMASK)
+#define	IFM_SUBTYPE(x)	((x) & IFM_TMASK)
+#define	IFM_INST(x)	(((x) & IFM_IMASK) >> IFM_ISHIFT)
+#define	IFM_OPTIONS(x)	((x) & (IFM_OMASK | IFM_GMASK))
+#define	IFM_MODE(x)	((x) & IFM_MMASK)
+
+#define	IFM_INST_MAX	IFM_INST(IFM_IMASK)
+#define	IFM_INST_ANY	((u_int) -1)
+
+/*
+ * Macro to create a media word.
+ */
+#define	IFM_MAKEWORD(type, subtype, options, instance)			\
+	((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))
+#define	IFM_MAKEMODE(mode) \
+	(((mode) << IFM_MSHIFT) & IFM_MMASK)
+
+/*
+ * NetBSD extension not defined in the BSDI API.  This is used in various
+ * places to get the canonical description for a given type/subtype.
+ *
+ * In the subtype and mediaopt descriptions, the valid TYPE bits are OR'd
+ * in to indicate which TYPE the subtype/option corresponds to.  If no
+ * TYPE is present, it is a shared media/mediaopt.
+ *
+ * Note that these are parsed case-insensitive.
+ *
+ * Order is important.  The first matching entry is the canonical name
+ * for a media type; subsequent matches are aliases.
+ */
+struct ifmedia_description {
+	int	ifmt_word;		/* word value; may be masked */
+	const char *ifmt_string;	/* description */
+};
+
+#define	IFM_TYPE_DESCRIPTIONS {						\
+	{ IFM_ETHER,			"Ethernet" },			\
+	{ IFM_ETHER,			"ether" },			\
+	{ IFM_TOKEN,			"TokenRing" },			\
+	{ IFM_TOKEN,			"token" },			\
+	{ IFM_FDDI,			"FDDI" },			\
+	{ IFM_IEEE80211,		"IEEE802.11" },			\
+	{ IFM_CARP,			"CARP" },			\
+	{ 0, NULL },							\
+}
+
+#define	IFM_TYPE_MATCH(dt, t)						\
+	(IFM_TYPE((dt)) == 0 || IFM_TYPE((dt)) == IFM_TYPE((t)))
+
+#define	IFM_SUBTYPE_DESCRIPTIONS {					\
+	{ IFM_AUTO,			"autoselect" },			\
+	{ IFM_AUTO,			"auto" },			\
+	{ IFM_MANUAL,			"manual" },			\
+	{ IFM_NONE,			"none" },			\
+									\
+	{ IFM_ETHER | IFM_10_T,		"10baseT" },			\
+	{ IFM_ETHER | IFM_10_T,		"10baseT/UTP" },		\
+	{ IFM_ETHER | IFM_10_T,		"UTP" },			\
+	{ IFM_ETHER | IFM_10_T,		"10UTP" },			\
+	{ IFM_ETHER | IFM_10_T,		"10BASE-T" },			\
+	{ IFM_ETHER | IFM_10_2,		"10base2" },			\
+	{ IFM_ETHER | IFM_10_2,		"10base2/BNC" },		\
+	{ IFM_ETHER | IFM_10_2,		"BNC" },			\
+	{ IFM_ETHER | IFM_10_2,		"10BNC" },			\
+	{ IFM_ETHER | IFM_10_2,		"10BASE2" },			\
+	{ IFM_ETHER | IFM_10_5,		"10base5" },			\
+	{ IFM_ETHER | IFM_10_5,		"10base5/AUI" },		\
+	{ IFM_ETHER | IFM_10_5,		"AUI" },			\
+	{ IFM_ETHER | IFM_10_5,		"10AUI" },			\
+	{ IFM_ETHER | IFM_10_5,		"10BASE5" },			\
+	{ IFM_ETHER | IFM_100_TX,	"100baseTX" },			\
+	{ IFM_ETHER | IFM_100_TX,	"100TX" },			\
+	{ IFM_ETHER | IFM_100_TX,	"100BASE-TX" },			\
+	{ IFM_ETHER | IFM_100_FX,	"100baseFX" },			\
+	{ IFM_ETHER | IFM_100_FX,	"100FX" },			\
+	{ IFM_ETHER | IFM_100_FX,	"100BASE-FX" },			\
+	{ IFM_ETHER | IFM_100_T4,	"100baseT4" },			\
+	{ IFM_ETHER | IFM_100_T4,	"100T4" },			\
+	{ IFM_ETHER | IFM_100_T4,	"100BASE-T4" },			\
+	{ IFM_ETHER | IFM_100_VG,	"100baseVG" },			\
+	{ IFM_ETHER | IFM_100_VG,	"100VG" },			\
+	{ IFM_ETHER | IFM_100_VG,	"100VG-AnyLAN" },		\
+	{ IFM_ETHER | IFM_100_T2,	"100baseT2" },			\
+	{ IFM_ETHER | IFM_100_T2,	"100T2" },			\
+	{ IFM_ETHER | IFM_100_T2,	"100BASE-T2" },			\
+	{ IFM_ETHER | IFM_1000_SX,	"1000baseSX" },			\
+	{ IFM_ETHER | IFM_1000_SX,	"1000SX" },			\
+	{ IFM_ETHER | IFM_1000_SX,	"1000BASE-SX" },		\
+	{ IFM_ETHER | IFM_10_STP,	"10baseSTP" },			\
+	{ IFM_ETHER | IFM_10_STP,	"STP" },			\
+	{ IFM_ETHER | IFM_10_STP,	"10STP" },			\
+	{ IFM_ETHER | IFM_10_STP,	"10BASE-STP" },			\
+	{ IFM_ETHER | IFM_10_FL,	"10baseFL" },			\
+	{ IFM_ETHER | IFM_10_FL,	"FL" },				\
+	{ IFM_ETHER | IFM_10_FL,	"10FL" },			\
+	{ IFM_ETHER | IFM_10_FL,	"10BASE-FL" },			\
+	{ IFM_ETHER | IFM_1000_LX,	"1000baseLX" },			\
+	{ IFM_ETHER | IFM_1000_LX,	"1000LX" },			\
+	{ IFM_ETHER | IFM_1000_LX,	"1000BASE-LX" },		\
+	{ IFM_ETHER | IFM_1000_CX,	"1000baseCX" },			\
+	{ IFM_ETHER | IFM_1000_CX,	"1000CX" },			\
+	{ IFM_ETHER | IFM_1000_CX,	"1000BASE-CX" },		\
+	{ IFM_ETHER | IFM_1000_BX10,	"1000BASE-BX10" },		\
+	{ IFM_ETHER | IFM_1000_T,	"1000baseT" },			\
+	{ IFM_ETHER | IFM_1000_T,	"1000T" },			\
+	{ IFM_ETHER | IFM_1000_T,	"1000BASE-T" },			\
+	{ IFM_ETHER | IFM_HPNA_1,	"HomePNA1" },			\
+	{ IFM_ETHER | IFM_HPNA_1,	"HPNA1" },			\
+	{ IFM_ETHER | IFM_10G_LR,	"10GbaseLR" },			\
+	{ IFM_ETHER | IFM_10G_LR,	"10GLR" },			\
+	{ IFM_ETHER | IFM_10G_LR,	"10GBASE-LR" },			\
+	{ IFM_ETHER | IFM_10G_SR,	"10GbaseSR" },			\
+	{ IFM_ETHER | IFM_10G_SR,	"10GSR" },			\
+	{ IFM_ETHER | IFM_10G_SR,	"10GBASE-SR" },			\
+	{ IFM_ETHER | IFM_10G_LRM,	"10Gbase-LRM" },		\
+	{ IFM_ETHER | IFM_10G_TWINAX,	"10Gbase-Twinax" },		\
+	{ IFM_ETHER | IFM_10G_TWINAX_LONG,	"10Gbase-Twinax-Long" },\
+	{ IFM_ETHER | IFM_10G_T,	"10Gbase-T" },			\
+	{ IFM_ETHER | IFM_10G_CX4,	"10GbaseCX4" },			\
+	{ IFM_ETHER | IFM_10G_CX4,	"10GCX4" },			\
+	{ IFM_ETHER | IFM_10G_CX4,	"10GBASE-CX4" },		\
+	{ IFM_ETHER | IFM_2500_SX,	"2500baseSX" },			\
+	{ IFM_ETHER | IFM_2500_SX,	"2500SX" },			\
+									\
+	{ IFM_TOKEN | IFM_TOK_STP4,	"DB9/4Mbit" },			\
+	{ IFM_TOKEN | IFM_TOK_STP4,	"4STP" },			\
+	{ IFM_TOKEN | IFM_TOK_STP16,	"DB9/16Mbit" },			\
+	{ IFM_TOKEN | IFM_TOK_STP16,	"16STP" },			\
+	{ IFM_TOKEN | IFM_TOK_UTP4,	"UTP/4Mbit" },			\
+	{ IFM_TOKEN | IFM_TOK_UTP4,	"4UTP" },			\
+	{ IFM_TOKEN | IFM_TOK_UTP16,	"UTP/16Mbit" },			\
+	{ IFM_TOKEN | IFM_TOK_UTP16,	"16UTP" },			\
+									\
+	{ IFM_FDDI | IFM_FDDI_SMF,	"Single-mode" },		\
+	{ IFM_FDDI | IFM_FDDI_SMF,	"SMF" },			\
+	{ IFM_FDDI | IFM_FDDI_MMF,	"Multi-mode" },			\
+	{ IFM_FDDI | IFM_FDDI_MMF,	"MMF" },			\
+	{ IFM_FDDI | IFM_FDDI_UTP,	"UTP" },			\
+	{ IFM_FDDI | IFM_FDDI_UTP,	"CDDI" },			\
+									\
+	/*								\
+	 * Short-hand for common media+option combos.			\
+	 */								\
+	{ IFM_ETHER | IFM_10_T | IFM_FDX,	"10baseT-FDX" },	\
+	{ IFM_ETHER | IFM_10_T | IFM_FDX,	"10BASE-T-FDX" },	\
+	{ IFM_ETHER | IFM_100_TX | IFM_FDX,	"100baseTX-FDX" },	\
+	{ IFM_ETHER | IFM_100_TX | IFM_FDX,	"100BASE-TX-FDX" },	\
+	{ IFM_ETHER | IFM_1000_T | IFM_FDX,	"1000baseT-FDX" },	\
+									\
+	/*								\
+	 * IEEE 802.11							\
+	 */								\
+	{ IFM_IEEE80211 | IFM_IEEE80211_FH1,	"FH1" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_FH2,	"FH2" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS1,	"DS1" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS2,	"DS2" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS5,	"DS5" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS11,	"DS11" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS22,	"DS22" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM6,	"OFDM6" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM9,	"OFDM9" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM12,	"OFDM12" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM18,	"OFDM18" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM24,	"OFDM24" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM36,	"OFDM36" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM48,	"OFDM48" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM54,	"OFDM54" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM72,	"OFDM72" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS354k, "DS/354Kbps" },         \
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS512k, "DS/512Kbps" },         \
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM3,  "OFDM/3Mbps" },         \
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM4,  "OFDM/4.5Mbps" },       \
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM27, "OFDM/27Mbps" },        \
+									\
+	{ 0, NULL },							\
+}
+
+#define IFM_MODE_DESCRIPTIONS {						\
+	{ IFM_AUTO,				"autoselect" },		\
+	{ IFM_AUTO,				"auto" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_11A,	"11a" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_11B,	"11b" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_11G,	"11g" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_FH,	"fh" },			\
+	{ IFM_IEEE80211 | IFM_IEEE80211_11NA,	"11na" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_11NG,	"11ng" },		\
+	{ 0, NULL },							\
+}
+
+#define	IFM_OPTION_DESCRIPTIONS {					\
+	{ IFM_FDX,			"full-duplex" },		\
+	{ IFM_FDX,			"fdx" },			\
+	{ IFM_HDX,			"half-duplex" },		\
+	{ IFM_HDX,			"hdx" },			\
+	{ IFM_FLOW,			"flowcontrol" },		\
+	{ IFM_FLOW,			"flow" },			\
+	{ IFM_FLAG0,			"flag0" },			\
+	{ IFM_FLAG1,			"flag1" },			\
+	{ IFM_FLAG2,			"flag2" },			\
+	{ IFM_LOOP,			"loopback" },			\
+	{ IFM_LOOP,			"hw-loopback"},			\
+	{ IFM_LOOP,			"loop" },			\
+									\
+	{ IFM_ETHER | IFM_ETH_MASTER,	"master" },			\
+	{ IFM_ETHER | IFM_ETH_RXPAUSE,	"rxpause" },			\
+	{ IFM_ETHER | IFM_ETH_TXPAUSE,	"txpause" },			\
+									\
+	{ IFM_TOKEN | IFM_TOK_ETR,	"EarlyTokenRelease" },		\
+	{ IFM_TOKEN | IFM_TOK_ETR,	"ETR" },			\
+	{ IFM_TOKEN | IFM_TOK_SRCRT,	"SourceRouting" },		\
+	{ IFM_TOKEN | IFM_TOK_SRCRT,	"SRCRT" },			\
+	{ IFM_TOKEN | IFM_TOK_ALLR,	"AllRoutes" },			\
+	{ IFM_TOKEN | IFM_TOK_ALLR,	"ALLR" },			\
+									\
+	{ IFM_FDDI | IFM_FDDI_DA,	"dual-attach" },		\
+	{ IFM_FDDI | IFM_FDDI_DA,	"das" },			\
+									\
+	{ IFM_IEEE80211 | IFM_IEEE80211_ADHOC,	"adhoc" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_HOSTAP,	"hostap" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_MONITOR,"monitor" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_TURBO,	"turbo" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_IBSS,	"ibss" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_WDS, 	"wds" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_MBSS,	"mesh" },		\
+									\
+	{ 0, NULL },							\
+}
+
+/*
+ * Baudrate descriptions for the various media types.
+ */
+struct ifmedia_baudrate {
+	int	ifmb_word;		/* media word */
+	uint64_t	ifmb_baudrate;		/* corresponding baudrate */
+};
+
+#define	IFM_BAUDRATE_DESCRIPTIONS {					\
+	{ IFM_ETHER | IFM_10_T,		IF_Mbps(10) },			\
+	{ IFM_ETHER | IFM_10_2,		IF_Mbps(10) },			\
+	{ IFM_ETHER | IFM_10_5,		IF_Mbps(10) },			\
+	{ IFM_ETHER | IFM_100_TX,	IF_Mbps(100) },			\
+	{ IFM_ETHER | IFM_100_FX,	IF_Mbps(100) },			\
+	{ IFM_ETHER | IFM_100_T4,	IF_Mbps(100) },			\
+	{ IFM_ETHER | IFM_100_VG,	IF_Mbps(100) },			\
+	{ IFM_ETHER | IFM_100_T2,	IF_Mbps(100) },			\
+	{ IFM_ETHER | IFM_1000_SX,	IF_Mbps(1000) },		\
+	{ IFM_ETHER | IFM_10_STP,	IF_Mbps(10) },			\
+	{ IFM_ETHER | IFM_10_FL,	IF_Mbps(10) },			\
+	{ IFM_ETHER | IFM_1000_LX,	IF_Mbps(1000) },		\
+	{ IFM_ETHER | IFM_1000_CX,	IF_Mbps(1000) },		\
+	{ IFM_ETHER | IFM_1000_T,	IF_Mbps(1000) },		\
+	{ IFM_ETHER | IFM_HPNA_1,	IF_Mbps(1) },			\
+	{ IFM_ETHER | IFM_10G_LR,	IF_Gbps(10ULL) },		\
+	{ IFM_ETHER | IFM_10G_SR,	IF_Gbps(10ULL) },		\
+	{ IFM_ETHER | IFM_10G_CX4,	IF_Gbps(10ULL) },		\
+	{ IFM_ETHER | IFM_2500_SX,	IF_Mbps(2500ULL) },		\
+									\
+	{ IFM_TOKEN | IFM_TOK_STP4,	IF_Mbps(4) },			\
+	{ IFM_TOKEN | IFM_TOK_STP16,	IF_Mbps(16) },			\
+	{ IFM_TOKEN | IFM_TOK_UTP4,	IF_Mbps(4) },			\
+	{ IFM_TOKEN | IFM_TOK_UTP16,	IF_Mbps(16) },			\
+									\
+	{ IFM_FDDI | IFM_FDDI_SMF,	IF_Mbps(100) },			\
+	{ IFM_FDDI | IFM_FDDI_MMF,	IF_Mbps(100) },			\
+	{ IFM_FDDI | IFM_FDDI_UTP,	IF_Mbps(100) },			\
+									\
+	{ IFM_IEEE80211 | IFM_IEEE80211_FH1,	IF_Mbps(1) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_FH2,	IF_Mbps(2) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS2,	IF_Mbps(2) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS5,	IF_Kbps(5500) },	\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS11,	IF_Mbps(11) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS1,	IF_Mbps(1) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_DS22,	IF_Mbps(22) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM6,	IF_Mbps(6) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM9,	IF_Mbps(9) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM12,	IF_Mbps(12) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM18,	IF_Mbps(18) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM24,	IF_Mbps(24) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM36,	IF_Mbps(36) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM48,	IF_Mbps(48) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM54,	IF_Mbps(54) },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM72,	IF_Mbps(72) },		\
+									\
+	{ 0, 0 },							\
+}
+
+/*
+ * Status bit descriptions for the various media types.
+ */
+struct ifmedia_status_description {
+	int	ifms_type;
+	int	ifms_valid;
+	int	ifms_bit;
+	const char *ifms_string[2];
+};
+
+#define	IFM_STATUS_DESC(ifms, bit)					\
+	(ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0]
+
+#define	IFM_STATUS_DESCRIPTIONS {					\
+	{ IFM_ETHER,		IFM_AVALID,	IFM_ACTIVE,		\
+	  { "no carrier", "active" } },					\
+									\
+	{ IFM_FDDI,		IFM_AVALID,	IFM_ACTIVE,		\
+	  { "no ring", "inserted" } },					\
+									\
+	{ IFM_TOKEN,		IFM_AVALID,	IFM_ACTIVE,		\
+	  { "no ring", "inserted" } },					\
+									\
+	{ IFM_IEEE80211,	IFM_AVALID,	IFM_ACTIVE,		\
+	  { "no network", "active" } },					\
+									\
+	{ IFM_CARP,		IFM_AVALID,	IFM_ACTIVE,		\
+	    { "backup", "master" } },					\
+									\
+	{ 0,			0,		0,			\
+	  { NULL, NULL } },						\
+}
+
+#ifndef _KERNEL
+/* Functions for converting media to/from strings, in libutil/if_media.c */
+const char *get_media_type_string(int);
+const char *get_media_subtype_string(int);
+const char *get_media_mode_string(int);
+const char *get_media_option_string(int *);
+int get_media_mode(int, const char *);
+int get_media_subtype(int, const char *);
+int get_media_options(int, const char *, char **);
+int lookup_media_word(struct ifmedia_description *, int, const char *);
+#endif /* _KERNEL */
+
+#endif /* !_NET_IF_MEDIA_H_ */

Property changes on: lab4/.minix-src/include/net/if_media.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/pfil.h
===================================================================
--- lab4/.minix-src/include/net/pfil.h	(nonexistent)
+++ lab4/.minix-src/include/net/pfil.h	(revision 13)
@@ -0,0 +1,73 @@
+/*	$NetBSD: pfil.h,v 1.31 2013/06/29 21:06:58 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1996 Matthew R. Green
+ * 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.
+ */
+
+#ifndef _NET_PFIL_H_
+#define _NET_PFIL_H_
+
+#include <sys/queue.h>
+
+struct mbuf;
+struct ifnet;
+
+/*
+ * The packet filter hooks are designed for anything to call them to
+ * possibly intercept the packet.
+ */
+typedef int (*pfil_func_t)(void *, struct mbuf **, struct ifnet *, int);
+
+#define PFIL_IN		0x00000001
+#define PFIL_OUT	0x00000002
+#define PFIL_ALL	(PFIL_IN|PFIL_OUT)
+#define PFIL_IFADDR	0x00000008
+#define PFIL_IFNET	0x00000010
+
+/* events notified by PFIL_IFNET */
+#define	PFIL_IFNET_ATTACH	0
+#define	PFIL_IFNET_DETACH	1
+
+#define	PFIL_TYPE_AF		1	/* key is AF_* type */
+#define	PFIL_TYPE_IFNET		2	/* key is ifnet pointer */
+
+typedef struct pfil_head	pfil_head_t;
+
+#ifdef _KERNEL
+
+int	pfil_run_hooks(pfil_head_t *, struct mbuf **, struct ifnet *, int);
+int	pfil_add_hook(pfil_func_t, void *, int, pfil_head_t *);
+int	pfil_remove_hook(pfil_func_t, void *, int, pfil_head_t *);
+
+pfil_head_t *	pfil_head_create(int, void *);
+void		pfil_head_destroy(pfil_head_t *);
+pfil_head_t *	pfil_head_get(int, void *);
+
+/* Packet filtering hook for interfaces (in sys/net/if.c module). */
+extern pfil_head_t *if_pfil;
+
+#endif /* _KERNEL */
+
+#endif /* !_NET_PFIL_H_ */

Property changes on: lab4/.minix-src/include/net/pfil.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/if.h
===================================================================
--- lab4/.minix-src/include/net/if.h	(nonexistent)
+++ lab4/.minix-src/include/net/if.h	(revision 13)
@@ -0,0 +1,1056 @@
+/*	$NetBSD: if.h,v 1.193 2015/10/02 03:08:26 ozaki-r Exp $	*/
+
+/*-
+ * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by William Studenmund and Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)if.h	8.3 (Berkeley) 2/9/95
+ */
+
+#ifndef _NET_IF_H_
+#define _NET_IF_H_
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <stdbool.h>
+#endif
+
+#include <sys/featuretest.h>
+
+/*
+ * Length of interface external name, including terminating '\0'.
+ * Note: this is the same size as a generic device's external name.
+ */
+#define IF_NAMESIZE 16
+
+#if defined(_NETBSD_SOURCE)
+
+#include <sys/socket.h>
+#include <sys/queue.h>
+#include <sys/mutex.h>
+
+#include <net/dlt.h>
+#include <net/pfil.h>
+#ifdef _KERNEL
+#include <net/pktqueue.h>
+#endif
+
+/*
+ * Always include ALTQ glue here -- we use the ALTQ interface queue
+ * structure even when ALTQ is not configured into the kernel so that
+ * the size of struct ifnet does not changed based on the option.  The
+ * ALTQ queue structure is API-compatible with the legacy ifqueue.
+ */
+#include <altq/if_altq.h>
+
+/*
+ * Structures defining a network interface, providing a packet
+ * transport mechanism (ala level 0 of the PUP protocols).
+ *
+ * Each interface accepts output datagrams of a specified maximum
+ * length, and provides higher level routines with input datagrams
+ * received from its medium.
+ *
+ * Output occurs when the routine if_output is called, with four parameters:
+ *	(*ifp->if_output)(ifp, m, dst, rt)
+ * Here m is the mbuf chain to be sent and dst is the destination address.
+ * The output routine encapsulates the supplied datagram if necessary,
+ * and then transmits it on its medium.
+ *
+ * On input, each interface unwraps the data received by it, and either
+ * places it on the input queue of a internetwork datagram routine
+ * and posts the associated software interrupt, or passes the datagram to a raw
+ * packet input routine.
+ *
+ * Routines exist for locating interfaces by their addresses
+ * or for locating a interface on a certain network, as well as more general
+ * routing and gateway routines maintaining information used to locate
+ * interfaces.  These routines live in the files if.c and route.c
+ */
+#include <sys/time.h>
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#include "opt_gateway.h"
+#endif
+
+struct mbuf;
+struct proc;
+struct rtentry;
+struct socket;
+struct ether_header;
+struct ifaddr;
+struct ifnet;
+struct rt_addrinfo;
+
+#define	IFNAMSIZ	IF_NAMESIZE
+
+/*
+ * Structure describing a `cloning' interface.
+ */
+struct if_clone {
+	LIST_ENTRY(if_clone) ifc_list;	/* on list of cloners */
+	const char *ifc_name;		/* name of device, e.g. `gif' */
+	size_t ifc_namelen;		/* length of name */
+
+	int	(*ifc_create)(struct if_clone *, int);
+	int	(*ifc_destroy)(struct ifnet *);
+};
+
+#define	IF_CLONE_INITIALIZER(name, create, destroy)			\
+	{ { NULL, NULL }, name, sizeof(name) - 1, create, destroy }
+
+/*
+ * Structure used to query names of interface cloners.
+ */
+struct if_clonereq {
+	int	ifcr_total;		/* total cloners (out) */
+	int	ifcr_count;		/* room for this many in user buffer */
+	char	*ifcr_buffer;		/* buffer for cloner names */
+};
+
+/*
+ * Structure defining statistics and other data kept regarding a network
+ * interface.
+ */
+struct if_data {
+	/* generic interface information */
+	u_char	ifi_type;		/* ethernet, tokenring, etc. */
+	u_char	ifi_addrlen;		/* media address length */
+	u_char	ifi_hdrlen;		/* media header length */
+	int	ifi_link_state;		/* current link state */
+	uint64_t ifi_mtu;		/* maximum transmission unit */
+	uint64_t ifi_metric;		/* routing metric (external only) */
+	uint64_t ifi_baudrate;		/* linespeed */
+	/* volatile statistics */
+	uint64_t ifi_ipackets;		/* packets received on interface */
+	uint64_t ifi_ierrors;		/* input errors on interface */
+	uint64_t ifi_opackets;		/* packets sent on interface */
+	uint64_t ifi_oerrors;		/* output errors on interface */
+	uint64_t ifi_collisions;	/* collisions on csma interfaces */
+	uint64_t ifi_ibytes;		/* total number of octets received */
+	uint64_t ifi_obytes;		/* total number of octets sent */
+	uint64_t ifi_imcasts;		/* packets received via multicast */
+	uint64_t ifi_omcasts;		/* packets sent via multicast */
+	uint64_t ifi_iqdrops;		/* dropped on input, this interface */
+	uint64_t ifi_noproto;		/* destined for unsupported protocol */
+	struct	timespec ifi_lastchange;/* last operational state change */
+};
+
+/*
+ * Values for if_link_state.
+ */
+#define	LINK_STATE_UNKNOWN	0	/* link invalid/unknown */
+#define	LINK_STATE_DOWN		1	/* link is down */
+#define	LINK_STATE_UP		2	/* link is up */
+
+/*
+ * Structure defining a queue for a network interface.
+ */
+struct ifqueue {
+	struct		mbuf *ifq_head;
+	struct		mbuf *ifq_tail;
+	int		ifq_len;
+	int		ifq_maxlen;
+	int		ifq_drops;
+	kmutex_t	*ifq_lock;
+};
+
+struct ifnet_lock;
+
+#ifdef _KERNEL
+#include <sys/condvar.h>
+#include <sys/percpu.h>
+#include <sys/callout.h>
+#ifdef GATEWAY
+#include <sys/mutex.h>
+#else
+#include <sys/rwlock.h>
+#endif
+
+struct ifnet_lock {
+	kmutex_t il_lock;	/* Protects the critical section. */
+	uint64_t il_nexit;	/* Counts threads across all CPUs who
+				 * have exited the critical section.
+				 * Access to il_nexit is synchronized
+				 * by il_lock.
+				 */
+	percpu_t *il_nenter;	/* Counts threads on each CPU who have
+				 * entered or who wait to enter the
+				 * critical section protected by il_lock.
+				 * Synchronization is not required.
+				 */
+	kcondvar_t il_emptied;	/* The ifnet_lock user must arrange for
+				 * the last threads in the critical
+				 * section to signal this condition variable
+				 * before they leave.
+				 */
+};
+#endif /* _KERNEL */
+
+/*
+ * Structure defining a queue for a network interface.
+ *
+ * (Would like to call this struct ``if'', but C isn't PL/1.)
+ */
+TAILQ_HEAD(ifnet_head, ifnet);		/* the actual queue head */
+
+struct bridge_softc;
+struct bridge_iflist;
+struct callout;
+struct krwlock;
+
+typedef struct ifnet {
+	void	*if_softc;		/* lower-level data for this if */
+	TAILQ_ENTRY(ifnet) if_list;	/* all struct ifnets are chained */
+	TAILQ_HEAD(, ifaddr) if_addrlist; /* linked list of addresses per if */
+	char	if_xname[IFNAMSIZ];	/* external name (name + unit) */
+	int	if_pcount;		/* number of promiscuous listeners */
+	struct bpf_if *if_bpf;		/* packet filter structure */
+	u_short	if_index;		/* numeric abbreviation for this if */
+	short	if_timer;		/* time 'til if_slowtimo called */
+	short	if_flags;		/* up/down, broadcast, etc. */
+	short	if__pad1;		/* be nice to m68k ports */
+	struct	if_data if_data;	/* statistics and other data about if */
+	/*
+	 * Procedure handles.  If you add more of these, don't forget the
+	 * corresponding NULL stub in if.c.
+	 */
+	int	(*if_output)		/* output routine (enqueue) */
+		    (struct ifnet *, struct mbuf *, const struct sockaddr *,
+		     struct rtentry *);
+	void	(*if_input)		/* input routine (from h/w driver) */
+		    (struct ifnet *, struct mbuf *);
+	void	(*if_start)		/* initiate output routine */
+		    (struct ifnet *);
+	int	(*if_ioctl)		/* ioctl routine */
+		    (struct ifnet *, u_long, void *);
+	int	(*if_init)		/* init routine */
+		    (struct ifnet *);
+	void	(*if_stop)		/* stop routine */
+		    (struct ifnet *, int);
+	void	(*if_slowtimo)		/* timer routine */
+		    (struct ifnet *);
+#define	if_watchdog	if_slowtimo
+	void	(*if_drain)		/* routine to release resources */
+		    (struct ifnet *);
+	struct ifaltq if_snd;		/* output queue (includes altq) */
+	struct ifaddr	*if_dl;		/* identity of this interface. */
+	const struct	sockaddr_dl *if_sadl;	/* pointer to sockaddr_dl
+						 * of if_dl
+						 */
+	/* if_hwdl: h/w identity
+	 *
+	 * May be NULL.  If not NULL, it is the address assigned
+	 * to the interface by the manufacturer, so it very likely
+	 * to be unique.  It MUST NOT be deleted.  It is highly
+	 * suitable for deriving the EUI64 for the interface.
+	 */
+	struct ifaddr	*if_hwdl;
+	const uint8_t *if_broadcastaddr;/* linklevel broadcast bytestring */
+	struct bridge_softc	*if_bridge;	/* bridge glue */
+	struct bridge_iflist	*if_bridgeif;	/* shortcut to interface list entry */
+	int	if_dlt;			/* data link type (<net/dlt.h>) */
+	pfil_head_t *	if_pfil;	/* filtering point */
+	uint64_t if_capabilities;	/* interface capabilities */
+	uint64_t if_capenable;		/* capabilities enabled */
+	union {
+		void *		carp_s;	/* carp structure (used by !carp ifs) */
+		struct ifnet	*carp_d;/* ptr to carpdev (used by carp ifs) */
+	} if_carp_ptr;
+#define if_carp		if_carp_ptr.carp_s
+#define if_carpdev	if_carp_ptr.carp_d
+	/*
+	 * These are pre-computed based on an interfaces enabled
+	 * capabilities, for speed elsewhere.
+	 */
+	int	if_csum_flags_tx;	/* M_CSUM_* flags for Tx */
+	int	if_csum_flags_rx;	/* M_CSUM_* flags for Rx */
+
+	void	*if_afdata[AF_MAX];
+	struct	mowner *if_mowner;	/* who owns mbufs for this interface */
+
+	void	*if_agrprivate;		/* used only when #if NAGR > 0 */
+
+	/*
+	 * pf specific data, used only when #if NPF > 0.
+	 */
+	void	*if_pf_kif;		/* pf interface abstraction */
+	void	*if_pf_groups;		/* pf interface groups */
+	/*
+	 * During an ifnet's lifetime, it has only one if_index, but
+	 * and if_index is not sufficient to identify an ifnet
+	 * because during the lifetime of the system, many ifnets may occupy a
+	 * given if_index.  Let us tell different ifnets at the same
+	 * if_index apart by their if_index_gen, a unique number that each ifnet
+	 * is assigned when it if_attach()s.  Now, the kernel can use the
+	 * pair (if_index, if_index_gen) as a weak reference to an ifnet.
+	 */
+	uint64_t if_index_gen;		/* generation number for the ifnet
+					 * at if_index: if two ifnets' index
+					 * and generation number are both the
+					 * same, they are the same ifnet.
+					 */
+	struct sysctllog	*if_sysctl_log;
+	int (*if_initaddr)(struct ifnet *, struct ifaddr *, bool);
+	int (*if_mcastop)(struct ifnet *, const unsigned long,
+	    const struct sockaddr *);
+	int (*if_setflags)(struct ifnet *, const short);
+	struct ifnet_lock *if_ioctl_lock;
+#ifdef _KERNEL /* XXX kvm(3) */
+	struct callout *if_slowtimo_ch;
+#endif
+#ifdef GATEWAY
+	struct kmutex	*if_afdata_lock;
+#else
+	struct krwlock	*if_afdata_lock;
+#endif
+} ifnet_t;
+ 
+#define	if_mtu		if_data.ifi_mtu
+#define	if_type		if_data.ifi_type
+#define	if_addrlen	if_data.ifi_addrlen
+#define	if_hdrlen	if_data.ifi_hdrlen
+#define	if_metric	if_data.ifi_metric
+#define	if_link_state	if_data.ifi_link_state
+#define	if_baudrate	if_data.ifi_baudrate
+#define	if_ipackets	if_data.ifi_ipackets
+#define	if_ierrors	if_data.ifi_ierrors
+#define	if_opackets	if_data.ifi_opackets
+#define	if_oerrors	if_data.ifi_oerrors
+#define	if_collisions	if_data.ifi_collisions
+#define	if_ibytes	if_data.ifi_ibytes
+#define	if_obytes	if_data.ifi_obytes
+#define	if_imcasts	if_data.ifi_imcasts
+#define	if_omcasts	if_data.ifi_omcasts
+#define	if_iqdrops	if_data.ifi_iqdrops
+#define	if_noproto	if_data.ifi_noproto
+#define	if_lastchange	if_data.ifi_lastchange
+
+#define	IFF_UP		0x0001		/* interface is up */
+#define	IFF_BROADCAST	0x0002		/* broadcast address valid */
+#define	IFF_DEBUG	0x0004		/* turn on debugging */
+#define	IFF_LOOPBACK	0x0008		/* is a loopback net */
+#define	IFF_POINTOPOINT	0x0010		/* interface is point-to-point link */
+#define	IFF_NOTRAILERS	0x0020		/* avoid use of trailers */
+#define	IFF_RUNNING	0x0040		/* resources allocated */
+#define	IFF_NOARP	0x0080		/* no address resolution protocol */
+#define	IFF_PROMISC	0x0100		/* receive all packets */
+#define	IFF_ALLMULTI	0x0200		/* receive all multicast packets */
+#define	IFF_OACTIVE	0x0400		/* transmission in progress */
+#define	IFF_SIMPLEX	0x0800		/* can't hear own transmissions */
+#define	IFF_LINK0	0x1000		/* per link layer defined bit */
+#define	IFF_LINK1	0x2000		/* per link layer defined bit */
+#define	IFF_LINK2	0x4000		/* per link layer defined bit */
+#define	IFF_MULTICAST	0x8000		/* supports multicast */
+
+#define	IFFBITS \
+    "\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS" \
+    "\7RUNNING\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX" \
+    "\15LINK0\16LINK1\17LINK2\20MULTICAST"
+
+/* flags set internally only: */
+#define	IFF_CANTCHANGE \
+	(IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\
+	    IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_PROMISC)
+
+/*
+ * Some convenience macros used for setting ifi_baudrate.
+ */
+#define	IF_Kbps(x)	((x) * 1000ULL)			/* kilobits/sec. */
+#define	IF_Mbps(x)	(IF_Kbps((x) * 1000ULL))	/* megabits/sec. */
+#define	IF_Gbps(x)	(IF_Mbps((x) * 1000ULL))	/* gigabits/sec. */
+
+/* Capabilities that interfaces can advertise. */
+					/* 0x01 .. 0x40 were previously used */
+#define	IFCAP_TSOv4		0x00080	/* can do TCPv4 segmentation offload */
+#define	IFCAP_CSUM_IPv4_Rx	0x00100	/* can do IPv4 header checksums (Rx) */
+#define	IFCAP_CSUM_IPv4_Tx	0x00200	/* can do IPv4 header checksums (Tx) */
+#define	IFCAP_CSUM_TCPv4_Rx	0x00400	/* can do IPv4/TCP checksums (Rx) */
+#define	IFCAP_CSUM_TCPv4_Tx	0x00800	/* can do IPv4/TCP checksums (Tx) */
+#define	IFCAP_CSUM_UDPv4_Rx	0x01000	/* can do IPv4/UDP checksums (Rx) */
+#define	IFCAP_CSUM_UDPv4_Tx	0x02000	/* can do IPv4/UDP checksums (Tx) */
+#define	IFCAP_CSUM_TCPv6_Rx	0x04000	/* can do IPv6/TCP checksums (Rx) */
+#define	IFCAP_CSUM_TCPv6_Tx	0x08000	/* can do IPv6/TCP checksums (Tx) */
+#define	IFCAP_CSUM_UDPv6_Rx	0x10000	/* can do IPv6/UDP checksums (Rx) */
+#define	IFCAP_CSUM_UDPv6_Tx	0x20000	/* can do IPv6/UDP checksums (Tx) */
+#define	IFCAP_TSOv6		0x40000	/* can do TCPv6 segmentation offload */
+#define	IFCAP_LRO		0x80000	/* can do Large Receive Offload */
+#define	IFCAP_MASK		0xfff80 /* currently valid capabilities */
+
+#define	IFCAPBITS		\
+	"\020"			\
+	"\10TSO4"		\
+	"\11IP4CSUM_Rx"		\
+	"\12IP4CSUM_Tx"		\
+	"\13TCP4CSUM_Rx"	\
+	"\14TCP4CSUM_Tx"	\
+	"\15UDP4CSUM_Rx"	\
+	"\16UDP4CSUM_Tx"	\
+	"\17TCP6CSUM_Rx"	\
+	"\20TCP6CSUM_Tx"	\
+	"\21UDP6CSUM_Rx"	\
+	"\22UDP6CSUM_Tx"	\
+	"\23TSO6"		\
+	"\24LRO"		\
+
+#ifdef GATEWAY
+#define	IF_AFDATA_LOCK_INIT(ifp)	\
+	do { \
+		(ifp)->if_afdata_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NET); \
+	} while (0)
+
+#define	IF_AFDATA_WLOCK(ifp)	mutex_enter((ifp)->if_afdata_lock)
+#define	IF_AFDATA_RLOCK(ifp)	mutex_enter((ifp)->if_afdata_lock)
+#define	IF_AFDATA_WUNLOCK(ifp)	mutex_exit((ifp)->if_afdata_lock)
+#define	IF_AFDATA_RUNLOCK(ifp)	mutex_exit((ifp)->if_afdata_lock)
+#define	IF_AFDATA_LOCK(ifp)	IF_AFDATA_WLOCK(ifp)
+#define	IF_AFDATA_UNLOCK(ifp)	IF_AFDATA_WUNLOCK(ifp)
+#define	IF_AFDATA_TRYLOCK(ifp)	mutex_tryenter((ifp)->if_afdata_lock)
+#define	IF_AFDATA_DESTROY(ifp)	mutex_destroy((ifp)->if_afdata_lock)
+
+#define	IF_AFDATA_LOCK_ASSERT(ifp)	\
+	KASSERT(mutex_owned((ifp)->if_afdata_lock))
+#define	IF_AFDATA_RLOCK_ASSERT(ifp)	\
+	KASSERT(mutex_owned((ifp)->if_afdata_lock))
+#define	IF_AFDATA_WLOCK_ASSERT(ifp)	\
+	KASSERT(mutex_owned((ifp)->if_afdata_lock))
+#define	IF_AFDATA_UNLOCK_ASSERT(ifp)	\
+	KASSERT(!mutex_owned((ifp)->if_afdata_lock))
+
+#else /* GATEWAY */
+#define	IF_AFDATA_LOCK_INIT(ifp)	\
+	do {(ifp)->if_afdata_lock = rw_obj_alloc();} while (0)
+
+#define	IF_AFDATA_WLOCK(ifp)	rw_enter((ifp)->if_afdata_lock, RW_WRITER)
+#define	IF_AFDATA_RLOCK(ifp)	rw_enter((ifp)->if_afdata_lock, RW_READER)
+#define	IF_AFDATA_WUNLOCK(ifp)	rw_exit((ifp)->if_afdata_lock)
+#define	IF_AFDATA_RUNLOCK(ifp)	rw_exit((ifp)->if_afdata_lock)
+#define	IF_AFDATA_LOCK(ifp)	IF_AFDATA_WLOCK(ifp)
+#define	IF_AFDATA_UNLOCK(ifp)	IF_AFDATA_WUNLOCK(ifp)
+#define	IF_AFDATA_TRYLOCK(ifp)	rw_tryenter((ifp)->if_afdata_lock, RW_WRITER)
+#define	IF_AFDATA_DESTROY(ifp)	rw_destroy((ifp)->if_afdata_lock)
+
+#define	IF_AFDATA_LOCK_ASSERT(ifp)	\
+	KASSERT(rw_lock_held((ifp)->if_afdata_lock))
+#define	IF_AFDATA_RLOCK_ASSERT(ifp)	\
+	KASSERT(rw_read_held((ifp)->if_afdata_lock))
+#define	IF_AFDATA_WLOCK_ASSERT(ifp)	\
+	KASSERT(rw_write_held((ifp)->if_afdata_lock))
+#define	IF_AFDATA_UNLOCK_ASSERT(ifp)	\
+	KASSERT(!rw_lock_held((ifp)->if_afdata_lock))
+#endif /* GATEWAY */
+
+#define IFQ_LOCK(_ifq)		if ((_ifq)->ifq_lock) mutex_enter((_ifq)->ifq_lock)
+#define IFQ_UNLOCK(_ifq)	if ((_ifq)->ifq_lock) mutex_exit((_ifq)->ifq_lock)
+
+/*
+ * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
+ * input routines have queues of messages stored on ifqueue structures
+ * (defined above).  Entries are added to and deleted from these structures
+ * by these macros, which should be called with ipl raised to splnet().
+ */
+#define	IF_QFULL(ifq)		((ifq)->ifq_len >= (ifq)->ifq_maxlen)
+#define	IF_DROP(ifq)		((ifq)->ifq_drops++)
+#define	IF_ENQUEUE(ifq, m) do { \
+	(m)->m_nextpkt = 0; \
+	if ((ifq)->ifq_tail == 0) \
+		(ifq)->ifq_head = m; \
+	else \
+		(ifq)->ifq_tail->m_nextpkt = m; \
+	(ifq)->ifq_tail = m; \
+	(ifq)->ifq_len++; \
+} while (/*CONSTCOND*/0)
+#define	IF_PREPEND(ifq, m) do { \
+	(m)->m_nextpkt = (ifq)->ifq_head; \
+	if ((ifq)->ifq_tail == 0) \
+		(ifq)->ifq_tail = (m); \
+	(ifq)->ifq_head = (m); \
+	(ifq)->ifq_len++; \
+} while (/*CONSTCOND*/0)
+#define	IF_DEQUEUE(ifq, m) do { \
+	(m) = (ifq)->ifq_head; \
+	if (m) { \
+		if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \
+			(ifq)->ifq_tail = 0; \
+		(m)->m_nextpkt = 0; \
+		(ifq)->ifq_len--; \
+	} \
+} while (/*CONSTCOND*/0) 
+#define	IF_POLL(ifq, m)		((m) = (ifq)->ifq_head)
+#define	IF_PURGE(ifq)							\
+do {									\
+	struct mbuf *__m0;						\
+									\
+	for (;;) {							\
+		IF_DEQUEUE((ifq), __m0);				\
+		if (__m0 == NULL)					\
+			break;						\
+		else							\
+			m_freem(__m0);					\
+	}								\
+} while (/*CONSTCOND*/ 0)
+#define	IF_IS_EMPTY(ifq)	((ifq)->ifq_len == 0)
+
+#ifndef IFQ_MAXLEN
+#define	IFQ_MAXLEN	256
+#endif
+#define	IFNET_SLOWHZ	1		/* granularity is 1 second */
+
+/*
+ * Structure defining statistics and other data kept regarding an address
+ * on a network interface.
+ */
+struct ifaddr_data {
+	int64_t	ifad_inbytes;
+	int64_t	ifad_outbytes;
+};
+
+/*
+ * The ifaddr structure contains information about one address
+ * of an interface.  They are maintained by the different address families,
+ * are allocated and attached when an address is set, and are linked
+ * together so all addresses for an interface can be located.
+ */
+struct ifaddr {
+	struct	sockaddr *ifa_addr;	/* address of interface */
+	struct	sockaddr *ifa_dstaddr;	/* other end of p-to-p link */
+#define	ifa_broadaddr	ifa_dstaddr	/* broadcast address interface */
+	struct	sockaddr *ifa_netmask;	/* used to determine subnet */
+	struct	ifnet *ifa_ifp;		/* back-pointer to interface */
+	TAILQ_ENTRY(ifaddr) ifa_list;	/* list of addresses for interface */
+	struct	ifaddr_data	ifa_data;	/* statistics on the address */
+	void	(*ifa_rtrequest)	/* check or clean routes (+ or -)'d */
+		        (int, struct rtentry *, const struct rt_addrinfo *);
+	u_int	ifa_flags;		/* mostly rt_flags for cloning */
+	int	ifa_refcnt;		/* count of references */
+	int	ifa_metric;		/* cost of going out this interface */
+	struct ifaddr	*(*ifa_getifa)(struct ifaddr *,
+			               const struct sockaddr *);
+	uint32_t	*ifa_seqno;
+	int16_t	ifa_preference;	/* preference level for this address */
+};
+#define	IFA_ROUTE	RTF_UP	/* (0x01) route installed */
+
+/*
+ * Message format for use in obtaining information about interfaces from
+ * sysctl and the routing socket.  We need to force 64-bit alignment if we
+ * aren't using compatiblity definitons.
+ */
+#if !defined(_KERNEL) || !defined(COMPAT_RTSOCK)
+#define	__align64	__aligned(sizeof(uint64_t))
+#else
+#define	__align64
+#endif
+struct if_msghdr {
+	u_short	ifm_msglen __align64;
+				/* to skip over non-understood messages */
+	u_char	ifm_version;	/* future binary compatibility */
+	u_char	ifm_type;	/* message type */
+	int	ifm_addrs;	/* like rtm_addrs */
+	int	ifm_flags;	/* value of if_flags */
+	u_short	ifm_index;	/* index for associated ifp */
+	struct	if_data ifm_data __align64;
+				/* statistics and other data about if */
+};
+
+/*
+ * Message format for use in obtaining information about interface addresses
+ * from sysctl and the routing socket.
+ */
+struct ifa_msghdr {
+	u_short	ifam_msglen __align64;
+				/* to skip over non-understood messages */
+	u_char	ifam_version;	/* future binary compatibility */
+	u_char	ifam_type;	/* message type */
+	int	ifam_addrs;	/* like rtm_addrs */
+	int	ifam_flags;	/* value of ifa_flags */
+	int	ifam_metric;	/* value of ifa_metric */
+	u_short	ifam_index;	/* index for associated ifp */
+};
+
+/*
+ * Message format announcing the arrival or departure of a network interface.
+ */
+struct if_announcemsghdr {
+	u_short	ifan_msglen __align64;
+				/* to skip over non-understood messages */
+	u_char	ifan_version;	/* future binary compatibility */
+	u_char	ifan_type;	/* message type */
+	u_short	ifan_index;	/* index for associated ifp */
+	char	ifan_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+	u_short	ifan_what;	/* what type of announcement */
+};
+
+#define	IFAN_ARRIVAL	0	/* interface arrival */
+#define	IFAN_DEPARTURE	1	/* interface departure */
+
+#undef __align64
+
+/*
+ * Interface request structure used for socket
+ * ioctl's.  All interface ioctl's must have parameter
+ * definitions which begin with ifr_name.  The
+ * remainder may be interface specific.
+ */
+struct	ifreq {
+	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
+	union {
+		struct	sockaddr ifru_addr;
+		struct	sockaddr ifru_dstaddr;
+		struct	sockaddr ifru_broadaddr;
+		struct	sockaddr_storage ifru_space;
+		short	ifru_flags;
+		int	ifru_addrflags;
+		int	ifru_metric;
+		int	ifru_mtu;
+		int	ifru_dlt;
+		u_int	ifru_value;
+		void *	ifru_data;
+		struct {
+			uint32_t	b_buflen;
+			void		*b_buf;
+		} ifru_b;
+	} ifr_ifru;
+#define	ifr_addr	ifr_ifru.ifru_addr	/* address */
+#define	ifr_dstaddr	ifr_ifru.ifru_dstaddr	/* other end of p-to-p link */
+#define	ifr_broadaddr	ifr_ifru.ifru_broadaddr	/* broadcast address */
+#define	ifr_space	ifr_ifru.ifru_space	/* sockaddr_storage */
+#define	ifr_flags	ifr_ifru.ifru_flags	/* flags */
+#define	ifr_addrflags	ifr_ifru.ifru_addrflags	/* addr flags */
+#define	ifr_metric	ifr_ifru.ifru_metric	/* metric */
+#define	ifr_mtu		ifr_ifru.ifru_mtu	/* mtu */
+#define	ifr_dlt		ifr_ifru.ifru_dlt	/* data link type (DLT_*) */
+#define	ifr_value	ifr_ifru.ifru_value	/* generic value */
+#define	ifr_media	ifr_ifru.ifru_metric	/* media options (overload) */
+#define	ifr_data	ifr_ifru.ifru_data	/* for use by interface
+						 * XXX deprecated
+						 */
+#define	ifr_buf		ifr_ifru.ifru_b.b_buf	/* new interface ioctls */
+#define	ifr_buflen	ifr_ifru.ifru_b.b_buflen
+#define	ifr_index	ifr_ifru.ifru_value	/* interface index, BSD */
+#define	ifr_ifindex	ifr_index		/* interface index, linux */
+};
+
+#ifdef _KERNEL
+#define	ifreq_setdstaddr	ifreq_setaddr
+#define	ifreq_setbroadaddr	ifreq_setaddr
+#define	ifreq_getdstaddr	ifreq_getaddr
+#define	ifreq_getbroadaddr	ifreq_getaddr
+
+static inline const struct sockaddr *
+/*ARGSUSED*/
+ifreq_getaddr(u_long cmd, const struct ifreq *ifr)
+{
+	return &ifr->ifr_addr;
+}
+#endif /* _KERNEL */
+
+struct ifcapreq {
+	char		ifcr_name[IFNAMSIZ];	/* if name, e.g. "en0" */
+	uint64_t	ifcr_capabilities;	/* supported capabiliites */
+	uint64_t	ifcr_capenable;		/* capabilities enabled */
+};
+
+struct ifaliasreq {
+	char	ifra_name[IFNAMSIZ];		/* if name, e.g. "en0" */
+	struct	sockaddr ifra_addr;
+	struct	sockaddr ifra_dstaddr;
+#define	ifra_broadaddr	ifra_dstaddr
+	struct	sockaddr ifra_mask;
+};
+
+struct ifdatareq {
+	char	ifdr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
+	struct	if_data ifdr_data;
+};
+
+struct ifmediareq {
+	char	ifm_name[IFNAMSIZ];		/* if name, e.g. "en0" */
+	int	ifm_current;			/* current media options */
+	int	ifm_mask;			/* don't care mask */
+	int	ifm_status;			/* media status */
+	int	ifm_active;			/* active options */
+	int	ifm_count;			/* # entries in ifm_ulist
+						   array */
+	int	*ifm_ulist;			/* media words */
+};
+
+
+struct  ifdrv {
+	char		ifd_name[IFNAMSIZ];	/* if name, e.g. "en0" */
+	unsigned long	ifd_cmd;
+	size_t		ifd_len;
+	void		*ifd_data;
+};
+#define IFLINKSTR_QUERYLEN	0x01
+#define IFLINKSTR_UNSET		0x02
+
+/*
+ * Structure used in SIOCGIFCONF request.
+ * Used to retrieve interface configuration
+ * for machine (useful for programs which
+ * must know all networks accessible).
+ */
+struct	ifconf {
+	int	ifc_len;		/* size of associated buffer */
+	union {
+		void *	ifcu_buf;
+		struct	ifreq *ifcu_req;
+	} ifc_ifcu;
+#define	ifc_buf	ifc_ifcu.ifcu_buf	/* buffer address */
+#define	ifc_req	ifc_ifcu.ifcu_req	/* array of structures returned */
+};
+
+/*
+ * Structure for SIOC[AGD]LIFADDR
+ */
+struct if_laddrreq {
+	char iflr_name[IFNAMSIZ];
+	unsigned int flags;
+#define IFLR_PREFIX	0x8000	/* in: prefix given  out: kernel fills id */
+#define IFLR_ACTIVE	0x4000	/* in/out: link-layer address activation */
+#define IFLR_FACTORY	0x2000	/* in/out: factory link-layer address */
+	unsigned int prefixlen;		/* in/out */
+	struct sockaddr_storage addr;	/* in/out */
+	struct sockaddr_storage dstaddr; /* out */
+};
+
+/*
+ * Structure for SIOC[SG]IFADDRPREF
+ */
+struct if_addrprefreq {
+	char			ifap_name[IFNAMSIZ];
+	int16_t			ifap_preference;	/* in/out */
+	struct sockaddr_storage	ifap_addr;		/* in/out */
+};
+
+#include <net/if_arp.h>
+
+#endif /* _NETBSD_SOURCE */
+
+#ifdef _KERNEL
+#ifdef ALTQ
+#define	ALTQ_DECL(x)		x
+#define ALTQ_COMMA		,
+
+#define IFQ_ENQUEUE(ifq, m, pattr, err)					\
+do {									\
+	IFQ_LOCK((ifq));						\
+	if (ALTQ_IS_ENABLED((ifq)))					\
+		ALTQ_ENQUEUE((ifq), (m), (pattr), (err));		\
+	else {								\
+		if (IF_QFULL((ifq))) {					\
+			m_freem((m));					\
+			(err) = ENOBUFS;				\
+		} else {						\
+			IF_ENQUEUE((ifq), (m));				\
+			(err) = 0;					\
+		}							\
+	}								\
+	if ((err))							\
+		(ifq)->ifq_drops++;					\
+	IFQ_UNLOCK((ifq));						\
+} while (/*CONSTCOND*/ 0)
+
+#define IFQ_DEQUEUE(ifq, m)						\
+do {									\
+	IFQ_LOCK((ifq));						\
+	if (TBR_IS_ENABLED((ifq)))					\
+		(m) = tbr_dequeue((ifq), ALTDQ_REMOVE);			\
+	else if (ALTQ_IS_ENABLED((ifq)))				\
+		ALTQ_DEQUEUE((ifq), (m));				\
+	else								\
+		IF_DEQUEUE((ifq), (m));					\
+	IFQ_UNLOCK((ifq));						\
+} while (/*CONSTCOND*/ 0)
+
+#define	IFQ_POLL(ifq, m)						\
+do {									\
+	IFQ_LOCK((ifq));						\
+	if (TBR_IS_ENABLED((ifq)))					\
+		(m) = tbr_dequeue((ifq), ALTDQ_POLL);			\
+	else if (ALTQ_IS_ENABLED((ifq)))				\
+		ALTQ_POLL((ifq), (m));					\
+	else								\
+		IF_POLL((ifq), (m));					\
+	IFQ_UNLOCK((ifq));						\
+} while (/*CONSTCOND*/ 0)
+
+#define	IFQ_PURGE(ifq)							\
+do {									\
+	IFQ_LOCK((ifq));						\
+	if (ALTQ_IS_ENABLED((ifq)))					\
+		ALTQ_PURGE((ifq));					\
+	else								\
+		IF_PURGE((ifq));					\
+	IFQ_UNLOCK((ifq));						\
+} while (/*CONSTCOND*/ 0)
+
+#define	IFQ_SET_READY(ifq)						\
+do {									\
+	(ifq)->altq_flags |= ALTQF_READY;				\
+} while (/*CONSTCOND*/ 0)
+
+#define	IFQ_CLASSIFY(ifq, m, af, pattr)					\
+do {									\
+	IFQ_LOCK((ifq));						\
+	if (ALTQ_IS_ENABLED((ifq))) {					\
+		if (ALTQ_NEEDS_CLASSIFY((ifq)))				\
+			(pattr)->pattr_class = (*(ifq)->altq_classify)	\
+				((ifq)->altq_clfier, (m), (af));	\
+		(pattr)->pattr_af = (af);				\
+		(pattr)->pattr_hdr = mtod((m), void *);		\
+	}								\
+	IFQ_UNLOCK((ifq));						\
+} while (/*CONSTCOND*/ 0)
+#else /* ! ALTQ */
+#define	ALTQ_DECL(x)		/* nothing */
+#define ALTQ_COMMA
+
+#define	IFQ_ENQUEUE(ifq, m, pattr, err)					\
+do {									\
+	IFQ_LOCK((ifq));						\
+	if (IF_QFULL((ifq))) {						\
+		m_freem((m));						\
+		(err) = ENOBUFS;					\
+	} else {							\
+		IF_ENQUEUE((ifq), (m));					\
+		(err) = 0;						\
+	}								\
+	if ((err))							\
+		(ifq)->ifq_drops++;					\
+	IFQ_UNLOCK((ifq));						\
+} while (/*CONSTCOND*/ 0)
+
+#define	IFQ_DEQUEUE(ifq, m)						\
+do {									\
+	IFQ_LOCK((ifq));						\
+	IF_DEQUEUE((ifq), (m));						\
+	IFQ_UNLOCK((ifq));						\
+} while (/*CONSTCOND*/ 0)
+
+#define	IFQ_POLL(ifq, m)						\
+do {									\
+	IFQ_LOCK((ifq));						\
+	IF_POLL((ifq), (m));						\
+	IFQ_UNLOCK((ifq));						\
+} while (/*CONSTCOND*/ 0)
+
+#define	IFQ_PURGE(ifq)							\
+do {									\
+	IFQ_LOCK((ifq));						\
+	IF_PURGE((ifq));						\
+	IFQ_UNLOCK((ifq));						\
+} while (/*CONSTCOND*/ 0)
+
+#define	IFQ_SET_READY(ifq)	/* nothing */
+
+#define	IFQ_CLASSIFY(ifq, m, af, pattr) /* nothing */
+
+#endif /* ALTQ */
+
+#define	IFQ_IS_EMPTY(ifq)		IF_IS_EMPTY((ifq))
+#define	IFQ_INC_LEN(ifq)		((ifq)->ifq_len++)
+#define	IFQ_DEC_LEN(ifq)		(--(ifq)->ifq_len)
+#define	IFQ_INC_DROPS(ifq)		((ifq)->ifq_drops++)
+#define	IFQ_SET_MAXLEN(ifq, len)	((ifq)->ifq_maxlen = (len))
+
+#include <sys/mallocvar.h>
+MALLOC_DECLARE(M_IFADDR);
+MALLOC_DECLARE(M_IFMADDR);
+
+int ifreq_setaddr(u_long, struct ifreq *, const struct sockaddr *);
+
+struct ifnet *if_alloc(u_char);
+void if_free(struct ifnet *);
+void if_initname(struct ifnet *, const char *, int);
+struct ifaddr *if_dl_create(const struct ifnet *, const struct sockaddr_dl **);
+void if_activate_sadl(struct ifnet *, struct ifaddr *,
+    const struct sockaddr_dl *);
+void	if_set_sadl(struct ifnet *, const void *, u_char, bool);
+void	if_alloc_sadl(struct ifnet *);
+void	if_initialize(struct ifnet *);
+void	if_register(struct ifnet *);
+void	if_attach(struct ifnet *); /* Deprecated. Use if_initialize and if_register */
+void	if_attachdomain(void);
+void	if_deactivate(struct ifnet *);
+void	if_purgeaddrs(struct ifnet *, int, void (*)(struct ifaddr *));
+void	if_detach(struct ifnet *);
+void	if_down(struct ifnet *);
+void	if_link_state_change(struct ifnet *, int);
+void	if_up(struct ifnet *);
+void	ifinit(void);
+void	ifinit1(void);
+int	ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *);
+extern int (*ifioctl)(struct socket *, u_long, void *, struct lwp *);
+int	ifioctl_common(struct ifnet *, u_long, void *);
+int	ifpromisc(struct ifnet *, int);
+struct	ifnet *ifunit(const char *);
+int	if_addr_init(ifnet_t *, struct ifaddr *, bool);
+int	if_do_dad(struct ifnet *);
+int	if_mcast_op(ifnet_t *, const unsigned long, const struct sockaddr *);
+int	if_flags_set(struct ifnet *, const short);
+int	if_clone_list(int, char *, int *);
+
+void ifa_insert(struct ifnet *, struct ifaddr *);
+void ifa_remove(struct ifnet *, struct ifaddr *);
+
+void	ifaref(struct ifaddr *);
+void	ifafree(struct ifaddr *);
+
+struct	ifaddr *ifa_ifwithaddr(const struct sockaddr *);
+struct	ifaddr *ifa_ifwithaf(int);
+struct	ifaddr *ifa_ifwithdstaddr(const struct sockaddr *);
+struct	ifaddr *ifa_ifwithnet(const struct sockaddr *);
+struct	ifaddr *ifa_ifwithladdr(const struct sockaddr *);
+struct	ifaddr *ifa_ifwithroute(int, const struct sockaddr *,
+					const struct sockaddr *);
+struct	ifaddr *ifaof_ifpforaddr(const struct sockaddr *, struct ifnet *);
+void	ifafree(struct ifaddr *);
+void	link_rtrequest(int, struct rtentry *, const struct rt_addrinfo *);
+void	p2p_rtrequest(int, struct rtentry *, const struct rt_addrinfo *);
+
+void	if_clone_attach(struct if_clone *);
+void	if_clone_detach(struct if_clone *);
+
+int	ifq_enqueue(struct ifnet *, struct mbuf * ALTQ_COMMA
+    ALTQ_DECL(struct altq_pktattr *));
+int	ifq_enqueue2(struct ifnet *, struct ifqueue *, struct mbuf * ALTQ_COMMA
+    ALTQ_DECL(struct altq_pktattr *));
+
+int	loioctl(struct ifnet *, u_long, void *);
+void	loopattach(int);
+int	looutput(struct ifnet *,
+	   struct mbuf *, const struct sockaddr *, struct rtentry *);
+void	lortrequest(int, struct rtentry *, const struct rt_addrinfo *);
+
+/*
+ * These are exported because they're an easy way to tell if
+ * an interface is going away without having to burn a flag.
+ */
+int	if_nulloutput(struct ifnet *, struct mbuf *,
+	    const struct sockaddr *, struct rtentry *);
+void	if_nullinput(struct ifnet *, struct mbuf *);
+void	if_nullstart(struct ifnet *);
+int	if_nullioctl(struct ifnet *, u_long, void *);
+int	if_nullinit(struct ifnet *);
+void	if_nullstop(struct ifnet *, int);
+void	if_nullslowtimo(struct ifnet *);
+#define	if_nullwatchdog	if_nullslowtimo
+void	if_nulldrain(struct ifnet *);
+#else
+struct if_nameindex {
+	unsigned int	if_index;	/* 1, 2, ... */
+	char		*if_name;	/* null terminated name: "le0", ... */
+};
+
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+unsigned int if_nametoindex(const char *);
+char *	if_indextoname(unsigned int, char *);
+struct	if_nameindex * if_nameindex(void);
+void	if_freenameindex(struct if_nameindex *);
+__END_DECLS
+#endif /* _KERNEL */ /* XXX really ALTQ? */
+
+#ifdef _KERNEL
+
+#define	IFNET_FIRST()			TAILQ_FIRST(&ifnet_list)
+#define	IFNET_EMPTY()			TAILQ_EMPTY(&ifnet_list)
+#define	IFNET_NEXT(__ifp)		TAILQ_NEXT((__ifp), if_list)
+#define	IFNET_FOREACH(__ifp)		TAILQ_FOREACH(__ifp, &ifnet_list, if_list)
+#define	IFADDR_FIRST(__ifp)		TAILQ_FIRST(&(__ifp)->if_addrlist)
+#define	IFADDR_NEXT(__ifa)		TAILQ_NEXT((__ifa), ifa_list)
+#define	IFADDR_FOREACH(__ifa, __ifp)	TAILQ_FOREACH(__ifa, \
+					    &(__ifp)->if_addrlist, ifa_list)
+#define	IFADDR_FOREACH_SAFE(__ifa, __ifp, __nifa) \
+					    TAILQ_FOREACH_SAFE(__ifa, \
+					    &(__ifp)->if_addrlist, ifa_list, __nifa)
+#define	IFADDR_EMPTY(__ifp)		TAILQ_EMPTY(&(__ifp)->if_addrlist)
+
+extern struct ifnet_head ifnet_list;
+extern struct ifnet *lo0ifp;
+
+ifnet_t *	if_byindex(u_int);
+
+/*
+ * ifq sysctl support
+ */
+int	sysctl_ifq(int *name, u_int namelen, void *oldp,
+		       size_t *oldlenp, void *newp, size_t newlen,
+		       struct ifqueue *ifq);
+/* symbolic names for terminal (per-protocol) CTL_IFQ_ nodes */
+#define IFQCTL_LEN 1
+#define IFQCTL_MAXLEN 2
+#define IFQCTL_PEAK 3
+#define IFQCTL_DROPS 4
+#define IFQCTL_MAXID 5
+
+#endif /* _KERNEL */
+
+#ifdef _NETBSD_SOURCE
+/*
+ * sysctl for ifq (per-protocol packet input queue variant of ifqueue)
+ */
+#define CTL_IFQ_NAMES  { \
+	{ 0, 0 }, \
+	{ "len", CTLTYPE_INT }, \
+	{ "maxlen", CTLTYPE_INT }, \
+	{ "peak", CTLTYPE_INT }, \
+	{ "drops", CTLTYPE_INT }, \
+}
+#endif /* _NETBSD_SOURCE */
+#endif /* !_NET_IF_H_ */

Property changes on: lab4/.minix-src/include/net/if.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/if_ieee1394.h
===================================================================
--- lab4/.minix-src/include/net/if_ieee1394.h	(nonexistent)
+++ lab4/.minix-src/include/net/if_ieee1394.h	(revision 13)
@@ -0,0 +1,120 @@
+/*	$NetBSD: if_ieee1394.h,v 1.9 2008/04/28 20:24:09 martin Exp $	*/
+
+/*
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Atsushi Onoe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _NET_IF_IEEE1394_H_
+#define _NET_IF_IEEE1394_H_
+
+/* hardware address information for arp / nd */
+struct ieee1394_hwaddr {
+	uint8_t	iha_uid[8];		/* node unique ID */
+	uint8_t	iha_maxrec;		/* max_rec in the config ROM */
+	uint8_t	iha_speed;		/* min of link/PHY speed */
+	uint8_t	iha_offset[6];		/* unicast FIFO address */
+};
+
+/*
+ * BPF wants to see one of these.
+ */
+struct ieee1394_bpfhdr {
+	uint8_t		ibh_dhost[8];
+	uint8_t		ibh_shost[8];
+	uint16_t	ibh_type;
+};
+
+#ifdef _KERNEL
+
+/* pseudo header */
+struct ieee1394_header {
+	uint8_t	ih_uid[8];		/* dst/src uid */
+	uint8_t	ih_maxrec;		/* dst maxrec for tx */
+	uint8_t	ih_speed;		/* speed */
+	uint8_t	ih_offset[6];		/* dst offset */
+};
+
+/* unfragment encapsulation header */
+struct ieee1394_unfraghdr {
+	uint16_t	iuh_ft;			/* fragment type == 0 */
+	uint16_t	iuh_etype;		/* ether_type */
+};
+
+/* fragmented encapsulation header */
+struct ieee1394_fraghdr {
+	uint16_t	ifh_ft_size;		/* fragment type, data size-1 */
+	uint16_t	ifh_etype_off;		/* etype for first fragment */
+						/* offset for subseq frag */
+	uint16_t	ifh_dgl;		/* datagram label */
+	uint16_t	ifh_reserved;
+};
+
+#define	IEEE1394_FT_SUBSEQ	0x8000
+#define	IEEE1394_FT_MORE	0x4000
+
+#define	IEEE1394MTU		1500
+
+#define	IEEE1394_GASP_LEN	8		/* GASP header for Stream */
+#define	IEEE1394_ADDR_LEN	8
+#define	IEEE1394_CRC_LEN	4
+
+struct ieee1394_reass_pkt {
+	LIST_ENTRY(ieee1394_reass_pkt) rp_next;
+	struct mbuf	*rp_m;
+	uint16_t	rp_size;
+	uint16_t	rp_etype;
+	uint16_t	rp_off;
+	uint16_t	rp_dgl;
+	uint16_t	rp_len;
+	uint16_t	rp_ttl;
+};
+
+struct ieee1394_reassq {
+	LIST_ENTRY(ieee1394_reassq) rq_node;
+	LIST_HEAD(, ieee1394_reass_pkt) rq_pkt;
+	uint32_t	fr_id;
+};
+
+struct ieee1394com {
+	struct ifnet	fc_if;
+	struct ieee1394_hwaddr ic_hwaddr;
+	uint16_t	ic_dgl;
+	LIST_HEAD(, ieee1394_reassq) ic_reassq;
+};
+
+const char *ieee1394_sprintf(const uint8_t *);
+void ieee1394_input(struct ifnet *, struct mbuf *, uint16_t);
+void ieee1394_ifattach(struct ifnet *, const struct ieee1394_hwaddr *);
+void ieee1394_ifdetach(struct ifnet *);
+int  ieee1394_ioctl(struct ifnet *, u_long, void *);
+struct mbuf * ieee1394_fragment(struct ifnet *, struct mbuf *, int, uint16_t);
+void ieee1394_drain(struct ifnet *);
+void ieee1394_watchdog(struct ifnet *);
+#endif /* _KERNEL */
+
+#endif /* !_NET_IF_IEEE1394_H_ */

Property changes on: lab4/.minix-src/include/net/if_ieee1394.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/netlib.h
===================================================================
--- lab4/.minix-src/include/net/netlib.h	(nonexistent)
+++ lab4/.minix-src/include/net/netlib.h	(revision 13)
@@ -0,0 +1,15 @@
+/*
+net/netlib.h
+*/
+
+#ifndef _NET__NETLIB_H_
+#define _NET__NETLIB_H_
+
+#define IPSTAT_DEVICE	"/dev/ipstat"
+#define ETH_DEVICE	"/dev/eth"
+#define IP_DEVICE	"/dev/ip"
+#define TCP_DEVICE	"/dev/tcp"
+#define UDP_DEVICE	"/dev/udp"
+#define UDS_DEVICE	"/dev/uds"
+
+#endif /* _NET__NETLIB_H_ */

Property changes on: lab4/.minix-src/include/net/netlib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/radix.h
===================================================================
--- lab4/.minix-src/include/net/radix.h	(nonexistent)
+++ lab4/.minix-src/include/net/radix.h	(revision 13)
@@ -0,0 +1,157 @@
+/*	$NetBSD: radix.h,v 1.22 2009/05/27 17:46:50 pooka Exp $	*/
+
+/*
+ * Copyright (c) 1988, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)radix.h	8.2 (Berkeley) 10/31/94
+ */
+
+#ifndef _NET_RADIX_H_
+#define	_NET_RADIX_H_
+
+/*
+ * Radix search tree node layout.
+ */
+
+struct radix_node {
+	struct	radix_mask *rn_mklist;	/* list of masks contained in subtree */
+	struct	radix_node *rn_p;	/* parent */
+	short	rn_b;			/* bit offset; -1-index(netmask) */
+	char	rn_bmask;		/* node: mask for bit test*/
+	u_char	rn_flags;		/* enumerated next */
+#define RNF_NORMAL	1		/* leaf contains normal route */
+#define RNF_ROOT	2		/* leaf is root leaf for tree */
+#define RNF_ACTIVE	4		/* This node is alive (for rtfree) */
+	union {
+		struct {			/* leaf only data: */
+			const char *rn_Key;	/* object of search */
+			const char *rn_Mask;	/* netmask, if present */
+			struct	radix_node *rn_Dupedkey;
+		} rn_leaf;
+		struct {			/* node only data: */
+			int	rn_Off;		/* where to start compare */
+			struct	radix_node *rn_L;/* progeny */
+			struct	radix_node *rn_R;/* progeny */
+		} rn_node;
+	} rn_u;
+#ifdef RN_DEBUG
+	int rn_info;
+	struct radix_node *rn_twin;
+	struct radix_node *rn_ybro;
+#endif
+};
+
+#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey
+#define rn_key rn_u.rn_leaf.rn_Key
+#define rn_mask rn_u.rn_leaf.rn_Mask
+#define rn_off rn_u.rn_node.rn_Off
+#define rn_l rn_u.rn_node.rn_L
+#define rn_r rn_u.rn_node.rn_R
+
+/*
+ * Annotations to tree concerning potential routes applying to subtrees.
+ */
+
+struct radix_mask {
+	short	rm_b;			/* bit offset; -1-index(netmask) */
+	char	rm_unused;		/* cf. rn_bmask */
+	u_char	rm_flags;		/* cf. rn_flags */
+	struct	radix_mask *rm_mklist;	/* more masks to try */
+	union	{
+		const char *rmu_mask;		/* the mask */
+		struct	radix_node *rmu_leaf;	/* for normal routes */
+	}	rm_rmu;
+	int	rm_refs;		/* # of references to this struct */
+};
+
+#define rm_mask rm_rmu.rmu_mask
+#define rm_leaf rm_rmu.rmu_leaf		/* extra field would make 32 bytes */
+
+#define MKGet(m) {\
+	if (rn_mkfreelist) {\
+		m = rn_mkfreelist; \
+		rn_mkfreelist = (m)->rm_mklist; \
+	} else \
+		R_Malloc(m, struct radix_mask *, sizeof (*(m))); }\
+
+#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);}
+
+struct radix_node_head {
+	struct	radix_node *rnh_treetop;
+	int	rnh_addrsize;		/* permit, but not require fixed keys */
+	int	rnh_pktsize;		/* permit, but not require fixed keys */
+	struct	radix_node *(*rnh_addaddr)	/* add based on sockaddr */
+		(const void *v, const void *mask,
+		     struct radix_node_head *head, struct radix_node nodes[]);
+	struct	radix_node *(*rnh_addpkt)	/* add based on packet hdr */
+		(const void *v, const void *mask,
+		     struct radix_node_head *head, struct radix_node nodes[]);
+	struct	radix_node *(*rnh_deladdr)	/* remove based on sockaddr */
+		(const void *v, const void *mask, struct radix_node_head *head);
+	struct	radix_node *(*rnh_delpkt)	/* remove based on packet hdr */
+		(const void *v, const void *mask, struct radix_node_head *head);
+	struct	radix_node *(*rnh_matchaddr)	/* locate based on sockaddr */
+		(const void *v, struct radix_node_head *head);
+	struct	radix_node *(*rnh_lookup)	/* locate based on sockaddr */
+		(const void *v, const void *mask, struct radix_node_head *head);
+	struct	radix_node *(*rnh_matchpkt)	/* locate based on packet hdr */
+		(const void *v, struct radix_node_head *head);
+	struct	radix_node rnh_nodes[3];	/* empty tree for common case */
+};
+
+#ifdef _KERNEL
+extern struct radix_mask *rn_mkfreelist;
+
+#define R_Malloc(p, t, n) (p = (t) malloc((size_t)(n), M_RTABLE, M_NOWAIT))
+#define Free(p) free(p, M_RTABLE);
+#endif /*_KERNEL*/
+
+void	rn_init(void);
+int	rn_inithead(void **, int);
+void	rn_delayedinit(void **, int);
+int	rn_inithead0(struct radix_node_head *, int);
+int	rn_refines(const void *, const void *);
+int	rn_walktree(struct radix_node_head *,
+	            int (*)(struct radix_node *, void *),
+		    void *);
+struct radix_node
+	 *rn_addmask(const void *, int, int),
+	 *rn_addroute(const void *, const void *, struct radix_node_head *,
+			struct radix_node [2]),
+	 *rn_delete1(const void *, const void *, struct radix_node_head *,
+			struct radix_node *),
+	 *rn_delete(const void *, const void *, struct radix_node_head *),
+	 *rn_insert(const void *, struct radix_node_head *, int *,
+			struct radix_node [2]),
+	 *rn_lookup(const void *, const void *, struct radix_node_head *),
+	 *rn_match(const void *, struct radix_node_head *),
+	 *rn_newpair(const void *, int, struct radix_node[2]),
+	 *rn_search(const void *, struct radix_node *),
+	 *rn_search_m(const void *, struct radix_node *, const void *);
+
+#endif /* !_NET_RADIX_H_ */

Property changes on: lab4/.minix-src/include/net/radix.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/in.h
===================================================================
--- lab4/.minix-src/include/netinet/in.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/in.h	(revision 13)
@@ -0,0 +1,634 @@
+/*	$NetBSD: in.h,v 1.97 2015/05/02 14:41:32 roy Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)in.h	8.3 (Berkeley) 1/3/94
+ */
+
+/*
+ * Constants and structures defined by the internet system,
+ * Per RFC 790, September 1981, and numerous additions.
+ */
+
+#ifndef _NETINET_IN_H_
+#define	_NETINET_IN_H_
+
+#include <sys/featuretest.h>
+#include <machine/int_types.h>
+
+#ifndef uint8_t
+typedef __uint8_t	uint8_t;
+#define	uint8_t		__uint8_t
+#endif
+
+#ifndef uint32_t
+typedef __uint32_t	uint32_t;
+#define	uint32_t	__uint32_t
+#endif
+
+#include <sys/ansi.h>
+
+#ifndef in_addr_t
+typedef __in_addr_t	in_addr_t;
+#define	in_addr_t	__in_addr_t
+#endif
+
+#ifndef in_port_t
+typedef __in_port_t	in_port_t;
+#define	in_port_t	__in_port_t
+#endif
+
+#ifndef sa_family_t
+typedef __sa_family_t	sa_family_t;
+#define	sa_family_t	__sa_family_t
+#endif
+
+/*
+ * Protocols
+ */
+#define	IPPROTO_IP		0		/* dummy for IP */
+#define	IPPROTO_HOPOPTS		0		/* IP6 hop-by-hop options */
+#define	IPPROTO_ICMP		1		/* control message protocol */
+#define	IPPROTO_IGMP		2		/* group mgmt protocol */
+#define	IPPROTO_GGP		3		/* gateway^2 (deprecated) */
+#define	IPPROTO_IPV4		4 		/* IP header */
+#define	IPPROTO_IPIP		4		/* IP inside IP */
+#define	IPPROTO_TCP		6		/* tcp */
+#define	IPPROTO_EGP		8		/* exterior gateway protocol */
+#define	IPPROTO_PUP		12		/* pup */
+#define	IPPROTO_UDP		17		/* user datagram protocol */
+#define	IPPROTO_IDP		22		/* xns idp */
+#define	IPPROTO_TP		29 		/* tp-4 w/ class negotiation */
+#define	IPPROTO_DCCP		33		/* DCCP */
+#define	IPPROTO_IPV6		41		/* IP6 header */
+#define	IPPROTO_ROUTING		43		/* IP6 routing header */
+#define	IPPROTO_FRAGMENT	44		/* IP6 fragmentation header */
+#define	IPPROTO_RSVP		46		/* resource reservation */
+#define	IPPROTO_GRE		47		/* GRE encaps RFC 1701 */
+#define	IPPROTO_ESP		50 		/* encap. security payload */
+#define	IPPROTO_AH		51 		/* authentication header */
+#define	IPPROTO_MOBILE		55		/* IP Mobility RFC 2004 */
+#define	IPPROTO_IPV6_ICMP	58		/* IPv6 ICMP */
+#define	IPPROTO_ICMPV6		58		/* ICMP6 */
+#define	IPPROTO_NONE		59		/* IP6 no next header */
+#define	IPPROTO_DSTOPTS		60		/* IP6 destination option */
+#define	IPPROTO_EON		80		/* ISO cnlp */
+#define	IPPROTO_ETHERIP		97		/* Ethernet-in-IP */
+#define	IPPROTO_ENCAP		98		/* encapsulation header */
+#define	IPPROTO_PIM		103		/* Protocol indep. multicast */
+#define	IPPROTO_IPCOMP		108		/* IP Payload Comp. Protocol */
+#define	IPPROTO_VRRP		112		/* VRRP RFC 2338 */
+#define	IPPROTO_CARP		112		/* Common Address Resolution Protocol */
+#define IPPROTO_PFSYNC      240     /* PFSYNC */
+#define	IPPROTO_RAW		255		/* raw IP packet */
+#define	IPPROTO_MAX		256
+
+/* last return value of *_input(), meaning "all job for this pkt is done".  */
+#define	IPPROTO_DONE		257
+
+/* sysctl placeholder for (FAST_)IPSEC */
+#define CTL_IPPROTO_IPSEC	258
+
+
+/*
+ * Local port number conventions:
+ *
+ * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
+ * unless a kernel is compiled with IPNOPRIVPORTS defined.
+ *
+ * When a user does a bind(2) or connect(2) with a port number of zero,
+ * a non-conflicting local port address is chosen.
+ *
+ * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
+ * that is settable by sysctl(3); net.inet.ip.anonportmin and
+ * net.inet.ip.anonportmax respectively.
+ *
+ * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
+ * default assignment range.
+ *
+ * The value IP_PORTRANGE_DEFAULT causes the default behavior.
+ *
+ * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
+ * and exists only for FreeBSD compatibility purposes.
+ *
+ * The value IP_PORTRANGE_LOW changes the range to the "low" are
+ * that is (by convention) restricted to privileged processes.
+ * This convention is based on "vouchsafe" principles only.
+ * It is only secure if you trust the remote host to restrict these ports.
+ * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
+ */
+
+#define	IPPORT_RESERVED		1024
+#define	IPPORT_ANONMIN		49152
+#define	IPPORT_ANONMAX		65535
+#define	IPPORT_RESERVEDMIN	600
+#define	IPPORT_RESERVEDMAX	(IPPORT_RESERVED-1)
+
+/*
+ * Internet address (a structure for historical reasons)
+ */
+struct in_addr {
+	in_addr_t s_addr;
+} __packed;
+
+/*
+ * Definitions of bits in internet address integers.
+ * On subnets, the decomposition of addresses to host and net parts
+ * is done according to subnet mask, not the masks here.
+ *
+ * By byte-swapping the constants, we avoid ever having to byte-swap IP
+ * addresses inside the kernel.  Unfortunately, user-level programs rely
+ * on these macros not doing byte-swapping.
+ */
+#ifdef _KERNEL
+#define	__IPADDR(x)	((uint32_t) htonl((uint32_t)(x)))
+#else
+#define	__IPADDR(x)	((uint32_t)(x))
+#endif
+
+#define	IN_CLASSA(i)		(((uint32_t)(i) & __IPADDR(0x80000000)) == \
+				 __IPADDR(0x00000000))
+#define	IN_CLASSA_NET		__IPADDR(0xff000000)
+#define	IN_CLASSA_NSHIFT	24
+#define	IN_CLASSA_HOST		__IPADDR(0x00ffffff)
+#define	IN_CLASSA_MAX		128
+
+#define	IN_CLASSB(i)		(((uint32_t)(i) & __IPADDR(0xc0000000)) == \
+				 __IPADDR(0x80000000))
+#define	IN_CLASSB_NET		__IPADDR(0xffff0000)
+#define	IN_CLASSB_NSHIFT	16
+#define	IN_CLASSB_HOST		__IPADDR(0x0000ffff)
+#define	IN_CLASSB_MAX		65536
+
+#define	IN_CLASSC(i)		(((uint32_t)(i) & __IPADDR(0xe0000000)) == \
+				 __IPADDR(0xc0000000))
+#define	IN_CLASSC_NET		__IPADDR(0xffffff00)
+#define	IN_CLASSC_NSHIFT	8
+#define	IN_CLASSC_HOST		__IPADDR(0x000000ff)
+
+#define	IN_CLASSD(i)		(((uint32_t)(i) & __IPADDR(0xf0000000)) == \
+				 __IPADDR(0xe0000000))
+/* These ones aren't really net and host fields, but routing needn't know. */
+#define	IN_CLASSD_NET		__IPADDR(0xf0000000)
+#define	IN_CLASSD_NSHIFT	28
+#define	IN_CLASSD_HOST		__IPADDR(0x0fffffff)
+#define	IN_MULTICAST(i)		IN_CLASSD(i)
+
+#define	IN_EXPERIMENTAL(i)	(((uint32_t)(i) & __IPADDR(0xf0000000)) == \
+				 __IPADDR(0xf0000000))
+#define	IN_BADCLASS(i)		(((uint32_t)(i) & __IPADDR(0xf0000000)) == \
+				 __IPADDR(0xf0000000))
+
+#define IN_LINKLOCAL(i)	(((uint32_t)(i) & __IPADDR(0xffff0000)) == \
+			 __IPADDR(0xa9fe0000))
+
+#define	IN_PRIVATE(i)	((((uint32_t)(i) & __IPADDR(0xff000000)) ==	\
+			  __IPADDR(0x0a000000))	||			\
+			 (((uint32_t)(i) & __IPADDR(0xfff00000)) ==	\
+			  __IPADDR(0xac100000))	||			\
+			 (((uint32_t)(i) & __IPADDR(0xffff0000)) ==	\
+			  __IPADDR(0xc0a80000)))
+
+#define	IN_LOCAL_GROUP(i)	(((uint32_t)(i) & __IPADDR(0xffffff00)) == \
+				 __IPADDR(0xe0000000))
+
+#define	IN_ANY_LOCAL(i)		(IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
+
+#define	INADDR_ANY		__IPADDR(0x00000000)
+#define	INADDR_LOOPBACK		__IPADDR(0x7f000001)
+#define	INADDR_BROADCAST	__IPADDR(0xffffffff)	/* must be masked */
+#define	INADDR_NONE		__IPADDR(0xffffffff)	/* -1 return */
+
+#define	INADDR_UNSPEC_GROUP	__IPADDR(0xe0000000)	/* 224.0.0.0 */
+#define	INADDR_ALLHOSTS_GROUP	__IPADDR(0xe0000001)	/* 224.0.0.1 */
+#define	INADDR_ALLRTRS_GROUP	__IPADDR(0xe0000002)	/* 224.0.0.2 */
+#define	INADDR_CARP_GROUP	__IPADDR(0xe0000012)	/* 224.0.0.18 */
+#define	INADDR_MAX_LOCAL_GROUP	__IPADDR(0xe00000ff)	/* 224.0.0.255 */
+
+#define	IN_LOOPBACKNET		127			/* official! */
+
+/*
+ * Socket address, internet style.
+ */
+struct sockaddr_in {
+	uint8_t		sin_len;
+	sa_family_t	sin_family;
+	in_port_t	sin_port;
+	struct in_addr	sin_addr;
+	__int8_t	sin_zero[8];
+};
+
+#define	INET_ADDRSTRLEN                 16
+
+/*
+ * Structure used to describe IP options.
+ * Used to store options internally, to pass them to a process,
+ * or to restore options retrieved earlier.
+ * The ip_dst is used for the first-hop gateway when using a source route
+ * (this gets put into the header proper).
+ */
+struct ip_opts {
+	struct in_addr	ip_dst;		/* first hop, 0 w/o src rt */
+#if defined(__cplusplus)
+	__int8_t	Ip_opts[40];	/* actually variable in size */
+#else
+	__int8_t	ip_opts[40];	/* actually variable in size */
+#endif
+};
+
+/*
+ * Options for use with [gs]etsockopt at the IP level.
+ * First word of comment is data type; bool is stored in int.
+ */
+#define	IP_OPTIONS		1    /* buf/ip_opts; set/get IP options */
+#define	IP_HDRINCL		2    /* int; header is included with data */
+#define	IP_TOS			3    /* int; IP type of service and preced. */
+#define	IP_TTL			4    /* int; IP time to live */
+#define	IP_RECVOPTS		5    /* bool; receive all IP opts w/dgram */
+#define	IP_RECVRETOPTS		6    /* bool; receive IP opts for response */
+#define	IP_RECVDSTADDR		7    /* bool; receive IP dst addr w/dgram */
+#define	IP_RETOPTS		8    /* ip_opts; set/get IP options */
+#define	IP_MULTICAST_IF		9    /* in_addr; set/get IP multicast i/f  */
+#define	IP_MULTICAST_TTL	10   /* u_char; set/get IP multicast ttl */
+#define	IP_MULTICAST_LOOP	11   /* u_char; set/get IP multicast loopback */
+/* The add and drop membership option numbers need to match with the v6 ones */
+#define	IP_ADD_MEMBERSHIP	12   /* ip_mreq; add an IP group membership */
+#define	IP_DROP_MEMBERSHIP	13   /* ip_mreq; drop an IP group membership */
+#define	IP_PORTALGO		18   /* int; port selection algo (rfc6056) */
+#define	IP_PORTRANGE		19   /* int; range to use for ephemeral port */
+#define	IP_RECVIF		20   /* bool; receive reception if w/dgram */
+#define	IP_ERRORMTU		21   /* int; get MTU of last xmit = EMSGSIZE */
+#define	IP_IPSEC_POLICY		22   /* struct; get/set security policy */
+#define	IP_RECVTTL		23   /* bool; receive IP TTL w/dgram */
+#define	IP_MINTTL		24   /* minimum TTL for packet or drop */
+#define	IP_PKTINFO		25   /* int; send interface and src addr */
+#define	IP_RECVPKTINFO		26   /* int; send interface and dst addr */
+
+/*
+ * Information sent in the control message of a datagram socket for
+ * IP_PKTINFO and IP_RECVPKTINFO.
+ */
+struct in_pktinfo {
+	struct in_addr	ipi_addr;	/* src/dst address */
+	unsigned int ipi_ifindex;	/* interface index */
+};
+
+/*
+ * Defaults and limits for options
+ */
+#define	IP_DEFAULT_MULTICAST_TTL  1	/* normally limit m'casts to 1 hop  */
+#define	IP_DEFAULT_MULTICAST_LOOP 1	/* normally hear sends if a member  */
+#define	IP_MAX_MEMBERSHIPS	20	/* per socket; must fit in one mbuf */
+
+/*
+ * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
+ */
+struct ip_mreq {
+	struct	in_addr imr_multiaddr;	/* IP multicast address of group */
+	struct	in_addr imr_interface;	/* local IP address of interface */
+};
+
+/*
+ * Argument for IP_PORTRANGE:
+ * - which range to search when port is unspecified at bind() or connect()
+ */
+#define	IP_PORTRANGE_DEFAULT	0	/* default range */
+#define	IP_PORTRANGE_HIGH	1	/* same as DEFAULT (FreeBSD compat) */
+#define	IP_PORTRANGE_LOW	2	/* use privileged range */
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Definitions for inet sysctl operations.
+ *
+ * Third level is protocol number.
+ * Fourth level is desired variable within that protocol.
+ */
+#define	IPPROTO_MAXID	(IPPROTO_AH + 1)	/* don't list to IPPROTO_MAX */
+
+#define	CTL_IPPROTO_NAMES { \
+	{ "ip", CTLTYPE_NODE }, \
+	{ "icmp", CTLTYPE_NODE }, \
+	{ "igmp", CTLTYPE_NODE }, \
+	{ "ggp", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "tcp", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ "egp", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "pup", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "udp", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "idp", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "ipsec", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "pim", CTLTYPE_NODE }, \
+}
+
+/*
+ * Names for IP sysctl objects
+ */
+#define	IPCTL_FORWARDING	1	/* act as router */
+#define	IPCTL_SENDREDIRECTS	2	/* may send redirects when forwarding */
+#define	IPCTL_DEFTTL		3	/* default TTL */
+#ifdef notyet
+#define	IPCTL_DEFMTU		4	/* default MTU */
+#endif
+#define	IPCTL_FORWSRCRT		5	/* forward source-routed packets */
+#define	IPCTL_DIRECTEDBCAST	6	/* default broadcast behavior */
+#define	IPCTL_ALLOWSRCRT	7	/* allow/drop all source-routed pkts */
+#define	IPCTL_SUBNETSARELOCAL	8	/* treat subnets as local addresses */
+#define	IPCTL_MTUDISC		9	/* allow path MTU discovery */
+#define	IPCTL_ANONPORTMIN      10	/* minimum ephemeral port */
+#define	IPCTL_ANONPORTMAX      11	/* maximum ephemeral port */
+#define	IPCTL_MTUDISCTIMEOUT   12	/* allow path MTU discovery */
+#define	IPCTL_MAXFLOWS         13	/* maximum ip flows allowed */
+#define	IPCTL_HOSTZEROBROADCAST 14	/* is host zero a broadcast addr? */
+#define	IPCTL_GIF_TTL 	       15	/* default TTL for gif encap packet */
+#define	IPCTL_LOWPORTMIN       16	/* minimum reserved port */
+#define	IPCTL_LOWPORTMAX       17	/* maximum reserved port */
+#define	IPCTL_MAXFRAGPACKETS   18	/* max packets reassembly queue */
+#define	IPCTL_GRE_TTL          19	/* default TTL for gre encap packet */
+#define	IPCTL_CHECKINTERFACE   20	/* drop pkts in from 'wrong' iface */
+#define	IPCTL_IFQ	       21	/* IP packet input queue */
+#define	IPCTL_RANDOMID	       22	/* use random IP ids (if configured) */
+#define	IPCTL_LOOPBACKCKSUM    23	/* do IP checksum on loopback */
+#define	IPCTL_STATS		24	/* IP statistics */
+#define	IPCTL_DAD_COUNT        25	/* DAD packets to send */
+#define	IPCTL_MAXID	       26
+
+#define	IPCTL_NAMES { \
+	{ 0, 0 }, \
+	{ "forwarding", CTLTYPE_INT }, \
+	{ "redirect", CTLTYPE_INT }, \
+	{ "ttl", CTLTYPE_INT }, \
+	{ "mtu", CTLTYPE_INT }, \
+	{ "forwsrcrt", CTLTYPE_INT }, \
+	{ "directed-broadcast", CTLTYPE_INT }, \
+	{ "allowsrcrt", CTLTYPE_INT }, \
+	{ "subnetsarelocal", CTLTYPE_INT }, \
+	{ "mtudisc", CTLTYPE_INT }, \
+	{ "anonportmin", CTLTYPE_INT }, \
+	{ "anonportmax", CTLTYPE_INT }, \
+	{ "mtudisctimeout", CTLTYPE_INT }, \
+	{ "maxflows", CTLTYPE_INT }, \
+	{ "hostzerobroadcast", CTLTYPE_INT }, \
+	{ "gifttl", CTLTYPE_INT }, \
+	{ "lowportmin", CTLTYPE_INT }, \
+	{ "lowportmax", CTLTYPE_INT }, \
+	{ "maxfragpackets", CTLTYPE_INT }, \
+	{ "grettl", CTLTYPE_INT }, \
+	{ "checkinterface", CTLTYPE_INT }, \
+	{ "ifq", CTLTYPE_NODE }, \
+	{ "random_id", CTLTYPE_INT }, \
+	{ "do_loopback_cksum", CTLTYPE_INT }, \
+	{ "stats", CTLTYPE_STRUCT }, \
+	{ "dad_count", CTLTYPE_INT }, \
+}
+#endif /* _NETBSD_SOURCE */
+
+/* INET6 stuff */
+#define	__KAME_NETINET_IN_H_INCLUDED_
+#include <netinet6/in6.h>
+#undef __KAME_NETINET_IN_H_INCLUDED_
+
+#ifdef _KERNEL
+/*
+ * in_cksum_phdr:
+ *
+ *	Compute significant parts of the IPv4 checksum pseudo-header
+ *	for use in a delayed TCP/UDP checksum calculation.
+ *
+ *	Args:
+ *
+ *		src		Source IP address
+ *		dst		Destination IP address
+ *		lenproto	htons(proto-hdr-len + proto-number)
+ */
+static __inline u_int16_t __unused
+in_cksum_phdr(u_int32_t src, u_int32_t dst, u_int32_t lenproto)
+{
+	u_int32_t sum;
+
+	sum = lenproto +
+	      (u_int16_t)(src >> 16) +
+	      (u_int16_t)(src /*& 0xffff*/) +
+	      (u_int16_t)(dst >> 16) +
+	      (u_int16_t)(dst /*& 0xffff*/);
+
+	sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/);
+
+	if (sum > 0xffff)
+		sum -= 0xffff;
+
+	return (sum);
+}
+
+/*
+ * in_cksum_addword:
+ *
+ *	Add the two 16-bit network-order values, carry, and return.
+ */
+static __inline u_int16_t __unused
+in_cksum_addword(u_int16_t a, u_int16_t b)
+{
+	u_int32_t sum = a + b;
+
+	if (sum > 0xffff)
+		sum -= 0xffff;
+
+	return (sum);
+}
+
+extern	struct in_addr zeroin_addr;
+extern	u_char	ip_protox[];
+extern const struct sockaddr_in in_any;
+
+int	in_broadcast(struct in_addr, struct ifnet *);
+int	in_canforward(struct in_addr);
+int	cpu_in_cksum(struct mbuf *, int, int, uint32_t);
+int	in_cksum(struct mbuf *, int);
+int	in4_cksum(struct mbuf *, u_int8_t, int, int);
+void	in_delayed_cksum(struct mbuf *);
+int	in_localaddr(struct in_addr);
+void	in_socktrim(struct sockaddr_in *);
+
+void	in_if_link_up(struct ifnet *);
+void	in_if_link_down(struct ifnet *);
+void	in_if_up(struct ifnet *);
+void	in_if_down(struct ifnet *);
+void	in_if_link_state_change(struct ifnet *, int);
+
+struct route;
+struct ip_moptions;
+
+struct sockaddr_in *in_selectsrc(struct sockaddr_in *,
+	struct route *, int, struct ip_moptions *, int *);
+
+#define	in_hosteq(s,t)	((s).s_addr == (t).s_addr)
+#define	in_nullhost(x)	((x).s_addr == INADDR_ANY)
+
+#define	satosin(sa)	((struct sockaddr_in *)(sa))
+#define	satocsin(sa)	((const struct sockaddr_in *)(sa))
+#define	sintosa(sin)	((struct sockaddr *)(sin))
+#define	sintocsa(sin)	((const struct sockaddr *)(sin))
+#define	ifatoia(ifa)	((struct in_ifaddr *)(ifa))
+
+int sockaddr_in_cmp(const struct sockaddr *, const struct sockaddr *);
+const void *sockaddr_in_const_addr(const struct sockaddr *, socklen_t *);
+void *sockaddr_in_addr(struct sockaddr *, socklen_t *);
+
+static inline void
+sockaddr_in_init1(struct sockaddr_in *sin, const struct in_addr *addr,
+    in_port_t port)
+{
+	sin->sin_port = port;
+	sin->sin_addr = *addr;
+	memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
+}
+
+static inline void
+sockaddr_in_init(struct sockaddr_in *sin, const struct in_addr *addr,
+    in_port_t port)
+{
+	sin->sin_family = AF_INET;
+	sin->sin_len = sizeof(*sin);
+	sockaddr_in_init1(sin, addr, port);
+}
+
+static inline struct sockaddr *
+sockaddr_in_alloc(const struct in_addr *addr, in_port_t port, int flags)
+{
+	struct sockaddr *sa;
+
+	sa = sockaddr_alloc(AF_INET, sizeof(struct sockaddr_in), flags);
+
+	if (sa == NULL)
+		return NULL;
+
+	sockaddr_in_init1(satosin(sa), addr, port);
+
+	return sa;
+}
+#endif /* _KERNEL */
+
+#if defined(_KERNEL) || defined(_TEST)
+int	in_print(char *, size_t, const struct in_addr *);
+#define IN_PRINT(b, a)	(in_print((b), sizeof(b), a), (b))
+int	sin_print(char *, size_t, const void *);
+#endif
+
+#endif /* !_NETINET_IN_H_ */

Property changes on: lab4/.minix-src/include/netinet/in.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/in_var.h
===================================================================
--- lab4/.minix-src/include/netinet/in_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/in_var.h	(revision 13)
@@ -0,0 +1,334 @@
+/*	$NetBSD: in_var.h,v 1.74 2015/08/31 08:05:20 ozaki-r Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Public Access Networks Corporation ("Panix").  It was developed under
+ * contract to Panix by Eric Haszlakiewicz and Thor Lancelot Simon.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1985, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)in_var.h	8.2 (Berkeley) 1/9/95
+ */
+
+#ifndef _NETINET_IN_VAR_H_
+#define _NETINET_IN_VAR_H_
+
+#include <sys/queue.h>
+
+#define IN_IFF_TENTATIVE	0x01	/* tentative address */
+#define IN_IFF_DUPLICATED	0x02	/* DAD detected duplicate */
+#define IN_IFF_DETACHED		0x04	/* may be detached from the link */
+#define IN_IFF_TRYTENTATIVE	0x08	/* intent to try DAD */
+
+/* do not input/output */
+#define IN_IFF_NOTREADY \
+    (IN_IFF_TRYTENTATIVE | IN_IFF_TENTATIVE | IN_IFF_DUPLICATED)
+
+/*
+ * Interface address, Internet version.  One of these structures
+ * is allocated for each interface with an Internet address.
+ * The ifaddr structure contains the protocol-independent part
+ * of the structure and is assumed to be first.
+ */
+struct in_ifaddr {
+	struct	ifaddr ia_ifa;		/* protocol-independent info */
+#define	ia_ifp		ia_ifa.ifa_ifp
+#define ia_flags	ia_ifa.ifa_flags
+					/* ia_{,sub}net{,mask} in host order */
+	u_int32_t ia_net;		/* network number of interface */
+	u_int32_t ia_netmask;		/* mask of net part */
+	u_int32_t ia_subnet;		/* subnet number, including net */
+	u_int32_t ia_subnetmask;	/* mask of subnet part */
+	struct	in_addr ia_netbroadcast; /* to recognize net broadcasts */
+	LIST_ENTRY(in_ifaddr) ia_hash;	/* entry in bucket of inet addresses */
+	TAILQ_ENTRY(in_ifaddr) ia_list;	/* list of internet addresses */
+	struct	sockaddr_in ia_addr;	/* reserve space for interface name */
+	struct	sockaddr_in ia_dstaddr;	/* reserve space for broadcast addr */
+#define	ia_broadaddr	ia_dstaddr
+	struct	sockaddr_in ia_sockmask; /* reserve space for general netmask */
+	LIST_HEAD(, in_multi) ia_multiaddrs; /* list of multicast addresses */
+	struct	in_multi *ia_allhosts;	/* multicast address record for
+					   the allhosts multicast group */
+	uint16_t ia_idsalt;		/* ip_id salt for this ia */
+	int	ia4_flags;		/* address flags */
+	void	(*ia_dad_start) (struct ifaddr *);	/* DAD start function */
+	void	(*ia_dad_stop) (struct ifaddr *);	/* DAD stop function */
+};
+
+struct	in_aliasreq {
+	char	ifra_name[IFNAMSIZ];		/* if name, e.g. "en0" */
+	struct	sockaddr_in ifra_addr;
+	struct	sockaddr_in ifra_dstaddr;
+#define	ifra_broadaddr	ifra_dstaddr
+	struct	sockaddr_in ifra_mask;
+};
+
+/*
+ * Given a pointer to an in_ifaddr (ifaddr),
+ * return a pointer to the addr as a sockaddr_in.
+ */
+#define	IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr))
+
+#ifdef _KERNEL
+
+/* Note: 61, 127, 251, 509, 1021, 2039 are good. */
+#ifndef IN_IFADDR_HASH_SIZE
+#define IN_IFADDR_HASH_SIZE	509
+#endif
+
+/*
+ * This is a bit unconventional, and wastes a little bit of space, but
+ * because we want a very even hash function we don't use & in_ifaddrhash
+ * here, but rather % the hash size, which should obviously be prime.
+ */
+
+#define	IN_IFADDR_HASH(x) in_ifaddrhashtbl[(u_long)(x) % IN_IFADDR_HASH_SIZE]
+
+LIST_HEAD(in_ifaddrhashhead, in_ifaddr);	/* Type of the hash head */
+TAILQ_HEAD(in_ifaddrhead, in_ifaddr);		/* Type of the list head */
+
+extern	u_long in_ifaddrhash;			/* size of hash table - 1 */
+extern  struct in_ifaddrhashhead *in_ifaddrhashtbl;	/* Hash table head */
+extern  struct in_ifaddrhead in_ifaddrhead;		/* List head (in ip_input) */
+
+extern	const	int	inetctlerrmap[];
+
+/*
+ * Macro for finding whether an internet address (in_addr) belongs to one
+ * of our interfaces (in_ifaddr).  NULL if the address isn't ours.
+ */
+#define INADDR_TO_IA(addr, ia) \
+	/* struct in_addr addr; */ \
+	/* struct in_ifaddr *ia; */ \
+{ \
+	LIST_FOREACH(ia, &IN_IFADDR_HASH((addr).s_addr), ia_hash) { \
+		if (in_hosteq(ia->ia_addr.sin_addr, (addr))) \
+			break; \
+	} \
+}
+
+/*
+ * Macro for finding the next in_ifaddr structure with the same internet
+ * address as ia. Call only with a valid ia pointer.
+ * Will set ia to NULL if none found.
+ */
+
+#define NEXT_IA_WITH_SAME_ADDR(ia) \
+	/* struct in_ifaddr *ia; */ \
+{ \
+	struct in_addr addr; \
+	addr = ia->ia_addr.sin_addr; \
+	do { \
+		ia = LIST_NEXT(ia, ia_hash); \
+	} while ((ia != NULL) && !in_hosteq(ia->ia_addr.sin_addr, addr)); \
+}
+
+/*
+ * Macro for finding the interface (ifnet structure) corresponding to one
+ * of our IP addresses.
+ */
+#define INADDR_TO_IFP(addr, ifp) \
+	/* struct in_addr addr; */ \
+	/* struct ifnet *ifp; */ \
+{ \
+	struct in_ifaddr *ia; \
+\
+	INADDR_TO_IA(addr, ia); \
+	(ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \
+}
+
+/*
+ * Macro for finding an internet address structure (in_ifaddr) corresponding
+ * to a given interface (ifnet structure).
+ */
+#define IFP_TO_IA(ifp, ia) \
+	/* struct ifnet *ifp; */ \
+	/* struct in_ifaddr *ia; */ \
+{ \
+	struct ifaddr *ifa; \
+\
+	IFADDR_FOREACH(ifa, ifp) { \
+		if (ifa->ifa_addr->sa_family == AF_INET) \
+			break; \
+	} \
+	(ia) = ifatoia(ifa); \
+}
+
+#include <netinet/in_selsrc.h>
+/*
+ * IPv4 per-interface state.
+ */
+struct in_ifinfo {
+	struct lltable		*ii_llt;	/* ARP state */
+	struct in_ifsysctl	*ii_selsrc;
+};
+
+#endif /* _KERNEL */
+
+/*
+ * Internet multicast address structure.  There is one of these for each IP
+ * multicast group to which this host belongs on a given network interface.
+ * They are kept in a linked list, rooted in the interface's in_ifaddr
+ * structure.
+ */
+struct router_info;
+
+struct in_multi {
+	LIST_ENTRY(in_multi) inm_list;	/* list of multicast addresses */
+	struct	router_info *inm_rti;	/* router version info */
+	struct	ifnet *inm_ifp;		/* back pointer to ifnet */
+	struct	in_addr inm_addr;	/* IP multicast address */
+	u_int	inm_refcount;		/* no. membership claims by sockets */
+	u_int	inm_timer;		/* IGMP membership report timer */
+	u_int	inm_state;		/* state of membership */
+};
+
+#ifdef _KERNEL
+
+#include <net/pktqueue.h>
+
+extern pktqueue_t *ip_pktq;
+
+extern int ip_dad_count;		/* Duplicate Address Detection probes */
+
+/*
+ * Structure used by functions below to remember position when stepping
+ * through all of the in_multi records.
+ */
+struct in_multistep {
+	int i_n;
+	struct in_multi *i_inm;
+};
+
+bool in_multi_group(struct in_addr, struct ifnet *, int);
+struct in_multi *in_first_multi(struct in_multistep *);
+struct in_multi *in_next_multi(struct in_multistep *);
+struct in_multi *in_lookup_multi(struct in_addr, struct ifnet *);
+struct in_multi *in_addmulti(struct in_addr *, struct ifnet *);
+void in_delmulti(struct in_multi *);
+
+void in_multi_lock(int);
+void in_multi_unlock(void);
+int in_multi_lock_held(void);
+
+struct ifaddr;
+
+int	in_ifinit(struct ifnet *,
+	    struct in_ifaddr *, const struct sockaddr_in *, int, int);
+void	in_savemkludge(struct in_ifaddr *);
+void	in_restoremkludge(struct in_ifaddr *, struct ifnet *);
+void	in_purgemkludge(struct ifnet *);
+void	in_ifscrub(struct ifnet *, struct in_ifaddr *);
+void	in_setmaxmtu(void);
+const char *in_fmtaddr(struct in_addr);
+int	in_control(struct socket *, u_long, void *, struct ifnet *);
+void	in_purgeaddr(struct ifaddr *);
+void	in_purgeif(struct ifnet *);
+int	ipflow_fastforward(struct mbuf *);
+
+struct ipid_state;
+typedef struct ipid_state ipid_state_t;
+
+ipid_state_t *	ip_id_init(void);
+void		ip_id_fini(ipid_state_t *);
+uint16_t	ip_randomid(ipid_state_t *, uint16_t);
+
+extern ipid_state_t *	ip_ids;
+extern uint16_t		ip_id;
+extern int		ip_do_randomid;
+
+/*
+ * ip_newid_range: "allocate" num contiguous IP IDs.
+ *
+ * => Return the first ID.
+ */
+static __inline uint16_t
+ip_newid_range(const struct in_ifaddr *ia, u_int num)
+{
+	uint16_t id;
+
+	if (ip_do_randomid) {
+		/* XXX ignore num */
+		return ip_randomid(ip_ids, ia ? ia->ia_idsalt : 0);
+	}
+
+	/* Never allow an IP ID of 0 (detect wrap). */
+	if ((uint16_t)(ip_id + num) < ip_id) {
+		ip_id = 1;
+	}
+	id = htons(ip_id);
+	ip_id += num;
+	return id;
+}
+
+static __inline uint16_t
+ip_newid(const struct in_ifaddr *ia)
+{
+
+	return ip_newid_range(ia, 1);
+}
+
+#ifdef SYSCTLFN_PROTO
+int	sysctl_inpcblist(SYSCTLFN_PROTO);
+#endif
+
+#define LLTABLE(ifp)	\
+	((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt
+
+#endif	/* !_KERNEL */
+
+/* INET6 stuff */
+#include <netinet6/in6_var.h>
+
+#endif /* !_NETINET_IN_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet/in_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/ip_icmp.h
===================================================================
--- lab4/.minix-src/include/netinet/ip_icmp.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/ip_icmp.h	(revision 13)
@@ -0,0 +1,254 @@
+/*	$NetBSD: ip_icmp.h,v 1.34 2015/02/18 17:00:15 christos Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ip_icmp.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IP_ICMP_H_
+#define _NETINET_IP_ICMP_H_
+
+
+/*
+ * Interface Control Message Protocol Definitions.
+ * Per RFC 792, September 1981.
+ */
+
+/*
+ * Internal of an ICMP Router Advertisement
+ */
+struct icmp_ra_addr {
+	u_int32_t ira_addr;
+	u_int32_t ira_preference;
+} __packed;
+
+/*
+ * Structure of an icmp header.
+ */
+struct icmp {
+	u_int8_t  icmp_type;		/* type of message, see below */
+	u_int8_t  icmp_code;		/* type sub code */
+	u_int16_t icmp_cksum;		/* ones complement cksum of struct */
+	union {
+		u_int8_t  ih_pptr;		/* ICMP_PARAMPROB */
+		struct in_addr ih_gwaddr;	/* ICMP_REDIRECT */
+		struct ih_idseq {
+			  n_short icd_id;
+			  n_short icd_seq;
+		} ih_idseq __packed;
+		int32_t	  ih_void;
+
+		/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
+		struct ih_pmtu {
+			  n_short ipm_void;
+			  n_short ipm_nextmtu;
+		} ih_pmtu __packed;
+		struct ih_rtradv {
+			u_int8_t irt_num_addrs;
+			u_int8_t irt_wpa;
+			u_int16_t irt_lifetime;
+		} ih_rtradv __packed;
+	} icmp_hun /* XXX __packed ??? */;
+#define icmp_pptr	  icmp_hun.ih_pptr
+#define icmp_gwaddr	  icmp_hun.ih_gwaddr
+#define icmp_id		  icmp_hun.ih_idseq.icd_id
+#define icmp_seq	  icmp_hun.ih_idseq.icd_seq
+#define icmp_void	  icmp_hun.ih_void
+#define icmp_pmvoid	  icmp_hun.ih_pmtu.ipm_void
+#define icmp_nextmtu	  icmp_hun.ih_pmtu.ipm_nextmtu
+#define icmp_num_addrs	  icmp_hun.ih_rtradv.irt_num_addrs
+#define icmp_wpa	  icmp_hun.ih_rtradv.irt_wpa
+#define icmp_lifetime	  icmp_hun.ih_rtradv.irt_lifetime
+	union {
+		struct id_ts {
+			  n_time its_otime;
+			  n_time its_rtime;
+			  n_time its_ttime;
+		} id_ts __packed;
+		struct id_ip  {
+			  struct ip idi_ip;
+			  /* options and then 64 bits of data */
+		} id_ip /* XXX: __packed ??? */;
+		struct icmp_ra_addr id_radv;
+		u_int32_t id_mask;
+		int8_t	  id_data[1];
+	} icmp_dun /* XXX __packed ??? */;
+#define icmp_otime	  icmp_dun.id_ts.its_otime
+#define icmp_rtime	  icmp_dun.id_ts.its_rtime
+#define icmp_ttime	  icmp_dun.id_ts.its_ttime
+#define icmp_ip		  icmp_dun.id_ip.idi_ip
+#define icmp_radv	  icmp_dun.id_mask
+#define icmp_mask	  icmp_dun.id_mask
+#define icmp_data	  icmp_dun.id_data
+};
+
+/*
+ * Lower bounds on packet lengths for various types.
+ * For the error advice packets must first insure that the
+ * packet is large enought to contain the returned ip header.
+ * Only then can we do the check to see if 64 bits of packet
+ * data have been returned, since we need to check the returned
+ * ip header length.
+ */
+#define ICMP_MINLEN	8				/* abs minimum */
+#define ICMP_TSLEN	(8 + 3 * sizeof (n_time))	/* timestamp */
+#define ICMP_MASKLEN	12				/* address mask */
+#define ICMP_ADVLENMIN	(8 + sizeof (struct ip) + 8)	/* min */
+#define ICMP_ADVLEN(p)	(8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+	/* N.B.: must separately check that ip_hl >= 5 */
+
+/*
+ * Definition of type and code field values.
+ */
+#define ICMP_ECHOREPLY		0		/* echo reply */
+#define ICMP_UNREACH		3		/* dest unreachable, codes: */
+#define		ICMP_UNREACH_NET	0		/* bad net */
+#define		ICMP_UNREACH_HOST	1		/* bad host */
+#define		ICMP_UNREACH_PROTOCOL	2		/* bad protocol */
+#define		ICMP_UNREACH_PORT	3		/* bad port */
+#define		ICMP_UNREACH_NEEDFRAG	4		/* IP_DF caused drop */
+#define		ICMP_UNREACH_SRCFAIL	5		/* src route failed */
+#define		ICMP_UNREACH_NET_UNKNOWN 6		/* unknown net */
+#define		ICMP_UNREACH_HOST_UNKNOWN 7		/* unknown host */
+#define		ICMP_UNREACH_ISOLATED	8		/* src host isolated */
+#define		ICMP_UNREACH_NET_PROHIB 9		/* prohibited access */
+#define		ICMP_UNREACH_HOST_PROHIB 10		/* ditto */
+#define		ICMP_UNREACH_TOSNET	11		/* bad tos for net */
+#define		ICMP_UNREACH_TOSHOST	12		/* bad tos for host */
+#define		ICMP_UNREACH_ADMIN_PROHIBIT 13		/* communication
+							   administratively
+							   prohibited */
+#define		ICMP_UNREACH_HOST_PREC	14		/* host precedence
+							   violation */
+#define		ICMP_UNREACH_PREC_CUTOFF 15		/* precedence cutoff */
+#define ICMP_SOURCEQUENCH	4		/* packet lost, slow down */
+#define ICMP_REDIRECT		5		/* shorter route, codes: */
+#define		ICMP_REDIRECT_NET	0		/* for network */
+#define		ICMP_REDIRECT_HOST	1		/* for host */
+#define		ICMP_REDIRECT_TOSNET	2		/* for tos and net */
+#define		ICMP_REDIRECT_TOSHOST	3		/* for tos and host */
+#define ICMP_ALTHOSTADDR	6		/* alternative host address */
+#define ICMP_ECHO		8		/* echo service */
+#define ICMP_ROUTERADVERT	9		/* router advertisement */
+#define		ICMP_ROUTERADVERT_NORMAL 0
+#define		ICMP_ROUTERADVERT_NOROUTE 16
+#define ICMP_ROUTERSOLICIT	10		/* router solicitation */
+#define ICMP_TIMXCEED		11		/* time exceeded, code: */
+#define		ICMP_TIMXCEED_INTRANS	0		/* ttl==0 in transit */
+#define		ICMP_TIMXCEED_REASS	1		/* ttl==0 in reass */
+#define ICMP_PARAMPROB		12		/* ip header bad */
+#define		ICMP_PARAMPROB_ERRATPTR 0
+#define		ICMP_PARAMPROB_OPTABSENT 1
+#define		ICMP_PARAMPROB_LENGTH	2
+#define ICMP_TSTAMP		13		/* timestamp request */
+#define ICMP_TSTAMPREPLY	14		/* timestamp reply */
+#define ICMP_IREQ		15		/* information request */
+#define ICMP_IREQREPLY		16		/* information reply */
+#define ICMP_MASKREQ		17		/* address mask request */
+#define ICMP_MASKREPLY		18		/* address mask reply */
+#define ICMP_TRACEROUTE		30		/* traceroute */
+#define ICMP_DATACONVERR	31		/* data conversion error */
+#define ICMP_MOBILE_REDIRECT	32		/* mobile redirect */
+#define ICMP_IPV6_WHEREAREYOU	33		/* ipv6 where are you */
+#define ICMP_IPV6_IAMHERE	34		/* ipv6 i am here */
+#define ICMP_MOBILE_REGREQUEST	35		/* mobile registration req */
+#define ICMP_MOBILE_REGREPLY	36		/* mobile registration reply */
+#define ICMP_SKIP		39		/* SKIP */
+#define ICMP_PHOTURIS		40		/* security */
+#define		ICMP_PHOTURIS_UNKNOWN_INDEX	0	/* unknown sec index */
+#define		ICMP_PHOTURIS_AUTH_FAILED	1	/* auth failed */
+#define		ICMP_PHOTURIS_DECOMPRESS_FAILED 2	/* decompress failed */
+#define		ICMP_PHOTURIS_DECRYPT_FAILED	3	/* decrypt failed */
+#define		ICMP_PHOTURIS_NEED_AUTHN	4	/* no authentication */
+#define		ICMP_PHOTURIS_NEED_AUTHZ	5	/* no authorization */
+
+#define ICMP_MAXTYPE		40
+#define ICMP_NTYPES		(ICMP_MAXTYPE + 1)
+
+#ifdef ICMP_STRINGS
+static const char *icmp_type[] = {
+	"echoreply", "unassigned_1", "unassigned_2", "unreach",
+	"sourcequench", "redirect", "althostaddr", "unassigned_7",
+	"echo", "routeradvert", "routersolicit", "timxceed",
+	"paramprob", "tstamp", "tstampreply", "ireq",
+	"ireqreply", "maskreq", "maskreply", "reserved_19",
+	"reserved_20", "reserved_21", "reserved_22", "reserved_23",
+	"reserved_24", "reserved_25", "reserved_26", "reserved_27",
+	"reserved_28", "reserved_29", "traceroute", "dataconverr",
+	"mobile_redirect", "ipv6_whereareyou", "ipv6_iamhere",
+	"mobile_regrequest", "mobile_regreply", "reserved_37",
+	"reserved_38", "skip", "photuris", NULL
+};
+static const char *icmp_code_none[] = { "none", NULL };
+static const char *icmp_code_unreach[] = {
+	"net", "host", "oprt", "needfrag", "srcfail", "net_unknown",
+	"host_unknown", "isolated", "net_prohib", "host_prohib",
+	"tosnet", "toshost", "admin_prohibit", "host_prec", "prec_cutoff", NULL
+};
+static const char *icmp_code_redirect[] = {
+	"net", "host", "tosnet", "toshost", NULL
+};
+static const char *icmp_code_routeradvert[] = {
+	"normal", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+	"noroute", NULL
+};
+static const char *icmp_code_timxceed[] = {
+	"intrans", "reass", NULL
+};
+static const char *icmp_code_paramprob[] = {
+	"erratptr", "optabsent", "length", NULL
+};
+static const char *icmp_code_photuris[] = {
+	"unknown_index", "auth_failed", "decompress_failed",
+	"decrypt_failed", "need_authn", "need_authz", NULL
+};
+#endif
+
+#define ICMP_INFOTYPE(type) \
+	((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+	(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+	(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+	(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+	(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
+#ifdef _KERNEL
+void	icmp_error(struct mbuf *, int, int, n_long, int);
+void	icmp_mtudisc(struct icmp *, struct in_addr);
+void	icmp_input(struct mbuf *, ...);
+void	icmp_init(void);
+void	icmp_reflect(struct mbuf *);
+void	icmp_send(struct mbuf *, struct mbuf *);
+int	icmp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
+
+void	icmp_mtudisc_callback_register(void (*)(struct in_addr));
+int	icmp_ratelimit(const struct in_addr *, const int, const int);
+#endif
+
+
+#endif /* !_NETINET_IP_ICMP_H_ */

Property changes on: lab4/.minix-src/include/netinet/ip_icmp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/psip_io.h
===================================================================
--- lab4/.minix-src/include/net/gen/psip_io.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/psip_io.h	(revision 13)
@@ -0,0 +1,24 @@
+/*
+server/ip/gen/psip_io.h
+*/
+
+#ifndef __SERVER__IP__GEN__PSIP_IO_H__
+#define __SERVER__IP__GEN__PSIP_IO_H__
+
+typedef struct nwio_psipopt
+{
+	unsigned long nwpo_flags;
+} nwio_psipopt_t;
+
+#define NWPO_PROMISC_MASK	0x0001L
+#define		NWPO_EN_PROMISC		0x00000001L
+#define		NWUO_DI_PROMISC		0x00010000L
+#define NWPO_NEXTHOP_MASK	0x0002L
+#define		NWPO_EN_NEXTHOP		0x00000002L
+#define		NWUO_DI_NEXTHOP		0x00020000L
+
+#endif /* __SERVER__IP__GEN__PSIP_IO_H__ */
+
+/*
+ * $PchId: psip_io.h,v 1.3 2001/02/19 07:35:58 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/net/gen/psip_io.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/tcp.h
===================================================================
--- lab4/.minix-src/include/net/gen/tcp.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/tcp.h	(revision 13)
@@ -0,0 +1,18 @@
+/*
+server/ip/gen/tcp.h
+*/
+
+#ifndef __SERVER__IP__GEN__TCP_H__
+#define __SERVER__IP__GEN__TCP_H__
+
+#define TCP_MIN_HDR_SIZE	20
+#define TCP_MAX_HDR_SIZE	60
+
+#define TCPPORT_TELNET		23
+#define TCPPORT_FINGER		79
+
+#define TCPPORT_RESERVED	1024
+
+typedef u16_t tcpport_t;
+
+#endif /* __SERVER__IP__GEN__TCP_H__ */

Property changes on: lab4/.minix-src/include/net/gen/tcp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/gen/udp_hdr.h
===================================================================
--- lab4/.minix-src/include/net/gen/udp_hdr.h	(nonexistent)
+++ lab4/.minix-src/include/net/gen/udp_hdr.h	(revision 13)
@@ -0,0 +1,22 @@
+/*
+server/ip/gen/udp_hdr.h
+*/
+
+#ifndef __SERVER__IP__GEN__UDP_HDR_H__
+#define __SERVER__IP__GEN__UDP_HDR_H__
+
+/*
+ * Included for compatibility with programs which assume udp_io_hdr_t to be
+ * defined in this header file
+ */
+#include "udp_io_hdr.h"
+
+typedef struct udp_hdr
+{
+	udpport_t uh_src_port;
+	udpport_t uh_dst_port;
+	u16_t uh_length;
+	u16_t uh_chksum;
+} udp_hdr_t;
+
+#endif /* __SERVER__IP__GEN__UDP_HDR_H__ */

Property changes on: lab4/.minix-src/include/net/gen/udp_hdr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/bpf.h
===================================================================
--- lab4/.minix-src/include/net/bpf.h	(nonexistent)
+++ lab4/.minix-src/include/net/bpf.h	(revision 13)
@@ -0,0 +1,527 @@
+/*	$NetBSD: bpf.h,v 1.67 2015/09/05 20:01:21 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1990, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from the Stanford/CMU enet packet filter,
+ * (net/enet.c) distributed as part of 4.3BSD, and code contributed
+ * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
+ * Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)bpf.h	8.2 (Berkeley) 1/9/95
+ * @(#) Header: bpf.h,v 1.36 97/06/12 14:29:53 leres Exp  (LBL)
+ */
+
+#ifndef _NET_BPF_H_
+#define _NET_BPF_H_
+
+#include <sys/ioccom.h>
+#include <sys/time.h>
+
+/* BSD style release date */
+#define BPF_RELEASE 199606
+
+/* Date when COP instructions and external memory have been released. */
+#define BPF_COP_EXTMEM_RELEASE 20140624
+
+__BEGIN_DECLS
+
+typedef	int bpf_int32;
+typedef	u_int bpf_u_int32;
+
+/*
+ * Alignment macros.  BPF_WORDALIGN rounds up to the next
+ * even multiple of BPF_ALIGNMENT.
+ */
+#define BPF_ALIGNMENT sizeof(long)
+#define BPF_ALIGNMENT32 sizeof(int)
+
+#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
+#define BPF_WORDALIGN32(x) (((x)+(BPF_ALIGNMENT32-1))&~(BPF_ALIGNMENT32-1))
+
+#define BPF_MAXINSNS 512
+#define BPF_DFLTBUFSIZE (1024*1024)	/* default static upper limit */
+#define BPF_MAXBUFSIZE (1024*1024*16)	/* hard limit on sysctl'able value */
+#define BPF_MINBUFSIZE 32
+
+/*
+ *  Structure for BIOCSETF.
+ */
+struct bpf_program {
+	u_int bf_len;
+	struct bpf_insn *bf_insns;
+};
+
+/*
+ * Struct returned by BIOCGSTATS and net.bpf.stats sysctl.
+ */
+struct bpf_stat {
+	uint64_t bs_recv;	/* number of packets received */
+	uint64_t bs_drop;	/* number of packets dropped */
+	uint64_t bs_capt;	/* number of packets captured */
+	uint64_t bs_padding[13];
+};
+
+/*
+ * Struct returned by BIOCGSTATSOLD.
+ */
+struct bpf_stat_old {
+	u_int bs_recv;		/* number of packets received */
+	u_int bs_drop;		/* number of packets dropped */
+};
+
+/*
+ * Struct return by BIOCVERSION.  This represents the version number of
+ * the filter language described by the instruction encodings below.
+ * bpf understands a program iff kernel_major == filter_major &&
+ * kernel_minor >= filter_minor, that is, if the value returned by the
+ * running kernel has the same major number and a minor number equal
+ * equal to or less than the filter being downloaded.  Otherwise, the
+ * results are undefined, meaning an error may be returned or packets
+ * may be accepted haphazardly.
+ * It has nothing to do with the source code version.
+ */
+struct bpf_version {
+	u_short bv_major;
+	u_short bv_minor;
+};
+/* Current version number of filter architecture. */
+#define BPF_MAJOR_VERSION 1
+#define BPF_MINOR_VERSION 1
+
+/*
+ * BPF ioctls
+ *
+ * The first set is for compatibility with Sun's pcc style
+ * header files.  If your using gcc, we assume that you
+ * have run fixincludes so the latter set should work.
+ */
+#define BIOCGBLEN	 _IOR('B',102, u_int)
+#define BIOCSBLEN	_IOWR('B',102, u_int)
+#define BIOCSETF	 _IOW('B',103, struct bpf_program)
+#define BIOCFLUSH	  _IO('B',104)
+#define BIOCPROMISC	  _IO('B',105)
+#define BIOCGDLT	 _IOR('B',106, u_int)
+#define BIOCGETIF	 _IOR('B',107, struct ifreq)
+#define BIOCSETIF	 _IOW('B',108, struct ifreq)
+#ifdef COMPAT_50
+#include <compat/sys/time.h>
+#define BIOCSORTIMEOUT	 _IOW('B',109, struct timeval50)
+#define BIOCGORTIMEOUT	 _IOR('B',110, struct timeval50)
+#endif
+#define BIOCGSTATS	 _IOR('B',111, struct bpf_stat)
+#define BIOCGSTATSOLD	 _IOR('B',111, struct bpf_stat_old)
+#define BIOCIMMEDIATE	 _IOW('B',112, u_int)
+#define BIOCVERSION	 _IOR('B',113, struct bpf_version)
+#define BIOCSTCPF	 _IOW('B',114, struct bpf_program)
+#define BIOCSUDPF	 _IOW('B',115, struct bpf_program)
+#define BIOCGHDRCMPLT	 _IOR('B',116, u_int)
+#define BIOCSHDRCMPLT	 _IOW('B',117, u_int)
+#define BIOCSDLT	 _IOW('B',118, u_int)
+#define BIOCGDLTLIST	_IOWR('B',119, struct bpf_dltlist)
+#define BIOCGSEESENT	 _IOR('B',120, u_int)
+#define BIOCSSEESENT	 _IOW('B',121, u_int)
+#define BIOCSRTIMEOUT	 _IOW('B',122, struct timeval)
+#define BIOCGRTIMEOUT	 _IOR('B',123, struct timeval)
+#define BIOCGFEEDBACK	 _IOR('B',124, u_int)
+#define BIOCSFEEDBACK	 _IOW('B',125, u_int)
+#define BIOCFEEDBACK     BIOCSFEEDBACK		/* FreeBSD name */
+
+/*
+ * Structure prepended to each packet. This is "wire" format, so we
+ * cannot change it unfortunately to 64 bit times on 32 bit systems [yet].
+ */
+struct bpf_timeval {
+	long tv_sec;
+	long tv_usec;
+};
+
+struct bpf_timeval32 {
+	int32_t tv_sec;
+	int32_t tv_usec;
+};
+
+struct bpf_hdr {
+	struct bpf_timeval bh_tstamp;	/* time stamp */
+	uint32_t	bh_caplen;	/* length of captured portion */
+	uint32_t	bh_datalen;	/* original length of packet */
+	uint16_t	bh_hdrlen;	/* length of bpf header (this struct
+					   plus alignment padding) */
+};
+
+struct bpf_hdr32 {
+	struct bpf_timeval32 bh_tstamp;	/* time stamp */
+	uint32_t	bh_caplen;	/* length of captured portion */
+	uint32_t	bh_datalen;	/* original length of packet */
+	uint16_t	bh_hdrlen;	/* length of bpf header (this struct
+					   plus alignment padding) */
+};
+/*
+ * Because the structure above is not a multiple of 4 bytes, some compilers
+ * will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work.
+ * Only the kernel needs to know about it; applications use bh_hdrlen.
+ * XXX To save a few bytes on 32-bit machines, we avoid end-of-struct
+ * XXX padding by using the size of the header data elements.  This is
+ * XXX fail-safe: on new machines, we just use the 'safe' sizeof.
+ */
+#ifdef _KERNEL
+#if defined(__arm32__) || defined(__i386__) || defined(__m68k__) || \
+    defined(__mips__) || defined(__ns32k__) || defined(__vax__) || \
+    defined(__sh__) || (defined(__sparc__) && !defined(__sparc64__))
+#define SIZEOF_BPF_HDR 18
+#define SIZEOF_BPF_HDR32 18
+#else
+#define SIZEOF_BPF_HDR sizeof(struct bpf_hdr)
+#define SIZEOF_BPF_HDR32 sizeof(struct bpf_hdr32)
+#endif
+#endif
+
+/* Pull in data-link level type codes. */
+#include <net/dlt.h>
+
+/*
+ * The instruction encodings.
+ */
+/* instruction classes */
+#define BPF_CLASS(code) ((code) & 0x07)
+#define		BPF_LD		0x00
+#define		BPF_LDX		0x01
+#define		BPF_ST		0x02
+#define		BPF_STX		0x03
+#define		BPF_ALU		0x04
+#define		BPF_JMP		0x05
+#define		BPF_RET		0x06
+#define		BPF_MISC	0x07
+
+/* ld/ldx fields */
+#define BPF_SIZE(code)	((code) & 0x18)
+#define		BPF_W		0x00
+#define		BPF_H		0x08
+#define		BPF_B		0x10
+/*				0x18	reserved; used by BSD/OS */
+#define BPF_MODE(code)	((code) & 0xe0)
+#define		BPF_IMM 	0x00
+#define		BPF_ABS		0x20
+#define		BPF_IND		0x40
+#define		BPF_MEM		0x60
+#define		BPF_LEN		0x80
+#define		BPF_MSH		0xa0
+/*				0xc0	reserved; used by BSD/OS */
+/*				0xe0	reserved; used by BSD/OS */
+
+/* alu/jmp fields */
+#define BPF_OP(code)	((code) & 0xf0)
+#define		BPF_ADD		0x00
+#define		BPF_SUB		0x10
+#define		BPF_MUL		0x20
+#define		BPF_DIV		0x30
+#define		BPF_OR		0x40
+#define		BPF_AND		0x50
+#define		BPF_LSH		0x60
+#define		BPF_RSH		0x70
+#define		BPF_NEG		0x80
+#define		BPF_MOD		0x90
+#define		BPF_XOR		0xa0
+/*				0xb0	reserved */
+/*				0xc0	reserved */
+/*				0xd0	reserved */
+/*				0xe0	reserved */
+/*				0xf0	reserved */
+#define		BPF_JA		0x00
+#define		BPF_JEQ		0x10
+#define		BPF_JGT		0x20
+#define		BPF_JGE		0x30
+#define		BPF_JSET	0x40
+/*				0x50	reserved; used by BSD/OS */
+/*				0x60	reserved */
+/*				0x70	reserved */
+/*				0x80	reserved */
+/*				0x90	reserved */
+/*				0xa0	reserved */
+/*				0xb0	reserved */
+/*				0xc0	reserved */
+/*				0xd0	reserved */
+/*				0xe0	reserved */
+/*				0xf0	reserved */
+#define BPF_SRC(code)	((code) & 0x08)
+#define		BPF_K		0x00
+#define		BPF_X		0x08
+
+/* ret - BPF_K and BPF_X also apply */
+#define BPF_RVAL(code)	((code) & 0x18)
+#define		BPF_A		0x10
+/*				0x18	reserved */
+
+/* misc */
+#define BPF_MISCOP(code) ((code) & 0xf8)
+#define		BPF_TAX		0x00
+/*				0x10	reserved */
+/*				0x18	reserved */
+#define		BPF_COP		0x20
+/*				0x28	reserved */
+/*				0x30	reserved */
+/*				0x38	reserved */
+#define		BPF_COPX	0x40	/* XXX: also used by BSD/OS */
+/*				0x48	reserved */
+/*				0x50	reserved */
+/*				0x58	reserved */
+/*				0x60	reserved */
+/*				0x68	reserved */
+/*				0x70	reserved */
+/*				0x78	reserved */
+#define		BPF_TXA		0x80
+/*				0x88	reserved */
+/*				0x90	reserved */
+/*				0x98	reserved */
+/*				0xa0	reserved */
+/*				0xa8	reserved */
+/*				0xb0	reserved */
+/*				0xb8	reserved */
+/*				0xc0	reserved; used by BSD/OS */
+/*				0xc8	reserved */
+/*				0xd0	reserved */
+/*				0xd8	reserved */
+/*				0xe0	reserved */
+/*				0xe8	reserved */
+/*				0xf0	reserved */
+/*				0xf8	reserved */
+
+/*
+ * The instruction data structure.
+ */
+struct bpf_insn {
+	uint16_t  code;
+	u_char 	  jt;
+	u_char 	  jf;
+	uint32_t  k;
+};
+
+/*
+ * Macros for insn array initializers.
+ */
+#define BPF_STMT(code, k) { (uint16_t)(code), 0, 0, k }
+#define BPF_JUMP(code, k, jt, jf) { (uint16_t)(code), jt, jf, k }
+
+/*
+ * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
+ */
+#define	BPF_MEMWORDS		16
+
+/*
+ * bpf_memword_init_t: bits indicate which words in the external memory
+ * store will be initialised by the caller before BPF program execution.
+ */
+typedef uint32_t bpf_memword_init_t;
+#define	BPF_MEMWORD_INIT(k)	(UINT32_C(1) << (k))
+
+/* Note: two most significant bits are reserved by bpfjit. */
+__CTASSERT(BPF_MEMWORDS + 2 <= sizeof(bpf_memword_init_t) * NBBY);
+
+#ifdef _KERNEL
+/*
+ * Max number of external memory words (for BPF_LD|BPF_MEM and BPF_ST).
+ */
+#define	BPF_MAX_MEMWORDS	30
+
+__CTASSERT(BPF_MAX_MEMWORDS >= BPF_MEMWORDS);
+__CTASSERT(BPF_MAX_MEMWORDS + 2 <= sizeof(bpf_memword_init_t) * NBBY);
+#endif
+
+/*
+ * Structure to retrieve available DLTs for the interface.
+ */
+struct bpf_dltlist {
+	u_int	bfl_len;	/* number of bfd_list array */
+	u_int	*bfl_list;	/* array of DLTs */
+};
+
+struct bpf_ctx;
+typedef struct bpf_ctx bpf_ctx_t;
+
+typedef struct bpf_args {
+	const uint8_t *	pkt;
+	size_t		wirelen;
+	size_t		buflen;
+	/*
+	 * The following arguments are used only by some kernel
+	 * subsystems.
+	 * They aren't required for classical bpf filter programs.
+	 * For such programs, bpfjit generated code doesn't read
+	 * those arguments at all. Note however that bpf interpreter
+	 * always needs a pointer to memstore.
+	 */
+	uint32_t *	mem; /* pointer to external memory store */
+	void *		arg; /* auxiliary argument for a copfunc */
+} bpf_args_t;
+
+#if defined(_KERNEL) || defined(__BPF_PRIVATE)
+
+typedef uint32_t (*bpf_copfunc_t)(const bpf_ctx_t *, bpf_args_t *, uint32_t);
+
+struct bpf_ctx {
+	/*
+	 * BPF coprocessor functions and the number of them.
+	 */
+	const bpf_copfunc_t *	copfuncs;
+	size_t			nfuncs;
+
+	/*
+	 * The number of memory words in the external memory store.
+	 * There may be up to BPF_MAX_MEMWORDS words; if zero is set,
+	 * then the internal memory store is used which has a fixed
+	 * number of words (BPF_MEMWORDS).
+	 */
+	size_t			extwords;
+
+	/*
+	 * The bitmask indicating which words in the external memstore
+	 * will be initialised by the caller.
+	 */
+	bpf_memword_init_t	preinited;
+};
+#endif
+
+#ifdef _KERNEL
+#include <net/bpfjit.h>
+#include <net/if.h>
+
+struct bpf_if;
+
+struct bpf_ops {
+	void (*bpf_attach)(struct ifnet *, u_int, u_int, struct bpf_if **);
+	void (*bpf_detach)(struct ifnet *);
+	void (*bpf_change_type)(struct ifnet *, u_int, u_int);
+
+	void (*bpf_tap)(struct bpf_if *, u_char *, u_int);
+	void (*bpf_mtap)(struct bpf_if *, struct mbuf *);
+	void (*bpf_mtap2)(struct bpf_if *, void *, u_int, struct mbuf *);
+	void (*bpf_mtap_af)(struct bpf_if *, uint32_t, struct mbuf *);
+	void (*bpf_mtap_sl_in)(struct bpf_if *, u_char *, struct mbuf **);
+	void (*bpf_mtap_sl_out)(struct bpf_if *, u_char *, struct mbuf *);
+};
+
+extern struct bpf_ops *bpf_ops;
+
+static inline void
+bpf_attach(struct ifnet *_ifp, u_int _dlt, u_int _hdrlen)
+{
+	bpf_ops->bpf_attach(_ifp, _dlt, _hdrlen, &_ifp->if_bpf);
+}
+
+static inline void
+bpf_attach2(struct ifnet *_ifp, u_int _dlt, u_int _hdrlen, struct bpf_if **_dp)
+{
+	bpf_ops->bpf_attach(_ifp, _dlt, _hdrlen, _dp);
+}
+
+static inline void
+bpf_tap(struct ifnet *_ifp, u_char *_pkt, u_int _len)
+{
+	if (_ifp->if_bpf)
+		bpf_ops->bpf_tap(_ifp->if_bpf, _pkt, _len);
+}
+
+static inline void
+bpf_mtap(struct ifnet *_ifp, struct mbuf *_m)
+{
+	if (_ifp->if_bpf)
+		bpf_ops->bpf_mtap(_ifp->if_bpf, _m);
+}
+
+static inline void
+bpf_mtap2(struct bpf_if *_bpf, void *_data, u_int _dlen, struct mbuf *_m)
+{
+	bpf_ops->bpf_mtap2(_bpf, _data, _dlen, _m);
+}
+
+static inline void
+bpf_mtap3(struct bpf_if *_bpf, struct mbuf *_m)
+{
+	if (_bpf)
+		bpf_ops->bpf_mtap(_bpf, _m);
+}
+
+static inline void
+bpf_mtap_af(struct ifnet *_ifp, uint32_t _af, struct mbuf *_m)
+{
+	if (_ifp->if_bpf)
+		bpf_ops->bpf_mtap_af(_ifp->if_bpf, _af, _m);
+}
+
+static inline void
+bpf_change_type(struct ifnet *_ifp, u_int _dlt, u_int _hdrlen)
+{
+	bpf_ops->bpf_change_type(_ifp, _dlt, _hdrlen);
+}
+
+static inline void
+bpf_detach(struct ifnet *_ifp)
+{
+	bpf_ops->bpf_detach(_ifp);
+}
+
+static inline void
+bpf_mtap_sl_in(struct ifnet *_ifp, u_char *_hdr, struct mbuf **_m)
+{
+	bpf_ops->bpf_mtap_sl_in(_ifp->if_bpf, _hdr, _m);
+}
+
+static inline void
+bpf_mtap_sl_out(struct ifnet *_ifp, u_char *_hdr, struct mbuf *_m)
+{
+	if (_ifp->if_bpf)
+		bpf_ops->bpf_mtap_sl_out(_ifp->if_bpf, _hdr, _m);
+}
+
+
+void	bpf_setops(void);
+
+void	bpf_ops_handover_enter(struct bpf_ops *);
+void	bpf_ops_handover_exit(void);
+
+void	bpfilterattach(int);
+
+bpf_ctx_t *bpf_create(void);
+void	bpf_destroy(bpf_ctx_t *);
+
+int	bpf_set_cop(bpf_ctx_t *, const bpf_copfunc_t *, size_t);
+int	bpf_set_extmem(bpf_ctx_t *, size_t, bpf_memword_init_t);
+u_int	bpf_filter_ext(const bpf_ctx_t *, const struct bpf_insn *, bpf_args_t *);
+int	bpf_validate_ext(const bpf_ctx_t *, const struct bpf_insn *, int);
+
+bpfjit_func_t bpf_jit_generate(bpf_ctx_t *, void *, size_t);
+void	bpf_jit_freecode(bpfjit_func_t);
+
+#endif
+
+int	bpf_validate(const struct bpf_insn *, int);
+u_int	bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
+
+__END_DECLS
+
+#endif /* !_NET_BPF_H_ */

Property changes on: lab4/.minix-src/include/net/bpf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/ethertypes.h
===================================================================
--- lab4/.minix-src/include/net/ethertypes.h	(nonexistent)
+++ lab4/.minix-src/include/net/ethertypes.h	(revision 13)
@@ -0,0 +1,315 @@
+/*	$NetBSD: ethertypes.h,v 1.18 2012/09/23 01:14:19 chs Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)if_ether.h	8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * Ethernet protocol types.
+ *
+ * According to "assigned numbers", the Ethernet protocol numbers are also
+ * used as ARP protocol type numbers.
+ *
+ * I factor them out here to avoid pulling all the Ethernet header file
+ * into the hardware independent ARP code. -is
+ *
+ * Additional sources of information:
+ *	http://www.mit.edu/~map/Ethernet/Ethernet.txt
+ *	ftp://venera.isi.edu/in-notes/iana/assignments/ethernet-numbers
+ *
+ */
+
+#ifndef _NET_ETHERTYPES_H_
+#define	_NET_ETHERTYPES_H_
+
+/*
+ *  NOTE: 0x0000-0x05DC (0..1500) are generally IEEE 802.3 length fields.
+ *  However, there are some conflicts.
+ */
+
+#define	ETHERTYPE_8023		0x0004	/* IEEE 802.3 packet */
+		   /* 0x0101 .. 0x1FF	   Experimental */
+#define	ETHERTYPE_PUP		0x0200	/* Xerox PUP protocol - see 0A00 */
+#define	ETHERTYPE_PUPAT		0x0200	/* PUP Address Translation - see 0A01 */
+#define	ETHERTYPE_SPRITE	0x0500	/* ??? */
+			     /* 0x0400	   Nixdorf */
+#define	ETHERTYPE_NS		0x0600	/* XNS */
+#define	ETHERTYPE_NSAT		0x0601	/* XNS Address Translation (3Mb only) */
+#define	ETHERTYPE_DLOG1 	0x0660	/* DLOG (?) */
+#define	ETHERTYPE_DLOG2 	0x0661	/* DLOG (?) */
+#define	ETHERTYPE_IP		0x0800	/* IP protocol */
+#define	ETHERTYPE_X75		0x0801	/* X.75 Internet */
+#define	ETHERTYPE_NBS		0x0802	/* NBS Internet */
+#define	ETHERTYPE_ECMA		0x0803	/* ECMA Internet */
+#define	ETHERTYPE_CHAOS 	0x0804	/* CHAOSnet */
+#define	ETHERTYPE_X25		0x0805	/* X.25 Level 3 */
+#define	ETHERTYPE_ARP		0x0806	/* Address resolution protocol */
+#define	ETHERTYPE_NSCOMPAT	0x0807	/* XNS Compatibility */
+#define	ETHERTYPE_FRARP 	0x0808	/* Frame Relay ARP (RFC1701) */
+			     /* 0x081C	   Symbolics Private */
+		    /* 0x0888 - 0x088A	   Xyplex */
+#define	ETHERTYPE_UBDEBUG	0x0900	/* Ungermann-Bass network debugger */
+#define	ETHERTYPE_IEEEPUP	0x0A00	/* Xerox IEEE802.3 PUP */
+#define	ETHERTYPE_IEEEPUPAT	0x0A01	/* Xerox IEEE802.3 PUP Address Translation */
+#define	ETHERTYPE_VINES 	0x0BAD	/* Banyan VINES */
+#define	ETHERTYPE_VINESLOOP	0x0BAE	/* Banyan VINES Loopback */
+#define	ETHERTYPE_VINESECHO	0x0BAF	/* Banyan VINES Echo */
+
+/*		       0x1000 - 0x100F	   Berkeley Trailer */
+/*
+ * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
+ * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
+ * by an ETHER type (as given above) and then the (variable-length) header.
+ */
+#define	ETHERTYPE_TRAIL		0x1000	/* Trailer packet */
+#define	ETHERTYPE_NTRAILER	16
+
+#define	ETHERTYPE_DCA		0x1234	/* DCA - Multicast */
+#define	ETHERTYPE_VALID 	0x1600	/* VALID system protocol */
+#define	ETHERTYPE_DOGFIGHT	0x1989	/* Artificial Horizons ("Aviator" dogfight simulator [on Sun]) */
+#define	ETHERTYPE_RCL		0x1995	/* Datapoint Corporation (RCL lan protocol) */
+
+					/* The following 3C0x types
+					   are unregistered: */
+#define	ETHERTYPE_NBPVCD	0x3C00	/* 3Com NBP virtual circuit datagram (like XNS SPP) not registered */
+#define	ETHERTYPE_NBPSCD	0x3C01	/* 3Com NBP System control datagram not registered */
+#define	ETHERTYPE_NBPCREQ	0x3C02	/* 3Com NBP Connect request (virtual cct) not registered */
+#define	ETHERTYPE_NBPCRSP	0x3C03	/* 3Com NBP Connect repsonse not registered */
+#define	ETHERTYPE_NBPCC		0x3C04	/* 3Com NBP Connect complete not registered */
+#define	ETHERTYPE_NBPCLREQ	0x3C05	/* 3Com NBP Close request (virtual cct) not registered */
+#define	ETHERTYPE_NBPCLRSP	0x3C06	/* 3Com NBP Close response not registered */
+#define	ETHERTYPE_NBPDG		0x3C07	/* 3Com NBP Datagram (like XNS IDP) not registered */
+#define	ETHERTYPE_NBPDGB	0x3C08	/* 3Com NBP Datagram broadcast not registered */
+#define	ETHERTYPE_NBPCLAIM	0x3C09	/* 3Com NBP Claim NetBIOS name not registered */
+#define	ETHERTYPE_NBPDLTE	0x3C0A	/* 3Com NBP Delete Netbios name not registered */
+#define	ETHERTYPE_NBPRAS	0x3C0B	/* 3Com NBP Remote adaptor status request not registered */
+#define	ETHERTYPE_NBPRAR	0x3C0C	/* 3Com NBP Remote adaptor response not registered */
+#define	ETHERTYPE_NBPRST	0x3C0D	/* 3Com NBP Reset not registered */
+
+#define	ETHERTYPE_PCS		0x4242	/* PCS Basic Block Protocol */
+#define	ETHERTYPE_IMLBLDIAG	0x424C	/* Information Modes Little Big LAN diagnostic */
+#define	ETHERTYPE_DIDDLE	0x4321	/* THD - Diddle */
+#define	ETHERTYPE_IMLBL		0x4C42	/* Information Modes Little Big LAN */
+#define	ETHERTYPE_SIMNET	0x5208	/* BBN Simnet Private */
+#define	ETHERTYPE_DECEXPER	0x6000	/* DEC Unassigned, experimental */
+#define	ETHERTYPE_MOPDL		0x6001	/* DEC MOP dump/load */
+#define	ETHERTYPE_MOPRC		0x6002	/* DEC MOP remote console */
+#define	ETHERTYPE_DECnet	0x6003	/* DEC DECNET Phase IV route */
+#define	ETHERTYPE_DN		ETHERTYPE_DECnet	/* libpcap, tcpdump */
+#define	ETHERTYPE_LAT		0x6004	/* DEC LAT */
+#define	ETHERTYPE_DECDIAG	0x6005	/* DEC diagnostic protocol (at interface initialization?) */
+#define	ETHERTYPE_DECCUST	0x6006	/* DEC customer protocol */
+#define	ETHERTYPE_SCA		0x6007	/* DEC LAVC, SCA */
+#define	ETHERTYPE_AMBER		0x6008	/* DEC AMBER */
+#define	ETHERTYPE_DECMUMPS	0x6009	/* DEC MUMPS */
+		    /* 0x6010 - 0x6014	   3Com Corporation */
+#define	ETHERTYPE_TRANSETHER	0x6558	/* Trans Ether Bridging (RFC1701)*/
+#define	ETHERTYPE_RAWFR		0x6559	/* Raw Frame Relay (RFC1701) */
+#define	ETHERTYPE_UBDL		0x7000	/* Ungermann-Bass download */
+#define	ETHERTYPE_UBNIU		0x7001	/* Ungermann-Bass NIUs */
+#define	ETHERTYPE_UBDIAGLOOP	0x7002	/* Ungermann-Bass diagnostic/loopback */
+#define	ETHERTYPE_UBNMC		0x7003	/* Ungermann-Bass ??? (NMC to/from UB Bridge) */
+#define	ETHERTYPE_UBBST		0x7005	/* Ungermann-Bass Bridge Spanning Tree */
+#define	ETHERTYPE_OS9		0x7007	/* OS/9 Microware */
+#define	ETHERTYPE_OS9NET	0x7009	/* OS/9 Net? */
+		    /* 0x7020 - 0x7029	   LRT (England) (now Sintrom) */
+#define	ETHERTYPE_RACAL		0x7030	/* Racal-Interlan */
+#define	ETHERTYPE_PRIMENTS	0x7031	/* Prime NTS (Network Terminal Service) */
+#define	ETHERTYPE_CABLETRON	0x7034	/* Cabletron */
+#define	ETHERTYPE_CRONUSVLN	0x8003	/* Cronus VLN */
+#define	ETHERTYPE_CRONUS	0x8004	/* Cronus Direct */
+#define	ETHERTYPE_HP		0x8005	/* HP Probe */
+#define	ETHERTYPE_NESTAR	0x8006	/* Nestar */
+#define	ETHERTYPE_ATTSTANFORD	0x8008	/* AT&T/Stanford (local use) */
+#define	ETHERTYPE_EXCELAN	0x8010	/* Excelan */
+#define	ETHERTYPE_SG_DIAG	0x8013	/* SGI diagnostic type */
+#define	ETHERTYPE_SG_NETGAMES	0x8014	/* SGI network games */
+#define	ETHERTYPE_SG_RESV	0x8015	/* SGI reserved type */
+#define	ETHERTYPE_SG_BOUNCE	0x8016	/* SGI bounce server */
+#define	ETHERTYPE_APOLLODOMAIN	0x8019	/* Apollo DOMAIN */
+#define	ETHERTYPE_TYMSHARE	0x802E	/* Tymeshare */
+#define	ETHERTYPE_TIGAN		0x802F	/* Tigan, Inc. */
+#define	ETHERTYPE_REVARP	0x8035	/* Reverse addr resolution protocol */
+#define	ETHERTYPE_AEONIC	0x8036	/* Aeonic Systems */
+#define	ETHERTYPE_IPXNEW	0x8037	/* IPX (Novell Netware?) */
+#define	ETHERTYPE_LANBRIDGE	0x8038	/* DEC LANBridge */
+#define	ETHERTYPE_DSMD	0x8039	/* DEC DSM/DDP */
+#define	ETHERTYPE_ARGONAUT	0x803A	/* DEC Argonaut Console */
+#define	ETHERTYPE_VAXELN	0x803B	/* DEC VAXELN */
+#define	ETHERTYPE_DECDNS	0x803C	/* DEC DNS Naming Service */
+#define	ETHERTYPE_ENCRYPT	0x803D	/* DEC Ethernet Encryption */
+#define	ETHERTYPE_DECDTS	0x803E	/* DEC Distributed Time Service */
+#define	ETHERTYPE_DECLTM	0x803F	/* DEC LAN Traffic Monitor */
+#define	ETHERTYPE_DECNETBIOS	0x8040	/* DEC PATHWORKS DECnet NETBIOS Emulation */
+#define	ETHERTYPE_DECLAST	0x8041	/* DEC Local Area System Transport */
+			     /* 0x8042	   DEC Unassigned */
+#define	ETHERTYPE_PLANNING	0x8044	/* Planning Research Corp. */
+		    /* 0x8046 - 0x8047	   AT&T */
+#define	ETHERTYPE_DECAM		0x8048	/* DEC Availability Manager for Distributed Systems DECamds (but someone at DEC says not) */
+#define	ETHERTYPE_EXPERDATA	0x8049	/* ExperData */
+#define	ETHERTYPE_VEXP		0x805B	/* Stanford V Kernel exp. */
+#define	ETHERTYPE_VPROD		0x805C	/* Stanford V Kernel prod. */
+#define	ETHERTYPE_ES		0x805D	/* Evans & Sutherland */
+#define	ETHERTYPE_LITTLE	0x8060	/* Little Machines */
+#define	ETHERTYPE_COUNTERPOINT	0x8062	/* Counterpoint Computers */
+		    /* 0x8065 - 0x8066	   Univ. of Mass @ Amherst */
+#define	ETHERTYPE_VEECO		0x8067	/* Veeco Integrated Auto. */
+#define	ETHERTYPE_GENDYN	0x8068	/* General Dynamics */
+#define	ETHERTYPE_ATT		0x8069	/* AT&T */
+#define	ETHERTYPE_AUTOPHON	0x806A	/* Autophon */
+#define	ETHERTYPE_COMDESIGN	0x806C	/* ComDesign */
+#define	ETHERTYPE_COMPUGRAPHIC	0x806D	/* Compugraphic Corporation */
+		    /* 0x806E - 0x8077	   Landmark Graphics Corp. */
+#define	ETHERTYPE_MATRA		0x807A	/* Matra */
+#define	ETHERTYPE_DDE		0x807B	/* Dansk Data Elektronik */
+#define	ETHERTYPE_MERIT		0x807C	/* Merit Internodal (or Univ of Michigan?) */
+		    /* 0x807D - 0x807F	   Vitalink Communications */
+#define	ETHERTYPE_VLTLMAN	0x8080	/* Vitalink TransLAN III Management */
+		    /* 0x8081 - 0x8083	   Counterpoint Computers */
+		    /* 0x8088 - 0x808A	   Xyplex */
+#define	ETHERTYPE_ATALK		0x809B	/* AppleTalk */
+#define	ETHERTYPE_AT		ETHERTYPE_ATALK		/* old NetBSD */
+#define	ETHERTYPE_APPLETALK	ETHERTYPE_ATALK		/* HP-UX */
+		    /* 0x809C - 0x809E	   Datability */
+#define	ETHERTYPE_SPIDER	0x809F	/* Spider Systems Ltd. */
+			     /* 0x80A3	   Nixdorf */
+		    /* 0x80A4 - 0x80B3	   Siemens Gammasonics Inc. */
+		    /* 0x80C0 - 0x80C3	   DCA (Digital Comm. Assoc.) Data Exchange Cluster */
+		    /* 0x80C4 - 0x80C5	   Banyan Systems */
+#define	ETHERTYPE_PACER		0x80C6	/* Pacer Software */
+#define	ETHERTYPE_APPLITEK	0x80C7	/* Applitek Corporation */
+		    /* 0x80C8 - 0x80CC	   Intergraph Corporation */
+		    /* 0x80CD - 0x80CE	   Harris Corporation */
+		    /* 0x80CF - 0x80D2	   Taylor Instrument */
+		    /* 0x80D3 - 0x80D4	   Rosemount Corporation */
+#define	ETHERTYPE_SNA		0x80D5	/* IBM SNA Services over Ethernet */
+#define	ETHERTYPE_VARIAN	0x80DD	/* Varian Associates */
+		    /* 0x80DE - 0x80DF	   TRFS (Integrated Solutions Transparent Remote File System) */
+		    /* 0x80E0 - 0x80E3	   Allen-Bradley */
+		    /* 0x80E4 - 0x80F0	   Datability */
+#define	ETHERTYPE_RETIX		0x80F2	/* Retix */
+#define	ETHERTYPE_AARP		0x80F3	/* AppleTalk AARP */
+		    /* 0x80F4 - 0x80F5	   Kinetics */
+#define	ETHERTYPE_APOLLO	0x80F7	/* Apollo Computer */
+#define ETHERTYPE_VLAN		0x8100	/* IEEE 802.1Q VLAN tagging (XXX conflicts) */
+		    /* 0x80FF - 0x8101	   Wellfleet Communications (XXX conflicts) */
+#define	ETHERTYPE_BOFL		0x8102	/* Wellfleet; BOFL (Breath OF Life) pkts [every 5-10 secs.] */
+#define	ETHERTYPE_WELLFLEET	0x8103	/* Wellfleet Communications */
+		    /* 0x8107 - 0x8109	   Symbolics Private */
+#define	ETHERTYPE_TALARIS	0x812B	/* Talaris */
+#define	ETHERTYPE_WATERLOO	0x8130	/* Waterloo Microsystems Inc. (XXX which?) */
+#define	ETHERTYPE_HAYES		0x8130	/* Hayes Microcomputers (XXX which?) */
+#define	ETHERTYPE_VGLAB		0x8131	/* VG Laboratory Systems */
+		    /* 0x8132 - 0x8137	   Bridge Communications */
+#define	ETHERTYPE_IPX		0x8137	/* Novell (old) NetWare IPX (ECONFIG E option) */
+#define	ETHERTYPE_NOVELL	0x8138	/* Novell, Inc. */
+		    /* 0x8139 - 0x813D	   KTI */
+#define	ETHERTYPE_MUMPS		0x813F	/* M/MUMPS data sharing */
+#define	ETHERTYPE_AMOEBA	0x8145	/* Vrije Universiteit (NL) Amoeba 4 RPC (obsolete) */
+#define	ETHERTYPE_FLIP		0x8146	/* Vrije Universiteit (NL) FLIP (Fast Local Internet Protocol) */
+#define	ETHERTYPE_VURESERVED	0x8147	/* Vrije Universiteit (NL) [reserved] */
+#define	ETHERTYPE_LOGICRAFT	0x8148	/* Logicraft */
+#define	ETHERTYPE_NCD		0x8149	/* Network Computing Devices */
+#define	ETHERTYPE_ALPHA		0x814A	/* Alpha Micro */
+#define	ETHERTYPE_SNMP		0x814C	/* SNMP over Ethernet (see RFC1089) */
+		    /* 0x814D - 0x814E	   BIIN */
+#define	ETHERTYPE_TEC	0x814F	/* Technically Elite Concepts */
+#define	ETHERTYPE_RATIONAL	0x8150	/* Rational Corp */
+		    /* 0x8151 - 0x8153	   Qualcomm */
+		    /* 0x815C - 0x815E	   Computer Protocol Pty Ltd */
+		    /* 0x8164 - 0x8166	   Charles River Data Systems */
+#define	ETHERTYPE_XTP		0x817D	/* Protocol Engines XTP */
+#define	ETHERTYPE_SGITW		0x817E	/* SGI/Time Warner prop. */
+#define	ETHERTYPE_HIPPI_FP	0x8180	/* HIPPI-FP encapsulation */
+#define	ETHERTYPE_STP		0x8181	/* Scheduled Transfer STP, HIPPI-ST */
+		    /* 0x8182 - 0x8183	   Reserved for HIPPI-6400 */
+		    /* 0x8184 - 0x818C	   SGI prop. */
+#define	ETHERTYPE_MOTOROLA	0x818D	/* Motorola */
+#define	ETHERTYPE_NETBEUI	0x8191	/* PowerLAN NetBIOS/NetBEUI (PC) */
+		    /* 0x819A - 0x81A3	   RAD Network Devices */
+		    /* 0x81B7 - 0x81B9	   Xyplex */
+		    /* 0x81CC - 0x81D5	   Apricot Computers */
+		    /* 0x81D6 - 0x81DD	   Artisoft Lantastic */
+		    /* 0x81E6 - 0x81EF	   Polygon */
+		    /* 0x81F0 - 0x81F2	   Comsat Labs */
+		    /* 0x81F3 - 0x81F5	   SAIC */
+		    /* 0x81F6 - 0x81F8	   VG Analytical */
+		    /* 0x8203 - 0x8205	   QNX Software Systems Ltd. */
+		    /* 0x8221 - 0x8222	   Ascom Banking Systems */
+		    /* 0x823E - 0x8240	   Advanced Encryption Systems */
+		    /* 0x8263 - 0x826A	   Charles River Data Systems */
+		    /* 0x827F - 0x8282	   Athena Programming */
+		    /* 0x829A - 0x829B	   Inst Ind Info Tech */
+		    /* 0x829C - 0x82AB	   Taurus Controls */
+		    /* 0x82AC - 0x8693	   Walker Richer & Quinn */
+#define	ETHERTYPE_ACCTON	0x8390	/* Accton Technologies (unregistered) */
+#define	ETHERTYPE_TALARISMC	0x852B	/* Talaris multicast */
+#define	ETHERTYPE_KALPANA	0x8582	/* Kalpana */
+		    /* 0x8694 - 0x869D	   Idea Courier */
+		    /* 0x869E - 0x86A1	   Computer Network Tech */
+		    /* 0x86A3 - 0x86AC	   Gateway Communications */
+#define	ETHERTYPE_SECTRA	0x86DB	/* SECTRA */
+#define	ETHERTYPE_IPV6		0x86DD	/* IP protocol version 6 */
+#define	ETHERTYPE_DELTACON	0x86DE	/* Delta Controls */
+#define	ETHERTYPE_ATOMIC	0x86DF	/* ATOMIC */
+		    /* 0x86E0 - 0x86EF	   Landis & Gyr Powers */
+		    /* 0x8700 - 0x8710	   Motorola */
+#define	ETHERTYPE_RDP		0x8739	/* Control Technology Inc. RDP Without IP */
+#define	ETHERTYPE_MICP		0x873A	/* Control Technology Inc. Mcast Industrial Ctrl Proto. */
+		    /* 0x873B - 0x873C	   Control Technology Inc. Proprietary */
+#define	ETHERTYPE_TCPCOMP	0x876B	/* TCP/IP Compression (RFC1701) */
+#define	ETHERTYPE_IPAS		0x876C	/* IP Autonomous Systems (RFC1701) */
+#define	ETHERTYPE_SECUREDATA	0x876D	/* Secure Data (RFC1701) */
+#define	ETHERTYPE_FLOWCONTROL	0x8808	/* 802.3x flow control packet */
+#define	ETHERTYPE_SLOWPROTOCOLS	0x8809	/* Slow protocols */
+#define	ETHERTYPE_PPP		0x880B	/* PPP (obsolete by PPPOE) */
+#define	ETHERTYPE_HITACHI	0x8820	/* Hitachi Cable (Optoelectronic Systems Laboratory) */
+#define	ETHERTYPE_MPLS		0x8847	/* MPLS Unicast */
+#define	ETHERTYPE_MPLS_MCAST	0x8848	/* MPLS Multicast */
+#define	ETHERTYPE_AXIS		0x8856	/* Axis Communications AB proprietary bootstrap/config */
+#define	ETHERTYPE_PPPOEDISC	0x8863	/* PPP Over Ethernet Discovery Stage */
+#define	ETHERTYPE_PPPOE		0x8864	/* PPP Over Ethernet Session Stage */
+#define	ETHERTYPE_LANPROBE	0x8888	/* HP LanProbe test? */
+#define	ETHERTYPE_PAE		0x888e	/* EAPOL PAE/802.1x */
+#define	ETHERTYPE_AOE		0x88a2	/* ATA over Ethernet */
+#define	ETHERTYPE_FCOE		0x8906	/* Fibre Channel over Ethernet */
+#define	ETHERTYPE_LOOPBACK	0x9000	/* Loopback */
+#define	ETHERTYPE_LBACK		ETHERTYPE_LOOPBACK	/* DEC MOP loopback */
+#define	ETHERTYPE_XNSSM		0x9001	/* 3Com (Formerly Bridge Communications), XNS Systems Management */
+#define	ETHERTYPE_TCPSM		0x9002	/* 3Com (Formerly Bridge Communications), TCP/IP Systems Management */
+#define	ETHERTYPE_BCLOOP	0x9003	/* 3Com (Formerly Bridge Communications), loopback detection */
+#define	ETHERTYPE_DEBNI		0xAAAA	/* DECNET? Used by VAX 6220 DEBNI */
+#define	ETHERTYPE_SONIX		0xFAF5	/* Sonix Arpeggio */
+#define	ETHERTYPE_VITAL		0xFF00	/* BBN VITAL-LanBridge cache wakeups */
+		    /* 0xFF00 - 0xFFOF	   ISC Bunker Ramo */
+
+#define	ETHERTYPE_MAX		0xFFFF	/* Maximum valid ethernet type, reserved */
+
+#endif /* !_NET_ETHERTYPES_H_ */

Property changes on: lab4/.minix-src/include/net/ethertypes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/if_dl.h
===================================================================
--- lab4/.minix-src/include/net/if_dl.h	(nonexistent)
+++ lab4/.minix-src/include/net/if_dl.h	(revision 13)
@@ -0,0 +1,128 @@
+/*	$NetBSD: if_dl.h,v 1.26 2014/12/03 01:31:37 christos Exp $	*/
+
+/*
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)if_dl.h	8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * A Link-Level Sockaddr may specify the interface in one of two
+ * ways: either by means of a system-provided index number (computed
+ * anew and possibly differently on every reboot), or by a human-readable
+ * string such as "il0" (for managerial convenience).
+ *
+ * Census taking actions, such as something akin to SIOCGCONF would return
+ * both the index and the human name.
+ *
+ * High volume transactions (such as giving a link-level ``from'' address
+ * in a recvfrom or recvmsg call) may be likely only to provide the indexed
+ * form, (which requires fewer copy operations and less space).
+ *
+ * The form and interpretation  of the link-level address is purely a matter
+ * of convention between the device driver and its consumers; however, it is
+ * expected that all drivers for an interface of a given if_type will agree.
+ */
+
+#ifndef _NET_IF_DL_H_
+#define _NET_IF_DL_H_
+
+#include <sys/ansi.h>
+
+#ifndef sa_family_t
+typedef __sa_family_t	sa_family_t;
+#define sa_family_t	__sa_family_t
+#endif
+#ifndef socklen_t
+typedef __socklen_t   socklen_t;
+#define socklen_t     __socklen_t
+#endif
+
+struct dl_addr {
+	uint8_t	    dl_type;	/* interface type */
+	uint8_t	    dl_nlen;	/* interface name length, no trailing 0 reqd. */
+	uint8_t	    dl_alen;	/* link level address length */
+	uint8_t	    dl_slen;	/* link layer selector length */
+	/*
+	 * minimum work area, can be larger; contains both if name
+	 * and ll address
+	 */
+	char	    dl_data[12];
+};
+
+/*
+ * Structure of a Link-Level sockaddr:
+ */
+struct sockaddr_dl {
+	uint8_t	    sdl_len;	/* Total length of sockaddr */
+	sa_family_t sdl_family;	/* AF_LINK */
+	uint16_t    sdl_index;	/* if != 0, system given index for interface */
+	struct dl_addr sdl_addr;
+#define sdl_type	sdl_addr.dl_type
+#define sdl_nlen	sdl_addr.dl_nlen
+#define sdl_alen	sdl_addr.dl_alen
+#define sdl_slen	sdl_addr.dl_slen
+#define sdl_data	sdl_addr.dl_data
+};
+
+#define	satosdl(__sa)	((struct sockaddr_dl *)(__sa))
+#define	satocsdl(__sa)	((const struct sockaddr_dl *)(__sa))
+
+/* We do arithmetic directly with these, so keep them char instead of void */
+#define LLADDR(s) ((char *)((s)->sdl_data + (s)->sdl_nlen))
+#define CLLADDR(s) ((const char *)((s)->sdl_data + (s)->sdl_nlen))
+
+#ifdef _KERNEL
+uint8_t sockaddr_dl_measure(uint8_t, uint8_t);
+struct sockaddr *sockaddr_dl_alloc(uint16_t, uint8_t,
+    const void *, uint8_t, const void *, uint8_t, int);
+struct sockaddr_dl *sockaddr_dl_init(struct sockaddr_dl *, socklen_t, uint16_t,
+    uint8_t, const void *, uint8_t, const void *, uint8_t);
+struct sockaddr_dl *sockaddr_dl_setaddr(struct sockaddr_dl *, socklen_t,
+    const void *, uint8_t);
+#else
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+void	link_addr(const char *, struct sockaddr_dl *);
+char	*link_ntoa(const struct sockaddr_dl *);
+__END_DECLS
+
+#endif /* !_KERNEL */
+
+#if defined(_KERNEL) || defined(_TEST)
+// 255 xx: + 255 'a' + / + # + 3 digits + NUL
+#define LINK_ADDRSTRLEN	((255 * 4) + 5)
+
+int	dl_print(char *, size_t, const struct dl_addr *);
+#define DL_PRINT(b, a) (dl_print((b), sizeof(b), (a)), (b))
+int	sdl_print(char *, size_t, const void *);
+#endif
+
+#endif /* !_NET_IF_DL_H_ */

Property changes on: lab4/.minix-src/include/net/if_dl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/if_pflog.h
===================================================================
--- lab4/.minix-src/include/net/if_pflog.h	(nonexistent)
+++ lab4/.minix-src/include/net/if_pflog.h	(revision 13)
@@ -0,0 +1,82 @@
+/*	$NetBSD: if_pflog.h,v 1.5 2008/06/18 09:06:27 yamt Exp $	*/
+/*	$OpenBSD: if_pflog.h,v 1.14 2006/10/25 11:27:01 henning Exp $ */
+
+/*
+ * Copyright 2001 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.
+ */
+
+#ifndef _NET_IF_PFLOG_H_
+#define _NET_IF_PFLOG_H_
+
+#define	PFLOGIFS_MAX	16
+
+struct pflog_softc {
+	struct ifnet		sc_if;		/* the interface */
+	int			sc_unit;
+	LIST_ENTRY(pflog_softc)	sc_list;
+};
+
+#define PFLOG_RULESET_NAME_SIZE	16
+
+struct pfloghdr {
+	u_int8_t	length;
+	sa_family_t	af;
+	u_int8_t	action;
+	u_int8_t	reason;
+	char		ifname[IFNAMSIZ];
+	char		ruleset[PFLOG_RULESET_NAME_SIZE];
+	u_int32_t	rulenr;
+	u_int32_t	subrulenr;
+	uid_t		uid;
+	pid_t		pid;
+	uid_t		rule_uid;
+	pid_t		rule_pid;
+	u_int8_t	dir;
+	u_int8_t	pad[3];
+};
+
+#define PFLOG_HDRLEN		sizeof(struct pfloghdr)
+/* minus pad, also used as a signature */
+#define PFLOG_REAL_HDRLEN	offsetof(struct pfloghdr, pad)
+
+/* XXX remove later when old format logs are no longer needed */
+struct old_pfloghdr {
+	u_int32_t af;
+	char ifname[IFNAMSIZ];
+	short rnr;
+	u_short reason;
+	u_short action;
+	u_short dir;
+};
+#define OLD_PFLOG_HDRLEN	sizeof(struct old_pfloghdr)
+
+#ifdef _KERNEL
+
+#if NPFLOG > 0
+#define	PFLOG_PACKET(i,x,a,b,c,d,e,f,g,h) pflog_packet(i,a,b,c,d,e,f,g,h)
+#else
+#define	PFLOG_PACKET(i,x,a,b,c,d,e,f,g,h) ((void)0)
+#endif /* NPFLOG > 0 */
+#endif /* _KERNEL */
+#endif /* _NET_IF_PFLOG_H_ */

Property changes on: lab4/.minix-src/include/net/if_pflog.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/pfkeyv2.h
===================================================================
--- lab4/.minix-src/include/net/pfkeyv2.h	(nonexistent)
+++ lab4/.minix-src/include/net/pfkeyv2.h	(revision 13)
@@ -0,0 +1,448 @@
+/*	$NetBSD: pfkeyv2.h,v 1.30 2011/06/09 19:54:18 drochner Exp $	*/
+/*	$KAME: pfkeyv2.h,v 1.36 2003/07/25 09:33:37 itojun Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This file has been derived rfc 2367,
+ * And added some flags of SADB_KEY_FLAGS_ as SADB_X_EXT_.
+ *	sakane@ydc.co.jp
+ */
+
+#ifndef _NET_PFKEYV2_H_
+#define _NET_PFKEYV2_H_
+
+/*
+This file defines structures and symbols for the PF_KEY Version 2
+key management interface. It was written at the U.S. Naval Research
+Laboratory. This file is in the public domain. The authors ask that
+you leave this credit intact on any copies of this file.
+*/
+#ifndef __PFKEY_V2_H
+#define __PFKEY_V2_H 1
+
+#define PF_KEY_V2 2
+#define PFKEYV2_REVISION        199806L
+
+#define SADB_RESERVED    0
+#define SADB_GETSPI      1
+#define SADB_UPDATE      2
+#define SADB_ADD         3
+#define SADB_DELETE      4
+#define SADB_GET         5
+#define SADB_ACQUIRE     6
+#define SADB_REGISTER    7
+#define SADB_EXPIRE      8
+#define SADB_FLUSH       9
+#define SADB_DUMP        10
+#define SADB_X_PROMISC   11
+#define SADB_X_PCHANGE   12
+
+#define SADB_X_SPDUPDATE  13
+#define SADB_X_SPDADD     14
+#define SADB_X_SPDDELETE  15	/* by policy index */
+#define SADB_X_SPDGET     16
+#define SADB_X_SPDACQUIRE 17
+#define SADB_X_SPDDUMP    18
+#define SADB_X_SPDFLUSH   19
+#define SADB_X_SPDSETIDX  20
+#define SADB_X_SPDEXPIRE  21	/* not yet */
+#define SADB_X_SPDDELETE2 22	/* by policy id */
+#define SADB_X_NAT_T_NEW_MAPPING 23
+#if 0
+#define	SADB_X_MIGRATE    24	/* KAME */
+#endif
+#define SADB_MAX          23
+
+struct sadb_msg {
+  uint8_t sadb_msg_version;
+  uint8_t sadb_msg_type;
+  uint8_t sadb_msg_errno;
+  uint8_t sadb_msg_satype;
+  uint16_t sadb_msg_len;
+  uint16_t sadb_msg_reserved;
+  uint32_t sadb_msg_seq;
+  uint32_t sadb_msg_pid;
+};
+
+struct sadb_ext {
+  uint16_t sadb_ext_len;
+  uint16_t sadb_ext_type;
+};
+
+struct sadb_sa {
+  uint16_t sadb_sa_len;
+  uint16_t sadb_sa_exttype;
+  uint32_t sadb_sa_spi;
+  uint8_t sadb_sa_replay;
+  uint8_t sadb_sa_state;
+  uint8_t sadb_sa_auth;
+  uint8_t sadb_sa_encrypt;
+  uint32_t sadb_sa_flags;
+};
+
+struct sadb_lifetime {
+  uint16_t sadb_lifetime_len;
+  uint16_t sadb_lifetime_exttype;
+  uint32_t sadb_lifetime_allocations;
+  uint64_t sadb_lifetime_bytes;
+  uint64_t sadb_lifetime_addtime;
+  uint64_t sadb_lifetime_usetime;
+};
+
+struct sadb_address {
+  uint16_t sadb_address_len;
+  uint16_t sadb_address_exttype;
+  uint8_t sadb_address_proto;
+  uint8_t sadb_address_prefixlen;
+  uint16_t sadb_address_reserved;
+};
+
+struct sadb_key {
+  uint16_t sadb_key_len;
+  uint16_t sadb_key_exttype;
+  uint16_t sadb_key_bits;
+  uint16_t sadb_key_reserved;
+};
+
+struct sadb_ident {
+  uint16_t sadb_ident_len;
+  uint16_t sadb_ident_exttype;
+  uint16_t sadb_ident_type;
+  uint16_t sadb_ident_reserved;
+  uint64_t sadb_ident_id;
+};
+
+struct sadb_sens {
+  uint16_t sadb_sens_len;
+  uint16_t sadb_sens_exttype;
+  uint32_t sadb_sens_dpd;
+  uint8_t sadb_sens_sens_level;
+  uint8_t sadb_sens_sens_len;
+  uint8_t sadb_sens_integ_level;
+  uint8_t sadb_sens_integ_len;
+  uint32_t sadb_sens_reserved;
+};
+
+struct sadb_prop {
+  uint16_t sadb_prop_len;
+  uint16_t sadb_prop_exttype;
+  uint8_t sadb_prop_replay;
+  uint8_t sadb_prop_reserved[3];
+};
+
+struct sadb_comb {
+  uint8_t sadb_comb_auth;
+  uint8_t sadb_comb_encrypt;
+  uint16_t sadb_comb_flags;
+  uint16_t sadb_comb_auth_minbits;
+  uint16_t sadb_comb_auth_maxbits;
+  uint16_t sadb_comb_encrypt_minbits;
+  uint16_t sadb_comb_encrypt_maxbits;
+  uint32_t sadb_comb_reserved;
+  uint32_t sadb_comb_soft_allocations;
+  uint32_t sadb_comb_hard_allocations;
+  uint64_t sadb_comb_soft_bytes;
+  uint64_t sadb_comb_hard_bytes;
+  uint64_t sadb_comb_soft_addtime;
+  uint64_t sadb_comb_hard_addtime;
+  uint64_t sadb_comb_soft_usetime;
+  uint64_t sadb_comb_hard_usetime;
+};
+
+struct sadb_supported {
+  uint16_t sadb_supported_len;
+  uint16_t sadb_supported_exttype;
+  uint32_t sadb_supported_reserved;
+};
+
+struct sadb_alg {
+  uint8_t sadb_alg_id;
+  uint8_t sadb_alg_ivlen;
+  uint16_t sadb_alg_minbits;
+  uint16_t sadb_alg_maxbits;
+  uint16_t sadb_alg_reserved;
+};
+
+struct sadb_spirange {
+  uint16_t sadb_spirange_len;
+  uint16_t sadb_spirange_exttype;
+  uint32_t sadb_spirange_min;
+  uint32_t sadb_spirange_max;
+  uint32_t sadb_spirange_reserved;
+};
+
+struct sadb_x_kmprivate {
+  uint16_t sadb_x_kmprivate_len;
+  uint16_t sadb_x_kmprivate_exttype;
+  uint32_t sadb_x_kmprivate_reserved;
+};
+
+/*
+ * XXX Additional SA Extension.
+ * mode: tunnel or transport
+ * reqid: to make SA unique nevertheless the address pair of SA are same.
+ *        Mainly it's for VPN.
+ */
+struct sadb_x_sa2 {
+  uint16_t sadb_x_sa2_len;
+  uint16_t sadb_x_sa2_exttype;
+  uint8_t sadb_x_sa2_mode;
+  uint8_t sadb_x_sa2_reserved1;
+  uint16_t sadb_x_sa2_reserved2;
+  uint32_t sadb_x_sa2_sequence;
+  uint32_t sadb_x_sa2_reqid;		/* topmost 16bits are always 0 */
+};
+
+/* XXX Policy Extension */
+/* sizeof(struct sadb_x_policy) == 16 */
+struct sadb_x_policy {
+  uint16_t sadb_x_policy_len;
+  uint16_t sadb_x_policy_exttype;
+  uint16_t sadb_x_policy_type;		/* See policy type of ipsec.h */
+  uint8_t sadb_x_policy_dir;		/* direction, see ipsec.h */
+  uint8_t sadb_x_policy_reserved;
+  uint32_t sadb_x_policy_id;
+  uint32_t sadb_x_policy_reserved2;
+};
+/*
+ * When policy_type == IPSEC, it is followed by some of
+ * the ipsec policy request.
+ * [total length of ipsec policy requests]
+ *	= (sadb_x_policy_len * sizeof(uint64_t) - sizeof(struct sadb_x_policy))
+ */
+
+/* XXX IPsec Policy Request Extension */
+/*
+ * This structure is aligned 8 bytes.
+ */
+struct sadb_x_ipsecrequest {
+  uint16_t sadb_x_ipsecrequest_len;	/* structure length in 64 bits. */
+  uint16_t sadb_x_ipsecrequest_proto;	/* See ipsec.h */
+  uint8_t sadb_x_ipsecrequest_mode;	/* See IPSEC_MODE_XX in ipsec.h. */
+  uint8_t sadb_x_ipsecrequest_level;	/* See IPSEC_LEVEL_XX in ipsec.h */
+  uint16_t sadb_x_ipsecrequest_reqid;	/* See ipsec.h */
+
+  /*
+   * followed by source IP address of SA, and immediately followed by
+   * destination IP address of SA.  These encoded into two of sockaddr
+   * structure without any padding.  Must set each sa_len exactly.
+   * Each of length of the sockaddr structure are not aligned to 64bits,
+   * but sum of x_request and addresses is aligned to 64bits.
+   */
+};
+
+/* NAT traversal type, see draft-ietf-ipsec-udp-encaps-06 */
+/* sizeof(struct sadb_x_nat_t_type) == 8 */
+struct sadb_x_nat_t_type {
+  uint16_t sadb_x_nat_t_type_len;
+  uint16_t sadb_x_nat_t_type_exttype;
+  uint8_t sadb_x_nat_t_type_type;
+  uint8_t sadb_x_nat_t_type_reserved[3];
+};
+
+/* NAT traversal source or destination port */
+/* sizeof(struct sadb_x_nat_t_port) == 8 */
+struct sadb_x_nat_t_port {
+  uint16_t sadb_x_nat_t_port_len;
+  uint16_t sadb_x_nat_t_port_exttype;
+  uint16_t sadb_x_nat_t_port_port;
+  uint16_t sadb_x_nat_t_port_reserved;
+};
+
+/* ESP fragmentation size */
+/* sizeof(struct sadb_x_nat_t_frag) == 8 */
+struct sadb_x_nat_t_frag {
+  uint16_t sadb_x_nat_t_frag_len;
+  uint16_t sadb_x_nat_t_frag_exttype;
+  uint16_t sadb_x_nat_t_frag_fraglen;
+  uint16_t sadb_x_nat_t_frag_reserved;
+};
+
+
+#define SADB_EXT_RESERVED             0
+#define SADB_EXT_SA                   1
+#define SADB_EXT_LIFETIME_CURRENT     2
+#define SADB_EXT_LIFETIME_HARD        3
+#define SADB_EXT_LIFETIME_SOFT        4
+#define SADB_EXT_ADDRESS_SRC          5
+#define SADB_EXT_ADDRESS_DST          6
+#define SADB_EXT_ADDRESS_PROXY        7
+#define SADB_EXT_KEY_AUTH             8
+#define SADB_EXT_KEY_ENCRYPT          9
+#define SADB_EXT_IDENTITY_SRC         10
+#define SADB_EXT_IDENTITY_DST         11
+#define SADB_EXT_SENSITIVITY          12
+#define SADB_EXT_PROPOSAL             13
+#define SADB_EXT_SUPPORTED_AUTH       14
+#define SADB_EXT_SUPPORTED_ENCRYPT    15
+#define SADB_EXT_SPIRANGE             16
+#define SADB_X_EXT_KMPRIVATE          17
+#define SADB_X_EXT_POLICY             18
+#define SADB_X_EXT_SA2                19
+#define SADB_X_EXT_NAT_T_TYPE         20
+#define SADB_X_EXT_NAT_T_SPORT        21
+#define SADB_X_EXT_NAT_T_DPORT        22
+#define SADB_X_EXT_NAT_T_OA           23	/* compat */
+#define SADB_X_EXT_NAT_T_OAI          23
+#define SADB_X_EXT_NAT_T_OAR          24
+#define SADB_X_EXT_NAT_T_FRAG	      25
+#if 0
+#define	SADB_X_EXT_TAG		      25	/* KAME */
+#define	SADB_X_EXT_SA3		      26	/* KAME */
+#define	SADB_X_EXT_PACKET	      27	/* KAME */
+#endif
+#define SADB_EXT_MAX                  25
+
+#define SADB_SATYPE_UNSPEC	0
+#define SADB_SATYPE_AH		2
+#define SADB_SATYPE_ESP		3
+#define SADB_SATYPE_RSVP	5
+#define SADB_SATYPE_OSPFV2	6
+#define SADB_SATYPE_RIPV2	7
+#define SADB_SATYPE_MIP		8
+#define SADB_X_SATYPE_IPCOMP	9
+/*#define SADB_X_SATYPE_POLICY	10	obsolete, do not reuse */
+#define SADB_X_SATYPE_TCPSIGNATURE	11
+#define SADB_SATYPE_MAX		12
+
+#define SADB_SASTATE_LARVAL   0
+#define SADB_SASTATE_MATURE   1
+#define SADB_SASTATE_DYING    2
+#define SADB_SASTATE_DEAD     3
+#define SADB_SASTATE_MAX      3
+
+#define SADB_SAFLAGS_PFS      1
+
+/* RFC2367 numbers - meets RFC2407 */
+#define SADB_AALG_NONE		0
+#define SADB_AALG_MD5HMAC	2
+#define SADB_AALG_SHA1HMAC	3
+#define SADB_AALG_MAX		251
+/* private allocations - based on RFC2407/IANA assignment */
+#define SADB_X_AALG_SHA2_256	5
+#define SADB_X_AALG_SHA2_384	6
+#define SADB_X_AALG_SHA2_512	7
+#define SADB_X_AALG_RIPEMD160HMAC 8
+#define SADB_X_AALG_AES_XCBC_MAC 9 /* RFC3566 */
+#define SADB_X_AALG_AES128GMAC	11 /* RFC4543 + Errata1821 */
+#define SADB_X_AALG_AES192GMAC	12
+#define SADB_X_AALG_AES256GMAC	13
+/* private allocations should use 249-255 (RFC2407) */
+#define SADB_X_AALG_MD5		249	/* Keyed MD5 */
+#define SADB_X_AALG_SHA		250	/* Keyed SHA */
+#define SADB_X_AALG_NULL	251	/* null authentication */
+#define SADB_X_AALG_TCP_MD5	252	/* Keyed TCP-MD5 (RFC2385) */
+
+/* RFC2367 numbers - meets RFC2407 */
+#define SADB_EALG_NONE		0
+#define SADB_EALG_DESCBC	2
+#define SADB_EALG_3DESCBC	3
+#define SADB_EALG_NULL		11
+#define SADB_EALG_MAX		250
+/* private allocations - based on RFC2407/IANA assignment */
+#define SADB_X_EALG_CAST128CBC	6
+#define SADB_X_EALG_BLOWFISHCBC	7
+#define SADB_X_EALG_RIJNDAELCBC	12
+#define SADB_X_EALG_AES		12
+#define SADB_X_EALG_AESCTR	13 /* RFC3686 */
+#define SADB_X_EALG_AESGCM8	18 /* RFC4106 */
+#define SADB_X_EALG_AESGCM12	19
+#define SADB_X_EALG_AESGCM16	20
+#define SADB_X_EALG_CAMELLIACBC	22 /* RFC4312 */
+#define SADB_X_EALG_AESGMAC	23 /* RFC4543 + Errata1821 */
+/* private allocations should use 249-255 (RFC2407) */
+#define SADB_X_EALG_SKIPJACK    250
+
+/* private allocations - based on RFC2407/IANA assignment */
+#define SADB_X_CALG_NONE	0
+#define SADB_X_CALG_OUI		1
+#define SADB_X_CALG_DEFLATE	2
+#define SADB_X_CALG_LZS		3
+#define SADB_X_CALG_MAX		4
+
+#define SADB_IDENTTYPE_RESERVED   0
+#define SADB_IDENTTYPE_PREFIX     1
+#define SADB_IDENTTYPE_FQDN       2
+#define SADB_IDENTTYPE_USERFQDN   3
+#define SADB_X_IDENTTYPE_ADDR     4
+#define SADB_IDENTTYPE_MAX        4
+
+/* `flags' in sadb_sa structure holds followings */
+#define SADB_X_EXT_NONE		0x0000	/* i.e. new format. */
+#define SADB_X_EXT_OLD		0x0001	/* old format. */
+
+#define SADB_X_EXT_IV4B		0x0010	/* IV length of 4 bytes in use */
+#define SADB_X_EXT_DERIV	0x0020	/* DES derived */
+#define SADB_X_EXT_CYCSEQ	0x0040	/* allowing to cyclic sequence. */
+
+	/* three of followings are exclusive flags each them */
+#define SADB_X_EXT_PSEQ		0x0000	/* sequencial padding for ESP */
+#define SADB_X_EXT_PRAND	0x0100	/* random padding for ESP */
+#define SADB_X_EXT_PZERO	0x0200	/* zero padding for ESP */
+#define SADB_X_EXT_PMASK	0x0300	/* mask for padding flag */
+
+#if 1
+#define SADB_X_EXT_RAWCPI	0x0080	/* use well known CPI (IPComp) */
+#endif
+
+#define SADB_KEY_FLAGS_MAX	0x0fff
+
+/* SPI size for PF_KEYv2 */
+#define PFKEY_SPI_SIZE	sizeof(uint32_t)
+
+/* Identifier for menber of lifetime structure */
+#define SADB_X_LIFETIME_ALLOCATIONS	0
+#define SADB_X_LIFETIME_BYTES		1
+#define SADB_X_LIFETIME_ADDTIME		2
+#define SADB_X_LIFETIME_USETIME		3
+
+/* The rate for SOFT lifetime against HARD one. */
+#define PFKEY_SOFT_LIFETIME_RATE	80
+
+/* Utilities */
+#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1)))
+#define	PFKEY_EXTLEN(msg) \
+	PFKEY_UNUNIT64(((const struct sadb_ext *)(const void *)(msg))->sadb_ext_len)
+#define PFKEY_ADDR_PREFIX(ext) \
+	(((const struct sadb_address *)(const void *)(ext))->sadb_address_prefixlen)
+#define PFKEY_ADDR_PROTO(ext) \
+	(((const struct sadb_address *)(const void *)(ext))->sadb_address_proto)
+#define PFKEY_ADDR_SADDR(ext) \
+	((struct sockaddr *)(void *)((char *)(void *)(ext) + \
+	sizeof(struct sadb_address)))
+
+/* in 64bits */
+#define	PFKEY_UNUNIT64(a)	((a) << 3)
+#define	PFKEY_UNIT64(a)		((a) >> 3)
+
+#endif /* __PFKEY_V2_H */
+
+#endif /* !_NET_PFKEYV2_H_ */

Property changes on: lab4/.minix-src/include/net/pfkeyv2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net80211/ieee80211_crypto.h
===================================================================
--- lab4/.minix-src/include/net80211/ieee80211_crypto.h	(nonexistent)
+++ lab4/.minix-src/include/net80211/ieee80211_crypto.h	(revision 13)
@@ -0,0 +1,232 @@
+/*	$NetBSD: ieee80211_crypto.h,v 1.11 2009/01/03 03:43:23 yamt Exp $	*/
+/*-
+ * Copyright (c) 2001 Atsushi Onoe
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * 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.
+ *
+ * $FreeBSD: src/sys/net80211/ieee80211_crypto.h,v 1.10 2005/08/08 18:46:35 sam Exp $
+ */
+#ifndef _NET80211_IEEE80211_CRYPTO_H_
+#define _NET80211_IEEE80211_CRYPTO_H_
+
+/*
+ * 802.11 protocol crypto-related definitions.
+ */
+#define	IEEE80211_KEYBUF_SIZE	16
+#define	IEEE80211_MICBUF_SIZE	(8+8)	/* space for both tx+rx keys */
+
+/*
+ * Old WEP-style key.  Deprecated.
+ */
+struct ieee80211_wepkey {
+	u_int		wk_len;		/* key length in bytes */
+	u_int8_t	wk_key[IEEE80211_KEYBUF_SIZE];
+};
+
+struct ieee80211_cipher;
+
+/*
+ * Crypto key state.  There is sufficient room for all supported
+ * ciphers (see below).  The underlying ciphers are handled
+ * separately through loadable cipher modules that register with
+ * the generic crypto support.  A key has a reference to an instance
+ * of the cipher; any per-key state is hung off wk_private by the
+ * cipher when it is attached.  Ciphers are automatically called
+ * to detach and cleanup any such state when the key is deleted.
+ *
+ * The generic crypto support handles encap/decap of cipher-related
+ * frame contents for both hardware- and software-based implementations.
+ * A key requiring software crypto support is automatically flagged and
+ * the cipher is expected to honor this and do the necessary work.
+ * Ciphers such as TKIP may also support mixed hardware/software
+ * encrypt/decrypt and MIC processing.
+ */
+typedef u_int16_t ieee80211_keyix;	/* h/w key index */
+
+struct ieee80211_key {
+	u_int8_t	wk_keylen;	/* key length in bytes */
+	u_int8_t	wk_pad;
+	u_int16_t	wk_flags;
+#define	IEEE80211_KEY_XMIT	0x01	/* key used for xmit */
+#define	IEEE80211_KEY_RECV	0x02	/* key used for recv */
+#define	IEEE80211_KEY_GROUP	0x04	/* key used for WPA group operation */
+#define	IEEE80211_KEY_SWCRYPT	0x10	/* host-based encrypt/decrypt */
+#define	IEEE80211_KEY_SWMIC	0x20	/* host-based enmic/demic */
+	ieee80211_keyix	wk_keyix;	/* h/w key index */
+	ieee80211_keyix	wk_rxkeyix;	/* optional h/w rx key index */
+	u_int8_t	wk_key[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
+#define	wk_txmic	wk_key+IEEE80211_KEYBUF_SIZE+0	/* XXX can't () right */
+#define	wk_rxmic	wk_key+IEEE80211_KEYBUF_SIZE+8	/* XXX can't () right */
+	u_int64_t	wk_keyrsc;	/* key receive sequence counter */
+	u_int64_t	wk_keytsc;	/* key transmit sequence counter */
+	const struct ieee80211_cipher *wk_cipher;
+	void		*wk_private;	/* private cipher state */
+};
+#define	IEEE80211_KEY_COMMON 		/* common flags passed in by apps */\
+	(IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV | IEEE80211_KEY_GROUP)
+
+/*
+ * NB: these values are ordered carefully; there are lots of
+ * of implications in any reordering.  In particular beware
+ * that 4 is not used to avoid conflicting with IEEE80211_F_PRIVACY.
+ */
+#define	IEEE80211_CIPHER_WEP		0
+#define	IEEE80211_CIPHER_TKIP		1
+#define	IEEE80211_CIPHER_AES_OCB	2
+#define	IEEE80211_CIPHER_AES_CCM	3
+#define	IEEE80211_CIPHER_CKIP		5
+#define	IEEE80211_CIPHER_NONE		6	/* pseudo value */
+
+#define	IEEE80211_CIPHER_MAX		(IEEE80211_CIPHER_NONE+1)
+
+#define	IEEE80211_KEYIX_NONE	((ieee80211_keyix) -1)
+#define	IEEE80211_KEY_UNDEFINED(k)	((k).wk_cipher == &ieee80211_cipher_none)
+
+#if defined(__KERNEL__) || defined(_KERNEL)
+
+struct ieee80211com;
+struct ieee80211_node;
+struct mbuf;
+
+/*
+ * Crypto state kept in each ieee80211com.  Some of this
+ * can/should be shared when virtual AP's are supported.
+ *
+ * XXX save reference to ieee80211com to properly encapsulate state.
+ * XXX split out crypto capabilities from ic_caps
+ */
+struct ieee80211_crypto_state {
+	struct ieee80211_key	cs_nw_keys[IEEE80211_WEP_NKID];
+	ieee80211_keyix		cs_def_txkey;	/* default/group tx key index */
+	u_int16_t		cs_max_keyix;	/* max h/w key index */
+
+	int			(*cs_key_alloc)(struct ieee80211com *,
+					const struct ieee80211_key *,
+					ieee80211_keyix *, ieee80211_keyix *);
+	int			(*cs_key_delete)(struct ieee80211com *, 
+					const struct ieee80211_key *);
+	int			(*cs_key_set)(struct ieee80211com *,
+					const struct ieee80211_key *,
+					const u_int8_t mac[IEEE80211_ADDR_LEN]);
+	void			(*cs_key_update_begin)(struct ieee80211com *);
+	void			(*cs_key_update_end)(struct ieee80211com *);
+};
+
+void	ieee80211_crypto_attach(struct ieee80211com *);
+void	ieee80211_crypto_detach(struct ieee80211com *);
+int	ieee80211_crypto_newkey(struct ieee80211com *,
+		int cipher, int flags, struct ieee80211_key *);
+int	ieee80211_crypto_delkey(struct ieee80211com *,
+		struct ieee80211_key *);
+int	ieee80211_crypto_setkey(struct ieee80211com *,
+		struct ieee80211_key *, const u_int8_t macaddr[IEEE80211_ADDR_LEN]);
+void	ieee80211_crypto_delglobalkeys(struct ieee80211com *);
+
+/*
+ * Template for a supported cipher.  Ciphers register with the
+ * crypto code and are typically loaded as separate modules
+ * (the null cipher is always present).
+ * XXX may need refcnts
+ */
+struct ieee80211_cipher {
+	const char *ic_name;		/* printable name */
+	u_int	ic_cipher;		/* IEEE80211_CIPHER_* */
+	u_int	ic_header;		/* size of privacy header (bytes) */
+	u_int	ic_trailer;		/* size of privacy trailer (bytes) */
+	u_int	ic_miclen;		/* size of mic trailer (bytes) */
+	void*	(*ic_attach)(struct ieee80211com *, struct ieee80211_key *);
+	void	(*ic_detach)(struct ieee80211_key *);
+	int	(*ic_setkey)(struct ieee80211_key *);
+	int	(*ic_encap)(struct ieee80211_key *, struct mbuf *,
+			u_int8_t keyid);
+	int	(*ic_decap)(struct ieee80211_key *, struct mbuf *, int);
+	int	(*ic_enmic)(struct ieee80211_key *, struct mbuf *, int);
+	int	(*ic_demic)(struct ieee80211_key *, struct mbuf *, int);
+};
+extern	const struct ieee80211_cipher ieee80211_cipher_none;
+extern	const struct ieee80211_cipher ieee80211_cipher_wep;
+extern	const struct ieee80211_cipher ieee80211_cipher_tkip;
+extern	const struct ieee80211_cipher ieee80211_cipher_ccmp;
+
+void	ieee80211_crypto_register(const struct ieee80211_cipher *);
+void	ieee80211_crypto_unregister(const struct ieee80211_cipher *);
+int	ieee80211_crypto_available(u_int cipher);
+
+struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211com *,
+		struct ieee80211_node *, struct mbuf *);
+struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211com *,
+		struct ieee80211_node *, struct mbuf *, int);
+
+/*
+ * Check and remove any MIC.
+ */
+static __inline int
+ieee80211_crypto_demic(struct ieee80211com *ic,
+    struct ieee80211_key *k, struct mbuf *m, int force)
+{
+	const struct ieee80211_cipher *cip = k->wk_cipher;
+	return (cip->ic_miclen > 0 ? cip->ic_demic(k, m, force) : 1);
+}
+
+/*
+ * Add any MIC.
+ */
+static __inline int
+ieee80211_crypto_enmic(struct ieee80211com *ic,
+	struct ieee80211_key *k, struct mbuf *m, int force)
+{
+	const struct ieee80211_cipher *cip = k->wk_cipher;
+	return (cip->ic_miclen > 0 ? cip->ic_enmic(k, m, force) : 1);
+}
+
+/* 
+ * Reset key state to an unused state.  The crypto
+ * key allocation mechanism insures other state (e.g.
+ * key data) is properly setup before a key is used.
+ */
+static __inline void
+ieee80211_crypto_resetkey(struct ieee80211com *ic,
+	struct ieee80211_key *k, ieee80211_keyix ix)
+{
+	k->wk_cipher = &ieee80211_cipher_none;
+	k->wk_private = k->wk_cipher->ic_attach(ic, k);
+	k->wk_keyix = k->wk_rxkeyix = ix;
+	k->wk_flags = IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV;
+}
+
+/*
+ * Crypt-related notification methods.
+ */
+void	ieee80211_notify_replay_failure(struct ieee80211com *,
+		const struct ieee80211_frame *, const struct ieee80211_key *,
+		u_int64_t rsc);
+void	ieee80211_notify_michael_failure(struct ieee80211com *,
+		const struct ieee80211_frame *, u_int keyix);
+#endif /* defined(__KERNEL__) || defined(_KERNEL) */
+#endif /* !_NET80211_IEEE80211_CRYPTO_H_ */

Property changes on: lab4/.minix-src/include/net80211/ieee80211_crypto.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netatalk/ddp_var.h
===================================================================
--- lab4/.minix-src/include/netatalk/ddp_var.h	(nonexistent)
+++ lab4/.minix-src/include/netatalk/ddp_var.h	(revision 13)
@@ -0,0 +1,60 @@
+/*	$NetBSD: ddp_var.h,v 1.4 2008/04/23 15:17:42 thorpej Exp $	 */
+
+/*
+ * Copyright (c) 1990,1994 Regents of The University of Michigan.
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation, and that the name of The University
+ * of Michigan not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. This software is supplied as is without expressed or
+ * implied warranties of any kind.
+ *
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ *
+ *	Research Systems Unix Group
+ *	The University of Michigan
+ *	c/o Wesley Craig
+ *	535 W. William Street
+ *	Ann Arbor, Michigan
+ *	+1-313-764-2278
+ *	netatalk@umich.edu
+ */
+
+#ifndef _NETATALK_DDP_VAR_H_
+#define _NETATALK_DDP_VAR_H_
+
+struct ddpcb {
+	struct sockaddr_at ddp_fsat, ddp_lsat;
+	struct route    ddp_route;
+	struct socket  *ddp_socket;
+	struct ddpcb   *ddp_prev, *ddp_next;
+	struct ddpcb   *ddp_pprev, *ddp_pnext;
+};
+
+#define sotoddpcb(so)	((struct ddpcb *)(so)->so_pcb)
+
+#define	DDP_STAT_SHORT		0	/* short header packets received */
+#define	DDP_STAT_LONG		1	/* long header packets received */
+#define	DDP_STAT_NOSUM		2	/* no checksum */
+#define	DDP_STAT_BADSUM		3	/* bad checksum */
+#define	DDP_STAT_TOOSHORT	4	/* packet too short */
+#define	DDP_STAT_TOOSMALL	5	/* not enough data */
+#define	DDP_STAT_FORWARD	6	/* packets forwarded */
+#define	DDP_STAT_ENCAP		7	/* packets encapsulated */
+#define	DDP_STAT_CANTFORWARD	8	/* packets rcvd for unreachable net */
+#define	DDP_STAT_NOSOCKSPACE	9	/* no space in sockbuf for packet */
+
+#define	DDP_NSTATS		10
+
+#ifdef _KERNEL
+extern struct ddpcb *ddp_ports[];
+extern struct ddpcb *ddpcb;
+#endif
+
+#endif /* !_NETATALK_DDP_VAR_H_ */

Property changes on: lab4/.minix-src/include/netatalk/ddp_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/if_inarp.h
===================================================================
--- lab4/.minix-src/include/netinet/if_inarp.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/if_inarp.h	(revision 13)
@@ -0,0 +1,91 @@
+/*	$NetBSD: if_inarp.h,v 1.47 2015/05/21 09:26:18 ozaki-r Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)if_ether.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IF_INARP_H_
+#define _NETINET_IF_INARP_H_
+
+#include <sys/queue.h>		/* for LIST_ENTRY */
+#include <netinet/in.h>		/* for struct in_addr */
+
+struct llinfo_arp {
+	LIST_ENTRY(llinfo_arp) la_list;
+	struct	rtentry *la_rt;
+	struct	mbuf *la_hold;		/* last packet until resolved/timeout */
+	long	la_asked;		/* last time we QUERIED for this addr */
+};
+
+struct sockaddr_inarp {
+	u_int8_t  sin_len;
+	u_int8_t  sin_family;
+	u_int16_t sin_port;
+	struct	  in_addr sin_addr;
+	struct	  in_addr sin_srcaddr;
+	u_int16_t sin_tos;
+	u_int16_t sin_other;
+#define SIN_PROXY 1
+};
+
+#ifdef _KERNEL
+
+/* ARP timings from RFC5227 */
+#define PROBE_WAIT               1
+#define PROBE_NUM                3
+#define PROBE_MIN                1
+#define PROBE_MAX                2
+#define ANNOUNCE_WAIT            2
+#define ANNOUNCE_NUM             2
+#define ANNOUNCE_INTERVAL        2
+#define MAX_CONFLICTS           10
+#define RATE_LIMIT_INTERVAL     60
+#define DEFEND_INTERVAL         10
+
+#include <sys/malloc.h>
+MALLOC_DECLARE(M_IPARP);
+
+extern struct ifqueue arpintrq;
+void arp_ifinit(struct ifnet *, struct ifaddr *);
+void arp_rtrequest(int, struct rtentry *, const struct rt_addrinfo *);
+int arpresolve(struct ifnet *, struct rtentry *, struct mbuf *,
+		    const struct sockaddr *, u_char *);
+void arpintr(void);
+void arprequest(struct ifnet *, const struct in_addr *, const struct in_addr *,
+    const u_int8_t *);
+void arp_drain(void);
+int arpioctl(u_long, void *);
+void arpwhohas(struct ifnet *, struct in_addr *);
+
+void revarpinput(struct mbuf *);
+int revarpwhoarewe(struct ifnet *, struct in_addr *, struct in_addr *);
+#endif
+
+#endif /* !_NETINET_IF_INARP_H_ */

Property changes on: lab4/.minix-src/include/netinet/if_inarp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/in_pcb.h
===================================================================
--- lab4/.minix-src/include/netinet/in_pcb.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/in_pcb.h	(revision 13)
@@ -0,0 +1,164 @@
+/*	$NetBSD: in_pcb.h,v 1.59 2015/05/24 15:43:45 rtr Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)in_pcb.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IN_PCB_H_
+#define _NETINET_IN_PCB_H_
+
+#include <sys/queue.h>
+#include <netinet/in_pcb_hdr.h>
+
+/*
+ * Common structure pcb for internet protocol implementation.
+ * Here are stored pointers to local and foreign host table
+ * entries, local and foreign socket numbers, and pointers
+ * up (to a socket structure) and down (to a protocol-specific)
+ * control block.
+ */
+struct inpcb {
+	struct inpcb_hdr inp_head;
+#define inp_hash	inp_head.inph_hash
+#define inp_queue	inp_head.inph_queue
+#define inp_af		inp_head.inph_af
+#define inp_ppcb	inp_head.inph_ppcb
+#define inp_state	inp_head.inph_state
+#define inp_portalgo	inp_head.inph_portalgo
+#define inp_socket	inp_head.inph_socket
+#define inp_table	inp_head.inph_table
+#define inp_sp		inp_head.inph_sp
+	struct	  route inp_route;	/* placeholder for routing entry */
+	u_int16_t inp_fport;		/* foreign port */
+	u_int16_t inp_lport;		/* local port */
+	int	  inp_flags;		/* generic IP/datagram flags */
+	struct	  ip inp_ip;		/* header prototype; should have more */
+	struct	  mbuf *inp_options;	/* IP options */
+	struct	  ip_moptions *inp_moptions; /* IP multicast options */
+	int	  inp_errormtu;		/* MTU of last xmit status = EMSGSIZE */
+	uint8_t	  inp_ip_minttl;
+	bool      inp_bindportonsend;
+};
+
+#define	inp_faddr	inp_ip.ip_dst
+#define	inp_laddr	inp_ip.ip_src
+
+/* flags in inp_flags: */
+#define	INP_RECVOPTS		0x0001	/* receive incoming IP options */
+#define	INP_RECVRETOPTS		0x0002	/* receive IP options for reply */
+#define	INP_RECVDSTADDR		0x0004	/* receive IP dst address */
+#define	INP_HDRINCL		0x0008	/* user supplies entire IP header */
+#define	INP_HIGHPORT		0x0010	/* (unused; FreeBSD compat) */
+#define	INP_LOWPORT		0x0020	/* user wants "low" port binding */
+#define	INP_ANONPORT		0x0040	/* port chosen for user */
+#define	INP_RECVIF		0x0080	/* receive incoming interface */
+/* XXX should move to an UDP control block */
+#define INP_ESPINUDP		0x0100	/* ESP over UDP for NAT-T */
+#define INP_ESPINUDP_NON_IKE	0x0200	/* ESP over UDP for NAT-T */
+#define INP_ESPINUDP_ALL	(INP_ESPINUDP|INP_ESPINUDP_NON_IKE)
+#define INP_NOHEADER		0x0400	/* Kernel removes IP header
+					 * before feeding a packet
+					 * to the raw socket user.
+					 * The socket user will
+					 * not supply an IP header.
+					 * Cancels INP_HDRINCL.
+					 */
+#define	INP_RECVTTL		0x0800	/* receive incoming IP TTL */
+#define	INP_PKTINFO		0x1000	/* receive dst packet info */
+#define	INP_RECVPKTINFO		0x2000	/* receive dst packet info */
+#define	INP_CONTROLOPTS		(INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\
+				INP_RECVIF|INP_RECVTTL|INP_RECVPKTINFO|\
+				INP_PKTINFO)
+
+#define	sotoinpcb(so)		((struct inpcb *)(so)->so_pcb)
+
+#ifdef _KERNEL
+void	in_losing(struct inpcb *);
+int	in_pcballoc(struct socket *, void *);
+int	in_pcbbind(void *, struct sockaddr_in *, struct lwp *);
+int	in_pcbconnect(void *, struct sockaddr_in *, struct lwp *);
+void	in_pcbdetach(void *);
+void	in_pcbdisconnect(void *);
+void	in_pcbinit(struct inpcbtable *, int, int);
+struct inpcb *
+	in_pcblookup_port(struct inpcbtable *,
+			  struct in_addr, u_int, int, struct vestigial_inpcb *);
+struct inpcb *
+	in_pcblookup_bind(struct inpcbtable *,
+	    struct in_addr, u_int);
+struct inpcb *
+	in_pcblookup_connect(struct inpcbtable *,
+			     struct in_addr, u_int, struct in_addr, u_int,
+			     struct vestigial_inpcb *);
+int	in_pcbnotify(struct inpcbtable *, struct in_addr, u_int,
+	    struct in_addr, u_int, int, void (*)(struct inpcb *, int));
+void	in_pcbnotifyall(struct inpcbtable *, struct in_addr, int,
+	    void (*)(struct inpcb *, int));
+void	in_pcbpurgeif0(struct inpcbtable *, struct ifnet *);
+void	in_pcbpurgeif(struct inpcbtable *, struct ifnet *);
+void	in_purgeifmcast(struct ip_moptions *, struct ifnet *);
+void	in_pcbstate(struct inpcb *, int);
+void	in_rtchange(struct inpcb *, int);
+void	in_setpeeraddr(struct inpcb *, struct sockaddr_in *);
+void	in_setsockaddr(struct inpcb *, struct sockaddr_in *);
+struct rtentry *
+	in_pcbrtentry(struct inpcb *);
+#endif
+
+#endif /* !_NETINET_IN_PCB_H_ */

Property changes on: lab4/.minix-src/include/netinet/in_pcb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/tcp.h
===================================================================
--- lab4/.minix-src/include/netinet/tcp.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/tcp.h	(revision 13)
@@ -0,0 +1,206 @@
+/*	$NetBSD: tcp.h,v 1.31 2015/02/14 12:57:53 he Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tcp.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_H_
+#define _NETINET_TCP_H_
+
+#include <sys/featuretest.h>
+
+#if defined(_NETBSD_SOURCE)
+#include <sys/types.h>
+
+typedef uint32_t tcp_seq;
+/*
+ * TCP header.
+ * Per RFC 793, September, 1981.
+ * Updated by RFC 3168, September, 2001.
+ */
+struct tcphdr {
+	uint16_t th_sport;		/* source port */
+	uint16_t th_dport;		/* destination port */
+	tcp_seq	  th_seq;		/* sequence number */
+	tcp_seq	  th_ack;		/* acknowledgement number */
+#if BYTE_ORDER == LITTLE_ENDIAN
+	/*LINTED non-portable bitfields*/
+	uint8_t  th_x2:4,		/* (unused) */
+		  th_off:4;		/* data offset */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	/*LINTED non-portable bitfields*/
+	uint8_t  th_off:4,		/* data offset */
+		  th_x2:4;		/* (unused) */
+#endif
+	uint8_t  th_flags;
+#define	TH_FIN	  0x01
+#define	TH_SYN	  0x02
+#define	TH_RST	  0x04
+#define	TH_PUSH	  0x08
+#define	TH_ACK	  0x10
+#define	TH_URG	  0x20
+#define	TH_ECE	  0x40
+#define	TH_CWR	  0x80
+	uint16_t th_win;			/* window */
+	uint16_t th_sum;			/* checksum */
+	uint16_t th_urp;			/* urgent pointer */
+} __packed;
+
+#define	TCPOPT_EOL		0
+#define	TCPOPT_NOP		1
+#define	TCPOPT_MAXSEG		2
+#define	   TCPOLEN_MAXSEG		4
+#define	TCPOPT_WINDOW		3
+#define	   TCPOLEN_WINDOW		3
+#define	TCPOPT_SACK_PERMITTED	4		/* Experimental */
+#define	   TCPOLEN_SACK_PERMITTED	2
+#define	TCPOPT_SACK		5		/* Experimental */
+#define	TCPOPT_TIMESTAMP	8
+#define	   TCPOLEN_TIMESTAMP		10
+#define	   TCPOLEN_TSTAMP_APPA		(TCPOLEN_TIMESTAMP+2) /* appendix A */
+
+#define TCPOPT_TSTAMP_HDR	\
+    (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
+
+#define	TCPOPT_SIGNATURE	19		/* Keyed MD5: RFC 2385 */
+#define	   TCPOLEN_SIGNATURE		18
+#define    TCPOLEN_SIGLEN		(TCPOLEN_SIGNATURE+2) /* padding */
+
+#define MAX_TCPOPTLEN	40	/* max # bytes that go in options */
+
+/*
+ * Default maximum segment size for TCP.
+ * This is defined by RFC 1112 Sec 4.2.2.6.
+ */
+#define	TCP_MSS		536
+
+#define	TCP_MINMSS	216
+
+#define	TCP_MAXWIN	65535	/* largest value for (unscaled) window */
+
+#define	TCP_MAX_WINSHIFT	14	/* maximum window shift */
+
+#define	TCP_MAXBURST	4	/* maximum segments in a burst */
+
+#endif /* _NETBSD_SOURCE */
+
+/*
+ * User-settable options (used with setsockopt).
+ */
+#define	TCP_NODELAY	1	/* don't delay send to coalesce packets */
+#define	TCP_MAXSEG	2	/* set maximum segment size */
+#define	TCP_KEEPIDLE	3
+#ifdef notyet
+#define	TCP_NOPUSH	4	/* reserved for FreeBSD compat */
+#endif
+#define	TCP_KEEPINTVL	5
+#define	TCP_KEEPCNT	6
+#define	TCP_KEEPINIT	7
+#ifdef notyet
+#define	TCP_NOOPT	8	/* reserved for FreeBSD compat */
+#endif
+#define	TCP_INFO	9	/* retrieve tcp_info structure */
+#define	TCP_MD5SIG	0x10	/* use MD5 digests (RFC2385) */
+#define	TCP_CONGCTL	0x20	/* selected congestion control */
+
+#define	TCPI_OPT_TIMESTAMPS	0x01
+#define	TCPI_OPT_SACK		0x02
+#define	TCPI_OPT_WSCALE		0x04
+#define	TCPI_OPT_ECN		0x08
+#define	TCPI_OPT_TOE		0x10
+
+/*
+ * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits
+ * the caller to query certain information about the state of a TCP
+ * connection.  We provide an overlapping set of fields with the Linux
+ * implementation, but since this is a fixed size structure, room has been
+ * left for growth.  In order to maximize potential future compatibility with
+ * the Linux API, the same variable names and order have been adopted, and
+ * padding left to make room for omitted fields in case they are added later.
+ *
+ * XXX: This is currently an unstable ABI/API, in that it is expected to
+ * change.
+ */
+struct tcp_info {
+	uint8_t		tcpi_state; /* TCP FSM state. */
+	uint8_t		__tcpi_ca_state;
+	uint8_t		__tcpi_retransmits;
+	uint8_t		__tcpi_probes;
+	uint8_t		__tcpi_backoff;
+	uint8_t		tcpi_options;	       /* Options enabled on conn. */
+	uint8_t		tcpi_snd_wscale:4,	/* RFC1323 send shift value. */
+			tcpi_rcv_wscale:4; /* RFC1323 recv shift value. */
+
+	uint32_t	tcpi_rto;		/* Retransmission timeout (usec). */
+	uint32_t	__tcpi_ato;
+	uint32_t	tcpi_snd_mss;		/* Max segment size for send. */
+	uint32_t	tcpi_rcv_mss;		/* Max segment size for receive. */
+
+	uint32_t	__tcpi_unacked;
+	uint32_t	__tcpi_sacked;
+	uint32_t	__tcpi_lost;
+	uint32_t	__tcpi_retrans;
+	uint32_t	__tcpi_fackets;
+
+	/* Times; measurements in usecs. */
+	uint32_t	__tcpi_last_data_sent;
+	uint32_t	__tcpi_last_ack_sent;	/* Also unimpl. on Linux? */
+	uint32_t	tcpi_last_data_recv;	/* Time since last recv data. */
+	uint32_t	__tcpi_last_ack_recv;
+
+	/* Metrics; variable units. */
+	uint32_t	__tcpi_pmtu;
+	uint32_t	__tcpi_rcv_ssthresh;
+	uint32_t	tcpi_rtt;		/* Smoothed RTT in usecs. */
+	uint32_t	tcpi_rttvar;		/* RTT variance in usecs. */
+	uint32_t	tcpi_snd_ssthresh;	/* Slow start threshold. */
+	uint32_t	tcpi_snd_cwnd;		/* Send congestion window. */
+	uint32_t	__tcpi_advmss;
+	uint32_t	__tcpi_reordering;
+
+	uint32_t	__tcpi_rcv_rtt;
+	uint32_t	tcpi_rcv_space;		/* Advertised recv window. */
+
+	/* FreeBSD/NetBSD extensions to tcp_info. */
+	uint32_t	tcpi_snd_wnd;		/* Advertised send window. */
+	uint32_t	tcpi_snd_bwnd;		/* No longer used. */
+	uint32_t	tcpi_snd_nxt;		/* Next egress seqno */
+	uint32_t	tcpi_rcv_nxt;		/* Next ingress seqno */
+	uint32_t	tcpi_toe_tid;		/* HWTID for TOE endpoints */
+	uint32_t	tcpi_snd_rexmitpack;	/* Retransmitted packets */
+	uint32_t	tcpi_rcv_ooopack;	/* Out-of-order packets */
+	uint32_t	tcpi_snd_zerowin;	/* Zero-sized windows sent */
+	
+	/* Padding to grow without breaking ABI. */
+	uint32_t	__tcpi_pad[26];		/* Padding. */
+};
+
+#endif /* !_NETINET_TCP_H_ */

Property changes on: lab4/.minix-src/include/netinet/tcp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/tcp_timer.h
===================================================================
--- lab4/.minix-src/include/netinet/tcp_timer.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/tcp_timer.h	(revision 13)
@@ -0,0 +1,195 @@
+/*	$NetBSD: tcp_timer.h,v 1.28 2011/05/24 18:37:52 gdt Exp $	*/
+
+/*-
+ * Copyright (c) 2001, 2005 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of Wasabi Systems, Inc.
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tcp_timer.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_TIMER_H_
+#define _NETINET_TCP_TIMER_H_
+
+/*
+ * Definitions of the TCP timers.  These timers are counted
+ * down PR_SLOWHZ times a second.
+ */
+#define	TCPT_NTIMERS	4
+
+#define	TCPT_REXMT	0		/* retransmit */
+#define	TCPT_PERSIST	1		/* retransmit persistance */
+#define	TCPT_KEEP	2		/* keep alive */
+#define	TCPT_2MSL	3		/* 2*msl quiet time timer */
+
+/*
+ * The TCPT_REXMT timer is used to force retransmissions.
+ * The TCP has the TCPT_REXMT timer set whenever segments
+ * have been sent for which ACKs are expected but not yet
+ * received.  If an ACK is received which advances tp->snd_una,
+ * then the retransmit timer is cleared (if there are no more
+ * outstanding segments) or reset to the base value (if there
+ * are more ACKs expected).  Whenever the retransmit timer goes off,
+ * we retransmit one unacknowledged segment, and do a backoff
+ * on the retransmit timer.
+ *
+ * The TCPT_PERSIST timer is used to keep window size information
+ * flowing even if the window goes shut.  If all previous transmissions
+ * have been acknowledged (so that there are no retransmissions in progress),
+ * and the window is too small to bother sending anything, then we start
+ * the TCPT_PERSIST timer.  When it expires, if the window is nonzero,
+ * we go to transmit state.  Otherwise, at intervals send a single byte
+ * into the peer's window to force him to update our window information.
+ * We do this at most as often as TCPT_PERSMIN time intervals,
+ * but no more frequently than the current estimate of round-trip
+ * packet time.  The TCPT_PERSIST timer is cleared whenever we receive
+ * a window update from the peer.
+ *
+ * The TCPT_KEEP timer is used to keep connections alive.  If an
+ * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time,
+ * but not yet established, then we drop the connection.  Once the connection
+ * is established, if the connection is idle for TCPTV_KEEP_IDLE time
+ * (and keepalives have been enabled on the socket), we begin to probe
+ * the connection.  We force the peer to send us a segment by sending:
+ *	<SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK>
+ * This segment is (deliberately) outside the window, and should elicit
+ * an ack segment in response from the peer.  If, despite the TCPT_KEEP
+ * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE
+ * amount of time probing, then we drop the connection.
+ */
+
+/*
+ * Time constants.
+ * All TCPTV_* constants are in units of slow ticks (typically 500 ms).
+ */
+#define	TCPTV_MSL	( 30*PR_SLOWHZ)		/* max seg lifetime (hah!) */
+#define	TCPTV_SRTTBASE	0			/* base roundtrip time;
+						   if 0, no idea yet */
+#define	TCPTV_SRTTDFLT	(  3*PR_SLOWHZ)		/* assumed RTT if no info */
+
+#define	TCPTV_PERSMIN	(  5*PR_SLOWHZ)		/* retransmit persistance */
+#define	TCPTV_PERSMAX	( 60*PR_SLOWHZ)		/* maximum persist interval */
+
+#define	TCPTV_KEEP_INIT	( 75*PR_SLOWHZ)		/* initial connect keep alive */
+#define	TCPTV_KEEP_IDLE	(120*60*PR_SLOWHZ)	/* dflt time before probing */
+#define	TCPTV_KEEPINTVL	( 75*PR_SLOWHZ)		/* default probe interval */
+#define	TCPTV_KEEPCNT	8			/* max probes before drop */
+
+#define	TCPTV_MIN	(  1*PR_SLOWHZ)		/* minimum allowable value */
+#define	TCPTV_REXMTMAX	( 64*PR_SLOWHZ)		/* max allowable REXMT value */
+
+#define	TCP_LINGERTIME	120			/* linger at most 2 minutes */
+
+#define	TCP_MAXRXTSHIFT	12			/* maximum retransmits */
+
+/* Acks are delayed for 1 second; constant is in fast ticks. */
+#define	TCP_DELACK_TICKS (hz / PR_FASTHZ)	/* time to delay ACK */
+
+#ifdef	TCPTIMERS
+const char *tcptimers[] =
+    { "REXMT", "PERSIST", "KEEP", "2MSL" };
+#endif
+
+/*
+ * Init, arm, disarm, and test TCP timers.
+ */
+#define	TCP_TIMER_INIT(tp, timer)					\
+	callout_setfunc(&(tp)->t_timer[(timer)],			\
+	    tcp_timer_funcs[(timer)], (tp))
+
+/*
+ * nticks is given in units of slow timeouts,
+ * typically 500 ms (with PR_SLOWHZ at 2).
+ */
+#define	TCP_TIMER_ARM(tp, timer, nticks)				\
+	callout_schedule(&(tp)->t_timer[(timer)],			\
+	    (nticks) * (hz / PR_SLOWHZ))
+
+#define	TCP_TIMER_DISARM(tp, timer)					\
+	callout_stop(&(tp)->t_timer[(timer)])
+
+#define	TCP_TIMER_ISARMED(tp, timer)					\
+	callout_active(&(tp)->t_timer[(timer)])
+
+/*
+ * Force a time value to be in a certain range.
+ */
+#define	TCPT_RANGESET(tv, value, tvmin, tvmax) { \
+	(tv) = (value); \
+	if ((tv) < (tvmin)) \
+		(tv) = (tvmin); \
+	if ((tv) > (tvmax)) \
+		(tv) = (tvmax); \
+}
+
+#ifdef _KERNEL
+typedef void (*tcp_timer_func_t)(void *);
+
+extern const tcp_timer_func_t tcp_timer_funcs[TCPT_NTIMERS];
+
+extern u_int tcp_keepinit;		/* time before initial connection times out */
+extern u_int tcp_keepidle;		/* time before keepalive probes begin */
+extern u_int tcp_keepintvl;		/* time between keepalive probes */
+extern u_int tcp_keepcnt;		/* number of keepalives, 0=infty */
+extern int tcp_maxpersistidle;		/* max idle time in persist */
+extern int tcp_ttl;			/* time to live for TCP segs */
+extern const int tcp_backoff[];
+
+void	tcp_timer_init(void);
+#endif
+
+#endif /* !_NETINET_TCP_TIMER_H_ */

Property changes on: lab4/.minix-src/include/netinet/tcp_timer.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/udp.h
===================================================================
--- lab4/.minix-src/include/netinet/udp.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/udp.h	(revision 13)
@@ -0,0 +1,62 @@
+/*	$NetBSD: udp.h,v 1.16 2012/06/22 14:54:35 christos Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)udp.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_UDP_H_
+#define _NETINET_UDP_H_
+
+#include <sys/types.h>
+/*
+ * Udp protocol header.
+ * Per RFC 768, September, 1981.
+ */
+struct udphdr {
+	uint16_t uh_sport;		/* source port */
+	uint16_t uh_dport;		/* destination port */
+	uint16_t uh_ulen;		/* udp length */
+	uint16_t uh_sum;		/* udp checksum */
+} __packed;
+
+/* socket options for UDP */
+#define	UDP_ENCAP	100
+
+/* Encapsulation types */
+#define UDP_ENCAP_ESPINUDP_NON_IKE 	1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
+#define UDP_ENCAP_ESPINUDP		2 /* draft-ietf-ipsec-udp-encaps-06 */
+
+/* Default encapsulation port */
+#define UDP_ENCAP_ESPINUDP_PORT		500
+
+/* Maximum UDP fragment size for ESP over UDP */
+#define UDP_ENCAP_ESPINUDP_MAXFRAGLEN	552
+
+#endif /* !_NETINET_UDP_H_ */

Property changes on: lab4/.minix-src/include/netinet/udp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net80211/_ieee80211.h
===================================================================
--- lab4/.minix-src/include/net80211/_ieee80211.h	(nonexistent)
+++ lab4/.minix-src/include/net80211/_ieee80211.h	(revision 13)
@@ -0,0 +1,206 @@
+/*-
+ * Copyright (c) 2001 Atsushi Onoe
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * 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.
+ *
+ * $FreeBSD: src/sys/net80211/_ieee80211.h,v 1.3 2005/08/10 17:42:13 sam Exp $
+ */
+#ifndef _NET80211__IEEE80211_H_
+#define _NET80211__IEEE80211_H_
+
+enum ieee80211_phytype {
+	IEEE80211_T_DS,			/* direct sequence spread spectrum */
+	IEEE80211_T_FH,			/* frequency hopping */
+	IEEE80211_T_OFDM,		/* frequency division multiplexing */
+	IEEE80211_T_TURBO		/* high rate OFDM, aka turbo mode */
+};
+#define	IEEE80211_T_CCK	IEEE80211_T_DS	/* more common nomenclature */
+
+/* XXX not really a mode; there are really multiple PHY's */
+enum ieee80211_phymode {
+	IEEE80211_MODE_AUTO	= 0,	/* autoselect */
+	IEEE80211_MODE_11A	= 1,	/* 5GHz, OFDM */
+	IEEE80211_MODE_11B	= 2,	/* 2GHz, CCK */
+	IEEE80211_MODE_11G	= 3,	/* 2GHz, OFDM */
+	IEEE80211_MODE_FH	= 4,	/* 2GHz, GFSK */
+	IEEE80211_MODE_TURBO_A	= 5,	/* 5GHz, OFDM, 2x clock */
+	IEEE80211_MODE_TURBO_G	= 6	/* 2GHz, OFDM, 2x clock */
+};
+#define	IEEE80211_MODE_MAX	((int)IEEE80211_MODE_TURBO_G + 1)
+
+enum ieee80211_opmode {
+	IEEE80211_M_STA		= 1,	/* infrastructure station */
+	IEEE80211_M_IBSS 	= 0,	/* IBSS (adhoc) station */
+	IEEE80211_M_AHDEMO	= 3,	/* Old lucent compatible adhoc demo */
+	IEEE80211_M_HOSTAP	= 6,	/* Software Access Point */
+	IEEE80211_M_MONITOR	= 8	/* Monitor mode */
+};
+
+/*
+ * 802.11g protection mode.
+ */
+enum ieee80211_protmode {
+	IEEE80211_PROT_NONE	= 0,	/* no protection */
+	IEEE80211_PROT_CTSONLY	= 1,	/* CTS to self */
+	IEEE80211_PROT_RTSCTS	= 2	/* RTS-CTS */
+};
+
+/*
+ * Authentication mode.
+ */
+enum ieee80211_authmode {
+	IEEE80211_AUTH_NONE	= 0,
+	IEEE80211_AUTH_OPEN	= 1,		/* open */
+	IEEE80211_AUTH_SHARED	= 2,		/* shared-key */
+	IEEE80211_AUTH_8021X	= 3,		/* 802.1x */
+	IEEE80211_AUTH_AUTO	= 4,		/* auto-select/accept */
+	/* NB: these are used only for ioctls */
+	IEEE80211_AUTH_WPA	= 5		/* WPA/RSN w/ 802.1x/PSK */
+};
+
+/*
+ * Roaming mode is effectively who controls the operation
+ * of the 802.11 state machine when operating as a station.
+ * State transitions are controlled either by the driver
+ * (typically when management frames are processed by the
+ * hardware/firmware), the host (auto/normal operation of
+ * the 802.11 layer), or explicitly through ioctl requests
+ * when applications like wpa_supplicant want control.
+ */
+enum ieee80211_roamingmode {
+	IEEE80211_ROAMING_DEVICE= 0,	/* driver/hardware control */
+	IEEE80211_ROAMING_AUTO	= 1,	/* 802.11 layer control */
+	IEEE80211_ROAMING_MANUAL= 2	/* application control */
+};
+
+/*
+ * Channels are specified by frequency and attributes.
+ */
+struct ieee80211_channel {
+	u_int16_t	ic_freq;	/* setting in MHz */
+	u_int16_t	ic_flags;	/* see below */
+};
+
+extern const struct ieee80211_channel ieee80211_channel_anyc;
+
+#define	IEEE80211_CHAN_MAX	255
+#define	IEEE80211_CHAN_BYTES	32	/* howmany(IEEE80211_CHAN_MAX, NBBY) */
+#define	IEEE80211_CHAN_ANY	0xffff	/* token for ``any channel'' */
+#define	IEEE80211_CHAN_ANYC 	(__UNCONST(&ieee80211_channel_anyc))
+
+/* bits 0-3 are for private use by drivers */
+/* channel attributes */
+#define	IEEE80211_CHAN_TURBO	0x0010	/* Turbo channel */
+#define	IEEE80211_CHAN_CCK	0x0020	/* CCK channel */
+#define	IEEE80211_CHAN_OFDM	0x0040	/* OFDM channel */
+#define	IEEE80211_CHAN_2GHZ	0x0080	/* 2 GHz spectrum channel. */
+#define	IEEE80211_CHAN_5GHZ	0x0100	/* 5 GHz spectrum channel */
+#define	IEEE80211_CHAN_PASSIVE	0x0200	/* Only passive scan allowed */
+#define	IEEE80211_CHAN_DYN	0x0400	/* Dynamic CCK-OFDM channel */
+#define	IEEE80211_CHAN_GFSK	0x0800	/* GFSK channel (FHSS PHY) */
+#define	IEEE80211_CHAN_GSM	0x1000	/* 900 MHz spectrum channel */
+#define	IEEE80211_CHAN_HALF	0x4000	/* Half rate channel */
+#define	IEEE80211_CHAN_QUARTER	0x8000	/* Quarter rate channel */
+
+/*
+ * Useful combinations of channel characteristics.
+ */
+#define	IEEE80211_CHAN_FHSS \
+	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
+#define	IEEE80211_CHAN_A \
+	(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
+#define	IEEE80211_CHAN_B \
+	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
+#define	IEEE80211_CHAN_PUREG \
+	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
+#define	IEEE80211_CHAN_G \
+	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
+#define	IEEE80211_CHAN_T \
+	(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
+#define	IEEE80211_CHAN_108G \
+	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
+
+#define	IEEE80211_CHAN_ALL \
+	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \
+	 IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN)
+#define	IEEE80211_CHAN_ALLTURBO \
+	(IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO)
+
+#define IEEE80211_IS_CHAN_ANYC(_c) \
+	((_c) == IEEE80211_CHAN_ANYC)
+
+#define _IEEE80211_IS_CHAN(_c, _ch) \
+	(((_c)->ic_flags & IEEE80211_CHAN_ ## _ch) == IEEE80211_CHAN_ ## _ch)
+
+#define	IEEE80211_IS_CHAN_FHSS(_c)	_IEEE80211_IS_CHAN(_c, FHSS)
+#define	IEEE80211_IS_CHAN_A(_c)		_IEEE80211_IS_CHAN(_c, A)
+#define	IEEE80211_IS_CHAN_B(_c)		_IEEE80211_IS_CHAN(_c, B)
+#define	IEEE80211_IS_CHAN_PUREG(_c)	_IEEE80211_IS_CHAN(_c, PUREG)
+#define	IEEE80211_IS_CHAN_G(_c)		_IEEE80211_IS_CHAN(_c, G)
+#define	IEEE80211_IS_CHAN_ANYG(_c)	_IEEE80211_IS_CHAN(_c, ANYG)
+#define	IEEE80211_IS_CHAN_T(_c)		_IEEE80211_IS_CHAN(_c, T)
+#define	IEEE80211_IS_CHAN_108G(_c)	_IEEE80211_IS_CHAN(_c, 108G)
+
+#define	IEEE80211_IS_CHAN_2GHZ(_c) 	_IEEE80211_IS_CHAN(_c, 2GHZ)
+#define	IEEE80211_IS_CHAN_5GHZ(_c) 	_IEEE80211_IS_CHAN(_c, 5GHZ)
+#define	IEEE80211_IS_CHAN_OFDM(_c) 	_IEEE80211_IS_CHAN(_c, OFDM)
+#define	IEEE80211_IS_CHAN_CCK(_c) 	_IEEE80211_IS_CHAN(_c, CCK)
+#define	IEEE80211_IS_CHAN_GFSK(_c) 	_IEEE80211_IS_CHAN(_c, GFSK)
+#define	IEEE80211_IS_CHAN_HALF(_c) 	_IEEE80211_IS_CHAN(_c, HALF)
+#define	IEEE80211_IS_CHAN_QUARTER(_c) 	_IEEE80211_IS_CHAN(_c, QUARTER)
+#define	IEEE80211_IS_CHAN_FULL(_c) \
+	(!IEEE80211_IS_CHAN_ANYC(_c) && \
+	((_c)->ic_flags & (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0)
+
+#define	IEEE80211_IS_CHAN_GSM(_c) 	_IEEE80211_IS_CHAN(_c, GSM)
+#define	IEEE80211_IS_CHAN_PASSIVE(_c) 	_IEEE80211_IS_CHAN(_c, PASSIVE)
+
+
+/* ni_chan encoding for FH phy */
+#define	IEEE80211_FH_CHANMOD	80
+#define	IEEE80211_FH_CHAN(set,pat)	(((set)-1)*IEEE80211_FH_CHANMOD+(pat))
+#define	IEEE80211_FH_CHANSET(chan)	((chan)/IEEE80211_FH_CHANMOD+1)
+#define	IEEE80211_FH_CHANPAT(chan)	((chan)%IEEE80211_FH_CHANMOD)
+
+/*
+ * 802.11 rate set.
+ */
+#define	IEEE80211_RATE_SIZE	8		/* 802.11 standard */
+#define	IEEE80211_RATE_MAXSIZE	15		/* max rates we'll handle */
+
+struct ieee80211_rateset {
+	u_int8_t		rs_nrates;
+	u_int8_t		rs_rates[IEEE80211_RATE_MAXSIZE];
+};
+
+extern const struct ieee80211_rateset ieee80211_std_rateset_11a;
+extern const struct ieee80211_rateset ieee80211_std_rateset_11b;
+extern const struct ieee80211_rateset ieee80211_std_rateset_11g;
+
+#endif /* !_NET80211__IEEE80211_H_ */

Property changes on: lab4/.minix-src/include/net80211/_ieee80211.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net80211/ieee80211_netbsd.h
===================================================================
--- lab4/.minix-src/include/net80211/ieee80211_netbsd.h	(nonexistent)
+++ lab4/.minix-src/include/net80211/ieee80211_netbsd.h	(revision 13)
@@ -0,0 +1,252 @@
+/* $NetBSD: ieee80211_netbsd.h,v 1.19 2014/04/07 00:07:40 pooka Exp $ */
+/*-
+ * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ *
+ * $FreeBSD: src/sys/net80211/ieee80211_freebsd.h,v 1.6 2005/08/08 18:46:36 sam Exp $
+ */
+#ifndef _NET80211_IEEE80211_NETBSD_H_
+#define _NET80211_IEEE80211_NETBSD_H_
+
+#ifdef _KERNEL
+#define	IASSERT(__cond, __complaint)	 	\
+	do {				 	\
+		if (!(__cond))		 	\
+			panic __complaint ;	\
+	} while (/*CONSTCOND*/0)
+
+void if_printf(struct ifnet *, const char *, ...)
+    __attribute__((__format__(__printf__,2,3)));
+
+#define	IEEE80211_LOCK_INIT_IMPL(_ic, _name, _member)	\
+	mutex_init(&(_ic)->_member, MUTEX_DEFAULT, IPL_NET)
+#define	IEEE80211_LOCK_IMPL(_ic, _member)		\
+	mutex_enter(&(_ic)->_member)
+#define IEEE80211_IS_LOCKED_IMPL(_ic, _member)          \
+        mutex_owned(&(_ic)->_member)
+#define	IEEE80211_UNLOCK_IMPL(_ic, _member)		\
+	mutex_exit(&(_ic)->_member)
+#define	IEEE80211_LOCK_ASSERT_IMPL(_ic, _member)	\
+	IASSERT(mutex_owned(&(_ic)->_member),		\
+	    ("%s: IEEE80211_LOCK not held", __func__))
+#define IEEE80211_LOCK_DESTROY_IMPL(_ic, _member)          \
+        mutex_destroy(&(_ic)->_member)
+
+/*
+ * Beacon locking definitions.
+ */
+typedef kmutex_t ieee80211_beacon_lock_t;
+#define	IEEE80211_BEACON_LOCK_INIT(_ic, _name)		\
+	IEEE80211_LOCK_INIT_IMPL(_ic, _name, ic_beaconlock)
+#define	IEEE80211_BEACON_LOCK_DESTROY(_ic)		\
+	IEEE80211_LOCK_DESTROY_IMPL(_ic, ic_beaconlock)
+#define	IEEE80211_BEACON_LOCK(_ic)			\
+	IEEE80211_LOCK_IMPL(_ic, ic_beaconlock)
+#define	IEEE80211_BEACON_UNLOCK(_ic)			\
+	IEEE80211_UNLOCK_IMPL(_ic, ic_beaconlock)
+#define	IEEE80211_BEACON_LOCK_ASSERT(_ic)		\
+	IEEE80211_LOCK_ASSERT_IMPL(_ic, ic_beaconlock)
+
+/*
+ * Node locking definitions.
+ * NB: MTX_DUPOK is because we don't generate per-interface strings.
+ */
+typedef kmutex_t ieee80211_node_lock_t;
+#define	IEEE80211_NODE_LOCK_INIT(_nt, _name)		\
+	IEEE80211_LOCK_INIT_IMPL(_nt, _name, nt_nodelock)
+#define	IEEE80211_NODE_LOCK_DESTROY(_nt)		\
+	IEEE80211_LOCK_DESTROY_IMPL(_nt, nt_nodelock)
+#define	IEEE80211_NODE_LOCK(_nt)			\
+	IEEE80211_LOCK_IMPL(_nt, nt_nodelock)
+#define IEEE80211_NODE_IS_LOCKED(_nt)                   \
+        IEEE80211_IS_LOCKED_IMPL(_nt, nt_nodelock)
+#define	IEEE80211_NODE_UNLOCK(_nt)			\
+	IEEE80211_UNLOCK_IMPL(_nt, nt_nodelock)
+#define	IEEE80211_NODE_LOCK_ASSERT(_nt)			\
+	IEEE80211_LOCK_ASSERT_IMPL(_nt, nt_nodelock)
+
+/*
+ * Node table scangen locking definitions.
+ */
+typedef kmutex_t ieee80211_scan_lock_t;
+#define	IEEE80211_SCAN_LOCK_INIT(_nt, _name)		\
+	IEEE80211_LOCK_INIT_IMPL(_nt, _name, nt_scanlock)
+#define	IEEE80211_SCAN_LOCK_DESTROY(_nt)		\
+	IEEE80211_LOCK_DESTROY_IMPL(_nt, nt_scanlock)
+#define	IEEE80211_SCAN_LOCK(_nt)			\
+	IEEE80211_LOCK_IMPL(_nt, nt_scanlock)
+#define	IEEE80211_SCAN_UNLOCK(_nt)			\
+	IEEE80211_UNLOCK_IMPL(_nt, nt_scanlock)
+#define	IEEE80211_SCAN_LOCK_ASSERT(_nt)			\
+	IEEE80211_LOCK_ASSERT_IMPL(_nt, nt_scanlock)
+
+/*
+ * Per-node power-save queue definitions. 
+ */
+#define	IEEE80211_NODE_SAVEQ_INIT(_ni, _name) do {		\
+	(_ni)->ni_savedq.ifq_maxlen = IEEE80211_PS_MAX_QUEUE;	\
+} while (0)
+#define	IEEE80211_NODE_SAVEQ_DESTROY(_ni)
+#define	IEEE80211_NODE_SAVEQ_QLEN(_ni)	((_ni)->ni_savedq.ifq_len)
+#define	IEEE80211_NODE_SAVEQ_LOCK(_ni)
+#define	IEEE80211_NODE_SAVEQ_UNLOCK(_ni)
+#define	IEEE80211_NODE_SAVEQ_DEQUEUE(_ni, _m, _qlen) do {	\
+	IEEE80211_NODE_SAVEQ_LOCK(_ni);				\
+	IF_DEQUEUE(&(_ni)->ni_savedq, _m);			\
+	(_qlen) = IEEE80211_NODE_SAVEQ_QLEN(_ni);		\
+	IEEE80211_NODE_SAVEQ_UNLOCK(_ni);			\
+} while (0)
+#define	IEEE80211_NODE_SAVEQ_DRAIN(_ni, _qlen) do {		\
+	IEEE80211_NODE_SAVEQ_LOCK(_ni);				\
+	(_qlen) = IEEE80211_NODE_SAVEQ_QLEN(_ni);		\
+	IF_PURGE(&(_ni)->ni_savedq);				\
+	IEEE80211_NODE_SAVEQ_UNLOCK(_ni);			\
+} while (0)
+/* XXX could be optimized */
+#define	_IEEE80211_NODE_SAVEQ_DEQUEUE_HEAD(_ni, _m) do {	\
+	IF_DEQUEUE(&(_ni)->ni_savedq, m);			\
+} while (0)
+#define	_IEEE80211_NODE_SAVEQ_ENQUEUE(_ni, _m, _qlen, _age) do {\
+	(_m)->m_nextpkt = NULL;					\
+	if ((_ni)->ni_savedq.ifq_tail != NULL) { 		\
+		_age -= M_AGE_GET((_ni)->ni_savedq.ifq_tail);	\
+		(_ni)->ni_savedq.ifq_tail->m_nextpkt = (_m);	\
+	} else { 						\
+		(_ni)->ni_savedq.ifq_head = (_m); 		\
+	}							\
+	M_AGE_SET(_m, _age);					\
+	(_ni)->ni_savedq.ifq_tail = (_m); 			\
+	(_qlen) = ++(_ni)->ni_savedq.ifq_len; 			\
+} while (0)
+
+/*
+ * 802.1x MAC ACL database locking definitions.
+ */
+typedef kmutex_t acl_lock_t;
+#define	ACL_LOCK_INIT(_as, _name)	\
+	IEEE80211_LOCK_INIT_IMPL(_as, _name, as_lock)
+#define	ACL_LOCK_DESTROY(_as)		\
+	IEEE80211_LOCK_DESTROY_IMPL(_as, as_lock)
+#define	ACL_LOCK(_as)			IEEE80211_LOCK_IMPL(_as, as_lock)
+#define	ACL_UNLOCK(_as)			IEEE80211_UNLOCK_IMPL(_as, as_lock)
+#define	ACL_LOCK_ASSERT(_as)		IEEE80211_LOCK_ASSERT_IMPL(_as, as_lock)
+
+struct ifqueue;
+void	ieee80211_drain_ifq(struct ifqueue *);
+
+struct mbuf *ieee80211_getmgtframe(u_int8_t **frm, u_int pktlen);
+#define	M_PWR_SAV	M_PROTO1		/* bypass PS handling */
+#define	M_MORE_DATA	M_LINK3			/* more data frames to follow */
+#define	M_FRAG		M_LINK4			/* 802.11 fragment */
+#define	M_FIRSTFRAG	M_LINK5			/* first 802.11 fragment */
+#define	M_FF		M_LINK6			/* "fast frames" */
+/*
+ * Encode WME access control bits in the PROTO flags.
+ * This is safe since it's passed directly in to the
+ * driver and there's no chance someone else will clobber
+ * them on us.
+ */
+#define	M_WME_AC_MASK	(M_LINK1|M_LINK2)
+/* XXX 5 is wrong if M_LINK* are redefined */
+#define	M_WME_AC_SHIFT	13
+
+#define	M_WME_SETAC(m, ac) \
+	((m)->m_flags = ((m)->m_flags &~ M_WME_AC_MASK) | \
+		((ac) << M_WME_AC_SHIFT))
+#define	M_WME_GETAC(m)	(((m)->m_flags >> M_WME_AC_SHIFT) & 0x3)
+
+/*
+ * Mbufs on the power save queue are tagged with an age and
+ * timed out.  We reuse the hardware checksum field in the
+ * mbuf packet header to store this data.
+ */
+#define	M_AGE_SET(m,v)		(m->m_pkthdr.csum_data = v)
+#define	M_AGE_GET(m)		(m->m_pkthdr.csum_data)
+#define	M_AGE_SUB(m,adj)	(m->m_pkthdr.csum_data -= adj)
+
+struct ieee80211com;
+#endif /* _KERNEL */
+
+/* XXX this stuff belongs elsewhere */
+/*
+ * Message formats for messages from the net80211 layer to user
+ * applications via the routing socket.  These messages are appended
+ * to an if_announcemsghdr structure.
+ */
+struct ieee80211_join_event {
+	uint8_t		iev_addr[6];
+};
+
+struct ieee80211_leave_event {
+	uint8_t		iev_addr[6];
+};
+
+struct ieee80211_replay_event {
+	uint8_t		iev_src[6];	/* src MAC */
+	uint8_t		iev_dst[6];	/* dst MAC */
+	uint8_t		iev_cipher;	/* cipher type */
+	uint8_t		iev_keyix;	/* key id/index */
+	uint64_t	iev_keyrsc;	/* RSC from key */
+	uint64_t	iev_rsc;	/* RSC from frame */
+};
+
+struct ieee80211_michael_event {
+	uint8_t		iev_src[6];	/* src MAC */
+	uint8_t		iev_dst[6];	/* dst MAC */
+	uint8_t		iev_cipher;	/* cipher type */
+	uint8_t		iev_keyix;	/* key id/index */
+};
+
+#define	RTM_IEEE80211_ASSOC	100	/* station associate (bss mode) */
+#define	RTM_IEEE80211_REASSOC	101	/* station re-associate (bss mode) */
+#define	RTM_IEEE80211_DISASSOC	102	/* station disassociate (bss mode) */
+#define	RTM_IEEE80211_JOIN	103	/* station join (ap mode) */
+#define	RTM_IEEE80211_LEAVE	104	/* station leave (ap mode) */
+#define	RTM_IEEE80211_SCAN	105	/* scan complete, results available */
+#define	RTM_IEEE80211_REPLAY	106	/* sequence counter replay detected */
+#define	RTM_IEEE80211_MICHAEL	107	/* Michael MIC failure detected */
+#define	RTM_IEEE80211_REJOIN	108	/* station re-associate (ap mode) */
+
+#ifdef _KERNEL
+#define	ticks	hardclock_ticks
+#define	ovbcopy(__src, __dst, __n)	((void)memmove(__dst, __src, __n))
+
+void	if_printf(struct ifnet *, const char *, ...);
+void	get_random_bytes(void *, size_t);
+
+void	ieee80211_sysctl_attach(struct ieee80211com *);
+void	ieee80211_sysctl_detach(struct ieee80211com *);
+void	ieee80211_load_module(const char *);
+
+void	ieee80211_rssadapt_sysctl_setup(struct sysctllog **);
+
+void	ieee80211_init(void);
+#define	IEEE80211_CRYPTO_SETUP(name)				\
+	static void name(void);					\
+	__link_set_add_text(ieee80211_funcs, name);		\
+	static void name(void)
+#endif
+
+#endif /* !_NET80211_IEEE80211_NETBSD_H_ */

Property changes on: lab4/.minix-src/include/net80211/ieee80211_netbsd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/icmp_var.h
===================================================================
--- lab4/.minix-src/include/netinet/icmp_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/icmp_var.h	(revision 13)
@@ -0,0 +1,95 @@
+/*	$NetBSD: icmp_var.h,v 1.30 2015/02/18 17:00:15 christos Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)icmp_var.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_ICMP_VAR_H_
+#define _NETINET_ICMP_VAR_H_
+
+/*
+ * Variables related to this implementation
+ * of the internet control message protocol.
+ */
+
+/*
+ * ICMP stastistics.
+ * Each counter is an unsigned 64-bit value.
+ */
+#define	ICMP_STAT_ERROR		0	/* # of calls to icmp_error */
+#define	ICMP_STAT_OLDSHORT	1	/* no error (old ip too short) */
+#define	ICMP_STAT_OLDICMP	2	/* no error (old was icmp) */
+#define	ICMP_STAT_BADCODE	3	/* icmp_code out of range */
+#define	ICMP_STAT_TOOSHORT	4	/* packet < ICMP_MINLEN */
+#define	ICMP_STAT_CHECKSUM	5	/* bad checksum */
+#define	ICMP_STAT_BADLEN	6	/* calculated bound mismatch */
+#define	ICMP_STAT_REFLECT	7	/* number of responses */
+#define	ICMP_STAT_PMTUCHG	8	/* path MTU changes */
+#define	ICMP_STAT_BMCASTECHO	9	/* b/mcast echo requests dropped */
+#define	ICMP_STAT_BMCASTTSTAMP	10	/* b/mcast tstamp requests dropped */
+#define	ICMP_STAT_LAST		16	/* Allow for 5 spare ones */
+#define	ICMP_STAT_OUTHIST	ICMP_STAT_LAST
+#define	ICMP_STAT_INHIST	(ICMP_STAT_LAST + ICMP_NTYPES)
+#define	ICMP_NSTATS		(ICMP_STAT_LAST + 2 * ICMP_NTYPES)
+
+/*
+ * Names for ICMP sysctl objects
+ */
+#define	ICMPCTL_MASKREPL	1	/* allow replies to netmask requests */
+#if 0	/*obsoleted*/
+#define ICMPCTL_ERRRATELIMIT	2	/* error rate limit */
+#endif
+#define ICMPCTL_RETURNDATABYTES	3	/* # of bytes to include in errors */
+#define ICMPCTL_ERRPPSLIMIT	4	/* ICMP error pps limitation */
+#define ICMPCTL_REDIRACCEPT	5	/* Accept redirects from routers */
+#define ICMPCTL_REDIRTIMEOUT	6	/* Remove routes added via redirects */
+#define	ICMPCTL_STATS		7	/* ICMP statistics */
+#define ICMPCTL_BMCASTECHO	8	/* allow broad/mult-cast echo */
+#define ICMPCTL_MAXID		9
+
+#define ICMPCTL_NAMES { \
+	{ 0, 0 }, \
+	{ "maskrepl", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ "returndatabytes", CTLTYPE_INT }, \
+	{ "errppslimit", CTLTYPE_INT }, \
+	{ "rediraccept", CTLTYPE_INT }, \
+	{ "redirtimeout", CTLTYPE_INT }, \
+	{ "stats", CTLTYPE_STRUCT }, \
+	{ "bmcastecho", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+
+void	icmp_statinc(u_int stat);
+
+#endif /* _KERNEL_ */
+
+#endif /* !_NETINET_ICMP_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet/icmp_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/ip.h
===================================================================
--- lab4/.minix-src/include/netinet/ip.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/ip.h	(revision 13)
@@ -0,0 +1,246 @@
+/*	$NetBSD: ip.h,v 1.34 2012/11/02 21:07:07 christos Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ip.h	8.2 (Berkeley) 6/1/94
+ */
+
+#ifndef _NETINET_IP_H_
+#define _NETINET_IP_H_
+
+#include <netinet/in_systm.h>	/* for n_time */
+/*
+ * Definitions for internet protocol version 4.
+ * Per RFC 791, September 1981.
+ */
+#define	IPVERSION	4
+
+/*
+ * Structure of an internet header, naked of options.
+ */
+struct ip {
+#if BYTE_ORDER == LITTLE_ENDIAN
+	unsigned int ip_hl:4,		/* header length */
+		     ip_v:4;		/* version */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	unsigned int ip_v:4,		/* version */
+		     ip_hl:4;		/* header length */
+#endif
+	u_int8_t  ip_tos;		/* type of service */
+	u_int16_t ip_len;		/* total length */
+	u_int16_t ip_id;		/* identification */
+	u_int16_t ip_off;		/* fragment offset field */
+#define	IP_RF 0x8000			/* reserved fragment flag */
+#define	IP_EF 0x8000			/* evil flag, per RFC 3514 */
+#define	IP_DF 0x4000			/* dont fragment flag */
+#define	IP_MF 0x2000			/* more fragments flag */
+#define	IP_OFFMASK 0x1fff		/* mask for fragmenting bits */
+	u_int8_t  ip_ttl;		/* time to live */
+	u_int8_t  ip_p;			/* protocol */
+	u_int16_t ip_sum;		/* checksum */
+	struct	  in_addr ip_src, ip_dst; /* source and dest address */
+} __packed;
+
+#define	IP_MAXPACKET	65535		/* maximum packet size */
+#define	IP_MINFRAGSIZE	69		/* minumum size that can be fraged */
+
+/*
+ * Definitions for IP type of service (ip_tos)
+ */
+
+/*
+ * Definitions for DiffServ Codepoints as per RFC2474
+ */
+#define	IPTOS_DSCP_CS0		0x00
+#define	IPTOS_DSCP_CS1		0x20
+#define	IPTOS_DSCP_AF11		0x28
+#define	IPTOS_DSCP_AF12		0x30
+#define	IPTOS_DSCP_AF13		0x38
+#define	IPTOS_DSCP_CS2		0x40
+#define	IPTOS_DSCP_AF21		0x48
+#define	IPTOS_DSCP_AF22		0x50
+#define	IPTOS_DSCP_AF23		0x58
+#define	IPTOS_DSCP_CS3		0x60
+#define	IPTOS_DSCP_AF31		0x68
+#define	IPTOS_DSCP_AF32		0x70
+#define	IPTOS_DSCP_AF33		0x78
+#define	IPTOS_DSCP_CS4		0x80
+#define	IPTOS_DSCP_AF41		0x88
+#define	IPTOS_DSCP_AF42		0x90
+#define	IPTOS_DSCP_AF43		0x98
+#define	IPTOS_DSCP_CS5		0xa0
+#define	IPTOS_DSCP_EF		0xb8
+#define	IPTOS_DSCP_CS6		0xc0
+#define	IPTOS_DSCP_CS7		0xe0
+
+/*
+ * Definitions for DiffServ Class Selector Codepoints
+ */
+#define	IPTOS_CLASS_CS0		0x00
+#define	IPTOS_CLASS_CS1		0x20
+#define	IPTOS_CLASS_CS2		0x40
+#define	IPTOS_CLASS_CS3		0x60
+#define	IPTOS_CLASS_CS4		0x80
+#define	IPTOS_CLASS_CS5		0xa0
+#define	IPTOS_CLASS_CS6		0xc0
+#define	IPTOS_CLASS_CS7		0xe0
+#define	IPTOS_CLASS_DEFAULT	IPTOS_CLASS_CS0
+#define	IPTOS_CLASS_MASK	0xe0
+#define	IPTOS_CLASS(cs)		((cs) & IPTOS_CLASS_MASK)
+#define	IPTOS_DSCP_MASK		0xfc
+#define	IPTOS_DSCP(cp)		((cp) & IPTOS_DSCP_MASK)
+
+/*
+ * ECN (Explicit Congestion Notification) codepoints in RFC3168
+ * mapped to the lower 2 bits of the TOS field.
+ */
+#define	IPTOS_ECN_NOTECT	0x00	/* not-ECT */
+#define	IPTOS_ECN_ECT1		0x01	/* ECN-capable transport (1) */
+#define	IPTOS_ECN_ECT0		0x02	/* ECN-capable transport (0) */
+#define	IPTOS_ECN_CE		0x03	/* congestion experienced */
+#define	IPTOS_ECN_MASK		0x03	/* ECN field mask */
+#define	IPTOS_ECN(cn)		((cn) & IPTOS_ECN_MASK)
+#define	IPTOS_ECN_NOT_ECT	0x00
+
+/*
+ * Definitions for IP type of service per RFC1349 (ip_tos)
+ * DEPRECATED
+ */
+#define	IPTOS_LOWDELAY		0x10
+#define	IPTOS_THROUGHPUT	0x08
+#define	IPTOS_RELIABILITY	0x04
+#define	IPTOS_MINCOST		0x02
+/* ECN RFC3168 obsoletes RFC2481, and these will be deprecated soon. */
+#define	IPTOS_CE		0x01	/* congestion experienced */
+#define	IPTOS_ECT		0x02	/* ECN-capable transport */
+
+/*
+ * Definitions for IP precedence per RFC1195 (also in ip_tos) (hopefully unused)
+ */
+#define	IPTOS_PREC_NETCONTROL		0xe0
+#define	IPTOS_PREC_INTERNETCONTROL	0xc0
+#define	IPTOS_PREC_CRITIC_ECP		0xa0
+#define	IPTOS_PREC_FLASHOVERRIDE	0x80
+#define	IPTOS_PREC_FLASH		0x60
+#define	IPTOS_PREC_IMMEDIATE		0x40
+#define	IPTOS_PREC_PRIORITY		0x20
+#define	IPTOS_PREC_ROUTINE		0x00
+
+/*
+ * Definitions for options.
+ */
+#define	IPOPT_COPIED(o)		((o)&0x80)
+#define	IPOPT_CLASS(o)		((o)&0x60)
+#define	IPOPT_NUMBER(o)		((o)&0x1f)
+
+#define	IPOPT_CONTROL		0x00
+#define	IPOPT_RESERVED1		0x20
+#define	IPOPT_DEBMEAS		0x40
+#define	IPOPT_RESERVED2		0x60
+
+#define	IPOPT_EOL		0		/* end of option list */
+#define	IPOPT_NOP		1		/* no operation */
+
+#define	IPOPT_RR		7		/* record packet route */
+#define	IPOPT_TS		68		/* timestamp */
+#define	IPOPT_SECURITY		130		/* provide s,c,h,tcc */
+#define	IPOPT_LSRR		131		/* loose source route */
+#define	IPOPT_SATID		136		/* satnet id */
+#define	IPOPT_SSRR		137		/* strict source route */
+
+/*
+ * Offsets to fields in options other than EOL and NOP.
+ */
+#define	IPOPT_OPTVAL		0		/* option ID */
+#define	IPOPT_OLEN		1		/* option length */
+#define	IPOPT_OFFSET		2		/* offset within option */
+#define	IPOPT_MINOFF		4		/* min value of above */
+
+/*
+ * Time stamp option structure.
+ */
+struct	ip_timestamp {
+	u_int8_t ipt_code;		/* IPOPT_TS */
+	u_int8_t ipt_len;		/* size of structure (variable) */
+	u_int8_t ipt_ptr;		/* index of current entry */
+#if BYTE_ORDER == LITTLE_ENDIAN
+	unsigned int ipt_flg:4,		/* flags, see below */
+		     ipt_oflw:4;	/* overflow counter */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	unsigned int ipt_oflw:4,	/* overflow counter */
+		     ipt_flg:4;		/* flags, see below */
+#endif
+	union ipt_timestamp {
+		 n_time	ipt_time[1];
+		 struct	ipt_ta {
+			struct in_addr ipt_addr;
+			n_time ipt_time;
+		 } ipt_ta[1] __packed;
+	} ipt_timestamp __packed;
+} __packed;
+
+/* flag bits for ipt_flg */
+#define	IPOPT_TS_TSONLY		0		/* timestamps only */
+#define	IPOPT_TS_TSANDADDR	1		/* timestamps and addresses */
+#define	IPOPT_TS_PRESPEC	3		/* specified modules only */
+
+/* bits for security (not byte swapped) */
+#define	IPOPT_SECUR_UNCLASS	0x0000
+#define	IPOPT_SECUR_CONFID	0xf135
+#define	IPOPT_SECUR_EFTO	0x789a
+#define	IPOPT_SECUR_MMMM	0xbc4d
+#define	IPOPT_SECUR_RESTR	0xaf13
+#define	IPOPT_SECUR_SECRET	0xd788
+#define	IPOPT_SECUR_TOPSECRET	0x6bc5
+
+/*
+ * Internet implementation parameters.
+ */
+#define	MAXTTL		255		/* maximum time to live (seconds) */
+#define	IPDEFTTL	64		/* default ttl, from RFC 1340 */
+#define	IPFRAGTTL	60		/* time to live for frags, slowhz */
+#define	IPTTLDEC	1		/* subtracted when forwarding */
+
+#define	IP_MSS		576		/* default maximum segment size */
+
+/*
+ * This is the real IPv4 pseudo header, used for computing the TCP and UDP
+ * checksums. For the Internet checksum, struct ipovly can be used instead.
+ * For stronger checksums, the real thing must be used.
+ */
+struct ippseudo {
+	struct	in_addr	ippseudo_src;	/* source internet address */
+	struct	in_addr	ippseudo_dst;	/* destination internet address */
+	u_int8_t	ippseudo_pad;	/* pad, must be zero */
+	u_int8_t	ippseudo_p;	/* protocol */
+	u_int16_t	ippseudo_len;	/* protocol length */
+} __packed;
+#endif /* !_NETINET_IP_H_ */

Property changes on: lab4/.minix-src/include/netinet/ip.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/ip_mroute.h
===================================================================
--- lab4/.minix-src/include/netinet/ip_mroute.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/ip_mroute.h	(revision 13)
@@ -0,0 +1,358 @@
+/*	$NetBSD: ip_mroute.h,v 1.31 2008/08/07 06:20:14 cegger Exp $	*/
+
+#ifndef _NETINET_IP_MROUTE_H_
+#define _NETINET_IP_MROUTE_H_
+
+/*
+ * Definitions for IP multicast forwarding.
+ *
+ * Written by David Waitzman, BBN Labs, August 1988.
+ * Modified by Steve Deering, Stanford, February 1989.
+ * Modified by Ajit Thyagarajan, PARC, August 1993.
+ * Modified by Ajit Thyagarajan, PARC, August 1994.
+ * Modified by Ahmed Helmy, SGI, June 1996.
+ * Modified by Pavlin Radoslavov, ICSI, October 2002.
+ *
+ * MROUTING Revision: 1.2
+ * and PIM-SMv2 and PIM-DM support, advanced API support,
+ * bandwidth metering and signaling.
+ */
+
+#include <sys/queue.h>
+#include <sys/callout.h>
+
+#ifdef _KERNEL
+struct sockopt; /* from <sys/socketvar.h> */
+#endif
+
+/*
+ * Multicast Routing set/getsockopt commands.
+ */
+#define	MRT_INIT		100	/* initialize forwarder */
+#define	MRT_DONE		101	/* shut down forwarder */
+#define	MRT_ADD_VIF		102	/* create virtual interface */
+#define	MRT_DEL_VIF		103	/* delete virtual interface */
+#define	MRT_ADD_MFC		104	/* insert forwarding cache entry */
+#define	MRT_DEL_MFC		105	/* delete forwarding cache entry */
+#define	MRT_VERSION		106	/* get kernel version number */
+#define	MRT_ASSERT		107	/* enable assert processing */
+#define MRT_PIM			MRT_ASSERT /* enable PIM processing */
+#define MRT_API_SUPPORT		109	/* supported MRT API */
+#define MRT_API_CONFIG		110	/* config MRT API */
+#define MRT_ADD_BW_UPCALL	111	/* create bandwidth monitor */
+#define MRT_DEL_BW_UPCALL	112	/* delete bandwidth monitor */
+
+
+/*
+ * Types and macros for handling bitmaps with one bit per virtual interface.
+ */
+#define	MAXVIFS 32
+typedef u_int32_t vifbitmap_t;
+typedef u_int16_t vifi_t;		/* type of a vif index */
+
+#define	VIFM_SET(n, m)			((m) |= (1 << (n)))
+#define	VIFM_CLR(n, m)			((m) &= ~(1 << (n)))
+#define	VIFM_ISSET(n, m)		((m) & (1 << (n)))
+#define	VIFM_SETALL(m)			((m) = 0xffffffff)
+#define	VIFM_CLRALL(m)			((m) = 0x00000000)
+#define	VIFM_COPY(mfrom, mto)		((mto) = (mfrom))
+#define	VIFM_SAME(m1, m2)		((m1) == (m2))
+
+#define	VIFF_TUNNEL	0x1		/* vif represents a tunnel end-point */
+#define	VIFF_SRCRT	0x2		/* tunnel uses IP src routing */
+#define VIFF_REGISTER	0x4		/* used for PIM Register encap/decap */
+
+/*
+ * Argument structure for MRT_ADD_VIF.
+ * (MRT_DEL_VIF takes a single vifi_t argument.)
+ */
+struct vifctl {
+	vifi_t	  vifc_vifi;	    	/* the index of the vif to be added */
+	u_int8_t  vifc_flags;     	/* VIFF_ flags defined below */
+	u_int8_t  vifc_threshold; 	/* min ttl required to forward on vif */
+	u_int32_t vifc_rate_limit;	/* max rate */
+	struct	  in_addr vifc_lcl_addr;/* local interface address */
+	struct	  in_addr vifc_rmt_addr;/* remote address (tunnels only) */
+};
+
+/*
+ * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC.
+ * XXX if you change this, make sure to change struct mfcctl2 as well.
+ */
+struct mfcctl {
+	struct	 in_addr mfcc_origin;	/* ip origin of mcasts */
+	struct	 in_addr mfcc_mcastgrp;	/* multicast group associated */
+	vifi_t	 mfcc_parent;		/* incoming vif */
+	u_int8_t mfcc_ttls[MAXVIFS];	/* forwarding ttls on vifs */
+};
+
+/*
+ * The new argument structure for MRT_ADD_MFC and MRT_DEL_MFC overlays
+ * and extends the old struct mfcctl.
+ */
+struct mfcctl2 {
+	/* the mfcctl fields */
+	struct in_addr	mfcc_origin;		/* ip origin of mcasts	     */
+	struct in_addr	mfcc_mcastgrp;		/* multicast group associated*/
+	vifi_t		mfcc_parent;		/* incoming vif		     */
+	u_int8_t	mfcc_ttls[MAXVIFS]; 	/* forwarding ttls on vifs   */
+
+	/* extension fields */
+	u_int8_t	mfcc_flags[MAXVIFS];	/* the MRT_MFC_FLAGS_* flags */
+	struct in_addr	mfcc_rp;		/* the RP address            */
+};
+/*
+ * The advanced-API flags.
+ *
+ * The MRT_MFC_FLAGS_XXX API flags are also used as flags
+ * for the mfcc_flags field.
+ */
+#define	MRT_MFC_FLAGS_DISABLE_WRONGVIF	(1 << 0) /* disable WRONGVIF signals */
+#define	MRT_MFC_FLAGS_BORDER_VIF	(1 << 1) /* border vif		     */
+#define MRT_MFC_RP			(1 << 8) /* enable RP address	     */
+#define MRT_MFC_BW_UPCALL		(1 << 9) /* enable bw upcalls	     */
+#define MRT_MFC_FLAGS_ALL		(MRT_MFC_FLAGS_DISABLE_WRONGVIF |    \
+					 MRT_MFC_FLAGS_BORDER_VIF)
+#define MRT_API_FLAGS_ALL		(MRT_MFC_FLAGS_ALL |		     \
+					 MRT_MFC_RP |			     \
+					 MRT_MFC_BW_UPCALL)
+
+/*
+ * Structure for installing or delivering an upcall if the
+ * measured bandwidth is above or below a threshold.
+ *
+ * User programs (e.g. daemons) may have a need to know when the
+ * bandwidth used by some data flow is above or below some threshold.
+ * This interface allows the userland to specify the threshold (in
+ * bytes and/or packets) and the measurement interval. Flows are
+ * all packet with the same source and destination IP address.
+ * At the moment the code is only used for multicast destinations
+ * but there is nothing that prevents its use for unicast.
+ *
+ * The measurement interval cannot be shorter than some Tmin (currently, 3s).
+ * The threshold is set in packets and/or bytes per_interval.
+ *
+ * Measurement works as follows:
+ *
+ * For >= measurements:
+ * The first packet marks the start of a measurement interval.
+ * During an interval we count packets and bytes, and when we
+ * pass the threshold we deliver an upcall and we are done.
+ * The first packet after the end of the interval resets the
+ * count and restarts the measurement.
+ *
+ * For <= measurement:
+ * We start a timer to fire at the end of the interval, and
+ * then for each incoming packet we count packets and bytes.
+ * When the timer fires, we compare the value with the threshold,
+ * schedule an upcall if we are below, and restart the measurement
+ * (reschedule timer and zero counters).
+ */
+
+struct bw_data {
+	struct timeval	b_time;
+	u_int64_t	b_packets;
+	u_int64_t	b_bytes;
+};
+
+struct bw_upcall {
+	struct in_addr	bu_src;			/* source address            */
+	struct in_addr	bu_dst;			/* destination address       */
+	u_int32_t	bu_flags;		/* misc flags (see below)    */
+#define BW_UPCALL_UNIT_PACKETS   (1 << 0)	/* threshold (in packets)    */
+#define BW_UPCALL_UNIT_BYTES     (1 << 1)	/* threshold (in bytes)      */
+#define BW_UPCALL_GEQ            (1 << 2)	/* upcall if bw >= threshold */
+#define BW_UPCALL_LEQ            (1 << 3)	/* upcall if bw <= threshold */
+#define BW_UPCALL_DELETE_ALL     (1 << 4)	/* delete all upcalls for s,d*/
+	struct bw_data	bu_threshold;		/* the bw threshold	     */
+	struct bw_data	bu_measured;		/* the measured bw	     */
+};
+
+/* max. number of upcalls to deliver together */
+#define BW_UPCALLS_MAX				128
+/* min. threshold time interval for bandwidth measurement */
+#define BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC	3
+#define BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC	0
+
+/*
+ * Argument structure used by mrouted to get src-grp pkt counts.
+ */
+struct sioc_sg_req {
+	struct	in_addr src;
+	struct	in_addr grp;
+	u_long	pktcnt;
+	u_long	bytecnt;
+	u_long	wrong_if;
+};
+
+/*
+ * Argument structure used by mrouted to get vif pkt counts.
+ */
+struct sioc_vif_req {
+	vifi_t	vifi;			/* vif number */
+	u_long	icount;			/* input packet count on vif */
+	u_long	ocount;			/* output packet count on vif */
+	u_long	ibytes;			/* input byte count on vif */
+	u_long	obytes;			/* output byte count on vif */
+};
+
+
+/*
+ * The kernel's multicast routing statistics.
+ */
+struct mrtstat {
+	u_long	mrts_mfc_lookups;	/* # forw. cache hash table hits */
+	u_long	mrts_mfc_misses;	/* # forw. cache hash table misses */
+	u_long	mrts_upcalls;		/* # calls to mrouted */
+	u_long	mrts_no_route;		/* no route for packet's origin */
+	u_long	mrts_bad_tunnel;	/* malformed tunnel options */
+	u_long	mrts_cant_tunnel;	/* no room for tunnel options */
+	u_long	mrts_wrong_if;		/* arrived on wrong interface */
+	u_long	mrts_upq_ovflw;		/* upcall Q overflow */
+	u_long	mrts_cache_cleanups;	/* # entries with no upcalls */
+	u_long	mrts_drop_sel;     	/* pkts dropped selectively */
+	u_long	mrts_q_overflow;    	/* pkts dropped - Q overflow */
+	u_long	mrts_pkt2large;     	/* pkts dropped - size > BKT SIZE */
+	u_long	mrts_upq_sockfull;	/* upcalls dropped - socket full */
+};
+
+
+#ifdef _KERNEL
+
+/*
+ * The kernel's virtual-interface structure.
+ */
+struct encaptab;
+struct vif {
+	struct	  mbuf *tbf_q, **tbf_t;	/* packet queue */
+	struct	  timeval tbf_last_pkt_t; /* arr. time of last pkt */
+	u_int32_t tbf_n_tok;		/* no of tokens in bucket */
+	u_int32_t tbf_q_len;		/* length of queue at this vif */
+	u_int32_t tbf_max_q_len;	/* max. queue length */
+
+	u_int8_t  v_flags;		/* VIFF_ flags defined above */
+	u_int8_t  v_threshold;		/* min ttl required to forward on vif */
+	u_int32_t v_rate_limit;		/* max rate */
+	struct	  in_addr v_lcl_addr;	/* local interface address */
+	struct	  in_addr v_rmt_addr;	/* remote address (tunnels only) */
+	struct	  ifnet *v_ifp;		/* pointer to interface */
+	u_long	  v_pkt_in;		/* # pkts in on interface */
+	u_long	  v_pkt_out;		/* # pkts out on interface */
+	u_long	  v_bytes_in;		/* # bytes in on interface */
+	u_long	  v_bytes_out;		/* # bytes out on interface */
+	struct	  route v_route;	/* cached route if this is a tunnel */
+	callout_t v_repq_ch;		/* for tbf_reprocess_q() */
+#ifdef RSVP_ISI
+	int	  v_rsvp_on;		/* # RSVP listening on this vif */
+	struct	  socket *v_rsvpd;	/* # RSVPD daemon */
+#endif /* RSVP_ISI */
+	const struct encaptab *v_encap_cookie;
+};
+
+/*
+ * The kernel's multicast forwarding cache entry structure.
+ * (A field for the type of service (mfc_tos) is to be added
+ * at a future point.)
+ */
+struct mfc {
+	LIST_ENTRY(mfc) mfc_hash;
+	struct	 in_addr mfc_origin;	 	/* ip origin of mcasts */
+	struct	 in_addr mfc_mcastgrp;  	/* multicast group associated */
+	vifi_t	 mfc_parent;			/* incoming vif */
+	u_int8_t mfc_ttls[MAXVIFS]; 		/* forwarding ttls on vifs */
+	u_long	 mfc_pkt_cnt;			/* pkt count for src-grp */
+	u_long	 mfc_byte_cnt;			/* byte count for src-grp */
+	u_long	 mfc_wrong_if;			/* wrong if for src-grp	*/
+	int	 mfc_expire;			/* time to clean entry up */
+	struct	 timeval mfc_last_assert;	/* last time I sent an assert */
+	struct	 rtdetq *mfc_stall;		/* pkts waiting for route */
+	u_int8_t mfc_flags[MAXVIFS];		/* the MRT_MFC_FLAGS_* flags */
+	struct	 in_addr mfc_rp;		/* the RP address	     */
+	struct	 bw_meter *mfc_bw_meter;	/* list of bandwidth meters  */
+};
+
+/*
+ * Structure used to communicate from kernel to multicast router.
+ * (Note the convenient similarity to an IP packet.)
+ */
+struct igmpmsg {
+	u_int32_t unused1;
+	u_int32_t unused2;
+	u_int8_t  im_msgtype;		/* what type of message */
+#define IGMPMSG_NOCACHE		1	/* no MFC in the kernel		    */
+#define IGMPMSG_WRONGVIF	2	/* packet came from wrong interface */
+#define	IGMPMSG_WHOLEPKT	3	/* PIM pkt for user level encap.    */
+#define	IGMPMSG_BW_UPCALL	4	/* BW monitoring upcall		    */
+	u_int8_t  im_mbz;		/* must be zero */
+	u_int8_t  im_vif;		/* vif rec'd on */
+	u_int8_t  unused3;
+	struct	  in_addr im_src, im_dst;
+} __packed;
+
+/*
+ * Argument structure used for pkt info. while upcall is made.
+ */
+struct rtdetq {
+	struct	mbuf *m;		/* a copy of the packet */
+	struct	ifnet *ifp;		/* interface pkt came in on */
+#ifdef UPCALL_TIMING
+	struct	timeval t;		/* timestamp */
+#endif /* UPCALL_TIMING */
+	struct	rtdetq *next;
+};
+
+#define	MFCTBLSIZ	256
+#define	MAX_UPQ		4		/* max. no of pkts in upcall Q */
+
+/*
+ * Token bucket filter code
+ */
+#define	MAX_BKT_SIZE    10000		/* 10K bytes size */
+#define	MAXQSIZE        10		/* max. no of pkts in token queue */
+
+/*
+ * Structure for measuring the bandwidth and sending an upcall if the
+ * measured bandwidth is above or below a threshold.
+ */
+struct bw_meter {
+	struct bw_meter	*bm_mfc_next;		/* next bw meter (same mfc)  */
+	struct bw_meter	*bm_time_next;		/* next bw meter (same time) */
+	uint32_t	bm_time_hash;		/* the time hash value       */
+	struct mfc	*bm_mfc;		/* the corresponding mfc     */
+	uint32_t	bm_flags;		/* misc flags (see below)    */
+#define BW_METER_UNIT_PACKETS	(1 << 0)	/* threshold (in packets)    */
+#define BW_METER_UNIT_BYTES	(1 << 1)	/* threshold (in bytes)      */
+#define BW_METER_GEQ		(1 << 2)	/* upcall if bw >= threshold */
+#define BW_METER_LEQ		(1 << 3)	/* upcall if bw <= threshold */
+#define BW_METER_USER_FLAGS 	(BW_METER_UNIT_PACKETS |		\
+				 BW_METER_UNIT_BYTES |			\
+				 BW_METER_GEQ |				\
+				 BW_METER_LEQ)
+
+#define BW_METER_UPCALL_DELIVERED (1 << 24)	/* upcall was delivered      */
+
+	struct bw_data	bm_threshold;		/* the upcall threshold	     */
+	struct bw_data	bm_measured;		/* the measured bw	     */
+	struct timeval	bm_start_time;		/* abs. time		     */
+};
+
+int	ip_mrouter_set(struct socket *, struct sockopt *);
+int	ip_mrouter_get(struct socket *, struct sockopt *);
+int	mrt_ioctl(struct socket *, u_long, void *);
+int	ip_mrouter_done(void);
+void	ip_mrouter_detach(struct ifnet *);
+void	reset_vif(struct vif *);
+#ifdef RSVP_ISI
+int	ip_mforward(struct mbuf *, struct ifnet *, struct ip_moptions *);
+int	legal_vif_num(int);
+int	ip_rsvp_vif_init(struct socket *, struct mbuf *);
+int	ip_rsvp_vif_done(struct socket *, struct mbuf *);
+void	ip_rsvp_force_done(struct socket *);
+void	rsvp_input(struct mbuf *, int, int);
+#else
+int	ip_mforward(struct mbuf *, struct ifnet *);
+#endif
+
+#endif /* _KERNEL */
+
+#endif /* !_NETINET_IP_MROUTE_H_ */

Property changes on: lab4/.minix-src/include/netinet/ip_mroute.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet6/in6_var.h
===================================================================
--- lab4/.minix-src/include/netinet6/in6_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet6/in6_var.h	(revision 13)
@@ -0,0 +1,716 @@
+/*	$NetBSD: in6_var.h,v 1.74 2015/09/06 06:01:01 dholland Exp $	*/
+/*	$KAME: in6_var.h,v 1.81 2002/06/08 11:16:51 itojun Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1985, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)in_var.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET6_IN6_VAR_H_
+#define _NETINET6_IN6_VAR_H_
+
+#include <sys/callout.h>
+#include <sys/ioccom.h>
+
+/*
+ * Interface address, Internet version.  One of these structures
+ * is allocated for each interface with an Internet address.
+ * The ifaddr structure contains the protocol-independent part
+ * of the structure and is assumed to be first.
+ */
+
+/*
+ * pltime/vltime are just for future reference (required to implements 2
+ * hour rule for hosts).  they should never be modified by nd6_timeout or
+ * anywhere else.
+ *	userland -> kernel: accept pltime/vltime
+ *	kernel -> userland: throw up everything
+ *	in kernel: modify preferred/expire only
+ */
+struct in6_addrlifetime {
+	time_t ia6t_expire;	/* valid lifetime expiration time */
+	time_t ia6t_preferred;	/* preferred lifetime expiration time */
+	u_int32_t ia6t_vltime;	/* valid lifetime */
+	u_int32_t ia6t_pltime;	/* prefix lifetime */
+};
+
+struct nd_ifinfo;
+struct in6_ifextra {
+	struct in6_ifstat *in6_ifstat;
+	struct icmp6_ifstat *icmp6_ifstat;
+	struct nd_ifinfo *nd_ifinfo;
+	struct scope6_id *scope6_id;
+	int nprefixes;
+	int ndefrouters;
+};
+
+LIST_HEAD(in6_multihead, in6_multi);
+struct	in6_ifaddr {
+	struct	ifaddr ia_ifa;		/* protocol-independent info */
+#define	ia_ifp		ia_ifa.ifa_ifp
+#define ia_flags	ia_ifa.ifa_flags
+	struct	sockaddr_in6 ia_addr;	/* interface address */
+	struct	sockaddr_in6 ia_net;	/* network number of interface */
+	struct	sockaddr_in6 ia_dstaddr; /* space for destination addr */
+	struct	sockaddr_in6 ia_prefixmask; /* prefix mask */
+	u_int32_t ia_plen;		/* prefix length */
+	struct	in6_ifaddr *ia_next;	/* next in6 list of IP6 addresses */
+	struct	in6_multihead ia6_multiaddrs;
+					/* list of multicast addresses */
+	int	ia6_flags;
+
+	struct in6_addrlifetime ia6_lifetime;
+	time_t	ia6_createtime; /* the creation time of this address, which is
+				 * currently used for temporary addresses only.
+				 */
+	time_t	ia6_updatetime;
+
+	/* back pointer to the ND prefix (for autoconfigured addresses only) */
+	struct nd_prefix *ia6_ndpr;
+
+	/* multicast addresses joined from the kernel */
+	LIST_HEAD(, in6_multi_mship) ia6_memberships;
+};
+
+/* control structure to manage address selection policy */
+struct in6_addrpolicy {
+	struct sockaddr_in6 addr; /* prefix address */
+	struct sockaddr_in6 addrmask; /* prefix mask */
+	int preced;		/* precedence */
+	int label;		/* matching label */
+	u_quad_t use;		/* statistics */
+};
+
+/*
+ * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12).
+ */
+struct in6_ifstat {
+	u_quad_t ifs6_in_receive;	/* # of total input datagram */
+	u_quad_t ifs6_in_hdrerr;	/* # of datagrams with invalid hdr */
+	u_quad_t ifs6_in_toobig;	/* # of datagrams exceeded MTU */
+	u_quad_t ifs6_in_noroute;	/* # of datagrams with no route */
+	u_quad_t ifs6_in_addrerr;	/* # of datagrams with invalid dst */
+	u_quad_t ifs6_in_protounknown;	/* # of datagrams with unknown proto */
+					/* NOTE: increment on final dst if */
+	u_quad_t ifs6_in_truncated;	/* # of truncated datagrams */
+	u_quad_t ifs6_in_discard;	/* # of discarded datagrams */
+					/* NOTE: fragment timeout is not here */
+	u_quad_t ifs6_in_deliver;	/* # of datagrams delivered to ULP */
+					/* NOTE: increment on final dst if */
+	u_quad_t ifs6_out_forward;	/* # of datagrams forwarded */
+					/* NOTE: increment on outgoing if */
+	u_quad_t ifs6_out_request;	/* # of outgoing datagrams from ULP */
+					/* NOTE: does not include forwrads */
+	u_quad_t ifs6_out_discard;	/* # of discarded datagrams */
+	u_quad_t ifs6_out_fragok;	/* # of datagrams fragmented */
+	u_quad_t ifs6_out_fragfail;	/* # of datagrams failed on fragment */
+	u_quad_t ifs6_out_fragcreat;	/* # of fragment datagrams */
+					/* NOTE: this is # after fragment */
+	u_quad_t ifs6_reass_reqd;	/* # of incoming fragmented packets */
+					/* NOTE: increment on final dst if */
+	u_quad_t ifs6_reass_ok;		/* # of reassembled packets */
+					/* NOTE: this is # after reass */
+					/* NOTE: increment on final dst if */
+	u_quad_t ifs6_reass_fail;	/* # of reass failures */
+					/* NOTE: may not be packet count */
+					/* NOTE: increment on final dst if */
+	u_quad_t ifs6_in_mcast;		/* # of inbound multicast datagrams */
+	u_quad_t ifs6_out_mcast;	/* # of outbound multicast datagrams */
+};
+
+/*
+ * ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry.
+ * XXX: I'm not sure if this file is the right place for this structure...
+ */
+struct icmp6_ifstat {
+	/*
+	 * Input statistics
+	 */
+	/* ipv6IfIcmpInMsgs, total # of input messages */
+	u_quad_t ifs6_in_msg;
+	/* ipv6IfIcmpInErrors, # of input error messages */
+	u_quad_t ifs6_in_error;
+	/* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */
+	u_quad_t ifs6_in_dstunreach;
+	/* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */
+	u_quad_t ifs6_in_adminprohib;
+	/* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */
+	u_quad_t ifs6_in_timeexceed;
+	/* ipv6IfIcmpInParmProblems, # of input parameter problem errors */
+	u_quad_t ifs6_in_paramprob;
+	/* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */
+	u_quad_t ifs6_in_pkttoobig;
+	/* ipv6IfIcmpInEchos, # of input echo requests */
+	u_quad_t ifs6_in_echo;
+	/* ipv6IfIcmpInEchoReplies, # of input echo replies */
+	u_quad_t ifs6_in_echoreply;
+	/* ipv6IfIcmpInRouterSolicits, # of input router solicitations */
+	u_quad_t ifs6_in_routersolicit;
+	/* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */
+	u_quad_t ifs6_in_routeradvert;
+	/* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */
+	u_quad_t ifs6_in_neighborsolicit;
+	/* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */
+	u_quad_t ifs6_in_neighboradvert;
+	/* ipv6IfIcmpInRedirects, # of input redirects */
+	u_quad_t ifs6_in_redirect;
+	/* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */
+	u_quad_t ifs6_in_mldquery;
+	/* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */
+	u_quad_t ifs6_in_mldreport;
+	/* ipv6IfIcmpInGroupMembReductions, # of input MLD done */
+	u_quad_t ifs6_in_mlddone;
+
+	/*
+	 * Output statistics. We should solve unresolved routing problem...
+	 */
+	/* ipv6IfIcmpOutMsgs, total # of output messages */
+	u_quad_t ifs6_out_msg;
+	/* ipv6IfIcmpOutErrors, # of output error messages */
+	u_quad_t ifs6_out_error;
+	/* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */
+	u_quad_t ifs6_out_dstunreach;
+	/* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */
+	u_quad_t ifs6_out_adminprohib;
+	/* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */
+	u_quad_t ifs6_out_timeexceed;
+	/* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */
+	u_quad_t ifs6_out_paramprob;
+	/* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */
+	u_quad_t ifs6_out_pkttoobig;
+	/* ipv6IfIcmpOutEchos, # of output echo requests */
+	u_quad_t ifs6_out_echo;
+	/* ipv6IfIcmpOutEchoReplies, # of output echo replies */
+	u_quad_t ifs6_out_echoreply;
+	/* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */
+	u_quad_t ifs6_out_routersolicit;
+	/* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */
+	u_quad_t ifs6_out_routeradvert;
+	/* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */
+	u_quad_t ifs6_out_neighborsolicit;
+	/* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */
+	u_quad_t ifs6_out_neighboradvert;
+	/* ipv6IfIcmpOutRedirects, # of output redirects */
+	u_quad_t ifs6_out_redirect;
+	/* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */
+	u_quad_t ifs6_out_mldquery;
+	/* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */
+	u_quad_t ifs6_out_mldreport;
+	/* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */
+	u_quad_t ifs6_out_mlddone;
+};
+
+/*
+ * If you make changes that change the size of in6_ifreq,
+ * make sure you fix compat/netinet6/in6_var.h
+ */
+struct	in6_ifreq {
+	char	ifr_name[IFNAMSIZ];
+	union {
+		struct	sockaddr_in6 ifru_addr;
+		struct	sockaddr_in6 ifru_dstaddr;
+		short	ifru_flags;
+		int	ifru_flags6;
+		int	ifru_metric;
+		void *	ifru_data;
+		struct in6_addrlifetime ifru_lifetime;
+		struct in6_ifstat ifru_stat;
+		struct icmp6_ifstat ifru_icmp6stat;
+	} ifr_ifru;
+};
+
+struct	in6_aliasreq {
+	char	ifra_name[IFNAMSIZ];
+	struct	sockaddr_in6 ifra_addr;
+	struct	sockaddr_in6 ifra_dstaddr;
+	struct	sockaddr_in6 ifra_prefixmask;
+	int	ifra_flags;
+	struct in6_addrlifetime ifra_lifetime;
+};
+
+/* prefix type macro */
+#define IN6_PREFIX_ND	1
+#define IN6_PREFIX_RR	2
+
+/*
+ * prefix related flags passed between kernel(NDP related part) and
+ * user land command(ifconfig) and daemon(rtadvd).
+ * Note: We originally intended to use prf_ra{} only within in6_prflags{}, but
+ * it was (probably unintentionally) used in nd6.h as well.  Since C++ does
+ * not allow such a reference, prf_ra{} was then moved outside.  In general,
+ * however, this structure should not be used directly.
+ */
+struct prf_ra {
+	u_int32_t onlink : 1;
+	u_int32_t autonomous : 1;
+	u_int32_t router : 1;
+	u_int32_t reserved : 5;
+};
+
+struct in6_prflags {
+	struct prf_ra prf_ra;
+	u_char prf_reserved1;
+	u_short prf_reserved2;
+	/* want to put this on 4byte offset */
+	struct prf_rr {
+		u_int32_t decrvalid : 1;
+		u_int32_t decrprefd : 1;
+		u_int32_t reserved : 6;
+	} prf_rr;
+	u_char prf_reserved3;
+	u_short prf_reserved4;
+};
+
+struct  in6_prefixreq {
+	char	ipr_name[IFNAMSIZ];
+	u_char	ipr_origin;
+	u_char	ipr_plen;
+	u_int32_t ipr_vltime;
+	u_int32_t ipr_pltime;
+	struct in6_prflags ipr_flags;
+	struct	sockaddr_in6 ipr_prefix;
+};
+
+#define PR_ORIG_RA	0
+#define PR_ORIG_RR	1
+#define PR_ORIG_STATIC	2
+#define PR_ORIG_KERNEL	3
+
+#define ipr_raf_onlink		ipr_flags.prf_ra.onlink
+#define ipr_raf_auto		ipr_flags.prf_ra.autonomous
+
+#define ipr_statef_onlink	ipr_flags.prf_state.onlink
+
+#define ipr_rrf_decrvalid	ipr_flags.prf_rr.decrvalid
+#define ipr_rrf_decrprefd	ipr_flags.prf_rr.decrprefd
+
+struct	in6_rrenumreq {
+	char	irr_name[IFNAMSIZ];
+	u_char	irr_origin;
+	u_char	irr_m_len;	/* match len for matchprefix */
+	u_char	irr_m_minlen;	/* minlen for matching prefix */
+	u_char	irr_m_maxlen;	/* maxlen for matching prefix */
+	u_char	irr_u_uselen;	/* uselen for adding prefix */
+	u_char	irr_u_keeplen;	/* keeplen from matching prefix */
+	struct irr_raflagmask {
+		u_int32_t onlink : 1;
+		u_int32_t autonomous : 1;
+		u_int32_t reserved : 6;
+	} irr_raflagmask;
+	u_int32_t irr_vltime;
+	u_int32_t irr_pltime;
+	struct in6_prflags irr_flags;
+	struct	sockaddr_in6 irr_matchprefix;
+	struct	sockaddr_in6 irr_useprefix;
+};
+
+#define irr_raf_mask_onlink	irr_raflagmask.onlink
+#define irr_raf_mask_auto	irr_raflagmask.autonomous
+#define irr_raf_mask_reserved	irr_raflagmask.reserved
+
+#define irr_raf_onlink		irr_flags.prf_ra.onlink
+#define irr_raf_auto		irr_flags.prf_ra.autonomous
+
+#define irr_statef_onlink	irr_flags.prf_state.onlink
+
+#define irr_rrf			irr_flags.prf_rr
+#define irr_rrf_decrvalid	irr_flags.prf_rr.decrvalid
+#define irr_rrf_decrprefd	irr_flags.prf_rr.decrprefd
+
+/*
+ * Given a pointer to an in6_ifaddr (ifaddr),
+ * return a pointer to the addr as a sockaddr_in6
+ */
+#define IA6_IN6(ia)	(&((ia)->ia_addr.sin6_addr))
+#define IA6_DSTIN6(ia)	(&((ia)->ia_dstaddr.sin6_addr))
+#define IA6_MASKIN6(ia)	(&((ia)->ia_prefixmask.sin6_addr))
+#define IA6_SIN6(ia)	(&((ia)->ia_addr))
+#define IA6_DSTSIN6(ia)	(&((ia)->ia_dstaddr))
+#define IFA_IN6(x)	(&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr)
+#define IFA_DSTIN6(x)	(&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr)
+
+#ifdef _KERNEL
+#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m)	(	\
+	(((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \
+	(((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \
+	(((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \
+	(((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 )
+#endif
+
+#define SIOCSIFADDR_IN6		 _IOW('i', 12, struct in6_ifreq)
+#define SIOCGIFADDR_IN6		_IOWR('i', 33, struct in6_ifreq)
+
+#ifdef _KERNEL
+/*
+ * SIOCSxxx ioctls should be unused (see comments in in6.c), but
+ * we do not shift numbers for binary compatibility.
+ */
+#define SIOCSIFDSTADDR_IN6	 _IOW('i', 14, struct in6_ifreq)
+#define SIOCSIFNETMASK_IN6	 _IOW('i', 22, struct in6_ifreq)
+#endif
+
+#define SIOCGIFDSTADDR_IN6	_IOWR('i', 34, struct in6_ifreq)
+#define SIOCGIFNETMASK_IN6	_IOWR('i', 37, struct in6_ifreq)
+
+#define SIOCDIFADDR_IN6		 _IOW('i', 25, struct in6_ifreq)
+/* 26 was OSIOCAIFADDR_IN6 */
+
+/* 70 was OSIOCSIFPHYADDR_IN6 */
+#define	SIOCGIFPSRCADDR_IN6	_IOWR('i', 71, struct in6_ifreq)
+#define	SIOCGIFPDSTADDR_IN6	_IOWR('i', 72, struct in6_ifreq)
+
+#define SIOCGIFAFLAG_IN6	_IOWR('i', 73, struct in6_ifreq)
+
+#define SIOCGDRLST_IN6		_IOWR('i', 74, struct in6_drlist)
+#define SIOCGPRLST_IN6		_IOWR('i', 75, struct in6_oprlist)
+#ifdef _KERNEL
+#define OSIOCGIFINFO_IN6	_IOWR('i', 76, struct in6_ondireq)
+#endif
+#define SIOCSNDFLUSH_IN6	_IOWR('i', 77, struct in6_ifreq)
+#define SIOCGNBRINFO_IN6	_IOWR('i', 78, struct in6_nbrinfo)
+#define SIOCSPFXFLUSH_IN6	_IOWR('i', 79, struct in6_ifreq)
+#define SIOCSRTRFLUSH_IN6	_IOWR('i', 80, struct in6_ifreq)
+/* 81 was old SIOCGIFALIFETIME_IN6 */
+#if 0
+/* withdrawn - do not reuse number 82 */
+#define SIOCSIFALIFETIME_IN6	_IOWR('i', 82, struct in6_ifreq)
+#endif
+#define SIOCGIFSTAT_IN6		_IOWR('i', 83, struct in6_ifreq)
+#define SIOCGIFSTAT_ICMP6	_IOWR('i', 84, struct in6_ifreq)
+
+#define SIOCSDEFIFACE_IN6	_IOWR('i', 85, struct in6_ndifreq)
+#define SIOCGDEFIFACE_IN6	_IOWR('i', 86, struct in6_ndifreq)
+
+#define SIOCSIFINFO_FLAGS	_IOWR('i', 87, struct in6_ndireq) /* XXX */
+
+#define SIOCSIFPREFIX_IN6	_IOW('i', 100, struct in6_prefixreq) /* set */
+#define SIOCGIFPREFIX_IN6	_IOWR('i', 101, struct in6_prefixreq) /* get */
+#define SIOCDIFPREFIX_IN6	_IOW('i', 102, struct in6_prefixreq) /* del */
+#define SIOCAIFPREFIX_IN6	_IOW('i', 103, struct in6_rrenumreq) /* add */
+#define SIOCCIFPREFIX_IN6	_IOW('i', 104, \
+				     struct in6_rrenumreq) /* change */
+#define SIOCSGIFPREFIX_IN6	_IOW('i', 105, \
+				     struct in6_rrenumreq) /* set global */
+#define SIOCGIFALIFETIME_IN6	_IOWR('i', 106, struct in6_ifreq)
+#define SIOCAIFADDR_IN6		_IOW('i', 107, struct in6_aliasreq)
+#define SIOCGIFINFO_IN6		_IOWR('i', 108, struct in6_ndireq)
+#define SIOCSIFINFO_IN6		_IOWR('i', 109, struct in6_ndireq)
+#define SIOCSIFPHYADDR_IN6      _IOW('i', 110, struct in6_aliasreq)
+
+
+/* XXX: Someone decided to switch to 'u' here for unknown reasons! */
+#define SIOCGETSGCNT_IN6	_IOWR('u', 106, \
+				      struct sioc_sg_req6) /* get s,g pkt cnt */
+#define SIOCGETMIFCNT_IN6	_IOWR('u', 107, \
+				      struct sioc_mif_req6) /* get pkt cnt per if */
+#define SIOCAADDRCTL_POLICY	_IOW('u', 108, struct in6_addrpolicy)
+#define SIOCDADDRCTL_POLICY	_IOW('u', 109, struct in6_addrpolicy)
+
+#define IN6_IFF_ANYCAST		0x01	/* anycast address */
+#define IN6_IFF_TENTATIVE	0x02	/* tentative address */
+#define IN6_IFF_DUPLICATED	0x04	/* DAD detected duplicate */
+#define IN6_IFF_DETACHED	0x08	/* may be detached from the link */
+#define IN6_IFF_DEPRECATED	0x10	/* deprecated address */
+#define IN6_IFF_NODAD		0x20	/* don't perform DAD on this address
+					 * (used only at first SIOC* call)
+					 */
+#define IN6_IFF_AUTOCONF	0x40	/* autoconfigurable address. */
+#define IN6_IFF_TEMPORARY	0x80	/* temporary (anonymous) address. */
+
+/* do not input/output */
+#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)
+
+#ifdef _KERNEL
+#define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b))
+#define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b))
+#endif
+
+#ifdef _KERNEL
+
+#include <net/pktqueue.h>
+
+extern pktqueue_t *ip6_pktq;
+
+MALLOC_DECLARE(M_IP6OPT);
+
+extern struct in6_ifaddr *in6_ifaddr;
+
+#define in6_ifstat_inc(ifp, tag) \
+do {								\
+	if (ifp)						\
+		((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->in6_ifstat->tag++; \
+} while (/*CONSTCOND*/ 0)
+
+extern const struct in6_addr zeroin6_addr;
+extern const u_char inet6ctlerrmap[];
+extern unsigned long in6_maxmtu;
+extern bool in6_present;
+
+/*
+ * Macro for finding the internet address structure (in6_ifaddr) corresponding
+ * to a given interface (ifnet structure).
+ */
+static inline struct in6_ifaddr *
+ifp_to_ia6(struct ifnet *ifp)
+{
+	struct ifaddr *ifa;
+
+	IFADDR_FOREACH(ifa, ifp) {
+		if (ifa->ifa_addr == NULL)
+			continue;
+		if (ifa->ifa_addr->sa_family == AF_INET6)
+			break;
+	}
+	return (struct in6_ifaddr *)ifa;
+}
+
+#define	IFP_TO_IA6(__ifp, __ia)				\
+do {							\
+	(__ia) = ifp_to_ia6((__ifp));				\
+} while (/*CONSTCOND*/0)
+
+
+#endif /* _KERNEL */
+
+/*
+ * Multi-cast membership entry.  One for each group/ifp that a PCB
+ * belongs to.
+ */
+struct in6_multi_mship {
+	struct	in6_multi *i6mm_maddr;	/* Multicast address pointer */
+	LIST_ENTRY(in6_multi_mship) i6mm_chain;  /* multicast options chain */
+};
+
+struct	in6_multi {
+	LIST_ENTRY(in6_multi) in6m_entry; /* list glue */
+	struct	in6_addr in6m_addr;	/* IP6 multicast address */
+	struct	ifnet *in6m_ifp;	/* back pointer to ifnet */
+	struct	in6_ifaddr *in6m_ia;	/* back pointer to in6_ifaddr */
+	u_int	in6m_refcount;		/* # membership claims by sockets */
+	u_int	in6m_state;		/* state of the membership */
+	int	in6m_timer;		/* delay to send the 1st report */
+	struct timeval in6m_timer_expire; /* when the timer expires */
+	callout_t in6m_timer_ch;
+};
+ 
+#define IN6M_TIMER_UNDEF -1
+
+
+#ifdef _KERNEL
+/* flags to in6_update_ifa */
+#define IN6_IFAUPDATE_DADDELAY	0x1 /* first time to configure an address */
+
+/*
+ * Structure used by macros below to remember position when stepping through
+ * all of the in6_multi records.
+ */
+struct	in6_multistep {
+	struct	in6_ifaddr *i_ia;
+	struct	in6_multi *i_in6m;
+};
+
+/*
+ * Macros for looking up the in6_multi record for a given IP6 multicast
+ * address on a given interface. If no matching record is found, "in6m"
+ * returns NULL.
+ */
+
+static inline struct in6_multi *
+in6_lookup_multi(struct in6_addr *addr, struct ifnet *ifp)
+{
+	struct in6_multi *in6m;
+	struct in6_ifaddr *ia;
+
+	if ((ia = ifp_to_ia6(ifp)) == NULL)
+	  	return NULL;
+	LIST_FOREACH(in6m, &ia->ia6_multiaddrs, in6m_entry) {
+		if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, addr))
+			break;
+	}
+	return in6m;
+}
+
+#define IN6_LOOKUP_MULTI(__addr, __ifp, __in6m)			\
+/* struct in6_addr __addr; */					\
+/* struct ifnet *__ifp; */					\
+/* struct in6_multi *__in6m; */					\
+do {								\
+	(__in6m) = in6_lookup_multi(&(__addr), (__ifp));	\
+} while (/*CONSTCOND*/ 0)
+
+/*
+ * Macro to step through all of the in6_multi records, one at a time.
+ * The current position is remembered in "step", which the caller must
+ * provide.  IN6_FIRST_MULTI(), below, must be called to initialize "step"
+ * and get the first record.  Both macros return a NULL "in6m" when there
+ * are no remaining records.
+ */
+static inline struct in6_multi *
+in6_next_multi(struct in6_multistep *step)
+{
+	struct in6_multi *in6m;
+
+	if ((in6m = step->i_in6m) != NULL) {
+		step->i_in6m = LIST_NEXT(in6m, in6m_entry);
+		return in6m;
+	}
+	while (step->i_ia != NULL) {
+		in6m = LIST_FIRST(&step->i_ia->ia6_multiaddrs);
+		step->i_ia = step->i_ia->ia_next;
+		if (in6m != NULL) {
+			step->i_in6m = LIST_NEXT(in6m, in6m_entry);
+			break;
+		}
+	}
+	return in6m;
+}
+
+static inline struct in6_multi *
+in6_first_multi(struct in6_multistep *step)
+{						
+	step->i_ia = in6_ifaddr;		
+	step->i_in6m = NULL;			
+	return in6_next_multi(step);		
+}
+
+#define IN6_NEXT_MULTI(__step, __in6m)		\
+/* struct in6_multistep __step; */		\
+/* struct in6_multi *__in6m; */			\
+do {						\
+	(__in6m) = in6_next_multi(&(__step));	\
+} while (/*CONSTCOND*/ 0)
+
+#define IN6_FIRST_MULTI(__step, __in6m)		\
+/* struct in6_multistep __step; */		\
+/* struct in6_multi *__in6m */			\
+do {						\
+	(__in6m) = in6_first_multi(&(__step));	\
+} while (/*CONSTCOND*/ 0)
+
+
+#if 0
+/*
+ * Macros for looking up the in6_multi_mship record for a given IP6 multicast
+ * address on a given interface. If no matching record is found, "imm"
+ * returns NULL.
+ */
+static inline struct in6_multi_mship *
+in6_lookup_mship(struct in6_addr *addr, struct ifnet *ifp,
+    struct ip6_moptions *imop)
+{
+	struct in6_multi_mship *imm;
+
+	LIST_FOREACH(imm, &imop->im6o_memberships, i6mm_chain) {
+		if (imm->i6mm_maddr->in6m_ifp != ifp)
+		    	continue;
+		if (IN6_ARE_ADDR_EQUAL(&imm->i6mm_maddr->in6m_addr,
+		    addr))
+			break;
+	}
+	return imm;
+}
+
+#define IN6_LOOKUP_MSHIP(__addr, __ifp, __imop, __imm)			\
+/* struct in6_addr __addr; */						\
+/* struct ifnet *__ifp; */						\
+/* struct ip6_moptions *__imop */					\
+/* struct in6_multi_mship *__imm; */					\
+do {									\
+	(__imm) = in6_lookup_mship(&(__addr), (__ifp), (__imop));	\
+} while (/*CONSTCOND*/ 0)
+#endif
+
+struct	in6_multi *in6_addmulti(struct in6_addr *, struct ifnet *,
+	int *, int);
+void	in6_delmulti(struct in6_multi *);
+struct in6_multi_mship *in6_joingroup(struct ifnet *, struct in6_addr *,
+	int *, int);
+int	in6_leavegroup(struct in6_multi_mship *);
+int	in6_mask2len(struct in6_addr *, u_char *);
+int	in6_control(struct socket *, u_long, void *, struct ifnet *);
+int	in6_update_ifa(struct ifnet *, struct in6_aliasreq *,
+	struct in6_ifaddr *, int);
+void	in6_purgeaddr(struct ifaddr *);
+void	in6_purgeif(struct ifnet *);
+void	in6_savemkludge(struct in6_ifaddr *);
+void	in6_setmaxmtu  (void);
+int	in6_if2idlen  (struct ifnet *);
+void	*in6_domifattach(struct ifnet *);
+void	in6_domifdetach(struct ifnet *, void *);
+void	in6_restoremkludge(struct in6_ifaddr *, struct ifnet *);
+void	in6_ifremlocal(struct ifaddr *);
+void	in6_ifaddlocal(struct ifaddr *);
+void	in6_createmkludge(struct ifnet *);
+void	in6_purgemkludge(struct ifnet *);
+struct in6_ifaddr *in6ifa_ifpforlinklocal(const struct ifnet *, int);
+struct in6_ifaddr *in6ifa_ifpwithaddr(const struct ifnet *,
+    const struct in6_addr *);
+char	*ip6_sprintf(const struct in6_addr *);
+int	in6_matchlen(struct in6_addr *, struct in6_addr *);
+int	in6_are_prefix_equal(struct in6_addr *, struct in6_addr *, int);
+void	in6_prefixlen2mask(struct in6_addr *, int);
+void	in6_purgeprefix(struct ifnet *);
+
+int	ip6flow_fastforward(struct mbuf **); /* IPv6 fast forward routine */
+
+int in6_src_ioctl(u_long, void *);
+int	in6_is_addr_deprecated(struct sockaddr_in6 *);
+struct in6pcb;
+#endif /* _KERNEL */
+
+#endif /* !_NETINET6_IN6_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet6/in6_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet6/pim6_var.h
===================================================================
--- lab4/.minix-src/include/netinet6/pim6_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet6/pim6_var.h	(revision 13)
@@ -0,0 +1,69 @@
+/*	$NetBSD: pim6_var.h,v 1.14 2008/04/15 05:40:15 thorpej Exp $	*/
+/*	$KAME: pim6_var.h,v 1.8 2000/06/06 08:07:43 jinmei Exp $	*/
+
+/*
+ * Copyright (C) 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _NETINET6_PIM6_VAR_H_
+#define _NETINET6_PIM6_VAR_H_
+
+/*
+ * Protocol Independent Multicast (PIM),
+ * implementation-specific definitions.
+ *
+ * Written by George Edmond Eddy (Rusty), ISI, February 1998
+ * Modified by Pavlin Ivanov Radoslavov, USC/ISI, May 1998
+ */
+
+#define	PIM6_STAT_RCV_TOTAL	0	/* total PIM messages received */
+#define	PIM6_STAT_RCV_TOOSHORT	1	/* received with too few bytes */
+#define	PIM6_STAT_RCV_BADSUM	2	/* received with bad checksum */
+#define	PIM6_STAT_RCV_BADVERSION 3	/* received bad PIM version */
+#define	PIM6_STAT_RCV_REGISTERS	4	/* received registers */
+#define	PIM6_STAT_RCV_BADREGISTERS 5	/* received invalid registers */
+#define	PIM6_STAT_SND_REGISTERS	6	/* sent registers */
+
+#define	PIM6_NSTATS		7
+
+#if defined(_KERNEL)
+void	pim6_init(void);
+int	pim6_input(struct mbuf **, int*, int);
+#endif /* _KERNEL */
+
+/*
+ * Names for PIM sysctl objects
+ */
+#define PIM6CTL_STATS		1	/* statistics (read-only) */
+#define PIM6CTL_MAXID		2
+
+#define PIM6CTL_NAMES { \
+	{ 0, 0 }, \
+	{ "stats", CTLTYPE_STRUCT }, \
+}
+#endif /* !_NETINET6_PIM6_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet6/pim6_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netmpls/mpls.h
===================================================================
--- lab4/.minix-src/include/netmpls/mpls.h	(nonexistent)
+++ lab4/.minix-src/include/netmpls/mpls.h	(revision 13)
@@ -0,0 +1,74 @@
+/*	$NetBSD: mpls.h,v 1.1 2010/06/26 14:24:28 kefren Exp $ */
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Mihai Chelaru <kefren@NetBSD.org>
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _NETMPLS_MPLS_H_
+#define _NETMPLS_MPLS_H_
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/queue.h>
+
+#include <net/if.h>
+#include <net/if_dl.h>
+
+#define MPLS_LABEL_IPV4NULL	0	/* IPv4 Explicit NULL Label	*/
+#define MPLS_LABEL_RTALERT	1	/* Router Alert Label		*/
+#define MPLS_LABEL_IPV6NULL	2	/* IPv6 Explicit NULL Label	*/
+#define MPLS_LABEL_IMPLNULL	3	/* Implicit NULL Label		*/
+#define MPLS_LABEL_RESMAX	15	/* Maximum reserved Label	*/
+
+union mpls_shim {
+	uint32_t s_addr;		/* the whole shim */
+	struct {
+#if BYTE_ORDER == LITTLE_ENDIAN
+		uint32_t ttl:8;
+		uint32_t bos:1;
+		uint32_t exp:3;
+		uint32_t label:20;
+#else
+		uint32_t label:20;
+		uint32_t exp:3;
+		uint32_t bos:1;
+		uint32_t ttl:8;
+#endif
+	} shim;
+};
+
+struct sockaddr_mpls {
+	uint8_t smpls_len;
+	uint8_t smpls_family;
+	uint8_t smpls_pad[2];
+	union mpls_shim smpls_addr;
+} __packed;
+
+
+#endif /* !_NETMPLS_MPLS_H_ */

Property changes on: lab4/.minix-src/include/netmpls/mpls.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/igmp_var.h
===================================================================
--- lab4/.minix-src/include/netinet/igmp_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/igmp_var.h	(revision 13)
@@ -0,0 +1,123 @@
+/*	$NetBSD: igmp_var.h,v 1.24 2014/05/29 23:02:48 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Stephen Deering of Stanford University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)igmp_var.h	8.1 (Berkeley) 7/19/93
+ */
+
+/*
+ * Copyright (c) 1988 Stephen Deering.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Stephen Deering of Stanford University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)igmp_var.h	8.1 (Berkeley) 7/19/93
+ */
+
+#ifndef _NETINET_IGMP_VAR_H_
+#define _NETINET_IGMP_VAR_H_
+
+/*
+ * Internet Group Management Protocol (IGMP),
+ * implementation-specific definitions.
+ *
+ * Written by Steve Deering, Stanford, May 1988.
+ * Modified by Rosen Sharma, Stanford, Aug 1994.
+ * Modified by Bill Fenner, Xerox PARC, Feb 1995.
+ *
+ * MULTICAST 1.3
+ */
+
+#define	IGMP_STAT_RCV_TOTAL	1	/* total IGMP messages received */
+#define	IGMP_STAT_RCV_TOOSHORT	2	/* received with too few bytes */
+#define	IGMP_STAT_RCV_BADSUM	3	/* received with bad checksum */
+#define	IGMP_STAT_RCV_QUERIES	4	/* received membership queries */
+#define	IGMP_STAT_RCV_BADQUERIES 5	/* received invalid queries */
+#define	IGMP_STAT_RCV_REPORTS	6	/* received membership reports */
+#define	IGMP_STAT_RCV_BADREPORTS 7	/* received invalid reports */
+#define	IGMP_STAT_RCV_OURREPORTS 8	/* received reports for our groups */
+#define	IGMP_STAT_SND_REPORTS	9	/* sent membership reports */
+
+#define	IGMP_NSTATS		10
+
+#ifdef _KERNEL
+/*
+ * Macro to compute a random timer value between 1 and (IGMP_MAX_REPORTING_
+ * DELAY * countdown frequency).  We assume that the routine random()
+ * is defined somewhere (and that it returns a positive number).
+ */
+#define	IGMP_RANDOM_DELAY(X)	(cprng_fast32() % (X) + 1)
+
+#ifdef __NO_STRICT_ALIGNMENT
+#define	IGMP_HDR_ALIGNED_P(ig)	1
+#else
+#define	IGMP_HDR_ALIGNED_P(ig)	((((vaddr_t) (ig)) & 3) == 0)
+#endif
+
+void	igmp_init(void);
+void	igmp_input(struct mbuf *, ...);
+int	igmp_joingroup(struct in_multi *);
+void	igmp_leavegroup(struct in_multi *);
+void	igmp_fasttimo(void);
+void	igmp_slowtimo(void);
+void	igmp_purgeif(struct ifnet *);
+#endif /* _KERNEL */
+
+#endif /* !_NETINET_IGMP_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet/igmp_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/in_systm.h
===================================================================
--- lab4/.minix-src/include/netinet/in_systm.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/in_systm.h	(revision 13)
@@ -0,0 +1,59 @@
+/*	$NetBSD: in_systm.h,v 1.13 2005/12/10 23:36:23 elad Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)in_systm.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IN_SYSTM_H_
+#define _NETINET_IN_SYSTM_H_
+
+/*
+ * Miscellaneous internetwork
+ * definitions for kernel.
+ */
+
+/*
+ * Network types.
+ *
+ * Internally the system keeps counters in the headers with the bytes
+ * swapped so that VAX instructions will work on them.  It reverses
+ * the bytes before transmission at each protocol level.  The n_ types
+ * represent the types with the bytes in ``high-ender'' order.
+ */
+typedef u_int16_t n_short;		/* short as received from the net */
+typedef u_int32_t n_long;		/* long as received from the net */
+
+typedef u_int32_t n_time;		/* ms since 00:00 GMT, byte rev */
+
+#ifdef _KERNEL
+n_time	 iptime (void);
+#endif
+
+#endif /* !_NETINET_IN_SYSTM_H_ */

Property changes on: lab4/.minix-src/include/netinet/in_systm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/ip_carp.h
===================================================================
--- lab4/.minix-src/include/netinet/ip_carp.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/ip_carp.h	(revision 13)
@@ -0,0 +1,168 @@
+/*	$NetBSD: ip_carp.h,v 1.7 2014/07/31 00:58:02 ozaki-r Exp $	*/
+/*	$OpenBSD: ip_carp.h,v 1.18 2005/04/20 23:00:41 mpf Exp $	*/
+
+/*
+ * Copyright (c) 2002 Michael Shalayeff. All rights reserved.
+ * Copyright (c) 2003 Ryan McBride. 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 OR HIS RELATIVES 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 MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _NETINET_IP_CARP_H_
+#define _NETINET_IP_CARP_H_
+
+/*
+ * The CARP header layout is as follows:
+ *
+ *     0                   1                   2                   3
+ *     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |Version| Type  | VirtualHostID |    AdvSkew    |    Auth Len   |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |   Reserved    |     AdvBase   |          Checksum             |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                         Counter (1)                           |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                         Counter (2)                           |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                        SHA-1 HMAC (1)                         |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                        SHA-1 HMAC (2)                         |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                        SHA-1 HMAC (3)                         |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                        SHA-1 HMAC (4)                         |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                        SHA-1 HMAC (5)                         |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ */
+
+struct carp_header {
+#if BYTE_ORDER == LITTLE_ENDIAN
+	unsigned int	carp_type:4,
+			carp_version:4;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	unsigned int	carp_version:4,
+			carp_type:4;
+#endif
+	u_int8_t	carp_vhid;	/* virtual host id */
+	u_int8_t	carp_advskew;	/* advertisement skew */
+	u_int8_t	carp_authlen;   /* size of counter+md, 32bit chunks */
+	u_int8_t	carp_pad1;	/* reserved */
+	u_int8_t	carp_advbase;	/* advertisement interval */
+	u_int16_t	carp_cksum;
+	u_int32_t	carp_counter[2];
+	unsigned char	carp_md[20];	/* SHA1 HMAC */
+} __packed;
+
+#define	CARP_DFLTTL		255
+
+/* carp_version */
+#define	CARP_VERSION		2
+
+/* carp_type */
+#define	CARP_ADVERTISEMENT	0x01
+
+#define	CARP_KEY_LEN		20	/* a sha1 hash of a passphrase */
+
+/* carp_advbase */
+#define	CARP_DFLTINTV		1
+
+/*
+ * Statistics.
+ */
+#define	CARP_STAT_IPACKETS	0	/* total input packets, IPv4 */
+#define	CARP_STAT_IPACKETS6	1	/* total input packets, IPv6 */
+#define	CARP_STAT_BADIF		2	/* wrong interface */
+#define	CARP_STAT_BADTTL	3	/* TTL is not CARP_DFLTTL */
+#define	CARP_STAT_HDROPS	4	/* packets shorter than hdr */
+#define	CARP_STAT_BADSUM	5	/* bad checksum */
+#define	CARP_STAT_BADVER	6	/* bad (incl unsupported) version */
+#define	CARP_STAT_BADLEN	7	/* data length does not match */
+#define	CARP_STAT_BADAUTH	8	/* bad authentication */
+#define	CARP_STAT_BADVHID	9	/* bad VHID */
+#define	CARP_STAT_BADADDRS	10	/* bad address list */
+#define	CARP_STAT_OPACKETS	11	/* total output packets, IPv4 */
+#define	CARP_STAT_OPACKETS6	12	/* total output packets, IPv6 */
+#define	CARP_STAT_ONOMEM	13	/* no memory for an mbuf */
+#define	CARP_STAT_OSTATES	14	/* total state updates sent */
+#define	CARP_STAT_PREEMPT	15	/* in enabled, preemptions */
+
+#define	CARP_NSTATS		16
+
+#define CARPDEVNAMSIZ	16
+#ifdef IFNAMSIZ
+#if CARPDEVNAMSIZ != IFNAMSIZ
+#error
+#endif
+#endif
+
+/*
+ * Configuration structure for SIOCSVH SIOCGVH
+ */
+struct carpreq {
+	int		carpr_state;
+#define	CARP_STATES	"INIT", "BACKUP", "MASTER"
+#define	CARP_MAXSTATE	2
+
+	char		carpr_carpdev[CARPDEVNAMSIZ];
+	int		carpr_vhid;
+	int		carpr_advskew;
+	int		carpr_advbase;
+	unsigned char	carpr_key[CARP_KEY_LEN];
+};
+
+/*
+ * Names for CARP sysctl objects
+ */
+#define	CARPCTL_ALLOW		1	/* accept incoming CARP packets */
+#define	CARPCTL_PREEMPT		2	/* high-pri backup preemption mode */
+#define	CARPCTL_LOG		3	/* log bad packets */
+#define	CARPCTL_ARPBALANCE	4	/* balance arp responses */
+#define CARPCTL_STATS		5	/* carp statistics */
+#define	CARPCTL_MAXID		6
+
+#define	CARPCTL_NAMES { \
+	{ 0, 0 }, \
+	{ "allow", CTLTYPE_INT }, \
+	{ "preempt", CTLTYPE_INT }, \
+	{ "log", CTLTYPE_INT }, \
+	{ "arpbalance", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+void		 carp_init(void);
+void		 carp_ifdetach(struct ifnet *);
+void		 carp_proto_input(struct mbuf *, ...);
+void		 carp_carpdev_state(void *);
+int		 carp6_proto_input(struct mbuf **, int *, int);
+int		 carp_iamatch(struct in_ifaddr *, u_char *,
+		     u_int32_t *, u_int32_t);
+struct ifaddr	*carp_iamatch6(void *, struct in6_addr *);
+struct ifnet	*carp_ourether(void *, struct ether_header *, u_char, int);
+int		 carp_input(struct mbuf *, u_int8_t *, u_int8_t *, u_int16_t);
+int		 carp_output(struct ifnet *, struct mbuf *,
+		     const struct sockaddr *, struct rtentry *);
+#endif /* _KERNEL */
+#endif /* _NETINET_IP_CARP_H_ */

Property changes on: lab4/.minix-src/include/netinet/ip_carp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/tcp_debug.h
===================================================================
--- lab4/.minix-src/include/netinet/tcp_debug.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/tcp_debug.h	(revision 13)
@@ -0,0 +1,75 @@
+/*	$NetBSD: tcp_debug.h,v 1.17 2007/03/04 06:03:22 christos Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tcp_debug.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_DEBUG_H_
+#define _NETINET_TCP_DEBUG_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_inet.h"
+#endif
+
+struct	tcp_debug {
+	n_time	td_time;
+	short	td_act;
+	short	td_ostate;
+	void *	td_tcb;
+	int	td_family;
+	struct	tcpiphdr td_ti;
+	struct {
+#ifdef INET6
+		struct ip6_hdr ip6;
+#else
+		u_char ip6_dummy[40];	/* just to keep struct align/size */
+#endif
+		struct tcphdr th;
+	} td_ti6;
+	short	td_req;
+	struct	tcpcb td_cb;
+};
+
+#define	TA_INPUT 	0
+#define	TA_OUTPUT	1
+#define	TA_USER		2
+#define	TA_RESPOND	3
+#define	TA_DROP		4
+
+#ifdef TANAMES
+const char	*tanames[] =
+    { "input", "output", "user", "respond", "drop" };
+#endif
+
+#ifndef TCP_NDEBUG
+#define	TCP_NDEBUG 100
+#endif
+
+#endif /* !_NETINET_TCP_DEBUG_H_ */

Property changes on: lab4/.minix-src/include/netinet/tcp_debug.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/tcp_var.h
===================================================================
--- lab4/.minix-src/include/netinet/tcp_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/tcp_var.h	(revision 13)
@@ -0,0 +1,1012 @@
+/*	$NetBSD: tcp_var.h,v 1.177 2015/02/14 22:09:53 he Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ *      @(#)COPYRIGHT   1.1 (NRL) 17 January 1995
+ *
+ * NRL grants permission for redistribution and use in source and binary
+ * forms, with or without modification, of the software and documentation
+ * created at NRL provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgements:
+ *      This product includes software developed by the University of
+ *      California, Berkeley and its contributors.
+ *      This product includes software developed at the Information
+ *      Technology Division, US Naval Research Laboratory.
+ * 4. Neither the name of the NRL nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THE SOFTWARE PROVIDED BY NRL IS PROVIDED BY NRL AND CONTRIBUTORS ``AS
+ * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL NRL OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * official policies, either expressed or implied, of the US Naval
+ * Research Laboratory (NRL).
+ */
+
+/*-
+ * Copyright (c) 1997, 1998, 1999, 2001, 2005 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993, 1994, 1995
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tcp_var.h	8.4 (Berkeley) 5/24/95
+ */
+
+#ifndef _NETINET_TCP_VAR_H_
+#define _NETINET_TCP_VAR_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_inet.h"
+#include "opt_mbuftrace.h"
+
+#endif
+
+/*
+ * Kernel variables for tcp.
+ */
+
+#include <sys/callout.h>
+
+#ifdef TCP_SIGNATURE
+/*
+ * Defines which are needed by the xform_tcp module and tcp_[in|out]put
+ * for SADB verification and lookup.
+ */
+#define	TCP_SIGLEN	16	/* length of computed digest in bytes */
+#define	TCP_KEYLEN_MIN	1	/* minimum length of TCP-MD5 key */
+#define	TCP_KEYLEN_MAX	80	/* maximum length of TCP-MD5 key */
+/*
+ * Only a single SA per host may be specified at this time. An SPI is
+ * needed in order for the KEY_ALLOCSA() lookup to work.
+ */
+#define	TCP_SIG_SPI	0x1000
+#endif /* TCP_SIGNATURE */
+
+/*
+ * SACK option block.
+ */
+struct sackblk {
+	tcp_seq left;		/* Left edge of sack block. */
+	tcp_seq right;		/* Right edge of sack block. */
+};
+
+TAILQ_HEAD(sackhead, sackhole);
+struct sackhole {
+	tcp_seq start;
+	tcp_seq end;
+	tcp_seq rxmit;
+
+	TAILQ_ENTRY(sackhole) sackhole_q;
+};
+
+/*
+ * Tcp control block, one per tcp; fields:
+ */
+struct tcpcb {
+	int	t_family;		/* address family on the wire */
+	struct ipqehead segq;		/* sequencing queue */
+	int	t_segqlen;		/* length of the above */
+	callout_t t_timer[TCPT_NTIMERS];/* tcp timers */
+	short	t_state;		/* state of this connection */
+	short	t_rxtshift;		/* log(2) of rexmt exp. backoff */
+	uint32_t t_rxtcur;		/* current retransmit value */
+	short	t_dupacks;		/* consecutive dup acks recd */
+	/*
+	 * t_partialacks:
+	 *	<0	not in fast recovery.
+	 *	==0	in fast recovery.  has not received partial acks
+	 *	>0	in fast recovery.  has received partial acks
+	 */
+	short	t_partialacks;		/* partials acks during fast rexmit */
+	u_short	t_peermss;		/* peer's maximum segment size */
+	u_short	t_ourmss;		/* our's maximum segment size */
+	u_short t_segsz;		/* current segment size in use */
+	char	t_force;		/* 1 if forcing out a byte */
+	u_int	t_flags;
+#define	TF_ACKNOW	0x0001		/* ack peer immediately */
+#define	TF_DELACK	0x0002		/* ack, but try to delay it */
+#define	TF_NODELAY	0x0004		/* don't delay packets to coalesce */
+#define	TF_NOOPT	0x0008		/* don't use tcp options */
+#define	TF_REQ_SCALE	0x0020		/* have/will request window scaling */
+#define	TF_RCVD_SCALE	0x0040		/* other side has requested scaling */
+#define	TF_REQ_TSTMP	0x0080		/* have/will request timestamps */
+#define	TF_RCVD_TSTMP	0x0100		/* a timestamp was received in SYN */
+#define	TF_SACK_PERMIT	0x0200		/* other side said I could SACK */
+#define	TF_SYN_REXMT	0x0400		/* rexmit timer fired on SYN */
+#define	TF_WILL_SACK	0x0800		/* try to use SACK */
+#define	TF_REASSEMBLING	0x1000		/* we're busy reassembling */
+#define	TF_DEAD		0x2000		/* dead and to-be-released */
+#define	TF_PMTUD_PEND	0x4000		/* Path MTU Discovery pending */
+#define	TF_ECN_PERMIT	0x10000		/* other side said is ECN-ready */
+#define	TF_ECN_SND_CWR	0x20000		/* ECN CWR in queue */
+#define	TF_ECN_SND_ECE	0x40000		/* ECN ECE in queue */
+#define	TF_SIGNATURE	0x400000	/* require MD5 digests (RFC2385) */
+
+
+	struct	mbuf *t_template;	/* skeletal packet for transmit */
+	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
+	struct	in6pcb *t_in6pcb;	/* back pointer to internet pcb */
+	callout_t t_delack_ch;		/* delayed ACK callout */
+/*
+ * The following fields are used as in the protocol specification.
+ * See RFC793, Dec. 1981, page 21.
+ */
+/* send sequence variables */
+	tcp_seq	snd_una;		/* send unacknowledged */
+	tcp_seq	snd_nxt;		/* send next */
+	tcp_seq	snd_up;			/* send urgent pointer */
+	tcp_seq	snd_wl1;		/* window update seg seq number */
+	tcp_seq	snd_wl2;		/* window update seg ack number */
+	tcp_seq	iss;			/* initial send sequence number */
+	u_long	snd_wnd;		/* send window */
+/*
+ * snd_recover
+ * 	it's basically same as the "recover" variable in RFC 2852 (NewReno).
+ * 	when entering fast retransmit, it's set to snd_max.
+ * 	newreno uses this to detect partial ack.
+ * snd_high
+ * 	it's basically same as the "send_high" variable in RFC 2852 (NewReno).
+ * 	on each RTO, it's set to snd_max.
+ * 	newreno uses this to avoid false fast retransmits.
+ */
+	tcp_seq snd_recover;
+	tcp_seq	snd_high;
+/* receive sequence variables */
+	u_long	rcv_wnd;		/* receive window */
+	tcp_seq	rcv_nxt;		/* receive next */
+	tcp_seq	rcv_up;			/* receive urgent pointer */
+	tcp_seq	irs;			/* initial receive sequence number */
+/*
+ * Additional variables for this implementation.
+ */
+/* receive variables */
+	tcp_seq	rcv_adv;		/* advertised window */
+
+/*
+ * retransmit variables
+ *
+ * snd_max
+ * 	the highest sequence number we've ever sent.
+ *	used to recognize retransmits.
+ */
+	tcp_seq	snd_max;
+
+/* congestion control (for slow start, source quench, retransmit after loss) */
+	u_long	snd_cwnd;		/* congestion-controlled window */
+	u_long	snd_ssthresh;		/* snd_cwnd size threshhold for
+					 * for slow start exponential to
+					 * linear switch
+					 */
+/* auto-sizing variables */
+	u_int rfbuf_cnt;		/* recv buffer autoscaling byte count */
+	uint32_t rfbuf_ts;		/* recv buffer autoscaling timestamp */
+
+/*
+ * transmit timing stuff.  See below for scale of srtt and rttvar.
+ * "Variance" is actually smoothed difference.
+ */
+	uint32_t t_rcvtime;		/* time last segment received */
+	uint32_t t_rtttime;		/* time we started measuring rtt */
+	tcp_seq	t_rtseq;		/* sequence number being timed */
+	int32_t	t_srtt;			/* smoothed round-trip time */
+	int32_t	t_rttvar;		/* variance in round-trip time */
+	uint32_t t_rttmin;		/* minimum rtt allowed */
+	u_long	max_sndwnd;		/* largest window peer has offered */
+
+/* out-of-band data */
+	char	t_oobflags;		/* have some */
+	char	t_iobc;			/* input character */
+#define	TCPOOB_HAVEDATA	0x01
+#define	TCPOOB_HADDATA	0x02
+	short	t_softerror;		/* possible error not yet reported */
+
+/* RFC 1323 variables */
+	u_char	snd_scale;		/* window scaling for send window */
+	u_char	rcv_scale;		/* window scaling for recv window */
+	u_char	request_r_scale;	/* pending window scaling */
+	u_char	requested_s_scale;
+	u_int32_t ts_recent;		/* timestamp echo data */
+	u_int32_t ts_recent_age;	/* when last updated */
+	u_int32_t ts_timebase;		/* our timebase */
+	tcp_seq	last_ack_sent;
+
+/* RFC 3465 variables */
+	u_long	t_bytes_acked;		/* ABC "bytes_acked" parameter */
+
+/* SACK stuff */
+#define TCP_SACK_MAX 3
+#define TCPSACK_NONE 0
+#define TCPSACK_HAVED 1
+	u_char rcv_sack_flags;		/* SACK flags. */
+	struct sackblk rcv_dsack_block;	/* RX D-SACK block. */
+	struct ipqehead timeq;		/* time sequenced queue. */
+	struct sackhead snd_holes;	/* TX SACK holes. */
+	int	snd_numholes;		/* Number of TX SACK holes. */
+	tcp_seq rcv_lastsack;		/* last seq number(+1) sack'd by rcv'r*/
+	tcp_seq sack_newdata;		/* New data xmitted in this recovery
+					   episode starts at this seq number*/
+	tcp_seq snd_fack;		/* FACK TCP.  Forward-most data held by
+					   peer. */
+
+/* CUBIC variables */
+	ulong snd_cubic_wmax;		/* W_max */
+	ulong snd_cubic_wmax_last;	/* Used for fast convergence */
+	ulong snd_cubic_ctime;		/* Last congestion time */
+
+/* pointer for syn cache entries*/
+	LIST_HEAD(, syn_cache) t_sc;	/* list of entries by this tcb */
+
+/* prediction of next mbuf when using large window sizes */
+	struct	mbuf *t_lastm;		/* last mbuf that data was sent from */
+	int	t_inoff;		/* data offset in previous mbuf */
+	int	t_lastoff;		/* last data address in mbuf chain */
+	int	t_lastlen;		/* last length read from mbuf chain */
+
+/* Path-MTU discovery blackhole detection */
+	int t_mtudisc;			/* perform mtudisc for this tcb */
+/* Path-MTU Discovery Information */
+	u_int	t_pmtud_mss_acked;	/* MSS acked, lower bound for MTU */
+	u_int	t_pmtud_mtu_sent;	/* MTU used, upper bound for MTU */
+	tcp_seq	t_pmtud_th_seq;		/* TCP SEQ from ICMP payload */
+	u_int	t_pmtud_nextmtu;	/* Advertised Next-Hop MTU from ICMP */
+	u_short	t_pmtud_ip_len;		/* IP length from ICMP payload */
+	u_short	t_pmtud_ip_hl;		/* IP header length from ICMP payload */
+
+	uint8_t t_ecn_retries;		/* # of ECN setup retries */
+	
+	const struct tcp_congctl *t_congctl;	/* per TCB congctl algorithm */
+
+	/* Keepalive per socket */
+	u_int	t_keepinit;
+	u_int	t_keepidle;
+	u_int	t_keepintvl;
+	u_int	t_keepcnt;
+	u_int	t_maxidle;		/* t_keepcnt * t_keepintvl */
+
+	u_int	t_msl;			/* MSL to use for this connexion */
+
+	/* maintain a few stats per connection: */
+	uint32_t t_rcvoopack;	 	/* out-of-order packets received */
+	uint32_t t_sndrexmitpack; 	/* retransmit packets sent */
+	uint32_t t_sndzerowin;		/* zero-window updates sent */
+};
+
+/*
+ * Macros to aid ECN TCP.
+ */
+#define TCP_ECN_ALLOWED(tp)	(tp->t_flags & TF_ECN_PERMIT)
+
+/*
+ * Macros to aid SACK/FACK TCP.
+ */
+#define TCP_SACK_ENABLED(tp)	(tp->t_flags & TF_WILL_SACK)
+#define TCP_FACK_FASTRECOV(tp)	\
+	(TCP_SACK_ENABLED(tp) && \
+	(SEQ_GT(tp->snd_fack, tp->snd_una + tcprexmtthresh * tp->t_segsz)))
+
+#ifdef _KERNEL
+/*
+ * TCP reassembly queue locks.
+ */
+static __inline int tcp_reass_lock_try (struct tcpcb *)
+	__unused;
+static __inline void tcp_reass_unlock (struct tcpcb *)
+	__unused;
+
+static __inline int
+tcp_reass_lock_try(struct tcpcb *tp)
+{
+	int s;
+
+	/*
+	 * Use splvm() -- we're blocking things that would cause
+	 * mbuf allocation.
+	 */
+	s = splvm();
+	if (tp->t_flags & TF_REASSEMBLING) {
+		splx(s);
+		return (0);
+	}
+	tp->t_flags |= TF_REASSEMBLING;
+	splx(s);
+	return (1);
+}
+
+static __inline void
+tcp_reass_unlock(struct tcpcb *tp)
+{
+	int s;
+
+	s = splvm();
+	KASSERT((tp->t_flags & TF_REASSEMBLING) != 0);
+	tp->t_flags &= ~TF_REASSEMBLING;
+	splx(s);
+}
+
+#ifdef DIAGNOSTIC
+#define	TCP_REASS_LOCK(tp)						\
+do {									\
+	if (tcp_reass_lock_try(tp) == 0) {				\
+		printf("%s:%d: tcpcb %p reass already locked\n",	\
+		    __FILE__, __LINE__, tp);				\
+		panic("tcp_reass_lock");				\
+	}								\
+} while (/*CONSTCOND*/ 0)
+#define	TCP_REASS_LOCK_CHECK(tp)					\
+do {									\
+	if (((tp)->t_flags & TF_REASSEMBLING) == 0) {			\
+		printf("%s:%d: tcpcb %p reass lock not held\n",		\
+		    __FILE__, __LINE__, tp);				\
+		panic("tcp reass lock check");				\
+	}								\
+} while (/*CONSTCOND*/ 0)
+#else
+#define	TCP_REASS_LOCK(tp)	(void) tcp_reass_lock_try((tp))
+#define	TCP_REASS_LOCK_CHECK(tp) /* nothing */
+#endif
+
+#define	TCP_REASS_UNLOCK(tp)	tcp_reass_unlock((tp))
+#endif /* _KERNEL */
+
+/*
+ * Queue for delayed ACK processing.
+ */
+#ifdef _KERNEL
+extern int tcp_delack_ticks;
+void	tcp_delack(void *);
+
+#define TCP_RESTART_DELACK(tp)						\
+	callout_reset(&(tp)->t_delack_ch, tcp_delack_ticks,		\
+	    tcp_delack, tp)
+
+#define	TCP_SET_DELACK(tp)						\
+do {									\
+	if (((tp)->t_flags & TF_DELACK) == 0) {				\
+		(tp)->t_flags |= TF_DELACK;				\
+		TCP_RESTART_DELACK(tp);					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	TCP_CLEAR_DELACK(tp)						\
+do {									\
+	if ((tp)->t_flags & TF_DELACK) {				\
+		(tp)->t_flags &= ~TF_DELACK;				\
+		callout_stop(&(tp)->t_delack_ch);			\
+	}								\
+} while (/*CONSTCOND*/0)
+#endif /* _KERNEL */
+
+/*
+ * Compute the current timestamp for a connection.
+ */
+#define	TCP_TIMESTAMP(tp)	(tcp_now - (tp)->ts_timebase)
+
+/*
+ * Handy way of passing around TCP option info.
+ */
+struct tcp_opt_info {
+	int		ts_present;
+	u_int32_t	ts_val;
+	u_int32_t	ts_ecr;
+	u_int16_t	maxseg;
+};
+
+#define	TOF_SIGNATURE	0x0040		/* signature option present */
+#define	TOF_SIGLEN	0x0080		/* sigature length valid (RFC2385) */
+
+/*
+ * Data for the TCP compressed state engine.
+ */
+union syn_cache_sa {
+	struct sockaddr sa;
+	struct sockaddr_in sin;
+#if 1 /*def INET6*/
+	struct sockaddr_in6 sin6;
+#endif
+};
+
+struct syn_cache {
+	TAILQ_ENTRY(syn_cache) sc_bucketq;	/* link on bucket list */
+	callout_t sc_timer;			/* rexmt timer */
+	struct route sc_route;
+	long sc_win;				/* advertised window */
+	int sc_bucketidx;			/* our bucket index */
+	u_int32_t sc_hash;
+	u_int32_t sc_timestamp;			/* timestamp from SYN */
+	u_int32_t sc_timebase;			/* our local timebase */
+	union syn_cache_sa sc_src;
+	union syn_cache_sa sc_dst;
+	tcp_seq sc_irs;
+	tcp_seq sc_iss;
+	u_int sc_rxtcur;			/* current rxt timeout */
+	u_int sc_rxttot;			/* total time spend on queues */
+	u_short sc_rxtshift;			/* for computing backoff */
+	u_short sc_flags;
+
+#define	SCF_UNREACH		0x0001		/* we've had an unreach error */
+#define	SCF_TIMESTAMP		0x0002		/* peer will do timestamps */
+#define	SCF_DEAD		0x0004		/* this entry to be released */
+#define SCF_SACK_PERMIT		0x0008		/* peer will do SACK */
+#define SCF_ECN_PERMIT		0x0010		/* peer will do ECN */
+#define SCF_SIGNATURE	0x40			/* send MD5 digests */
+
+	struct mbuf *sc_ipopts;			/* IP options */
+	u_int16_t sc_peermaxseg;
+	u_int16_t sc_ourmaxseg;
+	u_int8_t sc_request_r_scale	: 4,
+		 sc_requested_s_scale	: 4;
+
+	struct tcpcb *sc_tp;			/* tcb for listening socket */
+	LIST_ENTRY(syn_cache) sc_tpq;		/* list of entries by same tp */
+};
+
+struct syn_cache_head {
+	TAILQ_HEAD(, syn_cache) sch_bucket;	/* bucket entries */
+	u_short sch_length;			/* # entries in bucket */
+};
+
+#define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
+#ifdef INET6
+#define	in6totcpcb(ip)	((struct tcpcb *)(ip)->in6p_ppcb)
+#endif
+#ifndef INET6
+#define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
+#else
+#define	sototcpcb(so)	(((so)->so_proto->pr_domain->dom_family == AF_INET) \
+				? intotcpcb(sotoinpcb(so)) \
+				: in6totcpcb(sotoin6pcb(so)))
+#endif
+
+/*
+ * See RFC2988 for a discussion of RTO calculation; comments assume
+ * familiarity with that document.
+ *
+ * The smoothed round-trip time and estimated variance are stored as
+ * fixed point numbers.  Historically, srtt was scaled by
+ * TCP_RTT_SHIFT bits, and rttvar by TCP_RTTVAR_SHIFT bits.  Because
+ * the values coincide with the alpha and beta parameters suggested
+ * for RTO calculation (1/8 for srtt, 1/4 for rttvar), the combination
+ * of computing 1/8 of the new value and transforming it to the
+ * fixed-point representation required zero instructions.  However,
+ * the storage representations no longer coincide with the alpha/beta
+ * shifts; instead, more fractional bits are present.
+ *
+ * The storage representation of srtt is 1/32 slow ticks, or 1/64 s.
+ * (The assumption that a slow tick is 500 ms should not be present in
+ * the code.)
+ *
+ * The storage representation of rttvar is 1/16 slow ticks, or 1/32 s.
+ * There may be some confusion about this in the code.
+ *
+ * For historical reasons, these scales are also used in smoothing the
+ * average (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed).
+ * This results in alpha of 0.125 and beta of 0.25, following RFC2988
+ * section 2.3
+ *
+ * XXX Change SHIFT values to LGWEIGHT and REP_SHIFT, and adjust
+ * the code to use the correct ones.
+ */
+#define	TCP_RTT_SHIFT		3	/* shift for srtt; 3 bits frac. */
+#define	TCP_RTTVAR_SHIFT	2	/* multiplier for rttvar; 2 bits */
+
+/*
+ * Compute TCP retransmission timer, following RFC2988.
+ * This macro returns a value in slow timeout ticks.
+ *
+ * Section 2.2 requires that the RTO value be
+ *  srtt + max(G, 4*RTTVAR)
+ * where G is the clock granularity.
+ *
+ * This comment has not necessarily been updated for the new storage
+ * representation:
+ *
+ * Because of the way we do the smoothing, srtt and rttvar
+ * will each average +1/2 tick of bias.  When we compute
+ * the retransmit timer, we want 1/2 tick of rounding and
+ * 1 extra tick because of +-1/2 tick uncertainty in the
+ * firing of the timer.  The bias will give us exactly the
+ * 1.5 tick we need.  But, because the bias is
+ * statistical, we have to test that we don't drop below
+ * the minimum feasible timer (which is 2 ticks).
+ * This macro assumes that the value of 1<<TCP_RTTVAR_SHIFT
+ * is the same as the multiplier for rttvar.
+ *
+ * This macro appears to be wrong; it should be checking rttvar*4 in
+ * ticks and making sure we use 1 instead if rttvar*4 rounds to 0.  It
+ * appears to be treating srtt as being in the old storage
+ * representation, resulting in a factor of 4 extra.
+ */
+#define	TCP_REXMTVAL(tp) \
+	((((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) >> 2)
+
+/*
+ * Compute the initial window for slow start.
+ */
+#define	TCP_INITIAL_WINDOW(iw, segsz) \
+	min((iw) * (segsz), max(2 * (segsz), tcp_init_win_max[(iw)]))
+
+/*
+ * TCP statistics.
+ * Each counter is an unsigned 64-bit value.
+ *
+ * Many of these should be kept per connection, but that's inconvenient
+ * at the moment.
+ */
+#define	TCP_STAT_CONNATTEMPT	0	/* connections initiated */
+#define	TCP_STAT_ACCEPTS	1	/* connections accepted */
+#define	TCP_STAT_CONNECTS	2	/* connections established */
+#define	TCP_STAT_DROPS		3	/* connections dropped */
+#define	TCP_STAT_CONNDROPS	4	/* embryonic connections dropped */
+#define	TCP_STAT_CLOSED		5	/* conn. closed (includes drops) */
+#define	TCP_STAT_SEGSTIMED	6	/* segs where we tried to get rtt */
+#define	TCP_STAT_RTTUPDATED	7	/* times we succeeded */
+#define	TCP_STAT_DELACK		8	/* delayed ACKs sent */
+#define	TCP_STAT_TIMEOUTDROP	9	/* conn. dropped in rxmt timeout */
+#define	TCP_STAT_REXMTTIMEO	10	/* retransmit timeouts */
+#define	TCP_STAT_PERSISTTIMEO	11	/* persist timeouts */
+#define	TCP_STAT_KEEPTIMEO	12	/* keepalive timeouts */
+#define	TCP_STAT_KEEPPROBE	13	/* keepalive probes sent */
+#define	TCP_STAT_KEEPDROPS	14	/* connections dropped in keepalive */
+#define	TCP_STAT_PERSISTDROPS	15	/* connections dropped in persist */
+#define	TCP_STAT_CONNSDRAINED	16	/* connections drained due to memory
+					   shortage */
+#define	TCP_STAT_PMTUBLACKHOLE	17	/* PMTUD blackhole detected */
+#define	TCP_STAT_SNDTOTAL	18	/* total packets sent */
+#define	TCP_STAT_SNDPACK	19	/* data packlets sent */
+#define	TCP_STAT_SNDBYTE	20	/* data bytes sent */
+#define	TCP_STAT_SNDREXMITPACK	21	/* data packets retransmitted */
+#define	TCP_STAT_SNDREXMITBYTE	22	/* data bytes retransmitted */
+#define	TCP_STAT_SNDACKS	23	/* ACK-only packets sent */
+#define	TCP_STAT_SNDPROBE	24	/* window probes sent */
+#define	TCP_STAT_SNDURG		25	/* packets sent with URG only */
+#define	TCP_STAT_SNDWINUP	26	/* window update-only packets sent */
+#define	TCP_STAT_SNDCTRL	27	/* control (SYN|FIN|RST) packets sent */
+#define	TCP_STAT_RCVTOTAL	28	/* total packets received */
+#define	TCP_STAT_RCVPACK	29	/* packets received in sequence */
+#define	TCP_STAT_RCVBYTE	30	/* bytes received in sequence */
+#define	TCP_STAT_RCVBADSUM	31	/* packets received with cksum errs */
+#define	TCP_STAT_RCVBADOFF	32	/* packets received with bad offset */
+#define	TCP_STAT_RCVMEMDROP	33	/* packets dropped for lack of memory */
+#define	TCP_STAT_RCVSHORT	34	/* packets received too short */
+#define	TCP_STAT_RCVDUPPACK	35	/* duplicate-only packets received */
+#define	TCP_STAT_RCVDUPBYTE	36	/* duplicate-only bytes received */
+#define	TCP_STAT_RCVPARTDUPPACK	37	/* packets with some duplicate data */
+#define	TCP_STAT_RCVPARTDUPBYTE	38	/* dup. bytes in part-dup. packets */
+#define	TCP_STAT_RCVOOPACK	39	/* out-of-order packets received */
+#define	TCP_STAT_RCVOOBYTE	40	/* out-of-order bytes received */
+#define	TCP_STAT_RCVPACKAFTERWIN 41	/* packets with data after window */
+#define	TCP_STAT_RCVBYTEAFTERWIN 42	/* bytes received after window */
+#define	TCP_STAT_RCVAFTERCLOSE	43	/* packets received after "close" */
+#define	TCP_STAT_RCVWINPROBE	44	/* rcvd window probe packets */
+#define	TCP_STAT_RCVDUPACK	45	/* rcvd duplicate ACKs */
+#define	TCP_STAT_RCVACKTOOMUCH	46	/* rcvd ACKs for unsent data */
+#define	TCP_STAT_RCVACKPACK	47	/* rcvd ACK packets */
+#define	TCP_STAT_RCVACKBYTE	48	/* bytes ACKed by rcvd ACKs */
+#define	TCP_STAT_RCVWINUPD	49	/* rcvd window update packets */
+#define	TCP_STAT_PAWSDROP	50	/* segments dropped due to PAWS */
+#define	TCP_STAT_PREDACK	51	/* times hdr predict OK for ACKs */
+#define	TCP_STAT_PREDDAT	52	/* times hdr predict OK for data pkts */
+#define	TCP_STAT_PCBHASHMISS	53	/* input packets missing PCB hash */
+#define	TCP_STAT_NOPORT		54	/* no socket on port */
+#define	TCP_STAT_BADSYN		55	/* received ACK for which we have
+					   no SYN in compressed state */
+#define	TCP_STAT_DELAYED_FREE	56	/* delayed pool_put() of tcpcb */
+#define	TCP_STAT_SC_ADDED	57	/* # of sc entries added */
+#define	TCP_STAT_SC_COMPLETED	58	/* # of sc connections completed */
+#define	TCP_STAT_SC_TIMED_OUT	59	/* # of sc entries timed out */
+#define	TCP_STAT_SC_OVERFLOWED	60	/* # of sc drops due to overflow */
+#define	TCP_STAT_SC_RESET	61	/* # of sc drops due to RST */
+#define	TCP_STAT_SC_UNREACH	62	/* # of sc drops due to ICMP unreach */
+#define	TCP_STAT_SC_BUCKETOVERFLOW 63	/* # of sc drops due to bucket ovflow */
+#define	TCP_STAT_SC_ABORTED	64	/* # of sc entries aborted (no mem) */
+#define	TCP_STAT_SC_DUPESYN	65	/* # of duplicate SYNs received */
+#define	TCP_STAT_SC_DROPPED	66	/* # of SYNs dropped (no route/mem) */
+#define	TCP_STAT_SC_COLLISIONS	67	/* # of sc hash collisions */
+#define	TCP_STAT_SC_RETRANSMITTED 68	/* # of sc retransmissions */
+#define	TCP_STAT_SC_DELAYED_FREE 69	/* # of delayed pool_put()s */
+#define	TCP_STAT_SELFQUENCH	70	/* # of ENOBUFS we get on output */
+#define	TCP_STAT_BADSIG		71	/* # of drops due to bad signature */
+#define	TCP_STAT_GOODSIG	72	/* # of packets with good signature */
+#define	TCP_STAT_ECN_SHS	73	/* # of successful ECN handshakes */
+#define	TCP_STAT_ECN_CE		74	/* # of packets with CE bit */
+#define	TCP_STAT_ECN_ECT	75	/* # of packets with ECT(0) bit */
+
+#define	TCP_NSTATS		76
+
+/*
+ * Names for TCP sysctl objects.
+ */
+#define	TCPCTL_RFC1323		1	/* RFC1323 timestamps/scaling */
+#define	TCPCTL_SENDSPACE	2	/* default send buffer */
+#define	TCPCTL_RECVSPACE	3	/* default recv buffer */
+#define	TCPCTL_MSSDFLT		4	/* default seg size */
+#define	TCPCTL_SYN_CACHE_LIMIT	5	/* max size of comp. state engine */
+#define	TCPCTL_SYN_BUCKET_LIMIT	6	/* max size of hash bucket */
+#if 0	/*obsoleted*/
+#define	TCPCTL_SYN_CACHE_INTER	7	/* interval of comp. state timer */
+#endif
+#define	TCPCTL_INIT_WIN		8	/* initial window */
+#define	TCPCTL_MSS_IFMTU	9	/* mss from interface, not in_maxmtu */
+#define	TCPCTL_SACK		10	/* RFC2018 selective acknowledgement */
+#define	TCPCTL_WSCALE		11	/* RFC1323 window scaling */
+#define	TCPCTL_TSTAMP		12	/* RFC1323 timestamps */
+#define	TCPCTL_COMPAT_42	13	/* 4.2BSD TCP bug work-arounds */
+#define	TCPCTL_CWM		14	/* Congestion Window Monitoring */
+#define	TCPCTL_CWM_BURSTSIZE	15	/* burst size allowed by CWM */
+#define	TCPCTL_ACK_ON_PUSH	16	/* ACK immediately on PUSH */
+#define	TCPCTL_KEEPIDLE		17	/* keepalive idle time */
+#define	TCPCTL_KEEPINTVL	18	/* keepalive probe interval */
+#define	TCPCTL_KEEPCNT		19	/* keepalive count */
+#define	TCPCTL_SLOWHZ		20	/* PR_SLOWHZ (read-only) */
+#define	TCPCTL_NEWRENO		21	/* NewReno Congestion Control */
+#define TCPCTL_LOG_REFUSED	22	/* Log refused connections */
+#if 0	/*obsoleted*/
+#define	TCPCTL_RSTRATELIMIT	23	/* RST rate limit */
+#endif
+#define	TCPCTL_RSTPPSLIMIT	24	/* RST pps limit */
+#define	TCPCTL_DELACK_TICKS	25	/* # ticks to delay ACK */
+#define	TCPCTL_INIT_WIN_LOCAL	26	/* initial window for local nets */
+#define	TCPCTL_IDENT		27	/* rfc 931 identd */
+#define	TCPCTL_ACKDROPRATELIMIT	28	/* SYN/RST -> ACK rate limit */
+#define	TCPCTL_LOOPBACKCKSUM	29	/* do TCP checksum on loopback */
+#define	TCPCTL_STATS		30	/* TCP statistics */
+#define	TCPCTL_DEBUG		31	/* TCP debug sockets */
+#define	TCPCTL_DEBX		32	/* # of tcp debug sockets */
+#define	TCPCTL_DROP		33	/* drop tcp connection */
+#define	TCPCTL_MSL		34	/* Max Segment Life */
+#define	TCPCTL_MAXID		35
+
+#define	TCPCTL_NAMES { \
+	{ 0, 0 }, \
+	{ "rfc1323",	CTLTYPE_INT }, \
+	{ "sendspace",	CTLTYPE_INT }, \
+	{ "recvspace",	CTLTYPE_INT }, \
+	{ "mssdflt",	CTLTYPE_INT }, \
+	{ "syn_cache_limit", CTLTYPE_INT }, \
+	{ "syn_bucket_limit", CTLTYPE_INT }, \
+	{ 0, 0 },\
+	{ "init_win", CTLTYPE_INT }, \
+	{ "mss_ifmtu", CTLTYPE_INT }, \
+	{ "sack", CTLTYPE_INT }, \
+	{ "win_scale", CTLTYPE_INT }, \
+	{ "timestamps", CTLTYPE_INT }, \
+	{ "compat_42", CTLTYPE_INT }, \
+	{ "cwm", CTLTYPE_INT }, \
+	{ "cwm_burstsize", CTLTYPE_INT }, \
+	{ "ack_on_push", CTLTYPE_INT }, \
+	{ "keepidle",	CTLTYPE_INT }, \
+	{ "keepintvl",	CTLTYPE_INT }, \
+	{ "keepcnt",	CTLTYPE_INT }, \
+	{ "slowhz",	CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ "log_refused",CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ "rstppslimit", CTLTYPE_INT }, \
+	{ "delack_ticks", CTLTYPE_INT }, \
+	{ "init_win_local", CTLTYPE_INT }, \
+	{ "ident", CTLTYPE_STRUCT }, \
+	{ "ackdropppslimit", CTLTYPE_INT }, \
+	{ "do_loopback_cksum", CTLTYPE_INT }, \
+	{ "stats", CTLTYPE_STRUCT }, \
+	{ "debug", CTLTYPE_STRUCT }, \
+	{ "debx", CTLTYPE_INT }, \
+	{ "drop", CTLTYPE_STRUCT }, \
+	{ "msl", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+
+extern	struct inpcbtable tcbtable;	/* head of queue of active tcpcb's */
+extern	const struct pr_usrreqs tcp_usrreqs;
+
+extern	u_int32_t tcp_now;	/* for RFC 1323 timestamps */
+extern	int tcp_do_rfc1323;	/* enabled/disabled? */
+extern	int tcp_do_sack;	/* SACK enabled/disabled? */
+extern	int tcp_do_win_scale;	/* RFC1323 window scaling enabled/disabled? */
+extern	int tcp_do_timestamps;	/* RFC1323 timestamps enabled/disabled? */
+extern	int tcp_mssdflt;	/* default seg size */
+extern	int tcp_minmss;		/* minimal seg size */
+extern  int tcp_msl;		/* max segment life */
+extern	int tcp_init_win;	/* initial window */
+extern	int tcp_init_win_local;	/* initial window for local nets */
+extern	int tcp_init_win_max[11];/* max sizes for values of tcp_init_win_* */
+extern	int tcp_mss_ifmtu;	/* take MSS from interface, not in_maxmtu */
+extern	int tcp_compat_42;	/* work around ancient broken TCP peers */
+extern	int tcp_cwm;		/* enable Congestion Window Monitoring */
+extern	int tcp_cwm_burstsize;	/* burst size allowed by CWM */
+extern	int tcp_ack_on_push;	/* ACK immediately on PUSH */
+extern	int tcp_syn_cache_limit; /* max entries for compressed state engine */
+extern	int tcp_syn_bucket_limit;/* max entries per hash bucket */
+extern	int tcp_log_refused;	/* log refused connections */
+extern	int tcp_do_ecn;		/* TCP ECN enabled/disabled? */
+extern	int tcp_ecn_maxretries;	/* Max ECN setup retries */
+extern	int tcp_do_rfc1948;	/* ISS by cryptographic hash */
+extern int tcp_sack_tp_maxholes;	/* Max holes per connection. */
+extern int tcp_sack_globalmaxholes;	/* Max holes per system. */
+extern int tcp_sack_globalholes;	/* Number of holes present. */
+extern int tcp_do_abc;			/* RFC3465 ABC enabled/disabled? */
+extern int tcp_abc_aggressive;		/* 1: L=2*SMSS  0: L=1*SMSS */
+
+extern int tcp_msl_enable;		/* enable TIME_WAIT truncation	*/
+extern int tcp_msl_loop;		/* MSL for loopback		*/
+extern int tcp_msl_local;		/* MSL for 'local'		*/
+extern int tcp_msl_remote;		/* MSL otherwise		*/
+extern int tcp_msl_remote_threshold;	/* RTT threshold		*/
+extern int tcp_rttlocal;		/* Use RTT to decide who's 'local' */
+extern int tcp4_vtw_enable;
+extern int tcp6_vtw_enable;
+extern int tcp_vtw_was_enabled;
+extern int tcp_vtw_entries;
+
+extern	int tcp_rst_ppslim;
+extern	int tcp_ackdrop_ppslim;
+
+extern	int tcp_syn_cache_size;
+extern	struct syn_cache_head tcp_syn_cache[];
+extern	u_long syn_cache_count;
+
+#ifdef MBUFTRACE
+extern	struct mowner tcp_rx_mowner;
+extern	struct mowner tcp_tx_mowner;
+extern	struct mowner tcp_reass_mowner;
+extern	struct mowner tcp_sock_mowner;
+extern	struct mowner tcp_sock_rx_mowner;
+extern	struct mowner tcp_sock_tx_mowner;
+extern	struct mowner tcp_mowner;
+#endif
+
+extern int tcp_do_autorcvbuf;
+extern int tcp_autorcvbuf_inc;
+extern int tcp_autorcvbuf_max;
+extern int tcp_do_autosndbuf;
+extern int tcp_autosndbuf_inc;
+extern int tcp_autosndbuf_max;
+
+
+#define	TCPCTL_VARIABLES { \
+	{ 0 },					\
+	{ 1, 0, &tcp_do_rfc1323 },		\
+	{ 1, 0, &tcp_sendspace },		\
+	{ 1, 0, &tcp_recvspace },		\
+	{ 1, 0, &tcp_mssdflt },			\
+	{ 1, 0, &tcp_syn_cache_limit },		\
+	{ 1, 0, &tcp_syn_bucket_limit },	\
+	{ 0 },					\
+	{ 1, 0, &tcp_init_win },		\
+	{ 1, 0, &tcp_mss_ifmtu },		\
+	{ 1, 0, &tcp_do_sack },			\
+	{ 1, 0, &tcp_do_win_scale },		\
+	{ 1, 0, &tcp_do_timestamps },		\
+	{ 1, 0, &tcp_compat_42 },		\
+	{ 1, 0, &tcp_cwm },			\
+	{ 1, 0, &tcp_cwm_burstsize },		\
+	{ 1, 0, &tcp_ack_on_push },		\
+	{ 1, 0, &tcp_keepidle },		\
+	{ 1, 0, &tcp_keepintvl },		\
+	{ 1, 0, &tcp_keepcnt },			\
+	{ 1, 1, 0, PR_SLOWHZ },			\
+	{ 0 },					\
+	{ 1, 0, &tcp_log_refused },		\
+	{ 0 },					\
+	{ 1, 0, &tcp_rst_ppslim },		\
+	{ 1, 0, &tcp_delack_ticks },		\
+	{ 1, 0, &tcp_init_win_local },		\
+	{ 1, 0, &tcp_ackdrop_ppslim },		\
+}
+
+struct secasvar;
+
+void	 tcp_canceltimers(struct tcpcb *);
+struct tcpcb *
+	 tcp_close(struct tcpcb *);
+int	 tcp_isdead(struct tcpcb *);
+#ifdef INET6
+void	 *tcp6_ctlinput(int, const struct sockaddr *, void *);
+#endif
+void	 *tcp_ctlinput(int, const struct sockaddr *, void *);
+int	 tcp_ctloutput(int, struct socket *, struct sockopt *);
+struct tcpcb *
+	 tcp_disconnect1(struct tcpcb *);
+struct tcpcb *
+	 tcp_drop(struct tcpcb *, int);
+#ifdef TCP_SIGNATURE
+int	 tcp_signature_apply(void *, void *, u_int);
+struct secasvar *tcp_signature_getsav(struct mbuf *, struct tcphdr *);
+int	 tcp_signature(struct mbuf *, struct tcphdr *, int, struct secasvar *,
+	    char *);
+#endif
+void	 tcp_drain(void);
+void	 tcp_drainstub(void);
+void	 tcp_established(struct tcpcb *);
+void	 tcp_init(void);
+void	 tcp_init_common(unsigned);
+#ifdef INET6
+int	 tcp6_input(struct mbuf **, int *, int);
+#endif
+void	 tcp_input(struct mbuf *, ...);
+u_int	 tcp_hdrsz(struct tcpcb *);
+u_long	 tcp_mss_to_advertise(const struct ifnet *, int);
+void	 tcp_mss_from_peer(struct tcpcb *, int);
+void	 tcp_tcpcb_template(void);
+struct tcpcb *
+	 tcp_newtcpcb(int, void *);
+void	 tcp_notify(struct inpcb *, int);
+#ifdef INET6
+void	 tcp6_notify(struct in6pcb *, int);
+#endif
+u_int	 tcp_optlen(struct tcpcb *);
+int	 tcp_output(struct tcpcb *);
+void	 tcp_pulloutofband(struct socket *,
+	    struct tcphdr *, struct mbuf *, int);
+void	 tcp_quench(struct inpcb *, int);
+#ifdef INET6
+void	 tcp6_quench(struct in6pcb *, int);
+#endif
+void	 tcp_mtudisc(struct inpcb *, int);
+#ifdef INET6
+void	 tcp6_mtudisc_callback(struct in6_addr *);
+#endif
+
+void	tcpipqent_init(void);
+struct ipqent *tcpipqent_alloc(void);
+void	 tcpipqent_free(struct ipqent *);
+
+int	 tcp_respond(struct tcpcb *, struct mbuf *, struct mbuf *,
+	    struct tcphdr *, tcp_seq, tcp_seq, int);
+void	 tcp_rmx_rtt(struct tcpcb *);
+void	 tcp_setpersist(struct tcpcb *);
+#ifdef TCP_SIGNATURE
+int	 tcp_signature_compute(struct mbuf *, struct tcphdr *, int, int,
+	    int, u_char *, u_int);
+#endif
+void	 tcp_slowtimo(void *);
+extern callout_t tcp_slowtimo_ch;
+void	 tcp_fasttimo(void);
+struct mbuf *
+	 tcp_template(struct tcpcb *);
+void	 tcp_trace(short, short, struct tcpcb *, struct mbuf *, int);
+struct tcpcb *
+	 tcp_usrclosed(struct tcpcb *);
+void	 tcp_usrreq_init(void);
+void	 tcp_xmit_timer(struct tcpcb *, uint32_t);
+tcp_seq	 tcp_new_iss(struct tcpcb *, tcp_seq);
+tcp_seq  tcp_new_iss1(void *, void *, u_int16_t, u_int16_t, size_t,
+	    tcp_seq);
+
+void	 tcp_sack_init(void);
+void	 tcp_new_dsack(struct tcpcb *, tcp_seq, u_int32_t);
+void	 tcp_sack_option(struct tcpcb *, const struct tcphdr *,
+	    const u_char *, int);
+void	 tcp_del_sackholes(struct tcpcb *, const struct tcphdr *);
+void	 tcp_free_sackholes(struct tcpcb *);
+void	 tcp_sack_adjust(struct tcpcb *tp);
+struct sackhole *tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt);
+int	 tcp_sack_numblks(const struct tcpcb *);
+#define	TCP_SACK_OPTLEN(nblks)	((nblks) * 8 + 2 + 2)
+
+void	 tcp_statinc(u_int);
+void	 tcp_statadd(u_int, uint64_t);
+
+int	 syn_cache_add(struct sockaddr *, struct sockaddr *,
+		struct tcphdr *, unsigned int, struct socket *,
+		struct mbuf *, u_char *, int, struct tcp_opt_info *);
+void	 syn_cache_unreach(const struct sockaddr *, const struct sockaddr *,
+	   struct tcphdr *);
+struct socket *syn_cache_get(struct sockaddr *, struct sockaddr *,
+		struct tcphdr *, unsigned int, unsigned int,
+		struct socket *so, struct mbuf *);
+void	 syn_cache_init(void);
+void	 syn_cache_insert(struct syn_cache *, struct tcpcb *);
+struct syn_cache *syn_cache_lookup(const struct sockaddr *, const struct sockaddr *,
+		struct syn_cache_head **);
+void	 syn_cache_reset(struct sockaddr *, struct sockaddr *,
+		struct tcphdr *);
+int	 syn_cache_respond(struct syn_cache *, struct mbuf *);
+void	 syn_cache_timer(void *);
+void	 syn_cache_cleanup(struct tcpcb *);
+
+int	 tcp_input_checksum(int, struct mbuf *, const struct tcphdr *, int, int,
+    int);
+#endif
+
+#endif /* !_NETINET_TCP_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet/tcp_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/asn1_mac.h
===================================================================
--- lab4/.minix-src/include/openssl/asn1_mac.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/asn1_mac.h	(revision 13)
@@ -0,0 +1,579 @@
+/* crypto/asn1/asn1_mac.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_ASN1_MAC_H
+# define HEADER_ASN1_MAC_H
+
+# include <openssl/asn1.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifndef ASN1_MAC_ERR_LIB
+#  define ASN1_MAC_ERR_LIB        ERR_LIB_ASN1
+# endif
+
+# define ASN1_MAC_H_err(f,r,line) \
+        ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
+
+# define M_ASN1_D2I_vars(a,type,func) \
+        ASN1_const_CTX c; \
+        type ret=NULL; \
+        \
+        c.pp=(const unsigned char **)pp; \
+        c.q= *(const unsigned char **)pp; \
+        c.error=ERR_R_NESTED_ASN1_ERROR; \
+        if ((a == NULL) || ((*a) == NULL)) \
+                { if ((ret=(type)func()) == NULL) \
+                        { c.line=__LINE__; goto err; } } \
+        else    ret=(*a);
+
+# define M_ASN1_D2I_Init() \
+        c.p= *(const unsigned char **)pp; \
+        c.max=(length == 0)?0:(c.p+length);
+
+# define M_ASN1_D2I_Finish_2(a) \
+        if (!asn1_const_Finish(&c)) \
+                { c.line=__LINE__; goto err; } \
+        *(const unsigned char **)pp=c.p; \
+        if (a != NULL) (*a)=ret; \
+        return(ret);
+
+# define M_ASN1_D2I_Finish(a,func,e) \
+        M_ASN1_D2I_Finish_2(a); \
+err:\
+        ASN1_MAC_H_err((e),c.error,c.line); \
+        asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \
+        if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
+        return(NULL)
+
+# define M_ASN1_D2I_start_sequence() \
+        if (!asn1_GetSequence(&c,&length)) \
+                { c.line=__LINE__; goto err; }
+/* Begin reading ASN1 without a surrounding sequence */
+# define M_ASN1_D2I_begin() \
+        c.slen = length;
+
+/* End reading ASN1 with no check on length */
+# define M_ASN1_D2I_Finish_nolen(a, func, e) \
+        *pp=c.p; \
+        if (a != NULL) (*a)=ret; \
+        return(ret); \
+err:\
+        ASN1_MAC_H_err((e),c.error,c.line); \
+        asn1_add_error(*pp,(int)(c.q- *pp)); \
+        if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
+        return(NULL)
+
+# define M_ASN1_D2I_end_sequence() \
+        (((c.inf&1) == 0)?(c.slen <= 0): \
+                (c.eos=ASN1_const_check_infinite_end(&c.p,c.slen)))
+
+/* Don't use this with d2i_ASN1_BOOLEAN() */
+# define M_ASN1_D2I_get(b, func) \
+        c.q=c.p; \
+        if (func(&(b),&c.p,c.slen) == NULL) \
+                {c.line=__LINE__; goto err; } \
+        c.slen-=(c.p-c.q);
+
+/* Don't use this with d2i_ASN1_BOOLEAN() */
+# define M_ASN1_D2I_get_x(type,b,func) \
+        c.q=c.p; \
+        if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
+                {c.line=__LINE__; goto err; } \
+        c.slen-=(c.p-c.q);
+
+/* use this instead () */
+# define M_ASN1_D2I_get_int(b,func) \
+        c.q=c.p; \
+        if (func(&(b),&c.p,c.slen) < 0) \
+                {c.line=__LINE__; goto err; } \
+        c.slen-=(c.p-c.q);
+
+# define M_ASN1_D2I_get_opt(b,func,type) \
+        if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
+                == (V_ASN1_UNIVERSAL|(type)))) \
+                { \
+                M_ASN1_D2I_get(b,func); \
+                }
+
+# define M_ASN1_D2I_get_int_opt(b,func,type) \
+        if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
+                == (V_ASN1_UNIVERSAL|(type)))) \
+                { \
+                M_ASN1_D2I_get_int(b,func); \
+                }
+
+# define M_ASN1_D2I_get_imp(b,func, type) \
+        M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
+        c.q=c.p; \
+        if (func(&(b),&c.p,c.slen) == NULL) \
+                {c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \
+        c.slen-=(c.p-c.q);\
+        M_ASN1_next_prev=_tmp;
+
+# define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \
+        if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \
+                (V_ASN1_CONTEXT_SPECIFIC|(tag)))) \
+                { \
+                unsigned char _tmp = M_ASN1_next; \
+                M_ASN1_D2I_get_imp(b,func, type);\
+                }
+
+# define M_ASN1_D2I_get_set(r,func,free_func) \
+                M_ASN1_D2I_get_imp_set(r,func,free_func, \
+                        V_ASN1_SET,V_ASN1_UNIVERSAL);
+
+# define M_ASN1_D2I_get_set_type(type,r,func,free_func) \
+                M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \
+                        V_ASN1_SET,V_ASN1_UNIVERSAL);
+
+# define M_ASN1_D2I_get_set_opt(r,func,free_func) \
+        if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
+                V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
+                { M_ASN1_D2I_get_set(r,func,free_func); }
+
+# define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \
+        if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
+                V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
+                { M_ASN1_D2I_get_set_type(type,r,func,free_func); }
+
+# define M_ASN1_I2D_len_SET_opt(a,f) \
+        if ((a != NULL) && (sk_num(a) != 0)) \
+                M_ASN1_I2D_len_SET(a,f);
+
+# define M_ASN1_I2D_put_SET_opt(a,f) \
+        if ((a != NULL) && (sk_num(a) != 0)) \
+                M_ASN1_I2D_put_SET(a,f);
+
+# define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
+        if ((a != NULL) && (sk_num(a) != 0)) \
+                M_ASN1_I2D_put_SEQUENCE(a,f);
+
+# define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \
+        if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+                M_ASN1_I2D_put_SEQUENCE_type(type,a,f);
+
+# define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \
+        if ((c.slen != 0) && \
+                (M_ASN1_next == \
+                (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
+                { \
+                M_ASN1_D2I_get_imp_set(b,func,free_func,\
+                        tag,V_ASN1_CONTEXT_SPECIFIC); \
+                }
+
+# define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \
+        if ((c.slen != 0) && \
+                (M_ASN1_next == \
+                (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
+                { \
+                M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\
+                        tag,V_ASN1_CONTEXT_SPECIFIC); \
+                }
+
+# define M_ASN1_D2I_get_seq(r,func,free_func) \
+                M_ASN1_D2I_get_imp_set(r,func,free_func,\
+                        V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
+
+# define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \
+                M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
+                                            V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
+
+# define M_ASN1_D2I_get_seq_opt(r,func,free_func) \
+        if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
+                V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
+                { M_ASN1_D2I_get_seq(r,func,free_func); }
+
+# define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \
+        if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
+                V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
+                { M_ASN1_D2I_get_seq_type(type,r,func,free_func); }
+
+# define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \
+                M_ASN1_D2I_get_imp_set(r,func,free_func,\
+                        x,V_ASN1_CONTEXT_SPECIFIC);
+
+# define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \
+                M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
+                        x,V_ASN1_CONTEXT_SPECIFIC);
+
+# define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \
+        c.q=c.p; \
+        if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
+                (void (*)())free_func,a,b) == NULL) \
+                { c.line=__LINE__; goto err; } \
+        c.slen-=(c.p-c.q);
+
+# define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
+        c.q=c.p; \
+        if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
+                                   free_func,a,b) == NULL) \
+                { c.line=__LINE__; goto err; } \
+        c.slen-=(c.p-c.q);
+
+# define M_ASN1_D2I_get_set_strings(r,func,a,b) \
+        c.q=c.p; \
+        if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \
+                { c.line=__LINE__; goto err; } \
+        c.slen-=(c.p-c.q);
+
+# define M_ASN1_D2I_get_EXP_opt(r,func,tag) \
+        if ((c.slen != 0L) && (M_ASN1_next == \
+                (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
+                { \
+                int Tinf,Ttag,Tclass; \
+                long Tlen; \
+                \
+                c.q=c.p; \
+                Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
+                if (Tinf & 0x80) \
+                        { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
+                        c.line=__LINE__; goto err; } \
+                if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
+                                        Tlen = c.slen - (c.p - c.q) - 2; \
+                if (func(&(r),&c.p,Tlen) == NULL) \
+                        { c.line=__LINE__; goto err; } \
+                if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
+                        Tlen = c.slen - (c.p - c.q); \
+                        if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \
+                                { c.error=ERR_R_MISSING_ASN1_EOS; \
+                                c.line=__LINE__; goto err; } \
+                }\
+                c.slen-=(c.p-c.q); \
+                }
+
+# define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \
+        if ((c.slen != 0) && (M_ASN1_next == \
+                (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
+                { \
+                int Tinf,Ttag,Tclass; \
+                long Tlen; \
+                \
+                c.q=c.p; \
+                Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
+                if (Tinf & 0x80) \
+                        { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
+                        c.line=__LINE__; goto err; } \
+                if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
+                                        Tlen = c.slen - (c.p - c.q) - 2; \
+                if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \
+                        (void (*)())free_func, \
+                        b,V_ASN1_UNIVERSAL) == NULL) \
+                        { c.line=__LINE__; goto err; } \
+                if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
+                        Tlen = c.slen - (c.p - c.q); \
+                        if(!ASN1_check_infinite_end(&c.p, Tlen)) \
+                                { c.error=ERR_R_MISSING_ASN1_EOS; \
+                                c.line=__LINE__; goto err; } \
+                }\
+                c.slen-=(c.p-c.q); \
+                }
+
+# define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \
+        if ((c.slen != 0) && (M_ASN1_next == \
+                (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
+                { \
+                int Tinf,Ttag,Tclass; \
+                long Tlen; \
+                \
+                c.q=c.p; \
+                Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
+                if (Tinf & 0x80) \
+                        { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
+                        c.line=__LINE__; goto err; } \
+                if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
+                                        Tlen = c.slen - (c.p - c.q) - 2; \
+                if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \
+                        free_func,b,V_ASN1_UNIVERSAL) == NULL) \
+                        { c.line=__LINE__; goto err; } \
+                if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
+                        Tlen = c.slen - (c.p - c.q); \
+                        if(!ASN1_check_infinite_end(&c.p, Tlen)) \
+                                { c.error=ERR_R_MISSING_ASN1_EOS; \
+                                c.line=__LINE__; goto err; } \
+                }\
+                c.slen-=(c.p-c.q); \
+                }
+
+/* New macros */
+# define M_ASN1_New_Malloc(ret,type) \
+        if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
+                { c.line=__LINE__; goto err2; }
+
+# define M_ASN1_New(arg,func) \
+        if (((arg)=func()) == NULL) return(NULL)
+
+# define M_ASN1_New_Error(a) \
+/*-     err:    ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \
+                return(NULL);*/ \
+        err2:   ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \
+                return(NULL)
+
+/*
+ * BIG UGLY WARNING! This is so damn ugly I wanna puke.  Unfortunately, some
+ * macros that use ASN1_const_CTX still insist on writing in the input
+ * stream.  ARGH! ARGH! ARGH! Let's get rid of this macro package. Please? --
+ * Richard Levitte
+ */
+# define M_ASN1_next             (*((unsigned char *)(c.p)))
+# define M_ASN1_next_prev        (*((unsigned char *)(c.q)))
+
+/*************************************************/
+
+# define M_ASN1_I2D_vars(a)      int r=0,ret=0; \
+                                unsigned char *p; \
+                                if (a == NULL) return(0)
+
+/* Length Macros */
+# define M_ASN1_I2D_len(a,f)     ret+=f(a,NULL)
+# define M_ASN1_I2D_len_IMP_opt(a,f)     if (a != NULL) M_ASN1_I2D_len(a,f)
+
+# define M_ASN1_I2D_len_SET(a,f) \
+                ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
+
+# define M_ASN1_I2D_len_SET_type(type,a,f) \
+                ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \
+                                            V_ASN1_UNIVERSAL,IS_SET);
+
+# define M_ASN1_I2D_len_SEQUENCE(a,f) \
+                ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
+                                  IS_SEQUENCE);
+
+# define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \
+                ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \
+                                            V_ASN1_UNIVERSAL,IS_SEQUENCE)
+
+# define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \
+                if ((a != NULL) && (sk_num(a) != 0)) \
+                        M_ASN1_I2D_len_SEQUENCE(a,f);
+
+# define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \
+                if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+                        M_ASN1_I2D_len_SEQUENCE_type(type,a,f);
+
+# define M_ASN1_I2D_len_IMP_SET(a,f,x) \
+                ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);
+
+# define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \
+                ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
+                                            V_ASN1_CONTEXT_SPECIFIC,IS_SET);
+
+# define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \
+                if ((a != NULL) && (sk_num(a) != 0)) \
+                        ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
+                                          IS_SET);
+
+# define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \
+                if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+                        ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
+                                               V_ASN1_CONTEXT_SPECIFIC,IS_SET);
+
+# define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \
+                ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
+                                  IS_SEQUENCE);
+
+# define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \
+                if ((a != NULL) && (sk_num(a) != 0)) \
+                        ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
+                                          IS_SEQUENCE);
+
+# define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \
+                if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+                        ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
+                                                    V_ASN1_CONTEXT_SPECIFIC, \
+                                                    IS_SEQUENCE);
+
+# define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \
+                if (a != NULL)\
+                        { \
+                        v=f(a,NULL); \
+                        ret+=ASN1_object_size(1,v,mtag); \
+                        }
+
+# define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \
+                if ((a != NULL) && (sk_num(a) != 0))\
+                        { \
+                        v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
+                        ret+=ASN1_object_size(1,v,mtag); \
+                        }
+
+# define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
+                if ((a != NULL) && (sk_num(a) != 0))\
+                        { \
+                        v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \
+                                       IS_SEQUENCE); \
+                        ret+=ASN1_object_size(1,v,mtag); \
+                        }
+
+# define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
+                if ((a != NULL) && (sk_##type##_num(a) != 0))\
+                        { \
+                        v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \
+                                                 V_ASN1_UNIVERSAL, \
+                                                 IS_SEQUENCE); \
+                        ret+=ASN1_object_size(1,v,mtag); \
+                        }
+
+/* Put Macros */
+# define M_ASN1_I2D_put(a,f)     f(a,&p)
+
+# define M_ASN1_I2D_put_IMP_opt(a,f,t)   \
+                if (a != NULL) \
+                        { \
+                        unsigned char *q=p; \
+                        f(a,&p); \
+                        *q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\
+                        }
+
+# define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\
+                        V_ASN1_UNIVERSAL,IS_SET)
+# define M_ASN1_I2D_put_SET_type(type,a,f) \
+     i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET)
+# define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
+                        V_ASN1_CONTEXT_SPECIFIC,IS_SET)
+# define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \
+     i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET)
+# define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
+                        V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE)
+
+# define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\
+                                             V_ASN1_UNIVERSAL,IS_SEQUENCE)
+
+# define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \
+     i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
+                            IS_SEQUENCE)
+
+# define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
+                if ((a != NULL) && (sk_num(a) != 0)) \
+                        M_ASN1_I2D_put_SEQUENCE(a,f);
+
+# define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \
+                if ((a != NULL) && (sk_num(a) != 0)) \
+                        { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
+                                       IS_SET); }
+
+# define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \
+                if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+                        { i2d_ASN1_SET_OF_##type(a,&p,f,x, \
+                                                 V_ASN1_CONTEXT_SPECIFIC, \
+                                                 IS_SET); }
+
+# define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \
+                if ((a != NULL) && (sk_num(a) != 0)) \
+                        { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
+                                       IS_SEQUENCE); }
+
+# define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \
+                if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+                        { i2d_ASN1_SET_OF_##type(a,&p,f,x, \
+                                                 V_ASN1_CONTEXT_SPECIFIC, \
+                                                 IS_SEQUENCE); }
+
+# define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \
+                if (a != NULL) \
+                        { \
+                        ASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \
+                        f(a,&p); \
+                        }
+
+# define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \
+                if ((a != NULL) && (sk_num(a) != 0)) \
+                        { \
+                        ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
+                        i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
+                        }
+
+# define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
+                if ((a != NULL) && (sk_num(a) != 0)) \
+                        { \
+                        ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
+                        i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \
+                        }
+
+# define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
+                if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+                        { \
+                        ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
+                        i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \
+                                               IS_SEQUENCE); \
+                        }
+
+# define M_ASN1_I2D_seq_total() \
+                r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \
+                if (pp == NULL) return(r); \
+                p= *pp; \
+                ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
+
+# define M_ASN1_I2D_INF_seq_start(tag,ctx) \
+                *(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \
+                *(p++)=0x80
+
+# define M_ASN1_I2D_INF_seq_end() *(p++)=0x00; *(p++)=0x00
+
+# define M_ASN1_I2D_finish()     *pp=p; \
+                                return(r);
+
+int asn1_GetSequence(ASN1_const_CTX *c, long *length);
+void asn1_add_error(const unsigned char *address, int offset);
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/asn1_mac.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/bn.h
===================================================================
--- lab4/.minix-src/include/openssl/bn.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/bn.h	(revision 13)
@@ -0,0 +1,957 @@
+/* crypto/bn/bn.h */
+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* ====================================================================
+ * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ *
+ * Portions of the attached software ("Contribution") are developed by
+ * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
+ *
+ * The Contribution is licensed pursuant to the Eric Young open source
+ * license provided above.
+ *
+ * The binary polynomial arithmetic software is originally written by
+ * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
+ *
+ */
+
+#ifndef HEADER_BN_H
+# define HEADER_BN_H
+
+# include <openssl/e_os2.h>
+# ifndef OPENSSL_NO_FP_API
+#  include <stdio.h>            /* FILE */
+# endif
+# include <openssl/ossl_typ.h>
+# include <openssl/crypto.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*
+ * These preprocessor symbols control various aspects of the bignum headers
+ * and library code. They're not defined by any "normal" configuration, as
+ * they are intended for development and testing purposes. NB: defining all
+ * three can be useful for debugging application code as well as openssl
+ * itself. BN_DEBUG - turn on various debugging alterations to the bignum
+ * code BN_DEBUG_RAND - uses random poisoning of unused words to trip up
+ * mismanagement of bignum internals. You must also define BN_DEBUG.
+ */
+/* #define BN_DEBUG */
+/* #define BN_DEBUG_RAND */
+
+# ifndef OPENSSL_SMALL_FOOTPRINT
+#  define BN_MUL_COMBA
+#  define BN_SQR_COMBA
+#  define BN_RECURSION
+# endif
+
+/*
+ * This next option uses the C libraries (2 word)/(1 word) function. If it is
+ * not defined, I use my C version (which is slower). The reason for this
+ * flag is that when the particular C compiler library routine is used, and
+ * the library is linked with a different compiler, the library is missing.
+ * This mostly happens when the library is built with gcc and then linked
+ * using normal cc.  This would be a common occurrence because gcc normally
+ * produces code that is 2 times faster than system compilers for the big
+ * number stuff. For machines with only one compiler (or shared libraries),
+ * this should be on.  Again this in only really a problem on machines using
+ * "long long's", are 32bit, and are not using my assembler code.
+ */
+# if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || \
+    defined(OPENSSL_SYS_WIN32) || defined(linux)
+#  ifndef BN_DIV2W
+#   define BN_DIV2W
+#  endif
+# endif
+
+/*
+ * assuming long is 64bit - this is the DEC Alpha unsigned long long is only
+ * 64 bits :-(, don't define BN_LLONG for the DEC Alpha
+ */
+# ifdef SIXTY_FOUR_BIT_LONG
+#  define BN_ULLONG       unsigned long long
+#  define BN_ULONG        unsigned long
+#  define BN_LONG         long
+#  define BN_BITS         128
+#  define BN_BYTES        8
+#  define BN_BITS2        64
+#  define BN_BITS4        32
+#  define BN_MASK         (0xffffffffffffffffffffffffffffffffLL)
+#  define BN_MASK2        (0xffffffffffffffffL)
+#  define BN_MASK2l       (0xffffffffL)
+#  define BN_MASK2h       (0xffffffff00000000L)
+#  define BN_MASK2h1      (0xffffffff80000000L)
+#  define BN_TBIT         (0x8000000000000000L)
+#  define BN_DEC_CONV     (10000000000000000000UL)
+#  define BN_DEC_FMT1     "%lu"
+#  define BN_DEC_FMT2     "%019lu"
+#  define BN_DEC_NUM      19
+#  define BN_HEX_FMT1     "%lX"
+#  define BN_HEX_FMT2     "%016lX"
+# endif
+
+/*
+ * This is where the long long data type is 64 bits, but long is 32. For
+ * machines where there are 64bit registers, this is the mode to use. IRIX,
+ * on R4000 and above should use this mode, along with the relevant assembler
+ * code :-).  Do NOT define BN_LLONG.
+ */
+# ifdef SIXTY_FOUR_BIT
+#  undef BN_LLONG
+#  undef BN_ULLONG
+#  define BN_ULONG        unsigned long long
+#  define BN_LONG         long long
+#  define BN_BITS         128
+#  define BN_BYTES        8
+#  define BN_BITS2        64
+#  define BN_BITS4        32
+#  define BN_MASK2        (0xffffffffffffffffLL)
+#  define BN_MASK2l       (0xffffffffL)
+#  define BN_MASK2h       (0xffffffff00000000LL)
+#  define BN_MASK2h1      (0xffffffff80000000LL)
+#  define BN_TBIT         (0x8000000000000000LL)
+#  define BN_DEC_CONV     (10000000000000000000ULL)
+#  define BN_DEC_FMT1     "%llu"
+#  define BN_DEC_FMT2     "%019llu"
+#  define BN_DEC_NUM      19
+#  define BN_HEX_FMT1     "%llX"
+#  define BN_HEX_FMT2     "%016llX"
+# endif
+
+# ifdef THIRTY_TWO_BIT
+#  ifdef BN_LLONG
+#   if defined(_WIN32) && !defined(__GNUC__)
+#    define BN_ULLONG     unsigned __int64
+#    define BN_MASK       (0xffffffffffffffffI64)
+#   else
+#    define BN_ULLONG     unsigned long long
+#    define BN_MASK       (0xffffffffffffffffLL)
+#   endif
+#  endif
+#  define BN_ULONG        unsigned int
+#  define BN_LONG         int
+#  define BN_BITS         64
+#  define BN_BYTES        4
+#  define BN_BITS2        32
+#  define BN_BITS4        16
+#  define BN_MASK2        (0xffffffffL)
+#  define BN_MASK2l       (0xffff)
+#  define BN_MASK2h1      (0xffff8000L)
+#  define BN_MASK2h       (0xffff0000L)
+#  define BN_TBIT         (0x80000000L)
+#  define BN_DEC_CONV     (1000000000L)
+#  define BN_DEC_FMT1     "%u"
+#  define BN_DEC_FMT2     "%09u"
+#  define BN_DEC_NUM      9
+#  define BN_HEX_FMT1     "%X"
+#  define BN_HEX_FMT2     "%08X"
+# endif
+
+/*
+ * 2011-02-22 SMS. In various places, a size_t variable or a type cast to
+ * size_t was used to perform integer-only operations on pointers.  This
+ * failed on VMS with 64-bit pointers (CC /POINTER_SIZE = 64) because size_t
+ * is still only 32 bits.  What's needed in these cases is an integer type
+ * with the same size as a pointer, which size_t is not certain to be. The
+ * only fix here is VMS-specific.
+ */
+# if defined(OPENSSL_SYS_VMS)
+#  if __INITIAL_POINTER_SIZE == 64
+#   define PTR_SIZE_INT long long
+#  else                         /* __INITIAL_POINTER_SIZE == 64 */
+#   define PTR_SIZE_INT int
+#  endif                        /* __INITIAL_POINTER_SIZE == 64 [else] */
+# else                          /* defined(OPENSSL_SYS_VMS) */
+#  define PTR_SIZE_INT size_t
+# endif                         /* defined(OPENSSL_SYS_VMS) [else] */
+
+# define BN_DEFAULT_BITS 1280
+
+# define BN_FLG_MALLOCED         0x01
+# define BN_FLG_STATIC_DATA      0x02
+
+/*
+ * avoid leaking exponent information through timing,
+ * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,
+ * BN_div() will call BN_div_no_branch,
+ * BN_mod_inverse() will call BN_mod_inverse_no_branch.
+ */
+# define BN_FLG_CONSTTIME        0x04
+
+# ifdef OPENSSL_NO_DEPRECATED
+/* deprecated name for the flag */
+#  define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME
+/*
+ * avoid leaking exponent information through timings
+ * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime)
+ */
+# endif
+
+# ifndef OPENSSL_NO_DEPRECATED
+#  define BN_FLG_FREE             0x8000
+                                       /* used for debuging */
+# endif
+# define BN_set_flags(b,n)       ((b)->flags|=(n))
+# define BN_get_flags(b,n)       ((b)->flags&(n))
+
+/*
+ * get a clone of a BIGNUM with changed flags, for *temporary* use only (the
+ * two BIGNUMs cannot not be used in parallel!)
+ */
+# define BN_with_flags(dest,b,n)  ((dest)->d=(b)->d, \
+                                  (dest)->top=(b)->top, \
+                                  (dest)->dmax=(b)->dmax, \
+                                  (dest)->neg=(b)->neg, \
+                                  (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \
+                                                 |  ((b)->flags & ~BN_FLG_MALLOCED) \
+                                                 |  BN_FLG_STATIC_DATA \
+                                                 |  (n)))
+
+/* Already declared in ossl_typ.h */
+# if 0
+typedef struct bignum_st BIGNUM;
+/* Used for temp variables (declaration hidden in bn_lcl.h) */
+typedef struct bignum_ctx BN_CTX;
+typedef struct bn_blinding_st BN_BLINDING;
+typedef struct bn_mont_ctx_st BN_MONT_CTX;
+typedef struct bn_recp_ctx_st BN_RECP_CTX;
+typedef struct bn_gencb_st BN_GENCB;
+# endif
+
+struct bignum_st {
+    BN_ULONG *d;                /* Pointer to an array of 'BN_BITS2' bit
+                                 * chunks. */
+    int top;                    /* Index of last used d +1. */
+    /* The next are internal book keeping for bn_expand. */
+    int dmax;                   /* Size of the d array. */
+    int neg;                    /* one if the number is negative */
+    int flags;
+};
+
+/* Used for montgomery multiplication */
+struct bn_mont_ctx_st {
+    int ri;                     /* number of bits in R */
+    BIGNUM RR;                  /* used to convert to montgomery form */
+    BIGNUM N;                   /* The modulus */
+    BIGNUM Ni;                  /* R*(1/R mod N) - N*Ni = 1 (Ni is only
+                                 * stored for bignum algorithm) */
+    BN_ULONG n0[2];             /* least significant word(s) of Ni; (type
+                                 * changed with 0.9.9, was "BN_ULONG n0;"
+                                 * before) */
+    int flags;
+};
+
+/*
+ * Used for reciprocal division/mod functions It cannot be shared between
+ * threads
+ */
+struct bn_recp_ctx_st {
+    BIGNUM N;                   /* the divisor */
+    BIGNUM Nr;                  /* the reciprocal */
+    int num_bits;
+    int shift;
+    int flags;
+};
+
+/* Used for slow "generation" functions. */
+struct bn_gencb_st {
+    unsigned int ver;           /* To handle binary (in)compatibility */
+    void *arg;                  /* callback-specific data */
+    union {
+        /* if(ver==1) - handles old style callbacks */
+        void (*cb_1) (int, int, void *);
+        /* if(ver==2) - new callback style */
+        int (*cb_2) (int, int, BN_GENCB *);
+    } cb;
+};
+/* Wrapper function to make using BN_GENCB easier,  */
+int BN_GENCB_call(BN_GENCB *cb, int a, int b);
+/* Macro to populate a BN_GENCB structure with an "old"-style callback */
+# define BN_GENCB_set_old(gencb, callback, cb_arg) { \
+                BN_GENCB *tmp_gencb = (gencb); \
+                tmp_gencb->ver = 1; \
+                tmp_gencb->arg = (cb_arg); \
+                tmp_gencb->cb.cb_1 = (callback); }
+/* Macro to populate a BN_GENCB structure with a "new"-style callback */
+# define BN_GENCB_set(gencb, callback, cb_arg) { \
+                BN_GENCB *tmp_gencb = (gencb); \
+                tmp_gencb->ver = 2; \
+                tmp_gencb->arg = (cb_arg); \
+                tmp_gencb->cb.cb_2 = (callback); }
+
+# define BN_prime_checks 0      /* default: select number of iterations based
+                                 * on the size of the number */
+
+/*
+ * number of Miller-Rabin iterations for an error rate of less than 2^-80 for
+ * random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook of
+ * Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996];
+ * original paper: Damgaard, Landrock, Pomerance: Average case error
+ * estimates for the strong probable prime test. -- Math. Comp. 61 (1993)
+ * 177-194)
+ */
+# define BN_prime_checks_for_size(b) ((b) >= 1300 ?  2 : \
+                                (b) >=  850 ?  3 : \
+                                (b) >=  650 ?  4 : \
+                                (b) >=  550 ?  5 : \
+                                (b) >=  450 ?  6 : \
+                                (b) >=  400 ?  7 : \
+                                (b) >=  350 ?  8 : \
+                                (b) >=  300 ?  9 : \
+                                (b) >=  250 ? 12 : \
+                                (b) >=  200 ? 15 : \
+                                (b) >=  150 ? 18 : \
+                                /* b >= 100 */ 27)
+
+# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
+
+/* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */
+# define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \
+                                (((w) == 0) && ((a)->top == 0)))
+# define BN_is_zero(a)       ((a)->top == 0)
+# define BN_is_one(a)        (BN_abs_is_word((a),1) && !(a)->neg)
+# define BN_is_word(a,w)     (BN_abs_is_word((a),(w)) && (!(w) || !(a)->neg))
+# define BN_is_odd(a)        (((a)->top > 0) && ((a)->d[0] & 1))
+
+# define BN_one(a)       (BN_set_word((a),1))
+# define BN_zero_ex(a) \
+        do { \
+                BIGNUM *_tmp_bn = (a); \
+                _tmp_bn->top = 0; \
+                _tmp_bn->neg = 0; \
+        } while(0)
+# ifdef OPENSSL_NO_DEPRECATED
+#  define BN_zero(a)      BN_zero_ex(a)
+# else
+#  define BN_zero(a)      (BN_set_word((a),0))
+# endif
+
+const BIGNUM *BN_value_one(void);
+char *BN_options(void);
+BN_CTX *BN_CTX_new(void);
+# ifndef OPENSSL_NO_DEPRECATED
+void BN_CTX_init(BN_CTX *c);
+# endif
+void BN_CTX_free(BN_CTX *c);
+void BN_CTX_start(BN_CTX *ctx);
+BIGNUM *BN_CTX_get(BN_CTX *ctx);
+void BN_CTX_end(BN_CTX *ctx);
+int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
+int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
+int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
+int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
+int BN_num_bits(const BIGNUM *a);
+int BN_num_bits_word(BN_ULONG);
+BIGNUM *BN_new(void);
+void BN_init(BIGNUM *);
+void BN_clear_free(BIGNUM *a);
+BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
+void BN_swap(BIGNUM *a, BIGNUM *b);
+BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
+int BN_bn2bin(const BIGNUM *a, unsigned char *to);
+BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret);
+int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
+int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
+int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
+/** BN_set_negative sets sign of a BIGNUM
+ * \param  b  pointer to the BIGNUM object
+ * \param  n  0 if the BIGNUM b should be positive and a value != 0 otherwise
+ */
+void BN_set_negative(BIGNUM *b, int n);
+/** BN_is_negative returns 1 if the BIGNUM is negative
+ * \param  a  pointer to the BIGNUM object
+ * \return 1 if a < 0 and 0 otherwise
+ */
+# define BN_is_negative(a) ((a)->neg != 0)
+
+int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
+           BN_CTX *ctx);
+# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
+int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
+int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
+               BN_CTX *ctx);
+int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                     const BIGNUM *m);
+int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
+               BN_CTX *ctx);
+int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                     const BIGNUM *m);
+int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
+               BN_CTX *ctx);
+int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);
+int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m,
+                  BN_CTX *ctx);
+int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);
+
+BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
+BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
+int BN_mul_word(BIGNUM *a, BN_ULONG w);
+int BN_add_word(BIGNUM *a, BN_ULONG w);
+int BN_sub_word(BIGNUM *a, BN_ULONG w);
+int BN_set_word(BIGNUM *a, BN_ULONG w);
+BN_ULONG BN_get_word(const BIGNUM *a);
+
+int BN_cmp(const BIGNUM *a, const BIGNUM *b);
+void BN_free(BIGNUM *a);
+int BN_is_bit_set(const BIGNUM *a, int n);
+int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
+int BN_lshift1(BIGNUM *r, const BIGNUM *a);
+int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+
+int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+               const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+                    const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
+                              const BIGNUM *m, BN_CTX *ctx,
+                              BN_MONT_CTX *in_mont);
+int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
+                         const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
+                     const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m,
+                     BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+                      const BIGNUM *m, BN_CTX *ctx);
+
+int BN_mask_bits(BIGNUM *a, int n);
+# ifndef OPENSSL_NO_FP_API
+int BN_print_fp(FILE *fp, const BIGNUM *a);
+# endif
+# ifdef HEADER_BIO_H
+int BN_print(BIO *fp, const BIGNUM *a);
+# else
+int BN_print(void *fp, const BIGNUM *a);
+# endif
+int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
+int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
+int BN_rshift1(BIGNUM *r, const BIGNUM *a);
+void BN_clear(BIGNUM *a);
+BIGNUM *BN_dup(const BIGNUM *a);
+int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
+int BN_set_bit(BIGNUM *a, int n);
+int BN_clear_bit(BIGNUM *a, int n);
+char *BN_bn2hex(const BIGNUM *a);
+char *BN_bn2dec(const BIGNUM *a);
+int BN_hex2bn(BIGNUM **a, const char *str);
+int BN_dec2bn(BIGNUM **a, const char *str);
+int BN_asc2bn(BIGNUM **a, const char *str);
+int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
+int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns
+                                                                  * -2 for
+                                                                  * error */
+BIGNUM *BN_mod_inverse(BIGNUM *ret,
+                       const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
+BIGNUM *BN_mod_sqrt(BIGNUM *ret,
+                    const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
+
+void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
+
+/* Deprecated versions */
+# ifndef OPENSSL_NO_DEPRECATED
+BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
+                          const BIGNUM *add, const BIGNUM *rem,
+                          void (*callback) (int, int, void *), void *cb_arg);
+int BN_is_prime(const BIGNUM *p, int nchecks,
+                void (*callback) (int, int, void *),
+                BN_CTX *ctx, void *cb_arg);
+int BN_is_prime_fasttest(const BIGNUM *p, int nchecks,
+                         void (*callback) (int, int, void *), BN_CTX *ctx,
+                         void *cb_arg, int do_trial_division);
+# endif                         /* !defined(OPENSSL_NO_DEPRECATED) */
+
+/* Newer versions */
+int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,
+                         const BIGNUM *rem, BN_GENCB *cb);
+int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb);
+int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx,
+                            int do_trial_division, BN_GENCB *cb);
+
+int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx);
+
+int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
+                            const BIGNUM *Xp, const BIGNUM *Xp1,
+                            const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx,
+                            BN_GENCB *cb);
+int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1,
+                              BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e,
+                              BN_CTX *ctx, BN_GENCB *cb);
+
+BN_MONT_CTX *BN_MONT_CTX_new(void);
+void BN_MONT_CTX_init(BN_MONT_CTX *ctx);
+int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                          BN_MONT_CTX *mont, BN_CTX *ctx);
+# define BN_to_montgomery(r,a,mont,ctx)  BN_mod_mul_montgomery(\
+        (r),(a),&((mont)->RR),(mont),(ctx))
+int BN_from_montgomery(BIGNUM *r, const BIGNUM *a,
+                       BN_MONT_CTX *mont, BN_CTX *ctx);
+void BN_MONT_CTX_free(BN_MONT_CTX *mont);
+int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx);
+BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from);
+BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
+                                    const BIGNUM *mod, BN_CTX *ctx);
+
+/* BN_BLINDING flags */
+# define BN_BLINDING_NO_UPDATE   0x00000001
+# define BN_BLINDING_NO_RECREATE 0x00000002
+
+BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
+void BN_BLINDING_free(BN_BLINDING *b);
+int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx);
+int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
+int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
+int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
+int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
+                          BN_CTX *);
+# ifndef OPENSSL_NO_DEPRECATED
+unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);
+void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
+# endif
+CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);
+unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
+void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
+BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
+                                      const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
+                                      int (*bn_mod_exp) (BIGNUM *r,
+                                                         const BIGNUM *a,
+                                                         const BIGNUM *p,
+                                                         const BIGNUM *m,
+                                                         BN_CTX *ctx,
+                                                         BN_MONT_CTX *m_ctx),
+                                      BN_MONT_CTX *m_ctx);
+
+# ifndef OPENSSL_NO_DEPRECATED
+void BN_set_params(int mul, int high, int low, int mont);
+int BN_get_params(int which);   /* 0, mul, 1 high, 2 low, 3 mont */
+# endif
+
+void BN_RECP_CTX_init(BN_RECP_CTX *recp);
+BN_RECP_CTX *BN_RECP_CTX_new(void);
+void BN_RECP_CTX_free(BN_RECP_CTX *recp);
+int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx);
+int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
+                          BN_RECP_CTX *recp, BN_CTX *ctx);
+int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+                    const BIGNUM *m, BN_CTX *ctx);
+int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
+                BN_RECP_CTX *recp, BN_CTX *ctx);
+
+# ifndef OPENSSL_NO_EC2M
+
+/*
+ * Functions for arithmetic over binary polynomials represented by BIGNUMs.
+ * The BIGNUM::neg property of BIGNUMs representing binary polynomials is
+ * ignored. Note that input arguments are not const so that their bit arrays
+ * can be expanded to the appropriate size if needed.
+ */
+
+/*
+ * r = a + b
+ */
+int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+#  define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)
+/*
+ * r=a mod p
+ */
+int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p);
+/* r = (a * b) mod p */
+int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                    const BIGNUM *p, BN_CTX *ctx);
+/* r = (a * a) mod p */
+int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+/* r = (1 / b) mod p */
+int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx);
+/* r = (a / b) mod p */
+int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                    const BIGNUM *p, BN_CTX *ctx);
+/* r = (a ^ b) mod p */
+int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                    const BIGNUM *p, BN_CTX *ctx);
+/* r = sqrt(a) mod p */
+int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+                     BN_CTX *ctx);
+/* r^2 + r = a mod p */
+int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+                           BN_CTX *ctx);
+#  define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))
+/*-
+ * Some functions allow for representation of the irreducible polynomials
+ * as an unsigned int[], say p.  The irreducible f(t) is then of the form:
+ *     t^p[0] + t^p[1] + ... + t^p[k]
+ * where m = p[0] > p[1] > ... > p[k] = 0.
+ */
+/* r = a mod p */
+int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);
+/* r = (a * b) mod p */
+int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                        const int p[], BN_CTX *ctx);
+/* r = (a * a) mod p */
+int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
+                        BN_CTX *ctx);
+/* r = (1 / b) mod p */
+int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[],
+                        BN_CTX *ctx);
+/* r = (a / b) mod p */
+int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                        const int p[], BN_CTX *ctx);
+/* r = (a ^ b) mod p */
+int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+                        const int p[], BN_CTX *ctx);
+/* r = sqrt(a) mod p */
+int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
+                         const int p[], BN_CTX *ctx);
+/* r^2 + r = a mod p */
+int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
+                               const int p[], BN_CTX *ctx);
+int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max);
+int BN_GF2m_arr2poly(const int p[], BIGNUM *a);
+
+# endif
+
+/*
+ * faster mod functions for the 'NIST primes' 0 <= a < p^2
+ */
+int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+
+const BIGNUM *BN_get0_nist_prime_192(void);
+const BIGNUM *BN_get0_nist_prime_224(void);
+const BIGNUM *BN_get0_nist_prime_256(void);
+const BIGNUM *BN_get0_nist_prime_384(void);
+const BIGNUM *BN_get0_nist_prime_521(void);
+
+/* library internal functions */
+
+# define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\
+        (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2))
+# define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))
+BIGNUM *bn_expand2(BIGNUM *a, int words);
+# ifndef OPENSSL_NO_DEPRECATED
+BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */
+# endif
+
+/*-
+ * Bignum consistency macros
+ * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from
+ * bignum data after direct manipulations on the data. There is also an
+ * "internal" macro, bn_check_top(), for verifying that there are no leading
+ * zeroes. Unfortunately, some auditing is required due to the fact that
+ * bn_fix_top() has become an overabused duct-tape because bignum data is
+ * occasionally passed around in an inconsistent state. So the following
+ * changes have been made to sort this out;
+ * - bn_fix_top()s implementation has been moved to bn_correct_top()
+ * - if BN_DEBUG isn't defined, bn_fix_top() maps to bn_correct_top(), and
+ *   bn_check_top() is as before.
+ * - if BN_DEBUG *is* defined;
+ *   - bn_check_top() tries to pollute unused words even if the bignum 'top' is
+ *     consistent. (ed: only if BN_DEBUG_RAND is defined)
+ *   - bn_fix_top() maps to bn_check_top() rather than "fixing" anything.
+ * The idea is to have debug builds flag up inconsistent bignums when they
+ * occur. If that occurs in a bn_fix_top(), we examine the code in question; if
+ * the use of bn_fix_top() was appropriate (ie. it follows directly after code
+ * that manipulates the bignum) it is converted to bn_correct_top(), and if it
+ * was not appropriate, we convert it permanently to bn_check_top() and track
+ * down the cause of the bug. Eventually, no internal code should be using the
+ * bn_fix_top() macro. External applications and libraries should try this with
+ * their own code too, both in terms of building against the openssl headers
+ * with BN_DEBUG defined *and* linking with a version of OpenSSL built with it
+ * defined. This not only improves external code, it provides more test
+ * coverage for openssl's own code.
+ */
+
+# ifdef BN_DEBUG
+
+/* We only need assert() when debugging */
+#  include <assert.h>
+
+#  ifdef BN_DEBUG_RAND
+/* To avoid "make update" cvs wars due to BN_DEBUG, use some tricks */
+#   ifndef RAND_pseudo_bytes
+int RAND_pseudo_bytes(unsigned char *buf, int num);
+#    define BN_DEBUG_TRIX
+#   endif
+#   define bn_pollute(a) \
+        do { \
+                const BIGNUM *_bnum1 = (a); \
+                if(_bnum1->top < _bnum1->dmax) { \
+                        unsigned char _tmp_char; \
+                        /* We cast away const without the compiler knowing, any \
+                         * *genuinely* constant variables that aren't mutable \
+                         * wouldn't be constructed with top!=dmax. */ \
+                        BN_ULONG *_not_const; \
+                        memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \
+                        /* Debug only - safe to ignore error return */ \
+                        RAND_pseudo_bytes(&_tmp_char, 1); \
+                        memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \
+                                (_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \
+                } \
+        } while(0)
+#   ifdef BN_DEBUG_TRIX
+#    undef RAND_pseudo_bytes
+#   endif
+#  else
+#   define bn_pollute(a)
+#  endif
+#  define bn_check_top(a) \
+        do { \
+                const BIGNUM *_bnum2 = (a); \
+                if (_bnum2 != NULL) { \
+                        assert((_bnum2->top == 0) || \
+                                (_bnum2->d[_bnum2->top - 1] != 0)); \
+                        bn_pollute(_bnum2); \
+                } \
+        } while(0)
+
+#  define bn_fix_top(a)           bn_check_top(a)
+
+#  define bn_check_size(bn, bits) bn_wcheck_size(bn, ((bits+BN_BITS2-1))/BN_BITS2)
+#  define bn_wcheck_size(bn, words) \
+        do { \
+                const BIGNUM *_bnum2 = (bn); \
+                assert((words) <= (_bnum2)->dmax && (words) >= (_bnum2)->top); \
+                /* avoid unused variable warning with NDEBUG */ \
+                (void)(_bnum2); \
+        } while(0)
+
+# else                          /* !BN_DEBUG */
+
+#  define bn_pollute(a)
+#  define bn_check_top(a)
+#  define bn_fix_top(a)           bn_correct_top(a)
+#  define bn_check_size(bn, bits)
+#  define bn_wcheck_size(bn, words)
+
+# endif
+
+# define bn_correct_top(a) \
+        { \
+        BN_ULONG *ftl; \
+        int tmp_top = (a)->top; \
+        if (tmp_top > 0) \
+                { \
+                for (ftl= &((a)->d[tmp_top-1]); tmp_top > 0; tmp_top--) \
+                        if (*(ftl--)) break; \
+                (a)->top = tmp_top; \
+                } \
+        bn_pollute(a); \
+        }
+
+BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num,
+                          BN_ULONG w);
+BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
+void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num);
+BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d);
+BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
+                      int num);
+BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
+                      int num);
+
+/* Primes from RFC 2409 */
+BIGNUM *get_rfc2409_prime_768(BIGNUM *bn);
+BIGNUM *get_rfc2409_prime_1024(BIGNUM *bn);
+
+/* Primes from RFC 3526 */
+BIGNUM *get_rfc3526_prime_1536(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_2048(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_3072(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_4096(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn);
+
+int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_BN_strings(void);
+
+/* Error codes for the BN functions. */
+
+/* Function codes. */
+# define BN_F_BNRAND                                      127
+# define BN_F_BN_BLINDING_CONVERT_EX                      100
+# define BN_F_BN_BLINDING_CREATE_PARAM                    128
+# define BN_F_BN_BLINDING_INVERT_EX                       101
+# define BN_F_BN_BLINDING_NEW                             102
+# define BN_F_BN_BLINDING_UPDATE                          103
+# define BN_F_BN_BN2DEC                                   104
+# define BN_F_BN_BN2HEX                                   105
+# define BN_F_BN_CTX_GET                                  116
+# define BN_F_BN_CTX_NEW                                  106
+# define BN_F_BN_CTX_START                                129
+# define BN_F_BN_DIV                                      107
+# define BN_F_BN_DIV_NO_BRANCH                            138
+# define BN_F_BN_DIV_RECP                                 130
+# define BN_F_BN_EXP                                      123
+# define BN_F_BN_EXPAND2                                  108
+# define BN_F_BN_EXPAND_INTERNAL                          120
+# define BN_F_BN_GF2M_MOD                                 131
+# define BN_F_BN_GF2M_MOD_EXP                             132
+# define BN_F_BN_GF2M_MOD_MUL                             133
+# define BN_F_BN_GF2M_MOD_SOLVE_QUAD                      134
+# define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR                  135
+# define BN_F_BN_GF2M_MOD_SQR                             136
+# define BN_F_BN_GF2M_MOD_SQRT                            137
+# define BN_F_BN_LSHIFT                                   145
+# define BN_F_BN_MOD_EXP2_MONT                            118
+# define BN_F_BN_MOD_EXP_MONT                             109
+# define BN_F_BN_MOD_EXP_MONT_CONSTTIME                   124
+# define BN_F_BN_MOD_EXP_MONT_WORD                        117
+# define BN_F_BN_MOD_EXP_RECP                             125
+# define BN_F_BN_MOD_EXP_SIMPLE                           126
+# define BN_F_BN_MOD_INVERSE                              110
+# define BN_F_BN_MOD_INVERSE_NO_BRANCH                    139
+# define BN_F_BN_MOD_LSHIFT_QUICK                         119
+# define BN_F_BN_MOD_MUL_RECIPROCAL                       111
+# define BN_F_BN_MOD_SQRT                                 121
+# define BN_F_BN_MPI2BN                                   112
+# define BN_F_BN_NEW                                      113
+# define BN_F_BN_RAND                                     114
+# define BN_F_BN_RAND_RANGE                               122
+# define BN_F_BN_RSHIFT                                   146
+# define BN_F_BN_USUB                                     115
+
+/* Reason codes. */
+# define BN_R_ARG2_LT_ARG3                                100
+# define BN_R_BAD_RECIPROCAL                              101
+# define BN_R_BIGNUM_TOO_LONG                             114
+# define BN_R_BITS_TOO_SMALL                              118
+# define BN_R_CALLED_WITH_EVEN_MODULUS                    102
+# define BN_R_DIV_BY_ZERO                                 103
+# define BN_R_ENCODING_ERROR                              104
+# define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA                105
+# define BN_R_INPUT_NOT_REDUCED                           110
+# define BN_R_INVALID_LENGTH                              106
+# define BN_R_INVALID_RANGE                               115
+# define BN_R_INVALID_SHIFT                               119
+# define BN_R_NOT_A_SQUARE                                111
+# define BN_R_NOT_INITIALIZED                             107
+# define BN_R_NO_INVERSE                                  108
+# define BN_R_NO_SOLUTION                                 116
+# define BN_R_P_IS_NOT_PRIME                              112
+# define BN_R_TOO_MANY_ITERATIONS                         113
+# define BN_R_TOO_MANY_TEMPORARY_VARIABLES                109
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/bn.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/pim_var.h
===================================================================
--- lab4/.minix-src/include/netinet/pim_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/pim_var.h	(revision 13)
@@ -0,0 +1,81 @@
+/*	$NetBSD: pim_var.h,v 1.2 2005/12/10 23:36:23 elad Exp $	*/
+
+/*
+ * Copyright (c) 1998-2000
+ * University of Southern California/Information Sciences Institute.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: /repoman/r/ncvs/src/sys/netinet/pim_var.h,v 1.1 2003/08/07 18:17:43 hsu Exp $
+ */
+
+#ifndef _NETINET_PIM_VAR_H_
+#define _NETINET_PIM_VAR_H_
+
+/*
+ * Protocol Independent Multicast (PIM),
+ * kernel variables and implementation-specific definitions.
+ *
+ * Written by George Edmond Eddy (Rusty), ISI, February 1998.
+ * Modified by Pavlin Radoslavov, USC/ISI, May 1998, Aug 1999, October 2000.
+ * Modified by Hitoshi Asaeda, WIDE, August 1998.
+ */
+
+/*
+ * PIM statistics kept in the kernel
+ */
+struct pimstat {
+	u_quad_t pims_rcv_total_msgs;	   /* total PIM messages received    */
+	u_quad_t pims_rcv_total_bytes;	   /* total PIM bytes received	     */
+	u_quad_t pims_rcv_tooshort;	   /* rcvd with too few bytes	     */
+	u_quad_t pims_rcv_badsum;	   /* rcvd with bad checksum	     */
+	u_quad_t pims_rcv_badversion;	   /* rcvd bad PIM version	     */
+	u_quad_t pims_rcv_registers_msgs;  /* rcvd regs. msgs (data only)    */
+	u_quad_t pims_rcv_registers_bytes; /* rcvd regs. bytes (data only)   */
+	u_quad_t pims_rcv_registers_wrongiif; /* rcvd regs. on wrong iif     */
+	u_quad_t pims_rcv_badregisters;	   /* rcvd invalid registers	     */
+	u_quad_t pims_snd_registers_msgs;  /* sent regs. msgs (data only)    */
+	u_quad_t pims_snd_registers_bytes; /* sent regs. bytes (data only)   */
+};
+
+/*
+ * Names for PIM sysctl objects
+ */
+#define PIMCTL_STATS		1	/* statistics (read-only) */
+#define PIMCTL_MAXID		2
+
+#define PIMCTL_NAMES {			\
+	{ 0, 0 },			\
+	{ "stats", CTLTYPE_STRUCT },	\
+}
+
+#ifdef _KERNEL
+extern struct pimstat pimstat;
+
+void	pim_input(struct mbuf *, ...);
+#endif
+
+#endif /* !_NETINET_PIM_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet/pim_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/tcp_seq.h
===================================================================
--- lab4/.minix-src/include/netinet/tcp_seq.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/tcp_seq.h	(revision 13)
@@ -0,0 +1,70 @@
+/*	$NetBSD: tcp_seq.h,v 1.17 2014/07/25 17:53:59 ryo Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993, 1995
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tcp_seq.h	8.3 (Berkeley) 6/21/95
+ */
+
+#ifndef _NETINET_TCP_SEQ_H_
+#define _NETINET_TCP_SEQ_H_
+
+/*
+ * TCP sequence numbers are 32 bit integers operated
+ * on with modular arithmetic.  These macros can be
+ * used to compare such integers.
+ */
+#define	SEQ_LT(a,b)	((int)((a)-(b)) < 0)
+#define	SEQ_LEQ(a,b)	((int)((a)-(b)) <= 0)
+#define	SEQ_GT(a,b)	((int)((a)-(b)) > 0)
+#define	SEQ_GEQ(a,b)	((int)((a)-(b)) >= 0)
+#define SEQ_MIN(a, b)	((SEQ_LT(a, b)) ? (a) : (b))
+#define SEQ_MAX(a, b)	((SEQ_GT(a, b)) ? (a) : (b))
+
+#define	SEQ_SUB(a,b)	((long)((a)-(b)))
+
+/*
+ * Macros to initialize tcp sequence numbers for
+ * send and receive from initial send and receive
+ * sequence numbers.
+ */
+#define	tcp_rcvseqinit(tp) \
+	(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
+
+#define	tcp_sendseqinit(tp) \
+	(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
+	    (tp)->snd_recover = (tp)->snd_high = (tp)->snd_fack = (tp)->iss
+
+#define TCP_ISS_RANDOM_MASK 0x00ffffff /* bits of randomness in a TCP ISS */
+#define TCP_ISSINCR         0x01000000 /* increment per time and per conn */
+
+#ifdef _KERNEL
+extern tcp_seq	 tcp_iss_seq;		/* tcp initial seq # */
+#endif
+
+#endif /* !_NETINET_TCP_SEQ_H_ */

Property changes on: lab4/.minix-src/include/netinet/tcp_seq.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/tcpip.h
===================================================================
--- lab4/.minix-src/include/netinet/tcpip.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/tcpip.h	(revision 13)
@@ -0,0 +1,60 @@
+/*	$NetBSD: tcpip.h,v 1.11 2007/12/25 18:33:47 perry Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tcpip.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCPIP_H_
+#define _NETINET_TCPIP_H_
+
+/*
+ * Tcp+ip header, after ip options removed.
+ */
+struct tcpiphdr {
+	struct 	ipovly ti_i;		/* overlaid ip structure */
+	struct	tcphdr ti_t;		/* tcp header */
+} __packed;
+#define	ti_x1		ti_i.ih_x1
+#define	ti_pr		ti_i.ih_pr
+#define	ti_len		ti_i.ih_len
+#define	ti_src		ti_i.ih_src
+#define	ti_dst		ti_i.ih_dst
+#define	ti_sport	ti_t.th_sport
+#define	ti_dport	ti_t.th_dport
+#define	ti_seq		ti_t.th_seq
+#define	ti_ack		ti_t.th_ack
+#define	ti_x2		ti_t.th_x2
+#define	ti_off		ti_t.th_off
+#define	ti_flags	ti_t.th_flags
+#define	ti_win		ti_t.th_win
+#define	ti_sum		ti_t.th_sum
+#define	ti_urp		ti_t.th_urp
+
+#endif /* !_NETINET_TCPIP_H_ */

Property changes on: lab4/.minix-src/include/netinet/tcpip.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet6/in6_pcb.h
===================================================================
--- lab4/.minix-src/include/netinet6/in6_pcb.h	(nonexistent)
+++ lab4/.minix-src/include/netinet6/in6_pcb.h	(revision 13)
@@ -0,0 +1,189 @@
+/*	$NetBSD: in6_pcb.h,v 1.46 2015/05/24 15:43:45 rtr Exp $	*/
+/*	$KAME: in6_pcb.h,v 1.45 2001/02/09 05:59:46 itojun Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)in_pcb.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET6_IN6_PCB_H_
+#define _NETINET6_IN6_PCB_H_
+
+#include <sys/queue.h>
+#include <netinet/in_pcb_hdr.h>
+#include <netinet/ip6.h>
+
+/*
+ * Common structure pcb for internet protocol implementation.
+ * Here are stored pointers to local and foreign host table
+ * entries, local and foreign socket numbers, and pointers
+ * up (to a socket structure) and down (to a protocol-specific)
+ * control block.
+ */
+struct icmp6_filter;
+
+struct	in6pcb {
+	struct inpcb_hdr in6p_head;
+#define in6p_hash	 in6p_head.inph_hash
+#define in6p_queue	 in6p_head.inph_queue
+#define in6p_af		 in6p_head.inph_af
+#define in6p_ppcb	 in6p_head.inph_ppcb
+#define in6p_state	 in6p_head.inph_state
+#define in6p_portalgo	 in6p_head.inph_portalgo
+#define in6p_socket	 in6p_head.inph_socket
+#define in6p_table	 in6p_head.inph_table
+#define in6p_sp		 in6p_head.inph_sp
+	struct	route in6p_route;	/* placeholder for routing entry */
+	u_int16_t in6p_fport;		/* foreign port */
+	u_int16_t in6p_lport;		/* local port */
+	u_int32_t in6p_flowinfo;	/* priority and flowlabel */
+	int	in6p_flags;		/* generic IP6/datagram flags */
+	int	in6p_hops;		/* default hop limit */
+	struct	ip6_hdr in6p_ip6;	/* header prototype */
+	struct	mbuf *in6p_options;   /* IP6 options */
+	struct	ip6_pktopts *in6p_outputopts; /* IP6 options for outgoing packets */
+	struct	ip6_moptions *in6p_moptions; /* IP6 multicast options */
+	struct icmp6_filter *in6p_icmp6filt;
+	int	in6p_cksum;		/* IPV6_CHECKSUM setsockopt */
+	bool    in6p_bindportonsend;
+	struct ip_moptions *in6p_v4moptions;/* IP4 multicast options */
+};
+
+#define in6p_faddr	in6p_ip6.ip6_dst
+#define in6p_laddr	in6p_ip6.ip6_src
+
+/* states in inp_state: */
+#define	IN6P_ATTACHED		INP_ATTACHED
+#define	IN6P_BOUND		INP_BOUND
+#define	IN6P_CONNECTED		INP_CONNECTED
+
+/*
+ * Flags in in6p_flags
+ * We define KAME's original flags in higher 16 bits as much as possible
+ * for compatibility with *bsd*s.
+ */
+#define IN6P_RECVOPTS		0x001000 /* receive incoming IP6 options */
+#define IN6P_RECVRETOPTS	0x002000 /* receive IP6 options for reply */
+#define IN6P_RECVDSTADDR	0x004000 /* receive IP6 dst address */
+#define IN6P_IPV6_V6ONLY	0x008000 /* restrict AF_INET6 socket for v6 */
+#define IN6P_PKTINFO		0x010000 /* receive IP6 dst and I/F */
+#define IN6P_HOPLIMIT		0x020000 /* receive hoplimit */
+#define IN6P_HOPOPTS		0x040000 /* receive hop-by-hop options */
+#define IN6P_DSTOPTS		0x080000 /* receive dst options after rthdr */
+#define IN6P_RTHDR		0x100000 /* receive routing header */
+#define IN6P_RTHDRDSTOPTS	0x200000 /* receive dstoptions before rthdr */
+#define IN6P_TCLASS		0x400000 /* traffic class */
+
+#define IN6P_HIGHPORT		0x1000000 /* user wants "high" port binding */
+#define IN6P_LOWPORT		0x2000000 /* user wants "low" port binding */
+#define IN6P_ANONPORT		0x4000000 /* port chosen for user */
+#define IN6P_FAITH		0x8000000 /* accept FAITH'ed connections */
+
+#define IN6P_RFC2292		0x40000000 /* RFC2292 */
+#define IN6P_MTU		0x80000000 /* use minimum MTU */
+
+#define IN6P_CONTROLOPTS	(IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\
+				 IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\
+				 IN6P_TCLASS|IN6P_RFC2292|\
+				 IN6P_MTU)
+
+#ifdef _KERNEL
+/* compute hash value for foreign and local in6_addr and port */
+#define IN6_HASH(faddr, fport, laddr, lport) 			\
+	(((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^	\
+	  (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3] ^	\
+	  (laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^	\
+	  (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3])	\
+	 + (fport) + (lport))
+
+#define sotoin6pcb(so)	((struct in6pcb *)(so)->so_pcb)
+
+void	in6_losing(struct in6pcb *);
+void	in6_pcbinit(struct inpcbtable *, int, int);
+int	in6_pcballoc(struct socket *, void *);
+int	in6_pcbbind(void *, struct sockaddr_in6 *, struct lwp *);
+int	in6_pcbconnect(void *, struct sockaddr_in6 *, struct lwp *);
+void	in6_pcbdetach(struct in6pcb *);
+void	in6_pcbdisconnect(struct in6pcb *);
+struct	in6pcb *in6_pcblookup_port(struct inpcbtable *, struct in6_addr *,
+				   u_int, int, struct vestigial_inpcb *);
+int	in6_pcbnotify(struct inpcbtable *, const struct sockaddr *,
+	u_int, const struct sockaddr *, u_int, int, void *,
+	void (*)(struct in6pcb *, int));
+void	in6_pcbpurgeif0(struct inpcbtable *, struct ifnet *);
+void	in6_pcbpurgeif(struct inpcbtable *, struct ifnet *);
+void	in6_pcbstate(struct in6pcb *, int);
+void	in6_rtchange(struct in6pcb *, int);
+void	in6_setpeeraddr(struct in6pcb *, struct sockaddr_in6 *);
+void	in6_setsockaddr(struct in6pcb *, struct sockaddr_in6 *);
+
+/* in in6_src.c */
+int	in6_selecthlim(struct in6pcb *, struct ifnet *);
+int	in6_selecthlim_rt(struct in6pcb *);
+int	in6_pcbsetport(struct sockaddr_in6 *, struct in6pcb *, struct lwp *);
+
+extern struct rtentry *
+	in6_pcbrtentry(struct in6pcb *);
+extern struct in6pcb *in6_pcblookup_connect(struct inpcbtable *,
+					    const struct in6_addr *, u_int, const struct in6_addr *, u_int, int,
+					    struct vestigial_inpcb *);
+extern struct in6pcb *in6_pcblookup_bind(struct inpcbtable *,
+	const struct in6_addr *, u_int, int);
+#endif /* _KERNEL */
+
+#endif /* !_NETINET6_IN6_PCB_H_ */

Property changes on: lab4/.minix-src/include/netinet6/in6_pcb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/udp_var.h
===================================================================
--- lab4/.minix-src/include/netinet/udp_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/udp_var.h	(revision 13)
@@ -0,0 +1,107 @@
+/*	$NetBSD: udp_var.h,v 1.40 2014/05/18 14:46:16 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)udp_var.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_UDP_VAR_H_
+#define _NETINET_UDP_VAR_H_
+
+/*
+ * UDP kernel structures and variables.
+ */
+struct	udpiphdr {
+	struct 	ipovly ui_i;		/* overlaid ip structure */
+	struct	udphdr ui_u;		/* udp header */
+} __packed;
+#define	ui_x1		ui_i.ih_x1
+#define	ui_pr		ui_i.ih_pr
+#define	ui_len		ui_i.ih_len
+#define	ui_src		ui_i.ih_src
+#define	ui_dst		ui_i.ih_dst
+#define	ui_sport	ui_u.uh_sport
+#define	ui_dport	ui_u.uh_dport
+#define	ui_ulen		ui_u.uh_ulen
+#define	ui_sum		ui_u.uh_sum
+
+/*
+ * UDP statistics.
+ * Each counter is an unsigned 64-bit value.
+ */
+#define	UDP_STAT_IPACKETS	0	/* total input packets */
+#define	UDP_STAT_HDROPS		1	/* packet shorter than header */
+#define	UDP_STAT_BADSUM		2	/* checksum error */
+#define	UDP_STAT_BADLEN		3	/* data length larger than packet */
+#define	UDP_STAT_NOPORT		4	/* no socket on port */
+#define	UDP_STAT_NOPORTBCAST	5	/* of above, arrived as broadcast */
+#define	UDP_STAT_FULLSOCK	6	/* not delivered, input socket full */
+#define	UDP_STAT_PCBHASHMISS	7	/* input packets missing PCB hash */
+#define	UDP_STAT_OPACKETS	8	/* total output packets */
+
+#define	UDP_NSTATS		9
+
+/*
+ * Names for UDP sysctl objects
+ */
+#define	UDPCTL_CHECKSUM		1	/* checksum UDP packets */
+#define	UDPCTL_SENDSPACE	2	/* default send buffer */
+#define	UDPCTL_RECVSPACE	3	/* default recv buffer */
+#define	UDPCTL_LOOPBACKCKSUM	4	/* do UDP checksum on loopback */
+#define	UDPCTL_STATS		5	/* UDP statistics */
+#define	UDPCTL_MAXID		7
+
+#define UDPCTL_NAMES { \
+	{ 0, 0 }, \
+	{ "checksum", CTLTYPE_INT }, \
+	{ "sendspace", CTLTYPE_INT }, \
+	{ "recvspace", CTLTYPE_INT }, \
+	{ "do_loopback_cksum", CTLTYPE_INT }, \
+	{ "stats", CTLTYPE_STRUCT }, \
+}
+
+#ifdef _KERNEL
+
+extern	struct	inpcbtable udbtable;
+extern const struct pr_usrreqs udp_usrreqs;
+
+void	 *udp_ctlinput(int, const struct sockaddr *, void *);
+int	 udp_ctloutput(int, struct socket *, struct sockopt *);
+void	 udp_init(void);
+void	 udp_init_common(void);
+void	 udp_input(struct mbuf *, ...);
+int	 udp_output(struct mbuf *, ...);
+int	 udp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
+
+int	udp_input_checksum(int af, struct mbuf *, const struct udphdr *, int,
+	    int);
+void	udp_statinc(u_int);
+#endif /* _KERNEL */
+
+#endif /* !_NETINET_UDP_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet/udp_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet6/ip6_mroute.h
===================================================================
--- lab4/.minix-src/include/netinet6/ip6_mroute.h	(nonexistent)
+++ lab4/.minix-src/include/netinet6/ip6_mroute.h	(revision 13)
@@ -0,0 +1,277 @@
+/*	$NetBSD: ip6_mroute.h,v 1.17 2009/03/18 17:06:52 cegger Exp $	*/
+/*	$KAME: ip6_mroute.h,v 1.17 2001/02/10 02:05:52 itojun Exp $	*/
+
+/*
+ * Copyright (C) 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*	BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp	*/
+
+/*
+ * Definitions for IP multicast forwarding.
+ *
+ * Written by David Waitzman, BBN Labs, August 1988.
+ * Modified by Steve Deering, Stanford, February 1989.
+ * Modified by Ajit Thyagarajan, PARC, August 1993.
+ * Modified by Ajit Thyagarajan, PARC, August 1994.
+ * Modified by Ahmed Helmy, USC, September 1996.
+ *
+ * MROUTING Revision: 1.2
+ */
+
+#ifndef _NETINET6_IP6_MROUTE_H_
+#define _NETINET6_IP6_MROUTE_H_
+
+/*
+ * Multicast Routing set/getsockopt commands.
+ */
+#ifdef _KERNEL
+#define MRT6_OINIT		100	/* initialize forwarder (omrt6msg) */
+#endif
+#define MRT6_DONE		101	/* shut down forwarder */
+#define MRT6_ADD_MIF		102	/* add multicast interface */
+#define MRT6_DEL_MIF		103	/* delete multicast interface */
+#define MRT6_ADD_MFC		104	/* insert forwarding cache entry */
+#define MRT6_DEL_MFC		105	/* delete forwarding cache entry */
+#define MRT6_PIM                107     /* enable pim code */
+#define MRT6_INIT		108	/* initialize forwarder (mrt6msg) */
+
+#if BSD >= 199103
+#define GET_TIME(t)	microtime(&t)
+#elif defined(sun)
+#define GET_TIME(t)	uniqtime(&t)
+#else
+#define GET_TIME(t)	((t) = time)
+#endif
+
+/*
+ * Types and macros for handling bitmaps with one bit per multicast interface.
+ */
+typedef u_short mifi_t;		/* type of a mif index */
+#define MAXMIFS		64
+
+#ifndef	IF_SETSIZE
+#define	IF_SETSIZE	256
+#endif
+
+typedef	u_int32_t	if_mask;
+#define	NIFBITS	(sizeof(if_mask) * NBBY)	/* bits per mask */
+
+#ifndef howmany
+#define	howmany(x, y)	(((x) + ((y) - 1)) / (y))
+#endif
+
+typedef	struct if_set {
+	if_mask	ifs_bits[howmany(IF_SETSIZE, NIFBITS)];
+} if_set;
+
+#define	IF_SET(n, p)	((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
+#define	IF_CLR(n, p)	((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
+#define	IF_ISSET(n, p)	((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
+#define	IF_COPY(f, t)	memcpy( t, f, sizeof(*(f)))
+#define	IF_ZERO(p)	memset(p, 0, sizeof(*(p)))
+
+/*
+ * Argument structure for MRT6_ADD_IF.
+ */
+struct mif6ctl {
+	mifi_t	    mif6c_mifi;	    	/* the index of the mif to be added  */
+	u_char	    mif6c_flags;     	/* MIFF_ flags defined below         */
+	u_short	    mif6c_pifi;		/* the index of the physical IF */
+#ifdef notyet
+	u_int	    mif6c_rate_limit;    /* max rate           		     */
+#endif
+};
+
+#define	MIFF_REGISTER	0x1	/* mif represents a register end-point */
+
+/*
+ * Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC
+ */
+struct mf6cctl {
+	struct sockaddr_in6 mf6cc_origin;	/* IPv6 origin of mcasts */
+	struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */
+	mifi_t		mf6cc_parent;	/* incoming ifindex */
+	struct if_set	mf6cc_ifset;	/* set of forwarding ifs */
+};
+
+/*
+ * The kernel's multicast routing statistics.
+ */
+struct mrt6stat {
+	u_quad_t mrt6s_mfc_lookups;	/* # forw. cache hash table hits   */
+	u_quad_t mrt6s_mfc_misses;	/* # forw. cache hash table misses */
+	u_quad_t mrt6s_upcalls;		/* # calls to mrouted              */
+	u_quad_t mrt6s_no_route;	/* no route for packet's origin    */
+	u_quad_t mrt6s_bad_tunnel;	/* malformed tunnel options        */
+	u_quad_t mrt6s_cant_tunnel;	/* no room for tunnel options      */
+	u_quad_t mrt6s_wrong_if;	/* arrived on wrong interface	   */
+	u_quad_t mrt6s_upq_ovflw;	/* upcall Q overflow		   */
+	u_quad_t mrt6s_cache_cleanups;	/* # entries with no upcalls 	   */
+	u_quad_t mrt6s_drop_sel;     	/* pkts dropped selectively        */
+	u_quad_t mrt6s_q_overflow;    	/* pkts dropped - Q overflow       */
+	u_quad_t mrt6s_pkt2large;     	/* pkts dropped - size > BKT SIZE  */
+	u_quad_t mrt6s_upq_sockfull;	/* upcalls dropped - socket full   */
+};
+
+#ifdef MRT6_OINIT
+/*
+ * Struct used to communicate from kernel to multicast router
+ * note the convenient similarity to an IPv6 header.
+ * XXX old version, superseded by mrt6msg.
+ */
+struct omrt6msg {
+	u_long	    unused1;
+	u_char	    im6_msgtype;		/* what type of message	    */
+#if 0
+#define MRT6MSG_NOCACHE	1
+#define MRT6MSG_WRONGMIF	2
+#define MRT6MSG_WHOLEPKT	3		/* used for user level encap*/
+#endif
+	u_char	    im6_mbz;			/* must be zero		    */
+	u_char	    im6_mif;			/* mif rec'd on		    */
+	u_char	    unused2;
+	struct in6_addr  im6_src, im6_dst;
+};
+#endif
+
+/*
+ * Structure used to communicate from kernel to multicast router.
+ * We'll overlay the structure onto an MLD header (not an IPv6 header
+ * like igmpmsg{} used for IPv4 implementation). This is because this
+ * structure will be passed via an IPv6 raw socket, on which an application
+ * will only receive the payload i.e. the data after the IPv6 header and all
+ * the extension headers. (see Section 3 of draft-ietf-ipngwg-2292bis-01)
+ */
+struct mrt6msg {
+#define MRT6MSG_NOCACHE		1
+#define MRT6MSG_WRONGMIF	2
+#define MRT6MSG_WHOLEPKT	3		/* used for user level encap*/
+	u_char	    im6_mbz;			/* must be zero		    */
+	u_char	    im6_msgtype;		/* what type of message	    */
+	u_int16_t   im6_mif;			/* mif rec'd on		    */
+	u_int32_t   im6_pad;			/* padding for 64bit arch   */
+	struct in6_addr  im6_src, im6_dst;
+};
+
+/*
+ * Argument structure used by multicast routing daemon to get src-grp
+ * packet counts
+ */
+struct sioc_sg_req6 {
+	struct sockaddr_in6 src;
+	struct sockaddr_in6 grp;
+	u_quad_t pktcnt;
+	u_quad_t bytecnt;
+	u_quad_t wrong_if;
+};
+
+/*
+ * Argument structure used by mrouted to get mif pkt counts
+ */
+struct sioc_mif_req6 {
+	mifi_t mifi;		/* mif number				*/
+	u_quad_t icount;	/* Input packet count on mif		*/
+	u_quad_t ocount;	/* Output packet count on mif		*/
+	u_quad_t ibytes;	/* Input byte count on mif		*/
+	u_quad_t obytes;	/* Output byte count on mif		*/
+};
+
+#ifdef _KERNEL
+/*
+ * The kernel's multicast-interface structure.
+ */
+struct mif6 {
+        u_char   	m6_flags;     	/* MIFF_ flags defined above         */
+	u_int      	m6_rate_limit; 	/* max rate			     */
+#ifdef notyet
+	struct tbf      *m6_tbf;      	/* token bucket structure at intf.   */
+#endif
+	struct in6_addr	m6_lcl_addr;   	/* local interface address           */
+	struct ifnet    *m6_ifp;     	/* pointer to interface              */
+	u_quad_t	m6_pkt_in;	/* # pkts in on interface            */
+	u_quad_t	m6_pkt_out;	/* # pkts out on interface           */
+	u_quad_t	m6_bytes_in;	/* # bytes in on interface	     */
+	u_quad_t	m6_bytes_out;	/* # bytes out on interface	     */
+#ifdef notyet
+	u_int		m6_rsvp_on;	/* RSVP listening on this vif */
+	struct socket   *m6_rsvpd;	/* RSVP daemon socket */
+#endif
+};
+
+/*
+ * The kernel's multicast forwarding cache entry structure
+ */
+struct mf6c {
+	struct sockaddr_in6  mf6c_origin;	/* IPv6 origin of mcasts     */
+	struct sockaddr_in6  mf6c_mcastgrp;	/* multicast group associated*/
+	mifi_t	    	 mf6c_parent; 		/* incoming IF               */
+	struct if_set	 mf6c_ifset;		/* set of outgoing IFs */
+
+	u_quad_t    	mf6c_pkt_cnt;		/* pkt count for src-grp     */
+	u_quad_t    	mf6c_byte_cnt;		/* byte count for src-grp    */
+	u_quad_t    	mf6c_wrong_if;		/* wrong if for src-grp	     */
+	int	    	mf6c_expire;		/* time to clean entry up    */
+	struct timeval  mf6c_last_assert;	/* last time I sent an assert*/
+	struct rtdetq  *mf6c_stall;		/* pkts waiting for route */
+	struct mf6c    *mf6c_next;		/* hash table linkage */
+};
+
+#define MF6C_INCOMPLETE_PARENT ((mifi_t)-1)
+
+/*
+ * Argument structure used for pkt info. while upcall is made
+ */
+#ifndef _NETINET_IP_MROUTE_H_
+struct rtdetq {		/* XXX: rtdetq is also defined in ip_mroute.h */
+    struct mbuf 	*m;		/* A copy of the packet	    	    */
+    struct ifnet	*ifp;		/* Interface pkt came in on 	    */
+#ifdef UPCALL_TIMING
+    struct timeval	t;		/* Timestamp */
+#endif /* UPCALL_TIMING */
+    struct rtdetq	*next;
+};
+#endif /* _NETINET_IP_MROUTE_H_ */
+
+#define MF6CTBLSIZ	256
+#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0	  /* from sys:route.h */
+#define MF6CHASHMOD(h)	((h) & (MF6CTBLSIZ - 1))
+#else
+#define MF6CHASHMOD(h)	((h) % MF6CTBLSIZ)
+#endif
+
+#define MAX_UPQ6	4		/* max. no of pkts in upcall Q */
+
+int	ip6_mrouter_set(struct socket *, struct sockopt *);
+int	ip6_mrouter_get(struct socket *, struct sockopt *);
+int	ip6_mrouter_done(void);
+void	ip6_mrouter_detach(struct ifnet *);
+int	mrt6_ioctl(u_long, void *);
+#endif /* _KERNEL */
+
+#endif /* !_NETINET6_IP6_MROUTE_H_ */

Property changes on: lab4/.minix-src/include/netinet6/ip6_mroute.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet6/raw_ip6.h
===================================================================
--- lab4/.minix-src/include/netinet6/raw_ip6.h	(nonexistent)
+++ lab4/.minix-src/include/netinet6/raw_ip6.h	(revision 13)
@@ -0,0 +1,64 @@
+/*	$NetBSD: raw_ip6.h,v 1.4 2008/04/15 05:13:37 thorpej Exp $	*/
+/*	$KAME: raw_ip6.h,v 1.2 2001/05/27 13:28:35 itojun Exp $	*/
+
+/*
+ * Copyright (C) 2001 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _NETINET6_RAW_IP6_H_
+#define _NETINET6_RAW_IP6_H_
+
+/*
+ * ICMPv6 stat is counted separately.  see netinet/icmp6.h
+ */
+#define	RIP6_STAT_IPACKETS	0	/* total input packets */
+#define	RIP6_STAT_ISUM		1	/* input checksum computations */
+#define	RIP6_STAT_BADSUM	2	/* of above, checksum error */
+#define	RIP6_STAT_NOSOCK	3	/* no matching socket */
+#define	RIP6_STAT_NOSOCKMCAST	4	/* of above, arrived as multicast */
+#define	RIP6_STAT_FULLSOCK	5	/* not delivered, input socket full */
+#define	RIP6_STAT_OPACKETS	6	/* total output packets */
+
+#define	RIP6_NSTATS		7
+
+/*
+ * Names for Raw IPv6 sysctl objects
+ */
+#define RAW6CTL_STATS	1
+#define RAW6CTL_MAXID	2
+
+#define RAW6CTL_NAMES { \
+	{ 0, 0 }, \
+	{ "stats", CTLTYPE_STRUCT }, \
+}
+
+#ifdef _KERNEL
+extern struct rip6stat rip6stat;
+#endif
+
+#endif /* !_NETINET6_RAW_IP6_H_ */

Property changes on: lab4/.minix-src/include/netinet6/raw_ip6.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/cmac.h
===================================================================
--- lab4/.minix-src/include/openssl/cmac.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/cmac.h	(revision 13)
@@ -0,0 +1,82 @@
+/* crypto/cmac/cmac.h */
+/*
+ * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
+ * project.
+ */
+/* ====================================================================
+ * Copyright (c) 2010 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ */
+
+#ifndef HEADER_CMAC_H
+# define HEADER_CMAC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+# include <openssl/evp.h>
+
+/* Opaque */
+typedef struct CMAC_CTX_st CMAC_CTX;
+
+CMAC_CTX *CMAC_CTX_new(void);
+void CMAC_CTX_cleanup(CMAC_CTX *ctx);
+void CMAC_CTX_free(CMAC_CTX *ctx);
+EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx);
+int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in);
+
+int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,
+              const EVP_CIPHER *cipher, ENGINE *impl);
+int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen);
+int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen);
+int CMAC_resume(CMAC_CTX *ctx);
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/cmac.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/conf_api.h
===================================================================
--- lab4/.minix-src/include/openssl/conf_api.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/conf_api.h	(revision 13)
@@ -0,0 +1,89 @@
+/* conf_api.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef  HEADER_CONF_API_H
+# define HEADER_CONF_API_H
+
+# include <openssl/lhash.h>
+# include <openssl/conf.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Up until OpenSSL 0.9.5a, this was new_section */
+CONF_VALUE *_CONF_new_section(CONF *conf, const char *section);
+/* Up until OpenSSL 0.9.5a, this was get_section */
+CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);
+/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
+STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
+                                               const char *section);
+
+int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);
+char *_CONF_get_string(const CONF *conf, const char *section,
+                       const char *name);
+long _CONF_get_number(const CONF *conf, const char *section,
+                      const char *name);
+
+int _CONF_new_data(CONF *conf);
+void _CONF_free_data(CONF *conf);
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/conf_api.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netpgp/verify.h
===================================================================
--- lab4/.minix-src/include/netpgp/verify.h	(nonexistent)
+++ lab4/.minix-src/include/netpgp/verify.h	(revision 13)
@@ -0,0 +1,298 @@
+/*-
+ * Copyright (c) 2012,2013,2014,2015 Alistair Crooks <agc@NetBSD.org>
+ * 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.
+ */
+#ifndef NETPGP_VERIFY_H_
+#define NETPGP_VERIFY_H_	20150205
+
+#define NETPGPVERIFY_VERSION	"netpgpverify portable 20150205"
+
+#include <sys/types.h>
+
+#include <inttypes.h>
+
+#ifndef PGPV_ARRAY
+/* creates 2 unsigned vars called "name"c and "name"size in current scope */
+/* also creates an array called "name"s in current scope */
+#define PGPV_ARRAY(type, name)						\
+	unsigned name##c; unsigned name##vsize; type *name##s
+#endif
+
+/* 64bit key ids */
+#define PGPV_KEYID_LEN		8
+#define PGPV_STR_KEYID_LEN	(PGPV_KEYID_LEN + PGPV_KEYID_LEN + 1)
+
+/* bignum structure */
+typedef struct pgpv_bignum_t {
+	void			*bn;	/* hide the implementation details */
+	uint16_t		 bits;	/* cached number of bits */
+} pgpv_bignum_t;
+
+/* right now, our max binary digest length is 20 bytes */
+#define PGPV_MAX_HASH_LEN	64
+
+/* fingerprint */
+typedef struct pgpv_fingerprint_t {
+	uint8_t			hashalg;	/* algorithm for digest */
+	uint8_t			v[PGPV_MAX_HASH_LEN];	/* the digest */
+	uint32_t		len;		/* its length */
+} pgpv_fingerprint_t;
+
+/* specify size for array of bignums */
+#define PGPV_MAX_PUBKEY_BN	4
+
+/* public key */
+typedef struct pgpv_pubkey_t {
+	pgpv_fingerprint_t	 fingerprint;	/* key fingerprint i.e. digest */
+	uint8_t			 keyid[PGPV_KEYID_LEN];	/* last 8 bytes of v4 keys */
+	int64_t		 	 birth;		/* creation time */
+	int64_t			 expiry;	/* expiry time */
+	pgpv_bignum_t		 bn[PGPV_MAX_PUBKEY_BN];	/* bignums */
+	uint8_t			 keyalg;	/* key algorithm */
+	uint8_t			 hashalg;	/* hash algorithm */
+	uint8_t			 version;	/* key version */
+} pgpv_pubkey_t;
+
+#define PGPV_MAX_SESSKEY_BN	2
+
+/* a (size, byte array) string */
+typedef struct pgpv_string_t {
+	size_t			 size;
+	uint8_t			*data;
+} pgpv_string_t;
+
+typedef struct pgpv_ref_t {
+	void			*vp;
+	size_t			 offset;
+	unsigned		 mem;
+} pgpv_ref_t;
+
+#define PGPV_MAX_SECKEY_BN	4
+
+typedef struct pgpv_compress_t {
+	pgpv_string_t		 s;
+	uint8_t			 compalg;
+} pgpv_compress_t;
+
+/* a packet dealing with trust */
+typedef struct pgpv_trust_t {
+	uint8_t			level;
+	uint8_t			amount;
+} pgpv_trust_t;
+
+/* a signature sub packet */
+typedef struct pgpv_sigsubpkt_t {
+	pgpv_string_t		 s;
+	uint8_t			 tag;
+	uint8_t			 critical;
+} pgpv_sigsubpkt_t;
+
+#define PGPV_MAX_SIG_BN		2
+
+typedef struct pgpv_signature_t {
+	uint8_t			*signer;		/* key id of signer */
+	pgpv_ref_t		 hashstart;
+	uint8_t			*hash2;
+	uint8_t			*mpi;
+	int64_t			 birth;
+	int64_t			 keyexpiry;
+	int64_t			 expiry;
+	uint32_t		 hashlen;
+	uint8_t			 version;
+	uint8_t			 type;
+	uint8_t			 keyalg;
+	uint8_t			 hashalg;
+	uint8_t			 trustlevel;
+	uint8_t			 trustamount;
+	pgpv_bignum_t		 bn[PGPV_MAX_SIG_BN];
+	char			*regexp;
+	char			*pref_key_server;
+	char			*policy;
+	char			*features;
+	char			*why_revoked;
+	uint8_t			*revoke_fingerprint;
+	uint8_t			 revoke_alg;
+	uint8_t			 revoke_sensitive;
+	uint8_t			 trustsig;
+	uint8_t			 revocable;
+	uint8_t			 pref_symm_alg;
+	uint8_t			 pref_hash_alg;
+	uint8_t			 pref_compress_alg;
+	uint8_t			 key_server_modify;
+	uint8_t			 notation;
+	uint8_t			 type_key;
+	uint8_t			 primary_userid;
+	uint8_t			 revoked;	/* subtract 1 to get real reason, 0 == not revoked */
+} pgpv_signature_t;
+
+/* a signature packet */
+typedef struct pgpv_sigpkt_t {
+	pgpv_signature_t	 sig;
+	uint16_t		 subslen;
+	uint16_t		 unhashlen;
+	PGPV_ARRAY(pgpv_sigsubpkt_t, subpkts);
+} pgpv_sigpkt_t;
+
+/* a one-pass signature packet */
+typedef struct pgpv_onepass_t {
+	uint8_t			 keyid[PGPV_KEYID_LEN];
+	uint8_t			 version;
+	uint8_t			 type;
+	uint8_t			 hashalg;
+	uint8_t			 keyalg;
+	uint8_t			 nested;
+} pgpv_onepass_t;
+
+/* a literal data packet */
+typedef struct pgpv_litdata_t {
+	uint8_t			*filename;
+	pgpv_string_t		 s;
+	uint32_t		 secs;
+	uint8_t			 namelen;
+	char			 format;
+	unsigned		 mem;
+	size_t			 offset;
+	size_t			 len;
+} pgpv_litdata_t;
+
+/* user attributes - images */
+typedef struct pgpv_userattr_t {
+	size_t 			 len;
+	PGPV_ARRAY(pgpv_string_t, subattrs);
+} pgpv_userattr_t;
+
+/* a general PGP packet */
+typedef struct pgpv_pkt_t {
+	uint8_t			 tag;
+	uint8_t			 newfmt;
+	uint8_t			 allocated;
+	uint8_t			 mement;
+	size_t			 offset;
+	pgpv_string_t		 s;
+	union {
+		pgpv_sigpkt_t	sigpkt;
+		pgpv_onepass_t	onepass;
+		pgpv_litdata_t	litdata;
+		pgpv_compress_t	compressed;
+		pgpv_trust_t	trust;
+		pgpv_pubkey_t	pubkey;
+		pgpv_string_t	userid;
+		pgpv_userattr_t	userattr;
+	} u;
+} pgpv_pkt_t;
+
+/* a memory structure */
+typedef struct pgpv_mem_t {
+	size_t			 size;
+	size_t			 cc;
+	uint8_t			*mem;
+	FILE			*fp;
+	uint8_t			 dealloc;
+	const char		*allowed;	/* the types of packet that are allowed */
+} pgpv_mem_t;
+
+/* packet parser */
+
+typedef struct pgpv_signed_userid_t {
+	pgpv_string_t	 	 userid;
+	PGPV_ARRAY(pgpv_signature_t, sigs);
+	uint8_t			 primary_userid;
+	uint8_t			 revoked;
+} pgpv_signed_userid_t;
+
+typedef struct pgpv_signed_userattr_t {
+	pgpv_userattr_t	 	 userattr;
+	PGPV_ARRAY(pgpv_signature_t, sigs);
+	uint8_t			 revoked;
+} pgpv_signed_userattr_t;
+
+typedef struct pgpv_signed_subkey_t {
+	pgpv_pubkey_t	 	 subkey;
+	pgpv_signature_t 	 revoc_self_sig;
+	PGPV_ARRAY(pgpv_signature_t, sigs);
+} pgpv_signed_subkey_t;
+
+typedef struct pgpv_primarykey_t {
+	pgpv_pubkey_t 		 primary;
+	pgpv_signature_t 	 revoc_self_sig;
+	PGPV_ARRAY(pgpv_signature_t, direct_sigs);
+	PGPV_ARRAY(pgpv_signed_userid_t, signed_userids);
+	PGPV_ARRAY(pgpv_signed_userattr_t, signed_userattrs);
+	PGPV_ARRAY(pgpv_signed_subkey_t, signed_subkeys);
+	size_t			 fmtsize;
+	uint8_t			 primary_userid;
+} pgpv_primarykey_t;
+
+/* everything stems from this structure */
+typedef struct pgpv_t {
+	PGPV_ARRAY(pgpv_pkt_t, 	 pkts);		/* packet array */
+	PGPV_ARRAY(pgpv_primarykey_t,	 primaries);	/* array of primary keys */
+	PGPV_ARRAY(pgpv_mem_t,	 areas);	/* areas we read packets from */
+	PGPV_ARRAY(size_t,	 datastarts);	/* starts of data packets */
+	size_t		 	 pkt;		/* when parsing, current pkt number */
+	const char		*op;		/* the operation we're doing */
+	unsigned		 ssh;		/* using ssh keys */
+} pgpv_t;
+
+#define PGPV_REASON_LEN		128
+
+/* when searching, we define a cursor, and fill in an array of subscripts */
+typedef struct pgpv_cursor_t {
+	pgpv_t			*pgp;			/* pointer to pgp tree */
+	char			*field;			/* field we're searching on */
+	char			*op;			/* operation we're doing */
+	char			*value;			/* value we're searching for */
+	void			*ptr;			/* for regexps etc */
+	PGPV_ARRAY(uint32_t,	 found);		/* array of matched pimary key subscripts */
+	PGPV_ARRAY(size_t,	 datacookies);		/* cookies to retrieve matched data */
+	int64_t			 sigtime;		/* time of signature */
+	char			 why[PGPV_REASON_LEN];	/* reason for bad signature */
+} pgpv_cursor_t;
+
+#ifndef __BEGIN_DECLS
+#  if defined(__cplusplus)
+#  define __BEGIN_DECLS           extern "C" {
+#  define __END_DECLS             }
+#  else
+#  define __BEGIN_DECLS
+#  define __END_DECLS
+#  endif
+#endif
+
+__BEGIN_DECLS
+
+int pgpv_read_pubring(pgpv_t */*pgp*/, const void */*keyringfile/mem*/, ssize_t /*size*/);
+int pgpv_read_ssh_pubkeys(pgpv_t */*pgp*/, const void */*keyring*/, ssize_t /*size*/);
+
+size_t pgpv_verify(pgpv_cursor_t */*cursor*/, pgpv_t */*pgp*/, const void */*mem/file*/, ssize_t /*size*/);
+size_t pgpv_get_verified(pgpv_cursor_t */*cursor*/, size_t /*cookie*/, char **/*ret*/);
+int pgpv_get_cursor_element(pgpv_cursor_t */*cursor*/, size_t /*element*/);
+size_t pgpv_dump(pgpv_t */*pgp*/, char **/*data*/);
+
+size_t pgpv_get_entry(pgpv_t */*pgp*/, unsigned /*ent*/, char **/*ret*/, const char */*modifiers*/);
+
+int pgpv_close(pgpv_t */*pgp*/);
+
+__END_DECLS
+
+#endif

Property changes on: lab4/.minix-src/include/netpgp/verify.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet6/nd6.h
===================================================================
--- lab4/.minix-src/include/netinet6/nd6.h	(nonexistent)
+++ lab4/.minix-src/include/netinet6/nd6.h	(revision 13)
@@ -0,0 +1,472 @@
+/*	$NetBSD: nd6.h,v 1.66 2015/07/17 02:21:08 ozaki-r Exp $	*/
+/*	$KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _NETINET6_ND6_H_
+#define _NETINET6_ND6_H_
+
+#include <sys/queue.h>
+#include <sys/callout.h>
+
+struct	llinfo_nd6 {
+	struct	llinfo_nd6 *ln_next;
+	struct	llinfo_nd6 *ln_prev;
+	struct	rtentry *ln_rt;
+	struct	mbuf *ln_hold;	/* last packet until resolved/timeout */
+	long	ln_asked;	/* number of queries already sent for this addr */
+	u_long	ln_expire;	/* lifetime for NDP state transition */
+	short	ln_state;	/* reachability state */
+	short	ln_router;	/* 2^0: ND6 router bit */
+	int	ln_byhint;	/* # of times we made it reachable by UL hint */
+
+	long	ln_ntick;
+	struct callout ln_timer_ch;
+};
+
+#define ND6_LLINFO_PURGE	-3
+#define ND6_LLINFO_NOSTATE	-2
+/*
+ * We don't need the WAITDELETE state any more, but we keep the definition
+ * in a comment line instead of removing it. This is necessary to avoid
+ * unintentionally reusing the value for another purpose, which might
+ * affect backward compatibility with old applications.
+ * (20000711 jinmei@kame.net)
+ */
+/* #define ND6_LLINFO_WAITDELETE	-1 */
+#define ND6_LLINFO_INCOMPLETE	0
+#define ND6_LLINFO_REACHABLE	1
+#define ND6_LLINFO_STALE	2
+#define ND6_LLINFO_DELAY	3
+#define ND6_LLINFO_PROBE	4
+
+#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE)
+#define ND6_LLINFO_PERMANENT(n)	(((n)->ln_expire == 0) && ((n)->ln_state > ND6_LLINFO_INCOMPLETE))
+
+struct nd_ifinfo {
+	u_int32_t linkmtu;		/* LinkMTU */
+	u_int32_t maxmtu;		/* Upper bound of LinkMTU */
+	u_int32_t basereachable;	/* BaseReachableTime */
+	u_int32_t reachable;		/* Reachable Time */
+	u_int32_t retrans;		/* Retrans Timer */
+	u_int32_t flags;		/* Flags */
+	int recalctm;			/* BaseReacable re-calculation timer */
+	u_int8_t chlim;			/* CurHopLimit */
+	u_int8_t initialized; /* Flag to see the entry is initialized */
+	/* the following 3 members are for privacy extension for addrconf */
+	u_int8_t randomseed0[8]; /* upper 64 bits of MD5 digest */
+	u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */
+	u_int8_t randomid[8];	/* current random ID */
+};
+
+#define ND6_IFF_PERFORMNUD	0x01
+#define ND6_IFF_ACCEPT_RTADV	0x02	/* See "RTADV Key", below. */
+#define ND6_IFF_PREFER_SOURCE	0x04	/* XXX: not related to ND. */
+#define ND6_IFF_IFDISABLED	0x08	/* IPv6 operation is disabled due to
+					 * DAD failure.  (XXX: not ND-specific)
+					 */
+#define	ND6_IFF_OVERRIDE_RTADV	0x10	/* See "RTADV Key", below. */
+#define	ND6_IFF_AUTO_LINKLOCAL	0x20
+
+/*
+ * RTADV Key
+ *
+ * The flags ND6_IFF_ACCEPT_RTADV and ND6_IFF_OVERRIDE_RTADV form a
+ * tri-state variable.  (There are actually four different states, but
+ * two of the states are functionally identical.)
+ *
+ * ND6_IFF_OVERRIDE_RTADV or 0:	This interface does not accept
+ *				Router Advertisements.
+ *
+ * ND6_IFF_OVERRIDE_RTADV|
+ * ND6_IFF_ACCEPT_RTADV:	This interface accepts Router
+ *				Advertisements regardless of the
+ *				global setting, ip6_accept_rtadv.
+ *
+ * ND6_IFF_ACCEPT_RTADV:	This interface follows the global setting,
+ *				ip6_accept_rtadv.  If ip6_accept_rtadv == 0,
+ *				this interface does not accept Router
+ *				Advertisements.  If ip6_accept_rtadv != 0,
+ *				this interface does accept them.
+ */
+
+#ifdef _KERNEL
+#define ND_IFINFO(ifp) \
+	(((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo)
+#define IN6_LINKMTU(ifp) \
+	((ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) \
+	    ? ND_IFINFO(ifp)->linkmtu \
+	    : ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) \
+		? ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu))
+#endif
+
+struct in6_nbrinfo {
+	char ifname[IFNAMSIZ];	/* if name, e.g. "en0" */
+	struct in6_addr addr;	/* IPv6 address of the neighbor */
+	long	asked;		/* number of queries already sent for this addr */
+	int	isrouter;	/* if it acts as a router */
+	int	state;		/* reachability state */
+	int	expire;		/* lifetime for NDP state transition */
+};
+
+#define DRLSTSIZ 10
+#define PRLSTSIZ 10
+struct	in6_drlist {
+	char ifname[IFNAMSIZ];
+	struct {
+		struct	in6_addr rtaddr;
+		u_char	flags;
+		u_short	rtlifetime;
+		u_long	expire;
+		u_short if_index;
+	} defrouter[DRLSTSIZ];
+};
+
+struct	in6_defrouter {
+	struct	sockaddr_in6 rtaddr;
+	u_char	flags;
+	u_short	rtlifetime;
+	u_long	expire;
+	u_short if_index;
+};
+
+#ifdef _KERNEL
+struct	in6_oprlist {
+	char ifname[IFNAMSIZ];
+	struct {
+		struct	in6_addr prefix;
+		struct prf_ra raflags;
+		u_char	prefixlen;
+		u_char	origin;
+		u_long vltime;
+		u_long pltime;
+		u_long expire;
+		u_short if_index;
+		u_short advrtrs; /* number of advertisement routers */
+		struct	in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
+	} prefix[PRLSTSIZ];
+};
+#endif
+
+struct	in6_prlist {
+	char ifname[IFNAMSIZ];
+	struct {
+		struct	in6_addr prefix;
+		struct prf_ra raflags;
+		u_char	prefixlen;
+		u_char	origin;
+		u_int32_t vltime;
+		u_int32_t pltime;
+		time_t expire;
+		u_short if_index;
+		u_short advrtrs; /* number of advertisement routers */
+		struct	in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
+	} prefix[PRLSTSIZ];
+};
+
+struct in6_prefix {
+	struct	sockaddr_in6 prefix;
+	struct prf_ra raflags;
+	u_char	prefixlen;
+	u_char	origin;
+	u_int32_t vltime;
+	u_int32_t pltime;
+	time_t expire;
+	u_int32_t flags;
+	int refcnt;
+	u_short if_index;
+	u_short advrtrs; /* number of advertisement routers */
+	/* struct sockaddr_in6 advrtr[] */
+};
+
+#ifdef _KERNEL
+struct	in6_ondireq {
+	char ifname[IFNAMSIZ];
+	struct {
+		u_int32_t linkmtu;	/* LinkMTU */
+		u_int32_t maxmtu;	/* Upper bound of LinkMTU */
+		u_int32_t basereachable; /* BaseReachableTime */
+		u_int32_t reachable;	/* Reachable Time */
+		u_int32_t retrans;	/* Retrans Timer */
+		u_int32_t flags;	/* Flags */
+		int recalctm;		/* BaseReacable re-calculation timer */
+		u_int8_t chlim;		/* CurHopLimit */
+		u_int8_t receivedra;
+	} ndi;
+};
+#endif
+
+struct	in6_ndireq {
+	char ifname[IFNAMSIZ];
+	struct nd_ifinfo ndi;
+};
+
+struct	in6_ndifreq {
+	char ifname[IFNAMSIZ];
+	u_long ifindex;
+};
+
+/* Prefix status */
+#define NDPRF_ONLINK		0x1
+#define NDPRF_DETACHED		0x2
+#define NDPRF_HOME		0x4
+
+/* protocol constants */
+#define MAX_RTR_SOLICITATION_DELAY	1	/* 1sec */
+#define RTR_SOLICITATION_INTERVAL	4	/* 4sec */
+#define MAX_RTR_SOLICITATIONS		3
+
+#define ND6_INFINITE_LIFETIME		((u_int32_t)~0)
+
+#ifdef _KERNEL
+/* node constants */
+#define MAX_REACHABLE_TIME		3600000	/* msec */
+#define REACHABLE_TIME			30000	/* msec */
+#define RETRANS_TIMER			1000	/* msec */
+#define MIN_RANDOM_FACTOR		512	/* 1024 * 0.5 */
+#define MAX_RANDOM_FACTOR		1536	/* 1024 * 1.5 */
+#define DEF_TEMP_VALID_LIFETIME		604800	/* 1 week */
+#define DEF_TEMP_PREFERRED_LIFETIME	86400	/* 1 day */
+#define TEMPADDR_REGEN_ADVANCE		5	/* sec */
+#define MAX_TEMP_DESYNC_FACTOR		600	/* 10 min */
+#define ND_COMPUTE_RTIME(x) \
+		(((MIN_RANDOM_FACTOR * (x >> 10)) + (cprng_fast32() & \
+		((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
+
+TAILQ_HEAD(nd_drhead, nd_defrouter);
+struct	nd_defrouter {
+	TAILQ_ENTRY(nd_defrouter) dr_entry;
+	struct	in6_addr rtaddr;
+	u_char	flags;		/* flags on RA message */
+	u_short	rtlifetime;
+	u_long	expire;
+	struct  ifnet *ifp;
+	int	installed;	/* is installed into kernel routing table */
+};
+
+struct nd_prefixctl {
+	struct ifnet *ndprc_ifp;
+
+	/* prefix */
+	struct sockaddr_in6 ndprc_prefix;
+	u_char	ndprc_plen;
+
+	u_int32_t ndprc_vltime;	/* advertised valid lifetime */
+	u_int32_t ndprc_pltime;	/* advertised preferred lifetime */
+
+	struct prf_ra ndprc_flags;
+};
+
+#define ndprc_raf		ndprc_flags
+#define ndprc_raf_onlink	ndprc_flags.onlink
+#define ndprc_raf_auto		ndprc_flags.autonomous
+#define ndprc_raf_router	ndprc_flags.router
+
+struct nd_prefix {
+	struct ifnet *ndpr_ifp;
+	LIST_ENTRY(nd_prefix) ndpr_entry;
+	struct sockaddr_in6 ndpr_prefix;	/* prefix */
+	struct in6_addr ndpr_mask; /* netmask derived from the prefix */
+
+	u_int32_t ndpr_vltime;	/* advertised valid lifetime */
+	u_int32_t ndpr_pltime;	/* advertised preferred lifetime */
+
+	time_t ndpr_expire;	/* expiration time of the prefix */
+	time_t ndpr_preferred;	/* preferred time of the prefix */
+	time_t ndpr_lastupdate; /* reception time of last advertisement */
+
+	struct prf_ra ndpr_flags;
+	u_int32_t ndpr_stateflags; /* actual state flags */
+	/* list of routers that advertise the prefix: */
+	LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
+	u_char	ndpr_plen;
+	int	ndpr_refcnt;	/* reference couter from addresses */
+};
+
+#define ndpr_next		ndpr_entry.le_next
+
+#define ndpr_raf		ndpr_flags
+#define ndpr_raf_onlink		ndpr_flags.onlink
+#define ndpr_raf_auto		ndpr_flags.autonomous
+#define ndpr_raf_router		ndpr_flags.router
+
+/*
+ * Message format for use in obtaining information about prefixes
+ * from inet6 sysctl function
+ */
+struct inet6_ndpr_msghdr {
+	u_short	inpm_msglen;	/* to skip over non-understood messages */
+	u_char	inpm_version;	/* future binary compatibility */
+	u_char	inpm_type;	/* message type */
+	struct in6_addr inpm_prefix;
+	u_long	prm_vltim;
+	u_long	prm_pltime;
+	u_long	prm_expire;
+	u_long	prm_preferred;
+	struct in6_prflags prm_flags;
+	u_short	prm_index;	/* index for associated ifp */
+	u_char	prm_plen;	/* length of prefix in bits */
+};
+
+#define prm_raf_onlink		prm_flags.prf_ra.onlink
+#define prm_raf_auto		prm_flags.prf_ra.autonomous
+
+#define prm_statef_onlink	prm_flags.prf_state.onlink
+
+#define prm_rrf_decrvalid	prm_flags.prf_rr.decrvalid
+#define prm_rrf_decrprefd	prm_flags.prf_rr.decrprefd
+
+struct nd_pfxrouter {
+	LIST_ENTRY(nd_pfxrouter) pfr_entry;
+	struct nd_defrouter *router;
+};
+
+LIST_HEAD(nd_prhead, nd_prefix);
+
+#include <sys/mallocvar.h>
+MALLOC_DECLARE(M_IP6NDP);
+
+/* nd6.c */
+extern int nd6_prune;
+extern int nd6_delay;
+extern int nd6_umaxtries;
+extern int nd6_mmaxtries;
+extern int nd6_useloopback;
+extern int nd6_maxnudhint;
+extern int nd6_gctimer;
+extern struct llinfo_nd6 llinfo_nd6;
+extern struct nd_drhead nd_defrouter;
+extern struct nd_prhead nd_prefix;
+extern int nd6_debug;
+
+#define nd6log(x)	do { if (nd6_debug) log x; } while (/*CONSTCOND*/ 0)
+
+extern struct callout nd6_timer_ch;
+
+/* nd6_rtr.c */
+extern int nd6_defifindex;
+extern int ip6_desync_factor;	/* seconds */
+extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */
+extern u_int32_t ip6_temp_valid_lifetime; /* seconds */
+extern int ip6_temp_regen_advance; /* seconds */
+extern int nd6_numroutes;
+
+union nd_opts {
+	struct nd_opt_hdr *nd_opt_array[8];
+	struct {
+		struct nd_opt_hdr *zero;
+		struct nd_opt_hdr *src_lladdr;
+		struct nd_opt_hdr *tgt_lladdr;
+		struct nd_opt_prefix_info *pi_beg; /* multiple opts, start */
+		struct nd_opt_rd_hdr *rh;
+		struct nd_opt_mtu *mtu;
+		struct nd_opt_hdr *search;	/* multiple opts */
+		struct nd_opt_hdr *last;	/* multiple opts */
+		int done;
+		struct nd_opt_prefix_info *pi_end;/* multiple opts, end */
+	} nd_opt_each;
+};
+#define nd_opts_src_lladdr	nd_opt_each.src_lladdr
+#define nd_opts_tgt_lladdr	nd_opt_each.tgt_lladdr
+#define nd_opts_pi		nd_opt_each.pi_beg
+#define nd_opts_pi_end		nd_opt_each.pi_end
+#define nd_opts_rh		nd_opt_each.rh
+#define nd_opts_mtu		nd_opt_each.mtu
+#define nd_opts_search		nd_opt_each.search
+#define nd_opts_last		nd_opt_each.last
+#define nd_opts_done		nd_opt_each.done
+
+/* XXX: need nd6_var.h?? */
+/* nd6.c */
+void nd6_init(void);
+struct nd_ifinfo *nd6_ifattach(struct ifnet *);
+void nd6_ifdetach(struct ifnet *, struct in6_ifextra *);
+int nd6_is_addr_neighbor(const struct sockaddr_in6 *, struct ifnet *);
+void nd6_option_init(void *, int, union nd_opts *);
+struct nd_opt_hdr *nd6_option(union nd_opts *);
+int nd6_options(union nd_opts *);
+struct	rtentry *nd6_lookup(const struct in6_addr *, int, struct ifnet *);
+void nd6_setmtu(struct ifnet *);
+void nd6_llinfo_settimer(struct llinfo_nd6 *, long);
+void nd6_timer(void *);
+void nd6_purge(struct ifnet *, struct in6_ifextra *);
+void nd6_nud_hint(struct rtentry *);
+int nd6_resolve(struct ifnet *, struct rtentry *,
+	struct mbuf *, struct sockaddr *, u_char *);
+void nd6_rtrequest(int, struct rtentry *, const struct rt_addrinfo *);
+int nd6_ioctl(u_long, void *, struct ifnet *);
+void nd6_cache_lladdr(struct ifnet *, struct in6_addr *,
+	char *, int, int, int);
+int nd6_output(struct ifnet *, struct ifnet *, struct mbuf *,
+	const struct sockaddr_in6 *, struct rtentry *);
+int nd6_storelladdr(const struct ifnet *, const struct rtentry *, struct mbuf *,
+	const struct sockaddr *, uint8_t *, size_t);
+int nd6_sysctl(int, void *, size_t *, void *, size_t);
+int nd6_need_cache(struct ifnet *);
+void nd6_llinfo_release_pkts(struct llinfo_nd6 *, struct ifnet *,
+    struct rtentry *);
+
+/* nd6_nbr.c */
+void nd6_na_input(struct mbuf *, int, int);
+void nd6_na_output(struct ifnet *, const struct in6_addr *,
+	const struct in6_addr *, u_long, int, const struct sockaddr *);
+void nd6_ns_input(struct mbuf *, int, int);
+void nd6_ns_output(struct ifnet *, const struct in6_addr *,
+	const struct in6_addr *, struct llinfo_nd6 *, int);
+const void *nd6_ifptomac(const struct ifnet *);
+void nd6_dad_start(struct ifaddr *, int);
+void nd6_dad_stop(struct ifaddr *);
+void nd6_dad_duplicated(struct ifaddr *);
+
+/* nd6_rtr.c */
+void nd6_rs_input(struct mbuf *, int, int);
+void nd6_ra_input(struct mbuf *, int, int);
+void prelist_del(struct nd_prefix *);
+void defrouter_addreq(struct nd_defrouter *);
+void defrouter_reset(void);
+void defrouter_select(void);
+void defrtrlist_del(struct nd_defrouter *, struct in6_ifextra *);
+void prelist_remove(struct nd_prefix *);
+int nd6_prelist_add(struct nd_prefixctl *, struct nd_defrouter *,
+	struct nd_prefix **);
+int nd6_prefix_onlink(struct nd_prefix *);
+int nd6_prefix_offlink(struct nd_prefix *);
+void pfxlist_onlink_check(void);
+struct nd_defrouter *defrouter_lookup(const struct in6_addr *, struct ifnet *);
+struct nd_prefix *nd6_prefix_lookup(struct nd_prefixctl *);
+int in6_ifdel(struct ifnet *, struct in6_addr *);
+void rt6_flush(struct in6_addr *, struct ifnet *);
+int nd6_setdefaultiface(int);
+int in6_tmpifadd(const struct in6_ifaddr *, int, int);
+bool nd6_accepts_rtadv(const struct nd_ifinfo *);
+
+#endif /* _KERNEL */
+
+#endif /* !_NETINET6_ND6_H_ */

Property changes on: lab4/.minix-src/include/netinet6/nd6.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet6/udp6_var.h
===================================================================
--- lab4/.minix-src/include/netinet6/udp6_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet6/udp6_var.h	(revision 13)
@@ -0,0 +1,121 @@
+/*	$NetBSD: udp6_var.h,v 1.28 2015/05/02 17:18:03 rtr Exp $	*/
+/*	$KAME: udp6_var.h,v 1.11 2000/06/05 00:14:31 itojun Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)udp_var.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET6_UDP6_VAR_H_
+#define _NETINET6_UDP6_VAR_H_
+
+/*
+ * UDP Kernel structures and variables.
+ */
+
+#define	UDP6_STAT_IPACKETS	0	/* total input packets */
+#define	UDP6_STAT_HDROPS	1	/* packet shorter than header */
+#define	UDP6_STAT_BADSUM	2	/* checksum error */
+#define	UDP6_STAT_NOSUM		3	/* no checksum */
+#define	UDP6_STAT_BADLEN	4	/* data length larger than packet */
+#define	UDP6_STAT_NOPORT	5	/* no socket on port */
+#define	UDP6_STAT_NOPORTMCAST	6	/* of above, arrived as multicast */
+#define	UDP6_STAT_FULLSOCK	7	/* not delivered, input socket full */
+#define	UDP6_STAT_PCBCACHEMISS	8	/* input packets missing pcb cache */
+#define	UDP6_STAT_OPACKETS	9	/* total output packets */
+
+#define	UDP6_NSTATS		10
+
+/*
+ * Names for UDP6 sysctl objects
+ */
+#define	UDP6CTL_SENDSPACE	1	/* default send buffer */
+#define	UDP6CTL_RECVSPACE	2	/* default recv buffer */
+#define	UDP6CTL_LOOPBACKCKSUM	3	/* do UDP checksum on loopback? */
+#define	UDP6CTL_STATS		4	/* udp6 statistics */
+#define	UDP6CTL_MAXID		5
+
+#define UDP6CTL_NAMES { \
+	{ 0, 0 }, \
+	{ "sendspace", CTLTYPE_INT }, \
+	{ "recvspace", CTLTYPE_INT }, \
+	{ "do_loopback_cksum", CTLTYPE_INT }, \
+	{ "stats", CTLTYPE_STRUCT }, \
+}
+
+#ifdef _KERNEL
+
+extern const struct pr_usrreqs udp6_usrreqs;
+
+void	*udp6_ctlinput(int, const struct sockaddr *, void *);
+int	udp6_ctloutput(int, struct socket *, struct sockopt *);
+void	udp6_init(void);
+int	udp6_input(struct mbuf **, int *, int);
+int	udp6_output(struct in6pcb *, struct mbuf *, struct sockaddr_in6 *,
+    struct mbuf *, struct lwp *);
+int	udp6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
+int	udp6_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
+    struct mbuf *, struct lwp *);
+int	udp6_realinput(int, struct sockaddr_in6 *, struct sockaddr_in6 *,
+    struct mbuf *, int);
+int	udp6_input_checksum(struct mbuf *, const struct udphdr *, int, int);
+
+void	udp6_statinc(u_int);
+#endif /* _KERNEL */
+
+#endif /* !_NETINET6_UDP6_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet6/udp6_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/dsa.h
===================================================================
--- lab4/.minix-src/include/openssl/dsa.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/dsa.h	(revision 13)
@@ -0,0 +1,329 @@
+/* crypto/dsa/dsa.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+/*
+ * The DSS routines are based on patches supplied by
+ * Steven Schoch <schoch@sheba.arc.nasa.gov>.  He basically did the
+ * work and I have just tweaked them a little to fit into my
+ * stylistic vision for SSLeay :-) */
+
+#ifndef HEADER_DSA_H
+# define HEADER_DSA_H
+
+# include <openssl/e_os2.h>
+
+# ifdef OPENSSL_NO_DSA
+#  error DSA is disabled.
+# endif
+
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+# include <openssl/crypto.h>
+# include <openssl/ossl_typ.h>
+
+# ifndef OPENSSL_NO_DEPRECATED
+#  include <openssl/bn.h>
+#  ifndef OPENSSL_NO_DH
+#   include <openssl/dh.h>
+#  endif
+# endif
+
+# ifndef OPENSSL_DSA_MAX_MODULUS_BITS
+#  define OPENSSL_DSA_MAX_MODULUS_BITS   10000
+# endif
+
+# define DSA_FLAG_CACHE_MONT_P   0x01
+/*
+ * new with 0.9.7h; the built-in DSA implementation now uses constant time
+ * modular exponentiation for secret exponents by default. This flag causes
+ * the faster variable sliding window method to be used for all exponents.
+ */
+# define DSA_FLAG_NO_EXP_CONSTTIME       0x02
+
+/*
+ * If this flag is set the DSA method is FIPS compliant and can be used in
+ * FIPS mode. This is set in the validated module method. If an application
+ * sets this flag in its own methods it is its reposibility to ensure the
+ * result is compliant.
+ */
+
+# define DSA_FLAG_FIPS_METHOD                    0x0400
+
+/*
+ * If this flag is set the operations normally disabled in FIPS mode are
+ * permitted it is then the applications responsibility to ensure that the
+ * usage is compliant.
+ */
+
+# define DSA_FLAG_NON_FIPS_ALLOW                 0x0400
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Already defined in ossl_typ.h */
+/* typedef struct dsa_st DSA; */
+/* typedef struct dsa_method DSA_METHOD; */
+
+typedef struct DSA_SIG_st {
+    BIGNUM *r;
+    BIGNUM *s;
+} DSA_SIG;
+
+struct dsa_method {
+    const char *name;
+    DSA_SIG *(*dsa_do_sign) (const unsigned char *dgst, int dlen, DSA *dsa);
+    int (*dsa_sign_setup) (DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
+                           BIGNUM **rp);
+    int (*dsa_do_verify) (const unsigned char *dgst, int dgst_len,
+                          DSA_SIG *sig, DSA *dsa);
+    int (*dsa_mod_exp) (DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
+                        BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
+                        BN_MONT_CTX *in_mont);
+    /* Can be null */
+    int (*bn_mod_exp) (DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
+                       const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+    int (*init) (DSA *dsa);
+    int (*finish) (DSA *dsa);
+    int flags;
+    char *app_data;
+    /* If this is non-NULL, it is used to generate DSA parameters */
+    int (*dsa_paramgen) (DSA *dsa, int bits,
+                         const unsigned char *seed, int seed_len,
+                         int *counter_ret, unsigned long *h_ret,
+                         BN_GENCB *cb);
+    /* If this is non-NULL, it is used to generate DSA keys */
+    int (*dsa_keygen) (DSA *dsa);
+};
+
+struct dsa_st {
+    /*
+     * This first variable is used to pick up errors where a DSA is passed
+     * instead of of a EVP_PKEY
+     */
+    int pad;
+    long version;
+    int write_params;
+    BIGNUM *p;
+    BIGNUM *q;                  /* == 20 */
+    BIGNUM *g;
+    BIGNUM *pub_key;            /* y public key */
+    BIGNUM *priv_key;           /* x private key */
+    BIGNUM *kinv;               /* Signing pre-calc */
+    BIGNUM *r;                  /* Signing pre-calc */
+    int flags;
+    /* Normally used to cache montgomery values */
+    BN_MONT_CTX *method_mont_p;
+    int references;
+    CRYPTO_EX_DATA ex_data;
+    const DSA_METHOD *meth;
+    /* functional reference if 'meth' is ENGINE-provided */
+    ENGINE *engine;
+};
+
+# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
+                (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
+# define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \
+                (unsigned char *)(x))
+# define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x)
+# define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x)
+
+DSA *DSAparams_dup(DSA *x);
+DSA_SIG *DSA_SIG_new(void);
+void DSA_SIG_free(DSA_SIG *a);
+int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
+DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);
+
+DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
+int DSA_do_verify(const unsigned char *dgst, int dgst_len,
+                  DSA_SIG *sig, DSA *dsa);
+
+const DSA_METHOD *DSA_OpenSSL(void);
+
+void DSA_set_default_method(const DSA_METHOD *);
+const DSA_METHOD *DSA_get_default_method(void);
+int DSA_set_method(DSA *dsa, const DSA_METHOD *);
+
+DSA *DSA_new(void);
+DSA *DSA_new_method(ENGINE *engine);
+void DSA_free(DSA *r);
+/* "up" the DSA object's reference count */
+int DSA_up_ref(DSA *r);
+int DSA_size(const DSA *);
+        /* next 4 return -1 on error */
+int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp);
+int DSA_sign(int type, const unsigned char *dgst, int dlen,
+             unsigned char *sig, unsigned int *siglen, DSA *dsa);
+int DSA_verify(int type, const unsigned char *dgst, int dgst_len,
+               const unsigned char *sigbuf, int siglen, DSA *dsa);
+int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int DSA_set_ex_data(DSA *d, int idx, void *arg);
+void *DSA_get_ex_data(DSA *d, int idx);
+
+DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
+DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
+DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
+
+/* Deprecated version */
+# ifndef OPENSSL_NO_DEPRECATED
+DSA *DSA_generate_parameters(int bits,
+                             unsigned char *seed, int seed_len,
+                             int *counter_ret, unsigned long *h_ret, void
+                              (*callback) (int, int, void *), void *cb_arg);
+# endif                         /* !defined(OPENSSL_NO_DEPRECATED) */
+
+/* New version */
+int DSA_generate_parameters_ex(DSA *dsa, int bits,
+                               const unsigned char *seed, int seed_len,
+                               int *counter_ret, unsigned long *h_ret,
+                               BN_GENCB *cb);
+
+int DSA_generate_key(DSA *a);
+int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
+int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);
+int i2d_DSAparams(const DSA *a, unsigned char **pp);
+
+# ifndef OPENSSL_NO_BIO
+int DSAparams_print(BIO *bp, const DSA *x);
+int DSA_print(BIO *bp, const DSA *x, int off);
+# endif
+# ifndef OPENSSL_NO_FP_API
+int DSAparams_print_fp(FILE *fp, const DSA *x);
+int DSA_print_fp(FILE *bp, const DSA *x, int off);
+# endif
+
+# define DSS_prime_checks 50
+/*
+ * Primality test according to FIPS PUB 186[-1], Appendix 2.1: 50 rounds of
+ * Rabin-Miller
+ */
+# define DSA_is_prime(n, callback, cb_arg) \
+        BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg)
+
+# ifndef OPENSSL_NO_DH
+/*
+ * Convert DSA structure (key or just parameters) into DH structure (be
+ * careful to avoid small subgroup attacks when using this!)
+ */
+DH *DSA_dup_DH(const DSA *r);
+# endif
+
+# define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \
+        EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \
+                                EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL)
+
+# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS         (EVP_PKEY_ALG_CTRL + 1)
+# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS       (EVP_PKEY_ALG_CTRL + 2)
+# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD           (EVP_PKEY_ALG_CTRL + 3)
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_DSA_strings(void);
+
+/* Error codes for the DSA functions. */
+
+/* Function codes. */
+# define DSA_F_D2I_DSA_SIG                                110
+# define DSA_F_DO_DSA_PRINT                               104
+# define DSA_F_DSAPARAMS_PRINT                            100
+# define DSA_F_DSAPARAMS_PRINT_FP                         101
+# define DSA_F_DSA_DO_SIGN                                112
+# define DSA_F_DSA_DO_VERIFY                              113
+# define DSA_F_DSA_GENERATE_KEY                           124
+# define DSA_F_DSA_GENERATE_PARAMETERS_EX                 123
+# define DSA_F_DSA_NEW_METHOD                             103
+# define DSA_F_DSA_PARAM_DECODE                           119
+# define DSA_F_DSA_PRINT_FP                               105
+# define DSA_F_DSA_PRIV_DECODE                            115
+# define DSA_F_DSA_PRIV_ENCODE                            116
+# define DSA_F_DSA_PUB_DECODE                             117
+# define DSA_F_DSA_PUB_ENCODE                             118
+# define DSA_F_DSA_SIGN                                   106
+# define DSA_F_DSA_SIGN_SETUP                             107
+# define DSA_F_DSA_SIG_NEW                                109
+# define DSA_F_DSA_SIG_PRINT                              125
+# define DSA_F_DSA_VERIFY                                 108
+# define DSA_F_I2D_DSA_SIG                                111
+# define DSA_F_OLD_DSA_PRIV_DECODE                        122
+# define DSA_F_PKEY_DSA_CTRL                              120
+# define DSA_F_PKEY_DSA_KEYGEN                            121
+# define DSA_F_SIG_CB                                     114
+
+/* Reason codes. */
+# define DSA_R_BAD_Q_VALUE                                102
+# define DSA_R_BN_DECODE_ERROR                            108
+# define DSA_R_BN_ERROR                                   109
+# define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE                100
+# define DSA_R_DECODE_ERROR                               104
+# define DSA_R_INVALID_DIGEST_TYPE                        106
+# define DSA_R_MISSING_PARAMETERS                         101
+# define DSA_R_MODULUS_TOO_LARGE                          103
+# define DSA_R_NEED_NEW_SETUP_VALUES                      110
+# define DSA_R_NON_FIPS_DSA_METHOD                        111
+# define DSA_R_NO_PARAMETERS_SET                          107
+# define DSA_R_PARAMETER_ENCODING_ERROR                   105
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/dsa.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ebcdic.h
===================================================================
--- lab4/.minix-src/include/openssl/ebcdic.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ebcdic.h	(revision 13)
@@ -0,0 +1,26 @@
+/* crypto/ebcdic.h */
+
+#ifndef HEADER_EBCDIC_H
+# define HEADER_EBCDIC_H
+
+# include <sys/types.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Avoid name clashes with other applications */
+# define os_toascii   _openssl_os_toascii
+# define os_toebcdic  _openssl_os_toebcdic
+# define ebcdic2ascii _openssl_ebcdic2ascii
+# define ascii2ebcdic _openssl_ascii2ebcdic
+
+extern const unsigned char os_toascii[256];
+extern const unsigned char os_toebcdic[256];
+void *ebcdic2ascii(void *dest, const void *srce, size_t count);
+void *ascii2ebcdic(void *dest, const void *srce, size_t count);
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ebcdic.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/engine.h
===================================================================
--- lab4/.minix-src/include/openssl/engine.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/engine.h	(revision 13)
@@ -0,0 +1,961 @@
+/* openssl/engine.h */
+/*
+ * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project
+ * 2000.
+ */
+/* ====================================================================
+ * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ * ECDH support in OpenSSL originally developed by
+ * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
+ */
+
+#ifndef HEADER_ENGINE_H
+# define HEADER_ENGINE_H
+
+# include <openssl/opensslconf.h>
+
+# ifdef OPENSSL_NO_ENGINE
+#  error ENGINE is disabled.
+# endif
+
+# ifndef OPENSSL_NO_DEPRECATED
+#  include <openssl/bn.h>
+#  ifndef OPENSSL_NO_RSA
+#   include <openssl/rsa.h>
+#  endif
+#  ifndef OPENSSL_NO_DSA
+#   include <openssl/dsa.h>
+#  endif
+#  ifndef OPENSSL_NO_DH
+#   include <openssl/dh.h>
+#  endif
+#  ifndef OPENSSL_NO_ECDH
+#   include <openssl/ecdh.h>
+#  endif
+#  ifndef OPENSSL_NO_ECDSA
+#   include <openssl/ecdsa.h>
+#  endif
+#  include <openssl/rand.h>
+#  include <openssl/ui.h>
+#  include <openssl/err.h>
+# endif
+
+# include <openssl/ossl_typ.h>
+# include <openssl/symhacks.h>
+
+# include <openssl/x509.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*
+ * These flags are used to control combinations of algorithm (methods) by
+ * bitwise "OR"ing.
+ */
+# define ENGINE_METHOD_RSA               (unsigned int)0x0001
+# define ENGINE_METHOD_DSA               (unsigned int)0x0002
+# define ENGINE_METHOD_DH                (unsigned int)0x0004
+# define ENGINE_METHOD_RAND              (unsigned int)0x0008
+# define ENGINE_METHOD_ECDH              (unsigned int)0x0010
+# define ENGINE_METHOD_ECDSA             (unsigned int)0x0020
+# define ENGINE_METHOD_CIPHERS           (unsigned int)0x0040
+# define ENGINE_METHOD_DIGESTS           (unsigned int)0x0080
+# define ENGINE_METHOD_STORE             (unsigned int)0x0100
+# define ENGINE_METHOD_PKEY_METHS        (unsigned int)0x0200
+# define ENGINE_METHOD_PKEY_ASN1_METHS   (unsigned int)0x0400
+/* Obvious all-or-nothing cases. */
+# define ENGINE_METHOD_ALL               (unsigned int)0xFFFF
+# define ENGINE_METHOD_NONE              (unsigned int)0x0000
+
+/*
+ * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used
+ * internally to control registration of ENGINE implementations, and can be
+ * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to
+ * initialise registered ENGINEs if they are not already initialised.
+ */
+# define ENGINE_TABLE_FLAG_NOINIT        (unsigned int)0x0001
+
+/* ENGINE flags that can be set by ENGINE_set_flags(). */
+/* Not used */
+/* #define ENGINE_FLAGS_MALLOCED        0x0001 */
+
+/*
+ * This flag is for ENGINEs that wish to handle the various 'CMD'-related
+ * control commands on their own. Without this flag, ENGINE_ctrl() handles
+ * these control commands on behalf of the ENGINE using their "cmd_defns"
+ * data.
+ */
+# define ENGINE_FLAGS_MANUAL_CMD_CTRL    (int)0x0002
+
+/*
+ * This flag is for ENGINEs who return new duplicate structures when found
+ * via "ENGINE_by_id()". When an ENGINE must store state (eg. if
+ * ENGINE_ctrl() commands are called in sequence as part of some stateful
+ * process like key-generation setup and execution), it can set this flag -
+ * then each attempt to obtain the ENGINE will result in it being copied into
+ * a new structure. Normally, ENGINEs don't declare this flag so
+ * ENGINE_by_id() just increments the existing ENGINE's structural reference
+ * count.
+ */
+# define ENGINE_FLAGS_BY_ID_COPY         (int)0x0004
+
+/*
+ * This flag if for an ENGINE that does not want its methods registered as
+ * part of ENGINE_register_all_complete() for example if the methods are not
+ * usable as default methods.
+ */
+
+# define ENGINE_FLAGS_NO_REGISTER_ALL    (int)0x0008
+
+/*
+ * ENGINEs can support their own command types, and these flags are used in
+ * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input
+ * each command expects. Currently only numeric and string input is
+ * supported. If a control command supports none of the _NUMERIC, _STRING, or
+ * _NO_INPUT options, then it is regarded as an "internal" control command -
+ * and not for use in config setting situations. As such, they're not
+ * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl()
+ * access. Changes to this list of 'command types' should be reflected
+ * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string().
+ */
+
+/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */
+# define ENGINE_CMD_FLAG_NUMERIC         (unsigned int)0x0001
+/*
+ * accepts string input (cast from 'void*' to 'const char *', 4th parameter
+ * to ENGINE_ctrl)
+ */
+# define ENGINE_CMD_FLAG_STRING          (unsigned int)0x0002
+/*
+ * Indicates that the control command takes *no* input. Ie. the control
+ * command is unparameterised.
+ */
+# define ENGINE_CMD_FLAG_NO_INPUT        (unsigned int)0x0004
+/*
+ * Indicates that the control command is internal. This control command won't
+ * be shown in any output, and is only usable through the ENGINE_ctrl_cmd()
+ * function.
+ */
+# define ENGINE_CMD_FLAG_INTERNAL        (unsigned int)0x0008
+
+/*
+ * NB: These 3 control commands are deprecated and should not be used.
+ * ENGINEs relying on these commands should compile conditional support for
+ * compatibility (eg. if these symbols are defined) but should also migrate
+ * the same functionality to their own ENGINE-specific control functions that
+ * can be "discovered" by calling applications. The fact these control
+ * commands wouldn't be "executable" (ie. usable by text-based config)
+ * doesn't change the fact that application code can find and use them
+ * without requiring per-ENGINE hacking.
+ */
+
+/*
+ * These flags are used to tell the ctrl function what should be done. All
+ * command numbers are shared between all engines, even if some don't make
+ * sense to some engines.  In such a case, they do nothing but return the
+ * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED.
+ */
+# define ENGINE_CTRL_SET_LOGSTREAM               1
+# define ENGINE_CTRL_SET_PASSWORD_CALLBACK       2
+# define ENGINE_CTRL_HUP                         3/* Close and reinitialise
+                                                   * any handles/connections
+                                                   * etc. */
+# define ENGINE_CTRL_SET_USER_INTERFACE          4/* Alternative to callback */
+# define ENGINE_CTRL_SET_CALLBACK_DATA           5/* User-specific data, used
+                                                   * when calling the password
+                                                   * callback and the user
+                                                   * interface */
+# define ENGINE_CTRL_LOAD_CONFIGURATION          6/* Load a configuration,
+                                                   * given a string that
+                                                   * represents a file name
+                                                   * or so */
+# define ENGINE_CTRL_LOAD_SECTION                7/* Load data from a given
+                                                   * section in the already
+                                                   * loaded configuration */
+
+/*
+ * These control commands allow an application to deal with an arbitrary
+ * engine in a dynamic way. Warn: Negative return values indicate errors FOR
+ * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other
+ * commands, including ENGINE-specific command types, return zero for an
+ * error. An ENGINE can choose to implement these ctrl functions, and can
+ * internally manage things however it chooses - it does so by setting the
+ * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise
+ * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the
+ * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's
+ * ctrl() handler need only implement its own commands - the above "meta"
+ * commands will be taken care of.
+ */
+
+/*
+ * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not",
+ * then all the remaining control commands will return failure, so it is
+ * worth checking this first if the caller is trying to "discover" the
+ * engine's capabilities and doesn't want errors generated unnecessarily.
+ */
+# define ENGINE_CTRL_HAS_CTRL_FUNCTION           10
+/*
+ * Returns a positive command number for the first command supported by the
+ * engine. Returns zero if no ctrl commands are supported.
+ */
+# define ENGINE_CTRL_GET_FIRST_CMD_TYPE          11
+/*
+ * The 'long' argument specifies a command implemented by the engine, and the
+ * return value is the next command supported, or zero if there are no more.
+ */
+# define ENGINE_CTRL_GET_NEXT_CMD_TYPE           12
+/*
+ * The 'void*' argument is a command name (cast from 'const char *'), and the
+ * return value is the command that corresponds to it.
+ */
+# define ENGINE_CTRL_GET_CMD_FROM_NAME           13
+/*
+ * The next two allow a command to be converted into its corresponding string
+ * form. In each case, the 'long' argument supplies the command. In the
+ * NAME_LEN case, the return value is the length of the command name (not
+ * counting a trailing EOL). In the NAME case, the 'void*' argument must be a
+ * string buffer large enough, and it will be populated with the name of the
+ * command (WITH a trailing EOL).
+ */
+# define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD       14
+# define ENGINE_CTRL_GET_NAME_FROM_CMD           15
+/* The next two are similar but give a "short description" of a command. */
+# define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD       16
+# define ENGINE_CTRL_GET_DESC_FROM_CMD           17
+/*
+ * With this command, the return value is the OR'd combination of
+ * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given
+ * engine-specific ctrl command expects.
+ */
+# define ENGINE_CTRL_GET_CMD_FLAGS               18
+
+/*
+ * ENGINE implementations should start the numbering of their own control
+ * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc).
+ */
+# define ENGINE_CMD_BASE                         200
+
+/*
+ * NB: These 2 nCipher "chil" control commands are deprecated, and their
+ * functionality is now available through ENGINE-specific control commands
+ * (exposed through the above-mentioned 'CMD'-handling). Code using these 2
+ * commands should be migrated to the more general command handling before
+ * these are removed.
+ */
+
+/* Flags specific to the nCipher "chil" engine */
+# define ENGINE_CTRL_CHIL_SET_FORKCHECK          100
+        /*
+         * Depending on the value of the (long)i argument, this sets or
+         * unsets the SimpleForkCheck flag in the CHIL API to enable or
+         * disable checking and workarounds for applications that fork().
+         */
+# define ENGINE_CTRL_CHIL_NO_LOCKING             101
+        /*
+         * This prevents the initialisation function from providing mutex
+         * callbacks to the nCipher library.
+         */
+
+/*
+ * If an ENGINE supports its own specific control commands and wishes the
+ * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on
+ * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN
+ * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl()
+ * handler that supports the stated commands (ie. the "cmd_num" entries as
+ * described by the array). NB: The array must be ordered in increasing order
+ * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element
+ * has cmd_num set to zero and/or cmd_name set to NULL.
+ */
+typedef struct ENGINE_CMD_DEFN_st {
+    unsigned int cmd_num;       /* The command number */
+    const char *cmd_name;       /* The command name itself */
+    const char *cmd_desc;       /* A short description of the command */
+    unsigned int cmd_flags;     /* The input the command expects */
+} ENGINE_CMD_DEFN;
+
+/* Generic function pointer */
+typedef int (*ENGINE_GEN_FUNC_PTR) (void);
+/* Generic function pointer taking no arguments */
+typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *);
+/* Specific control function pointer */
+typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *,
+                                     void (*f) (void));
+/* Generic load_key function pointer */
+typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *,
+                                         UI_METHOD *ui_method,
+                                         void *callback_data);
+typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl,
+                                           STACK_OF(X509_NAME) *ca_dn,
+                                           X509 **pcert, EVP_PKEY **pkey,
+                                           STACK_OF(X509) **pother,
+                                           UI_METHOD *ui_method,
+                                           void *callback_data);
+/*-
+ * These callback types are for an ENGINE's handler for cipher and digest logic.
+ * These handlers have these prototypes;
+ *   int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid);
+ *   int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid);
+ * Looking at how to implement these handlers in the case of cipher support, if
+ * the framework wants the EVP_CIPHER for 'nid', it will call;
+ *   foo(e, &p_evp_cipher, NULL, nid);    (return zero for failure)
+ * If the framework wants a list of supported 'nid's, it will call;
+ *   foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error)
+ */
+/*
+ * Returns to a pointer to the array of supported cipher 'nid's. If the
+ * second parameter is non-NULL it is set to the size of the returned array.
+ */
+typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **,
+                                   const int **, int);
+typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **,
+                                   int);
+typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **,
+                                      const int **, int);
+typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **,
+                                           const int **, int);
+/*
+ * STRUCTURE functions ... all of these functions deal with pointers to
+ * ENGINE structures where the pointers have a "structural reference". This
+ * means that their reference is to allowed access to the structure but it
+ * does not imply that the structure is functional. To simply increment or
+ * decrement the structural reference count, use ENGINE_by_id and
+ * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next
+ * as it will automatically decrement the structural reference count of the
+ * "current" ENGINE and increment the structural reference count of the
+ * ENGINE it returns (unless it is NULL).
+ */
+
+/* Get the first/last "ENGINE" type available. */
+ENGINE *ENGINE_get_first(void);
+ENGINE *ENGINE_get_last(void);
+/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */
+ENGINE *ENGINE_get_next(ENGINE *e);
+ENGINE *ENGINE_get_prev(ENGINE *e);
+/* Add another "ENGINE" type into the array. */
+int ENGINE_add(ENGINE *e);
+/* Remove an existing "ENGINE" type from the array. */
+int ENGINE_remove(ENGINE *e);
+/* Retrieve an engine from the list by its unique "id" value. */
+ENGINE *ENGINE_by_id(const char *id);
+/* Add all the built-in engines. */
+void ENGINE_load_openssl(void);
+void ENGINE_load_dynamic(void);
+# ifndef OPENSSL_NO_STATIC_ENGINE
+void ENGINE_load_4758cca(void);
+void ENGINE_load_aep(void);
+void ENGINE_load_atalla(void);
+void ENGINE_load_chil(void);
+void ENGINE_load_cswift(void);
+void ENGINE_load_nuron(void);
+void ENGINE_load_sureware(void);
+void ENGINE_load_ubsec(void);
+void ENGINE_load_padlock(void);
+void ENGINE_load_capi(void);
+#  ifndef OPENSSL_NO_GMP
+void ENGINE_load_gmp(void);
+#  endif
+#  ifndef OPENSSL_NO_GOST
+void ENGINE_load_gost(void);
+#  endif
+# endif
+void ENGINE_load_cryptodev(void);
+void ENGINE_load_rsax(void);
+void ENGINE_load_rdrand(void);
+void ENGINE_load_builtin_engines(void);
+
+/*
+ * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation
+ * "registry" handling.
+ */
+unsigned int ENGINE_get_table_flags(void);
+void ENGINE_set_table_flags(unsigned int flags);
+
+/*- Manage registration of ENGINEs per "table". For each type, there are 3
+ * functions;
+ *   ENGINE_register_***(e) - registers the implementation from 'e' (if it has one)
+ *   ENGINE_unregister_***(e) - unregister the implementation from 'e'
+ *   ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list
+ * Cleanup is automatically registered from each table when required, so
+ * ENGINE_cleanup() will reverse any "register" operations.
+ */
+
+int ENGINE_register_RSA(ENGINE *e);
+void ENGINE_unregister_RSA(ENGINE *e);
+void ENGINE_register_all_RSA(void);
+
+int ENGINE_register_DSA(ENGINE *e);
+void ENGINE_unregister_DSA(ENGINE *e);
+void ENGINE_register_all_DSA(void);
+
+int ENGINE_register_ECDH(ENGINE *e);
+void ENGINE_unregister_ECDH(ENGINE *e);
+void ENGINE_register_all_ECDH(void);
+
+int ENGINE_register_ECDSA(ENGINE *e);
+void ENGINE_unregister_ECDSA(ENGINE *e);
+void ENGINE_register_all_ECDSA(void);
+
+int ENGINE_register_DH(ENGINE *e);
+void ENGINE_unregister_DH(ENGINE *e);
+void ENGINE_register_all_DH(void);
+
+int ENGINE_register_RAND(ENGINE *e);
+void ENGINE_unregister_RAND(ENGINE *e);
+void ENGINE_register_all_RAND(void);
+
+int ENGINE_register_STORE(ENGINE *e);
+void ENGINE_unregister_STORE(ENGINE *e);
+void ENGINE_register_all_STORE(void);
+
+int ENGINE_register_ciphers(ENGINE *e);
+void ENGINE_unregister_ciphers(ENGINE *e);
+void ENGINE_register_all_ciphers(void);
+
+int ENGINE_register_digests(ENGINE *e);
+void ENGINE_unregister_digests(ENGINE *e);
+void ENGINE_register_all_digests(void);
+
+int ENGINE_register_pkey_meths(ENGINE *e);
+void ENGINE_unregister_pkey_meths(ENGINE *e);
+void ENGINE_register_all_pkey_meths(void);
+
+int ENGINE_register_pkey_asn1_meths(ENGINE *e);
+void ENGINE_unregister_pkey_asn1_meths(ENGINE *e);
+void ENGINE_register_all_pkey_asn1_meths(void);
+
+/*
+ * These functions register all support from the above categories. Note, use
+ * of these functions can result in static linkage of code your application
+ * may not need. If you only need a subset of functionality, consider using
+ * more selective initialisation.
+ */
+int ENGINE_register_complete(ENGINE *e);
+int ENGINE_register_all_complete(void);
+
+/*
+ * Send parametrised control commands to the engine. The possibilities to
+ * send down an integer, a pointer to data or a function pointer are
+ * provided. Any of the parameters may or may not be NULL, depending on the
+ * command number. In actuality, this function only requires a structural
+ * (rather than functional) reference to an engine, but many control commands
+ * may require the engine be functional. The caller should be aware of trying
+ * commands that require an operational ENGINE, and only use functional
+ * references in such situations.
+ */
+int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void));
+
+/*
+ * This function tests if an ENGINE-specific command is usable as a
+ * "setting". Eg. in an application's config file that gets processed through
+ * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to
+ * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl().
+ */
+int ENGINE_cmd_is_executable(ENGINE *e, int cmd);
+
+/*
+ * This function works like ENGINE_ctrl() with the exception of taking a
+ * command name instead of a command number, and can handle optional
+ * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation
+ * on how to use the cmd_name and cmd_optional.
+ */
+int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
+                    long i, void *p, void (*f) (void), int cmd_optional);
+
+/*
+ * This function passes a command-name and argument to an ENGINE. The
+ * cmd_name is converted to a command number and the control command is
+ * called using 'arg' as an argument (unless the ENGINE doesn't support such
+ * a command, in which case no control command is called). The command is
+ * checked for input flags, and if necessary the argument will be converted
+ * to a numeric value. If cmd_optional is non-zero, then if the ENGINE
+ * doesn't support the given cmd_name the return value will be success
+ * anyway. This function is intended for applications to use so that users
+ * (or config files) can supply engine-specific config data to the ENGINE at
+ * run-time to control behaviour of specific engines. As such, it shouldn't
+ * be used for calling ENGINE_ctrl() functions that return data, deal with
+ * binary data, or that are otherwise supposed to be used directly through
+ * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl()
+ * operation in this function will be lost - the return value is interpreted
+ * as failure if the return value is zero, success otherwise, and this
+ * function returns a boolean value as a result. In other words, vendors of
+ * 'ENGINE'-enabled devices should write ENGINE implementations with
+ * parameterisations that work in this scheme, so that compliant ENGINE-based
+ * applications can work consistently with the same configuration for the
+ * same ENGINE-enabled devices, across applications.
+ */
+int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
+                           int cmd_optional);
+
+/*
+ * These functions are useful for manufacturing new ENGINE structures. They
+ * don't address reference counting at all - one uses them to populate an
+ * ENGINE structure with personalised implementations of things prior to
+ * using it directly or adding it to the builtin ENGINE list in OpenSSL.
+ * These are also here so that the ENGINE structure doesn't have to be
+ * exposed and break binary compatibility!
+ */
+ENGINE *ENGINE_new(void);
+int ENGINE_free(ENGINE *e);
+int ENGINE_up_ref(ENGINE *e);
+int ENGINE_set_id(ENGINE *e, const char *id);
+int ENGINE_set_name(ENGINE *e, const char *name);
+int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
+int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);
+int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth);
+int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth);
+int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);
+int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);
+int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth);
+int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);
+int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);
+int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);
+int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);
+int ENGINE_set_load_privkey_function(ENGINE *e,
+                                     ENGINE_LOAD_KEY_PTR loadpriv_f);
+int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);
+int ENGINE_set_load_ssl_client_cert_function(ENGINE *e,
+                                             ENGINE_SSL_CLIENT_CERT_PTR
+                                             loadssl_f);
+int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);
+int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);
+int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f);
+int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f);
+int ENGINE_set_flags(ENGINE *e, int flags);
+int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);
+/* These functions allow control over any per-structure ENGINE data. */
+int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                            CRYPTO_EX_dup *dup_func,
+                            CRYPTO_EX_free *free_func);
+int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);
+void *ENGINE_get_ex_data(const ENGINE *e, int idx);
+
+/*
+ * This function cleans up anything that needs it. Eg. the ENGINE_add()
+ * function automatically ensures the list cleanup function is registered to
+ * be called from ENGINE_cleanup(). Similarly, all ENGINE_register_***
+ * functions ensure ENGINE_cleanup() will clean up after them.
+ */
+void ENGINE_cleanup(void);
+
+/*
+ * These return values from within the ENGINE structure. These can be useful
+ * with functional references as well as structural references - it depends
+ * which you obtained. Using the result for functional purposes if you only
+ * obtained a structural reference may be problematic!
+ */
+const char *ENGINE_get_id(const ENGINE *e);
+const char *ENGINE_get_name(const ENGINE *e);
+const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
+const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
+const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e);
+const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e);
+const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
+const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
+const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e);
+ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);
+ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);
+ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);
+ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);
+ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);
+ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);
+ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE
+                                                               *e);
+ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);
+ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);
+ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e);
+ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e);
+const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);
+const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);
+const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid);
+const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid);
+const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e,
+                                                          const char *str,
+                                                          int len);
+const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe,
+                                                      const char *str,
+                                                      int len);
+const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);
+int ENGINE_get_flags(const ENGINE *e);
+
+/*
+ * FUNCTIONAL functions. These functions deal with ENGINE structures that
+ * have (or will) be initialised for use. Broadly speaking, the structural
+ * functions are useful for iterating the list of available engine types,
+ * creating new engine types, and other "list" operations. These functions
+ * actually deal with ENGINEs that are to be used. As such these functions
+ * can fail (if applicable) when particular engines are unavailable - eg. if
+ * a hardware accelerator is not attached or not functioning correctly. Each
+ * ENGINE has 2 reference counts; structural and functional. Every time a
+ * functional reference is obtained or released, a corresponding structural
+ * reference is automatically obtained or released too.
+ */
+
+/*
+ * Initialise a engine type for use (or up its reference count if it's
+ * already in use). This will fail if the engine is not currently operational
+ * and cannot initialise.
+ */
+int ENGINE_init(ENGINE *e);
+/*
+ * Free a functional reference to a engine type. This does not require a
+ * corresponding call to ENGINE_free as it also releases a structural
+ * reference.
+ */
+int ENGINE_finish(ENGINE *e);
+
+/*
+ * The following functions handle keys that are stored in some secondary
+ * location, handled by the engine.  The storage may be on a card or
+ * whatever.
+ */
+EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,
+                                  UI_METHOD *ui_method, void *callback_data);
+EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,
+                                 UI_METHOD *ui_method, void *callback_data);
+int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s,
+                                STACK_OF(X509_NAME) *ca_dn, X509 **pcert,
+                                EVP_PKEY **ppkey, STACK_OF(X509) **pother,
+                                UI_METHOD *ui_method, void *callback_data);
+
+/*
+ * This returns a pointer for the current ENGINE structure that is (by
+ * default) performing any RSA operations. The value returned is an
+ * incremented reference, so it should be free'd (ENGINE_finish) before it is
+ * discarded.
+ */
+ENGINE *ENGINE_get_default_RSA(void);
+/* Same for the other "methods" */
+ENGINE *ENGINE_get_default_DSA(void);
+ENGINE *ENGINE_get_default_ECDH(void);
+ENGINE *ENGINE_get_default_ECDSA(void);
+ENGINE *ENGINE_get_default_DH(void);
+ENGINE *ENGINE_get_default_RAND(void);
+/*
+ * These functions can be used to get a functional reference to perform
+ * ciphering or digesting corresponding to "nid".
+ */
+ENGINE *ENGINE_get_cipher_engine(int nid);
+ENGINE *ENGINE_get_digest_engine(int nid);
+ENGINE *ENGINE_get_pkey_meth_engine(int nid);
+ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid);
+
+/*
+ * This sets a new default ENGINE structure for performing RSA operations. If
+ * the result is non-zero (success) then the ENGINE structure will have had
+ * its reference count up'd so the caller should still free their own
+ * reference 'e'.
+ */
+int ENGINE_set_default_RSA(ENGINE *e);
+int ENGINE_set_default_string(ENGINE *e, const char *def_list);
+/* Same for the other "methods" */
+int ENGINE_set_default_DSA(ENGINE *e);
+int ENGINE_set_default_ECDH(ENGINE *e);
+int ENGINE_set_default_ECDSA(ENGINE *e);
+int ENGINE_set_default_DH(ENGINE *e);
+int ENGINE_set_default_RAND(ENGINE *e);
+int ENGINE_set_default_ciphers(ENGINE *e);
+int ENGINE_set_default_digests(ENGINE *e);
+int ENGINE_set_default_pkey_meths(ENGINE *e);
+int ENGINE_set_default_pkey_asn1_meths(ENGINE *e);
+
+/*
+ * The combination "set" - the flags are bitwise "OR"d from the
+ * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()"
+ * function, this function can result in unnecessary static linkage. If your
+ * application requires only specific functionality, consider using more
+ * selective functions.
+ */
+int ENGINE_set_default(ENGINE *e, unsigned int flags);
+
+void ENGINE_add_conf_module(void);
+
+/* Deprecated functions ... */
+/* int ENGINE_clear_defaults(void); */
+
+/**************************/
+/* DYNAMIC ENGINE SUPPORT */
+/**************************/
+
+/* Binary/behaviour compatibility levels */
+# define OSSL_DYNAMIC_VERSION            (unsigned long)0x00020000
+/*
+ * Binary versions older than this are too old for us (whether we're a loader
+ * or a loadee)
+ */
+# define OSSL_DYNAMIC_OLDEST             (unsigned long)0x00020000
+
+/*
+ * When compiling an ENGINE entirely as an external shared library, loadable
+ * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns'
+ * structure type provides the calling application's (or library's) error
+ * functionality and memory management function pointers to the loaded
+ * library. These should be used/set in the loaded library code so that the
+ * loading application's 'state' will be used/changed in all operations. The
+ * 'static_state' pointer allows the loaded library to know if it shares the
+ * same static data as the calling application (or library), and thus whether
+ * these callbacks need to be set or not.
+ */
+typedef void *(*dyn_MEM_malloc_cb) (size_t);
+typedef void *(*dyn_MEM_realloc_cb) (void *, size_t);
+typedef void (*dyn_MEM_free_cb) (void *);
+typedef struct st_dynamic_MEM_fns {
+    dyn_MEM_malloc_cb malloc_cb;
+    dyn_MEM_realloc_cb realloc_cb;
+    dyn_MEM_free_cb free_cb;
+} dynamic_MEM_fns;
+/*
+ * FIXME: Perhaps the memory and locking code (crypto.h) should declare and
+ * use these types so we (and any other dependant code) can simplify a bit??
+ */
+typedef void (*dyn_lock_locking_cb) (int, int, const char *, int);
+typedef int (*dyn_lock_add_lock_cb) (int *, int, int, const char *, int);
+typedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb) (const char *,
+                                                               int);
+typedef void (*dyn_dynlock_lock_cb) (int, struct CRYPTO_dynlock_value *,
+                                     const char *, int);
+typedef void (*dyn_dynlock_destroy_cb) (struct CRYPTO_dynlock_value *,
+                                        const char *, int);
+typedef struct st_dynamic_LOCK_fns {
+    dyn_lock_locking_cb lock_locking_cb;
+    dyn_lock_add_lock_cb lock_add_lock_cb;
+    dyn_dynlock_create_cb dynlock_create_cb;
+    dyn_dynlock_lock_cb dynlock_lock_cb;
+    dyn_dynlock_destroy_cb dynlock_destroy_cb;
+} dynamic_LOCK_fns;
+/* The top-level structure */
+typedef struct st_dynamic_fns {
+    void *static_state;
+    const ERR_FNS *err_fns;
+    const CRYPTO_EX_DATA_IMPL *ex_data_fns;
+    dynamic_MEM_fns mem_fns;
+    dynamic_LOCK_fns lock_fns;
+} dynamic_fns;
+
+/*
+ * The version checking function should be of this prototype. NB: The
+ * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading
+ * code. If this function returns zero, it indicates a (potential) version
+ * incompatibility and the loaded library doesn't believe it can proceed.
+ * Otherwise, the returned value is the (latest) version supported by the
+ * loading library. The loader may still decide that the loaded code's
+ * version is unsatisfactory and could veto the load. The function is
+ * expected to be implemented with the symbol name "v_check", and a default
+ * implementation can be fully instantiated with
+ * IMPLEMENT_DYNAMIC_CHECK_FN().
+ */
+typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version);
+# define IMPLEMENT_DYNAMIC_CHECK_FN() \
+        OPENSSL_EXPORT unsigned long v_check(unsigned long v); \
+        OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \
+                if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \
+                return 0; }
+
+/*
+ * This function is passed the ENGINE structure to initialise with its own
+ * function and command settings. It should not adjust the structural or
+ * functional reference counts. If this function returns zero, (a) the load
+ * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto
+ * the structure, and (c) the shared library will be unloaded. So
+ * implementations should do their own internal cleanup in failure
+ * circumstances otherwise they could leak. The 'id' parameter, if non-NULL,
+ * represents the ENGINE id that the loader is looking for. If this is NULL,
+ * the shared library can choose to return failure or to initialise a
+ * 'default' ENGINE. If non-NULL, the shared library must initialise only an
+ * ENGINE matching the passed 'id'. The function is expected to be
+ * implemented with the symbol name "bind_engine". A standard implementation
+ * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter
+ * 'fn' is a callback function that populates the ENGINE structure and
+ * returns an int value (zero for failure). 'fn' should have prototype;
+ * [static] int fn(ENGINE *e, const char *id);
+ */
+typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id,
+                                    const dynamic_fns *fns);
+# define IMPLEMENT_DYNAMIC_BIND_FN(fn) \
+        OPENSSL_EXPORT \
+        int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \
+        OPENSSL_EXPORT \
+        int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
+                if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \
+                if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \
+                        fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \
+                        return 0; \
+                CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \
+                CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \
+                CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \
+                CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \
+                CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \
+                if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \
+                        return 0; \
+                if(!ERR_set_implementation(fns->err_fns)) return 0; \
+        skip_cbs: \
+                if(!fn(e,id)) return 0; \
+                return 1; }
+
+/*
+ * If the loading application (or library) and the loaded ENGINE library
+ * share the same static data (eg. they're both dynamically linked to the
+ * same libcrypto.so) we need a way to avoid trying to set system callbacks -
+ * this would fail, and for the same reason that it's unnecessary to try. If
+ * the loaded ENGINE has (or gets from through the loader) its own copy of
+ * the libcrypto static data, we will need to set the callbacks. The easiest
+ * way to detect this is to have a function that returns a pointer to some
+ * static data and let the loading application and loaded ENGINE compare
+ * their respective values.
+ */
+void *ENGINE_get_static_state(void);
+
+# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
+void ENGINE_setup_bsd_cryptodev(void);
+# endif
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_ENGINE_strings(void);
+
+/* Error codes for the ENGINE functions. */
+
+/* Function codes. */
+# define ENGINE_F_DYNAMIC_CTRL                            180
+# define ENGINE_F_DYNAMIC_GET_DATA_CTX                    181
+# define ENGINE_F_DYNAMIC_LOAD                            182
+# define ENGINE_F_DYNAMIC_SET_DATA_CTX                    183
+# define ENGINE_F_ENGINE_ADD                              105
+# define ENGINE_F_ENGINE_BY_ID                            106
+# define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE                170
+# define ENGINE_F_ENGINE_CTRL                             142
+# define ENGINE_F_ENGINE_CTRL_CMD                         178
+# define ENGINE_F_ENGINE_CTRL_CMD_STRING                  171
+# define ENGINE_F_ENGINE_FINISH                           107
+# define ENGINE_F_ENGINE_FREE_UTIL                        108
+# define ENGINE_F_ENGINE_GET_CIPHER                       185
+# define ENGINE_F_ENGINE_GET_DEFAULT_TYPE                 177
+# define ENGINE_F_ENGINE_GET_DIGEST                       186
+# define ENGINE_F_ENGINE_GET_NEXT                         115
+# define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH               193
+# define ENGINE_F_ENGINE_GET_PKEY_METH                    192
+# define ENGINE_F_ENGINE_GET_PREV                         116
+# define ENGINE_F_ENGINE_INIT                             119
+# define ENGINE_F_ENGINE_LIST_ADD                         120
+# define ENGINE_F_ENGINE_LIST_REMOVE                      121
+# define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY                 150
+# define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY                  151
+# define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT             194
+# define ENGINE_F_ENGINE_NEW                              122
+# define ENGINE_F_ENGINE_REMOVE                           123
+# define ENGINE_F_ENGINE_SET_DEFAULT_STRING               189
+# define ENGINE_F_ENGINE_SET_DEFAULT_TYPE                 126
+# define ENGINE_F_ENGINE_SET_ID                           129
+# define ENGINE_F_ENGINE_SET_NAME                         130
+# define ENGINE_F_ENGINE_TABLE_REGISTER                   184
+# define ENGINE_F_ENGINE_UNLOAD_KEY                       152
+# define ENGINE_F_ENGINE_UNLOCKED_FINISH                  191
+# define ENGINE_F_ENGINE_UP_REF                           190
+# define ENGINE_F_INT_CTRL_HELPER                         172
+# define ENGINE_F_INT_ENGINE_CONFIGURE                    188
+# define ENGINE_F_INT_ENGINE_MODULE_INIT                  187
+# define ENGINE_F_LOG_MESSAGE                             141
+
+/* Reason codes. */
+# define ENGINE_R_ALREADY_LOADED                          100
+# define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER                133
+# define ENGINE_R_CMD_NOT_EXECUTABLE                      134
+# define ENGINE_R_COMMAND_TAKES_INPUT                     135
+# define ENGINE_R_COMMAND_TAKES_NO_INPUT                  136
+# define ENGINE_R_CONFLICTING_ENGINE_ID                   103
+# define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED            119
+# define ENGINE_R_DH_NOT_IMPLEMENTED                      139
+# define ENGINE_R_DSA_NOT_IMPLEMENTED                     140
+# define ENGINE_R_DSO_FAILURE                             104
+# define ENGINE_R_DSO_NOT_FOUND                           132
+# define ENGINE_R_ENGINES_SECTION_ERROR                   148
+# define ENGINE_R_ENGINE_CONFIGURATION_ERROR              102
+# define ENGINE_R_ENGINE_IS_NOT_IN_LIST                   105
+# define ENGINE_R_ENGINE_SECTION_ERROR                    149
+# define ENGINE_R_FAILED_LOADING_PRIVATE_KEY              128
+# define ENGINE_R_FAILED_LOADING_PUBLIC_KEY               129
+# define ENGINE_R_FINISH_FAILED                           106
+# define ENGINE_R_GET_HANDLE_FAILED                       107
+# define ENGINE_R_ID_OR_NAME_MISSING                      108
+# define ENGINE_R_INIT_FAILED                             109
+# define ENGINE_R_INTERNAL_LIST_ERROR                     110
+# define ENGINE_R_INVALID_ARGUMENT                        143
+# define ENGINE_R_INVALID_CMD_NAME                        137
+# define ENGINE_R_INVALID_CMD_NUMBER                      138
+# define ENGINE_R_INVALID_INIT_VALUE                      151
+# define ENGINE_R_INVALID_STRING                          150
+# define ENGINE_R_NOT_INITIALISED                         117
+# define ENGINE_R_NOT_LOADED                              112
+# define ENGINE_R_NO_CONTROL_FUNCTION                     120
+# define ENGINE_R_NO_INDEX                                144
+# define ENGINE_R_NO_LOAD_FUNCTION                        125
+# define ENGINE_R_NO_REFERENCE                            130
+# define ENGINE_R_NO_SUCH_ENGINE                          116
+# define ENGINE_R_NO_UNLOAD_FUNCTION                      126
+# define ENGINE_R_PROVIDE_PARAMETERS                      113
+# define ENGINE_R_RSA_NOT_IMPLEMENTED                     141
+# define ENGINE_R_UNIMPLEMENTED_CIPHER                    146
+# define ENGINE_R_UNIMPLEMENTED_DIGEST                    147
+# define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD         101
+# define ENGINE_R_VERSION_INCOMPATIBILITY                 145
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/engine.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net/route.h
===================================================================
--- lab4/.minix-src/include/net/route.h	(nonexistent)
+++ lab4/.minix-src/include/net/route.h	(revision 13)
@@ -0,0 +1,528 @@
+/*	$NetBSD: route.h,v 1.96 2015/09/02 11:35:11 ozaki-r Exp $	*/
+
+/*
+ * Copyright (c) 1980, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)route.h	8.5 (Berkeley) 2/8/95
+ */
+
+#ifndef _NET_ROUTE_H_
+#define _NET_ROUTE_H_
+
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <net/if.h>
+
+#if !(defined(_KERNEL) || defined(_STANDALONE))
+#include <stdbool.h>
+#endif
+
+/*
+ * Kernel resident routing tables.
+ *
+ * The routing tables are initialized when interface addresses
+ * are set by making entries for all directly connected interfaces.
+ */
+
+/*
+ * A route consists of a destination address and a reference
+ * to a routing entry.  These are often held by protocols
+ * in their control blocks, e.g. inpcb.
+ */
+struct route {
+	struct	rtentry		*_ro_rt;
+	struct	sockaddr	*ro_sa;
+	LIST_ENTRY(route)	ro_rtcache_next;
+	bool			ro_invalid;
+};
+
+/*
+ * These numbers are used by reliable protocols for determining
+ * retransmission behavior and are included in the routing structure.
+ */
+struct rt_metrics {
+	uint64_t rmx_locks;	/* Kernel must leave these values alone */
+	uint64_t rmx_mtu;	/* MTU for this path */
+	uint64_t rmx_hopcount;	/* max hops expected */
+	uint64_t rmx_recvpipe;	/* inbound delay-bandwidth product */
+	uint64_t rmx_sendpipe;	/* outbound delay-bandwidth product */
+	uint64_t rmx_ssthresh;	/* outbound gateway buffer limit */
+	uint64_t rmx_rtt;	/* estimated round trip time */
+	uint64_t rmx_rttvar;	/* estimated rtt variance */
+	time_t	rmx_expire;	/* lifetime for route, e.g. redirect */
+	time_t	rmx_pksent;	/* packets sent using this route */
+};
+
+/*
+ * rmx_rtt and rmx_rttvar are stored as microseconds;
+ * RTTTOPRHZ(rtt) converts to a value suitable for use
+ * by a protocol slowtimo counter.
+ */
+#define	RTM_RTTUNIT	1000000	/* units for rtt, rttvar, as units per sec */
+#define	RTTTOPRHZ(r)	((r) / (RTM_RTTUNIT / PR_SLOWHZ))
+
+/*
+ * We distinguish between routes to hosts and routes to networks,
+ * preferring the former if available.  For each route we infer
+ * the interface to use from the gateway address supplied when
+ * the route was entered.  Routes that forward packets through
+ * gateways are marked so that the output routines know to address the
+ * gateway rather than the ultimate destination.
+ */
+#ifndef RNF_NORMAL
+#include <net/radix.h>
+#endif
+struct rtentry {
+	struct	radix_node rt_nodes[2];	/* tree glue, and other values */
+#define	rt_mask(r)	((const struct sockaddr *)((r)->rt_nodes->rn_mask))
+	struct	sockaddr *rt_gateway;	/* value */
+	int	rt_flags;		/* up/down?, host/net */
+	int	rt_refcnt;		/* # held references */
+	uint64_t rt_use;			/* raw # packets forwarded */
+	struct	ifnet *rt_ifp;		/* the answer: interface to use */
+	struct	ifaddr *rt_ifa;		/* the answer: interface to use */
+	uint32_t rt_ifa_seqno;
+	void *	rt_llinfo;		/* pointer to link level info cache */
+	struct	rt_metrics rt_rmx;	/* metrics used by rx'ing protocols */
+	struct	rtentry *rt_gwroute;	/* implied entry for gatewayed routes */
+	LIST_HEAD(, rttimer) rt_timer;  /* queue of timeouts for misc funcs */
+	struct	rtentry *rt_parent;	/* parent of cloned route */
+	struct	sockaddr *_rt_key;
+	struct	sockaddr *rt_tag;	/* route tagging info */
+};
+
+static inline const struct sockaddr *
+rt_getkey(const struct rtentry *rt)
+{
+	return rt->_rt_key;
+}
+
+/*
+ * Following structure necessary for 4.3 compatibility;
+ * We should eventually move it to a compat file.
+ */
+struct ortentry {
+	uint32_t rt_hash;		/* to speed lookups */
+	struct	sockaddr rt_dst;	/* key */
+	struct	sockaddr rt_gateway;	/* value */
+	int16_t	rt_flags;		/* up/down?, host/net */
+	int16_t	rt_refcnt;		/* # held references */
+	uint32_t rt_use;		/* raw # packets forwarded */
+	struct	ifnet *rt_ifp;		/* the answer: interface to use */
+};
+
+#define	RTF_UP		0x1		/* route usable */
+#define	RTF_GATEWAY	0x2		/* destination is a gateway */
+#define	RTF_HOST	0x4		/* host entry (net otherwise) */
+#define	RTF_REJECT	0x8		/* host or net unreachable */
+#define	RTF_DYNAMIC	0x10		/* created dynamically (by redirect) */
+#define	RTF_MODIFIED	0x20		/* modified dynamically (by redirect) */
+#define RTF_DONE	0x40		/* message confirmed */
+#define RTF_MASK	0x80		/* subnet mask present */
+#define RTF_CLONING	0x100		/* generate new routes on use */
+#define RTF_XRESOLVE	0x200		/* external daemon resolves name */
+#define RTF_LLINFO	0x400		/* generated by ARP or NDP */
+#define RTF_LLDATA	0x400		/* used by apps to add/del L2 entries */
+#define RTF_STATIC	0x800		/* manually added */
+#define RTF_BLACKHOLE	0x1000		/* just discard pkts (during updates) */
+#define RTF_CLONED	0x2000		/* this is a cloned route */
+#define RTF_PROTO2	0x4000		/* protocol specific routing flag */
+#define RTF_PROTO1	0x8000		/* protocol specific routing flag */
+#define RTF_SRC		0x10000		/* route has fixed source address */
+#define RTF_ANNOUNCE	0x20000		/* announce new ARP or NDP entry */
+#define RTF_LOCAL	0x40000		/* route represents a local address */
+#define RTF_BROADCAST	0x80000		/* route represents a bcast address */
+
+/*
+ * Routing statistics.
+ */
+struct	rtstat {
+	uint64_t rts_badredirect;	/* bogus redirect calls */
+	uint64_t rts_dynamic;		/* routes created by redirects */
+	uint64_t rts_newgateway;	/* routes modified by redirects */
+	uint64_t rts_unreach;		/* lookups which failed */
+	uint64_t rts_wildcard;		/* lookups satisfied by a wildcard */
+};
+
+/*
+ * Structures for routing messages.  By forcing the first member to be aligned
+ * at a 64-bit boundary, we also force the size to be a multiple of 64-bits.
+ */
+
+#if !defined(_KERNEL) || !defined(COMPAT_RTSOCK)
+/*
+ * If we aren't being compiled for backwards compatiblity, enforce 64-bit
+ * alignment so any routing message is the same regardless if the kernel
+ * is an ILP32 or LP64 kernel.
+ */
+#define	__align64	__aligned(sizeof(uint64_t))
+#else
+#define	__align64
+#endif
+
+struct rt_msghdr {
+	u_short	rtm_msglen __align64;
+				/* to skip over non-understood messages */
+	u_char	rtm_version;	/* future binary compatibility */
+	u_char	rtm_type;	/* message type */
+	u_short	rtm_index;	/* index for associated ifp */
+	int	rtm_flags;	/* flags, incl. kern & message, e.g. DONE */
+	int	rtm_addrs;	/* bitmask identifying sockaddrs in msg */
+	pid_t	rtm_pid;	/* identify sender */
+	int	rtm_seq;	/* for sender to identify action */
+	int	rtm_errno;	/* why failed */
+	int	rtm_use;	/* from rtentry */
+	int	rtm_inits;	/* which metrics we are initializing */
+	struct	rt_metrics rtm_rmx __align64;
+				/* metrics themselves */
+};
+
+#undef __align64
+
+#define RTM_VERSION	4	/* Up the ante and ignore older versions */
+
+#define RTM_ADD		0x1	/* Add Route */
+#define RTM_DELETE	0x2	/* Delete Route */
+#define RTM_CHANGE	0x3	/* Change Metrics or flags */
+#define RTM_GET		0x4	/* Report Metrics */
+#define RTM_LOSING	0x5	/* Kernel Suspects Partitioning */
+#define RTM_REDIRECT	0x6	/* Told to use different route */
+#define RTM_MISS	0x7	/* Lookup failed on this address */
+#define RTM_LOCK	0x8	/* fix specified metrics */
+#define RTM_OLDADD	0x9	/* caused by SIOCADDRT */
+#define RTM_OLDDEL	0xa	/* caused by SIOCDELRT */
+#define RTM_RESOLVE	0xb	/* req to resolve dst to LL addr */
+#define RTM_NEWADDR	0xc	/* address being added to iface */
+#define RTM_DELADDR	0xd	/* address being removed from iface */
+#define RTM_OOIFINFO	0xe	/* Old (pre-1.5) RTM_IFINFO message */
+#define RTM_OIFINFO	0xf	/* Old (pre-64bit time) RTM_IFINFO message */
+#define	RTM_IFANNOUNCE	0x10	/* iface arrival/departure */
+#define	RTM_IEEE80211	0x11	/* IEEE80211 wireless event */
+#define	RTM_SETGATE	0x12	/* set prototype gateway for clones
+				 * (see example in arp_rtrequest).
+				 */
+#define	RTM_LLINFO_UPD	0x13	/* indication to ARP/NDP/etc. that link-layer
+				 * address has changed
+				 */
+#define RTM_IFINFO	0x14	/* iface/link going up/down etc. */
+#define RTM_CHGADDR	0x15	/* address properties changed */
+
+#define RTV_MTU		0x1	/* init or lock _mtu */
+#define RTV_HOPCOUNT	0x2	/* init or lock _hopcount */
+#define RTV_EXPIRE	0x4	/* init or lock _expire */
+#define RTV_RPIPE	0x8	/* init or lock _recvpipe */
+#define RTV_SPIPE	0x10	/* init or lock _sendpipe */
+#define RTV_SSTHRESH	0x20	/* init or lock _ssthresh */
+#define RTV_RTT		0x40	/* init or lock _rtt */
+#define RTV_RTTVAR	0x80	/* init or lock _rttvar */
+
+/*
+ * Bitmask values for rtm_addr.
+ */
+#define RTA_DST		0x1	/* destination sockaddr present */
+#define RTA_GATEWAY	0x2	/* gateway sockaddr present */
+#define RTA_NETMASK	0x4	/* netmask sockaddr present */
+#define RTA_GENMASK	0x8	/* cloning mask sockaddr present */
+#define RTA_IFP		0x10	/* interface name sockaddr present */
+#define RTA_IFA		0x20	/* interface addr sockaddr present */
+#define RTA_AUTHOR	0x40	/* sockaddr for author of redirect */
+#define RTA_BRD		0x80	/* for NEWADDR, broadcast or p-p dest addr */
+#define RTA_TAG		0x100	/* route tag */
+
+/*
+ * Index offsets for sockaddr array for alternate internal encoding.
+ */
+#define RTAX_DST	0	/* destination sockaddr present */
+#define RTAX_GATEWAY	1	/* gateway sockaddr present */
+#define RTAX_NETMASK	2	/* netmask sockaddr present */
+#define RTAX_GENMASK	3	/* cloning mask sockaddr present */
+#define RTAX_IFP	4	/* interface name sockaddr present */
+#define RTAX_IFA	5	/* interface addr sockaddr present */
+#define RTAX_AUTHOR	6	/* sockaddr for author of redirect */
+#define RTAX_BRD	7	/* for NEWADDR, broadcast or p-p dest addr */
+#define RTAX_TAG	8	/* route tag */
+#define RTAX_MAX	9	/* size of array to allocate */
+
+#define RT_ROUNDUP2(a, n)	((a) > 0 ? (1 + (((a) - 1) | ((n) - 1))) : (n))
+#define RT_ROUNDUP(a)		RT_ROUNDUP2((a), sizeof(uint64_t))
+#define RT_ADVANCE(x, n)	(x += RT_ROUNDUP((n)->sa_len))
+
+struct rt_addrinfo {
+	int	rti_addrs;
+	const struct	sockaddr *rti_info[RTAX_MAX];
+	int	rti_flags;
+	struct	ifaddr *rti_ifa;
+	struct	ifnet *rti_ifp;
+};
+
+struct route_cb {
+	int	ip_count;
+	int	ip6_count;
+	int	unused1;
+	int	mpls_count;
+	int	any_count;
+};
+
+/*
+ * This structure, and the prototypes for the rt_timer_{init,remove_all,
+ * add,timer} functions all used with the kind permission of BSDI.
+ * These allow functions to be called for routes at specific times.
+ */
+
+struct rttimer {
+	TAILQ_ENTRY(rttimer)	rtt_next;  /* entry on timer queue */
+	LIST_ENTRY(rttimer) 	rtt_link;  /* multiple timers per rtentry */
+	struct rttimer_queue   *rtt_queue; /* back pointer to queue */
+	struct rtentry         *rtt_rt;    /* Back pointer to the route */
+	void		      (*rtt_func)(struct rtentry *, struct rttimer *);
+	time_t          	rtt_time;  /* When this timer was registered */
+};
+
+struct rttimer_queue {
+	long				rtq_timeout;
+	unsigned long			rtq_count;
+	TAILQ_HEAD(, rttimer)		rtq_head;
+	LIST_ENTRY(rttimer_queue)	rtq_link;
+};
+
+
+struct rtbl;
+typedef struct rtbl rtbl_t;
+
+#ifdef _KERNEL
+
+struct rtbl {
+	struct radix_node_head t_rnh;
+};
+
+struct rt_walkarg {
+	int	w_op;
+	int	w_arg;
+	int	w_given;
+	int	w_needed;
+	void *	w_where;
+	int	w_tmemsize;
+	int	w_tmemneeded;
+	void *	w_tmem;
+};
+
+#if 0
+#define	RT_DPRINTF(__fmt, ...)	do { } while (/*CONSTCOND*/0)
+#else
+#define	RT_DPRINTF(__fmt, ...)	/* do nothing */
+#endif
+
+struct rtwalk {
+	int (*rw_f)(struct rtentry *, void *);
+	void *rw_v;
+};
+
+/*
+ * Global data specific to the routing socket.
+ */
+struct route_info {
+	struct sockaddr ri_dst;
+	struct sockaddr ri_src;
+	struct route_cb ri_cb;
+	int ri_maxqlen;
+	struct ifqueue ri_intrq;
+	void *ri_sih;
+};
+
+extern	struct	route_info route_info;
+extern	struct	rtstat	rtstat;
+
+struct socket;
+
+void	rt_init(void);
+
+int	rt_timer_add(struct rtentry *,
+	    void(*)(struct rtentry *, struct rttimer *),
+	    struct rttimer_queue *);
+unsigned long
+	rt_timer_count(struct rttimer_queue *);
+void	rt_timer_init(void);
+void	rt_timer_queue_change(struct rttimer_queue *, long);
+struct rttimer_queue *
+	rt_timer_queue_create(u_int);
+void	rt_timer_queue_destroy(struct rttimer_queue *, int);
+void	rt_timer_queue_remove_all(struct rttimer_queue *, int);
+void	rt_timer_remove_all(struct rtentry *, int);
+void	rt_timer_timer(void *);
+
+void	rt_newmsg(int, struct rtentry *);
+struct rtentry *
+	rtalloc1(const struct sockaddr *, int);
+void	rtfree(struct rtentry *);
+int	rtinit(struct ifaddr *, int, int);
+void	rtredirect(const struct sockaddr *, const struct sockaddr *,
+	    const struct sockaddr *, int, const struct sockaddr *,
+	    struct rtentry **);
+int	rtrequest(int, const struct sockaddr *,
+	    const struct sockaddr *, const struct sockaddr *, int,
+	    struct rtentry **);
+int	rtrequest1(int, struct rt_addrinfo *, struct rtentry **);
+int	rtrequest_newmsg(const int, const struct sockaddr *,
+	    const struct sockaddr *, const struct sockaddr *, const int);
+
+int	rt_ifa_addlocal(struct ifaddr *);
+int	rt_ifa_remlocal(struct ifaddr *, struct ifaddr *);
+struct ifaddr *
+	rt_get_ifa(struct rtentry *);
+int	rt_getifa(struct rt_addrinfo *);
+void	rt_replace_ifa(struct rtentry *, struct ifaddr *);
+int	rt_setgate(struct rtentry *, const struct sockaddr *);
+
+const struct sockaddr *
+	rt_settag(struct rtentry *, const struct sockaddr *);
+struct sockaddr *
+	rt_gettag(struct rtentry *);
+
+static inline struct rtentry *
+rt_get_gwroute(struct rtentry *rt)
+{
+	if (rt->rt_gwroute == NULL)
+		return NULL;
+	rt->rt_gwroute->rt_refcnt++;
+	return rt->rt_gwroute;
+}
+
+static inline void
+rt_set_gwroute(struct rtentry *rt, struct rtentry *gwrt)
+{
+
+	rt->rt_gwroute = gwrt;
+	if (rt->rt_gwroute != NULL)
+		rt->rt_gwroute->rt_refcnt++;
+}
+
+static inline void
+rt_assert_referenced(const struct rtentry *rt)
+{
+
+	KASSERT(rt->rt_refcnt > 0);
+}
+
+void	rtcache_copy(struct route *, const struct route *);
+void	rtcache_free(struct route *);
+struct rtentry *
+	rtcache_init(struct route *);
+struct rtentry *
+	rtcache_init_noclone(struct route *);
+struct rtentry *
+	rtcache_lookup2(struct route *, const struct sockaddr *, int,
+	    int *);
+int	rtcache_setdst(struct route *, const struct sockaddr *);
+struct rtentry *
+	rtcache_update(struct route *, int);
+
+static inline void
+rtcache_invariants(const struct route *ro)
+{
+	KASSERT(ro->ro_sa != NULL || ro->_ro_rt == NULL);
+	KASSERT(!ro->ro_invalid || ro->_ro_rt != NULL);
+	KASSERT(ro->_ro_rt == NULL || ro->_ro_rt->rt_refcnt > 0);
+}
+
+static inline struct rtentry *
+rtcache_lookup1(struct route *ro, const struct sockaddr *dst, int clone)
+{
+	int hit;
+
+	return rtcache_lookup2(ro, dst, clone, &hit);
+}
+
+static inline struct rtentry *
+rtcache_lookup_noclone(struct route *ro, const struct sockaddr *dst)
+{
+	return rtcache_lookup1(ro, dst, 0);
+}
+
+static inline struct rtentry *
+rtcache_lookup(struct route *ro, const struct sockaddr *dst)
+{
+	return rtcache_lookup1(ro, dst, 1);
+}
+
+static inline const struct sockaddr *
+rtcache_getdst(const struct route *ro)
+{
+	rtcache_invariants(ro);
+	return ro->ro_sa;
+}
+
+/* If the cache is not empty, and the cached route is still present
+ * in the routing table, return the cached route.  Otherwise, return
+ * NULL.
+ */
+static inline struct rtentry *
+rtcache_validate(const struct route *ro)
+{
+	struct rtentry *rt = ro->_ro_rt;
+
+	rtcache_invariants(ro);
+
+	if (ro->ro_invalid)
+		return NULL;
+
+	if (rt != NULL && (rt->rt_flags & RTF_UP) != 0 && rt->rt_ifp != NULL)
+		return rt;
+	return NULL;
+
+}
+
+/* rtsock */
+void	rt_ieee80211msg(struct ifnet *, int, void *, size_t);
+void	rt_ifannouncemsg(struct ifnet *, int);
+void	rt_ifmsg(struct ifnet *);
+void	rt_missmsg(int, const struct rt_addrinfo *, int, int);
+struct mbuf *
+	rt_msg1(int, struct rt_addrinfo *, void *, int);
+void	rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);
+void	route_enqueue(struct mbuf *, int);
+
+/* rtbl */
+int	rt_addaddr(rtbl_t *, struct rtentry *, const struct sockaddr *);
+void	rt_assert_inactive(const struct rtentry *);
+struct rtentry *
+	rt_deladdr(rtbl_t *, const struct sockaddr *,
+	    const struct sockaddr *);
+rtbl_t *rt_gettable(sa_family_t);
+int	rt_inithead(rtbl_t **, int);
+struct rtentry *
+	rt_lookup(rtbl_t *, const struct sockaddr *,
+	    const struct sockaddr *);
+struct rtentry *
+	rt_matchaddr(rtbl_t *, const struct sockaddr *);
+int	rt_walktree(sa_family_t, int (*)(struct rtentry *, void *), void *);
+void	rtbl_init(void);
+
+#endif /* _KERNEL */
+
+#endif /* !_NET_ROUTE_H_ */

Property changes on: lab4/.minix-src/include/net/route.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/net80211/ieee80211_ioctl.h
===================================================================
--- lab4/.minix-src/include/net80211/ieee80211_ioctl.h	(nonexistent)
+++ lab4/.minix-src/include/net80211/ieee80211_ioctl.h	(revision 13)
@@ -0,0 +1,612 @@
+/*	$NetBSD: ieee80211_ioctl.h,v 1.21 2015/09/06 06:01:01 dholland Exp $	*/
+/*-
+ * Copyright (c) 2001 Atsushi Onoe
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * 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.
+ *
+ * $FreeBSD: src/sys/net80211/ieee80211_ioctl.h,v 1.14 2005/08/13 17:31:48 sam Exp $
+ */
+#ifndef _NET80211_IEEE80211_IOCTL_H_
+#define _NET80211_IEEE80211_IOCTL_H_
+
+/*
+ * IEEE 802.11 ioctls.
+ */
+#include <sys/ioccom.h>
+#include <net80211/_ieee80211.h>
+#include <net80211/ieee80211.h>
+#include <net80211/ieee80211_crypto.h>
+
+/*
+ * Per/node (station) statistics available when operating as an AP.
+ */
+struct ieee80211_nodestats {
+	u_int32_t	ns_rx_data;		/* rx data frames */
+	u_int32_t	ns_rx_mgmt;		/* rx management frames */
+	u_int32_t	ns_rx_ctrl;		/* rx control frames */
+	u_int32_t	ns_rx_ucast;		/* rx unicast frames */
+	u_int32_t	ns_rx_mcast;		/* rx multi/broadcast frames */
+	u_int64_t	ns_rx_bytes;		/* rx data count (bytes) */
+	u_int64_t	ns_rx_beacons;		/* rx beacon frames */
+	u_int32_t	ns_rx_proberesp;	/* rx probe response frames */
+
+	u_int32_t	ns_rx_dup;		/* rx discard 'cuz dup */
+	u_int32_t	ns_rx_noprivacy;	/* rx w/ wep but privacy off */
+	u_int32_t	ns_rx_wepfail;		/* rx wep processing failed */
+	u_int32_t	ns_rx_demicfail;	/* rx demic failed */
+	u_int32_t	ns_rx_decap;		/* rx decapsulation failed */
+	u_int32_t	ns_rx_defrag;		/* rx defragmentation failed */
+	u_int32_t	ns_rx_disassoc;		/* rx disassociation */
+	u_int32_t	ns_rx_deauth;		/* rx deauthentication */
+	u_int32_t	ns_rx_decryptcrc;	/* rx decrypt failed on crc */
+	u_int32_t	ns_rx_unauth;		/* rx on unauthorized port */
+	u_int32_t	ns_rx_unencrypted;	/* rx unecrypted w/ privacy */
+
+	u_int32_t	ns_tx_data;		/* tx data frames */
+	u_int32_t	ns_tx_mgmt;		/* tx management frames */
+	u_int32_t	ns_tx_ucast;		/* tx unicast frames */
+	u_int32_t	ns_tx_mcast;		/* tx multi/broadcast frames */
+	u_int64_t	ns_tx_bytes;		/* tx data count (bytes) */
+	u_int32_t	ns_tx_probereq;		/* tx probe request frames */
+
+	u_int32_t	ns_tx_novlantag;	/* tx discard 'cuz no tag */
+	u_int32_t	ns_tx_vlanmismatch;	/* tx discard 'cuz bad tag */
+
+	u_int32_t	ns_ps_discard;		/* ps discard 'cuz of age */
+
+	/* MIB-related state */
+	u_int32_t	ns_tx_assoc;		/* [re]associations */
+	u_int32_t	ns_tx_assoc_fail;	/* [re]association failures */
+	u_int32_t	ns_tx_auth;		/* [re]authentications */
+	u_int32_t	ns_tx_auth_fail;	/* [re]authentication failures*/
+	u_int32_t	ns_tx_deauth;		/* deauthentications */
+	u_int32_t	ns_tx_deauth_code;	/* last deauth reason */
+	u_int32_t	ns_tx_disassoc;		/* disassociations */
+	u_int32_t	ns_tx_disassoc_code;	/* last disassociation reason */
+};
+
+#ifdef COMPAT_20
+struct ieee80211_ostats {
+	u_int32_t	is_rx_badversion;	/* rx frame with bad version */
+	u_int32_t	is_rx_tooshort;		/* rx frame too short */
+	u_int32_t	is_rx_wrongbss;		/* rx from wrong bssid */
+	u_int32_t	is_rx_dup;		/* rx discard 'cuz dup */
+	u_int32_t	is_rx_wrongdir;		/* rx w/ wrong direction */
+	u_int32_t	is_rx_mcastecho;	/* rx discard 'cuz mcast echo */
+	u_int32_t	is_rx_notassoc;		/* rx discard 'cuz sta !assoc */
+	u_int32_t	is_rx_nowep;		/* rx w/ wep but wep !config */
+	u_int32_t	is_rx_wepfail;		/* rx wep processing failed */
+	u_int32_t	is_rx_decap;		/* rx decapsulation failed */
+	u_int32_t	is_rx_mgtdiscard;	/* rx discard mgt frames */
+	u_int32_t	is_rx_ctl;		/* rx discard ctrl frames */
+	u_int32_t	is_rx_rstoobig;		/* rx rate set truncated */
+	u_int32_t	is_rx_elem_missing;	/* rx required element missing*/
+	u_int32_t	is_rx_elem_toobig;	/* rx element too big */
+	u_int32_t	is_rx_elem_toosmall;	/* rx element too small */
+	u_int32_t	is_rx_elem_unknown;	/* rx element unknown */
+	u_int32_t	is_rx_badchan;		/* rx frame w/ invalid chan */
+	u_int32_t	is_rx_chanmismatch;	/* rx frame chan mismatch */
+	u_int32_t	is_rx_nodealloc;	/* rx frame dropped */
+	u_int32_t	is_rx_ssidmismatch;	/* rx frame ssid mismatch  */
+	u_int32_t	is_rx_auth_unsupported;	/* rx w/ unsupported auth alg */
+	u_int32_t	is_rx_auth_fail;	/* rx sta auth failure */
+	u_int32_t	is_rx_assoc_bss;	/* rx assoc from wrong bssid */
+	u_int32_t	is_rx_assoc_notauth;	/* rx assoc w/o auth */
+	u_int32_t	is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
+	u_int32_t	is_rx_assoc_norate;	/* rx assoc w/ no rate match */
+	u_int32_t	is_rx_deauth;		/* rx deauthentication */
+	u_int32_t	is_rx_disassoc;		/* rx disassociation */
+	u_int32_t	is_rx_badsubtype;	/* rx frame w/ unknown subtype*/
+	u_int32_t	is_rx_nombuf;		/* rx failed for lack of mbuf */
+	u_int32_t	is_rx_decryptcrc;	/* rx decrypt failed on crc */
+	u_int32_t	is_rx_ahdemo_mgt;	/* rx discard ahdemo mgt frame*/
+	u_int32_t	is_rx_bad_auth;		/* rx bad auth request */
+	u_int32_t	is_tx_nombuf;		/* tx failed for lack of mbuf */
+	u_int32_t	is_tx_nonode;		/* tx failed for no node */
+	u_int32_t	is_tx_unknownmgt;	/* tx of unknown mgt frame */
+	u_int32_t	is_scan_active;		/* active scans started */
+	u_int32_t	is_scan_passive;	/* passive scans started */
+	u_int32_t	is_node_timeout;	/* nodes timed out inactivity */
+	u_int32_t	is_crypto_nomem;	/* no memory for crypto ctx */
+};
+#endif /* COMPAT_20 */
+
+/*
+ * Summary statistics.
+ */
+struct ieee80211_stats {
+	u_int32_t	is_rx_badversion;	/* rx frame with bad version */
+	u_int32_t	is_rx_tooshort;		/* rx frame too short */
+	u_int32_t	is_rx_wrongbss;		/* rx from wrong bssid */
+	u_int32_t	is_rx_dup;		/* rx discard 'cuz dup */
+	u_int32_t	is_rx_wrongdir;		/* rx w/ wrong direction */
+	u_int32_t	is_rx_mcastecho;	/* rx discard 'cuz mcast echo */
+	u_int32_t	is_rx_notassoc;		/* rx discard 'cuz sta !assoc */
+	u_int32_t	is_rx_noprivacy;	/* rx w/ wep but privacy off */
+	u_int32_t	is_rx_unencrypted;	/* rx w/o wep and privacy on */
+	u_int32_t	is_rx_wepfail;		/* rx wep processing failed */
+	u_int32_t	is_rx_decap;		/* rx decapsulation failed */
+	u_int32_t	is_rx_mgtdiscard;	/* rx discard mgt frames */
+	u_int32_t	is_rx_ctl;		/* rx discard ctrl frames */
+	u_int32_t	is_rx_beacon;		/* rx beacon frames */
+	u_int32_t	is_rx_rstoobig;		/* rx rate set truncated */
+	u_int32_t	is_rx_elem_missing;	/* rx required element missing*/
+	u_int32_t	is_rx_elem_toobig;	/* rx element too big */
+	u_int32_t	is_rx_elem_toosmall;	/* rx element too small */
+	u_int32_t	is_rx_elem_unknown;	/* rx element unknown */
+	u_int32_t	is_rx_badchan;		/* rx frame w/ invalid chan */
+	u_int32_t	is_rx_chanmismatch;	/* rx frame chan mismatch */
+	u_int32_t	is_rx_nodealloc;	/* rx frame dropped */
+	u_int32_t	is_rx_ssidmismatch;	/* rx frame ssid mismatch  */
+	u_int32_t	is_rx_auth_unsupported;	/* rx w/ unsupported auth alg */
+	u_int32_t	is_rx_auth_fail;	/* rx sta auth failure */
+	u_int32_t	is_rx_auth_countermeasures;/* rx auth discard 'cuz CM */
+	u_int32_t	is_rx_assoc_bss;	/* rx assoc from wrong bssid */
+	u_int32_t	is_rx_assoc_notauth;	/* rx assoc w/o auth */
+	u_int32_t	is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
+	u_int32_t	is_rx_assoc_norate;	/* rx assoc w/ no rate match */
+	u_int32_t	is_rx_assoc_badwpaie;	/* rx assoc w/ bad WPA IE */
+	u_int32_t	is_rx_deauth;		/* rx deauthentication */
+	u_int32_t	is_rx_disassoc;		/* rx disassociation */
+	u_int32_t	is_rx_badsubtype;	/* rx frame w/ unknown subtype*/
+	u_int32_t	is_rx_nobuf;		/* rx failed for lack of buf */
+	u_int32_t	is_rx_decryptcrc;	/* rx decrypt failed on crc */
+	u_int32_t	is_rx_ahdemo_mgt;	/* rx discard ahdemo mgt frame*/
+	u_int32_t	is_rx_bad_auth;		/* rx bad auth request */
+	u_int32_t	is_rx_unauth;		/* rx on unauthorized port */
+	u_int32_t	is_rx_badkeyid;		/* rx w/ incorrect keyid */
+	u_int32_t	is_rx_ccmpreplay;	/* rx seq# violation (CCMP) */
+	u_int32_t	is_rx_ccmpformat;	/* rx format bad (CCMP) */
+	u_int32_t	is_rx_ccmpmic;		/* rx MIC check failed (CCMP) */
+	u_int32_t	is_rx_tkipreplay;	/* rx seq# violation (TKIP) */
+	u_int32_t	is_rx_tkipformat;	/* rx format bad (TKIP) */
+	u_int32_t	is_rx_tkipmic;		/* rx MIC check failed (TKIP) */
+	u_int32_t	is_rx_tkipicv;		/* rx ICV check failed (TKIP) */
+	u_int32_t	is_rx_badcipher;	/* rx failed 'cuz key type */
+	u_int32_t	is_rx_nocipherctx;	/* rx failed 'cuz key !setup */
+	u_int32_t	is_rx_acl;		/* rx discard 'cuz acl policy */
+	u_int32_t	is_tx_nobuf;		/* tx failed for lack of buf */
+	u_int32_t	is_tx_nonode;		/* tx failed for no node */
+	u_int32_t	is_tx_unknownmgt;	/* tx of unknown mgt frame */
+	u_int32_t	is_tx_badcipher;	/* tx failed 'cuz key type */
+	u_int32_t	is_tx_nodefkey;		/* tx failed 'cuz no defkey */
+	u_int32_t	is_tx_noheadroom;	/* tx failed 'cuz no space */
+	u_int32_t	is_tx_fragframes;	/* tx frames fragmented */
+	u_int32_t	is_tx_frags;		/* tx fragments created */
+	u_int32_t	is_scan_active;		/* active scans started */
+	u_int32_t	is_scan_passive;	/* passive scans started */
+	u_int32_t	is_node_timeout;	/* nodes timed out inactivity */
+	u_int32_t	is_crypto_nomem;	/* no memory for crypto ctx */
+	u_int32_t	is_crypto_tkip;		/* tkip crypto done in s/w */
+	u_int32_t	is_crypto_tkipenmic;	/* tkip en-MIC done in s/w */
+	u_int32_t	is_crypto_tkipdemic;	/* tkip de-MIC done in s/w */
+	u_int32_t	is_crypto_tkipcm;	/* tkip counter measures */
+	u_int32_t	is_crypto_ccmp;		/* ccmp crypto done in s/w */
+	u_int32_t	is_crypto_wep;		/* wep crypto done in s/w */
+	u_int32_t	is_crypto_setkey_cipher;/* cipher rejected key */
+	u_int32_t	is_crypto_setkey_nokey;	/* no key index for setkey */
+	u_int32_t	is_crypto_delkey;	/* driver key delete failed */
+	u_int32_t	is_crypto_badcipher;	/* unknown cipher */
+	u_int32_t	is_crypto_nocipher;	/* cipher not available */
+	u_int32_t	is_crypto_attachfail;	/* cipher attach failed */
+	u_int32_t	is_crypto_swfallback;	/* cipher fallback to s/w */
+	u_int32_t	is_crypto_keyfail;	/* driver key alloc failed */
+	u_int32_t	is_crypto_enmicfail;	/* en-MIC failed */
+	u_int32_t	is_ibss_capmismatch;	/* merge failed-cap mismatch */
+	u_int32_t	is_ibss_norate;		/* merge failed-rate mismatch */
+	u_int32_t	is_ps_unassoc;		/* ps-poll for unassoc. sta */
+	u_int32_t	is_ps_badaid;		/* ps-poll w/ incorrect aid */
+	u_int32_t	is_ps_qempty;		/* ps-poll w/ nothing to send */
+	u_int32_t	is_ff_badhdr;		/* fast frame rx'd w/ bad hdr */
+	u_int32_t	is_ff_tooshort;		/* fast frame rx decap error */
+	u_int32_t	is_ff_split;		/* fast frame rx split error */
+	u_int32_t	is_ff_decap;		/* fast frames decap'd */
+	u_int32_t	is_ff_encap;		/* fast frames encap'd for tx */
+	u_int32_t	is_rx_badbintval;	/* rx frame w/ bogus bintval */
+	u_int32_t	is_spare[9];
+};
+
+/*
+ * Max size of optional information elements.  We artificially
+ * constrain this; it's limited only by the max frame size (and
+ * the max parameter size of the wireless extensions).
+ */
+#define	IEEE80211_MAX_OPT_IE	256
+
+/*
+ * WPA/RSN get/set key request.  Specify the key/cipher
+ * type and whether the key is to be used for sending and/or
+ * receiving.  The key index should be set only when working
+ * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').
+ * Otherwise a unicast/pairwise key is specified by the bssid
+ * (on a station) or mac address (on an ap).  They key length
+ * must include any MIC key data; otherwise it should be no
+ more than IEEE80211_KEYBUF_SIZE.
+ */
+struct ieee80211req_key {
+	u_int8_t	ik_type;	/* key/cipher type */
+	u_int8_t	ik_pad;
+	u_int16_t	ik_keyix;	/* key index */
+	u_int8_t	ik_keylen;	/* key length in bytes */
+	u_int8_t	ik_flags;
+/* NB: IEEE80211_KEY_XMIT and IEEE80211_KEY_RECV defined elsewhere */
+#define	IEEE80211_KEY_DEFAULT	0x80	/* default xmit key */
+	u_int8_t	ik_macaddr[IEEE80211_ADDR_LEN];
+	u_int64_t	ik_keyrsc;	/* key receive sequence counter */
+	u_int64_t	ik_keytsc;	/* key transmit sequence counter */
+	u_int8_t	ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
+};
+
+/*
+ * Delete a key either by index or address.  Set the index
+ * to IEEE80211_KEYIX_NONE when deleting a unicast key.
+ */
+struct ieee80211req_del_key {
+	u_int8_t	idk_keyix;	/* key index */
+	u_int8_t	idk_macaddr[IEEE80211_ADDR_LEN];
+};
+
+/*
+ * MLME state manipulation request.  IEEE80211_MLME_ASSOC
+ * only makes sense when operating as a station.  The other
+ * requests can be used when operating as a station or an
+ * ap (to effect a station).
+ */
+struct ieee80211req_mlme {
+	u_int8_t	im_op;		/* operation to perform */
+#define	IEEE80211_MLME_ASSOC		1	/* associate station */
+#define	IEEE80211_MLME_DISASSOC		2	/* disassociate station */
+#define	IEEE80211_MLME_DEAUTH		3	/* deauthenticate station */
+#define	IEEE80211_MLME_AUTHORIZE	4	/* authorize station */
+#define	IEEE80211_MLME_UNAUTHORIZE	5	/* unauthorize station */
+	u_int8_t	im_ssid_len;	/* length of optional ssid */
+	u_int16_t	im_reason;	/* 802.11 reason code */
+	u_int8_t	im_macaddr[IEEE80211_ADDR_LEN];
+	u_int8_t	im_ssid[IEEE80211_NWID_LEN];
+};
+
+/* 
+ * MAC ACL operations.
+ */
+enum {
+	IEEE80211_MACCMD_POLICY_OPEN	= 0,	/* set policy: no ACL's */
+	IEEE80211_MACCMD_POLICY_ALLOW	= 1,	/* set policy: allow traffic */
+	IEEE80211_MACCMD_POLICY_DENY	= 2,	/* set policy: deny traffic */
+	IEEE80211_MACCMD_FLUSH		= 3,	/* flush ACL database */
+	IEEE80211_MACCMD_DETACH		= 4,	/* detach ACL policy */
+	IEEE80211_MACCMD_POLICY		= 5,	/* get ACL policy */
+	IEEE80211_MACCMD_LIST		= 6	/* get ACL database */
+};
+
+struct ieee80211req_maclist {
+	u_int8_t	ml_macaddr[IEEE80211_ADDR_LEN];
+};
+
+/*
+ * Set the active channel list.  Note this list is
+ * intersected with the available channel list in
+ * calculating the set of channels actually used in
+ * scanning.
+ */
+struct ieee80211req_chanlist {
+	u_int8_t	ic_channels[IEEE80211_CHAN_BYTES];
+};
+
+/*
+ * Get the active channel list info.
+ */
+struct ieee80211req_chaninfo {
+	u_int	ic_nchans;
+	struct ieee80211_channel ic_chans[IEEE80211_CHAN_MAX];
+};
+
+/*
+ * Retrieve the WPA/RSN information element for an associated station.
+ */
+struct ieee80211req_wpaie {
+	u_int8_t	wpa_macaddr[IEEE80211_ADDR_LEN];
+	u_int8_t	wpa_ie[IEEE80211_MAX_OPT_IE];
+};
+
+/*
+ * Retrieve per-node statistics.
+ */
+struct ieee80211req_sta_stats {
+	union {
+		/* NB: explicitly force 64-bit alignment */
+		u_int8_t	macaddr[IEEE80211_ADDR_LEN];
+		u_int64_t	pad;
+	} is_u;
+	struct ieee80211_nodestats is_stats;
+};
+
+/*
+ * Station information block; the mac address is used
+ * to retrieve other data like stats, unicast key, etc.
+ */
+struct ieee80211req_sta_info {
+	u_int16_t	isi_len;		/* length (mult of 4) */
+	u_int16_t	isi_freq;		/* MHz */
+	u_int16_t	isi_flags;		/* channel flags */
+	u_int16_t	isi_state;		/* state flags */
+	u_int8_t	isi_authmode;		/* authentication algorithm */
+	u_int8_t	isi_rssi;
+	u_int8_t	isi_capinfo;		/* capabilities */
+	u_int8_t	isi_erp;		/* ERP element */
+	u_int8_t	isi_macaddr[IEEE80211_ADDR_LEN];
+	u_int8_t	isi_nrates;
+						/* negotiated rates */
+	u_int8_t	isi_rates[IEEE80211_RATE_MAXSIZE];
+	u_int8_t	isi_txrate;		/* index to isi_rates[] */
+	u_int16_t	isi_ie_len;		/* IE length */
+	u_int16_t	isi_associd;		/* assoc response */
+	u_int16_t	isi_txpower;		/* current tx power */
+	u_int16_t	isi_vlan;		/* vlan tag */
+	u_int16_t	isi_txseqs[17];		/* seq to be transmitted */
+	u_int16_t	isi_rxseqs[17];		/* seq previous for qos frames*/
+	u_int16_t	isi_inact;		/* inactivity timer */
+	/* XXX frag state? */
+	/* variable length IE data */
+};
+
+/*
+ * Retrieve per-station information; to retrieve all
+ * specify a mac address of ff:ff:ff:ff:ff:ff.
+ */
+struct ieee80211req_sta_req {
+	union {
+		/* NB: explicitly force 64-bit alignment */
+		u_int8_t	macaddr[IEEE80211_ADDR_LEN];
+		u_int64_t	pad;
+	} is_u;
+	struct ieee80211req_sta_info info[1];	/* variable length */
+};
+
+/*
+ * Get/set per-station tx power cap.
+ */
+struct ieee80211req_sta_txpow {
+	u_int8_t	it_macaddr[IEEE80211_ADDR_LEN];
+	u_int8_t	it_txpow;
+};
+
+/*
+ * WME parameters are set and return using i_val and i_len.
+ * i_val holds the value itself.  i_len specifies the AC
+ * and, as appropriate, then high bit specifies whether the
+ * operation is to be applied to the BSS or ourself.
+ */
+#define	IEEE80211_WMEPARAM_SELF	0x0000		/* parameter applies to self */
+#define	IEEE80211_WMEPARAM_BSS	0x8000		/* parameter applies to BSS */
+#define	IEEE80211_WMEPARAM_VAL	0x7fff		/* parameter value */
+
+/*
+ * FreeBSD-style ioctls.
+ */
+/* the first member must be matched with struct ifreq */
+struct ieee80211req {
+	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
+	u_int16_t	i_type;			/* req type */
+	int16_t		i_val;			/* Index or simple value */
+	u_int16_t	i_len;			/* Index or simple value */
+	void		*i_data;		/* Extra data */
+};
+
+#ifdef __FreeBSD__
+#define	SIOCS80211		 _IOW('i', 234, struct ieee80211req)
+#define	SIOCG80211		_IOWR('i', 235, struct ieee80211req)
+#define	SIOCG80211STATS		_IOWR('i', 236, struct ifreq)
+#endif /* __FreeBSD__ */
+
+#if defined(__NetBSD__) || defined(__minix)
+#define	SIOCS80211		 _IOW('i', 244, struct ieee80211req)
+#define	SIOCG80211		_IOWR('i', 245, struct ieee80211req)
+#define	SIOCG80211STATS		_IOWR('i', 246, struct ifreq)
+#define	SIOCG80211ZSTATS	_IOWR('i', 247, struct ifreq)
+#ifdef COMPAT_20
+#define	OSIOCG80211STATS	_IOWR('i', 242, struct ifreq)
+#define	OSIOCG80211ZSTATS	_IOWR('i', 243, struct ifreq)
+#endif /* COMPAT_20 */
+#endif /* defined(__NetBSD__) || defined(__minix) */
+
+#if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
+#define IEEE80211_IOC_SSID		1
+#endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
+#define IEEE80211_IOC_NUMSSIDS		2
+#define IEEE80211_IOC_WEP		3
+#define 	IEEE80211_WEP_NOSUP	-1
+#define 	IEEE80211_WEP_OFF	0
+#define 	IEEE80211_WEP_ON	1
+#define 	IEEE80211_WEP_MIXED	2
+#if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
+#define IEEE80211_IOC_WEPKEY		4
+#endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
+#define IEEE80211_IOC_NUMWEPKEYS	5
+#if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
+#define IEEE80211_IOC_WEPTXKEY		6
+#endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
+#define IEEE80211_IOC_AUTHMODE		7
+#define IEEE80211_IOC_STATIONNAME	8
+#if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
+#define IEEE80211_IOC_CHANNEL		9
+#endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
+#define IEEE80211_IOC_POWERSAVE		10
+#define 	IEEE80211_POWERSAVE_NOSUP	-1
+#define 	IEEE80211_POWERSAVE_OFF		0
+#define 	IEEE80211_POWERSAVE_CAM		1
+#define 	IEEE80211_POWERSAVE_PSP		2
+#define 	IEEE80211_POWERSAVE_PSP_CAM	3
+#define 	IEEE80211_POWERSAVE_ON		IEEE80211_POWERSAVE_CAM
+#define IEEE80211_IOC_POWERSAVESLEEP	11
+#define	IEEE80211_IOC_RTSTHRESHOLD	12
+#define IEEE80211_IOC_PROTMODE		13
+#define 	IEEE80211_PROTMODE_OFF		0
+#define 	IEEE80211_PROTMODE_CTS		1
+#define 	IEEE80211_PROTMODE_RTSCTS	2
+#define	IEEE80211_IOC_TXPOWER		14	/* global tx power limit */
+#if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
+#define	IEEE80211_IOC_BSSID		15
+#endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
+#define	IEEE80211_IOC_ROAMING		16	/* roaming mode */
+#define	IEEE80211_IOC_PRIVACY		17	/* privacy invoked */
+#define	IEEE80211_IOC_DROPUNENCRYPTED	18	/* discard unencrypted frames */
+#define	IEEE80211_IOC_WPAKEY		19
+#define	IEEE80211_IOC_DELKEY		20
+#define	IEEE80211_IOC_MLME		21
+#define	IEEE80211_IOC_OPTIE		22	/* optional info. element */
+#define	IEEE80211_IOC_SCAN_REQ		23
+#define	IEEE80211_IOC_SCAN_RESULTS	24
+#define	IEEE80211_IOC_COUNTERMEASURES	25	/* WPA/TKIP countermeasures */
+#define	IEEE80211_IOC_WPA		26	/* WPA mode (0,1,2) */
+#define	IEEE80211_IOC_CHANLIST		27	/* channel list */
+#define	IEEE80211_IOC_WME		28	/* WME mode (on, off) */
+#define	IEEE80211_IOC_HIDESSID		29	/* hide SSID mode (on, off) */
+#define	IEEE80211_IOC_APBRIDGE		30	/* AP inter-sta bridging */
+#define	IEEE80211_IOC_MCASTCIPHER	31	/* multicast/default cipher */
+#define	IEEE80211_IOC_MCASTKEYLEN	32	/* multicast key length */
+#define	IEEE80211_IOC_UCASTCIPHERS	33	/* unicast cipher suites */
+#define	IEEE80211_IOC_UCASTCIPHER	34	/* unicast cipher */
+#define	IEEE80211_IOC_UCASTKEYLEN	35	/* unicast key length */
+#define	IEEE80211_IOC_DRIVER_CAPS	36	/* driver capabilities */
+#define	IEEE80211_IOC_KEYMGTALGS	37	/* key management algorithms */
+#define	IEEE80211_IOC_RSNCAPS		38	/* RSN capabilities */
+#define	IEEE80211_IOC_WPAIE		39	/* WPA information element */
+#define	IEEE80211_IOC_STA_STATS		40	/* per-station statistics */
+#define	IEEE80211_IOC_MACCMD		41	/* MAC ACL operation */
+#define	IEEE80211_IOC_CHANINFO		42	/* channel info list */
+#define	IEEE80211_IOC_TXPOWMAX		43	/* max tx power for channel */
+#define	IEEE80211_IOC_STA_TXPOW		44	/* per-station tx power limit */
+#define	IEEE80211_IOC_STA_INFO		45	/* station/neighbor info */
+#define	IEEE80211_IOC_WME_CWMIN		46	/* WME: ECWmin */
+#define	IEEE80211_IOC_WME_CWMAX		47	/* WME: ECWmax */
+#define	IEEE80211_IOC_WME_AIFS		48	/* WME: AIFSN */
+#define	IEEE80211_IOC_WME_TXOPLIMIT	49	/* WME: txops limit */
+#define	IEEE80211_IOC_WME_ACM		50	/* WME: ACM (bss only) */
+#define	IEEE80211_IOC_WME_ACKPOLICY	51	/* WME: ACK policy (!bss only)*/
+#define	IEEE80211_IOC_DTIM_PERIOD	52	/* DTIM period (beacons) */
+#define	IEEE80211_IOC_BEACON_INTERVAL	53	/* beacon interval (ms) */
+#define	IEEE80211_IOC_ADDMAC		54	/* add sta to MAC ACL table */
+#define	IEEE80211_IOC_DELMAC		55	/* del sta from MAC ACL table */
+#define	IEEE80211_IOC_PUREG		56	/* pure 11g (no 11b stations) */
+#define	IEEE80211_IOC_MCAST_RATE	72	/* tx rate for mcast frames */
+#define	IEEE80211_IOC_FRAGTHRESHOLD	73	/* tx fragmentation threshold */
+
+/*
+ * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.
+ */
+struct ieee80211req_scan_result {
+	u_int16_t	isr_len;		/* length (mult of 4) */
+	u_int16_t	isr_freq;		/* MHz */
+	u_int16_t	isr_flags;		/* channel flags */
+	u_int8_t	isr_noise;
+	u_int8_t	isr_rssi;
+	u_int8_t	isr_intval;		/* beacon interval */
+	u_int8_t	isr_capinfo;		/* capabilities */
+	u_int8_t	isr_erp;		/* ERP element */
+	u_int8_t	isr_bssid[IEEE80211_ADDR_LEN];
+	u_int8_t	isr_nrates;
+	u_int8_t	isr_rates[IEEE80211_RATE_MAXSIZE];
+	u_int8_t	isr_ssid_len;		/* SSID length */
+	u_int8_t	isr_ie_len;		/* IE length */
+	u_int8_t	isr_pad[5];
+	/* variable length SSID followed by IE data */
+};
+
+#if defined(__NetBSD__) || defined(__minix)
+/* nwid is pointed at by ifr.ifr_data */
+struct ieee80211_nwid {
+	u_int8_t	i_len;
+	u_int8_t	i_nwid[IEEE80211_NWID_LEN];
+};
+
+#define	SIOCS80211NWID		_IOWR('i', 230, struct ifreq)
+#define	SIOCG80211NWID		_IOWR('i', 231, struct ifreq)
+
+/* the first member must be matched with struct ifreq */
+struct ieee80211_nwkey {
+	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
+	int		i_wepon;		/* wep enabled flag */
+	int		i_defkid;		/* default encrypt key id */
+	struct {
+		int		i_keylen;
+		u_int8_t	*i_keydat;
+	}		i_key[IEEE80211_WEP_NKID];
+};
+#define	SIOCS80211NWKEY		 _IOW('i', 232, struct ieee80211_nwkey)
+#define	SIOCG80211NWKEY		_IOWR('i', 233, struct ieee80211_nwkey)
+/* i_wepon */
+#define	IEEE80211_NWKEY_OPEN	0		/* No privacy */
+#define	IEEE80211_NWKEY_WEP	1		/* WEP enabled */
+#define	IEEE80211_NWKEY_EAP	2		/* EAP enabled */
+#define	IEEE80211_NWKEY_PERSIST	0x100		/* designate persist keyset */
+
+/* power management parameters */
+struct ieee80211_power {
+	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
+	int		i_enabled;		/* 1 == on, 0 == off */
+	int		i_maxsleep;		/* max sleep in ms */
+};
+#define	SIOCS80211POWER		 _IOW('i', 234, struct ieee80211_power)
+#define	SIOCG80211POWER		_IOWR('i', 235, struct ieee80211_power)
+
+struct ieee80211_auth {
+	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
+	int		i_authtype;
+};
+
+#define	IEEE80211_AUTH_NONE	0
+#define	IEEE80211_AUTH_OPEN	1
+#define	IEEE80211_AUTH_SHARED	2
+
+#define	SIOCS80211AUTH		 _IOW('i', 236, struct ieee80211_auth)
+#define	SIOCG80211AUTH		_IOWR('i', 237, struct ieee80211_auth)
+
+struct ieee80211chanreq {
+	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
+	u_int16_t	i_channel;
+};
+
+#ifndef IEEE80211_CHAN_ANY
+#define	IEEE80211_CHAN_ANY	0xffff
+#endif
+
+#define	SIOCS80211CHANNEL	 _IOW('i', 238, struct ieee80211chanreq)
+#define	SIOCG80211CHANNEL	_IOWR('i', 239, struct ieee80211chanreq)
+
+struct ieee80211_bssid {
+	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
+	u_int8_t	i_bssid[IEEE80211_ADDR_LEN];
+};
+
+#define	SIOCS80211BSSID		 _IOW('i', 240, struct ieee80211_bssid)
+#define	SIOCG80211BSSID		_IOWR('i', 241, struct ieee80211_bssid)
+
+#endif /* defined(__NetBSD__) || defined(__minix) */
+
+#endif /* !_NET80211_IEEE80211_IOCTL_H_ */

Property changes on: lab4/.minix-src/include/net80211/ieee80211_ioctl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/icmp6.h
===================================================================
--- lab4/.minix-src/include/netinet/icmp6.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/icmp6.h	(revision 13)
@@ -0,0 +1,778 @@
+/*	$NetBSD: icmp6.h,v 1.47 2013/07/01 12:43:15 christos Exp $	*/
+/*	$KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $	*/
+
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ip_icmp.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_ICMP6_H_
+#define _NETINET_ICMP6_H_
+
+#define ICMPV6_PLD_MAXLEN	1232	/* IPV6_MMTU - sizeof(struct ip6_hdr)
+					   - sizeof(struct icmp6_hdr) */
+
+struct icmp6_hdr {
+	u_int8_t	icmp6_type;	/* type field */
+	u_int8_t	icmp6_code;	/* code field */
+	u_int16_t	icmp6_cksum;	/* checksum field */
+	union {
+		u_int32_t	icmp6_un_data32[1]; /* type-specific field */
+		u_int16_t	icmp6_un_data16[2]; /* type-specific field */
+		u_int8_t	icmp6_un_data8[4];  /* type-specific field */
+	} icmp6_dataun;
+} __packed;
+
+#define icmp6_data32	icmp6_dataun.icmp6_un_data32
+#define icmp6_data16	icmp6_dataun.icmp6_un_data16
+#define icmp6_data8	icmp6_dataun.icmp6_un_data8
+#define icmp6_pptr	icmp6_data32[0]		/* parameter prob */
+#define icmp6_mtu	icmp6_data32[0]		/* packet too big */
+#define icmp6_id	icmp6_data16[0]		/* echo request/reply */
+#define icmp6_seq	icmp6_data16[1]		/* echo request/reply */
+#define icmp6_maxdelay	icmp6_data16[0]		/* mcast group membership */
+
+#define ICMP6_DST_UNREACH		1	/* dest unreachable, codes: */
+#define ICMP6_PACKET_TOO_BIG		2	/* packet too big */
+#define ICMP6_TIME_EXCEEDED		3	/* time exceeded, code: */
+#define ICMP6_PARAM_PROB		4	/* ip6 header bad */
+
+#define ICMP6_ECHO_REQUEST		128	/* echo service */
+#define ICMP6_ECHO_REPLY		129	/* echo reply */
+#define MLD_LISTENER_QUERY		130 	/* multicast listener query */
+#define MLD_LISTENER_REPORT		131	/* multicast listener report */
+#define MLD_LISTENER_DONE		132	/* multicast listener done */
+#define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */
+
+/* RFC2292 decls */
+#define ICMP6_MEMBERSHIP_QUERY		130	/* group membership query */
+#define ICMP6_MEMBERSHIP_REPORT		131	/* group membership report */
+#define ICMP6_MEMBERSHIP_REDUCTION	132	/* group membership termination */
+
+#ifndef _KERNEL
+/* the followings are for backward compatibility to old KAME apps. */
+#define MLD6_LISTENER_QUERY	MLD_LISTENER_QUERY
+#define MLD6_LISTENER_REPORT	MLD_LISTENER_REPORT
+#define MLD6_LISTENER_DONE	MLD_LISTENER_DONE
+#endif
+
+#define ND_ROUTER_SOLICIT		133	/* router solicitation */
+#define ND_ROUTER_ADVERT		134	/* router advertisement */
+#define ND_NEIGHBOR_SOLICIT		135	/* neighbor solicitation */
+#define ND_NEIGHBOR_ADVERT		136	/* neighbor advertisement */
+#define ND_REDIRECT			137	/* redirect */
+
+#define ICMP6_ROUTER_RENUMBERING	138	/* router renumbering */
+
+#define ICMP6_WRUREQUEST		139	/* who are you request */
+#define ICMP6_WRUREPLY			140	/* who are you reply */
+#define ICMP6_FQDN_QUERY		139	/* FQDN query */
+#define ICMP6_FQDN_REPLY		140	/* FQDN reply */
+#define ICMP6_NI_QUERY			139	/* node information request */
+#define ICMP6_NI_REPLY			140	/* node information reply */
+#define MLDV2_LISTENER_REPORT		143	/* RFC3810 listener report */
+
+/* The definitions below are experimental. TBA */
+#define MLD_MTRACE_RESP			200	/* mtrace response(to sender) */
+#define MLD_MTRACE			201	/* mtrace messages */
+
+#ifndef _KERNEL
+/* the followings are for backward compatibility to old KAME apps. */
+#define MLD6_MTRACE_RESP	MLD_MTRACE_RESP
+#define MLD6_MTRACE		MLD_MTRACE
+#endif
+
+#define ICMP6_MAXTYPE			201
+
+#define ICMP6_DST_UNREACH_NOROUTE	0	/* no route to destination */
+#define ICMP6_DST_UNREACH_ADMIN	 	1	/* administratively prohibited */
+#define ICMP6_DST_UNREACH_NOTNEIGHBOR	2	/* not a neighbor(obsolete) */
+#define ICMP6_DST_UNREACH_BEYONDSCOPE	2	/* beyond scope of source address */
+#define ICMP6_DST_UNREACH_ADDR		3	/* address unreachable */
+#define ICMP6_DST_UNREACH_NOPORT	4	/* port unreachable */
+#define ICMP6_DST_UNREACH_POLICY	5	/* source address failed ingress/egress policy */
+#define ICMP6_DST_UNREACH_REJROUTE	6	/* reject route to destination */
+#define ICMP6_DST_UNREACH_SOURCERT	7	/* error in source routing header */
+
+#define ICMP6_TIME_EXCEED_TRANSIT 	0	/* ttl==0 in transit */
+#define ICMP6_TIME_EXCEED_REASSEMBLY	1	/* ttl==0 in reass */
+
+#define ICMP6_PARAMPROB_HEADER 	 	0	/* erroneous header field */
+#define ICMP6_PARAMPROB_NEXTHEADER	1	/* unrecognized next header */
+#define ICMP6_PARAMPROB_OPTION		2	/* unrecognized option */
+
+#define ICMP6_INFOMSG_MASK		0x80	/* all informational messages */
+
+#define ICMP6_NI_SUBJ_IPV6	0	/* Query Subject is an IPv6 address */
+#define ICMP6_NI_SUBJ_FQDN	1	/* Query Subject is a Domain name */
+#define ICMP6_NI_SUBJ_IPV4	2	/* Query Subject is an IPv4 address */
+
+#define ICMP6_NI_SUCCESS	0	/* node information successful reply */
+#define ICMP6_NI_REFUSED	1	/* node information request is refused */
+#define ICMP6_NI_UNKNOWN	2	/* unknown Qtype */
+
+#define ICMP6_ROUTER_RENUMBERING_COMMAND  0	/* rr command */
+#define ICMP6_ROUTER_RENUMBERING_RESULT   1	/* rr result */
+#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255	/* rr seq num reset */
+
+/* Used in kernel only */
+#define ND_REDIRECT_ONLINK	0	/* redirect to an on-link node */
+#define ND_REDIRECT_ROUTER	1	/* redirect to a better router */
+
+/*
+ * Multicast Listener Discovery
+ */
+struct mld_hdr {
+	struct icmp6_hdr	mld_icmp6_hdr;
+	struct in6_addr		mld_addr; /* multicast address */
+} __packed;
+
+/* definitions to provide backward compatibility to old KAME applications */
+#ifndef _KERNEL
+#define mld6_hdr	mld_hdr
+#define mld6_type	mld_type
+#define mld6_code	mld_code
+#define mld6_cksum	mld_cksum
+#define mld6_maxdelay	mld_maxdelay
+#define mld6_reserved	mld_reserved
+#define mld6_addr	mld_addr
+#endif
+
+/* shortcut macro definitions */
+#define mld_type	mld_icmp6_hdr.icmp6_type
+#define mld_code	mld_icmp6_hdr.icmp6_code
+#define mld_cksum	mld_icmp6_hdr.icmp6_cksum
+#define mld_maxdelay	mld_icmp6_hdr.icmp6_data16[0]
+#define mld_reserved	mld_icmp6_hdr.icmp6_data16[1]
+
+#define MLD_MINLEN			24
+
+/*
+ * Neighbor Discovery
+ */
+
+struct nd_router_solicit {	/* router solicitation */
+	struct icmp6_hdr 	nd_rs_hdr;
+	/* could be followed by options */
+} __packed;
+
+#define nd_rs_type	nd_rs_hdr.icmp6_type
+#define nd_rs_code	nd_rs_hdr.icmp6_code
+#define nd_rs_cksum	nd_rs_hdr.icmp6_cksum
+#define nd_rs_reserved	nd_rs_hdr.icmp6_data32[0]
+
+struct nd_router_advert {	/* router advertisement */
+	struct icmp6_hdr	nd_ra_hdr;
+	u_int32_t		nd_ra_reachable;	/* reachable time */
+	u_int32_t		nd_ra_retransmit;	/* retransmit timer */
+	/* could be followed by options */
+} __packed;
+
+#define nd_ra_type		nd_ra_hdr.icmp6_type
+#define nd_ra_code		nd_ra_hdr.icmp6_code
+#define nd_ra_cksum		nd_ra_hdr.icmp6_cksum
+#define nd_ra_curhoplimit	nd_ra_hdr.icmp6_data8[0]
+#define nd_ra_flags_reserved	nd_ra_hdr.icmp6_data8[1]
+#define ND_RA_FLAG_MANAGED	0x80
+#define ND_RA_FLAG_OTHER	0x40
+#define ND_RA_FLAG_HOME_AGENT	0x20
+
+/*
+ * Router preference values based on RFC4191.
+ */
+#define ND_RA_FLAG_RTPREF_MASK	0x18 /* 00011000 */
+
+#define ND_RA_FLAG_RTPREF_HIGH	0x08 /* 00001000 */
+#define ND_RA_FLAG_RTPREF_MEDIUM	0x00 /* 00000000 */
+#define ND_RA_FLAG_RTPREF_LOW	0x18 /* 00011000 */
+#define ND_RA_FLAG_RTPREF_RSV	0x10 /* 00010000 */
+
+#define nd_ra_router_lifetime	nd_ra_hdr.icmp6_data16[1]
+
+struct nd_neighbor_solicit {	/* neighbor solicitation */
+	struct icmp6_hdr	nd_ns_hdr;
+	struct in6_addr		nd_ns_target;	/*target address */
+	/* could be followed by options */
+} __packed;
+
+#define nd_ns_type		nd_ns_hdr.icmp6_type
+#define nd_ns_code		nd_ns_hdr.icmp6_code
+#define nd_ns_cksum		nd_ns_hdr.icmp6_cksum
+#define nd_ns_reserved		nd_ns_hdr.icmp6_data32[0]
+
+struct nd_neighbor_advert {	/* neighbor advertisement */
+	struct icmp6_hdr	nd_na_hdr;
+	struct in6_addr		nd_na_target;	/* target address */
+	/* could be followed by options */
+} __packed;
+
+#define nd_na_type		nd_na_hdr.icmp6_type
+#define nd_na_code		nd_na_hdr.icmp6_code
+#define nd_na_cksum		nd_na_hdr.icmp6_cksum
+#define nd_na_flags_reserved	nd_na_hdr.icmp6_data32[0]
+#if BYTE_ORDER == BIG_ENDIAN
+#define ND_NA_FLAG_ROUTER		0x80000000
+#define ND_NA_FLAG_SOLICITED		0x40000000
+#define ND_NA_FLAG_OVERRIDE		0x20000000
+#else
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define ND_NA_FLAG_ROUTER		0x80
+#define ND_NA_FLAG_SOLICITED		0x40
+#define ND_NA_FLAG_OVERRIDE		0x20
+#endif
+#endif
+
+struct nd_redirect {		/* redirect */
+	struct icmp6_hdr	nd_rd_hdr;
+	struct in6_addr		nd_rd_target;	/* target address */
+	struct in6_addr		nd_rd_dst;	/* destination address */
+	/* could be followed by options */
+} __packed;
+
+#define nd_rd_type		nd_rd_hdr.icmp6_type
+#define nd_rd_code		nd_rd_hdr.icmp6_code
+#define nd_rd_cksum		nd_rd_hdr.icmp6_cksum
+#define nd_rd_reserved		nd_rd_hdr.icmp6_data32[0]
+
+struct nd_opt_hdr {		/* Neighbor discovery option header */
+	u_int8_t	nd_opt_type;
+	u_int8_t	nd_opt_len;
+	/* followed by option specific data*/
+} __packed;
+
+#define ND_OPT_SOURCE_LINKADDR		1
+#define ND_OPT_TARGET_LINKADDR		2
+#define ND_OPT_PREFIX_INFORMATION	3
+#define ND_OPT_REDIRECTED_HEADER	4
+#define ND_OPT_MTU			5
+#define ND_OPT_ADVINTERVAL		7
+#define ND_OPT_HOMEAGENT_INFO		8
+#define ND_OPT_SOURCE_ADDRLIST		9
+#define ND_OPT_TARGET_ADDRLIST		10
+#define ND_OPT_MAP			23	/* RFC 5380 */
+#define ND_OPT_ROUTE_INFO		24	/* RFC 4191 */
+#define ND_OPT_RDNSS			25	/* RFC 6016 */
+#define ND_OPT_DNSSL			31	/* RFC 6016 */
+
+struct nd_opt_route_info {	/* route info */
+	u_int8_t	nd_opt_rti_type;
+	u_int8_t	nd_opt_rti_len;
+	u_int8_t	nd_opt_rti_prefixlen;
+	u_int8_t	nd_opt_rti_flags;
+	u_int32_t	nd_opt_rti_lifetime;
+	/* prefix follows */
+};
+
+struct nd_opt_prefix_info {	/* prefix information */
+	u_int8_t	nd_opt_pi_type;
+	u_int8_t	nd_opt_pi_len;
+	u_int8_t	nd_opt_pi_prefix_len;
+	u_int8_t	nd_opt_pi_flags_reserved;
+	u_int32_t	nd_opt_pi_valid_time;
+	u_int32_t	nd_opt_pi_preferred_time;
+	u_int32_t	nd_opt_pi_reserved2;
+	struct in6_addr	nd_opt_pi_prefix;
+} __packed;
+
+#define ND_OPT_PI_FLAG_ONLINK		0x80
+#define ND_OPT_PI_FLAG_AUTO		0x40
+
+struct nd_opt_rd_hdr {		/* redirected header */
+	u_int8_t	nd_opt_rh_type;
+	u_int8_t	nd_opt_rh_len;
+	u_int16_t	nd_opt_rh_reserved1;
+	u_int32_t	nd_opt_rh_reserved2;
+	/* followed by IP header and data */
+} __packed;
+
+struct nd_opt_mtu {		/* MTU option */
+	u_int8_t	nd_opt_mtu_type;
+	u_int8_t	nd_opt_mtu_len;
+	u_int16_t	nd_opt_mtu_reserved;
+	u_int32_t	nd_opt_mtu_mtu;
+} __packed;
+
+struct nd_opt_rdnss {		/* RDNSS option RFC 6106 */
+	u_int8_t	nd_opt_rdnss_type;
+	u_int8_t	nd_opt_rdnss_len;
+	u_int16_t	nd_opt_rdnss_reserved;
+	u_int32_t	nd_opt_rdnss_lifetime;
+	/* followed by list of IP prefixes */
+} __packed;
+
+struct nd_opt_dnssl {		/* DNSSL option RFC 6106 */
+	u_int8_t	nd_opt_dnssl_type;
+	u_int8_t	nd_opt_dnssl_len;
+	u_int16_t	nd_opt_dnssl_reserved;
+	u_int32_t	nd_opt_dnssl_lifetime;
+	/* followed by list of IP prefixes */
+} __packed;
+
+/*
+ * icmp6 namelookup
+ */
+
+struct icmp6_namelookup {
+	struct icmp6_hdr 	icmp6_nl_hdr;
+	u_int8_t	icmp6_nl_nonce[8];
+	int32_t		icmp6_nl_ttl;
+#if 0
+	u_int8_t	icmp6_nl_len;
+	u_int8_t	icmp6_nl_name[3];
+#endif
+	/* could be followed by options */
+} __packed;
+
+/*
+ * icmp6 node information
+ */
+struct icmp6_nodeinfo {
+	struct icmp6_hdr icmp6_ni_hdr;
+	u_int8_t icmp6_ni_nonce[8];
+	/* could be followed by reply data */
+} __packed;
+
+#define ni_type		icmp6_ni_hdr.icmp6_type
+#define ni_code		icmp6_ni_hdr.icmp6_code
+#define ni_cksum	icmp6_ni_hdr.icmp6_cksum
+#define ni_qtype	icmp6_ni_hdr.icmp6_data16[0]
+#define ni_flags	icmp6_ni_hdr.icmp6_data16[1]
+
+#define NI_QTYPE_NOOP		0 /* NOOP  */
+#define NI_QTYPE_SUPTYPES	1 /* Supported Qtypes */
+#define NI_QTYPE_FQDN		2 /* FQDN (draft 04) */
+#define NI_QTYPE_DNSNAME	2 /* DNS Name */
+#define NI_QTYPE_NODEADDR	3 /* Node Addresses */
+#define NI_QTYPE_IPV4ADDR	4 /* IPv4 Addresses */
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define NI_SUPTYPE_FLAG_COMPRESS	0x1
+#define NI_FQDN_FLAG_VALIDTTL		0x1
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define NI_SUPTYPE_FLAG_COMPRESS	0x0100
+#define NI_FQDN_FLAG_VALIDTTL		0x0100
+#endif
+
+#ifdef NAME_LOOKUPS_04
+#if BYTE_ORDER == BIG_ENDIAN
+#define NI_NODEADDR_FLAG_LINKLOCAL	0x1
+#define NI_NODEADDR_FLAG_SITELOCAL	0x2
+#define NI_NODEADDR_FLAG_GLOBAL		0x4
+#define NI_NODEADDR_FLAG_ALL		0x8
+#define NI_NODEADDR_FLAG_TRUNCATE	0x10
+#define NI_NODEADDR_FLAG_ANYCAST	0x20 /* just experimental. not in spec */
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define NI_NODEADDR_FLAG_LINKLOCAL	0x0100
+#define NI_NODEADDR_FLAG_SITELOCAL	0x0200
+#define NI_NODEADDR_FLAG_GLOBAL		0x0400
+#define NI_NODEADDR_FLAG_ALL		0x0800
+#define NI_NODEADDR_FLAG_TRUNCATE	0x1000
+#define NI_NODEADDR_FLAG_ANYCAST	0x2000 /* just experimental. not in spec */
+#endif
+#else  /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
+#if BYTE_ORDER == BIG_ENDIAN
+#define NI_NODEADDR_FLAG_TRUNCATE	0x1
+#define NI_NODEADDR_FLAG_ALL		0x2
+#define NI_NODEADDR_FLAG_COMPAT		0x4
+#define NI_NODEADDR_FLAG_LINKLOCAL	0x8
+#define NI_NODEADDR_FLAG_SITELOCAL	0x10
+#define NI_NODEADDR_FLAG_GLOBAL		0x20
+#define NI_NODEADDR_FLAG_ANYCAST	0x40 /* just experimental. not in spec */
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define NI_NODEADDR_FLAG_TRUNCATE	0x0100
+#define NI_NODEADDR_FLAG_ALL		0x0200
+#define NI_NODEADDR_FLAG_COMPAT		0x0400
+#define NI_NODEADDR_FLAG_LINKLOCAL	0x0800
+#define NI_NODEADDR_FLAG_SITELOCAL	0x1000
+#define NI_NODEADDR_FLAG_GLOBAL		0x2000
+#define NI_NODEADDR_FLAG_ANYCAST	0x4000 /* just experimental. not in spec */
+#endif
+#endif
+
+struct ni_reply_fqdn {
+	u_int32_t ni_fqdn_ttl;	/* TTL */
+	u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
+	u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
+} __packed;
+
+/*
+ * Router Renumbering. as router-renum-08.txt
+ */
+struct icmp6_router_renum {	/* router renumbering header */
+	struct icmp6_hdr	rr_hdr;
+	u_int8_t	rr_segnum;
+	u_int8_t	rr_flags;
+	u_int16_t	rr_maxdelay;
+	u_int32_t	rr_reserved;
+} __packed;
+
+#define ICMP6_RR_FLAGS_TEST		0x80
+#define ICMP6_RR_FLAGS_REQRESULT	0x40
+#define ICMP6_RR_FLAGS_FORCEAPPLY	0x20
+#define ICMP6_RR_FLAGS_SPECSITE		0x10
+#define ICMP6_RR_FLAGS_PREVDONE		0x08
+
+#define rr_type		rr_hdr.icmp6_type
+#define rr_code		rr_hdr.icmp6_code
+#define rr_cksum	rr_hdr.icmp6_cksum
+#define rr_seqnum 	rr_hdr.icmp6_data32[0]
+
+struct rr_pco_match {		/* match prefix part */
+	u_int8_t	rpm_code;
+	u_int8_t	rpm_len;
+	u_int8_t	rpm_ordinal;
+	u_int8_t	rpm_matchlen;
+	u_int8_t	rpm_minlen;
+	u_int8_t	rpm_maxlen;
+	u_int16_t	rpm_reserved;
+	struct	in6_addr	rpm_prefix;
+} __packed;
+
+#define RPM_PCO_ADD		1
+#define RPM_PCO_CHANGE		2
+#define RPM_PCO_SETGLOBAL	3
+#define RPM_PCO_MAX		4
+
+struct rr_pco_use {		/* use prefix part */
+	u_int8_t	rpu_uselen;
+	u_int8_t	rpu_keeplen;
+	u_int8_t	rpu_ramask;
+	u_int8_t	rpu_raflags;
+	u_int32_t	rpu_vltime;
+	u_int32_t	rpu_pltime;
+	u_int32_t	rpu_flags;
+	struct	in6_addr rpu_prefix;
+} __packed;
+#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK	0x80
+#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO	0x40
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80000000
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40000000
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40
+#endif
+
+struct rr_result {		/* router renumbering result message */
+	u_int16_t	rrr_flags;
+	u_int8_t	rrr_ordinal;
+	u_int8_t	rrr_matchedlen;
+	u_int32_t	rrr_ifid;
+	struct	in6_addr rrr_prefix;
+} __packed;
+#if BYTE_ORDER == BIG_ENDIAN
+#define ICMP6_RR_RESULT_FLAGS_OOB		0x0002
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0001
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define ICMP6_RR_RESULT_FLAGS_OOB		0x0200
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0100
+#endif
+
+/*
+ * icmp6 filter structures.
+ */
+
+struct icmp6_filter {
+	u_int32_t icmp6_filt[8];
+};
+
+#define	ICMP6_FILTER_SETPASSALL(filterp) \
+	(void)memset(filterp, 0xff, sizeof(struct icmp6_filter))
+#define	ICMP6_FILTER_SETBLOCKALL(filterp) \
+	(void)memset(filterp, 0x00, sizeof(struct icmp6_filter))
+#define	ICMP6_FILTER_SETPASS(type, filterp) \
+	(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
+#define	ICMP6_FILTER_SETBLOCK(type, filterp) \
+	(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
+#define	ICMP6_FILTER_WILLPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+#define	ICMP6_FILTER_WILLBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+
+/*
+ * Variables related to this implementation
+ * of the internet control message protocol version 6.
+ */
+
+/*
+ * IPv6 ICMP statistics.
+ * Each counter is an unsigned 64-bit value.
+ */
+#define	ICMP6_STAT_ERROR	0	/* # of calls to icmp6_error */
+#define	ICMP6_STAT_CANTERROR	1	/* no error (old was icmp) */
+#define	ICMP6_STAT_TOOFREQ	2	/* no error (rate limitation) */
+#define	ICMP6_STAT_OUTHIST	3	/* # of output messages */
+		/* space for 256 counters */
+#define	ICMP6_STAT_BADCODE	259	/* icmp6_code out of range */
+#define	ICMP6_STAT_TOOSHORT	260	/* packet < sizeof(struct icmp6_hdr) */
+#define	ICMP6_STAT_CHECKSUM	261	/* bad checksum */
+#define	ICMP6_STAT_BADLEN	262	/* calculated bound mismatch */
+	/*
+	 * number of responses; this member is inherited from the netinet code,
+	 * but for netinet6 code, it is already available in outhist[].
+	 */
+#define	ICMP6_STAT_REFLECT	263
+#define	ICMP6_STAT_INHIST	264	/* # of input messages */
+		/* space for 256 counters */
+#define	ICMP6_STAT_ND_TOOMANYOPT 520	/* too many ND options */
+#define	ICMP6_STAT_OUTERRHIST	521
+		/* space for 13 counters */
+#define	ICMP6_STAT_PMTUCHG	534	/* path MTU changes */
+#define	ICMP6_STAT_ND_BADOPT	535	/* bad ND options */
+#define	ICMP6_STAT_BADNS	536	/* bad neighbor solicititation */
+#define	ICMP6_STAT_BADNA	537	/* bad neighbor advertisement */
+#define	ICMP6_STAT_BADRS	538	/* bad router solicitiation */
+#define	ICMP6_STAT_BADRA	539	/* bad router advertisement */
+#define	ICMP6_STAT_BADREDIRECT	540	/* bad redirect message */
+#define ICMP6_STAT_DROPPED_RAROUTE 541	/* discarded routes from router advertisement */
+
+#define	ICMP6_NSTATS		542
+
+#define	ICMP6_ERRSTAT_DST_UNREACH_NOROUTE	0
+#define	ICMP6_ERRSTAT_DST_UNREACH_ADMIN		1
+#define	ICMP6_ERRSTAT_DST_UNREACH_BEYONDSCOPE	2
+#define	ICMP6_ERRSTAT_DST_UNREACH_ADDR		3
+#define	ICMP6_ERRSTAT_DST_UNREACH_NOPORT	4
+#define	ICMP6_ERRSTAT_PACKET_TOO_BIG		5
+#define	ICMP6_ERRSTAT_TIME_EXCEED_TRANSIT	6
+#define	ICMP6_ERRSTAT_TIME_EXCEED_REASSEMBLY	7
+#define	ICMP6_ERRSTAT_PARAMPROB_HEADER		8
+#define	ICMP6_ERRSTAT_PARAMPROB_NEXTHEADER	9
+#define	ICMP6_ERRSTAT_PARAMPROB_OPTION		10
+#define	ICMP6_ERRSTAT_REDIRECT			11
+#define	ICMP6_ERRSTAT_UNKNOWN			12
+
+/*
+ * Names for ICMP sysctl objects
+ */
+#define ICMPV6CTL_STATS		1
+#define ICMPV6CTL_REDIRACCEPT	2	/* accept/process redirects */
+#define ICMPV6CTL_REDIRTIMEOUT	3	/* redirect cache time */
+#if 0	/*obsoleted*/
+#define ICMPV6CTL_ERRRATELIMIT	5	/* ICMPv6 error rate limitation */
+#endif
+#define ICMPV6CTL_ND6_PRUNE	6
+#define ICMPV6CTL_ND6_DELAY	8
+#define ICMPV6CTL_ND6_UMAXTRIES	9
+#define ICMPV6CTL_ND6_MMAXTRIES		10
+#define ICMPV6CTL_ND6_USELOOPBACK	11
+/*#define ICMPV6CTL_ND6_PROXYALL	12	obsoleted, do not reuse here */
+#define ICMPV6CTL_NODEINFO	13
+#define ICMPV6CTL_ERRPPSLIMIT	14	/* ICMPv6 error pps limitation */
+#define ICMPV6CTL_ND6_MAXNUDHINT	15
+#define ICMPV6CTL_MTUDISC_HIWAT	16
+#define ICMPV6CTL_MTUDISC_LOWAT	17
+#define ICMPV6CTL_ND6_DEBUG	18
+#define ICMPV6CTL_ND6_DRLIST	19
+#define ICMPV6CTL_ND6_PRLIST	20
+#define	ICMPV6CTL_ND6_MAXQLEN	24
+#define ICMPV6CTL_MAXID		25
+
+#define ICMPV6CTL_NAMES { \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "rediraccept", CTLTYPE_INT }, \
+	{ "redirtimeout", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "nd6_prune", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ "nd6_delay", CTLTYPE_INT }, \
+	{ "nd6_umaxtries", CTLTYPE_INT }, \
+	{ "nd6_mmaxtries", CTLTYPE_INT }, \
+	{ "nd6_useloopback", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ "nodeinfo", CTLTYPE_INT }, \
+	{ "errppslimit", CTLTYPE_INT }, \
+	{ "nd6_maxnudhint", CTLTYPE_INT }, \
+	{ "mtudisc_hiwat", CTLTYPE_INT }, \
+	{ "mtudisc_lowat", CTLTYPE_INT }, \
+	{ "nd6_debug", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "nd6_maxqueuelen", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+struct	rtentry;
+struct	rttimer;
+struct	in6_multi;
+
+void	icmp6_init(void);
+void	icmp6_paramerror(struct mbuf *, int);
+void	icmp6_error(struct mbuf *, int, int, int);
+void	icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
+int	icmp6_input(struct mbuf **, int *, int);
+void	icmp6_fasttimo(void);
+void	icmp6_reflect(struct mbuf *, size_t);
+void	icmp6_prepare(struct mbuf *);
+void	icmp6_redirect_input(struct mbuf *, int);
+void	icmp6_redirect_output(struct mbuf *, struct rtentry *);
+int	icmp6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
+
+void	icmp6_statinc(u_int);
+
+struct	ip6ctlparam;
+void	icmp6_mtudisc_update(struct ip6ctlparam *, int);
+void	icmp6_mtudisc_callback_register(void (*)(struct in6_addr *));
+
+/* XXX: is this the right place for these macros? */
+#define icmp6_ifstat_inc(ifp, tag) \
+do {								\
+	if (ifp)						\
+		((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat->tag++; \
+} while (/*CONSTCOND*/ 0)
+
+#define icmp6_ifoutstat_inc(ifp, type, code) \
+do { \
+		icmp6_ifstat_inc(ifp, ifs6_out_msg); \
+		switch(type) { \
+		 case ICMP6_DST_UNREACH: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
+			 if (code == ICMP6_DST_UNREACH_ADMIN) \
+				 icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
+			 break; \
+		 case ICMP6_PACKET_TOO_BIG: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
+			 break; \
+		 case ICMP6_TIME_EXCEEDED: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
+			 break; \
+		 case ICMP6_PARAM_PROB: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
+			 break; \
+		 case ICMP6_ECHO_REQUEST: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_echo); \
+			 break; \
+		 case ICMP6_ECHO_REPLY: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
+			 break; \
+		 case MLD_LISTENER_QUERY: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
+			 break; \
+		 case MLD_LISTENER_REPORT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
+			 break; \
+		 case MLD_LISTENER_DONE: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
+			 break; \
+		 case ND_ROUTER_SOLICIT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
+			 break; \
+		 case ND_ROUTER_ADVERT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
+			 break; \
+		 case ND_NEIGHBOR_SOLICIT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
+			 break; \
+		 case ND_NEIGHBOR_ADVERT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
+			 break; \
+		 case ND_REDIRECT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
+			 break; \
+		} \
+} while (/*CONSTCOND*/ 0)
+
+extern int	icmp6_rediraccept;	/* accept/process redirects */
+extern int	icmp6_redirtimeout;	/* cache time for redirect routes */
+#endif /* _KERNEL */
+
+#ifdef ICMP6_STRINGS
+/* Info: http://www.iana.org/assignments/icmpv6-parameters */
+
+static const char * const icmp6_type_err[] = {
+	"reserved0", "unreach", "packet_too_big", "timxceed", "paramprob",
+	NULL
+};
+
+static const char * const icmp6_type_info[] = {
+	"echo", "echoreply",
+	"mcastlistenq", "mcastlistenrep", "mcastlistendone",
+	"rtsol", "rtadv", "neighsol", "neighadv", "redirect",
+	"routerrenum", "nodeinfoq", "nodeinfor", "invneighsol", "invneighrep",
+	"mcastlistenrep2", "haad_req", "haad_rep",
+	"mobile_psol", "mobile_padv", "cga_sol", "cga_adv",
+	"experimental150", "mcast_rtadv", "mcast_rtsol", "mcast_rtterm",
+	"fmipv6_msg", "rpl_control", NULL
+};
+
+static const char * const icmp6_code_none[] = { "none", NULL };
+
+static const char * const icmp6_code_unreach[] = {
+	"noroute", "admin", "beyondscope", "addr", "port",
+	"srcaddr_policy", "reject_route", "source_route_err", NULL
+};
+
+static const char * const icmp6_code_timxceed[] = {
+	"intrans", "reass", NULL
+};
+
+static const char * const icmp6_code_paramprob[] = {
+	"hdr_field", "nxthdr_type", "option", NULL
+};      
+
+/* not all informational icmps that have codes have a names array */
+#endif
+
+#endif /* !_NETINET_ICMP6_H_ */

Property changes on: lab4/.minix-src/include/netinet/icmp6.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/igmp.h
===================================================================
--- lab4/.minix-src/include/netinet/igmp.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/igmp.h	(revision 13)
@@ -0,0 +1,129 @@
+/*	$NetBSD: igmp.h,v 1.12 2014/05/29 23:02:48 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Stephen Deering of Stanford University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)igmp.h	8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * Copyright (c) 1988 Stephen Deering.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Stephen Deering of Stanford University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)igmp.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IGMP_H_
+#define _NETINET_IGMP_H_
+
+/*
+ * Internet Group Management Protocol (IGMP) definitions.
+ *
+ * MULTICAST 1.3
+ */
+
+/*
+ * IGMP packet format.
+ */
+struct igmp {
+	uint8_t		igmp_type;	/* version & type of IGMP message  */
+	uint8_t		igmp_code;	/* code for routing sub-messages   */
+	uint16_t	igmp_cksum;	/* IP-style checksum               */
+	struct in_addr	igmp_group;	/* group address being reported    */
+} __packed;		/*  (zero for queries)             */
+
+#define	IGMP_MINLEN			8
+
+#define	IGMP_HOST_MEMBERSHIP_QUERY	0x11  /* membership query      */
+#define	IGMP_v1_HOST_MEMBERSHIP_REPORT	0x12  /* v1 membership report  */
+#define	IGMP_DVMRP			0x13  /* DVMRP routing message */
+#define	IGMP_PIM			0x14  /* PIM routing message   */
+#define	IGMP_v2_HOST_MEMBERSHIP_REPORT	0x16  /* v2 membership report  */
+#define	IGMP_HOST_LEAVE_MESSAGE		0x17  /* leave-group message   */
+#define	IGMP_MTRACE_REPLY		0x1e  /* traceroute reply      */
+#define	IGMP_MTRACE_QUERY		0x1f  /* traceroute query      */
+
+#define	IGMP_MAX_HOST_REPORT_DELAY	10    /* max delay for response to */
+					      /*  query (in seconds)       */
+
+#define	IGMP_TIMER_SCALE		10    /* denominator for igmp_timer */
+
+/*
+ * States for the IGMP v2 state table.
+ */
+#define	IGMP_DELAYING_MEMBER	1
+#define	IGMP_IDLE_MEMBER	2
+#define	IGMP_LAZY_MEMBER	3
+#define	IGMP_SLEEPING_MEMBER	4
+#define	IGMP_AWAKENING_MEMBER	5
+
+/*
+ * States for IGMP router version cache.
+ */
+#define	IGMP_v1_ROUTER		1
+#define	IGMP_v2_ROUTER		2
+
+/*
+ * Revert to v2 if we haven't heard from the router in this amount of time.
+ */
+#define	IGMP_AGE_THRESHOLD	540
+
+#endif /* !_NETINET_IGMP_H_ */

Property changes on: lab4/.minix-src/include/netinet/igmp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/in_pcb_hdr.h
===================================================================
--- lab4/.minix-src/include/netinet/in_pcb_hdr.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/in_pcb_hdr.h	(revision 13)
@@ -0,0 +1,133 @@
+/*	$NetBSD: in_pcb_hdr.h,v 1.11 2014/05/30 01:39:03 christos Exp $	*/
+
+/*
+ * Copyright (C) 2003 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)in_pcb.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IN_PCB_HDR_H_
+#define _NETINET_IN_PCB_HDR_H_
+
+#include <sys/queue.h>
+
+struct inpcbpolicy;
+
+/*
+ * align it with inpcb and in6pcb!
+ */
+struct inpcb_hdr {
+	LIST_ENTRY(inpcb_hdr) inph_hash;
+	LIST_ENTRY(inpcb_hdr) inph_lhash;
+	TAILQ_ENTRY(inpcb_hdr) inph_queue;
+	int	  inph_af;		/* address family - AF_INET */
+	void *	  inph_ppcb;		/* pointer to per-protocol pcb */
+	int	  inph_state;		/* bind/connect state */
+	int       inph_portalgo;
+	struct	  socket *inph_socket;	/* back pointer to socket */
+	struct	  inpcbtable *inph_table;
+	struct	  inpcbpolicy *inph_sp;	/* security policy */
+};
+
+#define	sotoinpcb_hdr(so)	((struct inpcb_hdr *)(so)->so_pcb)
+
+LIST_HEAD(inpcbhead, inpcb_hdr);
+
+struct vestigial_inpcb;
+
+/* Hooks for vestigial pcb entries.
+ * If vestigial entries exist for a table (TCP only)
+ * the vestigial pointer is set.
+ */
+typedef struct vestigial_hooks {
+	/* IPv4 hooks */
+	void	*(*init_ports4)(struct in_addr, u_int, int);
+	int	(*next_port4)(void *, struct vestigial_inpcb *);
+	int	(*lookup4)(struct in_addr, uint16_t,
+			   struct in_addr, uint16_t,
+			   struct vestigial_inpcb *);
+	/* IPv6 hooks */
+	void	*(*init_ports6)(const struct in6_addr*, u_int, int);
+	int	(*next_port6)(void *, struct vestigial_inpcb *);
+	int	(*lookup6)(const struct in6_addr *, uint16_t,
+			   const struct in6_addr *, uint16_t,
+			   struct vestigial_inpcb *);
+} vestigial_hooks_t;
+
+TAILQ_HEAD(inpcbqueue, inpcb_hdr);
+
+struct inpcbtable {
+	struct	  inpcbqueue inpt_queue;
+	struct	  inpcbhead *inpt_porthashtbl;
+	struct	  inpcbhead *inpt_bindhashtbl;
+	struct	  inpcbhead *inpt_connecthashtbl;
+	u_long	  inpt_porthash;
+	u_long	  inpt_bindhash;
+	u_long	  inpt_connecthash;
+	u_int16_t inpt_lastport;
+	u_int16_t inpt_lastlow;
+
+	vestigial_hooks_t *vestige;
+};
+#define inpt_lasthi inpt_lastport
+
+/* states in inp_state: */
+#define	INP_ATTACHED		0
+#define	INP_BOUND		1
+#define	INP_CONNECTED		2
+
+#endif /* !_NETINET_IN_PCB_HDR_H_ */

Property changes on: lab4/.minix-src/include/netinet/in_pcb_hdr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/ip6.h
===================================================================
--- lab4/.minix-src/include/netinet/ip6.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/ip6.h	(revision 13)
@@ -0,0 +1,319 @@
+/*	$NetBSD: ip6.h,v 1.23 2007/12/25 18:33:46 perry Exp $	*/
+/*	$KAME: ip6.h,v 1.45 2003/06/05 04:46:38 keiichi Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ip.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IP6_H_
+#define _NETINET_IP6_H_
+
+/*
+ * Definition for internet protocol version 6.
+ * RFC 2460
+ */
+
+struct ip6_hdr {
+	union {
+		struct ip6_hdrctl {
+			u_int32_t ip6_un1_flow;	/* 20 bits of flow-ID */
+			u_int16_t ip6_un1_plen;	/* payload length */
+			u_int8_t  ip6_un1_nxt;	/* next header */
+			u_int8_t  ip6_un1_hlim;	/* hop limit */
+		} ip6_un1;
+		u_int8_t ip6_un2_vfc;	/* 4 bits version, top 4 bits class */
+	} ip6_ctlun;
+	struct in6_addr ip6_src;	/* source address */
+	struct in6_addr ip6_dst;	/* destination address */
+} __packed;
+
+#define ip6_vfc		ip6_ctlun.ip6_un2_vfc
+#define ip6_flow	ip6_ctlun.ip6_un1.ip6_un1_flow
+#define ip6_plen	ip6_ctlun.ip6_un1.ip6_un1_plen
+#define ip6_nxt		ip6_ctlun.ip6_un1.ip6_un1_nxt
+#define ip6_hlim	ip6_ctlun.ip6_un1.ip6_un1_hlim
+#define ip6_hops	ip6_ctlun.ip6_un1.ip6_un1_hlim
+
+#define IPV6_VERSION		0x60
+#define IPV6_VERSION_MASK	0xf0
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define IPV6_FLOWINFO_MASK	0x0fffffff	/* flow info (28 bits) */
+#define IPV6_FLOWLABEL_MASK	0x000fffff	/* flow label (20 bits) */
+#else
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define IPV6_FLOWINFO_MASK	0xffffff0f	/* flow info (28 bits) */
+#define IPV6_FLOWLABEL_MASK	0xffff0f00	/* flow label (20 bits) */
+#endif /* LITTLE_ENDIAN */
+#endif
+#if 1
+/* ECN bits proposed by Sally Floyd */
+#define IP6TOS_CE		0x01	/* congestion experienced */
+#define IP6TOS_ECT		0x02	/* ECN-capable transport */
+#endif
+
+#ifdef _KERNEL
+/*
+ * for IPv6 pseudo header checksum
+ * XXX nonstandard
+ */
+struct ip6_hdr_pseudo {
+	struct in6_addr ip6ph_src;
+	struct in6_addr ip6ph_dst;
+	u_int32_t	ip6ph_len;
+	u_int8_t	ip6ph_zero[3];
+	u_int8_t	ip6ph_nxt;
+} __packed;
+#endif
+
+/*
+ * Extension Headers
+ */
+
+struct	ip6_ext {
+	u_int8_t ip6e_nxt;
+	u_int8_t ip6e_len;
+} __packed;
+
+/* Hop-by-Hop options header */
+/* XXX should we pad it to force alignment on an 8-byte boundary? */
+struct ip6_hbh {
+	u_int8_t ip6h_nxt;	/* next header */
+	u_int8_t ip6h_len;	/* length in units of 8 octets */
+	/* followed by options */
+} __packed;
+
+/* Destination options header */
+/* XXX should we pad it to force alignment on an 8-byte boundary? */
+struct ip6_dest {
+	u_int8_t ip6d_nxt;	/* next header */
+	u_int8_t ip6d_len;	/* length in units of 8 octets */
+	/* followed by options */
+} __packed;
+
+/* Option types and related macros */
+#define IP6OPT_PAD1		0x00	/* 00 0 00000 */
+#define IP6OPT_PADN		0x01	/* 00 0 00001 */
+#define IP6OPT_JUMBO		0xC2	/* 11 0 00010 = 194 */
+#define IP6OPT_NSAP_ADDR	0xC3	/* 11 0 00011 */
+#define IP6OPT_TUNNEL_LIMIT	0x04	/* 00 0 00100 */
+#define IP6OPT_RTALERT		0x05	/* 00 0 00101 (KAME definition) */
+#define IP6OPT_ROUTER_ALERT	0x05	/* (RFC3542 def, recommended) */
+
+#define IP6OPT_RTALERT_LEN	4
+#define IP6OPT_RTALERT_MLD	0	/* Datagram contains an MLD message */
+#define IP6OPT_RTALERT_RSVP	1	/* Datagram contains an RSVP message */
+#define IP6OPT_RTALERT_ACTNET	2 	/* contains an Active Networks msg */
+#define IP6OPT_MINLEN		2
+
+#define IP6OPT_TYPE(o)		((o) & 0xC0)
+#define IP6OPT_TYPE_SKIP	0x00
+#define IP6OPT_TYPE_DISCARD	0x40
+#define IP6OPT_TYPE_FORCEICMP	0x80
+#define IP6OPT_TYPE_ICMP	0xC0
+
+#define IP6OPT_MUTABLE		0x20
+
+/* IPv6 options: common part */
+struct ip6_opt {
+	u_int8_t ip6o_type;
+	u_int8_t ip6o_len;
+} __packed;
+
+/* Jumbo Payload Option */
+struct ip6_opt_jumbo {
+	u_int8_t ip6oj_type;
+	u_int8_t ip6oj_len;
+	u_int8_t ip6oj_jumbo_len[4];
+} __packed;
+#define IP6OPT_JUMBO_LEN 6
+
+/* NSAP Address Option */
+struct ip6_opt_nsap {
+	u_int8_t ip6on_type;
+	u_int8_t ip6on_len;
+	u_int8_t ip6on_src_nsap_len;
+	u_int8_t ip6on_dst_nsap_len;
+	/* followed by source NSAP */
+	/* followed by destination NSAP */
+} __packed;
+
+/* Tunnel Limit Option */
+struct ip6_opt_tunnel {
+	u_int8_t ip6ot_type;
+	u_int8_t ip6ot_len;
+	u_int8_t ip6ot_encap_limit;
+} __packed;
+
+/* Router Alert Option */
+struct ip6_opt_router {
+	u_int8_t ip6or_type;
+	u_int8_t ip6or_len;
+	u_int8_t ip6or_value[2];
+} __packed;
+/* Router alert values (in network byte order) */
+#if BYTE_ORDER == BIG_ENDIAN
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0001
+#define IP6_ALERT_AN	0x0002
+#else
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0100
+#define IP6_ALERT_AN	0x0200
+#endif /* LITTLE_ENDIAN */
+#endif
+
+/* Routing header */
+struct ip6_rthdr {
+	u_int8_t  ip6r_nxt;	/* next header */
+	u_int8_t  ip6r_len;	/* length in units of 8 octets */
+	u_int8_t  ip6r_type;	/* routing type */
+	u_int8_t  ip6r_segleft;	/* segments left */
+	/* followed by routing type specific data */
+} __packed;
+
+/* Type 0 Routing header */
+struct ip6_rthdr0 {
+	u_int8_t  ip6r0_nxt;		/* next header */
+	u_int8_t  ip6r0_len;		/* length in units of 8 octets */
+	u_int8_t  ip6r0_type;		/* always zero */
+	u_int8_t  ip6r0_segleft;	/* segments left */
+	u_int32_t ip6r0_reserved;	/* reserved field */
+} __packed;
+
+/* Fragment header */
+struct ip6_frag {
+	u_int8_t  ip6f_nxt;		/* next header */
+	u_int8_t  ip6f_reserved;	/* reserved field */
+	u_int16_t ip6f_offlg;		/* offset, reserved, and flag */
+	u_int32_t ip6f_ident;		/* identification */
+} __packed;
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define IP6F_OFF_MASK		0xfff8	/* mask out offset from _offlg */
+#define IP6F_RESERVED_MASK	0x0006	/* reserved bits in ip6f_offlg */
+#define IP6F_MORE_FRAG		0x0001	/* more-fragments flag */
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#define IP6F_OFF_MASK		0xf8ff	/* mask out offset from _offlg */
+#define IP6F_RESERVED_MASK	0x0600	/* reserved bits in ip6f_offlg */
+#define IP6F_MORE_FRAG		0x0100	/* more-fragments flag */
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+/*
+ * Internet implementation parameters.
+ */
+#define IPV6_MAXHLIM	255	/* maximum hoplimit */
+#define IPV6_DEFHLIM	64	/* default hlim */
+#define IPV6_FRAGTTL	120	/* ttl for fragment packets, in slowtimo tick */
+#define IPV6_HLIMDEC	1	/* subtracted when forwarding */
+
+#define IPV6_MMTU	1280	/* minimal MTU and reassembly. 1024 + 256 */
+#define IPV6_MAXPACKET	65535	/* ip6 max packet size without Jumbo payload*/
+
+#ifdef _KERNEL
+/*
+ * IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to
+ * "len") is located in single mbuf, on contiguous memory region.
+ * The pointer to the region will be returned to pointer variable "val",
+ * with type "typ".
+ * IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the
+ * very top of mbuf.  GET0 is likely to make memory copy than GET.
+ *
+ * XXX we're now testing this, needs m_pulldown()
+ */
+#define IP6_EXTHDR_GET(val, typ, m, off, len) \
+do {									\
+	struct mbuf *_t;						\
+	int _tmp;							\
+	if ((m)->m_len >= (off) + (len))				\
+		(val) = (typ)(mtod((m), char *) + (off));		\
+	else {								\
+		_t = m_pulldown((m), (off), (len), &_tmp);		\
+		if (_t) {						\
+			if (_t->m_len < _tmp + (len))			\
+				panic("m_pulldown malfunction");	\
+			(val) = (typ)(mtod(_t, char *) + _tmp);	\
+		} else {						\
+			(val) = (typ)NULL;				\
+			(m) = NULL;					\
+		}							\
+	}								\
+} while (/*CONSTCOND*/ 0)
+
+#define IP6_EXTHDR_GET0(val, typ, m, off, len) \
+do {									\
+	struct mbuf *_t;						\
+	if ((off) == 0 && (m)->m_len >= len)				\
+		(val) = (typ)mtod((m), void *);			\
+	else {								\
+		_t = m_pulldown((m), (off), (len), NULL);		\
+		if (_t) {						\
+			if (_t->m_len < (len))				\
+				panic("m_pulldown malfunction");	\
+			(val) = (typ)mtod(_t, void *);			\
+		} else {						\
+			(val) = (typ)NULL;				\
+			(m) = NULL;					\
+		}							\
+	}								\
+} while (/*CONSTCOND*/ 0)
+#endif /*_KERNEL*/
+
+#endif /* !_NETINET_IP6_H_ */

Property changes on: lab4/.minix-src/include/netinet/ip6.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/ip_var.h
===================================================================
--- lab4/.minix-src/include/netinet/ip_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/ip_var.h	(revision 13)
@@ -0,0 +1,253 @@
+/*	$NetBSD: ip_var.h,v 1.108 2015/06/04 09:20:00 ozaki-r Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ip_var.h	8.2 (Berkeley) 1/9/95
+ */
+
+#ifndef _NETINET_IP_VAR_H_
+#define _NETINET_IP_VAR_H_
+
+#include <sys/queue.h>
+#include <net/route.h>
+
+/*
+ * Overlay for ip header used by other protocols (tcp, udp).
+ */
+struct ipovly {
+	u_int8_t  ih_x1[9];		/* (unused) */
+	u_int8_t  ih_pr;		/* protocol */
+	u_int16_t ih_len;		/* protocol length */
+	struct	  in_addr ih_src;	/* source internet address */
+	struct	  in_addr ih_dst;	/* destination internet address */
+} __packed;
+
+/*
+ * IP Flow structure
+ */
+struct ipflow {
+	LIST_ENTRY(ipflow) ipf_list;	/* next in active list */
+	LIST_ENTRY(ipflow) ipf_hash;	/* next ipflow in bucket */
+	struct in_addr ipf_dst;		/* destination address */
+	struct in_addr ipf_src;		/* source address */
+	uint8_t ipf_tos;		/* type-of-service */
+	struct route ipf_ro;		/* associated route entry */
+	u_long ipf_uses;		/* number of uses in this period */
+	u_long ipf_last_uses;		/* number of uses in last period */
+	u_long ipf_dropped;		/* ENOBUFS retured by if_output */
+	u_long ipf_errors;		/* other errors returned by if_output */
+	u_int ipf_timer;		/* lifetime timer */
+};
+
+/*
+ * IP sequence queue structure.
+ *
+ * XXX -- The following explains why the ipqe_m field is here, for TCP's use:
+ * We want to avoid doing m_pullup on incoming packets but that
+ * means avoiding dtom on the tcp reassembly code.  That in turn means
+ * keeping an mbuf pointer in the reassembly queue (since we might
+ * have a cluster).  As a quick hack, the source & destination
+ * port numbers (which are no longer needed once we've located the
+ * tcpcb) are overlayed with an mbuf pointer.
+ */
+TAILQ_HEAD(ipqehead, ipqent);
+struct ipqent {
+	TAILQ_ENTRY(ipqent) ipqe_q;
+	union {
+		struct ip	*_ip;
+		struct tcpiphdr *_tcp;
+	} _ipqe_u1;
+	struct mbuf	*ipqe_m;	/* point to first mbuf */
+	struct mbuf	*ipre_mlast;	/* point to last mbuf */
+	u_int8_t	ipqe_mff;	/* for IP fragmentation */
+	/*
+	 * The following are used in TCP reassembly
+	 */
+	TAILQ_ENTRY(ipqent) ipqe_timeq;
+	u_int32_t ipqe_seq;
+	u_int32_t ipqe_len;
+	u_int32_t ipqe_flags;
+};
+#define	ipqe_tcp	_ipqe_u1._tcp
+
+/*
+ * Structure stored in mbuf in inpcb.ip_options
+ * and passed to ip_output when ip options are in use.
+ * The actual length of the options (including ipopt_dst)
+ * is in m_len.
+ */
+#define	MAX_IPOPTLEN	40
+
+struct ipoption {
+	struct	in_addr ipopt_dst;	/* first-hop dst if source routed */
+	int8_t	ipopt_list[MAX_IPOPTLEN];	/* options proper */
+};
+
+/*
+ * Structure attached to inpcb.ip_moptions and
+ * passed to ip_output when IP multicast options are in use.
+ */
+struct ip_moptions {
+	struct	  ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
+	struct in_addr imo_multicast_addr; /* ifindex/addr on MULTICAST_IF */
+	u_int8_t  imo_multicast_ttl;	/* TTL for outgoing multicasts */
+	u_int8_t  imo_multicast_loop;	/* 1 => hear sends if a member */
+	u_int16_t imo_num_memberships;	/* no. memberships this socket */
+	struct	  in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
+};
+
+/*
+ * IP statistics.
+ * Each counter is an unsigned 64-bit value.
+ */
+#define	IP_STAT_TOTAL		0	/* total packets received */
+#define	IP_STAT_BADSUM		1	/* checksum bad */
+#define	IP_STAT_TOOSHORT	2	/* packet too short */
+#define	IP_STAT_TOOSMALL	3	/* not enough data */
+#define	IP_STAT_BADHLEN		4	/* ip header length < data size */
+#define	IP_STAT_BADLEN		5	/* ip length < ip header length */
+#define	IP_STAT_FRAGMENTS	6	/* fragments received */
+#define	IP_STAT_FRAGDROPPED	7	/* frags dropped (dups, out of space) */
+#define	IP_STAT_FRAGTIMEOUT	8	/* fragments timed out */
+#define	IP_STAT_FORWARD		9	/* packets forwarded */
+#define	IP_STAT_FASTFORWARD	10	/* packets fast forwarded */
+#define	IP_STAT_CANTFORWARD	11	/* packets rcvd for unreachable dest */
+#define	IP_STAT_REDIRECTSENT	12	/* packets forwareded on same net */
+#define	IP_STAT_NOPROTO		13	/* unknown or unsupported protocol */
+#define	IP_STAT_DELIVERED	14	/* datagrams delivered to upper level */
+#define	IP_STAT_LOCALOUT	15	/* total ip packets generated here */
+#define	IP_STAT_ODROPPED	16	/* lost packets due to nobufs, etc. */
+#define	IP_STAT_REASSEMBLED	17	/* total packets reassembled ok */
+#define	IP_STAT_FRAGMENTED	18	/* datagrams successfully fragmented */
+#define	IP_STAT_OFRAGMENTS	19	/* output fragments created */
+#define	IP_STAT_CANTFRAG	20	/* don't fragment flag was set, etc. */
+#define	IP_STAT_BADOPTIONS	21	/* error in option processing */
+#define	IP_STAT_NOROUTE		22	/* packets discarded due to no route */
+#define	IP_STAT_BADVERS		23	/* ip version != 4 */
+#define	IP_STAT_RAWOUT		24	/* total raw ip packets generated */
+#define	IP_STAT_BADFRAGS	25	/* malformed fragments (bad length) */
+#define	IP_STAT_RCVMEMDROP	26	/* frags dropped for lack of memory */
+#define	IP_STAT_TOOLONG		27	/* ip length > max ip packet size */
+#define	IP_STAT_NOGIF		28	/* no match gif found */
+#define	IP_STAT_BADADDR		29	/* invalid address on header */
+
+#define	IP_NSTATS		30
+
+#ifdef _KERNEL
+
+#ifdef _KERNEL_OPT
+#include "opt_gateway.h"
+#include "opt_mbuftrace.h"
+#endif
+
+/*
+ * The following flags can be passed to ip_output() as last parameter
+ */
+#define	IP_FORWARDING		0x0001		/* most of ip header exists */
+#define	IP_RAWOUTPUT		0x0002		/* raw ip header exists */
+#define	IP_RETURNMTU		0x0004		/* pass back mtu on EMSGSIZE */
+#define	IP_NOIPNEWID		0x0008		/* don't fill in ip_id */
+__CTASSERT(SO_DONTROUTE ==	0x0010);
+__CTASSERT(SO_BROADCAST ==	0x0020);
+#define	IP_ROUTETOIF		SO_DONTROUTE	/* bypass routing tables */
+#define	IP_ALLOWBROADCAST	SO_BROADCAST	/* can send broadcast packets */
+
+#define	IP_IGMP_MCAST		0x0040		/* IGMP for mcast join/leave */
+#define	IP_MTUDISC		0x0400		/* Path MTU Discovery; set DF */
+
+extern struct domain inetdomain;
+extern const struct pr_usrreqs rip_usrreqs;
+
+extern int   ip_defttl;			/* default IP ttl */
+extern int   ipforwarding;		/* ip forwarding */
+extern int   ip_mtudisc;		/* mtu discovery */
+extern int   ip_mtudisc_timeout;	/* seconds to timeout mtu discovery */
+extern int   anonportmin;		/* minimum ephemeral port */
+extern int   anonportmax;		/* maximum ephemeral port */
+extern int   lowportmin;		/* minimum reserved port */
+extern int   lowportmax;		/* maximum reserved port */
+extern int   ip_do_loopback_cksum;	/* do IP checksum on loopback? */
+extern struct rttimer_queue *ip_mtudisc_timeout_q;
+#ifdef MBUFTRACE
+extern struct mowner ip_rx_mowner;
+extern struct mowner ip_tx_mowner;
+#endif
+struct	 inpcb;
+struct   sockopt;
+
+void	ip_init(void);
+void	in_init(void);
+
+int	 ip_ctloutput(int, struct socket *, struct sockopt *);
+void	 ip_drain(void);
+void	 ip_drainstub(void);
+void	 ip_freemoptions(struct ip_moptions *);
+int	 ip_optcopy(struct ip *, struct ip *);
+u_int	 ip_optlen(struct inpcb *);
+int	 ip_output(struct mbuf *, ...);
+int	 ip_fragment(struct mbuf *, struct ifnet *, u_long);
+
+void	 ip_reass_init(void);
+int	 ip_reass_packet(struct mbuf **, struct ip *);
+void	 ip_reass_slowtimo(void);
+void	 ip_reass_drain(void);
+
+void	 ip_savecontrol(struct inpcb *, struct mbuf **, struct ip *,
+	   struct mbuf *);
+void	 ip_slowtimo(void);
+void	 ip_fasttimo(void);
+struct mbuf *
+	 ip_srcroute(void);
+int	 ip_sysctl(int *, u_int, void *, size_t *, void *, size_t);
+void	 ip_statinc(u_int);
+void *	 rip_ctlinput(int, const struct sockaddr *, void *);
+int	 rip_ctloutput(int, struct socket *, struct sockopt *);
+void	 rip_init(void);
+void	 rip_input(struct mbuf *, ...);
+int	 rip_output(struct mbuf *, ...);
+int	 rip_usrreq(struct socket *,
+	    int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *);
+
+int	ip_setmoptions(struct ip_moptions **, const struct sockopt *sopt);
+int	ip_getmoptions(struct ip_moptions *, struct sockopt *sopt);
+
+int	ip_hresolv_output(struct ifnet * const, struct mbuf * const,
+	    const struct sockaddr * const, struct rtentry *);
+
+/* IP Flow interface. */
+void	ipflow_init(void);
+void	ipflow_poolinit(void);
+struct ipflow *ipflow_reap(bool);
+void	ipflow_create(const struct route *, struct mbuf *);
+void	ipflow_slowtimo(void);
+int	ipflow_invalidate_all(int);
+
+#endif  /* _KERNEL */
+
+#endif /* !_NETINET_IP_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet/ip_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/tcp_fsm.h
===================================================================
--- lab4/.minix-src/include/netinet/tcp_fsm.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/tcp_fsm.h	(revision 13)
@@ -0,0 +1,100 @@
+/*	$NetBSD: tcp_fsm.h,v 1.15 2005/12/10 23:36:23 elad Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tcp_fsm.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_FSM_H_
+#define _NETINET_TCP_FSM_H_
+
+/*
+ * TCP FSM state definitions.
+ * Per RFC793, September, 1981.
+ */
+
+#define	TCP_NSTATES	11
+
+#define	TCPS_CLOSED		0	/* closed */
+#define	TCPS_LISTEN		1	/* listening for connection */
+#define	TCPS_SYN_SENT		2	/* active, have sent syn */
+#define	TCPS_SYN_RECEIVED	3	/* have send and received syn */
+/* states < TCPS_ESTABLISHED are those where connections not established */
+#define	TCPS_ESTABLISHED	4	/* established */
+#define	TCPS_CLOSE_WAIT		5	/* rcvd fin, waiting for close */
+/* states > TCPS_CLOSE_WAIT are those where user has closed */
+#define	TCPS_FIN_WAIT_1		6	/* have closed, sent fin */
+#define	TCPS_CLOSING		7	/* closed xchd FIN; await ACK */
+#define	TCPS_LAST_ACK		8	/* had fin and close; await FIN ACK */
+/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
+#define	TCPS_FIN_WAIT_2		9	/* have closed, fin is acked */
+#define	TCPS_TIME_WAIT		10	/* in 2*msl quiet wait after close */
+
+#define	TCPS_HAVERCVDSYN(s)	((s) >= TCPS_SYN_RECEIVED)
+#define	TCPS_HAVEESTABLISHED(s)	((s) >= TCPS_ESTABLISHED)
+#define	TCPS_HAVERCVDFIN(s) \
+    ((s) == TCPS_CLOSE_WAIT || ((s) >= TCPS_CLOSING && (s) != TCPS_FIN_WAIT_2))
+
+#ifdef	TCPOUTFLAGS
+/*
+ * Flags used when sending segments in tcp_output.
+ * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally
+ * determined by state, with the proviso that TH_FIN is sent only
+ * if all data queued for output is included in the segment.
+ */
+const u_char	tcp_outflags[TCP_NSTATES] = {
+	TH_RST|TH_ACK,	/* CLOSED */
+	0,		/* LISTEN */
+	TH_SYN,		/* SYN_SENT */
+	TH_SYN|TH_ACK,	/* SYN_RCVD */
+	TH_ACK,		/* ESTABLISHED */
+	TH_ACK,		/* CLOSE_WAIT */
+	TH_FIN|TH_ACK,	/* FIN_WAIT_1 */
+	TH_FIN|TH_ACK,	/* CLOSING */
+	TH_FIN|TH_ACK,	/* LAST_ACK */
+	TH_ACK,		/* FIN_WAIT_2 */
+	TH_ACK,		/* TIME_WAIT */
+};
+#endif
+
+#ifdef KPROF
+int	tcp_acounts[TCP_NSTATES][PRU_NREQ];
+#endif
+
+#ifdef	TCPSTATES
+const char * const tcpstates[] = {
+	"CLOSED",	"LISTEN",	"SYN_SENT",	"SYN_RCVD",
+	"ESTABLISHED",	"CLOSE_WAIT",	"FIN_WAIT_1",	"CLOSING",
+	"LAST_ACK",	"FIN_WAIT_2",	"TIME_WAIT",
+};
+#elif defined(_KERNEL)
+extern const char * const tcpstates[];
+#endif
+
+#endif /* !_NETINET_TCP_FSM_H_ */

Property changes on: lab4/.minix-src/include/netinet/tcp_fsm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet/tcp_vtw.h
===================================================================
--- lab4/.minix-src/include/netinet/tcp_vtw.h	(nonexistent)
+++ lab4/.minix-src/include/netinet/tcp_vtw.h	(revision 13)
@@ -0,0 +1,418 @@
+/*	$NetBSD: tcp_vtw.h,v 1.6 2012/11/23 14:48:31 joerg Exp $	*/
+/*
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Coyote Point Systems, Inc.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Vestigial time-wait.
+ *
+ * This implementation uses cache-efficient techniques, which will
+ * appear somewhat peculiar.  The main philosophy is to optimise the
+ * amount of information available within a cache line.  Cache miss is
+ * expensive.  So we employ ad-hoc techniques to pull a series of
+ * linked-list follows into a cache line.  One cache line, multiple
+ * linked-list equivalents.
+ *
+ * One such ad-hoc technique is fat pointers.  Additional degrees of
+ * ad-hoqueness result from having to hand tune it for pointer size
+ * and for cache line size.
+ *
+ * The 'fat pointer' approach aggregates, for x86_32, 15 linked-list
+ * data structures into one cache line.  The additional 32 bits in the
+ * cache line are used for linking fat pointers, and for
+ * allocation/bookkeeping.
+ *
+ * The 15 32-bit tags encode the pointers to the linked list elements,
+ * and also encode the results of a search comparison.
+ *
+ * First, some more assumptions/restrictions.
+ *
+ * All the fat pointers are from a contiguous allocation arena.  Thus,
+ * we can refer to them by offset from a base, not as full pointers.
+ *
+ * All the linked list data elements are also from a contiguous
+ * allocation arena, again so that we can refer to them as offset from
+ * a base.
+ *
+ * In order to add a data element to a fat pointer, a key value is
+ * computed, based on unique data within the data element.  It is the
+ * linear searching of the linked lists of these elements based on
+ * these unique data that are being optimised here.
+ *
+ * Lets call the function that computes the key k(e), where e is the
+ * data element.  In this example, k(e) returns 32-bits.
+ *
+ * Consider a set E (say of order 15) of data elements.  Let K be
+ * the set of the k(e) for e in E.
+ *
+ * Let O be the set of the offsets from the base of the data elements in E.
+ *
+ * For each x in K, for each matching o in O, let t be x ^ o.  These
+ * are the tags. (More or less).
+ *
+ * In order to search all the data elements in E, we compute the
+ * search key, and one at a time, XOR the key into the tags.  If any
+ * result is a valid data element index, we have a possible match.  If
+ * not, there is no match.
+ *
+ * The no-match cases mean we do not have to de-reference the pointer
+ * to the data element in question.  We save cache miss penalty and
+ * cache load decreases.  Only in the case of a valid looking data
+ * element index, do we have to look closer.
+ *
+ * Thus, in the absence of false positives, 15 data elements can be
+ * searched with one cache line fill, as opposed to 15 cache line
+ * fills for the usual implementation.
+ *
+ * The vestigial time waits (vtw_t), the data elements in the above, are
+ * searched by faddr, fport, laddr, lport.  The key is a function of
+ * these values.
+ *
+ * We hash these keys into the traditional hash chains to reduce the
+ * search time, and use fat pointers to reduce the cache impacts of
+ * searching.
+ *
+ * The vtw_t are, per requirement, in a contiguous chunk.  Allocation
+ * is done with a clock hand, and all vtw_t within one allocation
+ * domain have the same lifetime, so they will always be sorted by
+ * age.
+ *
+ * A vtw_t will be allocated, timestamped, and have a fixed future
+ * expiration.  It will be added to a hash bucket implemented with fat
+ * pointers, which means that a cache line will be allocated in the
+ * hash bucket, placed at the head (more recent in time) and the vtw_t
+ * will be added to this.  As more entries are added, the fat pointer
+ * cache line will fill, requiring additional cache lines for fat
+ * pointers to be allocated. These will be added at the head, and the
+ * aged entries will hang down, tapeworm like.  As the vtw_t entries
+ * expire, the corresponding slot in the fat pointer will be
+ * reclaimed, and eventually the cache line will completely empty and
+ * be re-cycled, if not at the head of the chain.
+ *
+ * At times, a time-wait timer is restarted.  This corresponds to
+ * deleting the current entry and re-adding it.
+ *
+ * Most of the time, they are just placed here to die.
+ */
+#ifndef _NETINET_TCP_VTW_H
+#define _NETINET_TCP_VTW_H
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <net/if.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/in_pcb.h>
+#include <netinet/in_var.h>
+#include <netinet/ip_var.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <netinet/tcp_timer.h>
+#include <netinet/tcp_var.h>
+#include <netinet6/in6.h>
+#include <netinet/ip6.h>
+#include <netinet6/ip6_var.h>
+#include <netinet6/in6_pcb.h>
+#include <netinet6/ip6_var.h>
+#include <netinet6/in6_var.h>
+#include <netinet/icmp6.h>
+#include <netinet6/nd6.h>
+
+#define	VTW_NCLASS	(1+3)		/* # different classes */
+
+/*
+ * fat pointers, MI.
+ */
+struct fatp_mi;
+
+typedef uint32_t fatp_word_t;
+
+typedef struct fatp_mi	fatp_t;
+
+/* Supported cacheline sizes: 32 64 128 bytes.  See fatp_key(),
+ * fatp_slot_from_key(), fatp_xtra[].
+ */
+#define	FATP_NTAGS	(CACHE_LINE_SIZE / sizeof(fatp_word_t) - 1)
+#define	FATP_NXT_WIDTH	(sizeof(fatp_word_t) * NBBY - FATP_NTAGS)
+
+#define	FATP_MAX	(1 << FATP_NXT_WIDTH)
+
+/* Worked example: ULP32 with 64-byte cacheline (32-bit x86):
+ * 15 tags per cacheline.  At most 2^17 fat pointers per fatp_ctl_t.
+ * The comments on the fatp_mi members, below, correspond to the worked
+ * example.
+ */
+struct fatp_mi {
+	fatp_word_t	inuse	: FATP_NTAGS;	/* (1+15)*4 == CL_SIZE */
+	fatp_word_t	nxt	: FATP_NXT_WIDTH;/* at most 2^17 fat pointers */
+	fatp_word_t	tag[FATP_NTAGS];	/* 15 tags per CL */
+};
+
+static inline int
+fatp_ntags(void)
+{
+	return FATP_NTAGS;
+}
+
+static inline int
+fatp_full(fatp_t *fp) 
+{
+	fatp_t full;
+
+	full.inuse = (1U << FATP_NTAGS) - 1U;
+
+	return (fp->inuse == full.inuse);
+}
+
+struct vtw_common;
+struct vtw_v4;
+struct vtw_v6;
+struct vtw_ctl;
+
+/*!\brief common to all vtw
+ */
+typedef struct vtw_common {
+	struct timeval	expire;		/* date of birth+msl */
+	uint32_t	key;		/* hash key: full hash */
+	uint32_t	port_key;	/* hash key: local port hash */
+	uint32_t	rcv_nxt;
+	uint32_t	rcv_wnd;
+	uint32_t	snd_nxt;
+	uint32_t	snd_scale	: 8;	/* window scaling for send win */
+	uint32_t	msl_class	: 2;	/* TCP MSL class {0,1,2,3} */
+	uint32_t	reuse_port	: 1;
+	uint32_t	reuse_addr	: 1;
+	uint32_t	v6only		: 1;
+	uint32_t	hashed		: 1;	/* reachable via FATP */
+	uint32_t	uid;
+} vtw_t;
+
+/*!\brief vestigial timewait for IPv4
+ */
+typedef struct vtw_v4 {
+	vtw_t		common;		/*  must be first */
+	uint16_t	lport;
+	uint16_t	fport;
+	uint32_t	laddr;
+	uint32_t	faddr;
+} vtw_v4_t;
+
+/*!\brief vestigial timewait for IPv6
+ */
+typedef struct vtw_v6 {
+	vtw_t		common;		/* must be first */
+	uint16_t	lport;
+	uint16_t	fport;
+	struct in6_addr	laddr;
+	struct in6_addr	faddr;
+} vtw_v6_t;
+
+struct fatp_ctl;
+typedef struct vtw_ctl		vtw_ctl_t;
+typedef struct fatp_ctl		fatp_ctl_t;
+
+/*
+ * The vestigial time waits are kept in a contiguous chunk.
+ * Allocation and free pointers run as clock hands thru this array.
+ */
+struct vtw_ctl {
+	fatp_ctl_t	*fat;		/* collection of fatp to use	*/
+	vtw_ctl_t	*ctl;		/* <! controller's controller	*/
+	union {
+		vtw_t		*v;	/* common			*/
+		struct vtw_v4	*v4;	/* IPv4 resources		*/
+		struct vtw_v6	*v6;	/* IPv6 resources		*/
+	}		base,		/* base of vtw_t array		*/
+		/**/	lim,		/* extent of vtw_t array	*/
+		/**/	alloc,		/* allocation pointer		*/
+		/**/	oldest;		/* ^ to oldest			*/
+	uint32_t	nfree;		/* # free			*/
+	uint32_t	nalloc;		/* # allocated			*/
+	uint32_t	idx_mask;	/* mask capturing all index bits*/
+	uint32_t	is_v4	: 1;
+	uint32_t	is_v6	: 1;
+	uint32_t	idx_bits: 6;
+	uint32_t	clidx	: 3;	/* <! class index */
+};
+
+/*!\brief Collections of fat pointers.
+ */
+struct fatp_ctl {
+	vtw_ctl_t	*vtw;		/* associated VTWs		*/
+	fatp_t		*base;		/* base of fatp_t array		*/
+	fatp_t		*lim;		/* extent of fatp_t array	*/
+	fatp_t		*free;		/* free list			*/
+	uint32_t	mask;		/* hash mask			*/
+	uint32_t	nfree;		/* # free			*/
+	uint32_t	nalloc;		/* # allocated			*/
+	fatp_t		**hash;		/* hash anchors			*/
+	fatp_t		**port;		/* port hash anchors		*/
+};
+
+/*!\brief stats
+ */
+struct vtw_stats {
+	uint64_t	ins;		/* <! inserts */
+	uint64_t	del;		/* <! deleted */
+	uint64_t	kill;		/* <! assassination */
+	uint64_t	look[2];	/* <! lookup: full hash, port hash */
+	uint64_t	hit[2];		/* <! lookups that hit */
+	uint64_t	miss[2];	/* <! lookups that miss */
+	uint64_t	probe[2];	/* <! hits+miss */
+	uint64_t	losing[2];	/* <! misses requiring dereference */
+	uint64_t	max_chain[2];	/* <! max fatp chain traversed */
+	uint64_t	max_probe[2];	/* <! max probes in any one chain */
+	uint64_t	max_loss[2];	/* <! max losing probes in any one
+					 * chain
+					 */
+};
+
+typedef struct vtw_stats	vtw_stats_t;
+
+/*!\brief	follow fatp next 'pointer'
+ */
+static inline fatp_t *
+fatp_next(fatp_ctl_t *fat, fatp_t *fp)
+{
+	return fp->nxt ? fat->base + fp->nxt-1 : 0;
+}
+
+/*!\brief determine a collection-relative fat pointer index.
+ */
+static inline uint32_t
+fatp_index(fatp_ctl_t *fat, fatp_t *fp)
+{
+	return fp ? 1 + (fp - fat->base) : 0;
+}
+
+
+static inline uint32_t
+v4_tag(uint32_t faddr, uint32_t fport, uint32_t laddr, uint32_t lport)
+{
+	return (ntohl(faddr)   + ntohs(fport)
+		+ ntohl(laddr) + ntohs(lport));
+}
+
+static inline uint32_t
+v6_tag(const struct in6_addr *faddr, uint16_t fport,
+       const struct in6_addr *laddr, uint16_t lport)
+{
+#ifdef IN6_HASH
+	return IN6_HASH(faddr, fport, laddr, lport);
+#else
+	return 0;
+#endif
+}
+
+static inline uint32_t
+v4_port_tag(uint16_t lport)
+{
+	uint32_t tag = lport ^ (lport << 11);
+
+	tag ^= tag << 3;
+	tag += tag >> 5;
+	tag ^= tag << 4;
+	tag += tag >> 17;
+	tag ^= tag << 25;
+	tag += tag >> 6;
+
+	return tag;
+}
+
+static inline uint32_t
+v6_port_tag(uint16_t lport)
+{
+	return v4_port_tag(lport);
+}
+
+struct tcpcb;
+struct tcphdr;
+
+int  vtw_add(int, struct tcpcb *);
+void vtw_del(vtw_ctl_t *, vtw_t *);
+int vtw_lookup_v4(const struct ip *ip, const struct tcphdr *th,
+		  uint32_t faddr, uint16_t fport,
+		  uint32_t laddr, uint16_t lport);
+struct ip6_hdr;
+struct in6_addr;
+
+int vtw_lookup_v6(const struct ip6_hdr *ip, const struct tcphdr *th,
+		  const struct in6_addr *faddr, uint16_t fport,
+		  const struct in6_addr *laddr, uint16_t lport);
+
+typedef struct vestigial_inpcb {
+	union {
+		struct in_addr	v4;
+		struct in6_addr	v6;
+	} faddr, laddr;
+	uint16_t		fport, lport;
+	uint32_t		valid		: 1;
+	uint32_t		v4		: 1;
+	uint32_t		reuse_addr	: 1;
+	uint32_t		reuse_port	: 1;
+	uint32_t		v6only		: 1;
+	uint32_t		more_tbd	: 1;
+	uint32_t		uid;
+	uint32_t		rcv_nxt;
+	uint32_t		rcv_wnd;
+	uint32_t		snd_nxt;
+	struct vtw_common	*vtw;
+	struct vtw_ctl		*ctl;
+} vestigial_inpcb_t;
+
+#ifdef _KERNEL
+void vtw_restart(vestigial_inpcb_t*);
+int vtw_earlyinit(void);
+int sysctl_tcp_vtw_enable(SYSCTLFN_PROTO);
+#endif /* _KERNEL */
+
+#ifdef VTW_DEBUG
+typedef struct sin_either {
+	uint8_t		sin_len;
+	uint8_t		sin_family;
+	uint16_t	sin_port;
+	union {
+		struct in_addr	v4;
+		struct in6_addr	v6;
+	}		sin_addr;
+} sin_either_t;
+
+int vtw_debug_add(int af, sin_either_t *, sin_either_t *, int, int);
+
+typedef struct vtw_sysargs {
+	uint32_t	op;
+	sin_either_t	fa;
+	sin_either_t	la;
+} vtw_sysargs_t;
+
+#endif /* VTW_DEBUG */
+
+#endif /* _NETINET_TCP_VTW_H */

Property changes on: lab4/.minix-src/include/netinet/tcp_vtw.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/asn1t.h
===================================================================
--- lab4/.minix-src/include/openssl/asn1t.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/asn1t.h	(revision 13)
@@ -0,0 +1,973 @@
+/* asn1t.h */
+/*
+ * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
+ * 2000.
+ */
+/* ====================================================================
+ * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+#ifndef HEADER_ASN1T_H
+# define HEADER_ASN1T_H
+
+# include <stddef.h>
+# include <openssl/e_os2.h>
+# include <openssl/asn1.h>
+
+# ifdef OPENSSL_BUILD_SHLIBCRYPTO
+#  undef OPENSSL_EXTERN
+#  define OPENSSL_EXTERN OPENSSL_EXPORT
+# endif
+
+/* ASN1 template defines, structures and functions */
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
+
+/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
+#  define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr))
+
+/* Macros for start and end of ASN1_ITEM definition */
+
+#  define ASN1_ITEM_start(itname) \
+        OPENSSL_GLOBAL const ASN1_ITEM itname##_it = {
+
+#  define ASN1_ITEM_end(itname) \
+                };
+
+# else
+
+/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
+#  define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr()))
+
+/* Macros for start and end of ASN1_ITEM definition */
+
+#  define ASN1_ITEM_start(itname) \
+        const ASN1_ITEM * itname##_it(void) \
+        { \
+                static const ASN1_ITEM local_it = {
+
+#  define ASN1_ITEM_end(itname) \
+                }; \
+        return &local_it; \
+        }
+
+# endif
+
+/* Macros to aid ASN1 template writing */
+
+# define ASN1_ITEM_TEMPLATE(tname) \
+        static const ASN1_TEMPLATE tname##_item_tt
+
+# define ASN1_ITEM_TEMPLATE_END(tname) \
+        ;\
+        ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_PRIMITIVE,\
+                -1,\
+                &tname##_item_tt,\
+                0,\
+                NULL,\
+                0,\
+                #tname \
+        ASN1_ITEM_end(tname)
+
+/* This is a ASN1 type which just embeds a template */
+
+/*-
+ * This pair helps declare a SEQUENCE. We can do:
+ *
+ *      ASN1_SEQUENCE(stname) = {
+ *              ... SEQUENCE components ...
+ *      } ASN1_SEQUENCE_END(stname)
+ *
+ *      This will produce an ASN1_ITEM called stname_it
+ *      for a structure called stname.
+ *
+ *      If you want the same structure but a different
+ *      name then use:
+ *
+ *      ASN1_SEQUENCE(itname) = {
+ *              ... SEQUENCE components ...
+ *      } ASN1_SEQUENCE_END_name(stname, itname)
+ *
+ *      This will create an item called itname_it using
+ *      a structure called stname.
+ */
+
+# define ASN1_SEQUENCE(tname) \
+        static const ASN1_TEMPLATE tname##_seq_tt[]
+
+# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
+
+# define ASN1_SEQUENCE_END_name(stname, tname) \
+        ;\
+        ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_SEQUENCE,\
+                V_ASN1_SEQUENCE,\
+                tname##_seq_tt,\
+                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+                NULL,\
+                sizeof(stname),\
+                #stname \
+        ASN1_ITEM_end(tname)
+
+# define ASN1_NDEF_SEQUENCE(tname) \
+        ASN1_SEQUENCE(tname)
+
+# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \
+        ASN1_SEQUENCE_cb(tname, cb)
+
+# define ASN1_SEQUENCE_cb(tname, cb) \
+        static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
+        ASN1_SEQUENCE(tname)
+
+# define ASN1_BROKEN_SEQUENCE(tname) \
+        static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
+        ASN1_SEQUENCE(tname)
+
+# define ASN1_SEQUENCE_ref(tname, cb, lck) \
+        static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
+        ASN1_SEQUENCE(tname)
+
+# define ASN1_SEQUENCE_enc(tname, enc, cb) \
+        static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
+        ASN1_SEQUENCE(tname)
+
+# define ASN1_NDEF_SEQUENCE_END(tname) \
+        ;\
+        ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_NDEF_SEQUENCE,\
+                V_ASN1_SEQUENCE,\
+                tname##_seq_tt,\
+                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+                NULL,\
+                sizeof(tname),\
+                #tname \
+        ASN1_ITEM_end(tname)
+
+# define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)
+
+# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
+
+# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
+
+# define ASN1_SEQUENCE_END_ref(stname, tname) \
+        ;\
+        ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_SEQUENCE,\
+                V_ASN1_SEQUENCE,\
+                tname##_seq_tt,\
+                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+                &tname##_aux,\
+                sizeof(stname),\
+                #stname \
+        ASN1_ITEM_end(tname)
+
+# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \
+        ;\
+        ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_NDEF_SEQUENCE,\
+                V_ASN1_SEQUENCE,\
+                tname##_seq_tt,\
+                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+                &tname##_aux,\
+                sizeof(stname),\
+                #stname \
+        ASN1_ITEM_end(tname)
+
+/*-
+ * This pair helps declare a CHOICE type. We can do:
+ *
+ *      ASN1_CHOICE(chname) = {
+ *              ... CHOICE options ...
+ *      ASN1_CHOICE_END(chname)
+ *
+ *      This will produce an ASN1_ITEM called chname_it
+ *      for a structure called chname. The structure
+ *      definition must look like this:
+ *      typedef struct {
+ *              int type;
+ *              union {
+ *                      ASN1_SOMETHING *opt1;
+ *                      ASN1_SOMEOTHER *opt2;
+ *              } value;
+ *      } chname;
+ *
+ *      the name of the selector must be 'type'.
+ *      to use an alternative selector name use the
+ *      ASN1_CHOICE_END_selector() version.
+ */
+
+# define ASN1_CHOICE(tname) \
+        static const ASN1_TEMPLATE tname##_ch_tt[]
+
+# define ASN1_CHOICE_cb(tname, cb) \
+        static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
+        ASN1_CHOICE(tname)
+
+# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
+
+# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)
+
+# define ASN1_CHOICE_END_selector(stname, tname, selname) \
+        ;\
+        ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_CHOICE,\
+                offsetof(stname,selname) ,\
+                tname##_ch_tt,\
+                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
+                NULL,\
+                sizeof(stname),\
+                #stname \
+        ASN1_ITEM_end(tname)
+
+# define ASN1_CHOICE_END_cb(stname, tname, selname) \
+        ;\
+        ASN1_ITEM_start(tname) \
+                ASN1_ITYPE_CHOICE,\
+                offsetof(stname,selname) ,\
+                tname##_ch_tt,\
+                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
+                &tname##_aux,\
+                sizeof(stname),\
+                #stname \
+        ASN1_ITEM_end(tname)
+
+/* This helps with the template wrapper form of ASN1_ITEM */
+
+# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \
+        (flags), (tag), 0,\
+        #name, ASN1_ITEM_ref(type) }
+
+/* These help with SEQUENCE or CHOICE components */
+
+/* used to declare other types */
+
+# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \
+        (flags), (tag), offsetof(stname, field),\
+        #field, ASN1_ITEM_ref(type) }
+
+/* used when the structure is combined with the parent */
+
+# define ASN1_EX_COMBINE(flags, tag, type) { \
+        (flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) }
+
+/* implicit and explicit helper macros */
+
+# define ASN1_IMP_EX(stname, field, type, tag, ex) \
+                ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type)
+
+# define ASN1_EXP_EX(stname, field, type, tag, ex) \
+                ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type)
+
+/* Any defined by macros: the field used is in the table itself */
+
+# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
+#  define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }
+#  define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }
+# else
+#  define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb }
+#  define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb }
+# endif
+/* Plain simple type */
+# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)
+
+/* OPTIONAL simple type */
+# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type)
+
+/* IMPLICIT tagged simple type */
+# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0)
+
+/* IMPLICIT tagged OPTIONAL simple type */
+# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
+
+/* Same as above but EXPLICIT */
+
+# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0)
+# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
+
+/* SEQUENCE OF type */
+# define ASN1_SEQUENCE_OF(stname, field, type) \
+                ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type)
+
+/* OPTIONAL SEQUENCE OF */
+# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \
+                ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
+
+/* Same as above but for SET OF */
+
+# define ASN1_SET_OF(stname, field, type) \
+                ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type)
+
+# define ASN1_SET_OF_OPT(stname, field, type) \
+                ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
+
+/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */
+
+# define ASN1_IMP_SET_OF(stname, field, type, tag) \
+                        ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
+
+# define ASN1_EXP_SET_OF(stname, field, type, tag) \
+                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
+
+# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \
+                        ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
+
+# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \
+                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
+
+# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \
+                        ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
+
+# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \
+                        ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
+
+# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \
+                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
+
+# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
+                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
+
+/* EXPLICIT using indefinite length constructed form */
+# define ASN1_NDEF_EXP(stname, field, type, tag) \
+                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF)
+
+/* EXPLICIT OPTIONAL using indefinite length constructed form */
+# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \
+                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
+
+/* Macros for the ASN1_ADB structure */
+
+# define ASN1_ADB(name) \
+        static const ASN1_ADB_TABLE name##_adbtbl[]
+
+# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
+
+#  define ASN1_ADB_END(name, flags, field, app_table, def, none) \
+        ;\
+        static const ASN1_ADB name##_adb = {\
+                flags,\
+                offsetof(name, field),\
+                app_table,\
+                name##_adbtbl,\
+                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
+                def,\
+                none\
+        }
+
+# else
+
+#  define ASN1_ADB_END(name, flags, field, app_table, def, none) \
+        ;\
+        static const ASN1_ITEM *name##_adb(void) \
+        { \
+        static const ASN1_ADB internal_adb = \
+                {\
+                flags,\
+                offsetof(name, field),\
+                app_table,\
+                name##_adbtbl,\
+                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
+                def,\
+                none\
+                }; \
+                return (const ASN1_ITEM *) &internal_adb; \
+        } \
+        void dummy_function(void)
+
+# endif
+
+# define ADB_ENTRY(val, template) {val, template}
+
+# define ASN1_ADB_TEMPLATE(name) \
+        static const ASN1_TEMPLATE name##_tt
+
+/*
+ * This is the ASN1 template structure that defines a wrapper round the
+ * actual type. It determines the actual position of the field in the value
+ * structure, various flags such as OPTIONAL and the field name.
+ */
+
+struct ASN1_TEMPLATE_st {
+    unsigned long flags;        /* Various flags */
+    long tag;                   /* tag, not used if no tagging */
+    unsigned long offset;       /* Offset of this field in structure */
+# ifndef NO_ASN1_FIELD_NAMES
+    const char *field_name;     /* Field name */
+# endif
+    ASN1_ITEM_EXP *item;        /* Relevant ASN1_ITEM or ASN1_ADB */
+};
+
+/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */
+
+# define ASN1_TEMPLATE_item(t) (t->item_ptr)
+# define ASN1_TEMPLATE_adb(t) (t->item_ptr)
+
+typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE;
+typedef struct ASN1_ADB_st ASN1_ADB;
+
+struct ASN1_ADB_st {
+    unsigned long flags;        /* Various flags */
+    unsigned long offset;       /* Offset of selector field */
+    STACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */
+    const ASN1_ADB_TABLE *tbl;  /* Table of possible types */
+    long tblcount;              /* Number of entries in tbl */
+    const ASN1_TEMPLATE *default_tt; /* Type to use if no match */
+    const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */
+};
+
+struct ASN1_ADB_TABLE_st {
+    long value;                 /* NID for an object or value for an int */
+    const ASN1_TEMPLATE tt;     /* item for this value */
+};
+
+/* template flags */
+
+/* Field is optional */
+# define ASN1_TFLG_OPTIONAL      (0x1)
+
+/* Field is a SET OF */
+# define ASN1_TFLG_SET_OF        (0x1 << 1)
+
+/* Field is a SEQUENCE OF */
+# define ASN1_TFLG_SEQUENCE_OF   (0x2 << 1)
+
+/*
+ * Special case: this refers to a SET OF that will be sorted into DER order
+ * when encoded *and* the corresponding STACK will be modified to match the
+ * new order.
+ */
+# define ASN1_TFLG_SET_ORDER     (0x3 << 1)
+
+/* Mask for SET OF or SEQUENCE OF */
+# define ASN1_TFLG_SK_MASK       (0x3 << 1)
+
+/*
+ * These flags mean the tag should be taken from the tag field. If EXPLICIT
+ * then the underlying type is used for the inner tag.
+ */
+
+/* IMPLICIT tagging */
+# define ASN1_TFLG_IMPTAG        (0x1 << 3)
+
+/* EXPLICIT tagging, inner tag from underlying type */
+# define ASN1_TFLG_EXPTAG        (0x2 << 3)
+
+# define ASN1_TFLG_TAG_MASK      (0x3 << 3)
+
+/* context specific IMPLICIT */
+# define ASN1_TFLG_IMPLICIT      ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT
+
+/* context specific EXPLICIT */
+# define ASN1_TFLG_EXPLICIT      ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT
+
+/*
+ * If tagging is in force these determine the type of tag to use. Otherwise
+ * the tag is determined by the underlying type. These values reflect the
+ * actual octet format.
+ */
+
+/* Universal tag */
+# define ASN1_TFLG_UNIVERSAL     (0x0<<6)
+/* Application tag */
+# define ASN1_TFLG_APPLICATION   (0x1<<6)
+/* Context specific tag */
+# define ASN1_TFLG_CONTEXT       (0x2<<6)
+/* Private tag */
+# define ASN1_TFLG_PRIVATE       (0x3<<6)
+
+# define ASN1_TFLG_TAG_CLASS     (0x3<<6)
+
+/*
+ * These are for ANY DEFINED BY type. In this case the 'item' field points to
+ * an ASN1_ADB structure which contains a table of values to decode the
+ * relevant type
+ */
+
+# define ASN1_TFLG_ADB_MASK      (0x3<<8)
+
+# define ASN1_TFLG_ADB_OID       (0x1<<8)
+
+# define ASN1_TFLG_ADB_INT       (0x1<<9)
+
+/*
+ * This flag means a parent structure is passed instead of the field: this is
+ * useful is a SEQUENCE is being combined with a CHOICE for example. Since
+ * this means the structure and item name will differ we need to use the
+ * ASN1_CHOICE_END_name() macro for example.
+ */
+
+# define ASN1_TFLG_COMBINE       (0x1<<10)
+
+/*
+ * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes
+ * indefinite length constructed encoding to be used if required.
+ */
+
+# define ASN1_TFLG_NDEF          (0x1<<11)
+
+/* This is the actual ASN1 item itself */
+
+struct ASN1_ITEM_st {
+    char itype;                 /* The item type, primitive, SEQUENCE, CHOICE
+                                 * or extern */
+    long utype;                 /* underlying type */
+    const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains
+                                     * the contents */
+    long tcount;                /* Number of templates if SEQUENCE or CHOICE */
+    const void *funcs;          /* functions that handle this type */
+    long size;                  /* Structure size (usually) */
+# ifndef NO_ASN1_FIELD_NAMES
+    const char *sname;          /* Structure name */
+# endif
+};
+
+/*-
+ * These are values for the itype field and
+ * determine how the type is interpreted.
+ *
+ * For PRIMITIVE types the underlying type
+ * determines the behaviour if items is NULL.
+ *
+ * Otherwise templates must contain a single
+ * template and the type is treated in the
+ * same way as the type specified in the template.
+ *
+ * For SEQUENCE types the templates field points
+ * to the members, the size field is the
+ * structure size.
+ *
+ * For CHOICE types the templates field points
+ * to each possible member (typically a union)
+ * and the 'size' field is the offset of the
+ * selector.
+ *
+ * The 'funcs' field is used for application
+ * specific functions.
+ *
+ * For COMPAT types the funcs field gives a
+ * set of functions that handle this type, this
+ * supports the old d2i, i2d convention.
+ *
+ * The EXTERN type uses a new style d2i/i2d.
+ * The new style should be used where possible
+ * because it avoids things like the d2i IMPLICIT
+ * hack.
+ *
+ * MSTRING is a multiple string type, it is used
+ * for a CHOICE of character strings where the
+ * actual strings all occupy an ASN1_STRING
+ * structure. In this case the 'utype' field
+ * has a special meaning, it is used as a mask
+ * of acceptable types using the B_ASN1 constants.
+ *
+ * NDEF_SEQUENCE is the same as SEQUENCE except
+ * that it will use indefinite length constructed
+ * encoding if requested.
+ *
+ */
+
+# define ASN1_ITYPE_PRIMITIVE            0x0
+
+# define ASN1_ITYPE_SEQUENCE             0x1
+
+# define ASN1_ITYPE_CHOICE               0x2
+
+# define ASN1_ITYPE_COMPAT               0x3
+
+# define ASN1_ITYPE_EXTERN               0x4
+
+# define ASN1_ITYPE_MSTRING              0x5
+
+# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
+
+/*
+ * Cache for ASN1 tag and length, so we don't keep re-reading it for things
+ * like CHOICE
+ */
+
+struct ASN1_TLC_st {
+    char valid;                 /* Values below are valid */
+    int ret;                    /* return value */
+    long plen;                  /* length */
+    int ptag;                   /* class value */
+    int pclass;                 /* class value */
+    int hdrlen;                 /* header length */
+};
+
+/* Typedefs for ASN1 function pointers */
+
+typedef ASN1_VALUE *ASN1_new_func(void);
+typedef void ASN1_free_func(ASN1_VALUE *a);
+typedef ASN1_VALUE *ASN1_d2i_func(ASN1_VALUE **a, const unsigned char **in,
+                                  long length);
+typedef int ASN1_i2d_func(ASN1_VALUE *a, unsigned char **in);
+
+typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
+                        const ASN1_ITEM *it, int tag, int aclass, char opt,
+                        ASN1_TLC *ctx);
+
+typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
+                        const ASN1_ITEM *it, int tag, int aclass);
+typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
+typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
+
+typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval,
+                               int indent, const char *fname,
+                               const ASN1_PCTX *pctx);
+
+typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont,
+                               int *putype, const ASN1_ITEM *it);
+typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont,
+                               int len, int utype, char *free_cont,
+                               const ASN1_ITEM *it);
+typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval,
+                                 const ASN1_ITEM *it, int indent,
+                                 const ASN1_PCTX *pctx);
+
+typedef struct ASN1_COMPAT_FUNCS_st {
+    ASN1_new_func *asn1_new;
+    ASN1_free_func *asn1_free;
+    ASN1_d2i_func *asn1_d2i;
+    ASN1_i2d_func *asn1_i2d;
+} ASN1_COMPAT_FUNCS;
+
+typedef struct ASN1_EXTERN_FUNCS_st {
+    void *app_data;
+    ASN1_ex_new_func *asn1_ex_new;
+    ASN1_ex_free_func *asn1_ex_free;
+    ASN1_ex_free_func *asn1_ex_clear;
+    ASN1_ex_d2i *asn1_ex_d2i;
+    ASN1_ex_i2d *asn1_ex_i2d;
+    ASN1_ex_print_func *asn1_ex_print;
+} ASN1_EXTERN_FUNCS;
+
+typedef struct ASN1_PRIMITIVE_FUNCS_st {
+    void *app_data;
+    unsigned long flags;
+    ASN1_ex_new_func *prim_new;
+    ASN1_ex_free_func *prim_free;
+    ASN1_ex_free_func *prim_clear;
+    ASN1_primitive_c2i *prim_c2i;
+    ASN1_primitive_i2c *prim_i2c;
+    ASN1_primitive_print *prim_print;
+} ASN1_PRIMITIVE_FUNCS;
+
+/*
+ * This is the ASN1_AUX structure: it handles various miscellaneous
+ * requirements. For example the use of reference counts and an informational
+ * callback. The "informational callback" is called at various points during
+ * the ASN1 encoding and decoding. It can be used to provide minor
+ * customisation of the structures used. This is most useful where the
+ * supplied routines *almost* do the right thing but need some extra help at
+ * a few points. If the callback returns zero then it is assumed a fatal
+ * error has occurred and the main operation should be abandoned. If major
+ * changes in the default behaviour are required then an external type is
+ * more appropriate.
+ */
+
+typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,
+                        void *exarg);
+
+typedef struct ASN1_AUX_st {
+    void *app_data;
+    int flags;
+    int ref_offset;             /* Offset of reference value */
+    int ref_lock;               /* Lock type to use */
+    ASN1_aux_cb *asn1_cb;
+    int enc_offset;             /* Offset of ASN1_ENCODING structure */
+} ASN1_AUX;
+
+/* For print related callbacks exarg points to this structure */
+typedef struct ASN1_PRINT_ARG_st {
+    BIO *out;
+    int indent;
+    const ASN1_PCTX *pctx;
+} ASN1_PRINT_ARG;
+
+/* For streaming related callbacks exarg points to this structure */
+typedef struct ASN1_STREAM_ARG_st {
+    /* BIO to stream through */
+    BIO *out;
+    /* BIO with filters appended */
+    BIO *ndef_bio;
+    /* Streaming I/O boundary */
+    unsigned char **boundary;
+} ASN1_STREAM_ARG;
+
+/* Flags in ASN1_AUX */
+
+/* Use a reference count */
+# define ASN1_AFLG_REFCOUNT      1
+/* Save the encoding of structure (useful for signatures) */
+# define ASN1_AFLG_ENCODING      2
+/* The Sequence length is invalid */
+# define ASN1_AFLG_BROKEN        4
+
+/* operation values for asn1_cb */
+
+# define ASN1_OP_NEW_PRE         0
+# define ASN1_OP_NEW_POST        1
+# define ASN1_OP_FREE_PRE        2
+# define ASN1_OP_FREE_POST       3
+# define ASN1_OP_D2I_PRE         4
+# define ASN1_OP_D2I_POST        5
+# define ASN1_OP_I2D_PRE         6
+# define ASN1_OP_I2D_POST        7
+# define ASN1_OP_PRINT_PRE       8
+# define ASN1_OP_PRINT_POST      9
+# define ASN1_OP_STREAM_PRE      10
+# define ASN1_OP_STREAM_POST     11
+# define ASN1_OP_DETACHED_PRE    12
+# define ASN1_OP_DETACHED_POST   13
+
+/* Macro to implement a primitive type */
+# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)
+# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \
+                                ASN1_ITEM_start(itname) \
+                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
+                                ASN1_ITEM_end(itname)
+
+/* Macro to implement a multi string type */
+# define IMPLEMENT_ASN1_MSTRING(itname, mask) \
+                                ASN1_ITEM_start(itname) \
+                                        ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
+                                ASN1_ITEM_end(itname)
+
+/* Macro to implement an ASN1_ITEM in terms of old style funcs */
+
+# define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE)
+
+# define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \
+        static const ASN1_COMPAT_FUNCS sname##_ff = { \
+                (ASN1_new_func *)sname##_new, \
+                (ASN1_free_func *)sname##_free, \
+                (ASN1_d2i_func *)d2i_##sname, \
+                (ASN1_i2d_func *)i2d_##sname, \
+        }; \
+        ASN1_ITEM_start(sname) \
+                ASN1_ITYPE_COMPAT, \
+                tag, \
+                NULL, \
+                0, \
+                &sname##_ff, \
+                0, \
+                #sname \
+        ASN1_ITEM_end(sname)
+
+# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \
+        ASN1_ITEM_start(sname) \
+                ASN1_ITYPE_EXTERN, \
+                tag, \
+                NULL, \
+                0, \
+                &fptrs, \
+                0, \
+                #sname \
+        ASN1_ITEM_end(sname)
+
+/* Macro to implement standard functions in terms of ASN1_ITEM structures */
+
+# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname)
+
+# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname)
+
+# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
+                        IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
+
+# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \
+                IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname)
+
+# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
+                IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
+
+# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \
+        pre stname *fname##_new(void) \
+        { \
+                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
+        } \
+        pre void fname##_free(stname *a) \
+        { \
+                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
+        }
+
+# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
+        stname *fname##_new(void) \
+        { \
+                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
+        } \
+        void fname##_free(stname *a) \
+        { \
+                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
+        }
+
+# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \
+        IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
+        IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
+
+# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
+        stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
+        { \
+                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
+        } \
+        int i2d_##fname(stname *a, unsigned char **out) \
+        { \
+                return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
+        }
+
+# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \
+        int i2d_##stname##_NDEF(stname *a, unsigned char **out) \
+        { \
+                return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
+        }
+
+/*
+ * This includes evil casts to remove const: they will go away when full ASN1
+ * constification is done.
+ */
+# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
+        stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
+        { \
+                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
+        } \
+        int i2d_##fname(const stname *a, unsigned char **out) \
+        { \
+                return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
+        }
+
+# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \
+        stname * stname##_dup(stname *x) \
+        { \
+        return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
+        }
+
+# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \
+        IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname)
+
+# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \
+        int fname##_print_ctx(BIO *out, stname *x, int indent, \
+                                                const ASN1_PCTX *pctx) \
+        { \
+                return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \
+                        ASN1_ITEM_rptr(itname), pctx); \
+        }
+
+# define IMPLEMENT_ASN1_FUNCTIONS_const(name) \
+                IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)
+
+# define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \
+        IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
+        IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
+
+/* external definitions for primitive types */
+
+DECLARE_ASN1_ITEM(ASN1_BOOLEAN)
+DECLARE_ASN1_ITEM(ASN1_TBOOLEAN)
+DECLARE_ASN1_ITEM(ASN1_FBOOLEAN)
+DECLARE_ASN1_ITEM(ASN1_SEQUENCE)
+DECLARE_ASN1_ITEM(CBIGNUM)
+DECLARE_ASN1_ITEM(BIGNUM)
+DECLARE_ASN1_ITEM(LONG)
+DECLARE_ASN1_ITEM(ZLONG)
+
+DECLARE_STACK_OF(ASN1_VALUE)
+
+/* Functions used internally by the ASN1 code */
+
+int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
+void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
+int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
+int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
+
+void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
+int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
+                      const ASN1_TEMPLATE *tt);
+int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
+                     const ASN1_ITEM *it, int tag, int aclass, char opt,
+                     ASN1_TLC *ctx);
+
+int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
+                     const ASN1_ITEM *it, int tag, int aclass);
+int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out,
+                      const ASN1_TEMPLATE *tt);
+void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
+
+int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
+                const ASN1_ITEM *it);
+int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
+                int utype, char *free_cont, const ASN1_ITEM *it);
+
+int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it);
+int asn1_set_choice_selector(ASN1_VALUE **pval, int value,
+                             const ASN1_ITEM *it);
+
+ASN1_VALUE **asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
+
+const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt,
+                                 int nullerr);
+
+int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it);
+
+void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);
+void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
+int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval,
+                     const ASN1_ITEM *it);
+int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
+                  const ASN1_ITEM *it);
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/asn1t.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/buffer.h
===================================================================
--- lab4/.minix-src/include/openssl/buffer.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/buffer.h	(revision 13)
@@ -0,0 +1,118 @@
+/* crypto/buffer/buffer.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_BUFFER_H
+# define HEADER_BUFFER_H
+
+# include <openssl/ossl_typ.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# include <stddef.h>
+
+# if !defined(NO_SYS_TYPES_H)
+#  include <sys/types.h>
+# endif
+
+/* Already declared in ossl_typ.h */
+/* typedef struct buf_mem_st BUF_MEM; */
+
+struct buf_mem_st {
+    size_t length;              /* current number of bytes */
+    char *data;
+    size_t max;                 /* size of buffer */
+};
+
+BUF_MEM *BUF_MEM_new(void);
+void BUF_MEM_free(BUF_MEM *a);
+int BUF_MEM_grow(BUF_MEM *str, size_t len);
+int BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
+char *BUF_strdup(const char *str);
+char *BUF_strndup(const char *str, size_t siz);
+void *BUF_memdup(const void *data, size_t siz);
+void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
+
+/* safe string functions */
+size_t BUF_strlcpy(char *dst, const char *src, size_t siz);
+size_t BUF_strlcat(char *dst, const char *src, size_t siz);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_BUF_strings(void);
+
+/* Error codes for the BUF functions. */
+
+/* Function codes. */
+# define BUF_F_BUF_MEMDUP                                 103
+# define BUF_F_BUF_MEM_GROW                               100
+# define BUF_F_BUF_MEM_GROW_CLEAN                         105
+# define BUF_F_BUF_MEM_NEW                                101
+# define BUF_F_BUF_STRDUP                                 102
+# define BUF_F_BUF_STRNDUP                                104
+
+/* Reason codes. */
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/buffer.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/cms.h
===================================================================
--- lab4/.minix-src/include/openssl/cms.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/cms.h	(revision 13)
@@ -0,0 +1,505 @@
+/* crypto/cms/cms.h */
+/*
+ * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
+ * project.
+ */
+/* ====================================================================
+ * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ */
+
+#ifndef HEADER_CMS_H
+# define HEADER_CMS_H
+
+# include <openssl/x509.h>
+
+# ifdef OPENSSL_NO_CMS
+#  error CMS is disabled.
+# endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct CMS_ContentInfo_st CMS_ContentInfo;
+typedef struct CMS_SignerInfo_st CMS_SignerInfo;
+typedef struct CMS_CertificateChoices CMS_CertificateChoices;
+typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
+typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
+typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
+typedef struct CMS_Receipt_st CMS_Receipt;
+
+DECLARE_STACK_OF(CMS_SignerInfo)
+DECLARE_STACK_OF(GENERAL_NAMES)
+DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
+DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
+DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
+
+# define CMS_SIGNERINFO_ISSUER_SERIAL    0
+# define CMS_SIGNERINFO_KEYIDENTIFIER    1
+
+# define CMS_RECIPINFO_TRANS             0
+# define CMS_RECIPINFO_AGREE             1
+# define CMS_RECIPINFO_KEK               2
+# define CMS_RECIPINFO_PASS              3
+# define CMS_RECIPINFO_OTHER             4
+
+/* S/MIME related flags */
+
+# define CMS_TEXT                        0x1
+# define CMS_NOCERTS                     0x2
+# define CMS_NO_CONTENT_VERIFY           0x4
+# define CMS_NO_ATTR_VERIFY              0x8
+# define CMS_NOSIGS                      \
+                        (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY)
+# define CMS_NOINTERN                    0x10
+# define CMS_NO_SIGNER_CERT_VERIFY       0x20
+# define CMS_NOVERIFY                    0x20
+# define CMS_DETACHED                    0x40
+# define CMS_BINARY                      0x80
+# define CMS_NOATTR                      0x100
+# define CMS_NOSMIMECAP                  0x200
+# define CMS_NOOLDMIMETYPE               0x400
+# define CMS_CRLFEOL                     0x800
+# define CMS_STREAM                      0x1000
+# define CMS_NOCRL                       0x2000
+# define CMS_PARTIAL                     0x4000
+# define CMS_REUSE_DIGEST                0x8000
+# define CMS_USE_KEYID                   0x10000
+# define CMS_DEBUG_DECRYPT               0x20000
+
+const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
+
+BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
+int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
+
+ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
+int CMS_is_detached(CMS_ContentInfo *cms);
+int CMS_set_detached(CMS_ContentInfo *cms, int detached);
+
+# ifdef HEADER_PEM_H
+DECLARE_PEM_rw_const(CMS, CMS_ContentInfo)
+# endif
+int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
+CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
+int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
+
+BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
+int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
+int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in,
+                             int flags);
+CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
+int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
+
+int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont,
+              unsigned int flags);
+
+CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey,
+                          STACK_OF(X509) *certs, BIO *data,
+                          unsigned int flags);
+
+CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
+                                  X509 *signcert, EVP_PKEY *pkey,
+                                  STACK_OF(X509) *certs, unsigned int flags);
+
+int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);
+CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);
+
+int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
+                      unsigned int flags);
+CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
+                                   unsigned int flags);
+
+int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
+                              const unsigned char *key, size_t keylen,
+                              BIO *dcont, BIO *out, unsigned int flags);
+
+CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
+                                           const unsigned char *key,
+                                           size_t keylen, unsigned int flags);
+
+int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
+                               const unsigned char *key, size_t keylen);
+
+int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
+               X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);
+
+int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
+                       STACK_OF(X509) *certs,
+                       X509_STORE *store, unsigned int flags);
+
+STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
+
+CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,
+                             const EVP_CIPHER *cipher, unsigned int flags);
+
+int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
+                BIO *dcont, BIO *out, unsigned int flags);
+
+int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
+int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
+                         unsigned char *key, size_t keylen,
+                         unsigned char *id, size_t idlen);
+int CMS_decrypt_set1_password(CMS_ContentInfo *cms,
+                              unsigned char *pass, ossl_ssize_t passlen);
+
+STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
+int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
+CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
+CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
+                                           X509 *recip, unsigned int flags);
+int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
+int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
+int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
+                                     EVP_PKEY **pk, X509 **recip,
+                                     X509_ALGOR **palg);
+int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
+                                          ASN1_OCTET_STRING **keyid,
+                                          X509_NAME **issuer,
+                                          ASN1_INTEGER **sno);
+
+CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
+                                          unsigned char *key, size_t keylen,
+                                          unsigned char *id, size_t idlen,
+                                          ASN1_GENERALIZEDTIME *date,
+                                          ASN1_OBJECT *otherTypeId,
+                                          ASN1_TYPE *otherType);
+
+int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri,
+                                    X509_ALGOR **palg,
+                                    ASN1_OCTET_STRING **pid,
+                                    ASN1_GENERALIZEDTIME **pdate,
+                                    ASN1_OBJECT **potherid,
+                                    ASN1_TYPE **pothertype);
+
+int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,
+                               unsigned char *key, size_t keylen);
+
+int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
+                                   const unsigned char *id, size_t idlen);
+
+int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
+                                    unsigned char *pass,
+                                    ossl_ssize_t passlen);
+
+CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
+                                               int iter, int wrap_nid,
+                                               int pbe_nid,
+                                               unsigned char *pass,
+                                               ossl_ssize_t passlen,
+                                               const EVP_CIPHER *kekciph);
+
+int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
+
+int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
+                   unsigned int flags);
+CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
+
+int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
+const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
+
+CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);
+int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
+int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
+STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
+
+CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);
+int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
+int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
+STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
+
+int CMS_SignedData_init(CMS_ContentInfo *cms);
+CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
+                                X509 *signer, EVP_PKEY *pk, const EVP_MD *md,
+                                unsigned int flags);
+STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
+
+void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
+int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si,
+                                  ASN1_OCTET_STRING **keyid,
+                                  X509_NAME **issuer, ASN1_INTEGER **sno);
+int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
+int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
+                           unsigned int flags);
+void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk,
+                              X509 **signer, X509_ALGOR **pdig,
+                              X509_ALGOR **psig);
+int CMS_SignerInfo_sign(CMS_SignerInfo *si);
+int CMS_SignerInfo_verify(CMS_SignerInfo *si);
+int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
+
+int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);
+int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,
+                            int algnid, int keysize);
+int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
+
+int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
+int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
+                               int lastpos);
+int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,
+                               int lastpos);
+X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
+X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
+int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
+int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
+                                const ASN1_OBJECT *obj, int type,
+                                const void *bytes, int len);
+int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
+                                int nid, int type,
+                                const void *bytes, int len);
+int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
+                                const char *attrname, int type,
+                                const void *bytes, int len);
+void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
+                                  int lastpos, int type);
+
+int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
+int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
+                                 int lastpos);
+int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,
+                                 int lastpos);
+X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
+X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
+int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
+int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
+                                  const ASN1_OBJECT *obj, int type,
+                                  const void *bytes, int len);
+int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
+                                  int nid, int type,
+                                  const void *bytes, int len);
+int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
+                                  const char *attrname, int type,
+                                  const void *bytes, int len);
+void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
+                                    int lastpos, int type);
+
+# ifdef HEADER_X509V3_H
+
+int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
+CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen,
+                                               int allorfirst,
+                                               STACK_OF(GENERAL_NAMES)
+                                               *receiptList, STACK_OF(GENERAL_NAMES)
+                                               *receiptsTo);
+int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
+void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,
+                                    ASN1_STRING **pcid,
+                                    int *pallorfirst,
+                                    STACK_OF(GENERAL_NAMES) **plist,
+                                    STACK_OF(GENERAL_NAMES) **prto);
+
+# endif
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_CMS_strings(void);
+
+/* Error codes for the CMS functions. */
+
+/* Function codes. */
+# define CMS_F_CHECK_CONTENT                              99
+# define CMS_F_CMS_ADD0_CERT                              164
+# define CMS_F_CMS_ADD0_RECIPIENT_KEY                     100
+# define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD                165
+# define CMS_F_CMS_ADD1_RECEIPTREQUEST                    158
+# define CMS_F_CMS_ADD1_RECIPIENT_CERT                    101
+# define CMS_F_CMS_ADD1_SIGNER                            102
+# define CMS_F_CMS_ADD1_SIGNINGTIME                       103
+# define CMS_F_CMS_COMPRESS                               104
+# define CMS_F_CMS_COMPRESSEDDATA_CREATE                  105
+# define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO                106
+# define CMS_F_CMS_COPY_CONTENT                           107
+# define CMS_F_CMS_COPY_MESSAGEDIGEST                     108
+# define CMS_F_CMS_DATA                                   109
+# define CMS_F_CMS_DATAFINAL                              110
+# define CMS_F_CMS_DATAINIT                               111
+# define CMS_F_CMS_DECRYPT                                112
+# define CMS_F_CMS_DECRYPT_SET1_KEY                       113
+# define CMS_F_CMS_DECRYPT_SET1_PASSWORD                  166
+# define CMS_F_CMS_DECRYPT_SET1_PKEY                      114
+# define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX               115
+# define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO               116
+# define CMS_F_CMS_DIGESTEDDATA_DO_FINAL                  117
+# define CMS_F_CMS_DIGEST_VERIFY                          118
+# define CMS_F_CMS_ENCODE_RECEIPT                         161
+# define CMS_F_CMS_ENCRYPT                                119
+# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO              120
+# define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT                  121
+# define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT                  122
+# define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY                 123
+# define CMS_F_CMS_ENVELOPEDDATA_CREATE                   124
+# define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO                 125
+# define CMS_F_CMS_ENVELOPED_DATA_INIT                    126
+# define CMS_F_CMS_FINAL                                  127
+# define CMS_F_CMS_GET0_CERTIFICATE_CHOICES               128
+# define CMS_F_CMS_GET0_CONTENT                           129
+# define CMS_F_CMS_GET0_ECONTENT_TYPE                     130
+# define CMS_F_CMS_GET0_ENVELOPED                         131
+# define CMS_F_CMS_GET0_REVOCATION_CHOICES                132
+# define CMS_F_CMS_GET0_SIGNED                            133
+# define CMS_F_CMS_MSGSIGDIGEST_ADD1                      162
+# define CMS_F_CMS_RECEIPTREQUEST_CREATE0                 159
+# define CMS_F_CMS_RECEIPT_VERIFY                         160
+# define CMS_F_CMS_RECIPIENTINFO_DECRYPT                  134
+# define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT            135
+# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT            136
+# define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID            137
+# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP             138
+# define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP            139
+# define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT             140
+# define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT             141
+# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS           142
+# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID      143
+# define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT               167
+# define CMS_F_CMS_RECIPIENTINFO_SET0_KEY                 144
+# define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD            168
+# define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY                145
+# define CMS_F_CMS_SET1_SIGNERIDENTIFIER                  146
+# define CMS_F_CMS_SET_DETACHED                           147
+# define CMS_F_CMS_SIGN                                   148
+# define CMS_F_CMS_SIGNED_DATA_INIT                       149
+# define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN                150
+# define CMS_F_CMS_SIGNERINFO_SIGN                        151
+# define CMS_F_CMS_SIGNERINFO_VERIFY                      152
+# define CMS_F_CMS_SIGNERINFO_VERIFY_CERT                 153
+# define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT              154
+# define CMS_F_CMS_SIGN_RECEIPT                           163
+# define CMS_F_CMS_STREAM                                 155
+# define CMS_F_CMS_UNCOMPRESS                             156
+# define CMS_F_CMS_VERIFY                                 157
+
+/* Reason codes. */
+# define CMS_R_ADD_SIGNER_ERROR                           99
+# define CMS_R_CERTIFICATE_ALREADY_PRESENT                175
+# define CMS_R_CERTIFICATE_HAS_NO_KEYID                   160
+# define CMS_R_CERTIFICATE_VERIFY_ERROR                   100
+# define CMS_R_CIPHER_INITIALISATION_ERROR                101
+# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR      102
+# define CMS_R_CMS_DATAFINAL_ERROR                        103
+# define CMS_R_CMS_LIB                                    104
+# define CMS_R_CONTENTIDENTIFIER_MISMATCH                 170
+# define CMS_R_CONTENT_NOT_FOUND                          105
+# define CMS_R_CONTENT_TYPE_MISMATCH                      171
+# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA           106
+# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA            107
+# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA               108
+# define CMS_R_CONTENT_VERIFY_ERROR                       109
+# define CMS_R_CTRL_ERROR                                 110
+# define CMS_R_CTRL_FAILURE                               111
+# define CMS_R_DECRYPT_ERROR                              112
+# define CMS_R_DIGEST_ERROR                               161
+# define CMS_R_ERROR_GETTING_PUBLIC_KEY                   113
+# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE      114
+# define CMS_R_ERROR_SETTING_KEY                          115
+# define CMS_R_ERROR_SETTING_RECIPIENTINFO                116
+# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH               117
+# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER           176
+# define CMS_R_INVALID_KEY_LENGTH                         118
+# define CMS_R_MD_BIO_INIT_ERROR                          119
+# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH       120
+# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH                 121
+# define CMS_R_MSGSIGDIGEST_ERROR                         172
+# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE          162
+# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH                  163
+# define CMS_R_NEED_ONE_SIGNER                            164
+# define CMS_R_NOT_A_SIGNED_RECEIPT                       165
+# define CMS_R_NOT_ENCRYPTED_DATA                         122
+# define CMS_R_NOT_KEK                                    123
+# define CMS_R_NOT_KEY_TRANSPORT                          124
+# define CMS_R_NOT_PWRI                                   177
+# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE            125
+# define CMS_R_NO_CIPHER                                  126
+# define CMS_R_NO_CONTENT                                 127
+# define CMS_R_NO_CONTENT_TYPE                            173
+# define CMS_R_NO_DEFAULT_DIGEST                          128
+# define CMS_R_NO_DIGEST_SET                              129
+# define CMS_R_NO_KEY                                     130
+# define CMS_R_NO_KEY_OR_CERT                             174
+# define CMS_R_NO_MATCHING_DIGEST                         131
+# define CMS_R_NO_MATCHING_RECIPIENT                      132
+# define CMS_R_NO_MATCHING_SIGNATURE                      166
+# define CMS_R_NO_MSGSIGDIGEST                            167
+# define CMS_R_NO_PASSWORD                                178
+# define CMS_R_NO_PRIVATE_KEY                             133
+# define CMS_R_NO_PUBLIC_KEY                              134
+# define CMS_R_NO_RECEIPT_REQUEST                         168
+# define CMS_R_NO_SIGNERS                                 135
+# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE     136
+# define CMS_R_RECEIPT_DECODE_ERROR                       169
+# define CMS_R_RECIPIENT_ERROR                            137
+# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND               138
+# define CMS_R_SIGNFINAL_ERROR                            139
+# define CMS_R_SMIME_TEXT_ERROR                           140
+# define CMS_R_STORE_INIT_ERROR                           141
+# define CMS_R_TYPE_NOT_COMPRESSED_DATA                   142
+# define CMS_R_TYPE_NOT_DATA                              143
+# define CMS_R_TYPE_NOT_DIGESTED_DATA                     144
+# define CMS_R_TYPE_NOT_ENCRYPTED_DATA                    145
+# define CMS_R_TYPE_NOT_ENVELOPED_DATA                    146
+# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT                 147
+# define CMS_R_UNKNOWN_CIPHER                             148
+# define CMS_R_UNKNOWN_DIGEST_ALGORIHM                    149
+# define CMS_R_UNKNOWN_ID                                 150
+# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM          151
+# define CMS_R_UNSUPPORTED_CONTENT_TYPE                   152
+# define CMS_R_UNSUPPORTED_KEK_ALGORITHM                  153
+# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM       179
+# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE                 154
+# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE              155
+# define CMS_R_UNSUPPORTED_TYPE                           156
+# define CMS_R_UNWRAP_ERROR                               157
+# define CMS_R_UNWRAP_FAILURE                             180
+# define CMS_R_VERIFICATION_FAILURE                       158
+# define CMS_R_WRAP_ERROR                                 159
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/cms.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/crypto.h
===================================================================
--- lab4/.minix-src/include/openssl/crypto.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/crypto.h	(revision 13)
@@ -0,0 +1,661 @@
+/* crypto/crypto.h */
+/* ====================================================================
+ * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ * ECDH support in OpenSSL originally developed by
+ * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
+ */
+
+#ifndef HEADER_CRYPTO_H
+# define HEADER_CRYPTO_H
+
+# include <stdlib.h>
+
+# include <openssl/e_os2.h>
+
+# ifndef OPENSSL_NO_FP_API
+#  include <stdio.h>
+# endif
+
+# include <openssl/stack.h>
+# include <openssl/safestack.h>
+# include <openssl/opensslv.h>
+# include <openssl/ossl_typ.h>
+
+# ifdef CHARSET_EBCDIC
+#  include <openssl/ebcdic.h>
+# endif
+
+/*
+ * Resolve problems on some operating systems with symbol names that clash
+ * one way or another
+ */
+# include <openssl/symhacks.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Backward compatibility to SSLeay */
+/*
+ * This is more to be used to check the correct DLL is being used in the MS
+ * world.
+ */
+# define SSLEAY_VERSION_NUMBER   OPENSSL_VERSION_NUMBER
+# define SSLEAY_VERSION          0
+/* #define SSLEAY_OPTIONS       1 no longer supported */
+# define SSLEAY_CFLAGS           2
+# define SSLEAY_BUILT_ON         3
+# define SSLEAY_PLATFORM         4
+# define SSLEAY_DIR              5
+
+/* Already declared in ossl_typ.h */
+# if 0
+typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
+/* Called when a new object is created */
+typedef int CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
+                           int idx, long argl, void *argp);
+/* Called when an object is free()ed */
+typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
+                             int idx, long argl, void *argp);
+/* Called when we need to dup an object */
+typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from,
+                           void *from_d, int idx, long argl, void *argp);
+# endif
+
+/* A generic structure to pass assorted data in a expandable way */
+typedef struct openssl_item_st {
+    int code;
+    void *value;                /* Not used for flag attributes */
+    size_t value_size;          /* Max size of value for output, length for
+                                 * input */
+    size_t *value_length;       /* Returned length of value for output */
+} OPENSSL_ITEM;
+
+/*
+ * When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock
+ * names in cryptlib.c
+ */
+
+# define CRYPTO_LOCK_ERR                 1
+# define CRYPTO_LOCK_EX_DATA             2
+# define CRYPTO_LOCK_X509                3
+# define CRYPTO_LOCK_X509_INFO           4
+# define CRYPTO_LOCK_X509_PKEY           5
+# define CRYPTO_LOCK_X509_CRL            6
+# define CRYPTO_LOCK_X509_REQ            7
+# define CRYPTO_LOCK_DSA                 8
+# define CRYPTO_LOCK_RSA                 9
+# define CRYPTO_LOCK_EVP_PKEY            10
+# define CRYPTO_LOCK_X509_STORE          11
+# define CRYPTO_LOCK_SSL_CTX             12
+# define CRYPTO_LOCK_SSL_CERT            13
+# define CRYPTO_LOCK_SSL_SESSION         14
+# define CRYPTO_LOCK_SSL_SESS_CERT       15
+# define CRYPTO_LOCK_SSL                 16
+# define CRYPTO_LOCK_SSL_METHOD          17
+# define CRYPTO_LOCK_RAND                18
+# define CRYPTO_LOCK_RAND2               19
+# define CRYPTO_LOCK_MALLOC              20
+# define CRYPTO_LOCK_BIO                 21
+# define CRYPTO_LOCK_GETHOSTBYNAME       22
+# define CRYPTO_LOCK_GETSERVBYNAME       23
+# define CRYPTO_LOCK_READDIR             24
+# define CRYPTO_LOCK_RSA_BLINDING        25
+# define CRYPTO_LOCK_DH                  26
+# define CRYPTO_LOCK_MALLOC2             27
+# define CRYPTO_LOCK_DSO                 28
+# define CRYPTO_LOCK_DYNLOCK             29
+# define CRYPTO_LOCK_ENGINE              30
+# define CRYPTO_LOCK_UI                  31
+# define CRYPTO_LOCK_ECDSA               32
+# define CRYPTO_LOCK_EC                  33
+# define CRYPTO_LOCK_ECDH                34
+# define CRYPTO_LOCK_BN                  35
+# define CRYPTO_LOCK_EC_PRE_COMP         36
+# define CRYPTO_LOCK_STORE               37
+# define CRYPTO_LOCK_COMP                38
+# define CRYPTO_LOCK_FIPS                39
+# define CRYPTO_LOCK_FIPS2               40
+# define CRYPTO_NUM_LOCKS                41
+
+# define CRYPTO_LOCK             1
+# define CRYPTO_UNLOCK           2
+# define CRYPTO_READ             4
+# define CRYPTO_WRITE            8
+
+# ifndef OPENSSL_NO_LOCKING
+#  ifndef CRYPTO_w_lock
+#   define CRYPTO_w_lock(type)     \
+        CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
+#   define CRYPTO_w_unlock(type)   \
+        CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
+#   define CRYPTO_r_lock(type)     \
+        CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
+#   define CRYPTO_r_unlock(type)   \
+        CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
+#   define CRYPTO_add(addr,amount,type)    \
+        CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
+#  endif
+# else
+#  define CRYPTO_w_lock(a)
+#  define CRYPTO_w_unlock(a)
+#  define CRYPTO_r_lock(a)
+#  define CRYPTO_r_unlock(a)
+#  define CRYPTO_add(a,b,c)       ((*(a))+=(b))
+# endif
+
+/*
+ * Some applications as well as some parts of OpenSSL need to allocate and
+ * deallocate locks in a dynamic fashion.  The following typedef makes this
+ * possible in a type-safe manner.
+ */
+/* struct CRYPTO_dynlock_value has to be defined by the application. */
+typedef struct {
+    int references;
+    struct CRYPTO_dynlock_value *data;
+} CRYPTO_dynlock;
+
+/*
+ * The following can be used to detect memory leaks in the SSLeay library. It
+ * used, it turns on malloc checking
+ */
+
+# define CRYPTO_MEM_CHECK_OFF    0x0/* an enume */
+# define CRYPTO_MEM_CHECK_ON     0x1/* a bit */
+# define CRYPTO_MEM_CHECK_ENABLE 0x2/* a bit */
+# define CRYPTO_MEM_CHECK_DISABLE 0x3/* an enume */
+
+/*
+ * The following are bit values to turn on or off options connected to the
+ * malloc checking functionality
+ */
+
+/* Adds time to the memory checking information */
+# define V_CRYPTO_MDEBUG_TIME    0x1/* a bit */
+/* Adds thread number to the memory checking information */
+# define V_CRYPTO_MDEBUG_THREAD  0x2/* a bit */
+
+# define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)
+
+/* predec of the BIO type */
+typedef struct bio_st BIO_dummy;
+
+struct crypto_ex_data_st {
+    STACK_OF(void) *sk;
+    /* gcc is screwing up this data structure :-( */
+    int dummy;
+};
+DECLARE_STACK_OF(void)
+
+/*
+ * This stuff is basically class callback functions The current classes are
+ * SSL_CTX, SSL, SSL_SESSION, and a few more
+ */
+
+typedef struct crypto_ex_data_func_st {
+    long argl;                  /* Arbitary long */
+    void *argp;                 /* Arbitary void * */
+    CRYPTO_EX_new *new_func;
+    CRYPTO_EX_free *free_func;
+    CRYPTO_EX_dup *dup_func;
+} CRYPTO_EX_DATA_FUNCS;
+
+DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
+
+/*
+ * Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA
+ * entry.
+ */
+
+# define CRYPTO_EX_INDEX_BIO             0
+# define CRYPTO_EX_INDEX_SSL             1
+# define CRYPTO_EX_INDEX_SSL_CTX         2
+# define CRYPTO_EX_INDEX_SSL_SESSION     3
+# define CRYPTO_EX_INDEX_X509_STORE      4
+# define CRYPTO_EX_INDEX_X509_STORE_CTX  5
+# define CRYPTO_EX_INDEX_RSA             6
+# define CRYPTO_EX_INDEX_DSA             7
+# define CRYPTO_EX_INDEX_DH              8
+# define CRYPTO_EX_INDEX_ENGINE          9
+# define CRYPTO_EX_INDEX_X509            10
+# define CRYPTO_EX_INDEX_UI              11
+# define CRYPTO_EX_INDEX_ECDSA           12
+# define CRYPTO_EX_INDEX_ECDH            13
+# define CRYPTO_EX_INDEX_COMP            14
+# define CRYPTO_EX_INDEX_STORE           15
+
+/*
+ * Dynamically assigned indexes start from this value (don't use directly,
+ * use via CRYPTO_ex_data_new_class).
+ */
+# define CRYPTO_EX_INDEX_USER            100
+
+/*
+ * This is the default callbacks, but we can have others as well: this is
+ * needed in Win32 where the application malloc and the library malloc may
+ * not be the same.
+ */
+# define CRYPTO_malloc_init()    CRYPTO_set_mem_functions(\
+        malloc, realloc, free)
+
+# if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD
+#  ifndef CRYPTO_MDEBUG         /* avoid duplicate #define */
+#   define CRYPTO_MDEBUG
+#  endif
+# endif
+
+/*
+ * Set standard debugging functions (not done by default unless CRYPTO_MDEBUG
+ * is defined)
+ */
+# define CRYPTO_malloc_debug_init()      do {\
+        CRYPTO_set_mem_debug_functions(\
+                CRYPTO_dbg_malloc,\
+                CRYPTO_dbg_realloc,\
+                CRYPTO_dbg_free,\
+                CRYPTO_dbg_set_options,\
+                CRYPTO_dbg_get_options);\
+        } while(0)
+
+int CRYPTO_mem_ctrl(int mode);
+int CRYPTO_is_mem_check_on(void);
+
+/* for applications */
+# define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
+# define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
+
+/* for library-internal use */
+# define MemCheck_on()   CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)
+# define MemCheck_off()  CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
+# define is_MemCheck_on() CRYPTO_is_mem_check_on()
+
+# define OPENSSL_malloc(num)     CRYPTO_malloc((int)num,__FILE__,__LINE__)
+# define OPENSSL_strdup(str)     CRYPTO_strdup((str),__FILE__,__LINE__)
+# define OPENSSL_realloc(addr,num) \
+        CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
+# define OPENSSL_realloc_clean(addr,old_num,num) \
+        CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
+# define OPENSSL_remalloc(addr,num) \
+        CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
+# define OPENSSL_freeFunc        CRYPTO_free
+# define OPENSSL_free(addr)      CRYPTO_free(addr)
+
+# define OPENSSL_malloc_locked(num) \
+        CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
+# define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
+
+const char *SSLeay_version(int type);
+unsigned long SSLeay(void);
+
+int OPENSSL_issetugid(void);
+
+/* An opaque type representing an implementation of "ex_data" support */
+typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL;
+/* Return an opaque pointer to the current "ex_data" implementation */
+const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);
+/* Sets the "ex_data" implementation to be used (if it's not too late) */
+int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i);
+/* Get a new "ex_data" class, and return the corresponding "class_index" */
+int CRYPTO_ex_data_new_class(void);
+/* Within a given class, get/register a new index */
+int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
+                            CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
+                            CRYPTO_EX_free *free_func);
+/*
+ * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a
+ * given class (invokes whatever per-class callbacks are applicable)
+ */
+int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
+int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
+                       CRYPTO_EX_DATA *from);
+void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
+/*
+ * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular
+ * index (relative to the class type involved)
+ */
+int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
+void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx);
+/*
+ * This function cleans up all "ex_data" state. It mustn't be called under
+ * potential race-conditions.
+ */
+void CRYPTO_cleanup_all_ex_data(void);
+
+int CRYPTO_get_new_lockid(char *name);
+
+int CRYPTO_num_locks(void);     /* return CRYPTO_NUM_LOCKS (shared libs!) */
+void CRYPTO_lock(int mode, int type, const char *file, int line);
+void CRYPTO_set_locking_callback(void (*func) (int mode, int type,
+                                               const char *file, int line));
+void (*CRYPTO_get_locking_callback(void)) (int mode, int type,
+                                           const char *file, int line);
+void CRYPTO_set_add_lock_callback(int (*func)
+                                   (int *num, int mount, int type,
+                                    const char *file, int line));
+int (*CRYPTO_get_add_lock_callback(void)) (int *num, int mount, int type,
+                                           const char *file, int line);
+
+/* Don't use this structure directly. */
+typedef struct crypto_threadid_st {
+    void *ptr;
+    unsigned long val;
+} CRYPTO_THREADID;
+/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
+void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val);
+void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr);
+int CRYPTO_THREADID_set_callback(void (*threadid_func) (CRYPTO_THREADID *));
+void (*CRYPTO_THREADID_get_callback(void)) (CRYPTO_THREADID *);
+void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
+int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);
+void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);
+unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
+# ifndef OPENSSL_NO_DEPRECATED
+void CRYPTO_set_id_callback(unsigned long (*func) (void));
+unsigned long (*CRYPTO_get_id_callback(void)) (void);
+unsigned long CRYPTO_thread_id(void);
+# endif
+
+const char *CRYPTO_get_lock_name(int type);
+int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
+                    int line);
+
+int CRYPTO_get_new_dynlockid(void);
+void CRYPTO_destroy_dynlockid(int i);
+struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
+void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value
+                                        *(*dyn_create_function) (const char
+                                                                 *file,
+                                                                 int line));
+void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)
+                                       (int mode,
+                                        struct CRYPTO_dynlock_value *l,
+                                        const char *file, int line));
+void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)
+                                          (struct CRYPTO_dynlock_value *l,
+                                           const char *file, int line));
+struct CRYPTO_dynlock_value
+*(*CRYPTO_get_dynlock_create_callback(void)) (const char *file, int line);
+void (*CRYPTO_get_dynlock_lock_callback(void)) (int mode,
+                                                struct CRYPTO_dynlock_value
+                                                *l, const char *file,
+                                                int line);
+void (*CRYPTO_get_dynlock_destroy_callback(void)) (struct CRYPTO_dynlock_value
+                                                   *l, const char *file,
+                                                   int line);
+
+/*
+ * CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- call
+ * the latter last if you need different functions
+ */
+int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t),
+                             void (*f) (void *));
+int CRYPTO_set_locked_mem_functions(void *(*m) (size_t),
+                                    void (*freefunc) (void *));
+int CRYPTO_set_mem_ex_functions(void *(*m) (size_t, const char *, int),
+                                void *(*r) (void *, size_t, const char *,
+                                            int), void (*f) (void *));
+int CRYPTO_set_locked_mem_ex_functions(void *(*m) (size_t, const char *, int),
+                                       void (*freefunc) (void *));
+int CRYPTO_set_mem_debug_functions(void (*m)
+                                    (void *, int, const char *, int, int),
+                                   void (*r) (void *, void *, int,
+                                              const char *, int, int),
+                                   void (*f) (void *, int), void (*so) (long),
+                                   long (*go) (void));
+void CRYPTO_get_mem_functions(void *(**m) (size_t),
+                              void *(**r) (void *, size_t),
+                              void (**f) (void *));
+void CRYPTO_get_locked_mem_functions(void *(**m) (size_t),
+                                     void (**f) (void *));
+void CRYPTO_get_mem_ex_functions(void *(**m) (size_t, const char *, int),
+                                 void *(**r) (void *, size_t, const char *,
+                                              int), void (**f) (void *));
+void CRYPTO_get_locked_mem_ex_functions(void
+                                        *(**m) (size_t, const char *, int),
+                                        void (**f) (void *));
+void CRYPTO_get_mem_debug_functions(void (**m)
+                                     (void *, int, const char *, int, int),
+                                    void (**r) (void *, void *, int,
+                                                const char *, int, int),
+                                    void (**f) (void *, int),
+                                    void (**so) (long), long (**go) (void));
+
+void *CRYPTO_malloc_locked(int num, const char *file, int line);
+void CRYPTO_free_locked(void *ptr);
+void *CRYPTO_malloc(int num, const char *file, int line);
+char *CRYPTO_strdup(const char *str, const char *file, int line);
+void CRYPTO_free(void *ptr);
+void *CRYPTO_realloc(void *addr, int num, const char *file, int line);
+void *CRYPTO_realloc_clean(void *addr, int old_num, int num, const char *file,
+                           int line);
+void *CRYPTO_remalloc(void *addr, int num, const char *file, int line);
+
+void OPENSSL_cleanse(void *ptr, size_t len);
+
+void CRYPTO_set_mem_debug_options(long bits);
+long CRYPTO_get_mem_debug_options(void);
+
+# define CRYPTO_push_info(info) \
+        CRYPTO_push_info_(info, __FILE__, __LINE__);
+int CRYPTO_push_info_(const char *info, const char *file, int line);
+int CRYPTO_pop_info(void);
+int CRYPTO_remove_all_info(void);
+
+/*
+ * Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
+ * used as default in CRYPTO_MDEBUG compilations):
+ */
+/*-
+ * The last argument has the following significance:
+ *
+ * 0:   called before the actual memory allocation has taken place
+ * 1:   called after the actual memory allocation has taken place
+ */
+void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line,
+                       int before_p);
+void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, const char *file,
+                        int line, int before_p);
+void CRYPTO_dbg_free(void *addr, int before_p);
+/*-
+ * Tell the debugging code about options.  By default, the following values
+ * apply:
+ *
+ * 0:                           Clear all options.
+ * V_CRYPTO_MDEBUG_TIME (1):    Set the "Show Time" option.
+ * V_CRYPTO_MDEBUG_THREAD (2):  Set the "Show Thread Number" option.
+ * V_CRYPTO_MDEBUG_ALL (3):     1 + 2
+ */
+void CRYPTO_dbg_set_options(long bits);
+long CRYPTO_dbg_get_options(void);
+
+# ifndef OPENSSL_NO_FP_API
+void CRYPTO_mem_leaks_fp(FILE *);
+# endif
+void CRYPTO_mem_leaks(struct bio_st *bio);
+/* unsigned long order, char *file, int line, int num_bytes, char *addr */
+typedef void *CRYPTO_MEM_LEAK_CB (unsigned long, const char *, int, int,
+                                  void *);
+void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
+
+/* die if we have to */
+void OpenSSLDie(const char *file, int line, const char *assertion);
+# define OPENSSL_assert(e)       (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
+
+unsigned long *OPENSSL_ia32cap_loc(void);
+# define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
+int OPENSSL_isservice(void);
+
+int FIPS_mode(void);
+int FIPS_mode_set(int r);
+
+void OPENSSL_init(void);
+
+# define fips_md_init(alg) fips_md_init_ctx(alg, alg)
+
+# ifdef OPENSSL_FIPS
+#  define fips_md_init_ctx(alg, cx) \
+        int alg##_Init(cx##_CTX *c) \
+        { \
+        if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
+                "Low level API call to digest " #alg " forbidden in FIPS mode!"); \
+        return private_##alg##_Init(c); \
+        } \
+        int private_##alg##_Init(cx##_CTX *c)
+
+#  define fips_cipher_abort(alg) \
+        if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
+                "Low level API call to cipher " #alg " forbidden in FIPS mode!")
+
+# else
+#  define fips_md_init_ctx(alg, cx) \
+        int alg##_Init(cx##_CTX *c)
+#  define fips_cipher_abort(alg) while(0)
+# endif
+
+/*
+ * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal.
+ * It takes an amount of time dependent on |len|, but independent of the
+ * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements
+ * into a defined order as the return value when a != b is undefined, other
+ * than to be non-zero.
+ */
+int CRYPTO_memcmp(const void *a, const void *b, size_t len);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_CRYPTO_strings(void);
+
+/* Error codes for the CRYPTO functions. */
+
+/* Function codes. */
+# define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX                 100
+# define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID                103
+# define CRYPTO_F_CRYPTO_GET_NEW_LOCKID                   101
+# define CRYPTO_F_CRYPTO_SET_EX_DATA                      102
+# define CRYPTO_F_DEF_ADD_INDEX                           104
+# define CRYPTO_F_DEF_GET_CLASS                           105
+# define CRYPTO_F_FIPS_MODE_SET                           109
+# define CRYPTO_F_INT_DUP_EX_DATA                         106
+# define CRYPTO_F_INT_FREE_EX_DATA                        107
+# define CRYPTO_F_INT_NEW_EX_DATA                         108
+
+/* Reason codes. */
+# define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED                 101
+# define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK              100
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/crypto.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/dso.h
===================================================================
--- lab4/.minix-src/include/openssl/dso.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/dso.h	(revision 13)
@@ -0,0 +1,451 @@
+/* dso.h -*- mode:C; c-file-style: "eay" -*- */
+/*
+ * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project
+ * 2000.
+ */
+/* ====================================================================
+ * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_DSO_H
+# define HEADER_DSO_H
+
+# include <openssl/crypto.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* These values are used as commands to DSO_ctrl() */
+# define DSO_CTRL_GET_FLAGS      1
+# define DSO_CTRL_SET_FLAGS      2
+# define DSO_CTRL_OR_FLAGS       3
+
+/*
+ * By default, DSO_load() will translate the provided filename into a form
+ * typical for the platform (more specifically the DSO_METHOD) using the
+ * dso_name_converter function of the method. Eg. win32 will transform "blah"
+ * into "blah.dll", and dlfcn will transform it into "libblah.so". The
+ * behaviour can be overriden by setting the name_converter callback in the
+ * DSO object (using DSO_set_name_converter()). This callback could even
+ * utilise the DSO_METHOD's converter too if it only wants to override
+ * behaviour for one or two possible DSO methods. However, the following flag
+ * can be set in a DSO to prevent *any* native name-translation at all - eg.
+ * if the caller has prompted the user for a path to a driver library so the
+ * filename should be interpreted as-is.
+ */
+# define DSO_FLAG_NO_NAME_TRANSLATION            0x01
+/*
+ * An extra flag to give if only the extension should be added as
+ * translation.  This is obviously only of importance on Unix and other
+ * operating systems where the translation also may prefix the name with
+ * something, like 'lib', and ignored everywhere else. This flag is also
+ * ignored if DSO_FLAG_NO_NAME_TRANSLATION is used at the same time.
+ */
+# define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY      0x02
+
+/*
+ * The following flag controls the translation of symbol names to upper case.
+ * This is currently only being implemented for OpenVMS.
+ */
+# define DSO_FLAG_UPCASE_SYMBOL                  0x10
+
+/*
+ * This flag loads the library with public symbols. Meaning: The exported
+ * symbols of this library are public to all libraries loaded after this
+ * library. At the moment only implemented in unix.
+ */
+# define DSO_FLAG_GLOBAL_SYMBOLS                 0x20
+
+typedef void (*DSO_FUNC_TYPE) (void);
+
+typedef struct dso_st DSO;
+
+/*
+ * The function prototype used for method functions (or caller-provided
+ * callbacks) that transform filenames. They are passed a DSO structure
+ * pointer (or NULL if they are to be used independantly of a DSO object) and
+ * a filename to transform. They should either return NULL (if there is an
+ * error condition) or a newly allocated string containing the transformed
+ * form that the caller will need to free with OPENSSL_free() when done.
+ */
+typedef char *(*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
+/*
+ * The function prototype used for method functions (or caller-provided
+ * callbacks) that merge two file specifications. They are passed a DSO
+ * structure pointer (or NULL if they are to be used independantly of a DSO
+ * object) and two file specifications to merge. They should either return
+ * NULL (if there is an error condition) or a newly allocated string
+ * containing the result of merging that the caller will need to free with
+ * OPENSSL_free() when done. Here, merging means that bits and pieces are
+ * taken from each of the file specifications and added together in whatever
+ * fashion that is sensible for the DSO method in question.  The only rule
+ * that really applies is that if the two specification contain pieces of the
+ * same type, the copy from the first string takes priority.  One could see
+ * it as the first specification is the one given by the user and the second
+ * being a bunch of defaults to add on if they're missing in the first.
+ */
+typedef char *(*DSO_MERGER_FUNC)(DSO *, const char *, const char *);
+
+typedef struct dso_meth_st {
+    const char *name;
+    /*
+     * Loads a shared library, NB: new DSO_METHODs must ensure that a
+     * successful load populates the loaded_filename field, and likewise a
+     * successful unload OPENSSL_frees and NULLs it out.
+     */
+    int (*dso_load) (DSO *dso);
+    /* Unloads a shared library */
+    int (*dso_unload) (DSO *dso);
+    /* Binds a variable */
+    void *(*dso_bind_var) (DSO *dso, const char *symname);
+    /*
+     * Binds a function - assumes a return type of DSO_FUNC_TYPE. This should
+     * be cast to the real function prototype by the caller. Platforms that
+     * don't have compatible representations for different prototypes (this
+     * is possible within ANSI C) are highly unlikely to have shared
+     * libraries at all, let alone a DSO_METHOD implemented for them.
+     */
+    DSO_FUNC_TYPE (*dso_bind_func) (DSO *dso, const char *symname);
+/* I don't think this would actually be used in any circumstances. */
+# if 0
+    /* Unbinds a variable */
+    int (*dso_unbind_var) (DSO *dso, char *symname, void *symptr);
+    /* Unbinds a function */
+    int (*dso_unbind_func) (DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
+# endif
+    /*
+     * The generic (yuck) "ctrl()" function. NB: Negative return values
+     * (rather than zero) indicate errors.
+     */
+    long (*dso_ctrl) (DSO *dso, int cmd, long larg, void *parg);
+    /*
+     * The default DSO_METHOD-specific function for converting filenames to a
+     * canonical native form.
+     */
+    DSO_NAME_CONVERTER_FUNC dso_name_converter;
+    /*
+     * The default DSO_METHOD-specific function for converting filenames to a
+     * canonical native form.
+     */
+    DSO_MERGER_FUNC dso_merger;
+    /* [De]Initialisation handlers. */
+    int (*init) (DSO *dso);
+    int (*finish) (DSO *dso);
+    /* Return pathname of the module containing location */
+    int (*pathbyaddr) (void *addr, char *path, int sz);
+    /* Perform global symbol lookup, i.e. among *all* modules */
+    void *(*globallookup) (const char *symname);
+} DSO_METHOD;
+
+/**********************************************************************/
+/* The low-level handle type used to refer to a loaded shared library */
+
+struct dso_st {
+    DSO_METHOD *meth;
+    /*
+     * Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS doesn't use
+     * anything but will need to cache the filename for use in the dso_bind
+     * handler. All in all, let each method control its own destiny.
+     * "Handles" and such go in a STACK.
+     */
+    STACK_OF(void) *meth_data;
+    int references;
+    int flags;
+    /*
+     * For use by applications etc ... use this for your bits'n'pieces, don't
+     * touch meth_data!
+     */
+    CRYPTO_EX_DATA ex_data;
+    /*
+     * If this callback function pointer is set to non-NULL, then it will be
+     * used in DSO_load() in place of meth->dso_name_converter. NB: This
+     * should normally set using DSO_set_name_converter().
+     */
+    DSO_NAME_CONVERTER_FUNC name_converter;
+    /*
+     * If this callback function pointer is set to non-NULL, then it will be
+     * used in DSO_load() in place of meth->dso_merger. NB: This should
+     * normally set using DSO_set_merger().
+     */
+    DSO_MERGER_FUNC merger;
+    /*
+     * This is populated with (a copy of) the platform-independant filename
+     * used for this DSO.
+     */
+    char *filename;
+    /*
+     * This is populated with (a copy of) the translated filename by which
+     * the DSO was actually loaded. It is NULL iff the DSO is not currently
+     * loaded. NB: This is here because the filename translation process may
+     * involve a callback being invoked more than once not only to convert to
+     * a platform-specific form, but also to try different filenames in the
+     * process of trying to perform a load. As such, this variable can be
+     * used to indicate (a) whether this DSO structure corresponds to a
+     * loaded library or not, and (b) the filename with which it was actually
+     * loaded.
+     */
+    char *loaded_filename;
+};
+
+DSO *DSO_new(void);
+DSO *DSO_new_method(DSO_METHOD *method);
+int DSO_free(DSO *dso);
+int DSO_flags(DSO *dso);
+int DSO_up_ref(DSO *dso);
+long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg);
+
+/*
+ * This function sets the DSO's name_converter callback. If it is non-NULL,
+ * then it will be used instead of the associated DSO_METHOD's function. If
+ * oldcb is non-NULL then it is set to the function pointer value being
+ * replaced. Return value is non-zero for success.
+ */
+int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,
+                           DSO_NAME_CONVERTER_FUNC *oldcb);
+/*
+ * These functions can be used to get/set the platform-independant filename
+ * used for a DSO. NB: set will fail if the DSO is already loaded.
+ */
+const char *DSO_get_filename(DSO *dso);
+int DSO_set_filename(DSO *dso, const char *filename);
+/*
+ * This function will invoke the DSO's name_converter callback to translate a
+ * filename, or if the callback isn't set it will instead use the DSO_METHOD's
+ * converter. If "filename" is NULL, the "filename" in the DSO itself will be
+ * used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is
+ * simply duplicated. NB: This function is usually called from within a
+ * DSO_METHOD during the processing of a DSO_load() call, and is exposed so
+ * that caller-created DSO_METHODs can do the same thing. A non-NULL return
+ * value will need to be OPENSSL_free()'d.
+ */
+char *DSO_convert_filename(DSO *dso, const char *filename);
+/*
+ * This function will invoke the DSO's merger callback to merge two file
+ * specifications, or if the callback isn't set it will instead use the
+ * DSO_METHOD's merger.  A non-NULL return value will need to be
+ * OPENSSL_free()'d.
+ */
+char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
+/*
+ * If the DSO is currently loaded, this returns the filename that it was
+ * loaded under, otherwise it returns NULL. So it is also useful as a test as
+ * to whether the DSO is currently loaded. NB: This will not necessarily
+ * return the same value as DSO_convert_filename(dso, dso->filename), because
+ * the DSO_METHOD's load function may have tried a variety of filenames (with
+ * and/or without the aid of the converters) before settling on the one it
+ * actually loaded.
+ */
+const char *DSO_get_loaded_filename(DSO *dso);
+
+void DSO_set_default_method(DSO_METHOD *meth);
+DSO_METHOD *DSO_get_default_method(void);
+DSO_METHOD *DSO_get_method(DSO *dso);
+DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth);
+
+/*
+ * The all-singing all-dancing load function, you normally pass NULL for the
+ * first and third parameters. Use DSO_up and DSO_free for subsequent
+ * reference count handling. Any flags passed in will be set in the
+ * constructed DSO after its init() function but before the load operation.
+ * If 'dso' is non-NULL, 'flags' is ignored.
+ */
+DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags);
+
+/* This function binds to a variable inside a shared library. */
+void *DSO_bind_var(DSO *dso, const char *symname);
+
+/* This function binds to a function inside a shared library. */
+DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname);
+
+/*
+ * This method is the default, but will beg, borrow, or steal whatever method
+ * should be the default on any particular platform (including
+ * DSO_METH_null() if necessary).
+ */
+DSO_METHOD *DSO_METHOD_openssl(void);
+
+/*
+ * This method is defined for all platforms - if a platform has no DSO
+ * support then this will be the only method!
+ */
+DSO_METHOD *DSO_METHOD_null(void);
+
+/*
+ * If DSO_DLFCN is defined, the standard dlfcn.h-style functions (dlopen,
+ * dlclose, dlsym, etc) will be used and incorporated into this method. If
+ * not, this method will return NULL.
+ */
+DSO_METHOD *DSO_METHOD_dlfcn(void);
+
+/*
+ * If DSO_DL is defined, the standard dl.h-style functions (shl_load,
+ * shl_unload, shl_findsym, etc) will be used and incorporated into this
+ * method. If not, this method will return NULL.
+ */
+DSO_METHOD *DSO_METHOD_dl(void);
+
+/* If WIN32 is defined, use DLLs. If not, return NULL. */
+DSO_METHOD *DSO_METHOD_win32(void);
+
+/* If VMS is defined, use shared images. If not, return NULL. */
+DSO_METHOD *DSO_METHOD_vms(void);
+
+/*
+ * This function writes null-terminated pathname of DSO module containing
+ * 'addr' into 'sz' large caller-provided 'path' and returns the number of
+ * characters [including trailing zero] written to it. If 'sz' is 0 or
+ * negative, 'path' is ignored and required amount of charachers [including
+ * trailing zero] to accomodate pathname is returned. If 'addr' is NULL, then
+ * pathname of cryptolib itself is returned. Negative or zero return value
+ * denotes error.
+ */
+int DSO_pathbyaddr(void *addr, char *path, int sz);
+
+/*
+ * This function should be used with caution! It looks up symbols in *all*
+ * loaded modules and if module gets unloaded by somebody else attempt to
+ * dereference the pointer is doomed to have fatal consequences. Primary
+ * usage for this function is to probe *core* system functionality, e.g.
+ * check if getnameinfo(3) is available at run-time without bothering about
+ * OS-specific details such as libc.so.versioning or where does it actually
+ * reside: in libc itself or libsocket.
+ */
+void *DSO_global_lookup(const char *name);
+
+/* If BeOS is defined, use shared images. If not, return NULL. */
+DSO_METHOD *DSO_METHOD_beos(void);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_DSO_strings(void);
+
+/* Error codes for the DSO functions. */
+
+/* Function codes. */
+# define DSO_F_BEOS_BIND_FUNC                             144
+# define DSO_F_BEOS_BIND_VAR                              145
+# define DSO_F_BEOS_LOAD                                  146
+# define DSO_F_BEOS_NAME_CONVERTER                        147
+# define DSO_F_BEOS_UNLOAD                                148
+# define DSO_F_DLFCN_BIND_FUNC                            100
+# define DSO_F_DLFCN_BIND_VAR                             101
+# define DSO_F_DLFCN_LOAD                                 102
+# define DSO_F_DLFCN_MERGER                               130
+# define DSO_F_DLFCN_NAME_CONVERTER                       123
+# define DSO_F_DLFCN_UNLOAD                               103
+# define DSO_F_DL_BIND_FUNC                               104
+# define DSO_F_DL_BIND_VAR                                105
+# define DSO_F_DL_LOAD                                    106
+# define DSO_F_DL_MERGER                                  131
+# define DSO_F_DL_NAME_CONVERTER                          124
+# define DSO_F_DL_UNLOAD                                  107
+# define DSO_F_DSO_BIND_FUNC                              108
+# define DSO_F_DSO_BIND_VAR                               109
+# define DSO_F_DSO_CONVERT_FILENAME                       126
+# define DSO_F_DSO_CTRL                                   110
+# define DSO_F_DSO_FREE                                   111
+# define DSO_F_DSO_GET_FILENAME                           127
+# define DSO_F_DSO_GET_LOADED_FILENAME                    128
+# define DSO_F_DSO_GLOBAL_LOOKUP                          139
+# define DSO_F_DSO_LOAD                                   112
+# define DSO_F_DSO_MERGE                                  132
+# define DSO_F_DSO_NEW_METHOD                             113
+# define DSO_F_DSO_PATHBYADDR                             140
+# define DSO_F_DSO_SET_FILENAME                           129
+# define DSO_F_DSO_SET_NAME_CONVERTER                     122
+# define DSO_F_DSO_UP_REF                                 114
+# define DSO_F_GLOBAL_LOOKUP_FUNC                         138
+# define DSO_F_PATHBYADDR                                 137
+# define DSO_F_VMS_BIND_SYM                               115
+# define DSO_F_VMS_LOAD                                   116
+# define DSO_F_VMS_MERGER                                 133
+# define DSO_F_VMS_UNLOAD                                 117
+# define DSO_F_WIN32_BIND_FUNC                            118
+# define DSO_F_WIN32_BIND_VAR                             119
+# define DSO_F_WIN32_GLOBALLOOKUP                         142
+# define DSO_F_WIN32_GLOBALLOOKUP_FUNC                    143
+# define DSO_F_WIN32_JOINER                               135
+# define DSO_F_WIN32_LOAD                                 120
+# define DSO_F_WIN32_MERGER                               134
+# define DSO_F_WIN32_NAME_CONVERTER                       125
+# define DSO_F_WIN32_PATHBYADDR                           141
+# define DSO_F_WIN32_SPLITTER                             136
+# define DSO_F_WIN32_UNLOAD                               121
+
+/* Reason codes. */
+# define DSO_R_CTRL_FAILED                                100
+# define DSO_R_DSO_ALREADY_LOADED                         110
+# define DSO_R_EMPTY_FILE_STRUCTURE                       113
+# define DSO_R_FAILURE                                    114
+# define DSO_R_FILENAME_TOO_BIG                           101
+# define DSO_R_FINISH_FAILED                              102
+# define DSO_R_INCORRECT_FILE_SYNTAX                      115
+# define DSO_R_LOAD_FAILED                                103
+# define DSO_R_NAME_TRANSLATION_FAILED                    109
+# define DSO_R_NO_FILENAME                                111
+# define DSO_R_NO_FILE_SPECIFICATION                      116
+# define DSO_R_NULL_HANDLE                                104
+# define DSO_R_SET_FILENAME_FAILED                        112
+# define DSO_R_STACK_ERROR                                105
+# define DSO_R_SYM_FAILURE                                106
+# define DSO_R_UNLOAD_FAILED                              107
+# define DSO_R_UNSUPPORTED                                108
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/dso.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/idea.h
===================================================================
--- lab4/.minix-src/include/openssl/idea.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/idea.h	(revision 13)
@@ -0,0 +1,107 @@
+/* crypto/idea/idea.h */
+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_IDEA_H
+# define HEADER_IDEA_H
+
+# include <openssl/opensslconf.h>/* IDEA_INT, OPENSSL_NO_IDEA */
+
+# ifdef OPENSSL_NO_IDEA
+#  error IDEA is disabled.
+# endif
+
+# include <sys/types.h>
+
+# define IDEA_ENCRYPT    1
+# define IDEA_DECRYPT    0
+
+# define IDEA_BLOCK      8
+# define IDEA_KEY_LENGTH 16
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct idea_key_st {
+    IDEA_INT data[9][6];
+} IDEA_KEY_SCHEDULE;
+
+const char *idea_options(void);
+void idea_ecb_encrypt(const unsigned char *in, unsigned char *out,
+                      IDEA_KEY_SCHEDULE *ks);
+# ifdef OPENSSL_FIPS
+void private_idea_set_encrypt_key(const unsigned char *key,
+                                  IDEA_KEY_SCHEDULE *ks);
+# endif
+void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);
+void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
+void idea_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                      long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
+                      int enc);
+void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out,
+                        long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
+                        int *num, int enc);
+void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out,
+                        long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
+                        int *num);
+void idea_encrypt(IDEA_INT *in, IDEA_KEY_SCHEDULE *ks);
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/idea.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/md2.h
===================================================================
--- lab4/.minix-src/include/openssl/md2.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/md2.h	(revision 13)
@@ -0,0 +1,94 @@
+/* crypto/md/md2.h */
+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_MD2_H
+# define HEADER_MD2_H
+
+# include <openssl/opensslconf.h>/* OPENSSL_NO_MD2, MD2_INT */
+# ifdef OPENSSL_NO_MD2
+#  error MD2 is disabled.
+# endif
+# include <stddef.h>
+
+# define MD2_DIGEST_LENGTH       16
+# define MD2_BLOCK               16
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct MD2state_st {
+    unsigned int num;
+    unsigned char data[MD2_BLOCK];
+    MD2_INT cksm[MD2_BLOCK];
+    MD2_INT state[MD2_BLOCK];
+} MD2_CTX;
+
+const char *MD2_options(void);
+# ifdef OPENSSL_FIPS
+int private_MD2_Init(MD2_CTX *c);
+# endif
+int MD2_Init(MD2_CTX *c);
+int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len);
+int MD2_Final(unsigned char *md, MD2_CTX *c);
+unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md);
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/md2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/asn1.h
===================================================================
--- lab4/.minix-src/include/openssl/asn1.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/asn1.h	(revision 13)
@@ -0,0 +1,1417 @@
+/* crypto/asn1/asn1.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_ASN1_H
+# define HEADER_ASN1_H
+
+# include <time.h>
+# include <openssl/e_os2.h>
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+# include <openssl/stack.h>
+# include <openssl/safestack.h>
+
+# include <openssl/symhacks.h>
+
+# include <openssl/ossl_typ.h>
+# ifndef OPENSSL_NO_DEPRECATED
+#  include <openssl/bn.h>
+# endif
+
+# ifdef OPENSSL_BUILD_SHLIBCRYPTO
+#  undef OPENSSL_EXTERN
+#  define OPENSSL_EXTERN OPENSSL_EXPORT
+# endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# define V_ASN1_UNIVERSAL                0x00
+# define V_ASN1_APPLICATION              0x40
+# define V_ASN1_CONTEXT_SPECIFIC         0x80
+# define V_ASN1_PRIVATE                  0xc0
+
+# define V_ASN1_CONSTRUCTED              0x20
+# define V_ASN1_PRIMITIVE_TAG            0x1f
+# define V_ASN1_PRIMATIVE_TAG            0x1f
+
+# define V_ASN1_APP_CHOOSE               -2/* let the recipient choose */
+# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
+# define V_ASN1_ANY                      -4/* used in ASN1 template code */
+
+# define V_ASN1_NEG                      0x100/* negative flag */
+
+# define V_ASN1_UNDEF                    -1
+# define V_ASN1_EOC                      0
+# define V_ASN1_BOOLEAN                  1 /**/
+# define V_ASN1_INTEGER                  2
+# define V_ASN1_NEG_INTEGER              (2 | V_ASN1_NEG)
+# define V_ASN1_BIT_STRING               3
+# define V_ASN1_OCTET_STRING             4
+# define V_ASN1_NULL                     5
+# define V_ASN1_OBJECT                   6
+# define V_ASN1_OBJECT_DESCRIPTOR        7
+# define V_ASN1_EXTERNAL                 8
+# define V_ASN1_REAL                     9
+# define V_ASN1_ENUMERATED               10
+# define V_ASN1_NEG_ENUMERATED           (10 | V_ASN1_NEG)
+# define V_ASN1_UTF8STRING               12
+# define V_ASN1_SEQUENCE                 16
+# define V_ASN1_SET                      17
+# define V_ASN1_NUMERICSTRING            18 /**/
+# define V_ASN1_PRINTABLESTRING          19
+# define V_ASN1_T61STRING                20
+# define V_ASN1_TELETEXSTRING            20/* alias */
+# define V_ASN1_VIDEOTEXSTRING           21 /**/
+# define V_ASN1_IA5STRING                22
+# define V_ASN1_UTCTIME                  23
+# define V_ASN1_GENERALIZEDTIME          24 /**/
+# define V_ASN1_GRAPHICSTRING            25 /**/
+# define V_ASN1_ISO64STRING              26 /**/
+# define V_ASN1_VISIBLESTRING            26/* alias */
+# define V_ASN1_GENERALSTRING            27 /**/
+# define V_ASN1_UNIVERSALSTRING          28 /**/
+# define V_ASN1_BMPSTRING                30
+/* For use with d2i_ASN1_type_bytes() */
+# define B_ASN1_NUMERICSTRING    0x0001
+# define B_ASN1_PRINTABLESTRING  0x0002
+# define B_ASN1_T61STRING        0x0004
+# define B_ASN1_TELETEXSTRING    0x0004
+# define B_ASN1_VIDEOTEXSTRING   0x0008
+# define B_ASN1_IA5STRING        0x0010
+# define B_ASN1_GRAPHICSTRING    0x0020
+# define B_ASN1_ISO64STRING      0x0040
+# define B_ASN1_VISIBLESTRING    0x0040
+# define B_ASN1_GENERALSTRING    0x0080
+# define B_ASN1_UNIVERSALSTRING  0x0100
+# define B_ASN1_OCTET_STRING     0x0200
+# define B_ASN1_BIT_STRING       0x0400
+# define B_ASN1_BMPSTRING        0x0800
+# define B_ASN1_UNKNOWN          0x1000
+# define B_ASN1_UTF8STRING       0x2000
+# define B_ASN1_UTCTIME          0x4000
+# define B_ASN1_GENERALIZEDTIME  0x8000
+# define B_ASN1_SEQUENCE         0x10000
+/* For use with ASN1_mbstring_copy() */
+# define MBSTRING_FLAG           0x1000
+# define MBSTRING_UTF8           (MBSTRING_FLAG)
+# define MBSTRING_ASC            (MBSTRING_FLAG|1)
+# define MBSTRING_BMP            (MBSTRING_FLAG|2)
+# define MBSTRING_UNIV           (MBSTRING_FLAG|4)
+# define SMIME_OLDMIME           0x400
+# define SMIME_CRLFEOL           0x800
+# define SMIME_STREAM            0x1000
+    struct X509_algor_st;
+DECLARE_STACK_OF(X509_ALGOR)
+
+# define DECLARE_ASN1_SET_OF(type)/* filled in by mkstack.pl */
+# define IMPLEMENT_ASN1_SET_OF(type)/* nothing, no longer needed */
+
+/*
+ * We MUST make sure that, except for constness, asn1_ctx_st and
+ * asn1_const_ctx are exactly the same.  Fortunately, as soon as the old ASN1
+ * parsing macros are gone, we can throw this away as well...
+ */
+typedef struct asn1_ctx_st {
+    unsigned char *p;           /* work char pointer */
+    int eos;                    /* end of sequence read for indefinite
+                                 * encoding */
+    int error;                  /* error code to use when returning an error */
+    int inf;                    /* constructed if 0x20, indefinite is 0x21 */
+    int tag;                    /* tag from last 'get object' */
+    int xclass;                 /* class from last 'get object' */
+    long slen;                  /* length of last 'get object' */
+    unsigned char *max;         /* largest value of p allowed */
+    unsigned char *q;           /* temporary variable */
+    unsigned char **pp;         /* variable */
+    int line;                   /* used in error processing */
+} ASN1_CTX;
+
+typedef struct asn1_const_ctx_st {
+    const unsigned char *p;     /* work char pointer */
+    int eos;                    /* end of sequence read for indefinite
+                                 * encoding */
+    int error;                  /* error code to use when returning an error */
+    int inf;                    /* constructed if 0x20, indefinite is 0x21 */
+    int tag;                    /* tag from last 'get object' */
+    int xclass;                 /* class from last 'get object' */
+    long slen;                  /* length of last 'get object' */
+    const unsigned char *max;   /* largest value of p allowed */
+    const unsigned char *q;     /* temporary variable */
+    const unsigned char **pp;   /* variable */
+    int line;                   /* used in error processing */
+} ASN1_const_CTX;
+
+/*
+ * These are used internally in the ASN1_OBJECT to keep track of whether the
+ * names and data need to be free()ed
+ */
+# define ASN1_OBJECT_FLAG_DYNAMIC         0x01/* internal use */
+# define ASN1_OBJECT_FLAG_CRITICAL        0x02/* critical x509v3 object id */
+# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */
+# define ASN1_OBJECT_FLAG_DYNAMIC_DATA    0x08/* internal use */
+typedef struct asn1_object_st {
+    const char *sn, *ln;
+    int nid;
+    int length;
+    const unsigned char *data;  /* data remains const after init */
+    int flags;                  /* Should we free this one */
+} ASN1_OBJECT;
+
+# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */
+/*
+ * This indicates that the ASN1_STRING is not a real value but just a place
+ * holder for the location where indefinite length constructed data should be
+ * inserted in the memory buffer
+ */
+# define ASN1_STRING_FLAG_NDEF 0x010
+
+/*
+ * This flag is used by the CMS code to indicate that a string is not
+ * complete and is a place holder for content when it had all been accessed.
+ * The flag will be reset when content has been written to it.
+ */
+
+# define ASN1_STRING_FLAG_CONT 0x020
+/*
+ * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING
+ * type.
+ */
+# define ASN1_STRING_FLAG_MSTRING 0x040
+/* This is the base type that holds just about everything :-) */
+struct asn1_string_st {
+    int length;
+    int type;
+    unsigned char *data;
+    /*
+     * The value of the following field depends on the type being held.  It
+     * is mostly being used for BIT_STRING so if the input data has a
+     * non-zero 'unused bits' value, it will be handled correctly
+     */
+    long flags;
+};
+
+/*
+ * ASN1_ENCODING structure: this is used to save the received encoding of an
+ * ASN1 type. This is useful to get round problems with invalid encodings
+ * which can break signatures.
+ */
+
+typedef struct ASN1_ENCODING_st {
+    unsigned char *enc;         /* DER encoding */
+    long len;                   /* Length of encoding */
+    int modified;               /* set to 1 if 'enc' is invalid */
+} ASN1_ENCODING;
+
+/* Used with ASN1 LONG type: if a long is set to this it is omitted */
+# define ASN1_LONG_UNDEF 0x7fffffffL
+
+# define STABLE_FLAGS_MALLOC     0x01
+# define STABLE_NO_MASK          0x02
+# define DIRSTRING_TYPE  \
+ (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
+# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING)
+
+typedef struct asn1_string_table_st {
+    int nid;
+    long minsize;
+    long maxsize;
+    unsigned long mask;
+    unsigned long flags;
+} ASN1_STRING_TABLE;
+
+DECLARE_STACK_OF(ASN1_STRING_TABLE)
+
+/* size limits: this stuff is taken straight from RFC2459 */
+
+# define ub_name                         32768
+# define ub_common_name                  64
+# define ub_locality_name                128
+# define ub_state_name                   128
+# define ub_organization_name            64
+# define ub_organization_unit_name       64
+# define ub_title                        64
+# define ub_email_address                128
+
+/*
+ * Declarations for template structures: for full definitions see asn1t.h
+ */
+typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;
+typedef struct ASN1_TLC_st ASN1_TLC;
+/* This is just an opaque pointer */
+typedef struct ASN1_VALUE_st ASN1_VALUE;
+
+/* Declare ASN1 functions: the implement macro in in asn1t.h */
+
+# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
+
+# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \
+        DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
+
+# define DECLARE_ASN1_FUNCTIONS_name(type, name) \
+        DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
+        DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
+
+# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
+        DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
+        DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
+
+# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
+        type *d2i_##name(type **a, const unsigned char **in, long len); \
+        int i2d_##name(type *a, unsigned char **out); \
+        DECLARE_ASN1_ITEM(itname)
+
+# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
+        type *d2i_##name(type **a, const unsigned char **in, long len); \
+        int i2d_##name(const type *a, unsigned char **out); \
+        DECLARE_ASN1_ITEM(name)
+
+# define DECLARE_ASN1_NDEF_FUNCTION(name) \
+        int i2d_##name##_NDEF(name *a, unsigned char **out);
+
+# define DECLARE_ASN1_FUNCTIONS_const(name) \
+        DECLARE_ASN1_ALLOC_FUNCTIONS(name) \
+        DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name)
+
+# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
+        type *name##_new(void); \
+        void name##_free(type *a);
+
+# define DECLARE_ASN1_PRINT_FUNCTION(stname) \
+        DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname)
+
+# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \
+        int fname##_print_ctx(BIO *out, stname *x, int indent, \
+                                         const ASN1_PCTX *pctx);
+
+# define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
+# define I2D_OF(type) int (*)(type *,unsigned char **)
+# define I2D_OF_const(type) int (*)(const type *,unsigned char **)
+
+# define CHECKED_D2I_OF(type, d2i) \
+    ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))
+# define CHECKED_I2D_OF(type, i2d) \
+    ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))
+# define CHECKED_NEW_OF(type, xnew) \
+    ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))
+# define CHECKED_PTR_OF(type, p) \
+    ((void*) (1 ? p : (type*)0))
+# define CHECKED_PPTR_OF(type, p) \
+    ((void**) (1 ? p : (type**)0))
+
+# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
+# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
+# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
+
+TYPEDEF_D2I2D_OF(void);
+
+/*-
+ * The following macros and typedefs allow an ASN1_ITEM
+ * to be embedded in a structure and referenced. Since
+ * the ASN1_ITEM pointers need to be globally accessible
+ * (possibly from shared libraries) they may exist in
+ * different forms. On platforms that support it the
+ * ASN1_ITEM structure itself will be globally exported.
+ * Other platforms will export a function that returns
+ * an ASN1_ITEM pointer.
+ *
+ * To handle both cases transparently the macros below
+ * should be used instead of hard coding an ASN1_ITEM
+ * pointer in a structure.
+ *
+ * The structure will look like this:
+ *
+ * typedef struct SOMETHING_st {
+ *      ...
+ *      ASN1_ITEM_EXP *iptr;
+ *      ...
+ * } SOMETHING;
+ *
+ * It would be initialised as e.g.:
+ *
+ * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...};
+ *
+ * and the actual pointer extracted with:
+ *
+ * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr);
+ *
+ * Finally an ASN1_ITEM pointer can be extracted from an
+ * appropriate reference with: ASN1_ITEM_rptr(X509). This
+ * would be used when a function takes an ASN1_ITEM * argument.
+ *
+ */
+
+# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
+
+/* ASN1_ITEM pointer exported type */
+typedef const ASN1_ITEM ASN1_ITEM_EXP;
+
+/* Macro to obtain ASN1_ITEM pointer from exported type */
+#  define ASN1_ITEM_ptr(iptr) (iptr)
+
+/* Macro to include ASN1_ITEM pointer from base type */
+#  define ASN1_ITEM_ref(iptr) (&(iptr##_it))
+
+#  define ASN1_ITEM_rptr(ref) (&(ref##_it))
+
+#  define DECLARE_ASN1_ITEM(name) \
+        OPENSSL_EXTERN const ASN1_ITEM name##_it;
+
+# else
+
+/*
+ * Platforms that can't easily handle shared global variables are declared as
+ * functions returning ASN1_ITEM pointers.
+ */
+
+/* ASN1_ITEM pointer exported type */
+typedef const ASN1_ITEM *ASN1_ITEM_EXP (void);
+
+/* Macro to obtain ASN1_ITEM pointer from exported type */
+#  define ASN1_ITEM_ptr(iptr) (iptr())
+
+/* Macro to include ASN1_ITEM pointer from base type */
+#  define ASN1_ITEM_ref(iptr) (iptr##_it)
+
+#  define ASN1_ITEM_rptr(ref) (ref##_it())
+
+#  define DECLARE_ASN1_ITEM(name) \
+        const ASN1_ITEM * name##_it(void);
+
+# endif
+
+/* Parameters used by ASN1_STRING_print_ex() */
+
+/*
+ * These determine which characters to escape: RFC2253 special characters,
+ * control characters and MSB set characters
+ */
+
+# define ASN1_STRFLGS_ESC_2253           1
+# define ASN1_STRFLGS_ESC_CTRL           2
+# define ASN1_STRFLGS_ESC_MSB            4
+
+/*
+ * This flag determines how we do escaping: normally RC2253 backslash only,
+ * set this to use backslash and quote.
+ */
+
+# define ASN1_STRFLGS_ESC_QUOTE          8
+
+/* These three flags are internal use only. */
+
+/* Character is a valid PrintableString character */
+# define CHARTYPE_PRINTABLESTRING        0x10
+/* Character needs escaping if it is the first character */
+# define CHARTYPE_FIRST_ESC_2253         0x20
+/* Character needs escaping if it is the last character */
+# define CHARTYPE_LAST_ESC_2253          0x40
+
+/*
+ * NB the internal flags are safely reused below by flags handled at the top
+ * level.
+ */
+
+/*
+ * If this is set we convert all character strings to UTF8 first
+ */
+
+# define ASN1_STRFLGS_UTF8_CONVERT       0x10
+
+/*
+ * If this is set we don't attempt to interpret content: just assume all
+ * strings are 1 byte per character. This will produce some pretty odd
+ * looking output!
+ */
+
+# define ASN1_STRFLGS_IGNORE_TYPE        0x20
+
+/* If this is set we include the string type in the output */
+# define ASN1_STRFLGS_SHOW_TYPE          0x40
+
+/*
+ * This determines which strings to display and which to 'dump' (hex dump of
+ * content octets or DER encoding). We can only dump non character strings or
+ * everything. If we don't dump 'unknown' they are interpreted as character
+ * strings with 1 octet per character and are subject to the usual escaping
+ * options.
+ */
+
+# define ASN1_STRFLGS_DUMP_ALL           0x80
+# define ASN1_STRFLGS_DUMP_UNKNOWN       0x100
+
+/*
+ * These determine what 'dumping' does, we can dump the content octets or the
+ * DER encoding: both use the RFC2253 #XXXXX notation.
+ */
+
+# define ASN1_STRFLGS_DUMP_DER           0x200
+
+/*
+ * All the string flags consistent with RFC2253, escaping control characters
+ * isn't essential in RFC2253 but it is advisable anyway.
+ */
+
+# define ASN1_STRFLGS_RFC2253    (ASN1_STRFLGS_ESC_2253 | \
+                                ASN1_STRFLGS_ESC_CTRL | \
+                                ASN1_STRFLGS_ESC_MSB | \
+                                ASN1_STRFLGS_UTF8_CONVERT | \
+                                ASN1_STRFLGS_DUMP_UNKNOWN | \
+                                ASN1_STRFLGS_DUMP_DER)
+
+DECLARE_STACK_OF(ASN1_INTEGER)
+DECLARE_ASN1_SET_OF(ASN1_INTEGER)
+
+DECLARE_STACK_OF(ASN1_GENERALSTRING)
+
+typedef struct asn1_type_st {
+    int type;
+    union {
+        char *ptr;
+        ASN1_BOOLEAN boolean;
+        ASN1_STRING *asn1_string;
+        ASN1_OBJECT *object;
+        ASN1_INTEGER *integer;
+        ASN1_ENUMERATED *enumerated;
+        ASN1_BIT_STRING *bit_string;
+        ASN1_OCTET_STRING *octet_string;
+        ASN1_PRINTABLESTRING *printablestring;
+        ASN1_T61STRING *t61string;
+        ASN1_IA5STRING *ia5string;
+        ASN1_GENERALSTRING *generalstring;
+        ASN1_BMPSTRING *bmpstring;
+        ASN1_UNIVERSALSTRING *universalstring;
+        ASN1_UTCTIME *utctime;
+        ASN1_GENERALIZEDTIME *generalizedtime;
+        ASN1_VISIBLESTRING *visiblestring;
+        ASN1_UTF8STRING *utf8string;
+        /*
+         * set and sequence are left complete and still contain the set or
+         * sequence bytes
+         */
+        ASN1_STRING *set;
+        ASN1_STRING *sequence;
+        ASN1_VALUE *asn1_value;
+    } value;
+} ASN1_TYPE;
+
+DECLARE_STACK_OF(ASN1_TYPE)
+DECLARE_ASN1_SET_OF(ASN1_TYPE)
+
+typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
+
+DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
+DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
+
+typedef struct NETSCAPE_X509_st {
+    ASN1_OCTET_STRING *header;
+    X509 *cert;
+} NETSCAPE_X509;
+
+/* This is used to contain a list of bit names */
+typedef struct BIT_STRING_BITNAME_st {
+    int bitnum;
+    const char *lname;
+    const char *sname;
+} BIT_STRING_BITNAME;
+
+# define M_ASN1_STRING_length(x) ((x)->length)
+# define M_ASN1_STRING_length_set(x, n)  ((x)->length = (n))
+# define M_ASN1_STRING_type(x)   ((x)->type)
+# define M_ASN1_STRING_data(x)   ((x)->data)
+
+/* Macros for string operations */
+# define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\
+                ASN1_STRING_type_new(V_ASN1_BIT_STRING)
+# define M_ASN1_BIT_STRING_free(a)       ASN1_STRING_free((ASN1_STRING *)a)
+# define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
+                ASN1_STRING_dup((const ASN1_STRING *)a)
+# define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
+                (const ASN1_STRING *)a,(const ASN1_STRING *)b)
+# define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
+
+# define M_ASN1_INTEGER_new()    (ASN1_INTEGER *)\
+                ASN1_STRING_type_new(V_ASN1_INTEGER)
+# define M_ASN1_INTEGER_free(a)          ASN1_STRING_free((ASN1_STRING *)a)
+# define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)\
+                ASN1_STRING_dup((const ASN1_STRING *)a)
+# define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\
+                (const ASN1_STRING *)a,(const ASN1_STRING *)b)
+
+# define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\
+                ASN1_STRING_type_new(V_ASN1_ENUMERATED)
+# define M_ASN1_ENUMERATED_free(a)       ASN1_STRING_free((ASN1_STRING *)a)
+# define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)\
+                ASN1_STRING_dup((const ASN1_STRING *)a)
+# define M_ASN1_ENUMERATED_cmp(a,b)      ASN1_STRING_cmp(\
+                (const ASN1_STRING *)a,(const ASN1_STRING *)b)
+
+# define M_ASN1_OCTET_STRING_new()       (ASN1_OCTET_STRING *)\
+                ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
+# define M_ASN1_OCTET_STRING_free(a)     ASN1_STRING_free((ASN1_STRING *)a)
+# define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
+                ASN1_STRING_dup((const ASN1_STRING *)a)
+# define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
+                (const ASN1_STRING *)a,(const ASN1_STRING *)b)
+# define M_ASN1_OCTET_STRING_set(a,b,c)  ASN1_STRING_set((ASN1_STRING *)a,b,c)
+# define M_ASN1_OCTET_STRING_print(a,b)  ASN1_STRING_print(a,(ASN1_STRING *)b)
+# define M_i2d_ASN1_OCTET_STRING(a,pp) \
+                i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
+                V_ASN1_UNIVERSAL)
+
+# define B_ASN1_TIME \
+                        B_ASN1_UTCTIME | \
+                        B_ASN1_GENERALIZEDTIME
+
+# define B_ASN1_PRINTABLE \
+                        B_ASN1_NUMERICSTRING| \
+                        B_ASN1_PRINTABLESTRING| \
+                        B_ASN1_T61STRING| \
+                        B_ASN1_IA5STRING| \
+                        B_ASN1_BIT_STRING| \
+                        B_ASN1_UNIVERSALSTRING|\
+                        B_ASN1_BMPSTRING|\
+                        B_ASN1_UTF8STRING|\
+                        B_ASN1_SEQUENCE|\
+                        B_ASN1_UNKNOWN
+
+# define B_ASN1_DIRECTORYSTRING \
+                        B_ASN1_PRINTABLESTRING| \
+                        B_ASN1_TELETEXSTRING|\
+                        B_ASN1_BMPSTRING|\
+                        B_ASN1_UNIVERSALSTRING|\
+                        B_ASN1_UTF8STRING
+
+# define B_ASN1_DISPLAYTEXT \
+                        B_ASN1_IA5STRING| \
+                        B_ASN1_VISIBLESTRING| \
+                        B_ASN1_BMPSTRING|\
+                        B_ASN1_UTF8STRING
+
+# define M_ASN1_PRINTABLE_new()  ASN1_STRING_type_new(V_ASN1_T61STRING)
+# define M_ASN1_PRINTABLE_free(a)        ASN1_STRING_free((ASN1_STRING *)a)
+# define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
+                pp,a->type,V_ASN1_UNIVERSAL)
+# define M_d2i_ASN1_PRINTABLE(a,pp,l) \
+                d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
+                        B_ASN1_PRINTABLE)
+
+# define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
+# define M_DIRECTORYSTRING_free(a)       ASN1_STRING_free((ASN1_STRING *)a)
+# define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
+                                                pp,a->type,V_ASN1_UNIVERSAL)
+# define M_d2i_DIRECTORYSTRING(a,pp,l) \
+                d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
+                        B_ASN1_DIRECTORYSTRING)
+
+# define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
+# define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)
+# define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
+                                                pp,a->type,V_ASN1_UNIVERSAL)
+# define M_d2i_DISPLAYTEXT(a,pp,l) \
+                d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
+                        B_ASN1_DISPLAYTEXT)
+
+# define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\
+                ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
+# define M_ASN1_PRINTABLESTRING_free(a)  ASN1_STRING_free((ASN1_STRING *)a)
+# define M_i2d_ASN1_PRINTABLESTRING(a,pp) \
+                i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\
+                V_ASN1_UNIVERSAL)
+# define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \
+                (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\
+                ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING)
+
+# define M_ASN1_T61STRING_new()  (ASN1_T61STRING *)\
+                ASN1_STRING_type_new(V_ASN1_T61STRING)
+# define M_ASN1_T61STRING_free(a)        ASN1_STRING_free((ASN1_STRING *)a)
+# define M_i2d_ASN1_T61STRING(a,pp) \
+                i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\
+                V_ASN1_UNIVERSAL)
+# define M_d2i_ASN1_T61STRING(a,pp,l) \
+                (ASN1_T61STRING *)d2i_ASN1_type_bytes\
+                ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING)
+
+# define M_ASN1_IA5STRING_new()  (ASN1_IA5STRING *)\
+                ASN1_STRING_type_new(V_ASN1_IA5STRING)
+# define M_ASN1_IA5STRING_free(a)        ASN1_STRING_free((ASN1_STRING *)a)
+# define M_ASN1_IA5STRING_dup(a) \
+                (ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a)
+# define M_i2d_ASN1_IA5STRING(a,pp) \
+                i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
+                        V_ASN1_UNIVERSAL)
+# define M_d2i_ASN1_IA5STRING(a,pp,l) \
+                (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\
+                        B_ASN1_IA5STRING)
+
+# define M_ASN1_UTCTIME_new()    (ASN1_UTCTIME *)\
+                ASN1_STRING_type_new(V_ASN1_UTCTIME)
+# define M_ASN1_UTCTIME_free(a)  ASN1_STRING_free((ASN1_STRING *)a)
+# define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)\
+                ASN1_STRING_dup((const ASN1_STRING *)a)
+
+# define M_ASN1_GENERALIZEDTIME_new()    (ASN1_GENERALIZEDTIME *)\
+                ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
+# define M_ASN1_GENERALIZEDTIME_free(a)  ASN1_STRING_free((ASN1_STRING *)a)
+# define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\
+        (const ASN1_STRING *)a)
+
+# define M_ASN1_TIME_new()       (ASN1_TIME *)\
+                ASN1_STRING_type_new(V_ASN1_UTCTIME)
+# define M_ASN1_TIME_free(a)     ASN1_STRING_free((ASN1_STRING *)a)
+# define M_ASN1_TIME_dup(a) (ASN1_TIME *)\
+        ASN1_STRING_dup((const ASN1_STRING *)a)
+
+# define M_ASN1_GENERALSTRING_new()      (ASN1_GENERALSTRING *)\
+                ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
+# define M_ASN1_GENERALSTRING_free(a)    ASN1_STRING_free((ASN1_STRING *)a)
+# define M_i2d_ASN1_GENERALSTRING(a,pp) \
+                i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\
+                        V_ASN1_UNIVERSAL)
+# define M_d2i_ASN1_GENERALSTRING(a,pp,l) \
+                (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\
+                ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING)
+
+# define M_ASN1_UNIVERSALSTRING_new()    (ASN1_UNIVERSALSTRING *)\
+                ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING)
+# define M_ASN1_UNIVERSALSTRING_free(a)  ASN1_STRING_free((ASN1_STRING *)a)
+# define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \
+                i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\
+                        V_ASN1_UNIVERSAL)
+# define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \
+                (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\
+                ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)
+
+# define M_ASN1_BMPSTRING_new()  (ASN1_BMPSTRING *)\
+                ASN1_STRING_type_new(V_ASN1_BMPSTRING)
+# define M_ASN1_BMPSTRING_free(a)        ASN1_STRING_free((ASN1_STRING *)a)
+# define M_i2d_ASN1_BMPSTRING(a,pp) \
+                i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\
+                        V_ASN1_UNIVERSAL)
+# define M_d2i_ASN1_BMPSTRING(a,pp,l) \
+                (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\
+                ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)
+
+# define M_ASN1_VISIBLESTRING_new()      (ASN1_VISIBLESTRING *)\
+                ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
+# define M_ASN1_VISIBLESTRING_free(a)    ASN1_STRING_free((ASN1_STRING *)a)
+# define M_i2d_ASN1_VISIBLESTRING(a,pp) \
+                i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\
+                        V_ASN1_UNIVERSAL)
+# define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \
+                (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\
+                ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING)
+
+# define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\
+                ASN1_STRING_type_new(V_ASN1_UTF8STRING)
+# define M_ASN1_UTF8STRING_free(a)       ASN1_STRING_free((ASN1_STRING *)a)
+# define M_i2d_ASN1_UTF8STRING(a,pp) \
+                i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\
+                        V_ASN1_UNIVERSAL)
+# define M_d2i_ASN1_UTF8STRING(a,pp,l) \
+                (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
+                ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
+
+  /* for the is_set parameter to i2d_ASN1_SET */
+# define IS_SEQUENCE     0
+# define IS_SET          1
+
+DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
+
+int ASN1_TYPE_get(ASN1_TYPE *a);
+void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
+int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
+int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);
+
+ASN1_OBJECT *ASN1_OBJECT_new(void);
+void ASN1_OBJECT_free(ASN1_OBJECT *a);
+int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp);
+ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
+                             long length);
+ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
+                             long length);
+
+DECLARE_ASN1_ITEM(ASN1_OBJECT)
+
+DECLARE_STACK_OF(ASN1_OBJECT)
+DECLARE_ASN1_SET_OF(ASN1_OBJECT)
+
+ASN1_STRING *ASN1_STRING_new(void);
+void ASN1_STRING_free(ASN1_STRING *a);
+void ASN1_STRING_clear_free(ASN1_STRING *a);
+int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
+ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a);
+ASN1_STRING *ASN1_STRING_type_new(int type);
+int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
+  /*
+   * Since this is used to store all sorts of things, via macros, for now,
+   * make its data void *
+   */
+int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
+void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
+int ASN1_STRING_length(const ASN1_STRING *x);
+void ASN1_STRING_length_set(ASN1_STRING *x, int n);
+int ASN1_STRING_type(ASN1_STRING *x);
+unsigned char *ASN1_STRING_data(ASN1_STRING *x);
+
+DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
+int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp);
+ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
+                                     const unsigned char **pp, long length);
+int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length);
+int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
+int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
+int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
+                          unsigned char *flags, int flags_len);
+
+# ifndef OPENSSL_NO_BIO
+int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
+                               BIT_STRING_BITNAME *tbl, int indent);
+# endif
+int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
+int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
+                            BIT_STRING_BITNAME *tbl);
+
+int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
+int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length);
+
+DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
+int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp);
+ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
+                               long length);
+ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
+                                long length);
+ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x);
+int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
+
+DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
+
+int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
+ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);
+ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
+                               int offset_day, long offset_sec);
+int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
+int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
+# if 0
+time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
+# endif
+
+int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
+ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
+                                               time_t t);
+ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
+                                               time_t t, int offset_day,
+                                               long offset_sec);
+int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
+
+DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
+ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
+int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a,
+                          const ASN1_OCTET_STRING *b);
+int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data,
+                          int len);
+
+DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
+DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
+DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)
+DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
+DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)
+
+int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
+int UTF8_putc(unsigned char *str, int len, unsigned long value);
+
+DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
+
+DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
+DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
+DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)
+DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING)
+DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING)
+DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING)
+DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
+DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
+DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
+
+DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
+
+ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
+ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
+                         int offset_day, long offset_sec);
+int ASN1_TIME_check(ASN1_TIME *t);
+ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME
+                                                   **out);
+int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
+
+int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,
+                 i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
+STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
+                                      const unsigned char **pp,
+                                      long length, d2i_of_void *d2i,
+                                      void (*free_func) (OPENSSL_BLOCK),
+                                      int ex_tag, int ex_class);
+
+# ifndef OPENSSL_NO_BIO
+int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
+int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size);
+int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);
+int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size);
+int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a);
+int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size);
+int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
+# endif
+int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a);
+
+int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num);
+ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
+                                const char *sn, const char *ln);
+
+int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
+long ASN1_INTEGER_get(const ASN1_INTEGER *a);
+ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
+BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);
+
+int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
+long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
+ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai);
+BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn);
+
+/* General */
+/* given a string, return the correct type, max is the maximum length */
+int ASN1_PRINTABLE_type(const unsigned char *s, int max);
+
+int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
+ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
+                            long length, int Ptag, int Pclass);
+unsigned long ASN1_tag2bit(int tag);
+/* type is one or more of the B_ASN1_ values. */
+ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp,
+                                 long length, int type);
+
+/* PARSING */
+int asn1_Finish(ASN1_CTX *c);
+int asn1_const_Finish(ASN1_const_CTX *c);
+
+/* SPECIALS */
+int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
+                    int *pclass, long omax);
+int ASN1_check_infinite_end(unsigned char **p, long len);
+int ASN1_const_check_infinite_end(const unsigned char **p, long len);
+void ASN1_put_object(unsigned char **pp, int constructed, int length,
+                     int tag, int xclass);
+int ASN1_put_eoc(unsigned char **pp);
+int ASN1_object_size(int constructed, int length, int tag);
+
+/* Used to implement other functions */
+void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
+
+# define ASN1_dup_of(type,i2d,d2i,x) \
+    ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
+                     CHECKED_D2I_OF(type, d2i), \
+                     CHECKED_PTR_OF(type, x)))
+
+# define ASN1_dup_of_const(type,i2d,d2i,x) \
+    ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \
+                     CHECKED_D2I_OF(type, d2i), \
+                     CHECKED_PTR_OF(const type, x)))
+
+void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
+
+/* ASN1 alloc/free macros for when a type is only used internally */
+
+# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type))
+# define M_ASN1_free_of(x, type) \
+                ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
+
+# ifndef OPENSSL_NO_FP_API
+void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x);
+
+#  define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
+    ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \
+                        CHECKED_D2I_OF(type, d2i), \
+                        in, \
+                        CHECKED_PPTR_OF(type, x)))
+
+void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
+int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x);
+
+#  define ASN1_i2d_fp_of(type,i2d,out,x) \
+    (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
+                 out, \
+                 CHECKED_PTR_OF(type, x)))
+
+#  define ASN1_i2d_fp_of_const(type,i2d,out,x) \
+    (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \
+                 out, \
+                 CHECKED_PTR_OF(const type, x)))
+
+int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
+int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
+# endif
+
+int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
+
+# ifndef OPENSSL_NO_BIO
+void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x);
+
+#  define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
+    ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \
+                          CHECKED_D2I_OF(type, d2i), \
+                          in, \
+                          CHECKED_PPTR_OF(type, x)))
+
+void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
+int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x);
+
+#  define ASN1_i2d_bio_of(type,i2d,out,x) \
+    (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
+                  out, \
+                  CHECKED_PTR_OF(type, x)))
+
+#  define ASN1_i2d_bio_of_const(type,i2d,out,x) \
+    (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \
+                  out, \
+                  CHECKED_PTR_OF(const type, x)))
+
+int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
+int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
+int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
+int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
+int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
+int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
+int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
+                  unsigned char *buf, int off);
+int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent);
+int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent,
+                    int dump);
+# endif
+const char *ASN1_tag2str(int tag);
+
+/* Used to load and write netscape format cert */
+
+DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)
+
+int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
+
+int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len);
+int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, int max_len);
+int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
+                                  unsigned char *data, int len);
+int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num,
+                                  unsigned char *data, int max_len);
+
+STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
+                                         d2i_of_void *d2i,
+                                         void (*free_func) (OPENSSL_BLOCK));
+unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,
+                             unsigned char **buf, int *len);
+void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
+void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
+ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
+                              ASN1_OCTET_STRING **oct);
+
+# define ASN1_pack_string_of(type,obj,i2d,oct) \
+    (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \
+                      CHECKED_I2D_OF(type, i2d), \
+                      oct))
+
+ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it,
+                            ASN1_OCTET_STRING **oct);
+
+void ASN1_STRING_set_default_mask(unsigned long mask);
+int ASN1_STRING_set_default_mask_asc(const char *p);
+unsigned long ASN1_STRING_get_default_mask(void);
+int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
+                       int inform, unsigned long mask);
+int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
+                        int inform, unsigned long mask,
+                        long minsize, long maxsize);
+
+ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
+                                    const unsigned char *in, int inlen,
+                                    int inform, int nid);
+ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
+int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
+void ASN1_STRING_TABLE_cleanup(void);
+
+/* ASN1 template functions */
+
+/* Old API compatible functions */
+ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
+void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
+ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in,
+                          long len, const ASN1_ITEM *it);
+int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
+int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,
+                       const ASN1_ITEM *it);
+
+void ASN1_add_oid_module(void);
+
+ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
+ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
+
+/* ASN1 Print flags */
+
+/* Indicate missing OPTIONAL fields */
+# define ASN1_PCTX_FLAGS_SHOW_ABSENT             0x001
+/* Mark start and end of SEQUENCE */
+# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE           0x002
+/* Mark start and end of SEQUENCE/SET OF */
+# define ASN1_PCTX_FLAGS_SHOW_SSOF               0x004
+/* Show the ASN1 type of primitives */
+# define ASN1_PCTX_FLAGS_SHOW_TYPE               0x008
+/* Don't show ASN1 type of ANY */
+# define ASN1_PCTX_FLAGS_NO_ANY_TYPE             0x010
+/* Don't show ASN1 type of MSTRINGs */
+# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE         0x020
+/* Don't show field names in SEQUENCE */
+# define ASN1_PCTX_FLAGS_NO_FIELD_NAME           0x040
+/* Show structure names of each SEQUENCE field */
+# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME  0x080
+/* Don't show structure name even at top level */
+# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME          0x100
+
+int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
+                    const ASN1_ITEM *it, const ASN1_PCTX *pctx);
+ASN1_PCTX *ASN1_PCTX_new(void);
+void ASN1_PCTX_free(ASN1_PCTX *p);
+unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
+
+BIO_METHOD *BIO_f_asn1(void);
+
+BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
+
+int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
+                        const ASN1_ITEM *it);
+int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
+                              const char *hdr, const ASN1_ITEM *it);
+int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
+                     int ctype_nid, int econt_nid,
+                     STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it);
+ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
+int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
+int SMIME_text(BIO *in, BIO *out);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_ASN1_strings(void);
+
+/* Error codes for the ASN1 functions. */
+
+/* Function codes. */
+# define ASN1_F_A2D_ASN1_OBJECT                           100
+# define ASN1_F_A2I_ASN1_ENUMERATED                       101
+# define ASN1_F_A2I_ASN1_INTEGER                          102
+# define ASN1_F_A2I_ASN1_STRING                           103
+# define ASN1_F_APPEND_EXP                                176
+# define ASN1_F_ASN1_BIT_STRING_SET_BIT                   183
+# define ASN1_F_ASN1_CB                                   177
+# define ASN1_F_ASN1_CHECK_TLEN                           104
+# define ASN1_F_ASN1_COLLATE_PRIMITIVE                    105
+# define ASN1_F_ASN1_COLLECT                              106
+# define ASN1_F_ASN1_D2I_EX_PRIMITIVE                     108
+# define ASN1_F_ASN1_D2I_FP                               109
+# define ASN1_F_ASN1_D2I_READ_BIO                         107
+# define ASN1_F_ASN1_DIGEST                               184
+# define ASN1_F_ASN1_DO_ADB                               110
+# define ASN1_F_ASN1_DUP                                  111
+# define ASN1_F_ASN1_ENUMERATED_SET                       112
+# define ASN1_F_ASN1_ENUMERATED_TO_BN                     113
+# define ASN1_F_ASN1_EX_C2I                               204
+# define ASN1_F_ASN1_FIND_END                             190
+# define ASN1_F_ASN1_GENERALIZEDTIME_ADJ                  216
+# define ASN1_F_ASN1_GENERALIZEDTIME_SET                  185
+# define ASN1_F_ASN1_GENERATE_V3                          178
+# define ASN1_F_ASN1_GET_OBJECT                           114
+# define ASN1_F_ASN1_HEADER_NEW                           115
+# define ASN1_F_ASN1_I2D_BIO                              116
+# define ASN1_F_ASN1_I2D_FP                               117
+# define ASN1_F_ASN1_INTEGER_SET                          118
+# define ASN1_F_ASN1_INTEGER_TO_BN                        119
+# define ASN1_F_ASN1_ITEM_D2I_FP                          206
+# define ASN1_F_ASN1_ITEM_DUP                             191
+# define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW                  121
+# define ASN1_F_ASN1_ITEM_EX_D2I                          120
+# define ASN1_F_ASN1_ITEM_I2D_BIO                         192
+# define ASN1_F_ASN1_ITEM_I2D_FP                          193
+# define ASN1_F_ASN1_ITEM_PACK                            198
+# define ASN1_F_ASN1_ITEM_SIGN                            195
+# define ASN1_F_ASN1_ITEM_SIGN_CTX                        220
+# define ASN1_F_ASN1_ITEM_UNPACK                          199
+# define ASN1_F_ASN1_ITEM_VERIFY                          197
+# define ASN1_F_ASN1_MBSTRING_NCOPY                       122
+# define ASN1_F_ASN1_OBJECT_NEW                           123
+# define ASN1_F_ASN1_OUTPUT_DATA                          214
+# define ASN1_F_ASN1_PACK_STRING                          124
+# define ASN1_F_ASN1_PCTX_NEW                             205
+# define ASN1_F_ASN1_PKCS5_PBE_SET                        125
+# define ASN1_F_ASN1_SEQ_PACK                             126
+# define ASN1_F_ASN1_SEQ_UNPACK                           127
+# define ASN1_F_ASN1_SIGN                                 128
+# define ASN1_F_ASN1_STR2TYPE                             179
+# define ASN1_F_ASN1_STRING_SET                           186
+# define ASN1_F_ASN1_STRING_TABLE_ADD                     129
+# define ASN1_F_ASN1_STRING_TYPE_NEW                      130
+# define ASN1_F_ASN1_TEMPLATE_EX_D2I                      132
+# define ASN1_F_ASN1_TEMPLATE_NEW                         133
+# define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I                   131
+# define ASN1_F_ASN1_TIME_ADJ                             217
+# define ASN1_F_ASN1_TIME_SET                             175
+# define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING             134
+# define ASN1_F_ASN1_TYPE_GET_OCTETSTRING                 135
+# define ASN1_F_ASN1_UNPACK_STRING                        136
+# define ASN1_F_ASN1_UTCTIME_ADJ                          218
+# define ASN1_F_ASN1_UTCTIME_SET                          187
+# define ASN1_F_ASN1_VERIFY                               137
+# define ASN1_F_B64_READ_ASN1                             209
+# define ASN1_F_B64_WRITE_ASN1                            210
+# define ASN1_F_BIO_NEW_NDEF                              208
+# define ASN1_F_BITSTR_CB                                 180
+# define ASN1_F_BN_TO_ASN1_ENUMERATED                     138
+# define ASN1_F_BN_TO_ASN1_INTEGER                        139
+# define ASN1_F_C2I_ASN1_BIT_STRING                       189
+# define ASN1_F_C2I_ASN1_INTEGER                          194
+# define ASN1_F_C2I_ASN1_OBJECT                           196
+# define ASN1_F_COLLECT_DATA                              140
+# define ASN1_F_D2I_ASN1_BIT_STRING                       141
+# define ASN1_F_D2I_ASN1_BOOLEAN                          142
+# define ASN1_F_D2I_ASN1_BYTES                            143
+# define ASN1_F_D2I_ASN1_GENERALIZEDTIME                  144
+# define ASN1_F_D2I_ASN1_HEADER                           145
+# define ASN1_F_D2I_ASN1_INTEGER                          146
+# define ASN1_F_D2I_ASN1_OBJECT                           147
+# define ASN1_F_D2I_ASN1_SET                              148
+# define ASN1_F_D2I_ASN1_TYPE_BYTES                       149
+# define ASN1_F_D2I_ASN1_UINTEGER                         150
+# define ASN1_F_D2I_ASN1_UTCTIME                          151
+# define ASN1_F_D2I_AUTOPRIVATEKEY                        207
+# define ASN1_F_D2I_NETSCAPE_RSA                          152
+# define ASN1_F_D2I_NETSCAPE_RSA_2                        153
+# define ASN1_F_D2I_PRIVATEKEY                            154
+# define ASN1_F_D2I_PUBLICKEY                             155
+# define ASN1_F_D2I_RSA_NET                               200
+# define ASN1_F_D2I_RSA_NET_2                             201
+# define ASN1_F_D2I_X509                                  156
+# define ASN1_F_D2I_X509_CINF                             157
+# define ASN1_F_D2I_X509_PKEY                             159
+# define ASN1_F_I2D_ASN1_BIO_STREAM                       211
+# define ASN1_F_I2D_ASN1_SET                              188
+# define ASN1_F_I2D_ASN1_TIME                             160
+# define ASN1_F_I2D_DSA_PUBKEY                            161
+# define ASN1_F_I2D_EC_PUBKEY                             181
+# define ASN1_F_I2D_PRIVATEKEY                            163
+# define ASN1_F_I2D_PUBLICKEY                             164
+# define ASN1_F_I2D_RSA_NET                               162
+# define ASN1_F_I2D_RSA_PUBKEY                            165
+# define ASN1_F_LONG_C2I                                  166
+# define ASN1_F_OID_MODULE_INIT                           174
+# define ASN1_F_PARSE_TAGGING                             182
+# define ASN1_F_PKCS5_PBE2_SET_IV                         167
+# define ASN1_F_PKCS5_PBE_SET                             202
+# define ASN1_F_PKCS5_PBE_SET0_ALGOR                      215
+# define ASN1_F_PKCS5_PBKDF2_SET                          219
+# define ASN1_F_SMIME_READ_ASN1                           212
+# define ASN1_F_SMIME_TEXT                                213
+# define ASN1_F_X509_CINF_NEW                             168
+# define ASN1_F_X509_CRL_ADD0_REVOKED                     169
+# define ASN1_F_X509_INFO_NEW                             170
+# define ASN1_F_X509_NAME_ENCODE                          203
+# define ASN1_F_X509_NAME_EX_D2I                          158
+# define ASN1_F_X509_NAME_EX_NEW                          171
+# define ASN1_F_X509_NEW                                  172
+# define ASN1_F_X509_PKEY_NEW                             173
+
+/* Reason codes. */
+# define ASN1_R_ADDING_OBJECT                             171
+# define ASN1_R_ASN1_PARSE_ERROR                          203
+# define ASN1_R_ASN1_SIG_PARSE_ERROR                      204
+# define ASN1_R_AUX_ERROR                                 100
+# define ASN1_R_BAD_CLASS                                 101
+# define ASN1_R_BAD_OBJECT_HEADER                         102
+# define ASN1_R_BAD_PASSWORD_READ                         103
+# define ASN1_R_BAD_TAG                                   104
+# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH                 214
+# define ASN1_R_BN_LIB                                    105
+# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH                   106
+# define ASN1_R_BUFFER_TOO_SMALL                          107
+# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER           108
+# define ASN1_R_CONTEXT_NOT_INITIALISED                   217
+# define ASN1_R_DATA_IS_WRONG                             109
+# define ASN1_R_DECODE_ERROR                              110
+# define ASN1_R_DECODING_ERROR                            111
+# define ASN1_R_DEPTH_EXCEEDED                            174
+# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED         198
+# define ASN1_R_ENCODE_ERROR                              112
+# define ASN1_R_ERROR_GETTING_TIME                        173
+# define ASN1_R_ERROR_LOADING_SECTION                     172
+# define ASN1_R_ERROR_PARSING_SET_ELEMENT                 113
+# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS               114
+# define ASN1_R_EXPECTING_AN_INTEGER                      115
+# define ASN1_R_EXPECTING_AN_OBJECT                       116
+# define ASN1_R_EXPECTING_A_BOOLEAN                       117
+# define ASN1_R_EXPECTING_A_TIME                          118
+# define ASN1_R_EXPLICIT_LENGTH_MISMATCH                  119
+# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED              120
+# define ASN1_R_FIELD_MISSING                             121
+# define ASN1_R_FIRST_NUM_TOO_LARGE                       122
+# define ASN1_R_HEADER_TOO_LONG                           123
+# define ASN1_R_ILLEGAL_BITSTRING_FORMAT                  175
+# define ASN1_R_ILLEGAL_BOOLEAN                           176
+# define ASN1_R_ILLEGAL_CHARACTERS                        124
+# define ASN1_R_ILLEGAL_FORMAT                            177
+# define ASN1_R_ILLEGAL_HEX                               178
+# define ASN1_R_ILLEGAL_IMPLICIT_TAG                      179
+# define ASN1_R_ILLEGAL_INTEGER                           180
+# define ASN1_R_ILLEGAL_NESTED_TAGGING                    181
+# define ASN1_R_ILLEGAL_NULL                              125
+# define ASN1_R_ILLEGAL_NULL_VALUE                        182
+# define ASN1_R_ILLEGAL_OBJECT                            183
+# define ASN1_R_ILLEGAL_OPTIONAL_ANY                      126
+# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE          170
+# define ASN1_R_ILLEGAL_TAGGED_ANY                        127
+# define ASN1_R_ILLEGAL_TIME_VALUE                        184
+# define ASN1_R_INTEGER_NOT_ASCII_FORMAT                  185
+# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG                128
+# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT              220
+# define ASN1_R_INVALID_BMPSTRING_LENGTH                  129
+# define ASN1_R_INVALID_DIGIT                             130
+# define ASN1_R_INVALID_MIME_TYPE                         205
+# define ASN1_R_INVALID_MODIFIER                          186
+# define ASN1_R_INVALID_NUMBER                            187
+# define ASN1_R_INVALID_OBJECT_ENCODING                   216
+# define ASN1_R_INVALID_SEPARATOR                         131
+# define ASN1_R_INVALID_TIME_FORMAT                       132
+# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH            133
+# define ASN1_R_INVALID_UTF8STRING                        134
+# define ASN1_R_IV_TOO_LARGE                              135
+# define ASN1_R_LENGTH_ERROR                              136
+# define ASN1_R_LIST_ERROR                                188
+# define ASN1_R_MIME_NO_CONTENT_TYPE                      206
+# define ASN1_R_MIME_PARSE_ERROR                          207
+# define ASN1_R_MIME_SIG_PARSE_ERROR                      208
+# define ASN1_R_MISSING_EOC                               137
+# define ASN1_R_MISSING_SECOND_NUMBER                     138
+# define ASN1_R_MISSING_VALUE                             189
+# define ASN1_R_MSTRING_NOT_UNIVERSAL                     139
+# define ASN1_R_MSTRING_WRONG_TAG                         140
+# define ASN1_R_NESTED_ASN1_STRING                        197
+# define ASN1_R_NON_HEX_CHARACTERS                        141
+# define ASN1_R_NOT_ASCII_FORMAT                          190
+# define ASN1_R_NOT_ENOUGH_DATA                           142
+# define ASN1_R_NO_CONTENT_TYPE                           209
+# define ASN1_R_NO_DEFAULT_DIGEST                         201
+# define ASN1_R_NO_MATCHING_CHOICE_TYPE                   143
+# define ASN1_R_NO_MULTIPART_BODY_FAILURE                 210
+# define ASN1_R_NO_MULTIPART_BOUNDARY                     211
+# define ASN1_R_NO_SIG_CONTENT_TYPE                       212
+# define ASN1_R_NULL_IS_WRONG_LENGTH                      144
+# define ASN1_R_OBJECT_NOT_ASCII_FORMAT                   191
+# define ASN1_R_ODD_NUMBER_OF_CHARS                       145
+# define ASN1_R_PRIVATE_KEY_HEADER_MISSING                146
+# define ASN1_R_SECOND_NUMBER_TOO_LARGE                   147
+# define ASN1_R_SEQUENCE_LENGTH_MISMATCH                  148
+# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED                  149
+# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG              192
+# define ASN1_R_SHORT_LINE                                150
+# define ASN1_R_SIG_INVALID_MIME_TYPE                     213
+# define ASN1_R_STREAMING_NOT_SUPPORTED                   202
+# define ASN1_R_STRING_TOO_LONG                           151
+# define ASN1_R_STRING_TOO_SHORT                          152
+# define ASN1_R_TAG_VALUE_TOO_HIGH                        153
+# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
+# define ASN1_R_TIME_NOT_ASCII_FORMAT                     193
+# define ASN1_R_TOO_LONG                                  155
+# define ASN1_R_TYPE_NOT_CONSTRUCTED                      156
+# define ASN1_R_TYPE_NOT_PRIMITIVE                        218
+# define ASN1_R_UNABLE_TO_DECODE_RSA_KEY                  157
+# define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY          158
+# define ASN1_R_UNEXPECTED_EOC                            159
+# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH           215
+# define ASN1_R_UNKNOWN_FORMAT                            160
+# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM          161
+# define ASN1_R_UNKNOWN_OBJECT_TYPE                       162
+# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE                   163
+# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM               199
+# define ASN1_R_UNKNOWN_TAG                               194
+# define ASN1_R_UNKOWN_FORMAT                             195
+# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE           164
+# define ASN1_R_UNSUPPORTED_CIPHER                        165
+# define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM          166
+# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE               167
+# define ASN1_R_UNSUPPORTED_TYPE                          196
+# define ASN1_R_WRONG_PUBLIC_KEY_TYPE                     200
+# define ASN1_R_WRONG_TAG                                 168
+# define ASN1_R_WRONG_TYPE                                169
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/asn1.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/blowfish.h
===================================================================
--- lab4/.minix-src/include/openssl/blowfish.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/blowfish.h	(revision 13)
@@ -0,0 +1,130 @@
+/* crypto/bf/blowfish.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_BLOWFISH_H
+# define HEADER_BLOWFISH_H
+
+# include <openssl/e_os2.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifdef OPENSSL_NO_BF
+#  error BF is disabled.
+# endif
+
+# define BF_ENCRYPT      1
+# define BF_DECRYPT      0
+
+/*-
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * ! BF_LONG has to be at least 32 bits wide. If it's wider, then !
+ * ! BF_LONG_LOG2 has to be defined along.                        !
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ */
+
+# if defined(__LP32__)
+#  define BF_LONG unsigned long
+# elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
+#  define BF_LONG unsigned long
+#  define BF_LONG_LOG2 3
+/*
+ * _CRAY note. I could declare short, but I have no idea what impact
+ * does it have on performance on none-T3E machines. I could declare
+ * int, but at least on C90 sizeof(int) can be chosen at compile time.
+ * So I've chosen long...
+ *                                      <appro@fy.chalmers.se>
+ */
+# else
+#  define BF_LONG unsigned int
+# endif
+
+# define BF_ROUNDS       16
+# define BF_BLOCK        8
+
+typedef struct bf_key_st {
+    BF_LONG P[BF_ROUNDS + 2];
+    BF_LONG S[4 * 256];
+} BF_KEY;
+
+# ifdef OPENSSL_FIPS
+void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data);
+# endif
+void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
+
+void BF_encrypt(BF_LONG *data, const BF_KEY *key);
+void BF_decrypt(BF_LONG *data, const BF_KEY *key);
+
+void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
+                    const BF_KEY *key, int enc);
+void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
+                    const BF_KEY *schedule, unsigned char *ivec, int enc);
+void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,
+                      long length, const BF_KEY *schedule,
+                      unsigned char *ivec, int *num, int enc);
+void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,
+                      long length, const BF_KEY *schedule,
+                      unsigned char *ivec, int *num);
+const char *BF_options(void);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/blowfish.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/cast.h
===================================================================
--- lab4/.minix-src/include/openssl/cast.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/cast.h	(revision 13)
@@ -0,0 +1,112 @@
+/* crypto/cast/cast.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_CAST_H
+# define HEADER_CAST_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# include <openssl/opensslconf.h>
+
+# ifdef OPENSSL_NO_CAST
+#  error CAST is disabled.
+# endif
+
+# define CAST_ENCRYPT    1
+# define CAST_DECRYPT    0
+
+#ifndef __NetBSD__
+# define CAST_LONG unsigned int
+#else
+# include <sys/types.h>
+# define CAST_LONG uint32_t
+#endif
+
+# define CAST_BLOCK      8
+# define CAST_KEY_LENGTH 16
+
+typedef struct cast_key_st {
+    CAST_LONG data[32];
+    int short_key;              /* Use reduced rounds for short key */
+} CAST_KEY;
+
+# ifdef OPENSSL_FIPS
+void private_CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
+# endif
+void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
+void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
+                      const CAST_KEY *key, int enc);
+void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key);
+void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key);
+void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                      long length, const CAST_KEY *ks, unsigned char *iv,
+                      int enc);
+void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,
+                        long length, const CAST_KEY *schedule,
+                        unsigned char *ivec, int *num, int enc);
+void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
+                        long length, const CAST_KEY *schedule,
+                        unsigned char *ivec, int *num);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/cast.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/conf.h
===================================================================
--- lab4/.minix-src/include/openssl/conf.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/conf.h	(revision 13)
@@ -0,0 +1,267 @@
+/* crypto/conf/conf.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef  HEADER_CONF_H
+# define HEADER_CONF_H
+
+# include <openssl/bio.h>
+# include <openssl/lhash.h>
+# include <openssl/stack.h>
+# include <openssl/safestack.h>
+# include <openssl/e_os2.h>
+
+# include <openssl/ossl_typ.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+    char *section;
+    char *name;
+    char *value;
+} CONF_VALUE;
+
+DECLARE_STACK_OF(CONF_VALUE)
+DECLARE_LHASH_OF(CONF_VALUE);
+
+struct conf_st;
+struct conf_method_st;
+typedef struct conf_method_st CONF_METHOD;
+
+struct conf_method_st {
+    const char *name;
+    CONF *(*create) (CONF_METHOD *meth);
+    int (*init) (CONF *conf);
+    int (*destroy) (CONF *conf);
+    int (*destroy_data) (CONF *conf);
+    int (*load_bio) (CONF *conf, BIO *bp, long *eline);
+    int (*dump) (const CONF *conf, BIO *bp);
+    int (*is_number) (const CONF *conf, char c);
+    int (*to_int) (const CONF *conf, char c);
+    int (*load) (CONF *conf, const char *name, long *eline);
+};
+
+/* Module definitions */
+
+typedef struct conf_imodule_st CONF_IMODULE;
+typedef struct conf_module_st CONF_MODULE;
+
+DECLARE_STACK_OF(CONF_MODULE)
+DECLARE_STACK_OF(CONF_IMODULE)
+
+/* DSO module function typedefs */
+typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf);
+typedef void conf_finish_func (CONF_IMODULE *md);
+
+# define CONF_MFLAGS_IGNORE_ERRORS       0x1
+# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
+# define CONF_MFLAGS_SILENT              0x4
+# define CONF_MFLAGS_NO_DSO              0x8
+# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
+# define CONF_MFLAGS_DEFAULT_SECTION     0x20
+
+int CONF_set_default_method(CONF_METHOD *meth);
+void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
+LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
+                                long *eline);
+# ifndef OPENSSL_NO_FP_API
+LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
+                                   long *eline);
+# endif
+LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
+                                    long *eline);
+STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
+                                       const char *section);
+char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
+                      const char *name);
+long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
+                     const char *name);
+void CONF_free(LHASH_OF(CONF_VALUE) *conf);
+int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
+int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
+
+void OPENSSL_config(const char *config_name);
+void OPENSSL_no_config(void);
+
+/*
+ * New conf code.  The semantics are different from the functions above. If
+ * that wasn't the case, the above functions would have been replaced
+ */
+
+struct conf_st {
+    CONF_METHOD *meth;
+    void *meth_data;
+    LHASH_OF(CONF_VALUE) *data;
+};
+
+CONF *NCONF_new(CONF_METHOD *meth);
+CONF_METHOD *NCONF_default(void);
+CONF_METHOD *NCONF_WIN32(void);
+# if 0                          /* Just to give you an idea of what I have in
+                                 * mind */
+CONF_METHOD *NCONF_XML(void);
+# endif
+void NCONF_free(CONF *conf);
+void NCONF_free_data(CONF *conf);
+
+int NCONF_load(CONF *conf, const char *file, long *eline);
+# ifndef OPENSSL_NO_FP_API
+int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
+# endif
+int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
+STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
+                                        const char *section);
+char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
+int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
+                       long *result);
+int NCONF_dump_fp(const CONF *conf, FILE *out);
+int NCONF_dump_bio(const CONF *conf, BIO *out);
+
+# if 0                          /* The following function has no error
+                                 * checking, and should therefore be avoided */
+long NCONF_get_number(CONF *conf, char *group, char *name);
+# else
+#  define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
+# endif
+
+/* Module functions */
+
+int CONF_modules_load(const CONF *cnf, const char *appname,
+                      unsigned long flags);
+int CONF_modules_load_file(const char *filename, const char *appname,
+                           unsigned long flags);
+void CONF_modules_unload(int all);
+void CONF_modules_finish(void);
+void CONF_modules_free(void);
+int CONF_module_add(const char *name, conf_init_func *ifunc,
+                    conf_finish_func *ffunc);
+
+const char *CONF_imodule_get_name(const CONF_IMODULE *md);
+const char *CONF_imodule_get_value(const CONF_IMODULE *md);
+void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
+void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
+CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
+unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
+void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
+void *CONF_module_get_usr_data(CONF_MODULE *pmod);
+void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
+
+char *CONF_get1_default_config_file(void);
+
+int CONF_parse_list(const char *list, int sep, int nospc,
+                    int (*list_cb) (const char *elem, int len, void *usr),
+                    void *arg);
+
+void OPENSSL_load_builtin_modules(void);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_CONF_strings(void);
+
+/* Error codes for the CONF functions. */
+
+/* Function codes. */
+# define CONF_F_CONF_DUMP_FP                              104
+# define CONF_F_CONF_LOAD                                 100
+# define CONF_F_CONF_LOAD_BIO                             102
+# define CONF_F_CONF_LOAD_FP                              103
+# define CONF_F_CONF_MODULES_LOAD                         116
+# define CONF_F_CONF_PARSE_LIST                           119
+# define CONF_F_DEF_LOAD                                  120
+# define CONF_F_DEF_LOAD_BIO                              121
+# define CONF_F_MODULE_INIT                               115
+# define CONF_F_MODULE_LOAD_DSO                           117
+# define CONF_F_MODULE_RUN                                118
+# define CONF_F_NCONF_DUMP_BIO                            105
+# define CONF_F_NCONF_DUMP_FP                             106
+# define CONF_F_NCONF_GET_NUMBER                          107
+# define CONF_F_NCONF_GET_NUMBER_E                        112
+# define CONF_F_NCONF_GET_SECTION                         108
+# define CONF_F_NCONF_GET_STRING                          109
+# define CONF_F_NCONF_LOAD                                113
+# define CONF_F_NCONF_LOAD_BIO                            110
+# define CONF_F_NCONF_LOAD_FP                             114
+# define CONF_F_NCONF_NEW                                 111
+# define CONF_F_STR_COPY                                  101
+
+/* Reason codes. */
+# define CONF_R_ERROR_LOADING_DSO                         110
+# define CONF_R_LIST_CANNOT_BE_NULL                       115
+# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET              100
+# define CONF_R_MISSING_EQUAL_SIGN                        101
+# define CONF_R_MISSING_FINISH_FUNCTION                   111
+# define CONF_R_MISSING_INIT_FUNCTION                     112
+# define CONF_R_MODULE_INITIALIZATION_ERROR               109
+# define CONF_R_NO_CLOSE_BRACE                            102
+# define CONF_R_NO_CONF                                   105
+# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE           106
+# define CONF_R_NO_SECTION                                107
+# define CONF_R_NO_SUCH_FILE                              114
+# define CONF_R_NO_VALUE                                  108
+# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION              103
+# define CONF_R_UNKNOWN_MODULE_NAME                       113
+# define CONF_R_VARIABLE_HAS_NO_VALUE                     104
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/conf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/dh.h
===================================================================
--- lab4/.minix-src/include/openssl/dh.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/dh.h	(revision 13)
@@ -0,0 +1,287 @@
+/* crypto/dh/dh.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_DH_H
+# define HEADER_DH_H
+
+# include <openssl/e_os2.h>
+
+# ifdef OPENSSL_NO_DH
+#  error DH is disabled.
+# endif
+
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+# include <openssl/ossl_typ.h>
+# ifndef OPENSSL_NO_DEPRECATED
+#  include <openssl/bn.h>
+# endif
+
+# ifndef OPENSSL_DH_MAX_MODULUS_BITS
+#  define OPENSSL_DH_MAX_MODULUS_BITS    10000
+# endif
+
+# define DH_FLAG_CACHE_MONT_P     0x01
+
+/*
+ * new with 0.9.7h; the built-in DH
+ * implementation now uses constant time
+ * modular exponentiation for secret exponents
+ * by default. This flag causes the
+ * faster variable sliding window method to
+ * be used for all exponents.
+ */
+# define DH_FLAG_NO_EXP_CONSTTIME 0x02
+
+/*
+ * If this flag is set the DH method is FIPS compliant and can be used in
+ * FIPS mode. This is set in the validated module method. If an application
+ * sets this flag in its own methods it is its reposibility to ensure the
+ * result is compliant.
+ */
+
+# define DH_FLAG_FIPS_METHOD                     0x0400
+
+/*
+ * If this flag is set the operations normally disabled in FIPS mode are
+ * permitted it is then the applications responsibility to ensure that the
+ * usage is compliant.
+ */
+
+# define DH_FLAG_NON_FIPS_ALLOW                  0x0400
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Already defined in ossl_typ.h */
+/* typedef struct dh_st DH; */
+/* typedef struct dh_method DH_METHOD; */
+
+struct dh_method {
+    const char *name;
+    /* Methods here */
+    int (*generate_key) (DH *dh);
+    int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh);
+    /* Can be null */
+    int (*bn_mod_exp) (const DH *dh, BIGNUM *r, const BIGNUM *a,
+                       const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
+                       BN_MONT_CTX *m_ctx);
+    int (*init) (DH *dh);
+    int (*finish) (DH *dh);
+    int flags;
+    char *app_data;
+    /* If this is non-NULL, it will be used to generate parameters */
+    int (*generate_params) (DH *dh, int prime_len, int generator,
+                            BN_GENCB *cb);
+};
+
+struct dh_st {
+    /*
+     * This first argument is used to pick up errors when a DH is passed
+     * instead of a EVP_PKEY
+     */
+    int pad;
+    int version;
+    BIGNUM *p;
+    BIGNUM *g;
+    long length;                /* optional */
+    BIGNUM *pub_key;            /* g^x */
+    BIGNUM *priv_key;           /* x */
+    int flags;
+    BN_MONT_CTX *method_mont_p;
+    /* Place holders if we want to do X9.42 DH */
+    BIGNUM *q;
+    BIGNUM *j;
+    unsigned char *seed;
+    int seedlen;
+    BIGNUM *counter;
+    int references;
+    CRYPTO_EX_DATA ex_data;
+    const DH_METHOD *meth;
+    ENGINE *engine;
+};
+
+# define DH_GENERATOR_2          2
+/* #define DH_GENERATOR_3       3 */
+# define DH_GENERATOR_5          5
+
+/* DH_check error codes */
+# define DH_CHECK_P_NOT_PRIME            0x01
+# define DH_CHECK_P_NOT_SAFE_PRIME       0x02
+# define DH_UNABLE_TO_CHECK_GENERATOR    0x04
+# define DH_NOT_SUITABLE_GENERATOR       0x08
+
+/* DH_check_pub_key error codes */
+# define DH_CHECK_PUBKEY_TOO_SMALL       0x01
+# define DH_CHECK_PUBKEY_TOO_LARGE       0x02
+
+/*
+ * primes p where (p-1)/2 is prime too are called "safe"; we define this for
+ * backward compatibility:
+ */
+# define DH_CHECK_P_NOT_STRONG_PRIME     DH_CHECK_P_NOT_SAFE_PRIME
+
+# define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
+                (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
+# define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
+                (unsigned char *)(x))
+# define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
+# define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
+
+DH *DHparams_dup(DH *);
+
+const DH_METHOD *DH_OpenSSL(void);
+
+void DH_set_default_method(const DH_METHOD *meth);
+const DH_METHOD *DH_get_default_method(void);
+int DH_set_method(DH *dh, const DH_METHOD *meth);
+DH *DH_new_method(ENGINE *engine);
+
+DH *DH_new(void);
+void DH_free(DH *dh);
+int DH_up_ref(DH *dh);
+int DH_size(const DH *dh);
+int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                        CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int DH_set_ex_data(DH *d, int idx, void *arg);
+void *DH_get_ex_data(DH *d, int idx);
+
+/* Deprecated version */
+# ifndef OPENSSL_NO_DEPRECATED
+DH *DH_generate_parameters(int prime_len, int generator,
+                           void (*callback) (int, int, void *), void *cb_arg);
+# endif                         /* !defined(OPENSSL_NO_DEPRECATED) */
+
+/* New version */
+int DH_generate_parameters_ex(DH *dh, int prime_len, int generator,
+                              BN_GENCB *cb);
+
+int DH_check(const DH *dh, int *codes);
+int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes);
+int DH_generate_key(DH *dh);
+int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);
+DH *d2i_DHparams(DH **a, const unsigned char **pp, long length);
+int i2d_DHparams(const DH *a, unsigned char **pp);
+# ifndef OPENSSL_NO_FP_API
+int DHparams_print_fp(FILE *fp, const DH *x);
+# endif
+# ifndef OPENSSL_NO_BIO
+int DHparams_print(BIO *bp, const DH *x);
+# else
+int DHparams_print(char *bp, const DH *x);
+# endif
+
+# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \
+        EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
+                        EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL)
+
+# define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \
+        EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
+                        EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL)
+
+# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN     (EVP_PKEY_ALG_CTRL + 1)
+# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR     (EVP_PKEY_ALG_CTRL + 2)
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_DH_strings(void);
+
+/* Error codes for the DH functions. */
+
+/* Function codes. */
+# define DH_F_COMPUTE_KEY                                 102
+# define DH_F_DHPARAMS_PRINT_FP                           101
+# define DH_F_DH_BUILTIN_GENPARAMS                        106
+# define DH_F_DH_COMPUTE_KEY                              114
+# define DH_F_DH_GENERATE_KEY                             115
+# define DH_F_DH_GENERATE_PARAMETERS_EX                   116
+# define DH_F_DH_NEW_METHOD                               105
+# define DH_F_DH_PARAM_DECODE                             107
+# define DH_F_DH_PRIV_DECODE                              110
+# define DH_F_DH_PRIV_ENCODE                              111
+# define DH_F_DH_PUB_DECODE                               108
+# define DH_F_DH_PUB_ENCODE                               109
+# define DH_F_DO_DH_PRINT                                 100
+# define DH_F_GENERATE_KEY                                103
+# define DH_F_GENERATE_PARAMETERS                         104
+# define DH_F_PKEY_DH_DERIVE                              112
+# define DH_F_PKEY_DH_KEYGEN                              113
+
+/* Reason codes. */
+# define DH_R_BAD_GENERATOR                               101
+# define DH_R_BN_DECODE_ERROR                             109
+# define DH_R_BN_ERROR                                    106
+# define DH_R_DECODE_ERROR                                104
+# define DH_R_INVALID_PUBKEY                              102
+# define DH_R_KEYS_NOT_SET                                108
+# define DH_R_KEY_SIZE_TOO_SMALL                          110
+# define DH_R_MODULUS_TOO_LARGE                           103
+# define DH_R_NON_FIPS_METHOD                             111
+# define DH_R_NO_PARAMETERS_SET                           107
+# define DH_R_NO_PRIVATE_VALUE                            100
+# define DH_R_PARAMETER_ENCODING_ERROR                    105
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/dh.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/e_os2.h
===================================================================
--- lab4/.minix-src/include/openssl/e_os2.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/e_os2.h	(revision 13)
@@ -0,0 +1,328 @@
+/* e_os2.h */
+/* ====================================================================
+ * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#include <openssl/opensslconf.h>
+
+#ifndef HEADER_E_OS2_H
+# define HEADER_E_OS2_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/******************************************************************************
+ * Detect operating systems.  This probably needs completing.
+ * The result is that at least one OPENSSL_SYS_os macro should be defined.
+ * However, if none is defined, Unix is assumed.
+ **/
+
+# define OPENSSL_SYS_UNIX
+
+/* ---------------------- Macintosh, before MacOS X ----------------------- */
+# if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC)
+#  undef OPENSSL_SYS_UNIX
+#  define OPENSSL_SYS_MACINTOSH_CLASSIC
+# endif
+
+/* ---------------------- NetWare ----------------------------------------- */
+# if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE)
+#  undef OPENSSL_SYS_UNIX
+#  define OPENSSL_SYS_NETWARE
+# endif
+
+/* --------------------- Microsoft operating systems ---------------------- */
+
+/*
+ * Note that MSDOS actually denotes 32-bit environments running on top of
+ * MS-DOS, such as DJGPP one.
+ */
+# if defined(OPENSSL_SYSNAME_MSDOS)
+#  undef OPENSSL_SYS_UNIX
+#  define OPENSSL_SYS_MSDOS
+# endif
+
+/*
+ * For 32 bit environment, there seems to be the CygWin environment and then
+ * all the others that try to do the same thing Microsoft does...
+ */
+# if defined(OPENSSL_SYSNAME_UWIN)
+#  undef OPENSSL_SYS_UNIX
+#  define OPENSSL_SYS_WIN32_UWIN
+# else
+#  if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32)
+#   undef OPENSSL_SYS_UNIX
+#   define OPENSSL_SYS_WIN32_CYGWIN
+#  else
+#   if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32)
+#    undef OPENSSL_SYS_UNIX
+#    define OPENSSL_SYS_WIN32
+#   endif
+#   if defined(_WIN64) || defined(OPENSSL_SYSNAME_WIN64)
+#    undef OPENSSL_SYS_UNIX
+#    if !defined(OPENSSL_SYS_WIN64)
+#     define OPENSSL_SYS_WIN64
+#    endif
+#   endif
+#   if defined(OPENSSL_SYSNAME_WINNT)
+#    undef OPENSSL_SYS_UNIX
+#    define OPENSSL_SYS_WINNT
+#   endif
+#   if defined(OPENSSL_SYSNAME_WINCE)
+#    undef OPENSSL_SYS_UNIX
+#    define OPENSSL_SYS_WINCE
+#   endif
+#  endif
+# endif
+
+/* Anything that tries to look like Microsoft is "Windows" */
+# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
+#  undef OPENSSL_SYS_UNIX
+#  define OPENSSL_SYS_WINDOWS
+#  ifndef OPENSSL_SYS_MSDOS
+#   define OPENSSL_SYS_MSDOS
+#  endif
+# endif
+
+/*
+ * DLL settings.  This part is a bit tough, because it's up to the
+ * application implementor how he or she will link the application, so it
+ * requires some macro to be used.
+ */
+# ifdef OPENSSL_SYS_WINDOWS
+#  ifndef OPENSSL_OPT_WINDLL
+#   if defined(_WINDLL)         /* This is used when building OpenSSL to
+                                 * indicate that DLL linkage should be used */
+#    define OPENSSL_OPT_WINDLL
+#   endif
+#  endif
+# endif
+
+/* ------------------------------- OpenVMS -------------------------------- */
+# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS)
+#  undef OPENSSL_SYS_UNIX
+#  define OPENSSL_SYS_VMS
+#  if defined(__DECC)
+#   define OPENSSL_SYS_VMS_DECC
+#  elif defined(__DECCXX)
+#   define OPENSSL_SYS_VMS_DECC
+#   define OPENSSL_SYS_VMS_DECCXX
+#  else
+#   define OPENSSL_SYS_VMS_NODECC
+#  endif
+# endif
+
+/* -------------------------------- OS/2 ---------------------------------- */
+# if defined(__EMX__) || defined(__OS2__)
+#  undef OPENSSL_SYS_UNIX
+#  define OPENSSL_SYS_OS2
+# endif
+
+/* -------------------------------- Unix ---------------------------------- */
+# ifdef OPENSSL_SYS_UNIX
+#  if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX)
+#   define OPENSSL_SYS_LINUX
+#  endif
+#  ifdef OPENSSL_SYSNAME_MPE
+#   define OPENSSL_SYS_MPE
+#  endif
+#  ifdef OPENSSL_SYSNAME_SNI
+#   define OPENSSL_SYS_SNI
+#  endif
+#  ifdef OPENSSL_SYSNAME_ULTRASPARC
+#   define OPENSSL_SYS_ULTRASPARC
+#  endif
+#  ifdef OPENSSL_SYSNAME_NEWS4
+#   define OPENSSL_SYS_NEWS4
+#  endif
+#  ifdef OPENSSL_SYSNAME_MACOSX
+#   define OPENSSL_SYS_MACOSX
+#  endif
+#  ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY
+#   define OPENSSL_SYS_MACOSX_RHAPSODY
+#   define OPENSSL_SYS_MACOSX
+#  endif
+#  ifdef OPENSSL_SYSNAME_SUNOS
+#   define OPENSSL_SYS_SUNOS
+#  endif
+#  if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY)
+#   define OPENSSL_SYS_CRAY
+#  endif
+#  if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX)
+#   define OPENSSL_SYS_AIX
+#  endif
+# endif
+
+/* -------------------------------- VOS ----------------------------------- */
+# if defined(__VOS__) || defined(OPENSSL_SYSNAME_VOS)
+#  define OPENSSL_SYS_VOS
+#  ifdef __HPPA__
+#   define OPENSSL_SYS_VOS_HPPA
+#  endif
+#  ifdef __IA32__
+#   define OPENSSL_SYS_VOS_IA32
+#  endif
+# endif
+
+/* ------------------------------ VxWorks --------------------------------- */
+# ifdef OPENSSL_SYSNAME_VXWORKS
+#  define OPENSSL_SYS_VXWORKS
+# endif
+
+/* -------------------------------- BeOS ---------------------------------- */
+# if defined(__BEOS__)
+#  define OPENSSL_SYS_BEOS
+#  include <sys/socket.h>
+#  if defined(BONE_VERSION)
+#   define OPENSSL_SYS_BEOS_BONE
+#  else
+#   define OPENSSL_SYS_BEOS_R5
+#  endif
+# endif
+
+/**
+ * That's it for OS-specific stuff
+ *****************************************************************************/
+
+/* Specials for I/O an exit */
+# ifdef OPENSSL_SYS_MSDOS
+#  define OPENSSL_UNISTD_IO <io.h>
+#  define OPENSSL_DECLARE_EXIT extern void exit(int);
+# else
+#  define OPENSSL_UNISTD_IO OPENSSL_UNISTD
+#  define OPENSSL_DECLARE_EXIT  /* declared in unistd.h */
+# endif
+
+/*-
+ * Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare
+ * certain global symbols that, with some compilers under VMS, have to be
+ * defined and declared explicitely with globaldef and globalref.
+ * Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare
+ * DLL exports and imports for compilers under Win32.  These are a little
+ * more complicated to use.  Basically, for any library that exports some
+ * global variables, the following code must be present in the header file
+ * that declares them, before OPENSSL_EXTERN is used:
+ *
+ * #ifdef SOME_BUILD_FLAG_MACRO
+ * # undef OPENSSL_EXTERN
+ * # define OPENSSL_EXTERN OPENSSL_EXPORT
+ * #endif
+ *
+ * The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL
+ * have some generally sensible values, and for OPENSSL_EXTERN to have the
+ * value OPENSSL_IMPORT.
+ */
+
+# if defined(OPENSSL_SYS_VMS_NODECC)
+#  define OPENSSL_EXPORT globalref
+#  define OPENSSL_IMPORT globalref
+#  define OPENSSL_GLOBAL globaldef
+# elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
+#  define OPENSSL_EXPORT extern __declspec(dllexport)
+#  define OPENSSL_IMPORT extern __declspec(dllimport)
+#  define OPENSSL_GLOBAL
+# else
+#  define OPENSSL_EXPORT extern
+#  define OPENSSL_IMPORT extern
+#  define OPENSSL_GLOBAL
+# endif
+# define OPENSSL_EXTERN OPENSSL_IMPORT
+
+/*-
+ * Macros to allow global variables to be reached through function calls when
+ * required (if a shared library version requires it, for example.
+ * The way it's done allows definitions like this:
+ *
+ *      // in foobar.c
+ *      OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0)
+ *      // in foobar.h
+ *      OPENSSL_DECLARE_GLOBAL(int,foobar);
+ *      #define foobar OPENSSL_GLOBAL_REF(foobar)
+ */
+# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
+#  define OPENSSL_IMPLEMENT_GLOBAL(type,name,value)                      \
+        type *_shadow_##name(void)                                      \
+        { static type _hide_##name=value; return &_hide_##name; }
+#  define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
+#  define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
+# else
+#  define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _shadow_##name=value;
+#  define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name
+#  define OPENSSL_GLOBAL_REF(name) _shadow_##name
+# endif
+
+# if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && macintosh==1 && !defined(MAC_OS_GUSI_SOURCE)
+#  define ossl_ssize_t long
+# endif
+
+# ifdef OPENSSL_SYS_MSDOS
+#  define ossl_ssize_t long
+# endif
+
+# if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS)
+#  define ssize_t int
+# endif
+
+# if defined(__ultrix) && !defined(ssize_t)
+#  define ossl_ssize_t int
+# endif
+
+# ifndef ossl_ssize_t
+#  define ossl_ssize_t ssize_t
+# endif
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/e_os2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ecdsa.h
===================================================================
--- lab4/.minix-src/include/openssl/ecdsa.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ecdsa.h	(revision 13)
@@ -0,0 +1,260 @@
+/* crypto/ecdsa/ecdsa.h */
+/**
+ * \file   crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions
+ * \author Written by Nils Larsch for the OpenSSL project
+ */
+/* ====================================================================
+ * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+#ifndef HEADER_ECDSA_H
+# define HEADER_ECDSA_H
+
+# include <openssl/opensslconf.h>
+
+# ifdef OPENSSL_NO_ECDSA
+#  error ECDSA is disabled.
+# endif
+
+# include <openssl/ec.h>
+# include <openssl/ossl_typ.h>
+# ifndef OPENSSL_NO_DEPRECATED
+#  include <openssl/bn.h>
+# endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct ECDSA_SIG_st {
+    BIGNUM *r;
+    BIGNUM *s;
+} ECDSA_SIG;
+
+/** Allocates and initialize a ECDSA_SIG structure
+ *  \return pointer to a ECDSA_SIG structure or NULL if an error occurred
+ */
+ECDSA_SIG *ECDSA_SIG_new(void);
+
+/** frees a ECDSA_SIG structure
+ *  \param  sig  pointer to the ECDSA_SIG structure
+ */
+void ECDSA_SIG_free(ECDSA_SIG *sig);
+
+/** DER encode content of ECDSA_SIG object (note: this function modifies *pp
+ *  (*pp += length of the DER encoded signature)).
+ *  \param  sig  pointer to the ECDSA_SIG object
+ *  \param  pp   pointer to a unsigned char pointer for the output or NULL
+ *  \return the length of the DER encoded ECDSA_SIG object or 0
+ */
+int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp);
+
+/** Decodes a DER encoded ECDSA signature (note: this function changes *pp
+ *  (*pp += len)).
+ *  \param  sig  pointer to ECDSA_SIG pointer (may be NULL)
+ *  \param  pp   memory buffer with the DER encoded signature
+ *  \param  len  length of the buffer
+ *  \return pointer to the decoded ECDSA_SIG structure (or NULL)
+ */
+ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len);
+
+/** Computes the ECDSA signature of the given hash value using
+ *  the supplied private key and returns the created signature.
+ *  \param  dgst      pointer to the hash value
+ *  \param  dgst_len  length of the hash value
+ *  \param  eckey     EC_KEY object containing a private EC key
+ *  \return pointer to a ECDSA_SIG structure or NULL if an error occurred
+ */
+ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dgst_len,
+                         EC_KEY *eckey);
+
+/** Computes ECDSA signature of a given hash value using the supplied
+ *  private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
+ *  \param  dgst     pointer to the hash value to sign
+ *  \param  dgstlen  length of the hash value
+ *  \param  kinv     BIGNUM with a pre-computed inverse k (optional)
+ *  \param  rp       BIGNUM with a pre-computed rp value (optioanl),
+ *                   see ECDSA_sign_setup
+ *  \param  eckey    EC_KEY object containing a private EC key
+ *  \return pointer to a ECDSA_SIG structure or NULL if an error occurred
+ */
+ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,
+                            const BIGNUM *kinv, const BIGNUM *rp,
+                            EC_KEY *eckey);
+
+/** Verifies that the supplied signature is a valid ECDSA
+ *  signature of the supplied hash value using the supplied public key.
+ *  \param  dgst      pointer to the hash value
+ *  \param  dgst_len  length of the hash value
+ *  \param  sig       ECDSA_SIG structure
+ *  \param  eckey     EC_KEY object containing a public EC key
+ *  \return 1 if the signature is valid, 0 if the signature is invalid
+ *          and -1 on error
+ */
+int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
+                    const ECDSA_SIG *sig, EC_KEY *eckey);
+
+const ECDSA_METHOD *ECDSA_OpenSSL(void);
+
+/** Sets the default ECDSA method
+ *  \param  meth  new default ECDSA_METHOD
+ */
+void ECDSA_set_default_method(const ECDSA_METHOD *meth);
+
+/** Returns the default ECDSA method
+ *  \return pointer to ECDSA_METHOD structure containing the default method
+ */
+const ECDSA_METHOD *ECDSA_get_default_method(void);
+
+/** Sets method to be used for the ECDSA operations
+ *  \param  eckey  EC_KEY object
+ *  \param  meth   new method
+ *  \return 1 on success and 0 otherwise
+ */
+int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);
+
+/** Returns the maximum length of the DER encoded signature
+ *  \param  eckey  EC_KEY object
+ *  \return numbers of bytes required for the DER encoded signature
+ */
+int ECDSA_size(const EC_KEY *eckey);
+
+/** Precompute parts of the signing operation
+ *  \param  eckey  EC_KEY object containing a private EC key
+ *  \param  ctx    BN_CTX object (optional)
+ *  \param  kinv   BIGNUM pointer for the inverse of k
+ *  \param  rp     BIGNUM pointer for x coordinate of k * generator
+ *  \return 1 on success and 0 otherwise
+ */
+int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp);
+
+/** Computes ECDSA signature of a given hash value using the supplied
+ *  private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
+ *  \param  type     this parameter is ignored
+ *  \param  dgst     pointer to the hash value to sign
+ *  \param  dgstlen  length of the hash value
+ *  \param  sig      memory for the DER encoded created signature
+ *  \param  siglen   pointer to the length of the returned signature
+ *  \param  eckey    EC_KEY object containing a private EC key
+ *  \return 1 on success and 0 otherwise
+ */
+int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen,
+               unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
+
+/** Computes ECDSA signature of a given hash value using the supplied
+ *  private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
+ *  \param  type     this parameter is ignored
+ *  \param  dgst     pointer to the hash value to sign
+ *  \param  dgstlen  length of the hash value
+ *  \param  sig      buffer to hold the DER encoded signature
+ *  \param  siglen   pointer to the length of the returned signature
+ *  \param  kinv     BIGNUM with a pre-computed inverse k (optional)
+ *  \param  rp       BIGNUM with a pre-computed rp value (optioanl),
+ *                   see ECDSA_sign_setup
+ *  \param  eckey    EC_KEY object containing a private EC key
+ *  \return 1 on success and 0 otherwise
+ */
+int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen,
+                  unsigned char *sig, unsigned int *siglen,
+                  const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);
+
+/** Verifies that the given signature is valid ECDSA signature
+ *  of the supplied hash value using the specified public key.
+ *  \param  type     this parameter is ignored
+ *  \param  dgst     pointer to the hash value
+ *  \param  dgstlen  length of the hash value
+ *  \param  sig      pointer to the DER encoded signature
+ *  \param  siglen   length of the DER encoded signature
+ *  \param  eckey    EC_KEY object containing a public EC key
+ *  \return 1 if the signature is valid, 0 if the signature is invalid
+ *          and -1 on error
+ */
+int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen,
+                 const unsigned char *sig, int siglen, EC_KEY *eckey);
+
+/* the standard ex_data functions */
+int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
+                           *new_func, CRYPTO_EX_dup *dup_func,
+                           CRYPTO_EX_free *free_func);
+int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg);
+void *ECDSA_get_ex_data(EC_KEY *d, int idx);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_ECDSA_strings(void);
+
+/* Error codes for the ECDSA functions. */
+
+/* Function codes. */
+# define ECDSA_F_ECDSA_CHECK                              104
+# define ECDSA_F_ECDSA_DATA_NEW_METHOD                    100
+# define ECDSA_F_ECDSA_DO_SIGN                            101
+# define ECDSA_F_ECDSA_DO_VERIFY                          102
+# define ECDSA_F_ECDSA_SIGN_SETUP                         103
+
+/* Reason codes. */
+# define ECDSA_R_BAD_SIGNATURE                            100
+# define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE              101
+# define ECDSA_R_ERR_EC_LIB                               102
+# define ECDSA_R_MISSING_PARAMETERS                       103
+# define ECDSA_R_NEED_NEW_SETUP_VALUES                    106
+# define ECDSA_R_NON_FIPS_METHOD                          107
+# define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED          104
+# define ECDSA_R_SIGNATURE_MALLOC_FAILED                  105
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ecdsa.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/hmac.h
===================================================================
--- lab4/.minix-src/include/openssl/hmac.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/hmac.h	(revision 13)
@@ -0,0 +1,109 @@
+/* crypto/hmac/hmac.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+#ifndef HEADER_HMAC_H
+# define HEADER_HMAC_H
+
+# include <openssl/opensslconf.h>
+
+# ifdef OPENSSL_NO_HMAC
+#  error HMAC is disabled.
+# endif
+
+# include <openssl/evp.h>
+
+# define HMAC_MAX_MD_CBLOCK      128/* largest known is SHA512 */
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct hmac_ctx_st {
+    const EVP_MD *md;
+    EVP_MD_CTX md_ctx;
+    EVP_MD_CTX i_ctx;
+    EVP_MD_CTX o_ctx;
+    unsigned int key_length;
+    unsigned char key[HMAC_MAX_MD_CBLOCK];
+} HMAC_CTX;
+
+# define HMAC_size(e)    (EVP_MD_size((e)->md))
+
+void HMAC_CTX_init(HMAC_CTX *ctx);
+void HMAC_CTX_cleanup(HMAC_CTX *ctx);
+
+/* deprecated */
+# define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx)
+
+/* deprecated */
+int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md);
+int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
+                 const EVP_MD *md, ENGINE *impl);
+int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
+int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
+unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
+                    const unsigned char *d, size_t n, unsigned char *md,
+                    unsigned int *md_len);
+int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);
+
+void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/hmac.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ec.h
===================================================================
--- lab4/.minix-src/include/openssl/ec.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ec.h	(revision 13)
@@ -0,0 +1,1193 @@
+/* crypto/ec/ec.h */
+/*
+ * Originally written by Bodo Moeller for the OpenSSL project.
+ */
+/**
+ * \file crypto/ec/ec.h Include file for the OpenSSL EC functions
+ * \author Originally written by Bodo Moeller for the OpenSSL project
+ */
+/* ====================================================================
+ * Copyright (c) 1998-2005 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ *
+ * Portions of the attached software ("Contribution") are developed by
+ * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
+ *
+ * The Contribution is licensed pursuant to the OpenSSL open source
+ * license provided above.
+ *
+ * The elliptic curve binary polynomial software is originally written by
+ * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
+ *
+ */
+
+#ifndef HEADER_EC_H
+# define HEADER_EC_H
+
+# include <openssl/opensslconf.h>
+
+# ifdef OPENSSL_NO_EC
+#  error EC is disabled.
+# endif
+
+# include <openssl/asn1.h>
+# include <openssl/symhacks.h>
+# ifndef OPENSSL_NO_DEPRECATED
+#  include <openssl/bn.h>
+# endif
+
+# ifdef  __cplusplus
+extern "C" {
+# elif defined(__SUNPRO_C)
+#  if __SUNPRO_C >= 0x520
+#   pragma error_messages (off,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE)
+#  endif
+# endif
+
+# ifndef OPENSSL_ECC_MAX_FIELD_BITS
+#  define OPENSSL_ECC_MAX_FIELD_BITS 661
+# endif
+
+/** Enum for the point conversion form as defined in X9.62 (ECDSA)
+ *  for the encoding of a elliptic curve point (x,y) */
+typedef enum {
+        /** the point is encoded as z||x, where the octet z specifies
+         *  which solution of the quadratic equation y is  */
+    POINT_CONVERSION_COMPRESSED = 2,
+        /** the point is encoded as z||x||y, where z is the octet 0x02  */
+    POINT_CONVERSION_UNCOMPRESSED = 4,
+        /** the point is encoded as z||x||y, where the octet z specifies
+         *  which solution of the quadratic equation y is  */
+    POINT_CONVERSION_HYBRID = 6
+} point_conversion_form_t;
+
+typedef struct ec_method_st EC_METHOD;
+
+typedef struct ec_group_st
+    /*-
+     EC_METHOD *meth;
+     -- field definition
+     -- curve coefficients
+     -- optional generator with associated information (order, cofactor)
+     -- optional extra data (precomputed table for fast computation of multiples of generator)
+     -- ASN1 stuff
+    */
+    EC_GROUP;
+
+typedef struct ec_point_st EC_POINT;
+
+/********************************************************************/
+/*               EC_METHODs for curves over GF(p)                   */
+/********************************************************************/
+
+/** Returns the basic GFp ec methods which provides the basis for the
+ *  optimized methods.
+ *  \return  EC_METHOD object
+ */
+const EC_METHOD *EC_GFp_simple_method(void);
+
+/** Returns GFp methods using montgomery multiplication.
+ *  \return  EC_METHOD object
+ */
+const EC_METHOD *EC_GFp_mont_method(void);
+
+/** Returns GFp methods using optimized methods for NIST recommended curves
+ *  \return  EC_METHOD object
+ */
+const EC_METHOD *EC_GFp_nist_method(void);
+
+# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+/** Returns 64-bit optimized methods for nistp224
+ *  \return  EC_METHOD object
+ */
+const EC_METHOD *EC_GFp_nistp224_method(void);
+
+/** Returns 64-bit optimized methods for nistp256
+ *  \return  EC_METHOD object
+ */
+const EC_METHOD *EC_GFp_nistp256_method(void);
+
+/** Returns 64-bit optimized methods for nistp521
+ *  \return  EC_METHOD object
+ */
+const EC_METHOD *EC_GFp_nistp521_method(void);
+# endif
+
+# ifndef OPENSSL_NO_EC2M
+/********************************************************************/
+/*           EC_METHOD for curves over GF(2^m)                      */
+/********************************************************************/
+
+/** Returns the basic GF2m ec method
+ *  \return  EC_METHOD object
+ */
+const EC_METHOD *EC_GF2m_simple_method(void);
+
+# endif
+
+/********************************************************************/
+/*                   EC_GROUP functions                             */
+/********************************************************************/
+
+/** Creates a new EC_GROUP object
+ *  \param   meth  EC_METHOD to use
+ *  \return  newly created EC_GROUP object or NULL in case of an error.
+ */
+EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);
+
+/** Frees a EC_GROUP object
+ *  \param  group  EC_GROUP object to be freed.
+ */
+void EC_GROUP_free(EC_GROUP *group);
+
+/** Clears and frees a EC_GROUP object
+ *  \param  group  EC_GROUP object to be cleared and freed.
+ */
+void EC_GROUP_clear_free(EC_GROUP *group);
+
+/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD.
+ *  \param  dst  destination EC_GROUP object
+ *  \param  src  source EC_GROUP object
+ *  \return 1 on success and 0 if an error occurred.
+ */
+int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src);
+
+/** Creates a new EC_GROUP object and copies the copies the content
+ *  form src to the newly created EC_KEY object
+ *  \param  src  source EC_GROUP object
+ *  \return newly created EC_GROUP object or NULL in case of an error.
+ */
+EC_GROUP *EC_GROUP_dup(const EC_GROUP *src);
+
+/** Returns the EC_METHOD of the EC_GROUP object.
+ *  \param  group  EC_GROUP object
+ *  \return EC_METHOD used in this EC_GROUP object.
+ */
+const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);
+
+/** Returns the field type of the EC_METHOD.
+ *  \param  meth  EC_METHOD object
+ *  \return NID of the underlying field type OID.
+ */
+int EC_METHOD_get_field_type(const EC_METHOD *meth);
+
+/** Sets the generator and it's order/cofactor of a EC_GROUP object.
+ *  \param  group      EC_GROUP object
+ *  \param  generator  EC_POINT object with the generator.
+ *  \param  order      the order of the group generated by the generator.
+ *  \param  cofactor   the index of the sub-group generated by the generator
+ *                     in the group of all points on the elliptic curve.
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
+                           const BIGNUM *order, const BIGNUM *cofactor);
+
+/** Returns the generator of a EC_GROUP object.
+ *  \param  group  EC_GROUP object
+ *  \return the currently used generator (possibly NULL).
+ */
+const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);
+
+/** Gets the order of a EC_GROUP
+ *  \param  group  EC_GROUP object
+ *  \param  order  BIGNUM to which the order is copied
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);
+
+/** Gets the cofactor of a EC_GROUP
+ *  \param  group     EC_GROUP object
+ *  \param  cofactor  BIGNUM to which the cofactor is copied
+ *  \param  ctx       BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor,
+                          BN_CTX *ctx);
+
+/** Sets the name of a EC_GROUP object
+ *  \param  group  EC_GROUP object
+ *  \param  nid    NID of the curve name OID
+ */
+void EC_GROUP_set_curve_name(EC_GROUP *group, int nid);
+
+/** Returns the curve name of a EC_GROUP object
+ *  \param  group  EC_GROUP object
+ *  \return NID of the curve name OID or 0 if not set.
+ */
+int EC_GROUP_get_curve_name(const EC_GROUP *group);
+
+void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
+int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
+
+void EC_GROUP_set_point_conversion_form(EC_GROUP *group,
+                                        point_conversion_form_t form);
+point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *);
+
+unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x);
+size_t EC_GROUP_get_seed_len(const EC_GROUP *);
+size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);
+
+/** Sets the parameter of a ec over GFp defined by y^2 = x^3 + a*x + b
+ *  \param  group  EC_GROUP object
+ *  \param  p      BIGNUM with the prime number
+ *  \param  a      BIGNUM with parameter a of the equation
+ *  \param  b      BIGNUM with parameter b of the equation
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
+                           const BIGNUM *b, BN_CTX *ctx);
+
+/** Gets the parameter of the ec over GFp defined by y^2 = x^3 + a*x + b
+ *  \param  group  EC_GROUP object
+ *  \param  p      BIGNUM for the prime number
+ *  \param  a      BIGNUM for parameter a of the equation
+ *  \param  b      BIGNUM for parameter b of the equation
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
+                           BIGNUM *b, BN_CTX *ctx);
+
+# ifndef OPENSSL_NO_EC2M
+/** Sets the parameter of a ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b
+ *  \param  group  EC_GROUP object
+ *  \param  p      BIGNUM with the polynomial defining the underlying field
+ *  \param  a      BIGNUM with parameter a of the equation
+ *  \param  b      BIGNUM with parameter b of the equation
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
+                            const BIGNUM *b, BN_CTX *ctx);
+
+/** Gets the parameter of the ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b
+ *  \param  group  EC_GROUP object
+ *  \param  p      BIGNUM for the polynomial defining the underlying field
+ *  \param  a      BIGNUM for parameter a of the equation
+ *  \param  b      BIGNUM for parameter b of the equation
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
+                            BIGNUM *b, BN_CTX *ctx);
+# endif
+/** Returns the number of bits needed to represent a field element
+ *  \param  group  EC_GROUP object
+ *  \return number of bits needed to represent a field element
+ */
+int EC_GROUP_get_degree(const EC_GROUP *group);
+
+/** Checks whether the parameter in the EC_GROUP define a valid ec group
+ *  \param  group  EC_GROUP object
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 if group is a valid ec group and 0 otherwise
+ */
+int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);
+
+/** Checks whether the discriminant of the elliptic curve is zero or not
+ *  \param  group  EC_GROUP object
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 if the discriminant is not zero and 0 otherwise
+ */
+int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx);
+
+/** Compares two EC_GROUP objects
+ *  \param  a    first EC_GROUP object
+ *  \param  b    second EC_GROUP object
+ *  \param  ctx  BN_CTX object (optional)
+ *  \return 0 if both groups are equal and 1 otherwise
+ */
+int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx);
+
+/*
+ * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after
+ * choosing an appropriate EC_METHOD
+ */
+
+/** Creates a new EC_GROUP object with the specified parameters defined
+ *  over GFp (defined by the equation y^2 = x^3 + a*x + b)
+ *  \param  p    BIGNUM with the prime number
+ *  \param  a    BIGNUM with the parameter a of the equation
+ *  \param  b    BIGNUM with the parameter b of the equation
+ *  \param  ctx  BN_CTX object (optional)
+ *  \return newly created EC_GROUP object with the specified parameters
+ */
+EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,
+                                 const BIGNUM *b, BN_CTX *ctx);
+# ifndef OPENSSL_NO_EC2M
+/** Creates a new EC_GROUP object with the specified parameters defined
+ *  over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b)
+ *  \param  p    BIGNUM with the polynomial defining the underlying field
+ *  \param  a    BIGNUM with the parameter a of the equation
+ *  \param  b    BIGNUM with the parameter b of the equation
+ *  \param  ctx  BN_CTX object (optional)
+ *  \return newly created EC_GROUP object with the specified parameters
+ */
+EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a,
+                                  const BIGNUM *b, BN_CTX *ctx);
+# endif
+/** Creates a EC_GROUP object with a curve specified by a NID
+ *  \param  nid  NID of the OID of the curve name
+ *  \return newly created EC_GROUP object with specified curve or NULL
+ *          if an error occurred
+ */
+EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
+
+/********************************************************************/
+/*               handling of internal curves                        */
+/********************************************************************/
+
+typedef struct {
+    int nid;
+    const char *comment;
+} EC_builtin_curve;
+
+/*
+ * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all
+ * available curves or zero if a error occurred. In case r ist not zero
+ * nitems EC_builtin_curve structures are filled with the data of the first
+ * nitems internal groups
+ */
+size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
+
+/********************************************************************/
+/*                    EC_POINT functions                            */
+/********************************************************************/
+
+/** Creates a new EC_POINT object for the specified EC_GROUP
+ *  \param  group  EC_GROUP the underlying EC_GROUP object
+ *  \return newly created EC_POINT object or NULL if an error occurred
+ */
+EC_POINT *EC_POINT_new(const EC_GROUP *group);
+
+/** Frees a EC_POINT object
+ *  \param  point  EC_POINT object to be freed
+ */
+void EC_POINT_free(EC_POINT *point);
+
+/** Clears and frees a EC_POINT object
+ *  \param  point  EC_POINT object to be cleared and freed
+ */
+void EC_POINT_clear_free(EC_POINT *point);
+
+/** Copies EC_POINT object
+ *  \param  dst  destination EC_POINT object
+ *  \param  src  source EC_POINT object
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);
+
+/** Creates a new EC_POINT object and copies the content of the supplied
+ *  EC_POINT
+ *  \param  src    source EC_POINT object
+ *  \param  group  underlying the EC_GROUP object
+ *  \return newly created EC_POINT object or NULL if an error occurred
+ */
+EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);
+
+/** Returns the EC_METHOD used in EC_POINT object
+ *  \param  point  EC_POINT object
+ *  \return the EC_METHOD used
+ */
+const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
+
+/** Sets a point to infinity (neutral element)
+ *  \param  group  underlying EC_GROUP object
+ *  \param  point  EC_POINT to set to infinity
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);
+
+/** Sets the jacobian projective coordinates of a EC_POINT over GFp
+ *  \param  group  underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \param  x      BIGNUM with the x-coordinate
+ *  \param  y      BIGNUM with the y-coordinate
+ *  \param  z      BIGNUM with the z-coordinate
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group,
+                                             EC_POINT *p, const BIGNUM *x,
+                                             const BIGNUM *y, const BIGNUM *z,
+                                             BN_CTX *ctx);
+
+/** Gets the jacobian projective coordinates of a EC_POINT over GFp
+ *  \param  group  underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \param  x      BIGNUM for the x-coordinate
+ *  \param  y      BIGNUM for the y-coordinate
+ *  \param  z      BIGNUM for the z-coordinate
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
+                                             const EC_POINT *p, BIGNUM *x,
+                                             BIGNUM *y, BIGNUM *z,
+                                             BN_CTX *ctx);
+
+/** Sets the affine coordinates of a EC_POINT over GFp
+ *  \param  group  underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \param  x      BIGNUM with the x-coordinate
+ *  \param  y      BIGNUM with the y-coordinate
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
+                                        const BIGNUM *x, const BIGNUM *y,
+                                        BN_CTX *ctx);
+
+/** Gets the affine coordinates of a EC_POINT over GFp
+ *  \param  group  underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \param  x      BIGNUM for the x-coordinate
+ *  \param  y      BIGNUM for the y-coordinate
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
+                                        const EC_POINT *p, BIGNUM *x,
+                                        BIGNUM *y, BN_CTX *ctx);
+
+/** Sets the x9.62 compressed coordinates of a EC_POINT over GFp
+ *  \param  group  underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \param  x      BIGNUM with x-coordinate
+ *  \param  y_bit  integer with the y-Bit (either 0 or 1)
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
+                                            EC_POINT *p, const BIGNUM *x,
+                                            int y_bit, BN_CTX *ctx);
+# ifndef OPENSSL_NO_EC2M
+/** Sets the affine coordinates of a EC_POINT over GF2m
+ *  \param  group  underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \param  x      BIGNUM with the x-coordinate
+ *  \param  y      BIGNUM with the y-coordinate
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
+                                         const BIGNUM *x, const BIGNUM *y,
+                                         BN_CTX *ctx);
+
+/** Gets the affine coordinates of a EC_POINT over GF2m
+ *  \param  group  underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \param  x      BIGNUM for the x-coordinate
+ *  \param  y      BIGNUM for the y-coordinate
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
+                                         const EC_POINT *p, BIGNUM *x,
+                                         BIGNUM *y, BN_CTX *ctx);
+
+/** Sets the x9.62 compressed coordinates of a EC_POINT over GF2m
+ *  \param  group  underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \param  x      BIGNUM with x-coordinate
+ *  \param  y_bit  integer with the y-Bit (either 0 or 1)
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group,
+                                             EC_POINT *p, const BIGNUM *x,
+                                             int y_bit, BN_CTX *ctx);
+# endif
+/** Encodes a EC_POINT object to a octet string
+ *  \param  group  underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \param  form   point conversion form
+ *  \param  buf    memory buffer for the result. If NULL the function returns
+ *                 required buffer size.
+ *  \param  len    length of the memory buffer
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return the length of the encoded octet string or 0 if an error occurred
+ */
+size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,
+                          point_conversion_form_t form,
+                          unsigned char *buf, size_t len, BN_CTX *ctx);
+
+/** Decodes a EC_POINT from a octet string
+ *  \param  group  underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \param  buf    memory buffer with the encoded ec point
+ *  \param  len    length of the encoded ec point
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,
+                       const unsigned char *buf, size_t len, BN_CTX *ctx);
+
+/* other interfaces to point2oct/oct2point: */
+BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,
+                          point_conversion_form_t form, BIGNUM *, BN_CTX *);
+EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *,
+                            EC_POINT *, BN_CTX *);
+char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,
+                         point_conversion_form_t form, BN_CTX *);
+EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
+                             EC_POINT *, BN_CTX *);
+
+/********************************************************************/
+/*         functions for doing EC_POINT arithmetic                  */
+/********************************************************************/
+
+/** Computes the sum of two EC_POINT
+ *  \param  group  underlying EC_GROUP object
+ *  \param  r      EC_POINT object for the result (r = a + b)
+ *  \param  a      EC_POINT object with the first summand
+ *  \param  b      EC_POINT object with the second summand
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
+                 const EC_POINT *b, BN_CTX *ctx);
+
+/** Computes the double of a EC_POINT
+ *  \param  group  underlying EC_GROUP object
+ *  \param  r      EC_POINT object for the result (r = 2 * a)
+ *  \param  a      EC_POINT object
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
+                 BN_CTX *ctx);
+
+/** Computes the inverse of a EC_POINT
+ *  \param  group  underlying EC_GROUP object
+ *  \param  a      EC_POINT object to be inverted (it's used for the result as well)
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);
+
+/** Checks whether the point is the neutral element of the group
+ *  \param  group  the underlying EC_GROUP object
+ *  \param  p      EC_POINT object
+ *  \return 1 if the point is the neutral element and 0 otherwise
+ */
+int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p);
+
+/** Checks whether the point is on the curve
+ *  \param  group  underlying EC_GROUP object
+ *  \param  point  EC_POINT object to check
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 if point if on the curve and 0 otherwise
+ */
+int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
+                         BN_CTX *ctx);
+
+/** Compares two EC_POINTs
+ *  \param  group  underlying EC_GROUP object
+ *  \param  a      first EC_POINT object
+ *  \param  b      second EC_POINT object
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 0 if both points are equal and a value != 0 otherwise
+ */
+int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b,
+                 BN_CTX *ctx);
+
+int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx);
+int EC_POINTs_make_affine(const EC_GROUP *group, size_t num,
+                          EC_POINT *points[], BN_CTX *ctx);
+
+/** Computes r = generator * n sum_{i=0}^{num-1} p[i] * m[i]
+ *  \param  group  underlying EC_GROUP object
+ *  \param  r      EC_POINT object for the result
+ *  \param  n      BIGNUM with the multiplier for the group generator (optional)
+ *  \param  num    number futher summands
+ *  \param  p      array of size num of EC_POINT objects
+ *  \param  m      array of size num of BIGNUM objects
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n,
+                  size_t num, const EC_POINT *p[], const BIGNUM *m[],
+                  BN_CTX *ctx);
+
+/** Computes r = generator * n + q * m
+ *  \param  group  underlying EC_GROUP object
+ *  \param  r      EC_POINT object for the result
+ *  \param  n      BIGNUM with the multiplier for the group generator (optional)
+ *  \param  q      EC_POINT object with the first factor of the second summand
+ *  \param  m      BIGNUM with the second factor of the second summand
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n,
+                 const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);
+
+/** Stores multiples of generator for faster point multiplication
+ *  \param  group  EC_GROUP object
+ *  \param  ctx    BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occured
+ */
+int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
+
+/** Reports whether a precomputation has been done
+ *  \param  group  EC_GROUP object
+ *  \return 1 if a pre-computation has been done and 0 otherwise
+ */
+int EC_GROUP_have_precompute_mult(const EC_GROUP *group);
+
+/********************************************************************/
+/*                       ASN1 stuff                                 */
+/********************************************************************/
+
+/*
+ * EC_GROUP_get_basis_type() returns the NID of the basis type used to
+ * represent the field elements
+ */
+int EC_GROUP_get_basis_type(const EC_GROUP *);
+# ifndef OPENSSL_NO_EC2M
+int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k);
+int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1,
+                                   unsigned int *k2, unsigned int *k3);
+# endif
+
+# define OPENSSL_EC_NAMED_CURVE  0x001
+
+typedef struct ecpk_parameters_st ECPKPARAMETERS;
+
+EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);
+int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);
+
+# define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x)
+# define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x)
+# define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \
+                (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x))
+# define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \
+                (unsigned char *)(x))
+
+# ifndef OPENSSL_NO_BIO
+int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);
+# endif
+# ifndef OPENSSL_NO_FP_API
+int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);
+# endif
+
+/********************************************************************/
+/*                      EC_KEY functions                            */
+/********************************************************************/
+
+typedef struct ec_key_st EC_KEY;
+
+/* some values for the encoding_flag */
+# define EC_PKEY_NO_PARAMETERS   0x001
+# define EC_PKEY_NO_PUBKEY       0x002
+
+/* some values for the flags field */
+# define EC_FLAG_NON_FIPS_ALLOW  0x1
+# define EC_FLAG_FIPS_CHECKED    0x2
+
+/** Creates a new EC_KEY object.
+ *  \return EC_KEY object or NULL if an error occurred.
+ */
+EC_KEY *EC_KEY_new(void);
+
+int EC_KEY_get_flags(const EC_KEY *key);
+
+void EC_KEY_set_flags(EC_KEY *key, int flags);
+
+void EC_KEY_clear_flags(EC_KEY *key, int flags);
+
+/** Creates a new EC_KEY object using a named curve as underlying
+ *  EC_GROUP object.
+ *  \param  nid  NID of the named curve.
+ *  \return EC_KEY object or NULL if an error occurred.
+ */
+EC_KEY *EC_KEY_new_by_curve_name(int nid);
+
+/** Frees a EC_KEY object.
+ *  \param  key  EC_KEY object to be freed.
+ */
+void EC_KEY_free(EC_KEY *key);
+
+/** Copies a EC_KEY object.
+ *  \param  dst  destination EC_KEY object
+ *  \param  src  src EC_KEY object
+ *  \return dst or NULL if an error occurred.
+ */
+EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src);
+
+/** Creates a new EC_KEY object and copies the content from src to it.
+ *  \param  src  the source EC_KEY object
+ *  \return newly created EC_KEY object or NULL if an error occurred.
+ */
+EC_KEY *EC_KEY_dup(const EC_KEY *src);
+
+/** Increases the internal reference count of a EC_KEY object.
+ *  \param  key  EC_KEY object
+ *  \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_up_ref(EC_KEY *key);
+
+/** Returns the EC_GROUP object of a EC_KEY object
+ *  \param  key  EC_KEY object
+ *  \return the EC_GROUP object (possibly NULL).
+ */
+const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key);
+
+/** Sets the EC_GROUP of a EC_KEY object.
+ *  \param  key    EC_KEY object
+ *  \param  group  EC_GROUP to use in the EC_KEY object (note: the EC_KEY
+ *                 object will use an own copy of the EC_GROUP).
+ *  \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);
+
+/** Returns the private key of a EC_KEY object.
+ *  \param  key  EC_KEY object
+ *  \return a BIGNUM with the private key (possibly NULL).
+ */
+const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key);
+
+/** Sets the private key of a EC_KEY object.
+ *  \param  key  EC_KEY object
+ *  \param  prv  BIGNUM with the private key (note: the EC_KEY object
+ *               will use an own copy of the BIGNUM).
+ *  \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv);
+
+/** Returns the public key of a EC_KEY object.
+ *  \param  key  the EC_KEY object
+ *  \return a EC_POINT object with the public key (possibly NULL)
+ */
+const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
+
+/** Sets the public key of a EC_KEY object.
+ *  \param  key  EC_KEY object
+ *  \param  pub  EC_POINT object with the public key (note: the EC_KEY object
+ *               will use an own copy of the EC_POINT object).
+ *  \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);
+
+unsigned EC_KEY_get_enc_flags(const EC_KEY *key);
+void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);
+point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key);
+void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform);
+/* functions to set/get method specific data  */
+void *EC_KEY_get_key_method_data(EC_KEY *key,
+                                 void *(*dup_func) (void *),
+                                 void (*free_func) (void *),
+                                 void (*clear_free_func) (void *));
+/** Sets the key method data of an EC_KEY object, if none has yet been set.
+ *  \param  key              EC_KEY object
+ *  \param  data             opaque data to install.
+ *  \param  dup_func         a function that duplicates |data|.
+ *  \param  free_func        a function that frees |data|.
+ *  \param  clear_free_func  a function that wipes and frees |data|.
+ *  \return the previously set data pointer, or NULL if |data| was inserted.
+ */
+void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
+                                    void *(*dup_func) (void *),
+                                    void (*free_func) (void *),
+                                    void (*clear_free_func) (void *));
+/* wrapper functions for the underlying EC_GROUP object */
+void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag);
+
+/** Creates a table of pre-computed multiples of the generator to
+ *  accelerate further EC_KEY operations.
+ *  \param  key  EC_KEY object
+ *  \param  ctx  BN_CTX object (optional)
+ *  \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx);
+
+/** Creates a new ec private (and optional a new public) key.
+ *  \param  key  EC_KEY object
+ *  \return 1 on success and 0 if an error occurred.
+ */
+int EC_KEY_generate_key(EC_KEY *key);
+
+/** Verifies that a private and/or public key is valid.
+ *  \param  key  the EC_KEY object
+ *  \return 1 on success and 0 otherwise.
+ */
+int EC_KEY_check_key(const EC_KEY *key);
+
+/** Sets a public key from affine coordindates performing
+ *  neccessary NIST PKV tests.
+ *  \param  key  the EC_KEY object
+ *  \param  x    public key x coordinate
+ *  \param  y    public key y coordinate
+ *  \return 1 on success and 0 otherwise.
+ */
+int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
+                                             BIGNUM *y);
+
+/********************************************************************/
+/*        de- and encoding functions for SEC1 ECPrivateKey          */
+/********************************************************************/
+
+/** Decodes a private key from a memory buffer.
+ *  \param  key  a pointer to a EC_KEY object which should be used (or NULL)
+ *  \param  in   pointer to memory with the DER encoded private key
+ *  \param  len  length of the DER encoded private key
+ *  \return the decoded private key or NULL if an error occurred.
+ */
+EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len);
+
+/** Encodes a private key object and stores the result in a buffer.
+ *  \param  key  the EC_KEY object to encode
+ *  \param  out  the buffer for the result (if NULL the function returns number
+ *               of bytes needed).
+ *  \return 1 on success and 0 if an error occurred.
+ */
+int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out);
+
+/********************************************************************/
+/*        de- and encoding functions for EC parameters              */
+/********************************************************************/
+
+/** Decodes ec parameter from a memory buffer.
+ *  \param  key  a pointer to a EC_KEY object which should be used (or NULL)
+ *  \param  in   pointer to memory with the DER encoded ec parameters
+ *  \param  len  length of the DER encoded ec parameters
+ *  \return a EC_KEY object with the decoded parameters or NULL if an error
+ *          occurred.
+ */
+EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len);
+
+/** Encodes ec parameter and stores the result in a buffer.
+ *  \param  key  the EC_KEY object with ec paramters to encode
+ *  \param  out  the buffer for the result (if NULL the function returns number
+ *               of bytes needed).
+ *  \return 1 on success and 0 if an error occurred.
+ */
+int i2d_ECParameters(EC_KEY *key, unsigned char **out);
+
+/********************************************************************/
+/*         de- and encoding functions for EC public key             */
+/*         (octet string, not DER -- hence 'o2i' and 'i2o')         */
+/********************************************************************/
+
+/** Decodes a ec public key from a octet string.
+ *  \param  key  a pointer to a EC_KEY object which should be used
+ *  \param  in   memory buffer with the encoded public key
+ *  \param  len  length of the encoded public key
+ *  \return EC_KEY object with decoded public key or NULL if an error
+ *          occurred.
+ */
+EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len);
+
+/** Encodes a ec public key in an octet string.
+ *  \param  key  the EC_KEY object with the public key
+ *  \param  out  the buffer for the result (if NULL the function returns number
+ *               of bytes needed).
+ *  \return 1 on success and 0 if an error occurred
+ */
+int i2o_ECPublicKey(EC_KEY *key, unsigned char **out);
+
+# ifndef OPENSSL_NO_BIO
+/** Prints out the ec parameters on human readable form.
+ *  \param  bp   BIO object to which the information is printed
+ *  \param  key  EC_KEY object
+ *  \return 1 on success and 0 if an error occurred
+ */
+int ECParameters_print(BIO *bp, const EC_KEY *key);
+
+/** Prints out the contents of a EC_KEY object
+ *  \param  bp   BIO object to which the information is printed
+ *  \param  key  EC_KEY object
+ *  \param  off  line offset
+ *  \return 1 on success and 0 if an error occurred
+ */
+int EC_KEY_print(BIO *bp, const EC_KEY *key, int off);
+
+# endif
+# ifndef OPENSSL_NO_FP_API
+/** Prints out the ec parameters on human readable form.
+ *  \param  fp   file descriptor to which the information is printed
+ *  \param  key  EC_KEY object
+ *  \return 1 on success and 0 if an error occurred
+ */
+int ECParameters_print_fp(FILE *fp, const EC_KEY *key);
+
+/** Prints out the contents of a EC_KEY object
+ *  \param  fp   file descriptor to which the information is printed
+ *  \param  key  EC_KEY object
+ *  \param  off  line offset
+ *  \return 1 on success and 0 if an error occurred
+ */
+int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off);
+
+# endif
+
+# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x)
+
+# ifndef __cplusplus
+#  if defined(__SUNPRO_C)
+#   if __SUNPRO_C >= 0x520
+#    pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE)
+#   endif
+#  endif
+# endif
+
+# define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \
+        EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, EVP_PKEY_OP_PARAMGEN, \
+                                EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL)
+
+# define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID             (EVP_PKEY_ALG_CTRL + 1)
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_EC_strings(void);
+
+/* Error codes for the EC functions. */
+
+/* Function codes. */
+# define EC_F_BN_TO_FELEM                                 224
+# define EC_F_COMPUTE_WNAF                                143
+# define EC_F_D2I_ECPARAMETERS                            144
+# define EC_F_D2I_ECPKPARAMETERS                          145
+# define EC_F_D2I_ECPRIVATEKEY                            146
+# define EC_F_DO_EC_KEY_PRINT                             221
+# define EC_F_ECKEY_PARAM2TYPE                            223
+# define EC_F_ECKEY_PARAM_DECODE                          212
+# define EC_F_ECKEY_PRIV_DECODE                           213
+# define EC_F_ECKEY_PRIV_ENCODE                           214
+# define EC_F_ECKEY_PUB_DECODE                            215
+# define EC_F_ECKEY_PUB_ENCODE                            216
+# define EC_F_ECKEY_TYPE2PARAM                            220
+# define EC_F_ECPARAMETERS_PRINT                          147
+# define EC_F_ECPARAMETERS_PRINT_FP                       148
+# define EC_F_ECPKPARAMETERS_PRINT                        149
+# define EC_F_ECPKPARAMETERS_PRINT_FP                     150
+# define EC_F_ECP_NIST_MOD_192                            203
+# define EC_F_ECP_NIST_MOD_224                            204
+# define EC_F_ECP_NIST_MOD_256                            205
+# define EC_F_ECP_NIST_MOD_521                            206
+# define EC_F_EC_ASN1_GROUP2CURVE                         153
+# define EC_F_EC_ASN1_GROUP2FIELDID                       154
+# define EC_F_EC_ASN1_GROUP2PARAMETERS                    155
+# define EC_F_EC_ASN1_GROUP2PKPARAMETERS                  156
+# define EC_F_EC_ASN1_PARAMETERS2GROUP                    157
+# define EC_F_EC_ASN1_PKPARAMETERS2GROUP                  158
+# define EC_F_EC_EX_DATA_SET_DATA                         211
+# define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY           208
+# define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT     159
+# define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE              195
+# define EC_F_EC_GF2M_SIMPLE_OCT2POINT                    160
+# define EC_F_EC_GF2M_SIMPLE_POINT2OCT                    161
+# define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162
+# define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163
+# define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES   164
+# define EC_F_EC_GFP_MONT_FIELD_DECODE                    133
+# define EC_F_EC_GFP_MONT_FIELD_ENCODE                    134
+# define EC_F_EC_GFP_MONT_FIELD_MUL                       131
+# define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE                209
+# define EC_F_EC_GFP_MONT_FIELD_SQR                       132
+# define EC_F_EC_GFP_MONT_GROUP_SET_CURVE                 189
+# define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP             135
+# define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE             225
+# define EC_F_EC_GFP_NISTP224_POINTS_MUL                  228
+# define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226
+# define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE             230
+# define EC_F_EC_GFP_NISTP256_POINTS_MUL                  231
+# define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232
+# define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE             233
+# define EC_F_EC_GFP_NISTP521_POINTS_MUL                  234
+# define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235
+# define EC_F_EC_GFP_NIST_FIELD_MUL                       200
+# define EC_F_EC_GFP_NIST_FIELD_SQR                       201
+# define EC_F_EC_GFP_NIST_GROUP_SET_CURVE                 202
+# define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT      165
+# define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE               166
+# define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP           100
+# define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR           101
+# define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE                   102
+# define EC_F_EC_GFP_SIMPLE_OCT2POINT                     103
+# define EC_F_EC_GFP_SIMPLE_POINT2OCT                     104
+# define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE            137
+# define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES  167
+# define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP 105
+# define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES  168
+# define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP 128
+# define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES    169
+# define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP 129
+# define EC_F_EC_GROUP_CHECK                              170
+# define EC_F_EC_GROUP_CHECK_DISCRIMINANT                 171
+# define EC_F_EC_GROUP_COPY                               106
+# define EC_F_EC_GROUP_GET0_GENERATOR                     139
+# define EC_F_EC_GROUP_GET_COFACTOR                       140
+# define EC_F_EC_GROUP_GET_CURVE_GF2M                     172
+# define EC_F_EC_GROUP_GET_CURVE_GFP                      130
+# define EC_F_EC_GROUP_GET_DEGREE                         173
+# define EC_F_EC_GROUP_GET_ORDER                          141
+# define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS              193
+# define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS                194
+# define EC_F_EC_GROUP_NEW                                108
+# define EC_F_EC_GROUP_NEW_BY_CURVE_NAME                  174
+# define EC_F_EC_GROUP_NEW_FROM_DATA                      175
+# define EC_F_EC_GROUP_PRECOMPUTE_MULT                    142
+# define EC_F_EC_GROUP_SET_CURVE_GF2M                     176
+# define EC_F_EC_GROUP_SET_CURVE_GFP                      109
+# define EC_F_EC_GROUP_SET_EXTRA_DATA                     110
+# define EC_F_EC_GROUP_SET_GENERATOR                      111
+# define EC_F_EC_KEY_CHECK_KEY                            177
+# define EC_F_EC_KEY_COPY                                 178
+# define EC_F_EC_KEY_GENERATE_KEY                         179
+# define EC_F_EC_KEY_NEW                                  182
+# define EC_F_EC_KEY_PRINT                                180
+# define EC_F_EC_KEY_PRINT_FP                             181
+# define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES    229
+# define EC_F_EC_POINTS_MAKE_AFFINE                       136
+# define EC_F_EC_POINT_ADD                                112
+# define EC_F_EC_POINT_CMP                                113
+# define EC_F_EC_POINT_COPY                               114
+# define EC_F_EC_POINT_DBL                                115
+# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M        183
+# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP         116
+# define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP    117
+# define EC_F_EC_POINT_INVERT                             210
+# define EC_F_EC_POINT_IS_AT_INFINITY                     118
+# define EC_F_EC_POINT_IS_ON_CURVE                        119
+# define EC_F_EC_POINT_MAKE_AFFINE                        120
+# define EC_F_EC_POINT_MUL                                184
+# define EC_F_EC_POINT_NEW                                121
+# define EC_F_EC_POINT_OCT2POINT                          122
+# define EC_F_EC_POINT_POINT2OCT                          123
+# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M        185
+# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP         124
+# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M    186
+# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP     125
+# define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP    126
+# define EC_F_EC_POINT_SET_TO_INFINITY                    127
+# define EC_F_EC_PRE_COMP_DUP                             207
+# define EC_F_EC_PRE_COMP_NEW                             196
+# define EC_F_EC_WNAF_MUL                                 187
+# define EC_F_EC_WNAF_PRECOMPUTE_MULT                     188
+# define EC_F_I2D_ECPARAMETERS                            190
+# define EC_F_I2D_ECPKPARAMETERS                          191
+# define EC_F_I2D_ECPRIVATEKEY                            192
+# define EC_F_I2O_ECPUBLICKEY                             151
+# define EC_F_NISTP224_PRE_COMP_NEW                       227
+# define EC_F_NISTP256_PRE_COMP_NEW                       236
+# define EC_F_NISTP521_PRE_COMP_NEW                       237
+# define EC_F_O2I_ECPUBLICKEY                             152
+# define EC_F_OLD_EC_PRIV_DECODE                          222
+# define EC_F_PKEY_EC_CTRL                                197
+# define EC_F_PKEY_EC_CTRL_STR                            198
+# define EC_F_PKEY_EC_DERIVE                              217
+# define EC_F_PKEY_EC_KEYGEN                              199
+# define EC_F_PKEY_EC_PARAMGEN                            219
+# define EC_F_PKEY_EC_SIGN                                218
+
+/* Reason codes. */
+# define EC_R_ASN1_ERROR                                  115
+# define EC_R_ASN1_UNKNOWN_FIELD                          116
+# define EC_R_BIGNUM_OUT_OF_RANGE                         144
+# define EC_R_BUFFER_TOO_SMALL                            100
+# define EC_R_COORDINATES_OUT_OF_RANGE                    146
+# define EC_R_D2I_ECPKPARAMETERS_FAILURE                  117
+# define EC_R_DECODE_ERROR                                142
+# define EC_R_DISCRIMINANT_IS_ZERO                        118
+# define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE                119
+# define EC_R_FIELD_TOO_LARGE                             143
+# define EC_R_GF2M_NOT_SUPPORTED                          147
+# define EC_R_GROUP2PKPARAMETERS_FAILURE                  120
+# define EC_R_I2D_ECPKPARAMETERS_FAILURE                  121
+# define EC_R_INCOMPATIBLE_OBJECTS                        101
+# define EC_R_INVALID_ARGUMENT                            112
+# define EC_R_INVALID_COMPRESSED_POINT                    110
+# define EC_R_INVALID_COMPRESSION_BIT                     109
+# define EC_R_INVALID_CURVE                               141
+# define EC_R_INVALID_DIGEST_TYPE                         138
+# define EC_R_INVALID_ENCODING                            102
+# define EC_R_INVALID_FIELD                               103
+# define EC_R_INVALID_FORM                                104
+# define EC_R_INVALID_GROUP_ORDER                         122
+# define EC_R_INVALID_PENTANOMIAL_BASIS                   132
+# define EC_R_INVALID_PRIVATE_KEY                         123
+# define EC_R_INVALID_TRINOMIAL_BASIS                     137
+# define EC_R_KEYS_NOT_SET                                140
+# define EC_R_MISSING_PARAMETERS                          124
+# define EC_R_MISSING_PRIVATE_KEY                         125
+# define EC_R_NOT_A_NIST_PRIME                            135
+# define EC_R_NOT_A_SUPPORTED_NIST_PRIME                  136
+# define EC_R_NOT_IMPLEMENTED                             126
+# define EC_R_NOT_INITIALIZED                             111
+# define EC_R_NO_FIELD_MOD                                133
+# define EC_R_NO_PARAMETERS_SET                           139
+# define EC_R_PASSED_NULL_PARAMETER                       134
+# define EC_R_PKPARAMETERS2GROUP_FAILURE                  127
+# define EC_R_POINT_AT_INFINITY                           106
+# define EC_R_POINT_IS_NOT_ON_CURVE                       107
+# define EC_R_SLOT_FULL                                   108
+# define EC_R_UNDEFINED_GENERATOR                         113
+# define EC_R_UNDEFINED_ORDER                             128
+# define EC_R_UNKNOWN_GROUP                               129
+# define EC_R_UNKNOWN_ORDER                               114
+# define EC_R_UNSUPPORTED_FIELD                           131
+# define EC_R_WRONG_CURVE_PARAMETERS                      145
+# define EC_R_WRONG_ORDER                                 130
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ec.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/err.h
===================================================================
--- lab4/.minix-src/include/openssl/err.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/err.h	(revision 13)
@@ -0,0 +1,389 @@
+/* crypto/err/err.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* ====================================================================
+ * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_ERR_H
+# define HEADER_ERR_H
+
+# include <openssl/e_os2.h>
+
+# ifndef OPENSSL_NO_FP_API
+#  include <stdio.h>
+#  include <stdlib.h>
+# endif
+
+# include <openssl/ossl_typ.h>
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+# ifndef OPENSSL_NO_LHASH
+#  include <openssl/lhash.h>
+# endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifndef OPENSSL_NO_ERR
+#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
+# else
+#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,NULL,0)
+# endif
+
+# include <errno.h>
+
+# define ERR_TXT_MALLOCED        0x01
+# define ERR_TXT_STRING          0x02
+
+# define ERR_FLAG_MARK           0x01
+
+# define ERR_NUM_ERRORS  16
+typedef struct err_state_st {
+    CRYPTO_THREADID tid;
+    int err_flags[ERR_NUM_ERRORS];
+    unsigned long err_buffer[ERR_NUM_ERRORS];
+    char *err_data[ERR_NUM_ERRORS];
+    int err_data_flags[ERR_NUM_ERRORS];
+    const char *err_file[ERR_NUM_ERRORS];
+    int err_line[ERR_NUM_ERRORS];
+    int top, bottom;
+} ERR_STATE;
+
+/* library */
+# define ERR_LIB_NONE            1
+# define ERR_LIB_SYS             2
+# define ERR_LIB_BN              3
+# define ERR_LIB_RSA             4
+# define ERR_LIB_DH              5
+# define ERR_LIB_EVP             6
+# define ERR_LIB_BUF             7
+# define ERR_LIB_OBJ             8
+# define ERR_LIB_PEM             9
+# define ERR_LIB_DSA             10
+# define ERR_LIB_X509            11
+/* #define ERR_LIB_METH         12 */
+# define ERR_LIB_ASN1            13
+# define ERR_LIB_CONF            14
+# define ERR_LIB_CRYPTO          15
+# define ERR_LIB_EC              16
+# define ERR_LIB_SSL             20
+/* #define ERR_LIB_SSL23        21 */
+/* #define ERR_LIB_SSL2         22 */
+/* #define ERR_LIB_SSL3         23 */
+/* #define ERR_LIB_RSAREF       30 */
+/* #define ERR_LIB_PROXY        31 */
+# define ERR_LIB_BIO             32
+# define ERR_LIB_PKCS7           33
+# define ERR_LIB_X509V3          34
+# define ERR_LIB_PKCS12          35
+# define ERR_LIB_RAND            36
+# define ERR_LIB_DSO             37
+# define ERR_LIB_ENGINE          38
+# define ERR_LIB_OCSP            39
+# define ERR_LIB_UI              40
+# define ERR_LIB_COMP            41
+# define ERR_LIB_ECDSA           42
+# define ERR_LIB_ECDH            43
+# define ERR_LIB_STORE           44
+# define ERR_LIB_FIPS            45
+# define ERR_LIB_CMS             46
+# define ERR_LIB_TS              47
+# define ERR_LIB_HMAC            48
+# define ERR_LIB_JPAKE           49
+
+# define ERR_LIB_USER            128
+
+# define SYSerr(f,r)  ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
+# define BNerr(f,r)   ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
+# define RSAerr(f,r)  ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)
+# define DHerr(f,r)   ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)
+# define EVPerr(f,r)  ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)
+# define BUFerr(f,r)  ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)
+# define OBJerr(f,r)  ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)
+# define PEMerr(f,r)  ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)
+# define DSAerr(f,r)  ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)
+# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)
+# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)
+# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)
+# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)
+# define ECerr(f,r)   ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)
+# define SSLerr(f,r)  ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
+# define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)
+# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)
+# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)
+# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)
+# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)
+# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)
+# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)
+# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
+# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
+# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
+# define ECDSAerr(f,r)  ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)
+# define ECDHerr(f,r)  ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)
+# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)
+# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)
+# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
+# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)
+# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
+# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
+
+/*
+ * Borland C seems too stupid to be able to shift and do longs in the
+ * pre-processor :-(
+ */
+# define ERR_PACK(l,f,r)         (((((unsigned long)l)&0xffL)*0x1000000)| \
+                                ((((unsigned long)f)&0xfffL)*0x1000)| \
+                                ((((unsigned long)r)&0xfffL)))
+# define ERR_GET_LIB(l)          (int)((((unsigned long)l)>>24L)&0xffL)
+# define ERR_GET_FUNC(l)         (int)((((unsigned long)l)>>12L)&0xfffL)
+# define ERR_GET_REASON(l)       (int)((l)&0xfffL)
+# define ERR_FATAL_ERROR(l)      (int)((l)&ERR_R_FATAL)
+
+/* OS functions */
+# define SYS_F_FOPEN             1
+# define SYS_F_CONNECT           2
+# define SYS_F_GETSERVBYNAME     3
+# define SYS_F_SOCKET            4
+# define SYS_F_IOCTLSOCKET       5
+# define SYS_F_BIND              6
+# define SYS_F_LISTEN            7
+# define SYS_F_ACCEPT            8
+# define SYS_F_WSASTARTUP        9/* Winsock stuff */
+# define SYS_F_OPENDIR           10
+# define SYS_F_FREAD             11
+
+/* reasons */
+# define ERR_R_SYS_LIB   ERR_LIB_SYS/* 2 */
+# define ERR_R_BN_LIB    ERR_LIB_BN/* 3 */
+# define ERR_R_RSA_LIB   ERR_LIB_RSA/* 4 */
+# define ERR_R_DH_LIB    ERR_LIB_DH/* 5 */
+# define ERR_R_EVP_LIB   ERR_LIB_EVP/* 6 */
+# define ERR_R_BUF_LIB   ERR_LIB_BUF/* 7 */
+# define ERR_R_OBJ_LIB   ERR_LIB_OBJ/* 8 */
+# define ERR_R_PEM_LIB   ERR_LIB_PEM/* 9 */
+# define ERR_R_DSA_LIB   ERR_LIB_DSA/* 10 */
+# define ERR_R_X509_LIB  ERR_LIB_X509/* 11 */
+# define ERR_R_ASN1_LIB  ERR_LIB_ASN1/* 13 */
+# define ERR_R_CONF_LIB  ERR_LIB_CONF/* 14 */
+# define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO/* 15 */
+# define ERR_R_EC_LIB    ERR_LIB_EC/* 16 */
+# define ERR_R_SSL_LIB   ERR_LIB_SSL/* 20 */
+# define ERR_R_BIO_LIB   ERR_LIB_BIO/* 32 */
+# define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */
+# define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */
+# define ERR_R_PKCS12_LIB ERR_LIB_PKCS12/* 35 */
+# define ERR_R_RAND_LIB  ERR_LIB_RAND/* 36 */
+# define ERR_R_DSO_LIB   ERR_LIB_DSO/* 37 */
+# define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */
+# define ERR_R_OCSP_LIB  ERR_LIB_OCSP/* 39 */
+# define ERR_R_UI_LIB    ERR_LIB_UI/* 40 */
+# define ERR_R_COMP_LIB  ERR_LIB_COMP/* 41 */
+# define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */
+# define ERR_R_ECDH_LIB  ERR_LIB_ECDH/* 43 */
+# define ERR_R_STORE_LIB ERR_LIB_STORE/* 44 */
+# define ERR_R_TS_LIB    ERR_LIB_TS/* 45 */
+
+# define ERR_R_NESTED_ASN1_ERROR                 58
+# define ERR_R_BAD_ASN1_OBJECT_HEADER            59
+# define ERR_R_BAD_GET_ASN1_OBJECT_CALL          60
+# define ERR_R_EXPECTING_AN_ASN1_SEQUENCE        61
+# define ERR_R_ASN1_LENGTH_MISMATCH              62
+# define ERR_R_MISSING_ASN1_EOS                  63
+
+/* fatal error */
+# define ERR_R_FATAL                             64
+# define ERR_R_MALLOC_FAILURE                    (1|ERR_R_FATAL)
+# define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED       (2|ERR_R_FATAL)
+# define ERR_R_PASSED_NULL_PARAMETER             (3|ERR_R_FATAL)
+# define ERR_R_INTERNAL_ERROR                    (4|ERR_R_FATAL)
+# define ERR_R_DISABLED                          (5|ERR_R_FATAL)
+
+/*
+ * 99 is the maximum possible ERR_R_... code, higher values are reserved for
+ * the individual libraries
+ */
+
+typedef struct ERR_string_data_st {
+    unsigned long error;
+    const char *string;
+} ERR_STRING_DATA;
+
+void ERR_put_error(int lib, int func, int reason, const char *file, int line);
+void ERR_set_error_data(char *data, int flags);
+
+unsigned long ERR_get_error(void);
+unsigned long ERR_get_error_line(const char **file, int *line);
+unsigned long ERR_get_error_line_data(const char **file, int *line,
+                                      const char **data, int *flags);
+unsigned long ERR_peek_error(void);
+unsigned long ERR_peek_error_line(const char **file, int *line);
+unsigned long ERR_peek_error_line_data(const char **file, int *line,
+                                       const char **data, int *flags);
+unsigned long ERR_peek_last_error(void);
+unsigned long ERR_peek_last_error_line(const char **file, int *line);
+unsigned long ERR_peek_last_error_line_data(const char **file, int *line,
+                                            const char **data, int *flags);
+void ERR_clear_error(void);
+char *ERR_error_string(unsigned long e, char *buf);
+void ERR_error_string_n(unsigned long e, char *buf, size_t len);
+const char *ERR_lib_error_string(unsigned long e);
+const char *ERR_func_error_string(unsigned long e);
+const char *ERR_reason_error_string(unsigned long e);
+void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u),
+                         void *u);
+# ifndef OPENSSL_NO_FP_API
+void ERR_print_errors_fp(FILE *fp);
+# endif
+# ifndef OPENSSL_NO_BIO
+void ERR_print_errors(BIO *bp);
+# endif
+void ERR_add_error_data(int num, ...);
+void ERR_add_error_vdata(int num, va_list args);
+void ERR_load_strings(int lib, ERR_STRING_DATA str[]);
+void ERR_unload_strings(int lib, ERR_STRING_DATA str[]);
+void ERR_load_ERR_strings(void);
+void ERR_load_crypto_strings(void);
+void ERR_free_strings(void);
+
+void ERR_remove_thread_state(const CRYPTO_THREADID *tid);
+# ifndef OPENSSL_NO_DEPRECATED
+void ERR_remove_state(unsigned long pid); /* if zero we look it up */
+# endif
+ERR_STATE *ERR_get_state(void);
+
+# ifndef OPENSSL_NO_LHASH
+LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void);
+LHASH_OF(ERR_STATE) *ERR_get_err_state_table(void);
+void ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash);
+# endif
+
+int ERR_get_next_error_library(void);
+
+int ERR_set_mark(void);
+int ERR_pop_to_mark(void);
+
+/* Already defined in ossl_typ.h */
+/* typedef struct st_ERR_FNS ERR_FNS; */
+/*
+ * An application can use this function and provide the return value to
+ * loaded modules that should use the application's ERR state/functionality
+ */
+const ERR_FNS *ERR_get_implementation(void);
+/*
+ * A loaded module should call this function prior to any ERR operations
+ * using the application's "ERR_FNS".
+ */
+int ERR_set_implementation(const ERR_FNS *fns);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/err.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/krb5_asn.h
===================================================================
--- lab4/.minix-src/include/openssl/krb5_asn.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/krb5_asn.h	(revision 13)
@@ -0,0 +1,240 @@
+/* krb5_asn.h */
+/*
+ * Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project, **
+ * using ocsp/{*.h,*asn*.c} as a starting point
+ */
+
+/* ====================================================================
+ * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_KRB5_ASN_H
+# define HEADER_KRB5_ASN_H
+
+/*
+ * #include <krb5.h>
+ */
+# include <openssl/safestack.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*
+ * ASN.1 from Kerberos RFC 1510
+ */
+
+/*-     EncryptedData ::=   SEQUENCE {
+ *              etype[0]                      INTEGER, -- EncryptionType
+ *              kvno[1]                       INTEGER OPTIONAL,
+ *              cipher[2]                     OCTET STRING -- ciphertext
+ *      }
+ */
+typedef struct krb5_encdata_st {
+    ASN1_INTEGER *etype;
+    ASN1_INTEGER *kvno;
+    ASN1_OCTET_STRING *cipher;
+} KRB5_ENCDATA;
+
+DECLARE_STACK_OF(KRB5_ENCDATA)
+
+/*-     PrincipalName ::=   SEQUENCE {
+ *              name-type[0]                  INTEGER,
+ *              name-string[1]                SEQUENCE OF GeneralString
+ *      }
+ */
+typedef struct krb5_princname_st {
+    ASN1_INTEGER *nametype;
+    STACK_OF(ASN1_GENERALSTRING) *namestring;
+} KRB5_PRINCNAME;
+
+DECLARE_STACK_OF(KRB5_PRINCNAME)
+
+/*-     Ticket ::=      [APPLICATION 1] SEQUENCE {
+ *              tkt-vno[0]                    INTEGER,
+ *              realm[1]                      Realm,
+ *              sname[2]                      PrincipalName,
+ *              enc-part[3]                   EncryptedData
+ *      }
+ */
+typedef struct krb5_tktbody_st {
+    ASN1_INTEGER *tktvno;
+    ASN1_GENERALSTRING *realm;
+    KRB5_PRINCNAME *sname;
+    KRB5_ENCDATA *encdata;
+} KRB5_TKTBODY;
+
+typedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET;
+DECLARE_STACK_OF(KRB5_TKTBODY)
+
+/*-     AP-REQ ::=      [APPLICATION 14] SEQUENCE {
+ *              pvno[0]                       INTEGER,
+ *              msg-type[1]                   INTEGER,
+ *              ap-options[2]                 APOptions,
+ *              ticket[3]                     Ticket,
+ *              authenticator[4]              EncryptedData
+ *      }
+ *
+ *      APOptions ::=   BIT STRING {
+ *              reserved(0), use-session-key(1), mutual-required(2) }
+ */
+typedef struct krb5_ap_req_st {
+    ASN1_INTEGER *pvno;
+    ASN1_INTEGER *msgtype;
+    ASN1_BIT_STRING *apoptions;
+    KRB5_TICKET *ticket;
+    KRB5_ENCDATA *authenticator;
+} KRB5_APREQBODY;
+
+typedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ;
+DECLARE_STACK_OF(KRB5_APREQBODY)
+
+/*      Authenticator Stuff     */
+
+/*-     Checksum ::=   SEQUENCE {
+ *              cksumtype[0]                  INTEGER,
+ *              checksum[1]                   OCTET STRING
+ *      }
+ */
+typedef struct krb5_checksum_st {
+    ASN1_INTEGER *ctype;
+    ASN1_OCTET_STRING *checksum;
+} KRB5_CHECKSUM;
+
+DECLARE_STACK_OF(KRB5_CHECKSUM)
+
+/*-     EncryptionKey ::=   SEQUENCE {
+ *              keytype[0]                    INTEGER,
+ *              keyvalue[1]                   OCTET STRING
+ *      }
+ */
+typedef struct krb5_encryptionkey_st {
+    ASN1_INTEGER *ktype;
+    ASN1_OCTET_STRING *keyvalue;
+} KRB5_ENCKEY;
+
+DECLARE_STACK_OF(KRB5_ENCKEY)
+
+/*-     AuthorizationData ::=   SEQUENCE OF SEQUENCE {
+ *              ad-type[0]                    INTEGER,
+ *              ad-data[1]                    OCTET STRING
+ *      }
+ */
+typedef struct krb5_authorization_st {
+    ASN1_INTEGER *adtype;
+    ASN1_OCTET_STRING *addata;
+} KRB5_AUTHDATA;
+
+DECLARE_STACK_OF(KRB5_AUTHDATA)
+
+/*-     -- Unencrypted authenticator
+ *      Authenticator ::=    [APPLICATION 2] SEQUENCE    {
+ *              authenticator-vno[0]          INTEGER,
+ *              crealm[1]                     Realm,
+ *              cname[2]                      PrincipalName,
+ *              cksum[3]                      Checksum OPTIONAL,
+ *              cusec[4]                      INTEGER,
+ *              ctime[5]                      KerberosTime,
+ *              subkey[6]                     EncryptionKey OPTIONAL,
+ *              seq-number[7]                 INTEGER OPTIONAL,
+ *              authorization-data[8]         AuthorizationData OPTIONAL
+ *      }
+ */
+typedef struct krb5_authenticator_st {
+    ASN1_INTEGER *avno;
+    ASN1_GENERALSTRING *crealm;
+    KRB5_PRINCNAME *cname;
+    KRB5_CHECKSUM *cksum;
+    ASN1_INTEGER *cusec;
+    ASN1_GENERALIZEDTIME *ctime;
+    KRB5_ENCKEY *subkey;
+    ASN1_INTEGER *seqnum;
+    KRB5_AUTHDATA *authorization;
+} KRB5_AUTHENTBODY;
+
+typedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT;
+DECLARE_STACK_OF(KRB5_AUTHENTBODY)
+
+/*-  DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) =
+ *      type *name##_new(void);
+ *      void name##_free(type *a);
+ *      DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) =
+ *       DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) =
+ *        type *d2i_##name(type **a, const unsigned char **in, long len);
+ *        int i2d_##name(type *a, unsigned char **out);
+ *        DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it
+ */
+
+DECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA)
+DECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME)
+DECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY)
+DECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY)
+DECLARE_ASN1_FUNCTIONS(KRB5_TICKET)
+DECLARE_ASN1_FUNCTIONS(KRB5_APREQ)
+
+DECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM)
+DECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY)
+DECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA)
+DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY)
+DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT)
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/krb5_asn.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/md4.h
===================================================================
--- lab4/.minix-src/include/openssl/md4.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/md4.h	(revision 13)
@@ -0,0 +1,124 @@
+/* crypto/md4/md4.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_MD4_H
+# define HEADER_MD4_H
+
+# include <openssl/e_os2.h>
+# include <stddef.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifdef OPENSSL_NO_MD4
+#  error MD4 is disabled.
+# endif
+
+/*-
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then !
+ * ! MD4_LONG_LOG2 has to be defined along.                        !
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ */
+
+# ifndef __NetBSD__
+#  if defined(__LP32__)
+#   define MD4_LONG unsigned long
+#  elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
+#   define MD4_LONG unsigned long
+#   define MD4_LONG_LOG2 3
+/*
+ * _CRAY note. I could declare short, but I have no idea what impact
+ * does it have on performance on none-T3E machines. I could declare
+ * int, but at least on C90 sizeof(int) can be chosen at compile time.
+ * So I've chosen long...
+ *                                      <appro@fy.chalmers.se>
+ */
+#  else
+#   define MD4_LONG unsigned int
+#  endif
+# else
+#  include <sys/types.h>
+#  define MD4_LONG uint32_t
+# endif
+
+# define MD4_CBLOCK      64
+# define MD4_LBLOCK      (MD4_CBLOCK/4)
+# define MD4_DIGEST_LENGTH 16
+
+typedef struct MD4state_st {
+    MD4_LONG A, B, C, D;
+    MD4_LONG Nl, Nh;
+    MD4_LONG data[MD4_LBLOCK];
+    unsigned int num;
+} MD4_CTX;
+
+# ifdef OPENSSL_FIPS
+int private_MD4_Init(MD4_CTX *c);
+# endif
+int MD4_Init(MD4_CTX *c);
+int MD4_Update(MD4_CTX *c, const void *data, size_t len);
+int MD4_Final(unsigned char *md, MD4_CTX *c);
+unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md);
+void MD4_Transform(MD4_CTX *c, const unsigned char *b);
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/md4.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/modes.h
===================================================================
--- lab4/.minix-src/include/openssl/modes.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/modes.h	(revision 13)
@@ -0,0 +1,153 @@
+/* ====================================================================
+ * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ *
+ * Rights for redistribution and usage in source and binary
+ * forms are granted according to the OpenSSL license.
+ */
+
+#include <stddef.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+typedef void (*block128_f) (const unsigned char in[16],
+                            unsigned char out[16], const void *key);
+
+typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out,
+                          size_t len, const void *key,
+                          unsigned char ivec[16], int enc);
+
+typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out,
+                          size_t blocks, const void *key,
+                          const unsigned char ivec[16]);
+
+typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out,
+                          size_t blocks, const void *key,
+                          const unsigned char ivec[16],
+                          unsigned char cmac[16]);
+
+void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const void *key,
+                           unsigned char ivec[16], block128_f block);
+void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const void *key,
+                           unsigned char ivec[16], block128_f block);
+
+void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const void *key,
+                           unsigned char ivec[16],
+                           unsigned char ecount_buf[16], unsigned int *num,
+                           block128_f block);
+
+void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
+                                 size_t len, const void *key,
+                                 unsigned char ivec[16],
+                                 unsigned char ecount_buf[16],
+                                 unsigned int *num, ctr128_f ctr);
+
+void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const void *key,
+                           unsigned char ivec[16], int *num,
+                           block128_f block);
+
+void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t len, const void *key,
+                           unsigned char ivec[16], int *num,
+                           int enc, block128_f block);
+void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out,
+                             size_t length, const void *key,
+                             unsigned char ivec[16], int *num,
+                             int enc, block128_f block);
+void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
+                             size_t bits, const void *key,
+                             unsigned char ivec[16], int *num,
+                             int enc, block128_f block);
+
+size_t CRYPTO_cts128_encrypt_block(const unsigned char *in,
+                                   unsigned char *out, size_t len,
+                                   const void *key, unsigned char ivec[16],
+                                   block128_f block);
+size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out,
+                             size_t len, const void *key,
+                             unsigned char ivec[16], cbc128_f cbc);
+size_t CRYPTO_cts128_decrypt_block(const unsigned char *in,
+                                   unsigned char *out, size_t len,
+                                   const void *key, unsigned char ivec[16],
+                                   block128_f block);
+size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out,
+                             size_t len, const void *key,
+                             unsigned char ivec[16], cbc128_f cbc);
+
+size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in,
+                                       unsigned char *out, size_t len,
+                                       const void *key,
+                                       unsigned char ivec[16],
+                                       block128_f block);
+size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out,
+                                 size_t len, const void *key,
+                                 unsigned char ivec[16], cbc128_f cbc);
+size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in,
+                                       unsigned char *out, size_t len,
+                                       const void *key,
+                                       unsigned char ivec[16],
+                                       block128_f block);
+size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out,
+                                 size_t len, const void *key,
+                                 unsigned char ivec[16], cbc128_f cbc);
+
+typedef struct gcm128_context GCM128_CONTEXT;
+
+GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block);
+void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block);
+void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv,
+                         size_t len);
+int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad,
+                      size_t len);
+int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
+                          const unsigned char *in, unsigned char *out,
+                          size_t len);
+int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
+                          const unsigned char *in, unsigned char *out,
+                          size_t len);
+int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,
+                                const unsigned char *in, unsigned char *out,
+                                size_t len, ctr128_f stream);
+int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
+                                const unsigned char *in, unsigned char *out,
+                                size_t len, ctr128_f stream);
+int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag,
+                         size_t len);
+void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len);
+void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx);
+
+typedef struct ccm128_context CCM128_CONTEXT;
+
+void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx,
+                        unsigned int M, unsigned int L, void *key,
+                        block128_f block);
+int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce,
+                        size_t nlen, size_t mlen);
+void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad,
+                       size_t alen);
+int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp,
+                          unsigned char *out, size_t len);
+int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp,
+                          unsigned char *out, size_t len);
+int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp,
+                                unsigned char *out, size_t len,
+                                ccm128_f stream);
+int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp,
+                                unsigned char *out, size_t len,
+                                ccm128_f stream);
+size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len);
+
+typedef struct xts128_context XTS128_CONTEXT;
+
+int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx,
+                          const unsigned char iv[16],
+                          const unsigned char *inp, unsigned char *out,
+                          size_t len, int enc);
+
+#ifdef  __cplusplus
+}
+#endif

Property changes on: lab4/.minix-src/include/openssl/modes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/opensslconf.h
===================================================================
--- lab4/.minix-src/include/openssl/opensslconf.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/opensslconf.h	(revision 13)
@@ -0,0 +1,259 @@
+/* opensslconf.h */
+/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+/* OpenSSL was configured with the following options: */
+#ifndef OPENSSL_DOING_MAKEDEPEND
+
+
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+# define OPENSSL_NO_EC_NISTP_64_GCC_128
+#endif
+#ifndef OPENSSL_NO_GMP
+# define OPENSSL_NO_GMP
+#endif
+#ifndef OPENSSL_NO_JPAKE
+# define OPENSSL_NO_JPAKE
+#endif
+#ifndef OPENSSL_NO_KRB5
+# define OPENSSL_NO_KRB5
+#endif
+#if !defined(__NetBSD__) && !defined(__minix)
+#ifndef OPENSSL_NO_MD2
+# define OPENSSL_NO_MD2
+#endif
+#ifndef OPENSSL_NO_RC5
+# define OPENSSL_NO_RC5
+#endif
+#ifndef OPENSSL_NO_RFC3779
+# define OPENSSL_NO_RFC3779
+#endif
+#ifndef OPENSSL_NO_STORE
+# define OPENSSL_NO_STORE
+#endif
+#ifndef OPENSSL_NO_UNIT_TEST
+# define OPENSSL_NO_UNIT_TEST
+#endif
+#else /* __NetBSD__ */
+#ifndef OPENSSL_NO_SCTP
+# define OPENSSL_NO_SCTP
+#endif
+#endif /* __NetBSD__ */
+
+#define OPENSSL_CPUID_OBJ
+
+#endif /* OPENSSL_DOING_MAKEDEPEND */
+
+#ifndef OPENSSL_THREADS
+# define OPENSSL_THREADS
+#endif
+#ifndef OPENSSL_NO_DYNAMIC_ENGINE
+# define OPENSSL_NO_DYNAMIC_ENGINE
+#endif
+
+/* The OPENSSL_NO_* macros are also defined as NO_* if the application
+   asks for it.  This is a transient feature that is provided for those
+   who haven't had the time to do the appropriate changes in their
+   applications.  */
+#ifdef OPENSSL_ALGORITHM_DEFINES
+# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
+#  define NO_EC_NISTP_64_GCC_128
+# endif
+# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
+#  define NO_GMP
+# endif
+# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
+#  define NO_JPAKE
+# endif
+# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
+#  define NO_KRB5
+# endif
+# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
+#  define NO_MD2
+# endif
+# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
+#  define NO_RC5
+# endif
+# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
+#  define NO_RFC3779
+# endif
+# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
+#  define NO_SCTP
+# endif
+# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
+#  define NO_STORE
+# endif
+# if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST)
+#  define NO_UNIT_TEST
+# endif
+#endif
+
+/* crypto/opensslconf.h.in */
+
+/* Generate 80386 code? */
+#undef I386_ONLY
+
+#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
+#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
+#define ENGINESDIR "/usr/local/ssl/lib/engines"
+#define OPENSSLDIR "/usr/local/ssl"
+#endif
+#endif
+
+#undef OPENSSL_UNISTD
+#define OPENSSL_UNISTD <unistd.h>
+
+#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
+
+#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
+#define IDEA_INT uint32_t
+#endif
+
+#if defined(HEADER_MD2_H) && !defined(MD2_INT)
+#define MD2_INT uint32_t
+#endif
+
+#if defined(HEADER_RC2_H) && !defined(RC2_INT)
+/* I need to put in a mod for the alpha - eay */
+#define RC2_INT uint32_t
+#endif
+
+#if defined(HEADER_RC4_H)
+#if !defined(RC4_INT)
+/* using int types make the structure larger but make the code faster
+ * on most boxes I have tested - up to %20 faster. */
+/*
+ * I don't know what does "most" mean, but declaring "int" is a must on:
+ * - Intel P6 because partial register stalls are very expensive;
+ * - elder Alpha because it lacks byte load/store instructions;
+ */
+#define RC4_INT uint32_t
+#endif
+#if !defined(RC4_CHUNK)
+/*
+ * This enables code handling data aligned at natural CPU word
+ * boundary. See crypto/rc4/rc4_enc.c for further details.
+ */
+#ifdef _LP64
+#define RC4_CHUNK uint64_t
+#else
+#undef RC4_CHUNK
+#endif
+#endif
+#endif
+
+#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
+/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
+ * %20 speed up (longs are 8 bytes, int's are 4). */
+#ifndef DES_LONG
+#define DES_LONG uint32_t
+#endif
+#endif
+
+#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
+#define CONFIG_HEADER_BN_H
+/* #undef BN_LLONG */
+
+/* Should we define BN_DIV2W here? */
+
+/* Only one for the following should be defined */
+#ifdef _LP64
+#define SIXTY_FOUR_BIT_LONG
+#undef SIXTY_FOUR_BIT
+#undef THIRTY_TWO_BIT
+#else
+#undef SIXTY_FOUR_BIT_LONG
+#undef SIXTY_FOUR_BIT
+#define THIRTY_TWO_BIT
+#endif
+#endif
+
+#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
+#define CONFIG_HEADER_RC4_LOCL_H
+/* if this is defined data[i] is used instead of *data, this is a %20
+ * speedup on x86 */
+/* #undef RC4_INDEX */
+#endif
+
+#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
+#define CONFIG_HEADER_BF_LOCL_H
+/* #undef BF_PTR */
+#endif /* HEADER_BF_LOCL_H */
+
+#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
+#define CONFIG_HEADER_DES_LOCL_H
+#ifndef DES_DEFAULT_OPTIONS
+/* the following is tweaked from a config script, that is why it is a
+ * protected undef/define */
+#ifndef DES_PTR
+/* #undef DES_PTR */
+#endif
+
+/* This helps C compiler generate the correct code for multiple functional
+ * units.  It reduces register dependancies at the expense of 2 more
+ * registers */
+#ifndef DES_RISC1
+/* #undef DES_RISC1 */
+#endif
+
+#ifndef DES_RISC2
+/* #undef DES_RISC2 */
+#endif
+
+#if defined(DES_RISC1) && defined(DES_RISC2)
+#error YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
+#endif
+
+/* Unroll the inner loop, this sometimes helps, sometimes hinders.
+ * Very mucy CPU dependant */
+#ifndef DES_UNROLL
+/* #undef DES_UNROLL */
+#endif
+
+/* These default values were supplied by
+ * Peter Gutman <pgut001@cs.auckland.ac.nz>
+ * They are only used if nothing else has been defined */
+#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
+/* Special defines which change the way the code is built depending on the
+   CPU and OS.  For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
+   even newer MIPS CPU's, but at the moment one size fits all for
+   optimization options.  Older Sparc's work better with only UNROLL, but
+   there's no way to tell at compile time what it is you're running on */
+ 
+#if defined( sun )		/* Newer Sparc's */
+#  define DES_PTR
+#  define DES_RISC1
+#  define DES_UNROLL
+#elif defined( __ultrix )	/* Older MIPS */
+#  define DES_PTR
+#  define DES_RISC2
+#  define DES_UNROLL
+#elif defined( __osf1__ )	/* Alpha */
+#  define DES_PTR
+#  define DES_RISC2
+#elif defined ( _AIX )		/* RS6000 */
+  /* Unknown */
+#elif defined( __hpux )		/* HP-PA */
+  /* Unknown */
+#elif defined( __aux )		/* 68K */
+  /* Unknown */
+#elif defined( __dgux )		/* 88K (but P6 in latest boxes) */
+#  define DES_UNROLL
+#elif defined( __sgi )		/* Newer MIPS */
+#  define DES_PTR
+#  define DES_RISC2
+#  define DES_UNROLL
+#elif defined(i386) || defined(__i386__)	/* x86 boxes, should be gcc */
+#  define DES_PTR
+#  define DES_RISC1
+#  define DES_UNROLL
+#endif /* Systems-specific speed defines */
+#endif
+
+#endif /* DES_DEFAULT_OPTIONS */
+#endif /* HEADER_DES_LOCL_H */
+#ifdef  __cplusplus
+}
+#endif

Property changes on: lab4/.minix-src/include/openssl/opensslconf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/pem2.h
===================================================================
--- lab4/.minix-src/include/openssl/pem2.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/pem2.h	(revision 13)
@@ -0,0 +1,70 @@
+/* ====================================================================
+ * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+/*
+ * This header only exists to break a circular dependency between pem and err
+ * Ben 30 Jan 1999.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef HEADER_PEM_H
+void ERR_load_PEM_strings(void);
+#endif
+
+#ifdef __cplusplus
+}
+#endif

Property changes on: lab4/.minix-src/include/openssl/pem2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet6/in6.h
===================================================================
--- lab4/.minix-src/include/netinet6/in6.h	(nonexistent)
+++ lab4/.minix-src/include/netinet6/in6.h	(revision 13)
@@ -0,0 +1,830 @@
+/*	$NetBSD: in6.h,v 1.85 2015/08/07 08:11:33 ozaki-r Exp $	*/
+/*	$KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)in.h	8.3 (Berkeley) 1/3/94
+ */
+
+#ifndef _NETINET6_IN6_H_
+#define _NETINET6_IN6_H_
+
+#include <sys/featuretest.h>
+
+#ifndef __KAME_NETINET_IN_H_INCLUDED_
+#error "do not include netinet6/in6.h directly, include netinet/in.h.  see RFC2553"
+#endif
+
+#include <sys/socket.h>
+
+/*
+ * Identification of the network protocol stack
+ * for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE
+ * has the table of implementation/integration differences.
+ */
+#define __KAME__
+#define __KAME_VERSION		"NetBSD-current"
+
+/*
+ * Local port number conventions:
+ *
+ * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
+ * unless a kernel is compiled with IPNOPRIVPORTS defined.
+ *
+ * When a user does a bind(2) or connect(2) with a port number of zero,
+ * a non-conflicting local port address is chosen.
+ *
+ * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
+ * that is settable by sysctl(3); net.inet.ip.anonportmin and
+ * net.inet.ip.anonportmax respectively.
+ *
+ * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
+ * default assignment range.
+ *
+ * The value IP_PORTRANGE_DEFAULT causes the default behavior.
+ *
+ * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
+ * and exists only for FreeBSD compatibility purposes.
+ *
+ * The value IP_PORTRANGE_LOW changes the range to the "low" are
+ * that is (by convention) restricted to privileged processes.
+ * This convention is based on "vouchsafe" principles only.
+ * It is only secure if you trust the remote host to restrict these ports.
+ * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
+ */
+
+#if defined(_NETBSD_SOURCE)
+#define	IPV6PORT_RESERVED	1024
+#define	IPV6PORT_ANONMIN	49152
+#define	IPV6PORT_ANONMAX	65535
+#define	IPV6PORT_RESERVEDMIN	600
+#define	IPV6PORT_RESERVEDMAX	(IPV6PORT_RESERVED-1)
+#endif
+
+/*
+ * IPv6 address
+ */
+struct in6_addr {
+	union {
+		__uint8_t   __u6_addr8[16];
+		__uint16_t  __u6_addr16[8];
+		uint32_t  __u6_addr32[4];
+	} __u6_addr;			/* 128-bit IP6 address */
+};
+
+#define s6_addr   __u6_addr.__u6_addr8
+#ifdef _KERNEL	/* XXX nonstandard */
+#define s6_addr8  __u6_addr.__u6_addr8
+#define s6_addr16 __u6_addr.__u6_addr16
+#define s6_addr32 __u6_addr.__u6_addr32
+#endif
+
+#define INET6_ADDRSTRLEN	46
+
+/*
+ * Socket address for IPv6
+ */
+#if defined(_NETBSD_SOURCE)
+#define SIN6_LEN
+#endif
+struct sockaddr_in6 {
+	uint8_t		sin6_len;	/* length of this struct(socklen_t)*/
+	sa_family_t	sin6_family;	/* AF_INET6 (sa_family_t) */
+	in_port_t	sin6_port;	/* Transport layer port */
+	uint32_t	sin6_flowinfo;	/* IP6 flow information */
+	struct in6_addr	sin6_addr;	/* IP6 address */
+	uint32_t	sin6_scope_id;	/* scope zone index */
+};
+
+/*
+ * Local definition for masks
+ */
+#ifdef _KERNEL	/* XXX nonstandard */
+#define IN6MASK0	{{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
+#define IN6MASK32	{{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
+			    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
+#define IN6MASK64	{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
+			    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
+#define IN6MASK96	{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
+			    0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
+#define IN6MASK128	{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
+			    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
+#endif
+
+#ifdef _KERNEL
+extern const struct sockaddr_in6 sa6_any;
+
+extern const struct in6_addr in6mask0;
+extern const struct in6_addr in6mask32;
+extern const struct in6_addr in6mask64;
+extern const struct in6_addr in6mask96;
+extern const struct in6_addr in6mask128;
+#endif /* _KERNEL */
+
+/*
+ * Macros started with IPV6_ADDR is KAME local
+ */
+#ifdef _KERNEL	/* XXX nonstandard */
+#if BYTE_ORDER == BIG_ENDIAN
+#define IPV6_ADDR_INT32_ONE	1
+#define IPV6_ADDR_INT32_TWO	2
+#define IPV6_ADDR_INT32_MNL	0xff010000
+#define IPV6_ADDR_INT32_MLL	0xff020000
+#define IPV6_ADDR_INT32_SMP	0x0000ffff
+#define IPV6_ADDR_INT16_ULL	0xfe80
+#define IPV6_ADDR_INT16_USL	0xfec0
+#define IPV6_ADDR_INT16_MLL	0xff02
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define IPV6_ADDR_INT32_ONE	0x01000000
+#define IPV6_ADDR_INT32_TWO	0x02000000
+#define IPV6_ADDR_INT32_MNL	0x000001ff
+#define IPV6_ADDR_INT32_MLL	0x000002ff
+#define IPV6_ADDR_INT32_SMP	0xffff0000
+#define IPV6_ADDR_INT16_ULL	0x80fe
+#define IPV6_ADDR_INT16_USL	0xc0fe
+#define IPV6_ADDR_INT16_MLL	0x02ff
+#endif
+#endif
+
+/*
+ * Definition of some useful macros to handle IP6 addresses
+ */
+#define IN6ADDR_ANY_INIT \
+	{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
+#define IN6ADDR_LOOPBACK_INIT \
+	{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
+	{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
+	{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
+	{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
+
+extern const struct in6_addr in6addr_any;
+extern const struct in6_addr in6addr_loopback;
+extern const struct in6_addr in6addr_nodelocal_allnodes;
+extern const struct in6_addr in6addr_linklocal_allnodes;
+extern const struct in6_addr in6addr_linklocal_allrouters;
+
+#define IN6_ARE_ADDR_EQUAL(a, b)			\
+    (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
+
+/*
+ * Unspecified
+ */
+#define IN6_IS_ADDR_UNSPECIFIED(a)	\
+	((a)->__u6_addr.__u6_addr32[0] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[1] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[2] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[3] == 0)
+
+/*
+ * Loopback
+ */
+#define IN6_IS_ADDR_LOOPBACK(a)		\
+	((a)->__u6_addr.__u6_addr32[0] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[1] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[2] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[3] == ntohl(1))
+
+/*
+ * IPv4 compatible
+ */
+#define IN6_IS_ADDR_V4COMPAT(a)		\
+	((a)->__u6_addr.__u6_addr32[0] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[1] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[2] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[3] != 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[3] != ntohl(1))
+
+/*
+ * Mapped
+ */
+#define IN6_IS_ADDR_V4MAPPED(a)		      \
+	((a)->__u6_addr.__u6_addr32[0] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[1] == 0 &&	\
+	 (a)->__u6_addr.__u6_addr32[2] == ntohl(0x0000ffff))
+
+/*
+ * KAME Scope Values
+ */
+
+#ifdef _KERNEL	/* XXX nonstandard */
+#define IPV6_ADDR_SCOPE_NODELOCAL	0x01
+#define IPV6_ADDR_SCOPE_INTFACELOCAL	0x01
+#define IPV6_ADDR_SCOPE_LINKLOCAL	0x02
+#define IPV6_ADDR_SCOPE_SITELOCAL	0x05
+#define IPV6_ADDR_SCOPE_ORGLOCAL	0x08	/* just used in this file */
+#define IPV6_ADDR_SCOPE_GLOBAL		0x0e
+#else
+#define __IPV6_ADDR_SCOPE_NODELOCAL	0x01
+#define __IPV6_ADDR_SCOPE_LINKLOCAL	0x02
+#define __IPV6_ADDR_SCOPE_SITELOCAL	0x05
+#define __IPV6_ADDR_SCOPE_ORGLOCAL	0x08	/* just used in this file */
+#define __IPV6_ADDR_SCOPE_GLOBAL	0x0e
+#endif
+
+/*
+ * Unicast Scope
+ * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
+ */
+#define IN6_IS_ADDR_LINKLOCAL(a)	\
+	(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
+#define IN6_IS_ADDR_SITELOCAL(a)	\
+	(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
+
+/*
+ * Multicast
+ */
+#define IN6_IS_ADDR_MULTICAST(a)	((a)->s6_addr[0] == 0xff)
+
+#ifdef _KERNEL	/* XXX nonstandard */
+#define IPV6_ADDR_MC_SCOPE(a)		((a)->s6_addr[1] & 0x0f)
+#else
+#define __IPV6_ADDR_MC_SCOPE(a)		((a)->s6_addr[1] & 0x0f)
+#endif
+
+/*
+ * Multicast Scope
+ */
+#ifdef _KERNEL	/* refers nonstandard items */
+#define IN6_IS_ADDR_MC_NODELOCAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) &&	\
+	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
+#define IN6_IS_ADDR_MC_INTFACELOCAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) &&	\
+	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))
+#define IN6_IS_ADDR_MC_LINKLOCAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) &&	\
+	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
+#define IN6_IS_ADDR_MC_SITELOCAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) && 	\
+	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
+#define IN6_IS_ADDR_MC_ORGLOCAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) &&	\
+	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
+#define IN6_IS_ADDR_MC_GLOBAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) &&	\
+	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
+#else
+#define IN6_IS_ADDR_MC_NODELOCAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) &&	\
+	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
+#define IN6_IS_ADDR_MC_LINKLOCAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) &&	\
+	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
+#define IN6_IS_ADDR_MC_SITELOCAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) && 	\
+	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
+#define IN6_IS_ADDR_MC_ORGLOCAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) &&	\
+	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
+#define IN6_IS_ADDR_MC_GLOBAL(a)	\
+	(IN6_IS_ADDR_MULTICAST(a) &&	\
+	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
+#endif
+
+#ifdef _KERNEL	/* nonstandard */
+/*
+ * KAME Scope
+ */
+#define IN6_IS_SCOPE_LINKLOCAL(a)	\
+	((IN6_IS_ADDR_LINKLOCAL(a)) ||	\
+	 (IN6_IS_ADDR_MC_LINKLOCAL(a)))
+
+#define	IN6_IS_SCOPE_EMBEDDABLE(__a)	\
+    (IN6_IS_SCOPE_LINKLOCAL(__a) || IN6_IS_ADDR_MC_INTFACELOCAL(__a))
+
+#define IFA6_IS_DEPRECATED(a) \
+	((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
+	 (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \
+	 (a)->ia6_lifetime.ia6t_pltime)
+#define IFA6_IS_INVALID(a) \
+	((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
+	 (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \
+	 (a)->ia6_lifetime.ia6t_vltime)
+#endif
+
+/*
+ * Options for use with [gs]etsockopt at the IPV6 level.
+ * First word of comment is data type; bool is stored in int.
+ */
+/* no hdrincl */
+#if 0
+/* These are deprecated non-standard options which are no longer supported. */
+#define IPV6_OPTIONS		1  /* buf/ip6_opts; set/get IP6 options */
+#define IPV6_RECVOPTS		5  /* bool; receive all IP6 opts w/dgram */
+#define IPV6_RECVRETOPTS	6  /* bool; receive IP6 opts for response */
+#define IPV6_RECVDSTADDR	7  /* bool; receive IP6 dst addr w/dgram */
+#define IPV6_RETOPTS		8  /* ip6_opts; set/get IP6 options */
+#endif
+#define IPV6_SOCKOPT_RESERVED1	3  /* reserved for future use */
+#define IPV6_UNICAST_HOPS	4  /* int; IP6 hops */
+#define IPV6_MULTICAST_IF	9  /* u_int; set/get IP6 multicast i/f  */
+#define IPV6_MULTICAST_HOPS	10 /* int; set/get IP6 multicast hops */
+#define IPV6_MULTICAST_LOOP	11 /* u_int; set/get IP6 multicast loopback */
+/* The join and leave membership option numbers need to match with the v4 ones */
+#define IPV6_JOIN_GROUP		12 /* ip6_mreq; join a group membership */
+#define IPV6_LEAVE_GROUP	13 /* ip6_mreq; leave a group membership */
+#define IPV6_PORTRANGE		14 /* int; range to choose for unspec port */
+#if defined(_NETBSD_SOURCE)
+#define IPV6_PORTALGO		17 /* int; port selection algo (rfc6056) */
+#define ICMP6_FILTER		18 /* icmp6_filter; icmp6 filter */
+#endif
+/* RFC2292 options */
+#ifdef _KERNEL
+#define IPV6_2292PKTINFO	19 /* bool; send/recv if, src/dst addr */
+#define IPV6_2292HOPLIMIT	20 /* bool; hop limit */
+#define IPV6_2292NEXTHOP	21 /* bool; next hop addr */
+#define IPV6_2292HOPOPTS	22 /* bool; hop-by-hop option */
+#define IPV6_2292DSTOPTS	23 /* bool; destination option */
+#define IPV6_2292RTHDR		24 /* bool; routing header */
+#define IPV6_2292PKTOPTIONS	25 /* buf/cmsghdr; set/get IPv6 options */
+#endif
+#define IPV6_CHECKSUM		26 /* int; checksum offset for raw socket */
+#define IPV6_V6ONLY		27 /* bool; make AF_INET6 sockets v6 only */
+
+#define IPV6_IPSEC_POLICY	28 /* struct; get/set security policy */
+#define IPV6_FAITH		29 /* bool; accept FAITH'ed connections */
+
+/* new socket options introduced in RFC3542 */
+#define IPV6_RTHDRDSTOPTS       35 /* ip6_dest; send dst option before rthdr */
+
+#define IPV6_RECVPKTINFO        36 /* bool; recv if, dst addr */
+#define IPV6_RECVHOPLIMIT       37 /* bool; recv hop limit */
+#define IPV6_RECVRTHDR          38 /* bool; recv routing header */
+#define IPV6_RECVHOPOPTS        39 /* bool; recv hop-by-hop option */
+#define IPV6_RECVDSTOPTS        40 /* bool; recv dst option after rthdr */
+#ifdef _KERNEL
+#define IPV6_RECVRTHDRDSTOPTS   41 /* bool; recv dst option before rthdr */
+#endif
+#define IPV6_USE_MIN_MTU	42 /* bool; send packets at the minimum MTU */
+#define IPV6_RECVPATHMTU	43 /* bool; notify an according MTU */
+#define IPV6_PATHMTU		44 /* mtuinfo; get the current path MTU (sopt),
+				      4 bytes int; MTU notification (cmsg) */
+
+/* more new socket options introduced in RFC3542 */
+#define IPV6_PKTINFO		46 /* in6_pktinfo; send if, src addr */
+#define IPV6_HOPLIMIT		47 /* int; send hop limit */
+#define IPV6_NEXTHOP		48 /* sockaddr; next hop addr */
+#define IPV6_HOPOPTS		49 /* ip6_hbh; send hop-by-hop option */
+#define IPV6_DSTOPTS		50 /* ip6_dest; send dst option befor rthdr */
+#define IPV6_RTHDR		51 /* ip6_rthdr; send routing header */
+
+#define IPV6_RECVTCLASS		57 /* bool; recv traffic class values */
+#ifdef _KERNEL
+#define IPV6_OTCLASS		58 /* u_int8_t; send traffic class value */
+#endif
+
+#define IPV6_TCLASS		61 /* int; send traffic class value */
+#define IPV6_DONTFRAG		62 /* bool; disable IPv6 fragmentation */
+#define IPV6_PREFER_TEMPADDR	63 /* int; prefer temporary address as
+				    * the sorce address */
+/* to define items, should talk with KAME guys first, for *BSD compatibility */
+
+#define IPV6_RTHDR_LOOSE     0 /* this hop need not be a neighbor. XXX old spec */
+#define IPV6_RTHDR_STRICT    1 /* this hop must be a neighbor. XXX old spec */
+#define IPV6_RTHDR_TYPE_0    0 /* IPv6 routing header type 0 */
+
+/*
+ * Defaults and limits for options
+ */
+#define IPV6_DEFAULT_MULTICAST_HOPS 1	/* normally limit m'casts to 1 hop  */
+#define IPV6_DEFAULT_MULTICAST_LOOP 1	/* normally hear sends if a member  */
+
+/*
+ * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
+ */
+struct ipv6_mreq {
+	struct in6_addr	ipv6mr_multiaddr;
+	unsigned int	ipv6mr_interface;
+};
+
+/*
+ * IPV6_PKTINFO: Packet information(RFC2292 sec 5)
+ */
+struct in6_pktinfo {
+	struct in6_addr	ipi6_addr;	/* src/dst IPv6 address */
+	unsigned int	ipi6_ifindex;	/* send/recv interface index */
+};
+
+/*
+ * Control structure for IPV6_RECVPATHMTU socket option.
+ */
+struct ip6_mtuinfo {
+	struct sockaddr_in6 ip6m_addr;	/* or sockaddr_storage? */
+	uint32_t ip6m_mtu;
+};
+
+/*
+ * Argument for IPV6_PORTRANGE:
+ * - which range to search when port is unspecified at bind() or connect()
+ */
+#define	IPV6_PORTRANGE_DEFAULT	0	/* default range */
+#define	IPV6_PORTRANGE_HIGH	1	/* "high" - request firewall bypass */
+#define	IPV6_PORTRANGE_LOW	2	/* "low" - vouchsafe security */
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Definitions for inet6 sysctl operations.
+ *
+ * Third level is protocol number.
+ * Fourth level is desired variable within that protocol.
+ */
+#define IPV6PROTO_MAXID	(IPPROTO_PIM + 1)	/* don't list to IPV6PROTO_MAX */
+
+#define CTL_IPV6PROTO_NAMES { \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, \
+	{ "tcp6", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "udp6", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, \
+	{ "ip6", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, \
+	{ "ipsec6", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "icmp6", CTLTYPE_NODE }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "pim6", CTLTYPE_NODE }, \
+}
+
+/*
+ * Names for IP sysctl objects
+ */
+#define IPV6CTL_FORWARDING	1	/* act as router */
+#define IPV6CTL_SENDREDIRECTS	2	/* may send redirects when forwarding*/
+#define IPV6CTL_DEFHLIM		3	/* default Hop-Limit */
+#ifdef notyet
+#define IPV6CTL_DEFMTU		4	/* default MTU */
+#endif
+#define IPV6CTL_FORWSRCRT	5	/* forward source-routed dgrams */
+#define IPV6CTL_STATS		6	/* stats */
+#define IPV6CTL_MRTSTATS	7	/* multicast forwarding stats */
+#define IPV6CTL_MRTPROTO	8	/* multicast routing protocol */
+#define IPV6CTL_MAXFRAGPACKETS	9	/* max packets reassembly queue */
+#define IPV6CTL_SOURCECHECK	10	/* verify source route and intf */
+#define IPV6CTL_SOURCECHECK_LOGINT 11	/* minimume logging interval */
+#define IPV6CTL_ACCEPT_RTADV	12
+#define IPV6CTL_KEEPFAITH	13
+#define IPV6CTL_LOG_INTERVAL	14
+#define IPV6CTL_HDRNESTLIMIT	15
+#define IPV6CTL_DAD_COUNT	16
+#define IPV6CTL_AUTO_FLOWLABEL	17
+#define IPV6CTL_DEFMCASTHLIM	18
+#define IPV6CTL_GIF_HLIM	19	/* default HLIM for gif encap packet */
+#define IPV6CTL_KAME_VERSION	20
+#define IPV6CTL_USE_DEPRECATED	21	/* use deprecated addr (RFC2462 5.5.4) */
+#define IPV6CTL_RR_PRUNE	22	/* walk timer for router renumbering */
+/* 23: reserved */
+#define IPV6CTL_V6ONLY		24
+/* 25 to 27: reserved */
+#define IPV6CTL_ANONPORTMIN	28	/* minimum ephemeral port */
+#define IPV6CTL_ANONPORTMAX	29	/* maximum ephemeral port */
+#define IPV6CTL_LOWPORTMIN	30	/* minimum reserved port */
+#define IPV6CTL_LOWPORTMAX	31	/* maximum reserved port */
+/* 32 to 34: reserved */
+#define IPV6CTL_AUTO_LINKLOCAL	35	/* automatic link-local addr assign */
+/* 36 to 38: reserved */
+#define IPV6CTL_USE_DEFAULTZONE	39	/* use default scope zone */
+/* 40: reserved */
+#define IPV6CTL_MAXFRAGS	41	/* max fragments */
+#define IPV6CTL_IFQ		42	/* IPv6 packet input queue */
+#define IPV6CTL_RTADV_MAXROUTES 43	/* maximum number of routes */
+					/* via router advertisement */
+#define IPV6CTL_RTADV_NUMROUTES 44	/* current number of routes */
+					/* via router advertisement */
+/* New entries should be added here from current IPV6CTL_MAXID value. */
+/* to define items, should talk with KAME guys first, for *BSD compatibility */
+#define IPV6CTL_MAXID		45
+
+#define IPV6CTL_NAMES { \
+	{ 0, 0 }, \
+	{ "forwarding", CTLTYPE_INT }, \
+	{ "redirect", CTLTYPE_INT }, \
+	{ "hlim", CTLTYPE_INT }, \
+	{ "mtu", CTLTYPE_INT }, \
+	{ "forwsrcrt", CTLTYPE_INT }, \
+	{ "stats", CTLTYPE_STRUCT }, \
+	{ 0, 0 }, \
+	{ "mrtproto", CTLTYPE_INT }, \
+	{ "maxfragpackets", CTLTYPE_INT }, \
+	{ "sourcecheck", CTLTYPE_INT }, \
+	{ "sourcecheck_logint", CTLTYPE_INT }, \
+	{ "accept_rtadv", CTLTYPE_INT }, \
+	{ "keepfaith", CTLTYPE_INT }, \
+	{ "log_interval", CTLTYPE_INT }, \
+	{ "hdrnestlimit", CTLTYPE_INT }, \
+	{ "dad_count", CTLTYPE_INT }, \
+	{ "auto_flowlabel", CTLTYPE_INT }, \
+	{ "defmcasthlim", CTLTYPE_INT }, \
+	{ "gifhlim", CTLTYPE_INT }, \
+	{ "kame_version", CTLTYPE_STRING }, \
+	{ "use_deprecated", CTLTYPE_INT }, \
+	{ "rr_prune", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ "v6only", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "anonportmin", CTLTYPE_INT }, \
+	{ "anonportmax", CTLTYPE_INT }, \
+	{ "lowportmin", CTLTYPE_INT }, \
+	{ "lowportmax", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "maxfrags", CTLTYPE_INT }, \
+	{ "ifq", CTLTYPE_NODE }, \
+	{ "rtadv_maxroutes", CTLTYPE_INT }, \
+	{ "rtadv_numroutes", CTLTYPE_INT }, \
+}
+
+#endif /* _NETBSD_SOURCE */
+
+#ifdef _KERNEL
+struct cmsghdr;
+
+/*
+ * in6_cksum_phdr:
+ *
+ *	Compute significant parts of the IPv6 checksum pseudo-header
+ *	for use in a delayed TCP/UDP checksum calculation.
+ *
+ *	Args:
+ *
+ *		src		Source IPv6 address
+ *		dst		Destination IPv6 address
+ *		len		htonl(proto-hdr-len)
+ *		nxt		htonl(next-proto-number)
+ *
+ *	NOTE: We expect the src and dst addresses to be 16-bit
+ *	aligned!
+ */
+static __inline u_int16_t __unused
+in6_cksum_phdr(const struct in6_addr *src, const struct in6_addr *dst,
+    u_int32_t len, u_int32_t nxt)
+{
+	u_int32_t sum = 0;
+	const u_int16_t *w;
+
+	/*LINTED*/
+	w = (const u_int16_t *) src;
+	sum += w[0];
+	if (!IN6_IS_SCOPE_LINKLOCAL(src))
+		sum += w[1];
+	sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5];
+	sum += w[6]; sum += w[7];
+
+	/*LINTED*/
+	w = (const u_int16_t *) dst;
+	sum += w[0];
+	if (!IN6_IS_SCOPE_LINKLOCAL(dst))
+		sum += w[1];
+	sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5];
+	sum += w[6]; sum += w[7];
+
+	sum += (u_int16_t)(len >> 16) + (u_int16_t)(len /*& 0xffff*/);
+
+	sum += (u_int16_t)(nxt >> 16) + (u_int16_t)(nxt /*& 0xffff*/);
+
+	sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/);
+
+	if (sum > 0xffff)
+		sum -= 0xffff;
+
+	return (sum);
+}
+
+struct mbuf;
+struct ifnet;
+int sockaddr_in6_cmp(const struct sockaddr *, const struct sockaddr *);
+struct sockaddr *sockaddr_in6_externalize(struct sockaddr *, socklen_t,
+    const struct sockaddr *);
+int	in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t);
+void	in6_delayed_cksum(struct mbuf *);
+int	in6_localaddr(const struct in6_addr *);
+int	in6_addrscope(const struct in6_addr *);
+struct	in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *);
+extern void in6_if_link_up(struct ifnet *);
+extern void in6_if_link_down(struct ifnet *);
+extern void in6_if_link_state_change(struct ifnet *, int);
+extern void in6_if_up(struct ifnet *);
+extern void in6_if_down(struct ifnet *);
+#ifndef __FreeBSD__
+extern int in6_src_sysctl(void *, size_t *, void *, size_t);
+#endif
+extern void addrsel_policy_init(void);
+extern	u_char	ip6_protox[];
+
+#define	satosin6(sa)	((struct sockaddr_in6 *)(sa))
+#define	satocsin6(sa)	((const struct sockaddr_in6 *)(sa))
+#define	sin6tosa(sin6)	((struct sockaddr *)(sin6))
+#define	sin6tocsa(sin6)	((const struct sockaddr *)(sin6))
+#define	ifatoia6(ifa)	((struct in6_ifaddr *)(ifa))
+
+static inline void
+sockaddr_in6_init1(struct sockaddr_in6 *sin6, const struct in6_addr *addr,
+    in_port_t port, uint32_t flowinfo, uint32_t scope_id)
+{
+	sin6->sin6_port = port;
+	sin6->sin6_flowinfo = flowinfo;
+	sin6->sin6_addr = *addr;
+	sin6->sin6_scope_id = scope_id;
+}
+
+static inline void
+sockaddr_in6_init(struct sockaddr_in6 *sin6, const struct in6_addr *addr,
+    in_port_t port, uint32_t flowinfo, uint32_t scope_id)
+{
+	sin6->sin6_family = AF_INET6;
+	sin6->sin6_len = sizeof(*sin6);
+	sockaddr_in6_init1(sin6, addr, port, flowinfo, scope_id);
+}
+
+static inline struct sockaddr *
+sockaddr_in6_alloc(const struct in6_addr *addr, in_port_t port,
+    uint32_t flowinfo, uint32_t scope_id, int flags)
+{
+	struct sockaddr *sa;
+
+	if ((sa = sockaddr_alloc(AF_INET6, sizeof(struct sockaddr_in6),
+	    flags)) == NULL)
+		return NULL;
+
+	sockaddr_in6_init1(satosin6(sa), addr, port, flowinfo, scope_id);
+
+	return sa;
+}
+#endif /* _KERNEL */
+
+#if defined(_NETBSD_SOURCE)
+
+#include <machine/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_		size_t;
+#define	_SIZE_T
+#undef	_BSD_SIZE_T_
+#endif
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+struct cmsghdr;
+
+void	in6_sin6_2_sin(struct sockaddr_in *, struct sockaddr_in6 *);
+void	in6_sin_2_v4mapsin6(const struct sockaddr_in *, struct sockaddr_in6 *);
+void	in6_sin6_2_sin_in_sock(struct sockaddr *);
+void	in6_sin_2_v4mapsin6_in_sock(struct sockaddr **);
+
+#define INET6_IS_ADDR_LINKLOCAL		1
+#define INET6_IS_ADDR_MC_LINKLOCAL	2
+#define INET6_IS_ADDR_SITELOCAL		4
+void	inet6_getscopeid(struct sockaddr_in6 *, int);
+void	inet6_putscopeid(struct sockaddr_in6 *, int);
+
+extern int inet6_option_space(int);
+extern int inet6_option_init(void *, struct cmsghdr **, int);
+extern int inet6_option_append(struct cmsghdr *, const uint8_t *,
+	int, int);
+extern uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);
+extern int inet6_option_next(const struct cmsghdr *, uint8_t **);
+extern int inet6_option_find(const struct cmsghdr *, uint8_t **, int);
+
+extern size_t inet6_rthdr_space(int, int);
+extern struct cmsghdr *inet6_rthdr_init(void *, int);
+extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *,
+		unsigned int);
+extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int);
+#if 0 /* not implemented yet */
+extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *);
+#endif
+extern int inet6_rthdr_segments(const struct cmsghdr *);
+extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int);
+extern int inet6_rthdr_getflags(const struct cmsghdr *, int);
+
+extern int inet6_opt_init(void *, socklen_t);
+extern int inet6_opt_append(void *, socklen_t, int, uint8_t,
+		socklen_t, uint8_t, void **);
+extern int inet6_opt_finish(void *, socklen_t, int);
+extern int inet6_opt_set_val(void *, int, void *, socklen_t);
+
+extern int inet6_opt_next(void *, socklen_t, int, uint8_t *,
+		socklen_t *, void **);
+extern int inet6_opt_find(void *, socklen_t, int, uint8_t,
+		socklen_t *, void **);
+extern int inet6_opt_get_val(void *, int, void *, socklen_t);
+extern socklen_t inet6_rth_space(int, int);
+extern void *inet6_rth_init(void *, socklen_t, int, int);
+extern int inet6_rth_add(void *, const struct in6_addr *);
+extern int inet6_rth_reverse(const void *, void *);
+extern int inet6_rth_segments(const void *);
+extern struct in6_addr *inet6_rth_getaddr(const void *, int);
+__END_DECLS
+#endif /* _NETBSD_SOURCE */
+
+#if defined(_KERNEL) || defined(_TEST)
+int	in6_print(char *, size_t, const struct in6_addr *);
+#define IN6_PRINT(b, a) (in6_print((b), sizeof(b), (a)), (b))
+int	sin6_print(char *, size_t, const void *);
+#endif
+
+#endif /* !_NETINET6_IN6_H_ */

Property changes on: lab4/.minix-src/include/netinet6/in6.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet6/ip6_var.h
===================================================================
--- lab4/.minix-src/include/netinet6/ip6_var.h	(nonexistent)
+++ lab4/.minix-src/include/netinet6/ip6_var.h	(revision 13)
@@ -0,0 +1,411 @@
+/*	$NetBSD: ip6_var.h,v 1.64 2015/01/20 21:27:36 roy Exp $	*/
+/*	$KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ip_var.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET6_IP6_VAR_H_
+#define _NETINET6_IP6_VAR_H_
+
+#include <sys/socketvar.h>
+#include <net/route.h>
+
+/*
+ * IP6 reassembly queue structure.  Each fragment
+ * being reassembled is attached to one of these structures.
+ */
+struct	ip6q {
+	u_int32_t	ip6q_head;
+	u_int16_t	ip6q_len;
+	u_int8_t	ip6q_nxt;	/* ip6f_nxt in first fragment */
+	u_int8_t	ip6q_hlim;
+	struct ip6asfrag *ip6q_down;
+	struct ip6asfrag *ip6q_up;
+	u_int32_t	ip6q_ident;
+	u_int8_t	ip6q_arrive;
+	u_int8_t	ip6q_ttl;
+	struct in6_addr	ip6q_src, ip6q_dst;
+	struct ip6q	*ip6q_next;
+	struct ip6q	*ip6q_prev;
+	int		ip6q_unfrglen;	/* len of unfragmentable part */
+#ifdef notyet
+	u_char		*ip6q_nxtp;
+#endif
+	int		ip6q_nfrag;	/* # of fragments */
+};
+
+struct	ip6asfrag {
+	u_int32_t	ip6af_head;
+	u_int16_t	ip6af_len;
+	u_int8_t	ip6af_nxt;
+	u_int8_t	ip6af_hlim;
+	/* must not override the above members during reassembling */
+	struct ip6asfrag *ip6af_down;
+	struct ip6asfrag *ip6af_up;
+	struct mbuf	*ip6af_m;
+	int		ip6af_offset;	/* offset in ip6af_m to next header */
+	int		ip6af_frglen;	/* fragmentable part length */
+	int		ip6af_off;	/* fragment offset */
+	u_int16_t	ip6af_mff;	/* more fragment bit in frag off */
+};
+
+#define IP6_REASS_MBUF(ip6af) ((ip6af)->ip6af_m)
+
+struct	ip6_moptions {
+	struct	ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
+	u_char	im6o_multicast_hlim;	/* hoplimit for outgoing multicasts */
+	u_char	im6o_multicast_loop;	/* 1 >= hear sends if a member */
+	LIST_HEAD(, in6_multi_mship) im6o_memberships;
+};
+
+/*
+ * Control options for outgoing packets
+ */
+
+/* Routing header related info */
+struct	ip6po_rhinfo {
+	struct	ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
+	struct	route ip6po_rhi_route; /* Route to the 1st hop */
+};
+#define ip6po_rthdr	ip6po_rhinfo.ip6po_rhi_rthdr
+#define ip6po_route	ip6po_rhinfo.ip6po_rhi_route
+
+/* Nexthop related info */
+struct	ip6po_nhinfo {
+	struct	sockaddr *ip6po_nhi_nexthop;
+	struct	route ip6po_nhi_route; /* Route to the nexthop */
+};
+#define ip6po_nexthop	ip6po_nhinfo.ip6po_nhi_nexthop
+#define ip6po_nextroute	ip6po_nhinfo.ip6po_nhi_route
+
+struct	ip6_pktopts {
+	int	ip6po_hlim;		/* Hoplimit for outgoing packets */
+	struct	in6_pktinfo *ip6po_pktinfo; /* Outgoing IF/address information */
+	struct	ip6po_nhinfo ip6po_nhinfo; /* Next-hop address information */
+	struct	ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
+	struct	ip6_dest *ip6po_dest1; /* Destination options header(1st part) */
+	struct	ip6po_rhinfo ip6po_rhinfo; /* Routing header related info. */
+	struct	ip6_dest *ip6po_dest2; /* Destination options header(2nd part) */
+	int	ip6po_tclass;	/* traffic class */
+	int	ip6po_minmtu;  /* fragment vs PMTU discovery policy */
+#define IP6PO_MINMTU_MCASTONLY	-1 /* default; send at min MTU for multicast*/
+#define IP6PO_MINMTU_DISABLE	 0 /* always perform pmtu disc */
+#define IP6PO_MINMTU_ALL	 1 /* always send at min MTU */
+	int	ip6po_prefer_tempaddr;	/* whether temporary addresses are
+					 * preferred as source address */
+#define IP6PO_TEMPADDR_SYSTEM	-1 /* follow the system default */
+#define IP6PO_TEMPADDR_NOTPREFER 0 /* not prefer temporary address */
+#define IP6PO_TEMPADDR_PREFER	 1 /* prefer temporary address */
+	int ip6po_flags;
+#if 0	/* parameters in this block is obsolete. do not reuse the values. */
+#define IP6PO_REACHCONF	0x01	/* upper-layer reachability confirmation. */
+#define IP6PO_MINMTU	0x02	/* use minimum MTU (IPV6_USE_MIN_MTU) */
+#endif
+#define IP6PO_DONTFRAG	0x04	/* disable fragmentation (IPV6_DONTFRAG) */
+};
+
+/*
+ * IPv6 statistics.
+ * Each counter is an unsigned 64-bit value.
+ */
+#define	IP6_STAT_TOTAL		0	/* total packets received */
+#define	IP6_STAT_TOOSHORT	1	/* packet too short */
+#define	IP6_STAT_TOOSMALL	2	/* not enough data */
+#define	IP6_STAT_FRAGMENTS	3	/* fragments received */
+#define	IP6_STAT_FRAGDROPPED	4	/* frags dropped (dups, out of space) */
+#define	IP6_STAT_FRAGTIMEOUT	5	/* fragments timed out */
+#define	IP6_STAT_FRAGOVERFLOW	6	/* fragments that exceed limit */
+#define IP6_STAT_FORWARD	7	/* packets forwarded */
+#define	IP6_STAT_CANTFORWARD	8	/* packets rcvd for uncreachable dst */
+#define	IP6_STAT_REDIRECTSENT	9	/* packets forwarded on same net */
+#define	IP6_STAT_DELIVERED	10	/* datagrams delivered to upper level */
+#define	IP6_STAT_LOCALOUT	11	/* total IP packets generated here */
+#define	IP6_STAT_ODROPPED	12	/* lost packets due to nobufs, etc. */
+#define	IP6_STAT_REASSEMBLED	13	/* total packets reassembled ok */
+#define	IP6_STAT_FRAGMENTED	14	/* datagrams successfully fragmented */
+#define	IP6_STAT_OFRAGMENTS	15	/* output fragments created */
+#define	IP6_STAT_CANTFRAG	16	/* don't fragment flag was set, etc. */
+#define	IP6_STAT_BADOPTIONS	17	/* error in option processing */
+#define	IP6_STAT_NOROUTE	18	/* packets discarded due to no route */
+#define	IP6_STAT_BADVERS	19	/* ip6 version != 6 */
+#define	IP6_STAT_RAWOUT		20	/* total raw ip packets generated */
+#define	IP6_STAT_BADSCOPE	21	/* scope error */
+#define	IP6_STAT_NOTMEMBER	22	/* don't join this multicast group */
+#define	IP6_STAT_NXTHIST	23	/* next header histogram */
+		/* space for 256 counters */
+#define	IP6_STAT_M1		279	/* one mbuf */
+#define	IP6_STAT_M2M		280	/* two or more mbuf */
+		/* space for 32 counters */
+#define	IP6_STAT_MEXT1		312	/* one ext mbuf */
+#define	IP6_STAT_MEXT2M		313	/* two or more ext mbuf */
+#define	IP6_STAT_EXTHDRTOOLONG	314	/* ext hdr are not contiguous */
+#define	IP6_STAT_NOGIF		315	/* no match gif found */
+#define	IP6_STAT_TOOMANYHDR	316	/* discarded due to too many headers */
+	/*
+	 * statistics for improvement of the source address selection
+	 * algorithm:
+	 * XXX: hardcoded 16 = # of ip6 multicast scope types + 1
+	 */
+#define	IP6_STAT_SOURCES_NONE	317	/* number of times that address
+					   selection fails */
+#define	IP6_STAT_SOURCES_SAMEIF	318	/* number of times that an address
+					   on the outgoing I/F is chosen */
+		/* space for 16 counters */
+#define	IP6_STAT_SOURCES_OTHERIF 334	/* number of times that an address on
+					   a non-outgoing I/F is chosen */
+		/* space for 16 counters */
+#define	IP6_STAT_SOURCES_SAMESCOPE 350	/* number of times that an address that
+					   has the same scope from the dest.
+					   is chosen */
+		/* space for 16 counters */
+#define	IP6_STAT_SOURCES_OTHERSCOPE 366	/* number of times that an address that
+					   has a different scope from the dest.
+					   is chosen */
+		/* space for 16 counters */
+#define	IP6_STAT_SOURCES_DEPRECATED 382	/* number of times that a deprecated
+					   address is chosen */
+		/* space for 16 counters */
+#define	IP6_STAT_FORWARD_CACHEHIT 398
+#define	IP6_STAT_FORWARD_CACHEMISS 399
+#define	IP6_STAT_FASTFORWARD	400	/* packets fast forwarded */
+#define	IP6_STAT_FASTFORWARDFLOWS 401	/* number of fast forward flows */
+
+#define	IP6_NSTATS		402
+
+#define IP6FLOW_HASHBITS         6 /* should not be a multiple of 8 */
+
+/* 
+ * Structure for an IPv6 flow (ip6_fastforward).
+ */
+struct ip6flow {
+	LIST_ENTRY(ip6flow) ip6f_list;  /* next in active list */
+	LIST_ENTRY(ip6flow) ip6f_hash;  /* next ip6flow in bucket */
+	struct in6_addr ip6f_dst;       /* destination address */
+	struct in6_addr ip6f_src;       /* source address */
+	struct route ip6f_ro;       /* associated route entry */
+	u_int32_t ip6f_flow;		/* flow (tos) */
+	u_quad_t ip6f_uses;               /* number of uses in this period */
+	u_quad_t ip6f_last_uses;          /* number of uses in last period */
+	u_quad_t ip6f_dropped;            /* ENOBUFS returned by if_output */
+	u_quad_t ip6f_forwarded;          /* packets forwarded */
+	u_int ip6f_timer;               /* lifetime timer */
+};
+
+#ifdef _KERNEL
+/*
+ * Auxiliary attributes of incoming IPv6 packets, which is initialized when we
+ * come into ip6_input().
+ * XXX do not make it a kitchen sink!
+ */
+struct ip6aux {
+	/* ip6.ip6_dst */
+	struct in6_addr	ip6a_src;
+	uint32_t	ip6a_scope_id;
+	int		ip6a_flags;
+};
+
+/* flags passed to ip6_output as last parameter */
+#define	IPV6_UNSPECSRC		0x01	/* allow :: as the source address */
+#define	IPV6_FORWARDING		0x02	/* most of IPv6 header exists */
+#define	IPV6_MINMTU		0x04	/* use minimum MTU (IPV6_USE_MIN_MTU) */
+
+extern u_int32_t ip6_id;		/* fragment identifier */
+extern int	ip6_defhlim;		/* default hop limit */
+extern int	ip6_defmcasthlim;	/* default multicast hop limit */
+extern int	ip6_forwarding;		/* act as router? */
+extern int	ip6_sendredirect;	/* send ICMPv6 redirect? */
+extern int	ip6_forward_srcrt;	/* forward src-routed? */
+extern int	ip6_use_deprecated;	/* allow deprecated addr as source */
+extern int	ip6_rr_prune;		/* router renumbering prefix
+					 * walk list every 5 sec.    */
+extern int	ip6_mcast_pmtu;		/* enable pMTU discovery for multicast? */
+extern int	ip6_v6only;
+extern int	ip6_neighborgcthresh;	/* Threshold # of NDP entries for GC */
+extern int	ip6_maxifprefixes; /* Max acceptable prefixes via RA per IF */
+extern int	ip6_maxifdefrouters;	/* Max acceptable def routers via RA */
+extern int	ip6_maxdynroutes; /* Max # of routes created via redirect */
+
+
+extern struct socket *ip6_mrouter; 	/* multicast routing daemon */
+extern int	ip6_sendredirects;	/* send IP redirects when forwarding? */
+extern int	ip6_maxfragpackets; /* Maximum packets in reassembly queue */
+extern int	ip6_maxfrags;	/* Maximum fragments in reassembly queue */
+extern int	ip6_sourcecheck;	/* Verify source interface */
+extern int	ip6_sourcecheck_interval; /* Interval between log messages */
+extern int	ip6_accept_rtadv;	/* Acts as a host not a router */
+extern int	ip6_rtadv_maxroutes;	/* maximum number of routes via rtadv */
+extern int	ip6_keepfaith;		/* Firewall Aided Internet Translator */
+extern int	ip6_log_interval;
+extern time_t	ip6_log_time;
+extern int	ip6_hdrnestlimit; /* upper limit of # of extension headers */
+extern int	ip6_dad_count;		/* DupAddrDetectionTransmits */
+
+extern int ip6_auto_flowlabel;
+extern int ip6_auto_linklocal;
+
+extern int   ip6_anonportmin;		/* minimum ephemeral port */
+extern int   ip6_anonportmax;		/* maximum ephemeral port */
+extern int   ip6_lowportmin;		/* minimum reserved port */
+extern int   ip6_lowportmax;		/* maximum reserved port */
+
+extern int	ip6_use_tempaddr; /* whether to use temporary addresses. */
+extern int	ip6_prefer_tempaddr; /* whether to prefer temporary addresses
+					in the source address selection */
+extern int	ip6_use_defzone; /* whether to use the default scope zone
+				    when unspecified */
+
+#ifdef GATEWAY
+extern int      ip6_maxflows;           /* maximum amount of flows for ip6ff */
+extern int	ip6_hashsize;		/* size of hash table */
+#endif
+
+struct in6pcb;
+extern const struct pr_usrreqs rip6_usrreqs;
+
+int	icmp6_ctloutput(int, struct socket *, struct sockopt *);
+
+struct mbuf;
+void	ip6_init(void);
+void	ip6_input(struct mbuf *);
+const struct ip6aux *ip6_getdstifaddr(struct mbuf *);
+void	ip6_freepcbopts(struct ip6_pktopts *);
+void	ip6_freemoptions(struct ip6_moptions *);
+int	ip6_unknown_opt(u_int8_t *, struct mbuf *, int);
+u_int8_t *ip6_get_prevhdr(struct mbuf *, int);
+int	ip6_nexthdr(struct mbuf *, int, int, int *);
+int	ip6_lasthdr(struct mbuf *, int, int, int *);
+
+struct m_tag *ip6_addaux(struct mbuf *);
+struct m_tag *ip6_findaux(struct mbuf *);
+void	ip6_delaux(struct mbuf *);
+struct ip6_hdr;
+int	ip6_mforward(struct ip6_hdr *, struct ifnet *, struct mbuf *);
+int	ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *);
+void	ip6_savecontrol(struct in6pcb *, struct mbuf **, struct ip6_hdr *,
+		struct mbuf *);
+void	ip6_notify_pmtu(struct in6pcb *, const struct sockaddr_in6 *,
+		u_int32_t *);
+int	ip6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
+
+void	ip6_forward(struct mbuf *, int);
+
+void	ip6_mloopback(struct ifnet *, struct mbuf *,
+	              const struct sockaddr_in6 *);
+int	ip6_output(struct mbuf *, struct ip6_pktopts *,
+			struct route *, int,
+			struct ip6_moptions *, struct socket *,
+			struct ifnet **);
+int	ip6_ctloutput(int, struct socket *, struct sockopt *);
+int	ip6_raw_ctloutput(int, struct socket *, struct sockopt *);
+void	ip6_initpktopts(struct ip6_pktopts *);
+int	ip6_setpktopts(struct mbuf *, struct ip6_pktopts *,
+			    struct ip6_pktopts *, kauth_cred_t, int);
+void	ip6_clearpktopts(struct ip6_pktopts *, int);
+struct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int);
+int	ip6_optlen(struct in6pcb *);
+
+void	ip6_statinc(u_int);
+
+int	route6_input(struct mbuf **, int *, int);
+
+void	frag6_init(void);
+int	frag6_input(struct mbuf **, int *, int);
+int	ip6_reass_packet(struct mbuf **, int);
+void	frag6_slowtimo(void);
+void	frag6_fasttimo(void);
+void	frag6_drain(void);
+void	frag6_drainstub(void);
+
+int	ip6flow_init(int);
+void	ip6flow_poolinit(void);
+struct  ip6flow *ip6flow_reap(int);
+void    ip6flow_create(const struct route *, struct mbuf *);
+void    ip6flow_slowtimo(void);
+int	ip6flow_invalidate_all(int);
+
+void	rip6_init(void);
+int	rip6_input(struct mbuf **, int *, int);
+void	*rip6_ctlinput(int, const struct sockaddr *, void *);
+int	rip6_ctloutput(int, struct socket *, struct sockopt *);
+int	rip6_output(struct mbuf *, struct socket *, struct sockaddr_in6 *,
+			 struct mbuf *);
+int	rip6_attach(struct socket *, int);
+int	rip6_usrreq(struct socket *,
+	    int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *);
+
+int	dest6_input(struct mbuf **, int *, int);
+int	none_input(struct mbuf **, int *, int);
+
+struct route;
+
+struct 	in6_addr *in6_selectsrc(struct sockaddr_in6 *,
+	struct ip6_pktopts *, struct ip6_moptions *, struct route *,
+	struct in6_addr *, struct ifnet **, int *);
+int in6_selectroute(struct sockaddr_in6 *, struct ip6_pktopts *,
+	struct ip6_moptions *, struct route *, struct ifnet **,
+	struct rtentry **, int);
+int	ip6_get_membership(const struct sockopt *, struct ifnet **, void *,
+	size_t);
+
+u_int32_t ip6_randomid(void);
+u_int32_t ip6_randomflowlabel(void);
+#endif /* _KERNEL */
+
+#endif /* !_NETINET6_IP6_VAR_H_ */

Property changes on: lab4/.minix-src/include/netinet6/ip6_var.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netinet6/udp6.h
===================================================================
--- lab4/.minix-src/include/netinet6/udp6.h	(nonexistent)
+++ lab4/.minix-src/include/netinet6/udp6.h	(revision 13)
@@ -0,0 +1,38 @@
+/*	$NetBSD: udp6.h,v 1.7 2005/12/10 23:39:56 elad Exp $	*/
+/*	$KAME: udp6.h,v 1.4 2001/02/10 00:57:54 itojun Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _NETINET6_UDP6_H_
+#define _NETINET6_UDP6_H_
+
+#include <netinet/udp.h>
+
+#endif /* !_NETINET6_UDP6_H_ */

Property changes on: lab4/.minix-src/include/netinet6/udp6.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/aes.h
===================================================================
--- lab4/.minix-src/include/openssl/aes.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/aes.h	(revision 13)
@@ -0,0 +1,157 @@
+/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */
+/* ====================================================================
+ * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ */
+
+#ifndef HEADER_AES_H
+# define HEADER_AES_H
+
+# include <openssl/opensslconf.h>
+
+# ifdef OPENSSL_NO_AES
+#  error AES is disabled.
+# endif
+
+# include <stddef.h>
+
+# define AES_ENCRYPT     1
+# define AES_DECRYPT     0
+
+/*
+ * Because array size can't be a const in C, the following two are macros.
+ * Both sizes are in bytes.
+ */
+# define AES_MAXNR 14
+# define AES_BLOCK_SIZE 16
+
+#ifdef __NetBSD__
+#include <sys/types.h>
+#endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* This should be a hidden type, but EVP requires that the size be known */
+struct aes_key_st {
+#ifndef __NetBSD__
+# ifdef AES_LONG
+    unsigned long rd_key[4 * (AES_MAXNR + 1)];
+# else
+    unsigned int rd_key[4 * (AES_MAXNR + 1)];
+# endif
+#else
+    uint32_t rd_key[4 *(AES_MAXNR + 1)];
+#endif
+    int rounds;
+};
+typedef struct aes_key_st AES_KEY;
+
+const char *AES_options(void);
+
+int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
+                        AES_KEY *key);
+int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
+                        AES_KEY *key);
+
+int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
+                                AES_KEY *key);
+int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits,
+                                AES_KEY *key);
+
+void AES_encrypt(const unsigned char *in, unsigned char *out,
+                 const AES_KEY *key);
+void AES_decrypt(const unsigned char *in, unsigned char *out,
+                 const AES_KEY *key);
+
+void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
+                     const AES_KEY *key, const int enc);
+void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                     size_t length, const AES_KEY *key,
+                     unsigned char *ivec, const int enc);
+void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
+                        size_t length, const AES_KEY *key,
+                        unsigned char *ivec, int *num, const int enc);
+void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
+                      size_t length, const AES_KEY *key,
+                      unsigned char *ivec, int *num, const int enc);
+void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
+                      size_t length, const AES_KEY *key,
+                      unsigned char *ivec, int *num, const int enc);
+void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
+                        size_t length, const AES_KEY *key,
+                        unsigned char *ivec, int *num);
+void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
+                        size_t length, const AES_KEY *key,
+                        unsigned char ivec[AES_BLOCK_SIZE],
+                        unsigned char ecount_buf[AES_BLOCK_SIZE],
+                        unsigned int *num);
+/* NB: the IV is _two_ blocks long */
+void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
+                     size_t length, const AES_KEY *key,
+                     unsigned char *ivec, const int enc);
+/* NB: the IV is _four_ blocks long */
+void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
+                        size_t length, const AES_KEY *key,
+                        const AES_KEY *key2, const unsigned char *ivec,
+                        const int enc);
+
+int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
+                 unsigned char *out,
+                 const unsigned char *in, unsigned int inlen);
+int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
+                   unsigned char *out,
+                   const unsigned char *in, unsigned int inlen);
+
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif                          /* !HEADER_AES_H */

Property changes on: lab4/.minix-src/include/openssl/aes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/bio.h
===================================================================
--- lab4/.minix-src/include/openssl/bio.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/bio.h	(revision 13)
@@ -0,0 +1,875 @@
+/* crypto/bio/bio.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_BIO_H
+# define HEADER_BIO_H
+
+# include <openssl/e_os2.h>
+
+# ifndef OPENSSL_NO_FP_API
+#  include <stdio.h>
+# endif
+# include <stdarg.h>
+
+# include <openssl/crypto.h>
+
+# ifndef OPENSSL_NO_SCTP
+#  ifndef OPENSSL_SYS_VMS
+#   include <stdint.h>
+#  else
+#   include <inttypes.h>
+#  endif
+# endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* These are the 'types' of BIOs */
+# define BIO_TYPE_NONE           0
+# define BIO_TYPE_MEM            (1|0x0400)
+# define BIO_TYPE_FILE           (2|0x0400)
+
+# define BIO_TYPE_FD             (4|0x0400|0x0100)
+# define BIO_TYPE_SOCKET         (5|0x0400|0x0100)
+# define BIO_TYPE_NULL           (6|0x0400)
+# define BIO_TYPE_SSL            (7|0x0200)
+# define BIO_TYPE_MD             (8|0x0200)/* passive filter */
+# define BIO_TYPE_BUFFER         (9|0x0200)/* filter */
+# define BIO_TYPE_CIPHER         (10|0x0200)/* filter */
+# define BIO_TYPE_BASE64         (11|0x0200)/* filter */
+# define BIO_TYPE_CONNECT        (12|0x0400|0x0100)/* socket - connect */
+# define BIO_TYPE_ACCEPT         (13|0x0400|0x0100)/* socket for accept */
+# define BIO_TYPE_PROXY_CLIENT   (14|0x0200)/* client proxy BIO */
+# define BIO_TYPE_PROXY_SERVER   (15|0x0200)/* server proxy BIO */
+# define BIO_TYPE_NBIO_TEST      (16|0x0200)/* server proxy BIO */
+# define BIO_TYPE_NULL_FILTER    (17|0x0200)
+# define BIO_TYPE_BER            (18|0x0200)/* BER -> bin filter */
+# define BIO_TYPE_BIO            (19|0x0400)/* (half a) BIO pair */
+# define BIO_TYPE_LINEBUFFER     (20|0x0200)/* filter */
+# define BIO_TYPE_DGRAM          (21|0x0400|0x0100)
+# ifndef OPENSSL_NO_SCTP
+#  define BIO_TYPE_DGRAM_SCTP     (24|0x0400|0x0100)
+# endif
+# define BIO_TYPE_ASN1           (22|0x0200)/* filter */
+# define BIO_TYPE_COMP           (23|0x0200)/* filter */
+
+# define BIO_TYPE_DESCRIPTOR     0x0100/* socket, fd, connect or accept */
+# define BIO_TYPE_FILTER         0x0200
+# define BIO_TYPE_SOURCE_SINK    0x0400
+
+/*
+ * BIO_FILENAME_READ|BIO_CLOSE to open or close on free.
+ * BIO_set_fp(in,stdin,BIO_NOCLOSE);
+ */
+# define BIO_NOCLOSE             0x00
+# define BIO_CLOSE               0x01
+
+/*
+ * These are used in the following macros and are passed to BIO_ctrl()
+ */
+# define BIO_CTRL_RESET          1/* opt - rewind/zero etc */
+# define BIO_CTRL_EOF            2/* opt - are we at the eof */
+# define BIO_CTRL_INFO           3/* opt - extra tit-bits */
+# define BIO_CTRL_SET            4/* man - set the 'IO' type */
+# define BIO_CTRL_GET            5/* man - get the 'IO' type */
+# define BIO_CTRL_PUSH           6/* opt - internal, used to signify change */
+# define BIO_CTRL_POP            7/* opt - internal, used to signify change */
+# define BIO_CTRL_GET_CLOSE      8/* man - set the 'close' on free */
+# define BIO_CTRL_SET_CLOSE      9/* man - set the 'close' on free */
+# define BIO_CTRL_PENDING        10/* opt - is their more data buffered */
+# define BIO_CTRL_FLUSH          11/* opt - 'flush' buffered output */
+# define BIO_CTRL_DUP            12/* man - extra stuff for 'duped' BIO */
+# define BIO_CTRL_WPENDING       13/* opt - number of bytes still to write */
+/* callback is int cb(BIO *bio,state,ret); */
+# define BIO_CTRL_SET_CALLBACK   14/* opt - set callback function */
+# define BIO_CTRL_GET_CALLBACK   15/* opt - set callback function */
+
+# define BIO_CTRL_SET_FILENAME   30/* BIO_s_file special */
+
+/* dgram BIO stuff */
+# define BIO_CTRL_DGRAM_CONNECT       31/* BIO dgram special */
+# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected
+                                         * socket to be passed in */
+# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */
+# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */
+# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */
+# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */
+
+# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */
+# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */
+
+/* #ifdef IP_MTU_DISCOVER */
+# define BIO_CTRL_DGRAM_MTU_DISCOVER       39/* set DF bit on egress packets */
+/* #endif */
+
+# define BIO_CTRL_DGRAM_QUERY_MTU          40/* as kernel for current MTU */
+# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU   47
+# define BIO_CTRL_DGRAM_GET_MTU            41/* get cached value for MTU */
+# define BIO_CTRL_DGRAM_SET_MTU            42/* set cached value for MTU.
+                                              * want to use this if asking
+                                              * the kernel fails */
+
+# define BIO_CTRL_DGRAM_MTU_EXCEEDED       43/* check whether the MTU was
+                                              * exceed in the previous write
+                                              * operation */
+
+# define BIO_CTRL_DGRAM_GET_PEER           46
+# define BIO_CTRL_DGRAM_SET_PEER           44/* Destination for the data */
+
+# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT   45/* Next DTLS handshake timeout
+                                              * to adjust socket timeouts */
+
+# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD   49
+
+# ifndef OPENSSL_NO_SCTP
+/* SCTP stuff */
+#  define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE    50
+#  define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY                51
+#  define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY               52
+#  define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD               53
+#  define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO         60
+#  define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO         61
+#  define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO         62
+#  define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO         63
+#  define BIO_CTRL_DGRAM_SCTP_GET_PRINFO                  64
+#  define BIO_CTRL_DGRAM_SCTP_SET_PRINFO                  65
+#  define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN               70
+# endif
+
+/* modifiers */
+# define BIO_FP_READ             0x02
+# define BIO_FP_WRITE            0x04
+# define BIO_FP_APPEND           0x08
+# define BIO_FP_TEXT             0x10
+
+# define BIO_FLAGS_READ          0x01
+# define BIO_FLAGS_WRITE         0x02
+# define BIO_FLAGS_IO_SPECIAL    0x04
+# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
+# define BIO_FLAGS_SHOULD_RETRY  0x08
+# ifndef BIO_FLAGS_UPLINK
+/*
+ * "UPLINK" flag denotes file descriptors provided by application. It
+ * defaults to 0, as most platforms don't require UPLINK interface.
+ */
+#  define BIO_FLAGS_UPLINK        0
+# endif
+
+/* Used in BIO_gethostbyname() */
+# define BIO_GHBN_CTRL_HITS              1
+# define BIO_GHBN_CTRL_MISSES            2
+# define BIO_GHBN_CTRL_CACHE_SIZE        3
+# define BIO_GHBN_CTRL_GET_ENTRY         4
+# define BIO_GHBN_CTRL_FLUSH             5
+
+/* Mostly used in the SSL BIO */
+/*-
+ * Not used anymore
+ * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10
+ * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20
+ * #define BIO_FLAGS_PROTOCOL_STARTUP   0x40
+ */
+
+# define BIO_FLAGS_BASE64_NO_NL  0x100
+
+/*
+ * This is used with memory BIOs: it means we shouldn't free up or change the
+ * data in any way.
+ */
+# define BIO_FLAGS_MEM_RDONLY    0x200
+
+typedef struct bio_st BIO;
+
+void BIO_set_flags(BIO *b, int flags);
+int BIO_test_flags(const BIO *b, int flags);
+void BIO_clear_flags(BIO *b, int flags);
+
+# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0))
+# define BIO_set_retry_special(b) \
+                BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))
+# define BIO_set_retry_read(b) \
+                BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
+# define BIO_set_retry_write(b) \
+                BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))
+
+/* These are normally used internally in BIOs */
+# define BIO_clear_retry_flags(b) \
+                BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
+# define BIO_get_retry_flags(b) \
+                BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
+
+/* These should be used by the application to tell why we should retry */
+# define BIO_should_read(a)              BIO_test_flags(a, BIO_FLAGS_READ)
+# define BIO_should_write(a)             BIO_test_flags(a, BIO_FLAGS_WRITE)
+# define BIO_should_io_special(a)        BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL)
+# define BIO_retry_type(a)               BIO_test_flags(a, BIO_FLAGS_RWS)
+# define BIO_should_retry(a)             BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY)
+
+/*
+ * The next three are used in conjunction with the BIO_should_io_special()
+ * condition.  After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int
+ * *reason); will walk the BIO stack and return the 'reason' for the special
+ * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return
+ * the code.
+ */
+/*
+ * Returned from the SSL bio when the certificate retrieval code had an error
+ */
+# define BIO_RR_SSL_X509_LOOKUP          0x01
+/* Returned from the connect BIO when a connect would have blocked */
+# define BIO_RR_CONNECT                  0x02
+/* Returned from the accept BIO when an accept would have blocked */
+# define BIO_RR_ACCEPT                   0x03
+
+/* These are passed by the BIO callback */
+# define BIO_CB_FREE     0x01
+# define BIO_CB_READ     0x02
+# define BIO_CB_WRITE    0x03
+# define BIO_CB_PUTS     0x04
+# define BIO_CB_GETS     0x05
+# define BIO_CB_CTRL     0x06
+
+/*
+ * The callback is called before and after the underling operation, The
+ * BIO_CB_RETURN flag indicates if it is after the call
+ */
+# define BIO_CB_RETURN   0x80
+# define BIO_CB_return(a) ((a)|BIO_CB_RETURN)
+# define BIO_cb_pre(a)   (!((a)&BIO_CB_RETURN))
+# define BIO_cb_post(a)  ((a)&BIO_CB_RETURN)
+
+long (*BIO_get_callback(const BIO *b)) (struct bio_st *, int, const char *,
+                                        int, long, long);
+void BIO_set_callback(BIO *b,
+                      long (*callback) (struct bio_st *, int, const char *,
+                                        int, long, long));
+char *BIO_get_callback_arg(const BIO *b);
+void BIO_set_callback_arg(BIO *b, char *arg);
+
+const char *BIO_method_name(const BIO *b);
+int BIO_method_type(const BIO *b);
+
+typedef void bio_info_cb (struct bio_st *, int, const char *, int, long,
+                          long);
+
+typedef struct bio_method_st {
+    int type;
+    const char *name;
+    int (*bwrite) (BIO *, const char *, int);
+    int (*bread) (BIO *, char *, int);
+    int (*bputs) (BIO *, const char *);
+    int (*bgets) (BIO *, char *, int);
+    long (*ctrl) (BIO *, int, long, void *);
+    int (*create) (BIO *);
+    int (*destroy) (BIO *);
+    long (*callback_ctrl) (BIO *, int, bio_info_cb *);
+} BIO_METHOD;
+
+struct bio_st {
+    BIO_METHOD *method;
+    /* bio, mode, argp, argi, argl, ret */
+    long (*callback) (struct bio_st *, int, const char *, int, long, long);
+    char *cb_arg;               /* first argument for the callback */
+    int init;
+    int shutdown;
+    int flags;                  /* extra storage */
+    int retry_reason;
+    int num;
+    void *ptr;
+    struct bio_st *next_bio;    /* used by filter BIOs */
+    struct bio_st *prev_bio;    /* used by filter BIOs */
+    int references;
+    unsigned long num_read;
+    unsigned long num_write;
+    CRYPTO_EX_DATA ex_data;
+};
+
+DECLARE_STACK_OF(BIO)
+
+typedef struct bio_f_buffer_ctx_struct {
+    /*-
+     * Buffers are setup like this:
+     *
+     * <---------------------- size ----------------------->
+     * +---------------------------------------------------+
+     * | consumed | remaining          | free space        |
+     * +---------------------------------------------------+
+     * <-- off --><------- len ------->
+     */
+    /*- BIO *bio; *//*
+     * this is now in the BIO struct
+     */
+    int ibuf_size;              /* how big is the input buffer */
+    int obuf_size;              /* how big is the output buffer */
+    char *ibuf;                 /* the char array */
+    int ibuf_len;               /* how many bytes are in it */
+    int ibuf_off;               /* write/read offset */
+    char *obuf;                 /* the char array */
+    int obuf_len;               /* how many bytes are in it */
+    int obuf_off;               /* write/read offset */
+} BIO_F_BUFFER_CTX;
+
+/* Prefix and suffix callback in ASN1 BIO */
+typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen,
+                          void *parg);
+
+# ifndef OPENSSL_NO_SCTP
+/* SCTP parameter structs */
+struct bio_dgram_sctp_sndinfo {
+    uint16_t snd_sid;
+    uint16_t snd_flags;
+    uint32_t snd_ppid;
+    uint32_t snd_context;
+};
+
+struct bio_dgram_sctp_rcvinfo {
+    uint16_t rcv_sid;
+    uint16_t rcv_ssn;
+    uint16_t rcv_flags;
+    uint32_t rcv_ppid;
+    uint32_t rcv_tsn;
+    uint32_t rcv_cumtsn;
+    uint32_t rcv_context;
+};
+
+struct bio_dgram_sctp_prinfo {
+    uint16_t pr_policy;
+    uint32_t pr_value;
+};
+# endif
+
+/* connect BIO stuff */
+# define BIO_CONN_S_BEFORE               1
+# define BIO_CONN_S_GET_IP               2
+# define BIO_CONN_S_GET_PORT             3
+# define BIO_CONN_S_CREATE_SOCKET        4
+# define BIO_CONN_S_CONNECT              5
+# define BIO_CONN_S_OK                   6
+# define BIO_CONN_S_BLOCKED_CONNECT      7
+# define BIO_CONN_S_NBIO                 8
+/*
+ * #define BIO_CONN_get_param_hostname BIO_ctrl
+ */
+
+# define BIO_C_SET_CONNECT                       100
+# define BIO_C_DO_STATE_MACHINE                  101
+# define BIO_C_SET_NBIO                          102
+# define BIO_C_SET_PROXY_PARAM                   103
+# define BIO_C_SET_FD                            104
+# define BIO_C_GET_FD                            105
+# define BIO_C_SET_FILE_PTR                      106
+# define BIO_C_GET_FILE_PTR                      107
+# define BIO_C_SET_FILENAME                      108
+# define BIO_C_SET_SSL                           109
+# define BIO_C_GET_SSL                           110
+# define BIO_C_SET_MD                            111
+# define BIO_C_GET_MD                            112
+# define BIO_C_GET_CIPHER_STATUS                 113
+# define BIO_C_SET_BUF_MEM                       114
+# define BIO_C_GET_BUF_MEM_PTR                   115
+# define BIO_C_GET_BUFF_NUM_LINES                116
+# define BIO_C_SET_BUFF_SIZE                     117
+# define BIO_C_SET_ACCEPT                        118
+# define BIO_C_SSL_MODE                          119
+# define BIO_C_GET_MD_CTX                        120
+# define BIO_C_GET_PROXY_PARAM                   121
+# define BIO_C_SET_BUFF_READ_DATA                122/* data to read first */
+# define BIO_C_GET_CONNECT                       123
+# define BIO_C_GET_ACCEPT                        124
+# define BIO_C_SET_SSL_RENEGOTIATE_BYTES         125
+# define BIO_C_GET_SSL_NUM_RENEGOTIATES          126
+# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT       127
+# define BIO_C_FILE_SEEK                         128
+# define BIO_C_GET_CIPHER_CTX                    129
+# define BIO_C_SET_BUF_MEM_EOF_RETURN            130/* return end of input
+                                                     * value */
+# define BIO_C_SET_BIND_MODE                     131
+# define BIO_C_GET_BIND_MODE                     132
+# define BIO_C_FILE_TELL                         133
+# define BIO_C_GET_SOCKS                         134
+# define BIO_C_SET_SOCKS                         135
+
+# define BIO_C_SET_WRITE_BUF_SIZE                136/* for BIO_s_bio */
+# define BIO_C_GET_WRITE_BUF_SIZE                137
+# define BIO_C_MAKE_BIO_PAIR                     138
+# define BIO_C_DESTROY_BIO_PAIR                  139
+# define BIO_C_GET_WRITE_GUARANTEE               140
+# define BIO_C_GET_READ_REQUEST                  141
+# define BIO_C_SHUTDOWN_WR                       142
+# define BIO_C_NREAD0                            143
+# define BIO_C_NREAD                             144
+# define BIO_C_NWRITE0                           145
+# define BIO_C_NWRITE                            146
+# define BIO_C_RESET_READ_REQUEST                147
+# define BIO_C_SET_MD_CTX                        148
+
+# define BIO_C_SET_PREFIX                        149
+# define BIO_C_GET_PREFIX                        150
+# define BIO_C_SET_SUFFIX                        151
+# define BIO_C_GET_SUFFIX                        152
+
+# define BIO_C_SET_EX_ARG                        153
+# define BIO_C_GET_EX_ARG                        154
+
+# define BIO_set_app_data(s,arg)         BIO_set_ex_data(s,0,arg)
+# define BIO_get_app_data(s)             BIO_get_ex_data(s,0)
+
+/* BIO_s_connect() and BIO_s_socks4a_connect() */
+# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name)
+# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port)
+# define BIO_set_conn_ip(b,ip)     BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip)
+# define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port)
+# define BIO_get_conn_hostname(b)  BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)
+# define BIO_get_conn_port(b)      BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)
+# define BIO_get_conn_ip(b)               BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)
+# define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0)
+
+# define BIO_set_nbio(b,n)       BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
+
+/* BIO_s_accept_socket() */
+# define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)
+# define BIO_get_accept_port(b)  BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)
+/* #define BIO_set_nbio(b,n)    BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
+# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?(void *)"a":NULL)
+# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio)
+
+# define BIO_BIND_NORMAL                 0
+# define BIO_BIND_REUSEADDR_IF_UNUSED    1
+# define BIO_BIND_REUSEADDR              2
+# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
+# define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
+
+# define BIO_do_connect(b)       BIO_do_handshake(b)
+# define BIO_do_accept(b)        BIO_do_handshake(b)
+# define BIO_do_handshake(b)     BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
+
+/* BIO_s_proxy_client() */
+# define BIO_set_url(b,url)      BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url))
+# define BIO_set_proxies(b,p)    BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p))
+/* BIO_set_nbio(b,n) */
+# define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s))
+/* BIO *BIO_get_filter_bio(BIO *bio); */
+# define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)()))
+# define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk)
+# define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool)
+
+# define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp)
+# define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p))
+# define BIO_get_url(b,url)      BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))
+# define BIO_get_no_connect_return(b)    BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)
+
+# define BIO_set_fd(b,fd,c)      BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
+# define BIO_get_fd(b,c)         BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)
+
+# define BIO_set_fp(b,fp,c)      BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)
+# define BIO_get_fp(b,fpp)       BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)
+
+# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
+# define BIO_tell(b)     (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
+
+/*
+ * name is cast to lose const, but might be better to route through a
+ * function so we can do it safely
+ */
+# ifdef CONST_STRICT
+/*
+ * If you are wondering why this isn't defined, its because CONST_STRICT is
+ * purely a compile-time kludge to allow const to be checked.
+ */
+int BIO_read_filename(BIO *b, const char *name);
+# else
+#  define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
+                BIO_CLOSE|BIO_FP_READ,(char *)name)
+# endif
+# define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
+                BIO_CLOSE|BIO_FP_WRITE,name)
+# define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
+                BIO_CLOSE|BIO_FP_APPEND,name)
+# define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
+                BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name)
+
+/*
+ * WARNING WARNING, this ups the reference count on the read bio of the SSL
+ * structure.  This is because the ssl read BIO is now pointed to by the
+ * next_bio field in the bio.  So when you free the BIO, make sure you are
+ * doing a BIO_free_all() to catch the underlying BIO.
+ */
+# define BIO_set_ssl(b,ssl,c)    BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl)
+# define BIO_get_ssl(b,sslp)     BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp)
+# define BIO_set_ssl_mode(b,client)      BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)
+# define BIO_set_ssl_renegotiate_bytes(b,num) \
+        BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL);
+# define BIO_get_num_renegotiates(b) \
+        BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL);
+# define BIO_set_ssl_renegotiate_timeout(b,seconds) \
+        BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL);
+
+/* defined in evp.h */
+/* #define BIO_set_md(b,md)     BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */
+
+# define BIO_get_mem_data(b,pp)  BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)
+# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm)
+# define BIO_get_mem_ptr(b,pp)   BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp)
+# define BIO_set_mem_eof_return(b,v) \
+                                BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL)
+
+/* For the BIO_f_buffer() type */
+# define BIO_get_buffer_num_lines(b)     BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
+# define BIO_set_buffer_size(b,size)     BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
+# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)
+# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)
+# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)
+
+/* Don't use the next one unless you know what you are doing :-) */
+# define BIO_dup_state(b,ret)    BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret))
+
+# define BIO_reset(b)            (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)
+# define BIO_eof(b)              (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)
+# define BIO_set_close(b,c)      (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)
+# define BIO_get_close(b)        (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL)
+# define BIO_pending(b)          (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
+# define BIO_wpending(b)         (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)
+/* ...pending macros have inappropriate return type */
+size_t BIO_ctrl_pending(BIO *b);
+size_t BIO_ctrl_wpending(BIO *b);
+# define BIO_flush(b)            (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
+# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \
+                                                   cbp)
+# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb)
+
+/* For the BIO_f_buffer() type */
+# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)
+
+/* For BIO_s_bio() */
+# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL)
+# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL)
+# define BIO_make_bio_pair(b1,b2)   (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2)
+# define BIO_destroy_bio_pair(b)    (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL)
+# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL)
+/* macros with inappropriate type -- but ...pending macros use int too: */
+# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL)
+# define BIO_get_read_request(b)    (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL)
+size_t BIO_ctrl_get_write_guarantee(BIO *b);
+size_t BIO_ctrl_get_read_request(BIO *b);
+int BIO_ctrl_reset_read_request(BIO *b);
+
+/* ctrl macros for dgram */
+# define BIO_ctrl_dgram_connect(b,peer)  \
+                     (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer)
+# define BIO_ctrl_set_connected(b, state, peer) \
+         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer)
+# define BIO_dgram_recv_timedout(b) \
+         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL)
+# define BIO_dgram_send_timedout(b) \
+         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL)
+# define BIO_dgram_get_peer(b,peer) \
+         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)peer)
+# define BIO_dgram_set_peer(b,peer) \
+         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer)
+# define BIO_dgram_get_mtu_overhead(b) \
+         (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL)
+
+/* These two aren't currently implemented */
+/* int BIO_get_ex_num(BIO *bio); */
+/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */
+int BIO_set_ex_data(BIO *bio, int idx, void *data);
+void *BIO_get_ex_data(BIO *bio, int idx);
+int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+unsigned long BIO_number_read(BIO *bio);
+unsigned long BIO_number_written(BIO *bio);
+
+/* For BIO_f_asn1() */
+int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,
+                        asn1_ps_func *prefix_free);
+int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix,
+                        asn1_ps_func **pprefix_free);
+int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
+                        asn1_ps_func *suffix_free);
+int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
+                        asn1_ps_func **psuffix_free);
+
+# ifndef OPENSSL_NO_FP_API
+BIO_METHOD *BIO_s_file(void);
+BIO *BIO_new_file(const char *filename, const char *mode);
+BIO *BIO_new_fp(FILE *stream, int close_flag);
+#  define BIO_s_file_internal    BIO_s_file
+# endif
+BIO *BIO_new(BIO_METHOD *type);
+int BIO_set(BIO *a, BIO_METHOD *type);
+int BIO_free(BIO *a);
+void BIO_vfree(BIO *a);
+int BIO_read(BIO *b, void *data, int len);
+int BIO_gets(BIO *bp, char *buf, int size);
+int BIO_write(BIO *b, const void *data, int len);
+int BIO_puts(BIO *bp, const char *buf);
+int BIO_indent(BIO *b, int indent, int max);
+long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);
+long BIO_callback_ctrl(BIO *b, int cmd,
+                       void (*fp) (struct bio_st *, int, const char *, int,
+                                   long, long));
+char *BIO_ptr_ctrl(BIO *bp, int cmd, long larg);
+long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg);
+BIO *BIO_push(BIO *b, BIO *append);
+BIO *BIO_pop(BIO *b);
+void BIO_free_all(BIO *a);
+BIO *BIO_find_type(BIO *b, int bio_type);
+BIO *BIO_next(BIO *b);
+BIO *BIO_get_retry_BIO(BIO *bio, int *reason);
+int BIO_get_retry_reason(BIO *bio);
+BIO *BIO_dup_chain(BIO *in);
+
+int BIO_nread0(BIO *bio, char **buf);
+int BIO_nread(BIO *bio, char **buf, int num);
+int BIO_nwrite0(BIO *bio, char **buf);
+int BIO_nwrite(BIO *bio, char **buf, int num);
+
+long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi,
+                        long argl, long ret);
+
+BIO_METHOD *BIO_s_mem(void);
+BIO *BIO_new_mem_buf(void *buf, int len);
+BIO_METHOD *BIO_s_socket(void);
+BIO_METHOD *BIO_s_connect(void);
+BIO_METHOD *BIO_s_accept(void);
+BIO_METHOD *BIO_s_fd(void);
+# ifndef OPENSSL_SYS_OS2
+BIO_METHOD *BIO_s_log(void);
+# endif
+BIO_METHOD *BIO_s_bio(void);
+BIO_METHOD *BIO_s_null(void);
+BIO_METHOD *BIO_f_null(void);
+BIO_METHOD *BIO_f_buffer(void);
+# ifdef OPENSSL_SYS_VMS
+BIO_METHOD *BIO_f_linebuffer(void);
+# endif
+BIO_METHOD *BIO_f_nbio_test(void);
+# ifndef OPENSSL_NO_DGRAM
+BIO_METHOD *BIO_s_datagram(void);
+#  ifndef OPENSSL_NO_SCTP
+BIO_METHOD *BIO_s_datagram_sctp(void);
+#  endif
+# endif
+
+/* BIO_METHOD *BIO_f_ber(void); */
+
+int BIO_sock_should_retry(int i);
+int BIO_sock_non_fatal_error(int error);
+int BIO_dgram_non_fatal_error(int error);
+
+int BIO_fd_should_retry(int i);
+int BIO_fd_non_fatal_error(int error);
+int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u),
+                void *u, const char *s, int len);
+int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),
+                       void *u, const char *s, int len, int indent);
+int BIO_dump(BIO *b, const char *bytes, int len);
+int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent);
+# ifndef OPENSSL_NO_FP_API
+int BIO_dump_fp(FILE *fp, const char *s, int len);
+int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);
+# endif
+struct hostent *BIO_gethostbyname(const char *name);
+/*-
+ * We might want a thread-safe interface too:
+ * struct hostent *BIO_gethostbyname_r(const char *name,
+ *     struct hostent *result, void *buffer, size_t buflen);
+ * or something similar (caller allocates a struct hostent,
+ * pointed to by "result", and additional buffer space for the various
+ * substructures; if the buffer does not suffice, NULL is returned
+ * and an appropriate error code is set).
+ */
+int BIO_sock_error(int sock);
+int BIO_socket_ioctl(int fd, long type, void *arg);
+int BIO_socket_nbio(int fd, int mode);
+int BIO_get_port(const char *str, unsigned short *port_ptr);
+int BIO_get_host_ip(const char *str, unsigned char *ip);
+int BIO_get_accept_socket(char *host_port, int mode);
+int BIO_accept(int sock, char **ip_port);
+int BIO_sock_init(void);
+void BIO_sock_cleanup(void);
+int BIO_set_tcp_ndelay(int sock, int turn_on);
+
+BIO *BIO_new_socket(int sock, int close_flag);
+BIO *BIO_new_dgram(int fd, int close_flag);
+# ifndef OPENSSL_NO_SCTP
+BIO *BIO_new_dgram_sctp(int fd, int close_flag);
+int BIO_dgram_is_sctp(BIO *bio);
+int BIO_dgram_sctp_notification_cb(BIO *b,
+                                   void (*handle_notifications) (BIO *bio,
+                                                                 void
+                                                                 *context,
+                                                                 void *buf),
+                                   void *context);
+int BIO_dgram_sctp_wait_for_dry(BIO *b);
+int BIO_dgram_sctp_msg_waiting(BIO *b);
+# endif
+BIO *BIO_new_fd(int fd, int close_flag);
+BIO *BIO_new_connect(char *host_port);
+BIO *BIO_new_accept(char *host_port);
+
+int BIO_new_bio_pair(BIO **bio1, size_t writebuf1,
+                     BIO **bio2, size_t writebuf2);
+/*
+ * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints.
+ * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default
+ * value.
+ */
+
+void BIO_copy_next_retry(BIO *b);
+
+/*
+ * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);
+ */
+
+# ifdef __GNUC__
+#  define __bio_h__attr__ __attribute__
+# else
+#  define __bio_h__attr__(x)
+# endif
+int BIO_printf(BIO *bio, const char *format, ...)
+__bio_h__attr__((__format__(__printf__, 2, 3)));
+int BIO_vprintf(BIO *bio, const char *format, va_list args)
+__bio_h__attr__((__format__(__printf__, 2, 0)));
+int BIO_snprintf(char *buf, size_t n, const char *format, ...)
+__bio_h__attr__((__format__(__printf__, 3, 4)));
+int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
+__bio_h__attr__((__format__(__printf__, 3, 0)));
+# undef __bio_h__attr__
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_BIO_strings(void);
+
+/* Error codes for the BIO functions. */
+
+/* Function codes. */
+# define BIO_F_ACPT_STATE                                 100
+# define BIO_F_BIO_ACCEPT                                 101
+# define BIO_F_BIO_BER_GET_HEADER                         102
+# define BIO_F_BIO_CALLBACK_CTRL                          131
+# define BIO_F_BIO_CTRL                                   103
+# define BIO_F_BIO_GETHOSTBYNAME                          120
+# define BIO_F_BIO_GETS                                   104
+# define BIO_F_BIO_GET_ACCEPT_SOCKET                      105
+# define BIO_F_BIO_GET_HOST_IP                            106
+# define BIO_F_BIO_GET_PORT                               107
+# define BIO_F_BIO_MAKE_PAIR                              121
+# define BIO_F_BIO_NEW                                    108
+# define BIO_F_BIO_NEW_FILE                               109
+# define BIO_F_BIO_NEW_MEM_BUF                            126
+# define BIO_F_BIO_NREAD                                  123
+# define BIO_F_BIO_NREAD0                                 124
+# define BIO_F_BIO_NWRITE                                 125
+# define BIO_F_BIO_NWRITE0                                122
+# define BIO_F_BIO_PUTS                                   110
+# define BIO_F_BIO_READ                                   111
+# define BIO_F_BIO_SOCK_INIT                              112
+# define BIO_F_BIO_WRITE                                  113
+# define BIO_F_BUFFER_CTRL                                114
+# define BIO_F_CONN_CTRL                                  127
+# define BIO_F_CONN_STATE                                 115
+# define BIO_F_DGRAM_SCTP_READ                            132
+# define BIO_F_DGRAM_SCTP_WRITE                           133
+# define BIO_F_FILE_CTRL                                  116
+# define BIO_F_FILE_READ                                  130
+# define BIO_F_LINEBUFFER_CTRL                            129
+# define BIO_F_MEM_READ                                   128
+# define BIO_F_MEM_WRITE                                  117
+# define BIO_F_SSL_NEW                                    118
+# define BIO_F_WSASTARTUP                                 119
+
+/* Reason codes. */
+# define BIO_R_ACCEPT_ERROR                               100
+# define BIO_R_BAD_FOPEN_MODE                             101
+# define BIO_R_BAD_HOSTNAME_LOOKUP                        102
+# define BIO_R_BROKEN_PIPE                                124
+# define BIO_R_CONNECT_ERROR                              103
+# define BIO_R_EOF_ON_MEMORY_BIO                          127
+# define BIO_R_ERROR_SETTING_NBIO                         104
+# define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET      105
+# define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET        106
+# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET          107
+# define BIO_R_INVALID_ARGUMENT                           125
+# define BIO_R_INVALID_IP_ADDRESS                         108
+# define BIO_R_IN_USE                                     123
+# define BIO_R_KEEPALIVE                                  109
+# define BIO_R_NBIO_CONNECT_ERROR                         110
+# define BIO_R_NO_ACCEPT_PORT_SPECIFIED                   111
+# define BIO_R_NO_HOSTNAME_SPECIFIED                      112
+# define BIO_R_NO_PORT_DEFINED                            113
+# define BIO_R_NO_PORT_SPECIFIED                          114
+# define BIO_R_NO_SUCH_FILE                               128
+# define BIO_R_NULL_PARAMETER                             115
+# define BIO_R_TAG_MISMATCH                               116
+# define BIO_R_UNABLE_TO_BIND_SOCKET                      117
+# define BIO_R_UNABLE_TO_CREATE_SOCKET                    118
+# define BIO_R_UNABLE_TO_LISTEN_SOCKET                    119
+# define BIO_R_UNINITIALIZED                              120
+# define BIO_R_UNSUPPORTED_METHOD                         121
+# define BIO_R_WRITE_TO_READ_ONLY_BIO                     126
+# define BIO_R_WSASTARTUP                                 122
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/bio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/camellia.h
===================================================================
--- lab4/.minix-src/include/openssl/camellia.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/camellia.h	(revision 13)
@@ -0,0 +1,132 @@
+/* crypto/camellia/camellia.h -*- mode:C; c-file-style: "eay" -*- */
+/* ====================================================================
+ * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ */
+
+#ifndef HEADER_CAMELLIA_H
+# define HEADER_CAMELLIA_H
+
+# include <openssl/opensslconf.h>
+
+# ifdef OPENSSL_NO_CAMELLIA
+#  error CAMELLIA is disabled.
+# endif
+
+# include <stddef.h>
+
+# define CAMELLIA_ENCRYPT        1
+# define CAMELLIA_DECRYPT        0
+
+/*
+ * Because array size can't be a const in C, the following two are macros.
+ * Both sizes are in bytes.
+ */
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* This should be a hidden type, but EVP requires that the size be known */
+
+# define CAMELLIA_BLOCK_SIZE 16
+# define CAMELLIA_TABLE_BYTE_LEN 272
+# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
+
+typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
+                                                               * with WORD */
+
+struct camellia_key_st {
+    union {
+        double d;               /* ensures 64-bit align */
+        KEY_TABLE_TYPE rd_key;
+    } u;
+    int grand_rounds;
+};
+typedef struct camellia_key_st CAMELLIA_KEY;
+
+# ifdef OPENSSL_FIPS
+int private_Camellia_set_key(const unsigned char *userKey, const int bits,
+                             CAMELLIA_KEY *key);
+# endif
+int Camellia_set_key(const unsigned char *userKey, const int bits,
+                     CAMELLIA_KEY *key);
+
+void Camellia_encrypt(const unsigned char *in, unsigned char *out,
+                      const CAMELLIA_KEY *key);
+void Camellia_decrypt(const unsigned char *in, unsigned char *out,
+                      const CAMELLIA_KEY *key);
+
+void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out,
+                          const CAMELLIA_KEY *key, const int enc);
+void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                          size_t length, const CAMELLIA_KEY *key,
+                          unsigned char *ivec, const int enc);
+void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
+                             size_t length, const CAMELLIA_KEY *key,
+                             unsigned char *ivec, int *num, const int enc);
+void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t length, const CAMELLIA_KEY *key,
+                           unsigned char *ivec, int *num, const int enc);
+void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,
+                           size_t length, const CAMELLIA_KEY *key,
+                           unsigned char *ivec, int *num, const int enc);
+void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out,
+                             size_t length, const CAMELLIA_KEY *key,
+                             unsigned char *ivec, int *num);
+void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
+                             size_t length, const CAMELLIA_KEY *key,
+                             unsigned char ivec[CAMELLIA_BLOCK_SIZE],
+                             unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
+                             unsigned int *num);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif                          /* !HEADER_Camellia_H */

Property changes on: lab4/.minix-src/include/openssl/camellia.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/comp.h
===================================================================
--- lab4/.minix-src/include/openssl/comp.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/comp.h	(revision 13)
@@ -0,0 +1,79 @@
+
+#ifndef HEADER_COMP_H
+# define HEADER_COMP_H
+
+# include <openssl/crypto.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct comp_ctx_st COMP_CTX;
+
+typedef struct comp_method_st {
+    int type;                   /* NID for compression library */
+    const char *name;           /* A text string to identify the library */
+    int (*init) (COMP_CTX *ctx);
+    void (*finish) (COMP_CTX *ctx);
+    int (*compress) (COMP_CTX *ctx,
+                     unsigned char *out, unsigned int olen,
+                     unsigned char *in, unsigned int ilen);
+    int (*expand) (COMP_CTX *ctx,
+                   unsigned char *out, unsigned int olen,
+                   unsigned char *in, unsigned int ilen);
+    /*
+     * The following two do NOTHING, but are kept for backward compatibility
+     */
+    long (*ctrl) (void);
+    long (*callback_ctrl) (void);
+} COMP_METHOD;
+
+struct comp_ctx_st {
+    COMP_METHOD *meth;
+    unsigned long compress_in;
+    unsigned long compress_out;
+    unsigned long expand_in;
+    unsigned long expand_out;
+    CRYPTO_EX_DATA ex_data;
+};
+
+COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
+void COMP_CTX_free(COMP_CTX *ctx);
+int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
+                        unsigned char *in, int ilen);
+int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
+                      unsigned char *in, int ilen);
+COMP_METHOD *COMP_rle(void);
+COMP_METHOD *COMP_zlib(void);
+void COMP_zlib_cleanup(void);
+
+# ifdef HEADER_BIO_H
+#  ifdef ZLIB
+BIO_METHOD *BIO_f_zlib(void);
+#  endif
+# endif
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_COMP_strings(void);
+
+/* Error codes for the COMP functions. */
+
+/* Function codes. */
+# define COMP_F_BIO_ZLIB_FLUSH                            99
+# define COMP_F_BIO_ZLIB_NEW                              100
+# define COMP_F_BIO_ZLIB_READ                             101
+# define COMP_F_BIO_ZLIB_WRITE                            102
+
+/* Reason codes. */
+# define COMP_R_ZLIB_DEFLATE_ERROR                        99
+# define COMP_R_ZLIB_INFLATE_ERROR                        100
+# define COMP_R_ZLIB_NOT_SUPPORTED                        101
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/comp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/des.h
===================================================================
--- lab4/.minix-src/include/openssl/des.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/des.h	(revision 13)
@@ -0,0 +1,265 @@
+/* crypto/des/des.h */
+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_NEW_DES_H
+# define HEADER_NEW_DES_H
+
+# include <openssl/e_os2.h>     /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG
+                                 * (via openssl/opensslconf.h */
+
+#include <sys/types.h>
+# ifdef OPENSSL_NO_DES
+#  error DES is disabled.
+# endif
+
+# ifdef OPENSSL_BUILD_SHLIBCRYPTO
+#  undef OPENSSL_EXTERN
+#  define OPENSSL_EXTERN OPENSSL_EXPORT
+# endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef unsigned char DES_cblock[8];
+typedef /* const */ unsigned char const_DES_cblock[8];
+/*
+ * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and
+ * const_DES_cblock * are incompatible pointer types.
+ */
+
+typedef struct DES_ks {
+    union {
+        DES_cblock cblock;
+        /*
+         * make sure things are correct size on machines with 8 byte longs
+         */
+        DES_LONG deslong[2];
+    } ks[16];
+} DES_key_schedule;
+
+#if !defined(__NetBSD__) && !defined(__minix)
+# ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT
+#  ifndef OPENSSL_ENABLE_OLD_DES_SUPPORT
+#   define OPENSSL_ENABLE_OLD_DES_SUPPORT
+#  endif
+# endif
+
+# ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT
+#  include <openssl/des_old.h>
+# endif
+
+# define DES_KEY_SZ      (sizeof(DES_cblock))
+# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule))
+#else
+# include <sys/types.h>
+# define DES_KEY_SZ    8 /* (sizeof(DES_cblock)) */
+# define DES_SCHEDULE_SZ 128 /* (sizeof(DES_key_schedule)) */
+# define OPENSSL_DISABLE_OLD_DES_SUPPORT
+#endif
+
+# define DES_ENCRYPT     1
+# define DES_DECRYPT     0
+
+# define DES_CBC_MODE    0
+# define DES_PCBC_MODE   1
+
+# define DES_ecb2_encrypt(i,o,k1,k2,e) \
+        DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
+
+# define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
+        DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
+
+# define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
+        DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
+
+# define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
+        DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
+
+OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */
+# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key)
+OPENSSL_DECLARE_GLOBAL(int, DES_rw_mode); /* defaults to DES_PCBC_MODE */
+# define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode)
+
+const char *DES_options(void);
+void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
+                      DES_key_schedule *ks1, DES_key_schedule *ks2,
+                      DES_key_schedule *ks3, int enc);
+DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output,
+                       long length, DES_key_schedule *schedule,
+                       const_DES_cblock *ivec);
+/* DES_cbc_encrypt does not update the IV!  Use DES_ncbc_encrypt instead. */
+void DES_cbc_encrypt(const unsigned char *input, unsigned char *output,
+                     long length, DES_key_schedule *schedule,
+                     DES_cblock *ivec, int enc);
+void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output,
+                      long length, DES_key_schedule *schedule,
+                      DES_cblock *ivec, int enc);
+void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output,
+                      long length, DES_key_schedule *schedule,
+                      DES_cblock *ivec, const_DES_cblock *inw,
+                      const_DES_cblock *outw, int enc);
+void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
+                     long length, DES_key_schedule *schedule,
+                     DES_cblock *ivec, int enc);
+void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
+                     DES_key_schedule *ks, int enc);
+
+/*
+ * This is the DES encryption function that gets called by just about every
+ * other DES routine in the library.  You should not use this function except
+ * to implement 'modes' of DES.  I say this because the functions that call
+ * this routine do the conversion from 'char *' to long, and this needs to be
+ * done to make sure 'non-aligned' memory access do not occur.  The
+ * characters are loaded 'little endian'. Data is a pointer to 2 unsigned
+ * long's and ks is the DES_key_schedule to use.  enc, is non zero specifies
+ * encryption, zero if decryption.
+ */
+void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc);
+
+/*
+ * This functions is the same as DES_encrypt1() except that the DES initial
+ * permutation (IP) and final permutation (FP) have been left out.  As for
+ * DES_encrypt1(), you should not use this function. It is used by the
+ * routines in the library that implement triple DES. IP() DES_encrypt2()
+ * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1()
+ * DES_encrypt1() DES_encrypt1() except faster :-).
+ */
+void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc);
+
+void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1,
+                  DES_key_schedule *ks2, DES_key_schedule *ks3);
+void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1,
+                  DES_key_schedule *ks2, DES_key_schedule *ks3);
+void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,
+                          long length,
+                          DES_key_schedule *ks1, DES_key_schedule *ks2,
+                          DES_key_schedule *ks3, DES_cblock *ivec, int enc);
+void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out,
+                           long length,
+                           DES_key_schedule *ks1, DES_key_schedule *ks2,
+                           DES_key_schedule *ks3,
+                           DES_cblock *ivec1, DES_cblock *ivec2, int enc);
+void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
+                            long length, DES_key_schedule *ks1,
+                            DES_key_schedule *ks2, DES_key_schedule *ks3,
+                            DES_cblock *ivec, int *num, int enc);
+void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out,
+                          int numbits, long length, DES_key_schedule *ks1,
+                          DES_key_schedule *ks2, DES_key_schedule *ks3,
+                          DES_cblock *ivec, int enc);
+void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,
+                            long length, DES_key_schedule *ks1,
+                            DES_key_schedule *ks2, DES_key_schedule *ks3,
+                            DES_cblock *ivec, int *num);
+# if 0
+void DES_xwhite_in2out(const_DES_cblock *DES_key, const_DES_cblock *in_white,
+                       DES_cblock *out_white);
+# endif
+
+int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched,
+                 DES_cblock *iv);
+int DES_enc_write(int fd, const void *buf, int len, DES_key_schedule *sched,
+                  DES_cblock *iv);
+char *DES_fcrypt(const char *buf, const char *salt, char *ret);
+char *DES_crypt(const char *buf, const char *salt);
+void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
+                     long length, DES_key_schedule *schedule,
+                     DES_cblock *ivec);
+void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,
+                      long length, DES_key_schedule *schedule,
+                      DES_cblock *ivec, int enc);
+DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[],
+                        long length, int out_count, DES_cblock *seed);
+int DES_random_key(DES_cblock *ret);
+void DES_set_odd_parity(DES_cblock *key);
+int DES_check_key_parity(const_DES_cblock *key);
+int DES_is_weak_key(const_DES_cblock *key);
+/*
+ * DES_set_key (= set_key = DES_key_sched = key_sched) calls
+ * DES_set_key_checked if global variable DES_check_key is set,
+ * DES_set_key_unchecked otherwise.
+ */
+int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
+int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
+int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule);
+void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule);
+# ifdef OPENSSL_FIPS
+void private_DES_set_key_unchecked(const_DES_cblock *key,
+                                   DES_key_schedule *schedule);
+# endif
+void DES_string_to_key(const char *str, DES_cblock *key);
+void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2);
+void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,
+                       long length, DES_key_schedule *schedule,
+                       DES_cblock *ivec, int *num, int enc);
+void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out,
+                       long length, DES_key_schedule *schedule,
+                       DES_cblock *ivec, int *num);
+
+int DES_read_password(DES_cblock *key, const char *prompt, int verify);
+int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2,
+                        const char *prompt, int verify);
+
+# define DES_fixup_key_parity DES_set_odd_parity
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/des.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/dtls1.h
===================================================================
--- lab4/.minix-src/include/openssl/dtls1.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/dtls1.h	(revision 13)
@@ -0,0 +1,268 @@
+/* ssl/dtls1.h */
+/*
+ * DTLS implementation written by Nagendra Modadugu
+ * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
+ */
+/* ====================================================================
+ * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_DTLS1_H
+# define HEADER_DTLS1_H
+
+# include <openssl/buffer.h>
+# include <openssl/pqueue.h>
+# ifdef OPENSSL_SYS_VMS
+#  include <resource.h>
+#  include <sys/timeb.h>
+# endif
+# ifdef OPENSSL_SYS_WIN32
+/* Needed for struct timeval */
+#  include <winsock.h>
+# elif defined(OPENSSL_SYS_NETWARE) && !defined(_WINSOCK2API_)
+#  include <sys/timeval.h>
+# else
+#  if defined(OPENSSL_SYS_VXWORKS)
+#   include <sys/times.h>
+#  else
+#   include <sys/time.h>
+#  endif
+# endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# define DTLS1_VERSION                   0xFEFF
+# define DTLS_MAX_VERSION                DTLS1_VERSION
+# define DTLS1_VERSION_MAJOR             0xFE
+
+# define DTLS1_BAD_VER                   0x0100
+
+# if 0
+/* this alert description is not specified anywhere... */
+#  define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE    110
+# endif
+
+/* lengths of messages */
+# define DTLS1_COOKIE_LENGTH                     256
+
+# define DTLS1_RT_HEADER_LENGTH                  13
+
+# define DTLS1_HM_HEADER_LENGTH                  12
+
+# define DTLS1_HM_BAD_FRAGMENT                   -2
+# define DTLS1_HM_FRAGMENT_RETRY                 -3
+
+# define DTLS1_CCS_HEADER_LENGTH                  1
+
+# ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
+#  define DTLS1_AL_HEADER_LENGTH                   7
+# else
+#  define DTLS1_AL_HEADER_LENGTH                   2
+# endif
+
+# ifndef OPENSSL_NO_SSL_INTERN
+
+#  ifndef OPENSSL_NO_SCTP
+#   define DTLS1_SCTP_AUTH_LABEL   "EXPORTER_DTLS_OVER_SCTP"
+#  endif
+
+/* Max MTU overhead we know about so far is 40 for IPv6 + 8 for UDP */
+#  define DTLS1_MAX_MTU_OVERHEAD                   48
+
+typedef struct dtls1_bitmap_st {
+    unsigned long map;          /* track 32 packets on 32-bit systems and 64
+                                 * - on 64-bit systems */
+    unsigned char max_seq_num[8]; /* max record number seen so far, 64-bit
+                                   * value in big-endian encoding */
+} DTLS1_BITMAP;
+
+struct dtls1_retransmit_state {
+    EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
+    EVP_MD_CTX *write_hash;     /* used for mac generation */
+#  ifndef OPENSSL_NO_COMP
+    COMP_CTX *compress;         /* compression */
+#  else
+    char *compress;
+#  endif
+    SSL_SESSION *session;
+    unsigned short epoch;
+};
+
+struct hm_header_st {
+    unsigned char type;
+    unsigned long msg_len;
+    unsigned short seq;
+    unsigned long frag_off;
+    unsigned long frag_len;
+    unsigned int is_ccs;
+    struct dtls1_retransmit_state saved_retransmit_state;
+};
+
+struct ccs_header_st {
+    unsigned char type;
+    unsigned short seq;
+};
+
+struct dtls1_timeout_st {
+    /* Number of read timeouts so far */
+    unsigned int read_timeouts;
+    /* Number of write timeouts so far */
+    unsigned int write_timeouts;
+    /* Number of alerts received so far */
+    unsigned int num_alerts;
+};
+
+typedef struct record_pqueue_st {
+    unsigned short epoch;
+    pqueue q;
+} record_pqueue;
+
+typedef struct hm_fragment_st {
+    struct hm_header_st msg_header;
+    unsigned char *fragment;
+    unsigned char *reassembly;
+} hm_fragment;
+
+typedef struct dtls1_state_st {
+    unsigned int send_cookie;
+    unsigned char cookie[DTLS1_COOKIE_LENGTH];
+    unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];
+    unsigned int cookie_len;
+    /*
+     * The current data and handshake epoch.  This is initially
+     * undefined, and starts at zero once the initial handshake is
+     * completed
+     */
+    unsigned short r_epoch;
+    unsigned short w_epoch;
+    /* records being received in the current epoch */
+    DTLS1_BITMAP bitmap;
+    /* renegotiation starts a new set of sequence numbers */
+    DTLS1_BITMAP next_bitmap;
+    /* handshake message numbers */
+    unsigned short handshake_write_seq;
+    unsigned short next_handshake_write_seq;
+    unsigned short handshake_read_seq;
+    /* save last sequence number for retransmissions */
+    unsigned char last_write_sequence[8];
+    /* Received handshake records (processed and unprocessed) */
+    record_pqueue unprocessed_rcds;
+    record_pqueue processed_rcds;
+    /* Buffered handshake messages */
+    pqueue buffered_messages;
+    /* Buffered (sent) handshake records */
+    pqueue sent_messages;
+    /*
+     * Buffered application records. Only for records between CCS and
+     * Finished to prevent either protocol violation or unnecessary message
+     * loss.
+     */
+    record_pqueue buffered_app_data;
+    /* Is set when listening for new connections with dtls1_listen() */
+    unsigned int listen;
+    unsigned int link_mtu;      /* max on-the-wire DTLS packet size */
+    unsigned int mtu;           /* max DTLS packet size */
+    struct hm_header_st w_msg_hdr;
+    struct hm_header_st r_msg_hdr;
+    struct dtls1_timeout_st timeout;
+    /*
+     * Indicates when the last handshake msg or heartbeat sent will timeout
+     */
+    struct timeval next_timeout;
+    /* Timeout duration */
+    unsigned short timeout_duration;
+    /*
+     * storage for Alert/Handshake protocol data received but not yet
+     * processed by ssl3_read_bytes:
+     */
+    unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH];
+    unsigned int alert_fragment_len;
+    unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];
+    unsigned int handshake_fragment_len;
+    unsigned int retransmitting;
+    /*
+     * Set when the handshake is ready to process peer's ChangeCipherSpec message.
+     * Cleared after the message has been processed.
+     */
+    unsigned int change_cipher_spec_ok;
+#  ifndef OPENSSL_NO_SCTP
+    /* used when SSL_ST_XX_FLUSH is entered */
+    int next_state;
+    int shutdown_received;
+#  endif
+} DTLS1_STATE;
+
+typedef struct dtls1_record_data_st {
+    unsigned char *packet;
+    unsigned int packet_length;
+    SSL3_BUFFER rbuf;
+    SSL3_RECORD rrec;
+#  ifndef OPENSSL_NO_SCTP
+    struct bio_dgram_sctp_rcvinfo recordinfo;
+#  endif
+} DTLS1_RECORD_DATA;
+
+# endif
+
+/* Timeout multipliers (timeout slice is defined in apps/timeouts.h */
+# define DTLS1_TMO_READ_COUNT                      2
+# define DTLS1_TMO_WRITE_COUNT                     2
+
+# define DTLS1_TMO_ALERT_COUNT                     12
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/dtls1.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ecdh.h
===================================================================
--- lab4/.minix-src/include/openssl/ecdh.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ecdh.h	(revision 13)
@@ -0,0 +1,127 @@
+/* crypto/ecdh/ecdh.h */
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ *
+ * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
+ * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
+ * to the OpenSSL project.
+ *
+ * The ECC Code is licensed pursuant to the OpenSSL open source
+ * license provided below.
+ *
+ * The ECDH software is originally written by Douglas Stebila of
+ * Sun Microsystems Laboratories.
+ *
+ */
+/* ====================================================================
+ * Copyright (c) 2000-2002 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+#ifndef HEADER_ECDH_H
+# define HEADER_ECDH_H
+
+# include <openssl/opensslconf.h>
+
+# ifdef OPENSSL_NO_ECDH
+#  error ECDH is disabled.
+# endif
+
+# include <openssl/ec.h>
+# include <openssl/ossl_typ.h>
+# ifndef OPENSSL_NO_DEPRECATED
+#  include <openssl/bn.h>
+# endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const ECDH_METHOD *ECDH_OpenSSL(void);
+
+void ECDH_set_default_method(const ECDH_METHOD *);
+const ECDH_METHOD *ECDH_get_default_method(void);
+int ECDH_set_method(EC_KEY *, const ECDH_METHOD *);
+
+int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
+                     EC_KEY *ecdh, void *(*KDF) (const void *in, size_t inlen,
+                                                 void *out, size_t *outlen));
+
+int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
+                          *new_func, CRYPTO_EX_dup *dup_func,
+                          CRYPTO_EX_free *free_func);
+int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);
+void *ECDH_get_ex_data(EC_KEY *d, int idx);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_ECDH_strings(void);
+
+/* Error codes for the ECDH functions. */
+
+/* Function codes. */
+# define ECDH_F_ECDH_CHECK                                102
+# define ECDH_F_ECDH_COMPUTE_KEY                          100
+# define ECDH_F_ECDH_DATA_NEW_METHOD                      101
+
+/* Reason codes. */
+# define ECDH_R_KDF_FAILED                                102
+# define ECDH_R_NON_FIPS_METHOD                           103
+# define ECDH_R_NO_PRIVATE_VALUE                          100
+# define ECDH_R_POINT_ARITHMETIC_FAILURE                  101
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ecdh.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/obj_mac.h
===================================================================
--- lab4/.minix-src/include/openssl/obj_mac.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/obj_mac.h	(revision 13)
@@ -0,0 +1,4031 @@
+/* crypto/objects/obj_mac.h */
+
+/*
+ * THIS FILE IS GENERATED FROM objects.txt by objects.pl via the following
+ * command: perl objects.pl objects.txt obj_mac.num obj_mac.h
+ */
+
+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#define SN_undef                        "UNDEF"
+#define LN_undef                        "undefined"
+#define NID_undef                       0
+#define OBJ_undef                       0L
+
+#define SN_itu_t                "ITU-T"
+#define LN_itu_t                "itu-t"
+#define NID_itu_t               645
+#define OBJ_itu_t               0L
+
+#define NID_ccitt               404
+#define OBJ_ccitt               OBJ_itu_t
+
+#define SN_iso          "ISO"
+#define LN_iso          "iso"
+#define NID_iso         181
+#define OBJ_iso         1L
+
+#define SN_joint_iso_itu_t              "JOINT-ISO-ITU-T"
+#define LN_joint_iso_itu_t              "joint-iso-itu-t"
+#define NID_joint_iso_itu_t             646
+#define OBJ_joint_iso_itu_t             2L
+
+#define NID_joint_iso_ccitt             393
+#define OBJ_joint_iso_ccitt             OBJ_joint_iso_itu_t
+
+#define SN_member_body          "member-body"
+#define LN_member_body          "ISO Member Body"
+#define NID_member_body         182
+#define OBJ_member_body         OBJ_iso,2L
+
+#define SN_identified_organization              "identified-organization"
+#define NID_identified_organization             676
+#define OBJ_identified_organization             OBJ_iso,3L
+
+#define SN_hmac_md5             "HMAC-MD5"
+#define LN_hmac_md5             "hmac-md5"
+#define NID_hmac_md5            780
+#define OBJ_hmac_md5            OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L
+
+#define SN_hmac_sha1            "HMAC-SHA1"
+#define LN_hmac_sha1            "hmac-sha1"
+#define NID_hmac_sha1           781
+#define OBJ_hmac_sha1           OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L
+
+#define SN_certicom_arc         "certicom-arc"
+#define NID_certicom_arc                677
+#define OBJ_certicom_arc                OBJ_identified_organization,132L
+
+#define SN_international_organizations          "international-organizations"
+#define LN_international_organizations          "International Organizations"
+#define NID_international_organizations         647
+#define OBJ_international_organizations         OBJ_joint_iso_itu_t,23L
+
+#define SN_wap          "wap"
+#define NID_wap         678
+#define OBJ_wap         OBJ_international_organizations,43L
+
+#define SN_wap_wsg              "wap-wsg"
+#define NID_wap_wsg             679
+#define OBJ_wap_wsg             OBJ_wap,1L
+
+#define SN_selected_attribute_types             "selected-attribute-types"
+#define LN_selected_attribute_types             "Selected Attribute Types"
+#define NID_selected_attribute_types            394
+#define OBJ_selected_attribute_types            OBJ_joint_iso_itu_t,5L,1L,5L
+
+#define SN_clearance            "clearance"
+#define NID_clearance           395
+#define OBJ_clearance           OBJ_selected_attribute_types,55L
+
+#define SN_ISO_US               "ISO-US"
+#define LN_ISO_US               "ISO US Member Body"
+#define NID_ISO_US              183
+#define OBJ_ISO_US              OBJ_member_body,840L
+
+#define SN_X9_57                "X9-57"
+#define LN_X9_57                "X9.57"
+#define NID_X9_57               184
+#define OBJ_X9_57               OBJ_ISO_US,10040L
+
+#define SN_X9cm         "X9cm"
+#define LN_X9cm         "X9.57 CM ?"
+#define NID_X9cm                185
+#define OBJ_X9cm                OBJ_X9_57,4L
+
+#define SN_dsa          "DSA"
+#define LN_dsa          "dsaEncryption"
+#define NID_dsa         116
+#define OBJ_dsa         OBJ_X9cm,1L
+
+#define SN_dsaWithSHA1          "DSA-SHA1"
+#define LN_dsaWithSHA1          "dsaWithSHA1"
+#define NID_dsaWithSHA1         113
+#define OBJ_dsaWithSHA1         OBJ_X9cm,3L
+
+#define SN_ansi_X9_62           "ansi-X9-62"
+#define LN_ansi_X9_62           "ANSI X9.62"
+#define NID_ansi_X9_62          405
+#define OBJ_ansi_X9_62          OBJ_ISO_US,10045L
+
+#define OBJ_X9_62_id_fieldType          OBJ_ansi_X9_62,1L
+
+#define SN_X9_62_prime_field            "prime-field"
+#define NID_X9_62_prime_field           406
+#define OBJ_X9_62_prime_field           OBJ_X9_62_id_fieldType,1L
+
+#define SN_X9_62_characteristic_two_field               "characteristic-two-field"
+#define NID_X9_62_characteristic_two_field              407
+#define OBJ_X9_62_characteristic_two_field              OBJ_X9_62_id_fieldType,2L
+
+#define SN_X9_62_id_characteristic_two_basis            "id-characteristic-two-basis"
+#define NID_X9_62_id_characteristic_two_basis           680
+#define OBJ_X9_62_id_characteristic_two_basis           OBJ_X9_62_characteristic_two_field,3L
+
+#define SN_X9_62_onBasis                "onBasis"
+#define NID_X9_62_onBasis               681
+#define OBJ_X9_62_onBasis               OBJ_X9_62_id_characteristic_two_basis,1L
+
+#define SN_X9_62_tpBasis                "tpBasis"
+#define NID_X9_62_tpBasis               682
+#define OBJ_X9_62_tpBasis               OBJ_X9_62_id_characteristic_two_basis,2L
+
+#define SN_X9_62_ppBasis                "ppBasis"
+#define NID_X9_62_ppBasis               683
+#define OBJ_X9_62_ppBasis               OBJ_X9_62_id_characteristic_two_basis,3L
+
+#define OBJ_X9_62_id_publicKeyType              OBJ_ansi_X9_62,2L
+
+#define SN_X9_62_id_ecPublicKey         "id-ecPublicKey"
+#define NID_X9_62_id_ecPublicKey                408
+#define OBJ_X9_62_id_ecPublicKey                OBJ_X9_62_id_publicKeyType,1L
+
+#define OBJ_X9_62_ellipticCurve         OBJ_ansi_X9_62,3L
+
+#define OBJ_X9_62_c_TwoCurve            OBJ_X9_62_ellipticCurve,0L
+
+#define SN_X9_62_c2pnb163v1             "c2pnb163v1"
+#define NID_X9_62_c2pnb163v1            684
+#define OBJ_X9_62_c2pnb163v1            OBJ_X9_62_c_TwoCurve,1L
+
+#define SN_X9_62_c2pnb163v2             "c2pnb163v2"
+#define NID_X9_62_c2pnb163v2            685
+#define OBJ_X9_62_c2pnb163v2            OBJ_X9_62_c_TwoCurve,2L
+
+#define SN_X9_62_c2pnb163v3             "c2pnb163v3"
+#define NID_X9_62_c2pnb163v3            686
+#define OBJ_X9_62_c2pnb163v3            OBJ_X9_62_c_TwoCurve,3L
+
+#define SN_X9_62_c2pnb176v1             "c2pnb176v1"
+#define NID_X9_62_c2pnb176v1            687
+#define OBJ_X9_62_c2pnb176v1            OBJ_X9_62_c_TwoCurve,4L
+
+#define SN_X9_62_c2tnb191v1             "c2tnb191v1"
+#define NID_X9_62_c2tnb191v1            688
+#define OBJ_X9_62_c2tnb191v1            OBJ_X9_62_c_TwoCurve,5L
+
+#define SN_X9_62_c2tnb191v2             "c2tnb191v2"
+#define NID_X9_62_c2tnb191v2            689
+#define OBJ_X9_62_c2tnb191v2            OBJ_X9_62_c_TwoCurve,6L
+
+#define SN_X9_62_c2tnb191v3             "c2tnb191v3"
+#define NID_X9_62_c2tnb191v3            690
+#define OBJ_X9_62_c2tnb191v3            OBJ_X9_62_c_TwoCurve,7L
+
+#define SN_X9_62_c2onb191v4             "c2onb191v4"
+#define NID_X9_62_c2onb191v4            691
+#define OBJ_X9_62_c2onb191v4            OBJ_X9_62_c_TwoCurve,8L
+
+#define SN_X9_62_c2onb191v5             "c2onb191v5"
+#define NID_X9_62_c2onb191v5            692
+#define OBJ_X9_62_c2onb191v5            OBJ_X9_62_c_TwoCurve,9L
+
+#define SN_X9_62_c2pnb208w1             "c2pnb208w1"
+#define NID_X9_62_c2pnb208w1            693
+#define OBJ_X9_62_c2pnb208w1            OBJ_X9_62_c_TwoCurve,10L
+
+#define SN_X9_62_c2tnb239v1             "c2tnb239v1"
+#define NID_X9_62_c2tnb239v1            694
+#define OBJ_X9_62_c2tnb239v1            OBJ_X9_62_c_TwoCurve,11L
+
+#define SN_X9_62_c2tnb239v2             "c2tnb239v2"
+#define NID_X9_62_c2tnb239v2            695
+#define OBJ_X9_62_c2tnb239v2            OBJ_X9_62_c_TwoCurve,12L
+
+#define SN_X9_62_c2tnb239v3             "c2tnb239v3"
+#define NID_X9_62_c2tnb239v3            696
+#define OBJ_X9_62_c2tnb239v3            OBJ_X9_62_c_TwoCurve,13L
+
+#define SN_X9_62_c2onb239v4             "c2onb239v4"
+#define NID_X9_62_c2onb239v4            697
+#define OBJ_X9_62_c2onb239v4            OBJ_X9_62_c_TwoCurve,14L
+
+#define SN_X9_62_c2onb239v5             "c2onb239v5"
+#define NID_X9_62_c2onb239v5            698
+#define OBJ_X9_62_c2onb239v5            OBJ_X9_62_c_TwoCurve,15L
+
+#define SN_X9_62_c2pnb272w1             "c2pnb272w1"
+#define NID_X9_62_c2pnb272w1            699
+#define OBJ_X9_62_c2pnb272w1            OBJ_X9_62_c_TwoCurve,16L
+
+#define SN_X9_62_c2pnb304w1             "c2pnb304w1"
+#define NID_X9_62_c2pnb304w1            700
+#define OBJ_X9_62_c2pnb304w1            OBJ_X9_62_c_TwoCurve,17L
+
+#define SN_X9_62_c2tnb359v1             "c2tnb359v1"
+#define NID_X9_62_c2tnb359v1            701
+#define OBJ_X9_62_c2tnb359v1            OBJ_X9_62_c_TwoCurve,18L
+
+#define SN_X9_62_c2pnb368w1             "c2pnb368w1"
+#define NID_X9_62_c2pnb368w1            702
+#define OBJ_X9_62_c2pnb368w1            OBJ_X9_62_c_TwoCurve,19L
+
+#define SN_X9_62_c2tnb431r1             "c2tnb431r1"
+#define NID_X9_62_c2tnb431r1            703
+#define OBJ_X9_62_c2tnb431r1            OBJ_X9_62_c_TwoCurve,20L
+
+#define OBJ_X9_62_primeCurve            OBJ_X9_62_ellipticCurve,1L
+
+#define SN_X9_62_prime192v1             "prime192v1"
+#define NID_X9_62_prime192v1            409
+#define OBJ_X9_62_prime192v1            OBJ_X9_62_primeCurve,1L
+
+#define SN_X9_62_prime192v2             "prime192v2"
+#define NID_X9_62_prime192v2            410
+#define OBJ_X9_62_prime192v2            OBJ_X9_62_primeCurve,2L
+
+#define SN_X9_62_prime192v3             "prime192v3"
+#define NID_X9_62_prime192v3            411
+#define OBJ_X9_62_prime192v3            OBJ_X9_62_primeCurve,3L
+
+#define SN_X9_62_prime239v1             "prime239v1"
+#define NID_X9_62_prime239v1            412
+#define OBJ_X9_62_prime239v1            OBJ_X9_62_primeCurve,4L
+
+#define SN_X9_62_prime239v2             "prime239v2"
+#define NID_X9_62_prime239v2            413
+#define OBJ_X9_62_prime239v2            OBJ_X9_62_primeCurve,5L
+
+#define SN_X9_62_prime239v3             "prime239v3"
+#define NID_X9_62_prime239v3            414
+#define OBJ_X9_62_prime239v3            OBJ_X9_62_primeCurve,6L
+
+#define SN_X9_62_prime256v1             "prime256v1"
+#define NID_X9_62_prime256v1            415
+#define OBJ_X9_62_prime256v1            OBJ_X9_62_primeCurve,7L
+
+#define OBJ_X9_62_id_ecSigType          OBJ_ansi_X9_62,4L
+
+#define SN_ecdsa_with_SHA1              "ecdsa-with-SHA1"
+#define NID_ecdsa_with_SHA1             416
+#define OBJ_ecdsa_with_SHA1             OBJ_X9_62_id_ecSigType,1L
+
+#define SN_ecdsa_with_Recommended               "ecdsa-with-Recommended"
+#define NID_ecdsa_with_Recommended              791
+#define OBJ_ecdsa_with_Recommended              OBJ_X9_62_id_ecSigType,2L
+
+#define SN_ecdsa_with_Specified         "ecdsa-with-Specified"
+#define NID_ecdsa_with_Specified                792
+#define OBJ_ecdsa_with_Specified                OBJ_X9_62_id_ecSigType,3L
+
+#define SN_ecdsa_with_SHA224            "ecdsa-with-SHA224"
+#define NID_ecdsa_with_SHA224           793
+#define OBJ_ecdsa_with_SHA224           OBJ_ecdsa_with_Specified,1L
+
+#define SN_ecdsa_with_SHA256            "ecdsa-with-SHA256"
+#define NID_ecdsa_with_SHA256           794
+#define OBJ_ecdsa_with_SHA256           OBJ_ecdsa_with_Specified,2L
+
+#define SN_ecdsa_with_SHA384            "ecdsa-with-SHA384"
+#define NID_ecdsa_with_SHA384           795
+#define OBJ_ecdsa_with_SHA384           OBJ_ecdsa_with_Specified,3L
+
+#define SN_ecdsa_with_SHA512            "ecdsa-with-SHA512"
+#define NID_ecdsa_with_SHA512           796
+#define OBJ_ecdsa_with_SHA512           OBJ_ecdsa_with_Specified,4L
+
+#define OBJ_secg_ellipticCurve          OBJ_certicom_arc,0L
+
+#define SN_secp112r1            "secp112r1"
+#define NID_secp112r1           704
+#define OBJ_secp112r1           OBJ_secg_ellipticCurve,6L
+
+#define SN_secp112r2            "secp112r2"
+#define NID_secp112r2           705
+#define OBJ_secp112r2           OBJ_secg_ellipticCurve,7L
+
+#define SN_secp128r1            "secp128r1"
+#define NID_secp128r1           706
+#define OBJ_secp128r1           OBJ_secg_ellipticCurve,28L
+
+#define SN_secp128r2            "secp128r2"
+#define NID_secp128r2           707
+#define OBJ_secp128r2           OBJ_secg_ellipticCurve,29L
+
+#define SN_secp160k1            "secp160k1"
+#define NID_secp160k1           708
+#define OBJ_secp160k1           OBJ_secg_ellipticCurve,9L
+
+#define SN_secp160r1            "secp160r1"
+#define NID_secp160r1           709
+#define OBJ_secp160r1           OBJ_secg_ellipticCurve,8L
+
+#define SN_secp160r2            "secp160r2"
+#define NID_secp160r2           710
+#define OBJ_secp160r2           OBJ_secg_ellipticCurve,30L
+
+#define SN_secp192k1            "secp192k1"
+#define NID_secp192k1           711
+#define OBJ_secp192k1           OBJ_secg_ellipticCurve,31L
+
+#define SN_secp224k1            "secp224k1"
+#define NID_secp224k1           712
+#define OBJ_secp224k1           OBJ_secg_ellipticCurve,32L
+
+#define SN_secp224r1            "secp224r1"
+#define NID_secp224r1           713
+#define OBJ_secp224r1           OBJ_secg_ellipticCurve,33L
+
+#define SN_secp256k1            "secp256k1"
+#define NID_secp256k1           714
+#define OBJ_secp256k1           OBJ_secg_ellipticCurve,10L
+
+#define SN_secp384r1            "secp384r1"
+#define NID_secp384r1           715
+#define OBJ_secp384r1           OBJ_secg_ellipticCurve,34L
+
+#define SN_secp521r1            "secp521r1"
+#define NID_secp521r1           716
+#define OBJ_secp521r1           OBJ_secg_ellipticCurve,35L
+
+#define SN_sect113r1            "sect113r1"
+#define NID_sect113r1           717
+#define OBJ_sect113r1           OBJ_secg_ellipticCurve,4L
+
+#define SN_sect113r2            "sect113r2"
+#define NID_sect113r2           718
+#define OBJ_sect113r2           OBJ_secg_ellipticCurve,5L
+
+#define SN_sect131r1            "sect131r1"
+#define NID_sect131r1           719
+#define OBJ_sect131r1           OBJ_secg_ellipticCurve,22L
+
+#define SN_sect131r2            "sect131r2"
+#define NID_sect131r2           720
+#define OBJ_sect131r2           OBJ_secg_ellipticCurve,23L
+
+#define SN_sect163k1            "sect163k1"
+#define NID_sect163k1           721
+#define OBJ_sect163k1           OBJ_secg_ellipticCurve,1L
+
+#define SN_sect163r1            "sect163r1"
+#define NID_sect163r1           722
+#define OBJ_sect163r1           OBJ_secg_ellipticCurve,2L
+
+#define SN_sect163r2            "sect163r2"
+#define NID_sect163r2           723
+#define OBJ_sect163r2           OBJ_secg_ellipticCurve,15L
+
+#define SN_sect193r1            "sect193r1"
+#define NID_sect193r1           724
+#define OBJ_sect193r1           OBJ_secg_ellipticCurve,24L
+
+#define SN_sect193r2            "sect193r2"
+#define NID_sect193r2           725
+#define OBJ_sect193r2           OBJ_secg_ellipticCurve,25L
+
+#define SN_sect233k1            "sect233k1"
+#define NID_sect233k1           726
+#define OBJ_sect233k1           OBJ_secg_ellipticCurve,26L
+
+#define SN_sect233r1            "sect233r1"
+#define NID_sect233r1           727
+#define OBJ_sect233r1           OBJ_secg_ellipticCurve,27L
+
+#define SN_sect239k1            "sect239k1"
+#define NID_sect239k1           728
+#define OBJ_sect239k1           OBJ_secg_ellipticCurve,3L
+
+#define SN_sect283k1            "sect283k1"
+#define NID_sect283k1           729
+#define OBJ_sect283k1           OBJ_secg_ellipticCurve,16L
+
+#define SN_sect283r1            "sect283r1"
+#define NID_sect283r1           730
+#define OBJ_sect283r1           OBJ_secg_ellipticCurve,17L
+
+#define SN_sect409k1            "sect409k1"
+#define NID_sect409k1           731
+#define OBJ_sect409k1           OBJ_secg_ellipticCurve,36L
+
+#define SN_sect409r1            "sect409r1"
+#define NID_sect409r1           732
+#define OBJ_sect409r1           OBJ_secg_ellipticCurve,37L
+
+#define SN_sect571k1            "sect571k1"
+#define NID_sect571k1           733
+#define OBJ_sect571k1           OBJ_secg_ellipticCurve,38L
+
+#define SN_sect571r1            "sect571r1"
+#define NID_sect571r1           734
+#define OBJ_sect571r1           OBJ_secg_ellipticCurve,39L
+
+#define OBJ_wap_wsg_idm_ecid            OBJ_wap_wsg,4L
+
+#define SN_wap_wsg_idm_ecid_wtls1               "wap-wsg-idm-ecid-wtls1"
+#define NID_wap_wsg_idm_ecid_wtls1              735
+#define OBJ_wap_wsg_idm_ecid_wtls1              OBJ_wap_wsg_idm_ecid,1L
+
+#define SN_wap_wsg_idm_ecid_wtls3               "wap-wsg-idm-ecid-wtls3"
+#define NID_wap_wsg_idm_ecid_wtls3              736
+#define OBJ_wap_wsg_idm_ecid_wtls3              OBJ_wap_wsg_idm_ecid,3L
+
+#define SN_wap_wsg_idm_ecid_wtls4               "wap-wsg-idm-ecid-wtls4"
+#define NID_wap_wsg_idm_ecid_wtls4              737
+#define OBJ_wap_wsg_idm_ecid_wtls4              OBJ_wap_wsg_idm_ecid,4L
+
+#define SN_wap_wsg_idm_ecid_wtls5               "wap-wsg-idm-ecid-wtls5"
+#define NID_wap_wsg_idm_ecid_wtls5              738
+#define OBJ_wap_wsg_idm_ecid_wtls5              OBJ_wap_wsg_idm_ecid,5L
+
+#define SN_wap_wsg_idm_ecid_wtls6               "wap-wsg-idm-ecid-wtls6"
+#define NID_wap_wsg_idm_ecid_wtls6              739
+#define OBJ_wap_wsg_idm_ecid_wtls6              OBJ_wap_wsg_idm_ecid,6L
+
+#define SN_wap_wsg_idm_ecid_wtls7               "wap-wsg-idm-ecid-wtls7"
+#define NID_wap_wsg_idm_ecid_wtls7              740
+#define OBJ_wap_wsg_idm_ecid_wtls7              OBJ_wap_wsg_idm_ecid,7L
+
+#define SN_wap_wsg_idm_ecid_wtls8               "wap-wsg-idm-ecid-wtls8"
+#define NID_wap_wsg_idm_ecid_wtls8              741
+#define OBJ_wap_wsg_idm_ecid_wtls8              OBJ_wap_wsg_idm_ecid,8L
+
+#define SN_wap_wsg_idm_ecid_wtls9               "wap-wsg-idm-ecid-wtls9"
+#define NID_wap_wsg_idm_ecid_wtls9              742
+#define OBJ_wap_wsg_idm_ecid_wtls9              OBJ_wap_wsg_idm_ecid,9L
+
+#define SN_wap_wsg_idm_ecid_wtls10              "wap-wsg-idm-ecid-wtls10"
+#define NID_wap_wsg_idm_ecid_wtls10             743
+#define OBJ_wap_wsg_idm_ecid_wtls10             OBJ_wap_wsg_idm_ecid,10L
+
+#define SN_wap_wsg_idm_ecid_wtls11              "wap-wsg-idm-ecid-wtls11"
+#define NID_wap_wsg_idm_ecid_wtls11             744
+#define OBJ_wap_wsg_idm_ecid_wtls11             OBJ_wap_wsg_idm_ecid,11L
+
+#define SN_wap_wsg_idm_ecid_wtls12              "wap-wsg-idm-ecid-wtls12"
+#define NID_wap_wsg_idm_ecid_wtls12             745
+#define OBJ_wap_wsg_idm_ecid_wtls12             OBJ_wap_wsg_idm_ecid,12L
+
+#define SN_cast5_cbc            "CAST5-CBC"
+#define LN_cast5_cbc            "cast5-cbc"
+#define NID_cast5_cbc           108
+#define OBJ_cast5_cbc           OBJ_ISO_US,113533L,7L,66L,10L
+
+#define SN_cast5_ecb            "CAST5-ECB"
+#define LN_cast5_ecb            "cast5-ecb"
+#define NID_cast5_ecb           109
+
+#define SN_cast5_cfb64          "CAST5-CFB"
+#define LN_cast5_cfb64          "cast5-cfb"
+#define NID_cast5_cfb64         110
+
+#define SN_cast5_ofb64          "CAST5-OFB"
+#define LN_cast5_ofb64          "cast5-ofb"
+#define NID_cast5_ofb64         111
+
+#define LN_pbeWithMD5AndCast5_CBC               "pbeWithMD5AndCast5CBC"
+#define NID_pbeWithMD5AndCast5_CBC              112
+#define OBJ_pbeWithMD5AndCast5_CBC              OBJ_ISO_US,113533L,7L,66L,12L
+
+#define SN_id_PasswordBasedMAC          "id-PasswordBasedMAC"
+#define LN_id_PasswordBasedMAC          "password based MAC"
+#define NID_id_PasswordBasedMAC         782
+#define OBJ_id_PasswordBasedMAC         OBJ_ISO_US,113533L,7L,66L,13L
+
+#define SN_id_DHBasedMac                "id-DHBasedMac"
+#define LN_id_DHBasedMac                "Diffie-Hellman based MAC"
+#define NID_id_DHBasedMac               783
+#define OBJ_id_DHBasedMac               OBJ_ISO_US,113533L,7L,66L,30L
+
+#define SN_rsadsi               "rsadsi"
+#define LN_rsadsi               "RSA Data Security, Inc."
+#define NID_rsadsi              1
+#define OBJ_rsadsi              OBJ_ISO_US,113549L
+
+#define SN_pkcs         "pkcs"
+#define LN_pkcs         "RSA Data Security, Inc. PKCS"
+#define NID_pkcs                2
+#define OBJ_pkcs                OBJ_rsadsi,1L
+
+#define SN_pkcs1                "pkcs1"
+#define NID_pkcs1               186
+#define OBJ_pkcs1               OBJ_pkcs,1L
+
+#define LN_rsaEncryption                "rsaEncryption"
+#define NID_rsaEncryption               6
+#define OBJ_rsaEncryption               OBJ_pkcs1,1L
+
+#define SN_md2WithRSAEncryption         "RSA-MD2"
+#define LN_md2WithRSAEncryption         "md2WithRSAEncryption"
+#define NID_md2WithRSAEncryption                7
+#define OBJ_md2WithRSAEncryption                OBJ_pkcs1,2L
+
+#define SN_md4WithRSAEncryption         "RSA-MD4"
+#define LN_md4WithRSAEncryption         "md4WithRSAEncryption"
+#define NID_md4WithRSAEncryption                396
+#define OBJ_md4WithRSAEncryption                OBJ_pkcs1,3L
+
+#define SN_md5WithRSAEncryption         "RSA-MD5"
+#define LN_md5WithRSAEncryption         "md5WithRSAEncryption"
+#define NID_md5WithRSAEncryption                8
+#define OBJ_md5WithRSAEncryption                OBJ_pkcs1,4L
+
+#define SN_sha1WithRSAEncryption                "RSA-SHA1"
+#define LN_sha1WithRSAEncryption                "sha1WithRSAEncryption"
+#define NID_sha1WithRSAEncryption               65
+#define OBJ_sha1WithRSAEncryption               OBJ_pkcs1,5L
+
+#define SN_rsaesOaep            "RSAES-OAEP"
+#define LN_rsaesOaep            "rsaesOaep"
+#define NID_rsaesOaep           919
+#define OBJ_rsaesOaep           OBJ_pkcs1,7L
+
+#define SN_mgf1         "MGF1"
+#define LN_mgf1         "mgf1"
+#define NID_mgf1                911
+#define OBJ_mgf1                OBJ_pkcs1,8L
+
+#define SN_rsassaPss            "RSASSA-PSS"
+#define LN_rsassaPss            "rsassaPss"
+#define NID_rsassaPss           912
+#define OBJ_rsassaPss           OBJ_pkcs1,10L
+
+#define SN_sha256WithRSAEncryption              "RSA-SHA256"
+#define LN_sha256WithRSAEncryption              "sha256WithRSAEncryption"
+#define NID_sha256WithRSAEncryption             668
+#define OBJ_sha256WithRSAEncryption             OBJ_pkcs1,11L
+
+#define SN_sha384WithRSAEncryption              "RSA-SHA384"
+#define LN_sha384WithRSAEncryption              "sha384WithRSAEncryption"
+#define NID_sha384WithRSAEncryption             669
+#define OBJ_sha384WithRSAEncryption             OBJ_pkcs1,12L
+
+#define SN_sha512WithRSAEncryption              "RSA-SHA512"
+#define LN_sha512WithRSAEncryption              "sha512WithRSAEncryption"
+#define NID_sha512WithRSAEncryption             670
+#define OBJ_sha512WithRSAEncryption             OBJ_pkcs1,13L
+
+#define SN_sha224WithRSAEncryption              "RSA-SHA224"
+#define LN_sha224WithRSAEncryption              "sha224WithRSAEncryption"
+#define NID_sha224WithRSAEncryption             671
+#define OBJ_sha224WithRSAEncryption             OBJ_pkcs1,14L
+
+#define SN_pkcs3                "pkcs3"
+#define NID_pkcs3               27
+#define OBJ_pkcs3               OBJ_pkcs,3L
+
+#define LN_dhKeyAgreement               "dhKeyAgreement"
+#define NID_dhKeyAgreement              28
+#define OBJ_dhKeyAgreement              OBJ_pkcs3,1L
+
+#define SN_pkcs5                "pkcs5"
+#define NID_pkcs5               187
+#define OBJ_pkcs5               OBJ_pkcs,5L
+
+#define SN_pbeWithMD2AndDES_CBC         "PBE-MD2-DES"
+#define LN_pbeWithMD2AndDES_CBC         "pbeWithMD2AndDES-CBC"
+#define NID_pbeWithMD2AndDES_CBC                9
+#define OBJ_pbeWithMD2AndDES_CBC                OBJ_pkcs5,1L
+
+#define SN_pbeWithMD5AndDES_CBC         "PBE-MD5-DES"
+#define LN_pbeWithMD5AndDES_CBC         "pbeWithMD5AndDES-CBC"
+#define NID_pbeWithMD5AndDES_CBC                10
+#define OBJ_pbeWithMD5AndDES_CBC                OBJ_pkcs5,3L
+
+#define SN_pbeWithMD2AndRC2_CBC         "PBE-MD2-RC2-64"
+#define LN_pbeWithMD2AndRC2_CBC         "pbeWithMD2AndRC2-CBC"
+#define NID_pbeWithMD2AndRC2_CBC                168
+#define OBJ_pbeWithMD2AndRC2_CBC                OBJ_pkcs5,4L
+
+#define SN_pbeWithMD5AndRC2_CBC         "PBE-MD5-RC2-64"
+#define LN_pbeWithMD5AndRC2_CBC         "pbeWithMD5AndRC2-CBC"
+#define NID_pbeWithMD5AndRC2_CBC                169
+#define OBJ_pbeWithMD5AndRC2_CBC                OBJ_pkcs5,6L
+
+#define SN_pbeWithSHA1AndDES_CBC                "PBE-SHA1-DES"
+#define LN_pbeWithSHA1AndDES_CBC                "pbeWithSHA1AndDES-CBC"
+#define NID_pbeWithSHA1AndDES_CBC               170
+#define OBJ_pbeWithSHA1AndDES_CBC               OBJ_pkcs5,10L
+
+#define SN_pbeWithSHA1AndRC2_CBC                "PBE-SHA1-RC2-64"
+#define LN_pbeWithSHA1AndRC2_CBC                "pbeWithSHA1AndRC2-CBC"
+#define NID_pbeWithSHA1AndRC2_CBC               68
+#define OBJ_pbeWithSHA1AndRC2_CBC               OBJ_pkcs5,11L
+
+#define LN_id_pbkdf2            "PBKDF2"
+#define NID_id_pbkdf2           69
+#define OBJ_id_pbkdf2           OBJ_pkcs5,12L
+
+#define LN_pbes2                "PBES2"
+#define NID_pbes2               161
+#define OBJ_pbes2               OBJ_pkcs5,13L
+
+#define LN_pbmac1               "PBMAC1"
+#define NID_pbmac1              162
+#define OBJ_pbmac1              OBJ_pkcs5,14L
+
+#define SN_pkcs7                "pkcs7"
+#define NID_pkcs7               20
+#define OBJ_pkcs7               OBJ_pkcs,7L
+
+#define LN_pkcs7_data           "pkcs7-data"
+#define NID_pkcs7_data          21
+#define OBJ_pkcs7_data          OBJ_pkcs7,1L
+
+#define LN_pkcs7_signed         "pkcs7-signedData"
+#define NID_pkcs7_signed                22
+#define OBJ_pkcs7_signed                OBJ_pkcs7,2L
+
+#define LN_pkcs7_enveloped              "pkcs7-envelopedData"
+#define NID_pkcs7_enveloped             23
+#define OBJ_pkcs7_enveloped             OBJ_pkcs7,3L
+
+#define LN_pkcs7_signedAndEnveloped             "pkcs7-signedAndEnvelopedData"
+#define NID_pkcs7_signedAndEnveloped            24
+#define OBJ_pkcs7_signedAndEnveloped            OBJ_pkcs7,4L
+
+#define LN_pkcs7_digest         "pkcs7-digestData"
+#define NID_pkcs7_digest                25
+#define OBJ_pkcs7_digest                OBJ_pkcs7,5L
+
+#define LN_pkcs7_encrypted              "pkcs7-encryptedData"
+#define NID_pkcs7_encrypted             26
+#define OBJ_pkcs7_encrypted             OBJ_pkcs7,6L
+
+#define SN_pkcs9                "pkcs9"
+#define NID_pkcs9               47
+#define OBJ_pkcs9               OBJ_pkcs,9L
+
+#define LN_pkcs9_emailAddress           "emailAddress"
+#define NID_pkcs9_emailAddress          48
+#define OBJ_pkcs9_emailAddress          OBJ_pkcs9,1L
+
+#define LN_pkcs9_unstructuredName               "unstructuredName"
+#define NID_pkcs9_unstructuredName              49
+#define OBJ_pkcs9_unstructuredName              OBJ_pkcs9,2L
+
+#define LN_pkcs9_contentType            "contentType"
+#define NID_pkcs9_contentType           50
+#define OBJ_pkcs9_contentType           OBJ_pkcs9,3L
+
+#define LN_pkcs9_messageDigest          "messageDigest"
+#define NID_pkcs9_messageDigest         51
+#define OBJ_pkcs9_messageDigest         OBJ_pkcs9,4L
+
+#define LN_pkcs9_signingTime            "signingTime"
+#define NID_pkcs9_signingTime           52
+#define OBJ_pkcs9_signingTime           OBJ_pkcs9,5L
+
+#define LN_pkcs9_countersignature               "countersignature"
+#define NID_pkcs9_countersignature              53
+#define OBJ_pkcs9_countersignature              OBJ_pkcs9,6L
+
+#define LN_pkcs9_challengePassword              "challengePassword"
+#define NID_pkcs9_challengePassword             54
+#define OBJ_pkcs9_challengePassword             OBJ_pkcs9,7L
+
+#define LN_pkcs9_unstructuredAddress            "unstructuredAddress"
+#define NID_pkcs9_unstructuredAddress           55
+#define OBJ_pkcs9_unstructuredAddress           OBJ_pkcs9,8L
+
+#define LN_pkcs9_extCertAttributes              "extendedCertificateAttributes"
+#define NID_pkcs9_extCertAttributes             56
+#define OBJ_pkcs9_extCertAttributes             OBJ_pkcs9,9L
+
+#define SN_ext_req              "extReq"
+#define LN_ext_req              "Extension Request"
+#define NID_ext_req             172
+#define OBJ_ext_req             OBJ_pkcs9,14L
+
+#define SN_SMIMECapabilities            "SMIME-CAPS"
+#define LN_SMIMECapabilities            "S/MIME Capabilities"
+#define NID_SMIMECapabilities           167
+#define OBJ_SMIMECapabilities           OBJ_pkcs9,15L
+
+#define SN_SMIME                "SMIME"
+#define LN_SMIME                "S/MIME"
+#define NID_SMIME               188
+#define OBJ_SMIME               OBJ_pkcs9,16L
+
+#define SN_id_smime_mod         "id-smime-mod"
+#define NID_id_smime_mod                189
+#define OBJ_id_smime_mod                OBJ_SMIME,0L
+
+#define SN_id_smime_ct          "id-smime-ct"
+#define NID_id_smime_ct         190
+#define OBJ_id_smime_ct         OBJ_SMIME,1L
+
+#define SN_id_smime_aa          "id-smime-aa"
+#define NID_id_smime_aa         191
+#define OBJ_id_smime_aa         OBJ_SMIME,2L
+
+#define SN_id_smime_alg         "id-smime-alg"
+#define NID_id_smime_alg                192
+#define OBJ_id_smime_alg                OBJ_SMIME,3L
+
+#define SN_id_smime_cd          "id-smime-cd"
+#define NID_id_smime_cd         193
+#define OBJ_id_smime_cd         OBJ_SMIME,4L
+
+#define SN_id_smime_spq         "id-smime-spq"
+#define NID_id_smime_spq                194
+#define OBJ_id_smime_spq                OBJ_SMIME,5L
+
+#define SN_id_smime_cti         "id-smime-cti"
+#define NID_id_smime_cti                195
+#define OBJ_id_smime_cti                OBJ_SMIME,6L
+
+#define SN_id_smime_mod_cms             "id-smime-mod-cms"
+#define NID_id_smime_mod_cms            196
+#define OBJ_id_smime_mod_cms            OBJ_id_smime_mod,1L
+
+#define SN_id_smime_mod_ess             "id-smime-mod-ess"
+#define NID_id_smime_mod_ess            197
+#define OBJ_id_smime_mod_ess            OBJ_id_smime_mod,2L
+
+#define SN_id_smime_mod_oid             "id-smime-mod-oid"
+#define NID_id_smime_mod_oid            198
+#define OBJ_id_smime_mod_oid            OBJ_id_smime_mod,3L
+
+#define SN_id_smime_mod_msg_v3          "id-smime-mod-msg-v3"
+#define NID_id_smime_mod_msg_v3         199
+#define OBJ_id_smime_mod_msg_v3         OBJ_id_smime_mod,4L
+
+#define SN_id_smime_mod_ets_eSignature_88               "id-smime-mod-ets-eSignature-88"
+#define NID_id_smime_mod_ets_eSignature_88              200
+#define OBJ_id_smime_mod_ets_eSignature_88              OBJ_id_smime_mod,5L
+
+#define SN_id_smime_mod_ets_eSignature_97               "id-smime-mod-ets-eSignature-97"
+#define NID_id_smime_mod_ets_eSignature_97              201
+#define OBJ_id_smime_mod_ets_eSignature_97              OBJ_id_smime_mod,6L
+
+#define SN_id_smime_mod_ets_eSigPolicy_88               "id-smime-mod-ets-eSigPolicy-88"
+#define NID_id_smime_mod_ets_eSigPolicy_88              202
+#define OBJ_id_smime_mod_ets_eSigPolicy_88              OBJ_id_smime_mod,7L
+
+#define SN_id_smime_mod_ets_eSigPolicy_97               "id-smime-mod-ets-eSigPolicy-97"
+#define NID_id_smime_mod_ets_eSigPolicy_97              203
+#define OBJ_id_smime_mod_ets_eSigPolicy_97              OBJ_id_smime_mod,8L
+
+#define SN_id_smime_ct_receipt          "id-smime-ct-receipt"
+#define NID_id_smime_ct_receipt         204
+#define OBJ_id_smime_ct_receipt         OBJ_id_smime_ct,1L
+
+#define SN_id_smime_ct_authData         "id-smime-ct-authData"
+#define NID_id_smime_ct_authData                205
+#define OBJ_id_smime_ct_authData                OBJ_id_smime_ct,2L
+
+#define SN_id_smime_ct_publishCert              "id-smime-ct-publishCert"
+#define NID_id_smime_ct_publishCert             206
+#define OBJ_id_smime_ct_publishCert             OBJ_id_smime_ct,3L
+
+#define SN_id_smime_ct_TSTInfo          "id-smime-ct-TSTInfo"
+#define NID_id_smime_ct_TSTInfo         207
+#define OBJ_id_smime_ct_TSTInfo         OBJ_id_smime_ct,4L
+
+#define SN_id_smime_ct_TDTInfo          "id-smime-ct-TDTInfo"
+#define NID_id_smime_ct_TDTInfo         208
+#define OBJ_id_smime_ct_TDTInfo         OBJ_id_smime_ct,5L
+
+#define SN_id_smime_ct_contentInfo              "id-smime-ct-contentInfo"
+#define NID_id_smime_ct_contentInfo             209
+#define OBJ_id_smime_ct_contentInfo             OBJ_id_smime_ct,6L
+
+#define SN_id_smime_ct_DVCSRequestData          "id-smime-ct-DVCSRequestData"
+#define NID_id_smime_ct_DVCSRequestData         210
+#define OBJ_id_smime_ct_DVCSRequestData         OBJ_id_smime_ct,7L
+
+#define SN_id_smime_ct_DVCSResponseData         "id-smime-ct-DVCSResponseData"
+#define NID_id_smime_ct_DVCSResponseData                211
+#define OBJ_id_smime_ct_DVCSResponseData                OBJ_id_smime_ct,8L
+
+#define SN_id_smime_ct_compressedData           "id-smime-ct-compressedData"
+#define NID_id_smime_ct_compressedData          786
+#define OBJ_id_smime_ct_compressedData          OBJ_id_smime_ct,9L
+
+#define SN_id_ct_asciiTextWithCRLF              "id-ct-asciiTextWithCRLF"
+#define NID_id_ct_asciiTextWithCRLF             787
+#define OBJ_id_ct_asciiTextWithCRLF             OBJ_id_smime_ct,27L
+
+#define SN_id_smime_aa_receiptRequest           "id-smime-aa-receiptRequest"
+#define NID_id_smime_aa_receiptRequest          212
+#define OBJ_id_smime_aa_receiptRequest          OBJ_id_smime_aa,1L
+
+#define SN_id_smime_aa_securityLabel            "id-smime-aa-securityLabel"
+#define NID_id_smime_aa_securityLabel           213
+#define OBJ_id_smime_aa_securityLabel           OBJ_id_smime_aa,2L
+
+#define SN_id_smime_aa_mlExpandHistory          "id-smime-aa-mlExpandHistory"
+#define NID_id_smime_aa_mlExpandHistory         214
+#define OBJ_id_smime_aa_mlExpandHistory         OBJ_id_smime_aa,3L
+
+#define SN_id_smime_aa_contentHint              "id-smime-aa-contentHint"
+#define NID_id_smime_aa_contentHint             215
+#define OBJ_id_smime_aa_contentHint             OBJ_id_smime_aa,4L
+
+#define SN_id_smime_aa_msgSigDigest             "id-smime-aa-msgSigDigest"
+#define NID_id_smime_aa_msgSigDigest            216
+#define OBJ_id_smime_aa_msgSigDigest            OBJ_id_smime_aa,5L
+
+#define SN_id_smime_aa_encapContentType         "id-smime-aa-encapContentType"
+#define NID_id_smime_aa_encapContentType                217
+#define OBJ_id_smime_aa_encapContentType                OBJ_id_smime_aa,6L
+
+#define SN_id_smime_aa_contentIdentifier                "id-smime-aa-contentIdentifier"
+#define NID_id_smime_aa_contentIdentifier               218
+#define OBJ_id_smime_aa_contentIdentifier               OBJ_id_smime_aa,7L
+
+#define SN_id_smime_aa_macValue         "id-smime-aa-macValue"
+#define NID_id_smime_aa_macValue                219
+#define OBJ_id_smime_aa_macValue                OBJ_id_smime_aa,8L
+
+#define SN_id_smime_aa_equivalentLabels         "id-smime-aa-equivalentLabels"
+#define NID_id_smime_aa_equivalentLabels                220
+#define OBJ_id_smime_aa_equivalentLabels                OBJ_id_smime_aa,9L
+
+#define SN_id_smime_aa_contentReference         "id-smime-aa-contentReference"
+#define NID_id_smime_aa_contentReference                221
+#define OBJ_id_smime_aa_contentReference                OBJ_id_smime_aa,10L
+
+#define SN_id_smime_aa_encrypKeyPref            "id-smime-aa-encrypKeyPref"
+#define NID_id_smime_aa_encrypKeyPref           222
+#define OBJ_id_smime_aa_encrypKeyPref           OBJ_id_smime_aa,11L
+
+#define SN_id_smime_aa_signingCertificate               "id-smime-aa-signingCertificate"
+#define NID_id_smime_aa_signingCertificate              223
+#define OBJ_id_smime_aa_signingCertificate              OBJ_id_smime_aa,12L
+
+#define SN_id_smime_aa_smimeEncryptCerts                "id-smime-aa-smimeEncryptCerts"
+#define NID_id_smime_aa_smimeEncryptCerts               224
+#define OBJ_id_smime_aa_smimeEncryptCerts               OBJ_id_smime_aa,13L
+
+#define SN_id_smime_aa_timeStampToken           "id-smime-aa-timeStampToken"
+#define NID_id_smime_aa_timeStampToken          225
+#define OBJ_id_smime_aa_timeStampToken          OBJ_id_smime_aa,14L
+
+#define SN_id_smime_aa_ets_sigPolicyId          "id-smime-aa-ets-sigPolicyId"
+#define NID_id_smime_aa_ets_sigPolicyId         226
+#define OBJ_id_smime_aa_ets_sigPolicyId         OBJ_id_smime_aa,15L
+
+#define SN_id_smime_aa_ets_commitmentType               "id-smime-aa-ets-commitmentType"
+#define NID_id_smime_aa_ets_commitmentType              227
+#define OBJ_id_smime_aa_ets_commitmentType              OBJ_id_smime_aa,16L
+
+#define SN_id_smime_aa_ets_signerLocation               "id-smime-aa-ets-signerLocation"
+#define NID_id_smime_aa_ets_signerLocation              228
+#define OBJ_id_smime_aa_ets_signerLocation              OBJ_id_smime_aa,17L
+
+#define SN_id_smime_aa_ets_signerAttr           "id-smime-aa-ets-signerAttr"
+#define NID_id_smime_aa_ets_signerAttr          229
+#define OBJ_id_smime_aa_ets_signerAttr          OBJ_id_smime_aa,18L
+
+#define SN_id_smime_aa_ets_otherSigCert         "id-smime-aa-ets-otherSigCert"
+#define NID_id_smime_aa_ets_otherSigCert                230
+#define OBJ_id_smime_aa_ets_otherSigCert                OBJ_id_smime_aa,19L
+
+#define SN_id_smime_aa_ets_contentTimestamp             "id-smime-aa-ets-contentTimestamp"
+#define NID_id_smime_aa_ets_contentTimestamp            231
+#define OBJ_id_smime_aa_ets_contentTimestamp            OBJ_id_smime_aa,20L
+
+#define SN_id_smime_aa_ets_CertificateRefs              "id-smime-aa-ets-CertificateRefs"
+#define NID_id_smime_aa_ets_CertificateRefs             232
+#define OBJ_id_smime_aa_ets_CertificateRefs             OBJ_id_smime_aa,21L
+
+#define SN_id_smime_aa_ets_RevocationRefs               "id-smime-aa-ets-RevocationRefs"
+#define NID_id_smime_aa_ets_RevocationRefs              233
+#define OBJ_id_smime_aa_ets_RevocationRefs              OBJ_id_smime_aa,22L
+
+#define SN_id_smime_aa_ets_certValues           "id-smime-aa-ets-certValues"
+#define NID_id_smime_aa_ets_certValues          234
+#define OBJ_id_smime_aa_ets_certValues          OBJ_id_smime_aa,23L
+
+#define SN_id_smime_aa_ets_revocationValues             "id-smime-aa-ets-revocationValues"
+#define NID_id_smime_aa_ets_revocationValues            235
+#define OBJ_id_smime_aa_ets_revocationValues            OBJ_id_smime_aa,24L
+
+#define SN_id_smime_aa_ets_escTimeStamp         "id-smime-aa-ets-escTimeStamp"
+#define NID_id_smime_aa_ets_escTimeStamp                236
+#define OBJ_id_smime_aa_ets_escTimeStamp                OBJ_id_smime_aa,25L
+
+#define SN_id_smime_aa_ets_certCRLTimestamp             "id-smime-aa-ets-certCRLTimestamp"
+#define NID_id_smime_aa_ets_certCRLTimestamp            237
+#define OBJ_id_smime_aa_ets_certCRLTimestamp            OBJ_id_smime_aa,26L
+
+#define SN_id_smime_aa_ets_archiveTimeStamp             "id-smime-aa-ets-archiveTimeStamp"
+#define NID_id_smime_aa_ets_archiveTimeStamp            238
+#define OBJ_id_smime_aa_ets_archiveTimeStamp            OBJ_id_smime_aa,27L
+
+#define SN_id_smime_aa_signatureType            "id-smime-aa-signatureType"
+#define NID_id_smime_aa_signatureType           239
+#define OBJ_id_smime_aa_signatureType           OBJ_id_smime_aa,28L
+
+#define SN_id_smime_aa_dvcs_dvc         "id-smime-aa-dvcs-dvc"
+#define NID_id_smime_aa_dvcs_dvc                240
+#define OBJ_id_smime_aa_dvcs_dvc                OBJ_id_smime_aa,29L
+
+#define SN_id_smime_alg_ESDHwith3DES            "id-smime-alg-ESDHwith3DES"
+#define NID_id_smime_alg_ESDHwith3DES           241
+#define OBJ_id_smime_alg_ESDHwith3DES           OBJ_id_smime_alg,1L
+
+#define SN_id_smime_alg_ESDHwithRC2             "id-smime-alg-ESDHwithRC2"
+#define NID_id_smime_alg_ESDHwithRC2            242
+#define OBJ_id_smime_alg_ESDHwithRC2            OBJ_id_smime_alg,2L
+
+#define SN_id_smime_alg_3DESwrap                "id-smime-alg-3DESwrap"
+#define NID_id_smime_alg_3DESwrap               243
+#define OBJ_id_smime_alg_3DESwrap               OBJ_id_smime_alg,3L
+
+#define SN_id_smime_alg_RC2wrap         "id-smime-alg-RC2wrap"
+#define NID_id_smime_alg_RC2wrap                244
+#define OBJ_id_smime_alg_RC2wrap                OBJ_id_smime_alg,4L
+
+#define SN_id_smime_alg_ESDH            "id-smime-alg-ESDH"
+#define NID_id_smime_alg_ESDH           245
+#define OBJ_id_smime_alg_ESDH           OBJ_id_smime_alg,5L
+
+#define SN_id_smime_alg_CMS3DESwrap             "id-smime-alg-CMS3DESwrap"
+#define NID_id_smime_alg_CMS3DESwrap            246
+#define OBJ_id_smime_alg_CMS3DESwrap            OBJ_id_smime_alg,6L
+
+#define SN_id_smime_alg_CMSRC2wrap              "id-smime-alg-CMSRC2wrap"
+#define NID_id_smime_alg_CMSRC2wrap             247
+#define OBJ_id_smime_alg_CMSRC2wrap             OBJ_id_smime_alg,7L
+
+#define SN_id_alg_PWRI_KEK              "id-alg-PWRI-KEK"
+#define NID_id_alg_PWRI_KEK             893
+#define OBJ_id_alg_PWRI_KEK             OBJ_id_smime_alg,9L
+
+#define SN_id_smime_cd_ldap             "id-smime-cd-ldap"
+#define NID_id_smime_cd_ldap            248
+#define OBJ_id_smime_cd_ldap            OBJ_id_smime_cd,1L
+
+#define SN_id_smime_spq_ets_sqt_uri             "id-smime-spq-ets-sqt-uri"
+#define NID_id_smime_spq_ets_sqt_uri            249
+#define OBJ_id_smime_spq_ets_sqt_uri            OBJ_id_smime_spq,1L
+
+#define SN_id_smime_spq_ets_sqt_unotice         "id-smime-spq-ets-sqt-unotice"
+#define NID_id_smime_spq_ets_sqt_unotice                250
+#define OBJ_id_smime_spq_ets_sqt_unotice                OBJ_id_smime_spq,2L
+
+#define SN_id_smime_cti_ets_proofOfOrigin               "id-smime-cti-ets-proofOfOrigin"
+#define NID_id_smime_cti_ets_proofOfOrigin              251
+#define OBJ_id_smime_cti_ets_proofOfOrigin              OBJ_id_smime_cti,1L
+
+#define SN_id_smime_cti_ets_proofOfReceipt              "id-smime-cti-ets-proofOfReceipt"
+#define NID_id_smime_cti_ets_proofOfReceipt             252
+#define OBJ_id_smime_cti_ets_proofOfReceipt             OBJ_id_smime_cti,2L
+
+#define SN_id_smime_cti_ets_proofOfDelivery             "id-smime-cti-ets-proofOfDelivery"
+#define NID_id_smime_cti_ets_proofOfDelivery            253
+#define OBJ_id_smime_cti_ets_proofOfDelivery            OBJ_id_smime_cti,3L
+
+#define SN_id_smime_cti_ets_proofOfSender               "id-smime-cti-ets-proofOfSender"
+#define NID_id_smime_cti_ets_proofOfSender              254
+#define OBJ_id_smime_cti_ets_proofOfSender              OBJ_id_smime_cti,4L
+
+#define SN_id_smime_cti_ets_proofOfApproval             "id-smime-cti-ets-proofOfApproval"
+#define NID_id_smime_cti_ets_proofOfApproval            255
+#define OBJ_id_smime_cti_ets_proofOfApproval            OBJ_id_smime_cti,5L
+
+#define SN_id_smime_cti_ets_proofOfCreation             "id-smime-cti-ets-proofOfCreation"
+#define NID_id_smime_cti_ets_proofOfCreation            256
+#define OBJ_id_smime_cti_ets_proofOfCreation            OBJ_id_smime_cti,6L
+
+#define LN_friendlyName         "friendlyName"
+#define NID_friendlyName                156
+#define OBJ_friendlyName                OBJ_pkcs9,20L
+
+#define LN_localKeyID           "localKeyID"
+#define NID_localKeyID          157
+#define OBJ_localKeyID          OBJ_pkcs9,21L
+
+#define SN_ms_csp_name          "CSPName"
+#define LN_ms_csp_name          "Microsoft CSP Name"
+#define NID_ms_csp_name         417
+#define OBJ_ms_csp_name         1L,3L,6L,1L,4L,1L,311L,17L,1L
+
+#define SN_LocalKeySet          "LocalKeySet"
+#define LN_LocalKeySet          "Microsoft Local Key set"
+#define NID_LocalKeySet         856
+#define OBJ_LocalKeySet         1L,3L,6L,1L,4L,1L,311L,17L,2L
+
+#define OBJ_certTypes           OBJ_pkcs9,22L
+
+#define LN_x509Certificate              "x509Certificate"
+#define NID_x509Certificate             158
+#define OBJ_x509Certificate             OBJ_certTypes,1L
+
+#define LN_sdsiCertificate              "sdsiCertificate"
+#define NID_sdsiCertificate             159
+#define OBJ_sdsiCertificate             OBJ_certTypes,2L
+
+#define OBJ_crlTypes            OBJ_pkcs9,23L
+
+#define LN_x509Crl              "x509Crl"
+#define NID_x509Crl             160
+#define OBJ_x509Crl             OBJ_crlTypes,1L
+
+#define OBJ_pkcs12              OBJ_pkcs,12L
+
+#define OBJ_pkcs12_pbeids               OBJ_pkcs12,1L
+
+#define SN_pbe_WithSHA1And128BitRC4             "PBE-SHA1-RC4-128"
+#define LN_pbe_WithSHA1And128BitRC4             "pbeWithSHA1And128BitRC4"
+#define NID_pbe_WithSHA1And128BitRC4            144
+#define OBJ_pbe_WithSHA1And128BitRC4            OBJ_pkcs12_pbeids,1L
+
+#define SN_pbe_WithSHA1And40BitRC4              "PBE-SHA1-RC4-40"
+#define LN_pbe_WithSHA1And40BitRC4              "pbeWithSHA1And40BitRC4"
+#define NID_pbe_WithSHA1And40BitRC4             145
+#define OBJ_pbe_WithSHA1And40BitRC4             OBJ_pkcs12_pbeids,2L
+
+#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC           "PBE-SHA1-3DES"
+#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC           "pbeWithSHA1And3-KeyTripleDES-CBC"
+#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC          146
+#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC          OBJ_pkcs12_pbeids,3L
+
+#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC           "PBE-SHA1-2DES"
+#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC           "pbeWithSHA1And2-KeyTripleDES-CBC"
+#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC          147
+#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC          OBJ_pkcs12_pbeids,4L
+
+#define SN_pbe_WithSHA1And128BitRC2_CBC         "PBE-SHA1-RC2-128"
+#define LN_pbe_WithSHA1And128BitRC2_CBC         "pbeWithSHA1And128BitRC2-CBC"
+#define NID_pbe_WithSHA1And128BitRC2_CBC                148
+#define OBJ_pbe_WithSHA1And128BitRC2_CBC                OBJ_pkcs12_pbeids,5L
+
+#define SN_pbe_WithSHA1And40BitRC2_CBC          "PBE-SHA1-RC2-40"
+#define LN_pbe_WithSHA1And40BitRC2_CBC          "pbeWithSHA1And40BitRC2-CBC"
+#define NID_pbe_WithSHA1And40BitRC2_CBC         149
+#define OBJ_pbe_WithSHA1And40BitRC2_CBC         OBJ_pkcs12_pbeids,6L
+
+#define OBJ_pkcs12_Version1             OBJ_pkcs12,10L
+
+#define OBJ_pkcs12_BagIds               OBJ_pkcs12_Version1,1L
+
+#define LN_keyBag               "keyBag"
+#define NID_keyBag              150
+#define OBJ_keyBag              OBJ_pkcs12_BagIds,1L
+
+#define LN_pkcs8ShroudedKeyBag          "pkcs8ShroudedKeyBag"
+#define NID_pkcs8ShroudedKeyBag         151
+#define OBJ_pkcs8ShroudedKeyBag         OBJ_pkcs12_BagIds,2L
+
+#define LN_certBag              "certBag"
+#define NID_certBag             152
+#define OBJ_certBag             OBJ_pkcs12_BagIds,3L
+
+#define LN_crlBag               "crlBag"
+#define NID_crlBag              153
+#define OBJ_crlBag              OBJ_pkcs12_BagIds,4L
+
+#define LN_secretBag            "secretBag"
+#define NID_secretBag           154
+#define OBJ_secretBag           OBJ_pkcs12_BagIds,5L
+
+#define LN_safeContentsBag              "safeContentsBag"
+#define NID_safeContentsBag             155
+#define OBJ_safeContentsBag             OBJ_pkcs12_BagIds,6L
+
+#define SN_md2          "MD2"
+#define LN_md2          "md2"
+#define NID_md2         3
+#define OBJ_md2         OBJ_rsadsi,2L,2L
+
+#define SN_md4          "MD4"
+#define LN_md4          "md4"
+#define NID_md4         257
+#define OBJ_md4         OBJ_rsadsi,2L,4L
+
+#define SN_md5          "MD5"
+#define LN_md5          "md5"
+#define NID_md5         4
+#define OBJ_md5         OBJ_rsadsi,2L,5L
+
+#define SN_md5_sha1             "MD5-SHA1"
+#define LN_md5_sha1             "md5-sha1"
+#define NID_md5_sha1            114
+
+#define LN_hmacWithMD5          "hmacWithMD5"
+#define NID_hmacWithMD5         797
+#define OBJ_hmacWithMD5         OBJ_rsadsi,2L,6L
+
+#define LN_hmacWithSHA1         "hmacWithSHA1"
+#define NID_hmacWithSHA1                163
+#define OBJ_hmacWithSHA1                OBJ_rsadsi,2L,7L
+
+#define LN_hmacWithSHA224               "hmacWithSHA224"
+#define NID_hmacWithSHA224              798
+#define OBJ_hmacWithSHA224              OBJ_rsadsi,2L,8L
+
+#define LN_hmacWithSHA256               "hmacWithSHA256"
+#define NID_hmacWithSHA256              799
+#define OBJ_hmacWithSHA256              OBJ_rsadsi,2L,9L
+
+#define LN_hmacWithSHA384               "hmacWithSHA384"
+#define NID_hmacWithSHA384              800
+#define OBJ_hmacWithSHA384              OBJ_rsadsi,2L,10L
+
+#define LN_hmacWithSHA512               "hmacWithSHA512"
+#define NID_hmacWithSHA512              801
+#define OBJ_hmacWithSHA512              OBJ_rsadsi,2L,11L
+
+#define SN_rc2_cbc              "RC2-CBC"
+#define LN_rc2_cbc              "rc2-cbc"
+#define NID_rc2_cbc             37
+#define OBJ_rc2_cbc             OBJ_rsadsi,3L,2L
+
+#define SN_rc2_ecb              "RC2-ECB"
+#define LN_rc2_ecb              "rc2-ecb"
+#define NID_rc2_ecb             38
+
+#define SN_rc2_cfb64            "RC2-CFB"
+#define LN_rc2_cfb64            "rc2-cfb"
+#define NID_rc2_cfb64           39
+
+#define SN_rc2_ofb64            "RC2-OFB"
+#define LN_rc2_ofb64            "rc2-ofb"
+#define NID_rc2_ofb64           40
+
+#define SN_rc2_40_cbc           "RC2-40-CBC"
+#define LN_rc2_40_cbc           "rc2-40-cbc"
+#define NID_rc2_40_cbc          98
+
+#define SN_rc2_64_cbc           "RC2-64-CBC"
+#define LN_rc2_64_cbc           "rc2-64-cbc"
+#define NID_rc2_64_cbc          166
+
+#define SN_rc4          "RC4"
+#define LN_rc4          "rc4"
+#define NID_rc4         5
+#define OBJ_rc4         OBJ_rsadsi,3L,4L
+
+#define SN_rc4_40               "RC4-40"
+#define LN_rc4_40               "rc4-40"
+#define NID_rc4_40              97
+
+#define SN_des_ede3_cbc         "DES-EDE3-CBC"
+#define LN_des_ede3_cbc         "des-ede3-cbc"
+#define NID_des_ede3_cbc                44
+#define OBJ_des_ede3_cbc                OBJ_rsadsi,3L,7L
+
+#define SN_rc5_cbc              "RC5-CBC"
+#define LN_rc5_cbc              "rc5-cbc"
+#define NID_rc5_cbc             120
+#define OBJ_rc5_cbc             OBJ_rsadsi,3L,8L
+
+#define SN_rc5_ecb              "RC5-ECB"
+#define LN_rc5_ecb              "rc5-ecb"
+#define NID_rc5_ecb             121
+
+#define SN_rc5_cfb64            "RC5-CFB"
+#define LN_rc5_cfb64            "rc5-cfb"
+#define NID_rc5_cfb64           122
+
+#define SN_rc5_ofb64            "RC5-OFB"
+#define LN_rc5_ofb64            "rc5-ofb"
+#define NID_rc5_ofb64           123
+
+#define SN_ms_ext_req           "msExtReq"
+#define LN_ms_ext_req           "Microsoft Extension Request"
+#define NID_ms_ext_req          171
+#define OBJ_ms_ext_req          1L,3L,6L,1L,4L,1L,311L,2L,1L,14L
+
+#define SN_ms_code_ind          "msCodeInd"
+#define LN_ms_code_ind          "Microsoft Individual Code Signing"
+#define NID_ms_code_ind         134
+#define OBJ_ms_code_ind         1L,3L,6L,1L,4L,1L,311L,2L,1L,21L
+
+#define SN_ms_code_com          "msCodeCom"
+#define LN_ms_code_com          "Microsoft Commercial Code Signing"
+#define NID_ms_code_com         135
+#define OBJ_ms_code_com         1L,3L,6L,1L,4L,1L,311L,2L,1L,22L
+
+#define SN_ms_ctl_sign          "msCTLSign"
+#define LN_ms_ctl_sign          "Microsoft Trust List Signing"
+#define NID_ms_ctl_sign         136
+#define OBJ_ms_ctl_sign         1L,3L,6L,1L,4L,1L,311L,10L,3L,1L
+
+#define SN_ms_sgc               "msSGC"
+#define LN_ms_sgc               "Microsoft Server Gated Crypto"
+#define NID_ms_sgc              137
+#define OBJ_ms_sgc              1L,3L,6L,1L,4L,1L,311L,10L,3L,3L
+
+#define SN_ms_efs               "msEFS"
+#define LN_ms_efs               "Microsoft Encrypted File System"
+#define NID_ms_efs              138
+#define OBJ_ms_efs              1L,3L,6L,1L,4L,1L,311L,10L,3L,4L
+
+#define SN_ms_smartcard_login           "msSmartcardLogin"
+#define LN_ms_smartcard_login           "Microsoft Smartcardlogin"
+#define NID_ms_smartcard_login          648
+#define OBJ_ms_smartcard_login          1L,3L,6L,1L,4L,1L,311L,20L,2L,2L
+
+#define SN_ms_upn               "msUPN"
+#define LN_ms_upn               "Microsoft Universal Principal Name"
+#define NID_ms_upn              649
+#define OBJ_ms_upn              1L,3L,6L,1L,4L,1L,311L,20L,2L,3L
+
+#define SN_idea_cbc             "IDEA-CBC"
+#define LN_idea_cbc             "idea-cbc"
+#define NID_idea_cbc            34
+#define OBJ_idea_cbc            1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L
+
+#define SN_idea_ecb             "IDEA-ECB"
+#define LN_idea_ecb             "idea-ecb"
+#define NID_idea_ecb            36
+
+#define SN_idea_cfb64           "IDEA-CFB"
+#define LN_idea_cfb64           "idea-cfb"
+#define NID_idea_cfb64          35
+
+#define SN_idea_ofb64           "IDEA-OFB"
+#define LN_idea_ofb64           "idea-ofb"
+#define NID_idea_ofb64          46
+
+#define SN_bf_cbc               "BF-CBC"
+#define LN_bf_cbc               "bf-cbc"
+#define NID_bf_cbc              91
+#define OBJ_bf_cbc              1L,3L,6L,1L,4L,1L,3029L,1L,2L
+
+#define SN_bf_ecb               "BF-ECB"
+#define LN_bf_ecb               "bf-ecb"
+#define NID_bf_ecb              92
+
+#define SN_bf_cfb64             "BF-CFB"
+#define LN_bf_cfb64             "bf-cfb"
+#define NID_bf_cfb64            93
+
+#define SN_bf_ofb64             "BF-OFB"
+#define LN_bf_ofb64             "bf-ofb"
+#define NID_bf_ofb64            94
+
+#define SN_id_pkix              "PKIX"
+#define NID_id_pkix             127
+#define OBJ_id_pkix             1L,3L,6L,1L,5L,5L,7L
+
+#define SN_id_pkix_mod          "id-pkix-mod"
+#define NID_id_pkix_mod         258
+#define OBJ_id_pkix_mod         OBJ_id_pkix,0L
+
+#define SN_id_pe                "id-pe"
+#define NID_id_pe               175
+#define OBJ_id_pe               OBJ_id_pkix,1L
+
+#define SN_id_qt                "id-qt"
+#define NID_id_qt               259
+#define OBJ_id_qt               OBJ_id_pkix,2L
+
+#define SN_id_kp                "id-kp"
+#define NID_id_kp               128
+#define OBJ_id_kp               OBJ_id_pkix,3L
+
+#define SN_id_it                "id-it"
+#define NID_id_it               260
+#define OBJ_id_it               OBJ_id_pkix,4L
+
+#define SN_id_pkip              "id-pkip"
+#define NID_id_pkip             261
+#define OBJ_id_pkip             OBJ_id_pkix,5L
+
+#define SN_id_alg               "id-alg"
+#define NID_id_alg              262
+#define OBJ_id_alg              OBJ_id_pkix,6L
+
+#define SN_id_cmc               "id-cmc"
+#define NID_id_cmc              263
+#define OBJ_id_cmc              OBJ_id_pkix,7L
+
+#define SN_id_on                "id-on"
+#define NID_id_on               264
+#define OBJ_id_on               OBJ_id_pkix,8L
+
+#define SN_id_pda               "id-pda"
+#define NID_id_pda              265
+#define OBJ_id_pda              OBJ_id_pkix,9L
+
+#define SN_id_aca               "id-aca"
+#define NID_id_aca              266
+#define OBJ_id_aca              OBJ_id_pkix,10L
+
+#define SN_id_qcs               "id-qcs"
+#define NID_id_qcs              267
+#define OBJ_id_qcs              OBJ_id_pkix,11L
+
+#define SN_id_cct               "id-cct"
+#define NID_id_cct              268
+#define OBJ_id_cct              OBJ_id_pkix,12L
+
+#define SN_id_ppl               "id-ppl"
+#define NID_id_ppl              662
+#define OBJ_id_ppl              OBJ_id_pkix,21L
+
+#define SN_id_ad                "id-ad"
+#define NID_id_ad               176
+#define OBJ_id_ad               OBJ_id_pkix,48L
+
+#define SN_id_pkix1_explicit_88         "id-pkix1-explicit-88"
+#define NID_id_pkix1_explicit_88                269
+#define OBJ_id_pkix1_explicit_88                OBJ_id_pkix_mod,1L
+
+#define SN_id_pkix1_implicit_88         "id-pkix1-implicit-88"
+#define NID_id_pkix1_implicit_88                270
+#define OBJ_id_pkix1_implicit_88                OBJ_id_pkix_mod,2L
+
+#define SN_id_pkix1_explicit_93         "id-pkix1-explicit-93"
+#define NID_id_pkix1_explicit_93                271
+#define OBJ_id_pkix1_explicit_93                OBJ_id_pkix_mod,3L
+
+#define SN_id_pkix1_implicit_93         "id-pkix1-implicit-93"
+#define NID_id_pkix1_implicit_93                272
+#define OBJ_id_pkix1_implicit_93                OBJ_id_pkix_mod,4L
+
+#define SN_id_mod_crmf          "id-mod-crmf"
+#define NID_id_mod_crmf         273
+#define OBJ_id_mod_crmf         OBJ_id_pkix_mod,5L
+
+#define SN_id_mod_cmc           "id-mod-cmc"
+#define NID_id_mod_cmc          274
+#define OBJ_id_mod_cmc          OBJ_id_pkix_mod,6L
+
+#define SN_id_mod_kea_profile_88                "id-mod-kea-profile-88"
+#define NID_id_mod_kea_profile_88               275
+#define OBJ_id_mod_kea_profile_88               OBJ_id_pkix_mod,7L
+
+#define SN_id_mod_kea_profile_93                "id-mod-kea-profile-93"
+#define NID_id_mod_kea_profile_93               276
+#define OBJ_id_mod_kea_profile_93               OBJ_id_pkix_mod,8L
+
+#define SN_id_mod_cmp           "id-mod-cmp"
+#define NID_id_mod_cmp          277
+#define OBJ_id_mod_cmp          OBJ_id_pkix_mod,9L
+
+#define SN_id_mod_qualified_cert_88             "id-mod-qualified-cert-88"
+#define NID_id_mod_qualified_cert_88            278
+#define OBJ_id_mod_qualified_cert_88            OBJ_id_pkix_mod,10L
+
+#define SN_id_mod_qualified_cert_93             "id-mod-qualified-cert-93"
+#define NID_id_mod_qualified_cert_93            279
+#define OBJ_id_mod_qualified_cert_93            OBJ_id_pkix_mod,11L
+
+#define SN_id_mod_attribute_cert                "id-mod-attribute-cert"
+#define NID_id_mod_attribute_cert               280
+#define OBJ_id_mod_attribute_cert               OBJ_id_pkix_mod,12L
+
+#define SN_id_mod_timestamp_protocol            "id-mod-timestamp-protocol"
+#define NID_id_mod_timestamp_protocol           281
+#define OBJ_id_mod_timestamp_protocol           OBJ_id_pkix_mod,13L
+
+#define SN_id_mod_ocsp          "id-mod-ocsp"
+#define NID_id_mod_ocsp         282
+#define OBJ_id_mod_ocsp         OBJ_id_pkix_mod,14L
+
+#define SN_id_mod_dvcs          "id-mod-dvcs"
+#define NID_id_mod_dvcs         283
+#define OBJ_id_mod_dvcs         OBJ_id_pkix_mod,15L
+
+#define SN_id_mod_cmp2000               "id-mod-cmp2000"
+#define NID_id_mod_cmp2000              284
+#define OBJ_id_mod_cmp2000              OBJ_id_pkix_mod,16L
+
+#define SN_info_access          "authorityInfoAccess"
+#define LN_info_access          "Authority Information Access"
+#define NID_info_access         177
+#define OBJ_info_access         OBJ_id_pe,1L
+
+#define SN_biometricInfo                "biometricInfo"
+#define LN_biometricInfo                "Biometric Info"
+#define NID_biometricInfo               285
+#define OBJ_biometricInfo               OBJ_id_pe,2L
+
+#define SN_qcStatements         "qcStatements"
+#define NID_qcStatements                286
+#define OBJ_qcStatements                OBJ_id_pe,3L
+
+#define SN_ac_auditEntity               "ac-auditEntity"
+#define NID_ac_auditEntity              287
+#define OBJ_ac_auditEntity              OBJ_id_pe,4L
+
+#define SN_ac_targeting         "ac-targeting"
+#define NID_ac_targeting                288
+#define OBJ_ac_targeting                OBJ_id_pe,5L
+
+#define SN_aaControls           "aaControls"
+#define NID_aaControls          289
+#define OBJ_aaControls          OBJ_id_pe,6L
+
+#define SN_sbgp_ipAddrBlock             "sbgp-ipAddrBlock"
+#define NID_sbgp_ipAddrBlock            290
+#define OBJ_sbgp_ipAddrBlock            OBJ_id_pe,7L
+
+#define SN_sbgp_autonomousSysNum                "sbgp-autonomousSysNum"
+#define NID_sbgp_autonomousSysNum               291
+#define OBJ_sbgp_autonomousSysNum               OBJ_id_pe,8L
+
+#define SN_sbgp_routerIdentifier                "sbgp-routerIdentifier"
+#define NID_sbgp_routerIdentifier               292
+#define OBJ_sbgp_routerIdentifier               OBJ_id_pe,9L
+
+#define SN_ac_proxying          "ac-proxying"
+#define NID_ac_proxying         397
+#define OBJ_ac_proxying         OBJ_id_pe,10L
+
+#define SN_sinfo_access         "subjectInfoAccess"
+#define LN_sinfo_access         "Subject Information Access"
+#define NID_sinfo_access                398
+#define OBJ_sinfo_access                OBJ_id_pe,11L
+
+#define SN_proxyCertInfo                "proxyCertInfo"
+#define LN_proxyCertInfo                "Proxy Certificate Information"
+#define NID_proxyCertInfo               663
+#define OBJ_proxyCertInfo               OBJ_id_pe,14L
+
+#define SN_id_qt_cps            "id-qt-cps"
+#define LN_id_qt_cps            "Policy Qualifier CPS"
+#define NID_id_qt_cps           164
+#define OBJ_id_qt_cps           OBJ_id_qt,1L
+
+#define SN_id_qt_unotice                "id-qt-unotice"
+#define LN_id_qt_unotice                "Policy Qualifier User Notice"
+#define NID_id_qt_unotice               165
+#define OBJ_id_qt_unotice               OBJ_id_qt,2L
+
+#define SN_textNotice           "textNotice"
+#define NID_textNotice          293
+#define OBJ_textNotice          OBJ_id_qt,3L
+
+#define SN_server_auth          "serverAuth"
+#define LN_server_auth          "TLS Web Server Authentication"
+#define NID_server_auth         129
+#define OBJ_server_auth         OBJ_id_kp,1L
+
+#define SN_client_auth          "clientAuth"
+#define LN_client_auth          "TLS Web Client Authentication"
+#define NID_client_auth         130
+#define OBJ_client_auth         OBJ_id_kp,2L
+
+#define SN_code_sign            "codeSigning"
+#define LN_code_sign            "Code Signing"
+#define NID_code_sign           131
+#define OBJ_code_sign           OBJ_id_kp,3L
+
+#define SN_email_protect                "emailProtection"
+#define LN_email_protect                "E-mail Protection"
+#define NID_email_protect               132
+#define OBJ_email_protect               OBJ_id_kp,4L
+
+#define SN_ipsecEndSystem               "ipsecEndSystem"
+#define LN_ipsecEndSystem               "IPSec End System"
+#define NID_ipsecEndSystem              294
+#define OBJ_ipsecEndSystem              OBJ_id_kp,5L
+
+#define SN_ipsecTunnel          "ipsecTunnel"
+#define LN_ipsecTunnel          "IPSec Tunnel"
+#define NID_ipsecTunnel         295
+#define OBJ_ipsecTunnel         OBJ_id_kp,6L
+
+#define SN_ipsecUser            "ipsecUser"
+#define LN_ipsecUser            "IPSec User"
+#define NID_ipsecUser           296
+#define OBJ_ipsecUser           OBJ_id_kp,7L
+
+#define SN_time_stamp           "timeStamping"
+#define LN_time_stamp           "Time Stamping"
+#define NID_time_stamp          133
+#define OBJ_time_stamp          OBJ_id_kp,8L
+
+#define SN_OCSP_sign            "OCSPSigning"
+#define LN_OCSP_sign            "OCSP Signing"
+#define NID_OCSP_sign           180
+#define OBJ_OCSP_sign           OBJ_id_kp,9L
+
+#define SN_dvcs         "DVCS"
+#define LN_dvcs         "dvcs"
+#define NID_dvcs                297
+#define OBJ_dvcs                OBJ_id_kp,10L
+
+#define SN_id_it_caProtEncCert          "id-it-caProtEncCert"
+#define NID_id_it_caProtEncCert         298
+#define OBJ_id_it_caProtEncCert         OBJ_id_it,1L
+
+#define SN_id_it_signKeyPairTypes               "id-it-signKeyPairTypes"
+#define NID_id_it_signKeyPairTypes              299
+#define OBJ_id_it_signKeyPairTypes              OBJ_id_it,2L
+
+#define SN_id_it_encKeyPairTypes                "id-it-encKeyPairTypes"
+#define NID_id_it_encKeyPairTypes               300
+#define OBJ_id_it_encKeyPairTypes               OBJ_id_it,3L
+
+#define SN_id_it_preferredSymmAlg               "id-it-preferredSymmAlg"
+#define NID_id_it_preferredSymmAlg              301
+#define OBJ_id_it_preferredSymmAlg              OBJ_id_it,4L
+
+#define SN_id_it_caKeyUpdateInfo                "id-it-caKeyUpdateInfo"
+#define NID_id_it_caKeyUpdateInfo               302
+#define OBJ_id_it_caKeyUpdateInfo               OBJ_id_it,5L
+
+#define SN_id_it_currentCRL             "id-it-currentCRL"
+#define NID_id_it_currentCRL            303
+#define OBJ_id_it_currentCRL            OBJ_id_it,6L
+
+#define SN_id_it_unsupportedOIDs                "id-it-unsupportedOIDs"
+#define NID_id_it_unsupportedOIDs               304
+#define OBJ_id_it_unsupportedOIDs               OBJ_id_it,7L
+
+#define SN_id_it_subscriptionRequest            "id-it-subscriptionRequest"
+#define NID_id_it_subscriptionRequest           305
+#define OBJ_id_it_subscriptionRequest           OBJ_id_it,8L
+
+#define SN_id_it_subscriptionResponse           "id-it-subscriptionResponse"
+#define NID_id_it_subscriptionResponse          306
+#define OBJ_id_it_subscriptionResponse          OBJ_id_it,9L
+
+#define SN_id_it_keyPairParamReq                "id-it-keyPairParamReq"
+#define NID_id_it_keyPairParamReq               307
+#define OBJ_id_it_keyPairParamReq               OBJ_id_it,10L
+
+#define SN_id_it_keyPairParamRep                "id-it-keyPairParamRep"
+#define NID_id_it_keyPairParamRep               308
+#define OBJ_id_it_keyPairParamRep               OBJ_id_it,11L
+
+#define SN_id_it_revPassphrase          "id-it-revPassphrase"
+#define NID_id_it_revPassphrase         309
+#define OBJ_id_it_revPassphrase         OBJ_id_it,12L
+
+#define SN_id_it_implicitConfirm                "id-it-implicitConfirm"
+#define NID_id_it_implicitConfirm               310
+#define OBJ_id_it_implicitConfirm               OBJ_id_it,13L
+
+#define SN_id_it_confirmWaitTime                "id-it-confirmWaitTime"
+#define NID_id_it_confirmWaitTime               311
+#define OBJ_id_it_confirmWaitTime               OBJ_id_it,14L
+
+#define SN_id_it_origPKIMessage         "id-it-origPKIMessage"
+#define NID_id_it_origPKIMessage                312
+#define OBJ_id_it_origPKIMessage                OBJ_id_it,15L
+
+#define SN_id_it_suppLangTags           "id-it-suppLangTags"
+#define NID_id_it_suppLangTags          784
+#define OBJ_id_it_suppLangTags          OBJ_id_it,16L
+
+#define SN_id_regCtrl           "id-regCtrl"
+#define NID_id_regCtrl          313
+#define OBJ_id_regCtrl          OBJ_id_pkip,1L
+
+#define SN_id_regInfo           "id-regInfo"
+#define NID_id_regInfo          314
+#define OBJ_id_regInfo          OBJ_id_pkip,2L
+
+#define SN_id_regCtrl_regToken          "id-regCtrl-regToken"
+#define NID_id_regCtrl_regToken         315
+#define OBJ_id_regCtrl_regToken         OBJ_id_regCtrl,1L
+
+#define SN_id_regCtrl_authenticator             "id-regCtrl-authenticator"
+#define NID_id_regCtrl_authenticator            316
+#define OBJ_id_regCtrl_authenticator            OBJ_id_regCtrl,2L
+
+#define SN_id_regCtrl_pkiPublicationInfo                "id-regCtrl-pkiPublicationInfo"
+#define NID_id_regCtrl_pkiPublicationInfo               317
+#define OBJ_id_regCtrl_pkiPublicationInfo               OBJ_id_regCtrl,3L
+
+#define SN_id_regCtrl_pkiArchiveOptions         "id-regCtrl-pkiArchiveOptions"
+#define NID_id_regCtrl_pkiArchiveOptions                318
+#define OBJ_id_regCtrl_pkiArchiveOptions                OBJ_id_regCtrl,4L
+
+#define SN_id_regCtrl_oldCertID         "id-regCtrl-oldCertID"
+#define NID_id_regCtrl_oldCertID                319
+#define OBJ_id_regCtrl_oldCertID                OBJ_id_regCtrl,5L
+
+#define SN_id_regCtrl_protocolEncrKey           "id-regCtrl-protocolEncrKey"
+#define NID_id_regCtrl_protocolEncrKey          320
+#define OBJ_id_regCtrl_protocolEncrKey          OBJ_id_regCtrl,6L
+
+#define SN_id_regInfo_utf8Pairs         "id-regInfo-utf8Pairs"
+#define NID_id_regInfo_utf8Pairs                321
+#define OBJ_id_regInfo_utf8Pairs                OBJ_id_regInfo,1L
+
+#define SN_id_regInfo_certReq           "id-regInfo-certReq"
+#define NID_id_regInfo_certReq          322
+#define OBJ_id_regInfo_certReq          OBJ_id_regInfo,2L
+
+#define SN_id_alg_des40         "id-alg-des40"
+#define NID_id_alg_des40                323
+#define OBJ_id_alg_des40                OBJ_id_alg,1L
+
+#define SN_id_alg_noSignature           "id-alg-noSignature"
+#define NID_id_alg_noSignature          324
+#define OBJ_id_alg_noSignature          OBJ_id_alg,2L
+
+#define SN_id_alg_dh_sig_hmac_sha1              "id-alg-dh-sig-hmac-sha1"
+#define NID_id_alg_dh_sig_hmac_sha1             325
+#define OBJ_id_alg_dh_sig_hmac_sha1             OBJ_id_alg,3L
+
+#define SN_id_alg_dh_pop                "id-alg-dh-pop"
+#define NID_id_alg_dh_pop               326
+#define OBJ_id_alg_dh_pop               OBJ_id_alg,4L
+
+#define SN_id_cmc_statusInfo            "id-cmc-statusInfo"
+#define NID_id_cmc_statusInfo           327
+#define OBJ_id_cmc_statusInfo           OBJ_id_cmc,1L
+
+#define SN_id_cmc_identification                "id-cmc-identification"
+#define NID_id_cmc_identification               328
+#define OBJ_id_cmc_identification               OBJ_id_cmc,2L
+
+#define SN_id_cmc_identityProof         "id-cmc-identityProof"
+#define NID_id_cmc_identityProof                329
+#define OBJ_id_cmc_identityProof                OBJ_id_cmc,3L
+
+#define SN_id_cmc_dataReturn            "id-cmc-dataReturn"
+#define NID_id_cmc_dataReturn           330
+#define OBJ_id_cmc_dataReturn           OBJ_id_cmc,4L
+
+#define SN_id_cmc_transactionId         "id-cmc-transactionId"
+#define NID_id_cmc_transactionId                331
+#define OBJ_id_cmc_transactionId                OBJ_id_cmc,5L
+
+#define SN_id_cmc_senderNonce           "id-cmc-senderNonce"
+#define NID_id_cmc_senderNonce          332
+#define OBJ_id_cmc_senderNonce          OBJ_id_cmc,6L
+
+#define SN_id_cmc_recipientNonce                "id-cmc-recipientNonce"
+#define NID_id_cmc_recipientNonce               333
+#define OBJ_id_cmc_recipientNonce               OBJ_id_cmc,7L
+
+#define SN_id_cmc_addExtensions         "id-cmc-addExtensions"
+#define NID_id_cmc_addExtensions                334
+#define OBJ_id_cmc_addExtensions                OBJ_id_cmc,8L
+
+#define SN_id_cmc_encryptedPOP          "id-cmc-encryptedPOP"
+#define NID_id_cmc_encryptedPOP         335
+#define OBJ_id_cmc_encryptedPOP         OBJ_id_cmc,9L
+
+#define SN_id_cmc_decryptedPOP          "id-cmc-decryptedPOP"
+#define NID_id_cmc_decryptedPOP         336
+#define OBJ_id_cmc_decryptedPOP         OBJ_id_cmc,10L
+
+#define SN_id_cmc_lraPOPWitness         "id-cmc-lraPOPWitness"
+#define NID_id_cmc_lraPOPWitness                337
+#define OBJ_id_cmc_lraPOPWitness                OBJ_id_cmc,11L
+
+#define SN_id_cmc_getCert               "id-cmc-getCert"
+#define NID_id_cmc_getCert              338
+#define OBJ_id_cmc_getCert              OBJ_id_cmc,15L
+
+#define SN_id_cmc_getCRL                "id-cmc-getCRL"
+#define NID_id_cmc_getCRL               339
+#define OBJ_id_cmc_getCRL               OBJ_id_cmc,16L
+
+#define SN_id_cmc_revokeRequest         "id-cmc-revokeRequest"
+#define NID_id_cmc_revokeRequest                340
+#define OBJ_id_cmc_revokeRequest                OBJ_id_cmc,17L
+
+#define SN_id_cmc_regInfo               "id-cmc-regInfo"
+#define NID_id_cmc_regInfo              341
+#define OBJ_id_cmc_regInfo              OBJ_id_cmc,18L
+
+#define SN_id_cmc_responseInfo          "id-cmc-responseInfo"
+#define NID_id_cmc_responseInfo         342
+#define OBJ_id_cmc_responseInfo         OBJ_id_cmc,19L
+
+#define SN_id_cmc_queryPending          "id-cmc-queryPending"
+#define NID_id_cmc_queryPending         343
+#define OBJ_id_cmc_queryPending         OBJ_id_cmc,21L
+
+#define SN_id_cmc_popLinkRandom         "id-cmc-popLinkRandom"
+#define NID_id_cmc_popLinkRandom                344
+#define OBJ_id_cmc_popLinkRandom                OBJ_id_cmc,22L
+
+#define SN_id_cmc_popLinkWitness                "id-cmc-popLinkWitness"
+#define NID_id_cmc_popLinkWitness               345
+#define OBJ_id_cmc_popLinkWitness               OBJ_id_cmc,23L
+
+#define SN_id_cmc_confirmCertAcceptance         "id-cmc-confirmCertAcceptance"
+#define NID_id_cmc_confirmCertAcceptance                346
+#define OBJ_id_cmc_confirmCertAcceptance                OBJ_id_cmc,24L
+
+#define SN_id_on_personalData           "id-on-personalData"
+#define NID_id_on_personalData          347
+#define OBJ_id_on_personalData          OBJ_id_on,1L
+
+#define SN_id_on_permanentIdentifier            "id-on-permanentIdentifier"
+#define LN_id_on_permanentIdentifier            "Permanent Identifier"
+#define NID_id_on_permanentIdentifier           858
+#define OBJ_id_on_permanentIdentifier           OBJ_id_on,3L
+
+#define SN_id_pda_dateOfBirth           "id-pda-dateOfBirth"
+#define NID_id_pda_dateOfBirth          348
+#define OBJ_id_pda_dateOfBirth          OBJ_id_pda,1L
+
+#define SN_id_pda_placeOfBirth          "id-pda-placeOfBirth"
+#define NID_id_pda_placeOfBirth         349
+#define OBJ_id_pda_placeOfBirth         OBJ_id_pda,2L
+
+#define SN_id_pda_gender                "id-pda-gender"
+#define NID_id_pda_gender               351
+#define OBJ_id_pda_gender               OBJ_id_pda,3L
+
+#define SN_id_pda_countryOfCitizenship          "id-pda-countryOfCitizenship"
+#define NID_id_pda_countryOfCitizenship         352
+#define OBJ_id_pda_countryOfCitizenship         OBJ_id_pda,4L
+
+#define SN_id_pda_countryOfResidence            "id-pda-countryOfResidence"
+#define NID_id_pda_countryOfResidence           353
+#define OBJ_id_pda_countryOfResidence           OBJ_id_pda,5L
+
+#define SN_id_aca_authenticationInfo            "id-aca-authenticationInfo"
+#define NID_id_aca_authenticationInfo           354
+#define OBJ_id_aca_authenticationInfo           OBJ_id_aca,1L
+
+#define SN_id_aca_accessIdentity                "id-aca-accessIdentity"
+#define NID_id_aca_accessIdentity               355
+#define OBJ_id_aca_accessIdentity               OBJ_id_aca,2L
+
+#define SN_id_aca_chargingIdentity              "id-aca-chargingIdentity"
+#define NID_id_aca_chargingIdentity             356
+#define OBJ_id_aca_chargingIdentity             OBJ_id_aca,3L
+
+#define SN_id_aca_group         "id-aca-group"
+#define NID_id_aca_group                357
+#define OBJ_id_aca_group                OBJ_id_aca,4L
+
+#define SN_id_aca_role          "id-aca-role"
+#define NID_id_aca_role         358
+#define OBJ_id_aca_role         OBJ_id_aca,5L
+
+#define SN_id_aca_encAttrs              "id-aca-encAttrs"
+#define NID_id_aca_encAttrs             399
+#define OBJ_id_aca_encAttrs             OBJ_id_aca,6L
+
+#define SN_id_qcs_pkixQCSyntax_v1               "id-qcs-pkixQCSyntax-v1"
+#define NID_id_qcs_pkixQCSyntax_v1              359
+#define OBJ_id_qcs_pkixQCSyntax_v1              OBJ_id_qcs,1L
+
+#define SN_id_cct_crs           "id-cct-crs"
+#define NID_id_cct_crs          360
+#define OBJ_id_cct_crs          OBJ_id_cct,1L
+
+#define SN_id_cct_PKIData               "id-cct-PKIData"
+#define NID_id_cct_PKIData              361
+#define OBJ_id_cct_PKIData              OBJ_id_cct,2L
+
+#define SN_id_cct_PKIResponse           "id-cct-PKIResponse"
+#define NID_id_cct_PKIResponse          362
+#define OBJ_id_cct_PKIResponse          OBJ_id_cct,3L
+
+#define SN_id_ppl_anyLanguage           "id-ppl-anyLanguage"
+#define LN_id_ppl_anyLanguage           "Any language"
+#define NID_id_ppl_anyLanguage          664
+#define OBJ_id_ppl_anyLanguage          OBJ_id_ppl,0L
+
+#define SN_id_ppl_inheritAll            "id-ppl-inheritAll"
+#define LN_id_ppl_inheritAll            "Inherit all"
+#define NID_id_ppl_inheritAll           665
+#define OBJ_id_ppl_inheritAll           OBJ_id_ppl,1L
+
+#define SN_Independent          "id-ppl-independent"
+#define LN_Independent          "Independent"
+#define NID_Independent         667
+#define OBJ_Independent         OBJ_id_ppl,2L
+
+#define SN_ad_OCSP              "OCSP"
+#define LN_ad_OCSP              "OCSP"
+#define NID_ad_OCSP             178
+#define OBJ_ad_OCSP             OBJ_id_ad,1L
+
+#define SN_ad_ca_issuers                "caIssuers"
+#define LN_ad_ca_issuers                "CA Issuers"
+#define NID_ad_ca_issuers               179
+#define OBJ_ad_ca_issuers               OBJ_id_ad,2L
+
+#define SN_ad_timeStamping              "ad_timestamping"
+#define LN_ad_timeStamping              "AD Time Stamping"
+#define NID_ad_timeStamping             363
+#define OBJ_ad_timeStamping             OBJ_id_ad,3L
+
+#define SN_ad_dvcs              "AD_DVCS"
+#define LN_ad_dvcs              "ad dvcs"
+#define NID_ad_dvcs             364
+#define OBJ_ad_dvcs             OBJ_id_ad,4L
+
+#define SN_caRepository         "caRepository"
+#define LN_caRepository         "CA Repository"
+#define NID_caRepository                785
+#define OBJ_caRepository                OBJ_id_ad,5L
+
+#define OBJ_id_pkix_OCSP                OBJ_ad_OCSP
+
+#define SN_id_pkix_OCSP_basic           "basicOCSPResponse"
+#define LN_id_pkix_OCSP_basic           "Basic OCSP Response"
+#define NID_id_pkix_OCSP_basic          365
+#define OBJ_id_pkix_OCSP_basic          OBJ_id_pkix_OCSP,1L
+
+#define SN_id_pkix_OCSP_Nonce           "Nonce"
+#define LN_id_pkix_OCSP_Nonce           "OCSP Nonce"
+#define NID_id_pkix_OCSP_Nonce          366
+#define OBJ_id_pkix_OCSP_Nonce          OBJ_id_pkix_OCSP,2L
+
+#define SN_id_pkix_OCSP_CrlID           "CrlID"
+#define LN_id_pkix_OCSP_CrlID           "OCSP CRL ID"
+#define NID_id_pkix_OCSP_CrlID          367
+#define OBJ_id_pkix_OCSP_CrlID          OBJ_id_pkix_OCSP,3L
+
+#define SN_id_pkix_OCSP_acceptableResponses             "acceptableResponses"
+#define LN_id_pkix_OCSP_acceptableResponses             "Acceptable OCSP Responses"
+#define NID_id_pkix_OCSP_acceptableResponses            368
+#define OBJ_id_pkix_OCSP_acceptableResponses            OBJ_id_pkix_OCSP,4L
+
+#define SN_id_pkix_OCSP_noCheck         "noCheck"
+#define LN_id_pkix_OCSP_noCheck         "OCSP No Check"
+#define NID_id_pkix_OCSP_noCheck                369
+#define OBJ_id_pkix_OCSP_noCheck                OBJ_id_pkix_OCSP,5L
+
+#define SN_id_pkix_OCSP_archiveCutoff           "archiveCutoff"
+#define LN_id_pkix_OCSP_archiveCutoff           "OCSP Archive Cutoff"
+#define NID_id_pkix_OCSP_archiveCutoff          370
+#define OBJ_id_pkix_OCSP_archiveCutoff          OBJ_id_pkix_OCSP,6L
+
+#define SN_id_pkix_OCSP_serviceLocator          "serviceLocator"
+#define LN_id_pkix_OCSP_serviceLocator          "OCSP Service Locator"
+#define NID_id_pkix_OCSP_serviceLocator         371
+#define OBJ_id_pkix_OCSP_serviceLocator         OBJ_id_pkix_OCSP,7L
+
+#define SN_id_pkix_OCSP_extendedStatus          "extendedStatus"
+#define LN_id_pkix_OCSP_extendedStatus          "Extended OCSP Status"
+#define NID_id_pkix_OCSP_extendedStatus         372
+#define OBJ_id_pkix_OCSP_extendedStatus         OBJ_id_pkix_OCSP,8L
+
+#define SN_id_pkix_OCSP_valid           "valid"
+#define NID_id_pkix_OCSP_valid          373
+#define OBJ_id_pkix_OCSP_valid          OBJ_id_pkix_OCSP,9L
+
+#define SN_id_pkix_OCSP_path            "path"
+#define NID_id_pkix_OCSP_path           374
+#define OBJ_id_pkix_OCSP_path           OBJ_id_pkix_OCSP,10L
+
+#define SN_id_pkix_OCSP_trustRoot               "trustRoot"
+#define LN_id_pkix_OCSP_trustRoot               "Trust Root"
+#define NID_id_pkix_OCSP_trustRoot              375
+#define OBJ_id_pkix_OCSP_trustRoot              OBJ_id_pkix_OCSP,11L
+
+#define SN_algorithm            "algorithm"
+#define LN_algorithm            "algorithm"
+#define NID_algorithm           376
+#define OBJ_algorithm           1L,3L,14L,3L,2L
+
+#define SN_md5WithRSA           "RSA-NP-MD5"
+#define LN_md5WithRSA           "md5WithRSA"
+#define NID_md5WithRSA          104
+#define OBJ_md5WithRSA          OBJ_algorithm,3L
+
+#define SN_des_ecb              "DES-ECB"
+#define LN_des_ecb              "des-ecb"
+#define NID_des_ecb             29
+#define OBJ_des_ecb             OBJ_algorithm,6L
+
+#define SN_des_cbc              "DES-CBC"
+#define LN_des_cbc              "des-cbc"
+#define NID_des_cbc             31
+#define OBJ_des_cbc             OBJ_algorithm,7L
+
+#define SN_des_ofb64            "DES-OFB"
+#define LN_des_ofb64            "des-ofb"
+#define NID_des_ofb64           45
+#define OBJ_des_ofb64           OBJ_algorithm,8L
+
+#define SN_des_cfb64            "DES-CFB"
+#define LN_des_cfb64            "des-cfb"
+#define NID_des_cfb64           30
+#define OBJ_des_cfb64           OBJ_algorithm,9L
+
+#define SN_rsaSignature         "rsaSignature"
+#define NID_rsaSignature                377
+#define OBJ_rsaSignature                OBJ_algorithm,11L
+
+#define SN_dsa_2                "DSA-old"
+#define LN_dsa_2                "dsaEncryption-old"
+#define NID_dsa_2               67
+#define OBJ_dsa_2               OBJ_algorithm,12L
+
+#define SN_dsaWithSHA           "DSA-SHA"
+#define LN_dsaWithSHA           "dsaWithSHA"
+#define NID_dsaWithSHA          66
+#define OBJ_dsaWithSHA          OBJ_algorithm,13L
+
+#define SN_shaWithRSAEncryption         "RSA-SHA"
+#define LN_shaWithRSAEncryption         "shaWithRSAEncryption"
+#define NID_shaWithRSAEncryption                42
+#define OBJ_shaWithRSAEncryption                OBJ_algorithm,15L
+
+#define SN_des_ede_ecb          "DES-EDE"
+#define LN_des_ede_ecb          "des-ede"
+#define NID_des_ede_ecb         32
+#define OBJ_des_ede_ecb         OBJ_algorithm,17L
+
+#define SN_des_ede3_ecb         "DES-EDE3"
+#define LN_des_ede3_ecb         "des-ede3"
+#define NID_des_ede3_ecb                33
+
+#define SN_des_ede_cbc          "DES-EDE-CBC"
+#define LN_des_ede_cbc          "des-ede-cbc"
+#define NID_des_ede_cbc         43
+
+#define SN_des_ede_cfb64                "DES-EDE-CFB"
+#define LN_des_ede_cfb64                "des-ede-cfb"
+#define NID_des_ede_cfb64               60
+
+#define SN_des_ede3_cfb64               "DES-EDE3-CFB"
+#define LN_des_ede3_cfb64               "des-ede3-cfb"
+#define NID_des_ede3_cfb64              61
+
+#define SN_des_ede_ofb64                "DES-EDE-OFB"
+#define LN_des_ede_ofb64                "des-ede-ofb"
+#define NID_des_ede_ofb64               62
+
+#define SN_des_ede3_ofb64               "DES-EDE3-OFB"
+#define LN_des_ede3_ofb64               "des-ede3-ofb"
+#define NID_des_ede3_ofb64              63
+
+#define SN_desx_cbc             "DESX-CBC"
+#define LN_desx_cbc             "desx-cbc"
+#define NID_desx_cbc            80
+
+#define SN_sha          "SHA"
+#define LN_sha          "sha"
+#define NID_sha         41
+#define OBJ_sha         OBJ_algorithm,18L
+
+#define SN_sha1         "SHA1"
+#define LN_sha1         "sha1"
+#define NID_sha1                64
+#define OBJ_sha1                OBJ_algorithm,26L
+
+#define SN_dsaWithSHA1_2                "DSA-SHA1-old"
+#define LN_dsaWithSHA1_2                "dsaWithSHA1-old"
+#define NID_dsaWithSHA1_2               70
+#define OBJ_dsaWithSHA1_2               OBJ_algorithm,27L
+
+#define SN_sha1WithRSA          "RSA-SHA1-2"
+#define LN_sha1WithRSA          "sha1WithRSA"
+#define NID_sha1WithRSA         115
+#define OBJ_sha1WithRSA         OBJ_algorithm,29L
+
+#define SN_ripemd160            "RIPEMD160"
+#define LN_ripemd160            "ripemd160"
+#define NID_ripemd160           117
+#define OBJ_ripemd160           1L,3L,36L,3L,2L,1L
+
+#define SN_ripemd160WithRSA             "RSA-RIPEMD160"
+#define LN_ripemd160WithRSA             "ripemd160WithRSA"
+#define NID_ripemd160WithRSA            119
+#define OBJ_ripemd160WithRSA            1L,3L,36L,3L,3L,1L,2L
+
+#define SN_sxnet                "SXNetID"
+#define LN_sxnet                "Strong Extranet ID"
+#define NID_sxnet               143
+#define OBJ_sxnet               1L,3L,101L,1L,4L,1L
+
+#define SN_X500         "X500"
+#define LN_X500         "directory services (X.500)"
+#define NID_X500                11
+#define OBJ_X500                2L,5L
+
+#define SN_X509         "X509"
+#define NID_X509                12
+#define OBJ_X509                OBJ_X500,4L
+
+#define SN_commonName           "CN"
+#define LN_commonName           "commonName"
+#define NID_commonName          13
+#define OBJ_commonName          OBJ_X509,3L
+
+#define SN_surname              "SN"
+#define LN_surname              "surname"
+#define NID_surname             100
+#define OBJ_surname             OBJ_X509,4L
+
+#define LN_serialNumber         "serialNumber"
+#define NID_serialNumber                105
+#define OBJ_serialNumber                OBJ_X509,5L
+
+#define SN_countryName          "C"
+#define LN_countryName          "countryName"
+#define NID_countryName         14
+#define OBJ_countryName         OBJ_X509,6L
+
+#define SN_localityName         "L"
+#define LN_localityName         "localityName"
+#define NID_localityName                15
+#define OBJ_localityName                OBJ_X509,7L
+
+#define SN_stateOrProvinceName          "ST"
+#define LN_stateOrProvinceName          "stateOrProvinceName"
+#define NID_stateOrProvinceName         16
+#define OBJ_stateOrProvinceName         OBJ_X509,8L
+
+#define SN_streetAddress                "street"
+#define LN_streetAddress                "streetAddress"
+#define NID_streetAddress               660
+#define OBJ_streetAddress               OBJ_X509,9L
+
+#define SN_organizationName             "O"
+#define LN_organizationName             "organizationName"
+#define NID_organizationName            17
+#define OBJ_organizationName            OBJ_X509,10L
+
+#define SN_organizationalUnitName               "OU"
+#define LN_organizationalUnitName               "organizationalUnitName"
+#define NID_organizationalUnitName              18
+#define OBJ_organizationalUnitName              OBJ_X509,11L
+
+#define SN_title                "title"
+#define LN_title                "title"
+#define NID_title               106
+#define OBJ_title               OBJ_X509,12L
+
+#define LN_description          "description"
+#define NID_description         107
+#define OBJ_description         OBJ_X509,13L
+
+#define LN_searchGuide          "searchGuide"
+#define NID_searchGuide         859
+#define OBJ_searchGuide         OBJ_X509,14L
+
+#define LN_businessCategory             "businessCategory"
+#define NID_businessCategory            860
+#define OBJ_businessCategory            OBJ_X509,15L
+
+#define LN_postalAddress                "postalAddress"
+#define NID_postalAddress               861
+#define OBJ_postalAddress               OBJ_X509,16L
+
+#define LN_postalCode           "postalCode"
+#define NID_postalCode          661
+#define OBJ_postalCode          OBJ_X509,17L
+
+#define LN_postOfficeBox                "postOfficeBox"
+#define NID_postOfficeBox               862
+#define OBJ_postOfficeBox               OBJ_X509,18L
+
+#define LN_physicalDeliveryOfficeName           "physicalDeliveryOfficeName"
+#define NID_physicalDeliveryOfficeName          863
+#define OBJ_physicalDeliveryOfficeName          OBJ_X509,19L
+
+#define LN_telephoneNumber              "telephoneNumber"
+#define NID_telephoneNumber             864
+#define OBJ_telephoneNumber             OBJ_X509,20L
+
+#define LN_telexNumber          "telexNumber"
+#define NID_telexNumber         865
+#define OBJ_telexNumber         OBJ_X509,21L
+
+#define LN_teletexTerminalIdentifier            "teletexTerminalIdentifier"
+#define NID_teletexTerminalIdentifier           866
+#define OBJ_teletexTerminalIdentifier           OBJ_X509,22L
+
+#define LN_facsimileTelephoneNumber             "facsimileTelephoneNumber"
+#define NID_facsimileTelephoneNumber            867
+#define OBJ_facsimileTelephoneNumber            OBJ_X509,23L
+
+#define LN_x121Address          "x121Address"
+#define NID_x121Address         868
+#define OBJ_x121Address         OBJ_X509,24L
+
+#define LN_internationaliSDNNumber              "internationaliSDNNumber"
+#define NID_internationaliSDNNumber             869
+#define OBJ_internationaliSDNNumber             OBJ_X509,25L
+
+#define LN_registeredAddress            "registeredAddress"
+#define NID_registeredAddress           870
+#define OBJ_registeredAddress           OBJ_X509,26L
+
+#define LN_destinationIndicator         "destinationIndicator"
+#define NID_destinationIndicator                871
+#define OBJ_destinationIndicator                OBJ_X509,27L
+
+#define LN_preferredDeliveryMethod              "preferredDeliveryMethod"
+#define NID_preferredDeliveryMethod             872
+#define OBJ_preferredDeliveryMethod             OBJ_X509,28L
+
+#define LN_presentationAddress          "presentationAddress"
+#define NID_presentationAddress         873
+#define OBJ_presentationAddress         OBJ_X509,29L
+
+#define LN_supportedApplicationContext          "supportedApplicationContext"
+#define NID_supportedApplicationContext         874
+#define OBJ_supportedApplicationContext         OBJ_X509,30L
+
+#define SN_member               "member"
+#define NID_member              875
+#define OBJ_member              OBJ_X509,31L
+
+#define SN_owner                "owner"
+#define NID_owner               876
+#define OBJ_owner               OBJ_X509,32L
+
+#define LN_roleOccupant         "roleOccupant"
+#define NID_roleOccupant                877
+#define OBJ_roleOccupant                OBJ_X509,33L
+
+#define SN_seeAlso              "seeAlso"
+#define NID_seeAlso             878
+#define OBJ_seeAlso             OBJ_X509,34L
+
+#define LN_userPassword         "userPassword"
+#define NID_userPassword                879
+#define OBJ_userPassword                OBJ_X509,35L
+
+#define LN_userCertificate              "userCertificate"
+#define NID_userCertificate             880
+#define OBJ_userCertificate             OBJ_X509,36L
+
+#define LN_cACertificate                "cACertificate"
+#define NID_cACertificate               881
+#define OBJ_cACertificate               OBJ_X509,37L
+
+#define LN_authorityRevocationList              "authorityRevocationList"
+#define NID_authorityRevocationList             882
+#define OBJ_authorityRevocationList             OBJ_X509,38L
+
+#define LN_certificateRevocationList            "certificateRevocationList"
+#define NID_certificateRevocationList           883
+#define OBJ_certificateRevocationList           OBJ_X509,39L
+
+#define LN_crossCertificatePair         "crossCertificatePair"
+#define NID_crossCertificatePair                884
+#define OBJ_crossCertificatePair                OBJ_X509,40L
+
+#define SN_name         "name"
+#define LN_name         "name"
+#define NID_name                173
+#define OBJ_name                OBJ_X509,41L
+
+#define SN_givenName            "GN"
+#define LN_givenName            "givenName"
+#define NID_givenName           99
+#define OBJ_givenName           OBJ_X509,42L
+
+#define SN_initials             "initials"
+#define LN_initials             "initials"
+#define NID_initials            101
+#define OBJ_initials            OBJ_X509,43L
+
+#define LN_generationQualifier          "generationQualifier"
+#define NID_generationQualifier         509
+#define OBJ_generationQualifier         OBJ_X509,44L
+
+#define LN_x500UniqueIdentifier         "x500UniqueIdentifier"
+#define NID_x500UniqueIdentifier                503
+#define OBJ_x500UniqueIdentifier                OBJ_X509,45L
+
+#define SN_dnQualifier          "dnQualifier"
+#define LN_dnQualifier          "dnQualifier"
+#define NID_dnQualifier         174
+#define OBJ_dnQualifier         OBJ_X509,46L
+
+#define LN_enhancedSearchGuide          "enhancedSearchGuide"
+#define NID_enhancedSearchGuide         885
+#define OBJ_enhancedSearchGuide         OBJ_X509,47L
+
+#define LN_protocolInformation          "protocolInformation"
+#define NID_protocolInformation         886
+#define OBJ_protocolInformation         OBJ_X509,48L
+
+#define LN_distinguishedName            "distinguishedName"
+#define NID_distinguishedName           887
+#define OBJ_distinguishedName           OBJ_X509,49L
+
+#define LN_uniqueMember         "uniqueMember"
+#define NID_uniqueMember                888
+#define OBJ_uniqueMember                OBJ_X509,50L
+
+#define LN_houseIdentifier              "houseIdentifier"
+#define NID_houseIdentifier             889
+#define OBJ_houseIdentifier             OBJ_X509,51L
+
+#define LN_supportedAlgorithms          "supportedAlgorithms"
+#define NID_supportedAlgorithms         890
+#define OBJ_supportedAlgorithms         OBJ_X509,52L
+
+#define LN_deltaRevocationList          "deltaRevocationList"
+#define NID_deltaRevocationList         891
+#define OBJ_deltaRevocationList         OBJ_X509,53L
+
+#define SN_dmdName              "dmdName"
+#define NID_dmdName             892
+#define OBJ_dmdName             OBJ_X509,54L
+
+#define LN_pseudonym            "pseudonym"
+#define NID_pseudonym           510
+#define OBJ_pseudonym           OBJ_X509,65L
+
+#define SN_role         "role"
+#define LN_role         "role"
+#define NID_role                400
+#define OBJ_role                OBJ_X509,72L
+
+#define SN_X500algorithms               "X500algorithms"
+#define LN_X500algorithms               "directory services - algorithms"
+#define NID_X500algorithms              378
+#define OBJ_X500algorithms              OBJ_X500,8L
+
+#define SN_rsa          "RSA"
+#define LN_rsa          "rsa"
+#define NID_rsa         19
+#define OBJ_rsa         OBJ_X500algorithms,1L,1L
+
+#define SN_mdc2WithRSA          "RSA-MDC2"
+#define LN_mdc2WithRSA          "mdc2WithRSA"
+#define NID_mdc2WithRSA         96
+#define OBJ_mdc2WithRSA         OBJ_X500algorithms,3L,100L
+
+#define SN_mdc2         "MDC2"
+#define LN_mdc2         "mdc2"
+#define NID_mdc2                95
+#define OBJ_mdc2                OBJ_X500algorithms,3L,101L
+
+#define SN_id_ce                "id-ce"
+#define NID_id_ce               81
+#define OBJ_id_ce               OBJ_X500,29L
+
+#define SN_subject_directory_attributes         "subjectDirectoryAttributes"
+#define LN_subject_directory_attributes         "X509v3 Subject Directory Attributes"
+#define NID_subject_directory_attributes                769
+#define OBJ_subject_directory_attributes                OBJ_id_ce,9L
+
+#define SN_subject_key_identifier               "subjectKeyIdentifier"
+#define LN_subject_key_identifier               "X509v3 Subject Key Identifier"
+#define NID_subject_key_identifier              82
+#define OBJ_subject_key_identifier              OBJ_id_ce,14L
+
+#define SN_key_usage            "keyUsage"
+#define LN_key_usage            "X509v3 Key Usage"
+#define NID_key_usage           83
+#define OBJ_key_usage           OBJ_id_ce,15L
+
+#define SN_private_key_usage_period             "privateKeyUsagePeriod"
+#define LN_private_key_usage_period             "X509v3 Private Key Usage Period"
+#define NID_private_key_usage_period            84
+#define OBJ_private_key_usage_period            OBJ_id_ce,16L
+
+#define SN_subject_alt_name             "subjectAltName"
+#define LN_subject_alt_name             "X509v3 Subject Alternative Name"
+#define NID_subject_alt_name            85
+#define OBJ_subject_alt_name            OBJ_id_ce,17L
+
+#define SN_issuer_alt_name              "issuerAltName"
+#define LN_issuer_alt_name              "X509v3 Issuer Alternative Name"
+#define NID_issuer_alt_name             86
+#define OBJ_issuer_alt_name             OBJ_id_ce,18L
+
+#define SN_basic_constraints            "basicConstraints"
+#define LN_basic_constraints            "X509v3 Basic Constraints"
+#define NID_basic_constraints           87
+#define OBJ_basic_constraints           OBJ_id_ce,19L
+
+#define SN_crl_number           "crlNumber"
+#define LN_crl_number           "X509v3 CRL Number"
+#define NID_crl_number          88
+#define OBJ_crl_number          OBJ_id_ce,20L
+
+#define SN_crl_reason           "CRLReason"
+#define LN_crl_reason           "X509v3 CRL Reason Code"
+#define NID_crl_reason          141
+#define OBJ_crl_reason          OBJ_id_ce,21L
+
+#define SN_invalidity_date              "invalidityDate"
+#define LN_invalidity_date              "Invalidity Date"
+#define NID_invalidity_date             142
+#define OBJ_invalidity_date             OBJ_id_ce,24L
+
+#define SN_delta_crl            "deltaCRL"
+#define LN_delta_crl            "X509v3 Delta CRL Indicator"
+#define NID_delta_crl           140
+#define OBJ_delta_crl           OBJ_id_ce,27L
+
+#define SN_issuing_distribution_point           "issuingDistributionPoint"
+#define LN_issuing_distribution_point           "X509v3 Issuing Distrubution Point"
+#define NID_issuing_distribution_point          770
+#define OBJ_issuing_distribution_point          OBJ_id_ce,28L
+
+#define SN_certificate_issuer           "certificateIssuer"
+#define LN_certificate_issuer           "X509v3 Certificate Issuer"
+#define NID_certificate_issuer          771
+#define OBJ_certificate_issuer          OBJ_id_ce,29L
+
+#define SN_name_constraints             "nameConstraints"
+#define LN_name_constraints             "X509v3 Name Constraints"
+#define NID_name_constraints            666
+#define OBJ_name_constraints            OBJ_id_ce,30L
+
+#define SN_crl_distribution_points              "crlDistributionPoints"
+#define LN_crl_distribution_points              "X509v3 CRL Distribution Points"
+#define NID_crl_distribution_points             103
+#define OBJ_crl_distribution_points             OBJ_id_ce,31L
+
+#define SN_certificate_policies         "certificatePolicies"
+#define LN_certificate_policies         "X509v3 Certificate Policies"
+#define NID_certificate_policies                89
+#define OBJ_certificate_policies                OBJ_id_ce,32L
+
+#define SN_any_policy           "anyPolicy"
+#define LN_any_policy           "X509v3 Any Policy"
+#define NID_any_policy          746
+#define OBJ_any_policy          OBJ_certificate_policies,0L
+
+#define SN_policy_mappings              "policyMappings"
+#define LN_policy_mappings              "X509v3 Policy Mappings"
+#define NID_policy_mappings             747
+#define OBJ_policy_mappings             OBJ_id_ce,33L
+
+#define SN_authority_key_identifier             "authorityKeyIdentifier"
+#define LN_authority_key_identifier             "X509v3 Authority Key Identifier"
+#define NID_authority_key_identifier            90
+#define OBJ_authority_key_identifier            OBJ_id_ce,35L
+
+#define SN_policy_constraints           "policyConstraints"
+#define LN_policy_constraints           "X509v3 Policy Constraints"
+#define NID_policy_constraints          401
+#define OBJ_policy_constraints          OBJ_id_ce,36L
+
+#define SN_ext_key_usage                "extendedKeyUsage"
+#define LN_ext_key_usage                "X509v3 Extended Key Usage"
+#define NID_ext_key_usage               126
+#define OBJ_ext_key_usage               OBJ_id_ce,37L
+
+#define SN_freshest_crl         "freshestCRL"
+#define LN_freshest_crl         "X509v3 Freshest CRL"
+#define NID_freshest_crl                857
+#define OBJ_freshest_crl                OBJ_id_ce,46L
+
+#define SN_inhibit_any_policy           "inhibitAnyPolicy"
+#define LN_inhibit_any_policy           "X509v3 Inhibit Any Policy"
+#define NID_inhibit_any_policy          748
+#define OBJ_inhibit_any_policy          OBJ_id_ce,54L
+
+#define SN_target_information           "targetInformation"
+#define LN_target_information           "X509v3 AC Targeting"
+#define NID_target_information          402
+#define OBJ_target_information          OBJ_id_ce,55L
+
+#define SN_no_rev_avail         "noRevAvail"
+#define LN_no_rev_avail         "X509v3 No Revocation Available"
+#define NID_no_rev_avail                403
+#define OBJ_no_rev_avail                OBJ_id_ce,56L
+
+#define SN_anyExtendedKeyUsage          "anyExtendedKeyUsage"
+#define LN_anyExtendedKeyUsage          "Any Extended Key Usage"
+#define NID_anyExtendedKeyUsage         910
+#define OBJ_anyExtendedKeyUsage         OBJ_ext_key_usage,0L
+
+#define SN_netscape             "Netscape"
+#define LN_netscape             "Netscape Communications Corp."
+#define NID_netscape            57
+#define OBJ_netscape            2L,16L,840L,1L,113730L
+
+#define SN_netscape_cert_extension              "nsCertExt"
+#define LN_netscape_cert_extension              "Netscape Certificate Extension"
+#define NID_netscape_cert_extension             58
+#define OBJ_netscape_cert_extension             OBJ_netscape,1L
+
+#define SN_netscape_data_type           "nsDataType"
+#define LN_netscape_data_type           "Netscape Data Type"
+#define NID_netscape_data_type          59
+#define OBJ_netscape_data_type          OBJ_netscape,2L
+
+#define SN_netscape_cert_type           "nsCertType"
+#define LN_netscape_cert_type           "Netscape Cert Type"
+#define NID_netscape_cert_type          71
+#define OBJ_netscape_cert_type          OBJ_netscape_cert_extension,1L
+
+#define SN_netscape_base_url            "nsBaseUrl"
+#define LN_netscape_base_url            "Netscape Base Url"
+#define NID_netscape_base_url           72
+#define OBJ_netscape_base_url           OBJ_netscape_cert_extension,2L
+
+#define SN_netscape_revocation_url              "nsRevocationUrl"
+#define LN_netscape_revocation_url              "Netscape Revocation Url"
+#define NID_netscape_revocation_url             73
+#define OBJ_netscape_revocation_url             OBJ_netscape_cert_extension,3L
+
+#define SN_netscape_ca_revocation_url           "nsCaRevocationUrl"
+#define LN_netscape_ca_revocation_url           "Netscape CA Revocation Url"
+#define NID_netscape_ca_revocation_url          74
+#define OBJ_netscape_ca_revocation_url          OBJ_netscape_cert_extension,4L
+
+#define SN_netscape_renewal_url         "nsRenewalUrl"
+#define LN_netscape_renewal_url         "Netscape Renewal Url"
+#define NID_netscape_renewal_url                75
+#define OBJ_netscape_renewal_url                OBJ_netscape_cert_extension,7L
+
+#define SN_netscape_ca_policy_url               "nsCaPolicyUrl"
+#define LN_netscape_ca_policy_url               "Netscape CA Policy Url"
+#define NID_netscape_ca_policy_url              76
+#define OBJ_netscape_ca_policy_url              OBJ_netscape_cert_extension,8L
+
+#define SN_netscape_ssl_server_name             "nsSslServerName"
+#define LN_netscape_ssl_server_name             "Netscape SSL Server Name"
+#define NID_netscape_ssl_server_name            77
+#define OBJ_netscape_ssl_server_name            OBJ_netscape_cert_extension,12L
+
+#define SN_netscape_comment             "nsComment"
+#define LN_netscape_comment             "Netscape Comment"
+#define NID_netscape_comment            78
+#define OBJ_netscape_comment            OBJ_netscape_cert_extension,13L
+
+#define SN_netscape_cert_sequence               "nsCertSequence"
+#define LN_netscape_cert_sequence               "Netscape Certificate Sequence"
+#define NID_netscape_cert_sequence              79
+#define OBJ_netscape_cert_sequence              OBJ_netscape_data_type,5L
+
+#define SN_ns_sgc               "nsSGC"
+#define LN_ns_sgc               "Netscape Server Gated Crypto"
+#define NID_ns_sgc              139
+#define OBJ_ns_sgc              OBJ_netscape,4L,1L
+
+#define SN_org          "ORG"
+#define LN_org          "org"
+#define NID_org         379
+#define OBJ_org         OBJ_iso,3L
+
+#define SN_dod          "DOD"
+#define LN_dod          "dod"
+#define NID_dod         380
+#define OBJ_dod         OBJ_org,6L
+
+#define SN_iana         "IANA"
+#define LN_iana         "iana"
+#define NID_iana                381
+#define OBJ_iana                OBJ_dod,1L
+
+#define OBJ_internet            OBJ_iana
+
+#define SN_Directory            "directory"
+#define LN_Directory            "Directory"
+#define NID_Directory           382
+#define OBJ_Directory           OBJ_internet,1L
+
+#define SN_Management           "mgmt"
+#define LN_Management           "Management"
+#define NID_Management          383
+#define OBJ_Management          OBJ_internet,2L
+
+#define SN_Experimental         "experimental"
+#define LN_Experimental         "Experimental"
+#define NID_Experimental                384
+#define OBJ_Experimental                OBJ_internet,3L
+
+#define SN_Private              "private"
+#define LN_Private              "Private"
+#define NID_Private             385
+#define OBJ_Private             OBJ_internet,4L
+
+#define SN_Security             "security"
+#define LN_Security             "Security"
+#define NID_Security            386
+#define OBJ_Security            OBJ_internet,5L
+
+#define SN_SNMPv2               "snmpv2"
+#define LN_SNMPv2               "SNMPv2"
+#define NID_SNMPv2              387
+#define OBJ_SNMPv2              OBJ_internet,6L
+
+#define LN_Mail         "Mail"
+#define NID_Mail                388
+#define OBJ_Mail                OBJ_internet,7L
+
+#define SN_Enterprises          "enterprises"
+#define LN_Enterprises          "Enterprises"
+#define NID_Enterprises         389
+#define OBJ_Enterprises         OBJ_Private,1L
+
+#define SN_dcObject             "dcobject"
+#define LN_dcObject             "dcObject"
+#define NID_dcObject            390
+#define OBJ_dcObject            OBJ_Enterprises,1466L,344L
+
+#define SN_mime_mhs             "mime-mhs"
+#define LN_mime_mhs             "MIME MHS"
+#define NID_mime_mhs            504
+#define OBJ_mime_mhs            OBJ_Mail,1L
+
+#define SN_mime_mhs_headings            "mime-mhs-headings"
+#define LN_mime_mhs_headings            "mime-mhs-headings"
+#define NID_mime_mhs_headings           505
+#define OBJ_mime_mhs_headings           OBJ_mime_mhs,1L
+
+#define SN_mime_mhs_bodies              "mime-mhs-bodies"
+#define LN_mime_mhs_bodies              "mime-mhs-bodies"
+#define NID_mime_mhs_bodies             506
+#define OBJ_mime_mhs_bodies             OBJ_mime_mhs,2L
+
+#define SN_id_hex_partial_message               "id-hex-partial-message"
+#define LN_id_hex_partial_message               "id-hex-partial-message"
+#define NID_id_hex_partial_message              507
+#define OBJ_id_hex_partial_message              OBJ_mime_mhs_headings,1L
+
+#define SN_id_hex_multipart_message             "id-hex-multipart-message"
+#define LN_id_hex_multipart_message             "id-hex-multipart-message"
+#define NID_id_hex_multipart_message            508
+#define OBJ_id_hex_multipart_message            OBJ_mime_mhs_headings,2L
+
+#define SN_rle_compression              "RLE"
+#define LN_rle_compression              "run length compression"
+#define NID_rle_compression             124
+#define OBJ_rle_compression             1L,1L,1L,1L,666L,1L
+
+#define SN_zlib_compression             "ZLIB"
+#define LN_zlib_compression             "zlib compression"
+#define NID_zlib_compression            125
+#define OBJ_zlib_compression            OBJ_id_smime_alg,8L
+
+#define OBJ_csor                2L,16L,840L,1L,101L,3L
+
+#define OBJ_nistAlgorithms              OBJ_csor,4L
+
+#define OBJ_aes         OBJ_nistAlgorithms,1L
+
+#define SN_aes_128_ecb          "AES-128-ECB"
+#define LN_aes_128_ecb          "aes-128-ecb"
+#define NID_aes_128_ecb         418
+#define OBJ_aes_128_ecb         OBJ_aes,1L
+
+#define SN_aes_128_cbc          "AES-128-CBC"
+#define LN_aes_128_cbc          "aes-128-cbc"
+#define NID_aes_128_cbc         419
+#define OBJ_aes_128_cbc         OBJ_aes,2L
+
+#define SN_aes_128_ofb128               "AES-128-OFB"
+#define LN_aes_128_ofb128               "aes-128-ofb"
+#define NID_aes_128_ofb128              420
+#define OBJ_aes_128_ofb128              OBJ_aes,3L
+
+#define SN_aes_128_cfb128               "AES-128-CFB"
+#define LN_aes_128_cfb128               "aes-128-cfb"
+#define NID_aes_128_cfb128              421
+#define OBJ_aes_128_cfb128              OBJ_aes,4L
+
+#define SN_id_aes128_wrap               "id-aes128-wrap"
+#define NID_id_aes128_wrap              788
+#define OBJ_id_aes128_wrap              OBJ_aes,5L
+
+#define SN_aes_128_gcm          "id-aes128-GCM"
+#define LN_aes_128_gcm          "aes-128-gcm"
+#define NID_aes_128_gcm         895
+#define OBJ_aes_128_gcm         OBJ_aes,6L
+
+#define SN_aes_128_ccm          "id-aes128-CCM"
+#define LN_aes_128_ccm          "aes-128-ccm"
+#define NID_aes_128_ccm         896
+#define OBJ_aes_128_ccm         OBJ_aes,7L
+
+#define SN_id_aes128_wrap_pad           "id-aes128-wrap-pad"
+#define NID_id_aes128_wrap_pad          897
+#define OBJ_id_aes128_wrap_pad          OBJ_aes,8L
+
+#define SN_aes_192_ecb          "AES-192-ECB"
+#define LN_aes_192_ecb          "aes-192-ecb"
+#define NID_aes_192_ecb         422
+#define OBJ_aes_192_ecb         OBJ_aes,21L
+
+#define SN_aes_192_cbc          "AES-192-CBC"
+#define LN_aes_192_cbc          "aes-192-cbc"
+#define NID_aes_192_cbc         423
+#define OBJ_aes_192_cbc         OBJ_aes,22L
+
+#define SN_aes_192_ofb128               "AES-192-OFB"
+#define LN_aes_192_ofb128               "aes-192-ofb"
+#define NID_aes_192_ofb128              424
+#define OBJ_aes_192_ofb128              OBJ_aes,23L
+
+#define SN_aes_192_cfb128               "AES-192-CFB"
+#define LN_aes_192_cfb128               "aes-192-cfb"
+#define NID_aes_192_cfb128              425
+#define OBJ_aes_192_cfb128              OBJ_aes,24L
+
+#define SN_id_aes192_wrap               "id-aes192-wrap"
+#define NID_id_aes192_wrap              789
+#define OBJ_id_aes192_wrap              OBJ_aes,25L
+
+#define SN_aes_192_gcm          "id-aes192-GCM"
+#define LN_aes_192_gcm          "aes-192-gcm"
+#define NID_aes_192_gcm         898
+#define OBJ_aes_192_gcm         OBJ_aes,26L
+
+#define SN_aes_192_ccm          "id-aes192-CCM"
+#define LN_aes_192_ccm          "aes-192-ccm"
+#define NID_aes_192_ccm         899
+#define OBJ_aes_192_ccm         OBJ_aes,27L
+
+#define SN_id_aes192_wrap_pad           "id-aes192-wrap-pad"
+#define NID_id_aes192_wrap_pad          900
+#define OBJ_id_aes192_wrap_pad          OBJ_aes,28L
+
+#define SN_aes_256_ecb          "AES-256-ECB"
+#define LN_aes_256_ecb          "aes-256-ecb"
+#define NID_aes_256_ecb         426
+#define OBJ_aes_256_ecb         OBJ_aes,41L
+
+#define SN_aes_256_cbc          "AES-256-CBC"
+#define LN_aes_256_cbc          "aes-256-cbc"
+#define NID_aes_256_cbc         427
+#define OBJ_aes_256_cbc         OBJ_aes,42L
+
+#define SN_aes_256_ofb128               "AES-256-OFB"
+#define LN_aes_256_ofb128               "aes-256-ofb"
+#define NID_aes_256_ofb128              428
+#define OBJ_aes_256_ofb128              OBJ_aes,43L
+
+#define SN_aes_256_cfb128               "AES-256-CFB"
+#define LN_aes_256_cfb128               "aes-256-cfb"
+#define NID_aes_256_cfb128              429
+#define OBJ_aes_256_cfb128              OBJ_aes,44L
+
+#define SN_id_aes256_wrap               "id-aes256-wrap"
+#define NID_id_aes256_wrap              790
+#define OBJ_id_aes256_wrap              OBJ_aes,45L
+
+#define SN_aes_256_gcm          "id-aes256-GCM"
+#define LN_aes_256_gcm          "aes-256-gcm"
+#define NID_aes_256_gcm         901
+#define OBJ_aes_256_gcm         OBJ_aes,46L
+
+#define SN_aes_256_ccm          "id-aes256-CCM"
+#define LN_aes_256_ccm          "aes-256-ccm"
+#define NID_aes_256_ccm         902
+#define OBJ_aes_256_ccm         OBJ_aes,47L
+
+#define SN_id_aes256_wrap_pad           "id-aes256-wrap-pad"
+#define NID_id_aes256_wrap_pad          903
+#define OBJ_id_aes256_wrap_pad          OBJ_aes,48L
+
+#define SN_aes_128_cfb1         "AES-128-CFB1"
+#define LN_aes_128_cfb1         "aes-128-cfb1"
+#define NID_aes_128_cfb1                650
+
+#define SN_aes_192_cfb1         "AES-192-CFB1"
+#define LN_aes_192_cfb1         "aes-192-cfb1"
+#define NID_aes_192_cfb1                651
+
+#define SN_aes_256_cfb1         "AES-256-CFB1"
+#define LN_aes_256_cfb1         "aes-256-cfb1"
+#define NID_aes_256_cfb1                652
+
+#define SN_aes_128_cfb8         "AES-128-CFB8"
+#define LN_aes_128_cfb8         "aes-128-cfb8"
+#define NID_aes_128_cfb8                653
+
+#define SN_aes_192_cfb8         "AES-192-CFB8"
+#define LN_aes_192_cfb8         "aes-192-cfb8"
+#define NID_aes_192_cfb8                654
+
+#define SN_aes_256_cfb8         "AES-256-CFB8"
+#define LN_aes_256_cfb8         "aes-256-cfb8"
+#define NID_aes_256_cfb8                655
+
+#define SN_aes_128_ctr          "AES-128-CTR"
+#define LN_aes_128_ctr          "aes-128-ctr"
+#define NID_aes_128_ctr         904
+
+#define SN_aes_192_ctr          "AES-192-CTR"
+#define LN_aes_192_ctr          "aes-192-ctr"
+#define NID_aes_192_ctr         905
+
+#define SN_aes_256_ctr          "AES-256-CTR"
+#define LN_aes_256_ctr          "aes-256-ctr"
+#define NID_aes_256_ctr         906
+
+#define SN_aes_128_xts          "AES-128-XTS"
+#define LN_aes_128_xts          "aes-128-xts"
+#define NID_aes_128_xts         913
+
+#define SN_aes_256_xts          "AES-256-XTS"
+#define LN_aes_256_xts          "aes-256-xts"
+#define NID_aes_256_xts         914
+
+#define SN_des_cfb1             "DES-CFB1"
+#define LN_des_cfb1             "des-cfb1"
+#define NID_des_cfb1            656
+
+#define SN_des_cfb8             "DES-CFB8"
+#define LN_des_cfb8             "des-cfb8"
+#define NID_des_cfb8            657
+
+#define SN_des_ede3_cfb1                "DES-EDE3-CFB1"
+#define LN_des_ede3_cfb1                "des-ede3-cfb1"
+#define NID_des_ede3_cfb1               658
+
+#define SN_des_ede3_cfb8                "DES-EDE3-CFB8"
+#define LN_des_ede3_cfb8                "des-ede3-cfb8"
+#define NID_des_ede3_cfb8               659
+
+#define OBJ_nist_hashalgs               OBJ_nistAlgorithms,2L
+
+#define SN_sha256               "SHA256"
+#define LN_sha256               "sha256"
+#define NID_sha256              672
+#define OBJ_sha256              OBJ_nist_hashalgs,1L
+
+#define SN_sha384               "SHA384"
+#define LN_sha384               "sha384"
+#define NID_sha384              673
+#define OBJ_sha384              OBJ_nist_hashalgs,2L
+
+#define SN_sha512               "SHA512"
+#define LN_sha512               "sha512"
+#define NID_sha512              674
+#define OBJ_sha512              OBJ_nist_hashalgs,3L
+
+#define SN_sha224               "SHA224"
+#define LN_sha224               "sha224"
+#define NID_sha224              675
+#define OBJ_sha224              OBJ_nist_hashalgs,4L
+
+#define OBJ_dsa_with_sha2               OBJ_nistAlgorithms,3L
+
+#define SN_dsa_with_SHA224              "dsa_with_SHA224"
+#define NID_dsa_with_SHA224             802
+#define OBJ_dsa_with_SHA224             OBJ_dsa_with_sha2,1L
+
+#define SN_dsa_with_SHA256              "dsa_with_SHA256"
+#define NID_dsa_with_SHA256             803
+#define OBJ_dsa_with_SHA256             OBJ_dsa_with_sha2,2L
+
+#define SN_hold_instruction_code                "holdInstructionCode"
+#define LN_hold_instruction_code                "Hold Instruction Code"
+#define NID_hold_instruction_code               430
+#define OBJ_hold_instruction_code               OBJ_id_ce,23L
+
+#define OBJ_holdInstruction             OBJ_X9_57,2L
+
+#define SN_hold_instruction_none                "holdInstructionNone"
+#define LN_hold_instruction_none                "Hold Instruction None"
+#define NID_hold_instruction_none               431
+#define OBJ_hold_instruction_none               OBJ_holdInstruction,1L
+
+#define SN_hold_instruction_call_issuer         "holdInstructionCallIssuer"
+#define LN_hold_instruction_call_issuer         "Hold Instruction Call Issuer"
+#define NID_hold_instruction_call_issuer                432
+#define OBJ_hold_instruction_call_issuer                OBJ_holdInstruction,2L
+
+#define SN_hold_instruction_reject              "holdInstructionReject"
+#define LN_hold_instruction_reject              "Hold Instruction Reject"
+#define NID_hold_instruction_reject             433
+#define OBJ_hold_instruction_reject             OBJ_holdInstruction,3L
+
+#define SN_data         "data"
+#define NID_data                434
+#define OBJ_data                OBJ_itu_t,9L
+
+#define SN_pss          "pss"
+#define NID_pss         435
+#define OBJ_pss         OBJ_data,2342L
+
+#define SN_ucl          "ucl"
+#define NID_ucl         436
+#define OBJ_ucl         OBJ_pss,19200300L
+
+#define SN_pilot                "pilot"
+#define NID_pilot               437
+#define OBJ_pilot               OBJ_ucl,100L
+
+#define LN_pilotAttributeType           "pilotAttributeType"
+#define NID_pilotAttributeType          438
+#define OBJ_pilotAttributeType          OBJ_pilot,1L
+
+#define LN_pilotAttributeSyntax         "pilotAttributeSyntax"
+#define NID_pilotAttributeSyntax                439
+#define OBJ_pilotAttributeSyntax                OBJ_pilot,3L
+
+#define LN_pilotObjectClass             "pilotObjectClass"
+#define NID_pilotObjectClass            440
+#define OBJ_pilotObjectClass            OBJ_pilot,4L
+
+#define LN_pilotGroups          "pilotGroups"
+#define NID_pilotGroups         441
+#define OBJ_pilotGroups         OBJ_pilot,10L
+
+#define LN_iA5StringSyntax              "iA5StringSyntax"
+#define NID_iA5StringSyntax             442
+#define OBJ_iA5StringSyntax             OBJ_pilotAttributeSyntax,4L
+
+#define LN_caseIgnoreIA5StringSyntax            "caseIgnoreIA5StringSyntax"
+#define NID_caseIgnoreIA5StringSyntax           443
+#define OBJ_caseIgnoreIA5StringSyntax           OBJ_pilotAttributeSyntax,5L
+
+#define LN_pilotObject          "pilotObject"
+#define NID_pilotObject         444
+#define OBJ_pilotObject         OBJ_pilotObjectClass,3L
+
+#define LN_pilotPerson          "pilotPerson"
+#define NID_pilotPerson         445
+#define OBJ_pilotPerson         OBJ_pilotObjectClass,4L
+
+#define SN_account              "account"
+#define NID_account             446
+#define OBJ_account             OBJ_pilotObjectClass,5L
+
+#define SN_document             "document"
+#define NID_document            447
+#define OBJ_document            OBJ_pilotObjectClass,6L
+
+#define SN_room         "room"
+#define NID_room                448
+#define OBJ_room                OBJ_pilotObjectClass,7L
+
+#define LN_documentSeries               "documentSeries"
+#define NID_documentSeries              449
+#define OBJ_documentSeries              OBJ_pilotObjectClass,9L
+
+#define SN_Domain               "domain"
+#define LN_Domain               "Domain"
+#define NID_Domain              392
+#define OBJ_Domain              OBJ_pilotObjectClass,13L
+
+#define LN_rFC822localPart              "rFC822localPart"
+#define NID_rFC822localPart             450
+#define OBJ_rFC822localPart             OBJ_pilotObjectClass,14L
+
+#define LN_dNSDomain            "dNSDomain"
+#define NID_dNSDomain           451
+#define OBJ_dNSDomain           OBJ_pilotObjectClass,15L
+
+#define LN_domainRelatedObject          "domainRelatedObject"
+#define NID_domainRelatedObject         452
+#define OBJ_domainRelatedObject         OBJ_pilotObjectClass,17L
+
+#define LN_friendlyCountry              "friendlyCountry"
+#define NID_friendlyCountry             453
+#define OBJ_friendlyCountry             OBJ_pilotObjectClass,18L
+
+#define LN_simpleSecurityObject         "simpleSecurityObject"
+#define NID_simpleSecurityObject                454
+#define OBJ_simpleSecurityObject                OBJ_pilotObjectClass,19L
+
+#define LN_pilotOrganization            "pilotOrganization"
+#define NID_pilotOrganization           455
+#define OBJ_pilotOrganization           OBJ_pilotObjectClass,20L
+
+#define LN_pilotDSA             "pilotDSA"
+#define NID_pilotDSA            456
+#define OBJ_pilotDSA            OBJ_pilotObjectClass,21L
+
+#define LN_qualityLabelledData          "qualityLabelledData"
+#define NID_qualityLabelledData         457
+#define OBJ_qualityLabelledData         OBJ_pilotObjectClass,22L
+
+#define SN_userId               "UID"
+#define LN_userId               "userId"
+#define NID_userId              458
+#define OBJ_userId              OBJ_pilotAttributeType,1L
+
+#define LN_textEncodedORAddress         "textEncodedORAddress"
+#define NID_textEncodedORAddress                459
+#define OBJ_textEncodedORAddress                OBJ_pilotAttributeType,2L
+
+#define SN_rfc822Mailbox                "mail"
+#define LN_rfc822Mailbox                "rfc822Mailbox"
+#define NID_rfc822Mailbox               460
+#define OBJ_rfc822Mailbox               OBJ_pilotAttributeType,3L
+
+#define SN_info         "info"
+#define NID_info                461
+#define OBJ_info                OBJ_pilotAttributeType,4L
+
+#define LN_favouriteDrink               "favouriteDrink"
+#define NID_favouriteDrink              462
+#define OBJ_favouriteDrink              OBJ_pilotAttributeType,5L
+
+#define LN_roomNumber           "roomNumber"
+#define NID_roomNumber          463
+#define OBJ_roomNumber          OBJ_pilotAttributeType,6L
+
+#define SN_photo                "photo"
+#define NID_photo               464
+#define OBJ_photo               OBJ_pilotAttributeType,7L
+
+#define LN_userClass            "userClass"
+#define NID_userClass           465
+#define OBJ_userClass           OBJ_pilotAttributeType,8L
+
+#define SN_host         "host"
+#define NID_host                466
+#define OBJ_host                OBJ_pilotAttributeType,9L
+
+#define SN_manager              "manager"
+#define NID_manager             467
+#define OBJ_manager             OBJ_pilotAttributeType,10L
+
+#define LN_documentIdentifier           "documentIdentifier"
+#define NID_documentIdentifier          468
+#define OBJ_documentIdentifier          OBJ_pilotAttributeType,11L
+
+#define LN_documentTitle                "documentTitle"
+#define NID_documentTitle               469
+#define OBJ_documentTitle               OBJ_pilotAttributeType,12L
+
+#define LN_documentVersion              "documentVersion"
+#define NID_documentVersion             470
+#define OBJ_documentVersion             OBJ_pilotAttributeType,13L
+
+#define LN_documentAuthor               "documentAuthor"
+#define NID_documentAuthor              471
+#define OBJ_documentAuthor              OBJ_pilotAttributeType,14L
+
+#define LN_documentLocation             "documentLocation"
+#define NID_documentLocation            472
+#define OBJ_documentLocation            OBJ_pilotAttributeType,15L
+
+#define LN_homeTelephoneNumber          "homeTelephoneNumber"
+#define NID_homeTelephoneNumber         473
+#define OBJ_homeTelephoneNumber         OBJ_pilotAttributeType,20L
+
+#define SN_secretary            "secretary"
+#define NID_secretary           474
+#define OBJ_secretary           OBJ_pilotAttributeType,21L
+
+#define LN_otherMailbox         "otherMailbox"
+#define NID_otherMailbox                475
+#define OBJ_otherMailbox                OBJ_pilotAttributeType,22L
+
+#define LN_lastModifiedTime             "lastModifiedTime"
+#define NID_lastModifiedTime            476
+#define OBJ_lastModifiedTime            OBJ_pilotAttributeType,23L
+
+#define LN_lastModifiedBy               "lastModifiedBy"
+#define NID_lastModifiedBy              477
+#define OBJ_lastModifiedBy              OBJ_pilotAttributeType,24L
+
+#define SN_domainComponent              "DC"
+#define LN_domainComponent              "domainComponent"
+#define NID_domainComponent             391
+#define OBJ_domainComponent             OBJ_pilotAttributeType,25L
+
+#define LN_aRecord              "aRecord"
+#define NID_aRecord             478
+#define OBJ_aRecord             OBJ_pilotAttributeType,26L
+
+#define LN_pilotAttributeType27         "pilotAttributeType27"
+#define NID_pilotAttributeType27                479
+#define OBJ_pilotAttributeType27                OBJ_pilotAttributeType,27L
+
+#define LN_mXRecord             "mXRecord"
+#define NID_mXRecord            480
+#define OBJ_mXRecord            OBJ_pilotAttributeType,28L
+
+#define LN_nSRecord             "nSRecord"
+#define NID_nSRecord            481
+#define OBJ_nSRecord            OBJ_pilotAttributeType,29L
+
+#define LN_sOARecord            "sOARecord"
+#define NID_sOARecord           482
+#define OBJ_sOARecord           OBJ_pilotAttributeType,30L
+
+#define LN_cNAMERecord          "cNAMERecord"
+#define NID_cNAMERecord         483
+#define OBJ_cNAMERecord         OBJ_pilotAttributeType,31L
+
+#define LN_associatedDomain             "associatedDomain"
+#define NID_associatedDomain            484
+#define OBJ_associatedDomain            OBJ_pilotAttributeType,37L
+
+#define LN_associatedName               "associatedName"
+#define NID_associatedName              485
+#define OBJ_associatedName              OBJ_pilotAttributeType,38L
+
+#define LN_homePostalAddress            "homePostalAddress"
+#define NID_homePostalAddress           486
+#define OBJ_homePostalAddress           OBJ_pilotAttributeType,39L
+
+#define LN_personalTitle                "personalTitle"
+#define NID_personalTitle               487
+#define OBJ_personalTitle               OBJ_pilotAttributeType,40L
+
+#define LN_mobileTelephoneNumber                "mobileTelephoneNumber"
+#define NID_mobileTelephoneNumber               488
+#define OBJ_mobileTelephoneNumber               OBJ_pilotAttributeType,41L
+
+#define LN_pagerTelephoneNumber         "pagerTelephoneNumber"
+#define NID_pagerTelephoneNumber                489
+#define OBJ_pagerTelephoneNumber                OBJ_pilotAttributeType,42L
+
+#define LN_friendlyCountryName          "friendlyCountryName"
+#define NID_friendlyCountryName         490
+#define OBJ_friendlyCountryName         OBJ_pilotAttributeType,43L
+
+#define LN_organizationalStatus         "organizationalStatus"
+#define NID_organizationalStatus                491
+#define OBJ_organizationalStatus                OBJ_pilotAttributeType,45L
+
+#define LN_janetMailbox         "janetMailbox"
+#define NID_janetMailbox                492
+#define OBJ_janetMailbox                OBJ_pilotAttributeType,46L
+
+#define LN_mailPreferenceOption         "mailPreferenceOption"
+#define NID_mailPreferenceOption                493
+#define OBJ_mailPreferenceOption                OBJ_pilotAttributeType,47L
+
+#define LN_buildingName         "buildingName"
+#define NID_buildingName                494
+#define OBJ_buildingName                OBJ_pilotAttributeType,48L
+
+#define LN_dSAQuality           "dSAQuality"
+#define NID_dSAQuality          495
+#define OBJ_dSAQuality          OBJ_pilotAttributeType,49L
+
+#define LN_singleLevelQuality           "singleLevelQuality"
+#define NID_singleLevelQuality          496
+#define OBJ_singleLevelQuality          OBJ_pilotAttributeType,50L
+
+#define LN_subtreeMinimumQuality                "subtreeMinimumQuality"
+#define NID_subtreeMinimumQuality               497
+#define OBJ_subtreeMinimumQuality               OBJ_pilotAttributeType,51L
+
+#define LN_subtreeMaximumQuality                "subtreeMaximumQuality"
+#define NID_subtreeMaximumQuality               498
+#define OBJ_subtreeMaximumQuality               OBJ_pilotAttributeType,52L
+
+#define LN_personalSignature            "personalSignature"
+#define NID_personalSignature           499
+#define OBJ_personalSignature           OBJ_pilotAttributeType,53L
+
+#define LN_dITRedirect          "dITRedirect"
+#define NID_dITRedirect         500
+#define OBJ_dITRedirect         OBJ_pilotAttributeType,54L
+
+#define SN_audio                "audio"
+#define NID_audio               501
+#define OBJ_audio               OBJ_pilotAttributeType,55L
+
+#define LN_documentPublisher            "documentPublisher"
+#define NID_documentPublisher           502
+#define OBJ_documentPublisher           OBJ_pilotAttributeType,56L
+
+#define SN_id_set               "id-set"
+#define LN_id_set               "Secure Electronic Transactions"
+#define NID_id_set              512
+#define OBJ_id_set              OBJ_international_organizations,42L
+
+#define SN_set_ctype            "set-ctype"
+#define LN_set_ctype            "content types"
+#define NID_set_ctype           513
+#define OBJ_set_ctype           OBJ_id_set,0L
+
+#define SN_set_msgExt           "set-msgExt"
+#define LN_set_msgExt           "message extensions"
+#define NID_set_msgExt          514
+#define OBJ_set_msgExt          OBJ_id_set,1L
+
+#define SN_set_attr             "set-attr"
+#define NID_set_attr            515
+#define OBJ_set_attr            OBJ_id_set,3L
+
+#define SN_set_policy           "set-policy"
+#define NID_set_policy          516
+#define OBJ_set_policy          OBJ_id_set,5L
+
+#define SN_set_certExt          "set-certExt"
+#define LN_set_certExt          "certificate extensions"
+#define NID_set_certExt         517
+#define OBJ_set_certExt         OBJ_id_set,7L
+
+#define SN_set_brand            "set-brand"
+#define NID_set_brand           518
+#define OBJ_set_brand           OBJ_id_set,8L
+
+#define SN_setct_PANData                "setct-PANData"
+#define NID_setct_PANData               519
+#define OBJ_setct_PANData               OBJ_set_ctype,0L
+
+#define SN_setct_PANToken               "setct-PANToken"
+#define NID_setct_PANToken              520
+#define OBJ_setct_PANToken              OBJ_set_ctype,1L
+
+#define SN_setct_PANOnly                "setct-PANOnly"
+#define NID_setct_PANOnly               521
+#define OBJ_setct_PANOnly               OBJ_set_ctype,2L
+
+#define SN_setct_OIData         "setct-OIData"
+#define NID_setct_OIData                522
+#define OBJ_setct_OIData                OBJ_set_ctype,3L
+
+#define SN_setct_PI             "setct-PI"
+#define NID_setct_PI            523
+#define OBJ_setct_PI            OBJ_set_ctype,4L
+
+#define SN_setct_PIData         "setct-PIData"
+#define NID_setct_PIData                524
+#define OBJ_setct_PIData                OBJ_set_ctype,5L
+
+#define SN_setct_PIDataUnsigned         "setct-PIDataUnsigned"
+#define NID_setct_PIDataUnsigned                525
+#define OBJ_setct_PIDataUnsigned                OBJ_set_ctype,6L
+
+#define SN_setct_HODInput               "setct-HODInput"
+#define NID_setct_HODInput              526
+#define OBJ_setct_HODInput              OBJ_set_ctype,7L
+
+#define SN_setct_AuthResBaggage         "setct-AuthResBaggage"
+#define NID_setct_AuthResBaggage                527
+#define OBJ_setct_AuthResBaggage                OBJ_set_ctype,8L
+
+#define SN_setct_AuthRevReqBaggage              "setct-AuthRevReqBaggage"
+#define NID_setct_AuthRevReqBaggage             528
+#define OBJ_setct_AuthRevReqBaggage             OBJ_set_ctype,9L
+
+#define SN_setct_AuthRevResBaggage              "setct-AuthRevResBaggage"
+#define NID_setct_AuthRevResBaggage             529
+#define OBJ_setct_AuthRevResBaggage             OBJ_set_ctype,10L
+
+#define SN_setct_CapTokenSeq            "setct-CapTokenSeq"
+#define NID_setct_CapTokenSeq           530
+#define OBJ_setct_CapTokenSeq           OBJ_set_ctype,11L
+
+#define SN_setct_PInitResData           "setct-PInitResData"
+#define NID_setct_PInitResData          531
+#define OBJ_setct_PInitResData          OBJ_set_ctype,12L
+
+#define SN_setct_PI_TBS         "setct-PI-TBS"
+#define NID_setct_PI_TBS                532
+#define OBJ_setct_PI_TBS                OBJ_set_ctype,13L
+
+#define SN_setct_PResData               "setct-PResData"
+#define NID_setct_PResData              533
+#define OBJ_setct_PResData              OBJ_set_ctype,14L
+
+#define SN_setct_AuthReqTBS             "setct-AuthReqTBS"
+#define NID_setct_AuthReqTBS            534
+#define OBJ_setct_AuthReqTBS            OBJ_set_ctype,16L
+
+#define SN_setct_AuthResTBS             "setct-AuthResTBS"
+#define NID_setct_AuthResTBS            535
+#define OBJ_setct_AuthResTBS            OBJ_set_ctype,17L
+
+#define SN_setct_AuthResTBSX            "setct-AuthResTBSX"
+#define NID_setct_AuthResTBSX           536
+#define OBJ_setct_AuthResTBSX           OBJ_set_ctype,18L
+
+#define SN_setct_AuthTokenTBS           "setct-AuthTokenTBS"
+#define NID_setct_AuthTokenTBS          537
+#define OBJ_setct_AuthTokenTBS          OBJ_set_ctype,19L
+
+#define SN_setct_CapTokenData           "setct-CapTokenData"
+#define NID_setct_CapTokenData          538
+#define OBJ_setct_CapTokenData          OBJ_set_ctype,20L
+
+#define SN_setct_CapTokenTBS            "setct-CapTokenTBS"
+#define NID_setct_CapTokenTBS           539
+#define OBJ_setct_CapTokenTBS           OBJ_set_ctype,21L
+
+#define SN_setct_AcqCardCodeMsg         "setct-AcqCardCodeMsg"
+#define NID_setct_AcqCardCodeMsg                540
+#define OBJ_setct_AcqCardCodeMsg                OBJ_set_ctype,22L
+
+#define SN_setct_AuthRevReqTBS          "setct-AuthRevReqTBS"
+#define NID_setct_AuthRevReqTBS         541
+#define OBJ_setct_AuthRevReqTBS         OBJ_set_ctype,23L
+
+#define SN_setct_AuthRevResData         "setct-AuthRevResData"
+#define NID_setct_AuthRevResData                542
+#define OBJ_setct_AuthRevResData                OBJ_set_ctype,24L
+
+#define SN_setct_AuthRevResTBS          "setct-AuthRevResTBS"
+#define NID_setct_AuthRevResTBS         543
+#define OBJ_setct_AuthRevResTBS         OBJ_set_ctype,25L
+
+#define SN_setct_CapReqTBS              "setct-CapReqTBS"
+#define NID_setct_CapReqTBS             544
+#define OBJ_setct_CapReqTBS             OBJ_set_ctype,26L
+
+#define SN_setct_CapReqTBSX             "setct-CapReqTBSX"
+#define NID_setct_CapReqTBSX            545
+#define OBJ_setct_CapReqTBSX            OBJ_set_ctype,27L
+
+#define SN_setct_CapResData             "setct-CapResData"
+#define NID_setct_CapResData            546
+#define OBJ_setct_CapResData            OBJ_set_ctype,28L
+
+#define SN_setct_CapRevReqTBS           "setct-CapRevReqTBS"
+#define NID_setct_CapRevReqTBS          547
+#define OBJ_setct_CapRevReqTBS          OBJ_set_ctype,29L
+
+#define SN_setct_CapRevReqTBSX          "setct-CapRevReqTBSX"
+#define NID_setct_CapRevReqTBSX         548
+#define OBJ_setct_CapRevReqTBSX         OBJ_set_ctype,30L
+
+#define SN_setct_CapRevResData          "setct-CapRevResData"
+#define NID_setct_CapRevResData         549
+#define OBJ_setct_CapRevResData         OBJ_set_ctype,31L
+
+#define SN_setct_CredReqTBS             "setct-CredReqTBS"
+#define NID_setct_CredReqTBS            550
+#define OBJ_setct_CredReqTBS            OBJ_set_ctype,32L
+
+#define SN_setct_CredReqTBSX            "setct-CredReqTBSX"
+#define NID_setct_CredReqTBSX           551
+#define OBJ_setct_CredReqTBSX           OBJ_set_ctype,33L
+
+#define SN_setct_CredResData            "setct-CredResData"
+#define NID_setct_CredResData           552
+#define OBJ_setct_CredResData           OBJ_set_ctype,34L
+
+#define SN_setct_CredRevReqTBS          "setct-CredRevReqTBS"
+#define NID_setct_CredRevReqTBS         553
+#define OBJ_setct_CredRevReqTBS         OBJ_set_ctype,35L
+
+#define SN_setct_CredRevReqTBSX         "setct-CredRevReqTBSX"
+#define NID_setct_CredRevReqTBSX                554
+#define OBJ_setct_CredRevReqTBSX                OBJ_set_ctype,36L
+
+#define SN_setct_CredRevResData         "setct-CredRevResData"
+#define NID_setct_CredRevResData                555
+#define OBJ_setct_CredRevResData                OBJ_set_ctype,37L
+
+#define SN_setct_PCertReqData           "setct-PCertReqData"
+#define NID_setct_PCertReqData          556
+#define OBJ_setct_PCertReqData          OBJ_set_ctype,38L
+
+#define SN_setct_PCertResTBS            "setct-PCertResTBS"
+#define NID_setct_PCertResTBS           557
+#define OBJ_setct_PCertResTBS           OBJ_set_ctype,39L
+
+#define SN_setct_BatchAdminReqData              "setct-BatchAdminReqData"
+#define NID_setct_BatchAdminReqData             558
+#define OBJ_setct_BatchAdminReqData             OBJ_set_ctype,40L
+
+#define SN_setct_BatchAdminResData              "setct-BatchAdminResData"
+#define NID_setct_BatchAdminResData             559
+#define OBJ_setct_BatchAdminResData             OBJ_set_ctype,41L
+
+#define SN_setct_CardCInitResTBS                "setct-CardCInitResTBS"
+#define NID_setct_CardCInitResTBS               560
+#define OBJ_setct_CardCInitResTBS               OBJ_set_ctype,42L
+
+#define SN_setct_MeAqCInitResTBS                "setct-MeAqCInitResTBS"
+#define NID_setct_MeAqCInitResTBS               561
+#define OBJ_setct_MeAqCInitResTBS               OBJ_set_ctype,43L
+
+#define SN_setct_RegFormResTBS          "setct-RegFormResTBS"
+#define NID_setct_RegFormResTBS         562
+#define OBJ_setct_RegFormResTBS         OBJ_set_ctype,44L
+
+#define SN_setct_CertReqData            "setct-CertReqData"
+#define NID_setct_CertReqData           563
+#define OBJ_setct_CertReqData           OBJ_set_ctype,45L
+
+#define SN_setct_CertReqTBS             "setct-CertReqTBS"
+#define NID_setct_CertReqTBS            564
+#define OBJ_setct_CertReqTBS            OBJ_set_ctype,46L
+
+#define SN_setct_CertResData            "setct-CertResData"
+#define NID_setct_CertResData           565
+#define OBJ_setct_CertResData           OBJ_set_ctype,47L
+
+#define SN_setct_CertInqReqTBS          "setct-CertInqReqTBS"
+#define NID_setct_CertInqReqTBS         566
+#define OBJ_setct_CertInqReqTBS         OBJ_set_ctype,48L
+
+#define SN_setct_ErrorTBS               "setct-ErrorTBS"
+#define NID_setct_ErrorTBS              567
+#define OBJ_setct_ErrorTBS              OBJ_set_ctype,49L
+
+#define SN_setct_PIDualSignedTBE                "setct-PIDualSignedTBE"
+#define NID_setct_PIDualSignedTBE               568
+#define OBJ_setct_PIDualSignedTBE               OBJ_set_ctype,50L
+
+#define SN_setct_PIUnsignedTBE          "setct-PIUnsignedTBE"
+#define NID_setct_PIUnsignedTBE         569
+#define OBJ_setct_PIUnsignedTBE         OBJ_set_ctype,51L
+
+#define SN_setct_AuthReqTBE             "setct-AuthReqTBE"
+#define NID_setct_AuthReqTBE            570
+#define OBJ_setct_AuthReqTBE            OBJ_set_ctype,52L
+
+#define SN_setct_AuthResTBE             "setct-AuthResTBE"
+#define NID_setct_AuthResTBE            571
+#define OBJ_setct_AuthResTBE            OBJ_set_ctype,53L
+
+#define SN_setct_AuthResTBEX            "setct-AuthResTBEX"
+#define NID_setct_AuthResTBEX           572
+#define OBJ_setct_AuthResTBEX           OBJ_set_ctype,54L
+
+#define SN_setct_AuthTokenTBE           "setct-AuthTokenTBE"
+#define NID_setct_AuthTokenTBE          573
+#define OBJ_setct_AuthTokenTBE          OBJ_set_ctype,55L
+
+#define SN_setct_CapTokenTBE            "setct-CapTokenTBE"
+#define NID_setct_CapTokenTBE           574
+#define OBJ_setct_CapTokenTBE           OBJ_set_ctype,56L
+
+#define SN_setct_CapTokenTBEX           "setct-CapTokenTBEX"
+#define NID_setct_CapTokenTBEX          575
+#define OBJ_setct_CapTokenTBEX          OBJ_set_ctype,57L
+
+#define SN_setct_AcqCardCodeMsgTBE              "setct-AcqCardCodeMsgTBE"
+#define NID_setct_AcqCardCodeMsgTBE             576
+#define OBJ_setct_AcqCardCodeMsgTBE             OBJ_set_ctype,58L
+
+#define SN_setct_AuthRevReqTBE          "setct-AuthRevReqTBE"
+#define NID_setct_AuthRevReqTBE         577
+#define OBJ_setct_AuthRevReqTBE         OBJ_set_ctype,59L
+
+#define SN_setct_AuthRevResTBE          "setct-AuthRevResTBE"
+#define NID_setct_AuthRevResTBE         578
+#define OBJ_setct_AuthRevResTBE         OBJ_set_ctype,60L
+
+#define SN_setct_AuthRevResTBEB         "setct-AuthRevResTBEB"
+#define NID_setct_AuthRevResTBEB                579
+#define OBJ_setct_AuthRevResTBEB                OBJ_set_ctype,61L
+
+#define SN_setct_CapReqTBE              "setct-CapReqTBE"
+#define NID_setct_CapReqTBE             580
+#define OBJ_setct_CapReqTBE             OBJ_set_ctype,62L
+
+#define SN_setct_CapReqTBEX             "setct-CapReqTBEX"
+#define NID_setct_CapReqTBEX            581
+#define OBJ_setct_CapReqTBEX            OBJ_set_ctype,63L
+
+#define SN_setct_CapResTBE              "setct-CapResTBE"
+#define NID_setct_CapResTBE             582
+#define OBJ_setct_CapResTBE             OBJ_set_ctype,64L
+
+#define SN_setct_CapRevReqTBE           "setct-CapRevReqTBE"
+#define NID_setct_CapRevReqTBE          583
+#define OBJ_setct_CapRevReqTBE          OBJ_set_ctype,65L
+
+#define SN_setct_CapRevReqTBEX          "setct-CapRevReqTBEX"
+#define NID_setct_CapRevReqTBEX         584
+#define OBJ_setct_CapRevReqTBEX         OBJ_set_ctype,66L
+
+#define SN_setct_CapRevResTBE           "setct-CapRevResTBE"
+#define NID_setct_CapRevResTBE          585
+#define OBJ_setct_CapRevResTBE          OBJ_set_ctype,67L
+
+#define SN_setct_CredReqTBE             "setct-CredReqTBE"
+#define NID_setct_CredReqTBE            586
+#define OBJ_setct_CredReqTBE            OBJ_set_ctype,68L
+
+#define SN_setct_CredReqTBEX            "setct-CredReqTBEX"
+#define NID_setct_CredReqTBEX           587
+#define OBJ_setct_CredReqTBEX           OBJ_set_ctype,69L
+
+#define SN_setct_CredResTBE             "setct-CredResTBE"
+#define NID_setct_CredResTBE            588
+#define OBJ_setct_CredResTBE            OBJ_set_ctype,70L
+
+#define SN_setct_CredRevReqTBE          "setct-CredRevReqTBE"
+#define NID_setct_CredRevReqTBE         589
+#define OBJ_setct_CredRevReqTBE         OBJ_set_ctype,71L
+
+#define SN_setct_CredRevReqTBEX         "setct-CredRevReqTBEX"
+#define NID_setct_CredRevReqTBEX                590
+#define OBJ_setct_CredRevReqTBEX                OBJ_set_ctype,72L
+
+#define SN_setct_CredRevResTBE          "setct-CredRevResTBE"
+#define NID_setct_CredRevResTBE         591
+#define OBJ_setct_CredRevResTBE         OBJ_set_ctype,73L
+
+#define SN_setct_BatchAdminReqTBE               "setct-BatchAdminReqTBE"
+#define NID_setct_BatchAdminReqTBE              592
+#define OBJ_setct_BatchAdminReqTBE              OBJ_set_ctype,74L
+
+#define SN_setct_BatchAdminResTBE               "setct-BatchAdminResTBE"
+#define NID_setct_BatchAdminResTBE              593
+#define OBJ_setct_BatchAdminResTBE              OBJ_set_ctype,75L
+
+#define SN_setct_RegFormReqTBE          "setct-RegFormReqTBE"
+#define NID_setct_RegFormReqTBE         594
+#define OBJ_setct_RegFormReqTBE         OBJ_set_ctype,76L
+
+#define SN_setct_CertReqTBE             "setct-CertReqTBE"
+#define NID_setct_CertReqTBE            595
+#define OBJ_setct_CertReqTBE            OBJ_set_ctype,77L
+
+#define SN_setct_CertReqTBEX            "setct-CertReqTBEX"
+#define NID_setct_CertReqTBEX           596
+#define OBJ_setct_CertReqTBEX           OBJ_set_ctype,78L
+
+#define SN_setct_CertResTBE             "setct-CertResTBE"
+#define NID_setct_CertResTBE            597
+#define OBJ_setct_CertResTBE            OBJ_set_ctype,79L
+
+#define SN_setct_CRLNotificationTBS             "setct-CRLNotificationTBS"
+#define NID_setct_CRLNotificationTBS            598
+#define OBJ_setct_CRLNotificationTBS            OBJ_set_ctype,80L
+
+#define SN_setct_CRLNotificationResTBS          "setct-CRLNotificationResTBS"
+#define NID_setct_CRLNotificationResTBS         599
+#define OBJ_setct_CRLNotificationResTBS         OBJ_set_ctype,81L
+
+#define SN_setct_BCIDistributionTBS             "setct-BCIDistributionTBS"
+#define NID_setct_BCIDistributionTBS            600
+#define OBJ_setct_BCIDistributionTBS            OBJ_set_ctype,82L
+
+#define SN_setext_genCrypt              "setext-genCrypt"
+#define LN_setext_genCrypt              "generic cryptogram"
+#define NID_setext_genCrypt             601
+#define OBJ_setext_genCrypt             OBJ_set_msgExt,1L
+
+#define SN_setext_miAuth                "setext-miAuth"
+#define LN_setext_miAuth                "merchant initiated auth"
+#define NID_setext_miAuth               602
+#define OBJ_setext_miAuth               OBJ_set_msgExt,3L
+
+#define SN_setext_pinSecure             "setext-pinSecure"
+#define NID_setext_pinSecure            603
+#define OBJ_setext_pinSecure            OBJ_set_msgExt,4L
+
+#define SN_setext_pinAny                "setext-pinAny"
+#define NID_setext_pinAny               604
+#define OBJ_setext_pinAny               OBJ_set_msgExt,5L
+
+#define SN_setext_track2                "setext-track2"
+#define NID_setext_track2               605
+#define OBJ_setext_track2               OBJ_set_msgExt,7L
+
+#define SN_setext_cv            "setext-cv"
+#define LN_setext_cv            "additional verification"
+#define NID_setext_cv           606
+#define OBJ_setext_cv           OBJ_set_msgExt,8L
+
+#define SN_set_policy_root              "set-policy-root"
+#define NID_set_policy_root             607
+#define OBJ_set_policy_root             OBJ_set_policy,0L
+
+#define SN_setCext_hashedRoot           "setCext-hashedRoot"
+#define NID_setCext_hashedRoot          608
+#define OBJ_setCext_hashedRoot          OBJ_set_certExt,0L
+
+#define SN_setCext_certType             "setCext-certType"
+#define NID_setCext_certType            609
+#define OBJ_setCext_certType            OBJ_set_certExt,1L
+
+#define SN_setCext_merchData            "setCext-merchData"
+#define NID_setCext_merchData           610
+#define OBJ_setCext_merchData           OBJ_set_certExt,2L
+
+#define SN_setCext_cCertRequired                "setCext-cCertRequired"
+#define NID_setCext_cCertRequired               611
+#define OBJ_setCext_cCertRequired               OBJ_set_certExt,3L
+
+#define SN_setCext_tunneling            "setCext-tunneling"
+#define NID_setCext_tunneling           612
+#define OBJ_setCext_tunneling           OBJ_set_certExt,4L
+
+#define SN_setCext_setExt               "setCext-setExt"
+#define NID_setCext_setExt              613
+#define OBJ_setCext_setExt              OBJ_set_certExt,5L
+
+#define SN_setCext_setQualf             "setCext-setQualf"
+#define NID_setCext_setQualf            614
+#define OBJ_setCext_setQualf            OBJ_set_certExt,6L
+
+#define SN_setCext_PGWYcapabilities             "setCext-PGWYcapabilities"
+#define NID_setCext_PGWYcapabilities            615
+#define OBJ_setCext_PGWYcapabilities            OBJ_set_certExt,7L
+
+#define SN_setCext_TokenIdentifier              "setCext-TokenIdentifier"
+#define NID_setCext_TokenIdentifier             616
+#define OBJ_setCext_TokenIdentifier             OBJ_set_certExt,8L
+
+#define SN_setCext_Track2Data           "setCext-Track2Data"
+#define NID_setCext_Track2Data          617
+#define OBJ_setCext_Track2Data          OBJ_set_certExt,9L
+
+#define SN_setCext_TokenType            "setCext-TokenType"
+#define NID_setCext_TokenType           618
+#define OBJ_setCext_TokenType           OBJ_set_certExt,10L
+
+#define SN_setCext_IssuerCapabilities           "setCext-IssuerCapabilities"
+#define NID_setCext_IssuerCapabilities          619
+#define OBJ_setCext_IssuerCapabilities          OBJ_set_certExt,11L
+
+#define SN_setAttr_Cert         "setAttr-Cert"
+#define NID_setAttr_Cert                620
+#define OBJ_setAttr_Cert                OBJ_set_attr,0L
+
+#define SN_setAttr_PGWYcap              "setAttr-PGWYcap"
+#define LN_setAttr_PGWYcap              "payment gateway capabilities"
+#define NID_setAttr_PGWYcap             621
+#define OBJ_setAttr_PGWYcap             OBJ_set_attr,1L
+
+#define SN_setAttr_TokenType            "setAttr-TokenType"
+#define NID_setAttr_TokenType           622
+#define OBJ_setAttr_TokenType           OBJ_set_attr,2L
+
+#define SN_setAttr_IssCap               "setAttr-IssCap"
+#define LN_setAttr_IssCap               "issuer capabilities"
+#define NID_setAttr_IssCap              623
+#define OBJ_setAttr_IssCap              OBJ_set_attr,3L
+
+#define SN_set_rootKeyThumb             "set-rootKeyThumb"
+#define NID_set_rootKeyThumb            624
+#define OBJ_set_rootKeyThumb            OBJ_setAttr_Cert,0L
+
+#define SN_set_addPolicy                "set-addPolicy"
+#define NID_set_addPolicy               625
+#define OBJ_set_addPolicy               OBJ_setAttr_Cert,1L
+
+#define SN_setAttr_Token_EMV            "setAttr-Token-EMV"
+#define NID_setAttr_Token_EMV           626
+#define OBJ_setAttr_Token_EMV           OBJ_setAttr_TokenType,1L
+
+#define SN_setAttr_Token_B0Prime                "setAttr-Token-B0Prime"
+#define NID_setAttr_Token_B0Prime               627
+#define OBJ_setAttr_Token_B0Prime               OBJ_setAttr_TokenType,2L
+
+#define SN_setAttr_IssCap_CVM           "setAttr-IssCap-CVM"
+#define NID_setAttr_IssCap_CVM          628
+#define OBJ_setAttr_IssCap_CVM          OBJ_setAttr_IssCap,3L
+
+#define SN_setAttr_IssCap_T2            "setAttr-IssCap-T2"
+#define NID_setAttr_IssCap_T2           629
+#define OBJ_setAttr_IssCap_T2           OBJ_setAttr_IssCap,4L
+
+#define SN_setAttr_IssCap_Sig           "setAttr-IssCap-Sig"
+#define NID_setAttr_IssCap_Sig          630
+#define OBJ_setAttr_IssCap_Sig          OBJ_setAttr_IssCap,5L
+
+#define SN_setAttr_GenCryptgrm          "setAttr-GenCryptgrm"
+#define LN_setAttr_GenCryptgrm          "generate cryptogram"
+#define NID_setAttr_GenCryptgrm         631
+#define OBJ_setAttr_GenCryptgrm         OBJ_setAttr_IssCap_CVM,1L
+
+#define SN_setAttr_T2Enc                "setAttr-T2Enc"
+#define LN_setAttr_T2Enc                "encrypted track 2"
+#define NID_setAttr_T2Enc               632
+#define OBJ_setAttr_T2Enc               OBJ_setAttr_IssCap_T2,1L
+
+#define SN_setAttr_T2cleartxt           "setAttr-T2cleartxt"
+#define LN_setAttr_T2cleartxt           "cleartext track 2"
+#define NID_setAttr_T2cleartxt          633
+#define OBJ_setAttr_T2cleartxt          OBJ_setAttr_IssCap_T2,2L
+
+#define SN_setAttr_TokICCsig            "setAttr-TokICCsig"
+#define LN_setAttr_TokICCsig            "ICC or token signature"
+#define NID_setAttr_TokICCsig           634
+#define OBJ_setAttr_TokICCsig           OBJ_setAttr_IssCap_Sig,1L
+
+#define SN_setAttr_SecDevSig            "setAttr-SecDevSig"
+#define LN_setAttr_SecDevSig            "secure device signature"
+#define NID_setAttr_SecDevSig           635
+#define OBJ_setAttr_SecDevSig           OBJ_setAttr_IssCap_Sig,2L
+
+#define SN_set_brand_IATA_ATA           "set-brand-IATA-ATA"
+#define NID_set_brand_IATA_ATA          636
+#define OBJ_set_brand_IATA_ATA          OBJ_set_brand,1L
+
+#define SN_set_brand_Diners             "set-brand-Diners"
+#define NID_set_brand_Diners            637
+#define OBJ_set_brand_Diners            OBJ_set_brand,30L
+
+#define SN_set_brand_AmericanExpress            "set-brand-AmericanExpress"
+#define NID_set_brand_AmericanExpress           638
+#define OBJ_set_brand_AmericanExpress           OBJ_set_brand,34L
+
+#define SN_set_brand_JCB                "set-brand-JCB"
+#define NID_set_brand_JCB               639
+#define OBJ_set_brand_JCB               OBJ_set_brand,35L
+
+#define SN_set_brand_Visa               "set-brand-Visa"
+#define NID_set_brand_Visa              640
+#define OBJ_set_brand_Visa              OBJ_set_brand,4L
+
+#define SN_set_brand_MasterCard         "set-brand-MasterCard"
+#define NID_set_brand_MasterCard                641
+#define OBJ_set_brand_MasterCard                OBJ_set_brand,5L
+
+#define SN_set_brand_Novus              "set-brand-Novus"
+#define NID_set_brand_Novus             642
+#define OBJ_set_brand_Novus             OBJ_set_brand,6011L
+
+#define SN_des_cdmf             "DES-CDMF"
+#define LN_des_cdmf             "des-cdmf"
+#define NID_des_cdmf            643
+#define OBJ_des_cdmf            OBJ_rsadsi,3L,10L
+
+#define SN_rsaOAEPEncryptionSET         "rsaOAEPEncryptionSET"
+#define NID_rsaOAEPEncryptionSET                644
+#define OBJ_rsaOAEPEncryptionSET                OBJ_rsadsi,1L,1L,6L
+
+#define SN_ipsec3               "Oakley-EC2N-3"
+#define LN_ipsec3               "ipsec3"
+#define NID_ipsec3              749
+
+#define SN_ipsec4               "Oakley-EC2N-4"
+#define LN_ipsec4               "ipsec4"
+#define NID_ipsec4              750
+
+#define SN_whirlpool            "whirlpool"
+#define NID_whirlpool           804
+#define OBJ_whirlpool           OBJ_iso,0L,10118L,3L,0L,55L
+
+#define SN_cryptopro            "cryptopro"
+#define NID_cryptopro           805
+#define OBJ_cryptopro           OBJ_member_body,643L,2L,2L
+
+#define SN_cryptocom            "cryptocom"
+#define NID_cryptocom           806
+#define OBJ_cryptocom           OBJ_member_body,643L,2L,9L
+
+#define SN_id_GostR3411_94_with_GostR3410_2001          "id-GostR3411-94-with-GostR3410-2001"
+#define LN_id_GostR3411_94_with_GostR3410_2001          "GOST R 34.11-94 with GOST R 34.10-2001"
+#define NID_id_GostR3411_94_with_GostR3410_2001         807
+#define OBJ_id_GostR3411_94_with_GostR3410_2001         OBJ_cryptopro,3L
+
+#define SN_id_GostR3411_94_with_GostR3410_94            "id-GostR3411-94-with-GostR3410-94"
+#define LN_id_GostR3411_94_with_GostR3410_94            "GOST R 34.11-94 with GOST R 34.10-94"
+#define NID_id_GostR3411_94_with_GostR3410_94           808
+#define OBJ_id_GostR3411_94_with_GostR3410_94           OBJ_cryptopro,4L
+
+#define SN_id_GostR3411_94              "md_gost94"
+#define LN_id_GostR3411_94              "GOST R 34.11-94"
+#define NID_id_GostR3411_94             809
+#define OBJ_id_GostR3411_94             OBJ_cryptopro,9L
+
+#define SN_id_HMACGostR3411_94          "id-HMACGostR3411-94"
+#define LN_id_HMACGostR3411_94          "HMAC GOST 34.11-94"
+#define NID_id_HMACGostR3411_94         810
+#define OBJ_id_HMACGostR3411_94         OBJ_cryptopro,10L
+
+#define SN_id_GostR3410_2001            "gost2001"
+#define LN_id_GostR3410_2001            "GOST R 34.10-2001"
+#define NID_id_GostR3410_2001           811
+#define OBJ_id_GostR3410_2001           OBJ_cryptopro,19L
+
+#define SN_id_GostR3410_94              "gost94"
+#define LN_id_GostR3410_94              "GOST R 34.10-94"
+#define NID_id_GostR3410_94             812
+#define OBJ_id_GostR3410_94             OBJ_cryptopro,20L
+
+#define SN_id_Gost28147_89              "gost89"
+#define LN_id_Gost28147_89              "GOST 28147-89"
+#define NID_id_Gost28147_89             813
+#define OBJ_id_Gost28147_89             OBJ_cryptopro,21L
+
+#define SN_gost89_cnt           "gost89-cnt"
+#define NID_gost89_cnt          814
+
+#define SN_id_Gost28147_89_MAC          "gost-mac"
+#define LN_id_Gost28147_89_MAC          "GOST 28147-89 MAC"
+#define NID_id_Gost28147_89_MAC         815
+#define OBJ_id_Gost28147_89_MAC         OBJ_cryptopro,22L
+
+#define SN_id_GostR3411_94_prf          "prf-gostr3411-94"
+#define LN_id_GostR3411_94_prf          "GOST R 34.11-94 PRF"
+#define NID_id_GostR3411_94_prf         816
+#define OBJ_id_GostR3411_94_prf         OBJ_cryptopro,23L
+
+#define SN_id_GostR3410_2001DH          "id-GostR3410-2001DH"
+#define LN_id_GostR3410_2001DH          "GOST R 34.10-2001 DH"
+#define NID_id_GostR3410_2001DH         817
+#define OBJ_id_GostR3410_2001DH         OBJ_cryptopro,98L
+
+#define SN_id_GostR3410_94DH            "id-GostR3410-94DH"
+#define LN_id_GostR3410_94DH            "GOST R 34.10-94 DH"
+#define NID_id_GostR3410_94DH           818
+#define OBJ_id_GostR3410_94DH           OBJ_cryptopro,99L
+
+#define SN_id_Gost28147_89_CryptoPro_KeyMeshing         "id-Gost28147-89-CryptoPro-KeyMeshing"
+#define NID_id_Gost28147_89_CryptoPro_KeyMeshing                819
+#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing                OBJ_cryptopro,14L,1L
+
+#define SN_id_Gost28147_89_None_KeyMeshing              "id-Gost28147-89-None-KeyMeshing"
+#define NID_id_Gost28147_89_None_KeyMeshing             820
+#define OBJ_id_Gost28147_89_None_KeyMeshing             OBJ_cryptopro,14L,0L
+
+#define SN_id_GostR3411_94_TestParamSet         "id-GostR3411-94-TestParamSet"
+#define NID_id_GostR3411_94_TestParamSet                821
+#define OBJ_id_GostR3411_94_TestParamSet                OBJ_cryptopro,30L,0L
+
+#define SN_id_GostR3411_94_CryptoProParamSet            "id-GostR3411-94-CryptoProParamSet"
+#define NID_id_GostR3411_94_CryptoProParamSet           822
+#define OBJ_id_GostR3411_94_CryptoProParamSet           OBJ_cryptopro,30L,1L
+
+#define SN_id_Gost28147_89_TestParamSet         "id-Gost28147-89-TestParamSet"
+#define NID_id_Gost28147_89_TestParamSet                823
+#define OBJ_id_Gost28147_89_TestParamSet                OBJ_cryptopro,31L,0L
+
+#define SN_id_Gost28147_89_CryptoPro_A_ParamSet         "id-Gost28147-89-CryptoPro-A-ParamSet"
+#define NID_id_Gost28147_89_CryptoPro_A_ParamSet                824
+#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet                OBJ_cryptopro,31L,1L
+
+#define SN_id_Gost28147_89_CryptoPro_B_ParamSet         "id-Gost28147-89-CryptoPro-B-ParamSet"
+#define NID_id_Gost28147_89_CryptoPro_B_ParamSet                825
+#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet                OBJ_cryptopro,31L,2L
+
+#define SN_id_Gost28147_89_CryptoPro_C_ParamSet         "id-Gost28147-89-CryptoPro-C-ParamSet"
+#define NID_id_Gost28147_89_CryptoPro_C_ParamSet                826
+#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet                OBJ_cryptopro,31L,3L
+
+#define SN_id_Gost28147_89_CryptoPro_D_ParamSet         "id-Gost28147-89-CryptoPro-D-ParamSet"
+#define NID_id_Gost28147_89_CryptoPro_D_ParamSet                827
+#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet                OBJ_cryptopro,31L,4L
+
+#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet         "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet"
+#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet                828
+#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet                OBJ_cryptopro,31L,5L
+
+#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet         "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet"
+#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet                829
+#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet                OBJ_cryptopro,31L,6L
+
+#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet             "id-Gost28147-89-CryptoPro-RIC-1-ParamSet"
+#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet            830
+#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet            OBJ_cryptopro,31L,7L
+
+#define SN_id_GostR3410_94_TestParamSet         "id-GostR3410-94-TestParamSet"
+#define NID_id_GostR3410_94_TestParamSet                831
+#define OBJ_id_GostR3410_94_TestParamSet                OBJ_cryptopro,32L,0L
+
+#define SN_id_GostR3410_94_CryptoPro_A_ParamSet         "id-GostR3410-94-CryptoPro-A-ParamSet"
+#define NID_id_GostR3410_94_CryptoPro_A_ParamSet                832
+#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet                OBJ_cryptopro,32L,2L
+
+#define SN_id_GostR3410_94_CryptoPro_B_ParamSet         "id-GostR3410-94-CryptoPro-B-ParamSet"
+#define NID_id_GostR3410_94_CryptoPro_B_ParamSet                833
+#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet                OBJ_cryptopro,32L,3L
+
+#define SN_id_GostR3410_94_CryptoPro_C_ParamSet         "id-GostR3410-94-CryptoPro-C-ParamSet"
+#define NID_id_GostR3410_94_CryptoPro_C_ParamSet                834
+#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet                OBJ_cryptopro,32L,4L
+
+#define SN_id_GostR3410_94_CryptoPro_D_ParamSet         "id-GostR3410-94-CryptoPro-D-ParamSet"
+#define NID_id_GostR3410_94_CryptoPro_D_ParamSet                835
+#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet                OBJ_cryptopro,32L,5L
+
+#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet              "id-GostR3410-94-CryptoPro-XchA-ParamSet"
+#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet             836
+#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet             OBJ_cryptopro,33L,1L
+
+#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet              "id-GostR3410-94-CryptoPro-XchB-ParamSet"
+#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet             837
+#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet             OBJ_cryptopro,33L,2L
+
+#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet              "id-GostR3410-94-CryptoPro-XchC-ParamSet"
+#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet             838
+#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet             OBJ_cryptopro,33L,3L
+
+#define SN_id_GostR3410_2001_TestParamSet               "id-GostR3410-2001-TestParamSet"
+#define NID_id_GostR3410_2001_TestParamSet              839
+#define OBJ_id_GostR3410_2001_TestParamSet              OBJ_cryptopro,35L,0L
+
+#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet               "id-GostR3410-2001-CryptoPro-A-ParamSet"
+#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet              840
+#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet              OBJ_cryptopro,35L,1L
+
+#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet               "id-GostR3410-2001-CryptoPro-B-ParamSet"
+#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet              841
+#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet              OBJ_cryptopro,35L,2L
+
+#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet               "id-GostR3410-2001-CryptoPro-C-ParamSet"
+#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet              842
+#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet              OBJ_cryptopro,35L,3L
+
+#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet            "id-GostR3410-2001-CryptoPro-XchA-ParamSet"
+#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet           843
+#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet           OBJ_cryptopro,36L,0L
+
+#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet            "id-GostR3410-2001-CryptoPro-XchB-ParamSet"
+#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet           844
+#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet           OBJ_cryptopro,36L,1L
+
+#define SN_id_GostR3410_94_a            "id-GostR3410-94-a"
+#define NID_id_GostR3410_94_a           845
+#define OBJ_id_GostR3410_94_a           OBJ_id_GostR3410_94,1L
+
+#define SN_id_GostR3410_94_aBis         "id-GostR3410-94-aBis"
+#define NID_id_GostR3410_94_aBis                846
+#define OBJ_id_GostR3410_94_aBis                OBJ_id_GostR3410_94,2L
+
+#define SN_id_GostR3410_94_b            "id-GostR3410-94-b"
+#define NID_id_GostR3410_94_b           847
+#define OBJ_id_GostR3410_94_b           OBJ_id_GostR3410_94,3L
+
+#define SN_id_GostR3410_94_bBis         "id-GostR3410-94-bBis"
+#define NID_id_GostR3410_94_bBis                848
+#define OBJ_id_GostR3410_94_bBis                OBJ_id_GostR3410_94,4L
+
+#define SN_id_Gost28147_89_cc           "id-Gost28147-89-cc"
+#define LN_id_Gost28147_89_cc           "GOST 28147-89 Cryptocom ParamSet"
+#define NID_id_Gost28147_89_cc          849
+#define OBJ_id_Gost28147_89_cc          OBJ_cryptocom,1L,6L,1L
+
+#define SN_id_GostR3410_94_cc           "gost94cc"
+#define LN_id_GostR3410_94_cc           "GOST 34.10-94 Cryptocom"
+#define NID_id_GostR3410_94_cc          850
+#define OBJ_id_GostR3410_94_cc          OBJ_cryptocom,1L,5L,3L
+
+#define SN_id_GostR3410_2001_cc         "gost2001cc"
+#define LN_id_GostR3410_2001_cc         "GOST 34.10-2001 Cryptocom"
+#define NID_id_GostR3410_2001_cc                851
+#define OBJ_id_GostR3410_2001_cc                OBJ_cryptocom,1L,5L,4L
+
+#define SN_id_GostR3411_94_with_GostR3410_94_cc         "id-GostR3411-94-with-GostR3410-94-cc"
+#define LN_id_GostR3411_94_with_GostR3410_94_cc         "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom"
+#define NID_id_GostR3411_94_with_GostR3410_94_cc                852
+#define OBJ_id_GostR3411_94_with_GostR3410_94_cc                OBJ_cryptocom,1L,3L,3L
+
+#define SN_id_GostR3411_94_with_GostR3410_2001_cc               "id-GostR3411-94-with-GostR3410-2001-cc"
+#define LN_id_GostR3411_94_with_GostR3410_2001_cc               "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom"
+#define NID_id_GostR3411_94_with_GostR3410_2001_cc              853
+#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc              OBJ_cryptocom,1L,3L,4L
+
+#define SN_id_GostR3410_2001_ParamSet_cc                "id-GostR3410-2001-ParamSet-cc"
+#define LN_id_GostR3410_2001_ParamSet_cc                "GOST R 3410-2001 Parameter Set Cryptocom"
+#define NID_id_GostR3410_2001_ParamSet_cc               854
+#define OBJ_id_GostR3410_2001_ParamSet_cc               OBJ_cryptocom,1L,8L,1L
+
+#define SN_camellia_128_cbc             "CAMELLIA-128-CBC"
+#define LN_camellia_128_cbc             "camellia-128-cbc"
+#define NID_camellia_128_cbc            751
+#define OBJ_camellia_128_cbc            1L,2L,392L,200011L,61L,1L,1L,1L,2L
+
+#define SN_camellia_192_cbc             "CAMELLIA-192-CBC"
+#define LN_camellia_192_cbc             "camellia-192-cbc"
+#define NID_camellia_192_cbc            752
+#define OBJ_camellia_192_cbc            1L,2L,392L,200011L,61L,1L,1L,1L,3L
+
+#define SN_camellia_256_cbc             "CAMELLIA-256-CBC"
+#define LN_camellia_256_cbc             "camellia-256-cbc"
+#define NID_camellia_256_cbc            753
+#define OBJ_camellia_256_cbc            1L,2L,392L,200011L,61L,1L,1L,1L,4L
+
+#define SN_id_camellia128_wrap          "id-camellia128-wrap"
+#define NID_id_camellia128_wrap         907
+#define OBJ_id_camellia128_wrap         1L,2L,392L,200011L,61L,1L,1L,3L,2L
+
+#define SN_id_camellia192_wrap          "id-camellia192-wrap"
+#define NID_id_camellia192_wrap         908
+#define OBJ_id_camellia192_wrap         1L,2L,392L,200011L,61L,1L,1L,3L,3L
+
+#define SN_id_camellia256_wrap          "id-camellia256-wrap"
+#define NID_id_camellia256_wrap         909
+#define OBJ_id_camellia256_wrap         1L,2L,392L,200011L,61L,1L,1L,3L,4L
+
+#define OBJ_ntt_ds              0L,3L,4401L,5L
+
+#define OBJ_camellia            OBJ_ntt_ds,3L,1L,9L
+
+#define SN_camellia_128_ecb             "CAMELLIA-128-ECB"
+#define LN_camellia_128_ecb             "camellia-128-ecb"
+#define NID_camellia_128_ecb            754
+#define OBJ_camellia_128_ecb            OBJ_camellia,1L
+
+#define SN_camellia_128_ofb128          "CAMELLIA-128-OFB"
+#define LN_camellia_128_ofb128          "camellia-128-ofb"
+#define NID_camellia_128_ofb128         766
+#define OBJ_camellia_128_ofb128         OBJ_camellia,3L
+
+#define SN_camellia_128_cfb128          "CAMELLIA-128-CFB"
+#define LN_camellia_128_cfb128          "camellia-128-cfb"
+#define NID_camellia_128_cfb128         757
+#define OBJ_camellia_128_cfb128         OBJ_camellia,4L
+
+#define SN_camellia_192_ecb             "CAMELLIA-192-ECB"
+#define LN_camellia_192_ecb             "camellia-192-ecb"
+#define NID_camellia_192_ecb            755
+#define OBJ_camellia_192_ecb            OBJ_camellia,21L
+
+#define SN_camellia_192_ofb128          "CAMELLIA-192-OFB"
+#define LN_camellia_192_ofb128          "camellia-192-ofb"
+#define NID_camellia_192_ofb128         767
+#define OBJ_camellia_192_ofb128         OBJ_camellia,23L
+
+#define SN_camellia_192_cfb128          "CAMELLIA-192-CFB"
+#define LN_camellia_192_cfb128          "camellia-192-cfb"
+#define NID_camellia_192_cfb128         758
+#define OBJ_camellia_192_cfb128         OBJ_camellia,24L
+
+#define SN_camellia_256_ecb             "CAMELLIA-256-ECB"
+#define LN_camellia_256_ecb             "camellia-256-ecb"
+#define NID_camellia_256_ecb            756
+#define OBJ_camellia_256_ecb            OBJ_camellia,41L
+
+#define SN_camellia_256_ofb128          "CAMELLIA-256-OFB"
+#define LN_camellia_256_ofb128          "camellia-256-ofb"
+#define NID_camellia_256_ofb128         768
+#define OBJ_camellia_256_ofb128         OBJ_camellia,43L
+
+#define SN_camellia_256_cfb128          "CAMELLIA-256-CFB"
+#define LN_camellia_256_cfb128          "camellia-256-cfb"
+#define NID_camellia_256_cfb128         759
+#define OBJ_camellia_256_cfb128         OBJ_camellia,44L
+
+#define SN_camellia_128_cfb1            "CAMELLIA-128-CFB1"
+#define LN_camellia_128_cfb1            "camellia-128-cfb1"
+#define NID_camellia_128_cfb1           760
+
+#define SN_camellia_192_cfb1            "CAMELLIA-192-CFB1"
+#define LN_camellia_192_cfb1            "camellia-192-cfb1"
+#define NID_camellia_192_cfb1           761
+
+#define SN_camellia_256_cfb1            "CAMELLIA-256-CFB1"
+#define LN_camellia_256_cfb1            "camellia-256-cfb1"
+#define NID_camellia_256_cfb1           762
+
+#define SN_camellia_128_cfb8            "CAMELLIA-128-CFB8"
+#define LN_camellia_128_cfb8            "camellia-128-cfb8"
+#define NID_camellia_128_cfb8           763
+
+#define SN_camellia_192_cfb8            "CAMELLIA-192-CFB8"
+#define LN_camellia_192_cfb8            "camellia-192-cfb8"
+#define NID_camellia_192_cfb8           764
+
+#define SN_camellia_256_cfb8            "CAMELLIA-256-CFB8"
+#define LN_camellia_256_cfb8            "camellia-256-cfb8"
+#define NID_camellia_256_cfb8           765
+
+#define SN_kisa         "KISA"
+#define LN_kisa         "kisa"
+#define NID_kisa                773
+#define OBJ_kisa                OBJ_member_body,410L,200004L
+
+#define SN_seed_ecb             "SEED-ECB"
+#define LN_seed_ecb             "seed-ecb"
+#define NID_seed_ecb            776
+#define OBJ_seed_ecb            OBJ_kisa,1L,3L
+
+#define SN_seed_cbc             "SEED-CBC"
+#define LN_seed_cbc             "seed-cbc"
+#define NID_seed_cbc            777
+#define OBJ_seed_cbc            OBJ_kisa,1L,4L
+
+#define SN_seed_cfb128          "SEED-CFB"
+#define LN_seed_cfb128          "seed-cfb"
+#define NID_seed_cfb128         779
+#define OBJ_seed_cfb128         OBJ_kisa,1L,5L
+
+#define SN_seed_ofb128          "SEED-OFB"
+#define LN_seed_ofb128          "seed-ofb"
+#define NID_seed_ofb128         778
+#define OBJ_seed_ofb128         OBJ_kisa,1L,6L
+
+#define SN_hmac         "HMAC"
+#define LN_hmac         "hmac"
+#define NID_hmac                855
+
+#define SN_cmac         "CMAC"
+#define LN_cmac         "cmac"
+#define NID_cmac                894
+
+#define SN_rc4_hmac_md5         "RC4-HMAC-MD5"
+#define LN_rc4_hmac_md5         "rc4-hmac-md5"
+#define NID_rc4_hmac_md5                915
+
+#define SN_aes_128_cbc_hmac_sha1                "AES-128-CBC-HMAC-SHA1"
+#define LN_aes_128_cbc_hmac_sha1                "aes-128-cbc-hmac-sha1"
+#define NID_aes_128_cbc_hmac_sha1               916
+
+#define SN_aes_192_cbc_hmac_sha1                "AES-192-CBC-HMAC-SHA1"
+#define LN_aes_192_cbc_hmac_sha1                "aes-192-cbc-hmac-sha1"
+#define NID_aes_192_cbc_hmac_sha1               917
+
+#define SN_aes_256_cbc_hmac_sha1                "AES-256-CBC-HMAC-SHA1"
+#define LN_aes_256_cbc_hmac_sha1                "aes-256-cbc-hmac-sha1"
+#define NID_aes_256_cbc_hmac_sha1               918

Property changes on: lab4/.minix-src/include/openssl/obj_mac.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/rand.h
===================================================================
--- lab4/.minix-src/include/openssl/rand.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/rand.h	(revision 13)
@@ -0,0 +1,150 @@
+/* crypto/rand/rand.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_RAND_H
+# define HEADER_RAND_H
+
+# include <stdlib.h>
+# include <openssl/ossl_typ.h>
+# include <openssl/e_os2.h>
+
+# if defined(OPENSSL_SYS_WINDOWS)
+#  include <windows.h>
+# endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# if defined(OPENSSL_FIPS)
+#  define FIPS_RAND_SIZE_T size_t
+# endif
+
+/* Already defined in ossl_typ.h */
+/* typedef struct rand_meth_st RAND_METHOD; */
+
+struct rand_meth_st {
+    void (*seed) (const void *buf, int num);
+    int (*bytes) (unsigned char *buf, int num);
+    void (*cleanup) (void);
+    void (*add) (const void *buf, int num, double entropy);
+    int (*pseudorand) (unsigned char *buf, int num);
+    int (*status) (void);
+};
+
+# ifdef BN_DEBUG
+extern int rand_predictable;
+# endif
+
+int RAND_set_rand_method(const RAND_METHOD *meth);
+const RAND_METHOD *RAND_get_rand_method(void);
+# ifndef OPENSSL_NO_ENGINE
+int RAND_set_rand_engine(ENGINE *engine);
+# endif
+RAND_METHOD *RAND_SSLeay(void);
+void RAND_cleanup(void);
+int RAND_bytes(unsigned char *buf, int num);
+int RAND_pseudo_bytes(unsigned char *buf, int num);
+void RAND_seed(const void *buf, int num);
+void RAND_add(const void *buf, int num, double entropy);
+int RAND_load_file(const char *file, long max_bytes);
+int RAND_write_file(const char *file);
+const char *RAND_file_name(char *file, size_t num);
+int RAND_status(void);
+int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes);
+int RAND_egd(const char *path);
+int RAND_egd_bytes(const char *path, int bytes);
+int RAND_poll(void);
+
+# if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
+
+void RAND_screen(void);
+int RAND_event(UINT, WPARAM, LPARAM);
+
+# endif
+
+# ifdef OPENSSL_FIPS
+void RAND_set_fips_drbg_type(int type, int flags);
+int RAND_init_fips(void);
+# endif
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_RAND_strings(void);
+
+/* Error codes for the RAND functions. */
+
+/* Function codes. */
+# define RAND_F_RAND_GET_RAND_METHOD                      101
+# define RAND_F_RAND_INIT_FIPS                            102
+# define RAND_F_SSLEAY_RAND_BYTES                         100
+
+/* Reason codes. */
+# define RAND_R_DUAL_EC_DRBG_DISABLED                     104
+# define RAND_R_ERROR_INITIALISING_DRBG                   102
+# define RAND_R_ERROR_INSTANTIATING_DRBG                  103
+# define RAND_R_NO_FIPS_RANDOM_METHOD_SET                 101
+# define RAND_R_PRNG_NOT_SEEDED                           100
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/rand.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ripemd.h
===================================================================
--- lab4/.minix-src/include/openssl/ripemd.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ripemd.h	(revision 13)
@@ -0,0 +1,110 @@
+/* crypto/ripemd/ripemd.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_RIPEMD_H
+# define HEADER_RIPEMD_H
+
+# include <openssl/e_os2.h>
+# include <stddef.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifdef OPENSSL_NO_RIPEMD
+#  error RIPEMD is disabled.
+# endif
+
+# ifndef __NetBSD__
+#  if defined(__LP32__)
+#   define RIPEMD160_LONG unsigned long
+#  elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
+#   define RIPEMD160_LONG unsigned long
+#   define RIPEMD160_LONG_LOG2 3
+#  else
+#   define RIPEMD160_LONG unsigned int
+#  endif
+# else
+#  include <sys/types.h>
+#  define RIPEMD160_LONG u_int32_t
+# endif
+
+# define RIPEMD160_CBLOCK        64
+# define RIPEMD160_LBLOCK        (RIPEMD160_CBLOCK/4)
+# define RIPEMD160_DIGEST_LENGTH 20
+
+typedef struct RIPEMD160state_st {
+    RIPEMD160_LONG A, B, C, D, E;
+    RIPEMD160_LONG Nl, Nh;
+    RIPEMD160_LONG data[RIPEMD160_LBLOCK];
+    unsigned int num;
+} RIPEMD160_CTX;
+
+# ifdef OPENSSL_FIPS
+int private_RIPEMD160_Init(RIPEMD160_CTX *c);
+# endif
+int RIPEMD160_Init(RIPEMD160_CTX *c);
+int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len);
+int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
+unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md);
+void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/ripemd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/sha.h
===================================================================
--- lab4/.minix-src/include/openssl/sha.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/sha.h	(revision 13)
@@ -0,0 +1,219 @@
+/* crypto/sha/sha.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_SHA_H
+# define HEADER_SHA_H
+
+# include <openssl/e_os2.h>
+# include <stddef.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1))
+#  error SHA is disabled.
+# endif
+
+# if defined(OPENSSL_FIPS)
+#  define FIPS_SHA_SIZE_T size_t
+# endif
+
+/*-
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then !
+ * ! SHA_LONG_LOG2 has to be defined along.                        !
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ */
+
+# ifndef __NetBSD__
+#  if defined(__LP32__)
+#   define SHA_LONG unsigned long
+#  elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
+#   define SHA_LONG unsigned long
+#   define SHA_LONG_LOG2 3
+#  else
+#   define SHA_LONG unsigned int
+#  endif
+# else
+#  include <sys/types.h>
+#  define SHA_LONG uint32_t
+# endif
+
+# define SHA_LBLOCK      16
+# define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
+                                        * contiguous array of 32 bit wide
+                                        * big-endian values. */
+# define SHA_LAST_BLOCK  (SHA_CBLOCK-8)
+# define SHA_DIGEST_LENGTH 20
+
+typedef struct SHAstate_st {
+    SHA_LONG h0, h1, h2, h3, h4;
+    SHA_LONG Nl, Nh;
+    SHA_LONG data[SHA_LBLOCK];
+    unsigned int num;
+} SHA_CTX;
+
+# ifndef OPENSSL_NO_SHA0
+#  ifdef OPENSSL_FIPS
+int private_SHA_Init(SHA_CTX *c);
+#  endif
+int SHA_Init(SHA_CTX *c);
+int SHA_Update(SHA_CTX *c, const void *data, size_t len);
+int SHA_Final(unsigned char *md, SHA_CTX *c);
+unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md);
+void SHA_Transform(SHA_CTX *c, const unsigned char *data);
+# endif
+# ifndef OPENSSL_NO_SHA1
+#  ifdef OPENSSL_FIPS
+int private_SHA1_Init(SHA_CTX *c);
+#  endif
+int SHA1_Init(SHA_CTX *c);
+int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
+int SHA1_Final(unsigned char *md, SHA_CTX *c);
+unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md);
+void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
+# endif
+
+# define SHA256_CBLOCK   (SHA_LBLOCK*4)/* SHA-256 treats input data as a
+                                        * contiguous array of 32 bit wide
+                                        * big-endian values. */
+# define SHA224_DIGEST_LENGTH    28
+# define SHA256_DIGEST_LENGTH    32
+
+typedef struct SHA256state_st {
+    SHA_LONG h[8];
+    SHA_LONG Nl, Nh;
+    SHA_LONG data[SHA_LBLOCK];
+    unsigned int num, md_len;
+} SHA256_CTX;
+
+# ifndef OPENSSL_NO_SHA256
+#  ifdef OPENSSL_FIPS
+int private_SHA224_Init(SHA256_CTX *c);
+int private_SHA256_Init(SHA256_CTX *c);
+#  endif
+int SHA224_Init(SHA256_CTX *c);
+int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
+int SHA224_Final(unsigned char *md, SHA256_CTX *c);
+unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md);
+int SHA256_Init(SHA256_CTX *c);
+int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
+int SHA256_Final(unsigned char *md, SHA256_CTX *c);
+unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md);
+void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
+# endif
+
+# define SHA384_DIGEST_LENGTH    48
+# define SHA512_DIGEST_LENGTH    64
+
+# ifndef OPENSSL_NO_SHA512
+/*
+ * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64
+ * being exactly 64-bit wide. See Implementation Notes in sha512.c
+ * for further details.
+ */
+/*
+ * SHA-512 treats input data as a
+ * contiguous array of 64 bit
+ * wide big-endian values.
+ */
+#  define SHA512_CBLOCK   (SHA_LBLOCK*8)
+#  if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
+#   define SHA_LONG64 unsigned __int64
+#   define U64(C)     C##UI64
+#  elif defined(__arch64__)
+#   define SHA_LONG64 unsigned long
+#   define U64(C)     C##UL
+#  else
+#   define SHA_LONG64 unsigned long long
+#   define U64(C)     C##ULL
+#  endif
+
+typedef struct SHA512state_st {
+    SHA_LONG64 h[8];
+    SHA_LONG64 Nl, Nh;
+    union {
+        SHA_LONG64 d[SHA_LBLOCK];
+        unsigned char p[SHA512_CBLOCK];
+    } u;
+    unsigned int num, md_len;
+} SHA512_CTX;
+# endif
+
+# ifndef OPENSSL_NO_SHA512
+#  ifdef OPENSSL_FIPS
+int private_SHA384_Init(SHA512_CTX *c);
+int private_SHA512_Init(SHA512_CTX *c);
+#  endif
+int SHA384_Init(SHA512_CTX *c);
+int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
+int SHA384_Final(unsigned char *md, SHA512_CTX *c);
+unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md);
+int SHA512_Init(SHA512_CTX *c);
+int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
+int SHA512_Final(unsigned char *md, SHA512_CTX *c);
+unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md);
+void SHA512_Transform(SHA512_CTX *c, const unsigned char *data);
+# endif
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/sha.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/lhash.h
===================================================================
--- lab4/.minix-src/include/openssl/lhash.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/lhash.h	(revision 13)
@@ -0,0 +1,240 @@
+/* crypto/lhash/lhash.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+/*
+ * Header for dynamic hash table routines Author - Eric Young
+ */
+
+#ifndef HEADER_LHASH_H
+# define HEADER_LHASH_H
+
+# include <openssl/e_os2.h>
+# ifndef OPENSSL_NO_FP_API
+#  include <stdio.h>
+# endif
+
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct lhash_node_st {
+    void *data;
+    struct lhash_node_st *next;
+# ifndef OPENSSL_NO_HASH_COMP
+    unsigned long hash;
+# endif
+} LHASH_NODE;
+
+typedef int (*LHASH_COMP_FN_TYPE) (const void *, const void *);
+typedef unsigned long (*LHASH_HASH_FN_TYPE) (const void *);
+typedef void (*LHASH_DOALL_FN_TYPE) (void *);
+typedef void (*LHASH_DOALL_ARG_FN_TYPE) (void *, void *);
+
+/*
+ * Macros for declaring and implementing type-safe wrappers for LHASH
+ * callbacks. This way, callbacks can be provided to LHASH structures without
+ * function pointer casting and the macro-defined callbacks provide
+ * per-variable casting before deferring to the underlying type-specific
+ * callbacks. NB: It is possible to place a "static" in front of both the
+ * DECLARE and IMPLEMENT macros if the functions are strictly internal.
+ */
+
+/* First: "hash" functions */
+# define DECLARE_LHASH_HASH_FN(name, o_type) \
+        unsigned long name##_LHASH_HASH(const void *);
+# define IMPLEMENT_LHASH_HASH_FN(name, o_type) \
+        unsigned long name##_LHASH_HASH(const void *arg) { \
+                const o_type *a = arg; \
+                return name##_hash(a); }
+# define LHASH_HASH_FN(name) name##_LHASH_HASH
+
+/* Second: "compare" functions */
+# define DECLARE_LHASH_COMP_FN(name, o_type) \
+        int name##_LHASH_COMP(const void *, const void *);
+# define IMPLEMENT_LHASH_COMP_FN(name, o_type) \
+        int name##_LHASH_COMP(const void *arg1, const void *arg2) { \
+                const o_type *a = arg1;             \
+                const o_type *b = arg2; \
+                return name##_cmp(a,b); }
+# define LHASH_COMP_FN(name) name##_LHASH_COMP
+
+/* Third: "doall" functions */
+# define DECLARE_LHASH_DOALL_FN(name, o_type) \
+        void name##_LHASH_DOALL(void *);
+# define IMPLEMENT_LHASH_DOALL_FN(name, o_type) \
+        void name##_LHASH_DOALL(void *arg) { \
+                o_type *a = arg; \
+                name##_doall(a); }
+# define LHASH_DOALL_FN(name) name##_LHASH_DOALL
+
+/* Fourth: "doall_arg" functions */
+# define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
+        void name##_LHASH_DOALL_ARG(void *, void *);
+# define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
+        void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \
+                o_type *a = arg1; \
+                a_type *b = arg2; \
+                name##_doall_arg(a, b); }
+# define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG
+
+typedef struct lhash_st {
+    LHASH_NODE **b;
+    LHASH_COMP_FN_TYPE comp;
+    LHASH_HASH_FN_TYPE hash;
+    unsigned int num_nodes;
+    unsigned int num_alloc_nodes;
+    unsigned int p;
+    unsigned int pmax;
+    unsigned long up_load;      /* load times 256 */
+    unsigned long down_load;    /* load times 256 */
+    unsigned long num_items;
+    unsigned long num_expands;
+    unsigned long num_expand_reallocs;
+    unsigned long num_contracts;
+    unsigned long num_contract_reallocs;
+    unsigned long num_hash_calls;
+    unsigned long num_comp_calls;
+    unsigned long num_insert;
+    unsigned long num_replace;
+    unsigned long num_delete;
+    unsigned long num_no_delete;
+    unsigned long num_retrieve;
+    unsigned long num_retrieve_miss;
+    unsigned long num_hash_comps;
+    int error;
+} _LHASH;                       /* Do not use _LHASH directly, use LHASH_OF
+                                 * and friends */
+
+# define LH_LOAD_MULT    256
+
+/*
+ * Indicates a malloc() error in the last call, this is only bad in
+ * lh_insert().
+ */
+# define lh_error(lh)    ((lh)->error)
+
+_LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c);
+void lh_free(_LHASH *lh);
+void *lh_insert(_LHASH *lh, void *data);
+void *lh_delete(_LHASH *lh, const void *data);
+void *lh_retrieve(_LHASH *lh, const void *data);
+void lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func);
+void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg);
+unsigned long lh_strhash(const void *c);
+unsigned long lh_num_items(const _LHASH *lh);
+
+# ifndef OPENSSL_NO_FP_API
+void lh_stats(const _LHASH *lh, FILE *out);
+void lh_node_stats(const _LHASH *lh, FILE *out);
+void lh_node_usage_stats(const _LHASH *lh, FILE *out);
+# endif
+
+# ifndef OPENSSL_NO_BIO
+void lh_stats_bio(const _LHASH *lh, BIO *out);
+void lh_node_stats_bio(const _LHASH *lh, BIO *out);
+void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out);
+# endif
+
+/* Type checking... */
+
+# define LHASH_OF(type) struct lhash_st_##type
+
+# define DECLARE_LHASH_OF(type) LHASH_OF(type) { int dummy; }
+
+# define CHECKED_LHASH_OF(type,lh) \
+  ((_LHASH *)CHECKED_PTR_OF(LHASH_OF(type),lh))
+
+/* Define wrapper functions. */
+# define LHM_lh_new(type, name) \
+  ((LHASH_OF(type) *)lh_new(LHASH_HASH_FN(name), LHASH_COMP_FN(name)))
+# define LHM_lh_error(type, lh) \
+  lh_error(CHECKED_LHASH_OF(type,lh))
+# define LHM_lh_insert(type, lh, inst) \
+  ((type *)lh_insert(CHECKED_LHASH_OF(type, lh), \
+                     CHECKED_PTR_OF(type, inst)))
+# define LHM_lh_retrieve(type, lh, inst) \
+  ((type *)lh_retrieve(CHECKED_LHASH_OF(type, lh), \
+                       CHECKED_PTR_OF(type, inst)))
+# define LHM_lh_delete(type, lh, inst) \
+  ((type *)lh_delete(CHECKED_LHASH_OF(type, lh),                        \
+                     CHECKED_PTR_OF(type, inst)))
+# define LHM_lh_doall(type, lh,fn) lh_doall(CHECKED_LHASH_OF(type, lh), fn)
+# define LHM_lh_doall_arg(type, lh, fn, arg_type, arg) \
+  lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg))
+# define LHM_lh_num_items(type, lh) lh_num_items(CHECKED_LHASH_OF(type, lh))
+# define LHM_lh_down_load(type, lh) (CHECKED_LHASH_OF(type, lh)->down_load)
+# define LHM_lh_node_stats_bio(type, lh, out) \
+  lh_node_stats_bio(CHECKED_LHASH_OF(type, lh), out)
+# define LHM_lh_node_usage_stats_bio(type, lh, out) \
+  lh_node_usage_stats_bio(CHECKED_LHASH_OF(type, lh), out)
+# define LHM_lh_stats_bio(type, lh, out) \
+  lh_stats_bio(CHECKED_LHASH_OF(type, lh), out)
+# define LHM_lh_free(type, lh) lh_free(CHECKED_LHASH_OF(type, lh))
+
+DECLARE_LHASH_OF(OPENSSL_STRING);
+DECLARE_LHASH_OF(OPENSSL_CSTRING);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/lhash.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/mdc2.h
===================================================================
--- lab4/.minix-src/include/openssl/mdc2.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/mdc2.h	(revision 13)
@@ -0,0 +1,94 @@
+/* crypto/mdc2/mdc2.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_MDC2_H
+# define HEADER_MDC2_H
+
+# include <openssl/des.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifdef OPENSSL_NO_MDC2
+#  error MDC2 is disabled.
+# endif
+
+# define MDC2_BLOCK              8
+# define MDC2_DIGEST_LENGTH      16
+
+typedef struct mdc2_ctx_st {
+    unsigned int num;
+    unsigned char data[MDC2_BLOCK];
+    DES_cblock h, hh;
+    int pad_type;               /* either 1 or 2, default 1 */
+} MDC2_CTX;
+
+# ifdef OPENSSL_FIPS
+int private_MDC2_Init(MDC2_CTX *c);
+# endif
+int MDC2_Init(MDC2_CTX *c);
+int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len);
+int MDC2_Final(unsigned char *md, MDC2_CTX *c);
+unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/mdc2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ocsp.h
===================================================================
--- lab4/.minix-src/include/openssl/ocsp.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ocsp.h	(revision 13)
@@ -0,0 +1,626 @@
+/* ocsp.h */
+/*
+ * Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
+ * project.
+ */
+
+/*
+ * History: This file was transfered to Richard Levitte from CertCo by Kathy
+ * Weinhold in mid-spring 2000 to be included in OpenSSL or released as a
+ * patch kit.
+ */
+
+/* ====================================================================
+ * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_OCSP_H
+# define HEADER_OCSP_H
+
+# include <openssl/ossl_typ.h>
+# include <openssl/x509.h>
+# include <openssl/x509v3.h>
+# include <openssl/safestack.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Various flags and values */
+
+# define OCSP_DEFAULT_NONCE_LENGTH       16
+
+# define OCSP_NOCERTS                    0x1
+# define OCSP_NOINTERN                   0x2
+# define OCSP_NOSIGS                     0x4
+# define OCSP_NOCHAIN                    0x8
+# define OCSP_NOVERIFY                   0x10
+# define OCSP_NOEXPLICIT                 0x20
+# define OCSP_NOCASIGN                   0x40
+# define OCSP_NODELEGATED                0x80
+# define OCSP_NOCHECKS                   0x100
+# define OCSP_TRUSTOTHER                 0x200
+# define OCSP_RESPID_KEY                 0x400
+# define OCSP_NOTIME                     0x800
+
+/*-  CertID ::= SEQUENCE {
+ *       hashAlgorithm            AlgorithmIdentifier,
+ *       issuerNameHash     OCTET STRING, -- Hash of Issuer's DN
+ *       issuerKeyHash      OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields)
+ *       serialNumber       CertificateSerialNumber }
+ */
+typedef struct ocsp_cert_id_st {
+    X509_ALGOR *hashAlgorithm;
+    ASN1_OCTET_STRING *issuerNameHash;
+    ASN1_OCTET_STRING *issuerKeyHash;
+    ASN1_INTEGER *serialNumber;
+} OCSP_CERTID;
+
+DECLARE_STACK_OF(OCSP_CERTID)
+
+/*-  Request ::=     SEQUENCE {
+ *       reqCert                    CertID,
+ *       singleRequestExtensions    [0] EXPLICIT Extensions OPTIONAL }
+ */
+typedef struct ocsp_one_request_st {
+    OCSP_CERTID *reqCert;
+    STACK_OF(X509_EXTENSION) *singleRequestExtensions;
+} OCSP_ONEREQ;
+
+DECLARE_STACK_OF(OCSP_ONEREQ)
+DECLARE_ASN1_SET_OF(OCSP_ONEREQ)
+
+/*-  TBSRequest      ::=     SEQUENCE {
+ *       version             [0] EXPLICIT Version DEFAULT v1,
+ *       requestorName       [1] EXPLICIT GeneralName OPTIONAL,
+ *       requestList             SEQUENCE OF Request,
+ *       requestExtensions   [2] EXPLICIT Extensions OPTIONAL }
+ */
+typedef struct ocsp_req_info_st {
+    ASN1_INTEGER *version;
+    GENERAL_NAME *requestorName;
+    STACK_OF(OCSP_ONEREQ) *requestList;
+    STACK_OF(X509_EXTENSION) *requestExtensions;
+} OCSP_REQINFO;
+
+/*-  Signature       ::=     SEQUENCE {
+ *       signatureAlgorithm   AlgorithmIdentifier,
+ *       signature            BIT STRING,
+ *       certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
+ */
+typedef struct ocsp_signature_st {
+    X509_ALGOR *signatureAlgorithm;
+    ASN1_BIT_STRING *signature;
+    STACK_OF(X509) *certs;
+} OCSP_SIGNATURE;
+
+/*-  OCSPRequest     ::=     SEQUENCE {
+ *       tbsRequest                  TBSRequest,
+ *       optionalSignature   [0]     EXPLICIT Signature OPTIONAL }
+ */
+typedef struct ocsp_request_st {
+    OCSP_REQINFO *tbsRequest;
+    OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */
+} OCSP_REQUEST;
+
+/*-  OCSPResponseStatus ::= ENUMERATED {
+ *       successful            (0),      --Response has valid confirmations
+ *       malformedRequest      (1),      --Illegal confirmation request
+ *       internalError         (2),      --Internal error in issuer
+ *       tryLater              (3),      --Try again later
+ *                                       --(4) is not used
+ *       sigRequired           (5),      --Must sign the request
+ *       unauthorized          (6)       --Request unauthorized
+ *   }
+ */
+# define OCSP_RESPONSE_STATUS_SUCCESSFUL          0
+# define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST     1
+# define OCSP_RESPONSE_STATUS_INTERNALERROR        2
+# define OCSP_RESPONSE_STATUS_TRYLATER             3
+# define OCSP_RESPONSE_STATUS_SIGREQUIRED          5
+# define OCSP_RESPONSE_STATUS_UNAUTHORIZED         6
+
+/*-  ResponseBytes ::=       SEQUENCE {
+ *       responseType   OBJECT IDENTIFIER,
+ *       response       OCTET STRING }
+ */
+typedef struct ocsp_resp_bytes_st {
+    ASN1_OBJECT *responseType;
+    ASN1_OCTET_STRING *response;
+} OCSP_RESPBYTES;
+
+/*-  OCSPResponse ::= SEQUENCE {
+ *      responseStatus         OCSPResponseStatus,
+ *      responseBytes          [0] EXPLICIT ResponseBytes OPTIONAL }
+ */
+struct ocsp_response_st {
+    ASN1_ENUMERATED *responseStatus;
+    OCSP_RESPBYTES *responseBytes;
+};
+
+/*-  ResponderID ::= CHOICE {
+ *      byName   [1] Name,
+ *      byKey    [2] KeyHash }
+ */
+# define V_OCSP_RESPID_NAME 0
+# define V_OCSP_RESPID_KEY  1
+struct ocsp_responder_id_st {
+    int type;
+    union {
+        X509_NAME *byName;
+        ASN1_OCTET_STRING *byKey;
+    } value;
+};
+
+DECLARE_STACK_OF(OCSP_RESPID)
+DECLARE_ASN1_FUNCTIONS(OCSP_RESPID)
+
+/*-  KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key
+ *                            --(excluding the tag and length fields)
+ */
+
+/*-  RevokedInfo ::= SEQUENCE {
+ *       revocationTime              GeneralizedTime,
+ *       revocationReason    [0]     EXPLICIT CRLReason OPTIONAL }
+ */
+typedef struct ocsp_revoked_info_st {
+    ASN1_GENERALIZEDTIME *revocationTime;
+    ASN1_ENUMERATED *revocationReason;
+} OCSP_REVOKEDINFO;
+
+/*-  CertStatus ::= CHOICE {
+ *       good                [0]     IMPLICIT NULL,
+ *       revoked             [1]     IMPLICIT RevokedInfo,
+ *       unknown             [2]     IMPLICIT UnknownInfo }
+ */
+# define V_OCSP_CERTSTATUS_GOOD    0
+# define V_OCSP_CERTSTATUS_REVOKED 1
+# define V_OCSP_CERTSTATUS_UNKNOWN 2
+typedef struct ocsp_cert_status_st {
+    int type;
+    union {
+        ASN1_NULL *good;
+        OCSP_REVOKEDINFO *revoked;
+        ASN1_NULL *unknown;
+    } value;
+} OCSP_CERTSTATUS;
+
+/*-  SingleResponse ::= SEQUENCE {
+ *      certID                       CertID,
+ *      certStatus                   CertStatus,
+ *      thisUpdate                   GeneralizedTime,
+ *      nextUpdate           [0]     EXPLICIT GeneralizedTime OPTIONAL,
+ *      singleExtensions     [1]     EXPLICIT Extensions OPTIONAL }
+ */
+typedef struct ocsp_single_response_st {
+    OCSP_CERTID *certId;
+    OCSP_CERTSTATUS *certStatus;
+    ASN1_GENERALIZEDTIME *thisUpdate;
+    ASN1_GENERALIZEDTIME *nextUpdate;
+    STACK_OF(X509_EXTENSION) *singleExtensions;
+} OCSP_SINGLERESP;
+
+DECLARE_STACK_OF(OCSP_SINGLERESP)
+DECLARE_ASN1_SET_OF(OCSP_SINGLERESP)
+
+/*-  ResponseData ::= SEQUENCE {
+ *      version              [0] EXPLICIT Version DEFAULT v1,
+ *      responderID              ResponderID,
+ *      producedAt               GeneralizedTime,
+ *      responses                SEQUENCE OF SingleResponse,
+ *      responseExtensions   [1] EXPLICIT Extensions OPTIONAL }
+ */
+typedef struct ocsp_response_data_st {
+    ASN1_INTEGER *version;
+    OCSP_RESPID *responderId;
+    ASN1_GENERALIZEDTIME *producedAt;
+    STACK_OF(OCSP_SINGLERESP) *responses;
+    STACK_OF(X509_EXTENSION) *responseExtensions;
+} OCSP_RESPDATA;
+
+/*-  BasicOCSPResponse       ::= SEQUENCE {
+ *      tbsResponseData      ResponseData,
+ *      signatureAlgorithm   AlgorithmIdentifier,
+ *      signature            BIT STRING,
+ *      certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
+ */
+  /*
+   * Note 1: The value for "signature" is specified in the OCSP rfc2560 as
+   * follows: "The value for the signature SHALL be computed on the hash of
+   * the DER encoding ResponseData." This means that you must hash the
+   * DER-encoded tbsResponseData, and then run it through a crypto-signing
+   * function, which will (at least w/RSA) do a hash-'n'-private-encrypt
+   * operation.  This seems a bit odd, but that's the spec.  Also note that
+   * the data structures do not leave anywhere to independently specify the
+   * algorithm used for the initial hash. So, we look at the
+   * signature-specification algorithm, and try to do something intelligent.
+   * -- Kathy Weinhold, CertCo
+   */
+  /*
+   * Note 2: It seems that the mentioned passage from RFC 2560 (section
+   * 4.2.1) is open for interpretation.  I've done tests against another
+   * responder, and found that it doesn't do the double hashing that the RFC
+   * seems to say one should.  Therefore, all relevant functions take a flag
+   * saying which variant should be used.  -- Richard Levitte, OpenSSL team
+   * and CeloCom
+   */
+typedef struct ocsp_basic_response_st {
+    OCSP_RESPDATA *tbsResponseData;
+    X509_ALGOR *signatureAlgorithm;
+    ASN1_BIT_STRING *signature;
+    STACK_OF(X509) *certs;
+} OCSP_BASICRESP;
+
+/*-
+ *   CRLReason ::= ENUMERATED {
+ *        unspecified             (0),
+ *        keyCompromise           (1),
+ *        cACompromise            (2),
+ *        affiliationChanged      (3),
+ *        superseded              (4),
+ *        cessationOfOperation    (5),
+ *        certificateHold         (6),
+ *        removeFromCRL           (8) }
+ */
+# define OCSP_REVOKED_STATUS_NOSTATUS               -1
+# define OCSP_REVOKED_STATUS_UNSPECIFIED             0
+# define OCSP_REVOKED_STATUS_KEYCOMPROMISE           1
+# define OCSP_REVOKED_STATUS_CACOMPROMISE            2
+# define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED      3
+# define OCSP_REVOKED_STATUS_SUPERSEDED              4
+# define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION    5
+# define OCSP_REVOKED_STATUS_CERTIFICATEHOLD         6
+# define OCSP_REVOKED_STATUS_REMOVEFROMCRL           8
+
+/*-
+ * CrlID ::= SEQUENCE {
+ *     crlUrl               [0]     EXPLICIT IA5String OPTIONAL,
+ *     crlNum               [1]     EXPLICIT INTEGER OPTIONAL,
+ *     crlTime              [2]     EXPLICIT GeneralizedTime OPTIONAL }
+ */
+typedef struct ocsp_crl_id_st {
+    ASN1_IA5STRING *crlUrl;
+    ASN1_INTEGER *crlNum;
+    ASN1_GENERALIZEDTIME *crlTime;
+} OCSP_CRLID;
+
+/*-
+ * ServiceLocator ::= SEQUENCE {
+ *      issuer    Name,
+ *      locator   AuthorityInfoAccessSyntax OPTIONAL }
+ */
+typedef struct ocsp_service_locator_st {
+    X509_NAME *issuer;
+    STACK_OF(ACCESS_DESCRIPTION) *locator;
+} OCSP_SERVICELOC;
+
+# define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
+# define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
+
+# define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)
+
+# define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)
+
+# define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
+     (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)
+
+# define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\
+     (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL)
+
+# define PEM_write_bio_OCSP_REQUEST(bp,o) \
+    PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\
+                        bp,(char *)o, NULL,NULL,0,NULL,NULL)
+
+# define PEM_write_bio_OCSP_RESPONSE(bp,o) \
+    PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
+                        bp,(char *)o, NULL,NULL,0,NULL,NULL)
+
+# define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)
+
+# define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)
+
+# define OCSP_REQUEST_sign(o,pkey,md) \
+        ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\
+                o->optionalSignature->signatureAlgorithm,NULL,\
+                o->optionalSignature->signature,o->tbsRequest,pkey,md)
+
+# define OCSP_BASICRESP_sign(o,pkey,md,d) \
+        ASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\
+                o->signature,o->tbsResponseData,pkey,md)
+
+# define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\
+        a->optionalSignature->signatureAlgorithm,\
+        a->optionalSignature->signature,a->tbsRequest,r)
+
+# define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\
+        a->signatureAlgorithm,a->signature,a->tbsResponseData,r)
+
+# define ASN1_BIT_STRING_digest(data,type,md,len) \
+        ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
+
+# define OCSP_CERTSTATUS_dup(cs)\
+                (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
+                (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))
+
+OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id);
+
+OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req);
+OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req,
+                               int maxline);
+int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx);
+void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);
+int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req);
+int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx,
+                             const char *name, const char *value);
+
+OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);
+
+OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,
+                              X509_NAME *issuerName,
+                              ASN1_BIT_STRING *issuerKey,
+                              ASN1_INTEGER *serialNumber);
+
+OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);
+
+int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);
+int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len);
+int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs);
+int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);
+
+int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm);
+int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);
+
+int OCSP_request_sign(OCSP_REQUEST *req,
+                      X509 *signer,
+                      EVP_PKEY *key,
+                      const EVP_MD *dgst,
+                      STACK_OF(X509) *certs, unsigned long flags);
+
+int OCSP_response_status(OCSP_RESPONSE *resp);
+OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);
+
+int OCSP_resp_count(OCSP_BASICRESP *bs);
+OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);
+int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);
+int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,
+                            ASN1_GENERALIZEDTIME **revtime,
+                            ASN1_GENERALIZEDTIME **thisupd,
+                            ASN1_GENERALIZEDTIME **nextupd);
+int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,
+                          int *reason,
+                          ASN1_GENERALIZEDTIME **revtime,
+                          ASN1_GENERALIZEDTIME **thisupd,
+                          ASN1_GENERALIZEDTIME **nextupd);
+int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,
+                        ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec);
+
+int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs,
+                        X509_STORE *store, unsigned long flags);
+
+int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath,
+                   int *pssl);
+
+int OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
+int OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
+
+int OCSP_request_onereq_count(OCSP_REQUEST *req);
+OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);
+OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one);
+int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,
+                      ASN1_OCTET_STRING **pikeyHash,
+                      ASN1_INTEGER **pserial, OCSP_CERTID *cid);
+int OCSP_request_is_signed(OCSP_REQUEST *req);
+OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);
+OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp,
+                                        OCSP_CERTID *cid,
+                                        int status, int reason,
+                                        ASN1_TIME *revtime,
+                                        ASN1_TIME *thisupd,
+                                        ASN1_TIME *nextupd);
+int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert);
+int OCSP_basic_sign(OCSP_BASICRESP *brsp,
+                    X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
+                    STACK_OF(X509) *certs, unsigned long flags);
+
+X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
+
+X509_EXTENSION *OCSP_accept_responses_new(char **oids);
+
+X509_EXTENSION *OCSP_archive_cutoff_new(char *tim);
+
+X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, char **urls);
+
+int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x);
+int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos);
+int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj,
+                                int lastpos);
+int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos);
+X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc);
+X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc);
+void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit,
+                                int *idx);
+int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit,
+                              unsigned long flags);
+int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc);
+
+int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x);
+int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos);
+int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj, int lastpos);
+int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos);
+X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc);
+X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc);
+void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx);
+int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit,
+                             unsigned long flags);
+int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc);
+
+int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x);
+int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos);
+int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj,
+                                  int lastpos);
+int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit,
+                                       int lastpos);
+X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc);
+X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc);
+void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit,
+                                  int *idx);
+int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value,
+                                int crit, unsigned long flags);
+int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc);
+
+int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x);
+int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos);
+int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj,
+                                   int lastpos);
+int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit,
+                                        int lastpos);
+X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc);
+X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc);
+void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit,
+                                   int *idx);
+int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value,
+                                 int crit, unsigned long flags);
+int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc);
+
+DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP)
+DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS)
+DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO)
+DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP)
+DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA)
+DECLARE_ASN1_FUNCTIONS(OCSP_RESPID)
+DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE)
+DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES)
+DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ)
+DECLARE_ASN1_FUNCTIONS(OCSP_CERTID)
+DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST)
+DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE)
+DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO)
+DECLARE_ASN1_FUNCTIONS(OCSP_CRLID)
+DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC)
+
+const char *OCSP_response_status_str(long s);
+const char *OCSP_cert_status_str(long s);
+const char *OCSP_crl_reason_str(long s);
+
+int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags);
+int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags);
+
+int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
+                      X509_STORE *st, unsigned long flags);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_OCSP_strings(void);
+
+/* Error codes for the OCSP functions. */
+
+/* Function codes. */
+# define OCSP_F_ASN1_STRING_ENCODE                        100
+# define OCSP_F_D2I_OCSP_NONCE                            102
+# define OCSP_F_OCSP_BASIC_ADD1_STATUS                    103
+# define OCSP_F_OCSP_BASIC_SIGN                           104
+# define OCSP_F_OCSP_BASIC_VERIFY                         105
+# define OCSP_F_OCSP_CERT_ID_NEW                          101
+# define OCSP_F_OCSP_CHECK_DELEGATED                      106
+# define OCSP_F_OCSP_CHECK_IDS                            107
+# define OCSP_F_OCSP_CHECK_ISSUER                         108
+# define OCSP_F_OCSP_CHECK_VALIDITY                       115
+# define OCSP_F_OCSP_MATCH_ISSUERID                       109
+# define OCSP_F_OCSP_PARSE_URL                            114
+# define OCSP_F_OCSP_REQUEST_SIGN                         110
+# define OCSP_F_OCSP_REQUEST_VERIFY                       116
+# define OCSP_F_OCSP_RESPONSE_GET1_BASIC                  111
+# define OCSP_F_OCSP_SENDREQ_BIO                          112
+# define OCSP_F_OCSP_SENDREQ_NBIO                         117
+# define OCSP_F_PARSE_HTTP_LINE1                          118
+# define OCSP_F_REQUEST_VERIFY                            113
+
+/* Reason codes. */
+# define OCSP_R_BAD_DATA                                  100
+# define OCSP_R_CERTIFICATE_VERIFY_ERROR                  101
+# define OCSP_R_DIGEST_ERR                                102
+# define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD                 122
+# define OCSP_R_ERROR_IN_THISUPDATE_FIELD                 123
+# define OCSP_R_ERROR_PARSING_URL                         121
+# define OCSP_R_MISSING_OCSPSIGNING_USAGE                 103
+# define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE              124
+# define OCSP_R_NOT_BASIC_RESPONSE                        104
+# define OCSP_R_NO_CERTIFICATES_IN_CHAIN                  105
+# define OCSP_R_NO_CONTENT                                106
+# define OCSP_R_NO_PUBLIC_KEY                             107
+# define OCSP_R_NO_RESPONSE_DATA                          108
+# define OCSP_R_NO_REVOKED_TIME                           109
+# define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE    110
+# define OCSP_R_REQUEST_NOT_SIGNED                        128
+# define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA      111
+# define OCSP_R_ROOT_CA_NOT_TRUSTED                       112
+# define OCSP_R_SERVER_READ_ERROR                         113
+# define OCSP_R_SERVER_RESPONSE_ERROR                     114
+# define OCSP_R_SERVER_RESPONSE_PARSE_ERROR               115
+# define OCSP_R_SERVER_WRITE_ERROR                        116
+# define OCSP_R_SIGNATURE_FAILURE                         117
+# define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND              118
+# define OCSP_R_STATUS_EXPIRED                            125
+# define OCSP_R_STATUS_NOT_YET_VALID                      126
+# define OCSP_R_STATUS_TOO_OLD                            127
+# define OCSP_R_UNKNOWN_MESSAGE_DIGEST                    119
+# define OCSP_R_UNKNOWN_NID                               120
+# define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE            129
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ocsp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/pem.h
===================================================================
--- lab4/.minix-src/include/openssl/pem.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/pem.h	(revision 13)
@@ -0,0 +1,611 @@
+/* crypto/pem/pem.h */
+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_PEM_H
+# define HEADER_PEM_H
+
+# include <openssl/e_os2.h>
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+# ifndef OPENSSL_NO_STACK
+#  include <openssl/stack.h>
+# endif
+# include <openssl/evp.h>
+# include <openssl/x509.h>
+# include <openssl/pem2.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# define PEM_BUFSIZE             1024
+
+# define PEM_OBJ_UNDEF           0
+# define PEM_OBJ_X509            1
+# define PEM_OBJ_X509_REQ        2
+# define PEM_OBJ_CRL             3
+# define PEM_OBJ_SSL_SESSION     4
+# define PEM_OBJ_PRIV_KEY        10
+# define PEM_OBJ_PRIV_RSA        11
+# define PEM_OBJ_PRIV_DSA        12
+# define PEM_OBJ_PRIV_DH         13
+# define PEM_OBJ_PUB_RSA         14
+# define PEM_OBJ_PUB_DSA         15
+# define PEM_OBJ_PUB_DH          16
+# define PEM_OBJ_DHPARAMS        17
+# define PEM_OBJ_DSAPARAMS       18
+# define PEM_OBJ_PRIV_RSA_PUBLIC 19
+# define PEM_OBJ_PRIV_ECDSA      20
+# define PEM_OBJ_PUB_ECDSA       21
+# define PEM_OBJ_ECPARAMETERS    22
+
+# define PEM_ERROR               30
+# define PEM_DEK_DES_CBC         40
+# define PEM_DEK_IDEA_CBC        45
+# define PEM_DEK_DES_EDE         50
+# define PEM_DEK_DES_ECB         60
+# define PEM_DEK_RSA             70
+# define PEM_DEK_RSA_MD2         80
+# define PEM_DEK_RSA_MD5         90
+
+# define PEM_MD_MD2              NID_md2
+# define PEM_MD_MD5              NID_md5
+# define PEM_MD_SHA              NID_sha
+# define PEM_MD_MD2_RSA          NID_md2WithRSAEncryption
+# define PEM_MD_MD5_RSA          NID_md5WithRSAEncryption
+# define PEM_MD_SHA_RSA          NID_sha1WithRSAEncryption
+
+# define PEM_STRING_X509_OLD     "X509 CERTIFICATE"
+# define PEM_STRING_X509         "CERTIFICATE"
+# define PEM_STRING_X509_PAIR    "CERTIFICATE PAIR"
+# define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE"
+# define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST"
+# define PEM_STRING_X509_REQ     "CERTIFICATE REQUEST"
+# define PEM_STRING_X509_CRL     "X509 CRL"
+# define PEM_STRING_EVP_PKEY     "ANY PRIVATE KEY"
+# define PEM_STRING_PUBLIC       "PUBLIC KEY"
+# define PEM_STRING_RSA          "RSA PRIVATE KEY"
+# define PEM_STRING_RSA_PUBLIC   "RSA PUBLIC KEY"
+# define PEM_STRING_DSA          "DSA PRIVATE KEY"
+# define PEM_STRING_DSA_PUBLIC   "DSA PUBLIC KEY"
+# define PEM_STRING_PKCS7        "PKCS7"
+# define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA"
+# define PEM_STRING_PKCS8        "ENCRYPTED PRIVATE KEY"
+# define PEM_STRING_PKCS8INF     "PRIVATE KEY"
+# define PEM_STRING_DHPARAMS     "DH PARAMETERS"
+# define PEM_STRING_SSL_SESSION  "SSL SESSION PARAMETERS"
+# define PEM_STRING_DSAPARAMS    "DSA PARAMETERS"
+# define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
+# define PEM_STRING_ECPARAMETERS "EC PARAMETERS"
+# define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
+# define PEM_STRING_PARAMETERS   "PARAMETERS"
+# define PEM_STRING_CMS          "CMS"
+
+  /*
+   * Note that this structure is initialised by PEM_SealInit and cleaned up
+   * by PEM_SealFinal (at least for now)
+   */
+typedef struct PEM_Encode_Seal_st {
+    EVP_ENCODE_CTX encode;
+    EVP_MD_CTX md;
+    EVP_CIPHER_CTX cipher;
+} PEM_ENCODE_SEAL_CTX;
+
+/* enc_type is one off */
+# define PEM_TYPE_ENCRYPTED      10
+# define PEM_TYPE_MIC_ONLY       20
+# define PEM_TYPE_MIC_CLEAR      30
+# define PEM_TYPE_CLEAR          40
+
+typedef struct pem_recip_st {
+    char *name;
+    X509_NAME *dn;
+    int cipher;
+    int key_enc;
+    /*      char iv[8]; unused and wrong size */
+} PEM_USER;
+
+typedef struct pem_ctx_st {
+    int type;                   /* what type of object */
+    struct {
+        int version;
+        int mode;
+    } proc_type;
+
+    char *domain;
+
+    struct {
+        int cipher;
+        /*-
+        unused, and wrong size
+        unsigned char iv[8]; */
+    } DEK_info;
+
+    PEM_USER *originator;
+
+    int num_recipient;
+    PEM_USER **recipient;
+
+/*-
+    XXX(ben): don#t think this is used!
+        STACK *x509_chain;      / * certificate chain */
+    EVP_MD *md;                 /* signature type */
+
+    int md_enc;                 /* is the md encrypted or not? */
+    int md_len;                 /* length of md_data */
+    char *md_data;              /* message digest, could be pkey encrypted */
+
+    EVP_CIPHER *dec;            /* date encryption cipher */
+    int key_len;                /* key length */
+    unsigned char *key;         /* key */
+  /*-
+    unused, and wrong size
+    unsigned char iv[8]; */
+
+    int data_enc;               /* is the data encrypted */
+    int data_len;
+    unsigned char *data;
+} PEM_CTX;
+
+/*
+ * These macros make the PEM_read/PEM_write functions easier to maintain and
+ * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or
+ * IMPLEMENT_PEM_rw_cb(...)
+ */
+
+# ifdef OPENSSL_NO_FP_API
+
+#  define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/
+#  define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/
+#  define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/
+#  define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/
+#  define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/
+# else
+
+#  define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
+type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
+{ \
+return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \
+}
+
+#  define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
+int PEM_write_##name(FILE *fp, type *x) \
+{ \
+return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \
+}
+
+#  define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
+int PEM_write_##name(FILE *fp, const type *x) \
+{ \
+return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \
+}
+
+#  define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
+int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
+             unsigned char *kstr, int klen, pem_password_cb *cb, \
+                  void *u) \
+        { \
+        return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \
+        }
+
+#  define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
+int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
+             unsigned char *kstr, int klen, pem_password_cb *cb, \
+                  void *u) \
+        { \
+        return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \
+        }
+
+# endif
+
+# define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
+type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
+{ \
+return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \
+}
+
+# define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
+int PEM_write_bio_##name(BIO *bp, type *x) \
+{ \
+return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \
+}
+
+# define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
+int PEM_write_bio_##name(BIO *bp, const type *x) \
+{ \
+return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \
+}
+
+# define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
+int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
+             unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
+        { \
+        return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \
+        }
+
+# define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
+int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
+             unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
+        { \
+        return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \
+        }
+
+# define IMPLEMENT_PEM_write(name, type, str, asn1) \
+        IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
+        IMPLEMENT_PEM_write_fp(name, type, str, asn1)
+
+# define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
+        IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
+        IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)
+
+# define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
+        IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
+        IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)
+
+# define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
+        IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
+        IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)
+
+# define IMPLEMENT_PEM_read(name, type, str, asn1) \
+        IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
+        IMPLEMENT_PEM_read_fp(name, type, str, asn1)
+
+# define IMPLEMENT_PEM_rw(name, type, str, asn1) \
+        IMPLEMENT_PEM_read(name, type, str, asn1) \
+        IMPLEMENT_PEM_write(name, type, str, asn1)
+
+# define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
+        IMPLEMENT_PEM_read(name, type, str, asn1) \
+        IMPLEMENT_PEM_write_const(name, type, str, asn1)
+
+# define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
+        IMPLEMENT_PEM_read(name, type, str, asn1) \
+        IMPLEMENT_PEM_write_cb(name, type, str, asn1)
+
+/* These are the same except they are for the declarations */
+
+# if defined(OPENSSL_NO_FP_API)
+
+#  define DECLARE_PEM_read_fp(name, type) /**/
+#  define DECLARE_PEM_write_fp(name, type) /**/
+#  define DECLARE_PEM_write_cb_fp(name, type) /**/
+# else
+
+#  define DECLARE_PEM_read_fp(name, type) \
+        type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);
+
+#  define DECLARE_PEM_write_fp(name, type) \
+        int PEM_write_##name(FILE *fp, type *x);
+
+#  define DECLARE_PEM_write_fp_const(name, type) \
+        int PEM_write_##name(FILE *fp, const type *x);
+
+#  define DECLARE_PEM_write_cb_fp(name, type) \
+        int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
+             unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
+
+# endif
+
+# ifndef OPENSSL_NO_BIO
+#  define DECLARE_PEM_read_bio(name, type) \
+        type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);
+
+#  define DECLARE_PEM_write_bio(name, type) \
+        int PEM_write_bio_##name(BIO *bp, type *x);
+
+#  define DECLARE_PEM_write_bio_const(name, type) \
+        int PEM_write_bio_##name(BIO *bp, const type *x);
+
+#  define DECLARE_PEM_write_cb_bio(name, type) \
+        int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
+             unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
+
+# else
+
+#  define DECLARE_PEM_read_bio(name, type) /**/
+#  define DECLARE_PEM_write_bio(name, type) /**/
+#  define DECLARE_PEM_write_bio_const(name, type) /**/
+#  define DECLARE_PEM_write_cb_bio(name, type) /**/
+# endif
+# define DECLARE_PEM_write(name, type) \
+        DECLARE_PEM_write_bio(name, type) \
+        DECLARE_PEM_write_fp(name, type)
+# define DECLARE_PEM_write_const(name, type) \
+        DECLARE_PEM_write_bio_const(name, type) \
+        DECLARE_PEM_write_fp_const(name, type)
+# define DECLARE_PEM_write_cb(name, type) \
+        DECLARE_PEM_write_cb_bio(name, type) \
+        DECLARE_PEM_write_cb_fp(name, type)
+# define DECLARE_PEM_read(name, type) \
+        DECLARE_PEM_read_bio(name, type) \
+        DECLARE_PEM_read_fp(name, type)
+# define DECLARE_PEM_rw(name, type) \
+        DECLARE_PEM_read(name, type) \
+        DECLARE_PEM_write(name, type)
+# define DECLARE_PEM_rw_const(name, type) \
+        DECLARE_PEM_read(name, type) \
+        DECLARE_PEM_write_const(name, type)
+# define DECLARE_PEM_rw_cb(name, type) \
+        DECLARE_PEM_read(name, type) \
+        DECLARE_PEM_write_cb(name, type)
+# if 1
+/* "userdata": new with OpenSSL 0.9.4 */
+typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata);
+# else
+/* OpenSSL 0.9.3, 0.9.3a */
+typedef int pem_password_cb (char *buf, int size, int rwflag);
+# endif
+
+int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
+int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len,
+                  pem_password_cb *callback, void *u);
+
+# ifndef OPENSSL_NO_BIO
+int PEM_read_bio(BIO *bp, char **name, char **header,
+                 unsigned char **data, long *len);
+int PEM_write_bio(BIO *bp, const char *name, char *hdr, unsigned char *data,
+                  long len);
+int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm,
+                       const char *name, BIO *bp, pem_password_cb *cb,
+                       void *u);
+void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x,
+                        pem_password_cb *cb, void *u);
+int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x,
+                       const EVP_CIPHER *enc, unsigned char *kstr, int klen,
+                       pem_password_cb *cb, void *u);
+
+STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,
+                                            pem_password_cb *cb, void *u);
+int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
+                            unsigned char *kstr, int klen,
+                            pem_password_cb *cd, void *u);
+# endif
+
+int PEM_read(FILE *fp, char **name, char **header,
+             unsigned char **data, long *len);
+int PEM_write(FILE *fp, char *name, char *hdr, unsigned char *data, long len);
+void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,
+                    pem_password_cb *cb, void *u);
+int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
+                   void *x, const EVP_CIPHER *enc, unsigned char *kstr,
+                   int klen, pem_password_cb *callback, void *u);
+STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
+                                        pem_password_cb *cb, void *u);
+
+int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
+                 EVP_MD *md_type, unsigned char **ek, int *ekl,
+                 unsigned char *iv, EVP_PKEY **pubk, int npubk);
+void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl,
+                    unsigned char *in, int inl);
+int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl,
+                  unsigned char *out, int *outl, EVP_PKEY *priv);
+
+void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type);
+void PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt);
+int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
+                  unsigned int *siglen, EVP_PKEY *pkey);
+
+int PEM_def_callback(char *buf, int num, int w, void *key);
+void PEM_proc_type(char *buf, int type);
+void PEM_dek_info(char *buf, const char *type, int len, char *str);
+
+# include <openssl/symhacks.h>
+
+DECLARE_PEM_rw(X509, X509)
+DECLARE_PEM_rw(X509_AUX, X509)
+DECLARE_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR)
+DECLARE_PEM_rw(X509_REQ, X509_REQ)
+DECLARE_PEM_write(X509_REQ_NEW, X509_REQ)
+DECLARE_PEM_rw(X509_CRL, X509_CRL)
+DECLARE_PEM_rw(PKCS7, PKCS7)
+DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE)
+DECLARE_PEM_rw(PKCS8, X509_SIG)
+DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
+# ifndef OPENSSL_NO_RSA
+DECLARE_PEM_rw_cb(RSAPrivateKey, RSA)
+DECLARE_PEM_rw_const(RSAPublicKey, RSA)
+DECLARE_PEM_rw(RSA_PUBKEY, RSA)
+# endif
+# ifndef OPENSSL_NO_DSA
+DECLARE_PEM_rw_cb(DSAPrivateKey, DSA)
+DECLARE_PEM_rw(DSA_PUBKEY, DSA)
+DECLARE_PEM_rw_const(DSAparams, DSA)
+# endif
+# ifndef OPENSSL_NO_EC
+DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP)
+DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY)
+DECLARE_PEM_rw(EC_PUBKEY, EC_KEY)
+# endif
+# ifndef OPENSSL_NO_DH
+DECLARE_PEM_rw_const(DHparams, DH)
+# endif
+DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)
+DECLARE_PEM_rw(PUBKEY, EVP_PKEY)
+
+int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
+                                      char *kstr, int klen,
+                                      pem_password_cb *cb, void *u);
+int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,
+                                  char *, int, pem_password_cb *, void *);
+int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
+                            char *kstr, int klen,
+                            pem_password_cb *cb, void *u);
+int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
+                                char *kstr, int klen,
+                                pem_password_cb *cb, void *u);
+EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
+                                  void *u);
+
+int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
+                           char *kstr, int klen,
+                           pem_password_cb *cb, void *u);
+int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
+                               char *kstr, int klen,
+                               pem_password_cb *cb, void *u);
+int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
+                                  char *kstr, int klen,
+                                  pem_password_cb *cb, void *u);
+
+EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
+                                 void *u);
+
+int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
+                              char *kstr, int klen, pem_password_cb *cd,
+                              void *u);
+
+EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
+int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
+
+EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length);
+EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length);
+EVP_PKEY *b2i_PrivateKey_bio(BIO *in);
+EVP_PKEY *b2i_PublicKey_bio(BIO *in);
+int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk);
+int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk);
+# ifndef OPENSSL_NO_RC4
+EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
+int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel,
+                pem_password_cb *cb, void *u);
+# endif
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_PEM_strings(void);
+
+/* Error codes for the PEM functions. */
+
+/* Function codes. */
+# define PEM_F_B2I_DSS                                    127
+# define PEM_F_B2I_PVK_BIO                                128
+# define PEM_F_B2I_RSA                                    129
+# define PEM_F_CHECK_BITLEN_DSA                           130
+# define PEM_F_CHECK_BITLEN_RSA                           131
+# define PEM_F_D2I_PKCS8PRIVATEKEY_BIO                    120
+# define PEM_F_D2I_PKCS8PRIVATEKEY_FP                     121
+# define PEM_F_DO_B2I                                     132
+# define PEM_F_DO_B2I_BIO                                 133
+# define PEM_F_DO_BLOB_HEADER                             134
+# define PEM_F_DO_PK8PKEY                                 126
+# define PEM_F_DO_PK8PKEY_FP                              125
+# define PEM_F_DO_PVK_BODY                                135
+# define PEM_F_DO_PVK_HEADER                              136
+# define PEM_F_I2B_PVK                                    137
+# define PEM_F_I2B_PVK_BIO                                138
+# define PEM_F_LOAD_IV                                    101
+# define PEM_F_PEM_ASN1_READ                              102
+# define PEM_F_PEM_ASN1_READ_BIO                          103
+# define PEM_F_PEM_ASN1_WRITE                             104
+# define PEM_F_PEM_ASN1_WRITE_BIO                         105
+# define PEM_F_PEM_DEF_CALLBACK                           100
+# define PEM_F_PEM_DO_HEADER                              106
+# define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY            118
+# define PEM_F_PEM_GET_EVP_CIPHER_INFO                    107
+# define PEM_F_PEM_PK8PKEY                                119
+# define PEM_F_PEM_READ                                   108
+# define PEM_F_PEM_READ_BIO                               109
+# define PEM_F_PEM_READ_BIO_PARAMETERS                    140
+# define PEM_F_PEM_READ_BIO_PRIVATEKEY                    123
+# define PEM_F_PEM_READ_PRIVATEKEY                        124
+# define PEM_F_PEM_SEALFINAL                              110
+# define PEM_F_PEM_SEALINIT                               111
+# define PEM_F_PEM_SIGNFINAL                              112
+# define PEM_F_PEM_WRITE                                  113
+# define PEM_F_PEM_WRITE_BIO                              114
+# define PEM_F_PEM_WRITE_PRIVATEKEY                       139
+# define PEM_F_PEM_X509_INFO_READ                         115
+# define PEM_F_PEM_X509_INFO_READ_BIO                     116
+# define PEM_F_PEM_X509_INFO_WRITE_BIO                    117
+
+/* Reason codes. */
+# define PEM_R_BAD_BASE64_DECODE                          100
+# define PEM_R_BAD_DECRYPT                                101
+# define PEM_R_BAD_END_LINE                               102
+# define PEM_R_BAD_IV_CHARS                               103
+# define PEM_R_BAD_MAGIC_NUMBER                           116
+# define PEM_R_BAD_PASSWORD_READ                          104
+# define PEM_R_BAD_VERSION_NUMBER                         117
+# define PEM_R_BIO_WRITE_FAILURE                          118
+# define PEM_R_CIPHER_IS_NULL                             127
+# define PEM_R_ERROR_CONVERTING_PRIVATE_KEY               115
+# define PEM_R_EXPECTING_PRIVATE_KEY_BLOB                 119
+# define PEM_R_EXPECTING_PUBLIC_KEY_BLOB                  120
+# define PEM_R_INCONSISTENT_HEADER                        121
+# define PEM_R_KEYBLOB_HEADER_PARSE_ERROR                 122
+# define PEM_R_KEYBLOB_TOO_SHORT                          123
+# define PEM_R_NOT_DEK_INFO                               105
+# define PEM_R_NOT_ENCRYPTED                              106
+# define PEM_R_NOT_PROC_TYPE                              107
+# define PEM_R_NO_START_LINE                              108
+# define PEM_R_PROBLEMS_GETTING_PASSWORD                  109
+# define PEM_R_PUBLIC_KEY_NO_RSA                          110
+# define PEM_R_PVK_DATA_TOO_SHORT                         124
+# define PEM_R_PVK_TOO_SHORT                              125
+# define PEM_R_READ_KEY                                   111
+# define PEM_R_SHORT_HEADER                               112
+# define PEM_R_UNSUPPORTED_CIPHER                         113
+# define PEM_R_UNSUPPORTED_ENCRYPTION                     114
+# define PEM_R_UNSUPPORTED_KEY_COMPONENTS                 126
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/pem.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/pqueue.h
===================================================================
--- lab4/.minix-src/include/openssl/pqueue.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/pqueue.h	(revision 13)
@@ -0,0 +1,99 @@
+/* crypto/pqueue/pqueue.h */
+/*
+ * DTLS implementation written by Nagendra Modadugu
+ * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
+ */
+/* ====================================================================
+ * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_PQUEUE_H
+# define HEADER_PQUEUE_H
+
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+typedef struct _pqueue *pqueue;
+
+typedef struct _pitem {
+    unsigned char priority[8];  /* 64-bit value in big-endian encoding */
+    void *data;
+    struct _pitem *next;
+} pitem;
+
+typedef struct _pitem *piterator;
+
+pitem *pitem_new(unsigned char *prio64be, void *data);
+void pitem_free(pitem *item);
+
+pqueue pqueue_new(void);
+void pqueue_free(pqueue pq);
+
+pitem *pqueue_insert(pqueue pq, pitem *item);
+pitem *pqueue_peek(pqueue pq);
+pitem *pqueue_pop(pqueue pq);
+pitem *pqueue_find(pqueue pq, unsigned char *prio64be);
+pitem *pqueue_iterator(pqueue pq);
+pitem *pqueue_next(piterator *iter);
+
+void pqueue_print(pqueue pq);
+int pqueue_size(pqueue pq);
+
+#ifdef  __cplusplus
+}
+#endif
+#endif                          /* ! HEADER_PQUEUE_H */

Property changes on: lab4/.minix-src/include/openssl/pqueue.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/rc5.h
===================================================================
--- lab4/.minix-src/include/openssl/rc5.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/rc5.h	(revision 13)
@@ -0,0 +1,120 @@
+/* crypto/rc5/rc5.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_RC5_H
+# define HEADER_RC5_H
+
+# include <openssl/opensslconf.h>/* OPENSSL_NO_RC5 */
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifdef OPENSSL_NO_RC5
+#  error RC5 is disabled.
+# endif
+
+# define RC5_ENCRYPT     1
+# define RC5_DECRYPT     0
+
+#if !defined(__NetBSD__) && !defined(__minix)
+/* 32 bit.  For Alpha, things may get weird */
+#  define RC5_32_INT unsigned long
+# else
+#  include <sys/types.h>
+#  define RC5_32_INT uint32_t
+# endif
+
+# define RC5_32_BLOCK            8
+# define RC5_32_KEY_LENGTH       16/* This is a default, max is 255 */
+
+/*
+ * This are the only values supported.  Tweak the code if you want more The
+ * most supported modes will be RC5-32/12/16 RC5-32/16/8
+ */
+# define RC5_8_ROUNDS    8
+# define RC5_12_ROUNDS   12
+# define RC5_16_ROUNDS   16
+
+typedef struct rc5_key_st {
+    /* Number of rounds */
+    int rounds;
+    RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)];
+} RC5_32_KEY;
+
+void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
+                    int rounds);
+void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out,
+                        RC5_32_KEY *key, int enc);
+void RC5_32_encrypt(RC5_32_INT *data, RC5_32_KEY *key);
+void RC5_32_decrypt(RC5_32_INT *data, RC5_32_KEY *key);
+void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out,
+                        long length, RC5_32_KEY *ks, unsigned char *iv,
+                        int enc);
+void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out,
+                          long length, RC5_32_KEY *schedule,
+                          unsigned char *ivec, int *num, int enc);
+void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out,
+                          long length, RC5_32_KEY *schedule,
+                          unsigned char *ivec, int *num);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/rc5.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/seed.h
===================================================================
--- lab4/.minix-src/include/openssl/seed.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/seed.h	(revision 13)
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2007 KISA(Korea Information Security Agency). 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. Neither the name of author nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+/* ====================================================================
+ * Copyright (c) 1998-2007 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_SEED_H
+# define HEADER_SEED_H
+
+# include <openssl/opensslconf.h>
+# include <openssl/e_os2.h>
+# include <openssl/crypto.h>
+
+# ifdef OPENSSL_NO_SEED
+#  error SEED is disabled.
+# endif
+
+/* look whether we need 'long' to get 32 bits */
+# ifdef AES_LONG
+#  ifndef SEED_LONG
+#   define SEED_LONG 1
+#  endif
+# endif
+
+# if !defined(NO_SYS_TYPES_H)
+#  include <sys/types.h>
+# endif
+
+# define SEED_BLOCK_SIZE 16
+# define SEED_KEY_LENGTH 16
+
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct seed_key_st {
+# ifdef SEED_LONG
+    unsigned long data[32];
+# else
+    unsigned int data[32];
+# endif
+} SEED_KEY_SCHEDULE;
+
+# ifdef OPENSSL_FIPS
+void private_SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH],
+                          SEED_KEY_SCHEDULE *ks);
+# endif
+void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH],
+                  SEED_KEY_SCHEDULE *ks);
+
+void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE],
+                  unsigned char d[SEED_BLOCK_SIZE],
+                  const SEED_KEY_SCHEDULE *ks);
+void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE],
+                  unsigned char d[SEED_BLOCK_SIZE],
+                  const SEED_KEY_SCHEDULE *ks);
+
+void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out,
+                      const SEED_KEY_SCHEDULE *ks, int enc);
+void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
+                      const SEED_KEY_SCHEDULE *ks,
+                      unsigned char ivec[SEED_BLOCK_SIZE], int enc);
+void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
+                         size_t len, const SEED_KEY_SCHEDULE *ks,
+                         unsigned char ivec[SEED_BLOCK_SIZE], int *num,
+                         int enc);
+void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
+                         size_t len, const SEED_KEY_SCHEDULE *ks,
+                         unsigned char ivec[SEED_BLOCK_SIZE], int *num);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif                          /* HEADER_SEED_H */

Property changes on: lab4/.minix-src/include/openssl/seed.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/opensslv.h
===================================================================
--- lab4/.minix-src/include/openssl/opensslv.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/opensslv.h	(revision 13)
@@ -0,0 +1,97 @@
+#ifndef HEADER_OPENSSLV_H
+# define HEADER_OPENSSLV_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*-
+ * Numeric release version identifier:
+ * MNNFFPPS: major minor fix patch status
+ * The status nibble has one of the values 0 for development, 1 to e for betas
+ * 1 to 14, and f for release.  The patch level is exactly that.
+ * For example:
+ * 0.9.3-dev      0x00903000
+ * 0.9.3-beta1    0x00903001
+ * 0.9.3-beta2-dev 0x00903002
+ * 0.9.3-beta2    0x00903002 (same as ...beta2-dev)
+ * 0.9.3          0x0090300f
+ * 0.9.3a         0x0090301f
+ * 0.9.4          0x0090400f
+ * 1.2.3z         0x102031af
+ *
+ * For continuity reasons (because 0.9.5 is already out, and is coded
+ * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level
+ * part is slightly different, by setting the highest bit.  This means
+ * that 0.9.5a looks like this: 0x0090581f.  At 0.9.6, we can start
+ * with 0x0090600S...
+ *
+ * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.)
+ * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
+ *  major minor fix final patch/beta)
+ */
+# define OPENSSL_VERSION_NUMBER  0x1000110fL
+# ifdef OPENSSL_FIPS
+#  define OPENSSL_VERSION_TEXT    "OpenSSL 1.0.1p-fips 9 Jul 2015"
+# else
+#  define OPENSSL_VERSION_TEXT    "OpenSSL 1.0.1p 9 Jul 2015"
+# endif
+# define OPENSSL_VERSION_PTEXT   " part of " OPENSSL_VERSION_TEXT
+
+/*-
+ * The macros below are to be used for shared library (.so, .dll, ...)
+ * versioning.  That kind of versioning works a bit differently between
+ * operating systems.  The most usual scheme is to set a major and a minor
+ * number, and have the runtime loader check that the major number is equal
+ * to what it was at application link time, while the minor number has to
+ * be greater or equal to what it was at application link time.  With this
+ * scheme, the version number is usually part of the file name, like this:
+ *
+ *      libcrypto.so.0.9
+ *
+ * Some unixen also make a softlink with the major verson number only:
+ *
+ *      libcrypto.so.0
+ *
+ * On Tru64 and IRIX 6.x it works a little bit differently.  There, the
+ * shared library version is stored in the file, and is actually a series
+ * of versions, separated by colons.  The rightmost version present in the
+ * library when linking an application is stored in the application to be
+ * matched at run time.  When the application is run, a check is done to
+ * see if the library version stored in the application matches any of the
+ * versions in the version string of the library itself.
+ * This version string can be constructed in any way, depending on what
+ * kind of matching is desired.  However, to implement the same scheme as
+ * the one used in the other unixen, all compatible versions, from lowest
+ * to highest, should be part of the string.  Consecutive builds would
+ * give the following versions strings:
+ *
+ *      3.0
+ *      3.0:3.1
+ *      3.0:3.1:3.2
+ *      4.0
+ *      4.0:4.1
+ *
+ * Notice how version 4 is completely incompatible with version, and
+ * therefore give the breach you can see.
+ *
+ * There may be other schemes as well that I haven't yet discovered.
+ *
+ * So, here's the way it works here: first of all, the library version
+ * number doesn't need at all to match the overall OpenSSL version.
+ * However, it's nice and more understandable if it actually does.
+ * The current library version is stored in the macro SHLIB_VERSION_NUMBER,
+ * which is just a piece of text in the format "M.m.e" (Major, minor, edit).
+ * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways,
+ * we need to keep a history of version numbers, which is done in the
+ * macro SHLIB_VERSION_HISTORY.  The numbers are separated by colons and
+ * should only keep the versions that are binary compatible with the current.
+ */
+# define SHLIB_VERSION_HISTORY ""
+# define SHLIB_VERSION_NUMBER "1.0.0"
+
+
+#ifdef  __cplusplus
+}
+#endif
+#endif                          /* HEADER_OPENSSLV_H */

Property changes on: lab4/.minix-src/include/openssl/opensslv.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/pkcs12.h
===================================================================
--- lab4/.minix-src/include/openssl/pkcs12.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/pkcs12.h	(revision 13)
@@ -0,0 +1,342 @@
+/* pkcs12.h */
+/*
+ * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
+ * 1999.
+ */
+/* ====================================================================
+ * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_PKCS12_H
+# define HEADER_PKCS12_H
+
+# include <openssl/bio.h>
+# include <openssl/x509.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+# define PKCS12_KEY_ID   1
+# define PKCS12_IV_ID    2
+# define PKCS12_MAC_ID   3
+
+/* Default iteration count */
+# ifndef PKCS12_DEFAULT_ITER
+#  define PKCS12_DEFAULT_ITER     PKCS5_DEFAULT_ITER
+# endif
+
+# define PKCS12_MAC_KEY_LENGTH 20
+
+# define PKCS12_SALT_LEN 8
+
+/* Uncomment out next line for unicode password and names, otherwise ASCII */
+
+/*
+ * #define PBE_UNICODE
+ */
+
+# ifdef PBE_UNICODE
+#  define PKCS12_key_gen PKCS12_key_gen_uni
+#  define PKCS12_add_friendlyname PKCS12_add_friendlyname_uni
+# else
+#  define PKCS12_key_gen PKCS12_key_gen_asc
+#  define PKCS12_add_friendlyname PKCS12_add_friendlyname_asc
+# endif
+
+/* MS key usage constants */
+
+# define KEY_EX  0x10
+# define KEY_SIG 0x80
+
+typedef struct {
+    X509_SIG *dinfo;
+    ASN1_OCTET_STRING *salt;
+    ASN1_INTEGER *iter;         /* defaults to 1 */
+} PKCS12_MAC_DATA;
+
+typedef struct {
+    ASN1_INTEGER *version;
+    PKCS12_MAC_DATA *mac;
+    PKCS7 *authsafes;
+} PKCS12;
+
+typedef struct {
+    ASN1_OBJECT *type;
+    union {
+        struct pkcs12_bag_st *bag; /* secret, crl and certbag */
+        struct pkcs8_priv_key_info_st *keybag; /* keybag */
+        X509_SIG *shkeybag;     /* shrouded key bag */
+        STACK_OF(PKCS12_SAFEBAG) *safes;
+        ASN1_TYPE *other;
+    } value;
+    STACK_OF(X509_ATTRIBUTE) *attrib;
+} PKCS12_SAFEBAG;
+
+DECLARE_STACK_OF(PKCS12_SAFEBAG)
+DECLARE_ASN1_SET_OF(PKCS12_SAFEBAG)
+DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG)
+
+typedef struct pkcs12_bag_st {
+    ASN1_OBJECT *type;
+    union {
+        ASN1_OCTET_STRING *x509cert;
+        ASN1_OCTET_STRING *x509crl;
+        ASN1_OCTET_STRING *octet;
+        ASN1_IA5STRING *sdsicert;
+        ASN1_TYPE *other;       /* Secret or other bag */
+    } value;
+} PKCS12_BAGS;
+
+# define PKCS12_ERROR    0
+# define PKCS12_OK       1
+
+/* Compatibility macros */
+
+# define M_PKCS12_x5092certbag PKCS12_x5092certbag
+# define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag
+
+# define M_PKCS12_certbag2x509 PKCS12_certbag2x509
+# define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl
+
+# define M_PKCS12_unpack_p7data PKCS12_unpack_p7data
+# define M_PKCS12_pack_authsafes PKCS12_pack_authsafes
+# define M_PKCS12_unpack_authsafes PKCS12_unpack_authsafes
+# define M_PKCS12_unpack_p7encdata PKCS12_unpack_p7encdata
+
+# define M_PKCS12_decrypt_skey PKCS12_decrypt_skey
+# define M_PKCS8_decrypt PKCS8_decrypt
+
+# define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type)
+# define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type)
+# define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type
+
+# define PKCS12_get_attr(bag, attr_nid) \
+                         PKCS12_get_attr_gen(bag->attrib, attr_nid)
+
+# define PKCS8_get_attr(p8, attr_nid) \
+                PKCS12_get_attr_gen(p8->attributes, attr_nid)
+
+# define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0)
+
+PKCS12_SAFEBAG *PKCS12_x5092certbag(X509 *x509);
+PKCS12_SAFEBAG *PKCS12_x509crl2certbag(X509_CRL *crl);
+X509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag);
+X509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag);
+
+PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it,
+                                         int nid1, int nid2);
+PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8);
+PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass,
+                                   int passlen);
+PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(PKCS12_SAFEBAG *bag,
+                                         const char *pass, int passlen);
+X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
+                        const char *pass, int passlen, unsigned char *salt,
+                        int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8);
+PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass,
+                                     int passlen, unsigned char *salt,
+                                     int saltlen, int iter,
+                                     PKCS8_PRIV_KEY_INFO *p8);
+PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk);
+STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7);
+PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,
+                             unsigned char *salt, int saltlen, int iter,
+                             STACK_OF(PKCS12_SAFEBAG) *bags);
+STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass,
+                                                  int passlen);
+
+int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes);
+STACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12);
+
+int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name,
+                          int namelen);
+int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name,
+                                int namelen);
+int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name,
+                           int namelen);
+int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag,
+                                const unsigned char *name, int namelen);
+int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage);
+ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid);
+char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag);
+unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
+                                int passlen, unsigned char *in, int inlen,
+                                unsigned char **data, int *datalen,
+                                int en_de);
+void *PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it,
+                              const char *pass, int passlen,
+                              ASN1_OCTET_STRING *oct, int zbuf);
+ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor,
+                                           const ASN1_ITEM *it,
+                                           const char *pass, int passlen,
+                                           void *obj, int zbuf);
+PKCS12 *PKCS12_init(int mode);
+int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,
+                       int saltlen, int id, int iter, int n,
+                       unsigned char *out, const EVP_MD *md_type);
+int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
+                       int saltlen, int id, int iter, int n,
+                       unsigned char *out, const EVP_MD *md_type);
+int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
+                        ASN1_TYPE *param, const EVP_CIPHER *cipher,
+                        const EVP_MD *md_type, int en_de);
+int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
+                   unsigned char *mac, unsigned int *maclen);
+int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen);
+int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,
+                   unsigned char *salt, int saltlen, int iter,
+                   const EVP_MD *md_type);
+int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt,
+                     int saltlen, const EVP_MD *md_type);
+unsigned char *OPENSSL_asc2uni(const char *asc, int asclen,
+                               unsigned char **uni, int *unilen);
+char *OPENSSL_uni2asc(unsigned char *uni, int unilen);
+
+DECLARE_ASN1_FUNCTIONS(PKCS12)
+DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA)
+DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG)
+DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS)
+
+DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS)
+DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES)
+
+void PKCS12_PBE_add(void);
+int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
+                 STACK_OF(X509) **ca);
+PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert,
+                      STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter,
+                      int mac_iter, int keytype);
+
+PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);
+PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags,
+                               EVP_PKEY *key, int key_usage, int iter,
+                               int key_nid, char *pass);
+int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
+                    int safe_nid, int iter, char *pass);
+PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);
+
+int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12);
+int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12);
+PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12);
+PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);
+int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_PKCS12_strings(void);
+
+/* Error codes for the PKCS12 functions. */
+
+/* Function codes. */
+# define PKCS12_F_PARSE_BAG                               129
+# define PKCS12_F_PARSE_BAGS                              103
+# define PKCS12_F_PKCS12_ADD_FRIENDLYNAME                 100
+# define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC             127
+# define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI             102
+# define PKCS12_F_PKCS12_ADD_LOCALKEYID                   104
+# define PKCS12_F_PKCS12_CREATE                           105
+# define PKCS12_F_PKCS12_GEN_MAC                          107
+# define PKCS12_F_PKCS12_INIT                             109
+# define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I                 106
+# define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT                 108
+# define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG                117
+# define PKCS12_F_PKCS12_KEY_GEN_ASC                      110
+# define PKCS12_F_PKCS12_KEY_GEN_UNI                      111
+# define PKCS12_F_PKCS12_MAKE_KEYBAG                      112
+# define PKCS12_F_PKCS12_MAKE_SHKEYBAG                    113
+# define PKCS12_F_PKCS12_NEWPASS                          128
+# define PKCS12_F_PKCS12_PACK_P7DATA                      114
+# define PKCS12_F_PKCS12_PACK_P7ENCDATA                   115
+# define PKCS12_F_PKCS12_PARSE                            118
+# define PKCS12_F_PKCS12_PBE_CRYPT                        119
+# define PKCS12_F_PKCS12_PBE_KEYIVGEN                     120
+# define PKCS12_F_PKCS12_SETUP_MAC                        122
+# define PKCS12_F_PKCS12_SET_MAC                          123
+# define PKCS12_F_PKCS12_UNPACK_AUTHSAFES                 130
+# define PKCS12_F_PKCS12_UNPACK_P7DATA                    131
+# define PKCS12_F_PKCS12_VERIFY_MAC                       126
+# define PKCS12_F_PKCS8_ADD_KEYUSAGE                      124
+# define PKCS12_F_PKCS8_ENCRYPT                           125
+
+/* Reason codes. */
+# define PKCS12_R_CANT_PACK_STRUCTURE                     100
+# define PKCS12_R_CONTENT_TYPE_NOT_DATA                   121
+# define PKCS12_R_DECODE_ERROR                            101
+# define PKCS12_R_ENCODE_ERROR                            102
+# define PKCS12_R_ENCRYPT_ERROR                           103
+# define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE       120
+# define PKCS12_R_INVALID_NULL_ARGUMENT                   104
+# define PKCS12_R_INVALID_NULL_PKCS12_POINTER             105
+# define PKCS12_R_IV_GEN_ERROR                            106
+# define PKCS12_R_KEY_GEN_ERROR                           107
+# define PKCS12_R_MAC_ABSENT                              108
+# define PKCS12_R_MAC_GENERATION_ERROR                    109
+# define PKCS12_R_MAC_SETUP_ERROR                         110
+# define PKCS12_R_MAC_STRING_SET_ERROR                    111
+# define PKCS12_R_MAC_VERIFY_ERROR                        112
+# define PKCS12_R_MAC_VERIFY_FAILURE                      113
+# define PKCS12_R_PARSE_ERROR                             114
+# define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR           115
+# define PKCS12_R_PKCS12_CIPHERFINAL_ERROR                116
+# define PKCS12_R_PKCS12_PBE_CRYPT_ERROR                  117
+# define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM                118
+# define PKCS12_R_UNSUPPORTED_PKCS12_MODE                 119
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/pkcs12.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/rc2.h
===================================================================
--- lab4/.minix-src/include/openssl/rc2.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/rc2.h	(revision 13)
@@ -0,0 +1,105 @@
+/* crypto/rc2/rc2.h */
+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_RC2_H
+# define HEADER_RC2_H
+
+# include <openssl/opensslconf.h>/* OPENSSL_NO_RC2, RC2_INT */
+# ifdef OPENSSL_NO_RC2
+#  error RC2 is disabled.
+# endif
+
+# define RC2_ENCRYPT     1
+# define RC2_DECRYPT     0
+
+# define RC2_BLOCK       8
+# define RC2_KEY_LENGTH  16
+
+# include <sys/types.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct rc2_key_st {
+    RC2_INT data[64];
+} RC2_KEY;
+
+# ifdef OPENSSL_FIPS
+void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,
+                         int bits);
+# endif
+void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits);
+void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out,
+                     RC2_KEY *key, int enc);
+void RC2_encrypt(uint32_t *data, RC2_KEY *key);
+void RC2_decrypt(uint32_t *data, RC2_KEY *key);
+void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
+                     RC2_KEY *ks, unsigned char *iv, int enc);
+void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
+                       long length, RC2_KEY *schedule, unsigned char *ivec,
+                       int *num, int enc);
+void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out,
+                       long length, RC2_KEY *schedule, unsigned char *ivec,
+                       int *num);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/rc2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/rsa.h
===================================================================
--- lab4/.minix-src/include/openssl/rsa.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/rsa.h	(revision 13)
@@ -0,0 +1,610 @@
+/* crypto/rsa/rsa.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_RSA_H
+# define HEADER_RSA_H
+
+# include <openssl/asn1.h>
+
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+# include <openssl/crypto.h>
+# include <openssl/ossl_typ.h>
+# ifndef OPENSSL_NO_DEPRECATED
+#  include <openssl/bn.h>
+# endif
+
+# ifdef OPENSSL_NO_RSA
+#  error RSA is disabled.
+# endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Declared already in ossl_typ.h */
+/* typedef struct rsa_st RSA; */
+/* typedef struct rsa_meth_st RSA_METHOD; */
+
+struct rsa_meth_st {
+    const char *name;
+    int (*rsa_pub_enc) (int flen, const unsigned char *from,
+                        unsigned char *to, RSA *rsa, int padding);
+    int (*rsa_pub_dec) (int flen, const unsigned char *from,
+                        unsigned char *to, RSA *rsa, int padding);
+    int (*rsa_priv_enc) (int flen, const unsigned char *from,
+                         unsigned char *to, RSA *rsa, int padding);
+    int (*rsa_priv_dec) (int flen, const unsigned char *from,
+                         unsigned char *to, RSA *rsa, int padding);
+    /* Can be null */
+    int (*rsa_mod_exp) (BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx);
+    /* Can be null */
+    int (*bn_mod_exp) (BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+                       const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+    /* called at new */
+    int (*init) (RSA *rsa);
+    /* called at free */
+    int (*finish) (RSA *rsa);
+    /* RSA_METHOD_FLAG_* things */
+    int flags;
+    /* may be needed! */
+    char *app_data;
+    /*
+     * New sign and verify functions: some libraries don't allow arbitrary
+     * data to be signed/verified: this allows them to be used. Note: for
+     * this to work the RSA_public_decrypt() and RSA_private_encrypt() should
+     * *NOT* be used RSA_sign(), RSA_verify() should be used instead. Note:
+     * for backwards compatibility this functionality is only enabled if the
+     * RSA_FLAG_SIGN_VER option is set in 'flags'.
+     */
+    int (*rsa_sign) (int type,
+                     const unsigned char *m, unsigned int m_length,
+                     unsigned char *sigret, unsigned int *siglen,
+                     const RSA *rsa);
+    int (*rsa_verify) (int dtype, const unsigned char *m,
+                       unsigned int m_length, const unsigned char *sigbuf,
+                       unsigned int siglen, const RSA *rsa);
+    /*
+     * If this callback is NULL, the builtin software RSA key-gen will be
+     * used. This is for behavioural compatibility whilst the code gets
+     * rewired, but one day it would be nice to assume there are no such
+     * things as "builtin software" implementations.
+     */
+    int (*rsa_keygen) (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
+};
+
+struct rsa_st {
+    /*
+     * The first parameter is used to pickup errors where this is passed
+     * instead of aEVP_PKEY, it is set to 0
+     */
+    int pad;
+    long version;
+    const RSA_METHOD *meth;
+    /* functional reference if 'meth' is ENGINE-provided */
+    ENGINE *engine;
+    BIGNUM *n;
+    BIGNUM *e;
+    BIGNUM *d;
+    BIGNUM *p;
+    BIGNUM *q;
+    BIGNUM *dmp1;
+    BIGNUM *dmq1;
+    BIGNUM *iqmp;
+    /* be careful using this if the RSA structure is shared */
+    CRYPTO_EX_DATA ex_data;
+    int references;
+    int flags;
+    /* Used to cache montgomery values */
+    BN_MONT_CTX *_method_mod_n;
+    BN_MONT_CTX *_method_mod_p;
+    BN_MONT_CTX *_method_mod_q;
+    /*
+     * all BIGNUM values are actually in the following data, if it is not
+     * NULL
+     */
+    char *bignum_data;
+    BN_BLINDING *blinding;
+    BN_BLINDING *mt_blinding;
+};
+
+# ifndef OPENSSL_RSA_MAX_MODULUS_BITS
+#  define OPENSSL_RSA_MAX_MODULUS_BITS   16384
+# endif
+
+# ifndef OPENSSL_RSA_SMALL_MODULUS_BITS
+#  define OPENSSL_RSA_SMALL_MODULUS_BITS 3072
+# endif
+# ifndef OPENSSL_RSA_MAX_PUBEXP_BITS
+
+/* exponent limit enforced for "large" modulus only */
+#  define OPENSSL_RSA_MAX_PUBEXP_BITS    64
+# endif
+
+# define RSA_3   0x3L
+# define RSA_F4  0x10001L
+
+# define RSA_METHOD_FLAG_NO_CHECK        0x0001/* don't check pub/private
+                                                * match */
+
+# define RSA_FLAG_CACHE_PUBLIC           0x0002
+# define RSA_FLAG_CACHE_PRIVATE          0x0004
+# define RSA_FLAG_BLINDING               0x0008
+# define RSA_FLAG_THREAD_SAFE            0x0010
+/*
+ * This flag means the private key operations will be handled by rsa_mod_exp
+ * and that they do not depend on the private key components being present:
+ * for example a key stored in external hardware. Without this flag
+ * bn_mod_exp gets called when private key components are absent.
+ */
+# define RSA_FLAG_EXT_PKEY               0x0020
+
+/*
+ * This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify
+ * functions.
+ */
+# define RSA_FLAG_SIGN_VER               0x0040
+
+/*
+ * new with 0.9.6j and 0.9.7b; the built-in
+ * RSA implementation now uses blinding by
+ * default (ignoring RSA_FLAG_BLINDING),
+ * but other engines might not need it
+ */
+# define RSA_FLAG_NO_BLINDING            0x0080
+/*
+ * new with 0.9.8f; the built-in RSA
+ * implementation now uses constant time
+ * operations by default in private key operations,
+ * e.g., constant time modular exponentiation,
+ * modular inverse without leaking branches,
+ * division without leaking branches. This
+ * flag disables these constant time
+ * operations and results in faster RSA
+ * private key operations.
+ */
+# define RSA_FLAG_NO_CONSTTIME           0x0100
+# ifdef OPENSSL_USE_DEPRECATED
+/* deprecated name for the flag*/
+/*
+ * new with 0.9.7h; the built-in RSA
+ * implementation now uses constant time
+ * modular exponentiation for secret exponents
+ * by default. This flag causes the
+ * faster variable sliding window method to
+ * be used for all exponents.
+ */
+#  define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME
+# endif
+
+# define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \
+        EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, EVP_PKEY_CTRL_RSA_PADDING, \
+                                pad, NULL)
+
+# define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \
+        EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, \
+                                EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad)
+
+# define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \
+        EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \
+                                (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \
+                                EVP_PKEY_CTRL_RSA_PSS_SALTLEN, \
+                                len, NULL)
+
+# define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \
+        EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \
+                                (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \
+                                EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, \
+                                0, plen)
+
+# define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \
+        EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \
+                                EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL)
+
+# define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \
+        EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \
+                                EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp)
+
+# define  EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md)  \
+                EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_SIG,  \
+                                EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)md)
+
+# define  EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \
+                EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_SIG,  \
+                                EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)pmd)
+
+# define EVP_PKEY_CTRL_RSA_PADDING       (EVP_PKEY_ALG_CTRL + 1)
+# define EVP_PKEY_CTRL_RSA_PSS_SALTLEN   (EVP_PKEY_ALG_CTRL + 2)
+
+# define EVP_PKEY_CTRL_RSA_KEYGEN_BITS   (EVP_PKEY_ALG_CTRL + 3)
+# define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4)
+# define EVP_PKEY_CTRL_RSA_MGF1_MD       (EVP_PKEY_ALG_CTRL + 5)
+
+# define EVP_PKEY_CTRL_GET_RSA_PADDING           (EVP_PKEY_ALG_CTRL + 6)
+# define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN       (EVP_PKEY_ALG_CTRL + 7)
+# define EVP_PKEY_CTRL_GET_RSA_MGF1_MD           (EVP_PKEY_ALG_CTRL + 8)
+
+# define RSA_PKCS1_PADDING       1
+# define RSA_SSLV23_PADDING      2
+# define RSA_NO_PADDING          3
+# define RSA_PKCS1_OAEP_PADDING  4
+# define RSA_X931_PADDING        5
+/* EVP_PKEY_ only */
+# define RSA_PKCS1_PSS_PADDING   6
+
+# define RSA_PKCS1_PADDING_SIZE  11
+
+# define RSA_set_app_data(s,arg)         RSA_set_ex_data(s,0,arg)
+# define RSA_get_app_data(s)             RSA_get_ex_data(s,0)
+
+RSA *RSA_new(void);
+RSA *RSA_new_method(ENGINE *engine);
+int RSA_size(const RSA *rsa);
+
+/* Deprecated version */
+# ifndef OPENSSL_NO_DEPRECATED
+RSA *RSA_generate_key(int bits, unsigned long e, void
+                       (*callback) (int, int, void *), void *cb_arg);
+# endif                         /* !defined(OPENSSL_NO_DEPRECATED) */
+
+/* New version */
+int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
+
+int RSA_check_key(const RSA *);
+        /* next 4 return -1 on error */
+int RSA_public_encrypt(int flen, const unsigned char *from,
+                       unsigned char *to, RSA *rsa, int padding);
+int RSA_private_encrypt(int flen, const unsigned char *from,
+                        unsigned char *to, RSA *rsa, int padding);
+int RSA_public_decrypt(int flen, const unsigned char *from,
+                       unsigned char *to, RSA *rsa, int padding);
+int RSA_private_decrypt(int flen, const unsigned char *from,
+                        unsigned char *to, RSA *rsa, int padding);
+void RSA_free(RSA *r);
+/* "up" the RSA object's reference count */
+int RSA_up_ref(RSA *r);
+
+int RSA_flags(const RSA *r);
+
+void RSA_set_default_method(const RSA_METHOD *meth);
+const RSA_METHOD *RSA_get_default_method(void);
+const RSA_METHOD *RSA_get_method(const RSA *rsa);
+int RSA_set_method(RSA *rsa, const RSA_METHOD *meth);
+
+/* This function needs the memory locking malloc callbacks to be installed */
+int RSA_memory_lock(RSA *r);
+
+/* these are the actual SSLeay RSA functions */
+const RSA_METHOD *RSA_PKCS1_SSLeay(void);
+
+const RSA_METHOD *RSA_null_method(void);
+
+DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey)
+DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey)
+
+typedef struct rsa_pss_params_st {
+    X509_ALGOR *hashAlgorithm;
+    X509_ALGOR *maskGenAlgorithm;
+    ASN1_INTEGER *saltLength;
+    ASN1_INTEGER *trailerField;
+} RSA_PSS_PARAMS;
+
+DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS)
+
+# ifndef OPENSSL_NO_FP_API
+int RSA_print_fp(FILE *fp, const RSA *r, int offset);
+# endif
+
+# ifndef OPENSSL_NO_BIO
+int RSA_print(BIO *bp, const RSA *r, int offset);
+# endif
+
+# ifndef OPENSSL_NO_RC4
+int i2d_RSA_NET(const RSA *a, unsigned char **pp,
+                int (*cb) (char *buf, int len, const char *prompt,
+                           int verify), int sgckey);
+RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
+                 int (*cb) (char *buf, int len, const char *prompt,
+                            int verify), int sgckey);
+
+int i2d_Netscape_RSA(const RSA *a, unsigned char **pp,
+                     int (*cb) (char *buf, int len, const char *prompt,
+                                int verify));
+RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length,
+                      int (*cb) (char *buf, int len, const char *prompt,
+                                 int verify));
+# endif
+
+/*
+ * The following 2 functions sign and verify a X509_SIG ASN1 object inside
+ * PKCS#1 padded RSA encryption
+ */
+int RSA_sign(int type, const unsigned char *m, unsigned int m_length,
+             unsigned char *sigret, unsigned int *siglen, RSA *rsa);
+int RSA_verify(int type, const unsigned char *m, unsigned int m_length,
+               const unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
+
+/*
+ * The following 2 function sign and verify a ASN1_OCTET_STRING object inside
+ * PKCS#1 padded RSA encryption
+ */
+int RSA_sign_ASN1_OCTET_STRING(int type,
+                               const unsigned char *m, unsigned int m_length,
+                               unsigned char *sigret, unsigned int *siglen,
+                               RSA *rsa);
+int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m,
+                                 unsigned int m_length, unsigned char *sigbuf,
+                                 unsigned int siglen, RSA *rsa);
+
+int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);
+void RSA_blinding_off(RSA *rsa);
+BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx);
+
+int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,
+                                 const unsigned char *f, int fl);
+int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
+                                   const unsigned char *f, int fl,
+                                   int rsa_len);
+int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
+                                 const unsigned char *f, int fl);
+int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
+                                   const unsigned char *f, int fl,
+                                   int rsa_len);
+int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed,
+               long seedlen, const EVP_MD *dgst);
+int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
+                               const unsigned char *f, int fl,
+                               const unsigned char *p, int pl);
+int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
+                                 const unsigned char *f, int fl, int rsa_len,
+                                 const unsigned char *p, int pl);
+int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
+                           const unsigned char *f, int fl);
+int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
+                             const unsigned char *f, int fl, int rsa_len);
+int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *f,
+                         int fl);
+int RSA_padding_check_none(unsigned char *to, int tlen,
+                           const unsigned char *f, int fl, int rsa_len);
+int RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *f,
+                         int fl);
+int RSA_padding_check_X931(unsigned char *to, int tlen,
+                           const unsigned char *f, int fl, int rsa_len);
+int RSA_X931_hash_id(int nid);
+
+int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
+                         const EVP_MD *Hash, const unsigned char *EM,
+                         int sLen);
+int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM,
+                              const unsigned char *mHash, const EVP_MD *Hash,
+                              int sLen);
+
+int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
+                              const EVP_MD *Hash, const EVP_MD *mgf1Hash,
+                              const unsigned char *EM, int sLen);
+
+int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
+                                   const unsigned char *mHash,
+                                   const EVP_MD *Hash, const EVP_MD *mgf1Hash,
+                                   int sLen);
+
+int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int RSA_set_ex_data(RSA *r, int idx, void *arg);
+void *RSA_get_ex_data(const RSA *r, int idx);
+
+RSA *RSAPublicKey_dup(RSA *rsa);
+RSA *RSAPrivateKey_dup(RSA *rsa);
+
+/*
+ * If this flag is set the RSA method is FIPS compliant and can be used in
+ * FIPS mode. This is set in the validated module method. If an application
+ * sets this flag in its own methods it is its responsibility to ensure the
+ * result is compliant.
+ */
+
+# define RSA_FLAG_FIPS_METHOD                    0x0400
+
+/*
+ * If this flag is set the operations normally disabled in FIPS mode are
+ * permitted it is then the applications responsibility to ensure that the
+ * usage is compliant.
+ */
+
+# define RSA_FLAG_NON_FIPS_ALLOW                 0x0400
+/*
+ * Application has decided PRNG is good enough to generate a key: don't
+ * check.
+ */
+# define RSA_FLAG_CHECKED                        0x0800
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_RSA_strings(void);
+
+/* Error codes for the RSA functions. */
+
+/* Function codes. */
+# define RSA_F_CHECK_PADDING_MD                           140
+# define RSA_F_DO_RSA_PRINT                               146
+# define RSA_F_INT_RSA_VERIFY                             145
+# define RSA_F_MEMORY_LOCK                                100
+# define RSA_F_OLD_RSA_PRIV_DECODE                        147
+# define RSA_F_PKEY_RSA_CTRL                              143
+# define RSA_F_PKEY_RSA_CTRL_STR                          144
+# define RSA_F_PKEY_RSA_SIGN                              142
+# define RSA_F_PKEY_RSA_VERIFY                            154
+# define RSA_F_PKEY_RSA_VERIFYRECOVER                     141
+# define RSA_F_RSA_BUILTIN_KEYGEN                         129
+# define RSA_F_RSA_CHECK_KEY                              123
+# define RSA_F_RSA_EAY_PRIVATE_DECRYPT                    101
+# define RSA_F_RSA_EAY_PRIVATE_ENCRYPT                    102
+# define RSA_F_RSA_EAY_PUBLIC_DECRYPT                     103
+# define RSA_F_RSA_EAY_PUBLIC_ENCRYPT                     104
+# define RSA_F_RSA_GENERATE_KEY                           105
+# define RSA_F_RSA_GENERATE_KEY_EX                        155
+# define RSA_F_RSA_ITEM_VERIFY                            156
+# define RSA_F_RSA_MEMORY_LOCK                            130
+# define RSA_F_RSA_NEW_METHOD                             106
+# define RSA_F_RSA_NULL                                   124
+# define RSA_F_RSA_NULL_MOD_EXP                           131
+# define RSA_F_RSA_NULL_PRIVATE_DECRYPT                   132
+# define RSA_F_RSA_NULL_PRIVATE_ENCRYPT                   133
+# define RSA_F_RSA_NULL_PUBLIC_DECRYPT                    134
+# define RSA_F_RSA_NULL_PUBLIC_ENCRYPT                    135
+# define RSA_F_RSA_PADDING_ADD_NONE                       107
+# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP                 121
+# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS                  125
+# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1             148
+# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1               108
+# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2               109
+# define RSA_F_RSA_PADDING_ADD_SSLV23                     110
+# define RSA_F_RSA_PADDING_ADD_X931                       127
+# define RSA_F_RSA_PADDING_CHECK_NONE                     111
+# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP               122
+# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1             112
+# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2             113
+# define RSA_F_RSA_PADDING_CHECK_SSLV23                   114
+# define RSA_F_RSA_PADDING_CHECK_X931                     128
+# define RSA_F_RSA_PRINT                                  115
+# define RSA_F_RSA_PRINT_FP                               116
+# define RSA_F_RSA_PRIVATE_DECRYPT                        150
+# define RSA_F_RSA_PRIVATE_ENCRYPT                        151
+# define RSA_F_RSA_PRIV_DECODE                            137
+# define RSA_F_RSA_PRIV_ENCODE                            138
+# define RSA_F_RSA_PUBLIC_DECRYPT                         152
+# define RSA_F_RSA_PUBLIC_ENCRYPT                         153
+# define RSA_F_RSA_PUB_DECODE                             139
+# define RSA_F_RSA_SETUP_BLINDING                         136
+# define RSA_F_RSA_SIGN                                   117
+# define RSA_F_RSA_SIGN_ASN1_OCTET_STRING                 118
+# define RSA_F_RSA_VERIFY                                 119
+# define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING               120
+# define RSA_F_RSA_VERIFY_PKCS1_PSS                       126
+# define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1                  149
+
+/* Reason codes. */
+# define RSA_R_ALGORITHM_MISMATCH                         100
+# define RSA_R_BAD_E_VALUE                                101
+# define RSA_R_BAD_FIXED_HEADER_DECRYPT                   102
+# define RSA_R_BAD_PAD_BYTE_COUNT                         103
+# define RSA_R_BAD_SIGNATURE                              104
+# define RSA_R_BLOCK_TYPE_IS_NOT_01                       106
+# define RSA_R_BLOCK_TYPE_IS_NOT_02                       107
+# define RSA_R_DATA_GREATER_THAN_MOD_LEN                  108
+# define RSA_R_DATA_TOO_LARGE                             109
+# define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE                110
+# define RSA_R_DATA_TOO_LARGE_FOR_MODULUS                 132
+# define RSA_R_DATA_TOO_SMALL                             111
+# define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE                122
+# define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY                 112
+# define RSA_R_DMP1_NOT_CONGRUENT_TO_D                    124
+# define RSA_R_DMQ1_NOT_CONGRUENT_TO_D                    125
+# define RSA_R_D_E_NOT_CONGRUENT_TO_1                     123
+# define RSA_R_FIRST_OCTET_INVALID                        133
+# define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE        144
+# define RSA_R_INVALID_DIGEST_LENGTH                      143
+# define RSA_R_INVALID_HEADER                             137
+# define RSA_R_INVALID_KEYBITS                            145
+# define RSA_R_INVALID_MESSAGE_LENGTH                     131
+# define RSA_R_INVALID_MGF1_MD                            156
+# define RSA_R_INVALID_PADDING                            138
+# define RSA_R_INVALID_PADDING_MODE                       141
+# define RSA_R_INVALID_PSS_PARAMETERS                     149
+# define RSA_R_INVALID_PSS_SALTLEN                        146
+# define RSA_R_INVALID_SALT_LENGTH                        150
+# define RSA_R_INVALID_TRAILER                            139
+# define RSA_R_INVALID_X931_DIGEST                        142
+# define RSA_R_IQMP_NOT_INVERSE_OF_Q                      126
+# define RSA_R_KEY_SIZE_TOO_SMALL                         120
+# define RSA_R_LAST_OCTET_INVALID                         134
+# define RSA_R_MODULUS_TOO_LARGE                          105
+# define RSA_R_NON_FIPS_RSA_METHOD                        157
+# define RSA_R_NO_PUBLIC_EXPONENT                         140
+# define RSA_R_NULL_BEFORE_BLOCK_MISSING                  113
+# define RSA_R_N_DOES_NOT_EQUAL_P_Q                       127
+# define RSA_R_OAEP_DECODING_ERROR                        121
+# define RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE         158
+# define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE   148
+# define RSA_R_PADDING_CHECK_FAILED                       114
+# define RSA_R_PKCS_DECODING_ERROR                        159
+# define RSA_R_P_NOT_PRIME                                128
+# define RSA_R_Q_NOT_PRIME                                129
+# define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED               130
+# define RSA_R_SLEN_CHECK_FAILED                          136
+# define RSA_R_SLEN_RECOVERY_FAILED                       135
+# define RSA_R_SSLV3_ROLLBACK_ATTACK                      115
+# define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116
+# define RSA_R_UNKNOWN_ALGORITHM_TYPE                     117
+# define RSA_R_UNKNOWN_MASK_DIGEST                        151
+# define RSA_R_UNKNOWN_PADDING_TYPE                       118
+# define RSA_R_UNKNOWN_PSS_DIGEST                         152
+# define RSA_R_UNSUPPORTED_MASK_ALGORITHM                 153
+# define RSA_R_UNSUPPORTED_MASK_PARAMETER                 154
+# define RSA_R_UNSUPPORTED_SIGNATURE_TYPE                 155
+# define RSA_R_VALUE_MISSING                              147
+# define RSA_R_WRONG_SIGNATURE_LENGTH                     119
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/rsa.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/srp.h
===================================================================
--- lab4/.minix-src/include/openssl/srp.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/srp.h	(revision 13)
@@ -0,0 +1,169 @@
+/* crypto/srp/srp.h */
+/*
+ * Written by Christophe Renou (christophe.renou@edelweb.fr) with the
+ * precious help of Peter Sylvester (peter.sylvester@edelweb.fr) for the
+ * EdelKey project and contributed to the OpenSSL project 2004.
+ */
+/* ====================================================================
+ * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+#ifndef __SRP_H__
+# define __SRP_H__
+
+# ifndef OPENSSL_NO_SRP
+
+#  include <stdio.h>
+#  include <string.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#  include <openssl/safestack.h>
+#  include <openssl/bn.h>
+#  include <openssl/crypto.h>
+
+typedef struct SRP_gN_cache_st {
+    char *b64_bn;
+    BIGNUM *bn;
+} SRP_gN_cache;
+
+
+DECLARE_STACK_OF(SRP_gN_cache)
+
+typedef struct SRP_user_pwd_st {
+    char *id;
+    BIGNUM *s;
+    BIGNUM *v;
+    const BIGNUM *g;
+    const BIGNUM *N;
+    char *info;
+} SRP_user_pwd;
+
+DECLARE_STACK_OF(SRP_user_pwd)
+
+typedef struct SRP_VBASE_st {
+    STACK_OF(SRP_user_pwd) *users_pwd;
+    STACK_OF(SRP_gN_cache) *gN_cache;
+/* to simulate a user */
+    char *seed_key;
+    BIGNUM *default_g;
+    BIGNUM *default_N;
+} SRP_VBASE;
+
+/*
+ * Structure interne pour retenir les couples N et g
+ */
+typedef struct SRP_gN_st {
+    char *id;
+    BIGNUM *g;
+    BIGNUM *N;
+} SRP_gN;
+
+DECLARE_STACK_OF(SRP_gN)
+
+SRP_VBASE *SRP_VBASE_new(char *seed_key);
+int SRP_VBASE_free(SRP_VBASE *vb);
+int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
+SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
+char *SRP_create_verifier(const char *user, const char *pass, char **salt,
+                          char **verifier, const char *N, const char *g);
+int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
+                           BIGNUM **verifier, BIGNUM *N, BIGNUM *g);
+
+#  define SRP_NO_ERROR 0
+#  define SRP_ERR_VBASE_INCOMPLETE_FILE 1
+#  define SRP_ERR_VBASE_BN_LIB 2
+#  define SRP_ERR_OPEN_FILE 3
+#  define SRP_ERR_MEMORY 4
+
+#  define DB_srptype      0
+#  define DB_srpverifier  1
+#  define DB_srpsalt      2
+#  define DB_srpid        3
+#  define DB_srpgN        4
+#  define DB_srpinfo      5
+#  undef  DB_NUMBER
+#  define DB_NUMBER       6
+
+#  define DB_SRP_INDEX    'I'
+#  define DB_SRP_VALID    'V'
+#  define DB_SRP_REVOKED  'R'
+#  define DB_SRP_MODIF    'v'
+
+/* see srp.c */
+char *SRP_check_known_gN_param(BIGNUM *g, BIGNUM *N);
+SRP_gN *SRP_get_default_gN(const char *id);
+
+/* server side .... */
+BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b,
+                            BIGNUM *N);
+BIGNUM *SRP_Calc_B(BIGNUM *b, BIGNUM *N, BIGNUM *g, BIGNUM *v);
+int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N);
+BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N);
+
+/* client side .... */
+BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass);
+BIGNUM *SRP_Calc_A(BIGNUM *a, BIGNUM *N, BIGNUM *g);
+BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x,
+                            BIGNUM *a, BIGNUM *u);
+int SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N);
+
+#  define SRP_MINIMAL_N 1024
+
+#ifdef  __cplusplus
+}
+#endif
+
+# endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/srp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ssl2.h
===================================================================
--- lab4/.minix-src/include/openssl/ssl2.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ssl2.h	(revision 13)
@@ -0,0 +1,265 @@
+/* ssl/ssl2.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_SSL2_H
+# define HEADER_SSL2_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Protocol Version Codes */
+# define SSL2_VERSION            0x0002
+# define SSL2_VERSION_MAJOR      0x00
+# define SSL2_VERSION_MINOR      0x02
+/* #define SSL2_CLIENT_VERSION  0x0002 */
+/* #define SSL2_SERVER_VERSION  0x0002 */
+
+/* Protocol Message Codes */
+# define SSL2_MT_ERROR                   0
+# define SSL2_MT_CLIENT_HELLO            1
+# define SSL2_MT_CLIENT_MASTER_KEY       2
+# define SSL2_MT_CLIENT_FINISHED         3
+# define SSL2_MT_SERVER_HELLO            4
+# define SSL2_MT_SERVER_VERIFY           5
+# define SSL2_MT_SERVER_FINISHED         6
+# define SSL2_MT_REQUEST_CERTIFICATE     7
+# define SSL2_MT_CLIENT_CERTIFICATE      8
+
+/* Error Message Codes */
+# define SSL2_PE_UNDEFINED_ERROR         0x0000
+# define SSL2_PE_NO_CIPHER               0x0001
+# define SSL2_PE_NO_CERTIFICATE          0x0002
+# define SSL2_PE_BAD_CERTIFICATE         0x0004
+# define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006
+
+/* Cipher Kind Values */
+# define SSL2_CK_NULL_WITH_MD5                   0x02000000/* v3 */
+# define SSL2_CK_RC4_128_WITH_MD5                0x02010080
+# define SSL2_CK_RC4_128_EXPORT40_WITH_MD5       0x02020080
+# define SSL2_CK_RC2_128_CBC_WITH_MD5            0x02030080
+# define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5   0x02040080
+# define SSL2_CK_IDEA_128_CBC_WITH_MD5           0x02050080
+# define SSL2_CK_DES_64_CBC_WITH_MD5             0x02060040
+# define SSL2_CK_DES_64_CBC_WITH_SHA             0x02060140/* v3 */
+# define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5       0x020700c0
+# define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA       0x020701c0/* v3 */
+# define SSL2_CK_RC4_64_WITH_MD5                 0x02080080/* MS hack */
+
+# define SSL2_CK_DES_64_CFB64_WITH_MD5_1         0x02ff0800/* SSLeay */
+# define SSL2_CK_NULL                            0x02ff0810/* SSLeay */
+
+# define SSL2_TXT_DES_64_CFB64_WITH_MD5_1        "DES-CFB-M1"
+# define SSL2_TXT_NULL_WITH_MD5                  "NULL-MD5"
+# define SSL2_TXT_RC4_128_WITH_MD5               "RC4-MD5"
+# define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5      "EXP-RC4-MD5"
+# define SSL2_TXT_RC2_128_CBC_WITH_MD5           "RC2-CBC-MD5"
+# define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5  "EXP-RC2-CBC-MD5"
+# define SSL2_TXT_IDEA_128_CBC_WITH_MD5          "IDEA-CBC-MD5"
+# define SSL2_TXT_DES_64_CBC_WITH_MD5            "DES-CBC-MD5"
+# define SSL2_TXT_DES_64_CBC_WITH_SHA            "DES-CBC-SHA"
+# define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5      "DES-CBC3-MD5"
+# define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA      "DES-CBC3-SHA"
+# define SSL2_TXT_RC4_64_WITH_MD5                "RC4-64-MD5"
+
+# define SSL2_TXT_NULL                           "NULL"
+
+/* Flags for the SSL_CIPHER.algorithm2 field */
+# define SSL2_CF_5_BYTE_ENC                      0x01
+# define SSL2_CF_8_BYTE_ENC                      0x02
+
+/* Certificate Type Codes */
+# define SSL2_CT_X509_CERTIFICATE                0x01
+
+/* Authentication Type Code */
+# define SSL2_AT_MD5_WITH_RSA_ENCRYPTION         0x01
+
+# define SSL2_MAX_SSL_SESSION_ID_LENGTH          32
+
+/* Upper/Lower Bounds */
+# define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS      256
+# ifdef OPENSSL_SYS_MPE
+#  define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER    29998u
+# else
+#  define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER    32767u
+                                                       /* 2^15-1 */
+# endif
+# define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER    16383/* 2^14-1 */
+
+# define SSL2_CHALLENGE_LENGTH   16
+/*
+ * #define SSL2_CHALLENGE_LENGTH 32
+ */
+# define SSL2_MIN_CHALLENGE_LENGTH       16
+# define SSL2_MAX_CHALLENGE_LENGTH       32
+# define SSL2_CONNECTION_ID_LENGTH       16
+# define SSL2_MAX_CONNECTION_ID_LENGTH   16
+# define SSL2_SSL_SESSION_ID_LENGTH      16
+# define SSL2_MAX_CERT_CHALLENGE_LENGTH  32
+# define SSL2_MIN_CERT_CHALLENGE_LENGTH  16
+# define SSL2_MAX_KEY_MATERIAL_LENGTH    24
+
+# ifndef HEADER_SSL_LOCL_H
+#  define  CERT           char
+# endif
+
+# ifndef OPENSSL_NO_SSL_INTERN
+
+typedef struct ssl2_state_st {
+    int three_byte_header;
+    int clear_text;             /* clear text */
+    int escape;                 /* not used in SSLv2 */
+    int ssl2_rollback;          /* used if SSLv23 rolled back to SSLv2 */
+    /*
+     * non-blocking io info, used to make sure the same args were passwd
+     */
+    unsigned int wnum;          /* number of bytes sent so far */
+    int wpend_tot;
+    const unsigned char *wpend_buf;
+    int wpend_off;              /* offset to data to write */
+    int wpend_len;              /* number of bytes passwd to write */
+    int wpend_ret;              /* number of bytes to return to caller */
+    /* buffer raw data */
+    int rbuf_left;
+    int rbuf_offs;
+    unsigned char *rbuf;
+    unsigned char *wbuf;
+    unsigned char *write_ptr;   /* used to point to the start due to 2/3 byte
+                                 * header. */
+    unsigned int padding;
+    unsigned int rlength;       /* passed to ssl2_enc */
+    int ract_data_length;       /* Set when things are encrypted. */
+    unsigned int wlength;       /* passed to ssl2_enc */
+    int wact_data_length;       /* Set when things are decrypted. */
+    unsigned char *ract_data;
+    unsigned char *wact_data;
+    unsigned char *mac_data;
+    unsigned char *read_key;
+    unsigned char *write_key;
+    /* Stuff specifically to do with this SSL session */
+    unsigned int challenge_length;
+    unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH];
+    unsigned int conn_id_length;
+    unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH];
+    unsigned int key_material_length;
+    unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH * 2];
+    unsigned long read_sequence;
+    unsigned long write_sequence;
+    struct {
+        unsigned int conn_id_length;
+        unsigned int cert_type;
+        unsigned int cert_length;
+        unsigned int csl;
+        unsigned int clear;
+        unsigned int enc;
+        unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH];
+        unsigned int cipher_spec_length;
+        unsigned int session_id_length;
+        unsigned int clen;
+        unsigned int rlen;
+    } tmp;
+} SSL2_STATE;
+
+# endif
+
+/* SSLv2 */
+/* client */
+# define SSL2_ST_SEND_CLIENT_HELLO_A             (0x10|SSL_ST_CONNECT)
+# define SSL2_ST_SEND_CLIENT_HELLO_B             (0x11|SSL_ST_CONNECT)
+# define SSL2_ST_GET_SERVER_HELLO_A              (0x20|SSL_ST_CONNECT)
+# define SSL2_ST_GET_SERVER_HELLO_B              (0x21|SSL_ST_CONNECT)
+# define SSL2_ST_SEND_CLIENT_MASTER_KEY_A        (0x30|SSL_ST_CONNECT)
+# define SSL2_ST_SEND_CLIENT_MASTER_KEY_B        (0x31|SSL_ST_CONNECT)
+# define SSL2_ST_SEND_CLIENT_FINISHED_A          (0x40|SSL_ST_CONNECT)
+# define SSL2_ST_SEND_CLIENT_FINISHED_B          (0x41|SSL_ST_CONNECT)
+# define SSL2_ST_SEND_CLIENT_CERTIFICATE_A       (0x50|SSL_ST_CONNECT)
+# define SSL2_ST_SEND_CLIENT_CERTIFICATE_B       (0x51|SSL_ST_CONNECT)
+# define SSL2_ST_SEND_CLIENT_CERTIFICATE_C       (0x52|SSL_ST_CONNECT)
+# define SSL2_ST_SEND_CLIENT_CERTIFICATE_D       (0x53|SSL_ST_CONNECT)
+# define SSL2_ST_GET_SERVER_VERIFY_A             (0x60|SSL_ST_CONNECT)
+# define SSL2_ST_GET_SERVER_VERIFY_B             (0x61|SSL_ST_CONNECT)
+# define SSL2_ST_GET_SERVER_FINISHED_A           (0x70|SSL_ST_CONNECT)
+# define SSL2_ST_GET_SERVER_FINISHED_B           (0x71|SSL_ST_CONNECT)
+# define SSL2_ST_CLIENT_START_ENCRYPTION         (0x80|SSL_ST_CONNECT)
+# define SSL2_ST_X509_GET_CLIENT_CERTIFICATE     (0x90|SSL_ST_CONNECT)
+/* server */
+# define SSL2_ST_GET_CLIENT_HELLO_A              (0x10|SSL_ST_ACCEPT)
+# define SSL2_ST_GET_CLIENT_HELLO_B              (0x11|SSL_ST_ACCEPT)
+# define SSL2_ST_GET_CLIENT_HELLO_C              (0x12|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_SERVER_HELLO_A             (0x20|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_SERVER_HELLO_B             (0x21|SSL_ST_ACCEPT)
+# define SSL2_ST_GET_CLIENT_MASTER_KEY_A         (0x30|SSL_ST_ACCEPT)
+# define SSL2_ST_GET_CLIENT_MASTER_KEY_B         (0x31|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_SERVER_VERIFY_A            (0x40|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_SERVER_VERIFY_B            (0x41|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_SERVER_VERIFY_C            (0x42|SSL_ST_ACCEPT)
+# define SSL2_ST_GET_CLIENT_FINISHED_A           (0x50|SSL_ST_ACCEPT)
+# define SSL2_ST_GET_CLIENT_FINISHED_B           (0x51|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_SERVER_FINISHED_A          (0x60|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_SERVER_FINISHED_B          (0x61|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_REQUEST_CERTIFICATE_A      (0x70|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_REQUEST_CERTIFICATE_B      (0x71|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_REQUEST_CERTIFICATE_C      (0x72|SSL_ST_ACCEPT)
+# define SSL2_ST_SEND_REQUEST_CERTIFICATE_D      (0x73|SSL_ST_ACCEPT)
+# define SSL2_ST_SERVER_START_ENCRYPTION         (0x80|SSL_ST_ACCEPT)
+# define SSL2_ST_X509_GET_SERVER_CERTIFICATE     (0x90|SSL_ST_ACCEPT)
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ssl2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/store.h
===================================================================
--- lab4/.minix-src/include/openssl/store.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/store.h	(revision 13)
@@ -0,0 +1,658 @@
+/* crypto/store/store.h -*- mode:C; c-file-style: "eay" -*- */
+/*
+ * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project
+ * 2003.
+ */
+/* ====================================================================
+ * Copyright (c) 2003 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_STORE_H
+# define HEADER_STORE_H
+
+# include <openssl/opensslconf.h>
+
+# ifdef OPENSSL_NO_STORE
+#  error STORE is disabled.
+# endif
+
+# include <openssl/ossl_typ.h>
+# ifndef OPENSSL_NO_DEPRECATED
+#  include <openssl/evp.h>
+#  include <openssl/bn.h>
+#  include <openssl/x509.h>
+# endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Already defined in ossl_typ.h */
+/* typedef struct store_st STORE; */
+/* typedef struct store_method_st STORE_METHOD; */
+
+/*
+ * All the following functions return 0, a negative number or NULL on error.
+ * When everything is fine, they return a positive value or a non-NULL
+ * pointer, all depending on their purpose.
+ */
+
+/* Creators and destructor.   */
+STORE *STORE_new_method(const STORE_METHOD *method);
+STORE *STORE_new_engine(ENGINE *engine);
+void STORE_free(STORE *ui);
+
+/*
+ * Give a user interface parametrised control commands.  This can be used to
+ * send down an integer, a data pointer or a function pointer, as well as be
+ * used to get information from a STORE.
+ */
+int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f) (void));
+
+/*
+ * A control to set the directory with keys and certificates.  Used by the
+ * built-in directory level method.
+ */
+# define STORE_CTRL_SET_DIRECTORY        0x0001
+/*
+ * A control to set a file to load.  Used by the built-in file level method.
+ */
+# define STORE_CTRL_SET_FILE             0x0002
+/*
+ * A control to set a configuration file to load.  Can be used by any method
+ * that wishes to load a configuration file.
+ */
+# define STORE_CTRL_SET_CONF_FILE        0x0003
+/*
+ * A control to set a the section of the loaded configuration file.  Can be
+ * used by any method that wishes to load a configuration file.
+ */
+# define STORE_CTRL_SET_CONF_SECTION     0x0004
+
+/* Some methods may use extra data */
+# define STORE_set_app_data(s,arg)       STORE_set_ex_data(s,0,arg)
+# define STORE_get_app_data(s)           STORE_get_ex_data(s,0)
+int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                           CRYPTO_EX_dup *dup_func,
+                           CRYPTO_EX_free *free_func);
+int STORE_set_ex_data(STORE *r, int idx, void *arg);
+void *STORE_get_ex_data(STORE *r, int idx);
+
+/* Use specific methods instead of the built-in one */
+const STORE_METHOD *STORE_get_method(STORE *store);
+const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth);
+
+/* The standard OpenSSL methods. */
+/*
+ * This is the in-memory method.  It does everything except revoking and
+ * updating, and is of course volatile.  It's used by other methods that have
+ * an in-memory cache.
+ */
+const STORE_METHOD *STORE_Memory(void);
+# if 0                          /* Not yet implemented */
+/*
+ * This is the directory store.  It does everything except revoking and
+ * updating, and uses STORE_Memory() to cache things in memory.
+ */
+const STORE_METHOD *STORE_Directory(void);
+/*
+ * This is the file store.  It does everything except revoking and updating,
+ * and uses STORE_Memory() to cache things in memory.  Certificates are added
+ * to it with the store operation, and it will only get cached certificates.
+ */
+const STORE_METHOD *STORE_File(void);
+# endif
+
+/*
+ * Store functions take a type code for the type of data they should store or
+ * fetch
+ */
+typedef enum STORE_object_types {
+    STORE_OBJECT_TYPE_X509_CERTIFICATE = 0x01, /* X509 * */
+    STORE_OBJECT_TYPE_X509_CRL = 0x02, /* X509_CRL * */
+    STORE_OBJECT_TYPE_PRIVATE_KEY = 0x03, /* EVP_PKEY * */
+    STORE_OBJECT_TYPE_PUBLIC_KEY = 0x04, /* EVP_PKEY * */
+    STORE_OBJECT_TYPE_NUMBER = 0x05, /* BIGNUM * */
+    STORE_OBJECT_TYPE_ARBITRARY = 0x06, /* BUF_MEM * */
+    STORE_OBJECT_TYPE_NUM = 0x06 /* The amount of known object types */
+} STORE_OBJECT_TYPES;
+/* List of text strings corresponding to the object types. */
+extern const char *const STORE_object_type_string[STORE_OBJECT_TYPE_NUM + 1];
+
+/*
+ * Some store functions take a parameter list.  Those parameters come with
+ * one of the following codes. The comments following the codes below
+ * indicate what type the value should be a pointer to.
+ */
+typedef enum STORE_params {
+    STORE_PARAM_EVP_TYPE = 0x01, /* int */
+    STORE_PARAM_BITS = 0x02,    /* size_t */
+    STORE_PARAM_KEY_PARAMETERS = 0x03, /* ??? */
+    STORE_PARAM_KEY_NO_PARAMETERS = 0x04, /* N/A */
+    STORE_PARAM_AUTH_PASSPHRASE = 0x05, /* char * */
+    STORE_PARAM_AUTH_KRB5_TICKET = 0x06, /* void * */
+    STORE_PARAM_TYPE_NUM = 0x06 /* The amount of known parameter types */
+} STORE_PARAM_TYPES;
+/*
+ * Parameter value sizes.  -1 means unknown, anything else is the required
+ * size.
+ */
+extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM + 1];
+
+/*
+ * Store functions take attribute lists.  Those attributes come with codes.
+ * The comments following the codes below indicate what type the value should
+ * be a pointer to.
+ */
+typedef enum STORE_attribs {
+    STORE_ATTR_END = 0x00,
+    STORE_ATTR_FRIENDLYNAME = 0x01, /* C string */
+    STORE_ATTR_KEYID = 0x02,    /* 160 bit string (SHA1) */
+    STORE_ATTR_ISSUERKEYID = 0x03, /* 160 bit string (SHA1) */
+    STORE_ATTR_SUBJECTKEYID = 0x04, /* 160 bit string (SHA1) */
+    STORE_ATTR_ISSUERSERIALHASH = 0x05, /* 160 bit string (SHA1) */
+    STORE_ATTR_ISSUER = 0x06,   /* X509_NAME * */
+    STORE_ATTR_SERIAL = 0x07,   /* BIGNUM * */
+    STORE_ATTR_SUBJECT = 0x08,  /* X509_NAME * */
+    STORE_ATTR_CERTHASH = 0x09, /* 160 bit string (SHA1) */
+    STORE_ATTR_EMAIL = 0x0a,    /* C string */
+    STORE_ATTR_FILENAME = 0x0b, /* C string */
+    STORE_ATTR_TYPE_NUM = 0x0b, /* The amount of known attribute types */
+    STORE_ATTR_OR = 0xff        /* This is a special separator, which
+                                 * expresses the OR operation.  */
+} STORE_ATTR_TYPES;
+/*
+ * Attribute value sizes.  -1 means unknown, anything else is the required
+ * size.
+ */
+extern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM + 1];
+
+typedef enum STORE_certificate_status {
+    STORE_X509_VALID = 0x00,
+    STORE_X509_EXPIRED = 0x01,
+    STORE_X509_SUSPENDED = 0x02,
+    STORE_X509_REVOKED = 0x03
+} STORE_CERTIFICATE_STATUS;
+
+/*
+ * Engine store functions will return a structure that contains all the
+ * necessary information, including revokation status for certificates.  This
+ * is really not needed for application authors, as the ENGINE framework
+ * functions will extract the OpenSSL-specific information when at all
+ * possible.  However, for engine authors, it's crucial to know this
+ * structure.
+ */
+typedef struct STORE_OBJECT_st {
+    STORE_OBJECT_TYPES type;
+    union {
+        struct {
+            STORE_CERTIFICATE_STATUS status;
+            X509 *certificate;
+        } x509;
+        X509_CRL *crl;
+        EVP_PKEY *key;
+        BIGNUM *number;
+        BUF_MEM *arbitrary;
+    } data;
+} STORE_OBJECT;
+DECLARE_STACK_OF(STORE_OBJECT)
+STORE_OBJECT *STORE_OBJECT_new(void);
+void STORE_OBJECT_free(STORE_OBJECT *data);
+
+/*
+ * The following functions handle the storage. They return 0, a negative
+ * number or NULL on error, anything else on success.
+ */
+X509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[],
+                            OPENSSL_ITEM parameters[]);
+int STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[],
+                            OPENSSL_ITEM parameters[]);
+int STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[],
+                             OPENSSL_ITEM add_attributes[],
+                             OPENSSL_ITEM modify_attributes[],
+                             OPENSSL_ITEM delete_attributes[],
+                             OPENSSL_ITEM parameters[]);
+int STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[],
+                             OPENSSL_ITEM parameters[]);
+int STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[],
+                             OPENSSL_ITEM parameters[]);
+void *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[],
+                                   OPENSSL_ITEM parameters[]);
+X509 *STORE_list_certificate_next(STORE *e, void *handle);
+int STORE_list_certificate_end(STORE *e, void *handle);
+int STORE_list_certificate_endp(STORE *e, void *handle);
+EVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[],
+                             OPENSSL_ITEM parameters[]);
+EVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[],
+                                OPENSSL_ITEM parameters[]);
+int STORE_store_private_key(STORE *e, EVP_PKEY *data,
+                            OPENSSL_ITEM attributes[],
+                            OPENSSL_ITEM parameters[]);
+int STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[],
+                             OPENSSL_ITEM add_sttributes[],
+                             OPENSSL_ITEM modify_attributes[],
+                             OPENSSL_ITEM delete_attributes[],
+                             OPENSSL_ITEM parameters[]);
+int STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[],
+                             OPENSSL_ITEM parameters[]);
+int STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[],
+                             OPENSSL_ITEM parameters[]);
+void *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[],
+                                   OPENSSL_ITEM parameters[]);
+EVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle);
+int STORE_list_private_key_end(STORE *e, void *handle);
+int STORE_list_private_key_endp(STORE *e, void *handle);
+EVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[],
+                               OPENSSL_ITEM parameters[]);
+int STORE_store_public_key(STORE *e, EVP_PKEY *data,
+                           OPENSSL_ITEM attributes[],
+                           OPENSSL_ITEM parameters[]);
+int STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[],
+                            OPENSSL_ITEM add_sttributes[],
+                            OPENSSL_ITEM modify_attributes[],
+                            OPENSSL_ITEM delete_attributes[],
+                            OPENSSL_ITEM parameters[]);
+int STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[],
+                            OPENSSL_ITEM parameters[]);
+int STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[],
+                            OPENSSL_ITEM parameters[]);
+void *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[],
+                                  OPENSSL_ITEM parameters[]);
+EVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle);
+int STORE_list_public_key_end(STORE *e, void *handle);
+int STORE_list_public_key_endp(STORE *e, void *handle);
+X509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[],
+                             OPENSSL_ITEM parameters[]);
+X509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[],
+                        OPENSSL_ITEM parameters[]);
+int STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[],
+                    OPENSSL_ITEM parameters[]);
+int STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[],
+                     OPENSSL_ITEM add_sttributes[],
+                     OPENSSL_ITEM modify_attributes[],
+                     OPENSSL_ITEM delete_attributes[],
+                     OPENSSL_ITEM parameters[]);
+int STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[],
+                     OPENSSL_ITEM parameters[]);
+void *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[],
+                           OPENSSL_ITEM parameters[]);
+X509_CRL *STORE_list_crl_next(STORE *e, void *handle);
+int STORE_list_crl_end(STORE *e, void *handle);
+int STORE_list_crl_endp(STORE *e, void *handle);
+int STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[],
+                       OPENSSL_ITEM parameters[]);
+int STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[],
+                        OPENSSL_ITEM add_sttributes[],
+                        OPENSSL_ITEM modify_attributes[],
+                        OPENSSL_ITEM delete_attributes[],
+                        OPENSSL_ITEM parameters[]);
+BIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[],
+                         OPENSSL_ITEM parameters[]);
+int STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[],
+                        OPENSSL_ITEM parameters[]);
+int STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[],
+                          OPENSSL_ITEM parameters[]);
+int STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[],
+                           OPENSSL_ITEM add_sttributes[],
+                           OPENSSL_ITEM modify_attributes[],
+                           OPENSSL_ITEM delete_attributes[],
+                           OPENSSL_ITEM parameters[]);
+BUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
+                             OPENSSL_ITEM parameters[]);
+int STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
+                           OPENSSL_ITEM parameters[]);
+
+/* Create and manipulate methods */
+STORE_METHOD *STORE_create_method(char *name);
+void STORE_destroy_method(STORE_METHOD *store_method);
+
+/* These callback types are use for store handlers */
+typedef int (*STORE_INITIALISE_FUNC_PTR) (STORE *);
+typedef void (*STORE_CLEANUP_FUNC_PTR) (STORE *);
+typedef STORE_OBJECT *(*STORE_GENERATE_OBJECT_FUNC_PTR)(STORE *,
+                                                        STORE_OBJECT_TYPES
+                                                        type,
+                                                        OPENSSL_ITEM
+                                                        attributes[],
+                                                        OPENSSL_ITEM
+                                                        parameters[]);
+typedef STORE_OBJECT *(*STORE_GET_OBJECT_FUNC_PTR)(STORE *,
+                                                   STORE_OBJECT_TYPES type,
+                                                   OPENSSL_ITEM attributes[],
+                                                   OPENSSL_ITEM parameters[]);
+typedef void *(*STORE_START_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type,
+                                             OPENSSL_ITEM attributes[],
+                                             OPENSSL_ITEM parameters[]);
+typedef STORE_OBJECT *(*STORE_NEXT_OBJECT_FUNC_PTR)(STORE *, void *handle);
+typedef int (*STORE_END_OBJECT_FUNC_PTR) (STORE *, void *handle);
+typedef int (*STORE_HANDLE_OBJECT_FUNC_PTR) (STORE *, STORE_OBJECT_TYPES type,
+                                             OPENSSL_ITEM attributes[],
+                                             OPENSSL_ITEM parameters[]);
+typedef int (*STORE_STORE_OBJECT_FUNC_PTR) (STORE *, STORE_OBJECT_TYPES type,
+                                            STORE_OBJECT *data,
+                                            OPENSSL_ITEM attributes[],
+                                            OPENSSL_ITEM parameters[]);
+typedef int (*STORE_MODIFY_OBJECT_FUNC_PTR) (STORE *, STORE_OBJECT_TYPES type,
+                                             OPENSSL_ITEM search_attributes[],
+                                             OPENSSL_ITEM add_attributes[],
+                                             OPENSSL_ITEM modify_attributes[],
+                                             OPENSSL_ITEM delete_attributes[],
+                                             OPENSSL_ITEM parameters[]);
+typedef int (*STORE_GENERIC_FUNC_PTR) (STORE *, OPENSSL_ITEM attributes[],
+                                       OPENSSL_ITEM parameters[]);
+typedef int (*STORE_CTRL_FUNC_PTR) (STORE *, int cmd, long l, void *p,
+                                    void (*f) (void));
+
+int STORE_method_set_initialise_function(STORE_METHOD *sm,
+                                         STORE_INITIALISE_FUNC_PTR init_f);
+int STORE_method_set_cleanup_function(STORE_METHOD *sm,
+                                      STORE_CLEANUP_FUNC_PTR clean_f);
+int STORE_method_set_generate_function(STORE_METHOD *sm,
+                                       STORE_GENERATE_OBJECT_FUNC_PTR
+                                       generate_f);
+int STORE_method_set_get_function(STORE_METHOD *sm,
+                                  STORE_GET_OBJECT_FUNC_PTR get_f);
+int STORE_method_set_store_function(STORE_METHOD *sm,
+                                    STORE_STORE_OBJECT_FUNC_PTR store_f);
+int STORE_method_set_modify_function(STORE_METHOD *sm,
+                                     STORE_MODIFY_OBJECT_FUNC_PTR store_f);
+int STORE_method_set_revoke_function(STORE_METHOD *sm,
+                                     STORE_HANDLE_OBJECT_FUNC_PTR revoke_f);
+int STORE_method_set_delete_function(STORE_METHOD *sm,
+                                     STORE_HANDLE_OBJECT_FUNC_PTR delete_f);
+int STORE_method_set_list_start_function(STORE_METHOD *sm,
+                                         STORE_START_OBJECT_FUNC_PTR
+                                         list_start_f);
+int STORE_method_set_list_next_function(STORE_METHOD *sm,
+                                        STORE_NEXT_OBJECT_FUNC_PTR
+                                        list_next_f);
+int STORE_method_set_list_end_function(STORE_METHOD *sm,
+                                       STORE_END_OBJECT_FUNC_PTR list_end_f);
+int STORE_method_set_update_store_function(STORE_METHOD *sm,
+                                           STORE_GENERIC_FUNC_PTR);
+int STORE_method_set_lock_store_function(STORE_METHOD *sm,
+                                         STORE_GENERIC_FUNC_PTR);
+int STORE_method_set_unlock_store_function(STORE_METHOD *sm,
+                                           STORE_GENERIC_FUNC_PTR);
+int STORE_method_set_ctrl_function(STORE_METHOD *sm,
+                                   STORE_CTRL_FUNC_PTR ctrl_f);
+
+STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD
+                                                               *sm);
+STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm);
+STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD
+                                                                  *sm);
+STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm);
+STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm);
+STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD
+                                                              *sm);
+STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD
+                                                              *sm);
+STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD
+                                                              *sm);
+STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD
+                                                                 *sm);
+STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD
+                                                               *sm);
+STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD
+                                                             *sm);
+STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD
+                                                              *sm);
+STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm);
+STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD
+                                                              *sm);
+STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm);
+
+/* Method helper structures and functions. */
+
+/*
+ * This structure is the result of parsing through the information in a list
+ * of OPENSSL_ITEMs.  It stores all the necessary information in a structured
+ * way.
+ */
+typedef struct STORE_attr_info_st STORE_ATTR_INFO;
+
+/*
+ * Parse a list of OPENSSL_ITEMs and return a pointer to a STORE_ATTR_INFO.
+ * Note that we do this in the list form, since the list of OPENSSL_ITEMs can
+ * come in blocks separated with STORE_ATTR_OR.  Note that the value returned
+ * by STORE_parse_attrs_next() must be freed with STORE_ATTR_INFO_free().
+ */
+void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes);
+STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle);
+int STORE_parse_attrs_end(void *handle);
+int STORE_parse_attrs_endp(void *handle);
+
+/* Creator and destructor */
+STORE_ATTR_INFO *STORE_ATTR_INFO_new(void);
+int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs);
+
+/* Manipulators */
+char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs,
+                                STORE_ATTR_TYPES code);
+unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs,
+                                            STORE_ATTR_TYPES code);
+X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs,
+                                   STORE_ATTR_TYPES code);
+BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs,
+                                    STORE_ATTR_TYPES code);
+int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
+                             char *cstr, size_t cstr_size);
+int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
+                                unsigned char *sha1str, size_t sha1str_size);
+int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
+                           X509_NAME *dn);
+int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
+                               BIGNUM *number);
+int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
+                                char *cstr, size_t cstr_size);
+int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs,
+                                   STORE_ATTR_TYPES code,
+                                   unsigned char *sha1str,
+                                   size_t sha1str_size);
+int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
+                              X509_NAME *dn);
+int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs,
+                                  STORE_ATTR_TYPES code, BIGNUM *number);
+
+/*
+ * Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values in
+ * each contained attribute.
+ */
+int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO *const *a,
+                            const STORE_ATTR_INFO *const *b);
+/*
+ * Check if the set of attributes in a is within the range of attributes set
+ * in b.
+ */
+int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
+/* Check if the set of attributes in a are also set in b. */
+int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
+/* Same as STORE_ATTR_INFO_in(), but also checks the attribute values. */
+int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_STORE_strings(void);
+
+/* Error codes for the STORE functions. */
+
+/* Function codes. */
+# define STORE_F_MEM_DELETE                               134
+# define STORE_F_MEM_GENERATE                             135
+# define STORE_F_MEM_LIST_END                             168
+# define STORE_F_MEM_LIST_NEXT                            136
+# define STORE_F_MEM_LIST_START                           137
+# define STORE_F_MEM_MODIFY                               169
+# define STORE_F_MEM_STORE                                138
+# define STORE_F_STORE_ATTR_INFO_GET0_CSTR                139
+# define STORE_F_STORE_ATTR_INFO_GET0_DN                  140
+# define STORE_F_STORE_ATTR_INFO_GET0_NUMBER              141
+# define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR             142
+# define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR              143
+# define STORE_F_STORE_ATTR_INFO_MODIFY_DN                144
+# define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER            145
+# define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR           146
+# define STORE_F_STORE_ATTR_INFO_SET_CSTR                 147
+# define STORE_F_STORE_ATTR_INFO_SET_DN                   148
+# define STORE_F_STORE_ATTR_INFO_SET_NUMBER               149
+# define STORE_F_STORE_ATTR_INFO_SET_SHA1STR              150
+# define STORE_F_STORE_CERTIFICATE                        170
+# define STORE_F_STORE_CTRL                               161
+# define STORE_F_STORE_DELETE_ARBITRARY                   158
+# define STORE_F_STORE_DELETE_CERTIFICATE                 102
+# define STORE_F_STORE_DELETE_CRL                         103
+# define STORE_F_STORE_DELETE_NUMBER                      104
+# define STORE_F_STORE_DELETE_PRIVATE_KEY                 105
+# define STORE_F_STORE_DELETE_PUBLIC_KEY                  106
+# define STORE_F_STORE_GENERATE_CRL                       107
+# define STORE_F_STORE_GENERATE_KEY                       108
+# define STORE_F_STORE_GET_ARBITRARY                      159
+# define STORE_F_STORE_GET_CERTIFICATE                    109
+# define STORE_F_STORE_GET_CRL                            110
+# define STORE_F_STORE_GET_NUMBER                         111
+# define STORE_F_STORE_GET_PRIVATE_KEY                    112
+# define STORE_F_STORE_GET_PUBLIC_KEY                     113
+# define STORE_F_STORE_LIST_CERTIFICATE_END               114
+# define STORE_F_STORE_LIST_CERTIFICATE_ENDP              153
+# define STORE_F_STORE_LIST_CERTIFICATE_NEXT              115
+# define STORE_F_STORE_LIST_CERTIFICATE_START             116
+# define STORE_F_STORE_LIST_CRL_END                       117
+# define STORE_F_STORE_LIST_CRL_ENDP                      154
+# define STORE_F_STORE_LIST_CRL_NEXT                      118
+# define STORE_F_STORE_LIST_CRL_START                     119
+# define STORE_F_STORE_LIST_PRIVATE_KEY_END               120
+# define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP              155
+# define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT              121
+# define STORE_F_STORE_LIST_PRIVATE_KEY_START             122
+# define STORE_F_STORE_LIST_PUBLIC_KEY_END                123
+# define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP               156
+# define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT               124
+# define STORE_F_STORE_LIST_PUBLIC_KEY_START              125
+# define STORE_F_STORE_MODIFY_ARBITRARY                   162
+# define STORE_F_STORE_MODIFY_CERTIFICATE                 163
+# define STORE_F_STORE_MODIFY_CRL                         164
+# define STORE_F_STORE_MODIFY_NUMBER                      165
+# define STORE_F_STORE_MODIFY_PRIVATE_KEY                 166
+# define STORE_F_STORE_MODIFY_PUBLIC_KEY                  167
+# define STORE_F_STORE_NEW_ENGINE                         133
+# define STORE_F_STORE_NEW_METHOD                         132
+# define STORE_F_STORE_PARSE_ATTRS_END                    151
+# define STORE_F_STORE_PARSE_ATTRS_ENDP                   172
+# define STORE_F_STORE_PARSE_ATTRS_NEXT                   152
+# define STORE_F_STORE_PARSE_ATTRS_START                  171
+# define STORE_F_STORE_REVOKE_CERTIFICATE                 129
+# define STORE_F_STORE_REVOKE_PRIVATE_KEY                 130
+# define STORE_F_STORE_REVOKE_PUBLIC_KEY                  131
+# define STORE_F_STORE_STORE_ARBITRARY                    157
+# define STORE_F_STORE_STORE_CERTIFICATE                  100
+# define STORE_F_STORE_STORE_CRL                          101
+# define STORE_F_STORE_STORE_NUMBER                       126
+# define STORE_F_STORE_STORE_PRIVATE_KEY                  127
+# define STORE_F_STORE_STORE_PUBLIC_KEY                   128
+
+/* Reason codes. */
+# define STORE_R_ALREADY_HAS_A_VALUE                      127
+# define STORE_R_FAILED_DELETING_ARBITRARY                132
+# define STORE_R_FAILED_DELETING_CERTIFICATE              100
+# define STORE_R_FAILED_DELETING_KEY                      101
+# define STORE_R_FAILED_DELETING_NUMBER                   102
+# define STORE_R_FAILED_GENERATING_CRL                    103
+# define STORE_R_FAILED_GENERATING_KEY                    104
+# define STORE_R_FAILED_GETTING_ARBITRARY                 133
+# define STORE_R_FAILED_GETTING_CERTIFICATE               105
+# define STORE_R_FAILED_GETTING_KEY                       106
+# define STORE_R_FAILED_GETTING_NUMBER                    107
+# define STORE_R_FAILED_LISTING_CERTIFICATES              108
+# define STORE_R_FAILED_LISTING_KEYS                      109
+# define STORE_R_FAILED_MODIFYING_ARBITRARY               138
+# define STORE_R_FAILED_MODIFYING_CERTIFICATE             139
+# define STORE_R_FAILED_MODIFYING_CRL                     140
+# define STORE_R_FAILED_MODIFYING_NUMBER                  141
+# define STORE_R_FAILED_MODIFYING_PRIVATE_KEY             142
+# define STORE_R_FAILED_MODIFYING_PUBLIC_KEY              143
+# define STORE_R_FAILED_REVOKING_CERTIFICATE              110
+# define STORE_R_FAILED_REVOKING_KEY                      111
+# define STORE_R_FAILED_STORING_ARBITRARY                 134
+# define STORE_R_FAILED_STORING_CERTIFICATE               112
+# define STORE_R_FAILED_STORING_KEY                       113
+# define STORE_R_FAILED_STORING_NUMBER                    114
+# define STORE_R_NOT_IMPLEMENTED                          128
+# define STORE_R_NO_CONTROL_FUNCTION                      144
+# define STORE_R_NO_DELETE_ARBITRARY_FUNCTION             135
+# define STORE_R_NO_DELETE_NUMBER_FUNCTION                115
+# define STORE_R_NO_DELETE_OBJECT_FUNCTION                116
+# define STORE_R_NO_GENERATE_CRL_FUNCTION                 117
+# define STORE_R_NO_GENERATE_OBJECT_FUNCTION              118
+# define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION         136
+# define STORE_R_NO_GET_OBJECT_FUNCTION                   119
+# define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION            120
+# define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION             131
+# define STORE_R_NO_LIST_OBJECT_END_FUNCTION              121
+# define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION             122
+# define STORE_R_NO_LIST_OBJECT_START_FUNCTION            123
+# define STORE_R_NO_MODIFY_OBJECT_FUNCTION                145
+# define STORE_R_NO_REVOKE_OBJECT_FUNCTION                124
+# define STORE_R_NO_STORE                                 129
+# define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION       137
+# define STORE_R_NO_STORE_OBJECT_FUNCTION                 125
+# define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION          126
+# define STORE_R_NO_VALUE                                 130
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/store.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/txt_db.h
===================================================================
--- lab4/.minix-src/include/openssl/txt_db.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/txt_db.h	(revision 13)
@@ -0,0 +1,112 @@
+/* crypto/txt_db/txt_db.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_TXT_DB_H
+# define HEADER_TXT_DB_H
+
+# include <openssl/opensslconf.h>
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+# include <openssl/stack.h>
+# include <openssl/lhash.h>
+
+# define DB_ERROR_OK                     0
+# define DB_ERROR_MALLOC                 1
+# define DB_ERROR_INDEX_CLASH            2
+# define DB_ERROR_INDEX_OUT_OF_RANGE     3
+# define DB_ERROR_NO_INDEX               4
+# define DB_ERROR_INSERT_INDEX_CLASH     5
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef OPENSSL_STRING *OPENSSL_PSTRING;
+DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
+
+typedef struct txt_db_st {
+    int num_fields;
+    STACK_OF(OPENSSL_PSTRING) *data;
+    LHASH_OF(OPENSSL_STRING) **index;
+    int (**qual) (OPENSSL_STRING *);
+    long error;
+    long arg1;
+    long arg2;
+    OPENSSL_STRING *arg_row;
+} TXT_DB;
+
+# ifndef OPENSSL_NO_BIO
+TXT_DB *TXT_DB_read(BIO *in, int num);
+long TXT_DB_write(BIO *out, TXT_DB *db);
+# else
+TXT_DB *TXT_DB_read(char *in, int num);
+long TXT_DB_write(char *out, TXT_DB *db);
+# endif
+int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
+                        LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);
+void TXT_DB_free(TXT_DB *db);
+OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx,
+                                    OPENSSL_STRING *value);
+int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/txt_db.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/x509.h
===================================================================
--- lab4/.minix-src/include/openssl/x509.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/x509.h	(revision 13)
@@ -0,0 +1,1301 @@
+/* crypto/x509/x509.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ * ECDH support in OpenSSL originally developed by
+ * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
+ */
+
+#ifndef HEADER_X509_H
+# define HEADER_X509_H
+
+# include <openssl/e_os2.h>
+# include <openssl/symhacks.h>
+# ifndef OPENSSL_NO_BUFFER
+#  include <openssl/buffer.h>
+# endif
+# ifndef OPENSSL_NO_EVP
+#  include <openssl/evp.h>
+# endif
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+# include <openssl/stack.h>
+# include <openssl/asn1.h>
+# include <openssl/safestack.h>
+
+# ifndef OPENSSL_NO_EC
+#  include <openssl/ec.h>
+# endif
+
+# ifndef OPENSSL_NO_ECDSA
+#  include <openssl/ecdsa.h>
+# endif
+
+# ifndef OPENSSL_NO_ECDH
+#  include <openssl/ecdh.h>
+# endif
+
+# ifndef OPENSSL_NO_DEPRECATED
+#  ifndef OPENSSL_NO_RSA
+#   include <openssl/rsa.h>
+#  endif
+#  ifndef OPENSSL_NO_DSA
+#   include <openssl/dsa.h>
+#  endif
+#  ifndef OPENSSL_NO_DH
+#   include <openssl/dh.h>
+#  endif
+# endif
+
+# ifndef OPENSSL_NO_SHA
+#  include <openssl/sha.h>
+# endif
+# include <openssl/ossl_typ.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifdef OPENSSL_SYS_WIN32
+/* Under Win32 these are defined in wincrypt.h */
+#  undef X509_NAME
+#  undef X509_CERT_PAIR
+#  undef X509_EXTENSIONS
+# endif
+
+# define X509_FILETYPE_PEM       1
+# define X509_FILETYPE_ASN1      2
+# define X509_FILETYPE_DEFAULT   3
+
+# define X509v3_KU_DIGITAL_SIGNATURE     0x0080
+# define X509v3_KU_NON_REPUDIATION       0x0040
+# define X509v3_KU_KEY_ENCIPHERMENT      0x0020
+# define X509v3_KU_DATA_ENCIPHERMENT     0x0010
+# define X509v3_KU_KEY_AGREEMENT         0x0008
+# define X509v3_KU_KEY_CERT_SIGN         0x0004
+# define X509v3_KU_CRL_SIGN              0x0002
+# define X509v3_KU_ENCIPHER_ONLY         0x0001
+# define X509v3_KU_DECIPHER_ONLY         0x8000
+# define X509v3_KU_UNDEF                 0xffff
+
+typedef struct X509_objects_st {
+    int nid;
+    int (*a2i) (void);
+    int (*i2a) (void);
+} X509_OBJECTS;
+
+struct X509_algor_st {
+    ASN1_OBJECT *algorithm;
+    ASN1_TYPE *parameter;
+} /* X509_ALGOR */ ;
+
+DECLARE_ASN1_SET_OF(X509_ALGOR)
+
+typedef STACK_OF(X509_ALGOR) X509_ALGORS;
+
+typedef struct X509_val_st {
+    ASN1_TIME *notBefore;
+    ASN1_TIME *notAfter;
+} X509_VAL;
+
+struct X509_pubkey_st {
+    X509_ALGOR *algor;
+    ASN1_BIT_STRING *public_key;
+    EVP_PKEY *pkey;
+};
+
+typedef struct X509_sig_st {
+    X509_ALGOR *algor;
+    ASN1_OCTET_STRING *digest;
+} X509_SIG;
+
+typedef struct X509_name_entry_st {
+    ASN1_OBJECT *object;
+    ASN1_STRING *value;
+    int set;
+    int size;                   /* temp variable */
+} X509_NAME_ENTRY;
+
+DECLARE_STACK_OF(X509_NAME_ENTRY)
+DECLARE_ASN1_SET_OF(X509_NAME_ENTRY)
+
+/* we always keep X509_NAMEs in 2 forms. */
+struct X509_name_st {
+    STACK_OF(X509_NAME_ENTRY) *entries;
+    int modified;               /* true if 'bytes' needs to be built */
+# ifndef OPENSSL_NO_BUFFER
+    BUF_MEM *bytes;
+# else
+    char *bytes;
+# endif
+/*      unsigned long hash; Keep the hash around for lookups */
+    unsigned char *canon_enc;
+    int canon_enclen;
+} /* X509_NAME */ ;
+
+DECLARE_STACK_OF(X509_NAME)
+
+# define X509_EX_V_NETSCAPE_HACK         0x8000
+# define X509_EX_V_INIT                  0x0001
+typedef struct X509_extension_st {
+    ASN1_OBJECT *object;
+    ASN1_BOOLEAN critical;
+    ASN1_OCTET_STRING *value;
+} X509_EXTENSION;
+
+typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;
+
+DECLARE_STACK_OF(X509_EXTENSION)
+DECLARE_ASN1_SET_OF(X509_EXTENSION)
+
+/* a sequence of these are used */
+typedef struct x509_attributes_st {
+    ASN1_OBJECT *object;
+    int single;                 /* 0 for a set, 1 for a single item (which is
+                                 * wrong) */
+    union {
+        char *ptr;
+        /*
+         * 0
+         */ STACK_OF(ASN1_TYPE) *set;
+        /*
+         * 1
+         */ ASN1_TYPE *single;
+    } value;
+} X509_ATTRIBUTE;
+
+DECLARE_STACK_OF(X509_ATTRIBUTE)
+DECLARE_ASN1_SET_OF(X509_ATTRIBUTE)
+
+typedef struct X509_req_info_st {
+    ASN1_ENCODING enc;
+    ASN1_INTEGER *version;
+    X509_NAME *subject;
+    X509_PUBKEY *pubkey;
+    /*  d=2 hl=2 l=  0 cons: cont: 00 */
+    STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
+} X509_REQ_INFO;
+
+typedef struct X509_req_st {
+    X509_REQ_INFO *req_info;
+    X509_ALGOR *sig_alg;
+    ASN1_BIT_STRING *signature;
+    int references;
+} X509_REQ;
+
+typedef struct x509_cinf_st {
+    ASN1_INTEGER *version;      /* [ 0 ] default of v1 */
+    ASN1_INTEGER *serialNumber;
+    X509_ALGOR *signature;
+    X509_NAME *issuer;
+    X509_VAL *validity;
+    X509_NAME *subject;
+    X509_PUBKEY *key;
+    ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */
+    ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */
+    STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */
+    ASN1_ENCODING enc;
+} X509_CINF;
+
+/*
+ * This stuff is certificate "auxiliary info" it contains details which are
+ * useful in certificate stores and databases. When used this is tagged onto
+ * the end of the certificate itself
+ */
+
+typedef struct x509_cert_aux_st {
+    STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */
+    STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */
+    ASN1_UTF8STRING *alias;     /* "friendly name" */
+    ASN1_OCTET_STRING *keyid;   /* key id of private key */
+    STACK_OF(X509_ALGOR) *other; /* other unspecified info */
+} X509_CERT_AUX;
+
+struct x509_st {
+    X509_CINF *cert_info;
+    X509_ALGOR *sig_alg;
+    ASN1_BIT_STRING *signature;
+    int valid;
+    int references;
+    char *name;
+    CRYPTO_EX_DATA ex_data;
+    /* These contain copies of various extension values */
+    long ex_pathlen;
+    long ex_pcpathlen;
+    unsigned long ex_flags;
+    unsigned long ex_kusage;
+    unsigned long ex_xkusage;
+    unsigned long ex_nscert;
+    ASN1_OCTET_STRING *skid;
+    AUTHORITY_KEYID *akid;
+    X509_POLICY_CACHE *policy_cache;
+    STACK_OF(DIST_POINT) *crldp;
+    STACK_OF(GENERAL_NAME) *altname;
+    NAME_CONSTRAINTS *nc;
+# ifndef OPENSSL_NO_RFC3779
+    STACK_OF(IPAddressFamily) *rfc3779_addr;
+    struct ASIdentifiers_st *rfc3779_asid;
+# endif
+# ifndef OPENSSL_NO_SHA
+    unsigned char sha1_hash[SHA_DIGEST_LENGTH];
+# endif
+    X509_CERT_AUX *aux;
+} /* X509 */ ;
+
+DECLARE_STACK_OF(X509)
+DECLARE_ASN1_SET_OF(X509)
+
+/* This is used for a table of trust checking functions */
+
+typedef struct x509_trust_st {
+    int trust;
+    int flags;
+    int (*check_trust) (struct x509_trust_st *, X509 *, int);
+    char *name;
+    int arg1;
+    void *arg2;
+} X509_TRUST;
+
+DECLARE_STACK_OF(X509_TRUST)
+
+typedef struct x509_cert_pair_st {
+    X509 *forward;
+    X509 *reverse;
+} X509_CERT_PAIR;
+
+/* standard trust ids */
+
+# define X509_TRUST_DEFAULT      -1/* Only valid in purpose settings */
+
+# define X509_TRUST_COMPAT       1
+# define X509_TRUST_SSL_CLIENT   2
+# define X509_TRUST_SSL_SERVER   3
+# define X509_TRUST_EMAIL        4
+# define X509_TRUST_OBJECT_SIGN  5
+# define X509_TRUST_OCSP_SIGN    6
+# define X509_TRUST_OCSP_REQUEST 7
+# define X509_TRUST_TSA          8
+
+/* Keep these up to date! */
+# define X509_TRUST_MIN          1
+# define X509_TRUST_MAX          8
+
+/* trust_flags values */
+# define X509_TRUST_DYNAMIC      1
+# define X509_TRUST_DYNAMIC_NAME 2
+
+/* check_trust return codes */
+
+# define X509_TRUST_TRUSTED      1
+# define X509_TRUST_REJECTED     2
+# define X509_TRUST_UNTRUSTED    3
+
+/* Flags for X509_print_ex() */
+
+# define X509_FLAG_COMPAT                0
+# define X509_FLAG_NO_HEADER             1L
+# define X509_FLAG_NO_VERSION            (1L << 1)
+# define X509_FLAG_NO_SERIAL             (1L << 2)
+# define X509_FLAG_NO_SIGNAME            (1L << 3)
+# define X509_FLAG_NO_ISSUER             (1L << 4)
+# define X509_FLAG_NO_VALIDITY           (1L << 5)
+# define X509_FLAG_NO_SUBJECT            (1L << 6)
+# define X509_FLAG_NO_PUBKEY             (1L << 7)
+# define X509_FLAG_NO_EXTENSIONS         (1L << 8)
+# define X509_FLAG_NO_SIGDUMP            (1L << 9)
+# define X509_FLAG_NO_AUX                (1L << 10)
+# define X509_FLAG_NO_ATTRIBUTES         (1L << 11)
+
+/* Flags specific to X509_NAME_print_ex() */
+
+/* The field separator information */
+
+# define XN_FLAG_SEP_MASK        (0xf << 16)
+
+# define XN_FLAG_COMPAT          0/* Traditional SSLeay: use old
+                                   * X509_NAME_print */
+# define XN_FLAG_SEP_COMMA_PLUS  (1 << 16)/* RFC2253 ,+ */
+# define XN_FLAG_SEP_CPLUS_SPC   (2 << 16)/* ,+ spaced: more readable */
+# define XN_FLAG_SEP_SPLUS_SPC   (3 << 16)/* ;+ spaced */
+# define XN_FLAG_SEP_MULTILINE   (4 << 16)/* One line per field */
+
+# define XN_FLAG_DN_REV          (1 << 20)/* Reverse DN order */
+
+/* How the field name is shown */
+
+# define XN_FLAG_FN_MASK         (0x3 << 21)
+
+# define XN_FLAG_FN_SN           0/* Object short name */
+# define XN_FLAG_FN_LN           (1 << 21)/* Object long name */
+# define XN_FLAG_FN_OID          (2 << 21)/* Always use OIDs */
+# define XN_FLAG_FN_NONE         (3 << 21)/* No field names */
+
+# define XN_FLAG_SPC_EQ          (1 << 23)/* Put spaces round '=' */
+
+/*
+ * This determines if we dump fields we don't recognise: RFC2253 requires
+ * this.
+ */
+
+# define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)
+
+# define XN_FLAG_FN_ALIGN        (1 << 25)/* Align field names to 20
+                                           * characters */
+
+/* Complete set of RFC2253 flags */
+
+# define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \
+                        XN_FLAG_SEP_COMMA_PLUS | \
+                        XN_FLAG_DN_REV | \
+                        XN_FLAG_FN_SN | \
+                        XN_FLAG_DUMP_UNKNOWN_FIELDS)
+
+/* readable oneline form */
+
+# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \
+                        ASN1_STRFLGS_ESC_QUOTE | \
+                        XN_FLAG_SEP_CPLUS_SPC | \
+                        XN_FLAG_SPC_EQ | \
+                        XN_FLAG_FN_SN)
+
+/* readable multiline form */
+
+# define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \
+                        ASN1_STRFLGS_ESC_MSB | \
+                        XN_FLAG_SEP_MULTILINE | \
+                        XN_FLAG_SPC_EQ | \
+                        XN_FLAG_FN_LN | \
+                        XN_FLAG_FN_ALIGN)
+
+struct x509_revoked_st {
+    ASN1_INTEGER *serialNumber;
+    ASN1_TIME *revocationDate;
+    STACK_OF(X509_EXTENSION) /* optional */ *extensions;
+    /* Set up if indirect CRL */
+    STACK_OF(GENERAL_NAME) *issuer;
+    /* Revocation reason */
+    int reason;
+    int sequence;               /* load sequence */
+};
+
+DECLARE_STACK_OF(X509_REVOKED)
+DECLARE_ASN1_SET_OF(X509_REVOKED)
+
+typedef struct X509_crl_info_st {
+    ASN1_INTEGER *version;
+    X509_ALGOR *sig_alg;
+    X509_NAME *issuer;
+    ASN1_TIME *lastUpdate;
+    ASN1_TIME *nextUpdate;
+    STACK_OF(X509_REVOKED) *revoked;
+    STACK_OF(X509_EXTENSION) /* [0] */ *extensions;
+    ASN1_ENCODING enc;
+} X509_CRL_INFO;
+
+struct X509_crl_st {
+    /* actual signature */
+    X509_CRL_INFO *crl;
+    X509_ALGOR *sig_alg;
+    ASN1_BIT_STRING *signature;
+    int references;
+    int flags;
+    /* Copies of various extensions */
+    AUTHORITY_KEYID *akid;
+    ISSUING_DIST_POINT *idp;
+    /* Convenient breakdown of IDP */
+    int idp_flags;
+    int idp_reasons;
+    /* CRL and base CRL numbers for delta processing */
+    ASN1_INTEGER *crl_number;
+    ASN1_INTEGER *base_crl_number;
+# ifndef OPENSSL_NO_SHA
+    unsigned char sha1_hash[SHA_DIGEST_LENGTH];
+# endif
+    STACK_OF(GENERAL_NAMES) *issuers;
+    const X509_CRL_METHOD *meth;
+    void *meth_data;
+} /* X509_CRL */ ;
+
+DECLARE_STACK_OF(X509_CRL)
+DECLARE_ASN1_SET_OF(X509_CRL)
+
+typedef struct private_key_st {
+    int version;
+    /* The PKCS#8 data types */
+    X509_ALGOR *enc_algor;
+    ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */
+    /* When decrypted, the following will not be NULL */
+    EVP_PKEY *dec_pkey;
+    /* used to encrypt and decrypt */
+    int key_length;
+    char *key_data;
+    int key_free;               /* true if we should auto free key_data */
+    /* expanded version of 'enc_algor' */
+    EVP_CIPHER_INFO cipher;
+    int references;
+} X509_PKEY;
+
+# ifndef OPENSSL_NO_EVP
+typedef struct X509_info_st {
+    X509 *x509;
+    X509_CRL *crl;
+    X509_PKEY *x_pkey;
+    EVP_CIPHER_INFO enc_cipher;
+    int enc_len;
+    char *enc_data;
+    int references;
+} X509_INFO;
+
+DECLARE_STACK_OF(X509_INFO)
+# endif
+
+/*
+ * The next 2 structures and their 8 routines were sent to me by Pat Richard
+ * <patr@x509.com> and are used to manipulate Netscapes spki structures -
+ * useful if you are writing a CA web page
+ */
+typedef struct Netscape_spkac_st {
+    X509_PUBKEY *pubkey;
+    ASN1_IA5STRING *challenge;  /* challenge sent in atlas >= PR2 */
+} NETSCAPE_SPKAC;
+
+typedef struct Netscape_spki_st {
+    NETSCAPE_SPKAC *spkac;      /* signed public key and challenge */
+    X509_ALGOR *sig_algor;
+    ASN1_BIT_STRING *signature;
+} NETSCAPE_SPKI;
+
+/* Netscape certificate sequence structure */
+typedef struct Netscape_certificate_sequence {
+    ASN1_OBJECT *type;
+    STACK_OF(X509) *certs;
+} NETSCAPE_CERT_SEQUENCE;
+
+/*- Unused (and iv length is wrong)
+typedef struct CBCParameter_st
+        {
+        unsigned char iv[8];
+        } CBC_PARAM;
+*/
+
+/* Password based encryption structure */
+
+typedef struct PBEPARAM_st {
+    ASN1_OCTET_STRING *salt;
+    ASN1_INTEGER *iter;
+} PBEPARAM;
+
+/* Password based encryption V2 structures */
+
+typedef struct PBE2PARAM_st {
+    X509_ALGOR *keyfunc;
+    X509_ALGOR *encryption;
+} PBE2PARAM;
+
+typedef struct PBKDF2PARAM_st {
+/* Usually OCTET STRING but could be anything */
+    ASN1_TYPE *salt;
+    ASN1_INTEGER *iter;
+    ASN1_INTEGER *keylength;
+    X509_ALGOR *prf;
+} PBKDF2PARAM;
+
+/* PKCS#8 private key info structure */
+
+struct pkcs8_priv_key_info_st {
+    /* Flag for various broken formats */
+    int broken;
+# define PKCS8_OK                0
+# define PKCS8_NO_OCTET          1
+# define PKCS8_EMBEDDED_PARAM    2
+# define PKCS8_NS_DB             3
+# define PKCS8_NEG_PRIVKEY       4
+    ASN1_INTEGER *version;
+    X509_ALGOR *pkeyalg;
+    /* Should be OCTET STRING but some are broken */
+    ASN1_TYPE *pkey;
+    STACK_OF(X509_ATTRIBUTE) *attributes;
+};
+
+#ifdef  __cplusplus
+}
+#endif
+
+# include <openssl/x509_vfy.h>
+# include <openssl/pkcs7.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# define X509_EXT_PACK_UNKNOWN   1
+# define X509_EXT_PACK_STRING    2
+
+# define         X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version)
+/* #define      X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */
+# define         X509_get_notBefore(x) ((x)->cert_info->validity->notBefore)
+# define         X509_get_notAfter(x) ((x)->cert_info->validity->notAfter)
+# define         X509_extract_key(x)     X509_get_pubkey(x)/*****/
+# define         X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version)
+# define         X509_REQ_get_subject_name(x) ((x)->req_info->subject)
+# define         X509_REQ_extract_key(a) X509_REQ_get_pubkey(a)
+# define         X509_name_cmp(a,b)      X509_NAME_cmp((a),(b))
+# define         X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm))
+
+# define         X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version)
+# define         X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate)
+# define         X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate)
+# define         X509_CRL_get_issuer(x) ((x)->crl->issuer)
+# define         X509_CRL_get_REVOKED(x) ((x)->crl->revoked)
+
+void X509_CRL_set_default_method(const X509_CRL_METHOD *meth);
+X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl),
+                                     int (*crl_free) (X509_CRL *crl),
+                                     int (*crl_lookup) (X509_CRL *crl,
+                                                        X509_REVOKED **ret,
+                                                        ASN1_INTEGER *ser,
+                                                        X509_NAME *issuer),
+                                     int (*crl_verify) (X509_CRL *crl,
+                                                        EVP_PKEY *pk));
+void X509_CRL_METHOD_free(X509_CRL_METHOD *m);
+
+void X509_CRL_set_meth_data(X509_CRL *crl, void *dat);
+void *X509_CRL_get_meth_data(X509_CRL *crl);
+
+/*
+ * This one is only used so that a binary form can output, as in
+ * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf)
+ */
+# define         X509_get_X509_PUBKEY(x) ((x)->cert_info->key)
+
+const char *X509_verify_cert_error_string(long n);
+
+# ifndef OPENSSL_NO_EVP
+int X509_verify(X509 *a, EVP_PKEY *r);
+
+int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
+int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);
+int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r);
+
+NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len);
+char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x);
+EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x);
+int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);
+
+int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);
+
+int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent);
+int X509_signature_print(BIO *bp, X509_ALGOR *alg, ASN1_STRING *sig);
+
+int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
+int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
+int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
+int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
+
+int X509_pubkey_digest(const X509 *data, const EVP_MD *type,
+                       unsigned char *md, unsigned int *len);
+int X509_digest(const X509 *data, const EVP_MD *type,
+                unsigned char *md, unsigned int *len);
+int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type,
+                    unsigned char *md, unsigned int *len);
+int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type,
+                    unsigned char *md, unsigned int *len);
+int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type,
+                     unsigned char *md, unsigned int *len);
+# endif
+
+# ifndef OPENSSL_NO_FP_API
+X509 *d2i_X509_fp(FILE *fp, X509 **x509);
+int i2d_X509_fp(FILE *fp, X509 *x509);
+X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl);
+int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl);
+X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req);
+int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req);
+#  ifndef OPENSSL_NO_RSA
+RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa);
+int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa);
+RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa);
+int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa);
+RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa);
+int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa);
+#  endif
+#  ifndef OPENSSL_NO_DSA
+DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa);
+int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa);
+DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa);
+int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa);
+#  endif
+#  ifndef OPENSSL_NO_EC
+EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey);
+int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey);
+EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey);
+int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey);
+#  endif
+X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8);
+int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8);
+PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
+                                                PKCS8_PRIV_KEY_INFO **p8inf);
+int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf);
+int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key);
+int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey);
+EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);
+int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey);
+EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);
+# endif
+
+# ifndef OPENSSL_NO_BIO
+X509 *d2i_X509_bio(BIO *bp, X509 **x509);
+int i2d_X509_bio(BIO *bp, X509 *x509);
+X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl);
+int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl);
+X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req);
+int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req);
+#  ifndef OPENSSL_NO_RSA
+RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa);
+int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa);
+RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa);
+int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa);
+RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa);
+int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa);
+#  endif
+#  ifndef OPENSSL_NO_DSA
+DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa);
+int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa);
+DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa);
+int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa);
+#  endif
+#  ifndef OPENSSL_NO_EC
+EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey);
+int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey);
+EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey);
+int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey);
+#  endif
+X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8);
+int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8);
+PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
+                                                 PKCS8_PRIV_KEY_INFO **p8inf);
+int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf);
+int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key);
+int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey);
+EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);
+int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey);
+EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);
+# endif
+
+X509 *X509_dup(X509 *x509);
+X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa);
+X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex);
+X509_CRL *X509_CRL_dup(X509_CRL *crl);
+X509_REQ *X509_REQ_dup(X509_REQ *req);
+X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn);
+int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype,
+                    void *pval);
+void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
+                     X509_ALGOR *algor);
+void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);
+int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b);
+
+X509_NAME *X509_NAME_dup(X509_NAME *xn);
+X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);
+
+int X509_cmp_time(const ASN1_TIME *s, time_t *t);
+int X509_cmp_current_time(const ASN1_TIME *s);
+ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
+ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s,
+                            int offset_day, long offset_sec, time_t *t);
+ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj);
+
+const char *X509_get_default_cert_area(void);
+const char *X509_get_default_cert_dir(void);
+const char *X509_get_default_cert_file(void);
+const char *X509_get_default_cert_dir_env(void);
+const char *X509_get_default_cert_file_env(void);
+const char *X509_get_default_private_dir(void);
+
+X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
+X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey);
+
+DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
+DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS)
+DECLARE_ASN1_FUNCTIONS(X509_VAL)
+
+DECLARE_ASN1_FUNCTIONS(X509_PUBKEY)
+
+int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);
+EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key);
+int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain);
+int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp);
+EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length);
+# ifndef OPENSSL_NO_RSA
+int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp);
+RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length);
+# endif
+# ifndef OPENSSL_NO_DSA
+int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp);
+DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length);
+# endif
+# ifndef OPENSSL_NO_EC
+int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);
+EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length);
+# endif
+
+DECLARE_ASN1_FUNCTIONS(X509_SIG)
+DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO)
+DECLARE_ASN1_FUNCTIONS(X509_REQ)
+
+DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE)
+X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);
+
+DECLARE_ASN1_FUNCTIONS(X509_EXTENSION)
+DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS)
+
+DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY)
+
+DECLARE_ASN1_FUNCTIONS(X509_NAME)
+
+int X509_NAME_set(X509_NAME **xn, X509_NAME *name);
+
+DECLARE_ASN1_FUNCTIONS(X509_CINF)
+
+DECLARE_ASN1_FUNCTIONS(X509)
+DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX)
+
+DECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR)
+
+int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                          CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int X509_set_ex_data(X509 *r, int idx, void *arg);
+void *X509_get_ex_data(X509 *r, int idx);
+int i2d_X509_AUX(X509 *a, unsigned char **pp);
+X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length);
+
+int X509_alias_set1(X509 *x, unsigned char *name, int len);
+int X509_keyid_set1(X509 *x, unsigned char *id, int len);
+unsigned char *X509_alias_get0(X509 *x, int *len);
+unsigned char *X509_keyid_get0(X509 *x, int *len);
+int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *,
+                                                                int);
+int X509_TRUST_set(int *t, int trust);
+int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj);
+int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj);
+void X509_trust_clear(X509 *x);
+void X509_reject_clear(X509 *x);
+
+DECLARE_ASN1_FUNCTIONS(X509_REVOKED)
+DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO)
+DECLARE_ASN1_FUNCTIONS(X509_CRL)
+
+int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
+int X509_CRL_get0_by_serial(X509_CRL *crl,
+                            X509_REVOKED **ret, ASN1_INTEGER *serial);
+int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
+
+X509_PKEY *X509_PKEY_new(void);
+void X509_PKEY_free(X509_PKEY *a);
+int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp);
+X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp,
+                         long length);
+
+DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)
+DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)
+DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE)
+
+# ifndef OPENSSL_NO_EVP
+X509_INFO *X509_INFO_new(void);
+void X509_INFO_free(X509_INFO *a);
+char *X509_NAME_oneline(X509_NAME *a, char *buf, int size);
+
+int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,
+                ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey);
+
+int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
+                unsigned char *md, unsigned int *len);
+
+int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1,
+              X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
+              char *data, EVP_PKEY *pkey, const EVP_MD *type);
+
+int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data,
+                     unsigned char *md, unsigned int *len);
+
+int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1,
+                     ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey);
+
+int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1,
+                   X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data,
+                   EVP_PKEY *pkey, const EVP_MD *type);
+int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1,
+                       X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
+                       void *asn, EVP_MD_CTX *ctx);
+# endif
+
+int X509_set_version(X509 *x, long version);
+int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);
+ASN1_INTEGER *X509_get_serialNumber(X509 *x);
+int X509_set_issuer_name(X509 *x, X509_NAME *name);
+X509_NAME *X509_get_issuer_name(X509 *a);
+int X509_set_subject_name(X509 *x, X509_NAME *name);
+X509_NAME *X509_get_subject_name(X509 *a);
+int X509_set_notBefore(X509 *x, const ASN1_TIME *tm);
+int X509_set_notAfter(X509 *x, const ASN1_TIME *tm);
+int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
+EVP_PKEY *X509_get_pubkey(X509 *x);
+ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x);
+int X509_certificate_type(X509 *x, EVP_PKEY *pubkey /* optional */ );
+
+int X509_REQ_set_version(X509_REQ *x, long version);
+int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name);
+int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
+EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);
+int X509_REQ_extension_nid(int nid);
+int *X509_REQ_get_extension_nids(void);
+void X509_REQ_set_extension_nids(int *nids);
+STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);
+int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts,
+                                int nid);
+int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts);
+int X509_REQ_get_attr_count(const X509_REQ *req);
+int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos);
+int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj,
+                             int lastpos);
+X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);
+X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);
+int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);
+int X509_REQ_add1_attr_by_OBJ(X509_REQ *req,
+                              const ASN1_OBJECT *obj, int type,
+                              const unsigned char *bytes, int len);
+int X509_REQ_add1_attr_by_NID(X509_REQ *req,
+                              int nid, int type,
+                              const unsigned char *bytes, int len);
+int X509_REQ_add1_attr_by_txt(X509_REQ *req,
+                              const char *attrname, int type,
+                              const unsigned char *bytes, int len);
+
+int X509_CRL_set_version(X509_CRL *x, long version);
+int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
+int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);
+int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);
+int X509_CRL_sort(X509_CRL *crl);
+
+int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
+int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);
+
+int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey);
+
+int X509_check_private_key(X509 *x509, EVP_PKEY *pkey);
+
+int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
+unsigned long X509_issuer_and_serial_hash(X509 *a);
+
+int X509_issuer_name_cmp(const X509 *a, const X509 *b);
+unsigned long X509_issuer_name_hash(X509 *a);
+
+int X509_subject_name_cmp(const X509 *a, const X509 *b);
+unsigned long X509_subject_name_hash(X509 *x);
+
+# ifndef OPENSSL_NO_MD5
+unsigned long X509_issuer_name_hash_old(X509 *a);
+unsigned long X509_subject_name_hash_old(X509 *x);
+# endif
+
+int X509_cmp(const X509 *a, const X509 *b);
+int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
+unsigned long X509_NAME_hash(X509_NAME *x);
+unsigned long X509_NAME_hash_old(X509_NAME *x);
+
+int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
+int X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
+# ifndef OPENSSL_NO_FP_API
+int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag,
+                     unsigned long cflag);
+int X509_print_fp(FILE *bp, X509 *x);
+int X509_CRL_print_fp(FILE *bp, X509_CRL *x);
+int X509_REQ_print_fp(FILE *bp, X509_REQ *req);
+int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent,
+                          unsigned long flags);
+# endif
+
+# ifndef OPENSSL_NO_BIO
+int X509_NAME_print(BIO *bp, X509_NAME *name, int obase);
+int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent,
+                       unsigned long flags);
+int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag,
+                  unsigned long cflag);
+int X509_print(BIO *bp, X509 *x);
+int X509_ocspid_print(BIO *bp, X509 *x);
+int X509_CERT_AUX_print(BIO *bp, X509_CERT_AUX *x, int indent);
+int X509_CRL_print(BIO *bp, X509_CRL *x);
+int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag,
+                      unsigned long cflag);
+int X509_REQ_print(BIO *bp, X509_REQ *req);
+# endif
+
+int X509_NAME_entry_count(X509_NAME *name);
+int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len);
+int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,
+                              char *buf, int len);
+
+/*
+ * NOTE: you should be passsing -1, not 0 as lastpos.  The functions that use
+ * lastpos, search after that position on.
+ */
+int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos);
+int X509_NAME_get_index_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,
+                               int lastpos);
+X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);
+X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);
+int X509_NAME_add_entry(X509_NAME *name, X509_NAME_ENTRY *ne,
+                        int loc, int set);
+int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
+                               unsigned char *bytes, int len, int loc,
+                               int set);
+int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
+                               unsigned char *bytes, int len, int loc,
+                               int set);
+X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
+                                               const char *field, int type,
+                                               const unsigned char *bytes,
+                                               int len);
+X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
+                                               int type, unsigned char *bytes,
+                                               int len);
+int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
+                               const unsigned char *bytes, int len, int loc,
+                               int set);
+X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
+                                               ASN1_OBJECT *obj, int type,
+                                               const unsigned char *bytes,
+                                               int len);
+int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj);
+int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
+                             const unsigned char *bytes, int len);
+ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);
+ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);
+
+int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);
+int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,
+                          int nid, int lastpos);
+int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,
+                          ASN1_OBJECT *obj, int lastpos);
+int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,
+                               int crit, int lastpos);
+X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);
+X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);
+STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,
+                                         X509_EXTENSION *ex, int loc);
+
+int X509_get_ext_count(X509 *x);
+int X509_get_ext_by_NID(X509 *x, int nid, int lastpos);
+int X509_get_ext_by_OBJ(X509 *x, ASN1_OBJECT *obj, int lastpos);
+int X509_get_ext_by_critical(X509 *x, int crit, int lastpos);
+X509_EXTENSION *X509_get_ext(X509 *x, int loc);
+X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
+int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
+void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);
+int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
+                      unsigned long flags);
+
+int X509_CRL_get_ext_count(X509_CRL *x);
+int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);
+int X509_CRL_get_ext_by_OBJ(X509_CRL *x, ASN1_OBJECT *obj, int lastpos);
+int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos);
+X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);
+X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
+int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
+void *X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx);
+int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
+                          unsigned long flags);
+
+int X509_REVOKED_get_ext_count(X509_REVOKED *x);
+int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos);
+int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x, ASN1_OBJECT *obj,
+                                int lastpos);
+int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos);
+X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc);
+X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);
+int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);
+void *X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx);
+int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
+                              unsigned long flags);
+
+X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
+                                             int nid, int crit,
+                                             ASN1_OCTET_STRING *data);
+X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
+                                             ASN1_OBJECT *obj, int crit,
+                                             ASN1_OCTET_STRING *data);
+int X509_EXTENSION_set_object(X509_EXTENSION *ex, ASN1_OBJECT *obj);
+int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
+int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data);
+ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex);
+ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);
+int X509_EXTENSION_get_critical(X509_EXTENSION *ex);
+
+int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);
+int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,
+                           int lastpos);
+int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk,
+                           ASN1_OBJECT *obj, int lastpos);
+X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc);
+X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc);
+STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x,
+                                           X509_ATTRIBUTE *attr);
+STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE)
+                                                  **x, const ASN1_OBJECT *obj,
+                                                  int type,
+                                                  const unsigned char *bytes,
+                                                  int len);
+STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE)
+                                                  **x, int nid, int type,
+                                                  const unsigned char *bytes,
+                                                  int len);
+STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE)
+                                                  **x, const char *attrname,
+                                                  int type,
+                                                  const unsigned char *bytes,
+                                                  int len);
+void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, ASN1_OBJECT *obj,
+                              int lastpos, int type);
+X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,
+                                             int atrtype, const void *data,
+                                             int len);
+X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,
+                                             const ASN1_OBJECT *obj,
+                                             int atrtype, const void *data,
+                                             int len);
+X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,
+                                             const char *atrname, int type,
+                                             const unsigned char *bytes,
+                                             int len);
+int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);
+int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype,
+                             const void *data, int len);
+void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype,
+                               void *data);
+int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr);
+ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
+ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);
+
+int EVP_PKEY_get_attr_count(const EVP_PKEY *key);
+int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos);
+int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj,
+                             int lastpos);
+X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);
+X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);
+int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);
+int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,
+                              const ASN1_OBJECT *obj, int type,
+                              const unsigned char *bytes, int len);
+int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,
+                              int nid, int type,
+                              const unsigned char *bytes, int len);
+int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,
+                              const char *attrname, int type,
+                              const unsigned char *bytes, int len);
+
+int X509_verify_cert(X509_STORE_CTX *ctx);
+
+/* lookup a cert from a X509 STACK */
+X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name,
+                                     ASN1_INTEGER *serial);
+X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name);
+
+DECLARE_ASN1_FUNCTIONS(PBEPARAM)
+DECLARE_ASN1_FUNCTIONS(PBE2PARAM)
+DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)
+
+int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
+                         const unsigned char *salt, int saltlen);
+
+X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
+                          const unsigned char *salt, int saltlen);
+X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
+                           unsigned char *salt, int saltlen);
+X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
+                              unsigned char *salt, int saltlen,
+                              unsigned char *aiv, int prf_nid);
+
+X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
+                             int prf_nid, int keylen);
+
+/* PKCS#8 utilities */
+
+DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
+
+EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8);
+PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey);
+PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken);
+PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken);
+
+int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
+                    int version, int ptype, void *pval,
+                    unsigned char *penc, int penclen);
+int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg,
+                    const unsigned char **pk, int *ppklen,
+                    X509_ALGOR **pa, PKCS8_PRIV_KEY_INFO *p8);
+
+int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
+                           int ptype, void *pval,
+                           unsigned char *penc, int penclen);
+int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,
+                           const unsigned char **pk, int *ppklen,
+                           X509_ALGOR **pa, X509_PUBKEY *pub);
+
+int X509_check_trust(X509 *x, int id, int flags);
+int X509_TRUST_get_count(void);
+X509_TRUST *X509_TRUST_get0(int idx);
+int X509_TRUST_get_by_id(int id);
+int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int),
+                   char *name, int arg1, void *arg2);
+void X509_TRUST_cleanup(void);
+int X509_TRUST_get_flags(X509_TRUST *xp);
+char *X509_TRUST_get0_name(X509_TRUST *xp);
+int X509_TRUST_get_trust(X509_TRUST *xp);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_X509_strings(void);
+
+/* Error codes for the X509 functions. */
+
+/* Function codes. */
+# define X509_F_ADD_CERT_DIR                              100
+# define X509_F_BY_FILE_CTRL                              101
+# define X509_F_CHECK_POLICY                              145
+# define X509_F_DIR_CTRL                                  102
+# define X509_F_GET_CERT_BY_SUBJECT                       103
+# define X509_F_NETSCAPE_SPKI_B64_DECODE                  129
+# define X509_F_NETSCAPE_SPKI_B64_ENCODE                  130
+# define X509_F_X509AT_ADD1_ATTR                          135
+# define X509_F_X509V3_ADD_EXT                            104
+# define X509_F_X509_ATTRIBUTE_CREATE_BY_NID              136
+# define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ              137
+# define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT              140
+# define X509_F_X509_ATTRIBUTE_GET0_DATA                  139
+# define X509_F_X509_ATTRIBUTE_SET1_DATA                  138
+# define X509_F_X509_CHECK_PRIVATE_KEY                    128
+# define X509_F_X509_CRL_PRINT_FP                         147
+# define X509_F_X509_EXTENSION_CREATE_BY_NID              108
+# define X509_F_X509_EXTENSION_CREATE_BY_OBJ              109
+# define X509_F_X509_GET_PUBKEY_PARAMETERS                110
+# define X509_F_X509_LOAD_CERT_CRL_FILE                   132
+# define X509_F_X509_LOAD_CERT_FILE                       111
+# define X509_F_X509_LOAD_CRL_FILE                        112
+# define X509_F_X509_NAME_ADD_ENTRY                       113
+# define X509_F_X509_NAME_ENTRY_CREATE_BY_NID             114
+# define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT             131
+# define X509_F_X509_NAME_ENTRY_SET_OBJECT                115
+# define X509_F_X509_NAME_ONELINE                         116
+# define X509_F_X509_NAME_PRINT                           117
+# define X509_F_X509_PRINT_EX_FP                          118
+# define X509_F_X509_PUBKEY_GET                           119
+# define X509_F_X509_PUBKEY_SET                           120
+# define X509_F_X509_REQ_CHECK_PRIVATE_KEY                144
+# define X509_F_X509_REQ_PRINT_EX                         121
+# define X509_F_X509_REQ_PRINT_FP                         122
+# define X509_F_X509_REQ_TO_X509                          123
+# define X509_F_X509_STORE_ADD_CERT                       124
+# define X509_F_X509_STORE_ADD_CRL                        125
+# define X509_F_X509_STORE_CTX_GET1_ISSUER                146
+# define X509_F_X509_STORE_CTX_INIT                       143
+# define X509_F_X509_STORE_CTX_NEW                        142
+# define X509_F_X509_STORE_CTX_PURPOSE_INHERIT            134
+# define X509_F_X509_TO_X509_REQ                          126
+# define X509_F_X509_TRUST_ADD                            133
+# define X509_F_X509_TRUST_SET                            141
+# define X509_F_X509_VERIFY_CERT                          127
+
+/* Reason codes. */
+# define X509_R_BAD_X509_FILETYPE                         100
+# define X509_R_BASE64_DECODE_ERROR                       118
+# define X509_R_CANT_CHECK_DH_KEY                         114
+# define X509_R_CERT_ALREADY_IN_HASH_TABLE                101
+# define X509_R_ERR_ASN1_LIB                              102
+# define X509_R_INVALID_DIRECTORY                         113
+# define X509_R_INVALID_FIELD_NAME                        119
+# define X509_R_INVALID_TRUST                             123
+# define X509_R_KEY_TYPE_MISMATCH                         115
+# define X509_R_KEY_VALUES_MISMATCH                       116
+# define X509_R_LOADING_CERT_DIR                          103
+# define X509_R_LOADING_DEFAULTS                          104
+# define X509_R_METHOD_NOT_SUPPORTED                      124
+# define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY              105
+# define X509_R_PUBLIC_KEY_DECODE_ERROR                   125
+# define X509_R_PUBLIC_KEY_ENCODE_ERROR                   126
+# define X509_R_SHOULD_RETRY                              106
+# define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN        107
+# define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY            108
+# define X509_R_UNKNOWN_KEY_TYPE                          117
+# define X509_R_UNKNOWN_NID                               109
+# define X509_R_UNKNOWN_PURPOSE_ID                        121
+# define X509_R_UNKNOWN_TRUST_ID                          120
+# define X509_R_UNSUPPORTED_ALGORITHM                     111
+# define X509_R_WRONG_LOOKUP_TYPE                         112
+# define X509_R_WRONG_TYPE                                122
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/x509.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/pcap/namedb.h
===================================================================
--- lab4/.minix-src/include/pcap/namedb.h	(nonexistent)
+++ lab4/.minix-src/include/pcap/namedb.h	(revision 13)
@@ -0,0 +1,89 @@
+/*	$NetBSD: namedb.h,v 1.2 2014/11/19 19:33:31 christos Exp $	*/
+
+/*
+ * Copyright (c) 1994, 1996
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the Computer Systems
+ *	Engineering Group at Lawrence Berkeley Laboratory.
+ * 4. Neither the name of the University nor of the Laboratory may be used
+ *    to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lib_pcap_namedb_h
+#define lib_pcap_namedb_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * As returned by the pcap_next_etherent()
+ * XXX this stuff doesn't belong in this interface, but this
+ * library already must do name to address translation, so
+ * on systems that don't have support for /etc/ethers, we
+ * export these hooks since they'll
+ */
+struct pcap_etherent {
+	u_char addr[6];
+	char name[122];
+};
+#ifndef PCAP_ETHERS_FILE
+#define PCAP_ETHERS_FILE "/etc/ethers"
+#endif
+struct	pcap_etherent *pcap_next_etherent(FILE *);
+u_char *pcap_ether_hostton(const char*);
+u_char *pcap_ether_aton(const char *);
+
+bpf_u_int32 **pcap_nametoaddr(const char *);
+#ifdef INET6
+struct addrinfo *pcap_nametoaddrinfo(const char *);
+#endif
+bpf_u_int32 pcap_nametonetaddr(const char *);
+
+int	pcap_nametoport(const char *, int *, int *);
+int	pcap_nametoportrange(const char *, int *, int *, int *);
+int	pcap_nametoproto(const char *);
+int	pcap_nametoeproto(const char *);
+int	pcap_nametollc(const char *);
+/*
+ * If a protocol is unknown, PROTO_UNDEF is returned.
+ * Also, pcap_nametoport() returns the protocol along with the port number.
+ * If there are ambiguous entried in /etc/services (i.e. domain
+ * can be either tcp or udp) PROTO_UNDEF is returned.
+ */
+#define PROTO_UNDEF		-1
+
+/* XXX move these to pcap-int.h? */
+int __pcap_atodn(const char *, bpf_u_int32 *);
+int __pcap_atoin(const char *, bpf_u_int32 *);
+u_short	__pcap_nametodnaddr(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/pcap/namedb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/evp.h
===================================================================
--- lab4/.minix-src/include/openssl/evp.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/evp.h	(revision 13)
@@ -0,0 +1,1480 @@
+/* crypto/evp/evp.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_ENVELOPE_H
+# define HEADER_ENVELOPE_H
+
+# ifdef OPENSSL_ALGORITHM_DEFINES
+#  include <openssl/opensslconf.h>
+# else
+#  define OPENSSL_ALGORITHM_DEFINES
+#  include <openssl/opensslconf.h>
+#  undef OPENSSL_ALGORITHM_DEFINES
+# endif
+
+# include <openssl/ossl_typ.h>
+
+# include <openssl/symhacks.h>
+
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+
+/*-
+#define EVP_RC2_KEY_SIZE                16
+#define EVP_RC4_KEY_SIZE                16
+#define EVP_BLOWFISH_KEY_SIZE           16
+#define EVP_CAST5_KEY_SIZE              16
+#define EVP_RC5_32_12_16_KEY_SIZE       16
+*/
+# define EVP_MAX_MD_SIZE                 64/* longest known is SHA512 */
+# define EVP_MAX_KEY_LENGTH              64
+# define EVP_MAX_IV_LENGTH               16
+# define EVP_MAX_BLOCK_LENGTH            32
+
+# define PKCS5_SALT_LEN                  8
+/* Default PKCS#5 iteration count */
+# define PKCS5_DEFAULT_ITER              2048
+
+# include <openssl/objects.h>
+
+# define EVP_PK_RSA      0x0001
+# define EVP_PK_DSA      0x0002
+# define EVP_PK_DH       0x0004
+# define EVP_PK_EC       0x0008
+# define EVP_PKT_SIGN    0x0010
+# define EVP_PKT_ENC     0x0020
+# define EVP_PKT_EXCH    0x0040
+# define EVP_PKS_RSA     0x0100
+# define EVP_PKS_DSA     0x0200
+# define EVP_PKS_EC      0x0400
+
+# define EVP_PKEY_NONE   NID_undef
+# define EVP_PKEY_RSA    NID_rsaEncryption
+# define EVP_PKEY_RSA2   NID_rsa
+# define EVP_PKEY_DSA    NID_dsa
+# define EVP_PKEY_DSA1   NID_dsa_2
+# define EVP_PKEY_DSA2   NID_dsaWithSHA
+# define EVP_PKEY_DSA3   NID_dsaWithSHA1
+# define EVP_PKEY_DSA4   NID_dsaWithSHA1_2
+# define EVP_PKEY_DH     NID_dhKeyAgreement
+# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
+# define EVP_PKEY_HMAC   NID_hmac
+# define EVP_PKEY_CMAC   NID_cmac
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Type needs to be a bit field Sub-type needs to be for variations on the
+ * method, as in, can it do arbitrary encryption....
+ */
+struct evp_pkey_st {
+    int type;
+    int save_type;
+    int references;
+    const EVP_PKEY_ASN1_METHOD *ameth;
+    ENGINE *engine;
+    union {
+        char *ptr;
+# ifndef OPENSSL_NO_RSA
+        struct rsa_st *rsa;     /* RSA */
+# endif
+# ifndef OPENSSL_NO_DSA
+        struct dsa_st *dsa;     /* DSA */
+# endif
+# ifndef OPENSSL_NO_DH
+        struct dh_st *dh;       /* DH */
+# endif
+# ifndef OPENSSL_NO_EC
+        struct ec_key_st *ec;   /* ECC */
+# endif
+    } pkey;
+    int save_parameters;
+    STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
+} /* EVP_PKEY */ ;
+
+# define EVP_PKEY_MO_SIGN        0x0001
+# define EVP_PKEY_MO_VERIFY      0x0002
+# define EVP_PKEY_MO_ENCRYPT     0x0004
+# define EVP_PKEY_MO_DECRYPT     0x0008
+
+# ifndef EVP_MD
+struct env_md_st {
+    int type;
+    int pkey_type;
+    int md_size;
+    unsigned long flags;
+    int (*init) (EVP_MD_CTX *ctx);
+    int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count);
+    int (*final) (EVP_MD_CTX *ctx, unsigned char *md);
+    int (*copy) (EVP_MD_CTX *to, const EVP_MD_CTX *from);
+    int (*cleanup) (EVP_MD_CTX *ctx);
+    /* FIXME: prototype these some day */
+    int (*sign) (int type, const unsigned char *m, unsigned int m_length,
+                 unsigned char *sigret, unsigned int *siglen, void *key);
+    int (*verify) (int type, const unsigned char *m, unsigned int m_length,
+                   const unsigned char *sigbuf, unsigned int siglen,
+                   void *key);
+    int required_pkey_type[5];  /* EVP_PKEY_xxx */
+    int block_size;
+    int ctx_size;               /* how big does the ctx->md_data need to be */
+    /* control function */
+    int (*md_ctrl) (EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
+} /* EVP_MD */ ;
+
+typedef int evp_sign_method(int type, const unsigned char *m,
+                            unsigned int m_length, unsigned char *sigret,
+                            unsigned int *siglen, void *key);
+typedef int evp_verify_method(int type, const unsigned char *m,
+                              unsigned int m_length,
+                              const unsigned char *sigbuf,
+                              unsigned int siglen, void *key);
+
+/* digest can only handle a single block */
+#  define EVP_MD_FLAG_ONESHOT     0x0001
+
+/*
+ * digest is a "clone" digest used
+ * which is a copy of an existing
+ * one for a specific public key type.
+ * EVP_dss1() etc
+ */
+#  define EVP_MD_FLAG_PKEY_DIGEST 0x0002
+
+/* Digest uses EVP_PKEY_METHOD for signing instead of MD specific signing */
+
+#  define EVP_MD_FLAG_PKEY_METHOD_SIGNATURE       0x0004
+
+/* DigestAlgorithmIdentifier flags... */
+
+#  define EVP_MD_FLAG_DIGALGID_MASK               0x0018
+
+/* NULL or absent parameter accepted. Use NULL */
+
+#  define EVP_MD_FLAG_DIGALGID_NULL               0x0000
+
+/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */
+
+#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
+
+/* Custom handling via ctrl */
+
+#  define EVP_MD_FLAG_DIGALGID_CUSTOM             0x0018
+
+/* Note if suitable for use in FIPS mode */
+#  define EVP_MD_FLAG_FIPS        0x0400
+
+/* Digest ctrls */
+
+#  define EVP_MD_CTRL_DIGALGID                    0x1
+#  define EVP_MD_CTRL_MICALG                      0x2
+
+/* Minimum Algorithm specific ctrl value */
+
+#  define EVP_MD_CTRL_ALG_CTRL                    0x1000
+
+#  define EVP_PKEY_NULL_method    NULL,NULL,{0,0,0,0}
+
+#  ifndef OPENSSL_NO_DSA
+#   define EVP_PKEY_DSA_method     (evp_sign_method *)DSA_sign, \
+                                (evp_verify_method *)DSA_verify, \
+                                {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \
+                                        EVP_PKEY_DSA4,0}
+#  else
+#   define EVP_PKEY_DSA_method     EVP_PKEY_NULL_method
+#  endif
+
+#  ifndef OPENSSL_NO_ECDSA
+#   define EVP_PKEY_ECDSA_method   (evp_sign_method *)ECDSA_sign, \
+                                (evp_verify_method *)ECDSA_verify, \
+                                 {EVP_PKEY_EC,0,0,0}
+#  else
+#   define EVP_PKEY_ECDSA_method   EVP_PKEY_NULL_method
+#  endif
+
+#  ifndef OPENSSL_NO_RSA
+#   define EVP_PKEY_RSA_method     (evp_sign_method *)RSA_sign, \
+                                (evp_verify_method *)RSA_verify, \
+                                {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
+#   define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \
+                                (evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \
+                                (evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \
+                                {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
+#  else
+#   define EVP_PKEY_RSA_method     EVP_PKEY_NULL_method
+#   define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method
+#  endif
+
+# endif                         /* !EVP_MD */
+
+struct env_md_ctx_st {
+    const EVP_MD *digest;
+    ENGINE *engine;             /* functional reference if 'digest' is
+                                 * ENGINE-provided */
+    unsigned long flags;
+    void *md_data;
+    /* Public key context for sign/verify */
+    EVP_PKEY_CTX *pctx;
+    /* Update function: usually copied from EVP_MD */
+    int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count);
+} /* EVP_MD_CTX */ ;
+
+/* values for EVP_MD_CTX flags */
+
+# define EVP_MD_CTX_FLAG_ONESHOT         0x0001/* digest update will be
+                                                * called once only */
+# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
+                                                * cleaned */
+# define EVP_MD_CTX_FLAG_REUSE           0x0004/* Don't free up ctx->md_data
+                                                * in EVP_MD_CTX_cleanup */
+/*
+ * FIPS and pad options are ignored in 1.0.0, definitions are here so we
+ * don't accidentally reuse the values for other purposes.
+ */
+
+# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW  0x0008/* Allow use of non FIPS
+                                                * digest in FIPS mode */
+
+/*
+ * The following PAD options are also currently ignored in 1.0.0, digest
+ * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*()
+ * instead.
+ */
+# define EVP_MD_CTX_FLAG_PAD_MASK        0xF0/* RSA mode to use */
+# define EVP_MD_CTX_FLAG_PAD_PKCS1       0x00/* PKCS#1 v1.5 mode */
+# define EVP_MD_CTX_FLAG_PAD_X931        0x10/* X9.31 mode */
+# define EVP_MD_CTX_FLAG_PAD_PSS         0x20/* PSS mode */
+
+# define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */
+
+struct evp_cipher_st {
+    int nid;
+    int block_size;
+    /* Default value for variable length ciphers */
+    int key_len;
+    int iv_len;
+    /* Various flags */
+    unsigned long flags;
+    /* init key */
+    int (*init) (EVP_CIPHER_CTX *ctx, const unsigned char *key,
+                 const unsigned char *iv, int enc);
+    /* encrypt/decrypt data */
+    int (*do_cipher) (EVP_CIPHER_CTX *ctx, unsigned char *out,
+                      const unsigned char *in, size_t inl);
+    /* cleanup ctx */
+    int (*cleanup) (EVP_CIPHER_CTX *);
+    /* how big ctx->cipher_data needs to be */
+    int ctx_size;
+    /* Populate a ASN1_TYPE with parameters */
+    int (*set_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *);
+    /* Get parameters from a ASN1_TYPE */
+    int (*get_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *);
+    /* Miscellaneous operations */
+    int (*ctrl) (EVP_CIPHER_CTX *, int type, int arg, void *ptr);
+    /* Application data */
+    void *app_data;
+} /* EVP_CIPHER */ ;
+
+/* Values for cipher flags */
+
+/* Modes for ciphers */
+
+# define         EVP_CIPH_STREAM_CIPHER          0x0
+# define         EVP_CIPH_ECB_MODE               0x1
+# define         EVP_CIPH_CBC_MODE               0x2
+# define         EVP_CIPH_CFB_MODE               0x3
+# define         EVP_CIPH_OFB_MODE               0x4
+# define         EVP_CIPH_CTR_MODE               0x5
+# define         EVP_CIPH_GCM_MODE               0x6
+# define         EVP_CIPH_CCM_MODE               0x7
+# define         EVP_CIPH_XTS_MODE               0x10001
+# define         EVP_CIPH_MODE                   0xF0007
+/* Set if variable length cipher */
+# define         EVP_CIPH_VARIABLE_LENGTH        0x8
+/* Set if the iv handling should be done by the cipher itself */
+# define         EVP_CIPH_CUSTOM_IV              0x10
+/* Set if the cipher's init() function should be called if key is NULL */
+# define         EVP_CIPH_ALWAYS_CALL_INIT       0x20
+/* Call ctrl() to init cipher parameters */
+# define         EVP_CIPH_CTRL_INIT              0x40
+/* Don't use standard key length function */
+# define         EVP_CIPH_CUSTOM_KEY_LENGTH      0x80
+/* Don't use standard block padding */
+# define         EVP_CIPH_NO_PADDING             0x100
+/* cipher handles random key generation */
+# define         EVP_CIPH_RAND_KEY               0x200
+/* cipher has its own additional copying logic */
+# define         EVP_CIPH_CUSTOM_COPY            0x400
+/* Allow use default ASN1 get/set iv */
+# define         EVP_CIPH_FLAG_DEFAULT_ASN1      0x1000
+/* Buffer length in bits not bytes: CFB1 mode only */
+# define         EVP_CIPH_FLAG_LENGTH_BITS       0x2000
+/* Note if suitable for use in FIPS mode */
+# define         EVP_CIPH_FLAG_FIPS              0x4000
+/* Allow non FIPS cipher in FIPS mode */
+# define         EVP_CIPH_FLAG_NON_FIPS_ALLOW    0x8000
+/*
+ * Cipher handles any and all padding logic as well as finalisation.
+ */
+# define         EVP_CIPH_FLAG_CUSTOM_CIPHER     0x100000
+# define         EVP_CIPH_FLAG_AEAD_CIPHER       0x200000
+
+/* ctrl() values */
+
+# define         EVP_CTRL_INIT                   0x0
+# define         EVP_CTRL_SET_KEY_LENGTH         0x1
+# define         EVP_CTRL_GET_RC2_KEY_BITS       0x2
+# define         EVP_CTRL_SET_RC2_KEY_BITS       0x3
+# define         EVP_CTRL_GET_RC5_ROUNDS         0x4
+# define         EVP_CTRL_SET_RC5_ROUNDS         0x5
+# define         EVP_CTRL_RAND_KEY               0x6
+# define         EVP_CTRL_PBE_PRF_NID            0x7
+# define         EVP_CTRL_COPY                   0x8
+# define         EVP_CTRL_GCM_SET_IVLEN          0x9
+# define         EVP_CTRL_GCM_GET_TAG            0x10
+# define         EVP_CTRL_GCM_SET_TAG            0x11
+# define         EVP_CTRL_GCM_SET_IV_FIXED       0x12
+# define         EVP_CTRL_GCM_IV_GEN             0x13
+# define         EVP_CTRL_CCM_SET_IVLEN          EVP_CTRL_GCM_SET_IVLEN
+# define         EVP_CTRL_CCM_GET_TAG            EVP_CTRL_GCM_GET_TAG
+# define         EVP_CTRL_CCM_SET_TAG            EVP_CTRL_GCM_SET_TAG
+# define         EVP_CTRL_CCM_SET_L              0x14
+# define         EVP_CTRL_CCM_SET_MSGLEN         0x15
+/*
+ * AEAD cipher deduces payload length and returns number of bytes required to
+ * store MAC and eventual padding. Subsequent call to EVP_Cipher even
+ * appends/verifies MAC.
+ */
+# define         EVP_CTRL_AEAD_TLS1_AAD          0x16
+/* Used by composite AEAD ciphers, no-op in GCM, CCM... */
+# define         EVP_CTRL_AEAD_SET_MAC_KEY       0x17
+/* Set the GCM invocation field, decrypt only */
+# define         EVP_CTRL_GCM_SET_IV_INV         0x18
+
+/* RFC 5246 defines additional data to be 13 bytes in length */
+# define         EVP_AEAD_TLS1_AAD_LEN           13
+
+/* GCM TLS constants */
+/* Length of fixed part of IV derived from PRF */
+# define EVP_GCM_TLS_FIXED_IV_LEN                        4
+/* Length of explicit part of IV part of TLS records */
+# define EVP_GCM_TLS_EXPLICIT_IV_LEN                     8
+/* Length of tag for TLS */
+# define EVP_GCM_TLS_TAG_LEN                             16
+
+typedef struct evp_cipher_info_st {
+    const EVP_CIPHER *cipher;
+    unsigned char iv[EVP_MAX_IV_LENGTH];
+} EVP_CIPHER_INFO;
+
+struct evp_cipher_ctx_st {
+    const EVP_CIPHER *cipher;
+    ENGINE *engine;             /* functional reference if 'cipher' is
+                                 * ENGINE-provided */
+    int encrypt;                /* encrypt or decrypt */
+    int buf_len;                /* number we have left */
+    unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
+    unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
+    unsigned char buf[EVP_MAX_BLOCK_LENGTH]; /* saved partial block */
+    int num;                    /* used by cfb/ofb/ctr mode */
+    void *app_data;             /* application stuff */
+    int key_len;                /* May change for variable length cipher */
+    unsigned long flags;        /* Various flags */
+    void *cipher_data;          /* per EVP data */
+    int final_used;
+    int block_mask;
+    unsigned char final[EVP_MAX_BLOCK_LENGTH]; /* possible final block */
+} /* EVP_CIPHER_CTX */ ;
+
+typedef struct evp_Encode_Ctx_st {
+    /* number saved in a partial encode/decode */
+    int num;
+    /*
+     * The length is either the output line length (in input bytes) or the
+     * shortest input line length that is ok.  Once decoding begins, the
+     * length is adjusted up each time a longer line is decoded
+     */
+    int length;
+    /* data to encode */
+    unsigned char enc_data[80];
+    /* number read on current line */
+    int line_num;
+    int expect_nl;
+} EVP_ENCODE_CTX;
+
+/* Password based encryption function */
+typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass,
+                              int passlen, ASN1_TYPE *param,
+                              const EVP_CIPHER *cipher, const EVP_MD *md,
+                              int en_de);
+
+# ifndef OPENSSL_NO_RSA
+#  define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\
+                                        (char *)(rsa))
+# endif
+
+# ifndef OPENSSL_NO_DSA
+#  define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
+                                        (char *)(dsa))
+# endif
+
+# ifndef OPENSSL_NO_DH
+#  define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\
+                                        (char *)(dh))
+# endif
+
+# ifndef OPENSSL_NO_EC
+#  define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\
+                                        (char *)(eckey))
+# endif
+
+/* Add some extra combinations */
+# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
+# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
+# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a))
+# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))
+
+int EVP_MD_type(const EVP_MD *md);
+# define EVP_MD_nid(e)                   EVP_MD_type(e)
+# define EVP_MD_name(e)                  OBJ_nid2sn(EVP_MD_nid(e))
+int EVP_MD_pkey_type(const EVP_MD *md);
+int EVP_MD_size(const EVP_MD *md);
+int EVP_MD_block_size(const EVP_MD *md);
+unsigned long EVP_MD_flags(const EVP_MD *md);
+
+const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
+# define EVP_MD_CTX_size(e)              EVP_MD_size(EVP_MD_CTX_md(e))
+# define EVP_MD_CTX_block_size(e)        EVP_MD_block_size(EVP_MD_CTX_md(e))
+# define EVP_MD_CTX_type(e)              EVP_MD_type(EVP_MD_CTX_md(e))
+
+int EVP_CIPHER_nid(const EVP_CIPHER *cipher);
+# define EVP_CIPHER_name(e)              OBJ_nid2sn(EVP_CIPHER_nid(e))
+int EVP_CIPHER_block_size(const EVP_CIPHER *cipher);
+int EVP_CIPHER_key_length(const EVP_CIPHER *cipher);
+int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher);
+unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher);
+# define EVP_CIPHER_mode(e)              (EVP_CIPHER_flags(e) & EVP_CIPH_MODE)
+
+const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);
+void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
+void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
+# define EVP_CIPHER_CTX_type(c)         EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c))
+unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx);
+# define EVP_CIPHER_CTX_mode(e)          (EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE)
+
+# define EVP_ENCODE_LENGTH(l)    (((l+2)/3*4)+(l/48+1)*2+80)
+# define EVP_DECODE_LENGTH(l)    ((l+3)/4*3+80)
+
+# define EVP_SignInit_ex(a,b,c)          EVP_DigestInit_ex(a,b,c)
+# define EVP_SignInit(a,b)               EVP_DigestInit(a,b)
+# define EVP_SignUpdate(a,b,c)           EVP_DigestUpdate(a,b,c)
+# define EVP_VerifyInit_ex(a,b,c)        EVP_DigestInit_ex(a,b,c)
+# define EVP_VerifyInit(a,b)             EVP_DigestInit(a,b)
+# define EVP_VerifyUpdate(a,b,c)         EVP_DigestUpdate(a,b,c)
+# define EVP_OpenUpdate(a,b,c,d,e)       EVP_DecryptUpdate(a,b,c,d,e)
+# define EVP_SealUpdate(a,b,c,d,e)       EVP_EncryptUpdate(a,b,c,d,e)
+# define EVP_DigestSignUpdate(a,b,c)     EVP_DigestUpdate(a,b,c)
+# define EVP_DigestVerifyUpdate(a,b,c)   EVP_DigestUpdate(a,b,c)
+
+# ifdef CONST_STRICT
+void BIO_set_md(BIO *, const EVP_MD *md);
+# else
+#  define BIO_set_md(b,md)               BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md)
+# endif
+# define BIO_get_md(b,mdp)               BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp)
+# define BIO_get_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp)
+# define BIO_set_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp)
+# define BIO_get_cipher_status(b)        BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)
+# define BIO_get_cipher_ctx(b,c_pp)      BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp)
+
+int EVP_Cipher(EVP_CIPHER_CTX *c,
+               unsigned char *out, const unsigned char *in, unsigned int inl);
+
+# define EVP_add_cipher_alias(n,alias) \
+        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
+# define EVP_add_digest_alias(n,alias) \
+        OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
+# define EVP_delete_cipher_alias(alias) \
+        OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS);
+# define EVP_delete_digest_alias(alias) \
+        OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);
+
+void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
+int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
+EVP_MD_CTX *EVP_MD_CTX_create(void);
+void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
+int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);
+void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
+void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
+int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags);
+int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
+int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);
+int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
+int EVP_Digest(const void *data, size_t count,
+               unsigned char *md, unsigned int *size, const EVP_MD *type,
+               ENGINE *impl);
+
+int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in);
+int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
+int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
+
+int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify);
+int EVP_read_pw_string_min(char *buf, int minlen, int maxlen,
+                           const char *prompt, int verify);
+void EVP_set_pw_prompt(const char *prompt);
+char *EVP_get_pw_prompt(void);
+
+int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
+                   const unsigned char *salt, const unsigned char *data,
+                   int datal, int count, unsigned char *key,
+                   unsigned char *iv);
+
+void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags);
+void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags);
+int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags);
+
+int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
+                    const unsigned char *key, const unsigned char *iv);
+int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
+                       ENGINE *impl, const unsigned char *key,
+                       const unsigned char *iv);
+int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
+                      const unsigned char *in, int inl);
+int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
+int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
+
+int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
+                    const unsigned char *key, const unsigned char *iv);
+int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
+                       ENGINE *impl, const unsigned char *key,
+                       const unsigned char *iv);
+int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
+                      const unsigned char *in, int inl);
+int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+
+int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
+                   const unsigned char *key, const unsigned char *iv,
+                   int enc);
+int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
+                      ENGINE *impl, const unsigned char *key,
+                      const unsigned char *iv, int enc);
+int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
+                     const unsigned char *in, int inl);
+int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+
+int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s,
+                  EVP_PKEY *pkey);
+
+int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
+                    unsigned int siglen, EVP_PKEY *pkey);
+
+int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+                       const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
+int EVP_DigestSignFinal(EVP_MD_CTX *ctx,
+                        unsigned char *sigret, size_t *siglen);
+
+int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+                         const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
+int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen);
+
+int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
+                 const unsigned char *ek, int ekl, const unsigned char *iv,
+                 EVP_PKEY *priv);
+int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
+
+int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
+                 unsigned char **ek, int *ekl, unsigned char *iv,
+                 EVP_PKEY **pubk, int npubk);
+int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
+
+void EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
+void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
+                      const unsigned char *in, int inl);
+void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl);
+int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);
+
+void EVP_DecodeInit(EVP_ENCODE_CTX *ctx);
+int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
+                     const unsigned char *in, int inl);
+int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
+                    char *out, int *outl);
+int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);
+
+void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
+int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);
+EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);
+void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a);
+int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);
+int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);
+int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
+int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);
+
+# ifndef OPENSSL_NO_BIO
+BIO_METHOD *BIO_f_md(void);
+BIO_METHOD *BIO_f_base64(void);
+BIO_METHOD *BIO_f_cipher(void);
+BIO_METHOD *BIO_f_reliable(void);
+void BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k,
+                    const unsigned char *i, int enc);
+# endif
+
+const EVP_MD *EVP_md_null(void);
+# ifndef OPENSSL_NO_MD2
+const EVP_MD *EVP_md2(void);
+# endif
+# ifndef OPENSSL_NO_MD4
+const EVP_MD *EVP_md4(void);
+# endif
+# ifndef OPENSSL_NO_MD5
+const EVP_MD *EVP_md5(void);
+# endif
+# ifndef OPENSSL_NO_SHA
+const EVP_MD *EVP_sha(void);
+const EVP_MD *EVP_sha1(void);
+const EVP_MD *EVP_dss(void);
+const EVP_MD *EVP_dss1(void);
+const EVP_MD *EVP_ecdsa(void);
+# endif
+# ifndef OPENSSL_NO_SHA256
+const EVP_MD *EVP_sha224(void);
+const EVP_MD *EVP_sha256(void);
+# endif
+# ifndef OPENSSL_NO_SHA512
+const EVP_MD *EVP_sha384(void);
+const EVP_MD *EVP_sha512(void);
+# endif
+# ifndef OPENSSL_NO_MDC2
+const EVP_MD *EVP_mdc2(void);
+# endif
+# ifndef OPENSSL_NO_RIPEMD
+const EVP_MD *EVP_ripemd160(void);
+# endif
+# ifndef OPENSSL_NO_WHIRLPOOL
+const EVP_MD *EVP_whirlpool(void);
+# endif
+const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */
+# ifndef OPENSSL_NO_DES
+const EVP_CIPHER *EVP_des_ecb(void);
+const EVP_CIPHER *EVP_des_ede(void);
+const EVP_CIPHER *EVP_des_ede3(void);
+const EVP_CIPHER *EVP_des_ede_ecb(void);
+const EVP_CIPHER *EVP_des_ede3_ecb(void);
+const EVP_CIPHER *EVP_des_cfb64(void);
+#  define EVP_des_cfb EVP_des_cfb64
+const EVP_CIPHER *EVP_des_cfb1(void);
+const EVP_CIPHER *EVP_des_cfb8(void);
+const EVP_CIPHER *EVP_des_ede_cfb64(void);
+#  define EVP_des_ede_cfb EVP_des_ede_cfb64
+#  if 0
+const EVP_CIPHER *EVP_des_ede_cfb1(void);
+const EVP_CIPHER *EVP_des_ede_cfb8(void);
+#  endif
+const EVP_CIPHER *EVP_des_ede3_cfb64(void);
+#  define EVP_des_ede3_cfb EVP_des_ede3_cfb64
+const EVP_CIPHER *EVP_des_ede3_cfb1(void);
+const EVP_CIPHER *EVP_des_ede3_cfb8(void);
+const EVP_CIPHER *EVP_des_ofb(void);
+const EVP_CIPHER *EVP_des_ede_ofb(void);
+const EVP_CIPHER *EVP_des_ede3_ofb(void);
+const EVP_CIPHER *EVP_des_cbc(void);
+const EVP_CIPHER *EVP_des_ede_cbc(void);
+const EVP_CIPHER *EVP_des_ede3_cbc(void);
+const EVP_CIPHER *EVP_desx_cbc(void);
+/*
+ * This should now be supported through the dev_crypto ENGINE. But also, why
+ * are rc4 and md5 declarations made here inside a "NO_DES" precompiler
+ * branch?
+ */
+#  if 0
+#   ifdef OPENSSL_OPENBSD_DEV_CRYPTO
+const EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc(void);
+const EVP_CIPHER *EVP_dev_crypto_rc4(void);
+const EVP_MD *EVP_dev_crypto_md5(void);
+#   endif
+#  endif
+# endif
+# ifndef OPENSSL_NO_RC4
+const EVP_CIPHER *EVP_rc4(void);
+const EVP_CIPHER *EVP_rc4_40(void);
+#  ifndef OPENSSL_NO_MD5
+const EVP_CIPHER *EVP_rc4_hmac_md5(void);
+#  endif
+# endif
+# ifndef OPENSSL_NO_IDEA
+const EVP_CIPHER *EVP_idea_ecb(void);
+const EVP_CIPHER *EVP_idea_cfb64(void);
+#  define EVP_idea_cfb EVP_idea_cfb64
+const EVP_CIPHER *EVP_idea_ofb(void);
+const EVP_CIPHER *EVP_idea_cbc(void);
+# endif
+# ifndef OPENSSL_NO_RC2
+const EVP_CIPHER *EVP_rc2_ecb(void);
+const EVP_CIPHER *EVP_rc2_cbc(void);
+const EVP_CIPHER *EVP_rc2_40_cbc(void);
+const EVP_CIPHER *EVP_rc2_64_cbc(void);
+const EVP_CIPHER *EVP_rc2_cfb64(void);
+#  define EVP_rc2_cfb EVP_rc2_cfb64
+const EVP_CIPHER *EVP_rc2_ofb(void);
+# endif
+# ifndef OPENSSL_NO_BF
+const EVP_CIPHER *EVP_bf_ecb(void);
+const EVP_CIPHER *EVP_bf_cbc(void);
+const EVP_CIPHER *EVP_bf_cfb64(void);
+#  define EVP_bf_cfb EVP_bf_cfb64
+const EVP_CIPHER *EVP_bf_ofb(void);
+# endif
+# ifndef OPENSSL_NO_CAST
+const EVP_CIPHER *EVP_cast5_ecb(void);
+const EVP_CIPHER *EVP_cast5_cbc(void);
+const EVP_CIPHER *EVP_cast5_cfb64(void);
+#  define EVP_cast5_cfb EVP_cast5_cfb64
+const EVP_CIPHER *EVP_cast5_ofb(void);
+# endif
+# ifndef OPENSSL_NO_RC5
+const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);
+const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);
+const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);
+#  define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64
+const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);
+# endif
+# ifndef OPENSSL_NO_AES
+const EVP_CIPHER *EVP_aes_128_ecb(void);
+const EVP_CIPHER *EVP_aes_128_cbc(void);
+const EVP_CIPHER *EVP_aes_128_cfb1(void);
+const EVP_CIPHER *EVP_aes_128_cfb8(void);
+const EVP_CIPHER *EVP_aes_128_cfb128(void);
+#  define EVP_aes_128_cfb EVP_aes_128_cfb128
+const EVP_CIPHER *EVP_aes_128_ofb(void);
+const EVP_CIPHER *EVP_aes_128_ctr(void);
+const EVP_CIPHER *EVP_aes_128_ccm(void);
+const EVP_CIPHER *EVP_aes_128_gcm(void);
+const EVP_CIPHER *EVP_aes_128_xts(void);
+const EVP_CIPHER *EVP_aes_192_ecb(void);
+const EVP_CIPHER *EVP_aes_192_cbc(void);
+const EVP_CIPHER *EVP_aes_192_cfb1(void);
+const EVP_CIPHER *EVP_aes_192_cfb8(void);
+const EVP_CIPHER *EVP_aes_192_cfb128(void);
+#  define EVP_aes_192_cfb EVP_aes_192_cfb128
+const EVP_CIPHER *EVP_aes_192_ofb(void);
+const EVP_CIPHER *EVP_aes_192_ctr(void);
+const EVP_CIPHER *EVP_aes_192_ccm(void);
+const EVP_CIPHER *EVP_aes_192_gcm(void);
+const EVP_CIPHER *EVP_aes_256_ecb(void);
+const EVP_CIPHER *EVP_aes_256_cbc(void);
+const EVP_CIPHER *EVP_aes_256_cfb1(void);
+const EVP_CIPHER *EVP_aes_256_cfb8(void);
+const EVP_CIPHER *EVP_aes_256_cfb128(void);
+#  define EVP_aes_256_cfb EVP_aes_256_cfb128
+const EVP_CIPHER *EVP_aes_256_ofb(void);
+const EVP_CIPHER *EVP_aes_256_ctr(void);
+const EVP_CIPHER *EVP_aes_256_ccm(void);
+const EVP_CIPHER *EVP_aes_256_gcm(void);
+const EVP_CIPHER *EVP_aes_256_xts(void);
+#  if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
+const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
+const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);
+#  endif
+# endif
+# ifndef OPENSSL_NO_CAMELLIA
+const EVP_CIPHER *EVP_camellia_128_ecb(void);
+const EVP_CIPHER *EVP_camellia_128_cbc(void);
+const EVP_CIPHER *EVP_camellia_128_cfb1(void);
+const EVP_CIPHER *EVP_camellia_128_cfb8(void);
+const EVP_CIPHER *EVP_camellia_128_cfb128(void);
+#  define EVP_camellia_128_cfb EVP_camellia_128_cfb128
+const EVP_CIPHER *EVP_camellia_128_ofb(void);
+const EVP_CIPHER *EVP_camellia_192_ecb(void);
+const EVP_CIPHER *EVP_camellia_192_cbc(void);
+const EVP_CIPHER *EVP_camellia_192_cfb1(void);
+const EVP_CIPHER *EVP_camellia_192_cfb8(void);
+const EVP_CIPHER *EVP_camellia_192_cfb128(void);
+#  define EVP_camellia_192_cfb EVP_camellia_192_cfb128
+const EVP_CIPHER *EVP_camellia_192_ofb(void);
+const EVP_CIPHER *EVP_camellia_256_ecb(void);
+const EVP_CIPHER *EVP_camellia_256_cbc(void);
+const EVP_CIPHER *EVP_camellia_256_cfb1(void);
+const EVP_CIPHER *EVP_camellia_256_cfb8(void);
+const EVP_CIPHER *EVP_camellia_256_cfb128(void);
+#  define EVP_camellia_256_cfb EVP_camellia_256_cfb128
+const EVP_CIPHER *EVP_camellia_256_ofb(void);
+# endif
+
+# ifndef OPENSSL_NO_SEED
+const EVP_CIPHER *EVP_seed_ecb(void);
+const EVP_CIPHER *EVP_seed_cbc(void);
+const EVP_CIPHER *EVP_seed_cfb128(void);
+#  define EVP_seed_cfb EVP_seed_cfb128
+const EVP_CIPHER *EVP_seed_ofb(void);
+# endif
+
+void OPENSSL_add_all_algorithms_noconf(void);
+void OPENSSL_add_all_algorithms_conf(void);
+
+# ifdef OPENSSL_LOAD_CONF
+#  define OpenSSL_add_all_algorithms() \
+                OPENSSL_add_all_algorithms_conf()
+# else
+#  define OpenSSL_add_all_algorithms() \
+                OPENSSL_add_all_algorithms_noconf()
+# endif
+
+void OpenSSL_add_all_ciphers(void);
+void OpenSSL_add_all_digests(void);
+# define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms()
+# define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers()
+# define SSLeay_add_all_digests() OpenSSL_add_all_digests()
+
+int EVP_add_cipher(const EVP_CIPHER *cipher);
+int EVP_add_digest(const EVP_MD *digest);
+
+const EVP_CIPHER *EVP_get_cipherbyname(const char *name);
+const EVP_MD *EVP_get_digestbyname(const char *name);
+void EVP_cleanup(void);
+
+void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph,
+                                   const char *from, const char *to, void *x),
+                       void *arg);
+void EVP_CIPHER_do_all_sorted(void (*fn)
+                               (const EVP_CIPHER *ciph, const char *from,
+                                const char *to, void *x), void *arg);
+
+void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph,
+                               const char *from, const char *to, void *x),
+                   void *arg);
+void EVP_MD_do_all_sorted(void (*fn)
+                           (const EVP_MD *ciph, const char *from,
+                            const char *to, void *x), void *arg);
+
+int EVP_PKEY_decrypt_old(unsigned char *dec_key,
+                         const unsigned char *enc_key, int enc_key_len,
+                         EVP_PKEY *private_key);
+int EVP_PKEY_encrypt_old(unsigned char *enc_key,
+                         const unsigned char *key, int key_len,
+                         EVP_PKEY *pub_key);
+int EVP_PKEY_type(int type);
+int EVP_PKEY_id(const EVP_PKEY *pkey);
+int EVP_PKEY_base_id(const EVP_PKEY *pkey);
+int EVP_PKEY_bits(EVP_PKEY *pkey);
+int EVP_PKEY_size(EVP_PKEY *pkey);
+int EVP_PKEY_set_type(EVP_PKEY *pkey, int type);
+int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
+int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key);
+void *EVP_PKEY_get0(EVP_PKEY *pkey);
+
+# ifndef OPENSSL_NO_RSA
+struct rsa_st;
+int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key);
+struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
+# endif
+# ifndef OPENSSL_NO_DSA
+struct dsa_st;
+int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key);
+struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
+# endif
+# ifndef OPENSSL_NO_DH
+struct dh_st;
+int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key);
+struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
+# endif
+# ifndef OPENSSL_NO_EC
+struct ec_key_st;
+int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key);
+struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
+# endif
+
+EVP_PKEY *EVP_PKEY_new(void);
+void EVP_PKEY_free(EVP_PKEY *pkey);
+
+EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
+                        long length);
+int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
+
+EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
+                         long length);
+EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
+                             long length);
+int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
+
+int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
+int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
+int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode);
+int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);
+
+int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
+
+int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
+                          int indent, ASN1_PCTX *pctx);
+int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
+                           int indent, ASN1_PCTX *pctx);
+int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
+                          int indent, ASN1_PCTX *pctx);
+
+int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
+
+int EVP_CIPHER_type(const EVP_CIPHER *ctx);
+
+/* calls methods */
+int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
+int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
+
+/* These are used by EVP_CIPHER methods */
+int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
+int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
+
+/* PKCS5 password based encryption */
+int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
+                       ASN1_TYPE *param, const EVP_CIPHER *cipher,
+                       const EVP_MD *md, int en_de);
+int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
+                           const unsigned char *salt, int saltlen, int iter,
+                           int keylen, unsigned char *out);
+int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
+                      const unsigned char *salt, int saltlen, int iter,
+                      const EVP_MD *digest, int keylen, unsigned char *out);
+int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
+                          ASN1_TYPE *param, const EVP_CIPHER *cipher,
+                          const EVP_MD *md, int en_de);
+
+void PKCS5_PBE_add(void);
+
+int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
+                       ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
+
+/* PBE type */
+
+/* Can appear as the outermost AlgorithmIdentifier */
+# define EVP_PBE_TYPE_OUTER      0x0
+/* Is an PRF type OID */
+# define EVP_PBE_TYPE_PRF        0x1
+
+int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,
+                         int md_nid, EVP_PBE_KEYGEN *keygen);
+int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
+                    EVP_PBE_KEYGEN *keygen);
+int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid,
+                 EVP_PBE_KEYGEN **pkeygen);
+void EVP_PBE_cleanup(void);
+
+# define ASN1_PKEY_ALIAS         0x1
+# define ASN1_PKEY_DYNAMIC       0x2
+# define ASN1_PKEY_SIGPARAM_NULL 0x4
+
+# define ASN1_PKEY_CTRL_PKCS7_SIGN       0x1
+# define ASN1_PKEY_CTRL_PKCS7_ENCRYPT    0x2
+# define ASN1_PKEY_CTRL_DEFAULT_MD_NID   0x3
+# define ASN1_PKEY_CTRL_CMS_SIGN         0x5
+# define ASN1_PKEY_CTRL_CMS_ENVELOPE     0x7
+
+int EVP_PKEY_asn1_get_count(void);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
+                                                   const char *str, int len);
+int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);
+int EVP_PKEY_asn1_add_alias(int to, int from);
+int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id,
+                            int *ppkey_flags, const char **pinfo,
+                            const char **ppem_str,
+                            const EVP_PKEY_ASN1_METHOD *ameth);
+
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(EVP_PKEY *pkey);
+EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,
+                                        const char *pem_str,
+                                        const char *info);
+void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,
+                        const EVP_PKEY_ASN1_METHOD *src);
+void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);
+void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,
+                              int (*pub_decode) (EVP_PKEY *pk,
+                                                 X509_PUBKEY *pub),
+                              int (*pub_encode) (X509_PUBKEY *pub,
+                                                 const EVP_PKEY *pk),
+                              int (*pub_cmp) (const EVP_PKEY *a,
+                                              const EVP_PKEY *b),
+                              int (*pub_print) (BIO *out,
+                                                const EVP_PKEY *pkey,
+                                                int indent, ASN1_PCTX *pctx),
+                              int (*pkey_size) (const EVP_PKEY *pk),
+                              int (*pkey_bits) (const EVP_PKEY *pk));
+void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
+                               int (*priv_decode) (EVP_PKEY *pk,
+                                                   PKCS8_PRIV_KEY_INFO
+                                                   *p8inf),
+                               int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8,
+                                                   const EVP_PKEY *pk),
+                               int (*priv_print) (BIO *out,
+                                                  const EVP_PKEY *pkey,
+                                                  int indent,
+                                                  ASN1_PCTX *pctx));
+void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
+                             int (*param_decode) (EVP_PKEY *pkey,
+                                                  const unsigned char **pder,
+                                                  int derlen),
+                             int (*param_encode) (const EVP_PKEY *pkey,
+                                                  unsigned char **pder),
+                             int (*param_missing) (const EVP_PKEY *pk),
+                             int (*param_copy) (EVP_PKEY *to,
+                                                const EVP_PKEY *from),
+                             int (*param_cmp) (const EVP_PKEY *a,
+                                               const EVP_PKEY *b),
+                             int (*param_print) (BIO *out,
+                                                 const EVP_PKEY *pkey,
+                                                 int indent,
+                                                 ASN1_PCTX *pctx));
+
+void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
+                            void (*pkey_free) (EVP_PKEY *pkey));
+void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
+                            int (*pkey_ctrl) (EVP_PKEY *pkey, int op,
+                                              long arg1, void *arg2));
+
+# define EVP_PKEY_OP_UNDEFINED           0
+# define EVP_PKEY_OP_PARAMGEN            (1<<1)
+# define EVP_PKEY_OP_KEYGEN              (1<<2)
+# define EVP_PKEY_OP_SIGN                (1<<3)
+# define EVP_PKEY_OP_VERIFY              (1<<4)
+# define EVP_PKEY_OP_VERIFYRECOVER       (1<<5)
+# define EVP_PKEY_OP_SIGNCTX             (1<<6)
+# define EVP_PKEY_OP_VERIFYCTX           (1<<7)
+# define EVP_PKEY_OP_ENCRYPT             (1<<8)
+# define EVP_PKEY_OP_DECRYPT             (1<<9)
+# define EVP_PKEY_OP_DERIVE              (1<<10)
+
+# define EVP_PKEY_OP_TYPE_SIG    \
+        (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \
+                | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
+
+# define EVP_PKEY_OP_TYPE_CRYPT \
+        (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT)
+
+# define EVP_PKEY_OP_TYPE_NOGEN \
+        (EVP_PKEY_OP_SIG | EVP_PKEY_OP_CRYPT | EVP_PKEY_OP_DERIVE)
+
+# define EVP_PKEY_OP_TYPE_GEN \
+                (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN)
+
+# define  EVP_PKEY_CTX_set_signature_md(ctx, md) \
+                EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG,  \
+                                        EVP_PKEY_CTRL_MD, 0, (void *)md)
+
+# define EVP_PKEY_CTRL_MD                1
+# define EVP_PKEY_CTRL_PEER_KEY          2
+
+# define EVP_PKEY_CTRL_PKCS7_ENCRYPT     3
+# define EVP_PKEY_CTRL_PKCS7_DECRYPT     4
+
+# define EVP_PKEY_CTRL_PKCS7_SIGN        5
+
+# define EVP_PKEY_CTRL_SET_MAC_KEY       6
+
+# define EVP_PKEY_CTRL_DIGESTINIT        7
+
+/* Used by GOST key encryption in TLS */
+# define EVP_PKEY_CTRL_SET_IV            8
+
+# define EVP_PKEY_CTRL_CMS_ENCRYPT       9
+# define EVP_PKEY_CTRL_CMS_DECRYPT       10
+# define EVP_PKEY_CTRL_CMS_SIGN          11
+
+# define EVP_PKEY_CTRL_CIPHER            12
+
+# define EVP_PKEY_ALG_CTRL               0x1000
+
+# define EVP_PKEY_FLAG_AUTOARGLEN        2
+/*
+ * Method handles all operations: don't assume any digest related defaults.
+ */
+# define EVP_PKEY_FLAG_SIGCTX_CUSTOM     4
+
+const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
+EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags);
+void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,
+                             const EVP_PKEY_METHOD *meth);
+void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
+void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
+int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
+
+EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
+EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
+EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx);
+void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
+
+int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
+                      int cmd, int p1, void *p2);
+int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
+                          const char *value);
+
+int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx);
+void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen);
+
+EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e,
+                               const unsigned char *key, int keylen);
+
+void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data);
+void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx);
+EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);
+
+EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);
+
+void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);
+void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);
+
+int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
+                  unsigned char *sig, size_t *siglen,
+                  const unsigned char *tbs, size_t tbslen);
+int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
+                    const unsigned char *sig, size_t siglen,
+                    const unsigned char *tbs, size_t tbslen);
+int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,
+                            unsigned char *rout, size_t *routlen,
+                            const unsigned char *sig, size_t siglen);
+int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
+                     unsigned char *out, size_t *outlen,
+                     const unsigned char *in, size_t inlen);
+int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
+                     unsigned char *out, size_t *outlen,
+                     const unsigned char *in, size_t inlen);
+
+int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);
+int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
+
+typedef int EVP_PKEY_gen_cb (EVP_PKEY_CTX *ctx);
+
+int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
+int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
+
+void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);
+EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);
+
+int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);
+
+void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
+                            int (*init) (EVP_PKEY_CTX *ctx));
+
+void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,
+                            int (*copy) (EVP_PKEY_CTX *dst,
+                                         EVP_PKEY_CTX *src));
+
+void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,
+                               void (*cleanup) (EVP_PKEY_CTX *ctx));
+
+void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,
+                                int (*paramgen_init) (EVP_PKEY_CTX *ctx),
+                                int (*paramgen) (EVP_PKEY_CTX *ctx,
+                                                 EVP_PKEY *pkey));
+
+void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,
+                              int (*keygen_init) (EVP_PKEY_CTX *ctx),
+                              int (*keygen) (EVP_PKEY_CTX *ctx,
+                                             EVP_PKEY *pkey));
+
+void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,
+                            int (*sign_init) (EVP_PKEY_CTX *ctx),
+                            int (*sign) (EVP_PKEY_CTX *ctx,
+                                         unsigned char *sig, size_t *siglen,
+                                         const unsigned char *tbs,
+                                         size_t tbslen));
+
+void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,
+                              int (*verify_init) (EVP_PKEY_CTX *ctx),
+                              int (*verify) (EVP_PKEY_CTX *ctx,
+                                             const unsigned char *sig,
+                                             size_t siglen,
+                                             const unsigned char *tbs,
+                                             size_t tbslen));
+
+void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,
+                                      int (*verify_recover_init) (EVP_PKEY_CTX
+                                                                  *ctx),
+                                      int (*verify_recover) (EVP_PKEY_CTX
+                                                             *ctx,
+                                                             unsigned char
+                                                             *sig,
+                                                             size_t *siglen,
+                                                             const unsigned
+                                                             char *tbs,
+                                                             size_t tbslen));
+
+void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,
+                               int (*signctx_init) (EVP_PKEY_CTX *ctx,
+                                                    EVP_MD_CTX *mctx),
+                               int (*signctx) (EVP_PKEY_CTX *ctx,
+                                               unsigned char *sig,
+                                               size_t *siglen,
+                                               EVP_MD_CTX *mctx));
+
+void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,
+                                 int (*verifyctx_init) (EVP_PKEY_CTX *ctx,
+                                                        EVP_MD_CTX *mctx),
+                                 int (*verifyctx) (EVP_PKEY_CTX *ctx,
+                                                   const unsigned char *sig,
+                                                   int siglen,
+                                                   EVP_MD_CTX *mctx));
+
+void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
+                               int (*encrypt_init) (EVP_PKEY_CTX *ctx),
+                               int (*encryptfn) (EVP_PKEY_CTX *ctx,
+                                                 unsigned char *out,
+                                                 size_t *outlen,
+                                                 const unsigned char *in,
+                                                 size_t inlen));
+
+void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,
+                               int (*decrypt_init) (EVP_PKEY_CTX *ctx),
+                               int (*decrypt) (EVP_PKEY_CTX *ctx,
+                                               unsigned char *out,
+                                               size_t *outlen,
+                                               const unsigned char *in,
+                                               size_t inlen));
+
+void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,
+                              int (*derive_init) (EVP_PKEY_CTX *ctx),
+                              int (*derive) (EVP_PKEY_CTX *ctx,
+                                             unsigned char *key,
+                                             size_t *keylen));
+
+void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
+                            int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
+                                         void *p2),
+                            int (*ctrl_str) (EVP_PKEY_CTX *ctx,
+                                             const char *type,
+                                             const char *value));
+
+void EVP_add_alg_module(void);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_EVP_strings(void);
+
+/* Error codes for the EVP functions. */
+
+/* Function codes. */
+# define EVP_F_AESNI_INIT_KEY                             165
+# define EVP_F_AESNI_XTS_CIPHER                           176
+# define EVP_F_AES_INIT_KEY                               133
+# define EVP_F_AES_XTS                                    172
+# define EVP_F_AES_XTS_CIPHER                             175
+# define EVP_F_ALG_MODULE_INIT                            177
+# define EVP_F_CAMELLIA_INIT_KEY                          159
+# define EVP_F_CMAC_INIT                                  173
+# define EVP_F_D2I_PKEY                                   100
+# define EVP_F_DO_SIGVER_INIT                             161
+# define EVP_F_DSAPKEY2PKCS8                              134
+# define EVP_F_DSA_PKEY2PKCS8                             135
+# define EVP_F_ECDSA_PKEY2PKCS8                           129
+# define EVP_F_ECKEY_PKEY2PKCS8                           132
+# define EVP_F_EVP_CIPHERINIT_EX                          123
+# define EVP_F_EVP_CIPHER_CTX_COPY                        163
+# define EVP_F_EVP_CIPHER_CTX_CTRL                        124
+# define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH              122
+# define EVP_F_EVP_DECRYPTFINAL_EX                        101
+# define EVP_F_EVP_DIGESTINIT_EX                          128
+# define EVP_F_EVP_ENCRYPTFINAL_EX                        127
+# define EVP_F_EVP_MD_CTX_COPY_EX                         110
+# define EVP_F_EVP_MD_SIZE                                162
+# define EVP_F_EVP_OPENINIT                               102
+# define EVP_F_EVP_PBE_ALG_ADD                            115
+# define EVP_F_EVP_PBE_ALG_ADD_TYPE                       160
+# define EVP_F_EVP_PBE_CIPHERINIT                         116
+# define EVP_F_EVP_PKCS82PKEY                             111
+# define EVP_F_EVP_PKCS82PKEY_BROKEN                      136
+# define EVP_F_EVP_PKEY2PKCS8_BROKEN                      113
+# define EVP_F_EVP_PKEY_COPY_PARAMETERS                   103
+# define EVP_F_EVP_PKEY_CTX_CTRL                          137
+# define EVP_F_EVP_PKEY_CTX_CTRL_STR                      150
+# define EVP_F_EVP_PKEY_CTX_DUP                           156
+# define EVP_F_EVP_PKEY_DECRYPT                           104
+# define EVP_F_EVP_PKEY_DECRYPT_INIT                      138
+# define EVP_F_EVP_PKEY_DECRYPT_OLD                       151
+# define EVP_F_EVP_PKEY_DERIVE                            153
+# define EVP_F_EVP_PKEY_DERIVE_INIT                       154
+# define EVP_F_EVP_PKEY_DERIVE_SET_PEER                   155
+# define EVP_F_EVP_PKEY_ENCRYPT                           105
+# define EVP_F_EVP_PKEY_ENCRYPT_INIT                      139
+# define EVP_F_EVP_PKEY_ENCRYPT_OLD                       152
+# define EVP_F_EVP_PKEY_GET1_DH                           119
+# define EVP_F_EVP_PKEY_GET1_DSA                          120
+# define EVP_F_EVP_PKEY_GET1_ECDSA                        130
+# define EVP_F_EVP_PKEY_GET1_EC_KEY                       131
+# define EVP_F_EVP_PKEY_GET1_RSA                          121
+# define EVP_F_EVP_PKEY_KEYGEN                            146
+# define EVP_F_EVP_PKEY_KEYGEN_INIT                       147
+# define EVP_F_EVP_PKEY_NEW                               106
+# define EVP_F_EVP_PKEY_PARAMGEN                          148
+# define EVP_F_EVP_PKEY_PARAMGEN_INIT                     149
+# define EVP_F_EVP_PKEY_SIGN                              140
+# define EVP_F_EVP_PKEY_SIGN_INIT                         141
+# define EVP_F_EVP_PKEY_VERIFY                            142
+# define EVP_F_EVP_PKEY_VERIFY_INIT                       143
+# define EVP_F_EVP_PKEY_VERIFY_RECOVER                    144
+# define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT               145
+# define EVP_F_EVP_RIJNDAEL                               126
+# define EVP_F_EVP_SIGNFINAL                              107
+# define EVP_F_EVP_VERIFYFINAL                            108
+# define EVP_F_FIPS_CIPHERINIT                            166
+# define EVP_F_FIPS_CIPHER_CTX_COPY                       170
+# define EVP_F_FIPS_CIPHER_CTX_CTRL                       167
+# define EVP_F_FIPS_CIPHER_CTX_SET_KEY_LENGTH             171
+# define EVP_F_FIPS_DIGESTINIT                            168
+# define EVP_F_FIPS_MD_CTX_COPY                           169
+# define EVP_F_HMAC_INIT_EX                               174
+# define EVP_F_INT_CTX_NEW                                157
+# define EVP_F_PKCS5_PBE_KEYIVGEN                         117
+# define EVP_F_PKCS5_V2_PBE_KEYIVGEN                      118
+# define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN                   164
+# define EVP_F_PKCS8_SET_BROKEN                           112
+# define EVP_F_PKEY_SET_TYPE                              158
+# define EVP_F_RC2_MAGIC_TO_METH                          109
+# define EVP_F_RC5_CTRL                                   125
+
+/* Reason codes. */
+# define EVP_R_AES_IV_SETUP_FAILED                        162
+# define EVP_R_AES_KEY_SETUP_FAILED                       143
+# define EVP_R_ASN1_LIB                                   140
+# define EVP_R_BAD_BLOCK_LENGTH                           136
+# define EVP_R_BAD_DECRYPT                                100
+# define EVP_R_BAD_KEY_LENGTH                             137
+# define EVP_R_BN_DECODE_ERROR                            112
+# define EVP_R_BN_PUBKEY_ERROR                            113
+# define EVP_R_BUFFER_TOO_SMALL                           155
+# define EVP_R_CAMELLIA_KEY_SETUP_FAILED                  157
+# define EVP_R_CIPHER_PARAMETER_ERROR                     122
+# define EVP_R_COMMAND_NOT_SUPPORTED                      147
+# define EVP_R_CTRL_NOT_IMPLEMENTED                       132
+# define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED             133
+# define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH          138
+# define EVP_R_DECODE_ERROR                               114
+# define EVP_R_DIFFERENT_KEY_TYPES                        101
+# define EVP_R_DIFFERENT_PARAMETERS                       153
+# define EVP_R_DISABLED_FOR_FIPS                          163
+# define EVP_R_ENCODE_ERROR                               115
+# define EVP_R_ERROR_LOADING_SECTION                      165
+# define EVP_R_ERROR_SETTING_FIPS_MODE                    166
+# define EVP_R_EVP_PBE_CIPHERINIT_ERROR                   119
+# define EVP_R_EXPECTING_AN_RSA_KEY                       127
+# define EVP_R_EXPECTING_A_DH_KEY                         128
+# define EVP_R_EXPECTING_A_DSA_KEY                        129
+# define EVP_R_EXPECTING_A_ECDSA_KEY                      141
+# define EVP_R_EXPECTING_A_EC_KEY                         142
+# define EVP_R_FIPS_MODE_NOT_SUPPORTED                    167
+# define EVP_R_INITIALIZATION_ERROR                       134
+# define EVP_R_INPUT_NOT_INITIALIZED                      111
+# define EVP_R_INVALID_DIGEST                             152
+# define EVP_R_INVALID_FIPS_MODE                          168
+# define EVP_R_INVALID_KEY_LENGTH                         130
+# define EVP_R_INVALID_OPERATION                          148
+# define EVP_R_IV_TOO_LARGE                               102
+# define EVP_R_KEYGEN_FAILURE                             120
+# define EVP_R_MESSAGE_DIGEST_IS_NULL                     159
+# define EVP_R_METHOD_NOT_SUPPORTED                       144
+# define EVP_R_MISSING_PARAMETERS                         103
+# define EVP_R_NO_CIPHER_SET                              131
+# define EVP_R_NO_DEFAULT_DIGEST                          158
+# define EVP_R_NO_DIGEST_SET                              139
+# define EVP_R_NO_DSA_PARAMETERS                          116
+# define EVP_R_NO_KEY_SET                                 154
+# define EVP_R_NO_OPERATION_SET                           149
+# define EVP_R_NO_SIGN_FUNCTION_CONFIGURED                104
+# define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED              105
+# define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE   150
+# define EVP_R_OPERATON_NOT_INITIALIZED                   151
+# define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE                  117
+# define EVP_R_PRIVATE_KEY_DECODE_ERROR                   145
+# define EVP_R_PRIVATE_KEY_ENCODE_ERROR                   146
+# define EVP_R_PUBLIC_KEY_NOT_RSA                         106
+# define EVP_R_TOO_LARGE                                  164
+# define EVP_R_UNKNOWN_CIPHER                             160
+# define EVP_R_UNKNOWN_DIGEST                             161
+# define EVP_R_UNKNOWN_OPTION                             169
+# define EVP_R_UNKNOWN_PBE_ALGORITHM                      121
+# define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS                135
+# define EVP_R_UNSUPPORTED_ALGORITHM                      156
+# define EVP_R_UNSUPPORTED_CIPHER                         107
+# define EVP_R_UNSUPPORTED_KEYLENGTH                      123
+# define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION        124
+# define EVP_R_UNSUPPORTED_KEY_SIZE                       108
+# define EVP_R_UNSUPPORTED_PRF                            125
+# define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM          118
+# define EVP_R_UNSUPPORTED_SALT_TYPE                      126
+# define EVP_R_WRONG_FINAL_BLOCK_LENGTH                   109
+# define EVP_R_WRONG_PUBLIC_KEY_TYPE                      110
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/evp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/kssl.h
===================================================================
--- lab4/.minix-src/include/openssl/kssl.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/kssl.h	(revision 13)
@@ -0,0 +1,197 @@
+/* ssl/kssl.h -*- mode: C; c-file-style: "eay" -*- */
+/*
+ * Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project
+ * 2000. project 2000.
+ */
+/* ====================================================================
+ * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+/*
+ **      19990701        VRS     Started.
+ */
+
+#ifndef KSSL_H
+# define KSSL_H
+
+# include <openssl/opensslconf.h>
+
+# ifndef OPENSSL_NO_KRB5
+
+#  include <stdio.h>
+#  include <ctype.h>
+#  include <krb5.h>
+#  ifdef OPENSSL_SYS_WIN32
+/*
+ * These can sometimes get redefined indirectly by krb5 header files after
+ * they get undefed in ossl_typ.h
+ */
+#   undef X509_NAME
+#   undef X509_EXTENSIONS
+#   undef OCSP_REQUEST
+#   undef OCSP_RESPONSE
+#  endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*
+ *      Depending on which KRB5 implementation used, some types from
+ *      the other may be missing.  Resolve that here and now
+ */
+#  ifdef KRB5_HEIMDAL
+typedef unsigned char krb5_octet;
+#   define FAR
+#  else
+
+#   ifndef FAR
+#    define FAR
+#   endif
+
+#  endif
+
+/*-
+ *      Uncomment this to debug kssl problems or
+ *      to trace usage of the Kerberos session key
+ *
+ *      #define         KSSL_DEBUG
+ */
+
+#  ifndef KRB5SVC
+#   define KRB5SVC "host"
+#  endif
+
+#  ifndef KRB5KEYTAB
+#   define KRB5KEYTAB      "/etc/krb5.keytab"
+#  endif
+
+#  ifndef KRB5SENDAUTH
+#   define KRB5SENDAUTH    1
+#  endif
+
+#  ifndef KRB5CHECKAUTH
+#   define KRB5CHECKAUTH   1
+#  endif
+
+#  ifndef KSSL_CLOCKSKEW
+#   define KSSL_CLOCKSKEW  300;
+#  endif
+
+#  define KSSL_ERR_MAX    255
+typedef struct kssl_err_st {
+    int reason;
+    char text[KSSL_ERR_MAX + 1];
+} KSSL_ERR;
+
+/*-     Context for passing
+ *              (1) Kerberos session key to SSL, and
+ *              (2)     Config data between application and SSL lib
+ */
+typedef struct kssl_ctx_st {
+    /*      used by:    disposition:            */
+    char *service_name;         /* C,S default ok (kssl) */
+    char *service_host;         /* C input, REQUIRED */
+    char *client_princ;         /* S output from krb5 ticket */
+    char *keytab_file;          /* S NULL (/etc/krb5.keytab) */
+    char *cred_cache;           /* C NULL (default) */
+    krb5_enctype enctype;
+    int length;
+    krb5_octet FAR *key;
+} KSSL_CTX;
+
+#  define KSSL_CLIENT     1
+#  define KSSL_SERVER     2
+#  define KSSL_SERVICE    3
+#  define KSSL_KEYTAB     4
+
+#  define KSSL_CTX_OK     0
+#  define KSSL_CTX_ERR    1
+#  define KSSL_NOMEM      2
+
+/* Public (for use by applications that use OpenSSL with Kerberos 5 support */
+krb5_error_code kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text);
+KSSL_CTX *kssl_ctx_new(void);
+KSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx);
+void kssl_ctx_show(KSSL_CTX *kssl_ctx);
+krb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which,
+                                  krb5_data *realm, krb5_data *entity,
+                                  int nentities);
+krb5_error_code kssl_cget_tkt(KSSL_CTX *kssl_ctx, krb5_data **enc_tktp,
+                              krb5_data *authenp, KSSL_ERR *kssl_err);
+krb5_error_code kssl_sget_tkt(KSSL_CTX *kssl_ctx, krb5_data *indata,
+                              krb5_ticket_times *ttimes, KSSL_ERR *kssl_err);
+krb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session);
+void kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text);
+void kssl_krb5_free_data_contents(krb5_context context, krb5_data *data);
+krb5_error_code kssl_build_principal_2(krb5_context context,
+                                       krb5_principal *princ, int rlen,
+                                       const char *realm, int slen,
+                                       const char *svc, int hlen,
+                                       const char *host);
+krb5_error_code kssl_validate_times(krb5_timestamp atime,
+                                    krb5_ticket_times *ttimes);
+krb5_error_code kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp,
+                                   krb5_timestamp *atimep,
+                                   KSSL_ERR *kssl_err);
+unsigned char *kssl_skip_confound(krb5_enctype enctype, unsigned char *authn);
+
+void SSL_set0_kssl_ctx(SSL *s, KSSL_CTX *kctx);
+KSSL_CTX *SSL_get0_kssl_ctx(SSL *s);
+char *kssl_ctx_get0_client_princ(KSSL_CTX *kctx);
+
+#ifdef  __cplusplus
+}
+#endif
+# endif                         /* OPENSSL_NO_KRB5 */
+#endif                          /* KSSL_H */

Property changes on: lab4/.minix-src/include/openssl/kssl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/md5.h
===================================================================
--- lab4/.minix-src/include/openssl/md5.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/md5.h	(revision 13)
@@ -0,0 +1,124 @@
+/* crypto/md5/md5.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_MD5_H
+# define HEADER_MD5_H
+
+# include <openssl/e_os2.h>
+# include <stddef.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifdef OPENSSL_NO_MD5
+#  error MD5 is disabled.
+# endif
+
+/*
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then !
+ * ! MD5_LONG_LOG2 has to be defined along.                        !
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ */
+
+# ifndef __NetBSD__
+#  if defined(__LP32__)
+#   define MD5_LONG unsigned long
+#  elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
+#   define MD5_LONG unsigned long
+#   define MD5_LONG_LOG2 3
+/*
+ * _CRAY note. I could declare short, but I have no idea what impact
+ * does it have on performance on none-T3E machines. I could declare
+ * int, but at least on C90 sizeof(int) can be chosen at compile time.
+ * So I've chosen long...
+ *                                      <appro@fy.chalmers.se>
+ */
+#  else
+#   define MD5_LONG unsigned int
+#  endif
+# else
+#  include <sys/types.h>
+#  define MD5_LONG uint32_t
+# endif
+
+# define MD5_CBLOCK      64
+# define MD5_LBLOCK      (MD5_CBLOCK/4)
+# define MD5_DIGEST_LENGTH 16
+
+typedef struct MD5state_st {
+    MD5_LONG A, B, C, D;
+    MD5_LONG Nl, Nh;
+    MD5_LONG data[MD5_LBLOCK];
+    unsigned int num;
+} MD5_CTX;
+
+# ifdef OPENSSL_FIPS
+int private_MD5_Init(MD5_CTX *c);
+# endif
+int MD5_Init(MD5_CTX *c);
+int MD5_Update(MD5_CTX *c, const void *data, size_t len);
+int MD5_Final(unsigned char *md, MD5_CTX *c);
+unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md);
+void MD5_Transform(MD5_CTX *c, const unsigned char *b);
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/md5.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/objects.h
===================================================================
--- lab4/.minix-src/include/openssl/objects.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/objects.h	(revision 13)
@@ -0,0 +1,1143 @@
+/* crypto/objects/objects.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_OBJECTS_H
+# define HEADER_OBJECTS_H
+
+# define USE_OBJ_MAC
+
+# ifdef USE_OBJ_MAC
+#  include <openssl/obj_mac.h>
+# else
+#  define SN_undef                        "UNDEF"
+#  define LN_undef                        "undefined"
+#  define NID_undef                       0
+#  define OBJ_undef                       0L
+
+#  define SN_Algorithm                    "Algorithm"
+#  define LN_algorithm                    "algorithm"
+#  define NID_algorithm                   38
+#  define OBJ_algorithm                   1L,3L,14L,3L,2L
+
+#  define LN_rsadsi                       "rsadsi"
+#  define NID_rsadsi                      1
+#  define OBJ_rsadsi                      1L,2L,840L,113549L
+
+#  define LN_pkcs                         "pkcs"
+#  define NID_pkcs                        2
+#  define OBJ_pkcs                        OBJ_rsadsi,1L
+
+#  define SN_md2                          "MD2"
+#  define LN_md2                          "md2"
+#  define NID_md2                         3
+#  define OBJ_md2                         OBJ_rsadsi,2L,2L
+
+#  define SN_md5                          "MD5"
+#  define LN_md5                          "md5"
+#  define NID_md5                         4
+#  define OBJ_md5                         OBJ_rsadsi,2L,5L
+
+#  define SN_rc4                          "RC4"
+#  define LN_rc4                          "rc4"
+#  define NID_rc4                         5
+#  define OBJ_rc4                         OBJ_rsadsi,3L,4L
+
+#  define LN_rsaEncryption                "rsaEncryption"
+#  define NID_rsaEncryption               6
+#  define OBJ_rsaEncryption               OBJ_pkcs,1L,1L
+
+#  define SN_md2WithRSAEncryption         "RSA-MD2"
+#  define LN_md2WithRSAEncryption         "md2WithRSAEncryption"
+#  define NID_md2WithRSAEncryption        7
+#  define OBJ_md2WithRSAEncryption        OBJ_pkcs,1L,2L
+
+#  define SN_md5WithRSAEncryption         "RSA-MD5"
+#  define LN_md5WithRSAEncryption         "md5WithRSAEncryption"
+#  define NID_md5WithRSAEncryption        8
+#  define OBJ_md5WithRSAEncryption        OBJ_pkcs,1L,4L
+
+#  define SN_pbeWithMD2AndDES_CBC         "PBE-MD2-DES"
+#  define LN_pbeWithMD2AndDES_CBC         "pbeWithMD2AndDES-CBC"
+#  define NID_pbeWithMD2AndDES_CBC        9
+#  define OBJ_pbeWithMD2AndDES_CBC        OBJ_pkcs,5L,1L
+
+#  define SN_pbeWithMD5AndDES_CBC         "PBE-MD5-DES"
+#  define LN_pbeWithMD5AndDES_CBC         "pbeWithMD5AndDES-CBC"
+#  define NID_pbeWithMD5AndDES_CBC        10
+#  define OBJ_pbeWithMD5AndDES_CBC        OBJ_pkcs,5L,3L
+
+#  define LN_X500                         "X500"
+#  define NID_X500                        11
+#  define OBJ_X500                        2L,5L
+
+#  define LN_X509                         "X509"
+#  define NID_X509                        12
+#  define OBJ_X509                        OBJ_X500,4L
+
+#  define SN_commonName                   "CN"
+#  define LN_commonName                   "commonName"
+#  define NID_commonName                  13
+#  define OBJ_commonName                  OBJ_X509,3L
+
+#  define SN_countryName                  "C"
+#  define LN_countryName                  "countryName"
+#  define NID_countryName                 14
+#  define OBJ_countryName                 OBJ_X509,6L
+
+#  define SN_localityName                 "L"
+#  define LN_localityName                 "localityName"
+#  define NID_localityName                15
+#  define OBJ_localityName                OBJ_X509,7L
+
+/* Postal Address? PA */
+
+/* should be "ST" (rfc1327) but MS uses 'S' */
+#  define SN_stateOrProvinceName          "ST"
+#  define LN_stateOrProvinceName          "stateOrProvinceName"
+#  define NID_stateOrProvinceName         16
+#  define OBJ_stateOrProvinceName         OBJ_X509,8L
+
+#  define SN_organizationName             "O"
+#  define LN_organizationName             "organizationName"
+#  define NID_organizationName            17
+#  define OBJ_organizationName            OBJ_X509,10L
+
+#  define SN_organizationalUnitName       "OU"
+#  define LN_organizationalUnitName       "organizationalUnitName"
+#  define NID_organizationalUnitName      18
+#  define OBJ_organizationalUnitName      OBJ_X509,11L
+
+#  define SN_rsa                          "RSA"
+#  define LN_rsa                          "rsa"
+#  define NID_rsa                         19
+#  define OBJ_rsa                         OBJ_X500,8L,1L,1L
+
+#  define LN_pkcs7                        "pkcs7"
+#  define NID_pkcs7                       20
+#  define OBJ_pkcs7                       OBJ_pkcs,7L
+
+#  define LN_pkcs7_data                   "pkcs7-data"
+#  define NID_pkcs7_data                  21
+#  define OBJ_pkcs7_data                  OBJ_pkcs7,1L
+
+#  define LN_pkcs7_signed                 "pkcs7-signedData"
+#  define NID_pkcs7_signed                22
+#  define OBJ_pkcs7_signed                OBJ_pkcs7,2L
+
+#  define LN_pkcs7_enveloped              "pkcs7-envelopedData"
+#  define NID_pkcs7_enveloped             23
+#  define OBJ_pkcs7_enveloped             OBJ_pkcs7,3L
+
+#  define LN_pkcs7_signedAndEnveloped     "pkcs7-signedAndEnvelopedData"
+#  define NID_pkcs7_signedAndEnveloped    24
+#  define OBJ_pkcs7_signedAndEnveloped    OBJ_pkcs7,4L
+
+#  define LN_pkcs7_digest                 "pkcs7-digestData"
+#  define NID_pkcs7_digest                25
+#  define OBJ_pkcs7_digest                OBJ_pkcs7,5L
+
+#  define LN_pkcs7_encrypted              "pkcs7-encryptedData"
+#  define NID_pkcs7_encrypted             26
+#  define OBJ_pkcs7_encrypted             OBJ_pkcs7,6L
+
+#  define LN_pkcs3                        "pkcs3"
+#  define NID_pkcs3                       27
+#  define OBJ_pkcs3                       OBJ_pkcs,3L
+
+#  define LN_dhKeyAgreement               "dhKeyAgreement"
+#  define NID_dhKeyAgreement              28
+#  define OBJ_dhKeyAgreement              OBJ_pkcs3,1L
+
+#  define SN_des_ecb                      "DES-ECB"
+#  define LN_des_ecb                      "des-ecb"
+#  define NID_des_ecb                     29
+#  define OBJ_des_ecb                     OBJ_algorithm,6L
+
+#  define SN_des_cfb64                    "DES-CFB"
+#  define LN_des_cfb64                    "des-cfb"
+#  define NID_des_cfb64                   30
+/* IV + num */
+#  define OBJ_des_cfb64                   OBJ_algorithm,9L
+
+#  define SN_des_cbc                      "DES-CBC"
+#  define LN_des_cbc                      "des-cbc"
+#  define NID_des_cbc                     31
+/* IV */
+#  define OBJ_des_cbc                     OBJ_algorithm,7L
+
+#  define SN_des_ede                      "DES-EDE"
+#  define LN_des_ede                      "des-ede"
+#  define NID_des_ede                     32
+/* ?? */
+#  define OBJ_des_ede                     OBJ_algorithm,17L
+
+#  define SN_des_ede3                     "DES-EDE3"
+#  define LN_des_ede3                     "des-ede3"
+#  define NID_des_ede3                    33
+
+#  define SN_idea_cbc                     "IDEA-CBC"
+#  define LN_idea_cbc                     "idea-cbc"
+#  define NID_idea_cbc                    34
+#  define OBJ_idea_cbc                    1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L
+
+#  define SN_idea_cfb64                   "IDEA-CFB"
+#  define LN_idea_cfb64                   "idea-cfb"
+#  define NID_idea_cfb64                  35
+
+#  define SN_idea_ecb                     "IDEA-ECB"
+#  define LN_idea_ecb                     "idea-ecb"
+#  define NID_idea_ecb                    36
+
+#  define SN_rc2_cbc                      "RC2-CBC"
+#  define LN_rc2_cbc                      "rc2-cbc"
+#  define NID_rc2_cbc                     37
+#  define OBJ_rc2_cbc                     OBJ_rsadsi,3L,2L
+
+#  define SN_rc2_ecb                      "RC2-ECB"
+#  define LN_rc2_ecb                      "rc2-ecb"
+#  define NID_rc2_ecb                     38
+
+#  define SN_rc2_cfb64                    "RC2-CFB"
+#  define LN_rc2_cfb64                    "rc2-cfb"
+#  define NID_rc2_cfb64                   39
+
+#  define SN_rc2_ofb64                    "RC2-OFB"
+#  define LN_rc2_ofb64                    "rc2-ofb"
+#  define NID_rc2_ofb64                   40
+
+#  define SN_sha                          "SHA"
+#  define LN_sha                          "sha"
+#  define NID_sha                         41
+#  define OBJ_sha                         OBJ_algorithm,18L
+
+#  define SN_shaWithRSAEncryption         "RSA-SHA"
+#  define LN_shaWithRSAEncryption         "shaWithRSAEncryption"
+#  define NID_shaWithRSAEncryption        42
+#  define OBJ_shaWithRSAEncryption        OBJ_algorithm,15L
+
+#  define SN_des_ede_cbc                  "DES-EDE-CBC"
+#  define LN_des_ede_cbc                  "des-ede-cbc"
+#  define NID_des_ede_cbc                 43
+
+#  define SN_des_ede3_cbc                 "DES-EDE3-CBC"
+#  define LN_des_ede3_cbc                 "des-ede3-cbc"
+#  define NID_des_ede3_cbc                44
+#  define OBJ_des_ede3_cbc                OBJ_rsadsi,3L,7L
+
+#  define SN_des_ofb64                    "DES-OFB"
+#  define LN_des_ofb64                    "des-ofb"
+#  define NID_des_ofb64                   45
+#  define OBJ_des_ofb64                   OBJ_algorithm,8L
+
+#  define SN_idea_ofb64                   "IDEA-OFB"
+#  define LN_idea_ofb64                   "idea-ofb"
+#  define NID_idea_ofb64                  46
+
+#  define LN_pkcs9                        "pkcs9"
+#  define NID_pkcs9                       47
+#  define OBJ_pkcs9                       OBJ_pkcs,9L
+
+#  define SN_pkcs9_emailAddress           "Email"
+#  define LN_pkcs9_emailAddress           "emailAddress"
+#  define NID_pkcs9_emailAddress          48
+#  define OBJ_pkcs9_emailAddress          OBJ_pkcs9,1L
+
+#  define LN_pkcs9_unstructuredName       "unstructuredName"
+#  define NID_pkcs9_unstructuredName      49
+#  define OBJ_pkcs9_unstructuredName      OBJ_pkcs9,2L
+
+#  define LN_pkcs9_contentType            "contentType"
+#  define NID_pkcs9_contentType           50
+#  define OBJ_pkcs9_contentType           OBJ_pkcs9,3L
+
+#  define LN_pkcs9_messageDigest          "messageDigest"
+#  define NID_pkcs9_messageDigest         51
+#  define OBJ_pkcs9_messageDigest         OBJ_pkcs9,4L
+
+#  define LN_pkcs9_signingTime            "signingTime"
+#  define NID_pkcs9_signingTime           52
+#  define OBJ_pkcs9_signingTime           OBJ_pkcs9,5L
+
+#  define LN_pkcs9_countersignature       "countersignature"
+#  define NID_pkcs9_countersignature      53
+#  define OBJ_pkcs9_countersignature      OBJ_pkcs9,6L
+
+#  define LN_pkcs9_challengePassword      "challengePassword"
+#  define NID_pkcs9_challengePassword     54
+#  define OBJ_pkcs9_challengePassword     OBJ_pkcs9,7L
+
+#  define LN_pkcs9_unstructuredAddress    "unstructuredAddress"
+#  define NID_pkcs9_unstructuredAddress   55
+#  define OBJ_pkcs9_unstructuredAddress   OBJ_pkcs9,8L
+
+#  define LN_pkcs9_extCertAttributes      "extendedCertificateAttributes"
+#  define NID_pkcs9_extCertAttributes     56
+#  define OBJ_pkcs9_extCertAttributes     OBJ_pkcs9,9L
+
+#  define SN_netscape                     "Netscape"
+#  define LN_netscape                     "Netscape Communications Corp."
+#  define NID_netscape                    57
+#  define OBJ_netscape                    2L,16L,840L,1L,113730L
+
+#  define SN_netscape_cert_extension      "nsCertExt"
+#  define LN_netscape_cert_extension      "Netscape Certificate Extension"
+#  define NID_netscape_cert_extension     58
+#  define OBJ_netscape_cert_extension     OBJ_netscape,1L
+
+#  define SN_netscape_data_type           "nsDataType"
+#  define LN_netscape_data_type           "Netscape Data Type"
+#  define NID_netscape_data_type          59
+#  define OBJ_netscape_data_type          OBJ_netscape,2L
+
+#  define SN_des_ede_cfb64                "DES-EDE-CFB"
+#  define LN_des_ede_cfb64                "des-ede-cfb"
+#  define NID_des_ede_cfb64               60
+
+#  define SN_des_ede3_cfb64               "DES-EDE3-CFB"
+#  define LN_des_ede3_cfb64               "des-ede3-cfb"
+#  define NID_des_ede3_cfb64              61
+
+#  define SN_des_ede_ofb64                "DES-EDE-OFB"
+#  define LN_des_ede_ofb64                "des-ede-ofb"
+#  define NID_des_ede_ofb64               62
+
+#  define SN_des_ede3_ofb64               "DES-EDE3-OFB"
+#  define LN_des_ede3_ofb64               "des-ede3-ofb"
+#  define NID_des_ede3_ofb64              63
+
+/* I'm not sure about the object ID */
+#  define SN_sha1                         "SHA1"
+#  define LN_sha1                         "sha1"
+#  define NID_sha1                        64
+#  define OBJ_sha1                        OBJ_algorithm,26L
+/* 28 Jun 1996 - eay */
+/* #define OBJ_sha1                     1L,3L,14L,2L,26L,05L <- wrong */
+
+#  define SN_sha1WithRSAEncryption        "RSA-SHA1"
+#  define LN_sha1WithRSAEncryption        "sha1WithRSAEncryption"
+#  define NID_sha1WithRSAEncryption       65
+#  define OBJ_sha1WithRSAEncryption       OBJ_pkcs,1L,5L
+
+#  define SN_dsaWithSHA                   "DSA-SHA"
+#  define LN_dsaWithSHA                   "dsaWithSHA"
+#  define NID_dsaWithSHA                  66
+#  define OBJ_dsaWithSHA                  OBJ_algorithm,13L
+
+#  define SN_dsa_2                        "DSA-old"
+#  define LN_dsa_2                        "dsaEncryption-old"
+#  define NID_dsa_2                       67
+#  define OBJ_dsa_2                       OBJ_algorithm,12L
+
+/* proposed by microsoft to RSA */
+#  define SN_pbeWithSHA1AndRC2_CBC        "PBE-SHA1-RC2-64"
+#  define LN_pbeWithSHA1AndRC2_CBC        "pbeWithSHA1AndRC2-CBC"
+#  define NID_pbeWithSHA1AndRC2_CBC       68
+#  define OBJ_pbeWithSHA1AndRC2_CBC       OBJ_pkcs,5L,11L
+
+/*
+ * proposed by microsoft to RSA as pbeWithSHA1AndRC4: it is now defined
+ * explicitly in PKCS#5 v2.0 as id-PBKDF2 which is something completely
+ * different.
+ */
+#  define LN_id_pbkdf2                    "PBKDF2"
+#  define NID_id_pbkdf2                   69
+#  define OBJ_id_pbkdf2                   OBJ_pkcs,5L,12L
+
+#  define SN_dsaWithSHA1_2                "DSA-SHA1-old"
+#  define LN_dsaWithSHA1_2                "dsaWithSHA1-old"
+#  define NID_dsaWithSHA1_2               70
+/* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */
+#  define OBJ_dsaWithSHA1_2               OBJ_algorithm,27L
+
+#  define SN_netscape_cert_type           "nsCertType"
+#  define LN_netscape_cert_type           "Netscape Cert Type"
+#  define NID_netscape_cert_type          71
+#  define OBJ_netscape_cert_type          OBJ_netscape_cert_extension,1L
+
+#  define SN_netscape_base_url            "nsBaseUrl"
+#  define LN_netscape_base_url            "Netscape Base Url"
+#  define NID_netscape_base_url           72
+#  define OBJ_netscape_base_url           OBJ_netscape_cert_extension,2L
+
+#  define SN_netscape_revocation_url      "nsRevocationUrl"
+#  define LN_netscape_revocation_url      "Netscape Revocation Url"
+#  define NID_netscape_revocation_url     73
+#  define OBJ_netscape_revocation_url     OBJ_netscape_cert_extension,3L
+
+#  define SN_netscape_ca_revocation_url   "nsCaRevocationUrl"
+#  define LN_netscape_ca_revocation_url   "Netscape CA Revocation Url"
+#  define NID_netscape_ca_revocation_url  74
+#  define OBJ_netscape_ca_revocation_url  OBJ_netscape_cert_extension,4L
+
+#  define SN_netscape_renewal_url         "nsRenewalUrl"
+#  define LN_netscape_renewal_url         "Netscape Renewal Url"
+#  define NID_netscape_renewal_url        75
+#  define OBJ_netscape_renewal_url        OBJ_netscape_cert_extension,7L
+
+#  define SN_netscape_ca_policy_url       "nsCaPolicyUrl"
+#  define LN_netscape_ca_policy_url       "Netscape CA Policy Url"
+#  define NID_netscape_ca_policy_url      76
+#  define OBJ_netscape_ca_policy_url      OBJ_netscape_cert_extension,8L
+
+#  define SN_netscape_ssl_server_name     "nsSslServerName"
+#  define LN_netscape_ssl_server_name     "Netscape SSL Server Name"
+#  define NID_netscape_ssl_server_name    77
+#  define OBJ_netscape_ssl_server_name    OBJ_netscape_cert_extension,12L
+
+#  define SN_netscape_comment             "nsComment"
+#  define LN_netscape_comment             "Netscape Comment"
+#  define NID_netscape_comment            78
+#  define OBJ_netscape_comment            OBJ_netscape_cert_extension,13L
+
+#  define SN_netscape_cert_sequence       "nsCertSequence"
+#  define LN_netscape_cert_sequence       "Netscape Certificate Sequence"
+#  define NID_netscape_cert_sequence      79
+#  define OBJ_netscape_cert_sequence      OBJ_netscape_data_type,5L
+
+#  define SN_desx_cbc                     "DESX-CBC"
+#  define LN_desx_cbc                     "desx-cbc"
+#  define NID_desx_cbc                    80
+
+#  define SN_id_ce                        "id-ce"
+#  define NID_id_ce                       81
+#  define OBJ_id_ce                       2L,5L,29L
+
+#  define SN_subject_key_identifier       "subjectKeyIdentifier"
+#  define LN_subject_key_identifier       "X509v3 Subject Key Identifier"
+#  define NID_subject_key_identifier      82
+#  define OBJ_subject_key_identifier      OBJ_id_ce,14L
+
+#  define SN_key_usage                    "keyUsage"
+#  define LN_key_usage                    "X509v3 Key Usage"
+#  define NID_key_usage                   83
+#  define OBJ_key_usage                   OBJ_id_ce,15L
+
+#  define SN_private_key_usage_period     "privateKeyUsagePeriod"
+#  define LN_private_key_usage_period     "X509v3 Private Key Usage Period"
+#  define NID_private_key_usage_period    84
+#  define OBJ_private_key_usage_period    OBJ_id_ce,16L
+
+#  define SN_subject_alt_name             "subjectAltName"
+#  define LN_subject_alt_name             "X509v3 Subject Alternative Name"
+#  define NID_subject_alt_name            85
+#  define OBJ_subject_alt_name            OBJ_id_ce,17L
+
+#  define SN_issuer_alt_name              "issuerAltName"
+#  define LN_issuer_alt_name              "X509v3 Issuer Alternative Name"
+#  define NID_issuer_alt_name             86
+#  define OBJ_issuer_alt_name             OBJ_id_ce,18L
+
+#  define SN_basic_constraints            "basicConstraints"
+#  define LN_basic_constraints            "X509v3 Basic Constraints"
+#  define NID_basic_constraints           87
+#  define OBJ_basic_constraints           OBJ_id_ce,19L
+
+#  define SN_crl_number                   "crlNumber"
+#  define LN_crl_number                   "X509v3 CRL Number"
+#  define NID_crl_number                  88
+#  define OBJ_crl_number                  OBJ_id_ce,20L
+
+#  define SN_certificate_policies         "certificatePolicies"
+#  define LN_certificate_policies         "X509v3 Certificate Policies"
+#  define NID_certificate_policies        89
+#  define OBJ_certificate_policies        OBJ_id_ce,32L
+
+#  define SN_authority_key_identifier     "authorityKeyIdentifier"
+#  define LN_authority_key_identifier     "X509v3 Authority Key Identifier"
+#  define NID_authority_key_identifier    90
+#  define OBJ_authority_key_identifier    OBJ_id_ce,35L
+
+#  define SN_bf_cbc                       "BF-CBC"
+#  define LN_bf_cbc                       "bf-cbc"
+#  define NID_bf_cbc                      91
+#  define OBJ_bf_cbc                      1L,3L,6L,1L,4L,1L,3029L,1L,2L
+
+#  define SN_bf_ecb                       "BF-ECB"
+#  define LN_bf_ecb                       "bf-ecb"
+#  define NID_bf_ecb                      92
+
+#  define SN_bf_cfb64                     "BF-CFB"
+#  define LN_bf_cfb64                     "bf-cfb"
+#  define NID_bf_cfb64                    93
+
+#  define SN_bf_ofb64                     "BF-OFB"
+#  define LN_bf_ofb64                     "bf-ofb"
+#  define NID_bf_ofb64                    94
+
+#  define SN_mdc2                         "MDC2"
+#  define LN_mdc2                         "mdc2"
+#  define NID_mdc2                        95
+#  define OBJ_mdc2                        2L,5L,8L,3L,101L
+/* An alternative?                      1L,3L,14L,3L,2L,19L */
+
+#  define SN_mdc2WithRSA                  "RSA-MDC2"
+#  define LN_mdc2WithRSA                  "mdc2withRSA"
+#  define NID_mdc2WithRSA                 96
+#  define OBJ_mdc2WithRSA                 2L,5L,8L,3L,100L
+
+#  define SN_rc4_40                       "RC4-40"
+#  define LN_rc4_40                       "rc4-40"
+#  define NID_rc4_40                      97
+
+#  define SN_rc2_40_cbc                   "RC2-40-CBC"
+#  define LN_rc2_40_cbc                   "rc2-40-cbc"
+#  define NID_rc2_40_cbc                  98
+
+#  define SN_givenName                    "G"
+#  define LN_givenName                    "givenName"
+#  define NID_givenName                   99
+#  define OBJ_givenName                   OBJ_X509,42L
+
+#  define SN_surname                      "S"
+#  define LN_surname                      "surname"
+#  define NID_surname                     100
+#  define OBJ_surname                     OBJ_X509,4L
+
+#  define SN_initials                     "I"
+#  define LN_initials                     "initials"
+#  define NID_initials                    101
+#  define OBJ_initials                    OBJ_X509,43L
+
+#  define SN_uniqueIdentifier             "UID"
+#  define LN_uniqueIdentifier             "uniqueIdentifier"
+#  define NID_uniqueIdentifier            102
+#  define OBJ_uniqueIdentifier            OBJ_X509,45L
+
+#  define SN_crl_distribution_points      "crlDistributionPoints"
+#  define LN_crl_distribution_points      "X509v3 CRL Distribution Points"
+#  define NID_crl_distribution_points     103
+#  define OBJ_crl_distribution_points     OBJ_id_ce,31L
+
+#  define SN_md5WithRSA                   "RSA-NP-MD5"
+#  define LN_md5WithRSA                   "md5WithRSA"
+#  define NID_md5WithRSA                  104
+#  define OBJ_md5WithRSA                  OBJ_algorithm,3L
+
+#  define SN_serialNumber                 "SN"
+#  define LN_serialNumber                 "serialNumber"
+#  define NID_serialNumber                105
+#  define OBJ_serialNumber                OBJ_X509,5L
+
+#  define SN_title                        "T"
+#  define LN_title                        "title"
+#  define NID_title                       106
+#  define OBJ_title                       OBJ_X509,12L
+
+#  define SN_description                  "D"
+#  define LN_description                  "description"
+#  define NID_description                 107
+#  define OBJ_description                 OBJ_X509,13L
+
+/* CAST5 is CAST-128, I'm just sticking with the documentation */
+#  define SN_cast5_cbc                    "CAST5-CBC"
+#  define LN_cast5_cbc                    "cast5-cbc"
+#  define NID_cast5_cbc                   108
+#  define OBJ_cast5_cbc                   1L,2L,840L,113533L,7L,66L,10L
+
+#  define SN_cast5_ecb                    "CAST5-ECB"
+#  define LN_cast5_ecb                    "cast5-ecb"
+#  define NID_cast5_ecb                   109
+
+#  define SN_cast5_cfb64                  "CAST5-CFB"
+#  define LN_cast5_cfb64                  "cast5-cfb"
+#  define NID_cast5_cfb64                 110
+
+#  define SN_cast5_ofb64                  "CAST5-OFB"
+#  define LN_cast5_ofb64                  "cast5-ofb"
+#  define NID_cast5_ofb64                 111
+
+#  define LN_pbeWithMD5AndCast5_CBC       "pbeWithMD5AndCast5CBC"
+#  define NID_pbeWithMD5AndCast5_CBC      112
+#  define OBJ_pbeWithMD5AndCast5_CBC      1L,2L,840L,113533L,7L,66L,12L
+
+/*-
+ * This is one sun will soon be using :-(
+ * id-dsa-with-sha1 ID  ::= {
+ *   iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 }
+ */
+#  define SN_dsaWithSHA1                  "DSA-SHA1"
+#  define LN_dsaWithSHA1                  "dsaWithSHA1"
+#  define NID_dsaWithSHA1                 113
+#  define OBJ_dsaWithSHA1                 1L,2L,840L,10040L,4L,3L
+
+#  define NID_md5_sha1                    114
+#  define SN_md5_sha1                     "MD5-SHA1"
+#  define LN_md5_sha1                     "md5-sha1"
+
+#  define SN_sha1WithRSA                  "RSA-SHA1-2"
+#  define LN_sha1WithRSA                  "sha1WithRSA"
+#  define NID_sha1WithRSA                 115
+#  define OBJ_sha1WithRSA                 OBJ_algorithm,29L
+
+#  define SN_dsa                          "DSA"
+#  define LN_dsa                          "dsaEncryption"
+#  define NID_dsa                         116
+#  define OBJ_dsa                         1L,2L,840L,10040L,4L,1L
+
+#  define SN_ripemd160                    "RIPEMD160"
+#  define LN_ripemd160                    "ripemd160"
+#  define NID_ripemd160                   117
+#  define OBJ_ripemd160                   1L,3L,36L,3L,2L,1L
+
+/*
+ * The name should actually be rsaSignatureWithripemd160, but I'm going to
+ * continue using the convention I'm using with the other ciphers
+ */
+#  define SN_ripemd160WithRSA             "RSA-RIPEMD160"
+#  define LN_ripemd160WithRSA             "ripemd160WithRSA"
+#  define NID_ripemd160WithRSA            119
+#  define OBJ_ripemd160WithRSA            1L,3L,36L,3L,3L,1L,2L
+
+/*-
+ * Taken from rfc2040
+ *  RC5_CBC_Parameters ::= SEQUENCE {
+ *      version           INTEGER (v1_0(16)),
+ *      rounds            INTEGER (8..127),
+ *      blockSizeInBits   INTEGER (64, 128),
+ *      iv                OCTET STRING OPTIONAL
+ *      }
+ */
+#  define SN_rc5_cbc                      "RC5-CBC"
+#  define LN_rc5_cbc                      "rc5-cbc"
+#  define NID_rc5_cbc                     120
+#  define OBJ_rc5_cbc                     OBJ_rsadsi,3L,8L
+
+#  define SN_rc5_ecb                      "RC5-ECB"
+#  define LN_rc5_ecb                      "rc5-ecb"
+#  define NID_rc5_ecb                     121
+
+#  define SN_rc5_cfb64                    "RC5-CFB"
+#  define LN_rc5_cfb64                    "rc5-cfb"
+#  define NID_rc5_cfb64                   122
+
+#  define SN_rc5_ofb64                    "RC5-OFB"
+#  define LN_rc5_ofb64                    "rc5-ofb"
+#  define NID_rc5_ofb64                   123
+
+#  define SN_rle_compression              "RLE"
+#  define LN_rle_compression              "run length compression"
+#  define NID_rle_compression             124
+#  define OBJ_rle_compression             1L,1L,1L,1L,666L,1L
+
+#  define SN_zlib_compression             "ZLIB"
+#  define LN_zlib_compression             "zlib compression"
+#  define NID_zlib_compression            125
+#  define OBJ_zlib_compression            1L,1L,1L,1L,666L,2L
+
+#  define SN_ext_key_usage                "extendedKeyUsage"
+#  define LN_ext_key_usage                "X509v3 Extended Key Usage"
+#  define NID_ext_key_usage               126
+#  define OBJ_ext_key_usage               OBJ_id_ce,37
+
+#  define SN_id_pkix                      "PKIX"
+#  define NID_id_pkix                     127
+#  define OBJ_id_pkix                     1L,3L,6L,1L,5L,5L,7L
+
+#  define SN_id_kp                        "id-kp"
+#  define NID_id_kp                       128
+#  define OBJ_id_kp                       OBJ_id_pkix,3L
+
+/* PKIX extended key usage OIDs */
+
+#  define SN_server_auth                  "serverAuth"
+#  define LN_server_auth                  "TLS Web Server Authentication"
+#  define NID_server_auth                 129
+#  define OBJ_server_auth                 OBJ_id_kp,1L
+
+#  define SN_client_auth                  "clientAuth"
+#  define LN_client_auth                  "TLS Web Client Authentication"
+#  define NID_client_auth                 130
+#  define OBJ_client_auth                 OBJ_id_kp,2L
+
+#  define SN_code_sign                    "codeSigning"
+#  define LN_code_sign                    "Code Signing"
+#  define NID_code_sign                   131
+#  define OBJ_code_sign                   OBJ_id_kp,3L
+
+#  define SN_email_protect                "emailProtection"
+#  define LN_email_protect                "E-mail Protection"
+#  define NID_email_protect               132
+#  define OBJ_email_protect               OBJ_id_kp,4L
+
+#  define SN_time_stamp                   "timeStamping"
+#  define LN_time_stamp                   "Time Stamping"
+#  define NID_time_stamp                  133
+#  define OBJ_time_stamp                  OBJ_id_kp,8L
+
+/* Additional extended key usage OIDs: Microsoft */
+
+#  define SN_ms_code_ind                  "msCodeInd"
+#  define LN_ms_code_ind                  "Microsoft Individual Code Signing"
+#  define NID_ms_code_ind                 134
+#  define OBJ_ms_code_ind                 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L
+
+#  define SN_ms_code_com                  "msCodeCom"
+#  define LN_ms_code_com                  "Microsoft Commercial Code Signing"
+#  define NID_ms_code_com                 135
+#  define OBJ_ms_code_com                 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L
+
+#  define SN_ms_ctl_sign                  "msCTLSign"
+#  define LN_ms_ctl_sign                  "Microsoft Trust List Signing"
+#  define NID_ms_ctl_sign                 136
+#  define OBJ_ms_ctl_sign                 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L
+
+#  define SN_ms_sgc                       "msSGC"
+#  define LN_ms_sgc                       "Microsoft Server Gated Crypto"
+#  define NID_ms_sgc                      137
+#  define OBJ_ms_sgc                      1L,3L,6L,1L,4L,1L,311L,10L,3L,3L
+
+#  define SN_ms_efs                       "msEFS"
+#  define LN_ms_efs                       "Microsoft Encrypted File System"
+#  define NID_ms_efs                      138
+#  define OBJ_ms_efs                      1L,3L,6L,1L,4L,1L,311L,10L,3L,4L
+
+/* Additional usage: Netscape */
+
+#  define SN_ns_sgc                       "nsSGC"
+#  define LN_ns_sgc                       "Netscape Server Gated Crypto"
+#  define NID_ns_sgc                      139
+#  define OBJ_ns_sgc                      OBJ_netscape,4L,1L
+
+#  define SN_delta_crl                    "deltaCRL"
+#  define LN_delta_crl                    "X509v3 Delta CRL Indicator"
+#  define NID_delta_crl                   140
+#  define OBJ_delta_crl                   OBJ_id_ce,27L
+
+#  define SN_crl_reason                   "CRLReason"
+#  define LN_crl_reason                   "CRL Reason Code"
+#  define NID_crl_reason                  141
+#  define OBJ_crl_reason                  OBJ_id_ce,21L
+
+#  define SN_invalidity_date              "invalidityDate"
+#  define LN_invalidity_date              "Invalidity Date"
+#  define NID_invalidity_date             142
+#  define OBJ_invalidity_date             OBJ_id_ce,24L
+
+#  define SN_sxnet                        "SXNetID"
+#  define LN_sxnet                        "Strong Extranet ID"
+#  define NID_sxnet                       143
+#  define OBJ_sxnet                       1L,3L,101L,1L,4L,1L
+
+/* PKCS12 and related OBJECT IDENTIFIERS */
+
+#  define OBJ_pkcs12                      OBJ_pkcs,12L
+#  define OBJ_pkcs12_pbeids               OBJ_pkcs12, 1
+
+#  define SN_pbe_WithSHA1And128BitRC4     "PBE-SHA1-RC4-128"
+#  define LN_pbe_WithSHA1And128BitRC4     "pbeWithSHA1And128BitRC4"
+#  define NID_pbe_WithSHA1And128BitRC4    144
+#  define OBJ_pbe_WithSHA1And128BitRC4    OBJ_pkcs12_pbeids, 1L
+
+#  define SN_pbe_WithSHA1And40BitRC4      "PBE-SHA1-RC4-40"
+#  define LN_pbe_WithSHA1And40BitRC4      "pbeWithSHA1And40BitRC4"
+#  define NID_pbe_WithSHA1And40BitRC4     145
+#  define OBJ_pbe_WithSHA1And40BitRC4     OBJ_pkcs12_pbeids, 2L
+
+#  define SN_pbe_WithSHA1And3_Key_TripleDES_CBC   "PBE-SHA1-3DES"
+#  define LN_pbe_WithSHA1And3_Key_TripleDES_CBC   "pbeWithSHA1And3-KeyTripleDES-CBC"
+#  define NID_pbe_WithSHA1And3_Key_TripleDES_CBC  146
+#  define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC  OBJ_pkcs12_pbeids, 3L
+
+#  define SN_pbe_WithSHA1And2_Key_TripleDES_CBC   "PBE-SHA1-2DES"
+#  define LN_pbe_WithSHA1And2_Key_TripleDES_CBC   "pbeWithSHA1And2-KeyTripleDES-CBC"
+#  define NID_pbe_WithSHA1And2_Key_TripleDES_CBC  147
+#  define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC  OBJ_pkcs12_pbeids, 4L
+
+#  define SN_pbe_WithSHA1And128BitRC2_CBC         "PBE-SHA1-RC2-128"
+#  define LN_pbe_WithSHA1And128BitRC2_CBC         "pbeWithSHA1And128BitRC2-CBC"
+#  define NID_pbe_WithSHA1And128BitRC2_CBC        148
+#  define OBJ_pbe_WithSHA1And128BitRC2_CBC        OBJ_pkcs12_pbeids, 5L
+
+#  define SN_pbe_WithSHA1And40BitRC2_CBC  "PBE-SHA1-RC2-40"
+#  define LN_pbe_WithSHA1And40BitRC2_CBC  "pbeWithSHA1And40BitRC2-CBC"
+#  define NID_pbe_WithSHA1And40BitRC2_CBC 149
+#  define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L
+
+#  define OBJ_pkcs12_Version1     OBJ_pkcs12, 10L
+
+#  define OBJ_pkcs12_BagIds       OBJ_pkcs12_Version1, 1L
+
+#  define LN_keyBag               "keyBag"
+#  define NID_keyBag              150
+#  define OBJ_keyBag              OBJ_pkcs12_BagIds, 1L
+
+#  define LN_pkcs8ShroudedKeyBag  "pkcs8ShroudedKeyBag"
+#  define NID_pkcs8ShroudedKeyBag 151
+#  define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds, 2L
+
+#  define LN_certBag              "certBag"
+#  define NID_certBag             152
+#  define OBJ_certBag             OBJ_pkcs12_BagIds, 3L
+
+#  define LN_crlBag               "crlBag"
+#  define NID_crlBag              153
+#  define OBJ_crlBag              OBJ_pkcs12_BagIds, 4L
+
+#  define LN_secretBag            "secretBag"
+#  define NID_secretBag           154
+#  define OBJ_secretBag           OBJ_pkcs12_BagIds, 5L
+
+#  define LN_safeContentsBag      "safeContentsBag"
+#  define NID_safeContentsBag     155
+#  define OBJ_safeContentsBag     OBJ_pkcs12_BagIds, 6L
+
+#  define LN_friendlyName         "friendlyName"
+#  define NID_friendlyName        156
+#  define OBJ_friendlyName        OBJ_pkcs9, 20L
+
+#  define LN_localKeyID           "localKeyID"
+#  define NID_localKeyID          157
+#  define OBJ_localKeyID          OBJ_pkcs9, 21L
+
+#  define OBJ_certTypes           OBJ_pkcs9, 22L
+
+#  define LN_x509Certificate      "x509Certificate"
+#  define NID_x509Certificate     158
+#  define OBJ_x509Certificate     OBJ_certTypes, 1L
+
+#  define LN_sdsiCertificate      "sdsiCertificate"
+#  define NID_sdsiCertificate     159
+#  define OBJ_sdsiCertificate     OBJ_certTypes, 2L
+
+#  define OBJ_crlTypes            OBJ_pkcs9, 23L
+
+#  define LN_x509Crl              "x509Crl"
+#  define NID_x509Crl             160
+#  define OBJ_x509Crl             OBJ_crlTypes, 1L
+
+/* PKCS#5 v2 OIDs */
+
+#  define LN_pbes2                "PBES2"
+#  define NID_pbes2               161
+#  define OBJ_pbes2               OBJ_pkcs,5L,13L
+
+#  define LN_pbmac1               "PBMAC1"
+#  define NID_pbmac1              162
+#  define OBJ_pbmac1              OBJ_pkcs,5L,14L
+
+#  define LN_hmacWithSHA1         "hmacWithSHA1"
+#  define NID_hmacWithSHA1        163
+#  define OBJ_hmacWithSHA1        OBJ_rsadsi,2L,7L
+
+/* Policy Qualifier Ids */
+
+#  define LN_id_qt_cps            "Policy Qualifier CPS"
+#  define SN_id_qt_cps            "id-qt-cps"
+#  define NID_id_qt_cps           164
+#  define OBJ_id_qt_cps           OBJ_id_pkix,2L,1L
+
+#  define LN_id_qt_unotice        "Policy Qualifier User Notice"
+#  define SN_id_qt_unotice        "id-qt-unotice"
+#  define NID_id_qt_unotice       165
+#  define OBJ_id_qt_unotice       OBJ_id_pkix,2L,2L
+
+#  define SN_rc2_64_cbc                   "RC2-64-CBC"
+#  define LN_rc2_64_cbc                   "rc2-64-cbc"
+#  define NID_rc2_64_cbc                  166
+
+#  define SN_SMIMECapabilities            "SMIME-CAPS"
+#  define LN_SMIMECapabilities            "S/MIME Capabilities"
+#  define NID_SMIMECapabilities           167
+#  define OBJ_SMIMECapabilities           OBJ_pkcs9,15L
+
+#  define SN_pbeWithMD2AndRC2_CBC         "PBE-MD2-RC2-64"
+#  define LN_pbeWithMD2AndRC2_CBC         "pbeWithMD2AndRC2-CBC"
+#  define NID_pbeWithMD2AndRC2_CBC        168
+#  define OBJ_pbeWithMD2AndRC2_CBC        OBJ_pkcs,5L,4L
+
+#  define SN_pbeWithMD5AndRC2_CBC         "PBE-MD5-RC2-64"
+#  define LN_pbeWithMD5AndRC2_CBC         "pbeWithMD5AndRC2-CBC"
+#  define NID_pbeWithMD5AndRC2_CBC        169
+#  define OBJ_pbeWithMD5AndRC2_CBC        OBJ_pkcs,5L,6L
+
+#  define SN_pbeWithSHA1AndDES_CBC        "PBE-SHA1-DES"
+#  define LN_pbeWithSHA1AndDES_CBC        "pbeWithSHA1AndDES-CBC"
+#  define NID_pbeWithSHA1AndDES_CBC       170
+#  define OBJ_pbeWithSHA1AndDES_CBC       OBJ_pkcs,5L,10L
+
+/* Extension request OIDs */
+
+#  define LN_ms_ext_req                   "Microsoft Extension Request"
+#  define SN_ms_ext_req                   "msExtReq"
+#  define NID_ms_ext_req                  171
+#  define OBJ_ms_ext_req                  1L,3L,6L,1L,4L,1L,311L,2L,1L,14L
+
+#  define LN_ext_req                      "Extension Request"
+#  define SN_ext_req                      "extReq"
+#  define NID_ext_req                     172
+#  define OBJ_ext_req                     OBJ_pkcs9,14L
+
+#  define SN_name                         "name"
+#  define LN_name                         "name"
+#  define NID_name                        173
+#  define OBJ_name                        OBJ_X509,41L
+
+#  define SN_dnQualifier                  "dnQualifier"
+#  define LN_dnQualifier                  "dnQualifier"
+#  define NID_dnQualifier                 174
+#  define OBJ_dnQualifier                 OBJ_X509,46L
+
+#  define SN_id_pe                        "id-pe"
+#  define NID_id_pe                       175
+#  define OBJ_id_pe                       OBJ_id_pkix,1L
+
+#  define SN_id_ad                        "id-ad"
+#  define NID_id_ad                       176
+#  define OBJ_id_ad                       OBJ_id_pkix,48L
+
+#  define SN_info_access                  "authorityInfoAccess"
+#  define LN_info_access                  "Authority Information Access"
+#  define NID_info_access                 177
+#  define OBJ_info_access                 OBJ_id_pe,1L
+
+#  define SN_ad_OCSP                      "OCSP"
+#  define LN_ad_OCSP                      "OCSP"
+#  define NID_ad_OCSP                     178
+#  define OBJ_ad_OCSP                     OBJ_id_ad,1L
+
+#  define SN_ad_ca_issuers                "caIssuers"
+#  define LN_ad_ca_issuers                "CA Issuers"
+#  define NID_ad_ca_issuers               179
+#  define OBJ_ad_ca_issuers               OBJ_id_ad,2L
+
+#  define SN_OCSP_sign                    "OCSPSigning"
+#  define LN_OCSP_sign                    "OCSP Signing"
+#  define NID_OCSP_sign                   180
+#  define OBJ_OCSP_sign                   OBJ_id_kp,9L
+# endif                         /* USE_OBJ_MAC */
+
+# include <openssl/bio.h>
+# include <openssl/asn1.h>
+
+# define OBJ_NAME_TYPE_UNDEF             0x00
+# define OBJ_NAME_TYPE_MD_METH           0x01
+# define OBJ_NAME_TYPE_CIPHER_METH       0x02
+# define OBJ_NAME_TYPE_PKEY_METH         0x03
+# define OBJ_NAME_TYPE_COMP_METH         0x04
+# define OBJ_NAME_TYPE_NUM               0x05
+
+# define OBJ_NAME_ALIAS                  0x8000
+
+# define OBJ_BSEARCH_VALUE_ON_NOMATCH            0x01
+# define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH        0x02
+
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct obj_name_st {
+    int type;
+    int alias;
+    const char *name;
+    const char *data;
+} OBJ_NAME;
+
+# define         OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c)
+
+int OBJ_NAME_init(void);
+int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
+                       int (*cmp_func) (const char *, const char *),
+                       void (*free_func) (const char *, int, const char *));
+const char *OBJ_NAME_get(const char *name, int type);
+int OBJ_NAME_add(const char *name, int type, const char *data);
+int OBJ_NAME_remove(const char *name, int type);
+void OBJ_NAME_cleanup(int type); /* -1 for everything */
+void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg),
+                     void *arg);
+void OBJ_NAME_do_all_sorted(int type,
+                            void (*fn) (const OBJ_NAME *, void *arg),
+                            void *arg);
+
+ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o);
+ASN1_OBJECT *OBJ_nid2obj(int n);
+const char *OBJ_nid2ln(int n);
+const char *OBJ_nid2sn(int n);
+int OBJ_obj2nid(const ASN1_OBJECT *o);
+ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name);
+int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);
+int OBJ_txt2nid(const char *s);
+int OBJ_ln2nid(const char *s);
+int OBJ_sn2nid(const char *s);
+int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b);
+const void *OBJ_bsearch_(const void *key, const void *base, int num, int size,
+                         int (*cmp) (const void *, const void *));
+const void *OBJ_bsearch_ex_(const void *key, const void *base, int num,
+                            int size,
+                            int (*cmp) (const void *, const void *),
+                            int flags);
+
+# define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm)    \
+  static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \
+  static int nm##_cmp(type1 const *, type2 const *); \
+  scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)
+
+# define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp)   \
+  _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp)
+# define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm)     \
+  type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)
+
+/*-
+ * Unsolved problem: if a type is actually a pointer type, like
+ * nid_triple is, then its impossible to get a const where you need
+ * it. Consider:
+ *
+ * typedef int nid_triple[3];
+ * const void *a_;
+ * const nid_triple const *a = a_;
+ *
+ * The assignement discards a const because what you really want is:
+ *
+ * const int const * const *a = a_;
+ *
+ * But if you do that, you lose the fact that a is an array of 3 ints,
+ * which breaks comparison functions.
+ *
+ * Thus we end up having to cast, sadly, or unpack the
+ * declarations. Or, as I finally did in this case, delcare nid_triple
+ * to be a struct, which it should have been in the first place.
+ *
+ * Ben, August 2008.
+ *
+ * Also, strictly speaking not all types need be const, but handling
+ * the non-constness means a lot of complication, and in practice
+ * comparison routines do always not touch their arguments.
+ */
+
+# define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm)  \
+  static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)    \
+      { \
+      type1 const *a = a_; \
+      type2 const *b = b_; \
+      return nm##_cmp(a,b); \
+      } \
+  static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \
+      { \
+      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
+                                        nm##_cmp_BSEARCH_CMP_FN); \
+      } \
+      extern void dummy_prototype(void)
+
+# define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm)   \
+  static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)    \
+      { \
+      type1 const *a = a_; \
+      type2 const *b = b_; \
+      return nm##_cmp(a,b); \
+      } \
+  type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \
+      { \
+      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
+                                        nm##_cmp_BSEARCH_CMP_FN); \
+      } \
+      extern void dummy_prototype(void)
+
+# define OBJ_bsearch(type1,key,type2,base,num,cmp)                              \
+  ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \
+                         num,sizeof(type2),                             \
+                         ((void)CHECKED_PTR_OF(type1,cmp##_type_1),     \
+                          (void)CHECKED_PTR_OF(type2,cmp##_type_2),     \
+                          cmp##_BSEARCH_CMP_FN)))
+
+# define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags)                      \
+  ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \
+                         num,sizeof(type2),                             \
+                         ((void)CHECKED_PTR_OF(type1,cmp##_type_1),     \
+                          (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \
+                          cmp##_BSEARCH_CMP_FN)),flags)
+
+int OBJ_new_nid(int num);
+int OBJ_add_object(const ASN1_OBJECT *obj);
+int OBJ_create(const char *oid, const char *sn, const char *ln);
+void OBJ_cleanup(void);
+int OBJ_create_objects(BIO *in);
+
+int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid);
+int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid);
+int OBJ_add_sigid(int signid, int dig_id, int pkey_id);
+void OBJ_sigid_free(void);
+
+extern int obj_cleanup_defer;
+void check_defer(int nid);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_OBJ_strings(void);
+
+/* Error codes for the OBJ functions. */
+
+/* Function codes. */
+# define OBJ_F_OBJ_ADD_OBJECT                             105
+# define OBJ_F_OBJ_CREATE                                 100
+# define OBJ_F_OBJ_DUP                                    101
+# define OBJ_F_OBJ_NAME_NEW_INDEX                         106
+# define OBJ_F_OBJ_NID2LN                                 102
+# define OBJ_F_OBJ_NID2OBJ                                103
+# define OBJ_F_OBJ_NID2SN                                 104
+
+/* Reason codes. */
+# define OBJ_R_MALLOC_FAILURE                             100
+# define OBJ_R_UNKNOWN_NID                                101
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/objects.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ossl_typ.h
===================================================================
--- lab4/.minix-src/include/openssl/ossl_typ.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ossl_typ.h	(revision 13)
@@ -0,0 +1,209 @@
+/* ====================================================================
+ * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_OPENSSL_TYPES_H
+# define HEADER_OPENSSL_TYPES_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# include <openssl/e_os2.h>
+
+# ifdef NO_ASN1_TYPEDEFS
+#  define ASN1_INTEGER            ASN1_STRING
+#  define ASN1_ENUMERATED         ASN1_STRING
+#  define ASN1_BIT_STRING         ASN1_STRING
+#  define ASN1_OCTET_STRING       ASN1_STRING
+#  define ASN1_PRINTABLESTRING    ASN1_STRING
+#  define ASN1_T61STRING          ASN1_STRING
+#  define ASN1_IA5STRING          ASN1_STRING
+#  define ASN1_UTCTIME            ASN1_STRING
+#  define ASN1_GENERALIZEDTIME    ASN1_STRING
+#  define ASN1_TIME               ASN1_STRING
+#  define ASN1_GENERALSTRING      ASN1_STRING
+#  define ASN1_UNIVERSALSTRING    ASN1_STRING
+#  define ASN1_BMPSTRING          ASN1_STRING
+#  define ASN1_VISIBLESTRING      ASN1_STRING
+#  define ASN1_UTF8STRING         ASN1_STRING
+#  define ASN1_BOOLEAN            int
+#  define ASN1_NULL               int
+# else
+typedef struct asn1_string_st ASN1_INTEGER;
+typedef struct asn1_string_st ASN1_ENUMERATED;
+typedef struct asn1_string_st ASN1_BIT_STRING;
+typedef struct asn1_string_st ASN1_OCTET_STRING;
+typedef struct asn1_string_st ASN1_PRINTABLESTRING;
+typedef struct asn1_string_st ASN1_T61STRING;
+typedef struct asn1_string_st ASN1_IA5STRING;
+typedef struct asn1_string_st ASN1_GENERALSTRING;
+typedef struct asn1_string_st ASN1_UNIVERSALSTRING;
+typedef struct asn1_string_st ASN1_BMPSTRING;
+typedef struct asn1_string_st ASN1_UTCTIME;
+typedef struct asn1_string_st ASN1_TIME;
+typedef struct asn1_string_st ASN1_GENERALIZEDTIME;
+typedef struct asn1_string_st ASN1_VISIBLESTRING;
+typedef struct asn1_string_st ASN1_UTF8STRING;
+typedef struct asn1_string_st ASN1_STRING;
+typedef int ASN1_BOOLEAN;
+typedef int ASN1_NULL;
+# endif
+
+typedef struct ASN1_ITEM_st ASN1_ITEM;
+typedef struct asn1_pctx_st ASN1_PCTX;
+
+# ifdef OPENSSL_SYS_WIN32
+#  undef X509_NAME
+#  undef X509_EXTENSIONS
+#  undef X509_CERT_PAIR
+#  undef PKCS7_ISSUER_AND_SERIAL
+#  undef OCSP_REQUEST
+#  undef OCSP_RESPONSE
+# endif
+
+# ifdef BIGNUM
+#  undef BIGNUM
+# endif
+typedef struct bignum_st BIGNUM;
+typedef struct bignum_ctx BN_CTX;
+typedef struct bn_blinding_st BN_BLINDING;
+typedef struct bn_mont_ctx_st BN_MONT_CTX;
+typedef struct bn_recp_ctx_st BN_RECP_CTX;
+typedef struct bn_gencb_st BN_GENCB;
+
+typedef struct buf_mem_st BUF_MEM;
+
+typedef struct evp_cipher_st EVP_CIPHER;
+typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
+typedef struct env_md_st EVP_MD;
+typedef struct env_md_ctx_st EVP_MD_CTX;
+typedef struct evp_pkey_st EVP_PKEY;
+
+typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD;
+
+typedef struct evp_pkey_method_st EVP_PKEY_METHOD;
+typedef struct evp_pkey_ctx_st EVP_PKEY_CTX;
+
+typedef struct dh_st DH;
+typedef struct dh_method DH_METHOD;
+
+typedef struct dsa_st DSA;
+typedef struct dsa_method DSA_METHOD;
+
+typedef struct rsa_st RSA;
+typedef struct rsa_meth_st RSA_METHOD;
+
+typedef struct rand_meth_st RAND_METHOD;
+
+typedef struct ecdh_method ECDH_METHOD;
+typedef struct ecdsa_method ECDSA_METHOD;
+
+typedef struct x509_st X509;
+typedef struct X509_algor_st X509_ALGOR;
+typedef struct X509_crl_st X509_CRL;
+typedef struct x509_crl_method_st X509_CRL_METHOD;
+typedef struct x509_revoked_st X509_REVOKED;
+typedef struct X509_name_st X509_NAME;
+typedef struct X509_pubkey_st X509_PUBKEY;
+typedef struct x509_store_st X509_STORE;
+typedef struct x509_store_ctx_st X509_STORE_CTX;
+
+typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO;
+
+typedef struct v3_ext_ctx X509V3_CTX;
+typedef struct conf_st CONF;
+
+typedef struct store_st STORE;
+typedef struct store_method_st STORE_METHOD;
+
+typedef struct ui_st UI;
+typedef struct ui_method_st UI_METHOD;
+
+typedef struct st_ERR_FNS ERR_FNS;
+
+typedef struct engine_st ENGINE;
+typedef struct ssl_st SSL;
+typedef struct ssl_ctx_st SSL_CTX;
+
+typedef struct X509_POLICY_NODE_st X509_POLICY_NODE;
+typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL;
+typedef struct X509_POLICY_TREE_st X509_POLICY_TREE;
+typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE;
+
+typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID;
+typedef struct DIST_POINT_st DIST_POINT;
+typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT;
+typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS;
+
+  /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */
+# define DECLARE_PKCS12_STACK_OF(type)/* Nothing */
+# define IMPLEMENT_PKCS12_STACK_OF(type)/* Nothing */
+
+typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
+/* Callback types for crypto.h */
+typedef int CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
+                           int idx, long argl, void *argp);
+typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
+                             int idx, long argl, void *argp);
+typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from,
+                           void *from_d, int idx, long argl, void *argp);
+
+typedef struct ocsp_req_ctx_st OCSP_REQ_CTX;
+typedef struct ocsp_response_st OCSP_RESPONSE;
+typedef struct ocsp_responder_id_st OCSP_RESPID;
+
+#ifdef  __cplusplus
+}
+#endif
+#endif                          /* def HEADER_OPENSSL_TYPES_H */

Property changes on: lab4/.minix-src/include/openssl/ossl_typ.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/pkcs7.h
===================================================================
--- lab4/.minix-src/include/openssl/pkcs7.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/pkcs7.h	(revision 13)
@@ -0,0 +1,481 @@
+/* crypto/pkcs7/pkcs7.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_PKCS7_H
+# define HEADER_PKCS7_H
+
+# include <openssl/asn1.h>
+# include <openssl/bio.h>
+# include <openssl/e_os2.h>
+
+# include <openssl/symhacks.h>
+# include <openssl/ossl_typ.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifdef OPENSSL_SYS_WIN32
+/* Under Win32 thes are defined in wincrypt.h */
+#  undef PKCS7_ISSUER_AND_SERIAL
+#  undef PKCS7_SIGNER_INFO
+# endif
+
+/*-
+Encryption_ID           DES-CBC
+Digest_ID               MD5
+Digest_Encryption_ID    rsaEncryption
+Key_Encryption_ID       rsaEncryption
+*/
+
+typedef struct pkcs7_issuer_and_serial_st {
+    X509_NAME *issuer;
+    ASN1_INTEGER *serial;
+} PKCS7_ISSUER_AND_SERIAL;
+
+typedef struct pkcs7_signer_info_st {
+    ASN1_INTEGER *version;      /* version 1 */
+    PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
+    X509_ALGOR *digest_alg;
+    STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */
+    X509_ALGOR *digest_enc_alg;
+    ASN1_OCTET_STRING *enc_digest;
+    STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */
+    /* The private key to sign with */
+    EVP_PKEY *pkey;
+} PKCS7_SIGNER_INFO;
+
+DECLARE_STACK_OF(PKCS7_SIGNER_INFO)
+DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO)
+
+typedef struct pkcs7_recip_info_st {
+    ASN1_INTEGER *version;      /* version 0 */
+    PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
+    X509_ALGOR *key_enc_algor;
+    ASN1_OCTET_STRING *enc_key;
+    X509 *cert;                 /* get the pub-key from this */
+} PKCS7_RECIP_INFO;
+
+DECLARE_STACK_OF(PKCS7_RECIP_INFO)
+DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO)
+
+typedef struct pkcs7_signed_st {
+    ASN1_INTEGER *version;      /* version 1 */
+    STACK_OF(X509_ALGOR) *md_algs; /* md used */
+    STACK_OF(X509) *cert;       /* [ 0 ] */
+    STACK_OF(X509_CRL) *crl;    /* [ 1 ] */
+    STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
+    struct pkcs7_st *contents;
+} PKCS7_SIGNED;
+/*
+ * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about
+ * merging the two
+ */
+
+typedef struct pkcs7_enc_content_st {
+    ASN1_OBJECT *content_type;
+    X509_ALGOR *algorithm;
+    ASN1_OCTET_STRING *enc_data; /* [ 0 ] */
+    const EVP_CIPHER *cipher;
+} PKCS7_ENC_CONTENT;
+
+typedef struct pkcs7_enveloped_st {
+    ASN1_INTEGER *version;      /* version 0 */
+    STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
+    PKCS7_ENC_CONTENT *enc_data;
+} PKCS7_ENVELOPE;
+
+typedef struct pkcs7_signedandenveloped_st {
+    ASN1_INTEGER *version;      /* version 1 */
+    STACK_OF(X509_ALGOR) *md_algs; /* md used */
+    STACK_OF(X509) *cert;       /* [ 0 ] */
+    STACK_OF(X509_CRL) *crl;    /* [ 1 ] */
+    STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
+    PKCS7_ENC_CONTENT *enc_data;
+    STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
+} PKCS7_SIGN_ENVELOPE;
+
+typedef struct pkcs7_digest_st {
+    ASN1_INTEGER *version;      /* version 0 */
+    X509_ALGOR *md;             /* md used */
+    struct pkcs7_st *contents;
+    ASN1_OCTET_STRING *digest;
+} PKCS7_DIGEST;
+
+typedef struct pkcs7_encrypted_st {
+    ASN1_INTEGER *version;      /* version 0 */
+    PKCS7_ENC_CONTENT *enc_data;
+} PKCS7_ENCRYPT;
+
+typedef struct pkcs7_st {
+    /*
+     * The following is non NULL if it contains ASN1 encoding of this
+     * structure
+     */
+    unsigned char *asn1;
+    long length;
+# define PKCS7_S_HEADER  0
+# define PKCS7_S_BODY    1
+# define PKCS7_S_TAIL    2
+    int state;                  /* used during processing */
+    int detached;
+    ASN1_OBJECT *type;
+    /* content as defined by the type */
+    /*
+     * all encryption/message digests are applied to the 'contents', leaving
+     * out the 'type' field.
+     */
+    union {
+        char *ptr;
+        /* NID_pkcs7_data */
+        ASN1_OCTET_STRING *data;
+        /* NID_pkcs7_signed */
+        PKCS7_SIGNED *sign;
+        /* NID_pkcs7_enveloped */
+        PKCS7_ENVELOPE *enveloped;
+        /* NID_pkcs7_signedAndEnveloped */
+        PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
+        /* NID_pkcs7_digest */
+        PKCS7_DIGEST *digest;
+        /* NID_pkcs7_encrypted */
+        PKCS7_ENCRYPT *encrypted;
+        /* Anything else */
+        ASN1_TYPE *other;
+    } d;
+} PKCS7;
+
+DECLARE_STACK_OF(PKCS7)
+DECLARE_ASN1_SET_OF(PKCS7)
+DECLARE_PKCS12_STACK_OF(PKCS7)
+
+# define PKCS7_OP_SET_DETACHED_SIGNATURE 1
+# define PKCS7_OP_GET_DETACHED_SIGNATURE 2
+
+# define PKCS7_get_signed_attributes(si) ((si)->auth_attr)
+# define PKCS7_get_attributes(si)        ((si)->unauth_attr)
+
+# define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed)
+# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
+# define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped)
+# define PKCS7_type_is_signedAndEnveloped(a) \
+                (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)
+# define PKCS7_type_is_data(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_data)
+# define PKCS7_type_is_digest(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)
+
+# define PKCS7_set_detached(p,v) \
+                PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)
+# define PKCS7_get_detached(p) \
+                PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)
+
+# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))
+
+/* S/MIME related flags */
+
+# define PKCS7_TEXT              0x1
+# define PKCS7_NOCERTS           0x2
+# define PKCS7_NOSIGS            0x4
+# define PKCS7_NOCHAIN           0x8
+# define PKCS7_NOINTERN          0x10
+# define PKCS7_NOVERIFY          0x20
+# define PKCS7_DETACHED          0x40
+# define PKCS7_BINARY            0x80
+# define PKCS7_NOATTR            0x100
+# define PKCS7_NOSMIMECAP        0x200
+# define PKCS7_NOOLDMIMETYPE     0x400
+# define PKCS7_CRLFEOL           0x800
+# define PKCS7_STREAM            0x1000
+# define PKCS7_NOCRL             0x2000
+# define PKCS7_PARTIAL           0x4000
+# define PKCS7_REUSE_DIGEST      0x8000
+
+/* Flags: for compatibility with older code */
+
+# define SMIME_TEXT      PKCS7_TEXT
+# define SMIME_NOCERTS   PKCS7_NOCERTS
+# define SMIME_NOSIGS    PKCS7_NOSIGS
+# define SMIME_NOCHAIN   PKCS7_NOCHAIN
+# define SMIME_NOINTERN  PKCS7_NOINTERN
+# define SMIME_NOVERIFY  PKCS7_NOVERIFY
+# define SMIME_DETACHED  PKCS7_DETACHED
+# define SMIME_BINARY    PKCS7_BINARY
+# define SMIME_NOATTR    PKCS7_NOATTR
+
+DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL)
+
+int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,
+                                   const EVP_MD *type, unsigned char *md,
+                                   unsigned int *len);
+# ifndef OPENSSL_NO_FP_API
+PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7);
+int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7);
+# endif
+PKCS7 *PKCS7_dup(PKCS7 *p7);
+PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7);
+int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7);
+int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);
+int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);
+
+DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO)
+DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO)
+DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED)
+DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT)
+DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE)
+DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE)
+DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST)
+DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT)
+DECLARE_ASN1_FUNCTIONS(PKCS7)
+
+DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN)
+DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY)
+
+DECLARE_ASN1_NDEF_FUNCTION(PKCS7)
+DECLARE_ASN1_PRINT_FUNCTION(PKCS7)
+
+long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);
+
+int PKCS7_set_type(PKCS7 *p7, int type);
+int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other);
+int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);
+int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
+                          const EVP_MD *dgst);
+int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si);
+int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);
+int PKCS7_add_certificate(PKCS7 *p7, X509 *x509);
+int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509);
+int PKCS7_content_new(PKCS7 *p7, int nid);
+int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx,
+                     BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si);
+int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si,
+                          X509 *x509);
+
+BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio);
+int PKCS7_dataFinal(PKCS7 *p7, BIO *bio);
+BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);
+
+PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,
+                                       EVP_PKEY *pkey, const EVP_MD *dgst);
+X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
+int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md);
+STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);
+
+PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);
+void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk,
+                                 X509_ALGOR **pdig, X509_ALGOR **psig);
+void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc);
+int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri);
+int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509);
+int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher);
+int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7);
+
+PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);
+ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk);
+int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type,
+                               void *data);
+int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
+                        void *value);
+ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid);
+ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid);
+int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si,
+                                STACK_OF(X509_ATTRIBUTE) *sk);
+int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,
+                         STACK_OF(X509_ATTRIBUTE) *sk);
+
+PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
+                  BIO *data, int flags);
+
+PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7,
+                                         X509 *signcert, EVP_PKEY *pkey,
+                                         const EVP_MD *md, int flags);
+
+int PKCS7_final(PKCS7 *p7, BIO *data, int flags);
+int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
+                 BIO *indata, BIO *out, int flags);
+STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs,
+                                   int flags);
+PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,
+                     int flags);
+int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data,
+                  int flags);
+
+int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si,
+                              STACK_OF(X509_ALGOR) *cap);
+STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si);
+int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg);
+
+int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid);
+int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t);
+int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si,
+                             const unsigned char *md, int mdlen);
+
+int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);
+PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);
+
+BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_PKCS7_strings(void);
+
+/* Error codes for the PKCS7 functions. */
+
+/* Function codes. */
+# define PKCS7_F_B64_READ_PKCS7                           120
+# define PKCS7_F_B64_WRITE_PKCS7                          121
+# define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB                   136
+# define PKCS7_F_I2D_PKCS7_BIO_STREAM                     140
+# define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME           135
+# define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP                118
+# define PKCS7_F_PKCS7_ADD_CERTIFICATE                    100
+# define PKCS7_F_PKCS7_ADD_CRL                            101
+# define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO                 102
+# define PKCS7_F_PKCS7_ADD_SIGNATURE                      131
+# define PKCS7_F_PKCS7_ADD_SIGNER                         103
+# define PKCS7_F_PKCS7_BIO_ADD_DIGEST                     125
+# define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST               138
+# define PKCS7_F_PKCS7_CTRL                               104
+# define PKCS7_F_PKCS7_DATADECODE                         112
+# define PKCS7_F_PKCS7_DATAFINAL                          128
+# define PKCS7_F_PKCS7_DATAINIT                           105
+# define PKCS7_F_PKCS7_DATASIGN                           106
+# define PKCS7_F_PKCS7_DATAVERIFY                         107
+# define PKCS7_F_PKCS7_DECRYPT                            114
+# define PKCS7_F_PKCS7_DECRYPT_RINFO                      133
+# define PKCS7_F_PKCS7_ENCODE_RINFO                       132
+# define PKCS7_F_PKCS7_ENCRYPT                            115
+# define PKCS7_F_PKCS7_FINAL                              134
+# define PKCS7_F_PKCS7_FIND_DIGEST                        127
+# define PKCS7_F_PKCS7_GET0_SIGNERS                       124
+# define PKCS7_F_PKCS7_RECIP_INFO_SET                     130
+# define PKCS7_F_PKCS7_SET_CIPHER                         108
+# define PKCS7_F_PKCS7_SET_CONTENT                        109
+# define PKCS7_F_PKCS7_SET_DIGEST                         126
+# define PKCS7_F_PKCS7_SET_TYPE                           110
+# define PKCS7_F_PKCS7_SIGN                               116
+# define PKCS7_F_PKCS7_SIGNATUREVERIFY                    113
+# define PKCS7_F_PKCS7_SIGNER_INFO_SET                    129
+# define PKCS7_F_PKCS7_SIGNER_INFO_SIGN                   139
+# define PKCS7_F_PKCS7_SIGN_ADD_SIGNER                    137
+# define PKCS7_F_PKCS7_SIMPLE_SMIMECAP                    119
+# define PKCS7_F_PKCS7_VERIFY                             117
+# define PKCS7_F_SMIME_READ_PKCS7                         122
+# define PKCS7_F_SMIME_TEXT                               123
+
+/* Reason codes. */
+# define PKCS7_R_CERTIFICATE_VERIFY_ERROR                 117
+# define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER          144
+# define PKCS7_R_CIPHER_NOT_INITIALIZED                   116
+# define PKCS7_R_CONTENT_AND_DATA_PRESENT                 118
+# define PKCS7_R_CTRL_ERROR                               152
+# define PKCS7_R_DECODE_ERROR                             130
+# define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH            100
+# define PKCS7_R_DECRYPT_ERROR                            119
+# define PKCS7_R_DIGEST_FAILURE                           101
+# define PKCS7_R_ENCRYPTION_CTRL_FAILURE                  149
+# define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150
+# define PKCS7_R_ERROR_ADDING_RECIPIENT                   120
+# define PKCS7_R_ERROR_SETTING_CIPHER                     121
+# define PKCS7_R_INVALID_MIME_TYPE                        131
+# define PKCS7_R_INVALID_NULL_POINTER                     143
+# define PKCS7_R_INVALID_SIGNED_DATA_TYPE                 155
+# define PKCS7_R_MIME_NO_CONTENT_TYPE                     132
+# define PKCS7_R_MIME_PARSE_ERROR                         133
+# define PKCS7_R_MIME_SIG_PARSE_ERROR                     134
+# define PKCS7_R_MISSING_CERIPEND_INFO                    103
+# define PKCS7_R_NO_CONTENT                               122
+# define PKCS7_R_NO_CONTENT_TYPE                          135
+# define PKCS7_R_NO_DEFAULT_DIGEST                        151
+# define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND            154
+# define PKCS7_R_NO_MULTIPART_BODY_FAILURE                136
+# define PKCS7_R_NO_MULTIPART_BOUNDARY                    137
+# define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE         115
+# define PKCS7_R_NO_RECIPIENT_MATCHES_KEY                 146
+# define PKCS7_R_NO_SIGNATURES_ON_DATA                    123
+# define PKCS7_R_NO_SIGNERS                               142
+# define PKCS7_R_NO_SIG_CONTENT_TYPE                      138
+# define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE     104
+# define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR                124
+# define PKCS7_R_PKCS7_ADD_SIGNER_ERROR                   153
+# define PKCS7_R_PKCS7_DATAFINAL                          126
+# define PKCS7_R_PKCS7_DATAFINAL_ERROR                    125
+# define PKCS7_R_PKCS7_DATASIGN                           145
+# define PKCS7_R_PKCS7_PARSE_ERROR                        139
+# define PKCS7_R_PKCS7_SIG_PARSE_ERROR                    140
+# define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE   127
+# define PKCS7_R_SIGNATURE_FAILURE                        105
+# define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND             128
+# define PKCS7_R_SIGNING_CTRL_FAILURE                     147
+# define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE  148
+# define PKCS7_R_SIG_INVALID_MIME_TYPE                    141
+# define PKCS7_R_SMIME_TEXT_ERROR                         129
+# define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE               106
+# define PKCS7_R_UNABLE_TO_FIND_MEM_BIO                   107
+# define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST            108
+# define PKCS7_R_UNKNOWN_DIGEST_TYPE                      109
+# define PKCS7_R_UNKNOWN_OPERATION                        110
+# define PKCS7_R_UNSUPPORTED_CIPHER_TYPE                  111
+# define PKCS7_R_UNSUPPORTED_CONTENT_TYPE                 112
+# define PKCS7_R_WRONG_CONTENT_TYPE                       113
+# define PKCS7_R_WRONG_PKCS7_TYPE                         114
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/pkcs7.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/rc4.h
===================================================================
--- lab4/.minix-src/include/openssl/rc4.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/rc4.h	(revision 13)
@@ -0,0 +1,89 @@
+/* crypto/rc4/rc4.h */
+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_RC4_H
+# define HEADER_RC4_H
+
+# include <openssl/opensslconf.h>/* OPENSSL_NO_RC4, RC4_INT */
+# ifdef OPENSSL_NO_RC4
+#  error RC4 is disabled.
+# endif
+
+# include <stddef.h>
+# include <sys/types.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct rc4_key_st {
+    RC4_INT x, y;
+    RC4_INT data[256];
+} RC4_KEY;
+
+const char *RC4_options(void);
+void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
+void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
+void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
+         unsigned char *outdata);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/rc4.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/safestack.h
===================================================================
--- lab4/.minix-src/include/openssl/safestack.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/safestack.h	(revision 13)
@@ -0,0 +1,2536 @@
+/* ====================================================================
+ * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_SAFESTACK_H
+# define HEADER_SAFESTACK_H
+
+# include <openssl/stack.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+# ifndef CHECKED_PTR_OF
+#  define CHECKED_PTR_OF(type, p) \
+    ((void*) (1 ? p : (type*)0))
+# endif
+
+/*
+ * In C++ we get problems because an explicit cast is needed from (void *) we
+ * use CHECKED_STACK_OF to ensure the correct type is passed in the macros
+ * below.
+ */
+
+# define CHECKED_STACK_OF(type, p) \
+    ((_STACK*) (1 ? p : (STACK_OF(type)*)0))
+
+# define CHECKED_SK_FREE_FUNC(type, p) \
+    ((void (*)(void *)) ((1 ? p : (void (*)(type *))0)))
+
+# define CHECKED_SK_FREE_FUNC2(type, p) \
+    ((void (*)(void *)) ((1 ? p : (void (*)(type))0)))
+
+# define CHECKED_SK_CMP_FUNC(type, p) \
+    ((int (*)(const void *, const void *)) \
+        ((1 ? p : (int (*)(const type * const *, const type * const *))0)))
+
+# define STACK_OF(type) struct stack_st_##type
+# define PREDECLARE_STACK_OF(type) STACK_OF(type);
+
+# define DECLARE_STACK_OF(type) \
+STACK_OF(type) \
+    { \
+    _STACK stack; \
+    };
+# define DECLARE_SPECIAL_STACK_OF(type, type2) \
+STACK_OF(type) \
+    { \
+    _STACK stack; \
+    };
+
+/* nada (obsolete in new safestack approach)*/
+# define IMPLEMENT_STACK_OF(type)
+
+/*-
+ * Strings are special: normally an lhash entry will point to a single
+ * (somewhat) mutable object. In the case of strings:
+ *
+ * a) Instead of a single char, there is an array of chars, NUL-terminated.
+ * b) The string may have be immutable.
+ *
+ * So, they need their own declarations. Especially important for
+ * type-checking tools, such as Deputy.
+ *
+ * In practice, however, it appears to be hard to have a const
+ * string. For now, I'm settling for dealing with the fact it is a
+ * string at all.
+ */
+typedef char *OPENSSL_STRING;
+
+typedef const char *OPENSSL_CSTRING;
+
+/*
+ * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but
+ * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned
+ * above, instead of a single char each entry is a NUL-terminated array of
+ * chars. So, we have to implement STRING specially for STACK_OF. This is
+ * dealt with in the autogenerated macros below.
+ */
+
+DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
+
+/*
+ * Similarly, we sometimes use a block of characters, NOT nul-terminated.
+ * These should also be distinguished from "normal" stacks.
+ */
+typedef void *OPENSSL_BLOCK;
+DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
+
+/*
+ * SKM_sk_... stack macros are internal to safestack.h: never use them
+ * directly, use sk_<type>_... instead
+ */
+# define SKM_sk_new(type, cmp) \
+        ((STACK_OF(type) *)sk_new(CHECKED_SK_CMP_FUNC(type, cmp)))
+# define SKM_sk_new_null(type) \
+        ((STACK_OF(type) *)sk_new_null())
+# define SKM_sk_free(type, st) \
+        sk_free(CHECKED_STACK_OF(type, st))
+# define SKM_sk_num(type, st) \
+        sk_num(CHECKED_STACK_OF(type, st))
+# define SKM_sk_value(type, st,i) \
+        ((type *)sk_value(CHECKED_STACK_OF(type, st), i))
+# define SKM_sk_set(type, st,i,val) \
+        sk_set(CHECKED_STACK_OF(type, st), i, CHECKED_PTR_OF(type, val))
+# define SKM_sk_zero(type, st) \
+        sk_zero(CHECKED_STACK_OF(type, st))
+# define SKM_sk_push(type, st, val) \
+        sk_push(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val))
+# define SKM_sk_unshift(type, st, val) \
+        sk_unshift(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val))
+# define SKM_sk_find(type, st, val) \
+        sk_find(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val))
+# define SKM_sk_find_ex(type, st, val) \
+        sk_find_ex(CHECKED_STACK_OF(type, st), \
+                   CHECKED_PTR_OF(type, val))
+# define SKM_sk_delete(type, st, i) \
+        (type *)sk_delete(CHECKED_STACK_OF(type, st), i)
+# define SKM_sk_delete_ptr(type, st, ptr) \
+        (type *)sk_delete_ptr(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, ptr))
+# define SKM_sk_insert(type, st,val, i) \
+        sk_insert(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val), i)
+# define SKM_sk_set_cmp_func(type, st, cmp) \
+        ((int (*)(const type * const *,const type * const *)) \
+        sk_set_cmp_func(CHECKED_STACK_OF(type, st), CHECKED_SK_CMP_FUNC(type, cmp)))
+# define SKM_sk_dup(type, st) \
+        (STACK_OF(type) *)sk_dup(CHECKED_STACK_OF(type, st))
+# define SKM_sk_pop_free(type, st, free_func) \
+        sk_pop_free(CHECKED_STACK_OF(type, st), CHECKED_SK_FREE_FUNC(type, free_func))
+# define SKM_sk_shift(type, st) \
+        (type *)sk_shift(CHECKED_STACK_OF(type, st))
+# define SKM_sk_pop(type, st) \
+        (type *)sk_pop(CHECKED_STACK_OF(type, st))
+# define SKM_sk_sort(type, st) \
+        sk_sort(CHECKED_STACK_OF(type, st))
+# define SKM_sk_is_sorted(type, st) \
+        sk_is_sorted(CHECKED_STACK_OF(type, st))
+# define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+  (STACK_OF(type) *)d2i_ASN1_SET( \
+                                (STACK_OF(OPENSSL_BLOCK) **)CHECKED_PTR_OF(STACK_OF(type)*, st), \
+                                pp, length, \
+                                CHECKED_D2I_OF(type, d2i_func), \
+                                CHECKED_SK_FREE_FUNC(type, free_func), \
+                                ex_tag, ex_class)
+# define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
+  i2d_ASN1_SET((STACK_OF(OPENSSL_BLOCK) *)CHECKED_STACK_OF(type, st), pp, \
+                                CHECKED_I2D_OF(type, i2d_func), \
+                                ex_tag, ex_class, is_set)
+# define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
+        ASN1_seq_pack(CHECKED_PTR_OF(STACK_OF(type), st), \
+                        CHECKED_I2D_OF(type, i2d_func), buf, len)
+# define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
+        (STACK_OF(type) *)ASN1_seq_unpack(buf, len, CHECKED_D2I_OF(type, d2i_func), CHECKED_SK_FREE_FUNC(type, free_func))
+# define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \
+        (STACK_OF(type) *)PKCS12_decrypt_d2i(algor, \
+                                CHECKED_D2I_OF(type, d2i_func), \
+                                CHECKED_SK_FREE_FUNC(type, free_func), \
+                                pass, passlen, oct, seq)
+/*
+ * This block of defines is updated by util/mkstack.pl, please do not touch!
+ */
+# define sk_ACCESS_DESCRIPTION_new(cmp) SKM_sk_new(ACCESS_DESCRIPTION, (cmp))
+# define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTION)
+# define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st))
+# define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st))
+# define sk_ACCESS_DESCRIPTION_value(st, i) SKM_sk_value(ACCESS_DESCRIPTION, (st), (i))
+# define sk_ACCESS_DESCRIPTION_set(st, i, val) SKM_sk_set(ACCESS_DESCRIPTION, (st), (i), (val))
+# define sk_ACCESS_DESCRIPTION_zero(st) SKM_sk_zero(ACCESS_DESCRIPTION, (st))
+# define sk_ACCESS_DESCRIPTION_push(st, val) SKM_sk_push(ACCESS_DESCRIPTION, (st), (val))
+# define sk_ACCESS_DESCRIPTION_unshift(st, val) SKM_sk_unshift(ACCESS_DESCRIPTION, (st), (val))
+# define sk_ACCESS_DESCRIPTION_find(st, val) SKM_sk_find(ACCESS_DESCRIPTION, (st), (val))
+# define sk_ACCESS_DESCRIPTION_find_ex(st, val) SKM_sk_find_ex(ACCESS_DESCRIPTION, (st), (val))
+# define sk_ACCESS_DESCRIPTION_delete(st, i) SKM_sk_delete(ACCESS_DESCRIPTION, (st), (i))
+# define sk_ACCESS_DESCRIPTION_delete_ptr(st, ptr) SKM_sk_delete_ptr(ACCESS_DESCRIPTION, (st), (ptr))
+# define sk_ACCESS_DESCRIPTION_insert(st, val, i) SKM_sk_insert(ACCESS_DESCRIPTION, (st), (val), (i))
+# define sk_ACCESS_DESCRIPTION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ACCESS_DESCRIPTION, (st), (cmp))
+# define sk_ACCESS_DESCRIPTION_dup(st) SKM_sk_dup(ACCESS_DESCRIPTION, st)
+# define sk_ACCESS_DESCRIPTION_pop_free(st, free_func) SKM_sk_pop_free(ACCESS_DESCRIPTION, (st), (free_func))
+# define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st))
+# define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st))
+# define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st))
+# define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st))
+# define sk_ASIdOrRange_new(cmp) SKM_sk_new(ASIdOrRange, (cmp))
+# define sk_ASIdOrRange_new_null() SKM_sk_new_null(ASIdOrRange)
+# define sk_ASIdOrRange_free(st) SKM_sk_free(ASIdOrRange, (st))
+# define sk_ASIdOrRange_num(st) SKM_sk_num(ASIdOrRange, (st))
+# define sk_ASIdOrRange_value(st, i) SKM_sk_value(ASIdOrRange, (st), (i))
+# define sk_ASIdOrRange_set(st, i, val) SKM_sk_set(ASIdOrRange, (st), (i), (val))
+# define sk_ASIdOrRange_zero(st) SKM_sk_zero(ASIdOrRange, (st))
+# define sk_ASIdOrRange_push(st, val) SKM_sk_push(ASIdOrRange, (st), (val))
+# define sk_ASIdOrRange_unshift(st, val) SKM_sk_unshift(ASIdOrRange, (st), (val))
+# define sk_ASIdOrRange_find(st, val) SKM_sk_find(ASIdOrRange, (st), (val))
+# define sk_ASIdOrRange_find_ex(st, val) SKM_sk_find_ex(ASIdOrRange, (st), (val))
+# define sk_ASIdOrRange_delete(st, i) SKM_sk_delete(ASIdOrRange, (st), (i))
+# define sk_ASIdOrRange_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASIdOrRange, (st), (ptr))
+# define sk_ASIdOrRange_insert(st, val, i) SKM_sk_insert(ASIdOrRange, (st), (val), (i))
+# define sk_ASIdOrRange_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASIdOrRange, (st), (cmp))
+# define sk_ASIdOrRange_dup(st) SKM_sk_dup(ASIdOrRange, st)
+# define sk_ASIdOrRange_pop_free(st, free_func) SKM_sk_pop_free(ASIdOrRange, (st), (free_func))
+# define sk_ASIdOrRange_shift(st) SKM_sk_shift(ASIdOrRange, (st))
+# define sk_ASIdOrRange_pop(st) SKM_sk_pop(ASIdOrRange, (st))
+# define sk_ASIdOrRange_sort(st) SKM_sk_sort(ASIdOrRange, (st))
+# define sk_ASIdOrRange_is_sorted(st) SKM_sk_is_sorted(ASIdOrRange, (st))
+# define sk_ASN1_GENERALSTRING_new(cmp) SKM_sk_new(ASN1_GENERALSTRING, (cmp))
+# define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING)
+# define sk_ASN1_GENERALSTRING_free(st) SKM_sk_free(ASN1_GENERALSTRING, (st))
+# define sk_ASN1_GENERALSTRING_num(st) SKM_sk_num(ASN1_GENERALSTRING, (st))
+# define sk_ASN1_GENERALSTRING_value(st, i) SKM_sk_value(ASN1_GENERALSTRING, (st), (i))
+# define sk_ASN1_GENERALSTRING_set(st, i, val) SKM_sk_set(ASN1_GENERALSTRING, (st), (i), (val))
+# define sk_ASN1_GENERALSTRING_zero(st) SKM_sk_zero(ASN1_GENERALSTRING, (st))
+# define sk_ASN1_GENERALSTRING_push(st, val) SKM_sk_push(ASN1_GENERALSTRING, (st), (val))
+# define sk_ASN1_GENERALSTRING_unshift(st, val) SKM_sk_unshift(ASN1_GENERALSTRING, (st), (val))
+# define sk_ASN1_GENERALSTRING_find(st, val) SKM_sk_find(ASN1_GENERALSTRING, (st), (val))
+# define sk_ASN1_GENERALSTRING_find_ex(st, val) SKM_sk_find_ex(ASN1_GENERALSTRING, (st), (val))
+# define sk_ASN1_GENERALSTRING_delete(st, i) SKM_sk_delete(ASN1_GENERALSTRING, (st), (i))
+# define sk_ASN1_GENERALSTRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_GENERALSTRING, (st), (ptr))
+# define sk_ASN1_GENERALSTRING_insert(st, val, i) SKM_sk_insert(ASN1_GENERALSTRING, (st), (val), (i))
+# define sk_ASN1_GENERALSTRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_GENERALSTRING, (st), (cmp))
+# define sk_ASN1_GENERALSTRING_dup(st) SKM_sk_dup(ASN1_GENERALSTRING, st)
+# define sk_ASN1_GENERALSTRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_GENERALSTRING, (st), (free_func))
+# define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st))
+# define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st))
+# define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st))
+# define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st))
+# define sk_ASN1_INTEGER_new(cmp) SKM_sk_new(ASN1_INTEGER, (cmp))
+# define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER)
+# define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st))
+# define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st))
+# define sk_ASN1_INTEGER_value(st, i) SKM_sk_value(ASN1_INTEGER, (st), (i))
+# define sk_ASN1_INTEGER_set(st, i, val) SKM_sk_set(ASN1_INTEGER, (st), (i), (val))
+# define sk_ASN1_INTEGER_zero(st) SKM_sk_zero(ASN1_INTEGER, (st))
+# define sk_ASN1_INTEGER_push(st, val) SKM_sk_push(ASN1_INTEGER, (st), (val))
+# define sk_ASN1_INTEGER_unshift(st, val) SKM_sk_unshift(ASN1_INTEGER, (st), (val))
+# define sk_ASN1_INTEGER_find(st, val) SKM_sk_find(ASN1_INTEGER, (st), (val))
+# define sk_ASN1_INTEGER_find_ex(st, val) SKM_sk_find_ex(ASN1_INTEGER, (st), (val))
+# define sk_ASN1_INTEGER_delete(st, i) SKM_sk_delete(ASN1_INTEGER, (st), (i))
+# define sk_ASN1_INTEGER_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_INTEGER, (st), (ptr))
+# define sk_ASN1_INTEGER_insert(st, val, i) SKM_sk_insert(ASN1_INTEGER, (st), (val), (i))
+# define sk_ASN1_INTEGER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_INTEGER, (st), (cmp))
+# define sk_ASN1_INTEGER_dup(st) SKM_sk_dup(ASN1_INTEGER, st)
+# define sk_ASN1_INTEGER_pop_free(st, free_func) SKM_sk_pop_free(ASN1_INTEGER, (st), (free_func))
+# define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st))
+# define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st))
+# define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st))
+# define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st))
+# define sk_ASN1_OBJECT_new(cmp) SKM_sk_new(ASN1_OBJECT, (cmp))
+# define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT)
+# define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st))
+# define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st))
+# define sk_ASN1_OBJECT_value(st, i) SKM_sk_value(ASN1_OBJECT, (st), (i))
+# define sk_ASN1_OBJECT_set(st, i, val) SKM_sk_set(ASN1_OBJECT, (st), (i), (val))
+# define sk_ASN1_OBJECT_zero(st) SKM_sk_zero(ASN1_OBJECT, (st))
+# define sk_ASN1_OBJECT_push(st, val) SKM_sk_push(ASN1_OBJECT, (st), (val))
+# define sk_ASN1_OBJECT_unshift(st, val) SKM_sk_unshift(ASN1_OBJECT, (st), (val))
+# define sk_ASN1_OBJECT_find(st, val) SKM_sk_find(ASN1_OBJECT, (st), (val))
+# define sk_ASN1_OBJECT_find_ex(st, val) SKM_sk_find_ex(ASN1_OBJECT, (st), (val))
+# define sk_ASN1_OBJECT_delete(st, i) SKM_sk_delete(ASN1_OBJECT, (st), (i))
+# define sk_ASN1_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_OBJECT, (st), (ptr))
+# define sk_ASN1_OBJECT_insert(st, val, i) SKM_sk_insert(ASN1_OBJECT, (st), (val), (i))
+# define sk_ASN1_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_OBJECT, (st), (cmp))
+# define sk_ASN1_OBJECT_dup(st) SKM_sk_dup(ASN1_OBJECT, st)
+# define sk_ASN1_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(ASN1_OBJECT, (st), (free_func))
+# define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st))
+# define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st))
+# define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st))
+# define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st))
+# define sk_ASN1_STRING_TABLE_new(cmp) SKM_sk_new(ASN1_STRING_TABLE, (cmp))
+# define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE)
+# define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st))
+# define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st))
+# define sk_ASN1_STRING_TABLE_value(st, i) SKM_sk_value(ASN1_STRING_TABLE, (st), (i))
+# define sk_ASN1_STRING_TABLE_set(st, i, val) SKM_sk_set(ASN1_STRING_TABLE, (st), (i), (val))
+# define sk_ASN1_STRING_TABLE_zero(st) SKM_sk_zero(ASN1_STRING_TABLE, (st))
+# define sk_ASN1_STRING_TABLE_push(st, val) SKM_sk_push(ASN1_STRING_TABLE, (st), (val))
+# define sk_ASN1_STRING_TABLE_unshift(st, val) SKM_sk_unshift(ASN1_STRING_TABLE, (st), (val))
+# define sk_ASN1_STRING_TABLE_find(st, val) SKM_sk_find(ASN1_STRING_TABLE, (st), (val))
+# define sk_ASN1_STRING_TABLE_find_ex(st, val) SKM_sk_find_ex(ASN1_STRING_TABLE, (st), (val))
+# define sk_ASN1_STRING_TABLE_delete(st, i) SKM_sk_delete(ASN1_STRING_TABLE, (st), (i))
+# define sk_ASN1_STRING_TABLE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_STRING_TABLE, (st), (ptr))
+# define sk_ASN1_STRING_TABLE_insert(st, val, i) SKM_sk_insert(ASN1_STRING_TABLE, (st), (val), (i))
+# define sk_ASN1_STRING_TABLE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_STRING_TABLE, (st), (cmp))
+# define sk_ASN1_STRING_TABLE_dup(st) SKM_sk_dup(ASN1_STRING_TABLE, st)
+# define sk_ASN1_STRING_TABLE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_STRING_TABLE, (st), (free_func))
+# define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st))
+# define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st))
+# define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st))
+# define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st))
+# define sk_ASN1_TYPE_new(cmp) SKM_sk_new(ASN1_TYPE, (cmp))
+# define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE)
+# define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st))
+# define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st))
+# define sk_ASN1_TYPE_value(st, i) SKM_sk_value(ASN1_TYPE, (st), (i))
+# define sk_ASN1_TYPE_set(st, i, val) SKM_sk_set(ASN1_TYPE, (st), (i), (val))
+# define sk_ASN1_TYPE_zero(st) SKM_sk_zero(ASN1_TYPE, (st))
+# define sk_ASN1_TYPE_push(st, val) SKM_sk_push(ASN1_TYPE, (st), (val))
+# define sk_ASN1_TYPE_unshift(st, val) SKM_sk_unshift(ASN1_TYPE, (st), (val))
+# define sk_ASN1_TYPE_find(st, val) SKM_sk_find(ASN1_TYPE, (st), (val))
+# define sk_ASN1_TYPE_find_ex(st, val) SKM_sk_find_ex(ASN1_TYPE, (st), (val))
+# define sk_ASN1_TYPE_delete(st, i) SKM_sk_delete(ASN1_TYPE, (st), (i))
+# define sk_ASN1_TYPE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_TYPE, (st), (ptr))
+# define sk_ASN1_TYPE_insert(st, val, i) SKM_sk_insert(ASN1_TYPE, (st), (val), (i))
+# define sk_ASN1_TYPE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_TYPE, (st), (cmp))
+# define sk_ASN1_TYPE_dup(st) SKM_sk_dup(ASN1_TYPE, st)
+# define sk_ASN1_TYPE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_TYPE, (st), (free_func))
+# define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st))
+# define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st))
+# define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st))
+# define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st))
+# define sk_ASN1_UTF8STRING_new(cmp) SKM_sk_new(ASN1_UTF8STRING, (cmp))
+# define sk_ASN1_UTF8STRING_new_null() SKM_sk_new_null(ASN1_UTF8STRING)
+# define sk_ASN1_UTF8STRING_free(st) SKM_sk_free(ASN1_UTF8STRING, (st))
+# define sk_ASN1_UTF8STRING_num(st) SKM_sk_num(ASN1_UTF8STRING, (st))
+# define sk_ASN1_UTF8STRING_value(st, i) SKM_sk_value(ASN1_UTF8STRING, (st), (i))
+# define sk_ASN1_UTF8STRING_set(st, i, val) SKM_sk_set(ASN1_UTF8STRING, (st), (i), (val))
+# define sk_ASN1_UTF8STRING_zero(st) SKM_sk_zero(ASN1_UTF8STRING, (st))
+# define sk_ASN1_UTF8STRING_push(st, val) SKM_sk_push(ASN1_UTF8STRING, (st), (val))
+# define sk_ASN1_UTF8STRING_unshift(st, val) SKM_sk_unshift(ASN1_UTF8STRING, (st), (val))
+# define sk_ASN1_UTF8STRING_find(st, val) SKM_sk_find(ASN1_UTF8STRING, (st), (val))
+# define sk_ASN1_UTF8STRING_find_ex(st, val) SKM_sk_find_ex(ASN1_UTF8STRING, (st), (val))
+# define sk_ASN1_UTF8STRING_delete(st, i) SKM_sk_delete(ASN1_UTF8STRING, (st), (i))
+# define sk_ASN1_UTF8STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_UTF8STRING, (st), (ptr))
+# define sk_ASN1_UTF8STRING_insert(st, val, i) SKM_sk_insert(ASN1_UTF8STRING, (st), (val), (i))
+# define sk_ASN1_UTF8STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_UTF8STRING, (st), (cmp))
+# define sk_ASN1_UTF8STRING_dup(st) SKM_sk_dup(ASN1_UTF8STRING, st)
+# define sk_ASN1_UTF8STRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_UTF8STRING, (st), (free_func))
+# define sk_ASN1_UTF8STRING_shift(st) SKM_sk_shift(ASN1_UTF8STRING, (st))
+# define sk_ASN1_UTF8STRING_pop(st) SKM_sk_pop(ASN1_UTF8STRING, (st))
+# define sk_ASN1_UTF8STRING_sort(st) SKM_sk_sort(ASN1_UTF8STRING, (st))
+# define sk_ASN1_UTF8STRING_is_sorted(st) SKM_sk_is_sorted(ASN1_UTF8STRING, (st))
+# define sk_ASN1_VALUE_new(cmp) SKM_sk_new(ASN1_VALUE, (cmp))
+# define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE)
+# define sk_ASN1_VALUE_free(st) SKM_sk_free(ASN1_VALUE, (st))
+# define sk_ASN1_VALUE_num(st) SKM_sk_num(ASN1_VALUE, (st))
+# define sk_ASN1_VALUE_value(st, i) SKM_sk_value(ASN1_VALUE, (st), (i))
+# define sk_ASN1_VALUE_set(st, i, val) SKM_sk_set(ASN1_VALUE, (st), (i), (val))
+# define sk_ASN1_VALUE_zero(st) SKM_sk_zero(ASN1_VALUE, (st))
+# define sk_ASN1_VALUE_push(st, val) SKM_sk_push(ASN1_VALUE, (st), (val))
+# define sk_ASN1_VALUE_unshift(st, val) SKM_sk_unshift(ASN1_VALUE, (st), (val))
+# define sk_ASN1_VALUE_find(st, val) SKM_sk_find(ASN1_VALUE, (st), (val))
+# define sk_ASN1_VALUE_find_ex(st, val) SKM_sk_find_ex(ASN1_VALUE, (st), (val))
+# define sk_ASN1_VALUE_delete(st, i) SKM_sk_delete(ASN1_VALUE, (st), (i))
+# define sk_ASN1_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_VALUE, (st), (ptr))
+# define sk_ASN1_VALUE_insert(st, val, i) SKM_sk_insert(ASN1_VALUE, (st), (val), (i))
+# define sk_ASN1_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_VALUE, (st), (cmp))
+# define sk_ASN1_VALUE_dup(st) SKM_sk_dup(ASN1_VALUE, st)
+# define sk_ASN1_VALUE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_VALUE, (st), (free_func))
+# define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st))
+# define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st))
+# define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st))
+# define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st))
+# define sk_BIO_new(cmp) SKM_sk_new(BIO, (cmp))
+# define sk_BIO_new_null() SKM_sk_new_null(BIO)
+# define sk_BIO_free(st) SKM_sk_free(BIO, (st))
+# define sk_BIO_num(st) SKM_sk_num(BIO, (st))
+# define sk_BIO_value(st, i) SKM_sk_value(BIO, (st), (i))
+# define sk_BIO_set(st, i, val) SKM_sk_set(BIO, (st), (i), (val))
+# define sk_BIO_zero(st) SKM_sk_zero(BIO, (st))
+# define sk_BIO_push(st, val) SKM_sk_push(BIO, (st), (val))
+# define sk_BIO_unshift(st, val) SKM_sk_unshift(BIO, (st), (val))
+# define sk_BIO_find(st, val) SKM_sk_find(BIO, (st), (val))
+# define sk_BIO_find_ex(st, val) SKM_sk_find_ex(BIO, (st), (val))
+# define sk_BIO_delete(st, i) SKM_sk_delete(BIO, (st), (i))
+# define sk_BIO_delete_ptr(st, ptr) SKM_sk_delete_ptr(BIO, (st), (ptr))
+# define sk_BIO_insert(st, val, i) SKM_sk_insert(BIO, (st), (val), (i))
+# define sk_BIO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BIO, (st), (cmp))
+# define sk_BIO_dup(st) SKM_sk_dup(BIO, st)
+# define sk_BIO_pop_free(st, free_func) SKM_sk_pop_free(BIO, (st), (free_func))
+# define sk_BIO_shift(st) SKM_sk_shift(BIO, (st))
+# define sk_BIO_pop(st) SKM_sk_pop(BIO, (st))
+# define sk_BIO_sort(st) SKM_sk_sort(BIO, (st))
+# define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st))
+# define sk_BY_DIR_ENTRY_new(cmp) SKM_sk_new(BY_DIR_ENTRY, (cmp))
+# define sk_BY_DIR_ENTRY_new_null() SKM_sk_new_null(BY_DIR_ENTRY)
+# define sk_BY_DIR_ENTRY_free(st) SKM_sk_free(BY_DIR_ENTRY, (st))
+# define sk_BY_DIR_ENTRY_num(st) SKM_sk_num(BY_DIR_ENTRY, (st))
+# define sk_BY_DIR_ENTRY_value(st, i) SKM_sk_value(BY_DIR_ENTRY, (st), (i))
+# define sk_BY_DIR_ENTRY_set(st, i, val) SKM_sk_set(BY_DIR_ENTRY, (st), (i), (val))
+# define sk_BY_DIR_ENTRY_zero(st) SKM_sk_zero(BY_DIR_ENTRY, (st))
+# define sk_BY_DIR_ENTRY_push(st, val) SKM_sk_push(BY_DIR_ENTRY, (st), (val))
+# define sk_BY_DIR_ENTRY_unshift(st, val) SKM_sk_unshift(BY_DIR_ENTRY, (st), (val))
+# define sk_BY_DIR_ENTRY_find(st, val) SKM_sk_find(BY_DIR_ENTRY, (st), (val))
+# define sk_BY_DIR_ENTRY_find_ex(st, val) SKM_sk_find_ex(BY_DIR_ENTRY, (st), (val))
+# define sk_BY_DIR_ENTRY_delete(st, i) SKM_sk_delete(BY_DIR_ENTRY, (st), (i))
+# define sk_BY_DIR_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(BY_DIR_ENTRY, (st), (ptr))
+# define sk_BY_DIR_ENTRY_insert(st, val, i) SKM_sk_insert(BY_DIR_ENTRY, (st), (val), (i))
+# define sk_BY_DIR_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BY_DIR_ENTRY, (st), (cmp))
+# define sk_BY_DIR_ENTRY_dup(st) SKM_sk_dup(BY_DIR_ENTRY, st)
+# define sk_BY_DIR_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(BY_DIR_ENTRY, (st), (free_func))
+# define sk_BY_DIR_ENTRY_shift(st) SKM_sk_shift(BY_DIR_ENTRY, (st))
+# define sk_BY_DIR_ENTRY_pop(st) SKM_sk_pop(BY_DIR_ENTRY, (st))
+# define sk_BY_DIR_ENTRY_sort(st) SKM_sk_sort(BY_DIR_ENTRY, (st))
+# define sk_BY_DIR_ENTRY_is_sorted(st) SKM_sk_is_sorted(BY_DIR_ENTRY, (st))
+# define sk_BY_DIR_HASH_new(cmp) SKM_sk_new(BY_DIR_HASH, (cmp))
+# define sk_BY_DIR_HASH_new_null() SKM_sk_new_null(BY_DIR_HASH)
+# define sk_BY_DIR_HASH_free(st) SKM_sk_free(BY_DIR_HASH, (st))
+# define sk_BY_DIR_HASH_num(st) SKM_sk_num(BY_DIR_HASH, (st))
+# define sk_BY_DIR_HASH_value(st, i) SKM_sk_value(BY_DIR_HASH, (st), (i))
+# define sk_BY_DIR_HASH_set(st, i, val) SKM_sk_set(BY_DIR_HASH, (st), (i), (val))
+# define sk_BY_DIR_HASH_zero(st) SKM_sk_zero(BY_DIR_HASH, (st))
+# define sk_BY_DIR_HASH_push(st, val) SKM_sk_push(BY_DIR_HASH, (st), (val))
+# define sk_BY_DIR_HASH_unshift(st, val) SKM_sk_unshift(BY_DIR_HASH, (st), (val))
+# define sk_BY_DIR_HASH_find(st, val) SKM_sk_find(BY_DIR_HASH, (st), (val))
+# define sk_BY_DIR_HASH_find_ex(st, val) SKM_sk_find_ex(BY_DIR_HASH, (st), (val))
+# define sk_BY_DIR_HASH_delete(st, i) SKM_sk_delete(BY_DIR_HASH, (st), (i))
+# define sk_BY_DIR_HASH_delete_ptr(st, ptr) SKM_sk_delete_ptr(BY_DIR_HASH, (st), (ptr))
+# define sk_BY_DIR_HASH_insert(st, val, i) SKM_sk_insert(BY_DIR_HASH, (st), (val), (i))
+# define sk_BY_DIR_HASH_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BY_DIR_HASH, (st), (cmp))
+# define sk_BY_DIR_HASH_dup(st) SKM_sk_dup(BY_DIR_HASH, st)
+# define sk_BY_DIR_HASH_pop_free(st, free_func) SKM_sk_pop_free(BY_DIR_HASH, (st), (free_func))
+# define sk_BY_DIR_HASH_shift(st) SKM_sk_shift(BY_DIR_HASH, (st))
+# define sk_BY_DIR_HASH_pop(st) SKM_sk_pop(BY_DIR_HASH, (st))
+# define sk_BY_DIR_HASH_sort(st) SKM_sk_sort(BY_DIR_HASH, (st))
+# define sk_BY_DIR_HASH_is_sorted(st) SKM_sk_is_sorted(BY_DIR_HASH, (st))
+# define sk_CMS_CertificateChoices_new(cmp) SKM_sk_new(CMS_CertificateChoices, (cmp))
+# define sk_CMS_CertificateChoices_new_null() SKM_sk_new_null(CMS_CertificateChoices)
+# define sk_CMS_CertificateChoices_free(st) SKM_sk_free(CMS_CertificateChoices, (st))
+# define sk_CMS_CertificateChoices_num(st) SKM_sk_num(CMS_CertificateChoices, (st))
+# define sk_CMS_CertificateChoices_value(st, i) SKM_sk_value(CMS_CertificateChoices, (st), (i))
+# define sk_CMS_CertificateChoices_set(st, i, val) SKM_sk_set(CMS_CertificateChoices, (st), (i), (val))
+# define sk_CMS_CertificateChoices_zero(st) SKM_sk_zero(CMS_CertificateChoices, (st))
+# define sk_CMS_CertificateChoices_push(st, val) SKM_sk_push(CMS_CertificateChoices, (st), (val))
+# define sk_CMS_CertificateChoices_unshift(st, val) SKM_sk_unshift(CMS_CertificateChoices, (st), (val))
+# define sk_CMS_CertificateChoices_find(st, val) SKM_sk_find(CMS_CertificateChoices, (st), (val))
+# define sk_CMS_CertificateChoices_find_ex(st, val) SKM_sk_find_ex(CMS_CertificateChoices, (st), (val))
+# define sk_CMS_CertificateChoices_delete(st, i) SKM_sk_delete(CMS_CertificateChoices, (st), (i))
+# define sk_CMS_CertificateChoices_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_CertificateChoices, (st), (ptr))
+# define sk_CMS_CertificateChoices_insert(st, val, i) SKM_sk_insert(CMS_CertificateChoices, (st), (val), (i))
+# define sk_CMS_CertificateChoices_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_CertificateChoices, (st), (cmp))
+# define sk_CMS_CertificateChoices_dup(st) SKM_sk_dup(CMS_CertificateChoices, st)
+# define sk_CMS_CertificateChoices_pop_free(st, free_func) SKM_sk_pop_free(CMS_CertificateChoices, (st), (free_func))
+# define sk_CMS_CertificateChoices_shift(st) SKM_sk_shift(CMS_CertificateChoices, (st))
+# define sk_CMS_CertificateChoices_pop(st) SKM_sk_pop(CMS_CertificateChoices, (st))
+# define sk_CMS_CertificateChoices_sort(st) SKM_sk_sort(CMS_CertificateChoices, (st))
+# define sk_CMS_CertificateChoices_is_sorted(st) SKM_sk_is_sorted(CMS_CertificateChoices, (st))
+# define sk_CMS_RecipientInfo_new(cmp) SKM_sk_new(CMS_RecipientInfo, (cmp))
+# define sk_CMS_RecipientInfo_new_null() SKM_sk_new_null(CMS_RecipientInfo)
+# define sk_CMS_RecipientInfo_free(st) SKM_sk_free(CMS_RecipientInfo, (st))
+# define sk_CMS_RecipientInfo_num(st) SKM_sk_num(CMS_RecipientInfo, (st))
+# define sk_CMS_RecipientInfo_value(st, i) SKM_sk_value(CMS_RecipientInfo, (st), (i))
+# define sk_CMS_RecipientInfo_set(st, i, val) SKM_sk_set(CMS_RecipientInfo, (st), (i), (val))
+# define sk_CMS_RecipientInfo_zero(st) SKM_sk_zero(CMS_RecipientInfo, (st))
+# define sk_CMS_RecipientInfo_push(st, val) SKM_sk_push(CMS_RecipientInfo, (st), (val))
+# define sk_CMS_RecipientInfo_unshift(st, val) SKM_sk_unshift(CMS_RecipientInfo, (st), (val))
+# define sk_CMS_RecipientInfo_find(st, val) SKM_sk_find(CMS_RecipientInfo, (st), (val))
+# define sk_CMS_RecipientInfo_find_ex(st, val) SKM_sk_find_ex(CMS_RecipientInfo, (st), (val))
+# define sk_CMS_RecipientInfo_delete(st, i) SKM_sk_delete(CMS_RecipientInfo, (st), (i))
+# define sk_CMS_RecipientInfo_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RecipientInfo, (st), (ptr))
+# define sk_CMS_RecipientInfo_insert(st, val, i) SKM_sk_insert(CMS_RecipientInfo, (st), (val), (i))
+# define sk_CMS_RecipientInfo_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RecipientInfo, (st), (cmp))
+# define sk_CMS_RecipientInfo_dup(st) SKM_sk_dup(CMS_RecipientInfo, st)
+# define sk_CMS_RecipientInfo_pop_free(st, free_func) SKM_sk_pop_free(CMS_RecipientInfo, (st), (free_func))
+# define sk_CMS_RecipientInfo_shift(st) SKM_sk_shift(CMS_RecipientInfo, (st))
+# define sk_CMS_RecipientInfo_pop(st) SKM_sk_pop(CMS_RecipientInfo, (st))
+# define sk_CMS_RecipientInfo_sort(st) SKM_sk_sort(CMS_RecipientInfo, (st))
+# define sk_CMS_RecipientInfo_is_sorted(st) SKM_sk_is_sorted(CMS_RecipientInfo, (st))
+# define sk_CMS_RevocationInfoChoice_new(cmp) SKM_sk_new(CMS_RevocationInfoChoice, (cmp))
+# define sk_CMS_RevocationInfoChoice_new_null() SKM_sk_new_null(CMS_RevocationInfoChoice)
+# define sk_CMS_RevocationInfoChoice_free(st) SKM_sk_free(CMS_RevocationInfoChoice, (st))
+# define sk_CMS_RevocationInfoChoice_num(st) SKM_sk_num(CMS_RevocationInfoChoice, (st))
+# define sk_CMS_RevocationInfoChoice_value(st, i) SKM_sk_value(CMS_RevocationInfoChoice, (st), (i))
+# define sk_CMS_RevocationInfoChoice_set(st, i, val) SKM_sk_set(CMS_RevocationInfoChoice, (st), (i), (val))
+# define sk_CMS_RevocationInfoChoice_zero(st) SKM_sk_zero(CMS_RevocationInfoChoice, (st))
+# define sk_CMS_RevocationInfoChoice_push(st, val) SKM_sk_push(CMS_RevocationInfoChoice, (st), (val))
+# define sk_CMS_RevocationInfoChoice_unshift(st, val) SKM_sk_unshift(CMS_RevocationInfoChoice, (st), (val))
+# define sk_CMS_RevocationInfoChoice_find(st, val) SKM_sk_find(CMS_RevocationInfoChoice, (st), (val))
+# define sk_CMS_RevocationInfoChoice_find_ex(st, val) SKM_sk_find_ex(CMS_RevocationInfoChoice, (st), (val))
+# define sk_CMS_RevocationInfoChoice_delete(st, i) SKM_sk_delete(CMS_RevocationInfoChoice, (st), (i))
+# define sk_CMS_RevocationInfoChoice_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RevocationInfoChoice, (st), (ptr))
+# define sk_CMS_RevocationInfoChoice_insert(st, val, i) SKM_sk_insert(CMS_RevocationInfoChoice, (st), (val), (i))
+# define sk_CMS_RevocationInfoChoice_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RevocationInfoChoice, (st), (cmp))
+# define sk_CMS_RevocationInfoChoice_dup(st) SKM_sk_dup(CMS_RevocationInfoChoice, st)
+# define sk_CMS_RevocationInfoChoice_pop_free(st, free_func) SKM_sk_pop_free(CMS_RevocationInfoChoice, (st), (free_func))
+# define sk_CMS_RevocationInfoChoice_shift(st) SKM_sk_shift(CMS_RevocationInfoChoice, (st))
+# define sk_CMS_RevocationInfoChoice_pop(st) SKM_sk_pop(CMS_RevocationInfoChoice, (st))
+# define sk_CMS_RevocationInfoChoice_sort(st) SKM_sk_sort(CMS_RevocationInfoChoice, (st))
+# define sk_CMS_RevocationInfoChoice_is_sorted(st) SKM_sk_is_sorted(CMS_RevocationInfoChoice, (st))
+# define sk_CMS_SignerInfo_new(cmp) SKM_sk_new(CMS_SignerInfo, (cmp))
+# define sk_CMS_SignerInfo_new_null() SKM_sk_new_null(CMS_SignerInfo)
+# define sk_CMS_SignerInfo_free(st) SKM_sk_free(CMS_SignerInfo, (st))
+# define sk_CMS_SignerInfo_num(st) SKM_sk_num(CMS_SignerInfo, (st))
+# define sk_CMS_SignerInfo_value(st, i) SKM_sk_value(CMS_SignerInfo, (st), (i))
+# define sk_CMS_SignerInfo_set(st, i, val) SKM_sk_set(CMS_SignerInfo, (st), (i), (val))
+# define sk_CMS_SignerInfo_zero(st) SKM_sk_zero(CMS_SignerInfo, (st))
+# define sk_CMS_SignerInfo_push(st, val) SKM_sk_push(CMS_SignerInfo, (st), (val))
+# define sk_CMS_SignerInfo_unshift(st, val) SKM_sk_unshift(CMS_SignerInfo, (st), (val))
+# define sk_CMS_SignerInfo_find(st, val) SKM_sk_find(CMS_SignerInfo, (st), (val))
+# define sk_CMS_SignerInfo_find_ex(st, val) SKM_sk_find_ex(CMS_SignerInfo, (st), (val))
+# define sk_CMS_SignerInfo_delete(st, i) SKM_sk_delete(CMS_SignerInfo, (st), (i))
+# define sk_CMS_SignerInfo_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_SignerInfo, (st), (ptr))
+# define sk_CMS_SignerInfo_insert(st, val, i) SKM_sk_insert(CMS_SignerInfo, (st), (val), (i))
+# define sk_CMS_SignerInfo_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_SignerInfo, (st), (cmp))
+# define sk_CMS_SignerInfo_dup(st) SKM_sk_dup(CMS_SignerInfo, st)
+# define sk_CMS_SignerInfo_pop_free(st, free_func) SKM_sk_pop_free(CMS_SignerInfo, (st), (free_func))
+# define sk_CMS_SignerInfo_shift(st) SKM_sk_shift(CMS_SignerInfo, (st))
+# define sk_CMS_SignerInfo_pop(st) SKM_sk_pop(CMS_SignerInfo, (st))
+# define sk_CMS_SignerInfo_sort(st) SKM_sk_sort(CMS_SignerInfo, (st))
+# define sk_CMS_SignerInfo_is_sorted(st) SKM_sk_is_sorted(CMS_SignerInfo, (st))
+# define sk_CONF_IMODULE_new(cmp) SKM_sk_new(CONF_IMODULE, (cmp))
+# define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE)
+# define sk_CONF_IMODULE_free(st) SKM_sk_free(CONF_IMODULE, (st))
+# define sk_CONF_IMODULE_num(st) SKM_sk_num(CONF_IMODULE, (st))
+# define sk_CONF_IMODULE_value(st, i) SKM_sk_value(CONF_IMODULE, (st), (i))
+# define sk_CONF_IMODULE_set(st, i, val) SKM_sk_set(CONF_IMODULE, (st), (i), (val))
+# define sk_CONF_IMODULE_zero(st) SKM_sk_zero(CONF_IMODULE, (st))
+# define sk_CONF_IMODULE_push(st, val) SKM_sk_push(CONF_IMODULE, (st), (val))
+# define sk_CONF_IMODULE_unshift(st, val) SKM_sk_unshift(CONF_IMODULE, (st), (val))
+# define sk_CONF_IMODULE_find(st, val) SKM_sk_find(CONF_IMODULE, (st), (val))
+# define sk_CONF_IMODULE_find_ex(st, val) SKM_sk_find_ex(CONF_IMODULE, (st), (val))
+# define sk_CONF_IMODULE_delete(st, i) SKM_sk_delete(CONF_IMODULE, (st), (i))
+# define sk_CONF_IMODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_IMODULE, (st), (ptr))
+# define sk_CONF_IMODULE_insert(st, val, i) SKM_sk_insert(CONF_IMODULE, (st), (val), (i))
+# define sk_CONF_IMODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_IMODULE, (st), (cmp))
+# define sk_CONF_IMODULE_dup(st) SKM_sk_dup(CONF_IMODULE, st)
+# define sk_CONF_IMODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_IMODULE, (st), (free_func))
+# define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st))
+# define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st))
+# define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st))
+# define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st))
+# define sk_CONF_MODULE_new(cmp) SKM_sk_new(CONF_MODULE, (cmp))
+# define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE)
+# define sk_CONF_MODULE_free(st) SKM_sk_free(CONF_MODULE, (st))
+# define sk_CONF_MODULE_num(st) SKM_sk_num(CONF_MODULE, (st))
+# define sk_CONF_MODULE_value(st, i) SKM_sk_value(CONF_MODULE, (st), (i))
+# define sk_CONF_MODULE_set(st, i, val) SKM_sk_set(CONF_MODULE, (st), (i), (val))
+# define sk_CONF_MODULE_zero(st) SKM_sk_zero(CONF_MODULE, (st))
+# define sk_CONF_MODULE_push(st, val) SKM_sk_push(CONF_MODULE, (st), (val))
+# define sk_CONF_MODULE_unshift(st, val) SKM_sk_unshift(CONF_MODULE, (st), (val))
+# define sk_CONF_MODULE_find(st, val) SKM_sk_find(CONF_MODULE, (st), (val))
+# define sk_CONF_MODULE_find_ex(st, val) SKM_sk_find_ex(CONF_MODULE, (st), (val))
+# define sk_CONF_MODULE_delete(st, i) SKM_sk_delete(CONF_MODULE, (st), (i))
+# define sk_CONF_MODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_MODULE, (st), (ptr))
+# define sk_CONF_MODULE_insert(st, val, i) SKM_sk_insert(CONF_MODULE, (st), (val), (i))
+# define sk_CONF_MODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_MODULE, (st), (cmp))
+# define sk_CONF_MODULE_dup(st) SKM_sk_dup(CONF_MODULE, st)
+# define sk_CONF_MODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_MODULE, (st), (free_func))
+# define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st))
+# define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st))
+# define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st))
+# define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st))
+# define sk_CONF_VALUE_new(cmp) SKM_sk_new(CONF_VALUE, (cmp))
+# define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE)
+# define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st))
+# define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st))
+# define sk_CONF_VALUE_value(st, i) SKM_sk_value(CONF_VALUE, (st), (i))
+# define sk_CONF_VALUE_set(st, i, val) SKM_sk_set(CONF_VALUE, (st), (i), (val))
+# define sk_CONF_VALUE_zero(st) SKM_sk_zero(CONF_VALUE, (st))
+# define sk_CONF_VALUE_push(st, val) SKM_sk_push(CONF_VALUE, (st), (val))
+# define sk_CONF_VALUE_unshift(st, val) SKM_sk_unshift(CONF_VALUE, (st), (val))
+# define sk_CONF_VALUE_find(st, val) SKM_sk_find(CONF_VALUE, (st), (val))
+# define sk_CONF_VALUE_find_ex(st, val) SKM_sk_find_ex(CONF_VALUE, (st), (val))
+# define sk_CONF_VALUE_delete(st, i) SKM_sk_delete(CONF_VALUE, (st), (i))
+# define sk_CONF_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_VALUE, (st), (ptr))
+# define sk_CONF_VALUE_insert(st, val, i) SKM_sk_insert(CONF_VALUE, (st), (val), (i))
+# define sk_CONF_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_VALUE, (st), (cmp))
+# define sk_CONF_VALUE_dup(st) SKM_sk_dup(CONF_VALUE, st)
+# define sk_CONF_VALUE_pop_free(st, free_func) SKM_sk_pop_free(CONF_VALUE, (st), (free_func))
+# define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st))
+# define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st))
+# define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st))
+# define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st))
+# define sk_CRYPTO_EX_DATA_FUNCS_new(cmp) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (cmp))
+# define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS)
+# define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS, (st))
+# define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (st))
+# define sk_CRYPTO_EX_DATA_FUNCS_value(st, i) SKM_sk_value(CRYPTO_EX_DATA_FUNCS, (st), (i))
+# define sk_CRYPTO_EX_DATA_FUNCS_set(st, i, val) SKM_sk_set(CRYPTO_EX_DATA_FUNCS, (st), (i), (val))
+# define sk_CRYPTO_EX_DATA_FUNCS_zero(st) SKM_sk_zero(CRYPTO_EX_DATA_FUNCS, (st))
+# define sk_CRYPTO_EX_DATA_FUNCS_push(st, val) SKM_sk_push(CRYPTO_EX_DATA_FUNCS, (st), (val))
+# define sk_CRYPTO_EX_DATA_FUNCS_unshift(st, val) SKM_sk_unshift(CRYPTO_EX_DATA_FUNCS, (st), (val))
+# define sk_CRYPTO_EX_DATA_FUNCS_find(st, val) SKM_sk_find(CRYPTO_EX_DATA_FUNCS, (st), (val))
+# define sk_CRYPTO_EX_DATA_FUNCS_find_ex(st, val) SKM_sk_find_ex(CRYPTO_EX_DATA_FUNCS, (st), (val))
+# define sk_CRYPTO_EX_DATA_FUNCS_delete(st, i) SKM_sk_delete(CRYPTO_EX_DATA_FUNCS, (st), (i))
+# define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_EX_DATA_FUNCS, (st), (ptr))
+# define sk_CRYPTO_EX_DATA_FUNCS_insert(st, val, i) SKM_sk_insert(CRYPTO_EX_DATA_FUNCS, (st), (val), (i))
+# define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_EX_DATA_FUNCS, (st), (cmp))
+# define sk_CRYPTO_EX_DATA_FUNCS_dup(st) SKM_sk_dup(CRYPTO_EX_DATA_FUNCS, st)
+# define sk_CRYPTO_EX_DATA_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_EX_DATA_FUNCS, (st), (free_func))
+# define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st))
+# define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st))
+# define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st))
+# define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st))
+# define sk_CRYPTO_dynlock_new(cmp) SKM_sk_new(CRYPTO_dynlock, (cmp))
+# define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock)
+# define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st))
+# define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st))
+# define sk_CRYPTO_dynlock_value(st, i) SKM_sk_value(CRYPTO_dynlock, (st), (i))
+# define sk_CRYPTO_dynlock_set(st, i, val) SKM_sk_set(CRYPTO_dynlock, (st), (i), (val))
+# define sk_CRYPTO_dynlock_zero(st) SKM_sk_zero(CRYPTO_dynlock, (st))
+# define sk_CRYPTO_dynlock_push(st, val) SKM_sk_push(CRYPTO_dynlock, (st), (val))
+# define sk_CRYPTO_dynlock_unshift(st, val) SKM_sk_unshift(CRYPTO_dynlock, (st), (val))
+# define sk_CRYPTO_dynlock_find(st, val) SKM_sk_find(CRYPTO_dynlock, (st), (val))
+# define sk_CRYPTO_dynlock_find_ex(st, val) SKM_sk_find_ex(CRYPTO_dynlock, (st), (val))
+# define sk_CRYPTO_dynlock_delete(st, i) SKM_sk_delete(CRYPTO_dynlock, (st), (i))
+# define sk_CRYPTO_dynlock_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_dynlock, (st), (ptr))
+# define sk_CRYPTO_dynlock_insert(st, val, i) SKM_sk_insert(CRYPTO_dynlock, (st), (val), (i))
+# define sk_CRYPTO_dynlock_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_dynlock, (st), (cmp))
+# define sk_CRYPTO_dynlock_dup(st) SKM_sk_dup(CRYPTO_dynlock, st)
+# define sk_CRYPTO_dynlock_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_dynlock, (st), (free_func))
+# define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st))
+# define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st))
+# define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st))
+# define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st))
+# define sk_DIST_POINT_new(cmp) SKM_sk_new(DIST_POINT, (cmp))
+# define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT)
+# define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st))
+# define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st))
+# define sk_DIST_POINT_value(st, i) SKM_sk_value(DIST_POINT, (st), (i))
+# define sk_DIST_POINT_set(st, i, val) SKM_sk_set(DIST_POINT, (st), (i), (val))
+# define sk_DIST_POINT_zero(st) SKM_sk_zero(DIST_POINT, (st))
+# define sk_DIST_POINT_push(st, val) SKM_sk_push(DIST_POINT, (st), (val))
+# define sk_DIST_POINT_unshift(st, val) SKM_sk_unshift(DIST_POINT, (st), (val))
+# define sk_DIST_POINT_find(st, val) SKM_sk_find(DIST_POINT, (st), (val))
+# define sk_DIST_POINT_find_ex(st, val) SKM_sk_find_ex(DIST_POINT, (st), (val))
+# define sk_DIST_POINT_delete(st, i) SKM_sk_delete(DIST_POINT, (st), (i))
+# define sk_DIST_POINT_delete_ptr(st, ptr) SKM_sk_delete_ptr(DIST_POINT, (st), (ptr))
+# define sk_DIST_POINT_insert(st, val, i) SKM_sk_insert(DIST_POINT, (st), (val), (i))
+# define sk_DIST_POINT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(DIST_POINT, (st), (cmp))
+# define sk_DIST_POINT_dup(st) SKM_sk_dup(DIST_POINT, st)
+# define sk_DIST_POINT_pop_free(st, free_func) SKM_sk_pop_free(DIST_POINT, (st), (free_func))
+# define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st))
+# define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st))
+# define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st))
+# define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st))
+# define sk_ENGINE_new(cmp) SKM_sk_new(ENGINE, (cmp))
+# define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE)
+# define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st))
+# define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st))
+# define sk_ENGINE_value(st, i) SKM_sk_value(ENGINE, (st), (i))
+# define sk_ENGINE_set(st, i, val) SKM_sk_set(ENGINE, (st), (i), (val))
+# define sk_ENGINE_zero(st) SKM_sk_zero(ENGINE, (st))
+# define sk_ENGINE_push(st, val) SKM_sk_push(ENGINE, (st), (val))
+# define sk_ENGINE_unshift(st, val) SKM_sk_unshift(ENGINE, (st), (val))
+# define sk_ENGINE_find(st, val) SKM_sk_find(ENGINE, (st), (val))
+# define sk_ENGINE_find_ex(st, val) SKM_sk_find_ex(ENGINE, (st), (val))
+# define sk_ENGINE_delete(st, i) SKM_sk_delete(ENGINE, (st), (i))
+# define sk_ENGINE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE, (st), (ptr))
+# define sk_ENGINE_insert(st, val, i) SKM_sk_insert(ENGINE, (st), (val), (i))
+# define sk_ENGINE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE, (st), (cmp))
+# define sk_ENGINE_dup(st) SKM_sk_dup(ENGINE, st)
+# define sk_ENGINE_pop_free(st, free_func) SKM_sk_pop_free(ENGINE, (st), (free_func))
+# define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st))
+# define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st))
+# define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st))
+# define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st))
+# define sk_ENGINE_CLEANUP_ITEM_new(cmp) SKM_sk_new(ENGINE_CLEANUP_ITEM, (cmp))
+# define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM)
+# define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (st))
+# define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st))
+# define sk_ENGINE_CLEANUP_ITEM_value(st, i) SKM_sk_value(ENGINE_CLEANUP_ITEM, (st), (i))
+# define sk_ENGINE_CLEANUP_ITEM_set(st, i, val) SKM_sk_set(ENGINE_CLEANUP_ITEM, (st), (i), (val))
+# define sk_ENGINE_CLEANUP_ITEM_zero(st) SKM_sk_zero(ENGINE_CLEANUP_ITEM, (st))
+# define sk_ENGINE_CLEANUP_ITEM_push(st, val) SKM_sk_push(ENGINE_CLEANUP_ITEM, (st), (val))
+# define sk_ENGINE_CLEANUP_ITEM_unshift(st, val) SKM_sk_unshift(ENGINE_CLEANUP_ITEM, (st), (val))
+# define sk_ENGINE_CLEANUP_ITEM_find(st, val) SKM_sk_find(ENGINE_CLEANUP_ITEM, (st), (val))
+# define sk_ENGINE_CLEANUP_ITEM_find_ex(st, val) SKM_sk_find_ex(ENGINE_CLEANUP_ITEM, (st), (val))
+# define sk_ENGINE_CLEANUP_ITEM_delete(st, i) SKM_sk_delete(ENGINE_CLEANUP_ITEM, (st), (i))
+# define sk_ENGINE_CLEANUP_ITEM_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE_CLEANUP_ITEM, (st), (ptr))
+# define sk_ENGINE_CLEANUP_ITEM_insert(st, val, i) SKM_sk_insert(ENGINE_CLEANUP_ITEM, (st), (val), (i))
+# define sk_ENGINE_CLEANUP_ITEM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE_CLEANUP_ITEM, (st), (cmp))
+# define sk_ENGINE_CLEANUP_ITEM_dup(st) SKM_sk_dup(ENGINE_CLEANUP_ITEM, st)
+# define sk_ENGINE_CLEANUP_ITEM_pop_free(st, free_func) SKM_sk_pop_free(ENGINE_CLEANUP_ITEM, (st), (free_func))
+# define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st))
+# define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st))
+# define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st))
+# define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st))
+# define sk_ESS_CERT_ID_new(cmp) SKM_sk_new(ESS_CERT_ID, (cmp))
+# define sk_ESS_CERT_ID_new_null() SKM_sk_new_null(ESS_CERT_ID)
+# define sk_ESS_CERT_ID_free(st) SKM_sk_free(ESS_CERT_ID, (st))
+# define sk_ESS_CERT_ID_num(st) SKM_sk_num(ESS_CERT_ID, (st))
+# define sk_ESS_CERT_ID_value(st, i) SKM_sk_value(ESS_CERT_ID, (st), (i))
+# define sk_ESS_CERT_ID_set(st, i, val) SKM_sk_set(ESS_CERT_ID, (st), (i), (val))
+# define sk_ESS_CERT_ID_zero(st) SKM_sk_zero(ESS_CERT_ID, (st))
+# define sk_ESS_CERT_ID_push(st, val) SKM_sk_push(ESS_CERT_ID, (st), (val))
+# define sk_ESS_CERT_ID_unshift(st, val) SKM_sk_unshift(ESS_CERT_ID, (st), (val))
+# define sk_ESS_CERT_ID_find(st, val) SKM_sk_find(ESS_CERT_ID, (st), (val))
+# define sk_ESS_CERT_ID_find_ex(st, val) SKM_sk_find_ex(ESS_CERT_ID, (st), (val))
+# define sk_ESS_CERT_ID_delete(st, i) SKM_sk_delete(ESS_CERT_ID, (st), (i))
+# define sk_ESS_CERT_ID_delete_ptr(st, ptr) SKM_sk_delete_ptr(ESS_CERT_ID, (st), (ptr))
+# define sk_ESS_CERT_ID_insert(st, val, i) SKM_sk_insert(ESS_CERT_ID, (st), (val), (i))
+# define sk_ESS_CERT_ID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ESS_CERT_ID, (st), (cmp))
+# define sk_ESS_CERT_ID_dup(st) SKM_sk_dup(ESS_CERT_ID, st)
+# define sk_ESS_CERT_ID_pop_free(st, free_func) SKM_sk_pop_free(ESS_CERT_ID, (st), (free_func))
+# define sk_ESS_CERT_ID_shift(st) SKM_sk_shift(ESS_CERT_ID, (st))
+# define sk_ESS_CERT_ID_pop(st) SKM_sk_pop(ESS_CERT_ID, (st))
+# define sk_ESS_CERT_ID_sort(st) SKM_sk_sort(ESS_CERT_ID, (st))
+# define sk_ESS_CERT_ID_is_sorted(st) SKM_sk_is_sorted(ESS_CERT_ID, (st))
+# define sk_EVP_MD_new(cmp) SKM_sk_new(EVP_MD, (cmp))
+# define sk_EVP_MD_new_null() SKM_sk_new_null(EVP_MD)
+# define sk_EVP_MD_free(st) SKM_sk_free(EVP_MD, (st))
+# define sk_EVP_MD_num(st) SKM_sk_num(EVP_MD, (st))
+# define sk_EVP_MD_value(st, i) SKM_sk_value(EVP_MD, (st), (i))
+# define sk_EVP_MD_set(st, i, val) SKM_sk_set(EVP_MD, (st), (i), (val))
+# define sk_EVP_MD_zero(st) SKM_sk_zero(EVP_MD, (st))
+# define sk_EVP_MD_push(st, val) SKM_sk_push(EVP_MD, (st), (val))
+# define sk_EVP_MD_unshift(st, val) SKM_sk_unshift(EVP_MD, (st), (val))
+# define sk_EVP_MD_find(st, val) SKM_sk_find(EVP_MD, (st), (val))
+# define sk_EVP_MD_find_ex(st, val) SKM_sk_find_ex(EVP_MD, (st), (val))
+# define sk_EVP_MD_delete(st, i) SKM_sk_delete(EVP_MD, (st), (i))
+# define sk_EVP_MD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_MD, (st), (ptr))
+# define sk_EVP_MD_insert(st, val, i) SKM_sk_insert(EVP_MD, (st), (val), (i))
+# define sk_EVP_MD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_MD, (st), (cmp))
+# define sk_EVP_MD_dup(st) SKM_sk_dup(EVP_MD, st)
+# define sk_EVP_MD_pop_free(st, free_func) SKM_sk_pop_free(EVP_MD, (st), (free_func))
+# define sk_EVP_MD_shift(st) SKM_sk_shift(EVP_MD, (st))
+# define sk_EVP_MD_pop(st) SKM_sk_pop(EVP_MD, (st))
+# define sk_EVP_MD_sort(st) SKM_sk_sort(EVP_MD, (st))
+# define sk_EVP_MD_is_sorted(st) SKM_sk_is_sorted(EVP_MD, (st))
+# define sk_EVP_PBE_CTL_new(cmp) SKM_sk_new(EVP_PBE_CTL, (cmp))
+# define sk_EVP_PBE_CTL_new_null() SKM_sk_new_null(EVP_PBE_CTL)
+# define sk_EVP_PBE_CTL_free(st) SKM_sk_free(EVP_PBE_CTL, (st))
+# define sk_EVP_PBE_CTL_num(st) SKM_sk_num(EVP_PBE_CTL, (st))
+# define sk_EVP_PBE_CTL_value(st, i) SKM_sk_value(EVP_PBE_CTL, (st), (i))
+# define sk_EVP_PBE_CTL_set(st, i, val) SKM_sk_set(EVP_PBE_CTL, (st), (i), (val))
+# define sk_EVP_PBE_CTL_zero(st) SKM_sk_zero(EVP_PBE_CTL, (st))
+# define sk_EVP_PBE_CTL_push(st, val) SKM_sk_push(EVP_PBE_CTL, (st), (val))
+# define sk_EVP_PBE_CTL_unshift(st, val) SKM_sk_unshift(EVP_PBE_CTL, (st), (val))
+# define sk_EVP_PBE_CTL_find(st, val) SKM_sk_find(EVP_PBE_CTL, (st), (val))
+# define sk_EVP_PBE_CTL_find_ex(st, val) SKM_sk_find_ex(EVP_PBE_CTL, (st), (val))
+# define sk_EVP_PBE_CTL_delete(st, i) SKM_sk_delete(EVP_PBE_CTL, (st), (i))
+# define sk_EVP_PBE_CTL_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PBE_CTL, (st), (ptr))
+# define sk_EVP_PBE_CTL_insert(st, val, i) SKM_sk_insert(EVP_PBE_CTL, (st), (val), (i))
+# define sk_EVP_PBE_CTL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PBE_CTL, (st), (cmp))
+# define sk_EVP_PBE_CTL_dup(st) SKM_sk_dup(EVP_PBE_CTL, st)
+# define sk_EVP_PBE_CTL_pop_free(st, free_func) SKM_sk_pop_free(EVP_PBE_CTL, (st), (free_func))
+# define sk_EVP_PBE_CTL_shift(st) SKM_sk_shift(EVP_PBE_CTL, (st))
+# define sk_EVP_PBE_CTL_pop(st) SKM_sk_pop(EVP_PBE_CTL, (st))
+# define sk_EVP_PBE_CTL_sort(st) SKM_sk_sort(EVP_PBE_CTL, (st))
+# define sk_EVP_PBE_CTL_is_sorted(st) SKM_sk_is_sorted(EVP_PBE_CTL, (st))
+# define sk_EVP_PKEY_ASN1_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_ASN1_METHOD, (cmp))
+# define sk_EVP_PKEY_ASN1_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_ASN1_METHOD)
+# define sk_EVP_PKEY_ASN1_METHOD_free(st) SKM_sk_free(EVP_PKEY_ASN1_METHOD, (st))
+# define sk_EVP_PKEY_ASN1_METHOD_num(st) SKM_sk_num(EVP_PKEY_ASN1_METHOD, (st))
+# define sk_EVP_PKEY_ASN1_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_ASN1_METHOD, (st), (i))
+# define sk_EVP_PKEY_ASN1_METHOD_set(st, i, val) SKM_sk_set(EVP_PKEY_ASN1_METHOD, (st), (i), (val))
+# define sk_EVP_PKEY_ASN1_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_ASN1_METHOD, (st))
+# define sk_EVP_PKEY_ASN1_METHOD_push(st, val) SKM_sk_push(EVP_PKEY_ASN1_METHOD, (st), (val))
+# define sk_EVP_PKEY_ASN1_METHOD_unshift(st, val) SKM_sk_unshift(EVP_PKEY_ASN1_METHOD, (st), (val))
+# define sk_EVP_PKEY_ASN1_METHOD_find(st, val) SKM_sk_find(EVP_PKEY_ASN1_METHOD, (st), (val))
+# define sk_EVP_PKEY_ASN1_METHOD_find_ex(st, val) SKM_sk_find_ex(EVP_PKEY_ASN1_METHOD, (st), (val))
+# define sk_EVP_PKEY_ASN1_METHOD_delete(st, i) SKM_sk_delete(EVP_PKEY_ASN1_METHOD, (st), (i))
+# define sk_EVP_PKEY_ASN1_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PKEY_ASN1_METHOD, (st), (ptr))
+# define sk_EVP_PKEY_ASN1_METHOD_insert(st, val, i) SKM_sk_insert(EVP_PKEY_ASN1_METHOD, (st), (val), (i))
+# define sk_EVP_PKEY_ASN1_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PKEY_ASN1_METHOD, (st), (cmp))
+# define sk_EVP_PKEY_ASN1_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_ASN1_METHOD, st)
+# define sk_EVP_PKEY_ASN1_METHOD_pop_free(st, free_func) SKM_sk_pop_free(EVP_PKEY_ASN1_METHOD, (st), (free_func))
+# define sk_EVP_PKEY_ASN1_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_ASN1_METHOD, (st))
+# define sk_EVP_PKEY_ASN1_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_ASN1_METHOD, (st))
+# define sk_EVP_PKEY_ASN1_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_ASN1_METHOD, (st))
+# define sk_EVP_PKEY_ASN1_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_ASN1_METHOD, (st))
+# define sk_EVP_PKEY_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_METHOD, (cmp))
+# define sk_EVP_PKEY_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_METHOD)
+# define sk_EVP_PKEY_METHOD_free(st) SKM_sk_free(EVP_PKEY_METHOD, (st))
+# define sk_EVP_PKEY_METHOD_num(st) SKM_sk_num(EVP_PKEY_METHOD, (st))
+# define sk_EVP_PKEY_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_METHOD, (st), (i))
+# define sk_EVP_PKEY_METHOD_set(st, i, val) SKM_sk_set(EVP_PKEY_METHOD, (st), (i), (val))
+# define sk_EVP_PKEY_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_METHOD, (st))
+# define sk_EVP_PKEY_METHOD_push(st, val) SKM_sk_push(EVP_PKEY_METHOD, (st), (val))
+# define sk_EVP_PKEY_METHOD_unshift(st, val) SKM_sk_unshift(EVP_PKEY_METHOD, (st), (val))
+# define sk_EVP_PKEY_METHOD_find(st, val) SKM_sk_find(EVP_PKEY_METHOD, (st), (val))
+# define sk_EVP_PKEY_METHOD_find_ex(st, val) SKM_sk_find_ex(EVP_PKEY_METHOD, (st), (val))
+# define sk_EVP_PKEY_METHOD_delete(st, i) SKM_sk_delete(EVP_PKEY_METHOD, (st), (i))
+# define sk_EVP_PKEY_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PKEY_METHOD, (st), (ptr))
+# define sk_EVP_PKEY_METHOD_insert(st, val, i) SKM_sk_insert(EVP_PKEY_METHOD, (st), (val), (i))
+# define sk_EVP_PKEY_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PKEY_METHOD, (st), (cmp))
+# define sk_EVP_PKEY_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_METHOD, st)
+# define sk_EVP_PKEY_METHOD_pop_free(st, free_func) SKM_sk_pop_free(EVP_PKEY_METHOD, (st), (free_func))
+# define sk_EVP_PKEY_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_METHOD, (st))
+# define sk_EVP_PKEY_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_METHOD, (st))
+# define sk_EVP_PKEY_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_METHOD, (st))
+# define sk_EVP_PKEY_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_METHOD, (st))
+# define sk_GENERAL_NAME_new(cmp) SKM_sk_new(GENERAL_NAME, (cmp))
+# define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME)
+# define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st))
+# define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st))
+# define sk_GENERAL_NAME_value(st, i) SKM_sk_value(GENERAL_NAME, (st), (i))
+# define sk_GENERAL_NAME_set(st, i, val) SKM_sk_set(GENERAL_NAME, (st), (i), (val))
+# define sk_GENERAL_NAME_zero(st) SKM_sk_zero(GENERAL_NAME, (st))
+# define sk_GENERAL_NAME_push(st, val) SKM_sk_push(GENERAL_NAME, (st), (val))
+# define sk_GENERAL_NAME_unshift(st, val) SKM_sk_unshift(GENERAL_NAME, (st), (val))
+# define sk_GENERAL_NAME_find(st, val) SKM_sk_find(GENERAL_NAME, (st), (val))
+# define sk_GENERAL_NAME_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAME, (st), (val))
+# define sk_GENERAL_NAME_delete(st, i) SKM_sk_delete(GENERAL_NAME, (st), (i))
+# define sk_GENERAL_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAME, (st), (ptr))
+# define sk_GENERAL_NAME_insert(st, val, i) SKM_sk_insert(GENERAL_NAME, (st), (val), (i))
+# define sk_GENERAL_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAME, (st), (cmp))
+# define sk_GENERAL_NAME_dup(st) SKM_sk_dup(GENERAL_NAME, st)
+# define sk_GENERAL_NAME_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAME, (st), (free_func))
+# define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st))
+# define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st))
+# define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st))
+# define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st))
+# define sk_GENERAL_NAMES_new(cmp) SKM_sk_new(GENERAL_NAMES, (cmp))
+# define sk_GENERAL_NAMES_new_null() SKM_sk_new_null(GENERAL_NAMES)
+# define sk_GENERAL_NAMES_free(st) SKM_sk_free(GENERAL_NAMES, (st))
+# define sk_GENERAL_NAMES_num(st) SKM_sk_num(GENERAL_NAMES, (st))
+# define sk_GENERAL_NAMES_value(st, i) SKM_sk_value(GENERAL_NAMES, (st), (i))
+# define sk_GENERAL_NAMES_set(st, i, val) SKM_sk_set(GENERAL_NAMES, (st), (i), (val))
+# define sk_GENERAL_NAMES_zero(st) SKM_sk_zero(GENERAL_NAMES, (st))
+# define sk_GENERAL_NAMES_push(st, val) SKM_sk_push(GENERAL_NAMES, (st), (val))
+# define sk_GENERAL_NAMES_unshift(st, val) SKM_sk_unshift(GENERAL_NAMES, (st), (val))
+# define sk_GENERAL_NAMES_find(st, val) SKM_sk_find(GENERAL_NAMES, (st), (val))
+# define sk_GENERAL_NAMES_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAMES, (st), (val))
+# define sk_GENERAL_NAMES_delete(st, i) SKM_sk_delete(GENERAL_NAMES, (st), (i))
+# define sk_GENERAL_NAMES_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAMES, (st), (ptr))
+# define sk_GENERAL_NAMES_insert(st, val, i) SKM_sk_insert(GENERAL_NAMES, (st), (val), (i))
+# define sk_GENERAL_NAMES_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAMES, (st), (cmp))
+# define sk_GENERAL_NAMES_dup(st) SKM_sk_dup(GENERAL_NAMES, st)
+# define sk_GENERAL_NAMES_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAMES, (st), (free_func))
+# define sk_GENERAL_NAMES_shift(st) SKM_sk_shift(GENERAL_NAMES, (st))
+# define sk_GENERAL_NAMES_pop(st) SKM_sk_pop(GENERAL_NAMES, (st))
+# define sk_GENERAL_NAMES_sort(st) SKM_sk_sort(GENERAL_NAMES, (st))
+# define sk_GENERAL_NAMES_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAMES, (st))
+# define sk_GENERAL_SUBTREE_new(cmp) SKM_sk_new(GENERAL_SUBTREE, (cmp))
+# define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE)
+# define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st))
+# define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st))
+# define sk_GENERAL_SUBTREE_value(st, i) SKM_sk_value(GENERAL_SUBTREE, (st), (i))
+# define sk_GENERAL_SUBTREE_set(st, i, val) SKM_sk_set(GENERAL_SUBTREE, (st), (i), (val))
+# define sk_GENERAL_SUBTREE_zero(st) SKM_sk_zero(GENERAL_SUBTREE, (st))
+# define sk_GENERAL_SUBTREE_push(st, val) SKM_sk_push(GENERAL_SUBTREE, (st), (val))
+# define sk_GENERAL_SUBTREE_unshift(st, val) SKM_sk_unshift(GENERAL_SUBTREE, (st), (val))
+# define sk_GENERAL_SUBTREE_find(st, val) SKM_sk_find(GENERAL_SUBTREE, (st), (val))
+# define sk_GENERAL_SUBTREE_find_ex(st, val) SKM_sk_find_ex(GENERAL_SUBTREE, (st), (val))
+# define sk_GENERAL_SUBTREE_delete(st, i) SKM_sk_delete(GENERAL_SUBTREE, (st), (i))
+# define sk_GENERAL_SUBTREE_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_SUBTREE, (st), (ptr))
+# define sk_GENERAL_SUBTREE_insert(st, val, i) SKM_sk_insert(GENERAL_SUBTREE, (st), (val), (i))
+# define sk_GENERAL_SUBTREE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_SUBTREE, (st), (cmp))
+# define sk_GENERAL_SUBTREE_dup(st) SKM_sk_dup(GENERAL_SUBTREE, st)
+# define sk_GENERAL_SUBTREE_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_SUBTREE, (st), (free_func))
+# define sk_GENERAL_SUBTREE_shift(st) SKM_sk_shift(GENERAL_SUBTREE, (st))
+# define sk_GENERAL_SUBTREE_pop(st) SKM_sk_pop(GENERAL_SUBTREE, (st))
+# define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st))
+# define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE, (st))
+# define sk_IPAddressFamily_new(cmp) SKM_sk_new(IPAddressFamily, (cmp))
+# define sk_IPAddressFamily_new_null() SKM_sk_new_null(IPAddressFamily)
+# define sk_IPAddressFamily_free(st) SKM_sk_free(IPAddressFamily, (st))
+# define sk_IPAddressFamily_num(st) SKM_sk_num(IPAddressFamily, (st))
+# define sk_IPAddressFamily_value(st, i) SKM_sk_value(IPAddressFamily, (st), (i))
+# define sk_IPAddressFamily_set(st, i, val) SKM_sk_set(IPAddressFamily, (st), (i), (val))
+# define sk_IPAddressFamily_zero(st) SKM_sk_zero(IPAddressFamily, (st))
+# define sk_IPAddressFamily_push(st, val) SKM_sk_push(IPAddressFamily, (st), (val))
+# define sk_IPAddressFamily_unshift(st, val) SKM_sk_unshift(IPAddressFamily, (st), (val))
+# define sk_IPAddressFamily_find(st, val) SKM_sk_find(IPAddressFamily, (st), (val))
+# define sk_IPAddressFamily_find_ex(st, val) SKM_sk_find_ex(IPAddressFamily, (st), (val))
+# define sk_IPAddressFamily_delete(st, i) SKM_sk_delete(IPAddressFamily, (st), (i))
+# define sk_IPAddressFamily_delete_ptr(st, ptr) SKM_sk_delete_ptr(IPAddressFamily, (st), (ptr))
+# define sk_IPAddressFamily_insert(st, val, i) SKM_sk_insert(IPAddressFamily, (st), (val), (i))
+# define sk_IPAddressFamily_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(IPAddressFamily, (st), (cmp))
+# define sk_IPAddressFamily_dup(st) SKM_sk_dup(IPAddressFamily, st)
+# define sk_IPAddressFamily_pop_free(st, free_func) SKM_sk_pop_free(IPAddressFamily, (st), (free_func))
+# define sk_IPAddressFamily_shift(st) SKM_sk_shift(IPAddressFamily, (st))
+# define sk_IPAddressFamily_pop(st) SKM_sk_pop(IPAddressFamily, (st))
+# define sk_IPAddressFamily_sort(st) SKM_sk_sort(IPAddressFamily, (st))
+# define sk_IPAddressFamily_is_sorted(st) SKM_sk_is_sorted(IPAddressFamily, (st))
+# define sk_IPAddressOrRange_new(cmp) SKM_sk_new(IPAddressOrRange, (cmp))
+# define sk_IPAddressOrRange_new_null() SKM_sk_new_null(IPAddressOrRange)
+# define sk_IPAddressOrRange_free(st) SKM_sk_free(IPAddressOrRange, (st))
+# define sk_IPAddressOrRange_num(st) SKM_sk_num(IPAddressOrRange, (st))
+# define sk_IPAddressOrRange_value(st, i) SKM_sk_value(IPAddressOrRange, (st), (i))
+# define sk_IPAddressOrRange_set(st, i, val) SKM_sk_set(IPAddressOrRange, (st), (i), (val))
+# define sk_IPAddressOrRange_zero(st) SKM_sk_zero(IPAddressOrRange, (st))
+# define sk_IPAddressOrRange_push(st, val) SKM_sk_push(IPAddressOrRange, (st), (val))
+# define sk_IPAddressOrRange_unshift(st, val) SKM_sk_unshift(IPAddressOrRange, (st), (val))
+# define sk_IPAddressOrRange_find(st, val) SKM_sk_find(IPAddressOrRange, (st), (val))
+# define sk_IPAddressOrRange_find_ex(st, val) SKM_sk_find_ex(IPAddressOrRange, (st), (val))
+# define sk_IPAddressOrRange_delete(st, i) SKM_sk_delete(IPAddressOrRange, (st), (i))
+# define sk_IPAddressOrRange_delete_ptr(st, ptr) SKM_sk_delete_ptr(IPAddressOrRange, (st), (ptr))
+# define sk_IPAddressOrRange_insert(st, val, i) SKM_sk_insert(IPAddressOrRange, (st), (val), (i))
+# define sk_IPAddressOrRange_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(IPAddressOrRange, (st), (cmp))
+# define sk_IPAddressOrRange_dup(st) SKM_sk_dup(IPAddressOrRange, st)
+# define sk_IPAddressOrRange_pop_free(st, free_func) SKM_sk_pop_free(IPAddressOrRange, (st), (free_func))
+# define sk_IPAddressOrRange_shift(st) SKM_sk_shift(IPAddressOrRange, (st))
+# define sk_IPAddressOrRange_pop(st) SKM_sk_pop(IPAddressOrRange, (st))
+# define sk_IPAddressOrRange_sort(st) SKM_sk_sort(IPAddressOrRange, (st))
+# define sk_IPAddressOrRange_is_sorted(st) SKM_sk_is_sorted(IPAddressOrRange, (st))
+# define sk_KRB5_APREQBODY_new(cmp) SKM_sk_new(KRB5_APREQBODY, (cmp))
+# define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY)
+# define sk_KRB5_APREQBODY_free(st) SKM_sk_free(KRB5_APREQBODY, (st))
+# define sk_KRB5_APREQBODY_num(st) SKM_sk_num(KRB5_APREQBODY, (st))
+# define sk_KRB5_APREQBODY_value(st, i) SKM_sk_value(KRB5_APREQBODY, (st), (i))
+# define sk_KRB5_APREQBODY_set(st, i, val) SKM_sk_set(KRB5_APREQBODY, (st), (i), (val))
+# define sk_KRB5_APREQBODY_zero(st) SKM_sk_zero(KRB5_APREQBODY, (st))
+# define sk_KRB5_APREQBODY_push(st, val) SKM_sk_push(KRB5_APREQBODY, (st), (val))
+# define sk_KRB5_APREQBODY_unshift(st, val) SKM_sk_unshift(KRB5_APREQBODY, (st), (val))
+# define sk_KRB5_APREQBODY_find(st, val) SKM_sk_find(KRB5_APREQBODY, (st), (val))
+# define sk_KRB5_APREQBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_APREQBODY, (st), (val))
+# define sk_KRB5_APREQBODY_delete(st, i) SKM_sk_delete(KRB5_APREQBODY, (st), (i))
+# define sk_KRB5_APREQBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_APREQBODY, (st), (ptr))
+# define sk_KRB5_APREQBODY_insert(st, val, i) SKM_sk_insert(KRB5_APREQBODY, (st), (val), (i))
+# define sk_KRB5_APREQBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_APREQBODY, (st), (cmp))
+# define sk_KRB5_APREQBODY_dup(st) SKM_sk_dup(KRB5_APREQBODY, st)
+# define sk_KRB5_APREQBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_APREQBODY, (st), (free_func))
+# define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st))
+# define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st))
+# define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st))
+# define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st))
+# define sk_KRB5_AUTHDATA_new(cmp) SKM_sk_new(KRB5_AUTHDATA, (cmp))
+# define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA)
+# define sk_KRB5_AUTHDATA_free(st) SKM_sk_free(KRB5_AUTHDATA, (st))
+# define sk_KRB5_AUTHDATA_num(st) SKM_sk_num(KRB5_AUTHDATA, (st))
+# define sk_KRB5_AUTHDATA_value(st, i) SKM_sk_value(KRB5_AUTHDATA, (st), (i))
+# define sk_KRB5_AUTHDATA_set(st, i, val) SKM_sk_set(KRB5_AUTHDATA, (st), (i), (val))
+# define sk_KRB5_AUTHDATA_zero(st) SKM_sk_zero(KRB5_AUTHDATA, (st))
+# define sk_KRB5_AUTHDATA_push(st, val) SKM_sk_push(KRB5_AUTHDATA, (st), (val))
+# define sk_KRB5_AUTHDATA_unshift(st, val) SKM_sk_unshift(KRB5_AUTHDATA, (st), (val))
+# define sk_KRB5_AUTHDATA_find(st, val) SKM_sk_find(KRB5_AUTHDATA, (st), (val))
+# define sk_KRB5_AUTHDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHDATA, (st), (val))
+# define sk_KRB5_AUTHDATA_delete(st, i) SKM_sk_delete(KRB5_AUTHDATA, (st), (i))
+# define sk_KRB5_AUTHDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHDATA, (st), (ptr))
+# define sk_KRB5_AUTHDATA_insert(st, val, i) SKM_sk_insert(KRB5_AUTHDATA, (st), (val), (i))
+# define sk_KRB5_AUTHDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHDATA, (st), (cmp))
+# define sk_KRB5_AUTHDATA_dup(st) SKM_sk_dup(KRB5_AUTHDATA, st)
+# define sk_KRB5_AUTHDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHDATA, (st), (free_func))
+# define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st))
+# define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st))
+# define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st))
+# define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st))
+# define sk_KRB5_AUTHENTBODY_new(cmp) SKM_sk_new(KRB5_AUTHENTBODY, (cmp))
+# define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY)
+# define sk_KRB5_AUTHENTBODY_free(st) SKM_sk_free(KRB5_AUTHENTBODY, (st))
+# define sk_KRB5_AUTHENTBODY_num(st) SKM_sk_num(KRB5_AUTHENTBODY, (st))
+# define sk_KRB5_AUTHENTBODY_value(st, i) SKM_sk_value(KRB5_AUTHENTBODY, (st), (i))
+# define sk_KRB5_AUTHENTBODY_set(st, i, val) SKM_sk_set(KRB5_AUTHENTBODY, (st), (i), (val))
+# define sk_KRB5_AUTHENTBODY_zero(st) SKM_sk_zero(KRB5_AUTHENTBODY, (st))
+# define sk_KRB5_AUTHENTBODY_push(st, val) SKM_sk_push(KRB5_AUTHENTBODY, (st), (val))
+# define sk_KRB5_AUTHENTBODY_unshift(st, val) SKM_sk_unshift(KRB5_AUTHENTBODY, (st), (val))
+# define sk_KRB5_AUTHENTBODY_find(st, val) SKM_sk_find(KRB5_AUTHENTBODY, (st), (val))
+# define sk_KRB5_AUTHENTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHENTBODY, (st), (val))
+# define sk_KRB5_AUTHENTBODY_delete(st, i) SKM_sk_delete(KRB5_AUTHENTBODY, (st), (i))
+# define sk_KRB5_AUTHENTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHENTBODY, (st), (ptr))
+# define sk_KRB5_AUTHENTBODY_insert(st, val, i) SKM_sk_insert(KRB5_AUTHENTBODY, (st), (val), (i))
+# define sk_KRB5_AUTHENTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHENTBODY, (st), (cmp))
+# define sk_KRB5_AUTHENTBODY_dup(st) SKM_sk_dup(KRB5_AUTHENTBODY, st)
+# define sk_KRB5_AUTHENTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHENTBODY, (st), (free_func))
+# define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st))
+# define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st))
+# define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st))
+# define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st))
+# define sk_KRB5_CHECKSUM_new(cmp) SKM_sk_new(KRB5_CHECKSUM, (cmp))
+# define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM)
+# define sk_KRB5_CHECKSUM_free(st) SKM_sk_free(KRB5_CHECKSUM, (st))
+# define sk_KRB5_CHECKSUM_num(st) SKM_sk_num(KRB5_CHECKSUM, (st))
+# define sk_KRB5_CHECKSUM_value(st, i) SKM_sk_value(KRB5_CHECKSUM, (st), (i))
+# define sk_KRB5_CHECKSUM_set(st, i, val) SKM_sk_set(KRB5_CHECKSUM, (st), (i), (val))
+# define sk_KRB5_CHECKSUM_zero(st) SKM_sk_zero(KRB5_CHECKSUM, (st))
+# define sk_KRB5_CHECKSUM_push(st, val) SKM_sk_push(KRB5_CHECKSUM, (st), (val))
+# define sk_KRB5_CHECKSUM_unshift(st, val) SKM_sk_unshift(KRB5_CHECKSUM, (st), (val))
+# define sk_KRB5_CHECKSUM_find(st, val) SKM_sk_find(KRB5_CHECKSUM, (st), (val))
+# define sk_KRB5_CHECKSUM_find_ex(st, val) SKM_sk_find_ex(KRB5_CHECKSUM, (st), (val))
+# define sk_KRB5_CHECKSUM_delete(st, i) SKM_sk_delete(KRB5_CHECKSUM, (st), (i))
+# define sk_KRB5_CHECKSUM_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_CHECKSUM, (st), (ptr))
+# define sk_KRB5_CHECKSUM_insert(st, val, i) SKM_sk_insert(KRB5_CHECKSUM, (st), (val), (i))
+# define sk_KRB5_CHECKSUM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_CHECKSUM, (st), (cmp))
+# define sk_KRB5_CHECKSUM_dup(st) SKM_sk_dup(KRB5_CHECKSUM, st)
+# define sk_KRB5_CHECKSUM_pop_free(st, free_func) SKM_sk_pop_free(KRB5_CHECKSUM, (st), (free_func))
+# define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st))
+# define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st))
+# define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st))
+# define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st))
+# define sk_KRB5_ENCDATA_new(cmp) SKM_sk_new(KRB5_ENCDATA, (cmp))
+# define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA)
+# define sk_KRB5_ENCDATA_free(st) SKM_sk_free(KRB5_ENCDATA, (st))
+# define sk_KRB5_ENCDATA_num(st) SKM_sk_num(KRB5_ENCDATA, (st))
+# define sk_KRB5_ENCDATA_value(st, i) SKM_sk_value(KRB5_ENCDATA, (st), (i))
+# define sk_KRB5_ENCDATA_set(st, i, val) SKM_sk_set(KRB5_ENCDATA, (st), (i), (val))
+# define sk_KRB5_ENCDATA_zero(st) SKM_sk_zero(KRB5_ENCDATA, (st))
+# define sk_KRB5_ENCDATA_push(st, val) SKM_sk_push(KRB5_ENCDATA, (st), (val))
+# define sk_KRB5_ENCDATA_unshift(st, val) SKM_sk_unshift(KRB5_ENCDATA, (st), (val))
+# define sk_KRB5_ENCDATA_find(st, val) SKM_sk_find(KRB5_ENCDATA, (st), (val))
+# define sk_KRB5_ENCDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCDATA, (st), (val))
+# define sk_KRB5_ENCDATA_delete(st, i) SKM_sk_delete(KRB5_ENCDATA, (st), (i))
+# define sk_KRB5_ENCDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCDATA, (st), (ptr))
+# define sk_KRB5_ENCDATA_insert(st, val, i) SKM_sk_insert(KRB5_ENCDATA, (st), (val), (i))
+# define sk_KRB5_ENCDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCDATA, (st), (cmp))
+# define sk_KRB5_ENCDATA_dup(st) SKM_sk_dup(KRB5_ENCDATA, st)
+# define sk_KRB5_ENCDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCDATA, (st), (free_func))
+# define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st))
+# define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st))
+# define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st))
+# define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st))
+# define sk_KRB5_ENCKEY_new(cmp) SKM_sk_new(KRB5_ENCKEY, (cmp))
+# define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY)
+# define sk_KRB5_ENCKEY_free(st) SKM_sk_free(KRB5_ENCKEY, (st))
+# define sk_KRB5_ENCKEY_num(st) SKM_sk_num(KRB5_ENCKEY, (st))
+# define sk_KRB5_ENCKEY_value(st, i) SKM_sk_value(KRB5_ENCKEY, (st), (i))
+# define sk_KRB5_ENCKEY_set(st, i, val) SKM_sk_set(KRB5_ENCKEY, (st), (i), (val))
+# define sk_KRB5_ENCKEY_zero(st) SKM_sk_zero(KRB5_ENCKEY, (st))
+# define sk_KRB5_ENCKEY_push(st, val) SKM_sk_push(KRB5_ENCKEY, (st), (val))
+# define sk_KRB5_ENCKEY_unshift(st, val) SKM_sk_unshift(KRB5_ENCKEY, (st), (val))
+# define sk_KRB5_ENCKEY_find(st, val) SKM_sk_find(KRB5_ENCKEY, (st), (val))
+# define sk_KRB5_ENCKEY_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCKEY, (st), (val))
+# define sk_KRB5_ENCKEY_delete(st, i) SKM_sk_delete(KRB5_ENCKEY, (st), (i))
+# define sk_KRB5_ENCKEY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCKEY, (st), (ptr))
+# define sk_KRB5_ENCKEY_insert(st, val, i) SKM_sk_insert(KRB5_ENCKEY, (st), (val), (i))
+# define sk_KRB5_ENCKEY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCKEY, (st), (cmp))
+# define sk_KRB5_ENCKEY_dup(st) SKM_sk_dup(KRB5_ENCKEY, st)
+# define sk_KRB5_ENCKEY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCKEY, (st), (free_func))
+# define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st))
+# define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st))
+# define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st))
+# define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st))
+# define sk_KRB5_PRINCNAME_new(cmp) SKM_sk_new(KRB5_PRINCNAME, (cmp))
+# define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME)
+# define sk_KRB5_PRINCNAME_free(st) SKM_sk_free(KRB5_PRINCNAME, (st))
+# define sk_KRB5_PRINCNAME_num(st) SKM_sk_num(KRB5_PRINCNAME, (st))
+# define sk_KRB5_PRINCNAME_value(st, i) SKM_sk_value(KRB5_PRINCNAME, (st), (i))
+# define sk_KRB5_PRINCNAME_set(st, i, val) SKM_sk_set(KRB5_PRINCNAME, (st), (i), (val))
+# define sk_KRB5_PRINCNAME_zero(st) SKM_sk_zero(KRB5_PRINCNAME, (st))
+# define sk_KRB5_PRINCNAME_push(st, val) SKM_sk_push(KRB5_PRINCNAME, (st), (val))
+# define sk_KRB5_PRINCNAME_unshift(st, val) SKM_sk_unshift(KRB5_PRINCNAME, (st), (val))
+# define sk_KRB5_PRINCNAME_find(st, val) SKM_sk_find(KRB5_PRINCNAME, (st), (val))
+# define sk_KRB5_PRINCNAME_find_ex(st, val) SKM_sk_find_ex(KRB5_PRINCNAME, (st), (val))
+# define sk_KRB5_PRINCNAME_delete(st, i) SKM_sk_delete(KRB5_PRINCNAME, (st), (i))
+# define sk_KRB5_PRINCNAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_PRINCNAME, (st), (ptr))
+# define sk_KRB5_PRINCNAME_insert(st, val, i) SKM_sk_insert(KRB5_PRINCNAME, (st), (val), (i))
+# define sk_KRB5_PRINCNAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_PRINCNAME, (st), (cmp))
+# define sk_KRB5_PRINCNAME_dup(st) SKM_sk_dup(KRB5_PRINCNAME, st)
+# define sk_KRB5_PRINCNAME_pop_free(st, free_func) SKM_sk_pop_free(KRB5_PRINCNAME, (st), (free_func))
+# define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st))
+# define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st))
+# define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st))
+# define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st))
+# define sk_KRB5_TKTBODY_new(cmp) SKM_sk_new(KRB5_TKTBODY, (cmp))
+# define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY)
+# define sk_KRB5_TKTBODY_free(st) SKM_sk_free(KRB5_TKTBODY, (st))
+# define sk_KRB5_TKTBODY_num(st) SKM_sk_num(KRB5_TKTBODY, (st))
+# define sk_KRB5_TKTBODY_value(st, i) SKM_sk_value(KRB5_TKTBODY, (st), (i))
+# define sk_KRB5_TKTBODY_set(st, i, val) SKM_sk_set(KRB5_TKTBODY, (st), (i), (val))
+# define sk_KRB5_TKTBODY_zero(st) SKM_sk_zero(KRB5_TKTBODY, (st))
+# define sk_KRB5_TKTBODY_push(st, val) SKM_sk_push(KRB5_TKTBODY, (st), (val))
+# define sk_KRB5_TKTBODY_unshift(st, val) SKM_sk_unshift(KRB5_TKTBODY, (st), (val))
+# define sk_KRB5_TKTBODY_find(st, val) SKM_sk_find(KRB5_TKTBODY, (st), (val))
+# define sk_KRB5_TKTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_TKTBODY, (st), (val))
+# define sk_KRB5_TKTBODY_delete(st, i) SKM_sk_delete(KRB5_TKTBODY, (st), (i))
+# define sk_KRB5_TKTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_TKTBODY, (st), (ptr))
+# define sk_KRB5_TKTBODY_insert(st, val, i) SKM_sk_insert(KRB5_TKTBODY, (st), (val), (i))
+# define sk_KRB5_TKTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_TKTBODY, (st), (cmp))
+# define sk_KRB5_TKTBODY_dup(st) SKM_sk_dup(KRB5_TKTBODY, st)
+# define sk_KRB5_TKTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_TKTBODY, (st), (free_func))
+# define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st))
+# define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st))
+# define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st))
+# define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st))
+# define sk_MEM_OBJECT_DATA_new(cmp) SKM_sk_new(MEM_OBJECT_DATA, (cmp))
+# define sk_MEM_OBJECT_DATA_new_null() SKM_sk_new_null(MEM_OBJECT_DATA)
+# define sk_MEM_OBJECT_DATA_free(st) SKM_sk_free(MEM_OBJECT_DATA, (st))
+# define sk_MEM_OBJECT_DATA_num(st) SKM_sk_num(MEM_OBJECT_DATA, (st))
+# define sk_MEM_OBJECT_DATA_value(st, i) SKM_sk_value(MEM_OBJECT_DATA, (st), (i))
+# define sk_MEM_OBJECT_DATA_set(st, i, val) SKM_sk_set(MEM_OBJECT_DATA, (st), (i), (val))
+# define sk_MEM_OBJECT_DATA_zero(st) SKM_sk_zero(MEM_OBJECT_DATA, (st))
+# define sk_MEM_OBJECT_DATA_push(st, val) SKM_sk_push(MEM_OBJECT_DATA, (st), (val))
+# define sk_MEM_OBJECT_DATA_unshift(st, val) SKM_sk_unshift(MEM_OBJECT_DATA, (st), (val))
+# define sk_MEM_OBJECT_DATA_find(st, val) SKM_sk_find(MEM_OBJECT_DATA, (st), (val))
+# define sk_MEM_OBJECT_DATA_find_ex(st, val) SKM_sk_find_ex(MEM_OBJECT_DATA, (st), (val))
+# define sk_MEM_OBJECT_DATA_delete(st, i) SKM_sk_delete(MEM_OBJECT_DATA, (st), (i))
+# define sk_MEM_OBJECT_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(MEM_OBJECT_DATA, (st), (ptr))
+# define sk_MEM_OBJECT_DATA_insert(st, val, i) SKM_sk_insert(MEM_OBJECT_DATA, (st), (val), (i))
+# define sk_MEM_OBJECT_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MEM_OBJECT_DATA, (st), (cmp))
+# define sk_MEM_OBJECT_DATA_dup(st) SKM_sk_dup(MEM_OBJECT_DATA, st)
+# define sk_MEM_OBJECT_DATA_pop_free(st, free_func) SKM_sk_pop_free(MEM_OBJECT_DATA, (st), (free_func))
+# define sk_MEM_OBJECT_DATA_shift(st) SKM_sk_shift(MEM_OBJECT_DATA, (st))
+# define sk_MEM_OBJECT_DATA_pop(st) SKM_sk_pop(MEM_OBJECT_DATA, (st))
+# define sk_MEM_OBJECT_DATA_sort(st) SKM_sk_sort(MEM_OBJECT_DATA, (st))
+# define sk_MEM_OBJECT_DATA_is_sorted(st) SKM_sk_is_sorted(MEM_OBJECT_DATA, (st))
+# define sk_MIME_HEADER_new(cmp) SKM_sk_new(MIME_HEADER, (cmp))
+# define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER)
+# define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st))
+# define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st))
+# define sk_MIME_HEADER_value(st, i) SKM_sk_value(MIME_HEADER, (st), (i))
+# define sk_MIME_HEADER_set(st, i, val) SKM_sk_set(MIME_HEADER, (st), (i), (val))
+# define sk_MIME_HEADER_zero(st) SKM_sk_zero(MIME_HEADER, (st))
+# define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val))
+# define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val))
+# define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val))
+# define sk_MIME_HEADER_find_ex(st, val) SKM_sk_find_ex(MIME_HEADER, (st), (val))
+# define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i))
+# define sk_MIME_HEADER_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr))
+# define sk_MIME_HEADER_insert(st, val, i) SKM_sk_insert(MIME_HEADER, (st), (val), (i))
+# define sk_MIME_HEADER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_HEADER, (st), (cmp))
+# define sk_MIME_HEADER_dup(st) SKM_sk_dup(MIME_HEADER, st)
+# define sk_MIME_HEADER_pop_free(st, free_func) SKM_sk_pop_free(MIME_HEADER, (st), (free_func))
+# define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st))
+# define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st))
+# define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st))
+# define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st))
+# define sk_MIME_PARAM_new(cmp) SKM_sk_new(MIME_PARAM, (cmp))
+# define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM)
+# define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st))
+# define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st))
+# define sk_MIME_PARAM_value(st, i) SKM_sk_value(MIME_PARAM, (st), (i))
+# define sk_MIME_PARAM_set(st, i, val) SKM_sk_set(MIME_PARAM, (st), (i), (val))
+# define sk_MIME_PARAM_zero(st) SKM_sk_zero(MIME_PARAM, (st))
+# define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val))
+# define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val))
+# define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val))
+# define sk_MIME_PARAM_find_ex(st, val) SKM_sk_find_ex(MIME_PARAM, (st), (val))
+# define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i))
+# define sk_MIME_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr))
+# define sk_MIME_PARAM_insert(st, val, i) SKM_sk_insert(MIME_PARAM, (st), (val), (i))
+# define sk_MIME_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_PARAM, (st), (cmp))
+# define sk_MIME_PARAM_dup(st) SKM_sk_dup(MIME_PARAM, st)
+# define sk_MIME_PARAM_pop_free(st, free_func) SKM_sk_pop_free(MIME_PARAM, (st), (free_func))
+# define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st))
+# define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st))
+# define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st))
+# define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st))
+# define sk_NAME_FUNCS_new(cmp) SKM_sk_new(NAME_FUNCS, (cmp))
+# define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS)
+# define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st))
+# define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st))
+# define sk_NAME_FUNCS_value(st, i) SKM_sk_value(NAME_FUNCS, (st), (i))
+# define sk_NAME_FUNCS_set(st, i, val) SKM_sk_set(NAME_FUNCS, (st), (i), (val))
+# define sk_NAME_FUNCS_zero(st) SKM_sk_zero(NAME_FUNCS, (st))
+# define sk_NAME_FUNCS_push(st, val) SKM_sk_push(NAME_FUNCS, (st), (val))
+# define sk_NAME_FUNCS_unshift(st, val) SKM_sk_unshift(NAME_FUNCS, (st), (val))
+# define sk_NAME_FUNCS_find(st, val) SKM_sk_find(NAME_FUNCS, (st), (val))
+# define sk_NAME_FUNCS_find_ex(st, val) SKM_sk_find_ex(NAME_FUNCS, (st), (val))
+# define sk_NAME_FUNCS_delete(st, i) SKM_sk_delete(NAME_FUNCS, (st), (i))
+# define sk_NAME_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(NAME_FUNCS, (st), (ptr))
+# define sk_NAME_FUNCS_insert(st, val, i) SKM_sk_insert(NAME_FUNCS, (st), (val), (i))
+# define sk_NAME_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(NAME_FUNCS, (st), (cmp))
+# define sk_NAME_FUNCS_dup(st) SKM_sk_dup(NAME_FUNCS, st)
+# define sk_NAME_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(NAME_FUNCS, (st), (free_func))
+# define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st))
+# define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st))
+# define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st))
+# define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st))
+# define sk_OCSP_CERTID_new(cmp) SKM_sk_new(OCSP_CERTID, (cmp))
+# define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID)
+# define sk_OCSP_CERTID_free(st) SKM_sk_free(OCSP_CERTID, (st))
+# define sk_OCSP_CERTID_num(st) SKM_sk_num(OCSP_CERTID, (st))
+# define sk_OCSP_CERTID_value(st, i) SKM_sk_value(OCSP_CERTID, (st), (i))
+# define sk_OCSP_CERTID_set(st, i, val) SKM_sk_set(OCSP_CERTID, (st), (i), (val))
+# define sk_OCSP_CERTID_zero(st) SKM_sk_zero(OCSP_CERTID, (st))
+# define sk_OCSP_CERTID_push(st, val) SKM_sk_push(OCSP_CERTID, (st), (val))
+# define sk_OCSP_CERTID_unshift(st, val) SKM_sk_unshift(OCSP_CERTID, (st), (val))
+# define sk_OCSP_CERTID_find(st, val) SKM_sk_find(OCSP_CERTID, (st), (val))
+# define sk_OCSP_CERTID_find_ex(st, val) SKM_sk_find_ex(OCSP_CERTID, (st), (val))
+# define sk_OCSP_CERTID_delete(st, i) SKM_sk_delete(OCSP_CERTID, (st), (i))
+# define sk_OCSP_CERTID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_CERTID, (st), (ptr))
+# define sk_OCSP_CERTID_insert(st, val, i) SKM_sk_insert(OCSP_CERTID, (st), (val), (i))
+# define sk_OCSP_CERTID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_CERTID, (st), (cmp))
+# define sk_OCSP_CERTID_dup(st) SKM_sk_dup(OCSP_CERTID, st)
+# define sk_OCSP_CERTID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_CERTID, (st), (free_func))
+# define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st))
+# define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st))
+# define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st))
+# define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st))
+# define sk_OCSP_ONEREQ_new(cmp) SKM_sk_new(OCSP_ONEREQ, (cmp))
+# define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ)
+# define sk_OCSP_ONEREQ_free(st) SKM_sk_free(OCSP_ONEREQ, (st))
+# define sk_OCSP_ONEREQ_num(st) SKM_sk_num(OCSP_ONEREQ, (st))
+# define sk_OCSP_ONEREQ_value(st, i) SKM_sk_value(OCSP_ONEREQ, (st), (i))
+# define sk_OCSP_ONEREQ_set(st, i, val) SKM_sk_set(OCSP_ONEREQ, (st), (i), (val))
+# define sk_OCSP_ONEREQ_zero(st) SKM_sk_zero(OCSP_ONEREQ, (st))
+# define sk_OCSP_ONEREQ_push(st, val) SKM_sk_push(OCSP_ONEREQ, (st), (val))
+# define sk_OCSP_ONEREQ_unshift(st, val) SKM_sk_unshift(OCSP_ONEREQ, (st), (val))
+# define sk_OCSP_ONEREQ_find(st, val) SKM_sk_find(OCSP_ONEREQ, (st), (val))
+# define sk_OCSP_ONEREQ_find_ex(st, val) SKM_sk_find_ex(OCSP_ONEREQ, (st), (val))
+# define sk_OCSP_ONEREQ_delete(st, i) SKM_sk_delete(OCSP_ONEREQ, (st), (i))
+# define sk_OCSP_ONEREQ_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_ONEREQ, (st), (ptr))
+# define sk_OCSP_ONEREQ_insert(st, val, i) SKM_sk_insert(OCSP_ONEREQ, (st), (val), (i))
+# define sk_OCSP_ONEREQ_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_ONEREQ, (st), (cmp))
+# define sk_OCSP_ONEREQ_dup(st) SKM_sk_dup(OCSP_ONEREQ, st)
+# define sk_OCSP_ONEREQ_pop_free(st, free_func) SKM_sk_pop_free(OCSP_ONEREQ, (st), (free_func))
+# define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st))
+# define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st))
+# define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st))
+# define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st))
+# define sk_OCSP_RESPID_new(cmp) SKM_sk_new(OCSP_RESPID, (cmp))
+# define sk_OCSP_RESPID_new_null() SKM_sk_new_null(OCSP_RESPID)
+# define sk_OCSP_RESPID_free(st) SKM_sk_free(OCSP_RESPID, (st))
+# define sk_OCSP_RESPID_num(st) SKM_sk_num(OCSP_RESPID, (st))
+# define sk_OCSP_RESPID_value(st, i) SKM_sk_value(OCSP_RESPID, (st), (i))
+# define sk_OCSP_RESPID_set(st, i, val) SKM_sk_set(OCSP_RESPID, (st), (i), (val))
+# define sk_OCSP_RESPID_zero(st) SKM_sk_zero(OCSP_RESPID, (st))
+# define sk_OCSP_RESPID_push(st, val) SKM_sk_push(OCSP_RESPID, (st), (val))
+# define sk_OCSP_RESPID_unshift(st, val) SKM_sk_unshift(OCSP_RESPID, (st), (val))
+# define sk_OCSP_RESPID_find(st, val) SKM_sk_find(OCSP_RESPID, (st), (val))
+# define sk_OCSP_RESPID_find_ex(st, val) SKM_sk_find_ex(OCSP_RESPID, (st), (val))
+# define sk_OCSP_RESPID_delete(st, i) SKM_sk_delete(OCSP_RESPID, (st), (i))
+# define sk_OCSP_RESPID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_RESPID, (st), (ptr))
+# define sk_OCSP_RESPID_insert(st, val, i) SKM_sk_insert(OCSP_RESPID, (st), (val), (i))
+# define sk_OCSP_RESPID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_RESPID, (st), (cmp))
+# define sk_OCSP_RESPID_dup(st) SKM_sk_dup(OCSP_RESPID, st)
+# define sk_OCSP_RESPID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_RESPID, (st), (free_func))
+# define sk_OCSP_RESPID_shift(st) SKM_sk_shift(OCSP_RESPID, (st))
+# define sk_OCSP_RESPID_pop(st) SKM_sk_pop(OCSP_RESPID, (st))
+# define sk_OCSP_RESPID_sort(st) SKM_sk_sort(OCSP_RESPID, (st))
+# define sk_OCSP_RESPID_is_sorted(st) SKM_sk_is_sorted(OCSP_RESPID, (st))
+# define sk_OCSP_SINGLERESP_new(cmp) SKM_sk_new(OCSP_SINGLERESP, (cmp))
+# define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP)
+# define sk_OCSP_SINGLERESP_free(st) SKM_sk_free(OCSP_SINGLERESP, (st))
+# define sk_OCSP_SINGLERESP_num(st) SKM_sk_num(OCSP_SINGLERESP, (st))
+# define sk_OCSP_SINGLERESP_value(st, i) SKM_sk_value(OCSP_SINGLERESP, (st), (i))
+# define sk_OCSP_SINGLERESP_set(st, i, val) SKM_sk_set(OCSP_SINGLERESP, (st), (i), (val))
+# define sk_OCSP_SINGLERESP_zero(st) SKM_sk_zero(OCSP_SINGLERESP, (st))
+# define sk_OCSP_SINGLERESP_push(st, val) SKM_sk_push(OCSP_SINGLERESP, (st), (val))
+# define sk_OCSP_SINGLERESP_unshift(st, val) SKM_sk_unshift(OCSP_SINGLERESP, (st), (val))
+# define sk_OCSP_SINGLERESP_find(st, val) SKM_sk_find(OCSP_SINGLERESP, (st), (val))
+# define sk_OCSP_SINGLERESP_find_ex(st, val) SKM_sk_find_ex(OCSP_SINGLERESP, (st), (val))
+# define sk_OCSP_SINGLERESP_delete(st, i) SKM_sk_delete(OCSP_SINGLERESP, (st), (i))
+# define sk_OCSP_SINGLERESP_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_SINGLERESP, (st), (ptr))
+# define sk_OCSP_SINGLERESP_insert(st, val, i) SKM_sk_insert(OCSP_SINGLERESP, (st), (val), (i))
+# define sk_OCSP_SINGLERESP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_SINGLERESP, (st), (cmp))
+# define sk_OCSP_SINGLERESP_dup(st) SKM_sk_dup(OCSP_SINGLERESP, st)
+# define sk_OCSP_SINGLERESP_pop_free(st, free_func) SKM_sk_pop_free(OCSP_SINGLERESP, (st), (free_func))
+# define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st))
+# define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st))
+# define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st))
+# define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st))
+# define sk_PKCS12_SAFEBAG_new(cmp) SKM_sk_new(PKCS12_SAFEBAG, (cmp))
+# define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG)
+# define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st))
+# define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st))
+# define sk_PKCS12_SAFEBAG_value(st, i) SKM_sk_value(PKCS12_SAFEBAG, (st), (i))
+# define sk_PKCS12_SAFEBAG_set(st, i, val) SKM_sk_set(PKCS12_SAFEBAG, (st), (i), (val))
+# define sk_PKCS12_SAFEBAG_zero(st) SKM_sk_zero(PKCS12_SAFEBAG, (st))
+# define sk_PKCS12_SAFEBAG_push(st, val) SKM_sk_push(PKCS12_SAFEBAG, (st), (val))
+# define sk_PKCS12_SAFEBAG_unshift(st, val) SKM_sk_unshift(PKCS12_SAFEBAG, (st), (val))
+# define sk_PKCS12_SAFEBAG_find(st, val) SKM_sk_find(PKCS12_SAFEBAG, (st), (val))
+# define sk_PKCS12_SAFEBAG_find_ex(st, val) SKM_sk_find_ex(PKCS12_SAFEBAG, (st), (val))
+# define sk_PKCS12_SAFEBAG_delete(st, i) SKM_sk_delete(PKCS12_SAFEBAG, (st), (i))
+# define sk_PKCS12_SAFEBAG_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS12_SAFEBAG, (st), (ptr))
+# define sk_PKCS12_SAFEBAG_insert(st, val, i) SKM_sk_insert(PKCS12_SAFEBAG, (st), (val), (i))
+# define sk_PKCS12_SAFEBAG_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS12_SAFEBAG, (st), (cmp))
+# define sk_PKCS12_SAFEBAG_dup(st) SKM_sk_dup(PKCS12_SAFEBAG, st)
+# define sk_PKCS12_SAFEBAG_pop_free(st, free_func) SKM_sk_pop_free(PKCS12_SAFEBAG, (st), (free_func))
+# define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st))
+# define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st))
+# define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st))
+# define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st))
+# define sk_PKCS7_new(cmp) SKM_sk_new(PKCS7, (cmp))
+# define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7)
+# define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st))
+# define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st))
+# define sk_PKCS7_value(st, i) SKM_sk_value(PKCS7, (st), (i))
+# define sk_PKCS7_set(st, i, val) SKM_sk_set(PKCS7, (st), (i), (val))
+# define sk_PKCS7_zero(st) SKM_sk_zero(PKCS7, (st))
+# define sk_PKCS7_push(st, val) SKM_sk_push(PKCS7, (st), (val))
+# define sk_PKCS7_unshift(st, val) SKM_sk_unshift(PKCS7, (st), (val))
+# define sk_PKCS7_find(st, val) SKM_sk_find(PKCS7, (st), (val))
+# define sk_PKCS7_find_ex(st, val) SKM_sk_find_ex(PKCS7, (st), (val))
+# define sk_PKCS7_delete(st, i) SKM_sk_delete(PKCS7, (st), (i))
+# define sk_PKCS7_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7, (st), (ptr))
+# define sk_PKCS7_insert(st, val, i) SKM_sk_insert(PKCS7, (st), (val), (i))
+# define sk_PKCS7_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7, (st), (cmp))
+# define sk_PKCS7_dup(st) SKM_sk_dup(PKCS7, st)
+# define sk_PKCS7_pop_free(st, free_func) SKM_sk_pop_free(PKCS7, (st), (free_func))
+# define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st))
+# define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st))
+# define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st))
+# define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st))
+# define sk_PKCS7_RECIP_INFO_new(cmp) SKM_sk_new(PKCS7_RECIP_INFO, (cmp))
+# define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO)
+# define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st))
+# define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st))
+# define sk_PKCS7_RECIP_INFO_value(st, i) SKM_sk_value(PKCS7_RECIP_INFO, (st), (i))
+# define sk_PKCS7_RECIP_INFO_set(st, i, val) SKM_sk_set(PKCS7_RECIP_INFO, (st), (i), (val))
+# define sk_PKCS7_RECIP_INFO_zero(st) SKM_sk_zero(PKCS7_RECIP_INFO, (st))
+# define sk_PKCS7_RECIP_INFO_push(st, val) SKM_sk_push(PKCS7_RECIP_INFO, (st), (val))
+# define sk_PKCS7_RECIP_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_RECIP_INFO, (st), (val))
+# define sk_PKCS7_RECIP_INFO_find(st, val) SKM_sk_find(PKCS7_RECIP_INFO, (st), (val))
+# define sk_PKCS7_RECIP_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_RECIP_INFO, (st), (val))
+# define sk_PKCS7_RECIP_INFO_delete(st, i) SKM_sk_delete(PKCS7_RECIP_INFO, (st), (i))
+# define sk_PKCS7_RECIP_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_RECIP_INFO, (st), (ptr))
+# define sk_PKCS7_RECIP_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_RECIP_INFO, (st), (val), (i))
+# define sk_PKCS7_RECIP_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_RECIP_INFO, (st), (cmp))
+# define sk_PKCS7_RECIP_INFO_dup(st) SKM_sk_dup(PKCS7_RECIP_INFO, st)
+# define sk_PKCS7_RECIP_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_RECIP_INFO, (st), (free_func))
+# define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st))
+# define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st))
+# define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st))
+# define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st))
+# define sk_PKCS7_SIGNER_INFO_new(cmp) SKM_sk_new(PKCS7_SIGNER_INFO, (cmp))
+# define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO)
+# define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st))
+# define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st))
+# define sk_PKCS7_SIGNER_INFO_value(st, i) SKM_sk_value(PKCS7_SIGNER_INFO, (st), (i))
+# define sk_PKCS7_SIGNER_INFO_set(st, i, val) SKM_sk_set(PKCS7_SIGNER_INFO, (st), (i), (val))
+# define sk_PKCS7_SIGNER_INFO_zero(st) SKM_sk_zero(PKCS7_SIGNER_INFO, (st))
+# define sk_PKCS7_SIGNER_INFO_push(st, val) SKM_sk_push(PKCS7_SIGNER_INFO, (st), (val))
+# define sk_PKCS7_SIGNER_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_SIGNER_INFO, (st), (val))
+# define sk_PKCS7_SIGNER_INFO_find(st, val) SKM_sk_find(PKCS7_SIGNER_INFO, (st), (val))
+# define sk_PKCS7_SIGNER_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_SIGNER_INFO, (st), (val))
+# define sk_PKCS7_SIGNER_INFO_delete(st, i) SKM_sk_delete(PKCS7_SIGNER_INFO, (st), (i))
+# define sk_PKCS7_SIGNER_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_SIGNER_INFO, (st), (ptr))
+# define sk_PKCS7_SIGNER_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_SIGNER_INFO, (st), (val), (i))
+# define sk_PKCS7_SIGNER_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_SIGNER_INFO, (st), (cmp))
+# define sk_PKCS7_SIGNER_INFO_dup(st) SKM_sk_dup(PKCS7_SIGNER_INFO, st)
+# define sk_PKCS7_SIGNER_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_SIGNER_INFO, (st), (free_func))
+# define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st))
+# define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st))
+# define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st))
+# define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st))
+# define sk_POLICYINFO_new(cmp) SKM_sk_new(POLICYINFO, (cmp))
+# define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO)
+# define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st))
+# define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st))
+# define sk_POLICYINFO_value(st, i) SKM_sk_value(POLICYINFO, (st), (i))
+# define sk_POLICYINFO_set(st, i, val) SKM_sk_set(POLICYINFO, (st), (i), (val))
+# define sk_POLICYINFO_zero(st) SKM_sk_zero(POLICYINFO, (st))
+# define sk_POLICYINFO_push(st, val) SKM_sk_push(POLICYINFO, (st), (val))
+# define sk_POLICYINFO_unshift(st, val) SKM_sk_unshift(POLICYINFO, (st), (val))
+# define sk_POLICYINFO_find(st, val) SKM_sk_find(POLICYINFO, (st), (val))
+# define sk_POLICYINFO_find_ex(st, val) SKM_sk_find_ex(POLICYINFO, (st), (val))
+# define sk_POLICYINFO_delete(st, i) SKM_sk_delete(POLICYINFO, (st), (i))
+# define sk_POLICYINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYINFO, (st), (ptr))
+# define sk_POLICYINFO_insert(st, val, i) SKM_sk_insert(POLICYINFO, (st), (val), (i))
+# define sk_POLICYINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYINFO, (st), (cmp))
+# define sk_POLICYINFO_dup(st) SKM_sk_dup(POLICYINFO, st)
+# define sk_POLICYINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYINFO, (st), (free_func))
+# define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st))
+# define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st))
+# define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st))
+# define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st))
+# define sk_POLICYQUALINFO_new(cmp) SKM_sk_new(POLICYQUALINFO, (cmp))
+# define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO)
+# define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st))
+# define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st))
+# define sk_POLICYQUALINFO_value(st, i) SKM_sk_value(POLICYQUALINFO, (st), (i))
+# define sk_POLICYQUALINFO_set(st, i, val) SKM_sk_set(POLICYQUALINFO, (st), (i), (val))
+# define sk_POLICYQUALINFO_zero(st) SKM_sk_zero(POLICYQUALINFO, (st))
+# define sk_POLICYQUALINFO_push(st, val) SKM_sk_push(POLICYQUALINFO, (st), (val))
+# define sk_POLICYQUALINFO_unshift(st, val) SKM_sk_unshift(POLICYQUALINFO, (st), (val))
+# define sk_POLICYQUALINFO_find(st, val) SKM_sk_find(POLICYQUALINFO, (st), (val))
+# define sk_POLICYQUALINFO_find_ex(st, val) SKM_sk_find_ex(POLICYQUALINFO, (st), (val))
+# define sk_POLICYQUALINFO_delete(st, i) SKM_sk_delete(POLICYQUALINFO, (st), (i))
+# define sk_POLICYQUALINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYQUALINFO, (st), (ptr))
+# define sk_POLICYQUALINFO_insert(st, val, i) SKM_sk_insert(POLICYQUALINFO, (st), (val), (i))
+# define sk_POLICYQUALINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYQUALINFO, (st), (cmp))
+# define sk_POLICYQUALINFO_dup(st) SKM_sk_dup(POLICYQUALINFO, st)
+# define sk_POLICYQUALINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYQUALINFO, (st), (free_func))
+# define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st))
+# define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st))
+# define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st))
+# define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st))
+# define sk_POLICY_MAPPING_new(cmp) SKM_sk_new(POLICY_MAPPING, (cmp))
+# define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING)
+# define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st))
+# define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st))
+# define sk_POLICY_MAPPING_value(st, i) SKM_sk_value(POLICY_MAPPING, (st), (i))
+# define sk_POLICY_MAPPING_set(st, i, val) SKM_sk_set(POLICY_MAPPING, (st), (i), (val))
+# define sk_POLICY_MAPPING_zero(st) SKM_sk_zero(POLICY_MAPPING, (st))
+# define sk_POLICY_MAPPING_push(st, val) SKM_sk_push(POLICY_MAPPING, (st), (val))
+# define sk_POLICY_MAPPING_unshift(st, val) SKM_sk_unshift(POLICY_MAPPING, (st), (val))
+# define sk_POLICY_MAPPING_find(st, val) SKM_sk_find(POLICY_MAPPING, (st), (val))
+# define sk_POLICY_MAPPING_find_ex(st, val) SKM_sk_find_ex(POLICY_MAPPING, (st), (val))
+# define sk_POLICY_MAPPING_delete(st, i) SKM_sk_delete(POLICY_MAPPING, (st), (i))
+# define sk_POLICY_MAPPING_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICY_MAPPING, (st), (ptr))
+# define sk_POLICY_MAPPING_insert(st, val, i) SKM_sk_insert(POLICY_MAPPING, (st), (val), (i))
+# define sk_POLICY_MAPPING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICY_MAPPING, (st), (cmp))
+# define sk_POLICY_MAPPING_dup(st) SKM_sk_dup(POLICY_MAPPING, st)
+# define sk_POLICY_MAPPING_pop_free(st, free_func) SKM_sk_pop_free(POLICY_MAPPING, (st), (free_func))
+# define sk_POLICY_MAPPING_shift(st) SKM_sk_shift(POLICY_MAPPING, (st))
+# define sk_POLICY_MAPPING_pop(st) SKM_sk_pop(POLICY_MAPPING, (st))
+# define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st))
+# define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (st))
+# define sk_SRP_gN_new(cmp) SKM_sk_new(SRP_gN, (cmp))
+# define sk_SRP_gN_new_null() SKM_sk_new_null(SRP_gN)
+# define sk_SRP_gN_free(st) SKM_sk_free(SRP_gN, (st))
+# define sk_SRP_gN_num(st) SKM_sk_num(SRP_gN, (st))
+# define sk_SRP_gN_value(st, i) SKM_sk_value(SRP_gN, (st), (i))
+# define sk_SRP_gN_set(st, i, val) SKM_sk_set(SRP_gN, (st), (i), (val))
+# define sk_SRP_gN_zero(st) SKM_sk_zero(SRP_gN, (st))
+# define sk_SRP_gN_push(st, val) SKM_sk_push(SRP_gN, (st), (val))
+# define sk_SRP_gN_unshift(st, val) SKM_sk_unshift(SRP_gN, (st), (val))
+# define sk_SRP_gN_find(st, val) SKM_sk_find(SRP_gN, (st), (val))
+# define sk_SRP_gN_find_ex(st, val) SKM_sk_find_ex(SRP_gN, (st), (val))
+# define sk_SRP_gN_delete(st, i) SKM_sk_delete(SRP_gN, (st), (i))
+# define sk_SRP_gN_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_gN, (st), (ptr))
+# define sk_SRP_gN_insert(st, val, i) SKM_sk_insert(SRP_gN, (st), (val), (i))
+# define sk_SRP_gN_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_gN, (st), (cmp))
+# define sk_SRP_gN_dup(st) SKM_sk_dup(SRP_gN, st)
+# define sk_SRP_gN_pop_free(st, free_func) SKM_sk_pop_free(SRP_gN, (st), (free_func))
+# define sk_SRP_gN_shift(st) SKM_sk_shift(SRP_gN, (st))
+# define sk_SRP_gN_pop(st) SKM_sk_pop(SRP_gN, (st))
+# define sk_SRP_gN_sort(st) SKM_sk_sort(SRP_gN, (st))
+# define sk_SRP_gN_is_sorted(st) SKM_sk_is_sorted(SRP_gN, (st))
+# define sk_SRP_gN_cache_new(cmp) SKM_sk_new(SRP_gN_cache, (cmp))
+# define sk_SRP_gN_cache_new_null() SKM_sk_new_null(SRP_gN_cache)
+# define sk_SRP_gN_cache_free(st) SKM_sk_free(SRP_gN_cache, (st))
+# define sk_SRP_gN_cache_num(st) SKM_sk_num(SRP_gN_cache, (st))
+# define sk_SRP_gN_cache_value(st, i) SKM_sk_value(SRP_gN_cache, (st), (i))
+# define sk_SRP_gN_cache_set(st, i, val) SKM_sk_set(SRP_gN_cache, (st), (i), (val))
+# define sk_SRP_gN_cache_zero(st) SKM_sk_zero(SRP_gN_cache, (st))
+# define sk_SRP_gN_cache_push(st, val) SKM_sk_push(SRP_gN_cache, (st), (val))
+# define sk_SRP_gN_cache_unshift(st, val) SKM_sk_unshift(SRP_gN_cache, (st), (val))
+# define sk_SRP_gN_cache_find(st, val) SKM_sk_find(SRP_gN_cache, (st), (val))
+# define sk_SRP_gN_cache_find_ex(st, val) SKM_sk_find_ex(SRP_gN_cache, (st), (val))
+# define sk_SRP_gN_cache_delete(st, i) SKM_sk_delete(SRP_gN_cache, (st), (i))
+# define sk_SRP_gN_cache_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_gN_cache, (st), (ptr))
+# define sk_SRP_gN_cache_insert(st, val, i) SKM_sk_insert(SRP_gN_cache, (st), (val), (i))
+# define sk_SRP_gN_cache_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_gN_cache, (st), (cmp))
+# define sk_SRP_gN_cache_dup(st) SKM_sk_dup(SRP_gN_cache, st)
+# define sk_SRP_gN_cache_pop_free(st, free_func) SKM_sk_pop_free(SRP_gN_cache, (st), (free_func))
+# define sk_SRP_gN_cache_shift(st) SKM_sk_shift(SRP_gN_cache, (st))
+# define sk_SRP_gN_cache_pop(st) SKM_sk_pop(SRP_gN_cache, (st))
+# define sk_SRP_gN_cache_sort(st) SKM_sk_sort(SRP_gN_cache, (st))
+# define sk_SRP_gN_cache_is_sorted(st) SKM_sk_is_sorted(SRP_gN_cache, (st))
+# define sk_SRP_user_pwd_new(cmp) SKM_sk_new(SRP_user_pwd, (cmp))
+# define sk_SRP_user_pwd_new_null() SKM_sk_new_null(SRP_user_pwd)
+# define sk_SRP_user_pwd_free(st) SKM_sk_free(SRP_user_pwd, (st))
+# define sk_SRP_user_pwd_num(st) SKM_sk_num(SRP_user_pwd, (st))
+# define sk_SRP_user_pwd_value(st, i) SKM_sk_value(SRP_user_pwd, (st), (i))
+# define sk_SRP_user_pwd_set(st, i, val) SKM_sk_set(SRP_user_pwd, (st), (i), (val))
+# define sk_SRP_user_pwd_zero(st) SKM_sk_zero(SRP_user_pwd, (st))
+# define sk_SRP_user_pwd_push(st, val) SKM_sk_push(SRP_user_pwd, (st), (val))
+# define sk_SRP_user_pwd_unshift(st, val) SKM_sk_unshift(SRP_user_pwd, (st), (val))
+# define sk_SRP_user_pwd_find(st, val) SKM_sk_find(SRP_user_pwd, (st), (val))
+# define sk_SRP_user_pwd_find_ex(st, val) SKM_sk_find_ex(SRP_user_pwd, (st), (val))
+# define sk_SRP_user_pwd_delete(st, i) SKM_sk_delete(SRP_user_pwd, (st), (i))
+# define sk_SRP_user_pwd_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_user_pwd, (st), (ptr))
+# define sk_SRP_user_pwd_insert(st, val, i) SKM_sk_insert(SRP_user_pwd, (st), (val), (i))
+# define sk_SRP_user_pwd_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_user_pwd, (st), (cmp))
+# define sk_SRP_user_pwd_dup(st) SKM_sk_dup(SRP_user_pwd, st)
+# define sk_SRP_user_pwd_pop_free(st, free_func) SKM_sk_pop_free(SRP_user_pwd, (st), (free_func))
+# define sk_SRP_user_pwd_shift(st) SKM_sk_shift(SRP_user_pwd, (st))
+# define sk_SRP_user_pwd_pop(st) SKM_sk_pop(SRP_user_pwd, (st))
+# define sk_SRP_user_pwd_sort(st) SKM_sk_sort(SRP_user_pwd, (st))
+# define sk_SRP_user_pwd_is_sorted(st) SKM_sk_is_sorted(SRP_user_pwd, (st))
+# define sk_SRTP_PROTECTION_PROFILE_new(cmp) SKM_sk_new(SRTP_PROTECTION_PROFILE, (cmp))
+# define sk_SRTP_PROTECTION_PROFILE_new_null() SKM_sk_new_null(SRTP_PROTECTION_PROFILE)
+# define sk_SRTP_PROTECTION_PROFILE_free(st) SKM_sk_free(SRTP_PROTECTION_PROFILE, (st))
+# define sk_SRTP_PROTECTION_PROFILE_num(st) SKM_sk_num(SRTP_PROTECTION_PROFILE, (st))
+# define sk_SRTP_PROTECTION_PROFILE_value(st, i) SKM_sk_value(SRTP_PROTECTION_PROFILE, (st), (i))
+# define sk_SRTP_PROTECTION_PROFILE_set(st, i, val) SKM_sk_set(SRTP_PROTECTION_PROFILE, (st), (i), (val))
+# define sk_SRTP_PROTECTION_PROFILE_zero(st) SKM_sk_zero(SRTP_PROTECTION_PROFILE, (st))
+# define sk_SRTP_PROTECTION_PROFILE_push(st, val) SKM_sk_push(SRTP_PROTECTION_PROFILE, (st), (val))
+# define sk_SRTP_PROTECTION_PROFILE_unshift(st, val) SKM_sk_unshift(SRTP_PROTECTION_PROFILE, (st), (val))
+# define sk_SRTP_PROTECTION_PROFILE_find(st, val) SKM_sk_find(SRTP_PROTECTION_PROFILE, (st), (val))
+# define sk_SRTP_PROTECTION_PROFILE_find_ex(st, val) SKM_sk_find_ex(SRTP_PROTECTION_PROFILE, (st), (val))
+# define sk_SRTP_PROTECTION_PROFILE_delete(st, i) SKM_sk_delete(SRTP_PROTECTION_PROFILE, (st), (i))
+# define sk_SRTP_PROTECTION_PROFILE_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRTP_PROTECTION_PROFILE, (st), (ptr))
+# define sk_SRTP_PROTECTION_PROFILE_insert(st, val, i) SKM_sk_insert(SRTP_PROTECTION_PROFILE, (st), (val), (i))
+# define sk_SRTP_PROTECTION_PROFILE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRTP_PROTECTION_PROFILE, (st), (cmp))
+# define sk_SRTP_PROTECTION_PROFILE_dup(st) SKM_sk_dup(SRTP_PROTECTION_PROFILE, st)
+# define sk_SRTP_PROTECTION_PROFILE_pop_free(st, free_func) SKM_sk_pop_free(SRTP_PROTECTION_PROFILE, (st), (free_func))
+# define sk_SRTP_PROTECTION_PROFILE_shift(st) SKM_sk_shift(SRTP_PROTECTION_PROFILE, (st))
+# define sk_SRTP_PROTECTION_PROFILE_pop(st) SKM_sk_pop(SRTP_PROTECTION_PROFILE, (st))
+# define sk_SRTP_PROTECTION_PROFILE_sort(st) SKM_sk_sort(SRTP_PROTECTION_PROFILE, (st))
+# define sk_SRTP_PROTECTION_PROFILE_is_sorted(st) SKM_sk_is_sorted(SRTP_PROTECTION_PROFILE, (st))
+# define sk_SSL_CIPHER_new(cmp) SKM_sk_new(SSL_CIPHER, (cmp))
+# define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER)
+# define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st))
+# define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st))
+# define sk_SSL_CIPHER_value(st, i) SKM_sk_value(SSL_CIPHER, (st), (i))
+# define sk_SSL_CIPHER_set(st, i, val) SKM_sk_set(SSL_CIPHER, (st), (i), (val))
+# define sk_SSL_CIPHER_zero(st) SKM_sk_zero(SSL_CIPHER, (st))
+# define sk_SSL_CIPHER_push(st, val) SKM_sk_push(SSL_CIPHER, (st), (val))
+# define sk_SSL_CIPHER_unshift(st, val) SKM_sk_unshift(SSL_CIPHER, (st), (val))
+# define sk_SSL_CIPHER_find(st, val) SKM_sk_find(SSL_CIPHER, (st), (val))
+# define sk_SSL_CIPHER_find_ex(st, val) SKM_sk_find_ex(SSL_CIPHER, (st), (val))
+# define sk_SSL_CIPHER_delete(st, i) SKM_sk_delete(SSL_CIPHER, (st), (i))
+# define sk_SSL_CIPHER_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_CIPHER, (st), (ptr))
+# define sk_SSL_CIPHER_insert(st, val, i) SKM_sk_insert(SSL_CIPHER, (st), (val), (i))
+# define sk_SSL_CIPHER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_CIPHER, (st), (cmp))
+# define sk_SSL_CIPHER_dup(st) SKM_sk_dup(SSL_CIPHER, st)
+# define sk_SSL_CIPHER_pop_free(st, free_func) SKM_sk_pop_free(SSL_CIPHER, (st), (free_func))
+# define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st))
+# define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st))
+# define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st))
+# define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st))
+# define sk_SSL_COMP_new(cmp) SKM_sk_new(SSL_COMP, (cmp))
+# define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP)
+# define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st))
+# define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st))
+# define sk_SSL_COMP_value(st, i) SKM_sk_value(SSL_COMP, (st), (i))
+# define sk_SSL_COMP_set(st, i, val) SKM_sk_set(SSL_COMP, (st), (i), (val))
+# define sk_SSL_COMP_zero(st) SKM_sk_zero(SSL_COMP, (st))
+# define sk_SSL_COMP_push(st, val) SKM_sk_push(SSL_COMP, (st), (val))
+# define sk_SSL_COMP_unshift(st, val) SKM_sk_unshift(SSL_COMP, (st), (val))
+# define sk_SSL_COMP_find(st, val) SKM_sk_find(SSL_COMP, (st), (val))
+# define sk_SSL_COMP_find_ex(st, val) SKM_sk_find_ex(SSL_COMP, (st), (val))
+# define sk_SSL_COMP_delete(st, i) SKM_sk_delete(SSL_COMP, (st), (i))
+# define sk_SSL_COMP_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_COMP, (st), (ptr))
+# define sk_SSL_COMP_insert(st, val, i) SKM_sk_insert(SSL_COMP, (st), (val), (i))
+# define sk_SSL_COMP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_COMP, (st), (cmp))
+# define sk_SSL_COMP_dup(st) SKM_sk_dup(SSL_COMP, st)
+# define sk_SSL_COMP_pop_free(st, free_func) SKM_sk_pop_free(SSL_COMP, (st), (free_func))
+# define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st))
+# define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st))
+# define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st))
+# define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st))
+# define sk_STACK_OF_X509_NAME_ENTRY_new(cmp) SKM_sk_new(STACK_OF_X509_NAME_ENTRY, (cmp))
+# define sk_STACK_OF_X509_NAME_ENTRY_new_null() SKM_sk_new_null(STACK_OF_X509_NAME_ENTRY)
+# define sk_STACK_OF_X509_NAME_ENTRY_free(st) SKM_sk_free(STACK_OF_X509_NAME_ENTRY, (st))
+# define sk_STACK_OF_X509_NAME_ENTRY_num(st) SKM_sk_num(STACK_OF_X509_NAME_ENTRY, (st))
+# define sk_STACK_OF_X509_NAME_ENTRY_value(st, i) SKM_sk_value(STACK_OF_X509_NAME_ENTRY, (st), (i))
+# define sk_STACK_OF_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(STACK_OF_X509_NAME_ENTRY, (st), (i), (val))
+# define sk_STACK_OF_X509_NAME_ENTRY_zero(st) SKM_sk_zero(STACK_OF_X509_NAME_ENTRY, (st))
+# define sk_STACK_OF_X509_NAME_ENTRY_push(st, val) SKM_sk_push(STACK_OF_X509_NAME_ENTRY, (st), (val))
+# define sk_STACK_OF_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(STACK_OF_X509_NAME_ENTRY, (st), (val))
+# define sk_STACK_OF_X509_NAME_ENTRY_find(st, val) SKM_sk_find(STACK_OF_X509_NAME_ENTRY, (st), (val))
+# define sk_STACK_OF_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(STACK_OF_X509_NAME_ENTRY, (st), (val))
+# define sk_STACK_OF_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(STACK_OF_X509_NAME_ENTRY, (st), (i))
+# define sk_STACK_OF_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(STACK_OF_X509_NAME_ENTRY, (st), (ptr))
+# define sk_STACK_OF_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(STACK_OF_X509_NAME_ENTRY, (st), (val), (i))
+# define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STACK_OF_X509_NAME_ENTRY, (st), (cmp))
+# define sk_STACK_OF_X509_NAME_ENTRY_dup(st) SKM_sk_dup(STACK_OF_X509_NAME_ENTRY, st)
+# define sk_STACK_OF_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(STACK_OF_X509_NAME_ENTRY, (st), (free_func))
+# define sk_STACK_OF_X509_NAME_ENTRY_shift(st) SKM_sk_shift(STACK_OF_X509_NAME_ENTRY, (st))
+# define sk_STACK_OF_X509_NAME_ENTRY_pop(st) SKM_sk_pop(STACK_OF_X509_NAME_ENTRY, (st))
+# define sk_STACK_OF_X509_NAME_ENTRY_sort(st) SKM_sk_sort(STACK_OF_X509_NAME_ENTRY, (st))
+# define sk_STACK_OF_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(STACK_OF_X509_NAME_ENTRY, (st))
+# define sk_STORE_ATTR_INFO_new(cmp) SKM_sk_new(STORE_ATTR_INFO, (cmp))
+# define sk_STORE_ATTR_INFO_new_null() SKM_sk_new_null(STORE_ATTR_INFO)
+# define sk_STORE_ATTR_INFO_free(st) SKM_sk_free(STORE_ATTR_INFO, (st))
+# define sk_STORE_ATTR_INFO_num(st) SKM_sk_num(STORE_ATTR_INFO, (st))
+# define sk_STORE_ATTR_INFO_value(st, i) SKM_sk_value(STORE_ATTR_INFO, (st), (i))
+# define sk_STORE_ATTR_INFO_set(st, i, val) SKM_sk_set(STORE_ATTR_INFO, (st), (i), (val))
+# define sk_STORE_ATTR_INFO_zero(st) SKM_sk_zero(STORE_ATTR_INFO, (st))
+# define sk_STORE_ATTR_INFO_push(st, val) SKM_sk_push(STORE_ATTR_INFO, (st), (val))
+# define sk_STORE_ATTR_INFO_unshift(st, val) SKM_sk_unshift(STORE_ATTR_INFO, (st), (val))
+# define sk_STORE_ATTR_INFO_find(st, val) SKM_sk_find(STORE_ATTR_INFO, (st), (val))
+# define sk_STORE_ATTR_INFO_find_ex(st, val) SKM_sk_find_ex(STORE_ATTR_INFO, (st), (val))
+# define sk_STORE_ATTR_INFO_delete(st, i) SKM_sk_delete(STORE_ATTR_INFO, (st), (i))
+# define sk_STORE_ATTR_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_ATTR_INFO, (st), (ptr))
+# define sk_STORE_ATTR_INFO_insert(st, val, i) SKM_sk_insert(STORE_ATTR_INFO, (st), (val), (i))
+# define sk_STORE_ATTR_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_ATTR_INFO, (st), (cmp))
+# define sk_STORE_ATTR_INFO_dup(st) SKM_sk_dup(STORE_ATTR_INFO, st)
+# define sk_STORE_ATTR_INFO_pop_free(st, free_func) SKM_sk_pop_free(STORE_ATTR_INFO, (st), (free_func))
+# define sk_STORE_ATTR_INFO_shift(st) SKM_sk_shift(STORE_ATTR_INFO, (st))
+# define sk_STORE_ATTR_INFO_pop(st) SKM_sk_pop(STORE_ATTR_INFO, (st))
+# define sk_STORE_ATTR_INFO_sort(st) SKM_sk_sort(STORE_ATTR_INFO, (st))
+# define sk_STORE_ATTR_INFO_is_sorted(st) SKM_sk_is_sorted(STORE_ATTR_INFO, (st))
+# define sk_STORE_OBJECT_new(cmp) SKM_sk_new(STORE_OBJECT, (cmp))
+# define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT)
+# define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st))
+# define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st))
+# define sk_STORE_OBJECT_value(st, i) SKM_sk_value(STORE_OBJECT, (st), (i))
+# define sk_STORE_OBJECT_set(st, i, val) SKM_sk_set(STORE_OBJECT, (st), (i), (val))
+# define sk_STORE_OBJECT_zero(st) SKM_sk_zero(STORE_OBJECT, (st))
+# define sk_STORE_OBJECT_push(st, val) SKM_sk_push(STORE_OBJECT, (st), (val))
+# define sk_STORE_OBJECT_unshift(st, val) SKM_sk_unshift(STORE_OBJECT, (st), (val))
+# define sk_STORE_OBJECT_find(st, val) SKM_sk_find(STORE_OBJECT, (st), (val))
+# define sk_STORE_OBJECT_find_ex(st, val) SKM_sk_find_ex(STORE_OBJECT, (st), (val))
+# define sk_STORE_OBJECT_delete(st, i) SKM_sk_delete(STORE_OBJECT, (st), (i))
+# define sk_STORE_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_OBJECT, (st), (ptr))
+# define sk_STORE_OBJECT_insert(st, val, i) SKM_sk_insert(STORE_OBJECT, (st), (val), (i))
+# define sk_STORE_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_OBJECT, (st), (cmp))
+# define sk_STORE_OBJECT_dup(st) SKM_sk_dup(STORE_OBJECT, st)
+# define sk_STORE_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(STORE_OBJECT, (st), (free_func))
+# define sk_STORE_OBJECT_shift(st) SKM_sk_shift(STORE_OBJECT, (st))
+# define sk_STORE_OBJECT_pop(st) SKM_sk_pop(STORE_OBJECT, (st))
+# define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st))
+# define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st))
+# define sk_SXNETID_new(cmp) SKM_sk_new(SXNETID, (cmp))
+# define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID)
+# define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st))
+# define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st))
+# define sk_SXNETID_value(st, i) SKM_sk_value(SXNETID, (st), (i))
+# define sk_SXNETID_set(st, i, val) SKM_sk_set(SXNETID, (st), (i), (val))
+# define sk_SXNETID_zero(st) SKM_sk_zero(SXNETID, (st))
+# define sk_SXNETID_push(st, val) SKM_sk_push(SXNETID, (st), (val))
+# define sk_SXNETID_unshift(st, val) SKM_sk_unshift(SXNETID, (st), (val))
+# define sk_SXNETID_find(st, val) SKM_sk_find(SXNETID, (st), (val))
+# define sk_SXNETID_find_ex(st, val) SKM_sk_find_ex(SXNETID, (st), (val))
+# define sk_SXNETID_delete(st, i) SKM_sk_delete(SXNETID, (st), (i))
+# define sk_SXNETID_delete_ptr(st, ptr) SKM_sk_delete_ptr(SXNETID, (st), (ptr))
+# define sk_SXNETID_insert(st, val, i) SKM_sk_insert(SXNETID, (st), (val), (i))
+# define sk_SXNETID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SXNETID, (st), (cmp))
+# define sk_SXNETID_dup(st) SKM_sk_dup(SXNETID, st)
+# define sk_SXNETID_pop_free(st, free_func) SKM_sk_pop_free(SXNETID, (st), (free_func))
+# define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st))
+# define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st))
+# define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st))
+# define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st))
+# define sk_UI_STRING_new(cmp) SKM_sk_new(UI_STRING, (cmp))
+# define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING)
+# define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st))
+# define sk_UI_STRING_num(st) SKM_sk_num(UI_STRING, (st))
+# define sk_UI_STRING_value(st, i) SKM_sk_value(UI_STRING, (st), (i))
+# define sk_UI_STRING_set(st, i, val) SKM_sk_set(UI_STRING, (st), (i), (val))
+# define sk_UI_STRING_zero(st) SKM_sk_zero(UI_STRING, (st))
+# define sk_UI_STRING_push(st, val) SKM_sk_push(UI_STRING, (st), (val))
+# define sk_UI_STRING_unshift(st, val) SKM_sk_unshift(UI_STRING, (st), (val))
+# define sk_UI_STRING_find(st, val) SKM_sk_find(UI_STRING, (st), (val))
+# define sk_UI_STRING_find_ex(st, val) SKM_sk_find_ex(UI_STRING, (st), (val))
+# define sk_UI_STRING_delete(st, i) SKM_sk_delete(UI_STRING, (st), (i))
+# define sk_UI_STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(UI_STRING, (st), (ptr))
+# define sk_UI_STRING_insert(st, val, i) SKM_sk_insert(UI_STRING, (st), (val), (i))
+# define sk_UI_STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(UI_STRING, (st), (cmp))
+# define sk_UI_STRING_dup(st) SKM_sk_dup(UI_STRING, st)
+# define sk_UI_STRING_pop_free(st, free_func) SKM_sk_pop_free(UI_STRING, (st), (free_func))
+# define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st))
+# define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st))
+# define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st))
+# define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st))
+# define sk_X509_new(cmp) SKM_sk_new(X509, (cmp))
+# define sk_X509_new_null() SKM_sk_new_null(X509)
+# define sk_X509_free(st) SKM_sk_free(X509, (st))
+# define sk_X509_num(st) SKM_sk_num(X509, (st))
+# define sk_X509_value(st, i) SKM_sk_value(X509, (st), (i))
+# define sk_X509_set(st, i, val) SKM_sk_set(X509, (st), (i), (val))
+# define sk_X509_zero(st) SKM_sk_zero(X509, (st))
+# define sk_X509_push(st, val) SKM_sk_push(X509, (st), (val))
+# define sk_X509_unshift(st, val) SKM_sk_unshift(X509, (st), (val))
+# define sk_X509_find(st, val) SKM_sk_find(X509, (st), (val))
+# define sk_X509_find_ex(st, val) SKM_sk_find_ex(X509, (st), (val))
+# define sk_X509_delete(st, i) SKM_sk_delete(X509, (st), (i))
+# define sk_X509_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509, (st), (ptr))
+# define sk_X509_insert(st, val, i) SKM_sk_insert(X509, (st), (val), (i))
+# define sk_X509_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509, (st), (cmp))
+# define sk_X509_dup(st) SKM_sk_dup(X509, st)
+# define sk_X509_pop_free(st, free_func) SKM_sk_pop_free(X509, (st), (free_func))
+# define sk_X509_shift(st) SKM_sk_shift(X509, (st))
+# define sk_X509_pop(st) SKM_sk_pop(X509, (st))
+# define sk_X509_sort(st) SKM_sk_sort(X509, (st))
+# define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st))
+# define sk_X509V3_EXT_METHOD_new(cmp) SKM_sk_new(X509V3_EXT_METHOD, (cmp))
+# define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD)
+# define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st))
+# define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st))
+# define sk_X509V3_EXT_METHOD_value(st, i) SKM_sk_value(X509V3_EXT_METHOD, (st), (i))
+# define sk_X509V3_EXT_METHOD_set(st, i, val) SKM_sk_set(X509V3_EXT_METHOD, (st), (i), (val))
+# define sk_X509V3_EXT_METHOD_zero(st) SKM_sk_zero(X509V3_EXT_METHOD, (st))
+# define sk_X509V3_EXT_METHOD_push(st, val) SKM_sk_push(X509V3_EXT_METHOD, (st), (val))
+# define sk_X509V3_EXT_METHOD_unshift(st, val) SKM_sk_unshift(X509V3_EXT_METHOD, (st), (val))
+# define sk_X509V3_EXT_METHOD_find(st, val) SKM_sk_find(X509V3_EXT_METHOD, (st), (val))
+# define sk_X509V3_EXT_METHOD_find_ex(st, val) SKM_sk_find_ex(X509V3_EXT_METHOD, (st), (val))
+# define sk_X509V3_EXT_METHOD_delete(st, i) SKM_sk_delete(X509V3_EXT_METHOD, (st), (i))
+# define sk_X509V3_EXT_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509V3_EXT_METHOD, (st), (ptr))
+# define sk_X509V3_EXT_METHOD_insert(st, val, i) SKM_sk_insert(X509V3_EXT_METHOD, (st), (val), (i))
+# define sk_X509V3_EXT_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509V3_EXT_METHOD, (st), (cmp))
+# define sk_X509V3_EXT_METHOD_dup(st) SKM_sk_dup(X509V3_EXT_METHOD, st)
+# define sk_X509V3_EXT_METHOD_pop_free(st, free_func) SKM_sk_pop_free(X509V3_EXT_METHOD, (st), (free_func))
+# define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st))
+# define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st))
+# define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st))
+# define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st))
+# define sk_X509_ALGOR_new(cmp) SKM_sk_new(X509_ALGOR, (cmp))
+# define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR)
+# define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st))
+# define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st))
+# define sk_X509_ALGOR_value(st, i) SKM_sk_value(X509_ALGOR, (st), (i))
+# define sk_X509_ALGOR_set(st, i, val) SKM_sk_set(X509_ALGOR, (st), (i), (val))
+# define sk_X509_ALGOR_zero(st) SKM_sk_zero(X509_ALGOR, (st))
+# define sk_X509_ALGOR_push(st, val) SKM_sk_push(X509_ALGOR, (st), (val))
+# define sk_X509_ALGOR_unshift(st, val) SKM_sk_unshift(X509_ALGOR, (st), (val))
+# define sk_X509_ALGOR_find(st, val) SKM_sk_find(X509_ALGOR, (st), (val))
+# define sk_X509_ALGOR_find_ex(st, val) SKM_sk_find_ex(X509_ALGOR, (st), (val))
+# define sk_X509_ALGOR_delete(st, i) SKM_sk_delete(X509_ALGOR, (st), (i))
+# define sk_X509_ALGOR_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ALGOR, (st), (ptr))
+# define sk_X509_ALGOR_insert(st, val, i) SKM_sk_insert(X509_ALGOR, (st), (val), (i))
+# define sk_X509_ALGOR_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ALGOR, (st), (cmp))
+# define sk_X509_ALGOR_dup(st) SKM_sk_dup(X509_ALGOR, st)
+# define sk_X509_ALGOR_pop_free(st, free_func) SKM_sk_pop_free(X509_ALGOR, (st), (free_func))
+# define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st))
+# define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st))
+# define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st))
+# define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st))
+# define sk_X509_ATTRIBUTE_new(cmp) SKM_sk_new(X509_ATTRIBUTE, (cmp))
+# define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE)
+# define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st))
+# define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st))
+# define sk_X509_ATTRIBUTE_value(st, i) SKM_sk_value(X509_ATTRIBUTE, (st), (i))
+# define sk_X509_ATTRIBUTE_set(st, i, val) SKM_sk_set(X509_ATTRIBUTE, (st), (i), (val))
+# define sk_X509_ATTRIBUTE_zero(st) SKM_sk_zero(X509_ATTRIBUTE, (st))
+# define sk_X509_ATTRIBUTE_push(st, val) SKM_sk_push(X509_ATTRIBUTE, (st), (val))
+# define sk_X509_ATTRIBUTE_unshift(st, val) SKM_sk_unshift(X509_ATTRIBUTE, (st), (val))
+# define sk_X509_ATTRIBUTE_find(st, val) SKM_sk_find(X509_ATTRIBUTE, (st), (val))
+# define sk_X509_ATTRIBUTE_find_ex(st, val) SKM_sk_find_ex(X509_ATTRIBUTE, (st), (val))
+# define sk_X509_ATTRIBUTE_delete(st, i) SKM_sk_delete(X509_ATTRIBUTE, (st), (i))
+# define sk_X509_ATTRIBUTE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ATTRIBUTE, (st), (ptr))
+# define sk_X509_ATTRIBUTE_insert(st, val, i) SKM_sk_insert(X509_ATTRIBUTE, (st), (val), (i))
+# define sk_X509_ATTRIBUTE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ATTRIBUTE, (st), (cmp))
+# define sk_X509_ATTRIBUTE_dup(st) SKM_sk_dup(X509_ATTRIBUTE, st)
+# define sk_X509_ATTRIBUTE_pop_free(st, free_func) SKM_sk_pop_free(X509_ATTRIBUTE, (st), (free_func))
+# define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st))
+# define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st))
+# define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st))
+# define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st))
+# define sk_X509_CRL_new(cmp) SKM_sk_new(X509_CRL, (cmp))
+# define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL)
+# define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st))
+# define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st))
+# define sk_X509_CRL_value(st, i) SKM_sk_value(X509_CRL, (st), (i))
+# define sk_X509_CRL_set(st, i, val) SKM_sk_set(X509_CRL, (st), (i), (val))
+# define sk_X509_CRL_zero(st) SKM_sk_zero(X509_CRL, (st))
+# define sk_X509_CRL_push(st, val) SKM_sk_push(X509_CRL, (st), (val))
+# define sk_X509_CRL_unshift(st, val) SKM_sk_unshift(X509_CRL, (st), (val))
+# define sk_X509_CRL_find(st, val) SKM_sk_find(X509_CRL, (st), (val))
+# define sk_X509_CRL_find_ex(st, val) SKM_sk_find_ex(X509_CRL, (st), (val))
+# define sk_X509_CRL_delete(st, i) SKM_sk_delete(X509_CRL, (st), (i))
+# define sk_X509_CRL_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_CRL, (st), (ptr))
+# define sk_X509_CRL_insert(st, val, i) SKM_sk_insert(X509_CRL, (st), (val), (i))
+# define sk_X509_CRL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_CRL, (st), (cmp))
+# define sk_X509_CRL_dup(st) SKM_sk_dup(X509_CRL, st)
+# define sk_X509_CRL_pop_free(st, free_func) SKM_sk_pop_free(X509_CRL, (st), (free_func))
+# define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st))
+# define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st))
+# define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st))
+# define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st))
+# define sk_X509_EXTENSION_new(cmp) SKM_sk_new(X509_EXTENSION, (cmp))
+# define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION)
+# define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st))
+# define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st))
+# define sk_X509_EXTENSION_value(st, i) SKM_sk_value(X509_EXTENSION, (st), (i))
+# define sk_X509_EXTENSION_set(st, i, val) SKM_sk_set(X509_EXTENSION, (st), (i), (val))
+# define sk_X509_EXTENSION_zero(st) SKM_sk_zero(X509_EXTENSION, (st))
+# define sk_X509_EXTENSION_push(st, val) SKM_sk_push(X509_EXTENSION, (st), (val))
+# define sk_X509_EXTENSION_unshift(st, val) SKM_sk_unshift(X509_EXTENSION, (st), (val))
+# define sk_X509_EXTENSION_find(st, val) SKM_sk_find(X509_EXTENSION, (st), (val))
+# define sk_X509_EXTENSION_find_ex(st, val) SKM_sk_find_ex(X509_EXTENSION, (st), (val))
+# define sk_X509_EXTENSION_delete(st, i) SKM_sk_delete(X509_EXTENSION, (st), (i))
+# define sk_X509_EXTENSION_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_EXTENSION, (st), (ptr))
+# define sk_X509_EXTENSION_insert(st, val, i) SKM_sk_insert(X509_EXTENSION, (st), (val), (i))
+# define sk_X509_EXTENSION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_EXTENSION, (st), (cmp))
+# define sk_X509_EXTENSION_dup(st) SKM_sk_dup(X509_EXTENSION, st)
+# define sk_X509_EXTENSION_pop_free(st, free_func) SKM_sk_pop_free(X509_EXTENSION, (st), (free_func))
+# define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st))
+# define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st))
+# define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st))
+# define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st))
+# define sk_X509_INFO_new(cmp) SKM_sk_new(X509_INFO, (cmp))
+# define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO)
+# define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st))
+# define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st))
+# define sk_X509_INFO_value(st, i) SKM_sk_value(X509_INFO, (st), (i))
+# define sk_X509_INFO_set(st, i, val) SKM_sk_set(X509_INFO, (st), (i), (val))
+# define sk_X509_INFO_zero(st) SKM_sk_zero(X509_INFO, (st))
+# define sk_X509_INFO_push(st, val) SKM_sk_push(X509_INFO, (st), (val))
+# define sk_X509_INFO_unshift(st, val) SKM_sk_unshift(X509_INFO, (st), (val))
+# define sk_X509_INFO_find(st, val) SKM_sk_find(X509_INFO, (st), (val))
+# define sk_X509_INFO_find_ex(st, val) SKM_sk_find_ex(X509_INFO, (st), (val))
+# define sk_X509_INFO_delete(st, i) SKM_sk_delete(X509_INFO, (st), (i))
+# define sk_X509_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_INFO, (st), (ptr))
+# define sk_X509_INFO_insert(st, val, i) SKM_sk_insert(X509_INFO, (st), (val), (i))
+# define sk_X509_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_INFO, (st), (cmp))
+# define sk_X509_INFO_dup(st) SKM_sk_dup(X509_INFO, st)
+# define sk_X509_INFO_pop_free(st, free_func) SKM_sk_pop_free(X509_INFO, (st), (free_func))
+# define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st))
+# define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st))
+# define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st))
+# define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st))
+# define sk_X509_LOOKUP_new(cmp) SKM_sk_new(X509_LOOKUP, (cmp))
+# define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP)
+# define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st))
+# define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st))
+# define sk_X509_LOOKUP_value(st, i) SKM_sk_value(X509_LOOKUP, (st), (i))
+# define sk_X509_LOOKUP_set(st, i, val) SKM_sk_set(X509_LOOKUP, (st), (i), (val))
+# define sk_X509_LOOKUP_zero(st) SKM_sk_zero(X509_LOOKUP, (st))
+# define sk_X509_LOOKUP_push(st, val) SKM_sk_push(X509_LOOKUP, (st), (val))
+# define sk_X509_LOOKUP_unshift(st, val) SKM_sk_unshift(X509_LOOKUP, (st), (val))
+# define sk_X509_LOOKUP_find(st, val) SKM_sk_find(X509_LOOKUP, (st), (val))
+# define sk_X509_LOOKUP_find_ex(st, val) SKM_sk_find_ex(X509_LOOKUP, (st), (val))
+# define sk_X509_LOOKUP_delete(st, i) SKM_sk_delete(X509_LOOKUP, (st), (i))
+# define sk_X509_LOOKUP_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_LOOKUP, (st), (ptr))
+# define sk_X509_LOOKUP_insert(st, val, i) SKM_sk_insert(X509_LOOKUP, (st), (val), (i))
+# define sk_X509_LOOKUP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_LOOKUP, (st), (cmp))
+# define sk_X509_LOOKUP_dup(st) SKM_sk_dup(X509_LOOKUP, st)
+# define sk_X509_LOOKUP_pop_free(st, free_func) SKM_sk_pop_free(X509_LOOKUP, (st), (free_func))
+# define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st))
+# define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st))
+# define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st))
+# define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st))
+# define sk_X509_NAME_new(cmp) SKM_sk_new(X509_NAME, (cmp))
+# define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME)
+# define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st))
+# define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st))
+# define sk_X509_NAME_value(st, i) SKM_sk_value(X509_NAME, (st), (i))
+# define sk_X509_NAME_set(st, i, val) SKM_sk_set(X509_NAME, (st), (i), (val))
+# define sk_X509_NAME_zero(st) SKM_sk_zero(X509_NAME, (st))
+# define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val))
+# define sk_X509_NAME_unshift(st, val) SKM_sk_unshift(X509_NAME, (st), (val))
+# define sk_X509_NAME_find(st, val) SKM_sk_find(X509_NAME, (st), (val))
+# define sk_X509_NAME_find_ex(st, val) SKM_sk_find_ex(X509_NAME, (st), (val))
+# define sk_X509_NAME_delete(st, i) SKM_sk_delete(X509_NAME, (st), (i))
+# define sk_X509_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME, (st), (ptr))
+# define sk_X509_NAME_insert(st, val, i) SKM_sk_insert(X509_NAME, (st), (val), (i))
+# define sk_X509_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME, (st), (cmp))
+# define sk_X509_NAME_dup(st) SKM_sk_dup(X509_NAME, st)
+# define sk_X509_NAME_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME, (st), (free_func))
+# define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st))
+# define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st))
+# define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st))
+# define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st))
+# define sk_X509_NAME_ENTRY_new(cmp) SKM_sk_new(X509_NAME_ENTRY, (cmp))
+# define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY)
+# define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st))
+# define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st))
+# define sk_X509_NAME_ENTRY_value(st, i) SKM_sk_value(X509_NAME_ENTRY, (st), (i))
+# define sk_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(X509_NAME_ENTRY, (st), (i), (val))
+# define sk_X509_NAME_ENTRY_zero(st) SKM_sk_zero(X509_NAME_ENTRY, (st))
+# define sk_X509_NAME_ENTRY_push(st, val) SKM_sk_push(X509_NAME_ENTRY, (st), (val))
+# define sk_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(X509_NAME_ENTRY, (st), (val))
+# define sk_X509_NAME_ENTRY_find(st, val) SKM_sk_find(X509_NAME_ENTRY, (st), (val))
+# define sk_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(X509_NAME_ENTRY, (st), (val))
+# define sk_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(X509_NAME_ENTRY, (st), (i))
+# define sk_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME_ENTRY, (st), (ptr))
+# define sk_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(X509_NAME_ENTRY, (st), (val), (i))
+# define sk_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME_ENTRY, (st), (cmp))
+# define sk_X509_NAME_ENTRY_dup(st) SKM_sk_dup(X509_NAME_ENTRY, st)
+# define sk_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME_ENTRY, (st), (free_func))
+# define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st))
+# define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st))
+# define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st))
+# define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st))
+# define sk_X509_OBJECT_new(cmp) SKM_sk_new(X509_OBJECT, (cmp))
+# define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT)
+# define sk_X509_OBJECT_free(st) SKM_sk_free(X509_OBJECT, (st))
+# define sk_X509_OBJECT_num(st) SKM_sk_num(X509_OBJECT, (st))
+# define sk_X509_OBJECT_value(st, i) SKM_sk_value(X509_OBJECT, (st), (i))
+# define sk_X509_OBJECT_set(st, i, val) SKM_sk_set(X509_OBJECT, (st), (i), (val))
+# define sk_X509_OBJECT_zero(st) SKM_sk_zero(X509_OBJECT, (st))
+# define sk_X509_OBJECT_push(st, val) SKM_sk_push(X509_OBJECT, (st), (val))
+# define sk_X509_OBJECT_unshift(st, val) SKM_sk_unshift(X509_OBJECT, (st), (val))
+# define sk_X509_OBJECT_find(st, val) SKM_sk_find(X509_OBJECT, (st), (val))
+# define sk_X509_OBJECT_find_ex(st, val) SKM_sk_find_ex(X509_OBJECT, (st), (val))
+# define sk_X509_OBJECT_delete(st, i) SKM_sk_delete(X509_OBJECT, (st), (i))
+# define sk_X509_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_OBJECT, (st), (ptr))
+# define sk_X509_OBJECT_insert(st, val, i) SKM_sk_insert(X509_OBJECT, (st), (val), (i))
+# define sk_X509_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_OBJECT, (st), (cmp))
+# define sk_X509_OBJECT_dup(st) SKM_sk_dup(X509_OBJECT, st)
+# define sk_X509_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(X509_OBJECT, (st), (free_func))
+# define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st))
+# define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st))
+# define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st))
+# define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st))
+# define sk_X509_POLICY_DATA_new(cmp) SKM_sk_new(X509_POLICY_DATA, (cmp))
+# define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA)
+# define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st))
+# define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st))
+# define sk_X509_POLICY_DATA_value(st, i) SKM_sk_value(X509_POLICY_DATA, (st), (i))
+# define sk_X509_POLICY_DATA_set(st, i, val) SKM_sk_set(X509_POLICY_DATA, (st), (i), (val))
+# define sk_X509_POLICY_DATA_zero(st) SKM_sk_zero(X509_POLICY_DATA, (st))
+# define sk_X509_POLICY_DATA_push(st, val) SKM_sk_push(X509_POLICY_DATA, (st), (val))
+# define sk_X509_POLICY_DATA_unshift(st, val) SKM_sk_unshift(X509_POLICY_DATA, (st), (val))
+# define sk_X509_POLICY_DATA_find(st, val) SKM_sk_find(X509_POLICY_DATA, (st), (val))
+# define sk_X509_POLICY_DATA_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_DATA, (st), (val))
+# define sk_X509_POLICY_DATA_delete(st, i) SKM_sk_delete(X509_POLICY_DATA, (st), (i))
+# define sk_X509_POLICY_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_DATA, (st), (ptr))
+# define sk_X509_POLICY_DATA_insert(st, val, i) SKM_sk_insert(X509_POLICY_DATA, (st), (val), (i))
+# define sk_X509_POLICY_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_DATA, (st), (cmp))
+# define sk_X509_POLICY_DATA_dup(st) SKM_sk_dup(X509_POLICY_DATA, st)
+# define sk_X509_POLICY_DATA_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_DATA, (st), (free_func))
+# define sk_X509_POLICY_DATA_shift(st) SKM_sk_shift(X509_POLICY_DATA, (st))
+# define sk_X509_POLICY_DATA_pop(st) SKM_sk_pop(X509_POLICY_DATA, (st))
+# define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st))
+# define sk_X509_POLICY_DATA_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_DATA, (st))
+# define sk_X509_POLICY_NODE_new(cmp) SKM_sk_new(X509_POLICY_NODE, (cmp))
+# define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE)
+# define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st))
+# define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st))
+# define sk_X509_POLICY_NODE_value(st, i) SKM_sk_value(X509_POLICY_NODE, (st), (i))
+# define sk_X509_POLICY_NODE_set(st, i, val) SKM_sk_set(X509_POLICY_NODE, (st), (i), (val))
+# define sk_X509_POLICY_NODE_zero(st) SKM_sk_zero(X509_POLICY_NODE, (st))
+# define sk_X509_POLICY_NODE_push(st, val) SKM_sk_push(X509_POLICY_NODE, (st), (val))
+# define sk_X509_POLICY_NODE_unshift(st, val) SKM_sk_unshift(X509_POLICY_NODE, (st), (val))
+# define sk_X509_POLICY_NODE_find(st, val) SKM_sk_find(X509_POLICY_NODE, (st), (val))
+# define sk_X509_POLICY_NODE_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_NODE, (st), (val))
+# define sk_X509_POLICY_NODE_delete(st, i) SKM_sk_delete(X509_POLICY_NODE, (st), (i))
+# define sk_X509_POLICY_NODE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_NODE, (st), (ptr))
+# define sk_X509_POLICY_NODE_insert(st, val, i) SKM_sk_insert(X509_POLICY_NODE, (st), (val), (i))
+# define sk_X509_POLICY_NODE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_NODE, (st), (cmp))
+# define sk_X509_POLICY_NODE_dup(st) SKM_sk_dup(X509_POLICY_NODE, st)
+# define sk_X509_POLICY_NODE_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_NODE, (st), (free_func))
+# define sk_X509_POLICY_NODE_shift(st) SKM_sk_shift(X509_POLICY_NODE, (st))
+# define sk_X509_POLICY_NODE_pop(st) SKM_sk_pop(X509_POLICY_NODE, (st))
+# define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st))
+# define sk_X509_POLICY_NODE_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_NODE, (st))
+# define sk_X509_PURPOSE_new(cmp) SKM_sk_new(X509_PURPOSE, (cmp))
+# define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE)
+# define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st))
+# define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st))
+# define sk_X509_PURPOSE_value(st, i) SKM_sk_value(X509_PURPOSE, (st), (i))
+# define sk_X509_PURPOSE_set(st, i, val) SKM_sk_set(X509_PURPOSE, (st), (i), (val))
+# define sk_X509_PURPOSE_zero(st) SKM_sk_zero(X509_PURPOSE, (st))
+# define sk_X509_PURPOSE_push(st, val) SKM_sk_push(X509_PURPOSE, (st), (val))
+# define sk_X509_PURPOSE_unshift(st, val) SKM_sk_unshift(X509_PURPOSE, (st), (val))
+# define sk_X509_PURPOSE_find(st, val) SKM_sk_find(X509_PURPOSE, (st), (val))
+# define sk_X509_PURPOSE_find_ex(st, val) SKM_sk_find_ex(X509_PURPOSE, (st), (val))
+# define sk_X509_PURPOSE_delete(st, i) SKM_sk_delete(X509_PURPOSE, (st), (i))
+# define sk_X509_PURPOSE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_PURPOSE, (st), (ptr))
+# define sk_X509_PURPOSE_insert(st, val, i) SKM_sk_insert(X509_PURPOSE, (st), (val), (i))
+# define sk_X509_PURPOSE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_PURPOSE, (st), (cmp))
+# define sk_X509_PURPOSE_dup(st) SKM_sk_dup(X509_PURPOSE, st)
+# define sk_X509_PURPOSE_pop_free(st, free_func) SKM_sk_pop_free(X509_PURPOSE, (st), (free_func))
+# define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st))
+# define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st))
+# define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st))
+# define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st))
+# define sk_X509_REVOKED_new(cmp) SKM_sk_new(X509_REVOKED, (cmp))
+# define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED)
+# define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st))
+# define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st))
+# define sk_X509_REVOKED_value(st, i) SKM_sk_value(X509_REVOKED, (st), (i))
+# define sk_X509_REVOKED_set(st, i, val) SKM_sk_set(X509_REVOKED, (st), (i), (val))
+# define sk_X509_REVOKED_zero(st) SKM_sk_zero(X509_REVOKED, (st))
+# define sk_X509_REVOKED_push(st, val) SKM_sk_push(X509_REVOKED, (st), (val))
+# define sk_X509_REVOKED_unshift(st, val) SKM_sk_unshift(X509_REVOKED, (st), (val))
+# define sk_X509_REVOKED_find(st, val) SKM_sk_find(X509_REVOKED, (st), (val))
+# define sk_X509_REVOKED_find_ex(st, val) SKM_sk_find_ex(X509_REVOKED, (st), (val))
+# define sk_X509_REVOKED_delete(st, i) SKM_sk_delete(X509_REVOKED, (st), (i))
+# define sk_X509_REVOKED_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_REVOKED, (st), (ptr))
+# define sk_X509_REVOKED_insert(st, val, i) SKM_sk_insert(X509_REVOKED, (st), (val), (i))
+# define sk_X509_REVOKED_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_REVOKED, (st), (cmp))
+# define sk_X509_REVOKED_dup(st) SKM_sk_dup(X509_REVOKED, st)
+# define sk_X509_REVOKED_pop_free(st, free_func) SKM_sk_pop_free(X509_REVOKED, (st), (free_func))
+# define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st))
+# define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st))
+# define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st))
+# define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st))
+# define sk_X509_TRUST_new(cmp) SKM_sk_new(X509_TRUST, (cmp))
+# define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST)
+# define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st))
+# define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st))
+# define sk_X509_TRUST_value(st, i) SKM_sk_value(X509_TRUST, (st), (i))
+# define sk_X509_TRUST_set(st, i, val) SKM_sk_set(X509_TRUST, (st), (i), (val))
+# define sk_X509_TRUST_zero(st) SKM_sk_zero(X509_TRUST, (st))
+# define sk_X509_TRUST_push(st, val) SKM_sk_push(X509_TRUST, (st), (val))
+# define sk_X509_TRUST_unshift(st, val) SKM_sk_unshift(X509_TRUST, (st), (val))
+# define sk_X509_TRUST_find(st, val) SKM_sk_find(X509_TRUST, (st), (val))
+# define sk_X509_TRUST_find_ex(st, val) SKM_sk_find_ex(X509_TRUST, (st), (val))
+# define sk_X509_TRUST_delete(st, i) SKM_sk_delete(X509_TRUST, (st), (i))
+# define sk_X509_TRUST_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_TRUST, (st), (ptr))
+# define sk_X509_TRUST_insert(st, val, i) SKM_sk_insert(X509_TRUST, (st), (val), (i))
+# define sk_X509_TRUST_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_TRUST, (st), (cmp))
+# define sk_X509_TRUST_dup(st) SKM_sk_dup(X509_TRUST, st)
+# define sk_X509_TRUST_pop_free(st, free_func) SKM_sk_pop_free(X509_TRUST, (st), (free_func))
+# define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st))
+# define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st))
+# define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st))
+# define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st))
+# define sk_X509_VERIFY_PARAM_new(cmp) SKM_sk_new(X509_VERIFY_PARAM, (cmp))
+# define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM)
+# define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st))
+# define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st))
+# define sk_X509_VERIFY_PARAM_value(st, i) SKM_sk_value(X509_VERIFY_PARAM, (st), (i))
+# define sk_X509_VERIFY_PARAM_set(st, i, val) SKM_sk_set(X509_VERIFY_PARAM, (st), (i), (val))
+# define sk_X509_VERIFY_PARAM_zero(st) SKM_sk_zero(X509_VERIFY_PARAM, (st))
+# define sk_X509_VERIFY_PARAM_push(st, val) SKM_sk_push(X509_VERIFY_PARAM, (st), (val))
+# define sk_X509_VERIFY_PARAM_unshift(st, val) SKM_sk_unshift(X509_VERIFY_PARAM, (st), (val))
+# define sk_X509_VERIFY_PARAM_find(st, val) SKM_sk_find(X509_VERIFY_PARAM, (st), (val))
+# define sk_X509_VERIFY_PARAM_find_ex(st, val) SKM_sk_find_ex(X509_VERIFY_PARAM, (st), (val))
+# define sk_X509_VERIFY_PARAM_delete(st, i) SKM_sk_delete(X509_VERIFY_PARAM, (st), (i))
+# define sk_X509_VERIFY_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_VERIFY_PARAM, (st), (ptr))
+# define sk_X509_VERIFY_PARAM_insert(st, val, i) SKM_sk_insert(X509_VERIFY_PARAM, (st), (val), (i))
+# define sk_X509_VERIFY_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_VERIFY_PARAM, (st), (cmp))
+# define sk_X509_VERIFY_PARAM_dup(st) SKM_sk_dup(X509_VERIFY_PARAM, st)
+# define sk_X509_VERIFY_PARAM_pop_free(st, free_func) SKM_sk_pop_free(X509_VERIFY_PARAM, (st), (free_func))
+# define sk_X509_VERIFY_PARAM_shift(st) SKM_sk_shift(X509_VERIFY_PARAM, (st))
+# define sk_X509_VERIFY_PARAM_pop(st) SKM_sk_pop(X509_VERIFY_PARAM, (st))
+# define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st))
+# define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PARAM, (st))
+# define sk_nid_triple_new(cmp) SKM_sk_new(nid_triple, (cmp))
+# define sk_nid_triple_new_null() SKM_sk_new_null(nid_triple)
+# define sk_nid_triple_free(st) SKM_sk_free(nid_triple, (st))
+# define sk_nid_triple_num(st) SKM_sk_num(nid_triple, (st))
+# define sk_nid_triple_value(st, i) SKM_sk_value(nid_triple, (st), (i))
+# define sk_nid_triple_set(st, i, val) SKM_sk_set(nid_triple, (st), (i), (val))
+# define sk_nid_triple_zero(st) SKM_sk_zero(nid_triple, (st))
+# define sk_nid_triple_push(st, val) SKM_sk_push(nid_triple, (st), (val))
+# define sk_nid_triple_unshift(st, val) SKM_sk_unshift(nid_triple, (st), (val))
+# define sk_nid_triple_find(st, val) SKM_sk_find(nid_triple, (st), (val))
+# define sk_nid_triple_find_ex(st, val) SKM_sk_find_ex(nid_triple, (st), (val))
+# define sk_nid_triple_delete(st, i) SKM_sk_delete(nid_triple, (st), (i))
+# define sk_nid_triple_delete_ptr(st, ptr) SKM_sk_delete_ptr(nid_triple, (st), (ptr))
+# define sk_nid_triple_insert(st, val, i) SKM_sk_insert(nid_triple, (st), (val), (i))
+# define sk_nid_triple_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(nid_triple, (st), (cmp))
+# define sk_nid_triple_dup(st) SKM_sk_dup(nid_triple, st)
+# define sk_nid_triple_pop_free(st, free_func) SKM_sk_pop_free(nid_triple, (st), (free_func))
+# define sk_nid_triple_shift(st) SKM_sk_shift(nid_triple, (st))
+# define sk_nid_triple_pop(st) SKM_sk_pop(nid_triple, (st))
+# define sk_nid_triple_sort(st) SKM_sk_sort(nid_triple, (st))
+# define sk_nid_triple_is_sorted(st) SKM_sk_is_sorted(nid_triple, (st))
+# define sk_void_new(cmp) SKM_sk_new(void, (cmp))
+# define sk_void_new_null() SKM_sk_new_null(void)
+# define sk_void_free(st) SKM_sk_free(void, (st))
+# define sk_void_num(st) SKM_sk_num(void, (st))
+# define sk_void_value(st, i) SKM_sk_value(void, (st), (i))
+# define sk_void_set(st, i, val) SKM_sk_set(void, (st), (i), (val))
+# define sk_void_zero(st) SKM_sk_zero(void, (st))
+# define sk_void_push(st, val) SKM_sk_push(void, (st), (val))
+# define sk_void_unshift(st, val) SKM_sk_unshift(void, (st), (val))
+# define sk_void_find(st, val) SKM_sk_find(void, (st), (val))
+# define sk_void_find_ex(st, val) SKM_sk_find_ex(void, (st), (val))
+# define sk_void_delete(st, i) SKM_sk_delete(void, (st), (i))
+# define sk_void_delete_ptr(st, ptr) SKM_sk_delete_ptr(void, (st), (ptr))
+# define sk_void_insert(st, val, i) SKM_sk_insert(void, (st), (val), (i))
+# define sk_void_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(void, (st), (cmp))
+# define sk_void_dup(st) SKM_sk_dup(void, st)
+# define sk_void_pop_free(st, free_func) SKM_sk_pop_free(void, (st), (free_func))
+# define sk_void_shift(st) SKM_sk_shift(void, (st))
+# define sk_void_pop(st) SKM_sk_pop(void, (st))
+# define sk_void_sort(st) SKM_sk_sort(void, (st))
+# define sk_void_is_sorted(st) SKM_sk_is_sorted(void, (st))
+# define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_SK_CMP_FUNC(char, cmp)))
+# define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null())
+# define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val))
+# define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val))
+# define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_STACK_OF(OPENSSL_STRING, st), i))
+# define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st)
+# define sk_OPENSSL_STRING_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_FREE_FUNC2(OPENSSL_STRING, free_func))
+# define sk_OPENSSL_STRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val), i)
+# define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st)
+# define sk_OPENSSL_STRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_STRING, st), i, CHECKED_PTR_OF(char, val))
+# define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st))
+# define sk_OPENSSL_STRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val))
+# define sk_OPENSSL_STRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_CONST_PTR_OF(char, val))
+# define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i))
+# define sk_OPENSSL_STRING_delete_ptr(st, ptr) (OPENSSL_STRING *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, ptr))
+# define sk_OPENSSL_STRING_set_cmp_func(st, cmp)  \
+        ((int (*)(const char * const *,const char * const *)) \
+        sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_CMP_FUNC(char, cmp)))
+# define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st)
+# define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st))
+# define sk_OPENSSL_STRING_pop(st) (char *)sk_pop(CHECKED_STACK_OF(OPENSSL_STRING, st))
+# define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st))
+# define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st))
+# define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_SK_CMP_FUNC(void, cmp)))
+# define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null())
+# define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))
+# define sk_OPENSSL_BLOCK_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))
+# define sk_OPENSSL_BLOCK_value(st, i) ((OPENSSL_BLOCK)sk_value(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i))
+# define sk_OPENSSL_BLOCK_num(st) SKM_sk_num(OPENSSL_BLOCK, st)
+# define sk_OPENSSL_BLOCK_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_FREE_FUNC2(OPENSSL_BLOCK, free_func))
+# define sk_OPENSSL_BLOCK_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val), i)
+# define sk_OPENSSL_BLOCK_free(st) SKM_sk_free(OPENSSL_BLOCK, st)
+# define sk_OPENSSL_BLOCK_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i, CHECKED_PTR_OF(void, val))
+# define sk_OPENSSL_BLOCK_zero(st) SKM_sk_zero(OPENSSL_BLOCK, (st))
+# define sk_OPENSSL_BLOCK_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))
+# define sk_OPENSSL_BLOCK_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_CONST_PTR_OF(void, val))
+# define sk_OPENSSL_BLOCK_delete(st, i) SKM_sk_delete(OPENSSL_BLOCK, (st), (i))
+# define sk_OPENSSL_BLOCK_delete_ptr(st, ptr) (OPENSSL_BLOCK *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, ptr))
+# define sk_OPENSSL_BLOCK_set_cmp_func(st, cmp)  \
+        ((int (*)(const void * const *,const void * const *)) \
+        sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_CMP_FUNC(void, cmp)))
+# define sk_OPENSSL_BLOCK_dup(st) SKM_sk_dup(OPENSSL_BLOCK, st)
+# define sk_OPENSSL_BLOCK_shift(st) SKM_sk_shift(OPENSSL_BLOCK, (st))
+# define sk_OPENSSL_BLOCK_pop(st) (void *)sk_pop(CHECKED_STACK_OF(OPENSSL_BLOCK, st))
+# define sk_OPENSSL_BLOCK_sort(st) SKM_sk_sort(OPENSSL_BLOCK, (st))
+# define sk_OPENSSL_BLOCK_is_sorted(st) SKM_sk_is_sorted(OPENSSL_BLOCK, (st))
+# define sk_OPENSSL_PSTRING_new(cmp) ((STACK_OF(OPENSSL_PSTRING) *)sk_new(CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp)))
+# define sk_OPENSSL_PSTRING_new_null() ((STACK_OF(OPENSSL_PSTRING) *)sk_new_null())
+# define sk_OPENSSL_PSTRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))
+# define sk_OPENSSL_PSTRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))
+# define sk_OPENSSL_PSTRING_value(st, i) ((OPENSSL_PSTRING)sk_value(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i))
+# define sk_OPENSSL_PSTRING_num(st) SKM_sk_num(OPENSSL_PSTRING, st)
+# define sk_OPENSSL_PSTRING_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_FREE_FUNC2(OPENSSL_PSTRING, free_func))
+# define sk_OPENSSL_PSTRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val), i)
+# define sk_OPENSSL_PSTRING_free(st) SKM_sk_free(OPENSSL_PSTRING, st)
+# define sk_OPENSSL_PSTRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i, CHECKED_PTR_OF(OPENSSL_STRING, val))
+# define sk_OPENSSL_PSTRING_zero(st) SKM_sk_zero(OPENSSL_PSTRING, (st))
+# define sk_OPENSSL_PSTRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))
+# define sk_OPENSSL_PSTRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_CONST_PTR_OF(OPENSSL_STRING, val))
+# define sk_OPENSSL_PSTRING_delete(st, i) SKM_sk_delete(OPENSSL_PSTRING, (st), (i))
+# define sk_OPENSSL_PSTRING_delete_ptr(st, ptr) (OPENSSL_PSTRING *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, ptr))
+# define sk_OPENSSL_PSTRING_set_cmp_func(st, cmp)  \
+        ((int (*)(const OPENSSL_STRING * const *,const OPENSSL_STRING * const *)) \
+        sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp)))
+# define sk_OPENSSL_PSTRING_dup(st) SKM_sk_dup(OPENSSL_PSTRING, st)
+# define sk_OPENSSL_PSTRING_shift(st) SKM_sk_shift(OPENSSL_PSTRING, (st))
+# define sk_OPENSSL_PSTRING_pop(st) (OPENSSL_STRING *)sk_pop(CHECKED_STACK_OF(OPENSSL_PSTRING, st))
+# define sk_OPENSSL_PSTRING_sort(st) SKM_sk_sort(OPENSSL_PSTRING, (st))
+# define sk_OPENSSL_PSTRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_PSTRING, (st))
+# define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(ACCESS_DESCRIPTION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_ACCESS_DESCRIPTION(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(ACCESS_DESCRIPTION, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_ACCESS_DESCRIPTION(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(ACCESS_DESCRIPTION, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_ASN1_INTEGER(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(ASN1_INTEGER, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_ASN1_INTEGER(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(ASN1_INTEGER, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_ASN1_INTEGER(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(ASN1_INTEGER, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_ASN1_INTEGER(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(ASN1_INTEGER, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_ASN1_OBJECT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(ASN1_OBJECT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_ASN1_OBJECT(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(ASN1_OBJECT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_ASN1_OBJECT(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(ASN1_OBJECT, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_ASN1_OBJECT(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(ASN1_OBJECT, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_ASN1_TYPE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(ASN1_TYPE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_ASN1_TYPE(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(ASN1_TYPE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_ASN1_TYPE(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(ASN1_TYPE, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_ASN1_UTF8STRING(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(ASN1_UTF8STRING, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_ASN1_UTF8STRING(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(ASN1_UTF8STRING, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_ASN1_UTF8STRING(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(ASN1_UTF8STRING, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_ASN1_UTF8STRING(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(ASN1_UTF8STRING, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_DIST_POINT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(DIST_POINT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_DIST_POINT(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(DIST_POINT, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_ESS_CERT_ID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(ESS_CERT_ID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_ESS_CERT_ID(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(ESS_CERT_ID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_ESS_CERT_ID(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(ESS_CERT_ID, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_ESS_CERT_ID(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(ESS_CERT_ID, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_EVP_MD(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(EVP_MD, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_EVP_MD(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(EVP_MD, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_EVP_MD(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(EVP_MD, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_EVP_MD(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(EVP_MD, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_GENERAL_NAME(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_GENERAL_NAME(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(GENERAL_NAME, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_GENERAL_NAME(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(GENERAL_NAME, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_GENERAL_NAME(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(GENERAL_NAME, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_OCSP_ONEREQ(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(OCSP_ONEREQ, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_OCSP_ONEREQ(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(OCSP_ONEREQ, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_OCSP_ONEREQ(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(OCSP_ONEREQ, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_OCSP_ONEREQ(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(OCSP_ONEREQ, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(OCSP_SINGLERESP, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(OCSP_SINGLERESP, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_OCSP_SINGLERESP(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(OCSP_SINGLERESP, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_OCSP_SINGLERESP(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(OCSP_SINGLERESP, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(PKCS12_SAFEBAG, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(PKCS12_SAFEBAG, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_PKCS12_SAFEBAG(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(PKCS12_SAFEBAG, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_PKCS12_SAFEBAG(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(PKCS12_SAFEBAG, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_PKCS7(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(PKCS7, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_PKCS7(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(PKCS7, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_PKCS7(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(PKCS7, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_PKCS7(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(PKCS7, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(PKCS7_RECIP_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(PKCS7_RECIP_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_PKCS7_RECIP_INFO(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(PKCS7_RECIP_INFO, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_PKCS7_RECIP_INFO(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(PKCS7_RECIP_INFO, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(PKCS7_SIGNER_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(PKCS7_SIGNER_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_PKCS7_SIGNER_INFO(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(PKCS7_SIGNER_INFO, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_PKCS7_SIGNER_INFO(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(PKCS7_SIGNER_INFO, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_POLICYINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(POLICYINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_POLICYINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(POLICYINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_POLICYINFO(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(POLICYINFO, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_POLICYINFO(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(POLICYINFO, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_POLICYQUALINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(POLICYQUALINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_POLICYQUALINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(POLICYQUALINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_POLICYQUALINFO(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(POLICYQUALINFO, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_POLICYQUALINFO(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(POLICYQUALINFO, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_SXNETID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(SXNETID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_SXNETID(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(SXNETID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_SXNETID(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(SXNETID, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_SXNETID(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(SXNETID, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_X509(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(X509, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_X509(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(X509, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_X509(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(X509, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_X509(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(X509, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_X509_ALGOR(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(X509_ALGOR, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_X509_ALGOR(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(X509_ALGOR, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_X509_ALGOR(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(X509_ALGOR, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_X509_ALGOR(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(X509_ALGOR, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(X509_ATTRIBUTE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(X509_ATTRIBUTE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_X509_ATTRIBUTE(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(X509_ATTRIBUTE, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_X509_ATTRIBUTE(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(X509_ATTRIBUTE, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_X509_CRL(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(X509_CRL, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_X509_CRL(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(X509_CRL, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_X509_CRL(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(X509_CRL, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_X509_CRL(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(X509_CRL, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_X509_EXTENSION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(X509_EXTENSION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_X509_EXTENSION(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(X509_EXTENSION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_X509_EXTENSION(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(X509_EXTENSION, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_X509_EXTENSION(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(X509_EXTENSION, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(X509_NAME_ENTRY, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(X509_NAME_ENTRY, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_X509_NAME_ENTRY(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(X509_NAME_ENTRY, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_X509_NAME_ENTRY(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(X509_NAME_ENTRY, (buf), (len), (d2i_func), (free_func))
+# define d2i_ASN1_SET_OF_X509_REVOKED(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+        SKM_ASN1_SET_OF_d2i(X509_REVOKED, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
+# define i2d_ASN1_SET_OF_X509_REVOKED(st, pp, i2d_func, ex_tag, ex_class, is_set) \
+        SKM_ASN1_SET_OF_i2d(X509_REVOKED, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+# define ASN1_seq_pack_X509_REVOKED(st, i2d_func, buf, len) \
+        SKM_ASN1_seq_pack(X509_REVOKED, (st), (i2d_func), (buf), (len))
+# define ASN1_seq_unpack_X509_REVOKED(buf, len, d2i_func, free_func) \
+        SKM_ASN1_seq_unpack(X509_REVOKED, (buf), (len), (d2i_func), (free_func))
+# define PKCS12_decrypt_d2i_PKCS12_SAFEBAG(algor, d2i_func, free_func, pass, passlen, oct, seq) \
+        SKM_PKCS12_decrypt_d2i(PKCS12_SAFEBAG, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))
+# define PKCS12_decrypt_d2i_PKCS7(algor, d2i_func, free_func, pass, passlen, oct, seq) \
+        SKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))
+# define lh_ADDED_OBJ_new() LHM_lh_new(ADDED_OBJ,added_obj)
+# define lh_ADDED_OBJ_insert(lh,inst) LHM_lh_insert(ADDED_OBJ,lh,inst)
+# define lh_ADDED_OBJ_retrieve(lh,inst) LHM_lh_retrieve(ADDED_OBJ,lh,inst)
+# define lh_ADDED_OBJ_delete(lh,inst) LHM_lh_delete(ADDED_OBJ,lh,inst)
+# define lh_ADDED_OBJ_doall(lh,fn) LHM_lh_doall(ADDED_OBJ,lh,fn)
+# define lh_ADDED_OBJ_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(ADDED_OBJ,lh,fn,arg_type,arg)
+# define lh_ADDED_OBJ_error(lh) LHM_lh_error(ADDED_OBJ,lh)
+# define lh_ADDED_OBJ_num_items(lh) LHM_lh_num_items(ADDED_OBJ,lh)
+# define lh_ADDED_OBJ_down_load(lh) LHM_lh_down_load(ADDED_OBJ,lh)
+# define lh_ADDED_OBJ_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(ADDED_OBJ,lh,out)
+# define lh_ADDED_OBJ_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(ADDED_OBJ,lh,out)
+# define lh_ADDED_OBJ_stats_bio(lh,out) \
+  LHM_lh_stats_bio(ADDED_OBJ,lh,out)
+# define lh_ADDED_OBJ_free(lh) LHM_lh_free(ADDED_OBJ,lh)
+# define lh_APP_INFO_new() LHM_lh_new(APP_INFO,app_info)
+# define lh_APP_INFO_insert(lh,inst) LHM_lh_insert(APP_INFO,lh,inst)
+# define lh_APP_INFO_retrieve(lh,inst) LHM_lh_retrieve(APP_INFO,lh,inst)
+# define lh_APP_INFO_delete(lh,inst) LHM_lh_delete(APP_INFO,lh,inst)
+# define lh_APP_INFO_doall(lh,fn) LHM_lh_doall(APP_INFO,lh,fn)
+# define lh_APP_INFO_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(APP_INFO,lh,fn,arg_type,arg)
+# define lh_APP_INFO_error(lh) LHM_lh_error(APP_INFO,lh)
+# define lh_APP_INFO_num_items(lh) LHM_lh_num_items(APP_INFO,lh)
+# define lh_APP_INFO_down_load(lh) LHM_lh_down_load(APP_INFO,lh)
+# define lh_APP_INFO_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(APP_INFO,lh,out)
+# define lh_APP_INFO_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(APP_INFO,lh,out)
+# define lh_APP_INFO_stats_bio(lh,out) \
+  LHM_lh_stats_bio(APP_INFO,lh,out)
+# define lh_APP_INFO_free(lh) LHM_lh_free(APP_INFO,lh)
+# define lh_CONF_VALUE_new() LHM_lh_new(CONF_VALUE,conf_value)
+# define lh_CONF_VALUE_insert(lh,inst) LHM_lh_insert(CONF_VALUE,lh,inst)
+# define lh_CONF_VALUE_retrieve(lh,inst) LHM_lh_retrieve(CONF_VALUE,lh,inst)
+# define lh_CONF_VALUE_delete(lh,inst) LHM_lh_delete(CONF_VALUE,lh,inst)
+# define lh_CONF_VALUE_doall(lh,fn) LHM_lh_doall(CONF_VALUE,lh,fn)
+# define lh_CONF_VALUE_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(CONF_VALUE,lh,fn,arg_type,arg)
+# define lh_CONF_VALUE_error(lh) LHM_lh_error(CONF_VALUE,lh)
+# define lh_CONF_VALUE_num_items(lh) LHM_lh_num_items(CONF_VALUE,lh)
+# define lh_CONF_VALUE_down_load(lh) LHM_lh_down_load(CONF_VALUE,lh)
+# define lh_CONF_VALUE_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(CONF_VALUE,lh,out)
+# define lh_CONF_VALUE_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(CONF_VALUE,lh,out)
+# define lh_CONF_VALUE_stats_bio(lh,out) \
+  LHM_lh_stats_bio(CONF_VALUE,lh,out)
+# define lh_CONF_VALUE_free(lh) LHM_lh_free(CONF_VALUE,lh)
+# define lh_ENGINE_PILE_new() LHM_lh_new(ENGINE_PILE,engine_pile)
+# define lh_ENGINE_PILE_insert(lh,inst) LHM_lh_insert(ENGINE_PILE,lh,inst)
+# define lh_ENGINE_PILE_retrieve(lh,inst) LHM_lh_retrieve(ENGINE_PILE,lh,inst)
+# define lh_ENGINE_PILE_delete(lh,inst) LHM_lh_delete(ENGINE_PILE,lh,inst)
+# define lh_ENGINE_PILE_doall(lh,fn) LHM_lh_doall(ENGINE_PILE,lh,fn)
+# define lh_ENGINE_PILE_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(ENGINE_PILE,lh,fn,arg_type,arg)
+# define lh_ENGINE_PILE_error(lh) LHM_lh_error(ENGINE_PILE,lh)
+# define lh_ENGINE_PILE_num_items(lh) LHM_lh_num_items(ENGINE_PILE,lh)
+# define lh_ENGINE_PILE_down_load(lh) LHM_lh_down_load(ENGINE_PILE,lh)
+# define lh_ENGINE_PILE_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(ENGINE_PILE,lh,out)
+# define lh_ENGINE_PILE_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(ENGINE_PILE,lh,out)
+# define lh_ENGINE_PILE_stats_bio(lh,out) \
+  LHM_lh_stats_bio(ENGINE_PILE,lh,out)
+# define lh_ENGINE_PILE_free(lh) LHM_lh_free(ENGINE_PILE,lh)
+# define lh_ERR_STATE_new() LHM_lh_new(ERR_STATE,err_state)
+# define lh_ERR_STATE_insert(lh,inst) LHM_lh_insert(ERR_STATE,lh,inst)
+# define lh_ERR_STATE_retrieve(lh,inst) LHM_lh_retrieve(ERR_STATE,lh,inst)
+# define lh_ERR_STATE_delete(lh,inst) LHM_lh_delete(ERR_STATE,lh,inst)
+# define lh_ERR_STATE_doall(lh,fn) LHM_lh_doall(ERR_STATE,lh,fn)
+# define lh_ERR_STATE_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(ERR_STATE,lh,fn,arg_type,arg)
+# define lh_ERR_STATE_error(lh) LHM_lh_error(ERR_STATE,lh)
+# define lh_ERR_STATE_num_items(lh) LHM_lh_num_items(ERR_STATE,lh)
+# define lh_ERR_STATE_down_load(lh) LHM_lh_down_load(ERR_STATE,lh)
+# define lh_ERR_STATE_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(ERR_STATE,lh,out)
+# define lh_ERR_STATE_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(ERR_STATE,lh,out)
+# define lh_ERR_STATE_stats_bio(lh,out) \
+  LHM_lh_stats_bio(ERR_STATE,lh,out)
+# define lh_ERR_STATE_free(lh) LHM_lh_free(ERR_STATE,lh)
+# define lh_ERR_STRING_DATA_new() LHM_lh_new(ERR_STRING_DATA,err_string_data)
+# define lh_ERR_STRING_DATA_insert(lh,inst) LHM_lh_insert(ERR_STRING_DATA,lh,inst)
+# define lh_ERR_STRING_DATA_retrieve(lh,inst) LHM_lh_retrieve(ERR_STRING_DATA,lh,inst)
+# define lh_ERR_STRING_DATA_delete(lh,inst) LHM_lh_delete(ERR_STRING_DATA,lh,inst)
+# define lh_ERR_STRING_DATA_doall(lh,fn) LHM_lh_doall(ERR_STRING_DATA,lh,fn)
+# define lh_ERR_STRING_DATA_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(ERR_STRING_DATA,lh,fn,arg_type,arg)
+# define lh_ERR_STRING_DATA_error(lh) LHM_lh_error(ERR_STRING_DATA,lh)
+# define lh_ERR_STRING_DATA_num_items(lh) LHM_lh_num_items(ERR_STRING_DATA,lh)
+# define lh_ERR_STRING_DATA_down_load(lh) LHM_lh_down_load(ERR_STRING_DATA,lh)
+# define lh_ERR_STRING_DATA_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(ERR_STRING_DATA,lh,out)
+# define lh_ERR_STRING_DATA_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(ERR_STRING_DATA,lh,out)
+# define lh_ERR_STRING_DATA_stats_bio(lh,out) \
+  LHM_lh_stats_bio(ERR_STRING_DATA,lh,out)
+# define lh_ERR_STRING_DATA_free(lh) LHM_lh_free(ERR_STRING_DATA,lh)
+# define lh_EX_CLASS_ITEM_new() LHM_lh_new(EX_CLASS_ITEM,ex_class_item)
+# define lh_EX_CLASS_ITEM_insert(lh,inst) LHM_lh_insert(EX_CLASS_ITEM,lh,inst)
+# define lh_EX_CLASS_ITEM_retrieve(lh,inst) LHM_lh_retrieve(EX_CLASS_ITEM,lh,inst)
+# define lh_EX_CLASS_ITEM_delete(lh,inst) LHM_lh_delete(EX_CLASS_ITEM,lh,inst)
+# define lh_EX_CLASS_ITEM_doall(lh,fn) LHM_lh_doall(EX_CLASS_ITEM,lh,fn)
+# define lh_EX_CLASS_ITEM_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(EX_CLASS_ITEM,lh,fn,arg_type,arg)
+# define lh_EX_CLASS_ITEM_error(lh) LHM_lh_error(EX_CLASS_ITEM,lh)
+# define lh_EX_CLASS_ITEM_num_items(lh) LHM_lh_num_items(EX_CLASS_ITEM,lh)
+# define lh_EX_CLASS_ITEM_down_load(lh) LHM_lh_down_load(EX_CLASS_ITEM,lh)
+# define lh_EX_CLASS_ITEM_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(EX_CLASS_ITEM,lh,out)
+# define lh_EX_CLASS_ITEM_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(EX_CLASS_ITEM,lh,out)
+# define lh_EX_CLASS_ITEM_stats_bio(lh,out) \
+  LHM_lh_stats_bio(EX_CLASS_ITEM,lh,out)
+# define lh_EX_CLASS_ITEM_free(lh) LHM_lh_free(EX_CLASS_ITEM,lh)
+# define lh_FUNCTION_new() LHM_lh_new(FUNCTION,function)
+# define lh_FUNCTION_insert(lh,inst) LHM_lh_insert(FUNCTION,lh,inst)
+# define lh_FUNCTION_retrieve(lh,inst) LHM_lh_retrieve(FUNCTION,lh,inst)
+# define lh_FUNCTION_delete(lh,inst) LHM_lh_delete(FUNCTION,lh,inst)
+# define lh_FUNCTION_doall(lh,fn) LHM_lh_doall(FUNCTION,lh,fn)
+# define lh_FUNCTION_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(FUNCTION,lh,fn,arg_type,arg)
+# define lh_FUNCTION_error(lh) LHM_lh_error(FUNCTION,lh)
+# define lh_FUNCTION_num_items(lh) LHM_lh_num_items(FUNCTION,lh)
+# define lh_FUNCTION_down_load(lh) LHM_lh_down_load(FUNCTION,lh)
+# define lh_FUNCTION_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(FUNCTION,lh,out)
+# define lh_FUNCTION_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(FUNCTION,lh,out)
+# define lh_FUNCTION_stats_bio(lh,out) \
+  LHM_lh_stats_bio(FUNCTION,lh,out)
+# define lh_FUNCTION_free(lh) LHM_lh_free(FUNCTION,lh)
+# define lh_MEM_new() LHM_lh_new(MEM,mem)
+# define lh_MEM_insert(lh,inst) LHM_lh_insert(MEM,lh,inst)
+# define lh_MEM_retrieve(lh,inst) LHM_lh_retrieve(MEM,lh,inst)
+# define lh_MEM_delete(lh,inst) LHM_lh_delete(MEM,lh,inst)
+# define lh_MEM_doall(lh,fn) LHM_lh_doall(MEM,lh,fn)
+# define lh_MEM_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(MEM,lh,fn,arg_type,arg)
+# define lh_MEM_error(lh) LHM_lh_error(MEM,lh)
+# define lh_MEM_num_items(lh) LHM_lh_num_items(MEM,lh)
+# define lh_MEM_down_load(lh) LHM_lh_down_load(MEM,lh)
+# define lh_MEM_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(MEM,lh,out)
+# define lh_MEM_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(MEM,lh,out)
+# define lh_MEM_stats_bio(lh,out) \
+  LHM_lh_stats_bio(MEM,lh,out)
+# define lh_MEM_free(lh) LHM_lh_free(MEM,lh)
+# define lh_OBJ_NAME_new() LHM_lh_new(OBJ_NAME,obj_name)
+# define lh_OBJ_NAME_insert(lh,inst) LHM_lh_insert(OBJ_NAME,lh,inst)
+# define lh_OBJ_NAME_retrieve(lh,inst) LHM_lh_retrieve(OBJ_NAME,lh,inst)
+# define lh_OBJ_NAME_delete(lh,inst) LHM_lh_delete(OBJ_NAME,lh,inst)
+# define lh_OBJ_NAME_doall(lh,fn) LHM_lh_doall(OBJ_NAME,lh,fn)
+# define lh_OBJ_NAME_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(OBJ_NAME,lh,fn,arg_type,arg)
+# define lh_OBJ_NAME_error(lh) LHM_lh_error(OBJ_NAME,lh)
+# define lh_OBJ_NAME_num_items(lh) LHM_lh_num_items(OBJ_NAME,lh)
+# define lh_OBJ_NAME_down_load(lh) LHM_lh_down_load(OBJ_NAME,lh)
+# define lh_OBJ_NAME_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(OBJ_NAME,lh,out)
+# define lh_OBJ_NAME_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(OBJ_NAME,lh,out)
+# define lh_OBJ_NAME_stats_bio(lh,out) \
+  LHM_lh_stats_bio(OBJ_NAME,lh,out)
+# define lh_OBJ_NAME_free(lh) LHM_lh_free(OBJ_NAME,lh)
+# define lh_OPENSSL_CSTRING_new() LHM_lh_new(OPENSSL_CSTRING,openssl_cstring)
+# define lh_OPENSSL_CSTRING_insert(lh,inst) LHM_lh_insert(OPENSSL_CSTRING,lh,inst)
+# define lh_OPENSSL_CSTRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_CSTRING,lh,inst)
+# define lh_OPENSSL_CSTRING_delete(lh,inst) LHM_lh_delete(OPENSSL_CSTRING,lh,inst)
+# define lh_OPENSSL_CSTRING_doall(lh,fn) LHM_lh_doall(OPENSSL_CSTRING,lh,fn)
+# define lh_OPENSSL_CSTRING_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(OPENSSL_CSTRING,lh,fn,arg_type,arg)
+# define lh_OPENSSL_CSTRING_error(lh) LHM_lh_error(OPENSSL_CSTRING,lh)
+# define lh_OPENSSL_CSTRING_num_items(lh) LHM_lh_num_items(OPENSSL_CSTRING,lh)
+# define lh_OPENSSL_CSTRING_down_load(lh) LHM_lh_down_load(OPENSSL_CSTRING,lh)
+# define lh_OPENSSL_CSTRING_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(OPENSSL_CSTRING,lh,out)
+# define lh_OPENSSL_CSTRING_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(OPENSSL_CSTRING,lh,out)
+# define lh_OPENSSL_CSTRING_stats_bio(lh,out) \
+  LHM_lh_stats_bio(OPENSSL_CSTRING,lh,out)
+# define lh_OPENSSL_CSTRING_free(lh) LHM_lh_free(OPENSSL_CSTRING,lh)
+# define lh_OPENSSL_STRING_new() LHM_lh_new(OPENSSL_STRING,openssl_string)
+# define lh_OPENSSL_STRING_insert(lh,inst) LHM_lh_insert(OPENSSL_STRING,lh,inst)
+# define lh_OPENSSL_STRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_STRING,lh,inst)
+# define lh_OPENSSL_STRING_delete(lh,inst) LHM_lh_delete(OPENSSL_STRING,lh,inst)
+# define lh_OPENSSL_STRING_doall(lh,fn) LHM_lh_doall(OPENSSL_STRING,lh,fn)
+# define lh_OPENSSL_STRING_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(OPENSSL_STRING,lh,fn,arg_type,arg)
+# define lh_OPENSSL_STRING_error(lh) LHM_lh_error(OPENSSL_STRING,lh)
+# define lh_OPENSSL_STRING_num_items(lh) LHM_lh_num_items(OPENSSL_STRING,lh)
+# define lh_OPENSSL_STRING_down_load(lh) LHM_lh_down_load(OPENSSL_STRING,lh)
+# define lh_OPENSSL_STRING_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(OPENSSL_STRING,lh,out)
+# define lh_OPENSSL_STRING_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(OPENSSL_STRING,lh,out)
+# define lh_OPENSSL_STRING_stats_bio(lh,out) \
+  LHM_lh_stats_bio(OPENSSL_STRING,lh,out)
+# define lh_OPENSSL_STRING_free(lh) LHM_lh_free(OPENSSL_STRING,lh)
+# define lh_SSL_SESSION_new() LHM_lh_new(SSL_SESSION,ssl_session)
+# define lh_SSL_SESSION_insert(lh,inst) LHM_lh_insert(SSL_SESSION,lh,inst)
+# define lh_SSL_SESSION_retrieve(lh,inst) LHM_lh_retrieve(SSL_SESSION,lh,inst)
+# define lh_SSL_SESSION_delete(lh,inst) LHM_lh_delete(SSL_SESSION,lh,inst)
+# define lh_SSL_SESSION_doall(lh,fn) LHM_lh_doall(SSL_SESSION,lh,fn)
+# define lh_SSL_SESSION_doall_arg(lh,fn,arg_type,arg) \
+  LHM_lh_doall_arg(SSL_SESSION,lh,fn,arg_type,arg)
+# define lh_SSL_SESSION_error(lh) LHM_lh_error(SSL_SESSION,lh)
+# define lh_SSL_SESSION_num_items(lh) LHM_lh_num_items(SSL_SESSION,lh)
+# define lh_SSL_SESSION_down_load(lh) LHM_lh_down_load(SSL_SESSION,lh)
+# define lh_SSL_SESSION_node_stats_bio(lh,out) \
+  LHM_lh_node_stats_bio(SSL_SESSION,lh,out)
+# define lh_SSL_SESSION_node_usage_stats_bio(lh,out) \
+  LHM_lh_node_usage_stats_bio(SSL_SESSION,lh,out)
+# define lh_SSL_SESSION_stats_bio(lh,out) \
+  LHM_lh_stats_bio(SSL_SESSION,lh,out)
+# define lh_SSL_SESSION_free(lh) LHM_lh_free(SSL_SESSION,lh)
+#ifdef  __cplusplus
+}
+#endif
+#endif                          /* !defined HEADER_SAFESTACK_H */

Property changes on: lab4/.minix-src/include/openssl/safestack.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/srtp.h
===================================================================
--- lab4/.minix-src/include/openssl/srtp.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/srtp.h	(revision 13)
@@ -0,0 +1,148 @@
+/* ssl/srtp.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* ====================================================================
+ * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/*
+ * DTLS code by Eric Rescorla <ekr@rtfm.com>
+ *
+ * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc.
+ */
+
+#ifndef HEADER_D1_SRTP_H
+# define HEADER_D1_SRTP_H
+
+# include <openssl/ssl.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# define SRTP_AES128_CM_SHA1_80 0x0001
+# define SRTP_AES128_CM_SHA1_32 0x0002
+# define SRTP_AES128_F8_SHA1_80 0x0003
+# define SRTP_AES128_F8_SHA1_32 0x0004
+# define SRTP_NULL_SHA1_80      0x0005
+# define SRTP_NULL_SHA1_32      0x0006
+
+# ifndef OPENSSL_NO_SRTP
+
+int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles);
+int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles);
+SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);
+
+STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl);
+SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);
+
+# endif
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/srtp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ssl3.h
===================================================================
--- lab4/.minix-src/include/openssl/ssl3.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ssl3.h	(revision 13)
@@ -0,0 +1,730 @@
+/* ssl/ssl3.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* ====================================================================
+ * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ * ECC cipher suite support in OpenSSL originally developed by
+ * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
+ */
+
+#ifndef HEADER_SSL3_H
+# define HEADER_SSL3_H
+
+# ifndef OPENSSL_NO_COMP
+#  include <openssl/comp.h>
+# endif
+# include <openssl/buffer.h>
+# include <openssl/evp.h>
+# include <openssl/ssl.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Signalling cipher suite value from RFC 5746
+ * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV)
+ */
+# define SSL3_CK_SCSV                            0x030000FF
+
+/*
+ * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00
+ * (TLS_FALLBACK_SCSV)
+ */
+# define SSL3_CK_FALLBACK_SCSV                   0x03005600
+
+# define SSL3_CK_RSA_NULL_MD5                    0x03000001
+# define SSL3_CK_RSA_NULL_SHA                    0x03000002
+# define SSL3_CK_RSA_RC4_40_MD5                  0x03000003
+# define SSL3_CK_RSA_RC4_128_MD5                 0x03000004
+# define SSL3_CK_RSA_RC4_128_SHA                 0x03000005
+# define SSL3_CK_RSA_RC2_40_MD5                  0x03000006
+# define SSL3_CK_RSA_IDEA_128_SHA                0x03000007
+# define SSL3_CK_RSA_DES_40_CBC_SHA              0x03000008
+# define SSL3_CK_RSA_DES_64_CBC_SHA              0x03000009
+# define SSL3_CK_RSA_DES_192_CBC3_SHA            0x0300000A
+
+# define SSL3_CK_DH_DSS_DES_40_CBC_SHA           0x0300000B
+# define SSL3_CK_DH_DSS_DES_64_CBC_SHA           0x0300000C
+# define SSL3_CK_DH_DSS_DES_192_CBC3_SHA         0x0300000D
+# define SSL3_CK_DH_RSA_DES_40_CBC_SHA           0x0300000E
+# define SSL3_CK_DH_RSA_DES_64_CBC_SHA           0x0300000F
+# define SSL3_CK_DH_RSA_DES_192_CBC3_SHA         0x03000010
+
+# define SSL3_CK_EDH_DSS_DES_40_CBC_SHA          0x03000011
+# define SSL3_CK_EDH_DSS_DES_64_CBC_SHA          0x03000012
+# define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA        0x03000013
+# define SSL3_CK_EDH_RSA_DES_40_CBC_SHA          0x03000014
+# define SSL3_CK_EDH_RSA_DES_64_CBC_SHA          0x03000015
+# define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA        0x03000016
+
+# define SSL3_CK_ADH_RC4_40_MD5                  0x03000017
+# define SSL3_CK_ADH_RC4_128_MD5                 0x03000018
+# define SSL3_CK_ADH_DES_40_CBC_SHA              0x03000019
+# define SSL3_CK_ADH_DES_64_CBC_SHA              0x0300001A
+# define SSL3_CK_ADH_DES_192_CBC_SHA             0x0300001B
+
+# if 0
+#  define SSL3_CK_FZA_DMS_NULL_SHA                0x0300001C
+#  define SSL3_CK_FZA_DMS_FZA_SHA                 0x0300001D
+#  if 0                         /* Because it clashes with KRB5, is never
+                                 * used any more, and is safe to remove
+                                 * according to David Hopwood
+                                 * <david.hopwood@zetnet.co.uk> of the
+                                 * ietf-tls list */
+#   define SSL3_CK_FZA_DMS_RC4_SHA                 0x0300001E
+#  endif
+# endif
+
+/*
+ * VRS Additional Kerberos5 entries
+ */
+# define SSL3_CK_KRB5_DES_64_CBC_SHA             0x0300001E
+# define SSL3_CK_KRB5_DES_192_CBC3_SHA           0x0300001F
+# define SSL3_CK_KRB5_RC4_128_SHA                0x03000020
+# define SSL3_CK_KRB5_IDEA_128_CBC_SHA           0x03000021
+# define SSL3_CK_KRB5_DES_64_CBC_MD5             0x03000022
+# define SSL3_CK_KRB5_DES_192_CBC3_MD5           0x03000023
+# define SSL3_CK_KRB5_RC4_128_MD5                0x03000024
+# define SSL3_CK_KRB5_IDEA_128_CBC_MD5           0x03000025
+
+# define SSL3_CK_KRB5_DES_40_CBC_SHA             0x03000026
+# define SSL3_CK_KRB5_RC2_40_CBC_SHA             0x03000027
+# define SSL3_CK_KRB5_RC4_40_SHA                 0x03000028
+# define SSL3_CK_KRB5_DES_40_CBC_MD5             0x03000029
+# define SSL3_CK_KRB5_RC2_40_CBC_MD5             0x0300002A
+# define SSL3_CK_KRB5_RC4_40_MD5                 0x0300002B
+
+# define SSL3_TXT_RSA_NULL_MD5                   "NULL-MD5"
+# define SSL3_TXT_RSA_NULL_SHA                   "NULL-SHA"
+# define SSL3_TXT_RSA_RC4_40_MD5                 "EXP-RC4-MD5"
+# define SSL3_TXT_RSA_RC4_128_MD5                "RC4-MD5"
+# define SSL3_TXT_RSA_RC4_128_SHA                "RC4-SHA"
+# define SSL3_TXT_RSA_RC2_40_MD5                 "EXP-RC2-CBC-MD5"
+# define SSL3_TXT_RSA_IDEA_128_SHA               "IDEA-CBC-SHA"
+# define SSL3_TXT_RSA_DES_40_CBC_SHA             "EXP-DES-CBC-SHA"
+# define SSL3_TXT_RSA_DES_64_CBC_SHA             "DES-CBC-SHA"
+# define SSL3_TXT_RSA_DES_192_CBC3_SHA           "DES-CBC3-SHA"
+
+# define SSL3_TXT_DH_DSS_DES_40_CBC_SHA          "EXP-DH-DSS-DES-CBC-SHA"
+# define SSL3_TXT_DH_DSS_DES_64_CBC_SHA          "DH-DSS-DES-CBC-SHA"
+# define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA        "DH-DSS-DES-CBC3-SHA"
+# define SSL3_TXT_DH_RSA_DES_40_CBC_SHA          "EXP-DH-RSA-DES-CBC-SHA"
+# define SSL3_TXT_DH_RSA_DES_64_CBC_SHA          "DH-RSA-DES-CBC-SHA"
+# define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA        "DH-RSA-DES-CBC3-SHA"
+
+# define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA         "EXP-EDH-DSS-DES-CBC-SHA"
+# define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA         "EDH-DSS-DES-CBC-SHA"
+# define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA       "EDH-DSS-DES-CBC3-SHA"
+# define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA         "EXP-EDH-RSA-DES-CBC-SHA"
+# define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA         "EDH-RSA-DES-CBC-SHA"
+# define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA       "EDH-RSA-DES-CBC3-SHA"
+
+# define SSL3_TXT_ADH_RC4_40_MD5                 "EXP-ADH-RC4-MD5"
+# define SSL3_TXT_ADH_RC4_128_MD5                "ADH-RC4-MD5"
+# define SSL3_TXT_ADH_DES_40_CBC_SHA             "EXP-ADH-DES-CBC-SHA"
+# define SSL3_TXT_ADH_DES_64_CBC_SHA             "ADH-DES-CBC-SHA"
+# define SSL3_TXT_ADH_DES_192_CBC_SHA            "ADH-DES-CBC3-SHA"
+
+# if 0
+#  define SSL3_TXT_FZA_DMS_NULL_SHA               "FZA-NULL-SHA"
+#  define SSL3_TXT_FZA_DMS_FZA_SHA                "FZA-FZA-CBC-SHA"
+#  define SSL3_TXT_FZA_DMS_RC4_SHA                "FZA-RC4-SHA"
+# endif
+
+# define SSL3_TXT_KRB5_DES_64_CBC_SHA            "KRB5-DES-CBC-SHA"
+# define SSL3_TXT_KRB5_DES_192_CBC3_SHA          "KRB5-DES-CBC3-SHA"
+# define SSL3_TXT_KRB5_RC4_128_SHA               "KRB5-RC4-SHA"
+# define SSL3_TXT_KRB5_IDEA_128_CBC_SHA          "KRB5-IDEA-CBC-SHA"
+# define SSL3_TXT_KRB5_DES_64_CBC_MD5            "KRB5-DES-CBC-MD5"
+# define SSL3_TXT_KRB5_DES_192_CBC3_MD5          "KRB5-DES-CBC3-MD5"
+# define SSL3_TXT_KRB5_RC4_128_MD5               "KRB5-RC4-MD5"
+# define SSL3_TXT_KRB5_IDEA_128_CBC_MD5          "KRB5-IDEA-CBC-MD5"
+
+# define SSL3_TXT_KRB5_DES_40_CBC_SHA            "EXP-KRB5-DES-CBC-SHA"
+# define SSL3_TXT_KRB5_RC2_40_CBC_SHA            "EXP-KRB5-RC2-CBC-SHA"
+# define SSL3_TXT_KRB5_RC4_40_SHA                "EXP-KRB5-RC4-SHA"
+# define SSL3_TXT_KRB5_DES_40_CBC_MD5            "EXP-KRB5-DES-CBC-MD5"
+# define SSL3_TXT_KRB5_RC2_40_CBC_MD5            "EXP-KRB5-RC2-CBC-MD5"
+# define SSL3_TXT_KRB5_RC4_40_MD5                "EXP-KRB5-RC4-MD5"
+
+# define SSL3_SSL_SESSION_ID_LENGTH              32
+# define SSL3_MAX_SSL_SESSION_ID_LENGTH          32
+
+# define SSL3_MASTER_SECRET_SIZE                 48
+# define SSL3_RANDOM_SIZE                        32
+# define SSL3_SESSION_ID_SIZE                    32
+# define SSL3_RT_HEADER_LENGTH                   5
+
+# ifndef SSL3_ALIGN_PAYLOAD
+ /*
+  * Some will argue that this increases memory footprint, but it's not
+  * actually true. Point is that malloc has to return at least 64-bit aligned
+  * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case.
+  * Suggested pre-gaping simply moves these wasted bytes from the end of
+  * allocated region to its front, but makes data payload aligned, which
+  * improves performance:-)
+  */
+#  define SSL3_ALIGN_PAYLOAD                     8
+# else
+#  if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0
+#   error "insane SSL3_ALIGN_PAYLOAD"
+#   undef SSL3_ALIGN_PAYLOAD
+#  endif
+# endif
+
+/*
+ * This is the maximum MAC (digest) size used by the SSL library. Currently
+ * maximum of 20 is used by SHA1, but we reserve for future extension for
+ * 512-bit hashes.
+ */
+
+# define SSL3_RT_MAX_MD_SIZE                     64
+
+/*
+ * Maximum block size used in all ciphersuites. Currently 16 for AES.
+ */
+
+# define SSL_RT_MAX_CIPHER_BLOCK_SIZE            16
+
+# define SSL3_RT_MAX_EXTRA                       (16384)
+
+/* Maximum plaintext length: defined by SSL/TLS standards */
+# define SSL3_RT_MAX_PLAIN_LENGTH                16384
+/* Maximum compression overhead: defined by SSL/TLS standards */
+# define SSL3_RT_MAX_COMPRESSED_OVERHEAD         1024
+
+/*
+ * The standards give a maximum encryption overhead of 1024 bytes. In
+ * practice the value is lower than this. The overhead is the maximum number
+ * of padding bytes (256) plus the mac size.
+ */
+# define SSL3_RT_MAX_ENCRYPTED_OVERHEAD  (256 + SSL3_RT_MAX_MD_SIZE)
+
+/*
+ * OpenSSL currently only uses a padding length of at most one block so the
+ * send overhead is smaller.
+ */
+
+# define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \
+                        (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE)
+
+/* If compression isn't used don't include the compression overhead */
+
+# ifdef OPENSSL_NO_COMP
+#  define SSL3_RT_MAX_COMPRESSED_LENGTH           SSL3_RT_MAX_PLAIN_LENGTH
+# else
+#  define SSL3_RT_MAX_COMPRESSED_LENGTH   \
+                (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD)
+# endif
+# define SSL3_RT_MAX_ENCRYPTED_LENGTH    \
+                (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH)
+# define SSL3_RT_MAX_PACKET_SIZE         \
+                (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)
+
+# define SSL3_MD_CLIENT_FINISHED_CONST   "\x43\x4C\x4E\x54"
+# define SSL3_MD_SERVER_FINISHED_CONST   "\x53\x52\x56\x52"
+
+# define SSL3_VERSION                    0x0300
+# define SSL3_VERSION_MAJOR              0x03
+# define SSL3_VERSION_MINOR              0x00
+
+# define SSL3_RT_CHANGE_CIPHER_SPEC      20
+# define SSL3_RT_ALERT                   21
+# define SSL3_RT_HANDSHAKE               22
+# define SSL3_RT_APPLICATION_DATA        23
+# define TLS1_RT_HEARTBEAT               24
+
+# define SSL3_AL_WARNING                 1
+# define SSL3_AL_FATAL                   2
+
+# define SSL3_AD_CLOSE_NOTIFY             0
+# define SSL3_AD_UNEXPECTED_MESSAGE      10/* fatal */
+# define SSL3_AD_BAD_RECORD_MAC          20/* fatal */
+# define SSL3_AD_DECOMPRESSION_FAILURE   30/* fatal */
+# define SSL3_AD_HANDSHAKE_FAILURE       40/* fatal */
+# define SSL3_AD_NO_CERTIFICATE          41
+# define SSL3_AD_BAD_CERTIFICATE         42
+# define SSL3_AD_UNSUPPORTED_CERTIFICATE 43
+# define SSL3_AD_CERTIFICATE_REVOKED     44
+# define SSL3_AD_CERTIFICATE_EXPIRED     45
+# define SSL3_AD_CERTIFICATE_UNKNOWN     46
+# define SSL3_AD_ILLEGAL_PARAMETER       47/* fatal */
+
+# define TLS1_HB_REQUEST         1
+# define TLS1_HB_RESPONSE        2
+
+# ifndef OPENSSL_NO_SSL_INTERN
+
+typedef struct ssl3_record_st {
+    /* type of record */
+    /*
+     * r
+     */ int type;
+    /* How many bytes available */
+    /*
+     * rw
+     */ unsigned int length;
+    /* read/write offset into 'buf' */
+    /*
+     * r
+     */ unsigned int off;
+    /* pointer to the record data */
+    /*
+     * rw
+     */ unsigned char *data;
+    /* where the decode bytes are */
+    /*
+     * rw
+     */ unsigned char *input;
+    /* only used with decompression - malloc()ed */
+    /*
+     * r
+     */ unsigned char *comp;
+    /* epoch number, needed by DTLS1 */
+    /*
+     * r
+     */ unsigned long epoch;
+    /* sequence number, needed by DTLS1 */
+    /*
+     * r
+     */ unsigned char seq_num[8];
+} SSL3_RECORD;
+
+typedef struct ssl3_buffer_st {
+    /* at least SSL3_RT_MAX_PACKET_SIZE bytes, see ssl3_setup_buffers() */
+    unsigned char *buf;
+    /* buffer size */
+    size_t len;
+    /* where to 'copy from' */
+    int offset;
+    /* how many bytes left */
+    int left;
+} SSL3_BUFFER;
+
+# endif
+
+# define SSL3_CT_RSA_SIGN                        1
+# define SSL3_CT_DSS_SIGN                        2
+# define SSL3_CT_RSA_FIXED_DH                    3
+# define SSL3_CT_DSS_FIXED_DH                    4
+# define SSL3_CT_RSA_EPHEMERAL_DH                5
+# define SSL3_CT_DSS_EPHEMERAL_DH                6
+# define SSL3_CT_FORTEZZA_DMS                    20
+/*
+ * SSL3_CT_NUMBER is used to size arrays and it must be large enough to
+ * contain all of the cert types defined either for SSLv3 and TLSv1.
+ */
+# define SSL3_CT_NUMBER                  9
+
+# define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS       0x0001
+# define SSL3_FLAGS_DELAY_CLIENT_FINISHED        0x0002
+# define SSL3_FLAGS_POP_BUFFER                   0x0004
+# define TLS1_FLAGS_TLS_PADDING_BUG              0x0008
+# define TLS1_FLAGS_SKIP_CERT_VERIFY             0x0010
+# define TLS1_FLAGS_KEEP_HANDSHAKE               0x0020
+/*
+ * Set when the handshake is ready to process peer's ChangeCipherSpec message.
+ * Cleared after the message has been processed.
+ */
+# define SSL3_FLAGS_CCS_OK                       0x0080
+
+/*
+ * SSL3_FLAGS_SGC_RESTART_DONE is set when we restart a handshake because of
+ * MS SGC and so prevents us from restarting the handshake in a loop. It's
+ * reset on a renegotiation, so effectively limits the client to one restart
+ * per negotiation. This limits the possibility of a DDoS attack where the
+ * client handshakes in a loop using SGC to restart. Servers which permit
+ * renegotiation can still be effected, but we can't prevent that.
+ */
+# define SSL3_FLAGS_SGC_RESTART_DONE             0x0040
+
+# ifndef OPENSSL_NO_SSL_INTERN
+
+typedef struct ssl3_state_st {
+    long flags;
+    int delay_buf_pop_ret;
+    unsigned char read_sequence[8];
+    int read_mac_secret_size;
+    unsigned char read_mac_secret[EVP_MAX_MD_SIZE];
+    unsigned char write_sequence[8];
+    int write_mac_secret_size;
+    unsigned char write_mac_secret[EVP_MAX_MD_SIZE];
+    unsigned char server_random[SSL3_RANDOM_SIZE];
+    unsigned char client_random[SSL3_RANDOM_SIZE];
+    /* flags for countermeasure against known-IV weakness */
+    int need_empty_fragments;
+    int empty_fragment_done;
+    /* The value of 'extra' when the buffers were initialized */
+    int init_extra;
+    SSL3_BUFFER rbuf;           /* read IO goes into here */
+    SSL3_BUFFER wbuf;           /* write IO goes into here */
+    SSL3_RECORD rrec;           /* each decoded record goes in here */
+    SSL3_RECORD wrec;           /* goes out from here */
+    /*
+     * storage for Alert/Handshake protocol data received but not yet
+     * processed by ssl3_read_bytes:
+     */
+    unsigned char alert_fragment[2];
+    unsigned int alert_fragment_len;
+    unsigned char handshake_fragment[4];
+    unsigned int handshake_fragment_len;
+    /* partial write - check the numbers match */
+    unsigned int wnum;          /* number of bytes sent so far */
+    int wpend_tot;              /* number bytes written */
+    int wpend_type;
+    int wpend_ret;              /* number of bytes submitted */
+    const unsigned char *wpend_buf;
+    /* used during startup, digest all incoming/outgoing packets */
+    BIO *handshake_buffer;
+    /*
+     * When set of handshake digests is determined, buffer is hashed and
+     * freed and MD_CTX-es for all required digests are stored in this array
+     */
+    EVP_MD_CTX **handshake_dgst;
+    /*
+     * Set whenever an expected ChangeCipherSpec message is processed.
+     * Unset when the peer's Finished message is received.
+     * Unexpected ChangeCipherSpec messages trigger a fatal alert.
+     */
+    int change_cipher_spec;
+    int warn_alert;
+    int fatal_alert;
+    /*
+     * we allow one fatal and one warning alert to be outstanding, send close
+     * alert via the warning alert
+     */
+    int alert_dispatch;
+    unsigned char send_alert[2];
+    /*
+     * This flag is set when we should renegotiate ASAP, basically when there
+     * is no more data in the read or write buffers
+     */
+    int renegotiate;
+    int total_renegotiations;
+    int num_renegotiations;
+    int in_read_app_data;
+    /*
+     * Opaque PRF input as used for the current handshake. These fields are
+     * used only if TLSEXT_TYPE_opaque_prf_input is defined (otherwise, they
+     * are merely present to improve binary compatibility)
+     */
+    void *client_opaque_prf_input;
+    size_t client_opaque_prf_input_len;
+    void *server_opaque_prf_input;
+    size_t server_opaque_prf_input_len;
+    struct {
+        /* actually only needs to be 16+20 */
+        unsigned char cert_verify_md[EVP_MAX_MD_SIZE * 2];
+        /* actually only need to be 16+20 for SSLv3 and 12 for TLS */
+        unsigned char finish_md[EVP_MAX_MD_SIZE * 2];
+        int finish_md_len;
+        unsigned char peer_finish_md[EVP_MAX_MD_SIZE * 2];
+        int peer_finish_md_len;
+        unsigned long message_size;
+        int message_type;
+        /* used to hold the new cipher we are going to use */
+        const SSL_CIPHER *new_cipher;
+#  ifndef OPENSSL_NO_DH
+        DH *dh;
+#  endif
+#  ifndef OPENSSL_NO_ECDH
+        EC_KEY *ecdh;           /* holds short lived ECDH key */
+#  endif
+        /* used when SSL_ST_FLUSH_DATA is entered */
+        int next_state;
+        int reuse_message;
+        /* used for certificate requests */
+        int cert_req;
+        int ctype_num;
+        char ctype[SSL3_CT_NUMBER];
+        STACK_OF(X509_NAME) *ca_names;
+        int use_rsa_tmp;
+        int key_block_length;
+        unsigned char *key_block;
+        const EVP_CIPHER *new_sym_enc;
+        const EVP_MD *new_hash;
+        int new_mac_pkey_type;
+        int new_mac_secret_size;
+#  ifndef OPENSSL_NO_COMP
+        const SSL_COMP *new_compression;
+#  else
+        char *new_compression;
+#  endif
+        int cert_request;
+    } tmp;
+
+    /* Connection binding to prevent renegotiation attacks */
+    unsigned char previous_client_finished[EVP_MAX_MD_SIZE];
+    unsigned char previous_client_finished_len;
+    unsigned char previous_server_finished[EVP_MAX_MD_SIZE];
+    unsigned char previous_server_finished_len;
+    int send_connection_binding; /* TODOEKR */
+
+#  ifndef OPENSSL_NO_NEXTPROTONEG
+    /*
+     * Set if we saw the Next Protocol Negotiation extension from our peer.
+     */
+    int next_proto_neg_seen;
+#  endif
+
+#  ifndef OPENSSL_NO_TLSEXT
+#   ifndef OPENSSL_NO_EC
+    /*
+     * This is set to true if we believe that this is a version of Safari
+     * running on OS X 10.6 or newer. We wish to know this because Safari on
+     * 10.8 .. 10.8.3 has broken ECDHE-ECDSA support.
+     */
+    char is_probably_safari;
+#   endif                       /* !OPENSSL_NO_EC */
+#  endif                        /* !OPENSSL_NO_TLSEXT */
+} SSL3_STATE;
+
+# endif
+
+/* SSLv3 */
+/*
+ * client
+ */
+/* extra state */
+# define SSL3_ST_CW_FLUSH                (0x100|SSL_ST_CONNECT)
+# ifndef OPENSSL_NO_SCTP
+#  define DTLS1_SCTP_ST_CW_WRITE_SOCK                     (0x310|SSL_ST_CONNECT)
+#  define DTLS1_SCTP_ST_CR_READ_SOCK                      (0x320|SSL_ST_CONNECT)
+# endif
+/* write to server */
+# define SSL3_ST_CW_CLNT_HELLO_A         (0x110|SSL_ST_CONNECT)
+# define SSL3_ST_CW_CLNT_HELLO_B         (0x111|SSL_ST_CONNECT)
+/* read from server */
+# define SSL3_ST_CR_SRVR_HELLO_A         (0x120|SSL_ST_CONNECT)
+# define SSL3_ST_CR_SRVR_HELLO_B         (0x121|SSL_ST_CONNECT)
+# define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT)
+# define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT)
+# define SSL3_ST_CR_CERT_A               (0x130|SSL_ST_CONNECT)
+# define SSL3_ST_CR_CERT_B               (0x131|SSL_ST_CONNECT)
+# define SSL3_ST_CR_KEY_EXCH_A           (0x140|SSL_ST_CONNECT)
+# define SSL3_ST_CR_KEY_EXCH_B           (0x141|SSL_ST_CONNECT)
+# define SSL3_ST_CR_CERT_REQ_A           (0x150|SSL_ST_CONNECT)
+# define SSL3_ST_CR_CERT_REQ_B           (0x151|SSL_ST_CONNECT)
+# define SSL3_ST_CR_SRVR_DONE_A          (0x160|SSL_ST_CONNECT)
+# define SSL3_ST_CR_SRVR_DONE_B          (0x161|SSL_ST_CONNECT)
+/* write to server */
+# define SSL3_ST_CW_CERT_A               (0x170|SSL_ST_CONNECT)
+# define SSL3_ST_CW_CERT_B               (0x171|SSL_ST_CONNECT)
+# define SSL3_ST_CW_CERT_C               (0x172|SSL_ST_CONNECT)
+# define SSL3_ST_CW_CERT_D               (0x173|SSL_ST_CONNECT)
+# define SSL3_ST_CW_KEY_EXCH_A           (0x180|SSL_ST_CONNECT)
+# define SSL3_ST_CW_KEY_EXCH_B           (0x181|SSL_ST_CONNECT)
+# define SSL3_ST_CW_CERT_VRFY_A          (0x190|SSL_ST_CONNECT)
+# define SSL3_ST_CW_CERT_VRFY_B          (0x191|SSL_ST_CONNECT)
+# define SSL3_ST_CW_CHANGE_A             (0x1A0|SSL_ST_CONNECT)
+# define SSL3_ST_CW_CHANGE_B             (0x1A1|SSL_ST_CONNECT)
+# ifndef OPENSSL_NO_NEXTPROTONEG
+#  define SSL3_ST_CW_NEXT_PROTO_A         (0x200|SSL_ST_CONNECT)
+#  define SSL3_ST_CW_NEXT_PROTO_B         (0x201|SSL_ST_CONNECT)
+# endif
+# define SSL3_ST_CW_FINISHED_A           (0x1B0|SSL_ST_CONNECT)
+# define SSL3_ST_CW_FINISHED_B           (0x1B1|SSL_ST_CONNECT)
+/* read from server */
+# define SSL3_ST_CR_CHANGE_A             (0x1C0|SSL_ST_CONNECT)
+# define SSL3_ST_CR_CHANGE_B             (0x1C1|SSL_ST_CONNECT)
+# define SSL3_ST_CR_FINISHED_A           (0x1D0|SSL_ST_CONNECT)
+# define SSL3_ST_CR_FINISHED_B           (0x1D1|SSL_ST_CONNECT)
+# define SSL3_ST_CR_SESSION_TICKET_A     (0x1E0|SSL_ST_CONNECT)
+# define SSL3_ST_CR_SESSION_TICKET_B     (0x1E1|SSL_ST_CONNECT)
+# define SSL3_ST_CR_CERT_STATUS_A        (0x1F0|SSL_ST_CONNECT)
+# define SSL3_ST_CR_CERT_STATUS_B        (0x1F1|SSL_ST_CONNECT)
+
+/* server */
+/* extra state */
+# define SSL3_ST_SW_FLUSH                (0x100|SSL_ST_ACCEPT)
+# ifndef OPENSSL_NO_SCTP
+#  define DTLS1_SCTP_ST_SW_WRITE_SOCK                     (0x310|SSL_ST_ACCEPT)
+#  define DTLS1_SCTP_ST_SR_READ_SOCK                      (0x320|SSL_ST_ACCEPT)
+# endif
+/* read from client */
+/* Do not change the number values, they do matter */
+# define SSL3_ST_SR_CLNT_HELLO_A         (0x110|SSL_ST_ACCEPT)
+# define SSL3_ST_SR_CLNT_HELLO_B         (0x111|SSL_ST_ACCEPT)
+# define SSL3_ST_SR_CLNT_HELLO_C         (0x112|SSL_ST_ACCEPT)
+/* write to client */
+# define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT)
+# define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_HELLO_REQ_A          (0x120|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_HELLO_REQ_B          (0x121|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_HELLO_REQ_C          (0x122|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_SRVR_HELLO_A         (0x130|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_SRVR_HELLO_B         (0x131|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_CERT_A               (0x140|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_CERT_B               (0x141|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_KEY_EXCH_A           (0x150|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_KEY_EXCH_B           (0x151|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_CERT_REQ_A           (0x160|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_CERT_REQ_B           (0x161|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_SRVR_DONE_A          (0x170|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_SRVR_DONE_B          (0x171|SSL_ST_ACCEPT)
+/* read from client */
+# define SSL3_ST_SR_CERT_A               (0x180|SSL_ST_ACCEPT)
+# define SSL3_ST_SR_CERT_B               (0x181|SSL_ST_ACCEPT)
+# define SSL3_ST_SR_KEY_EXCH_A           (0x190|SSL_ST_ACCEPT)
+# define SSL3_ST_SR_KEY_EXCH_B           (0x191|SSL_ST_ACCEPT)
+# define SSL3_ST_SR_CERT_VRFY_A          (0x1A0|SSL_ST_ACCEPT)
+# define SSL3_ST_SR_CERT_VRFY_B          (0x1A1|SSL_ST_ACCEPT)
+# define SSL3_ST_SR_CHANGE_A             (0x1B0|SSL_ST_ACCEPT)
+# define SSL3_ST_SR_CHANGE_B             (0x1B1|SSL_ST_ACCEPT)
+# ifndef OPENSSL_NO_NEXTPROTONEG
+#  define SSL3_ST_SR_NEXT_PROTO_A         (0x210|SSL_ST_ACCEPT)
+#  define SSL3_ST_SR_NEXT_PROTO_B         (0x211|SSL_ST_ACCEPT)
+# endif
+# define SSL3_ST_SR_FINISHED_A           (0x1C0|SSL_ST_ACCEPT)
+# define SSL3_ST_SR_FINISHED_B           (0x1C1|SSL_ST_ACCEPT)
+/* write to client */
+# define SSL3_ST_SW_CHANGE_A             (0x1D0|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_CHANGE_B             (0x1D1|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_FINISHED_A           (0x1E0|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_FINISHED_B           (0x1E1|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_SESSION_TICKET_A     (0x1F0|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_SESSION_TICKET_B     (0x1F1|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_CERT_STATUS_A        (0x200|SSL_ST_ACCEPT)
+# define SSL3_ST_SW_CERT_STATUS_B        (0x201|SSL_ST_ACCEPT)
+
+# define SSL3_MT_HELLO_REQUEST                   0
+# define SSL3_MT_CLIENT_HELLO                    1
+# define SSL3_MT_SERVER_HELLO                    2
+# define SSL3_MT_NEWSESSION_TICKET               4
+# define SSL3_MT_CERTIFICATE                     11
+# define SSL3_MT_SERVER_KEY_EXCHANGE             12
+# define SSL3_MT_CERTIFICATE_REQUEST             13
+# define SSL3_MT_SERVER_DONE                     14
+# define SSL3_MT_CERTIFICATE_VERIFY              15
+# define SSL3_MT_CLIENT_KEY_EXCHANGE             16
+# define SSL3_MT_FINISHED                        20
+# define SSL3_MT_CERTIFICATE_STATUS              22
+# ifndef OPENSSL_NO_NEXTPROTONEG
+#  define SSL3_MT_NEXT_PROTO                      67
+# endif
+# define DTLS1_MT_HELLO_VERIFY_REQUEST    3
+
+# define SSL3_MT_CCS                             1
+
+/* These are used when changing over to a new cipher */
+# define SSL3_CC_READ            0x01
+# define SSL3_CC_WRITE           0x02
+# define SSL3_CC_CLIENT          0x10
+# define SSL3_CC_SERVER          0x20
+# define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE)
+# define SSL3_CHANGE_CIPHER_SERVER_READ  (SSL3_CC_SERVER|SSL3_CC_READ)
+# define SSL3_CHANGE_CIPHER_CLIENT_READ  (SSL3_CC_CLIENT|SSL3_CC_READ)
+# define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE)
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ssl3.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/tls1.h
===================================================================
--- lab4/.minix-src/include/openssl/tls1.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/tls1.h	(revision 13)
@@ -0,0 +1,788 @@
+/* ssl/tls1.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* ====================================================================
+ * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ *
+ * Portions of the attached software ("Contribution") are developed by
+ * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
+ *
+ * The Contribution is licensed pursuant to the OpenSSL open source
+ * license provided above.
+ *
+ * ECC cipher suite support in OpenSSL originally written by
+ * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.
+ *
+ */
+/* ====================================================================
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
+
+#ifndef HEADER_TLS1_H
+# define HEADER_TLS1_H
+
+# include <openssl/buffer.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES    0
+
+# define TLS1_VERSION                    0x0301
+# define TLS1_1_VERSION                  0x0302
+# define TLS1_2_VERSION                  0x0303
+# define TLS_MAX_VERSION                 TLS1_2_VERSION
+
+# define TLS1_VERSION_MAJOR              0x03
+# define TLS1_VERSION_MINOR              0x01
+
+# define TLS1_1_VERSION_MAJOR            0x03
+# define TLS1_1_VERSION_MINOR            0x02
+
+# define TLS1_2_VERSION_MAJOR            0x03
+# define TLS1_2_VERSION_MINOR            0x03
+
+# define TLS1_get_version(s) \
+                ((s->version >> 8) == TLS1_VERSION_MAJOR ? s->version : 0)
+
+# define TLS1_get_client_version(s) \
+                ((s->client_version >> 8) == TLS1_VERSION_MAJOR ? s->client_version : 0)
+
+# define TLS1_AD_DECRYPTION_FAILED       21
+# define TLS1_AD_RECORD_OVERFLOW         22
+# define TLS1_AD_UNKNOWN_CA              48/* fatal */
+# define TLS1_AD_ACCESS_DENIED           49/* fatal */
+# define TLS1_AD_DECODE_ERROR            50/* fatal */
+# define TLS1_AD_DECRYPT_ERROR           51
+# define TLS1_AD_EXPORT_RESTRICTION      60/* fatal */
+# define TLS1_AD_PROTOCOL_VERSION        70/* fatal */
+# define TLS1_AD_INSUFFICIENT_SECURITY   71/* fatal */
+# define TLS1_AD_INTERNAL_ERROR          80/* fatal */
+# define TLS1_AD_INAPPROPRIATE_FALLBACK  86/* fatal */
+# define TLS1_AD_USER_CANCELLED          90
+# define TLS1_AD_NO_RENEGOTIATION        100
+/* codes 110-114 are from RFC3546 */
+# define TLS1_AD_UNSUPPORTED_EXTENSION   110
+# define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111
+# define TLS1_AD_UNRECOGNIZED_NAME       112
+# define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113
+# define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114
+# define TLS1_AD_UNKNOWN_PSK_IDENTITY    115/* fatal */
+
+/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */
+# define TLSEXT_TYPE_server_name                 0
+# define TLSEXT_TYPE_max_fragment_length         1
+# define TLSEXT_TYPE_client_certificate_url      2
+# define TLSEXT_TYPE_trusted_ca_keys             3
+# define TLSEXT_TYPE_truncated_hmac              4
+# define TLSEXT_TYPE_status_request              5
+/* ExtensionType values from RFC4681 */
+# define TLSEXT_TYPE_user_mapping                6
+
+/* ExtensionType values from RFC5878 */
+# define TLSEXT_TYPE_client_authz                7
+# define TLSEXT_TYPE_server_authz                8
+
+/* ExtensionType values from RFC6091 */
+# define TLSEXT_TYPE_cert_type           9
+
+/* ExtensionType values from RFC4492 */
+# define TLSEXT_TYPE_elliptic_curves             10
+# define TLSEXT_TYPE_ec_point_formats            11
+
+/* ExtensionType value from RFC5054 */
+# define TLSEXT_TYPE_srp                         12
+
+/* ExtensionType values from RFC5246 */
+# define TLSEXT_TYPE_signature_algorithms        13
+
+/* ExtensionType value from RFC5764 */
+# define TLSEXT_TYPE_use_srtp    14
+
+/* ExtensionType value from RFC5620 */
+# define TLSEXT_TYPE_heartbeat   15
+
+/*
+ * ExtensionType value for TLS padding extension.
+ * http://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml
+ * http://tools.ietf.org/html/draft-agl-tls-padding-03
+ */
+# define TLSEXT_TYPE_padding     21
+
+/* ExtensionType value from RFC4507 */
+# define TLSEXT_TYPE_session_ticket              35
+
+/* ExtensionType value from draft-rescorla-tls-opaque-prf-input-00.txt */
+# if 0
+/*
+ * will have to be provided externally for now ,
+ * i.e. build with -DTLSEXT_TYPE_opaque_prf_input=38183
+ * using whatever extension number you'd like to try
+ */
+#  define TLSEXT_TYPE_opaque_prf_input           ?? */
+# endif
+
+/* Temporary extension type */
+# define TLSEXT_TYPE_renegotiate                 0xff01
+
+# ifndef OPENSSL_NO_NEXTPROTONEG
+/* This is not an IANA defined extension number */
+#  define TLSEXT_TYPE_next_proto_neg              13172
+# endif
+
+/* NameType value from RFC 3546 */
+# define TLSEXT_NAMETYPE_host_name 0
+/* status request value from RFC 3546 */
+# define TLSEXT_STATUSTYPE_ocsp 1
+
+/* ECPointFormat values from draft-ietf-tls-ecc-12 */
+# define TLSEXT_ECPOINTFORMAT_first                      0
+# define TLSEXT_ECPOINTFORMAT_uncompressed               0
+# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime  1
+# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2  2
+# define TLSEXT_ECPOINTFORMAT_last                       2
+
+/* Signature and hash algorithms from RFC 5246 */
+
+# define TLSEXT_signature_anonymous                      0
+# define TLSEXT_signature_rsa                            1
+# define TLSEXT_signature_dsa                            2
+# define TLSEXT_signature_ecdsa                          3
+
+# define TLSEXT_hash_none                                0
+# define TLSEXT_hash_md5                                 1
+# define TLSEXT_hash_sha1                                2
+# define TLSEXT_hash_sha224                              3
+# define TLSEXT_hash_sha256                              4
+# define TLSEXT_hash_sha384                              5
+# define TLSEXT_hash_sha512                              6
+
+# ifndef OPENSSL_NO_TLSEXT
+
+#  define TLSEXT_MAXLEN_host_name 255
+
+const char *SSL_get_servername(const SSL *s, const int type);
+int SSL_get_servername_type(const SSL *s);
+/*
+ * SSL_export_keying_material exports a value derived from the master secret,
+ * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and
+ * optional context. (Since a zero length context is allowed, the |use_context|
+ * flag controls whether a context is included.) It returns 1 on success and
+ * zero otherwise.
+ */
+int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
+                               const char *label, size_t llen,
+                               const unsigned char *p, size_t plen,
+                               int use_context);
+
+#  define SSL_set_tlsext_host_name(s,name) \
+SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)name)
+
+#  define SSL_set_tlsext_debug_callback(ssl, cb) \
+SSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,(void (*)(void))cb)
+
+#  define SSL_set_tlsext_debug_arg(ssl, arg) \
+SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0, (void *)arg)
+
+#  define SSL_set_tlsext_status_type(ssl, type) \
+SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type, NULL)
+
+#  define SSL_get_tlsext_status_exts(ssl, arg) \
+SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0, (void *)arg)
+
+#  define SSL_set_tlsext_status_exts(ssl, arg) \
+SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0, (void *)arg)
+
+#  define SSL_get_tlsext_status_ids(ssl, arg) \
+SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0, (void *)arg)
+
+#  define SSL_set_tlsext_status_ids(ssl, arg) \
+SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0, (void *)arg)
+
+#  define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \
+SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0, (void *)arg)
+
+#  define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \
+SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen, (void *)arg)
+
+#  define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \
+SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,(void (*)(void))cb)
+
+#  define SSL_TLSEXT_ERR_OK 0
+#  define SSL_TLSEXT_ERR_ALERT_WARNING 1
+#  define SSL_TLSEXT_ERR_ALERT_FATAL 2
+#  define SSL_TLSEXT_ERR_NOACK 3
+
+#  define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \
+SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0, (void *)arg)
+
+#  define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \
+        SSL_CTX_ctrl((ctx),SSL_CTRL_GET_TLSEXT_TICKET_KEYS,(keylen),(keys))
+#  define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \
+        SSL_CTX_ctrl((ctx),SSL_CTRL_SET_TLSEXT_TICKET_KEYS,(keylen),(keys))
+
+#  define SSL_CTX_set_tlsext_status_cb(ssl, cb) \
+SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,(void (*)(void))cb)
+
+#  define SSL_CTX_set_tlsext_status_arg(ssl, arg) \
+SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0, (void *)arg)
+
+#  define SSL_set_tlsext_opaque_prf_input(s, src, len) \
+SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT, len, src)
+#  define SSL_CTX_set_tlsext_opaque_prf_input_callback(ctx, cb) \
+SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB, (void (*)(void))cb)
+#  define SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(ctx, arg) \
+SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG, 0, arg)
+
+#  define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \
+SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)
+
+#  ifndef OPENSSL_NO_HEARTBEATS
+#   define SSL_TLSEXT_HB_ENABLED                           0x01
+#   define SSL_TLSEXT_HB_DONT_SEND_REQUESTS        0x02
+#   define SSL_TLSEXT_HB_DONT_RECV_REQUESTS        0x04
+
+#   define SSL_get_tlsext_heartbeat_pending(ssl) \
+        SSL_ctrl((ssl),SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING,0,NULL)
+#   define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \
+        SSL_ctrl((ssl),SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL)
+#  endif
+# endif
+
+/* PSK ciphersuites from 4279 */
+# define TLS1_CK_PSK_WITH_RC4_128_SHA                    0x0300008A
+# define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA               0x0300008B
+# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA                0x0300008C
+# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA                0x0300008D
+
+/*
+ * Additional TLS ciphersuites from expired Internet Draft
+ * draft-ietf-tls-56-bit-ciphersuites-01.txt (available if
+ * TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES is defined, see s3_lib.c).  We
+ * actually treat them like SSL 3.0 ciphers, which we probably shouldn't.
+ * Note that the first two are actually not in the IDs.
+ */
+# define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5          0x03000060/* not in
+                                                                    * ID */
+# define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5      0x03000061/* not in
+                                                                    * ID */
+# define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA         0x03000062
+# define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA     0x03000063
+# define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA          0x03000064
+# define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA      0x03000065
+# define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA                0x03000066
+
+/* AES ciphersuites from RFC3268 */
+
+# define TLS1_CK_RSA_WITH_AES_128_SHA                    0x0300002F
+# define TLS1_CK_DH_DSS_WITH_AES_128_SHA                 0x03000030
+# define TLS1_CK_DH_RSA_WITH_AES_128_SHA                 0x03000031
+# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA                0x03000032
+# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA                0x03000033
+# define TLS1_CK_ADH_WITH_AES_128_SHA                    0x03000034
+
+# define TLS1_CK_RSA_WITH_AES_256_SHA                    0x03000035
+# define TLS1_CK_DH_DSS_WITH_AES_256_SHA                 0x03000036
+# define TLS1_CK_DH_RSA_WITH_AES_256_SHA                 0x03000037
+# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA                0x03000038
+# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA                0x03000039
+# define TLS1_CK_ADH_WITH_AES_256_SHA                    0x0300003A
+
+/* TLS v1.2 ciphersuites */
+# define TLS1_CK_RSA_WITH_NULL_SHA256                    0x0300003B
+# define TLS1_CK_RSA_WITH_AES_128_SHA256                 0x0300003C
+# define TLS1_CK_RSA_WITH_AES_256_SHA256                 0x0300003D
+# define TLS1_CK_DH_DSS_WITH_AES_128_SHA256              0x0300003E
+# define TLS1_CK_DH_RSA_WITH_AES_128_SHA256              0x0300003F
+# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256             0x03000040
+
+/* Camellia ciphersuites from RFC4132 */
+# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA           0x03000041
+# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA        0x03000042
+# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA        0x03000043
+# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA       0x03000044
+# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA       0x03000045
+# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA           0x03000046
+
+/* TLS v1.2 ciphersuites */
+# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256             0x03000067
+# define TLS1_CK_DH_DSS_WITH_AES_256_SHA256              0x03000068
+# define TLS1_CK_DH_RSA_WITH_AES_256_SHA256              0x03000069
+# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256             0x0300006A
+# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256             0x0300006B
+# define TLS1_CK_ADH_WITH_AES_128_SHA256                 0x0300006C
+# define TLS1_CK_ADH_WITH_AES_256_SHA256                 0x0300006D
+
+/* Camellia ciphersuites from RFC4132 */
+# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA           0x03000084
+# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA        0x03000085
+# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA        0x03000086
+# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA       0x03000087
+# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA       0x03000088
+# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA           0x03000089
+
+/* SEED ciphersuites from RFC4162 */
+# define TLS1_CK_RSA_WITH_SEED_SHA                       0x03000096
+# define TLS1_CK_DH_DSS_WITH_SEED_SHA                    0x03000097
+# define TLS1_CK_DH_RSA_WITH_SEED_SHA                    0x03000098
+# define TLS1_CK_DHE_DSS_WITH_SEED_SHA                   0x03000099
+# define TLS1_CK_DHE_RSA_WITH_SEED_SHA                   0x0300009A
+# define TLS1_CK_ADH_WITH_SEED_SHA                       0x0300009B
+
+/* TLS v1.2 GCM ciphersuites from RFC5288 */
+# define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256             0x0300009C
+# define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384             0x0300009D
+# define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256         0x0300009E
+# define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384         0x0300009F
+# define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256          0x030000A0
+# define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384          0x030000A1
+# define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256         0x030000A2
+# define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384         0x030000A3
+# define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256          0x030000A4
+# define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384          0x030000A5
+# define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256             0x030000A6
+# define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384             0x030000A7
+
+/*
+ * ECC ciphersuites from draft-ietf-tls-ecc-12.txt with changes soon to be in
+ * draft 13
+ */
+# define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA                0x0300C001
+# define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA             0x0300C002
+# define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA        0x0300C003
+# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA         0x0300C004
+# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA         0x0300C005
+
+# define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA               0x0300C006
+# define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA            0x0300C007
+# define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA       0x0300C008
+# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA        0x0300C009
+# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA        0x0300C00A
+
+# define TLS1_CK_ECDH_RSA_WITH_NULL_SHA                  0x0300C00B
+# define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA               0x0300C00C
+# define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA          0x0300C00D
+# define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA           0x0300C00E
+# define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA           0x0300C00F
+
+# define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA                 0x0300C010
+# define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA              0x0300C011
+# define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA         0x0300C012
+# define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA          0x0300C013
+# define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA          0x0300C014
+
+# define TLS1_CK_ECDH_anon_WITH_NULL_SHA                 0x0300C015
+# define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA              0x0300C016
+# define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA         0x0300C017
+# define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA          0x0300C018
+# define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA          0x0300C019
+
+/* SRP ciphersuites from RFC 5054 */
+# define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA           0x0300C01A
+# define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA       0x0300C01B
+# define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA       0x0300C01C
+# define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA            0x0300C01D
+# define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA        0x0300C01E
+# define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA        0x0300C01F
+# define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA            0x0300C020
+# define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA        0x0300C021
+# define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA        0x0300C022
+
+/* ECDH HMAC based ciphersuites from RFC5289 */
+
+# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256         0x0300C023
+# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384         0x0300C024
+# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256          0x0300C025
+# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384          0x0300C026
+# define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256           0x0300C027
+# define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384           0x0300C028
+# define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256            0x0300C029
+# define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384            0x0300C02A
+
+/* ECDH GCM based ciphersuites from RFC5289 */
+# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256     0x0300C02B
+# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384     0x0300C02C
+# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256      0x0300C02D
+# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384      0x0300C02E
+# define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256       0x0300C02F
+# define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384       0x0300C030
+# define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256        0x0300C031
+# define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384        0x0300C032
+
+/*
+ * XXX Inconsistency alert: The OpenSSL names of ciphers with ephemeral DH
+ * here include the string "DHE", while elsewhere it has always been "EDH".
+ * (The alias for the list of all such ciphers also is "EDH".) The
+ * specifications speak of "EDH"; maybe we should allow both forms for
+ * everything.
+ */
+# define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5         "EXP1024-RC4-MD5"
+# define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5     "EXP1024-RC2-CBC-MD5"
+# define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA        "EXP1024-DES-CBC-SHA"
+# define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA    "EXP1024-DHE-DSS-DES-CBC-SHA"
+# define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA         "EXP1024-RC4-SHA"
+# define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA     "EXP1024-DHE-DSS-RC4-SHA"
+# define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA               "DHE-DSS-RC4-SHA"
+
+/* AES ciphersuites from RFC3268 */
+# define TLS1_TXT_RSA_WITH_AES_128_SHA                   "AES128-SHA"
+# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA                "DH-DSS-AES128-SHA"
+# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA                "DH-RSA-AES128-SHA"
+# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA               "DHE-DSS-AES128-SHA"
+# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA               "DHE-RSA-AES128-SHA"
+# define TLS1_TXT_ADH_WITH_AES_128_SHA                   "ADH-AES128-SHA"
+
+# define TLS1_TXT_RSA_WITH_AES_256_SHA                   "AES256-SHA"
+# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA                "DH-DSS-AES256-SHA"
+# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA                "DH-RSA-AES256-SHA"
+# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA               "DHE-DSS-AES256-SHA"
+# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA               "DHE-RSA-AES256-SHA"
+# define TLS1_TXT_ADH_WITH_AES_256_SHA                   "ADH-AES256-SHA"
+
+/* ECC ciphersuites from draft-ietf-tls-ecc-01.txt (Mar 15, 2001) */
+# define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA               "ECDH-ECDSA-NULL-SHA"
+# define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA            "ECDH-ECDSA-RC4-SHA"
+# define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA       "ECDH-ECDSA-DES-CBC3-SHA"
+# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA        "ECDH-ECDSA-AES128-SHA"
+# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA        "ECDH-ECDSA-AES256-SHA"
+
+# define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA              "ECDHE-ECDSA-NULL-SHA"
+# define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA           "ECDHE-ECDSA-RC4-SHA"
+# define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA      "ECDHE-ECDSA-DES-CBC3-SHA"
+# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA       "ECDHE-ECDSA-AES128-SHA"
+# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA       "ECDHE-ECDSA-AES256-SHA"
+
+# define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA                 "ECDH-RSA-NULL-SHA"
+# define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA              "ECDH-RSA-RC4-SHA"
+# define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA         "ECDH-RSA-DES-CBC3-SHA"
+# define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA          "ECDH-RSA-AES128-SHA"
+# define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA          "ECDH-RSA-AES256-SHA"
+
+# define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA                "ECDHE-RSA-NULL-SHA"
+# define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA             "ECDHE-RSA-RC4-SHA"
+# define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA        "ECDHE-RSA-DES-CBC3-SHA"
+# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA         "ECDHE-RSA-AES128-SHA"
+# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA         "ECDHE-RSA-AES256-SHA"
+
+# define TLS1_TXT_ECDH_anon_WITH_NULL_SHA                "AECDH-NULL-SHA"
+# define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA             "AECDH-RC4-SHA"
+# define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA        "AECDH-DES-CBC3-SHA"
+# define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA         "AECDH-AES128-SHA"
+# define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA         "AECDH-AES256-SHA"
+
+/* PSK ciphersuites from RFC 4279 */
+# define TLS1_TXT_PSK_WITH_RC4_128_SHA                   "PSK-RC4-SHA"
+# define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA              "PSK-3DES-EDE-CBC-SHA"
+# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA               "PSK-AES128-CBC-SHA"
+# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA               "PSK-AES256-CBC-SHA"
+
+/* SRP ciphersuite from RFC 5054 */
+# define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA          "SRP-3DES-EDE-CBC-SHA"
+# define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA      "SRP-RSA-3DES-EDE-CBC-SHA"
+# define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA      "SRP-DSS-3DES-EDE-CBC-SHA"
+# define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA           "SRP-AES-128-CBC-SHA"
+# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA       "SRP-RSA-AES-128-CBC-SHA"
+# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA       "SRP-DSS-AES-128-CBC-SHA"
+# define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA           "SRP-AES-256-CBC-SHA"
+# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA       "SRP-RSA-AES-256-CBC-SHA"
+# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA       "SRP-DSS-AES-256-CBC-SHA"
+
+/* Camellia ciphersuites from RFC4132 */
+# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA          "CAMELLIA128-SHA"
+# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA       "DH-DSS-CAMELLIA128-SHA"
+# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA       "DH-RSA-CAMELLIA128-SHA"
+# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA      "DHE-DSS-CAMELLIA128-SHA"
+# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA      "DHE-RSA-CAMELLIA128-SHA"
+# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA          "ADH-CAMELLIA128-SHA"
+
+# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA          "CAMELLIA256-SHA"
+# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA       "DH-DSS-CAMELLIA256-SHA"
+# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA       "DH-RSA-CAMELLIA256-SHA"
+# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA      "DHE-DSS-CAMELLIA256-SHA"
+# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA      "DHE-RSA-CAMELLIA256-SHA"
+# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA          "ADH-CAMELLIA256-SHA"
+
+/* SEED ciphersuites from RFC4162 */
+# define TLS1_TXT_RSA_WITH_SEED_SHA                      "SEED-SHA"
+# define TLS1_TXT_DH_DSS_WITH_SEED_SHA                   "DH-DSS-SEED-SHA"
+# define TLS1_TXT_DH_RSA_WITH_SEED_SHA                   "DH-RSA-SEED-SHA"
+# define TLS1_TXT_DHE_DSS_WITH_SEED_SHA                  "DHE-DSS-SEED-SHA"
+# define TLS1_TXT_DHE_RSA_WITH_SEED_SHA                  "DHE-RSA-SEED-SHA"
+# define TLS1_TXT_ADH_WITH_SEED_SHA                      "ADH-SEED-SHA"
+
+/* TLS v1.2 ciphersuites */
+# define TLS1_TXT_RSA_WITH_NULL_SHA256                   "NULL-SHA256"
+# define TLS1_TXT_RSA_WITH_AES_128_SHA256                "AES128-SHA256"
+# define TLS1_TXT_RSA_WITH_AES_256_SHA256                "AES256-SHA256"
+# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256             "DH-DSS-AES128-SHA256"
+# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256             "DH-RSA-AES128-SHA256"
+# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256            "DHE-DSS-AES128-SHA256"
+# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256            "DHE-RSA-AES128-SHA256"
+# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256             "DH-DSS-AES256-SHA256"
+# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256             "DH-RSA-AES256-SHA256"
+# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256            "DHE-DSS-AES256-SHA256"
+# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256            "DHE-RSA-AES256-SHA256"
+# define TLS1_TXT_ADH_WITH_AES_128_SHA256                "ADH-AES128-SHA256"
+# define TLS1_TXT_ADH_WITH_AES_256_SHA256                "ADH-AES256-SHA256"
+
+/* TLS v1.2 GCM ciphersuites from RFC5288 */
+# define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256            "AES128-GCM-SHA256"
+# define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384            "AES256-GCM-SHA384"
+# define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256        "DHE-RSA-AES128-GCM-SHA256"
+# define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384        "DHE-RSA-AES256-GCM-SHA384"
+# define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256         "DH-RSA-AES128-GCM-SHA256"
+# define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384         "DH-RSA-AES256-GCM-SHA384"
+# define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256        "DHE-DSS-AES128-GCM-SHA256"
+# define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384        "DHE-DSS-AES256-GCM-SHA384"
+# define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256         "DH-DSS-AES128-GCM-SHA256"
+# define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384         "DH-DSS-AES256-GCM-SHA384"
+# define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256            "ADH-AES128-GCM-SHA256"
+# define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384            "ADH-AES256-GCM-SHA384"
+
+/* ECDH HMAC based ciphersuites from RFC5289 */
+
+# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256    "ECDHE-ECDSA-AES128-SHA256"
+# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384    "ECDHE-ECDSA-AES256-SHA384"
+# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256     "ECDH-ECDSA-AES128-SHA256"
+# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384     "ECDH-ECDSA-AES256-SHA384"
+# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256      "ECDHE-RSA-AES128-SHA256"
+# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384      "ECDHE-RSA-AES256-SHA384"
+# define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256       "ECDH-RSA-AES128-SHA256"
+# define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384       "ECDH-RSA-AES256-SHA384"
+
+/* ECDH GCM based ciphersuites from RFC5289 */
+# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256    "ECDHE-ECDSA-AES128-GCM-SHA256"
+# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384    "ECDHE-ECDSA-AES256-GCM-SHA384"
+# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256     "ECDH-ECDSA-AES128-GCM-SHA256"
+# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384     "ECDH-ECDSA-AES256-GCM-SHA384"
+# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256      "ECDHE-RSA-AES128-GCM-SHA256"
+# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384      "ECDHE-RSA-AES256-GCM-SHA384"
+# define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256       "ECDH-RSA-AES128-GCM-SHA256"
+# define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384       "ECDH-RSA-AES256-GCM-SHA384"
+
+# define TLS_CT_RSA_SIGN                 1
+# define TLS_CT_DSS_SIGN                 2
+# define TLS_CT_RSA_FIXED_DH             3
+# define TLS_CT_DSS_FIXED_DH             4
+# define TLS_CT_ECDSA_SIGN               64
+# define TLS_CT_RSA_FIXED_ECDH           65
+# define TLS_CT_ECDSA_FIXED_ECDH         66
+# define TLS_CT_GOST94_SIGN              21
+# define TLS_CT_GOST01_SIGN              22
+/*
+ * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see
+ * comment there)
+ */
+# define TLS_CT_NUMBER                   9
+
+# define TLS1_FINISH_MAC_LENGTH          12
+
+# define TLS_MD_MAX_CONST_SIZE                   20
+# define TLS_MD_CLIENT_FINISH_CONST              "client finished"
+# define TLS_MD_CLIENT_FINISH_CONST_SIZE         15
+# define TLS_MD_SERVER_FINISH_CONST              "server finished"
+# define TLS_MD_SERVER_FINISH_CONST_SIZE         15
+# define TLS_MD_SERVER_WRITE_KEY_CONST           "server write key"
+# define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE      16
+# define TLS_MD_KEY_EXPANSION_CONST              "key expansion"
+# define TLS_MD_KEY_EXPANSION_CONST_SIZE         13
+# define TLS_MD_CLIENT_WRITE_KEY_CONST           "client write key"
+# define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE      16
+# define TLS_MD_SERVER_WRITE_KEY_CONST           "server write key"
+# define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE      16
+# define TLS_MD_IV_BLOCK_CONST                   "IV block"
+# define TLS_MD_IV_BLOCK_CONST_SIZE              8
+# define TLS_MD_MASTER_SECRET_CONST              "master secret"
+# define TLS_MD_MASTER_SECRET_CONST_SIZE         13
+
+# ifdef CHARSET_EBCDIC
+#  undef TLS_MD_CLIENT_FINISH_CONST
+/*
+ * client finished
+ */
+#  define TLS_MD_CLIENT_FINISH_CONST    "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64"
+
+#  undef TLS_MD_SERVER_FINISH_CONST
+/*
+ * server finished
+ */
+#  define TLS_MD_SERVER_FINISH_CONST    "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64"
+
+#  undef TLS_MD_SERVER_WRITE_KEY_CONST
+/*
+ * server write key
+ */
+#  define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79"
+
+#  undef TLS_MD_KEY_EXPANSION_CONST
+/*
+ * key expansion
+ */
+#  define TLS_MD_KEY_EXPANSION_CONST    "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e"
+
+#  undef TLS_MD_CLIENT_WRITE_KEY_CONST
+/*
+ * client write key
+ */
+#  define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79"
+
+#  undef TLS_MD_SERVER_WRITE_KEY_CONST
+/*
+ * server write key
+ */
+#  define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79"
+
+#  undef TLS_MD_IV_BLOCK_CONST
+/*
+ * IV block
+ */
+#  define TLS_MD_IV_BLOCK_CONST         "\x49\x56\x20\x62\x6c\x6f\x63\x6b"
+
+#  undef TLS_MD_MASTER_SECRET_CONST
+/*
+ * master secret
+ */
+#  define TLS_MD_MASTER_SECRET_CONST    "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74"
+# endif
+
+/* TLS Session Ticket extension struct */
+struct tls_session_ticket_ext_st {
+    unsigned short length;
+    void *data;
+};
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/tls1.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ui_compat.h
===================================================================
--- lab4/.minix-src/include/openssl/ui_compat.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ui_compat.h	(revision 13)
@@ -0,0 +1,88 @@
+/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */
+/*
+ * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project
+ * 2001.
+ */
+/* ====================================================================
+ * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_UI_COMPAT_H
+# define HEADER_UI_COMPAT_H
+
+# include <openssl/opensslconf.h>
+# include <openssl/ui.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The following functions were previously part of the DES section, and are
+ * provided here for backward compatibility reasons.
+ */
+
+# define des_read_pw_string(b,l,p,v) \
+        _ossl_old_des_read_pw_string((b),(l),(p),(v))
+# define des_read_pw(b,bf,s,p,v) \
+        _ossl_old_des_read_pw((b),(bf),(s),(p),(v))
+
+int _ossl_old_des_read_pw_string(char *buf, int length, const char *prompt,
+                                 int verify);
+int _ossl_old_des_read_pw(char *buf, char *buff, int size, const char *prompt,
+                          int verify);
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ui_compat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/x509v3.h
===================================================================
--- lab4/.minix-src/include/openssl/x509v3.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/x509v3.h	(revision 13)
@@ -0,0 +1,1015 @@
+/* x509v3.h */
+/*
+ * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
+ * 1999.
+ */
+/* ====================================================================
+ * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+#ifndef HEADER_X509V3_H
+# define HEADER_X509V3_H
+
+# include <openssl/bio.h>
+# include <openssl/x509.h>
+# include <openssl/conf.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Forward reference */
+struct v3_ext_method;
+struct v3_ext_ctx;
+
+/* Useful typedefs */
+
+typedef void *(*X509V3_EXT_NEW)(void);
+typedef void (*X509V3_EXT_FREE) (void *);
+typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long);
+typedef int (*X509V3_EXT_I2D) (void *, unsigned char **);
+typedef STACK_OF(CONF_VALUE) *
+    (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext,
+                       STACK_OF(CONF_VALUE) *extlist);
+typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method,
+                                struct v3_ext_ctx *ctx,
+                                STACK_OF(CONF_VALUE) *values);
+typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method,
+                                void *ext);
+typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method,
+                                struct v3_ext_ctx *ctx, const char *str);
+typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext,
+                               BIO *out, int indent);
+typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method,
+                                struct v3_ext_ctx *ctx, const char *str);
+
+/* V3 extension structure */
+
+struct v3_ext_method {
+    int ext_nid;
+    int ext_flags;
+/* If this is set the following four fields are ignored */
+    ASN1_ITEM_EXP *it;
+/* Old style ASN1 calls */
+    X509V3_EXT_NEW ext_new;
+    X509V3_EXT_FREE ext_free;
+    X509V3_EXT_D2I d2i;
+    X509V3_EXT_I2D i2d;
+/* The following pair is used for string extensions */
+    X509V3_EXT_I2S i2s;
+    X509V3_EXT_S2I s2i;
+/* The following pair is used for multi-valued extensions */
+    X509V3_EXT_I2V i2v;
+    X509V3_EXT_V2I v2i;
+/* The following are used for raw extensions */
+    X509V3_EXT_I2R i2r;
+    X509V3_EXT_R2I r2i;
+    void *usr_data;             /* Any extension specific data */
+};
+
+typedef struct X509V3_CONF_METHOD_st {
+    char *(*get_string) (void *db, char *section, char *value);
+    STACK_OF(CONF_VALUE) *(*get_section) (void *db, char *section);
+    void (*free_string) (void *db, char *string);
+    void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section);
+} X509V3_CONF_METHOD;
+
+/* Context specific info */
+struct v3_ext_ctx {
+# define CTX_TEST 0x1
+    int flags;
+    X509 *issuer_cert;
+    X509 *subject_cert;
+    X509_REQ *subject_req;
+    X509_CRL *crl;
+    X509V3_CONF_METHOD *db_meth;
+    void *db;
+/* Maybe more here */
+};
+
+typedef struct v3_ext_method X509V3_EXT_METHOD;
+
+DECLARE_STACK_OF(X509V3_EXT_METHOD)
+
+/* ext_flags values */
+# define X509V3_EXT_DYNAMIC      0x1
+# define X509V3_EXT_CTX_DEP      0x2
+# define X509V3_EXT_MULTILINE    0x4
+
+typedef BIT_STRING_BITNAME ENUMERATED_NAMES;
+
+typedef struct BASIC_CONSTRAINTS_st {
+    int ca;
+    ASN1_INTEGER *pathlen;
+} BASIC_CONSTRAINTS;
+
+typedef struct PKEY_USAGE_PERIOD_st {
+    ASN1_GENERALIZEDTIME *notBefore;
+    ASN1_GENERALIZEDTIME *notAfter;
+} PKEY_USAGE_PERIOD;
+
+typedef struct otherName_st {
+    ASN1_OBJECT *type_id;
+    ASN1_TYPE *value;
+} OTHERNAME;
+
+typedef struct EDIPartyName_st {
+    ASN1_STRING *nameAssigner;
+    ASN1_STRING *partyName;
+} EDIPARTYNAME;
+
+typedef struct GENERAL_NAME_st {
+# define GEN_OTHERNAME   0
+# define GEN_EMAIL       1
+# define GEN_DNS         2
+# define GEN_X400        3
+# define GEN_DIRNAME     4
+# define GEN_EDIPARTY    5
+# define GEN_URI         6
+# define GEN_IPADD       7
+# define GEN_RID         8
+    int type;
+    union {
+        char *ptr;
+        OTHERNAME *otherName;   /* otherName */
+        ASN1_IA5STRING *rfc822Name;
+        ASN1_IA5STRING *dNSName;
+        ASN1_TYPE *x400Address;
+        X509_NAME *directoryName;
+        EDIPARTYNAME *ediPartyName;
+        ASN1_IA5STRING *uniformResourceIdentifier;
+        ASN1_OCTET_STRING *iPAddress;
+        ASN1_OBJECT *registeredID;
+        /* Old names */
+        ASN1_OCTET_STRING *ip;  /* iPAddress */
+        X509_NAME *dirn;        /* dirn */
+        ASN1_IA5STRING *ia5;    /* rfc822Name, dNSName,
+                                 * uniformResourceIdentifier */
+        ASN1_OBJECT *rid;       /* registeredID */
+        ASN1_TYPE *other;       /* x400Address */
+    } d;
+} GENERAL_NAME;
+
+typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES;
+
+typedef struct ACCESS_DESCRIPTION_st {
+    ASN1_OBJECT *method;
+    GENERAL_NAME *location;
+} ACCESS_DESCRIPTION;
+
+typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS;
+
+typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE;
+
+DECLARE_STACK_OF(GENERAL_NAME)
+DECLARE_ASN1_SET_OF(GENERAL_NAME)
+
+DECLARE_STACK_OF(ACCESS_DESCRIPTION)
+DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION)
+
+typedef struct DIST_POINT_NAME_st {
+    int type;
+    union {
+        GENERAL_NAMES *fullname;
+        STACK_OF(X509_NAME_ENTRY) *relativename;
+    } name;
+/* If relativename then this contains the full distribution point name */
+    X509_NAME *dpname;
+} DIST_POINT_NAME;
+/* All existing reasons */
+# define CRLDP_ALL_REASONS       0x807f
+
+# define CRL_REASON_NONE                         -1
+# define CRL_REASON_UNSPECIFIED                  0
+# define CRL_REASON_KEY_COMPROMISE               1
+# define CRL_REASON_CA_COMPROMISE                2
+# define CRL_REASON_AFFILIATION_CHANGED          3
+# define CRL_REASON_SUPERSEDED                   4
+# define CRL_REASON_CESSATION_OF_OPERATION       5
+# define CRL_REASON_CERTIFICATE_HOLD             6
+# define CRL_REASON_REMOVE_FROM_CRL              8
+# define CRL_REASON_PRIVILEGE_WITHDRAWN          9
+# define CRL_REASON_AA_COMPROMISE                10
+
+struct DIST_POINT_st {
+    DIST_POINT_NAME *distpoint;
+    ASN1_BIT_STRING *reasons;
+    GENERAL_NAMES *CRLissuer;
+    int dp_reasons;
+};
+
+typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS;
+
+DECLARE_STACK_OF(DIST_POINT)
+DECLARE_ASN1_SET_OF(DIST_POINT)
+
+struct AUTHORITY_KEYID_st {
+    ASN1_OCTET_STRING *keyid;
+    GENERAL_NAMES *issuer;
+    ASN1_INTEGER *serial;
+};
+
+/* Strong extranet structures */
+
+typedef struct SXNET_ID_st {
+    ASN1_INTEGER *zone;
+    ASN1_OCTET_STRING *user;
+} SXNETID;
+
+DECLARE_STACK_OF(SXNETID)
+DECLARE_ASN1_SET_OF(SXNETID)
+
+typedef struct SXNET_st {
+    ASN1_INTEGER *version;
+    STACK_OF(SXNETID) *ids;
+} SXNET;
+
+typedef struct NOTICEREF_st {
+    ASN1_STRING *organization;
+    STACK_OF(ASN1_INTEGER) *noticenos;
+} NOTICEREF;
+
+typedef struct USERNOTICE_st {
+    NOTICEREF *noticeref;
+    ASN1_STRING *exptext;
+} USERNOTICE;
+
+typedef struct POLICYQUALINFO_st {
+    ASN1_OBJECT *pqualid;
+    union {
+        ASN1_IA5STRING *cpsuri;
+        USERNOTICE *usernotice;
+        ASN1_TYPE *other;
+    } d;
+} POLICYQUALINFO;
+
+DECLARE_STACK_OF(POLICYQUALINFO)
+DECLARE_ASN1_SET_OF(POLICYQUALINFO)
+
+typedef struct POLICYINFO_st {
+    ASN1_OBJECT *policyid;
+    STACK_OF(POLICYQUALINFO) *qualifiers;
+} POLICYINFO;
+
+typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES;
+
+DECLARE_STACK_OF(POLICYINFO)
+DECLARE_ASN1_SET_OF(POLICYINFO)
+
+typedef struct POLICY_MAPPING_st {
+    ASN1_OBJECT *issuerDomainPolicy;
+    ASN1_OBJECT *subjectDomainPolicy;
+} POLICY_MAPPING;
+
+DECLARE_STACK_OF(POLICY_MAPPING)
+
+typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS;
+
+typedef struct GENERAL_SUBTREE_st {
+    GENERAL_NAME *base;
+    ASN1_INTEGER *minimum;
+    ASN1_INTEGER *maximum;
+} GENERAL_SUBTREE;
+
+DECLARE_STACK_OF(GENERAL_SUBTREE)
+
+struct NAME_CONSTRAINTS_st {
+    STACK_OF(GENERAL_SUBTREE) *permittedSubtrees;
+    STACK_OF(GENERAL_SUBTREE) *excludedSubtrees;
+};
+
+typedef struct POLICY_CONSTRAINTS_st {
+    ASN1_INTEGER *requireExplicitPolicy;
+    ASN1_INTEGER *inhibitPolicyMapping;
+} POLICY_CONSTRAINTS;
+
+/* Proxy certificate structures, see RFC 3820 */
+typedef struct PROXY_POLICY_st {
+    ASN1_OBJECT *policyLanguage;
+    ASN1_OCTET_STRING *policy;
+} PROXY_POLICY;
+
+typedef struct PROXY_CERT_INFO_EXTENSION_st {
+    ASN1_INTEGER *pcPathLengthConstraint;
+    PROXY_POLICY *proxyPolicy;
+} PROXY_CERT_INFO_EXTENSION;
+
+DECLARE_ASN1_FUNCTIONS(PROXY_POLICY)
+DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
+
+struct ISSUING_DIST_POINT_st {
+    DIST_POINT_NAME *distpoint;
+    int onlyuser;
+    int onlyCA;
+    ASN1_BIT_STRING *onlysomereasons;
+    int indirectCRL;
+    int onlyattr;
+};
+
+/* Values in idp_flags field */
+/* IDP present */
+# define IDP_PRESENT     0x1
+/* IDP values inconsistent */
+# define IDP_INVALID     0x2
+/* onlyuser true */
+# define IDP_ONLYUSER    0x4
+/* onlyCA true */
+# define IDP_ONLYCA      0x8
+/* onlyattr true */
+# define IDP_ONLYATTR    0x10
+/* indirectCRL true */
+# define IDP_INDIRECT    0x20
+/* onlysomereasons present */
+# define IDP_REASONS     0x40
+
+# define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \
+",name:", val->name, ",value:", val->value);
+
+# define X509V3_set_ctx_test(ctx) \
+                        X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)
+# define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL;
+
+# define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \
+                        0,0,0,0, \
+                        0,0, \
+                        (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \
+                        (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \
+                        NULL, NULL, \
+                        table}
+
+# define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \
+                        0,0,0,0, \
+                        (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \
+                        (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \
+                        0,0,0,0, \
+                        NULL}
+
+# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+
+/* X509_PURPOSE stuff */
+
+# define EXFLAG_BCONS            0x1
+# define EXFLAG_KUSAGE           0x2
+# define EXFLAG_XKUSAGE          0x4
+# define EXFLAG_NSCERT           0x8
+
+# define EXFLAG_CA               0x10
+/* Really self issued not necessarily self signed */
+# define EXFLAG_SI               0x20
+# define EXFLAG_SS               0x20
+# define EXFLAG_V1               0x40
+# define EXFLAG_INVALID          0x80
+# define EXFLAG_SET              0x100
+# define EXFLAG_CRITICAL         0x200
+# define EXFLAG_PROXY            0x400
+
+# define EXFLAG_INVALID_POLICY   0x800
+# define EXFLAG_FRESHEST         0x1000
+
+# define KU_DIGITAL_SIGNATURE    0x0080
+# define KU_NON_REPUDIATION      0x0040
+# define KU_KEY_ENCIPHERMENT     0x0020
+# define KU_DATA_ENCIPHERMENT    0x0010
+# define KU_KEY_AGREEMENT        0x0008
+# define KU_KEY_CERT_SIGN        0x0004
+# define KU_CRL_SIGN             0x0002
+# define KU_ENCIPHER_ONLY        0x0001
+# define KU_DECIPHER_ONLY        0x8000
+
+# define NS_SSL_CLIENT           0x80
+# define NS_SSL_SERVER           0x40
+# define NS_SMIME                0x20
+# define NS_OBJSIGN              0x10
+# define NS_SSL_CA               0x04
+# define NS_SMIME_CA             0x02
+# define NS_OBJSIGN_CA           0x01
+# define NS_ANY_CA               (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA)
+
+# define XKU_SSL_SERVER          0x1
+# define XKU_SSL_CLIENT          0x2
+# define XKU_SMIME               0x4
+# define XKU_CODE_SIGN           0x8
+# define XKU_SGC                 0x10
+# define XKU_OCSP_SIGN           0x20
+# define XKU_TIMESTAMP           0x40
+# define XKU_DVCS                0x80
+
+# define X509_PURPOSE_DYNAMIC    0x1
+# define X509_PURPOSE_DYNAMIC_NAME       0x2
+
+typedef struct x509_purpose_st {
+    int purpose;
+    int trust;                  /* Default trust ID */
+    int flags;
+    int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int);
+    char *name;
+    char *sname;
+    void *usr_data;
+} X509_PURPOSE;
+
+# define X509_PURPOSE_SSL_CLIENT         1
+# define X509_PURPOSE_SSL_SERVER         2
+# define X509_PURPOSE_NS_SSL_SERVER      3
+# define X509_PURPOSE_SMIME_SIGN         4
+# define X509_PURPOSE_SMIME_ENCRYPT      5
+# define X509_PURPOSE_CRL_SIGN           6
+# define X509_PURPOSE_ANY                7
+# define X509_PURPOSE_OCSP_HELPER        8
+# define X509_PURPOSE_TIMESTAMP_SIGN     9
+
+# define X509_PURPOSE_MIN                1
+# define X509_PURPOSE_MAX                9
+
+/* Flags for X509V3_EXT_print() */
+
+# define X509V3_EXT_UNKNOWN_MASK         (0xfL << 16)
+/* Return error for unknown extensions */
+# define X509V3_EXT_DEFAULT              0
+/* Print error for unknown extensions */
+# define X509V3_EXT_ERROR_UNKNOWN        (1L << 16)
+/* ASN1 parse unknown extensions */
+# define X509V3_EXT_PARSE_UNKNOWN        (2L << 16)
+/* BIO_dump unknown extensions */
+# define X509V3_EXT_DUMP_UNKNOWN         (3L << 16)
+
+/* Flags for X509V3_add1_i2d */
+
+# define X509V3_ADD_OP_MASK              0xfL
+# define X509V3_ADD_DEFAULT              0L
+# define X509V3_ADD_APPEND               1L
+# define X509V3_ADD_REPLACE              2L
+# define X509V3_ADD_REPLACE_EXISTING     3L
+# define X509V3_ADD_KEEP_EXISTING        4L
+# define X509V3_ADD_DELETE               5L
+# define X509V3_ADD_SILENT               0x10
+
+DECLARE_STACK_OF(X509_PURPOSE)
+
+DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
+
+DECLARE_ASN1_FUNCTIONS(SXNET)
+DECLARE_ASN1_FUNCTIONS(SXNETID)
+
+int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen);
+int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user,
+                       int userlen);
+int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user,
+                         int userlen);
+
+ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone);
+ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone);
+ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone);
+
+DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID)
+
+DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
+
+DECLARE_ASN1_FUNCTIONS(GENERAL_NAME)
+GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a);
+int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b);
+
+ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
+                                     X509V3_CTX *ctx,
+                                     STACK_OF(CONF_VALUE) *nval);
+STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
+                                          ASN1_BIT_STRING *bits,
+                                          STACK_OF(CONF_VALUE) *extlist);
+
+STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
+                                       GENERAL_NAME *gen,
+                                       STACK_OF(CONF_VALUE) *ret);
+int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);
+
+DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES)
+
+STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,
+                                        GENERAL_NAMES *gen,
+                                        STACK_OF(CONF_VALUE) *extlist);
+GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method,
+                                 X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+
+DECLARE_ASN1_FUNCTIONS(OTHERNAME)
+DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME)
+int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b);
+void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value);
+void *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype);
+int GENERAL_NAME_set0_othername(GENERAL_NAME *gen,
+                                ASN1_OBJECT *oid, ASN1_TYPE *value);
+int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen,
+                                ASN1_OBJECT **poid, ASN1_TYPE **pvalue);
+
+char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,
+                            ASN1_OCTET_STRING *ia5);
+ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,
+                                         X509V3_CTX *ctx, char *str);
+
+DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)
+int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION *a);
+
+DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES)
+DECLARE_ASN1_FUNCTIONS(POLICYINFO)
+DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO)
+DECLARE_ASN1_FUNCTIONS(USERNOTICE)
+DECLARE_ASN1_FUNCTIONS(NOTICEREF)
+
+DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS)
+DECLARE_ASN1_FUNCTIONS(DIST_POINT)
+DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME)
+DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT)
+
+int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname);
+
+int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc);
+
+DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)
+DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
+
+DECLARE_ASN1_ITEM(POLICY_MAPPING)
+DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)
+DECLARE_ASN1_ITEM(POLICY_MAPPINGS)
+
+DECLARE_ASN1_ITEM(GENERAL_SUBTREE)
+DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
+
+DECLARE_ASN1_ITEM(NAME_CONSTRAINTS)
+DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
+
+DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)
+DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)
+
+GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,
+                               const X509V3_EXT_METHOD *method,
+                               X509V3_CTX *ctx, int gen_type, char *value,
+                               int is_nc);
+
+# ifdef HEADER_CONF_H
+GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method,
+                               X509V3_CTX *ctx, CONF_VALUE *cnf);
+GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
+                                  const X509V3_EXT_METHOD *method,
+                                  X509V3_CTX *ctx, CONF_VALUE *cnf,
+                                  int is_nc);
+void X509V3_conf_free(CONF_VALUE *val);
+
+X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid,
+                                     char *value);
+X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name,
+                                 char *value);
+int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section,
+                            STACK_OF(X509_EXTENSION) **sk);
+int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
+                         X509 *cert);
+int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
+                             X509_REQ *req);
+int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
+                             X509_CRL *crl);
+
+X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf,
+                                    X509V3_CTX *ctx, int ext_nid,
+                                    char *value);
+X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
+                                char *name, char *value);
+int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
+                        char *section, X509 *cert);
+int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
+                            char *section, X509_REQ *req);
+int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
+                            char *section, X509_CRL *crl);
+
+int X509V3_add_value_bool_nf(char *name, int asn1_bool,
+                             STACK_OF(CONF_VALUE) **extlist);
+int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool);
+int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint);
+void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf);
+void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash);
+# endif
+
+char *X509V3_get_string(X509V3_CTX *ctx, char *name, char *section);
+STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, char *section);
+void X509V3_string_free(X509V3_CTX *ctx, char *str);
+void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section);
+void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,
+                    X509_REQ *req, X509_CRL *crl, int flags);
+
+int X509V3_add_value(const char *name, const char *value,
+                     STACK_OF(CONF_VALUE) **extlist);
+int X509V3_add_value_uchar(const char *name, const unsigned char *value,
+                           STACK_OF(CONF_VALUE) **extlist);
+int X509V3_add_value_bool(const char *name, int asn1_bool,
+                          STACK_OF(CONF_VALUE) **extlist);
+int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint,
+                         STACK_OF(CONF_VALUE) **extlist);
+char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint);
+ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value);
+char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);
+char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth,
+                                ASN1_ENUMERATED *aint);
+int X509V3_EXT_add(X509V3_EXT_METHOD *ext);
+int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist);
+int X509V3_EXT_add_alias(int nid_to, int nid_from);
+void X509V3_EXT_cleanup(void);
+
+const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext);
+const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid);
+int X509V3_add_standard_extensions(void);
+STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line);
+void *X509V3_EXT_d2i(X509_EXTENSION *ext);
+void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit,
+                     int *idx);
+
+X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);
+int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value,
+                    int crit, unsigned long flags);
+
+char *hex_to_string(const unsigned char *buffer, long len);
+unsigned char *string_to_hex(const char *str, long *len);
+int name_cmp(const char *name, const char *cmp);
+
+void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
+                        int ml);
+int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
+                     int indent);
+int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
+
+int X509V3_extensions_print(BIO *out, char *title,
+                            STACK_OF(X509_EXTENSION) *exts,
+                            unsigned long flag, int indent);
+
+int X509_check_ca(X509 *x);
+int X509_check_purpose(X509 *x, int id, int ca);
+int X509_supported_extension(X509_EXTENSION *ex);
+int X509_PURPOSE_set(int *p, int purpose);
+int X509_check_issued(X509 *issuer, X509 *subject);
+int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid);
+int X509_PURPOSE_get_count(void);
+X509_PURPOSE *X509_PURPOSE_get0(int idx);
+int X509_PURPOSE_get_by_sname(char *sname);
+int X509_PURPOSE_get_by_id(int id);
+int X509_PURPOSE_add(int id, int trust, int flags,
+                     int (*ck) (const X509_PURPOSE *, const X509 *, int),
+                     char *name, char *sname, void *arg);
+char *X509_PURPOSE_get0_name(X509_PURPOSE *xp);
+char *X509_PURPOSE_get0_sname(X509_PURPOSE *xp);
+int X509_PURPOSE_get_trust(X509_PURPOSE *xp);
+void X509_PURPOSE_cleanup(void);
+int X509_PURPOSE_get_id(X509_PURPOSE *);
+
+STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x);
+STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x);
+void X509_email_free(STACK_OF(OPENSSL_STRING) *sk);
+STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x);
+
+ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);
+ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);
+int a2i_ipadd(unsigned char *ipout, const char *ipasc);
+int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk,
+                             unsigned long chtype);
+
+void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent);
+DECLARE_STACK_OF(X509_POLICY_NODE)
+
+# ifndef OPENSSL_NO_RFC3779
+
+typedef struct ASRange_st {
+    ASN1_INTEGER *min, *max;
+} ASRange;
+
+#  define ASIdOrRange_id          0
+#  define ASIdOrRange_range       1
+
+typedef struct ASIdOrRange_st {
+    int type;
+    union {
+        ASN1_INTEGER *id;
+        ASRange *range;
+    } u;
+} ASIdOrRange;
+
+typedef STACK_OF(ASIdOrRange) ASIdOrRanges;
+DECLARE_STACK_OF(ASIdOrRange)
+
+#  define ASIdentifierChoice_inherit              0
+#  define ASIdentifierChoice_asIdsOrRanges        1
+
+typedef struct ASIdentifierChoice_st {
+    int type;
+    union {
+        ASN1_NULL *inherit;
+        ASIdOrRanges *asIdsOrRanges;
+    } u;
+} ASIdentifierChoice;
+
+typedef struct ASIdentifiers_st {
+    ASIdentifierChoice *asnum, *rdi;
+} ASIdentifiers;
+
+DECLARE_ASN1_FUNCTIONS(ASRange)
+DECLARE_ASN1_FUNCTIONS(ASIdOrRange)
+DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice)
+DECLARE_ASN1_FUNCTIONS(ASIdentifiers)
+
+typedef struct IPAddressRange_st {
+    ASN1_BIT_STRING *min, *max;
+} IPAddressRange;
+
+#  define IPAddressOrRange_addressPrefix  0
+#  define IPAddressOrRange_addressRange   1
+
+typedef struct IPAddressOrRange_st {
+    int type;
+    union {
+        ASN1_BIT_STRING *addressPrefix;
+        IPAddressRange *addressRange;
+    } u;
+} IPAddressOrRange;
+
+typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges;
+DECLARE_STACK_OF(IPAddressOrRange)
+
+#  define IPAddressChoice_inherit                 0
+#  define IPAddressChoice_addressesOrRanges       1
+
+typedef struct IPAddressChoice_st {
+    int type;
+    union {
+        ASN1_NULL *inherit;
+        IPAddressOrRanges *addressesOrRanges;
+    } u;
+} IPAddressChoice;
+
+typedef struct IPAddressFamily_st {
+    ASN1_OCTET_STRING *addressFamily;
+    IPAddressChoice *ipAddressChoice;
+} IPAddressFamily;
+
+typedef STACK_OF(IPAddressFamily) IPAddrBlocks;
+DECLARE_STACK_OF(IPAddressFamily)
+
+DECLARE_ASN1_FUNCTIONS(IPAddressRange)
+DECLARE_ASN1_FUNCTIONS(IPAddressOrRange)
+DECLARE_ASN1_FUNCTIONS(IPAddressChoice)
+DECLARE_ASN1_FUNCTIONS(IPAddressFamily)
+
+/*
+ * API tag for elements of the ASIdentifer SEQUENCE.
+ */
+#  define V3_ASID_ASNUM   0
+#  define V3_ASID_RDI     1
+
+/*
+ * AFI values, assigned by IANA.  It'd be nice to make the AFI
+ * handling code totally generic, but there are too many little things
+ * that would need to be defined for other address families for it to
+ * be worth the trouble.
+ */
+#  define IANA_AFI_IPV4   1
+#  define IANA_AFI_IPV6   2
+
+/*
+ * Utilities to construct and extract values from RFC3779 extensions,
+ * since some of the encodings (particularly for IP address prefixes
+ * and ranges) are a bit tedious to work with directly.
+ */
+int v3_asid_add_inherit(ASIdentifiers *asid, int which);
+int v3_asid_add_id_or_range(ASIdentifiers *asid, int which,
+                            ASN1_INTEGER *min, ASN1_INTEGER *max);
+int v3_addr_add_inherit(IPAddrBlocks *addr,
+                        const unsigned afi, const unsigned *safi);
+int v3_addr_add_prefix(IPAddrBlocks *addr,
+                       const unsigned afi, const unsigned *safi,
+                       unsigned char *a, const int prefixlen);
+int v3_addr_add_range(IPAddrBlocks *addr,
+                      const unsigned afi, const unsigned *safi,
+                      unsigned char *min, unsigned char *max);
+unsigned v3_addr_get_afi(const IPAddressFamily *f);
+int v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi,
+                      unsigned char *min, unsigned char *max,
+                      const int length);
+
+/*
+ * Canonical forms.
+ */
+int v3_asid_is_canonical(ASIdentifiers *asid);
+int v3_addr_is_canonical(IPAddrBlocks *addr);
+int v3_asid_canonize(ASIdentifiers *asid);
+int v3_addr_canonize(IPAddrBlocks *addr);
+
+/*
+ * Tests for inheritance and containment.
+ */
+int v3_asid_inherits(ASIdentifiers *asid);
+int v3_addr_inherits(IPAddrBlocks *addr);
+int v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b);
+int v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b);
+
+/*
+ * Check whether RFC 3779 extensions nest properly in chains.
+ */
+int v3_asid_validate_path(X509_STORE_CTX *);
+int v3_addr_validate_path(X509_STORE_CTX *);
+int v3_asid_validate_resource_set(STACK_OF(X509) *chain,
+                                  ASIdentifiers *ext, int allow_inheritance);
+int v3_addr_validate_resource_set(STACK_OF(X509) *chain,
+                                  IPAddrBlocks *ext, int allow_inheritance);
+
+# endif                         /* OPENSSL_NO_RFC3779 */
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_X509V3_strings(void);
+
+/* Error codes for the X509V3 functions. */
+
+/* Function codes. */
+# define X509V3_F_A2I_GENERAL_NAME                        164
+# define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE             161
+# define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL         162
+# define X509V3_F_COPY_EMAIL                              122
+# define X509V3_F_COPY_ISSUER                             123
+# define X509V3_F_DO_DIRNAME                              144
+# define X509V3_F_DO_EXT_CONF                             124
+# define X509V3_F_DO_EXT_I2D                              135
+# define X509V3_F_DO_EXT_NCONF                            151
+# define X509V3_F_DO_I2V_NAME_CONSTRAINTS                 148
+# define X509V3_F_GNAMES_FROM_SECTNAME                    156
+# define X509V3_F_HEX_TO_STRING                           111
+# define X509V3_F_I2S_ASN1_ENUMERATED                     121
+# define X509V3_F_I2S_ASN1_IA5STRING                      149
+# define X509V3_F_I2S_ASN1_INTEGER                        120
+# define X509V3_F_I2V_AUTHORITY_INFO_ACCESS               138
+# define X509V3_F_NOTICE_SECTION                          132
+# define X509V3_F_NREF_NOS                                133
+# define X509V3_F_POLICY_SECTION                          131
+# define X509V3_F_PROCESS_PCI_VALUE                       150
+# define X509V3_F_R2I_CERTPOL                             130
+# define X509V3_F_R2I_PCI                                 155
+# define X509V3_F_S2I_ASN1_IA5STRING                      100
+# define X509V3_F_S2I_ASN1_INTEGER                        108
+# define X509V3_F_S2I_ASN1_OCTET_STRING                   112
+# define X509V3_F_S2I_ASN1_SKEY_ID                        114
+# define X509V3_F_S2I_SKEY_ID                             115
+# define X509V3_F_SET_DIST_POINT_NAME                     158
+# define X509V3_F_STRING_TO_HEX                           113
+# define X509V3_F_SXNET_ADD_ID_ASC                        125
+# define X509V3_F_SXNET_ADD_ID_INTEGER                    126
+# define X509V3_F_SXNET_ADD_ID_ULONG                      127
+# define X509V3_F_SXNET_GET_ID_ASC                        128
+# define X509V3_F_SXNET_GET_ID_ULONG                      129
+# define X509V3_F_V2I_ASIDENTIFIERS                       163
+# define X509V3_F_V2I_ASN1_BIT_STRING                     101
+# define X509V3_F_V2I_AUTHORITY_INFO_ACCESS               139
+# define X509V3_F_V2I_AUTHORITY_KEYID                     119
+# define X509V3_F_V2I_BASIC_CONSTRAINTS                   102
+# define X509V3_F_V2I_CRLD                                134
+# define X509V3_F_V2I_EXTENDED_KEY_USAGE                  103
+# define X509V3_F_V2I_GENERAL_NAMES                       118
+# define X509V3_F_V2I_GENERAL_NAME_EX                     117
+# define X509V3_F_V2I_IDP                                 157
+# define X509V3_F_V2I_IPADDRBLOCKS                        159
+# define X509V3_F_V2I_ISSUER_ALT                          153
+# define X509V3_F_V2I_NAME_CONSTRAINTS                    147
+# define X509V3_F_V2I_POLICY_CONSTRAINTS                  146
+# define X509V3_F_V2I_POLICY_MAPPINGS                     145
+# define X509V3_F_V2I_SUBJECT_ALT                         154
+# define X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL          160
+# define X509V3_F_V3_GENERIC_EXTENSION                    116
+# define X509V3_F_X509V3_ADD1_I2D                         140
+# define X509V3_F_X509V3_ADD_VALUE                        105
+# define X509V3_F_X509V3_EXT_ADD                          104
+# define X509V3_F_X509V3_EXT_ADD_ALIAS                    106
+# define X509V3_F_X509V3_EXT_CONF                         107
+# define X509V3_F_X509V3_EXT_I2D                          136
+# define X509V3_F_X509V3_EXT_NCONF                        152
+# define X509V3_F_X509V3_GET_SECTION                      142
+# define X509V3_F_X509V3_GET_STRING                       143
+# define X509V3_F_X509V3_GET_VALUE_BOOL                   110
+# define X509V3_F_X509V3_PARSE_LIST                       109
+# define X509V3_F_X509_PURPOSE_ADD                        137
+# define X509V3_F_X509_PURPOSE_SET                        141
+
+/* Reason codes. */
+# define X509V3_R_BAD_IP_ADDRESS                          118
+# define X509V3_R_BAD_OBJECT                              119
+# define X509V3_R_BN_DEC2BN_ERROR                         100
+# define X509V3_R_BN_TO_ASN1_INTEGER_ERROR                101
+# define X509V3_R_DIRNAME_ERROR                           149
+# define X509V3_R_DISTPOINT_ALREADY_SET                   160
+# define X509V3_R_DUPLICATE_ZONE_ID                       133
+# define X509V3_R_ERROR_CONVERTING_ZONE                   131
+# define X509V3_R_ERROR_CREATING_EXTENSION                144
+# define X509V3_R_ERROR_IN_EXTENSION                      128
+# define X509V3_R_EXPECTED_A_SECTION_NAME                 137
+# define X509V3_R_EXTENSION_EXISTS                        145
+# define X509V3_R_EXTENSION_NAME_ERROR                    115
+# define X509V3_R_EXTENSION_NOT_FOUND                     102
+# define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED         103
+# define X509V3_R_EXTENSION_VALUE_ERROR                   116
+# define X509V3_R_ILLEGAL_EMPTY_EXTENSION                 151
+# define X509V3_R_ILLEGAL_HEX_DIGIT                       113
+# define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG             152
+# define X509V3_R_INVALID_MULTIPLE_RDNS                   161
+# define X509V3_R_INVALID_ASNUMBER                        162
+# define X509V3_R_INVALID_ASRANGE                         163
+# define X509V3_R_INVALID_BOOLEAN_STRING                  104
+# define X509V3_R_INVALID_EXTENSION_STRING                105
+# define X509V3_R_INVALID_INHERITANCE                     165
+# define X509V3_R_INVALID_IPADDRESS                       166
+# define X509V3_R_INVALID_NAME                            106
+# define X509V3_R_INVALID_NULL_ARGUMENT                   107
+# define X509V3_R_INVALID_NULL_NAME                       108
+# define X509V3_R_INVALID_NULL_VALUE                      109
+# define X509V3_R_INVALID_NUMBER                          140
+# define X509V3_R_INVALID_NUMBERS                         141
+# define X509V3_R_INVALID_OBJECT_IDENTIFIER               110
+# define X509V3_R_INVALID_OPTION                          138
+# define X509V3_R_INVALID_POLICY_IDENTIFIER               134
+# define X509V3_R_INVALID_PROXY_POLICY_SETTING            153
+# define X509V3_R_INVALID_PURPOSE                         146
+# define X509V3_R_INVALID_SAFI                            164
+# define X509V3_R_INVALID_SECTION                         135
+# define X509V3_R_INVALID_SYNTAX                          143
+# define X509V3_R_ISSUER_DECODE_ERROR                     126
+# define X509V3_R_MISSING_VALUE                           124
+# define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS           142
+# define X509V3_R_NO_CONFIG_DATABASE                      136
+# define X509V3_R_NO_ISSUER_CERTIFICATE                   121
+# define X509V3_R_NO_ISSUER_DETAILS                       127
+# define X509V3_R_NO_POLICY_IDENTIFIER                    139
+# define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED   154
+# define X509V3_R_NO_PUBLIC_KEY                           114
+# define X509V3_R_NO_SUBJECT_DETAILS                      125
+# define X509V3_R_ODD_NUMBER_OF_DIGITS                    112
+# define X509V3_R_OPERATION_NOT_DEFINED                   148
+# define X509V3_R_OTHERNAME_ERROR                         147
+# define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED         155
+# define X509V3_R_POLICY_PATH_LENGTH                      156
+# define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED      157
+# define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED   158
+# define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159
+# define X509V3_R_SECTION_NOT_FOUND                       150
+# define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS            122
+# define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID              123
+# define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT             111
+# define X509V3_R_UNKNOWN_EXTENSION                       129
+# define X509V3_R_UNKNOWN_EXTENSION_NAME                  130
+# define X509V3_R_UNKNOWN_OPTION                          120
+# define X509V3_R_UNSUPPORTED_OPTION                      117
+# define X509V3_R_UNSUPPORTED_TYPE                        167
+# define X509V3_R_USER_TOO_LONG                           132
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/x509v3.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ssl23.h
===================================================================
--- lab4/.minix-src/include/openssl/ssl23.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ssl23.h	(revision 13)
@@ -0,0 +1,84 @@
+/* ssl/ssl23.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_SSL23_H
+# define HEADER_SSL23_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*
+ * client
+ */
+/* write to server */
+# define SSL23_ST_CW_CLNT_HELLO_A        (0x210|SSL_ST_CONNECT)
+# define SSL23_ST_CW_CLNT_HELLO_B        (0x211|SSL_ST_CONNECT)
+/* read from server */
+# define SSL23_ST_CR_SRVR_HELLO_A        (0x220|SSL_ST_CONNECT)
+# define SSL23_ST_CR_SRVR_HELLO_B        (0x221|SSL_ST_CONNECT)
+
+/* server */
+/* read from client */
+# define SSL23_ST_SR_CLNT_HELLO_A        (0x210|SSL_ST_ACCEPT)
+# define SSL23_ST_SR_CLNT_HELLO_B        (0x211|SSL_ST_ACCEPT)
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ssl23.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/symhacks.h
===================================================================
--- lab4/.minix-src/include/openssl/symhacks.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/symhacks.h	(revision 13)
@@ -0,0 +1,486 @@
+/* ====================================================================
+ * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_SYMHACKS_H
+# define HEADER_SYMHACKS_H
+
+# include <openssl/e_os2.h>
+
+/*
+ * Hacks to solve the problem with linkers incapable of handling very long
+ * symbol names.  In the case of VMS, the limit is 31 characters on VMS for
+ * VAX.
+ */
+/*
+ * Note that this affects util/libeay.num and util/ssleay.num...  you may
+ * change those manually, but that's not recommended, as those files are
+ * controlled centrally and updated on Unix, and the central definition may
+ * disagree with yours, which in turn may come with shareable library
+ * incompatibilities.
+ */
+# ifdef OPENSSL_SYS_VMS
+
+/* Hack a long name in crypto/ex_data.c */
+#  undef CRYPTO_get_ex_data_implementation
+#  define CRYPTO_get_ex_data_implementation       CRYPTO_get_ex_data_impl
+#  undef CRYPTO_set_ex_data_implementation
+#  define CRYPTO_set_ex_data_implementation       CRYPTO_set_ex_data_impl
+
+/* Hack a long name in crypto/asn1/a_mbstr.c */
+#  undef ASN1_STRING_set_default_mask_asc
+#  define ASN1_STRING_set_default_mask_asc        ASN1_STRING_set_def_mask_asc
+
+#  if 0                         /* No longer needed, since safestack macro
+                                 * magic does the job */
+/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */
+#   undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO
+#   define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO       i2d_ASN1_SET_OF_PKCS7_SIGINF
+#   undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO
+#   define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO       d2i_ASN1_SET_OF_PKCS7_SIGINF
+#  endif
+
+#  if 0                         /* No longer needed, since safestack macro
+                                 * magic does the job */
+/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */
+#   undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO
+#   define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO        i2d_ASN1_SET_OF_PKCS7_RECINF
+#   undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO
+#   define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO        d2i_ASN1_SET_OF_PKCS7_RECINF
+#  endif
+
+#  if 0                         /* No longer needed, since safestack macro
+                                 * magic does the job */
+/* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */
+#   undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION
+#   define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION      i2d_ASN1_SET_OF_ACC_DESC
+#   undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION
+#   define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION      d2i_ASN1_SET_OF_ACC_DESC
+#  endif
+
+/* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */
+#  undef PEM_read_NETSCAPE_CERT_SEQUENCE
+#  define PEM_read_NETSCAPE_CERT_SEQUENCE         PEM_read_NS_CERT_SEQ
+#  undef PEM_write_NETSCAPE_CERT_SEQUENCE
+#  define PEM_write_NETSCAPE_CERT_SEQUENCE        PEM_write_NS_CERT_SEQ
+#  undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE
+#  define PEM_read_bio_NETSCAPE_CERT_SEQUENCE     PEM_read_bio_NS_CERT_SEQ
+#  undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE
+#  define PEM_write_bio_NETSCAPE_CERT_SEQUENCE    PEM_write_bio_NS_CERT_SEQ
+#  undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE
+#  define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ
+
+/* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */
+#  undef PEM_read_PKCS8_PRIV_KEY_INFO
+#  define PEM_read_PKCS8_PRIV_KEY_INFO            PEM_read_P8_PRIV_KEY_INFO
+#  undef PEM_write_PKCS8_PRIV_KEY_INFO
+#  define PEM_write_PKCS8_PRIV_KEY_INFO           PEM_write_P8_PRIV_KEY_INFO
+#  undef PEM_read_bio_PKCS8_PRIV_KEY_INFO
+#  define PEM_read_bio_PKCS8_PRIV_KEY_INFO        PEM_read_bio_P8_PRIV_KEY_INFO
+#  undef PEM_write_bio_PKCS8_PRIV_KEY_INFO
+#  define PEM_write_bio_PKCS8_PRIV_KEY_INFO       PEM_write_bio_P8_PRIV_KEY_INFO
+#  undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO
+#  define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO    PEM_wrt_cb_bio_P8_PRIV_KEY_INFO
+
+/* Hack other PEM names */
+#  undef PEM_write_bio_PKCS8PrivateKey_nid
+#  define PEM_write_bio_PKCS8PrivateKey_nid       PEM_write_bio_PKCS8PrivKey_nid
+
+/* Hack some long X509 names */
+#  undef X509_REVOKED_get_ext_by_critical
+#  define X509_REVOKED_get_ext_by_critical        X509_REVOKED_get_ext_by_critic
+#  undef X509_policy_tree_get0_user_policies
+#  define X509_policy_tree_get0_user_policies     X509_pcy_tree_get0_usr_policies
+#  undef X509_policy_node_get0_qualifiers
+#  define X509_policy_node_get0_qualifiers        X509_pcy_node_get0_qualifiers
+#  undef X509_STORE_CTX_get_explicit_policy
+#  define X509_STORE_CTX_get_explicit_policy      X509_STORE_CTX_get_expl_policy
+#  undef X509_STORE_CTX_get0_current_issuer
+#  define X509_STORE_CTX_get0_current_issuer      X509_STORE_CTX_get0_cur_issuer
+
+/* Hack some long CRYPTO names */
+#  undef CRYPTO_set_dynlock_destroy_callback
+#  define CRYPTO_set_dynlock_destroy_callback     CRYPTO_set_dynlock_destroy_cb
+#  undef CRYPTO_set_dynlock_create_callback
+#  define CRYPTO_set_dynlock_create_callback      CRYPTO_set_dynlock_create_cb
+#  undef CRYPTO_set_dynlock_lock_callback
+#  define CRYPTO_set_dynlock_lock_callback        CRYPTO_set_dynlock_lock_cb
+#  undef CRYPTO_get_dynlock_lock_callback
+#  define CRYPTO_get_dynlock_lock_callback        CRYPTO_get_dynlock_lock_cb
+#  undef CRYPTO_get_dynlock_destroy_callback
+#  define CRYPTO_get_dynlock_destroy_callback     CRYPTO_get_dynlock_destroy_cb
+#  undef CRYPTO_get_dynlock_create_callback
+#  define CRYPTO_get_dynlock_create_callback      CRYPTO_get_dynlock_create_cb
+#  undef CRYPTO_set_locked_mem_ex_functions
+#  define CRYPTO_set_locked_mem_ex_functions      CRYPTO_set_locked_mem_ex_funcs
+#  undef CRYPTO_get_locked_mem_ex_functions
+#  define CRYPTO_get_locked_mem_ex_functions      CRYPTO_get_locked_mem_ex_funcs
+
+/* Hack some long SSL names */
+#  undef SSL_CTX_set_default_verify_paths
+#  define SSL_CTX_set_default_verify_paths        SSL_CTX_set_def_verify_paths
+#  undef SSL_get_ex_data_X509_STORE_CTX_idx
+#  define SSL_get_ex_data_X509_STORE_CTX_idx      SSL_get_ex_d_X509_STORE_CTX_idx
+#  undef SSL_add_file_cert_subjects_to_stack
+#  define SSL_add_file_cert_subjects_to_stack     SSL_add_file_cert_subjs_to_stk
+#  undef SSL_add_dir_cert_subjects_to_stack
+#  define SSL_add_dir_cert_subjects_to_stack      SSL_add_dir_cert_subjs_to_stk
+#  undef SSL_CTX_use_certificate_chain_file
+#  define SSL_CTX_use_certificate_chain_file      SSL_CTX_use_cert_chain_file
+#  undef SSL_CTX_set_cert_verify_callback
+#  define SSL_CTX_set_cert_verify_callback        SSL_CTX_set_cert_verify_cb
+#  undef SSL_CTX_set_default_passwd_cb_userdata
+#  define SSL_CTX_set_default_passwd_cb_userdata  SSL_CTX_set_def_passwd_cb_ud
+#  undef SSL_COMP_get_compression_methods
+#  define SSL_COMP_get_compression_methods        SSL_COMP_get_compress_methods
+#  undef ssl_add_clienthello_renegotiate_ext
+#  define ssl_add_clienthello_renegotiate_ext     ssl_add_clienthello_reneg_ext
+#  undef ssl_add_serverhello_renegotiate_ext
+#  define ssl_add_serverhello_renegotiate_ext     ssl_add_serverhello_reneg_ext
+#  undef ssl_parse_clienthello_renegotiate_ext
+#  define ssl_parse_clienthello_renegotiate_ext   ssl_parse_clienthello_reneg_ext
+#  undef ssl_parse_serverhello_renegotiate_ext
+#  define ssl_parse_serverhello_renegotiate_ext   ssl_parse_serverhello_reneg_ext
+#  undef SSL_srp_server_param_with_username
+#  define SSL_srp_server_param_with_username      SSL_srp_server_param_with_un
+#  undef SSL_CTX_set_srp_client_pwd_callback
+#  define SSL_CTX_set_srp_client_pwd_callback     SSL_CTX_set_srp_client_pwd_cb
+#  undef SSL_CTX_set_srp_verify_param_callback
+#  define SSL_CTX_set_srp_verify_param_callback   SSL_CTX_set_srp_vfy_param_cb
+#  undef SSL_CTX_set_srp_username_callback
+#  define SSL_CTX_set_srp_username_callback       SSL_CTX_set_srp_un_cb
+#  undef ssl_add_clienthello_use_srtp_ext
+#  define ssl_add_clienthello_use_srtp_ext        ssl_add_clihello_use_srtp_ext
+#  undef ssl_add_serverhello_use_srtp_ext
+#  define ssl_add_serverhello_use_srtp_ext        ssl_add_serhello_use_srtp_ext
+#  undef ssl_parse_clienthello_use_srtp_ext
+#  define ssl_parse_clienthello_use_srtp_ext      ssl_parse_clihello_use_srtp_ext
+#  undef ssl_parse_serverhello_use_srtp_ext
+#  define ssl_parse_serverhello_use_srtp_ext      ssl_parse_serhello_use_srtp_ext
+#  undef SSL_CTX_set_next_protos_advertised_cb
+#  define SSL_CTX_set_next_protos_advertised_cb   SSL_CTX_set_next_protos_adv_cb
+#  undef SSL_CTX_set_next_proto_select_cb
+#  define SSL_CTX_set_next_proto_select_cb        SSL_CTX_set_next_proto_sel_cb
+#  undef ssl3_cbc_record_digest_supported
+#  define ssl3_cbc_record_digest_supported        ssl3_cbc_record_digest_support
+#  undef ssl_check_clienthello_tlsext_late
+#  define ssl_check_clienthello_tlsext_late       ssl_check_clihello_tlsext_late
+#  undef ssl_check_clienthello_tlsext_early
+#  define ssl_check_clienthello_tlsext_early      ssl_check_clihello_tlsext_early
+
+/* Hack some long ENGINE names */
+#  undef ENGINE_get_default_BN_mod_exp_crt
+#  define ENGINE_get_default_BN_mod_exp_crt       ENGINE_get_def_BN_mod_exp_crt
+#  undef ENGINE_set_default_BN_mod_exp_crt
+#  define ENGINE_set_default_BN_mod_exp_crt       ENGINE_set_def_BN_mod_exp_crt
+#  undef ENGINE_set_load_privkey_function
+#  define ENGINE_set_load_privkey_function        ENGINE_set_load_privkey_fn
+#  undef ENGINE_get_load_privkey_function
+#  define ENGINE_get_load_privkey_function        ENGINE_get_load_privkey_fn
+#  undef ENGINE_unregister_pkey_asn1_meths
+#  define ENGINE_unregister_pkey_asn1_meths       ENGINE_unreg_pkey_asn1_meths
+#  undef ENGINE_register_all_pkey_asn1_meths
+#  define ENGINE_register_all_pkey_asn1_meths     ENGINE_reg_all_pkey_asn1_meths
+#  undef ENGINE_set_default_pkey_asn1_meths
+#  define ENGINE_set_default_pkey_asn1_meths      ENGINE_set_def_pkey_asn1_meths
+#  undef ENGINE_get_pkey_asn1_meth_engine
+#  define ENGINE_get_pkey_asn1_meth_engine        ENGINE_get_pkey_asn1_meth_eng
+#  undef ENGINE_set_load_ssl_client_cert_function
+#  define ENGINE_set_load_ssl_client_cert_function \
+                                                ENGINE_set_ld_ssl_clnt_cert_fn
+#  undef ENGINE_get_ssl_client_cert_function
+#  define ENGINE_get_ssl_client_cert_function     ENGINE_get_ssl_client_cert_fn
+
+/* Hack some long OCSP names */
+#  undef OCSP_REQUEST_get_ext_by_critical
+#  define OCSP_REQUEST_get_ext_by_critical        OCSP_REQUEST_get_ext_by_crit
+#  undef OCSP_BASICRESP_get_ext_by_critical
+#  define OCSP_BASICRESP_get_ext_by_critical      OCSP_BASICRESP_get_ext_by_crit
+#  undef OCSP_SINGLERESP_get_ext_by_critical
+#  define OCSP_SINGLERESP_get_ext_by_critical     OCSP_SINGLERESP_get_ext_by_crit
+
+/* Hack some long DES names */
+#  undef _ossl_old_des_ede3_cfb64_encrypt
+#  define _ossl_old_des_ede3_cfb64_encrypt        _ossl_odes_ede3_cfb64_encrypt
+#  undef _ossl_old_des_ede3_ofb64_encrypt
+#  define _ossl_old_des_ede3_ofb64_encrypt        _ossl_odes_ede3_ofb64_encrypt
+
+/* Hack some long EVP names */
+#  undef OPENSSL_add_all_algorithms_noconf
+#  define OPENSSL_add_all_algorithms_noconf       OPENSSL_add_all_algo_noconf
+#  undef OPENSSL_add_all_algorithms_conf
+#  define OPENSSL_add_all_algorithms_conf         OPENSSL_add_all_algo_conf
+#  undef EVP_PKEY_meth_set_verify_recover
+#  define EVP_PKEY_meth_set_verify_recover        EVP_PKEY_meth_set_vrfy_recover
+
+/* Hack some long EC names */
+#  undef EC_GROUP_set_point_conversion_form
+#  define EC_GROUP_set_point_conversion_form      EC_GROUP_set_point_conv_form
+#  undef EC_GROUP_get_point_conversion_form
+#  define EC_GROUP_get_point_conversion_form      EC_GROUP_get_point_conv_form
+#  undef EC_GROUP_clear_free_all_extra_data
+#  define EC_GROUP_clear_free_all_extra_data      EC_GROUP_clr_free_all_xtra_data
+#  undef EC_KEY_set_public_key_affine_coordinates
+#  define EC_KEY_set_public_key_affine_coordinates \
+                                                EC_KEY_set_pub_key_aff_coords
+#  undef EC_POINT_set_Jprojective_coordinates_GFp
+#  define EC_POINT_set_Jprojective_coordinates_GFp \
+                                                EC_POINT_set_Jproj_coords_GFp
+#  undef EC_POINT_get_Jprojective_coordinates_GFp
+#  define EC_POINT_get_Jprojective_coordinates_GFp \
+                                                EC_POINT_get_Jproj_coords_GFp
+#  undef EC_POINT_set_affine_coordinates_GFp
+#  define EC_POINT_set_affine_coordinates_GFp     EC_POINT_set_affine_coords_GFp
+#  undef EC_POINT_get_affine_coordinates_GFp
+#  define EC_POINT_get_affine_coordinates_GFp     EC_POINT_get_affine_coords_GFp
+#  undef EC_POINT_set_compressed_coordinates_GFp
+#  define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp
+#  undef EC_POINT_set_affine_coordinates_GF2m
+#  define EC_POINT_set_affine_coordinates_GF2m    EC_POINT_set_affine_coords_GF2m
+#  undef EC_POINT_get_affine_coordinates_GF2m
+#  define EC_POINT_get_affine_coordinates_GF2m    EC_POINT_get_affine_coords_GF2m
+#  undef EC_POINT_set_compressed_coordinates_GF2m
+#  define EC_POINT_set_compressed_coordinates_GF2m \
+                                                EC_POINT_set_compr_coords_GF2m
+#  undef ec_GF2m_simple_group_clear_finish
+#  define ec_GF2m_simple_group_clear_finish       ec_GF2m_simple_grp_clr_finish
+#  undef ec_GF2m_simple_group_check_discriminant
+#  define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim
+#  undef ec_GF2m_simple_point_clear_finish
+#  define ec_GF2m_simple_point_clear_finish       ec_GF2m_simple_pt_clr_finish
+#  undef ec_GF2m_simple_point_set_to_infinity
+#  define ec_GF2m_simple_point_set_to_infinity    ec_GF2m_simple_pt_set_to_inf
+#  undef ec_GF2m_simple_points_make_affine
+#  define ec_GF2m_simple_points_make_affine       ec_GF2m_simple_pts_make_affine
+#  undef ec_GF2m_simple_point_set_affine_coordinates
+#  define ec_GF2m_simple_point_set_affine_coordinates \
+                                                ec_GF2m_smp_pt_set_af_coords
+#  undef ec_GF2m_simple_point_get_affine_coordinates
+#  define ec_GF2m_simple_point_get_affine_coordinates \
+                                                ec_GF2m_smp_pt_get_af_coords
+#  undef ec_GF2m_simple_set_compressed_coordinates
+#  define ec_GF2m_simple_set_compressed_coordinates \
+                                                ec_GF2m_smp_set_compr_coords
+#  undef ec_GFp_simple_group_set_curve_GFp
+#  define ec_GFp_simple_group_set_curve_GFp       ec_GFp_simple_grp_set_curve_GFp
+#  undef ec_GFp_simple_group_get_curve_GFp
+#  define ec_GFp_simple_group_get_curve_GFp       ec_GFp_simple_grp_get_curve_GFp
+#  undef ec_GFp_simple_group_clear_finish
+#  define ec_GFp_simple_group_clear_finish        ec_GFp_simple_grp_clear_finish
+#  undef ec_GFp_simple_group_set_generator
+#  define ec_GFp_simple_group_set_generator       ec_GFp_simple_grp_set_generator
+#  undef ec_GFp_simple_group_get0_generator
+#  define ec_GFp_simple_group_get0_generator      ec_GFp_simple_grp_gt0_generator
+#  undef ec_GFp_simple_group_get_cofactor
+#  define ec_GFp_simple_group_get_cofactor        ec_GFp_simple_grp_get_cofactor
+#  undef ec_GFp_simple_point_clear_finish
+#  define ec_GFp_simple_point_clear_finish        ec_GFp_simple_pt_clear_finish
+#  undef ec_GFp_simple_point_set_to_infinity
+#  define ec_GFp_simple_point_set_to_infinity     ec_GFp_simple_pt_set_to_inf
+#  undef ec_GFp_simple_points_make_affine
+#  define ec_GFp_simple_points_make_affine        ec_GFp_simple_pts_make_affine
+#  undef ec_GFp_simple_set_Jprojective_coordinates_GFp
+#  define ec_GFp_simple_set_Jprojective_coordinates_GFp \
+                                                ec_GFp_smp_set_Jproj_coords_GFp
+#  undef ec_GFp_simple_get_Jprojective_coordinates_GFp
+#  define ec_GFp_simple_get_Jprojective_coordinates_GFp \
+                                                ec_GFp_smp_get_Jproj_coords_GFp
+#  undef ec_GFp_simple_point_set_affine_coordinates_GFp
+#  define ec_GFp_simple_point_set_affine_coordinates_GFp \
+                                                ec_GFp_smp_pt_set_af_coords_GFp
+#  undef ec_GFp_simple_point_get_affine_coordinates_GFp
+#  define ec_GFp_simple_point_get_affine_coordinates_GFp \
+                                                ec_GFp_smp_pt_get_af_coords_GFp
+#  undef ec_GFp_simple_set_compressed_coordinates_GFp
+#  define ec_GFp_simple_set_compressed_coordinates_GFp \
+                                                ec_GFp_smp_set_compr_coords_GFp
+#  undef ec_GFp_simple_point_set_affine_coordinates
+#  define ec_GFp_simple_point_set_affine_coordinates \
+                                                ec_GFp_smp_pt_set_af_coords
+#  undef ec_GFp_simple_point_get_affine_coordinates
+#  define ec_GFp_simple_point_get_affine_coordinates \
+                                                ec_GFp_smp_pt_get_af_coords
+#  undef ec_GFp_simple_set_compressed_coordinates
+#  define ec_GFp_simple_set_compressed_coordinates \
+                                                ec_GFp_smp_set_compr_coords
+#  undef ec_GFp_simple_group_check_discriminant
+#  define ec_GFp_simple_group_check_discriminant  ec_GFp_simple_grp_chk_discrim
+
+/* Hack som long STORE names */
+#  undef STORE_method_set_initialise_function
+#  define STORE_method_set_initialise_function    STORE_meth_set_initialise_fn
+#  undef STORE_method_set_cleanup_function
+#  define STORE_method_set_cleanup_function       STORE_meth_set_cleanup_fn
+#  undef STORE_method_set_generate_function
+#  define STORE_method_set_generate_function      STORE_meth_set_generate_fn
+#  undef STORE_method_set_modify_function
+#  define STORE_method_set_modify_function        STORE_meth_set_modify_fn
+#  undef STORE_method_set_revoke_function
+#  define STORE_method_set_revoke_function        STORE_meth_set_revoke_fn
+#  undef STORE_method_set_delete_function
+#  define STORE_method_set_delete_function        STORE_meth_set_delete_fn
+#  undef STORE_method_set_list_start_function
+#  define STORE_method_set_list_start_function    STORE_meth_set_list_start_fn
+#  undef STORE_method_set_list_next_function
+#  define STORE_method_set_list_next_function     STORE_meth_set_list_next_fn
+#  undef STORE_method_set_list_end_function
+#  define STORE_method_set_list_end_function      STORE_meth_set_list_end_fn
+#  undef STORE_method_set_update_store_function
+#  define STORE_method_set_update_store_function  STORE_meth_set_update_store_fn
+#  undef STORE_method_set_lock_store_function
+#  define STORE_method_set_lock_store_function    STORE_meth_set_lock_store_fn
+#  undef STORE_method_set_unlock_store_function
+#  define STORE_method_set_unlock_store_function  STORE_meth_set_unlock_store_fn
+#  undef STORE_method_get_initialise_function
+#  define STORE_method_get_initialise_function    STORE_meth_get_initialise_fn
+#  undef STORE_method_get_cleanup_function
+#  define STORE_method_get_cleanup_function       STORE_meth_get_cleanup_fn
+#  undef STORE_method_get_generate_function
+#  define STORE_method_get_generate_function      STORE_meth_get_generate_fn
+#  undef STORE_method_get_modify_function
+#  define STORE_method_get_modify_function        STORE_meth_get_modify_fn
+#  undef STORE_method_get_revoke_function
+#  define STORE_method_get_revoke_function        STORE_meth_get_revoke_fn
+#  undef STORE_method_get_delete_function
+#  define STORE_method_get_delete_function        STORE_meth_get_delete_fn
+#  undef STORE_method_get_list_start_function
+#  define STORE_method_get_list_start_function    STORE_meth_get_list_start_fn
+#  undef STORE_method_get_list_next_function
+#  define STORE_method_get_list_next_function     STORE_meth_get_list_next_fn
+#  undef STORE_method_get_list_end_function
+#  define STORE_method_get_list_end_function      STORE_meth_get_list_end_fn
+#  undef STORE_method_get_update_store_function
+#  define STORE_method_get_update_store_function  STORE_meth_get_update_store_fn
+#  undef STORE_method_get_lock_store_function
+#  define STORE_method_get_lock_store_function    STORE_meth_get_lock_store_fn
+#  undef STORE_method_get_unlock_store_function
+#  define STORE_method_get_unlock_store_function  STORE_meth_get_unlock_store_fn
+
+/* Hack some long TS names */
+#  undef TS_RESP_CTX_set_status_info_cond
+#  define TS_RESP_CTX_set_status_info_cond        TS_RESP_CTX_set_stat_info_cond
+#  undef TS_RESP_CTX_set_clock_precision_digits
+#  define TS_RESP_CTX_set_clock_precision_digits  TS_RESP_CTX_set_clk_prec_digits
+#  undef TS_CONF_set_clock_precision_digits
+#  define TS_CONF_set_clock_precision_digits      TS_CONF_set_clk_prec_digits
+
+/* Hack some long CMS names */
+#  undef CMS_RecipientInfo_ktri_get0_algs
+#  define CMS_RecipientInfo_ktri_get0_algs        CMS_RecipInfo_ktri_get0_algs
+#  undef CMS_RecipientInfo_ktri_get0_signer_id
+#  define CMS_RecipientInfo_ktri_get0_signer_id   CMS_RecipInfo_ktri_get0_sigr_id
+#  undef CMS_OtherRevocationInfoFormat_it
+#  define CMS_OtherRevocationInfoFormat_it        CMS_OtherRevocInfoFormat_it
+#  undef CMS_KeyAgreeRecipientIdentifier_it
+#  define CMS_KeyAgreeRecipientIdentifier_it      CMS_KeyAgreeRecipIdentifier_it
+#  undef CMS_OriginatorIdentifierOrKey_it
+#  define CMS_OriginatorIdentifierOrKey_it        CMS_OriginatorIdOrKey_it
+#  undef cms_SignerIdentifier_get0_signer_id
+#  define cms_SignerIdentifier_get0_signer_id     cms_SignerId_get0_signer_id
+
+/* Hack some long DTLS1 names */
+#  undef dtls1_retransmit_buffered_messages
+#  define dtls1_retransmit_buffered_messages      dtls1_retransmit_buffered_msgs
+
+/* Hack some long SRP names */
+#  undef SRP_generate_server_master_secret
+#  define SRP_generate_server_master_secret       SRP_gen_server_master_secret
+#  undef SRP_generate_client_master_secret
+#  define SRP_generate_client_master_secret       SRP_gen_client_master_secret
+
+/* Hack some long UI names */
+#  undef UI_method_get_prompt_constructor
+#  define UI_method_get_prompt_constructor        UI_method_get_prompt_constructr
+#  undef UI_method_set_prompt_constructor
+#  define UI_method_set_prompt_constructor        UI_method_set_prompt_constructr
+
+# endif                         /* defined OPENSSL_SYS_VMS */
+
+/* Case insensitive linking causes problems.... */
+# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2)
+#  undef ERR_load_CRYPTO_strings
+#  define ERR_load_CRYPTO_strings                 ERR_load_CRYPTOlib_strings
+#  undef OCSP_crlID_new
+#  define OCSP_crlID_new                          OCSP_crlID2_new
+
+#  undef d2i_ECPARAMETERS
+#  define d2i_ECPARAMETERS                        d2i_UC_ECPARAMETERS
+#  undef i2d_ECPARAMETERS
+#  define i2d_ECPARAMETERS                        i2d_UC_ECPARAMETERS
+#  undef d2i_ECPKPARAMETERS
+#  define d2i_ECPKPARAMETERS                      d2i_UC_ECPKPARAMETERS
+#  undef i2d_ECPKPARAMETERS
+#  define i2d_ECPKPARAMETERS                      i2d_UC_ECPKPARAMETERS
+
+/*
+ * These functions do not seem to exist! However, I'm paranoid... Original
+ * command in x509v3.h: These functions are being redefined in another
+ * directory, and clash when the linker is case-insensitive, so let's hide
+ * them a little, by giving them an extra 'o' at the beginning of the name...
+ */
+#  undef X509v3_cleanup_extensions
+#  define X509v3_cleanup_extensions               oX509v3_cleanup_extensions
+#  undef X509v3_add_extension
+#  define X509v3_add_extension                    oX509v3_add_extension
+#  undef X509v3_add_netscape_extensions
+#  define X509v3_add_netscape_extensions          oX509v3_add_netscape_extensions
+#  undef X509v3_add_standard_extensions
+#  define X509v3_add_standard_extensions          oX509v3_add_standard_extensions
+
+/* This one clashes with CMS_data_create */
+#  undef cms_Data_create
+#  define cms_Data_create                         priv_cms_Data_create
+
+# endif
+
+#endif                          /* ! defined HEADER_VMS_IDHACKS_H */

Property changes on: lab4/.minix-src/include/openssl/symhacks.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ui.h
===================================================================
--- lab4/.minix-src/include/openssl/ui.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ui.h	(revision 13)
@@ -0,0 +1,415 @@
+/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */
+/*
+ * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project
+ * 2001.
+ */
+/* ====================================================================
+ * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_UI_H
+# define HEADER_UI_H
+
+# ifndef OPENSSL_NO_DEPRECATED
+#  include <openssl/crypto.h>
+# endif
+# include <openssl/safestack.h>
+# include <openssl/ossl_typ.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Declared already in ossl_typ.h */
+/* typedef struct ui_st UI; */
+/* typedef struct ui_method_st UI_METHOD; */
+
+/*
+ * All the following functions return -1 or NULL on error and in some cases
+ * (UI_process()) -2 if interrupted or in some other way cancelled. When
+ * everything is fine, they return 0, a positive value or a non-NULL pointer,
+ * all depending on their purpose.
+ */
+
+/* Creators and destructor.   */
+UI *UI_new(void);
+UI *UI_new_method(const UI_METHOD *method);
+void UI_free(UI *ui);
+
+/*-
+   The following functions are used to add strings to be printed and prompt
+   strings to prompt for data.  The names are UI_{add,dup}_<function>_string
+   and UI_{add,dup}_input_boolean.
+
+   UI_{add,dup}_<function>_string have the following meanings:
+        add     add a text or prompt string.  The pointers given to these
+                functions are used verbatim, no copying is done.
+        dup     make a copy of the text or prompt string, then add the copy
+                to the collection of strings in the user interface.
+        <function>
+                The function is a name for the functionality that the given
+                string shall be used for.  It can be one of:
+                        input   use the string as data prompt.
+                        verify  use the string as verification prompt.  This
+                                is used to verify a previous input.
+                        info    use the string for informational output.
+                        error   use the string for error output.
+   Honestly, there's currently no difference between info and error for the
+   moment.
+
+   UI_{add,dup}_input_boolean have the same semantics for "add" and "dup",
+   and are typically used when one wants to prompt for a yes/no response.
+
+   All of the functions in this group take a UI and a prompt string.
+   The string input and verify addition functions also take a flag argument,
+   a buffer for the result to end up with, a minimum input size and a maximum
+   input size (the result buffer MUST be large enough to be able to contain
+   the maximum number of characters).  Additionally, the verify addition
+   functions takes another buffer to compare the result against.
+   The boolean input functions take an action description string (which should
+   be safe to ignore if the expected user action is obvious, for example with
+   a dialog box with an OK button and a Cancel button), a string of acceptable
+   characters to mean OK and to mean Cancel.  The two last strings are checked
+   to make sure they don't have common characters.  Additionally, the same
+   flag argument as for the string input is taken, as well as a result buffer.
+   The result buffer is required to be at least one byte long.  Depending on
+   the answer, the first character from the OK or the Cancel character strings
+   will be stored in the first byte of the result buffer.  No NUL will be
+   added, so the result is *not* a string.
+
+   On success, the all return an index of the added information.  That index
+   is usefull when retrieving results with UI_get0_result(). */
+int UI_add_input_string(UI *ui, const char *prompt, int flags,
+                        char *result_buf, int minsize, int maxsize);
+int UI_dup_input_string(UI *ui, const char *prompt, int flags,
+                        char *result_buf, int minsize, int maxsize);
+int UI_add_verify_string(UI *ui, const char *prompt, int flags,
+                         char *result_buf, int minsize, int maxsize,
+                         const char *test_buf);
+int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
+                         char *result_buf, int minsize, int maxsize,
+                         const char *test_buf);
+int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,
+                         const char *ok_chars, const char *cancel_chars,
+                         int flags, char *result_buf);
+int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
+                         const char *ok_chars, const char *cancel_chars,
+                         int flags, char *result_buf);
+int UI_add_info_string(UI *ui, const char *text);
+int UI_dup_info_string(UI *ui, const char *text);
+int UI_add_error_string(UI *ui, const char *text);
+int UI_dup_error_string(UI *ui, const char *text);
+
+/* These are the possible flags.  They can be or'ed together. */
+/* Use to have echoing of input */
+# define UI_INPUT_FLAG_ECHO              0x01
+/*
+ * Use a default password.  Where that password is found is completely up to
+ * the application, it might for example be in the user data set with
+ * UI_add_user_data().  It is not recommended to have more than one input in
+ * each UI being marked with this flag, or the application might get
+ * confused.
+ */
+# define UI_INPUT_FLAG_DEFAULT_PWD       0x02
+
+/*-
+ * The user of these routines may want to define flags of their own.  The core
+ * UI won't look at those, but will pass them on to the method routines.  They
+ * must use higher bits so they don't get confused with the UI bits above.
+ * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use.  A good
+ * example of use is this:
+ *
+ *    #define MY_UI_FLAG1       (0x01 << UI_INPUT_FLAG_USER_BASE)
+ *
+*/
+# define UI_INPUT_FLAG_USER_BASE 16
+
+/*-
+ * The following function helps construct a prompt.  object_desc is a
+ * textual short description of the object, for example "pass phrase",
+ * and object_name is the name of the object (might be a card name or
+ * a file name.
+ * The returned string shall always be allocated on the heap with
+ * OPENSSL_malloc(), and need to be free'd with OPENSSL_free().
+ *
+ * If the ui_method doesn't contain a pointer to a user-defined prompt
+ * constructor, a default string is built, looking like this:
+ *
+ *       "Enter {object_desc} for {object_name}:"
+ *
+ * So, if object_desc has the value "pass phrase" and object_name has
+ * the value "foo.key", the resulting string is:
+ *
+ *       "Enter pass phrase for foo.key:"
+*/
+char *UI_construct_prompt(UI *ui_method,
+                          const char *object_desc, const char *object_name);
+
+/*
+ * The following function is used to store a pointer to user-specific data.
+ * Any previous such pointer will be returned and replaced.
+ *
+ * For callback purposes, this function makes a lot more sense than using
+ * ex_data, since the latter requires that different parts of OpenSSL or
+ * applications share the same ex_data index.
+ *
+ * Note that the UI_OpenSSL() method completely ignores the user data. Other
+ * methods may not, however.
+ */
+void *UI_add_user_data(UI *ui, void *user_data);
+/* We need a user data retrieving function as well.  */
+void *UI_get0_user_data(UI *ui);
+
+/* Return the result associated with a prompt given with the index i. */
+const char *UI_get0_result(UI *ui, int i);
+
+/* When all strings have been added, process the whole thing. */
+int UI_process(UI *ui);
+
+/*
+ * Give a user interface parametrised control commands.  This can be used to
+ * send down an integer, a data pointer or a function pointer, as well as be
+ * used to get information from a UI.
+ */
+int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void));
+
+/* The commands */
+/*
+ * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the
+ * OpenSSL error stack before printing any info or added error messages and
+ * before any prompting.
+ */
+# define UI_CTRL_PRINT_ERRORS            1
+/*
+ * Check if a UI_process() is possible to do again with the same instance of
+ * a user interface.  This makes UI_ctrl() return 1 if it is redoable, and 0
+ * if not.
+ */
+# define UI_CTRL_IS_REDOABLE             2
+
+/* Some methods may use extra data */
+# define UI_set_app_data(s,arg)         UI_set_ex_data(s,0,arg)
+# define UI_get_app_data(s)             UI_get_ex_data(s,0)
+int UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                        CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int UI_set_ex_data(UI *r, int idx, void *arg);
+void *UI_get_ex_data(UI *r, int idx);
+
+/* Use specific methods instead of the built-in one */
+void UI_set_default_method(const UI_METHOD *meth);
+const UI_METHOD *UI_get_default_method(void);
+const UI_METHOD *UI_get_method(UI *ui);
+const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth);
+
+/* The method with all the built-in thingies */
+UI_METHOD *UI_OpenSSL(void);
+
+/* ---------- For method writers ---------- */
+/*-
+   A method contains a number of functions that implement the low level
+   of the User Interface.  The functions are:
+
+        an opener       This function starts a session, maybe by opening
+                        a channel to a tty, or by opening a window.
+        a writer        This function is called to write a given string,
+                        maybe to the tty, maybe as a field label in a
+                        window.
+        a flusher       This function is called to flush everything that
+                        has been output so far.  It can be used to actually
+                        display a dialog box after it has been built.
+        a reader        This function is called to read a given prompt,
+                        maybe from the tty, maybe from a field in a
+                        window.  Note that it's called wth all string
+                        structures, not only the prompt ones, so it must
+                        check such things itself.
+        a closer        This function closes the session, maybe by closing
+                        the channel to the tty, or closing the window.
+
+   All these functions are expected to return:
+
+        0       on error.
+        1       on success.
+        -1      on out-of-band events, for example if some prompting has
+                been canceled (by pressing Ctrl-C, for example).  This is
+                only checked when returned by the flusher or the reader.
+
+   The way this is used, the opener is first called, then the writer for all
+   strings, then the flusher, then the reader for all strings and finally the
+   closer.  Note that if you want to prompt from a terminal or other command
+   line interface, the best is to have the reader also write the prompts
+   instead of having the writer do it.  If you want to prompt from a dialog
+   box, the writer can be used to build up the contents of the box, and the
+   flusher to actually display the box and run the event loop until all data
+   has been given, after which the reader only grabs the given data and puts
+   them back into the UI strings.
+
+   All method functions take a UI as argument.  Additionally, the writer and
+   the reader take a UI_STRING.
+*/
+
+/*
+ * The UI_STRING type is the data structure that contains all the needed info
+ * about a string or a prompt, including test data for a verification prompt.
+ */
+typedef struct ui_string_st UI_STRING;
+DECLARE_STACK_OF(UI_STRING)
+
+/*
+ * The different types of strings that are currently supported. This is only
+ * needed by method authors.
+ */
+enum UI_string_types {
+    UIT_NONE = 0,
+    UIT_PROMPT,                 /* Prompt for a string */
+    UIT_VERIFY,                 /* Prompt for a string and verify */
+    UIT_BOOLEAN,                /* Prompt for a yes/no response */
+    UIT_INFO,                   /* Send info to the user */
+    UIT_ERROR                   /* Send an error message to the user */
+};
+
+/* Create and manipulate methods */
+UI_METHOD *UI_create_method(char *name);
+void UI_destroy_method(UI_METHOD *ui_method);
+int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui));
+int UI_method_set_writer(UI_METHOD *method,
+                         int (*writer) (UI *ui, UI_STRING *uis));
+int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui));
+int UI_method_set_reader(UI_METHOD *method,
+                         int (*reader) (UI *ui, UI_STRING *uis));
+int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui));
+int UI_method_set_prompt_constructor(UI_METHOD *method,
+                                     char *(*prompt_constructor) (UI *ui,
+                                                                  const char
+                                                                  *object_desc,
+                                                                  const char
+                                                                  *object_name));
+int (*UI_method_get_opener(UI_METHOD *method)) (UI *);
+int (*UI_method_get_writer(UI_METHOD *method)) (UI *, UI_STRING *);
+int (*UI_method_get_flusher(UI_METHOD *method)) (UI *);
+int (*UI_method_get_reader(UI_METHOD *method)) (UI *, UI_STRING *);
+int (*UI_method_get_closer(UI_METHOD *method)) (UI *);
+char *(*UI_method_get_prompt_constructor(UI_METHOD *method)) (UI *,
+                                                              const char *,
+                                                              const char *);
+
+/*
+ * The following functions are helpers for method writers to access relevant
+ * data from a UI_STRING.
+ */
+
+/* Return type of the UI_STRING */
+enum UI_string_types UI_get_string_type(UI_STRING *uis);
+/* Return input flags of the UI_STRING */
+int UI_get_input_flags(UI_STRING *uis);
+/* Return the actual string to output (the prompt, info or error) */
+const char *UI_get0_output_string(UI_STRING *uis);
+/*
+ * Return the optional action string to output (the boolean promtp
+ * instruction)
+ */
+const char *UI_get0_action_string(UI_STRING *uis);
+/* Return the result of a prompt */
+const char *UI_get0_result_string(UI_STRING *uis);
+/*
+ * Return the string to test the result against.  Only useful with verifies.
+ */
+const char *UI_get0_test_string(UI_STRING *uis);
+/* Return the required minimum size of the result */
+int UI_get_result_minsize(UI_STRING *uis);
+/* Return the required maximum size of the result */
+int UI_get_result_maxsize(UI_STRING *uis);
+/* Set the result of a UI_STRING. */
+int UI_set_result(UI *ui, UI_STRING *uis, const char *result);
+
+/* A couple of popular utility functions */
+int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
+                           int verify);
+int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt,
+                    int verify);
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_UI_strings(void);
+
+/* Error codes for the UI functions. */
+
+/* Function codes. */
+# define UI_F_GENERAL_ALLOCATE_BOOLEAN                    108
+# define UI_F_GENERAL_ALLOCATE_PROMPT                     109
+# define UI_F_GENERAL_ALLOCATE_STRING                     100
+# define UI_F_UI_CTRL                                     111
+# define UI_F_UI_DUP_ERROR_STRING                         101
+# define UI_F_UI_DUP_INFO_STRING                          102
+# define UI_F_UI_DUP_INPUT_BOOLEAN                        110
+# define UI_F_UI_DUP_INPUT_STRING                         103
+# define UI_F_UI_DUP_VERIFY_STRING                        106
+# define UI_F_UI_GET0_RESULT                              107
+# define UI_F_UI_NEW_METHOD                               104
+# define UI_F_UI_SET_RESULT                               105
+
+/* Reason codes. */
+# define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS             104
+# define UI_R_INDEX_TOO_LARGE                             102
+# define UI_R_INDEX_TOO_SMALL                             103
+# define UI_R_NO_RESULT_BUFFER                            105
+# define UI_R_RESULT_TOO_LARGE                            100
+# define UI_R_RESULT_TOO_SMALL                            101
+# define UI_R_UNKNOWN_CONTROL_COMMAND                     106
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ui.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/x509_vfy.h
===================================================================
--- lab4/.minix-src/include/openssl/x509_vfy.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/x509_vfy.h	(revision 13)
@@ -0,0 +1,595 @@
+/* crypto/x509/x509_vfy.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_X509_H
+# include <openssl/x509.h>
+/*
+ * openssl/x509.h ends up #include-ing this file at about the only
+ * appropriate moment.
+ */
+#endif
+
+#ifndef HEADER_X509_VFY_H
+# define HEADER_X509_VFY_H
+
+# include <openssl/opensslconf.h>
+# ifndef OPENSSL_NO_LHASH
+#  include <openssl/lhash.h>
+# endif
+# include <openssl/bio.h>
+# include <openssl/crypto.h>
+# include <openssl/symhacks.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# if 0
+/* Outer object */
+typedef struct x509_hash_dir_st {
+    int num_dirs;
+    char **dirs;
+    int *dirs_type;
+    int num_dirs_alloced;
+} X509_HASH_DIR_CTX;
+# endif
+
+typedef struct x509_file_st {
+    int num_paths;              /* number of paths to files or directories */
+    int num_alloced;
+    char **paths;               /* the list of paths or directories */
+    int *path_type;
+} X509_CERT_FILE_CTX;
+
+/*******************************/
+/*-
+SSL_CTX -> X509_STORE
+                -> X509_LOOKUP
+                        ->X509_LOOKUP_METHOD
+                -> X509_LOOKUP
+                        ->X509_LOOKUP_METHOD
+
+SSL     -> X509_STORE_CTX
+                ->X509_STORE
+
+The X509_STORE holds the tables etc for verification stuff.
+A X509_STORE_CTX is used while validating a single certificate.
+The X509_STORE has X509_LOOKUPs for looking up certs.
+The X509_STORE then calls a function to actually verify the
+certificate chain.
+*/
+
+# define X509_LU_RETRY           -1
+# define X509_LU_FAIL            0
+# define X509_LU_X509            1
+# define X509_LU_CRL             2
+# define X509_LU_PKEY            3
+
+typedef struct x509_object_st {
+    /* one of the above types */
+    int type;
+    union {
+        char *ptr;
+        X509 *x509;
+        X509_CRL *crl;
+        EVP_PKEY *pkey;
+    } data;
+} X509_OBJECT;
+
+typedef struct x509_lookup_st X509_LOOKUP;
+
+DECLARE_STACK_OF(X509_LOOKUP)
+DECLARE_STACK_OF(X509_OBJECT)
+
+/* This is a static that defines the function interface */
+typedef struct x509_lookup_method_st {
+    const char *name;
+    int (*new_item) (X509_LOOKUP *ctx);
+    void (*free) (X509_LOOKUP *ctx);
+    int (*init) (X509_LOOKUP *ctx);
+    int (*shutdown) (X509_LOOKUP *ctx);
+    int (*ctrl) (X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
+                 char **ret);
+    int (*get_by_subject) (X509_LOOKUP *ctx, int type, X509_NAME *name,
+                           X509_OBJECT *ret);
+    int (*get_by_issuer_serial) (X509_LOOKUP *ctx, int type, X509_NAME *name,
+                                 ASN1_INTEGER *serial, X509_OBJECT *ret);
+    int (*get_by_fingerprint) (X509_LOOKUP *ctx, int type,
+                               unsigned char *bytes, int len,
+                               X509_OBJECT *ret);
+    int (*get_by_alias) (X509_LOOKUP *ctx, int type, char *str, int len,
+                         X509_OBJECT *ret);
+} X509_LOOKUP_METHOD;
+
+/*
+ * This structure hold all parameters associated with a verify operation by
+ * including an X509_VERIFY_PARAM structure in related structures the
+ * parameters used can be customized
+ */
+
+typedef struct X509_VERIFY_PARAM_st {
+    char *name;
+    time_t check_time;          /* Time to use */
+    unsigned long inh_flags;    /* Inheritance flags */
+    unsigned long flags;        /* Various verify flags */
+    int purpose;                /* purpose to check untrusted certificates */
+    int trust;                  /* trust setting to check */
+    int depth;                  /* Verify depth */
+    STACK_OF(ASN1_OBJECT) *policies; /* Permissible policies */
+} X509_VERIFY_PARAM;
+
+DECLARE_STACK_OF(X509_VERIFY_PARAM)
+
+/*
+ * This is used to hold everything.  It is used for all certificate
+ * validation.  Once we have a certificate chain, the 'verify' function is
+ * then called to actually check the cert chain.
+ */
+struct x509_store_st {
+    /* The following is a cache of trusted certs */
+    int cache;                  /* if true, stash any hits */
+    STACK_OF(X509_OBJECT) *objs; /* Cache of all objects */
+    /* These are external lookup methods */
+    STACK_OF(X509_LOOKUP) *get_cert_methods;
+    X509_VERIFY_PARAM *param;
+    /* Callbacks for various operations */
+    /* called to verify a certificate */
+    int (*verify) (X509_STORE_CTX *ctx);
+    /* error callback */
+    int (*verify_cb) (int ok, X509_STORE_CTX *ctx);
+    /* get issuers cert from ctx */
+    int (*get_issuer) (X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
+    /* check issued */
+    int (*check_issued) (X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
+    /* Check revocation status of chain */
+    int (*check_revocation) (X509_STORE_CTX *ctx);
+    /* retrieve CRL */
+    int (*get_crl) (X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x);
+    /* Check CRL validity */
+    int (*check_crl) (X509_STORE_CTX *ctx, X509_CRL *crl);
+    /* Check certificate against CRL */
+    int (*cert_crl) (X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x);
+    STACK_OF(X509) *(*lookup_certs) (X509_STORE_CTX *ctx, X509_NAME *nm);
+    STACK_OF(X509_CRL) *(*lookup_crls) (X509_STORE_CTX *ctx, X509_NAME *nm);
+    int (*cleanup) (X509_STORE_CTX *ctx);
+    CRYPTO_EX_DATA ex_data;
+    int references;
+} /* X509_STORE */ ;
+
+int X509_STORE_set_depth(X509_STORE *store, int depth);
+
+# define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func))
+# define X509_STORE_set_verify_func(ctx,func)    ((ctx)->verify=(func))
+
+/* This is the functions plus an instance of the local variables. */
+struct x509_lookup_st {
+    int init;                   /* have we been started */
+    int skip;                   /* don't use us. */
+    X509_LOOKUP_METHOD *method; /* the functions */
+    char *method_data;          /* method data */
+    X509_STORE *store_ctx;      /* who owns us */
+} /* X509_LOOKUP */ ;
+
+/*
+ * This is a used when verifying cert chains.  Since the gathering of the
+ * cert chain can take some time (and have to be 'retried', this needs to be
+ * kept and passed around.
+ */
+struct x509_store_ctx_st {      /* X509_STORE_CTX */
+    X509_STORE *ctx;
+    /* used when looking up certs */
+    int current_method;
+    /* The following are set by the caller */
+    /* The cert to check */
+    X509 *cert;
+    /* chain of X509s - untrusted - passed in */
+    STACK_OF(X509) *untrusted;
+    /* set of CRLs passed in */
+    STACK_OF(X509_CRL) *crls;
+    X509_VERIFY_PARAM *param;
+    /* Other info for use with get_issuer() */
+    void *other_ctx;
+    /* Callbacks for various operations */
+    /* called to verify a certificate */
+    int (*verify) (X509_STORE_CTX *ctx);
+    /* error callback */
+    int (*verify_cb) (int ok, X509_STORE_CTX *ctx);
+    /* get issuers cert from ctx */
+    int (*get_issuer) (X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
+    /* check issued */
+    int (*check_issued) (X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
+    /* Check revocation status of chain */
+    int (*check_revocation) (X509_STORE_CTX *ctx);
+    /* retrieve CRL */
+    int (*get_crl) (X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x);
+    /* Check CRL validity */
+    int (*check_crl) (X509_STORE_CTX *ctx, X509_CRL *crl);
+    /* Check certificate against CRL */
+    int (*cert_crl) (X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x);
+    int (*check_policy) (X509_STORE_CTX *ctx);
+    STACK_OF(X509) *(*lookup_certs) (X509_STORE_CTX *ctx, X509_NAME *nm);
+    STACK_OF(X509_CRL) *(*lookup_crls) (X509_STORE_CTX *ctx, X509_NAME *nm);
+    int (*cleanup) (X509_STORE_CTX *ctx);
+    /* The following is built up */
+    /* if 0, rebuild chain */
+    int valid;
+    /* index of last untrusted cert */
+    int last_untrusted;
+    /* chain of X509s - built up and trusted */
+    STACK_OF(X509) *chain;
+    /* Valid policy tree */
+    X509_POLICY_TREE *tree;
+    /* Require explicit policy value */
+    int explicit_policy;
+    /* When something goes wrong, this is why */
+    int error_depth;
+    int error;
+    X509 *current_cert;
+    /* cert currently being tested as valid issuer */
+    X509 *current_issuer;
+    /* current CRL */
+    X509_CRL *current_crl;
+    /* score of current CRL */
+    int current_crl_score;
+    /* Reason mask */
+    unsigned int current_reasons;
+    /* For CRL path validation: parent context */
+    X509_STORE_CTX *parent;
+    CRYPTO_EX_DATA ex_data;
+} /* X509_STORE_CTX */ ;
+
+void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
+
+# define X509_STORE_CTX_set_app_data(ctx,data) \
+        X509_STORE_CTX_set_ex_data(ctx,0,data)
+# define X509_STORE_CTX_get_app_data(ctx) \
+        X509_STORE_CTX_get_ex_data(ctx,0)
+
+# define X509_L_FILE_LOAD        1
+# define X509_L_ADD_DIR          2
+
+# define X509_LOOKUP_load_file(x,name,type) \
+                X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL)
+
+# define X509_LOOKUP_add_dir(x,name,type) \
+                X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL)
+
+# define         X509_V_OK                                       0
+/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */
+
+# define         X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT            2
+# define         X509_V_ERR_UNABLE_TO_GET_CRL                    3
+# define         X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE     4
+# define         X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE      5
+# define         X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY   6
+# define         X509_V_ERR_CERT_SIGNATURE_FAILURE               7
+# define         X509_V_ERR_CRL_SIGNATURE_FAILURE                8
+# define         X509_V_ERR_CERT_NOT_YET_VALID                   9
+# define         X509_V_ERR_CERT_HAS_EXPIRED                     10
+# define         X509_V_ERR_CRL_NOT_YET_VALID                    11
+# define         X509_V_ERR_CRL_HAS_EXPIRED                      12
+# define         X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD       13
+# define         X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD        14
+# define         X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD       15
+# define         X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD       16
+# define         X509_V_ERR_OUT_OF_MEM                           17
+# define         X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT          18
+# define         X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN            19
+# define         X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY    20
+# define         X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE      21
+# define         X509_V_ERR_CERT_CHAIN_TOO_LONG                  22
+# define         X509_V_ERR_CERT_REVOKED                         23
+# define         X509_V_ERR_INVALID_CA                           24
+# define         X509_V_ERR_PATH_LENGTH_EXCEEDED                 25
+# define         X509_V_ERR_INVALID_PURPOSE                      26
+# define         X509_V_ERR_CERT_UNTRUSTED                       27
+# define         X509_V_ERR_CERT_REJECTED                        28
+/* These are 'informational' when looking for issuer cert */
+# define         X509_V_ERR_SUBJECT_ISSUER_MISMATCH              29
+# define         X509_V_ERR_AKID_SKID_MISMATCH                   30
+# define         X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH          31
+# define         X509_V_ERR_KEYUSAGE_NO_CERTSIGN                 32
+
+# define         X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER             33
+# define         X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION         34
+# define         X509_V_ERR_KEYUSAGE_NO_CRL_SIGN                 35
+# define         X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION     36
+# define         X509_V_ERR_INVALID_NON_CA                       37
+# define         X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED           38
+# define         X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE        39
+# define         X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED       40
+
+# define         X509_V_ERR_INVALID_EXTENSION                    41
+# define         X509_V_ERR_INVALID_POLICY_EXTENSION             42
+# define         X509_V_ERR_NO_EXPLICIT_POLICY                   43
+# define         X509_V_ERR_DIFFERENT_CRL_SCOPE                  44
+# define         X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE        45
+
+# define         X509_V_ERR_UNNESTED_RESOURCE                    46
+
+# define         X509_V_ERR_PERMITTED_VIOLATION                  47
+# define         X509_V_ERR_EXCLUDED_VIOLATION                   48
+# define         X509_V_ERR_SUBTREE_MINMAX                       49
+# define         X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE          51
+# define         X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX        52
+# define         X509_V_ERR_UNSUPPORTED_NAME_SYNTAX              53
+# define         X509_V_ERR_CRL_PATH_VALIDATION_ERROR            54
+
+/* The application is not happy */
+# define         X509_V_ERR_APPLICATION_VERIFICATION             50
+
+/* Certificate verify flags */
+
+/* Send issuer+subject checks to verify_cb */
+# define X509_V_FLAG_CB_ISSUER_CHECK             0x1
+/* Use check time instead of current time */
+# define X509_V_FLAG_USE_CHECK_TIME              0x2
+/* Lookup CRLs */
+# define X509_V_FLAG_CRL_CHECK                   0x4
+/* Lookup CRLs for whole chain */
+# define X509_V_FLAG_CRL_CHECK_ALL               0x8
+/* Ignore unhandled critical extensions */
+# define X509_V_FLAG_IGNORE_CRITICAL             0x10
+/* Disable workarounds for broken certificates */
+# define X509_V_FLAG_X509_STRICT                 0x20
+/* Enable proxy certificate validation */
+# define X509_V_FLAG_ALLOW_PROXY_CERTS           0x40
+/* Enable policy checking */
+# define X509_V_FLAG_POLICY_CHECK                0x80
+/* Policy variable require-explicit-policy */
+# define X509_V_FLAG_EXPLICIT_POLICY             0x100
+/* Policy variable inhibit-any-policy */
+# define X509_V_FLAG_INHIBIT_ANY                 0x200
+/* Policy variable inhibit-policy-mapping */
+# define X509_V_FLAG_INHIBIT_MAP                 0x400
+/* Notify callback that policy is OK */
+# define X509_V_FLAG_NOTIFY_POLICY               0x800
+/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */
+# define X509_V_FLAG_EXTENDED_CRL_SUPPORT        0x1000
+/* Delta CRL support */
+# define X509_V_FLAG_USE_DELTAS                  0x2000
+/* Check selfsigned CA signature */
+# define X509_V_FLAG_CHECK_SS_SIGNATURE          0x4000
+/*
+ * If the initial chain is not trusted, do not attempt to build an alternative
+ * chain. Alternate chain checking was introduced in 1.0.1n/1.0.2b. Setting
+ * this flag will force the behaviour to match that of previous versions.
+ */
+# define X509_V_FLAG_NO_ALT_CHAINS               0x100000
+
+# define X509_VP_FLAG_DEFAULT                    0x1
+# define X509_VP_FLAG_OVERWRITE                  0x2
+# define X509_VP_FLAG_RESET_FLAGS                0x4
+# define X509_VP_FLAG_LOCKED                     0x8
+# define X509_VP_FLAG_ONCE                       0x10
+
+/* Internal use: mask of policy related options */
+# define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \
+                                | X509_V_FLAG_EXPLICIT_POLICY \
+                                | X509_V_FLAG_INHIBIT_ANY \
+                                | X509_V_FLAG_INHIBIT_MAP)
+
+int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
+                               X509_NAME *name);
+X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,
+                                             int type, X509_NAME *name);
+X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
+                                        X509_OBJECT *x);
+void X509_OBJECT_up_ref_count(X509_OBJECT *a);
+void X509_OBJECT_free_contents(X509_OBJECT *a);
+X509_STORE *X509_STORE_new(void);
+void X509_STORE_free(X509_STORE *v);
+
+STACK_OF(X509) *X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm);
+STACK_OF(X509_CRL) *X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm);
+int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
+int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
+int X509_STORE_set_trust(X509_STORE *ctx, int trust);
+int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm);
+
+void X509_STORE_set_verify_cb(X509_STORE *ctx,
+                              int (*verify_cb) (int, X509_STORE_CTX *));
+
+X509_STORE_CTX *X509_STORE_CTX_new(void);
+
+int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
+
+void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
+int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
+                        X509 *x509, STACK_OF(X509) *chain);
+void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
+void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
+
+X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
+
+X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);
+X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
+
+int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
+int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
+
+int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
+                              X509_OBJECT *ret);
+
+int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
+                     long argl, char **ret);
+
+# ifndef OPENSSL_NO_STDIO
+int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);
+int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type);
+int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);
+# endif
+
+X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);
+void X509_LOOKUP_free(X509_LOOKUP *ctx);
+int X509_LOOKUP_init(X509_LOOKUP *ctx);
+int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
+                           X509_OBJECT *ret);
+int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
+                                 ASN1_INTEGER *serial, X509_OBJECT *ret);
+int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
+                               unsigned char *bytes, int len,
+                               X509_OBJECT *ret);
+int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, int len,
+                         X509_OBJECT *ret);
+int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
+
+# ifndef OPENSSL_NO_STDIO
+int X509_STORE_load_locations(X509_STORE *ctx,
+                              const char *file, const char *dir);
+int X509_STORE_set_default_paths(X509_STORE *ctx);
+# endif
+
+int X509_STORE_CTX_get_ex_new_index(long argl, void *argp,
+                                    CRYPTO_EX_new *new_func,
+                                    CRYPTO_EX_dup *dup_func,
+                                    CRYPTO_EX_free *free_func);
+int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data);
+void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx);
+int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
+void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s);
+int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
+X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
+X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx);
+X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx);
+X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx);
+STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
+STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
+void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x);
+void X509_STORE_CTX_set_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk);
+void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk);
+int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
+int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);
+int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
+                                   int purpose, int trust);
+void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags);
+void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
+                             time_t t);
+void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
+                                  int (*verify_cb) (int, X509_STORE_CTX *));
+
+X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx);
+int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx);
+
+X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
+void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);
+int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
+
+/* X509_VERIFY_PARAM functions */
+
+X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void);
+void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param);
+int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to,
+                              const X509_VERIFY_PARAM *from);
+int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to,
+                           const X509_VERIFY_PARAM *from);
+int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name);
+int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param,
+                                unsigned long flags);
+int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
+                                  unsigned long flags);
+unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
+int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
+int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
+void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
+void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
+int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
+                                  ASN1_OBJECT *policy);
+int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
+                                    STACK_OF(ASN1_OBJECT) *policies);
+int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
+
+int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param);
+const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name);
+void X509_VERIFY_PARAM_table_cleanup(void);
+
+int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy,
+                      STACK_OF(X509) *certs,
+                      STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags);
+
+void X509_policy_tree_free(X509_POLICY_TREE *tree);
+
+int X509_policy_tree_level_count(const X509_POLICY_TREE *tree);
+X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree,
+                                               int i);
+
+STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const
+                                                           X509_POLICY_TREE
+                                                           *tree);
+
+STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const
+                                                                X509_POLICY_TREE
+                                                                *tree);
+
+int X509_policy_level_node_count(X509_POLICY_LEVEL *level);
+
+X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level,
+                                              int i);
+
+const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node);
+
+STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const
+                                                           X509_POLICY_NODE
+                                                           *node);
+const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE
+                                                     *node);
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/x509_vfy.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/pcap/pcap.h
===================================================================
--- lab4/.minix-src/include/pcap/pcap.h	(nonexistent)
+++ lab4/.minix-src/include/pcap/pcap.h	(revision 13)
@@ -0,0 +1,489 @@
+/*	$NetBSD: pcap.h,v 1.6 2015/03/31 21:39:43 christos Exp $	*/
+
+/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
+/*
+ * Copyright (c) 1993, 1994, 1995, 1996, 1997
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the Computer Systems
+ *	Engineering Group at Lawrence Berkeley Laboratory.
+ * 4. Neither the name of the University nor of the Laboratory may be used
+ *    to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lib_pcap_pcap_h
+#define lib_pcap_pcap_h
+
+#if defined(WIN32)
+  #include <pcap-stdinc.h>
+#elif defined(MSDOS)
+  #include <sys/types.h>
+  #include <sys/socket.h>  /* u_int, u_char etc. */
+#else /* UN*X */
+  #include <sys/types.h>
+  #include <sys/time.h>
+#endif /* WIN32/MSDOS/UN*X */
+
+#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H
+#include <pcap/bpf.h>
+#else
+#include <net/bpf.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Version number of the current version of the pcap file format.
+ *
+ * NOTE: this is *NOT* the version number of the libpcap library.
+ * To fetch the version information for the version of libpcap
+ * you're using, use pcap_lib_version().
+ */
+#define PCAP_VERSION_MAJOR 2
+#define PCAP_VERSION_MINOR 4
+
+#define PCAP_ERRBUF_SIZE 256
+
+/*
+ * Compatibility for systems that have a bpf.h that
+ * predates the bpf typedefs for 64-bit support.
+ */
+#if BPF_RELEASE - 0 < 199406
+typedef	int bpf_int32;
+typedef	u_int bpf_u_int32;
+#endif
+
+typedef struct pcap pcap_t;
+typedef struct pcap_dumper pcap_dumper_t;
+typedef struct pcap_if pcap_if_t;
+typedef struct pcap_addr pcap_addr_t;
+
+/*
+ * The first record in the file contains saved values for some
+ * of the flags used in the printout phases of tcpdump.
+ * Many fields here are 32 bit ints so compilers won't insert unwanted
+ * padding; these files need to be interchangeable across architectures.
+ *
+ * Do not change the layout of this structure, in any way (this includes
+ * changes that only affect the length of fields in this structure).
+ *
+ * Also, do not change the interpretation of any of the members of this
+ * structure, in any way (this includes using values other than
+ * LINKTYPE_ values, as defined in "savefile.c", in the "linktype"
+ * field).
+ *
+ * Instead:
+ *
+ *	introduce a new structure for the new format, if the layout
+ *	of the structure changed;
+ *
+ *	send mail to "tcpdump-workers@lists.tcpdump.org", requesting
+ *	a new magic number for your new capture file format, and, when
+ *	you get the new magic number, put it in "savefile.c";
+ *
+ *	use that magic number for save files with the changed file
+ *	header;
+ *
+ *	make the code in "savefile.c" capable of reading files with
+ *	the old file header as well as files with the new file header
+ *	(using the magic number to determine the header format).
+ *
+ * Then supply the changes by forking the branch at
+ *
+ *	https://github.com/the-tcpdump-group/libpcap/issues
+ *
+ * and issuing a pull request, so that future versions of libpcap and
+ * programs that use it (such as tcpdump) will be able to read your new
+ * capture file format.
+ */
+struct pcap_file_header {
+	bpf_u_int32 magic;
+	u_short version_major;
+	u_short version_minor;
+	bpf_int32 thiszone;	/* gmt to local correction */
+	bpf_u_int32 sigfigs;	/* accuracy of timestamps */
+	bpf_u_int32 snaplen;	/* max length saved portion of each pkt */
+	bpf_u_int32 linktype;	/* data link type (LINKTYPE_*) */
+};
+
+/*
+ * Macros for the value returned by pcap_datalink_ext().
+ *
+ * If LT_FCS_LENGTH_PRESENT(x) is true, the LT_FCS_LENGTH(x) macro
+ * gives the FCS length of packets in the capture.
+ */
+#define LT_FCS_LENGTH_PRESENT(x)	((x) & 0x04000000)
+#define LT_FCS_LENGTH(x)		(((x) & 0xF0000000) >> 28)
+#define LT_FCS_DATALINK_EXT(x)		((((x) & 0xF) << 28) | 0x04000000)
+
+typedef enum {
+       PCAP_D_INOUT = 0,
+       PCAP_D_IN,
+       PCAP_D_OUT
+} pcap_direction_t;
+
+/*
+ * Generic per-packet information, as supplied by libpcap.
+ *
+ * The time stamp can and should be a "struct timeval", regardless of
+ * whether your system supports 32-bit tv_sec in "struct timeval",
+ * 64-bit tv_sec in "struct timeval", or both if it supports both 32-bit
+ * and 64-bit applications.  The on-disk format of savefiles uses 32-bit
+ * tv_sec (and tv_usec); this structure is irrelevant to that.  32-bit
+ * and 64-bit versions of libpcap, even if they're on the same platform,
+ * should supply the appropriate version of "struct timeval", even if
+ * that's not what the underlying packet capture mechanism supplies.
+ */
+struct pcap_pkthdr {
+	struct timeval ts;	/* time stamp */
+	bpf_u_int32 caplen;	/* length of portion present */
+	bpf_u_int32 len;	/* length this packet (off wire) */
+};
+
+/*
+ * As returned by the pcap_stats()
+ */
+struct pcap_stat {
+	u_int ps_recv;		/* number of packets received */
+	u_int ps_drop;		/* number of packets dropped */
+	u_int ps_ifdrop;	/* drops by interface -- only supported on some platforms */
+#ifdef WIN32
+	u_int bs_capt;		/* number of packets that reach the application */
+#endif /* WIN32 */
+};
+
+#ifdef MSDOS
+/*
+ * As returned by the pcap_stats_ex()
+ */
+struct pcap_stat_ex {
+       u_long  rx_packets;        /* total packets received       */
+       u_long  tx_packets;        /* total packets transmitted    */
+       u_long  rx_bytes;          /* total bytes received         */
+       u_long  tx_bytes;          /* total bytes transmitted      */
+       u_long  rx_errors;         /* bad packets received         */
+       u_long  tx_errors;         /* packet transmit problems     */
+       u_long  rx_dropped;        /* no space in Rx buffers       */
+       u_long  tx_dropped;        /* no space available for Tx    */
+       u_long  multicast;         /* multicast packets received   */
+       u_long  collisions;
+
+       /* detailed rx_errors: */
+       u_long  rx_length_errors;
+       u_long  rx_over_errors;    /* receiver ring buff overflow  */
+       u_long  rx_crc_errors;     /* recv'd pkt with crc error    */
+       u_long  rx_frame_errors;   /* recv'd frame alignment error */
+       u_long  rx_fifo_errors;    /* recv'r fifo overrun          */
+       u_long  rx_missed_errors;  /* recv'r missed packet         */
+
+       /* detailed tx_errors */
+       u_long  tx_aborted_errors;
+       u_long  tx_carrier_errors;
+       u_long  tx_fifo_errors;
+       u_long  tx_heartbeat_errors;
+       u_long  tx_window_errors;
+     };
+#endif
+
+/*
+ * Item in a list of interfaces.
+ */
+struct pcap_if {
+	struct pcap_if *next;
+	char *name;		/* name to hand to "pcap_open_live()" */
+	char *description;	/* textual description of interface, or NULL */
+	struct pcap_addr *addresses;
+	bpf_u_int32 flags;	/* PCAP_IF_ interface flags */
+};
+
+#define PCAP_IF_LOOPBACK	0x00000001	/* interface is loopback */
+#define PCAP_IF_UP		0x00000002	/* interface is up */
+#define PCAP_IF_RUNNING		0x00000004	/* interface is running */
+
+/*
+ * Representation of an interface address.
+ */
+struct pcap_addr {
+	struct pcap_addr *next;
+	struct sockaddr *addr;		/* address */
+	struct sockaddr *netmask;	/* netmask for that address */
+	struct sockaddr *broadaddr;	/* broadcast address for that address */
+	struct sockaddr *dstaddr;	/* P2P destination address for that address */
+};
+
+typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *,
+			     const u_char *);
+
+/*
+ * Error codes for the pcap API.
+ * These will all be negative, so you can check for the success or
+ * failure of a call that returns these codes by checking for a
+ * negative value.
+ */
+#define PCAP_ERROR			-1	/* generic error code */
+#define PCAP_ERROR_BREAK		-2	/* loop terminated by pcap_breakloop */
+#define PCAP_ERROR_NOT_ACTIVATED	-3	/* the capture needs to be activated */
+#define PCAP_ERROR_ACTIVATED		-4	/* the operation can't be performed on already activated captures */
+#define PCAP_ERROR_NO_SUCH_DEVICE	-5	/* no such device exists */
+#define PCAP_ERROR_RFMON_NOTSUP		-6	/* this device doesn't support rfmon (monitor) mode */
+#define PCAP_ERROR_NOT_RFMON		-7	/* operation supported only in monitor mode */
+#define PCAP_ERROR_PERM_DENIED		-8	/* no permission to open the device */
+#define PCAP_ERROR_IFACE_NOT_UP		-9	/* interface isn't up */
+#define PCAP_ERROR_CANTSET_TSTAMP_TYPE	-10	/* this device doesn't support setting the time stamp type */
+#define PCAP_ERROR_PROMISC_PERM_DENIED	-11	/* you don't have permission to capture in promiscuous mode */
+#define PCAP_ERROR_TSTAMP_PRECISION_NOTSUP -12  /* the requested time stamp precision is not supported */
+
+/*
+ * Warning codes for the pcap API.
+ * These will all be positive and non-zero, so they won't look like
+ * errors.
+ */
+#define PCAP_WARNING			1	/* generic warning code */
+#define PCAP_WARNING_PROMISC_NOTSUP	2	/* this device doesn't support promiscuous mode */
+#define PCAP_WARNING_TSTAMP_TYPE_NOTSUP	3	/* the requested time stamp type is not supported */
+
+/*
+ * Value to pass to pcap_compile() as the netmask if you don't know what
+ * the netmask is.
+ */
+#define PCAP_NETMASK_UNKNOWN	0xffffffff
+
+char	*pcap_lookupdev(char *);
+int	pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);
+
+pcap_t	*pcap_create(const char *, char *);
+int	pcap_set_snaplen(pcap_t *, int);
+int	pcap_set_promisc(pcap_t *, int);
+int	pcap_can_set_rfmon(pcap_t *);
+int	pcap_set_rfmon(pcap_t *, int);
+int	pcap_set_timeout(pcap_t *, int);
+int	pcap_set_tstamp_type(pcap_t *, int);
+int	pcap_set_immediate_mode(pcap_t *, int);
+int	pcap_set_buffer_size(pcap_t *, int);
+int	pcap_set_tstamp_precision(pcap_t *, int);
+int	pcap_get_tstamp_precision(pcap_t *);
+int	pcap_activate(pcap_t *);
+
+int	pcap_list_tstamp_types(pcap_t *, int **);
+void	pcap_free_tstamp_types(int *);
+int	pcap_tstamp_type_name_to_val(const char *);
+const char *pcap_tstamp_type_val_to_name(int);
+const char *pcap_tstamp_type_val_to_description(int);
+
+/*
+ * Time stamp types.
+ * Not all systems and interfaces will necessarily support all of these.
+ *
+ * A system that supports PCAP_TSTAMP_HOST is offering time stamps
+ * provided by the host machine, rather than by the capture device,
+ * but not committing to any characteristics of the time stamp;
+ * it will not offer any of the PCAP_TSTAMP_HOST_ subtypes.
+ *
+ * PCAP_TSTAMP_HOST_LOWPREC is a time stamp, provided by the host machine,
+ * that's low-precision but relatively cheap to fetch; it's normally done
+ * using the system clock, so it's normally synchronized with times you'd
+ * fetch from system calls.
+ *
+ * PCAP_TSTAMP_HOST_HIPREC is a time stamp, provided by the host machine,
+ * that's high-precision; it might be more expensive to fetch.  It might
+ * or might not be synchronized with the system clock, and might have
+ * problems with time stamps for packets received on different CPUs,
+ * depending on the platform.
+ *
+ * PCAP_TSTAMP_ADAPTER is a high-precision time stamp supplied by the
+ * capture device; it's synchronized with the system clock.
+ *
+ * PCAP_TSTAMP_ADAPTER_UNSYNCED is a high-precision time stamp supplied by
+ * the capture device; it's not synchronized with the system clock.
+ *
+ * Note that time stamps synchronized with the system clock can go
+ * backwards, as the system clock can go backwards.  If a clock is
+ * not in sync with the system clock, that could be because the
+ * system clock isn't keeping accurate time, because the other
+ * clock isn't keeping accurate time, or both.
+ *
+ * Note that host-provided time stamps generally correspond to the
+ * time when the time-stamping code sees the packet; this could
+ * be some unknown amount of time after the first or last bit of
+ * the packet is received by the network adapter, due to batching
+ * of interrupts for packet arrival, queueing delays, etc..
+ */
+#define PCAP_TSTAMP_HOST		0	/* host-provided, unknown characteristics */
+#define PCAP_TSTAMP_HOST_LOWPREC	1	/* host-provided, low precision */
+#define PCAP_TSTAMP_HOST_HIPREC		2	/* host-provided, high precision */
+#define PCAP_TSTAMP_ADAPTER		3	/* device-provided, synced with the system clock */
+#define PCAP_TSTAMP_ADAPTER_UNSYNCED	4	/* device-provided, not synced with the system clock */
+
+/*
+ * Time stamp resolution types.
+ * Not all systems and interfaces will necessarily support all of these
+ * resolutions when doing live captures; all of them can be requested
+ * when reading a savefile.
+ */
+#define PCAP_TSTAMP_PRECISION_MICRO	0	/* use timestamps with microsecond precision, default */
+#define PCAP_TSTAMP_PRECISION_NANO	1	/* use timestamps with nanosecond precision */
+
+pcap_t	*pcap_open_live(const char *, int, int, int, char *);
+pcap_t	*pcap_open_dead(int, int);
+pcap_t	*pcap_open_dead_with_tstamp_precision(int, int, u_int);
+pcap_t	*pcap_open_offline_with_tstamp_precision(const char *, u_int, char *);
+pcap_t	*pcap_open_offline(const char *, char *);
+#if defined(WIN32)
+pcap_t  *pcap_hopen_offline_with_tstamp_precision(intptr_t, u_int, char *);
+pcap_t  *pcap_hopen_offline(intptr_t, char *);
+#if !defined(LIBPCAP_EXPORTS)
+#define pcap_fopen_offline_with_tstamp_precision(f,p,b) \
+	pcap_hopen_offline_with_tstamp_precision(_get_osfhandle(_fileno(f)), p, b)
+#define pcap_fopen_offline(f,b) \
+	pcap_hopen_offline(_get_osfhandle(_fileno(f)), b)
+#else /*LIBPCAP_EXPORTS*/
+static pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
+static pcap_t *pcap_fopen_offline(FILE *, char *);
+#endif
+#else /*WIN32*/
+pcap_t	*pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
+pcap_t	*pcap_fopen_offline(FILE *, char *);
+#endif /*WIN32*/
+
+void	pcap_close(pcap_t *);
+int	pcap_loop(pcap_t *, int, pcap_handler, u_char *);
+int	pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
+const u_char*
+	pcap_next(pcap_t *, struct pcap_pkthdr *);
+int 	pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
+void	pcap_breakloop(pcap_t *);
+int	pcap_stats(pcap_t *, struct pcap_stat *);
+int	pcap_setfilter(pcap_t *, struct bpf_program *);
+int 	pcap_setdirection(pcap_t *, pcap_direction_t);
+int	pcap_getnonblock(pcap_t *, char *);
+int	pcap_setnonblock(pcap_t *, int, char *);
+int	pcap_inject(pcap_t *, const void *, size_t);
+int	pcap_sendpacket(pcap_t *, const u_char *, int);
+const char *pcap_statustostr(int);
+const char *pcap_strerror(int);
+char	*pcap_geterr(pcap_t *);
+void	pcap_perror(pcap_t *, char *);
+int	pcap_compile(pcap_t *, struct bpf_program *, const char *, int,
+	    bpf_u_int32);
+int	pcap_compile_nopcap(int, int, struct bpf_program *,
+	    const char *, int, bpf_u_int32);
+void	pcap_freecode(struct bpf_program *);
+int	pcap_offline_filter(const struct bpf_program *,
+	    const struct pcap_pkthdr *, const u_char *);
+int	pcap_datalink(pcap_t *);
+int	pcap_datalink_ext(pcap_t *);
+int	pcap_list_datalinks(pcap_t *, int **);
+int	pcap_set_datalink(pcap_t *, int);
+void	pcap_free_datalinks(int *);
+int	pcap_datalink_name_to_val(const char *);
+const char *pcap_datalink_val_to_name(int);
+const char *pcap_datalink_val_to_description(int);
+int	pcap_snapshot(pcap_t *);
+int	pcap_is_swapped(pcap_t *);
+int	pcap_major_version(pcap_t *);
+int	pcap_minor_version(pcap_t *);
+
+/* XXX */
+FILE	*pcap_file(pcap_t *);
+int	pcap_fileno(pcap_t *);
+
+pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
+pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp);
+pcap_dumper_t *pcap_dump_open_append(pcap_t *, const char *);
+FILE	*pcap_dump_file(pcap_dumper_t *);
+long	pcap_dump_ftell(pcap_dumper_t *);
+int	pcap_dump_flush(pcap_dumper_t *);
+void	pcap_dump_close(pcap_dumper_t *);
+void	pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);
+
+int	pcap_findalldevs(pcap_if_t **, char *);
+void	pcap_freealldevs(pcap_if_t *);
+
+const char *pcap_lib_version(void);
+
+/*
+ * On at least some versions of NetBSD and QNX, we don't want to declare
+ * bpf_filter() here, as it's also be declared in <net/bpf.h>, with a
+ * different signature, but, on other BSD-flavored UN*Xes, it's not
+ * declared in <net/bpf.h>, so we *do* want to declare it here, so it's
+ * declared when we build pcap-bpf.c.
+ */
+#if !defined(__NetBSD__) && !defined(__QNX__)
+u_int	bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
+#endif
+int	bpf_validate(const struct bpf_insn *f, int len);
+char	*bpf_image(const struct bpf_insn *, int);
+void	bpf_dump(const struct bpf_program *, int);
+
+#if defined(WIN32)
+
+/*
+ * Win32 definitions
+ */
+
+int pcap_setbuff(pcap_t *p, int dim);
+int pcap_setmode(pcap_t *p, int mode);
+int pcap_setmintocopy(pcap_t *p, int size);
+Adapter *pcap_get_adapter(pcap_t *p);
+
+#ifdef WPCAP
+/* Include file with the wpcap-specific extensions */
+#include <Win32-Extensions.h>
+#endif /* WPCAP */
+
+#define MODE_CAPT 0
+#define MODE_STAT 1
+#define MODE_MON 2
+
+#elif defined(MSDOS)
+
+/*
+ * MS-DOS definitions
+ */
+
+int  pcap_stats_ex (pcap_t *, struct pcap_stat_ex *);
+void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait);
+u_long pcap_mac_packets (void);
+
+#else /* UN*X */
+
+/*
+ * UN*X definitions
+ */
+
+int	pcap_get_selectable_fd(pcap_t *);
+
+#endif /* WIN32/MSDOS/UN*X */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* lib_pcap_pcap_h */

Property changes on: lab4/.minix-src/include/pcap/pcap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/prop/prop_array.h
===================================================================
--- lab4/.minix-src/include/prop/prop_array.h	(nonexistent)
+++ lab4/.minix-src/include/prop/prop_array.h	(revision 13)
@@ -0,0 +1,163 @@
+/*     $NetBSD: prop_array.h,v 1.13 2011/09/30 22:08:18 jym Exp $    */
+
+/*-
+ * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PROPLIB_PROP_ARRAY_H_
+#define	_PROPLIB_PROP_ARRAY_H_
+
+#include <prop/prop_object.h>
+
+typedef struct _prop_array *prop_array_t;
+
+__BEGIN_DECLS
+prop_array_t	prop_array_create(void);
+prop_array_t	prop_array_create_with_capacity(unsigned int);
+
+prop_array_t	prop_array_copy(prop_array_t);
+prop_array_t	prop_array_copy_mutable(prop_array_t);
+
+unsigned int	prop_array_capacity(prop_array_t);
+unsigned int	prop_array_count(prop_array_t);
+bool		prop_array_ensure_capacity(prop_array_t, unsigned int);
+
+void		prop_array_make_immutable(prop_array_t);
+bool		prop_array_mutable(prop_array_t);
+
+prop_object_iterator_t prop_array_iterator(prop_array_t);
+
+prop_object_t	prop_array_get(prop_array_t, unsigned int);
+bool		prop_array_set(prop_array_t, unsigned int, prop_object_t);
+bool		prop_array_add(prop_array_t, prop_object_t);
+void		prop_array_remove(prop_array_t, unsigned int);
+
+bool		prop_array_equals(prop_array_t, prop_array_t);
+
+char *		prop_array_externalize(prop_array_t);
+prop_array_t	prop_array_internalize(const char *);
+
+bool		prop_array_externalize_to_file(prop_array_t, const char *);
+prop_array_t	prop_array_internalize_from_file(const char *);
+
+#if defined(__NetBSD__)
+struct plistref;
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+bool		prop_array_externalize_to_pref(prop_array_t, struct plistref *);
+bool		prop_array_internalize_from_pref(const struct plistref *,
+		                                 prop_array_t *);
+int		prop_array_send_ioctl(prop_array_t, int, unsigned long);
+int		prop_array_recv_ioctl(int, unsigned long, prop_array_t *);
+int		prop_array_send_syscall(prop_array_t, struct plistref *);
+int		prop_array_recv_syscall(const struct plistref *,
+					prop_array_t *);
+#elif defined(_KERNEL)
+int		prop_array_copyin(const struct plistref *, prop_array_t *);
+int		prop_array_copyout(struct plistref *, prop_array_t);
+int		prop_array_copyin_ioctl(const struct plistref *, const u_long,
+					prop_array_t *);
+int		prop_array_copyout_ioctl(struct plistref *, const u_long,
+					 prop_array_t);
+#endif
+#endif /* __NetBSD__ */
+
+/*
+ * Utility routines to make it more convenient to work with values
+ * stored in dictionaries.
+ */
+bool		prop_array_get_bool(prop_array_t, unsigned int,
+					 bool *);
+bool		prop_array_set_bool(prop_array_t, unsigned int,
+					 bool);
+
+bool		prop_array_get_int8(prop_array_t, unsigned int,
+					 int8_t *);
+bool		prop_array_get_uint8(prop_array_t, unsigned int,
+					  uint8_t *);
+bool		prop_array_set_int8(prop_array_t, unsigned int,
+					 int8_t);
+bool		prop_array_set_uint8(prop_array_t, unsigned int,
+					  uint8_t);
+
+bool		prop_array_get_int16(prop_array_t, unsigned int,
+					  int16_t *);
+bool		prop_array_get_uint16(prop_array_t, unsigned int,
+					   uint16_t *);
+bool		prop_array_set_int16(prop_array_t, unsigned int,
+					  int16_t);
+bool		prop_array_set_uint16(prop_array_t, unsigned int,
+					   uint16_t);
+
+bool		prop_array_get_int32(prop_array_t, unsigned int,
+					  int32_t *);
+bool		prop_array_get_uint32(prop_array_t, unsigned int,
+					   uint32_t *);
+bool		prop_array_set_int32(prop_array_t, unsigned int,
+					  int32_t);
+bool		prop_array_set_uint32(prop_array_t, unsigned int,
+					   uint32_t);
+
+bool		prop_array_get_int64(prop_array_t, unsigned int,
+					  int64_t *);
+bool		prop_array_get_uint64(prop_array_t, unsigned int,
+					   uint64_t *);
+bool		prop_array_set_int64(prop_array_t, unsigned int,
+					  int64_t);
+bool		prop_array_set_uint64(prop_array_t, unsigned int,
+					   uint64_t);
+
+bool		prop_array_add_int8(prop_array_t, int8_t);
+bool		prop_array_add_uint8(prop_array_t, uint8_t);
+
+bool		prop_array_add_int16(prop_array_t, int16_t);
+bool		prop_array_add_uint16(prop_array_t, uint16_t);
+
+bool		prop_array_add_int32(prop_array_t, int32_t);
+bool		prop_array_add_uint32(prop_array_t, uint32_t);
+
+bool		prop_array_add_int64(prop_array_t, int64_t);
+bool		prop_array_add_uint64(prop_array_t, uint64_t);
+
+bool		prop_array_get_cstring(prop_array_t, unsigned int,
+					     char **);
+bool		prop_array_set_cstring(prop_array_t, unsigned int,
+					    const char *);
+
+bool		prop_array_get_cstring_nocopy(prop_array_t,
+                                                   unsigned int,
+						   const char **);
+bool		prop_array_set_cstring_nocopy(prop_array_t,
+						   unsigned int,
+						   const char *);
+
+bool		prop_array_add_and_rel(prop_array_t, prop_object_t);
+
+__END_DECLS
+
+#endif /* _PROPLIB_PROP_ARRAY_H_ */

Property changes on: lab4/.minix-src/include/prop/prop_array.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/prop/prop_ingest.h
===================================================================
--- lab4/.minix-src/include/prop/prop_ingest.h	(nonexistent)
+++ lab4/.minix-src/include/prop/prop_ingest.h	(revision 13)
@@ -0,0 +1,90 @@
+/*	$NetBSD: prop_ingest.h,v 1.3 2008/04/28 20:22:51 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PROPLIB_PROP_INGEST_H_
+#define	_PROPLIB_PROP_INGEST_H_
+
+#include <prop/prop_dictionary.h>
+
+typedef enum {
+	PROP_INGEST_ERROR_NO_ERROR		= 0,
+	PROP_INGEST_ERROR_NO_KEY		= 1,
+	PROP_INGEST_ERROR_WRONG_TYPE		= 2,
+	PROP_INGEST_ERROR_HANDLER_FAILED	= 3
+} prop_ingest_error_t;
+
+typedef enum {
+	PROP_INGEST_FLAG_OPTIONAL		= 0x01
+} prop_ingest_flag_t;
+
+typedef struct _prop_ingest_context *prop_ingest_context_t;
+
+typedef bool (*prop_ingest_handler_t)(prop_ingest_context_t, prop_object_t);
+
+typedef struct {
+	const char *pite_key;
+	prop_type_t pite_type;
+	unsigned int pite_flags;
+	prop_ingest_handler_t pite_handler;
+} prop_ingest_table_entry;
+
+#define	PROP_INGEST(key_, type_, handler_)				\
+	{ .pite_key = key_ ,						\
+	  .pite_type = type_ ,						\
+	  .pite_flags = 0 ,						\
+	  .pite_handler = handler_ }
+
+#define	PROP_INGEST_OPTIONAL(key_, type_, handler_)			\
+	{ .pite_key = key_ ,						\
+	  .pite_type = type_ ,						\
+	  .pite_flags = PROP_INGEST_FLAG_OPTIONAL ,			\
+	  .pite_handler = handler_ }
+
+#define	PROP_INGEST_END							\
+	{ .pite_key = NULL }
+
+__BEGIN_DECLS
+prop_ingest_context_t
+		prop_ingest_context_alloc(void *);
+void		prop_ingest_context_free(prop_ingest_context_t);
+
+prop_ingest_error_t
+		prop_ingest_context_error(prop_ingest_context_t);
+prop_type_t	prop_ingest_context_type(prop_ingest_context_t);
+const char *	prop_ingest_context_key(prop_ingest_context_t);
+void *		prop_ingest_context_private(prop_ingest_context_t);
+
+bool		prop_dictionary_ingest(prop_dictionary_t,
+				       const prop_ingest_table_entry[],
+				       prop_ingest_context_t);
+__END_DECLS
+
+#endif /* _PROPLIB_PROP_INGEST_H_ */

Property changes on: lab4/.minix-src/include/prop/prop_ingest.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/prop/plistref.h
===================================================================
--- lab4/.minix-src/include/prop/plistref.h	(nonexistent)
+++ lab4/.minix-src/include/prop/plistref.h	(revision 13)
@@ -0,0 +1,48 @@
+/*	$NetBSD: plistref.h,v 1.2 2008/04/28 20:22:51 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PROPLIB_PLISTREF_H_
+#define	_PROPLIB_PLISTREF_H_
+
+/* for size_t */
+#include <sys/types.h>
+
+/*
+ * Property List Reference --
+ *	Used to pass externalized property lists across protection
+ *	boundaries (ioctls, syscalls, etc.).
+ */
+struct plistref {
+	void *pref_plist;		/* plist data */
+	size_t pref_len;		/* total length of plist data */
+};
+
+#endif /* _PROPLIB_PLISTREF_H_ */

Property changes on: lab4/.minix-src/include/prop/plistref.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/prop/prop_dictionary.h
===================================================================
--- lab4/.minix-src/include/prop/prop_dictionary.h	(nonexistent)
+++ lab4/.minix-src/include/prop/prop_dictionary.h	(revision 13)
@@ -0,0 +1,181 @@
+/*	$NetBSD: prop_dictionary.h,v 1.14 2011/09/30 22:08:18 jym Exp $	*/
+
+/*-
+ * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PROPLIB_PROP_DICTIONARY_H_
+#define	_PROPLIB_PROP_DICTIONARY_H_
+
+#include <prop/prop_object.h>
+
+typedef struct _prop_dictionary *prop_dictionary_t;
+typedef struct _prop_dictionary_keysym *prop_dictionary_keysym_t;
+
+__BEGIN_DECLS
+prop_dictionary_t prop_dictionary_create(void);
+prop_dictionary_t prop_dictionary_create_with_capacity(unsigned int);
+
+prop_dictionary_t prop_dictionary_copy(prop_dictionary_t);
+prop_dictionary_t prop_dictionary_copy_mutable(prop_dictionary_t);
+
+unsigned int	prop_dictionary_count(prop_dictionary_t);
+bool		prop_dictionary_ensure_capacity(prop_dictionary_t,
+						unsigned int);
+
+void		prop_dictionary_make_immutable(prop_dictionary_t);
+bool		prop_dictionary_mutable(prop_dictionary_t);
+
+prop_object_iterator_t prop_dictionary_iterator(prop_dictionary_t);
+prop_array_t	prop_dictionary_all_keys(prop_dictionary_t);
+
+prop_object_t	prop_dictionary_get(prop_dictionary_t, const char *);
+bool		prop_dictionary_set(prop_dictionary_t, const char *,
+				    prop_object_t);
+void		prop_dictionary_remove(prop_dictionary_t, const char *);
+
+prop_object_t	prop_dictionary_get_keysym(prop_dictionary_t,
+					   prop_dictionary_keysym_t);
+bool		prop_dictionary_set_keysym(prop_dictionary_t,
+					   prop_dictionary_keysym_t,
+					   prop_object_t);
+void		prop_dictionary_remove_keysym(prop_dictionary_t,
+					      prop_dictionary_keysym_t);
+
+bool		prop_dictionary_equals(prop_dictionary_t, prop_dictionary_t);
+
+char *		prop_dictionary_externalize(prop_dictionary_t);
+prop_dictionary_t prop_dictionary_internalize(const char *);
+
+bool		prop_dictionary_externalize_to_file(prop_dictionary_t,
+						    const char *);
+prop_dictionary_t prop_dictionary_internalize_from_file(const char *);
+
+const char *	prop_dictionary_keysym_cstring_nocopy(prop_dictionary_keysym_t);
+
+bool		prop_dictionary_keysym_equals(prop_dictionary_keysym_t,
+					      prop_dictionary_keysym_t);
+
+#if defined(__NetBSD__)
+struct plistref;
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+bool		prop_dictionary_externalize_to_pref(prop_dictionary_t, struct plistref *);
+bool		prop_dictionary_internalize_from_pref(const struct plistref *,
+		                                      prop_dictionary_t *);
+int		prop_dictionary_send_ioctl(prop_dictionary_t, int,
+					   unsigned long);
+int		prop_dictionary_recv_ioctl(int, unsigned long,
+					   prop_dictionary_t *);
+int		prop_dictionary_sendrecv_ioctl(prop_dictionary_t,
+					       int, unsigned long,
+					       prop_dictionary_t *);
+int		prop_dictionary_send_syscall(prop_dictionary_t,
+		     struct plistref *);
+int		prop_dictionary_recv_syscall(const struct plistref *,
+					   prop_dictionary_t *);
+#elif defined(_KERNEL)
+int		prop_dictionary_copyin(const struct plistref *,
+				       prop_dictionary_t *);
+int		prop_dictionary_copyout(struct plistref *,
+				       prop_dictionary_t);
+int		prop_dictionary_copyin_ioctl(const struct plistref *,
+					     const u_long,
+					     prop_dictionary_t *);
+int		prop_dictionary_copyout_ioctl(struct plistref *,
+					      const u_long,
+					      prop_dictionary_t);
+#endif
+#endif /* __NetBSD__ */
+
+/*
+ * Utility routines to make it more convenient to work with values
+ * stored in dictionaries.
+ */
+bool		prop_dictionary_get_dict(prop_dictionary_t, const char *,
+					 prop_dictionary_t *);
+bool		prop_dictionary_get_bool(prop_dictionary_t, const char *,
+					 bool *);
+bool		prop_dictionary_set_bool(prop_dictionary_t, const char *,
+					 bool);
+
+bool		prop_dictionary_get_int8(prop_dictionary_t, const char *,
+					 int8_t *);
+bool		prop_dictionary_get_uint8(prop_dictionary_t, const char *,
+					  uint8_t *);
+bool		prop_dictionary_set_int8(prop_dictionary_t, const char *,
+					 int8_t);
+bool		prop_dictionary_set_uint8(prop_dictionary_t, const char *,
+					  uint8_t);
+
+bool		prop_dictionary_get_int16(prop_dictionary_t, const char *,
+					  int16_t *);
+bool		prop_dictionary_get_uint16(prop_dictionary_t, const char *,
+					   uint16_t *);
+bool		prop_dictionary_set_int16(prop_dictionary_t, const char *,
+					  int16_t);
+bool		prop_dictionary_set_uint16(prop_dictionary_t, const char *,
+					   uint16_t);
+
+bool		prop_dictionary_get_int32(prop_dictionary_t, const char *,
+					  int32_t *);
+bool		prop_dictionary_get_uint32(prop_dictionary_t, const char *,
+					   uint32_t *);
+bool		prop_dictionary_set_int32(prop_dictionary_t, const char *,
+					  int32_t);
+bool		prop_dictionary_set_uint32(prop_dictionary_t, const char *,
+					   uint32_t);
+
+bool		prop_dictionary_get_int64(prop_dictionary_t, const char *,
+					  int64_t *);
+bool		prop_dictionary_get_uint64(prop_dictionary_t, const char *,
+					   uint64_t *);
+bool		prop_dictionary_set_int64(prop_dictionary_t, const char *,
+					  int64_t);
+bool		prop_dictionary_set_uint64(prop_dictionary_t, const char *,
+					   uint64_t);
+
+bool		prop_dictionary_get_cstring(prop_dictionary_t, const char *,
+					     char **);
+bool		prop_dictionary_set_cstring(prop_dictionary_t, const char *,
+					    const char *);
+
+bool		prop_dictionary_get_cstring_nocopy(prop_dictionary_t,
+						   const char *,
+						   const char **);
+bool		prop_dictionary_set_cstring_nocopy(prop_dictionary_t,
+						   const char *,
+						   const char *);
+
+bool		prop_dictionary_set_and_rel(prop_dictionary_t,
+						   const char *,
+						   prop_object_t);
+
+__END_DECLS
+
+#endif /* _PROPLIB_PROP_DICTIONARY_H_ */

Property changes on: lab4/.minix-src/include/prop/prop_dictionary.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ssl.h
===================================================================
--- lab4/.minix-src/include/openssl/ssl.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ssl.h	(revision 13)
@@ -0,0 +1,2766 @@
+/* ssl/ssl.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* ====================================================================
+ * Copyright (c) 1998-2007 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ * ECC cipher suite support in OpenSSL originally developed by
+ * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
+ */
+/* ====================================================================
+ * Copyright 2005 Nokia. All rights reserved.
+ *
+ * The portions of the attached software ("Contribution") is developed by
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
+ * license.
+ *
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
+ * support (see RFC 4279) to OpenSSL.
+ *
+ * No patent licenses or other rights except those expressly stated in
+ * the OpenSSL open source license shall be deemed granted or received
+ * expressly, by implication, estoppel, or otherwise.
+ *
+ * No assurances are provided by Nokia that the Contribution does not
+ * infringe the patent or other intellectual property rights of any third
+ * party or that the license provides you with all the necessary rights
+ * to make use of the Contribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
+ * OTHERWISE.
+ */
+
+#ifndef HEADER_SSL_H
+# define HEADER_SSL_H
+
+# include <openssl/e_os2.h>
+
+# ifndef OPENSSL_NO_COMP
+#  include <openssl/comp.h>
+# endif
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+# ifndef OPENSSL_NO_DEPRECATED
+#  ifndef OPENSSL_NO_X509
+#   include <openssl/x509.h>
+#  endif
+#  include <openssl/crypto.h>
+#  include <openssl/lhash.h>
+#  include <openssl/buffer.h>
+# endif
+# include <openssl/pem.h>
+# include <openssl/hmac.h>
+
+# include <openssl/kssl.h>
+# include <openssl/safestack.h>
+# include <openssl/symhacks.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* SSLeay version number for ASN.1 encoding of the session information */
+/*-
+ * Version 0 - initial version
+ * Version 1 - added the optional peer certificate
+ */
+# define SSL_SESSION_ASN1_VERSION 0x0001
+
+/* text strings for the ciphers */
+# define SSL_TXT_NULL_WITH_MD5           SSL2_TXT_NULL_WITH_MD5
+# define SSL_TXT_RC4_128_WITH_MD5        SSL2_TXT_RC4_128_WITH_MD5
+# define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5
+# define SSL_TXT_RC2_128_CBC_WITH_MD5    SSL2_TXT_RC2_128_CBC_WITH_MD5
+# define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5
+# define SSL_TXT_IDEA_128_CBC_WITH_MD5   SSL2_TXT_IDEA_128_CBC_WITH_MD5
+# define SSL_TXT_DES_64_CBC_WITH_MD5     SSL2_TXT_DES_64_CBC_WITH_MD5
+# define SSL_TXT_DES_64_CBC_WITH_SHA     SSL2_TXT_DES_64_CBC_WITH_SHA
+# define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5
+# define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA
+
+/*
+ * VRS Additional Kerberos5 entries
+ */
+# define SSL_TXT_KRB5_DES_64_CBC_SHA   SSL3_TXT_KRB5_DES_64_CBC_SHA
+# define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA
+# define SSL_TXT_KRB5_RC4_128_SHA      SSL3_TXT_KRB5_RC4_128_SHA
+# define SSL_TXT_KRB5_IDEA_128_CBC_SHA SSL3_TXT_KRB5_IDEA_128_CBC_SHA
+# define SSL_TXT_KRB5_DES_64_CBC_MD5   SSL3_TXT_KRB5_DES_64_CBC_MD5
+# define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5
+# define SSL_TXT_KRB5_RC4_128_MD5      SSL3_TXT_KRB5_RC4_128_MD5
+# define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5
+
+# define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA
+# define SSL_TXT_KRB5_RC2_40_CBC_SHA   SSL3_TXT_KRB5_RC2_40_CBC_SHA
+# define SSL_TXT_KRB5_RC4_40_SHA       SSL3_TXT_KRB5_RC4_40_SHA
+# define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5
+# define SSL_TXT_KRB5_RC2_40_CBC_MD5   SSL3_TXT_KRB5_RC2_40_CBC_MD5
+# define SSL_TXT_KRB5_RC4_40_MD5       SSL3_TXT_KRB5_RC4_40_MD5
+
+# define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA
+# define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5
+# define SSL_TXT_KRB5_DES_64_CBC_SHA   SSL3_TXT_KRB5_DES_64_CBC_SHA
+# define SSL_TXT_KRB5_DES_64_CBC_MD5   SSL3_TXT_KRB5_DES_64_CBC_MD5
+# define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA
+# define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5
+# define SSL_MAX_KRB5_PRINCIPAL_LENGTH  256
+
+# define SSL_MAX_SSL_SESSION_ID_LENGTH           32
+# define SSL_MAX_SID_CTX_LENGTH                  32
+
+# define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES     (512/8)
+# define SSL_MAX_KEY_ARG_LENGTH                  8
+# define SSL_MAX_MASTER_KEY_LENGTH               48
+
+/* These are used to specify which ciphers to use and not to use */
+
+# define SSL_TXT_EXP40           "EXPORT40"
+# define SSL_TXT_EXP56           "EXPORT56"
+# define SSL_TXT_LOW             "LOW"
+# define SSL_TXT_MEDIUM          "MEDIUM"
+# define SSL_TXT_HIGH            "HIGH"
+# define SSL_TXT_FIPS            "FIPS"
+
+# define SSL_TXT_kFZA            "kFZA"/* unused! */
+# define SSL_TXT_aFZA            "aFZA"/* unused! */
+# define SSL_TXT_eFZA            "eFZA"/* unused! */
+# define SSL_TXT_FZA             "FZA"/* unused! */
+
+# define SSL_TXT_aNULL           "aNULL"
+# define SSL_TXT_eNULL           "eNULL"
+# define SSL_TXT_NULL            "NULL"
+
+# define SSL_TXT_kRSA            "kRSA"
+# define SSL_TXT_kDHr            "kDHr"/* no such ciphersuites supported! */
+# define SSL_TXT_kDHd            "kDHd"/* no such ciphersuites supported! */
+# define SSL_TXT_kDH             "kDH"/* no such ciphersuites supported! */
+# define SSL_TXT_kEDH            "kEDH"
+# define SSL_TXT_kKRB5           "kKRB5"
+# define SSL_TXT_kECDHr          "kECDHr"
+# define SSL_TXT_kECDHe          "kECDHe"
+# define SSL_TXT_kECDH           "kECDH"
+# define SSL_TXT_kEECDH          "kEECDH"
+# define SSL_TXT_kPSK            "kPSK"
+# define SSL_TXT_kGOST           "kGOST"
+# define SSL_TXT_kSRP            "kSRP"
+
+# define SSL_TXT_aRSA            "aRSA"
+# define SSL_TXT_aDSS            "aDSS"
+# define SSL_TXT_aDH             "aDH"/* no such ciphersuites supported! */
+# define SSL_TXT_aECDH           "aECDH"
+# define SSL_TXT_aKRB5           "aKRB5"
+# define SSL_TXT_aECDSA          "aECDSA"
+# define SSL_TXT_aPSK            "aPSK"
+# define SSL_TXT_aGOST94 "aGOST94"
+# define SSL_TXT_aGOST01 "aGOST01"
+# define SSL_TXT_aGOST  "aGOST"
+# define SSL_TXT_aSRP            "aSRP"
+
+# define SSL_TXT_DSS             "DSS"
+# define SSL_TXT_DH              "DH"
+# define SSL_TXT_EDH             "EDH"/* same as "kEDH:-ADH" */
+# define SSL_TXT_ADH             "ADH"
+# define SSL_TXT_RSA             "RSA"
+# define SSL_TXT_ECDH            "ECDH"
+# define SSL_TXT_EECDH           "EECDH"/* same as "kEECDH:-AECDH" */
+# define SSL_TXT_AECDH           "AECDH"
+# define SSL_TXT_ECDSA           "ECDSA"
+# define SSL_TXT_KRB5            "KRB5"
+# define SSL_TXT_PSK             "PSK"
+# define SSL_TXT_SRP             "SRP"
+
+# define SSL_TXT_DES             "DES"
+# define SSL_TXT_3DES            "3DES"
+# define SSL_TXT_RC4             "RC4"
+# define SSL_TXT_RC2             "RC2"
+# define SSL_TXT_IDEA            "IDEA"
+# define SSL_TXT_SEED            "SEED"
+# define SSL_TXT_AES128          "AES128"
+# define SSL_TXT_AES256          "AES256"
+# define SSL_TXT_AES             "AES"
+# define SSL_TXT_AES_GCM         "AESGCM"
+# define SSL_TXT_CAMELLIA128     "CAMELLIA128"
+# define SSL_TXT_CAMELLIA256     "CAMELLIA256"
+# define SSL_TXT_CAMELLIA        "CAMELLIA"
+
+# define SSL_TXT_MD5             "MD5"
+# define SSL_TXT_SHA1            "SHA1"
+# define SSL_TXT_SHA             "SHA"/* same as "SHA1" */
+# define SSL_TXT_GOST94          "GOST94"
+# define SSL_TXT_GOST89MAC               "GOST89MAC"
+# define SSL_TXT_SHA256          "SHA256"
+# define SSL_TXT_SHA384          "SHA384"
+
+# define SSL_TXT_SSLV2           "SSLv2"
+# define SSL_TXT_SSLV3           "SSLv3"
+# define SSL_TXT_TLSV1           "TLSv1"
+# define SSL_TXT_TLSV1_1         "TLSv1.1"
+# define SSL_TXT_TLSV1_2         "TLSv1.2"
+
+# define SSL_TXT_EXP             "EXP"
+# define SSL_TXT_EXPORT          "EXPORT"
+
+# define SSL_TXT_ALL             "ALL"
+
+/*-
+ * COMPLEMENTOF* definitions. These identifiers are used to (de-select)
+ * ciphers normally not being used.
+ * Example: "RC4" will activate all ciphers using RC4 including ciphers
+ * without authentication, which would normally disabled by DEFAULT (due
+ * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT"
+ * will make sure that it is also disabled in the specific selection.
+ * COMPLEMENTOF* identifiers are portable between version, as adjustments
+ * to the default cipher setup will also be included here.
+ *
+ * COMPLEMENTOFDEFAULT does not experience the same special treatment that
+ * DEFAULT gets, as only selection is being done and no sorting as needed
+ * for DEFAULT.
+ */
+# define SSL_TXT_CMPALL          "COMPLEMENTOFALL"
+# define SSL_TXT_CMPDEF          "COMPLEMENTOFDEFAULT"
+
+/*
+ * The following cipher list is used by default. It also is substituted when
+ * an application-defined cipher list string starts with 'DEFAULT'.
+ */
+# define SSL_DEFAULT_CIPHER_LIST "ALL:!EXPORT:!aNULL:!eNULL:!SSLv2"
+/*
+ * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always
+ * starts with a reasonable order, and all we have to do for DEFAULT is
+ * throwing out anonymous and unencrypted ciphersuites! (The latter are not
+ * actually enabled by ALL, but "ALL:RSA" would enable some of them.)
+ */
+
+/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */
+# define SSL_SENT_SHUTDOWN       1
+# define SSL_RECEIVED_SHUTDOWN   2
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && !defined(OPENSSL_NO_SSL2)
+#  define OPENSSL_NO_SSL2
+# endif
+
+# define SSL_FILETYPE_ASN1       X509_FILETYPE_ASN1
+# define SSL_FILETYPE_PEM        X509_FILETYPE_PEM
+
+/*
+ * This is needed to stop compilers complaining about the 'struct ssl_st *'
+ * function parameters used to prototype callbacks in SSL_CTX.
+ */
+typedef struct ssl_st *ssl_crock_st;
+typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT;
+typedef struct ssl_method_st SSL_METHOD;
+typedef struct ssl_cipher_st SSL_CIPHER;
+typedef struct ssl_session_st SSL_SESSION;
+
+DECLARE_STACK_OF(SSL_CIPHER)
+
+/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/
+typedef struct srtp_protection_profile_st {
+    const char *name;
+    unsigned long id;
+} SRTP_PROTECTION_PROFILE;
+
+DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE)
+
+typedef int (*tls_session_ticket_ext_cb_fn) (SSL *s,
+                                             const unsigned char *data,
+                                             int len, void *arg);
+typedef int (*tls_session_secret_cb_fn) (SSL *s, void *secret,
+                                         int *secret_len,
+                                         STACK_OF(SSL_CIPHER) *peer_ciphers,
+                                         SSL_CIPHER **cipher, void *arg);
+
+# ifndef OPENSSL_NO_SSL_INTERN
+
+/* used to hold info on the particular ciphers used */
+struct ssl_cipher_st {
+    int valid;
+    const char *name;           /* text name */
+    unsigned long id;           /* id, 4 bytes, first is version */
+    /*
+     * changed in 0.9.9: these four used to be portions of a single value
+     * 'algorithms'
+     */
+    unsigned long algorithm_mkey; /* key exchange algorithm */
+    unsigned long algorithm_auth; /* server authentication */
+    unsigned long algorithm_enc; /* symmetric encryption */
+    unsigned long algorithm_mac; /* symmetric authentication */
+    unsigned long algorithm_ssl; /* (major) protocol version */
+    unsigned long algo_strength; /* strength and export flags */
+    unsigned long algorithm2;   /* Extra flags */
+    int strength_bits;          /* Number of bits really used */
+    int alg_bits;               /* Number of bits for algorithm */
+};
+
+/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */
+struct ssl_method_st {
+    int version;
+    int (*ssl_new) (SSL *s);
+    void (*ssl_clear) (SSL *s);
+    void (*ssl_free) (SSL *s);
+    int (*ssl_accept) (SSL *s);
+    int (*ssl_connect) (SSL *s);
+    int (*ssl_read) (SSL *s, void *buf, int len);
+    int (*ssl_peek) (SSL *s, void *buf, int len);
+    int (*ssl_write) (SSL *s, const void *buf, int len);
+    int (*ssl_shutdown) (SSL *s);
+    int (*ssl_renegotiate) (SSL *s);
+    int (*ssl_renegotiate_check) (SSL *s);
+    long (*ssl_get_message) (SSL *s, int st1, int stn, int mt, long
+                             max, int *ok);
+    int (*ssl_read_bytes) (SSL *s, int type, unsigned char *buf, int len,
+                           int peek);
+    int (*ssl_write_bytes) (SSL *s, int type, const void *buf_, int len);
+    int (*ssl_dispatch_alert) (SSL *s);
+    long (*ssl_ctrl) (SSL *s, int cmd, long larg, void *parg);
+    long (*ssl_ctx_ctrl) (SSL_CTX *ctx, int cmd, long larg, void *parg);
+    const SSL_CIPHER *(*get_cipher_by_char) (const unsigned char *ptr);
+    int (*put_cipher_by_char) (const SSL_CIPHER *cipher, unsigned char *ptr);
+    int (*ssl_pending) (const SSL *s);
+    int (*num_ciphers) (void);
+    const SSL_CIPHER *(*get_cipher) (unsigned ncipher);
+    const struct ssl_method_st *(*get_ssl_method) (int version);
+    long (*get_timeout) (void);
+    struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */
+    int (*ssl_version) (void);
+    long (*ssl_callback_ctrl) (SSL *s, int cb_id, void (*fp) (void));
+    long (*ssl_ctx_callback_ctrl) (SSL_CTX *s, int cb_id, void (*fp) (void));
+};
+
+/*-
+ * Lets make this into an ASN.1 type structure as follows
+ * SSL_SESSION_ID ::= SEQUENCE {
+ *      version                 INTEGER,        -- structure version number
+ *      SSLversion              INTEGER,        -- SSL version number
+ *      Cipher                  OCTET STRING,   -- the 3 byte cipher ID
+ *      Session_ID              OCTET STRING,   -- the Session ID
+ *      Master_key              OCTET STRING,   -- the master key
+ *      KRB5_principal          OCTET STRING    -- optional Kerberos principal
+ *      Key_Arg [ 0 ] IMPLICIT  OCTET STRING,   -- the optional Key argument
+ *      Time [ 1 ] EXPLICIT     INTEGER,        -- optional Start Time
+ *      Timeout [ 2 ] EXPLICIT  INTEGER,        -- optional Timeout ins seconds
+ *      Peer [ 3 ] EXPLICIT     X509,           -- optional Peer Certificate
+ *      Session_ID_context [ 4 ] EXPLICIT OCTET STRING,   -- the Session ID context
+ *      Verify_result [ 5 ] EXPLICIT INTEGER,   -- X509_V_... code for `Peer'
+ *      HostName [ 6 ] EXPLICIT OCTET STRING,   -- optional HostName from servername TLS extension
+ *      PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint
+ *      PSK_identity [ 8 ] EXPLICIT OCTET STRING,  -- optional PSK identity
+ *      Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket
+ *      Ticket [10]             EXPLICIT OCTET STRING, -- session ticket (clients only)
+ *      Compression_meth [11]   EXPLICIT OCTET STRING, -- optional compression method
+ *      SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username
+ *      }
+ * Look in ssl/ssl_asn1.c for more details
+ * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
+ */
+struct ssl_session_st {
+    int ssl_version;            /* what ssl version session info is being
+                                 * kept in here? */
+    /* only really used in SSLv2 */
+    unsigned int key_arg_length;
+    unsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH];
+    int master_key_length;
+    unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];
+    /* session_id - valid? */
+    unsigned int session_id_length;
+    unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
+    /*
+     * this is used to determine whether the session is being reused in the
+     * appropriate context. It is up to the application to set this, via
+     * SSL_new
+     */
+    unsigned int sid_ctx_length;
+    unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
+#  ifndef OPENSSL_NO_KRB5
+    unsigned int krb5_client_princ_len;
+    unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH];
+#  endif                        /* OPENSSL_NO_KRB5 */
+#  ifndef OPENSSL_NO_PSK
+    char *psk_identity_hint;
+    char *psk_identity;
+#  endif
+    /*
+     * Used to indicate that session resumption is not allowed. Applications
+     * can also set this bit for a new session via not_resumable_session_cb
+     * to disable session caching and tickets.
+     */
+    int not_resumable;
+    /* The cert is the certificate used to establish this connection */
+    struct sess_cert_st /* SESS_CERT */ *sess_cert;
+    /*
+     * This is the cert for the other end. On clients, it will be the same as
+     * sess_cert->peer_key->x509 (the latter is not enough as sess_cert is
+     * not retained in the external representation of sessions, see
+     * ssl_asn1.c).
+     */
+    X509 *peer;
+    /*
+     * when app_verify_callback accepts a session where the peer's
+     * certificate is not ok, we must remember the error for session reuse:
+     */
+    long verify_result;         /* only for servers */
+    int references;
+    long timeout;
+    long time;
+    unsigned int compress_meth; /* Need to lookup the method */
+    const SSL_CIPHER *cipher;
+    unsigned long cipher_id;    /* when ASN.1 loaded, this needs to be used
+                                 * to load the 'cipher' structure */
+    STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */
+    CRYPTO_EX_DATA ex_data;     /* application specific data */
+    /*
+     * These are used to make removal of session-ids more efficient and to
+     * implement a maximum cache size.
+     */
+    struct ssl_session_st *prev, *next;
+#  ifndef OPENSSL_NO_TLSEXT
+    char *tlsext_hostname;
+#   ifndef OPENSSL_NO_EC
+    size_t tlsext_ecpointformatlist_length;
+    unsigned char *tlsext_ecpointformatlist; /* peer's list */
+    size_t tlsext_ellipticcurvelist_length;
+    unsigned char *tlsext_ellipticcurvelist; /* peer's list */
+#   endif                       /* OPENSSL_NO_EC */
+    /* RFC4507 info */
+    unsigned char *tlsext_tick; /* Session ticket */
+    size_t tlsext_ticklen;      /* Session ticket length */
+    long tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */
+#  endif
+#  ifndef OPENSSL_NO_SRP
+    char *srp_username;
+#  endif
+};
+
+# endif
+
+# define SSL_OP_MICROSOFT_SESS_ID_BUG                    0x00000001L
+# define SSL_OP_NETSCAPE_CHALLENGE_BUG                   0x00000002L
+/* Allow initial connection to servers that don't support RI */
+# define SSL_OP_LEGACY_SERVER_CONNECT                    0x00000004L
+# define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG         0x00000008L
+# define SSL_OP_TLSEXT_PADDING                           0x00000010L
+# define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER               0x00000020L
+# define SSL_OP_SAFARI_ECDHE_ECDSA_BUG                   0x00000040L
+# define SSL_OP_SSLEAY_080_CLIENT_DH_BUG                 0x00000080L
+# define SSL_OP_TLS_D5_BUG                               0x00000100L
+# define SSL_OP_TLS_BLOCK_PADDING_BUG                    0x00000200L
+
+/* Hasn't done anything since OpenSSL 0.9.7h, retained for compatibility */
+# define SSL_OP_MSIE_SSLV2_RSA_PADDING                   0x0
+/* Refers to ancient SSLREF and SSLv2, retained for compatibility */
+# define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG              0x0
+
+/*
+ * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in
+ * OpenSSL 0.9.6d.  Usually (depending on the application protocol) the
+ * workaround is not needed.  Unfortunately some broken SSL/TLS
+ * implementations cannot handle it at all, which is why we include it in
+ * SSL_OP_ALL.
+ */
+/* added in 0.9.6e */
+# define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS              0x00000800L
+
+/*
+ * SSL_OP_ALL: various bug workarounds that should be rather harmless.  This
+ * used to be 0x000FFFFFL before 0.9.7.
+ */
+# define SSL_OP_ALL                                      0x80000BFFL
+
+/* DTLS options */
+# define SSL_OP_NO_QUERY_MTU                 0x00001000L
+/* Turn on Cookie Exchange (on relevant for servers) */
+# define SSL_OP_COOKIE_EXCHANGE              0x00002000L
+/* Don't use RFC4507 ticket extension */
+# define SSL_OP_NO_TICKET                    0x00004000L
+/* Use Cisco's "speshul" version of DTLS_BAD_VER (as client)  */
+# define SSL_OP_CISCO_ANYCONNECT             0x00008000L
+
+/* As server, disallow session resumption on renegotiation */
+# define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION   0x00010000L
+/* Don't use compression even if supported */
+# define SSL_OP_NO_COMPRESSION                           0x00020000L
+/* Permit unsafe legacy renegotiation */
+# define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION        0x00040000L
+/* If set, always create a new key when using tmp_ecdh parameters */
+# define SSL_OP_SINGLE_ECDH_USE                          0x00080000L
+/* If set, always create a new key when using tmp_dh parameters */
+# define SSL_OP_SINGLE_DH_USE                            0x00100000L
+/* Does nothing: retained for compatibiity */
+# define SSL_OP_EPHEMERAL_RSA                            0x0
+/*
+ * Set on servers to choose the cipher according to the server's preferences
+ */
+# define SSL_OP_CIPHER_SERVER_PREFERENCE                 0x00400000L
+/*
+ * If set, a server will allow a client to issue a SSLv3.0 version number as
+ * latest version supported in the premaster secret, even when TLSv1.0
+ * (version 3.1) was announced in the client hello. Normally this is
+ * forbidden to prevent version rollback attacks.
+ */
+# define SSL_OP_TLS_ROLLBACK_BUG                         0x00800000L
+
+# define SSL_OP_NO_SSLv2                                 0x01000000L
+# define SSL_OP_NO_SSLv3                                 0x02000000L
+# define SSL_OP_NO_TLSv1                                 0x04000000L
+# define SSL_OP_NO_TLSv1_2                               0x08000000L
+# define SSL_OP_NO_TLSv1_1                               0x10000000L
+
+/*
+ * These next two were never actually used for anything since SSLeay zap so
+ * we have some more flags.
+ */
+/*
+ * The next flag deliberately changes the ciphertest, this is a check for the
+ * PKCS#1 attack
+ */
+# define SSL_OP_PKCS1_CHECK_1                            0x0
+# define SSL_OP_PKCS1_CHECK_2                            0x0
+
+# define SSL_OP_NETSCAPE_CA_DN_BUG                       0x20000000L
+# define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG          0x40000000L
+/*
+ * Make server add server-hello extension from early version of cryptopro
+ * draft, when GOST ciphersuite is negotiated. Required for interoperability
+ * with CryptoPro CSP 3.x
+ */
+# define SSL_OP_CRYPTOPRO_TLSEXT_BUG                     0x80000000L
+
+/*
+ * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success
+ * when just a single record has been written):
+ */
+# define SSL_MODE_ENABLE_PARTIAL_WRITE       0x00000001L
+/*
+ * Make it possible to retry SSL_write() with changed buffer location (buffer
+ * contents must stay the same!); this is not the default to avoid the
+ * misconception that non-blocking SSL_write() behaves like non-blocking
+ * write():
+ */
+# define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L
+/*
+ * Never bother the application with retries if the transport is blocking:
+ */
+# define SSL_MODE_AUTO_RETRY 0x00000004L
+/* Don't attempt to automatically build certificate chain */
+# define SSL_MODE_NO_AUTO_CHAIN 0x00000008L
+/*
+ * Save RAM by releasing read and write buffers when they're empty. (SSL3 and
+ * TLS only.) "Released" buffers are put onto a free-list in the context or
+ * just freed (depending on the context's setting for freelist_max_len).
+ */
+# define SSL_MODE_RELEASE_BUFFERS 0x00000010L
+/*
+ * Send the current time in the Random fields of the ClientHello and
+ * ServerHello records for compatibility with hypothetical implementations
+ * that require it.
+ */
+# define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020L
+# define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040L
+/*
+ * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications
+ * that reconnect with a downgraded protocol version; see
+ * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your
+ * application attempts a normal handshake. Only use this in explicit
+ * fallback retries, following the guidance in
+ * draft-ietf-tls-downgrade-scsv-00.
+ */
+# define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080L
+
+/*
+ * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they
+ * cannot be used to clear bits.
+ */
+
+# define SSL_CTX_set_options(ctx,op) \
+        SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL)
+# define SSL_CTX_clear_options(ctx,op) \
+        SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_OPTIONS,(op),NULL)
+# define SSL_CTX_get_options(ctx) \
+        SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL)
+# define SSL_set_options(ssl,op) \
+        SSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL)
+# define SSL_clear_options(ssl,op) \
+        SSL_ctrl((ssl),SSL_CTRL_CLEAR_OPTIONS,(op),NULL)
+# define SSL_get_options(ssl) \
+        SSL_ctrl((ssl),SSL_CTRL_OPTIONS,0,NULL)
+
+# define SSL_CTX_set_mode(ctx,op) \
+        SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
+# define SSL_CTX_clear_mode(ctx,op) \
+        SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL)
+# define SSL_CTX_get_mode(ctx) \
+        SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL)
+# define SSL_clear_mode(ssl,op) \
+        SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL)
+# define SSL_set_mode(ssl,op) \
+        SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
+# define SSL_get_mode(ssl) \
+        SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL)
+# define SSL_set_mtu(ssl, mtu) \
+        SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL)
+# define DTLS_set_link_mtu(ssl, mtu) \
+        SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL)
+# define DTLS_get_link_min_mtu(ssl) \
+        SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL)
+
+# define SSL_get_secure_renegotiation_support(ssl) \
+        SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL)
+
+# ifndef OPENSSL_NO_HEARTBEATS
+#  define SSL_heartbeat(ssl) \
+        SSL_ctrl((ssl),SSL_CTRL_TLS_EXT_SEND_HEARTBEAT,0,NULL)
+# endif
+
+void SSL_CTX_set_msg_callback(SSL_CTX *ctx,
+                              void (*cb) (int write_p, int version,
+                                          int content_type, const void *buf,
+                                          size_t len, SSL *ssl, void *arg));
+void SSL_set_msg_callback(SSL *ssl,
+                          void (*cb) (int write_p, int version,
+                                      int content_type, const void *buf,
+                                      size_t len, SSL *ssl, void *arg));
+# define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
+# define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
+
+# ifndef OPENSSL_NO_SRP
+
+#  ifndef OPENSSL_NO_SSL_INTERN
+
+typedef struct srp_ctx_st {
+    /* param for all the callbacks */
+    void *SRP_cb_arg;
+    /* set client Hello login callback */
+    int (*TLS_ext_srp_username_callback) (SSL *, int *, void *);
+    /* set SRP N/g param callback for verification */
+    int (*SRP_verify_param_callback) (SSL *, void *);
+    /* set SRP client passwd callback */
+    char *(*SRP_give_srp_client_pwd_callback) (SSL *, void *);
+    char *login;
+    BIGNUM *N, *g, *s, *B, *A;
+    BIGNUM *a, *b, *v;
+    char *info;
+    int strength;
+    unsigned long srp_Mask;
+} SRP_CTX;
+
+#  endif
+
+/* see tls_srp.c */
+int SSL_SRP_CTX_init(SSL *s);
+int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx);
+int SSL_SRP_CTX_free(SSL *ctx);
+int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx);
+int SSL_srp_server_param_with_username(SSL *s, int *ad);
+int SRP_generate_server_master_secret(SSL *s, unsigned char *master_key);
+int SRP_Calc_A_param(SSL *s);
+int SRP_generate_client_master_secret(SSL *s, unsigned char *master_key);
+
+# endif
+
+# if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32)
+#  define SSL_MAX_CERT_LIST_DEFAULT 1024*30
+                                          /* 30k max cert list :-) */
+# else
+#  define SSL_MAX_CERT_LIST_DEFAULT 1024*100
+                                           /* 100k max cert list :-) */
+# endif
+
+# define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT      (1024*20)
+
+/*
+ * This callback type is used inside SSL_CTX, SSL, and in the functions that
+ * set them. It is used to override the generation of SSL/TLS session IDs in
+ * a server. Return value should be zero on an error, non-zero to proceed.
+ * Also, callbacks should themselves check if the id they generate is unique
+ * otherwise the SSL handshake will fail with an error - callbacks can do
+ * this using the 'ssl' value they're passed by;
+ * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in
+ * is set at the maximum size the session ID can be. In SSLv2 this is 16
+ * bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback can alter this
+ * length to be less if desired, but under SSLv2 session IDs are supposed to
+ * be fixed at 16 bytes so the id will be padded after the callback returns
+ * in this case. It is also an error for the callback to set the size to
+ * zero.
+ */
+typedef int (*GEN_SESSION_CB) (const SSL *ssl, unsigned char *id,
+                               unsigned int *id_len);
+
+typedef struct ssl_comp_st SSL_COMP;
+
+# ifndef OPENSSL_NO_SSL_INTERN
+
+struct ssl_comp_st {
+    int id;
+    const char *name;
+#  ifndef OPENSSL_NO_COMP
+    COMP_METHOD *method;
+#  else
+    char *method;
+#  endif
+};
+
+DECLARE_STACK_OF(SSL_COMP)
+DECLARE_LHASH_OF(SSL_SESSION);
+
+struct ssl_ctx_st {
+    const SSL_METHOD *method;
+    STACK_OF(SSL_CIPHER) *cipher_list;
+    /* same as above but sorted for lookup */
+    STACK_OF(SSL_CIPHER) *cipher_list_by_id;
+    struct x509_store_st /* X509_STORE */ *cert_store;
+    LHASH_OF(SSL_SESSION) *sessions;
+    /*
+     * Most session-ids that will be cached, default is
+     * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited.
+     */
+    unsigned long session_cache_size;
+    struct ssl_session_st *session_cache_head;
+    struct ssl_session_st *session_cache_tail;
+    /*
+     * This can have one of 2 values, ored together, SSL_SESS_CACHE_CLIENT,
+     * SSL_SESS_CACHE_SERVER, Default is SSL_SESSION_CACHE_SERVER, which
+     * means only SSL_accept which cache SSL_SESSIONS.
+     */
+    int session_cache_mode;
+    /*
+     * If timeout is not 0, it is the default timeout value set when
+     * SSL_new() is called.  This has been put in to make life easier to set
+     * things up
+     */
+    long session_timeout;
+    /*
+     * If this callback is not null, it will be called each time a session id
+     * is added to the cache.  If this function returns 1, it means that the
+     * callback will do a SSL_SESSION_free() when it has finished using it.
+     * Otherwise, on 0, it means the callback has finished with it. If
+     * remove_session_cb is not null, it will be called when a session-id is
+     * removed from the cache.  After the call, OpenSSL will
+     * SSL_SESSION_free() it.
+     */
+    int (*new_session_cb) (struct ssl_st *ssl, SSL_SESSION *sess);
+    void (*remove_session_cb) (struct ssl_ctx_st *ctx, SSL_SESSION *sess);
+    SSL_SESSION *(*get_session_cb) (struct ssl_st *ssl,
+                                    unsigned char *data, int len, int *copy);
+    struct {
+        int sess_connect;       /* SSL new conn - started */
+        int sess_connect_renegotiate; /* SSL reneg - requested */
+        int sess_connect_good;  /* SSL new conne/reneg - finished */
+        int sess_accept;        /* SSL new accept - started */
+        int sess_accept_renegotiate; /* SSL reneg - requested */
+        int sess_accept_good;   /* SSL accept/reneg - finished */
+        int sess_miss;          /* session lookup misses */
+        int sess_timeout;       /* reuse attempt on timeouted session */
+        int sess_cache_full;    /* session removed due to full cache */
+        int sess_hit;           /* session reuse actually done */
+        int sess_cb_hit;        /* session-id that was not in the cache was
+                                 * passed back via the callback.  This
+                                 * indicates that the application is
+                                 * supplying session-id's from other
+                                 * processes - spooky :-) */
+    } stats;
+
+    int references;
+
+    /* if defined, these override the X509_verify_cert() calls */
+    int (*app_verify_callback) (X509_STORE_CTX *, void *);
+    void *app_verify_arg;
+    /*
+     * before OpenSSL 0.9.7, 'app_verify_arg' was ignored
+     * ('app_verify_callback' was called with just one argument)
+     */
+
+    /* Default password callback. */
+    pem_password_cb *default_passwd_callback;
+
+    /* Default password callback user data. */
+    void *default_passwd_callback_userdata;
+
+    /* get client cert callback */
+    int (*client_cert_cb) (SSL *ssl, X509 **x509, EVP_PKEY **pkey);
+
+    /* cookie generate callback */
+    int (*app_gen_cookie_cb) (SSL *ssl, unsigned char *cookie,
+                              unsigned int *cookie_len);
+
+    /* verify cookie callback */
+    int (*app_verify_cookie_cb) (SSL *ssl, unsigned char *cookie,
+                                 unsigned int cookie_len);
+
+    CRYPTO_EX_DATA ex_data;
+
+    const EVP_MD *rsa_md5;      /* For SSLv2 - name is 'ssl2-md5' */
+    const EVP_MD *md5;          /* For SSLv3/TLSv1 'ssl3-md5' */
+    const EVP_MD *sha1;         /* For SSLv3/TLSv1 'ssl3->sha1' */
+
+    STACK_OF(X509) *extra_certs;
+    STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */
+
+    /* Default values used when no per-SSL value is defined follow */
+
+    /* used if SSL's info_callback is NULL */
+    void (*info_callback) (const SSL *ssl, int type, int val);
+
+    /* what we put in client cert requests */
+    STACK_OF(X509_NAME) *client_CA;
+
+    /*
+     * Default values to use in SSL structures follow (these are copied by
+     * SSL_new)
+     */
+
+    unsigned long options;
+    unsigned long mode;
+    long max_cert_list;
+
+    struct cert_st /* CERT */ *cert;
+    int read_ahead;
+
+    /* callback that allows applications to peek at protocol messages */
+    void (*msg_callback) (int write_p, int version, int content_type,
+                          const void *buf, size_t len, SSL *ssl, void *arg);
+    void *msg_callback_arg;
+
+    int verify_mode;
+    unsigned int sid_ctx_length;
+    unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
+    /* called 'verify_callback' in the SSL */
+    int (*default_verify_callback) (int ok, X509_STORE_CTX *ctx);
+
+    /* Default generate session ID callback. */
+    GEN_SESSION_CB generate_session_id;
+
+    X509_VERIFY_PARAM *param;
+
+#  if 0
+    int purpose;                /* Purpose setting */
+    int trust;                  /* Trust setting */
+#  endif
+
+    int quiet_shutdown;
+
+    /*
+     * Maximum amount of data to send in one fragment. actual record size can
+     * be more than this due to padding and MAC overheads.
+     */
+    unsigned int max_send_fragment;
+
+#  ifndef OPENSSL_NO_ENGINE
+    /*
+     * Engine to pass requests for client certs to
+     */
+    ENGINE *client_cert_engine;
+#  endif
+
+#  ifndef OPENSSL_NO_TLSEXT
+    /* TLS extensions servername callback */
+    int (*tlsext_servername_callback) (SSL *, int *, void *);
+    void *tlsext_servername_arg;
+    /* RFC 4507 session ticket keys */
+    unsigned char tlsext_tick_key_name[16];
+    unsigned char tlsext_tick_hmac_key[16];
+    unsigned char tlsext_tick_aes_key[16];
+    /* Callback to support customisation of ticket key setting */
+    int (*tlsext_ticket_key_cb) (SSL *ssl,
+                                 unsigned char *name, unsigned char *iv,
+                                 EVP_CIPHER_CTX *ectx,
+                                 HMAC_CTX *hctx, int enc);
+
+    /* certificate status request info */
+    /* Callback for status request */
+    int (*tlsext_status_cb) (SSL *ssl, void *arg);
+    void *tlsext_status_arg;
+
+    /* draft-rescorla-tls-opaque-prf-input-00.txt information */
+    int (*tlsext_opaque_prf_input_callback) (SSL *, void *peerinput,
+                                             size_t len, void *arg);
+    void *tlsext_opaque_prf_input_callback_arg;
+#  endif
+
+#  ifndef OPENSSL_NO_PSK
+    char *psk_identity_hint;
+    unsigned int (*psk_client_callback) (SSL *ssl, const char *hint,
+                                         char *identity,
+                                         unsigned int max_identity_len,
+                                         unsigned char *psk,
+                                         unsigned int max_psk_len);
+    unsigned int (*psk_server_callback) (SSL *ssl, const char *identity,
+                                         unsigned char *psk,
+                                         unsigned int max_psk_len);
+#  endif
+
+#  ifndef OPENSSL_NO_BUF_FREELISTS
+#   define SSL_MAX_BUF_FREELIST_LEN_DEFAULT 32
+    unsigned int freelist_max_len;
+    struct ssl3_buf_freelist_st *wbuf_freelist;
+    struct ssl3_buf_freelist_st *rbuf_freelist;
+#  endif
+#  ifndef OPENSSL_NO_SRP
+    SRP_CTX srp_ctx;            /* ctx for SRP authentication */
+#  endif
+
+#  ifndef OPENSSL_NO_TLSEXT
+
+#   ifndef OPENSSL_NO_NEXTPROTONEG
+    /* Next protocol negotiation information */
+    /* (for experimental NPN extension). */
+
+    /*
+     * For a server, this contains a callback function by which the set of
+     * advertised protocols can be provided.
+     */
+    int (*next_protos_advertised_cb) (SSL *s, const unsigned char **buf,
+                                      unsigned int *len, void *arg);
+    void *next_protos_advertised_cb_arg;
+    /*
+     * For a client, this contains a callback function that selects the next
+     * protocol from the list provided by the server.
+     */
+    int (*next_proto_select_cb) (SSL *s, unsigned char **out,
+                                 unsigned char *outlen,
+                                 const unsigned char *in,
+                                 unsigned int inlen, void *arg);
+    void *next_proto_select_cb_arg;
+#   endif
+    /* SRTP profiles we are willing to do from RFC 5764 */
+    STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;
+#  endif
+};
+
+# endif
+
+# define SSL_SESS_CACHE_OFF                      0x0000
+# define SSL_SESS_CACHE_CLIENT                   0x0001
+# define SSL_SESS_CACHE_SERVER                   0x0002
+# define SSL_SESS_CACHE_BOTH     (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER)
+# define SSL_SESS_CACHE_NO_AUTO_CLEAR            0x0080
+/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */
+# define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP       0x0100
+# define SSL_SESS_CACHE_NO_INTERNAL_STORE        0x0200
+# define SSL_SESS_CACHE_NO_INTERNAL \
+        (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE)
+
+LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx);
+# define SSL_CTX_sess_number(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL)
+# define SSL_CTX_sess_connect(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL)
+# define SSL_CTX_sess_connect_good(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL)
+# define SSL_CTX_sess_connect_renegotiate(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL)
+# define SSL_CTX_sess_accept(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL)
+# define SSL_CTX_sess_accept_renegotiate(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL)
+# define SSL_CTX_sess_accept_good(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL)
+# define SSL_CTX_sess_hits(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL)
+# define SSL_CTX_sess_cb_hits(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL)
+# define SSL_CTX_sess_misses(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL)
+# define SSL_CTX_sess_timeouts(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL)
+# define SSL_CTX_sess_cache_full(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL)
+
+void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,
+                             int (*new_session_cb) (struct ssl_st *ssl,
+                                                    SSL_SESSION *sess));
+int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl,
+                                              SSL_SESSION *sess);
+void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx,
+                                void (*remove_session_cb) (struct ssl_ctx_st
+                                                           *ctx,
+                                                           SSL_SESSION
+                                                           *sess));
+void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx,
+                                                  SSL_SESSION *sess);
+void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
+                             SSL_SESSION *(*get_session_cb) (struct ssl_st
+                                                             *ssl,
+                                                             unsigned char
+                                                             *data, int len,
+                                                             int *copy));
+SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl,
+                                                       unsigned char *Data,
+                                                       int len, int *copy);
+void SSL_CTX_set_info_callback(SSL_CTX *ctx,
+                               void (*cb) (const SSL *ssl, int type,
+                                           int val));
+void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type,
+                                                 int val);
+void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx,
+                                int (*client_cert_cb) (SSL *ssl, X509 **x509,
+                                                       EVP_PKEY **pkey));
+int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509,
+                                                 EVP_PKEY **pkey);
+# ifndef OPENSSL_NO_ENGINE
+int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e);
+# endif
+void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,
+                                    int (*app_gen_cookie_cb) (SSL *ssl,
+                                                              unsigned char
+                                                              *cookie,
+                                                              unsigned int
+                                                              *cookie_len));
+void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
+                                  int (*app_verify_cookie_cb) (SSL *ssl,
+                                                               unsigned char
+                                                               *cookie,
+                                                               unsigned int
+                                                               cookie_len));
+# ifndef OPENSSL_NO_NEXTPROTONEG
+void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s,
+                                           int (*cb) (SSL *ssl,
+                                                      const unsigned char
+                                                      **out,
+                                                      unsigned int *outlen,
+                                                      void *arg), void *arg);
+void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s,
+                                      int (*cb) (SSL *ssl,
+                                                 unsigned char **out,
+                                                 unsigned char *outlen,
+                                                 const unsigned char *in,
+                                                 unsigned int inlen,
+                                                 void *arg), void *arg);
+
+int SSL_select_next_proto(unsigned char **out, unsigned char *outlen,
+                          const unsigned char *in, unsigned int inlen,
+                          const unsigned char *client,
+                          unsigned int client_len);
+void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,
+                                    unsigned *len);
+
+#  define OPENSSL_NPN_UNSUPPORTED 0
+#  define OPENSSL_NPN_NEGOTIATED  1
+#  define OPENSSL_NPN_NO_OVERLAP  2
+# endif
+
+# ifndef OPENSSL_NO_PSK
+/*
+ * the maximum length of the buffer given to callbacks containing the
+ * resulting identity/psk
+ */
+#  define PSK_MAX_IDENTITY_LEN 128
+#  define PSK_MAX_PSK_LEN 256
+void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx,
+                                     unsigned int (*psk_client_callback) (SSL
+                                                                          *ssl,
+                                                                          const
+                                                                          char
+                                                                          *hint,
+                                                                          char
+                                                                          *identity,
+                                                                          unsigned
+                                                                          int
+                                                                          max_identity_len,
+                                                                          unsigned
+                                                                          char
+                                                                          *psk,
+                                                                          unsigned
+                                                                          int
+                                                                          max_psk_len));
+void SSL_set_psk_client_callback(SSL *ssl,
+                                 unsigned int (*psk_client_callback) (SSL
+                                                                      *ssl,
+                                                                      const
+                                                                      char
+                                                                      *hint,
+                                                                      char
+                                                                      *identity,
+                                                                      unsigned
+                                                                      int
+                                                                      max_identity_len,
+                                                                      unsigned
+                                                                      char
+                                                                      *psk,
+                                                                      unsigned
+                                                                      int
+                                                                      max_psk_len));
+void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx,
+                                     unsigned int (*psk_server_callback) (SSL
+                                                                          *ssl,
+                                                                          const
+                                                                          char
+                                                                          *identity,
+                                                                          unsigned
+                                                                          char
+                                                                          *psk,
+                                                                          unsigned
+                                                                          int
+                                                                          max_psk_len));
+void SSL_set_psk_server_callback(SSL *ssl,
+                                 unsigned int (*psk_server_callback) (SSL
+                                                                      *ssl,
+                                                                      const
+                                                                      char
+                                                                      *identity,
+                                                                      unsigned
+                                                                      char
+                                                                      *psk,
+                                                                      unsigned
+                                                                      int
+                                                                      max_psk_len));
+int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint);
+int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint);
+const char *SSL_get_psk_identity_hint(const SSL *s);
+const char *SSL_get_psk_identity(const SSL *s);
+# endif
+
+# define SSL_NOTHING     1
+# define SSL_WRITING     2
+# define SSL_READING     3
+# define SSL_X509_LOOKUP 4
+
+/* These will only be used when doing non-blocking IO */
+# define SSL_want_nothing(s)     (SSL_want(s) == SSL_NOTHING)
+# define SSL_want_read(s)        (SSL_want(s) == SSL_READING)
+# define SSL_want_write(s)       (SSL_want(s) == SSL_WRITING)
+# define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP)
+
+# define SSL_MAC_FLAG_READ_MAC_STREAM 1
+# define SSL_MAC_FLAG_WRITE_MAC_STREAM 2
+
+# ifndef OPENSSL_NO_SSL_INTERN
+
+struct ssl_st {
+    /*
+     * protocol version (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION,
+     * DTLS1_VERSION)
+     */
+    int version;
+    /* SSL_ST_CONNECT or SSL_ST_ACCEPT */
+    int type;
+    /* SSLv3 */
+    const SSL_METHOD *method;
+    /*
+     * There are 2 BIO's even though they are normally both the same.  This
+     * is so data can be read and written to different handlers
+     */
+#  ifndef OPENSSL_NO_BIO
+    /* used by SSL_read */
+    BIO *rbio;
+    /* used by SSL_write */
+    BIO *wbio;
+    /* used during session-id reuse to concatenate messages */
+    BIO *bbio;
+#  else
+    /* used by SSL_read */
+    char *rbio;
+    /* used by SSL_write */
+    char *wbio;
+    char *bbio;
+#  endif
+    /*
+     * This holds a variable that indicates what we were doing when a 0 or -1
+     * is returned.  This is needed for non-blocking IO so we know what
+     * request needs re-doing when in SSL_accept or SSL_connect
+     */
+    int rwstate;
+    /* true when we are actually in SSL_accept() or SSL_connect() */
+    int in_handshake;
+    int (*handshake_func) (SSL *);
+    /*
+     * Imagine that here's a boolean member "init" that is switched as soon
+     * as SSL_set_{accept/connect}_state is called for the first time, so
+     * that "state" and "handshake_func" are properly initialized.  But as
+     * handshake_func is == 0 until then, we use this test instead of an
+     * "init" member.
+     */
+    /* are we the server side? - mostly used by SSL_clear */
+    int server;
+    /*
+     * Generate a new session or reuse an old one.
+     * NB: For servers, the 'new' session may actually be a previously
+     * cached session or even the previous session unless
+     * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set
+     */
+    int new_session;
+    /* don't send shutdown packets */
+    int quiet_shutdown;
+    /* we have shut things down, 0x01 sent, 0x02 for received */
+    int shutdown;
+    /* where we are */
+    int state;
+    /* where we are when reading */
+    int rstate;
+    BUF_MEM *init_buf;          /* buffer used during init */
+    void *init_msg;             /* pointer to handshake message body, set by
+                                 * ssl3_get_message() */
+    int init_num;               /* amount read/written */
+    int init_off;               /* amount read/written */
+    /* used internally to point at a raw packet */
+    unsigned char *packet;
+    unsigned int packet_length;
+    struct ssl2_state_st *s2;   /* SSLv2 variables */
+    struct ssl3_state_st *s3;   /* SSLv3 variables */
+    struct dtls1_state_st *d1;  /* DTLSv1 variables */
+    int read_ahead;             /* Read as many input bytes as possible (for
+                                 * non-blocking reads) */
+    /* callback that allows applications to peek at protocol messages */
+    void (*msg_callback) (int write_p, int version, int content_type,
+                          const void *buf, size_t len, SSL *ssl, void *arg);
+    void *msg_callback_arg;
+    int hit;                    /* reusing a previous session */
+    X509_VERIFY_PARAM *param;
+#  if 0
+    int purpose;                /* Purpose setting */
+    int trust;                  /* Trust setting */
+#  endif
+    /* crypto */
+    STACK_OF(SSL_CIPHER) *cipher_list;
+    STACK_OF(SSL_CIPHER) *cipher_list_by_id;
+    /*
+     * These are the ones being used, the ones in SSL_SESSION are the ones to
+     * be 'copied' into these ones
+     */
+    int mac_flags;
+    EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */
+    EVP_MD_CTX *read_hash;      /* used for mac generation */
+#  ifndef OPENSSL_NO_COMP
+    COMP_CTX *expand;           /* uncompress */
+#  else
+    char *expand;
+#  endif
+    EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
+    EVP_MD_CTX *write_hash;     /* used for mac generation */
+#  ifndef OPENSSL_NO_COMP
+    COMP_CTX *compress;         /* compression */
+#  else
+    char *compress;
+#  endif
+    /* session info */
+    /* client cert? */
+    /* This is used to hold the server certificate used */
+    struct cert_st /* CERT */ *cert;
+    /*
+     * the session_id_context is used to ensure sessions are only reused in
+     * the appropriate context
+     */
+    unsigned int sid_ctx_length;
+    unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
+    /* This can also be in the session once a session is established */
+    SSL_SESSION *session;
+    /* Default generate session ID callback. */
+    GEN_SESSION_CB generate_session_id;
+    /* Used in SSL2 and SSL3 */
+    /*
+     * 0 don't care about verify failure.
+     * 1 fail if verify fails
+     */
+    int verify_mode;
+    /* fail if callback returns 0 */
+    int (*verify_callback) (int ok, X509_STORE_CTX *ctx);
+    /* optional informational callback */
+    void (*info_callback) (const SSL *ssl, int type, int val);
+    /* error bytes to be written */
+    int error;
+    /* actual code */
+    int error_code;
+#  ifndef OPENSSL_NO_KRB5
+    /* Kerberos 5 context */
+    KSSL_CTX *kssl_ctx;
+#  endif                        /* OPENSSL_NO_KRB5 */
+#  ifndef OPENSSL_NO_PSK
+    unsigned int (*psk_client_callback) (SSL *ssl, const char *hint,
+                                         char *identity,
+                                         unsigned int max_identity_len,
+                                         unsigned char *psk,
+                                         unsigned int max_psk_len);
+    unsigned int (*psk_server_callback) (SSL *ssl, const char *identity,
+                                         unsigned char *psk,
+                                         unsigned int max_psk_len);
+#  endif
+    SSL_CTX *ctx;
+    /*
+     * set this flag to 1 and a sleep(1) is put into all SSL_read() and
+     * SSL_write() calls, good for nbio debuging :-)
+     */
+    int debug;
+    /* extra application data */
+    long verify_result;
+    CRYPTO_EX_DATA ex_data;
+    /* for server side, keep the list of CA_dn we can use */
+    STACK_OF(X509_NAME) *client_CA;
+    int references;
+    /* protocol behaviour */
+    unsigned long options;
+    /* API behaviour */
+    unsigned long mode;
+    long max_cert_list;
+    int first_packet;
+    /* what was passed, used for SSLv3/TLS rollback check */
+    int client_version;
+    unsigned int max_send_fragment;
+#  ifndef OPENSSL_NO_TLSEXT
+    /* TLS extension debug callback */
+    void (*tlsext_debug_cb) (SSL *s, int client_server, int type,
+                             unsigned char *data, int len, void *arg);
+    void *tlsext_debug_arg;
+    char *tlsext_hostname;
+    /*-
+     * no further mod of servername
+     * 0 : call the servername extension callback.
+     * 1 : prepare 2, allow last ack just after in server callback.
+     * 2 : don't call servername callback, no ack in server hello
+     */
+    int servername_done;
+    /* certificate status request info */
+    /* Status type or -1 if no status type */
+    int tlsext_status_type;
+    /* Expect OCSP CertificateStatus message */
+    int tlsext_status_expected;
+    /* OCSP status request only */
+    STACK_OF(OCSP_RESPID) *tlsext_ocsp_ids;
+    X509_EXTENSIONS *tlsext_ocsp_exts;
+    /* OCSP response received or to be sent */
+    unsigned char *tlsext_ocsp_resp;
+    int tlsext_ocsp_resplen;
+    /* RFC4507 session ticket expected to be received or sent */
+    int tlsext_ticket_expected;
+#   ifndef OPENSSL_NO_EC
+    size_t tlsext_ecpointformatlist_length;
+    /* our list */
+    unsigned char *tlsext_ecpointformatlist;
+    size_t tlsext_ellipticcurvelist_length;
+    /* our list */
+    unsigned char *tlsext_ellipticcurvelist;
+#   endif                       /* OPENSSL_NO_EC */
+    /*
+     * draft-rescorla-tls-opaque-prf-input-00.txt information to be used for
+     * handshakes
+     */
+    void *tlsext_opaque_prf_input;
+    size_t tlsext_opaque_prf_input_len;
+    /* TLS Session Ticket extension override */
+    TLS_SESSION_TICKET_EXT *tlsext_session_ticket;
+    /* TLS Session Ticket extension callback */
+    tls_session_ticket_ext_cb_fn tls_session_ticket_ext_cb;
+    void *tls_session_ticket_ext_cb_arg;
+    /* TLS pre-shared secret session resumption */
+    tls_session_secret_cb_fn tls_session_secret_cb;
+    void *tls_session_secret_cb_arg;
+    SSL_CTX *initial_ctx;       /* initial ctx, used to store sessions */
+#   ifndef OPENSSL_NO_NEXTPROTONEG
+    /*
+     * Next protocol negotiation. For the client, this is the protocol that
+     * we sent in NextProtocol and is set when handling ServerHello
+     * extensions. For a server, this is the client's selected_protocol from
+     * NextProtocol and is set when handling the NextProtocol message, before
+     * the Finished message.
+     */
+    unsigned char *next_proto_negotiated;
+    unsigned char next_proto_negotiated_len;
+#   endif
+#   define session_ctx initial_ctx
+    /* What we'll do */
+    STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;
+    /* What's been chosen */
+    SRTP_PROTECTION_PROFILE *srtp_profile;
+        /*-
+         * Is use of the Heartbeat extension negotiated?
+         * 0: disabled
+         * 1: enabled
+         * 2: enabled, but not allowed to send Requests
+         */
+    unsigned int tlsext_heartbeat;
+    /* Indicates if a HeartbeatRequest is in flight */
+    unsigned int tlsext_hb_pending;
+    /* HeartbeatRequest sequence number */
+    unsigned int tlsext_hb_seq;
+#  else
+#   define session_ctx ctx
+#  endif                        /* OPENSSL_NO_TLSEXT */
+    /*-
+     * 1 if we are renegotiating.
+     * 2 if we are a server and are inside a handshake
+     * (i.e. not just sending a HelloRequest)
+     */
+    int renegotiate;
+#  ifndef OPENSSL_NO_SRP
+    /* ctx for SRP authentication */
+    SRP_CTX srp_ctx;
+#  endif
+};
+
+# endif
+
+#ifdef __cplusplus
+}
+#endif
+
+# include <openssl/ssl2.h>
+# include <openssl/ssl3.h>
+# include <openssl/tls1.h>      /* This is mostly sslv3 with a few tweaks */
+# include <openssl/dtls1.h>     /* Datagram TLS */
+# include <openssl/ssl23.h>
+# include <openssl/srtp.h>      /* Support for the use_srtp extension */
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* compatibility */
+# define SSL_set_app_data(s,arg)         (SSL_set_ex_data(s,0,(char *)arg))
+# define SSL_get_app_data(s)             (SSL_get_ex_data(s,0))
+# define SSL_SESSION_set_app_data(s,a)   (SSL_SESSION_set_ex_data(s,0,(char *)a))
+# define SSL_SESSION_get_app_data(s)     (SSL_SESSION_get_ex_data(s,0))
+# define SSL_CTX_get_app_data(ctx)       (SSL_CTX_get_ex_data(ctx,0))
+# define SSL_CTX_set_app_data(ctx,arg)   (SSL_CTX_set_ex_data(ctx,0,(char *)arg))
+
+/*
+ * The following are the possible values for ssl->state are are used to
+ * indicate where we are up to in the SSL connection establishment. The
+ * macros that follow are about the only things you should need to use and
+ * even then, only when using non-blocking IO. It can also be useful to work
+ * out where you were when the connection failed
+ */
+
+# define SSL_ST_CONNECT                  0x1000
+# define SSL_ST_ACCEPT                   0x2000
+# define SSL_ST_MASK                     0x0FFF
+# define SSL_ST_INIT                     (SSL_ST_CONNECT|SSL_ST_ACCEPT)
+# define SSL_ST_BEFORE                   0x4000
+# define SSL_ST_OK                       0x03
+# define SSL_ST_RENEGOTIATE              (0x04|SSL_ST_INIT)
+# define SSL_ST_ERR                      0x05
+
+# define SSL_CB_LOOP                     0x01
+# define SSL_CB_EXIT                     0x02
+# define SSL_CB_READ                     0x04
+# define SSL_CB_WRITE                    0x08
+# define SSL_CB_ALERT                    0x4000/* used in callback */
+# define SSL_CB_READ_ALERT               (SSL_CB_ALERT|SSL_CB_READ)
+# define SSL_CB_WRITE_ALERT              (SSL_CB_ALERT|SSL_CB_WRITE)
+# define SSL_CB_ACCEPT_LOOP              (SSL_ST_ACCEPT|SSL_CB_LOOP)
+# define SSL_CB_ACCEPT_EXIT              (SSL_ST_ACCEPT|SSL_CB_EXIT)
+# define SSL_CB_CONNECT_LOOP             (SSL_ST_CONNECT|SSL_CB_LOOP)
+# define SSL_CB_CONNECT_EXIT             (SSL_ST_CONNECT|SSL_CB_EXIT)
+# define SSL_CB_HANDSHAKE_START          0x10
+# define SSL_CB_HANDSHAKE_DONE           0x20
+
+/* Is the SSL_connection established? */
+# define SSL_get_state(a)                SSL_state(a)
+# define SSL_is_init_finished(a)         (SSL_state(a) == SSL_ST_OK)
+# define SSL_in_init(a)                  (SSL_state(a)&SSL_ST_INIT)
+# define SSL_in_before(a)                (SSL_state(a)&SSL_ST_BEFORE)
+# define SSL_in_connect_init(a)          (SSL_state(a)&SSL_ST_CONNECT)
+# define SSL_in_accept_init(a)           (SSL_state(a)&SSL_ST_ACCEPT)
+
+/*
+ * The following 2 states are kept in ssl->rstate when reads fail, you should
+ * not need these
+ */
+# define SSL_ST_READ_HEADER                      0xF0
+# define SSL_ST_READ_BODY                        0xF1
+# define SSL_ST_READ_DONE                        0xF2
+
+/*-
+ * Obtain latest Finished message
+ *   -- that we sent (SSL_get_finished)
+ *   -- that we expected from peer (SSL_get_peer_finished).
+ * Returns length (0 == no Finished so far), copies up to 'count' bytes.
+ */
+size_t SSL_get_finished(const SSL *s, void *buf, size_t count);
+size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count);
+
+/*
+ * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options are
+ * 'ored' with SSL_VERIFY_PEER if they are desired
+ */
+# define SSL_VERIFY_NONE                 0x00
+# define SSL_VERIFY_PEER                 0x01
+# define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02
+# define SSL_VERIFY_CLIENT_ONCE          0x04
+
+# define OpenSSL_add_ssl_algorithms()    SSL_library_init()
+# define SSLeay_add_ssl_algorithms()     SSL_library_init()
+
+/* this is for backward compatibility */
+# if 0                          /* NEW_SSLEAY */
+#  define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c)
+#  define SSL_set_pref_cipher(c,n)        SSL_set_cipher_list(c,n)
+#  define SSL_add_session(a,b)            SSL_CTX_add_session((a),(b))
+#  define SSL_remove_session(a,b)         SSL_CTX_remove_session((a),(b))
+#  define SSL_flush_sessions(a,b)         SSL_CTX_flush_sessions((a),(b))
+# endif
+/* More backward compatibility */
+# define SSL_get_cipher(s) \
+                SSL_CIPHER_get_name(SSL_get_current_cipher(s))
+# define SSL_get_cipher_bits(s,np) \
+                SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np)
+# define SSL_get_cipher_version(s) \
+                SSL_CIPHER_get_version(SSL_get_current_cipher(s))
+# define SSL_get_cipher_name(s) \
+                SSL_CIPHER_get_name(SSL_get_current_cipher(s))
+# define SSL_get_time(a)         SSL_SESSION_get_time(a)
+# define SSL_set_time(a,b)       SSL_SESSION_set_time((a),(b))
+# define SSL_get_timeout(a)      SSL_SESSION_get_timeout(a)
+# define SSL_set_timeout(a,b)    SSL_SESSION_set_timeout((a),(b))
+
+# define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id)
+# define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id)
+
+DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
+# define SSL_AD_REASON_OFFSET            1000/* offset to get SSL_R_... value
+                                              * from SSL_AD_... */
+/* These alert types are for SSLv3 and TLSv1 */
+# define SSL_AD_CLOSE_NOTIFY             SSL3_AD_CLOSE_NOTIFY
+/* fatal */
+# define SSL_AD_UNEXPECTED_MESSAGE       SSL3_AD_UNEXPECTED_MESSAGE
+/* fatal */
+# define SSL_AD_BAD_RECORD_MAC           SSL3_AD_BAD_RECORD_MAC
+# define SSL_AD_DECRYPTION_FAILED        TLS1_AD_DECRYPTION_FAILED
+# define SSL_AD_RECORD_OVERFLOW          TLS1_AD_RECORD_OVERFLOW
+/* fatal */
+# define SSL_AD_DECOMPRESSION_FAILURE    SSL3_AD_DECOMPRESSION_FAILURE
+/* fatal */
+# define SSL_AD_HANDSHAKE_FAILURE        SSL3_AD_HANDSHAKE_FAILURE
+/* Not for TLS */
+# define SSL_AD_NO_CERTIFICATE           SSL3_AD_NO_CERTIFICATE
+# define SSL_AD_BAD_CERTIFICATE          SSL3_AD_BAD_CERTIFICATE
+# define SSL_AD_UNSUPPORTED_CERTIFICATE  SSL3_AD_UNSUPPORTED_CERTIFICATE
+# define SSL_AD_CERTIFICATE_REVOKED      SSL3_AD_CERTIFICATE_REVOKED
+# define SSL_AD_CERTIFICATE_EXPIRED      SSL3_AD_CERTIFICATE_EXPIRED
+# define SSL_AD_CERTIFICATE_UNKNOWN      SSL3_AD_CERTIFICATE_UNKNOWN
+/* fatal */
+# define SSL_AD_ILLEGAL_PARAMETER        SSL3_AD_ILLEGAL_PARAMETER
+/* fatal */
+# define SSL_AD_UNKNOWN_CA               TLS1_AD_UNKNOWN_CA
+/* fatal */
+# define SSL_AD_ACCESS_DENIED            TLS1_AD_ACCESS_DENIED
+/* fatal */
+# define SSL_AD_DECODE_ERROR             TLS1_AD_DECODE_ERROR
+# define SSL_AD_DECRYPT_ERROR            TLS1_AD_DECRYPT_ERROR
+/* fatal */
+# define SSL_AD_EXPORT_RESTRICTION       TLS1_AD_EXPORT_RESTRICTION
+/* fatal */
+# define SSL_AD_PROTOCOL_VERSION         TLS1_AD_PROTOCOL_VERSION
+/* fatal */
+# define SSL_AD_INSUFFICIENT_SECURITY    TLS1_AD_INSUFFICIENT_SECURITY
+/* fatal */
+# define SSL_AD_INTERNAL_ERROR           TLS1_AD_INTERNAL_ERROR
+# define SSL_AD_USER_CANCELLED           TLS1_AD_USER_CANCELLED
+# define SSL_AD_NO_RENEGOTIATION         TLS1_AD_NO_RENEGOTIATION
+# define SSL_AD_UNSUPPORTED_EXTENSION    TLS1_AD_UNSUPPORTED_EXTENSION
+# define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE
+# define SSL_AD_UNRECOGNIZED_NAME        TLS1_AD_UNRECOGNIZED_NAME
+# define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE
+# define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE
+/* fatal */
+# define SSL_AD_UNKNOWN_PSK_IDENTITY     TLS1_AD_UNKNOWN_PSK_IDENTITY
+/* fatal */
+# define SSL_AD_INAPPROPRIATE_FALLBACK   TLS1_AD_INAPPROPRIATE_FALLBACK
+# define SSL_ERROR_NONE                  0
+# define SSL_ERROR_SSL                   1
+# define SSL_ERROR_WANT_READ             2
+# define SSL_ERROR_WANT_WRITE            3
+# define SSL_ERROR_WANT_X509_LOOKUP      4
+# define SSL_ERROR_SYSCALL               5/* look at error stack/return
+                                           * value/errno */
+# define SSL_ERROR_ZERO_RETURN           6
+# define SSL_ERROR_WANT_CONNECT          7
+# define SSL_ERROR_WANT_ACCEPT           8
+# define SSL_CTRL_NEED_TMP_RSA                   1
+# define SSL_CTRL_SET_TMP_RSA                    2
+# define SSL_CTRL_SET_TMP_DH                     3
+# define SSL_CTRL_SET_TMP_ECDH                   4
+# define SSL_CTRL_SET_TMP_RSA_CB                 5
+# define SSL_CTRL_SET_TMP_DH_CB                  6
+# define SSL_CTRL_SET_TMP_ECDH_CB                7
+# define SSL_CTRL_GET_SESSION_REUSED             8
+# define SSL_CTRL_GET_CLIENT_CERT_REQUEST        9
+# define SSL_CTRL_GET_NUM_RENEGOTIATIONS         10
+# define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS       11
+# define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS       12
+# define SSL_CTRL_GET_FLAGS                      13
+# define SSL_CTRL_EXTRA_CHAIN_CERT               14
+# define SSL_CTRL_SET_MSG_CALLBACK               15
+# define SSL_CTRL_SET_MSG_CALLBACK_ARG           16
+/* only applies to datagram connections */
+# define SSL_CTRL_SET_MTU                17
+/* Stats */
+# define SSL_CTRL_SESS_NUMBER                    20
+# define SSL_CTRL_SESS_CONNECT                   21
+# define SSL_CTRL_SESS_CONNECT_GOOD              22
+# define SSL_CTRL_SESS_CONNECT_RENEGOTIATE       23
+# define SSL_CTRL_SESS_ACCEPT                    24
+# define SSL_CTRL_SESS_ACCEPT_GOOD               25
+# define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE        26
+# define SSL_CTRL_SESS_HIT                       27
+# define SSL_CTRL_SESS_CB_HIT                    28
+# define SSL_CTRL_SESS_MISSES                    29
+# define SSL_CTRL_SESS_TIMEOUTS                  30
+# define SSL_CTRL_SESS_CACHE_FULL                31
+# define SSL_CTRL_OPTIONS                        32
+# define SSL_CTRL_MODE                           33
+# define SSL_CTRL_GET_READ_AHEAD                 40
+# define SSL_CTRL_SET_READ_AHEAD                 41
+# define SSL_CTRL_SET_SESS_CACHE_SIZE            42
+# define SSL_CTRL_GET_SESS_CACHE_SIZE            43
+# define SSL_CTRL_SET_SESS_CACHE_MODE            44
+# define SSL_CTRL_GET_SESS_CACHE_MODE            45
+# define SSL_CTRL_GET_MAX_CERT_LIST              50
+# define SSL_CTRL_SET_MAX_CERT_LIST              51
+# define SSL_CTRL_SET_MAX_SEND_FRAGMENT          52
+/* see tls1.h for macros based on these */
+# ifndef OPENSSL_NO_TLSEXT
+#  define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB       53
+#  define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG      54
+#  define SSL_CTRL_SET_TLSEXT_HOSTNAME            55
+#  define SSL_CTRL_SET_TLSEXT_DEBUG_CB            56
+#  define SSL_CTRL_SET_TLSEXT_DEBUG_ARG           57
+#  define SSL_CTRL_GET_TLSEXT_TICKET_KEYS         58
+#  define SSL_CTRL_SET_TLSEXT_TICKET_KEYS         59
+#  define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT    60
+#  define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61
+#  define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62
+#  define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB       63
+#  define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG   64
+#  define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE     65
+#  define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS     66
+#  define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS     67
+#  define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS      68
+#  define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS      69
+#  define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP        70
+#  define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP        71
+#  define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB       72
+#  define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB    75
+#  define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB                76
+#  define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB             77
+#  define SSL_CTRL_SET_SRP_ARG            78
+#  define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME               79
+#  define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH               80
+#  define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD               81
+#  ifndef OPENSSL_NO_HEARTBEATS
+#   define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT                         85
+#   define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING          86
+#   define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS      87
+#  endif
+# endif
+# define DTLS_CTRL_GET_TIMEOUT           73
+# define DTLS_CTRL_HANDLE_TIMEOUT        74
+# define DTLS_CTRL_LISTEN                        75
+# define SSL_CTRL_GET_RI_SUPPORT                 76
+# define SSL_CTRL_CLEAR_OPTIONS                  77
+# define SSL_CTRL_CLEAR_MODE                     78
+# define SSL_CTRL_GET_EXTRA_CHAIN_CERTS          82
+# define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS        83
+# define SSL_CTRL_CHECK_PROTO_VERSION            119
+# define DTLS_CTRL_SET_LINK_MTU                  120
+# define DTLS_CTRL_GET_LINK_MIN_MTU              121
+# define DTLSv1_get_timeout(ssl, arg) \
+        SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)arg)
+# define DTLSv1_handle_timeout(ssl) \
+        SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL)
+# define DTLSv1_listen(ssl, peer) \
+        SSL_ctrl(ssl,DTLS_CTRL_LISTEN,0, (void *)peer)
+# define SSL_session_reused(ssl) \
+        SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL)
+# define SSL_num_renegotiations(ssl) \
+        SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL)
+# define SSL_clear_num_renegotiations(ssl) \
+        SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL)
+# define SSL_total_renegotiations(ssl) \
+        SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL)
+# define SSL_CTX_need_tmp_RSA(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL)
+# define SSL_CTX_set_tmp_rsa(ctx,rsa) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)
+# define SSL_CTX_set_tmp_dh(ctx,dh) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh)
+# define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)
+# define SSL_need_tmp_RSA(ssl) \
+        SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL)
+# define SSL_set_tmp_rsa(ssl,rsa) \
+        SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)
+# define SSL_set_tmp_dh(ssl,dh) \
+        SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh)
+# define SSL_set_tmp_ecdh(ssl,ecdh) \
+        SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)
+# define SSL_CTX_add_extra_chain_cert(ctx,x509) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)
+# define SSL_CTX_get_extra_chain_certs(ctx,px509) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509)
+# define SSL_CTX_clear_extra_chain_certs(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL)
+# ifndef OPENSSL_NO_BIO
+BIO_METHOD *BIO_f_ssl(void);
+BIO *BIO_new_ssl(SSL_CTX *ctx, int client);
+BIO *BIO_new_ssl_connect(SSL_CTX *ctx);
+BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx);
+int BIO_ssl_copy_session_id(BIO *to, BIO *from);
+void BIO_ssl_shutdown(BIO *ssl_bio);
+
+# endif
+
+int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str);
+SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
+void SSL_CTX_free(SSL_CTX *);
+long SSL_CTX_set_timeout(SSL_CTX *ctx, long t);
+long SSL_CTX_get_timeout(const SSL_CTX *ctx);
+X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);
+void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *);
+int SSL_want(const SSL *s);
+int SSL_clear(SSL *s);
+
+void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm);
+
+const SSL_CIPHER *SSL_get_current_cipher(const SSL *s);
+int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits);
+char *SSL_CIPHER_get_version(const SSL_CIPHER *c);
+const char *SSL_CIPHER_get_name(const SSL_CIPHER *c);
+unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c);
+
+int SSL_get_fd(const SSL *s);
+int SSL_get_rfd(const SSL *s);
+int SSL_get_wfd(const SSL *s);
+const char *SSL_get_cipher_list(const SSL *s, int n);
+char *SSL_get_shared_ciphers(const SSL *s, char *buf, int len);
+int SSL_get_read_ahead(const SSL *s);
+int SSL_pending(const SSL *s);
+# ifndef OPENSSL_NO_SOCK
+int SSL_set_fd(SSL *s, int fd);
+int SSL_set_rfd(SSL *s, int fd);
+int SSL_set_wfd(SSL *s, int fd);
+# endif
+# ifndef OPENSSL_NO_BIO
+void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio);
+BIO *SSL_get_rbio(const SSL *s);
+BIO *SSL_get_wbio(const SSL *s);
+# endif
+int SSL_set_cipher_list(SSL *s, const char *str);
+void SSL_set_read_ahead(SSL *s, int yes);
+int SSL_get_verify_mode(const SSL *s);
+int SSL_get_verify_depth(const SSL *s);
+int (*SSL_get_verify_callback(const SSL *s)) (int, X509_STORE_CTX *);
+void SSL_set_verify(SSL *s, int mode,
+                    int (*callback) (int ok, X509_STORE_CTX *ctx));
+void SSL_set_verify_depth(SSL *s, int depth);
+# ifndef OPENSSL_NO_RSA
+int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
+# endif
+int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);
+int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
+int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d,
+                            long len);
+int SSL_use_certificate(SSL *ssl, X509 *x);
+int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);
+
+# ifndef OPENSSL_NO_STDIO
+int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);
+int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type);
+int SSL_use_certificate_file(SSL *ssl, const char *file, int type);
+int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type);
+int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type);
+int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);
+/* PEM type */
+int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file);
+STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
+int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
+                                        const char *file);
+#  ifndef OPENSSL_SYS_VMS
+/* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */
+#   ifndef OPENSSL_SYS_MACINTOSH_CLASSIC
+int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
+                                       const char *dir);
+#   endif
+#  endif
+
+# endif
+
+void SSL_load_error_strings(void);
+const char *SSL_state_string(const SSL *s);
+const char *SSL_rstate_string(const SSL *s);
+const char *SSL_state_string_long(const SSL *s);
+const char *SSL_rstate_string_long(const SSL *s);
+long SSL_SESSION_get_time(const SSL_SESSION *s);
+long SSL_SESSION_set_time(SSL_SESSION *s, long t);
+long SSL_SESSION_get_timeout(const SSL_SESSION *s);
+long SSL_SESSION_set_timeout(SSL_SESSION *s, long t);
+void SSL_copy_session_id(SSL *to, const SSL *from);
+X509 *SSL_SESSION_get0_peer(SSL_SESSION *s);
+int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx,
+                                unsigned int sid_ctx_len);
+
+SSL_SESSION *SSL_SESSION_new(void);
+const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,
+                                        unsigned int *len);
+unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s);
+# ifndef OPENSSL_NO_FP_API
+int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses);
+# endif
+# ifndef OPENSSL_NO_BIO
+int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses);
+# endif
+void SSL_SESSION_free(SSL_SESSION *ses);
+int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
+int SSL_set_session(SSL *to, SSL_SESSION *session);
+int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c);
+int SSL_CTX_remove_session(SSL_CTX *, SSL_SESSION *c);
+int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
+int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB);
+int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
+                                unsigned int id_len);
+SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
+                             long length);
+
+# ifdef HEADER_X509_H
+X509 *SSL_get_peer_certificate(const SSL *s);
+# endif
+
+STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s);
+
+int SSL_CTX_get_verify_mode(const SSL_CTX *ctx);
+int SSL_CTX_get_verify_depth(const SSL_CTX *ctx);
+int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx)) (int,
+                                                        X509_STORE_CTX *);
+void SSL_CTX_set_verify(SSL_CTX *ctx, int mode,
+                        int (*callback) (int, X509_STORE_CTX *));
+void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth);
+void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx,
+                                      int (*cb) (X509_STORE_CTX *, void *),
+                                      void *arg);
+# ifndef OPENSSL_NO_RSA
+int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
+# endif
+int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d,
+                                   long len);
+int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
+int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx,
+                                const unsigned char *d, long len);
+int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
+int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len,
+                                 const unsigned char *d);
+
+void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb);
+void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);
+
+int SSL_CTX_check_private_key(const SSL_CTX *ctx);
+int SSL_check_private_key(const SSL *ctx);
+
+int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx,
+                                   unsigned int sid_ctx_len);
+
+SSL *SSL_new(SSL_CTX *ctx);
+int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx,
+                               unsigned int sid_ctx_len);
+
+int SSL_CTX_set_purpose(SSL_CTX *s, int purpose);
+int SSL_set_purpose(SSL *s, int purpose);
+int SSL_CTX_set_trust(SSL_CTX *s, int trust);
+int SSL_set_trust(SSL *s, int trust);
+
+int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
+int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
+
+# ifndef OPENSSL_NO_SRP
+int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name);
+int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password);
+int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength);
+int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx,
+                                        char *(*cb) (SSL *, void *));
+int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx,
+                                          int (*cb) (SSL *, void *));
+int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,
+                                      int (*cb) (SSL *, int *, void *));
+int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg);
+
+int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g,
+                             BIGNUM *sa, BIGNUM *v, char *info);
+int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass,
+                                const char *grp);
+
+BIGNUM *SSL_get_srp_g(SSL *s);
+BIGNUM *SSL_get_srp_N(SSL *s);
+
+char *SSL_get_srp_username(SSL *s);
+char *SSL_get_srp_userinfo(SSL *s);
+# endif
+
+void SSL_free(SSL *ssl);
+int SSL_accept(SSL *ssl);
+int SSL_connect(SSL *ssl);
+int SSL_read(SSL *ssl, void *buf, int num);
+int SSL_peek(SSL *ssl, void *buf, int num);
+int SSL_write(SSL *ssl, const void *buf, int num);
+long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg);
+long SSL_callback_ctrl(SSL *, int, void (*)(void));
+long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg);
+long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void));
+
+int SSL_get_error(const SSL *s, int ret_code);
+const char *SSL_get_version(const SSL *s);
+
+/* This sets the 'default' SSL version that SSL_new() will create */
+int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth);
+
+# ifndef OPENSSL_NO_SSL2
+const SSL_METHOD *SSLv2_method(void); /* SSLv2 */
+const SSL_METHOD *SSLv2_server_method(void); /* SSLv2 */
+const SSL_METHOD *SSLv2_client_method(void); /* SSLv2 */
+# endif
+
+# ifndef OPENSSL_NO_SSL3_METHOD
+const SSL_METHOD *SSLv3_method(void); /* SSLv3 */
+const SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */
+const SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */
+# endif
+
+const SSL_METHOD *SSLv23_method(void); /* Negotiate highest available SSL/TLS
+                                        * version */
+const SSL_METHOD *SSLv23_server_method(void); /* Negotiate highest available
+                                               * SSL/TLS version */
+const SSL_METHOD *SSLv23_client_method(void); /* Negotiate highest available
+                                               * SSL/TLS version */
+
+const SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */
+const SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */
+const SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */
+
+const SSL_METHOD *TLSv1_1_method(void); /* TLSv1.1 */
+const SSL_METHOD *TLSv1_1_server_method(void); /* TLSv1.1 */
+const SSL_METHOD *TLSv1_1_client_method(void); /* TLSv1.1 */
+
+const SSL_METHOD *TLSv1_2_method(void); /* TLSv1.2 */
+const SSL_METHOD *TLSv1_2_server_method(void); /* TLSv1.2 */
+const SSL_METHOD *TLSv1_2_client_method(void); /* TLSv1.2 */
+
+const SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */
+const SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */
+const SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */
+
+STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s);
+
+int SSL_do_handshake(SSL *s);
+int SSL_renegotiate(SSL *s);
+int SSL_renegotiate_abbreviated(SSL *s);
+int SSL_renegotiate_pending(SSL *s);
+int SSL_shutdown(SSL *s);
+
+const SSL_METHOD *SSL_get_ssl_method(SSL *s);
+int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
+const char *SSL_alert_type_string_long(int value);
+const char *SSL_alert_type_string(int value);
+const char *SSL_alert_desc_string_long(int value);
+const char *SSL_alert_desc_string(int value);
+
+void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);
+void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);
+STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s);
+STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s);
+int SSL_add_client_CA(SSL *ssl, X509 *x);
+int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x);
+
+void SSL_set_connect_state(SSL *s);
+void SSL_set_accept_state(SSL *s);
+
+long SSL_get_default_timeout(const SSL *s);
+
+int SSL_library_init(void);
+
+char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size);
+STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk);
+
+SSL *SSL_dup(SSL *ssl);
+
+X509 *SSL_get_certificate(const SSL *ssl);
+/*
+ * EVP_PKEY
+ */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl);
+
+void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode);
+int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx);
+void SSL_set_quiet_shutdown(SSL *ssl, int mode);
+int SSL_get_quiet_shutdown(const SSL *ssl);
+void SSL_set_shutdown(SSL *ssl, int mode);
+int SSL_get_shutdown(const SSL *ssl);
+int SSL_version(const SSL *ssl);
+int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);
+int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
+                                  const char *CApath);
+# define SSL_get0_session SSL_get_session/* just peek at pointer */
+SSL_SESSION *SSL_get_session(const SSL *ssl);
+SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */
+SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);
+SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx);
+void SSL_set_info_callback(SSL *ssl,
+                           void (*cb) (const SSL *ssl, int type, int val));
+void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type,
+                                               int val);
+int SSL_state(const SSL *ssl);
+void SSL_set_state(SSL *ssl, int state);
+
+void SSL_set_verify_result(SSL *ssl, long v);
+long SSL_get_verify_result(const SSL *ssl);
+
+int SSL_set_ex_data(SSL *ssl, int idx, void *data);
+void *SSL_get_ex_data(const SSL *ssl, int idx);
+int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+
+int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data);
+void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx);
+int SSL_SESSION_get_ex_new_index(long argl, void *argp,
+                                 CRYPTO_EX_new *new_func,
+                                 CRYPTO_EX_dup *dup_func,
+                                 CRYPTO_EX_free *free_func);
+
+int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data);
+void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx);
+int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                             CRYPTO_EX_dup *dup_func,
+                             CRYPTO_EX_free *free_func);
+
+int SSL_get_ex_data_X509_STORE_CTX_idx(void);
+
+# define SSL_CTX_sess_set_cache_size(ctx,t) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL)
+# define SSL_CTX_sess_get_cache_size(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL)
+# define SSL_CTX_set_session_cache_mode(ctx,m) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)
+# define SSL_CTX_get_session_cache_mode(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL)
+
+# define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx)
+# define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m)
+# define SSL_CTX_get_read_ahead(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL)
+# define SSL_CTX_set_read_ahead(ctx,m) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL)
+# define SSL_CTX_get_max_cert_list(ctx) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
+# define SSL_CTX_set_max_cert_list(ctx,m) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
+# define SSL_get_max_cert_list(ssl) \
+        SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
+# define SSL_set_max_cert_list(ssl,m) \
+        SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
+
+# define SSL_CTX_set_max_send_fragment(ctx,m) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL)
+# define SSL_set_max_send_fragment(ssl,m) \
+        SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL)
+
+     /* NB: the keylength is only applicable when is_export is true */
+# ifndef OPENSSL_NO_RSA
+void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
+                                  RSA *(*cb) (SSL *ssl, int is_export,
+                                              int keylength));
+
+void SSL_set_tmp_rsa_callback(SSL *ssl,
+                              RSA *(*cb) (SSL *ssl, int is_export,
+                                          int keylength));
+# endif
+# ifndef OPENSSL_NO_DH
+void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,
+                                 DH *(*dh) (SSL *ssl, int is_export,
+                                            int keylength));
+void SSL_set_tmp_dh_callback(SSL *ssl,
+                             DH *(*dh) (SSL *ssl, int is_export,
+                                        int keylength));
+# endif
+# ifndef OPENSSL_NO_ECDH
+void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx,
+                                   EC_KEY *(*ecdh) (SSL *ssl, int is_export,
+                                                    int keylength));
+void SSL_set_tmp_ecdh_callback(SSL *ssl,
+                               EC_KEY *(*ecdh) (SSL *ssl, int is_export,
+                                                int keylength));
+# endif
+
+# ifndef OPENSSL_NO_COMP
+const COMP_METHOD *SSL_get_current_compression(SSL *s);
+const COMP_METHOD *SSL_get_current_expansion(SSL *s);
+const char *SSL_COMP_get_name(const COMP_METHOD *comp);
+STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);
+int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm);
+# else
+const void *SSL_get_current_compression(SSL *s);
+const void *SSL_get_current_expansion(SSL *s);
+const char *SSL_COMP_get_name(const void *comp);
+void *SSL_COMP_get_compression_methods(void);
+int SSL_COMP_add_compression_method(int id, void *cm);
+# endif
+
+/* TLS extensions functions */
+int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len);
+
+int SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb,
+                                  void *arg);
+
+/* Pre-shared secret session resumption functions */
+int SSL_set_session_secret_cb(SSL *s,
+                              tls_session_secret_cb_fn tls_session_secret_cb,
+                              void *arg);
+
+void SSL_set_debug(SSL *s, int debug);
+int SSL_cache_hit(SSL *s);
+
+# ifndef OPENSSL_NO_UNIT_TEST
+const struct openssl_ssl_test_functions *SSL_test_functions(void);
+# endif
+
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_SSL_strings(void);
+
+/* Error codes for the SSL functions. */
+
+/* Function codes. */
+# define SSL_F_CLIENT_CERTIFICATE                         100
+# define SSL_F_CLIENT_FINISHED                            167
+# define SSL_F_CLIENT_HELLO                               101
+# define SSL_F_CLIENT_MASTER_KEY                          102
+# define SSL_F_D2I_SSL_SESSION                            103
+# define SSL_F_DO_DTLS1_WRITE                             245
+# define SSL_F_DO_SSL3_WRITE                              104
+# define SSL_F_DTLS1_ACCEPT                               246
+# define SSL_F_DTLS1_ADD_CERT_TO_BUF                      295
+# define SSL_F_DTLS1_BUFFER_RECORD                        247
+# define SSL_F_DTLS1_CHECK_TIMEOUT_NUM                    316
+# define SSL_F_DTLS1_CLIENT_HELLO                         248
+# define SSL_F_DTLS1_CONNECT                              249
+# define SSL_F_DTLS1_ENC                                  250
+# define SSL_F_DTLS1_GET_HELLO_VERIFY                     251
+# define SSL_F_DTLS1_GET_MESSAGE                          252
+# define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT                 253
+# define SSL_F_DTLS1_GET_RECORD                           254
+# define SSL_F_DTLS1_HANDLE_TIMEOUT                       297
+# define SSL_F_DTLS1_HEARTBEAT                            305
+# define SSL_F_DTLS1_OUTPUT_CERT_CHAIN                    255
+# define SSL_F_DTLS1_PREPROCESS_FRAGMENT                  288
+# define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE           256
+# define SSL_F_DTLS1_PROCESS_RECORD                       257
+# define SSL_F_DTLS1_READ_BYTES                           258
+# define SSL_F_DTLS1_READ_FAILED                          259
+# define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST             260
+# define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE              261
+# define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE             262
+# define SSL_F_DTLS1_SEND_CLIENT_VERIFY                   263
+# define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST            264
+# define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE              265
+# define SSL_F_DTLS1_SEND_SERVER_HELLO                    266
+# define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE             267
+# define SSL_F_DTLS1_WRITE_APP_DATA_BYTES                 268
+# define SSL_F_GET_CLIENT_FINISHED                        105
+# define SSL_F_GET_CLIENT_HELLO                           106
+# define SSL_F_GET_CLIENT_MASTER_KEY                      107
+# define SSL_F_GET_SERVER_FINISHED                        108
+# define SSL_F_GET_SERVER_HELLO                           109
+# define SSL_F_GET_SERVER_VERIFY                          110
+# define SSL_F_I2D_SSL_SESSION                            111
+# define SSL_F_READ_N                                     112
+# define SSL_F_REQUEST_CERTIFICATE                        113
+# define SSL_F_SERVER_FINISH                              239
+# define SSL_F_SERVER_HELLO                               114
+# define SSL_F_SERVER_VERIFY                              240
+# define SSL_F_SSL23_ACCEPT                               115
+# define SSL_F_SSL23_CLIENT_HELLO                         116
+# define SSL_F_SSL23_CONNECT                              117
+# define SSL_F_SSL23_GET_CLIENT_HELLO                     118
+# define SSL_F_SSL23_GET_SERVER_HELLO                     119
+# define SSL_F_SSL23_PEEK                                 237
+# define SSL_F_SSL23_READ                                 120
+# define SSL_F_SSL23_WRITE                                121
+# define SSL_F_SSL2_ACCEPT                                122
+# define SSL_F_SSL2_CONNECT                               123
+# define SSL_F_SSL2_ENC_INIT                              124
+# define SSL_F_SSL2_GENERATE_KEY_MATERIAL                 241
+# define SSL_F_SSL2_PEEK                                  234
+# define SSL_F_SSL2_READ                                  125
+# define SSL_F_SSL2_READ_INTERNAL                         236
+# define SSL_F_SSL2_SET_CERTIFICATE                       126
+# define SSL_F_SSL2_WRITE                                 127
+# define SSL_F_SSL3_ACCEPT                                128
+# define SSL_F_SSL3_ADD_CERT_TO_BUF                       296
+# define SSL_F_SSL3_CALLBACK_CTRL                         233
+# define SSL_F_SSL3_CHANGE_CIPHER_STATE                   129
+# define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM              130
+# define SSL_F_SSL3_CHECK_CLIENT_HELLO                    304
+# define SSL_F_SSL3_CHECK_FINISHED                        339
+# define SSL_F_SSL3_CLIENT_HELLO                          131
+# define SSL_F_SSL3_CONNECT                               132
+# define SSL_F_SSL3_CTRL                                  213
+# define SSL_F_SSL3_CTX_CTRL                              133
+# define SSL_F_SSL3_DIGEST_CACHED_RECORDS                 293
+# define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC                 292
+# define SSL_F_SSL3_ENC                                   134
+# define SSL_F_SSL3_GENERATE_KEY_BLOCK                    238
+# define SSL_F_SSL3_GET_CERTIFICATE_REQUEST               135
+# define SSL_F_SSL3_GET_CERT_STATUS                       289
+# define SSL_F_SSL3_GET_CERT_VERIFY                       136
+# define SSL_F_SSL3_GET_CLIENT_CERTIFICATE                137
+# define SSL_F_SSL3_GET_CLIENT_HELLO                      138
+# define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE               139
+# define SSL_F_SSL3_GET_FINISHED                          140
+# define SSL_F_SSL3_GET_KEY_EXCHANGE                      141
+# define SSL_F_SSL3_GET_MESSAGE                           142
+# define SSL_F_SSL3_GET_NEW_SESSION_TICKET                283
+# define SSL_F_SSL3_GET_NEXT_PROTO                        306
+# define SSL_F_SSL3_GET_RECORD                            143
+# define SSL_F_SSL3_GET_SERVER_CERTIFICATE                144
+# define SSL_F_SSL3_GET_SERVER_DONE                       145
+# define SSL_F_SSL3_GET_SERVER_HELLO                      146
+# define SSL_F_SSL3_HANDSHAKE_MAC                         285
+# define SSL_F_SSL3_NEW_SESSION_TICKET                    287
+# define SSL_F_SSL3_OUTPUT_CERT_CHAIN                     147
+# define SSL_F_SSL3_PEEK                                  235
+# define SSL_F_SSL3_READ_BYTES                            148
+# define SSL_F_SSL3_READ_N                                149
+# define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST              150
+# define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE               151
+# define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE              152
+# define SSL_F_SSL3_SEND_CLIENT_VERIFY                    153
+# define SSL_F_SSL3_SEND_SERVER_CERTIFICATE               154
+# define SSL_F_SSL3_SEND_SERVER_HELLO                     242
+# define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE              155
+# define SSL_F_SSL3_SETUP_KEY_BLOCK                       157
+# define SSL_F_SSL3_SETUP_READ_BUFFER                     156
+# define SSL_F_SSL3_SETUP_WRITE_BUFFER                    291
+# define SSL_F_SSL3_WRITE_BYTES                           158
+# define SSL_F_SSL3_WRITE_PENDING                         159
+# define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT        298
+# define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT                 277
+# define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT           307
+# define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK         215
+# define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK        216
+# define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT        299
+# define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT                 278
+# define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT           308
+# define SSL_F_SSL_BAD_METHOD                             160
+# define SSL_F_SSL_BYTES_TO_CIPHER_LIST                   161
+# define SSL_F_SSL_CERT_DUP                               221
+# define SSL_F_SSL_CERT_INST                              222
+# define SSL_F_SSL_CERT_INSTANTIATE                       214
+# define SSL_F_SSL_CERT_NEW                               162
+# define SSL_F_SSL_CHECK_PRIVATE_KEY                      163
+# define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT               280
+# define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG            279
+# define SSL_F_SSL_CIPHER_PROCESS_RULESTR                 230
+# define SSL_F_SSL_CIPHER_STRENGTH_SORT                   231
+# define SSL_F_SSL_CLEAR                                  164
+# define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD            165
+# define SSL_F_SSL_CREATE_CIPHER_LIST                     166
+# define SSL_F_SSL_CTRL                                   232
+# define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY                  168
+# define SSL_F_SSL_CTX_MAKE_PROFILES                      309
+# define SSL_F_SSL_CTX_NEW                                169
+# define SSL_F_SSL_CTX_SET_CIPHER_LIST                    269
+# define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE             290
+# define SSL_F_SSL_CTX_SET_PURPOSE                        226
+# define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT             219
+# define SSL_F_SSL_CTX_SET_SSL_VERSION                    170
+# define SSL_F_SSL_CTX_SET_TRUST                          229
+# define SSL_F_SSL_CTX_USE_CERTIFICATE                    171
+# define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1               172
+# define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE         220
+# define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE               173
+# define SSL_F_SSL_CTX_USE_PRIVATEKEY                     174
+# define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1                175
+# define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE                176
+# define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT              272
+# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY                  177
+# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1             178
+# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE             179
+# define SSL_F_SSL_DO_HANDSHAKE                           180
+# define SSL_F_SSL_GET_NEW_SESSION                        181
+# define SSL_F_SSL_GET_PREV_SESSION                       217
+# define SSL_F_SSL_GET_SERVER_SEND_CERT                   182
+# define SSL_F_SSL_GET_SERVER_SEND_PKEY                   317
+# define SSL_F_SSL_GET_SIGN_PKEY                          183
+# define SSL_F_SSL_INIT_WBIO_BUFFER                       184
+# define SSL_F_SSL_LOAD_CLIENT_CA_FILE                    185
+# define SSL_F_SSL_NEW                                    186
+# define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT      300
+# define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT               302
+# define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT         310
+# define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT      301
+# define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT               303
+# define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT         311
+# define SSL_F_SSL_PEEK                                   270
+# define SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT             281
+# define SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT             282
+# define SSL_F_SSL_READ                                   223
+# define SSL_F_SSL_RSA_PRIVATE_DECRYPT                    187
+# define SSL_F_SSL_RSA_PUBLIC_ENCRYPT                     188
+# define SSL_F_SSL_SESSION_DUP                            348
+# define SSL_F_SSL_SESSION_NEW                            189
+# define SSL_F_SSL_SESSION_PRINT_FP                       190
+# define SSL_F_SSL_SESSION_SET1_ID_CONTEXT                312
+# define SSL_F_SSL_SESS_CERT_NEW                          225
+# define SSL_F_SSL_SET_CERT                               191
+# define SSL_F_SSL_SET_CIPHER_LIST                        271
+# define SSL_F_SSL_SET_FD                                 192
+# define SSL_F_SSL_SET_PKEY                               193
+# define SSL_F_SSL_SET_PURPOSE                            227
+# define SSL_F_SSL_SET_RFD                                194
+# define SSL_F_SSL_SET_SESSION                            195
+# define SSL_F_SSL_SET_SESSION_ID_CONTEXT                 218
+# define SSL_F_SSL_SET_SESSION_TICKET_EXT                 294
+# define SSL_F_SSL_SET_TRUST                              228
+# define SSL_F_SSL_SET_WFD                                196
+# define SSL_F_SSL_SHUTDOWN                               224
+# define SSL_F_SSL_SRP_CTX_INIT                           313
+# define SSL_F_SSL_UNDEFINED_CONST_FUNCTION               243
+# define SSL_F_SSL_UNDEFINED_FUNCTION                     197
+# define SSL_F_SSL_UNDEFINED_VOID_FUNCTION                244
+# define SSL_F_SSL_USE_CERTIFICATE                        198
+# define SSL_F_SSL_USE_CERTIFICATE_ASN1                   199
+# define SSL_F_SSL_USE_CERTIFICATE_FILE                   200
+# define SSL_F_SSL_USE_PRIVATEKEY                         201
+# define SSL_F_SSL_USE_PRIVATEKEY_ASN1                    202
+# define SSL_F_SSL_USE_PRIVATEKEY_FILE                    203
+# define SSL_F_SSL_USE_PSK_IDENTITY_HINT                  273
+# define SSL_F_SSL_USE_RSAPRIVATEKEY                      204
+# define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1                 205
+# define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE                 206
+# define SSL_F_SSL_VERIFY_CERT_CHAIN                      207
+# define SSL_F_SSL_WRITE                                  208
+# define SSL_F_TLS1_CERT_VERIFY_MAC                       286
+# define SSL_F_TLS1_CHANGE_CIPHER_STATE                   209
+# define SSL_F_TLS1_CHECK_SERVERHELLO_TLSEXT              274
+# define SSL_F_TLS1_ENC                                   210
+# define SSL_F_TLS1_EXPORT_KEYING_MATERIAL                314
+# define SSL_F_TLS1_HEARTBEAT                             315
+# define SSL_F_TLS1_PREPARE_CLIENTHELLO_TLSEXT            275
+# define SSL_F_TLS1_PREPARE_SERVERHELLO_TLSEXT            276
+# define SSL_F_TLS1_PRF                                   284
+# define SSL_F_TLS1_SETUP_KEY_BLOCK                       211
+# define SSL_F_WRITE_PENDING                              212
+
+/* Reason codes. */
+# define SSL_R_APP_DATA_IN_HANDSHAKE                      100
+# define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272
+# define SSL_R_BAD_ALERT_RECORD                           101
+# define SSL_R_BAD_AUTHENTICATION_TYPE                    102
+# define SSL_R_BAD_CHANGE_CIPHER_SPEC                     103
+# define SSL_R_BAD_CHECKSUM                               104
+# define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK              106
+# define SSL_R_BAD_DECOMPRESSION                          107
+# define SSL_R_BAD_DH_G_LENGTH                            108
+# define SSL_R_BAD_DH_PUB_KEY_LENGTH                      109
+# define SSL_R_BAD_DH_P_LENGTH                            110
+# define SSL_R_BAD_DIGEST_LENGTH                          111
+# define SSL_R_BAD_DSA_SIGNATURE                          112
+# define SSL_R_BAD_ECC_CERT                               304
+# define SSL_R_BAD_ECDSA_SIGNATURE                        305
+# define SSL_R_BAD_ECPOINT                                306
+# define SSL_R_BAD_HANDSHAKE_LENGTH                       332
+# define SSL_R_BAD_HELLO_REQUEST                          105
+# define SSL_R_BAD_LENGTH                                 271
+# define SSL_R_BAD_MAC_DECODE                             113
+# define SSL_R_BAD_MAC_LENGTH                             333
+# define SSL_R_BAD_MESSAGE_TYPE                           114
+# define SSL_R_BAD_PACKET_LENGTH                          115
+# define SSL_R_BAD_PROTOCOL_VERSION_NUMBER                116
+# define SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH               316
+# define SSL_R_BAD_RESPONSE_ARGUMENT                      117
+# define SSL_R_BAD_RSA_DECRYPT                            118
+# define SSL_R_BAD_RSA_ENCRYPT                            119
+# define SSL_R_BAD_RSA_E_LENGTH                           120
+# define SSL_R_BAD_RSA_MODULUS_LENGTH                     121
+# define SSL_R_BAD_RSA_SIGNATURE                          122
+# define SSL_R_BAD_SIGNATURE                              123
+# define SSL_R_BAD_SRP_A_LENGTH                           347
+# define SSL_R_BAD_SRP_B_LENGTH                           348
+# define SSL_R_BAD_SRP_G_LENGTH                           349
+# define SSL_R_BAD_SRP_N_LENGTH                           350
+# define SSL_R_BAD_SRP_PARAMETERS                         371
+# define SSL_R_BAD_SRP_S_LENGTH                           351
+# define SSL_R_BAD_SRTP_MKI_VALUE                         352
+# define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST           353
+# define SSL_R_BAD_SSL_FILETYPE                           124
+# define SSL_R_BAD_SSL_SESSION_ID_LENGTH                  125
+# define SSL_R_BAD_STATE                                  126
+# define SSL_R_BAD_WRITE_RETRY                            127
+# define SSL_R_BIO_NOT_SET                                128
+# define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG                  129
+# define SSL_R_BN_LIB                                     130
+# define SSL_R_CA_DN_LENGTH_MISMATCH                      131
+# define SSL_R_CA_DN_TOO_LONG                             132
+# define SSL_R_CCS_RECEIVED_EARLY                         133
+# define SSL_R_CERTIFICATE_VERIFY_FAILED                  134
+# define SSL_R_CERT_LENGTH_MISMATCH                       135
+# define SSL_R_CHALLENGE_IS_DIFFERENT                     136
+# define SSL_R_CIPHER_CODE_WRONG_LENGTH                   137
+# define SSL_R_CIPHER_OR_HASH_UNAVAILABLE                 138
+# define SSL_R_CIPHER_TABLE_SRC_ERROR                     139
+# define SSL_R_CLIENTHELLO_TLSEXT                         226
+# define SSL_R_COMPRESSED_LENGTH_TOO_LONG                 140
+# define SSL_R_COMPRESSION_DISABLED                       343
+# define SSL_R_COMPRESSION_FAILURE                        141
+# define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE    307
+# define SSL_R_COMPRESSION_LIBRARY_ERROR                  142
+# define SSL_R_CONNECTION_ID_IS_DIFFERENT                 143
+# define SSL_R_CONNECTION_TYPE_NOT_SET                    144
+# define SSL_R_COOKIE_MISMATCH                            308
+# define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED              145
+# define SSL_R_DATA_LENGTH_TOO_LONG                       146
+# define SSL_R_DECRYPTION_FAILED                          147
+# define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC        281
+# define SSL_R_DH_KEY_TOO_SMALL                           372
+# define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG            148
+# define SSL_R_DIGEST_CHECK_FAILED                        149
+# define SSL_R_DTLS_MESSAGE_TOO_BIG                       334
+# define SSL_R_DUPLICATE_COMPRESSION_ID                   309
+# define SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT             317
+# define SSL_R_ECC_CERT_NOT_FOR_SIGNING                   318
+# define SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE         322
+# define SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE        323
+# define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER               310
+# define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST         354
+# define SSL_R_ENCRYPTED_LENGTH_TOO_LONG                  150
+# define SSL_R_ERROR_GENERATING_TMP_RSA_KEY               282
+# define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST              151
+# define SSL_R_EXCESSIVE_MESSAGE_SIZE                     152
+# define SSL_R_EXTRA_DATA_IN_MESSAGE                      153
+# define SSL_R_GOT_A_FIN_BEFORE_A_CCS                     154
+# define SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS                355
+# define SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION           356
+# define SSL_R_HTTPS_PROXY_REQUEST                        155
+# define SSL_R_HTTP_REQUEST                               156
+# define SSL_R_ILLEGAL_PADDING                            283
+# define SSL_R_INAPPROPRIATE_FALLBACK                     373
+# define SSL_R_INCONSISTENT_COMPRESSION                   340
+# define SSL_R_INVALID_CHALLENGE_LENGTH                   158
+# define SSL_R_INVALID_COMMAND                            280
+# define SSL_R_INVALID_COMPRESSION_ALGORITHM              341
+# define SSL_R_INVALID_PURPOSE                            278
+# define SSL_R_INVALID_SRP_USERNAME                       357
+# define SSL_R_INVALID_STATUS_RESPONSE                    328
+# define SSL_R_INVALID_TICKET_KEYS_LENGTH                 325
+# define SSL_R_INVALID_TRUST                              279
+# define SSL_R_KEY_ARG_TOO_LONG                           284
+# define SSL_R_KRB5                                       285
+# define SSL_R_KRB5_C_CC_PRINC                            286
+# define SSL_R_KRB5_C_GET_CRED                            287
+# define SSL_R_KRB5_C_INIT                                288
+# define SSL_R_KRB5_C_MK_REQ                              289
+# define SSL_R_KRB5_S_BAD_TICKET                          290
+# define SSL_R_KRB5_S_INIT                                291
+# define SSL_R_KRB5_S_RD_REQ                              292
+# define SSL_R_KRB5_S_TKT_EXPIRED                         293
+# define SSL_R_KRB5_S_TKT_NYV                             294
+# define SSL_R_KRB5_S_TKT_SKEW                            295
+# define SSL_R_LENGTH_MISMATCH                            159
+# define SSL_R_LENGTH_TOO_SHORT                           160
+# define SSL_R_LIBRARY_BUG                                274
+# define SSL_R_LIBRARY_HAS_NO_CIPHERS                     161
+# define SSL_R_MESSAGE_TOO_LONG                           296
+# define SSL_R_MISSING_DH_DSA_CERT                        162
+# define SSL_R_MISSING_DH_KEY                             163
+# define SSL_R_MISSING_DH_RSA_CERT                        164
+# define SSL_R_MISSING_DSA_SIGNING_CERT                   165
+# define SSL_R_MISSING_EXPORT_TMP_DH_KEY                  166
+# define SSL_R_MISSING_EXPORT_TMP_RSA_KEY                 167
+# define SSL_R_MISSING_RSA_CERTIFICATE                    168
+# define SSL_R_MISSING_RSA_ENCRYPTING_CERT                169
+# define SSL_R_MISSING_RSA_SIGNING_CERT                   170
+# define SSL_R_MISSING_SRP_PARAM                          358
+# define SSL_R_MISSING_TMP_DH_KEY                         171
+# define SSL_R_MISSING_TMP_ECDH_KEY                       311
+# define SSL_R_MISSING_TMP_RSA_KEY                        172
+# define SSL_R_MISSING_TMP_RSA_PKEY                       173
+# define SSL_R_MISSING_VERIFY_MESSAGE                     174
+# define SSL_R_MULTIPLE_SGC_RESTARTS                      346
+# define SSL_R_NON_SSLV2_INITIAL_PACKET                   175
+# define SSL_R_NO_CERTIFICATES_RETURNED                   176
+# define SSL_R_NO_CERTIFICATE_ASSIGNED                    177
+# define SSL_R_NO_CERTIFICATE_RETURNED                    178
+# define SSL_R_NO_CERTIFICATE_SET                         179
+# define SSL_R_NO_CERTIFICATE_SPECIFIED                   180
+# define SSL_R_NO_CIPHERS_AVAILABLE                       181
+# define SSL_R_NO_CIPHERS_PASSED                          182
+# define SSL_R_NO_CIPHERS_SPECIFIED                       183
+# define SSL_R_NO_CIPHER_LIST                             184
+# define SSL_R_NO_CIPHER_MATCH                            185
+# define SSL_R_NO_CLIENT_CERT_METHOD                      331
+# define SSL_R_NO_CLIENT_CERT_RECEIVED                    186
+# define SSL_R_NO_COMPRESSION_SPECIFIED                   187
+# define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER           330
+# define SSL_R_NO_METHOD_SPECIFIED                        188
+# define SSL_R_NO_PRIVATEKEY                              189
+# define SSL_R_NO_PRIVATE_KEY_ASSIGNED                    190
+# define SSL_R_NO_PROTOCOLS_AVAILABLE                     191
+# define SSL_R_NO_PUBLICKEY                               192
+# define SSL_R_NO_RENEGOTIATION                           339
+# define SSL_R_NO_REQUIRED_DIGEST                         324
+# define SSL_R_NO_SHARED_CIPHER                           193
+# define SSL_R_NO_SRTP_PROFILES                           359
+# define SSL_R_NO_VERIFY_CALLBACK                         194
+# define SSL_R_NULL_SSL_CTX                               195
+# define SSL_R_NULL_SSL_METHOD_PASSED                     196
+# define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED            197
+# define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344
+# define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE              297
+# define SSL_R_OPAQUE_PRF_INPUT_TOO_LONG                  327
+# define SSL_R_PACKET_LENGTH_TOO_LONG                     198
+# define SSL_R_PARSE_TLSEXT                               227
+# define SSL_R_PATH_TOO_LONG                              270
+# define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE          199
+# define SSL_R_PEER_ERROR                                 200
+# define SSL_R_PEER_ERROR_CERTIFICATE                     201
+# define SSL_R_PEER_ERROR_NO_CERTIFICATE                  202
+# define SSL_R_PEER_ERROR_NO_CIPHER                       203
+# define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE    204
+# define SSL_R_PRE_MAC_LENGTH_TOO_LONG                    205
+# define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS          206
+# define SSL_R_PROTOCOL_IS_SHUTDOWN                       207
+# define SSL_R_PSK_IDENTITY_NOT_FOUND                     223
+# define SSL_R_PSK_NO_CLIENT_CB                           224
+# define SSL_R_PSK_NO_SERVER_CB                           225
+# define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR                   208
+# define SSL_R_PUBLIC_KEY_IS_NOT_RSA                      209
+# define SSL_R_PUBLIC_KEY_NOT_RSA                         210
+# define SSL_R_READ_BIO_NOT_SET                           211
+# define SSL_R_READ_TIMEOUT_EXPIRED                       312
+# define SSL_R_READ_WRONG_PACKET_TYPE                     212
+# define SSL_R_RECORD_LENGTH_MISMATCH                     213
+# define SSL_R_RECORD_TOO_LARGE                           214
+# define SSL_R_RECORD_TOO_SMALL                           298
+# define SSL_R_RENEGOTIATE_EXT_TOO_LONG                   335
+# define SSL_R_RENEGOTIATION_ENCODING_ERR                 336
+# define SSL_R_RENEGOTIATION_MISMATCH                     337
+# define SSL_R_REQUIRED_CIPHER_MISSING                    215
+# define SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING    342
+# define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO                 216
+# define SSL_R_REUSE_CERT_TYPE_NOT_ZERO                   217
+# define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO                 218
+# define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING           345
+# define SSL_R_SERVERHELLO_TLSEXT                         275
+# define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED           277
+# define SSL_R_SHORT_READ                                 219
+# define SSL_R_SIGNATURE_ALGORITHMS_ERROR                 360
+# define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE      220
+# define SSL_R_SRP_A_CALC                                 361
+# define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES           362
+# define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG      363
+# define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE            364
+# define SSL_R_SSL23_DOING_SESSION_ID_REUSE               221
+# define SSL_R_SSL2_CONNECTION_ID_TOO_LONG                299
+# define SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT             321
+# define SSL_R_SSL3_EXT_INVALID_SERVERNAME                319
+# define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE           320
+# define SSL_R_SSL3_SESSION_ID_TOO_LONG                   300
+# define SSL_R_SSL3_SESSION_ID_TOO_SHORT                  222
+# define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE                1042
+# define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC                 1020
+# define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED            1045
+# define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED            1044
+# define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN            1046
+# define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE          1030
+# define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE              1040
+# define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER              1047
+# define SSL_R_SSLV3_ALERT_NO_CERTIFICATE                 1041
+# define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE             1010
+# define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE        1043
+# define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION         228
+# define SSL_R_SSL_HANDSHAKE_FAILURE                      229
+# define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS                 230
+# define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED             301
+# define SSL_R_SSL_SESSION_ID_CONFLICT                    302
+# define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG            273
+# define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH              303
+# define SSL_R_SSL_SESSION_ID_IS_DIFFERENT                231
+# define SSL_R_TLSV1_ALERT_ACCESS_DENIED                  1049
+# define SSL_R_TLSV1_ALERT_DECODE_ERROR                   1050
+# define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED              1021
+# define SSL_R_TLSV1_ALERT_DECRYPT_ERROR                  1051
+# define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION             1060
+# define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK         1086
+# define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY          1071
+# define SSL_R_TLSV1_ALERT_INTERNAL_ERROR                 1080
+# define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION               1100
+# define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION               1070
+# define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW                1022
+# define SSL_R_TLSV1_ALERT_UNKNOWN_CA                     1048
+# define SSL_R_TLSV1_ALERT_USER_CANCELLED                 1090
+# define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE           1114
+# define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE      1113
+# define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE             1111
+# define SSL_R_TLSV1_UNRECOGNIZED_NAME                    1112
+# define SSL_R_TLSV1_UNSUPPORTED_EXTENSION                1110
+# define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER       232
+# define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT           365
+# define SSL_R_TLS_HEARTBEAT_PENDING                      366
+# define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL                 367
+# define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST             157
+# define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233
+# define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG    234
+# define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER            235
+# define SSL_R_UNABLE_TO_DECODE_DH_CERTS                  236
+# define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS                313
+# define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY               237
+# define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS               238
+# define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS             314
+# define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS       239
+# define SSL_R_UNABLE_TO_FIND_SSL_METHOD                  240
+# define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES           241
+# define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES           242
+# define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES          243
+# define SSL_R_UNEXPECTED_MESSAGE                         244
+# define SSL_R_UNEXPECTED_RECORD                          245
+# define SSL_R_UNINITIALIZED                              276
+# define SSL_R_UNKNOWN_ALERT_TYPE                         246
+# define SSL_R_UNKNOWN_CERTIFICATE_TYPE                   247
+# define SSL_R_UNKNOWN_CIPHER_RETURNED                    248
+# define SSL_R_UNKNOWN_CIPHER_TYPE                        249
+# define SSL_R_UNKNOWN_DIGEST                             368
+# define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE                  250
+# define SSL_R_UNKNOWN_PKEY_TYPE                          251
+# define SSL_R_UNKNOWN_PROTOCOL                           252
+# define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE                  253
+# define SSL_R_UNKNOWN_SSL_VERSION                        254
+# define SSL_R_UNKNOWN_STATE                              255
+# define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED       338
+# define SSL_R_UNSUPPORTED_CIPHER                         256
+# define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM          257
+# define SSL_R_UNSUPPORTED_DIGEST_TYPE                    326
+# define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE                 315
+# define SSL_R_UNSUPPORTED_PROTOCOL                       258
+# define SSL_R_UNSUPPORTED_SSL_VERSION                    259
+# define SSL_R_UNSUPPORTED_STATUS_TYPE                    329
+# define SSL_R_USE_SRTP_NOT_NEGOTIATED                    369
+# define SSL_R_WRITE_BIO_NOT_SET                          260
+# define SSL_R_WRONG_CIPHER_RETURNED                      261
+# define SSL_R_WRONG_MESSAGE_TYPE                         262
+# define SSL_R_WRONG_NUMBER_OF_KEY_BITS                   263
+# define SSL_R_WRONG_SIGNATURE_LENGTH                     264
+# define SSL_R_WRONG_SIGNATURE_SIZE                       265
+# define SSL_R_WRONG_SIGNATURE_TYPE                       370
+# define SSL_R_WRONG_SSL_VERSION                          266
+# define SSL_R_WRONG_VERSION_NUMBER                       267
+# define SSL_R_X509_LIB                                   268
+# define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS           269
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ssl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/stack.h
===================================================================
--- lab4/.minix-src/include/openssl/stack.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/stack.h	(revision 13)
@@ -0,0 +1,106 @@
+/* crypto/stack/stack.h */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_STACK_H
+# define HEADER_STACK_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef struct stack_st {
+    int num;
+    char **data;
+    int sorted;
+    int num_alloc;
+    int (*comp) (const void *, const void *);
+} _STACK;                       /* Use STACK_OF(...) instead */
+
+# define M_sk_num(sk)            ((sk) ? (sk)->num:-1)
+# define M_sk_value(sk,n)        ((sk) ? (sk)->data[n] : NULL)
+
+int sk_num(const _STACK *);
+void *sk_value(const _STACK *, int);
+
+void *sk_set(_STACK *, int, void *);
+
+_STACK *sk_new(int (*cmp) (const void *, const void *));
+_STACK *sk_new_null(void);
+void sk_free(_STACK *);
+void sk_pop_free(_STACK *st, void (*func) (void *));
+int sk_insert(_STACK *sk, void *data, int where);
+void *sk_delete(_STACK *st, int loc);
+void *sk_delete_ptr(_STACK *st, void *p);
+int sk_find(_STACK *st, void *data);
+int sk_find_ex(_STACK *st, void *data);
+int sk_push(_STACK *st, void *data);
+int sk_unshift(_STACK *st, void *data);
+void *sk_shift(_STACK *st);
+void *sk_pop(_STACK *st);
+void sk_zero(_STACK *st);
+int (*sk_set_cmp_func(_STACK *sk, int (*c) (const void *, const void *)))
+ (const void *, const void *);
+_STACK *sk_dup(_STACK *st);
+void sk_sort(_STACK *st);
+int sk_is_sorted(const _STACK *st);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/stack.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/prop/proplib.h
===================================================================
--- lab4/.minix-src/include/prop/proplib.h	(nonexistent)
+++ lab4/.minix-src/include/prop/proplib.h	(revision 13)
@@ -0,0 +1,50 @@
+/*	$NetBSD: proplib.h,v 1.7 2009/09/13 18:45:10 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PROPLIB_PROPLIB_H_
+#define	_PROPLIB_PROPLIB_H_
+
+#include <prop/prop_array.h>
+#include <prop/prop_bool.h>
+#include <prop/prop_data.h>
+#include <prop/prop_dictionary.h>
+#include <prop/prop_number.h>
+#include <prop/prop_string.h>
+
+#include <prop/prop_ingest.h>
+
+#include <prop/plistref.h>
+
+#ifdef _KERNEL
+void	prop_kern_init(void);
+#endif
+
+#endif /* _PROPLIB_PROPLIB_H_ */

Property changes on: lab4/.minix-src/include/prop/proplib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/prop/prop_string.h
===================================================================
--- lab4/.minix-src/include/prop/prop_string.h	(nonexistent)
+++ lab4/.minix-src/include/prop/prop_string.h	(revision 13)
@@ -0,0 +1,60 @@
+/*	$NetBSD: prop_string.h,v 1.3 2008/04/28 20:22:51 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PROPLIB_PROP_STRING_H_
+#define	_PROPLIB_PROP_STRING_H_
+
+#include <prop/prop_object.h>
+
+typedef struct _prop_string *prop_string_t;
+
+__BEGIN_DECLS
+prop_string_t	prop_string_create(void);
+prop_string_t	prop_string_create_cstring(const char *);
+prop_string_t	prop_string_create_cstring_nocopy(const char *);
+
+prop_string_t	prop_string_copy(prop_string_t);
+prop_string_t	prop_string_copy_mutable(prop_string_t);
+
+size_t		prop_string_size(prop_string_t);
+bool		prop_string_mutable(prop_string_t);
+
+char *		prop_string_cstring(prop_string_t);
+const char *	prop_string_cstring_nocopy(prop_string_t);
+
+bool		prop_string_append(prop_string_t, prop_string_t);
+bool		prop_string_append_cstring(prop_string_t, const char *);
+
+bool		prop_string_equals(prop_string_t, prop_string_t);
+bool		prop_string_equals_cstring(prop_string_t, const char *);
+__END_DECLS
+
+#endif /* _PROPLIB_PROP_STRING_H_ */

Property changes on: lab4/.minix-src/include/prop/prop_string.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/protocols/rwhod.h
===================================================================
--- lab4/.minix-src/include/protocols/rwhod.h	(nonexistent)
+++ lab4/.minix-src/include/protocols/rwhod.h	(revision 13)
@@ -0,0 +1,66 @@
+/*	$NetBSD: rwhod.h,v 1.7 2003/08/07 09:44:13 agc Exp $	*/
+
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)rwhod.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _PROTOCOLS_RWHOD_H_
+#define	_PROTOCOLS_RWHOD_H_
+
+/*
+ * rwho protocol packet format.
+ */
+struct	outmp {
+	char	out_line[8];		/* tty name */
+	char	out_name[8];		/* user id */
+	int32_t	out_time;		/* time on */
+};
+
+struct	whod {
+	char	wd_vers;		/* protocol version # */
+	char	wd_type;		/* packet type, see below */
+	char	wd_pad[2];
+	int32_t	wd_sendtime;		/* time stamp by sender */
+	int32_t	wd_recvtime;		/* time stamp applied by receiver */
+	char	wd_hostname[32];	/* hosts's name */
+	int32_t	wd_loadav[3];		/* load average as in uptime */
+	int32_t	wd_boottime;		/* time system booted */
+	struct	whoent {
+		struct	outmp we_utmp;	/* active tty info */
+		int32_t	we_idle;	/* tty idle time */
+	} wd_we[1024 / sizeof (struct whoent)];
+};
+
+#define	WHODVERSION	1
+#define	WHODTYPE_STATUS	1		/* host status */
+
+#define	_PATH_RWHODIR	"/var/rwho"
+
+#endif /* !_PROTOCOLS_RWHOD_H_ */

Property changes on: lab4/.minix-src/include/protocols/rwhod.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/readline/readline.h
===================================================================
--- lab4/.minix-src/include/readline/readline.h	(nonexistent)
+++ lab4/.minix-src/include/readline/readline.h	(revision 13)
@@ -0,0 +1,223 @@
+/*	$NetBSD: readline.h,v 1.37 2015/06/02 15:36:45 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jaromir Dolecek.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _READLINE_H_
+#define _READLINE_H_
+
+#include <sys/types.h>
+#include <stdio.h>
+
+/* list of readline stuff supported by editline library's readline wrapper */
+
+/* typedefs */
+typedef int	  Function(const char *, int);
+typedef void	  VFunction(void);
+typedef void	  rl_vcpfunc_t(char *);
+typedef char	**rl_completion_func_t(const char *, int, int);
+typedef char     *rl_compentry_func_t(const char *, int);
+typedef int	  rl_command_func_t(int, int);
+
+/* only supports length */
+typedef struct {
+	int length;
+} HISTORY_STATE;
+
+typedef void *histdata_t;
+
+typedef struct _hist_entry {
+	const char	*line;
+	histdata_t 	 data;
+} HIST_ENTRY;
+
+typedef struct _keymap_entry {
+	char type;
+#define ISFUNC	0
+#define ISKMAP	1
+#define ISMACR	2
+	Function *function;
+} KEYMAP_ENTRY;
+
+#define KEYMAP_SIZE	256
+
+typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
+typedef KEYMAP_ENTRY *Keymap;
+
+#define control_character_threshold	0x20
+#define control_character_bit		0x40
+
+#ifndef CTRL
+#include <sys/ioctl.h>
+#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
+#include <sys/ttydefaults.h>
+#endif
+#ifndef CTRL
+#define CTRL(c)		((c) & 037)
+#endif
+#endif
+#ifndef UNCTRL
+#define UNCTRL(c)	(((c) - 'a' + 'A')|control_character_bit)
+#endif
+
+#define RUBOUT		0x7f
+#define ABORT_CHAR	CTRL('G')
+#define RL_READLINE_VERSION 	0x0402
+#define RL_PROMPT_START_IGNORE	'\1'
+#define RL_PROMPT_END_IGNORE	'\2'
+
+/* global variables used by readline enabled applications */
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern const char	*rl_library_version;
+extern int 		rl_readline_version; 
+extern char		*rl_readline_name;
+extern FILE		*rl_instream;
+extern FILE		*rl_outstream;
+extern char		*rl_line_buffer;
+extern int		 rl_point, rl_end;
+extern int		 history_base, history_length;
+extern int		 max_input_history;
+extern char		*rl_basic_word_break_characters;
+extern char		*rl_completer_word_break_characters;
+extern char		*rl_completer_quote_characters;
+extern rl_compentry_func_t *rl_completion_entry_function;
+extern char		*(*rl_completion_word_break_hook)(void);
+extern rl_completion_func_t *rl_attempted_completion_function;
+extern int		 rl_attempted_completion_over;
+extern int		rl_completion_type;
+extern int		rl_completion_query_items;
+extern char		*rl_special_prefixes;
+extern int		rl_completion_append_character;
+extern int		rl_inhibit_completion;
+extern Function		*rl_pre_input_hook;
+extern Function		*rl_startup_hook;
+extern char		*rl_terminal_name;
+extern int		rl_already_prompted;
+extern char		*rl_prompt;
+/*
+ * The following is not implemented
+ */
+extern int		rl_catch_signals;
+extern int		rl_catch_sigwinch;
+extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
+			emacs_meta_keymap,
+			emacs_ctlx_keymap;
+extern int		rl_filename_completion_desired;
+extern int		rl_ignore_completion_duplicates;
+extern int		(*rl_getc_function)(FILE *);
+extern VFunction	*rl_redisplay_function;
+extern VFunction	*rl_completion_display_matches_hook;
+extern VFunction	*rl_prep_term_function;
+extern VFunction	*rl_deprep_term_function;
+extern int		readline_echoing_p;
+extern int		_rl_print_completions_horizontally;
+
+/* supported functions */
+char		*readline(const char *);
+int		 rl_initialize(void);
+
+void		 using_history(void);
+int		 add_history(const char *);
+void		 clear_history(void);
+void		 stifle_history(int);
+int		 unstifle_history(void);
+int		 history_is_stifled(void);
+int		 where_history(void);
+HIST_ENTRY	*current_history(void);
+HIST_ENTRY	*history_get(int);
+HIST_ENTRY	*remove_history(int);
+HIST_ENTRY	*replace_history_entry(int, const char *, histdata_t);
+int		 history_total_bytes(void);
+int		 history_set_pos(int);
+HIST_ENTRY	*previous_history(void);
+HIST_ENTRY	*next_history(void);
+int		 history_search(const char *, int);
+int		 history_search_prefix(const char *, int);
+int		 history_search_pos(const char *, int, int);
+int		 read_history(const char *);
+int		 write_history(const char *);
+int		 history_truncate_file (const char *, int);
+int		 history_expand(char *, char **);
+char	       **history_tokenize(const char *);
+const char	*get_history_event(const char *, int *, int);
+char		*history_arg_extract(int, int, const char *);
+
+char		*tilde_expand(char *);
+char		*filename_completion_function(const char *, int);
+char		*username_completion_function(const char *, int);
+int		 rl_complete(int, int);
+int		 rl_read_key(void);
+char	       **completion_matches(const char *, rl_compentry_func_t *);
+void		 rl_display_match_list(char **, int, int);
+
+int		 rl_insert(int, int);
+int		 rl_insert_text(const char *);
+void		 rl_reset_terminal(const char *);
+int		 rl_bind_key(int, rl_command_func_t *);
+int		 rl_newline(int, int);
+void		 rl_callback_read_char(void);
+void		 rl_callback_handler_install(const char *, rl_vcpfunc_t *);
+void		 rl_callback_handler_remove(void);
+void		 rl_redisplay(void);
+int		 rl_get_previous_history(int, int);
+void		 rl_prep_terminal(int);
+void		 rl_deprep_terminal(void);
+int		 rl_read_init_file(const char *);
+int		 rl_parse_and_bind(const char *);
+int		 rl_variable_bind(const char *, const char *);
+void		 rl_stuff_char(int);
+int		 rl_add_defun(const char *, rl_command_func_t *, int);
+HISTORY_STATE	*history_get_history_state(void);
+void		 rl_get_screen_size(int *, int *);
+void		 rl_set_screen_size(int, int);
+char 		*rl_filename_completion_function (const char *, int);
+int		 _rl_abort_internal(void);
+int		 _rl_qsort_string_compare(char **, char **);
+char 	       **rl_completion_matches(const char *, rl_compentry_func_t *);
+void		 rl_forced_update_display(void);
+int		 rl_set_prompt(const char *);
+int		 rl_on_new_line(void);
+
+/*
+ * The following are not implemented
+ */
+int		 rl_kill_text(int, int);
+Keymap		 rl_get_keymap(void);
+void		 rl_set_keymap(Keymap);
+Keymap		 rl_make_bare_keymap(void);
+int		 rl_generic_bind(int, const char *, const char *, Keymap);
+int		 rl_bind_key_in_map(int, rl_command_func_t *, Keymap);
+void		 rl_cleanup_after_signal(void);
+void		 rl_free_line_state(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _READLINE_H_ */

Property changes on: lab4/.minix-src/include/readline/readline.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ssp/stdio.h
===================================================================
--- lab4/.minix-src/include/ssp/stdio.h	(nonexistent)
+++ lab4/.minix-src/include/ssp/stdio.h	(revision 13)
@@ -0,0 +1,74 @@
+/*	$NetBSD: stdio.h,v 1.5 2011/07/17 20:54:34 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _SSP_STDIO_H_
+#define _SSP_STDIO_H_
+
+#include <ssp/ssp.h>
+
+__BEGIN_DECLS
+int __sprintf_chk(char *__restrict, int, size_t, const char *__restrict, ...)
+    __printflike(4, 5);
+int __vsprintf_chk(char *__restrict, int, size_t, const char *__restrict,
+    __va_list)
+    __printflike(4, 0);
+int __snprintf_chk(char *__restrict, size_t, int, size_t,
+    const char *__restrict, ...)
+    __printflike(5, 6);
+int __vsnprintf_chk(char *__restrict, size_t, int, size_t,
+     const char *__restrict, __va_list)
+    __printflike(5, 0);
+char *__gets_chk(char *, size_t);
+char *__fgets_chk(char *, int, size_t, FILE *);
+__END_DECLS
+
+#if __SSP_FORTIFY_LEVEL > 0
+
+
+#define sprintf(str, ...) \
+    __builtin___sprintf_chk(str, 0, __ssp_bos(str), __VA_ARGS__)
+
+#define vsprintf(str, fmt, ap) \
+    __builtin___vsprintf_chk(str, 0, __ssp_bos(str), fmt, ap)
+
+#define snprintf(str, len, ...) \
+    __builtin___snprintf_chk(str, len, 0, __ssp_bos(str), __VA_ARGS__)
+
+#define vsnprintf(str, len, fmt, ap) \
+    __builtin___vsnprintf_chk(str, len, 0, __ssp_bos(str), fmt, ap)
+
+#define gets(str) \
+    __gets_chk(str, __ssp_bos(str))
+
+#define fgets(str, len, fp) \
+    __fgets_chk(str, len, __ssp_bos(str), fp)
+#endif /* __SSP_FORTIFY_LEVEL > 0 */
+
+#endif /* _SSP_STDIO_H_ */

Property changes on: lab4/.minix-src/include/ssp/stdio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/acct.h
===================================================================
--- lab4/.minix-src/include/sys/acct.h	(nonexistent)
+++ lab4/.minix-src/include/sys/acct.h	(revision 13)
@@ -0,0 +1,80 @@
+/*	$NetBSD: acct.h,v 1.27 2009/01/11 02:45:55 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)acct.h	8.3 (Berkeley) 7/10/94
+ */
+
+#ifndef _SYS_ACCT_H_
+#define _SYS_ACCT_H_
+
+/*
+ * Accounting structures; these use a comp_t type which is a 3 bits base 8
+ * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
+ * seconds.
+ */
+typedef uint16_t comp_t;
+
+struct acct {
+	char	  ac_comm[16];	/* command name */
+	comp_t	  ac_utime;	/* user time */
+	comp_t	  ac_stime;	/* system time */
+	comp_t	  ac_etime;	/* elapsed time */
+	time_t	  ac_btime;	/* starting time */
+	uid_t	  ac_uid;	/* user id */
+	gid_t	  ac_gid;	/* group id */
+	uint16_t  ac_mem;	/* average memory usage */
+	comp_t	  ac_io;	/* count of IO blocks */
+	dev_t	  ac_tty;	/* controlling tty */
+
+#define	AFORK	0x01		/* fork'd but not exec'd */
+#define	ASU	0x02		/* used super-user permissions */
+#define	ACOMPAT	0x04		/* used compatibility mode */
+#define	ACORE	0x08		/* dumped core */
+#define	AXSIG	0x10		/* killed by a signal */
+	uint8_t   ac_flag;	/* accounting flags */
+};
+
+/*
+ * 1/AHZ is the granularity of the data encoded in the comp_t fields.
+ * This is not necessarily equal to hz.
+ */
+#define	AHZ	64
+
+#ifdef _KERNEL
+void	acct_init(void);
+int	acct_process(struct lwp *);
+#endif
+
+#endif /* !_SYS_ACCT_H_ */

Property changes on: lab4/.minix-src/include/sys/acct.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/aout_mids.h
===================================================================
--- lab4/.minix-src/include/sys/aout_mids.h	(nonexistent)
+++ lab4/.minix-src/include/sys/aout_mids.h	(revision 13)
@@ -0,0 +1,79 @@
+/* $NetBSD: aout_mids.h,v 1.6 2014/12/08 20:51:02 christos Exp $ */
+
+/*
+ * Copyright (c) 2009, The NetBSD Foundation, Inc.
+ * 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.
+ */
+
+#ifndef _SYS_AOUT_MIDS_H_
+#define _SYS_AOUT_MIDS_H_
+
+/*
+ * a_mid - keep sorted in numerical order for sanity's sake
+ * ensure that: 0 < mid < 0x3ff
+ *
+ * NB: These are still being used in kernel core files.
+ */
+#define	MID_ZERO	0x000	/* unknown - implementation dependent */
+#define	MID_SUN010	0x001	/* sun 68010/68020 binary */
+#define	MID_SUN020	0x002	/* sun 68020-only binary */
+
+#define	MID_PC386	0x064	/* 386 PC binary. (so quoth BFD) */
+
+#define	MID_I386	0x086	/* i386 BSD binary */
+#define	MID_M68K	0x087	/* m68k BSD binary with 8K page sizes */
+#define	MID_M68K4K	0x088	/* m68k BSD binary with 4K page sizes */
+#define	MID_NS32532	0x089	/* ns32532 */
+#define	MID_SPARC	0x08a	/* sparc */
+#define	MID_PMAX	0x08b	/* pmax */
+#define	MID_VAX1K	0x08c	/* VAX 1K page size binaries */
+#define	MID_ALPHA	0x08d	/* Alpha BSD binary */
+#define	MID_MIPS	0x08e	/* big-endian MIPS */
+#define	MID_ARM6	0x08f	/* ARM6 */
+#define	MID_M680002K	0x090	/* m68000 with 2K page sizes */
+#define	MID_SH3		0x091	/* SH3 */
+
+#define	MID_POWERPC	0x095	/* big-endian PowerPC */
+#define	MID_VAX		0x096	/* VAX */
+#define	MID_MIPS1	0x097	/* MIPS1 */
+#define	MID_MIPS2	0x098	/* MIPS2 */
+#define	MID_M88K	0x099	/* m88k BSD */
+#define	MID_HPPA	0x09a	/* HP PARISC */
+#define	MID_SH5_64	0x09b	/* LP64 SH5 */
+#define	MID_SPARC64	0x09c	/* LP64 sparc */
+#define	MID_X86_64	0x09d	/* AMD x86-64 */
+#define	MID_SH5_32	0x09e	/* ILP32 SH5 */
+#define	MID_IA64	0x09f	/* Itanium */
+
+#define	MID_AARCH64	0x0b7	/* ARM AARCH64 */
+#define	MID_OR1K	0x0b8	/* OpenRISC 1000 */
+#define	MID_RISCV	0x0b9	/* Risc-V */
+
+#define	MID_HP200	0x0c8	/* hp200 (68010) BSD binary */
+
+#define	MID_HP300	0x12c	/* hp300 (68020+68881) BSD binary */
+
+#define	MID_HPUX800     0x20b   /* hp800 HP-UX binary */
+#define	MID_HPUX	0x20c	/* hp200/300 HP-UX binary */
+
+#endif /* _SYS_AOUT_MIDS_H_ */

Property changes on: lab4/.minix-src/include/sys/aout_mids.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/ts.h
===================================================================
--- lab4/.minix-src/include/openssl/ts.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/ts.h	(revision 13)
@@ -0,0 +1,862 @@
+/* crypto/ts/ts.h */
+/*
+ * Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL project
+ * 2002, 2003, 2004.
+ */
+/* ====================================================================
+ * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED 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 OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#ifndef HEADER_TS_H
+# define HEADER_TS_H
+
+# include <openssl/opensslconf.h>
+# include <openssl/symhacks.h>
+# ifndef OPENSSL_NO_BUFFER
+#  include <openssl/buffer.h>
+# endif
+# ifndef OPENSSL_NO_EVP
+#  include <openssl/evp.h>
+# endif
+# ifndef OPENSSL_NO_BIO
+#  include <openssl/bio.h>
+# endif
+# include <openssl/stack.h>
+# include <openssl/asn1.h>
+# include <openssl/safestack.h>
+
+# ifndef OPENSSL_NO_RSA
+#  include <openssl/rsa.h>
+# endif
+
+# ifndef OPENSSL_NO_DSA
+#  include <openssl/dsa.h>
+# endif
+
+# ifndef OPENSSL_NO_DH
+#  include <openssl/dh.h>
+# endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+# ifdef WIN32
+/* Under Win32 this is defined in wincrypt.h */
+#  undef X509_NAME
+# endif
+
+# include <openssl/x509.h>
+# include <openssl/x509v3.h>
+
+/*-
+MessageImprint ::= SEQUENCE  {
+     hashAlgorithm                AlgorithmIdentifier,
+     hashedMessage                OCTET STRING  }
+*/
+
+typedef struct TS_msg_imprint_st {
+    X509_ALGOR *hash_algo;
+    ASN1_OCTET_STRING *hashed_msg;
+} TS_MSG_IMPRINT;
+
+/*-
+TimeStampReq ::= SEQUENCE  {
+   version                  INTEGER  { v1(1) },
+   messageImprint           MessageImprint,
+     --a hash algorithm OID and the hash value of the data to be
+     --time-stamped
+   reqPolicy                TSAPolicyId                OPTIONAL,
+   nonce                    INTEGER                    OPTIONAL,
+   certReq                  BOOLEAN                    DEFAULT FALSE,
+   extensions               [0] IMPLICIT Extensions    OPTIONAL  }
+*/
+
+typedef struct TS_req_st {
+    ASN1_INTEGER *version;
+    TS_MSG_IMPRINT *msg_imprint;
+    ASN1_OBJECT *policy_id;     /* OPTIONAL */
+    ASN1_INTEGER *nonce;        /* OPTIONAL */
+    ASN1_BOOLEAN cert_req;      /* DEFAULT FALSE */
+    STACK_OF(X509_EXTENSION) *extensions; /* [0] OPTIONAL */
+} TS_REQ;
+
+/*-
+Accuracy ::= SEQUENCE {
+                seconds        INTEGER           OPTIONAL,
+                millis     [0] INTEGER  (1..999) OPTIONAL,
+                micros     [1] INTEGER  (1..999) OPTIONAL  }
+*/
+
+typedef struct TS_accuracy_st {
+    ASN1_INTEGER *seconds;
+    ASN1_INTEGER *millis;
+    ASN1_INTEGER *micros;
+} TS_ACCURACY;
+
+/*-
+TSTInfo ::= SEQUENCE  {
+    version                      INTEGER  { v1(1) },
+    policy                       TSAPolicyId,
+    messageImprint               MessageImprint,
+      -- MUST have the same value as the similar field in
+      -- TimeStampReq
+    serialNumber                 INTEGER,
+     -- Time-Stamping users MUST be ready to accommodate integers
+     -- up to 160 bits.
+    genTime                      GeneralizedTime,
+    accuracy                     Accuracy                 OPTIONAL,
+    ordering                     BOOLEAN             DEFAULT FALSE,
+    nonce                        INTEGER                  OPTIONAL,
+      -- MUST be present if the similar field was present
+      -- in TimeStampReq.  In that case it MUST have the same value.
+    tsa                          [0] GeneralName          OPTIONAL,
+    extensions                   [1] IMPLICIT Extensions  OPTIONAL   }
+*/
+
+typedef struct TS_tst_info_st {
+    ASN1_INTEGER *version;
+    ASN1_OBJECT *policy_id;
+    TS_MSG_IMPRINT *msg_imprint;
+    ASN1_INTEGER *serial;
+    ASN1_GENERALIZEDTIME *time;
+    TS_ACCURACY *accuracy;
+    ASN1_BOOLEAN ordering;
+    ASN1_INTEGER *nonce;
+    GENERAL_NAME *tsa;
+    STACK_OF(X509_EXTENSION) *extensions;
+} TS_TST_INFO;
+
+/*-
+PKIStatusInfo ::= SEQUENCE {
+    status        PKIStatus,
+    statusString  PKIFreeText     OPTIONAL,
+    failInfo      PKIFailureInfo  OPTIONAL  }
+
+From RFC 1510 - section 3.1.1:
+PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String
+        -- text encoded as UTF-8 String (note:  each UTF8String SHOULD
+        -- include an RFC 1766 language tag to indicate the language
+        -- of the contained text)
+*/
+
+/* Possible values for status. See ts_resp_print.c && ts_resp_verify.c. */
+
+# define TS_STATUS_GRANTED                       0
+# define TS_STATUS_GRANTED_WITH_MODS             1
+# define TS_STATUS_REJECTION                     2
+# define TS_STATUS_WAITING                       3
+# define TS_STATUS_REVOCATION_WARNING            4
+# define TS_STATUS_REVOCATION_NOTIFICATION       5
+
+/*
+ * Possible values for failure_info. See ts_resp_print.c && ts_resp_verify.c
+ */
+
+# define TS_INFO_BAD_ALG                 0
+# define TS_INFO_BAD_REQUEST             2
+# define TS_INFO_BAD_DATA_FORMAT         5
+# define TS_INFO_TIME_NOT_AVAILABLE      14
+# define TS_INFO_UNACCEPTED_POLICY       15
+# define TS_INFO_UNACCEPTED_EXTENSION    16
+# define TS_INFO_ADD_INFO_NOT_AVAILABLE  17
+# define TS_INFO_SYSTEM_FAILURE          25
+
+typedef struct TS_status_info_st {
+    ASN1_INTEGER *status;
+    STACK_OF(ASN1_UTF8STRING) *text;
+    ASN1_BIT_STRING *failure_info;
+} TS_STATUS_INFO;
+
+DECLARE_STACK_OF(ASN1_UTF8STRING)
+DECLARE_ASN1_SET_OF(ASN1_UTF8STRING)
+
+/*-
+TimeStampResp ::= SEQUENCE  {
+     status                  PKIStatusInfo,
+     timeStampToken          TimeStampToken     OPTIONAL }
+*/
+
+typedef struct TS_resp_st {
+    TS_STATUS_INFO *status_info;
+    PKCS7 *token;
+    TS_TST_INFO *tst_info;
+} TS_RESP;
+
+/* The structure below would belong to the ESS component. */
+
+/*-
+IssuerSerial ::= SEQUENCE {
+        issuer                   GeneralNames,
+        serialNumber             CertificateSerialNumber
+        }
+*/
+
+typedef struct ESS_issuer_serial {
+    STACK_OF(GENERAL_NAME) *issuer;
+    ASN1_INTEGER *serial;
+} ESS_ISSUER_SERIAL;
+
+/*-
+ESSCertID ::=  SEQUENCE {
+        certHash                 Hash,
+        issuerSerial             IssuerSerial OPTIONAL
+}
+*/
+
+typedef struct ESS_cert_id {
+    ASN1_OCTET_STRING *hash;    /* Always SHA-1 digest. */
+    ESS_ISSUER_SERIAL *issuer_serial;
+} ESS_CERT_ID;
+
+DECLARE_STACK_OF(ESS_CERT_ID)
+DECLARE_ASN1_SET_OF(ESS_CERT_ID)
+
+/*-
+SigningCertificate ::=  SEQUENCE {
+       certs        SEQUENCE OF ESSCertID,
+       policies     SEQUENCE OF PolicyInformation OPTIONAL
+}
+*/
+
+typedef struct ESS_signing_cert {
+    STACK_OF(ESS_CERT_ID) *cert_ids;
+    STACK_OF(POLICYINFO) *policy_info;
+} ESS_SIGNING_CERT;
+
+TS_REQ *TS_REQ_new(void);
+void TS_REQ_free(TS_REQ *a);
+int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp);
+TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);
+
+TS_REQ *TS_REQ_dup(TS_REQ *a);
+
+TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a);
+int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a);
+TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a);
+int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a);
+
+TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void);
+void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a);
+int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp);
+TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,
+                                   const unsigned char **pp, long length);
+
+TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a);
+
+TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a);
+int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a);
+TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a);
+int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a);
+
+TS_RESP *TS_RESP_new(void);
+void TS_RESP_free(TS_RESP *a);
+int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp);
+TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);
+TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
+TS_RESP *TS_RESP_dup(TS_RESP *a);
+
+TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a);
+int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a);
+TS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a);
+int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a);
+
+TS_STATUS_INFO *TS_STATUS_INFO_new(void);
+void TS_STATUS_INFO_free(TS_STATUS_INFO *a);
+int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp);
+TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a,
+                                   const unsigned char **pp, long length);
+TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a);
+
+TS_TST_INFO *TS_TST_INFO_new(void);
+void TS_TST_INFO_free(TS_TST_INFO *a);
+int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp);
+TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,
+                             long length);
+TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a);
+
+TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
+int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a);
+TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a);
+int i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a);
+
+TS_ACCURACY *TS_ACCURACY_new(void);
+void TS_ACCURACY_free(TS_ACCURACY *a);
+int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp);
+TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp,
+                             long length);
+TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a);
+
+ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void);
+void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a);
+int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **pp);
+ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a,
+                                         const unsigned char **pp,
+                                         long length);
+ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a);
+
+ESS_CERT_ID *ESS_CERT_ID_new(void);
+void ESS_CERT_ID_free(ESS_CERT_ID *a);
+int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp);
+ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp,
+                             long length);
+ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a);
+
+ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void);
+void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a);
+int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **pp);
+ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a,
+                                       const unsigned char **pp, long length);
+ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a);
+
+void ERR_load_TS_strings(void);
+
+int TS_REQ_set_version(TS_REQ *a, long version);
+long TS_REQ_get_version(const TS_REQ *a);
+
+int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint);
+TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a);
+
+int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg);
+X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a);
+
+int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len);
+ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a);
+
+int TS_REQ_set_policy_id(TS_REQ *a, ASN1_OBJECT *policy);
+ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a);
+
+int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce);
+const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a);
+
+int TS_REQ_set_cert_req(TS_REQ *a, int cert_req);
+int TS_REQ_get_cert_req(const TS_REQ *a);
+
+STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a);
+void TS_REQ_ext_free(TS_REQ *a);
+int TS_REQ_get_ext_count(TS_REQ *a);
+int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos);
+int TS_REQ_get_ext_by_OBJ(TS_REQ *a, ASN1_OBJECT *obj, int lastpos);
+int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos);
+X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc);
+X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc);
+int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc);
+void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx);
+
+/* Function declarations for TS_REQ defined in ts/ts_req_print.c */
+
+int TS_REQ_print_bio(BIO *bio, TS_REQ *a);
+
+/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */
+
+int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info);
+TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a);
+
+/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
+void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info);
+PKCS7 *TS_RESP_get_token(TS_RESP *a);
+TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a);
+
+int TS_TST_INFO_set_version(TS_TST_INFO *a, long version);
+long TS_TST_INFO_get_version(const TS_TST_INFO *a);
+
+int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id);
+ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a);
+
+int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint);
+TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a);
+
+int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial);
+const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a);
+
+int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime);
+const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a);
+
+int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy);
+TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a);
+
+int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds);
+const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a);
+
+int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis);
+const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a);
+
+int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros);
+const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a);
+
+int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering);
+int TS_TST_INFO_get_ordering(const TS_TST_INFO *a);
+
+int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce);
+const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a);
+
+int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa);
+GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a);
+
+STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a);
+void TS_TST_INFO_ext_free(TS_TST_INFO *a);
+int TS_TST_INFO_get_ext_count(TS_TST_INFO *a);
+int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos);
+int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, ASN1_OBJECT *obj, int lastpos);
+int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos);
+X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc);
+X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc);
+int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc);
+void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx);
+
+/*
+ * Declarations related to response generation, defined in ts/ts_resp_sign.c.
+ */
+
+/* Optional flags for response generation. */
+
+/* Don't include the TSA name in response. */
+# define TS_TSA_NAME             0x01
+
+/* Set ordering to true in response. */
+# define TS_ORDERING             0x02
+
+/*
+ * Include the signer certificate and the other specified certificates in
+ * the ESS signing certificate attribute beside the PKCS7 signed data.
+ * Only the signer certificates is included by default.
+ */
+# define TS_ESS_CERT_ID_CHAIN    0x04
+
+/* Forward declaration. */
+struct TS_resp_ctx;
+
+/* This must return a unique number less than 160 bits long. */
+typedef ASN1_INTEGER *(*TS_serial_cb) (struct TS_resp_ctx *, void *);
+
+/*
+ * This must return the seconds and microseconds since Jan 1, 1970 in the sec
+ * and usec variables allocated by the caller. Return non-zero for success
+ * and zero for failure.
+ */
+typedef int (*TS_time_cb) (struct TS_resp_ctx *, void *, long *sec,
+                           long *usec);
+
+/*
+ * This must process the given extension. It can modify the TS_TST_INFO
+ * object of the context. Return values: !0 (processed), 0 (error, it must
+ * set the status info/failure info of the response).
+ */
+typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *,
+                                void *);
+
+typedef struct TS_resp_ctx {
+    X509 *signer_cert;
+    EVP_PKEY *signer_key;
+    STACK_OF(X509) *certs;      /* Certs to include in signed data. */
+    STACK_OF(ASN1_OBJECT) *policies; /* Acceptable policies. */
+    ASN1_OBJECT *default_policy; /* It may appear in policies, too. */
+    STACK_OF(EVP_MD) *mds;      /* Acceptable message digests. */
+    ASN1_INTEGER *seconds;      /* accuracy, 0 means not specified. */
+    ASN1_INTEGER *millis;       /* accuracy, 0 means not specified. */
+    ASN1_INTEGER *micros;       /* accuracy, 0 means not specified. */
+    unsigned clock_precision_digits; /* fraction of seconds in time stamp
+                                      * token. */
+    unsigned flags;             /* Optional info, see values above. */
+    /* Callback functions. */
+    TS_serial_cb serial_cb;
+    void *serial_cb_data;       /* User data for serial_cb. */
+    TS_time_cb time_cb;
+    void *time_cb_data;         /* User data for time_cb. */
+    TS_extension_cb extension_cb;
+    void *extension_cb_data;    /* User data for extension_cb. */
+    /* These members are used only while creating the response. */
+    TS_REQ *request;
+    TS_RESP *response;
+    TS_TST_INFO *tst_info;
+} TS_RESP_CTX;
+
+DECLARE_STACK_OF(EVP_MD)
+DECLARE_ASN1_SET_OF(EVP_MD)
+
+/* Creates a response context that can be used for generating responses. */
+TS_RESP_CTX *TS_RESP_CTX_new(void);
+void TS_RESP_CTX_free(TS_RESP_CTX *ctx);
+
+/* This parameter must be set. */
+int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer);
+
+/* This parameter must be set. */
+int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key);
+
+/* This parameter must be set. */
+int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *def_policy);
+
+/* No additional certs are included in the response by default. */
+int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs);
+
+/*
+ * Adds a new acceptable policy, only the default policy is accepted by
+ * default.
+ */
+int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy);
+
+/*
+ * Adds a new acceptable message digest. Note that no message digests are
+ * accepted by default. The md argument is shared with the caller.
+ */
+int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md);
+
+/* Accuracy is not included by default. */
+int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx,
+                             int secs, int millis, int micros);
+
+/*
+ * Clock precision digits, i.e. the number of decimal digits: '0' means sec,
+ * '3' msec, '6' usec, and so on. Default is 0.
+ */
+int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx,
+                                           unsigned clock_precision_digits);
+/* At most we accept usec precision. */
+# define TS_MAX_CLOCK_PRECISION_DIGITS   6
+
+/* No flags are set by default. */
+void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags);
+
+/* Default callback always returns a constant. */
+void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data);
+
+/* Default callback uses the gettimeofday() and gmtime() system calls. */
+void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data);
+
+/*
+ * Default callback rejects all extensions. The extension callback is called
+ * when the TS_TST_INFO object is already set up and not signed yet.
+ */
+/* FIXME: extension handling is not tested yet. */
+void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx,
+                                  TS_extension_cb cb, void *data);
+
+/* The following methods can be used in the callbacks. */
+int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx,
+                                int status, const char *text);
+
+/* Sets the status info only if it is still TS_STATUS_GRANTED. */
+int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx,
+                                     int status, const char *text);
+
+int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure);
+
+/* The get methods below can be used in the extension callback. */
+TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx);
+
+TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx);
+
+/*
+ * Creates the signed TS_TST_INFO and puts it in TS_RESP.
+ * In case of errors it sets the status info properly.
+ * Returns NULL only in case of memory allocation/fatal error.
+ */
+TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio);
+
+/*
+ * Declarations related to response verification,
+ * they are defined in ts/ts_resp_verify.c.
+ */
+
+int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs,
+                             X509_STORE *store, X509 **signer_out);
+
+/* Context structure for the generic verify method. */
+
+/* Verify the signer's certificate and the signature of the response. */
+# define TS_VFY_SIGNATURE        (1u << 0)
+/* Verify the version number of the response. */
+# define TS_VFY_VERSION          (1u << 1)
+/* Verify if the policy supplied by the user matches the policy of the TSA. */
+# define TS_VFY_POLICY           (1u << 2)
+/*
+ * Verify the message imprint provided by the user. This flag should not be
+ * specified with TS_VFY_DATA.
+ */
+# define TS_VFY_IMPRINT          (1u << 3)
+/*
+ * Verify the message imprint computed by the verify method from the user
+ * provided data and the MD algorithm of the response. This flag should not
+ * be specified with TS_VFY_IMPRINT.
+ */
+# define TS_VFY_DATA             (1u << 4)
+/* Verify the nonce value. */
+# define TS_VFY_NONCE            (1u << 5)
+/* Verify if the TSA name field matches the signer certificate. */
+# define TS_VFY_SIGNER           (1u << 6)
+/* Verify if the TSA name field equals to the user provided name. */
+# define TS_VFY_TSA_NAME         (1u << 7)
+
+/* You can use the following convenience constants. */
+# define TS_VFY_ALL_IMPRINT      (TS_VFY_SIGNATURE       \
+                                 | TS_VFY_VERSION       \
+                                 | TS_VFY_POLICY        \
+                                 | TS_VFY_IMPRINT       \
+                                 | TS_VFY_NONCE         \
+                                 | TS_VFY_SIGNER        \
+                                 | TS_VFY_TSA_NAME)
+# define TS_VFY_ALL_DATA         (TS_VFY_SIGNATURE       \
+                                 | TS_VFY_VERSION       \
+                                 | TS_VFY_POLICY        \
+                                 | TS_VFY_DATA          \
+                                 | TS_VFY_NONCE         \
+                                 | TS_VFY_SIGNER        \
+                                 | TS_VFY_TSA_NAME)
+
+typedef struct TS_verify_ctx {
+    /* Set this to the union of TS_VFY_... flags you want to carry out. */
+    unsigned flags;
+    /* Must be set only with TS_VFY_SIGNATURE. certs is optional. */
+    X509_STORE *store;
+    STACK_OF(X509) *certs;
+    /* Must be set only with TS_VFY_POLICY. */
+    ASN1_OBJECT *policy;
+    /*
+     * Must be set only with TS_VFY_IMPRINT. If md_alg is NULL, the
+     * algorithm from the response is used.
+     */
+    X509_ALGOR *md_alg;
+    unsigned char *imprint;
+    unsigned imprint_len;
+    /* Must be set only with TS_VFY_DATA. */
+    BIO *data;
+    /* Must be set only with TS_VFY_TSA_NAME. */
+    ASN1_INTEGER *nonce;
+    /* Must be set only with TS_VFY_TSA_NAME. */
+    GENERAL_NAME *tsa_name;
+} TS_VERIFY_CTX;
+
+int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response);
+int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token);
+
+/*
+ * Declarations related to response verification context,
+ * they are defined in ts/ts_verify_ctx.c.
+ */
+
+/* Set all fields to zero. */
+TS_VERIFY_CTX *TS_VERIFY_CTX_new(void);
+void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx);
+void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx);
+void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx);
+
+/*-
+ * If ctx is NULL, it allocates and returns a new object, otherwise
+ * it returns ctx. It initialises all the members as follows:
+ * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE)
+ * certs = NULL
+ * store = NULL
+ * policy = policy from the request or NULL if absent (in this case
+ *      TS_VFY_POLICY is cleared from flags as well)
+ * md_alg = MD algorithm from request
+ * imprint, imprint_len = imprint from request
+ * data = NULL
+ * nonce, nonce_len = nonce from the request or NULL if absent (in this case
+ *      TS_VFY_NONCE is cleared from flags as well)
+ * tsa_name = NULL
+ * Important: after calling this method TS_VFY_SIGNATURE should be added!
+ */
+TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx);
+
+/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */
+
+int TS_RESP_print_bio(BIO *bio, TS_RESP *a);
+int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a);
+int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a);
+
+/* Common utility functions defined in ts/ts_lib.c */
+
+int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num);
+int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj);
+int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions);
+int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg);
+int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg);
+
+/*
+ * Function declarations for handling configuration options, defined in
+ * ts/ts_conf.c
+ */
+
+X509 *TS_CONF_load_cert(const char *file);
+STACK_OF(X509) *TS_CONF_load_certs(const char *file);
+EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);
+const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
+int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
+                       TS_RESP_CTX *ctx);
+int TS_CONF_set_crypto_device(CONF *conf, const char *section,
+                              const char *device);
+int TS_CONF_set_default_engine(const char *name);
+int TS_CONF_set_signer_cert(CONF *conf, const char *section,
+                            const char *cert, TS_RESP_CTX *ctx);
+int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
+                      TS_RESP_CTX *ctx);
+int TS_CONF_set_signer_key(CONF *conf, const char *section,
+                           const char *key, const char *pass,
+                           TS_RESP_CTX *ctx);
+int TS_CONF_set_def_policy(CONF *conf, const char *section,
+                           const char *policy, TS_RESP_CTX *ctx);
+int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx);
+int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx);
+int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx);
+int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section,
+                                       TS_RESP_CTX *ctx);
+int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx);
+int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx);
+int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section,
+                                  TS_RESP_CTX *ctx);
+
+/* -------------------------------------------------- */
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_TS_strings(void);
+
+/* Error codes for the TS functions. */
+
+/* Function codes. */
+# define TS_F_D2I_TS_RESP                                 147
+# define TS_F_DEF_SERIAL_CB                               110
+# define TS_F_DEF_TIME_CB                                 111
+# define TS_F_ESS_ADD_SIGNING_CERT                        112
+# define TS_F_ESS_CERT_ID_NEW_INIT                        113
+# define TS_F_ESS_SIGNING_CERT_NEW_INIT                   114
+# define TS_F_INT_TS_RESP_VERIFY_TOKEN                    149
+# define TS_F_PKCS7_TO_TS_TST_INFO                        148
+# define TS_F_TS_ACCURACY_SET_MICROS                      115
+# define TS_F_TS_ACCURACY_SET_MILLIS                      116
+# define TS_F_TS_ACCURACY_SET_SECONDS                     117
+# define TS_F_TS_CHECK_IMPRINTS                           100
+# define TS_F_TS_CHECK_NONCES                             101
+# define TS_F_TS_CHECK_POLICY                             102
+# define TS_F_TS_CHECK_SIGNING_CERTS                      103
+# define TS_F_TS_CHECK_STATUS_INFO                        104
+# define TS_F_TS_COMPUTE_IMPRINT                          145
+# define TS_F_TS_CONF_SET_DEFAULT_ENGINE                  146
+# define TS_F_TS_GET_STATUS_TEXT                          105
+# define TS_F_TS_MSG_IMPRINT_SET_ALGO                     118
+# define TS_F_TS_REQ_SET_MSG_IMPRINT                      119
+# define TS_F_TS_REQ_SET_NONCE                            120
+# define TS_F_TS_REQ_SET_POLICY_ID                        121
+# define TS_F_TS_RESP_CREATE_RESPONSE                     122
+# define TS_F_TS_RESP_CREATE_TST_INFO                     123
+# define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO                124
+# define TS_F_TS_RESP_CTX_ADD_MD                          125
+# define TS_F_TS_RESP_CTX_ADD_POLICY                      126
+# define TS_F_TS_RESP_CTX_NEW                             127
+# define TS_F_TS_RESP_CTX_SET_ACCURACY                    128
+# define TS_F_TS_RESP_CTX_SET_CERTS                       129
+# define TS_F_TS_RESP_CTX_SET_DEF_POLICY                  130
+# define TS_F_TS_RESP_CTX_SET_SIGNER_CERT                 131
+# define TS_F_TS_RESP_CTX_SET_STATUS_INFO                 132
+# define TS_F_TS_RESP_GET_POLICY                          133
+# define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION          134
+# define TS_F_TS_RESP_SET_STATUS_INFO                     135
+# define TS_F_TS_RESP_SET_TST_INFO                        150
+# define TS_F_TS_RESP_SIGN                                136
+# define TS_F_TS_RESP_VERIFY_SIGNATURE                    106
+# define TS_F_TS_RESP_VERIFY_TOKEN                        107
+# define TS_F_TS_TST_INFO_SET_ACCURACY                    137
+# define TS_F_TS_TST_INFO_SET_MSG_IMPRINT                 138
+# define TS_F_TS_TST_INFO_SET_NONCE                       139
+# define TS_F_TS_TST_INFO_SET_POLICY_ID                   140
+# define TS_F_TS_TST_INFO_SET_SERIAL                      141
+# define TS_F_TS_TST_INFO_SET_TIME                        142
+# define TS_F_TS_TST_INFO_SET_TSA                         143
+# define TS_F_TS_VERIFY                                   108
+# define TS_F_TS_VERIFY_CERT                              109
+# define TS_F_TS_VERIFY_CTX_NEW                           144
+
+/* Reason codes. */
+# define TS_R_BAD_PKCS7_TYPE                              132
+# define TS_R_BAD_TYPE                                    133
+# define TS_R_CERTIFICATE_VERIFY_ERROR                    100
+# define TS_R_COULD_NOT_SET_ENGINE                        127
+# define TS_R_COULD_NOT_SET_TIME                          115
+# define TS_R_D2I_TS_RESP_INT_FAILED                      128
+# define TS_R_DETACHED_CONTENT                            134
+# define TS_R_ESS_ADD_SIGNING_CERT_ERROR                  116
+# define TS_R_ESS_SIGNING_CERTIFICATE_ERROR               101
+# define TS_R_INVALID_NULL_POINTER                        102
+# define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE          117
+# define TS_R_MESSAGE_IMPRINT_MISMATCH                    103
+# define TS_R_NONCE_MISMATCH                              104
+# define TS_R_NONCE_NOT_RETURNED                          105
+# define TS_R_NO_CONTENT                                  106
+# define TS_R_NO_TIME_STAMP_TOKEN                         107
+# define TS_R_PKCS7_ADD_SIGNATURE_ERROR                   118
+# define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR                 119
+# define TS_R_PKCS7_TO_TS_TST_INFO_FAILED                 129
+# define TS_R_POLICY_MISMATCH                             108
+# define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE      120
+# define TS_R_RESPONSE_SETUP_ERROR                        121
+# define TS_R_SIGNATURE_FAILURE                           109
+# define TS_R_THERE_MUST_BE_ONE_SIGNER                    110
+# define TS_R_TIME_SYSCALL_ERROR                          122
+# define TS_R_TOKEN_NOT_PRESENT                           130
+# define TS_R_TOKEN_PRESENT                               131
+# define TS_R_TSA_NAME_MISMATCH                           111
+# define TS_R_TSA_UNTRUSTED                               112
+# define TS_R_TST_INFO_SETUP_ERROR                        123
+# define TS_R_TS_DATASIGN                                 124
+# define TS_R_UNACCEPTABLE_POLICY                         125
+# define TS_R_UNSUPPORTED_MD_ALGORITHM                    126
+# define TS_R_UNSUPPORTED_VERSION                         113
+# define TS_R_WRONG_CONTENT_TYPE                          114
+
+#ifdef  __cplusplus
+}
+#endif
+#endif

Property changes on: lab4/.minix-src/include/openssl/ts.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/openssl/whrlpool.h
===================================================================
--- lab4/.minix-src/include/openssl/whrlpool.h	(nonexistent)
+++ lab4/.minix-src/include/openssl/whrlpool.h	(revision 13)
@@ -0,0 +1,41 @@
+#ifndef HEADER_WHRLPOOL_H
+# define HEADER_WHRLPOOL_H
+
+# include <openssl/e_os2.h>
+# include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+# define WHIRLPOOL_DIGEST_LENGTH (512/8)
+# define WHIRLPOOL_BBLOCK        512
+# define WHIRLPOOL_COUNTER       (256/8)
+
+typedef struct {
+    union {
+        unsigned char c[WHIRLPOOL_DIGEST_LENGTH];
+        /* double q is here to ensure 64-bit alignment */
+        double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)];
+    } H;
+    unsigned char data[WHIRLPOOL_BBLOCK / 8];
+    unsigned int bitoff;
+    size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)];
+} WHIRLPOOL_CTX;
+
+# ifndef OPENSSL_NO_WHIRLPOOL
+#  ifdef OPENSSL_FIPS
+int private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c);
+#  endif
+int WHIRLPOOL_Init(WHIRLPOOL_CTX *c);
+int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes);
+void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits);
+int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c);
+unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md);
+# endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/openssl/whrlpool.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/pcap/bpf.h
===================================================================
--- lab4/.minix-src/include/pcap/bpf.h	(nonexistent)
+++ lab4/.minix-src/include/pcap/bpf.h	(revision 13)
@@ -0,0 +1 @@
+../net/bpf.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/pcap/bpf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ppath/ppath_impl.h
===================================================================
--- lab4/.minix-src/include/ppath/ppath_impl.h	(nonexistent)
+++ lab4/.minix-src/include/ppath/ppath_impl.h	(revision 13)
@@ -0,0 +1,23 @@
+/* $Id: ppath_impl.h,v 1.1 2011/08/25 16:15:29 dyoung Exp $ */
+
+/* Copyright (c) 2010 David Young.  All rights reserved. */
+
+#if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE))
+#include <lib/libkern/libkern.h>
+#include <sys/errno.h>
+#define	ppath_assert(__x)	KASSERT(__x)
+#else
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#define	ppath_assert(__x)	assert(__x)
+#endif /* defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE)) */
+
+void *ppath_alloc(size_t);
+void ppath_free(void *, size_t);
+void ppath_component_extant_inc(void);
+void ppath_component_extant_dec(void);
+void ppath_extant_inc(void);
+void ppath_extant_dec(void);
+

Property changes on: lab4/.minix-src/include/ppath/ppath_impl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/prop/prop_data.h
===================================================================
--- lab4/.minix-src/include/prop/prop_data.h	(nonexistent)
+++ lab4/.minix-src/include/prop/prop_data.h	(revision 13)
@@ -0,0 +1,54 @@
+/*	$NetBSD: prop_data.h,v 1.3 2008/04/28 20:22:51 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PROPLIB_PROP_DATA_H_
+#define	_PROPLIB_PROP_DATA_H_
+
+#include <prop/prop_object.h>
+
+typedef struct _prop_data *prop_data_t;
+
+__BEGIN_DECLS
+prop_data_t	prop_data_create_data(const void *, size_t);
+prop_data_t	prop_data_create_data_nocopy(const void *, size_t);
+
+prop_data_t	prop_data_copy(prop_data_t);
+
+size_t		prop_data_size(prop_data_t);
+
+void *		prop_data_data(prop_data_t);
+const void *	prop_data_data_nocopy(prop_data_t);
+
+bool		prop_data_equals(prop_data_t, prop_data_t);
+bool		prop_data_equals_data(prop_data_t, const void *, size_t);
+__END_DECLS
+
+#endif /* _PROPLIB_PROP_DATA_H_ */

Property changes on: lab4/.minix-src/include/prop/prop_data.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/prop/prop_object.h
===================================================================
--- lab4/.minix-src/include/prop/prop_object.h	(nonexistent)
+++ lab4/.minix-src/include/prop/prop_object.h	(revision 13)
@@ -0,0 +1,72 @@
+/*	$NetBSD: prop_object.h,v 1.8 2008/12/05 13:11:41 ad Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PROPLIB_PROP_OBJECT_H_
+#define	_PROPLIB_PROP_OBJECT_H_
+
+#include <sys/types.h>
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <stdbool.h>
+#endif /* ! _KERNEL && ! _STANDALONE */
+
+typedef void *prop_object_t;
+
+typedef enum {
+	PROP_TYPE_UNKNOWN	=	0x00000000,
+#ifndef _PROPLIB_ZFS_CONFLICT
+	PROP_TYPE_BOOL		=	0x626f6f6c,	/* 'bool' */
+	PROP_TYPE_NUMBER	=	0x6e6d6272,	/* 'nmbr' */
+	PROP_TYPE_STRING	=	0x73746e67,	/* 'stng' */
+	PROP_TYPE_DATA		=	0x64617461,	/* 'data' */
+	PROP_TYPE_ARRAY		=	0x61726179,	/* 'aray' */
+	PROP_TYPE_DICTIONARY	=	0x64696374,	/* 'dict' */
+	PROP_TYPE_DICT_KEYSYM	=	0x646b6579	/* 'dkey' */
+#endif	/* !_PROPLIB_ZFS_CONFLICT */
+} prop_type_t;
+
+__BEGIN_DECLS
+void		prop_object_retain(prop_object_t);
+void		prop_object_release(prop_object_t);
+
+prop_type_t	prop_object_type(prop_object_t);
+
+bool		prop_object_equals(prop_object_t, prop_object_t);
+bool		prop_object_equals_with_error(prop_object_t, prop_object_t, bool *);
+
+typedef struct _prop_object_iterator *prop_object_iterator_t;
+
+prop_object_t	prop_object_iterator_next(prop_object_iterator_t);
+void		prop_object_iterator_reset(prop_object_iterator_t);
+void		prop_object_iterator_release(prop_object_iterator_t);
+__END_DECLS
+
+#endif /* _PROPLIB_PROP_OBJECT_H_ */

Property changes on: lab4/.minix-src/include/prop/prop_object.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/protocols/routed.h
===================================================================
--- lab4/.minix-src/include/protocols/routed.h	(nonexistent)
+++ lab4/.minix-src/include/protocols/routed.h	(revision 13)
@@ -0,0 +1,175 @@
+/*	$NetBSD: routed.h,v 1.14 2005/12/26 19:01:47 perry Exp $	*/
+
+/*-
+ * Copyright (c) 1983, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)routed.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _PROTOCOLS_ROUTED_H_
+#define	_PROTOCOLS_ROUTED_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Routing Information Protocol
+ *
+ * Derived from Xerox NS Routing Information Protocol
+ * by changing 32-bit net numbers to sockaddr's and
+ * padding stuff to 32-bit boundaries.
+ */
+
+#define RIP_VERSION_0	0
+#define	RIP_VERSION_1	1
+#define	RIP_VERSION_2	2
+
+#define	RIPv1		RIP_VERSION_1
+#define	RIPv2		RIP_VERSION_2
+#ifndef RIPVERSION
+#define	RIPVERSION	RIPv1
+#endif
+
+#define RIP_PORT	520
+
+#if RIPVERSION == 1
+/* We include the V2 fields to get the right size */
+struct netinfo {
+	uint16_t   rip_family;
+	uint16_t   rip_tag;
+	uint32_t   rip_dst;		/* destination net/host */
+	uint32_t   rip_dst_mask;	/* destination mask (V2 only) */
+	uint32_t   rip_router;		/* next host (V2 only) */
+	uint32_t   rip_metric;		/* cost of route */
+};
+#else
+struct netinfo {
+	uint16_t   n_family;
+#define	    RIP_AF_INET	    htons(AF_INET)
+#define	    RIP_AF_UNSPEC   0
+#define	    RIP_AF_AUTH	    0xffff
+	uint16_t   n_tag;		/* optional in RIPv2 */
+	uint32_t   n_dst;		/* destination net or host */
+#define	    RIP_DEFAULT	    0
+	uint32_t   n_mask;		/* netmask in RIPv2 */
+	uint32_t   n_nhop;		/* optional next hop in RIPv2 */
+	uint32_t   n_metric;		/* cost of route */
+};
+#endif
+
+/* RIPv2 authentication */
+struct netauth {
+	uint16_t   a_family;		/* always RIP_AF_AUTH */
+	uint16_t   a_type;
+#define	    RIP_AUTH_NONE   0
+#define	    RIP_AUTH_PW	    htons(2)	/* password type */
+#define	    RIP_AUTH_MD5    htons(3)	/* Keyed MD5 */
+	union {
+#define	    RIP_AUTH_PW_LEN 16
+	    uint8_t    au_pw[RIP_AUTH_PW_LEN];
+	    struct a_md5 {
+		int16_t	md5_pkt_len;	/* RIP-II packet length */
+		int8_t	md5_keyid;	/* key ID and auth data len */
+		int8_t	md5_auth_len;	/* 16 */
+		uint32_t md5_seqno;	/* sequence number */
+		uint32_t rsvd[2];	/* must be 0 */
+#define	    RIP_AUTH_MD5_KEY_LEN   RIP_AUTH_PW_LEN
+#define	    RIP_AUTH_MD5_HASH_XTRA (sizeof(struct netauth)-sizeof(struct a_md5))
+#define	    RIP_AUTH_MD5_HASH_LEN  (RIP_AUTH_MD5_KEY_LEN+RIP_AUTH_MD5_HASH_XTRA)
+	    } a_md5;
+	} au;
+};
+
+struct rip {
+	uint8_t    rip_cmd;		/* request/response */
+	uint8_t    rip_vers;		/* protocol version # */
+	uint16_t   rip_res1;		/* pad to 32-bit boundary */
+	union {				/* variable length... */
+	    struct netinfo ru_nets[1];
+	    int8_t    ru_tracefile[1];
+	    struct netauth ru_auth[1];
+	} ripun;
+#define	rip_nets	ripun.ru_nets
+#define rip_auths	ripun.ru_auth
+#define	rip_tracefile	ripun.ru_tracefile
+};
+
+/* Packet types.
+ */
+#define	RIPCMD_REQUEST		1	/* want info */
+#define	RIPCMD_RESPONSE		2	/* responding to request */
+#define	RIPCMD_TRACEON		3	/* turn tracing on */
+#define	RIPCMD_TRACEOFF		4	/* turn it off */
+
+/* Gated extended RIP to include a "poll" command instead of using
+ * RIPCMD_REQUEST with (RIP_AF_UNSPEC, RIP_DEFAULT).  RFC 1058 says
+ * command 5 is used by Sun Microsystems for its own purposes.
+ */
+#define RIPCMD_POLL		5
+
+#define	RIPCMD_MAX		6
+
+#ifdef RIPCMDS
+const char *ripcmds[RIPCMD_MAX] = {
+	"#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF"
+};
+#endif
+
+#define	HOPCNT_INFINITY		16
+#define	MAXPACKETSIZE		512	/* max broadcast size */
+#define NETS_LEN ((MAXPACKETSIZE-sizeof(struct rip))	\
+		      / sizeof(struct netinfo) +1)
+
+#define INADDR_RIP_GROUP (uint32_t)0xe0000009	/* 224.0.0.9 */
+
+
+/* Timer values used in managing the routing table.
+ *
+ * Complete tables are broadcast every SUPPLY_INTERVAL seconds.
+ * If changes occur between updates, dynamic updates containing only changes
+ * may be sent.  When these are sent, a timer is set for a random value
+ * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates
+ * are sent until the timer expires.
+ *
+ * Every update of a routing entry forces an entry's timer to be reset.
+ * After EXPIRE_TIME without updates, the entry is marked invalid,
+ * but held onto until GARBAGE_TIME so that others may see it, to
+ * "poison" the bad route.
+ */
+#define	SUPPLY_INTERVAL		30	/* time to supply tables */
+#define	MIN_WAITTIME		2	/* min sec until next flash updates */
+#define	MAX_WAITTIME		5	/* max sec until flash update */
+
+#define STALE_TIME		90	/* switch to a new gateway */
+#define	EXPIRE_TIME		180	/* time to mark entry invalid */
+#define	GARBAGE_TIME		240	/* time to garbage collect */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !_PROTOCOLS_ROUTED_H_ */

Property changes on: lab4/.minix-src/include/protocols/routed.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/readline/history.h
===================================================================
--- lab4/.minix-src/include/readline/history.h	(nonexistent)
+++ lab4/.minix-src/include/readline/history.h	(revision 13)
@@ -0,0 +1 @@
+readline.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/readline/history.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ssp/ssp.h
===================================================================
--- lab4/.minix-src/include/ssp/ssp.h	(nonexistent)
+++ lab4/.minix-src/include/ssp/ssp.h	(revision 13)
@@ -0,0 +1,89 @@
+/*	$NetBSD: ssp.h,v 1.13 2015/09/03 20:43:47 plunky Exp $	*/
+
+/*-
+ * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _SSP_SSP_H_
+#define _SSP_SSP_H_
+
+#include <sys/cdefs.h>
+
+#if !defined(__cplusplus)
+# if _FORTIFY_SOURCE > 0 && !defined(__lint__) && \
+     (__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1)
+#  if _FORTIFY_SOURCE > 1
+#   define __SSP_FORTIFY_LEVEL 2
+#  else
+#   define __SSP_FORTIFY_LEVEL 1
+#  endif
+# else
+#  define __SSP_FORTIFY_LEVEL 0
+# endif
+#else
+# define __SSP_FORTIFY_LEVEL 0
+#endif
+
+/* __ssp_real is used by the implementation in libc */
+#if __SSP_FORTIFY_LEVEL == 0
+#define __ssp_real_(fun)	fun
+#else
+#define __ssp_real_(fun)	__ssp_real_ ## fun
+#endif
+#define __ssp_real(fun)		__ssp_real_(fun)
+
+#define __ssp_inline static __inline __attribute__((__always_inline__))
+
+#define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL > 1)
+#define __ssp_bos0(ptr) __builtin_object_size(ptr, 0)
+
+#define __ssp_check(buf, len, bos) \
+	if (bos(buf) != (size_t)-1 && len > bos(buf)) \
+		__chk_fail()
+#define __ssp_redirect_raw(rtype, fun, symbol, args, call, cond, bos) \
+rtype __ssp_real_(fun) args __RENAME(symbol); \
+__ssp_inline rtype fun args __RENAME(__ssp_protected_ ## fun); \
+__ssp_inline rtype fun args { \
+	if (cond) \
+		__ssp_check(__buf, __len, bos); \
+	return __ssp_real_(fun) call; \
+}
+
+#define __ssp_redirect(rtype, fun, args, call) \
+    __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos)
+#define __ssp_redirect0(rtype, fun, args, call) \
+    __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos0)
+
+#define __ssp_overlap(a, b, l) \
+    (((a) <= (b) && (b) < (a) + (l)) || ((b) <= (a) && (a) < (b) + (l)))
+
+__BEGIN_DECLS
+void __stack_chk_fail(void) __dead;
+void __chk_fail(void) __dead;
+__END_DECLS
+
+#endif /* _SSP_SSP_H_ */

Property changes on: lab4/.minix-src/include/ssp/ssp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ssp/unistd.h
===================================================================
--- lab4/.minix-src/include/ssp/unistd.h	(nonexistent)
+++ lab4/.minix-src/include/ssp/unistd.h	(revision 13)
@@ -0,0 +1,51 @@
+/*	$NetBSD: unistd.h,v 1.7 2015/06/25 18:41:03 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _SSP_UNISTD_H_
+#define _SSP_UNISTD_H_
+
+#include <ssp/ssp.h>
+
+#if __SSP_FORTIFY_LEVEL > 0
+__BEGIN_DECLS
+
+__ssp_redirect0(ssize_t, read, (int __fd, void *__buf, size_t __len), \
+    (__fd, __buf, __len));
+
+__ssp_redirect(ssize_t, readlink, (const char *__restrict __path, \
+    char *__restrict __buf, size_t __len), (__path, __buf, __len));
+
+__ssp_redirect_raw(char *, getcwd, getcwd, (char *__buf, size_t __len),
+    (__buf, __len), __buf != 0, __ssp_bos);
+
+__END_DECLS
+
+#endif /* __SSP_FORTIFY_LEVEL > 0 */
+#endif /* _SSP_UNISTD_H_ */

Property changes on: lab4/.minix-src/include/ssp/unistd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ansi.h
===================================================================
--- lab4/.minix-src/include/sys/ansi.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ansi.h	(revision 13)
@@ -0,0 +1,75 @@
+/*	$NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jun-ichiro itojun Hagino and by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_SYS_ANSI_H_
+#define	_SYS_ANSI_H_
+
+#include <machine/ansi.h>
+
+typedef char *		__caddr_t;	/* core address */
+typedef __uint32_t	__gid_t;	/* group id */
+typedef __uint32_t	__in_addr_t;	/* IP(v4) address */
+typedef __uint16_t	__in_port_t;	/* "Internet" port number */
+typedef __uint32_t	__mode_t;	/* file permissions */
+typedef __int64_t	__off_t;	/* file offset */
+typedef __int32_t	__pid_t;	/* process id */
+typedef __uint8_t	__sa_family_t;	/* socket address family */
+typedef unsigned int	__socklen_t;	/* socket-related datum length */
+typedef __uint32_t	__uid_t;	/* user id */
+typedef	__uint64_t	__fsblkcnt_t;	/* fs block count (statvfs) */
+typedef	__uint64_t	__fsfilcnt_t;	/* fs file count */
+
+struct __tag_wctrans_t;
+typedef struct __tag_wctrans_t *__wctrans_t;
+
+struct __tag_wctype_t;
+typedef struct __tag_wctype_t *__wctype_t;
+
+/*
+ * mbstate_t is an opaque object to keep conversion state, during multibyte
+ * stream conversions.  The content must not be referenced by user programs.
+ */
+typedef union {
+	__int64_t __mbstateL; /* for alignment */
+	char __mbstate8[128];
+} __mbstate_t;
+
+#define _BSD_WCTRANS_T_	__wctrans_t	/* wctrans_t */
+#define _BSD_WCTYPE_T_	__wctype_t	/* wctype_t */
+#define _BSD_MBSTATE_T_	__mbstate_t	/* mbstate_t */
+
+#ifdef __lint__
+typedef char *__va_list;
+#else
+typedef __builtin_va_list __va_list;
+#endif
+
+#endif	/* !_SYS_ANSI_H_ */

Property changes on: lab4/.minix-src/include/sys/ansi.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ppath/ppath.h
===================================================================
--- lab4/.minix-src/include/ppath/ppath.h	(nonexistent)
+++ lab4/.minix-src/include/ppath/ppath.h	(revision 13)
@@ -0,0 +1,91 @@
+/* $Id: ppath.h,v 1.1 2011/08/25 16:15:29 dyoung Exp $ */
+
+/* Copyright (c) 2010 David Young.  All rights reserved. */
+
+#ifndef _PPATH_H
+#define _PPATH_H
+
+#include <prop/proplib.h>
+
+#define	PPATH_MAX_COMPONENTS	16
+
+struct _ppath;
+struct _ppath_component;
+typedef struct _ppath ppath_t;
+typedef struct _ppath_component ppath_component_t;
+
+ppath_component_t *ppath_idx(unsigned int);
+ppath_component_t *ppath_key(const char *);
+
+ppath_component_t *ppath_component_retain(ppath_component_t *);
+void ppath_component_release(ppath_component_t *);
+
+ppath_t *ppath_create(void);
+unsigned int ppath_length(const ppath_t *);
+int ppath_component_idx(const ppath_component_t *);
+const char *ppath_component_key(const ppath_component_t *);
+ppath_t *ppath_pop(ppath_t *, ppath_component_t **);
+ppath_t *ppath_push(ppath_t *, ppath_component_t *);
+ppath_component_t *ppath_component_at(const ppath_t *, unsigned int);
+ppath_t *ppath_subpath(const ppath_t *, unsigned int, unsigned int);
+ppath_t *ppath_push_idx(ppath_t *, unsigned int);
+ppath_t *ppath_push_key(ppath_t *, const char *);
+ppath_t *ppath_replace_idx(ppath_t *, unsigned int);
+ppath_t *ppath_replace_key(ppath_t *, const char *);
+
+ppath_t *ppath_copy(const ppath_t *);
+ppath_t *ppath_retain(ppath_t *);
+void ppath_release(ppath_t *);
+
+prop_object_t ppath_lookup(prop_object_t, const ppath_t *);
+
+int ppath_copydel_object(prop_object_t, prop_object_t *, const ppath_t *);
+int ppath_copyset_object(prop_object_t, prop_object_t *, const ppath_t *,
+    prop_object_t);
+int ppath_create_object(prop_object_t, const ppath_t *, prop_object_t);
+int ppath_set_object(prop_object_t, const ppath_t *, prop_object_t);
+int ppath_get_object(prop_object_t, const ppath_t *, prop_object_t *);
+int ppath_delete_object(prop_object_t, const ppath_t *);
+
+int ppath_copydel_bool(prop_object_t, prop_object_t *, const ppath_t *);
+int ppath_copyset_bool(prop_object_t, prop_object_t *, const ppath_t *, bool);
+int ppath_create_bool(prop_object_t, const ppath_t *, bool);
+int ppath_create_int64(prop_object_t, const ppath_t *, int64_t);
+int ppath_create_uint64(prop_object_t, const ppath_t *, uint64_t);
+int ppath_create_data(prop_object_t, const ppath_t *, const void *, size_t);
+int ppath_create_string(prop_object_t, const ppath_t *, const char *);
+int ppath_set_bool(prop_object_t, const ppath_t *, bool);
+int ppath_get_bool(prop_object_t, const ppath_t *, bool *);
+int ppath_delete_bool(prop_object_t, const ppath_t *);
+
+int ppath_copydel_data(prop_object_t, prop_object_t *, const ppath_t *);
+int ppath_copyset_data(prop_object_t, prop_object_t *, const ppath_t *,
+    const void *, size_t);
+int ppath_set_data(prop_object_t, const ppath_t *, const void *, size_t);
+int ppath_get_data(prop_object_t, const ppath_t *, const void **, size_t *);
+int ppath_dup_data(prop_object_t, const ppath_t *, void **, size_t *);
+int ppath_delete_data(prop_object_t, const ppath_t *);
+
+int ppath_copydel_int64(prop_object_t, prop_object_t *, const ppath_t *);
+int ppath_copyset_int64(prop_object_t, prop_object_t *, const ppath_t *,
+    int64_t);
+int ppath_set_int64(prop_object_t, const ppath_t *, int64_t);
+int ppath_get_int64(prop_object_t, const ppath_t *, int64_t *);
+int ppath_delete_int64(prop_object_t, const ppath_t *);
+
+int ppath_copydel_string(prop_object_t, prop_object_t *, const ppath_t *);
+int ppath_copyset_string(prop_object_t, prop_object_t *, const ppath_t *,
+    const char *);
+int ppath_set_string(prop_object_t, const ppath_t *, const char *);
+int ppath_get_string(prop_object_t, const ppath_t *, const char **);
+int ppath_dup_string(prop_object_t, const ppath_t *, char **);
+int ppath_delete_string(prop_object_t, const ppath_t *);
+
+int ppath_copydel_uint64(prop_object_t, prop_object_t *, const ppath_t *);
+int ppath_copyset_uint64(prop_object_t, prop_object_t *, const ppath_t *,
+    uint64_t);
+int ppath_set_uint64(prop_object_t, const ppath_t *, uint64_t);
+int ppath_get_uint64(prop_object_t, const ppath_t *, uint64_t *);
+int ppath_delete_uint64(prop_object_t, const ppath_t *);
+
+#endif /* _PPATH_H */

Property changes on: lab4/.minix-src/include/ppath/ppath.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/prop/prop_bool.h
===================================================================
--- lab4/.minix-src/include/prop/prop_bool.h	(nonexistent)
+++ lab4/.minix-src/include/prop/prop_bool.h	(revision 13)
@@ -0,0 +1,48 @@
+/*	$NetBSD: prop_bool.h,v 1.4 2008/04/28 20:22:51 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PROPLIB_PROP_BOOL_H_
+#define	_PROPLIB_PROP_BOOL_H_
+
+#include <prop/prop_object.h>
+
+typedef struct _prop_bool *prop_bool_t;
+
+__BEGIN_DECLS
+prop_bool_t	prop_bool_create(bool);
+prop_bool_t	prop_bool_copy(prop_bool_t);
+
+bool		prop_bool_true(prop_bool_t);
+
+bool		prop_bool_equals(prop_bool_t, prop_bool_t);
+__END_DECLS
+
+#endif /* _PROPLIB_PROP_BOOL_H_ */

Property changes on: lab4/.minix-src/include/prop/prop_bool.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/prop/prop_number.h
===================================================================
--- lab4/.minix-src/include/prop/prop_number.h	(nonexistent)
+++ lab4/.minix-src/include/prop/prop_number.h	(revision 13)
@@ -0,0 +1,59 @@
+/*	$NetBSD: prop_number.h,v 1.6 2008/04/28 20:22:51 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PROPLIB_PROP_NUMBER_H_
+#define	_PROPLIB_PROP_NUMBER_H_
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <stdint.h>
+#endif
+#include <prop/prop_object.h>
+
+typedef struct _prop_number *prop_number_t;
+
+__BEGIN_DECLS
+prop_number_t	prop_number_create_integer(int64_t);
+prop_number_t	prop_number_create_unsigned_integer(uint64_t);
+
+prop_number_t	prop_number_copy(prop_number_t);
+
+int		prop_number_size(prop_number_t);
+bool		prop_number_unsigned(prop_number_t);
+
+int64_t		prop_number_integer_value(prop_number_t);
+uint64_t	prop_number_unsigned_integer_value(prop_number_t);
+
+bool		prop_number_equals(prop_number_t, prop_number_t);
+bool		prop_number_equals_integer(prop_number_t, int64_t);
+bool		prop_number_equals_unsigned_integer(prop_number_t, uint64_t);
+__END_DECLS
+
+#endif /* _PROPLIB_PROP_NUMBER_H_ */

Property changes on: lab4/.minix-src/include/prop/prop_number.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/protocols/dumprestore.h
===================================================================
--- lab4/.minix-src/include/protocols/dumprestore.h	(nonexistent)
+++ lab4/.minix-src/include/protocols/dumprestore.h	(revision 13)
@@ -0,0 +1,159 @@
+/*	$NetBSD: dumprestore.h,v 1.16 2009/01/11 03:04:12 christos Exp $	*/
+
+/*
+ * Copyright (c) 1980, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dumprestore.h	8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _PROTOCOLS_DUMPRESTORE_H_
+#define _PROTOCOLS_DUMPRESTORE_H_
+
+/*
+ * TP_BSIZE is the size of file blocks on the dump tapes.
+ * Note that TP_BSIZE must be a multiple of DEV_BSIZE.
+ *
+ * NTREC is the number of TP_BSIZE blocks that are written
+ * in each tape record. HIGHDENSITYTREC is the number of
+ * TP_BSIZE blocks that are written in each tape record on
+ * 6250 BPI or higher density tapes.
+ *
+ * TP_NINDIR is the number of indirect pointers in a TS_INODE
+ * or TS_ADDR record. Note that it must be a power of two.
+ */
+#define TP_BSIZE	1024
+#define NTREC   	10
+#define HIGHDENSITYTREC	32
+#define TP_NINDIR	(TP_BSIZE/2)
+#define LBLSIZE		16
+#define NAMELEN		64
+
+#define OFS_MAGIC   	(int)60011
+#define NFS_MAGIC   	(int)60012
+#ifndef FS_UFS2_MAGIC
+#define FS_UFS2_MAGIC   (int)0x19540119
+#endif
+#define CHECKSUM	(int)84446
+
+union u_spcl {
+	char dummy[TP_BSIZE];
+	struct	s_spcl {
+		int32_t	c_type;		    /* record type (see below) */
+		int32_t	c_old_date;	    /* date of this dump */
+		int32_t	c_old_ddate;	    /* date of previous dump */
+		int32_t	c_volume;	    /* dump volume number */
+		int32_t	c_old_tapea;	    /* logical block of this record */
+		uint32_t c_inumber;	    /* number of inode */
+		int32_t	c_magic;	    /* magic number (see above) */
+		int32_t	c_checksum;	    /* record checksum */
+		union {
+			struct ufs1_dinode __uc_dinode;
+			struct {
+				uint16_t __uc_mode;
+				int16_t __uc_spare1[3];
+				uint64_t __uc_size;
+				int32_t __uc_old_atime;
+				int32_t __uc_atimensec;
+				int32_t __uc_old_mtime;
+				int32_t __uc_mtimensec;
+				int32_t __uc_spare2[2];
+				int32_t __uc_rdev;
+				int32_t __uc_birthtimensec;
+				int64_t __uc_birthtime;
+				int64_t __uc_atime;
+				int64_t __uc_mtime;
+				int32_t __uc_spare4[7];
+				uint32_t __uc_file_flags;
+				int32_t __uc_spare5[2];
+				uint32_t __uc_uid;
+				uint32_t __uc_gid;
+				int32_t __uc_spare6[2];
+			} __uc_ino;
+		} __c_ino;
+		int32_t	c_count;	    /* number of valid c_addr entries */
+		char	c_addr[TP_NINDIR];  /* 1 => data; 0 => hole in inode */
+		char	c_label[LBLSIZE];   /* dump label */
+		int32_t	c_level;	    /* level of this dump */
+		char	c_filesys[NAMELEN]; /* name of dumpped file system */
+		char	c_dev[NAMELEN];	    /* name of dumpped device */
+		char	c_host[NAMELEN];    /* name of dumpped host */
+		int32_t	c_flags;	    /* additional information */
+		int32_t	c_old_firstrec;	    /* first record on volume */
+		int64_t c_date;		    /* date of this dump */
+		int64_t c_ddate;	    /* date of previous dump */
+		int64_t c_tapea;	    /* logical block of this record */
+		int64_t c_firstrec;	    /* first record on volume */
+		int32_t	c_spare[24];	    /* reserved for future uses */
+	} s_spcl;
+} u_spcl;
+#define spcl u_spcl.s_spcl
+
+#define c_dinode	__c_ino.__uc_dinode
+#define c_mode		__c_ino.__uc_ino.__uc_mode
+#define c_spare1	__c_ino.__uc_ino.__uc_spare1
+#define c_size		__c_ino.__uc_ino.__uc_size
+#define c_old_atime	__c_ino.__uc_ino.__uc_old_atime
+#define c_atime		__c_ino.__uc_ino.__uc_atime
+#define c_atimensec	__c_ino.__uc_ino.__uc_atimensec
+#define c_mtime		__c_ino.__uc_ino.__uc_mtime
+#define c_mtimensec	__c_ino.__uc_ino.__uc_mtimensec
+#define c_birthtime	__c_ino.__uc_ino.__uc_birthtime
+#define c_birthtimensec	__c_ino.__uc_ino.__uc_birthtimensec
+#define c_old_mtime	__c_ino.__uc_ino.__uc_old_mtime
+#define c_rdev		__c_ino.__uc_ino.__uc_rdev
+#define c_file_flags	__c_ino.__uc_ino.__uc_file_flags
+#define c_uid		__c_ino.__uc_ino.__uc_uid
+#define c_gid		__c_ino.__uc_ino.__uc_gid
+
+/*
+ * special record types
+ */
+#define TS_TAPE 	1	/* dump tape header */
+#define TS_INODE	2	/* beginning of file record */
+#define TS_ADDR 	4	/* continuation of file record */
+#define TS_BITS 	3	/* map of inodes on tape */
+#define TS_CLRI 	6	/* map of inodes deleted since last dump */
+#define TS_END  	5	/* end of volume marker */
+
+/*
+ * flag values
+ */
+#define DR_NEWHEADER	0x0001	/* new format tape header */
+#define DR_NEWINODEFMT	0x0002	/* new format inodes on tape */
+#define DR_EXTATTRIBUTES 0x8000	/* linux: extended attributes */
+
+#define	DUMPOUTFMT	"%-16s %c %s"		/* for printf */
+						/* name, level, ctime(date) */
+#define	DUMPINFMT	"%16s %c %[^\n]\n"	/* inverse for scanf */
+
+#endif /* !_PROTOCOLS_DUMPRESTORE_H_ */

Property changes on: lab4/.minix-src/include/protocols/dumprestore.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/protocols/talkd.h
===================================================================
--- lab4/.minix-src/include/protocols/talkd.h	(nonexistent)
+++ lab4/.minix-src/include/protocols/talkd.h	(revision 13)
@@ -0,0 +1,120 @@
+/*	$NetBSD: talkd.h,v 1.10 2005/12/26 19:01:47 perry Exp $	*/
+
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)talkd.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _PROTOCOLS_TALKD_H_
+#define	_PROTOCOLS_TALKD_H_
+
+/*
+ * This describes the protocol used by the talk server and clients.
+ *
+ * The talk server acts a repository of invitations, responding to
+ * requests by clients wishing to rendezvous for the purpose of
+ * holding a conversation.  In normal operation, a client, the caller,
+ * initiates a rendezvous by sending a CTL_MSG to the server of
+ * type LOOK_UP.  This causes the server to search its invitation
+ * tables to check if an invitation currently exists for the caller
+ * (to speak to the callee specified in the message).  If the lookup
+ * fails, the caller then sends an ANNOUNCE message causing the server
+ * to broadcast an announcement on the callee's login ports requesting
+ * contact.  When the callee responds, the local server uses the
+ * recorded invitation to respond with the appropriate rendezvous
+ * address and the caller and callee client programs establish a
+ * stream connection through which the conversation takes place.
+ */
+
+/*
+ * 4.3 compat sockaddr
+ */
+struct talkd_sockaddr {
+	uint16_t	sa_family;	/* address family */
+	char		sa_data[14];	/* up to 14 bytes of direct address */
+};
+
+/*
+ * Client->server request message format.
+ */
+typedef struct {
+	u_char	  vers;			/* protocol version */
+	u_char	  type;			/* request type, see below */
+	u_char	  answer;		/* not used */
+	u_char	  pad;
+	uint32_t id_num;		/* message id */
+	struct	  talkd_sockaddr addr;	/* old (4.3) style */
+	struct	  talkd_sockaddr ctl_addr;/* old (4.3) style */
+	int32_t	  pid;			/* caller's process id */
+#define	NAME_SIZE	12
+	char	  l_name[NAME_SIZE];	/* caller's name */
+	char	  r_name[NAME_SIZE];	/* callee's name */
+#define	TTY_SIZE	16
+	char	  r_tty[TTY_SIZE];	/* callee's tty name */
+} CTL_MSG;
+
+/*
+ * Server->client response message format.
+ */
+typedef struct {
+	u_char	  vers;		/* protocol version */
+	u_char	  type;		/* type of request message, see below */
+	u_char	  answer;	/* respose to request message, see below */
+	u_char	  pad;
+	uint32_t id_num;	/* message id */
+	struct	  talkd_sockaddr addr; /* address for establishing conversation */
+} CTL_RESPONSE;
+
+#define	TALK_VERSION	1		/* protocol version */
+
+/* message type values */
+#define LEAVE_INVITE	0	/* leave invitation with server */
+#define LOOK_UP		1	/* check for invitation by callee */
+#define DELETE		2	/* delete invitation by caller */
+#define ANNOUNCE	3	/* announce invitation by caller */
+
+/* answer values */
+#define SUCCESS		0	/* operation completed properly */
+#define NOT_HERE	1	/* callee not logged in */
+#define FAILED		2	/* operation failed for unexplained reason */
+#define MACHINE_UNKNOWN	3	/* caller's machine name unknown */
+#define PERMISSION_DENIED 4	/* callee's tty doesn't permit announce */
+#define UNKNOWN_REQUEST	5	/* request has invalid type value */
+#define	BADVERSION	6	/* request has invalid protocol version */
+#define	BADADDR		7	/* request has invalid addr value */
+#define	BADCTLADDR	8	/* request has invalid ctl_addr value */
+
+/*
+ * Operational parameters.
+ */
+#define MAX_LIFE	60	/* max time daemon saves invitations */
+/* RING_WAIT should be 10's of seconds less than MAX_LIFE */
+#define RING_WAIT	30	/* time to wait before resending invitation */
+
+#endif /* !_PROTOCOLS_TALKD_H_ */

Property changes on: lab4/.minix-src/include/protocols/talkd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/rpcsvc/yp_prot.h
===================================================================
--- lab4/.minix-src/include/rpcsvc/yp_prot.h	(nonexistent)
+++ lab4/.minix-src/include/rpcsvc/yp_prot.h	(revision 13)
@@ -0,0 +1,330 @@
+/*	$NetBSD: yp_prot.h,v 1.18 2013/01/23 17:27:35 mbalmer Exp $	*/
+
+/*
+ * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
+ * 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.
+ */
+
+#ifndef _RPCSVC_YP_PROT_H_
+#define _RPCSVC_YP_PROT_H_
+
+/*
+ * YPSERV PROTOCOL:
+ * 
+ * ypserv supports the following procedures:
+ * 
+ * YPPROC_NULL		takes (void), returns (void).
+ * 			called to check if server is alive.
+ * YPPROC_DOMAIN	takes (char *), returns (bool_t).
+ * 			true if ypserv serves the named domain.
+ * YPPROC_DOMAIN_NOACK	takes (char *), returns (bool_t).
+ * 			true if ypserv serves the named domain.
+ *			used for broadcasts, does not ack if ypserv
+ *			doesn't handle named domain.
+ * YPPROC_MATCH		takes (struct ypreq_key), returns (struct ypresp_val)
+ * 			does a lookup.
+ * YPPROC_FIRST		takes (struct ypreq_nokey) returns (ypresp_key_val).
+ * 			gets the first key/datum from the map.
+ * YPPROC_NEXT		takes (struct ypreq_key) returns (ypresp_key_val).
+ * 			gets the next key/datum from the map.
+ * YPPROC_XFR		takes (struct ypreq_xfr), returns (void).
+ * 			tells ypserv to check if there is a new version of
+ *			the map.
+ * YPPROC_CLEAR		takes (void), returns (void).
+ * 			tells ypserv to flush its file cache, so that
+ *			newly transferred files will get read.
+ * YPPROC_ALL		takes (struct ypreq_nokey), returns (bool_t and
+ *			struct ypresp_key_val).
+ * 			returns an array of data, with the bool_t being
+ * 			false on the last datum. read the source, it's
+ *			convoluted.
+ * YPPROC_MASTER	takes (struct ypreq_nokey), returns (ypresp_master).
+ * YPPROC_ORDER		takes (struct ypreq_nokey), returns (ypresp_order).
+ * YPPROC_MAPLIST	takes (char *), returns (struct ypmaplist *).
+ */
+
+/* Program and version symbols, magic numbers */
+#define YPPROG		((unsigned long)100004)
+#define YPVERS		((unsigned long)2)
+#define YPVERS_ORIG	((unsigned long)1)
+
+#define YPMAXRECORD	1024
+#define YPMAXDOMAIN	64
+#define YPMAXMAP	64
+#define YPMAXPEER	256
+
+/*
+ * I don't know if anything of sun's depends on this, or if they
+ * simply defined it so that their own code wouldn't try to send
+ * packets over the ethernet MTU. This YP code doesn't use it.
+ */
+#define YPMSGSZ		1600
+
+#ifndef DATUM
+typedef struct {
+	const char	*dptr;
+	int		 dsize;
+} datum;
+#define DATUM
+#endif
+
+struct ypmap_parms {
+	const char *domain;
+	const char *map;
+	unsigned int ordernum;
+	char *owner;
+};
+
+struct ypreq_key {
+	const char *domain;
+	const char *map;
+	datum keydat;
+};
+
+struct ypreq_nokey {
+	const char *domain;
+	const char *map;
+};
+
+struct ypreq_xfr {
+	struct ypmap_parms map_parms;
+	unsigned int transid;
+	unsigned int proto;
+	unsigned int port;
+};
+#define ypxfr_domain	map_parms.domain
+#define ypxfr_map	map_parms.map
+#define ypxfr_ordernum	map_parms.ordernum
+#define ypxfr_owner	map_parms.owner
+
+struct ypresp_val {
+	unsigned int status;
+	datum valdat;
+};
+
+struct ypresp_key_val {
+	unsigned int status;
+	datum keydat;
+	datum valdat;
+};
+
+struct ypresp_master {
+	unsigned int status;
+	char *master;
+};
+
+struct ypresp_order {
+	unsigned int status;
+	unsigned int ordernum;
+};
+
+struct ypmaplist {
+	char ypml_name[YPMAXMAP + 1];
+	struct ypmaplist *ypml_next;
+};
+
+struct ypresp_maplist {
+	unsigned int status;
+	struct ypmaplist *list;
+};
+
+/* ypserv procedure numbers */
+#define YPPROC_NULL		((unsigned long)0)
+#define YPPROC_DOMAIN		((unsigned long)1)
+#define YPPROC_DOMAIN_NONACK	((unsigned long)2)
+#define YPPROC_MATCH		((unsigned long)3)
+#define YPPROC_FIRST		((unsigned long)4)
+#define YPPROC_NEXT		((unsigned long)5)
+#define YPPROC_XFR		((unsigned long)6)
+#define YPPROC_CLEAR		((unsigned long)7)
+#define YPPROC_ALL		((unsigned long)8)
+#define YPPROC_MASTER		((unsigned long)9)
+#define YPPROC_ORDER		((unsigned long)10)
+#define YPPROC_MAPLIST		((unsigned long)11)
+
+/* ypserv procedure return status values */
+#define YP_TRUE	 	((unsigned int)1)	/* general purpose success code */
+#define YP_NOMORE 	((unsigned int)2)	/* no more entries in map */
+#define YP_FALSE 	((unsigned int)0)	/* general purpose failure code */
+#define YP_NOMAP 	((unsigned int)-1)	/* no such map in domain */
+#define YP_NODOM 	((unsigned int)-2)	/* domain not supported */
+#define YP_NOKEY 	((unsigned int)-3)	/* no such key in map */
+#define YP_BADOP 	((unsigned int)-4)	/* invalid operation */
+#define YP_BADDB 	((unsigned int)-5)	/* server data base is bad */
+#define YP_YPERR 	((unsigned int)-6)	/* YP server error */
+#define YP_BADARGS 	((unsigned int)-7)	/* request arguments bad */
+#define YP_VERS		((unsigned int)-8)	/* YP server version mismatch */
+
+/*
+ * Sun's header file says:
+ * "Domain binding data structure, used by ypclnt package and ypserv modules.
+ * Users of the ypclnt package (or of this protocol) don't HAVE to know about
+ * it, but it must be available to users because _yp_dobind is a public
+ * interface."
+ * 
+ * This is totally bogus! Nowhere else does Sun state that _yp_dobind() is
+ * a public interface, and I don't know any reason anyone would want to call
+ * it. But, just in case anyone does actually expect it to be available..
+ * we provide this.. exactly as Sun wants it.
+ */
+struct dom_binding {
+	struct dom_binding *dom_pnext;
+	char dom_domain[YPMAXDOMAIN + 1];
+	struct sockaddr_in dom_server_addr;
+	u_short dom_server_port;
+	int dom_socket;
+	CLIENT *dom_client;
+	u_short dom_local_port;
+	long dom_vers;
+};
+
+/*
+ * YPBIND PROTOCOL:
+ * 
+ * ypbind supports the following procedures:
+ *
+ * YPBINDPROC_NULL	takes (void), returns (void).
+ *			to check if ypbind is running.
+ * YPBINDPROC_DOMAIN	takes (char *), returns (struct ypbind_resp).
+ *			requests that ypbind start to serve the
+ *			named domain (if it doesn't already)
+ * YPBINDPROC_SETDOM	takes (struct ypbind_setdom), returns (void).
+ *			used by ypset.
+ */
+ 
+#define YPBINDPROG		((unsigned long)100007)
+#define YPBINDVERS		((unsigned long)2)
+#define YPBINDVERS_ORIG		((unsigned long)1)
+
+/* ypbind procedure numbers */
+#define YPBINDPROC_NULL		((unsigned long)0)
+#define YPBINDPROC_DOMAIN	((unsigned long)1)
+#define YPBINDPROC_SETDOM	((unsigned long)2)
+
+/* error code in ypbind_resp.ypbind_status */
+enum ypbind_resptype {
+	YPBIND_SUCC_VAL = 1,
+	YPBIND_FAIL_VAL = 2
+};
+
+/* network order, of course */
+struct ypbind_binding {
+	struct in_addr	ypbind_binding_addr;
+	uint16_t	ypbind_binding_port;
+};
+
+struct ypbind_resp {
+	enum ypbind_resptype	ypbind_status;
+	union {
+		unsigned int		ypbind_error;
+		struct ypbind_binding	ypbind_bindinfo;
+	} ypbind_respbody;
+};
+
+/* error code in ypbind_resp.ypbind_respbody.ypbind_error */
+#define YPBIND_ERR_ERR		1	/* internal error */
+#define YPBIND_ERR_NOSERV	2	/* no bound server for passed domain */
+#define YPBIND_ERR_RESC		3	/* system resource allocation failure */
+
+/*
+ * Request data structure for ypbind "Set domain" procedure.
+ */
+struct ypbind_setdom {
+	char ypsetdom_domain[YPMAXDOMAIN + 1];
+	struct ypbind_binding ypsetdom_binding;
+	unsigned int ypsetdom_vers;
+};
+#define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
+#define ypsetdom_port ypsetdom_binding.ypbind_binding_port
+
+/*
+ * YPPUSH PROTOCOL:
+ * 
+ * Sun says:
+ * "Protocol between clients (ypxfr, only) and yppush
+ *  yppush speaks a protocol in the transient range, which
+ *  is supplied to ypxfr as a command-line parameter when it
+ *  is activated by ypserv."
+ * 
+ * This protocol is not implimented, naturally, because this YP
+ * implimentation only does the client side.
+ */
+#define YPPUSHVERS		((unsigned long)1)
+#define YPPUSHVERS_ORIG		((unsigned long)1)
+
+/* yppush procedure numbers */
+#define YPPUSHPROC_NULL		((unsigned long)0)
+#define YPPUSHPROC_XFRRESP	((unsigned long)1)
+
+struct yppushresp_xfr {
+	unsigned int	transid;
+	unsigned int	status;
+};
+
+/* yppush status value in yppushresp_xfr.status */
+#define YPPUSH_SUCC	((unsigned int)1)	/* Success */
+#define YPPUSH_AGE	((unsigned int)2)	/* Master's version not newer */
+#define YPPUSH_NOMAP 	((unsigned int)-1)	/* Can't find server for map */
+#define YPPUSH_NODOM 	((unsigned int)-2)	/* Domain not supported */
+#define YPPUSH_RSRC 	((unsigned int)-3)	/* Local resource alloc failure */
+#define YPPUSH_RPC 	((unsigned int)-4)	/* RPC failure talking to server */
+#define YPPUSH_MADDR	((unsigned int)-5)	/* Can't get master address */
+#define YPPUSH_YPERR 	((unsigned int)-6)	/* YP server/map db error */
+#define YPPUSH_BADARGS 	((unsigned int)-7)	/* Request arguments bad */
+#define YPPUSH_DBM	((unsigned int)-8)	/* Local dbm operation failed */
+#define YPPUSH_FILE	((unsigned int)-9)	/* Local file I/O operation failed */
+#define YPPUSH_SKEW	((unsigned int)-10)	/* Map version skew during transfer */
+#define YPPUSH_CLEAR	((unsigned int)-11)	/* Can't send "Clear" req to local ypserv */
+#define YPPUSH_FORCE	((unsigned int)-12)	/* No local order number in map - use -f */
+#define YPPUSH_XFRERR	((unsigned int)-13)	/* ypxfr error */
+#define YPPUSH_REFUSED	((unsigned int)-14)	/* Transfer request refused by ypserv */
+
+struct ypall_callback;
+
+__BEGIN_DECLS
+bool_t xdr_domainname(XDR *, char *);	/* obsolete */
+bool_t xdr_peername(XDR *, char *);	/* obsolete */
+bool_t xdr_mapname(XDR *, char *);	/* obsolete */
+bool_t xdr_datum(XDR *, datum *);
+bool_t xdr_ypdomain_wrap_string(XDR *, char **);
+bool_t xdr_ypmap_wrap_string(XDR *, char **);
+bool_t xdr_ypreq_key(XDR *, struct ypreq_key *);
+bool_t xdr_ypreq_nokey(XDR *, struct ypreq_nokey *);
+bool_t xdr_ypreq_xfr(XDR *, struct ypreq_xfr *);
+bool_t xdr_ypresp_val(XDR *, struct ypresp_val *);
+bool_t xdr_ypresp_key_val(XDR *, struct ypresp_key_val *);
+bool_t xdr_ypmap_parms(XDR *, struct ypmap_parms *);
+bool_t xdr_ypowner_wrap_string(XDR *, char **);
+bool_t xdr_yppushresp_xfr(XDR *, struct yppushresp_xfr *);
+bool_t xdr_ypresp_order(XDR *, struct ypresp_order *);
+bool_t xdr_ypresp_master(XDR *, struct ypresp_master *);
+bool_t xdr_ypall(XDR *, struct ypall_callback *);
+bool_t xdr_ypresp_maplist(XDR *, struct ypresp_maplist *);
+bool_t xdr_ypbind_resp(XDR *, struct ypbind_resp *);
+bool_t xdr_ypbind_setdom(XDR *, struct ypbind_setdom *);
+bool_t xdr_ypmaplist(XDR *, struct ypmaplist *);
+bool_t xdr_yp_inaddr(XDR *, struct in_addr *);
+__END_DECLS
+
+#endif /* _RPCSVC_YP_PROT_H_ */

Property changes on: lab4/.minix-src/include/rpcsvc/yp_prot.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/audioio.h
===================================================================
--- lab4/.minix-src/include/sys/audioio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/audioio.h	(revision 13)
@@ -0,0 +1,338 @@
+/*	$NetBSD: audioio.h,v 1.34 2011/09/06 01:16:43 jmcneill Exp $	*/
+
+/*
+ * Copyright (c) 1991-1993 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the Computer Systems
+ *	Engineering Group at Lawrence Berkeley Laboratory.
+ * 4. Neither the name of the University nor of the Laboratory may be used
+ *    to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef _SYS_AUDIOIO_H_
+#define _SYS_AUDIOIO_H_
+
+#include <sys/types.h>
+#include <sys/ioccom.h>
+
+#ifndef _KERNEL
+#include <string.h>	/* Required for memset(3) prototype (AUDIO_INITINFO) */
+#endif /* _KERNEL */
+
+/*
+ * Audio device
+ */
+struct audio_prinfo {
+	u_int	sample_rate;	/* sample rate in bit/s */
+	u_int	channels;	/* number of channels, usually 1 or 2 */
+	u_int	precision;	/* number of bits/sample */
+	u_int	encoding;	/* data encoding (AUDIO_ENCODING_* below) */
+	u_int	gain;		/* volume level */
+	u_int	port;		/* selected I/O port */
+	u_int	seek;		/* BSD extension */
+	u_int	avail_ports;	/* available I/O ports */
+	u_int	buffer_size;	/* total size audio buffer */
+	u_int	_ispare[1];
+	/* Current state of device: */
+	u_int	samples;	/* number of samples */
+	u_int	eof;		/* End Of File (zero-size writes) counter */
+	u_char	pause;		/* non-zero if paused, zero to resume */
+	u_char	error;		/* non-zero if underflow/overflow ocurred */
+	u_char	waiting;	/* non-zero if another process hangs in open */
+	u_char	balance;	/* stereo channel balance */
+	u_char	cspare[2];
+	u_char	open;		/* non-zero if currently open */
+	u_char	active;		/* non-zero if I/O is currently active */
+};
+typedef struct audio_prinfo audio_prinfo_t;
+
+struct audio_info {
+	struct	audio_prinfo play;	/* Info for play (output) side */
+	struct	audio_prinfo record;	/* Info for record (input) side */
+
+	u_int	monitor_gain;	/* input to output mix */
+	/* BSD extensions */
+	u_int	blocksize;	/* H/W read/write block size */
+	u_int	hiwat;		/* output high water mark */
+	u_int	lowat;		/* output low water mark */
+	u_int	_ispare1;
+	u_int	mode;		/* current device mode */
+#define AUMODE_PLAY	0x01
+#define AUMODE_RECORD	0x02
+#define AUMODE_PLAY_ALL	0x04	/* don't do real-time correction */
+};
+typedef struct audio_info audio_info_t;
+
+#define AUDIO_INITINFO(p) \
+	(void)memset((void *)(p), 0xff, sizeof(struct audio_info))
+
+/*
+ * Parameter for the AUDIO_GETDEV ioctl to determine current
+ * audio devices.
+ */
+#define MAX_AUDIO_DEV_LEN       16
+typedef struct audio_device {
+        char name[MAX_AUDIO_DEV_LEN];
+        char version[MAX_AUDIO_DEV_LEN];
+        char config[MAX_AUDIO_DEV_LEN];
+} audio_device_t;
+
+typedef struct audio_offset {
+	u_int	samples;	/* Total number of bytes transferred */
+	u_int	deltablks;	/* Blocks transferred since last checked */
+	u_int	offset;		/* Physical transfer offset in buffer */
+} audio_offset_t;
+
+/*
+ * Supported audio encodings
+ */
+/* Encoding ID's */
+#define	AUDIO_ENCODING_NONE		0 /* no encoding assigned */
+#define	AUDIO_ENCODING_ULAW		1 /* ITU G.711 mu-law */
+#define	AUDIO_ENCODING_ALAW		2 /* ITU G.711 A-law */
+#define	AUDIO_ENCODING_PCM16		3 /* signed linear PCM, obsolete */
+#define AUDIO_ENCODING_LINEAR		AUDIO_ENCODING_PCM16 /* SunOS compat */
+#define	AUDIO_ENCODING_PCM8		4 /* unsigned linear PCM, obsolete */
+#define AUDIO_ENCODING_LINEAR8		AUDIO_ENCODING_PCM8 /* SunOS compat */
+#define	AUDIO_ENCODING_ADPCM		5 /* adaptive differential PCM */
+#define AUDIO_ENCODING_SLINEAR_LE	6
+#define AUDIO_ENCODING_SLINEAR_BE	7
+#define AUDIO_ENCODING_ULINEAR_LE	8
+#define AUDIO_ENCODING_ULINEAR_BE	9
+#define AUDIO_ENCODING_SLINEAR		10
+#define AUDIO_ENCODING_ULINEAR		11
+#define AUDIO_ENCODING_MPEG_L1_STREAM	12
+#define AUDIO_ENCODING_MPEG_L1_PACKETS	13
+#define AUDIO_ENCODING_MPEG_L1_SYSTEM	14
+#define AUDIO_ENCODING_MPEG_L2_STREAM	15
+#define AUDIO_ENCODING_MPEG_L2_PACKETS	16
+#define AUDIO_ENCODING_MPEG_L2_SYSTEM	17
+#define AUDIO_ENCODING_AC3		18
+
+typedef struct audio_encoding {
+	int	index;
+	char	name[MAX_AUDIO_DEV_LEN];
+	int	encoding;
+	int	precision;
+	int	flags;
+#define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */
+} audio_encoding_t;
+
+/*
+ * Balance settings.
+ */
+#define	AUDIO_LEFT_BALANCE	0	/* left channel only	*/
+#define	AUDIO_MID_BALANCE	32	/* equal left/right channel */
+#define	AUDIO_RIGHT_BALANCE	64	/* right channel only	*/
+#define	AUDIO_BALANCE_SHIFT	3
+
+/*
+ * Output ports
+ */
+#define	AUDIO_SPEAKER		0x01	/* built-in speaker */
+#define	AUDIO_HEADPHONE		0x02	/* headphone jack */
+#define	AUDIO_LINE_OUT		0x04	/* line out	 */
+
+/*
+ * Input ports
+ */
+#define	AUDIO_MICROPHONE	0x01	/* microphone */
+#define	AUDIO_LINE_IN		0x02	/* line in	 */
+#define	AUDIO_CD		0x04	/* on-board CD inputs */
+#define	AUDIO_INTERNAL_CD_IN	AUDIO_CD	/* internal CDROM */
+
+/*
+ * Audio device operations
+ */
+#define AUDIO_GETINFO	_IOR('A', 21, struct audio_info)
+#define AUDIO_SETINFO	_IOWR('A', 22, struct audio_info)
+#define AUDIO_DRAIN	_IO('A', 23)
+#define AUDIO_FLUSH	_IO('A', 24)
+#define AUDIO_WSEEK	_IOR('A', 25, u_long)
+#define AUDIO_RERROR	_IOR('A', 26, int)
+#define AUDIO_GETDEV	_IOR('A', 27, struct audio_device)
+#define AUDIO_GETENC	_IOWR('A', 28, struct audio_encoding)
+#define AUDIO_GETFD	_IOR('A', 29, int)
+#define AUDIO_SETFD	_IOWR('A', 30, int)
+#define AUDIO_PERROR	_IOR('A', 31, int)
+#define AUDIO_GETIOFFS	_IOR('A', 32, struct audio_offset)
+#define AUDIO_GETOOFFS	_IOR('A', 33, struct audio_offset)
+#define AUDIO_GETPROPS	_IOR('A', 34, int)
+#define  AUDIO_PROP_FULLDUPLEX	0x01
+#define  AUDIO_PROP_MMAP	0x02
+#define  AUDIO_PROP_INDEPENDENT	0x04
+#define  AUDIO_PROP_PLAYBACK	0x10
+#define  AUDIO_PROP_CAPTURE	0x20
+#define AUDIO_GETBUFINFO	_IOR('A', 35, struct audio_info)
+
+/*
+ * Mixer device
+ */
+#define AUDIO_MIN_GAIN	0
+#define AUDIO_MAX_GAIN	255
+
+typedef struct mixer_level {
+	int num_channels;
+	u_char level[8];	/* [num_channels] */
+} mixer_level_t;
+#define AUDIO_MIXER_LEVEL_MONO	0
+#define AUDIO_MIXER_LEVEL_LEFT	0
+#define AUDIO_MIXER_LEVEL_RIGHT	1
+
+/*
+ * Device operations
+ */
+
+typedef struct audio_mixer_name {
+	char name[MAX_AUDIO_DEV_LEN];
+	int msg_id;
+} audio_mixer_name_t;
+
+typedef struct mixer_devinfo {
+	int index;
+	audio_mixer_name_t label;
+	int type;
+#define AUDIO_MIXER_CLASS	0
+#define AUDIO_MIXER_ENUM	1
+#define AUDIO_MIXER_SET		2
+#define AUDIO_MIXER_VALUE	3
+	int mixer_class;
+	int next, prev;
+#define AUDIO_MIXER_LAST	-1
+	union {
+		struct audio_mixer_enum {
+			int num_mem;
+			struct {
+				audio_mixer_name_t label;
+				int ord;
+			} member[32];
+		} e;
+		struct audio_mixer_set {
+			int num_mem;
+			struct {
+				audio_mixer_name_t label;
+				int mask;
+			} member[32];
+		} s;
+		struct audio_mixer_value {
+			audio_mixer_name_t units;
+			int num_channels;
+			int delta;
+		} v;
+	} un;
+} mixer_devinfo_t;
+
+
+typedef struct mixer_ctrl {
+	int dev;
+	int type;
+	union {
+		int ord;		/* enum */
+		int mask;		/* set */
+		mixer_level_t value;	/* value */
+	} un;
+} mixer_ctrl_t;
+
+/*
+ * Mixer operations
+ */
+#define AUDIO_MIXER_READ		_IOWR('M', 0, mixer_ctrl_t)
+#define AUDIO_MIXER_WRITE		_IOWR('M', 1, mixer_ctrl_t)
+#define AUDIO_MIXER_DEVINFO		_IOWR('M', 2, mixer_devinfo_t)
+
+/*
+ * Well known device names
+ */
+#define AudioNmicrophone	"mic"
+#define AudioNline	"line"
+#define AudioNcd	"cd"
+#define AudioNdac	"dac"
+#define AudioNaux	"aux"
+#define AudioNrecord	"record"
+#define AudioNvolume	"volume"
+#define AudioNmonitor	"monitor"
+#define AudioNtreble	"treble"
+#define AudioNmid	"mid"
+#define AudioNbass	"bass"
+#define AudioNbassboost	"bassboost"
+#define AudioNspeaker	"speaker"
+#define AudioNheadphone	"headphones"
+#define AudioNoutput	"output"
+#define AudioNinput	"input"
+#define AudioNmaster	"master"
+#define AudioNstereo	"stereo"
+#define AudioNmono	"mono"
+#define AudioNloudness	"loudness"
+#define AudioNspatial	"spatial"
+#define AudioNsurround	"surround"
+#define AudioNpseudo	"pseudo"
+#define AudioNmute	"mute"
+#define AudioNenhanced	"enhanced"
+#define AudioNpreamp	"preamp"
+#define AudioNon	"on"
+#define AudioNoff	"off"
+#define AudioNmode	"mode"
+#define AudioNsource	"source"
+#define AudioNfmsynth	"fmsynth"
+#define AudioNwave	"wave"
+#define AudioNmidi	"midi"
+#define AudioNmixerout	"mixerout"
+#define AudioNswap	"swap"	/* swap left and right channels */
+#define AudioNagc	"agc"
+#define AudioNdelay	"delay"
+#define AudioNselect	"select" /* select destination */
+#define AudioNvideo     "video"
+#define AudioNcenter    "center"
+#define AudioNdepth     "depth"
+#define AudioNlfe       "lfe"
+
+#define AudioEmulaw		"mulaw"
+#define AudioEalaw		"alaw"
+#define AudioEadpcm		"adpcm"
+#define AudioEslinear		"slinear"
+#define AudioEslinear_le	"slinear_le"
+#define AudioEslinear_be	"slinear_be"
+#define AudioEulinear		"ulinear"
+#define AudioEulinear_le	"ulinear_le"
+#define AudioEulinear_be	"ulinear_be"
+#define AudioEmpeg_l1_stream	"mpeg_l1_stream"
+#define AudioEmpeg_l1_packets	"mpeg_l1_packets"
+#define AudioEmpeg_l1_system	"mpeg_l1_system"
+#define AudioEmpeg_l2_stream	"mpeg_l2_stream"
+#define AudioEmpeg_l2_packets	"mpeg_l2_packets"
+#define AudioEmpeg_l2_system	"mpeg_l2_system"
+#define AudioEac3		"ac3"
+
+#define AudioCinputs	"inputs"
+#define AudioCoutputs	"outputs"
+#define AudioCrecord	"record"
+#define AudioCmonitor	"monitor"
+#define AudioCequalization	"equalization"
+#define AudioCmodem	"modem"
+
+#endif /* !_SYS_AUDIOIO_H_ */

Property changes on: lab4/.minix-src/include/sys/audioio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/buf.h
===================================================================
--- lab4/.minix-src/include/sys/buf.h	(nonexistent)
+++ lab4/.minix-src/include/sys/buf.h	(revision 13)
@@ -0,0 +1,310 @@
+/*     $NetBSD: buf.h,v 1.121 2015/03/28 19:24:04 maxv Exp $ */
+
+/*-
+ * Copyright (c) 1999, 2000, 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center, and by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)buf.h	8.9 (Berkeley) 3/30/95
+ */
+
+#ifndef _SYS_BUF_H_
+#define	_SYS_BUF_H_
+
+#include <sys/pool.h>
+#include <sys/queue.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+#include <sys/rbtree.h>
+#if defined(_KERNEL)
+#include <sys/workqueue.h>
+#endif /* defined(_KERNEL) */
+
+struct buf;
+struct mount;
+struct vnode;
+struct kauth_cred;
+
+#define NOLIST ((struct buf *)0x87654321)
+
+extern kmutex_t bufcache_lock;
+extern kmutex_t buffer_lock;
+
+/*
+ * The buffer header describes an I/O operation in the kernel.
+ *
+ * Field markings and the corresponding locks:
+ *
+ * b	thread of execution that holds BC_BUSY, does not correspond
+ *	  directly to any particular LWP
+ * c	bufcache_lock
+ * o	b_objlock
+ *
+ * For buffers associated with a vnode, b_objlock points to vp->v_interlock.
+ * If not associated with a vnode, it points to the generic buffer_lock.
+ */
+struct buf {
+	union {
+		TAILQ_ENTRY(buf) u_actq;
+		rb_node_t u_rbnode;
+#if defined(_KERNEL) /* u_work is smaller than u_actq. XXX */
+		struct work u_work;
+#endif /* defined(_KERNEL) */
+	} b_u;					/* b: device driver queue */
+#define	b_actq	b_u.u_actq
+#define	b_work	b_u.u_work
+	void			(*b_iodone)(struct buf *);/* b: call when done */
+	int			b_error;	/* b: errno value. */
+	int			b_resid;	/* b: remaining I/O. */
+	u_int			b_flags;	/* b: B_* flags */
+	int			b_prio;		/* b: priority for queue */
+	int			b_bufsize;	/* b: allocated size */
+	int			b_bcount;	/* b: valid bytes in buffer */
+	dev_t			b_dev;		/* b: associated device */
+	void			*b_data;	/* b: fs private data */
+	daddr_t			b_blkno;	/* b: physical block number
+						      (partition relative) */
+	daddr_t			b_rawblkno;	/* b: raw physical block number
+						      (volume relative) */
+	struct proc		*b_proc;	/* b: proc if BB_PHYS */
+	void			*b_saveaddr;	/* b: saved b_data for physio */
+
+	/*
+	 * b: private data for owner.
+	 *  - buffer cache buffers are owned by corresponding filesystem.
+	 *  - non-buffer cache buffers are owned by subsystem which
+	 *    allocated them. (filesystem, disk driver, etc)
+	 */
+	void	*b_private;
+	off_t	b_dcookie;		/* NFS: Offset cookie if dir block */
+
+	kcondvar_t		b_busy;		/* c: threads waiting on buf */
+	u_int			b_refcnt;	/* c: refcount for b_busy */
+	void			*b_unused;	/*  : unused */
+	LIST_ENTRY(buf)		b_hash;		/* c: hash chain */
+	LIST_ENTRY(buf)		b_vnbufs;	/* c: associated vnode */
+	TAILQ_ENTRY(buf)	b_freelist;	/* c: position if not active */
+	LIST_ENTRY(buf)		b_wapbllist;	/* c: transaction buffer list */
+	daddr_t			b_lblkno;	/* c: logical block number */
+	int			b_freelistindex;/* c: free list index (BQ_) */
+	u_int			b_cflags;	/* c: BC_* flags */
+	struct vnode		*b_vp;		/* c: file vnode */
+
+	kcondvar_t		b_done;		/* o: waiting on completion */
+	u_int			b_oflags;	/* o: BO_* flags */
+	kmutex_t		*b_objlock;	/* o: completion lock */
+};
+
+/*
+ * For portability with historic industry practice, the cylinder number has
+ * to be maintained in the `b_resid' field.
+ */
+#define	b_cylinder b_resid		/* Cylinder number for disksort(). */
+
+/*
+ * These flags are kept in b_cflags (owned by buffer cache).
+ */
+#define	BC_AGE		0x00000001	/* Move to age queue when I/O done. */
+#define	BC_BUSY		0x00000010	/* I/O in progress. */
+#define	BC_INVAL	0x00002000	/* Does not contain valid info. */
+#define	BC_NOCACHE	0x00008000	/* Do not cache block after use. */
+#define	BC_WANTED	0x00800000	/* Process wants this buffer. */
+#define	BC_VFLUSH	0x04000000	/* Buffer is being synced. */
+
+/*
+ * These flags are kept in b_oflags (owned by associated object).
+ */
+#define	BO_DELWRI	0x00000080	/* Delay I/O until buffer reused. */
+#define	BO_DONE		0x00000200	/* I/O completed. */
+
+/*
+ * These flags are kept in b_flags (owned by buffer holder).
+ */
+#define	B_WRITE		0x00000000	/* Write buffer (pseudo flag). */
+#define	B_ASYNC		0x00000004	/* Start I/O, do not wait. */
+#define	B_COWDONE	0x00000400	/* Copy-on-write already done. */
+#define	B_GATHERED	0x00001000	/* LFS: already in a segment. */
+#define	B_LOCKED	0x00004000	/* Locked in core (not reusable). */
+#define	B_PHYS		0x00040000	/* I/O to user memory. */
+#define	B_RAW		0x00080000	/* Set by physio for raw transfers. */
+#define	B_READ		0x00100000	/* Read buffer. */
+#define	B_DEVPRIVATE	0x02000000	/* Device driver private flag. */
+
+#define BUF_FLAGBITS \
+    "\20\1AGE\3ASYNC\4BAD\5BUSY\10DELWRI" \
+    "\12DONE\13COWDONE\15GATHERED\16INVAL\17LOCKED\20NOCACHE" \
+    "\23PHYS\24RAW\25READ\32DEVPRIVATE\33VFLUSH"
+
+/* Avoid weird code due to B_WRITE being a "pseudo flag" */
+#define BUF_ISREAD(bp)	(((bp)->b_flags & B_READ) == B_READ)
+#define BUF_ISWRITE(bp)	(((bp)->b_flags & B_READ) == B_WRITE)
+
+/*
+ * This structure describes a clustered I/O.  It is stored in the b_saveaddr
+ * field of the buffer on which I/O is done.  At I/O completion, cluster
+ * callback uses the structure to parcel I/O's to individual buffers, and
+ * then free's this structure.
+ */
+struct cluster_save {
+	long	bs_bcount;		/* Saved b_bcount. */
+	long	bs_bufsize;		/* Saved b_bufsize. */
+	void	*bs_saveaddr;		/* Saved b_addr. */
+	int	bs_nchildren;		/* Number of associated buffers. */
+	struct buf *bs_children;	/* List of associated buffers. */
+};
+
+/*
+ * Zero out the buffer's data area.
+ */
+#define	clrbuf(bp)							\
+do {									\
+	memset((bp)->b_data, 0, (u_int)(bp)->b_bcount);			\
+	(bp)->b_resid = 0;						\
+} while (/* CONSTCOND */ 0)
+
+/* Flags to low-level allocation routines. */
+#define B_CLRBUF	0x01	/* Request allocated buffer be cleared. */
+#define B_SYNC		0x02	/* Do all allocations synchronously. */
+#define B_METAONLY	0x04	/* Return indirect block buffer. */
+#define B_CONTIG	0x08	/* Allocate file contiguously. */
+
+/* Flags to bread() and breadn(). */
+#define B_MODIFY	0x01	/* Hint: caller might modify buffer */
+
+#ifdef _KERNEL
+
+#define	BIO_GETPRIO(bp)		((bp)->b_prio)
+#define	BIO_SETPRIO(bp, prio)	(bp)->b_prio = (prio)
+#define	BIO_COPYPRIO(bp1, bp2)	BIO_SETPRIO(bp1, BIO_GETPRIO(bp2))
+
+#define	BPRIO_NPRIO		3
+#define	BPRIO_TIMECRITICAL	2
+#define	BPRIO_TIMELIMITED	1
+#define	BPRIO_TIMENONCRITICAL	0
+#define	BPRIO_DEFAULT		BPRIO_TIMELIMITED
+
+extern	u_int nbuf;		/* The number of buffer headers */
+
+/*
+ * Definitions for the buffer free lists.
+ */
+#define	BQUEUES		4		/* number of free buffer queues */
+
+#define	BQ_LOCKED	0		/* super-blocks &c */
+#define	BQ_LRU		1		/* lru, useful buffers */
+#define	BQ_AGE		2		/* rubbish */
+#define	BQ_EMPTY	3		/* buffer headers with no memory */
+
+struct bqueue {
+	TAILQ_HEAD(, buf) bq_queue;
+	uint64_t bq_bytes;
+	buf_t *bq_marker;
+};
+
+extern struct bqueue bufqueues[BQUEUES];
+
+__BEGIN_DECLS
+int	allocbuf(buf_t *, int, int);
+void	bawrite(buf_t *);
+void	bdwrite(buf_t *);
+void	biodone(buf_t *);
+int	biowait(buf_t *);
+int	bread(struct vnode *, daddr_t, int, int, buf_t **);
+int	breadn(struct vnode *, daddr_t, int, daddr_t *, int *, int,
+	       int, buf_t **);
+void	brelsel(buf_t *, int);
+void	brelse(buf_t *, int);
+void	bremfree(buf_t *);
+void	bufinit(void);
+void	bufinit2(void);
+int	bwrite(buf_t *);
+buf_t	*getblk(struct vnode *, daddr_t, int, int, int);
+buf_t	*geteblk(int);
+buf_t	*incore(struct vnode *, daddr_t);
+
+void	minphys(buf_t *);
+int	physio(void (*)(buf_t *), buf_t *, dev_t, int,
+	       void (*)(buf_t *), struct uio *);
+
+void	brelvp(buf_t *);
+void	reassignbuf(buf_t *, struct vnode *);
+void	bgetvp(struct vnode *, buf_t *);
+int	buf_syncwait(void);
+u_long	buf_memcalc(void);
+int	buf_drain(int);
+int	buf_setvalimit(vsize_t);
+#if defined(DDB) || defined(DEBUGPRINT)
+void	vfs_buf_print(buf_t *, int, void (*)(const char *, ...)
+    __printflike(1, 2));
+#endif
+buf_t	*getiobuf(struct vnode *, bool);
+void	putiobuf(buf_t *);
+void	buf_init(buf_t *);
+void	buf_destroy(buf_t *);
+int	bbusy(buf_t *, bool, int, kmutex_t *);
+
+void	nestiobuf_iodone(buf_t *);
+void	nestiobuf_setup(buf_t *, buf_t *, int, size_t);
+void	nestiobuf_done(buf_t *, int, int);
+
+__END_DECLS
+#endif /* _KERNEL */
+#endif /* !_SYS_BUF_H_ */

Property changes on: lab4/.minix-src/include/sys/buf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/cdefs.h
===================================================================
--- lab4/.minix-src/include/sys/cdefs.h	(nonexistent)
+++ lab4/.minix-src/include/sys/cdefs.h	(revision 13)
@@ -0,0 +1,628 @@
+/*	$NetBSD: cdefs.h,v 1.126 2015/08/30 08:46:44 mlelstv Exp $	*/
+
+/* * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Berkeley Software Design, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
+ */
+
+#ifndef	_SYS_CDEFS_H_
+#define	_SYS_CDEFS_H_
+
+#ifdef _KERNEL_OPT
+#include "opt_diagnostic.h"
+#endif
+
+/*
+ * Macro to test if we're using a GNU C compiler of a specific vintage
+ * or later, for e.g. features that appeared in a particular version
+ * of GNU C.  Usage:
+ *
+ *	#if __GNUC_PREREQ__(major, minor)
+ *	...cool feature...
+ *	#else
+ *	...delete feature...
+ *	#endif
+ */
+#ifdef __GNUC__
+#define	__GNUC_PREREQ__(x, y)						\
+	((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) ||			\
+	 (__GNUC__ > (x)))
+#else
+#define	__GNUC_PREREQ__(x, y)	0
+#endif
+
+#include <machine/cdefs.h>
+#ifdef __ELF__
+#include <sys/cdefs_elf.h>
+#else
+#include <sys/cdefs_aout.h>
+#endif
+
+#ifdef __GNUC__
+#define	__strict_weak_alias(alias,sym)					\
+	__unused static __typeof__(alias) *__weak_alias_##alias = &sym;	\
+	__weak_alias(alias,sym)
+#else
+#define	__strict_weak_alias(alias,sym) __weak_alias(alias,sym)
+#endif
+
+/*
+ * Optional marker for size-optimised MD calling convention.
+ */
+#ifndef __compactcall
+#define	__compactcall
+#endif
+
+/*
+ * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
+ * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
+ * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
+ * in between its arguments.  __CONCAT can also concatenate double-quoted
+ * strings produced by the __STRING macro, but this only works with ANSI C.
+ */
+
+#define	___STRING(x)	__STRING(x)
+#define	___CONCAT(x,y)	__CONCAT(x,y)
+
+#if __STDC__ || defined(__cplusplus)
+#define	__P(protos)	protos		/* full-blown ANSI C */
+#define	__CONCAT(x,y)	x ## y
+#define	__STRING(x)	#x
+
+#define	__const		const		/* define reserved names to standard */
+#define	__signed	signed
+#define	__volatile	volatile
+#if defined(__cplusplus) || defined(__PCC__)
+#define	__inline	inline		/* convert to C++/C99 keyword */
+#else
+#if !defined(__GNUC__) && !defined(__lint__)
+#define	__inline			/* delete GCC keyword */
+#endif /* !__GNUC__  && !__lint__ */
+#endif /* !__cplusplus */
+
+#else	/* !(__STDC__ || __cplusplus) */
+#define	__P(protos)	()		/* traditional C preprocessor */
+#define	__CONCAT(x,y)	x/**/y
+#define	__STRING(x)	"x"
+
+#ifndef __GNUC__
+#define	__const				/* delete pseudo-ANSI C keywords */
+#define	__inline
+#define	__signed
+#define	__volatile
+#endif	/* !__GNUC__ */
+
+/*
+ * In non-ANSI C environments, new programs will want ANSI-only C keywords
+ * deleted from the program and old programs will want them left alone.
+ * Programs using the ANSI C keywords const, inline etc. as normal
+ * identifiers should define -DNO_ANSI_KEYWORDS.
+ */
+#ifndef	NO_ANSI_KEYWORDS
+#define	const		__const		/* convert ANSI C keywords */
+#define	inline		__inline
+#define	signed		__signed
+#define	volatile	__volatile
+#endif /* !NO_ANSI_KEYWORDS */
+#endif	/* !(__STDC__ || __cplusplus) */
+
+/*
+ * Used for internal auditing of the NetBSD source tree.
+ */
+#ifdef __AUDIT__
+#define	__aconst	__const
+#else
+#define	__aconst
+#endif
+
+/*
+ * Compile Time Assertion.
+ */
+#ifdef __COUNTER__
+#define	__CTASSERT(x)		__CTASSERT0(x, __ctassert, __COUNTER__)
+#else
+#define	__CTASSERT(x)		__CTASSERT99(x, __INCLUDE_LEVEL__, __LINE__)
+#define	__CTASSERT99(x, a, b)	__CTASSERT0(x, __CONCAT(__ctassert,a), \
+					       __CONCAT(_,b))
+#endif
+#define	__CTASSERT0(x, y, z)	__CTASSERT1(x, y, z) 
+#define	__CTASSERT1(x, y, z)	typedef char y ## z[/*CONSTCOND*/(x) ? 1 : -1] __unused
+
+/*
+ * The following macro is used to remove const cast-away warnings
+ * from gcc -Wcast-qual; it should be used with caution because it
+ * can hide valid errors; in particular most valid uses are in
+ * situations where the API requires it, not to cast away string
+ * constants. We don't use *intptr_t on purpose here and we are
+ * explicit about unsigned long so that we don't have additional
+ * dependencies.
+ */
+#define __UNCONST(a)	((void *)(unsigned long)(const void *)(a))
+
+/*
+ * The following macro is used to remove the volatile cast-away warnings
+ * from gcc -Wcast-qual; as above it should be used with caution
+ * because it can hide valid errors or warnings.  Valid uses include
+ * making it possible to pass a volatile pointer to memset().
+ * For the same reasons as above, we use unsigned long and not intptr_t.
+ */
+#define __UNVOLATILE(a)	((void *)(unsigned long)(volatile void *)(a))
+
+/*
+ * GCC2 provides __extension__ to suppress warnings for various GNU C
+ * language extensions under "-ansi -pedantic".
+ */
+#if !__GNUC_PREREQ__(2, 0)
+#define	__extension__		/* delete __extension__ if non-gcc or gcc1 */
+#endif
+
+/*
+ * GCC1 and some versions of GCC2 declare dead (non-returning) and
+ * pure (no side effects) functions using "volatile" and "const";
+ * unfortunately, these then cause warnings under "-ansi -pedantic".
+ * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
+ * these work for GNU C++ (modulo a slight glitch in the C++ grammar
+ * in the distribution version of 2.5.5).
+ *
+ * GCC defines a pure function as depending only on its arguments and
+ * global variables.  Typical examples are strlen and sqrt.
+ *
+ * GCC defines a const function as depending only on its arguments.
+ * Therefore calling a const function again with identical arguments
+ * will always produce the same result.
+ *
+ * Rounding modes for floating point operations are considered global
+ * variables and prevent sqrt from being a const function.
+ *
+ * Calls to const functions can be optimised away and moved around
+ * without limitations.
+ */
+#if !__GNUC_PREREQ__(2, 0)
+#define __attribute__(x)
+#endif
+
+#if __GNUC_PREREQ__(2, 5)
+#define	__dead		__attribute__((__noreturn__))
+#elif defined(__GNUC__)
+#define	__dead		__volatile
+#else
+#define	__dead
+#endif
+
+#if __GNUC_PREREQ__(2, 96)
+#define	__pure		__attribute__((__pure__))
+#elif defined(__GNUC__)
+#define	__pure		__const
+#else
+#define	__pure
+#endif
+
+#if __GNUC_PREREQ__(2, 5)
+#define	__constfunc	__attribute__((__const__))
+#else
+#define	__constfunc
+#endif
+
+#if __GNUC_PREREQ__(3, 0)
+#define	__noinline	__attribute__((__noinline__))
+#else
+#define	__noinline	/* nothing */
+#endif
+
+#if __GNUC_PREREQ__(3, 0)
+#define	__always_inline	__attribute__((__always_inline__))
+#else
+#define	__always_inline	/* nothing */
+#endif
+
+#if __GNUC_PREREQ__(4, 1)
+#define	__returns_twice	__attribute__((__returns_twice__))
+#else
+#define	__returns_twice	/* nothing */
+#endif
+
+#if __GNUC_PREREQ__(4, 5)
+#define	__noclone	__attribute__((__noclone__))
+#else
+#define	__noclone	/* nothing */
+#endif
+
+/*
+ * __unused: Note that item or function might be unused.
+ */
+#if __GNUC_PREREQ__(2, 7)
+#define	__unused	__attribute__((__unused__))
+#else
+#define	__unused	/* delete */
+#endif
+
+/*
+ * __used: Note that item is needed, even if it appears to be unused.
+ */
+#if __GNUC_PREREQ__(3, 1)
+#define	__used		__attribute__((__used__))
+#else
+#define	__used		__unused
+#endif
+
+/*
+ * __diagused: Note that item is used in diagnostic code, but may be
+ * unused in non-diagnostic code.
+ */
+#if (defined(_KERNEL) && defined(DIAGNOSTIC)) \
+ || (!defined(_KERNEL) && !defined(NDEBUG))
+#define	__diagused	/* empty */
+#else
+#define	__diagused	__unused
+#endif
+
+/*
+ * __debugused: Note that item is used in debug code, but may be
+ * unused in non-debug code.
+ */
+#if defined(DEBUG)
+#define	__debugused	/* empty */
+#else
+#define	__debugused	__unused
+#endif
+
+#if __GNUC_PREREQ__(3, 1)
+#define	__noprofile	__attribute__((__no_instrument_function__))
+#else
+#define	__noprofile	/* nothing */
+#endif
+
+#if __GNUC_PREREQ__(4, 6) || defined(__clang__)
+#define	__unreachable()	__builtin_unreachable()
+#else
+#define	__unreachable()	do {} while (/*CONSTCOND*/0)
+#endif
+
+#if defined(__cplusplus)
+#define	__BEGIN_EXTERN_C	extern "C" {
+#define	__END_EXTERN_C		}
+#define	__static_cast(x,y)	static_cast<x>(y)
+#else
+#define	__BEGIN_EXTERN_C
+#define	__END_EXTERN_C
+#define	__static_cast(x,y)	(x)y
+#endif
+
+#if __GNUC_PREREQ__(4, 0)
+#  define __dso_public	__attribute__((__visibility__("default")))
+#  define __dso_hidden	__attribute__((__visibility__("hidden")))
+#  define __BEGIN_PUBLIC_DECLS	\
+	_Pragma("GCC visibility push(default)") __BEGIN_EXTERN_C
+#  define __END_PUBLIC_DECLS	__END_EXTERN_C _Pragma("GCC visibility pop")
+#  define __BEGIN_HIDDEN_DECLS	\
+	_Pragma("GCC visibility push(hidden)") __BEGIN_EXTERN_C
+#  define __END_HIDDEN_DECLS	__END_EXTERN_C _Pragma("GCC visibility pop")
+#else
+#  define __dso_public
+#  define __dso_hidden
+#  define __BEGIN_PUBLIC_DECLS	__BEGIN_EXTERN_C
+#  define __END_PUBLIC_DECLS	__END_EXTERN_C
+#  define __BEGIN_HIDDEN_DECLS	__BEGIN_EXTERN_C
+#  define __END_HIDDEN_DECLS	__END_EXTERN_C
+#endif
+#if __GNUC_PREREQ__(4, 2)
+#  define __dso_protected	__attribute__((__visibility__("protected")))
+#else
+#  define __dso_protected
+#endif
+
+#define	__BEGIN_DECLS		__BEGIN_PUBLIC_DECLS
+#define	__END_DECLS		__END_PUBLIC_DECLS
+
+/*
+ * Non-static C99 inline functions are optional bodies.  They don't
+ * create global symbols if not used, but can be replaced if desirable.
+ * This differs from the behavior of GCC before version 4.3.  The nearest
+ * equivalent for older GCC is `extern inline'.  For newer GCC, use the
+ * gnu_inline attribute additionally to get the old behavior.
+ *
+ * For C99 compilers other than GCC, the C99 behavior is expected.
+ */
+#if defined(__GNUC__) && defined(__GNUC_STDC_INLINE__)
+#define	__c99inline	extern __attribute__((__gnu_inline__)) __inline
+#elif defined(__GNUC__)
+#define	__c99inline	extern __inline
+#elif defined(__STDC_VERSION__)
+#define	__c99inline	__inline
+#endif
+
+#if defined(__lint__)
+#define	__packed	__packed
+#define	__aligned(x)	/* delete */
+#define	__section(x)	/* delete */
+#elif __GNUC_PREREQ__(2, 7) || defined(__PCC__)
+#define	__packed	__attribute__((__packed__))
+#define	__aligned(x)	__attribute__((__aligned__(x)))
+#define	__section(x)	__attribute__((__section__(x)))
+#elif defined(_MSC_VER)
+#define	__packed	/* ignore */
+#else
+#define	__packed	error: no __packed for this compiler
+#define	__aligned(x)	error: no __aligned for this compiler
+#define	__section(x)	error: no __section for this compiler
+#endif
+
+/*
+ * C99 defines the restrict type qualifier keyword, which was made available
+ * in GCC 2.92.
+ */
+#if defined(__lint__)
+#define	__restrict	/* delete __restrict when not supported */
+#elif __STDC_VERSION__ >= 199901L
+#define	__restrict	restrict
+#elif __GNUC_PREREQ__(2, 92)
+#define	__restrict	__restrict__
+#else
+#define	__restrict	/* delete __restrict when not supported */
+#endif
+
+/*
+ * C99 defines __func__ predefined identifier, which was made available
+ * in GCC 2.95.
+ */
+#if !(__STDC_VERSION__ >= 199901L)
+#if __GNUC_PREREQ__(2, 6)
+#define	__func__	__PRETTY_FUNCTION__
+#elif __GNUC_PREREQ__(2, 4)
+#define	__func__	__FUNCTION__
+#else
+#define	__func__	""
+#endif
+#endif /* !(__STDC_VERSION__ >= 199901L) */
+
+#if defined(_KERNEL)
+#if defined(NO_KERNEL_RCSIDS)
+#undef __KERNEL_RCSID
+#define	__KERNEL_RCSID(_n, _s)		/* nothing */
+#endif /* NO_KERNEL_RCSIDS */
+#endif /* _KERNEL */
+
+#if !defined(_STANDALONE) && !defined(_KERNEL)
+#if defined(__GNUC__) || defined(__PCC__)
+#define	__RENAME(x)	___RENAME(x)
+#elif defined(__lint__)
+#define	__RENAME(x)	__symbolrename(x)
+#else
+#error "No function renaming possible"
+#endif /* __GNUC__ */
+#else /* _STANDALONE || _KERNEL */
+#define	__RENAME(x)	no renaming in kernel/standalone environment
+#endif
+
+/*
+ * A barrier to stop the optimizer from moving code or assume live
+ * register values. This is gcc specific, the version is more or less
+ * arbitrary, might work with older compilers.
+ */
+#if __GNUC_PREREQ__(2, 95)
+#define	__insn_barrier()	__asm __volatile("":::"memory")
+#else
+#define	__insn_barrier()	/* */
+#endif
+
+/*
+ * GNU C version 2.96 adds explicit branch prediction so that
+ * the CPU back-end can hint the processor and also so that
+ * code blocks can be reordered such that the predicted path
+ * sees a more linear flow, thus improving cache behavior, etc.
+ *
+ * The following two macros provide us with a way to use this
+ * compiler feature.  Use __predict_true() if you expect the expression
+ * to evaluate to true, and __predict_false() if you expect the
+ * expression to evaluate to false.
+ *
+ * A few notes about usage:
+ *
+ *	* Generally, __predict_false() error condition checks (unless
+ *	  you have some _strong_ reason to do otherwise, in which case
+ *	  document it), and/or __predict_true() `no-error' condition
+ *	  checks, assuming you want to optimize for the no-error case.
+ *
+ *	* Other than that, if you don't know the likelihood of a test
+ *	  succeeding from empirical or other `hard' evidence, don't
+ *	  make predictions.
+ *
+ *	* These are meant to be used in places that are run `a lot'.
+ *	  It is wasteful to make predictions in code that is run
+ *	  seldomly (e.g. at subsystem initialization time) as the
+ *	  basic block reordering that this affects can often generate
+ *	  larger code.
+ */
+#if __GNUC_PREREQ__(2, 96)
+#define	__predict_true(exp)	__builtin_expect((exp) != 0, 1)
+#define	__predict_false(exp)	__builtin_expect((exp) != 0, 0)
+#else
+#define	__predict_true(exp)	(exp)
+#define	__predict_false(exp)	(exp)
+#endif
+
+/*
+ * Compiler-dependent macros to declare that functions take printf-like
+ * or scanf-like arguments.  They are null except for versions of gcc
+ * that are known to support the features properly (old versions of gcc-2
+ * didn't permit keeping the keywords out of the application namespace).
+ */
+#if __GNUC_PREREQ__(2, 7)
+#define __printflike(fmtarg, firstvararg)	\
+	    __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
+#define __scanflike(fmtarg, firstvararg)	\
+	    __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
+#define __format_arg(fmtarg)    __attribute__((__format_arg__ (fmtarg)))
+#else
+#define __printflike(fmtarg, firstvararg)	/* nothing */
+#define __scanflike(fmtarg, firstvararg)	/* nothing */
+#define __format_arg(fmtarg)			/* nothing */
+#endif
+
+/*
+ * Macros for manipulating "link sets".  Link sets are arrays of pointers
+ * to objects, which are gathered up by the linker.
+ *
+ * Object format-specific code has provided us with the following macros:
+ *
+ *	__link_set_add_text(set, sym)
+ *		Add a reference to the .text symbol `sym' to `set'.
+ *
+ *	__link_set_add_rodata(set, sym)
+ *		Add a reference to the .rodata symbol `sym' to `set'.
+ *
+ *	__link_set_add_data(set, sym)
+ *		Add a reference to the .data symbol `sym' to `set'.
+ *
+ *	__link_set_add_bss(set, sym)
+ *		Add a reference to the .bss symbol `sym' to `set'.
+ *
+ *	__link_set_decl(set, ptype)
+ *		Provide an extern declaration of the set `set', which
+ *		contains an array of pointers to type `ptype'.  This
+ *		macro must be used by any code which wishes to reference
+ *		the elements of a link set.
+ *
+ *	__link_set_start(set)
+ *		This points to the first slot in the link set.
+ *
+ *	__link_set_end(set)
+ *		This points to the (non-existent) slot after the last
+ *		entry in the link set.
+ *
+ *	__link_set_count(set)
+ *		Count the number of entries in link set `set'.
+ *
+ * In addition, we provide the following macros for accessing link sets:
+ *
+ *	__link_set_foreach(pvar, set)
+ *		Iterate over the link set `set'.  Because a link set is
+ *		an array of pointers, pvar must be declared as "type **pvar",
+ *		and the actual entry accessed as "*pvar".
+ *
+ *	__link_set_entry(set, idx)
+ *		Access the link set entry at index `idx' from set `set'.
+ */
+#define	__link_set_foreach(pvar, set)					\
+	for (pvar = __link_set_start(set); pvar < __link_set_end(set); pvar++)
+
+#define	__link_set_entry(set, idx)	(__link_set_start(set)[idx])
+
+/*
+ * Return the natural alignment in bytes for the given type
+ */
+#if __GNUC_PREREQ__(4, 1)
+#define	__alignof(__t)  __alignof__(__t)
+#else
+#define __alignof(__t) (sizeof(struct { char __x; __t __y; }) - sizeof(__t))
+#endif
+
+/*
+ * Return the number of elements in a statically-allocated array,
+ * __x.
+ */
+#define	__arraycount(__x)	(sizeof(__x) / sizeof(__x[0]))
+
+#ifndef __ASSEMBLER__
+/* __BIT(n): nth bit, where __BIT(0) == 0x1. */
+#define	__BIT(__n)	\
+    (((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : ((uintmax_t)1 << (uintmax_t)((__n) & (NBBY * sizeof(uintmax_t) - 1))))
+
+/* __BITS(m, n): bits m through n, m < n. */
+#define	__BITS(__m, __n)	\
+	((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1))
+#endif /* !__ASSEMBLER__ */
+
+/* find least significant bit that is set */
+#define	__LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask))
+
+#define	__PRIuBIT	PRIuMAX
+#define	__PRIuBITS	__PRIuBIT
+
+#define	__PRIxBIT	PRIxMAX
+#define	__PRIxBITS	__PRIxBIT
+
+#define	__SHIFTOUT(__x, __mask)	(((__x) & (__mask)) / __LOWEST_SET_BIT(__mask))
+#define	__SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask))
+#define	__SHIFTOUT_MASK(__mask) __SHIFTOUT((__mask), (__mask))
+
+/*
+ * Only to be used in other headers that are included from both c or c++
+ * NOT to be used in code.
+ */
+#ifdef __cplusplus
+#define __CAST(__dt, __st)	static_cast<__dt>(__st)
+#else
+#define __CAST(__dt, __st)	((__dt)(__st))
+#endif
+
+#define __CASTV(__dt, __st)	__CAST(__dt, __CAST(void *, __st))
+#define __CASTCV(__dt, __st)	__CAST(__dt, __CAST(const void *, __st))
+
+#define __USE(a) ((void)(a))
+
+#define __type_mask(t) (/*LINTED*/sizeof(t) < sizeof(intmax_t) ? \
+    (~((1ULL << (sizeof(t) * NBBY)) - 1)) : 0ULL)
+
+#ifndef __ASSEMBLER__
+static __inline long long __zeroll(void) { return 0; }
+static __inline unsigned long long __zeroull(void) { return 0; }
+#else
+#define __zeroll() (0LL)
+#define __zeroull() (0ULL)
+#endif
+
+#define __negative_p(x) (!((x) > 0) && ((x) != 0))
+
+#define __type_min_s(t) ((t)((1ULL << (sizeof(t) * NBBY - 1))))
+#define __type_max_s(t) ((t)~((1ULL << (sizeof(t) * NBBY - 1))))
+#define __type_min_u(t) ((t)0ULL)
+#define __type_max_u(t) ((t)~0ULL)
+#define __type_is_signed(t) (/*LINTED*/__type_min_s(t) + (t)1 < (t)1)
+#define __type_min(t) (__type_is_signed(t) ? __type_min_s(t) : __type_min_u(t))
+#define __type_max(t) (__type_is_signed(t) ? __type_max_s(t) : __type_max_u(t))
+
+
+#define __type_fit_u(t, a) (/*LINTED*/!__negative_p(a) && \
+    (uintmax_t)((a) + __zeroull()) <= (uintmax_t)__type_max_u(t))
+
+#define __type_fit_s(t, a) (/*LINTED*/__negative_p(a) ? \
+    ((intmax_t)((a) + __zeroll()) >= (intmax_t)__type_min_s(t)) : \
+    ((intmax_t)((a) + __zeroll()) >= (intmax_t)0 && \
+     (intmax_t)((a) + __zeroll()) <= (intmax_t)__type_max_s(t)))
+
+/*
+ * return true if value 'a' fits in type 't'
+ */
+#define __type_fit(t, a) (__type_is_signed(t) ? \
+    __type_fit_s(t, a) : __type_fit_u(t, a))
+
+#endif /* !_SYS_CDEFS_H_ */

Property changes on: lab4/.minix-src/include/sys/cdefs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/protocols/timed.h
===================================================================
--- lab4/.minix-src/include/protocols/timed.h	(nonexistent)
+++ lab4/.minix-src/include/protocols/timed.h	(revision 13)
@@ -0,0 +1,100 @@
+/*	$NetBSD: timed.h,v 1.11 2008/02/16 07:30:15 matt Exp $	*/
+
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)timed.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef	_PROTOCOLS_TIMED_H_
+#define	_PROTOCOLS_TIMED_H_
+
+/*
+ * Time Synchronization Protocol
+ */
+
+#define	TSPVERSION	1
+#define ANYADDR 	NULL
+
+struct tsp {
+	uint8_t tsp_type;
+	uint8_t tsp_vers;
+	uint16_t tsp_seq;
+	union {
+		struct {
+			int32_t tv_sec;
+			int32_t tv_usec;
+		} tspu_time;
+		char tspu_hopcnt;
+	} tsp_u;
+	char tsp_name[MAXHOSTNAMELEN];
+};
+
+#define	tsp_time	tsp_u.tspu_time
+#define	tsp_hopcnt	tsp_u.tspu_hopcnt
+ 
+/*
+ * Command types.
+ */
+#define	TSP_ANY			0	/* match any types */
+#define	TSP_ADJTIME		1	/* send adjtime */
+#define	TSP_ACK			2	/* generic acknowledgement */
+#define	TSP_MASTERREQ		3	/* ask for master's name */ 
+#define	TSP_MASTERACK		4	/* acknowledge master request */
+#define	TSP_SETTIME		5	/* send network time */
+#define	TSP_MASTERUP		6	/* inform slaves that master is up */
+#define	TSP_SLAVEUP		7	/* slave is up but not polled */
+#define	TSP_ELECTION		8	/* advance candidature for master */
+#define	TSP_ACCEPT		9	/* support candidature of master */
+#define	TSP_REFUSE		10	/* reject candidature of master */
+#define	TSP_CONFLICT		11	/* two or more masters present */
+#define	TSP_RESOLVE		12	/* masters' conflict resolution */
+#define	TSP_QUIT		13	/* reject candidature if master is up */
+#define	TSP_DATE		14	/* reset the time (date command) */
+#define	TSP_DATEREQ		15	/* remote request to reset the time */
+#define	TSP_DATEACK		16	/* acknowledge time setting  */
+#define	TSP_TRACEON		17	/* turn tracing on */
+#define	TSP_TRACEOFF		18	/* turn tracing off */
+#define	TSP_MSITE		19	/* find out master's site */
+#define	TSP_MSITEREQ		20	/* remote master's site request */
+#define	TSP_TEST		21	/* for testing election algo */
+#define	TSP_SETDATE		22	/* New from date command */
+#define	TSP_SETDATEREQ		23	/* New remote for above */
+#define	TSP_LOOP		24	/* loop detection packet */
+
+#define	TSPTYPENUMBER		25
+
+#ifdef TSPTYPES
+const char * const tsptype[TSPTYPENUMBER] =
+  { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP", 
+  "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT", 
+  "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
+  "TEST", "SETDATE", "SETDATEREQ", "LOOP" };
+#endif
+
+#endif /* !_PROTOCOLS_TIMED_H_ */

Property changes on: lab4/.minix-src/include/protocols/timed.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ssp/string.h
===================================================================
--- lab4/.minix-src/include/ssp/string.h	(nonexistent)
+++ lab4/.minix-src/include/ssp/string.h	(revision 13)
@@ -0,0 +1,108 @@
+/*	$NetBSD: string.h,v 1.13 2014/11/29 13:23:48 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _SSP_STRING_H_
+#define _SSP_STRING_H_
+
+#include <sys/cdefs.h>
+#include <ssp/ssp.h>
+
+__BEGIN_DECLS
+void *__memcpy_chk(void *, const void *, size_t, size_t);
+void *__memmove_chk(void *, void *, size_t, size_t);
+void *__memset_chk(void *, int, size_t, size_t);
+char *__stpcpy_chk(char *, const char *, size_t);
+char *__strcat_chk(char *, const char *, size_t);
+char *__strcpy_chk(char *, const char *, size_t);
+char *__strncat_chk(char *, const char *, size_t, size_t);
+char *__strncpy_chk(char *, const char *, size_t, size_t);
+__END_DECLS
+
+#if __SSP_FORTIFY_LEVEL > 0
+
+#define __ssp_bos_check3(fun, dst, src, len) \
+    ((__ssp_bos0(dst) != (size_t)-1) ? \
+    __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)) : \
+    __ ## fun ## _ichk(dst, src, len))
+
+#define __ssp_bos_check2(fun, dst, src) \
+    ((__ssp_bos0(dst) != (size_t)-1) ? \
+    __builtin___ ## fun ## _chk(dst, src, __ssp_bos0(dst)) : \
+    __ ## fun ## _ichk(dst, src))
+
+#define __ssp_bos_icheck3_restrict(fun, type1, type2) \
+static __inline type1 __ ## fun ## _ichk(type1 __restrict, type2 __restrict, size_t); \
+static __inline __attribute__((__always_inline__)) type1 \
+__ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src, size_t len) { \
+	return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \
+}
+
+#define __ssp_bos_icheck3(fun, type1, type2) \
+static __inline type1 __ ## fun ## _ichk(type1, type2, size_t); \
+static __inline __attribute__((__always_inline__)) type1 \
+__ ## fun ## _ichk(type1 dst, type2 src, size_t len) { \
+	return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \
+}
+
+#define __ssp_bos_icheck2_restrict(fun, type1, type2) \
+static __inline type1 __ ## fun ## _ichk(type1, type2); \
+static __inline __attribute__((__always_inline__)) type1 \
+__ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src) { \
+	return __builtin___ ## fun ## _chk(dst, src, __ssp_bos0(dst)); \
+}
+
+__BEGIN_DECLS
+__ssp_bos_icheck3_restrict(memcpy, void *, const void *)
+__ssp_bos_icheck3(memmove, void *, const void *)
+__ssp_bos_icheck3(memset, void *, int)
+__ssp_bos_icheck2_restrict(stpcpy, char *, const char *)
+#if __GNUC_PREREQ__(4,8) || defined(__clang__)
+__ssp_bos_icheck3_restrict(stpncpy, char *, const char *)
+#endif
+__ssp_bos_icheck2_restrict(strcpy, char *, const char *)
+__ssp_bos_icheck2_restrict(strcat, char *, const char *)
+__ssp_bos_icheck3_restrict(strncpy, char *, const char *)
+__ssp_bos_icheck3_restrict(strncat, char *, const char *)
+__END_DECLS
+
+#define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len)
+#define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len)
+#define memset(dst, val, len) __ssp_bos_check3(memset, dst, val, len)
+#define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src)
+#if __GNUC_PREREQ__(4,8) || defined(__clang__)
+#define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len)
+#endif
+#define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src)
+#define strcat(dst, src) __ssp_bos_check2(strcat, dst, src)
+#define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len)
+#define strncat(dst, src, len) __ssp_bos_check3(strncat, dst, src, len)
+
+#endif /* __SSP_FORTIFY_LEVEL > 0 */
+#endif /* _SSP_STRING_H_ */

Property changes on: lab4/.minix-src/include/ssp/string.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/atomic.h
===================================================================
--- lab4/.minix-src/include/sys/atomic.h	(nonexistent)
+++ lab4/.minix-src/include/sys/atomic.h	(revision 13)
@@ -0,0 +1,167 @@
+/*	$NetBSD: atomic.h,v 1.13 2015/01/08 22:27:18 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_ATOMIC_H_
+#define	_SYS_ATOMIC_H_
+
+#include <sys/types.h>
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <stdint.h>
+#endif
+
+__BEGIN_DECLS
+/*
+ * Atomic ADD
+ */
+void		atomic_add_32(volatile uint32_t *, int32_t);
+void		atomic_add_int(volatile unsigned int *, int);
+void		atomic_add_long(volatile unsigned long *, long);
+void		atomic_add_ptr(volatile void *, ssize_t);
+void		atomic_add_64(volatile uint64_t *, int64_t);
+
+uint32_t	atomic_add_32_nv(volatile uint32_t *, int32_t);
+unsigned int	atomic_add_int_nv(volatile unsigned int *, int);
+unsigned long	atomic_add_long_nv(volatile unsigned long *, long);
+void *		atomic_add_ptr_nv(volatile void *, ssize_t);
+uint64_t	atomic_add_64_nv(volatile uint64_t *, int64_t);
+
+/*
+ * Atomic AND
+ */
+void		atomic_and_32(volatile uint32_t *, uint32_t);
+void		atomic_and_uint(volatile unsigned int *, unsigned int);
+void		atomic_and_ulong(volatile unsigned long *, unsigned long);
+void		atomic_and_64(volatile uint64_t *, uint64_t);
+
+uint32_t	atomic_and_32_nv(volatile uint32_t *, uint32_t);
+unsigned int	atomic_and_uint_nv(volatile unsigned int *, unsigned int);
+unsigned long	atomic_and_ulong_nv(volatile unsigned long *, unsigned long);
+uint64_t	atomic_and_64_nv(volatile uint64_t *, uint64_t);
+
+/*
+ * Atomic OR
+ */
+void		atomic_or_32(volatile uint32_t *, uint32_t);
+void		atomic_or_uint(volatile unsigned int *, unsigned int);
+void		atomic_or_ulong(volatile unsigned long *, unsigned long);
+void		atomic_or_64(volatile uint64_t *, uint64_t);
+
+uint32_t	atomic_or_32_nv(volatile uint32_t *, uint32_t);
+unsigned int	atomic_or_uint_nv(volatile unsigned int *, unsigned int);
+unsigned long	atomic_or_ulong_nv(volatile unsigned long *, unsigned long);
+uint64_t	atomic_or_64_nv(volatile uint64_t *, uint64_t);
+
+/*
+ * Atomic COMPARE-AND-SWAP
+ */
+uint32_t	atomic_cas_32(volatile uint32_t *, uint32_t, uint32_t);
+unsigned int	atomic_cas_uint(volatile unsigned int *, unsigned int,
+				unsigned int);
+unsigned long	atomic_cas_ulong(volatile unsigned long *, unsigned long,
+				 unsigned long);
+void *		atomic_cas_ptr(volatile void *, void *, void *);
+uint64_t	atomic_cas_64(volatile uint64_t *, uint64_t, uint64_t);
+
+/*
+ * This operations will be provided for userland, but may not be
+ * implemented efficiently.
+ */
+uint16_t	atomic_cas_16(volatile uint16_t *, uint16_t, uint16_t);
+uint8_t 	atomic_cas_8(volatile uint8_t *, uint8_t, uint8_t);
+
+/*
+ * Non-interlocked atomic COMPARE-AND-SWAP.
+ */
+uint32_t	atomic_cas_32_ni(volatile uint32_t *, uint32_t, uint32_t);
+unsigned int	atomic_cas_uint_ni(volatile unsigned int *, unsigned int,
+				   unsigned int);
+unsigned long	atomic_cas_ulong_ni(volatile unsigned long *, unsigned long,
+				    unsigned long);
+void *		atomic_cas_ptr_ni(volatile void *, void *, void *);
+uint64_t	atomic_cas_64_ni(volatile uint64_t *, uint64_t, uint64_t);
+
+/*
+ * Atomic SWAP
+ */
+uint32_t	atomic_swap_32(volatile uint32_t *, uint32_t);
+unsigned int	atomic_swap_uint(volatile unsigned int *, unsigned int);
+unsigned long	atomic_swap_ulong(volatile unsigned long *, unsigned long);
+void *		atomic_swap_ptr(volatile void *, void *);
+uint64_t	atomic_swap_64(volatile uint64_t *, uint64_t);
+
+/*
+ * Atomic DECREMENT
+ */
+void		atomic_dec_32(volatile uint32_t *);
+void		atomic_dec_uint(volatile unsigned int *);
+void		atomic_dec_ulong(volatile unsigned long *);
+void		atomic_dec_ptr(volatile void *);
+void		atomic_dec_64(volatile uint64_t *);
+
+uint32_t	atomic_dec_32_nv(volatile uint32_t *);
+unsigned int	atomic_dec_uint_nv(volatile unsigned int *);
+unsigned long	atomic_dec_ulong_nv(volatile unsigned long *);
+void *		atomic_dec_ptr_nv(volatile void *);
+uint64_t	atomic_dec_64_nv(volatile uint64_t *);
+
+/*
+ * Atomic INCREMENT
+ */
+void		atomic_inc_32(volatile uint32_t *);
+void		atomic_inc_uint(volatile unsigned int *);
+void		atomic_inc_ulong(volatile unsigned long *);
+void		atomic_inc_ptr(volatile void *);
+void		atomic_inc_64(volatile uint64_t *);
+
+uint32_t	atomic_inc_32_nv(volatile uint32_t *);
+unsigned int	atomic_inc_uint_nv(volatile unsigned int *);
+unsigned long	atomic_inc_ulong_nv(volatile unsigned long *);
+void *		atomic_inc_ptr_nv(volatile void *);
+uint64_t	atomic_inc_64_nv(volatile uint64_t *);
+
+/*
+ * Memory barrier operations
+ */
+void		membar_enter(void);
+void		membar_exit(void);
+void		membar_producer(void);
+void		membar_consumer(void);
+void		membar_sync(void);
+
+#ifdef	__HAVE_MEMBAR_DATADEP_CONSUMER
+void		membar_datadep_consumer(void);
+#else
+#define	membar_datadep_consumer()	((void)0)
+#endif
+
+__END_DECLS
+
+#endif /* ! _SYS_ATOMIC_H_ */

Property changes on: lab4/.minix-src/include/sys/atomic.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/bswap.h
===================================================================
--- lab4/.minix-src/include/sys/bswap.h	(nonexistent)
+++ lab4/.minix-src/include/sys/bswap.h	(revision 13)
@@ -0,0 +1,78 @@
+/*      $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $      */
+
+/* Written by Manuel Bouyer. Public domain */
+
+#ifndef _SYS_BSWAP_H_
+#define _SYS_BSWAP_H_
+
+#ifndef _LOCORE
+#include <sys/stdint.h>
+
+#include <machine/bswap.h>
+
+__BEGIN_DECLS
+/* Always declare the functions in case their address is taken (etc) */
+#if defined(_KERNEL) || defined(_STANDALONE) || !defined(__BSWAP_RENAME)
+uint16_t bswap16(uint16_t) __constfunc;
+uint32_t bswap32(uint32_t) __constfunc;
+#else
+uint16_t bswap16(uint16_t) __RENAME(__bswap16) __constfunc;
+uint32_t bswap32(uint32_t) __RENAME(__bswap32) __constfunc;
+#endif
+uint64_t bswap64(uint64_t) __constfunc;
+__END_DECLS
+
+#if defined(__GNUC__) && !defined(__lint__)
+
+/* machine/byte_swap.h might have defined inline versions */
+#ifndef __BYTE_SWAP_U64_VARIABLE
+#define	__BYTE_SWAP_U64_VARIABLE bswap64
+#endif
+
+#ifndef __BYTE_SWAP_U32_VARIABLE
+#define	__BYTE_SWAP_U32_VARIABLE bswap32
+#endif
+
+#ifndef __BYTE_SWAP_U16_VARIABLE
+#define	__BYTE_SWAP_U16_VARIABLE bswap16
+#endif
+
+#define	__byte_swap_u64_constant(x) \
+	(__CAST(uint64_t, \
+	 ((((x) & 0xff00000000000000ull) >> 56) | \
+	  (((x) & 0x00ff000000000000ull) >> 40) | \
+	  (((x) & 0x0000ff0000000000ull) >> 24) | \
+	  (((x) & 0x000000ff00000000ull) >>  8) | \
+	  (((x) & 0x00000000ff000000ull) <<  8) | \
+	  (((x) & 0x0000000000ff0000ull) << 24) | \
+	  (((x) & 0x000000000000ff00ull) << 40) | \
+	  (((x) & 0x00000000000000ffull) << 56))))
+
+#define	__byte_swap_u32_constant(x) \
+	(__CAST(uint32_t, \
+	((((x) & 0xff000000) >> 24) | \
+	 (((x) & 0x00ff0000) >>  8) | \
+	 (((x) & 0x0000ff00) <<  8) | \
+	 (((x) & 0x000000ff) << 24))))
+
+#define	__byte_swap_u16_constant(x) \
+	(__CAST(uint16_t, \
+	((((x) & 0xff00) >> 8) | \
+	 (((x) & 0x00ff) << 8))))
+
+#define	bswap64(x) \
+	__CAST(uint64_t, __builtin_constant_p((x)) ? \
+	 __byte_swap_u64_constant(x) : __BYTE_SWAP_U64_VARIABLE(x))
+
+#define	bswap32(x) \
+	__CAST(uint32_t, __builtin_constant_p((x)) ? \
+	 __byte_swap_u32_constant(x) : __BYTE_SWAP_U32_VARIABLE(x))
+
+#define	bswap16(x) \
+	__CAST(uint16_t, __builtin_constant_p((x)) ? \
+	 __byte_swap_u16_constant(x) : __BYTE_SWAP_U16_VARIABLE(x))
+
+#endif /* __GNUC__ && !__lint__ */
+#endif /* !_LOCORE */
+
+#endif /* !_SYS_BSWAP_H_ */

Property changes on: lab4/.minix-src/include/sys/bswap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/chio.h
===================================================================
--- lab4/.minix-src/include/sys/chio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/chio.h	(revision 13)
@@ -0,0 +1,282 @@
+/*	$NetBSD: chio.h,v 1.13 2015/09/06 06:01:02 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_CHIO_H_
+#define _SYS_CHIO_H_
+
+#include <sys/ioccom.h>
+
+/*
+ * Element types.  Used as "to" and "from" type indicators in move
+ * and exchange operations.
+ *
+ * Note that code in sys/dev/scsipi/ch.c relies on these values (uses
+ * them as offsets in an array, and other evil), so don't muck with them
+ * unless you know what you're doing.
+ */
+#define CHET_MT		0	/* medium transport (picker) */
+#define CHET_ST		1	/* storage transport (slot) */
+#define CHET_IE		2	/* import/export (portal) */
+#define CHET_DT		3	/* data transfer (drive) */
+
+/*
+ * Structure used to execute a MOVE MEDIUM command.
+ */
+struct changer_move_request {
+	int	cm_fromtype;	/* element type to move from */
+	int	cm_fromunit;	/* logical unit of from element */
+	int	cm_totype;	/* element type to move to */
+	int	cm_tounit;	/* logical unit of to element */
+	int	cm_flags;	/* misc. flags */
+};
+
+/* cm_flags */
+#define CM_INVERT	0x01	/* invert media */
+
+/*
+ * Structure used to execute an EXCHANGE MEDIUM command.  In an
+ * exchange operation, the following steps occur:
+ *
+ *	- media from source is moved to first destination.
+ *
+ *	- media previously occupying first destination is moved
+ *	  to the second destination.
+ *
+ * The second destination may or may not be the same as the source.
+ * In the case of a simple exchange, the source and second destination
+ * are the same.
+ */
+struct changer_exchange_request {
+	int	ce_srctype;	/* element type of source */
+	int	ce_srcunit;	/* logical unit of source */
+	int	ce_fdsttype;	/* element type of first destination */
+	int	ce_fdstunit;	/* logical unit of first destination */
+	int	ce_sdsttype;	/* element type of second destination */
+	int	ce_sdstunit;	/* logical unit of second destination */
+	int	ce_flags;	/* misc. flags */
+};
+
+/* ce_flags */
+#define CE_INVERT1	0x01	/* invert media 1 */
+#define CE_INVERT2	0x02	/* invert media 2 */
+
+/*
+ * Structure used to execute a POSITION TO ELEMENT command.  This
+ * moves the current picker in front of the specified element.
+ */
+struct changer_position_request {
+	int	cp_type;	/* element type */
+	int	cp_unit;	/* logical unit of element */
+	int	cp_flags;	/* misc. flags */
+};
+
+/* cp_flags */
+#define CP_INVERT	0x01	/* invert picker */
+
+/*
+ * Data returned by CHIOGPARAMS.
+ */
+struct changer_params {
+	int	cp_curpicker;	/* current picker */
+	int	cp_npickers;	/* number of pickers */
+	int	cp_nslots;	/* number of slots */
+	int	cp_nportals;	/* number of import/export portals */
+	int	cp_ndrives;	/* number of drives */
+};
+
+/*
+ * Old-style command used to get element status.
+ */
+struct ochanger_element_status_request {
+	int	cesr_type;	/* element type */
+	uint8_t *cesr_data;	/* pre-allocated data storage */
+};
+
+/*
+ * Structure of a changer volume tag.
+ */
+#define	CHANGER_VOLTAG_SIZE	32	/* same as SCSI voltag size */
+struct changer_voltag {
+	char	cv_tag[CHANGER_VOLTAG_SIZE + 1];	/* ASCII tag */
+	uint16_t cv_serial;				/* serial number */
+};
+
+/*
+ * Data returned by CHIOGSTATUS.
+ */
+struct changer_element_status {
+	int	ces_flags;	/* CESTATUS_* flags; see below */
+
+	/*
+	 * The following is only valid on Data Transport elements (drives).
+	 */
+	char	ces_xname[16];	/* external name of drive device */
+
+	/*
+	 * The following fieds indicate the element the medium was
+	 * moved from in order to arrive in this element.
+	 */
+	int	ces_from_type;	/* type of element */
+	int	ces_from_unit;	/* logical unit of element */
+
+	/*
+	 * Volume tag information.
+	 */
+	struct changer_voltag ces_pvoltag;	/* primary volume tag */
+	struct changer_voltag ces_avoltag;	/* alternate volume tag */
+
+	size_t	ces_vendor_len;	/* length of any vendor-specific data */
+
+	/*
+	 * These two fields are only valid if CESTATUS_EXCEPT is
+	 * set in ces_flags, and are only valid on SCSI changers.
+	 */
+	uint8_t ces_asc;	/* Additional Sense Code */
+	uint8_t ces_ascq;	/* Additional Sense Code Qualifier */
+
+	/*
+	 * These two fields may be useful if ces_xname is not valid.
+	 * They indicate the target and lun of a drive element.  These
+	 * are only valid on SCSI changers.
+	 */
+	uint8_t ces_target;	/* SCSI target of drive */
+	uint8_t ces_lun;	/* SCSI LUN of drive */
+};
+
+/*
+ * Flags for changer_element_status.  These are flags that are returned
+ * by hardware.  Not all flags have meaning for all element types.
+ */
+#define CESTATUS_FULL		0x0001	/* element is full */
+#define CESTATUS_IMPEXP		0x0002	/* media deposited by operator */
+#define CESTATUS_EXCEPT		0x0004	/* element in abnormal state */
+#define CESTATUS_ACCESS		0x0008	/* media accessible by picker */
+#define CESTATUS_EXENAB		0x0010	/* element supports exporting */
+#define CESTATUS_INENAB		0x0020	/* element supports importing */
+
+#define CESTATUS_PICKER_MASK	0x0005	/* flags valid for pickers */
+#define CESTATUS_SLOT_MASK	0x000c	/* flags valid for slots */
+#define CESTATUS_PORTAL_MASK	0x003f	/* flags valid for portals */
+#define CESTATUS_DRIVE_MASK	0x000c	/* flags valid for drives */
+
+#define	CESTATUS_INVERTED	0x0040	/* medium inverted from storage */
+#define	CESTATUS_NOTBUS		0x0080	/* drive not on same bus as changer */
+
+/*
+ * These changer_element_status flags indicate the validity of fields
+ * in the returned data.
+ */
+#define	CESTATUS_STATUS_VALID	0x0100	/* entire structure valid */
+#define	CESTATUS_XNAME_VALID	0x0200	/* ces_xname valid */
+#define	CESTATUS_FROM_VALID	0x0400	/* ces_from_* valid */
+#define	CESTATUS_PVOL_VALID	0x0800	/* ces_pvoltag valid */
+#define	CESTATUS_AVOL_VALID	0x1000	/* ces_avoltag valid */
+#define	CESTATUS_TARGET_VALID	0x2000	/* ces_target valid */
+#define	CESTATUS_LUN_VALID	0x4000	/* ces_lun valid */
+
+#define CESTATUS_BITS	\
+	"\20\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
+
+/*
+ * Command used to get element status.
+ */
+struct changer_element_status_request {
+	int	cesr_type;	/* element type */
+	int	cesr_unit;	/* start at this unit */
+	int	cesr_count;	/* for this many units */
+	int	cesr_flags;	/* flags; see below */
+				/* pre-allocated data storage */
+	/*
+	 * These fields point to the data to be returned to the
+	 * user:
+	 *
+	 *	cesr_deta: pointer to array of cesr_count status descriptors
+	 *
+	 *	cesr_vendor_data: pointer to array of void *'s which point
+	 *	to pre-allocated areas for vendor-specific data.  Optional.
+	 */
+	struct changer_element_status *cesr_data;
+	void	**cesr_vendor_data;
+};
+
+#define	CESR_VOLTAGS		0x01	/* request volume tags */
+
+/*
+ * Command used to modify a media element's volume tag.
+ */
+struct changer_set_voltag_request {
+	int	csvr_type;	/* element type */
+	int	csvr_unit;	/* unit to modify */
+	int	csvr_flags;	/* flags; see below */
+				/* the actual volume tag; ignored if clearing
+				   the tag */
+	struct changer_voltag csvr_voltag;
+};
+
+#define	CSVR_MODE_SET		0x00	/* set volume tag if not set */
+#define	CSVR_MODE_REPLACE	0x01	/* unconditionally replace volume tag */
+#define	CSVR_MODE_CLEAR		0x02	/* clear volume tag */
+#define	CSVR_MODE_MASK		0x0f
+#define	CSVR_ALTERNATE		0x10	/* modify alternate volume tag */
+
+/*
+ * Changer events.
+ *
+ * When certain events occur, the kernel can indicate this by setting
+ * a bit in a bitmask.
+ *
+ * When a read is issued to the changer, the kernel returns this event
+ * bitmask.  The read never blocks; if no events are pending, the bitmask
+ * will be all-clear.
+ *
+ * A process may select for read to wait for an event to occur.
+ *
+ * The event mask is cleared when the changer is closed.
+ */
+#define	CHANGER_EVENT_SIZE		sizeof(u_int)
+#define	CHEV_ELEMENT_STATUS_CHANGED	0x00000001
+
+/*
+ * ioctls applicable to changers.
+ */
+#define CHIOMOVE	_IOW('c', 0x01, struct changer_move_request)
+#define CHIOEXCHANGE	_IOW('c', 0x02, struct changer_exchange_request)
+#define CHIOPOSITION	_IOW('c', 0x03, struct changer_position_request)
+#define CHIOGPICKER	_IOR('c', 0x04, int)
+#define CHIOSPICKER	_IOW('c', 0x05, int)
+#define CHIOGPARAMS	_IOR('c', 0x06, struct changer_params)
+#define CHIOIELEM	 _IO('c', 0x07)
+#define OCHIOGSTATUS	_IOW('c', 0x08, struct ochanger_element_status_request)
+#define	CHIOGSTATUS	_IOW('c', 0x09, struct changer_element_status_request)
+#define	CHIOSVOLTAG	_IOW('c', 0x0a, struct changer_set_voltag_request)
+
+#endif /* _SYS_CHIO_H_ */

Property changes on: lab4/.minix-src/include/sys/chio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/cdbr.h
===================================================================
--- lab4/.minix-src/include/sys/cdbr.h	(nonexistent)
+++ lab4/.minix-src/include/sys/cdbr.h	(revision 13)
@@ -0,0 +1,64 @@
+/*	$NetBSD: cdbr.h,v 1.1 2013/12/11 01:24:08 joerg Exp $	*/
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef	_CDBR_H
+#define	_CDBR_H
+
+#include <sys/cdefs.h>
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/types.h>
+#else
+#include <inttypes.h>
+#include <stddef.h>
+#endif
+
+#define	CDBR_DEFAULT	0
+
+struct cdbr;
+
+__BEGIN_DECLS
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+struct cdbr	*cdbr_open(const char *, int);
+#endif
+struct cdbr	*cdbr_open_mem(void *, size_t, int,
+    void (*)(void *, void *, size_t), void *);
+uint32_t	 cdbr_entries(struct cdbr *);
+int		 cdbr_get(struct cdbr *, uint32_t, const void **, size_t *);
+int		 cdbr_find(struct cdbr *, const void *, size_t,
+    const void **, size_t *);
+void		 cdbr_close(struct cdbr *);
+
+__END_DECLS
+
+#endif /* _CDBR_H */

Property changes on: lab4/.minix-src/include/sys/cdbr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/common_int_const.h
===================================================================
--- lab4/.minix-src/include/sys/common_int_const.h	(nonexistent)
+++ lab4/.minix-src/include/sys/common_int_const.h	(revision 13)
@@ -0,0 +1,62 @@
+/*	$NetBSD: common_int_const.h,v 1.1 2014/07/25 21:43:13 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_COMMON_INT_CONST_H_
+#define _SYS_COMMON_INT_CONST_H_
+
+#ifndef __INTMAX_C_SUFFIX__
+#error Your compiler does not provide inter constant suffix macros.
+#endif
+
+#define __int_join_(c,suffix) c ## suffix
+#define __int_join(c,suffix) __int_join_(c,suffix)
+/*
+ * 7.18.4 Macros for integer constants
+ */
+
+/* 7.18.4.1 Macros for minimum-width integer constants */
+
+#define	INT8_C(c)	__int_join(c, __INT8_C_SUFFIX__)
+#define	INT16_C(c)	__int_join(c, __INT16_C_SUFFIX__)
+#define	INT32_C(c)	__int_join(c, __INT32_C_SUFFIX__)
+#define	INT64_C(c)	__int_join(c, __INT64_C_SUFFIX__)
+
+#define	UINT8_C(c)	__int_join(c, __UINT8_C_SUFFIX__)
+#define	UINT16_C(c)	__int_join(c, __UINT16_C_SUFFIX__)
+#define	UINT32_C(c)	__int_join(c, __UINT32_C_SUFFIX__)
+#define	UINT64_C(c)	__int_join(c, __UINT64_C_SUFFIX__)
+
+/* 7.18.4.2 Macros for greatest-width integer constants */
+
+#define	INTMAX_C(c)	__int_join(c, __INTMAX_C_SUFFIX__)
+#define	UINTMAX_C(c)	__int_join(c, __UINTMAX_C_SUFFIX__)
+
+#endif /* _SYS_COMMON_INT_CONST_H_ */

Property changes on: lab4/.minix-src/include/sys/common_int_const.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/rpcsvc/ypclnt.h
===================================================================
--- lab4/.minix-src/include/rpcsvc/ypclnt.h	(nonexistent)
+++ lab4/.minix-src/include/rpcsvc/ypclnt.h	(revision 13)
@@ -0,0 +1,86 @@
+/*	$NetBSD: ypclnt.h,v 1.14 2012/03/02 17:27:48 christos Exp $	*/
+
+/*
+ * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
+ * 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.
+ */
+
+#ifndef _RPCSVC_YPCLNT_H_
+#define _RPCSVC_YPCLNT_H_
+
+#define YPERR_BADARGS	1		/* args to function are bad */
+#define YPERR_RPC	2		/* RPC failure */
+#define YPERR_DOMAIN	3		/* can't bind to a server for domain */
+#define YPERR_MAP	4		/* no such map in server's domain */
+#define YPERR_KEY	5		/* no such key in map */
+#define YPERR_YPERR	6		/* some internal YP server or client error */
+#define YPERR_RESRC	7		/* local resource allocation failure */
+#define YPERR_NOMORE	8		/* no more records in map database */
+#define YPERR_PMAP	9		/* can't communicate with portmapper */
+#define YPERR_YPBIND	10		/* can't communicate with ypbind */
+#define YPERR_YPSERV	11		/* can't communicate with ypserv */
+#define YPERR_NODOM	12		/* local domain name not set */
+#define YPERR_BADDB	13		/* YP data base is bad */
+#define YPERR_VERS	14		/* YP version mismatch */
+#define YPERR_ACCESS	15		/* access violation */
+#define YPERR_BUSY	16		/* database is busy */
+
+/*
+ * Types of update operations
+ */
+#define YPOP_CHANGE	1		/* change, do not add */
+#define YPOP_INSERT	2		/* add, do not change */
+#define YPOP_DELETE	3		/* delete this entry */
+#define YPOP_STORE 	4		/* add, or change */
+ 
+struct ypall_callback {
+	/* return non-0 to stop getting called */
+	int (*foreach)(int, char *, int, char *, int, char *);
+	char *data;		/* opaque pointer for use of callback fn */
+};
+
+__BEGIN_DECLS
+int	yp_bind		(const char *);
+struct dom_binding;
+int	_yp_dobind	(const char *, struct dom_binding **);
+int	_yp_check	(char **);
+void	yp_unbind	(const char *);
+int	yp_get_default_domain(char **);
+struct ypmaplist;
+int	yp_maplist	(const char *, struct ypmaplist **);
+int	yp_match 	(const char *, const char *, const char *,
+			     int , char **, int *);
+int	yp_first 	(const char *, const char *, char **, int *,
+			     char **, int *);
+int	yp_next		(const char *, const char *, const char *,
+			     int, char **, int *, char **, int *);
+int	yp_master	(const char *, const char *, char **);
+int	yp_order	(const char *, const char *, int *);
+int	yp_all		(const char *, const char *, struct ypall_callback *);
+char *	yperr_string	(int);
+int	ypprot_err	(unsigned int);
+int	yp_setbindtries	(int);
+__END_DECLS
+
+#endif /* _RPCSVC_YPCLNT_H_ */

Property changes on: lab4/.minix-src/include/rpcsvc/ypclnt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/common_int_types.h
===================================================================
--- lab4/.minix-src/include/sys/common_int_types.h	(nonexistent)
+++ lab4/.minix-src/include/sys/common_int_types.h	(revision 13)
@@ -0,0 +1,61 @@
+/*	$NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_COMMON_INT_TYPES_H_
+#define _SYS_COMMON_INT_TYPES_H_
+
+#ifndef __UINTPTR_TYPE__
+#error Your compiler does not provide exact width type macros.
+#endif
+
+/*
+ * 7.18.1 Integer types
+ */
+
+/* 7.18.1.1 Exact-width integer types */
+
+typedef	__INT8_TYPE__		   __int8_t;
+typedef	__UINT8_TYPE__		  __uint8_t;
+typedef	__INT16_TYPE__		  __int16_t;
+typedef	__UINT16_TYPE__		 __uint16_t;
+typedef	__INT32_TYPE__		  __int32_t;
+typedef	__UINT32_TYPE__		 __uint32_t;
+typedef	__INT64_TYPE__		  __int64_t;
+typedef	__UINT64_TYPE__		 __uint64_t;
+
+#define	__BIT_TYPES_DEFINED__
+
+/* 7.18.1.4 Integer types capable of holding object pointers */
+
+typedef	__INTPTR_TYPE__		 __intptr_t;
+typedef	__UINTPTR_TYPE__	__uintptr_t;
+
+#endif /* _SYS_COMMON_INT_TYPES_H_ */

Property changes on: lab4/.minix-src/include/sys/common_int_types.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/agpio.h
===================================================================
--- lab4/.minix-src/include/sys/agpio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/agpio.h	(revision 13)
@@ -0,0 +1,146 @@
+/*	$NetBSD: agpio.h,v 1.11 2015/09/06 06:01:02 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 2000 Doug Rabson
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	$FreeBSD: src/sys/sys/agpio.h,v 1.1 2000/06/09 16:04:30 dfr Exp $
+ */
+
+#ifndef _SYS_AGPIO_H_
+#define _SYS_AGPIO_H_
+
+#include <sys/ioccom.h>
+
+/*
+ * The AGP gatt uses 4k pages irrespective of the host page size.
+ */
+#define AGP_PAGE_SIZE		4096
+#define AGP_PAGE_SHIFT		12
+
+/*
+ * Macros to manipulate AGP mode words.
+ */
+#define AGP_MODE_GET_RQ(x)		(((x) & 0xff000000U) >> 24)
+#define AGP_MODE_GET_ARQSZ(x)		(((x) & 0x0000e000U) >> 13)
+#define AGP_MODE_GET_CAL(x)		(((x) & 0x00001c00U) >> 10)
+#define AGP_MODE_GET_SBA(x)		(((x) & 0x00000200U) >> 9)
+#define AGP_MODE_GET_AGP(x)		(((x) & 0x00000100U) >> 8)
+#define AGP_MODE_GET_4G(x)		(((x) & 0x00000020U) >> 5)
+#define AGP_MODE_GET_FW(x)		(((x) & 0x00000010U) >> 4)
+#define AGP_MODE_GET_MODE_3(x)		(((x) & 0x00000008U) >> 3)
+#define AGP_MODE_GET_RATE(x)		((x) & 0x00000007U)
+#define AGP_MODE_SET_RQ(x,v)		(((x) & ~0xff000000U) | ((v) << 24))
+#define AGP_MODE_SET_ARQSZ(x,v)		(((x) & ~0x0000e000U) | ((v) << 13))
+#define AGP_MODE_SET_CAL(x,v)		(((x) & ~0x00001c00U) | ((v) << 10))
+#define AGP_MODE_SET_SBA(x,v)		(((x) & ~0x00000200U) | ((v) << 9))
+#define AGP_MODE_SET_AGP(x,v)		(((x) & ~0x00000100U) | ((v) << 8))
+#define AGP_MODE_SET_4G(x,v)		(((x) & ~0x00000020U) | ((v) << 5))
+#define AGP_MODE_SET_FW(x,v)		(((x) & ~0x00000010U) | ((v) << 4))
+#define AGP_MODE_SET_MODE_3(x,v)	(((x) & ~0x00000008U) | ((v) << 3))
+#define AGP_MODE_SET_RATE(x,v)		(((x) & ~0x00000007U) | (v))
+#define AGP_MODE_V2_RATE_1x		0x00000001
+#define AGP_MODE_V2_RATE_2x		0x00000002
+#define AGP_MODE_V2_RATE_4x		0x00000004
+#define AGP_MODE_V3_RATE_4x		0x00000001
+#define AGP_MODE_V3_RATE_8x		0x00000002
+#define AGP_MODE_V3_RATE_RSVD		0x00000004
+
+/* compat */
+#define AGP_MODE_RATE_1x		AGP_MODE_V2_RATE_1x
+#define AGP_MODE_RATE_2x		AGP_MODE_V2_RATE_2x
+#define AGP_MODE_RATE_4x		AGP_MODE_V2_RATE_4x
+
+#define AGPIOC_BASE       'A'
+#define AGPIOC_INFO       _IOR (AGPIOC_BASE, 0, agp_info)
+#define AGPIOC_ACQUIRE    _IO  (AGPIOC_BASE, 1)
+#define AGPIOC_RELEASE    _IO  (AGPIOC_BASE, 2)
+#define AGPIOC_SETUP      _IOW (AGPIOC_BASE, 3, agp_setup)
+#if 0
+#define AGPIOC_RESERVE    _IOW (AGPIOC_BASE, 4, agp_region)
+#define AGPIOC_PROTECT    _IOW (AGPIOC_BASE, 5, agp_region)
+#endif
+#define AGPIOC_ALLOCATE   _IOWR(AGPIOC_BASE, 6, agp_allocate)
+#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
+#define AGPIOC_BIND       _IOW (AGPIOC_BASE, 8, agp_bind)
+#define AGPIOC_UNBIND     _IOW (AGPIOC_BASE, 9, agp_unbind)
+
+typedef struct _agp_version {
+	uint16_t major;
+	uint16_t minor;
+} agp_version;
+
+typedef struct _agp_info {
+	agp_version version;	/* version of the driver        */
+	uint32_t bridge_id;	/* bridge vendor/device         */
+	uint32_t agp_mode;	/* mode info of bridge          */
+	off_t aper_base;	/* base of aperture             */
+	size_t aper_size;	/* size of aperture             */
+	size_t pg_total;	/* max pages (swap + system)    */
+	size_t pg_system;	/* max pages (system)           */
+	size_t pg_used;		/* current pages used           */
+} agp_info;
+
+typedef struct _agp_setup {
+	uint32_t agp_mode;		/* mode info of bridge          */
+} agp_setup;
+
+#if 0
+/*
+ * The "prot" down below needs still a "sleep" flag somehow ...
+ */
+typedef struct _agp_segment {
+	off_t pg_start;		/* starting page to populate    */
+	size_t pg_count;	/* number of pages              */
+	int prot;		/* prot flags for mmap          */
+} agp_segment;
+
+typedef struct _agp_region {
+	pid_t pid;		/* pid of process               */
+	size_t seg_count;	/* number of segments           */
+	struct _agp_segment *seg_list;
+} agp_region;
+#endif
+
+typedef struct _agp_allocate {
+	int key;		/* tag of allocation            */
+	size_t pg_count;	/* number of pages              */
+	uint32_t type;		/* 0 == normal, other devspec   */
+	uint32_t physical;	/* device specific (some devices
+				 * need a phys address of the
+				 * actual page behind the gatt
+				 * table)                        */
+} agp_allocate;
+
+typedef struct _agp_bind {
+	int key;		/* tag of allocation            */
+	off_t pg_start;		/* starting page to populate    */
+} agp_bind;
+
+typedef struct _agp_unbind {
+	int key;		/* tag of allocation            */
+	uint32_t priority;	/* priority for paging out      */
+} agp_unbind;
+
+#endif /* !_SYS_AGPIO_H_ */

Property changes on: lab4/.minix-src/include/sys/agpio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/cdio.h
===================================================================
--- lab4/.minix-src/include/sys/cdio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/cdio.h	(revision 13)
@@ -0,0 +1,427 @@
+/*	$NetBSD: cdio.h,v 1.34 2015/09/06 06:01:02 dholland Exp $	*/
+
+#ifndef _SYS_CDIO_H_
+#define _SYS_CDIO_H_
+
+#include <sys/ioccom.h>
+
+/* Shared between kernel & process */
+
+union msf_lba {
+	struct {
+		u_char unused;
+		u_char minute;
+		u_char second;
+		u_char frame;
+	} msf;
+	uint32_t lba;
+	u_char	addr[4];
+};
+
+struct cd_toc_entry {
+	u_char		nothing1;
+#if BYTE_ORDER == LITTLE_ENDIAN
+	uint32_t	control:4;
+	uint32_t	addr_type:4;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	uint32_t	addr_type:4;
+	uint32_t	control:4;
+#endif
+	u_char		track;
+	u_char		nothing2;
+	union msf_lba	addr;
+};
+
+struct cd_sub_channel_header {
+	u_char	nothing1;
+	u_char	audio_status;
+#define CD_AS_AUDIO_INVALID	0x00
+#define CD_AS_PLAY_IN_PROGRESS	0x11
+#define CD_AS_PLAY_PAUSED	0x12
+#define CD_AS_PLAY_COMPLETED	0x13
+#define CD_AS_PLAY_ERROR	0x14
+#define CD_AS_NO_STATUS		0x15
+	u_char	data_len[2];
+};
+
+struct cd_sub_channel_q_data {
+	u_char		data_format;
+#if BYTE_ORDER == LITTLE_ENDIAN
+	uint32_t	control:4;
+	uint32_t	addr_type:4;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	uint32_t	addr_type:4;
+	uint32_t	control:4;
+#endif
+	u_char		track_number;
+	u_char		index_number;
+	u_char		absaddr[4];
+	u_char		reladdr[4];
+#if BYTE_ORDER == LITTLE_ENDIAN
+        uint32_t  	:7;
+        uint32_t	mc_valid:1;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+        uint32_t	mc_valid:1;
+        uint32_t	:7;
+#endif
+        u_char  mc_number[15];
+#if BYTE_ORDER == LITTLE_ENDIAN
+        uint32_t	:7;
+        uint32_t	ti_valid:1;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+        uint32_t	ti_valid:1;
+        uint32_t	:7;
+#endif
+        u_char		ti_number[15];
+};
+
+struct cd_sub_channel_position_data {
+	u_char		data_format;
+#if BYTE_ORDER == LITTLE_ENDIAN
+	uint32_t	control:4;
+	uint32_t	addr_type:4;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	uint32_t	addr_type:4;
+	uint32_t	control:4;
+#endif
+	u_char		track_number;
+	u_char		index_number;
+	union msf_lba	absaddr;
+	union msf_lba	reladdr;
+};
+
+struct cd_sub_channel_media_catalog {
+	u_char		data_format;
+	u_char		nothing1;
+	u_char		nothing2;
+	u_char		nothing3;
+#if BYTE_ORDER == LITTLE_ENDIAN
+	uint32_t	:7;
+	uint32_t	mc_valid:1;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	uint32_t	mc_valid:1;
+	uint32_t	:7;
+#endif
+	u_char		mc_number[15];
+};
+
+struct cd_sub_channel_track_info {
+	u_char		data_format;
+	u_char		nothing1;
+	u_char		track_number;
+	u_char		nothing2;
+#if BYTE_ORDER == LITTLE_ENDIAN
+	uint32_t	:7;
+	uint32_t	ti_valid:1;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	uint32_t	ti_valid:1;
+	uint32_t	:7;
+#endif
+	u_char		ti_number[15];
+};
+
+struct cd_sub_channel_info {
+	struct cd_sub_channel_header header;
+	union {
+		struct cd_sub_channel_q_data q_data;
+		struct cd_sub_channel_position_data position;
+		struct cd_sub_channel_media_catalog media_catalog;
+		struct cd_sub_channel_track_info track_info;
+	} what;
+};
+
+/*
+ * Ioctls for the CD drive
+ */
+struct ioc_play_track {
+	u_char	start_track;
+	u_char	start_index;
+	u_char	end_track;
+	u_char	end_index;
+};
+
+#define	CDIOCPLAYTRACKS	_IOW('c', 1, struct ioc_play_track)
+struct ioc_play_blocks {
+	int	blk;
+	int	len;
+};
+#define	CDIOCPLAYBLOCKS	_IOW('c', 2, struct ioc_play_blocks)
+
+struct ioc_read_subchannel {
+	u_char	address_format;
+#define CD_LBA_FORMAT		1
+#define CD_MSF_FORMAT		2
+	u_char	data_format;
+#define CD_SUBQ_DATA		0
+#define CD_CURRENT_POSITION	1
+#define CD_MEDIA_CATALOG	2
+#define CD_TRACK_INFO		3
+	u_char	track;
+	int	data_len;
+	struct	cd_sub_channel_info *data;
+};
+#define CDIOCREADSUBCHANNEL _IOWR('c', 3, struct ioc_read_subchannel )
+
+#ifdef _KERNEL
+/* As above, but with the buffer following the request for in-kernel users. */
+struct ioc_read_subchannel_buf {
+	struct ioc_read_subchannel req;
+	struct cd_sub_channel_info info;
+};
+#define CDIOCREADSUBCHANNEL_BUF _IOWR('c', 3, struct ioc_read_subchannel_buf)
+#endif
+
+struct ioc_toc_header {
+	u_short	len;
+	u_char	starting_track;
+	u_char	ending_track;
+};
+
+#define CDIOREADTOCHEADER _IOR('c', 4, struct ioc_toc_header)
+
+struct ioc_read_toc_entry {
+	u_char	address_format;
+	u_char	starting_track;
+	u_short	data_len;
+	struct	cd_toc_entry *data;
+};
+#define CDIOREADTOCENTRIES _IOWR('c', 5, struct ioc_read_toc_entry)
+#define CDIOREADTOCENTRYS CDIOREADTOCENTRIES
+
+#ifdef _KERNEL
+/* As above, but with the buffer following the request for in-kernel users. */
+struct ioc_read_toc_entry_buf {
+	struct ioc_read_toc_entry req;
+	struct cd_toc_entry       entry[100];   /* NB: 8 bytes each */
+};
+#define CDIOREADTOCENTRIES_BUF _IOWR('c', 5, struct ioc_read_toc_entry_buf)
+#endif
+
+/* read LBA start of a given session; 0=last, others not yet supported */
+#define CDIOREADMSADDR _IOWR('c', 6, int)
+
+struct	ioc_patch {
+	u_char	patch[4];	/* one for each channel */
+};
+#define	CDIOCSETPATCH	_IOW('c', 9, struct ioc_patch)
+
+struct	ioc_vol {
+	u_char	vol[4];	/* one for each channel */
+};
+#define	CDIOCGETVOL	_IOR('c', 10, struct ioc_vol)
+#define	CDIOCSETVOL	_IOW('c', 11, struct ioc_vol)
+#define	CDIOCSETMONO	_IO('c', 12)
+#define	CDIOCSETSTEREO	_IO('c', 13)
+#define	CDIOCSETMUTE	_IO('c', 14)
+#define	CDIOCSETLEFT	_IO('c', 15)
+#define	CDIOCSETRIGHT	_IO('c', 16)
+#define	CDIOCSETDEBUG	_IO('c', 17)
+#define	CDIOCCLRDEBUG	_IO('c', 18)
+#define	CDIOCPAUSE	_IO('c', 19)
+#define	CDIOCRESUME	_IO('c', 20)
+#define	CDIOCRESET	_IO('c', 21)
+#define	CDIOCSTART	_IO('c', 22)
+#define	CDIOCSTOP	_IO('c', 23)
+#define	CDIOCEJECT	_IO('c', 24)
+#define	CDIOCALLOW	_IO('c', 25)
+#define	CDIOCPREVENT	_IO('c', 26)
+#define	CDIOCCLOSE	_IO('c', 27)
+
+struct ioc_play_msf {
+	u_char	start_m;
+	u_char	start_s;
+	u_char	start_f;
+	u_char	end_m;
+	u_char	end_s;
+	u_char	end_f;
+};
+#define	CDIOCPLAYMSF	_IOW('c', 25, struct ioc_play_msf)
+
+struct ioc_load_unload {
+	u_char options;
+#define	CD_LU_ABORT	0x1	/* NOTE: These are the same as the ATAPI */
+#define	CD_LU_UNLOAD	0x2	/* op values for the LOAD_UNLOAD command */
+#define	CD_LU_LOAD	0x3
+	u_char slot;
+};
+#define		CDIOCLOADUNLOAD	_IOW('c', 26, struct ioc_load_unload)
+
+
+#if defined(_KERNEL) || defined(_EXPOSE_MMC)
+/* not exposed to userland yet until its completely mature */
+/*
+ * MMC device abstraction interface.
+ *
+ * It gathers information from GET_CONFIGURATION, READ_DISCINFO,
+ * READ_TRACKINFO, READ_TOC2, READ_CD_CAPACITY and GET_CONFIGURATION
+ * SCSI/ATAPI calls regardless if its a legacy CD-ROM/DVD-ROM device or a MMC
+ * standard recordable device.
+ */
+struct mmc_discinfo {
+	uint16_t	mmc_profile;
+	uint16_t	mmc_class;
+
+	uint8_t		disc_state;
+	uint8_t		last_session_state;
+	uint8_t		bg_format_state;
+	uint8_t		link_block_penalty;	/* in sectors		   */
+
+	uint64_t	mmc_cur;		/* current MMC_CAPs        */
+	uint64_t	mmc_cap;		/* possible MMC_CAPs       */
+
+	uint32_t	disc_flags;		/* misc flags              */
+
+	uint32_t	disc_id;
+	uint64_t	disc_barcode;
+	uint8_t		application_code;	/* 8 bit really            */
+
+	uint8_t		unused1[3];		/* padding                 */
+
+	uint32_t	last_possible_lba;	/* last leadout start adr. */
+	uint32_t	sector_size;
+
+	uint16_t	num_sessions;
+	uint16_t	num_tracks;		/* derived */
+
+	uint16_t	first_track;
+	uint16_t	first_track_last_session;
+	uint16_t	last_track_last_session;
+
+	uint16_t	unused2;		/* padding/misc info resv. */
+
+	uint16_t	reserved1[4];		/* MMC-5 track resources   */
+	uint32_t	reserved2[3];		/* MMC-5 POW resources     */
+
+	uint32_t	reserved3[8];		/* MMC-5+ */
+};
+#define MMCGETDISCINFO	_IOR('c', 28, struct mmc_discinfo)
+
+#define MMC_CLASS_UNKN  0
+#define MMC_CLASS_DISC	1
+#define MMC_CLASS_CD	2
+#define MMC_CLASS_DVD	3
+#define MMC_CLASS_MO	4
+#define MMC_CLASS_BD	5
+#define MMC_CLASS_FILE	0xffff	/* emulation mode */
+
+#define MMC_DFLAGS_BARCODEVALID	(1 <<  0)  /* barcode is present and valid   */
+#define MMC_DFLAGS_DISCIDVALID  (1 <<  1)  /* discid is present and valid    */
+#define MMC_DFLAGS_APPCODEVALID (1 <<  2)  /* application code valid         */
+#define MMC_DFLAGS_UNRESTRICTED (1 <<  3)  /* restricted, then set app. code */
+
+#define MMC_DFLAGS_FLAGBITS \
+    "\10\1BARCODEVALID\2DISCIDVALID\3APPCODEVALID\4UNRESTRICTED"
+
+#define MMC_CAP_SEQUENTIAL	(1 <<  0)  /* sequential writable only       */
+#define MMC_CAP_RECORDABLE	(1 <<  1)  /* record-able; i.e. not static   */
+#define MMC_CAP_ERASABLE	(1 <<  2)  /* drive can erase sectors        */
+#define MMC_CAP_BLANKABLE	(1 <<  3)  /* media can be blanked           */
+#define MMC_CAP_FORMATTABLE	(1 <<  4)  /* media can be formatted         */
+#define MMC_CAP_REWRITABLE	(1 <<  5)  /* media can be rewritten         */
+#define MMC_CAP_MRW		(1 <<  6)  /* Mount Rainier formatted        */
+#define MMC_CAP_PACKET		(1 <<  7)  /* using packet recording         */
+#define MMC_CAP_STRICTOVERWRITE	(1 <<  8)  /* only writes a packet at a time */
+#define MMC_CAP_PSEUDOOVERWRITE (1 <<  9)  /* overwrite through replacement  */
+#define MMC_CAP_ZEROLINKBLK	(1 << 10)  /* zero link block length capable */
+#define MMC_CAP_HW_DEFECTFREE	(1 << 11)  /* hardware defect management     */
+
+#define MMC_CAP_FLAGBITS \
+    "\10\1SEQUENTIAL\2RECORDABLE\3ERASABLE\4BLANKABLE\5FORMATTABLE" \
+    "\6REWRITABLE\7MRW\10PACKET\11STRICTOVERWRITE\12PSEUDOOVERWRITE" \
+    "\13ZEROLINKBLK\14HW_DEFECTFREE"
+
+#define MMC_STATE_EMPTY		0
+#define MMC_STATE_INCOMPLETE	1
+#define MMC_STATE_FULL		2
+#define MMC_STATE_CLOSED	3
+
+#define MMC_BGFSTATE_UNFORM	0
+#define MMC_BGFSTATE_STOPPED	1
+#define MMC_BGFSTATE_RUNNING	2
+#define	MMC_BGFSTATE_COMPLETED	3
+
+
+struct mmc_trackinfo {
+	uint16_t	tracknr;	/* IN/OUT */
+	uint16_t	sessionnr;
+
+	uint8_t		track_mode;
+	uint8_t		data_mode;
+
+	uint16_t	flags;
+
+	uint32_t	track_start;
+	uint32_t	next_writable;
+	uint32_t	free_blocks;
+	uint32_t	packet_size;
+	uint32_t	track_size;
+	uint32_t	last_recorded;
+};
+#define MMCGETTRACKINFO	_IOWR('c', 29, struct mmc_trackinfo)
+
+#define MMC_TRACKINFO_COPY		(1 <<  0)
+#define MMC_TRACKINFO_DAMAGED		(1 <<  1)
+#define MMC_TRACKINFO_FIXED_PACKET	(1 <<  2)
+#define MMC_TRACKINFO_INCREMENTAL	(1 <<  3)
+#define MMC_TRACKINFO_BLANK		(1 <<  4)
+#define MMC_TRACKINFO_RESERVED		(1 <<  5)
+#define MMC_TRACKINFO_NWA_VALID		(1 <<  6)
+#define MMC_TRACKINFO_LRA_VALID		(1 <<  7)
+#define MMC_TRACKINFO_DATA		(1 <<  8)
+#define MMC_TRACKINFO_AUDIO		(1 <<  9)
+#define MMC_TRACKINFO_AUDIO_4CHAN	(1 << 10)
+#define MMC_TRACKINFO_PRE_EMPH		(1 << 11)
+
+#define MMC_TRACKINFO_FLAGBITS \
+    "\10\1COPY\2DAMAGED\3FIXEDPACKET\4INCREMENTAL\5BLANK" \
+    "\6RESERVED\7NWA_VALID\10LRA_VALID\11DATA\12AUDIO" \
+    "\13AUDIO_4CHAN\14PRE_EMPH"
+
+struct mmc_op {
+	uint16_t	operation;		/* IN */
+	uint16_t	mmc_profile;		/* IN */
+
+	/* parameters to operation */
+	uint16_t	tracknr;		/* IN */
+	uint16_t	sessionnr;		/* IN */
+	uint32_t	extent;			/* IN */
+
+	uint32_t	reserved[4];
+};
+#define MMCOP _IOWR('c', 30, struct mmc_op)
+
+#define MMC_OP_SYNCHRONISECACHE		 1
+#define MMC_OP_CLOSETRACK		 2
+#define MMC_OP_CLOSESESSION		 3
+#define MMC_OP_FINALISEDISC		 4
+#define MMC_OP_RESERVETRACK		 5
+#define MMC_OP_RESERVETRACK_NWA		 6
+#define MMC_OP_UNRESERVETRACK		 7
+#define MMC_OP_REPAIRTRACK		 8
+#define MMC_OP_UNCLOSELASTSESSION	 9
+#define MMC_OP_MAX			 9
+
+struct mmc_writeparams {
+	uint16_t	tracknr;		/* IN */
+	uint16_t	mmc_class;		/* IN */
+	uint32_t	mmc_cur;		/* IN */
+	uint32_t	blockingnr;		/* IN */
+
+	/* when tracknr == 0 */
+	uint8_t		track_mode;		/* IN; normally 5 */
+	uint8_t		data_mode;		/* IN; normally 2 */
+};
+#define MMC_TRACKMODE_DEFAULT	5		/* data, incremental recording */
+#define MMC_DATAMODE_DEFAULT	2		/* CDROM XA disc */
+#define MMCSETUPWRITEPARAMS _IOW('c', 31, struct mmc_writeparams)
+
+#endif /* _KERNEL || _EXPOSE_MMC */
+
+#endif /* !_SYS_CDIO_H_ */

Property changes on: lab4/.minix-src/include/sys/cdio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/condvar.h
===================================================================
--- lab4/.minix-src/include/sys/condvar.h	(nonexistent)
+++ lab4/.minix-src/include/sys/condvar.h	(revision 13)
@@ -0,0 +1,62 @@
+/*	$NetBSD: condvar.h,v 1.12 2009/12/05 22:38:19 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_CONDVAR_H_
+#define	_SYS_CONDVAR_H_
+
+#include <sys/mutex.h>
+
+typedef struct kcondvar {
+	void		*cv_opaque[3];
+} kcondvar_t;
+
+#ifdef _KERNEL
+
+void	cv_init(kcondvar_t *, const char *);
+void	cv_destroy(kcondvar_t *);
+
+void	cv_wait(kcondvar_t *, kmutex_t *);
+int	cv_wait_sig(kcondvar_t *, kmutex_t *);
+int	cv_timedwait(kcondvar_t *, kmutex_t *, int);
+int	cv_timedwait_sig(kcondvar_t *, kmutex_t *, int);
+
+void	cv_signal(kcondvar_t *);
+void	cv_broadcast(kcondvar_t *);
+
+bool	cv_has_waiters(kcondvar_t *);
+bool	cv_is_valid(kcondvar_t *);
+
+/* The "lightning bolt", awoken once per second by the clock interrupt. */
+extern kcondvar_t lbolt;
+
+#endif	/* _KERNEL */
+
+#endif /* _SYS_CONDVAR_H_ */

Property changes on: lab4/.minix-src/include/sys/condvar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/common_ansi.h
===================================================================
--- lab4/.minix-src/include/sys/common_ansi.h	(nonexistent)
+++ lab4/.minix-src/include/sys/common_ansi.h	(revision 13)
@@ -0,0 +1,76 @@
+/*	$NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_COMMON_ANSI_H_
+#define _SYS_COMMON_ANSI_H_
+
+#include <sys/cdefs.h>
+
+#include <machine/int_types.h>
+
+#if !defined(__PTRDIFF_TYPE__)
+#error __PTRDIFF_TYPE__ not present
+#endif
+
+#if !defined(__SIZE_TYPE__)
+#error __SIZE_TYPE__ not present
+#endif
+
+#if !defined(__WCHAR_TYPE__)
+#error __WCHAR_TYPE__ not present
+#endif
+
+#if !defined(__WINT_TYPE__)
+#error __WINT_TYPE__ not present
+#endif
+
+/*
+ * Types which are fundamental to the implementation and may appear in
+ * more than one standard header are defined here.  Standard headers
+ * then use:
+ *	#ifdef	_BSD_SIZE_T_
+ *	typedef	_BSD_SIZE_T_ size_t;
+ *	#undef	_BSD_SIZE_T_
+ *	#endif
+ */
+#define	_BSD_CLOCK_T_		unsigned int	/* clock() */
+#define	_BSD_PTRDIFF_T_		__PTRDIFF_TYPE__ /* ptr1 - ptr2 */
+#define	_BSD_SSIZE_T_		__PTRDIFF_TYPE__ /* byte count or error */
+#define	_BSD_SIZE_T_		__SIZE_TYPE__	/* sizeof() */
+#define	_BSD_TIME_T_		__int64_t	/* time() */
+#define	_BSD_CLOCKID_T_		int		/* clockid_t */
+#define	_BSD_TIMER_T_		int		/* timer_t */
+#define	_BSD_SUSECONDS_T_	int		/* suseconds_t */
+#define	_BSD_USECONDS_T_	unsigned int	/* useconds_t */
+#define	_BSD_WCHAR_T_		__WCHAR_TYPE__	/* wchar_t */
+#define	_BSD_WINT_T_		__WINT_TYPE__	/* wint_t */
+
+#endif	/* _SYS_COMMON_ANSI_H_ */

Property changes on: lab4/.minix-src/include/sys/common_ansi.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ssp/strings.h
===================================================================
--- lab4/.minix-src/include/ssp/strings.h	(nonexistent)
+++ lab4/.minix-src/include/ssp/strings.h	(revision 13)
@@ -0,0 +1,48 @@
+/*	$NetBSD: strings.h,v 1.3 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _SSP_STRINGS_H_
+#define _SSP_STRINGS_H_
+
+#include <ssp/ssp.h>
+
+#if __SSP_FORTIFY_LEVEL > 0
+
+#define bcopy(src, dst, len) \
+    ((__ssp_bos0(dst) != (size_t)-1) ? \
+    __builtin___memmove_chk(dst, src, len, __ssp_bos0(dst)) : \
+    __memmove_ichk(dst, src, len))
+#define bzero(dst, len) \
+    ((__ssp_bos0(dst) != (size_t)-1) ? \
+    __builtin___memset_chk(dst, 0, len, __ssp_bos0(dst)) : \
+    __memset_ichk(dst, 0, len))
+
+#endif /* __SSP_FORTIFY_LEVEL > 0 */
+#endif /* _SSP_STRINGS_H_ */

Property changes on: lab4/.minix-src/include/ssp/strings.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/cpuio.h
===================================================================
--- lab4/.minix-src/include/sys/cpuio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/cpuio.h	(revision 13)
@@ -0,0 +1,95 @@
+/*	$NetBSD: cpuio.h,v 1.9 2013/01/05 16:36:38 dsl Exp $	*/
+
+/*-
+ * Copyright (c) 2007, 2009, 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(_SYS_CPUIO_H_)
+#define	_SYS_CPUIO_H_
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/ioccom.h>
+
+#ifndef _KERNEL
+#include <limits.h>
+#include <stdbool.h>
+#endif
+
+/*
+ * This is not a great place to describe CPU properties, those
+ * are better returned via autoconf.
+ */
+typedef struct cpustate {
+	u_int		cs_id;		/* matching ci_cpuid */
+	bool		cs_online;	/* running unbound LWPs */
+	bool		cs_intr;	/* fielding interrupts */
+	bool		cs_unused[2];	/* reserved */
+	int32_t		cs_lastmod;	/* time of last state change */
+	char		cs_name[16];	/* reserved */
+	int32_t		cs_lastmodhi;	/* time of last state change */
+	uint32_t	cs_intrcnt;	/* count of interrupt handlers + 1 */
+	uint32_t	cs_hwid;	/* hardware id */
+	uint32_t	cs_reserved;	/* reserved */
+} cpustate_t;
+
+#define	IOC_CPU_SETSTATE	_IOW('c', 0, cpustate_t)
+#define	IOC_CPU_GETSTATE	_IOWR('c', 1, cpustate_t)
+#define	IOC_CPU_GETCOUNT	_IOR('c', 2, int)
+#define	IOC_CPU_MAPID		_IOWR('c', 3, int)
+/* 4 and 5 reserved for compat nb6 x86 amd ucode loader */
+
+struct cpu_ucode_version {
+	int loader_version;	/* IN: md version number */
+	void *data;		/* OUT: CPU ID data */
+};
+
+#define IOC_CPU_UCODE_GET_VERSION	_IOWR('c', 6, struct cpu_ucode_version)
+
+#ifdef __i386__
+/* In order to read the info from an amd64 kernel we need ... */
+struct cpu_ucode_version_64 {
+	int loader_version;	/* IN: md version number */
+	int pad1;
+	void *data;		/* OUT: CPU ID data */
+	int must_be_zero;
+};
+#define IOC_CPU_UCODE_GET_VERSION_64	_IOWR('c', 6, struct cpu_ucode_version_64)
+#endif
+
+struct cpu_ucode {
+	int loader_version;	/* md version number */
+	int cpu_nr;		/* CPU index or special value below */
+#define CPU_UCODE_ALL_CPUS (-1)
+#define CPU_UCODE_CURRENT_CPU (-2)
+	char fwname[PATH_MAX];
+};
+
+#define IOC_CPU_UCODE_APPLY		_IOW('c', 7, struct cpu_ucode)
+
+#endif /* !_SYS_CPUIO_H_ */

Property changes on: lab4/.minix-src/include/sys/cpuio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/asynchio.h
===================================================================
--- lab4/.minix-src/include/sys/asynchio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/asynchio.h	(revision 13)
@@ -0,0 +1,43 @@
+/*	asynchio.h - Asynchronous I/O			Author: Kees J. Bot
+ *								7 Jul 1997
+ * Minix-vmd compatible asynchio(3) using BSD select(2).
+ */
+#ifndef _SYS__ASYNCHIO_H
+#define _SYS__ASYNCHIO_H
+
+#include <sys/select.h>			/* for FD_SETSIZE */
+
+#define SEL_READ	0		/* Code for a read. */
+#define SEL_WRITE	1		/* Code for a write. */
+#define SEL_EXCEPT	2		/* Code for some exception. */
+#define SEL_NR		3		/* Number of codes. */
+
+struct _asynfd {
+	int		afd_seen;	/* Set if we manage this descriptor. */
+	int		afd_flags;	/* File flags by fcntl(fd, F_GETFL). */
+	int		afd_state[SEL_NR];  /* Operation state. */
+};
+
+typedef struct {
+	int		asyn_more;	/* Set if more to do before blocking. */
+	struct _asynfd	asyn_afd[FD_SETSIZE];
+	fd_set		asyn_fdset[SEL_NR];	/* Select() fd sets. */
+} asynchio_t;
+
+#define ASYN_INPROGRESS	EAGAIN		/* Errno code telling "nothing yet." */
+#define ASYN_NONBLOCK	0x01		/* If asyn_wait() mustn't block. */
+
+struct timeval;
+
+void asyn_init(asynchio_t *_asyn);
+ssize_t asyn_read(asynchio_t *_asyn, int _fd, void *_buf, size_t _len);
+ssize_t asyn_write(asynchio_t *_asyn, int _fd, const void *_buf, size_t _len);
+int asyn_special(asynchio_t *_asyn, int _fd, int _op);
+int asyn_result(asynchio_t *_asyn, int _fd, int _op, int _result);
+int asyn_wait(asynchio_t *_asyn, int _flags, struct timeval *to);
+int asyn_cancel(asynchio_t *_asyn, int _fd, int _op);
+int asyn_pending(asynchio_t *_asyn, int _fd, int _op);
+int asyn_synch(asynchio_t *_asyn, int _fd);
+int asyn_close(asynchio_t *_asyn, int _fd);
+
+#endif /* _SYS__ASYNCHIO_H */

Property changes on: lab4/.minix-src/include/sys/asynchio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/device_if.h
===================================================================
--- lab4/.minix-src/include/sys/device_if.h	(nonexistent)
+++ lab4/.minix-src/include/sys/device_if.h	(revision 13)
@@ -0,0 +1,27 @@
+/*	$NetBSD: device_if.h,v 1.5 2010/02/24 22:38:10 dyoung Exp $	*/
+
+#ifndef	_SYS_DEVICE_IF_H
+#define	_SYS_DEVICE_IF_H
+
+struct device;
+typedef struct device *device_t;
+
+#ifdef _KERNEL
+typedef enum devact_level {
+	  DEVACT_LEVEL_CLASS	= 0
+	, DEVACT_LEVEL_DRIVER	= 1
+	, DEVACT_LEVEL_BUS	= 2
+} devact_level_t;
+
+#define	DEVACT_LEVEL_FULL	DEVACT_LEVEL_CLASS
+
+struct device_lock;
+struct device_suspensor;
+
+typedef uint64_t devgen_t;
+
+typedef struct device_lock *device_lock_t;
+typedef struct device_suspensor device_suspensor_t;
+#endif
+
+#endif	/* _SYS_DEVICE_IF_H */

Property changes on: lab4/.minix-src/include/sys/device_if.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/common_int_mwgwtypes.h
===================================================================
--- lab4/.minix-src/include/sys/common_int_mwgwtypes.h	(nonexistent)
+++ lab4/.minix-src/include/sys/common_int_mwgwtypes.h	(revision 13)
@@ -0,0 +1,69 @@
+/*	$NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_COMMON_INT_MWGWTYPES_H_
+#define _SYS_COMMON_INT_MWGWTYPES_H_
+
+#ifndef __UINT_FAST64_TYPE__
+#error Your compiler does not provide min/fast width type macros.
+#endif
+
+/*
+ * 7.18.1 Integer types
+ */
+
+/* 7.18.1.2 Minimum-width integer types */
+
+typedef	__INT_LEAST8_TYPE__		  int_least8_t;
+typedef	__UINT_LEAST8_TYPE__		 uint_least8_t;
+typedef	__INT_LEAST16_TYPE__		 int_least16_t;
+typedef	__UINT_LEAST16_TYPE__		uint_least16_t;
+typedef	__INT_LEAST32_TYPE__		 int_least32_t;
+typedef	__UINT_LEAST32_TYPE__		uint_least32_t;
+typedef	__INT_LEAST64_TYPE__		 int_least64_t;
+typedef	__UINT_LEAST64_TYPE__		uint_least64_t;
+
+/* 7.18.1.3 Fastest minimum-width integer types */
+typedef	__INT_FAST8_TYPE__		   int_fast8_t;
+typedef	__UINT_FAST8_TYPE__		  uint_fast8_t;
+typedef	__INT_FAST16_TYPE__		  int_fast16_t;
+typedef	__UINT_FAST16_TYPE__		 uint_fast16_t;
+typedef	__INT_FAST32_TYPE__		  int_fast32_t;
+typedef	__UINT_FAST32_TYPE__		 uint_fast32_t;
+typedef	__INT_FAST64_TYPE__		  int_fast64_t;
+typedef	__UINT_FAST64_TYPE__		 uint_fast64_t;
+
+/* 7.18.1.5 Greatest-width integer types */
+
+typedef	__INTMAX_TYPE__			      intmax_t;
+typedef	__UINTMAX_TYPE__		     uintmax_t;
+
+#endif /* _SYS_COMMON_INT_MWGWTYPES_H_ */

Property changes on: lab4/.minix-src/include/sys/common_int_mwgwtypes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/aio.h
===================================================================
--- lab4/.minix-src/include/sys/aio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/aio.h	(revision 13)
@@ -0,0 +1,126 @@
+/*	$NetBSD: aio.h,v 1.12 2012/01/07 19:48:19 christos Exp $	*/
+
+/*
+ * Copyright (c) 2007, Mindaugas Rasiukevicius <rmind at NetBSD org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_AIO_H_
+#define _SYS_AIO_H_
+
+#include <sys/types.h>
+#include <sys/signal.h>
+
+/* Returned by aio_cancel() */
+#define AIO_CANCELED		0x1
+#define AIO_NOTCANCELED		0x2
+#define AIO_ALLDONE		0x3
+
+/* LIO opcodes */
+#define LIO_NOP			0x0
+#define LIO_WRITE		0x1
+#define LIO_READ		0x2
+
+/* LIO modes */
+#define LIO_NOWAIT		0x0
+#define LIO_WAIT		0x1
+
+/*
+ * Asynchronous I/O structure.
+ * Defined in the Base Definitions volume of IEEE Std 1003.1-2001 .
+ */
+struct aiocb {
+	off_t aio_offset;		/* File offset */
+	volatile void *aio_buf;		/* I/O buffer in process space */
+	size_t aio_nbytes;		/* Length of transfer */
+	int aio_fildes;			/* File descriptor */
+	int aio_lio_opcode;		/* LIO opcode */
+	int aio_reqprio;		/* Request priority offset */
+	struct sigevent aio_sigevent;	/* Signal to deliver */
+
+	/* Internal kernel variables */
+	int _state;			/* State of the job */
+	int _errno;			/* Error value */
+	ssize_t _retval;		/* Return value */
+};
+
+/* Internal kernel data */
+#ifdef _KERNEL
+
+/* Default limits of allowed AIO operations */
+#define AIO_LISTIO_MAX		512
+#define AIO_MAX			AIO_LISTIO_MAX * 16
+
+#include <sys/condvar.h>
+#include <sys/lwp.h>
+#include <sys/mutex.h>
+#include <sys/pool.h>
+#include <sys/queue.h>
+
+/* Operations (as flags) */
+#define AIO_LIO			0x00
+#define AIO_READ		0x01
+#define AIO_WRITE		0x02
+#define AIO_SYNC		0x04
+#define AIO_DSYNC		0x08
+
+/* Job states */
+#define JOB_NONE		0x0
+#define JOB_WIP			0x1
+#define JOB_DONE		0x2
+
+/* Structure of AIO job */
+struct aio_job {
+	int aio_op;		/* Operation code */
+	struct aiocb aiocbp;	/* AIO data structure */
+	void *aiocb_uptr;	/* User-space pointer for identification of job */
+	TAILQ_ENTRY(aio_job) list;
+	struct lio_req *lio;
+};
+
+/* LIO structure */
+struct lio_req {
+	u_int refcnt;		/* Reference counter */
+	struct sigevent sig;	/* Signal of lio_listio() calls */
+};
+
+/* Structure of AIO data for process */
+struct aioproc {
+	kmutex_t aio_mtx;		/* Protects the entire structure */
+	kcondvar_t aio_worker_cv;	/* Signals on a new job */
+	kcondvar_t done_cv;		/* Signals when the job is done */
+	struct aio_job *curjob;		/* Currently processing AIO job */
+	unsigned int jobs_count;	/* Count of the jobs */
+	TAILQ_HEAD(, aio_job) jobs_queue;/* Queue of the AIO jobs */
+	struct lwp *aio_worker;		/* AIO worker thread */
+};
+
+extern u_int aio_listio_max;
+/* Prototypes */
+void	aio_print_jobs(void (*)(const char *, ...) __printflike(1, 2));
+int	aio_suspend1(struct lwp *, struct aiocb **, int, struct timespec *);
+
+#endif /* _KERNEL */
+
+#endif /* _SYS_AIO_H_ */

Property changes on: lab4/.minix-src/include/sys/aio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/bitops.h
===================================================================
--- lab4/.minix-src/include/sys/bitops.h	(nonexistent)
+++ lab4/.minix-src/include/sys/bitops.h	(revision 13)
@@ -0,0 +1,329 @@
+/*	$NetBSD: bitops.h,v 1.11 2012/12/07 02:27:58 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas and Joerg Sonnenberger.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _SYS_BITOPS_H_
+#define _SYS_BITOPS_H_
+
+#include <sys/stdint.h>
+
+/*
+ * Find First Set functions
+ */
+#ifndef ffs32
+static __inline int __unused
+ffs32(uint32_t _n)
+{
+	int _v;
+
+	if (!_n)
+		return 0;
+
+	_v = 1;
+	if ((_n & 0x0000FFFFU) == 0) {
+		_n >>= 16;
+		_v += 16;
+	}
+	if ((_n & 0x000000FFU) == 0) {
+		_n >>= 8;
+		_v += 8;
+	}
+	if ((_n & 0x0000000FU) == 0) {
+		_n >>= 4;
+		_v += 4;
+	}
+	if ((_n & 0x00000003U) == 0) {
+		_n >>= 2;
+		_v += 2;
+	}
+	if ((_n & 0x00000001U) == 0) {
+		_n >>= 1;
+		_v += 1;
+	}
+	return _v;
+}
+#endif
+
+#ifndef ffs64
+static __inline int __unused
+ffs64(uint64_t _n)
+{
+	int _v;
+
+	if (!_n)
+		return 0;
+
+	_v = 1;
+	if ((_n & 0x00000000FFFFFFFFULL) == 0) {
+		_n >>= 32;
+		_v += 32;
+	}
+	if ((_n & 0x000000000000FFFFULL) == 0) {
+		_n >>= 16;
+		_v += 16;
+	}
+	if ((_n & 0x00000000000000FFULL) == 0) {
+		_n >>= 8;
+		_v += 8;
+	}
+	if ((_n & 0x000000000000000FULL) == 0) {
+		_n >>= 4;
+		_v += 4;
+	}
+	if ((_n & 0x0000000000000003ULL) == 0) {
+		_n >>= 2;
+		_v += 2;
+	}
+	if ((_n & 0x0000000000000001ULL) == 0) {
+		_n >>= 1;
+		_v += 1;
+	}
+	return _v;
+}
+#endif
+
+/*
+ * Find Last Set functions
+ */
+#ifndef fls32
+static __inline int __unused
+fls32(uint32_t _n)
+{
+	int _v;
+
+	if (!_n)
+		return 0;
+
+	_v = 32;
+	if ((_n & 0xFFFF0000U) == 0) {
+		_n <<= 16;
+		_v -= 16;
+	}
+	if ((_n & 0xFF000000U) == 0) {
+		_n <<= 8;
+		_v -= 8;
+	}
+	if ((_n & 0xF0000000U) == 0) {
+		_n <<= 4;
+		_v -= 4;
+	}
+	if ((_n & 0xC0000000U) == 0) {
+		_n <<= 2;
+		_v -= 2;
+	}
+	if ((_n & 0x80000000U) == 0) {
+		_n <<= 1;
+		_v -= 1;
+	}
+	return _v;
+}
+#endif
+
+#ifndef fls64
+static __inline int __unused
+fls64(uint64_t _n)
+{
+	int _v;
+
+	if (!_n)
+		return 0;
+
+	_v = 64;
+	if ((_n & 0xFFFFFFFF00000000ULL) == 0) {
+		_n <<= 32;
+		_v -= 32;
+	}
+	if ((_n & 0xFFFF000000000000ULL) == 0) {
+		_n <<= 16;
+		_v -= 16;
+	}
+	if ((_n & 0xFF00000000000000ULL) == 0) {
+		_n <<= 8;
+		_v -= 8;
+	}
+	if ((_n & 0xF000000000000000ULL) == 0) {
+		_n <<= 4;
+		_v -= 4;
+	}
+	if ((_n & 0xC000000000000000ULL) == 0) {
+		_n <<= 2;
+		_v -= 2;
+	}
+	if ((_n & 0x8000000000000000ULL) == 0) {
+		_n <<= 1;
+		_v -= 1;
+	}
+	return _v;
+}
+#endif
+
+/*
+ * Integer logarithm, returns -1 on error. Inspired by the linux
+ * version written by David Howells.
+ */
+#define _ilog2_helper(_n, _x)	((_n) & (1ULL << (_x))) ? _x :
+#define _ilog2_const(_n) ( \
+	_ilog2_helper(_n, 63) \
+	_ilog2_helper(_n, 62) \
+	_ilog2_helper(_n, 61) \
+	_ilog2_helper(_n, 60) \
+	_ilog2_helper(_n, 59) \
+	_ilog2_helper(_n, 58) \
+	_ilog2_helper(_n, 57) \
+	_ilog2_helper(_n, 56) \
+	_ilog2_helper(_n, 55) \
+	_ilog2_helper(_n, 54) \
+	_ilog2_helper(_n, 53) \
+	_ilog2_helper(_n, 52) \
+	_ilog2_helper(_n, 51) \
+	_ilog2_helper(_n, 50) \
+	_ilog2_helper(_n, 49) \
+	_ilog2_helper(_n, 48) \
+	_ilog2_helper(_n, 47) \
+	_ilog2_helper(_n, 46) \
+	_ilog2_helper(_n, 45) \
+	_ilog2_helper(_n, 44) \
+	_ilog2_helper(_n, 43) \
+	_ilog2_helper(_n, 42) \
+	_ilog2_helper(_n, 41) \
+	_ilog2_helper(_n, 40) \
+	_ilog2_helper(_n, 39) \
+	_ilog2_helper(_n, 38) \
+	_ilog2_helper(_n, 37) \
+	_ilog2_helper(_n, 36) \
+	_ilog2_helper(_n, 35) \
+	_ilog2_helper(_n, 34) \
+	_ilog2_helper(_n, 33) \
+	_ilog2_helper(_n, 32) \
+	_ilog2_helper(_n, 31) \
+	_ilog2_helper(_n, 30) \
+	_ilog2_helper(_n, 29) \
+	_ilog2_helper(_n, 28) \
+	_ilog2_helper(_n, 27) \
+	_ilog2_helper(_n, 26) \
+	_ilog2_helper(_n, 25) \
+	_ilog2_helper(_n, 24) \
+	_ilog2_helper(_n, 23) \
+	_ilog2_helper(_n, 22) \
+	_ilog2_helper(_n, 21) \
+	_ilog2_helper(_n, 20) \
+	_ilog2_helper(_n, 19) \
+	_ilog2_helper(_n, 18) \
+	_ilog2_helper(_n, 17) \
+	_ilog2_helper(_n, 16) \
+	_ilog2_helper(_n, 15) \
+	_ilog2_helper(_n, 14) \
+	_ilog2_helper(_n, 13) \
+	_ilog2_helper(_n, 12) \
+	_ilog2_helper(_n, 11) \
+	_ilog2_helper(_n, 10) \
+	_ilog2_helper(_n,  9) \
+	_ilog2_helper(_n,  8) \
+	_ilog2_helper(_n,  7) \
+	_ilog2_helper(_n,  6) \
+	_ilog2_helper(_n,  5) \
+	_ilog2_helper(_n,  4) \
+	_ilog2_helper(_n,  3) \
+	_ilog2_helper(_n,  2) \
+	_ilog2_helper(_n,  1) \
+	_ilog2_helper(_n,  0) \
+	-1)
+
+#define ilog2(_n) \
+( \
+	__builtin_constant_p(_n) ?  _ilog2_const(_n) : \
+	((sizeof(_n) > 4 ? fls64(_n) : fls32(_n)) - 1) \
+)
+
+static __inline void
+fast_divide32_prepare(uint32_t _div, uint32_t * __restrict _m,
+    uint8_t *__restrict _s1, uint8_t *__restrict _s2)
+{
+	uint64_t _mt;
+	int _l;
+
+	_l = fls32(_div - 1);
+	_mt = (uint64_t)(0x100000000ULL * ((1ULL << _l) - _div));
+	*_m = (uint32_t)(_mt / _div + 1);
+	*_s1 = (_l > 1) ? 1 : _l;
+	*_s2 = (_l == 0) ? 0 : _l - 1;
+}
+
+/* ARGSUSED */
+static __inline uint32_t
+fast_divide32(uint32_t _v, uint32_t _div __unused, uint32_t _m, uint8_t _s1,
+    uint8_t _s2)
+{
+	uint32_t _t;
+
+	_t = (uint32_t)(((uint64_t)_v * _m) >> 32);
+	return (_t + ((_v - _t) >> _s1)) >> _s2;
+}
+
+static __inline uint32_t
+fast_remainder32(uint32_t _v, uint32_t _div, uint32_t _m, uint8_t _s1,
+    uint8_t _s2)
+{
+
+	return _v - _div * fast_divide32(_v, _div, _m, _s1, _s2);
+}
+
+#define __BITMAP_TYPE(__s, __t, __n) struct __s { \
+    __t _b[__BITMAP_SIZE(__t, __n)]; \
+}
+
+#define __BITMAP_BITS(__t)		(sizeof(__t) * NBBY)
+#define __BITMAP_SHIFT(__t)		(ilog2(__BITMAP_BITS(__t)))
+#define __BITMAP_MASK(__t)		(__BITMAP_BITS(__t) - 1)
+#define __BITMAP_SIZE(__t, __n) \
+    (((__n) + (__BITMAP_BITS(__t) - 1)) / __BITMAP_BITS(__t))
+#define __BITMAP_BIT(__n, __v) \
+    (1 << ((__n) & __BITMAP_MASK(*(__v)->_b)))
+#define __BITMAP_WORD(__n, __v) \
+    ((__n) >> __BITMAP_SHIFT(*(__v)->_b))
+
+#define __BITMAP_SET(__n, __v) \
+    ((__v)->_b[__BITMAP_WORD(__n, __v)] |= __BITMAP_BIT(__n, __v))
+#define __BITMAP_CLR(__n, __v) \
+    ((__v)->_b[__BITMAP_WORD(__n, __v)] &= ~__BITMAP_BIT(__n, __v))
+#define __BITMAP_ISSET(__n, __v) \
+    ((__v)->_b[__BITMAP_WORD(__n, __v)] & __BITMAP_BIT(__n, __v))
+
+#if __GNUC_PREREQ__(2, 95)
+#define	__BITMAP_ZERO(__v) \
+    (void)__builtin_memset((__v), 0, sizeof(*__v))
+#else
+#define __BITMAP_ZERO(__v) do {						\
+	size_t __i;							\
+	for (__i = 0; __i < __arraycount(__v->_b); __i++)		\
+		(__v)->_b[__i] = 0;					\
+	} while (/* CONSTCOND */ 0)
+#endif /* GCC 2.95 */
+
+#endif /* _SYS_BITOPS_H_ */

Property changes on: lab4/.minix-src/include/sys/bitops.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/disklabel.h
===================================================================
--- lab4/.minix-src/include/sys/disklabel.h	(nonexistent)
+++ lab4/.minix-src/include/sys/disklabel.h	(revision 13)
@@ -0,0 +1,479 @@
+/*	$NetBSD: disklabel.h,v 1.118 2015/01/02 19:42:07 christos Exp $	*/
+
+/*
+ * Copyright (c) 1987, 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)disklabel.h	8.2 (Berkeley) 7/10/94
+ */
+
+#ifndef _SYS_DISKLABEL_H_
+#define	_SYS_DISKLABEL_H_
+
+/*
+ * We need <machine/types.h> for __HAVE_OLD_DISKLABEL
+ */
+#ifndef _LOCORE
+#include <sys/types.h>
+#endif
+
+/*
+ * Each disk has a label which includes information about the hardware
+ * disk geometry, filesystem partitions, and drive specific information.
+ * The location of the label, as well as the number of partitions the
+ * label can describe and the number of the "whole disk" (raw)
+ * partition are machine dependent.
+ */
+#if HAVE_NBTOOL_CONFIG_H
+#undef MAXPARTITIONS
+#define MAXPARTITIONS		MAXMAXPARTITIONS
+#else
+#include <machine/disklabel.h>
+#endif /* HAVE_NBTOOL_CONFIG_H */
+
+/*
+ * The absolute maximum number of disk partitions allowed.
+ * This is the maximum value of MAXPARTITIONS for which 'struct disklabel'
+ * is <= DEV_BSIZE bytes long.  If MAXPARTITIONS is greater than this, beware.
+ */
+#define	MAXMAXPARTITIONS	22
+#if MAXPARTITIONS > MAXMAXPARTITIONS
+#warning beware: MAXPARTITIONS bigger than MAXMAXPARTITIONS
+#endif
+
+/*
+ * Ports can switch their MAXPARTITIONS once, as follows:
+ *
+ * - define OLDMAXPARTITIONS in <machine/disklabel.h> as the old number
+ * - define MAXPARTITIONS as the new number
+ * - define DISKUNIT, DISKPART and DISKMINOR macros in <machine/disklabel.h>
+ *   as appropriate for the port (see the i386 one for an example).
+ * - define __HAVE_OLD_DISKLABEL in <machine/types.h>
+ */
+
+#if defined(_KERNEL) && defined(__HAVE_OLD_DISKLABEL) && \
+	   (MAXPARTITIONS < OLDMAXPARTITIONS)
+#error "can only grow disklabel size"
+#endif
+
+
+/*
+ * Translate between device numbers and major/disk unit/disk partition.
+ */
+#ifndef __HAVE_OLD_DISKLABEL
+#if !HAVE_NBTOOL_CONFIG_H
+#define	DISKUNIT(dev)	(minor(dev) / MAXPARTITIONS)
+#define	DISKPART(dev)	(minor(dev) % MAXPARTITIONS)
+#define	DISKMINOR(unit, part) \
+    (((unit) * MAXPARTITIONS) + (part))
+#endif /* !HAVE_NBTOOL_CONFIG_H */
+#endif
+#define	MAKEDISKDEV(maj, unit, part) \
+    (makedev((maj), DISKMINOR((unit), (part))))
+
+#define	DISKMAGIC	((uint32_t)0x82564557)	/* The disk magic number */
+
+#ifndef _LOCORE
+struct	partition {		/* the partition table */
+	uint32_t p_size;	/* number of sectors in partition */
+	uint32_t p_offset;	/* starting sector */
+	union {
+		uint32_t fsize; /* FFS, ADOS: filesystem basic fragment size */
+		uint32_t cdsession; /* ISO9660: session offset */
+	} __partition_u2;
+#define	p_fsize		__partition_u2.fsize
+#define	p_cdsession	__partition_u2.cdsession
+	uint8_t p_fstype;	/* filesystem type, see below */
+	uint8_t p_frag;	/* filesystem fragments per block */
+	union {
+		uint16_t cpg;	/* UFS: FS cylinders per group */
+		uint16_t sgs;	/* LFS: FS segment shift */
+	} __partition_u1;
+#define	p_cpg	__partition_u1.cpg
+#define	p_sgs	__partition_u1.sgs
+};
+struct disklabel {
+	uint32_t d_magic;		/* the magic number */
+	uint16_t d_type;		/* drive type */
+	uint16_t d_subtype;		/* controller/d_type specific */
+	char	  d_typename[16];	/* type name, e.g. "eagle" */
+
+	/*
+	 * d_packname contains the pack identifier and is returned when
+	 * the disklabel is read off the disk or in-core copy.
+	 * d_boot0 and d_boot1 are the (optional) names of the
+	 * primary (block 0) and secondary (block 1-15) bootstraps
+	 * as found in /usr/mdec.  These are returned when using
+	 * getdiskbyname(3) to retrieve the values from /etc/disktab.
+	 */
+	union {
+		char	un_d_packname[16];	/* pack identifier */
+		struct {
+			char *un_d_boot0;	/* primary bootstrap name */
+			char *un_d_boot1;	/* secondary bootstrap name */
+		} un_b;
+		uint64_t un_d_pad;		/* force 8 byte alignment */
+	} d_un;
+#define	d_packname	d_un.un_d_packname
+#define	d_boot0		d_un.un_b.un_d_boot0
+#define	d_boot1		d_un.un_b.un_d_boot1
+
+			/* disk geometry: */
+	uint32_t d_secsize;		/* # of bytes per sector */
+	uint32_t d_nsectors;		/* # of data sectors per track */
+	uint32_t d_ntracks;		/* # of tracks per cylinder */
+	uint32_t d_ncylinders;		/* # of data cylinders per unit */
+	uint32_t d_secpercyl;		/* # of data sectors per cylinder */
+	uint32_t d_secperunit;		/* # of data sectors per unit */
+
+	/*
+	 * Spares (bad sector replacements) below are not counted in
+	 * d_nsectors or d_secpercyl.  Spare sectors are assumed to
+	 * be physical sectors which occupy space at the end of each
+	 * track and/or cylinder.
+	 */
+	uint16_t d_sparespertrack;	/* # of spare sectors per track */
+	uint16_t d_sparespercyl;	/* # of spare sectors per cylinder */
+	/*
+	 * Alternative cylinders include maintenance, replacement,
+	 * configuration description areas, etc.
+	 */
+	uint32_t d_acylinders;		/* # of alt. cylinders per unit */
+
+			/* hardware characteristics: */
+	/*
+	 * d_interleave, d_trackskew and d_cylskew describe perturbations
+	 * in the media format used to compensate for a slow controller.
+	 * Interleave is physical sector interleave, set up by the
+	 * formatter or controller when formatting.  When interleaving is
+	 * in use, logically adjacent sectors are not physically
+	 * contiguous, but instead are separated by some number of
+	 * sectors.  It is specified as the ratio of physical sectors
+	 * traversed per logical sector.  Thus an interleave of 1:1
+	 * implies contiguous layout, while 2:1 implies that logical
+	 * sector 0 is separated by one sector from logical sector 1.
+	 * d_trackskew is the offset of sector 0 on track N relative to
+	 * sector 0 on track N-1 on the same cylinder.  Finally, d_cylskew
+	 * is the offset of sector 0 on cylinder N relative to sector 0
+	 * on cylinder N-1.
+	 */
+	uint16_t d_rpm;		/* rotational speed */
+	uint16_t d_interleave;		/* hardware sector interleave */
+	uint16_t d_trackskew;		/* sector 0 skew, per track */
+	uint16_t d_cylskew;		/* sector 0 skew, per cylinder */
+	uint32_t d_headswitch;		/* head switch time, usec */
+	uint32_t d_trkseek;		/* track-to-track seek, usec */
+	uint32_t d_flags;		/* generic flags */
+#define	NDDATA 5
+	uint32_t d_drivedata[NDDATA];	/* drive-type specific information */
+#define	NSPARE 5
+	uint32_t d_spare[NSPARE];	/* reserved for future use */
+	uint32_t d_magic2;		/* the magic number (again) */
+	uint16_t d_checksum;		/* xor of data incl. partitions */
+
+			/* filesystem and partition information: */
+	uint16_t d_npartitions;	/* number of partitions in following */
+	uint32_t d_bbsize;		/* size of boot area at sn0, bytes */
+	uint32_t d_sbsize;		/* max size of fs superblock, bytes */
+	struct	partition  d_partitions[MAXPARTITIONS];
+			/* the partition table, actually may be more */
+};
+
+#if defined(__HAVE_OLD_DISKLABEL) && !HAVE_NBTOOL_CONFIG_H
+/*
+ * Same as above, but with OLDMAXPARTITIONS partitions. For use in
+ * the old DIOC* ioctl calls.
+ */
+struct olddisklabel {
+	uint32_t d_magic;
+	uint16_t d_type;
+	uint16_t d_subtype;
+	char	  d_typename[16];
+	union {
+		char	un_d_packname[16];
+		struct {
+			char *un_d_boot0;
+			char *un_d_boot1;
+		} un_b;
+	} d_un;
+	uint32_t d_secsize;
+	uint32_t d_nsectors;
+	uint32_t d_ntracks;
+	uint32_t d_ncylinders;
+	uint32_t d_secpercyl;
+	uint32_t d_secperunit;
+	uint16_t d_sparespertrack;
+	uint16_t d_sparespercyl;
+	uint32_t d_acylinders;
+	uint16_t d_rpm;
+	uint16_t d_interleave;
+	uint16_t d_trackskew;
+	uint16_t d_cylskew;
+	uint32_t d_headswitch;
+	uint32_t d_trkseek;
+	uint32_t d_flags;
+	uint32_t d_drivedata[NDDATA];
+	uint32_t d_spare[NSPARE];
+	uint32_t d_magic2;
+	uint16_t d_checksum;
+	uint16_t d_npartitions;
+	uint32_t d_bbsize;
+	uint32_t d_sbsize;
+	struct	opartition {
+		uint32_t p_size;
+		uint32_t p_offset;
+		union {
+			uint32_t fsize;
+			uint32_t cdsession;
+		} __partition_u2;
+		uint8_t p_fstype;
+		uint8_t p_frag;
+		union {
+			uint16_t cpg;
+			uint16_t sgs;
+		} __partition_u1;
+	} d_partitions[OLDMAXPARTITIONS];
+};
+#endif /* __HAVE_OLD_DISKLABEL */
+#else /* _LOCORE */
+	/*
+	 * offsets for asm boot files.
+	 */
+	.set	d_secsize,40
+	.set	d_nsectors,44
+	.set	d_ntracks,48
+	.set	d_ncylinders,52
+	.set	d_secpercyl,56
+	.set	d_secperunit,60
+	.set	d_end_,148+(MAXPARTITIONS*16)
+#endif /* _LOCORE */
+
+/*
+ * We normally use C99 initialisers (just in case the lists below are out
+ * of sequence, or have gaps), but lint doesn't grok them.
+ * Maybe some host compilers don't either, but many have for quite some time.
+ */
+
+#ifndef lint
+#define ARRAY_INIT(element,value) [element]=value
+#else
+#define ARRAY_INIT(element,value) value
+#endif
+
+/* Use pre-processor magic to get all the parameters one one line... */
+
+/* d_type values: */
+#define DKTYPE_DEFN(x) \
+x(UNKNOWN,	0,	"unknown") \
+x(SMD,		1,	"SMD")		/* SMD, XSMD; VAX hp/up */ \
+x(MSCP,		2,	"MSCP")		/* MSCP */ \
+x(DEC,		3,	"old DEC")	/* other DEC (rk, rl) */ \
+x(SCSI,		4,	"SCSI")		/* SCSI */ \
+x(ESDI,		5,	"ESDI")		/* ESDI interface */ \
+x(ST506,	6,	"ST506")	/* ST506 etc. */ \
+x(HPIB,		7,	"HP-IB")	/* CS/80 on HP-IB */ \
+x(HPFL,		8,	"HP-FL")	/* HP Fiber-link */ \
+x(TYPE_9,	9,	"type 9") \
+x(FLOPPY,	10,	"floppy")	/* floppy */ \
+x(CCD,		11,	"ccd")		/* concatenated disk device */ \
+x(VND,		12,	"vnd")		/* uvnode pseudo-disk */ \
+x(ATAPI,	13,	"ATAPI")	/* ATAPI */ \
+x(RAID,		14,	"RAID")		/* RAIDframe */ \
+x(LD,		15,	"ld")		/* logical disk */ \
+x(JFS2,		16,	"jfs")		/* IBM JFS2 */ \
+x(CGD,		17,	"cgd")		/* cryptographic pseudo-disk */ \
+x(VINUM,	18,	"vinum")	/* vinum volume */ \
+x(FLASH,	19,	"flash")	/* flash memory devices */ \
+x(DM,		20,	"dm")		/* device-mapper pseudo-disk devices */\
+x(RUMPD,	21,	"rumpd")	/* rump virtual disk */ \
+x(MD,		22,	"md")		/* memory disk */ \
+    
+#ifndef _LOCORE
+#define DKTYPE_NUMS(tag, number, name) __CONCAT(DKTYPE_,tag=number),
+#ifndef DKTYPE_ENUMNAME
+#define DKTYPE_ENUMNAME
+#endif
+enum DKTYPE_ENUMNAME { DKTYPE_DEFN(DKTYPE_NUMS) DKMAXTYPES };
+#undef	DKTYPE_NUMS
+#endif
+
+#ifdef DKTYPENAMES
+#define	DKTYPE_NAMES(tag, number, name) ARRAY_INIT(number,name),
+static const char *const dktypenames[] = { DKTYPE_DEFN(DKTYPE_NAMES) NULL };
+#undef	DKTYPE_NAMES
+#endif
+
+/*
+ * Partition type names, numbers, label-names, fsck prog, and mount prog
+ */
+#define	FSTYPE_DEFN(x) \
+x(UNUSED,   0, "unused",     NULL,    NULL)   /* unused */ \
+x(SWAP,     1, "swap",       NULL,    NULL)   /* swap */ \
+x(V6,       2, "Version 6",  NULL,    NULL)   /* Sixth Edition */ \
+x(V7,       3, "Version 7", "v7fs",  "v7fs")  /* Seventh Edition */ \
+x(SYSV,     4, "System V",   NULL,    NULL)   /* System V */ \
+x(V71K,     5, "4.1BSD",     NULL,    NULL)   /* V7, 1K blocks (4.1, 2.9) */ \
+x(V8,    6, "Eighth Edition",NULL,    NULL)   /* Eighth Edition, 4K blocks */ \
+x(BSDFFS,   7, "4.2BSD",    "ffs",   "ffs")   /* 4.2BSD fast file system */ \
+x(MSDOS,    8, "MSDOS",     "msdos", "msdos") /* MSDOS file system */ \
+x(BSDLFS,   9, "4.4LFS",    "lfs",   "lfs")   /* 4.4BSD log-structured FS */ \
+x(OTHER,   10, "unknown",    NULL,    NULL)   /* in use, unknown/unsupported */\
+x(HPFS,    11, "HPFS",       NULL,    NULL)   /* OS/2 high-performance FS */ \
+x(ISO9660, 12, "ISO9660",    NULL,   "cd9660")/* ISO 9660, normally CD-ROM */ \
+x(BOOT,    13, "boot",       NULL,    NULL)   /* bootstrap code in partition */\
+x(ADOS,    14, "ADOS",       NULL,   "ados")  /* AmigaDOS fast file system */ \
+x(HFS,     15, "HFS",        NULL,    NULL)   /* Macintosh HFS */ \
+x(FILECORE,16, "FILECORE",   NULL, "filecore")/* Acorn Filecore FS */ \
+x(EX2FS,   17, "Linux Ext2","ext2fs","ext2fs")/* Linux Extended 2 FS */ \
+x(NTFS,    18, "NTFS",       NULL,   "ntfs")  /* Windows/NT file system */ \
+x(RAID,    19, "RAID",       NULL,    NULL)   /* RAIDframe component */ \
+x(CCD,     20, "ccd",        NULL,    NULL)   /* concatenated disk component */\
+x(JFS2,    21, "jfs",        NULL,    NULL)   /* IBM JFS2 */ \
+x(APPLEUFS,22, "Apple UFS", "ffs",   "ffs")   /* Apple UFS */ \
+/* XXX this is not the same as FreeBSD.  How to solve? */ \
+x(VINUM,   23, "vinum",      NULL,    NULL)   /* Vinum */ \
+x(UDF,     24, "UDF",        NULL,   "udf")   /* UDF */ \
+x(SYSVBFS, 25, "SysVBFS",    NULL,  "sysvbfs")/* System V boot file system */ \
+x(EFS,     26, "EFS",        NULL,   "efs")   /* SGI's Extent Filesystem */ \
+x(NILFS,   27, "NiLFS",      NULL,   "nilfs") /* NTT's NiLFS(2) */ \
+x(CGD,     28, "cgd",	     NULL,   NULL)    /* Cryptographic disk */ \
+x(MINIXFS3,29, "MINIX FSv3", NULL,   NULL)    /* MINIX file system v3 */
+
+
+#ifndef _LOCORE
+#define	FS_TYPENUMS(tag, number, name, fsck, mount) __CONCAT(FS_,tag=number),
+#ifndef FSTYPE_ENUMNAME
+#define FSTYPE_ENUMNAME
+#endif
+enum FSTYPE_ENUMNAME { FSTYPE_DEFN(FS_TYPENUMS) FSMAXTYPES };
+#undef	FS_TYPENUMS
+#endif
+
+#ifdef	FSTYPENAMES
+#define	FS_TYPENAMES(tag, number, name, fsck, mount) ARRAY_INIT(number,name),
+static const char *const fstypenames[] = { FSTYPE_DEFN(FS_TYPENAMES) NULL };
+#undef	FS_TYPENAMES
+#endif
+
+#ifdef FSCKNAMES
+/* These are the names MOUNT_XXX from <sys/mount.h> */
+#define	FS_FSCKNAMES(tag, number, name, fsck, mount) ARRAY_INIT(number,fsck),
+static const char *const fscknames[] = { FSTYPE_DEFN(FS_FSCKNAMES) NULL };
+#undef	FS_FSCKNAMES
+#define	FSMAXNAMES	FSMAXTYPES
+#endif
+
+#ifdef MOUNTNAMES
+/* These are the names MOUNT_XXX from <sys/mount.h> */
+#define	FS_MOUNTNAMES(tag, number, name, fsck, mount) ARRAY_INIT(number,mount),
+static const char *const mountnames[] = { FSTYPE_DEFN(FS_MOUNTNAMES) NULL };
+#undef	FS_MOUNTNAMES
+#define	FSMAXMOUNTNAMES	FSMAXTYPES
+#endif
+
+/*
+ * flags shared by various drives:
+ */
+#define		D_REMOVABLE	0x01		/* removable media */
+#define		D_ECC		0x02		/* supports ECC */
+#define		D_BADSECT	0x04		/* supports bad sector forw. */
+#define		D_RAMDISK	0x08		/* disk emulator */
+#define		D_CHAIN		0x10		/* can do back-back transfers */
+#define		D_SCSI_MMC	0x20		/* SCSI MMC sessioned media */
+
+/*
+ * Drive data for SMD.
+ */
+#define	d_smdflags	d_drivedata[0]
+#define		D_SSE		0x1		/* supports skip sectoring */
+#define	d_mindist	d_drivedata[1]
+#define	d_maxdist	d_drivedata[2]
+#define	d_sdist		d_drivedata[3]
+
+/*
+ * Drive data for ST506.
+ */
+#define	d_precompcyl	d_drivedata[0]
+#define	d_gap3		d_drivedata[1]		/* used only when formatting */
+
+/*
+ * Drive data for SCSI.
+ */
+#define	d_blind		d_drivedata[0]
+
+#ifndef _LOCORE
+/*
+ * Structure used to perform a format or other raw operation,
+ * returning data and/or register values.  Register identification
+ * and format are device- and driver-dependent. Currently unused.
+ */
+struct format_op {
+	char	*df_buf;
+	int	 df_count;		/* value-result */
+	daddr_t	 df_startblk;
+	int	 df_reg[8];		/* result */
+};
+
+#ifdef _KERNEL
+/*
+ * Structure used internally to retrieve information about a partition
+ * on a disk.
+ */
+struct partinfo {
+	struct disklabel *disklab;
+	struct partition *part;
+};
+
+struct disk;
+
+int disk_read_sectors(void (*)(struct buf *), const struct disklabel *,
+    struct buf *, unsigned int, int);
+void	 diskerr(const struct buf *, const char *, const char *, int,
+	    int, const struct disklabel *);
+u_int	 dkcksum(struct disklabel *);
+u_int	 dkcksum_sized(struct disklabel *, size_t);
+int	 setdisklabel(struct disklabel *, struct disklabel *, u_long,
+	    struct cpu_disklabel *);
+const char *readdisklabel(dev_t, void (*)(struct buf *),
+	    struct disklabel *, struct cpu_disklabel *);
+int	 writedisklabel(dev_t, void (*)(struct buf *), struct disklabel *,
+	    struct cpu_disklabel *);
+const char *convertdisklabel(struct disklabel *, void (*)(struct buf *),
+    struct buf *, uint32_t);
+int	 bounds_check_with_label(struct disk *, struct buf *, int);
+int	 bounds_check_with_mediasize(struct buf *, int, uint64_t);
+const char *getfstypename(int);
+#endif
+#endif /* _LOCORE */
+
+#if !defined(_KERNEL) && !defined(_LOCORE)
+
+#include <sys/cdefs.h>
+
+#endif
+
+#endif /* !_SYS_DISKLABEL_H_ */

Property changes on: lab4/.minix-src/include/sys/disklabel.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/common_wchar_limits.h
===================================================================
--- lab4/.minix-src/include/sys/common_wchar_limits.h	(nonexistent)
+++ lab4/.minix-src/include/sys/common_wchar_limits.h	(revision 13)
@@ -0,0 +1,57 @@
+/*	$NetBSD: common_wchar_limits.h,v 1.1 2014/08/18 22:21:39 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_COMMON_WCHAR_LIMITS_H_
+#define _SYS_COMMON_WCHAR_LIMITS_H_
+
+/*
+ * 7.18.3 Limits of other integer types
+ */
+
+/* limits of wchar_t */
+
+#if !defined(__WCHAR_MIN__) || !defined(__WCHAR_MAX__)
+#error __WCHAR_MIN__ or __WCHAR_MAX__ not defined
+#endif
+
+#define	WCHAR_MIN	__WCHAR_MIN__			/* wchar_t	  */
+#define	WCHAR_MAX	__WCHAR_MAX__			/* wchar_t	  */
+
+/* limits of wint_t */
+
+#if !defined(__WINT_MIN__) || !defined(__WINT_MAX__)
+#error __WINT_MIN__ or __WINT_MAX__ not defined
+#endif
+
+#define	WINT_MIN	__WINT_MIN__			/* wint_t	  */
+#define	WINT_MAX	__WINT_MAX__			/* wint_t	  */
+
+#endif /* !_SYS_COMMON_WCHAR_LIMITS_H_ */

Property changes on: lab4/.minix-src/include/sys/common_wchar_limits.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ataio.h
===================================================================
--- lab4/.minix-src/include/sys/ataio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ataio.h	(revision 13)
@@ -0,0 +1,56 @@
+/*	$NetBSD: ataio.h,v 1.9 2012/01/24 20:04:07 jakllsch Exp $	*/
+
+#ifndef _SYS_ATAIO_H_
+#define _SYS_ATAIO_H_
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+typedef struct	atareq {
+	u_long	flags;		/* info about the request status and type */
+	u_char	command;	/* command code */
+	u_char	features;	/* feature modifier bits for command */
+	u_char	sec_count;	/* sector count */
+	u_char	sec_num;	/* sector number */
+	u_char	head;		/* head number */
+	u_short	cylinder;	/* cylinder/lba address */
+
+	void *	databuf;	/* Pointer to I/O data buffer */
+	u_long	datalen;	/* length of data buffer */
+	int	timeout;	/* Command timeout */
+	u_char	retsts;		/* the return status for the command */
+	u_char	error;		/* error bits */
+} atareq_t;
+
+/* bit definitions for flags */
+#define ATACMD_READ		0x00000001
+#define ATACMD_WRITE		0x00000002
+#define ATACMD_READREG		0x00000004
+#define ATACMD_LBA		0x00000008
+
+/* definitions for the return status (retsts) */
+#define ATACMD_OK	0x00
+#define ATACMD_TIMEOUT	0x01
+#define ATACMD_ERROR	0x02
+#define ATACMD_DF	0x03
+
+#define ATAIOCCOMMAND	_IOWR('Q', 8, atareq_t)
+
+/*
+ * ATA bus IOCTL
+ */
+/* Scan bus for new devices. */
+struct atabusioscan_args {
+	int	at_dev;		/* device to scan, -1 for wildcard */
+};
+#define ATABUSIOSCAN	_IOW('A', 50, struct atabusioscan_args)
+
+#define ATABUSIORESET	_IO('A', 51) /* reset ATA bus */
+
+struct atabusiodetach_args {
+	int	at_dev;		/* device to detach; -1 for wildcard */
+};
+#define ATABUSIODETACH	_IOW('A', 52, struct atabusiodetach_args)
+
+
+#endif /* _SYS_ATAIO_H_ */

Property changes on: lab4/.minix-src/include/sys/ataio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/callback.h
===================================================================
--- lab4/.minix-src/include/sys/callback.h	(nonexistent)
+++ lab4/.minix-src/include/sys/callback.h	(revision 13)
@@ -0,0 +1,63 @@
+/*	$NetBSD: callback.h,v 1.3 2007/07/09 21:11:32 ad Exp $	*/
+
+/*-
+ * Copyright (c)2006 YAMAMOTO Takashi,
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_CALLBACK_H_
+#define	_SYS_CALLBACK_H_
+
+#include <sys/queue.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+
+struct callback_entry {
+	TAILQ_ENTRY(callback_entry) ce_q;
+	int (*ce_func)(struct callback_entry *, void *, void *);
+	void *ce_obj;
+};
+
+struct callback_head {
+	kmutex_t ch_lock;
+	kcondvar_t ch_cv;
+	TAILQ_HEAD(, callback_entry) ch_q;
+	struct callback_entry *ch_next;
+	int ch_nentries;
+	int ch_running;
+	int ch_flags;
+};
+
+/* return values of ce_func */
+#define	CALLBACK_CHAIN_CONTINUE	0
+#define	CALLBACK_CHAIN_ABORT	1
+
+int callback_run_roundrobin(struct callback_head *, void *);
+void callback_register(struct callback_head *, struct callback_entry *,
+    void *, int (*)(struct callback_entry *, void *, void *));
+void callback_unregister(struct callback_head *, struct callback_entry *);
+void callback_head_init(struct callback_head *, int);
+void callback_head_destroy(struct callback_head *);
+
+#endif /* !_SYS_CALLBACK_H_ */

Property changes on: lab4/.minix-src/include/sys/callback.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/cpufreq.h
===================================================================
--- lab4/.minix-src/include/sys/cpufreq.h	(nonexistent)
+++ lab4/.minix-src/include/sys/cpufreq.h	(revision 13)
@@ -0,0 +1,93 @@
+/*	$NetBSD: cpufreq.h,v 1.5 2011/10/27 05:13:04 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jukka Ruohonen.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef	_SYS_CPUFREQ_H_
+#define	_SYS_CPUFREQ_H_
+
+#ifndef _KERNEL
+#include <stdbool.h>
+#endif
+
+#ifdef _KERNEL
+#ifndef _SYS_XCALL_H_
+#include <sys/xcall.h>
+#endif
+#endif
+
+#define CPUFREQ_NAME_MAX	 16
+#define CPUFREQ_STATE_MAX	 32
+#define CPUFREQ_LATENCY_MAX	 UINT32_MAX
+
+#define CPUFREQ_STATE_ENABLED	 UINT32_MAX
+#define CPUFREQ_STATE_DISABLED	 UINT32_MAX - 1
+
+struct cpufreq_state {
+	uint32_t		 cfs_freq;	  /* MHz  */
+	uint32_t		 cfs_power;	  /* mW   */
+	uint32_t		 cfs_latency;	  /* usec */
+	uint32_t		 cfs_index;
+	uint32_t		 cfs_reserved[5];
+};
+
+struct cpufreq {
+	char			 cf_name[CPUFREQ_NAME_MAX];
+	uint32_t		 cf_state_count;
+	uint32_t		 cf_state_target;
+	uint32_t		 cf_state_current;
+	uint32_t		 cf_reserved[5];
+	u_int			 cf_index;
+
+#ifdef _KERNEL
+	bool			 cf_mp;
+	bool			 cf_init;
+	void			*cf_cookie;
+	xcfunc_t		 cf_get_freq;
+	xcfunc_t		 cf_set_freq;
+	uint32_t		 cf_state_saved;
+	struct cpufreq_state	 cf_state[CPUFREQ_STATE_MAX];
+#endif	/* _KERNEL */
+};
+
+#ifdef _KERNEL
+void		cpufreq_init(void);
+int		cpufreq_register(struct cpufreq *);
+void		cpufreq_deregister(void);
+void		cpufreq_suspend(struct cpu_info *);
+void		cpufreq_resume(struct cpu_info *);
+uint32_t	cpufreq_get(struct cpu_info *);
+int		cpufreq_get_backend(struct cpufreq *);
+int		cpufreq_get_state(uint32_t, struct cpufreq_state *);
+int		cpufreq_get_state_index(uint32_t, struct cpufreq_state *);
+void		cpufreq_set(struct cpu_info *, uint32_t);
+void		cpufreq_set_all(uint32_t);
+#endif	/* _KERNEL */
+
+#endif /* _SYS_CPUFREQ_H_ */

Property changes on: lab4/.minix-src/include/sys/cpufreq.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/bootblock.h
===================================================================
--- lab4/.minix-src/include/sys/bootblock.h	(nonexistent)
+++ lab4/.minix-src/include/sys/bootblock.h	(revision 13)
@@ -0,0 +1,1463 @@
+/*	$NetBSD: bootblock.h,v 1.57 2014/09/14 17:39:06 nonaka Exp $	*/
+
+/*-
+ * Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*-
+ * Copyright (C) 1993	Allen K. Briggs, Chris P. Caputo,
+ *			Michael L. Finch, Bradley A. Grantham, and
+ *			Lawrence A. Kesteloot
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the Alice Group.
+ * 4. The names of the Alice Group or any of its members may not be used
+ *    to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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.
+ *
+ */
+/*
+ * Copyright (c) 1994, 1999 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou
+ *      for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+/*
+ * Copyright (c) 1994 Rolf Grossmann
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Rolf Grossmann.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+#ifndef _SYS_BOOTBLOCK_H
+#define	_SYS_BOOTBLOCK_H
+
+#if !defined(__ASSEMBLER__)
+#include <sys/cdefs.h>
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/stdint.h>
+#else
+#include <stdint.h>
+#endif
+#endif	/* !defined(__ASSEMBLER__) */
+
+/* ------------------------------------------
+ * MBR (Master Boot Record) --
+ *	definitions for systems that use MBRs
+ */
+
+/*
+ * Layout of boot records:
+ *
+ *	Byte range	Use	Description
+ *	----------	---	-----------
+ *
+ *	0 - 2		FMP	JMP xxx, NOP
+ *	3 - 10		FP	OEM Name
+ *
+ *	11 - 61		FMP	FAT12/16 BPB
+ *				Whilst not strictly necessary for MBR,
+ *				GRUB reserves this area
+ *
+ *	11 - 89		P	FAT32 BPB
+ *				(are we ever going to boot off this?)
+ *
+ *
+ *	62 - 217	FMP	Boot code
+ *
+ *	90 - 217	P	FAT32 boot code
+ *
+ *	218 - 223	M	Win95b/98/me "drive time"
+ *		http://www.geocities.com/thestarman3/asm/mbr/95BMEMBR.htm#MYST
+ *				only changed if all 6 bytes are 0
+ *
+ *	224 - 436	FMP	boot code (continued)
+ *
+ *	437 - 439	M	WinNT/2K/XP MBR "boot language"
+ *		http://www.geocities.com/thestarman3/asm/mbr/Win2kmbr.htm
+ *				not needed by us
+ *
+ *	400 - 439	MP	NetBSD: mbr_bootsel
+ *
+ *	424 - 439	M	NetBSD: bootptn_guid (in GPT PMBR only)
+ *
+ *	440 - 443	M	WinNT/2K/XP Drive Serial Number (NT DSN)
+ *		http://www.geocities.com/thestarman3/asm/mbr/Win2kmbr.htm
+ *
+ *	444 - 445	FMP	bootcode or unused
+ *				NetBSD: mbr_bootsel_magic
+ *
+ *	446 - 509	M	partition table
+ *
+ *	510 - 511	FMP	magic number (0xAA55)
+ *
+ *	Use:
+ *	----
+ *	F	Floppy boot sector
+ *	M	Master Boot Record
+ *	P	Partition Boot record
+ *
+ */
+
+/*
+ * MBR (Master Boot Record)
+ */
+#define	MBR_BBSECTOR		0	/* MBR relative sector # */
+#define	MBR_BPB_OFFSET		11	/* offsetof(mbr_sector, mbr_bpb) */
+#define	MBR_BOOTCODE_OFFSET	90	/* offsetof(mbr_sector, mbr_bootcode) */
+#define	MBR_BS_OFFSET		400	/* offsetof(mbr_sector, mbr_bootsel) */
+#define	MBR_BS_OLD_OFFSET	404	/* where mbr_bootsel used to be */
+#define	MBR_GPT_GUID_OFFSET	424	/* location of partition GUID to boot */
+#define	MBR_GPT_GUID_DEFAULT		/* default uninitialized GUID */ \
+	{0xeee69d04,0x02f4,0x11e0,0x8f,0x5d,{0x00,0xe0,0x81,0x52,0x9a,0x6b}}
+#define	MBR_DSN_OFFSET		440	/* offsetof(mbr_sector, mbr_dsn) */
+#define	MBR_BS_MAGIC_OFFSET	444	/* offsetof(mbr_sector, mbr_bootsel_magic) */
+#define	MBR_PART_OFFSET		446	/* offsetof(mbr_sector, mbr_part[0]) */
+#define	MBR_MAGIC_OFFSET	510	/* offsetof(mbr_sector, mbr_magic) */
+#define	MBR_MAGIC		0xaa55	/* MBR magic number */
+#define	MBR_BS_MAGIC		0xb5e1	/* mbr_bootsel magic number */
+#define	MBR_PART_COUNT		4	/* Number of partitions in MBR */
+#define	MBR_BS_PARTNAMESIZE	8	/* Size of name mbr_bootsel nametab */
+					/* (excluding trailing NUL) */
+
+		/* values for mbr_partition.mbrp_flag */
+#define	MBR_PFLAG_ACTIVE	0x80	/* The active partition */
+
+		/* values for mbr_partition.mbrp_type */
+#define	MBR_PTYPE_UNUSED	0x00	/* Unused */
+#define	MBR_PTYPE_FAT12		0x01	/* 12-bit FAT */
+#define	MBR_PTYPE_XENIX_ROOT	0x02	/* XENIX / */
+#define	MBR_PTYPE_XENIX_USR	0x03	/* XENIX /usr */
+#define	MBR_PTYPE_FAT16S	0x04	/* 16-bit FAT, less than 32M */
+#define	MBR_PTYPE_EXT		0x05	/* extended partition */
+#define	MBR_PTYPE_FAT16B	0x06	/* 16-bit FAT, more than 32M */
+#define	MBR_PTYPE_NTFS		0x07	/* OS/2 HPFS, NTFS, QNX2, Adv. UNIX */
+#define	MBR_PTYPE_DELL		0x08	/* AIX or os, or etc. */
+#define MBR_PTYPE_AIX_BOOT	0x09	/* AIX boot partition or Coherent */
+#define MBR_PTYPE_OS2_BOOT	0x0a	/* O/2 boot manager or Coherent swap */
+#define	MBR_PTYPE_FAT32		0x0b	/* 32-bit FAT */
+#define	MBR_PTYPE_FAT32L	0x0c	/* 32-bit FAT, LBA-mapped */
+#define	MBR_PTYPE_7XXX		0x0d	/* 7XXX, LBA-mapped */
+#define	MBR_PTYPE_FAT16L	0x0e	/* 16-bit FAT, LBA-mapped */
+#define	MBR_PTYPE_EXT_LBA	0x0f	/* extended partition, LBA-mapped */
+#define	MBR_PTYPE_OPUS		0x10	/* OPUS */
+#define MBR_PTYPE_OS2_DOS12	0x11 	/* OS/2 DOS 12-bit FAT */
+#define MBR_PTYPE_COMPAQ_DIAG	0x12 	/* Compaq diagnostics */
+#define MBR_PTYPE_OS2_DOS16S	0x14 	/* OS/2 DOS 16-bit FAT <32M */
+#define MBR_PTYPE_OS2_DOS16B	0x16 	/* OS/2 DOS 16-bit FAT >=32M */
+#define MBR_PTYPE_OS2_IFS	0x17 	/* OS/2 hidden IFS */
+#define MBR_PTYPE_AST_SWAP	0x18 	/* AST Windows swapfile */
+#define MBR_PTYPE_WILLOWTECH	0x19 	/* Willowtech Photon coS */
+#define MBR_PTYPE_HID_FAT32	0x1b 	/* hidden win95 fat 32 */
+#define MBR_PTYPE_HID_FAT32_LBA	0x1c 	/* hidden win95 fat 32 lba */
+#define MBR_PTYPE_HID_FAT16_LBA	0x1d	/* hidden win95 fat 16 lba */
+#define MBR_PTYPE_WILLOWSOFT	0x20 	/* Willowsoft OFS1 */
+#define MBR_PTYPE_RESERVED_x21	0x21 	/* reserved */
+#define MBR_PTYPE_RESERVED_x23	0x23 	/* reserved */
+#define MBR_PTYPE_RESERVED_x24	0x24	/* NEC DOS */
+#define MBR_PTYPE_RESERVED_x26	0x26 	/* reserved */
+#define MBR_PTYPE_RESERVED_x31	0x31 	/* reserved */
+#define MBR_PTYPE_NOS		0x32	/* Alien Internet Services NOS */
+#define MBR_PTYPE_RESERVED_x33	0x33 	/* reserved */
+#define MBR_PTYPE_RESERVED_x34	0x34 	/* reserved */
+#define MBR_PTYPE_OS2_JFS	0x35 	/* JFS on OS2 */
+#define MBR_PTYPE_RESERVED_x36	0x36 	/* reserved */
+#define MBR_PTYPE_THEOS		0x38 	/* Theos */
+#define MBR_PTYPE_PLAN9		0x39 	/* Plan 9, or Theos spanned */
+#define MBR_PTYPE_THEOS_4GB	0x3a 	/* Theos ver 4 4gb partition */
+#define MBR_PTYPE_THEOS_EXT	0x3b 	/* Theos ve 4 extended partition */
+#define MBR_PTYPE_PMRECOVERY	0x3c 	/* PartitionMagic recovery */
+#define MBR_PTYPE_HID_NETWARE	0x3d 	/* Hidden Netware */
+#define MBR_PTYPE_VENIX		0x40 	/* VENIX 286 or LynxOS */
+#define	MBR_PTYPE_PREP		0x41	/* PReP */
+#define	MBR_PTYPE_DRDOS_LSWAP	0x42	/* linux swap sharing DRDOS disk */
+#define	MBR_PTYPE_DRDOS_LINUX	0x43	/* linux sharing DRDOS disk */
+#define	MBR_PTYPE_GOBACK	0x44	/* GoBack change utility */
+#define	MBR_PTYPE_BOOT_US	0x45	/* Boot US Boot manager */
+#define	MBR_PTYPE_EUMEL_x46	0x46	/* EUMEL/Elan or Ergos 3 */
+#define	MBR_PTYPE_EUMEL_x47	0x47	/* EUMEL/Elan or Ergos 3 */
+#define	MBR_PTYPE_EUMEL_x48	0x48	/* EUMEL/Elan or Ergos 3 */
+#define	MBR_PTYPE_ALFS_THIN	0x4a	/* ALFX/THIN filesystem for DOS */
+#define	MBR_PTYPE_OBERON	0x4c	/* Oberon partition */
+#define MBR_PTYPE_QNX4X		0x4d 	/* QNX4.x */
+#define MBR_PTYPE_QNX4X_2	0x4e 	/* QNX4.x 2nd part */
+#define MBR_PTYPE_QNX4X_3	0x4f 	/* QNX4.x 3rd part */
+#define MBR_PTYPE_DM		0x50 	/* DM (disk manager) */
+#define MBR_PTYPE_DM6_AUX1	0x51 	/* DM6 Aux1 (or Novell) */
+#define MBR_PTYPE_CPM		0x52 	/* CP/M or Microport SysV/AT */
+#define MBR_PTYPE_DM6_AUX3	0x53 	/* DM6 Aux3 */
+#define	MBR_PTYPE_DM6_DDO	0x54	/* DM6 DDO */
+#define MBR_PTYPE_EZDRIVE	0x55	/* EZ-Drive (disk manager) */
+#define MBR_PTYPE_GOLDEN_BOW	0x56	/* Golden Bow (disk manager) */
+#define MBR_PTYPE_DRIVE_PRO	0x57	/* Drive PRO */
+#define MBR_PTYPE_PRIAM_EDISK	0x5c	/* Priam Edisk (disk manager) */
+#define MBR_PTYPE_SPEEDSTOR	0x61	/* SpeedStor */
+#define MBR_PTYPE_HURD		0x63	/* GNU HURD or Mach or Sys V/386 */
+#define MBR_PTYPE_NOVELL_2XX	0x64	/* Novell Netware 2.xx or Speedstore */
+#define MBR_PTYPE_NOVELL_3XX	0x65	/* Novell Netware 3.xx */
+#define MBR_PTYPE_NOVELL_386	0x66	/* Novell 386 Netware */
+#define MBR_PTYPE_NOVELL_x67	0x67	/* Novell */
+#define MBR_PTYPE_NOVELL_x68	0x68	/* Novell */
+#define MBR_PTYPE_NOVELL_x69	0x69	/* Novell */
+#define MBR_PTYPE_DISKSECURE	0x70	/* DiskSecure Multi-Boot */
+#define MBR_PTYPE_RESERVED_x71	0x71	/* reserved */
+#define MBR_PTYPE_RESERVED_x73	0x73	/* reserved */
+#define MBR_PTYPE_RESERVED_x74	0x74	/* reserved */
+#define MBR_PTYPE_PCIX		0x75	/* PC/IX */
+#define MBR_PTYPE_RESERVED_x76	0x76	/* reserved */
+#define MBR_PTYPE_M2FS_M2CS	0x77	/* M2FS/M2CS partition */
+#define MBR_PTYPE_XOSL_FS	0x78	/* XOSL boot loader filesystem */
+#define MBR_PTYPE_MINIX_14A	0x80	/* MINIX until 1.4a */
+#define MBR_PTYPE_MINIX_14B	0x81	/* MINIX since 1.4b */
+#define	MBR_PTYPE_LNXSWAP	0x82	/* Linux swap or Solaris */
+#define	MBR_PTYPE_LNXEXT2	0x83	/* Linux native */
+#define MBR_PTYPE_OS2_C		0x84	/* OS/2 hidden C: drive */
+#define	MBR_PTYPE_EXT_LNX	0x85	/* Linux extended partition */
+#define	MBR_PTYPE_NTFATVOL 	0x86	/* NT FAT volume set */
+#define	MBR_PTYPE_NTFSVOL	0x87	/* NTFS volume set or HPFS mirrored */
+#define	MBR_PTYPE_LNX_KERNEL	0x8a	/* Linux Kernel AiR-BOOT partition */
+#define	MBR_PTYPE_FT_FAT32	0x8b	/* Legacy Fault tolerant FAT32 */
+#define	MBR_PTYPE_FT_FAT32_EXT	0x8c	/* Legacy Fault tolerant FAT32 ext */
+#define	MBR_PTYPE_HID_FR_FD_12	0x8d	/* Hidden free FDISK FAT12 */
+#define	MBR_PTYPE_LNX_LVM	0x8e	/* Linux Logical Volume Manager */
+#define	MBR_PTYPE_HID_FR_FD_16	0x90	/* Hidden free FDISK FAT16 */
+#define	MBR_PTYPE_HID_FR_FD_EXT	0x91	/* Hidden free FDISK DOS EXT */
+#define	MBR_PTYPE_HID_FR_FD_16B	0x92	/* Hidden free FDISK FAT16 Big */
+#define MBR_PTYPE_AMOEBA_FS 	0x93	/* Amoeba filesystem */
+#define MBR_PTYPE_AMOEBA_BAD 	0x94	/* Amoeba bad block table */
+#define MBR_PTYPE_MIT_EXOPC 	0x95	/* MIT EXOPC native partitions */
+#define	MBR_PTYPE_HID_FR_FD_32	0x97	/* Hidden free FDISK FAT32 */
+#define	MBR_PTYPE_DATALIGHT	0x98	/* Datalight ROM-DOS Super-Boot */
+#define MBR_PTYPE_MYLEX 	0x99	/* Mylex EISA SCSI */
+#define	MBR_PTYPE_HID_FR_FD_16L	0x9a	/* Hidden free FDISK FAT16 LBA */
+#define	MBR_PTYPE_HID_FR_FD_EXL	0x9b	/* Hidden free FDISK EXT LBA */
+#define MBR_PTYPE_BSDI	 	0x9f	/* BSDI? */
+#define MBR_PTYPE_IBM_HIB	0xa0	/* IBM Thinkpad hibernation */
+#define MBR_PTYPE_HP_VOL_xA1	0xa1	/* HP Volume expansion (SpeedStor) */
+#define MBR_PTYPE_HP_VOL_xA3	0xa3	/* HP Volume expansion (SpeedStor) */
+#define MBR_PTYPE_HP_VOL_xA4	0xa4	/* HP Volume expansion (SpeedStor) */
+#define	MBR_PTYPE_386BSD	0xa5	/* 386BSD partition type */
+#define	MBR_PTYPE_OPENBSD	0xa6	/* OpenBSD partition type */
+#define	MBR_PTYPE_NEXTSTEP_486 	0xa7	/* NeXTSTEP 486 */
+#define	MBR_PTYPE_APPLE_UFS 	0xa8	/* Apple UFS */
+#define	MBR_PTYPE_NETBSD	0xa9	/* NetBSD partition type */
+#define MBR_PTYPE_OLIVETTI	0xaa	/* Olivetty Fat12 1.44MB Service part */
+#define MBR_PTYPE_APPLE_BOOT	0xab	/* Apple Boot */
+#define MBR_PTYPE_SHAG_OS	0xae	/* SHAG OS filesystem */
+#define MBR_PTYPE_APPLE_HFS	0xaf	/* Apple HFS */
+#define MBR_PTYPE_BOOTSTAR_DUM	0xb0	/* BootStar Dummy */
+#define MBR_PTYPE_RESERVED_xB1	0xb1	/* reserved */
+#define MBR_PTYPE_RESERVED_xB3	0xb3	/* reserved */
+#define MBR_PTYPE_RESERVED_xB4	0xb4	/* reserved */
+#define MBR_PTYPE_RESERVED_xB6	0xb6	/* reserved */
+#define MBR_PTYPE_BSDI_386	0xb7	/* BSDI BSD/386 filesystem */
+#define MBR_PTYPE_BSDI_SWAP	0xb8	/* BSDI BSD/386 swap */
+#define	MBR_PTYPE_BOOT_WIZARD	0xbb	/* Boot Wizard Hidden */
+#define	MBR_PTYPE_SOLARIS_8	0xbe	/* Solaris 8 partition type */
+#define	MBR_PTYPE_SOLARIS	0xbf	/* Solaris partition type */
+#define MBR_PTYPE_CTOS		0xc0 	/* CTOS */
+#define MBR_PTYPE_DRDOS_FAT12	0xc1 	/* DRDOS/sec (FAT-12) */
+#define MBR_PTYPE_HID_LNX	0xc2 	/* Hidden Linux */
+#define MBR_PTYPE_HID_LNX_SWAP	0xc3 	/* Hidden Linux swap */
+#define MBR_PTYPE_DRDOS_FAT16S	0xc4 	/* DRDOS/sec (FAT-16, < 32M) */
+#define MBR_PTYPE_DRDOS_EXT	0xc5 	/* DRDOS/sec (EXT) */
+#define MBR_PTYPE_DRDOS_FAT16B	0xc6 	/* DRDOS/sec (FAT-16, >= 32M) */
+#define MBR_PTYPE_SYRINX	0xc7 	/* Syrinx (Cyrnix?) or HPFS disabled */
+#define MBR_PTYPE_DRDOS_8_xC8	0xc8 	/* Reserved for DR-DOS 8.0+ */
+#define MBR_PTYPE_DRDOS_8_xC9	0xc9 	/* Reserved for DR-DOS 8.0+ */
+#define MBR_PTYPE_DRDOS_8_xCA	0xca 	/* Reserved for DR-DOS 8.0+ */
+#define MBR_PTYPE_DRDOS_74_CHS	0xcb 	/* DR-DOS 7.04+ Secured FAT32 CHS */
+#define MBR_PTYPE_DRDOS_74_LBA	0xcc 	/* DR-DOS 7.04+ Secured FAT32 LBA */
+#define MBR_PTYPE_CTOS_MEMDUMP	0xcd	/* CTOS Memdump */
+#define MBR_PTYPE_DRDOS_74_16X	0xce 	/* DR-DOS 7.04+ FAT16X LBA */
+#define MBR_PTYPE_DRDOS_74_EXT	0xcf 	/* DR-DOS 7.04+ EXT LBA */
+#define MBR_PTYPE_REAL32	0xd0 	/* REAL/32 secure big partition */
+#define MBR_PTYPE_MDOS_FAT12	0xd1 	/* Old Multiuser DOS FAT12 */
+#define MBR_PTYPE_MDOS_FAT16S	0xd4 	/* Old Multiuser DOS FAT16 Small */
+#define MBR_PTYPE_MDOS_EXT	0xd5 	/* Old Multiuser DOS Extended */
+#define MBR_PTYPE_MDOS_FAT16B	0xd6 	/* Old Multiuser DOS FAT16 Big */
+#define MBR_PTYPE_CPM_86	0xd8 	/* CP/M 86 */
+#define MBR_PTYPE_CONCURRENT	0xdb 	/* CP/M or Concurrent CP/M */
+#define MBR_PTYPE_HID_CTOS_MEM	0xdd 	/* Hidden CTOS Memdump */
+#define MBR_PTYPE_DELL_UTIL	0xde 	/* Dell PowerEdge Server utilities */
+#define MBR_PTYPE_DGUX_VIRTUAL	0xdf 	/* DG/UX virtual disk manager */
+#define MBR_PTYPE_STMICROELEC	0xe0 	/* STMicroelectronics ST AVFS */
+#define MBR_PTYPE_DOS_ACCESS	0xe1 	/* DOS access or SpeedStor 12-bit */
+#define MBR_PTYPE_STORDIM	0xe3 	/* DOS R/O or Storage Dimensions */
+#define MBR_PTYPE_SPEEDSTOR_16S	0xe4 	/* SpeedStor 16-bit FAT < 1024 cyl. */
+#define MBR_PTYPE_RESERVED_xE5	0xe5	/* reserved */
+#define MBR_PTYPE_RESERVED_xE6	0xe6	/* reserved */
+#define MBR_PTYPE_BEOS		0xeb 	/* BeOS */
+#define	MBR_PTYPE_PMBR		0xee	/* GPT Protective MBR */
+#define	MBR_PTYPE_EFI		0xef	/* EFI system partition */
+#define MBR_PTYPE_LNX_PA_RISC	0xf0 	/* Linux PA-RISC boot loader */
+#define MBR_PTYPE_SPEEDSTOR_X	0xf1 	/* SpeedStor or Storage Dimensions */
+#define MBR_PTYPE_DOS33_SEC	0xf2 	/* DOS 3.3+ Secondary */
+#define MBR_PTYPE_RESERVED_xF3	0xf3	/* reserved */
+#define MBR_PTYPE_SPEEDSTOR_L	0xf4	/* SpeedStor large partition */
+#define MBR_PTYPE_PROLOGUE	0xf5	/* Prologue multi-volumen partition */
+#define MBR_PTYPE_RESERVED_xF6	0xf6 	/* reserved */
+#define MBR_PTYPE_PCACHE	0xf9 	/* pCache: ext2/ext3 persistent cache */
+#define MBR_PTYPE_BOCHS		0xfa 	/* Bochs x86 emulator */
+#define MBR_PTYPE_VMWARE	0xfb 	/* VMware File System */
+#define MBR_PTYPE_VMWARE_SWAP	0xfc 	/* VMware Swap */
+#define MBR_PTYPE_LNX_RAID	0xfd 	/* Linux RAID partition persistent sb */
+#define MBR_PTYPE_LANSTEP	0xfe	/* LANstep or IBM PS/2 IML */
+#define MBR_PTYPE_XENIX_BAD	0xff 	/* Xenix Bad Block Table */
+
+#ifdef MBRPTYPENAMES
+static const struct mbr_ptype {
+	int id;
+	const char *name;
+} mbr_ptypes[] = {
+	{ MBR_PTYPE_UNUSED, "<UNUSED>" },
+	{ MBR_PTYPE_FAT12, "Primary DOS with 12 bit FAT" },
+	{ MBR_PTYPE_XENIX_ROOT, "XENIX / filesystem" },
+	{ MBR_PTYPE_XENIX_USR, "XENIX /usr filesystem" },
+	{ MBR_PTYPE_FAT16S, "Primary DOS with 16 bit FAT <32M" },
+	{ MBR_PTYPE_EXT, "Extended partition" },
+	{ MBR_PTYPE_FAT16B, "Primary 'big' DOS, 16-bit FAT (> 32MB)" },
+	{ MBR_PTYPE_NTFS, "NTFS, OS/2 HPFS, QNX2 or Advanced UNIX" },
+	{ MBR_PTYPE_DELL, "AIX filesystem or OS/2 (thru v1.3) or DELL "
+			  "multiple drives or Commodore DOS or SplitDrive" },
+	{ MBR_PTYPE_AIX_BOOT, "AIX boot partition or Coherent" },
+	{ MBR_PTYPE_OS2_BOOT, "OS/2 Boot Manager or Coherent swap or OPUS" },
+	{ MBR_PTYPE_FAT32, "Primary DOS with 32 bit FAT" },
+	{ MBR_PTYPE_FAT32L, "Primary DOS with 32 bit FAT - LBA" },
+	{ MBR_PTYPE_7XXX, "Type 7??? - LBA" },
+	{ MBR_PTYPE_FAT16L, "DOS (16-bit FAT) - LBA" },
+	{ MBR_PTYPE_EXT_LBA, "Ext. partition - LBA" },
+	{ MBR_PTYPE_OPUS, "OPUS" },
+	{ MBR_PTYPE_OS2_DOS12, "OS/2 BM: hidden DOS 12-bit FAT" },
+	{ MBR_PTYPE_COMPAQ_DIAG, "Compaq diagnostics" },
+	{ MBR_PTYPE_OS2_DOS16S, "OS/2 BM: hidden DOS 16-bit FAT <32M "
+				"or Novell DOS 7.0 bug" },
+	{ MBR_PTYPE_OS2_DOS16B, "OS/2 BM: hidden DOS 16-bit FAT >=32M" },
+	{ MBR_PTYPE_OS2_IFS, "OS/2 BM: hidden IFS" },
+	{ MBR_PTYPE_AST_SWAP, "AST Windows swapfile" },
+	{ MBR_PTYPE_WILLOWTECH, "Willowtech Photon coS" },
+	{ MBR_PTYPE_HID_FAT32, "hidden Windows/95 FAT32" },
+	{ MBR_PTYPE_HID_FAT32_LBA, "hidden Windows/95 FAT32 LBA" },
+	{ MBR_PTYPE_HID_FAT16_LBA, "hidden Windows/95 FAT16 LBA" },
+	{ MBR_PTYPE_WILLOWSOFT, "Willowsoft OFS1" },
+	{ MBR_PTYPE_RESERVED_x21, "reserved" },
+	{ MBR_PTYPE_RESERVED_x23, "reserved" },
+	{ MBR_PTYPE_RESERVED_x24, "NEC DOS"},
+	{ MBR_PTYPE_RESERVED_x26, "reserved" },
+	{ MBR_PTYPE_RESERVED_x31, "reserved" },
+	{ MBR_PTYPE_NOS, "Alien Internet Services NOS" },
+	{ MBR_PTYPE_RESERVED_x33, "reserved" },
+	{ MBR_PTYPE_RESERVED_x34, "reserved" },
+	{ MBR_PTYPE_OS2_JFS, "JFS on OS2" },
+	{ MBR_PTYPE_RESERVED_x36, "reserved" },
+	{ MBR_PTYPE_THEOS, "Theos" },
+	{ MBR_PTYPE_PLAN9, "Plan 9" },
+	{ MBR_PTYPE_PLAN9, "Plan 9, or Theos spanned" },
+	{ MBR_PTYPE_THEOS_4GB,	"Theos ver 4 4gb partition" },
+	{ MBR_PTYPE_THEOS_EXT,	"Theos ve 4 extended partition" },
+	{ MBR_PTYPE_PMRECOVERY, "PartitionMagic recovery" },
+	{ MBR_PTYPE_HID_NETWARE, "Hidden Netware" },
+	{ MBR_PTYPE_VENIX, "VENIX 286 or LynxOS" },
+	{ MBR_PTYPE_PREP, "Linux/MINIX (sharing disk with DRDOS) "
+			  "or Personal RISC boot" },
+	{ MBR_PTYPE_DRDOS_LSWAP, "SFS or Linux swap "
+				 "(sharing disk with DRDOS)" },
+	{ MBR_PTYPE_DRDOS_LINUX, "Linux native (sharing disk with DRDOS)" },
+	{ MBR_PTYPE_GOBACK, "GoBack change utility" },
+	{ MBR_PTYPE_BOOT_US, "Boot US Boot manager" },
+	{ MBR_PTYPE_EUMEL_x46, "EUMEL/Elan or Ergos 3" },
+	{ MBR_PTYPE_EUMEL_x47, "EUMEL/Elan or Ergos 3" },
+	{ MBR_PTYPE_EUMEL_x48, "EUMEL/Elan or Ergos 3" },
+	{ MBR_PTYPE_ALFS_THIN, "ALFX/THIN filesystem for DOS" },
+	{ MBR_PTYPE_OBERON, "Oberon partition" },
+	{ MBR_PTYPE_QNX4X, "QNX4.x" },
+	{ MBR_PTYPE_QNX4X_2, "QNX4.x 2nd part" },
+	{ MBR_PTYPE_QNX4X_3, "QNX4.x 3rd part" },
+	{ MBR_PTYPE_DM, "DM (disk manager)" },
+	{ MBR_PTYPE_DM6_AUX1, "DM6 Aux1 (or Novell)" },
+	{ MBR_PTYPE_CPM, "CP/M or Microport SysV/AT" },
+	{ MBR_PTYPE_DM6_AUX3, "DM6 Aux3" },
+	{ MBR_PTYPE_DM6_DDO, "DM6 DDO" },
+	{ MBR_PTYPE_EZDRIVE, "EZ-Drive (disk manager)" },
+	{ MBR_PTYPE_GOLDEN_BOW, "Golden Bow (disk manager)" },
+	{ MBR_PTYPE_DRIVE_PRO, "Drive PRO" },
+	{ MBR_PTYPE_PRIAM_EDISK, "Priam Edisk (disk manager)" },
+	{ MBR_PTYPE_SPEEDSTOR, "SpeedStor" },
+	{ MBR_PTYPE_HURD, "GNU HURD or Mach or Sys V/386 "
+			  "(such as ISC UNIX) or MtXinu" },
+	{ MBR_PTYPE_NOVELL_2XX, "Novell Netware 2.xx or Speedstore" },
+	{ MBR_PTYPE_NOVELL_3XX, "Novell Netware 3.xx" },
+	{ MBR_PTYPE_NOVELL_386, "Novell 386 Netware" },
+	{ MBR_PTYPE_NOVELL_x67, "Novell" },
+	{ MBR_PTYPE_NOVELL_x68, "Novell" },
+	{ MBR_PTYPE_NOVELL_x69, "Novell" },
+	{ MBR_PTYPE_DISKSECURE, "DiskSecure Multi-Boot" },
+	{ MBR_PTYPE_RESERVED_x71, "reserved" },
+	{ MBR_PTYPE_RESERVED_x73, "reserved" },
+	{ MBR_PTYPE_RESERVED_x74, "reserved" },
+	{ MBR_PTYPE_PCIX, "PC/IX" },
+	{ MBR_PTYPE_RESERVED_x76, "reserved" },
+	{ MBR_PTYPE_M2FS_M2CS,	"M2FS/M2CS partition" },
+	{ MBR_PTYPE_XOSL_FS, "XOSL boot loader filesystem" },
+	{ MBR_PTYPE_MINIX_14A, "MINIX until 1.4a" },
+	{ MBR_PTYPE_MINIX_14B, "MINIX since 1.4b, early Linux, Mitac dmgr" },
+	{ MBR_PTYPE_LNXSWAP, "Linux swap or Prime or Solaris" },
+	{ MBR_PTYPE_LNXEXT2, "Linux native" },
+	{ MBR_PTYPE_OS2_C, "OS/2 hidden C: drive" },
+	{ MBR_PTYPE_EXT_LNX, "Linux extended" },
+	{ MBR_PTYPE_NTFATVOL, "NT FAT volume set" },
+	{ MBR_PTYPE_NTFSVOL, "NTFS volume set or HPFS mirrored" },
+	{ MBR_PTYPE_LNX_KERNEL,	"Linux Kernel AiR-BOOT partition" },
+	{ MBR_PTYPE_FT_FAT32, "Legacy Fault tolerant FAT32" },
+	{ MBR_PTYPE_FT_FAT32_EXT, "Legacy Fault tolerant FAT32 ext" },
+	{ MBR_PTYPE_HID_FR_FD_12, "Hidden free FDISK FAT12" },
+	{ MBR_PTYPE_LNX_LVM, "Linux Logical Volume Manager" },
+	{ MBR_PTYPE_HID_FR_FD_16, "Hidden free FDISK FAT16" },
+	{ MBR_PTYPE_HID_FR_FD_EXT, "Hidden free FDISK DOS EXT" },
+	{ MBR_PTYPE_HID_FR_FD_16L, "Hidden free FDISK FAT16 Large" },
+	{ MBR_PTYPE_AMOEBA_FS, "Amoeba filesystem" },
+	{ MBR_PTYPE_AMOEBA_BAD, "Amoeba bad block table" },
+	{ MBR_PTYPE_MIT_EXOPC, "MIT EXOPC native partitions" },
+	{ MBR_PTYPE_HID_FR_FD_32, "Hidden free FDISK FAT32" },
+	{ MBR_PTYPE_DATALIGHT, "Datalight ROM-DOS Super-Boot" },
+	{ MBR_PTYPE_MYLEX, "Mylex EISA SCSI" },
+	{ MBR_PTYPE_HID_FR_FD_16L, "Hidden free FDISK FAT16 LBA" },
+	{ MBR_PTYPE_HID_FR_FD_EXL, "Hidden free FDISK EXT LBA" },
+	{ MBR_PTYPE_BSDI, "BSDI?" },
+	{ MBR_PTYPE_IBM_HIB, "IBM Thinkpad hibernation" },
+	{ MBR_PTYPE_HP_VOL_xA1, "HP Volume expansion (SpeedStor)" },
+	{ MBR_PTYPE_HP_VOL_xA3, "HP Volume expansion (SpeedStor)" },
+	{ MBR_PTYPE_HP_VOL_xA4, "HP Volume expansion (SpeedStor)" },
+	{ MBR_PTYPE_386BSD, "FreeBSD or 386BSD or old NetBSD" },
+	{ MBR_PTYPE_OPENBSD, "OpenBSD" },
+	{ MBR_PTYPE_NEXTSTEP_486, "NeXTSTEP 486" },
+	{ MBR_PTYPE_APPLE_UFS, "Apple UFS" },
+	{ MBR_PTYPE_NETBSD, "NetBSD" },
+	{ MBR_PTYPE_OLIVETTI, "Olivetty Fat12 1.44MB Service part" },
+	{ MBR_PTYPE_SHAG_OS, "SHAG OS filesystem" },
+	{ MBR_PTYPE_BOOTSTAR_DUM, "BootStar Dummy" },
+	{ MBR_PTYPE_BOOT_WIZARD, "Boot Wizard Hidden" },
+	{ MBR_PTYPE_APPLE_BOOT, "Apple Boot" },
+	{ MBR_PTYPE_APPLE_HFS, "Apple HFS" },
+	{ MBR_PTYPE_RESERVED_xB6, "reserved" },
+	{ MBR_PTYPE_RESERVED_xB6, "reserved" },
+	{ MBR_PTYPE_RESERVED_xB6, "reserved" },
+	{ MBR_PTYPE_RESERVED_xB6, "reserved" },
+	{ MBR_PTYPE_BSDI_386, "BSDI BSD/386 filesystem" },
+	{ MBR_PTYPE_BSDI_SWAP, "BSDI BSD/386 swap" },
+	{ MBR_PTYPE_SOLARIS_8, "Solaris 8 boot partition" },
+	{ MBR_PTYPE_SOLARIS, "Solaris boot partition" },
+	{ MBR_PTYPE_CTOS, "CTOS" },
+	{ MBR_PTYPE_DRDOS_FAT12, "DRDOS/sec (FAT-12)" },
+	{ MBR_PTYPE_HID_LNX, "Hidden Linux" },
+	{ MBR_PTYPE_HID_LNX_SWAP, "Hidden Linux Swap" },
+	{ MBR_PTYPE_DRDOS_FAT16S, "DRDOS/sec (FAT-16, < 32M)" },
+	{ MBR_PTYPE_DRDOS_EXT, "DRDOS/sec (EXT)" },
+	{ MBR_PTYPE_DRDOS_FAT16B, "DRDOS/sec (FAT-16, >= 32M)" },
+	{ MBR_PTYPE_SYRINX, "Syrinx (Cyrnix?) or HPFS disabled" },
+	{ MBR_PTYPE_DRDOS_8_xC8, "Reserved for DR-DOS 8.0+" },
+	{ MBR_PTYPE_DRDOS_8_xC9, "Reserved for DR-DOS 8.0+" },
+	{ MBR_PTYPE_DRDOS_8_xCA, "Reserved for DR-DOS 8.0+" },
+	{ MBR_PTYPE_DRDOS_74_CHS, "DR-DOS 7.04+ Secured FAT32 CHS" },
+	{ MBR_PTYPE_DRDOS_74_LBA, "DR-DOS 7.04+ Secured FAT32 LBA" },
+	{ MBR_PTYPE_CTOS_MEMDUMP, "CTOS Memdump" },
+	{ MBR_PTYPE_DRDOS_74_16X, "DR-DOS 7.04+ FAT16X LBA" },
+	{ MBR_PTYPE_DRDOS_74_EXT, "DR-DOS 7.04+ EXT LBA" },
+	{ MBR_PTYPE_REAL32, "REAL/32 secure big partition" },
+	{ MBR_PTYPE_MDOS_FAT12, "Old Multiuser DOS FAT12" },
+	{ MBR_PTYPE_MDOS_FAT16S, "Old Multiuser DOS FAT16 Small" },
+	{ MBR_PTYPE_MDOS_EXT, "Old Multiuser DOS Extended" },
+	{ MBR_PTYPE_MDOS_FAT16B, "Old Multiuser DOS FAT16 Big" },
+	{ MBR_PTYPE_CPM_86, "CP/M 86" },
+	{ MBR_PTYPE_CONCURRENT, "CP/M or Concurrent CP/M or Concurrent DOS "
+				"or CTOS" },
+	{ MBR_PTYPE_HID_CTOS_MEM, "Hidden CTOS Memdump" },
+	{ MBR_PTYPE_DELL_UTIL, "Dell PowerEdge Server utilities" },
+	{ MBR_PTYPE_DGUX_VIRTUAL, "DG/UX virtual disk manager" },
+	{ MBR_PTYPE_STMICROELEC, "STMicroelectronics ST AVFS" },
+	{ MBR_PTYPE_DOS_ACCESS, "DOS access or SpeedStor 12-bit FAT "
+				"extended partition" },
+	{ MBR_PTYPE_STORDIM, "DOS R/O or SpeedStor or Storage Dimensions" },
+	{ MBR_PTYPE_SPEEDSTOR_16S, "SpeedStor 16-bit FAT extended partition "
+				   "< 1024 cyl." },
+	{ MBR_PTYPE_RESERVED_xE5, "reserved" },
+	{ MBR_PTYPE_RESERVED_xE6, "reserved" },
+	{ MBR_PTYPE_BEOS, "BeOS" },
+	{ MBR_PTYPE_PMBR, "GPT Protective MBR" },
+	{ MBR_PTYPE_EFI, "EFI system partition" },
+	{ MBR_PTYPE_LNX_PA_RISC, "Linux PA-RISC boot loader" },
+	{ MBR_PTYPE_SPEEDSTOR_X, "SpeedStor or Storage Dimensions" },
+	{ MBR_PTYPE_DOS33_SEC, "DOS 3.3+ Secondary" },
+	{ MBR_PTYPE_RESERVED_xF3, "reserved" },
+	{ MBR_PTYPE_SPEEDSTOR_L, "SpeedStor large partition or "
+				 "Storage Dimensions" },
+	{ MBR_PTYPE_PROLOGUE, "Prologue multi-volumen partition" },
+	{ MBR_PTYPE_RESERVED_xF6, "reserved" },
+	{ MBR_PTYPE_PCACHE, "pCache: ext2/ext3 persistent cache" },
+	{ MBR_PTYPE_BOCHS, "Bochs x86 emulator" },
+	{ MBR_PTYPE_VMWARE, "VMware File System" },
+	{ MBR_PTYPE_VMWARE_SWAP, "VMware Swap" },
+	{ MBR_PTYPE_LNX_RAID, "Linux RAID partition persistent sb" },
+	{ MBR_PTYPE_LANSTEP, "SpeedStor >1024 cyl. or LANstep "
+			     "or IBM PS/2 IML" },
+	{ MBR_PTYPE_XENIX_BAD, "Xenix Bad Block Table" },
+};
+#endif
+
+#define	MBR_PSECT(s)		((s) & 0x3f)
+#define	MBR_PCYL(c, s)		((c) + (((s) & 0xc0) << 2))
+
+#define	MBR_IS_EXTENDED(x)	((x) == MBR_PTYPE_EXT || \
+				 (x) == MBR_PTYPE_EXT_LBA || \
+				 (x) == MBR_PTYPE_EXT_LNX)
+
+		/* values for mbr_bootsel.mbrbs_flags */
+#define	MBR_BS_ACTIVE	0x01	/* Bootselector active (or code present) */
+#define	MBR_BS_EXTINT13	0x02	/* Set by fdisk if LBA needed (deprecated) */
+#define	MBR_BS_READ_LBA	0x04	/* Force LBA reads (deprecated) */
+#define	MBR_BS_EXTLBA	0x08	/* Extended ptn capable (LBA reads) */
+#define	MBR_BS_ASCII	0x10	/* Bootselect code needs ascii key code */
+/* This is always set, the bootsel is located using the magic number...  */
+#define	MBR_BS_NEWMBR	0x80	/* New bootsel at offset 440 */
+
+#if !defined(__ASSEMBLER__)					/* { */
+
+/*
+ * (x86) BIOS Parameter Block for FAT12
+ */
+struct mbr_bpbFAT12 {
+	uint16_t	bpbBytesPerSec;	/* bytes per sector */
+	uint8_t		bpbSecPerClust;	/* sectors per cluster */
+	uint16_t	bpbResSectors;	/* number of reserved sectors */
+	uint8_t		bpbFATs;	/* number of FATs */
+	uint16_t	bpbRootDirEnts;	/* number of root directory entries */
+	uint16_t	bpbSectors;	/* total number of sectors */
+	uint8_t		bpbMedia;	/* media descriptor */
+	uint16_t	bpbFATsecs;	/* number of sectors per FAT */
+	uint16_t	bpbSecPerTrack;	/* sectors per track */
+	uint16_t	bpbHeads;	/* number of heads */
+	uint16_t	bpbHiddenSecs;	/* # of hidden sectors */
+} __packed;
+
+/*
+ * (x86) BIOS Parameter Block for FAT16
+ */
+struct mbr_bpbFAT16 {
+	uint16_t	bpbBytesPerSec;	/* bytes per sector */
+	uint8_t		bpbSecPerClust;	/* sectors per cluster */
+	uint16_t	bpbResSectors;	/* number of reserved sectors */
+	uint8_t		bpbFATs;	/* number of FATs */
+	uint16_t	bpbRootDirEnts;	/* number of root directory entries */
+	uint16_t	bpbSectors;	/* total number of sectors */
+	uint8_t		bpbMedia;	/* media descriptor */
+	uint16_t	bpbFATsecs;	/* number of sectors per FAT */
+	uint16_t	bpbSecPerTrack;	/* sectors per track */
+	uint16_t	bpbHeads;	/* number of heads */
+	uint32_t	bpbHiddenSecs;	/* # of hidden sectors */
+	uint32_t	bpbHugeSectors;	/* # of sectors if bpbSectors == 0 */
+	uint8_t		bsDrvNum;	/* Int 0x13 drive number (e.g. 0x80) */
+	uint8_t		bsReserved1;	/* Reserved; set to 0 */
+	uint8_t		bsBootSig;	/* 0x29 if next 3 fields are present */
+	uint8_t		bsVolID[4];	/* Volume serial number */
+	uint8_t		bsVolLab[11];	/* Volume label */
+	uint8_t		bsFileSysType[8];
+					/* "FAT12   ", "FAT16   ", "FAT     " */
+} __packed;
+
+/*
+ * (x86) BIOS Parameter Block for FAT32
+ */
+struct mbr_bpbFAT32 {
+	uint16_t	bpbBytesPerSec;	/* bytes per sector */
+	uint8_t		bpbSecPerClust;	/* sectors per cluster */
+	uint16_t	bpbResSectors;	/* number of reserved sectors */
+	uint8_t		bpbFATs;	/* number of FATs */
+	uint16_t	bpbRootDirEnts;	/* number of root directory entries */
+	uint16_t	bpbSectors;	/* total number of sectors */
+	uint8_t		bpbMedia;	/* media descriptor */
+	uint16_t	bpbFATsecs;	/* number of sectors per FAT */
+	uint16_t	bpbSecPerTrack;	/* sectors per track */
+	uint16_t	bpbHeads;	/* number of heads */
+	uint32_t	bpbHiddenSecs;	/* # of hidden sectors */
+	uint32_t	bpbHugeSectors;	/* # of sectors if bpbSectors == 0 */
+	uint32_t	bpbBigFATsecs;	/* like bpbFATsecs for FAT32 */
+	uint16_t	bpbExtFlags;	/* extended flags: */
+#define	MBR_FAT32_FATNUM	0x0F	/*   mask for numbering active FAT */
+#define	MBR_FAT32_FATMIRROR	0x80	/*   FAT is mirrored (as previously) */
+	uint16_t	bpbFSVers;	/* filesystem version */
+#define	MBR_FAT32_FSVERS	0	/*   currently only 0 is understood */
+	uint32_t	bpbRootClust;	/* start cluster for root directory */
+	uint16_t	bpbFSInfo;	/* filesystem info structure sector */
+	uint16_t	bpbBackup;	/* backup boot sector */
+	uint8_t		bsReserved[12];	/* Reserved for future expansion */
+	uint8_t		bsDrvNum;	/* Int 0x13 drive number (e.g. 0x80) */
+	uint8_t		bsReserved1;	/* Reserved; set to 0 */
+	uint8_t		bsBootSig;	/* 0x29 if next 3 fields are present */
+	uint8_t		bsVolID[4];	/* Volume serial number */
+	uint8_t		bsVolLab[11];	/* Volume label */
+	uint8_t		bsFileSysType[8]; /* "FAT32   " */
+} __packed;
+
+/*
+ * (x86) MBR boot selector
+ */
+struct mbr_bootsel {
+	uint8_t		mbrbs_defkey;
+	uint8_t		mbrbs_flags;
+	uint16_t	mbrbs_timeo;
+	char		mbrbs_nametab[MBR_PART_COUNT][MBR_BS_PARTNAMESIZE + 1];
+} __packed;
+
+/*
+ * MBR partition
+ */
+struct mbr_partition {
+	uint8_t		mbrp_flag;	/* MBR partition flags */
+	uint8_t		mbrp_shd;	/* Starting head */
+	uint8_t		mbrp_ssect;	/* Starting sector */
+	uint8_t		mbrp_scyl;	/* Starting cylinder */
+	uint8_t		mbrp_type;	/* Partition type (see below) */
+	uint8_t		mbrp_ehd;	/* End head */
+	uint8_t		mbrp_esect;	/* End sector */
+	uint8_t		mbrp_ecyl;	/* End cylinder */
+	uint32_t	mbrp_start;	/* Absolute starting sector number */
+	uint32_t	mbrp_size;	/* Partition size in sectors */
+} __packed;
+
+int xlat_mbr_fstype(int);	/* in sys/lib/libkern/xlat_mbr_fstype.c */
+
+/*
+ * MBR boot sector.
+ * This is used by both the MBR (Master Boot Record) in sector 0 of the disk
+ * and the PBR (Partition Boot Record) in sector 0 of an MBR partition.
+ */
+struct mbr_sector {
+					/* Jump instruction to boot code.  */
+					/* Usually 0xE9nnnn or 0xEBnn90 */
+	uint8_t			mbr_jmpboot[3];
+					/* OEM name and version */
+	uint8_t			mbr_oemname[8];
+	union {				/* BIOS Parameter Block */
+		struct mbr_bpbFAT12	bpb12;
+		struct mbr_bpbFAT16	bpb16;
+		struct mbr_bpbFAT32	bpb32;
+	} mbr_bpb;
+					/* Boot code */
+	uint8_t			mbr_bootcode[310];
+					/* Config for /usr/mdec/mbr_bootsel */
+	struct mbr_bootsel	mbr_bootsel;
+					/* NT Drive Serial Number */
+	uint32_t		mbr_dsn;
+					/* mbr_bootsel magic */
+	uint16_t		mbr_bootsel_magic;
+					/* MBR partition table */
+	struct mbr_partition	mbr_parts[MBR_PART_COUNT];
+					/* MBR magic (0xaa55) */
+	uint16_t		mbr_magic;
+} __packed;
+
+#endif	/* !defined(__ASSEMBLER__) */				/* } */
+
+
+/* ------------------------------------------
+ * shared --
+ *	definitions shared by many platforms
+ */
+
+#if !defined(__ASSEMBLER__)					/* { */
+
+	/* Maximum # of blocks in bbi_block_table, each bbi_block_size long */
+#define	SHARED_BBINFO_MAXBLOCKS	118	/* so sizeof(shared_bbinfo) == 512 */
+
+struct shared_bbinfo {
+	uint8_t bbi_magic[32];
+	int32_t bbi_block_size;
+	int32_t bbi_block_count;
+	int32_t bbi_block_table[SHARED_BBINFO_MAXBLOCKS];
+};
+
+/* ------------------------------------------
+ * alpha --
+ *	Alpha (disk, but also tape) Boot Block.
+ *
+ *	See Section (III) 3.6.1 of the Alpha Architecture Reference Manual.
+ */
+
+struct alpha_boot_block {
+	uint64_t bb_data[63];		/* data (disklabel, also as below) */
+	uint64_t bb_cksum;		/* checksum of the boot block,
+					 * taken as uint64_t's
+					 */
+};
+#define	bb_secsize	bb_data[60]	/* secondary size (blocks) */
+#define	bb_secstart	bb_data[61]	/* secondary start (blocks) */
+#define	bb_flags	bb_data[62]	/* unknown flags (set to zero) */
+
+#define	ALPHA_BOOT_BLOCK_OFFSET		0	/* offset of boot block. */
+#define	ALPHA_BOOT_BLOCK_BLOCKSIZE	512	/* block size for sector
+						 * size/start, and for boot
+						 * block itself.
+						 */
+
+#define	ALPHA_BOOT_BLOCK_CKSUM(bb,cksum)				\
+	do {								\
+		const struct alpha_boot_block *_bb = (bb);		\
+		uint64_t _cksum;					\
+		size_t _i;						\
+									\
+		_cksum = 0;						\
+		for (_i = 0;						\
+		    _i < (sizeof _bb->bb_data / sizeof _bb->bb_data[0]); \
+		    _i++)						\
+			_cksum += le64toh(_bb->bb_data[_i]);		\
+		*(cksum) = htole64(_cksum);				\
+	} while (/*CONSTCOND*/ 0)
+
+/* ------------------------------------------
+ * apple --
+ *	Apple computers boot block related information
+ */
+
+/*
+ *	Driver Descriptor Map, from Inside Macintosh: Devices, SCSI Manager
+ *	pp 12-13.  The driver descriptor map always resides on physical block 0.
+ */
+struct apple_drvr_descriptor {
+	uint32_t	descBlock;	/* first block of driver */
+	uint16_t	descSize;	/* driver size in blocks */
+	uint16_t	descType;	/* system type */
+} __packed;
+
+/*
+ *	system types; Apple reserves 0-15
+ */
+#define	APPLE_DRVR_TYPE_MACINTOSH	1
+
+#define	APPLE_DRVR_MAP_MAGIC		0x4552
+#define	APPLE_DRVR_MAP_MAX_DESCRIPTORS	61
+
+struct apple_drvr_map {
+	uint16_t	sbSig;		/* map signature */
+	uint16_t	sbBlockSize;	/* block size of device */
+	uint32_t	sbBlkCount;	/* number of blocks on device */
+	uint16_t	sbDevType;	/* (used internally by ROM) */
+	uint16_t	sbDevID;	/* (used internally by ROM) */
+	uint32_t	sbData;		/* (used internally by ROM) */
+	uint16_t	sbDrvrCount;	/* number of driver descriptors */
+	struct apple_drvr_descriptor sb_dd[APPLE_DRVR_MAP_MAX_DESCRIPTORS];
+	uint16_t	pad[3];
+} __packed;
+
+/*
+ *	Partition map structure from Inside Macintosh: Devices, SCSI Manager
+ *	pp. 13-14.  The partition map always begins on physical block 1.
+ *
+ *	With the exception of block 0, all blocks on the disk must belong to
+ *	exactly one partition.  The partition map itself belongs to a partition
+ *	of type `APPLE_PARTITION_MAP', and is not limited in size by anything
+ *	other than available disk space.  The partition map is not necessarily
+ *	the first partition listed.
+ */
+#define	APPLE_PART_MAP_ENTRY_MAGIC	0x504d
+
+struct apple_part_map_entry {
+	uint16_t	pmSig;		/* partition signature */
+	uint16_t	pmSigPad;	/* (reserved) */
+	uint32_t	pmMapBlkCnt;	/* number of blocks in partition map */
+	uint32_t	pmPyPartStart;	/* first physical block of partition */
+	uint32_t	pmPartBlkCnt;	/* number of blocks in partition */
+	uint8_t		pmPartName[32];	/* partition name */
+	uint8_t		pmPartType[32];	/* partition type */
+	uint32_t	pmLgDataStart;	/* first logical block of data area */
+	uint32_t	pmDataCnt;	/* number of blocks in data area */
+	uint32_t	pmPartStatus;	/* partition status information */
+/*
+ * Partition Status Information from Apple Tech Note 1189
+ */
+#define	APPLE_PS_VALID		0x00000001	/* Entry is valid */
+#define	APPLE_PS_ALLOCATED	0x00000002	/* Entry is allocated */
+#define	APPLE_PS_IN_USE		0x00000004	/* Entry in use */
+#define	APPLE_PS_BOOT_INFO	0x00000008	/* Entry contains boot info */
+#define	APPLE_PS_READABLE	0x00000010	/* Entry is readable */
+#define	APPLE_PS_WRITABLE	0x00000020	/* Entry is writable */
+#define	APPLE_PS_BOOT_CODE_PIC	0x00000040	/* Boot code has position
+						 * independent code */
+#define	APPLE_PS_CC_DRVR	0x00000100	/* Partition contains chain-
+						 * compatible driver */
+#define	APPLE_PS_RL_DRVR	0x00000200	/* Partition contains real
+						 * driver */
+#define	APPLE_PS_CH_DRVR	0x00000400	/* Partition contains chain
+						 * driver */
+#define	APPLE_PS_AUTO_MOUNT	0x40000000	/* Mount automatically at
+						 * startup */
+#define	APPLE_PS_STARTUP	0x80000000	/* Is the startup partition */
+	uint32_t	pmLgBootStart;	/* first logical block of boot code */
+	uint32_t	pmBootSize;	/* size of boot code, in bytes */
+	uint32_t	pmBootLoad;	/* boot code load address */
+	uint32_t	pmBootLoad2;	/* (reserved) */
+	uint32_t	pmBootEntry;	/* boot code entry point */
+	uint32_t	pmBootEntry2;	/* (reserved) */
+	uint32_t	pmBootCksum;	/* boot code checksum */
+	int8_t		pmProcessor[16]; /* processor type (e.g. "68020") */
+	uint8_t		pmBootArgs[128]; /* A/UX boot arguments */
+	uint8_t		pad[248];	/* pad to end of block */
+};
+
+#define	APPLE_PART_TYPE_DRIVER		"APPLE_DRIVER"
+#define	APPLE_PART_TYPE_DRIVER43	"APPLE_DRIVER43"
+#define	APPLE_PART_TYPE_DRIVERATA	"APPLE_DRIVER_ATA"
+#define	APPLE_PART_TYPE_DRIVERIOKIT	"APPLE_DRIVER_IOKIT"
+#define	APPLE_PART_TYPE_FWDRIVER	"APPLE_FWDRIVER"
+#define	APPLE_PART_TYPE_FWB_COMPONENT	"FWB DRIVER COMPONENTS"
+#define	APPLE_PART_TYPE_FREE		"APPLE_FREE"
+#define	APPLE_PART_TYPE_MAC		"APPLE_HFS"
+#define	APPLE_PART_TYPE_NETBSD		"NETBSD"
+#define	APPLE_PART_TYPE_NBSD_PPCBOOT	"NETBSD/MACPPC"
+#define	APPLE_PART_TYPE_NBSD_68KBOOT	"NETBSD/MAC68K"
+#define	APPLE_PART_TYPE_PATCHES		"APPLE_PATCHES"
+#define	APPLE_PART_TYPE_PARTMAP		"APPLE_PARTITION_MAP"
+#define	APPLE_PART_TYPE_PATCHES		"APPLE_PATCHES"
+#define	APPLE_PART_TYPE_SCRATCH		"APPLE_SCRATCH"
+#define	APPLE_PART_TYPE_UNIX		"APPLE_UNIX_SVR2"
+
+/*
+ * "pmBootArgs" for APPLE_UNIX_SVR2 partition.
+ * NetBSD/mac68k only uses Magic, Cluster, Type, and Flags.
+ */
+struct apple_blockzeroblock {
+	uint32_t       bzbMagic;
+	uint8_t        bzbCluster;
+	uint8_t        bzbType;
+	uint16_t       bzbBadBlockInode;
+	uint16_t       bzbFlags;
+	uint16_t       bzbReserved;
+	uint32_t       bzbCreationTime;
+	uint32_t       bzbMountTime;
+	uint32_t       bzbUMountTime;
+};
+
+#define	APPLE_BZB_MAGIC		0xABADBABE
+#define	APPLE_BZB_TYPEFS	1
+#define	APPLE_BZB_TYPESWAP	3
+#define	APPLE_BZB_ROOTFS	0x8000
+#define	APPLE_BZB_USRFS		0x4000
+
+/* ------------------------------------------
+ * ews4800mips
+ *
+ */
+
+#define	EWS4800MIPS_BBINFO_MAGIC		"NetBSD/ews4800mips     20040611"
+#define	EWS4800MIPS_BOOT_BLOCK_OFFSET		0
+#define	EWS4800MIPS_BOOT_BLOCK_BLOCKSIZE	512
+#define	EWS4800MIPS_BOOT_BLOCK_MAX_SIZE		(512 * 8)
+
+/* ------------------------------------------
+ * hp300
+ *
+ */
+
+/* volume header for "LIF" format volumes */
+
+struct	hp300_lifvol {
+	int16_t	vol_id;
+	char	vol_label[6];
+	int32_t	vol_addr;
+	int16_t	vol_oct;
+	int16_t	vol_dummy;
+	int32_t	vol_dirsize;
+	int16_t	vol_version;
+	int16_t	vol_zero;
+	int32_t	vol_huh1;
+	int32_t	vol_huh2;
+	int32_t	vol_length;
+};
+
+/* LIF directory entry format */
+
+struct	hp300_lifdir {
+	char	dir_name[10];
+	int16_t	dir_type;
+	int32_t	dir_addr;
+	int32_t	dir_length;
+	char	dir_toc[6];
+	int16_t	dir_flag;
+	int32_t	dir_exec;
+};
+
+/* load header for boot rom */
+struct hp300_load {
+	int32_t address;
+	int32_t count;
+};
+
+#define	HP300_VOL_ID		-32768
+#define	HP300_VOL_OCT		4096
+#define	HP300_DIR_TYPE		-5822
+#define	HP300_DIR_FLAG		0x8001	/* dont ask me! */
+#define	HP300_SECTSIZE		256
+
+
+/* ------------------------------------------
+ * hppa
+ *
+ */
+
+/*
+ * volume header for "LIF" format volumes
+ */
+struct	hppa_lifvol {
+	uint16_t	vol_id;
+	uint8_t		vol_label[6];
+	uint32_t	vol_addr;
+	uint16_t	vol_oct;
+	uint16_t	vol_dummy;
+
+	uint32_t	vol_dirsize;
+	uint16_t	vol_version;
+	uint16_t	vol_zero;
+	uint32_t	vol_number;
+	uint32_t	vol_lastvol;
+
+	uint32_t	vol_length;
+	uint8_t		vol_toc[6];
+	uint8_t		vol_dummy1[198];
+
+	uint32_t	ipl_addr;
+	uint32_t	ipl_size;
+	uint32_t	ipl_entry;
+
+	uint32_t	vol_dummy2;
+};
+
+struct	hppa_lifdir {
+	uint8_t		dir_name[10];
+	uint16_t	dir_type;
+	uint32_t	dir_addr;
+	uint32_t	dir_length;
+	uint8_t		dir_toc[6];
+	uint16_t	dir_flag;
+	uint32_t	dir_implement;
+};
+
+struct hppa_lifload {
+	int address;
+	int count;
+};
+
+#define	HPPA_LIF_VOL_ID	0x8000
+#define	HPPA_LIF_VOL_OCT	0x1000
+#define	HPPA_LIF_DIR_SWAP	0x5243
+#define	HPPA_LIF_DIR_FS	0xcd38
+#define	HPPA_LIF_DIR_IOMAP	0xcd60
+#define	HPPA_LIF_DIR_HPUX	0xcd80
+#define	HPPA_LIF_DIR_ISL	0xce00
+#define	HPPA_LIF_DIR_PAD	0xcffe
+#define	HPPA_LIF_DIR_AUTO	0xcfff
+#define	HPPA_LIF_DIR_EST	0xd001
+#define	HPPA_LIF_DIR_TYPE	0xe942
+
+#define	HPPA_LIF_DIR_FLAG	0x8001	/* dont ask me! */
+#define	HPPA_LIF_SECTSIZE	256
+
+#define	HPPA_LIF_NUMDIR	8
+
+#define	HPPA_LIF_VOLSTART	0
+#define	HPPA_LIF_VOLSIZE	sizeof(struct hppa_lifvol)
+#define	HPPA_LIF_DIRSTART	2048
+#define	HPPA_LIF_DIRSIZE	(HPPA_LIF_NUMDIR * sizeof(struct hppa_lifdir))
+#define	HPPA_LIF_FILESTART	4096
+
+#define	hppa_btolifs(b)	(((b) + (HPPA_LIF_SECTSIZE - 1)) / HPPA_LIF_SECTSIZE)
+#define	hppa_lifstob(s)	((s) * HPPA_LIF_SECTSIZE)
+#define	hppa_lifstodb(s)	((s) * HPPA_LIF_SECTSIZE / DEV_BSIZE)
+
+
+/* ------------------------------------------
+ * x86
+ *
+ */
+
+/*
+ * Parameters for NetBSD /boot written to start of pbr code by installboot
+ */
+
+struct x86_boot_params {
+	uint32_t	bp_length;	/* length of patchable data */
+	uint32_t	bp_flags;
+	uint32_t	bp_timeout;	/* boot timeout in seconds */
+	uint32_t	bp_consdev;
+	uint32_t	bp_conspeed;
+	uint8_t		bp_password[16];	/* md5 hash of password */
+	char		bp_keymap[64];	/* keyboard translation map */
+	uint32_t	bp_consaddr;	/* ioaddr for console */
+};
+
+#endif	/* !defined(__ASSEMBLER__) */				/* } */
+
+#define	X86_BOOT_MAGIC(n)	('x' << 24 | 0x86b << 12 | 'm' << 4 | (n))
+#define	X86_BOOT_MAGIC_1	X86_BOOT_MAGIC(1)	/* pbr.S */
+#define	X86_BOOT_MAGIC_2	X86_BOOT_MAGIC(2)	/* bootxx.S */
+#define	X86_BOOT_MAGIC_PXE	X86_BOOT_MAGIC(3)	/* start_pxe.S */
+#define	X86_BOOT_MAGIC_FAT	X86_BOOT_MAGIC(4)	/* fatboot.S */
+#define	X86_MBR_GPT_MAGIC	0xedb88320		/* gpt.S */
+
+		/* values for bp_flags */
+#define	X86_BP_FLAGS_RESET_VIDEO	1
+#define	X86_BP_FLAGS_PASSWORD		2
+#define	X86_BP_FLAGS_NOMODULES		4
+#define	X86_BP_FLAGS_NOBOOTCONF		8
+#define	X86_BP_FLAGS_LBA64VALID		0x10
+
+		/* values for bp_consdev */
+#define	X86_BP_CONSDEV_PC	0
+#define	X86_BP_CONSDEV_COM0	1
+#define	X86_BP_CONSDEV_COM1	2
+#define	X86_BP_CONSDEV_COM2	3
+#define	X86_BP_CONSDEV_COM3	4
+#define	X86_BP_CONSDEV_COM0KBD	5
+#define	X86_BP_CONSDEV_COM1KBD	6
+#define	X86_BP_CONSDEV_COM2KBD	7
+#define	X86_BP_CONSDEV_COM3KBD	8
+
+/* ------------------------------------------
+ * landisk
+ */
+
+#if !defined(__ASSEMBLER__)					/* { */
+
+/*
+ * Parameters for NetBSD /boot written to start of pbr code by installboot
+ */
+struct landisk_boot_params {
+	uint32_t	bp_length;	/* length of patchable data */
+	uint32_t	bp_flags;
+	uint32_t	bp_timeout;	/* boot timeout in seconds */
+	uint32_t	bp_consdev;
+	uint32_t	bp_conspeed;
+};
+
+#endif	/* !defined(__ASSEMBLER__) */				/* } */
+
+#define	LANDISK_BOOT_MAGIC_1	0x20031125
+#define	LANDISK_BOOT_MAGIC_2	0x20041110
+
+#if !defined(__ASSEMBLER__)					/* { */
+
+/* ------------------------------------------
+ * macppc
+ */
+
+#define	MACPPC_BOOT_BLOCK_OFFSET	2048
+#define	MACPPC_BOOT_BLOCK_BLOCKSIZE	512
+#define	MACPPC_BOOT_BLOCK_MAX_SIZE	2048	/* XXX: could be up to 6144 */
+	/* Magic string -- 32 bytes long (including the NUL) */
+#define	MACPPC_BBINFO_MAGIC		"NetBSD/macppc bootxx   20020515"
+
+/* ------------------------------------------
+ * news68k, newsmips
+ */
+
+#define	NEWS_BOOT_BLOCK_LABELOFFSET	64 /* XXX from <machine/disklabel.h> */
+#define	NEWS_BOOT_BLOCK_OFFSET		0
+#define	NEWS_BOOT_BLOCK_BLOCKSIZE	512
+#define	NEWS_BOOT_BLOCK_MAX_SIZE	(512 * 16)
+
+	/* Magic string -- 32 bytes long (including the NUL) */
+#define	NEWS68K_BBINFO_MAGIC		"NetBSD/news68k bootxx  20020518"
+#define	NEWSMIPS_BBINFO_MAGIC		"NetBSD/newsmips bootxx 20020518"
+
+/* ------------------------------------------
+ * next68k
+ */
+
+#define	NEXT68K_LABEL_MAXPARTITIONS	8	/* number of partitions in next68k_disklabel */
+#define	NEXT68K_LABEL_CPULBLLEN		24
+#define	NEXT68K_LABEL_MAXDNMLEN		24
+#define	NEXT68K_LABEL_MAXTYPLEN		24
+#define	NEXT68K_LABEL_MAXBFLEN		24
+#define	NEXT68K_LABEL_MAXHNLEN		32
+#define	NEXT68K_LABEL_MAXMPTLEN		16
+#define	NEXT68K_LABEL_MAXFSTLEN		8
+#define	NEXT68K_LABEL_NBAD		1670	/* sized to make label ~= 8KB */
+
+struct next68k_partition {
+	int32_t	cp_offset;		/* starting sector */
+	int32_t	cp_size;		/* number of sectors in partition */
+	int16_t	cp_bsize;		/* block size in bytes */
+	int16_t	cp_fsize;		/* filesystem basic fragment size */
+	char	cp_opt;			/* optimization type: 's'pace/'t'ime */
+	char	cp_pad1;
+	int16_t	cp_cpg;			/* filesystem cylinders per group */
+	int16_t	cp_density;		/* bytes per inode density */
+	int8_t	cp_minfree;		/* minfree (%) */
+	int8_t	cp_newfs;		/* run newfs during init */
+	char	cp_mountpt[NEXT68K_LABEL_MAXMPTLEN];
+					/* default/standard mount point */
+	int8_t	cp_automnt;		/* auto-mount when inserted */
+	char	cp_type[NEXT68K_LABEL_MAXFSTLEN]; /* file system type name */
+	char	cp_pad2;
+} __packed;
+
+/* The disklabel the way it is on the disk */
+struct next68k_disklabel {
+	int32_t	cd_version;		/* label version */
+	int32_t	cd_label_blkno;		/* block # of this label */
+	int32_t	cd_size;		/* size of media area (sectors) */
+	char	cd_label[NEXT68K_LABEL_CPULBLLEN]; /* disk name (label) */
+	uint32_t cd_flags;		/* flags */
+	uint32_t cd_tag;		/* volume tag */
+	char	cd_name[NEXT68K_LABEL_MAXDNMLEN]; /* drive (hardware) name */
+	char	cd_type[NEXT68K_LABEL_MAXTYPLEN]; /* drive type */
+	int32_t	cd_secsize;		/* # of bytes per sector */
+	int32_t	cd_ntracks;		/* # of tracks per cylinder */
+	int32_t	cd_nsectors;		/* # of data sectors per track */
+	int32_t	cd_ncylinders;		/* # of data cylinders per unit */
+	int32_t	cd_rpm;			/* rotational speed */
+	int16_t	cd_front;		/* # of sectors in "front porch" */
+	int16_t	cd_back;		/* # of sectors in "back porch" */
+	int16_t	cd_ngroups;		/* # of alt groups */
+	int16_t	cd_ag_size;		/* alt group size (sectors) */
+	int16_t	cd_ag_alts;		/* alternate sectors / alt group */
+	int16_t	cd_ag_off;		/* sector offset to first alternate */
+	int32_t	cd_boot_blkno[2];	/* boot program locations */
+	char	cd_kernel[NEXT68K_LABEL_MAXBFLEN]; /* default kernel name */
+	char	cd_hostname[NEXT68K_LABEL_MAXHNLEN];
+				/* host name (usu. where disk was labeled) */
+	char	cd_rootpartition;	/* root partition letter e.g. 'a' */
+	char	cd_rwpartition;		/* r/w partition letter e.g. 'b' */
+	struct next68k_partition cd_partitions[NEXT68K_LABEL_MAXPARTITIONS];
+
+	union {
+		uint16_t CD_v3_checksum; /* label version 3 checksum */
+		int32_t	CD_bad[NEXT68K_LABEL_NBAD];
+					/* block number that is bad */
+	} cd_un;
+	uint16_t cd_checksum;		/* label version 1 or 2 checksum */
+} __packed;
+
+#define	NEXT68K_LABEL_cd_checksum	cd_checksum
+#define	NEXT68K_LABEL_cd_v3_checksum	cd_un.CD_v3_checksum
+#define	NEXT68K_LABEL_cd_bad		cd_un.CD_bad
+
+#define	NEXT68K_LABEL_SECTOR		0	/* sector containing label */
+#define	NEXT68K_LABEL_OFFSET		0	/* offset of label in sector */
+#define	NEXT68K_LABEL_SIZE		8192	/* size of label */
+#define	NEXT68K_LABEL_CD_V1		0x4e655854 /* version #1: "NeXT" */
+#define	NEXT68K_LABEL_CD_V2		0x646c5632 /* version #2: "dlV2" */
+#define	NEXT68K_LABEL_CD_V3		0x646c5633 /* version #3: "dlV3" */
+#define	NEXT68K_LABEL_DEFAULTFRONTPORCH	(160 * 2)
+#define	NEXT68K_LABEL_DEFAULTBOOT0_1	(32 * 2)
+#define	NEXT68K_LABEL_DEFAULTBOOT0_2	(96 * 2)
+
+/* ------------------------------------------
+ * pmax --
+ *	PMAX (DECstation / MIPS) boot block information
+ */
+
+/*
+ * If mode is 0, there is just one sequence of blocks and one Dec_BootMap
+ * is used.  If mode is 1, there are multiple sequences of blocks
+ * and multiple Dec_BootMaps are used, the last with numBlocks = 0.
+ */
+struct pmax_boot_map {
+	int32_t	num_blocks;		/* Number of blocks to read. */
+	int32_t	start_block;		/* Starting block on disk. */
+};
+
+/*
+ * This is the structure of a disk or tape boot block.  The boot_map
+ * can either be a single boot count and start block (contiguous mode)
+ * or a list of up to 61 (to fill a 512 byte sector) block count and
+ * start block pairs.  Under NetBSD, contiguous mode is always used.
+ */
+struct pmax_boot_block {
+	uint8_t		pad[8];
+	int32_t		magic;			/* PMAX_BOOT_MAGIC */
+	int32_t		mode;			/* Mode for boot info. */
+	uint32_t	load_addr;		/* Address to start loading. */
+	uint32_t	exec_addr;		/* Address to start execing. */
+	struct		pmax_boot_map map[61];	/* boot program section(s). */
+} __packed;
+
+#define	PMAX_BOOT_MAGIC			0x0002757a
+#define	PMAX_BOOTMODE_CONTIGUOUS	0
+#define	PMAX_BOOTMODE_SCATTERED		1
+
+#define	PMAX_BOOT_BLOCK_OFFSET		0
+#define	PMAX_BOOT_BLOCK_BLOCKSIZE	512
+
+
+/* ------------------------------------------
+ * sgimips
+ */
+
+/*
+ * Some IRIX man pages refer to the size being a multiple of whole cylinders.
+ * Later ones only refer to the size being "typically" 2MB.  IRIX fx(1)
+ * uses a default drive geometry if one can't be determined, suggesting
+ * that "whole cylinder" multiples are not required.
+ */
+
+#define SGI_BOOT_BLOCK_SIZE_VOLHDR	3135
+#define SGI_BOOT_BLOCK_MAGIC		0xbe5a941
+#define SGI_BOOT_BLOCK_MAXPARTITIONS	16
+#define SGI_BOOT_BLOCK_MAXVOLDIRS	15
+#define SGI_BOOT_BLOCK_BLOCKSIZE	512
+
+/*
+ * SGI partition conventions:
+ *
+ * Partition 0 - root
+ * Partition 1 - swap
+ * Partition 6 - usr
+ * Partition 7 - volume body
+ * Partition 8 - volume header
+ * Partition 10 - whole disk
+ */
+
+struct sgi_boot_devparms {
+	uint8_t		dp_skew;
+	uint8_t		dp_gap1;
+	uint8_t		dp_gap2;
+	uint8_t		dp_spares_cyl;
+	uint16_t	dp_cyls;
+	uint16_t	dp_shd0;
+	uint16_t	dp_trks0;
+	uint8_t		dp_ctq_depth;
+	uint8_t		dp_cylshi;
+	uint16_t	dp_unused;
+	uint16_t	dp_secs;
+	uint16_t	dp_secbytes;
+	uint16_t	dp_interleave;
+	uint32_t	dp_flags;
+	uint32_t	dp_datarate;
+	uint32_t	dp_nretries;
+	uint32_t	dp_mspw;
+	uint16_t	dp_xgap1;
+	uint16_t	dp_xsync;
+	uint16_t	dp_xrdly;
+	uint16_t	dp_xgap2;
+	uint16_t	dp_xrgate;
+	uint16_t	dp_xwcont;
+} __packed;
+
+struct sgi_boot_block {
+	uint32_t	magic;
+	int16_t		root;
+	int16_t		swap;
+	char		bootfile[16];
+	struct sgi_boot_devparms dp;
+	struct {
+		char		name[8];
+		int32_t		block;
+		int32_t		bytes;
+	}		voldir[SGI_BOOT_BLOCK_MAXVOLDIRS];
+	struct {
+		int32_t		blocks;
+		int32_t		first;
+		int32_t		type;
+	}		partitions[SGI_BOOT_BLOCK_MAXPARTITIONS];
+	int32_t		checksum;
+	int32_t		_pad;
+} __packed;
+
+#define SGI_PTYPE_VOLHDR	0
+#define SGI_PTYPE_TRKREPL	1
+#define SGI_PTYPE_SECREPL	2
+#define SGI_PTYPE_RAW		3
+#define SGI_PTYPE_BSD		4
+#define SGI_PTYPE_SYSV		5
+#define SGI_PTYPE_VOLUME	6
+#define SGI_PTYPE_EFS		7
+#define SGI_PTYPE_LVOL		8
+#define SGI_PTYPE_RLVOL		9
+#define SGI_PTYPE_XFS		10
+#define SGI_PTYPE_XFSLOG	11
+#define SGI_PTYPE_XLV		12
+#define SGI_PTYPE_XVM		13
+
+/* ------------------------------------------
+ * sparc
+ */
+
+#define	SPARC_BOOT_BLOCK_OFFSET		512
+#define	SPARC_BOOT_BLOCK_BLOCKSIZE	512
+#define	SPARC_BOOT_BLOCK_MAX_SIZE	(512 * 15)
+	/* Magic string -- 32 bytes long (including the NUL) */
+#define	SPARC_BBINFO_MAGIC		"NetBSD/sparc bootxx    20020515"
+
+
+/* ------------------------------------------
+ * sparc64
+ */
+
+#define	SPARC64_BOOT_BLOCK_OFFSET	512
+#define	SPARC64_BOOT_BLOCK_BLOCKSIZE	512
+#define	SPARC64_BOOT_BLOCK_MAX_SIZE	(512 * 15)
+
+
+/* ------------------------------------------
+ * sun68k (sun2, sun3)
+ */
+
+#define	SUN68K_BOOT_BLOCK_OFFSET	512
+#define	SUN68K_BOOT_BLOCK_BLOCKSIZE	512
+#define	SUN68K_BOOT_BLOCK_MAX_SIZE	(512 * 15)
+	/* Magic string -- 32 bytes long (including the NUL) */
+#define	SUN68K_BBINFO_MAGIC		"NetBSD/sun68k bootxx   20020515"
+
+
+/* ------------------------------------------
+ * vax --
+ *	VAX boot block information
+ */
+
+struct vax_boot_block {
+/* Note that these don't overlap any of the pmax boot block */
+	uint8_t		pad0[2];
+	uint8_t		bb_id_offset;	/* offset in words to id (magic1)*/
+	uint8_t		bb_mbone;	/* must be one */
+	uint16_t	bb_lbn_hi;	/* lbn (hi word) of bootstrap */
+	uint16_t	bb_lbn_low;	/* lbn (low word) of bootstrap */
+	uint8_t		pad1[406];
+	/* disklabel offset is 64 from base, or 56 from start of pad1 */
+
+	/* The rest of these fields are identification area and describe
+	 * the secondary block for uVAX VMB.
+	 */
+	uint8_t		bb_magic1;	/* magic number */
+	uint8_t		bb_mbz1;	/* must be zero */
+	uint8_t		bb_pad1;	/* any value */
+	uint8_t		bb_sum1;	/* ~(magic1 + mbz1 + pad1) */
+
+	uint8_t		bb_mbz2;	/* must be zero */
+	uint8_t		bb_volinfo;	/* volinfo */
+	uint8_t		bb_pad2a;	/* any value */
+	uint8_t		bb_pad2b;	/* any value */
+
+	uint32_t	bb_size;	/* size in blocks of bootstrap */
+	uint32_t	bb_load;	/* load offset to bootstrap */
+	uint32_t	bb_entry;	/* byte offset in bootstrap */
+	uint32_t	bb_sum3;	/* sum of previous 3 fields */
+
+	/* The rest is unused.
+	 */
+	uint8_t		pad2[74];
+} __packed;
+
+#define	VAX_BOOT_MAGIC1			0x18	/* size of BB info? */
+#define	VAX_BOOT_VOLINFO_NONE		0x00	/* no special info */
+#define	VAX_BOOT_VOLINFO_SS		0x01	/* single sided */
+#define	VAX_BOOT_VOLINFO_DS		0x81	/* double sided */
+
+#define	VAX_BOOT_SIZE			15	/* 15 blocks */
+#define	VAX_BOOT_LOAD			0	/* no load offset */
+#define	VAX_BOOT_ENTRY			0x200	/* one block in */
+
+#define	VAX_BOOT_BLOCK_OFFSET		0
+#define	VAX_BOOT_BLOCK_BLOCKSIZE	512
+
+
+/* ------------------------------------------
+ * x68k
+ */
+
+#define	X68K_BOOT_BLOCK_OFFSET		0
+#define	X68K_BOOT_BLOCK_BLOCKSIZE	512
+#define	X68K_BOOT_BLOCK_MAX_SIZE	(512 * 16)
+	/* Magic string -- 32 bytes long (including the NUL) */
+#define	X68K_BBINFO_MAGIC		"NetBSD/x68k bootxx     20020601"
+
+#endif	/* !defined(__ASSEMBLER__) */				/* } */
+
+#endif	/* !_SYS_BOOTBLOCK_H */

Property changes on: lab4/.minix-src/include/sys/bootblock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/dkbad.h
===================================================================
--- lab4/.minix-src/include/sys/dkbad.h	(nonexistent)
+++ lab4/.minix-src/include/sys/dkbad.h	(revision 13)
@@ -0,0 +1,82 @@
+/*	$NetBSD: dkbad.h,v 1.15 2005/12/26 18:41:36 perry Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dkbad.h	8.2 (Berkeley) 7/10/94
+ */
+
+#ifndef _SYS_DKBAD_H_
+#define _SYS_DKBAD_H_
+
+/*
+ * Definitions needed to perform bad sector revectoring ala DEC STD 144.
+ *
+ * The bad sector information is located in the first 5 even numbered
+ * sectors of the last track of the disk pack.  There are five identical
+ * copies of the information, described by the dkbad structure.
+ *
+ * Replacement sectors are allocated starting with the first sector before
+ * the bad sector information and working backwards towards the beginning of
+ * the disk.  A maximum of 126 bad sectors are supported.  The position of
+ * the bad sector in the bad sector table determines which replacement sector
+ * it corresponds to.
+ *
+ * The bad sector information and replacement sectors are conventionally
+ * only accessible through the 'c' file system partition of the disk.  If
+ * that partition is used for a file system, the user is responsible for
+ * making sure that it does not overlap the bad sector information or any
+ * replacement sectors.
+ */
+#define NBT_BAD	126
+
+struct dkbad {
+	int32_t   bt_csn;		/* cartridge serial number */
+	uint16_t bt_mbz;		/* unused; should be 0 */
+	uint16_t bt_flag;		/* -1 => alignment cartridge */
+	struct bt_bad {
+		uint16_t bt_cyl;	/* cylinder number of bad sector */
+		uint16_t bt_trksec;	/* track and sector number */
+	} bt_bad[NBT_BAD];
+};
+
+/*
+ * An indicator that the bad block handling is available. This is used
+ * to conditionally enable code that performs badblock re-mapping.
+ */
+#define	HAS_BAD144_HANDLING
+
+#define	ECC	0
+#define	SSE	1
+#define	BSE	2
+#define	CONT	3
+
+#ifdef _KERNEL
+int isbad(struct dkbad *, int, int, int);
+#endif
+#endif /* _SYS_DKBAD_H_ */

Property changes on: lab4/.minix-src/include/sys/dkbad.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/cdefs_aout.h
===================================================================
--- lab4/.minix-src/include/sys/cdefs_aout.h	(nonexistent)
+++ lab4/.minix-src/include/sys/cdefs_aout.h	(revision 13)
@@ -0,0 +1,125 @@
+/*	$NetBSD: cdefs_aout.h,v 1.20 2006/05/18 17:55:38 christos Exp $	*/
+
+/*
+ * Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
+ * Public domain.
+ */
+
+#ifndef _SYS_CDEFS_AOUT_H_
+#define	_SYS_CDEFS_AOUT_H_
+
+#define	_C_LABEL(x)		__CONCAT(_,x)
+#define	_C_LABEL_STRING(x)	"_"x
+
+#if __STDC__
+#define	___RENAME(x)	__asm(___STRING(_C_LABEL(x)))
+#else
+#define	___RENAME(x)	____RENAME(_/**/x)
+#define	____RENAME(x)	__asm(___STRING(x))
+#endif
+
+#define	__indr_reference(sym,alias)	/* nada, since we do weak refs */
+
+#ifdef __GNUC__
+#if __STDC__
+#define	__strong_alias(alias,sym)	       				\
+    __asm(".global " _C_LABEL_STRING(#alias) "\n"			\
+	    _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
+#define	__weak_alias(alias,sym)						\
+    __asm(".weak " _C_LABEL_STRING(#alias) "\n"			\
+	    _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
+
+/* Do not use __weak_extern, use __weak_reference instead */
+#define	__weak_extern(sym)						\
+    __asm(".weak " _C_LABEL_STRING(#sym));
+
+#if __GNUC_PREREQ__(4, 0)
+#define	__weak_reference(sym)	__attribute__((__weakref__))
+#else
+#define	__weak_reference(sym)	; __asm(".weak " _C_LABEL_STRING(#sym))
+#endif
+
+#define	__warn_references(sym,msg)					\
+	__asm(".stabs \"" msg "\",30,0,0,0");				\
+	__asm(".stabs \"_" #sym "\",1,0,0,0");
+#else /* __STDC__ */
+#define	__weak_alias(alias,sym) ___weak_alias(_/**/alias,_/**/sym)
+#define	___weak_alias(alias,sym)					\
+    __asm(".weak alias\nalias = sym");
+/* Do not use __weak_extern, use __weak_reference instead */
+#define	__weak_extern(sym) ___weak_extern(_/**/sym)
+#define	___weak_extern(sym)						\
+    __asm(".weak sym");
+
+#if __GNUC_PREREQ__(4, 0)
+#define	__weak_reference(sym)	__attribute__((__weakref__))
+#else
+#define	___weak_reference(sym)	; __asm(".weak sym");
+#define	__weak_reference(sym)	___weak_reference(_/**/sym)
+#endif
+
+#define	__warn_references(sym,msg)					\
+	__asm(".stabs msg,30,0,0,0");					\
+	__asm(".stabs \"_/**/sym\",1,0,0,0");
+#endif /* __STDC__ */
+#else /* __GNUC__ */
+#define	__warn_references(sym,msg)
+#endif /* __GNUC__ */
+
+#if defined(__sh__)		/* XXX SH COFF */
+#undef __indr_reference(sym,alias)
+#undef __warn_references(sym,msg)
+#define	__warn_references(sym,msg)
+#endif
+
+#define	__IDSTRING(_n,_s)						\
+	__asm(".data ; .asciz \"" _s "\" ; .text")
+
+#undef __KERNEL_RCSID
+
+#define	__RCSID(_s)	__IDSTRING(rcsid,_s)
+#define	__SCCSID(_s)
+#define	__SCCSID2(_s)
+#if 0	/* XXX userland __COPYRIGHTs have \ns in them */
+#define	__COPYRIGHT(_s)	__IDSTRING(copyright,_s)
+#else
+#define	__COPYRIGHT(_s)							\
+	static const char copyright[] __attribute__((__unused__)) = _s
+#endif
+
+#if defined(USE_KERNEL_RCSIDS) || !defined(_KERNEL)
+#define	__KERNEL_RCSID(_n,_s) __IDSTRING(__CONCAT(rcsid,_n),_s)
+#else
+#define	__KERNEL_RCSID(_n,_s)
+#endif
+#define	__KERNEL_SCCSID(_n,_s)
+#define	__KERNEL_COPYRIGHT(_n, _s) __IDSTRING(__CONCAT(copyright,_n),_s)
+
+#ifndef __lint__
+#define	__link_set_make_entry(set, sym, type)				\
+	static void const * const					\
+	    __link_set_##set##_sym_##sym __used = &sym;		\
+	__asm(".stabs \"___link_set_" #set "\", " #type ", 0, 0, _" #sym)
+#else
+#define	__link_set_make_entry(set, sym, type)				\
+	extern void const * const __link_set_##set##_sym_##sym
+#endif /* __lint__ */
+
+#define	__link_set_add_text(set, sym)	__link_set_make_entry(set, sym, 23)
+#define	__link_set_add_rodata(set, sym)	__link_set_make_entry(set, sym, 23)
+#define	__link_set_add_data(set, sym)	__link_set_make_entry(set, sym, 25)
+#define	__link_set_add_bss(set, sym)	__link_set_make_entry(set, sym, 27)
+
+#define	__link_set_decl(set, ptype)					\
+extern struct {								\
+	int	__ls_length;						\
+	ptype	*__ls_items[1];						\
+} __link_set_##set
+
+#define	__link_set_start(set)	(&(__link_set_##set).__ls_items[0])
+#define	__link_set_end(set)						\
+	(&(__link_set_##set).__ls_items[(__link_set_##set).__ls_length])
+
+#define	__link_set_count(set)	((__link_set_##set).__ls_length)
+
+#endif /* !_SYS_CDEFS_AOUT_H_ */

Property changes on: lab4/.minix-src/include/sys/cdefs_aout.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/device.h
===================================================================
--- lab4/.minix-src/include/sys/device.h	(nonexistent)
+++ lab4/.minix-src/include/sys/device.h	(revision 13)
@@ -0,0 +1,576 @@
+/* $NetBSD: device.h,v 1.147 2015/03/06 09:28:15 mrg Exp $ */
+
+/*
+ * Copyright (c) 1996, 2000 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *          This product includes software developed for the
+ *          NetBSD Project.  See http://www.NetBSD.org/ for
+ *          information about NetBSD.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ *
+ * --(license Id: LICENSE.proto,v 1.1 2000/06/13 21:40:26 cgd Exp )--
+ */
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Lawrence Berkeley Laboratories.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)device.h	8.2 (Berkeley) 2/17/94
+ */
+
+#ifndef _SYS_DEVICE_H_
+#define	_SYS_DEVICE_H_
+
+#include <sys/device_if.h>
+#include <sys/evcnt.h>
+#include <sys/queue.h>
+
+#ifdef _KERNEL
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+#include <sys/pmf.h>
+#endif
+
+#include <prop/proplib.h>
+
+/*
+ * Minimal device structures.
+ * Note that all ``system'' device types are listed here.
+ */
+typedef enum devclass {
+	DV_DULL,		/* generic, no special info */
+	DV_CPU,			/* CPU (carries resource utilization) */
+	DV_DISK,		/* disk drive (label, etc) */
+	DV_IFNET,		/* network interface */
+	DV_TAPE,		/* tape device */
+	DV_TTY,			/* serial line interface (?) */
+	DV_AUDIODEV,		/* audio device */
+	DV_DISPLAYDEV,		/* display device */
+	DV_BUS,			/* bus device */
+	DV_VIRTUAL,		/* unbacked virtual device */
+} devclass_t;
+
+/*
+ * Actions for ca_activate.
+ */
+typedef enum devact {
+	DVACT_DEACTIVATE	/* deactivate the device */
+} devact_t;
+
+typedef enum {
+	DVA_SYSTEM,
+	DVA_HARDWARE
+} devactive_t;
+
+typedef struct cfdata *cfdata_t;
+typedef struct cfdriver *cfdriver_t;
+typedef struct cfattach *cfattach_t;
+
+#ifdef _KERNEL
+struct device_lock {
+	int		dvl_nwait;
+	int		dvl_nlock;
+	lwp_t		*dvl_holder;
+	kmutex_t	dvl_mtx;
+	kcondvar_t	dvl_cv;
+};
+
+struct device_suspensor {
+	const device_suspensor_t	*ds_delegator;
+	char				ds_name[32];
+};
+
+#define	DEVICE_SUSPENSORS_MAX	16
+
+struct device_garbage {
+	device_t	*dg_devs;
+	int		dg_ndevs;
+};
+
+struct device {
+	devclass_t	dv_class;	/* this device's classification */
+	TAILQ_ENTRY(device) dv_list;	/* entry on list of all devices */
+	cfdata_t	dv_cfdata;	/* config data that found us
+					   (NULL if pseudo-device) */
+	cfdriver_t	dv_cfdriver;	/* our cfdriver */
+	cfattach_t	dv_cfattach;	/* our cfattach */
+	int		dv_unit;	/* device unit number */
+	char		dv_xname[16];	/* external name (name + unit) */
+	device_t	dv_parent;	/* pointer to parent device
+					   (NULL if pseudo- or root node) */
+	int		dv_depth;	/* number of parents until root */
+	int		dv_flags;	/* misc. flags; see below */
+	void		*dv_private;	/* this device's private storage */
+	int		*dv_locators;	/* our actual locators (optional) */
+	prop_dictionary_t dv_properties;/* properties dictionary */
+
+	size_t		dv_activity_count;
+	void		(**dv_activity_handlers)(device_t, devactive_t);
+
+	bool		(*dv_driver_suspend)(device_t, const pmf_qual_t *);
+	bool		(*dv_driver_resume)(device_t, const pmf_qual_t *);
+	bool		(*dv_driver_shutdown)(device_t, int);
+	bool		(*dv_driver_child_register)(device_t);
+
+	void		*dv_bus_private;
+	bool		(*dv_bus_suspend)(device_t, const pmf_qual_t *);
+	bool		(*dv_bus_resume)(device_t, const pmf_qual_t *);
+	bool		(*dv_bus_shutdown)(device_t, int);
+	void		(*dv_bus_deregister)(device_t);
+
+	void		*dv_class_private;
+	bool		(*dv_class_suspend)(device_t, const pmf_qual_t *);
+	bool		(*dv_class_resume)(device_t, const pmf_qual_t *);
+	void		(*dv_class_deregister)(device_t);
+
+	devgen_t		dv_add_gen,
+				dv_del_gen;
+
+	struct device_lock	dv_lock;
+	const device_suspensor_t
+	    *dv_bus_suspensors[DEVICE_SUSPENSORS_MAX],
+	    *dv_driver_suspensors[DEVICE_SUSPENSORS_MAX],
+	    *dv_class_suspensors[DEVICE_SUSPENSORS_MAX];
+	struct device_garbage dv_garbage;
+};
+
+/* dv_flags */
+#define	DVF_ACTIVE		0x0001	/* device is activated */
+#define	DVF_PRIV_ALLOC		0x0002	/* device private storage != device */
+#define	DVF_POWER_HANDLERS	0x0004	/* device has suspend/resume support */
+#define	DVF_CLASS_SUSPENDED	0x0008	/* device class suspend was called */
+#define	DVF_DRIVER_SUSPENDED	0x0010	/* device driver suspend was called */
+#define	DVF_BUS_SUSPENDED	0x0020	/* device bus suspend was called */
+#define	DVF_DETACH_SHUTDOWN	0x0080	/* device detaches safely at shutdown */
+
+TAILQ_HEAD(devicelist, device);
+
+enum deviter_flags {
+	  DEVITER_F_RW =		0x1
+	, DEVITER_F_SHUTDOWN =		0x2
+	, DEVITER_F_LEAVES_FIRST =	0x4
+	, DEVITER_F_ROOT_FIRST =	0x8
+};
+
+typedef enum deviter_flags deviter_flags_t;
+
+struct deviter {
+	device_t	di_prev;
+	deviter_flags_t	di_flags;
+	int		di_curdepth;
+	int		di_maxdepth;
+	devgen_t	di_gen;
+};
+
+typedef struct deviter deviter_t;
+
+struct shutdown_state {
+	bool initialized;
+	deviter_t di;
+};
+#endif
+
+/*
+ * Description of a locator, as part of interface attribute definitions.
+ */
+struct cflocdesc {
+	const char *cld_name;
+	const char *cld_defaultstr; /* NULL if no default */
+	int cld_default;
+};
+
+/*
+ * Description of an interface attribute, provided by potential
+ * parent device drivers, referred to by child device configuration data.
+ */
+struct cfiattrdata {
+	const char *ci_name;
+	int ci_loclen;
+	const struct cflocdesc ci_locdesc[
+#if defined(__GNUC__) && __GNUC__ <= 2
+		0
+#endif
+	];
+};
+
+/*
+ * Description of a configuration parent.  Each device attachment attaches
+ * to an "interface attribute", which is given in this structure.  The parent
+ * *must* carry this attribute.  Optionally, an individual device instance
+ * may also specify a specific parent device instance.
+ */
+struct cfparent {
+	const char *cfp_iattr;		/* interface attribute */
+	const char *cfp_parent;		/* optional specific parent */
+	int cfp_unit;			/* optional specific unit
+					   (DVUNIT_ANY to wildcard) */
+};
+
+/*
+ * Configuration data (i.e., data placed in ioconf.c).
+ */
+struct cfdata {
+	const char *cf_name;		/* driver name */
+	const char *cf_atname;		/* attachment name */
+	short	cf_unit;		/* unit number */
+	short	cf_fstate;		/* finding state (below) */
+	int	*cf_loc;		/* locators (machine dependent) */
+	int	cf_flags;		/* flags from config */
+	const struct cfparent *cf_pspec;/* parent specification */
+};
+#define FSTATE_NOTFOUND		0	/* has not been found */
+#define	FSTATE_FOUND		1	/* has been found */
+#define	FSTATE_STAR		2	/* duplicable */
+#define FSTATE_DSTAR		3	/* has not been found, and disabled */
+#define FSTATE_DNOTFOUND	4	/* duplicate, and disabled */
+
+/*
+ * Multiple configuration data tables may be maintained.  This structure
+ * provides the linkage.
+ */
+struct cftable {
+	cfdata_t	ct_cfdata;	/* pointer to cfdata table */
+	TAILQ_ENTRY(cftable) ct_list;	/* list linkage */
+};
+TAILQ_HEAD(cftablelist, cftable);
+
+typedef int (*cfsubmatch_t)(device_t, cfdata_t, const int *, void *);
+
+/*
+ * `configuration' attachment and driver (what the machine-independent
+ * autoconf uses).  As devices are found, they are applied against all
+ * the potential matches.  The one with the best match is taken, and a
+ * device structure (plus any other data desired) is allocated.  Pointers
+ * to these are placed into an array of pointers.  The array itself must
+ * be dynamic since devices can be found long after the machine is up
+ * and running.
+ *
+ * Devices can have multiple configuration attachments if they attach
+ * to different attributes (busses, or whatever), to allow specification
+ * of multiple match and attach functions.  There is only one configuration
+ * driver per driver, so that things like unit numbers and the device
+ * structure array will be shared.
+ */
+struct cfattach {
+	const char *ca_name;		/* name of attachment */
+	LIST_ENTRY(cfattach) ca_list;	/* link on cfdriver's list */
+	size_t	  ca_devsize;		/* size of dev data (for alloc) */
+	int	  ca_flags;		/* flags for driver allocation etc */
+	int	(*ca_match)(device_t, cfdata_t, void *);
+	void	(*ca_attach)(device_t, device_t, void *);
+	int	(*ca_detach)(device_t, int);
+	int	(*ca_activate)(device_t, devact_t);
+	/* technically, the next 2 belong into "struct cfdriver" */
+	int	(*ca_rescan)(device_t, const char *,
+			     const int *); /* scan for new children */
+	void	(*ca_childdetached)(device_t, device_t);
+};
+LIST_HEAD(cfattachlist, cfattach);
+
+#define	CFATTACH_DECL3_NEW(name, ddsize, matfn, attfn, detfn, actfn, \
+	rescanfn, chdetfn, __flags) \
+struct cfattach __CONCAT(name,_ca) = {					\
+	.ca_name		= ___STRING(name),			\
+	.ca_devsize		= ddsize,				\
+	.ca_flags		= (__flags) | DVF_PRIV_ALLOC,		\
+	.ca_match 		= matfn,				\
+	.ca_attach		= attfn,				\
+	.ca_detach		= detfn,				\
+	.ca_activate		= actfn,				\
+	.ca_rescan		= rescanfn,				\
+	.ca_childdetached	= chdetfn,				\
+}
+
+#define	CFATTACH_DECL2_NEW(name, ddsize, matfn, attfn, detfn, actfn,	\
+	rescanfn, chdetfn)						\
+	CFATTACH_DECL3_NEW(name, ddsize, matfn, attfn, detfn, actfn,	\
+	    rescanfn, chdetfn, 0)
+
+#define	CFATTACH_DECL_NEW(name, ddsize, matfn, attfn, detfn, actfn)	\
+	CFATTACH_DECL2_NEW(name, ddsize, matfn, attfn, detfn, actfn, NULL, NULL)
+
+/* Flags given to config_detach(), and the ca_detach function. */
+#define	DETACH_FORCE	0x01		/* force detachment; hardware gone */
+#define	DETACH_QUIET	0x02		/* don't print a notice */
+#define	DETACH_SHUTDOWN	0x04		/* detach because of system shutdown */
+
+struct cfdriver {
+	LIST_ENTRY(cfdriver) cd_list;	/* link on allcfdrivers */
+	struct cfattachlist cd_attach;	/* list of all attachments */
+	device_t *cd_devs;		/* devices found */
+	const char *cd_name;		/* device name */
+	enum	devclass cd_class;	/* device classification */
+	int	cd_ndevs;		/* size of cd_devs array */
+	const struct cfiattrdata * const *cd_attrs; /* attributes provided */
+};
+LIST_HEAD(cfdriverlist, cfdriver);
+
+#define	CFDRIVER_DECL(name, class, attrs)				\
+struct cfdriver __CONCAT(name,_cd) = {					\
+	.cd_name		= ___STRING(name),			\
+	.cd_class		= class,				\
+	.cd_attrs		= attrs,				\
+}
+
+/*
+ * The cfattachinit is a data structure used to associate a list of
+ * cfattach's with cfdrivers as found in the static kernel configuration.
+ */
+struct cfattachinit {
+	const char *cfai_name;		 /* driver name */
+	struct cfattach * const *cfai_list;/* list of attachments */
+};
+/*
+ * the same, but with a non-constant list so it can be modified
+ * for module bookkeeping
+ */
+struct cfattachlkminit {
+	const char *cfai_name;		/* driver name */
+	struct cfattach **cfai_list;	/* list of attachments */
+};
+
+/*
+ * Configuration printing functions, and their return codes.  The second
+ * argument is NULL if the device was configured; otherwise it is the name
+ * of the parent device.  The return value is ignored if the device was
+ * configured, so most functions can return UNCONF unconditionally.
+ */
+typedef int (*cfprint_t)(void *, const char *);		/* XXX const char * */
+#define	QUIET	0		/* print nothing */
+#define	UNCONF	1		/* print " not configured\n" */
+#define	UNSUPP	2		/* print " not supported\n" */
+
+/*
+ * Pseudo-device attach information (function + number of pseudo-devs).
+ */
+struct pdevinit {
+	void	(*pdev_attach)(int);
+	int	pdev_count;
+};
+
+/* This allows us to wildcard a device unit. */
+#define	DVUNIT_ANY	-1
+
+#ifdef _KERNEL
+
+extern struct cfdriverlist allcfdrivers;/* list of all cfdrivers */
+extern struct cftablelist allcftables;	/* list of all cfdata tables */
+extern device_t booted_device;		/* the device we booted from */
+extern int booted_partition;		/* the partition on that device */
+extern daddr_t booted_startblk;		/* or the start of a wedge */
+extern uint64_t booted_nblks;		/* and the size of that wedge */
+extern char *bootspec;			/* and the device/wedge name */
+
+struct vnode *opendisk(device_t);
+int getdisksize(struct vnode *, uint64_t *, unsigned int *);
+struct dkwedge_info;
+int getdiskinfo(struct vnode *, struct dkwedge_info *);
+
+void	config_init(void);
+int	config_init_component(struct cfdriver *const*,
+			      const struct cfattachinit *, struct cfdata *);
+int	config_fini_component(struct cfdriver *const*,
+			      const struct cfattachinit *, struct cfdata *);
+void	config_init_mi(void);
+void	drvctl_init(void);
+
+int	config_cfdriver_attach(struct cfdriver *);
+int	config_cfdriver_detach(struct cfdriver *);
+
+int	config_cfattach_attach(const char *, struct cfattach *);
+int	config_cfattach_detach(const char *, struct cfattach *);
+
+int	config_cfdata_attach(cfdata_t, int);
+int	config_cfdata_detach(cfdata_t);
+
+struct cfdriver *config_cfdriver_lookup(const char *);
+struct cfattach *config_cfattach_lookup(const char *, const char *);
+const struct cfiattrdata *cfiattr_lookup(const char *, const struct cfdriver *);
+
+const char *cfdata_ifattr(const struct cfdata *);
+
+int	config_stdsubmatch(device_t, cfdata_t, const int *, void *);
+cfdata_t config_search_loc(cfsubmatch_t, device_t,
+				 const char *, const int *, void *);
+cfdata_t config_search_ia(cfsubmatch_t, device_t,
+				 const char *, void *);
+cfdata_t config_rootsearch(cfsubmatch_t, const char *, void *);
+device_t config_found_sm_loc(device_t, const char *, const int *,
+			     void *, cfprint_t, cfsubmatch_t);
+device_t config_found_ia(device_t, const char *, void *, cfprint_t);
+device_t config_found(device_t, void *, cfprint_t);
+device_t config_rootfound(const char *, void *);
+device_t config_attach_loc(device_t, cfdata_t, const int *, void *, cfprint_t);
+device_t config_attach(device_t, cfdata_t, void *, cfprint_t);
+int	config_match(device_t, cfdata_t, void *);
+
+bool ifattr_match(const char *, const char *);
+
+device_t config_attach_pseudo(cfdata_t);
+
+int	config_detach(device_t, int);
+int	config_detach_children(device_t, int flags);
+bool	config_detach_all(int);
+int	config_deactivate(device_t);
+void	config_defer(device_t, void (*)(device_t));
+void	config_deferred(device_t);
+void	config_interrupts(device_t, void (*)(device_t));
+void	config_mountroot(device_t, void (*)(device_t));
+void	config_pending_incr(device_t);
+void	config_pending_decr(device_t);
+void	config_create_interruptthreads(void);
+void	config_create_mountrootthreads(void);
+
+int	config_finalize_register(device_t, int (*)(device_t));
+void	config_finalize(void);
+void	config_finalize_mountroot(void);
+
+void	config_twiddle_init(void);
+void	config_twiddle_fn(void *);
+
+void	null_childdetached(device_t, device_t);
+
+device_t	device_lookup(cfdriver_t, int);
+void		*device_lookup_private(cfdriver_t, int);
+void		device_register(device_t, void *);
+void		device_register_post_config(device_t, void *);
+
+devclass_t	device_class(device_t);
+cfdata_t	device_cfdata(device_t);
+cfdriver_t	device_cfdriver(device_t);
+cfattach_t	device_cfattach(device_t);
+int		device_unit(device_t);
+const char	*device_xname(device_t);
+device_t	device_parent(device_t);
+bool		device_is_active(device_t);
+bool		device_activation(device_t, devact_level_t);
+bool		device_is_enabled(device_t);
+bool		device_has_power(device_t);
+int		device_locator(device_t, u_int);
+void		*device_private(device_t);
+prop_dictionary_t device_properties(device_t);
+
+device_t	deviter_first(deviter_t *, deviter_flags_t);
+void		deviter_init(deviter_t *, deviter_flags_t);
+device_t	deviter_next(deviter_t *);
+void		deviter_release(deviter_t *);
+
+bool		device_active(device_t, devactive_t);
+bool		device_active_register(device_t,
+				       void (*)(device_t, devactive_t));
+void		device_active_deregister(device_t,
+				         void (*)(device_t, devactive_t));
+
+bool		device_is_a(device_t, const char *);
+
+device_t	device_find_by_xname(const char *);
+device_t	device_find_by_driver_unit(const char *, int);
+
+bool		device_pmf_is_registered(device_t);
+
+bool		device_pmf_driver_suspend(device_t, const pmf_qual_t *);
+bool		device_pmf_driver_resume(device_t, const pmf_qual_t *);
+bool		device_pmf_driver_shutdown(device_t, int);
+
+bool		device_pmf_driver_register(device_t,
+		    bool (*)(device_t, const pmf_qual_t *),
+		    bool (*)(device_t, const pmf_qual_t *),
+		    bool (*)(device_t, int));
+void		device_pmf_driver_deregister(device_t);
+
+bool		device_pmf_driver_child_register(device_t);
+void		device_pmf_driver_set_child_register(device_t,
+		    bool (*)(device_t));
+
+void		*device_pmf_bus_private(device_t);
+bool		device_pmf_bus_suspend(device_t, const pmf_qual_t *);
+bool		device_pmf_bus_resume(device_t, const pmf_qual_t *);
+bool		device_pmf_bus_shutdown(device_t, int);
+
+device_lock_t	device_getlock(device_t);
+void		device_pmf_unlock(device_t);
+bool		device_pmf_lock(device_t);
+
+bool		device_is_self_suspended(device_t);
+void		device_pmf_self_suspend(device_t, const pmf_qual_t *);
+void		device_pmf_self_resume(device_t, const pmf_qual_t *);
+bool		device_pmf_self_wait(device_t, const pmf_qual_t *);
+
+void		device_pmf_bus_register(device_t, void *,
+		    bool (*)(device_t, const pmf_qual_t *),
+		    bool (*)(device_t, const pmf_qual_t *),
+		    bool (*)(device_t, int),
+		    void (*)(device_t));
+void		device_pmf_bus_deregister(device_t);
+
+void		*device_pmf_class_private(device_t);
+bool		device_pmf_class_suspend(device_t, const pmf_qual_t *);
+bool		device_pmf_class_resume(device_t, const pmf_qual_t *);
+
+void		device_pmf_class_register(device_t, void *,
+		    bool (*)(device_t, const pmf_qual_t *),
+		    bool (*)(device_t, const pmf_qual_t *),
+		    void (*)(device_t));
+void		device_pmf_class_deregister(device_t);
+
+device_t	shutdown_first(struct shutdown_state *);
+device_t	shutdown_next(struct shutdown_state *);
+#endif /* _KERNEL */
+
+#endif /* !_SYS_DEVICE_H_ */

Property changes on: lab4/.minix-src/include/sys/device.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/drvctlio.h
===================================================================
--- lab4/.minix-src/include/sys/drvctlio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/drvctlio.h	(revision 13)
@@ -0,0 +1,130 @@
+/* $NetBSD: drvctlio.h,v 1.7 2008/05/31 13:24:57 freza Exp $ */
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* This interface is experimental and may change. */
+
+#ifndef _SYS_DRVCTLIO_H_ 
+#define _SYS_DRVCTLIO_H_ 
+
+#include <prop/proplib.h>
+#include <sys/ioccom.h>
+
+#define DRVCTLDEV "/dev/drvctl"
+
+struct devdetachargs {
+	char devname[16];
+};
+
+struct devlistargs {
+	char l_devname[16];
+	char (*l_childname)[16];
+	size_t l_children;
+};
+
+enum devpmflags {
+	DEVPM_F_SUBTREE = 0x1
+};
+
+struct devpmargs {
+	char devname[16];
+	uint32_t flags;
+};
+
+struct devrescanargs {
+	char busname[16];
+	char ifattr[16];
+	unsigned int numlocators;
+	int *locators;
+};
+
+#define DRVDETACHDEV _IOW('D', 123, struct devdetachargs)
+#define DRVRESCANBUS _IOW('D', 124, struct devrescanargs)
+#define	DRVCTLCOMMAND _IOWR('D', 125, struct plistref)
+#define DRVRESUMEDEV _IOW('D', 126, struct devpmargs)
+#define DRVLISTDEV _IOWR('D', 127, struct devlistargs)
+#define DRVGETEVENT _IOR('D', 128, struct plistref)
+#define DRVSUSPENDDEV _IOW('D', 129, struct devpmargs)
+
+/*
+ * DRVCTLCOMMAND documentation
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * Generic ioctl that takes a dictionary as an argument (specifies the
+ * command and arguments) and returns a dictionary with the results.
+ *
+ * Command arguments are structured like so:
+ *
+ * <dict>
+ *	<key>drvctl-command</key>
+ *	<string>...</string>
+ *	<!-- optional arguments -->
+ *	<key>drvctl-arguments</key>
+ *	<dict>
+ *		<!-- arguments vary with command -->
+ *	</dict>
+ * </dict>
+ *
+ * Results are returned like so:
+ *
+ * <dict>
+ *	<key>drvctl-error</key>
+ *	<!-- 0 == success, otherwise an errno value -->
+ *	<integer>...</integer>
+ *	<!-- optional additional error message -->
+ *	<key>drvctl-error-message</key>
+ *	<string>...</string>
+ *	<!-- optional results dictionary -->
+ *	<key>drvctl-result-data</key>
+ *	<dict>
+ *		<!-- results vary with command -->
+ *	</dict>
+ * </dict>
+ *
+ *
+ * Commands recognized by DRVCTLCOMMAND
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * get-properties
+ *
+ * Arguments:
+ *
+ *	<dict>
+ *		<key>device-name</key>
+ *		<string>...</string>
+ *	</dict>
+ *
+ * Results:
+ *	<dict>
+ *		<!-- contents of device's properties dictionary -->
+ *	</dict>
+ */
+
+#endif /* _SYS_DRVCTLIO_H_ */

Property changes on: lab4/.minix-src/include/sys/drvctlio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/clock.h
===================================================================
--- lab4/.minix-src/include/sys/clock.h	(nonexistent)
+++ lab4/.minix-src/include/sys/clock.h	(revision 13)
@@ -0,0 +1,89 @@
+/*	$NetBSD: clock.h,v 1.3 2014/11/17 17:11:29 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Gordon W. Ross
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_CLOCK_H_
+#define _SYS_CLOCK_H_
+
+/* Some handy constants. */
+#define SECS_PER_MINUTE		60
+#define SECS_PER_HOUR		3600
+#define SECS_PER_DAY		86400
+#define DAYS_PER_COMMON_YEAR    365
+#define DAYS_PER_LEAP_YEAR      366
+#define SECS_PER_COMMON_YEAR	(SECS_PER_DAY * DAYS_PER_COMMON_YEAR)
+#define SECS_PER_LEAP_YEAR	(SECS_PER_DAY * DAYS_PER_LEAP_YEAR)
+
+/* Traditional POSIX base year */
+#define	POSIX_BASE_YEAR	1970
+
+/* Some handy functions */
+static inline int
+days_in_month(int m)
+{
+	switch (m) {
+	case 2:
+		return 28;
+	case 4: case 6: case 9: case 11:
+		return 30;
+	case 1: case 3: case 5: case 7: case 8: case 10: case 12:
+		return 31;
+	default:
+		return -1;
+	}
+}
+
+/*
+ * This inline avoids some unnecessary modulo operations
+ * as compared with the usual macro:
+ *   ( ((year % 4) == 0 &&
+ *      (year % 100) != 0) ||
+ *     ((year % 400) == 0) )
+ * It is otherwise equivalent.
+ */
+static inline int
+is_leap_year(uint64_t year)
+{
+	if ((year & 3) != 0)
+		return 0;
+
+	if (__predict_false((year % 100) != 0))
+		return 1;
+
+	return __predict_false((year % 400) == 0);
+}
+
+static inline int
+days_per_year(uint64_t year)
+{
+	return is_leap_year(year) ? DAYS_PER_LEAP_YEAR : DAYS_PER_COMMON_YEAR;
+}
+
+#endif /* _SYS_CLOCK_H_ */

Property changes on: lab4/.minix-src/include/sys/clock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/elf_core.h
===================================================================
--- lab4/.minix-src/include/sys/elf_core.h	(nonexistent)
+++ lab4/.minix-src/include/sys/elf_core.h	(revision 13)
@@ -0,0 +1,50 @@
+/*
+ * This file mainly provides a definition of the structures used
+ * to describe the notes section of an ELF file.
+ *
+ * It is the interface between MINIX core dump and GDB
+ */
+
+#ifndef _SYS_ELF_CORE_H_
+#define _SYS_ELF_CORE_H_
+
+#include <sys/param.h>
+#include <machine/stackframe.h>
+
+/* MINIX core file format:
+ *
+ * The core file is in ELF format. Besides the regular program segments,
+ * it has a NOTE segment which contains two NOTE entries
+ * - one containing a minix_elfcore_info_t and the other one containing
+ * the general purpose registers (a stackframe_s structure)
+ */
+
+typedef struct stackframe_s gregset_t; /* General purpose registers */
+
+/*
+ * A lot more things should be added to these structures.  At present,
+ * they contain the absolute bare minimum required to allow GDB to work
+ * with MINIX ELF core dumps.
+ */
+
+#define ELF_NOTE_MINIX_ELFCORE_NAME	"MINIX-CORE"
+#define NT_MINIX_ELFCORE_INFO		1
+#define NT_MINIX_ELFCORE_GREGS		2
+
+#define MINIX_ELFCORE_VERSION		1  /* Current version of minix_elfcore_info_t */
+#define RESERVED_SIZE                   5
+
+typedef struct minix_elfcore_info {
+  /* Version 1 fields */
+  uint32_t	mei_version;		/* Version number of struct */
+  uint32_t	mei_meisize;		/* sizeof(minix_elfcore_info_t) */
+  uint32_t	mei_signo;		/* killing signal */
+  int32_t	mei_pid;		/* Process ID */
+  int8_t        mei_command[MAXCOMLEN]; /* Command */
+  uint32_t      flags;                  /* Flags */
+  int32_t       reserved[RESERVED_SIZE];/* Reserved space*/
+  /* Put below version 2 fields */
+} minix_elfcore_info_t;
+
+#endif /* _SYS_ELF_CORE_H_ */
+

Property changes on: lab4/.minix-src/include/sys/elf_core.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/common_int_fmtio.h
===================================================================
--- lab4/.minix-src/include/sys/common_int_fmtio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/common_int_fmtio.h	(revision 13)
@@ -0,0 +1,230 @@
+/*	$NetBSD: common_int_fmtio.h,v 1.1 2014/07/25 21:43:13 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_COMMON_INT_FMTIO_H_
+#define _SYS_COMMON_INT_FMTIO_H_
+
+#ifndef __INTPTR_FMTd__
+#error Your compiler does not provide format string macros.
+#endif
+
+/*
+ * 7.8.1 Macros for format specifiers
+ */
+
+/* fprintf macros for signed integers */
+#define	PRId8		__INT8_FMTd__
+#define	PRId16		__INT16_FMTd__
+#define	PRId32		__INT32_FMTd__
+#define	PRId64		__INT64_FMTd__
+#define	PRIdLEAST8	__INT_LEAST8_FMTd__
+#define	PRIdLEAST16	__INT_LEAST16_FMTd__
+#define	PRIdLEAST32	__INT_LEAST32_FMTd__
+#define	PRIdLEAST64	__INT_LEAST64_FMTd__
+#define	PRIdFAST8	__INT_FAST8_FMTd__
+#define	PRIdFAST16	__INT_FAST16_FMTd__
+#define	PRIdFAST32	__INT_FAST32_FMTd__
+#define	PRIdFAST64	__INT_FAST64_FMTd__
+#define	PRIdMAX		__INTMAX_FMTd__
+#define	PRIdPTR		__INTPTR_FMTd__
+
+#define	PRIi8		__INT8_FMTi__
+#define	PRIi16		__INT16_FMTi__
+#define	PRIi32		__INT32_FMTi__
+#define	PRIi64		__INT64_FMTi__
+#define	PRIiLEAST8	__INT_LEAST8_FMTi__
+#define	PRIiLEAST16	__INT_LEAST16_FMTi__
+#define	PRIiLEAST32	__INT_LEAST32_FMTi__
+#define	PRIiLEAST64	__INT_LEAST64_FMTi__
+#define	PRIiFAST8	__INT_FAST8_FMTi__
+#define	PRIiFAST16	__INT_FAST16_FMTi__
+#define	PRIiFAST32	__INT_FAST32_FMTi__
+#define	PRIiFAST64	__INT_FAST64_FMTi__
+#define	PRIiMAX		__INTMAX_FMTi__
+#define	PRIiPTR		__INTPTR_FMTi__
+
+/* fprintf macros for unsigned integers */
+
+#define	PRIo8		__UINT8_FMTo__
+#define	PRIo16		__UINT16_FMTo__
+#define	PRIo32		__UINT32_FMTo__
+#define	PRIo64		__UINT64_FMTo__
+#define	PRIoLEAST8	__UINT_LEAST8_FMTo__
+#define	PRIoLEAST16	__UINT_LEAST16_FMTo__
+#define	PRIoLEAST32	__UINT_LEAST32_FMTo__
+#define	PRIoLEAST64	__UINT_LEAST64_FMTo__
+#define	PRIoFAST8	__UINT_FAST8_FMTo__
+#define	PRIoFAST16	__UINT_FAST16_FMTo__
+#define	PRIoFAST32	__UINT_FAST32_FMTo__
+#define	PRIoFAST64	__UINT_FAST64_FMTo__
+#define	PRIoMAX		__UINTMAX_FMTo__
+#define	PRIoPTR		__UINTPTR_FMTo__
+
+#define	PRIu8		__UINT8_FMTu__
+#define	PRIu16		__UINT16_FMTu__
+#define	PRIu32		__UINT32_FMTu__
+#define	PRIu64		__UINT64_FMTu__
+#define	PRIuLEAST8	__UINT_LEAST8_FMTu__
+#define	PRIuLEAST16	__UINT_LEAST16_FMTu__
+#define	PRIuLEAST32	__UINT_LEAST32_FMTu__
+#define	PRIuLEAST64	__UINT_LEAST64_FMTu__
+#define	PRIuFAST8	__UINT_FAST8_FMTu__
+#define	PRIuFAST16	__UINT_FAST16_FMTu__
+#define	PRIuFAST32	__UINT_FAST32_FMTu__
+#define	PRIuFAST64	__UINT_FAST64_FMTu__
+#define	PRIuMAX		__UINTMAX_FMTu__
+#define	PRIuPTR		__UINTPTR_FMTu__
+
+#define	PRIx8		__UINT8_FMTx__
+#define	PRIx16		__UINT16_FMTx__
+#define	PRIx32		__UINT32_FMTx__
+#define	PRIx64		__UINT64_FMTx__
+#define	PRIxLEAST8	__UINT_LEAST8_FMTx__
+#define	PRIxLEAST16	__UINT_LEAST16_FMTx__
+#define	PRIxLEAST32	__UINT_LEAST32_FMTx__
+#define	PRIxLEAST64	__UINT_LEAST64_FMTx__
+#define	PRIxFAST8	__UINT_FAST8_FMTx__
+#define	PRIxFAST16	__UINT_FAST16_FMTx__
+#define	PRIxFAST32	__UINT_FAST32_FMTx__
+#define	PRIxFAST64	__UINT_FAST64_FMTx__
+#define	PRIxMAX		__UINTMAX_FMTx__
+#define	PRIxPTR		__UINTPTR_FMTx__
+
+#define	PRIX8		__UINT8_FMTX__
+#define	PRIX16		__UINT16_FMTX__
+#define	PRIX32		__UINT32_FMTX__
+#define	PRIX64		__UINT64_FMTX__
+#define	PRIXLEAST8	__UINT_LEAST8_FMTX__
+#define	PRIXLEAST16	__UINT_LEAST16_FMTX__
+#define	PRIXLEAST32	__UINT_LEAST32_FMTX__
+#define	PRIXLEAST64	__UINT_LEAST64_FMTX__
+#define	PRIXFAST8	__UINT_FAST8_FMTX__
+#define	PRIXFAST16	__UINT_FAST16_FMTX__
+#define	PRIXFAST32	__UINT_FAST32_FMTX__
+#define	PRIXFAST64	__UINT_FAST64_FMTX__
+#define	PRIXMAX		__UINTMAX_FMTX__
+#define	PRIXPTR		__UINTPTR_FMTX__
+
+/* fscanf macros for signed integers */
+
+#define	SCNd8		__INT8_FMTd__
+#define	SCNd16		__INT16_FMTd__
+#define	SCNd32		__INT32_FMTd__
+#define	SCNd64		__INT64_FMTd__
+#define	SCNdLEAST8	__INT_LEAST8_FMTd__
+#define	SCNdLEAST16	__INT_LEAST16_FMTd__
+#define	SCNdLEAST32	__INT_LEAST32_FMTd__
+#define	SCNdLEAST64	__INT_LEAST64_FMTd__
+#define	SCNdFAST8	__INT_FAST8_FMTd__
+#define	SCNdFAST16	__INT_FAST16_FMTd__
+#define	SCNdFAST32	__INT_FAST32_FMTd__
+#define	SCNdFAST64	__INT_FAST64_FMTd__
+#define	SCNdMAX		__INTMAX_FMTd__
+#define	SCNdPTR		__INTPTR_FMTd__
+
+#define	SCNi8		__INT8_FMTi__
+#define	SCNi16		__INT16_FMTi__
+#define	SCNi32		__INT32_FMTi__
+#define	SCNi64		__INT64_FMTi__
+#define	SCNiLEAST8	__INT_LEAST8_FMTi__
+#define	SCNiLEAST16	__INT_LEAST16_FMTi__
+#define	SCNiLEAST32	__INT_LEAST32_FMTi__
+#define	SCNiLEAST64	__INT_LEAST64_FMTi__
+#define	SCNiFAST8	__INT_FAST8_FMTi__
+#define	SCNiFAST16	__INT_FAST16_FMTi__
+#define	SCNiFAST32	__INT_FAST32_FMTi__
+#define	SCNiFAST64	__INT_FAST64_FMTi__
+#define	SCNiMAX		__INTMAX_FMTi__
+#define	SCNiPTR		__INTPTR_FMTi__
+
+/* fscanf macros for unsigned integers */
+
+#define	SCNo8		__UINT8_FMTo__
+#define	SCNo16		__UINT16_FMTo__
+#define	SCNo32		__UINT32_FMTo__
+#define	SCNo64		__UINT64_FMTo__
+#define	SCNoLEAST8	__UINT_LEAST8_FMTo__
+#define	SCNoLEAST16	__UINT_LEAST16_FMTo__
+#define	SCNoLEAST32	__UINT_LEAST32_FMTo__
+#define	SCNoLEAST64	__UINT_LEAST64_FMTo__
+#define	SCNoFAST8	__UINT_FAST8_FMTo__
+#define	SCNoFAST16	__UINT_FAST16_FMTo__
+#define	SCNoFAST32	__UINT_FAST32_FMTo__
+#define	SCNoFAST64	__UINT_FAST64_FMTo__
+#define	SCNoMAX		__UINTMAX_FMTo__
+#define	SCNoPTR		__UINTPTR_FMTo__
+
+#define	SCNu8		__UINT8_FMTu__
+#define	SCNu16		__UINT16_FMTu__
+#define	SCNu32		__UINT32_FMTu__
+#define	SCNu64		__UINT64_FMTu__
+#define	SCNuLEAST8	__UINT_LEAST8_FMTu__
+#define	SCNuLEAST16	__UINT_LEAST16_FMTu__
+#define	SCNuLEAST32	__UINT_LEAST32_FMTu__
+#define	SCNuLEAST64	__UINT_LEAST64_FMTu__
+#define	SCNuFAST8	__UINT_FAST8_FMTu__
+#define	SCNuFAST16	__UINT_FAST16_FMTu__
+#define	SCNuFAST32	__UINT_FAST32_FMTu__
+#define	SCNuFAST64	__UINT_FAST64_FMTu__
+#define	SCNuMAX		__UINTMAX_FMTu__
+#define	SCNuPTR		__UINTPTR_FMTu__
+
+#define	SCNx8		__UINT8_FMTx__
+#define	SCNx16		__UINT16_FMTx__
+#define	SCNx32		__UINT32_FMTx__
+#define	SCNx64		__UINT64_FMTx__
+#define	SCNxLEAST8	__UINT_LEAST8_FMTx__
+#define	SCNxLEAST16	__UINT_LEAST16_FMTx__
+#define	SCNxLEAST32	__UINT_LEAST32_FMTx__
+#define	SCNxLEAST64	__UINT_LEAST64_FMTx__
+#define	SCNxFAST8	__UINT_FAST8_FMTx__
+#define	SCNxFAST16	__UINT_FAST16_FMTx__
+#define	SCNxFAST32	__UINT_FAST32_FMTx__
+#define	SCNxFAST64	__UINT_FAST64_FMTx__
+#define	SCNxMAX		__UINTMAX_FMTx__
+#define	SCNxPTR		__UINTPTR_FMTx__
+
+#define	SCNX8		__UINT8_FMTX__
+#define	SCNX16		__UINT16_FMTX__
+#define	SCNX32		__UINT32_FMTX__
+#define	SCNX64		__UINT64_FMTX__
+#define	SCNXLEAST8	__UINT_LEAST8_FMTX__
+#define	SCNXLEAST16	__UINT_LEAST16_FMTX__
+#define	SCNXLEAST32	__UINT_LEAST32_FMTX__
+#define	SCNXLEAST64	__UINT_LEAST64_FMTX__
+#define	SCNXFAST8	__UINT_FAST8_FMTX__
+#define	SCNXFAST16	__UINT_FAST16_FMTX__
+#define	SCNXFAST32	__UINT_FAST32_FMTX__
+#define	SCNXFAST64	__UINT_FAST64_FMTX__
+#define	SCNXMAX		__UINTMAX_FMTX__
+#define	SCNXPTR		__UINTPTR_FMTX__
+
+#endif /* _SYS_COMMON_INT_FMTIO_H_ */

Property changes on: lab4/.minix-src/include/sys/common_int_fmtio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/disk.h
===================================================================
--- lab4/.minix-src/include/sys/disk.h	(nonexistent)
+++ lab4/.minix-src/include/sys/disk.h	(revision 13)
@@ -0,0 +1,553 @@
+/*	$NetBSD: disk.h,v 1.65 2015/08/16 18:00:03 mlelstv Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Lawrence Berkeley Laboratories.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Header: disk.h,v 1.5 92/11/19 04:33:03 torek Exp  (LBL)
+ *
+ *	@(#)disk.h	8.2 (Berkeley) 1/9/95
+ */
+
+#ifndef _SYS_DISK_H_
+#define _SYS_DISK_H_
+
+/*
+ * Disk device structures.
+ */
+
+#ifdef _KERNEL
+#include <sys/device.h>
+#endif
+#include <sys/dkio.h>
+#include <sys/time.h>
+#include <sys/queue.h>
+#include <sys/mutex.h>
+#include <sys/iostat.h>
+
+#include <prop/proplib.h>
+
+struct buf;
+struct disk;
+struct disklabel;
+struct cpu_disklabel;
+struct lwp;
+struct vnode;
+
+/*
+ * Disk information dictionary.
+ *
+ * This contains general infomation for disk devices.
+ *
+ *	<dict>
+ *		<key>type</key>
+ *		<string>...</string>
+ *		<key>geometry</key>
+ *		<dict>
+ *			<!-- See below for disk geometry dictionary
+ *			     contents. -->
+ *		</dict>
+ *
+ *		<!-- optional information -->
+ *		<key>rpm</key>
+ *		<integer>...</integer>
+ *		<key>sector-interleave</key>
+ *		<integer>...</integer>
+ *		<key>track-skew</key>
+ *		<integer>...</integer>
+ *		<key>cylinder-skew</key>
+ *		<integer>...</integer>
+ *		<key>head-switch-usecs</key>
+ *		<integer>...</integer>
+ *		<key>track-seek-usecs</key>
+ *		<integer>...</integer>
+ *		<key>removable</key>
+ *		<false/>
+ *		<key>ecc</key>
+ *		<false/>
+ *		<key>bad-sector-forwarding</key>
+ *		<true/>
+ *		<key>ramdisk</key>
+ *		<false/>
+ *		<key>back-to-back-transfers</key>
+ *		<true/>
+ *
+ *		<!-- additional information for SMD drives -->
+ *		<key>smd-skip-sectoring</key>
+ *		<false/>
+ *		<!-- XXX better names for these properties -->
+ *		<key>smd-mindist</key>
+ *		<integer>...</integer>
+ *		<key>smd-maxdist</key>
+ *		<integer>...</integer>
+ *		<key>smd-sdist</key>
+ *		<integer>...</integer>
+ *
+ *		<!-- additional information for ST506 drives -->
+ *		<!-- XXX better names for these properties -->
+ *		<key>st506-precompcyl</key>
+ *		<integer>...</integer>
+ *		<key>st506-gap3</key>
+ *		<integer>...</integer>
+ *
+ *		<!-- additional information for ATA drives -->
+ *		<!-- XXX -->
+ *
+ *		<!-- additional information for SCSI drives -->
+ *		<!-- XXX -->
+ *	</dict>
+ */
+
+/*
+ * dkwedge_info:
+ *
+ *	Information needed to configure (or query configuration of) a
+ *	disk wedge.
+ */
+struct dkwedge_info {
+	char		dkw_devname[16];/* device-style name (e.g. "dk0") */
+	uint8_t		dkw_wname[128];	/* wedge name (Unicode, UTF-8) */
+	char		dkw_parent[16];	/* parent disk device name */
+	daddr_t		dkw_offset;	/* LBA offset of wedge in parent */
+	uint64_t	dkw_size;	/* size of wedge in blocks */
+	char		dkw_ptype[32];	/* partition type string */
+};
+
+/*
+ * dkwedge_list:
+ *
+ *	Structure used to query a list of wedges.
+ */
+struct dkwedge_list {
+	void		*dkwl_buf;	/* storage for dkwedge_info array */
+	size_t		dkwl_bufsize;	/* size of that buffer */
+	u_int		dkwl_nwedges;	/* total number of wedges */
+	u_int		dkwl_ncopied;	/* number actually copied */
+};
+
+#ifdef _KERNEL
+/*
+ * dkwedge_discovery_method:
+ *
+ *	Structure used to describe partition map parsing schemes
+ *	used for wedge autodiscovery.
+ */
+struct dkwedge_discovery_method {
+					/* link in wedge driver's list */
+	LIST_ENTRY(dkwedge_discovery_method) ddm_list;
+	const char	*ddm_name;	/* name of this method */
+	int		ddm_priority;	/* search priority */
+	int		(*ddm_discover)(struct disk *, struct vnode *);
+};
+
+#define	DKWEDGE_DISCOVERY_METHOD_DECL(name, prio, discover)		\
+static struct dkwedge_discovery_method name ## _ddm = {			\
+	{ NULL, NULL },							\
+	#name,								\
+	prio,								\
+	discover							\
+};									\
+__link_set_add_data(dkwedge_methods, name ## _ddm)
+#endif /* _KERNEL */
+
+/* Some common partition types */
+#define	DKW_PTYPE_UNKNOWN	""
+#define	DKW_PTYPE_UNUSED	"unused"
+#define	DKW_PTYPE_SWAP		"swap"
+#define	DKW_PTYPE_V6		"v6"
+#define	DKW_PTYPE_V7		"v7"
+#define	DKW_PTYPE_SYSV		"sysv"
+#define	DKW_PTYPE_V71K		"v71k"
+#define	DKW_PTYPE_V8		"v8"
+#define	DKW_PTYPE_FFS		"ffs"
+#define	DKW_PTYPE_FAT		"msdos"
+#define	DKW_PTYPE_LFS		"lfs"
+#define	DKW_PTYPE_OTHER		"other"
+#define	DKW_PTYPE_HPFS		"hpfs"
+#define	DKW_PTYPE_ISO9660	"cd9660"
+#define	DKW_PTYPE_BOOT		"boot"
+#define	DKW_PTYPE_AMIGADOS	"ados"
+#define	DKW_PTYPE_HFS		"hfs"
+#define	DKW_PTYPE_FILECORE	"filecore"
+#define	DKW_PTYPE_EXT2FS	"ext2fs"
+#define	DKW_PTYPE_NTFS		"ntfs"
+#define	DKW_PTYPE_RAIDFRAME	"raidframe"
+#define	DKW_PTYPE_CCD		"ccd"
+#define	DKW_PTYPE_JFS2		"jfs2"
+#define	DKW_PTYPE_APPLEUFS	"appleufs"
+#define	DKW_PTYPE_VINUM		"vinum"
+#define	DKW_PTYPE_UDF		"udf"
+#define	DKW_PTYPE_APPLEHFS	"hfs"
+#define	DKW_PTYPE_SYSVBFS	"sysvbfs"
+#define	DKW_PTYPE_EFS		"efs"
+#define	DKW_PTYPE_NILFS		"nilfs"
+#define	DKW_PTYPE_CGD		"cgd"
+#define	DKW_PTYPE_MINIXFS3	"minixfs3"
+
+/*
+ * Ensure each symbol used in FSTYPE_DEFN in <sys/disklabel.h>
+ * has a corresponding DKW_PTYPE_* definition.
+ */
+#define	DKW_PTYPE_MSDOS		DKW_PTYPE_FAT
+#define	DKW_PTYPE_BSDFFS	DKW_PTYPE_FFS
+#define	DKW_PTYPE_BSDLFS	DKW_PTYPE_LFS
+#define	DKW_PTYPE_ADOS		DKW_PTYPE_AMIGADOS
+#define	DKW_PTYPE_EX2FS		DKW_PTYPE_EXT2FS
+#define	DKW_PTYPE_RAID		DKW_PTYPE_RAIDFRAME
+
+/*
+ * Disk geometry dictionary.
+ *
+ * NOTE: Not all geometry information is relevant for every kind of disk.
+ *
+ *	<dict>
+ *		<key>sectors-per-unit</key>
+ *		<integer>...</integer>
+ *		<key>sector-size</key>
+ *		<integer>...</integer>
+ *		<key>sectors-per-track</key>
+ *		<integer>...</integer>
+ *		<key>tracks-per-cylinder</key>
+ *		<integer>...</integer>
+ *		<key>cylinders-per-unit</key>
+ *		<integer>...</integer>
+ *		<key>physical-cylinders-per-unit</key>
+ *		<integer>...</integer>
+ *		<key>spare-sectors-per-track</key>
+ *		<integer>...</integer>
+ *		<key>spare-sectors-per-cylinder</key>
+ *		<integer>...</integer>
+ *		<key>alternative-cylinders</key>
+ *		<integer>...</integer>
+ *	</dict>
+ * NOTE: Not all geometry information is relevant for every kind of disk.
+ */
+
+struct disk_geom {
+	int64_t		dg_secperunit;	/* # of data sectors per unit */
+	uint32_t	dg_secsize;	/* # of bytes per sector */
+	uint32_t	dg_nsectors;	/* # of data sectors per track */
+	uint32_t	dg_ntracks;	/* # of tracks per cylinder */
+	uint32_t	dg_ncylinders;	/* # of data cylinders per unit */
+	uint32_t	dg_secpercyl;	/* # of data sectors per cylinder */
+	uint32_t	dg_pcylinders;	/* # of physical cylinders per unit */
+
+	/*
+	 * Spares (bad sector replacements) below are not counted in
+	 * dg_nsectors or dg_secpercyl.  Spare sectors are assumed to
+	 * be physical sectors which occupy space at the end of each
+	 * track and/or cylinder.
+	 */
+	uint32_t	dg_sparespertrack;
+	uint32_t	dg_sparespercyl;
+	/*
+	 * Alternative cylinders include maintenance, replacement,
+	 * configuration description areas, etc.
+	 */
+	uint32_t	dg_acylinders;
+};
+
+/*
+ * Disk partition dictionary.
+ *
+ * A partition is represented as a dictionary containing generic partition
+ * properties (such as starting block and block count), as well as information
+ * that is specific to individual partition map formats.
+ *
+ *	<dict>
+ *		<key>start-block</key>
+ *		<integer>...</integer>
+ *		<key>block-count</key>
+ *		<integer>...</integer>
+ *		<!-- DKW_PTYPE strings ("" or missing if unknown) -->
+ *		<key>type</type>
+ *		<string>...</string>
+ *		<!-- optional -->
+ *		<key>name</key>
+ *		<string>...</string>
+ *
+ *		<!-- these are valid for GPT partition maps -->
+ *		<key>gpt-type-guid</key>
+ *		<string>...</string>
+ *		<key>gpt-partition-guid</key>
+ *		<string>...</string>
+ *		<key>gpt-platform-required</key>
+ *		<false/>
+ *
+ *		<!-- these are valid for 4.4BSD partition maps -->
+ *		<key>bsd44-partition-type</key>
+ *		<integer>...</integer>
+ *		<key>bsd44-fs-fragment-size</key>
+ *		<integer>...</integer>
+ *		<key>bsd44-iso9660-session-offset</key>
+ *		<integer>...</integer>
+ *		<key>bsd44-ffs-cylinders-per-group</key>
+ *		<integer>...</integer>
+ *		<key>bsd44-lfs-segment-shift</key>
+ *		<integer>...</integer>
+ *
+ *		<!-- these are valid for NeXT partition maps -->
+ *		<key>next-block-size</key>
+ *		<integer>...</integer>
+ *		<key>next-fs-fragment-size</key>
+ *		<integer>...</integer>
+ *		<key>next-fs-optimization</key>
+ *		<string>...</string>	<!-- "space" or "time" -->
+ *		<key>next-fs-cylinders-per-group</key>
+ *		<integer>...</integer>
+ *		<key>next-bytes-per-inode-density</key>
+ *		<integer>...</integer>
+ *		<key>next-minfree-percentage</key>
+ *		<integer>...</integer>
+ *		<key>next-run-newfs-during-init</key>
+ *		<false/>
+ *		<key>next-mount-point</key>
+ *		<string>...</string>
+ *		<key>next-automount</key>
+ *		<true/>
+ *		<key>next-partition-type</key>
+ *		<string>...</string>
+ *
+ *		<!-- these are valid for MBR partition maps -->
+ *		<key>mbr-start-head</key>
+ *		<integer>...</integer>
+ *		<key>mbr-start-sector</key>
+ *		<integer>...</integer>
+ *		<key>mbr-start-cylinder</key>
+ *		<integer>...</integer>
+ *		<key>mbr-partition-type</key>
+ *		<integer>...</integer>
+ *		<key>mbr-end-head</key>
+ *		<integer>...</integer>
+ *		<key>mbr-end-sector</key>
+ *		<integer>...</integer>
+ *		<key>mbr-end-cylinder</key>
+ *		<integer>...</integer>
+ *		<key>mbr-active-partition</key>
+ *		<false/>
+ *
+ *		<!-- these are valid for Apple partition maps -->
+ *		<key>apple-partition-type</key>
+ *		<string>...</string>
+ *		<!-- XXX What else do we need?  wrstuden? -->
+ *
+ *		<!-- these are valid for RISCiX partition maps -->
+ *		<key>riscix-partition-type</key>
+ *		<integer>...</integer>
+ *
+ *		<!-- these are valid for MIPS/SGI partition maps -->
+ *		<key>mips-partition-type</key>
+ *		<integer>...</integer>
+ *
+ *		<!-- SunOS 4 partition maps have no specific
+ *		     additional information.  Note, however,
+ *		     that SunOS 4 partitions must begin on
+ *		     cylinder boundaries. -->
+ *
+ *		<!-- XXX Need Amiga partition map info -->
+ *
+ *		<!-- these are valid for VTOC partition maps -->
+ *		<key>vtoc-tag</key>
+ *		<integer>...</integer>
+ *		<key>vtoc-unmount</key>
+ *		<false/>
+ *		<key>vtoc-read-only</key>
+ *		<false/>
+ *		<!-- XXX is this really part of the partition info? -->
+ *		<key>vtoc-timestamp</key>
+ *		<integer>...</integer>
+ *
+ *		<!-- mvme68k partition maps use 4.4BSD partition
+ *		     info stuffed into two different areas of the
+ *		     disk information label recognized by BUG. -->
+ *
+ *		<!-- XXX What else? -->
+ *	</dict>
+ */
+
+struct disk {
+	TAILQ_ENTRY(disk) dk_link;	/* link in global disklist */
+	const char	*dk_name;	/* disk name */
+	prop_dictionary_t dk_info;	/* reference to disk-info dictionary */
+	struct disk_geom dk_geom;	/* cooked version of dk_info */
+	int		dk_bopenmask;	/* block devices open */
+	int		dk_copenmask;	/* character devices open */
+	int		dk_openmask;	/* composite (bopen|copen) */
+	int		dk_state;	/* label state   ### */
+	int		dk_blkshift;	/* shift to convert DEV_BSIZE to blks */
+	int		dk_byteshift;	/* shift to convert bytes to blks */
+
+	/*
+	 * Metrics data; note that some metrics may have no meaning
+	 * on certain types of disks.
+	 */
+	struct io_stats	*dk_stats;
+
+	const struct dkdriver *dk_driver;	/* pointer to driver */
+
+	/*
+	 * Information required to be the parent of a disk wedge.
+	 */
+	kmutex_t	dk_rawlock;	/* lock on these fields */
+	u_int		dk_rawopens;	/* # of openes of rawvp */
+	struct vnode	*dk_rawvp;	/* vnode for the RAW_PART bdev */
+
+	kmutex_t	dk_openlock;	/* lock on these and openmask */
+	u_int		dk_nwedges;	/* # of configured wedges */
+					/* all wedges on this disk */
+	LIST_HEAD(, dkwedge_softc) dk_wedges;
+
+	/*
+	 * Disk label information.  Storage for the in-core disk label
+	 * must be dynamically allocated, otherwise the size of this
+	 * structure becomes machine-dependent.
+	 */
+	daddr_t		dk_labelsector;		/* sector containing label */
+	struct disklabel *dk_label;	/* label */
+	struct cpu_disklabel *dk_cpulabel;
+};
+
+#ifdef _KERNEL
+struct dkdriver {
+	void	(*d_strategy)(struct buf *);
+	void	(*d_minphys)(struct buf *);
+	int	(*d_open)(dev_t, int, int, struct lwp *);
+	int	(*d_close)(dev_t, int, int, struct lwp *);
+	int	(*d_diskstart)(device_t, struct buf *);
+	void	(*d_iosize)(device_t, int *);
+	int	(*d_dumpblocks)(device_t, void *, daddr_t, int);
+	int	(*d_lastclose)(device_t);
+	int	(*d_discard)(device_t, off_t, off_t);
+};
+#endif
+
+/* states */
+#define	DK_CLOSED	0		/* drive is closed */
+#define	DK_WANTOPEN	1		/* drive being opened */
+#define	DK_WANTOPENRAW	2		/* drive being opened */
+#define	DK_RDLABEL	3		/* label being read */
+#define	DK_OPEN		4		/* label read, drive open */
+#define	DK_OPENRAW	5		/* open without label */
+
+/*
+ * Bad sector lists per fixed disk
+ */
+struct disk_badsectors {
+	SLIST_ENTRY(disk_badsectors)	dbs_next;
+	daddr_t		dbs_min;	/* min. sector number */
+	daddr_t		dbs_max;	/* max. sector number */
+	struct timeval	dbs_failedat;	/* first failure at */
+};
+
+struct disk_badsecinfo {
+	uint32_t	dbsi_bufsize;	/* size of region pointed to */
+	uint32_t	dbsi_skip;	/* how many to skip past */
+	uint32_t	dbsi_copied;	/* how many got copied back */
+	uint32_t	dbsi_left;	/* remaining to copy */
+	void *		dbsi_buffer;	/* region to copy disk_badsectors to */
+};
+
+#define	DK_STRATEGYNAMELEN	32
+struct disk_strategy {
+	char dks_name[DK_STRATEGYNAMELEN]; /* name of strategy */
+	char *dks_param;		/* notyet; should be NULL */
+	size_t dks_paramlen;		/* notyet; should be 0 */
+};
+
+#define	DK_BSIZE2BLKSHIFT(b)	((ffs((b) / DEV_BSIZE)) - 1)
+#define	DK_BSIZE2BYTESHIFT(b)	(ffs((b)) - 1)
+
+#ifdef _KERNEL
+extern	int disk_count;			/* number of disks in global disklist */
+
+struct proc;
+
+void	disk_attach(struct disk *);
+int	disk_begindetach(struct disk *, int (*)(device_t), device_t, int);
+void	disk_detach(struct disk *);
+void	disk_init(struct disk *, const char *, const struct dkdriver *);
+void	disk_destroy(struct disk *);
+void	disk_busy(struct disk *);
+void	disk_unbusy(struct disk *, long, int);
+bool	disk_isbusy(struct disk *);
+struct disk *disk_find(const char *);
+int	disk_ioctl(struct disk *, dev_t, u_long, void *, int, struct lwp *);
+void	disk_set_info(device_t, struct disk *, const char *);
+
+void	dkwedge_init(void);
+int	dkwedge_add(struct dkwedge_info *);
+int	dkwedge_del(struct dkwedge_info *);
+void	dkwedge_delall(struct disk *);
+int	dkwedge_list(struct disk *, struct dkwedge_list *, struct lwp *);
+void	dkwedge_discover(struct disk *);
+int	dkwedge_read(struct disk *, struct vnode *, daddr_t, void *, size_t);
+device_t dkwedge_find_by_wname(const char *);
+const char *dkwedge_get_parent_name(dev_t);
+void	dkwedge_print_wnames(void);
+device_t dkwedge_find_partition(device_t, daddr_t, uint64_t);
+#endif
+
+#endif /* _SYS_DISK_H_ */

Property changes on: lab4/.minix-src/include/sys/disk.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/callout.h
===================================================================
--- lab4/.minix-src/include/sys/callout.h	(nonexistent)
+++ lab4/.minix-src/include/sys/callout.h	(revision 13)
@@ -0,0 +1,126 @@
+/*	$NetBSD: callout.h,v 1.32 2015/02/07 19:36:42 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2000, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center, and by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_CALLOUT_H_
+#define _SYS_CALLOUT_H_
+
+#include <sys/types.h>
+
+/*
+ * The callout implementation is private to kern_timeout.c yet uses
+ * caller-supplied storage, as lightweight callout operations are
+ * critical to system performance.
+ *
+ * The size of callout_t must remain constant in order to ensure ABI
+ * compatibility for kernel modules: it may become smaller, but must
+ * not grow.  If more space is required, rearrange the members of
+ * callout_impl_t.
+ */
+typedef struct callout {
+	void	*_c_store[10];
+} callout_t;
+
+/* Internal flags. */
+#define	CALLOUT_BOUND		0x0001	/* bound to a specific CPU */
+#define	CALLOUT_PENDING		0x0002	/* callout is on the queue */
+#define	CALLOUT_FIRED		0x0004	/* callout has fired */
+#define	CALLOUT_INVOKING	0x0008	/* callout function is being invoked */
+
+/* End-user flags. */
+#define	CALLOUT_MPSAFE		0x0100	/* does not need kernel_lock */
+#define	CALLOUT_FLAGMASK	0xff00
+
+#define CALLOUT_FMT	"\177\020\
+b\00BOUND\0\
+b\01PENDING\0\
+b\02FIRED\0\
+b\03INVOKING\0\
+b\10MPSAFE\0"
+
+#ifdef _CALLOUT_PRIVATE
+
+/* The following funkyness is to appease gcc3's strict aliasing. */
+struct callout_circq {
+	/* next element */
+	union {
+		struct callout_impl	*elem;
+		struct callout_circq	*list;
+	} cq_next;
+	/* previous element */
+	union {
+		struct callout_impl	*elem;
+		struct callout_circq	*list;
+	} cq_prev;
+};
+#define	cq_next_e	cq_next.elem
+#define	cq_prev_e	cq_prev.elem
+#define	cq_next_l	cq_next.list
+#define	cq_prev_l	cq_prev.list
+
+struct callout_cpu;
+
+typedef struct callout_impl {
+	struct callout_circq c_list;		/* linkage on queue */
+	void	(*c_func)(void *);		/* function to call */
+	void	*c_arg;				/* function argument */
+	struct callout_cpu * volatile c_cpu;	/* associated CPU */
+	int	c_time;				/* when callout fires */
+	u_int	c_flags;			/* state of this entry */
+	u_int	c_magic;			/* magic number */
+} callout_impl_t;
+#define	CALLOUT_MAGIC		0x11deeba1
+
+#endif	/* _CALLOUT_PRIVATE */
+
+#ifdef _KERNEL
+struct cpu_info;
+
+void	callout_startup(void);
+void	callout_init_cpu(struct cpu_info *);
+void	callout_hardclock(void);
+
+void	callout_init(callout_t *, u_int);
+void	callout_destroy(callout_t *);
+void	callout_setfunc(callout_t *, void (*)(void *), void *);
+void	callout_reset(callout_t *, int, void (*)(void *), void *);
+void	callout_schedule(callout_t *, int);
+bool	callout_stop(callout_t *);
+bool	callout_halt(callout_t *, void *);
+bool	callout_pending(callout_t *);
+bool	callout_expired(callout_t *);
+bool	callout_active(callout_t *);
+bool	callout_invoking(callout_t *);
+void	callout_ack(callout_t *);
+void	callout_bind(callout_t *, struct cpu_info *);
+#endif	/* _KERNEL */
+
+#endif /* !_SYS_CALLOUT_H_ */

Property changes on: lab4/.minix-src/include/sys/callout.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/errno.h
===================================================================
--- lab4/.minix-src/include/sys/errno.h	(nonexistent)
+++ lab4/.minix-src/include/sys/errno.h	(revision 13)
@@ -0,0 +1,217 @@
+/*	$NetBSD: errno.h,v 1.40 2013/01/02 18:51:53 dsl Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)errno.h	8.5 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_ERRNO_H_
+#define _SYS_ERRNO_H_
+
+#define	EPERM		(_SIGN 1 )		/* Operation not permitted */
+#define	ENOENT		(_SIGN 2 )		/* No such file or directory */
+#define	ESRCH		(_SIGN 3 )		/* No such process */
+#define	EINTR		(_SIGN 4 )		/* Interrupted system call */
+#define	EIO		(_SIGN 5 )		/* Input/output error */
+#define	ENXIO		(_SIGN 6 )		/* Device not configured */
+#define	E2BIG		(_SIGN 7 )		/* Argument list too long */
+#define	ENOEXEC		(_SIGN 8 )		/* Exec format error */
+#define	EBADF		(_SIGN 9 )		/* Bad file descriptor */
+#define	ECHILD		(_SIGN 10 )		/* No child processes */
+#define	EDEADLK		(_SIGN 11 )		/* Resource deadlock avoided */
+					/* 11 was EAGAIN */
+#define	ENOMEM		(_SIGN 12 )		/* Cannot allocate memory */
+#define	EACCES		(_SIGN 13 )		/* Permission denied */
+#define	EFAULT		(_SIGN 14 )		/* Bad address */
+#define	ENOTBLK		(_SIGN 15 )		/* Block device required */
+#define	EBUSY		(_SIGN 16 )		/* Device busy */
+#define	EEXIST		(_SIGN 17 )		/* File exists */
+#define	EXDEV		(_SIGN 18 )		/* Cross-device link */
+#define	ENODEV		(_SIGN 19 )		/* Operation not supported by device */
+#define	ENOTDIR		(_SIGN 20 )		/* Not a directory */
+#define	EISDIR		(_SIGN 21 )		/* Is a directory */
+#define	EINVAL		(_SIGN 22 )		/* Invalid argument */
+#define	ENFILE		(_SIGN 23 )		/* Too many open files in system */
+#define	EMFILE		(_SIGN 24 )		/* Too many open files */
+#define	ENOTTY		(_SIGN 25 )		/* Inappropriate ioctl for device */
+#define	ETXTBSY		(_SIGN 26 )		/* Text file busy */
+#define	EFBIG		(_SIGN 27 )		/* File too large */
+#define	ENOSPC		(_SIGN 28 )		/* No space left on device */
+#define	ESPIPE		(_SIGN 29 )		/* Illegal seek */
+#define	EROFS		(_SIGN 30 )		/* Read-only file system */
+#define	EMLINK		(_SIGN 31 )		/* Too many links */
+#define	EPIPE		(_SIGN 32 )		/* Broken pipe */
+
+/* math software */
+#define	EDOM		(_SIGN 33 )		/* Numerical argument out of domain */
+#define	ERANGE		(_SIGN 34 )		/* Result too large or too small */
+
+/* non-blocking and interrupt i/o */
+#define	EAGAIN		(_SIGN 35 )		/* Resource temporarily unavailable */
+#define	EWOULDBLOCK	EAGAIN		/* Operation would block */
+#define	EINPROGRESS	(_SIGN 36 )		/* Operation now in progress */
+#define	EALREADY	(_SIGN 37 )		/* Operation already in progress */
+
+/* ipc/network software -- argument errors */
+#define	ENOTSOCK	(_SIGN 38 )		/* Socket operation on non-socket */
+#define	EDESTADDRREQ	(_SIGN 39 )		/* Destination address required */
+#define	EMSGSIZE	(_SIGN 40 )		/* Message too long */
+#define	EPROTOTYPE	(_SIGN 41 )		/* Protocol wrong type for socket */
+#define	ENOPROTOOPT	(_SIGN 42 )		/* Protocol option not available */
+#define	EPROTONOSUPPORT	(_SIGN 43 )		/* Protocol not supported */
+#define	ESOCKTNOSUPPORT	(_SIGN 44 )		/* Socket type not supported */
+#define	EOPNOTSUPP	(_SIGN 45 )		/* Operation not supported */
+#define	EPFNOSUPPORT	(_SIGN 46 )		/* Protocol family not supported */
+#define	EAFNOSUPPORT	(_SIGN 47 )		/* Address family not supported by protocol family */
+#define	EADDRINUSE	(_SIGN 48 )		/* Address already in use */
+#define	EADDRNOTAVAIL	(_SIGN 49 )		/* Can't assign requested address */
+
+/* ipc/network software -- operational errors */
+#define	ENETDOWN	(_SIGN 50 )		/* Network is down */
+#define	ENETUNREACH	(_SIGN 51 )		/* Network is unreachable */
+#define	ENETRESET	(_SIGN 52 )		/* Network dropped connection on reset */
+#define	ECONNABORTED	(_SIGN 53 )		/* Software caused connection abort */
+#define	ECONNRESET	(_SIGN 54 )		/* Connection reset by peer */
+#define	ENOBUFS		(_SIGN 55 )		/* No buffer space available */
+#define	EISCONN		(_SIGN 56 )		/* Socket is already connected */
+#define	ENOTCONN	(_SIGN 57 )		/* Socket is not connected */
+#define	ESHUTDOWN	(_SIGN 58 )		/* Can't send after socket shutdown */
+#define	ETOOMANYREFS	(_SIGN 59 )		/* Too many references: can't splice */
+#define	ETIMEDOUT	(_SIGN 60 )		/* Operation timed out */
+#define	ECONNREFUSED	(_SIGN 61 )		/* Connection refused */
+
+#define	ELOOP		(_SIGN 62 )		/* Too many levels of symbolic links */
+#define	ENAMETOOLONG	(_SIGN 63 )		/* File name too long */
+
+/* should be rearranged */
+#define	EHOSTDOWN	(_SIGN 64 )		/* Host is down */
+#define	EHOSTUNREACH	(_SIGN 65 )		/* No route to host */
+#define	ENOTEMPTY	(_SIGN 66 )		/* Directory not empty */
+
+/* quotas & mush */
+#define	EPROCLIM	(_SIGN 67 )		/* Too many processes */
+#define	EUSERS		(_SIGN 68 )		/* Too many users */
+#define	EDQUOT		(_SIGN 69 )		/* Disc quota exceeded */
+
+/* Network File System */
+#define	ESTALE		(_SIGN 70 )		/* Stale NFS file handle */
+#define	EREMOTE		(_SIGN 71 )		/* Too many levels of remote in path */
+#define	EBADRPC		(_SIGN 72 )		/* RPC struct is bad */
+#define	ERPCMISMATCH	(_SIGN 73 )		/* RPC version wrong */
+#define	EPROGUNAVAIL	(_SIGN 74 )		/* RPC prog. not avail */
+#define	EPROGMISMATCH	(_SIGN 75 )		/* Program version wrong */
+#define	EPROCUNAVAIL	(_SIGN 76 )		/* Bad procedure for program */
+
+#define	ENOLCK		(_SIGN 77 )		/* No locks available */
+#define	ENOSYS		(_SIGN 78 )		/* Function not implemented */
+
+#define	EFTYPE		(_SIGN 79 )		/* Inappropriate file type or format */
+#define	EAUTH		(_SIGN 80 )		/* Authentication error */
+#define	ENEEDAUTH	(_SIGN 81 )		/* Need authenticator */
+
+/* SystemV IPC */
+#define	EIDRM		(_SIGN 82 )		/* Identifier removed */
+#define	ENOMSG		(_SIGN 83 )		/* No message of desired type */
+#define	EOVERFLOW	(_SIGN 84 )		/* Value too large to be stored in data type */
+
+/* Wide/multibyte-character handling, ISO/IEC 9899/AMD1:1995 */
+#define	EILSEQ		(_SIGN 85 )		/* Illegal byte sequence */
+
+/* From IEEE Std 1003.1-2001 */
+/* Base, Realtime, Threads or Thread Priority Scheduling option errors */
+#define ENOTSUP		(_SIGN 86 )		/* Not supported */
+
+/* Realtime option errors */
+#define ECANCELED	(_SIGN 87 )		/* Operation canceled */
+
+/* Realtime, XSI STREAMS option errors */
+#define EBADMSG		(_SIGN 88 )		/* Bad or Corrupt message */
+
+/* XSI STREAMS option errors  */
+#define ENODATA		(_SIGN 89 )		/* No message available */
+#define ENOSR		(_SIGN 90 )		/* No STREAM resources */
+#define ENOSTR		(_SIGN 91 )		/* Not a STREAM */
+#define ETIME		(_SIGN 92 )		/* STREAM ioctl timeout */
+
+/* File system extended attribute errors */
+#define	ENOATTR		(_SIGN 93 )		/* Attribute not found */
+
+/* Realtime, XSI STREAMS option errors */
+#define	EMULTIHOP	(_SIGN 94 )		/* Multihop attempted */ 
+#define	ENOLINK		(_SIGN 95 )		/* Link has been severed */
+#define	EPROTO		(_SIGN 96 )		/* Protocol error */
+
+#define	ELAST		(_SIGN 96 )		/* Must equal largest errno */
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+/* pseudo-errors returned inside kernel to modify return to process */
+#define	EJUSTRETURN	-2		/* don't modify regs, just return */
+#define	ERESTART	-3		/* restart syscall */
+#define	EPASSTHROUGH	-4		/* ioctl not handled by this layer */
+#define	EDUPFD		-5		/* Dup given fd */
+#define	EMOVEFD		-6		/* Move given fd */
+#endif
+
+#if defined(__minix)
+/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
+#ifdef _SYSTEM
+#   define _SIGN         -
+#   define OK            0
+#else
+#   define _SIGN         
+#endif
+
+/* minix-specific error codes */
+#define ERESTART     (_SIGN 200 )  /* service restarted */
+#define ENOTREADY    (_SIGN 201 )  /* source or destination is not ready */
+#define EDEADSRCDST  (_SIGN 202 )  /* source or destination is not alive */
+#define EDONTREPLY   (_SIGN 203 )  /* pseudo-code: don't send a reply */
+#define EGENERIC     (_SIGN 204 )  /* generic error */
+#define EPACKSIZE    (_SIGN 205 )  /* invalid packet size for some protocol */
+#define EURG         (_SIGN 206 )  /* urgent data present */
+#define ENOURG       (_SIGN 207 )  /* no urgent data present */
+#define ELOCKED      (_SIGN 208 )  /* can't send message due to deadlock */
+#define EBADCALL     (_SIGN 209 )  /* illegal system call number */
+#define ECALLDENIED  (_SIGN 210 )  /* no permission for system call */
+#define ETRAPDENIED  (_SIGN 211 )  /* IPC trap not allowed */
+#define EBADREQUEST  (_SIGN 212 )  /* destination cannot handle request */
+#define EBADMODE     (_SIGN 213 )  /* badmode in ioctl */
+#define ENOCONN      (_SIGN 214 )  /* no such connection */
+#define EDEADEPT     (_SIGN 215 )  /* specified endpoint is not alive */
+#define EBADEPT      (_SIGN 216 )  /* specified endpoint is bad */
+#define EBADCPU      (_SIGN 217 )  /* requested CPU does not work */
+
+#endif /* defined(__minix) */
+
+#endif /* !_SYS_ERRNO_H_ */

Property changes on: lab4/.minix-src/include/sys/errno.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/common_limits.h
===================================================================
--- lab4/.minix-src/include/sys/common_limits.h	(nonexistent)
+++ lab4/.minix-src/include/sys/common_limits.h	(revision 13)
@@ -0,0 +1,95 @@
+/*	$NetBSD: common_limits.h,v 1.2 2014/08/19 15:46:46 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_COMMON_LIMITS_H_
+#define _SYS_COMMON_LIMITS_H_
+
+#define	CHAR_BIT	__CHAR_BIT__	/* number of bits in a char */
+
+#define SCHAR_MIN	(-__SCHAR_MAX__-1) /* min value for a signed char */
+#define	SCHAR_MAX	__SCHAR_MAX__	/* max value for a signed char */
+#define	UCHAR_MAX	(2*SCHAR_MAX+1)	/* max value for an unsigned char */
+
+#define	SHRT_MIN	(-__SHRT_MAX__-1) /* min value for a short */
+#define	SHRT_MAX	__SHRT_MAX__	/* max value for a short */
+#define	USHRT_MAX	(2*SHRT_MAX+1)	/* max value for an unsigned short */
+
+#define	INT_MIN		(-__INT_MAX__-1) /* min value for an int */
+#define	INT_MAX		__INT_MAX__	/* max value for an int */
+#define	UINT_MAX	(2U*INT_MAX+1U)	/* max value for an unsigned int */
+
+#define	LONG_MIN	(-__LONG_MAX__-1L)	/* min value for a long */
+#define	LONG_MAX	__LONG_MAX__		/* max value for a long */
+#define	ULONG_MAX	(2UL*LONG_MAX+1UL)	/* max unsigned long */
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define	SSIZE_MAX	LONG_MAX	/* max value for a ssize_t */
+
+#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
+    defined(_NETBSD_SOURCE)
+#define	LLONG_MIN	(-__LONG_LONG_MAX__-1LL) /* min signed long long */
+#define	LLONG_MAX	__LONG_LONG_MAX__	/* max signed long long */
+#define	ULLONG_MAX	(2ULL*LLONG_MAX+1ULL)	/* max unsigned long long */
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#define	SSIZE_MIN	LONG_MIN	/* min value for a ssize_t */
+#define	SIZE_T_MAX	ULONG_MAX	/* max value for a size_t */
+
+#define	UQUAD_MAX	ULLONG_MAX	/* max unsigned quad */
+#define	QUAD_MAX	LLONG_MAX	/* max signed quad */
+#define	QUAD_MIN	LLONG_MIN	/* min signed quad */
+
+#endif /* _NETBSD_SOURCE */
+#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define LONG_BIT	(__SIZEOF_LONG__ * 8)
+#define WORD_BIT	(__SIZEOF_INT__ * 8)
+
+#define DBL_DIG		__DBL_DIG__
+#define DBL_MAX		__DBL_MAX__
+#define DBL_MIN		__DBL_MIN__
+
+#define FLT_DIG		__FLT_DIG__
+#define FLT_MAX		__FLT_MAX__
+#define FLT_MIN		__FLT_MIN__
+
+#ifdef __LDBL_DIG__
+#define LDBL_DIG	__LDBL_DIG__
+#define LDBL_MAX	__LDBL_MAX__
+#define LDBL_MIN	__LDBL_MIN__
+#endif
+
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#endif /* _SYS_COMMON_LIMITS_H_ */

Property changes on: lab4/.minix-src/include/sys/common_limits.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/cdefs_elf.h
===================================================================
--- lab4/.minix-src/include/sys/cdefs_elf.h	(nonexistent)
+++ lab4/.minix-src/include/sys/cdefs_elf.h	(revision 13)
@@ -0,0 +1,222 @@
+/*	$NetBSD: cdefs_elf.h,v 1.49 2015/05/08 13:58:53 christos Exp $	*/
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _SYS_CDEFS_ELF_H_
+#define	_SYS_CDEFS_ELF_H_
+
+#ifdef __LEADING_UNDERSCORE
+#define	_C_LABEL(x)	__CONCAT(_,x)
+#define _C_LABEL_STRING(x)	"_"x
+#else
+#define	_C_LABEL(x)	x
+#define _C_LABEL_STRING(x)	x
+#endif
+
+#if __STDC__
+#define	___RENAME(x)	__asm(___STRING(_C_LABEL(x)))
+#else
+#ifdef __LEADING_UNDERSCORE
+#define	___RENAME(x)	____RENAME(_/**/x)
+#define	____RENAME(x)	__asm(___STRING(x))
+#else
+#define	___RENAME(x)	__asm(___STRING(x))
+#endif
+#endif
+
+#define	__indr_reference(sym,alias)	/* nada, since we do weak refs */
+
+#if __STDC__
+#define	__strong_alias(alias,sym)	       				\
+    __asm(".global " _C_LABEL_STRING(#alias) "\n"			\
+	    _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
+
+#define	__weak_alias(alias,sym)						\
+    __asm(".weak " _C_LABEL_STRING(#alias) "\n"			\
+	    _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
+
+/* Do not use __weak_extern, use __weak_reference instead */
+#define	__weak_extern(sym)						\
+    __asm(".weak " _C_LABEL_STRING(#sym));
+
+#if __GNUC_PREREQ__(4, 0)
+#define	__weak	__attribute__((__weak__))
+#else
+#define	__weak
+#endif
+
+#if __GNUC_PREREQ__(4, 0)
+#define	__weak_reference(sym)	__attribute__((__weakref__(#sym)))
+#else
+#define	__weak_reference(sym)	; __asm(".weak " _C_LABEL_STRING(#sym))
+#endif
+
+#if __GNUC_PREREQ__(4, 2)
+#define	__weakref_visible	static
+#else
+#define	__weakref_visible	extern
+#endif
+
+#define	__warn_references(sym,msg)					\
+    __asm(".pushsection .gnu.warning." #sym "\n"			\
+	  ".ascii \"" msg "\"\n"					\
+	  ".popsection");
+
+#else /* !__STDC__ */
+
+#ifdef __LEADING_UNDERSCORE
+#define __weak_alias(alias,sym) ___weak_alias(_/**/alias,_/**/sym)
+#define	___weak_alias(alias,sym)					\
+    __asm(".weak alias\nalias = sym");
+#else
+#define	__weak_alias(alias,sym)						\
+    __asm(".weak alias\nalias = sym");
+#endif
+#ifdef __LEADING_UNDERSCORE
+#define __weak_extern(sym) ___weak_extern(_/**/sym)
+#define	___weak_extern(sym)						\
+    __asm(".weak sym");
+#else
+#define	__weak_extern(sym)						\
+    __asm(".weak sym");
+#endif
+#define	__warn_references(sym,msg)					\
+    __asm(".pushsection .gnu.warning.sym\n"				\
+	  ".ascii \"" msg "\"\n"					\
+	  ".popsection");
+
+#endif /* !__STDC__ */
+
+#if __arm__
+#define __ifunc(name, resolver) \
+	__asm(".globl	" _C_LABEL_STRING(#name) "\n" \
+	      ".type	" _C_LABEL_STRING(#name) ", %gnu_indirect_function\n" \
+	       _C_LABEL_STRING(#name) " = " _C_LABEL_STRING(#resolver))
+#else
+#define __ifunc(name, resolver) \
+	__asm(".globl	" _C_LABEL_STRING(#name) "\n" \
+	      ".type	" _C_LABEL_STRING(#name) ", @gnu_indirect_function\n" \
+	      _C_LABEL_STRING(#name) " = " _C_LABEL_STRING(#resolver))
+#endif
+
+#if __STDC__
+#define	__SECTIONSTRING(_sec, _str)					\
+	__asm(".pushsection " #_sec "\n"				\
+	      ".asciz \"" _str "\"\n"					\
+	      ".popsection")
+#else
+#define	__SECTIONSTRING(_sec, _str)					\
+	__asm(".pushsection _sec\n"					\
+	      ".asciz \"" _str "\"\n"					\
+	      ".popsection")
+#endif
+
+#define	__IDSTRING(_n,_s)		__SECTIONSTRING(.ident,_s)
+
+#define	__RCSID(_s)			__IDSTRING(rcsid,_s)
+#define	__SCCSID(_s)
+#define __SCCSID2(_s)
+#define	__COPYRIGHT(_s)			__SECTIONSTRING(.copyright,_s)
+
+#define	__KERNEL_RCSID(_n, _s)		__RCSID(_s)
+#define	__KERNEL_SCCSID(_n, _s)
+#define	__KERNEL_COPYRIGHT(_n, _s)	__COPYRIGHT(_s)
+
+#ifndef __lint__
+#define	__link_set_make_entry(set, sym)					\
+	static void const * const __link_set_##set##_sym_##sym		\
+	    __section("link_set_" #set) __used = (const void *)&sym
+#define	__link_set_make_entry2(set, sym, n)				\
+	static void const * const __link_set_##set##_sym_##sym##_##n	\
+	    __section("link_set_" #set) __used = (const void *)&sym[n]
+#else
+#define	__link_set_make_entry(set, sym)					\
+	extern void const * const __link_set_##set##_sym_##sym
+#define	__link_set_make_entry2(set, sym, n)				\
+	extern void const * const __link_set_##set##_sym_##sym##_##n
+#endif /* __lint__ */
+
+#define	__link_set_add_text(set, sym)	__link_set_make_entry(set, sym)
+#define	__link_set_add_rodata(set, sym)	__link_set_make_entry(set, sym)
+#define	__link_set_add_data(set, sym)	__link_set_make_entry(set, sym)
+#define	__link_set_add_bss(set, sym)	__link_set_make_entry(set, sym)
+#define	__link_set_add_text2(set, sym, n)   __link_set_make_entry2(set, sym, n)
+#define	__link_set_add_rodata2(set, sym, n) __link_set_make_entry2(set, sym, n)
+#define	__link_set_add_data2(set, sym, n)   __link_set_make_entry2(set, sym, n)
+#define	__link_set_add_bss2(set, sym, n)    __link_set_make_entry2(set, sym, n)
+
+#define	__link_set_start(set)	(__start_link_set_##set)
+#define	__link_set_end(set)	(__stop_link_set_##set)
+
+#define	__link_set_decl(set, ptype)					\
+	extern ptype * const __link_set_start(set)[] __dso_hidden;	\
+	extern ptype * const __link_set_end(set)[] __weak __dso_hidden
+
+#define	__link_set_count(set)						\
+	(__link_set_end(set) - __link_set_start(set))
+
+
+#ifdef _KERNEL
+
+/*
+ * On multiprocessor systems we can gain an improvement in performance
+ * by being mindful of which cachelines data is placed in.
+ *
+ * __read_mostly:
+ *
+ *	It makes sense to ensure that rarely modified data is not
+ *	placed in the same cacheline as frequently modified data.
+ *	To mitigate the phenomenon known as "false-sharing" we
+ *	can annotate rarely modified variables with __read_mostly.
+ *	All such variables are placed into the .data.read_mostly
+ *	section in the kernel ELF.
+ *
+ *	Prime candidates for __read_mostly annotation are variables
+ *	which are hardly ever modified and which are used in code
+ *	hot-paths, e.g. pmap_initialized.
+ *
+ * __cacheline_aligned:
+ *
+ *	Some data structures (mainly locks) benefit from being aligned
+ *	on a cacheline boundary, and having a cacheline to themselves.
+ *	This way, the modification of other data items cannot adversely
+ *	affect the lock and vice versa.
+ *
+ *	Any variables annotated with __cacheline_aligned will be
+ *	placed into the .data.cacheline_aligned ELF section.
+ */
+#define	__read_mostly						\
+    __attribute__((__section__(".data.read_mostly")))
+
+#define	__cacheline_aligned					\
+    __attribute__((__aligned__(COHERENCY_UNIT),			\
+		 __section__(".data.cacheline_aligned")))
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_CDEFS_ELF_H_ */

Property changes on: lab4/.minix-src/include/sys/cdefs_elf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/exec_aout.h
===================================================================
--- lab4/.minix-src/include/sys/exec_aout.h	(nonexistent)
+++ lab4/.minix-src/include/sys/exec_aout.h	(revision 13)
@@ -0,0 +1,182 @@
+/*	$NetBSD: exec_aout.h,v 1.40 2012/03/17 21:54:12 martin Exp $	*/
+
+/*
+ * Copyright (c) 1993, 1994 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+#ifndef _SYS_EXEC_AOUT_H_
+#define _SYS_EXEC_AOUT_H_
+
+#ifndef N_PAGSIZ
+#define	N_PAGSIZ(ex)	(AOUT_LDPGSZ)
+#endif
+
+/*
+ * Header prepended to each a.out file.
+ * only manipulate the a_midmag field via the
+ * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros below.
+ */
+struct exec {
+	u_long	a_midmag;	/* htonl(flags<<26 | mid<<16 | magic) */
+	u_long	a_text;		/* text segment size */
+	u_long	a_data;		/* initialized data size */
+	u_long	a_bss;		/* uninitialized data size */
+	u_long	a_syms;		/* symbol table size */
+	u_long	a_entry;	/* entry point */
+	u_long	a_trsize;	/* text relocation size */
+	u_long	a_drsize;	/* data relocation size */
+};
+
+/* a_magic */
+#define	OMAGIC		0407	/* old impure format */
+#define	NMAGIC		0410	/* read-only text */
+#define	ZMAGIC		0413	/* demand load format */
+#define	QMAGIC		0314	/* "compact" demand load format; deprecated */
+
+#include <sys/aout_mids.h>
+
+/*
+ * a_flags
+ */
+#define	EX_DYNAMIC	0x20
+#define	EX_PIC		0x10
+#define	EX_DPMASK	0x30
+/*
+ * Interpretation of the (a_flags & EX_DPMASK) bits:
+ *
+ *	00		traditional executable or object file
+ *	01		object file contains PIC code (set by `as -k')
+ *	10		dynamic executable
+ *	11		position independent executable image
+ * 			(eg. a shared library)
+ *
+ */
+
+/*
+ * The a.out structure's a_midmag field is a network-byteorder encoding
+ * of this int
+ *	FFFFFFmmmmmmmmmmMMMMMMMMMMMMMMMM
+ * Where `F' is 6 bits of flag like EX_DYNAMIC,
+ *       `m' is 10 bits of machine-id like MID_I386, and
+ *       `M' is 16 bits worth of magic number, ie. ZMAGIC.
+ * The macros below will set/get the needed fields.
+ */
+#define	N_GETMAGIC(ex) \
+    ((((uint32_t)(ex).a_midmag)&0xffff0000) ? \
+    (be32toh((uint32_t)((ex).a_midmag))&0xffff) : ((ex).a_midmag))
+#define	N_GETMAGIC2(ex) \
+    ((((uint32_t)(ex).a_midmag)&0xffff0000) ? \
+    (be32toh((uint32_t)((ex).a_midmag))&0xffff) : (((ex).a_midmag) | 0x10000))
+#define	N_GETMID(ex) \
+    ((((uint32_t)(ex).a_midmag)&0xffff0000) ? \
+    ((be32toh((uint32_t)((ex).a_midmag))>>16)&0x03ff) : MID_ZERO)
+#define	N_GETFLAG(ex) \
+    ((((uint32_t)(ex).a_midmag)&0xffff0000) ? \
+    ((be32toh((uint32_t)((ex).a_midmag))>>26)&0x3f) : 0)
+#define	N_SETMAGIC(ex,mag,mid,flag) \
+    ((ex).a_midmag = htobe32((uint32_t) \
+    ((((flag)&0x3f)<<26)|(((mid)&0x03ff)<<16)|(((mag)&0xffff)))))
+
+#define	N_ALIGN(ex,x) \
+	(N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC ? \
+	((x) + AOUT_LDPGSZ - 1) & ~(AOUT_LDPGSZ - 1) : (x))
+
+/* Valid magic number check. */
+#define	N_BADMAG(ex) \
+	(N_GETMAGIC(ex) != NMAGIC && N_GETMAGIC(ex) != OMAGIC && \
+	N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC)
+
+/* Address of the bottom of the text segment. */
+#define	N_TXTADDR(ex)	(N_GETMAGIC2(ex) == (ZMAGIC|0x10000) ? 0 : AOUT_LDPGSZ)
+
+/* Address of the bottom of the data segment. */
+#define	N_DATADDR(ex) \
+	(N_GETMAGIC(ex) == OMAGIC ? N_TXTADDR(ex) + (ex).a_text : \
+	(N_TXTADDR(ex) + (ex).a_text + AOUT_LDPGSZ - 1) & ~(AOUT_LDPGSZ - 1))
+
+/* Address of the bottom of the bss segment. */
+#define	N_BSSADDR(ex) \
+	(N_DATADDR(ex) + (ex).a_data)
+
+/* Text segment offset. */
+#define	N_TXTOFF(ex) \
+	( N_GETMAGIC2(ex)==ZMAGIC || N_GETMAGIC2(ex)==(QMAGIC|0x10000) ? \
+	0 : (N_GETMAGIC2(ex)==(ZMAGIC|0x10000) ? AOUT_LDPGSZ : \
+	sizeof(struct exec)) )
+
+/* Data segment offset. */
+#define	N_DATOFF(ex) \
+	N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text)
+
+/* Text relocation table offset. */
+#define	N_TRELOFF(ex) \
+	(N_DATOFF(ex) + (ex).a_data)
+
+/* Data relocation table offset. */
+#define	N_DRELOFF(ex) \
+	(N_TRELOFF(ex) + (ex).a_trsize)
+
+/* Symbol table offset. */
+#define	N_SYMOFF(ex) \
+	(N_DRELOFF(ex) + (ex).a_drsize)
+
+/* String table offset. */
+#define	N_STROFF(ex) \
+	(N_SYMOFF(ex) + (ex).a_syms)
+
+#include <machine/aout_machdep.h>
+
+#ifdef _KERNEL
+
+/* the "a.out" format's entry in the exec switch */
+int	exec_aout_makecmds(struct lwp *, struct exec_package *);
+
+/* functions which prepare various a.out executable types */
+/*
+ * MI portion
+ */
+int	exec_aout_prep_zmagic(struct lwp *, struct exec_package *);
+int	exec_aout_prep_nmagic(struct lwp *, struct exec_package *);
+int	exec_aout_prep_omagic(struct lwp *, struct exec_package *);
+
+/* For compatibility modules */
+int	exec_aout_prep_oldzmagic(struct lwp *, struct exec_package *);
+int	exec_aout_prep_oldnmagic(struct lwp *, struct exec_package *);
+int	exec_aout_prep_oldomagic(struct lwp *, struct exec_package *);
+
+/*
+ * MD portion
+ */
+#ifndef cpu_exec_aout_makecmds
+int	cpu_exec_aout_makecmds(struct lwp *, struct exec_package *);
+#endif
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_EXEC_AOUT_H_ */

Property changes on: lab4/.minix-src/include/sys/exec_aout.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/conf.h
===================================================================
--- lab4/.minix-src/include/sys/conf.h	(nonexistent)
+++ lab4/.minix-src/include/sys/conf.h	(revision 13)
@@ -0,0 +1,280 @@
+/*	$NetBSD: conf.h,v 1.145 2014/07/25 07:56:14 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)conf.h	8.5 (Berkeley) 1/9/95
+ */
+
+#ifndef _SYS_CONF_H_
+#define _SYS_CONF_H_
+
+/*
+ * Definitions of device driver entry switches
+ */
+
+#include <sys/queue.h>
+#include <sys/device_if.h>
+
+struct buf;
+struct knote;
+struct lwp;
+struct tty;
+struct uio;
+struct vnode;
+
+/*
+ * Types for d_flag
+ */
+#define D_OTHER		0x0000
+#define	D_TAPE		0x0001
+#define	D_DISK		0x0002
+#define	D_TTY		0x0003
+#define	D_TYPEMASK	0x00ff
+#define	D_MPSAFE	0x0100
+#define	D_NEGOFFSAFE	0x0200
+
+/*
+ * Block device switch table
+ */
+struct bdevsw {
+	int		(*d_open)(dev_t, int, int, struct lwp *);
+	int		(*d_close)(dev_t, int, int, struct lwp *);
+	void		(*d_strategy)(struct buf *);
+	int		(*d_ioctl)(dev_t, u_long, void *, int, struct lwp *);
+	int		(*d_dump)(dev_t, daddr_t, void *, size_t);
+	int		(*d_psize)(dev_t);
+	int		(*d_discard)(dev_t, off_t, off_t);
+	int		d_flag;
+};
+
+/*
+ * Character device switch table
+ */
+struct cdevsw {
+	int		(*d_open)(dev_t, int, int, struct lwp *);
+	int		(*d_close)(dev_t, int, int, struct lwp *);
+	int		(*d_read)(dev_t, struct uio *, int);
+	int		(*d_write)(dev_t, struct uio *, int);
+	int		(*d_ioctl)(dev_t, u_long, void *, int, struct lwp *);
+	void		(*d_stop)(struct tty *, int);
+	struct tty *	(*d_tty)(dev_t);
+	int		(*d_poll)(dev_t, int, struct lwp *);
+	paddr_t		(*d_mmap)(dev_t, off_t, int);
+	int		(*d_kqfilter)(dev_t, struct knote *);
+	int		(*d_discard)(dev_t, off_t, off_t);
+	int		d_flag;
+};
+
+#ifdef _KERNEL
+
+#include <sys/mutex.h>
+extern kmutex_t device_lock;
+
+int devsw_attach(const char *, const struct bdevsw *, devmajor_t *,
+		 const struct cdevsw *, devmajor_t *);
+int devsw_detach(const struct bdevsw *, const struct cdevsw *);
+const struct bdevsw *bdevsw_lookup(dev_t);
+const struct cdevsw *cdevsw_lookup(dev_t);
+devmajor_t bdevsw_lookup_major(const struct bdevsw *);
+devmajor_t cdevsw_lookup_major(const struct cdevsw *);
+
+#define	dev_type_open(n)	int n (dev_t, int, int, struct lwp *)
+#define	dev_type_close(n)	int n (dev_t, int, int, struct lwp *)
+#define	dev_type_read(n)	int n (dev_t, struct uio *, int)
+#define	dev_type_write(n)	int n (dev_t, struct uio *, int)
+#define	dev_type_ioctl(n) \
+		int n (dev_t, u_long, void *, int, struct lwp *)
+#define	dev_type_stop(n)	void n (struct tty *, int)
+#define	dev_type_tty(n)		struct tty * n (dev_t)
+#define	dev_type_poll(n)	int n (dev_t, int, struct lwp *)
+#define	dev_type_mmap(n)	paddr_t n (dev_t, off_t, int)
+#define	dev_type_strategy(n)	void n (struct buf *)
+#define	dev_type_dump(n)	int n (dev_t, daddr_t, void *, size_t)
+#define	dev_type_size(n)	int n (dev_t)
+#define	dev_type_kqfilter(n)	int n (dev_t, struct knote *)
+#define dev_type_discard(n)	int n (dev_t, off_t, off_t)
+
+#define	noopen		((dev_type_open((*)))enodev)
+#define	noclose		((dev_type_close((*)))enodev)
+#define	noread		((dev_type_read((*)))enodev)
+#define	nowrite		((dev_type_write((*)))enodev)
+#define	noioctl		((dev_type_ioctl((*)))enodev)
+#define	nostop		((dev_type_stop((*)))enodev)
+#define	notty		NULL
+#define	nopoll		seltrue
+#define	nommap		((dev_type_mmap((*)))enodev)
+#define	nodump		((dev_type_dump((*)))enodev)
+#define	nosize		NULL
+#define	nokqfilter	seltrue_kqfilter
+#define nodiscard	((dev_type_discard((*)))enodev)
+
+#define	nullopen	((dev_type_open((*)))nullop)
+#define	nullclose	((dev_type_close((*)))nullop)
+#define	nullread	((dev_type_read((*)))nullop)
+#define	nullwrite	((dev_type_write((*)))nullop)
+#define	nullioctl	((dev_type_ioctl((*)))nullop)
+#define	nullstop	((dev_type_stop((*)))nullop)
+#define	nullpoll	((dev_type_poll((*)))nullop)
+#define	nullmmap	((dev_type_mmap((*)))nullop)
+#define	nulldump	((dev_type_dump((*)))nullop)
+#define	nullkqfilter	((dev_type_kqfilter((*)))eopnotsupp)
+#define nulldiscard	((dev_type_discard((*)))nullop)
+
+/* device access wrappers. */
+
+dev_type_open(bdev_open);
+dev_type_close(bdev_close);
+dev_type_strategy(bdev_strategy);
+dev_type_ioctl(bdev_ioctl);
+dev_type_dump(bdev_dump);
+dev_type_size(bdev_size);
+dev_type_discard(bdev_discard);
+
+dev_type_open(cdev_open);
+dev_type_close(cdev_close);
+dev_type_read(cdev_read);
+dev_type_write(cdev_write);
+dev_type_ioctl(cdev_ioctl);
+dev_type_stop(cdev_stop);
+dev_type_tty(cdev_tty);
+dev_type_poll(cdev_poll);
+dev_type_mmap(cdev_mmap);
+dev_type_kqfilter(cdev_kqfilter);
+dev_type_discard(cdev_discard);
+
+int	cdev_type(dev_t);
+int	bdev_type(dev_t);
+
+/* symbolic sleep message strings */
+extern	const char devopn[], devio[], devwait[], devin[], devout[];
+extern	const char devioc[], devcls[];
+
+#endif /* _KERNEL */
+
+/*
+ * Line discipline switch table
+ */
+struct linesw {
+	const char *l_name;	/* Linesw name */
+
+	LIST_ENTRY(linesw) l_list;
+	u_int	l_refcnt;	/* locked by ttyldisc_list_slock */
+	int	l_no;		/* legacy discipline number (for TIOCGETD) */
+
+	int	(*l_open)	(dev_t, struct tty *);
+	int	(*l_close)	(struct tty *, int);
+	int	(*l_read)	(struct tty *, struct uio *, int);
+	int	(*l_write)	(struct tty *, struct uio *, int);
+	int	(*l_ioctl)	(struct tty *, u_long, void *, int,
+				    struct lwp *);
+	int	(*l_rint)	(int, struct tty *);
+	int	(*l_start)	(struct tty *);
+	int	(*l_modem)	(struct tty *, int);
+	int	(*l_poll)	(struct tty *, int, struct lwp *);
+};
+
+#ifdef _KERNEL
+void	       ttyldisc_init(void);
+int	       ttyldisc_attach(struct linesw *);
+int	       ttyldisc_detach(struct linesw *);
+struct linesw *ttyldisc_lookup(const char *);
+struct linesw *ttyldisc_lookup_bynum(int);
+struct linesw *ttyldisc_default(void);
+void	       ttyldisc_release(struct linesw *);
+
+/* For those defining their own line disciplines: */
+#define	ttynodisc ((int (*)(dev_t, struct tty *))enodev)
+#define	ttyerrclose ((int (*)(struct tty *, int))enodev)
+#define	ttyerrio ((int (*)(struct tty *, struct uio *, int))enodev)
+#define	ttyerrinput ((int (*)(int, struct tty *))enodev)
+#define	ttyerrstart ((int (*)(struct tty *))enodev)
+
+int	ttyerrpoll (struct tty *, int, struct lwp *);
+int	ttynullioctl(struct tty *, u_long, void *, int, struct lwp *);
+
+int	iskmemdev(dev_t);
+int	seltrue_kqfilter(dev_t, struct knote *);
+#endif
+
+#ifdef _KERNEL
+
+#define	DEV_MEM		0	/* minor device 0 is physical memory */
+#define	DEV_KMEM	1	/* minor device 1 is kernel memory */
+#define	DEV_NULL	2	/* minor device 2 is EOF/rathole */
+#ifdef COMPAT_16
+#define	_DEV_ZERO_oARM	3	/* reserved: old ARM /dev/zero minor */
+#endif
+#define	DEV_ZERO	12	/* minor device 12 is '\0'/rathole */
+
+enum devnode_class {
+	DEVNODE_DONTBOTHER,
+	DEVNODE_SINGLE,
+	DEVNODE_VECTOR,
+};
+#define DEVNODE_FLAG_LINKZERO	0x01	/* create name -> name0 link */
+#define DEVNODE_FLAG_ISMINOR0	0x02	/* vector[0] specifies minor */
+#ifdef notyet
+#define DEVNODE_FLAG_ISMINOR1	0x04	/* vector[1] specifies starting minor */
+#endif
+
+struct devsw_conv {
+	const char *d_name;
+	devmajor_t d_bmajor;
+	devmajor_t d_cmajor;
+
+	/* information about /dev nodes related to the device */
+	enum devnode_class d_class;
+	int d_flags;
+	int d_vectdim[2];
+};
+
+void devsw_init(void);
+const char *devsw_blk2name(devmajor_t);
+const char *cdevsw_getname(devmajor_t);
+const char *bdevsw_getname(devmajor_t);
+devmajor_t devsw_name2blk(const char *, char *, size_t);
+devmajor_t devsw_name2chr(const char *, char *, size_t);
+dev_t devsw_chr2blk(dev_t);
+dev_t devsw_blk2chr(dev_t);
+
+void mm_init(void);
+#endif /* _KERNEL */
+
+#ifdef _KERNEL
+void	setroot(device_t, int);
+void	rootconf(void);
+void	swapconf(void);
+#endif /* _KERNEL */
+
+#endif /* !_SYS_CONF_H_ */

Property changes on: lab4/.minix-src/include/sys/conf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/clockctl.h
===================================================================
--- lab4/.minix-src/include/sys/clockctl.h	(nonexistent)
+++ lab4/.minix-src/include/sys/clockctl.h	(revision 13)
@@ -0,0 +1,77 @@
+/*      $NetBSD: clockctl.h,v 1.16 2015/09/06 06:01:02 dholland Exp $ */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Emmanuel Dreyfus.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ *
+ *
+ */
+
+#ifndef _SYS_CLOCKCTL_H_
+#define _SYS_CLOCKCTL_H_
+
+#include <sys/ioccom.h>
+#include <sys/time.h>
+#include <sys/timex.h>
+
+struct clockctl_settimeofday {
+	const struct timeval *tv;
+	const void *tzp;
+};
+
+#define CLOCKCTL_SETTIMEOFDAY _IOW('C', 0x5, struct clockctl_settimeofday)
+
+struct clockctl_adjtime {
+	const struct timeval *delta;
+	struct timeval *olddelta;
+};
+
+#define CLOCKCTL_ADJTIME _IOWR('C', 0x6, struct clockctl_adjtime)
+
+struct clockctl_clock_settime {
+	clockid_t clock_id;
+	const struct timespec *tp;
+};
+
+#define CLOCKCTL_CLOCK_SETTIME _IOW('C', 0x7, struct clockctl_clock_settime)
+
+struct clockctl_ntp_adjtime {
+	struct timex *tp;
+	register_t retval;
+};
+
+#define CLOCKCTL_NTP_ADJTIME _IOWR('C', 0x8, struct clockctl_ntp_adjtime)
+
+#ifdef _KERNEL
+void    clockctlattach(int);
+int     clockctlopen(dev_t, int, int, struct lwp *);
+int     clockctlclose(dev_t, int, int, struct lwp *);
+int     clockctlioctl(dev_t, u_long, void *, int, struct lwp *);
+#endif
+
+#endif /* _SYS_CLOCKCTL_H_ */

Property changes on: lab4/.minix-src/include/sys/clockctl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ctype_bits.h
===================================================================
--- lab4/.minix-src/include/sys/ctype_bits.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ctype_bits.h	(revision 13)
@@ -0,0 +1,68 @@
+/* $NetBSD: ctype_bits.h,v 1.5 2013/04/30 00:42:31 joerg Exp $ */
+
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ctype.h	5.3 (Berkeley) 4/3/91
+ *	NetBSD: ctype.h,v 1.30 2010/05/22 06:38:15 tnozaki Exp
+ */
+
+#ifndef _SYS_CTYPE_BITS_H_
+#define _SYS_CTYPE_BITS_H_
+
+#define	_CTYPE_A	0x0001	/* Alpha     */
+#define	_CTYPE_C	0x0002	/* Control   */
+#define	_CTYPE_D	0x0004	/* Digit     */
+#define	_CTYPE_G	0x0008	/* Graph     */
+#define	_CTYPE_L	0x0010	/* Lower     */
+#define	_CTYPE_P	0x0020	/* Punct     */
+#define	_CTYPE_S	0x0040	/* Space     */
+#define	_CTYPE_U	0x0080	/* Upper     */
+#define	_CTYPE_X	0x0100	/* X digit   */
+#define	_CTYPE_BL	0x0200	/* Blank     */
+#define	_CTYPE_R	0x0400	/* Print     */
+#define	_CTYPE_I	0x0800	/* Ideogram  */
+#define	_CTYPE_T	0x1000	/* Special   */
+#define	_CTYPE_Q	0x2000	/* Phonogram */
+
+__BEGIN_DECLS
+extern const unsigned short	*_ctype_tab_;
+extern const short	*_tolower_tab_;
+extern const short	*_toupper_tab_;
+
+extern const unsigned short _C_ctype_tab_[];
+extern const short _C_toupper_tab_[];
+extern const short _C_tolower_tab_[];
+__END_DECLS
+
+#endif /* !_SYS_CTYPE_BITS_H_ */

Property changes on: lab4/.minix-src/include/sys/ctype_bits.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/exec_script.h
===================================================================
--- lab4/.minix-src/include/sys/exec_script.h	(nonexistent)
+++ lab4/.minix-src/include/sys/exec_script.h	(revision 13)
@@ -0,0 +1,49 @@
+/*	$NetBSD: exec_script.h,v 1.12 2005/12/11 12:25:20 christos Exp $	*/
+
+/*
+ * Copyright (c) 1994 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+#ifndef _SYS_EXEC_SCRIPT_H_
+#define _SYS_EXEC_SCRIPT_H_
+
+#define	EXEC_SCRIPT_MAGIC	"#!"
+#define	EXEC_SCRIPT_MAGICLEN	2
+
+/* Extra 2 are for possible space between #! and shell name, and newline.  */
+#define SCRIPT_HDR_SIZE		(EXEC_SCRIPT_MAGICLEN + MAXINTERP + 2)
+
+#ifdef _KERNEL
+
+/* the shell script handler's entry in the exec switch */
+int	exec_script_makecmds(struct lwp *, struct exec_package *);
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_EXEC_SCRIPT_H_ */

Property changes on: lab4/.minix-src/include/sys/exec_script.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/disklabel_rdb.h
===================================================================
--- lab4/.minix-src/include/sys/disklabel_rdb.h	(nonexistent)
+++ lab4/.minix-src/include/sys/disklabel_rdb.h	(revision 13)
@@ -0,0 +1,231 @@
+/*	$NetBSD: disklabel_rdb.h,v 1.2 2010/06/19 08:45:25 kiyohara Exp $	*/
+
+/*
+ * Copyright (c) 1994 Christian E. Hopps
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christian E. Hopps.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+#ifndef _SYS_DISKLABEL_RDB_H_
+#define _SYS_DISKLABEL_RDB_H_
+
+/*
+ * describes ados Rigid Disk Blocks
+ * which are used to partition a drive
+ */
+#define RDBNULL ((u_long)0xffffffff)
+
+/*
+ * you will find rdblock somewhere in [0, RDBMAXBLOCKS)
+ */
+#define RDB_MAXBLOCKS	16
+
+struct rdblock {
+	u_long id;		/* 'RDSK' */
+	u_long nsumlong;	/* number of longs in check sum */
+	u_long chksum;		/* simple additive with wrap checksum */
+	u_long hostid;		/* scsi target of host */
+	u_long nbytes;		/* size of disk blocks */
+	u_long flags;
+	u_long badbhead;	/* linked list of badblocks */
+	u_long partbhead;	/* linked list of partblocks */
+	u_long fsbhead;		/*   "     "   of fsblocks */
+	u_long driveinit;
+	u_long resv1[6];	/* RDBNULL */
+	u_long ncylinders;	/* number of cylinders on drive */
+	u_long nsectors;	/* number of sectors per track */
+	u_long nheads;		/* number of tracks per cylinder */
+	u_long interleave;
+	u_long park;		/* only used with st506 i.e. not */
+	u_long resv2[3];
+	u_long wprecomp;	/* start cyl for write precomp */
+	u_long reducedwrite;	/* start cyl for reduced write current */
+	u_long steprate;	/* driver step rate in ?s */
+	u_long resv3[5];
+	u_long rdblowb;		/* lowblock of range for rdb's */
+	u_long rdbhighb;	/* high block of range for rdb's */
+	u_long lowcyl;		/* low cylinder of partition area */
+	u_long highcyl;		/* upper cylinder of partition area */
+	u_long secpercyl;	/* number of sectors per cylinder */
+	u_long parkseconds;	/* zero if no park needed */
+	u_long resv4[2];
+	char   diskvendor[8];	/* inquiry stuff */
+	char   diskproduct[16];	/* inquiry stuff */
+	char   diskrevision[4];	/* inquiry stuff */
+	char   contvendor[8];	/* inquiry stuff */
+	char   contproduct[16];	/* inquiry stuff */
+	char   contrevision[4];	/* inquiry stuff */
+#if never_use_secsize
+	u_long resv5[0];
+#endif
+};
+
+
+#define RDBF_LAST	0x1	/* last drive available */
+#define RDBF_LASTLUN	0x2	/* last LUN available */
+#define RDBF_LASTUNIT	0x4	/* last target available */
+#define RDBF_NORESELECT	0x8	/* do not use reselect */
+#define RDBF_DISKID	0x10	/* disk id is valid ?? */
+#define RDBF_CTRLID	0x20	/* ctrl id is valid ?? */
+#define RDBF_SYNC	0x40	/* drive supports SCSI synchronous mode */
+	
+struct ados_environ {
+	u_long tabsize;		/* 0: environ table size */
+	u_long sizeblock;	/* 1: n long words in a block */
+	u_long secorg;		/* 2: not used must be zero */
+	u_long numheads;	/* 3: number of surfaces */
+	u_long secperblk;	/* 4: must be 1 */
+	u_long secpertrk;	/* 5: blocks per track */
+	u_long resvblocks;	/* 6: reserved blocks at start */
+	u_long prefac;		/* 7: must be 0 */
+	u_long interleave;	/* 8: normally 1 */
+	u_long lowcyl;		/* 9: low cylinder of partition */
+	u_long highcyl;		/* 10: upper cylinder of partition */
+	u_long numbufs;		/* 11: ados: number of buffers */
+	u_long membuftype;	/* 12: ados: type of bufmem */
+	u_long maxtrans;	/* 13: maxtrans the ctrlr supports */
+	u_long mask;		/* 14: mask for valid address */
+	u_long bootpri;		/* 15: boot priority for autoboot */
+	u_long dostype;		/* 16: filesystem type */
+	u_long baud;		/* 17: serial handler baud rate */
+	u_long control;		/* 18: control word for fs */
+	u_long bootblocks;	/* 19: blocks containing boot code */
+	u_long fsize;		/* 20: file system block size */
+	u_long frag;		/* 21: allowable frags per block */
+	u_long cpg;		/* 22: cylinders per group */
+};
+
+struct partblock {
+	u_long id;		/* 'PART' */
+	u_long nsumlong;	/* number of longs in check sum */
+	u_long chksum;		/* simple additive with wrap checksum */
+	u_long hostid;		/* scsi target of host */
+	u_long next;		/* next in chain */
+	u_long flags;		/* see below */
+	u_long resv1[3];
+	u_char partname[32];	/* (BCPL) part name (may not be unique) */
+	u_long resv2[15];
+	struct ados_environ e;
+#if never_use_secsize
+	u_long extra[9];	/* 8 for extra added to environ */
+#endif
+};
+
+#define PBF_BOOTABLE	0x1	/* partition is bootable */
+#define PBF_NOMOUNT	0x2	/* partition should be mounted */
+
+struct badblock {
+	u_long id;		/* 'BADB' */
+	u_long nsumlong;	/* number of longs in check sum */
+	u_long chksum;		/* simple additive with wrap checksum */
+	u_long hostid;		/* scsi target of host */
+	u_long next;		/* next in chain */
+	u_long resv;
+	struct badblockent {
+		u_long badblock;
+		u_long goodblock;
+	} badtab[0];		/* 61 for secsize == 512 */
+};
+
+struct fsblock {
+	u_long id;		/* 'FSHD' */
+	u_long nsumlong;	/* number of longs in check sum */
+	u_long chksum;		/* simple additive with wrap checksum */
+	u_long hostid;		/* scsi target of host */
+	u_long next;		/* next in chain */
+	u_long flags;
+	u_long resv1[2];
+	u_long dostype;		/* this is a file system for this type */
+	u_long version;		/* version of this fs */
+	u_long patchflags;	/* describes which functions to replace */
+	u_long type;		/* zero */
+	u_long task;		/* zero */
+	u_long lock;		/* zero */
+	u_long handler;		/* zero */
+	u_long stacksize;	/* to use when loading handler */
+	u_long priority;	/* to run the fs at. */
+	u_long startup;		/* zero */
+	u_long lsegblocks;	/* linked list of lsegblocks of fs code */
+	u_long globalvec;	/* bcpl vector not used mostly */
+#if never_use_secsize
+	u_long resv2[44];
+#endif
+};
+
+struct lsegblock {
+	u_long id;		/* 'LSEG' */
+	u_long nsumlong;	/* number of longs in check sum */
+	u_long chksum;		/* simple additive with wrap checksum */
+	u_long hostid;		/* scsi target of host */
+	u_long next;		/* next in chain */
+	u_long loaddata[0];	/* load segment data, 123 for secsize == 512 */
+};
+
+#define RDBLOCK_ID	0x5244534b	/* 'RDSK' */
+#define PARTBLOCK_ID	0x50415254	/* 'PART' */
+#define BADBLOCK_ID	0x42414442	/* 'BADB' */
+#define FSBLOCK_ID	0x46534844	/* 'FSHD' */
+#define LSEGBLOCK_ID	0x4c534547	/* 'LSEG' */
+
+/*
+ * Dos types for identifying file systems
+ * bsd file systems will be 'N','B',x,y where y is the fstype found in
+ * disklabel.h (for DOST_DOS it will be the version number)
+ */
+#define DOST_XXXBSD	0x42534400	/* Old type back compat*/
+#define DOST_NBR	0x4e425200	/* 'NBRx' NetBSD root partition */
+#define DOST_NBS	0x4e425300	/* 'NBS0' NetBSD swap partition */
+#define DOST_NBU	0x4e425500	/* 'NBUx' NetBSD user partition */
+#define DOST_DOS	0x444f5300	/* 'DOSx' AmigaDos partition */
+#define DOST_AMIX	0x554e4900	/* 'UNIx' AmigaDos partition */
+#define DOST_MUFS	0x6d754600	/* 'muFx' AmigaDos partition (muFS) */
+#define DOST_EXT2	0x4c4e5800	/* 'LNX0' Linux fs partition (ext2fs) */
+#define DOST_LNXSWP	0x53575000	/* 'SWP0' Linux swap partition */
+#define DOST_RAID	0x52414900	/* 'RAID' Raidframe partition */
+#define DOST_MSD	0x4d534400	/* 'MSDx' MSDOS partition */
+#define DOST_SFS	0x53465300	/* 'SFSx' Smart fs partition */
+
+struct adostype {
+	u_char archtype;	/* see ADT_xxx below */
+	u_char fstype;		/* byte 3 from amiga dostype */
+};
+
+/* archtypes */
+#define ADT_UNKNOWN	0
+#define ADT_AMIGADOS	1
+#define ADT_NETBSDROOT	2
+#define ADT_NETBSDSWAP	3
+#define ADT_NETBSDUSER	4
+#define ADT_AMIX	5
+#define ADT_EXT2	6
+#define ADT_RAID	7
+#define ADT_MSD		8
+#define ADT_SFS		9
+
+#define ISFSARCH_NETBSD(adt) \
+	((adt).archtype >= ADT_NETBSDROOT && (adt).archtype <= ADT_NETBSDUSER)
+
+#endif /* _SYS_DISKLABEL_RDB_H_ */

Property changes on: lab4/.minix-src/include/sys/disklabel_rdb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/common_int_limits.h
===================================================================
--- lab4/.minix-src/include/sys/common_int_limits.h	(nonexistent)
+++ lab4/.minix-src/include/sys/common_int_limits.h	(revision 13)
@@ -0,0 +1,130 @@
+/*	$NetBSD: common_int_limits.h,v 1.1 2014/07/25 21:43:13 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_COMMON_INT_LIMITS_H_
+#define _SYS_COMMON_INT_LIMITS_H_
+
+#ifndef __SIG_ATOMIC_MAX__
+#error Your compiler does not provide limit macros.
+#endif
+
+/*
+ * 7.18.2 Limits of specified-width integer types
+ */
+
+/* 7.18.2.1 Limits of exact-width integer types */
+
+/* minimum values of exact-width signed integer types */
+#define	INT8_MIN		(-__INT8_MAX__-1)
+#define	INT16_MIN		(-__INT16_MAX__-1)
+#define	INT32_MIN		(-__INT32_MAX__-1)
+#define	INT64_MIN		(-__INT64_MAX__-1)
+
+/* maximum values of exact-width signed integer types */
+#define	INT8_MAX		__INT8_MAX__
+#define	INT16_MAX		__INT16_MAX__
+#define	INT32_MAX		__INT32_MAX__
+#define	INT64_MAX		__INT64_MAX__
+
+/* maximum values of exact-width unsigned integer types */
+#define	UINT8_MAX		__UINT8_MAX__
+#define	UINT16_MAX		__UINT16_MAX__
+#define	UINT32_MAX		__UINT32_MAX__
+#define	UINT64_MAX		__UINT64_MAX__
+
+/* 7.18.2.2 Limits of minimum-width integer types */
+
+/* minimum values of minimum-width signed integer types */
+#define	INT_LEAST8_MIN		(-__INT_LEAST8_MAX__-1)
+#define	INT_LEAST16_MIN		(-__INT_LEAST16_MAX__-1)
+#define	INT_LEAST32_MIN		(-__INT_LEAST32_MAX__-1)
+#define	INT_LEAST64_MIN		(-__INT_LEAST64_MAX__-1)
+
+/* maximum values of minimum-width signed integer types */
+#define	INT_LEAST8_MAX		__INT_LEAST8_MAX__
+#define	INT_LEAST16_MAX		__INT_LEAST16_MAX__
+#define	INT_LEAST32_MAX		__INT_LEAST32_MAX__
+#define	INT_LEAST64_MAX		__INT_LEAST64_MAX__
+
+/* maximum values of minimum-width unsigned integer types */
+#define	UINT_LEAST8_MAX 	__UINT_LEAST8_MAX__
+#define	UINT_LEAST16_MAX	__UINT_LEAST16_MAX__
+#define	UINT_LEAST32_MAX	__UINT_LEAST32_MAX__
+#define	UINT_LEAST64_MAX	__UINT_LEAST64_MAX__
+
+/* 7.18.2.3 Limits of fastest minimum-width integer types */
+ 
+/* minimum values of fastest minimum-width signed integer types */
+#define	INT_FAST8_MIN		(-__INT_FAST8_MAX__-1)
+#define	INT_FAST16_MIN		(-__INT_FAST16_MAX__-1)
+#define	INT_FAST32_MIN		(-__INT_FAST32_MAX__-1)
+#define	INT_FAST64_MIN		(-__INT_FAST64_MAX__-1)
+
+/* maximum values of fastest minimum-width signed integer types */
+#define	INT_FAST8_MAX		__INT_FAST8_MAX__
+#define	INT_FAST16_MAX		__INT_FAST16_MAX__
+#define	INT_FAST32_MAX		__INT_FAST32_MAX__
+#define	INT_FAST64_MAX		__INT_FAST64_MAX__
+
+/* maximum values of fastest minimum-width unsigned integer types */
+#define	UINT_FAST8_MAX 	__UINT_FAST8_MAX__
+#define	UINT_FAST16_MAX	__UINT_FAST16_MAX__
+#define	UINT_FAST32_MAX	__UINT_FAST32_MAX__
+#define	UINT_FAST64_MAX	__UINT_FAST64_MAX__
+
+/* 7.18.2.4 Limits of integer types capable of holding object pointers */
+#define	INTPTR_MIN	(-__INTPTR_MAX__-1)
+#define	INTPTR_MAX	__INTPTR_MAX__
+#define	UINTPTR_MAX	__UINTPTR_MAX__
+
+/* 7.18.2.5 Limits of greatest-width integer types */
+
+#define	INTMAX_MIN	(-__INTMAX_MAX__-1)
+#define	INTMAX_MAX	__INTMAX_MAX__
+#define	UINTMAX_MAX	__UINTMAX_MAX__
+
+
+/*
+ * 7.18.3 Limits of other integer types
+ */
+
+/* limits of ptrdiff_t */
+#define	PTRDIFF_MIN	(-__PTRDIFF_MAX__-1)
+#define	PTRDIFF_MAX	__PTRDIFF_MAX__
+
+/* limits of sig_atomic_t */
+#define	SIG_ATOMIC_MIN	(-__SIG_ATOMIC_MAX__-1)
+#define	SIG_ATOMIC_MAX	__SIG_ATOMIC_MAX__
+
+/* limit of size_t */
+#define	SIZE_MAX	__SIZE_MAX__
+
+#endif /* _SYS_COMMON_INT_LIMITS_H_ */

Property changes on: lab4/.minix-src/include/sys/common_int_limits.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/domain.h
===================================================================
--- lab4/.minix-src/include/sys/domain.h	(nonexistent)
+++ lab4/.minix-src/include/sys/domain.h	(revision 13)
@@ -0,0 +1,109 @@
+/*	$NetBSD: domain.h,v 1.32 2015/04/22 19:46:08 roy Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)domain.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_DOMAIN_H_
+#define _SYS_DOMAIN_H_
+
+/*
+ * Structure per communications domain.
+ */
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+#include <net/route.h>
+
+/*
+ * Forward structure declarations for function prototypes [sic].
+ */
+struct	lwp;
+struct	mbuf;
+struct	ifnet;
+struct	ifqueue;
+struct  sockaddr;
+
+LIST_HEAD(dom_rtlist, route);
+
+struct	domain {
+	int	dom_family;		/* AF_xxx */
+	const char *dom_name;
+	void	(*dom_init)		/* initialize domain data structures */
+			(void);
+	int	(*dom_externalize)	/* externalize access rights */
+			(struct mbuf *, struct lwp *, int);
+	void	(*dom_dispose)		/* dispose of internalized rights */
+			(struct mbuf *);
+	const struct protosw *dom_protosw, *dom_protoswNPROTOSW;
+	int	(*dom_rtattach)		/* initialize routing table */
+			(rtbl_t **, int);
+	int	dom_rtoffset;		/* an arg to rtattach, in bits */
+	int	dom_maxrtkey;		/* for routing layer */
+	void	(*dom_if_up)		/* ifnet brought up */
+			(struct ifnet *);
+	void	(*dom_if_down)		/* ifnet brought down */
+			(struct ifnet *);
+	void	*(*dom_ifattach)	/* attach af-dependent data on ifnet */
+			(struct ifnet *);
+	void	(*dom_ifdetach)		/* detach af-dependent data on ifnet */
+			(struct ifnet *, void *);
+	void	(*dom_if_link_state_change)
+			(struct ifnet *, int);
+	const void *(*dom_sockaddr_const_addr)(const struct sockaddr *,
+					       socklen_t *);
+	void	*(*dom_sockaddr_addr)(struct sockaddr *, socklen_t *);
+	int	(*dom_sockaddr_cmp)(const struct sockaddr *,
+	                            const struct sockaddr *);
+	struct sockaddr *(*dom_sockaddr_externalize)(struct sockaddr *,
+	                                             socklen_t,
+						     const struct sockaddr *);
+	const struct sockaddr *dom_sa_any;
+	struct ifqueue *dom_ifqueues[2]; /* ifqueue for domain */
+	STAILQ_ENTRY(domain) dom_link;
+	struct	mowner dom_mowner;
+	uint_fast8_t	dom_sa_cmpofs;
+	uint_fast8_t	dom_sa_cmplen;
+	struct dom_rtlist dom_rtcache;
+};
+
+STAILQ_HEAD(domainhead,domain);
+
+#ifdef _KERNEL
+#define	DOMAIN_DEFINE(name)	\
+	extern struct domain name; \
+	__link_set_add_data(domains, name)
+
+#define	DOMAIN_FOREACH(dom)	STAILQ_FOREACH(dom, &domains, dom_link)
+extern struct domainhead domains;
+void domain_attach(struct domain *);
+void domaininit(bool);
+#endif
+
+#endif /* !_SYS_DOMAIN_H_ */

Property changes on: lab4/.minix-src/include/sys/domain.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/fd_set.h
===================================================================
--- lab4/.minix-src/include/sys/fd_set.h	(nonexistent)
+++ lab4/.minix-src/include/sys/fd_set.h	(revision 13)
@@ -0,0 +1,110 @@
+/*	$NetBSD: fd_set.h,v 1.5 2010/07/08 18:56:17 rmind Exp $	*/
+
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	from: @(#)types.h	8.4 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_FD_SET_H_
+#define	_SYS_FD_SET_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <machine/int_types.h>
+
+/*
+ * Implementation dependent defines, hidden from user space.
+ * POSIX does not specify them.
+ */
+
+typedef	__uint32_t	__fd_mask;
+
+/* 32 = 2 ^ 5 */
+#define	__NFDBITS	(32)
+#define	__NFDSHIFT	(5)
+#define	__NFDMASK	(__NFDBITS - 1)
+
+/*
+ * Select uses bit fields of file descriptors.  These macros manipulate
+ * such bit fields.  Note: FD_SETSIZE may be defined by the user.
+ */
+
+#ifndef	FD_SETSIZE
+#if defined(__minix)
+#define	FD_SETSIZE	255
+#else
+#define	FD_SETSIZE	256
+#endif /* defined(__minix) */
+#endif
+
+#define	__NFD_SIZE	(((FD_SETSIZE) + (__NFDBITS - 1)) / __NFDBITS)
+
+typedef	struct fd_set {
+	__fd_mask	fds_bits[__NFD_SIZE];
+} fd_set;
+
+#define	FD_SET(n, p)	\
+    ((p)->fds_bits[(unsigned)(n) >> __NFDSHIFT] |= (1 << ((n) & __NFDMASK)))
+#define	FD_CLR(n, p)	\
+    ((p)->fds_bits[(unsigned)(n) >> __NFDSHIFT] &= ~(1 << ((n) & __NFDMASK)))
+#define	FD_ISSET(n, p)	\
+    ((p)->fds_bits[(unsigned)(n) >> __NFDSHIFT] & (1 << ((n) & __NFDMASK)))
+#if __GNUC_PREREQ__(2, 95)
+#define	FD_ZERO(p)	(void)__builtin_memset((p), 0, sizeof(*(p)))
+#else
+#define	FD_ZERO(p)	do {						\
+	fd_set *__fds = (p);						\
+	unsigned int __i;						\
+	for (__i = 0; __i < __NFD_SIZE; __i++)				\
+		__fds->fds_bits[__i] = 0;				\
+	} while (/* CONSTCOND */ 0)
+#endif /* GCC 2.95 */
+
+/*
+ * Expose our internals if we are not required to hide them.
+ */
+#if defined(_NETBSD_SOURCE)
+
+#define	fd_mask		__fd_mask
+#define	NFDBITS		__NFDBITS
+
+#if __GNUC_PREREQ__(2, 95)
+#define	FD_COPY(f, t)	(void)__builtin_memcpy((t), (f), sizeof(*(f)))
+#else
+#define	FD_COPY(f, t)	do {						\
+	fd_set *__f = (f), *__t = (t);					\
+	unsigned int __i;						\
+	for (__i = 0; __i < __NFD_SIZE; __i++)				\
+		__t->fds_bits[__i] = __f->fds_bits[__i];		\
+	} while (/* CONSTCOND */ 0)
+#endif /* GCC 2.95 */
+
+#endif /* _NETBSD_SOURCE */
+
+#endif /* _SYS_FD_SET_H_ */

Property changes on: lab4/.minix-src/include/sys/fd_set.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/dir.h
===================================================================
--- lab4/.minix-src/include/sys/dir.h	(nonexistent)
+++ lab4/.minix-src/include/sys/dir.h	(revision 13)
@@ -0,0 +1,64 @@
+/*	$NetBSD: dir.h,v 1.11 2005/12/11 12:25:20 christos Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dir.h	8.2 (Berkeley) 1/4/94
+ */
+
+/*
+ * The information in this file should be obtained from <dirent.h>
+ * and is provided solely (and temporarily) for backward compatibility.
+ */
+
+#ifndef _SYS_DIR_H_
+#define	_SYS_DIR_H_
+
+#ifdef	_KERNEL
+/* This file should only be used by old user-level code. */
+#error "Please use <sys/dirent.h> instead"
+#endif
+
+#include <dirent.h>
+
+/*
+ * Backwards compatibility.
+ */
+#define direct dirent
+
+/*
+ * The DIRSIZ macro gives the minimum record length which will hold
+ * the directory entry.  This requires the amount of space in struct direct
+ * without the d_name field, plus enough space for the name with a terminating
+ * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
+ */
+#undef DIRSIZ
+#define DIRSIZ(dp) \
+    ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
+
+#endif /* !_SYS_DIR_H_ */

Property changes on: lab4/.minix-src/include/sys/dir.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/common_lock.h
===================================================================
--- lab4/.minix-src/include/sys/common_lock.h	(nonexistent)
+++ lab4/.minix-src/include/sys/common_lock.h	(revision 13)
@@ -0,0 +1,102 @@
+/* $NetBSD: common_lock.h,v 1.1 2015/06/26 14:27:35 matt Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Machine-dependent spin lock operations using the builtin compiler atomic
+ * primitives.
+ */
+
+#ifndef _SYS_COMMON_LOCK_H_
+#define	_SYS_COMMON_LOCK_H_
+
+static __inline int
+__SIMPLELOCK_LOCKED_P(__cpu_simple_lock_t *__ptr)
+{
+	return *__ptr != __SIMPLELOCK_UNLOCKED;
+}
+
+static __inline int
+__SIMPLELOCK_UNLOCKED_P(__cpu_simple_lock_t *__ptr)
+{
+	return *__ptr == __SIMPLELOCK_UNLOCKED;
+}
+
+static __inline void
+__cpu_simple_lock_clear(__cpu_simple_lock_t *__ptr)
+{
+#if 1
+	*__ptr = __SIMPLELOCK_UNLOCKED;
+#else
+	__atomic_store_n(__ptr, __SIMPLELOCK_UNLOCKED, __ATOMIC_RELAXED);
+#endif
+}
+
+static __inline void
+__cpu_simple_lock_set(__cpu_simple_lock_t *__ptr)
+{
+#if 1
+	*__ptr = __SIMPLELOCK_LOCKED;
+#else
+	__atomic_store_n(__ptr, __SIMPLELOCK_LOCKED, __ATOMIC_RELAXED);
+#endif
+}
+
+static __inline void __unused
+__cpu_simple_lock_init(__cpu_simple_lock_t *__ptr)
+{
+#if 1
+	*__ptr = __SIMPLELOCK_UNLOCKED;
+#else
+	__atomic_store_n(__ptr, __SIMPLELOCK_UNLOCKED, __ATOMIC_RELAXED);
+#endif
+}
+
+static __inline void __unused
+__cpu_simple_lock(__cpu_simple_lock_t *__ptr)
+{
+	while (__atomic_exchange_n(__ptr, __SIMPLELOCK_LOCKED, __ATOMIC_ACQUIRE) == __SIMPLELOCK_LOCKED) {
+		/* do nothing */
+	}
+}
+
+static __inline int __unused
+__cpu_simple_lock_try(__cpu_simple_lock_t *__ptr)
+{
+	return __atomic_exchange_n(__ptr, __SIMPLELOCK_LOCKED, __ATOMIC_ACQUIRE) == __SIMPLELOCK_UNLOCKED;
+}
+
+static __inline void __unused
+__cpu_simple_unlock(__cpu_simple_lock_t *__ptr)
+{
+	__atomic_store_n(__ptr, __SIMPLELOCK_UNLOCKED, __ATOMIC_RELEASE);
+}
+
+#endif /* _SYS_COMMON_LOCK_H_ */

Property changes on: lab4/.minix-src/include/sys/common_lock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/filedesc.h
===================================================================
--- lab4/.minix-src/include/sys/filedesc.h	(nonexistent)
+++ lab4/.minix-src/include/sys/filedesc.h	(revision 13)
@@ -0,0 +1,243 @@
+/*	$NetBSD: filedesc.h,v 1.63 2012/02/11 23:16:18 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)filedesc.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_FILEDESC_H_
+#define	_SYS_FILEDESC_H_
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/mutex.h>
+#include <sys/rwlock.h>
+#include <sys/condvar.h>
+
+/*
+ * This structure is used for the management of descriptors.  It may be
+ * shared by multiple processes.
+ *
+ * A process is initially started out with NDFILE descriptors stored within
+ * this structure, selected to be enough for typical applications based on
+ * the historical limit of 20 open files (and the usage of descriptors by
+ * shells).  If these descriptors are exhausted, a larger descriptor table
+ * may be allocated, up to a process' resource limit; the internal arrays
+ * are then unused.  The initial expansion is set to NDEXTENT; each time
+ * it runs out, it is doubled until the resource limit is reached. NDEXTENT
+ * should be selected to be the biggest multiple of OFILESIZE (see below)
+ * that will fit in a power-of-two sized piece of memory.
+ */
+#define	NDFILE		20
+#define	NDEXTENT	50		/* 250 bytes in 256-byte alloc */
+#define	NDENTRIES	32		/* 32 fds per entry */
+#define	NDENTRYMASK	(NDENTRIES - 1)
+#define	NDENTRYSHIFT	5		/* bits per entry */
+#define	NDLOSLOTS(x)	(((x) + NDENTRIES - 1) >> NDENTRYSHIFT)
+#define	NDHISLOTS(x)	((NDLOSLOTS(x) + NDENTRIES - 1) >> NDENTRYSHIFT)
+#define	NDFDFILE	6		/* first 6 descriptors are free */
+
+/*
+ * Process-private descriptor reference, one for each descriptor slot
+ * in use.  Locks:
+ *
+ * :	unlocked
+ * a	atomic operations + filedesc_t::fd_lock in some cases
+ * d	filedesc_t::fd_lock
+ *
+ * Note that ff_exclose and ff_allocated are likely to be byte sized
+ * (bool).  In general adjacent sub-word sized fields must be locked
+ * the same way, but in this case it's ok: ff_exclose can only be
+ * modified while the descriptor slot is live, and ff_allocated when
+ * it's invalid.
+ */
+typedef struct fdfile {
+	bool		ff_exclose;	/* :: close on exec flag */
+	bool		ff_allocated;	/* d: descriptor slot is allocated */
+	u_int		ff_refcnt;	/* a: reference count on structure */
+	struct file	*ff_file;	/* d: pointer to file if open */
+	SLIST_HEAD(,knote) ff_knlist;	/* d: knotes attached to this fd */
+	kcondvar_t	ff_closing;	/* d: notifier for close */
+} fdfile_t;
+
+/* Reference count */
+#define	FR_CLOSING	(0x80000000)	/* closing: must interlock */
+#define	FR_MASK		(~FR_CLOSING)	/* reference count */
+
+/*
+ * Open file table, potentially many 'active' tables per filedesc_t
+ * in a multi-threaded process, or with a shared filedesc_t (clone()).
+ * nfiles is first to avoid pointer arithmetic.
+ */
+typedef struct fdtab {
+	u_int		dt_nfiles;	/* number of open files allocated */
+	struct fdtab	*dt_link;	/* for lists of dtab */
+	fdfile_t	*dt_ff[NDFILE];	/* file structures for open fds */
+} fdtab_t;
+
+typedef struct filedesc {
+	/*
+	 * Built-in fdfile_t records first, since they have strict
+	 * alignment requirements.
+	 */
+	uint8_t		fd_dfdfile[NDFDFILE][CACHE_LINE_SIZE];
+	/*
+	 * All of the remaining fields are locked by fd_lock.
+	 */
+	kmutex_t	fd_lock;	/* lock on structure */
+	fdtab_t * volatile fd_dt;	/* active descriptor table */
+	uint32_t	*fd_himap;	/* each bit points to 32 fds */
+	uint32_t	*fd_lomap;	/* bitmap of free fds */
+	struct klist	*fd_knhash;	/* hash of attached non-fd knotes */
+	int		fd_lastkqfile;	/* max descriptor for kqueue */
+	int		fd_lastfile;	/* high-water mark of fd_ofiles */
+	int		fd_refcnt;	/* reference count */
+	u_long		fd_knhashmask;	/* size of fd_knhash */
+	int		fd_freefile;	/* approx. next free file */
+	int		fd_unused;	/* unused */
+	bool		fd_exclose;	/* non-zero if >0 fd with EXCLOSE */
+	/*
+	 * This structure is used when the number of open files is
+	 * <= NDFILE, and are then pointed to by the pointers above.
+	 */
+	fdtab_t		fd_dtbuiltin;
+	/*
+	 * These arrays are used when the number of open files is
+	 * <= 1024, and are then pointed to by the pointers above.
+	 */
+#define fd_startzero	fd_dhimap	/* area to zero on return to cache */
+	uint32_t	fd_dhimap[NDENTRIES >> NDENTRYSHIFT];
+	uint32_t	fd_dlomap[NDENTRIES];
+} filedesc_t;
+
+typedef struct cwdinfo {
+	struct vnode	*cwdi_cdir;	/* current directory */
+	struct vnode	*cwdi_rdir;	/* root directory */
+	struct vnode	*cwdi_edir;	/* emulation root (if known) */
+	krwlock_t	cwdi_lock;	/* lock on entire struct */
+	u_short		cwdi_cmask;	/* mask for file creation */
+	u_int		cwdi_refcnt;	/* reference count */
+} cwdinfo_t;
+
+#ifdef _KERNEL
+
+struct fileops;
+struct socket;
+struct proc;
+
+/*
+ * Kernel global variables and routines.
+ */
+void	fd_sys_init(void);
+int	fd_open(const char*, int, int, int*);
+int	fd_dupopen(int, int *, int, int);
+int	fd_alloc(struct proc *, int, int *);
+void	fd_tryexpand(struct proc *);
+int	fd_allocfile(file_t **, int *);
+void	fd_affix(struct proc *, file_t *, unsigned);
+void	fd_abort(struct proc *, file_t *, unsigned);
+filedesc_t *fd_copy(void);
+filedesc_t *fd_init(filedesc_t *);
+void	fd_share(proc_t *);
+void	fd_hold(lwp_t *);
+void	fd_free(void);
+void	fd_closeexec(void);
+void	fd_ktrexecfd(void);
+int	fd_checkstd(void);
+file_t	*fd_getfile(unsigned);
+file_t	*fd_getfile2(proc_t *, unsigned);
+void	fd_putfile(unsigned);
+int	fd_getvnode(unsigned, file_t **);
+int	fd_getsock(unsigned, struct socket **);
+int	fd_getsock1(unsigned, struct socket **, file_t **);
+void	fd_putvnode(unsigned);
+void	fd_putsock(unsigned);
+int	fd_close(unsigned);
+int	fd_dup(file_t *, int, int *, bool);
+int	fd_dup2(file_t *, unsigned, int);
+int	fd_clone(file_t *, unsigned, int, const struct fileops *, void *);
+void	fd_set_exclose(struct lwp *, int, bool);
+int	pipe1(struct lwp *, register_t *, int);
+int	dodup(struct lwp *, int, int, int, register_t *);
+
+void	cwd_sys_init(void);
+struct cwdinfo *cwdinit(void);
+void	cwdshare(proc_t *);
+void	cwdunshare(proc_t *);
+void	cwdfree(struct cwdinfo *);
+void	cwdexec(struct proc *);
+
+#define GETCWD_CHECK_ACCESS 0x0001
+int	getcwd_common(struct vnode *, struct vnode *, char **, char *, int,
+    int, struct lwp *);
+int	vnode_to_path(char *, size_t, struct vnode *, struct lwp *,
+    struct proc *);
+
+int	closef(file_t *);
+file_t *fgetdummy(void);
+void	fputdummy(file_t *);
+
+struct stat;
+int	do_sys_fstat(int, struct stat *);
+struct flock;
+int	do_fcntl_lock(int, int, struct flock *);
+int	do_posix_fadvise(int, off_t, off_t, int);
+
+extern kmutex_t filelist_lock;
+extern filedesc_t filedesc0;
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_FILEDESC_H_ */

Property changes on: lab4/.minix-src/include/sys/filedesc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/core.h
===================================================================
--- lab4/.minix-src/include/sys/core.h	(nonexistent)
+++ lab4/.minix-src/include/sys/core.h	(revision 13)
@@ -0,0 +1,116 @@
+/*	$NetBSD: core.h,v 1.12 2009/08/20 22:07:49 he Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Kranenburg.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_CORE_H_
+#define _SYS_CORE_H_
+
+#define COREMAGIC	0507
+#define CORESEGMAGIC	0510
+
+/*
+ * The core structure's c_midmag field (like exec's a_midmag) is a
+ * network-byteorder encoding of this int
+ *	FFFFFFmmmmmmmmmmMMMMMMMMMMMMMMMM
+ * Where `F' is 6 bits of flag (currently unused),
+ *       `m' is 10 bits of machine-id, and
+ *       `M' is 16 bits worth of magic number, ie. COREMAGIC.
+ * The macros below will set/get the needed fields.
+ */
+#define	CORE_GETMAGIC(c)  (  ntohl(((c).c_midmag))        & 0xffff )
+#define	CORE_GETMID(c)    ( (ntohl(((c).c_midmag)) >> 16) & 0x03ff )
+#define	CORE_GETFLAG(c)   ( (ntohl(((c).c_midmag)) >> 26) & 0x03f  )
+#define	CORE_SETMAGIC(c,mag,mid,flag) ( (c).c_midmag = htonl ( \
+			( ((flag) & 0x3f)   << 26) | \
+			( ((mid)  & 0x03ff) << 16) | \
+			( ((mag)  & 0xffff)      ) ) )
+
+/* Flag definitions */
+#define CORE_CPU	1
+#define CORE_DATA	2
+#define CORE_STACK	4
+
+#include <sys/aout_mids.h>
+
+/*
+ * A core file consists of a header followed by a number of segments.
+ * Each segment is preceded by a `coreseg' structure giving the
+ * segment's type, the virtual address where the bits resided in
+ * process address space and the size of the segment.
+ *
+ * The core header specifies the lengths of the core header itself and
+ * each of the following core segment headers to allow for any machine
+ * dependent alignment requirements.
+ */
+
+struct core {
+	uint32_t c_midmag;		/* magic, id, flags */
+	uint16_t c_hdrsize;		/* Size of this header (machdep algn) */
+	uint16_t c_seghdrsize;		/* Size of a segment header */
+	uint32_t c_nseg;		/* # of core segments */
+	char	c_name[MAXCOMLEN+1];	/* Copy of p->p_comm */
+	uint32_t c_signo;		/* Killing signal */
+	u_long	c_ucode;		/* Hmm ? */
+	u_long	c_cpusize;		/* Size of machine dependent segment */
+	u_long	c_tsize;		/* Size of traditional text segment */
+	u_long	c_dsize;		/* Size of traditional data segment */
+	u_long	c_ssize;		/* Size of traditional stack segment */
+};
+
+struct coreseg {
+	uint32_t c_midmag;		/* magic, id, flags */
+	u_long	c_addr;			/* Virtual address of segment */
+	u_long	c_size;			/* Size of this segment */
+};
+
+/*
+ * 32-bit versions of the above.
+ */
+struct core32 {
+	uint32_t c_midmag;		/* magic, id, flags */
+	uint16_t c_hdrsize;		/* Size of this header (machdep algn) */
+	uint16_t c_seghdrsize;		/* Size of a segment header */
+	uint32_t c_nseg;		/* # of core segments */
+	char	c_name[MAXCOMLEN+1];	/* Copy of p->p_comm */
+	uint32_t c_signo;		/* Killing signal */
+	u_int	c_ucode;		/* Hmm ? */
+	u_int	c_cpusize;		/* Size of machine dependent segment */
+	u_int	c_tsize;		/* Size of traditional text segment */
+	u_int	c_dsize;		/* Size of traditional data segment */
+	u_int	c_ssize;		/* Size of traditional stack segment */
+};
+
+struct coreseg32 {
+	uint32_t c_midmag;		/* magic, id, flags */
+	u_int	c_addr;			/* Virtual address of segment */
+	u_int	c_size;			/* Size of this segment */
+};
+
+#endif /* !_SYS_CORE_H_ */

Property changes on: lab4/.minix-src/include/sys/core.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/disklabel_acorn.h
===================================================================
--- lab4/.minix-src/include/sys/disklabel_acorn.h	(nonexistent)
+++ lab4/.minix-src/include/sys/disklabel_acorn.h	(revision 13)
@@ -0,0 +1,109 @@
+/*	$NetBSD: disklabel_acorn.h,v 1.6 2005/12/11 12:25:20 christos Exp $	*/
+
+/*
+ * Copyright (c) 1994 Mark Brinicombe.
+ * Copyright (c) 1994 Brini.
+ * All rights reserved.
+ *
+ * This code is derived from software written for Brini by Mark Brinicombe
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by Brini.
+ * 4. The name of the company nor the name of the author may be used to
+ *    endorse or promote products derived from this software without specific
+ *    prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_DISKLABEL_ACORN_H_
+#define _SYS_DISKLABEL_ACORN_H_
+
+#define PARTITION_TYPE_UNUSED  0
+#define PARTITION_TYPE_ADFS    1
+#define PARTITION_TYPE_RISCIX  2
+
+#define PARTITION_FORMAT_RISCIX  2
+#define PARTITION_FORMAT_RISCBSD 0x42
+
+#define FILECORE_BOOT_SECTOR 6
+
+/* Stuff to deal with RISCiX partitions */
+
+#define NRISCIX_PARTITIONS 8
+#define RISCIX_PARTITION_OFFSET 8
+
+struct riscix_partition {
+	uint32_t	rp_start;
+	uint32_t	rp_length;
+	uint32_t	rp_type;
+	int8_t		rp_name[16];
+};
+
+struct riscix_partition_table {
+	uint32_t	pad0;
+	uint32_t	pad1;
+	struct riscix_partition partitions[NRISCIX_PARTITIONS];
+};
+
+struct filecore_bootblock {
+	uint8_t		padding0[0x1c0];
+	uint8_t		log2secsize;
+	uint8_t		secspertrack;
+	uint8_t		heads;
+	uint8_t		density;
+	uint8_t		idlen;
+	uint8_t		log2bpmb;
+	uint8_t		skew;
+	uint8_t		bootoption;
+	uint8_t		lowsector;
+	uint8_t		nzones;
+	uint16_t	zone_spare;
+	uint32_t	root;
+	uint32_t	disc_size;
+	uint16_t	disc_id;
+	uint8_t		disc_name[10];
+	uint32_t	disc_type;
+
+	uint8_t		padding1[24];
+
+	uint8_t		partition_type;
+	uint8_t		partition_cyl_low;
+	uint8_t		partition_cyl_high;
+	uint8_t		checksum;
+};
+
+#if defined(_KERNEL) && !defined(__ASSEMBLER__)
+struct buf;
+struct cpu_disklabel;
+struct disklabel;
+
+/* for readdisklabel.  rv != 0 -> matches, msg == NULL -> success */
+int filecore_label_read(dev_t, void (*)(struct buf *),
+	struct disklabel *, struct cpu_disklabel *, const char **, int *,
+	int *);
+
+/* for writedisklabel.  rv == 0 -> dosen't match, rv > 0 -> success */
+int filecore_label_locate(dev_t, void (*)(struct buf *),
+	struct disklabel *, struct cpu_disklabel *, int *, int *);
+#endif
+#endif /* _SYS_DISKLABEL_ACORN_H_ */

Property changes on: lab4/.minix-src/include/sys/disklabel_acorn.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/elf_common.h
===================================================================
--- lab4/.minix-src/include/sys/elf_common.h	(nonexistent)
+++ lab4/.minix-src/include/sys/elf_common.h	(revision 13)
@@ -0,0 +1,961 @@
+/*-
+ * Copyright (c) 1998 John D. Polstra.
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_ELF_COMMON_H_
+#define	_SYS_ELF_COMMON_H_ 1
+
+/*
+ * ELF definitions that are independent of architecture or word size.
+ */
+
+/*
+ * Note header.  The ".note" section contains an array of notes.  Each
+ * begins with this header, aligned to a word boundary.  Immediately
+ * following the note header is n_namesz bytes of name, padded to the
+ * next word boundary.  Then comes n_descsz bytes of descriptor, again
+ * padded to a word boundary.  The values of n_namesz and n_descsz do
+ * not include the padding.
+ */
+
+typedef struct {
+	uint32_t	n_namesz;	/* Length of name. */
+	uint32_t	n_descsz;	/* Length of descriptor. */
+	uint32_t	n_type;		/* Type of this note. */
+} Elf_Note;
+
+/*
+ * The header for GNU-style hash sections.
+ */
+
+typedef struct {
+	uint32_t	gh_nbuckets;	/* Number of hash buckets. */
+	uint32_t	gh_symndx;	/* First visible symbol in .dynsym. */
+	uint32_t	gh_maskwords;	/* #maskwords used in bloom filter. */
+	uint32_t	gh_shift2;	/* Bloom filter shift count. */
+} Elf_GNU_Hash_Header;
+
+/* Indexes into the e_ident array.  Keep synced with
+   http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
+#define	EI_MAG0		0	/* Magic number, byte 0. */
+#define	EI_MAG1		1	/* Magic number, byte 1. */
+#define	EI_MAG2		2	/* Magic number, byte 2. */
+#define	EI_MAG3		3	/* Magic number, byte 3. */
+#define	EI_CLASS	4	/* Class of machine. */
+#define	EI_DATA		5	/* Data format. */
+#define	EI_VERSION	6	/* ELF format version. */
+#define	EI_OSABI	7	/* Operating system / ABI identification */
+#define	EI_ABIVERSION	8	/* ABI version */
+#define	OLD_EI_BRAND	8	/* Start of architecture identification. */
+#define	EI_PAD		9	/* Start of padding (per SVR4 ABI). */
+#define	EI_NIDENT	16	/* Size of e_ident array. */
+
+/* Values for the magic number bytes. */
+#define	ELFMAG0		0x7f
+#define	ELFMAG1		'E'
+#define	ELFMAG2		'L'
+#define	ELFMAG3		'F'
+#define	ELFMAG		"\177ELF"	/* magic string */
+#define	SELFMAG		4		/* magic string size */
+
+/* Values for e_ident[EI_VERSION] and e_version. */
+#define	EV_NONE		0
+#define	EV_CURRENT	1
+
+/* Values for e_ident[EI_CLASS]. */
+#define	ELFCLASSNONE	0	/* Unknown class. */
+#define	ELFCLASS32	1	/* 32-bit architecture. */
+#define	ELFCLASS64	2	/* 64-bit architecture. */
+
+/* Values for e_ident[EI_DATA]. */
+#define	ELFDATANONE	0	/* Unknown data format. */
+#define	ELFDATA2LSB	1	/* 2's complement little-endian. */
+#define	ELFDATA2MSB	2	/* 2's complement big-endian. */
+
+/* Values for e_ident[EI_OSABI]. */
+#define	ELFOSABI_NONE		0	/* UNIX System V ABI */
+#define	ELFOSABI_HPUX		1	/* HP-UX operating system */
+#define	ELFOSABI_NETBSD		2	/* NetBSD */
+#define	ELFOSABI_LINUX		3	/* GNU/Linux */
+#define	ELFOSABI_HURD		4	/* GNU/Hurd */
+#define	ELFOSABI_86OPEN		5	/* 86Open common IA32 ABI */
+#define	ELFOSABI_SOLARIS	6	/* Solaris */
+#define	ELFOSABI_AIX		7	/* AIX */
+#define	ELFOSABI_IRIX		8	/* IRIX */
+#define	ELFOSABI_FREEBSD	9	/* FreeBSD */
+#define	ELFOSABI_TRU64		10	/* TRU64 UNIX */
+#define	ELFOSABI_MODESTO	11	/* Novell Modesto */
+#define	ELFOSABI_OPENBSD	12	/* OpenBSD */
+#define	ELFOSABI_OPENVMS	13	/* Open VMS */
+#define	ELFOSABI_NSK		14	/* HP Non-Stop Kernel */
+#define	ELFOSABI_AROS		15	/* Amiga Research OS */
+#define	ELFOSABI_ARM		97	/* ARM */
+#define	ELFOSABI_STANDALONE	255	/* Standalone (embedded) application */
+
+#define	ELFOSABI_SYSV		ELFOSABI_NONE	/* symbol used in old spec */
+#define	ELFOSABI_MONTEREY	ELFOSABI_AIX	/* Monterey */
+
+/* e_ident */
+#define	IS_ELF(ehdr)	((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
+			 (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
+			 (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
+			 (ehdr).e_ident[EI_MAG3] == ELFMAG3)
+
+/* Values for e_type. */
+#define	ET_NONE		0	/* Unknown type. */
+#define	ET_REL		1	/* Relocatable. */
+#define	ET_EXEC		2	/* Executable. */
+#define	ET_DYN		3	/* Shared object. */
+#define	ET_CORE		4	/* Core file. */
+#define	ET_LOOS		0xfe00	/* First operating system specific. */
+#define	ET_HIOS		0xfeff	/* Last operating system-specific. */
+#define	ET_LOPROC	0xff00	/* First processor-specific. */
+#define	ET_HIPROC	0xffff	/* Last processor-specific. */
+
+/* Values for e_machine. */
+#define	EM_NONE		0	/* Unknown machine. */
+#define	EM_M32		1	/* AT&T WE32100. */
+#define	EM_SPARC	2	/* Sun SPARC. */
+#define	EM_386		3	/* Intel i386. */
+#define	EM_68K		4	/* Motorola 68000. */
+#define	EM_88K		5	/* Motorola 88000. */
+#define	EM_860		7	/* Intel i860. */
+#define	EM_MIPS		8	/* MIPS R3000 Big-Endian only. */
+#define	EM_S370		9	/* IBM System/370. */
+#define	EM_MIPS_RS3_LE	10	/* MIPS R3000 Little-Endian. */
+#define	EM_PARISC	15	/* HP PA-RISC. */
+#define	EM_VPP500	17	/* Fujitsu VPP500. */
+#define	EM_SPARC32PLUS	18	/* SPARC v8plus. */
+#define	EM_960		19	/* Intel 80960. */
+#define	EM_PPC		20	/* PowerPC 32-bit. */
+#define	EM_PPC64	21	/* PowerPC 64-bit. */
+#define	EM_S390		22	/* IBM System/390. */
+#define	EM_V800		36	/* NEC V800. */
+#define	EM_FR20		37	/* Fujitsu FR20. */
+#define	EM_RH32		38	/* TRW RH-32. */
+#define	EM_RCE		39	/* Motorola RCE. */
+#define	EM_ARM		40	/* ARM. */
+#define	EM_SH		42	/* Hitachi SH. */
+#define	EM_SPARCV9	43	/* SPARC v9 64-bit. */
+#define	EM_TRICORE	44	/* Siemens TriCore embedded processor. */
+#define	EM_ARC		45	/* Argonaut RISC Core. */
+#define	EM_H8_300	46	/* Hitachi H8/300. */
+#define	EM_H8_300H	47	/* Hitachi H8/300H. */
+#define	EM_H8S		48	/* Hitachi H8S. */
+#define	EM_H8_500	49	/* Hitachi H8/500. */
+#define	EM_IA_64	50	/* Intel IA-64 Processor. */
+#define	EM_MIPS_X	51	/* Stanford MIPS-X. */
+#define	EM_COLDFIRE	52	/* Motorola ColdFire. */
+#define	EM_68HC12	53	/* Motorola M68HC12. */
+#define	EM_MMA		54	/* Fujitsu MMA. */
+#define	EM_PCP		55	/* Siemens PCP. */
+#define	EM_NCPU		56	/* Sony nCPU. */
+#define	EM_NDR1		57	/* Denso NDR1 microprocessor. */
+#define	EM_STARCORE	58	/* Motorola Star*Core processor. */
+#define	EM_ME16		59	/* Toyota ME16 processor. */
+#define	EM_ST100	60	/* STMicroelectronics ST100 processor. */
+#define	EM_TINYJ	61	/* Advanced Logic Corp. TinyJ processor. */
+#define	EM_X86_64	62	/* Advanced Micro Devices x86-64 */
+#define	EM_AMD64	EM_X86_64	/* Advanced Micro Devices x86-64 (compat) */
+#define	EM_PDSP		63	/* Sony DSP Processor. */
+#define	EM_FX66		66	/* Siemens FX66 microcontroller. */
+#define	EM_ST9PLUS	67	/* STMicroelectronics ST9+ 8/16
+				   microcontroller. */
+#define	EM_ST7		68	/* STmicroelectronics ST7 8-bit
+				   microcontroller. */
+#define	EM_68HC16	69	/* Motorola MC68HC16 microcontroller. */
+#define	EM_68HC11	70	/* Motorola MC68HC11 microcontroller. */
+#define	EM_68HC08	71	/* Motorola MC68HC08 microcontroller. */
+#define	EM_68HC05	72	/* Motorola MC68HC05 microcontroller. */
+#define	EM_SVX		73	/* Silicon Graphics SVx. */
+#define	EM_ST19		74	/* STMicroelectronics ST19 8-bit mc. */
+#define	EM_VAX		75	/* Digital VAX. */
+#define	EM_CRIS		76	/* Axis Communications 32-bit embedded
+				   processor. */
+#define	EM_JAVELIN	77	/* Infineon Technologies 32-bit embedded
+				   processor. */
+#define	EM_FIREPATH	78	/* Element 14 64-bit DSP Processor. */
+#define	EM_ZSP		79	/* LSI Logic 16-bit DSP Processor. */
+#define	EM_MMIX		80	/* Donald Knuth's educational 64-bit proc. */
+#define	EM_HUANY	81	/* Harvard University machine-independent
+				   object files. */
+#define	EM_PRISM	82	/* SiTera Prism. */
+#define	EM_AVR		83	/* Atmel AVR 8-bit microcontroller. */
+#define	EM_FR30		84	/* Fujitsu FR30. */
+#define	EM_D10V		85	/* Mitsubishi D10V. */
+#define	EM_D30V		86	/* Mitsubishi D30V. */
+#define	EM_V850		87	/* NEC v850. */
+#define	EM_M32R		88	/* Mitsubishi M32R. */
+#define	EM_MN10300	89	/* Matsushita MN10300. */
+#define	EM_MN10200	90	/* Matsushita MN10200. */
+#define	EM_PJ		91	/* picoJava. */
+#define	EM_OPENRISC	92	/* OpenRISC 32-bit embedded processor. */
+#define	EM_ARC_A5	93	/* ARC Cores Tangent-A5. */
+#define	EM_XTENSA	94	/* Tensilica Xtensa Architecture. */
+#define	EM_VIDEOCORE	95	/* Alphamosaic VideoCore processor. */
+#define	EM_TMM_GPP	96	/* Thompson Multimedia General Purpose
+				   Processor. */
+#define	EM_NS32K	97	/* National Semiconductor 32000 series. */
+#define	EM_TPC		98	/* Tenor Network TPC processor. */
+#define	EM_SNP1K	99	/* Trebia SNP 1000 processor. */
+#define	EM_ST200	100	/* STMicroelectronics ST200 microcontroller. */
+#define	EM_IP2K		101	/* Ubicom IP2xxx microcontroller family. */
+#define	EM_MAX		102	/* MAX Processor. */
+#define	EM_CR		103	/* National Semiconductor CompactRISC
+				   microprocessor. */
+#define	EM_F2MC16	104	/* Fujitsu F2MC16. */
+#define	EM_MSP430	105	/* Texas Instruments embedded microcontroller
+				   msp430. */
+#define	EM_BLACKFIN	106	/* Analog Devices Blackfin (DSP) processor. */
+#define	EM_SE_C33	107	/* S1C33 Family of Seiko Epson processors. */
+#define	EM_SEP		108	/* Sharp embedded microprocessor. */
+#define	EM_ARCA		109	/* Arca RISC Microprocessor. */
+#define	EM_UNICORE	110	/* Microprocessor series from PKU-Unity Ltd.
+				   and MPRC of Peking University */
+
+/* Non-standard or deprecated. */
+#define	EM_486		6	/* Intel i486. */
+#define	EM_MIPS_RS4_BE	10	/* MIPS R4000 Big-Endian */
+#define	EM_ALPHA_STD	41	/* Digital Alpha (standard value). */
+#define	EM_ALPHA	0x9026	/* Alpha (written in the absence of an ABI) */
+
+/* Special section indexes. */
+#define	SHN_UNDEF	     0		/* Undefined, missing, irrelevant. */
+#define	SHN_LORESERVE	0xff00		/* First of reserved range. */
+#define	SHN_LOPROC	0xff00		/* First processor-specific. */
+#define	SHN_HIPROC	0xff1f		/* Last processor-specific. */
+#define	SHN_LOOS	0xff20		/* First operating system-specific. */
+#define	SHN_HIOS	0xff3f		/* Last operating system-specific. */
+#define	SHN_ABS		0xfff1		/* Absolute values. */
+#define	SHN_COMMON	0xfff2		/* Common data. */
+#define	SHN_XINDEX	0xffff		/* Escape -- index stored elsewhere. */
+#define	SHN_HIRESERVE	0xffff		/* Last of reserved range. */
+
+/* sh_type */
+#define	SHT_NULL		0	/* inactive */
+#define	SHT_PROGBITS		1	/* program defined information */
+#define	SHT_SYMTAB		2	/* symbol table section */
+#define	SHT_STRTAB		3	/* string table section */
+#define	SHT_RELA		4	/* relocation section with addends */
+#define	SHT_HASH		5	/* symbol hash table section */
+#define	SHT_DYNAMIC		6	/* dynamic section */
+#define	SHT_NOTE		7	/* note section */
+#define	SHT_NOBITS		8	/* no space section */
+#define	SHT_REL			9	/* relocation section - no addends */
+#define	SHT_SHLIB		10	/* reserved - purpose unknown */
+#define	SHT_DYNSYM		11	/* dynamic symbol table section */
+#define	SHT_INIT_ARRAY		14	/* Initialization function pointers. */
+#define	SHT_FINI_ARRAY		15	/* Termination function pointers. */
+#define	SHT_PREINIT_ARRAY	16	/* Pre-initialization function ptrs. */
+#define	SHT_GROUP		17	/* Section group. */
+#define	SHT_SYMTAB_SHNDX	18	/* Section indexes (see SHN_XINDEX). */
+#define	SHT_LOOS		0x60000000	/* First of OS specific semantics */
+#define	SHT_LOSUNW		0x6ffffff4
+#define	SHT_SUNW_dof		0x6ffffff4
+#define	SHT_SUNW_cap		0x6ffffff5
+#define	SHT_SUNW_SIGNATURE	0x6ffffff6
+#define	SHT_GNU_HASH		0x6ffffff6
+#define	SHT_SUNW_ANNOTATE	0x6ffffff7
+#define	SHT_SUNW_DEBUGSTR	0x6ffffff8
+#define	SHT_SUNW_DEBUG		0x6ffffff9
+#define	SHT_SUNW_move		0x6ffffffa
+#define	SHT_SUNW_COMDAT		0x6ffffffb
+#define	SHT_SUNW_syminfo	0x6ffffffc
+#define	SHT_SUNW_verdef		0x6ffffffd
+#define	SHT_GNU_verdef		0x6ffffffd	/* Symbol versions provided */
+#define	SHT_SUNW_verneed	0x6ffffffe
+#define	SHT_GNU_verneed		0x6ffffffe	/* Symbol versions required */
+#define	SHT_SUNW_versym		0x6fffffff
+#define	SHT_GNU_versym		0x6fffffff	/* Symbol version table */
+#define	SHT_HISUNW		0x6fffffff
+#define	SHT_HIOS		0x6fffffff	/* Last of OS specific semantics */
+#define	SHT_LOPROC		0x70000000	/* reserved range for processor */
+#define	SHT_AMD64_UNWIND	0x70000001	/* unwind information */
+#define	SHT_HIPROC		0x7fffffff	/* specific section header types */
+#define	SHT_LOUSER		0x80000000	/* reserved range for application */
+#define	SHT_HIUSER		0xffffffff	/* specific indexes */
+
+/* Flags for sh_flags. */
+#define	SHF_WRITE		0x1	/* Section contains writable data. */
+#define	SHF_ALLOC		0x2	/* Section occupies memory. */
+#define	SHF_EXECINSTR		0x4	/* Section contains instructions. */
+#define	SHF_MERGE		0x10	/* Section may be merged. */
+#define	SHF_STRINGS		0x20	/* Section contains strings. */
+#define	SHF_INFO_LINK		0x40	/* sh_info holds section index. */
+#define	SHF_LINK_ORDER		0x80	/* Special ordering requirements. */
+#define	SHF_OS_NONCONFORMING	0x100	/* OS-specific processing required. */
+#define	SHF_GROUP		0x200	/* Member of section group. */
+#define	SHF_TLS			0x400	/* Section contains TLS data. */
+#define	SHF_MASKOS	0x0ff00000	/* OS-specific semantics. */
+#define	SHF_MASKPROC	0xf0000000	/* Processor-specific semantics. */
+
+/* Values for p_type. */
+#define	PT_NULL		0	/* Unused entry. */
+#define	PT_LOAD		1	/* Loadable segment. */
+#define	PT_DYNAMIC	2	/* Dynamic linking information segment. */
+#define	PT_INTERP	3	/* Pathname of interpreter. */
+#define	PT_NOTE		4	/* Auxiliary information. */
+#define	PT_SHLIB	5	/* Reserved (not used). */
+#define	PT_PHDR		6	/* Location of program header itself. */
+#define	PT_TLS		7	/* Thread local storage segment */
+#define	PT_LOOS		0x60000000	/* First OS-specific. */
+#define	PT_SUNW_UNWIND	0x6464e550	/* amd64 UNWIND program header */
+#define	PT_GNU_EH_FRAME	0x6474e550
+#define	PT_LOSUNW	0x6ffffffa
+#define	PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */
+#define	PT_SUNWSTACK	0x6ffffffb	/* describes the stack segment */
+#define	PT_SUNWDTRACE	0x6ffffffc	/* private */
+#define	PT_SUNWCAP	0x6ffffffd	/* hard/soft capabilities segment */
+#define	PT_HISUNW	0x6fffffff
+#define	PT_HIOS		0x6fffffff	/* Last OS-specific. */
+#define	PT_LOPROC	0x70000000	/* First processor-specific type. */
+#define	PT_HIPROC	0x7fffffff	/* Last processor-specific type. */
+
+/* Values for p_flags. */
+#define	PF_X		0x1		/* Executable. */
+#define	PF_W		0x2		/* Writable. */
+#define	PF_R		0x4		/* Readable. */
+#define	PF_MASKOS	0x0ff00000	/* Operating system-specific. */
+#define	PF_MASKPROC	0xf0000000	/* Processor-specific. */
+
+/* Extended program header index. */
+#define	PN_XNUM		0xffff
+
+/* Values for d_tag. */
+#define	DT_NULL		0	/* Terminating entry. */
+#define	DT_NEEDED	1	/* String table offset of a needed shared
+				   library. */
+#define	DT_PLTRELSZ	2	/* Total size in bytes of PLT relocations. */
+#define	DT_PLTGOT	3	/* Processor-dependent address. */
+#define	DT_HASH		4	/* Address of symbol hash table. */
+#define	DT_STRTAB	5	/* Address of string table. */
+#define	DT_SYMTAB	6	/* Address of symbol table. */
+#define	DT_RELA		7	/* Address of ElfNN_Rela relocations. */
+#define	DT_RELASZ	8	/* Total size of ElfNN_Rela relocations. */
+#define	DT_RELAENT	9	/* Size of each ElfNN_Rela relocation entry. */
+#define	DT_STRSZ	10	/* Size of string table. */
+#define	DT_SYMENT	11	/* Size of each symbol table entry. */
+#define	DT_INIT		12	/* Address of initialization function. */
+#define	DT_FINI		13	/* Address of finalization function. */
+#define	DT_SONAME	14	/* String table offset of shared object
+				   name. */
+#define	DT_RPATH	15	/* String table offset of library path. [sup] */
+#define	DT_SYMBOLIC	16	/* Indicates "symbolic" linking. [sup] */
+#define	DT_REL		17	/* Address of ElfNN_Rel relocations. */
+#define	DT_RELSZ	18	/* Total size of ElfNN_Rel relocations. */
+#define	DT_RELENT	19	/* Size of each ElfNN_Rel relocation. */
+#define	DT_PLTREL	20	/* Type of relocation used for PLT. */
+#define	DT_DEBUG	21	/* Reserved (not used). */
+#define	DT_TEXTREL	22	/* Indicates there may be relocations in
+				   non-writable segments. [sup] */
+#define	DT_JMPREL	23	/* Address of PLT relocations. */
+#define	DT_BIND_NOW	24	/* [sup] */
+#define	DT_INIT_ARRAY	25	/* Address of the array of pointers to
+				   initialization functions */
+#define	DT_FINI_ARRAY	26	/* Address of the array of pointers to
+				   termination functions */
+#define	DT_INIT_ARRAYSZ	27	/* Size in bytes of the array of
+				   initialization functions. */
+#define	DT_FINI_ARRAYSZ	28	/* Size in bytes of the array of
+				   terminationfunctions. */
+#define	DT_RUNPATH	29	/* String table offset of a null-terminated
+				   library search path string. */
+#define	DT_FLAGS	30	/* Object specific flag values. */
+#define	DT_ENCODING	32	/* Values greater than or equal to DT_ENCODING
+				   and less than DT_LOOS follow the rules for
+				   the interpretation of the d_un union
+				   as follows: even == 'd_ptr', even == 'd_val'
+				   or none */
+#define	DT_PREINIT_ARRAY 32	/* Address of the array of pointers to
+				   pre-initialization functions. */
+#define	DT_PREINIT_ARRAYSZ 33	/* Size in bytes of the array of
+				   pre-initialization functions. */
+#define	DT_MAXPOSTAGS	34	/* number of positive tags */
+#define	DT_LOOS		0x6000000d	/* First OS-specific */
+#define	DT_SUNW_AUXILIARY	0x6000000d	/* symbol auxiliary name */
+#define	DT_SUNW_RTLDINF		0x6000000e	/* ld.so.1 info (private) */
+#define	DT_SUNW_FILTER		0x6000000f	/* symbol filter name */
+#define	DT_SUNW_CAP		0x60000010	/* hardware/software */
+#define	DT_HIOS		0x6ffff000	/* Last OS-specific */
+
+/*
+ * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
+ * Dyn.d_un.d_val field of the Elf*_Dyn structure.
+ */
+#define	DT_VALRNGLO	0x6ffffd00
+#define	DT_CHECKSUM	0x6ffffdf8	/* elf checksum */
+#define	DT_PLTPADSZ	0x6ffffdf9	/* pltpadding size */
+#define	DT_MOVEENT	0x6ffffdfa	/* move table entry size */
+#define	DT_MOVESZ	0x6ffffdfb	/* move table size */
+#define	DT_FEATURE_1	0x6ffffdfc	/* feature holder */
+#define	DT_POSFLAG_1	0x6ffffdfd	/* flags for DT_* entries, effecting */
+					/*	the following DT_* entry. */
+					/*	See DF_P1_* definitions */
+#define	DT_SYMINSZ	0x6ffffdfe	/* syminfo table size (in bytes) */
+#define	DT_SYMINENT	0x6ffffdff	/* syminfo entry size (in bytes) */
+#define	DT_VALRNGHI	0x6ffffdff
+
+/*
+ * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
+ * Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
+ *
+ * If any adjustment is made to the ELF object after it has been
+ * built, these entries will need to be adjusted.
+ */
+#define	DT_ADDRRNGLO	0x6ffffe00
+#define	DT_GNU_HASH	0x6ffffef5	/* GNU-style hash table */
+#define	DT_CONFIG	0x6ffffefa	/* configuration information */
+#define	DT_DEPAUDIT	0x6ffffefb	/* dependency auditing */
+#define	DT_AUDIT	0x6ffffefc	/* object auditing */
+#define	DT_PLTPAD	0x6ffffefd	/* pltpadding (sparcv9) */
+#define	DT_MOVETAB	0x6ffffefe	/* move table */
+#define	DT_SYMINFO	0x6ffffeff	/* syminfo table */
+#define	DT_ADDRRNGHI	0x6ffffeff
+
+#define	DT_VERSYM	0x6ffffff0	/* Address of versym section. */
+#define	DT_RELACOUNT	0x6ffffff9	/* number of RELATIVE relocations */
+#define	DT_RELCOUNT	0x6ffffffa	/* number of RELATIVE relocations */
+#define	DT_FLAGS_1	0x6ffffffb	/* state flags - see DF_1_* defs */
+#define	DT_VERDEF	0x6ffffffc	/* Address of verdef section. */
+#define	DT_VERDEFNUM	0x6ffffffd	/* Number of elems in verdef section */
+#define	DT_VERNEED	0x6ffffffe	/* Address of verneed section. */
+#define	DT_VERNEEDNUM	0x6fffffff	/* Number of elems in verneed section */
+
+#define	DT_LOPROC	0x70000000	/* First processor-specific type. */
+#define	DT_DEPRECATED_SPARC_REGISTER	0x7000001
+#define	DT_AUXILIARY	0x7ffffffd	/* shared library auxiliary name */
+#define	DT_USED		0x7ffffffe	/* ignored - same as needed */
+#define	DT_FILTER	0x7fffffff	/* shared library filter name */
+#define	DT_HIPROC	0x7fffffff	/* Last processor-specific type. */
+
+/* Values for DT_FLAGS */
+#define	DF_ORIGIN	0x0001	/* Indicates that the object being loaded may
+				   make reference to the $ORIGIN substitution
+				   string */
+#define	DF_SYMBOLIC	0x0002	/* Indicates "symbolic" linking. */
+#define	DF_TEXTREL	0x0004	/* Indicates there may be relocations in
+				   non-writable segments. */
+#define	DF_BIND_NOW	0x0008	/* Indicates that the dynamic linker should
+				   process all relocations for the object
+				   containing this entry before transferring
+				   control to the program. */
+#define	DF_STATIC_TLS	0x0010	/* Indicates that the shared object or
+				   executable contains code using a static
+				   thread-local storage scheme. */
+
+/* Values for DT_FLAGS_1 */
+#define	DF_1_BIND_NOW	0x00000001	/* Same as DF_BIND_NOW */
+#define	DF_1_GLOBAL	0x00000002	/* Set the RTLD_GLOBAL for object */
+#define	DF_1_NODELETE	0x00000008	/* Set the RTLD_NODELETE for object */
+#define	DF_1_NOOPEN     0x00000040	/* Do not allow loading on dlopen() */
+#define	DF_1_ORIGIN	0x00000080	/* Process $ORIGIN */
+
+/* Values for n_type.  Used in core files. */
+#define	NT_PRSTATUS	1	/* Process status. */
+#define	NT_FPREGSET	2	/* Floating point registers. */
+#define	NT_PRPSINFO	3	/* Process state info. */
+
+/* Symbol Binding - ELFNN_ST_BIND - st_info */
+#define	STB_LOCAL	0	/* Local symbol */
+#define	STB_GLOBAL	1	/* Global symbol */
+#define	STB_WEAK	2	/* like global - lower precedence */
+#define	STB_LOOS	10	/* Reserved range for operating system */
+#define	STB_HIOS	12	/*   specific semantics. */
+#define	STB_LOPROC	13	/* reserved range for processor */
+#define	STB_HIPROC	15	/*   specific semantics. */
+
+/* Symbol type - ELFNN_ST_TYPE - st_info */
+#define	STT_NOTYPE	0	/* Unspecified type. */
+#define	STT_OBJECT	1	/* Data object. */
+#define	STT_FUNC	2	/* Function. */
+#define	STT_SECTION	3	/* Section. */
+#define	STT_FILE	4	/* Source file. */
+#define	STT_COMMON	5	/* Uninitialized common block. */
+#define	STT_TLS		6	/* TLS object. */
+#define	STT_NUM		7
+#define	STT_LOOS	10	/* Reserved range for operating system */
+#define	STT_HIOS	12	/*   specific semantics. */
+#define	STT_LOPROC	13	/* reserved range for processor */
+#define	STT_HIPROC	15	/*   specific semantics. */
+
+/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */
+#define	STV_DEFAULT	0x0	/* Default visibility (see binding). */
+#define	STV_INTERNAL	0x1	/* Special meaning in relocatable objects. */
+#define	STV_HIDDEN	0x2	/* Not visible. */
+#define	STV_PROTECTED	0x3	/* Visible but not preemptible. */
+#define	STV_EXPORTED	0x4
+#define	STV_SINGLETON	0x5
+#define	STV_ELIMINATE	0x6
+
+/* Special symbol table indexes. */
+#define	STN_UNDEF	0	/* Undefined symbol index. */
+
+/* Symbol versioning flags. */
+#define	VER_DEF_CURRENT	1
+#define	VER_DEF_IDX(x)	VER_NDX(x)
+
+#define	VER_FLG_BASE	0x01
+#define	VER_FLG_WEAK	0x02
+
+#define	VER_NEED_CURRENT	1
+#define	VER_NEED_WEAK	(1u << 15)
+#define	VER_NEED_HIDDEN	VER_NDX_HIDDEN
+#define	VER_NEED_IDX(x)	VER_NDX(x)
+
+#define	VER_NDX_LOCAL	0
+#define	VER_NDX_GLOBAL	1
+#define	VER_NDX_GIVEN	2
+
+#define	VER_NDX_HIDDEN	(1u << 15)
+#define	VER_NDX(x)	((x) & ~(1u << 15))
+
+#define	CA_SUNW_NULL	0
+#define	CA_SUNW_HW_1	1		/* first hardware capabilities entry */
+#define	CA_SUNW_SF_1	2		/* first software capabilities entry */
+
+/*
+ * Syminfo flag values
+ */
+#define	SYMINFO_FLG_DIRECT	0x0001	/* symbol ref has direct association */
+					/*	to object containing defn. */
+#define	SYMINFO_FLG_PASSTHRU	0x0002	/* ignored - see SYMINFO_FLG_FILTER */
+#define	SYMINFO_FLG_COPY	0x0004	/* symbol is a copy-reloc */
+#define	SYMINFO_FLG_LAZYLOAD	0x0008	/* object containing defn should be */
+					/*	lazily-loaded */
+#define	SYMINFO_FLG_DIRECTBIND	0x0010	/* ref should be bound directly to */
+					/*	object containing defn. */
+#define	SYMINFO_FLG_NOEXTDIRECT	0x0020	/* don't let an external reference */
+					/*	directly bind to this symbol */
+#define	SYMINFO_FLG_FILTER	0x0002	/* symbol ref is associated to a */
+#define	SYMINFO_FLG_AUXILIARY	0x0040	/* 	standard or auxiliary filter */
+
+/*
+ * Syminfo.si_boundto values.
+ */
+#define	SYMINFO_BT_SELF		0xffff	/* symbol bound to self */
+#define	SYMINFO_BT_PARENT	0xfffe	/* symbol bound to parent */
+#define	SYMINFO_BT_NONE		0xfffd	/* no special symbol binding */
+#define	SYMINFO_BT_EXTERN	0xfffc	/* symbol defined as external */
+#define	SYMINFO_BT_LOWRESERVE	0xff00	/* beginning of reserved entries */
+
+/*
+ * Syminfo version values.
+ */
+#define	SYMINFO_NONE		0	/* Syminfo version */
+#define	SYMINFO_CURRENT		1
+#define	SYMINFO_NUM		2
+
+/*
+ * Relocation types.
+ *
+ * All machine architectures are defined here to allow tools on one to
+ * handle others.
+ */
+
+#define	R_386_NONE		0	/* No relocation. */
+#define	R_386_32		1	/* Add symbol value. */
+#define	R_386_PC32		2	/* Add PC-relative symbol value. */
+#define	R_386_GOT32		3	/* Add PC-relative GOT offset. */
+#define	R_386_PLT32		4	/* Add PC-relative PLT offset. */
+#define	R_386_COPY		5	/* Copy data from shared object. */
+#define	R_386_GLOB_DAT		6	/* Set GOT entry to data address. */
+#define	R_386_JMP_SLOT		7	/* Set GOT entry to code address. */
+#define	R_386_RELATIVE		8	/* Add load address of shared object. */
+#define	R_386_GOTOFF		9	/* Add GOT-relative symbol address. */
+#define	R_386_GOTPC		10	/* Add PC-relative GOT table address. */
+#define	R_386_TLS_TPOFF		14	/* Negative offset in static TLS block */
+#define	R_386_TLS_IE		15	/* Absolute address of GOT for -ve static TLS */
+#define	R_386_TLS_GOTIE		16	/* GOT entry for negative static TLS block */
+#define	R_386_TLS_LE		17	/* Negative offset relative to static TLS */
+#define	R_386_TLS_GD		18	/* 32 bit offset to GOT (index,off) pair */
+#define	R_386_TLS_LDM		19	/* 32 bit offset to GOT (index,zero) pair */
+#define	R_386_TLS_GD_32		24	/* 32 bit offset to GOT (index,off) pair */
+#define	R_386_TLS_GD_PUSH	25	/* pushl instruction for Sun ABI GD sequence */
+#define	R_386_TLS_GD_CALL	26	/* call instruction for Sun ABI GD sequence */
+#define	R_386_TLS_GD_POP	27	/* popl instruction for Sun ABI GD sequence */
+#define	R_386_TLS_LDM_32	28	/* 32 bit offset to GOT (index,zero) pair */
+#define	R_386_TLS_LDM_PUSH	29	/* pushl instruction for Sun ABI LD sequence */
+#define	R_386_TLS_LDM_CALL	30	/* call instruction for Sun ABI LD sequence */
+#define	R_386_TLS_LDM_POP	31	/* popl instruction for Sun ABI LD sequence */
+#define	R_386_TLS_LDO_32	32	/* 32 bit offset from start of TLS block */
+#define	R_386_TLS_IE_32		33	/* 32 bit offset to GOT static TLS offset entry */
+#define	R_386_TLS_LE_32		34	/* 32 bit offset within static TLS block */
+#define	R_386_TLS_DTPMOD32	35	/* GOT entry containing TLS index */
+#define	R_386_TLS_DTPOFF32	36	/* GOT entry containing TLS offset */
+#define	R_386_TLS_TPOFF32	37	/* GOT entry of -ve static TLS offset */
+
+#define	R_ARM_NONE		0	/* No relocation. */
+#define	R_ARM_PC24		1
+#define	R_ARM_ABS32		2
+#define	R_ARM_REL32		3
+#define	R_ARM_PC13		4
+#define	R_ARM_ABS16		5
+#define	R_ARM_ABS12		6
+#define	R_ARM_THM_ABS5		7
+#define	R_ARM_ABS8		8
+#define	R_ARM_SBREL32		9
+#define	R_ARM_THM_PC22		10
+#define	R_ARM_THM_PC8		11
+#define	R_ARM_AMP_VCALL9	12
+#define	R_ARM_SWI24		13
+#define	R_ARM_THM_SWI8		14
+#define	R_ARM_XPC25		15
+#define	R_ARM_THM_XPC22		16
+#define	R_ARM_COPY		20	/* Copy data from shared object. */
+#define	R_ARM_GLOB_DAT		21	/* Set GOT entry to data address. */
+#define	R_ARM_JUMP_SLOT		22	/* Set GOT entry to code address. */
+#define	R_ARM_RELATIVE		23	/* Add load address of shared object. */
+#define	R_ARM_GOTOFF		24	/* Add GOT-relative symbol address. */
+#define	R_ARM_GOTPC		25	/* Add PC-relative GOT table address. */
+#define	R_ARM_GOT32		26	/* Add PC-relative GOT offset. */
+#define	R_ARM_PLT32		27	/* Add PC-relative PLT offset. */
+#define	R_ARM_GNU_VTENTRY	100
+#define	R_ARM_GNU_VTINHERIT	101
+#define	R_ARM_RSBREL32		250
+#define	R_ARM_THM_RPC22		251
+#define	R_ARM_RREL32		252
+#define	R_ARM_RABS32		253
+#define	R_ARM_RPC24		254
+#define	R_ARM_RBASE		255
+
+/*	Name			Value	   Field	Calculation */
+#define	R_IA_64_NONE		0	/* None */
+#define	R_IA_64_IMM14		0x21	/* immediate14	S + A */
+#define	R_IA_64_IMM22		0x22	/* immediate22	S + A */
+#define	R_IA_64_IMM64		0x23	/* immediate64	S + A */
+#define	R_IA_64_DIR32MSB	0x24	/* word32 MSB	S + A */
+#define	R_IA_64_DIR32LSB	0x25	/* word32 LSB	S + A */
+#define	R_IA_64_DIR64MSB	0x26	/* word64 MSB	S + A */
+#define	R_IA_64_DIR64LSB	0x27	/* word64 LSB	S + A */
+#define	R_IA_64_GPREL22		0x2a	/* immediate22	@gprel(S + A) */
+#define	R_IA_64_GPREL64I	0x2b	/* immediate64	@gprel(S + A) */
+#define	R_IA_64_GPREL32MSB	0x2c	/* word32 MSB	@gprel(S + A) */
+#define	R_IA_64_GPREL32LSB	0x2d	/* word32 LSB	@gprel(S + A) */
+#define	R_IA_64_GPREL64MSB	0x2e	/* word64 MSB	@gprel(S + A) */
+#define	R_IA_64_GPREL64LSB	0x2f	/* word64 LSB	@gprel(S + A) */
+#define	R_IA_64_LTOFF22		0x32	/* immediate22	@ltoff(S + A) */
+#define	R_IA_64_LTOFF64I	0x33	/* immediate64	@ltoff(S + A) */
+#define	R_IA_64_PLTOFF22	0x3a	/* immediate22	@pltoff(S + A) */
+#define	R_IA_64_PLTOFF64I	0x3b	/* immediate64	@pltoff(S + A) */
+#define	R_IA_64_PLTOFF64MSB	0x3e	/* word64 MSB	@pltoff(S + A) */
+#define	R_IA_64_PLTOFF64LSB	0x3f	/* word64 LSB	@pltoff(S + A) */
+#define	R_IA_64_FPTR64I		0x43	/* immediate64	@fptr(S + A) */
+#define	R_IA_64_FPTR32MSB	0x44	/* word32 MSB	@fptr(S + A) */
+#define	R_IA_64_FPTR32LSB	0x45	/* word32 LSB	@fptr(S + A) */
+#define	R_IA_64_FPTR64MSB	0x46	/* word64 MSB	@fptr(S + A) */
+#define	R_IA_64_FPTR64LSB	0x47	/* word64 LSB	@fptr(S + A) */
+#define	R_IA_64_PCREL60B	0x48	/* immediate60 form1 S + A - P */
+#define	R_IA_64_PCREL21B	0x49	/* immediate21 form1 S + A - P */
+#define	R_IA_64_PCREL21M	0x4a	/* immediate21 form2 S + A - P */
+#define	R_IA_64_PCREL21F	0x4b	/* immediate21 form3 S + A - P */
+#define	R_IA_64_PCREL32MSB	0x4c	/* word32 MSB	S + A - P */
+#define	R_IA_64_PCREL32LSB	0x4d	/* word32 LSB	S + A - P */
+#define	R_IA_64_PCREL64MSB	0x4e	/* word64 MSB	S + A - P */
+#define	R_IA_64_PCREL64LSB	0x4f	/* word64 LSB	S + A - P */
+#define	R_IA_64_LTOFF_FPTR22	0x52	/* immediate22	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_LTOFF_FPTR64I	0x53	/* immediate64	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_LTOFF_FPTR32MSB	0x54	/* word32 MSB	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_LTOFF_FPTR32LSB	0x55	/* word32 LSB	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_LTOFF_FPTR64MSB	0x56	/* word64 MSB	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_LTOFF_FPTR64LSB	0x57	/* word64 LSB	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_SEGREL32MSB	0x5c	/* word32 MSB	@segrel(S + A) */
+#define	R_IA_64_SEGREL32LSB	0x5d	/* word32 LSB	@segrel(S + A) */
+#define	R_IA_64_SEGREL64MSB	0x5e	/* word64 MSB	@segrel(S + A) */
+#define	R_IA_64_SEGREL64LSB	0x5f	/* word64 LSB	@segrel(S + A) */
+#define	R_IA_64_SECREL32MSB	0x64	/* word32 MSB	@secrel(S + A) */
+#define	R_IA_64_SECREL32LSB	0x65	/* word32 LSB	@secrel(S + A) */
+#define	R_IA_64_SECREL64MSB	0x66	/* word64 MSB	@secrel(S + A) */
+#define	R_IA_64_SECREL64LSB	0x67	/* word64 LSB	@secrel(S + A) */
+#define	R_IA_64_REL32MSB	0x6c	/* word32 MSB	BD + A */
+#define	R_IA_64_REL32LSB	0x6d	/* word32 LSB	BD + A */
+#define	R_IA_64_REL64MSB	0x6e	/* word64 MSB	BD + A */
+#define	R_IA_64_REL64LSB	0x6f	/* word64 LSB	BD + A */
+#define	R_IA_64_LTV32MSB	0x74	/* word32 MSB	S + A */
+#define	R_IA_64_LTV32LSB	0x75	/* word32 LSB	S + A */
+#define	R_IA_64_LTV64MSB	0x76	/* word64 MSB	S + A */
+#define	R_IA_64_LTV64LSB	0x77	/* word64 LSB	S + A */
+#define	R_IA_64_PCREL21BI	0x79	/* immediate21 form1 S + A - P */
+#define	R_IA_64_PCREL22		0x7a	/* immediate22	S + A - P */
+#define	R_IA_64_PCREL64I	0x7b	/* immediate64	S + A - P */
+#define	R_IA_64_IPLTMSB		0x80	/* function descriptor MSB special */
+#define	R_IA_64_IPLTLSB		0x81	/* function descriptor LSB speciaal */
+#define	R_IA_64_SUB		0x85	/* immediate64	A - S */
+#define	R_IA_64_LTOFF22X	0x86	/* immediate22	special */
+#define	R_IA_64_LDXMOV		0x87	/* immediate22	special */
+#define	R_IA_64_TPREL14		0x91	/* imm14	@tprel(S + A) */
+#define	R_IA_64_TPREL22		0x92	/* imm22	@tprel(S + A) */
+#define	R_IA_64_TPREL64I	0x93	/* imm64	@tprel(S + A) */
+#define	R_IA_64_TPREL64MSB	0x96	/* word64 MSB	@tprel(S + A) */
+#define	R_IA_64_TPREL64LSB	0x97	/* word64 LSB	@tprel(S + A) */
+#define	R_IA_64_LTOFF_TPREL22	0x9a	/* imm22	@ltoff(@tprel(S+A)) */
+#define	R_IA_64_DTPMOD64MSB	0xa6	/* word64 MSB	@dtpmod(S + A) */
+#define	R_IA_64_DTPMOD64LSB	0xa7	/* word64 LSB	@dtpmod(S + A) */
+#define	R_IA_64_LTOFF_DTPMOD22	0xaa	/* imm22	@ltoff(@dtpmod(S+A)) */
+#define	R_IA_64_DTPREL14	0xb1	/* imm14	@dtprel(S + A) */
+#define	R_IA_64_DTPREL22	0xb2	/* imm22	@dtprel(S + A) */
+#define	R_IA_64_DTPREL64I	0xb3	/* imm64	@dtprel(S + A) */
+#define	R_IA_64_DTPREL32MSB	0xb4	/* word32 MSB	@dtprel(S + A) */
+#define	R_IA_64_DTPREL32LSB	0xb5	/* word32 LSB	@dtprel(S + A) */
+#define	R_IA_64_DTPREL64MSB	0xb6	/* word64 MSB	@dtprel(S + A) */
+#define	R_IA_64_DTPREL64LSB	0xb7	/* word64 LSB	@dtprel(S + A) */
+#define	R_IA_64_LTOFF_DTPREL22	0xba	/* imm22	@ltoff(@dtprel(S+A)) */
+
+#define	R_MIPS_NONE	0	/* No reloc */
+#define	R_MIPS_16	1	/* Direct 16 bit */
+#define	R_MIPS_32	2	/* Direct 32 bit */
+#define	R_MIPS_REL32	3	/* PC relative 32 bit */
+#define	R_MIPS_26	4	/* Direct 26 bit shifted */
+#define	R_MIPS_HI16	5	/* High 16 bit */
+#define	R_MIPS_LO16	6	/* Low 16 bit */
+#define	R_MIPS_GPREL16	7	/* GP relative 16 bit */
+#define	R_MIPS_LITERAL	8	/* 16 bit literal entry */
+#define	R_MIPS_GOT16	9	/* 16 bit GOT entry */
+#define	R_MIPS_PC16	10	/* PC relative 16 bit */
+#define	R_MIPS_CALL16	11	/* 16 bit GOT entry for function */
+#define	R_MIPS_GPREL32	12	/* GP relative 32 bit */
+#define	R_MIPS_GOTHI16	21	/* GOT HI 16 bit */
+#define	R_MIPS_GOTLO16	22	/* GOT LO 16 bit */
+#define	R_MIPS_CALLHI16 30	/* upper 16 bit GOT entry for function */
+#define	R_MIPS_CALLLO16 31	/* lower 16 bit GOT entry for function */
+
+#define	R_PPC_NONE		0	/* No relocation. */
+#define	R_PPC_ADDR32		1
+#define	R_PPC_ADDR24		2
+#define	R_PPC_ADDR16		3
+#define	R_PPC_ADDR16_LO		4
+#define	R_PPC_ADDR16_HI		5
+#define	R_PPC_ADDR16_HA		6
+#define	R_PPC_ADDR14		7
+#define	R_PPC_ADDR14_BRTAKEN	8
+#define	R_PPC_ADDR14_BRNTAKEN	9
+#define	R_PPC_REL24		10
+#define	R_PPC_REL14		11
+#define	R_PPC_REL14_BRTAKEN	12
+#define	R_PPC_REL14_BRNTAKEN	13
+#define	R_PPC_GOT16		14
+#define	R_PPC_GOT16_LO		15
+#define	R_PPC_GOT16_HI		16
+#define	R_PPC_GOT16_HA		17
+#define	R_PPC_PLTREL24		18
+#define	R_PPC_COPY		19
+#define	R_PPC_GLOB_DAT		20
+#define	R_PPC_JMP_SLOT		21
+#define	R_PPC_RELATIVE		22
+#define	R_PPC_LOCAL24PC		23
+#define	R_PPC_UADDR32		24
+#define	R_PPC_UADDR16		25
+#define	R_PPC_REL32		26
+#define	R_PPC_PLT32		27
+#define	R_PPC_PLTREL32		28
+#define	R_PPC_PLT16_LO		29
+#define	R_PPC_PLT16_HI		30
+#define	R_PPC_PLT16_HA		31
+#define	R_PPC_SDAREL16		32
+#define	R_PPC_SECTOFF		33
+#define	R_PPC_SECTOFF_LO	34
+#define	R_PPC_SECTOFF_HI	35
+#define	R_PPC_SECTOFF_HA	36
+
+/*
+ * 64-bit relocations
+ */
+#define	R_PPC64_ADDR64		38
+#define	R_PPC64_ADDR16_HIGHER	39
+#define	R_PPC64_ADDR16_HIGHERA	40
+#define	R_PPC64_ADDR16_HIGHEST	41
+#define	R_PPC64_ADDR16_HIGHESTA	42
+#define	R_PPC64_UADDR64		43
+#define	R_PPC64_REL64		44
+#define	R_PPC64_PLT64		45
+#define	R_PPC64_PLTREL64	46
+#define	R_PPC64_TOC16		47
+#define	R_PPC64_TOC16_LO	48
+#define	R_PPC64_TOC16_HI	49
+#define	R_PPC64_TOC16_HA	50
+#define	R_PPC64_TOC		51
+#define	R_PPC64_DTPMOD64	68
+#define	R_PPC64_TPREL64		73
+#define	R_PPC64_DTPREL64	78
+
+/*
+ * TLS relocations
+ */
+#define	R_PPC_TLS		67
+#define	R_PPC_DTPMOD32		68
+#define	R_PPC_TPREL16		69
+#define	R_PPC_TPREL16_LO	70
+#define	R_PPC_TPREL16_HI	71
+#define	R_PPC_TPREL16_HA	72
+#define	R_PPC_TPREL32		73
+#define	R_PPC_DTPREL16		74
+#define	R_PPC_DTPREL16_LO	75
+#define	R_PPC_DTPREL16_HI	76
+#define	R_PPC_DTPREL16_HA	77
+#define	R_PPC_DTPREL32		78
+#define	R_PPC_GOT_TLSGD16	79
+#define	R_PPC_GOT_TLSGD16_LO	80
+#define	R_PPC_GOT_TLSGD16_HI	81
+#define	R_PPC_GOT_TLSGD16_HA	82
+#define	R_PPC_GOT_TLSLD16	83
+#define	R_PPC_GOT_TLSLD16_LO	84
+#define	R_PPC_GOT_TLSLD16_HI	85
+#define	R_PPC_GOT_TLSLD16_HA	86
+#define	R_PPC_GOT_TPREL16	87
+#define	R_PPC_GOT_TPREL16_LO	88
+#define	R_PPC_GOT_TPREL16_HI	89
+#define	R_PPC_GOT_TPREL16_HA	90
+
+/*
+ * The remaining relocs are from the Embedded ELF ABI, and are not in the
+ *  SVR4 ELF ABI.
+ */
+
+#define	R_PPC_EMB_NADDR32	101
+#define	R_PPC_EMB_NADDR16	102
+#define	R_PPC_EMB_NADDR16_LO	103
+#define	R_PPC_EMB_NADDR16_HI	104
+#define	R_PPC_EMB_NADDR16_HA	105
+#define	R_PPC_EMB_SDAI16	106
+#define	R_PPC_EMB_SDA2I16	107
+#define	R_PPC_EMB_SDA2REL	108
+#define	R_PPC_EMB_SDA21		109
+#define	R_PPC_EMB_MRKREF	110
+#define	R_PPC_EMB_RELSEC16	111
+#define	R_PPC_EMB_RELST_LO	112
+#define	R_PPC_EMB_RELST_HI	113
+#define	R_PPC_EMB_RELST_HA	114
+#define	R_PPC_EMB_BIT_FLD	115
+#define	R_PPC_EMB_RELSDA	116
+
+#define	R_SPARC_NONE		0
+#define	R_SPARC_8		1
+#define	R_SPARC_16		2
+#define	R_SPARC_32		3
+#define	R_SPARC_DISP8		4
+#define	R_SPARC_DISP16		5
+#define	R_SPARC_DISP32		6
+#define	R_SPARC_WDISP30		7
+#define	R_SPARC_WDISP22		8
+#define	R_SPARC_HI22		9
+#define	R_SPARC_22		10
+#define	R_SPARC_13		11
+#define	R_SPARC_LO10		12
+#define	R_SPARC_GOT10		13
+#define	R_SPARC_GOT13		14
+#define	R_SPARC_GOT22		15
+#define	R_SPARC_PC10		16
+#define	R_SPARC_PC22		17
+#define	R_SPARC_WPLT30		18
+#define	R_SPARC_COPY		19
+#define	R_SPARC_GLOB_DAT	20
+#define	R_SPARC_JMP_SLOT	21
+#define	R_SPARC_RELATIVE	22
+#define	R_SPARC_UA32		23
+#define	R_SPARC_PLT32		24
+#define	R_SPARC_HIPLT22		25
+#define	R_SPARC_LOPLT10		26
+#define	R_SPARC_PCPLT32		27
+#define	R_SPARC_PCPLT22		28
+#define	R_SPARC_PCPLT10		29
+#define	R_SPARC_10		30
+#define	R_SPARC_11		31
+#define	R_SPARC_64		32
+#define	R_SPARC_OLO10		33
+#define	R_SPARC_HH22		34
+#define	R_SPARC_HM10		35
+#define	R_SPARC_LM22		36
+#define	R_SPARC_PC_HH22		37
+#define	R_SPARC_PC_HM10		38
+#define	R_SPARC_PC_LM22		39
+#define	R_SPARC_WDISP16		40
+#define	R_SPARC_WDISP19		41
+#define	R_SPARC_GLOB_JMP	42
+#define	R_SPARC_7		43
+#define	R_SPARC_5		44
+#define	R_SPARC_6		45
+#define	R_SPARC_DISP64		46
+#define	R_SPARC_PLT64		47
+#define	R_SPARC_HIX22		48
+#define	R_SPARC_LOX10		49
+#define	R_SPARC_H44		50
+#define	R_SPARC_M44		51
+#define	R_SPARC_L44		52
+#define	R_SPARC_REGISTER	53
+#define	R_SPARC_UA64		54
+#define	R_SPARC_UA16		55
+#define	R_SPARC_TLS_GD_HI22	56
+#define	R_SPARC_TLS_GD_LO10	57
+#define	R_SPARC_TLS_GD_ADD	58
+#define	R_SPARC_TLS_GD_CALL	59
+#define	R_SPARC_TLS_LDM_HI22	60
+#define	R_SPARC_TLS_LDM_LO10	61
+#define	R_SPARC_TLS_LDM_ADD	62
+#define	R_SPARC_TLS_LDM_CALL	63
+#define	R_SPARC_TLS_LDO_HIX22	64
+#define	R_SPARC_TLS_LDO_LOX10	65
+#define	R_SPARC_TLS_LDO_ADD	66
+#define	R_SPARC_TLS_IE_HI22	67
+#define	R_SPARC_TLS_IE_LO10	68
+#define	R_SPARC_TLS_IE_LD	69
+#define	R_SPARC_TLS_IE_LDX	70
+#define	R_SPARC_TLS_IE_ADD	71
+#define	R_SPARC_TLS_LE_HIX22	72
+#define	R_SPARC_TLS_LE_LOX10	73
+#define	R_SPARC_TLS_DTPMOD32	74
+#define	R_SPARC_TLS_DTPMOD64	75
+#define	R_SPARC_TLS_DTPOFF32	76
+#define	R_SPARC_TLS_DTPOFF64	77
+#define	R_SPARC_TLS_TPOFF32	78
+#define	R_SPARC_TLS_TPOFF64	79
+
+#define	R_X86_64_NONE		0	/* No relocation. */
+#define	R_X86_64_64		1	/* Add 64 bit symbol value. */
+#define	R_X86_64_PC32		2	/* PC-relative 32 bit signed sym value. */
+#define	R_X86_64_GOT32		3	/* PC-relative 32 bit GOT offset. */
+#define	R_X86_64_PLT32		4	/* PC-relative 32 bit PLT offset. */
+#define	R_X86_64_COPY		5	/* Copy data from shared object. */
+#define	R_X86_64_GLOB_DAT	6	/* Set GOT entry to data address. */
+#define	R_X86_64_JMP_SLOT	7	/* Set GOT entry to code address. */
+#define	R_X86_64_RELATIVE	8	/* Add load address of shared object. */
+#define	R_X86_64_GOTPCREL	9	/* Add 32 bit signed pcrel offset to GOT. */
+#define	R_X86_64_32		10	/* Add 32 bit zero extended symbol value */
+#define	R_X86_64_32S		11	/* Add 32 bit sign extended symbol value */
+#define	R_X86_64_16		12	/* Add 16 bit zero extended symbol value */
+#define	R_X86_64_PC16		13	/* Add 16 bit signed extended pc relative symbol value */
+#define	R_X86_64_8		14	/* Add 8 bit zero extended symbol value */
+#define	R_X86_64_PC8		15	/* Add 8 bit signed extended pc relative symbol value */
+#define	R_X86_64_DTPMOD64	16	/* ID of module containing symbol */
+#define	R_X86_64_DTPOFF64	17	/* Offset in TLS block */
+#define	R_X86_64_TPOFF64	18	/* Offset in static TLS block */
+#define	R_X86_64_TLSGD		19	/* PC relative offset to GD GOT entry */
+#define	R_X86_64_TLSLD		20	/* PC relative offset to LD GOT entry */
+#define	R_X86_64_DTPOFF32	21	/* Offset in TLS block */
+#define	R_X86_64_GOTTPOFF	22	/* PC relative offset to IE GOT entry */
+#define	R_X86_64_TPOFF32	23	/* Offset in static TLS block */
+
+
+#endif /* !_SYS_ELF_COMMON_H_ */

Property changes on: lab4/.minix-src/include/sys/elf_common.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/fstypes.h
===================================================================
--- lab4/.minix-src/include/sys/fstypes.h	(nonexistent)
+++ lab4/.minix-src/include/sys/fstypes.h	(revision 13)
@@ -0,0 +1,285 @@
+/*	$NetBSD: fstypes.h,v 1.33 2015/05/06 15:57:08 hannken Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)mount.h	8.21 (Berkeley) 5/20/95
+ */
+
+#ifndef _SYS_FSTYPES_H_
+#define	_SYS_FSTYPES_H_
+
+typedef struct { int32_t __fsid_val[2]; } fsid_t; /* file system id type */
+
+#if defined(_KERNEL)
+/*
+ * File identifier.
+ * These are unique per filesystem on a single machine.
+ */
+struct fid {
+	unsigned short	fid_len;		/* length of data in bytes */
+	unsigned short	fid_reserved;		/* compat: historic align */
+	char		fid_data[0];		/* data (variable length) */
+};
+
+/*
+ * Generic file handle
+ */
+struct fhandle {
+	fsid_t	fh_fsid;	/* File system id of mount point */
+	struct	fid fh_fid;	/* File sys specific id */
+};
+typedef struct fhandle	fhandle_t;
+
+/*
+ * FHANDLE_SIZE_MAX: arbitrary value to prevent unreasonable allocation.
+ *
+ * FHANDLE_SIZE_MIN: chosen for compatibility.  smaller handles are zero-padded.
+ */
+
+#define	FHANDLE_SIZE_COMPAT	28
+#define	FHANDLE_SIZE_MAX	1024
+#define	FHANDLE_SIZE_MIN	FHANDLE_SIZE_COMPAT
+
+#define	FHANDLE_FSID(fh)	(&(fh)->fh_fsid)
+#define	FHANDLE_FILEID(fh)	(&(fh)->fh_fid)
+#define	FHANDLE_SIZE_FROM_FILEID_SIZE(fidsize) \
+	MAX(FHANDLE_SIZE_MIN, (offsetof(fhandle_t, fh_fid) + (fidsize)))
+#define	FHANDLE_SIZE(fh) \
+	FHANDLE_SIZE_FROM_FILEID_SIZE(FHANDLE_FILEID(fh)->fid_len)
+#endif /* defined(_KERNEL) */
+
+/*
+ * Mount flags.  XXX BEWARE: these are not in numerical order!
+ *
+ * Unmount uses MNT_FORCE flag.
+ *
+ * Note that all mount flags are listed here.  if you need to add one, take
+ * one of the __MNT_UNUSED flags.
+ */
+
+#define	__MNT_UNUSED1	0x00200000
+
+#define	MNT_RDONLY	0x00000001	/* read only filesystem */
+#define	MNT_SYNCHRONOUS	0x00000002	/* file system written synchronously */
+#define	MNT_NOEXEC	0x00000004	/* can't exec from filesystem */
+#define	MNT_NOSUID	0x00000008	/* don't honor setuid bits on fs */
+#define	MNT_NODEV	0x00000010	/* don't interpret special files */
+#define	MNT_UNION	0x00000020	/* union with underlying filesystem */
+#define	MNT_ASYNC	0x00000040	/* file system written asynchronously */
+#define	MNT_NOCOREDUMP	0x00008000	/* don't write core dumps to this FS */
+#define	MNT_RELATIME	0x00020000	/* only update access time if mod/ch */
+#define	MNT_IGNORE	0x00100000	/* don't show entry in df */
+#define	MNT_DISCARD	0x00800000	/* use DISCARD/TRIM if supported */
+#define	MNT_EXTATTR	0x01000000	/* enable extended attributes */
+#define	MNT_LOG		0x02000000	/* Use logging */
+#define	MNT_NOATIME	0x04000000	/* Never update access times in fs */
+#define	MNT_SYMPERM	0x20000000	/* recognize symlink permission */
+#define	MNT_NODEVMTIME	0x40000000	/* Never update mod times for devs */
+#define	MNT_SOFTDEP	0x80000000	/* Use soft dependencies */
+
+#define	__MNT_BASIC_FLAGS \
+	{ MNT_ASYNC,		0,	"asynchronous" }, \
+	{ MNT_DISCARD,		0,	"discard" }, \
+	{ MNT_EXTATTR,		0,	"extattr" }, \
+	{ MNT_IGNORE,		0,	"hidden" }, \
+	{ MNT_LOG,		0,	"log" }, \
+	{ MNT_NOATIME,		0,	"noatime" }, \
+	{ MNT_NOCOREDUMP,	0,	"nocoredump" }, \
+	{ MNT_NODEV,		0,	"nodev" }, \
+	{ MNT_NODEVMTIME,	0,	"nodevmtime" }, \
+	{ MNT_NOEXEC,		0,	"noexec" }, \
+	{ MNT_NOSUID,		0,	"nosuid" }, \
+	{ MNT_RDONLY,		0,	"read-only" }, \
+	{ MNT_RELATIME,		0,	"relatime" }, \
+	{ MNT_SOFTDEP,		0,	"soft dependencies" }, \
+	{ MNT_SYMPERM,		0,	"symperm" }, \
+	{ MNT_SYNCHRONOUS,	0,	"synchronous" }, \
+	{ MNT_UNION,		0,	"union" }, \
+
+#define MNT_BASIC_FLAGS (MNT_ASYNC | MNT_DISCARD | MNT_EXTATTR | MNT_LOG | \
+    MNT_NOATIME | MNT_NOCOREDUMP | MNT_NODEV | MNT_NODEVMTIME | MNT_NOEXEC | \
+    MNT_NOSUID | MNT_RDONLY | MNT_RELATIME | MNT_SOFTDEP | MNT_SYMPERM | \
+    MNT_SYNCHRONOUS | MNT_UNION)
+/*
+ * exported mount flags.
+ */
+#define	MNT_EXRDONLY	0x00000080	/* exported read only */
+#define	MNT_EXPORTED	0x00000100	/* file system is exported */
+#define	MNT_DEFEXPORTED	0x00000200	/* exported to the world */
+#define	MNT_EXPORTANON	0x00000400	/* use anon uid mapping for everyone */
+#define	MNT_EXKERB	0x00000800	/* exported with Kerberos uid mapping */
+#define	MNT_EXNORESPORT	0x08000000	/* don't enforce reserved ports (NFS) */
+#define	MNT_EXPUBLIC	0x10000000	/* public export (WebNFS) */
+
+#define	__MNT_EXPORTED_FLAGS \
+	{ MNT_EXRDONLY,		1,	"exported read-only" }, \
+	{ MNT_EXPORTED,		0,	"NFS exported" }, \
+	{ MNT_DEFEXPORTED,	1,	"exported to the world" }, \
+	{ MNT_EXPORTANON,	1,	"anon uid mapping" }, \
+	{ MNT_EXKERB,		1,	"kerberos uid mapping" }, \
+	{ MNT_EXNORESPORT,	0,	"non-reserved ports" }, \
+	{ MNT_EXPUBLIC,		0,	"WebNFS exports" },
+
+/*
+ * Flags set by internal operations.
+ */
+#define	MNT_LOCAL	0x00001000	/* filesystem is stored locally */
+#define	MNT_QUOTA	0x00002000	/* quotas are enabled on filesystem */
+#define	MNT_ROOTFS	0x00004000	/* identifies the root filesystem */
+
+#define	__MNT_INTERNAL_FLAGS \
+	{ MNT_LOCAL,		0,	"local" }, \
+	{ MNT_QUOTA,		0,	"with quotas" }, \
+	{ MNT_ROOTFS,		1,	"root file system" },
+
+/*
+ * Mask of flags that are visible to statvfs()
+ */
+#define	MNT_VISFLAGMASK	( \
+     MNT_RDONLY | \
+     MNT_SYNCHRONOUS | \
+     MNT_NOEXEC | \
+     MNT_NOSUID | \
+     MNT_NODEV | \
+     MNT_UNION | \
+     MNT_ASYNC | \
+     MNT_NOCOREDUMP | \
+     MNT_IGNORE | \
+     MNT_DISCARD | \
+     MNT_NOATIME | \
+     MNT_SYMPERM | \
+     MNT_NODEVMTIME | \
+     MNT_SOFTDEP | \
+     MNT_EXRDONLY | \
+     MNT_EXPORTED | \
+     MNT_DEFEXPORTED | \
+     MNT_EXPORTANON | \
+     MNT_EXKERB | \
+     MNT_EXNORESPORT | \
+     MNT_EXPUBLIC | \
+     MNT_LOCAL | \
+     MNT_QUOTA | \
+     MNT_ROOTFS | \
+     MNT_LOG | \
+     MNT_EXTATTR)
+
+/*
+ * External filesystem control flags.
+ */
+#define	MNT_UPDATE	0x00010000	/* not a real mount, just an update */
+#define	MNT_RELOAD	0x00040000	/* reload filesystem data */
+#define	MNT_FORCE	0x00080000	/* force unmount or readonly change */
+#define	MNT_GETARGS	0x00400000	/* retrieve file system specific args */
+
+#define	MNT_OP_FLAGS	(MNT_UPDATE|MNT_RELOAD|MNT_FORCE|MNT_GETARGS)
+
+#define	__MNT_EXTERNAL_FLAGS \
+	{ MNT_UPDATE,		1,	"being updated" }, \
+	{ MNT_RELOAD,		1,	"reload filesystem data" }, \
+	{ MNT_FORCE,		1,	"force unmount or readonly change" }, \
+	{ MNT_GETARGS,		1,	"retrieve mount arguments" },
+
+/*
+ * Internal filesystem control flags.
+ * These are set in struct mount mnt_iflag.
+ *
+ * IMNT_UNMOUNT locks the mount entry so that name lookup cannot proceed
+ * past the mount point.  This keeps the subtree stable during mounts
+ * and unmounts.
+ */
+#define	IMNT_GONE	0x00000001	/* filesystem is gone.. */
+#define	IMNT_UNMOUNT	0x00000002	/* unmount in progress */
+#define	IMNT_WANTRDWR	0x00000004	/* upgrade to read/write requested */
+#define	IMNT_DTYPE	0x00000040	/* returns d_type fields */
+#define	IMNT_HAS_TRANS	0x00000080	/* supports transactions */
+#define	IMNT_MPSAFE	0x00000100	/* file system code MP safe */
+#define	IMNT_CAN_RWTORO	0x00000200	/* can downgrade fs to from rw to r/o */
+#define	IMNT_ONWORKLIST	0x00000400	/* on syncer worklist */
+
+#define	__MNT_FLAGS \
+	__MNT_BASIC_FLAGS \
+	__MNT_EXPORTED_FLAGS \
+	__MNT_INTERNAL_FLAGS \
+	__MNT_EXTERNAL_FLAGS
+
+#define	__MNT_FLAG_BITS \
+	"\20" \
+	"\40MNT_SOFTDEP" \
+	"\37MNT_NODEVMTIME" \
+	"\36MNT_SYMPERM" \
+	"\35MNT_EXPUBLIC" \
+	"\34MNT_EXNORESPORT" \
+	"\33MNT_NOATIME" \
+	"\32MNT_LOG" \
+	"\31MNT_EXTATTR" \
+	"\30MNT_DISCARD" \
+	"\27MNT_GETARGS" \
+	"\26MNT_UNUSED" \
+	"\25MNT_IGNORE" \
+	"\24MNT_FORCE" \
+	"\23MNT_RELOAD" \
+	"\22MNT_RELATIME" \
+	"\21MNT_UPDATE" \
+	"\20MNT_NOCOREDUMP" \
+	"\17MNT_ROOTFS" \
+	"\16MNT_QUOTA" \
+	"\15MNT_LOCAL" \
+	"\14MNT_EXKERB" \
+	"\13MNT_EXPORTANON" \
+	"\12MNT_DEFEXPORTED" \
+	"\11MNT_EXPORTED" \
+	"\10MNT_EXRDONLY" \
+	"\07MNT_ASYNC" \
+	"\06MNT_UNION" \
+	"\05MNT_NODEV" \
+	"\04MNT_NOSUID" \
+	"\03MNT_NOEXEC" \
+	"\02MNT_SYNCHRONOUS" \
+	"\01MNT_RDONLY"
+
+#define	__IMNT_FLAG_BITS \
+	"\20" \
+	"\13IMNT_ONWORKLIST" \
+	"\12IMNT_CAN_RWTORO" \
+        "\11IMNT_MPSAFE" \
+	"\10IMNT_HAS_TRANS" \
+	"\07IMNT_DTYPE" \
+	"\03IMNT_WANTRDWR" \
+	"\02IMNT_UNMOUNT" \
+	"\01IMNT_GONE"
+
+/*
+ * Flags for various system call interfaces.
+ *
+ * waitfor flags to vfs_sync() and getvfsstat()
+ */
+#define	MNT_WAIT	1	/* synchronously wait for I/O to complete */
+#define	MNT_NOWAIT	2	/* start all I/O, but do not wait for it */
+#define	MNT_LAZY 	3	/* push data not written by filesystem syncer */
+#endif /* _SYS_FSTYPES_H_ */

Property changes on: lab4/.minix-src/include/sys/fstypes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ctype_inline.h
===================================================================
--- lab4/.minix-src/include/sys/ctype_inline.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ctype_inline.h	(revision 13)
@@ -0,0 +1,74 @@
+/* $NetBSD: ctype_inline.h,v 1.4 2015/02/24 13:17:27 joerg Exp $ */
+
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ctype.h	5.3 (Berkeley) 4/3/91
+ *	NetBSD: ctype.h,v 1.30 2010/05/22 06:38:15 tnozaki Exp
+ */
+
+#ifndef _CTYPE_INLINE_H_
+#define _CTYPE_INLINE_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+#include <sys/ctype_bits.h>
+
+#define	isalnum(c)	((int)((_ctype_tab_ + 1)[(c)] & (_CTYPE_A|_CTYPE_D)))
+#define	isalpha(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_A))
+#define	iscntrl(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_C))
+#define	isdigit(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_D))
+#define	isgraph(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_G))
+#define	islower(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_L))
+#define	isprint(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_R))
+#define	ispunct(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_P))
+#define	isspace(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_S))
+#define	isupper(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_U))
+#define	isxdigit(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_X))
+#define	tolower(c)	((int)((_tolower_tab_ + 1)[(c)]))
+#define	toupper(c)	((int)((_toupper_tab_ + 1)[(c)]))
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define	isascii(c)	((unsigned)(c) <= 0177)
+#define	toascii(c)	((c) & 0177)
+#define _tolower(c)	((c) - 'A' + 'a')
+#define _toupper(c)	((c) - 'a' + 'A')
+#endif
+
+#if defined(_ISOC99_SOURCE) || (_POSIX_C_SOURCE - 0) > 200112L || \
+    (_XOPEN_SOURCE - 0) > 600 || defined(_NETBSD_SOURCE)
+#define	isblank(c)	((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_BL))
+#endif
+
+#endif /* !_CTYPE_INLINE_H_ */

Property changes on: lab4/.minix-src/include/sys/ctype_inline.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/envsys.h
===================================================================
--- lab4/.minix-src/include/sys/envsys.h	(nonexistent)
+++ lab4/.minix-src/include/sys/envsys.h	(revision 13)
@@ -0,0 +1,198 @@
+/* $NetBSD: envsys.h,v 1.34 2014/05/18 11:46:24 kardel Exp $ */
+
+/*-
+ * Copyright (c) 1999, 2007, 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tim Rightnour, Juan Romero Pardines and Bill Squier.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_ENVSYS_H_
+#define _SYS_ENVSYS_H_
+
+#ifndef _KERNEL
+#include <stdbool.h>
+#endif
+
+#include <sys/ioccom.h>
+#include <sys/power.h>
+#include <sys/queue.h>
+
+/*
+ * ENVironmental SYStem version 2 (aka ENVSYS 2)
+ */
+
+#define ENVSYS_MAXSENSORS	512
+#define ENVSYS_DESCLEN		32
+
+/* sensor units */
+enum envsys_units {
+	ENVSYS_STEMP		= 0,	/* Temperature (microkelvins) */
+	ENVSYS_SFANRPM,			/* Fan RPM */
+	ENVSYS_SVOLTS_AC,		/* AC Volts */
+	ENVSYS_SVOLTS_DC,		/* DC Volts */
+	ENVSYS_SOHMS,			/* Ohms */
+	ENVSYS_SWATTS,			/* Watts */
+	ENVSYS_SAMPS,			/* Ampere */
+	ENVSYS_SWATTHOUR,		/* Watt hour */
+	ENVSYS_SAMPHOUR,		/* Ampere hour */
+	ENVSYS_INDICATOR,		/* Indicator */
+	ENVSYS_INTEGER,			/* Integer */
+	ENVSYS_DRIVE,			/* Drive */
+	ENVSYS_BATTERY_CAPACITY,	/* Battery capacity */
+	ENVSYS_BATTERY_CHARGE,		/* Battery charging/discharging */
+	ENVSYS_SRELHUMIDITY,		/* relative humidity */
+	ENVSYS_NSENSORS
+};
+
+/* sensor states */
+enum envsys_states {
+	ENVSYS_SVALID		= 10,	/* sensor state is valid */
+	ENVSYS_SINVALID,		/* sensor state is invalid */
+	ENVSYS_SCRITICAL,		/* sensor state is critical */
+	ENVSYS_SCRITUNDER,		/* sensor state is critical under */
+	ENVSYS_SCRITOVER,		/* sensor state is critical over */
+	ENVSYS_SWARNUNDER,		/* sensor state is warn under */
+	ENVSYS_SWARNOVER		/* sensor state is warn over */
+};
+
+/* sensor drive states */
+enum envsys_drive_states {
+	ENVSYS_DRIVE_EMPTY	= 1,	/* drive is empty */
+	ENVSYS_DRIVE_READY,		/* drive is ready */
+	ENVSYS_DRIVE_POWERUP,		/* drive is powered up */
+	ENVSYS_DRIVE_ONLINE,		/* drive is online */
+	ENVSYS_DRIVE_IDLE,		/* drive is idle */
+	ENVSYS_DRIVE_ACTIVE,		/* drive is active */
+	ENVSYS_DRIVE_REBUILD,		/* drive is rebuilding */
+	ENVSYS_DRIVE_POWERDOWN,		/* drive is powered down */
+	ENVSYS_DRIVE_FAIL,		/* drive failed */
+	ENVSYS_DRIVE_PFAIL,		/* drive is degraded */
+	ENVSYS_DRIVE_MIGRATING,		/* drive is migrating */
+	ENVSYS_DRIVE_OFFLINE,		/* drive is offline */
+	ENVSYS_DRIVE_BUILD,		/* drive is building */
+	ENVSYS_DRIVE_CHECK		/* drive is checking its state */
+};
+
+/* sensor battery capacity states */
+enum envsys_battery_capacity_states {
+	ENVSYS_BATTERY_CAPACITY_NORMAL	= 1,	/* normal cap in battery */
+	ENVSYS_BATTERY_CAPACITY_WARNING,	/* warning cap in battery */
+	ENVSYS_BATTERY_CAPACITY_CRITICAL,	/* critical cap in battery */
+	ENVSYS_BATTERY_CAPACITY_HIGH,		/* high cap in battery */
+	ENVSYS_BATTERY_CAPACITY_MAX,		/* maximum cap in battery */
+	ENVSYS_BATTERY_CAPACITY_LOW		/* low cap in battery */
+};
+
+/* sensor indicator states */
+enum envsys_indicator_states {
+	ENVSYS_INDICATOR_FALSE		= 0,
+	ENVSYS_INDICATOR_TRUE		= 1
+};
+
+/*
+ * IOCTLs
+ */
+#define ENVSYS_GETDICTIONARY	_IOWR('E', 0, struct plistref)
+#define ENVSYS_SETDICTIONARY	_IOWR('E', 1, struct plistref)
+#define ENVSYS_REMOVEPROPS	_IOWR('E', 2, struct plistref)
+
+/*
+ * Compatibility with old interface. Only ENVSYS_GTREDATA
+ * and ENVSYS_GTREINFO ioctls are supported.
+ */
+
+/* get sensor data */
+
+struct envsys_tre_data {
+	u_int sensor;
+	union {				/* all data is given */
+		uint32_t data_us;	/* in microKelvins, */
+		int32_t data_s;		/* rpms, volts, amps, */
+	} cur, min, max, avg;		/* ohms, watts, etc */
+					/* see units below */
+
+	uint32_t	warnflags;	/* warning flags */
+	uint32_t	validflags;	/* sensor valid flags */
+	u_int		units;		/* type of sensor */
+};
+typedef struct envsys_tre_data envsys_tre_data_t;
+
+/* flags for warnflags */
+#define ENVSYS_WARN_OK		0x00000000  /* All is well */
+#define ENVSYS_WARN_UNDER	0x00000001  /* an under condition */
+#define ENVSYS_WARN_CRITUNDER	0x00000002  /* a critical under condition */
+#define ENVSYS_WARN_OVER	0x00000004  /* an over condition */
+#define ENVSYS_WARN_CRITOVER	0x00000008  /* a critical over condition */
+
+/* drive status */
+#define ENVSYS_DRIVE_EMPTY      1
+#define ENVSYS_DRIVE_READY      2
+#define ENVSYS_DRIVE_POWERUP    3
+#define ENVSYS_DRIVE_ONLINE     4
+#define ENVSYS_DRIVE_IDLE       5
+#define ENVSYS_DRIVE_ACTIVE     6
+#define ENVSYS_DRIVE_REBUILD    7
+#define ENVSYS_DRIVE_POWERDOWN  8
+#define ENVSYS_DRIVE_FAIL       9
+#define ENVSYS_DRIVE_PFAIL      10
+
+#ifdef ENVSYSUNITNAMES
+static const char * const envsysunitnames[] = {
+    "degC", "RPM", "VAC", "V", "Ohms", "W",
+    "A", "Wh", "Ah", "bool", "integer", "drive", "%rH", "Unk"
+};
+static const char * const envsysdrivestatus[] = {
+    "unknown", "empty", "ready", "powering up", "online", "idle", "active",
+    "rebuilding", "powering down", "failed", "degraded"
+};
+#endif
+
+
+/* flags for validflags */
+#define ENVSYS_FVALID		0x00000001  /* sensor is valid */
+#define ENVSYS_FCURVALID	0x00000002  /* cur for this sens is valid */
+#define ENVSYS_FMINVALID	0x00000004  /* min for this sens is valid */
+#define ENVSYS_FMAXVALID	0x00000008  /* max for this sens is valid */
+#define ENVSYS_FAVGVALID	0x00000010  /* avg for this sens is valid */
+#define ENVSYS_FFRACVALID	0x00000020  /* display fraction of max */
+
+#define ENVSYS_GTREDATA 	_IOWR('E', 2, envsys_tre_data_t)
+
+/* set and check sensor info */
+
+struct envsys_basic_info {
+	u_int	sensor;		/* sensor number */
+	u_int	units;		/* type of sensor */
+	char	desc[33];	/* sensor description */
+	u_int	rfact;		/* for volts, (int)(factor x 10^4) */
+	u_int	rpms;		/* for fans, set nominal RPMs */
+	uint32_t validflags;	/* sensor valid flags */
+};
+typedef struct envsys_basic_info envsys_basic_info_t;
+
+#define ENVSYS_GTREINFO 	_IOWR('E', 4, envsys_basic_info_t)
+
+#endif /* _SYS_ENVSYS_H_ */

Property changes on: lab4/.minix-src/include/sys/envsys.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/dkio.h
===================================================================
--- lab4/.minix-src/include/sys/dkio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/dkio.h	(revision 13)
@@ -0,0 +1,122 @@
+/*	$NetBSD: dkio.h,v 1.21 2014/12/29 18:41:20 mlelstv Exp $	*/
+
+/*
+ * Copyright (c) 1987, 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_DKIO_H_
+#define _SYS_DKIO_H_
+
+#include <sys/ioccom.h>
+#include <prop/plistref.h>
+
+/*
+ * Disk-specific ioctls.
+ */
+		/* get and set disklabel; DIOCGPART used internally */
+#define DIOCGDINFO	_IOR('d', 101, struct disklabel)/* get */
+#define DIOCSDINFO	_IOW('d', 102, struct disklabel)/* set */
+#define DIOCWDINFO	_IOW('d', 103, struct disklabel)/* set, update disk */
+
+#ifdef _KERNEL
+#define DIOCGDINFO32	(DIOCGDINFO - (sizeof(uint32_t) << IOCPARM_SHIFT))
+#define DIOCGPART	_IOW('d', 104, struct partinfo)	/* get partition */
+#endif
+
+#if defined(__HAVE_OLD_DISKLABEL) && defined(_KERNEL)
+#define ODIOCGDINFO	_IOR('d', 101, struct olddisklabel)/* get */
+#define ODIOCSDINFO	_IOW('d', 102, struct olddisklabel)/* set */
+#define ODIOCWDINFO	_IOW('d', 103, struct olddisklabel)/* set, update dk */
+#endif
+
+/* do format operation, read or write */
+#define DIOCRFORMAT	_IOWR('d', 105, struct format_op)
+#define DIOCWFORMAT	_IOWR('d', 106, struct format_op)
+
+#define DIOCSSTEP	_IOW('d', 107, int)	/* set step rate */
+#define DIOCSRETRIES	_IOW('d', 108, int)	/* set # of retries */
+#define DIOCKLABEL	_IOW('d', 119, int)	/* keep/drop label on close? */
+#define DIOCWLABEL	_IOW('d', 109, int)	/* write en/disable label */
+
+#define DIOCSBAD	_IOW('d', 110, struct dkbad)	/* set kernel dkbad */
+#define DIOCEJECT	_IOW('d', 112, int)	/* eject removable disk */
+#define ODIOCEJECT	_IO('d', 112)		/* eject removable disk */
+#define DIOCLOCK	_IOW('d', 113, int)	/* lock/unlock pack */
+
+		/* get default label, clear label */
+#define	DIOCGDEFLABEL	_IOR('d', 114, struct disklabel)
+#define	DIOCCLRLABEL	_IO('d', 115)
+
+#if defined(__HAVE_OLD_DISKLABEL) && defined(_KERNEL)
+#define	ODIOCGDEFLABEL	_IOR('d', 114, struct olddisklabel)
+#endif
+
+		/* disk cache enable/disable */
+#define	DIOCGCACHE	_IOR('d', 116, int)	/* get cache enables */
+#define	DIOCSCACHE	_IOW('d', 117, int)	/* set cache enables */
+
+#define	DKCACHE_READ	0x000001 /* read cache enabled */
+#define	DKCACHE_WRITE	0x000002 /* write(back) cache enabled */
+#define	DKCACHE_RCHANGE	0x000100 /* read enable is changeable */
+#define	DKCACHE_WCHANGE	0x000200 /* write enable is changeable */
+#define	DKCACHE_SAVE	0x010000 /* cache parameters are savable/save them */
+
+		/* sync disk cache */
+#define	DIOCCACHESYNC	_IOW('d', 118, int)	/* sync cache (force?) */
+
+		/* bad sector list */
+#define	DIOCBSLIST	_IOWR('d', 119, struct disk_badsecinfo)	/* get list */
+#define	DIOCBSFLUSH	_IO('d', 120)			/* flush list */
+
+		/* wedges */
+#define	DIOCAWEDGE	_IOWR('d', 121, struct dkwedge_info) /* add wedge */
+#define	DIOCGWEDGEINFO	_IOR('d', 122, struct dkwedge_info)  /* get wedge inf */
+#define	DIOCDWEDGE	_IOW('d', 123, struct dkwedge_info)  /* del wedge */
+#define	DIOCLWEDGES	_IOWR('d', 124, struct dkwedge_list) /* list wedges */
+
+		/* disk buffer queue strategy */
+#define	DIOCGSTRATEGY	_IOR('d', 125, struct disk_strategy)
+#define	DIOCSSTRATEGY	_IOW('d', 126, struct disk_strategy)
+
+		/* get disk-info dictionary */
+#define	DIOCGDISKINFO	_IOR('d', 127, struct plistref)
+
+
+#define	DIOCTUR		_IOR('d', 128, int)	/* test unit ready */
+
+/* 129 was DIOCGDISCARDPARAMS during 6.99 */
+/* 130 was DIOCDISCARD during 6.99 */
+
+		/* trigger wedge auto discover */
+#define	DIOCMWEDGES	_IOR('d', 131, int)	/* make wedges */
+
+		/* query disk geometry */
+#define	DIOCGSECTORSIZE	_IOR('d', 133, u_int)	/* sector size in bytes */
+#define	DIOCGMEDIASIZE	_IOR('d', 132, off_t)	/* media size in bytes */
+
+#endif /* _SYS_DKIO_H_ */

Property changes on: lab4/.minix-src/include/sys/dkio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/hash.h
===================================================================
--- lab4/.minix-src/include/sys/hash.h	(nonexistent)
+++ lab4/.minix-src/include/sys/hash.h	(revision 13)
@@ -0,0 +1,106 @@
+/*	$NetBSD: hash.h,v 1.8 2014/09/05 05:46:15 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_SYS_HASH_H_
+#define	_SYS_HASH_H_
+
+#include <sys/types.h>
+
+#ifdef __HAVE_MACHINE_HASH_H
+#include <machine/hash.h>
+#endif
+
+#ifndef __HAVE_HASH32_BUF			/* not overridden by MD hash */
+
+#define	HASH32_BUF_INIT	5381
+
+/*
+ * uint32_t
+ * hash32_buf(const void *bf, size_t len, uint32_t hash)
+ *	return a 32 bit hash of the binary buffer buf (size len),
+ *	seeded with an initial hash value of hash (usually HASH32_BUF_INIT).
+ */
+static __inline uint32_t
+hash32_buf(const void *bf, size_t len, uint32_t hash)
+{
+	const uint8_t *s = (const uint8_t *)bf;
+
+	while (len-- != 0)			/* "nemesi": k=257, r=r*257 */
+		hash = hash * 257 + *s++;
+	return (hash * 257);
+}
+#endif	/* __HAVE_HASH32_BUF */
+
+
+#ifndef __HAVE_HASH32_STR			/* not overridden by MD hash */
+
+#define	HASH32_STR_INIT	5381
+/*
+ * uint32_t
+ * hash32_str(const void *bf, uint32_t hash)
+ *	return a 32 bit hash of NUL terminated ASCII string buf,
+ *	seeded with an initial hash value of hash (usually HASH32_STR_INIT).
+ */
+static __inline uint32_t
+hash32_str(const void *bf, uint32_t hash)
+{
+	const uint8_t *s = (const uint8_t *)bf;
+	uint8_t	c;
+
+	while ((c = *s++) != 0)
+		hash = hash * 33 + c;		/* "perl": k=33, r=r+r/32 */
+	return (hash + (hash >> 5));
+}
+
+/*
+ * uint32_t
+ * hash32_strn(const void *bf, size_t len, uint32_t hash)
+ *	return a 32 bit hash of NUL terminated ASCII string buf up to
+ *	a maximum of len bytes,
+ *	seeded with an initial hash value of hash (usually HASH32_STR_INIT).
+ */
+static __inline uint32_t
+hash32_strn(const void *bf, size_t len, uint32_t hash)
+{
+	const uint8_t *s = (const uint8_t *)bf;
+	uint8_t	c;
+
+	while ((c = *s++) != 0 && len-- != 0)
+		hash = hash * 33 + c;		/* "perl": k=33, r=r+r/32 */
+	return (hash + (hash >> 5));
+}
+#endif	/* __HAVE_HASH32_STR */
+
+__BEGIN_DECLS
+uint32_t	murmurhash2(const void *, size_t, uint32_t);
+__END_DECLS
+
+#endif	/* !_SYS_HASH_H_ */

Property changes on: lab4/.minix-src/include/sys/hash.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/dirent.h
===================================================================
--- lab4/.minix-src/include/sys/dirent.h	(nonexistent)
+++ lab4/.minix-src/include/sys/dirent.h	(revision 13)
@@ -0,0 +1,129 @@
+/*	$NetBSD: dirent.h,v 1.29 2015/02/26 02:05:54 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dirent.h	8.3 (Berkeley) 8/10/94
+ */
+
+#ifndef _SYS_DIRENT_H_
+#define _SYS_DIRENT_H_
+
+#include <sys/featuretest.h>
+
+/*
+ * The dirent structure defines the format of directory entries returned by
+ * the getdents(2) system call.
+ *
+ * A directory entry has a struct dirent at the front of it, containing its
+ * inode number, the length of the entry, and the length of the name
+ * contained in the entry.  These are followed by the name padded to 
+ * _DIRENT_ALIGN() byte boundary with null bytes.  All names are guaranteed
+ * NUL terminated.  The maximum length of a name in a directory is MAXNAMLEN.
+ */
+struct dirent {
+	ino_t d_fileno;			/* file number of entry */
+	uint16_t d_reclen;		/* length of this record */
+	uint16_t d_namlen;		/* length of string in d_name */
+	uint8_t  d_type; 		/* file type, see below */
+#if defined(_NETBSD_SOURCE)
+#define	MAXNAMLEN	511		/* must be kept in sync with NAME_MAX */
+	char	d_name[MAXNAMLEN + 1];	/* name must be no longer than this */
+#else
+	char	d_name[511 + 1];	/* name must be no longer than this */
+#endif
+};
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * File types
+ */
+#define	DT_UNKNOWN	 0
+#define	DT_FIFO		 1
+#define	DT_CHR		 2
+#define	DT_DIR		 4
+#define	DT_BLK		 6
+#define	DT_REG		 8
+#define	DT_LNK		10
+#define	DT_SOCK		12
+#define	DT_WHT		14
+
+/*
+ * Caution: the following macros are used by the ufs/ffs code on ffs's
+ * struct direct as well as the exposed struct dirent. The two
+ * structures are not the same, so it's important (until ufs is fixed,
+ * XXX) that the macro definitions remain type-polymorphic.
+ */
+
+/*
+ * The _DIRENT_ALIGN macro returns the alignment of struct dirent.
+ * struct direct and struct dirent12 used 4 byte alignment but
+ * struct dirent uses 8.
+ */
+#define _DIRENT_ALIGN(dp) (sizeof((dp)->d_fileno) - 1)
+/*
+ * The _DIRENT_NAMEOFF macro returns the offset of the d_name field in 
+ * struct dirent
+ */
+#if __GNUC_PREREQ__(4, 0)
+#define	_DIRENT_NAMEOFF(dp)	__builtin_offsetof(__typeof__(*(dp)), d_name)
+#else
+#define _DIRENT_NAMEOFF(dp) \
+    ((char *)(void *)&(dp)->d_name - (char *)(void *)dp)
+#endif
+/*
+ * The _DIRENT_RECLEN macro gives the minimum record length which will hold
+ * a name of size "namlen".  This requires the amount of space in struct dirent
+ * without the d_name field, plus enough space for the name with a terminating
+ * null byte (namlen+1), rounded up to a the appropriate byte boundary.
+ */
+#define _DIRENT_RECLEN(dp, namlen) \
+    ((_DIRENT_NAMEOFF(dp) + (namlen) + 1 + _DIRENT_ALIGN(dp)) & \
+    ~_DIRENT_ALIGN(dp))
+/*
+ * The _DIRENT_SIZE macro returns the minimum record length required for
+ * name name stored in the current record.
+ */
+#define	_DIRENT_SIZE(dp) _DIRENT_RECLEN(dp, (dp)->d_namlen)
+/*
+ * The _DIRENT_NEXT macro advances to the next dirent record.
+ */
+#define _DIRENT_NEXT(dp) ((void *)((char *)(void *)(dp) + (dp)->d_reclen))
+/*
+ * The _DIRENT_MINSIZE returns the size of an empty (invalid) record.
+ */
+#define _DIRENT_MINSIZE(dp) _DIRENT_RECLEN(dp, 0)
+
+/*
+ * Convert between stat structure types and directory types.
+ */
+#define	IFTODT(mode)	(((mode) & 0170000) >> 12)
+#define	DTTOIF(dirtype)	((dirtype) << 12)
+#endif
+
+#endif	/* !_SYS_DIRENT_H_ */

Property changes on: lab4/.minix-src/include/sys/dirent.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/dvdio.h
===================================================================
--- lab4/.minix-src/include/sys/dvdio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/dvdio.h	(revision 13)
@@ -0,0 +1,206 @@
+/*	$NetBSD: dvdio.h,v 1.8 2005/12/26 18:41:36 perry Exp $	*/
+
+#ifndef _SYS_DVDIO_H_
+#define _SYS_DVDIO_H_
+
+#include <sys/types.h>
+#include <sys/ioccom.h>
+
+/* DVD-ROM Specific ioctls */
+#define DVD_READ_STRUCT		_IOWR('d', 0, dvd_struct)
+#define DVD_WRITE_STRUCT	_IOWR('d', 1, dvd_struct)
+#define DVD_AUTH		_IOWR('d', 2, dvd_authinfo)
+
+#define GPCMD_READ_DVD_STRUCTURE	0xad
+#define GPCMD_SEND_DVD_STRUCTURE	0xad
+#define GPCMD_REPORT_KEY		0xa4
+#define GPCMD_SEND_KEY			0xa3
+
+/* DVD struct types */
+#define DVD_STRUCT_PHYSICAL		0x00
+#define DVD_STRUCT_COPYRIGHT		0x01
+#define DVD_STRUCT_DISCKEY		0x02
+#define DVD_STRUCT_BCA			0x03
+#define DVD_STRUCT_MANUFACT		0x04
+
+struct dvd_layer {
+	uint8_t book_version	: 4;
+	uint8_t book_type	: 4;
+	uint8_t min_rate	: 4;
+	uint8_t disc_size	: 4;
+	uint8_t layer_type	: 4;
+	uint8_t track_path	: 1;
+	uint8_t nlayers	: 2;
+	uint8_t track_density	: 4;
+	uint8_t linear_density	: 4;
+	uint8_t bca		: 1;
+	uint32_t start_sector;
+	uint32_t end_sector;
+	uint32_t end_sector_l0;
+};
+
+struct dvd_physical {
+	uint8_t type;
+	uint8_t layer_num;
+	struct dvd_layer layer[4];
+};
+
+struct dvd_copyright {
+	uint8_t type;
+
+	uint8_t layer_num;
+	uint8_t cpst;
+	uint8_t rmi;
+};
+
+struct dvd_disckey {
+	uint8_t type;
+
+	unsigned agid		: 2;
+	uint8_t value[2048];
+};
+
+struct dvd_bca {
+	uint8_t type;
+
+	int len;
+	uint8_t value[188];
+};
+
+struct dvd_manufact {
+	uint8_t type;
+
+	uint8_t layer_num;
+	int len;
+	uint8_t value[2048];
+};
+
+typedef union {
+	uint8_t type;
+
+	struct dvd_physical	physical;
+	struct dvd_copyright	copyright;
+	struct dvd_disckey	disckey;
+	struct dvd_bca		bca;
+	struct dvd_manufact	manufact;
+} dvd_struct;
+
+/*
+ * DVD authentication ioctl
+ */
+
+/* Authentication states */
+#define DVD_LU_SEND_AGID	0
+#define DVD_HOST_SEND_CHALLENGE	1
+#define DVD_LU_SEND_KEY1	2
+#define DVD_LU_SEND_CHALLENGE	3
+#define DVD_HOST_SEND_KEY2	4
+
+/* Termination states */
+#define DVD_AUTH_ESTABLISHED	5
+#define DVD_AUTH_FAILURE	6
+
+/* Other functions */
+#define DVD_LU_SEND_TITLE_KEY	7
+#define DVD_LU_SEND_ASF		8
+#define DVD_INVALIDATE_AGID	9
+#define DVD_LU_SEND_RPC_STATE	10
+#define DVD_HOST_SEND_RPC_STATE	11
+
+/* State data */
+typedef uint8_t dvd_key[5];		/* 40-bit value, MSB is first elem. */
+typedef uint8_t dvd_challenge[10];	/* 80-bit value, MSB is first elem. */
+
+struct dvd_lu_send_agid {
+	uint8_t type;
+	unsigned agid		: 2;
+};
+
+struct dvd_host_send_challenge {
+	uint8_t type;
+	unsigned agid		: 2;
+
+	dvd_challenge chal;
+};
+
+struct dvd_send_key {
+	uint8_t type;
+	unsigned agid		: 2;
+
+	dvd_key key;
+};
+
+struct dvd_lu_send_challenge {
+	uint8_t type;
+	unsigned agid		: 2;
+
+	dvd_challenge chal;
+};
+
+#define DVD_CPM_NO_COPYRIGHT	0
+#define DVD_CPM_COPYRIGHTED	1
+
+#define DVD_CP_SEC_NONE		0
+#define DVD_CP_SEC_EXIST	1
+
+#define DVD_CGMS_UNRESTRICTED	0
+#define DVD_CGMS_SINGLE		2
+#define DVD_CGMS_RESTRICTED	3
+
+struct dvd_lu_send_title_key {
+	uint8_t type;
+	unsigned agid		: 2;
+
+	dvd_key title_key;
+	int lba;
+	unsigned cpm		: 1;
+	unsigned cp_sec		: 1;
+	unsigned cgms		: 2;
+};
+
+struct dvd_lu_send_asf {
+	uint8_t type;
+	unsigned agid		: 2;
+
+	unsigned asf		: 1;
+};
+
+struct dvd_host_send_rpcstate {
+	uint8_t type;
+	uint8_t pdrc;
+};
+
+struct dvd_lu_send_rpcstate {
+	uint8_t type		: 2;
+	uint8_t vra		: 3;
+	uint8_t ucca		: 3;
+	uint8_t region_mask;
+	uint8_t rpc_scheme;
+};
+
+typedef union {
+	uint8_t type;
+
+	struct dvd_lu_send_agid		lsa;
+	struct dvd_host_send_challenge	hsc;
+	struct dvd_send_key		lsk;
+	struct dvd_lu_send_challenge	lsc;
+	struct dvd_send_key		hsk;
+	struct dvd_lu_send_title_key	lstk;
+	struct dvd_lu_send_asf		lsasf;
+	struct dvd_host_send_rpcstate	hrpcs;
+	struct dvd_lu_send_rpcstate	lrpcs;
+} dvd_authinfo;
+
+typedef struct {
+	uint16_t report_key_length;
+	uint8_t reserved1[2];
+	uint8_t ucca		: 3;
+	uint8_t vra		: 3;
+	uint8_t type_code	: 2;
+	uint8_t region_mask;
+	uint8_t rpc_scheme;
+	uint8_t reserved2;
+} dvd_rpc_state_t;
+
+#endif /* _SYS_DVDIO_H_ */

Property changes on: lab4/.minix-src/include/sys/dvdio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/disklabel_gpt.h
===================================================================
--- lab4/.minix-src/include/sys/disklabel_gpt.h	(nonexistent)
+++ lab4/.minix-src/include/sys/disklabel_gpt.h	(revision 13)
@@ -0,0 +1,184 @@
+/*	$NetBSD: disklabel_gpt.h,v 1.12 2013/11/24 08:17:50 jnemeth Exp $	*/
+
+/*
+ * Copyright (c) 2002 Marcel Moolenaar
+ * 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.
+ *
+ * $FreeBSD: src/sys/sys/gpt.h,v 1.7 2004/08/02 18:46:52 marcel Exp $
+ */
+
+#ifndef _SYS_DISKLABEL_GPT_H_
+#define	_SYS_DISKLABEL_GPT_H_
+
+/*
+ * Definitions for the EFI GUID Partition Table disk partitioning scheme.
+ *
+ * NOTE: As EFI is an Intel specification, all fields are stored in
+ * little-endian byte-order.
+ */
+
+/*
+ * GUID Partition Table Header
+ */
+struct gpt_hdr {
+	int8_t		hdr_sig[8];	/* identifies GUID Partition Table */
+	uint32_t	hdr_revision;	/* GPT specification revsion */
+	uint32_t	hdr_size;	/* size of GPT Header */
+	uint32_t	hdr_crc_self;	/* CRC32 of GPT Header */
+	uint32_t	hdr__rsvd0;	/* must be zero */
+	uint64_t	hdr_lba_self;	/* LBA that contains this Header */
+	uint64_t	hdr_lba_alt;	/* LBA of backup GPT Header */
+	uint64_t	hdr_lba_start;	/* first LBA usable for partitions */
+	uint64_t	hdr_lba_end;	/* last LBA usable for partitions */
+	uint8_t		hdr_guid[16];	/* GUID to identify the disk */
+	uint64_t	hdr_lba_table;	/* first LBA of GPE array */
+	uint32_t	hdr_entries;	/* number of entries in GPE array */
+	uint32_t	hdr_entsz;	/* size of each GPE */
+	uint32_t	hdr_crc_table;	/* CRC32 of GPE array */
+	/*
+	 * The remainder of the block that contains the GPT Header
+	 * is reserved by EFI for future GPT Header expansion, and
+	 * must be zero.
+	 */
+};
+
+#define	GPT_HDR_SIG		"EFI PART"
+#define	GPT_HDR_REVISION	0x00010000	/* 1.0 */
+
+#define	GPT_HDR_BLKNO		1
+
+#define	GPT_HDR_SIZE		0x5c
+
+/*
+ * GUID Partition Entry
+ */
+struct gpt_ent {
+	uint8_t		ent_type[16];	/* partition type GUID */
+	uint8_t		ent_guid[16];	/* unique partition GUID */
+	uint64_t	ent_lba_start;	/* start of partition */
+	uint64_t	ent_lba_end;	/* end of partition */
+	uint64_t	ent_attr;	/* partition attributes */
+	uint16_t	ent_name[36];	/* partition name in UNICODE-16 */
+};
+
+#define	GPT_ENT_ATTR_REQUIRED_PARTITION		(1ULL << 0)
+					/* required for platform to function */
+#define	GPT_ENT_ATTR_NO_BLOCK_IO_PROTOCOL	(1ULL << 1)
+					/* UEFI won't recognize file system */
+#define	GPT_ENT_ATTR_LEGACY_BIOS_BOOTABLE	(1ULL << 2)
+					/* legacy BIOS boot partition */
+/* The following three entries are from FreeBSD. */
+#define GPT_ENT_ATTR_BOOTME			(1ULL << 59)
+					/* indicates a bootable partition */
+#define GPT_ENT_ATTR_BOOTONCE			(1ULL << 58)
+				/* attempt to boot this partition only once */
+#define GPT_ENT_ATTR_BOOTFAILED			(1ULL << 57)
+		/* partition that was marked bootonce but failed to boot */
+
+/*
+ * Partition types defined by the EFI specification:
+ *
+ *	GPT_ENT_TYPE_UNUSED		Unused Entry
+ *	GPT_ENT_TYPE_EFI		EFI System Partition
+ *	GPT_ENT_TYPE_MBR		Partition containing legacy MBR
+ */
+#define	GPT_ENT_TYPE_UNUSED		\
+	{0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}}
+#define	GPT_ENT_TYPE_EFI		\
+	{0xc12a7328,0xf81f,0x11d2,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}}
+#define	GPT_ENT_TYPE_MBR		\
+	{0x024dee41,0x33e7,0x11d3,0x9d,0x69,{0x00,0x08,0xc7,0x81,0xf3,0x9f}}
+
+/*
+ * Partition types defined by other operating systems.
+ */
+#define	GPT_ENT_TYPE_NETBSD_SWAP	\
+	{0x49f48d32,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+#define	GPT_ENT_TYPE_NETBSD_FFS		\
+	{0x49f48d5a,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+#define	GPT_ENT_TYPE_NETBSD_LFS		\
+	{0x49f48d82,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+#define	GPT_ENT_TYPE_NETBSD_RAIDFRAME	\
+	{0x49f48daa,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+#define	GPT_ENT_TYPE_NETBSD_CCD	\
+	{0x2db519c4,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+#define	GPT_ENT_TYPE_NETBSD_CGD	\
+	{0x2db519ec,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+
+#define	GPT_ENT_TYPE_FREEBSD		\
+	{0x516e7cb4,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#define	GPT_ENT_TYPE_FREEBSD_SWAP	\
+	{0x516e7cb5,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#define	GPT_ENT_TYPE_FREEBSD_UFS	\
+	{0x516e7cb6,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#define	GPT_ENT_TYPE_FREEBSD_VINUM	\
+	{0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#define GPT_ENT_TYPE_FREEBSD_ZFS	\
+	{0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+/*
+ * The following are unused but documented here to avoid reuse.
+ *
+ *      GPT_ENT_TYPE_FREEBSD_UFS2	\
+ *	{0x516e7cb7,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+ */
+
+#define	GPT_ENT_TYPE_MS_RESERVED	\
+	{0xe3c9e316,0x0b5c,0x4db8,0x81,0x7d,{0xf9,0x2d,0xf0,0x02,0x15,0xae}}
+#define	GPT_ENT_TYPE_MS_BASIC_DATA	\
+	{0xebd0a0a2,0xb9e5,0x4433,0x87,0xc0,{0x68,0xb6,0xb7,0x26,0x99,0xc7}}
+#define	GPT_ENT_TYPE_MS_LDM_METADATA	\
+	{0x5808c8aa,0x7e8f,0x42e0,0x85,0xd2,{0xe1,0xe9,0x04,0x34,0xcf,0xb3}}
+#define	GPT_ENT_TYPE_MS_LDM_DATA	\
+	{0xaf9b60a0,0x1431,0x4f62,0xbc,0x68,{0x33,0x11,0x71,0x4a,0x69,0xad}}
+
+/*
+ * Linux originally used GPT_ENT_TYPE_MS_BASIC_DATA in place of
+ * GPT_ENT_TYPE_LINUX_DATA.
+ */
+#define	GPT_ENT_TYPE_LINUX_DATA		\
+	{0x0fc63daf,0x8483,0x4772,0x8e,0x79,{0x3d,0x69,0xd8,0x47,0x7d,0xe4}}
+#define	GPT_ENT_TYPE_LINUX_RAID		\
+	{0xa19d880f,0x05fc,0x4d3b,0xa0,0x06,{0x74,0x3f,0x0f,0x84,0x91,0x1e}}
+#define	GPT_ENT_TYPE_LINUX_SWAP		\
+	{0x0657fd6d,0xa4ab,0x43c4,0x84,0xe5,{0x09,0x33,0xc8,0x4b,0x4f,0x4f}}
+#define	GPT_ENT_TYPE_LINUX_LVM		\
+	{0xe6d6d379,0xf507,0x44c2,0xa2,0x3c,{0x23,0x8f,0x2a,0x3d,0xf9,0x28}}
+
+#define	GPT_ENT_TYPE_APPLE_HFS		\
+	{0x48465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
+#define	GPT_ENT_TYPE_APPLE_UFS		\
+	{0x55465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
+
+#if defined(__minix)
+#define	GPT_ENT_TYPE_MINIX_MFS		\
+	{0xb7aadf00,0xde27,0x11ca,0xa5,0x74,{0x56,0x72,0x69,0x6a,0x65,0x55}}
+#endif /* defined(__minix) */
+
+/*
+ * Used by GRUB 2.
+ */
+#define	GPT_ENT_TYPE_BIOS		\
+	{0x21686148,0x6449,0x6e6f,0x74,0x4e,{0x65,0x65,0x64,0x45,0x46,0x49}}
+
+#endif /* _SYS_DISKLABEL_GPT_H_ */

Property changes on: lab4/.minix-src/include/sys/disklabel_gpt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/inttypes.h
===================================================================
--- lab4/.minix-src/include/sys/inttypes.h	(nonexistent)
+++ lab4/.minix-src/include/sys/inttypes.h	(revision 13)
@@ -0,0 +1,46 @@
+/*	$NetBSD: inttypes.h,v 1.6 2013/04/22 21:26:48 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus J. Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_INTTYPES_H_
+#define _SYS_INTTYPES_H_
+
+/*
+ * 7.8  Format conversion of integer types
+ */
+
+#include <sys/stdint.h>
+
+#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) || \
+    (__cplusplus >= 201103L)
+#include <machine/int_fmtio.h>
+#endif
+
+#endif /* !_SYS_INTTYPES_H_ */

Property changes on: lab4/.minix-src/include/sys/inttypes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/exec.h
===================================================================
--- lab4/.minix-src/include/sys/exec.h	(nonexistent)
+++ lab4/.minix-src/include/sys/exec.h	(revision 13)
@@ -0,0 +1,319 @@
+/*	$NetBSD: exec.h,v 1.149 2015/10/10 10:51:15 maxv Exp $	*/
+
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)exec.h	8.4 (Berkeley) 2/19/95
+ */
+
+/*-
+ * Copyright (c) 1993 Theo de Raadt.  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.
+ */
+
+/*-
+ * Copyright (c) 1994 Christopher G. Demetriou
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)exec.h	8.4 (Berkeley) 2/19/95
+ */
+
+#ifndef _SYS_EXEC_H_
+#define _SYS_EXEC_H_
+
+struct pathbuf; /* from namei.h */
+
+
+/*
+ * The following structure is found at the top of the user stack of each
+ * user process. The ps program uses it to locate argv and environment
+ * strings. Programs that wish ps to display other information may modify
+ * it; normally ps_argvstr points to argv[0], and ps_nargvstr is the same
+ * as the program's argc. The fields ps_envstr and ps_nenvstr are the
+ * equivalent for the environment.
+ */
+struct ps_strings {
+	char	**ps_argvstr;	/* first of 0 or more argument strings */
+	int	ps_nargvstr;	/* the number of argument strings */
+	char	**ps_envstr;	/* first of 0 or more environment strings */
+	int	ps_nenvstr;	/* the number of environment strings */
+};
+
+#ifdef _KERNEL
+struct ps_strings32 {
+	uint32_t	ps_argvstr;	/* first of 0 or more argument strings */
+	int32_t		ps_nargvstr;	/* the number of argument strings */
+	uint32_t	ps_envstr;	/* first of 0 or more environment strings */
+	int32_t		ps_nenvstr;	/* the number of environment strings */
+};
+#endif
+
+/*
+ * the following structures allow execve() to put together processes
+ * in a more extensible and cleaner way.
+ *
+ * the exec_package struct defines an executable being execve()'d.
+ * it contains the header, the vmspace-building commands, the vnode
+ * information, and the arguments associated with the newly-execve'd
+ * process.
+ *
+ * the exec_vmcmd struct defines a command description to be used
+ * in creating the new process's vmspace.
+ */
+
+#include <sys/uio.h>
+
+struct lwp;
+struct proc;
+struct exec_package;
+struct vnode;
+struct coredump_iostate;
+
+typedef int (*exec_makecmds_fcn)(struct lwp *, struct exec_package *);
+
+struct execsw {
+	u_int	es_hdrsz;		/* size of header for this format */
+	exec_makecmds_fcn es_makecmds;	/* function to setup vmcmds */
+	union {				/* probe function */
+		int (*elf_probe_func)(struct lwp *,
+			struct exec_package *, void *, char *, vaddr_t *);
+		int (*ecoff_probe_func)(struct lwp *, struct exec_package *);
+	} u;
+	struct  emul *es_emul;		/* os emulation */
+	int	es_prio;		/* entry priority */
+	int	es_arglen;		/* Extra argument size in words */
+					/* Copy arguments on the new stack */
+	int	(*es_copyargs)(struct lwp *, struct exec_package *,
+			struct ps_strings *, char **, void *);
+					/* Set registers before execution */
+	void	(*es_setregs)(struct lwp *, struct exec_package *, vaddr_t);
+					/* Dump core */
+	int	(*es_coredump)(struct lwp *, struct coredump_iostate *);
+	int	(*es_setup_stack)(struct lwp *, struct exec_package *);
+};
+
+#define EXECSW_PRIO_ANY		0x000	/* default, no preference */
+#define EXECSW_PRIO_FIRST	0x001	/* this should be among first */
+#define EXECSW_PRIO_LAST	0x002	/* this should be among last */
+
+/* exec vmspace-creation command set; see below */
+struct exec_vmcmd_set {
+	u_int	evs_cnt;
+	u_int	evs_used;
+	struct	exec_vmcmd *evs_cmds;
+};
+
+#define	EXEC_DEFAULT_VMCMD_SETSIZE	9	/* # of cmds in set to start */
+struct exec_fakearg {
+	char *fa_arg;
+	size_t fa_len;
+};
+
+struct exec_package {
+	const char *ep_kname;		/* kernel-side copy of file's name */
+	char *ep_resolvedname;		/* fully resolved path from namei */
+	void	*ep_hdr;		/* file's exec header */
+	u_int	ep_hdrlen;		/* length of ep_hdr */
+	u_int	ep_hdrvalid;		/* bytes of ep_hdr that are valid */
+	struct	exec_vmcmd_set ep_vmcmds;  /* vmcmds used to build vmspace */
+	struct	vnode *ep_vp;		/* executable's vnode */
+	struct	vattr *ep_vap;		/* executable's attributes */
+	vaddr_t	ep_taddr;		/* process's text address */
+	vsize_t	ep_tsize;		/* size of process's text */
+	vaddr_t	ep_daddr;		/* process's data(+bss) address */
+	vsize_t	ep_dsize;		/* size of process's data(+bss) */
+	vaddr_t	ep_maxsaddr;		/* proc's max stack addr ("top") */
+	vaddr_t	ep_minsaddr;		/* proc's min stack addr ("bottom") */
+	vsize_t	ep_ssize;		/* size of process's stack */
+	vaddr_t	ep_entry;		/* process's entry point */
+	vaddr_t	ep_entryoffset;		/* offset to entry point */
+	vaddr_t	ep_vm_minaddr;		/* bottom of process address space */
+	vaddr_t	ep_vm_maxaddr;		/* top of process address space */
+	u_int	ep_flags;		/* flags; see below. */
+	size_t	ep_fa_len;		/* byte size of ep_fa */
+	struct exec_fakearg *ep_fa;	/* a fake args vector for scripts */
+	int	ep_fd;			/* a file descriptor we're holding */
+	void	*ep_emul_arg;		/* emulation argument */
+	const struct	execsw *ep_esch;/* execsw entry */
+	struct vnode *ep_emul_root;     /* base of emulation filesystem */
+	struct vnode *ep_interp;        /* vnode of (elf) interpeter */
+	uint32_t ep_pax_flags;		/* pax flags */
+	char	*ep_path;		/* absolute path of executable */
+	void	(*ep_emul_arg_free)(void *);
+					/* free ep_emul_arg */
+	uint32_t ep_osversion;		/* OS version */
+	char	ep_machine_arch[12];	/* from MARCH note */
+};
+#define	EXEC_INDIR	0x0001		/* script handling already done */
+#define	EXEC_HASFD	0x0002		/* holding a shell script */
+#define	EXEC_HASARGL	0x0004		/* has fake args vector */
+#define	EXEC_SKIPARG	0x0008		/* don't copy user-supplied argv[0] */
+#define	EXEC_DESTR	0x0010		/* destructive ops performed */
+#define	EXEC_32		0x0020		/* 32-bit binary emulation */
+#define	EXEC_FORCEAUX	0x0040		/* always use ELF AUX vector */
+#define	EXEC_TOPDOWN_VM	0x0080		/* may use top-down VM layout */
+#define	EXEC_FROM32	0x0100		/* exec'ed from 32-bit binary */
+
+struct exec_vmcmd {
+	int	(*ev_proc)(struct lwp *, struct exec_vmcmd *);
+				/* procedure to run for region of vmspace */
+	vsize_t	ev_len;		/* length of the segment to map */
+	vaddr_t	ev_addr;	/* address in the vmspace to place it at */
+	struct	vnode *ev_vp;	/* vnode pointer for the file w/the data */
+	vsize_t	ev_offset;	/* offset in the file for the data */
+	u_int	ev_prot;	/* protections for segment */
+	int	ev_flags;
+#define	VMCMD_RELATIVE	0x0001	/* ev_addr is relative to base entry */
+#define	VMCMD_BASE	0x0002	/* marks a base entry */
+#define	VMCMD_FIXED	0x0004	/* entry must be mapped at ev_addr */
+#define	VMCMD_STACK	0x0008	/* entry is for a stack */
+};
+
+#ifdef _KERNEL
+/*
+ * funtions used either by execve() or the various CPU-dependent execve()
+ * hooks.
+ */
+void	kill_vmcmd		(struct exec_vmcmd **);
+int	exec_makecmds		(struct lwp *, struct exec_package *);
+int	exec_runcmds		(struct lwp *, struct exec_package *);
+void	vmcmdset_extend		(struct exec_vmcmd_set *);
+void	kill_vmcmds		(struct exec_vmcmd_set *);
+int	vmcmd_map_pagedvn	(struct lwp *, struct exec_vmcmd *);
+int	vmcmd_map_readvn	(struct lwp *, struct exec_vmcmd *);
+int	vmcmd_readvn		(struct lwp *, struct exec_vmcmd *);
+int	vmcmd_map_zero		(struct lwp *, struct exec_vmcmd *);
+int	copyargs		(struct lwp *, struct exec_package *,
+				    struct ps_strings *, char **, void *);
+int	copyin_psstrings	(struct proc *, struct ps_strings *);
+int	copy_procargs		(struct proc *, int, size_t *,
+    int (*)(void *, const void *, size_t, size_t), void *);
+void	setregs			(struct lwp *, struct exec_package *, vaddr_t);
+int	check_veriexec		(struct lwp *, struct vnode *,
+				     struct exec_package *, int);
+int	check_exec		(struct lwp *, struct exec_package *,
+				     struct pathbuf *);
+int	exec_init		(int);
+int	exec_read_from		(struct lwp *, struct vnode *, u_long off,
+				    void *, size_t);
+int	exec_setup_stack	(struct lwp *, struct exec_package *);
+
+int	coredump_write		(struct coredump_iostate *, enum uio_seg,
+				    const void *, size_t);
+off_t	coredump_offset		(struct coredump_iostate *);
+
+void	exec_free_emul_arg	(struct exec_package *);
+
+
+/*
+ * Machine dependent functions
+ */
+struct core;
+struct core32;
+int	cpu_coredump(struct lwp *, struct coredump_iostate *, struct core *);
+int	cpu_coredump32(struct lwp *, struct coredump_iostate *, struct core32 *);
+
+int	exec_add(struct execsw *, int);
+int	exec_remove(struct execsw *, int);
+
+void	new_vmcmd(struct exec_vmcmd_set *,
+		    int (*)(struct lwp *, struct exec_vmcmd *),
+		    vsize_t, vaddr_t, struct vnode *, u_long, u_int, int);
+#define	NEW_VMCMD(evsp,lwp,len,addr,vp,offset,prot) \
+	new_vmcmd(evsp,lwp,len,addr,vp,offset,prot,0)
+#define	NEW_VMCMD2(evsp,lwp,len,addr,vp,offset,prot,flags) \
+	new_vmcmd(evsp,lwp,len,addr,vp,offset,prot,flags)
+
+typedef	int (*execve_fetch_element_t)(char * const *, size_t, char **);
+int	execve1(struct lwp *, const char *, char * const *, char * const *,
+    execve_fetch_element_t);
+
+struct posix_spawn_file_actions;
+struct posix_spawnattr;
+int	check_posix_spawn	(struct lwp *);
+void	posix_spawn_fa_free(struct posix_spawn_file_actions *, size_t);
+int	do_posix_spawn(struct lwp *, pid_t *, bool*, const char *,
+    struct posix_spawn_file_actions *, struct posix_spawnattr *,
+    char *const *argv, char *const *, execve_fetch_element_t);
+
+extern int	maxexec;
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_EXEC_H_ */

Property changes on: lab4/.minix-src/include/sys/exec.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioc_fbd.h
===================================================================
--- lab4/.minix-src/include/sys/ioc_fbd.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioc_fbd.h	(revision 13)
@@ -0,0 +1,66 @@
+/*	sys/ioc_fbd.h - Faulty Block Device ioctl() command codes.
+ *
+ */
+
+#ifndef _S_I_FBD_H
+#define _S_I_FBD_H
+
+/* FBD rule structure. */
+
+typedef int fbd_rulenum_t;
+
+struct fbd_rule {
+	fbd_rulenum_t num;	/* rule number (1-based) */
+	u64_t start;		/* start position of area to match */
+	u64_t end;		/* end position (exclusive) (0 = up to EOF) */
+	int flags;		/* match read and/or write requests */
+	unsigned int skip;	/* # matches to skip before activating */
+	unsigned int count;	/* # times left to trigger (0 = no limit) */
+	int action;		/* action type to perform when triggered */
+
+	union {			/* action parameters */
+		struct {
+			int type;	/* corruption type */
+		} corrupt;
+
+		struct {
+			int code;	/* error code to return (OK, EIO..) */
+		} error;
+
+		struct {
+			u64_t start;	/* start position of target area */
+			u64_t end;	/* end position of area (excl) */
+			u32_t align;	/* alignment to use in target area */
+		} misdir;
+
+		struct {
+			u32_t lead;	/* # bytes to process normally */
+		} losttorn;
+	} params;
+};
+
+/* Match flags. */
+#define FBD_FLAG_READ	0x1		/* match read requests */
+#define FBD_FLAG_WRITE	0x2		/* match write requests */
+
+/* Action types. */
+enum {
+	FBD_ACTION_CORRUPT,		/* write or return corrupt data */
+	FBD_ACTION_ERROR,		/* return an I/O error */
+	FBD_ACTION_MISDIR,		/* perform a misdirected write */
+	FBD_ACTION_LOSTTORN		/* perform a lost or torn write */
+};
+
+/* Corruption types. */
+enum {
+	FBD_CORRUPT_ZERO,		/* write or return ..zeroed data */
+	FBD_CORRUPT_PERSIST,		/* ..consequently the same bad data */
+	FBD_CORRUPT_RANDOM		/* ..new random data every time */
+};
+
+/* The I/O control requests. */
+#define FBDCADDRULE	_IOW('B', 1, struct fbd_rule)	/* add a rule */
+#define FBDCDELRULE	_IOW('B', 2, fbd_rulenum_t)	/* delete a rule */
+#define FBDCGETRULE	_IOWR('B', 3, struct fbd_rule)	/* retrieve a rule */
+
+#endif /* _S_I_FBD_H */

Property changes on: lab4/.minix-src/include/sys/ioc_fbd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/dkstat.h
===================================================================
--- lab4/.minix-src/include/sys/dkstat.h	(nonexistent)
+++ lab4/.minix-src/include/sys/dkstat.h	(revision 13)
@@ -0,0 +1,49 @@
+/*	$NetBSD: dkstat.h,v 1.17 2005/12/26 18:41:36 perry Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dkstat.h	8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_DKSTAT_H_
+#define _SYS_DKSTAT_H_
+
+#ifdef _KERNEL
+extern uint64_t tk_cancc;
+extern uint64_t tk_nin;
+extern uint64_t tk_nout;
+extern uint64_t tk_rawcc;
+#endif
+
+#endif /* _SYS_DKSTAT_H_ */

Property changes on: lab4/.minix-src/include/sys/dkstat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioc_sound.h
===================================================================
--- lab4/.minix-src/include/sys/ioc_sound.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioc_sound.h	(revision 13)
@@ -0,0 +1,34 @@
+/*	sys/ioc_sound.h - Sound ioctl() command codes.	Author: Kees J. Bot
+ *								23 Nov 2002
+ *
+ */
+
+#ifndef _S_I_SOUND_H
+#define _S_I_SOUND_H
+
+#include <minix/ioctl.h>
+
+/* Soundcard DSP ioctls. */
+#define	DSPIORATE		_IOW('s', 1, unsigned int)
+#define DSPIOSTEREO		_IOW('s', 2, unsigned int)
+#define DSPIOSIZE		_IOW('s', 3, unsigned int)
+#define DSPIOBITS		_IOW('s', 4, unsigned int)
+#define DSPIOSIGN		_IOW('s', 5, unsigned int)
+#define DSPIOMAX		_IOR('s', 6, unsigned int)
+#define DSPIORESET		_IO ('s', 7)
+#define DSPIOFREEBUF 		_IOR('s', 30, unsigned int)
+#define DSPIOSAMPLESINBUF	_IOR('s', 31, unsigned int)
+#define DSPIOPAUSE		_IO ('s', 32)
+#define DSPIORESUME		_IO ('s', 33)
+
+/* Soundcard mixer ioctls. */
+#define MIXIOGETVOLUME		_IOWR('s', 10, struct volume_level)
+#define MIXIOGETINPUTLEFT	_IOWR('s', 11, struct inout_ctrl)
+#define MIXIOGETINPUTRIGHT	_IOWR('s', 12, struct inout_ctrl)
+#define MIXIOGETOUTPUT		_IOWR('s', 13, struct inout_ctrl)
+#define MIXIOSETVOLUME		_IOWR('s', 20, struct volume_level)
+#define MIXIOSETINPUTLEFT	_IOWR('s', 21, struct inout_ctrl)
+#define MIXIOSETINPUTRIGHT	_IOWR('s', 22, struct inout_ctrl)
+#define MIXIOSETOUTPUT		_IOWR('s', 23, struct inout_ctrl)
+
+#endif /* _S_I_SOUND_H */

Property changes on: lab4/.minix-src/include/sys/ioc_sound.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/elf64.h
===================================================================
--- lab4/.minix-src/include/sys/elf64.h	(nonexistent)
+++ lab4/.minix-src/include/sys/elf64.h	(revision 13)
@@ -0,0 +1,248 @@
+/*-
+ * Copyright (c) 1996-1998 John D. Polstra.
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_ELF64_H_
+#define _SYS_ELF64_H_ 1
+
+#include <sys/elf_common.h>
+
+/*
+ * ELF definitions common to all 64-bit architectures.
+ */
+
+typedef uint64_t	Elf64_Addr;
+typedef uint16_t	Elf64_Half;
+typedef uint64_t	Elf64_Off;
+typedef int32_t		Elf64_Sword;
+typedef int64_t		Elf64_Sxword;
+typedef uint32_t	Elf64_Word;
+typedef uint64_t	Elf64_Lword;
+typedef uint64_t	Elf64_Xword;
+
+/*
+ * Types of dynamic symbol hash table bucket and chain elements.
+ *
+ * This is inconsistent among 64 bit architectures, so a machine dependent
+ * typedef is required.
+ */
+
+typedef Elf64_Word	Elf64_Hashelt;
+
+/* Non-standard class-dependent datatype used for abstraction. */
+typedef Elf64_Xword	Elf64_Size;
+typedef Elf64_Sxword	Elf64_Ssize;
+
+/*
+ * ELF header.
+ */
+
+typedef struct {
+	unsigned char	e_ident[EI_NIDENT];	/* File identification. */
+	Elf64_Half	e_type;		/* File type. */
+	Elf64_Half	e_machine;	/* Machine architecture. */
+	Elf64_Word	e_version;	/* ELF format version. */
+	Elf64_Addr	e_entry;	/* Entry point. */
+	Elf64_Off	e_phoff;	/* Program header file offset. */
+	Elf64_Off	e_shoff;	/* Section header file offset. */
+	Elf64_Word	e_flags;	/* Architecture-specific flags. */
+	Elf64_Half	e_ehsize;	/* Size of ELF header in bytes. */
+	Elf64_Half	e_phentsize;	/* Size of program header entry. */
+	Elf64_Half	e_phnum;	/* Number of program header entries. */
+	Elf64_Half	e_shentsize;	/* Size of section header entry. */
+	Elf64_Half	e_shnum;	/* Number of section header entries. */
+	Elf64_Half	e_shstrndx;	/* Section name strings section. */
+} Elf64_Ehdr;
+
+/*
+ * Section header.
+ */
+
+typedef struct {
+	Elf64_Word	sh_name;	/* Section name (index into the
+					   section header string table). */
+	Elf64_Word	sh_type;	/* Section type. */
+	Elf64_Xword	sh_flags;	/* Section flags. */
+	Elf64_Addr	sh_addr;	/* Address in memory image. */
+	Elf64_Off	sh_offset;	/* Offset in file. */
+	Elf64_Xword	sh_size;	/* Size in bytes. */
+	Elf64_Word	sh_link;	/* Index of a related section. */
+	Elf64_Word	sh_info;	/* Depends on section type. */
+	Elf64_Xword	sh_addralign;	/* Alignment in bytes. */
+	Elf64_Xword	sh_entsize;	/* Size of each entry in section. */
+} Elf64_Shdr;
+
+/*
+ * Program header.
+ */
+
+typedef struct {
+	Elf64_Word	p_type;		/* Entry type. */
+	Elf64_Word	p_flags;	/* Access permission flags. */
+	Elf64_Off	p_offset;	/* File offset of contents. */
+	Elf64_Addr	p_vaddr;	/* Virtual address in memory image. */
+	Elf64_Addr	p_paddr;	/* Physical address (not used). */
+	Elf64_Xword	p_filesz;	/* Size of contents in file. */
+	Elf64_Xword	p_memsz;	/* Size of contents in memory. */
+	Elf64_Xword	p_align;	/* Alignment in memory and file. */
+} Elf64_Phdr;
+
+/*
+ * Dynamic structure.  The ".dynamic" section contains an array of them.
+ */
+
+typedef struct {
+	Elf64_Sxword	d_tag;		/* Entry type. */
+	union {
+		Elf64_Xword	d_val;	/* Integer value. */
+		Elf64_Addr	d_ptr;	/* Address value. */
+	} d_un;
+} Elf64_Dyn;
+
+/*
+ * Relocation entries.
+ */
+
+/* Relocations that don't need an addend field. */
+typedef struct {
+	Elf64_Addr	r_offset;	/* Location to be relocated. */
+	Elf64_Xword	r_info;		/* Relocation type and symbol index. */
+} Elf64_Rel;
+
+/* Relocations that need an addend field. */
+typedef struct {
+	Elf64_Addr	r_offset;	/* Location to be relocated. */
+	Elf64_Xword	r_info;		/* Relocation type and symbol index. */
+	Elf64_Sxword	r_addend;	/* Addend. */
+} Elf64_Rela;
+
+/* Macros for accessing the fields of r_info. */
+#define	ELF64_R_SYM(info)	((info) >> 32)
+#define	ELF64_R_TYPE(info)	((info) & 0xffffffffL)
+
+/* Macro for constructing r_info from field values. */
+#define	ELF64_R_INFO(sym, type)	(((sym) << 32) + ((type) & 0xffffffffL))
+
+#define	ELF64_R_TYPE_DATA(info)	(((Elf64_Xword)(info)<<32)>>40)
+#define	ELF64_R_TYPE_ID(info)	(((Elf64_Xword)(info)<<56)>>56)
+#define	ELF64_R_TYPE_INFO(data, type)	\
+				(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
+
+/*
+ *	Note entry header
+ */
+typedef Elf_Note Elf64_Nhdr;
+
+/*
+ *	Move entry
+ */
+typedef struct {
+	Elf64_Lword	m_value;	/* symbol value */
+	Elf64_Xword 	m_info;		/* size + index */
+	Elf64_Xword	m_poffset;	/* symbol offset */
+	Elf64_Half	m_repeat;	/* repeat count */
+	Elf64_Half	m_stride;	/* stride info */
+} Elf64_Move;
+
+#define	ELF64_M_SYM(info)	((info)>>8)
+#define	ELF64_M_SIZE(info)	((unsigned char)(info))
+#define	ELF64_M_INFO(sym, size)	(((sym)<<8)+(unsigned char)(size))
+
+/*
+ *	Hardware/Software capabilities entry
+ */
+typedef struct {
+	Elf64_Xword	c_tag;		/* how to interpret value */
+	union {
+		Elf64_Xword	c_val;
+		Elf64_Addr	c_ptr;
+	} c_un;
+} Elf64_Cap;
+
+/*
+ * Symbol table entries.
+ */
+
+typedef struct {
+	Elf64_Word	st_name;	/* String table index of name. */
+	unsigned char	st_info;	/* Type and binding information. */
+	unsigned char	st_other;	/* Reserved (not used). */
+	Elf64_Half	st_shndx;	/* Section index of symbol. */
+	Elf64_Addr	st_value;	/* Symbol value. */
+	Elf64_Xword	st_size;	/* Size of associated object. */
+} Elf64_Sym;
+
+/* Macros for accessing the fields of st_info. */
+#define	ELF64_ST_BIND(info)		((info) >> 4)
+#define	ELF64_ST_TYPE(info)		((info) & 0xf)
+
+/* Macro for constructing st_info from field values. */
+#define	ELF64_ST_INFO(bind, type)	(((bind) << 4) + ((type) & 0xf))
+
+/* Macro for accessing the fields of st_other. */
+#define	ELF64_ST_VISIBILITY(oth)	((oth) & 0x3)
+
+/* Structures used by Sun & GNU-style symbol versioning. */
+typedef struct {
+	Elf64_Half	vd_version;
+	Elf64_Half	vd_flags;
+	Elf64_Half	vd_ndx;
+	Elf64_Half	vd_cnt;
+	Elf64_Word	vd_hash;
+	Elf64_Word	vd_aux;
+	Elf64_Word	vd_next;
+} Elf64_Verdef;
+
+typedef struct {
+	Elf64_Word	vda_name;
+	Elf64_Word	vda_next;
+} Elf64_Verdaux;
+
+typedef struct {
+	Elf64_Half	vn_version;
+	Elf64_Half	vn_cnt;
+	Elf64_Word	vn_file;
+	Elf64_Word	vn_aux;
+	Elf64_Word	vn_next;
+} Elf64_Verneed;
+
+typedef struct {
+	Elf64_Word	vna_hash;
+	Elf64_Half	vna_flags;
+	Elf64_Half	vna_other;
+	Elf64_Word	vna_name;
+	Elf64_Word	vna_next;
+} Elf64_Vernaux;
+
+typedef Elf64_Half Elf64_Versym;
+
+typedef struct {
+	Elf64_Half	si_boundto;	/* direct bindings - symbol bound to */
+	Elf64_Half	si_flags;	/* per symbol flags */
+} Elf64_Syminfo;
+
+#endif /* !_SYS_ELF64_H_ */

Property changes on: lab4/.minix-src/include/sys/elf64.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/elf_generic.h
===================================================================
--- lab4/.minix-src/include/sys/elf_generic.h	(nonexistent)
+++ lab4/.minix-src/include/sys/elf_generic.h	(revision 13)
@@ -0,0 +1,90 @@
+/*-
+ * Copyright (c) 1998 John D. Polstra.
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_ELF_GENERIC_H_
+#define	_SYS_ELF_GENERIC_H_ 1
+
+#include <sys/cdefs.h>
+
+/*
+ * Definitions of generic ELF names which relieve applications from
+ * needing to know the word size.
+ */
+
+#if __ELF_WORD_SIZE != 32 && __ELF_WORD_SIZE != 64
+#error "__ELF_WORD_SIZE must be defined as 32 or 64"
+#endif
+
+#define	ELF_CLASS	__CONCAT(ELFCLASS,__ELF_WORD_SIZE)
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define	ELF_DATA	ELFDATA2LSB
+#elif BYTE_ORDER == BIG_ENDIAN
+#define	ELF_DATA	ELFDATA2MSB
+#else
+#error "Unknown byte order"
+#endif
+
+#define CONCAT(x,y)	__CONCAT(x,y)
+#define	__elfN(x)	CONCAT(CONCAT(CONCAT(elf,__ELF_WORD_SIZE),_),x)
+#define	__ElfN(x)	CONCAT(CONCAT(CONCAT(Elf,__ELF_WORD_SIZE),_),x)
+#define	__ELFN(x)	CONCAT(CONCAT(CONCAT(ELF,__ELF_WORD_SIZE),_),x)
+#define	__ElfType(x)	typedef __ElfN(x) __CONCAT(Elf_,x)
+
+__ElfType(Addr);
+__ElfType(Half);
+__ElfType(Off);
+__ElfType(Sword);
+__ElfType(Word);
+__ElfType(Ehdr);
+__ElfType(Shdr);
+__ElfType(Nhdr);
+__ElfType(Phdr);
+__ElfType(Dyn);
+__ElfType(Rel);
+__ElfType(Rela);
+__ElfType(Sym);
+__ElfType(Verdef);
+__ElfType(Verdaux);
+__ElfType(Verneed);
+__ElfType(Vernaux);
+__ElfType(Versym);
+
+/* Non-standard ELF types. */
+__ElfType(Hashelt);
+__ElfType(Size);
+__ElfType(Ssize);
+
+#define	ELF_R_SYM	__ELFN(R_SYM)
+#define	ELF_R_TYPE	__ELFN(R_TYPE)
+#define	ELF_R_INFO	__ELFN(R_INFO)
+#define	ELF_ST_BIND	__ELFN(ST_BIND)
+#define	ELF_ST_TYPE	__ELFN(ST_TYPE)
+#define	ELF_ST_INFO	__ELFN(ST_INFO)
+
+#endif /* !_SYS_ELF_GENERIC_H_ */

Property changes on: lab4/.minix-src/include/sys/elf_generic.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioctl_compat.h
===================================================================
--- lab4/.minix-src/include/sys/ioctl_compat.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioctl_compat.h	(revision 13)
@@ -0,0 +1,172 @@
+/*	$NetBSD: ioctl_compat.h,v 1.17 2015/09/06 06:01:02 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ioctl_compat.h	8.4 (Berkeley) 1/21/94
+ */
+
+#if !defined(__minix)
+#ifndef _SYS_IOCTL_COMPAT_H_
+#define	_SYS_IOCTL_COMPAT_H_
+
+#include <sys/ioccom.h>
+#include <sys/ttychars.h>
+#include <sys/ttydev.h>
+
+struct tchars {
+	char	t_intrc;	/* interrupt */
+	char	t_quitc;	/* quit */
+	char	t_startc;	/* start output */
+	char	t_stopc;	/* stop output */
+	char	t_eofc;		/* end-of-file */
+	char	t_brkc;		/* input delimiter (like nl) */
+};
+
+struct ltchars {
+	char	t_suspc;	/* stop process signal */
+	char	t_dsuspc;	/* delayed stop process signal */
+	char	t_rprntc;	/* reprint line */
+	char	t_flushc;	/* flush output (toggles) */
+	char	t_werasc;	/* word erase */
+	char	t_lnextc;	/* literal next character */
+};
+
+/*
+ * Structure for TIOCGETP and TIOCSETP ioctls.
+ */
+#ifndef _SGTTYB_
+#define	_SGTTYB_
+struct sgttyb {
+	char	sg_ispeed;		/* input speed */
+	char	sg_ospeed;		/* output speed */
+	char	sg_erase;		/* erase character */
+	char	sg_kill;		/* kill character */
+	short	sg_flags;		/* mode flags */
+};
+#endif
+
+#ifdef USE_OLD_TTY
+# undef  TIOCGETD
+# define TIOCGETD	_IOR('t', 0, int)	/* get line discipline */
+# undef  TIOCSETD
+# define TIOCSETD	_IOW('t', 1, int)	/* set line discipline */
+#else
+# define OTIOCGETD	_IOR('t', 0, int)	/* get line discipline */
+# define OTIOCSETD	_IOW('t', 1, int)	/* set line discipline */
+#endif
+#define	TIOCHPCL	_IO('t', 2)		/* hang up on last close */
+#define	TIOCGETP	_IOR('t', 8,struct sgttyb)/* get parameters -- gtty */
+#define	TIOCSETP	_IOW('t', 9,struct sgttyb)/* set parameters -- stty */
+#define	TIOCSETN	_IOW('t',10,struct sgttyb)/* as above, but no flushtty*/
+#define	TIOCSETC	_IOW('t',17,struct tchars)/* set special characters */
+#define	TIOCGETC	_IOR('t',18,struct tchars)/* get special characters */
+/*
+ * The entries marked as termios below, are common and should have the
+ * same values.
+ */
+#define		TANDEM		0x00000001	/* send stopc on out q full */
+#define		CBREAK		0x00000002	/* half-cooked mode */
+#define		LCASE		0x00000004	/* simulate lower case */
+/* termios	ECHO		0x00000008	   enable echoing */
+#define		CRMOD		0x00000010	/* map \r to \r\n on output */
+#define		RAW		0x00000020	/* no i/o processing */
+#define		ODDP		0x00000040	/* get/send odd parity */
+#define		EVENP		0x00000080	/* get/send even parity */
+#define		ANYP		0x000000c0	/* get any parity/send none */
+#define		NLDELAY		0x00000300	/* \n delay */
+#define			NL0	0x00000000
+#define			NL1	0x00000100	/* tty 37 */
+#define			NL2	0x00000200	/* vt05 */
+#define			NL3	0x00000300
+#define		TBDELAY		0x00000c00	/* horizontal tab delay */
+#define			TAB0	0x00000000
+#define			TAB1	0x00000400	/* tty 37 */
+#define			TAB2	0x00000800
+#define		XTABS		0x00000c00	/* expand tabs on output */
+#define		CRDELAY		0x00003000	/* \r delay */
+#define			CR0	0x00000000
+#define			CR1	0x00001000	/* tn 300 */
+#define			CR2	0x00002000	/* tty 37 */
+#define			CR3	0x00003000	/* concept 100 */
+#define		VTDELAY		0x00004000	/* vertical tab delay */
+#define			FF0	0x00000000
+#define			FF1	0x00004000	/* tty 37 */
+#define		BSDELAY		0x00008000	/* \b delay */
+#define			BS0	0x00000000
+#define			BS1	0x00008000
+#define		ALLDELAY	(NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)
+#define		CRTBS		0x00010000	/* do backspacing for crt */
+#define		PRTERA		0x00020000	/* \ ... / erase */
+#define		CRTERA		0x00040000	/* " \b " to wipe out char */
+#define		TILDE		0x00080000	/* hazeltine tilde kludge */
+/* termios	MDMBUF		0x00100000	   DTR/DCD hardware flow control */
+#define		LITOUT		0x00200000	/* literal output */
+/* termios	TOSTOP		0x00400000	   stop background jobs on output */
+/* termios	FLUSHO		0x00800000	   output being flushed (state) */
+#define		NOHANG		0x01000000	/* (no-op) was no SIGHUP on carrier drop */
+#define		L001000		0x02000000
+#define		CRTKIL		0x04000000	/* kill line with " \b " */
+#define		PASS8		0x08000000
+#define		CTLECH		0x10000000	/* echo control chars as ^X */
+/* termios	PENDIN		0x20000000	   re-echo input buffer at next read */
+#define		DECCTQ		0x40000000	/* only ^Q starts after ^S */
+/* termios 	NOFLSH		0x80000000	   don't flush output on signal */
+#define	TIOCLBIS	_IOW('t', 127, int)	/* bis local mode bits */
+#define	TIOCLBIC	_IOW('t', 126, int)	/* bic local mode bits */
+#define	TIOCLSET	_IOW('t', 125, int)	/* set entire local mode word */
+#define	TIOCLGET	_IOR('t', 124, int)	/* get local modes */
+#define		LCRTBS		(CRTBS>>16)
+#define		LPRTERA		(PRTERA>>16)
+#define		LCRTERA		(CRTERA>>16)
+#define		LTILDE		(TILDE>>16)
+#define		LMDMBUF		(MDMBUF>>16)
+#define		LLITOUT		(LITOUT>>16)
+#define		LTOSTOP		(TOSTOP>>16)
+#define		LFLUSHO		(FLUSHO>>16)
+#define		LNOHANG		(NOHANG>>16)
+#define		LCRTKIL		(CRTKIL>>16)
+#define		LPASS8		(PASS8>>16)
+#define		LCTLECH		(CTLECH>>16)
+#define		LPENDIN		(PENDIN>>16)
+#define		LDECCTQ		(DECCTQ>>16)
+#define		LNOFLSH		(NOFLSH>>16)
+#define	TIOCSLTC	_IOW('t',117,struct ltchars)/* set local special chars*/
+#define	TIOCGLTC	_IOR('t',116,struct ltchars)/* get local special chars*/
+#define OTIOCCONS	_IO('t', 98)	/* for hp300 -- sans int arg */
+#define	OTTYDISC	0
+#define	NETLDISC	1
+#define	NTTYDISC	2
+
+#endif /* !_SYS_IOCTL_COMPAT_H_ */
+#endif /* !defined(__minix) */

Property changes on: lab4/.minix-src/include/sys/ioctl_compat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/endian.h
===================================================================
--- lab4/.minix-src/include/sys/endian.h	(nonexistent)
+++ lab4/.minix-src/include/sys/endian.h	(revision 13)
@@ -0,0 +1,340 @@
+/*	$NetBSD: endian.h,v 1.29 2014/03/18 14:28:37 riastradh Exp $	*/
+
+/*
+ * Copyright (c) 1987, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)endian.h	8.1 (Berkeley) 6/11/93
+ */
+
+#ifndef _SYS_ENDIAN_H_
+#define _SYS_ENDIAN_H_
+
+#include <sys/featuretest.h>
+
+/*
+ * Definitions for byte order, according to byte significance from low
+ * address to high.
+ */
+#define	_LITTLE_ENDIAN	1234	/* LSB first: i386, vax */
+#define	_BIG_ENDIAN	4321	/* MSB first: 68000, ibm, net */
+#define	_PDP_ENDIAN	3412	/* LSB first in word, MSW first in long */
+
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#ifndef _LOCORE
+
+/* C-family endian-ness definitions */
+
+#include <sys/ansi.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#ifndef in_addr_t
+typedef __in_addr_t	in_addr_t;
+#define	in_addr_t	__in_addr_t
+#endif
+
+#ifndef in_port_t
+typedef __in_port_t	in_port_t;
+#define	in_port_t	__in_port_t
+#endif
+
+__BEGIN_DECLS
+uint32_t htonl(uint32_t) __constfunc;
+uint16_t htons(uint16_t) __constfunc;
+uint32_t ntohl(uint32_t) __constfunc;
+uint16_t ntohs(uint16_t) __constfunc;
+__END_DECLS
+
+#endif /* !_LOCORE */
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+
+#include <machine/endian_machdep.h>
+
+/*
+ * Define the order of 32-bit words in 64-bit words.
+ */
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+#define _QUAD_HIGHWORD 1
+#define _QUAD_LOWWORD 0
+#endif
+
+#if _BYTE_ORDER == _BIG_ENDIAN
+#define _QUAD_HIGHWORD 0
+#define _QUAD_LOWWORD 1
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+/*
+ *  Traditional names for byteorder.  These are defined as the numeric
+ *  sequences so that third party code can "#define XXX_ENDIAN" and not
+ *  cause errors.
+ */
+#define	LITTLE_ENDIAN	1234		/* LSB first: i386, vax */
+#define	BIG_ENDIAN	4321		/* MSB first: 68000, ibm, net */
+#define	PDP_ENDIAN	3412		/* LSB first in word, MSW first in long */
+#define BYTE_ORDER	_BYTE_ORDER
+
+#ifndef _LOCORE
+
+#include <machine/bswap.h>
+
+/*
+ * Macros for network/external number representation conversion.
+ */
+#if BYTE_ORDER == BIG_ENDIAN && !defined(__lint__)
+#define	ntohl(x)	(x)
+#define	ntohs(x)	(x)
+#define	htonl(x)	(x)
+#define	htons(x)	(x)
+
+#define	NTOHL(x)	(void) (x)
+#define	NTOHS(x)	(void) (x)
+#define	HTONL(x)	(void) (x)
+#define	HTONS(x)	(void) (x)
+
+#else	/* LITTLE_ENDIAN || !defined(__lint__) */
+
+#define	ntohl(x)	bswap32(__CAST(uint32_t, (x)))
+#define	ntohs(x)	bswap16(__CAST(uint16_t, (x)))
+#define	htonl(x)	bswap32(__CAST(uint32_t, (x)))
+#define	htons(x)	bswap16(__CAST(uint16_t, (x)))
+
+#define	NTOHL(x)	(x) = ntohl(__CAST(uint32_t, (x)))
+#define	NTOHS(x)	(x) = ntohs(__CAST(uint16_t, (x)))
+#define	HTONL(x)	(x) = htonl(__CAST(uint32_t, (x)))
+#define	HTONS(x)	(x) = htons(__CAST(uint16_t, (x)))
+#endif	/* LITTLE_ENDIAN || !defined(__lint__) */
+
+/*
+ * Macros to convert to a specific endianness.
+ */
+
+#if BYTE_ORDER == BIG_ENDIAN
+
+#define htobe16(x)	(x)
+#define htobe32(x)	(x)
+#define htobe64(x)	(x)
+#define htole16(x)	bswap16(__CAST(uint16_t, (x)))
+#define htole32(x)	bswap32(__CAST(uint32_t, (x)))
+#define htole64(x)	bswap64(__CAST(uint64_t, (x)))
+
+#define HTOBE16(x)	__CAST(void, (x))
+#define HTOBE32(x)	__CAST(void, (x))
+#define HTOBE64(x)	__CAST(void, (x))
+#define HTOLE16(x)	(x) = bswap16(__CAST(uint16_t, (x)))
+#define HTOLE32(x)	(x) = bswap32(__CAST(uint32_t, (x)))
+#define HTOLE64(x)	(x) = bswap64(__CAST(uint64_t, (x)))
+
+#else	/* LITTLE_ENDIAN */
+
+#define htobe16(x)	bswap16(__CAST(uint16_t, (x)))
+#define htobe32(x)	bswap32(__CAST(uint32_t, (x)))
+#define htobe64(x)	bswap64(__CAST(uint64_t, (x)))
+#define htole16(x)	(x)
+#define htole32(x)	(x)
+#define htole64(x)	(x)
+
+#define HTOBE16(x)	(x) = bswap16(__CAST(uint16_t, (x)))
+#define HTOBE32(x)	(x) = bswap32(__CAST(uint32_t, (x)))
+#define HTOBE64(x)	(x) = bswap64(__CAST(uint64_t, (x)))
+#define HTOLE16(x)	__CAST(void, (x))
+#define HTOLE32(x)	__CAST(void, (x))
+#define HTOLE64(x)	__CAST(void, (x))
+
+#endif	/* LITTLE_ENDIAN */
+
+#define be16toh(x)	htobe16(x)
+#define be32toh(x)	htobe32(x)
+#define be64toh(x)	htobe64(x)
+#define le16toh(x)	htole16(x)
+#define le32toh(x)	htole32(x)
+#define le64toh(x)	htole64(x)
+
+#define BE16TOH(x)	HTOBE16(x)
+#define BE32TOH(x)	HTOBE32(x)
+#define BE64TOH(x)	HTOBE64(x)
+#define LE16TOH(x)	HTOLE16(x)
+#define LE32TOH(x)	HTOLE32(x)
+#define LE64TOH(x)	HTOLE64(x)
+
+/*
+ * Routines to encode/decode big- and little-endian multi-octet values
+ * to/from an octet stream.
+ */
+
+#if __GNUC_PREREQ__(2, 95)
+
+#define __GEN_ENDIAN_ENC(bits, endian) \
+static __inline __unused void \
+endian ## bits ## enc(void *dst, uint ## bits ## _t u) \
+{ \
+	u = hto ## endian ## bits (u); \
+	__builtin_memcpy(dst, &u, sizeof(u)); \
+}
+
+__GEN_ENDIAN_ENC(16, be)
+__GEN_ENDIAN_ENC(32, be)
+__GEN_ENDIAN_ENC(64, be)
+__GEN_ENDIAN_ENC(16, le)
+__GEN_ENDIAN_ENC(32, le)
+__GEN_ENDIAN_ENC(64, le)
+#undef __GEN_ENDIAN_ENC
+
+#define __GEN_ENDIAN_DEC(bits, endian) \
+static __inline __unused uint ## bits ## _t \
+endian ## bits ## dec(const void *buf) \
+{ \
+	uint ## bits ## _t u; \
+	__builtin_memcpy(&u, buf, sizeof(u)); \
+	return endian ## bits ## toh (u); \
+}
+
+__GEN_ENDIAN_DEC(16, be)
+__GEN_ENDIAN_DEC(32, be)
+__GEN_ENDIAN_DEC(64, be)
+__GEN_ENDIAN_DEC(16, le)
+__GEN_ENDIAN_DEC(32, le)
+__GEN_ENDIAN_DEC(64, le)
+#undef __GEN_ENDIAN_DEC
+
+#else	/* !(GCC >= 2.95) */
+
+static __inline void __unused
+be16enc(void *buf, uint16_t u)
+{
+	uint8_t *p = __CAST(uint8_t *, buf);
+
+	p[0] = __CAST(uint8_t, ((__CAST(unsigned, u) >> 8) & 0xff));
+	p[1] = __CAST(uint8_t, (u & 0xff));
+}
+
+static __inline void __unused
+le16enc(void *buf, uint16_t u)
+{
+	uint8_t *p = __CAST(uint8_t *, buf);
+
+	p[0] = __CAST(uint8_t, (u & 0xff));
+	p[1] = __CAST(uint8_t, ((__CAST(unsigned, u) >> 8) & 0xff));
+}
+
+static __inline uint16_t __unused
+be16dec(const void *buf)
+{
+	const uint8_t *p = __CAST(const uint8_t *, buf);
+
+	return ((__CAST(uint16_t, p[0]) << 8) | p[1]);
+}
+
+static __inline uint16_t __unused
+le16dec(const void *buf)
+{
+	const uint8_t *p = __CAST(const uint8_t *, buf);
+
+	return (p[0] | (__CAST(uint16_t, p[1]) << 8));
+}
+
+static __inline void __unused
+be32enc(void *buf, uint32_t u)
+{
+	uint8_t *p = __CAST(uint8_t *, buf);
+
+	p[0] = __CAST(uint8_t, ((u >> 24) & 0xff));
+	p[1] = __CAST(uint8_t, ((u >> 16) & 0xff));
+	p[2] = __CAST(uint8_t, ((u >> 8) & 0xff));
+	p[3] = __CAST(uint8_t, (u & 0xff));
+}
+
+static __inline void __unused
+le32enc(void *buf, uint32_t u)
+{
+	uint8_t *p = __CAST(uint8_t *, buf);
+
+	p[0] = __CAST(uint8_t, (u & 0xff));
+	p[1] = __CAST(uint8_t, ((u >> 8) & 0xff));
+	p[2] = __CAST(uint8_t, ((u >> 16) & 0xff));
+	p[3] = __CAST(uint8_t, ((u >> 24) & 0xff));
+}
+
+static __inline uint32_t __unused
+be32dec(const void *buf)
+{
+	const uint8_t *p = __CAST(const uint8_t *, buf);
+
+	return ((__CAST(uint32_t, be16dec(p)) << 16) | be16dec(p + 2));
+}
+
+static __inline uint32_t __unused
+le32dec(const void *buf)
+{
+	const uint8_t *p = __CAST(const uint8_t *, buf);
+
+	return (le16dec(p) | (__CAST(uint32_t, le16dec(p + 2)) << 16));
+}
+
+static __inline void __unused
+be64enc(void *buf, uint64_t u)
+{
+	uint8_t *p = __CAST(uint8_t *, buf);
+
+	be32enc(p, __CAST(uint32_t, (u >> 32)));
+	be32enc(p + 4, __CAST(uint32_t, (u & 0xffffffffULL)));
+}
+
+static __inline void __unused
+le64enc(void *buf, uint64_t u)
+{
+	uint8_t *p = __CAST(uint8_t *, buf);
+
+	le32enc(p, __CAST(uint32_t, (u & 0xffffffffULL)));
+	le32enc(p + 4, __CAST(uint32_t, (u >> 32)));
+}
+
+static __inline uint64_t __unused
+be64dec(const void *buf)
+{
+	const uint8_t *p = (const uint8_t *)buf;
+
+	return ((__CAST(uint64_t, be32dec(p)) << 32) | be32dec(p + 4));
+}
+
+static __inline uint64_t __unused
+le64dec(const void *buf)
+{
+	const uint8_t *p = (const uint8_t *)buf;
+
+	return (le32dec(p) | (__CAST(uint64_t, le32dec(p + 4)) << 32));
+}
+
+#endif	/* GCC >= 2.95 */
+
+#endif /* !_LOCORE */
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+#endif /* !_SYS_ENDIAN_H_ */

Property changes on: lab4/.minix-src/include/sys/endian.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/evcnt.h
===================================================================
--- lab4/.minix-src/include/sys/evcnt.h	(nonexistent)
+++ lab4/.minix-src/include/sys/evcnt.h	(revision 13)
@@ -0,0 +1,140 @@
+/*	$NetBSD: evcnt.h,v 1.8 2011/01/29 18:21:22 matt Exp $	*/
+
+/*
+ * Copyright (c) 1996, 2000 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *          This product includes software developed for the
+ *          NetBSD Project.  See http://www.NetBSD.org/ for
+ *          information about NetBSD.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ *
+ * --(license Id: LICENSE.proto,v 1.1 2000/06/13 21:40:26 cgd Exp )--
+ */
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Lawrence Berkeley Laboratories.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_EVCNT_H_
+#define	_SYS_EVCNT_H_
+
+#include <sys/queue.h>
+#include <sys/stdint.h>
+
+/*
+ * event counters
+ */
+
+struct evcnt {
+	uint64_t	ev_count;	/* how many have occurred */
+	TAILQ_ENTRY(evcnt) ev_list;	/* entry on list of all counters */
+	unsigned char	ev_type;	/* counter type; see below */
+	unsigned char	ev_grouplen;	/* 'group' len, excluding NUL */
+	unsigned char	ev_namelen;	/* 'name' len, excluding NUL */
+	char		ev_pad1;	/* reserved (for now); 0 */
+	const struct evcnt *ev_parent;	/* parent, for hierarchical ctrs */
+	const char	*ev_group;	/* name of group */
+	const char	*ev_name;	/* name of specific event */
+};
+TAILQ_HEAD(evcntlist, evcnt);
+
+/* maximum group/name lengths, including trailing NUL */
+#define	EVCNT_STRING_MAX	255
+
+/* ev_type values */
+#define	EVCNT_TYPE_ANY		-1	/* for sysctl */
+#define	EVCNT_TYPE_MISC		0	/* miscellaneous; catch all */
+#define	EVCNT_TYPE_INTR		1	/* interrupt; count with vmstat -i */
+#define	EVCNT_TYPE_TRAP		2	/* processor trap/execption */
+
+/*
+ * initializer for an event count structure.  the lengths are initted and
+ * it is added to the evcnt list at attach time.
+ */
+#define	EVCNT_INITIALIZER(type, parent, group, name)	\
+    {							\
+	.ev_type = type,				\
+	.ev_parent = parent,				\
+	.ev_group = group,				\
+	.ev_name = name,				\
+    }
+
+/*
+ * Attach a static event counter.  This uses a link set to do the work.
+ * NOTE: "ev" should not be a pointer to the object, but rather a direct
+ * reference to the object itself.
+ */
+#define	EVCNT_ATTACH_STATIC(ev)		__link_set_add_data(evcnts, ev)
+#define	EVCNT_ATTACH_STATIC2(ev, n)	__link_set_add_data2(evcnts, ev, n)
+
+#ifdef _KERNEL
+
+extern struct evcntlist allevents;	/* list of all event counters */
+
+void	evcnt_init(void);
+void	evcnt_attach_static(struct evcnt *);
+void	evcnt_attach_dynamic_nozero(struct evcnt *, int, const struct evcnt *,
+	    const char *, const char *);
+void	evcnt_attach_dynamic(struct evcnt *, int, const struct evcnt *,
+	    const char *, const char *);
+void	evcnt_detach(struct evcnt *);
+#endif /* _KERNEL */
+
+#endif /* !_SYS_EVCNT_H_ */

Property changes on: lab4/.minix-src/include/sys/evcnt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/exec_elf.h
===================================================================
--- lab4/.minix-src/include/sys/exec_elf.h	(nonexistent)
+++ lab4/.minix-src/include/sys/exec_elf.h	(revision 13)
@@ -0,0 +1,1329 @@
+/*	$NetBSD: exec_elf.h,v 1.149 2015/07/30 15:28:18 maxv Exp $	*/
+
+/*-
+ * Copyright (c) 1994 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_EXEC_ELF_H_
+#define _SYS_EXEC_ELF_H_
+
+/*
+ * The current ELF ABI specification is available at:
+ *	http://www.sco.com/developers/gabi/
+ *
+ * Current header definitions are in:
+ *	http://www.sco.com/developers/gabi/latest/ch4.eheader.html
+ */
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/types.h>
+#else
+#include <inttypes.h>
+#endif /* _KERNEL || _STANDALONE */
+
+#ifdef   _BSD_SIZE_T_
+typedef  _BSD_SIZE_T_    size_t;
+#undef   _BSD_SIZE_T_
+#endif
+
+#if HAVE_NBTOOL_CONFIG_H
+#include <nbinclude/machine/elf_machdep.h>
+#else
+#include <machine/elf_machdep.h>
+#endif
+
+typedef uint8_t		Elf_Byte;
+
+typedef uint32_t	Elf32_Addr;
+#define ELF32_FSZ_ADDR	4
+typedef uint32_t	Elf32_Off;
+typedef int32_t		Elf32_SOff;
+#define ELF32_FSZ_OFF	4
+typedef int32_t		Elf32_Sword;
+#define ELF32_FSZ_SWORD 4
+typedef uint32_t	Elf32_Word;
+#define ELF32_FSZ_WORD	4
+typedef uint16_t	Elf32_Half;
+#define ELF32_FSZ_HALF	2
+typedef uint64_t	Elf32_Lword;
+#define ELF32_FSZ_LWORD 8
+
+typedef uint64_t	Elf64_Addr;
+#define ELF64_FSZ_ADDR	8
+typedef uint64_t	Elf64_Off;
+typedef int64_t		Elf64_SOff;
+#define ELF64_FSZ_OFF	8
+
+typedef int32_t		Elf64_Sword;
+#define ELF64_FSZ_SWORD 4
+typedef uint32_t	Elf64_Word;
+#define ELF64_FSZ_WORD	4
+
+typedef int64_t		Elf64_Sxword;
+#define ELF64_FSZ_SXWORD 8
+typedef uint64_t	Elf64_Xword;
+#define ELF64_FSZ_XWORD 8
+typedef uint64_t	Elf64_Lword;
+#define ELF64_FSZ_LWORD 8
+typedef uint16_t	Elf64_Half;
+#define ELF64_FSZ_HALF 2
+
+/*
+ * ELF Header
+ */
+#define ELF_NIDENT	16
+
+typedef struct {
+	unsigned char	e_ident[ELF_NIDENT];	/* Id bytes */
+	Elf32_Half	e_type;			/* file type */
+	Elf32_Half	e_machine;		/* machine type */
+	Elf32_Word	e_version;		/* version number */
+	Elf32_Addr	e_entry;		/* entry point */
+	Elf32_Off	e_phoff;		/* Program hdr offset */
+	Elf32_Off	e_shoff;		/* Section hdr offset */
+	Elf32_Word	e_flags;		/* Processor flags */
+	Elf32_Half	e_ehsize;		/* sizeof ehdr */
+	Elf32_Half	e_phentsize;		/* Program header entry size */
+	Elf32_Half	e_phnum;		/* Number of program headers */
+	Elf32_Half	e_shentsize;		/* Section header entry size */
+	Elf32_Half	e_shnum;		/* Number of section headers */
+	Elf32_Half	e_shstrndx;		/* String table index */
+} Elf32_Ehdr;
+
+typedef struct {
+	unsigned char	e_ident[ELF_NIDENT];	/* Id bytes */
+	Elf64_Half	e_type;			/* file type */
+	Elf64_Half	e_machine;		/* machine type */
+	Elf64_Word	e_version;		/* version number */
+	Elf64_Addr	e_entry;		/* entry point */
+	Elf64_Off	e_phoff;		/* Program hdr offset */
+	Elf64_Off	e_shoff;		/* Section hdr offset */
+	Elf64_Word	e_flags;		/* Processor flags */
+	Elf64_Half	e_ehsize;		/* sizeof ehdr */
+	Elf64_Half	e_phentsize;		/* Program header entry size */
+	Elf64_Half	e_phnum;		/* Number of program headers */
+	Elf64_Half	e_shentsize;		/* Section header entry size */
+	Elf64_Half	e_shnum;		/* Number of section headers */
+	Elf64_Half	e_shstrndx;		/* String table index */
+} Elf64_Ehdr;
+
+/* e_ident offsets */
+#define EI_MAG0		0	/* '\177' */
+#define EI_MAG1		1	/* 'E'	  */
+#define EI_MAG2		2	/* 'L'	  */
+#define EI_MAG3		3	/* 'F'	  */
+#define EI_CLASS	4	/* File class */
+#define EI_DATA		5	/* Data encoding */
+#define EI_VERSION	6	/* File version */
+#define EI_OSABI	7	/* Operating system/ABI identification */
+#define EI_ABIVERSION	8	/* ABI version */
+#define EI_PAD		9	/* Start of padding bytes up to EI_NIDENT*/
+#define EI_NIDENT	16	/* First non-ident header byte */
+
+/* e_ident[EI_MAG0,EI_MAG3] */
+#define ELFMAG0		0x7f
+#define ELFMAG1		'E'
+#define ELFMAG2		'L'
+#define ELFMAG3		'F'
+#define ELFMAG		"\177ELF"
+#define SELFMAG		4
+
+/* e_ident[EI_CLASS] */
+#define ELFCLASSNONE	0	/* Invalid class */
+#define ELFCLASS32	1	/* 32-bit objects */
+#define ELFCLASS64	2	/* 64-bit objects */
+#define ELFCLASSNUM	3
+
+/* e_ident[EI_DATA] */
+#define ELFDATANONE	0	/* Invalid data encoding */
+#define ELFDATA2LSB	1	/* 2's complement values, LSB first */
+#define ELFDATA2MSB	2	/* 2's complement values, MSB first */
+
+/* e_ident[EI_VERSION] */
+#define EV_NONE		0	/* Invalid version */
+#define EV_CURRENT	1	/* Current version */
+#define EV_NUM		2
+
+/* e_ident[EI_OSABI] */
+#define ELFOSABI_SYSV		0	/* UNIX System V ABI */
+#define ELFOSABI_HPUX		1	/* HP-UX operating system */
+#define ELFOSABI_NETBSD		2	/* NetBSD */
+#define ELFOSABI_LINUX		3	/* GNU/Linux */
+#define ELFOSABI_HURD		4	/* GNU/Hurd */
+#define ELFOSABI_86OPEN		5	/* 86Open */
+#define ELFOSABI_SOLARIS	6	/* Solaris */
+#define ELFOSABI_MONTEREY	7	/* Monterey */
+#define ELFOSABI_IRIX		8	/* IRIX */
+#define ELFOSABI_FREEBSD	9	/* FreeBSD */
+#define ELFOSABI_TRU64		10	/* TRU64 UNIX */
+#define ELFOSABI_MODESTO	11	/* Novell Modesto */
+#define ELFOSABI_OPENBSD	12	/* OpenBSD */
+#define ELFOSABI_OPENVMS	13	/* OpenVMS */
+#define ELFOSABI_NSK		14	/* HP Non-Stop Kernel */
+#define ELFOSABI_AROS		15	/* Amiga Research OS */
+/* Unofficial OSABIs follow */
+#define ELFOSABI_ARM		97	/* ARM */
+#define ELFOSABI_STANDALONE	255	/* Standalone (embedded) application */
+
+#define ELFOSABI_NONE		ELFOSABI_SYSV
+#define ELFOSABI_AIX		ELFOSABI_MONTEREY
+
+/* e_type */
+#define ET_NONE		0	/* No file type */
+#define ET_REL		1	/* Relocatable file */
+#define ET_EXEC		2	/* Executable file */
+#define ET_DYN		3	/* Shared object file */
+#define ET_CORE		4	/* Core file */
+#define ET_NUM		5
+
+#define ET_LOOS		0xfe00	/* Operating system specific range */
+#define ET_HIOS		0xfeff
+#define ET_LOPROC	0xff00	/* Processor-specific range */
+#define ET_HIPROC	0xffff
+
+/* e_machine */
+#define EM_NONE		0	/* No machine */
+#define EM_M32		1	/* AT&T WE 32100 */
+#define EM_SPARC	2	/* SPARC */
+#define EM_386		3	/* Intel 80386 */
+#define EM_68K		4	/* Motorola 68000 */
+#define EM_88K		5	/* Motorola 88000 */
+#define EM_486		6	/* Intel 80486 */
+#define EM_860		7	/* Intel 80860 */
+#define EM_MIPS		8	/* MIPS I Architecture */
+#define EM_S370		9	/* Amdahl UTS on System/370 */
+#define EM_MIPS_RS3_LE	10	/* MIPS RS3000 Little-endian */
+			/* 11-14 - Reserved */
+#define EM_RS6000	11	/* IBM RS/6000 XXX reserved */
+#define EM_PARISC	15	/* Hewlett-Packard PA-RISC */
+#define EM_NCUBE	16	/* NCube XXX reserved */
+#define EM_VPP500	17	/* Fujitsu VPP500 */
+#define EM_SPARC32PLUS	18	/* Enhanced instruction set SPARC */
+#define EM_960		19	/* Intel 80960 */
+#define EM_PPC		20	/* PowerPC */
+#define EM_PPC64	21	/* 64-bit PowerPC */
+			/* 22-35 - Reserved */
+#define EM_S390		22	/* System/390 XXX reserved */
+#define EM_V800		36	/* NEC V800 */
+#define EM_FR20		37	/* Fujitsu FR20 */
+#define EM_RH32		38	/* TRW RH-32 */
+#define EM_RCE		39	/* Motorola RCE */
+#define EM_ARM		40	/* Advanced RISC Machines ARM */
+#define EM_ALPHA	41	/* DIGITAL Alpha */
+#define EM_SH		42	/* Hitachi Super-H */
+#define EM_SPARCV9	43	/* SPARC Version 9 */
+#define EM_TRICORE	44	/* Siemens Tricore */
+#define EM_ARC		45	/* Argonaut RISC Core */
+#define EM_H8_300	46	/* Hitachi H8/300 */
+#define EM_H8_300H	47	/* Hitachi H8/300H */
+#define EM_H8S		48	/* Hitachi H8S */
+#define EM_H8_500	49	/* Hitachi H8/500 */
+#define EM_IA_64	50	/* Intel Merced Processor */
+#define EM_MIPS_X	51	/* Stanford MIPS-X */
+#define EM_COLDFIRE	52	/* Motorola Coldfire */
+#define EM_68HC12	53	/* Motorola MC68HC12 */
+#define EM_MMA		54	/* Fujitsu MMA Multimedia Accelerator */
+#define EM_PCP		55	/* Siemens PCP */
+#define EM_NCPU		56	/* Sony nCPU embedded RISC processor */
+#define EM_NDR1		57	/* Denso NDR1 microprocessor */
+#define EM_STARCORE	58	/* Motorola Star*Core processor */
+#define EM_ME16		59	/* Toyota ME16 processor */
+#define EM_ST100	60	/* STMicroelectronics ST100 processor */
+#define EM_TINYJ	61	/* Advanced Logic Corp. TinyJ embedded family processor */
+#define EM_X86_64	62	/* AMD x86-64 architecture */
+#define EM_PDSP		63	/* Sony DSP Processor */
+#define EM_PDP10	64	/* Digital Equipment Corp. PDP-10 */
+#define EM_PDP11	65	/* Digital Equipment Corp. PDP-11 */
+#define EM_FX66		66	/* Siemens FX66 microcontroller */
+#define EM_ST9PLUS	67	/* STMicroelectronics ST9+ 8/16 bit microcontroller */
+#define EM_ST7		68	/* STMicroelectronics ST7 8-bit microcontroller */
+#define EM_68HC16	69	/* Motorola MC68HC16 Microcontroller */
+#define EM_68HC11	70	/* Motorola MC68HC11 Microcontroller */
+#define EM_68HC08	71	/* Motorola MC68HC08 Microcontroller */
+#define EM_68HC05	72	/* Motorola MC68HC05 Microcontroller */
+#define EM_SVX		73	/* Silicon Graphics SVx */
+#define EM_ST19		74	/* STMicroelectronics ST19 8-bit CPU */
+#define EM_VAX		75	/* Digital VAX */
+#define EM_CRIS		76	/* Axis Communications 32-bit embedded processor */
+#define EM_JAVELIN	77	/* Infineon Technologies 32-bit embedded CPU */
+#define EM_FIREPATH	78	/* Element 14 64-bit DSP processor */
+#define EM_ZSP		79	/* LSI Logic's 16-bit DSP processor */
+#define EM_MMIX		80	/* Donald Knuth's educational 64-bit processor */
+#define EM_HUANY	81	/* Harvard's machine-independent format */
+#define EM_PRISM	82	/* SiTera Prism */
+#define EM_AVR		83	/* Atmel AVR 8-bit microcontroller */
+#define EM_FR30		84	/* Fujitsu FR30 */
+#define EM_D10V		85	/* Mitsubishi D10V */
+#define EM_D30V		86	/* Mitsubishi D30V */
+#define EM_V850		87	/* NEC v850 */
+#define EM_M32R		88	/* Mitsubishi M32R */
+#define EM_MN10300	89	/* Matsushita MN10300 */
+#define EM_MN10200	90	/* Matsushita MN10200 */
+#define EM_PJ		91	/* picoJava */
+#define EM_OR1K		92	/* OpenRISC 32-bit embedded processor */
+#define EM_OPENRISC	EM_OR1K
+#define EM_ARC_A5	93	/* ARC Cores Tangent-A5 */
+#define EM_XTENSA	94	/* Tensilica Xtensa Architecture */
+#define EM_VIDEOCORE	95	/* Alphamosaic VideoCore processor */
+#define EM_TMM_GPP	96	/* Thompson Multimedia General Purpose Processor */
+#define EM_NS32K	97	/* National Semiconductor 32000 series */
+#define EM_TPC		98	/* Tenor Network TPC processor */
+#define EM_SNP1K	99	/* Trebia SNP 1000 processor */
+#define EM_ST200	100	/* STMicroelectronics ST200 microcontroller */
+#define EM_IP2K		101	/* Ubicom IP2xxx microcontroller family */
+#define EM_MAX		102	/* MAX processor */
+#define EM_CR		103	/* National Semiconductor CompactRISC micorprocessor */
+#define EM_F2MC16	104	/* Fujitsu F2MC16 */
+#define EM_MSP430	105	/* Texas Instruments MSP430 */
+#define EM_BLACKFIN	106	/* Analog Devices Blackfin DSP */
+#define EM_SE_C33	107	/* Seiko Epson S1C33 family */
+#define EM_SEP		108	/* Sharp embedded microprocessor */
+#define EM_ARCA		109	/* Arca RISC microprocessor */
+#define EM_UNICORE	110	/* UNICORE from PKU-Unity Ltd. and MPRC Peking University */
+#define EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
+#define EM_AARCH64	183	/* AArch64 64-bit ARM microprocessor */
+#define EM_AVR32	185	/* Atmel Corporation 32-bit microprocessor family*/
+#define EM_TILE64	187	/* Tilera TILE64 multicore architecture family */
+#define EM_TILEPRO	188	/* Tilera TILEPro multicore architecture family */
+#define EM_MICROBLAZE	189	/* Xilinx MicroBlaze 32-bit RISC soft processor core */
+#define EM_TILEGX	192	/* Tilera TILE-GX multicore architecture family */
+#define EM_Z80		220	/* Zilog Z80 */
+#define EM_RISCV	243	/* RISC-V */
+
+/* Unofficial machine types follow */
+#define EM_ALPHA_EXP	36902	/* used by NetBSD/alpha; obsolete */
+#define EM_NUM		36903
+
+/*
+ * Program Header
+ */
+typedef struct {
+	Elf32_Word	p_type;		/* entry type */
+	Elf32_Off	p_offset;	/* offset */
+	Elf32_Addr	p_vaddr;	/* virtual address */
+	Elf32_Addr	p_paddr;	/* physical address */
+	Elf32_Word	p_filesz;	/* file size */
+	Elf32_Word	p_memsz;	/* memory size */
+	Elf32_Word	p_flags;	/* flags */
+	Elf32_Word	p_align;	/* memory & file alignment */
+} Elf32_Phdr;
+
+typedef struct {
+	Elf64_Word	p_type;		/* entry type */
+	Elf64_Word	p_flags;	/* flags */
+	Elf64_Off	p_offset;	/* offset */
+	Elf64_Addr	p_vaddr;	/* virtual address */
+	Elf64_Addr	p_paddr;	/* physical address */
+	Elf64_Xword	p_filesz;	/* file size */
+	Elf64_Xword	p_memsz;	/* memory size */
+	Elf64_Xword	p_align;	/* memory & file alignment */
+} Elf64_Phdr;
+
+/* p_type */
+#define PT_NULL		0		/* Program header table entry unused */
+#define PT_LOAD		1		/* Loadable program segment */
+#define PT_DYNAMIC	2		/* Dynamic linking information */
+#define PT_INTERP	3		/* Program interpreter */
+#define PT_NOTE		4		/* Auxiliary information */
+#define PT_SHLIB	5		/* Reserved, unspecified semantics */
+#define PT_PHDR		6		/* Entry for header table itself */
+#define PT_TLS		7		/* TLS initialisation image */
+#define PT_NUM		8
+
+#define PT_LOOS		0x60000000	/* OS-specific range */
+
+/* GNU-specific */
+#define PT_GNU_EH_FRAME 0x6474e550	/* EH frame segment */
+#define PT_GNU_STACK	0x6474e551	/* Indicate executable stack */
+#define PT_GNU_RELRO	0x6474e552	/* Make read-only after relocation */
+
+#define PT_HIOS		0x6fffffff
+#define PT_LOPROC	0x70000000	/* Processor-specific range */
+#define PT_HIPROC	0x7fffffff
+
+#define PT_MIPS_REGINFO 0x70000000
+
+/* p_flags */
+#define PF_R		0x4		/* Segment is readable */
+#define PF_W		0x2		/* Segment is writable */
+#define PF_X		0x1		/* Segment is executable */
+
+#define PF_MASKOS	0x0ff00000	/* Operating system specific values */
+#define PF_MASKPROC	0xf0000000	/* Processor-specific values */
+
+/* Extended program header index. */
+#define PN_XNUM		0xffff
+
+/*
+ * Section Headers
+ */
+typedef struct {
+	Elf32_Word	sh_name;	/* section name (.shstrtab index) */
+	Elf32_Word	sh_type;	/* section type */
+	Elf32_Word	sh_flags;	/* section flags */
+	Elf32_Addr	sh_addr;	/* virtual address */
+	Elf32_Off	sh_offset;	/* file offset */
+	Elf32_Word	sh_size;	/* section size */
+	Elf32_Word	sh_link;	/* link to another */
+	Elf32_Word	sh_info;	/* misc info */
+	Elf32_Word	sh_addralign;	/* memory alignment */
+	Elf32_Word	sh_entsize;	/* table entry size */
+} Elf32_Shdr;
+
+typedef struct {
+	Elf64_Word	sh_name;	/* section name (.shstrtab index) */
+	Elf64_Word	sh_type;	/* section type */
+	Elf64_Xword	sh_flags;	/* section flags */
+	Elf64_Addr	sh_addr;	/* virtual address */
+	Elf64_Off	sh_offset;	/* file offset */
+	Elf64_Xword	sh_size;	/* section size */
+	Elf64_Word	sh_link;	/* link to another */
+	Elf64_Word	sh_info;	/* misc info */
+	Elf64_Xword	sh_addralign;	/* memory alignment */
+	Elf64_Xword	sh_entsize;	/* table entry size */
+} Elf64_Shdr;
+
+/* sh_type */
+#define SHT_NULL	      0		/* Section header table entry unused */
+#define SHT_PROGBITS	      1		/* Program information */
+#define SHT_SYMTAB	      2		/* Symbol table */
+#define SHT_STRTAB	      3		/* String table */
+#define SHT_RELA	      4		/* Relocation information w/ addend */
+#define SHT_HASH	      5		/* Symbol hash table */
+#define SHT_DYNAMIC	      6		/* Dynamic linking information */
+#define SHT_NOTE	      7		/* Auxiliary information */
+#define SHT_NOBITS	      8		/* No space allocated in file image */
+#define SHT_REL		      9		/* Relocation information w/o addend */
+#define SHT_SHLIB	     10		/* Reserved, unspecified semantics */
+#define SHT_DYNSYM	     11		/* Symbol table for dynamic linker */
+#define SHT_INIT_ARRAY	     14		/* Initialization function pointers */
+#define SHT_FINI_ARRAY	     15		/* Termination function pointers */
+#define SHT_PREINIT_ARRAY    16		/* Pre-initialization function ptrs */
+#define SHT_GROUP	     17		/* Section group */
+#define SHT_SYMTAB_SHNDX     18		/* Section indexes (see SHN_XINDEX) */
+#define SHT_NUM		     19
+
+#define SHT_LOOS	     0x60000000 /* Operating system specific range */
+#define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700   /* GNU incremental build data */
+#define	SHT_LOSUNW	     0x6ffffff4
+#define	SHT_SUNW_dof	     0x6ffffff4
+#define	SHT_GNU_ATTRIBUTES   0x6ffffff5	/* GNU object attributes */
+#define	SHT_SUNW_cap	     0x6ffffff5
+#define	SHT_SUNW_SIGNATURE   0x6ffffff6
+#define SHT_GNU_HASH	     0x6ffffff6 /* GNU style symbol hash table */
+#define SHT_GNU_LIBLIST	     0x6ffffff7 /* GNU list of prelink dependencies */
+#define SHT_SUNW_move	     0x6ffffffa
+#define	SHT_SUNW_COMDAT	     0x6ffffffb
+#define SHT_SUNW_syminfo     0x6ffffffc
+#define SHT_SUNW_verdef	     0x6ffffffd /* Versions defined by file */
+#define SHT_GNU_verdef	     SHT_SUNW_verdef
+#define SHT_SUNW_verneed     0x6ffffffe /* Versions needed by file */
+#define SHT_GNU_verneed	     SHT_SUNW_verneed
+#define SHT_SUNW_versym	     0x6fffffff /* Symbol versions */
+#define SHT_GNU_versym	     SHT_SUNW_versym
+#define	SHT_HISUNW	     0x6fffffff
+#define SHT_HIOS	     0x6fffffff
+#define SHT_LOPROC	     0x70000000 /* Processor-specific range */
+#define SHT_AMD64_UNWIND     0x70000001 /* unwind information */
+#define SHT_ARM_EXIDX	     0x70000001	/* exception index table */
+#define SHT_ARM_PREEMPTMAP   0x70000002 /* BPABI DLL dynamic linking 
+					 * pre-emption map */
+#define SHT_ARM_ATTRIBUTES   0x70000003 /* Object file compatibility 
+					 * attributes */
+#define SHT_ARM_DEBUGOVERLAY 0x70000004 /* See DBGOVL for details */
+#define SHT_ARM_OVERLAYSECTION 0x70000005
+#define	SHT_MIPS_REGINFO     0x70000006
+#define	SHT_MIPS_OPTIONS     0x7000000d
+#define	SHT_MIPS_DWARF	     0x7000001e	/* MIPS gcc uses MIPS_DWARF */
+#define SHT_HIPROC	     0x7fffffff
+#define SHT_LOUSER	     0x80000000 /* Application-specific range */
+#define SHT_HIUSER	     0xffffffff
+
+/* sh_flags */
+#define SHF_WRITE	     0x00000001 /* Contains writable data */
+#define SHF_ALLOC	     0x00000002 /* Occupies memory */
+#define SHF_EXECINSTR	     0x00000004 /* Contains executable insns */
+#define SHF_MERGE	     0x00000010 /* Might be merged */
+#define SHF_STRINGS	     0x00000020 /* Contains nul terminated strings */
+#define SHF_INFO_LINK	     0x00000040 /* "sh_info" contains SHT index */
+#define SHF_LINK_ORDER	     0x00000080 /* Preserve order after combining */
+#define SHF_OS_NONCONFORMING 0x00000100 /* OS specific handling required */
+#define SHF_GROUP	     0x00000200 /* Is member of a group */
+#define SHF_TLS		     0x00000400 /* Holds thread-local data */
+#define SHF_MASKOS	     0x0ff00000 /* Operating system specific values */
+#define SHF_MASKPROC	     0xf0000000 /* Processor-specific values */
+#define SHF_ORDERED	     0x40000000 /* Ordering requirement (Solaris) */
+#define SHF_EXCLUDE	     0x80000000 /* Excluded unless unles ref/alloc
+					   (Solaris).*/
+/*
+ * Symbol Table
+ */
+typedef struct {
+	Elf32_Word	st_name;	/* Symbol name (.strtab index) */
+	Elf32_Word	st_value;	/* value of symbol */
+	Elf32_Word	st_size;	/* size of symbol */
+	Elf_Byte	st_info;	/* type / binding attrs */
+	Elf_Byte	st_other;	/* unused */
+	Elf32_Half	st_shndx;	/* section index of symbol */
+} Elf32_Sym;
+
+typedef struct {
+	Elf64_Word	st_name;	/* Symbol name (.strtab index) */
+	Elf_Byte	st_info;	/* type / binding attrs */
+	Elf_Byte	st_other;	/* unused */
+	Elf64_Half	st_shndx;	/* section index of symbol */
+	Elf64_Addr	st_value;	/* value of symbol */
+	Elf64_Xword	st_size;	/* size of symbol */
+} Elf64_Sym;
+
+/* Symbol Table index of the undefined symbol */
+#define ELF_SYM_UNDEFINED	0
+
+#define STN_UNDEF		0	/* undefined index */
+
+/* st_info: Symbol Bindings */
+#define STB_LOCAL		0	/* local symbol */
+#define STB_GLOBAL		1	/* global symbol */
+#define STB_WEAK		2	/* weakly defined global symbol */
+#define STB_NUM			3
+
+#define STB_LOOS		10	/* Operating system specific range */
+#define STB_HIOS		12
+#define STB_LOPROC		13	/* Processor-specific range */
+#define STB_HIPROC		15
+
+/* st_info: Symbol Types */
+#define STT_NOTYPE		0	/* Type not specified */
+#define STT_OBJECT		1	/* Associated with a data object */
+#define STT_FUNC		2	/* Associated with a function */
+#define STT_SECTION		3	/* Associated with a section */
+#define STT_FILE		4	/* Associated with a file name */
+#define STT_COMMON		5	/* Uninitialised common block */
+#define STT_TLS			6	/* Thread local data object */
+#define STT_NUM			7
+
+#define STT_LOOS		10	/* Operating system specific range */
+#define STT_GNU_IFUNC		10	/* GNU extension: indirect function */
+#define STT_HIOS		12
+#define STT_LOPROC		13	/* Processor-specific range */
+#define STT_HIPROC		15
+
+/* st_other: Visibility Types */
+#define STV_DEFAULT		0	/* use binding type */
+#define STV_INTERNAL		1	/* not referenced from outside */
+#define STV_HIDDEN		2	/* not visible, may be used via ptr */
+#define STV_PROTECTED		3	/* visible, not preemptible */
+#define STV_EXPORTED		4
+#define STV_SINGLETON		5
+#define STV_ELIMINATE		6
+
+/* st_info/st_other utility macros */
+#define ELF_ST_BIND(info)		((uint32_t)(info) >> 4)
+#define ELF_ST_TYPE(info)		((uint32_t)(info) & 0xf)
+#define ELF_ST_INFO(bind,type)		((Elf_Byte)(((bind) << 4) | \
+					 ((type) & 0xf)))
+#define ELF_ST_VISIBILITY(other)	((uint32_t)(other) & 3)
+
+/*
+ * Special section indexes
+ */
+#define SHN_UNDEF	0		/* Undefined section */
+
+#define SHN_LORESERVE	0xff00		/* Reserved range */
+#define SHN_ABS		0xfff1		/*  Absolute symbols */
+#define SHN_COMMON	0xfff2		/*  Common symbols */
+#define SHN_XINDEX	0xffff		/* Escape -- index stored elsewhere */
+#define SHN_HIRESERVE	0xffff
+
+#define SHN_LOPROC	0xff00		/* Processor-specific range */
+#define SHN_HIPROC	0xff1f
+#define SHN_LOOS	0xff20		/* Operating system specific range */
+#define SHN_HIOS	0xff3f
+
+#define SHN_MIPS_ACOMMON 0xff00
+#define SHN_MIPS_TEXT	0xff01
+#define SHN_MIPS_DATA	0xff02
+#define SHN_MIPS_SCOMMON 0xff03
+
+/*
+ * Relocation Entries
+ */
+typedef struct {
+	Elf32_Word	r_offset;	/* where to do it */
+	Elf32_Word	r_info;		/* index & type of relocation */
+} Elf32_Rel;
+
+typedef struct {
+	Elf32_Word	r_offset;	/* where to do it */
+	Elf32_Word	r_info;		/* index & type of relocation */
+	Elf32_Sword	r_addend;	/* adjustment value */
+} Elf32_Rela;
+
+/* r_info utility macros */
+#define ELF32_R_SYM(info)	((info) >> 8)
+#define ELF32_R_TYPE(info)	((info) & 0xff)
+#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
+
+typedef struct {
+	Elf64_Addr	r_offset;	/* where to do it */
+	Elf64_Xword	r_info;		/* index & type of relocation */
+} Elf64_Rel;
+
+typedef struct {
+	Elf64_Addr	r_offset;	/* where to do it */
+	Elf64_Xword	r_info;		/* index & type of relocation */
+	Elf64_Sxword	r_addend;	/* adjustment value */
+} Elf64_Rela;
+
+/* r_info utility macros */
+#define ELF64_R_SYM(info)	((info) >> 32)
+#define ELF64_R_TYPE(info)	((info) & 0xffffffff)
+#define ELF64_R_INFO(sym,type)	(((sym) << 32) + (type))
+
+/*
+ * Move entries
+ */
+typedef struct {
+	Elf32_Lword	m_value;	/* symbol value */
+	Elf32_Word	m_info;		/* size + index */
+	Elf32_Word	m_poffset;	/* symbol offset */
+	Elf32_Half	m_repeat;	/* repeat count */
+	Elf32_Half	m_stride;	/* stride info */
+} Elf32_Move;
+
+#define ELF32_M_SYM(info)	((info) >> 8)
+#define ELF32_M_SIZE(info)	((info) & 0xff)
+#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size))
+
+typedef struct {
+	Elf64_Lword	m_value;	/* symbol value */
+	Elf64_Xword	m_info;		/* size + index */
+	Elf64_Xword	m_poffset;	/* symbol offset */
+	Elf64_Word	m_repeat;	/* repeat count */
+	Elf64_Word	m_stride;	/* stride info */
+} Elf64_Move;
+
+#define ELF64_M_SYM(info)	((info) >> 8)
+#define ELF64_M_SIZE(info)	((info) & 0xff)
+#define ELF64_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size))
+
+/*
+ * Hardware/software capabilities entry
+ */
+typedef struct {
+	Elf32_Word		c_tag;	/* entry tag value */
+	union {
+		Elf32_Addr	c_ptr;
+		Elf32_Word	c_val;
+	} c_un;
+} Elf32_Cap;
+
+typedef struct {
+	Elf64_Xword		c_tag;	/* entry tag value */
+	union {
+		Elf64_Addr	c_ptr;
+		Elf64_Xword	c_val;
+	} c_un;
+} Elf64_Cap;
+
+/*
+ * Dynamic Section structure array
+ */
+typedef struct {
+	Elf32_Word		d_tag;	/* entry tag value */
+	union {
+		Elf32_Addr	d_ptr;
+		Elf32_Word	d_val;
+	} d_un;
+} Elf32_Dyn;
+
+typedef struct {
+	Elf64_Xword		d_tag;	/* entry tag value */
+	union {
+		Elf64_Addr	d_ptr;
+		Elf64_Xword	d_val;
+	} d_un;
+} Elf64_Dyn;
+
+/* d_tag */
+#define DT_NULL		0	/* Marks end of dynamic array */
+#define DT_NEEDED	1	/* Name of needed library (DT_STRTAB offset) */
+#define DT_PLTRELSZ	2	/* Size, in bytes, of relocations in PLT */
+#define DT_PLTGOT	3	/* Address of PLT and/or GOT */
+#define DT_HASH		4	/* Address of symbol hash table */
+#define DT_STRTAB	5	/* Address of string table */
+#define DT_SYMTAB	6	/* Address of symbol table */
+#define DT_RELA		7	/* Address of Rela relocation table */
+#define DT_RELASZ	8	/* Size, in bytes, of DT_RELA table */
+#define DT_RELAENT	9	/* Size, in bytes, of one DT_RELA entry */
+#define DT_STRSZ	10	/* Size, in bytes, of DT_STRTAB table */
+#define DT_SYMENT	11	/* Size, in bytes, of one DT_SYMTAB entry */
+#define DT_INIT		12	/* Address of initialization function */
+#define DT_FINI		13	/* Address of termination function */
+#define DT_SONAME	14	/* Shared object name (DT_STRTAB offset) */
+#define DT_RPATH	15	/* Library search path (DT_STRTAB offset) */
+#define DT_SYMBOLIC	16	/* Start symbol search within local object */
+#define DT_REL		17	/* Address of Rel relocation table */
+#define DT_RELSZ	18	/* Size, in bytes, of DT_REL table */
+#define DT_RELENT	19	/* Size, in bytes, of one DT_REL entry */
+#define DT_PLTREL	20	/* Type of PLT relocation entries */
+#define DT_DEBUG	21	/* Used for debugging; unspecified */
+#define DT_TEXTREL	22	/* Relocations might modify non-writable seg */
+#define DT_JMPREL	23	/* Address of relocations associated with PLT */
+#define DT_BIND_NOW	24	/* Process all relocations at load-time */
+#define DT_INIT_ARRAY	25	/* Address of initialization function array */
+#define DT_FINI_ARRAY	26	/* Size, in bytes, of DT_INIT_ARRAY array */
+#define DT_INIT_ARRAYSZ 27	/* Address of termination function array */
+#define DT_FINI_ARRAYSZ 28	/* Size, in bytes, of DT_FINI_ARRAY array*/
+#define DT_RUNPATH	29	/* overrides DT_RPATH */
+#define DT_FLAGS	30	/* Encodes ORIGIN, SYMBOLIC, TEXTREL, BIND_NOW, STATIC_TLS */
+#define DT_ENCODING	31	/* ??? */
+#define DT_PREINIT_ARRAY 32	/* Address of pre-init function array */
+#define DT_PREINIT_ARRAYSZ 33	/* Size, in bytes, of DT_PREINIT_ARRAY array */
+#define DT_NUM		34
+
+#define DT_LOOS		0x60000000	/* Operating system specific range */
+#define DT_VERSYM	0x6ffffff0	/* Symbol versions */
+#define DT_FLAGS_1	0x6ffffffb	/* ELF dynamic flags */
+#define DT_VERDEF	0x6ffffffc	/* Versions defined by file */
+#define DT_VERDEFNUM	0x6ffffffd	/* Number of versions defined by file */
+#define DT_VERNEED	0x6ffffffe	/* Versions needed by file */
+#define DT_VERNEEDNUM	0x6fffffff	/* Number of versions needed by file */
+#define DT_HIOS		0x6fffffff
+#define DT_LOPROC	0x70000000	/* Processor-specific range */
+#define DT_HIPROC	0x7fffffff
+
+/* Flag values for DT_FLAGS */
+#define DF_ORIGIN	0x00000001	/* uses $ORIGIN */
+#define DF_SYMBOLIC	0x00000002	/* */
+#define DF_TEXTREL	0x00000004	/* */
+#define DF_BIND_NOW	0x00000008	/* */
+#define DF_STATIC_TLS	0x00000010	/* */
+
+/* Flag values for DT_FLAGS_1 (incomplete) */
+#define DF_1_BIND_NOW	0x00000001	/* Same as DF_BIND_NOW */
+#define DF_1_NODELETE	0x00000008	/* Set the RTLD_NODELETE for object */
+#define DF_1_INITFIRST	0x00000020	/* Object's init/fini take priority */
+#define DF_1_NOOPEN	0x00000040	/* Do not allow loading on dlopen() */
+
+/*
+ * Auxiliary Vectors
+ */
+typedef struct {
+	Elf32_Word	a_type;				/* 32-bit id */
+	Elf32_Word	a_v;				/* 32-bit id */
+} Aux32Info;
+
+typedef struct {
+	Elf64_Word	a_type;		/* 32-bit id */
+	Elf64_Xword	a_v;		/* 64-bit id */
+} Aux64Info;
+
+/* a_type */
+#define AT_NULL		0	/* Marks end of array */
+#define AT_IGNORE	1	/* No meaning, a_un is undefined */
+#define AT_EXECFD	2	/* Open file descriptor of object file */
+#define AT_PHDR		3	/* &phdr[0] */
+#define AT_PHENT	4	/* sizeof(phdr[0]) */
+#define AT_PHNUM	5	/* # phdr entries */
+#define AT_PAGESZ	6	/* PAGESIZE */
+#define AT_BASE		7	/* Interpreter base addr */
+#define AT_FLAGS	8	/* Processor flags */
+#define AT_ENTRY	9	/* Entry address of executable */
+#define AT_DCACHEBSIZE	10	/* Data cache block size */
+#define AT_ICACHEBSIZE	11	/* Instruction cache block size */
+#define AT_UCACHEBSIZE	12	/* Unified cache block size */
+#define AT_STACKBASE	13	/* Base address of the main thread */
+
+	/* Vendor specific */
+#define AT_MIPS_NOTELF	10	/* XXX a_val != 0 -> MIPS XCOFF executable */
+
+#define AT_EUID		2000	/* euid (solaris compatible numbers) */
+#define AT_RUID		2001	/* ruid (solaris compatible numbers) */
+#define AT_EGID		2002	/* egid (solaris compatible numbers) */
+#define AT_RGID		2003	/* rgid (solaris compatible numbers) */
+
+	/* Solaris kernel specific */
+#define AT_SUN_LDELF	2004	/* dynamic linker's ELF header */
+#define AT_SUN_LDSHDR	2005	/* dynamic linker's section header */
+#define AT_SUN_LDNAME	2006	/* dynamic linker's name */
+#define AT_SUN_LPGSIZE	2007	/* large pagesize */
+
+	/* Other information */
+#define AT_SUN_PLATFORM 2008	/* sysinfo(SI_PLATFORM) */
+#define AT_SUN_HWCAP	2009	/* process hardware capabilities */
+#define AT_SUN_IFLUSH	2010	/* do we need to flush the instruction cache? */
+#define AT_SUN_CPU	2011	/* CPU name */
+	/* ibcs2 emulation band aid */
+#define AT_SUN_EMUL_ENTRY 2012	/* coff entry point */
+#define AT_SUN_EMUL_EXECFD 2013 /* coff file descriptor */
+	/* Executable's fully resolved name */
+#define AT_SUN_EXECNAME 2014
+
+/*
+ * The header for GNU-style hash sections.
+ */
+typedef struct {
+	uint32_t	gh_nbuckets;	/* Number of hash buckets. */
+	uint32_t	gh_symndx;	/* First visible symbol in .dynsym. */
+	uint32_t	gh_maskwords;	/* #maskwords used in bloom filter. */
+	uint32_t	gh_shift2;	/* Bloom filter shift count. */
+} Elf_GNU_Hash_Header;
+
+/*
+ * Note Headers
+ */
+typedef struct {
+	Elf32_Word n_namesz;
+	Elf32_Word n_descsz;
+	Elf32_Word n_type;
+} Elf32_Nhdr;
+
+typedef struct {
+	Elf64_Word n_namesz;
+	Elf64_Word n_descsz;
+	Elf64_Word n_type;
+} Elf64_Nhdr;
+
+#define ELF_NOTE_GNU_NAMESZ		4
+#define ELF_NOTE_GNU_NAME		"GNU\0"
+
+/*
+ * GNU-specific note type: ABI tag
+ * name: GNU\0
+ * namesz: 4
+ * desc:
+ *	word[0]: OS tag
+ *	word[1]: major version
+ *	word[2]: minor version
+ *	word[3]: teeny version
+ * descsz: 16
+ */
+/* GNU-specific note name and description sizes */
+#define ELF_NOTE_TYPE_ABI_TAG		1
+#define ELF_NOTE_ABI_NAME		ELF_NOTE_GNU_NAME
+#define ELF_NOTE_ABI_NAMESZ		ELF_NOTE_GNU_NAMESZ
+#define ELF_NOTE_ABI_DESCSZ		16
+/* GNU-specific OS/version value stuff */
+#define ELF_NOTE_ABI_OS_LINUX		0
+#define ELF_NOTE_ABI_OS_HURD		1
+#define ELF_NOTE_ABI_OS_SOLARIS		2
+#define ELF_NOTE_ABI_OS_KFREEBSD	3
+#define ELF_NOTE_ABI_OS_KNETBSD		4
+
+/*
+ * GNU-specific note type: Hardware capabilities
+ * name: GNU\0
+ * namesz: 4
+ * desc:
+ *	word[0]: Number of entries
+ *	word[1]: Bitmask of enabled entries
+ *	Followed by a byte id, and a NUL terminated string per entry
+ * descsz: variable
+ */
+#define ELF_NOTE_TYPE_GNU_HWCAP		2
+
+/*
+ * GNU-specific note type: Build ID generated by ld
+ * name: GNU\0
+ * desc:
+ *	word[0..4] SHA1 [default] 
+ * or
+ *	word[0..3] md5 or uuid
+ * descsz: 16 or 20
+ */
+#define ELF_NOTE_TYPE_GNU_BUILD_ID	3
+
+/* SuSE-specific note type: ABI
+ * name: SuSE\0
+ * namesz: 5
+ * desc:
+ *	half[0] = MMmm
+ *
+ *	M = product major version
+ *	m = product minor version
+ * descsz: 2
+ */
+#define ELF_NOTE_TYPE_SUSE_TAG	1
+/* SuSE-specific note name and description sizes */
+#define ELF_NOTE_SUSE_NAMESZ	5
+#define ELF_NOTE_SUSE_DESCSZ	2
+/* SuSE-specific note name */
+#define ELF_NOTE_SUSE_NAME		"SuSE\0"
+
+/* SuSE-specific note type: version
+ * name: SuSE\0\0\0\0
+ * namesz: 8
+ * desc: 
+ *	word[0] = VVTTMMmm
+ *
+ *	V = version of following data
+ *	T = product type: [box, sles, nld, whatever]
+ *	M = product major version
+ *	m = product minor version
+ * descsz: 8
+ */
+#define ELF_NOTE_TYPE_SUSE_VERSION_TAG	0x45537553	/* SuSE in LE */
+/* SuSE-specific note name and description sizes */
+#define ELF_NOTE_SUSE_VERSION_NAMESZ	8
+#define ELF_NOTE_SUSE_VERSION_DESCSZ	8
+/* SuSE-specific note name */
+#define ELF_NOTE_SUSE_VERSION_NAME		"SuSE\0\0\0\0"
+
+/* NetBSD-specific note type: Emulation name.
+ * name: NetBSD\0\0
+ * namesz: 8
+ * desc: 
+ *	word[0]: MMmmrrpp00
+ *
+ *	M = major version
+ *	m = minor version
+ *	r = release ["",A-Z,Z[A-Z] but numeric]
+ *	p = patchlevel
+ * descsz: 4
+ */
+#define ELF_NOTE_TYPE_NETBSD_TAG	1
+#if defined(__minix)
+/* NetBSD-specific note name and description sizes */
+#define ELF_NOTE_NETBSD_NAMESZ		7
+#define ELF_NOTE_NETBSD_DESCSZ		4
+/* NetBSD-specific note name */
+#define ELF_NOTE_NETBSD_NAME		"NetBSD\0\0"
+#else
+/* MINIX3-specific note name and description sizes */
+#define ELF_NOTE_NETBSD_NAMESZ		6
+#define ELF_NOTE_NETBSD_DESCSZ		4
+#define ELF_NOTE_NETBSD_NAME		"Minix\0\0\0"
+#endif /* defined(__minix) */
+
+/* NetBSD-specific note type: Checksum. 
+ * There should be 1 NOTE per PT_LOAD section.
+ * name: ???
+ * namesz: ???
+ * desc:
+ *	a tuple of <phnum>(16),<chk-type>(16),<chk-value>.
+ * descsz: ???
+ */
+#define ELF_NOTE_TYPE_CHECKSUM_TAG	2
+#define ELF_NOTE_CHECKSUM_CRC32		1
+#define ELF_NOTE_CHECKSUM_MD5		2
+#define ELF_NOTE_CHECKSUM_SHA1		3
+#define ELF_NOTE_CHECKSUM_SHA256	4
+
+/*
+ * NetBSD-specific note type: PaX.
+ * There should be 1 NOTE per executable.
+ * name: PaX\0
+ * namesz: 4
+ * desc:
+ *	word[0]: capability bitmask
+ * descsz: 4
+ */
+#define ELF_NOTE_TYPE_PAX_TAG		3
+#define ELF_NOTE_PAX_MPROTECT		0x01	/* Force enable Mprotect */
+#define ELF_NOTE_PAX_NOMPROTECT		0x02	/* Force disable Mprotect */
+#define ELF_NOTE_PAX_GUARD		0x04	/* Force enable Segvguard */
+#define ELF_NOTE_PAX_NOGUARD		0x08	/* Force disable Segvguard */
+#define ELF_NOTE_PAX_ASLR		0x10	/* Force enable ASLR */
+#define ELF_NOTE_PAX_NOASLR		0x20	/* Force disable ASLR */
+#define ELF_NOTE_PAX_NAMESZ		4
+#define ELF_NOTE_PAX_NAME		"PaX\0"
+#define ELF_NOTE_PAX_DESCSZ		4
+
+/*
+ * NetBSD-specific core file information.
+ *
+ * NetBSD ELF core files use notes to provide information about
+ * the process's state.	 The note name is "NetBSD-CORE" for
+ * information that is global to the process, and "NetBSD-CORE@nn",
+ * where "nn" is the lwpid of the LWP that the information belongs
+ * to (such as register state).
+ *
+ * We use the following note identifiers:
+ *
+ *	ELF_NOTE_NETBSD_CORE_PROCINFO
+ *		Note is a "netbsd_elfcore_procinfo" structure.
+ *
+ * We also use ptrace(2) request numbers (the ones that exist in
+ * machine-dependent space) to identify register info notes.  The
+ * info in such notes is in the same format that ptrace(2) would
+ * export that information.
+ *
+ * Please try to keep the members of this structure nicely aligned,
+ * and if you add elements, add them to the end and bump the version.
+ */
+
+#define ELF_NOTE_NETBSD_CORE_NAME	"NetBSD-CORE"
+
+#define ELF_NOTE_NETBSD_CORE_PROCINFO	1
+
+#define NETBSD_ELFCORE_PROCINFO_VERSION 1
+
+struct netbsd_elfcore_procinfo {
+	/* Version 1 fields start here. */
+	uint32_t	cpi_version;		/* our version */
+	uint32_t	cpi_cpisize;		/* sizeof(this struct) */
+	uint32_t	cpi_signo;		/* killing signal */
+	uint32_t	cpi_sigcode;		/* signal code */
+	uint32_t	cpi_sigpend[4];		/* pending signals */
+	uint32_t	cpi_sigmask[4];		/* blocked signals */
+	uint32_t	cpi_sigignore[4];	/* ignored signals */
+	uint32_t	cpi_sigcatch[4];	/* caught signals */
+	int32_t		cpi_pid;		/* process ID */
+	int32_t		cpi_ppid;		/* parent process ID */
+	int32_t		cpi_pgrp;		/* process group ID */
+	int32_t		cpi_sid;		/* session ID */
+	uint32_t	cpi_ruid;		/* real user ID */
+	uint32_t	cpi_euid;		/* effective user ID */
+	uint32_t	cpi_svuid;		/* saved user ID */
+	uint32_t	cpi_rgid;		/* real group ID */
+	uint32_t	cpi_egid;		/* effective group ID */
+	uint32_t	cpi_svgid;		/* saved group ID */
+	uint32_t	cpi_nlwps;		/* number of LWPs */
+	int8_t		cpi_name[32];		/* copy of p->p_comm */
+	/* Add version 2 fields below here. */
+	int32_t		cpi_siglwp;	/* LWP target of killing signal */
+};
+
+/*
+ * NetBSD-specific note type: MACHINE_ARCH.
+ * There should be 1 NOTE per executable.
+ * name:	NetBSD\0
+ * namesz:	7
+ * desc:	string
+ * descsz:	variable
+ */
+#define ELF_NOTE_TYPE_MARCH_TAG		5
+/* NetBSD-specific note name and description sizes */
+#define ELF_NOTE_MARCH_NAMESZ		ELF_NOTE_NETBSD_NAMESZ
+/* NetBSD-specific note name */
+#define ELF_NOTE_MARCH_NAME		ELF_NOTE_NETBSD_NAME
+
+/*
+ * NetBSD-specific note type: MCMODEL
+ * There should be 1 NOTE per executable.
+ * name:	NetBSD\0
+ * namesz:	7
+ * code model:	string
+ */
+
+#define ELF_NOTE_TYPE_MCMODEL_TAG	6
+/* NetBSD-specific note name and description sizes */
+#define ELF_NOTE_MCMODEL_NAMESZ		ELF_NOTE_NETBSD_NAMESZ
+/* NetBSD-specific note name */
+#define ELF_NOTE_MCMODEL_NAME		ELF_NOTE_NETBSD_NAME
+
+
+#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
+#define ELFSIZE ARCH_ELFSIZE
+#endif
+
+#if defined(ELFSIZE)
+#define CONCAT(x,y)	__CONCAT(x,y)
+#define ELFNAME(x)	CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
+#define ELFNAME2(x,y)	CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
+#define ELFNAMEEND(x)	CONCAT(x,CONCAT(_elf,ELFSIZE))
+#define ELFDEFNNAME(x)	CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
+#endif
+
+#if defined(ELFSIZE) && (ELFSIZE == 32)
+#define Elf_Ehdr	Elf32_Ehdr
+#define Elf_Phdr	Elf32_Phdr
+#define Elf_Shdr	Elf32_Shdr
+#define Elf_Sym		Elf32_Sym
+#define Elf_Rel		Elf32_Rel
+#define Elf_Rela	Elf32_Rela
+#define Elf_Dyn		Elf32_Dyn
+#define Elf_Word	Elf32_Word
+#define Elf_Sword	Elf32_Sword
+#define Elf_Half	Elf32_Half
+#define Elf_Addr	Elf32_Addr
+#define Elf_Off		Elf32_Off
+#define Elf_SOff	Elf32_SOff
+#define Elf_Nhdr	Elf32_Nhdr
+#define Elf_Verdef	Elf32_Verdef
+#define Elf_Verdaux	Elf32_Verdaux
+#define Elf_Verneed	Elf32_Verneed
+#define Elf_Vernaux	Elf32_Vernaux
+#define Elf_Versym	Elf32_Versym
+
+#define ELF_R_SYM	ELF32_R_SYM
+#define ELF_R_TYPE	ELF32_R_TYPE
+#define ELFCLASS	ELFCLASS32
+
+#define AuxInfo		Aux32Info
+#elif defined(ELFSIZE) && (ELFSIZE == 64)
+#define Elf_Ehdr	Elf64_Ehdr
+#define Elf_Phdr	Elf64_Phdr
+#define Elf_Shdr	Elf64_Shdr
+#define Elf_Sym		Elf64_Sym
+#define Elf_Rel		Elf64_Rel
+#define Elf_Rela	Elf64_Rela
+#define Elf_Dyn		Elf64_Dyn
+#define Elf_Word	Elf64_Word
+#define Elf_Sword	Elf64_Sword
+#define Elf_Half	Elf64_Half
+#define Elf_Addr	Elf64_Addr
+#define Elf_Off		Elf64_Off
+#define Elf_SOff	Elf64_SOff
+#define Elf_Nhdr	Elf64_Nhdr
+#define Elf_Verdef	Elf64_Verdef
+#define Elf_Verdaux	Elf64_Verdaux
+#define Elf_Verneed	Elf64_Verneed
+#define Elf_Vernaux	Elf64_Vernaux
+#define Elf_Versym	Elf64_Versym
+
+#define ELF_R_SYM	ELF64_R_SYM
+#define ELF_R_TYPE	ELF64_R_TYPE
+#define ELFCLASS	ELFCLASS64
+
+#define AuxInfo		Aux64Info
+#endif
+
+#ifndef Elf_Symindx
+#define Elf_Symindx	uint32_t
+#endif
+
+#define ELF32_ST_BIND(info)		ELF_ST_BIND(info)
+#define ELF32_ST_TYPE(info)		ELF_ST_TYPE(info)
+#define ELF32_ST_INFO(bind,type)	ELF_ST_INFO(bind,type)
+#define ELF32_ST_VISIBILITY(other)	ELF_ST_VISIBILITY(other)
+
+#define ELF64_ST_BIND(info)		ELF_ST_BIND(info)
+#define ELF64_ST_TYPE(info)		ELF_ST_TYPE(info)
+#define ELF64_ST_INFO(bind,type)	ELF_ST_INFO(bind,type)
+#define ELF64_ST_VISIBILITY(other)	ELF_ST_VISIBILITY(other)
+
+typedef struct {
+	Elf32_Half	si_boundto;	/* direct bindings - symbol bound to */
+	Elf32_Half	si_flags;	/* per symbol flags */
+} Elf32_Syminfo;
+
+typedef struct {
+	Elf64_Word	si_boundto;	/* direct bindings - symbol bound to */
+	Elf64_Word	si_flags;	/* per symbol flags */
+} Elf64_Syminfo;
+
+#define SYMINFO_FLG_DIRECT	0x0001	/* symbol ref has direct association
+					   to object containing definition */
+#define SYMINFO_FLG_PASSTHRU	0x0002	/* ignored - see SYMINFO_FLG_FILTER */
+#define SYMINFO_FLG_COPY	0x0004	/* symbol is a copy-reloc */
+#define SYMINFO_FLG_LAZYLOAD	0x0008	/* object containing defn should be
+					   lazily-loaded */
+#define SYMINFO_FLG_DIRECTBIND	0x0010	/* ref should be bound directly to
+					   object containing definition */
+#define SYMINFO_FLG_NOEXTDIRECT 0x0020	/* don't let an external reference
+					   directly bind to this symbol */
+#define SYMINFO_FLG_FILTER	0x0002	/* symbol ref is associated to a */
+#define SYMINFO_FLG_AUXILIARY	0x0040	/*	standard or auxiliary filter */
+
+#define SYMINFO_BT_SELF		0xffff	/* symbol bound to self */
+#define SYMINFO_BT_PARENT	0xfffe	/* symbol bound to parent */
+#define SYMINFO_BT_NONE		0xfffd	/* no special symbol binding */
+#define SYMINFO_BT_EXTERN	0xfffc	/* symbol defined as external */
+#define SYMINFO_BT_LOWRESERVE	0xff00	/* beginning of reserved entries */
+
+#define SYMINFO_NONE		0	/* Syminfo version */
+#define SYMINFO_CURRENT		1
+#define SYMINFO_NUM		2
+
+/*
+ * These constants are used for Elf32_Verdef struct's version number.  
+ */
+#define VER_DEF_NONE		0
+#define VER_DEF_CURRENT		1
+
+/*
+ * These constants are used for Elf32_Verdef struct's vd_ndx.
+ */
+#define VER_DEF_IDX(x)		VER_NDX(x)
+
+/*
+ * These constants are used for Elf32_Verdef struct's vd_flags.	 
+ */
+#define VER_FLG_BASE		0x1
+#define VER_FLG_WEAK		0x2
+
+/*
+ * These are used in an Elf32_Versym field.
+ */
+#define VER_NDX_LOCAL		0
+#define VER_NDX_GLOBAL		1
+#define VER_NDX_GIVEN		2
+
+/*
+ * These constants are used for Elf32_Verneed struct's version number.	
+ */
+#define VER_NEED_NONE		0
+#define VER_NEED_CURRENT	1
+
+/*
+ * These constants are used for Elf32_Vernaux struct's vna_other.
+ */
+#define VER_NEED_HIDDEN		VER_NDX_HIDDEN
+#define VER_NEED_IDX(x)		VER_NDX(x)
+
+/* index */
+#define VER_NDX_HIDDEN		0x8000
+#define VER_NDX(x)		((x) & ~VER_NDX_HIDDEN)
+
+/*
+ * GNU Extension hidding symbol
+ */
+#define VERSYM_HIDDEN		0x8000
+#define VERSYM_VERSION		0x7fff
+
+#define ELF_VER_CHR		'@'
+
+/*
+ * These are current size independent.
+ */
+
+typedef struct {
+	Elf32_Half	vd_version;	/* version number of structure */
+	Elf32_Half	vd_flags;	/* flags (VER_FLG_*) */
+	Elf32_Half	vd_ndx;		/* version index */
+	Elf32_Half	vd_cnt;		/* number of verdaux entries */
+	Elf32_Word	vd_hash;	/* hash of name */
+	Elf32_Word	vd_aux;		/* offset to verdaux entries */
+	Elf32_Word	vd_next;	/* offset to next verdef */
+} Elf32_Verdef;
+typedef Elf32_Verdef	Elf64_Verdef;
+
+typedef struct {
+	Elf32_Word	vda_name;	/* string table offset of name */
+	Elf32_Word	vda_next;	/* offset to verdaux */
+} Elf32_Verdaux;
+typedef Elf32_Verdaux	Elf64_Verdaux;
+
+typedef struct {
+	Elf32_Half	vn_version;	/* version number of structure */
+	Elf32_Half	vn_cnt;		/* number of vernaux entries */
+	Elf32_Word	vn_file;	/* string table offset of library name*/
+	Elf32_Word	vn_aux;		/* offset to vernaux entries */
+	Elf32_Word	vn_next;	/* offset to next verneed */
+} Elf32_Verneed;
+typedef Elf32_Verneed	Elf64_Verneed;
+
+typedef struct {
+	Elf32_Word	vna_hash;	/* Hash of dependency name */
+	Elf32_Half	vna_flags;	/* flags (VER_FLG_*) */
+	Elf32_Half	vna_other;	/* unused */
+	Elf32_Word	vna_name;	/* string table offset to version name*/
+	Elf32_Word	vna_next;	/* offset to next vernaux */
+} Elf32_Vernaux;
+typedef Elf32_Vernaux	Elf64_Vernaux;
+
+typedef struct {
+	Elf32_Half	vs_vers;
+} Elf32_Versym;
+typedef Elf32_Versym	Elf64_Versym;
+
+#ifdef _KERNEL
+
+/*
+ * Arbitrary limits to avoid DoS for excessive memory allocation.
+ */
+#define ELF_MAXPHNUM	128
+#define ELF_MAXSHNUM	32768
+#define ELF_MAXNOTESIZE	1024
+
+#define ELF_AUX_ENTRIES 15	/* Max size of aux array passed to loader */
+#define ELF32_NO_ADDR	(~(Elf32_Addr)0) /* Indicates addr. not yet filled in */
+#define ELF32_LINK_ADDR ((Elf32_Addr)-2) /* advises to use link address */
+#define ELF64_NO_ADDR	(~(Elf64_Addr)0) /* Indicates addr. not yet filled in */
+#define ELF64_LINK_ADDR ((Elf64_Addr)-2) /* advises to use link address */
+
+#if defined(ELFSIZE) && (ELFSIZE == 64)
+#define ELF_NO_ADDR	ELF64_NO_ADDR
+#define ELF_LINK_ADDR	ELF64_LINK_ADDR
+#elif defined(ELFSIZE) && (ELFSIZE == 32)
+#define ELF_NO_ADDR	ELF32_NO_ADDR
+#define ELF_LINK_ADDR	ELF32_LINK_ADDR
+#endif
+
+#ifndef ELF32_EHDR_FLAGS_OK
+#define ELF32_EHDR_FLAGS_OK(eh) 1
+#endif
+
+#ifndef ELF64_EHDR_FLAGS_OK
+#define ELF64_EHDR_FLAGS_OK(eh) 1
+#endif
+
+#if defined(ELFSIZE) && (ELFSIZE == 64)
+#define ELF_EHDR_FLAGS_OK(eh)	ELF64_EHDR_FLAGS_OK(eh)
+#else
+#define ELF_EHDR_FLAGS_OK(eh)	ELF32_EHDR_FLAGS_OK(eh)
+#endif
+
+#if defined(ELFSIZE)
+struct elf_args {
+	Elf_Addr	arg_entry;	/* program entry point */
+	Elf_Addr	arg_interp;	/* Interpreter load address */
+	Elf_Addr	arg_phaddr;	/* program header address */
+	Elf_Addr	arg_phentsize;	/* Size of program header */
+	Elf_Addr	arg_phnum;	/* Number of program headers */
+};
+#endif
+
+#ifdef _KERNEL_OPT
+#include "opt_execfmt.h"
+#endif
+
+struct ps_strings;
+struct coredump_iostate;
+struct note_state;
+struct exec_package;
+
+#ifdef EXEC_ELF32
+int	exec_elf32_makecmds(struct lwp *, struct exec_package *);
+int	elf32_copyargs(struct lwp *, struct exec_package *,
+    struct ps_strings *, char **, void *);
+
+int	coredump_elf32(struct lwp *, struct coredump_iostate *);
+void	coredump_savenote_elf32(struct note_state *, unsigned int,
+	    const char *, void *, size_t);
+
+int	elf32_check_header(Elf32_Ehdr *);
+#endif
+
+#ifdef EXEC_ELF64
+int	exec_elf64_makecmds(struct lwp *, struct exec_package *);
+int	elf64_copyargs(struct lwp *, struct exec_package *,
+    struct ps_strings *, char **, void *);
+
+int	coredump_elf64(struct lwp *, struct coredump_iostate *);
+void	coredump_savenote_elf64(struct note_state *, unsigned int,
+	    const char *, void *, size_t);
+
+int	elf64_check_header(Elf64_Ehdr *);
+#endif
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_EXEC_ELF_H_ */

Property changes on: lab4/.minix-src/include/sys/exec_elf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/kbdio.h
===================================================================
--- lab4/.minix-src/include/sys/kbdio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/kbdio.h	(revision 13)
@@ -0,0 +1,22 @@
+#ifndef _SYS__KBDIO_H
+#define _SYS__KBDIO_H
+
+#include <sys/time.h>
+
+typedef struct kio_bell
+{
+	unsigned kb_pitch;		/* Bell frequency in HZ */
+	unsigned long kb_volume;	/* Volume in micro volts */
+	struct timeval kb_duration;
+} kio_bell_t;
+
+typedef struct kio_leds
+{
+	unsigned kl_bits;
+} kio_leds_t;
+
+#define KBD_LEDS_NUM	0x1
+#define KBD_LEDS_CAPS	0x2
+#define KBD_LEDS_SCROLL	0x4
+
+#endif /* _SYS__KBDIO_H */

Property changes on: lab4/.minix-src/include/sys/kbdio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/event.h
===================================================================
--- lab4/.minix-src/include/sys/event.h	(nonexistent)
+++ lab4/.minix-src/include/sys/event.h	(revision 13)
@@ -0,0 +1,259 @@
+/*	$NetBSD: event.h,v 1.24 2015/01/14 22:21:00 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	$FreeBSD: src/sys/sys/event.h,v 1.12 2001/02/24 01:44:03 jlemon Exp $
+ */
+
+#ifndef _SYS_EVENT_H_
+#define	_SYS_EVENT_H_
+
+#include <sys/featuretest.h>
+#include <sys/types.h>			/* for size_t */
+#include <sys/inttypes.h>		/* for uintptr_t */
+#include <sys/null.h>			/* for NULL */
+
+#define	EVFILT_READ		0U
+#define	EVFILT_WRITE		1U
+#define	EVFILT_AIO		2U	/* attached to aio requests */
+#define	EVFILT_VNODE		3U	/* attached to vnodes */
+#define	EVFILT_PROC		4U	/* attached to struct proc */
+#define	EVFILT_SIGNAL		5U	/* attached to struct proc */
+#define	EVFILT_TIMER		6U	/* arbitrary timer (in ms) */
+#define	EVFILT_SYSCOUNT		7U	/* number of filters */
+
+#define	EV_SET(kevp, a, b, c, d, e, f)					\
+do {									\
+	(kevp)->ident = (a);						\
+	(kevp)->filter = (b);						\
+	(kevp)->flags = (c);						\
+	(kevp)->fflags = (d);						\
+	(kevp)->data = (e);						\
+	(kevp)->udata = (f);						\
+} while (/* CONSTCOND */ 0)
+
+
+struct kevent {
+	uintptr_t	ident;		/* identifier for this event */
+	uint32_t	filter;		/* filter for event */
+	uint32_t	flags;		/* action flags for kqueue */
+	uint32_t	fflags;		/* filter flag value */
+	int64_t		data;		/* filter data value */
+	intptr_t	udata;		/* opaque user data identifier */
+};
+
+/* actions */
+#define	EV_ADD		0x0001U		/* add event to kq (implies ENABLE) */
+#define	EV_DELETE	0x0002U		/* delete event from kq */
+#define	EV_ENABLE	0x0004U		/* enable event */
+#define	EV_DISABLE	0x0008U		/* disable event (not reported) */
+
+/* flags */
+#define	EV_ONESHOT	0x0010U		/* only report one occurrence */
+#define	EV_CLEAR	0x0020U		/* clear event state after reporting */
+
+#define	EV_SYSFLAGS	0xF000U		/* reserved by system */
+#define	EV_FLAG1	0x2000U		/* filter-specific flag */
+
+/* returned values */
+#define	EV_EOF		0x8000U		/* EOF detected */
+#define	EV_ERROR	0x4000U		/* error, data contains errno */
+
+/*
+ * hint flag for in-kernel use - must not equal any existing note
+ */
+#ifdef _KERNEL
+#define NOTE_SUBMIT	0x01000000U		/* initial knote submission */
+#endif
+/*
+ * data/hint flags for EVFILT_{READ|WRITE}, shared with userspace
+ */
+#define	NOTE_LOWAT	0x0001U			/* low water mark */
+
+/*
+ * data/hint flags for EVFILT_VNODE, shared with userspace
+ */
+#define	NOTE_DELETE	0x0001U			/* vnode was removed */
+#define	NOTE_WRITE	0x0002U			/* data contents changed */
+#define	NOTE_EXTEND	0x0004U			/* size increased */
+#define	NOTE_ATTRIB	0x0008U			/* attributes changed */
+#define	NOTE_LINK	0x0010U			/* link count changed */
+#define	NOTE_RENAME	0x0020U			/* vnode was renamed */
+#define	NOTE_REVOKE	0x0040U			/* vnode access was revoked */
+
+/*
+ * data/hint flags for EVFILT_PROC, shared with userspace
+ */
+#define	NOTE_EXIT	0x80000000U		/* process exited */
+#define	NOTE_FORK	0x40000000U		/* process forked */
+#define	NOTE_EXEC	0x20000000U		/* process exec'd */
+#define	NOTE_PCTRLMASK	0xf0000000U		/* mask for hint bits */
+#define	NOTE_PDATAMASK	0x000fffffU		/* mask for pid */
+
+/* additional flags for EVFILT_PROC */
+#define	NOTE_TRACK	0x00000001U		/* follow across forks */
+#define	NOTE_TRACKERR	0x00000002U		/* could not track child */
+#define	NOTE_CHILD	0x00000004U		/* am a child process */
+
+/*
+ * This is currently visible to userland to work around broken
+ * programs which pull in <sys/proc.h> or <sys/select.h>.
+ */
+#include <sys/queue.h>
+struct knote;
+SLIST_HEAD(klist, knote);
+
+
+/*
+ * ioctl(2)s supported on kqueue descriptors.
+ */
+#include <sys/ioctl.h>
+
+struct kfilter_mapping {
+	char		*name;		/* name to lookup or return */
+	size_t		len;		/* length of name */
+	uint32_t	filter;		/* filter to lookup or return */
+};
+
+/* map filter to name (max size len) */
+#define KFILTER_BYFILTER	_IOWR('k', 0, struct kfilter_mapping)
+/* map name to filter (len ignored) */
+#define KFILTER_BYNAME		_IOWR('k', 1, struct kfilter_mapping)
+
+#ifdef _KERNEL
+
+#define	KNOTE(list, hint)	if (!SLIST_EMPTY(list)) knote(list, hint)
+
+/*
+ * Flag indicating hint is a signal.  Used by EVFILT_SIGNAL, and also
+ * shared by EVFILT_PROC  (all knotes attached to p->p_klist)
+ */
+#define	NOTE_SIGNAL	0x08000000U
+
+/*
+ * Callback methods for each filter type.
+ */
+struct filterops {
+	int	f_isfd;			/* true if ident == filedescriptor */
+	int	(*f_attach)	(struct knote *);
+					/* called when knote is ADDed */
+	void	(*f_detach)	(struct knote *);
+					/* called when knote is DELETEd */
+	int	(*f_event)	(struct knote *, long);
+					/* called when event is triggered */
+};
+
+/*
+ * Field locking:
+ *
+ * f	kn_kq->kq_fdp->fd_lock
+ * q	kn_kq->kq_lock
+ * o	object mutex (e.g. device driver or vnode interlock)
+ */
+struct kfilter;
+
+struct knote {
+	SLIST_ENTRY(knote)	kn_link;	/* f: for fd */
+	SLIST_ENTRY(knote)	kn_selnext;	/* o: for struct selinfo */
+	TAILQ_ENTRY(knote)	kn_tqe;		/* q: for struct kqueue */
+	struct kqueue		*kn_kq;		/* q: which queue we are on */
+	struct kevent		kn_kevent;
+	uint32_t		kn_status;
+	uint32_t		kn_sfflags;	/*   saved filter flags */
+	uintptr_t		kn_sdata;	/*   saved data field */
+	void			*kn_obj;	/*   pointer to monitored obj */
+	const struct filterops	*kn_fop;
+	struct kfilter		*kn_kfilter;
+	void 			*kn_hook;
+
+#define	KN_ACTIVE	0x01U			/* event has been triggered */
+#define	KN_QUEUED	0x02U			/* event is on queue */
+#define	KN_DISABLED	0x04U			/* event is disabled */
+#define	KN_DETACHED	0x08U			/* knote is detached */
+#define	KN_MARKER	0x10U			/* is a marker */
+
+#define	kn_id		kn_kevent.ident
+#define	kn_filter	kn_kevent.filter
+#define	kn_flags	kn_kevent.flags
+#define	kn_fflags	kn_kevent.fflags
+#define	kn_data		kn_kevent.data
+};
+
+#include <sys/systm.h> /* for copyin_t */
+
+struct lwp;
+struct timespec;
+
+void	kqueue_init(void);
+void	knote(struct klist *, long);
+void	knote_fdclose(int);
+
+typedef	int (*kevent_fetch_changes_t)(void *, const struct kevent *,
+    struct kevent *, size_t, int);
+typedef	int (*kevent_put_events_t)(void *, struct kevent *, struct kevent *,
+    size_t, int);
+
+struct kevent_ops {
+	void *keo_private;
+	copyin_t keo_fetch_timeout;
+	kevent_fetch_changes_t keo_fetch_changes;
+	kevent_put_events_t keo_put_events;
+};
+
+
+int	kevent_fetch_changes(void *, const struct kevent *, struct kevent *,
+    size_t, int);
+int 	kevent_put_events(void *, struct kevent *, struct kevent *, size_t,
+    int);
+int	kevent1(register_t *, int, const struct kevent *,
+    size_t, struct kevent *, size_t, const struct timespec *,
+    const struct kevent_ops *);
+
+int	kfilter_register(const char *, const struct filterops *, int *);
+int	kfilter_unregister(const char *);
+
+int	filt_seltrue(struct knote *, long);
+extern const struct filterops seltrue_filtops;
+
+#else 	/* !_KERNEL */
+
+#include <sys/cdefs.h>
+struct timespec;
+
+__BEGIN_DECLS
+#if defined(_NETBSD_SOURCE)
+int	kqueue(void);
+int	kqueue1(int);
+#ifndef __LIBC12_SOURCE__
+int	kevent(int, const struct kevent *, size_t, struct kevent *, size_t,
+		    const struct timespec *) __RENAME(__kevent50);
+#endif
+#endif /* !_POSIX_C_SOURCE */
+__END_DECLS
+
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_EVENT_H_ */

Property changes on: lab4/.minix-src/include/sys/event.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/exec_coff.h
===================================================================
--- lab4/.minix-src/include/sys/exec_coff.h	(nonexistent)
+++ lab4/.minix-src/include/sys/exec_coff.h	(revision 13)
@@ -0,0 +1,156 @@
+/* $NetBSD: exec_coff.h,v 1.7 2005/12/11 12:25:20 christos Exp $ */
+
+/*-
+ * Copyright (C) 2000 SAITOH Masanobu.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+#ifndef _SYS_EXEC_COFF_H_
+#define _SYS_EXEC_COFF_H_
+
+#include <machine/coff_machdep.h>
+
+/*
+ * COFF file header
+ */
+
+struct coff_filehdr {
+	u_short	f_magic;	/* magic number */
+	u_short	f_nscns;	/* # of sections */
+	long	f_timdat;	/* timestamp */
+	long	f_symptr;	/* file offset of symbol table */
+	long	f_nsyms;	/* # of symbol table entries */
+	u_short	f_opthdr;	/* size of optional header */
+	u_short	f_flags;	/* flags */
+};
+
+/* f_flags */
+#define COFF_F_RELFLG	0x1
+#define COFF_F_EXEC	0x2
+#define COFF_F_LNNO	0x4
+#define COFF_F_LSYMS	0x8
+#define COFF_F_SWABD	0x40
+#define COFF_F_AR16WR	0x80
+#define COFF_F_AR32WR	0x100
+#define COFF_F_AR32W	0x200
+
+/*
+ * COFF system header
+ */
+
+struct coff_aouthdr {
+	short	a_magic;
+	short	a_vstamp;
+	long	a_tsize;
+	long	a_dsize;
+	long	a_bsize;
+	long	a_entry;
+	long	a_tstart;
+	long	a_dstart;
+};
+
+/*
+ * COFF section header
+ */
+
+struct coff_scnhdr {
+	char	s_name[8];
+	long	s_paddr;
+	long	s_vaddr;
+	long	s_size;
+	long	s_scnptr;
+	long	s_relptr;
+	long	s_lnnoptr;
+	u_short	s_nreloc;
+	u_short	s_nlnno;
+	long	s_flags;
+};
+
+/* s_flags */
+#define COFF_STYP_REG		0x00
+#define COFF_STYP_DSECT		0x01
+#define COFF_STYP_NOLOAD	0x02
+#define COFF_STYP_GROUP		0x04
+#define COFF_STYP_PAD		0x08
+#define COFF_STYP_COPY		0x10
+#define COFF_STYP_TEXT		0x20
+#define COFF_STYP_DATA		0x40
+#define COFF_STYP_BSS		0x80
+#define COFF_STYP_INFO		0x200
+#define COFF_STYP_OVER		0x400
+#define COFF_STYP_SHLIB		0x800
+
+/*
+ * COFF shared library header
+ */
+
+struct coff_slhdr {
+	long	entry_len;	/* in words */
+	long	path_index;	/* in words */
+	char	sl_name[1];
+};
+
+struct coff_exechdr {
+	struct coff_filehdr f;
+	struct coff_aouthdr a;
+};
+
+#define COFF_ROUND(val, by)     (((val) + by - 1) & ~(by - 1))
+
+#define COFF_ALIGN(a) ((a) & ~(COFF_LDPGSZ - 1))
+
+#define COFF_HDR_SIZE \
+	(sizeof(struct coff_filehdr) + sizeof(struct coff_aouthdr))
+
+#define COFF_BLOCK_ALIGN(ap, value) \
+        ((ap)->a_magic == COFF_ZMAGIC ? COFF_ROUND(value, COFF_LDPGSZ) : \
+         value)
+
+#define COFF_TXTOFF(fp, ap) \
+        ((ap)->a_magic == COFF_ZMAGIC ? 0 : \
+         COFF_ROUND(COFF_HDR_SIZE + (fp)->f_nscns * \
+		    sizeof(struct coff_scnhdr), \
+		    COFF_SEGMENT_ALIGNMENT(fp, ap)))
+
+#define COFF_DATOFF(fp, ap) \
+        (COFF_BLOCK_ALIGN(ap, COFF_TXTOFF(fp, ap) + (ap)->a_tsize))
+
+#define COFF_SEGMENT_ALIGN(fp, ap, value) \
+        (COFF_ROUND(value, ((ap)->a_magic == COFF_ZMAGIC ? COFF_LDPGSZ : \
+         COFF_SEGMENT_ALIGNMENT(fp, ap))))
+
+#ifdef _KERNEL
+int     exec_coff_makecmds(struct lwp *, struct exec_package *);
+
+int	exec_coff_prep_omagic(struct lwp *, struct exec_package *,
+				struct coff_filehdr *,
+				struct coff_aouthdr *);
+int	exec_coff_prep_nmagic(struct lwp *, struct exec_package *,
+				struct coff_filehdr *,
+				struct coff_aouthdr *);
+int	exec_coff_prep_zmagic(struct lwp *, struct exec_package *,
+				struct coff_filehdr *,
+				struct coff_aouthdr *);
+#endif /* _KERNEL */
+#endif /* !_SYS_EXEC_COFF_H_ */

Property changes on: lab4/.minix-src/include/sys/exec_coff.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/kmem.h
===================================================================
--- lab4/.minix-src/include/sys/kmem.h	(nonexistent)
+++ lab4/.minix-src/include/sys/kmem.h	(revision 13)
@@ -0,0 +1,55 @@
+/*	$NetBSD: kmem.h,v 1.9 2012/02/05 03:40:08 rmind Exp $	*/
+
+/*-
+ * Copyright (c)2006 YAMAMOTO Takashi,
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_KMEM_H_
+#define	_SYS_KMEM_H_
+
+#include <sys/types.h>
+
+typedef unsigned int km_flag_t;
+
+void	kmem_init(void);
+size_t	kmem_roundup_size(size_t);
+
+void *	kmem_alloc(size_t, km_flag_t);
+void *	kmem_zalloc(size_t, km_flag_t);
+void	kmem_free(void *, size_t);
+
+void *	kmem_intr_alloc(size_t, km_flag_t);
+void *	kmem_intr_zalloc(size_t, km_flag_t);
+void	kmem_intr_free(void *, size_t);
+
+char *	kmem_asprintf(const char *, ...) __printflike(1, 2);
+
+/*
+ * km_flag_t values:
+ */
+#define	KM_SLEEP	0x00000001	/* can sleep */
+#define	KM_NOSLEEP	0x00000002	/* don't sleep */
+
+#endif /* !_SYS_KMEM_H_ */

Property changes on: lab4/.minix-src/include/sys/kmem.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/exec_ecoff.h
===================================================================
--- lab4/.minix-src/include/sys/exec_ecoff.h	(nonexistent)
+++ lab4/.minix-src/include/sys/exec_ecoff.h	(revision 13)
@@ -0,0 +1,118 @@
+/*	$NetBSD: exec_ecoff.h,v 1.20 2009/12/10 14:13:54 matt Exp $	*/
+
+/*
+ * Copyright (c) 1994 Adam Glass
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Adam Glass.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+#ifndef	_SYS_EXEC_ECOFF_H_
+#define	_SYS_EXEC_ECOFF_H_
+
+#include <machine/ecoff_machdep.h>
+
+struct ecoff_filehdr {
+	u_short f_magic;	/* magic number */
+	u_short f_nscns;	/* # of sections */
+	u_int   f_timdat;	/* time and date stamp */
+	u_long  f_symptr;	/* file offset of symbol table */
+	u_int   f_nsyms;	/* # of symbol table entries */
+	u_short f_opthdr;	/* sizeof the optional header */
+	u_short f_flags;	/* flags??? */
+};
+
+struct ecoff_aouthdr {
+	u_short magic;
+	u_short vstamp;
+	ECOFF_PAD
+	u_long  tsize;
+	u_long  dsize;
+	u_long  bsize;
+	u_long  entry;
+	u_long  text_start;
+	u_long  data_start;
+	u_long  bss_start;
+	ECOFF_MACHDEP;
+};
+
+struct ecoff_scnhdr {		/* needed for size info */
+	char	s_name[8];	/* name */
+	u_long  s_paddr;	/* physical addr? for ROMing?*/
+	u_long  s_vaddr;	/* virtual addr? */
+	u_long  s_size;		/* size */
+	u_long  s_scnptr;	/* file offset of raw data */
+	u_long  s_relptr;	/* file offset of reloc data */
+	u_long  s_lnnoptr;	/* file offset of line data */
+	u_short s_nreloc;	/* # of relocation entries */
+	u_short s_nlnno;	/* # of line entries */
+	u_int   s_flags;	/* flags */
+};
+
+struct ecoff_exechdr {
+	struct ecoff_filehdr f;
+	struct ecoff_aouthdr a;
+};
+
+#define ECOFF_HDR_SIZE (sizeof(struct ecoff_exechdr))
+
+#define ECOFF_OMAGIC 0407
+#define ECOFF_NMAGIC 0410
+#define ECOFF_ZMAGIC 0413
+
+#define ECOFF_ROUND(value, by) \
+        (((value) + (by) - 1) & ~((by) - 1))
+
+#define ECOFF_BLOCK_ALIGN(ep, value) \
+        ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_ROUND((value), ECOFF_LDPGSZ) : \
+	 (value))
+
+#define ECOFF_TXTOFF(ep) \
+        ((ep)->a.magic == ECOFF_ZMAGIC ? 0 : \
+	 ECOFF_ROUND(ECOFF_HDR_SIZE + (ep)->f.f_nscns * \
+		     sizeof(struct ecoff_scnhdr), ECOFF_SEGMENT_ALIGNMENT(ep)))
+
+#define ECOFF_DATOFF(ep) \
+        (ECOFF_BLOCK_ALIGN((ep), ECOFF_TXTOFF(ep) + (ep)->a.tsize))
+
+#define ECOFF_SEGMENT_ALIGN(ep, value) \
+        (ECOFF_ROUND((value), ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_LDPGSZ : \
+         ECOFF_SEGMENT_ALIGNMENT(ep))))
+
+#ifdef _KERNEL
+int	exec_ecoff_makecmds(struct lwp *, struct exec_package *);
+int	cpu_exec_ecoff_probe(struct lwp *, struct exec_package *);
+void	cpu_exec_ecoff_setregs(struct lwp *, struct exec_package *, vaddr_t);
+
+int	exec_ecoff_prep_omagic(struct lwp *, struct exec_package *,
+	    struct ecoff_exechdr *, struct vnode *);
+int	exec_ecoff_prep_nmagic(struct lwp *, struct exec_package *,
+	    struct ecoff_exechdr *, struct vnode *);
+int	exec_ecoff_prep_zmagic(struct lwp *, struct exec_package *,
+	    struct ecoff_exechdr *, struct vnode *);
+
+#endif /* _KERNEL */
+#endif /* !_SYS_EXEC_ECOFF_H_ */

Property changes on: lab4/.minix-src/include/sys/exec_ecoff.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/extattr.h
===================================================================
--- lab4/.minix-src/include/sys/extattr.h	(nonexistent)
+++ lab4/.minix-src/include/sys/extattr.h	(revision 13)
@@ -0,0 +1,110 @@
+/*	$NetBSD: extattr.h,v 1.9 2012/03/13 18:41:02 elad Exp $	*/
+
+/*-
+ * Copyright (c) 1999-2001 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by Robert Watson for the TrustedBSD Project.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * FreeBSD: src/sys/sys/extattr.h,v 1.12 2003/06/04 04:04:24 rwatson Exp
+ */
+
+/*
+ * Support for file system extended attributes.  Originally developed by
+ * the TrustedBSD Project.  For a Linux-compatible interface to the same
+ * subsystem, see <sys/xattr.h>.
+ */
+
+#ifndef _SYS_EXTATTR_H_
+#define	_SYS_EXTATTR_H_
+
+#include <sys/types.h>
+
+#define	EXTATTR_NAMESPACE_USER		0x00000001
+#define	EXTATTR_NAMESPACE_USER_STRING	"user"
+#define	EXTATTR_NAMESPACE_SYSTEM	0x00000002
+#define	EXTATTR_NAMESPACE_SYSTEM_STRING	"system"
+
+/* for sys_extattrctl */
+#define EXTATTR_CMD_START		0x00000001
+#define EXTATTR_CMD_STOP		0x00000002
+
+#ifdef _KERNEL
+
+#include <sys/param.h>
+
+/* VOP_LISTEXTATTR flags */
+#define EXTATTR_LIST_LENPREFIX	1	/* names with length prefix */
+
+#define	EXTATTR_MAXNAMELEN	KERNEL_NAME_MAX
+struct lwp;
+struct vnode;
+int	extattr_check_cred(struct vnode *, const char *, kauth_cred_t, int);
+
+#else
+
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+int	extattrctl(const char *_path, int _cmd, const char *_filename,
+	    int _attrnamespace, const char *_attrname);
+
+int	extattr_delete_fd(int _fd, int _attrnamespace, const char *_attrname);
+int	extattr_delete_file(const char *_path, int _attrnamespace,
+	    const char *_attrname);
+int	extattr_delete_link(const char *_path, int _attrnamespace,
+	    const char *_attrname);
+ssize_t	extattr_get_fd(int _fd, int _attrnamespace, const char *_attrname,
+	    void *_data, size_t _nbytes);
+ssize_t	extattr_get_file(const char *_path, int _attrnamespace,
+	    const char *_attrname, void *_data, size_t _nbytes);
+ssize_t	extattr_get_link(const char *_path, int _attrnamespace,
+	    const char *_attrname, void *_data, size_t _nbytes);
+ssize_t	extattr_list_fd(int _fd, int _attrnamespace, void *_data,
+	    size_t _nbytes);
+ssize_t	extattr_list_file(const char *_path, int _attrnamespace, void *_data,
+	    size_t _nbytes);
+ssize_t	extattr_list_link(const char *_path, int _attrnamespace, void *_data,
+	    size_t _nbytes);
+int	extattr_set_fd(int _fd, int _attrnamespace, const char *_attrname,
+	    const void *_data, size_t _nbytes);
+int	extattr_set_file(const char *_path, int _attrnamespace,
+	    const char *_attrname, const void *_data, size_t _nbytes);
+int	extattr_set_link(const char *_path, int _attrnamespace,
+	    const char *_attrname, const void *_data, size_t _nbytes);
+
+extern const int extattr_namespaces[];
+
+int	extattr_namespace_to_string(int, char **);
+int	extattr_string_to_namespace(const char *, int *);
+int	extattr_copy_fd(int _from_fd, int _to_fd, int _namespace);
+int	extattr_copy_file(const char *_from, const char *_to, int _namespace);
+int	extattr_copy_link(const char *_from, const char *_to, int _namespace);
+
+int	fcpxattr(int _from_fd, int _to_fd);
+int	cpxattr(const char *_from, const char *_to);
+int	lcpxattr(const char *_from, const char *_to);
+__END_DECLS
+
+#endif /* !_KERNEL */
+#endif /* !_SYS_EXTATTR_H_ */

Property changes on: lab4/.minix-src/include/sys/extattr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/fcntl.h
===================================================================
--- lab4/.minix-src/include/sys/fcntl.h	(nonexistent)
+++ lab4/.minix-src/include/sys/fcntl.h	(revision 13)
@@ -0,0 +1,332 @@
+/*	$NetBSD: fcntl.h,v 1.46 2013/09/15 10:41:20 njoly Exp $	*/
+
+/*-
+ * Copyright (c) 1983, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)fcntl.h	8.3 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_FCNTL_H_
+#define	_SYS_FCNTL_H_
+
+/*
+ * This file includes the definitions for open and fcntl
+ * described by POSIX for <fcntl.h>; it also includes
+ * related kernel definitions.
+ */
+
+#ifndef _KERNEL
+#include <sys/featuretest.h>
+#include <sys/types.h>
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#include <sys/stat.h>
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+#endif /* !_KERNEL */
+
+/*
+ * File status flags: these are used by open(2), fcntl(2).
+ * They are also used (indirectly) in the kernel file structure f_flags,
+ * which is a superset of the open/fcntl flags.  Open flags and f_flags
+ * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
+ * Open/fcntl flags begin with O_; kernel-internal flags begin with F.
+ */
+/* open-only flags */
+#define	O_RDONLY	0x00000000	/* open for reading only */
+#define	O_WRONLY	0x00000001	/* open for writing only */
+#define	O_RDWR		0x00000002	/* open for reading and writing */
+#define	O_ACCMODE	0x00000003	/* mask for above modes */
+
+/*
+ * Kernel encoding of open mode; separate read and write bits that are
+ * independently testable: 1 greater than the above.
+ *
+ * XXX
+ * FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH,
+ * which was documented to use FREAD/FWRITE, continues to work.
+ */
+#if defined(_NETBSD_SOURCE)
+#define	FREAD		0x00000001
+#define	FWRITE		0x00000002
+#endif
+#define	O_NONBLOCK	0x00000004	/* no delay */
+#define	O_APPEND	0x00000008	/* set append mode */
+#if defined(_NETBSD_SOURCE)
+#define	O_SHLOCK	0x00000010	/* open with shared file lock */
+#if !defined(__minix) || 1
+#define	O_EXLOCK	0x00000020	/* open with exclusive file lock */
+#endif /* !defined(__minix) */
+#define	O_ASYNC		0x00000040	/* signal pgrp when data ready */
+#endif
+#if (_POSIX_C_SOURCE - 0) >= 199309L || \
+    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+#define	O_SYNC		0x00000080	/* synchronous writes */
+#endif
+#if defined(_NETBSD_SOURCE)
+#define	O_NOFOLLOW	0x00000100	/* don't follow symlinks on the last */
+					/* path component */
+#endif
+#define	O_CREAT		0x00000200	/* create if nonexistent */
+#define	O_TRUNC		0x00000400	/* truncate to zero length */
+#define	O_EXCL		0x00000800	/* error if already exists */
+
+/* defined by POSIX 1003.1; BSD default, but required to be bitwise distinct */
+#define	O_NOCTTY	0x00008000	/* don't assign controlling terminal */
+
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#define	O_DSYNC		0x00010000	/* write: I/O data completion */
+#define	O_RSYNC		0x00020000	/* read: I/O completion as for write */
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#define	O_ALT_IO	0x00040000	/* use alternate i/o semantics */
+#define	O_DIRECT	0x00080000	/* direct I/O hint */
+#endif
+
+#define	O_DIRECTORY	0x00200000	/* fail if not a directory */
+#define	O_CLOEXEC	0x00400000	/* set close on exec */
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0 >= 700) || \
+    defined(_INCOMPLETE_XOPEN_C063) || defined(_NETBSD_SOURCE)
+#define	O_SEARCH	0x00800000	/* skip search permission checks */
+#endif
+#if defined(_NETBSD_SOURCE)
+#define	O_NOSIGPIPE	0x01000000	/* don't deliver sigpipe */
+#endif
+
+#ifdef _KERNEL
+/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
+#define	FFLAGS(oflags)	((oflags) + 1)
+#define	OFLAGS(fflags)	((fflags) - 1)
+
+/* all bits settable during open(2) */
+#define	O_MASK		(O_ACCMODE|O_NONBLOCK|O_APPEND|O_SHLOCK|O_EXLOCK|\
+			 O_ASYNC|O_SYNC|O_CREAT|O_TRUNC|O_EXCL|O_DSYNC|\
+			 O_RSYNC|O_NOCTTY|O_ALT_IO|O_NOFOLLOW|O_DIRECT|\
+			 O_DIRECTORY|O_CLOEXEC|O_NOSIGPIPE)
+
+#define	FMARK		0x00001000	/* mark during gc() */
+#define	FDEFER		0x00002000	/* defer for next gc pass */
+#define	FHASLOCK	0x00004000	/* descriptor holds advisory lock */
+#define	FSCAN		0x00100000	/* scan during gc passes */
+#define	FSILENT		0x40000000	/* suppress kernel error messages */
+#define	FKIOCTL		0x80000000	/* kernel originated ioctl */
+/* bits settable by fcntl(F_SETFL, ...) */
+#define	FCNTLFLAGS	(FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FDSYNC|FRSYNC|FALTIO|\
+			 FDIRECT|FNOSIGPIPE)
+/* bits to save after open(2) */
+#define	FMASK		(FREAD|FWRITE|FCNTLFLAGS)
+#endif /* _KERNEL */
+
+/*
+ * The O_* flags used to have only F* names, which were used in the kernel
+ * and by fcntl.  We retain the F* names for the kernel f_flags field
+ * and for backward compatibility for fcntl.
+ */
+#if defined(_NETBSD_SOURCE)
+#define	FAPPEND		O_APPEND	/* kernel/compat */
+#define	FASYNC		O_ASYNC		/* kernel/compat */
+#define	O_FSYNC		O_SYNC		/* compat */
+#define	FNDELAY		O_NONBLOCK	/* compat */
+#define	O_NDELAY	O_NONBLOCK	/* compat */
+#endif
+#if defined(_KERNEL)
+#define	FNOSIGPIPE	O_NOSIGPIPE	/* kernel */
+#define	FNONBLOCK	O_NONBLOCK	/* kernel */
+#define	FFSYNC		O_SYNC		/* kernel */
+#define	FDSYNC		O_DSYNC		/* kernel */
+#define	FRSYNC		O_RSYNC		/* kernel */
+#define	FALTIO		O_ALT_IO	/* kernel */
+#define	FDIRECT		O_DIRECT	/* kernel */
+#endif
+
+/*
+ * Constants used for fcntl(2)
+ */
+
+/* command values */
+#define	F_DUPFD		0		/* duplicate file descriptor */
+#define	F_GETFD		1		/* get file descriptor flags */
+#define	F_SETFD		2		/* set file descriptor flags */
+#define	F_GETFL		3		/* get file status flags */
+#define	F_SETFL		4		/* set file status flags */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#define	F_GETOWN	5		/* get SIGIO/SIGURG proc/pgrp */
+#define	F_SETOWN	6		/* set SIGIO/SIGURG proc/pgrp */
+#endif
+#define	F_GETLK		7		/* get record locking information */
+#define	F_SETLK		8		/* set record locking information */
+#define	F_SETLKW	9		/* F_SETLK; wait if blocked */
+#if defined(_NETBSD_SOURCE)
+#define	F_CLOSEM	10		/* close all fds >= to the one given */
+#define	F_MAXFD		11		/* return the max open fd */
+#define	F_DUPFD_CLOEXEC	12		/* close on exec duplicated fd */
+#define	F_GETNOSIGPIPE	13		/* get SIGPIPE disposition */
+#define	F_SETNOSIGPIPE	14		/* set SIGPIPE disposition */
+#endif
+
+/* file descriptor flags (F_GETFD, F_SETFD) */
+#define	FD_CLOEXEC	1		/* close-on-exec flag */
+
+/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */
+#define	F_RDLCK		1		/* shared or read lock */
+#define	F_UNLCK		2		/* unlock */
+#define	F_WRLCK		3		/* exclusive or write lock */
+#ifdef _KERNEL
+#define	F_WAIT		0x010		/* Wait until lock is granted */
+#define	F_FLOCK		0x020	 	/* Use flock(2) semantics for lock */
+#define	F_POSIX		0x040	 	/* Use POSIX semantics for lock */
+#endif
+
+/* Constants for fcntl's passed to the underlying fs - like ioctl's. */
+#if defined(_NETBSD_SOURCE)
+#define	F_PARAM_MASK	0xfff
+#define	F_PARAM_LEN(x)	(((x) >> 16) & F_PARAM_MASK)
+#define	F_PARAM_MAX	4095
+#define	F_FSCTL		(int)0x80000000	/* This fcntl goes to the fs */
+#define	F_FSVOID	(int)0x40000000	/* no parameters */
+#define	F_FSOUT		(int)0x20000000	/* copy out parameter */
+#define	F_FSIN		(int)0x10000000	/* copy in parameter */
+#define	F_FSINOUT	(F_FSIN | F_FSOUT)
+#define	F_FSDIRMASK	(int)0x70000000	/* mask for IN/OUT/VOID */
+#define	F_FSPRIV	(int)0x00008000	/* command is fs-specific */
+
+/*
+ * Define command macros for operations which, if implemented, must be
+ * the same for all fs's.
+ */
+#define	_FCN(inout, num, len) \
+		(F_FSCTL | inout | ((len & F_PARAM_MASK) << 16) | (num))
+#define	_FCNO(c)	_FCN(F_FSVOID,	(c), 0)
+#define	_FCNR(c, t)	_FCN(F_FSIN,	(c), (int)sizeof(t))
+#define	_FCNW(c, t)	_FCN(F_FSOUT,	(c), (int)sizeof(t))
+#define	_FCNRW(c, t)	_FCN(F_FSINOUT,	(c), (int)sizeof(t))
+
+/*
+ * Define command macros for fs-specific commands.
+ */
+#define	_FCN_FSPRIV(inout, fs, num, len) \
+	(F_FSCTL | F_FSPRIV | inout | ((len & F_PARAM_MASK) << 16) |	\
+	 (fs) << 8 | (num))
+#define	_FCNO_FSPRIV(f, c)	_FCN_FSPRIV(F_FSVOID,  (f), (c), 0)
+#define	_FCNR_FSPRIV(f, c, t)	_FCN_FSPRIV(F_FSIN,    (f), (c), (int)sizeof(t))
+#define	_FCNW_FSPRIV(f, c, t)	_FCN_FSPRIV(F_FSOUT,   (f), (c), (int)sizeof(t))
+#define	_FCNRW_FSPRIV(f, c, t)	_FCN_FSPRIV(F_FSINOUT, (f), (c), (int)sizeof(t))
+
+#endif /* _NETBSD_SOURCE */
+
+/*
+ * Advisory file segment locking data type -
+ * information passed to system by user
+ */
+struct flock {
+	off_t	l_start;	/* starting offset */
+	off_t	l_len;		/* len = 0 means until end of file */
+	pid_t	l_pid;		/* lock owner */
+	short	l_type;		/* lock type: read/write, etc. */
+	short	l_whence;	/* type of l_start */
+};
+
+
+#if defined(_NETBSD_SOURCE)
+/* lock operations for flock(2) */
+#define	LOCK_SH		0x01		/* shared file lock */
+#define	LOCK_EX		0x02		/* exclusive file lock */
+#define	LOCK_NB		0x04		/* don't block when locking */
+#define	LOCK_UN		0x08		/* unlock file */
+#endif
+
+/* Always ensure that these are consistent with <stdio.h> and <unistd.h>! */
+#ifndef	SEEK_SET
+#define	SEEK_SET	0	/* set file offset to offset */
+#endif
+#ifndef	SEEK_CUR
+#define	SEEK_CUR	1	/* set file offset to current plus offset */
+#endif
+#ifndef	SEEK_END
+#define	SEEK_END	2	/* set file offset to EOF plus offset */
+#endif
+
+/*
+ * posix_advise advisories.
+ */
+
+#define	POSIX_FADV_NORMAL	0	/* default advice / no advice */
+#define	POSIX_FADV_RANDOM	1	/* random access */
+#define	POSIX_FADV_SEQUENTIAL	2	/* sequential access(lower to higher) */
+#define	POSIX_FADV_WILLNEED	3	/* be needed in near future */
+#define	POSIX_FADV_DONTNEED	4	/* not be needed in near future */
+#define	POSIX_FADV_NOREUSE	5	/* be accessed once */
+
+/*
+ * Constants for X/Open Extended API set 2 (a.k.a. C063)
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0 >= 700) || \
+    defined(_INCOMPLETE_XOPEN_C063) || defined(_NETBSD_SOURCE)
+#define	AT_FDCWD		-100	/* Use cwd for relative link target */
+#define	AT_EACCESS		0x100	/* Use euig/egid for access checks */
+#define	AT_SYMLINK_NOFOLLOW	0x200	/* Do not follow symlinks */
+#define	AT_SYMLINK_FOLLOW	0x400	/* Follow symlinks */
+#define	AT_REMOVEDIR		0x800	/* Remove directory only */
+#endif
+
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	open(const char *, int, ...);
+int	creat(const char *, mode_t);
+int	fcntl(int, int, ...);
+#if defined(_NETBSD_SOURCE)
+int	flock(int, int);
+#endif /* _NETBSD_SOURCE */
+int	posix_fadvise(int, off_t, off_t, int);
+
+/*
+ * X/Open Extended API set 2 (a.k.a. C063)
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0 >= 700) || \
+    defined(_INCOMPLETE_XOPEN_C063) || defined(_NETBSD_SOURCE)
+int	openat(int, const char *, int, ...);
+#endif
+__END_DECLS
+#endif /* !_KERNEL */
+
+#if defined(__minix)
+#define F_FREESP       100
+#define F_FLUSH_FS_CACHE	101	/* invalidate cache on associated FS */
+#endif /* defined(__minix) */
+
+#endif /* !_SYS_FCNTL_H_ */

Property changes on: lab4/.minix-src/include/sys/fcntl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/localedef.h
===================================================================
--- lab4/.minix-src/include/sys/localedef.h	(nonexistent)
+++ lab4/.minix-src/include/sys/localedef.h	(revision 13)
@@ -0,0 +1,85 @@
+/*	$NetBSD: localedef.h,v 1.10 2013/08/18 20:03:48 joerg Exp $	*/
+
+/*
+ * Copyright (c) 1994 Winning Strategies, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Winning Strategies, Inc.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+#ifndef _SYS_LOCALEDEF_H_
+#define _SYS_LOCALEDEF_H_
+
+typedef struct {
+	const char *yesexpr;
+	const char *noexpr;
+	const char *yesstr;
+	const char *nostr;
+} _MessagesLocale;
+
+typedef struct {
+	const char *int_curr_symbol;
+	const char *currency_symbol;
+	const char *mon_decimal_point;
+	const char *mon_thousands_sep;
+	const char *mon_grouping;
+	const char *positive_sign;
+	const char *negative_sign;
+	char int_frac_digits;
+	char frac_digits;
+	char p_cs_precedes;
+	char p_sep_by_space;
+	char n_cs_precedes;
+	char n_sep_by_space;
+	char p_sign_posn;
+	char n_sign_posn;
+	char int_p_cs_precedes;
+	char int_n_cs_precedes;
+	char int_p_sep_by_space;
+	char int_n_sep_by_space;
+	char int_p_sign_posn;
+	char int_n_sign_posn;
+} _MonetaryLocale;
+
+typedef struct {
+	const char *decimal_point;
+	const char *thousands_sep;
+	const char *grouping;
+} _NumericLocale;
+
+typedef struct {
+	const char *abday[7];
+	const char *day[7];
+	const char *abmon[12];
+	const char *mon[12];
+	const char *am_pm[2];
+	const char *d_t_fmt;
+	const char *d_fmt;
+	const char *t_fmt;
+	const char *t_fmt_ampm;
+} _TimeLocale;
+
+#endif /* !_SYS_LOCALEDEF_H_ */

Property changes on: lab4/.minix-src/include/sys/localedef.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/fdio.h
===================================================================
--- lab4/.minix-src/include/sys/fdio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/fdio.h	(revision 13)
@@ -0,0 +1,84 @@
+/*	$NetBSD: fdio.h,v 1.4 2008/04/28 20:24:10 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by John Kohl.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_FDIO_H_
+#define _SYS_FDIO_H_
+
+#include <sys/ioccom.h>
+
+/* Floppy diskette definitions */
+
+enum fdformat_result {
+	FDFORMAT_SUCCESS,
+	FDFORMAT_MEDIA_ERROR,		/* hardware reported a formatting
+					   error */
+	FDFORMAT_CONFIG_ERROR		/* something bogus in parameters */
+};
+
+#define FDFORMAT_VERSION 19961120
+
+struct fdformat_cmd {
+	u_int formatcmd_version;	/* FDFORMAT_VERSION */
+	int head;		/* IN */
+	int cylinder;		/* IN */
+};
+
+struct fdformat_parms {
+/* list of items taken from i386 formatting glop (NEC 765);
+   should be made the union of support needed for other devices. */
+    u_int fdformat_version;	/* rev this when needed; write drivers to
+				   allow forward compatibility, please,
+				   and add elements to the end of the
+				   structure */
+    u_int nbps;				/* number of bytes per sector */
+    u_int ncyl;				/* number of cylinders */
+    u_int nspt;				/* sectors per track */
+    u_int ntrk;				/* number of heads/tracks per cyl */
+    u_int stepspercyl;			/* steps per cylinder */
+    u_int gaplen;			/* formatting gap length */
+    u_int fillbyte;			/* formatting fill byte */
+    u_int xfer_rate;			/* in bits per second; driver
+					   must convert */
+    u_int interleave;			/* interleave factor */
+};
+
+
+#define FDOPT_NORETRY 0x0001	/* no retries on failure (cleared on close) */
+#define FDOPT_SILENT  0x0002	/* no error messages (cleared on close) */
+
+#define FDIOCGETOPTS  _IOR('d', 114, int) /* drive options, see previous */
+#define FDIOCSETOPTS  _IOW('d', 115, int)
+
+#define FDIOCSETFORMAT _IOW('d', 116, struct fdformat_parms) /* set format parms */
+#define FDIOCGETFORMAT _IOR('d', 117, struct fdformat_parms) /* get format parms */
+#define FDIOCFORMAT_TRACK _IOW('d', 118, struct fdformat_cmd) /* do it */
+
+#endif /* _SYS_FDIO_H_ */

Property changes on: lab4/.minix-src/include/sys/fdio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/extent.h
===================================================================
--- lab4/.minix-src/include/sys/extent.h	(nonexistent)
+++ lab4/.minix-src/include/sys/extent.h	(revision 13)
@@ -0,0 +1,115 @@
+/*	$NetBSD: extent.h,v 1.19 2012/01/27 18:53:10 para Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_EXTENT_H_
+#define _SYS_EXTENT_H_
+
+#include <sys/queue.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+
+struct extent_region {
+	LIST_ENTRY(extent_region) er_link;	/* link in region list */
+	u_long 	er_start;		/* start of region */
+	u_long	er_end;			/* end of region */
+	int	er_flags;		/* misc. flags */
+};
+
+/* er_flags */
+#define ER_ALLOC	0x01	/* region descriptor dynamically allocated */
+
+struct extent {
+	const char *ex_name;		/* name of extent */
+	kmutex_t ex_lock;		/* lock on this extent */
+	kcondvar_t ex_cv;		/* synchronization */
+					/* allocated regions in extent */
+	LIST_HEAD(, extent_region) ex_regions;
+	u_long	ex_start;		/* start of extent */
+	u_long	ex_end;			/* end of extent */
+	int	ex_flags;		/* misc. information */
+};
+
+struct extent_fixed {
+	struct extent	fex_extent;	/* MUST BE FIRST */
+					/* freelist of region descriptors */
+	LIST_HEAD(, extent_region) fex_freelist;
+	void *		fex_storage;	/* storage space for descriptors */
+	size_t		fex_storagesize; /* size of storage space */
+};
+
+/* ex_flags; for internal use only */
+#define EXF_FIXED	0x01		/* extent uses fixed storage */
+#define EXF_NOCOALESCE	0x02		/* coalescing of regions not allowed */
+#define EXF_FLWANTED	0x08		/* someone asleep on freelist */
+
+#define EXF_BITS	"\20\4FLWANTED\2NOCOALESCE\1FIXED"
+
+/* misc. flags passed to extent functions */
+#define EX_NOWAIT	0x00		/* not safe to sleep */
+#define EX_WAITOK	0x01		/* safe to sleep */
+#define EX_FAST		0x02		/* take first fit in extent_alloc() */
+#define EX_CATCH	0x04		/* catch signals while sleeping */
+#define EX_NOCOALESCE	0x08		/* create a non-coalescing extent */
+#define EX_MALLOCOK	0x10		/* safe to call kmem_alloc() */
+#define EX_WAITSPACE	0x20		/* wait for space to become free */
+#define EX_BOUNDZERO	0x40		/* boundary lines start at 0 */
+
+/*
+ * Special place holders for "alignment" and "boundary" arguments,
+ * in the event the caller doesn't wish to use those features.
+ */
+#define EX_NOALIGN	1		/* don't do alignment */
+#define EX_NOBOUNDARY	0		/* don't do boundary checking */
+
+#if defined(_KERNEL) || defined(_EXTENT_TESTING)
+#define EXTENT_FIXED_STORAGE_SIZE(_nregions)		\
+	(ALIGN(sizeof(struct extent_fixed)) +		\
+	((ALIGN(sizeof(struct extent_region))) *	\
+	 (_nregions)))
+
+struct	extent *extent_create(const char *, u_long, u_long,
+	    void *, size_t, int);
+void	extent_destroy(struct extent *);
+int	extent_alloc_subregion1(struct extent *, u_long, u_long,
+	    u_long, u_long, u_long, u_long, int, u_long *);
+int	extent_alloc_subregion(struct extent *, u_long, u_long,
+	    u_long, u_long, u_long, int, u_long *);
+int	extent_alloc_region(struct extent *, u_long, u_long, int);
+int	extent_alloc1(struct extent *, u_long, u_long, u_long, u_long, int,
+	    u_long *);
+int	extent_alloc(struct extent *, u_long, u_long, u_long, int, u_long *);
+int	extent_free(struct extent *, u_long, u_long, int);
+void	extent_print(struct extent *);
+void	extent_init(void);
+
+#endif /* _KERNEL || _EXTENT_TESTING */
+
+#endif /* ! _SYS_EXTENT_H_ */

Property changes on: lab4/.minix-src/include/sys/extent.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/file.h
===================================================================
--- lab4/.minix-src/include/sys/file.h	(nonexistent)
+++ lab4/.minix-src/include/sys/file.h	(revision 13)
@@ -0,0 +1,211 @@
+/*	$NetBSD: file.h,v 1.79 2015/05/30 20:09:47 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)file.h	8.3 (Berkeley) 1/9/95
+ */
+
+#ifndef _SYS_FILE_H_
+#define	_SYS_FILE_H_
+
+#include <sys/fcntl.h>
+#include <sys/unistd.h>
+
+#ifdef _KERNEL
+#include <sys/queue.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+
+struct proc;
+struct lwp;
+struct uio;
+struct iovec;
+struct stat;
+struct knote;
+struct uvm_object;
+
+struct fileops {
+	int	(*fo_read)	(struct file *, off_t *, struct uio *,
+				    kauth_cred_t, int);
+	int	(*fo_write)	(struct file *, off_t *, struct uio *,
+				    kauth_cred_t, int);
+	int	(*fo_ioctl)	(struct file *, u_long, void *);
+	int	(*fo_fcntl)	(struct file *, u_int, void *);
+	int	(*fo_poll)	(struct file *, int);
+	int	(*fo_stat)	(struct file *, struct stat *);
+	int	(*fo_close)	(struct file *);
+	int	(*fo_kqfilter)	(struct file *, struct knote *);
+	void	(*fo_restart)	(struct file *);
+	int	(*fo_mmap)	(struct file *, off_t *, size_t, int, int *,
+				 int *, struct uvm_object **, int *);
+	void	(*fo_spare2)	(void);
+};
+
+union file_data {
+	struct vnode *fd_vp;		// DTYPE_VNODE
+	struct socket *fd_so;		// DTYPE_SOCKET
+	struct pipe *fd_pipe;		// DTYPE_PIPE
+	struct kqueue *fd_kq;		// DTYPE_KQUEUE
+	void *fd_data;			// DTYPE_MISC
+	struct rnd_ctx *fd_rndctx;	// DTYPE_MISC (rnd)
+	int fd_devunit;			// DTYPE_MISC (tap)
+	struct bpf_d *fd_bpf;		// DTYPE_MISC (bpf)
+	struct fcrypt *fd_fcrypt;	// DTYPE_CRYPTO is not used
+	struct mqueue *fd_mq;		// DTYPE_MQUEUE
+	struct ksem *fd_ks;		// DTYPE_SEM
+	struct iscsifd *fd_iscsi;	// DTYPE_MISC (iscsi)
+};
+
+/*
+ * Kernel file descriptor.  One entry for each open kernel vnode and
+ * socket.
+ *
+ * This structure is exported via the KERN_FILE and KERN_FILE2 sysctl
+ * calls.  Only add members to the end, do not delete them.
+ */
+struct file {
+	off_t		f_offset;	/* first, is 64-bit */
+	kauth_cred_t 	f_cred;		/* creds associated with descriptor */
+	const struct fileops *f_ops;
+	union file_data	f_undata;	/* descriptor data, e.g. vnode/socket */
+	LIST_ENTRY(file) f_list;	/* list of active files */
+	kmutex_t	f_lock;		/* lock on structure */
+	int		f_flag;		/* see fcntl.h */
+	u_int		f_marker;	/* traversal marker (sysctl) */
+	u_int		f_type;		/* descriptor type */
+	u_int		f_advice;	/* access pattern hint; UVM_ADV_* */
+	u_int		f_count;	/* reference count */
+	u_int		f_msgcount;	/* references from message queue */
+	u_int		f_unpcount;	/* deferred close: see uipc_usrreq.c */
+	SLIST_ENTRY(file) f_unplist;	/* deferred close: see uipc_usrreq.c */
+};
+
+#define f_vnode		f_undata.fd_vp
+#define f_socket	f_undata.fd_so
+#define f_pipe		f_undata.fd_pipe
+#define f_kqueue	f_undata.fd_kq
+#define f_data		f_undata.fd_data
+#define f_mqueue	f_undata.fd_mq
+#define f_ksem		f_undata.fd_ks
+
+#define f_rndctx	f_undata.fd_rndctx
+#define f_devunit	f_undata.fd_devunit
+#define f_bpf		f_undata.fd_bpf
+#define f_fcrypt	f_undata.fd_fcrypt
+#define f_iscsi		f_undata.fd_iscsi
+#endif
+
+/*
+ * Descriptor types.
+ */
+
+#define	DTYPE_VNODE	1		/* file */
+#define	DTYPE_SOCKET	2		/* communications endpoint */
+#define	DTYPE_PIPE	3		/* pipe */
+#define	DTYPE_KQUEUE	4		/* event queue */
+#define	DTYPE_MISC	5		/* misc file descriptor type */
+#define	DTYPE_CRYPTO	6		/* crypto */
+#define	DTYPE_MQUEUE	7		/* message queue */
+#define	DTYPE_SEM	8		/* semaphore */
+
+#define DTYPE_NAMES	\
+    "0", "file", "socket", "pipe", "kqueue", "misc", "crypto", "mqueue", \
+    "semaphore"
+
+#ifdef _KERNEL
+
+/*
+ * Flags for fo_read and fo_write and do_fileread/write/v
+ */
+#define	FOF_UPDATE_OFFSET	0x0001	/* update the file offset */
+#define	FOF_IOV_SYSSPACE	0x0100	/* iov structure in kernel memory */
+
+LIST_HEAD(filelist, file);
+extern struct filelist	filehead;	/* head of list of open files */
+extern u_int		maxfiles;	/* kernel limit on # of open files */
+
+extern const struct fileops vnops;	/* vnode operations for files */
+
+int	dofileread(int, struct file *, void *, size_t,
+	    off_t *, int, register_t *);
+int	dofilewrite(int, struct file *, const void *,
+	    size_t, off_t *, int, register_t *);
+
+int	do_filereadv(int, const struct iovec *, int, off_t *,
+	    int, register_t *);
+int	do_filewritev(int, const struct iovec *, int, off_t *,
+	    int, register_t *);
+
+int	fsetown(pid_t *, u_long, const void *);
+int	fgetown(pid_t, u_long, void *);
+void	fownsignal(pid_t, int, int, int, void *);
+
+/* Commonly used fileops */
+int	fnullop_fcntl(struct file *, u_int, void *);
+int	fnullop_poll(struct file *, int);
+int	fnullop_kqfilter(struct file *, struct knote *);
+int	fbadop_read(struct file *, off_t *, struct uio *, kauth_cred_t, int);
+int	fbadop_write(struct file *, off_t *, struct uio *, kauth_cred_t, int);
+int	fbadop_ioctl(struct file *, u_long, void *);
+int	fbadop_close(struct file *);
+int	fbadop_stat(struct file *, struct stat *);
+void	fnullop_restart(struct file *);
+
+#endif /* _KERNEL */
+
+#endif /* _SYS_FILE_H_ */

Property changes on: lab4/.minix-src/include/sys/file.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/lwp.h
===================================================================
--- lab4/.minix-src/include/sys/lwp.h	(nonexistent)
+++ lab4/.minix-src/include/sys/lwp.h	(revision 13)
@@ -0,0 +1,534 @@
+/*	$NetBSD: lwp.h,v 1.170 2015/03/31 01:10:02 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
+ *    The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nathan J. Williams and Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_LWP_H_
+#define _SYS_LWP_H_
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/queue.h>
+#include <sys/callout.h>
+#include <sys/kcpuset.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+#include <sys/signalvar.h>
+#include <sys/sched.h>
+#include <sys/specificdata.h>
+#include <sys/syncobj.h>
+#include <sys/resource.h>
+
+#if defined(_KERNEL)
+struct lwp;
+/* forward declare this for <machine/cpu.h> so it can get l_cpu. */
+static inline struct cpu_info *lwp_getcpu(struct lwp *);
+#include <machine/cpu.h>		/* curcpu() and cpu_info */
+#endif
+
+#include <machine/proc.h>		/* Machine-dependent proc substruct. */
+
+/*
+ * Lightweight process.  Field markings and the corresponding locks:
+ *
+ * a:	proc_lock
+ * c:	condition variable interlock, passed to cv_wait()
+ * l:	*l_mutex
+ * p:	l_proc->p_lock
+ * s:	spc_mutex, which may or may not be referenced by l_mutex
+ * S:	l_selcluster->sc_lock
+ * (:	unlocked, stable
+ * !:	unlocked, may only be reliably accessed by the LWP itself
+ *
+ * Fields are clustered together by usage (to increase the likelyhood
+ * of cache hits) and by size (to reduce dead space in the structure).
+ */
+
+#include <sys/pcu.h>
+
+struct lockdebug;
+struct sysent;
+
+struct lwp {
+	/* Scheduling and overall state. */
+	TAILQ_ENTRY(lwp) l_runq;	/* s: run queue */
+	union {
+		void *	info;		/* s: scheduler-specific structure */
+		u_int	timeslice;	/* l: time-quantum for SCHED_M2 */
+	} l_sched;
+	struct cpu_info *volatile l_cpu;/* s: CPU we're on if LSONPROC */
+	kmutex_t * volatile l_mutex;	/* l: ptr to mutex on sched state */
+	int		l_ctxswtch;	/* l: performing a context switch */
+	void		*l_addr;	/* l: PCB address; use lwp_getpcb() */
+	struct mdlwp	l_md;		/* l: machine-dependent fields. */
+	int		l_flag;		/* l: misc flag values */
+	int		l_stat;		/* l: overall LWP status */
+	struct bintime 	l_rtime;	/* l: real time */
+	struct bintime	l_stime;	/* l: start time (while ONPROC) */
+	u_int		l_swtime;	/* l: time swapped in or out */
+	u_int		l_rticks;	/* l: Saved start time of run */
+	u_int		l_rticksum;	/* l: Sum of ticks spent running */
+	u_int		l_slpticks;	/* l: Saved start time of sleep */
+	u_int		l_slpticksum;	/* l: Sum of ticks spent sleeping */
+	int		l_biglocks;	/* l: biglock count before sleep */
+	int		l_class;	/* l: scheduling class */
+	int		l_kpriority;	/* !: has kernel priority boost */
+	pri_t		l_kpribase;	/* !: kernel priority base level */
+	pri_t		l_priority;	/* l: scheduler priority */
+	pri_t		l_inheritedprio;/* l: inherited priority */
+	SLIST_HEAD(, turnstile) l_pi_lenders; /* l: ts lending us priority */
+	uint64_t	l_ncsw;		/* l: total context switches */
+	uint64_t	l_nivcsw;	/* l: involuntary context switches */
+	u_int		l_cpticks;	/* (: Ticks of CPU time */
+	fixpt_t		l_pctcpu;	/* p: %cpu during l_swtime */
+	fixpt_t		l_estcpu;	/* l: cpu time for SCHED_4BSD */
+	psetid_t	l_psid;		/* l: assigned processor-set ID */
+	struct cpu_info *l_target_cpu;	/* l: target CPU to migrate */
+	struct lwpctl	*l_lwpctl;	/* p: lwpctl block kernel address */
+	struct lcpage	*l_lcpage;	/* p: lwpctl containing page */
+	kcpuset_t	*l_affinity;	/* l: CPU set for affinity */
+
+	/* Synchronisation. */
+	struct turnstile *l_ts;		/* l: current turnstile */
+	struct syncobj	*l_syncobj;	/* l: sync object operations set */
+	TAILQ_ENTRY(lwp) l_sleepchain;	/* l: sleep queue */
+	wchan_t		l_wchan;	/* l: sleep address */
+	const char	*l_wmesg;	/* l: reason for sleep */
+	struct sleepq	*l_sleepq;	/* l: current sleep queue */
+	int		l_sleeperr;	/* !: error before unblock */
+	u_int		l_slptime;	/* l: time since last blocked */
+	callout_t	l_timeout_ch;	/* !: callout for tsleep */
+	u_int		l_emap_gen;	/* !: emap generation number */
+	kcondvar_t	l_waitcv;	/* a: vfork() wait */
+
+#if PCU_UNIT_COUNT > 0
+	struct cpu_info	* volatile l_pcu_cpu[PCU_UNIT_COUNT];
+	uint32_t	l_pcu_valid;
+#endif
+
+	/* Process level and global state, misc. */
+	LIST_ENTRY(lwp)	l_list;		/* a: entry on list of all LWPs */
+	void		*l_ctxlink;	/* p: uc_link {get,set}context */
+	struct proc	*l_proc;	/* p: parent process */
+	LIST_ENTRY(lwp)	l_sibling;	/* p: entry on proc's list of LWPs */
+	lwpid_t		l_waiter;	/* p: first LWP waiting on us */
+	lwpid_t 	l_waitingfor;	/* p: specific LWP we are waiting on */
+	int		l_prflag;	/* p: process level flags */
+	u_int		l_refcnt;	/* p: reference count on this LWP */
+	lwpid_t		l_lid;		/* (: LWP identifier; local to proc */
+	char		*l_name;	/* (: name, optional */
+
+	/* State of select() or poll(). */
+	int		l_selflag;	/* S: polling state flags */
+	SLIST_HEAD(,selinfo) l_selwait;	/* S: descriptors waited on */
+	int		l_selret;	/* S: return value of select/poll */
+	uintptr_t	l_selrec;	/* !: argument for selrecord() */
+	struct selcluster *l_selcluster;/* !: associated cluster data */
+	void *		l_selbits;	/* (: select() bit-field */
+	size_t		l_selni;	/* (: size of a single bit-field */
+
+	/* Signals. */
+	int		l_sigrestore;	/* p: need to restore old sig mask */
+	sigset_t	l_sigwaitset;	/* p: signals being waited for */
+	kcondvar_t	l_sigcv;	/* p: for sigsuspend() */
+	struct ksiginfo	*l_sigwaited;	/* p: delivered signals from set */
+	sigpend_t	*l_sigpendset;	/* p: XXX issignal()/postsig() baton */
+	LIST_ENTRY(lwp)	l_sigwaiter;	/* p: chain on list of waiting LWPs */
+	stack_t		l_sigstk;	/* p: sp & on stack state variable */
+	sigset_t	l_sigmask;	/* p: signal mask */
+	sigpend_t	l_sigpend;	/* p: signals to this LWP */
+	sigset_t	l_sigoldmask;	/* p: mask for sigpause */
+
+	/* Private data. */
+	specificdata_reference
+		l_specdataref;		/* !: subsystem lwp-specific data */
+	struct timespec l_ktrcsw;	/* !: for ktrace CSW trace XXX */
+	void		*l_private;	/* !: svr4-style lwp-private data */
+	struct lwp	*l_switchto;	/* !: mi_switch: switch to this LWP */
+	struct kauth_cred *l_cred;	/* !: cached credentials */
+	struct filedesc	*l_fd;		/* !: cached copy of proc::p_fd */
+	void		*l_emuldata;	/* !: kernel lwp-private data */
+	u_int		l_cv_signalled;	/* c: restarted by cv_signal() */
+	u_short		l_shlocks;	/* !: lockdebug: shared locks held */
+	u_short		l_exlocks;	/* !: lockdebug: excl. locks held */
+	u_short		l_unused;	/* !: unused */
+	u_short		l_blcnt;	/* !: count of kernel_lock held */
+	int		l_nopreempt;	/* !: don't preempt me! */
+	u_int		l_dopreempt;	/* s: kernel preemption pending */
+	int		l_pflag;	/* !: LWP private flags */
+	int		l_dupfd;	/* !: side return from cloning devs XXX */
+	const struct sysent * volatile l_sysent;/* !: currently active syscall */
+	struct rusage	l_ru;		/* !: accounting information */
+	uint64_t	l_pfailtime;	/* !: for kernel preemption */
+	uintptr_t	l_pfailaddr;	/* !: for kernel preemption */
+	uintptr_t	l_pfaillock;	/* !: for kernel preemption */
+	_TAILQ_HEAD(,struct lockdebug,volatile) l_ld_locks;/* !: locks held by LWP */
+	int		l_tcgen;	/* !: for timecounter removal */
+
+	/* These are only used by 'options SYSCALL_TIMES'. */
+	uint32_t	l_syscall_time;	/* !: time epoch for current syscall */
+	uint64_t	*l_syscall_counter; /* !: counter for current process */
+
+	struct kdtrace_thread *l_dtrace; /* (: DTrace-specific data. */
+};
+
+/*
+ * UAREA_PCB_OFFSET: an offset of PCB structure in the uarea.  MD code may
+ * define it in <machine/proc.h>, to indicate a different uarea layout.
+ */
+#ifndef UAREA_PCB_OFFSET
+#define	UAREA_PCB_OFFSET	0
+#endif
+
+LIST_HEAD(lwplist, lwp);		/* A list of LWPs. */
+
+#ifdef _KERNEL
+extern struct lwplist	alllwp;		/* List of all LWPs. */
+extern lwp_t		lwp0;		/* LWP for proc0. */
+extern int		maxlwp __read_mostly;	/* max number of lwps */
+#ifndef MAXLWP
+#define	MAXLWP		2048
+#endif
+#ifndef	__HAVE_CPU_MAXLWP
+#define	cpu_maxlwp()	MAXLWP
+#endif
+#endif
+
+#endif /* _KERNEL || _KMEMUSER */
+
+/* These flags are kept in l_flag. */
+#define	LW_IDLE		0x00000001 /* Idle lwp. */
+#define	LW_LWPCTL	0x00000002 /* Adjust lwpctl in userret */
+#define	LW_SINTR	0x00000080 /* Sleep is interruptible. */
+#define	LW_SYSTEM	0x00000200 /* Kernel thread */
+#define	LW_WSUSPEND	0x00020000 /* Suspend before return to user */
+#define	LW_BATCH	0x00040000 /* LWP tends to hog CPU */
+#define	LW_WCORE	0x00080000 /* Stop for core dump on return to user */
+#define	LW_WEXIT	0x00100000 /* Exit before return to user */
+#define	LW_PENDSIG	0x01000000 /* Pending signal for us */
+#define	LW_CANCELLED	0x02000000 /* tsleep should not sleep */
+#define	LW_WREBOOT	0x08000000 /* System is rebooting, please suspend */
+#define	LW_UNPARKED	0x10000000 /* Unpark op pending */
+#define	LW_RUMP_CLEAR	0x40000000 /* Clear curlwp in RUMP scheduler */
+#define	LW_RUMP_QEXIT	0x80000000 /* LWP should exit ASAP */
+
+/* The second set of flags is kept in l_pflag. */
+#define	LP_KTRACTIVE	0x00000001 /* Executing ktrace operation */
+#define	LP_KTRCSW	0x00000002 /* ktrace context switch marker */
+#define	LP_KTRCSWUSER	0x00000004 /* ktrace context switch marker */
+#define	LP_PIDLID	0x00000008 /* free LID from PID space on exit */
+#define	LP_OWEUPC	0x00000010 /* Owe user profiling tick */
+#define	LP_MPSAFE	0x00000020 /* Starts life without kernel_lock */
+#define	LP_INTR		0x00000040 /* Soft interrupt handler */
+#define	LP_SYSCTLWRITE	0x00000080 /* sysctl write lock held */
+#define	LP_MUSTJOIN	0x00000100 /* Must join kthread on exit */
+#define	LP_VFORKWAIT	0x00000200 /* Waiting at vfork() for a child */
+#define	LP_TIMEINTR	0x00010000 /* Time this soft interrupt */
+#define	LP_RUNNING	0x20000000 /* Active on a CPU */
+#define	LP_BOUND	0x80000000 /* Bound to a CPU */
+
+/* The third set is kept in l_prflag. */
+#define	LPR_DETACHED	0x00800000 /* Won't be waited for. */
+#define	LPR_CRMOD	0x00000100 /* Credentials modified */
+
+/*
+ * Mask indicating that there is "exceptional" work to be done on return to
+ * user.
+ */
+#define	LW_USERRET	\
+    (LW_WEXIT | LW_PENDSIG | LW_WREBOOT | LW_WSUSPEND | LW_WCORE | LW_LWPCTL)
+
+/*
+ * Status values.
+ *
+ * A note about LSRUN and LSONPROC: LSRUN indicates that a process is
+ * runnable but *not* yet running, i.e. is on a run queue.  LSONPROC
+ * indicates that the process is actually executing on a CPU, i.e.
+ * it is no longer on a run queue.
+ */
+#define	LSIDL		1	/* Process being created by fork. */
+#define	LSRUN		2	/* Currently runnable. */
+#define	LSSLEEP		3	/* Sleeping on an address. */
+#define	LSSTOP		4	/* Process debugging or suspension. */
+#define	LSZOMB		5	/* Awaiting collection by parent. */
+/* unused, for source compatibility with NetBSD 4.0 and earlier. */
+#define	LSDEAD		6	/* Process is almost a zombie. */
+#define	LSONPROC	7	/* Process is currently on a CPU. */
+#define	LSSUSPENDED	8	/* Not running, not signalable. */
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+static inline void *
+lwp_getpcb(struct lwp *l)
+{
+
+	return l->l_addr;
+}
+#endif /* _KERNEL || _KMEMUSER */
+
+#ifdef _KERNEL
+#define	LWP_CACHE_CREDS(l, p)						\
+do {									\
+	(void)p;							\
+	if (__predict_false((l)->l_prflag & LPR_CRMOD))			\
+		lwp_update_creds(l);					\
+} while (/* CONSTCOND */ 0)
+
+void	lwpinit(void);
+void	lwp0_init(void);
+void	lwp_sys_init(void);
+
+void	lwp_startup(lwp_t *, lwp_t *);
+void	startlwp(void *);
+
+int	lwp_locked(lwp_t *, kmutex_t *);
+void	lwp_setlock(lwp_t *, kmutex_t *);
+void	lwp_unlock_to(lwp_t *, kmutex_t *);
+int	lwp_trylock(lwp_t *);
+void	lwp_addref(lwp_t *);
+void	lwp_delref(lwp_t *);
+void	lwp_delref2(lwp_t *);
+void	lwp_drainrefs(lwp_t *);
+bool	lwp_alive(lwp_t *);
+lwp_t	*lwp_find_first(proc_t *);
+
+int	lwp_wait(lwp_t *, lwpid_t, lwpid_t *, bool);
+void	lwp_continue(lwp_t *);
+void	lwp_unsleep(lwp_t *, bool);
+void	lwp_unstop(lwp_t *);
+void	lwp_exit(lwp_t *);
+void	lwp_exit_switchaway(lwp_t *) __dead;
+int	lwp_suspend(lwp_t *, lwp_t *);
+int	lwp_create1(lwp_t *, const void *, size_t, u_long, lwpid_t *);
+void	lwp_update_creds(lwp_t *);
+void	lwp_migrate(lwp_t *, struct cpu_info *);
+lwp_t *	lwp_find2(pid_t, lwpid_t);
+lwp_t *	lwp_find(proc_t *, int);
+void	lwp_userret(lwp_t *);
+void	lwp_need_userret(lwp_t *);
+void	lwp_free(lwp_t *, bool, bool);
+uint64_t lwp_pctr(void);
+int	lwp_setprivate(lwp_t *, void *);
+int	do_lwp_create(lwp_t *, void *, u_long, lwpid_t *);
+
+void	lwpinit_specificdata(void);
+int	lwp_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
+void	lwp_specific_key_delete(specificdata_key_t);
+void	lwp_initspecific(lwp_t *);
+void	lwp_finispecific(lwp_t *);
+void	*lwp_getspecific(specificdata_key_t);
+#if defined(_LWP_API_PRIVATE)
+void	*_lwp_getspecific_by_lwp(lwp_t *, specificdata_key_t);
+#endif
+void	lwp_setspecific(specificdata_key_t, void *);
+
+/* Syscalls. */
+int	lwp_park(clockid_t, int, struct timespec *, const void *);
+int	lwp_unpark(lwpid_t, const void *);
+
+/* DDB. */
+void	lwp_whatis(uintptr_t, void (*)(const char *, ...) __printflike(1, 2));
+
+/*
+ * Lock an LWP. XXX _MODULE
+ */
+static inline void
+lwp_lock(lwp_t *l)
+{
+	kmutex_t *old = l->l_mutex;
+
+	/*
+	 * Note: mutex_spin_enter() will have posted a read barrier.
+	 * Re-test l->l_mutex.  If it has changed, we need to try again.
+	 */
+	mutex_spin_enter(old);
+	while (__predict_false(l->l_mutex != old)) {
+		mutex_spin_exit(old);
+		old = l->l_mutex;
+		mutex_spin_enter(old);
+	}
+}
+
+/*
+ * Unlock an LWP. XXX _MODULE
+ */
+static inline void
+lwp_unlock(lwp_t *l)
+{
+	mutex_spin_exit(l->l_mutex);
+}
+
+static inline void
+lwp_changepri(lwp_t *l, pri_t pri)
+{
+	KASSERT(mutex_owned(l->l_mutex));
+
+	if (l->l_priority == pri)
+		return;
+
+	(*l->l_syncobj->sobj_changepri)(l, pri);
+	KASSERT(l->l_priority == pri);
+}
+
+static inline void
+lwp_lendpri(lwp_t *l, pri_t pri)
+{
+	KASSERT(mutex_owned(l->l_mutex));
+
+	if (l->l_inheritedprio == pri)
+		return;
+
+	(*l->l_syncobj->sobj_lendpri)(l, pri);
+	KASSERT(l->l_inheritedprio == pri);
+}
+
+static inline pri_t
+lwp_eprio(lwp_t *l)
+{
+	pri_t pri;
+
+	pri = l->l_priority;
+	if ((l->l_flag & LW_SYSTEM) == 0 && l->l_kpriority && pri < PRI_KERNEL)
+		pri = (pri >> 1) + l->l_kpribase;
+	return MAX(l->l_inheritedprio, pri);
+}
+
+int lwp_create(lwp_t *, struct proc *, vaddr_t, int,
+    void *, size_t, void (*)(void *), void *, lwp_t **, int);
+
+/*
+ * XXX _MODULE
+ * We should provide real stubs for the below that modules can use.
+ */
+
+static inline void
+spc_lock(struct cpu_info *ci)
+{
+	mutex_spin_enter(ci->ci_schedstate.spc_mutex);
+}
+
+static inline void
+spc_unlock(struct cpu_info *ci)
+{
+	mutex_spin_exit(ci->ci_schedstate.spc_mutex);
+}
+
+static inline void
+spc_dlock(struct cpu_info *ci1, struct cpu_info *ci2)
+{
+	struct schedstate_percpu *spc1 = &ci1->ci_schedstate;
+	struct schedstate_percpu *spc2 = &ci2->ci_schedstate;
+
+	KASSERT(ci1 != ci2);
+	if (ci1 < ci2) {
+		mutex_spin_enter(spc1->spc_mutex);
+		mutex_spin_enter(spc2->spc_mutex);
+	} else {
+		mutex_spin_enter(spc2->spc_mutex);
+		mutex_spin_enter(spc1->spc_mutex);
+	}
+}
+
+/*
+ * Allow machine-dependent code to override curlwp in <machine/cpu.h> for
+ * its own convenience.  Otherwise, we declare it as appropriate.
+ */
+#if !defined(curlwp)
+#if defined(MULTIPROCESSOR)
+#define	curlwp		curcpu()->ci_curlwp	/* Current running LWP */
+#else
+extern struct lwp	*curlwp;		/* Current running LWP */
+#endif /* MULTIPROCESSOR */
+#endif /* ! curlwp */
+#define	curproc		(curlwp->l_proc)
+
+/*
+ * This provide a way for <machine/cpu.h> to get l_cpu for curlwp before
+ * struct lwp is defined.
+ */
+static inline struct cpu_info *
+lwp_getcpu(struct lwp *l)
+{
+	return l->l_cpu;
+}
+
+static inline bool
+CURCPU_IDLE_P(void)
+{
+	struct cpu_info *ci = curcpu();
+	return ci->ci_data.cpu_onproc == ci->ci_data.cpu_idlelwp;
+}
+
+/*
+ * Disable and re-enable preemption.  Only for low-level kernel
+ * use.  Device drivers and anything that could potentially be
+ * compiled as a module should use kpreempt_disable() and
+ * kpreempt_enable().
+ */
+static inline void
+KPREEMPT_DISABLE(lwp_t *l)
+{
+
+	KASSERT(l == curlwp);
+	l->l_nopreempt++;
+	__insn_barrier();
+}
+
+static inline void
+KPREEMPT_ENABLE(lwp_t *l)
+{
+
+	KASSERT(l == curlwp);
+	KASSERT(l->l_nopreempt > 0);
+	__insn_barrier();
+	if (--l->l_nopreempt != 0)
+		return;
+	__insn_barrier();
+	if (__predict_false(l->l_dopreempt))
+		kpreempt(0);
+	__insn_barrier();
+}
+
+/* For lwp::l_dopreempt */
+#define	DOPREEMPT_ACTIVE	0x01
+#define	DOPREEMPT_COUNTED	0x02
+
+#endif /* _KERNEL */
+
+/* Flags for _lwp_create(), as per Solaris. */
+#define	LWP_DETACHED	0x00000040
+#define	LWP_SUSPENDED	0x00000080
+
+/* Kernel-internal flags for LWP creation. */
+#define	LWP_PIDLID	0x40000000
+#define	LWP_VFORK	0x80000000
+
+#endif	/* !_SYS_LWP_H_ */

Property changes on: lab4/.minix-src/include/sys/lwp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/featuretest.h
===================================================================
--- lab4/.minix-src/include/sys/featuretest.h	(nonexistent)
+++ lab4/.minix-src/include/sys/featuretest.h	(revision 13)
@@ -0,0 +1,85 @@
+/*	$NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $	*/
+
+/*
+ * Written by Klaus Klein <kleink@NetBSD.org>, February 2, 1998.
+ * Public domain.
+ *
+ * NOTE: Do not protect this header against multiple inclusion.  Doing
+ * so can have subtle side-effects due to header file inclusion order
+ * and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE.  Instead,
+ * protect each CPP macro that we want to supply.
+ */
+
+/*
+ * Feature-test macros are defined by several standards, and allow an
+ * application to specify what symbols they want the system headers to
+ * expose, and hence what standard they want them to conform to.
+ * There are two classes of feature-test macros.  The first class
+ * specify complete standards, and if one of these is defined, header
+ * files will try to conform to the relevant standard.  They are:
+ *
+ * ANSI macros:
+ * _ANSI_SOURCE			ANSI C89
+ *
+ * POSIX macros:
+ * _POSIX_SOURCE == 1		IEEE Std 1003.1 (version?)
+ * _POSIX_C_SOURCE == 1		IEEE Std 1003.1-1990
+ * _POSIX_C_SOURCE == 2		IEEE Std 1003.2-1992
+ * _POSIX_C_SOURCE == 199309L	IEEE Std 1003.1b-1993
+ * _POSIX_C_SOURCE == 199506L	ISO/IEC 9945-1:1996
+ * _POSIX_C_SOURCE == 200112L	IEEE Std 1003.1-2001
+ * _POSIX_C_SOURCE == 200809L   IEEE Std 1003.1-2008
+ *
+ * X/Open macros:
+ * _XOPEN_SOURCE		System Interfaces and Headers, Issue 4, Ver 2
+ * _XOPEN_SOURCE_EXTENDED == 1	XSH4.2 UNIX extensions
+ * _XOPEN_SOURCE == 500		System Interfaces and Headers, Issue 5
+ * _XOPEN_SOURCE == 520		Networking Services (XNS), Issue 5.2
+ * _XOPEN_SOURCE == 600		IEEE Std 1003.1-2001, XSI option
+ * _XOPEN_SOURCE == 700		IEEE Std 1003.1-2008, XSI option
+ *
+ * NetBSD macros:
+ * _NETBSD_SOURCE == 1		Make all NetBSD features available.
+ *
+ * If more than one of these "major" feature-test macros is defined,
+ * then the set of facilities provided (and namespace used) is the
+ * union of that specified by the relevant standards, and in case of
+ * conflict, the earlier standard in the above list has precedence (so
+ * if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version
+ * of rename() that's used is the POSIX one).  If none of the "major"
+ * feature-test macros is defined, _NETBSD_SOURCE is assumed.
+ *
+ * There are also "minor" feature-test macros, which enable extra
+ * functionality in addition to some base standard.  They should be
+ * defined along with one of the "major" macros.  The "minor" macros
+ * are:
+ *
+ * _REENTRANT
+ * _ISOC99_SOURCE
+ * _ISOC11_SOURCE
+ * _LARGEFILE_SOURCE		Large File Support
+ *		<http://ftp.sas.com/standards/large.file/x_open.20Mar96.html>
+ */
+
+#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
+#define _POSIX_C_SOURCE	1L
+#endif
+
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+    !defined(_XOPEN_SOURCE) && !defined(_NETBSD_SOURCE)
+#define _NETBSD_SOURCE 1
+#endif
+
+/* Compatibility for older version of autotools. */
+#if defined(_MINIX)
+#undef _MINIX
+#define _NETBSD_SOURCE 1
+#endif /* defined(__minix) */
+
+/* Never define _REENTRANT on Minix */
+#if !defined(__minix)
+#if ((_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500) && \
+    !defined(_REENTRANT)
+#define _REENTRANT
+#endif /* !defined(__minix) */
+#endif

Property changes on: lab4/.minix-src/include/sys/featuretest.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/filio.h
===================================================================
--- lab4/.minix-src/include/sys/filio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/filio.h	(revision 13)
@@ -0,0 +1,62 @@
+/*	$NetBSD: filio.h,v 1.10 2005/12/11 12:25:20 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)filio.h	8.1 (Berkeley) 3/28/94
+ */
+
+#ifndef	_SYS_FILIO_H_
+#define	_SYS_FILIO_H_
+
+#include <sys/ioccom.h>
+
+/* Generic file-descriptor ioctl's. */
+#define	FIOCLEX		 _IO('f', 1)		/* set close on exec on fd */
+#define	FIONCLEX	 _IO('f', 2)		/* remove close on exec */
+#define	FIONREAD	_IOR('f', 127, int)	/* get # bytes to read */
+#define	FIONBIO		_IOW('f', 126, int)	/* set/clear non-blocking i/o */
+#define	FIOASYNC	_IOW('f', 125, int)	/* set/clear async i/o */
+#define	FIOSETOWN	_IOW('f', 124, int)	/* set owner */
+#define	FIOGETOWN	_IOR('f', 123, int)	/* get owner */
+#define	OFIOGETBMAP	_IOWR('f', 122, uint32_t) /* get underlying block no. */
+#define	FIOGETBMAP	_IOWR('f', 122, daddr_t) /* get underlying block no. */
+#define	FIONWRITE	_IOR('f', 121, int)	/* get # bytes outstanding
+						 * in send queue. */
+#define	FIONSPACE	_IOR('f', 120, int)	/* get space in send queue. */
+
+
+/* Ugly symbol for compatibility with other operating systems */
+#define	FIBMAP		FIOGETBMAP
+
+#endif /* !_SYS_FILIO_H_ */

Property changes on: lab4/.minix-src/include/sys/filio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/float_ieee754.h
===================================================================
--- lab4/.minix-src/include/sys/float_ieee754.h	(nonexistent)
+++ lab4/.minix-src/include/sys/float_ieee754.h	(revision 13)
@@ -0,0 +1,159 @@
+/*	$NetBSD: float_ieee754.h,v 1.11 2013/06/18 20:17:19 christos Exp $	*/
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)float.h	8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * NOTICE: This is not a standalone file.  To use it, #include it in
+ * your port's float.h header.
+ */
+
+#ifndef _SYS_FLOAT_IEEE754_H_
+#define _SYS_FLOAT_IEEE754_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+/*
+ * feature macro to test for IEEE754
+ */
+#define _FLOAT_IEEE754	1
+
+#if !defined(__ASSEMBLER__) && !defined(FLT_ROUNDS)
+__BEGIN_DECLS
+extern int __flt_rounds(void);
+__END_DECLS
+#define FLT_ROUNDS	__flt_rounds()
+#endif
+
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+    !defined(_XOPEN_SOURCE) || \
+    ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    ((_XOPEN_SOURCE  - 0) >= 600) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+#ifndef FLT_EVAL_METHOD
+#if __GNUC_PREREQ__(3, 3)
+#define FLT_EVAL_METHOD	__FLT_EVAL_METHOD__
+#endif /* GCC >= 3.3 */
+#endif /* defined(FLT_EVAL_METHOD) */
+#endif /* !defined(_ANSI_SOURCE) && ... */
+
+#if __GNUC_PREREQ__(3, 3)
+/*
+ * GCC 3,3 and later provide builtins for the FLT, DBL, and LDBL constants.
+ */
+#define FLT_RADIX	__FLT_RADIX__
+
+#define FLT_MANT_DIG	__FLT_MANT_DIG__
+#define FLT_EPSILON	__FLT_EPSILON__
+#define FLT_DIG		__FLT_DIG__
+#define FLT_MIN_EXP	__FLT_MIN_EXP__
+#define FLT_MIN		__FLT_MIN__
+#define FLT_MIN_10_EXP	__FLT_MIN_10_EXP__
+#define FLT_MAX_EXP	__FLT_MAX_EXP__
+#define FLT_MAX		__FLT_MAX__
+#define FLT_MAX_10_EXP	__FLT_MAX_10_EXP__
+
+#define DBL_MANT_DIG	__DBL_MANT_DIG__
+#define DBL_EPSILON	__DBL_EPSILON__
+#define DBL_DIG		__DBL_DIG__
+#define DBL_MIN_EXP	__DBL_MIN_EXP__
+#define DBL_MIN		__DBL_MIN__
+#define DBL_MIN_10_EXP	__DBL_MIN_10_EXP__
+#define DBL_MAX_EXP	__DBL_MAX_EXP__
+#define DBL_MAX		__DBL_MAX__
+#define DBL_MAX_10_EXP	__DBL_MAX_10_EXP__
+#else /* GCC < 3.3 */
+#define FLT_RADIX	2		/* b */
+
+#define FLT_MANT_DIG	24		/* p */
+#define FLT_DIG		6		/* floor((p-1)*log10(b))+(b == 10) */
+#define FLT_MIN_EXP	(-125)		/* emin */
+#define FLT_MIN_10_EXP	(-37)		/* ceil(log10(b**(emin-1))) */
+#define FLT_MAX_EXP	128		/* emax */
+#define FLT_MAX_10_EXP	38		/* floor(log10((1-b**(-p))*b**emax)) */
+#if __STDC_VERSION__ >= 199901L
+#define FLT_EPSILON	0x1.0p-23F
+#define FLT_MIN		0x1.0p-126F
+#define FLT_MAX		0x1.fffffep+127F
+#else
+#define FLT_EPSILON	1.19209290E-7F	/* b**(1-p) */
+#define FLT_MIN		1.17549435E-38F	/* b**(emin-1) */
+#define FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */
+#endif
+
+#define DBL_MANT_DIG	53
+#define DBL_DIG		15
+#define DBL_MIN_EXP	(-1021)
+#define DBL_MIN_10_EXP	(-307)
+#define DBL_MAX_EXP	1024
+#define DBL_MAX_10_EXP	308
+
+#if __STDC_VERSION__ >= 199901L
+#define DBL_EPSILON	0x1.0p-52
+#define DBL_MIN		0x1.0p-1022
+#define DBL_MAX		0x1.fffffffffffffp+1023
+#else
+#define DBL_EPSILON	2.2204460492503131E-16
+#define DBL_MIN		2.2250738585072014E-308
+#define DBL_MAX		1.7976931348623157E+308
+#endif
+#endif /* GCC < 3.3 */
+/*
+ * If no extended-precision type is defined by the machine-dependent
+ * header including this, default to `long double' being double-precision.
+ */
+#ifndef LDBL_MANT_DIG
+#define LDBL_MANT_DIG	DBL_MANT_DIG
+#define LDBL_EPSILON	DBL_EPSILON
+#define LDBL_DIG	DBL_DIG
+#define LDBL_MIN_EXP	DBL_MIN_EXP
+#define LDBL_MIN	DBL_MIN
+#define LDBL_MIN_10_EXP	DBL_MIN_10_EXP
+#define LDBL_MAX_EXP	DBL_MAX_EXP
+#define LDBL_MAX	DBL_MAX
+#define LDBL_MAX_10_EXP	DBL_MAX_10_EXP
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+    !defined(_XOPEN_SOURCE) || \
+    ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    ((_XOPEN_SOURCE  - 0) >= 600) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+#if __GNUC_PREREQ__(3, 3)
+#define DECIMAL_DIG	__DECIMAL_DIG__
+#else
+#define DECIMAL_DIG	17		/* ceil((1+p*log10(b))-(b==10) */
+#endif
+#endif /* !defined(_ANSI_SOURCE) && ... */
+#endif /* LDBL_MANT_DIG */
+
+#endif	/* _SYS_FLOAT_IEEE754_H_ */

Property changes on: lab4/.minix-src/include/sys/float_ieee754.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/mbuf.h
===================================================================
--- lab4/.minix-src/include/sys/mbuf.h	(nonexistent)
+++ lab4/.minix-src/include/sys/mbuf.h	(revision 13)
@@ -0,0 +1,940 @@
+/*	$NetBSD: mbuf.h,v 1.158 2015/06/04 09:19:59 ozaki-r Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center and Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)mbuf.h	8.5 (Berkeley) 2/19/95
+ */
+
+#ifndef _SYS_MBUF_H_
+#define _SYS_MBUF_H_
+
+#ifdef _KERNEL_OPT
+#include "opt_mbuftrace.h"
+#endif
+
+#ifndef M_WAITOK
+#include <sys/malloc.h>
+#endif
+#include <sys/pool.h>
+#include <sys/queue.h>
+#if defined(_KERNEL)
+#include <sys/percpu_types.h>
+#endif /* defined(_KERNEL) */
+
+/* For offsetof() */
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/systm.h>
+#else
+#include <stddef.h>
+#endif
+
+#include <uvm/uvm_param.h>	/* for MIN_PAGE_SIZE */
+
+/*
+ * Mbufs are of a single size, MSIZE (machine/param.h), which
+ * includes overhead.  An mbuf may add a single "mbuf cluster" of size
+ * MCLBYTES (also in machine/param.h), which has no additional overhead
+ * and is used instead of the internal data area; this is done when
+ * at least MINCLSIZE of data must be stored.
+ */
+
+/* Packet tags structure */
+struct m_tag {
+	SLIST_ENTRY(m_tag)	m_tag_link;	/* List of packet tags */
+	uint16_t		m_tag_id;	/* Tag ID */
+	uint16_t		m_tag_len;	/* Length of data */
+};
+
+/* mbuf ownership structure */
+struct mowner {
+	char mo_name[16];		/* owner name (fxp0) */
+	char mo_descr[16];		/* owner description (input) */
+	LIST_ENTRY(mowner) mo_link;	/* */
+	struct percpu *mo_counters;
+};
+
+#define MOWNER_INIT(x, y) { .mo_name = x, .mo_descr = y }
+
+enum mowner_counter_index {
+	MOWNER_COUNTER_CLAIMS,		/* # of small mbuf claimed */
+	MOWNER_COUNTER_RELEASES,	/* # of small mbuf released */
+	MOWNER_COUNTER_CLUSTER_CLAIMS,	/* # of M_CLUSTER mbuf claimed */
+	MOWNER_COUNTER_CLUSTER_RELEASES,/* # of M_CLUSTER mbuf released */
+	MOWNER_COUNTER_EXT_CLAIMS,	/* # of M_EXT mbuf claimed */
+	MOWNER_COUNTER_EXT_RELEASES,	/* # of M_EXT mbuf released */
+
+	MOWNER_COUNTER_NCOUNTERS,
+};
+
+#if defined(_KERNEL)
+struct mowner_counter {
+	u_long mc_counter[MOWNER_COUNTER_NCOUNTERS];
+};
+#endif /* defined(_KERNEL) */
+
+/* userland-exported version of struct mowner */
+struct mowner_user {
+	char mo_name[16];		/* owner name (fxp0) */
+	char mo_descr[16];		/* owner description (input) */
+	LIST_ENTRY(mowner) mo_link;	/* unused padding; for compatibility */
+	u_long mo_counter[MOWNER_COUNTER_NCOUNTERS]; /* counters */
+};
+
+/*
+ * Macros for type conversion
+ * mtod(m,t) -	convert mbuf pointer to data pointer of correct type
+ */
+#define	mtod(m, t)	((t)((m)->m_data))
+
+/* header at beginning of each mbuf: */
+struct m_hdr {
+	struct	mbuf *mh_next;		/* next buffer in chain */
+	struct	mbuf *mh_nextpkt;	/* next chain in queue/record */
+	char   *mh_data;		/* location of data */
+	struct	mowner *mh_owner;	/* mbuf owner */
+	int	mh_len;			/* amount of data in this mbuf */
+	int	mh_flags;		/* flags; see below */
+	paddr_t	mh_paddr;		/* physical address of mbuf */
+	short	mh_type;		/* type of data in this mbuf */
+};
+
+/*
+ * record/packet header in first mbuf of chain; valid if M_PKTHDR set
+ *
+ * A note about csum_data: For the out-bound direction, the low 16 bits
+ * indicates the offset after the L4 header where the final L4 checksum value
+ * is to be stored and the high 16 bits is the length of the L3 header (the
+ * start of the data to be checksumed).  For the in-bound direction, it is only
+ * valid if the M_CSUM_DATA flag is set.  In this case, an L4 checksum has been
+ * calculated by hardware, but it is up to software to perform final
+ * verification.
+ *
+ * Note for in-bound TCP/UDP checksums, we expect the csum_data to NOT
+ * be bit-wise inverted (the final step in the calculation of an IP
+ * checksum) -- this is so we can accumulate the checksum for fragmented
+ * packets during reassembly.
+ */
+struct	pkthdr {
+	struct ifnet	*rcvif;			/* rcv interface */
+	SLIST_HEAD(packet_tags, m_tag) tags;	/* list of packet tags */
+	int		len;			/* total packet length */
+	int		csum_flags;		/* checksum flags */
+	uint32_t	csum_data;		/* checksum data */
+	u_int		segsz;			/* segment size */
+};
+
+/*
+ * Note: These bits are carefully arrange so that the compiler can have
+ * a prayer of generating a jump table.
+ */
+#define	M_CSUM_TCPv4		0x00000001	/* TCP header/payload */
+#define	M_CSUM_UDPv4		0x00000002	/* UDP header/payload */
+#define	M_CSUM_TCP_UDP_BAD	0x00000004	/* TCP/UDP checksum bad */
+#define	M_CSUM_DATA		0x00000008	/* consult csum_data */
+#define	M_CSUM_TCPv6		0x00000010	/* IPv6 TCP header/payload */
+#define	M_CSUM_UDPv6		0x00000020	/* IPv6 UDP header/payload */
+#define	M_CSUM_IPv4		0x00000040	/* IPv4 header */
+#define	M_CSUM_IPv4_BAD		0x00000080	/* IPv4 header checksum bad */
+#define	M_CSUM_TSOv4		0x00000100	/* TCPv4 segmentation offload */
+#define	M_CSUM_TSOv6		0x00000200	/* TCPv6 segmentation offload */
+
+/* Checksum-assist quirks: keep separate from jump-table bits. */
+#define	M_CSUM_NO_PSEUDOHDR	0x80000000	/* Rx csum_data does not include
+						 * the UDP/TCP pseudo-hdr, and
+						 * is not yet 1s-complemented.
+						 */
+
+#define M_CSUM_BITS \
+    "\20\1TCPv4\2UDPv4\3TCP_UDP_BAD\4DATA\5TCPv6\6UDPv6\7IPv4\10IPv4_BAD" \
+    "\11TSOv4\12TSOv6\40NO_PSEUDOHDR"
+
+/*
+ * Macros for manipulating csum_data on outgoing packets.  These are
+ * used to pass information down from the L4/L3 to the L2.
+ */
+#define	M_CSUM_DATA_IPv4_IPHL(x)	((x) >> 16)
+#define	M_CSUM_DATA_IPv4_OFFSET(x)	((x) & 0xffff)
+
+/*
+ * Macros for M_CSUM_TCPv6 and M_CSUM_UDPv6
+ *
+ * M_CSUM_DATA_IPv6_HL: length of ip6_hdr + ext header.
+ * ie. offset of UDP/TCP header in the packet.
+ *
+ * M_CSUM_DATA_IPv6_OFFSET: offset of the checksum field in UDP/TCP header. 
+ */
+
+#define	M_CSUM_DATA_IPv6_HL(x)		((x) >> 16)
+#define	M_CSUM_DATA_IPv6_HL_SET(x, v)	(x) = ((x) & 0xffff) | ((v) << 16)
+#define	M_CSUM_DATA_IPv6_OFFSET(x)	((x) & 0xffff)
+
+/*
+ * Max # of pages we can attach to m_ext.  This is carefully chosen
+ * to be able to handle SOSEND_LOAN_CHUNK with our minimum sized page.
+ */
+#ifdef MIN_PAGE_SIZE
+#define	M_EXT_MAXPAGES		((65536 / MIN_PAGE_SIZE) + 1)
+#endif
+
+/* description of external storage mapped into mbuf, valid if M_EXT set */
+struct _m_ext_storage {
+	unsigned int ext_refcnt;
+	int ext_flags;
+	char *ext_buf;			/* start of buffer */
+	void (*ext_free)		/* free routine if not the usual */
+		(struct mbuf *, void *, size_t, void *);
+	void *ext_arg;			/* argument for ext_free */
+	size_t ext_size;		/* size of buffer, for ext_free */
+	union {
+		paddr_t extun_paddr;	/* physical address (M_EXT_CLUSTER) */
+					/* pages (M_EXT_PAGES) */
+	/*
+	 * XXX This is gross, but it doesn't really matter; this is
+	 * XXX overlaid on top of the mbuf data area.
+	 */
+#ifdef M_EXT_MAXPAGES
+		struct vm_page *extun_pgs[M_EXT_MAXPAGES];
+#endif
+	} ext_un;
+#define	ext_paddr	ext_un.extun_paddr
+#define	ext_pgs		ext_un.extun_pgs
+#ifdef DEBUG
+	const char *ext_ofile;
+	const char *ext_nfile;
+	int ext_oline;
+	int ext_nline;
+#endif
+};
+
+struct _m_ext {
+	struct mbuf *ext_ref;
+	struct _m_ext_storage ext_storage;
+};
+
+#define	M_PADDR_INVALID		POOL_PADDR_INVALID
+
+/*
+ * Definition of "struct mbuf".
+ * Don't change this without understanding how MHLEN/MLEN are defined.
+ */
+#define	MBUF_DEFINE(name, mhlen, mlen)					\
+	struct name {							\
+		struct	m_hdr m_hdr;					\
+		union {							\
+			struct {					\
+				struct	pkthdr MH_pkthdr;		\
+				union {					\
+					struct	_m_ext MH_ext;		\
+					char MH_databuf[(mhlen)];	\
+				} MH_dat;				\
+			} MH;						\
+			char M_databuf[(mlen)];				\
+		} M_dat;						\
+	}
+#define	m_next		m_hdr.mh_next
+#define	m_len		m_hdr.mh_len
+#define	m_data		m_hdr.mh_data
+#define	m_owner		m_hdr.mh_owner
+#define	m_type		m_hdr.mh_type
+#define	m_flags		m_hdr.mh_flags
+#define	m_nextpkt	m_hdr.mh_nextpkt
+#define	m_paddr		m_hdr.mh_paddr
+#define	m_pkthdr	M_dat.MH.MH_pkthdr
+#define	m_ext_storage	M_dat.MH.MH_dat.MH_ext.ext_storage
+#define	m_ext_ref	M_dat.MH.MH_dat.MH_ext.ext_ref
+#define	m_ext		m_ext_ref->m_ext_storage
+#define	m_pktdat	M_dat.MH.MH_dat.MH_databuf
+#define	m_dat		M_dat.M_databuf
+
+/*
+ * Dummy mbuf structure to calculate the right values for MLEN/MHLEN, taking
+ * into account inter-structure padding.
+ */
+MBUF_DEFINE(_mbuf_dummy, 1, 1);
+
+/* normal data len */
+#define	MLEN		(MSIZE - offsetof(struct _mbuf_dummy, m_dat))
+/* data len w/pkthdr */
+#define	MHLEN		(MSIZE - offsetof(struct _mbuf_dummy, m_pktdat))
+
+#define	MINCLSIZE	(MHLEN+MLEN+1)	/* smallest amount to put in cluster */
+#define	M_MAXCOMPRESS	(MHLEN / 2)	/* max amount to copy for compression */
+
+/*
+ * The *real* struct mbuf
+ */
+MBUF_DEFINE(mbuf, MHLEN, MLEN);
+
+/* mbuf flags */
+#define	M_EXT		0x00000001	/* has associated external storage */
+#define	M_PKTHDR	0x00000002	/* start of record */
+#define	M_EOR		0x00000004	/* end of record */
+#define	M_PROTO1	0x00000008	/* protocol-specific */
+
+/* mbuf pkthdr flags, also in m_flags */
+#define	M_AUTHIPHDR	0x00000010	/* data origin authentication for
+					 * IP header */
+#define	M_DECRYPTED	0x00000020	/* confidentiality */
+#define	M_LOOP		0x00000040	/* for Mbuf statistics */
+#define	M_AUTHIPDGM     0x00000080	/* data origin authentication */
+#define	M_BCAST		0x00000100	/* send/received as link-level
+					 * broadcast */
+#define	M_MCAST		0x00000200	/* send/received as link-level
+					 * multicast */
+#define	M_CANFASTFWD	0x00000400	/* used by filters to indicate
+					 * packet can be fast-forwarded */
+#define	M_ANYCAST6	0x00000800	/* received as IPv6 anycast */
+
+#define	M_LINK0		0x00001000	/* link layer specific flag */
+#define	M_LINK1		0x00002000	/* link layer specific flag */
+#define	M_LINK2		0x00004000	/* link layer specific flag */
+
+#define	M_LINK3		0x00008000	/* link layer specific flag */
+#define	M_LINK4		0x00010000	/* link layer specific flag */
+#define	M_LINK5		0x00020000	/* link layer specific flag */
+#define	M_LINK6		0x00040000	/* link layer specific flag */
+#define	M_LINK7		0x00080000	/* link layer specific flag */
+
+/* additional flags for M_EXT mbufs */
+#define	M_EXT_FLAGS	0xff000000
+#define	M_EXT_CLUSTER	0x01000000	/* ext is a cluster */
+#define	M_EXT_PAGES	0x02000000	/* ext_pgs is valid */
+#define	M_EXT_ROMAP	0x04000000	/* ext mapping is r-o at MMU */
+#define	M_EXT_RW	0x08000000	/* ext storage is writable */
+
+/* for source-level compatibility */
+#define	M_CLUSTER	M_EXT_CLUSTER
+
+#define M_FLAGS_BITS \
+    "\20\1EXT\2PKTHDR\3EOR\4PROTO1\5AUTHIPHDR\6DECRYPTED\7LOOP\10AUTHIPDGM" \
+    "\11BCAST\12MCAST\13CANFASTFWD\14ANYCAST6\15LINK0\16LINK1\17LINK2\20LINK3" \
+    "\21LINK4\22LINK5\23LINK6\24LINK7" \
+    "\31EXT_CLUSTER\32EXT_PAGES\33EXT_ROMAP\34EXT_RW"
+
+/* flags copied when copying m_pkthdr */
+#define	M_COPYFLAGS	(M_PKTHDR|M_EOR|M_BCAST|M_MCAST|M_CANFASTFWD|M_ANYCAST6|M_LINK0|M_LINK1|M_LINK2|M_AUTHIPHDR|M_DECRYPTED|M_LOOP|M_AUTHIPDGM)
+
+/* flag copied when shallow-copying external storage */
+#define	M_EXTCOPYFLAGS	(M_EXT|M_EXT_FLAGS)
+
+/* mbuf types */
+#define	MT_FREE		0	/* should be on free list */
+#define	MT_DATA		1	/* dynamic (data) allocation */
+#define	MT_HEADER	2	/* packet header */
+#define	MT_SONAME	3	/* socket name */
+#define	MT_SOOPTS	4	/* socket options */
+#define	MT_FTABLE	5	/* fragment reassembly header */
+#define MT_CONTROL	6	/* extra-data protocol message */
+#define MT_OOBDATA	7	/* expedited data  */
+
+#ifdef MBUFTYPES
+static const char * const mbuftypes[] = {
+	"mbfree",
+	"mbdata",
+	"mbheader",
+	"mbsoname",
+	"mbsopts",
+	"mbftable",
+	"mbcontrol",
+	"mboobdata",
+};
+#endif
+
+/* flags to m_get/MGET */
+#define	M_DONTWAIT	M_NOWAIT
+#define	M_WAIT		M_WAITOK
+
+#ifdef MBUFTRACE
+/*
+ * mbuf allocation tracing
+ */
+void mowner_init(struct mbuf *, int);
+void mowner_ref(struct mbuf *, int);
+void m_claim(struct mbuf *, struct mowner *);
+void mowner_revoke(struct mbuf *, bool, int);
+void mowner_attach(struct mowner *);
+void mowner_detach(struct mowner *);
+void m_claimm(struct mbuf *, struct mowner *);
+#else
+#define mowner_init(m, type)		do { } while (/* CONSTCOND */ 0)
+#define	mowner_ref(m, flags)		do { } while (/* CONSTCOND */ 0)
+#define	mowner_revoke(m, all, flags)	do { } while (/* CONSTCOND */ 0)
+#define	m_claim(m, mowner) 		do { } while (/* CONSTCOND */ 0)
+#define	mowner_attach(mo)		do { } while (/* CONSTCOND */ 0)
+#define	mowner_detach(mo)		do { } while (/* CONSTCOND */ 0)
+#define	m_claimm(m, mo)			do { } while (/* CONSTCOND */ 0)
+#endif
+
+#define	MCLAIM(m, mo)		m_claim((m), (mo))
+#define	MOWNER_ATTACH(mo)	mowner_attach(mo)
+#define	MOWNER_DETACH(mo)	mowner_detach(mo)
+
+/*
+ * mbuf allocation/deallocation macros:
+ *
+ *	MGET(struct mbuf *m, int how, int type)
+ * allocates an mbuf and initializes it to contain internal data.
+ *
+ *	MGETHDR(struct mbuf *m, int how, int type)
+ * allocates an mbuf and initializes it to contain a packet header
+ * and internal data.
+ *
+ * If 'how' is M_WAIT, these macros (and the corresponding functions)
+ * are guaranteed to return successfully.
+ */
+#define	MGET(m, how, type)	m = m_get((how), (type))
+#define	MGETHDR(m, how, type)	m = m_gethdr((how), (type))
+
+#if defined(_KERNEL)
+#define	_M_
+/*
+ * Macros for tracking external storage associated with an mbuf.
+ */
+#ifdef DEBUG
+#define MCLREFDEBUGN(m, file, line)					\
+do {									\
+	(m)->m_ext.ext_nfile = (file);					\
+	(m)->m_ext.ext_nline = (line);					\
+} while (/* CONSTCOND */ 0)
+
+#define MCLREFDEBUGO(m, file, line)					\
+do {									\
+	(m)->m_ext.ext_ofile = (file);					\
+	(m)->m_ext.ext_oline = (line);					\
+} while (/* CONSTCOND */ 0)
+#else
+#define MCLREFDEBUGN(m, file, line)
+#define MCLREFDEBUGO(m, file, line)
+#endif
+
+#define	MCLINITREFERENCE(m)						\
+do {									\
+	KDASSERT(((m)->m_flags & M_EXT) == 0);				\
+	(m)->m_ext_ref = (m);						\
+	(m)->m_ext.ext_refcnt = 1;					\
+	MCLREFDEBUGO((m), __FILE__, __LINE__);				\
+	MCLREFDEBUGN((m), NULL, 0);					\
+} while (/* CONSTCOND */ 0)
+
+/*
+ * Macros for mbuf external storage.
+ *
+ * MCLGET allocates and adds an mbuf cluster to a normal mbuf;
+ * the flag M_EXT is set upon success.
+ *
+ * MEXTMALLOC allocates external storage and adds it to
+ * a normal mbuf; the flag M_EXT is set upon success.
+ *
+ * MEXTADD adds pre-allocated external storage to
+ * a normal mbuf; the flag M_EXT is set upon success.
+ */
+
+#define	_MCLGET(m, pool_cache, size, how)				\
+do {									\
+	(m)->m_ext_storage.ext_buf = (char *)				\
+	    pool_cache_get_paddr((pool_cache),				\
+		(how) == M_WAIT ? (PR_WAITOK|PR_LIMITFAIL) : 0,		\
+		&(m)->m_ext_storage.ext_paddr);				\
+	if ((m)->m_ext_storage.ext_buf != NULL) {			\
+		MCLINITREFERENCE(m);					\
+		(m)->m_data = (m)->m_ext.ext_buf;			\
+		(m)->m_flags = ((m)->m_flags & ~M_EXTCOPYFLAGS) |	\
+				M_EXT|M_CLUSTER|M_EXT_RW;		\
+		(m)->m_ext.ext_flags = 0;				\
+		(m)->m_ext.ext_size = (size);				\
+		(m)->m_ext.ext_free = NULL;				\
+		(m)->m_ext.ext_arg = (pool_cache);			\
+		/* ext_paddr initialized above */			\
+		mowner_ref((m), M_EXT|M_CLUSTER);			\
+	}								\
+} while (/* CONSTCOND */ 0)
+
+/*
+ * The standard mbuf cluster pool.
+ */
+#define	MCLGET(m, how)	_MCLGET((m), mcl_cache, MCLBYTES, (how))
+
+#define	MEXTMALLOC(m, size, how)					\
+do {									\
+	(m)->m_ext_storage.ext_buf = (char *)				\
+	    malloc((size), mbtypes[(m)->m_type], (how));		\
+	if ((m)->m_ext_storage.ext_buf != NULL) {			\
+		MCLINITREFERENCE(m);					\
+		(m)->m_data = (m)->m_ext.ext_buf;			\
+		(m)->m_flags = ((m)->m_flags & ~M_EXTCOPYFLAGS) |	\
+				M_EXT|M_EXT_RW;				\
+		(m)->m_ext.ext_flags = 0;				\
+		(m)->m_ext.ext_size = (size);				\
+		(m)->m_ext.ext_free = NULL;				\
+		(m)->m_ext.ext_arg = NULL;				\
+		mowner_ref((m), M_EXT);					\
+	}								\
+} while (/* CONSTCOND */ 0)
+
+#define	MEXTADD(m, buf, size, type, free, arg)				\
+do {									\
+	MCLINITREFERENCE(m);						\
+	(m)->m_data = (m)->m_ext.ext_buf = (char *)(buf);		\
+	(m)->m_flags = ((m)->m_flags & ~M_EXTCOPYFLAGS) | M_EXT;	\
+	(m)->m_ext.ext_flags = 0;					\
+	(m)->m_ext.ext_size = (size);					\
+	(m)->m_ext.ext_free = (free);					\
+	(m)->m_ext.ext_arg = (arg);					\
+	mowner_ref((m), M_EXT);						\
+} while (/* CONSTCOND */ 0)
+
+/*
+ * Reset the data pointer on an mbuf.
+ */
+#define	MRESETDATA(m)							\
+do {									\
+	if ((m)->m_flags & M_EXT)					\
+		(m)->m_data = (m)->m_ext.ext_buf;			\
+	else if ((m)->m_flags & M_PKTHDR)				\
+		(m)->m_data = (m)->m_pktdat;				\
+	else								\
+		(m)->m_data = (m)->m_dat;				\
+} while (/* CONSTCOND */ 0)
+
+/*
+ * MFREE(struct mbuf *m, struct mbuf *n)
+ * Free a single mbuf and associated external storage.
+ * Place the successor, if any, in n.
+ */
+#define	MFREE(m, n)							\
+	mowner_revoke((m), 1, (m)->m_flags);				\
+	mbstat_type_add((m)->m_type, -1);				\
+	if ((m)->m_flags & M_PKTHDR)					\
+		m_tag_delete_chain((m), NULL);				\
+	(n) = (m)->m_next;						\
+	if ((m)->m_flags & M_EXT) {					\
+		m_ext_free((m));						\
+	} else {							\
+		KASSERT((m)->m_type != MT_FREE);				\
+		(m)->m_type = MT_FREE;					\
+		pool_cache_put(mb_cache, (m));				\
+	}								\
+
+/*
+ * Copy mbuf pkthdr from `from' to `to'.
+ * `from' must have M_PKTHDR set, and `to' must be empty.
+ */
+#define	M_COPY_PKTHDR(to, from)						\
+do {									\
+	(to)->m_pkthdr = (from)->m_pkthdr;				\
+	(to)->m_flags = (from)->m_flags & M_COPYFLAGS;			\
+	SLIST_INIT(&(to)->m_pkthdr.tags);				\
+	m_tag_copy_chain((to), (from));					\
+	(to)->m_data = (to)->m_pktdat;					\
+} while (/* CONSTCOND */ 0)
+
+/*
+ * Move mbuf pkthdr from `from' to `to'.
+ * `from' must have M_PKTHDR set, and `to' must be empty.
+ */
+#define	M_MOVE_PKTHDR(to, from)	m_move_pkthdr(to, from)
+
+/*
+ * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place
+ * an object of the specified size at the end of the mbuf, longword aligned.
+ */
+#define	M_ALIGN(m, len)							\
+do {									\
+	(m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1);		\
+} while (/* CONSTCOND */ 0)
+
+/*
+ * As above, for mbufs allocated with m_gethdr/MGETHDR
+ * or initialized by M_COPY_PKTHDR.
+ */
+#define	MH_ALIGN(m, len)						\
+do {									\
+	(m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1);		\
+} while (/* CONSTCOND */ 0)
+
+/*
+ * Determine if an mbuf's data area is read-only.  This is true
+ * if external storage is read-only mapped, or not marked as R/W,
+ * or referenced by more than one mbuf.
+ */
+#define	M_READONLY(m)							\
+	(((m)->m_flags & M_EXT) != 0 &&					\
+	  (((m)->m_flags & (M_EXT_ROMAP|M_EXT_RW)) != M_EXT_RW ||	\
+	  (m)->m_ext.ext_refcnt > 1))
+
+#define	M_UNWRITABLE(__m, __len)					\
+	((__m)->m_len < (__len) || M_READONLY((__m)))
+/*
+ * Determine if an mbuf's data area is read-only at the MMU.
+ */
+#define	M_ROMAP(m)							\
+	(((m)->m_flags & (M_EXT|M_EXT_ROMAP)) == (M_EXT|M_EXT_ROMAP))
+
+/*
+ * Compute the amount of space available
+ * before the current start of data in an mbuf.
+ */
+#define	_M_LEADINGSPACE(m)						\
+	((m)->m_flags & M_EXT ? (m)->m_data - (m)->m_ext.ext_buf :	\
+	 (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat :	\
+	 (m)->m_data - (m)->m_dat)
+
+#define	M_LEADINGSPACE(m)						\
+	(M_READONLY((m)) ? 0 : _M_LEADINGSPACE((m)))
+
+/*
+ * Compute the amount of space available
+ * after the end of data in an mbuf.
+ */
+#define	_M_TRAILINGSPACE(m)						\
+	((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size - \
+	 ((m)->m_data + (m)->m_len) :					\
+	 &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
+
+#define	M_TRAILINGSPACE(m)						\
+	(M_READONLY((m)) ? 0 : _M_TRAILINGSPACE((m)))
+
+/*
+ * Compute the address of an mbuf's data area.
+ */
+#define	M_BUFADDR(m)							\
+	(((m)->m_flags & M_PKTHDR) ? (m)->m_pktdat : (m)->m_dat)
+
+/*
+ * Compute the offset of the beginning of the data buffer of a non-ext
+ * mbuf.
+ */
+#define	M_BUFOFFSET(m)							\
+	(((m)->m_flags & M_PKTHDR) ?					\
+	 offsetof(struct mbuf, m_pktdat) : offsetof(struct mbuf, m_dat))
+
+/*
+ * Arrange to prepend space of size plen to mbuf m.
+ * If a new mbuf must be allocated, how specifies whether to wait.
+ * If how is M_DONTWAIT and allocation fails, the original mbuf chain
+ * is freed and m is set to NULL.
+ */
+#define	M_PREPEND(m, plen, how)						\
+do {									\
+	if (M_LEADINGSPACE(m) >= (plen)) {				\
+		(m)->m_data -= (plen);					\
+		(m)->m_len += (plen);					\
+	} else								\
+		(m) = m_prepend((m), (plen), (how));			\
+	if ((m) && (m)->m_flags & M_PKTHDR)				\
+		(m)->m_pkthdr.len += (plen);				\
+} while (/* CONSTCOND */ 0)
+
+/* change mbuf to new type */
+#define MCHTYPE(m, t)							\
+do {									\
+	KASSERT((t) != MT_FREE);					\
+	mbstat_type_add((m)->m_type, -1);				\
+	mbstat_type_add(t, 1);						\
+	(m)->m_type = t;						\
+} while (/* CONSTCOND */ 0)
+
+/* length to m_copy to copy all */
+#define	M_COPYALL	-1
+
+/* compatibility with 4.3 */
+#define  m_copy(m, o, l)	m_copym((m), (o), (l), M_DONTWAIT)
+
+/*
+ * Allow drivers and/or protocols to use the rcvif member of
+ * PKTHDR mbufs to store private context information.
+ */
+#define	M_GETCTX(m, t)		((t)(m)->m_pkthdr.rcvif)
+#define	M_SETCTX(m, c)		((void)((m)->m_pkthdr.rcvif = (void *)(c)))
+
+#endif /* defined(_KERNEL) */
+
+/*
+ * Simple mbuf queueing system
+ *
+ * this is basically a SIMPLEQ adapted to mbuf use (ie using
+ * m_nextpkt instead of field.sqe_next).
+ *
+ * m_next is ignored, so queueing chains of mbufs is possible
+ */
+#define MBUFQ_HEAD(name)					\
+struct name {							\
+	struct mbuf *mq_first;					\
+	struct mbuf **mq_last;					\
+}
+
+#define MBUFQ_INIT(q)		do {				\
+	(q)->mq_first = NULL;					\
+	(q)->mq_last = &(q)->mq_first;				\
+} while (/*CONSTCOND*/0)
+
+#define MBUFQ_ENQUEUE(q, m)	do {				\
+	(m)->m_nextpkt = NULL;					\
+	*(q)->mq_last = (m);					\
+	(q)->mq_last = &(m)->m_nextpkt;				\
+} while (/*CONSTCOND*/0)
+
+#define MBUFQ_PREPEND(q, m)	do {				\
+	if (((m)->m_nextpkt = (q)->mq_first) == NULL)		\
+		(q)->mq_last = &(m)->m_nextpkt;			\
+	(q)->mq_first = (m);					\
+} while (/*CONSTCOND*/0)
+
+#define MBUFQ_DEQUEUE(q, m)	do {				\
+	if (((m) = (q)->mq_first) != NULL) { 			\
+		if (((q)->mq_first = (m)->m_nextpkt) == NULL)	\
+			(q)->mq_last = &(q)->mq_first;		\
+		else						\
+			(m)->m_nextpkt = NULL;			\
+	}							\
+} while (/*CONSTCOND*/0)
+
+#define MBUFQ_DRAIN(q)		do {				\
+	struct mbuf *__m0;					\
+	while ((__m0 = (q)->mq_first) != NULL) {		\
+		(q)->mq_first = __m0->m_nextpkt;		\
+		m_freem(__m0);					\
+	}							\
+	(q)->mq_last = &(q)->mq_first;				\
+} while (/*CONSTCOND*/0)
+
+#define MBUFQ_FIRST(q)		((q)->mq_first)
+#define MBUFQ_NEXT(m)		((m)->m_nextpkt)
+#define MBUFQ_LAST(q)		(*(q)->mq_last)
+
+/*
+ * Mbuf statistics.
+ * For statistics related to mbuf and cluster allocations, see also the
+ * pool headers (mb_cache and mcl_cache).
+ */
+struct mbstat {
+	u_long	_m_spare;	/* formerly m_mbufs */
+	u_long	_m_spare1;	/* formerly m_clusters */
+	u_long	_m_spare2;	/* spare field */
+	u_long	_m_spare3;	/* formely m_clfree - free clusters */
+	u_long	m_drops;	/* times failed to find space */
+	u_long	m_wait;		/* times waited for space */
+	u_long	m_drain;	/* times drained protocols for space */
+	u_short	m_mtypes[256];	/* type specific mbuf allocations */
+};
+
+struct mbstat_cpu {
+	u_int	m_mtypes[256];	/* type specific mbuf allocations */
+};
+
+/*
+ * Mbuf sysctl variables.
+ */
+#define	MBUF_MSIZE		1	/* int: mbuf base size */
+#define	MBUF_MCLBYTES		2	/* int: mbuf cluster size */
+#define	MBUF_NMBCLUSTERS	3	/* int: limit on the # of clusters */
+#define	MBUF_MBLOWAT		4	/* int: mbuf low water mark */
+#define	MBUF_MCLLOWAT		5	/* int: mbuf cluster low water mark */
+#define	MBUF_STATS		6	/* struct: mbstat */
+#define	MBUF_MOWNERS		7	/* struct: m_owner[] */
+#define	MBUF_MAXID		8	/* number of valid MBUF ids */
+
+#define	CTL_MBUF_NAMES {						\
+	{ 0, 0 },							\
+	{ "msize", CTLTYPE_INT },					\
+	{ "mclbytes", CTLTYPE_INT },					\
+	{ "nmbclusters", CTLTYPE_INT },					\
+	{ "mblowat", CTLTYPE_INT },					\
+	{ "mcllowat", CTLTYPE_INT },					\
+	{ 0 /* "stats" */, CTLTYPE_STRUCT },				\
+	{ 0 /* "mowners" */, CTLTYPE_STRUCT },				\
+}
+
+#ifdef	_KERNEL
+extern struct mbstat mbstat;
+extern int	nmbclusters;		/* limit on the # of clusters */
+extern int	mblowat;		/* mbuf low water mark */
+extern int	mcllowat;		/* mbuf cluster low water mark */
+extern int	max_linkhdr;		/* largest link-level header */
+extern int	max_protohdr;		/* largest protocol header */
+extern int	max_hdr;		/* largest link+protocol header */
+extern int	max_datalen;		/* MHLEN - max_hdr */
+extern const int msize;			/* mbuf base size */
+extern const int mclbytes;		/* mbuf cluster size */
+extern pool_cache_t mb_cache;
+extern pool_cache_t mcl_cache;
+#ifdef MBUFTRACE
+LIST_HEAD(mownerhead, mowner);
+extern struct mownerhead mowners;
+extern struct mowner unknown_mowners[];
+extern struct mowner revoked_mowner;
+#endif
+
+MALLOC_DECLARE(M_MBUF);
+MALLOC_DECLARE(M_SONAME);
+
+struct	mbuf *m_copym(struct mbuf *, int, int, int);
+struct	mbuf *m_copypacket(struct mbuf *, int);
+struct	mbuf *m_devget(char *, int, int, struct ifnet *,
+			    void (*copy)(const void *, void *, size_t));
+struct	mbuf *m_dup(struct mbuf *, int, int, int);
+struct	mbuf *m_free(struct mbuf *);
+struct	mbuf *m_get(int, int);
+struct	mbuf *m_getclr(int, int);
+struct	mbuf *m_gethdr(int, int);
+struct	mbuf *m_prepend(struct mbuf *,int, int);
+struct	mbuf *m_pulldown(struct mbuf *, int, int, int *);
+struct	mbuf *m_pullup(struct mbuf *, int);
+struct	mbuf *m_copyup(struct mbuf *, int, int);
+struct	mbuf *m_split(struct mbuf *,int, int);
+struct	mbuf *m_getptr(struct mbuf *, int, int *);
+void	m_adj(struct mbuf *, int);
+struct	mbuf *m_defrag(struct mbuf *, int);
+int	m_apply(struct mbuf *, int, int,
+		int (*)(void *, void *, unsigned int), void *);
+void	m_cat(struct mbuf *,struct mbuf *);
+void	m_clget(struct mbuf *, int);
+int	m_mballoc(int, int);
+void	m_copyback(struct mbuf *, int, int, const void *);
+struct	mbuf *m_copyback_cow(struct mbuf *, int, int, const void *, int);
+int 	m_makewritable(struct mbuf **, int, int, int);
+struct	mbuf *m_getcl(int, int, int);
+void	m_copydata(struct mbuf *, int, int, void *);
+void	m_freem(struct mbuf *);
+void	m_reclaim(void *, int);
+void	mbinit(void);
+void	m_ext_free(struct mbuf *);
+char *	m_mapin(struct mbuf *);
+void	m_move_pkthdr(struct mbuf *, struct mbuf *);
+
+bool	m_ensure_contig(struct mbuf **, int);
+struct mbuf *m_add(struct mbuf *, struct mbuf *);
+void	m_align(struct mbuf *, int);
+int	m_append(struct mbuf *, int, const void *);
+
+/* Inline routines. */
+static __inline u_int m_length(const struct mbuf *) __unused;
+
+/* Statistics */
+void mbstat_type_add(int, int);
+
+/* Packet tag routines */
+struct	m_tag *m_tag_get(int, int, int);
+void	m_tag_free(struct m_tag *);
+void	m_tag_prepend(struct mbuf *, struct m_tag *);
+void	m_tag_unlink(struct mbuf *, struct m_tag *);
+void	m_tag_delete(struct mbuf *, struct m_tag *);
+void	m_tag_delete_chain(struct mbuf *, struct m_tag *);
+void	m_tag_delete_nonpersistent(struct mbuf *);
+struct	m_tag *m_tag_find(const struct mbuf *, int, struct m_tag *);
+struct	m_tag *m_tag_copy(struct m_tag *);
+int	m_tag_copy_chain(struct mbuf *, struct mbuf *);
+void	m_tag_init(struct mbuf *);
+struct	m_tag *m_tag_first(struct mbuf *);
+struct	m_tag *m_tag_next(struct mbuf *, struct m_tag *);
+
+/* Packet tag types */
+#define PACKET_TAG_NONE				0  /* Nothing */
+#define PACKET_TAG_VLAN				1  /* VLAN ID */
+#define PACKET_TAG_ENCAP			2  /* encapsulation data */
+#define PACKET_TAG_ESP				3  /* ESP information */
+#define PACKET_TAG_PF				11 /* packet filter */
+#define PACKET_TAG_ALTQ_QID			12 /* ALTQ queue id */
+
+#define PACKET_TAG_IPSEC_IN_CRYPTO_DONE		16
+#define PACKET_TAG_IPSEC_IN_DONE		17
+#define PACKET_TAG_IPSEC_OUT_DONE		18
+#define	PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED	19  /* NIC IPsec crypto req'ed */
+#define	PACKET_TAG_IPSEC_IN_COULD_DO_CRYPTO	20  /* NIC notifies IPsec */
+#define	PACKET_TAG_IPSEC_PENDING_TDB		21  /* Reminder to do IPsec */
+
+#define	PACKET_TAG_IPSEC_SOCKET			22 /* IPSEC socket ref */
+#define	PACKET_TAG_IPSEC_HISTORY		23 /* IPSEC history */
+
+#define	PACKET_TAG_IPSEC_NAT_T_PORTS		25 /* two uint16_t */
+
+#define	PACKET_TAG_INET6			26 /* IPv6 info */
+
+#define	PACKET_TAG_ECO_RETRYPARMS		27 /* Econet retry parameters */
+
+#define	PACKET_TAG_TUNNEL_INFO			28 /* tunnel identification and
+						    * protocol callback, for
+						    * loop detection/recovery
+						    */
+
+#define	PACKET_TAG_MPLS				29 /* Indicate it's for MPLS */
+
+/*
+ * Return the number of bytes in the mbuf chain, m.
+ */
+static __inline u_int
+m_length(const struct mbuf *m)
+{
+	const struct mbuf *m0;
+	u_int pktlen;
+
+	if ((m->m_flags & M_PKTHDR) != 0)
+		return m->m_pkthdr.len;
+
+	pktlen = 0;
+	for (m0 = m; m0 != NULL; m0 = m0->m_next)
+		pktlen += m0->m_len;
+	return pktlen;
+}
+
+void m_print(const struct mbuf *, const char *, void (*)(const char *, ...)
+    __printflike(1, 2));
+
+#endif /* _KERNEL */
+#endif /* !_SYS_MBUF_H_ */

Property changes on: lab4/.minix-src/include/sys/mbuf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/flashio.h
===================================================================
--- lab4/.minix-src/include/sys/flashio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/flashio.h	(revision 13)
@@ -0,0 +1,118 @@
+/*	$NetBSD: flashio.h,v 1.4 2011/06/28 20:49:43 ahoka Exp $	*/
+
+/*-
+ * Copyright (c) 2011 Department of Software Engineering,
+ *		      University of Szeged, Hungary
+ * Copyright (c) 2011 Adam Hoka <ahoka@NetBSD.org>
+ * Copyright (c) 2010 David Tengeri <dtengeri@inf.u-szeged.hu>
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by the Department of Software Engineering, University of Szeged, Hungary
+ *
+ * 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.
+ */
+
+#ifndef _FLASHIO_H_
+#define _FLASHIO_H_
+
+#include <sys/ioctl.h>
+
+/* this header may be used fron the kernel */
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/types.h>
+#else
+#include <stdint.h>
+#include <stdbool.h>
+#endif
+
+enum {
+	FLASH_ERASE_DONE 	= 0x0,
+	FLASH_ERASE_FAILED	= 0x1
+};
+
+enum {
+	FLASH_TYPE_UNKNOWN	= 0x0,
+	FLASH_TYPE_NOR		= 0x1,
+	FLASH_TYPE_NAND		= 0x2
+};
+
+/* public userspace API */
+
+/* common integer type to address flash */
+typedef int64_t flash_off_t;
+typedef uint64_t flash_size_t;
+typedef uint64_t flash_addr_t;
+
+/**
+ * struct erase_params - for ioctl erase call
+ * @addr: start address of the erase
+ * @len: length of the erase
+ */
+struct flash_erase_params {
+	flash_off_t ep_addr;
+	flash_off_t ep_len;
+};
+
+struct flash_badblock_params {
+	flash_off_t bbp_addr;
+	bool bbp_isbad;
+};
+
+struct flash_info_params {
+	flash_off_t ip_flash_size;
+	flash_size_t ip_page_size;
+	flash_size_t ip_erase_size;
+	uint8_t ip_flash_type;
+};
+
+struct flash_dump_params {
+	flash_off_t dp_block;
+	flash_off_t dp_len;
+	uint8_t *dp_buf;
+};
+
+enum {
+	FLASH_IOCTL_ERASE_BLOCK,
+	FLASH_IOCTL_DUMP,
+	FLASH_IOCTL_GET_INFO,
+	FLASH_IOCTL_BLOCK_ISBAD,
+	FLASH_IOCTL_BLOCK_MARKBAD
+};
+
+#define FLASH_ERASE_BLOCK 	\
+	_IOW('&', FLASH_IOCTL_ERASE_BLOCK, struct flash_erase_params)
+
+#define FLASH_DUMP		\
+	_IOWR('&', FLASH_IOCTL_DUMP, struct flash_dump_params)
+
+#define FLASH_GET_INFO		\
+	_IOWR('&', FLASH_IOCTL_GET_INFO, struct flash_info_params)
+
+#define FLASH_BLOCK_ISBAD 	\
+	_IOWR('&', FLASH_IOCTL_BLOCK_ISBAD, struct flash_badblock_params)
+
+#define FLASH_BLOCK_MARKBAD	\
+	_IOW('&', FLASH_IOCTL_BLOCK_MARKBAD, struct flash_badblock_params)
+
+#endif
+

Property changes on: lab4/.minix-src/include/sys/flashio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/gpio.h
===================================================================
--- lab4/.minix-src/include/sys/gpio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/gpio.h	(revision 13)
@@ -0,0 +1,117 @@
+/* $NetBSD: gpio.h,v 1.14 2015/09/06 06:01:02 dholland Exp $ */
+/*	$OpenBSD: gpio.h,v 1.7 2008/11/26 14:51:20 mbalmer Exp $	*/
+/*
+ * Copyright (c) 2009, 2011 Marc Balmer <marc@msys.ch>
+ * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SYS_GPIO_H_
+#define _SYS_GPIO_H_
+
+#include <sys/ioccom.h>
+#include <sys/time.h>
+
+/* GPIO pin states */
+#define GPIO_PIN_LOW		0x00	/* low level (logical 0) */
+#define GPIO_PIN_HIGH		0x01	/* high level (logical 1) */
+
+/* Max name length of a pin */
+#define GPIOMAXNAME		64
+
+/* GPIO pin configuration flags */
+#define GPIO_PIN_INPUT		0x0001	/* input direction */
+#define GPIO_PIN_OUTPUT		0x0002	/* output direction */
+#define GPIO_PIN_INOUT		0x0004	/* bi-directional */
+#define GPIO_PIN_OPENDRAIN	0x0008	/* open-drain output */
+#define GPIO_PIN_PUSHPULL	0x0010	/* push-pull output */
+#define GPIO_PIN_TRISTATE	0x0020	/* output disabled */
+#define GPIO_PIN_PULLUP		0x0040	/* internal pull-up enabled */
+#define GPIO_PIN_PULLDOWN	0x0080	/* internal pull-down enabled */
+#define GPIO_PIN_INVIN		0x0100	/* invert input */
+#define GPIO_PIN_INVOUT		0x0200	/* invert output */
+#define GPIO_PIN_USER		0x0400	/* user != 0 can access */
+#define GPIO_PIN_PULSATE	0x0800	/* pulsate in hardware */
+#define GPIO_PIN_SET		0x8000	/* set for securelevel access */
+
+/* GPIO controller description */
+struct gpio_info {
+	int gpio_npins;		/* total number of pins available */
+};
+
+/* GPIO pin request (read/write/toggle) */
+struct gpio_req {
+	char		gp_name[GPIOMAXNAME];	/* pin name */
+	int		gp_pin;			/* pin number */
+	int		gp_value;		/* value */
+};
+
+/* GPIO pin configuration */
+struct gpio_set {
+	char	gp_name[GPIOMAXNAME];
+	int	gp_pin;
+	int	gp_caps;
+	int	gp_flags;
+	char	gp_name2[GPIOMAXNAME];	/* new name */
+};
+
+/* Attach device drivers that use GPIO pins */
+struct gpio_attach {
+	char		ga_dvname[16];	/* device name */
+	int		ga_offset;	/* pin number */
+	uint32_t	ga_mask;	/* binary mask */
+	uint32_t	ga_flags;	/* driver dependent flags */
+};
+
+/* gpio(4) API */
+#define GPIOINFO		_IOR('G', 0, struct gpio_info)
+#define GPIOSET			_IOWR('G', 5, struct gpio_set)
+#define GPIOUNSET		_IOWR('G', 6, struct gpio_set)
+#define GPIOREAD		_IOWR('G', 7, struct gpio_req)
+#define GPIOWRITE		_IOWR('G', 8, struct gpio_req)
+#define GPIOTOGGLE		_IOWR('G', 9, struct gpio_req)
+#define GPIOATTACH		_IOWR('G', 10, struct gpio_attach)
+
+#ifdef COMPAT_50
+/* Old structure to attach/detach devices */
+struct gpio_attach50 {
+	char		ga_dvname[16];	/* device name */
+	int		ga_offset;	/* pin number */
+	uint32_t	ga_mask;	/* binary mask */
+};
+
+/* GPIO pin control (old API) */
+struct gpio_pin_ctl {
+	int gp_pin;		/* pin number */
+	int gp_caps;		/* pin capabilities (read-only) */
+	int gp_flags;		/* pin configuration flags */
+};
+
+/* GPIO pin operation (read/write/toggle) (old API) */
+struct gpio_pin_op {
+	int gp_pin;		/* pin number */
+	int gp_value;		/* value */
+};
+
+/* the old API */
+#define GPIOPINREAD		_IOWR('G', 1, struct gpio_pin_op)
+#define GPIOPINWRITE		_IOWR('G', 2, struct gpio_pin_op)
+#define GPIOPINTOGGLE		_IOWR('G', 3, struct gpio_pin_op)
+#define GPIOPINCTL		_IOWR('G', 4, struct gpio_pin_ctl)
+#define GPIOATTACH50		_IOWR('G', 10, struct gpio_attach50)
+#define GPIODETACH50		_IOWR('G', 11, struct gpio_attach50)
+#define GPIODETACH		_IOWR('G', 11, struct gpio_attach)
+#endif	/* COMPAT_50 */
+
+#endif	/* !_SYS_GPIO_H_ */

Property changes on: lab4/.minix-src/include/sys/gpio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/gcq.h
===================================================================
--- lab4/.minix-src/include/sys/gcq.h	(nonexistent)
+++ lab4/.minix-src/include/sys/gcq.h	(revision 13)
@@ -0,0 +1,463 @@
+/* $NetBSD: gcq.h,v 1.2 2007/08/19 07:35:32 kiyohara Exp $ */
+/*
+ * Not (c) 2007 Matthew Orgass
+ * This file is public domain, meaning anyone can make any use of part or all 
+ * of this file including copying into other works without credit.  Any use, 
+ * modified or not, is solely the responsibility of the user.  If this file is 
+ * part of a collection then use in the collection is governed by the terms of 
+ * the collection.
+ */
+
+/*
+ * Generic Circular Queues: Pointer arithmetic is used to recover the 
+ * enclosing object.  Merge operation is provided.  Items can be multiply 
+ * removed, but queue traversal requires separate knowledge of the queue head.
+ */
+
+#ifndef _GCQ_H
+#define _GCQ_H
+
+#ifdef _KERNEL
+#include <sys/types.h>
+#include <sys/null.h>
+#include <lib/libkern/libkern.h>
+#else
+#include <stdbool.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <assert.h>
+#endif
+
+#ifdef GCQ_USE_ASSERT
+#define GCQ_ASSERT(x) assert(x)
+#else
+#ifdef _KERNEL
+#define GCQ_ASSERT(x) KASSERT(x)
+#else
+#define GCQ_ASSERT(x) _DIAGASSERT(x)
+#endif
+#endif
+
+struct gcq {
+	struct gcq *q_next;
+	struct gcq *q_prev;
+};
+
+struct gcq_head {
+	struct gcq hq;
+};
+
+#define GCQ_INIT(q) { &(q), &(q) }
+#define GCQ_INIT_HEAD(head) { GCQ_INIT((head).hq) }
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_init(struct gcq *q)
+{
+	q->q_next = q->q_prev = q;
+}
+
+__attribute__((nonnull, const, warn_unused_result, always_inline)) 
+static inline struct gcq *
+gcq_q(struct gcq *q)
+{
+	return q;
+}
+
+__attribute__((nonnull, const, warn_unused_result, always_inline)) 
+static inline struct gcq *
+gcq_hq(struct gcq_head *head)
+{
+	return (struct gcq *)head;
+}
+
+__attribute__((nonnull, const, warn_unused_result, always_inline)) 
+static inline struct gcq_head *
+gcq_head(struct gcq *q)
+{
+	return (struct gcq_head *)q;
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_init_head(struct gcq_head *head)
+{
+	gcq_init(gcq_hq(head));
+}
+
+__attribute__((nonnull, pure, warn_unused_result, always_inline))
+static inline bool
+gcq_onlist(struct gcq *q)
+{
+	return (q->q_next != q);
+}
+
+__attribute__((nonnull, pure, warn_unused_result, always_inline))
+static inline bool
+gcq_empty(struct gcq_head *head)
+{
+	return (!gcq_onlist(gcq_hq(head)));
+}
+
+__attribute__((nonnull, pure, warn_unused_result, always_inline))
+static inline bool
+gcq_linked(struct gcq *prev, struct gcq *next)
+{
+	return (prev->q_next == next && next->q_prev == prev);
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_insert_after(struct gcq *on, struct gcq *off)
+{
+	struct gcq *on_next;
+	GCQ_ASSERT(off->q_next == off && off->q_prev == off);
+	on_next = on->q_next;
+
+	off->q_prev = on;
+	off->q_next = on_next;
+	on_next->q_prev = off;
+	on->q_next = off;
+}
+
+__attribute__((nonnull)) static inline void
+gcq_insert_before(struct gcq *on, struct gcq *off)
+{
+	struct gcq *on_prev;
+	GCQ_ASSERT(off->q_next == off && off->q_prev == off);
+	on_prev = on->q_prev;
+
+	off->q_next = on;
+	off->q_prev = on_prev;
+	on_prev->q_next = off;
+	on->q_prev = off;
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_insert_head(struct gcq_head *head, struct gcq *q)
+{
+	gcq_insert_after(gcq_hq(head), q);
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_insert_tail(struct gcq_head *head, struct gcq *q)
+{
+	gcq_insert_before(gcq_hq(head), q);
+}
+
+__attribute__((nonnull)) static inline void
+gcq_tie(struct gcq *dst, struct gcq *src)
+{
+	struct gcq *dst_next, *src_prev;
+	dst_next = dst->q_next;
+	src_prev = src->q_prev;
+
+	src_prev->q_next = dst_next;
+	dst_next->q_prev = src_prev;
+	src->q_prev = dst;
+	dst->q_next = src;
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_tie_after(struct gcq *dst, struct gcq *src)
+{
+	GCQ_ASSERT(dst != src && dst->q_prev != src);
+	gcq_tie(dst, src);
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_tie_before(struct gcq *dst, struct gcq *src)
+{
+	gcq_tie_after(dst->q_prev, src);
+}
+
+__attribute__((nonnull)) static inline struct gcq *
+gcq_remove(struct gcq *q)
+{
+	struct gcq *next, *prev;
+	next = q->q_next;
+	prev = q->q_prev;
+
+	prev->q_next = next;
+	next->q_prev = prev;
+	gcq_init(q);
+	return q;
+}
+
+#ifdef GCQ_UNCONDITIONAL_MERGE
+__attribute__((nonnull)) static inline void
+gcq_merge(struct gcq *dst, struct gcq *src)
+{
+	GCQ_ASSERT(dst != src && dst->q_prev != src);
+	gcq_tie(dst, src);
+	gcq_tie(src, src);
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_merge_head(struct gcq_head *dst, struct gcq_head *src)
+{
+	gcq_merge(gcq_hq(dst), gcq_hq(src));
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_merge_tail(struct gcq_head *dst, struct gcq_head *src)
+{
+	gcq_merge(gcq_hq(dst)->q_prev, gcq_hq(src));
+}
+#else
+__attribute__((nonnull)) static inline void
+gcq_merge(struct gcq *dst, struct gcq *src)
+{
+	struct gcq *dst_next, *src_prev, *src_next;
+	GCQ_ASSERT(dst != src && dst->q_prev != src);
+
+	if (gcq_onlist(src)) {
+		dst_next = dst->q_next;
+		src_prev = src->q_prev;
+		src_next = src->q_next;
+
+		dst_next->q_prev = src_prev;
+		src_prev->q_next = dst_next;
+		dst->q_next = src_next;
+		src_next->q_prev = dst;
+		gcq_init(src);
+	}
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_merge_head(struct gcq_head *dst, struct gcq_head *src)
+{
+	gcq_merge(gcq_hq(dst), gcq_hq(src));
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_merge_tail(struct gcq_head *dst, struct gcq_head *src)
+{
+	gcq_merge(gcq_hq(dst)->q_prev, gcq_hq(src));
+}
+#endif
+
+__attribute__((nonnull)) static inline void
+gcq_clear(struct gcq *q)
+{
+	struct gcq *nq, *next;
+	nq=q;
+	do {
+		next = nq->q_next;
+		gcq_init(nq);
+		nq = next;
+	} while (next != q);
+}
+
+__attribute__((nonnull, always_inline)) static inline void
+gcq_remove_all(struct gcq_head *head)
+{
+	gcq_clear(gcq_hq(head));
+}
+
+__attribute__((nonnull, always_inline)) static inline struct gcq *
+_gcq_next(struct gcq *current, struct gcq_head *head, struct gcq *start)
+{
+	struct gcq *q, *hq;
+	hq = gcq_hq(head);
+	q = current->q_next;
+	if (hq != start && q == hq)
+		q = hq->q_next;
+	if (current != start)
+		GCQ_ASSERT(gcq_onlist(current));
+	return q;
+}
+
+__attribute__((nonnull, always_inline)) static inline struct gcq *
+_gcq_prev(struct gcq *current, struct gcq_head *head, struct gcq *start)
+{
+	struct gcq *q, *hq;
+	hq = gcq_hq(head);
+	q = current->q_prev;
+	if (hq != start && q == hq)
+		q = hq->q_prev;
+	if (current != start)
+		GCQ_ASSERT(gcq_onlist(current));
+	return q;
+}
+
+
+#define GCQ_ITEM(q, type, name) 					\
+    ((type *)(void *)((uint8_t *)gcq_q(q) - offsetof(type, name)))
+
+
+#define _GCQ_GDQ(var, h, ptr, fn) (gcq_hq(h)->ptr != gcq_hq(h) ?	\
+    (var = fn(gcq_hq(h)->ptr), true) : (var = NULL, false))
+#define _GCQ_GDQ_TYPED(tvar, h, type, name, ptr, fn)			\
+    (gcq_hq(h)->ptr != gcq_hq(h) ? (tvar = GCQ_ITEM(fn(gcq_hq(h)->ptr),	\
+    type, name), true) : (tvar = NULL, false))
+#define _GCQ_NP(var, current, head, start, np, fn)			\
+    (np(current, head, start) != (start) ? 				\
+    (var = fn(np(current, head, start)), true) : (var = NULL, false))
+#define _GCQ_NP_TYPED(tvar, current, head, start, type, name, np, fn) 	\
+    (np(current, head, start) != (start) ? 				\
+    (tvar = GCQ_ITEM(fn(np(current, head, start)), type, name), true) :	\
+    (tvar = NULL, false))
+
+#define _GCQ_GDQ_COND(var, h, ptr, rem, cond)				\
+    (gcq_hq(h)->ptr != gcq_hq(h) ? (var = gcq_hq(h)->ptr, 		\
+    ((cond) ? (rem, true) : (var = NULL, false))) : 			\
+    (var = NULL, false))
+#define _GCQ_GDQ_COND_TYPED(tvar, h, type, name, ptr, rem, cond)  	\
+    (gcq_hq(h)->ptr != gcq_hq(h) ? (tvar = GCQ_ITEM(gcq_hq(h)->ptr,	\
+    type, name), ((cond) ? (rem, true) : (tvar = NULL, false))) : 	\
+    (tvar = NULL, false))
+#define _GCQ_NP_COND(var, current, head, start, np, rem, cond) 		\
+    (np(current, head, start) != (start) ? 				\
+    (var = fn(np(current, head, start)), ((cond) ? (rem), true) : 	\
+    (var = NULL, false))) : (var = NULL, false))
+#define _GCQ_NP_COND_TYPED(tvar, current, head, start, type, name, np, 	\
+    rem, cond) (np(current, head, start) != (start) ? 			\
+    (tvar = GCQ_ITEM(fn(np(current, head, start)), type, name), 	\
+    ((cond) ? (rem, true) : (var = NULL, false))) : 			\
+    (tvar = NULL, false))
+
+#define GCQ_GOT_FIRST(var, h) _GCQ_GDQ(var, h, q_next, gcq_q)
+#define GCQ_GOT_LAST(var, h) _GCQ_GDQ(var, h, q_prev, gcq_q)
+#define GCQ_DEQUEUED_FIRST(var, h) _GCQ_GDQ(var, h, q_next, gcq_remove)
+#define GCQ_DEQUEUED_LAST(var, h) _GCQ_GDQ(var, h, q_prev, gcq_remove)
+#define GCQ_GOT_FIRST_TYPED(tvar, h, type, name)  			\
+    _GCQ_GDQ_TYPED(tvar, h, type, name, q_next, gcq_q)
+#define GCQ_GOT_LAST_TYPED(tvar, h, type, name)  			\
+    _GCQ_GDQ_TYPED(tvar, h, type, name, q_prev, gcq_q)
+#define GCQ_DEQUEUED_FIRST_TYPED(tvar, h, type, name)			\
+    _GCQ_GDQ_TYPED(tvar, h, type, name, q_next, gcq_remove)
+#define GCQ_DEQUEUED_LAST_TYPED(tvar, h, type, name)			\
+    _GCQ_GDQ_TYPED(tvar, h, type, name, q_prev, gcq_remove)
+#define GCQ_GOT_NEXT(var, current, head, start)				\
+    _GCQ_NP(var, current, head, start, _gcq_next, gcq_q)
+#define GCQ_GOT_PREV(var, current, head, start)				\
+    _GCQ_NP(var, current, head, start, _gcq_prev, gcq_q)
+#define GCQ_DEQUEUED_NEXT(var, current, head, start)			\
+    _GCQ_NP(var, current, head, start, _gcq_next, gcq_remove)
+#define GCQ_DEQUEUED_PREV(var, current, head, start)			\
+    _GCQ_NP(var, current, head, start, _gcq_prev, gcq_remove)
+#define GCQ_GOT_NEXT_TYPED(tvar, current, head, start, type, name)	\
+    _GCQ_NP_TYPED(tvar, current, head, start, type, name,		\
+    _gcq_next, gcq_q)
+#define GCQ_GOT_PREV_TYPED(tvar, current, head, start, type, name)	\
+    _GCQ_NP_TYPED(tvar, current, head, start, type, name,		\
+    _gcq_prev, gcq_q)
+#define GCQ_DEQUEUED_NEXT_TYPED(tvar, current, head, start, type, name)	\
+    _GCQ_NP_TYPED(tvar, current, head, start, type, name,		\
+    _gcq_next, gcq_remove)
+#define GCQ_DEQUEUED_PREV_TYPED(tvar, current, head, start, type, name)	\
+    _GCQ_NP_TYPED(tvar, current, head, start, type, name,		\
+    _gcq_prev, gcq_remove)
+
+#define GCQ_GOT_FIRST_COND(var, h, cond)				\
+    _GCQ_GDQ_COND(var, h, q_next, ((void)0), cond)
+#define GCQ_GOT_LAST_COND(var, h, cond) 				\
+    _GCQ_GDQ_COND(var, h, q_prev, ((void)0), cond)
+#define GCQ_DEQUEUED_FIRST_COND(var, h, cond) 				\
+    _GCQ_GDQ_COND(var, h, q_next, gcq_remove(var), cond)
+#define GCQ_DEQUEUED_LAST_COND(var, h, cond)				\
+    _GCQ_GDQ_COND(var, h, q_prev, gcq_remove(var), cond)
+#define GCQ_GOT_FIRST_COND_TYPED(tvar, h, type, name, cond)  		\
+    _GCQ_GDQ_COND_TYPED(tvar, h, type, name, q_next, ((void)0), cond)
+#define GCQ_GOT_LAST_COND_TYPED(tvar, h, type, name, cond)  		\
+    _GCQ_GDQ_COND_TYPED(tvar, h, type, name, q_prev, ((void)0), cond)
+#define GCQ_DEQUEUED_FIRST_COND_TYPED(tvar, h, type, name, cond)	\
+    _GCQ_GDQ_COND_TYPED(tvar, h, type, name, q_next, 			\
+    gcq_remove(&(tvar)->name), cond)
+#define GCQ_DEQUEUED_LAST_COND_TYPED(tvar, h, type, name, cond)		\
+    _GCQ_GDQ_COND_TYPED(tvar, h, type, name, q_prev, 			\
+    gcq_remove(&(tvar)->name), cond)
+#define GCQ_GOT_NEXT_COND(var, current, head, start, cond)		\
+    _GCQ_NP_COND(var, current, head, start, _gcq_next, ((void)0), cond)
+#define GCQ_GOT_PREV_COND(var, current, head, start, cond)		\
+    _GCQ_NP_COND(var, current, head, start, _gcq_prev, ((void)0), cond)
+#define GCQ_DEQUEUED_NEXT_COND(var, current, head, start, cond)		\
+    _GCQ_NP_COND(var, current, head, start, _gcq_next, gcq_remove(var), \
+    cond)
+#define GCQ_DEQUEUED_PREV_COND(var, current, head, start, cond)		\
+    _GCQ_NP_COND(var, current, head, start, _gcq_prev, gcq_remove(var), \
+    cond)
+#define GCQ_GOT_NEXT_COND_TYPED(tvar, current, head, start, type, name, \
+    cond) _GCQ_NP_COND_TYPED(tvar, current, head, start, type, name,	\
+    _gcq_next, ((void)0), cond)
+#define GCQ_GOT_PREV_COND_TYPED(tvar, current, head, start, type, name, \
+    cond) _GCQ_NP_COND_TYPED(tvar, current, head, start, type, name,	\
+    _gcq_prev, ((void)0), cond)
+#define GCQ_DEQUEUED_NEXT_COND_TYPED(tvar, current, head, start, type, 	\
+    name, cond) _GCQ_NP_COND_TYPED(tvar, current, head, start, type, 	\
+    name, _gcq_next, gcq_remove(&(tvar)->name), cond)
+#define GCQ_DEQUEUED_PREV_COND_TYPED(tvar, current, head, start, type, 	\
+    name, cond) _GCQ_NP_COND_TYPED(tvar, current, head, start, type, 	\
+    name, _gcq_prev, gcq_remove(&(tvar)->name), cond)
+
+
+#define _GCQ_FOREACH(var, h, tnull, item, ptr) 				\
+    for ((var)=gcq_hq(h)->ptr; ((var) != gcq_hq(h) && 			\
+    (GCQ_ASSERT(gcq_onlist(var)), item, true)) ||			\
+    (tnull, false); (var)=(var)->ptr)
+#define _GCQ_FOREACH_NVAR(var, nvar, h, tnull, item, ptr, ol, rem, ro) 	\
+    for ((nvar)=gcq_hq(h)->ptr; (((var)=(nvar), (nvar) != gcq_hq(h)) &&	\
+    (ol, (nvar)=(nvar)->ptr, rem, item, true)) || (tnull, false); ro)
+
+#define GCQ_FOREACH(var, h)						\
+    _GCQ_FOREACH(var, h, ((void)0), ((void)0), q_next)
+#define GCQ_FOREACH_REV(var, h)						\
+    _GCQ_FOREACH(var, h, ((void)0), ((void)0), q_prev)
+#define GCQ_FOREACH_NVAR(var, nvar, h) 					\
+    _GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0),		\
+    q_next, GCQ_ASSERT(gcq_onlist(nvar)), ((void)0), ((void)0))
+#define GCQ_FOREACH_NVAR_REV(var, nvar, h) 				\
+    _GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0),		\
+    q_prev, GCQ_ASSERT(gcq_onlist(nvar)), ((void)0), ((void)0))
+#define GCQ_FOREACH_RO(var, nvar, h)					\
+    _GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0),		\
+    q_next, ((void)0), ((void)0), GCQ_ASSERT(gcq_linked(var, nvar)))
+#define GCQ_FOREACH_RO_REV(var, nvar, h)				\
+    _GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0),		\
+    q_prev, ((void)0), ((void)0), GCQ_ASSERT(gcq_linked(nvar, var)))
+#define GCQ_FOREACH_DEQUEUED(var, nvar, h)				\
+    _GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0),		\
+    q_next, GCQ_ASSERT(gcq_onlist(nvar)), gcq_remove(var), ((void)0)
+#define GCQ_FOREACH_DEQUEUED_REV(var, nvar, h)				\
+    _GCQ_FOREACH_NVAR(var, nvar, h, ((void)0), ((void)0),		\
+    q_prev, GCQ_ASSERT(gcq_onlist(nvar)), gcq_remove(var), ((void)0)
+
+#define GCQ_FOREACH_TYPED(var, h, tvar, type, name)			\
+    _GCQ_FOREACH(var, h, (tvar)=NULL, (tvar)=GCQ_ITEM(var, type, name), \
+    q_next)
+#define GCQ_FOREACH_TYPED_REV(var, h, tvar, type, name)			\
+    _GCQ_FOREACH(var, h, (tvar)=NULL, (tvar)=GCQ_ITEM(var, type, name), \
+    q_prev)
+#define GCQ_FOREACH_NVAR_TYPED(var, nvar, h, tvar, type, name)		\
+    _GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, 			\
+    (tvar)=GCQ_ITEM(var, type, name),					\
+    q_next, GCQ_ASSERT(gcq_onlist(nvar)), ((void)0), ((void)0))
+#define GCQ_FOREACH_NVAR_REV_TYPED(var, nvar, h, tvar, type, name)	\
+    _GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, 			\
+    (tvar)=GCQ_ITEM(var, type, name),					\
+    q_prev, GCQ_ASSERT(gcq_onlist(nvar)), ((void)0), ((void)0))
+#define GCQ_FOREACH_RO_TYPED(var, nvar, h, tvar, type, name)		\
+    _GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, 			\
+    (tvar)=GCQ_ITEM(var, type, name),					\
+    q_next, ((void)0), ((void)0), GCQ_ASSERT(gcq_lined(var, nvar)))
+#define GCQ_FOREACH_RO_REV_TYPED(var, nvar, h, tvar, type, name)	\
+    _GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, 			\
+    (tvar)=GCQ_ITEM(var, type, name),					\
+    q_prev, ((void)0), ((void)0), GCQ_ASSERT(gcq_linked(nvar, var)))
+#define GCQ_FOREACH_DEQUEUED_TYPED(var, nvar, h, tvar, type, name)	\
+    _GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, 			\
+    (tvar)=GCQ_ITEM(var, type, name),					\
+    q_next, GCQ_ASSERT(gcq_onlist(nvar)), gcq_remove(var), ((void)0))
+#define GCQ_FOREACH_DEQUEUED_REV_TYPED(var, nvar, h, tvar, type, name)	\
+    _GCQ_FOREACH_NVAR(var, nvar, h, (tvar)=NULL, 			\
+    (tvar)=GCQ_ITEM(var, type, name),					\
+    q_prev, GCQ_ASSERT(gcq_onlist(nvar)), gcq_remove(var), ((void)0))
+
+#define _GCQ_COND(fe, cond) do { fe { if (cond) break; } } while (0)
+
+#define GCQ_FIND(var, h, cond) _GCQ_COND(GCQ_FOREACH(var, h), cond)
+#define GCQ_FIND_REV(var, h, cond) _GCQ_COND(GCQ_FOREACH_REV(var, h), cond)
+#define GCQ_FIND_TYPED(var, h, tvar, type, name, cond) 			\
+    _GCQ_COND(GCQ_FOREACH_TYPED(var, h, tvar, type, name), cond)
+#define GCQ_FIND_TYPED_REV(var, h, tvar, type, name, cond) 		\
+    _GCQ_COND(GCQ_FOREACH_REV_TYPED(var, h, tvar, type, name), cond)
+
+#endif /* _GCQ_H */

Property changes on: lab4/.minix-src/include/sys/gcq.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/gmon.h
===================================================================
--- lab4/.minix-src/include/sys/gmon.h	(nonexistent)
+++ lab4/.minix-src/include/sys/gmon.h	(revision 13)
@@ -0,0 +1,153 @@
+/*	$NetBSD: gmon.h,v 1.10 2012/03/09 15:38:03 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)gmon.h	8.2 (Berkeley) 1/4/94
+ */
+
+#ifndef _SYS_GMON_H_
+#define _SYS_GMON_H_
+
+#include <machine/profile.h>
+
+/*
+ * Structure prepended to gmon.out profiling data file.
+ */
+struct gmonhdr {
+	u_long	lpc;		/* base pc address of sample buffer */
+	u_long	hpc;		/* max pc address of sampled buffer */
+	int	ncnt;		/* size of sample buffer (plus this header) */
+	int	version;	/* version number */
+	int	profrate;	/* profiling clock rate */
+	int	spare[3];	/* reserved */
+};
+#define GMONVERSION	0x00051879
+
+/*
+ * histogram counters are unsigned shorts (according to the kernel).
+ */
+#define	HISTCOUNTER	unsigned short
+
+/*
+ * fraction of text space to allocate for histogram counters here, 1/2
+ */
+#ifndef HISTFRACTION
+#define	HISTFRACTION	2
+#endif	/* HISTFRACTION */
+
+/*
+ * Fraction of text space to allocate for from hash buckets.
+ * The value of HASHFRACTION is based on the minimum number of bytes
+ * of separation between two subroutine call points in the object code.
+ * Given MIN_SUBR_SEPARATION bytes of separation the value of
+ * HASHFRACTION is calculated as:
+ *
+ *	HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
+ *
+ * For example, on the VAX, the shortest two call sequence is:
+ *
+ *	calls	$0,(r0)
+ *	calls	$0,(r0)
+ *
+ * which is separated by only three bytes, thus HASHFRACTION is
+ * calculated as:
+ *
+ *	HASHFRACTION = 3 / (2 * 2 - 1) = 1
+ *
+ * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
+ * is less than three, this algorithm will not work!
+ *
+ * In practice, however, call instructions are rarely at a minimal
+ * distance.  Hence, we will define HASHFRACTION to be 2 across all
+ * architectures.  This saves a reasonable amount of space for
+ * profiling data structures without (in practice) sacrificing
+ * any granularity.
+ */
+#define	HASHFRACTION	2
+
+/*
+ * percent of text space to allocate for tostructs with a minimum.
+ */
+#define ARCDENSITY	2
+#define MINARCS		50
+#define MAXARCS		((1 << (unsigned int)(8 * sizeof(HISTCOUNTER))) - 2)
+
+struct tostruct {
+	u_long	selfpc;
+	long	count;
+	u_short	link;
+	u_short pad;
+};
+
+/*
+ * a raw arc, with pointers to the calling site and
+ * the called site and a count.
+ */
+struct rawarc {
+	u_long	raw_frompc;
+	u_long	raw_selfpc;
+	long	raw_count;
+};
+
+/*
+ * The profiling data structures are housed in this structure.
+ */
+struct gmonparam {
+	int		state;
+	u_short		*kcount;
+	u_long		kcountsize;
+	u_short		*froms;
+	u_long		fromssize;
+	struct tostruct	*tos;
+	u_long		tossize;
+	long		tolimit;
+	u_long		lowpc;
+	u_long		highpc;
+	u_long		textsize;
+	u_long		hashfraction;
+};
+extern struct gmonparam _gmonparam;
+
+/*
+ * Possible states of profiling.
+ */
+#define	GMON_PROF_ON	0
+#define	GMON_PROF_BUSY	1
+#define	GMON_PROF_ERROR	2
+#define	GMON_PROF_OFF	3
+
+/*
+ * Sysctl definitions for extracting profiling information from the kernel.
+ */
+#define	GPROF_STATE	0	/* int: profiling enabling variable */
+#define	GPROF_COUNT	1	/* struct: profile tick count buffer */
+#define	GPROF_FROMS	2	/* struct: from location hash bucket */
+#define	GPROF_TOS	3	/* struct: destination/count structure */
+#define	GPROF_GMONPARAM	4	/* struct: profiling parameters (see above) */
+#endif /* !_SYS_GMON_H_ */

Property changes on: lab4/.minix-src/include/sys/gmon.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/intrio.h
===================================================================
--- lab4/.minix-src/include/sys/intrio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/intrio.h	(revision 13)
@@ -0,0 +1,68 @@
+/*	$NetBSD: intrio.h,v 1.1 2015/08/17 06:16:03 knakahara Exp $	*/
+
+/*
+ * Copyright (c) 2015 Internet Initiative Japan Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_INTRIO_H_
+#define _SYS_INTRIO_H_
+
+#include <sys/types.h>
+#include <sys/intr.h>
+#include <sys/sched.h>
+
+#define INTRIO_LIST_VERSION 1
+
+struct intrio_set {
+	char intrid[INTRIDBUF];
+	cpuset_t *cpuset;
+	size_t cpuset_size;
+};
+
+struct intrio_list_line_cpu {
+	bool illc_assigned;
+	uint64_t illc_count;
+};
+
+struct intrio_list_line {
+	char ill_intrid[INTRIDBUF];
+	char ill_xname[INTRDEVNAMEBUF];
+	struct intrio_list_line_cpu ill_cpu[1]; /* Array size is overwritten to ncpu. */
+};
+
+struct intrio_list {
+	int il_version; /* Version number of this struct. */
+	int il_ncpus;
+	int il_nintrs;
+	size_t il_bufsize;
+
+	size_t il_linesize;
+	off_t il_lineoffset;
+/*
+ * struct intrio_list_line il_lines[interrupt_num] must be followed here.
+ */
+};
+
+#endif /* !_SYS_INTRIO_H_ */

Property changes on: lab4/.minix-src/include/sys/intrio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ieee754.h
===================================================================
--- lab4/.minix-src/include/sys/ieee754.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ieee754.h	(revision 13)
@@ -0,0 +1,218 @@
+/*	$NetBSD: ieee754.h,v 1.15 2014/02/01 16:39:52 matt Exp $	*/
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ieee.h	8.1 (Berkeley) 6/11/93
+ */
+#ifndef _SYS_IEEE754_H_
+#define _SYS_IEEE754_H_
+
+/*
+ * NOTICE: This is not a standalone file.  To use it, #include it in
+ * your port's ieee.h header.
+ */
+
+#include <machine/endian.h>
+
+/*
+ * <sys/ieee754.h> defines the layout of IEEE 754 floating point types.
+ * Only single-precision and double-precision types are defined here;
+ * 128-bit long doubles are define here IFF __HAVE_LONG_DOUBLE equals 128.
+ * Otherwise extended types, if available, are defined in the machine-dependent
+ * header.
+ */
+
+/*
+ * Define the number of bits in each fraction and exponent.
+ *
+ *		     k	         k+1
+ * Note that  1.0 x 2  == 0.1 x 2      and that denorms are represented
+ *
+ *					  (-exp_bias+1)
+ * as fractions that look like 0.fffff x 2             .  This means that
+ *
+ *			 -126
+ * the number 0.10000 x 2    , for instance, is the same as the normalized
+ *
+ *		-127			   -128
+ * float 1.0 x 2    .  Thus, to represent 2    , we need one leading zero
+ *
+ *				  -129
+ * in the fraction; to represent 2    , we need two, and so on.  This
+ *
+ *						     (-exp_bias-fracbits+1)
+ * implies that the smallest denormalized number is 2
+ *
+ * for whichever format we are talking about: for single precision, for
+ *
+ *						-126		-149
+ * instance, we get .00000000000000000000001 x 2    , or 1.0 x 2    , and
+ *
+ * -149 == -127 - 23 + 1.
+ */
+#define	SNG_EXPBITS	8
+#define	SNG_FRACBITS	23
+
+struct ieee_single {
+#if _BYTE_ORDER == _BIG_ENDIAN
+	u_int	sng_sign:1;
+	u_int	sng_exp:SNG_EXPBITS;
+	u_int	sng_frac:SNG_FRACBITS;
+#else
+	u_int	sng_frac:SNG_FRACBITS;
+	u_int	sng_exp:SNG_EXPBITS;
+	u_int	sng_sign:1;
+#endif
+};
+
+#define	DBL_EXPBITS	11
+#define	DBL_FRACHBITS	20
+#define	DBL_FRACLBITS	32
+#define	DBL_FRACBITS	(DBL_FRACHBITS + DBL_FRACLBITS)
+
+struct ieee_double {
+#if _BYTE_ORDER == _BIG_ENDIAN
+	u_int	dbl_sign:1;
+	u_int	dbl_exp:DBL_EXPBITS;
+	u_int	dbl_frach:DBL_FRACHBITS;
+	u_int	dbl_fracl:DBL_FRACLBITS;
+#else
+	u_int	dbl_fracl:DBL_FRACLBITS;
+	u_int	dbl_frach:DBL_FRACHBITS;
+	u_int	dbl_exp:DBL_EXPBITS;
+	u_int	dbl_sign:1;
+#endif
+};
+
+#if __HAVE_LONG_DOUBLE + 0 == 128
+
+#define	EXT_EXPBITS	15
+#define EXT_FRACHBITS	48
+#define	EXT_FRACLBITS	64
+#define	EXT_FRACBITS	(EXT_FRACLBITS + EXT_FRACHBITS)
+
+#define	EXT_TO_ARRAY32(u, a) do {				\
+	(a)[0] = (uint32_t)((u).extu_ext.ext_fracl >>  0);	\
+	(a)[1] = (uint32_t)((u).extu_ext.ext_fracl >> 32);	\
+	(a)[2] = (uint32_t)((u).extu_ext.ext_frach >>  0);	\
+	(a)[3] = (uint32_t)((u).extu_ext.ext_frach >> 32);	\
+} while(/*CONSTCOND*/0)
+
+struct ieee_ext {
+#if _BYTE_ORDER == _BIG_ENDIAN
+	uint64_t ext_sign:1;
+	uint64_t ext_exp:EXT_EXPBITS;
+	uint64_t ext_frach:EXT_FRACHBITS;
+	uint64_t ext_fracl;
+#else
+	uint64_t ext_fracl;
+	uint64_t ext_frach:EXT_FRACHBITS;
+	uint64_t ext_exp:EXT_EXPBITS;
+	uint64_t ext_sign:1;
+#endif
+};
+#endif /* __HAVE_LONG_DOUBLE == 128 */
+
+/*
+ * Floats whose exponent is in [1..INFNAN) (of whatever type) are
+ * `normal'.  Floats whose exponent is INFNAN are either Inf or NaN.
+ * Floats whose exponent is zero are either zero (iff all fraction
+ * bits are zero) or subnormal values.
+ *
+ * At least one `signalling NaN' and one `quiet NaN' value must be
+ * implemented.  It is left to the architecture to specify how to
+ * distinguish between these.
+ */
+#define	SNG_EXP_INFNAN	255
+#define	DBL_EXP_INFNAN	2047
+#if __HAVE_LONG_DOUBLE + 0 == 128
+#define	EXT_EXP_INFNAN	0x7fff
+#endif
+
+/*
+ * Exponent biases.
+ */
+#define	SNG_EXP_BIAS	127
+#define	DBL_EXP_BIAS	1023
+#if __HAVE_LONG_DOUBLE + 0 == 128
+#define	EXT_EXP_BIAS	16383
+#endif
+
+/*
+ * Convenience data structures.
+ */
+union ieee_single_u {
+	float			sngu_f;
+	struct ieee_single	sngu_sng;
+};
+
+#define	sngu_sign	sngu_sng.sng_sign
+#define	sngu_exp	sngu_sng.sng_exp
+#define	sngu_frac	sngu_sng.sng_frac
+#define	SNGU_ZEROFRAC_P(u)	((u).sngu_frac != 0)
+
+union ieee_double_u {
+	double			dblu_d;
+	struct ieee_double	dblu_dbl;
+};
+
+#define	dblu_sign	dblu_dbl.dbl_sign
+#define	dblu_exp	dblu_dbl.dbl_exp
+#define	dblu_frach	dblu_dbl.dbl_frach
+#define	dblu_fracl	dblu_dbl.dbl_fracl
+#define	DBLU_ZEROFRAC_P(u)	(((u).dblu_frach|(u).dblu_fracl) != 0)
+
+#if __HAVE_LONG_DOUBLE + 0 == 128
+union ieee_ext_u {
+	long double		extu_ld;
+	struct ieee_ext		extu_ext;
+};
+
+#define extu_exp	extu_ext.ext_exp
+#define extu_sign	extu_ext.ext_sign
+#define extu_fracl	extu_ext.ext_fracl
+#define extu_frach	extu_ext.ext_frach
+#define	EXTU_ZEROFRAC_P(u)	(((u).extu_frach|(u).extu_fracl) != 0)
+
+#ifndef LDBL_NBIT
+#define LDBL_IMPLICIT_NBIT	1	/* our NBIT is implicit */
+#endif
+
+#endif /* __HAVE_LONG_DOUBLE */
+
+#endif /* _SYS_IEEE754_H_ */

Property changes on: lab4/.minix-src/include/sys/ieee754.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/mman.h
===================================================================
--- lab4/.minix-src/include/sys/mman.h	(nonexistent)
+++ lab4/.minix-src/include/sys/mman.h	(revision 13)
@@ -0,0 +1,218 @@
+/*	$NetBSD: mman.h,v 1.48 2014/08/03 19:14:24 wiz Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)mman.h	8.2 (Berkeley) 1/9/95
+ */
+
+#ifndef _SYS_MMAN_H_
+#define _SYS_MMAN_H_
+
+#include <sys/featuretest.h>
+
+#include <machine/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#include <sys/ansi.h>
+
+#ifndef	mode_t
+typedef	__mode_t	mode_t;
+#define	mode_t		__mode_t
+#endif
+
+#ifndef	off_t
+typedef	__off_t		off_t;		/* file offset */
+#define	off_t		__off_t
+#endif
+
+
+/*
+ * Protections are chosen from these bits, or-ed together
+ */
+#define	PROT_NONE	0x00	/* no permissions */
+#define	PROT_READ	0x01	/* pages can be read */
+#define	PROT_WRITE	0x02	/* pages can be written */
+#define	PROT_EXEC	0x04	/* pages can be executed */
+
+/*
+ * Flags contain sharing type and options.
+ * Sharing types; choose one.
+ */
+#define	MAP_SHARED	0x0001	/* share changes */
+#define	MAP_PRIVATE	0x0002	/* changes are private */
+
+#ifdef _KERNEL
+/*
+ * Deprecated flag; these are treated as MAP_PRIVATE internally by
+ * the kernel.
+ */
+#define	MAP_COPY	0x0004	/* "copy" region at mmap time */
+#endif
+
+/*
+ * Other flags
+ */
+#define	MAP_FIXED	 0x0010	/* map addr must be exactly as requested */
+#define	MAP_RENAME	 0x0020	/* Sun: rename private pages to file */
+#define	MAP_NORESERVE	 0x0040	/* Sun: don't reserve needed swap area */
+#define	MAP_INHERIT	 0x0080	/* region is retained after exec */
+#define	MAP_HASSEMAPHORE 0x0200	/* region may contain semaphores */
+#define	MAP_TRYFIXED     0x0400 /* attempt hint address, even within break */
+#define	MAP_WIRED	 0x0800	/* mlock() mapping when it is established */
+
+/*
+ * Mapping type
+ */
+#define	MAP_FILE	0x0000	/* map from file (default) */
+#define	MAP_ANONYMOUS	0x1000	/* allocated from memory, swap space */
+#define	MAP_ANON	MAP_ANONYMOUS
+#define	MAP_STACK	0x2000	/* allocated from memory, swap space (stack) */
+
+/*
+ * Alignment (expressed in log2).  Must be >= log2(PAGE_SIZE) and
+ * < # bits in a pointer (26 (acorn26), 32 or 64).
+ */
+#define	MAP_ALIGNED(n)		((n) << MAP_ALIGNMENT_SHIFT)
+#define	MAP_ALIGNMENT_SHIFT	24
+#define	MAP_ALIGNMENT_MASK	MAP_ALIGNED(0xff)
+#define	MAP_ALIGNMENT_64KB	MAP_ALIGNED(16)	/* 2^16 */
+#define	MAP_ALIGNMENT_16MB	MAP_ALIGNED(24)	/* 2^24 */
+#define	MAP_ALIGNMENT_4GB	MAP_ALIGNED(32)	/* 2^32 */
+#define	MAP_ALIGNMENT_1TB	MAP_ALIGNED(40)	/* 2^40 */
+#define	MAP_ALIGNMENT_256TB	MAP_ALIGNED(48)	/* 2^48 */
+#define	MAP_ALIGNMENT_64PB	MAP_ALIGNED(56)	/* 2^56 */
+
+#if defined(__minix)
+/*
+ * Minix-specific flags
+ */
+#define MAP_UNINITIALIZED	0x040000       /* do not clear memory */
+#define MAP_PREALLOC		0x080000        /* not on-demand */
+#define MAP_CONTIG		0x100000        /* contiguous in physical memory */
+#define MAP_LOWER16M		0x200000        /* physically below 16MB */
+#define MAP_LOWER1M		0x400000        /* physically below 16MB */
+#define MAP_THIRDPARTY		0x800000        /* perform on behalf of any process */
+#endif /* defined(__minix) */
+
+/*
+ * Error indicator returned by mmap(2)
+ */
+#define	MAP_FAILED	((void *) -1)	/* mmap() failed */
+
+/*
+ * Flags to msync
+ */
+#define	MS_ASYNC	0x01	/* perform asynchronous writes */
+#define	MS_INVALIDATE	0x02	/* invalidate cached data */
+#define	MS_SYNC		0x04	/* perform synchronous writes */
+
+/*
+ * Flags to mlockall
+ */
+#define	MCL_CURRENT	0x01	/* lock all pages currently mapped */
+#define	MCL_FUTURE	0x02	/* lock all pages mapped in the future */
+
+/*
+ * POSIX memory avissory values.
+ * Note: keep consistent with the original definitions below.
+ */
+#define	POSIX_MADV_NORMAL	0	/* No further special treatment */
+#define	POSIX_MADV_RANDOM	1	/* Expect random page references */
+#define	POSIX_MADV_SEQUENTIAL	2	/* Expect sequential page references */
+#define	POSIX_MADV_WILLNEED	3	/* Will need these pages */
+#define	POSIX_MADV_DONTNEED	4	/* Don't need these pages */
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Original advice values, equivalent to POSIX definitions,
+ * and few implementation-specific ones.
+ */
+#define	MADV_NORMAL		POSIX_MADV_NORMAL
+#define	MADV_RANDOM		POSIX_MADV_RANDOM
+#define	MADV_SEQUENTIAL		POSIX_MADV_SEQUENTIAL
+#define	MADV_WILLNEED		POSIX_MADV_WILLNEED
+#define	MADV_DONTNEED		POSIX_MADV_DONTNEED
+#define	MADV_SPACEAVAIL		5	/* Insure that resources are reserved */
+#define	MADV_FREE		6	/* Pages are empty, free them */
+
+/*
+ * Flags to minherit
+ */
+#define	MAP_INHERIT_SHARE	0	/* share with child */
+#define	MAP_INHERIT_COPY	1	/* copy into child */
+#define	MAP_INHERIT_NONE	2	/* absent from child */
+#define	MAP_INHERIT_DONATE_COPY	3	/* copy and delete -- not
+					   implemented in UVM */
+#define	MAP_INHERIT_ZERO	4	/* zero in child */
+#define	MAP_INHERIT_DEFAULT	MAP_INHERIT_COPY
+#endif
+
+#ifndef _KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+void *	mmap(void *, size_t, int, int, int, off_t);
+int	munmap(void *, size_t);
+int	mprotect(void *, size_t, int);
+#ifndef __LIBC12_SOURCE__
+int	msync(void *, size_t, int) __RENAME(__msync13);
+#endif
+int	mlock(const void *, size_t);
+int	munlock(const void *, size_t);
+int	mlockall(int);
+int	munlockall(void);
+#if defined(_NETBSD_SOURCE)
+int	madvise(void *, size_t, int);
+int	mincore(void *, size_t, char *);
+int	minherit(void *, size_t, int);
+void *	mremap(void *, size_t, void *, size_t, int);
+#endif
+int	posix_madvise(void *, size_t, int);
+int	shm_open(const char *, int, mode_t);
+int	shm_unlink(const char *);
+
+#if defined(__minix) && defined(_MINIX_SYSTEM)
+#include <minix/endpoint.h>
+void *         vm_remap(endpoint_t d, endpoint_t s, void *da, void *sa, size_t si);
+void *         vm_remap_ro(endpoint_t d, endpoint_t s, void *da, void *sa, size_t si);
+int            vm_unmap(endpoint_t endpt, void *addr);
+unsigned long  vm_getphys(endpoint_t endpt, void *addr);
+u8_t           vm_getrefcount(endpoint_t endpt, void *addr);
+#endif /* defined(__minix) && defined(_MINIX_SYSTEM) */
+
+__END_DECLS
+
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_MMAN_H_ */

Property changes on: lab4/.minix-src/include/sys/mman.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioc_fb.h
===================================================================
--- lab4/.minix-src/include/sys/ioc_fb.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioc_fb.h	(revision 13)
@@ -0,0 +1,14 @@
+/*	sys/ioc_fb.h - Framebuffer command codes
+ *
+ */
+
+#ifndef _S_I_FB_H
+#define _S_I_FB_H
+
+/* The I/O control requests. */
+#define FBIOGET_VSCREENINFO	_IOR('V', 1, struct fb_var_screeninfo)
+#define FBIOPUT_VSCREENINFO     _IOW('V', 2, struct fb_var_screeninfo)
+#define FBIOGET_FSCREENINFO     _IOR('V', 3, struct fb_fix_screeninfo)
+#define FBIOPAN_DISPLAY	_IOW('V', 4, struct fb_var_screeninfo)
+
+#endif /* _S_I_FB_H */

Property changes on: lab4/.minix-src/include/sys/ioc_fb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioc_block.h
===================================================================
--- lab4/.minix-src/include/sys/ioc_block.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioc_block.h	(revision 13)
@@ -0,0 +1,15 @@
+/*	sys/ioc_block.h - Block ioctl() command codes.
+ *
+ */
+
+#ifndef _S_I_BLOCK_H
+#define _S_I_BLOCK_H
+
+#include <minix/ioctl.h>
+#include <minix/btrace.h>
+
+#define BIOCTRACEBUF	_IOW('b', 1, size_t)
+#define BIOCTRACECTL	_IOW('b', 2, int)
+#define BIOCTRACEGET	_IOR_BIG(3, btrace_entry[BTBUF_SIZE])
+
+#endif /* _S_I_BLOCK_H */

Property changes on: lab4/.minix-src/include/sys/ioc_block.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/intr.h
===================================================================
--- lab4/.minix-src/include/sys/intr.h	(nonexistent)
+++ lab4/.minix-src/include/sys/intr.h	(revision 13)
@@ -0,0 +1,104 @@
+/*	$NetBSD: intr.h,v 1.19 2015/08/17 06:16:03 knakahara Exp $	*/
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_INTR_H_
+#define	_SYS_INTR_H_
+
+#define INTRIDBUF 64
+#define INTRDEVNAMEBUF 256
+
+#ifdef _KERNEL
+
+#include <sys/types.h>
+
+struct cpu_info;
+
+/* Public interface. */
+void	*softint_establish(u_int, void (*)(void *), void *);
+void	softint_disestablish(void *);
+void	softint_schedule(void *);
+void	softint_schedule_cpu(void *, struct cpu_info *);
+
+/* MI hooks. */
+void	softint_init(struct cpu_info *);
+lwp_t	*softint_picklwp(void);
+void	softint_overlay(void);
+void	softint_block(lwp_t *);
+
+/* MD-MI interface. */
+void	softint_init_md(lwp_t *, u_int, uintptr_t *);
+#ifndef __HAVE_MD_SOFTINT_TRIGGER
+void	softint_trigger(uintptr_t);
+#endif
+void	softint_dispatch(lwp_t *, int);
+
+/* Flags for softint_establish(). */
+#define	SOFTINT_BIO	0x0000
+#define	SOFTINT_CLOCK	0x0001
+#define	SOFTINT_SERIAL	0x0002
+#define	SOFTINT_NET	0x0003
+#define	SOFTINT_MPSAFE	0x0100
+#define	SOFTINT_RCPU	0x0200
+
+/* Implementation private flags. */
+#define	SOFTINT_PENDING	0x1000
+#define	SOFTINT_ACTIVE	0x2000
+
+#define	SOFTINT_COUNT	0x0004
+#define	SOFTINT_LVLMASK	0x00ff
+#define	SOFTINT_IMPMASK	0xf000
+
+extern u_int	softint_timing;
+
+/*
+ * Historical aliases.
+ */
+#define	IPL_BIO		IPL_VM
+#define	IPL_NET		IPL_VM
+#define	IPL_TTY		IPL_VM
+#define	IPL_AUDIO	IPL_SCHED
+#define	IPL_CLOCK	IPL_SCHED
+#define	IPL_SERIAL	IPL_HIGH
+
+#define	splbio()	splvm()
+#define	splnet()	splvm()
+#define	spltty()	splvm()
+#define	splaudio()	splsched()
+#define	splclock()	splsched()
+#define	splserial()	splhigh()
+
+#include <machine/intr.h>
+
+#elif defined(_KMEMUSER)
+#define	SOFTINT_COUNT	0x0004
+#endif	/* _KERNEL */
+
+#endif	/* _SYS_INTR_H_ */

Property changes on: lab4/.minix-src/include/sys/intr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/msg.h
===================================================================
--- lab4/.minix-src/include/sys/msg.h	(nonexistent)
+++ lab4/.minix-src/include/sys/msg.h	(revision 13)
@@ -0,0 +1,221 @@
+/*	$NetBSD: msg.h,v 1.25 2015/05/13 01:16:15 pgoyette Exp $	*/
+
+/*-
+ * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center, and by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * SVID compatible msg.h file
+ *
+ * Author:  Daniel Boulet
+ *
+ * Copyright 1993 Daniel Boulet and RTMX Inc.
+ *
+ * This system call was implemented by Daniel Boulet under contract from RTMX.
+ *
+ * Redistribution and use in source forms, with and without modification,
+ * are permitted provided that this entire comment appears intact.
+ *
+ * Redistribution in binary form may occur without any restrictions.
+ * Obviously, it would be nice if you gave credit where credit is due
+ * but requiring it would be too onerous.
+ *
+ * This software is provided ``AS IS'' without any warranties of any kind.
+ */
+
+#ifndef _SYS_MSG_H_
+#define _SYS_MSG_H_
+
+#include <sys/featuretest.h>
+#include <sys/ipc.h>
+#ifdef _KERNEL
+#include <sys/condvar.h>
+#include <sys/mutex.h>
+#endif
+
+#ifdef _KERNEL
+struct __msg {
+	struct	__msg *msg_next; /* next msg in the chain */
+	long	msg_type;	/* type of this message */
+    				/* >0 -> type of this message */
+    				/* 0 -> free header */
+	u_short	msg_ts;		/* size of this message */
+	short	msg_spot;	/* location of start of msg in buffer */
+};
+#endif /* _KERNEL */
+
+#define MSG_NOERROR	010000		/* don't complain about too long msgs */
+
+typedef unsigned long	msgqnum_t;
+typedef size_t		msglen_t;
+
+struct msqid_ds {
+	struct ipc_perm	msg_perm;	/* operation permission strucure */
+	msgqnum_t	msg_qnum;	/* number of messages in the queue */
+	msglen_t	msg_qbytes;	/* max # of bytes in the queue */
+	pid_t		msg_lspid;	/* process ID of last msgsend() */
+	pid_t		msg_lrpid;	/* process ID of last msgrcv() */
+	time_t		msg_stime;	/* time of last msgsend() */
+	time_t		msg_rtime;	/* time of last msgrcv() */
+	time_t		msg_ctime;	/* time of last change */
+
+	/*
+	 * These members are private and used only in the internal
+	 * implementation of this interface.
+	 */
+	struct __msg	*_msg_first;	/* first message in the queue */
+	struct __msg	*_msg_last;	/* last message in the queue */
+	msglen_t	_msg_cbytes;	/* # of bytes currently in queue */
+};
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Based on the configuration parameters described in an SVR2 (yes, two)
+ * config(1m) man page.
+ *
+ * Each message is broken up and stored in segments that are msgssz bytes
+ * long.  For efficiency reasons, this should be a power of two.  Also,
+ * it doesn't make sense if it is less than 8 or greater than about 256.
+ * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of
+ * two between 8 and 1024 inclusive (and panic's if it isn't).
+ */
+struct msginfo {
+	int32_t	msgmax;		/* max chars in a message */
+	int32_t	msgmni;		/* max message queue identifiers */
+	int32_t	msgmnb;		/* max chars in a queue */
+	int32_t	msgtql;		/* max messages in system */
+	int32_t	msgssz;		/* size of a message segment
+				   (see notes above) */
+	int32_t	msgseg;		/* number of message segments */
+};
+
+/* Warning: 64-bit structure padding is needed here */
+struct msgid_ds_sysctl {
+	struct		ipc_perm_sysctl msg_perm;
+	uint64_t	msg_qnum;
+	uint64_t	msg_qbytes;
+	uint64_t	_msg_cbytes;
+	pid_t		msg_lspid;
+	pid_t		msg_lrpid;
+	time_t		msg_stime;
+	time_t		msg_rtime;
+	time_t		msg_ctime;
+	int32_t		pad;
+};
+struct msg_sysctl_info {
+	struct	msginfo msginfo;
+	struct	msgid_ds_sysctl msgids[1];
+};
+#endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */
+
+#ifdef _KERNEL
+
+#ifndef MSGSSZ
+#define MSGSSZ	8		/* Each segment must be 2^N long */
+#endif
+#ifndef MSGSEG
+#define MSGSEG	2048		/* must be less than 32767 */
+#endif
+#undef MSGMAX			/* ALWAYS compute MGSMAX! */
+#define MSGMAX	(MSGSSZ*MSGSEG)
+#ifndef MSGMNB
+#define MSGMNB	2048		/* max # of bytes in a queue */
+#endif
+#ifndef MSGMNI
+#define MSGMNI	40
+#endif
+#ifndef MSGTQL
+#define MSGTQL	40
+#endif
+
+/*
+ * macros to convert between msqid_ds's and msqid's.
+ */
+#define MSQID(ix,ds)	((ix) & 0xffff | (((ds).msg_perm._seq << 16) & 0xffff0000))
+#define MSQID_IX(id)	((id) & 0xffff)
+#define MSQID_SEQ(id)	(((id) >> 16) & 0xffff)
+
+/*
+ * Stuff allocated in machdep.h
+ */
+struct msgmap {
+	short	next;		/* next segment in buffer */
+    				/* -1 -> available */
+    				/* 0..(MSGSEG-1) -> index of next segment */
+};
+
+typedef struct kmsq {
+	struct msqid_ds msq_u;
+	kcondvar_t	msq_cv;
+} kmsq_t;
+
+extern struct msginfo msginfo;
+extern kmsq_t	*msqs;		/* MSGMNI queues */
+extern kmutex_t	msgmutex;
+
+#define MSG_LOCKED	01000	/* Is this msqid_ds locked? */
+
+#define SYSCTL_FILL_MSG(src, dst) do { \
+	SYSCTL_FILL_PERM((src).msg_perm, (dst).msg_perm); \
+	(dst).msg_qnum = (src).msg_qnum; \
+	(dst).msg_qbytes = (src).msg_qbytes; \
+	(dst)._msg_cbytes = (src)._msg_cbytes; \
+	(dst).msg_lspid = (src).msg_lspid; \
+	(dst).msg_lrpid = (src).msg_lrpid; \
+	(dst).msg_stime = (src).msg_stime; \
+	(dst).msg_rtime = (src).msg_rtime; \
+	(dst).msg_ctime = (src).msg_ctime; \
+} while (/*CONSTCOND*/ 0)
+
+#endif /* _KERNEL */
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	msgctl(int, int, struct msqid_ds *) __RENAME(__msgctl50);
+int	msgget(key_t, int);
+int	msgsnd(int, const void *, size_t, int);
+ssize_t	msgrcv(int, void *, size_t, long, int);
+__END_DECLS
+#else
+#include <sys/systm.h>
+
+struct proc;
+
+void	msginit(void);
+int	msgfini(void);
+int	msgctl1(struct lwp *, int, int, struct msqid_ds *);
+int	msgsnd1(struct lwp *, int, const char *, size_t, int, size_t,
+    copyin_t);
+int	msgrcv1(struct lwp *, int, char *, size_t, long, int, size_t,
+    copyout_t, register_t *);
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_MSG_H_ */

Property changes on: lab4/.minix-src/include/sys/msg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioc_net.h
===================================================================
--- lab4/.minix-src/include/sys/ioc_net.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioc_net.h	(revision 13)
@@ -0,0 +1,99 @@
+/*	sys/ioc_net.h - NetBSD-friendly version of Minix net/ioctl.h 
+ */
+/*	net/ioctl.h - Network ioctl() command codes.	Author: Kees J. Bot
+ *								23 Nov 2002
+ *
+ */
+
+#ifndef _SYS_IOC_NET_H_
+#define _SYS_IOC_NET_H_
+
+#include <minix/ioctl.h>
+#include <sys/un.h>
+
+#include <sys/ansi.h>
+#ifndef socklen_t
+typedef __socklen_t	socklen_t;
+#define socklen_t	__socklen_t
+#endif
+
+#define MSG_CONTROL_MAX (1024 - sizeof(socklen_t))
+struct msg_control
+{
+	char		msg_control[MSG_CONTROL_MAX];
+	socklen_t	msg_controllen;
+};
+
+
+/* Network ioctls. */
+#define NWIOSETHOPT	_IOW('n', 16, struct nwio_ethopt)
+#define NWIOGETHOPT	_IOR('n', 17, struct nwio_ethopt)
+#define NWIOGETHSTAT	_IOR('n', 18, struct nwio_ethstat)
+
+#define NWIOARPGIP	_IOWR('n',20, struct nwio_arp)
+#define NWIOARPGNEXT	_IOWR('n',21, struct nwio_arp)
+#define NWIOARPSIP	_IOW ('n',22, struct nwio_arp)
+#define NWIOARPDIP	_IOW ('n',23, struct nwio_arp)
+
+#define NWIOSIPCONF2	_IOW('n', 32, struct nwio_ipconf2)
+#define NWIOSIPCONF	_IOW('n', 32, struct nwio_ipconf)
+#define NWIOGIPCONF2	_IOR('n', 33, struct nwio_ipconf2)
+#define NWIOGIPCONF	_IOR('n', 33, struct nwio_ipconf)
+#define NWIOSIPOPT	_IOW('n', 34, struct nwio_ipopt)
+#define NWIOGIPOPT	_IOR('n', 35, struct nwio_ipopt)
+
+#define NWIOGIPOROUTE	_IOWR('n', 40, struct nwio_route)
+#define NWIOSIPOROUTE	_IOW ('n', 41, struct nwio_route)
+#define NWIODIPOROUTE	_IOW ('n', 42, struct nwio_route)
+#define NWIOGIPIROUTE	_IOWR('n', 43, struct nwio_route)
+#define NWIOSIPIROUTE	_IOW ('n', 44, struct nwio_route)
+#define NWIODIPIROUTE	_IOW ('n', 45, struct nwio_route)
+
+#define NWIOSTCPCONF	_IOW('n', 48, struct nwio_tcpconf)
+#define NWIOGTCPCONF	_IOR('n', 49, struct nwio_tcpconf)
+#define NWIOTCPCONN	_IOW('n', 50, struct nwio_tcpcl)
+#define NWIOTCPLISTEN	_IOW('n', 51, struct nwio_tcpcl)
+#define NWIOTCPATTACH	_IOW('n', 52, struct nwio_tcpatt)
+#define NWIOTCPSHUTDOWN	_IO ('n', 53)
+#define NWIOSTCPOPT	_IOW('n', 54, struct nwio_tcpopt)
+#define NWIOGTCPOPT	_IOR('n', 55, struct nwio_tcpopt)
+#define NWIOTCPPUSH	_IO ('n', 56)
+#define NWIOTCPLISTENQ	_IOW('n', 57, int)
+#define NWIOGTCPCOOKIE	_IOR('n', 58, struct tcp_cookie)
+#define NWIOTCPACCEPTTO	_IOW('n', 59, struct tcp_cookie)
+#define NWIOTCPGERROR	_IOR('n', 60, int)
+
+#define NWIOSUDPOPT	_IOW('n', 64, struct nwio_udpopt)
+#define NWIOGUDPOPT	_IOR('n', 65, struct nwio_udpopt)
+#define NWIOUDPPEEK	_IOR('n', 66, struct udp_io_hdr)
+
+#define NWIOGUDSFADDR   _IOR ('n', 67, struct sockaddr_un) /* recvfrom() */
+#define NWIOSUDSTADDR	_IOW ('n', 68, struct sockaddr_un) /* sendto() */
+#define NWIOSUDSADDR	_IOW ('n', 69, struct sockaddr_un) /* bind() */
+#define NWIOGUDSADDR	_IOR ('n', 70, struct sockaddr_un) /* getsockname() */
+#define NWIOGUDSPADDR	_IOR ('n', 71, struct sockaddr_un) /* getpeername() */
+#define NWIOSUDSTYPE	_IOW ('n', 72, int)		   /* socket() */
+#define NWIOSUDSBLOG	_IOW ('n', 73, int)		   /* listen() */
+#define NWIOSUDSCONN	_IOW ('n', 74, struct sockaddr_un) /* connect() */
+#define NWIOSUDSSHUT    _IOW ('n', 75, int)		  /* shutdown() */
+#define NWIOSUDSPAIR	_IOW ('n', 76, dev_t)		  /* socketpair() */
+#define NWIOSUDSACCEPT	_IOW ('n', 77, struct sockaddr_un) /* accept() */
+#define NWIOSUDSCTRL	_IOW ('n', 78, struct msg_control) /* sendmsg() */
+#define NWIOGUDSCTRL	_IOWR('n', 79, struct msg_control) /* recvmsg() */
+
+#define NWIOSPSIPOPT	_IOW('n', 80, struct nwio_psipopt)
+#define NWIOGPSIPOPT	_IOR('n', 81, struct nwio_psipopt)
+
+/* setsockopt/setsockopt for unix domain sockets */
+#define NWIOGUDSSOTYPE	 _IOR('n', 90, int)		  /* SO_TYPE */
+#define NWIOGUDSPEERCRED _IOR('n', 91, struct uucred)	  /* SO_PEERCRED */
+#define NWIOGUDSSNDBUF	 _IOR('n', 92, size_t)            /* SO_SNDBUF */
+#define NWIOSUDSSNDBUF	 _IOW('n', 93, size_t)            /* SO_SNDBUF */
+#define NWIOGUDSRCVBUF	 _IOR('n', 94, size_t)            /* SO_RCVBUF */
+#define NWIOSUDSRCVBUF	 _IOW('n', 95, size_t)            /* SO_RCVBUF */
+
+#endif /* _NET__IOCTL_H */
+
+/*
+ * $PchId: ioctl.h,v 1.2 2003/07/25 14:34:03 philip Exp $
+ */

Property changes on: lab4/.minix-src/include/sys/ioc_net.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioc_file.h
===================================================================
--- lab4/.minix-src/include/sys/ioc_file.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioc_file.h	(revision 13)
@@ -0,0 +1,11 @@
+/*	sys/ioc_file.h - File ioctl() command codes.
+ */
+
+#ifndef _SYS_IOC_FILE_H
+#define _SYS_IOC_FILE_H
+
+#include <minix/ioctl.h>
+
+#define FIONREAD	_IOR('f', 1, int)
+
+#endif /* _SYS_IOC_FILE_H */

Property changes on: lab4/.minix-src/include/sys/ioc_file.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioc_disk.h
===================================================================
--- lab4/.minix-src/include/sys/ioc_disk.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioc_disk.h	(revision 13)
@@ -0,0 +1,20 @@
+/*	sys/ioc_disk.h - Disk ioctl() command codes.	Author: Kees J. Bot
+ *								23 Nov 2002
+ *
+ */
+
+#ifndef _S_I_DISK_H
+#define _S_I_DISK_H
+
+#include <minix/ioctl.h>
+
+#define DIOCSETP	_IOW('d', 3, struct part_geom)
+#define DIOCGETP	_IOR('d', 4, struct part_geom)
+#define DIOCEJECT	_IO ('d', 5)
+#define DIOCTIMEOUT	_IOWR('d', 6, int)
+#define DIOCOPENCT	_IOR('d', 7, int)
+#define DIOCFLUSH	_IO ('d', 8)
+#define DIOCSETWC	_IOW('d', 9, int)
+#define DIOCGETWC	_IOR('d', 10, int)
+
+#endif /* _S_I_DISK_H */

Property changes on: lab4/.minix-src/include/sys/ioc_disk.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioctl.h
===================================================================
--- lab4/.minix-src/include/sys/ioctl.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioctl.h	(revision 13)
@@ -0,0 +1,135 @@
+/*	$NetBSD: ioctl.h,v 1.36 2009/02/13 22:41:04 apb Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ioctl.h	8.6 (Berkeley) 3/28/94
+ */
+
+#ifndef	_SYS_IOCTL_H_
+#define	_SYS_IOCTL_H_
+
+#include <sys/ttycom.h>
+
+/*
+ * Pun for SunOS prior to 3.2.  SunOS 3.2 and later support TIOCGWINSZ
+ * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented
+ * nonwithstanding).
+ */
+struct ttysize {
+	unsigned short	ts_lines;
+	unsigned short	ts_cols;
+	unsigned short	ts_xxx;
+	unsigned short	ts_yyy;
+};
+#define	TIOCGSIZE	TIOCGWINSZ
+#define	TIOCSSIZE	TIOCSWINSZ
+
+#include <sys/ioccom.h>
+
+#include <sys/dkio.h>
+#include <sys/filio.h>
+#include <sys/sockio.h>
+
+#if defined(__minix)
+/* ioctls */
+#include <sys/ioc_net.h>	/* 'n'			*/
+#include <sys/ioc_disk.h>	/* 'd'			*/
+#include <sys/ioc_file.h>	/* 'f'			*/
+#include <sys/ioc_memory.h>	/* 'm'			*/
+#include <sys/ioc_tape.h>	/* 'M'			*/
+#include <sys/ioc_sound.h>	/* 's'			*/
+#include <sys/ioc_block.h>	/* 'b'			*/
+#include <sys/ioc_fbd.h>	/* 'B'			*/
+#include <sys/ioc_fb.h>		/* 'V'			*/
+#include <dev/vndvar.h>		/* 'F'			*/
+#include <dev/i2c/i2c_io.h>
+#endif /* defined(__minix) */
+
+/*
+ * Passthrough ioctl commands. These are passed through to devices
+ * as they are, it is expected that the device (a module, for example),
+ * will know how to deal with them. One for each emulation, so that
+ * no namespace clashes will occur between them, for devices that
+ * may be dealing with specific ioctls for multiple emulations.
+ */
+
+struct ioctl_pt {
+	unsigned long com;
+	void *data;
+};
+
+#define PTIOCNETBSD	_IOW('Z', 0, struct ioctl_pt)
+#define PTIOCSUNOS	_IOW('Z', 1, struct ioctl_pt)
+#define PTIOCSVR4	_IOW('Z', 2, struct ioctl_pt)
+#define PTIOCLINUX	_IOW('Z', 3, struct ioctl_pt)
+#define PTIOCFREEBSD	_IOW('Z', 4, struct ioctl_pt)
+#define PTIOCOSF1	_IOW('Z', 5, struct ioctl_pt)
+#define PTIOCULTRIX	_IOW('Z', 6, struct ioctl_pt)
+#define PTIOCWIN32	_IOW('Z', 7, struct ioctl_pt)
+
+#ifndef _KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	ioctl(int, unsigned long, ...);
+__END_DECLS
+#endif /* !_KERNEL */
+#endif /* !_SYS_IOCTL_H_ */
+
+#if !defined(__minix)
+/*
+ * Keep outside _SYS_IOCTL_H_
+ * Compatibility with old terminal driver
+ *
+ * Source level -> #define USE_OLD_TTY
+ * Kernel level -> options COMPAT_43 or COMPAT_SUNOS or ...
+ */
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_freebsd.h"
+#include "opt_compat_sunos.h"
+#include "opt_compat_svr4.h"
+#include "opt_compat_43.h"
+#include "opt_compat_osf1.h"
+#include "opt_compat_ibcs2.h"
+#include "opt_modular.h"
+#endif
+
+#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) || \
+    defined(COMPAT_SVR4) || defined(COMPAT_FREEBSD) || defined(COMPAT_OSF1) || \
+    defined(COMPAT_IBCS2) || defined(MODULAR)
+#include <sys/ioctl_compat.h>
+#endif /* !defined(__minix) */
+#endif

Property changes on: lab4/.minix-src/include/sys/ioctl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioc_tape.h
===================================================================
--- lab4/.minix-src/include/sys/ioc_tape.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioc_tape.h	(revision 13)
@@ -0,0 +1,15 @@
+/*	sys/ioc_tape.h - Magnetic Tape ioctl() command codes.
+ *							Author: Kees J. Bot
+ *								23 Nov 2002
+ *
+ */
+
+#ifndef _S_I_TAPE_H
+#define _S_I_TAPE_H
+
+#include <minix/ioctl.h>
+
+#define MTIOCTOP	_IOW('M', 1, struct mtop)
+#define MTIOCGET	_IOR('M', 2, struct mtget)
+
+#endif /* _S_I_TAPE_H */

Property changes on: lab4/.minix-src/include/sys/ioc_tape.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioc_memory.h
===================================================================
--- lab4/.minix-src/include/sys/ioc_memory.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioc_memory.h	(revision 13)
@@ -0,0 +1,14 @@
+/*	sys/ioc_memory.h - Memory ioctl() command codes.
+ *							Author: Kees J. Bot
+ *								23 Nov 2002
+ *
+ */
+
+#ifndef _S_I_MEMORY_H
+#define _S_I_MEMORY_H
+
+#include <minix/ioctl.h>
+
+#define MIOCRAMSIZE	_IOW('m', 3, u32_t)
+
+#endif /* _S_I_MEMORY_H */

Property changes on: lab4/.minix-src/include/sys/ioc_memory.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/namei.h
===================================================================
--- lab4/.minix-src/include/sys/namei.h	(nonexistent)
+++ lab4/.minix-src/include/sys/namei.h	(revision 13)
@@ -0,0 +1,357 @@
+/*	$NetBSD: namei.h,v 1.93 2015/04/21 03:19:03 riastradh Exp $	*/
+
+
+/*
+ * WARNING: GENERATED FILE.  DO NOT EDIT
+ * (edit namei.src and run make namei in src/sys/sys)
+ *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
+ *   from: NetBSD: namei.src,v 1.37 2015/04/21 03:18:21 riastradh Exp 
+ */
+
+/*
+ * Copyright (c) 1985, 1989, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)namei.h	8.5 (Berkeley) 8/20/94
+ */
+
+#ifndef _SYS_NAMEI_H_
+#define	_SYS_NAMEI_H_
+
+#include <sys/queue.h>
+#include <sys/mutex.h>
+
+#ifdef _KERNEL
+#include <sys/kauth.h>
+
+/*
+ * Abstraction for a single pathname.
+ *
+ * This contains both the pathname string and (eventually) all
+ * metadata that determines how the path is to be interpreted.
+ * It is an opaque structure; the implementation is in vfs_lookup.c.
+ *
+ * To call namei, first set up a pathbuf with pathbuf_create or
+ * pathbuf_copyin, then do NDINIT(), then call namei, then AFTER THE
+ * STRUCT NAMEIDATA IS DEAD, call pathbuf_destroy. Don't destroy the
+ * pathbuf before you've finished using the nameidata, or mysterious
+ * bad things may happen.
+ *
+ * pathbuf_assimilate is like pathbuf_create but assumes ownership of
+ * the string buffer passed in, which MUST BE of size PATH_MAX and
+ * have been allocated with PNBUF_GET(). This should only be used when
+ * absolutely necessary; e.g. nfsd uses it for loading paths from
+ * mbufs.
+ */
+struct pathbuf;
+
+struct pathbuf *pathbuf_create(const char *path);
+struct pathbuf *pathbuf_assimilate(char *path);
+int pathbuf_copyin(const char *userpath, struct pathbuf **ret);
+void pathbuf_destroy(struct pathbuf *);
+
+/* get a copy of the (current) path string */
+void pathbuf_copystring(const struct pathbuf *, char *buf, size_t maxlen);
+
+/* hold a reference copy of the original path string */
+const char *pathbuf_stringcopy_get(struct pathbuf *);
+void pathbuf_stringcopy_put(struct pathbuf *, const char *);
+
+// XXX remove this
+int pathbuf_maybe_copyin(const char *userpath, enum uio_seg seg, struct pathbuf **ret);
+
+/*
+ * Lookup parameters: this structure describes the subset of
+ * information from the nameidata structure that is passed
+ * through the VOP interface.
+ */
+struct componentname {
+	/*
+	 * Arguments to lookup.
+	 */
+	uint32_t	cn_nameiop;	/* namei operation */
+	uint32_t	cn_flags;	/* flags to namei */
+	kauth_cred_t 	cn_cred;	/* credentials */
+	/*
+	 * Shared between lookup and commit routines.
+	 */
+	const char 	*cn_nameptr;	/* pointer to looked up name */
+	size_t		cn_namelen;	/* length of looked up comp */
+	size_t		cn_consume;	/* chars to consume in lookup */
+};
+
+/*
+ * Encapsulation of namei parameters.
+ */
+struct nameidata {
+	/*
+	 * Arguments to namei/lookup.
+	 */
+	struct vnode *ni_atdir;		/* startup dir, cwd if null */
+	struct pathbuf *ni_pathbuf;	/* pathname container */
+	char *ni_pnbuf;			/* extra pathname buffer ref (XXX) */
+	/*
+	 * Arguments to lookup.
+	 */
+	struct	vnode *ni_rootdir;	/* logical root directory */
+	struct	vnode *ni_erootdir;	/* emulation root directory */
+	/*
+	 * Results: returned from/manipulated by lookup
+	 */
+	struct	vnode *ni_vp;		/* vnode of result */
+	struct	vnode *ni_dvp;		/* vnode of intermediate directory */
+	/*
+	 * Shared between namei and lookup/commit routines.
+	 */
+	size_t		ni_pathlen;	/* remaining chars in path */
+	const char	*ni_next;	/* next location in pathname */
+	unsigned int	ni_loopcnt;	/* count of symlinks encountered */
+	/*
+	 * Lookup parameters: this structure describes the subset of
+	 * information from the nameidata structure that is passed
+	 * through the VOP interface.
+	 */
+	struct componentname ni_cnd;
+};
+
+/*
+ * namei operations
+ */
+#define	LOOKUP		0	/* perform name lookup only */
+#define	CREATE		1	/* setup for file creation */
+#define	DELETE		2	/* setup for file deletion */
+#define	RENAME		3	/* setup for file renaming */
+#define	OPMASK		3	/* mask for operation */
+/*
+ * namei operational modifier flags, stored in ni_cnd.cn_flags
+ */
+#define	LOCKLEAF	0x00000004	/* lock inode on return */
+#define	LOCKPARENT	0x00000008	/* want parent vnode returned locked */
+#define	TRYEMULROOT	0x00000010	/* try relative to emulation root
+					   first */
+#define	NOCACHE		0x00000020	/* name must not be left in cache */
+#define	FOLLOW		0x00000040	/* follow symbolic links */
+#define	NOFOLLOW	0x00000000	/* do not follow symbolic links
+					   (pseudo) */
+#define	EMULROOTSET	0x00000080	/* emulation root already
+					   in ni_erootdir */
+#define	NOCHROOT	0x01000000	/* no chroot on abs path lookups */
+#define	MODMASK		0x010000fc	/* mask of operational modifiers */
+/*
+ * Namei parameter descriptors.
+ */
+#define	NOCROSSMOUNT	0x0000100	/* do not cross mount points */
+#define	RDONLY		0x0000200	/* lookup with read-only semantics */
+#define	ISDOTDOT	0x0002000	/* current component name is .. */
+#define	MAKEENTRY	0x0004000	/* entry is to be added to name cache */
+#define	ISLASTCN	0x0008000	/* this is last component of pathname */
+#define	ISWHITEOUT	0x0020000	/* found whiteout */
+#define	DOWHITEOUT	0x0040000	/* do whiteouts */
+#define	REQUIREDIR	0x0080000	/* must be a directory */
+#define	CREATEDIR	0x0200000	/* trailing slashes are ok */
+#define	PARAMASK	0x02ee300	/* mask of parameter descriptors */
+
+/*
+ * Initialization of a nameidata structure.
+ */
+#define NDINIT(ndp, op, flags, pathbuf) { \
+	(ndp)->ni_cnd.cn_nameiop = op; \
+	(ndp)->ni_cnd.cn_flags = flags; \
+	(ndp)->ni_atdir = NULL; \
+	(ndp)->ni_pathbuf = pathbuf; \
+	(ndp)->ni_cnd.cn_cred = kauth_cred_get(); \
+}
+
+/*
+ * Use this to set the start directory for openat()-type operations.
+ */
+#define NDAT(ndp, dir) {			\
+	(ndp)->ni_atdir = (dir);		\
+}
+
+#endif
+
+/*
+ * This structure describes the elements in the cache of recent
+ * names looked up by namei. NCHNAMLEN is sized to make structure
+ * size a power of two to optimize allocations.  Minimum reasonable
+ * size is 15.
+ */
+
+#define	NCHNAMLEN	31	/* maximum name segment length we bother with */
+
+/*
+ * Namecache entry.  This structure is arranged so that frequently
+ * accessed and mostly read-only data is toward the front, with
+ * infrequently accessed data and the lock towards the rear.  The
+ * lock is then more likely to be in a seperate cache line.
+ */
+struct	namecache {
+	LIST_ENTRY(namecache) nc_hash;	/* hash chain */
+	LIST_ENTRY(namecache) nc_vhash;	/* directory hash chain */
+	struct	vnode *nc_dvp;		/* vnode of parent of name */
+	struct	vnode *nc_vp;		/* vnode the name refers to */
+	int	nc_flags;		/* copy of componentname's ISWHITEOUT */
+	char	nc_nlen;		/* length of name */
+	char	nc_name[NCHNAMLEN];	/* segment name */
+	void	*nc_gcqueue;		/* queue for garbage collection */
+	TAILQ_ENTRY(namecache) nc_lru;	/* psuedo-lru chain */
+	LIST_ENTRY(namecache) nc_dvlist;
+	LIST_ENTRY(namecache) nc_vlist;
+	kmutex_t nc_lock;		/* lock on this entry */
+	int	nc_hittime;		/* last time scored a hit */
+};
+
+#ifdef _KERNEL
+#include <sys/pool.h>
+
+struct mount;
+struct cpu_info;
+
+extern pool_cache_t pnbuf_cache;	/* pathname buffer cache */
+
+#define	PNBUF_GET()	((char *)pool_cache_get(pnbuf_cache, PR_WAITOK))
+#define	PNBUF_PUT(pnb)	pool_cache_put(pnbuf_cache, (void *)(pnb))
+
+/*
+ * Typesafe flags for namei_simple/nameiat_simple.
+ *
+ * This encoding is not optimal but serves the important purpose of
+ * not being type-compatible with the regular namei flags.
+ */
+struct namei_simple_flags_type; /* Opaque. */
+typedef const struct namei_simple_flags_type *namei_simple_flags_t; /* Gross. */
+extern const namei_simple_flags_t
+	NSM_NOFOLLOW_NOEMULROOT,
+	NSM_NOFOLLOW_TRYEMULROOT,
+	NSM_FOLLOW_NOEMULROOT,
+	NSM_FOLLOW_TRYEMULROOT;
+
+/*
+ * namei(at)?_simple_* - the simple cases of namei, with no struct
+ *                       nameidata involved.
+ *
+ * namei_simple_kernel takes a kernel-space path as the first argument.
+ * namei_simple_user takes a user-space path as the first argument.
+ * The nameiat_simple_* variants handle relative path using the given 
+ * directory vnode instead of current directory.
+ *
+ * A namei call can be converted to namei_simple_* if:
+ *    - the second arg to NDINIT is LOOKUP;
+ *    - it does not need the parent vnode, nd.ni_dvp;
+ *    - the only flags it uses are (NO)FOLLOW and TRYEMULROOT;
+ *    - it does not do anything else gross with the contents of nd.
+ */
+int namei_simple_kernel(const char *, namei_simple_flags_t, struct vnode **);
+int namei_simple_user(const char *, namei_simple_flags_t, struct vnode **);
+int nameiat_simple_kernel(struct vnode *, const char *, namei_simple_flags_t,
+    struct vnode **);
+int nameiat_simple_user(struct vnode *, const char *, namei_simple_flags_t, 
+    struct vnode **);
+
+int	namei(struct nameidata *);
+uint32_t namei_hash(const char *, const char **);
+int	lookup_for_nfsd(struct nameidata *, struct vnode *, int neverfollow);
+int	lookup_for_nfsd_index(struct nameidata *, struct vnode *);
+int	relookup(struct vnode *, struct vnode **, struct componentname *, int);
+void	cache_purge1(struct vnode *, const char *, size_t, int);
+#define	PURGE_PARENTS	1
+#define	PURGE_CHILDREN	2
+#define	cache_purge(vp)	cache_purge1((vp),NULL,0,PURGE_PARENTS|PURGE_CHILDREN)
+int	cache_lookup(struct vnode *, const char *, size_t, uint32_t, uint32_t,
+			int *, struct vnode **);
+int	cache_lookup_raw(struct vnode *, const char *, size_t, uint32_t,
+			int *, struct vnode **);
+int	cache_revlookup(struct vnode *, struct vnode **, char **, char *);
+void	cache_enter(struct vnode *, struct vnode *,
+			const char *, size_t, uint32_t);
+void	nchinit(void);
+void	nchreinit(void);
+void	namecache_count_pass2(void);
+void	namecache_count_2passes(void);
+void	cache_cpu_init(struct cpu_info *);
+void	cache_purgevfs(struct mount *);
+void	namecache_print(struct vnode *, void (*)(const char *, ...)
+    __printflike(1, 2));
+
+#endif
+
+/*
+ * Stats on usefulness of namei caches.  A couple of structures are
+ * used for counting, with members having the same names but different
+ * types.  Containerize member names with the preprocessor to avoid
+ * cut-'n'-paste.  A (U) in the comment documents values that are
+ * incremented unlocked; we may treat these specially.
+ */
+#define	_NAMEI_CACHE_STATS(type) {					\
+	type	ncs_goodhits;	/* hits that we can really use (U) */	\
+	type	ncs_neghits;	/* negative hits that we can use */	\
+	type	ncs_badhits;	/* hits we must drop */			\
+	type	ncs_falsehits;	/* hits with id mismatch (U) */		\
+	type	ncs_miss;	/* misses */				\
+	type	ncs_long;	/* long names that ignore cache */	\
+	type	ncs_pass2;	/* names found with passes == 2 (U) */	\
+	type	ncs_2passes;	/* number of times we attempt it (U) */	\
+	type	ncs_revhits;	/* reverse-cache hits */		\
+	type	ncs_revmiss;	/* reverse-cache misses */		\
+}
+
+/*
+ * Sysctl deals with a uint64_t version of the stats and summary
+ * totals are kept that way.
+ */
+struct	nchstats _NAMEI_CACHE_STATS(uint64_t);
+
+/* #endif !_SYS_NAMEI_H_ (generated by gennameih.awk) */
+
+/* Definitions match above, but with NAMEI_ prefix */
+#define NAMEI_LOOKUP	0
+#define NAMEI_CREATE	1
+#define NAMEI_DELETE	2
+#define NAMEI_RENAME	3
+#define NAMEI_OPMASK	3
+#define NAMEI_LOCKLEAF	0x00000004
+#define NAMEI_LOCKPARENT	0x00000008
+#define NAMEI_TRYEMULROOT	0x00000010
+#define NAMEI_NOCACHE	0x00000020
+#define NAMEI_FOLLOW	0x00000040
+#define NAMEI_NOFOLLOW	0x00000000
+#define NAMEI_EMULROOTSET	0x00000080
+#define NAMEI_NOCHROOT	0x01000000
+#define NAMEI_MODMASK	0x010000fc
+#define NAMEI_NOCROSSMOUNT	0x0000100
+#define NAMEI_RDONLY	0x0000200
+#define NAMEI_ISDOTDOT	0x0002000
+#define NAMEI_MAKEENTRY	0x0004000
+#define NAMEI_ISLASTCN	0x0008000
+#define NAMEI_ISWHITEOUT	0x0020000
+#define NAMEI_DOWHITEOUT	0x0040000
+#define NAMEI_REQUIREDIR	0x0080000
+#define NAMEI_CREATEDIR	0x0200000
+#define NAMEI_PARAMASK	0x02ee300
+
+#endif /* !_SYS_NAMEI_H_ */

Property changes on: lab4/.minix-src/include/sys/namei.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/joystick.h
===================================================================
--- lab4/.minix-src/include/sys/joystick.h	(nonexistent)
+++ lab4/.minix-src/include/sys/joystick.h	(revision 13)
@@ -0,0 +1,23 @@
+/*	$NetBSD: joystick.h,v 1.2 2005/12/03 17:10:46 christos Exp $	*/
+
+#ifndef _SYS_JOYSTICK_H_
+#define _SYS_JOYSTICK_H_
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+struct joystick {
+    int x;
+    int y;
+    int b1;
+    int b2;
+};
+
+#define JOY_SETTIMEOUT    _IOW('J', 1, int)    /* set timeout */
+#define JOY_GETTIMEOUT    _IOR('J', 2, int)    /* get timeout */
+#define JOY_SET_X_OFFSET  _IOW('J', 3, int)    /* set offset on X-axis */
+#define JOY_SET_Y_OFFSET  _IOW('J', 4, int)    /* set offset on X-axis */
+#define JOY_GET_X_OFFSET  _IOR('J', 5, int)    /* get offset on X-axis */
+#define JOY_GET_Y_OFFSET  _IOR('J', 6, int)    /* get offset on Y-axis */
+
+#endif /* _SYS_JOYSTICK_H_ */

Property changes on: lab4/.minix-src/include/sys/joystick.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/iostat.h
===================================================================
--- lab4/.minix-src/include/sys/iostat.h	(nonexistent)
+++ lab4/.minix-src/include/sys/iostat.h	(revision 13)
@@ -0,0 +1,108 @@
+/*	$NetBSD: iostat.h,v 1.10 2009/04/04 07:30:09 ad Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1997, 2004, 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_IOSTAT_H_
+#define _SYS_IOSTAT_H_
+
+/*
+ * Disk device structures.
+ */
+
+#include <sys/time.h>
+#include <sys/queue.h>
+
+#define	IOSTATNAMELEN	16
+
+/* types of drives we can have */
+#define IOSTAT_DISK	0
+#define IOSTAT_TAPE	1
+#define IOSTAT_NFS	2
+
+/* The following structure is 64-bit alignment safe */
+struct io_sysctl {
+	char		name[IOSTATNAMELEN];
+	int32_t		busy;
+	int32_t		type;
+	u_int64_t	xfer;
+	u_int64_t	seek;
+	u_int64_t	bytes;
+	u_int32_t	attachtime_sec;
+	u_int32_t	attachtime_usec;
+	u_int32_t	timestamp_sec;
+	u_int32_t	timestamp_usec;
+	u_int32_t	time_sec;
+	u_int32_t	time_usec;
+	/* New separate read/write stats */
+	u_int64_t	rxfer;
+	u_int64_t	rbytes;
+	u_int64_t	wxfer;
+	u_int64_t	wbytes;
+};
+
+/*
+ * Structure for keeping the in-kernel drive stats - these are linked
+ * together in drivelist.
+ */
+
+struct io_stats {
+	char		io_name[IOSTATNAMELEN];  /* device name */
+	void		*io_parent; /* pointer to what we are attached to */
+	int		io_type;   /* type of device the state belong to */
+	int		io_busy;	/* busy counter */
+	u_int64_t	io_rxfer;	/* total number of read transfers */
+	u_int64_t	io_wxfer;	/* total number of write transfers */
+	u_int64_t	io_seek;	/* total independent seek operations */
+	u_int64_t	io_rbytes;	/* total bytes read */
+	u_int64_t	io_wbytes;	/* total bytes written */
+	struct timeval	io_attachtime;	/* time disk was attached */
+	struct timeval	io_timestamp;	/* timestamp of last unbusy */
+	struct timeval	io_time;	/* total time spent busy */
+	TAILQ_ENTRY(io_stats) io_link;
+};
+
+/*
+ * drivelist_head is defined here so that user-land has access to it.
+ */
+TAILQ_HEAD(iostatlist_head, io_stats);	/* the iostatlist is a TAILQ */
+
+#ifdef _KERNEL
+void	iostat_init(void);
+void	iostat_busy(struct io_stats *);
+void	iostat_unbusy(struct io_stats *, long, int);
+bool	iostat_isbusy(struct io_stats *);
+struct io_stats *iostat_find(const char *);
+struct io_stats *iostat_alloc(int32_t, void *, const char *);
+void	iostat_free(struct io_stats *);
+void	iostat_seek(struct io_stats *);
+#endif
+
+#endif /* _SYS_IOSTAT_H_ */

Property changes on: lab4/.minix-src/include/sys/iostat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ioccom.h
===================================================================
--- lab4/.minix-src/include/sys/ioccom.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ioccom.h	(revision 13)
@@ -0,0 +1,115 @@
+/*	$NetBSD: ioccom.h,v 1.12 2014/12/10 00:16:05 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ioccom.h	8.3 (Berkeley) 1/9/95
+ */
+
+#ifndef	_SYS_IOCCOM_H_
+#define	_SYS_IOCCOM_H_
+
+#if !defined(__minix)
+/*
+ * Ioctl's have the command encoded in the lower word, and the size of
+ * any in or out parameters in the upper word.  The high 3 bits of the
+ * upper word are used to encode the in/out status of the parameter.
+ *
+ *	 31 29 28                     16 15            8 7             0
+ *	+---------------------------------------------------------------+
+ *	| I/O | Parameter Length        | Command Group | Command       |
+ *	+---------------------------------------------------------------+
+ */
+#define	IOCPARM_MASK	0x1fff		/* parameter length, at most 13 bits */
+#else
+/* For Minix, reserve one extra flag bit: the 'big' size flag. 
+ * We have big ioctls and can't help it.
+ *
+ *	 31   28 27                     16 15            8 7             0
+ *	+----------------------------------------------------------------+
+ *	| I/O/B | Parameter Length       | Command Group | Command       |
+ *	+----------------------------------------------------------------+
+ */
+#define IOC_BIG		(unsigned long)0x10000000
+#define	IOCPARM_MASK	0xfff		/* parameter length, at most 12 bits */
+#define IOCPARM_MASK_BIG       0xFFFFF	/* or 20 bits, if IOC_BIG is set */
+#define	IOCPARM_SHIFT_BIG	8	
+#endif /* !defined(__minix) */
+
+#define	IOCPARM_SHIFT	16
+#define	IOCGROUP_SHIFT	8
+#define	IOCPARM_LEN(x)	(((x) >> IOCPARM_SHIFT) & IOCPARM_MASK)
+#define	IOCBASECMD(x)	((x) & ~(IOCPARM_MASK << IOCPARM_SHIFT))
+#define	IOCGROUP(x)	(((x) >> IOCGROUP_SHIFT) & 0xff)
+
+#define	IOCPARM_MAX	NBPG	/* max size of ioctl args, mult. of NBPG */
+				/* no parameters */
+#define	IOC_VOID	(unsigned long)0x20000000
+				/* copy parameters out */
+#define	IOC_OUT		(unsigned long)0x40000000
+				/* copy parameters in */
+#define	IOC_IN		(unsigned long)0x80000000
+				/* copy parameters in and out */
+#define	IOC_INOUT	(IOC_IN|IOC_OUT)
+				/* mask for IN/OUT/VOID */
+#define	IOC_DIRMASK	(unsigned long)0xe0000000
+
+#define	_IOC(inout, group, num, len) \
+    ((inout) | (((len) & IOCPARM_MASK) << IOCPARM_SHIFT) | \
+    ((group) << IOCGROUP_SHIFT) | (num))
+#define	_IO(g,n)	_IOC(IOC_VOID,	(g), (n), 0)
+#define	_IOR(g,n,t)	_IOC(IOC_OUT,	(g), (n), sizeof(t))
+#define	_IOW(g,n,t)	_IOC(IOC_IN,	(g), (n), sizeof(t))
+/* this should be _IORW, but stdio got there first */
+#define	_IOWR(g,n,t)	_IOC(IOC_INOUT,	(g), (n), sizeof(t))
+
+#define IOCSNPRINTF(buf, len, cmd) \
+    snprintf((buf), (len), "_IO%s%s('%c', %hhu)", \
+	(((cmd) >> 30) & 1) ? "W" : "", \
+	(((cmd) >> 30) & 2) ? "R" : "", \
+	(char)IOCGROUP(cmd), (unsigned char)(cmd))
+		
+#if defined(__minix)
+#define _IOW_BIG(y,t)  (y | ((sizeof(t) & IOCPARM_MASK_BIG) << IOCPARM_SHIFT_BIG) \
+        | IOC_IN | IOC_BIG)
+#define _IOR_BIG(y,t)  (y | ((sizeof(t) & IOCPARM_MASK_BIG) << IOCPARM_SHIFT_BIG) \
+        | IOC_OUT | IOC_BIG)
+#define _IORW_BIG(y,t) (y | ((sizeof(t) & IOCPARM_MASK_BIG) << IOCPARM_SHIFT_BIG) \
+        | IOC_INOUT | IOC_BIG)
+
+/* Decode an ioctl call. */
+#define _MINIX_IOCTL_SIZE(i)            (((i) >> IOCPARM_SHIFT) & IOCPARM_MASK)
+#define _MINIX_IOCTL_IOR(i)             ((i) & IOC_OUT)
+#define _MINIX_IOCTL_IOW(i)             ((i) & IOC_IN)
+
+/* Recognize and decode size of a 'big' ioctl call. */
+#define _MINIX_IOCTL_BIG(i)             ((i) & IOC_BIG)
+#define _MINIX_IOCTL_SIZE_BIG(i)        (((i) >> IOCPARM_SHIFT_BIG) & IOCPARM_MASK_BIG)
+#endif /* defined(__minix) */
+
+#endif /* !_SYS_IOCCOM_H_ */

Property changes on: lab4/.minix-src/include/sys/ioccom.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/pipe.h
===================================================================
--- lab4/.minix-src/include/sys/pipe.h	(nonexistent)
+++ lab4/.minix-src/include/sys/pipe.h	(revision 13)
@@ -0,0 +1,148 @@
+/* $NetBSD: pipe.h,v 1.32 2009/12/20 09:36:06 dsl Exp $ */
+
+/*
+ * Copyright (c) 1996 John S. Dyson
+ * 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 immediately at the beginning of the file, without modification,
+ *    this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Absolutely no warranty of function or purpose is made by the author
+ *    John S. Dyson.
+ * 4. This work was done expressly for inclusion into FreeBSD.  Other use
+ *    is allowed if this notation is included.
+ * 5. Modifications may be freely made to this file if the above conditions
+ *    are met.
+ *
+ * $FreeBSD: src/sys/sys/pipe.h,v 1.18 2002/02/27 07:35:59 alfred Exp $
+ */
+
+#ifndef _SYS_PIPE_H_
+#define _SYS_PIPE_H_
+
+#include <sys/selinfo.h>		/* for struct selinfo */
+
+#include <uvm/uvm_extern.h>
+
+/*
+ * Pipe buffer size, keep moderate in value, pipes take kva space.
+ */
+#ifndef PIPE_SIZE
+#define PIPE_SIZE	16384
+#endif
+
+#ifndef BIG_PIPE_SIZE
+#define BIG_PIPE_SIZE	(4*PIPE_SIZE)
+#endif
+
+/*
+ * Maximum size of kva for direct write transfer. If the amount
+ * of data in buffer is larger, it would be transferred in chunks of this
+ * size. This kva memory is freed after use if amount of pipe kva memory
+ * is bigger than limitpipekva.
+ */
+#ifndef PIPE_DIRECT_CHUNK
+#define PIPE_DIRECT_CHUNK	(1*1024*1024)
+#endif
+
+/*
+ * PIPE_MINDIRECT MUST be smaller than PIPE_SIZE and MUST be bigger
+ * than PIPE_BUF.
+ */
+#ifndef PIPE_MINDIRECT
+#define PIPE_MINDIRECT	8192
+#endif
+
+/*
+ * Pipe buffer information.
+ * Separate in, out, cnt are used to simplify calculations.
+ * Buffered write is active when the buffer.cnt field is set.
+ */
+struct pipebuf {
+	size_t	cnt;		/* number of chars currently in buffer */
+	u_int	in;		/* in pointer */
+	u_int	out;		/* out pointer */
+	size_t	size;		/* size of buffer */
+	void *	buffer;		/* kva of buffer */
+};
+
+/*
+ * Information to support direct transfers between processes for pipes.
+ */
+struct pipemapping {
+	vaddr_t		kva;		/* kernel virtual address */
+	vsize_t		cnt;		/* number of chars in buffer */
+	voff_t		pos;		/* current position within page */
+	int		npages;		/* how many pages allocated */
+	struct vm_page	**pgs;		/* pointers to the pages */
+	u_int		egen;		/* emap generation number */
+};
+
+/*
+ * Bits in pipe_state.
+ */
+#define PIPE_ASYNC	0x001	/* Async I/O */
+#define PIPE_EOF	0x010	/* Pipe is in EOF condition */
+#define PIPE_SIGNALR	0x020	/* Do selwakeup() on read(2) */
+#define PIPE_DIRECTW	0x040	/* Pipe in direct write mode setup */
+#define PIPE_DIRECTR	0x080	/* Pipe direct read request (setup complete) */
+#define	PIPE_LOCKFL	0x100	/* Process has exclusive access to
+				   pointers/data. */
+#define	PIPE_LWANT	0x200	/* Process wants exclusive access to
+				   pointers/data. */
+#define	PIPE_RESTART	0x400	/* Return ERESTART to blocked syscalls */
+
+/*
+ * Per-pipe data structure.
+ * Two of these are linked together to produce bi-directional pipes.
+ */
+struct pipe {
+	kmutex_t *pipe_lock;		/* pipe mutex */
+	kcondvar_t pipe_rcv;		/* cv for readers */
+	kcondvar_t pipe_wcv;		/* cv for writers */
+	kcondvar_t pipe_draincv;	/* cv for close */
+	kcondvar_t pipe_lkcv;		/* locking */
+	struct	pipebuf pipe_buffer;	/* data storage */
+	struct	pipemapping pipe_map;	/* pipe mapping for direct I/O */
+	struct	selinfo pipe_sel;	/* for compat with select */
+	struct	timespec pipe_atime;	/* time of last access */
+	struct	timespec pipe_mtime;	/* time of last modify */
+	struct	timespec pipe_btime;	/* time of creation */
+	pid_t	pipe_pgid;		/* process group for sigio */
+	struct	pipe *pipe_peer;	/* link with other direction */
+	u_int	pipe_state;		/* pipe status info */
+	int	pipe_busy;		/* busy flag, to handle rundown */
+	vaddr_t	pipe_kmem;		/* preallocated PIPE_SIZE buffer */
+};
+
+/*
+ * KERN_PIPE subtypes
+ */
+#define	KERN_PIPE_MAXKVASZ		1	/* maximum kva size */
+#define	KERN_PIPE_LIMITKVA		2	/* */
+#define	KERN_PIPE_MAXBIGPIPES		3	/* maximum # of "big" pipes */
+#define	KERN_PIPE_NBIGPIPES		4	/* current number of "big" p. */
+#define	KERN_PIPE_KVASIZE		5	/* current pipe kva size */
+#define	KERN_PIPE_MAXID			6
+
+#define	CTL_PIPE_NAMES { \
+	{ 0, 0 }, \
+	{ "maxkvasz", CTLTYPE_INT }, \
+	{ "maxloankvasz", CTLTYPE_INT }, \
+	{ "maxbigpipes", CTLTYPE_INT }, \
+	{ "nbigpipes", CTLTYPE_INT }, \
+	{ "kvasize", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+int	sysctl_dopipe(int *, u_int, void *, size_t *, void *, size_t);
+void	pipe_init(void);
+#endif /* _KERNEL */
+
+#endif /* !_SYS_PIPE_H_ */

Property changes on: lab4/.minix-src/include/sys/pipe.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/kgdb.h
===================================================================
--- lab4/.minix-src/include/sys/kgdb.h	(nonexistent)
+++ lab4/.minix-src/include/sys/kgdb.h	(revision 13)
@@ -0,0 +1,104 @@
+/*	$NetBSD: kgdb.h,v 1.12 2011/04/03 22:29:28 dyoung Exp $	*/
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Lawrence Berkeley Laboratories.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)remote-sl.h	8.1 (Berkeley) 6/11/93
+ */
+
+#ifndef _SYS_KGDB_H_
+#define _SYS_KGDB_H_
+
+/*
+ * Protocol definition for KGDB
+ * (gdb over remote serial line)
+ */
+
+#include <machine/db_machdep.h>
+
+/*
+ * Message types.
+ */
+#define KGDB_MEM_R	'm'
+#define KGDB_MEM_W	'M'
+#define KGDB_REG_R	'g'
+#define KGDB_REG_W	'G'
+#define KGDB_CONT	'c'
+#define KGDB_STEP	's'
+#define KGDB_KILL	'k'
+#define KGDB_DETACH	'D'
+#define KGDB_SIGNAL	'?'
+#define KGDB_DEBUG	'd'
+
+/*
+ * start of frame/end of frame
+ */
+#define KGDB_START	'$'
+#define KGDB_END	'#'
+#define KGDB_GOODP	'+'
+#define KGDB_BADP	'-'
+
+#ifdef	_KERNEL
+
+#include <ddb/db_run.h>
+#include <ddb/db_access.h>
+
+/*
+ * Functions and variables exported from kgdb_stub.c
+ */
+extern dev_t kgdb_dev;
+extern int kgdb_rate, kgdb_active;
+extern int kgdb_debug_init, kgdb_debug_panic;
+extern label_t *kgdb_recover;
+
+void kgdb_attach(int (*)(void *), void (*)(void *, int), void *);
+void kgdb_connect(int);
+void kgdb_panic(void);
+int kgdb_trap(int, db_regs_t *);
+int kgdb_disconnected(void);
+
+/*
+ * Machine dependent functions needed by kgdb_stub.c
+ */
+int kgdb_signal(int);
+int kgdb_acc(vaddr_t, size_t);
+void kgdb_entry_notice(int, db_regs_t *);
+void kgdb_getregs(db_regs_t *, kgdb_reg_t *);
+void kgdb_setregs(db_regs_t *, kgdb_reg_t *);
+
+#endif	/* _KERNEL */
+#endif /* !_SYS_KGDB_H_ */

Property changes on: lab4/.minix-src/include/sys/kgdb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/kcore.h
===================================================================
--- lab4/.minix-src/include/sys/kcore.h	(nonexistent)
+++ lab4/.minix-src/include/sys/kcore.h	(revision 13)
@@ -0,0 +1,59 @@
+/*	$NetBSD: kcore.h,v 1.4 2011/01/18 08:17:39 matt Exp $	*/
+
+/*
+ * Copyright (c) 1996 Leo Weppelman.
+ * 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.
+ */
+#ifndef _SYS_KCORE_H_
+#define	_SYS_KCORE_H_
+
+/*
+ * Definitions for the kernel crash-dump format. The structure of
+ * the files and headers is borrowed from the 'regular' core files
+ * as described in <sys/core.h>.
+ */
+#define	KCORE_MAGIC	0x8fca
+#define	KCORESEG_MAGIC	0x8fac
+
+/*
+ * Description of a memory segment. To make this suitable for sharing
+ * between all architectures, u_quad_t seems to be the necessary type...
+ */
+typedef struct phys_ram_seg {
+	u_quad_t	start;		/* Physical start address	*/
+	u_quad_t	size;		/* Size in bytes		*/
+} phys_ram_seg_t;
+
+typedef struct kcore_hdr {
+	uint32_t	c_midmag;	/* Magic, id, flags		*/
+	uint16_t	c_hdrsize;	/* Aligned header size		*/
+	uint16_t	c_seghdrsize;	/* Aligned seg-header size	*/
+	uint32_t	c_nseg;		/* Number of segments		*/
+} kcore_hdr_t;
+
+typedef struct kcore_seg {
+	uint32_t	c_midmag;	/* Magic, id, flags		*/
+	uint32_t	c_size;		/* Sizeof this segment		*/
+} kcore_seg_t;
+
+#endif /* _SYS_KCORE_H_ */

Property changes on: lab4/.minix-src/include/sys/kcore.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ipc.h
===================================================================
--- lab4/.minix-src/include/sys/ipc.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ipc.h	(revision 13)
@@ -0,0 +1,153 @@
+/*	$NetBSD: ipc.h,v 1.36 2015/05/19 12:17:53 joerg Exp $	*/
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ipc.h	8.4 (Berkeley) 2/19/95
+ */
+
+/*
+ * SVID compatible ipc.h file
+ */
+
+#ifndef _SYS_IPC_H_
+#define _SYS_IPC_H_
+
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+struct ipc_perm {
+	uid_t		uid;	/* user id */
+	gid_t		gid;	/* group id */
+	uid_t		cuid;	/* creator user id */
+	gid_t		cgid;	/* creator group id */
+	mode_t		mode;	/* r/w permission */
+
+	/*
+	 * These members are private and used only in the internal
+	 * implementation of this interface.
+	 */
+	unsigned short	_seq;	/* sequence # (to generate unique
+				   msg/sem/shm id) */
+	key_t		_key;	/* user specified msg/sem/shm key */
+};
+
+#if defined(_NETBSD_SOURCE)
+/* Warning: 64-bit structure padding is needed here */
+struct ipc_perm_sysctl {
+	uint64_t	_key;
+	uid_t		uid;
+	gid_t		gid;
+	uid_t		cuid;
+	gid_t		cgid;
+	mode_t		mode;
+	int16_t		_seq;
+	int16_t		pad;
+};
+#endif /* _NETBSD_SOURCE */
+
+/* Common access type bits, used with ipcperm(). */
+#define	IPC_R		000400	/* read permission */
+#define	IPC_W		000200	/* write/alter permission */
+#define	IPC_M		010000	/* permission to change control info */
+
+/* X/Open required constants (same values as system 5) */
+#define	IPC_CREAT	001000	/* create entry if key does not exist */
+#define	IPC_EXCL	002000	/* fail if key exists */
+#define	IPC_NOWAIT	004000	/* error if request must wait */
+
+#define	IPC_PRIVATE	(key_t)0 /* private key */
+
+#define	IPC_RMID	0	/* remove identifier */
+#define	IPC_SET		1	/* set options */
+#define	IPC_STAT	2	/* get options */
+
+#if defined(__minix)
+#define IPC_INFO       500       /* See ipcs. */
+#endif /* !defined(__minix) */
+
+/*
+ * Macros to convert between ipc ids and array indices or sequence ids.
+ * The first of these is used by ipcs(1), and so is defined outside the
+ * kernel as well.
+ */
+#if defined(_NETBSD_SOURCE)
+#define	IXSEQ_TO_IPCID(ix,perm)	(((perm._seq) << 16) | (ix & 0xffff))
+#endif
+
+#ifdef _KERNEL
+#include <sys/sysctl.h>
+#define	IPCID_TO_IX(id)		((id) & 0xffff)
+#define	IPCID_TO_SEQ(id)	(((id) >> 16) & 0xffff)
+
+struct kauth_cred;
+__BEGIN_DECLS
+int	ipcperm(struct kauth_cred *, struct ipc_perm *, int);
+
+void	sysvipcinit(void);
+void	sysvipcfini(void);
+__END_DECLS
+
+/*
+ * sysctl helper routine for kern.ipc.sysvipc_info subtree.
+ */
+
+#define SYSCTL_FILL_PERM(src, dst) do { \
+	(dst)._key = (src)._key; \
+	(dst).uid = (src).uid; \
+	(dst).gid = (src).gid; \
+	(dst).cuid = (src).cuid; \
+	(dst).cgid = (src).cgid; \
+	(dst).mode = (src).mode; \
+	(dst)._seq = (src)._seq; \
+} while (/*CONSTCOND*/ 0);
+
+/*
+ * Set-up the sysctl routine for COMPAT_50
+ */
+
+__BEGIN_DECLS
+void sysvipc50_set_compat_sysctl(int (*)(SYSCTLFN_PROTO));
+__END_DECLS
+
+#else /* _KERNEL */
+__BEGIN_DECLS
+key_t	ftok(const char *, int);
+__END_DECLS
+#endif
+#endif /* !_SYS_IPC_H_ */

Property changes on: lab4/.minix-src/include/sys/ipc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ksem.h
===================================================================
--- lab4/.minix-src/include/sys/ksem.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ksem.h	(revision 13)
@@ -0,0 +1,77 @@
+/*	$NetBSD: ksem.h,v 1.14 2012/11/25 01:05:04 christos Exp $	*/
+
+/*
+ * Copyright (c) 2002 Alfred Perlstein <alfred@FreeBSD.org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_KSEM_H_
+#define _SYS_KSEM_H_
+
+#include <sys/cdefs.h>
+
+struct timespec;
+
+#ifdef _KERNEL
+#define	KSEM_MAX	128
+
+typedef struct ksem {
+	LIST_ENTRY(ksem)	ks_entry;	/* global list entry */
+	kmutex_t		ks_lock;	/* lock on this ksem */
+	kcondvar_t		ks_cv;		/* condition variable */
+	u_int			ks_ref;		/* number of references */
+	u_int			ks_value;	/* current value */
+	u_int			ks_waiters;	/* number of waiters */
+	char *			ks_name;	/* name, if named */
+	size_t			ks_namelen;	/* length of name */
+	int			ks_flags;	/* for KS_UNLINKED */
+	mode_t			ks_mode;	/* protection bits */
+	uid_t			ks_uid;		/* creator uid */
+	gid_t			ks_gid;		/* creator gid */
+} ksem_t;
+
+int do_ksem_init(struct lwp *, unsigned int, intptr_t *, copyout_t);
+int do_ksem_open(struct lwp *, const char *, int, mode_t, unsigned int,
+    intptr_t *, copyout_t);
+int do_ksem_wait(struct lwp *, intptr_t, bool, struct timespec *);
+
+extern int	ksem_max;
+#endif
+
+#ifdef _LIBC
+__BEGIN_DECLS
+int _ksem_close(intptr_t);
+int _ksem_destroy(intptr_t);
+int _ksem_getvalue(intptr_t, int *);
+int _ksem_init(unsigned int, intptr_t *);
+int _ksem_open(const char *, int, mode_t, unsigned int, intptr_t *);
+int _ksem_post(intptr_t);
+int _ksem_timedwait(intptr_t, const struct timespec * __restrict);
+int _ksem_trywait(intptr_t);
+int _ksem_unlink(const char *);
+int _ksem_wait(intptr_t);
+__END_DECLS
+#endif /* _LIBC */
+
+#endif /* _SYS_KSEM_H_ */

Property changes on: lab4/.minix-src/include/sys/ksem.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ktrace.h
===================================================================
--- lab4/.minix-src/include/sys/ktrace.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ktrace.h	(revision 13)
@@ -0,0 +1,434 @@
+/*	$NetBSD: ktrace.h,v 1.61 2013/12/09 17:43:58 pooka Exp $	*/
+
+/*
+ * Copyright (c) 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ktrace.h	8.2 (Berkeley) 2/19/95
+ */
+
+#ifndef _SYS_KTRACE_H_
+#define _SYS_KTRACE_H_
+
+#include <sys/mutex.h>
+#include <sys/lwp.h>
+
+/*
+ * operations to ktrace system call  (KTROP(op))
+ */
+#define KTROP_SET		0	/* set trace points */
+#define KTROP_CLEAR		1	/* clear trace points */
+#define KTROP_CLEARFILE		2	/* stop all tracing to file */
+#define	KTROP_MASK		0x3
+#define	KTROP(o)		((o)&KTROP_MASK) /* macro to extract operation */
+/*
+ * flags (ORed in with operation)
+ */
+#define KTRFLAG_DESCEND		4	/* perform op on all children too */
+
+/*
+ * ktrace record header
+ */
+struct ktr_header {
+	int	ktr_len;		/* length of record minus length of old header */
+#if BYTE_ORDER == LITTLE_ENDIAN
+	short	ktr_type;		/* trace record type */
+	short	ktr_version;		/* trace record version */
+#else
+	short	ktr_version;		/* trace record version */
+	short	ktr_type;		/* trace record type */
+#endif
+	pid_t	ktr_pid;		/* process id */
+	char	ktr_comm[MAXCOMLEN+1];	/* command name */
+	union {
+		struct { /* v0 */
+			struct {
+				int32_t tv_sec;
+				long tv_usec;
+			} _tv;
+			const void *_buf;
+		} _v0;
+		struct { /* v1 */
+			struct {
+				int32_t tv_sec;
+				long tv_nsec;
+			} _ts;
+			lwpid_t _lid;
+		} _v1;
+		struct { /* v2 */
+			struct timespec _ts;
+			lwpid_t _lid;
+		} _v2;
+	} _v;
+};
+
+#define ktr_lid		_v._v2._lid
+#define ktr_olid	_v._v1._lid
+#define ktr_time	_v._v2._ts
+#define ktr_otv		_v._v0._tv
+#define ktr_ots		_v._v1._ts
+#define ktr_ts		_v._v2._ts
+#define ktr_unused	_v._v0._buf
+
+#define	KTR_SHIMLEN	offsetof(struct ktr_header, ktr_pid)
+
+/*
+ * Test for kernel trace point
+ */
+#define KTRPOINT(p, type)	\
+	(((p)->p_traceflag & (1<<(type))) != 0)
+
+/*
+ * ktrace record types
+ */
+
+/*
+ * KTR_SYSCALL - system call record
+ */
+#define KTR_SYSCALL	1
+struct ktr_syscall {
+	int	ktr_code;		/* syscall number */
+	int	ktr_argsize;		/* size of arguments */
+	/*
+	 * followed by ktr_argsize/sizeof(register_t) "register_t"s
+	 */
+};
+
+/*
+ * KTR_SYSRET - return from system call record
+ */
+#define KTR_SYSRET	2
+struct ktr_sysret {
+	short	ktr_code;
+	short	ktr_eosys;		/* XXX unused */
+	int	ktr_error;
+	register_t ktr_retval;
+	register_t ktr_retval_1;
+};
+
+/*
+ * KTR_NAMEI - namei record
+ */
+#define KTR_NAMEI	3
+	/* record contains pathname */
+
+/*
+ * KTR_GENIO - trace generic process i/o
+ */
+#define KTR_GENIO	4
+struct ktr_genio {
+	int	ktr_fd;
+	enum	uio_rw ktr_rw;
+	/*
+	 * followed by data successfully read/written
+	 */
+};
+
+/*
+ * KTR_PSIG - trace processed signal
+ */
+#define	KTR_PSIG	5
+struct ktr_psig {
+	int	signo;
+	sig_t	action;
+	sigset_t mask;
+	int	code;
+	/*
+	 * followed by optional siginfo_t
+	 */
+};
+
+/*
+ * KTR_CSW - trace context switches
+ */
+#define KTR_CSW		6
+struct ktr_csw {
+	int	out;	/* 1 if switch out, 0 if switch in */
+	int	user;	/* 1 if usermode (ivcsw), 0 if kernel (vcsw) */
+};
+
+/*
+ * KTR_EMUL - emulation change
+ */
+#define KTR_EMUL	7
+	/* record contains emulation name */
+
+/*
+ * KTR_USER - user record
+ */
+#define	KTR_USER	8
+#define KTR_USER_MAXIDLEN	20
+#define KTR_USER_MAXLEN		2048	/* maximum length of passed data */
+struct ktr_user {
+	char 	ktr_id[KTR_USER_MAXIDLEN];	/* string id of caller */
+	/*
+	 * Followed by ktr_len - sizeof(struct ktr_user) of user data.
+	 */
+};
+
+/*
+ * KTR_EXEC_ARG, KTR_EXEC_ENV - Arguments and environment from exec
+ */
+#define KTR_EXEC_ARG		10
+#define KTR_EXEC_ENV		11
+	/* record contains arg/env string */
+
+/*
+ * KTR_SAUPCALL - scheduler activated upcall.
+ *
+ * The structure is no longer used, but retained for compatibility.
+ */
+#define	KTR_SAUPCALL	13
+struct ktr_saupcall {
+	int ktr_type;
+	int ktr_nevent;
+	int ktr_nint;
+	void *ktr_sas;
+	void *ktr_ap;
+	/*
+	 * followed by nevent sa_t's from sas[]
+	 */
+};
+
+/*
+ * KTR_MIB - MIB name and data
+ */
+#define KTR_MIB		14
+	/* Record contains MIB name */
+
+/*
+ * KTR_EXEC_FD - Opened file descriptor from exec
+ */
+#define KTR_EXEC_FD		15
+struct ktr_execfd {
+	int   ktr_fd;
+	u_int ktr_dtype; /* one of DTYPE_* constants */
+};
+
+/*
+ * kernel trace points (in p_traceflag)
+ */
+#define KTRFAC_MASK	0x00ffffff
+#define KTRFAC_SYSCALL	(1<<KTR_SYSCALL)
+#define KTRFAC_SYSRET	(1<<KTR_SYSRET)
+#define KTRFAC_NAMEI	(1<<KTR_NAMEI)
+#define KTRFAC_GENIO	(1<<KTR_GENIO)
+#define	KTRFAC_PSIG	(1<<KTR_PSIG)
+#define KTRFAC_CSW	(1<<KTR_CSW)
+#define KTRFAC_EMUL	(1<<KTR_EMUL)
+#define	KTRFAC_USER	(1<<KTR_USER)
+#define KTRFAC_EXEC_ARG	(1<<KTR_EXEC_ARG)
+#define KTRFAC_EXEC_ENV	(1<<KTR_EXEC_ENV)
+#define	KTRFAC_MIB	(1<<KTR_MIB)
+#define	KTRFAC_EXEC_FD	(1<<KTR_EXEC_FD)
+/*
+ * trace flags (also in p_traceflags)
+ */
+#define KTRFAC_PERSISTENT	0x80000000	/* persistent trace across sugid
+						   exec (exclusive) */
+#define KTRFAC_INHERIT	0x40000000	/* pass trace flags to children */
+#define KTRFAC_TRC_EMUL	0x10000000	/* ktrace KTR_EMUL before next trace */
+#define	KTRFAC_VER_MASK	0x0f000000	/* record version mask */
+#define	KTRFAC_VER_SHIFT	24	/* record version shift */
+
+#define	KTRFAC_VERSION(tf)	(((tf) & KTRFAC_VER_MASK) >> KTRFAC_VER_SHIFT)
+
+#define	KTRFACv0	(0 << KTRFAC_VER_SHIFT)
+#define	KTRFACv1	(1 << KTRFAC_VER_SHIFT)
+#define	KTRFACv2	(2 << KTRFAC_VER_SHIFT)
+
+#ifndef	_KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	ktrace(const char *, int, int, pid_t);
+int	fktrace(int, int, int, pid_t);
+int	utrace(const char *, void *, size_t);
+__END_DECLS
+
+#else
+
+void ktrinit(void);
+void ktrderef(struct proc *);
+void ktradref(struct proc *);
+
+extern kmutex_t ktrace_lock;
+extern int ktrace_on;
+
+int ktruser(const char *, void *, size_t, int);
+bool ktr_point(int);
+
+void ktr_csw(int, int);
+void ktr_emul(void);
+void ktr_geniov(int, enum uio_rw, struct iovec *, size_t, int);
+void ktr_genio(int, enum uio_rw, const void *, size_t, int);
+void ktr_mibio(int, enum uio_rw, const void *, size_t, int);
+void ktr_namei(const char *, size_t);
+void ktr_namei2(const char *, size_t, const char *, size_t);
+void ktr_psig(int, sig_t, const sigset_t *, const ksiginfo_t *);
+void ktr_syscall(register_t, const register_t [], int);
+void ktr_sysret(register_t, int, register_t *);
+void ktr_kuser(const char *, void *, size_t);
+void ktr_mib(const int *a , u_int b);
+void ktr_execarg(const void *, size_t);
+void ktr_execenv(const void *, size_t);
+void ktr_execfd(int, u_int);
+
+int  ktrace_common(lwp_t *, int, int, int, file_t **);
+
+static inline int
+ktrenter(lwp_t *l)
+{
+
+	if ((l->l_pflag & LP_KTRACTIVE) != 0)
+		return 1;
+	l->l_pflag |= LP_KTRACTIVE;
+	return 0;
+}
+
+static inline void
+ktrexit(lwp_t *l)
+{
+
+	l->l_pflag &= ~LP_KTRACTIVE;
+}
+
+static inline bool
+ktrpoint(int fac)
+{
+    return __predict_false(ktrace_on) && __predict_false(ktr_point(1 << fac));
+}
+
+static inline void
+ktrcsw(int a, int b)
+{
+	if (__predict_false(ktrace_on))
+		ktr_csw(a, b);
+}
+
+static inline void
+ktremul(void)
+{
+	if (__predict_false(ktrace_on))
+		ktr_emul();
+}
+
+static inline void
+ktrgenio(int a, enum uio_rw b, const void *c, size_t d, int e)
+{
+	if (__predict_false(ktrace_on))
+		ktr_genio(a, b, c, d, e);
+}
+
+static inline void
+ktrgeniov(int a, enum uio_rw b, struct iovec *c, int d, int e)
+{
+	if (__predict_false(ktrace_on))
+		ktr_geniov(a, b, c, d, e);
+}
+
+static inline void
+ktrmibio(int a, enum uio_rw b, const void *c, size_t d, int e)
+{
+	if (__predict_false(ktrace_on))
+		ktr_mibio(a, b, c, d, e);
+}
+
+static inline void
+ktrnamei(const char *a, size_t b)
+{
+	if (__predict_false(ktrace_on))
+		ktr_namei(a, b);
+}
+
+static inline void
+ktrnamei2(const char *a, size_t b, const char *c, size_t d)
+{
+	if (__predict_false(ktrace_on))
+		ktr_namei2(a, b, c, d);
+}
+
+static inline void
+ktrpsig(int a, sig_t b, const sigset_t *c, const ksiginfo_t * d)
+{
+	if (__predict_false(ktrace_on))
+		ktr_psig(a, b, c, d);
+}
+
+static inline void
+ktrsyscall(register_t code, const register_t args[], int narg)
+{
+	if (__predict_false(ktrace_on))
+		ktr_syscall(code, args, narg);
+}
+
+static inline void
+ktrsysret(register_t a, int b, register_t *c)
+{
+	if (__predict_false(ktrace_on))
+		ktr_sysret(a, b, c);
+}
+
+static inline void
+ktrkuser(const char *a, void *b, size_t c)
+{
+	if (__predict_false(ktrace_on))
+		ktr_kuser(a, b, c);
+}
+
+static inline void
+ktrmib(const int *a , u_int b)
+{
+	if (__predict_false(ktrace_on))
+		ktr_mib(a, b);
+}
+
+static inline void
+ktrexecarg(const void *a, size_t b)
+{
+	if (__predict_false(ktrace_on))
+		ktr_execarg(a, b);
+}
+
+static inline void
+ktrexecenv(const void *a, size_t b)
+{
+	if (__predict_false(ktrace_on))
+		ktr_execenv(a, b);
+}
+
+static inline void
+ktrexecfd(int fd, u_int dtype)
+{
+	if (__predict_false(ktrace_on))
+		ktr_execfd(fd, dtype);
+}
+
+#endif	/* !_KERNEL */
+
+#endif /* _SYS_KTRACE_H_ */

Property changes on: lab4/.minix-src/include/sys/ktrace.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/power.h
===================================================================
--- lab4/.minix-src/include/sys/power.h	(nonexistent)
+++ lab4/.minix-src/include/sys/power.h	(revision 13)
@@ -0,0 +1,287 @@
+/*	$NetBSD: power.h,v 1.20 2015/01/06 15:39:54 bouyer Exp $	*/
+
+/*
+ * Copyright (c) 2003 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+/*
+ * Definitions for power management.
+ */
+
+#ifndef _SYS_POWER_H_
+#define	_SYS_POWER_H_
+
+#include <sys/ioccom.h>
+
+#ifndef _KERNEL
+#include <stdint.h>
+#endif
+
+/*
+ * Power Switches:
+ *
+ * Power switches are devices on the system that are used by the system
+ * operator to cause certain types of power management events to happen.
+ * This may be the closing of a laptop lid, the pressing of a power button,
+ * or some other type of user-initiated hardware event.
+ *
+ * We define the following types of power switches:
+ *
+ *	Power button		This is the "on/off" button on a system,
+ *				or another button which provides a similar
+ *				function.  If there is no power management
+ *				daemon present, an event on this button will
+ *				cause a semi-graceful shutdown of the system
+ *				to occur.  This kind of button doesn't keep
+ *				state; we only know (care) if an event occurs.
+ *
+ *	Reset button		This is the "reset" button on a system, or
+ *				another button which provides a similar
+ *				function.  If there is no power management
+ *				daemon present, an event on this button will
+ *				cause a semi-graceful reboot of the system
+ *				to occur.  This kind of button doesn't keep
+ *				state; we only know (care) if an event occurs.
+ *
+ *	Sleep button		This is a button which is dedicated to a
+ *				"sleep" function.  This kind of button doesn't
+ *				keep state; we only know (care) if an event
+ *				occurs.
+ *
+ *	Lid switch		This is e.g. the lid of a laptop.  This kind
+ *				of switch has state.  We know if it is open
+ *				or closed.
+ *
+ *	Radio switch		This is e.g. the switch of the transmitter
+ * 				of a wifi interface. We know if it is
+ *				on or off.
+ *
+ */
+
+#define	PSWITCH_TYPE_POWER	0	/* power button */
+#define	PSWITCH_TYPE_SLEEP	1	/* sleep button */
+#define	PSWITCH_TYPE_LID	2	/* lid switch */
+#define	PSWITCH_TYPE_RESET	3	/* reset button */
+#define	PSWITCH_TYPE_ACADAPTER	4	/* AC adapter presence */
+#define	PSWITCH_TYPE_HOTKEY	5	/* hotkey button */
+#define		PSWITCH_HK_DISPLAY_CYCLE	"display-cycle"
+#define		PSWITCH_HK_LOCK_SCREEN		"lock-screen"
+#define		PSWITCH_HK_BATTERY_INFO		"battery-info"
+#define		PSWITCH_HK_EJECT_BUTTON		"eject-button"
+#define		PSWITCH_HK_ZOOM_BUTTON		"zoom-button"
+#define		PSWITCH_HK_VENDOR_BUTTON	"vendor-button"
+#ifndef THINKPAD_NORMAL_HOTKEYS
+#define		PSWITCH_HK_FNF1_BUTTON		"fnf1-button"
+#define		PSWITCH_HK_WIRELESS_BUTTON	"wireless-button"
+#define		PSWITCH_HK_WWAN_BUTTON		"wWAN-button"
+#define		PSWITCH_HK_POINTER_BUTTON	"pointer-button"
+#define		PSWITCH_HK_FNF10_BUTTON		"fnf10-button"
+#define		PSWITCH_HK_FNF11_BUTTON		"fnf11-button"
+#define		PSWITCH_HK_BRIGHTNESS_UP	"brightness-up"
+#define		PSWITCH_HK_BRIGHTNESS_DOWN	"brightness-down"
+#define		PSWITCH_HK_THINKLIGHT		"thinklight"
+#define		PSWITCH_HK_VOLUME_UP		"volume-up"
+#define		PSWITCH_HK_VOLUME_DOWN		"volume-down"
+#define		PSWITCH_HK_VOLUME_MUTE		"volume-mute"
+#endif /* THINKPAD_NORMAL_HOTKEYS */
+#define	PSWITCH_TYPE_RADIO	6	/* radio switch */
+
+#define	PSWITCH_EVENT_PRESSED	0	/* button pressed, lid closed, AC off */
+#define	PSWITCH_EVENT_RELEASED	1	/* button released, lid open, AC on */
+
+/*
+ * This structure describes the state of a power switch.
+ */
+struct pswitch_state {
+	char	psws_name[16];		/* power switch name */
+	int32_t	psws_type;		/* type of switch (qualifier) */
+	int32_t	psws_state;		/* state of the switch/event */
+};
+
+/*
+ * envsys(4) events:
+ *
+ * envsys events are sent by the sysmon envsys framework when
+ * a warning or critical condition happens in a sensor.
+ *
+ * We define the folowing types of envsys events:
+ *
+ *	sensor temperature	To handle temperature sensors.
+ *
+ *	sensor voltage		To handle voltage sensors (AC/DC).
+ *
+ *	sensor power		To handle power sensors (W/Ampere).
+ *
+ *	sensor resistance	To handle resistance sensors (Ohms).
+ *
+ *	sensor battery		To handle battery sensors (Ah/Wh).
+ *
+ *	sensor fan		To handle fan sensors.
+ *
+ *	sensor drive		To handle drive sensors.
+ *
+ * 	sensor indicator	To handle indicator/integer sensors.
+ */
+
+#define PENVSYS_TYPE_TEMP		10
+#define PENVSYS_TYPE_VOLTAGE		11
+#define PENVSYS_TYPE_POWER		12
+#define PENVSYS_TYPE_RESISTANCE 	13
+#define PENVSYS_TYPE_BATTERY		14
+#define PENVSYS_TYPE_FAN		15
+#define PENVSYS_TYPE_DRIVE		16
+#define PENVSYS_TYPE_INDICATOR		17
+
+/*
+ * The following events apply for temperatures, power, resistance,
+ * voltages, battery and fan sensors:
+ *
+ * 	PENVSYS_EVENT_CRITICAL		A critical limit.
+ *
+ * 	PENVSYS_EVENT_CRITOVER		A critical over limit.
+ *
+ * 	PENVSYS_EVENT_CRITUNDER		A critical under limit.
+ *
+ * 	PENVSYS_EVENT_WARNOVER		A warning under limit.
+ *
+ * 	PENVSYS_EVENT_WARNUNDER		A warning over limit.
+ *
+ * The folowing event applies to all sensors, when the state is
+ * valid or the warning or critical limit is not valid anymore:
+ *
+ * 	PENVSYS_EVENT_NORMAL		Normal state in the sensor.
+ */
+
+#define PENVSYS_EVENT_NORMAL 		90
+#define PENVSYS_EVENT_CRITICAL 		100
+#define PENVSYS_EVENT_CRITOVER 		110
+#define PENVSYS_EVENT_CRITUNDER 	120
+#define PENVSYS_EVENT_WARNOVER 		130
+#define PENVSYS_EVENT_WARNUNDER 	140
+
+/*
+ * The following events apply for battery sensors:
+ *
+ * 	PENVSYS_EVENT_BATT_CRIT		User critical capacity.
+ *
+ *	PENVSYS_EVENT_BATT_WARN		User warning capacity.
+ *
+ *	PENVSYS_EVENT_BATT_HIGH		User high capacity.
+ *
+ *	PENVSYS_EVENT_BATT_MAX		User maximum capacity.
+ *
+ * 	PENVSYS_EVENT_LOW_POWER		AC Adapter is OFF and all batteries
+ * 					are discharged.
+ */
+
+#define PENVSYS_EVENT_BATT_CRIT		170
+#define PENVSYS_EVENT_BATT_WARN		175
+#define PENVSYS_EVENT_BATT_HIGH		177
+#define PENVSYS_EVENT_BATT_MAX		178
+#define PENVSYS_EVENT_LOW_POWER		180
+
+/*
+ * The following event apply for battery state and drive sensors:
+ *
+ * 	PENVSYS_EVENT_STATE_CHANGED	State has changed.
+ *
+ */
+#define PENVSYS_EVENT_STATE_CHANGED 	190
+
+/*
+ * The following events are used internally to associate multiple
+ * external states with a single event monitor
+ */
+#define PENVSYS_EVENT_LIMITS		200
+#define PENVSYS_EVENT_CAPACITY		210
+
+/*
+ * The following pseudo-event is used to force refreshing of a
+ * sensor that provides rnd(4) entropy, even if the sensor is not
+ * otherwise being monitored.
+ */
+#define PENVSYS_EVENT_NULL		220
+
+/*
+ * This structure defines the properties of an envsys event.
+ */
+struct penvsys_state {
+	char	pes_dvname[16];		/* device name */
+	char	pes_sensname[32];	/* sensor name */
+	char	pes_statedesc[64];	/* sensor state description */
+	int32_t	pes_type;		/* envsys power type */
+};
+
+/*
+ * Power management event messages:
+ *
+ * We ensure that a message is always exactly 32 bytes long, so that
+ * userland doesn't need to issue multiple reads to get a single event.
+ */
+#define	POWER_EVENT_MSG_SIZE	32
+
+#define	POWER_EVENT_SWITCH_STATE_CHANGE		0
+#define POWER_EVENT_ENVSYS_STATE_CHANGE		1
+
+typedef struct power_event {
+	int32_t		pev_type;	/* power event type */
+	union {
+		int32_t	 _pev_d_space[(POWER_EVENT_MSG_SIZE /
+				       sizeof(int32_t)) - 1];
+
+		/*
+		 * This field is used for:
+		 *
+		 * 	POWER_EVENT_SWITCH_STATE_CHANGE
+		 */
+		struct pswitch_state _pev_d_switch;
+	} _pev_data;
+} power_event_t;
+
+#define pev_switch	_pev_data._pev_d_switch
+
+#define POWER_EVENT_RECVDICT	_IOWR('P', 1, struct plistref)
+
+/*
+ * POWER_IOC_GET_TYPE:
+ *
+ *	Get the power management back-end type.
+ */
+struct power_type {
+	char	power_type[32];
+};
+#define	POWER_IOC_GET_TYPE	_IOR('P', 0, struct power_type)
+#define	POWER_IOC_GET_TYPE_WITH_LOSSAGE _IOR('P', 0, sizeof(struct power_type))
+
+#endif /* _SYS_POWER_H_ */

Property changes on: lab4/.minix-src/include/sys/power.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/lock.h
===================================================================
--- lab4/.minix-src/include/sys/lock.h	(nonexistent)
+++ lab4/.minix-src/include/sys/lock.h	(revision 13)
@@ -0,0 +1,116 @@
+/*	$NetBSD: lock.h,v 1.86 2010/07/01 13:00:57 hannken Exp $	*/
+
+/*-
+ * Copyright (c) 1999, 2000, 2006, 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center, by Ross Harvey, and by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1995
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code contains ideas from software contributed to Berkeley by
+ * Avadis Tevanian, Jr., Michael Wayne Young, and the Mach Operating
+ * System project at Carnegie-Mellon University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)lock.h	8.12 (Berkeley) 5/19/95
+ */
+
+#ifndef	_SYS_LOCK_H_
+#define	_SYS_LOCK_H_
+
+#include <sys/stdint.h>
+#include <sys/mutex.h>
+
+#include <machine/lock.h>
+
+#ifdef _KERNEL
+
+/*
+ * From <machine/lock.h>.
+ */
+#ifndef SPINLOCK_SPIN_HOOK
+#define	SPINLOCK_SPIN_HOOK
+#endif
+#ifndef SPINLOCK_BACKOFF_HOOK
+#define	SPINLOCK_BACKOFF_HOOK		nullop(NULL)
+#endif
+#ifndef	SPINLOCK_BACKOFF_MIN
+#define	SPINLOCK_BACKOFF_MIN	4
+#endif
+#ifndef	SPINLOCK_BACKOFF_MAX
+#define	SPINLOCK_BACKOFF_MAX	128
+#endif
+
+#define	SPINLOCK_BACKOFF(count)					\
+do {								\
+	int __i;						\
+	for (__i = (count); __i != 0; __i--) {			\
+		SPINLOCK_BACKOFF_HOOK;				\
+	}							\
+	if ((count) < SPINLOCK_BACKOFF_MAX)			\
+		(count) += (count);				\
+} while (/* CONSTCOND */ 0);
+
+#define	SPINLOCK_RUN_HOOK(count)	((count) >= SPINLOCK_BACKOFF_MAX)
+
+#ifdef LOCKDEBUG
+#define	SPINLOCK_SPINOUT(spins)		((spins)++ > 0x0fffffff)
+#else
+#define	SPINLOCK_SPINOUT(spins)		((void)(spins), 0)
+#endif
+
+extern __cpu_simple_lock_t kernel_lock[];
+
+#endif /* _KERNEL */
+
+#endif /* _SYS_LOCK_H_ */

Property changes on: lab4/.minix-src/include/sys/lock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/lua.h
===================================================================
--- lab4/.minix-src/include/sys/lua.h	(nonexistent)
+++ lab4/.minix-src/include/sys/lua.h	(revision 13)
@@ -0,0 +1,104 @@
+/*	$NetBSD: lua.h,v 1.8 2015/09/06 06:01:02 dholland Exp $ */
+
+/*
+ * Copyright (c) 2014 by Lourival Vieira Neto <lneto@NetBSD.org>.
+ * Copyright (c) 2011, 2013 Marc Balmer <mbalmer@NetBSD.org>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the Author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_LUA_H_
+#define _SYS_LUA_H_
+
+#include <sys/param.h>
+#include <sys/ioccom.h>
+
+#include <lua.h>		/* for lua_State */
+
+#ifdef _KERNEL
+#include <sys/condvar.h>
+#endif
+
+#define MAX_LUA_NAME		16
+#define MAX_LUA_DESC		64
+#define LUA_MAX_MODNAME		32
+
+struct lua_state_info {
+	char	name[MAX_LUA_NAME];
+	char	desc[MAX_LUA_DESC];
+	bool	user;
+};
+
+struct lua_info {
+	int num_states;		/* total number of created Lua states */
+	struct lua_state_info *states;
+};
+
+struct lua_create {
+	char	name[MAX_LUA_NAME];
+	char	desc[MAX_LUA_DESC];
+};
+
+struct lua_require {
+	char	state[MAX_LUA_NAME];
+	char	module[LUA_MAX_MODNAME];
+};
+
+struct lua_load {
+	char	state[MAX_LUA_NAME];
+	char	path[MAXPATHLEN];
+};
+
+#define LUAINFO		_IOWR('l', 0, struct lua_info)
+
+#define LUACREATE	_IOWR('l', 1, struct lua_create)
+#define LUADESTROY	_IOWR('l', 2, struct lua_create)
+
+/* 'require' a module in a state */
+#define LUAREQUIRE	_IOWR('l', 3, struct lua_require)
+
+/* loading Lua code into a Lua state */
+#define LUALOAD		_IOWR('l', 4, struct lua_load)
+
+#ifdef _KERNEL
+extern int klua_mod_register(const char *, lua_CFunction);
+extern int klua_mod_unregister(const char *);
+
+typedef struct _klua_State {
+	lua_State	*L;
+	kmutex_t	 ks_lock;
+	bool		 ks_user;	/* state created by user (ioctl) */
+} klua_State;
+
+extern void klua_lock(klua_State *);
+extern void klua_unlock(klua_State *);
+
+extern void klua_close(klua_State *);
+extern klua_State *klua_newstate(lua_Alloc, void *, const char *, const char *,
+		int);
+extern klua_State *kluaL_newstate(const char *, const char *, int);
+#endif
+
+#endif /* _SYS_LUA_H_ */

Property changes on: lab4/.minix-src/include/sys/lua.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/kcpuset.h
===================================================================
--- lab4/.minix-src/include/sys/kcpuset.h	(nonexistent)
+++ lab4/.minix-src/include/sys/kcpuset.h	(revision 13)
@@ -0,0 +1,85 @@
+/*	$NetBSD: kcpuset.h,v 1.11 2014/05/19 20:39:23 rmind Exp $	*/
+
+/*-
+ * Copyright (c) 2008, 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas and Mindaugas Rasiukevicius.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_SYS_KCPUSET_H_
+#define	_SYS_KCPUSET_H_
+
+struct kcpuset;
+typedef struct kcpuset	kcpuset_t;
+
+#ifdef _KERNEL
+
+#include <sys/sched.h>
+
+void		kcpuset_sysinit(void);
+
+void		kcpuset_create(kcpuset_t **, bool);
+void		kcpuset_clone(kcpuset_t **, const kcpuset_t *);
+void		kcpuset_destroy(kcpuset_t *);
+void		kcpuset_copy(kcpuset_t *, const kcpuset_t *);
+
+void		kcpuset_use(kcpuset_t *);
+void		kcpuset_unuse(kcpuset_t *, kcpuset_t **);
+
+int		kcpuset_copyin(const cpuset_t *, kcpuset_t *, size_t);
+int		kcpuset_copyout(kcpuset_t *, cpuset_t *, size_t);
+
+void		kcpuset_zero(kcpuset_t *);
+void		kcpuset_fill(kcpuset_t *);
+void		kcpuset_set(kcpuset_t *, cpuid_t);
+void		kcpuset_clear(kcpuset_t *, cpuid_t);
+
+bool		kcpuset_isset(const kcpuset_t *, cpuid_t);
+bool		kcpuset_isotherset(const kcpuset_t *, cpuid_t);
+bool		kcpuset_iszero(const kcpuset_t *);
+bool		kcpuset_intersecting_p(const kcpuset_t *, const kcpuset_t *);
+bool		kcpuset_match(const kcpuset_t *, const kcpuset_t *);
+void		kcpuset_intersect(kcpuset_t *, const kcpuset_t *);
+void		kcpuset_merge(kcpuset_t *, const kcpuset_t *);
+void		kcpuset_remove(kcpuset_t *, const kcpuset_t *);
+int		kcpuset_countset(const kcpuset_t *);
+
+cpuid_t		kcpuset_ffs(const kcpuset_t *);
+cpuid_t		kcpuset_ffs_intersecting(const kcpuset_t *, const kcpuset_t *);
+
+void		kcpuset_atomic_set(kcpuset_t *, cpuid_t);
+void		kcpuset_atomic_clear(kcpuset_t *, cpuid_t);
+
+void		kcpuset_atomicly_zero(kcpuset_t *);
+void		kcpuset_atomicly_intersect(kcpuset_t *, const kcpuset_t *);
+void		kcpuset_atomicly_merge(kcpuset_t *, const kcpuset_t *);
+void		kcpuset_atomicly_remove(kcpuset_t *, const kcpuset_t *);
+
+void		kcpuset_export_u32(const kcpuset_t *, uint32_t *, size_t);
+
+#endif
+
+#endif /* _SYS_KCPUSET_H_ */

Property changes on: lab4/.minix-src/include/sys/kcpuset.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/lwpctl.h
===================================================================
--- lab4/.minix-src/include/sys/lwpctl.h	(nonexistent)
+++ lab4/.minix-src/include/sys/lwpctl.h	(revision 13)
@@ -0,0 +1,97 @@
+/*	$NetBSD: lwpctl.h,v 1.4 2008/04/28 20:24:10 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(_SYS_LWPCTL_H_)
+#define	_SYS_LWPCTL_H_
+
+/*
+ * Note on compatibility:
+ *
+ * This must be the same size for both 32 and 64-bit processes, since
+ * the same format will be used by both.
+ *
+ * Removal of unused fields is OK, as long as the change in layout
+ * does not affect supported fields.
+ *
+ * It is OK to add fields to this structure, since the kernel allocates
+ * the space.  Re-use of fields is more complicated - see the feature
+ * word passed to the system call.
+ */
+typedef struct lwpctl {
+	volatile int	lc_curcpu;
+	volatile int	lc_pctr;
+} lwpctl_t;
+
+#define	LWPCTL_CPU_NONE		(-1)
+#define	LWPCTL_CPU_EXITED	(-2)
+
+#define	LWPCTL_FEATURE_CURCPU	0x00000001
+#define	LWPCTL_FEATURE_PCTR	0x00000002
+
+#if defined(_KERNEL)
+
+#include <sys/mutex.h>
+
+#include <uvm/uvm_extern.h>
+
+typedef struct lcpage {
+	TAILQ_ENTRY(lcpage) lcp_chain;
+	vaddr_t		lcp_uaddr;
+	vaddr_t		lcp_kaddr;
+	u_int		lcp_nfree;
+	u_int		lcp_rotor;
+	u_int		lcp_bitmap[1];
+} lcpage_t;
+
+typedef struct lcproc {
+	kmutex_t	lp_lock;
+	struct uvm_object *lp_uao;
+	TAILQ_HEAD(,lcpage) lp_pages;
+	vaddr_t		lp_cur;
+	vaddr_t		lp_max;
+	vaddr_t		lp_uva;
+} lcproc_t;
+
+#define	LWPCTL_PER_PAGE		((PAGE_SIZE / sizeof(lwpctl_t)) & ~31)
+#define	LWPCTL_BITMAP_ENTRIES	(LWPCTL_PER_PAGE >> 5)
+#define	LWPCTL_BITMAP_SZ	(LWPCTL_BITMAP_ENTRIES * sizeof(u_int))
+#define	LWPCTL_LCPAGE_SZ	\
+    (sizeof(lcpage_t) - sizeof(u_int) + LWPCTL_BITMAP_SZ)
+#define	LWPCTL_UAREA_SZ		\
+    (round_page(MAX_LWP_PER_PROC * sizeof(lwpctl_t)))
+
+int	lwp_ctl_alloc(vaddr_t *);
+void	lwp_ctl_free(lwp_t *);
+void	lwp_ctl_exit(void);
+
+#endif /* defined(_KERNEL) */
+
+#endif /* !_SYS_LWPCTL_H_ */

Property changes on: lab4/.minix-src/include/sys/lwpctl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/mallocvar.h
===================================================================
--- lab4/.minix-src/include/sys/mallocvar.h	(nonexistent)
+++ lab4/.minix-src/include/sys/mallocvar.h	(revision 13)
@@ -0,0 +1,55 @@
+/*	$NetBSD: mallocvar.h,v 1.13 2014/12/27 19:32:57 maxv Exp $	*/
+
+/*
+ * Copyright (c) 1987, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)malloc.h	8.5 (Berkeley) 5/3/95
+ */
+
+#ifndef _SYS_MALLOCVAR_H_
+#define	_SYS_MALLOCVAR_H_
+
+#include <sys/types.h>
+
+/*
+ * This structure describes a type of malloc'd memory and carries
+ * allocation statistics for that memory.
+ */
+struct malloc_type;
+
+#ifdef _KERNEL
+#define	MALLOC_JUSTDEFINE(type, shortdesc, longdesc)
+#define	MALLOC_DEFINE(type, shortdesc, longdesc)
+#define	MALLOC_DECLARE(type)						\
+	static struct malloc_type *const __unused type = 0
+
+#define	malloc_type_attach(malloc_type)
+#define	malloc_type_detach(malloc_type)
+#endif /* _KERNEL */
+
+#endif /* _SYS_MALLOCVAR_H_ */

Property changes on: lab4/.minix-src/include/sys/mallocvar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/md4.h
===================================================================
--- lab4/.minix-src/include/sys/md4.h	(nonexistent)
+++ lab4/.minix-src/include/sys/md4.h	(revision 13)
@@ -0,0 +1,58 @@
+/*	$NetBSD: md4.h,v 1.7 2005/12/26 18:41:36 perry Exp $	*/
+
+/*
+ * This file is derived from the RSA Data Security, Inc. MD4 Message-Digest
+ * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
+ * for portability and formatting.
+ */
+
+/*
+ * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
+ * rights reserved.
+ *
+ * License to copy and use this software is granted provided that it
+ * is identified as the "RSA Data Security, Inc. MD4 Message-Digest
+ * Algorithm" in all material mentioning or referencing this software
+ * or this function.
+ *
+ * License is also granted to make and use derivative works provided
+ * that such works are identified as "derived from the RSA Data
+ * Security, Inc. MD4 Message-Digest Algorithm" in all material
+ * mentioning or referencing the derived work.
+ *
+ * RSA Data Security, Inc. makes no representations concerning either
+ * the merchantability of this software or the suitability of this
+ * software for any particular purpose. It is provided "as is"
+ * without express or implied warranty of any kind.
+ *
+ * These notices must be retained in any copies of any part of this
+ * documentation and/or software.
+ */
+
+#ifndef _SYS_MD4_H_
+#define _SYS_MD4_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#define MD4_DIGEST_LENGTH 16
+
+/* MD4 context. */
+typedef struct MD4Context {
+	uint32_t state[4];	/* state (ABCD) */
+	uint32_t count[2];	/* number of bits, modulo 2^64 (lsb first) */
+	unsigned char buffer[64]; /* input buffer */
+} MD4_CTX;
+
+__BEGIN_DECLS
+void	MD4Init(MD4_CTX *);
+void	MD4Update(MD4_CTX *, const unsigned char *, unsigned int);
+void	MD4Final(unsigned char[MD4_DIGEST_LENGTH], MD4_CTX *);
+#ifndef _KERNEL
+char	*MD4End(MD4_CTX *, char *);
+char	*MD4File(const char *, char *);
+char	*MD4Data(const unsigned char *, unsigned int, char *);
+#endif /* _KERNEL */
+__END_DECLS
+
+#endif /* _SYS_MD4_H_ */

Property changes on: lab4/.minix-src/include/sys/md4.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/midiio.h
===================================================================
--- lab4/.minix-src/include/sys/midiio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/midiio.h	(revision 13)
@@ -0,0 +1,780 @@
+/*	$NetBSD: midiio.h,v 1.16 2015/09/06 06:01:02 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (augustss@NetBSD.org) and (native API structures
+ * and macros) Chapman Flack (chap@NetBSD.org).
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_MIDIIO_H_
+#define _SYS_MIDIIO_H_
+
+/*
+ * The API defined here produces events compatible with the OSS MIDI API at
+ * the binary level.
+ */
+
+#include <machine/endian_machdep.h>
+#include <sys/ioccom.h>
+
+/*
+ * ioctl() commands for /dev/midi##
+ * XXX is directly frobbing an MPU401 even supported? isn't it just run
+ * in UART mode?
+ */
+typedef struct {
+	unsigned	char cmd;
+	char		nr_args, nr_returns;
+	unsigned char	data[30];
+} mpu_command_rec;
+
+#define MIDI_PRETIME		_IOWR('m', 0, int)
+#define MIDI_MPUMODE		_IOWR('m', 1, int)
+#define MIDI_MPUCMD		_IOWR('m', 2, mpu_command_rec)
+
+
+/* The MPU401 command acknowledge and active sense command */
+#define MIDI_ACK	0xfe
+
+
+/* Sequencer */
+#define SEQUENCER_RESET			_IO  ('Q', 0)
+#define SEQUENCER_SYNC			_IO  ('Q', 1)
+#define SEQUENCER_INFO			_IOWR('Q', 2, struct synth_info)
+#define SEQUENCER_CTRLRATE		_IOWR('Q', 3, int)
+#define SEQUENCER_GETOUTCOUNT		_IOR ('Q', 4, int)
+#define SEQUENCER_GETINCOUNT		_IOR ('Q', 5, int)
+/*#define SEQUENCER_PERCMODE		_IOW ('Q', 6, int)*/
+/*#define SEQUENCER_TESTMIDI		_IOW ('Q', 8, int)*/
+#define SEQUENCER_RESETSAMPLES		_IOW ('Q', 9, int)
+/*
+ * The sequencer at present makes no distinction between a 'synth' and a 'midi'.
+ * This is actually a cleaner layering than OSS: devices that are onboard
+ * synths just attach midi(4) via midisyn and present an ordinary MIDI face to
+ * the system. At present the same number is returned for NRSYNTHS and NRMIDIS
+ * but don't believe both, or you'll think you have twice as many devices as
+ * you really have. The MIDI_INFO ioctl isn't implemented; use SEQUENCER_INFO
+ * (which corresponds to OSS's SYNTH_INFO) to get information on any kind of
+ * device, though the struct synth_info it uses has some members that only
+ * pertain to synths (and get filled in with fixed, probably wrong values,
+ * anyway).
+ */
+#define SEQUENCER_NRSYNTHS		_IOR ('Q',10, int)
+#define SEQUENCER_NRMIDIS		_IOR ('Q',11, int)
+/*#define SEQUENCER_MIDI_INFO		_IOWR('Q',12, struct midi_info)*/
+#define SEQUENCER_THRESHOLD		_IOW ('Q',13, int)
+#define SEQUENCER_MEMAVL		_IOWR('Q',14, int)
+/*#define SEQUENCER_FM_4OP_ENABLE		_IOW ('Q',15, int)*/
+#define SEQUENCER_PANIC			_IO  ('Q',17)
+#define SEQUENCER_OUTOFBAND		_IOW ('Q',18, struct seq_event_rec)
+#define SEQUENCER_GETTIME		_IOR ('Q',19, int)
+/*#define SEQUENCER_ID			_IOWR('Q',20, struct synth_info)*/
+/*#define SEQUENCER_CONTROL		_IOWR('Q',21, struct synth_control)*/
+/*#define SEQUENCER_REMOVESAMPLE		_IOWR('Q',22, struct remove_sample)*/
+
+#if 0
+typedef struct synth_control {
+	int	devno;		/* Synthesizer # */
+	char	data[4000];	/* Device specific command/data record */
+} synth_control;
+
+typedef struct remove_sample {
+	int	devno;		/* Synthesizer # */
+	int	bankno;		/* MIDI bank # (0=General MIDI) */
+	int	instrno;	/* MIDI instrument number */
+} remove_sample;
+#endif
+
+#define CMDSIZE 8
+typedef struct seq_event_rec {
+	u_char	arr[CMDSIZE];
+} seq_event_rec;
+
+struct synth_info {
+	char	name[30];
+	int	device;
+	int	synth_type;
+#define SYNTH_TYPE_FM			0
+#define SYNTH_TYPE_SAMPLE		1
+#define SYNTH_TYPE_MIDI			2
+
+	int	synth_subtype;
+#define SYNTH_SUB_FM_TYPE_ADLIB		0x00
+#define SYNTH_SUB_FM_TYPE_OPL3		0x01
+#define SYNTH_SUB_MIDI_TYPE_MPU401	0x401
+
+#define SYNTH_SUB_SAMPLE_TYPE_BASIC	0x10
+#define SYNTH_SUB_SAMPLE_TYPE_GUS	SAMPLE_TYPE_BASIC
+
+	int	nr_voices;
+	int	instr_bank_size;
+	u_int	capabilities;
+#define SYNTH_CAP_OPL3			0x00000002
+#define SYNTH_CAP_INPUT			0x00000004
+};
+
+/* Sequencer timer */
+#define SEQUENCER_TMR_TIMEBASE		_IOWR('T', 1, int)
+#define SEQUENCER_TMR_START		_IO  ('T', 2)
+#define SEQUENCER_TMR_STOP		_IO  ('T', 3)
+#define SEQUENCER_TMR_CONTINUE		_IO  ('T', 4)
+#define SEQUENCER_TMR_TEMPO		_IOWR('T', 5, int)
+#define SEQUENCER_TMR_SOURCE		_IOWR('T', 6, int)
+#  define SEQUENCER_TMR_INTERNAL	0x00000001
+#if 0
+#  define SEQUENCER_TMR_EXTERNAL	0x00000002
+#  define SEQUENCER_TMR_MODE_MIDI	0x00000010
+#  define SEQUENCER_TMR_MODE_FSK	0x00000020
+#  define SEQUENCER_TMR_MODE_CLS	0x00000040
+#  define SEQUENCER_TMR_MODE_SMPTE	0x00000080
+#endif
+#define SEQUENCER_TMR_METRONOME		_IOW ('T', 7, int)
+#define SEQUENCER_TMR_SELECT		_IOW ('T', 8, int)
+
+
+#define MIDI_CTRL_BANK_SELECT_MSB	0
+#define MIDI_CTRL_MODULATION_MSB	1
+#define MIDI_CTRL_BREATH_MSB		2
+#define MIDI_CTRL_FOOT_MSB		4
+#define MIDI_CTRL_PORTAMENTO_TIME_MSB	5
+#define MIDI_CTRL_DATA_ENTRY_MSB	6
+#define MIDI_CTRL_CHANNEL_VOLUME_MSB	7
+#define MIDI_CTRL_BALANCE_MSB		8
+#define MIDI_CTRL_PAN_MSB		10
+#define MIDI_CTRL_EXPRESSION_MSB	11
+#define MIDI_CTRL_EFFECT_1_MSB		12
+#define MIDI_CTRL_EFFECT_2_MSB		13
+#define MIDI_CTRL_GENERAL_PURPOSE_1_MSB	16
+#define MIDI_CTRL_GENERAL_PURPOSE_2_MSB	17
+#define MIDI_CTRL_GENERAL_PURPOSE_3_MSB	18
+#define MIDI_CTRL_GENERAL_PURPOSE_4_MSB	19
+#define MIDI_CTRL_BANK_SELECT_LSB	32
+#define MIDI_CTRL_MODULATION_LSB	33
+#define MIDI_CTRL_BREATH_LSB		34
+#define MIDI_CTRL_FOOT_LSB		36
+#define MIDI_CTRL_PORTAMENTO_TIME_LSB	37
+#define MIDI_CTRL_DATA_ENTRY_LSB	38
+#define MIDI_CTRL_CHANNEL_VOLUME_LSB	39
+#define MIDI_CTRL_BALANCE_LSB		40
+#define MIDI_CTRL_PAN_LSB		42
+#define MIDI_CTRL_EXPRESSION_LSB	43
+#define MIDI_CTRL_EFFECT_1_LSB		44
+#define MIDI_CTRL_EFFECT_2_LSB		45
+#define MIDI_CTRL_GENERAL_PURPOSE_1_LSB	48
+#define MIDI_CTRL_GENERAL_PURPOSE_2_LSB	49
+#define MIDI_CTRL_GENERAL_PURPOSE_3_LSB	50
+#define MIDI_CTRL_GENERAL_PURPOSE_4_LSB	51
+#define MIDI_CTRL_HOLD_1		64
+#define MIDI_CTRL_PORTAMENTO		65
+#define MIDI_CTRL_SOSTENUTO		66
+#define MIDI_CTRL_SOFT_PEDAL		67
+#define MIDI_CTRL_LEGATO		68
+#define MIDI_CTRL_HOLD_2		69
+#define MIDI_CTRL_SOUND_VARIATION	70
+#define MIDI_CTRL_HARMONIC_INTENSITY	71
+#define MIDI_CTRL_RELEASE_TIME		72
+#define MIDI_CTRL_ATTACK_TIME		73
+#define MIDI_CTRL_BRIGHTNESS		74
+#define MIDI_CTRL_DECAY_TIME		75
+#define MIDI_CTRL_VIBRATO_RATE		76
+#define MIDI_CTRL_VIBRATO_DEPTH		77
+#define MIDI_CTRL_VIBRATO_DELAY		78
+#define MIDI_CTRL_VIBRATO_DECAY		MIDI_CTRL_VIBRATO_DELAY /*deprecated*/
+#define MIDI_CTRL_SOUND_10		79
+#define MIDI_CTRL_GENERAL_PURPOSE_5	80
+#define MIDI_CTRL_GENERAL_PURPOSE_6	81
+#define MIDI_CTRL_GENERAL_PURPOSE_7	82
+#define MIDI_CTRL_GENERAL_PURPOSE_8	83
+#define MIDI_CTRL_PORTAMENTO_CONTROL	84
+#define MIDI_CTRL_EFFECT_DEPTH_1	91
+#define MIDI_CTRL_EFFECT_DEPTH_2	92
+#define MIDI_CTRL_EFFECT_DEPTH_3	93
+#define MIDI_CTRL_EFFECT_DEPTH_4	94
+#define MIDI_CTRL_EFFECT_DEPTH_5	95
+#define MIDI_CTRL_RPN_INCREMENT		96
+#define MIDI_CTRL_RPN_DECREMENT		97
+#define MIDI_CTRL_NRPN_LSB		98
+#define MIDI_CTRL_NRPN_MSB		99
+#define MIDI_CTRL_RPN_LSB		100
+#define MIDI_CTRL_RPN_MSB		101
+#define MIDI_CTRL_SOUND_OFF		120
+#define MIDI_CTRL_RESET			121
+#define MIDI_CTRL_LOCAL			122
+#define MIDI_CTRL_NOTES_OFF		123
+#define MIDI_CTRL_ALLOFF		MIDI_CTRL_NOTES_OFF /*deprecated*/
+#define MIDI_CTRL_OMNI_OFF		124
+#define MIDI_CTRL_OMNI_ON		125
+#define MIDI_CTRL_POLY_OFF		126
+#define MIDI_CTRL_POLY_ON		127
+
+#define MIDI_BEND_NEUTRAL	(1<<13)
+
+#define MIDI_RPN_PITCH_BEND_SENSITIVITY	0
+#define MIDI_RPN_CHANNEL_FINE_TUNING	1
+#define MIDI_RPN_CHANNEL_COARSE_TUNING	2
+#define MIDI_RPN_TUNING_PROGRAM_CHANGE	3
+#define MIDI_RPN_TUNING_BANK_SELECT	4
+#define MIDI_RPN_MODULATION_DEPTH_RANGE	5
+
+#define MIDI_NOTEOFF		0x80
+#define MIDI_NOTEON		0x90
+#define MIDI_KEY_PRESSURE	0xA0
+#define MIDI_CTL_CHANGE		0xB0
+#define MIDI_PGM_CHANGE		0xC0
+#define MIDI_CHN_PRESSURE	0xD0
+#define MIDI_PITCH_BEND		0xE0
+#define MIDI_SYSTEM_PREFIX	0xF0
+
+#define MIDI_IS_STATUS(d) ((d) >= 0x80)
+#define MIDI_IS_COMMON(d) ((d) >= 0xf0)
+
+#define MIDI_SYSEX_START	0xF0
+#define MIDI_SYSEX_END		0xF7
+
+#define MIDI_GET_STATUS(d) ((d) & 0xf0)
+#define MIDI_GET_CHAN(d) ((d) & 0x0f)
+
+#define MIDI_HALF_VEL 64
+
+#define SEQ_LOCAL		0x80
+#define SEQ_TIMING		0x81
+#define SEQ_CHN_COMMON		0x92
+#define SEQ_CHN_VOICE		0x93
+#define SEQ_SYSEX		0x94
+#define SEQ_FULLSIZE		0xfd
+
+#define SEQ_MK_CHN_VOICE(e, unit, cmd, chan, key, vel) (\
+    (e)->arr[0] = SEQ_CHN_VOICE, (e)->arr[1] = (unit), (e)->arr[2] = (cmd),\
+    (e)->arr[3] = (chan), (e)->arr[4] = (key), (e)->arr[5] = (vel),\
+    (e)->arr[6] = 0, (e)->arr[7] = 0)
+#define SEQ_MK_CHN_COMMON(e, unit, cmd, chan, p1, p2, w14) (\
+    (e)->arr[0] = SEQ_CHN_COMMON, (e)->arr[1] = (unit), (e)->arr[2] = (cmd),\
+    (e)->arr[3] = (chan), (e)->arr[4] = (p1), (e)->arr[5] = (p2),\
+    *(short*)&(e)->arr[6] = (w14))
+
+#if _BYTE_ORDER == _BIG_ENDIAN
+/* big endian */
+#define SEQ_PATCHKEY(id) (0xfd00|id)
+#else
+/* little endian */
+#define SEQ_PATCHKEY(id) ((id<<8)|0xfd)
+#endif
+struct sysex_info {
+	uint16_t	key;	/* Use SYSEX_PATCH or MAUI_PATCH here */
+#define SEQ_SYSEX_PATCH	SEQ_PATCHKEY(0x05)
+#define SEQ_MAUI_PATCH	SEQ_PATCHKEY(0x06)
+	int16_t	device_no;	/* Synthesizer number */
+	int32_t	len;		/* Size of the sysex data in bytes */
+	u_char	data[1];	/* Sysex data starts here */
+};
+#define SEQ_SYSEX_HDRSIZE ((u_long)((struct sysex_info *)0)->data)
+
+typedef unsigned char sbi_instr_data[32];
+struct sbi_instrument {
+	uint16_t key;	/* FM_PATCH or OPL3_PATCH */
+#define SBI_FM_PATCH	SEQ_PATCHKEY(0x01)
+#define SBI_OPL3_PATCH	SEQ_PATCHKEY(0x03)
+	int16_t		device;
+	int32_t		channel;
+	sbi_instr_data	operators;
+};
+
+#define TMR_RESET		0	/* beware: not an OSS event */
+#define TMR_WAIT_REL		1	/* Time relative to the prev time */
+#define TMR_WAIT_ABS		2	/* Absolute time since TMR_START */
+#define TMR_STOP		3
+#define TMR_START		4
+#define TMR_CONTINUE		5
+#define TMR_TEMPO		6
+#define TMR_ECHO		8
+#define TMR_CLOCK		9	/* MIDI clock */
+#define TMR_SPP			10	/* Song position pointer */
+#define TMR_TIMESIG		11	/* Time signature */
+
+/* Old sequencer definitions */
+#define SEQOLD_CMDSIZE 4
+
+#define SEQOLD_NOTEOFF		0
+#define SEQOLD_NOTEON		1
+#define SEQOLD_WAIT		TMR_WAIT_ABS
+#define SEQOLD_PGMCHANGE	3
+#define SEQOLD_SYNCTIMER	TMR_START
+#define SEQOLD_MIDIPUTC		5
+#define SEQOLD_ECHO		TMR_ECHO
+#define SEQOLD_AFTERTOUCH	9
+#define SEQOLD_CONTROLLER	10
+#define SEQOLD_PRIVATE		0xfe
+#define SEQOLD_EXTENDED		0xff
+
+/*
+ * The 'midipitch' data type, used in the kernel between the midisyn layer and
+ * onboard synth drivers, and in userland as parameters to the MIDI Tuning Spec
+ * (RP-012) universal-system-exclusive messages. It is a MIDI key number shifted
+ * left to accommodate 14 bit sub-semitone resolution. In this representation,
+ * tuning and bending adjustments are simple addition and subtraction.
+ */
+typedef int32_t midipitch_t;
+
+/*
+ * Nominal conversions between midipitches and key numbers. (Beware that these
+ * are the nominal, standard correspondences, but whole point of the MIDI Tuning
+ * Spec is that you can set things up so the hardware might render key N at
+ * actual pitch MIDIPITCH_FROM_KEY(N)+c for some correction c.)
+ */
+#define MIDIPITCH_FROM_KEY(k) ((k)<<14)
+#define MIDIPITCH_TO_KEY(mp) (((mp)+(1<<13))>>14)
+
+#define MIDIPITCH_MAX (MIDIPITCH_FROM_KEY(128)-2) /* ...(128)-1 is reserved */
+#define MIDIPITCH_OCTAVE  196608
+#define MIDIPITCH_SEMITONE 16384
+#define MIDIPITCH_CENT       164 /* this, regrettably, is inexact. */
+
+/*
+ * For rendering, convert a midipitch (after all tuning adjustments) to Hz.
+ * The conversion is DEFINED as MIDI key 69.00000 (A) === 440 Hz equal tempered
+ * always. Alternate tunings are obtained by adjusting midipitches.
+ *
+ * The midihz18_t (Hz shifted left for 18-bit sub-Hz resolution) covers the
+ * full midipitch range without losing 21-bit precision, as the lowest midipitch
+ * is ~8 Hz (~3 bits left of radix point, 18 right) and for the highest the
+ * result still fits in a uint32.
+ */
+typedef uint32_t midihz18_t;
+
+#define MIDIHZ18_TO_HZ(h18) ((h18)>>18) /* truncates! ok for dbg msgs maybe */
+
+#ifndef _KERNEL
+/*
+ * With floating point in userland, can also manipulate midipitches as
+ * floating-point fractional MIDI key numbers (tuning adjustments are still
+ * additive), and hz18 as fractional Hz (adjustments don't add in this form).
+ */
+#include <math.h>
+#define MIDIPITCH_TO_FRKEY(mp) (scalbn((mp),-14))
+#define MIDIPITCH_FROM_FRKEY(frk) ((midipitch_t)round(scalbn((frk),14)))
+#define MIDIHZ18_TO_FRHZ(h18) (scalbn((h18),-18))
+#define MIDIHZ18_FROM_FRHZ(frh) ((midihz18_t)round(scalbn((frh),18)))
+
+#define MIDIPITCH_TO_FRHZ(mp) (440*pow(2,(MIDIPITCH_TO_FRKEY((mp))-69)/12))
+#define MIDIPITCH_FROM_FRHZ(fhz) \
+                               MIDIPITCH_FROM_FRKEY(69+12*log((fhz)/440)/log(2))
+#define MIDIPITCH_TO_HZ18(mp) MIDIHZ18_FROM_FRHZ(MIDIPITCH_TO_FRHZ((mp)))
+#define MIDIPITCH_FROM_HZ18(h18) MIDIPITCH_FROM_FRHZ(MIDIHZ18_TO_FRHZ((h18)))
+
+#else /* no fp in kernel; only an accurate to-hz18 conversion is implemented */
+
+extern midihz18_t midisyn_mp2hz18(midipitch_t);
+#define MIDIPITCH_TO_HZ18(mp) (midisyn_mp2hz18((mp)))
+
+#endif /* _KERNEL */
+
+
+/*
+ * A native API for the /dev/music sequencer device follows. The event
+ * structures are OSS events at the level of bytes, but for developing or
+ * porting applications some macros and documentation are needed to generate
+ * and dissect the events; here they are. For porting existing OSS applications,
+ * sys/soundcard.h can be extended to supply the usual OSS macros, defining them
+ * in terms of these.
+ */
+
+/*
+ * TODO: determine OSS compatible structures for TMR_RESET and TMR_CLOCK,
+ *       OSS values of EV_SYSTEM, SNDCTL_SEQ_ACTSENSE_ENABLE,
+ *       SNDCTL_SEQ_TIMING_ENABLE, and SNDCTL_SEQ_RT_ENABLE.
+ * (TMR_RESET may be a NetBSD extension: it is generated in sequencer.c and
+ * has no args. To be corrected if a different definition is found anywhere.)
+ */
+typedef union {
+
+#define _EVT_HDR \
+	uint8_t tag
+
+	_EVT_HDR;
+
+#define _LOCAL_HDR \
+	_EVT_HDR; \
+	uint8_t op
+
+	struct { _LOCAL_HDR; } local;
+
+	struct {
+		_LOCAL_HDR;
+		uint16_t _zero;
+		uint32_t devmask;
+	} l_startaudio;
+
+/* define a constructor for local evts - someday when we support any */
+
+#define _TIMING_HDR \
+	_LOCAL_HDR; \
+	uint16_t _zeroh
+	struct { _TIMING_HDR; } timing;
+	
+	struct {
+		_TIMING_HDR;
+		uint32_t divisions;
+	} t_WAIT_REL, t_WAIT_ABS;
+	
+	struct {
+		_TIMING_HDR;
+		uint32_t _zero;
+	} t_STOP, t_START, t_CONTINUE, t_RESET;
+	
+	struct {
+		_TIMING_HDR;
+		uint32_t bpm; /* unambiguously, (MIDI clocks/minute)/24 */
+	} t_TEMPO;
+	
+	struct {
+		_TIMING_HDR;
+		uint32_t cookie;
+	} t_ECHO;
+	
+	struct {
+		_TIMING_HDR;
+		uint32_t midibeat; /* in low 14 bits; midibeat: 6 MIDI clocks */
+	} t_SPP;
+	
+	struct {
+		_TIMING_HDR;
+#if _BYTE_ORDER == _BIG_ENDIAN
+		uint8_t numerator;
+		uint8_t lg2denom;
+		uint8_t clks_per_click;
+		uint8_t dsq_per_24clks;
+#elif _BYTE_ORDER == _LITTLE_ENDIAN
+		uint8_t dsq_per_24clks;
+		uint8_t clks_per_click;
+		uint8_t lg2denom;
+		uint8_t numerator;
+#else
+#error "unexpected _BYTE_ORDER"
+#endif
+	} t_TIMESIG;
+	
+	struct { /* use this only to implement OSS compatibility macro */
+		_TIMING_HDR;
+		uint32_t signature;
+	} t_osscompat_timesig;
+	
+
+#define _COMMON_HDR \
+	_EVT_HDR; \
+	uint8_t device; \
+	uint8_t op; \
+	uint8_t channel
+
+	struct { _COMMON_HDR; } common;
+
+	struct {
+		_COMMON_HDR;
+		uint8_t controller;
+		uint8_t _zero;
+		uint16_t value;
+	} c_CTL_CHANGE;
+	
+	struct {
+		_COMMON_HDR;
+		uint8_t program;
+		uint8_t _zero0;
+		uint16_t _zero1;
+	} c_PGM_CHANGE;
+	
+	struct {
+		_COMMON_HDR;
+		uint8_t pressure;
+		uint8_t _zero0;
+		uint16_t _zero1;
+	} c_CHN_PRESSURE;
+	
+	struct {
+		_COMMON_HDR;
+		uint8_t _zero0;
+		uint8_t _zero1;
+		uint16_t value;
+	} c_PITCH_BEND;
+
+#define _VOICE_HDR \
+	_COMMON_HDR; \
+	uint8_t key
+
+	struct { _VOICE_HDR; }  voice;
+
+	struct {
+		_VOICE_HDR;
+		uint8_t velocity;
+		uint16_t _zero;
+	} c_NOTEOFF, c_NOTEON;
+
+	struct {
+		_VOICE_HDR;
+		uint8_t pressure;
+		uint16_t _zero;
+	} c_KEY_PRESSURE;
+
+	struct {
+		_EVT_HDR;
+		uint8_t device;
+		uint8_t buffer[6];
+	} sysex;
+
+	struct {
+		_EVT_HDR;
+		uint8_t device;
+		uint8_t status;
+		uint8_t data[2];
+	} system;
+	
+	struct {
+		_EVT_HDR;
+		uint8_t byte;
+		uint8_t device;
+		uint8_t _zero0;
+		uint32_t _zero1;
+	} putc; /* a seqold event that's still needed at times, ugly as 'tis */
+
+	struct {
+		_EVT_HDR;
+		uint8_t byte[7];
+	} unknown; /* for debug/display */
+
+#undef _VOICE_HDR
+#undef _COMMON_HDR
+#undef _TIMING_HDR
+#undef _LOCAL_HDR
+#undef _EVT_HDR
+	
+} __packed seq_event_t;
+
+#define _SEQ_TAG_NOTEOFF	SEQ_CHN_VOICE
+#define _SEQ_TAG_NOTEON 	SEQ_CHN_VOICE
+#define _SEQ_TAG_KEY_PRESSURE	SEQ_CHN_VOICE
+
+#define _SEQ_TAG_CTL_CHANGE	SEQ_CHN_COMMON
+#define _SEQ_TAG_PGM_CHANGE	SEQ_CHN_COMMON
+#define _SEQ_TAG_CHN_PRESSURE	SEQ_CHN_COMMON
+#define _SEQ_TAG_PITCH_BEND	SEQ_CHN_COMMON
+
+#if __STDC_VERSION__ >= 199901L
+
+#define SEQ_MK_EVENT(_member,_tag,...)					\
+(seq_event_t){ ._member = { .tag = (_tag), __VA_ARGS__ } }
+
+#define SEQ_MK_TIMING(_op,...)						\
+SEQ_MK_EVENT(t_##_op, SEQ_TIMING, .op = TMR_##_op, __VA_ARGS__)
+
+#define SEQ_MK_CHN(_op,...)						\
+SEQ_MK_EVENT(c_##_op, _SEQ_TAG_##_op, .op = MIDI_##_op, __VA_ARGS__)
+
+#define SEQ_MK_SYSEX(_dev,...)						\
+SEQ_MK_EVENT(sysex, 0x94, .device=(_dev), 				\
+             .buffer={0xff, 0xff, 0xff, 0xff, 0xff, 0xff, __VA_ARGS__})
+
+#else /* assume gcc 2.95.3 */
+
+#define SEQ_MK_EVENT(_member,_tag,_args...)				\
+(seq_event_t){ ._member = { .tag = (_tag), _args } }
+
+#define SEQ_MK_TIMING(_op,_args...)						\
+SEQ_MK_EVENT(t_##_op, SEQ_TIMING, .op = TMR_##_op, _args)
+
+#define SEQ_MK_CHN(_op,_args...)					\
+SEQ_MK_EVENT(c_##_op, _SEQ_TAG_##_op, .op = MIDI_##_op, _args)
+
+#define SEQ_MK_SYSEX(_dev,_args...)						\
+SEQ_MK_EVENT(sysex, 0x94, .device=(_dev), 				\
+             .buffer={0xff, 0xff, 0xff, 0xff, 0xff, 0xff, _args})
+
+#endif /* c99 vs. gcc 2.95.3 */
+
+#if 0
+#include <fcntl.h>
+#include <stdio.h>
+int
+main(int argc, char **argv)
+{
+	int i;
+	int fd;
+	seq_event_t e;
+	
+	/* simple usage example (add a buffer to reduce syscall overhead) */
+	fd = open("/dev/music", O_RDWR);
+	write(fd, &SEQ_MK_TIMING(START), sizeof (seq_event_t));
+	
+	read(fd, &e, sizeof e);
+	switch ( e.tag ) {
+	case SEQ_CHN_VOICE:
+		switch ( e.voice.op ) {
+		case MIDI_NOTEON:
+			printf("Note on, dev=%d chn=%d key=%d vel=%d\n",
+			    e.c_NOTEON.device, e.c_NOTEON.channel,
+			    e.c_NOTEON.key, e.c_NOTEON.velocity);
+		}
+	}
+
+	/* all the macros: */
+	e = SEQ_MK_TIMING(START);
+	e = SEQ_MK_TIMING(STOP);
+	e = SEQ_MK_TIMING(CONTINUE);
+	/*
+	 * Wait until the specified number of divisions from the timer start
+	 * (abs) or the preceding event (rel). The number of divisions to a
+	 * beat or to a MIDI clock is determined by the timebase (set by
+	 * ioctl). The tempo is expressed in beats per minute, where a beat
+	 * is always 24 MIDI clocks (and usually equated to a quarter note,
+	 * but that can be changed with timesig)--that is, tempo is
+	 * (MIDI clocks per minute)/24. The timebase is the number of divisions
+	 * in a beat--that is, the number of divisions that make up 24 MIDI
+	 * clocks--so the timebase is 24*(divisions per MIDI clock). The MThd
+	 * header in a SMF gives the 'natural' timebase for the file; if the
+	 * timebase is set accordingly, then the delay values appearing in the
+	 * tracks are in terms of divisions, and can be used as WAIT_REL
+	 * arguments without modification.
+	 */
+	e = SEQ_MK_TIMING(WAIT_ABS, .divisions=192);
+	e = SEQ_MK_TIMING(WAIT_REL, .divisions=192);
+	/*
+	 * The 'beat' in bpm is 24 MIDI clocks (usually a quarter note but
+	 * changeable with timesig).
+	 */
+	e = SEQ_MK_TIMING(TEMPO, .bpm=84);
+	/*
+	 * An ECHO event on output appears on input at the appointed time; the
+	 * cookie can be anything of interest to the application. Can be used
+	 * in schemes to get some control over latency.
+	 */
+	e = SEQ_MK_TIMING(ECHO, .cookie=0xfeedface);
+	/*
+	 * A midibeat is smaller than a beat. It is six MIDI clocks, or a fourth
+	 * of a beat, or a sixteenth note if the beat is a quarter. SPP is a
+	 * request to position at the requested midibeat from the start of the
+	 * sequence. [sequencer does not at present implement SPP]
+	 */
+	e = SEQ_MK_TIMING(SPP, .midibeat=128);
+	/*
+	 * numerator and lg2denom describe the time signature as it would
+	 * appear on a staff, where lg2denom of 0,1,2,3... corresponds to
+	 * denominator of 1,2,4,8... respectively. So the example below
+	 * corresponds to 4/4. dsq_per_24clks defines the relationship of
+	 * MIDI clocks to note values, by specifying the number of
+	 * demisemiquavers (32nd notes) represented by 24 MIDI clocks.
+	 * The default is 8 demisemiquavers, or a quarter note.
+	 * clks_per_click can configure a metronome (for example, the MPU401
+	 * had such a feature in intelligent mode) to click every so many
+	 * MIDI clocks. The 24 in this example would give a click every quarter
+	 * note. [sequencer does not at present implement TIMESIG]
+	 */
+	e = SEQ_MK_TIMING(TIMESIG, .numerator=4, .lg2denom=2,
+	                           .clks_per_click=24, .dsq_per_24clks=8);
+	/*
+	 * This example declares 6/8 time where the beat (24 clocks) is the
+	 * eighth note, but the metronome clicks every dotted quarter (twice
+	 * per measure):
+	 */
+	e = SEQ_MK_TIMING(TIMESIG, .numerator=6, .lg2denom=3,
+	                           .clks_per_click=72, .dsq_per_24clks=4);
+	/*
+	 * An alternate declaration for 6/8 where the beat (24 clocks) is now
+	 * the dotted quarter and corresponds to the metronome click:
+	 */
+	e = SEQ_MK_TIMING(TIMESIG, .numerator=6, .lg2denom=3,
+	                           .clks_per_click=24, .dsq_per_24clks=12);
+	/*
+	 * It would also be possible to keep the default correspondence of
+	 * 24 clocks to the quarter note (8 dsq), and still click the metronome
+	 * each dotted quarter:
+	 */
+	e = SEQ_MK_TIMING(TIMESIG, .numerator=6, .lg2denom=3,
+	                           .clks_per_click=36, .dsq_per_24clks=8);
+
+	e = SEQ_MK_CHN(NOTEON,  .device=1, .channel=0, .key=60, .velocity=64);
+	e = SEQ_MK_CHN(NOTEOFF, .device=1, .channel=0, .key=60, .velocity=64);
+	e = SEQ_MK_CHN(KEY_PRESSURE, .device=1, .channel=0, .key=60,
+	                             .pressure=64);
+	
+	/*
+	 * sequencer does not at present implement CTL_CHANGE well. The API
+	 * provides for a 14-bit value where you give the controller index
+	 * of the controller MSB and sequencer will split the 14-bit value to
+	 * the controller MSB and LSB for you--but it doesn't; it ignores the
+	 * high bits of value and writes the low bits whether you have specified
+	 * MSB or LSB. That would not be hard to fix but for the fact that OSS
+	 * itself seems to suffer from the same mixup (and its behavior differs
+	 * with whether the underlying device is an onboard synth or a MIDI
+	 * link!) so there is surely a lot of code that relies on it being
+	 * broken :(.
+	 * (Note: as the OSS developers have ceased development of the
+	 * /dev/music API as of OSS4, it would be possible given a complete
+	 * list of the events defined in OSS4 to add some new ones for native
+	 * use without fear of future conflict, such as a better ctl_change.)
+	 */
+	e = SEQ_MK_CHN(CTL_CHANGE, .device=1, .channel=0,
+	               .controller=MIDI_CTRL_EXPRESSION_MSB, .value=8192);/*XX*/
+	/*
+	 * The way you really have to do it:
+	 */
+	e = SEQ_MK_CHN(CTL_CHANGE, .device=1, .channel=0,
+	               .controller=MIDI_CTRL_EXPRESSION_MSB, .value=8192>>7);
+	e = SEQ_MK_CHN(CTL_CHANGE, .device=1, .channel=0,
+	               .controller=MIDI_CTRL_EXPRESSION_LSB, .value=8192&0x7f);
+
+	e = SEQ_MK_CHN(PGM_CHANGE,   .device=1, .channel=0, .program=51);
+	e = SEQ_MK_CHN(CHN_PRESSURE, .device=1, .channel=0, .pressure=64);
+	e = SEQ_MK_CHN(PITCH_BEND,   .device=1, .channel=0, .value=8192);
+	
+	/*
+	 * A SYSEX event carries up to six bytes of a system exclusive message.
+	 * The first such message must begin with MIDI_SYSEX_START (0xf0), the
+	 * last must end with MIDI_SYSEX_END (0xf7), and only the last may carry
+	 * fewer than 6 bytes. To supply message bytes in the macro, you must
+	 * prefix the first with [0]= as shown. The macro's first argument is
+	 * the device.
+	 */
+	e = SEQ_MK_SYSEX(1,[0]=MIDI_SYSEX_START,1,2,MIDI_SYSEX_END);
+	/*
+	 * In some cases it may be easier to use the macro only to initialize
+	 * the event, and fill in the message bytes later. The code that fills
+	 * in the message does not need to store 0xff following the SYSEX_END.
+	 */
+	e = SEQ_MK_SYSEX(1);
+	for ( i = 0; i < 3; ++ i )
+		e.sysex.buffer[i] = i;
+	/*
+	 * It would be nice to think the old /dev/sequencer MIDIPUTC event
+	 * obsolete, but it is still needed (absent any better API) by any MIDI
+	 * file player that will implement the ESCAPED events that may occur in
+	 * SMF. Sorry. Here's how to use it:
+	 */
+	e = SEQ_MK_EVENT(putc, SEQOLD_MIDIPUTC, .device=1, .byte=42);
+	
+	printf("confirm event size: %d (should be 8)\n", sizeof (seq_event_t));
+	return 0;
+}
+#endif /* 0 */
+
+#endif /* !_SYS_MIDIIO_H_ */

Property changes on: lab4/.minix-src/include/sys/midiio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ksyms.h
===================================================================
--- lab4/.minix-src/include/sys/ksyms.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ksyms.h	(revision 13)
@@ -0,0 +1,147 @@
+/*	$NetBSD: ksyms.h,v 1.33 2015/09/06 06:01:02 dholland Exp $	*/
+
+/*
+ * Copyright (c) 2001, 2003 Anders Magnusson (ragge@ludd.luth.se).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+#ifndef _SYS_KSYMS_H_
+#define _SYS_KSYMS_H_
+
+#ifdef _KSYMS_PRIVATE
+#include <sys/exec_elf.h>
+#include <sys/ioccom.h>
+#include <sys/queue.h>
+
+struct ksyms_symtab {
+	TAILQ_ENTRY(ksyms_symtab) sd_queue; /* All active tables */
+	const char *sd_name;	/* Name of this table */
+	Elf_Sym *sd_symstart;	/* Address of symbol table */
+	uintptr_t sd_minsym;	/* symbol with minimum value */
+	uintptr_t sd_maxsym;	/* symbol with maximum value */
+	char *sd_strstart;	/* Address of corresponding string table */
+	int sd_usroffset;	/* Real address for userspace */
+	int sd_symsize;		/* Size in bytes of symbol table */
+	int sd_strsize;		/* Size of string table */
+	int sd_nglob;		/* Number of global symbols */
+	bool sd_gone;		/* dead but around for open() */
+	void *sd_ctfstart;	/* Address of CTF contents */
+	int sd_ctfsize;		/* Size in bytes of CTF contents */
+	uint32_t *sd_nmap;	/* Name map for sorted symbols */
+	int sd_nmapsize;	/* Total span of map */
+};
+
+/*
+ * Static allocated ELF header.
+ * Basic info is filled in at attach, sizes at open.
+ */
+#define	SHNOTE		1
+#define	SYMTAB		2
+#define	STRTAB		3
+#define	SHSTRTAB	4
+#define	SHBSS		5
+#define	SHCTF		6
+#define	NSECHDR		7
+
+#define	NPRGHDR		1
+#define	SHSTRSIZ	64
+
+struct ksyms_hdr {
+	Elf_Ehdr	kh_ehdr;
+	Elf_Phdr	kh_phdr[NPRGHDR];
+	Elf_Shdr	kh_shdr[NSECHDR];
+	char 		kh_strtab[SHSTRSIZ];
+	/* 0=NameSize, 1=DescSize, 2=Tag, 3="NetB", 4="SD\0\0", 5=Version */
+	int32_t		kh_note[6];
+};
+#endif	/* _KSYMS_PRIVATE */
+
+/*
+ * Do a lookup of a symbol using the in-kernel lookup algorithm.
+ */
+struct ksyms_ogsymbol {
+	const char *kg_name;
+	union {
+		void *ku_sym;		 /* Normally Elf_Sym */
+		unsigned long *ku_value;
+	} _un;
+#define	kg_sym _un.ku_sym
+#define	kg_value _un.ku_value
+};
+
+#ifdef ELFSIZE
+struct ksyms_gsymbol {
+	const char *kg_name;
+	union {
+		Elf_Sym ku_sym;
+	} _un;
+};
+#endif
+
+struct ksyms_gvalue {
+	const char *kv_name;
+	uint64_t kv_value;
+};
+
+#define	OKIOCGSYMBOL	_IOW('l', 1, struct ksyms_ogsymbol)
+#define	OKIOCGVALUE	_IOW('l', 2, struct ksyms_ogsymbol)
+#define	KIOCGSIZE	_IOR('l', 3, int)
+#define	KIOCGVALUE	_IOWR('l', 4, struct ksyms_gvalue)
+#define	KIOCGSYMBOL	_IOWR('l', 5, struct ksyms_gsymbol)
+
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+/*
+ * Definitions used in ksyms_getname() and ksyms_getval().
+ */
+#define	KSYMS_CLOSEST	0001	/* Nearest lower match */
+#define	KSYMS_EXACT	0002	/* Only exact match allowed */
+#define KSYMS_EXTERN	0000	/* Only external symbols (pseudo) */
+#define KSYMS_PROC	0100	/* Procedures only */
+#define KSYMS_ANY	0200	/* Also local symbols (DDB use only) */
+
+typedef int (*ksyms_callback_t)(const char *, int, void *,
+	uint32_t, int, void *);
+
+/*
+ * Prototypes
+ */
+
+int ksyms_getname(const char **, const char **, vaddr_t, int);
+int ksyms_getval(const char *, const char *, unsigned long *, int);
+int ksyms_getval_unlocked(const char *, const char *, unsigned long *, int);
+struct ksyms_symtab *ksyms_get_mod(const char *);
+int ksyms_mod_foreach(const char *mod, ksyms_callback_t, void *);
+int ksyms_addsymtab(const char *, void *, vsize_t, char *, vsize_t);
+int ksyms_delsymtab(const char *);
+void ksyms_init(void);
+void ksyms_addsyms_elf(int, void *, void *);
+void ksyms_addsyms_explicit(void *, void *, size_t, void *, size_t);
+int ksyms_sift(char *, char *, int);
+void ksyms_modload(const char *, void *, vsize_t, char *, vsize_t);
+void ksyms_modunload(const char *);
+
+#endif /* _KERNEL */
+#endif /* _SYS_KSYMS_H_ */

Property changes on: lab4/.minix-src/include/sys/ksyms.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/module.h
===================================================================
--- lab4/.minix-src/include/sys/module.h	(nonexistent)
+++ lab4/.minix-src/include/sys/module.h	(revision 13)
@@ -0,0 +1,237 @@
+/*	$NetBSD: module.h,v 1.38 2015/06/22 16:35:13 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_MODULE_H_
+#define _SYS_MODULE_H_
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/cdefs.h>
+#include <sys/queue.h>
+#include <sys/uio.h>
+
+#define	MAXMODNAME	32
+#define	MAXMODDEPS	10
+
+/* Module classes, provided only for system boot and cosmetic purposes. */
+typedef enum modclass {
+	MODULE_CLASS_ANY,
+	MODULE_CLASS_MISC,
+	MODULE_CLASS_VFS,
+	MODULE_CLASS_DRIVER,
+	MODULE_CLASS_EXEC,
+	MODULE_CLASS_SECMODEL
+} modclass_t;
+
+/* Module sources: where did it come from? */
+typedef enum modsrc {
+	MODULE_SOURCE_KERNEL,
+	MODULE_SOURCE_BOOT,
+	MODULE_SOURCE_FILESYS
+} modsrc_t;
+
+/* Commands passed to module control routine. */
+typedef enum modcmd {
+	MODULE_CMD_INIT,		/* mandatory */
+	MODULE_CMD_FINI,		/* mandatory */
+	MODULE_CMD_STAT,		/* optional */
+	MODULE_CMD_AUTOUNLOAD,		/* optional */
+} modcmd_t;
+
+#ifdef _KERNEL
+
+#include <sys/mutex.h>
+
+#include <prop/proplib.h>
+
+/* Module header structure. */
+typedef struct modinfo {
+	u_int		mi_version;
+	modclass_t	mi_class;
+	int		(*mi_modcmd)(modcmd_t, void *);
+	const char	*mi_name;
+	const char	*mi_required;
+} const modinfo_t;
+
+/* Per module information, maintained by kern_module.c */ 
+typedef struct module {
+	u_int			mod_refcnt;
+	const modinfo_t		*mod_info;
+	struct kobj		*mod_kobj;
+	TAILQ_ENTRY(module)	mod_chain;
+	struct module		*mod_required[MAXMODDEPS];
+	u_int			mod_nrequired;
+	modsrc_t		mod_source;
+	time_t			mod_autotime;
+	void 			*mod_ctf;
+	u_int			mod_fbtentries;	/* DTrace FBT entry count */
+	int			mod_flags;
+#define MODFLG_MUST_FORCE	0x01
+#define MODFLG_AUTO_LOADED	0x02
+
+} module_t;
+
+/*
+ * Per-module linkage.  Loadable modules have a `link_set_modules' section
+ * containing only one entry, pointing to the module's modinfo_t record.
+ * For the kernel, `link_set_modules' can contain multiple entries and
+ * records all modules built into the kernel at link time.
+ *
+ * Alternatively, in some environments rump kernels use
+ * __attribute__((constructor)) due to link sets being
+ * difficult (impossible?) to implement (e.g. GNU gold, OS X, etc.)
+ */
+
+#ifdef RUMP_USE_CTOR
+struct modinfo_chain {
+	const struct modinfo	*mc_info;
+	LIST_ENTRY(modinfo_chain) mc_entries;
+};
+LIST_HEAD(modinfo_boot_chain, modinfo_chain);
+#define _MODULE_REGISTER(name)						\
+static void __CONCAT(modctor_,name)(void) __attribute__((__constructor__));\
+static void __CONCAT(modctor_,name)(void)				\
+{									\
+	static struct modinfo_chain mc = {				\
+		.mc_info = &__CONCAT(name,_modinfo),			\
+	};								\
+	extern struct modinfo_boot_chain modinfo_boot_chain;		\
+	LIST_INSERT_HEAD(&modinfo_boot_chain, &mc, mc_entries);		\
+}
+
+#else /* RUMP_USE_CTOR */
+
+#define _MODULE_REGISTER(name) __link_set_add_rodata(modules, __CONCAT(name,_modinfo));
+
+#endif /* RUMP_USE_CTOR */
+
+#define	MODULE(class, name, required)				\
+static int __CONCAT(name,_modcmd)(modcmd_t, void *);		\
+static const modinfo_t __CONCAT(name,_modinfo) = {		\
+	.mi_version = __NetBSD_Version__,			\
+	.mi_class = (class),					\
+	.mi_modcmd = __CONCAT(name,_modcmd),			\
+	.mi_name = __STRING(name),				\
+	.mi_required = (required)				\
+}; 								\
+_MODULE_REGISTER(name)
+
+TAILQ_HEAD(modlist, module);
+
+extern struct vm_map	*module_map;
+extern u_int		module_count;
+extern u_int		module_builtinlist;
+extern struct modlist	module_list;
+extern struct modlist	module_builtins;
+extern u_int		module_gen;
+
+void	module_init(void);
+void	module_start_unload_thread(void);
+void	module_builtin_require_force(void);
+void	module_init_md(void);
+void	module_init_class(modclass_t);
+int	module_prime(const char *, void *, size_t);
+
+bool	module_compatible(int, int);
+int	module_load(const char *, int, prop_dictionary_t, modclass_t);
+int	module_builtin_add(modinfo_t * const *, size_t, bool);
+int	module_builtin_remove(modinfo_t *, bool);
+int	module_autoload(const char *, modclass_t);
+int	module_unload(const char *);
+int	module_hold(const char *);
+void	module_rele(const char *);
+int	module_find_section(const char *, void **, size_t *);
+void	module_thread_kick(void);
+void	module_load_vfs_init(void);
+
+void	module_whatis(uintptr_t, void (*)(const char *, ...)
+    __printflike(1, 2));
+void	module_print_list(void (*)(const char *, ...) __printflike(1, 2));
+
+#ifdef _MODULE_INTERNAL
+extern
+int	(*module_load_vfs_vec)(const char *, int, bool, module_t *,
+			       prop_dictionary_t *);
+int	module_load_vfs(const char *, int, bool, module_t *,
+			prop_dictionary_t *);
+void	module_error(const char *, ...) __printflike(1, 2);
+void	module_print(const char *, ...) __printflike(1, 2);
+#endif /* _MODULE_INTERNAL */
+
+#define MODULE_BASE_SIZE 64
+extern char	module_base[MODULE_BASE_SIZE];
+extern const char	*module_machine;
+
+#else	/* _KERNEL */
+
+#include <stdint.h>
+
+#endif	/* _KERNEL */
+
+typedef struct modctl_load {
+	const char *ml_filename;
+
+#define MODCTL_NO_PROP		0x2
+#define MODCTL_LOAD_FORCE	0x1
+	int ml_flags;
+
+	const char *ml_props;
+	size_t ml_propslen;
+} modctl_load_t;
+
+typedef enum modctl {
+	MODCTL_LOAD,		/* modctl_load_t *ml */
+	MODCTL_UNLOAD,		/* char *name */
+	MODCTL_STAT,		/* struct iovec *buffer */
+	MODCTL_EXISTS		/* enum: 0: load, 1: autoload */
+} modctl_t;
+
+/*
+ * This structure intentionally has the same layout for 32 and 64
+ * bit builds.
+ */
+typedef struct modstat {
+	char		ms_name[MAXMODNAME];
+	char		ms_required[MAXMODNAME * MAXMODDEPS];
+	uint64_t	ms_addr;
+	modsrc_t	ms_source;
+	modclass_t	ms_class;
+	u_int		ms_size;
+	u_int		ms_refcnt;
+	u_int		ms_reserved[4];
+} modstat_t;
+
+int	modctl(int, void *);
+
+#ifdef _KERNEL
+/* attention: pointers passed are userland pointers!,
+   see modctl_load_t */
+int	handle_modctl_load(const char *, int, const char *, size_t);
+#endif
+
+#endif	/* !_SYS_MODULE_H_ */

Property changes on: lab4/.minix-src/include/sys/module.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/pset.h
===================================================================
--- lab4/.minix-src/include/sys/pset.h	(nonexistent)
+++ lab4/.minix-src/include/sys/pset.h	(revision 13)
@@ -0,0 +1,74 @@
+/*	$NetBSD: pset.h,v 1.4 2013/04/27 21:35:24 joerg Exp $	*/
+
+/*
+ * Copyright (c) 2008, Mindaugas Rasiukevicius <rmind at NetBSD org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_PSET_H_
+#define _SYS_PSET_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+/* Types of processor-sets */
+#define	PS_NONE			0
+#define	PS_MYID			-1
+#define	PS_QUERY		-2
+
+/* ID types for processor-set calls */
+#define	P_MYID			-1
+#define	P_PID			1
+#define	P_LWPID			2
+
+/* For compatibility only */
+typedef	cpuid_t		processorid_t;
+
+__BEGIN_DECLS
+int	pset_assign(psetid_t, cpuid_t, psetid_t *);
+int	pset_bind(psetid_t, idtype_t, id_t, psetid_t *);
+int	pset_create(psetid_t *);
+int	pset_destroy(psetid_t);
+__END_DECLS
+
+#ifdef _NETBSD_SOURCE
+int	_pset_bind(idtype_t, id_t, id_t, psetid_t, psetid_t *);
+#endif	/* _NETBSD_SOURCE */
+
+#ifdef _KERNEL
+
+/* Processor-set structure */
+typedef struct {
+	int		ps_flags;
+} pset_info_t;
+
+/* Flags */
+#define	PSET_BUSY	0x01
+
+void	psets_init(void);
+
+#endif	/* _KERNEL */
+
+#endif	/* _SYS_PSET_H_ */

Property changes on: lab4/.minix-src/include/sys/pset.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/mqueue.h
===================================================================
--- lab4/.minix-src/include/sys/mqueue.h	(nonexistent)
+++ lab4/.minix-src/include/sys/mqueue.h	(revision 13)
@@ -0,0 +1,121 @@
+/*	$NetBSD: mqueue.h,v 1.17 2015/06/20 14:41:54 martin Exp $	*/
+
+/*
+ * Copyright (c) 2007-2009 Mindaugas Rasiukevicius <rmind at NetBSD org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_MQUEUE_H_
+#define _SYS_MQUEUE_H_
+
+/* Maximal number of mqueue descriptors, that process could open */
+#define	MQ_OPEN_MAX		512
+
+/* Maximal priority of the message */
+#define	MQ_PRIO_MAX		32
+
+struct mq_attr {
+	long	mq_flags;	/* Flags of message queue */
+	long	mq_maxmsg;	/* Maximum number of messages */
+	long	mq_msgsize;	/* Maximum size of the message */
+	long	mq_curmsgs;	/* Count of the queued messages */
+};
+
+/* Internal kernel data */
+#ifdef _KERNEL
+
+#include <sys/condvar.h>
+#include <sys/mutex.h>
+#include <sys/queue.h>
+#include <sys/selinfo.h>
+#include <sys/types.h>
+#include <sys/param.h>
+
+/*
+ * Flags below are used in mq_flags for internal purposes.
+ * This is permitted according to POSIX.
+ */
+
+/* Message queue is unlinked */
+#define	MQ_UNLINKED		0x10000000
+/* There are receive-waiters */
+#define	MQ_RECEIVE		0x20000000
+
+/* Maximal length of mqueue name */
+#define	MQ_NAMELEN		(KERNEL_NAME_MAX + 1)
+
+/* Default size of the message */
+#define	MQ_DEF_MSGSIZE		1024
+
+/* Size/bits and index of reserved queue */
+#define	MQ_PQSIZE		32
+#define	MQ_PQRESQ		0
+
+/* Structure of the message queue. */
+typedef struct mqueue {
+	char *			mq_name;
+	kmutex_t		mq_mtx;
+	kcondvar_t		mq_send_cv;
+	kcondvar_t		mq_recv_cv;
+	struct mq_attr		mq_attrib;
+	/* Notification */
+	struct selinfo		mq_rsel;
+	struct selinfo		mq_wsel;
+	struct sigevent		mq_sig_notify;
+	struct proc *		mq_notify_proc;
+	/* Permissions */
+	mode_t			mq_mode;
+	uid_t			mq_euid;
+	gid_t			mq_egid;
+	/* Reference counter, queue array and bitmap */
+	u_int			mq_refcnt;
+	TAILQ_HEAD(, mq_msg)	mq_head[1 + MQ_PQSIZE];
+	uint32_t		mq_bitmap;
+	/* Entry of the global list */
+	LIST_ENTRY(mqueue)	mq_list;
+	/* Time stamps */
+	struct timespec		mq_atime;
+	struct timespec		mq_mtime;
+	struct timespec		mq_btime;
+} mqueue_t;
+
+/* Structure of the message. */
+typedef struct mq_msg {
+	TAILQ_ENTRY(mq_msg)	msg_queue;
+	size_t			msg_len;
+	u_int			msg_prio;
+	uint8_t			msg_ptr[1];
+} mq_msg_t;
+
+/* Prototypes */
+void	mqueue_print_list(void (*pr)(const char *, ...) __printflike(1, 2));
+int	mq_send1(mqd_t, const char *, size_t, u_int, struct timespec *);
+int	mq_recv1(mqd_t, void *, size_t, u_int *, struct timespec *, ssize_t *);
+int	mqueue_get(mqd_t mqd, int fflag, mqueue_t **mqret);
+int	mq_handle_open(struct lwp *l, const char *, int, mode_t,
+	    struct mq_attr*, register_t *retval);
+
+#endif	/* _KERNEL */
+
+#endif	/* _SYS_MQUEUE_H_ */

Property changes on: lab4/.minix-src/include/sys/mqueue.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/msgbuf.h
===================================================================
--- lab4/.minix-src/include/sys/msgbuf.h	(nonexistent)
+++ lab4/.minix-src/include/sys/msgbuf.h	(revision 13)
@@ -0,0 +1,56 @@
+/*	$NetBSD: msgbuf.h,v 1.15 2007/11/07 00:19:08 ad Exp $	*/
+
+/*
+ * Copyright (c) 1981, 1984, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)msgbuf.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_MSGBUF_H_
+#define _SYS_MSGBUF_H_
+
+struct	kern_msgbuf {
+#define	MSG_MAGIC	0x063061
+	long	msg_magic;
+	long	msg_bufx;		/* write pointer */
+	long	msg_bufr;		/* read pointer */
+	long	msg_bufs;		/* real msg_bufc size (bytes) */
+	char	msg_bufc[1];		/* buffer */
+};
+
+#ifdef _KERNEL
+extern int	msgbufmapped;		/* is the message buffer mapped */
+extern int	msgbufenabled;		/* is logging to the buffer enabled */
+extern struct	kern_msgbuf *msgbufp;	/* the mapped buffer, itself. */
+
+void	initmsgbuf(void *, size_t);
+void	loginit(void);
+void	logputchar(int);
+#endif
+
+#endif /* !_SYS_MSGBUF_H_ */

Property changes on: lab4/.minix-src/include/sys/msgbuf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/quota.h
===================================================================
--- lab4/.minix-src/include/sys/quota.h	(nonexistent)
+++ lab4/.minix-src/include/sys/quota.h	(revision 13)
@@ -0,0 +1,81 @@
+/* $NetBSD: quota.h,v 1.12 2012/01/30 00:56:19 dholland Exp $ */
+/*-
+  * Copyright (c) 2010 Manuel Bouyer
+  * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  * POSSIBILITY OF SUCH DAMAGE.
+  */
+
+#ifndef _SYS_QUOTA_H_
+#define _SYS_QUOTA_H_
+
+#include <sys/types.h>
+
+/* quota id types (entities being billed) */
+#define QUOTA_IDTYPE_USER	0
+#define QUOTA_IDTYPE_GROUP	1
+
+/* quota object types (things being limited) */
+#define QUOTA_OBJTYPE_BLOCKS	0
+#define QUOTA_OBJTYPE_FILES	1
+
+/* id value for "default" */
+#define QUOTA_DEFAULTID		((id_t)-1)
+
+/* limit value for "no limit" */
+#define QUOTA_NOLIMIT		((uint64_t)0xffffffffffffffffULL)
+
+/* time value for "no time" */
+#define QUOTA_NOTIME		((time_t)-1)
+
+/*
+ * Semantic restrictions. These are hints applications can use
+ * to help produce comprehensible error diagnostics when something
+ * unsupported is attempted.
+ */
+#define QUOTA_RESTRICT_NEEDSQUOTACHECK	0x1	/* quotacheck(8) required */
+#define QUOTA_RESTRICT_UNIFORMGRACE	0x2	/* grace time is global */
+#define QUOTA_RESTRICT_32BIT		0x4	/* values limited to 2^32 */
+#define QUOTA_RESTRICT_READONLY		0x8	/* updates not supported */
+
+
+/*
+ * Structure used to describe the key part of a quota record.
+ */
+struct quotakey {
+	int qk_idtype;		/* type of id (user, group, etc.) */
+	id_t qk_id;		/* actual id number */
+	int qk_objtype;		/* type of fs object (blocks, files, etc.) */
+};
+
+/*
+ * Structure used to describe the value part of a quota record.
+ */
+struct quotaval {
+        uint64_t qv_hardlimit;	/* absolute limit */
+	uint64_t qv_softlimit;	/* overflowable limit */
+	uint64_t qv_usage;	/* current usage */
+	time_t qv_expiretime;	/* time when softlimit grace expires */
+	time_t qv_grace;	/* allowed time for overflowing soft limit */
+};
+
+#endif /* _SYS_QUOTA_H_ */

Property changes on: lab4/.minix-src/include/sys/quota.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/lockf.h
===================================================================
--- lab4/.minix-src/include/sys/lockf.h	(nonexistent)
+++ lab4/.minix-src/include/sys/lockf.h	(revision 13)
@@ -0,0 +1,50 @@
+/*	$NetBSD: lockf.h,v 1.20 2008/11/19 13:34:11 pooka Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Scooter Morris at Genentech Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)lockf.h	8.2 (Berkeley) 10/26/94
+ */
+
+#ifndef _SYS_LOCKF_H_
+#define _SYS_LOCKF_H_
+
+#ifdef _KERNEL
+
+#include <sys/vnode.h>
+
+struct lockf;
+
+int lf_advlock(struct vop_advlock_args *, struct lockf **, off_t);
+void lf_init(void);
+#endif /* _KERNEL */
+
+#endif /* !_SYS_LOCKF_H_ */

Property changes on: lab4/.minix-src/include/sys/lockf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/null.h
===================================================================
--- lab4/.minix-src/include/sys/null.h	(nonexistent)
+++ lab4/.minix-src/include/sys/null.h	(revision 13)
@@ -0,0 +1,21 @@
+/*	$NetBSD: null.h,v 1.9 2010/07/06 11:56:20 kleink Exp $	*/
+
+/*
+ * Written by Klaus Klein <kleink@NetBSD.org>, December 22, 1999.
+ * Public domain.
+ */
+
+#ifndef _SYS_NULL_H_
+#define _SYS_NULL_H_
+#ifndef	NULL
+#if !defined(__GNUG__) || __GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 90)
+#if !defined(__cplusplus)
+#define	NULL	((void *)0)
+#else
+#define	NULL	0
+#endif /* !__cplusplus */
+#else
+#define	NULL	__null
+#endif
+#endif
+#endif /* _SYS_NULL_H_ */

Property changes on: lab4/.minix-src/include/sys/null.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/mutex.h
===================================================================
--- lab4/.minix-src/include/sys/mutex.h	(nonexistent)
+++ lab4/.minix-src/include/sys/mutex.h	(revision 13)
@@ -0,0 +1,216 @@
+/*	$NetBSD: mutex.h,v 1.20 2010/02/08 09:54:27 skrll Exp $	*/
+
+/*-
+ * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe and Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_MUTEX_H_
+#define	_SYS_MUTEX_H_
+
+/*
+ * There are 2 types of mutexes:
+ *
+ *	* Adaptive -- If the lock is already held, the thread attempting
+ *	  to acquire the lock determines if the thread that holds it is
+ *	  currently running.  If so, it spins, else it sleeps.
+ *
+ *	* Spin -- If the lock is already held, the thread attempting to
+ *	  acquire the lock spins.  The IPL will be raised on entry.
+ *
+ * Machine dependent code must provide the following:
+ *
+ *	struct mutex
+ *		The actual mutex structure.  This structure is mostly
+ *		opaque to machine-independent code; most access are done
+ *		through macros.  However, machine-independent code must
+ *		be able to access the following members:
+ *
+ *		uintptr_t		mtx_owner
+ *		ipl_cookie_t		mtx_ipl
+ *		__cpu_simple_lock_t	mtx_lock
+ *
+ * If an architecture can be considered 'simple' (no interlock required in
+ * the MP case, or no MP) it need only define __HAVE_SIMPLE_MUTEXES and
+ * provide the following:
+ *
+ *	struct mutex
+ *
+ *		[additionally:]
+ *		volatile integer	mtx_id
+ *
+ *	MUTEX_RECEIVE(mtx)
+ *		Post a load fence after acquiring the mutex, if necessary.
+ *
+ *	MUTEX_GIVE(mtx)
+ *		Post a load/store fence after releasing the mutex, if
+ *		necessary.
+ *
+ * 	MUTEX_CAS(ptr, old, new)
+ *		Perform an atomic "compare and swap" operation and
+ *		evaluate to true or false according to the success
+ *
+ * Otherwise, the following must be defined:
+ *
+ *	MUTEX_INITIALIZE_SPIN(mtx, dodebug, minipl)
+ *		Initialize a spin mutex.
+ *
+ *	MUTEX_INITIALIZE_ADAPTIVE(mtx, dodebug)
+ *		Initialize an adaptive mutex.
+ *
+ *	MUTEX_DESTROY(mtx)
+ *		Tear down a mutex.
+ *
+ *	MUTEX_ADAPTIVE_P(mtx)
+ *		Evaluates to true if the mutex is an adaptive mutex.
+ *
+ *	MUTEX_SPIN_P(mtx)
+ *		Evaluates to true if the mutex is a spin mutex.
+ *
+ *	MUTEX_OWNER(owner)
+ *		Returns the owner of the adaptive mutex (LWP address).
+ *
+ *	MUTEX_OWNED(owner)
+ *		Returns non-zero if an adaptive mutex is currently
+ *		held by an LWP.
+ *
+ *	MUTEX_HAS_WAITERS(mtx)
+ *		Returns true if the mutex has waiters.
+ *
+ *	MUTEX_SET_WAITERS(mtx)
+ *		Mark the mutex has having waiters.
+ *
+ *	MUTEX_ACQUIRE(mtx, owner)
+ *		Try to acquire an adaptive mutex such that:
+ *			if (lock held OR waiters)
+ *				return 0;
+ *			else
+ *				return 1;
+ *		Must be MP/interrupt atomic.
+ *
+ *	MUTEX_RELEASE(mtx)
+ *		Release the lock and clear the "has waiters" indication.
+ *		Must be interrupt atomic, need not be MP safe.
+ *
+ *	MUTEX_DEBUG_P(mtx)
+ *		Evaluates to true if the mutex is initialized with
+ *		dodebug==true.  Only used in the LOCKDEBUG case.
+ *
+ * Machine dependent code may optionally provide stubs for the following
+ * functions to implement the easy (unlocked / no waiters) cases.  If
+ * these stubs are provided, __HAVE_MUTEX_STUBS should be defined.
+ *
+ *	mutex_enter()
+ *	mutex_exit()
+ *
+ * Two additional stubs may be implemented that handle only the spinlock
+ * case, primarily for the scheduler.  __HAVE_SPIN_MUTEX_STUBS should be
+ * defined if these are provided:
+ *
+ *	mutex_spin_enter()
+ *	mutex_spin_exit()
+ */
+
+#if defined(_KERNEL_OPT)
+#include "opt_lockdebug.h"
+#endif
+
+#if !defined(_KERNEL)
+#include <sys/types.h>
+#include <sys/inttypes.h>
+#endif
+
+typedef enum kmutex_type_t {
+	MUTEX_SPIN = 0,		/* To get a spin mutex at IPL_NONE */
+	MUTEX_ADAPTIVE = 1,	/* For porting code written for Solaris */
+	MUTEX_DEFAULT = 2,	/* The only native, endorsed type */
+	MUTEX_DRIVER = 3,	/* For porting code written for Solaris */
+	MUTEX_NODEBUG = 4	/* Disables LOCKDEBUG; use with care */
+} kmutex_type_t;
+
+typedef struct kmutex kmutex_t;
+
+#if defined(__MUTEX_PRIVATE)
+
+#define	MUTEX_THREAD			((uintptr_t)-16L)
+
+#define	MUTEX_BIT_SPIN			0x01
+#define	MUTEX_BIT_WAITERS		0x02
+
+#if defined(LOCKDEBUG)
+#define	MUTEX_BIT_NODEBUG		0x04	/* LOCKDEBUG disabled */
+#else
+#define	MUTEX_BIT_NODEBUG		0x00	/* do nothing */
+#endif	/* LOCKDEBUG */
+
+#define	MUTEX_SPIN_IPL(mtx)		((mtx)->mtx_ipl)
+#define	MUTEX_SPIN_OLDSPL(ci)		((ci)->ci_mtx_oldspl)
+
+void	mutex_vector_enter(kmutex_t *);
+void	mutex_vector_exit(kmutex_t *);
+void	mutex_spin_retry(kmutex_t *);
+void	mutex_wakeup(kmutex_t *);
+
+#endif	/* __MUTEX_PRIVATE */
+
+#ifdef _KERNEL
+#include <sys/intr.h>
+#endif
+
+#include <machine/mutex.h>
+
+/*
+ * Return true if no spin mutexes are held by the current CPU.
+ */
+#ifndef MUTEX_NO_SPIN_ACTIVE_P
+#define	MUTEX_NO_SPIN_ACTIVE_P(ci)	((ci)->ci_mtx_count == 0)
+#endif
+
+#ifdef _KERNEL
+
+void	mutex_init(kmutex_t *, kmutex_type_t, int);
+void	mutex_destroy(kmutex_t *);
+
+void	mutex_enter(kmutex_t *);
+void	mutex_exit(kmutex_t *);
+
+void	mutex_spin_enter(kmutex_t *);
+void	mutex_spin_exit(kmutex_t *);
+
+int	mutex_tryenter(kmutex_t *);
+
+int	mutex_owned(kmutex_t *);
+lwp_t	*mutex_owner(kmutex_t *);
+
+void	mutex_obj_init(void);
+kmutex_t *mutex_obj_alloc(kmutex_type_t, int);
+void	mutex_obj_hold(kmutex_t *);
+bool	mutex_obj_free(kmutex_t *);
+
+#endif /* _KERNEL */
+
+#endif /* _SYS_MUTEX_H_ */

Property changes on: lab4/.minix-src/include/sys/mutex.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/pmc.h
===================================================================
--- lab4/.minix-src/include/sys/pmc.h	(nonexistent)
+++ lab4/.minix-src/include/sys/pmc.h	(revision 13)
@@ -0,0 +1,100 @@
+/*	$NetBSD: pmc.h,v 1.5 2005/12/11 12:25:20 christos Exp $	*/
+
+/*
+ * Copyright (c) 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Allen Briggs for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_PMC_H_
+#define	_SYS_PMC_H_
+
+struct pmc_counter_cfg {
+	pmc_evid_t	event_id;		/* What event to configure */
+	pmc_ctr_t	reset_value;		/* Value to set counter to */
+	uint32_t	flags;			/* PMC_FLAG_* */
+};
+
+#if defined(_KERNEL)
+
+/*
+ *      The following functions are defined in machine/pmc.h as either
+ * functions or macros.
+ *
+ * int	pmc_get_num_counters(void);
+ * int	pmc_get_counter_type(int ctr);
+ *
+ * void	pmc_save_context(struct proc *p);
+ * void	pmc_restore_context(struct proc *p);
+ * void	pmc_process_exit(struct proc *p);
+ *
+ * int	pmc_enable_counter(struct proc *p, int ctr);
+ * int	pmc_disable_counter(struct proc *p, int ctr);
+ * int	pmc_counter_isrunning(struct proc *p, int ctr);
+ * int	pmc_counter_isconfigured(struct proc *p, int ctr);
+ *
+ * int	pmc_configure_counter(struct proc *p, int ctr, pmc_counter_cfg *cfg);
+ *
+ * int	pmc_get_counter_value(struct proc *p, int ctr, int flags,
+ *          uint64_t *pval);
+ *
+ * int	pmc_accumulate(struct proc *p_parent, struct proc *p_exiting);
+ *
+ * int	pmc_alloc_kernel_counter(int ctr, struct pmc_counter_cfg *cfg);
+ * int	pmc_free_kernel_counter(int ctr);
+ *
+ * int	pmc_start_profiling(int ctr, struct pmc_counter_cfg *cfg);
+ * int	pmc_stop_profiling(int ctr);
+ *
+ * int	PMC_ENABLED(struct proc *p);
+ */
+
+#define PMC_VALUE_FLAGS_CHILDREN	0x00000001
+
+#endif	/* _KERNEL */
+
+#include <machine/pmc.h>
+
+#define PMC_OP_START		1
+#define PMC_OP_STOP		2
+#define PMC_OP_CONFIGURE	3
+#define PMC_OP_PROFSTART	4
+#define PMC_OP_PROFSTOP		5
+int	pmc_control(int ctr, int operation, void *args);
+
+#define PMC_INFO_NCOUNTERS			1
+#define PMC_INFO_CPUCTR_TYPE			2
+#define PMC_INFO_COUNTER_VALUE			3
+#define PMC_INFO_ACCUMULATED_COUNTER_VALUE	4
+int	pmc_get_info(int ctr, int request, void *data);
+
+#endif	/* !_SYS_PMC_H_ */

Property changes on: lab4/.minix-src/include/sys/pmc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/rbtree.h
===================================================================
--- lab4/.minix-src/include/sys/rbtree.h	(nonexistent)
+++ lab4/.minix-src/include/sys/rbtree.h	(revision 13)
@@ -0,0 +1,192 @@
+/*	$NetBSD: rbtree.h,v 1.2 2012/02/17 08:20:55 yamt Exp $	*/
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas <matt@3am-software.com>.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_RBTREE_H_
+#define	_SYS_RBTREE_H_
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/types.h>
+#else
+#include <stdbool.h>
+#include <inttypes.h>
+#endif
+#include <sys/queue.h>
+#include <sys/endian.h>
+
+__BEGIN_DECLS
+
+typedef struct rb_node {
+	struct rb_node *rb_nodes[2];
+#define	RB_DIR_LEFT		0
+#define	RB_DIR_RIGHT		1
+#define	RB_DIR_OTHER		1
+#define	rb_left			rb_nodes[RB_DIR_LEFT]
+#define	rb_right		rb_nodes[RB_DIR_RIGHT]
+
+	/*
+	 * rb_info contains the two flags and the parent back pointer.
+	 * We put the two flags in the low two bits since we know that
+	 * rb_node will have an alignment of 4 or 8 bytes.
+	 */
+	uintptr_t rb_info;
+#define	RB_FLAG_POSITION	0x2
+#define	RB_FLAG_RED		0x1
+#define	RB_FLAG_MASK		(RB_FLAG_POSITION|RB_FLAG_RED)
+#define	RB_FATHER(rb) \
+    ((struct rb_node *)((rb)->rb_info & ~RB_FLAG_MASK))
+#define	RB_SET_FATHER(rb, father) \
+    ((void)((rb)->rb_info = (uintptr_t)(father)|((rb)->rb_info & RB_FLAG_MASK)))
+
+#define	RB_SENTINEL_P(rb)	((rb) == NULL)
+#define	RB_LEFT_SENTINEL_P(rb)	RB_SENTINEL_P((rb)->rb_left)
+#define	RB_RIGHT_SENTINEL_P(rb)	RB_SENTINEL_P((rb)->rb_right)
+#define	RB_FATHER_SENTINEL_P(rb) RB_SENTINEL_P(RB_FATHER((rb)))
+#define	RB_CHILDLESS_P(rb) \
+    (RB_SENTINEL_P(rb) || (RB_LEFT_SENTINEL_P(rb) && RB_RIGHT_SENTINEL_P(rb)))
+#define	RB_TWOCHILDREN_P(rb) \
+    (!RB_SENTINEL_P(rb) && !RB_LEFT_SENTINEL_P(rb) && !RB_RIGHT_SENTINEL_P(rb))
+
+#define	RB_POSITION(rb)	\
+    (((rb)->rb_info & RB_FLAG_POSITION) ? RB_DIR_RIGHT : RB_DIR_LEFT)
+#define	RB_RIGHT_P(rb)		(RB_POSITION(rb) == RB_DIR_RIGHT)
+#define	RB_LEFT_P(rb)		(RB_POSITION(rb) == RB_DIR_LEFT)
+#define	RB_RED_P(rb) 		(!RB_SENTINEL_P(rb) && ((rb)->rb_info & RB_FLAG_RED) != 0)
+#define	RB_BLACK_P(rb) 		(RB_SENTINEL_P(rb) || ((rb)->rb_info & RB_FLAG_RED) == 0)
+#define	RB_MARK_RED(rb) 	((void)((rb)->rb_info |= RB_FLAG_RED))
+#define	RB_MARK_BLACK(rb) 	((void)((rb)->rb_info &= ~RB_FLAG_RED))
+#define	RB_INVERT_COLOR(rb) 	((void)((rb)->rb_info ^= RB_FLAG_RED))
+#define	RB_ROOT_P(rbt, rb)	((rbt)->rbt_root == (rb))
+#define	RB_SET_POSITION(rb, position) \
+    ((void)((position) ? ((rb)->rb_info |= RB_FLAG_POSITION) : \
+    ((rb)->rb_info &= ~RB_FLAG_POSITION)))
+#define	RB_ZERO_PROPERTIES(rb)	((void)((rb)->rb_info &= ~RB_FLAG_MASK))
+#define	RB_COPY_PROPERTIES(dst, src) \
+    ((void)((dst)->rb_info ^= ((dst)->rb_info ^ (src)->rb_info) & RB_FLAG_MASK))
+#define RB_SWAP_PROPERTIES(a, b) do { \
+    uintptr_t xorinfo = ((a)->rb_info ^ (b)->rb_info) & RB_FLAG_MASK; \
+    (a)->rb_info ^= xorinfo; \
+    (b)->rb_info ^= xorinfo; \
+  } while (/*CONSTCOND*/ 0)
+#ifdef RBDEBUG
+	TAILQ_ENTRY(rb_node) rb_link;
+#endif
+} rb_node_t;
+
+#define RB_TREE_MIN(T) rb_tree_iterate((T), NULL, RB_DIR_LEFT)
+#define RB_TREE_MAX(T) rb_tree_iterate((T), NULL, RB_DIR_RIGHT)
+#define RB_TREE_FOREACH(N, T) \
+    for ((N) = RB_TREE_MIN(T); (N); \
+	(N) = rb_tree_iterate((T), (N), RB_DIR_RIGHT))
+#define RB_TREE_FOREACH_REVERSE(N, T) \
+    for ((N) = RB_TREE_MAX(T); (N); \
+	(N) = rb_tree_iterate((T), (N), RB_DIR_LEFT))
+
+#ifdef RBDEBUG
+TAILQ_HEAD(rb_node_qh, rb_node);
+
+#define	RB_TAILQ_REMOVE(a, b, c)		TAILQ_REMOVE(a, b, c)
+#define	RB_TAILQ_INIT(a)			TAILQ_INIT(a)
+#define	RB_TAILQ_INSERT_HEAD(a, b, c)		TAILQ_INSERT_HEAD(a, b, c)
+#define	RB_TAILQ_INSERT_BEFORE(a, b, c)		TAILQ_INSERT_BEFORE(a, b, c)
+#define	RB_TAILQ_INSERT_AFTER(a, b, c, d)	TAILQ_INSERT_AFTER(a, b, c, d)
+#else
+#define	RB_TAILQ_REMOVE(a, b, c)		do { } while (/*CONSTCOND*/0)
+#define	RB_TAILQ_INIT(a)			do { } while (/*CONSTCOND*/0)
+#define	RB_TAILQ_INSERT_HEAD(a, b, c)		do { } while (/*CONSTCOND*/0)
+#define	RB_TAILQ_INSERT_BEFORE(a, b, c)		do { } while (/*CONSTCOND*/0)
+#define	RB_TAILQ_INSERT_AFTER(a, b, c, d)	do { } while (/*CONSTCOND*/0)
+#endif /* RBDEBUG */
+
+/*
+ * rbto_compare_nodes_fn:
+ *	return a positive value if the first node > the second node.
+ *	return a negative value if the first node < the second node.
+ *	return 0 if they are considered same.
+ *
+ * rbto_compare_key_fn:
+ *	return a positive value if the node > the key.
+ *	return a negative value if the node < the key.
+ *	return 0 if they are considered same.
+ */
+
+typedef signed int (*rbto_compare_nodes_fn)(void *, const void *, const void *);
+typedef signed int (*rbto_compare_key_fn)(void *, const void *, const void *);
+
+typedef struct {
+	rbto_compare_nodes_fn rbto_compare_nodes;
+	rbto_compare_key_fn rbto_compare_key;
+	size_t rbto_node_offset;
+	void *rbto_context;
+} rb_tree_ops_t;
+
+typedef struct rb_tree {
+	struct rb_node *rbt_root;
+	const rb_tree_ops_t *rbt_ops;
+	struct rb_node *rbt_minmax[2];
+#ifdef RBDEBUG
+	struct rb_node_qh rbt_nodes;
+#endif
+#ifdef RBSTATS
+	unsigned int rbt_count;
+	unsigned int rbt_insertions;
+	unsigned int rbt_removals;
+	unsigned int rbt_insertion_rebalance_calls;
+	unsigned int rbt_insertion_rebalance_passes;
+	unsigned int rbt_removal_rebalance_calls;
+	unsigned int rbt_removal_rebalance_passes;
+#endif
+} rb_tree_t;
+
+#ifdef RBSTATS
+#define	RBSTAT_INC(v)	((void)((v)++))
+#define	RBSTAT_DEC(v)	((void)((v)--))
+#else
+#define	RBSTAT_INC(v)	do { } while (/*CONSTCOND*/0)
+#define	RBSTAT_DEC(v)	do { } while (/*CONSTCOND*/0)
+#endif
+
+void	rb_tree_init(rb_tree_t *, const rb_tree_ops_t *);
+void *	rb_tree_insert_node(rb_tree_t *, void *);
+void *	rb_tree_find_node(rb_tree_t *, const void *);
+void *	rb_tree_find_node_geq(rb_tree_t *, const void *);
+void *	rb_tree_find_node_leq(rb_tree_t *, const void *);
+void	rb_tree_remove_node(rb_tree_t *, void *);
+void *	rb_tree_iterate(rb_tree_t *, void *, const unsigned int);
+#ifdef RBDEBUG
+void	rb_tree_check(const rb_tree_t *, bool);
+#endif
+#ifdef RBSTATS
+void	rb_tree_depths(const rb_tree_t *, size_t *);
+#endif
+
+__END_DECLS
+
+#endif	/* _SYS_RBTREE_H_*/

Property changes on: lab4/.minix-src/include/sys/rbtree.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/pcu.h
===================================================================
--- lab4/.minix-src/include/sys/pcu.h	(nonexistent)
+++ lab4/.minix-src/include/sys/pcu.h	(revision 13)
@@ -0,0 +1,95 @@
+/*	$NetBSD: pcu.h,v 1.12 2014/05/16 00:48:41 rmind Exp $	*/
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Mindaugas Rasiukevicius.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_PCU_H_
+#define _SYS_PCU_H_
+
+#if !defined(_KERNEL) && !defined(_KMEMUSER)
+#error "not supposed to be exposed to userland"
+#endif
+
+#ifndef _KERNEL
+#include <stdbool.h>
+#endif
+
+/*
+ * Default: no PCU for MD.
+ */
+#ifndef	PCU_UNIT_COUNT
+#define	PCU_UNIT_COUNT		0
+#endif
+
+#if PCU_UNIT_COUNT > 0
+
+/*
+ * pcu_state_save(lwp)
+ *	Tells MD code to save the current CPU's state into the given
+ *	LWP's MD storage.
+ *
+ * pcu_state_load(lwp, flags)
+ *	Tells MD code to load PCU state from the given LWP's MD storage
+ *	to the current CPU.
+ *
+ * pcu_state_release(lwp)
+ *	Tells MD code detect the next use of the PCU on the LWP and
+ *	call pcu_load().
+ */
+
+typedef struct {
+	u_int	pcu_id;
+	void	(*pcu_state_save)(lwp_t *);
+	void	(*pcu_state_load)(lwp_t *, unsigned);
+	void	(*pcu_state_release)(lwp_t *);
+} pcu_ops_t;
+
+/*
+ * Flags for the pcu_state_load() operation.
+ */
+#define	PCU_VALID	0x01	/* PCU state is considered valid */
+#define	PCU_REENABLE	0x02	/* the state is present, re-enable PCU */
+
+void	pcu_switchpoint(lwp_t *);
+void	pcu_discard_all(lwp_t *);
+void	pcu_save_all(lwp_t *);
+
+void	pcu_load(const pcu_ops_t *);
+void	pcu_save(const pcu_ops_t *);
+void	pcu_save_all_on_cpu(void);
+void	pcu_discard(const pcu_ops_t *, bool);
+bool	pcu_valid_p(const pcu_ops_t *);
+
+#else
+#define	pcu_switchpoint(l)
+#define	pcu_discard_all(l)
+#define	pcu_save_all(l)
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/sys/pcu.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/malloc.h
===================================================================
--- lab4/.minix-src/include/sys/malloc.h	(nonexistent)
+++ lab4/.minix-src/include/sys/malloc.h	(revision 13)
@@ -0,0 +1,77 @@
+/*	$NetBSD: malloc.h,v 1.116 2014/12/27 19:32:57 maxv Exp $	*/
+
+/*
+ * Copyright (c) 1987, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)malloc.h	8.5 (Berkeley) 5/3/95
+ */
+
+#ifndef _SYS_MALLOC_H_
+#define	_SYS_MALLOC_H_
+
+#ifdef _KERNEL
+
+/*
+ * flags to malloc
+ */
+#define	M_WAITOK	0x0000	/* can wait for resources */
+#define	M_NOWAIT	0x0001	/* do not wait for resources */
+#define	M_ZERO		0x0002	/* zero the allocation */
+#define	M_CANFAIL	0x0004	/* can fail if requested memory can't ever
+				 * be allocated */
+#include <sys/mallocvar.h>
+#if 0
+/*
+ * The following are standard, built-in malloc types that are
+ * not specific to any one subsystem.
+ *
+ * They are currently not defined, but are still passed to malloc()
+ * and free(). They may be re-instated as diagnostics at some point.
+ */
+MALLOC_DECLARE(M_DEVBUF);
+MALLOC_DECLARE(M_DMAMAP);
+MALLOC_DECLARE(M_FREE);
+MALLOC_DECLARE(M_TEMP);
+MALLOC_DECLARE(M_RTABLE);
+MALLOC_DECLARE(M_FTABLE);
+MALLOC_DECLARE(M_UFSMNT);
+MALLOC_DECLARE(M_NETADDR);
+MALLOC_DECLARE(M_MRTABLE);
+#endif
+
+void	*kern_malloc(unsigned long, int);
+void	*kern_realloc(void *, unsigned long, int);
+void	kern_free(void *);
+
+#define	malloc(size, type, flags)	kern_malloc(size, flags)
+#define	free(addr, type)		kern_free(addr)
+#define	realloc(ptr, size, type, flags)	kern_realloc(ptr, size, flags)
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_MALLOC_H_ */

Property changes on: lab4/.minix-src/include/sys/malloc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/proc.h
===================================================================
--- lab4/.minix-src/include/sys/proc.h	(nonexistent)
+++ lab4/.minix-src/include/sys/proc.h	(revision 13)
@@ -0,0 +1,572 @@
+/*	$NetBSD: proc.h,v 1.323 2015/09/24 14:33:31 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1986, 1989, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)proc.h	8.15 (Berkeley) 5/19/95
+ */
+
+#ifndef _SYS_PROC_H_
+#define	_SYS_PROC_H_
+
+#include <sys/lwp.h>
+
+#if defined(_KMEMUSER) || defined(_KERNEL)
+
+#if defined(_KERNEL_OPT)
+#include "opt_multiprocessor.h"
+#include "opt_kstack.h"
+#include "opt_lockdebug.h"
+#endif
+
+#include <machine/proc.h>		/* Machine-dependent proc substruct */
+#include <machine/pcb.h>
+#include <sys/aio.h>
+#include <sys/rwlock.h>
+#include <sys/mqueue.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+#include <sys/queue.h>
+#include <sys/signalvar.h>
+#include <sys/siginfo.h>
+#include <sys/event.h>
+#include <sys/specificdata.h>
+
+#ifndef _KERNEL
+#include <sys/time.h>
+#include <sys/resource.h>
+#endif
+
+/*
+ * One structure allocated per session.
+ */
+struct session {
+	int		s_count;	/* Ref cnt; pgrps in session */
+	u_int		s_flags;
+#define	S_LOGIN_SET	1		/* s_login set in this session */
+	struct proc	*s_leader;	/* Session leader */
+	struct vnode	*s_ttyvp;	/* Vnode of controlling terminal */
+	struct tty	*s_ttyp;	/* Controlling terminal */
+	char		s_login[MAXLOGNAME]; /* Setlogin() name */
+	pid_t		s_sid;		/* Session ID (pid of leader) */
+};
+
+/*
+ * One structure allocated per process group.
+ */
+struct pgrp {
+	LIST_HEAD(, proc) pg_members;	/* Pointer to pgrp members */
+	struct session	*pg_session;	/* Pointer to session */
+	pid_t		pg_id;		/* Pgrp id */
+	int		pg_jobc;	/*
+					 * Number of processes qualifying
+					 * pgrp for job control
+					 */
+};
+
+/*
+ * One structure allocated per emulation.
+ */
+struct exec_package;
+struct ras;
+struct kauth_cred;
+
+struct emul {
+	const char	*e_name;	/* Symbolic name */
+	const char	*e_path;	/* Extra emulation path (NULL if none)*/
+#ifndef __HAVE_MINIMAL_EMUL
+	int		e_flags;	/* Miscellaneous flags, see above */
+					/* Syscall handling function */
+	const int	*e_errno;	/* Errno array */
+	int		e_nosys;	/* Offset of the nosys() syscall */
+	int		e_nsysent;	/* Number of system call entries */
+#endif
+	struct sysent	*e_sysent;	/* System call array */
+	const char * const *e_syscallnames; /* System call name array */
+					/* Signal sending function */
+	void		(*e_sendsig)(const struct ksiginfo *,
+					  const sigset_t *);
+	void		(*e_trapsignal)(struct lwp *, struct ksiginfo *);
+	int		(*e_tracesig)(struct proc *, int);
+	char		*e_sigcode;	/* Start of sigcode */
+	char		*e_esigcode;	/* End of sigcode */
+					/* Set registers before execution */
+	struct uvm_object **e_sigobject;/* shared sigcode object */
+	void		(*e_setregs)(struct lwp *, struct exec_package *,
+					  vaddr_t);
+
+					/* Per-process hooks */
+	void		(*e_proc_exec)(struct proc *, struct exec_package *);
+	void		(*e_proc_fork)(struct proc *, struct lwp *, int);
+	void		(*e_proc_exit)(struct proc *);
+	void		(*e_lwp_fork)(struct lwp *, struct lwp *);
+	void		(*e_lwp_exit)(struct lwp *);
+
+#ifdef __HAVE_SYSCALL_INTERN
+	void		(*e_syscall_intern)(struct proc *);
+#else
+	void		(*e_syscall)(void);
+#endif
+					/* Emulation specific sysctl data */
+	struct sysctlnode *e_sysctlovly;
+	int		(*e_fault)(struct proc *, vaddr_t, int);
+
+	vaddr_t		(*e_vm_default_addr)(struct proc *, vaddr_t, vsize_t);
+
+	/* Emulation-specific hook for userspace page faults */
+	int		(*e_usertrap)(struct lwp *, vaddr_t, void *);
+
+	size_t		e_ucsize;	/* size of ucontext_t */
+	void		(*e_startlwp)(void *);
+
+	/* Dtrace syscall probe */
+	void 		(*e_dtrace_syscall)(uint32_t, register_t,
+			    const struct sysent *, const void *,
+			    const register_t *, int);
+};
+
+/*
+ * Emulation miscelaneous flags
+ */
+#define	EMUL_HAS_SYS___syscall	0x001	/* Has SYS___syscall */
+
+/*
+ * Description of a process.
+ *
+ * This structure contains the information needed to manage a thread of
+ * control, known in UN*X as a process; it has references to substructures
+ * containing descriptions of things that the process uses, but may share
+ * with related processes.  The process structure and the substructures
+ * are always addressible except for those marked "(PROC ONLY)" below,
+ * which might be addressible only on a processor on which the process
+ * is running.
+ *
+ * Field markings and the corresponding locks:
+ *
+ * a:	p_auxlock
+ * k:	ktrace_mutex
+ * l:	proc_lock
+ * t:	p_stmutex
+ * p:	p_lock
+ * (:	updated atomically
+ * ::	unlocked, stable
+ */
+struct vmspace;
+
+struct proc {
+	LIST_ENTRY(proc) p_list;	/* l: List of all processes */
+
+	kmutex_t	p_auxlock;	/* :: secondary, longer term lock */
+	kmutex_t	*p_lock;	/* :: general mutex */
+	kmutex_t	p_stmutex;	/* :: mutex on profiling state */
+	krwlock_t	p_reflock;	/* p: lock for debugger, procfs */
+	kcondvar_t	p_waitcv;	/* p: wait, stop CV on children */
+	kcondvar_t	p_lwpcv;	/* p: wait, stop CV on LWPs */
+
+	/* Substructures: */
+	struct kauth_cred *p_cred;	/* p: Master copy of credentials */
+	struct filedesc	*p_fd;		/* :: Ptr to open files structure */
+	struct cwdinfo	*p_cwdi;	/* :: cdir/rdir/cmask info */
+	struct pstats	*p_stats;	/* :: Accounting/stats (PROC ONLY) */
+	struct plimit	*p_limit;	/* :: Process limits */
+	struct vmspace	*p_vmspace;	/* :: Address space */
+	struct sigacts	*p_sigacts;	/* :: Process sigactions */
+	struct aioproc	*p_aio;		/* p: Asynchronous I/O data */
+	u_int		p_mqueue_cnt;	/* (: Count of open message queues */
+	specificdata_reference
+			p_specdataref;	/*    subsystem proc-specific data */
+
+	int		p_exitsig;	/* l: signal to send to parent on exit */
+	int		p_flag;		/* p: PK_* flags */
+	int		p_sflag;	/* p: PS_* flags */
+	int		p_slflag;	/* s, l: PSL_* flags */
+	int		p_lflag;	/* l: PL_* flags */
+	int		p_stflag;	/* t: PST_* flags */
+	char		p_stat;		/* p: S* process status. */
+	char		p_trace_enabled;/* p: cached by syscall_intern() */
+	char		p_pad1[2];	/*  unused */
+
+	pid_t		p_pid;		/* :: Process identifier. */
+	LIST_ENTRY(proc) p_pglist;	/* l: List of processes in pgrp. */
+	struct proc 	*p_pptr;	/* l: Pointer to parent process. */
+	LIST_ENTRY(proc) p_sibling;	/* l: List of sibling processes. */
+	LIST_HEAD(, proc) p_children;	/* l: List of children. */
+	LIST_HEAD(, lwp) p_lwps;	/* p: List of LWPs. */
+	struct ras	*p_raslist;	/* a: List of RAS entries */
+
+/* The following fields are all zeroed upon creation in fork. */
+#define	p_startzero	p_nlwps
+
+	int 		p_nlwps;	/* p: Number of LWPs */
+	int 		p_nzlwps;	/* p: Number of zombie LWPs */
+	int		p_nrlwps;	/* p: Number running/sleeping LWPs */
+	int		p_nlwpwait;	/* p: Number of LWPs in lwp_wait1() */
+	int		p_ndlwps;	/* p: Number of detached LWPs */
+	int 		p_nlwpid;	/* p: Next LWP ID */
+	u_int		p_nstopchild;	/* l: Count of stopped/dead children */
+	u_int		p_waited;	/* l: parent has waited on child */
+	struct lwp	*p_zomblwp;	/* p: detached LWP to be reaped */
+	struct lwp	*p_vforklwp;	/* p: parent LWP waiting at vfork() */
+
+	/* scheduling */
+	void		*p_sched_info;	/* p: Scheduler-specific structure */
+	fixpt_t		p_estcpu;	/* p: Time avg. value of p_cpticks */
+	fixpt_t		p_estcpu_inherited; /* p: cpu inherited from children */
+	unsigned int	p_forktime;
+	fixpt_t         p_pctcpu;       /* p: %cpu from dead LWPs */
+
+	struct proc	*p_opptr;	/* l: save parent during ptrace. */
+	struct ptimers	*p_timers;	/*    Timers: real, virtual, profiling */
+	struct bintime 	p_rtime;	/* p: real time */
+	u_quad_t 	p_uticks;	/* t: Statclock hits in user mode */
+	u_quad_t 	p_sticks;	/* t: Statclock hits in system mode */
+	u_quad_t 	p_iticks;	/* t: Statclock hits processing intr */
+
+	int		p_traceflag;	/* k: Kernel trace points */
+	void		*p_tracep;	/* k: Trace private data */
+	struct vnode 	*p_textvp;	/* :: Vnode of executable */
+
+	struct emul	*p_emul;	/* :: emulation information */
+	void		*p_emuldata;	/* :: per-proc emul data, or NULL */
+	const struct execsw *p_execsw;	/* :: exec package information */
+	struct klist	p_klist;	/* p: knotes attached to proc */
+
+	LIST_HEAD(, lwp) p_sigwaiters;	/* p: LWPs waiting for signals */
+	sigpend_t	p_sigpend;	/* p: pending signals */
+	struct lcproc	*p_lwpctl;	/* p, a: _lwp_ctl() information */
+	pid_t		p_ppid;		/* :: cached parent pid */
+	pid_t 		p_fpid;		/* :: forked pid */
+
+/*
+ * End area that is zeroed on creation
+ */
+#define	p_endzero	p_startcopy
+
+/*
+ * The following fields are all copied upon creation in fork.
+ */
+#define	p_startcopy	p_sigctx
+
+	struct sigctx 	p_sigctx;	/* p: Shared signal state */
+
+	u_char		p_nice;		/* p: Process "nice" value */
+	char		p_comm[MAXCOMLEN+1];
+					/* p: basename of last exec file */
+	struct pgrp 	*p_pgrp;	/* l: Pointer to process group */
+
+	vaddr_t		p_psstrp;	/* :: address of process's ps_strings */
+	u_int		p_pax;		/* :: PAX flags */
+
+/*
+ * End area that is copied on creation
+ */
+#define	p_endcopy	p_xstat
+
+	u_short		p_xstat;	/* p: Exit status for wait; also stop signal */
+	u_short		p_acflag;	/* p: Acc. flags; see struct lwp also */
+	struct mdproc	p_md;		/* p: Any machine-dependent fields */
+	vaddr_t		p_stackbase;	/* :: ASLR randomized stack base */
+	struct kdtrace_proc *p_dtrace;	/* :: DTrace-specific data. */
+};
+
+#define	p_rlimit	p_limit->pl_rlimit
+#define	p_session	p_pgrp->pg_session
+#define	p_pgid		p_pgrp->pg_id
+
+#endif	/* _KMEMUSER || _KERNEL */
+
+/*
+ * Status values.
+ */
+#define	SIDL		1		/* Process being created by fork */
+#define	SACTIVE		2		/* Process is not stopped */
+#define	SDYING		3		/* About to die */
+#define	SSTOP		4		/* Process debugging or suspension */
+#define	SZOMB		5		/* Awaiting collection by parent */
+#define	SDEAD	 	6		/* Almost a zombie */
+
+#define	P_ZOMBIE(p)	\
+    ((p)->p_stat == SZOMB || (p)->p_stat == SDYING || (p)->p_stat == SDEAD)
+
+/*
+ * These flags are kept in p_flag and are protected by p_lock.  Access from
+ * process context only.
+ */
+#define	PK_ADVLOCK	0x00000001 /* Process may hold a POSIX advisory lock */
+#define	PK_SYSTEM	0x00000002 /* System process (kthread) */
+#define	PK_SYSVSEM	0x00000004 /* Used SysV semaphores */
+#define	PK_SUGID	0x00000100 /* Had set id privileges since last exec */
+#define	PK_EXEC		0x00004000 /* Process called exec */
+#define	PK_NOCLDWAIT	0x00020000 /* No zombies if child dies */
+#define	PK_32		0x00040000 /* 32-bit process (used on 64-bit kernels) */
+#define	PK_CLDSIGIGN	0x00080000 /* Process is ignoring SIGCHLD */
+#define	PK_MARKER	0x80000000 /* Is a dummy marker process */
+
+/*
+ * These flags are kept in p_sflag and are protected by p_lock.  Access from
+ * process context only.
+ */
+#define	PS_NOCLDSTOP	0x00000008 /* No SIGCHLD when children stop */
+#define	PS_RUMP_LWPEXIT	0x00000400 /* LWPs in RUMP kernel should exit for GC */
+#define	PS_WCORE	0x00001000 /* Process needs to dump core */
+#define	PS_WEXIT	0x00002000 /* Working on exiting */
+#define	PS_STOPFORK	0x00800000 /* Child will be stopped on fork(2) */
+#define	PS_STOPEXEC	0x01000000 /* Will be stopped on exec(2) */
+#define	PS_STOPEXIT	0x02000000 /* Will be stopped at process exit */
+#define	PS_NOTIFYSTOP	0x10000000 /* Notify parent of successful STOP */
+#define	PS_STOPPING	0x80000000 /* Transitioning SACTIVE -> SSTOP */
+
+/*
+ * These flags are kept in p_sflag and are protected by the proc_lock
+ * and p_lock.  Access from process context only.
+ */
+#define	PSL_TRACEFORK	0x00000001 /* traced process wants fork events */
+#define	PSL_TRACED	0x00000800 /* Debugged process being traced */
+#define	PSL_FSTRACE	0x00010000 /* Debugger process being traced by procfs */
+#define	PSL_CHTRACED	0x00400000 /* Child has been traced & reparented */
+#define	PSL_SYSCALL	0x04000000 /* process has PT_SYSCALL enabled */
+#define	PSL_SYSCALLEMU	0x08000000 /* cancel in-progress syscall */
+
+/*
+ * Kept in p_stflag and protected by p_stmutex.
+ */
+#define	PST_PROFIL	0x00000020 /* Has started profiling */
+
+/*
+ * The final set are protected by the proc_lock.  Access
+ * from process context only.
+ */
+#define	PL_CONTROLT	0x00000002 /* Has a controlling terminal */
+#define	PL_PPWAIT	0x00000010 /* Parent is waiting for child exec/exit */
+#define	PL_SIGCOMPAT	0x00000200 /* Has used compat signal trampoline */
+#define	PL_ORPHANPG	0x20000000 /* Member of an orphaned pgrp */
+
+#if defined(_KMEMUSER) || defined(_KERNEL)
+
+/*
+ * Macro to compute the exit signal to be delivered.
+ */
+#define	P_EXITSIG(p)	\
+    (((p)->p_slflag & (PSL_TRACED|PSL_FSTRACE)) ? SIGCHLD : p->p_exitsig)
+
+LIST_HEAD(proclist, proc);		/* A list of processes */
+
+/*
+ * This structure associates a proclist with its lock.
+ */
+struct proclist_desc {
+	struct proclist	*pd_list;	/* The list */
+	/*
+	 * XXX Add a pointer to the proclist's lock eventually.
+	 */
+};
+
+#ifdef _KERNEL
+
+/*
+ * We use process IDs <= PID_MAX until there are > 16k processes.
+ * NO_PGID is used to represent "no process group" for a tty.
+ */
+#define	PID_MAX		30000
+#define	NO_PGID		((pid_t)-1)
+
+#define	SESS_LEADER(p)	((p)->p_session->s_leader == (p))
+
+/*
+ * Flags passed to fork1().
+ */
+#define	FORK_PPWAIT	0x0001		/* Block parent until child exit */
+#define	FORK_SHAREVM	0x0002		/* Share vmspace with parent */
+#define	FORK_SHARECWD	0x0004		/* Share cdir/rdir/cmask */
+#define	FORK_SHAREFILES	0x0008		/* Share file descriptors */
+#define	FORK_SHARESIGS	0x0010		/* Share signal actions */
+#define	FORK_NOWAIT	0x0020		/* Make init the parent of the child */
+#define	FORK_CLEANFILES	0x0040		/* Start with a clean descriptor set */
+#define	FORK_SYSTEM	0x0080		/* Fork a kernel thread */
+
+extern struct proc	proc0;		/* Process slot for swapper */
+extern u_int		nprocs;		/* Current number of procs */
+extern int		maxproc;	/* Max number of procs */
+#define	vmspace_kernel()	(proc0.p_vmspace)
+
+extern kmutex_t		*proc_lock;
+extern struct proclist	allproc;	/* List of all processes */
+extern struct proclist	zombproc;	/* List of zombie processes */
+
+extern struct proc	*initproc;	/* Process slots for init, pager */
+
+extern const struct proclist_desc proclists[];
+
+extern struct pool	ptimer_pool;	/* Memory pool for ptimers */
+
+int		proc_find_locked(struct lwp *, struct proc **, pid_t);
+proc_t *	proc_find_raw(pid_t);
+proc_t *	proc_find(pid_t);		/* Find process by ID */
+struct pgrp *	pgrp_find(pid_t);		/* Find process group by ID */
+
+void	procinit(void);
+void	procinit_sysctl(void);
+int	proc_enterpgrp(struct proc *, pid_t, pid_t, bool);
+void	proc_leavepgrp(struct proc *);
+void	proc_sesshold(struct session *);
+void	proc_sessrele(struct session *);
+void	fixjobc(struct proc *, struct pgrp *, int);
+
+int	tsleep(wchan_t, pri_t, const char *, int);
+int	mtsleep(wchan_t, pri_t, const char *, int, kmutex_t *);
+void	wakeup(wchan_t);
+int	kpause(const char *, bool, int, kmutex_t *);
+void	exit1(struct lwp *, int) __dead;
+int	kill1(struct lwp *l, pid_t pid, ksiginfo_t *ksi, register_t *retval);
+int	do_sys_wait(int *, int *, int, struct rusage *);
+struct proc *proc_alloc(void);
+void	proc0_init(void);
+pid_t	proc_alloc_pid(struct proc *);
+void	proc_free_pid(pid_t);
+void	proc_free_mem(struct proc *);
+void	exit_lwps(struct lwp *l);
+int	fork1(struct lwp *, int, int, void *, size_t,
+	    void (*)(void *), void *, register_t *, struct proc **);
+int	pgid_in_session(struct proc *, pid_t);
+void	cpu_lwp_fork(struct lwp *, struct lwp *, void *, size_t,
+	    void (*)(void *), void *);
+void	cpu_lwp_free(struct lwp *, int);
+void	cpu_lwp_free2(struct lwp *);
+void	cpu_spawn_return(struct lwp*);
+
+#ifdef __HAVE_SYSCALL_INTERN
+void	syscall_intern(struct proc *);
+#endif
+
+void	child_return(void *);
+
+int	proc_isunder(struct proc *, struct lwp *);
+void	proc_stop(struct proc *, int, int);
+int	proc_uidmatch(kauth_cred_t, kauth_cred_t);
+
+int	proc_vmspace_getref(struct proc *, struct vmspace **);
+void	proc_crmod_leave(kauth_cred_t, kauth_cred_t, bool);
+void	proc_crmod_enter(void);
+
+int	proc_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
+void	proc_specific_key_delete(specificdata_key_t);
+void	proc_initspecific(struct proc *);
+void	proc_finispecific(struct proc *);
+void *	proc_getspecific(struct proc *, specificdata_key_t);
+void	proc_setspecific(struct proc *, specificdata_key_t, void *);
+int	proc_compare(const struct proc *, const struct lwp *,
+    const struct proc *, const struct lwp *);
+
+int	proclist_foreach_call(struct proclist *,
+    int (*)(struct proc *, void *arg), void *);
+
+static inline struct proc *
+_proclist_skipmarker(struct proc *p0)
+{
+	struct proc *p = p0;
+
+	while (p != NULL && p->p_flag & PK_MARKER)
+		p = LIST_NEXT(p, p_list);
+
+	return p;
+}
+
+/*
+ * PROCLIST_FOREACH: iterate on the given proclist, skipping PK_MARKER ones.
+ */
+#define	PROCLIST_FOREACH(var, head)					\
+	for ((var) = LIST_FIRST(head);					\
+		((var) = _proclist_skipmarker(var)) != NULL;		\
+		(var) = LIST_NEXT(var, p_list))
+
+#ifdef KSTACK_CHECK_MAGIC
+void	kstack_setup_magic(const struct lwp *);
+void	kstack_check_magic(const struct lwp *);
+#else
+#define	kstack_setup_magic(x)
+#define	kstack_check_magic(x)
+#endif
+
+extern struct emul emul_netbsd;
+
+#endif	/* _KERNEL */
+
+/*
+ * Kernel stack parameters.
+ *
+ * KSTACK_LOWEST_ADDR: return the lowest address of the LWP's kernel stack,
+ * excluding red-zone.
+ *
+ * KSTACK_SIZE: the size kernel stack for a LWP, excluding red-zone.
+ *
+ * if <machine/proc.h> provides the MD definition, it will be used.
+ */
+#ifndef KSTACK_LOWEST_ADDR
+#define	KSTACK_LOWEST_ADDR(l)	((void *)ALIGN((struct pcb *)((l)->l_addr) + 1))
+#endif
+#ifndef KSTACK_SIZE
+#define	KSTACK_SIZE		(USPACE - ALIGN(sizeof(struct pcb)))
+#endif
+
+#endif	/* _KMEMUSER || _KERNEL */
+
+#endif	/* !_SYS_PROC_H_ */

Property changes on: lab4/.minix-src/include/sys/proc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/pool.h
===================================================================
--- lab4/.minix-src/include/sys/pool.h	(nonexistent)
+++ lab4/.minix-src/include/sys/pool.h	(revision 13)
@@ -0,0 +1,351 @@
+/*	$NetBSD: pool.h,v 1.79 2015/07/29 00:10:25 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1997, 1998, 1999, 2000, 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Kranenburg; by Jason R. Thorpe of the Numerical Aerospace
+ * Simulation Facility, NASA Ames Research Center.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_POOL_H_
+#define _SYS_POOL_H_
+
+#include <sys/stdbool.h>
+#include <sys/stdint.h>
+
+struct pool_sysctl {
+	char pr_wchan[16];
+	uint64_t pr_flags;
+	uint64_t pr_size;
+	uint64_t pr_pagesize;
+	uint64_t pr_itemsperpage;
+	uint64_t pr_nitems;
+	uint64_t pr_nout;
+	uint64_t pr_hardlimit;
+	uint64_t pr_npages;
+	uint64_t pr_minpages;
+	uint64_t pr_maxpages;
+
+	uint64_t pr_nget;
+	uint64_t pr_nfail;
+	uint64_t pr_nput;
+	uint64_t pr_npagealloc;
+	uint64_t pr_npagefree;
+	uint64_t pr_hiwat;
+	uint64_t pr_nidle;
+
+	uint64_t pr_cache_meta_size;
+	uint64_t pr_cache_nfull;
+	uint64_t pr_cache_npartial;
+	uint64_t pr_cache_nempty;
+	uint64_t pr_cache_ncontended;
+	uint64_t pr_cache_nmiss_global;
+	uint64_t pr_cache_nhit_global;
+	uint64_t pr_cache_nmiss_pcpu;
+	uint64_t pr_cache_nhit_pcpu;
+};
+
+#ifdef _KERNEL
+#define	__POOL_EXPOSE
+#endif
+
+#ifdef __POOL_EXPOSE
+#include <sys/param.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+#include <sys/queue.h>
+#include <sys/time.h>
+#include <sys/tree.h>
+#include <sys/callback.h>
+
+#define	POOL_PADDR_INVALID	((paddr_t) -1)
+
+struct pool;
+
+struct pool_allocator {
+	void		*(*pa_alloc)(struct pool *, int);
+	void		(*pa_free)(struct pool *, void *);
+	unsigned int	pa_pagesz;
+
+	/* The following fields are for internal use only. */
+	kmutex_t	pa_lock;
+	TAILQ_HEAD(, pool) pa_list;	/* list of pools using this allocator */
+	uint32_t	pa_refcnt;	/* number of pools using this allocator */
+	int		pa_pagemask;
+	int		pa_pageshift;
+};
+
+LIST_HEAD(pool_pagelist,pool_item_header);
+SPLAY_HEAD(phtree, pool_item_header);
+
+struct pool {
+	TAILQ_ENTRY(pool)
+			pr_poollist;
+	struct pool_pagelist
+			pr_emptypages;	/* Empty pages */
+	struct pool_pagelist
+			pr_fullpages;	/* Full pages */
+	struct pool_pagelist
+			pr_partpages;	/* Partially-allocated pages */
+	struct pool_item_header	*pr_curpage;
+	struct pool	*pr_phpool;	/* Pool item header pool */
+	struct pool_cache *pr_cache;	/* Cache for this pool */
+	unsigned int	pr_size;	/* Size of item */
+	unsigned int	pr_align;	/* Requested alignment, must be 2^n */
+	unsigned int	pr_itemoffset;	/* Align this offset in item */
+	unsigned int	pr_minitems;	/* minimum # of items to keep */
+	unsigned int	pr_minpages;	/* same in page units */
+	unsigned int	pr_maxpages;	/* maximum # of pages to keep */
+	unsigned int	pr_npages;	/* # of pages allocated */
+	unsigned int	pr_itemsperpage;/* # items that fit in a page */
+	unsigned int	pr_slack;	/* unused space in a page */
+	unsigned int	pr_nitems;	/* number of available items in pool */
+	unsigned int	pr_nout;	/* # items currently allocated */
+	unsigned int	pr_hardlimit;	/* hard limit to number of allocated
+					   items */
+	unsigned int	pr_refcnt;	/* ref count for pagedaemon, etc */
+	struct pool_allocator *pr_alloc;/* back-end allocator */
+	TAILQ_ENTRY(pool) pr_alloc_list;/* link on allocator's pool list */
+
+	/* Drain hook. */
+	void		(*pr_drain_hook)(void *, int);
+	void		*pr_drain_hook_arg;
+
+	const char	*pr_wchan;	/* tsleep(9) identifier */
+	unsigned int	pr_flags;	/* r/w flags */
+	unsigned int	pr_roflags;	/* r/o flags */
+#define	PR_WAITOK	0x01	/* Note: matches KM_SLEEP */
+#define PR_NOWAIT	0x02	/* Note: matches KM_NOSLEEP */
+#define PR_WANTED	0x04
+#define PR_PHINPAGE	0x40
+#define PR_LOGGING	0x80
+#define PR_LIMITFAIL	0x100	/* even if waiting, fail if we hit limit */
+#define PR_RECURSIVE	0x200	/* pool contains pools, for vmstat(8) */
+#define PR_NOTOUCH	0x400	/* don't use free items to keep internal state*/
+#define PR_NOALIGN	0x800	/* don't assume backend alignment */
+#define	PR_LARGECACHE	0x1000	/* use large cache groups */
+
+	/*
+	 * `pr_lock' protects the pool's data structures when removing
+	 * items from or returning items to the pool, or when reading
+	 * or updating read/write fields in the pool descriptor.
+	 *
+	 * We assume back-end page allocators provide their own locking
+	 * scheme.  They will be called with the pool descriptor _unlocked_,
+	 * since the page allocators may block.
+	 */
+	kmutex_t	pr_lock;
+	kcondvar_t	pr_cv;
+	int		pr_ipl;
+
+	struct phtree	pr_phtree;
+
+	int		pr_maxcolor;	/* Cache colouring */
+	int		pr_curcolor;
+	int		pr_phoffset;	/* Offset in page of page header */
+
+	/*
+	 * Warning message to be issued, and a per-time-delta rate cap,
+	 * if the hard limit is reached.
+	 */
+	const char	*pr_hardlimit_warning;
+	struct timeval	pr_hardlimit_ratecap;
+	struct timeval	pr_hardlimit_warning_last;
+
+	/*
+	 * Instrumentation
+	 */
+	unsigned long	pr_nget;	/* # of successful requests */
+	unsigned long	pr_nfail;	/* # of unsuccessful requests */
+	unsigned long	pr_nput;	/* # of releases */
+	unsigned long	pr_npagealloc;	/* # of pages allocated */
+	unsigned long	pr_npagefree;	/* # of pages released */
+	unsigned int	pr_hiwat;	/* max # of pages in pool */
+	unsigned long	pr_nidle;	/* # of idle pages */
+
+	/*
+	 * Diagnostic aides.
+	 */
+	void		*pr_freecheck;
+	void		*pr_qcache;
+	bool		pr_redzone;
+	size_t		pr_reqsize;
+};
+
+/*
+ * Cache group sizes, assuming 4-byte paddr_t on !_LP64.
+ * All groups will be aligned to CACHE_LINE_SIZE.
+ */
+#ifdef _LP64
+#define	PCG_NOBJECTS_NORMAL	15	/* 256 byte group */
+#define	PCG_NOBJECTS_LARGE	63	/* 1024 byte group */
+#else
+#define	PCG_NOBJECTS_NORMAL	14	/* 124 byte group */
+#define	PCG_NOBJECTS_LARGE	62	/* 508 byte group */
+#endif
+
+typedef struct pcgpair {
+	void	*pcgo_va;		/* object virtual address */
+	paddr_t	pcgo_pa;		/* object physical address */
+} pcgpair_t;
+
+/* The pool cache group. */
+typedef struct pool_cache_group {
+	struct pool_cache_group	*pcg_next;	/* link to next group */
+	u_int			pcg_avail;	/* # available objects */
+	u_int			pcg_size;	/* max number objects */
+	pcgpair_t 		pcg_objects[1];	/* the objects */
+} pcg_t;
+
+typedef struct pool_cache_cpu {
+	uint64_t		cc_misses;
+	uint64_t		cc_hits;
+	struct pool_cache_group	*cc_current;
+	struct pool_cache_group	*cc_previous;	
+	struct pool_cache	*cc_cache;
+	int			cc_ipl;
+	int			cc_cpuindex;
+#ifdef _KERNEL
+	ipl_cookie_t		cc_iplcookie;
+#endif
+} pool_cache_cpu_t;
+
+struct pool_cache {
+	/* Pool layer. */
+	struct pool	pc_pool;
+	
+	/* Cache layer. */
+	kmutex_t	pc_lock;	/* locks cache layer */
+	TAILQ_ENTRY(pool_cache)
+			pc_cachelist;	/* entry on global cache list */
+	pcg_t		*pc_emptygroups;/* list of empty cache groups */
+	pcg_t		*pc_fullgroups;	/* list of full cache groups */
+	pcg_t		*pc_partgroups;	/* groups for reclamation */
+	struct pool	*pc_pcgpool;	/* Pool of cache groups */
+	int		pc_pcgsize;	/* Use large cache groups? */
+	int		pc_ncpu;	/* number cpus set up */
+	int		(*pc_ctor)(void *, void *, int);
+	void		(*pc_dtor)(void *, void *);
+	void		*pc_arg;	/* for ctor/ctor */
+	uint64_t	pc_hits;	/* cache layer hits */
+	uint64_t	pc_misses;	/* cache layer misses */
+	uint64_t	pc_contended;	/* contention events on cache */
+	unsigned int	pc_nempty;	/* empty groups in cache */
+	unsigned int	pc_nfull;	/* full groups in cache */
+	unsigned int	pc_npart;	/* partial groups in cache */
+	unsigned int	pc_refcnt;	/* ref count for pagedaemon, etc */
+
+	/* Diagnostic aides. */
+	void		*pc_freecheck;
+	bool		pc_redzone;
+	size_t		pc_reqsize;
+
+	/* CPU layer. */
+	pool_cache_cpu_t pc_cpu0 __aligned(CACHE_LINE_SIZE);
+	void		*pc_cpus[MAXCPUS] __aligned(CACHE_LINE_SIZE);
+};
+
+#endif /* __POOL_EXPOSE */
+
+typedef struct pool_cache *pool_cache_t;
+
+#ifdef _KERNEL
+/*
+ * pool_allocator_kmem is the default that all pools get unless
+ * otherwise specified.  pool_allocator_nointr is provided for
+ * pools that know they will never be accessed in interrupt
+ * context.
+ */
+extern struct pool_allocator pool_allocator_kmem;
+extern struct pool_allocator pool_allocator_nointr;
+extern struct pool_allocator pool_allocator_meta;
+#ifdef POOL_SUBPAGE
+/* The above are subpage allocators in this case. */
+extern struct pool_allocator pool_allocator_kmem_fullpage;
+extern struct pool_allocator pool_allocator_nointr_fullpage;
+#endif
+
+void		pool_subsystem_init(void);
+
+void		pool_init(struct pool *, size_t, u_int, u_int,
+		    int, const char *, struct pool_allocator *, int);
+void		pool_destroy(struct pool *);
+
+void		pool_set_drain_hook(struct pool *,
+		    void (*)(void *, int), void *);
+
+void		*pool_get(struct pool *, int);
+void		pool_put(struct pool *, void *);
+int		pool_reclaim(struct pool *);
+
+int		pool_prime(struct pool *, int);
+void		pool_setlowat(struct pool *, int);
+void		pool_sethiwat(struct pool *, int);
+void		pool_sethardlimit(struct pool *, int, const char *, int);
+bool		pool_drain(struct pool **);
+
+/*
+ * Debugging and diagnostic aides.
+ */
+void		pool_printit(struct pool *, const char *,
+    void (*)(const char *, ...) __printflike(1, 2));
+void		pool_printall(const char *, void (*)(const char *, ...)
+    __printflike(1, 2));
+int		pool_chk(struct pool *, const char *);
+
+/*
+ * Pool cache routines.
+ */
+pool_cache_t	pool_cache_init(size_t, u_int, u_int, u_int, const char *,
+		    struct pool_allocator *, int, int (*)(void *, void *, int),
+		    void (*)(void *, void *), void *);
+void		pool_cache_bootstrap(pool_cache_t, size_t, u_int, u_int, u_int,
+		    const char *, struct pool_allocator *, int,
+		    int (*)(void *, void *, int), void (*)(void *, void *),
+		    void *);
+void		pool_cache_destroy(pool_cache_t);
+void		pool_cache_bootstrap_destroy(pool_cache_t);
+void		*pool_cache_get_paddr(pool_cache_t, int, paddr_t *);
+void		pool_cache_put_paddr(pool_cache_t, void *, paddr_t);
+void		pool_cache_destruct_object(pool_cache_t, void *);
+void		pool_cache_invalidate(pool_cache_t);
+bool		pool_cache_reclaim(pool_cache_t);
+void		pool_cache_set_drain_hook(pool_cache_t,
+		    void (*)(void *, int), void *);
+void		pool_cache_setlowat(pool_cache_t, int);
+void		pool_cache_sethiwat(pool_cache_t, int);
+void		pool_cache_sethardlimit(pool_cache_t, int, const char *, int);
+void		pool_cache_cpu_init(struct cpu_info *);
+
+#define		pool_cache_get(pc, f) pool_cache_get_paddr((pc), (f), NULL)
+#define		pool_cache_put(pc, o) pool_cache_put_paddr((pc), (o), \
+				          POOL_PADDR_INVALID)
+
+void 		pool_whatis(uintptr_t, void (*)(const char *, ...)
+    __printflike(1, 2));
+#endif /* _KERNEL */
+
+#endif /* _SYS_POOL_H_ */

Property changes on: lab4/.minix-src/include/sys/pool.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/rnd.h
===================================================================
--- lab4/.minix-src/include/sys/rnd.h	(nonexistent)
+++ lab4/.minix-src/include/sys/rnd.h	(revision 13)
@@ -0,0 +1,54 @@
+/*	$NetBSD: rnd.h,v 1.49 2015/04/14 12:51:30 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Michael Graff <explorer@flame.org>.  This code uses ideas and
+ * algorithms from the Linux driver written by Ted Ts'o.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_RND_H_
+#define	_SYS_RND_H_
+
+#ifdef _KERNEL
+
+#include <sys/types.h>
+
+struct file;
+
+#define	RND_DEV_RANDOM	0	/* minor for blocking until unpredictable */
+#define	RND_DEV_URANDOM	1	/* minor for randomly generating data */
+
+void		rnd_init(void);
+void		rnd_init_softint(void);
+void		rnd_seed(void *, size_t);
+int		rnd_system_ioctl(struct file *, u_long, void *);
+
+extern int	rnd_initial_entropy;
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_RND_H_ */

Property changes on: lab4/.minix-src/include/sys/rnd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/protosw.h
===================================================================
--- lab4/.minix-src/include/sys/protosw.h	(nonexistent)
+++ lab4/.minix-src/include/sys/protosw.h	(revision 13)
@@ -0,0 +1,499 @@
+/*	$NetBSD: protosw.h,v 1.64 2015/05/02 17:18:04 rtr Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)protosw.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_PROTOSW_H_
+#define _SYS_PROTOSW_H_
+
+/*
+ * Protocol switch table.
+ *
+ * Each protocol has a handle initializing one of these structures,
+ * which is used for protocol-protocol and system-protocol communication.
+ *
+ * A protocol is called through the pr_init entry before any other.
+ * Thereafter it is called every 200ms through the pr_fasttimo entry and
+ * every 500ms through the pr_slowtimo for timer based actions.
+ * The system will call the pr_drain entry if it is low on space and
+ * this should throw away any non-critical data.
+ *
+ * Protocols pass data between themselves as chains of mbufs using
+ * the pr_input and pr_output hooks.  Pr_input passes data up (towards
+ * UNIX) and pr_output passes it down (towards the imps); control
+ * information passes up and down on pr_ctlinput and pr_ctloutput.
+ * The protocol is responsible for the space occupied by any the
+ * arguments to these entries and must dispose it.
+ *
+ * The userreq routine interfaces protocols to the system and is
+ * described below.
+ */
+
+struct mbuf;
+struct ifnet;
+struct sockaddr;
+struct socket;
+struct sockopt;
+struct stat;
+struct domain;
+struct proc;
+struct lwp;
+struct pr_usrreqs;
+
+struct protosw {
+	int 	pr_type;		/* socket type used for */
+	struct	domain *pr_domain;	/* domain protocol a member of */
+	short	pr_protocol;		/* protocol number */
+	short	pr_flags;		/* see below */
+
+/* protocol-protocol hooks */
+	void	(*pr_input)		/* input to protocol (from below) */
+			(struct mbuf *, ...);
+	int	(*pr_output)		/* output to protocol (from above) */
+			(struct mbuf *, ...);
+	void	*(*pr_ctlinput)		/* control input (from below) */
+			(int, const struct sockaddr *, void *);
+	int	(*pr_ctloutput)		/* control output (from above) */
+			(int, struct socket *, struct sockopt *);
+
+/* user-protocol hooks */
+	const struct pr_usrreqs *pr_usrreqs;
+
+/* utility hooks */
+	void	(*pr_init)		/* initialization hook */
+			(void);
+
+	void	(*pr_fasttimo)		/* fast timeout (200ms) */
+			(void);
+	void	(*pr_slowtimo)		/* slow timeout (500ms) */
+			(void);
+	void	(*pr_drain)		/* flush any excess space possible */
+			(void);
+};
+
+#define	PR_SLOWHZ	2		/* 2 slow timeouts per second */
+#define	PR_FASTHZ	5		/* 5 fast timeouts per second */
+
+/*
+ * Values for pr_flags.
+ * PR_ADDR requires PR_ATOMIC;
+ * PR_ADDR and PR_CONNREQUIRED are mutually exclusive.
+ */
+#define	PR_ATOMIC	0x01		/* exchange atomic messages only */
+#define	PR_ADDR		0x02		/* addresses given with messages */
+#define	PR_CONNREQUIRED	0x04		/* connection required by protocol */
+#define	PR_WANTRCVD	0x08		/* want pr_rcvd() calls */
+#define	PR_RIGHTS	0x10		/* passes capabilities */
+#define	PR_LISTEN	0x20		/* supports listen(2) and accept(2) */
+#define	PR_LASTHDR	0x40		/* enforce ipsec policy; last header */
+#define	PR_ABRTACPTDIS	0x80		/* abort on accept(2) to disconnected
+					   socket */
+#define PR_PURGEIF	0x100		/* might store struct ifnet pointer;
+					   pr_purgeif() must be called on ifnet
+					   deletion */
+
+/*
+ * The arguments to usrreq are:
+ *	(*protosw[].pr_usrreq)(up, req, m, nam, opt, p);
+ * where up is a (struct socket *), req is one of these requests,
+ * m is a optional mbuf chain containing a message,
+ * nam is an optional mbuf chain containing an address,
+ * opt is an optional mbuf containing socket options,
+ * and p is a pointer to the process requesting the action (if any).
+ * The protocol is responsible for disposal of the mbuf chains m and opt,
+ * the caller is responsible for any space held by nam.
+ * A non-zero return from usrreq gives an
+ * UNIX error number which should be passed to higher level software.
+ */
+#define	PRU_ATTACH		0	/* attach protocol to up */
+#define	PRU_DETACH		1	/* detach protocol from up */
+#define	PRU_BIND		2	/* bind socket to address */
+#define	PRU_LISTEN		3	/* listen for connection */
+#define	PRU_CONNECT		4	/* establish connection to peer */
+#define	PRU_ACCEPT		5	/* accept connection from peer */
+#define	PRU_DISCONNECT		6	/* disconnect from peer */
+#define	PRU_SHUTDOWN		7	/* won't send any more data */
+#define	PRU_RCVD		8	/* have taken data; more room now */
+#define	PRU_SEND		9	/* send this data */
+#define	PRU_ABORT		10	/* abort (fast DISCONNECT, DETACH) */
+#define	PRU_CONTROL		11	/* control operations on protocol */
+#define	PRU_SENSE		12	/* return status into m */
+#define	PRU_RCVOOB		13	/* retrieve out of band data */
+#define	PRU_SENDOOB		14	/* send out of band data */
+#define	PRU_SOCKADDR		15	/* fetch socket's address */
+#define	PRU_PEERADDR		16	/* fetch peer's address */
+#define	PRU_CONNECT2		17	/* connect two sockets */
+/* begin for protocols internal use */
+#define	PRU_FASTTIMO		18	/* 200ms timeout */
+#define	PRU_SLOWTIMO		19	/* 500ms timeout */
+#define	PRU_PROTORCV		20	/* receive from below */
+#define	PRU_PROTOSEND		21	/* send to below */
+#define	PRU_PURGEIF		22	/* purge specified if */
+
+#define	PRU_NREQ		23
+
+#ifdef PRUREQUESTS
+static const char * const prurequests[] = {
+	"ATTACH",	"DETACH",	"BIND",		"LISTEN",
+	"CONNECT",	"ACCEPT",	"DISCONNECT",	"SHUTDOWN",
+	"RCVD",		"SEND",		"ABORT",	"CONTROL",
+	"SENSE",	"RCVOOB",	"SENDOOB",	"SOCKADDR",
+	"PEERADDR",	"CONNECT2",	"FASTTIMO",	"SLOWTIMO",
+	"PROTORCV",	"PROTOSEND",	"PURGEIF",
+};
+#endif
+
+/*
+ * The arguments to the ctlinput routine are
+ *	(*protosw[].pr_ctlinput)(cmd, sa, arg);
+ * where cmd is one of the commands below, sa is a pointer to a sockaddr,
+ * and arg is an optional void *argument used within a protocol family.
+ */
+#define	PRC_IFDOWN		0	/* interface transition */
+#define	PRC_ROUTEDEAD		1	/* select new route if possible ??? */
+#define	PRC_QUENCH2		3	/* DEC congestion bit says slow down */
+#define	PRC_QUENCH		4	/* some one said to slow down */
+#define	PRC_MSGSIZE		5	/* message size forced drop */
+#define	PRC_HOSTDEAD		6	/* host appears to be down */
+#define	PRC_HOSTUNREACH		7	/* deprecated (use PRC_UNREACH_HOST) */
+#define	PRC_UNREACH_NET		8	/* no route to network */
+#define	PRC_UNREACH_HOST	9	/* no route to host */
+#define	PRC_UNREACH_PROTOCOL	10	/* dst says bad protocol */
+#define	PRC_UNREACH_PORT	11	/* bad port # */
+/* was	PRC_UNREACH_NEEDFRAG	12	   (use PRC_MSGSIZE) */
+#define	PRC_UNREACH_SRCFAIL	13	/* source route failed */
+#define	PRC_REDIRECT_NET	14	/* net routing redirect */
+#define	PRC_REDIRECT_HOST	15	/* host routing redirect */
+#define	PRC_REDIRECT_TOSNET	16	/* redirect for type of service & net */
+#define	PRC_REDIRECT_TOSHOST	17	/* redirect for tos & host */
+#define	PRC_TIMXCEED_INTRANS	18	/* packet lifetime expired in transit */
+#define	PRC_TIMXCEED_REASS	19	/* lifetime expired on reass q */
+#define	PRC_PARAMPROB		20	/* header incorrect */
+
+#define	PRC_NCMDS		21
+
+#define	PRC_IS_REDIRECT(cmd)	\
+	((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST)
+
+#ifdef PRCREQUESTS
+static const char * const prcrequests[] = {
+	"IFDOWN", "ROUTEDEAD", "#2", "DEC-BIT-QUENCH2",
+	"QUENCH", "MSGSIZE", "HOSTDEAD", "#7",
+	"NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH",
+	"#12", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT",
+	"TOSNET-REDIRECT", "TOSHOST-REDIRECT", "TX-INTRANS", "TX-REASS",
+	"PARAMPROB"
+};
+#endif
+
+/*
+ * The arguments to ctloutput are:
+ *	(*protosw[].pr_ctloutput)(req, so, sopt);
+ * req is one of the actions listed below, so is a (struct socket *),
+ * sopt is a (struct sockopt *)
+ * A non-zero return from usrreq gives an
+ * UNIX error number which should be passed to higher level software.
+ */
+#define	PRCO_GETOPT	0
+#define	PRCO_SETOPT	1
+
+#define	PRCO_NCMDS	2
+
+#ifdef PRCOREQUESTS
+static const char * const prcorequests[] = {
+	"GETOPT", "SETOPT",
+};
+#endif
+
+#ifdef _KERNEL
+
+struct pr_usrreqs {
+	int	(*pr_attach)(struct socket *, int);
+	void	(*pr_detach)(struct socket *);
+	int	(*pr_accept)(struct socket *, struct sockaddr *);
+	int	(*pr_connect)(struct socket *, struct sockaddr *, struct lwp *);
+	int	(*pr_connect2)(struct socket *, struct socket *);
+	int	(*pr_bind)(struct socket *, struct sockaddr *, struct lwp *);
+	int	(*pr_listen)(struct socket *, struct lwp *);
+	int	(*pr_disconnect)(struct socket *);
+	int	(*pr_shutdown)(struct socket *);
+	int	(*pr_abort)(struct socket *);
+	int	(*pr_ioctl)(struct socket *, u_long, void *, struct ifnet *);
+	int	(*pr_stat)(struct socket *, struct stat *);
+	int	(*pr_peeraddr)(struct socket *, struct sockaddr *);
+	int	(*pr_sockaddr)(struct socket *, struct sockaddr *);
+	int	(*pr_rcvd)(struct socket *, int, struct lwp *);
+	int	(*pr_recvoob)(struct socket *, struct mbuf *, int);
+	int	(*pr_send)(struct socket *, struct mbuf *, struct sockaddr *,
+	    struct mbuf *, struct lwp *);
+	int	(*pr_sendoob)(struct socket *, struct mbuf *, struct mbuf *);
+	int	(*pr_purgeif)(struct socket *, struct ifnet *);
+};
+
+/*
+ * Monotonically increasing time values for slow and fast timers.
+ */
+extern	u_int pfslowtimo_now;
+extern	u_int pffasttimo_now;
+
+#define	PRT_SLOW_ARM(t, nticks)	(t) = (pfslowtimo_now + (nticks))
+#define	PRT_FAST_ARM(t, nticks)	(t) = (pffasttimo_now + (nticks))
+
+#define	PRT_SLOW_DISARM(t)	(t) = 0
+#define	PRT_FAST_DISARM(t)	(t) = 0
+
+#define	PRT_SLOW_ISARMED(t)	((t) != 0)
+#define	PRT_FAST_ISARMED(t)	((t) != 0)
+
+#define	PRT_SLOW_ISEXPIRED(t)	(PRT_SLOW_ISARMED((t)) && (t) <= pfslowtimo_now)
+#define	PRT_FAST_ISEXPIRED(t)	(PRT_FAST_ISARMED((t)) && (t) <= pffasttimo_now)
+
+struct sockaddr;
+const struct protosw *pffindproto(int, int, int);
+const struct protosw *pffindtype(int, int);
+struct domain *pffinddomain(int);
+void pfctlinput(int, const struct sockaddr *);
+void pfctlinput2(int, const struct sockaddr *, void *);
+
+/*
+ * Wrappers for non-MPSAFE protocols
+ */
+#include <sys/systm.h>	/* kernel_lock */
+
+#define	PR_WRAP_USRREQS(name)				\
+static int						\
+name##_attach_wrapper(struct socket *a, int b)		\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_attach(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static void						\
+name##_detach_wrapper(struct socket *a)			\
+{							\
+	KERNEL_LOCK(1, NULL);				\
+	name##_detach(a);				\
+	KERNEL_UNLOCK_ONE(NULL);			\
+}							\
+static int						\
+name##_accept_wrapper(struct socket *a,			\
+    struct sockaddr *b)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_accept(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_bind_wrapper(struct socket *a,			\
+    struct sockaddr *b,	struct lwp *c)			\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_bind(a, b, c);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_connect_wrapper(struct socket *a,		\
+    struct sockaddr *b, struct lwp *c)			\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_connect(a, b, c);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_connect2_wrapper(struct socket *a,		\
+    struct socket *b)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_connect2(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_listen_wrapper(struct socket *a, struct lwp *b)	\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_listen(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_disconnect_wrapper(struct socket *a)		\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_disconnect(a);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_shutdown_wrapper(struct socket *a)		\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_shutdown(a);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_abort_wrapper(struct socket *a)			\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_abort(a);				\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_ioctl_wrapper(struct socket *a, u_long b,	\
+    void *c, struct ifnet *d)				\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_ioctl(a, b, c, d);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_stat_wrapper(struct socket *a, struct stat *b)	\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_stat(a, b);				\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_peeraddr_wrapper(struct socket *a,		\
+    struct sockaddr *b)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_peeraddr(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_sockaddr_wrapper(struct socket *a,		\
+    struct sockaddr *b)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_sockaddr(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_rcvd_wrapper(struct socket *a, int b,		\
+    struct lwp *c)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_rcvd(a, b, c);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_recvoob_wrapper(struct socket *a,		\
+    struct mbuf *b, int c)				\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_recvoob(a, b, c);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_send_wrapper(struct socket *a, struct mbuf *b,	\
+    struct sockaddr *c, struct mbuf *d, struct lwp *e)	\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_send(a, b, c, d, e);		\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_sendoob_wrapper(struct socket *a,		\
+    struct mbuf *b, struct mbuf *c)			\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_sendoob(a, b, c);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_purgeif_wrapper(struct socket *a,		\
+    struct ifnet *b)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_purgeif(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}
+
+#define	PR_WRAP_CTLOUTPUT(name)				\
+static int						\
+name##_wrapper(int a, struct socket *b,			\
+    struct sockopt *c)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name(a, b, c);				\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}
+
+#define	PR_WRAP_CTLINPUT(name)				\
+static void *						\
+name##_wrapper(int a, const struct sockaddr *b, void *c)\
+{							\
+	void *rv;					\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name(a, b, c);				\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_PROTOSW_H_ */

Property changes on: lab4/.minix-src/include/sys/protosw.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ptrace.h
===================================================================
--- lab4/.minix-src/include/sys/ptrace.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ptrace.h	(revision 13)
@@ -0,0 +1,254 @@
+/*	$NetBSD: ptrace.h,v 1.46 2015/07/02 03:47:54 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1984, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ptrace.h	8.2 (Berkeley) 1/4/94
+ */
+
+#ifndef	_SYS_PTRACE_H_
+#define	_SYS_PTRACE_H_
+
+#define	PT_TRACE_ME		0	/* child declares it's being traced */
+#define	PT_READ_I		1	/* read word in child's I space */
+#define	PT_READ_D		2	/* read word in child's D space */
+#define	PT_WRITE_I		4	/* write word in child's I space */
+#define	PT_WRITE_D		5	/* write word in child's D space */
+#define	PT_CONTINUE		7	/* continue the child */
+#define	PT_KILL			8	/* kill the child process */
+#define	PT_ATTACH		9	/* attach to running process */
+#define	PT_DETACH		10	/* detach from running process */
+#define	PT_IO			11	/* do I/O to/from the stopped process */
+#define	PT_DUMPCORE		12	/* make child generate a core dump */
+#define	PT_LWPINFO		13	/* get info about the LWP */
+#define	PT_SYSCALL		14	/* stop on syscall entry/exit */
+#define	PT_SYSCALLEMU		15	/* cancel syscall, tracer emulates it */
+#define	PT_SET_EVENT_MASK	16	/* set the event mask, defined below */
+#define	PT_GET_EVENT_MASK	17	/* get the event mask, defined below */
+#define	PT_GET_PROCESS_STATE	18	/* get process state, defined below */
+
+#define	PT_FIRSTMACH		32	/* for machine-specific requests */
+#include <machine/ptrace.h>		/* machine-specific requests, if any */
+
+#define PT_STRINGS \
+/*  0 */    "PT_TRACE_ME", \
+/*  1 */    "PT_READ_I", \
+/*  2 */    "PT_READ_D", \
+/*  3 */    "*PT_INVALID_3*", \
+/*  4 */    "PT_WRITE_I", \
+/*  5 */    "PT_WRITE_D", \
+/*  6 */    "*PT_INVALID_6*", \
+/*  7 */    "PT_CONTINUE", \
+/*  8 */    "PT_KILL", \
+/*  9 */    "PT_ATTACH", \
+/* 10 */    "PT_DETACH", \
+/* 11 */    "PT_IO", \
+/* 12 */    "PT_DUMPCORE", \
+/* 13 */    "PT_LWPINFO", \
+/* 14 */    "PT_SYSCALL", \
+/* 15 */    "PT_SYSCALLEMU", \
+/* 16 */    "PT_SET_EVENT_MASK", \
+/* 17 */    "PT_GET_EVENT_MASK", \
+/* 18 */    "PT_GET_PROCESS_STATE",
+
+/* PT_{G,S}EVENT_MASK */
+typedef struct ptrace_event {
+	int	pe_set_event;
+} ptrace_event_t;
+
+/* PT_GET_PROCESS_STATE */
+typedef struct ptrace_state {
+	int	pe_report_event;
+	pid_t	pe_other_pid;
+} ptrace_state_t;
+
+#define	PTRACE_FORK	0x0001	/* Report forks */
+
+/*
+ * Argument structure for PT_IO.
+ */
+struct ptrace_io_desc {
+	int	piod_op;	/* I/O operation (see below) */
+	void	*piod_offs;	/* child offset */
+	void	*piod_addr;	/* parent offset */
+	size_t	piod_len;	/* request length (in)/actual count (out) */
+};
+
+/* piod_op */
+#define	PIOD_READ_D	1	/* read from D space */
+#define	PIOD_WRITE_D	2	/* write to D spcae */
+#define	PIOD_READ_I	3	/* read from I space */
+#define	PIOD_WRITE_I	4	/* write to I space */
+#define PIOD_READ_AUXV	5	/* Read from aux array */
+
+/*
+ * Argument structure for PT_LWPINFO.
+ */
+struct ptrace_lwpinfo {
+	lwpid_t	pl_lwpid;	/* LWP described */
+	int	pl_event;	/* Event that stopped the LWP */
+	/* Add fields at the end */
+};
+
+#define PL_EVENT_NONE	0
+#define PL_EVENT_SIGNAL	1
+
+#ifdef _KERNEL
+
+#if defined(PT_GETREGS) || defined(PT_SETREGS)
+struct reg;
+#ifndef process_reg32
+#define process_reg32 struct reg
+#endif
+#ifndef process_reg64
+#define process_reg64 struct reg
+#endif
+#endif
+#if defined(PT_GETFPREGS) || defined(PT_SETFPREGS)
+struct fpreg;
+#ifndef process_fpreg32
+#define process_fpreg32 struct fpreg
+#endif
+#ifndef process_fpreg64
+#define process_fpreg64 struct fpreg
+#endif
+#endif
+
+void	ptrace_init(void);
+
+int	process_doregs(struct lwp *, struct lwp *, struct uio *);
+int	process_validregs(struct lwp *);
+
+int	process_dofpregs(struct lwp *, struct lwp *, struct uio *);
+int	process_validfpregs(struct lwp *);
+
+int	process_domem(struct lwp *, struct lwp *, struct uio *);
+
+void	process_stoptrace(void);
+
+void	proc_reparent(struct proc *, struct proc *);
+
+/*
+ * 64bit architectures that support 32bit emulation (amd64 and sparc64)
+ * will #define process_read_regs32 to netbsd32_process_read_regs (etc).
+ * In all other cases these #defines drop the size suffix.
+ */
+#ifdef PT_GETFPREGS
+int	process_read_fpregs(struct lwp *, struct fpreg *, size_t *);
+#ifndef process_read_fpregs32
+#define process_read_fpregs32	process_read_fpregs
+#endif
+#ifndef process_read_fpregs64
+#define process_read_fpregs64	process_read_fpregs
+#endif
+#endif
+#ifdef PT_GETREGS
+int	process_read_regs(struct lwp *, struct reg *);
+#ifndef process_read_regs32
+#define process_read_regs32	process_read_regs
+#endif
+#ifndef process_read_regs64
+#define process_read_regs64	process_read_regs
+#endif
+#endif
+int	process_set_pc(struct lwp *, void *);
+int	process_sstep(struct lwp *, int);
+#ifdef PT_SETFPREGS
+int	process_write_fpregs(struct lwp *, const struct fpreg *, size_t);
+#endif
+#ifdef PT_SETREGS
+int	process_write_regs(struct lwp *, const struct reg *);
+#endif
+
+#ifdef __HAVE_PROCFS_MACHDEP
+int	ptrace_machdep_dorequest(struct lwp *, struct lwp *, int,
+	    void *, int);
+#endif
+
+#ifndef FIX_SSTEP
+#define FIX_SSTEP(p)
+#endif
+
+#else /* !_KERNEL */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	ptrace(int _request, pid_t _pid, void *_addr, int _data);
+__END_DECLS
+
+#endif /* !_KERNEL */
+
+#if defined(__minix)
+/* Trace options. */
+#define TO_TRACEFORK   0x1     /* automatically attach to forked children */
+#define TO_ALTEXEC     0x2     /* send SIGSTOP on successful exec() */
+#define TO_NOEXEC      0x4     /* do not send signal on successful exec() */
+
+/* Trace spaces. */
+#define TS_INS         0       /* text space */
+#define TS_DATA        1       /* data space */
+
+/* Trance range structure. */
+struct ptrace_range {
+  int pr_space;                        /* space in traced process */
+  long pr_addr;                        /* address in traced process */
+  void *pr_ptr;                        /* buffer in caller process */
+  size_t pr_size;              /* size of range, in bytes */
+};
+
+/* Trace requests aliases for minix. */
+#define T_OK           PT_TRACE_ME /* enable tracing by parent for this process */
+#define T_GETINS       PT_READ_I   /* return value from instruction space */
+#define T_GETDATA      PT_READ_D   /* return value from data space */
+#define T_SETINS       PT_WRITE_I  /* set value from instruction space */
+#define T_SETDATA      PT_WRITE_D  /* set value from data space */
+#define T_RESUME       PT_CONTINUE /* resume execution */
+#define T_EXIT         PT_KILL     /* exit */
+#define T_SYSCALL      PT_SYSCALL /* trace system call */
+#define T_ATTACH       PT_ATTACH  /* attach to a running process */
+#define T_DETACH       PT_DETACH  /* detach from a traced process */
+
+/* Trace requests unique to minix */
+#define T_STOP        -1       /* stop the process */
+#define T_READB_INS    100     /* Read a byte from the text segment of an
+                                * untraced process (only for root)
+                                */
+#define T_WRITEB_INS   101     /* Write a byte in the text segment of an
+                                * untraced process (only for root)
+                                */
+#define T_GETUSER      102       /* return value from user process table */
+#define T_SETUSER      103       /* set value in user process table */
+#define T_STEP         104       /* set trace bit */
+#define T_SETOPT       105       /* set trace options */
+#define T_GETRANGE     106       /* get range of values */
+#define T_SETRANGE     107       /* set range of values */
+
+#endif /* defined(__minix) */
+
+#endif	/* !_SYS_PTRACE_H_ */

Property changes on: lab4/.minix-src/include/sys/ptrace.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/md5.h
===================================================================
--- lab4/.minix-src/include/sys/md5.h	(nonexistent)
+++ lab4/.minix-src/include/sys/md5.h	(revision 13)
@@ -0,0 +1,58 @@
+/*	$NetBSD: md5.h,v 1.9 2005/12/26 18:41:36 perry Exp $	*/
+
+/*
+ * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
+ * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
+ * for portability and formatting.
+ */
+
+/*
+ * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
+ * rights reserved.
+ *
+ * License to copy and use this software is granted provided that it
+ * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
+ * Algorithm" in all material mentioning or referencing this software
+ * or this function.
+ *
+ * License is also granted to make and use derivative works provided
+ * that such works are identified as "derived from the RSA Data
+ * Security, Inc. MD5 Message-Digest Algorithm" in all material
+ * mentioning or referencing the derived work.
+ *
+ * RSA Data Security, Inc. makes no representations concerning either
+ * the merchantability of this software or the suitability of this
+ * software for any particular purpose. It is provided "as is"
+ * without express or implied warranty of any kind.
+ *
+ * These notices must be retained in any copies of any part of this
+ * documentation and/or software.
+ */
+
+#ifndef _SYS_MD5_H_
+#define _SYS_MD5_H_
+
+#include <sys/types.h>
+
+#define MD5_DIGEST_LENGTH		16
+#define	MD5_DIGEST_STRING_LENGTH	33
+
+/* MD5 context. */
+typedef struct MD5Context {
+	uint32_t state[4];	/* state (ABCD) */
+	uint32_t count[2];	/* number of bits, modulo 2^64 (lsb first) */
+	unsigned char buffer[64]; /* input buffer */
+} MD5_CTX;
+
+__BEGIN_DECLS
+void	MD5Init(MD5_CTX *);
+void	MD5Update(MD5_CTX *, const unsigned char *, unsigned int);
+void	MD5Final(unsigned char[MD5_DIGEST_LENGTH], MD5_CTX *);
+#ifndef _KERNEL
+char	*MD5End(MD5_CTX *, char *);
+char	*MD5File(const char *, char *);
+char	*MD5Data(const unsigned char *, unsigned int, char *);
+#endif /* _KERNEL */
+__END_DECLS
+
+#endif /* _SYS_MD5_H_ */

Property changes on: lab4/.minix-src/include/sys/md5.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/sched.h
===================================================================
--- lab4/.minix-src/include/sys/sched.h	(nonexistent)
+++ lab4/.minix-src/include/sys/sched.h	(revision 13)
@@ -0,0 +1,267 @@
+/*	$NetBSD: sched.h,v 1.75 2011/11/21 04:36:05 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1999, 2000, 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Ross Harvey, Jason R. Thorpe, Nathan J. Williams, Andrew Doran and
+ * Daniel Sieger.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)kern_clock.c	8.5 (Berkeley) 1/21/94
+ */
+
+#ifndef	_SYS_SCHED_H_
+#define	_SYS_SCHED_H_
+
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+#if defined(_KERNEL_OPT)
+#include "opt_multiprocessor.h"
+#include "opt_lockdebug.h"
+#endif
+
+struct sched_param {
+	int	sched_priority;
+};
+
+/*
+ * Scheduling policies required by IEEE Std 1003.1-2001
+ */
+#define	SCHED_NONE	-1
+#define	SCHED_OTHER	0
+#define	SCHED_FIFO	1
+#define	SCHED_RR	2
+
+#if defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+
+/*
+ * Interface of CPU-sets.
+ */
+typedef struct _cpuset cpuset_t;
+
+#ifndef _KERNEL
+
+#define	cpuset_create()		_cpuset_create()
+#define	cpuset_destroy(c)	_cpuset_destroy(c)
+#define	cpuset_size(c)		_cpuset_size(c)
+#define	cpuset_zero(c)		_cpuset_zero(c)
+#define	cpuset_isset(i, c)	_cpuset_isset(i, c)
+#define	cpuset_set(i, c)	_cpuset_set(i, c)
+#define	cpuset_clr(i, c)	_cpuset_clr(i, c)
+
+cpuset_t *_cpuset_create(void);
+void	_cpuset_destroy(cpuset_t *);
+void	_cpuset_zero(cpuset_t *);
+int	_cpuset_set(cpuid_t, cpuset_t *);
+int	_cpuset_clr(cpuid_t, cpuset_t *);
+int	_cpuset_isset(cpuid_t, const cpuset_t *);
+size_t	_cpuset_size(const cpuset_t *);
+
+#endif
+
+/*
+ * Internal affinity and scheduling calls.
+ */
+int	_sched_getaffinity(pid_t, lwpid_t, size_t, cpuset_t *);
+int	_sched_setaffinity(pid_t, lwpid_t, size_t, const cpuset_t *);
+int	_sched_getparam(pid_t, lwpid_t, int *, struct sched_param *);
+int	_sched_setparam(pid_t, lwpid_t, int, const struct sched_param *);
+__END_DECLS
+
+/*
+ * CPU states.
+ * XXX Not really scheduler state, but no other good place to put
+ * it right now, and it really is per-CPU.
+ */
+#define	CP_USER		0
+#define	CP_NICE		1
+#define	CP_SYS		2
+#define	CP_INTR		3
+#define	CP_IDLE		4
+#define	CPUSTATES	5
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+
+#include <sys/mutex.h>
+#include <sys/time.h>
+
+/*
+ * Per-CPU scheduler state.  Field markings and the corresponding locks: 
+ *
+ * s:	splsched, may only be safely accessed by the CPU itself
+ * m:	spc_mutex
+ * (:	unlocked, stable
+ * c:	cpu_lock
+ */
+struct schedstate_percpu {
+	/* First set of data is likely to be accessed by other CPUs. */
+	kmutex_t	*spc_mutex;	/* (: lock on below, runnable LWPs */
+	kmutex_t	*spc_lwplock;	/* (: general purpose lock for LWPs */
+	struct lwp	*spc_migrating;	/* (: migrating LWP */
+	pri_t		spc_curpriority;/* m: usrpri of curlwp */
+	pri_t		spc_maxpriority;/* m: highest priority queued */
+	psetid_t	spc_psid;	/* c: processor-set ID */
+	time_t		spc_lastmod;	/* c: time of last cpu state change */
+
+	/* For the most part, this set of data is CPU-private. */
+	void		*spc_sched_info;/* (: scheduler-specific structure */
+	volatile int	spc_flags;	/* s: flags; see below */
+	u_int		spc_schedticks;	/* s: ticks for schedclock() */
+	uint64_t	spc_cp_time[CPUSTATES];/* s: CPU state statistics */
+	int		spc_ticks;	/* s: ticks until sched_tick() */
+	int		spc_pscnt;	/* s: prof/stat counter */
+	int		spc_psdiv;	/* s: prof/stat divisor */
+};
+
+/* spc_flags */
+#define	SPCF_SEENRR		0x0001	/* process has seen roundrobin() */
+#define	SPCF_SHOULDYIELD	0x0002	/* process should yield the CPU */
+#define	SPCF_OFFLINE		0x0004	/* CPU marked offline */
+#define	SPCF_RUNNING		0x0008	/* CPU is running */
+#define	SPCF_NOINTR		0x0010	/* shielded from interrupts */
+
+#define	SPCF_SWITCHCLEAR	(SPCF_SEENRR|SPCF_SHOULDYIELD)
+
+#endif /* defined(_KERNEL) || defined(_KMEMUSER) */
+
+/*
+ * Flags passed to the Linux-compatible __clone(2) system call.
+ */
+#define	CLONE_CSIGNAL		0x000000ff	/* signal to be sent at exit */
+#define	CLONE_VM		0x00000100	/* share address space */
+#define	CLONE_FS		0x00000200	/* share "file system" info */
+#define	CLONE_FILES		0x00000400	/* share file descriptors */
+#define	CLONE_SIGHAND		0x00000800	/* share signal actions */
+#define	CLONE_PID		0x00001000	/* share process ID */
+#define	CLONE_PTRACE		0x00002000	/* ptrace(2) continues on
+						   child */
+#define	CLONE_VFORK		0x00004000	/* parent blocks until child
+						   exits */
+
+#endif /* _NETBSD_SOURCE */
+
+#ifdef _KERNEL
+
+extern int schedhz;			/* ideally: 16 */
+
+struct proc;
+struct cpu_info;
+
+/*
+ * Common Scheduler Interface.
+ */
+
+/* Scheduler initialization */
+void		runq_init(void);
+void		synch_init(void);
+void		sched_init(void);
+void		sched_rqinit(void);
+void		sched_cpuattach(struct cpu_info *);
+
+/* Time-driven events */
+void		sched_tick(struct cpu_info *);
+void		schedclock(struct lwp *);
+void		sched_schedclock(struct lwp *);
+void		sched_pstats(void);
+void		sched_lwp_stats(struct lwp *);
+void		sched_pstats_hook(struct lwp *, int);
+
+/* Runqueue-related functions */
+bool		sched_curcpu_runnable_p(void);
+void		sched_dequeue(struct lwp *);
+void		sched_enqueue(struct lwp *, bool);
+struct lwp *	sched_nextlwp(void);
+void		sched_oncpu(struct lwp *);
+void		sched_newts(struct lwp *);
+
+/* Priority adjustment */
+void		sched_nice(struct proc *, int);
+
+/* Handlers of fork and exit */
+void		sched_proc_fork(struct proc *, struct proc *);
+void		sched_proc_exit(struct proc *, struct proc *);
+void		sched_lwp_fork(struct lwp *, struct lwp *);
+void		sched_lwp_collect(struct lwp *);
+
+void		sched_slept(struct lwp *);
+void		sched_wakeup(struct lwp *);
+
+void		setrunnable(struct lwp *);
+void		sched_setrunnable(struct lwp *);
+
+struct cpu_info *sched_takecpu(struct lwp *);
+void		sched_print_runqueue(void (*pr)(const char *, ...)
+    __printflike(1, 2));
+
+/* Dispatching */
+bool		kpreempt(uintptr_t);
+void		preempt(void);
+void		yield(void);
+int		mi_switch(struct lwp *);
+void		updatertime(lwp_t *, const struct bintime *);
+void		sched_idle(void);
+void		suspendsched(void);
+
+int		do_sched_setparam(pid_t, lwpid_t, int, const struct sched_param *);
+int		do_sched_getparam(pid_t, lwpid_t, int *, struct sched_param *);
+
+#endif	/* _KERNEL */
+#endif	/* _SYS_SCHED_H_ */

Property changes on: lab4/.minix-src/include/sys/sched.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/quotactl.h
===================================================================
--- lab4/.minix-src/include/sys/quotactl.h	(nonexistent)
+++ lab4/.minix-src/include/sys/quotactl.h	(revision 13)
@@ -0,0 +1,162 @@
+/*	$NetBSD: quotactl.h,v 1.38 2014/06/28 22:27:50 dholland Exp $	*/
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David A. Holland.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_QUOTACTL_H_
+#define _SYS_QUOTACTL_H_
+
+#include <sys/stdint.h>
+
+/*
+ * Note - this is an internal interface. Application code (and,
+ * really, anything that isn't libquota or inside the kernel) should
+ * use the <quota.h> API instead.
+ */
+
+/* Size of random quota strings */
+#define QUOTA_NAMELEN   32
+
+/*              
+ * Structure for QUOTACTL_STAT.
+ */             
+struct quotastat {
+	char qs_implname[QUOTA_NAMELEN];
+	int qs_numidtypes;
+	int qs_numobjtypes;
+	unsigned qs_restrictions;	/* semantic restriction codes */
+};
+
+/*
+ * Structures for QUOTACTL_IDTYPESTAT and QUOTACTL_OBJTYPESTAT.
+ */
+struct quotaidtypestat {
+	char qis_name[QUOTA_NAMELEN];
+};
+struct quotaobjtypestat {
+	char qos_name[QUOTA_NAMELEN];
+	int qos_isbytes;
+};
+                        
+/*
+ * Semi-opaque structure for cursors. This holds the cursor state in
+ * userland; the size is exposed only to libquota, not to client code,
+ * and is meant to be large enough to accommodate all likely future
+ * expansion without being unduly bloated, as it will need to be
+ * copied in and out for every call using it.
+ */
+struct quotakcursor {
+	union {
+		char qkc_space[64];
+		uintmax_t __qkc_forcealign;
+	} u;
+};
+
+/* Command codes. */
+#define QUOTACTL_STAT		0
+#define QUOTACTL_IDTYPESTAT	1
+#define QUOTACTL_OBJTYPESTAT	2
+#define QUOTACTL_GET		3
+#define QUOTACTL_PUT		4
+#define QUOTACTL_DEL		5
+#define QUOTACTL_CURSOROPEN	6
+#define QUOTACTL_CURSORCLOSE	7
+#define QUOTACTL_CURSORSKIPIDTYPE 8
+#define QUOTACTL_CURSORGET	9
+#define QUOTACTL_CURSORATEND	10
+#define QUOTACTL_CURSORREWIND	11
+#define QUOTACTL_QUOTAON	12
+#define QUOTACTL_QUOTAOFF	13
+
+/* Argument encoding. */
+struct quotactl_args {
+	unsigned qc_op;
+	union {
+		struct {
+			struct quotastat *qc_info;
+		} stat;
+		struct {
+			int qc_idtype;
+			struct quotaidtypestat *qc_info;
+		} idtypestat;
+		struct {
+			int qc_objtype;
+			struct quotaobjtypestat *qc_info;
+		} objtypestat;
+		struct {
+			const struct quotakey *qc_key;
+			struct quotaval *qc_val;
+		} get;
+		struct {
+			const struct quotakey *qc_key;
+			const struct quotaval *qc_val;
+		} put;
+		struct {
+			const struct quotakey *qc_key;
+		} del;
+		struct {
+			struct quotakcursor *qc_cursor;
+		} cursoropen;
+		struct {
+			struct quotakcursor *qc_cursor;
+		} cursorclose;
+		struct {
+			struct quotakcursor *qc_cursor;
+			int qc_idtype;
+		} cursorskipidtype;
+		struct {
+			struct quotakcursor *qc_cursor;
+			struct quotakey *qc_keys;
+			struct quotaval *qc_vals;
+			unsigned qc_maxnum;
+			unsigned *qc_ret;
+		} cursorget;
+		struct {
+			struct quotakcursor *qc_cursor;
+			int *qc_ret; /* really boolean */
+		} cursoratend;
+		struct {
+			struct quotakcursor *qc_cursor;
+		} cursorrewind;
+		struct {
+			int qc_idtype;
+			const char *qc_quotafile;
+		} quotaon;
+		struct {
+			int qc_idtype;
+		} quotaoff;
+	} u;
+};
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+__BEGIN_DECLS
+int __quotactl(const char *, struct quotactl_args *);
+__END_DECLS
+#endif
+
+#endif /* _SYS_QUOTACTL_H_ */

Property changes on: lab4/.minix-src/include/sys/quotactl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/mount.h
===================================================================
--- lab4/.minix-src/include/sys/mount.h	(nonexistent)
+++ lab4/.minix-src/include/sys/mount.h	(revision 13)
@@ -0,0 +1,545 @@
+/*	$NetBSD: mount.h,v 1.217 2015/05/06 15:57:08 hannken Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)mount.h	8.21 (Berkeley) 5/20/95
+ */
+
+#ifndef _SYS_MOUNT_H_
+#define _SYS_MOUNT_H_
+
+#ifndef _KERNEL
+#include <sys/featuretest.h>
+#if defined(_NETBSD_SOURCE)
+#include <sys/stat.h>
+#endif /* _NETBSD_SOURCE */
+#endif
+
+#ifndef _STANDALONE
+#include <sys/param.h> /* precautionary upon removal from ucred.h */
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/ucred.h>
+#include <sys/fstypes.h>
+#include <sys/queue.h>
+#include <sys/rwlock.h>
+#include <sys/statvfs.h>
+#include <sys/specificdata.h>
+#include <sys/condvar.h>
+#endif	/* !_STANDALONE */
+
+/*
+ * file system statistics
+ */
+
+#define	MNAMELEN	90	/* length of buffer for returned name */
+
+/*
+ * File system types.
+ */
+#define	MOUNT_FFS	"ffs"		/* UNIX "Fast" Filesystem */
+#define	MOUNT_UFS	MOUNT_FFS	/* for compatibility */
+#define	MOUNT_NFS	"nfs"		/* Network Filesystem */
+#define	MOUNT_MFS	"mfs"		/* Memory Filesystem */
+#define	MOUNT_MSDOS	"msdos"		/* MSDOS Filesystem */
+#define	MOUNT_LFS	"lfs"		/* Log-based Filesystem */
+#define	MOUNT_FDESC	"fdesc"		/* File Descriptor Filesystem */
+#define	MOUNT_NULL	"null"		/* Minimal Filesystem Layer */
+#define	MOUNT_OVERLAY	"overlay"	/* Minimal Overlay Filesystem Layer */
+#define	MOUNT_UMAP	"umap"	/* User/Group Identifier Remapping Filesystem */
+#define	MOUNT_KERNFS	"kernfs"	/* Kernel Information Filesystem */
+#define	MOUNT_PROCFS	"procfs"	/* /proc Filesystem */
+#define	MOUNT_AFS	"afs"		/* Andrew Filesystem */
+#define	MOUNT_CD9660	"cd9660"	/* ISO9660 (aka CDROM) Filesystem */
+#define	MOUNT_UNION	"union"		/* Union (translucent) Filesystem */
+#define	MOUNT_ADOSFS	"adosfs"	/* AmigaDOS Filesystem */
+#define	MOUNT_EXT2FS	"ext2fs"	/* Second Extended Filesystem */
+#define	MOUNT_CFS	"coda"		/* Coda Filesystem */
+#define	MOUNT_CODA	MOUNT_CFS	/* Coda Filesystem */
+#define	MOUNT_FILECORE	"filecore"	/* Acorn Filecore Filesystem */
+#define	MOUNT_NTFS	"ntfs"		/* Windows/NT Filesystem */
+#define	MOUNT_SMBFS	"smbfs"		/* CIFS (SMB) */
+#define	MOUNT_PTYFS	"ptyfs"		/* Pseudo tty filesystem */
+#define	MOUNT_TMPFS	"tmpfs"		/* Efficient memory file-system */
+#define MOUNT_UDF	"udf"		/* UDF CD/DVD filesystem */
+#define	MOUNT_SYSVBFS	"sysvbfs"	/* System V Boot Filesystem */
+#define MOUNT_PUFFS	"puffs"		/* Pass-to-Userspace filesystem */
+#define MOUNT_HFS	"hfs"		/* Apple HFS+ Filesystem */
+#define MOUNT_EFS	"efs"		/* SGI's Extent Filesystem */
+#define MOUNT_ZFS	"zfs"		/* Sun ZFS */
+#define MOUNT_NILFS	"nilfs"		/* NTT's NiLFS(2) logging file system */
+#define MOUNT_RUMPFS	"rumpfs"	/* rump virtual file system */
+#define	MOUNT_V7FS	"v7fs"		/* 7th Edition of Unix Filesystem */
+
+#ifndef _STANDALONE
+
+struct vnode;
+struct vattr;
+
+/*
+ * Structure per mounted file system.  Each mounted file system has an
+ * array of operations and an instance record.  The file systems are
+ * put on a doubly linked list.
+ */
+struct mount {
+	TAILQ_ENTRY(mount) mnt_list;		/* mount list */
+	TAILQ_HEAD(, vnode) mnt_vnodelist;	/* list of vnodes this mount */
+	struct vfsops	*mnt_op;		/* operations on fs */
+	struct vnode	*mnt_vnodecovered;	/* vnode we mounted on */
+	int		mnt_synclist_slot;	/* synclist slot index */
+	void		*mnt_transinfo;		/* for FS-internal use */
+	void		*mnt_data;		/* private data */
+	kmutex_t	mnt_unmounting;		/* to prevent new activity */
+	kmutex_t	mnt_renamelock;		/* per-fs rename lock */
+	int		mnt_refcnt;		/* ref count on this structure */
+	unsigned int	mnt_busynest;		/* vfs_busy nestings */
+	int		mnt_flag;		/* flags */
+	int		mnt_iflag;		/* internal flags */
+	int		mnt_fs_bshift;		/* offset shift for lblkno */
+	int		mnt_dev_bshift;		/* shift for device sectors */
+	struct statvfs	mnt_stat;		/* cache of filesystem stats */
+	specificdata_reference
+			mnt_specdataref;	/* subsystem specific data */
+	kmutex_t	mnt_updating;		/* to serialize updates */
+	struct wapbl_ops
+			*mnt_wapbl_op;		/* logging ops */
+	struct wapbl	*mnt_wapbl;		/* log info */
+	struct wapbl_replay
+			*mnt_wapbl_replay;	/* replay support XXX: what? */
+	uint64_t	mnt_gen;
+};
+
+/*
+ * Sysctl CTL_VFS definitions.
+ *
+ * Second level identifier specifies which filesystem. Second level
+ * identifier VFS_GENERIC returns information about all filesystems.
+ *
+ * Note the slightly non-flat nature of these sysctl numbers.  Oh for
+ * a better sysctl interface.
+ */
+#define VFS_GENERIC	0		/* generic filesystem information */
+#define VFS_MAXTYPENUM	1		/* int: highest defined fs type */
+#define VFS_CONF	2		/* struct: vfsconf for filesystem given
+					   as next argument */
+#define VFS_USERMOUNT	3		/* enable/disable fs mnt by non-root */
+#define	VFS_MAGICLINKS  4		/* expand 'magic' symlinks */
+#define	VFSGEN_MAXID	5		/* number of valid vfs.generic ids */
+
+/*
+ * USE THE SAME NAMES AS MOUNT_*!
+ *
+ * Only need to add new entry here if the filesystem actually supports
+ * sysctl(2).
+ */
+#define	CTL_VFS_NAMES { \
+	{ "generic", CTLTYPE_NODE }, \
+	{ MOUNT_FFS, CTLTYPE_NODE }, \
+	{ MOUNT_NFS, CTLTYPE_NODE }, \
+	{ MOUNT_MFS, CTLTYPE_NODE }, \
+	{ MOUNT_MSDOS, CTLTYPE_NODE }, \
+	{ MOUNT_LFS, CTLTYPE_NODE }, \
+	{ 0, 0 }, 			/* MOUNT_LOFS */ \
+	{ MOUNT_FDESC, CTLTYPE_NODE }, \
+	{ MOUNT_NULL, CTLTYPE_NODE }, \
+	{ MOUNT_UMAP, CTLTYPE_NODE }, \
+	{ MOUNT_KERNFS, CTLTYPE_NODE }, \
+	{ MOUNT_PROCFS, CTLTYPE_NODE }, \
+	{ MOUNT_AFS, CTLTYPE_NODE }, \
+	{ MOUNT_CD9660, CTLTYPE_NODE }, \
+	{ MOUNT_UNION, CTLTYPE_NODE }, \
+	{ MOUNT_ADOSFS, CTLTYPE_NODE }, \
+	{ MOUNT_EXT2FS, CTLTYPE_NODE }, \
+	{ MOUNT_CODA, CTLTYPE_NODE }, \
+	{ MOUNT_FILECORE, CTLTYPE_NODE }, \
+	{ MOUNT_NTFS, CTLTYPE_NODE }, \
+}
+
+#define	VFS_MAXID	20		/* number of valid vfs ids */
+
+#define	CTL_VFSGENCTL_NAMES { \
+	{ 0, 0 }, \
+	{ "maxtypenum", CTLTYPE_INT }, \
+	{ "conf", CTLTYPE_NODE }, 	/* Special */ \
+	{ "usermount", CTLTYPE_INT }, \
+	{ "magiclinks", CTLTYPE_INT }, \
+}
+
+#if defined(_KERNEL)
+
+struct quotactl_args;		/* in sys/quotactl.h */
+struct quotastat;		/* in sys/quotactl.h */
+struct quotaidtypestat;		/* in sys/quotactl.h */
+struct quotaobjtypestat;	/* in sys/quotactl.h */
+struct quotakcursor;		/* in sys/quotactl.h */
+struct quotakey;		/* in sys/quota.h */
+struct quotaval;		/* in sys/quota.h */
+
+#if __STDC__
+struct nameidata;
+#endif
+
+/*
+ * Operations supported on mounted file system.
+ */
+
+struct vfsops {
+	const char *vfs_name;
+	size_t	vfs_min_mount_data;
+	int	(*vfs_mount)	(struct mount *, const char *, void *,
+				    size_t *);
+	int	(*vfs_start)	(struct mount *, int);
+	int	(*vfs_unmount)	(struct mount *, int);
+	int	(*vfs_root)	(struct mount *, struct vnode **);
+	int	(*vfs_quotactl)	(struct mount *, struct quotactl_args *);
+	int	(*vfs_statvfs)	(struct mount *, struct statvfs *);
+	int	(*vfs_sync)	(struct mount *, int, struct kauth_cred *);
+	int	(*vfs_vget)	(struct mount *, ino_t, struct vnode **);
+	int	(*vfs_loadvnode) (struct mount *, struct vnode *,
+				    const void *, size_t, const void **);
+	int	(*vfs_newvnode) (struct mount *, struct vnode *, struct vnode *,
+				    struct vattr *, kauth_cred_t,
+				    size_t *, const void **);
+	int	(*vfs_fhtovp)	(struct mount *, struct fid *,
+				    struct vnode **);
+	int	(*vfs_vptofh)	(struct vnode *, struct fid *, size_t *);
+	void	(*vfs_init)	(void);
+	void	(*vfs_reinit)	(void);
+	void	(*vfs_done)	(void);
+	int	(*vfs_mountroot)(void);
+	int	(*vfs_snapshot)	(struct mount *, struct vnode *,
+				    struct timespec *);
+	int	(*vfs_extattrctl) (struct mount *, int,
+				    struct vnode *, int, const char *);
+	int	(*vfs_suspendctl) (struct mount *, int);
+	int	(*vfs_renamelock_enter)(struct mount *);
+	void	(*vfs_renamelock_exit)(struct mount *);
+	int	(*vfs_fsync)	(struct vnode *, int);
+	const struct vnodeopv_desc * const *vfs_opv_descs;
+	int	vfs_refcount;
+	LIST_ENTRY(vfsops) vfs_list;
+};
+
+/* XXX vget is actually file system internal. */
+#define VFS_VGET(MP, INO, VPP)    (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
+#define VFS_LOADVNODE(MP, VP, KEY, KEY_LEN, NEW_KEY) \
+	(*(MP)->mnt_op->vfs_loadvnode)(MP, VP, KEY, KEY_LEN, NEW_KEY)
+#define VFS_NEWVNODE(MP, DVP, VP, VAP, CRED, NEW_LEN, NEW_KEY) \
+	(*(MP)->mnt_op->vfs_newvnode)(MP, DVP, VP, VAP, CRED, NEW_LEN, NEW_KEY)
+
+#define VFS_RENAMELOCK_ENTER(MP)  (*(MP)->mnt_op->vfs_renamelock_enter)(MP)
+#define VFS_RENAMELOCK_EXIT(MP)   (*(MP)->mnt_op->vfs_renamelock_exit)(MP)
+#define VFS_FSYNC(MP, VP, FLG)	  (*(MP)->mnt_op->vfs_fsync)(VP, FLG)
+
+int	VFS_MOUNT(struct mount *, const char *, void *, size_t *);
+int	VFS_START(struct mount *, int);
+int	VFS_UNMOUNT(struct mount *, int);
+int	VFS_ROOT(struct mount *, struct vnode **);
+int	VFS_QUOTACTL(struct mount *, struct quotactl_args *);
+int	VFS_STATVFS(struct mount *, struct statvfs *);
+int	VFS_SYNC(struct mount *, int, struct kauth_cred *);
+int	VFS_FHTOVP(struct mount *, struct fid *, struct vnode **);
+int	VFS_VPTOFH(struct vnode *, struct fid *, size_t *);
+int	VFS_SNAPSHOT(struct mount *, struct vnode *, struct timespec *);
+int	VFS_EXTATTRCTL(struct mount *, int, struct vnode *, int, const char *);
+int	VFS_SUSPENDCTL(struct mount *, int);
+
+#endif /* _KERNEL */
+
+#ifdef _KERNEL
+#if __STDC__
+struct mbuf;
+struct vnodeopv_desc;
+struct kauth_cred;
+#endif
+
+#define	VFS_MAX_MOUNT_DATA	8192
+
+#define VFS_PROTOS(fsname)						\
+int	fsname##_mount(struct mount *, const char *, void *,		\
+		size_t *);						\
+int	fsname##_start(struct mount *, int);				\
+int	fsname##_unmount(struct mount *, int);				\
+int	fsname##_root(struct mount *, struct vnode **);			\
+int	fsname##_quotactl(struct mount *, struct quotactl_args *);	\
+int	fsname##_statvfs(struct mount *, struct statvfs *);		\
+int	fsname##_sync(struct mount *, int, struct kauth_cred *);	\
+int	fsname##_vget(struct mount *, ino_t, struct vnode **);		\
+int	fsname##_loadvnode(struct mount *, struct vnode *,		\
+		const void *, size_t, const void **);			\
+int	fsname##_newvnode(struct mount *, struct vnode *,		\
+		struct vnode *, struct vattr *, kauth_cred_t,		\
+		size_t *, const void **);				\
+int	fsname##_fhtovp(struct mount *, struct fid *, struct vnode **);	\
+int	fsname##_vptofh(struct vnode *, struct fid *, size_t *);	\
+void	fsname##_init(void);						\
+void	fsname##_reinit(void);						\
+void	fsname##_done(void);						\
+int	fsname##_mountroot(void);					\
+int	fsname##_snapshot(struct mount *, struct vnode *,		\
+		struct timespec *);					\
+int	fsname##_extattrctl(struct mount *, int, struct vnode *, int,	\
+		const char *);						\
+int	fsname##_suspendctl(struct mount *, int)
+
+/*
+ * This operations vector is so wapbl can be wrapped into a filesystem lkm.
+ * XXX Eventually, we want to move this functionality
+ * down into the filesystems themselves so that this isn't needed.
+ */
+struct wapbl_ops {
+	void (*wo_wapbl_discard)(struct wapbl *);
+	int (*wo_wapbl_replay_isopen)(struct wapbl_replay *);
+	int (*wo_wapbl_replay_can_read)(struct wapbl_replay *, daddr_t, long);
+	int (*wo_wapbl_replay_read)(struct wapbl_replay *, void *, daddr_t, long);
+	void (*wo_wapbl_add_buf)(struct wapbl *, struct buf *);
+	void (*wo_wapbl_remove_buf)(struct wapbl *, struct buf *);
+	void (*wo_wapbl_resize_buf)(struct wapbl *, struct buf *, long, long);
+	int (*wo_wapbl_begin)(struct wapbl *, const char *, int);
+	void (*wo_wapbl_end)(struct wapbl *);
+	void (*wo_wapbl_junlock_assert)(struct wapbl *);
+	void (*wo_wapbl_biodone)(struct buf *);
+};
+#define WAPBL_DISCARD(MP)						\
+    (*(MP)->mnt_wapbl_op->wo_wapbl_discard)((MP)->mnt_wapbl)
+#define WAPBL_REPLAY_ISOPEN(MP)						\
+    (*(MP)->mnt_wapbl_op->wo_wapbl_replay_isopen)((MP)->mnt_wapbl_replay)
+#define WAPBL_REPLAY_CAN_READ(MP, BLK, LEN)				\
+    (*(MP)->mnt_wapbl_op->wo_wapbl_replay_can_read)((MP)->mnt_wapbl_replay, \
+    (BLK), (LEN))
+#define WAPBL_REPLAY_READ(MP, DATA, BLK, LEN)				\
+    (*(MP)->mnt_wapbl_op->wo_wapbl_replay_read)((MP)->mnt_wapbl_replay,	\
+    (DATA), (BLK), (LEN))
+#define WAPBL_ADD_BUF(MP, BP)						\
+    (*(MP)->mnt_wapbl_op->wo_wapbl_add_buf)((MP)->mnt_wapbl, (BP))
+#define WAPBL_REMOVE_BUF(MP, BP)					\
+    (*(MP)->mnt_wapbl_op->wo_wapbl_remove_buf)((MP)->mnt_wapbl, (BP))
+#define WAPBL_RESIZE_BUF(MP, BP, OLDSZ, OLDCNT)				\
+    (*(MP)->mnt_wapbl_op->wo_wapbl_resize_buf)((MP)->mnt_wapbl, (BP),	\
+    (OLDSZ), (OLDCNT))
+#define WAPBL_BEGIN(MP)							\
+    (*(MP)->mnt_wapbl_op->wo_wapbl_begin)((MP)->mnt_wapbl,		\
+    __FILE__, __LINE__)
+#define WAPBL_END(MP)							\
+    (*(MP)->mnt_wapbl_op->wo_wapbl_end)((MP)->mnt_wapbl)
+#define WAPBL_JUNLOCK_ASSERT(MP)					\
+    (*(MP)->mnt_wapbl_op->wo_wapbl_junlock_assert)((MP)->mnt_wapbl)
+
+struct vfs_hooks {
+	LIST_ENTRY(vfs_hooks) vfs_hooks_list;
+	void	(*vh_unmount)(struct mount *);
+	int	(*vh_reexport)(struct mount *, const char *, void *);
+	void	(*vh_future_expansion_1)(void);
+	void	(*vh_future_expansion_2)(void);
+	void	(*vh_future_expansion_3)(void);
+	void	(*vh_future_expansion_4)(void);
+	void	(*vh_future_expansion_5)(void);
+};
+
+void	vfs_hooks_init(void);
+int	vfs_hooks_attach(struct vfs_hooks *);
+int	vfs_hooks_detach(struct vfs_hooks *);
+void	vfs_hooks_unmount(struct mount *);
+int	vfs_hooks_reexport(struct mount *, const char *, void *);
+
+#endif /* _KERNEL */
+
+/*
+ * Export arguments for local filesystem mount calls.
+ *
+ * This structure is deprecated and is only provided for compatibility
+ * reasons with old binary utilities; several file systems expose an
+ * instance of this structure in their mount arguments structure, thus
+ * needing a padding in place of the old values.  This definition cannot
+ * change in the future due to this reason.
+ * XXX: This should be moved to the compat subtree but cannot be done
+ * until we can move the mount args structures themselves.
+ *
+ * The current export_args structure can be found in nfs/nfs.h.
+ */
+struct export_args30 {
+	int	ex_flags;		/* export related flags */
+	uid_t	ex_root;		/* mapping for root uid */
+	struct	uucred ex_anon;		/* mapping for anonymous user */
+	struct	sockaddr *ex_addr;	/* net address to which exported */
+	int	ex_addrlen;		/* and the net address length */
+	struct	sockaddr *ex_mask;	/* mask of valid bits in saddr */
+	int	ex_masklen;		/* and the smask length */
+	char	*ex_indexfile;		/* index file for WebNFS URLs */
+};
+
+struct mnt_export_args30 {
+	const char *fspec;		/* Always NULL */
+	struct export_args30 eargs;
+};
+
+#ifdef _KERNEL
+
+/*
+ * exported VFS interface (see vfssubr(9))
+ */
+struct	mount *vfs_getvfs(fsid_t *);    /* return vfs given fsid */
+int	vfs_composefh(struct vnode *, fhandle_t *, size_t *);
+int	vfs_composefh_alloc(struct vnode *, fhandle_t **);
+void	vfs_composefh_free(fhandle_t *);
+int	vfs_fhtovp(fhandle_t *, struct vnode **);
+int	vfs_mountedon(struct vnode *);/* is a vfs mounted on vp */
+int	vfs_mountroot(void);
+void	vfs_shutdown(void);	    /* unmount and sync file systems */
+void	vfs_sync_all(struct lwp *);
+bool	vfs_unmountall(struct lwp *);	    /* unmount file systems */
+bool	vfs_unmountall1(struct lwp *, bool, bool);
+bool	vfs_unmount_forceone(struct lwp *);
+int 	vfs_busy(struct mount *, struct mount **);
+int	vfs_rootmountalloc(const char *, const char *, struct mount **);
+void	vfs_unbusy(struct mount *, bool, struct mount **);
+int	vfs_attach(struct vfsops *);
+int	vfs_detach(struct vfsops *);
+void	vfs_reinit(void);
+struct vfsops *vfs_getopsbyname(const char *);
+void	vfs_delref(struct vfsops *);
+void	vfs_destroy(struct mount *);
+struct mount *vfs_mountalloc(struct vfsops *, struct vnode *);
+int	vfs_stdextattrctl(struct mount *, int, struct vnode *,
+	    int, const char *);
+void	vfs_insmntque(struct vnode *, struct mount *);
+int	vfs_quotactl_stat(struct mount *, struct quotastat *);
+int	vfs_quotactl_idtypestat(struct mount *, int, struct quotaidtypestat *);
+int	vfs_quotactl_objtypestat(struct mount *,int,struct quotaobjtypestat *);
+int	vfs_quotactl_get(struct mount *, const struct quotakey *,
+	    struct quotaval *);
+int	vfs_quotactl_put(struct mount *, const struct quotakey *,
+	    const struct quotaval *);
+int	vfs_quotactl_del(struct mount *, const struct quotakey *);
+int	vfs_quotactl_cursoropen(struct mount *, struct quotakcursor *);
+int	vfs_quotactl_cursorclose(struct mount *, struct quotakcursor *);
+int	vfs_quotactl_cursorskipidtype(struct mount *, struct quotakcursor *,
+            int);
+int	vfs_quotactl_cursorget(struct mount *, struct quotakcursor *,
+            struct quotakey *, struct quotaval *, unsigned, unsigned *);
+int	vfs_quotactl_cursoratend(struct mount *, struct quotakcursor *, int *);
+int	vfs_quotactl_cursorrewind(struct mount *, struct quotakcursor *);
+int	vfs_quotactl_quotaon(struct mount *, int, const char *);
+int	vfs_quotactl_quotaoff(struct mount *, int);
+
+struct vnode_iterator; /* Opaque. */
+void	vfs_vnode_iterator_init(struct mount *, struct vnode_iterator **);
+void	vfs_vnode_iterator_destroy(struct vnode_iterator *);
+struct vnode *vfs_vnode_iterator_next(struct vnode_iterator *,
+    bool (*)(void *, struct vnode *), void *);
+
+/* Syncer */
+extern int	syncer_maxdelay;
+extern kmutex_t	syncer_mutex;
+extern time_t	syncdelay;
+extern time_t	filedelay;
+extern time_t	dirdelay; 
+extern time_t	metadelay;
+void	vfs_syncer_add_to_worklist(struct mount *);
+void	vfs_syncer_remove_from_worklist(struct mount *);
+
+extern	TAILQ_HEAD(mntlist, mount) mountlist;	/* mounted filesystem list */
+extern	struct vfsops *vfssw[];			/* filesystem type table */
+extern	int nvfssw;
+extern  kmutex_t mountlist_lock;
+extern	kmutex_t vfs_list_lock;
+
+void	vfs_mount_sysinit(void);
+long	makefstype(const char *);
+int	mount_domount(struct lwp *, struct vnode **, struct vfsops *,
+	    const char *, int, void *, size_t *);
+int	dounmount(struct mount *, int, struct lwp *);
+int	do_sys_mount(struct lwp *, struct vfsops *, const char *, const char *,
+	    int, void *, enum uio_seg, size_t, register_t *);
+void	vfsinit(void);
+void	vfs_opv_init(const struct vnodeopv_desc * const *);
+void	vfs_opv_free(const struct vnodeopv_desc * const *);
+#ifdef DEBUG
+void	vfs_bufstats(void);
+#endif
+
+int	mount_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
+void	mount_specific_key_delete(specificdata_key_t);
+void 	mount_initspecific(struct mount *);
+void 	mount_finispecific(struct mount *);
+void *	mount_getspecific(struct mount *, specificdata_key_t);
+void	mount_setspecific(struct mount *, specificdata_key_t, void *);
+
+int	usermount_common_policy(struct mount *, u_long);
+void	mountlist_append(struct mount *);
+
+LIST_HEAD(vfs_list_head, vfsops);
+extern struct vfs_list_head vfs_list;
+
+#else /* _KERNEL */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#if !defined(__LIBC12_SOURCE__) && !defined(_STANDALONE)
+int	getfh(const char *, void *, size_t *)
+	__RENAME(__getfh30);
+#endif
+
+#if !defined(__minix)
+int	unmount(const char *, int);
+#else
+int	minix_umount(const char *_name, int srvflags);
+#endif /* !defined(__minix) */
+
+#if defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+#if !defined(__minix)
+int mount(const char *, const char *, int, void *, size_t) __RENAME(__mount50);
+#else
+int minix_mount(char *_spec, char *_name, int _mountflags, int srvflags, char *type,
+	char *args);
+#endif /* !defined(__minix) */
+int	fhopen(const void *, size_t, int) __RENAME(__fhopen40);
+int	fhstat(const void *, size_t, struct stat *) __RENAME(__fhstat50);
+#endif
+#endif /* _NETBSD_SOURCE */
+__END_DECLS
+
+#endif /* _KERNEL */
+#endif /* !_STANDALONE */
+
+#if defined(__minix) && !defined(_STANDALONE)
+/* Service flags. These are not passed to VFS. */
+#define MS_REUSE	0x001	/* Tell RS to try reusing binary from memory */
+#define MS_EXISTING	0x002	/* Tell mount to use already running server */
+
+#define MNT_LABEL_LEN	16	/* Length of fs label including nul */
+
+/* Legacy definitions. */
+#define MNTNAMELEN	16	/* Length of fs type name including nul */
+#define MNTFLAGLEN	64	/* Length of flags string including nul */
+#endif /*  defined(__minix) && !defined(_STANDALONE) */
+
+#endif /* !_SYS_MOUNT_H_ */

Property changes on: lab4/.minix-src/include/sys/mount.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/queue.h
===================================================================
--- lab4/.minix-src/include/sys/queue.h	(nonexistent)
+++ lab4/.minix-src/include/sys/queue.h	(revision 13)
@@ -0,0 +1,846 @@
+/*	$NetBSD: queue.h,v 1.68 2014/11/19 08:10:01 uebayasi Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)queue.h	8.5 (Berkeley) 8/20/94
+ */
+
+#ifndef	_SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines five types of data structures: singly-linked lists,
+ * lists, simple queues, tail queues, and circular queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The
+ * elements are singly linked for minimum space and pointer manipulation
+ * overhead at the expense of O(n) removal for arbitrary elements. New
+ * elements can be added to the list after an existing element or at the
+ * head of the list.  Elements being removed from the head of the list
+ * should use the explicit macro for this purpose for optimum
+ * efficiency. A singly-linked list may only be traversed in the forward
+ * direction.  Singly-linked lists are ideal for applications with large
+ * datasets and few or no removals or for implementing a LIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A simple queue is headed by a pair of pointers, one the head of the
+ * list and the other to the tail of the list. The elements are singly
+ * linked to save space, so elements can only be removed from the
+ * head of the list. New elements can be added to the list after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A simple queue may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * A circle queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the list.
+ * A circle queue may be traversed in either direction, but has a more
+ * complex end of list detection.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ */
+
+/*
+ * Include the definition of NULL only on NetBSD because sys/null.h
+ * is not available elsewhere.  This conditional makes the header
+ * portable and it can simply be dropped verbatim into any system.
+ * The caveat is that on other systems some other header
+ * must provide NULL before the macros can be used.
+ */
+#if defined(__NetBSD__) || defined(__minix)
+#include <sys/null.h>
+#endif
+
+#if defined(QUEUEDEBUG)
+# if defined(_KERNEL)
+#  define QUEUEDEBUG_ABORT(...) panic(__VA_ARGS__)
+# else
+#  include <err.h>
+#  define QUEUEDEBUG_ABORT(...) err(1, __VA_ARGS__)
+# endif
+#endif
+
+/*
+ * Singly-linked List definitions.
+ */
+#define	SLIST_HEAD(name, type)						\
+struct name {								\
+	struct type *slh_first;	/* first element */			\
+}
+
+#define	SLIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	SLIST_ENTRY(type)						\
+struct {								\
+	struct type *sle_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked List access methods.
+ */
+#define	SLIST_FIRST(head)	((head)->slh_first)
+#define	SLIST_END(head)		NULL
+#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
+#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
+
+#define	SLIST_FOREACH(var, head, field)					\
+	for((var) = (head)->slh_first;					\
+	    (var) != SLIST_END(head);					\
+	    (var) = (var)->field.sle_next)
+
+#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = SLIST_FIRST((head));				\
+	    (var) != SLIST_END(head) &&					\
+	    ((tvar) = SLIST_NEXT((var), field), 1);			\
+	    (var) = (tvar))
+
+/*
+ * Singly-linked List functions.
+ */
+#define	SLIST_INIT(head) do {						\
+	(head)->slh_first = SLIST_END(head);				\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
+	(elm)->field.sle_next = (slistelm)->field.sle_next;		\
+	(slistelm)->field.sle_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
+	(elm)->field.sle_next = (head)->slh_first;			\
+	(head)->slh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE_AFTER(slistelm, field) do {			\
+	(slistelm)->field.sle_next =					\
+	    SLIST_NEXT(SLIST_NEXT((slistelm), field), field);		\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE_HEAD(head, field) do {				\
+	(head)->slh_first = (head)->slh_first->field.sle_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE(head, elm, type, field) do {			\
+	if ((head)->slh_first == (elm)) {				\
+		SLIST_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = (head)->slh_first;		\
+		while(curelm->field.sle_next != (elm))			\
+			curelm = curelm->field.sle_next;		\
+		curelm->field.sle_next =				\
+		    curelm->field.sle_next->field.sle_next;		\
+	}								\
+} while (/*CONSTCOND*/0)
+
+
+/*
+ * List definitions.
+ */
+#define	LIST_HEAD(name, type)						\
+struct name {								\
+	struct type *lh_first;	/* first element */			\
+}
+
+#define	LIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	LIST_ENTRY(type)						\
+struct {								\
+	struct type *le_next;	/* next element */			\
+	struct type **le_prev;	/* address of previous next element */	\
+}
+
+/*
+ * List access methods.
+ */
+#define	LIST_FIRST(head)		((head)->lh_first)
+#define	LIST_END(head)			NULL
+#define	LIST_EMPTY(head)		((head)->lh_first == LIST_END(head))
+#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
+
+#define	LIST_FOREACH(var, head, field)					\
+	for ((var) = ((head)->lh_first);				\
+	    (var) != LIST_END(head);					\
+	    (var) = ((var)->field.le_next))
+
+#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = LIST_FIRST((head));				\
+	    (var) != LIST_END(head) &&					\
+	    ((tvar) = LIST_NEXT((var), field), 1);			\
+	    (var) = (tvar))
+
+#define	LIST_MOVE(head1, head2) do {					\
+	LIST_INIT((head2));						\
+	if (!LIST_EMPTY((head1))) {					\
+		(head2)->lh_first = (head1)->lh_first;			\
+		LIST_INIT((head1));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+/*
+ * List functions.
+ */
+#if defined(QUEUEDEBUG)
+#define	QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)			\
+	if ((head)->lh_first &&						\
+	    (head)->lh_first->field.le_prev != &(head)->lh_first)	\
+		QUEUEDEBUG_ABORT("LIST_INSERT_HEAD %p %s:%d", (head),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_LIST_OP(elm, field)					\
+	if ((elm)->field.le_next &&					\
+	    (elm)->field.le_next->field.le_prev !=			\
+	    &(elm)->field.le_next)					\
+		QUEUEDEBUG_ABORT("LIST_* forw %p %s:%d", (elm),		\
+		    __FILE__, __LINE__);				\
+	if (*(elm)->field.le_prev != (elm))				\
+		QUEUEDEBUG_ABORT("LIST_* back %p %s:%d", (elm),		\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_LIST_POSTREMOVE(elm, field)				\
+	(elm)->field.le_next = (void *)1L;				\
+	(elm)->field.le_prev = (void *)1L;
+#else
+#define	QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)
+#define	QUEUEDEBUG_LIST_OP(elm, field)
+#define	QUEUEDEBUG_LIST_POSTREMOVE(elm, field)
+#endif
+
+#define	LIST_INIT(head) do {						\
+	(head)->lh_first = LIST_END(head);				\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
+	QUEUEDEBUG_LIST_OP((listelm), field)				\
+	if (((elm)->field.le_next = (listelm)->field.le_next) != 	\
+	    LIST_END(head))						\
+		(listelm)->field.le_next->field.le_prev =		\
+		    &(elm)->field.le_next;				\
+	(listelm)->field.le_next = (elm);				\
+	(elm)->field.le_prev = &(listelm)->field.le_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	QUEUEDEBUG_LIST_OP((listelm), field)				\
+	(elm)->field.le_prev = (listelm)->field.le_prev;		\
+	(elm)->field.le_next = (listelm);				\
+	*(listelm)->field.le_prev = (elm);				\
+	(listelm)->field.le_prev = &(elm)->field.le_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_HEAD(head, elm, field) do {				\
+	QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field)		\
+	if (((elm)->field.le_next = (head)->lh_first) != LIST_END(head))\
+		(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
+	(head)->lh_first = (elm);					\
+	(elm)->field.le_prev = &(head)->lh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_REMOVE(elm, field) do {					\
+	QUEUEDEBUG_LIST_OP((elm), field)				\
+	if ((elm)->field.le_next != NULL)				\
+		(elm)->field.le_next->field.le_prev = 			\
+		    (elm)->field.le_prev;				\
+	*(elm)->field.le_prev = (elm)->field.le_next;			\
+	QUEUEDEBUG_LIST_POSTREMOVE((elm), field)			\
+} while (/*CONSTCOND*/0)
+
+#define LIST_REPLACE(elm, elm2, field) do {				\
+	if (((elm2)->field.le_next = (elm)->field.le_next) != NULL)	\
+		(elm2)->field.le_next->field.le_prev =			\
+		    &(elm2)->field.le_next;				\
+	(elm2)->field.le_prev = (elm)->field.le_prev;			\
+	*(elm2)->field.le_prev = (elm2);				\
+	QUEUEDEBUG_LIST_POSTREMOVE((elm), field)			\
+} while (/*CONSTCOND*/0)
+
+/*
+ * Simple queue definitions.
+ */
+#define	SIMPLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *sqh_first;	/* first element */			\
+	struct type **sqh_last;	/* addr of last next element */		\
+}
+
+#define	SIMPLEQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).sqh_first }
+
+#define	SIMPLEQ_ENTRY(type)						\
+struct {								\
+	struct type *sqe_next;	/* next element */			\
+}
+
+/*
+ * Simple queue access methods.
+ */
+#define	SIMPLEQ_FIRST(head)		((head)->sqh_first)
+#define	SIMPLEQ_END(head)		NULL
+#define	SIMPLEQ_EMPTY(head)		((head)->sqh_first == SIMPLEQ_END(head))
+#define	SIMPLEQ_NEXT(elm, field)	((elm)->field.sqe_next)
+
+#define	SIMPLEQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->sqh_first);				\
+	    (var) != SIMPLEQ_END(head);					\
+	    (var) = ((var)->field.sqe_next))
+
+#define	SIMPLEQ_FOREACH_SAFE(var, head, field, next)			\
+	for ((var) = ((head)->sqh_first);				\
+	    (var) != SIMPLEQ_END(head) &&				\
+	    ((next = ((var)->field.sqe_next)), 1);			\
+	    (var) = (next))
+
+/*
+ * Simple queue functions.
+ */
+#define	SIMPLEQ_INIT(head) do {						\
+	(head)->sqh_first = NULL;					\
+	(head)->sqh_last = &(head)->sqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.sqe_next = (head)->sqh_first) == NULL)	\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(head)->sqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.sqe_next = NULL;					\
+	*(head)->sqh_last = (elm);					\
+	(head)->sqh_last = &(elm)->field.sqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(listelm)->field.sqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_REMOVE_HEAD(head, field) do {				\
+	if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
+		(head)->sqh_last = &(head)->sqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_REMOVE_AFTER(head, elm, field) do {			\
+	if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
+	    == NULL)							\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_REMOVE(head, elm, type, field) do {			\
+	if ((head)->sqh_first == (elm)) {				\
+		SIMPLEQ_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->sqh_first;		\
+		while (curelm->field.sqe_next != (elm))			\
+			curelm = curelm->field.sqe_next;		\
+		if ((curelm->field.sqe_next =				\
+			curelm->field.sqe_next->field.sqe_next) == NULL) \
+			    (head)->sqh_last = &(curelm)->field.sqe_next; \
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_CONCAT(head1, head2) do {				\
+	if (!SIMPLEQ_EMPTY((head2))) {					\
+		*(head1)->sqh_last = (head2)->sqh_first;		\
+		(head1)->sqh_last = (head2)->sqh_last;		\
+		SIMPLEQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_LAST(head, type, field)					\
+	(SIMPLEQ_EMPTY((head)) ?						\
+		NULL :							\
+	        ((struct type *)(void *)				\
+		((char *)((head)->sqh_last) - offsetof(struct type, field))))
+
+/*
+ * Tail queue definitions.
+ */
+#define	_TAILQ_HEAD(name, type, qual)					\
+struct name {								\
+	qual type *tqh_first;		/* first element */		\
+	qual type *qual *tqh_last;	/* addr of last next element */	\
+}
+#define TAILQ_HEAD(name, type)	_TAILQ_HEAD(name, struct type,)
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ TAILQ_END(head), &(head).tqh_first }
+
+#define	_TAILQ_ENTRY(type, qual)					\
+struct {								\
+	qual type *tqe_next;		/* next element */		\
+	qual type *qual *tqe_prev;	/* address of previous next element */\
+}
+#define TAILQ_ENTRY(type)	_TAILQ_ENTRY(struct type,)
+
+/*
+ * Tail queue access methods.
+ */
+#define	TAILQ_FIRST(head)		((head)->tqh_first)
+#define	TAILQ_END(head)			(NULL)
+#define	TAILQ_NEXT(elm, field)		((elm)->field.tqe_next)
+#define	TAILQ_LAST(head, headname) \
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+#define	TAILQ_PREV(elm, headname, field) \
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+#define	TAILQ_EMPTY(head)		(TAILQ_FIRST(head) == TAILQ_END(head))
+
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = ((head)->tqh_first);				\
+	    (var) != TAILQ_END(head);					\
+	    (var) = ((var)->field.tqe_next))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, next)			\
+	for ((var) = ((head)->tqh_first);				\
+	    (var) != TAILQ_END(head) &&					\
+	    ((next) = TAILQ_NEXT(var, field), 1); (var) = (next))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));\
+	    (var) != TAILQ_END(head);					\
+	    (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) != TAILQ_END(head) && 				\
+	    ((prev) = TAILQ_PREV((var), headname, field), 1); (var) = (prev))
+
+/*
+ * Tail queue functions.
+ */
+#if defined(QUEUEDEBUG)
+#define	QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)			\
+	if ((head)->tqh_first &&					\
+	    (head)->tqh_first->field.tqe_prev != &(head)->tqh_first)	\
+		QUEUEDEBUG_ABORT("TAILQ_INSERT_HEAD %p %s:%d", (head),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)			\
+	if (*(head)->tqh_last != NULL)					\
+		QUEUEDEBUG_ABORT("TAILQ_INSERT_TAIL %p %s:%d", (head),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_OP(elm, field)					\
+	if ((elm)->field.tqe_next &&					\
+	    (elm)->field.tqe_next->field.tqe_prev !=			\
+	    &(elm)->field.tqe_next)					\
+		QUEUEDEBUG_ABORT("TAILQ_* forw %p %s:%d", (elm),	\
+		    __FILE__, __LINE__);				\
+	if (*(elm)->field.tqe_prev != (elm))				\
+		QUEUEDEBUG_ABORT("TAILQ_* back %p %s:%d", (elm),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)			\
+	if ((elm)->field.tqe_next == NULL &&				\
+	    (head)->tqh_last != &(elm)->field.tqe_next)			\
+		QUEUEDEBUG_ABORT("TAILQ_PREREMOVE head %p elm %p %s:%d",\
+		    (head), (elm), __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)				\
+	(elm)->field.tqe_next = (void *)1L;				\
+	(elm)->field.tqe_prev = (void *)1L;
+#else
+#define	QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)
+#define	QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)
+#define	QUEUEDEBUG_TAILQ_OP(elm, field)
+#define	QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)
+#define	QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)
+#endif
+
+#define	TAILQ_INIT(head) do {						\
+	(head)->tqh_first = TAILQ_END(head);				\
+	(head)->tqh_last = &(head)->tqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field)		\
+	if (((elm)->field.tqe_next = (head)->tqh_first) != TAILQ_END(head))\
+		(head)->tqh_first->field.tqe_prev =			\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(head)->tqh_first = (elm);					\
+	(elm)->field.tqe_prev = &(head)->tqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field)		\
+	(elm)->field.tqe_next = TAILQ_END(head);			\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &(elm)->field.tqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QUEUEDEBUG_TAILQ_OP((listelm), field)				\
+	if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != 	\
+	    TAILQ_END(head))						\
+		(elm)->field.tqe_next->field.tqe_prev = 		\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(listelm)->field.tqe_next = (elm);				\
+	(elm)->field.tqe_prev = &(listelm)->field.tqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QUEUEDEBUG_TAILQ_OP((listelm), field)				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	(elm)->field.tqe_next = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &(elm)->field.tqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field)		\
+	QUEUEDEBUG_TAILQ_OP((elm), field)				\
+	if (((elm)->field.tqe_next) != TAILQ_END(head))			\
+		(elm)->field.tqe_next->field.tqe_prev = 		\
+		    (elm)->field.tqe_prev;				\
+	else								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+	*(elm)->field.tqe_prev = (elm)->field.tqe_next;			\
+	QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field);			\
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_REPLACE(head, elm, elm2, field) do {			\
+        if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != 	\
+	    TAILQ_END(head))   						\
+                (elm2)->field.tqe_next->field.tqe_prev =		\
+                    &(elm2)->field.tqe_next;				\
+        else								\
+                (head)->tqh_last = &(elm2)->field.tqe_next;		\
+        (elm2)->field.tqe_prev = (elm)->field.tqe_prev;			\
+        *(elm2)->field.tqe_prev = (elm2);				\
+	QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field);			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#define	STAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *stqh_first;	/* first element */		\
+	struct type **stqh_last;	/* addr of last next element */	\
+}
+
+#define	STAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).stqh_first }
+
+#define	STAILQ_ENTRY(type)						\
+struct {								\
+	struct type *stqe_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked Tail queue access methods.
+ */
+#define	STAILQ_FIRST(head)	((head)->stqh_first)
+#define	STAILQ_END(head)	NULL
+#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
+#define	STAILQ_EMPTY(head)	(STAILQ_FIRST(head) == STAILQ_END(head))
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#define	STAILQ_INIT(head) do {						\
+	(head)->stqh_first = NULL;					\
+	(head)->stqh_last = &(head)->stqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.stqe_next = (head)->stqh_first) == NULL)	\
+		(head)->stqh_last = &(elm)->field.stqe_next;		\
+	(head)->stqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.stqe_next = NULL;					\
+	*(head)->stqh_last = (elm);					\
+	(head)->stqh_last = &(elm)->field.stqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+		(head)->stqh_last = &(elm)->field.stqe_next;		\
+	(listelm)->field.stqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_REMOVE_HEAD(head, field) do {				\
+	if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
+		(head)->stqh_last = &(head)->stqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_REMOVE(head, elm, type, field) do {			\
+	if ((head)->stqh_first == (elm)) {				\
+		STAILQ_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->stqh_first;		\
+		while (curelm->field.stqe_next != (elm))			\
+			curelm = curelm->field.stqe_next;		\
+		if ((curelm->field.stqe_next =				\
+			curelm->field.stqe_next->field.stqe_next) == NULL) \
+			    (head)->stqh_last = &(curelm)->field.stqe_next; \
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->stqh_first);				\
+		(var);							\
+		(var) = ((var)->field.stqe_next))
+
+#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = STAILQ_FIRST((head));				\
+	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	STAILQ_CONCAT(head1, head2) do {				\
+	if (!STAILQ_EMPTY((head2))) {					\
+		*(head1)->stqh_last = (head2)->stqh_first;		\
+		(head1)->stqh_last = (head2)->stqh_last;		\
+		STAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_LAST(head, type, field)					\
+	(STAILQ_EMPTY((head)) ?						\
+		NULL :							\
+	        ((struct type *)(void *)				\
+		((char *)((head)->stqh_last) - offsetof(struct type, field))))
+
+
+#ifndef _KERNEL
+/*
+ * Circular queue definitions. Do not use. We still keep the macros
+ * for compatibility but because of pointer aliasing issues their use
+ * is discouraged!
+ */
+
+/*
+ * __launder_type():  We use this ugly hack to work around the the compiler
+ * noticing that two types may not alias each other and elide tests in code.
+ * We hit this in the CIRCLEQ macros when comparing 'struct name *' and
+ * 'struct type *' (see CIRCLEQ_HEAD()).  Modern compilers (such as GCC
+ * 4.8) declare these comparisons as always false, causing the code to
+ * not run as designed.
+ *
+ * This hack is only to be used for comparisons and thus can be fully const.
+ * Do not use for assignment.
+ *
+ * If we ever choose to change the ABI of the CIRCLEQ macros, we could fix
+ * this by changing the head/tail sentinal values, but see the note above
+ * this one.
+ */
+static __inline const void * __launder_type(const void *);
+static __inline const void *
+__launder_type(const void *__x)
+{
+	__asm __volatile("" : "+r" (__x));
+	return __x;
+}
+
+#if defined(QUEUEDEBUG)
+#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)				\
+	if ((head)->cqh_first != CIRCLEQ_ENDC(head) &&			\
+	    (head)->cqh_first->field.cqe_prev != CIRCLEQ_ENDC(head))	\
+		QUEUEDEBUG_ABORT("CIRCLEQ head forw %p %s:%d", (head),	\
+		      __FILE__, __LINE__);				\
+	if ((head)->cqh_last != CIRCLEQ_ENDC(head) &&			\
+	    (head)->cqh_last->field.cqe_next != CIRCLEQ_ENDC(head))	\
+		QUEUEDEBUG_ABORT("CIRCLEQ head back %p %s:%d", (head),	\
+		      __FILE__, __LINE__);
+#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)			\
+	if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) {		\
+		if ((head)->cqh_last != (elm))				\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm last %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	} else {							\
+		if ((elm)->field.cqe_next->field.cqe_prev != (elm))	\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm forw %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	}								\
+	if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) {		\
+		if ((head)->cqh_first != (elm))				\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm first %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	} else {							\
+		if ((elm)->field.cqe_prev->field.cqe_next != (elm))	\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm prev %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	}
+#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)			\
+	(elm)->field.cqe_next = (void *)1L;				\
+	(elm)->field.cqe_prev = (void *)1L;
+#else
+#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)
+#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)
+#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)
+#endif
+
+#define	CIRCLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *cqh_first;		/* first element */		\
+	struct type *cqh_last;		/* last element */		\
+}
+
+#define	CIRCLEQ_HEAD_INITIALIZER(head)					\
+	{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
+
+#define	CIRCLEQ_ENTRY(type)						\
+struct {								\
+	struct type *cqe_next;		/* next element */		\
+	struct type *cqe_prev;		/* previous element */		\
+}
+
+/*
+ * Circular queue functions.
+ */
+#define	CIRCLEQ_INIT(head) do {						\
+	(head)->cqh_first = CIRCLEQ_END(head);				\
+	(head)->cqh_last = CIRCLEQ_END(head);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)		\
+	(elm)->field.cqe_next = (listelm)->field.cqe_next;		\
+	(elm)->field.cqe_prev = (listelm);				\
+	if ((listelm)->field.cqe_next == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(listelm)->field.cqe_next->field.cqe_prev = (elm);	\
+	(listelm)->field.cqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do {		\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)		\
+	(elm)->field.cqe_next = (listelm);				\
+	(elm)->field.cqe_prev = (listelm)->field.cqe_prev;		\
+	if ((listelm)->field.cqe_prev == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(listelm)->field.cqe_prev->field.cqe_next = (elm);	\
+	(listelm)->field.cqe_prev = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_HEAD(head, elm, field) do {			\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	(elm)->field.cqe_next = (head)->cqh_first;			\
+	(elm)->field.cqe_prev = CIRCLEQ_END(head);			\
+	if ((head)->cqh_last == CIRCLEQ_ENDC(head))			\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(head)->cqh_first->field.cqe_prev = (elm);		\
+	(head)->cqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_TAIL(head, elm, field) do {			\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	(elm)->field.cqe_next = CIRCLEQ_END(head);			\
+	(elm)->field.cqe_prev = (head)->cqh_last;			\
+	if ((head)->cqh_first == CIRCLEQ_ENDC(head))			\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(head)->cqh_last->field.cqe_next = (elm);		\
+	(head)->cqh_last = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_REMOVE(head, elm, field) do {				\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field)			\
+	if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_last = (elm)->field.cqe_prev;		\
+	else								\
+		(elm)->field.cqe_next->field.cqe_prev =			\
+		    (elm)->field.cqe_prev;				\
+	if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_first = (elm)->field.cqe_next;		\
+	else								\
+		(elm)->field.cqe_prev->field.cqe_next =			\
+		    (elm)->field.cqe_next;				\
+	QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field)			\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->cqh_first);				\
+		(var) != CIRCLEQ_ENDC(head);				\
+		(var) = ((var)->field.cqe_next))
+
+#define	CIRCLEQ_FOREACH_REVERSE(var, head, field)			\
+	for ((var) = ((head)->cqh_last);				\
+		(var) != CIRCLEQ_ENDC(head);				\
+		(var) = ((var)->field.cqe_prev))
+
+/*
+ * Circular queue access methods.
+ */
+#define	CIRCLEQ_FIRST(head)		((head)->cqh_first)
+#define	CIRCLEQ_LAST(head)		((head)->cqh_last)
+/* For comparisons */
+#define	CIRCLEQ_ENDC(head)		(__launder_type(head))
+/* For assignments */
+#define	CIRCLEQ_END(head)		((void *)(head))
+#define	CIRCLEQ_NEXT(elm, field)	((elm)->field.cqe_next)
+#define	CIRCLEQ_PREV(elm, field)	((elm)->field.cqe_prev)
+#define	CIRCLEQ_EMPTY(head)						\
+    (CIRCLEQ_FIRST(head) == CIRCLEQ_ENDC(head))
+
+#define CIRCLEQ_LOOP_NEXT(head, elm, field)				\
+	(((elm)->field.cqe_next == CIRCLEQ_ENDC(head))			\
+	    ? ((head)->cqh_first)					\
+	    : (elm->field.cqe_next))
+#define CIRCLEQ_LOOP_PREV(head, elm, field)				\
+	(((elm)->field.cqe_prev == CIRCLEQ_ENDC(head))			\
+	    ? ((head)->cqh_last)					\
+	    : (elm->field.cqe_prev))
+#endif /* !_KERNEL */
+
+#endif	/* !_SYS_QUEUE_H_ */

Property changes on: lab4/.minix-src/include/sys/queue.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/reboot.h
===================================================================
--- lab4/.minix-src/include/sys/reboot.h	(nonexistent)
+++ lab4/.minix-src/include/sys/reboot.h	(revision 13)
@@ -0,0 +1,124 @@
+/*	$NetBSD: reboot.h,v 1.25 2007/12/25 18:33:48 perry Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1988, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)reboot.h	8.3 (Berkeley) 12/13/94
+ */
+
+#ifndef _SYS_REBOOT_H_
+#define _SYS_REBOOT_H_
+
+/*
+ * Arguments to reboot system call.  These are passed to the boot program,
+ * and then on to init.
+ */
+#define	RB_AUTOBOOT	0	/* flags for system auto-booting itself */
+
+#define	RB_ASKNAME	0x00000001	/* ask for file name to reboot from */
+#define	RB_SINGLE	0x00000002	/* reboot to single user only */
+#define	RB_NOSYNC	0x00000004	/* dont sync before reboot */
+#define	RB_HALT		0x00000008	/* don't reboot, just halt */
+#define	RB_INITNAME	0x00000010	/* name given for /etc/init (unused) */
+#define	__RB_UNUSED1	0x00000020	/* was RB_DFLTROOT, obsolete */
+#define	RB_KDB		0x00000040	/* give control to kernel debugger */
+#define	RB_RDONLY	0x00000080	/* mount root fs read-only */
+#define	RB_DUMP		0x00000100	/* dump kernel memory before reboot */
+#define	RB_MINIROOT	0x00000200	/* mini-root present in memory */
+#define	RB_STRING	0x00000400	/* use provided bootstr */
+#define	RB_POWERDOWN	(RB_HALT|0x800) /* turn power off (or at least halt) */
+#define RB_USERCONF	0x00001000	/* change configured devices */
+
+/*
+ * Extra autoboot flags (passed by boot prog to kernel). See also
+ * macros bootverbose, bootquiet in <sys/systm.h>.
+ */
+#define	AB_NORMAL	0x00000000	/* boot normally (default) */
+#define	AB_QUIET	0x00010000 	/* boot quietly */
+#define	AB_VERBOSE	0x00020000	/* boot verbosely */
+#define	AB_SILENT	0x00040000	/* boot silently */
+#define	AB_DEBUG	0x00080000	/* boot with debug messages */
+
+/*
+ * The top 4 bits are architecture specific and are used to
+ * pass information between the bootblocks and the machine
+ * initialization code.
+ */
+#define	RB_MD1		0x10000000
+#define	RB_MD2		0x20000000
+#define	RB_MD3		0x40000000
+#define	RB_MD4		0x80000000
+
+/*
+ * Constants for converting boot-style device number to type,
+ * adaptor (uba, mba, etc), unit number and partition number.
+ * Type (== major device number) is in the low byte
+ * for backward compatibility.  Except for that of the "magic
+ * number", each mask applies to the shifted value.
+ * Format:
+ *	 (4) (4) (4) (4)  (8)     (8)
+ *	--------------------------------
+ *	|MA | AD| CT| UN| PART  | TYPE |
+ *	--------------------------------
+ */
+#define	B_ADAPTORSHIFT		24
+#define	B_ADAPTORMASK		0x0f
+#define	B_ADAPTOR(val)		(((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK)
+#define B_CONTROLLERSHIFT	20
+#define B_CONTROLLERMASK	0xf
+#define	B_CONTROLLER(val)	(((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
+#define B_UNITSHIFT		16
+#define B_UNITMASK		0xf
+#define	B_UNIT(val)		(((val) >> B_UNITSHIFT) & B_UNITMASK)
+#define B_PARTITIONSHIFT	8
+#define B_PARTITIONMASK		0xff
+#define	B_PARTITION(val)	(((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK)
+#define	B_TYPESHIFT		0
+#define	B_TYPEMASK		0xff
+#define	B_TYPE(val)		(((val) >> B_TYPESHIFT) & B_TYPEMASK)
+
+#define	B_MAGICMASK	0xf0000000
+#define	B_DEVMAGIC	0xa0000000
+
+#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
+	(((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
+	((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \
+	((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC)
+
+#ifdef _KERNEL
+
+__BEGIN_DECLS
+
+void	cpu_reboot(int, char *)
+    __dead;
+
+__END_DECLS
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_REBOOT_H_ */

Property changes on: lab4/.minix-src/include/sys/reboot.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/selinfo.h
===================================================================
--- lab4/.minix-src/include/sys/selinfo.h	(nonexistent)
+++ lab4/.minix-src/include/sys/selinfo.h	(revision 13)
@@ -0,0 +1,83 @@
+/*	$NetBSD: selinfo.h,v 1.8 2010/07/08 12:23:31 rmind Exp $	*/
+
+/*-
+ * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)select.h	8.2 (Berkeley) 1/4/94
+*	from: NetBSD: select.h,v 1.21 2005/03/10 00:25:45 kleink Exp
+ */
+
+#ifndef _SYS_SELINFO_H_
+#define	_SYS_SELINFO_H_
+
+#include <sys/event.h>		/* for struct klist */
+
+/*
+ * Used to maintain information about processes that wish to be
+ * notified when I/O becomes possible.
+ */
+struct selinfo {
+	struct klist	sel_klist;	/* knotes attached to this selinfo */
+	void		*sel_cluster;	/* current cluster association */
+	struct lwp	*sel_lwp;	/* first LWP to be notified */
+	uintptr_t	sel_fdinfo;	/* selected descriptor by first LWP */
+	SLIST_ENTRY(selinfo) sel_chain;	/* entry on LWP's list of selinfo */
+	uint32_t	sel_collision;	/* mask of colliding cpus */
+	uint32_t	sel_reserved[3];/* reserved for future expansion */
+};
+
+#endif /* !_SYS_SELINFO_H_ */

Property changes on: lab4/.minix-src/include/sys/selinfo.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ras.h
===================================================================
--- lab4/.minix-src/include/sys/ras.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ras.h	(revision 13)
@@ -0,0 +1,134 @@
+/*	$NetBSD: ras.h,v 1.14 2008/08/11 21:51:14 skrll Exp $	*/
+
+/*-
+ * Copyright (c) 2002, 2004, 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Gregory McGarry.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_RAS_H_
+#define _SYS_RAS_H_
+
+#ifndef __ASSEMBLER__
+#include <sys/types.h>
+#include <sys/queue.h>
+
+struct ras {
+	struct ras	*ras_next;
+	void		*ras_startaddr;
+	void		*ras_endaddr;
+};
+
+#define RAS_INSTALL		0
+#define RAS_PURGE		1
+#define RAS_PURGE_ALL		2
+#else
+#include <sys/cdefs.h>
+#endif /* __ASSEMBLER__ */
+
+#ifdef _KERNEL
+
+#ifndef __ASSEMBLER__
+struct proc;
+
+void	*ras_lookup(struct proc *, void *);
+int	ras_fork(struct proc *, struct proc *);
+int	ras_purgeall(void);
+#endif /* __ASSEMBLER__ */
+
+#else /* !_KERNEL */
+
+#ifndef	RAS_DECL
+
+#define	RAS_DECL(name)							\
+extern void __CONCAT(name,_ras_start(void)), __CONCAT(name,_ras_end(void))
+
+#endif	/* RAS_DECL */
+
+/*
+ * RAS_START and RAS_END contain implicit instruction reordering
+ * barriers.  See __insn_barrier() in <sys/cdefs.h>.
+ *
+ * Note: You are strongly advised to avoid coding RASs in C. There is a
+ * good chance the compiler will generate code which cannot be restarted.
+ */
+#define	RAS_START(name)							\
+	__asm volatile(".globl " ___STRING(name) "_ras_start\n"	\
+			 ___STRING(name) "_ras_start:" 			\
+	    ::: "memory")
+
+#define	RAS_END(name)							\
+	__asm volatile(".globl " ___STRING(name) "_ras_end\n"		\
+			 ___STRING(name) "_ras_end:"			\
+	    ::: "memory")
+
+#define	RAS_ADDR(name)	((void *)(uintptr_t) __CONCAT(name,_ras_start))
+#define	RAS_SIZE(name)	((size_t)((uintptr_t) __CONCAT(name,_ras_end) -	\
+				  (uintptr_t) __CONCAT(name,_ras_start)))
+
+#ifndef __ASSEMBLER__
+__BEGIN_DECLS
+int rasctl(void *, size_t, int);
+__END_DECLS
+
+#else /* __ASSEMBLER__ */
+
+#ifndef	_ASM_LS_CHAR
+#define	_ASM_LS_CHAR	;
+#endif
+
+/*
+ * RAS_START_ASM and RAS_END_ASM are for use within assembly code.
+ * This is the prefered method of coding a RAS.
+ */
+#define	RAS_START_ASM(name)						\
+	.globl _C_LABEL(__CONCAT(name,_ras_start))	 _ASM_LS_CHAR	\
+	_C_LABEL(__CONCAT(name,_ras_start)):
+
+#define	RAS_END_ASM(name)						\
+	.globl _C_LABEL(__CONCAT(name,_ras_end)) 	_ASM_LS_CHAR	\
+	_C_LABEL(__CONCAT(name,_ras_end)):
+
+/*
+ * RAS_START_ASM_HIDDEN and RAS_END_ASM_HIDDEN are similar to the above,
+ * except that they limit the scope of the symbol such that it will not
+ * be placed into the dynamic symbol table. Thus no other module (executable
+ * or shared library) can reference it directly.
+ */
+#define	RAS_START_ASM_HIDDEN(name)					\
+	.globl _C_LABEL(__CONCAT(name,_ras_start)) 	_ASM_LS_CHAR	\
+	.hidden _C_LABEL(__CONCAT(name,_ras_start)) 	_ASM_LS_CHAR	\
+	_C_LABEL(__CONCAT(name,_ras_start)):
+
+#define	RAS_END_ASM_HIDDEN(name)					\
+	.globl _C_LABEL(__CONCAT(name,_ras_end)) 	_ASM_LS_CHAR	\
+	.hidden _C_LABEL(__CONCAT(name,_ras_end)) 	_ASM_LS_CHAR	\
+	_C_LABEL(__CONCAT(name,_ras_end)):
+#endif /* __ASSEMBLER__ */
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_RAS_H_ */

Property changes on: lab4/.minix-src/include/sys/ras.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/mtio.h
===================================================================
--- lab4/.minix-src/include/sys/mtio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/mtio.h	(revision 13)
@@ -0,0 +1,166 @@
+/*	$NetBSD: mtio.h,v 1.24 2015/09/06 06:01:02 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)mtio.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_MTIO_H_
+#define	_SYS_MTIO_H_
+
+#include <sys/ioccom.h>
+
+/*
+ * Structures and definitions for mag tape io control commands
+ */
+
+/* structure for MTIOCTOP - mag tape op command */
+struct mtop {
+	short	mt_op;		/* operations defined below */
+	int32_t	mt_count;	/* how many of them */
+};
+
+/* operations */
+#define	MTWEOF		0	/* write an end-of-file record */
+#define	MTFSF		1	/* forward space file */
+#define	MTBSF		2	/* backward space file */
+#define	MTFSR		3	/* forward space record */
+#define	MTBSR		4	/* backward space record */
+#define	MTREW		5	/* rewind */
+#define	MTOFFL		6	/* rewind and put the drive offline */
+#define	MTNOP		7	/* no operation, sets status only */
+#define	MTRETEN		8	/* retension */
+#define	MTERASE		9	/* erase entire tape */
+#define	MTEOM		10	/* forward to end of media */
+#define	MTNBSF		11	/* backward space to beginning of file */
+#define	MTCACHE		12	/* enable controller cache */
+#define	MTNOCACHE	13	/* disable controller cache */
+#define	MTSETBSIZ	14	/* set block size; 0 for variable */
+#define	MTSETDNSTY	15	/* set density code for current mode */
+#define	MTCMPRESS	16	/* set/clear device compression */
+#define	MTEWARN		17	/* set/clear early warning behaviour */
+
+/* structure for MTIOCGET - mag tape get status command */
+
+struct mtget {
+	short	mt_type;	/* type of magtape device */
+/* the following two registers are grossly device dependent */
+	short	mt_dsreg;	/* ``drive status'' register */
+	short	mt_erreg;	/* ``error'' register */
+/* end device-dependent registers */
+	short	mt_resid;	/* residual count */
+/* the following two are not yet implemented by most tape drivers */
+	int32_t	mt_fileno;	/* file number of current position */
+	int32_t	mt_blkno;	/* block number of current position */
+/* end not yet implemented */
+	int32_t	mt_blksiz;	/* current block size */
+	int32_t	mt_density;	/* current density code */
+	int32_t	mt_mblksiz[4];	/* block size for different modes */
+	int32_t mt_mdensity[4];	/* density codes for different modes */
+};
+
+/*
+ * Constants for mt_type byte.  These are the same
+ * for controllers compatible with the types listed.
+ */
+#define	MT_ISTS		0x01		/* TS-11 */
+#define	MT_ISHT		0x02		/* TM03 Massbus: TE16, TU45, TU77 */
+#define	MT_ISTM		0x03		/* TM11/TE10 Unibus */
+#define	MT_ISMT		0x04		/* TM78/TU78 Massbus */
+#define	MT_ISUT		0x05		/* SI TU-45 emulation on Unibus */
+#define	MT_ISCPC	0x06		/* SUN */
+#define	MT_ISAR		0x07		/* SUN - Also "GENERIC SCSI" */
+#define	MT_ISTMSCP	0x08		/* DEC TMSCP protocol (TU81, TK50) */
+#define	MT_ISCY		0x09		/* CCI Cipher */
+#define	MT_ISCT		0x0a		/* HP 1/4 tape */
+#define	MT_ISFHP	0x0b		/* HP 7980 1/2 tape */
+#define	MT_ISEXABYTE	0x0c		/* Exabyte */
+#define	MT_ISEXA8200	0x0c		/* Exabyte EXB-8200 */
+#define	MT_ISEXA8500	0x0d		/* Exabyte EXB-8500 */
+#define	MT_ISVIPER1	0x0e		/* Archive Viper-150 */
+#define	MT_ISPYTHON	0x0f		/* Archive Python (DAT) */
+#define	MT_ISHPDAT	0x10		/* HP 35450A DAT drive */
+#define	MT_ISWANGTEK	0x11		/* WANGTEK 5150ES */
+#define	MT_ISCALIPER	0x12		/* Caliper CP150 */
+#define	MT_ISWTEK5099	0x13		/* WANGTEK 5099ES */
+#define	MT_ISVIPER2525	0x14		/* Archive Viper 2525 */
+#define	MT_ISMFOUR	0x11		/* M4 Data 1/2 9track drive */
+#define	MT_ISTK50	0x12		/* DEC SCSI TK50 */
+#define	MT_ISMT02	0x13		/* Emulex MT02 SCSI tape controller */
+
+/* bits defined for the mt_dsreg field */
+#define	MT_DS_RDONLY	0x10		/* tape mounted readonly */
+#define	MT_DS_MOUNTED	0x03		/* tape mounted (for control opens) */
+
+/*
+ * For the mt_erreg field.....This is supposed to be a *generic*
+ * MT interface, so we cannot overload it with SCSI specific entities,
+ * (like ASC/ASCQ) nor is there enough room to put all the information
+ * in that is desirable. This whole structure should be redone.
+ *
+ * In the interim, this will be considered device-specific. For SCSI,
+ * this will be taken to mean the last Sense Key seen. It is not
+ * guaranteed to always be sensibly associated with any command.
+ */
+
+/*
+ * The action of a MTIOCGET command clears mt_dsreg, mt_erreg, and mt_resid
+ */
+
+/* mag tape io control commands */
+#define	MTIOCTOP	_IOW('m', 1, struct mtop)	/* do a mag tape op */
+#define	MTIOCGET	_IOR('m', 2, struct mtget)	/* get tape status */
+#define	MTIOCIEOT	_IO('m', 3)			/* ignore EOT error */
+#define	MTIOCEEOT	_IO('m', 4)			/* enable EOT error */
+/*
+ * When more SCSI-3 SSC (streaming device) devices are out there
+ * that support the full 32 byte type 2 structure, we'll have to
+ * rethink these ioctls to support all the entities they haul into
+ * the picture (64 bit blocks, logical file record numbers, etc..).
+ */
+#define	MTIOCRDSPOS	_IOR('m', 5, uint32_t)	/* get logical blk addr */
+#define	MTIOCRDHPOS	_IOR('m', 6, uint32_t)	/* get hardware blk addr */
+#define	MTIOCSLOCATE	_IOW('m', 5, uint32_t)	/* seek to logical blk addr */
+#define	MTIOCHLOCATE	_IOW('m', 6, uint32_t)	/* seek to hardware blk addr */
+
+#ifdef	_KERNEL
+/*
+ * minor device number
+ */
+
+#define	T_UNIT		003		/* unit selection */
+#define	T_NOREWIND	004		/* no rewind on close */
+#define	T_DENSEL	030		/* density select */
+#define	T_800BPI	000		/* select  800 bpi */
+#define	T_1600BPI	010		/* select 1600 bpi */
+#define	T_6250BPI	020		/* select 6250 bpi */
+#define	T_BADBPI	030		/* undefined selection */
+#endif /* _KERNEL */
+
+#endif /* !_SYS_MTIO_H_ */

Property changes on: lab4/.minix-src/include/sys/mtio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/rndio.h
===================================================================
--- lab4/.minix-src/include/sys/rndio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/rndio.h	(revision 13)
@@ -0,0 +1,174 @@
+/*	$NetBSD: rndio.h,v 1.2 2015/09/06 06:01:02 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Michael Graff <explorer@flame.org>.  This code uses ideas and
+ * algorithms from the Linux driver written by Ted Ts'o.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_SYS_RNDIO_H
+#define	_SYS_RNDIO_H
+
+#include <sys/types.h>
+#include <sys/sha1.h>
+#include <sys/ioccom.h>
+
+/*
+ * Exposed "size" of entropy pool, for convenience in load/save
+ * from userspace.  Do not assume this is the same as the actual in-kernel
+ * pool size!
+ */
+#define RND_SAVEWORDS	128
+typedef struct {
+	uint32_t entropy;
+	uint8_t data[RND_SAVEWORDS * sizeof(uint32_t)];
+	uint8_t digest[SHA1_DIGEST_LENGTH];
+} rndsave_t;
+
+/* Statistics exposed by RNDGETPOOLSTAT */
+typedef struct
+{
+	uint32_t	poolsize;
+	uint32_t 	threshold;
+	uint32_t	maxentropy;
+
+	uint32_t	added;
+	uint32_t	curentropy;
+	uint32_t	removed;
+	uint32_t	discarded;
+	uint32_t	generated;
+} rndpoolstat_t;
+
+/* Sanitized random source view for userspace */
+typedef struct {
+	char		name[16];	/* device name */
+	uint32_t	total;		/* entropy from this source */
+	uint32_t	type;		/* type */
+	uint32_t	flags;		/* flags */
+} rndsource_t;
+
+typedef struct {
+	rndsource_t	rt;
+	uint32_t	dt_samples;	/* time-delta samples input */
+	uint32_t	dt_total;	/* time-delta entropy estimate */
+	uint32_t	dv_samples;	/* value-delta samples input */
+	uint32_t	dv_total;	/* value-delta entropy estimate */
+} rndsource_est_t;
+
+/*
+ * Flags to control the source.  Low byte is type, upper bits are flags.
+ */
+#define RND_FLAG_NO_ESTIMATE	0x00000100
+#define RND_FLAG_NO_COLLECT	0x00000200
+#define RND_FLAG_FAST		0x00000400	/* process samples in bulk */
+#define RND_FLAG_HASCB		0x00000800	/* has get callback */
+#define RND_FLAG_COLLECT_TIME	0x00001000	/* use timestamp as input */
+#define RND_FLAG_COLLECT_VALUE	0x00002000	/* use value as input */
+#define RND_FLAG_ESTIMATE_TIME	0x00004000	/* estimate entropy on time */
+#define RND_FLAG_ESTIMATE_VALUE	0x00008000	/* estimate entropy on value */
+#define	RND_FLAG_HASENABLE	0x00010000	/* has enable/disable fns */
+#define RND_FLAG_DEFAULT	(RND_FLAG_COLLECT_VALUE|RND_FLAG_COLLECT_TIME|\
+				 RND_FLAG_ESTIMATE_TIME)
+
+#define	RND_TYPE_UNKNOWN	0	/* unknown source */
+#define	RND_TYPE_DISK		1	/* source is physical disk */
+#define	RND_TYPE_NET		2	/* source is a network device */
+#define	RND_TYPE_TAPE		3	/* source is a tape drive */
+#define	RND_TYPE_TTY		4	/* source is a tty device */
+#define	RND_TYPE_RNG		5	/* source is a hardware RNG */
+#define RND_TYPE_SKEW		6	/* source is skew between clocks */
+#define RND_TYPE_ENV		7	/* source is temp or fan sensor */
+#define RND_TYPE_VM		8	/* source is VM system events */
+#define RND_TYPE_POWER		9	/* source is power events */
+#define	RND_TYPE_MAX		9	/* last type id used */
+
+#define	RND_MAXSTATCOUNT	10	/* 10 sources at once max */
+
+/*
+ * return "count" random entries, starting at "start"
+ */
+typedef struct {
+	uint32_t	start;
+	uint32_t	count;
+	rndsource_t	source[RND_MAXSTATCOUNT];
+} rndstat_t;
+
+/*
+ * return "count" random entries with estimates, starting at "start"
+ */
+typedef struct {
+	uint32_t	start;
+	uint32_t	count;
+	rndsource_est_t	source[RND_MAXSTATCOUNT];
+} rndstat_est_t;
+
+/*
+ * return information on a specific source by name
+ */
+typedef struct {
+	char		name[16];
+	rndsource_t	source;
+} rndstat_name_t;
+
+typedef struct {
+	char		name[16];
+	rndsource_est_t	source;
+} rndstat_est_name_t;
+
+
+/*
+ * set/clear device flags.  If type is set to 0xff, the name is used
+ * instead.  Otherwise, the flags set/cleared apply to all devices of
+ * the specified type, and the name is ignored.
+ */
+typedef struct {
+	char		name[16];	/* the name we are adjusting */
+	uint32_t	type;		/* the type of device we want */
+	uint32_t	flags;		/* flags to set or clear */
+	uint32_t	mask;		/* mask for the flags we are setting */
+} rndctl_t;
+
+/*
+ * Add entropy to the pool.  len is the data length, in bytes.
+ * entropy is the number of bits of estimated entropy in the data.
+ */
+typedef struct {
+	uint32_t	len;
+	uint32_t	entropy;
+	u_char		data[RND_SAVEWORDS * sizeof(uint32_t)];
+} rnddata_t;
+
+#define	RNDGETENTCNT	_IOR('R',  101, uint32_t) /* get entropy count */
+#define	RNDGETSRCNUM	_IOWR('R', 102, rndstat_t) /* get rnd source info */
+#define	RNDGETSRCNAME	_IOWR('R', 103, rndstat_name_t) /* get src by name */
+#define	RNDCTL		_IOW('R',  104, rndctl_t)  /* set/clear source flags */
+#define	RNDADDDATA	_IOW('R',  105, rnddata_t) /* add data to the pool */
+#define	RNDGETPOOLSTAT	_IOR('R',  106, rndpoolstat_t) /* get statistics */
+#define	RNDGETESTNUM	_IOWR('R', 107, rndstat_est_t) /* get srcest */
+#define	RNDGETESTNAME	_IOWR('R', 108, rndstat_est_name_t) /* " by name */
+
+#endif	/* _SYS_RNDIO_H */

Property changes on: lab4/.minix-src/include/sys/rndio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/resourcevar.h
===================================================================
--- lab4/.minix-src/include/sys/resourcevar.h	(nonexistent)
+++ lab4/.minix-src/include/sys/resourcevar.h	(revision 13)
@@ -0,0 +1,128 @@
+/*	$NetBSD: resourcevar.h,v 1.55 2014/09/05 05:47:40 matt Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)resourcevar.h	8.4 (Berkeley) 1/9/95
+ */
+
+#ifndef	_SYS_RESOURCEVAR_H_
+#define	_SYS_RESOURCEVAR_H_
+
+#if !defined(_KERNEL) && !defined(_KMEMUSER)
+#error "not supposed to be exposed to userland"
+#endif
+
+#include <sys/mutex.h>
+
+/*
+ * Kernel per-process accounting / statistics
+ */
+struct uprof {				/* profile arguments */
+	char *	pr_base;		/* buffer base */
+	size_t  pr_size;		/* buffer size */
+	u_long	pr_off;			/* pc offset */
+	u_int   pr_scale;		/* pc scaling */
+	u_long	pr_addr;		/* temp storage for addr until AST */
+	u_long	pr_ticks;		/* temp storage for ticks until AST */
+};
+
+struct pstats {
+#define	pstat_startzero	p_ru
+	struct	rusage p_ru;		/* stats for this proc */
+	struct	rusage p_cru;		/* sum of stats for reaped children */
+#define	pstat_endzero	pstat_startcopy
+
+#define	pstat_startcopy	p_timer
+	struct	itimerspec p_timer[3];	/* virtual-time timers */
+	struct	uprof p_prof;			/* profile arguments */
+#define	pstat_endcopy	p_start
+	struct	timeval p_start;	/* starting time */
+};
+
+#ifdef _KERNEL
+
+/*
+ * Process resource limits.  Since this structure is moderately large,
+ * but changes infrequently, it is shared copy-on-write after forks.
+ *
+ * When a separate copy is created, then 'pl_writeable' is set to true,
+ * and 'pl_sv_limit' is pointed to the old proc_t::p_limit structure.
+ */
+struct plimit {
+	struct rlimit	pl_rlimit[RLIM_NLIMITS];
+	char *		pl_corename;
+	size_t		pl_cnlen;
+	u_int		pl_refcnt;
+	bool		pl_writeable;
+	kmutex_t	pl_lock;
+	struct plimit *	pl_sv_limit;
+};
+
+/* add user profiling from AST XXXSMP */
+#define	ADDUPROF(l)							\
+	do {								\
+		struct proc *_p = (l)->l_proc;				\
+		addupc_task((l),					\
+		    _p->p_stats->p_prof.pr_addr,			\
+		    _p->p_stats->p_prof.pr_ticks);			\
+		_p->p_stats->p_prof.pr_ticks = 0;			\
+	} while (/* CONSTCOND */ 0)
+
+extern char defcorename[];
+
+extern int security_setidcore_dump;
+extern char security_setidcore_path[];
+extern uid_t security_setidcore_owner;
+extern gid_t security_setidcore_group;
+extern mode_t security_setidcore_mode;
+
+void	addupc_intr(struct lwp *, u_long);
+void	addupc_task(struct lwp *, u_long, u_int);
+void	calcru(struct proc *, struct timeval *, struct timeval *,
+	    struct timeval *, struct timeval *);
+
+struct plimit *lim_copy(struct plimit *);
+void	lim_addref(struct plimit *);
+void	lim_privatise(struct proc *);
+void	lim_setcorename(struct proc *, char *, size_t);
+void	lim_free(struct plimit *);
+
+void	resource_init(void);
+void	ruadd(struct rusage *, struct rusage *);
+void	rulwps(proc_t *, struct rusage *);
+struct	pstats *pstatscopy(struct pstats *);
+void	pstatsfree(struct pstats *);
+extern rlim_t maxdmap;
+extern rlim_t maxsmap;
+
+int	getrusage1(struct proc *, int, struct rusage *);
+
+#endif
+
+#endif	/* !_SYS_RESOURCEVAR_H_ */

Property changes on: lab4/.minix-src/include/sys/resourcevar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/shm.h
===================================================================
--- lab4/.minix-src/include/sys/shm.h	(nonexistent)
+++ lab4/.minix-src/include/sys/shm.h	(revision 13)
@@ -0,0 +1,227 @@
+/*	$NetBSD: shm.h,v 1.49 2015/05/13 01:16:15 pgoyette Exp $	*/
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1994 Adam Glass
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Adam Glass.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+/*
+ * As defined+described in "X/Open System Interfaces and Headers"
+ *                         Issue 4, p. XXX
+ */
+
+#ifndef _SYS_SHM_H_
+#define _SYS_SHM_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+#include <sys/ipc.h>
+
+#define	SHM_RDONLY	010000	/* Attach read-only (else read-write) */
+#define	SHM_RND		020000	/* Round attach address to SHMLBA */
+#ifdef _KERNEL
+#define _SHM_RMLINGER	040000	/* Attach even if segment removed */
+#endif
+
+/* Segment low boundry address multiple */
+#if defined(_KERNEL) || defined(_STANDALONE) || defined(_MODULE)
+#define	SHMLBA		PAGE_SIZE
+#else
+/*
+ * SHMLBA uses libc's internal __sysconf() to retrieve the machine's
+ * page size. The value of _SC_PAGESIZE is 28 -- we hard code it so we do not
+ * need to include unistd.h
+ */
+__BEGIN_DECLS
+long __sysconf(int);
+__END_DECLS
+#define	SHMLBA		(__sysconf(28))
+#endif
+
+typedef unsigned int	shmatt_t;
+
+struct shmid_ds {
+	struct ipc_perm	shm_perm;	/* operation permission structure */
+	size_t		shm_segsz;	/* size of segment in bytes */
+	pid_t		shm_lpid;	/* process ID of last shm operation */
+	pid_t		shm_cpid;	/* process ID of creator */
+	shmatt_t	shm_nattch;	/* number of current attaches */
+	time_t		shm_atime;	/* time of last shmat() */
+	time_t		shm_dtime;	/* time of last shmdt() */
+	time_t		shm_ctime;	/* time of last change by shmctl() */
+
+	/*
+	 * These members are private and used only in the internal
+	 * implementation of this interface.
+	 */
+	void		*_shm_internal;
+};
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Some systems (e.g. HP-UX) take these as the second (cmd) arg to shmctl().
+ */
+#define	SHM_LOCK	3	/* Lock segment in memory. */
+#define	SHM_UNLOCK	4	/* Unlock a segment locked by SHM_LOCK. */
+#endif /* _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Permission definitions used in shmflag arguments to shmat(2) and shmget(2).
+ * Provided for source compatibility only; do not use in new code!
+ */
+#define	SHM_R		IPC_R	/* S_IRUSR, R for owner */
+#define	SHM_W		IPC_W	/* S_IWUSR, W for owner */
+
+/*
+ * System 5 style catch-all structure for shared memory constants that
+ * might be of interest to user programs.  Do we really want/need this?
+ */
+struct shminfo {
+	uint64_t	shmmax;	/* max shared memory segment size (bytes) */
+	uint32_t	shmmin;	/* min shared memory segment size (bytes) */
+	uint32_t	shmmni;	/* max number of shared memory identifiers */
+	uint32_t	shmseg;	/* max shared memory segments per process */
+	uint32_t	shmall;	/* max amount of shared memory (pages) */
+};
+
+/* Warning: 64-bit structure padding is needed here */
+struct shmid_ds_sysctl {
+	struct		ipc_perm_sysctl shm_perm;
+	uint64_t	shm_segsz;
+	pid_t		shm_lpid;
+	pid_t		shm_cpid;
+	time_t		shm_atime;
+	time_t		shm_dtime;
+	time_t		shm_ctime;
+	uint32_t	shm_nattch;
+};
+struct shm_sysctl_info {
+	struct	shminfo shminfo;
+	struct	shmid_ds_sysctl shmids[1];
+};
+#endif /* _NETBSD_SOURCE */
+
+#ifdef _KERNEL
+extern struct shminfo shminfo;
+extern struct shmid_ds *shmsegs;
+extern int shm_nused;
+
+#define	SHMSEG_FREE		0x0200
+#define	SHMSEG_REMOVED		0x0400
+#define	SHMSEG_ALLOCATED	0x0800
+#define	SHMSEG_WANTED		0x1000
+#define	SHMSEG_RMLINGER		0x2000
+#define	SHMSEG_WIRED		0x4000
+
+struct vmspace;
+
+void	shminit(void);
+int	shmfini(void);
+void	shmfork(struct vmspace *, struct vmspace *);
+void	shmexit(struct vmspace *);
+int	shmctl1(struct lwp *, int, int, struct shmid_ds *);
+
+#define SYSCTL_FILL_SHM(src, dst) do { \
+	SYSCTL_FILL_PERM((src).shm_perm, (dst).shm_perm); \
+	(dst).shm_segsz = (src).shm_segsz; \
+	(dst).shm_lpid = (src).shm_lpid; \
+	(dst).shm_cpid = (src).shm_cpid; \
+	(dst).shm_atime = (src).shm_atime; \
+	(dst).shm_dtime = (src).shm_dtime; \
+	(dst).shm_ctime = (src).shm_ctime; \
+	(dst).shm_nattch = (src).shm_nattch; \
+} while (/*CONSTCOND*/ 0)
+
+#else /* !_KERNEL */
+
+__BEGIN_DECLS
+void	*shmat(int, const void *, int);
+int	shmctl(int, int, struct shmid_ds *) __RENAME(__shmctl50);
+int	shmdt(const void *);
+int	shmget(key_t, size_t, int);
+__END_DECLS
+
+#endif /* !_KERNEL */
+
+#if defined(__minix)
+/* ipcs ctl commands */
+#define SHM_STAT       13
+#define SHM_INFO       14
+
+struct shm_info
+{
+       int used_ids;
+       unsigned long int shm_tot;  /* total allocated shm */
+       unsigned long int shm_rss;  /* total resident shm */
+       unsigned long int shm_swp;  /* total swapped shm */
+       unsigned long int swap_attempts;
+       unsigned long int swap_successes;
+};
+
+#define SHMMNI 1024
+#define SHMSEG 32              /* max shared segs per process */
+
+/* Public shm_perm.mode flags, synchronized with NetBSD kernel values above */
+#define SHM_DEST	0x0400	/* destroy on last detach (SHMSEG_REMOVED) */
+#define SHM_LOCKED	0x4000	/* pages will not be swapped (SHMSEG_WIRED) */
+
+#endif /* defined(__minix) */
+
+#endif /* !_SYS_SHM_H_ */

Property changes on: lab4/.minix-src/include/sys/shm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/param.h
===================================================================
--- lab4/.minix-src/include/sys/param.h	(nonexistent)
+++ lab4/.minix-src/include/sys/param.h	(revision 13)
@@ -0,0 +1,496 @@
+/*	$NetBSD: param.h,v 1.486 2015/08/29 14:07:45 uebayasi Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)param.h	8.3 (Berkeley) 4/4/95
+ */
+
+#ifndef _SYS_PARAM_H_
+#define	_SYS_PARAM_H_
+
+#ifdef _KERNEL_OPT
+#include "opt_param.h"
+#endif
+
+/*
+ * Historic BSD #defines -- probably will remain untouched for all time.
+ */
+#define	BSD	199506		/* System version (year & month). */
+#define	BSD4_3	1
+#define	BSD4_4	1
+
+/*
+ *	#define __NetBSD_Version__ MMmmrrpp00
+ *
+ *	M = major version
+ *	m = minor version; a minor number of 99 indicates current.
+ *	r = 0 (*)
+ *	p = patchlevel
+ *
+ * When new releases are made, src/gnu/usr.bin/groff/tmac/mdoc.local
+ * needs to be updated and the changes sent back to the groff maintainers.
+ *
+ * (*)	Up to 2.0I "release" used to be "",A-Z,Z[A-Z] but numeric
+ *	    	e.g. NetBSD-1.2D  = 102040000 ('D' == 4)
+ *	NetBSD-2.0H 	(200080000) was changed on 20041001 to:
+ *	2.99.9		(299000900)
+ */
+
+#define	__NetBSD_Version__	799002100	/* NetBSD 7.99.21 */
+
+#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
+    (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
+
+/*
+ * Historical NetBSD #define
+ *
+ * NetBSD 1.4 was the last release for which this value was incremented.
+ * The value is now permanently fixed at 199905. It will never be
+ * changed again.
+ *
+ * New code must use __NetBSD_Version__ instead, and should not even
+ * count on NetBSD being defined.
+ *
+ */
+
+#define	NetBSD	199905		/* NetBSD version (year & month). */
+
+/*
+ * There macros determine if we are running in protected mode or not.
+ *   _HARDKERNEL: code uses kernel namespace and runs in hw priviledged mode
+ *   _SOFTKERNEL: code uses kernel namespace but runs without hw priviledges
+ */
+#if defined(_KERNEL) && !defined(_RUMPKERNEL)
+#define _HARDKERNEL
+#endif
+#if defined(_KERNEL) && defined(_RUMPKERNEL)
+#define _SOFTKERNEL
+#endif
+
+#include <sys/null.h>
+
+#ifndef __ASSEMBLER__
+#include <sys/inttypes.h>
+#include <sys/types.h>
+
+/*
+ * Machine-independent constants (some used in following include files).
+ * Redefined constants are from POSIX 1003.1 limits file.
+ *
+ * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
+ * MAXHOSTNAMELEN should be >= (_POSIX_HOST_NAME_MAX + 1) (see <limits.h>)
+ * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
+ */
+#include <sys/syslimits.h>
+
+#define	MAXCOMLEN	16		/* max command name remembered */
+#define	MAXINTERP	PATH_MAX	/* max interpreter file name length */
+/* DEPRECATED: use LOGIN_NAME_MAX instead. */
+#define	MAXLOGNAME	(LOGIN_NAME_MAX - 1) /* max login name length */
+#define	NCARGS		ARG_MAX		/* max bytes for an exec function */
+#define	NGROUPS		NGROUPS_MAX	/* max number groups */
+#define	NOGROUP		65535		/* marker for empty group set member */
+#define	MAXHOSTNAMELEN	256		/* max hostname size */
+
+#ifndef NOFILE
+#define	NOFILE		OPEN_MAX	/* max open files per process */
+#endif
+#ifndef MAXUPRC				/* max simultaneous processes */
+#define	MAXUPRC		CHILD_MAX	/* POSIX 1003.1-compliant default */
+#else
+#if (MAXUPRC - 0) < CHILD_MAX
+#error MAXUPRC less than CHILD_MAX.  See options(4) for details.
+#endif /* (MAXUPRC - 0) < CHILD_MAX */
+#endif /* !defined(MAXUPRC) */
+
+/* Macros for min/max. */
+#define	MIN(a,b)	((/*CONSTCOND*/(a)<(b))?(a):(b))
+#define	MAX(a,b)	((/*CONSTCOND*/(a)>(b))?(a):(b))
+
+/* More types and definitions used throughout the kernel. */
+#ifdef _KERNEL
+#include <sys/cdefs.h>
+#include <sys/errno.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/ucred.h>
+#include <sys/uio.h>
+#include <uvm/uvm_param.h>
+#ifndef NPROC
+#define	NPROC	(20 + 16 * MAXUSERS)
+#endif
+#ifndef NTEXT
+#define	NTEXT	(80 + NPROC / 8)		/* actually the object cache */
+#endif
+#ifndef NVNODE
+#define	NVNODE	(NPROC + NTEXT + 100)
+#define	NVNODE_IMPLICIT
+#endif
+#ifndef VNODE_KMEM_MAXPCT
+#define	VNODE_KMEM_MAXPCT	60
+#endif
+#ifndef BUFCACHE_VA_MAXPCT
+#define	BUFCACHE_VA_MAXPCT	20
+#endif
+#define	VNODE_COST	2048			/* assumed space in bytes */
+#endif /* _KERNEL */
+
+/* Signals. */
+#include <sys/signal.h>
+
+/* Machine type dependent parameters. */
+#include <machine/param.h>
+#include <machine/limits.h>
+
+/* pages ("clicks") to disk blocks */
+#define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
+#define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
+
+/* bytes to pages */
+#define	ctob(x)		((x) << PGSHIFT)
+#define	btoc(x)		(((x) + PGOFSET) >> PGSHIFT)
+
+/* bytes to disk blocks */
+#define	dbtob(x)	((x) << DEV_BSHIFT)
+#define	btodb(x)	((x) >> DEV_BSHIFT)
+
+#ifndef COHERENCY_UNIT
+#define	COHERENCY_UNIT		64
+#endif
+#ifndef CACHE_LINE_SIZE
+#define	CACHE_LINE_SIZE		64
+#endif
+#ifndef MAXCPUS
+#define	MAXCPUS			32
+#endif
+#ifndef MAX_LWP_PER_PROC
+#define	MAX_LWP_PER_PROC	8000
+#endif
+
+/*
+ * Stack macros.  On most architectures, the stack grows down,
+ * towards lower addresses; it is the rare architecture where
+ * it grows up, towards higher addresses.
+ *
+ * STACK_GROW and STACK_SHRINK adjust a stack pointer by some
+ * size, no questions asked.  STACK_ALIGN aligns a stack pointer.
+ *
+ * STACK_ALLOC returns a pointer to allocated stack space of
+ * some size; given such a pointer and a size, STACK_MAX gives
+ * the maximum (in the "maxsaddr" sense) stack address of the
+ * allocated memory.
+ */
+#if defined(_KERNEL) || defined(__EXPOSE_STACK)
+
+#ifndef STACK_ALIGNBYTES
+#define STACK_ALIGNBYTES	__ALIGNBYTES
+#endif
+
+#ifdef __MACHINE_STACK_GROWS_UP
+#define	STACK_GROW(sp, _size)		(((char *)(void *)(sp)) + (_size))
+#define	STACK_SHRINK(sp, _size)		(((char *)(void *)(sp)) - (_size))
+#define	STACK_ALIGN(sp, bytes)	\
+	((char *)((((unsigned long)(sp)) + (bytes)) & ~(bytes)))
+#define	STACK_ALLOC(sp, _size)		((char *)(void *)(sp))
+#define	STACK_MAX(p, _size)		(((char *)(void *)(p)) + (_size))
+#else
+#define	STACK_GROW(sp, _size)		(((char *)(void *)(sp)) - (_size))
+#define	STACK_SHRINK(sp, _size)		(((char *)(void *)(sp)) + (_size))
+#define	STACK_ALIGN(sp, bytes)	\
+	((char *)(((unsigned long)(sp)) & ~(bytes)))
+#define	STACK_ALLOC(sp, _size)		(((char *)(void *)(sp)) - (_size))
+#define	STACK_MAX(p, _size)		((char *)(void *)(p))
+#endif
+#define	STACK_LEN_ALIGN(len, bytes)	(((len) + (bytes)) & ~(bytes))
+
+#endif /* defined(_KERNEL) || defined(__EXPOSE_STACK) */
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value for all
+ * data types (int, long, ...).   The result is u_int and must be cast to
+ * any desired pointer type.
+ *
+ * ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ *
+ */
+#define ALIGNBYTES	__ALIGNBYTES
+#ifndef ALIGN
+#define	ALIGN(p)		(((uintptr_t)(p) + ALIGNBYTES) & ~ALIGNBYTES)
+#endif
+#ifndef ALIGNED_POINTER
+#define	ALIGNED_POINTER(p,t)	((((uintptr_t)(p)) & (sizeof(t) - 1)) == 0)
+#endif
+
+/*
+ * Historic priority levels.  These are meaningless and remain only
+ * for source compatibility.  Do not use in new code.
+ */
+#define	PSWP	0
+#define	PVM	4
+#define	PINOD	8
+#define	PRIBIO	16
+#define	PVFS	20
+#define	PZERO	22
+#define	PSOCK	24
+#define	PWAIT	32
+#define	PLOCK	36
+#define	PPAUSE	40
+#define	PUSER	50
+#define	MAXPRI	127
+
+#define	PCATCH		0x100	/* OR'd with pri for tsleep to check signals */
+#define	PNORELOCK	0x200	/* OR'd with pri for tsleep to not relock */
+
+/*
+ * New priority levels.
+ */
+#define	PRI_COUNT		224
+#define	PRI_NONE		(-1)
+
+#define	PRI_KERNEL_RT		192
+#define	NPRI_KERNEL_RT		32
+#define	MAXPRI_KERNEL_RT	(PRI_KERNEL_RT + NPRI_KERNEL_RT - 1)
+
+#define	PRI_USER_RT		128
+#define	NPRI_USER_RT		64
+#define	MAXPRI_USER_RT		(PRI_USER_RT + NPRI_USER_RT - 1)
+
+#define	PRI_KTHREAD		96
+#define	NPRI_KTHREAD		32
+#define	MAXPRI_KTHREAD		(PRI_KTHREAD + NPRI_KTHREAD - 1)
+
+#define	PRI_KERNEL		64
+#define	NPRI_KERNEL		32
+#define	MAXPRI_KERNEL		(PRI_KERNEL + NPRI_KERNEL - 1)
+
+#define	PRI_USER		0
+#define	NPRI_USER		64
+#define	MAXPRI_USER		(PRI_USER + NPRI_USER - 1)
+
+/* Priority range used by POSIX real-time features */
+#define	SCHED_PRI_MIN		0
+#define	SCHED_PRI_MAX		63
+
+/*
+ * Kernel thread priorities.
+ */
+#define	PRI_SOFTSERIAL	MAXPRI_KERNEL_RT
+#define	PRI_SOFTNET	(MAXPRI_KERNEL_RT - schedppq * 1)
+#define	PRI_SOFTBIO	(MAXPRI_KERNEL_RT - schedppq * 2)
+#define	PRI_SOFTCLOCK	(MAXPRI_KERNEL_RT - schedppq * 3)
+
+#define	PRI_XCALL	MAXPRI_KTHREAD
+#define	PRI_PGDAEMON	(MAXPRI_KTHREAD - schedppq * 1)
+#define	PRI_VM		(MAXPRI_KTHREAD - schedppq * 2)
+#define	PRI_IOFLUSH	(MAXPRI_KTHREAD - schedppq * 3)
+#define	PRI_BIO		(MAXPRI_KTHREAD - schedppq * 4)
+
+#define	PRI_IDLE	PRI_USER
+
+/*
+ * Miscellaneous.
+ */
+#define	NBPW	sizeof(int)	/* number of bytes per word (integer) */
+
+#define	CMASK	022		/* default file mask: S_IWGRP|S_IWOTH */
+#define	NODEV	(dev_t)(-1)	/* non-existent device */
+
+/*
+ * File system parameters and macros.
+ *
+ * The file system is made out of blocks of at most MAXBSIZE units, with
+ * smaller units (fragments) only in the last direct block.  MAXBSIZE
+ * primarily determines the size of buffers in the buffer pool.  It may be
+ * made larger without any effect on existing file systems; however making
+ * it smaller may make some file systems unmountable.
+ */
+#ifndef MAXBSIZE				/* XXX */
+#define	MAXBSIZE	MAXPHYS
+#endif
+#define	MAXFRAG 	8
+
+/*
+ * MAXPATHLEN defines the longest permissible path length after expanding
+ * symbolic links. It is used to allocate a temporary buffer from the buffer
+ * pool in which to do the name expansion, hence should be a power of two,
+ * and must be less than or equal to MAXBSIZE.  MAXSYMLINKS defines the
+ * maximum number of symbolic links that may be expanded in a path name.
+ * It should be set high enough to allow all legitimate uses, but halt
+ * infinite loops reasonably quickly.
+ *
+ * MAXSYMLINKS should be >= _POSIX_SYMLOOP_MAX (see <limits.h>)
+ */
+#define	MAXPATHLEN	PATH_MAX
+#define	MAXSYMLINKS	32
+
+/*
+ * This is the maximum individual filename component length enforced by
+ * namei. Filesystems cannot exceed this limit. The upper bound for that
+ * limit is NAME_MAX. We don't bump it for now, for compatibility with
+ * old binaries during the time where MAXPATHLEN was 511 and NAME_MAX was
+ * 255
+ */
+#define	KERNEL_NAME_MAX	255
+
+/* Bit map related macros. */
+#define	setbit(a,i)	((a)[(i)/NBBY] |= 1<<((i)%NBBY))
+#define	clrbit(a,i)	((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
+#define	isset(a,i)	((a)[(i)/NBBY] & (1<<((i)%NBBY)))
+#define	isclr(a,i)	(((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
+
+/* Macros for counting and rounding. */
+#ifndef howmany
+#define	howmany(x, y)	(((x)+((y)-1))/(y))
+#endif
+#define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))
+#define	rounddown(x,y)	(((x)/(y))*(y))
+
+/*
+ * Rounding to powers of two.  The naive definitions of roundup2 and
+ * rounddown2,
+ *
+ *	#define	roundup2(x,m)	(((x) + ((m) - 1)) & ~((m) - 1))
+ *	#define	rounddown2(x,m)	((x) & ~((m) - 1)),
+ *
+ * exhibit a quirk of integer arithmetic in C because the complement
+ * happens in the type of m, not in the type of x.  So if unsigned int
+ * is 32-bit, and m is an unsigned int while x is a uint64_t, then
+ * roundup2 and rounddown2 would have the unintended effect of clearing
+ * the upper 32 bits of the result(!).  These definitions avoid the
+ * pitfalls of C arithmetic depending on the types of x and m, and
+ * additionally avoid multiply evaluating their arguments.
+ */
+#define	roundup2(x,m)	((((x) - 1) | ((m) - 1)) + 1)
+#define	rounddown2(x,m)	((x) & ~((__typeof__(x))((m) - 1)))
+
+#define	powerof2(x)	((((x)-1)&(x))==0)
+
+/*
+ * Constants for setting the parameters of the kernel memory allocator.
+ *
+ * 2 ** MINBUCKET is the smallest unit of memory that will be
+ * allocated. It must be at least large enough to hold a pointer.
+ *
+ * Units of memory less or equal to MAXALLOCSAVE will permanently
+ * allocate physical memory; requests for these size pieces of
+ * memory are quite fast. Allocations greater than MAXALLOCSAVE must
+ * always allocate and free physical memory; requests for these
+ * size allocations should be done infrequently as they will be slow.
+ *
+ * Constraints: NBPG <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and
+ * MAXALLOCSAVE must be a power of two.
+ */
+#ifdef _LP64
+#define	MINBUCKET	5		/* 5 => min allocation of 32 bytes */
+#else
+#define	MINBUCKET	4		/* 4 => min allocation of 16 bytes */
+#endif
+#define	MAXALLOCSAVE	(2 * NBPG)
+
+/*
+ * Scale factor for scaled integers used to count %cpu time and load avgs.
+ *
+ * The number of CPU `tick's that map to a unique `%age' can be expressed
+ * by the formula (1 / (2 ^ (FSHIFT - 11))).  The maximum load average that
+ * can be calculated (assuming 32 bits) can be closely approximated using
+ * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).
+ *
+ * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',
+ * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.
+ */
+#define	FSHIFT	11		/* bits to right of fixed binary point */
+#define	FSCALE	(1<<FSHIFT)
+
+/*
+ * The time for a process to be blocked before being very swappable.
+ * This is a number of seconds which the system takes as being a non-trivial
+ * amount of real time.  You probably shouldn't change this;
+ * it is used in subtle ways (fractions and multiples of it are, that is, like
+ * half of a ``long time'', almost a long time, etc.)
+ * It is related to human patience and other factors which don't really
+ * change over time.
+ */
+#define        MAXSLP          20
+
+/*
+ * Defaults for Unified Buffer Cache parameters.
+ * These may be overridden in <machine/param.h>.
+ */
+
+#ifndef UBC_WINSHIFT
+#define	UBC_WINSHIFT	13
+#endif
+#ifndef UBC_NWINS
+#define	UBC_NWINS	1024
+#endif
+
+#ifdef _KERNEL
+/*
+ * macro to convert from milliseconds to hz without integer overflow
+ * Default version using only 32bits arithmetics.
+ * 64bit port can define 64bit version in their <machine/param.h>
+ * 0x20000 is safe for hz < 20000
+ */
+#ifndef mstohz
+#define mstohz(ms) \
+	(__predict_false((ms) >= 0x20000) ? \
+	    ((ms +0u) / 1000u) * hz : \
+	    ((ms +0u) * hz) / 1000u)
+#endif
+#ifndef hztoms
+#define hztoms(t) \
+	(__predict_false((t) >= 0x20000) ? \
+	    ((t +0u) / hz) * 1000u : \
+	    ((t +0u) * 1000u) / hz)
+#endif
+
+extern const int schedppq;
+extern size_t coherency_unit;
+
+#endif /* _KERNEL */
+
+/*
+ * Minimum alignment of "struct lwp" needed by the architecture.
+ * This counts when packing a lock byte into a word alongside a
+ * pointer to an LWP.
+ */
+#ifndef MIN_LWP_ALIGNMENT
+#define	MIN_LWP_ALIGNMENT	32
+#endif
+#endif /* !__ASSEMBLER__ */
+
+#endif /* !_SYS_PARAM_H_ */

Property changes on: lab4/.minix-src/include/sys/param.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/scanio.h
===================================================================
--- lab4/.minix-src/include/sys/scanio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/scanio.h	(revision 13)
@@ -0,0 +1,132 @@
+/*	$NetBSD: scanio.h,v 1.3 2015/09/06 06:01:02 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1995 Kenneth Stailey.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by Kenneth Stailey.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+/*
+ * Definitions for PINT scanner drivers
+ */
+
+#ifndef _SYS_SCANIO_H_
+#define _SYS_SCANIO_H_
+
+#include <sys/ioccom.h>
+
+/*
+ * XXX scancap make this sort of obsolete:
+ *
+ * Some comments about the values in the scan_io struct:
+ *
+ * All user-changeable values have minimum and maximum values for
+ * specific scanner types and are rejected by the special drivers if
+ * they are not in range. For values in the range, the driver selects
+ * the next physically possible setting for the particular scanner.
+ * So it is good practice to issue a SCIOCGET after a SCIOCSET to see
+ * what the driver has chosen.
+ *
+ * Brightness and contrast default to 100 (%) but scanners may support
+ * higher and/or lower values, though the maximum value is 255.
+ * velocity is the scan speed and defaults to 100 (%), only slower
+ * values may be possible.
+ */
+
+struct scan_io {
+	u_long	scan_width;		 /* width in 1/1200ths of an inch */
+	u_long	scan_height;		 /* height in 1/1200ths of an inch */
+#ifdef SCAN_BC
+# define scan_window_width scan_width
+# define scan_window_length scan_height
+#endif
+	u_short	scan_x_resolution;	/* horizontal resolution in dots-per-inch */
+	u_short	scan_y_resolution;	/* vertical resolution in dots-per-inch */
+	u_long	scan_x_origin;		/* horizontal coordinate of upper left corner */
+	u_long	scan_y_origin;		/* vertical coordinate of upper left corner */
+	u_char	scan_image_mode;	/* type of image data sent by scanner */
+	u_char	scan_brightness;	/* brightness control for those to can do it */
+	u_char	scan_contrast;		/* contrast control for those to can do it */
+	u_char	scan_quality;		/* speed of scan for instance */
+#ifdef SCAN_BC
+# define scan_velocity scan_quality
+#endif
+	u_long	scan_window_size;	/* size of window in bytes (ro) */
+	u_long	scan_lines;		/* number of pixels per column (ro) */
+	u_long	scan_pixels_per_line;	/* number of pixels per line (ro) */
+	u_short	scan_bits_per_pixel;	/* number of bits per pixel (ro) */
+	u_char	scan_scanner_type;	/* type of scanner (ro) */
+};
+
+/*
+ * defines for different commands
+ */
+
+#define SCIOCGET	_IOR('S', 1, struct scan_io) /* retrieve parameters */
+#define SCIOCSET	_IOW('S', 2, struct scan_io) /* set parameters */
+#define SCIOCRESTART	_IO('S', 3) /* restart scan */
+#define SCIOC_USE_ADF	_IO('S', 4) /* use ADF as paper source for next scan */
+				    /* even after close() */
+#ifdef SCAN_BC
+# define SCAN_GET	SCIOCGET
+# define SCAN_SET	SCIOCSET
+# define SCAN_REWIND	SCIOCRESTART
+# define SCAN_USE_ADF	SCIOC_USE_ADF
+#endif
+
+/*
+ * defines for scan_image_mode field
+ */
+
+#define SIM_BINARY_MONOCHROME	0
+#define SIM_DITHERED_MONOCHROME	1
+#define SIM_GRAYSCALE		2
+#define SIM_COLOR		5
+#define SIM_RED			103
+#define SIM_GREEN		104
+#define SIM_BLUE		105
+
+/*
+ * defines for different types of scanners & product names as comments
+ */
+
+#define RICOH_IS410	1	/* Ricoh IS-410 */
+#define FUJITSU_M3096G	2	/* Fujitsu M3096G */
+#ifdef SCAN_BC
+# define FUJITSU	2	/* Fujitsu M3096G (deprecated) */
+#endif
+#define HP_SCANJET_IIC	3	/* HP ScanJet IIc */
+#define RICOH_FS1	4	/* Ricoh FS1 */
+#define SHARP_JX600	5	/* Sharp JX600 */
+#define RICOH_IS50	6	/* Ricoh IS-50 */
+#define IBM_2456	7	/* IBM 2456 */
+#define UMAX_UC630	8	/* UMAX UC630 */
+#define UMAX_UG630	9	/* UMAX UG630 */
+#define MUSTEK_06000CX	10	/* Mustek MFS06000CX */
+#define MUSTEK_12000CX	11	/* Mustek MFS12000CX */
+#define EPSON_ES300C	12	/* epson es300c */
+
+#endif /* _SYS_SCANIO_H_ */

Property changes on: lab4/.minix-src/include/sys/scanio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/scsiio.h
===================================================================
--- lab4/.minix-src/include/sys/scsiio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/scsiio.h	(revision 13)
@@ -0,0 +1,112 @@
+/*     $NetBSD: scsiio.h,v 1.12 2007/03/04 06:03:41 christos Exp $        */
+
+#ifndef _SYS_SCSIIO_H_
+#define _SYS_SCSIIO_H_
+
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#define	SENSEBUFLEN 48
+
+typedef struct	scsireq {
+	u_long	flags;		/* info about the request status and type */
+	u_long	timeout;
+	u_char	cmd[16];	/* 12 is actually the max */
+	u_char	cmdlen;
+	void *	databuf;	/* address in user space of buffer */
+	u_long	datalen;	/* size of user buffer (request) */
+	u_long	datalen_used;	/* size of user buffer (used)*/
+	u_char	sense[SENSEBUFLEN]; /* returned sense will be in here */
+	u_char	senselen;	/* sensedata request size (MAX of SENSEBUFLEN)*/
+	u_char	senselen_used;	/* return value only */
+	u_char	status;		/* what the scsi status was from the adapter */
+	u_char	retsts;		/* the return status for the command */
+	int	error;		/* error bits */
+} scsireq_t;
+
+/* bit definitions for flags */
+#define SCCMD_READ		0x00000001
+#define SCCMD_WRITE		0x00000002
+#define SCCMD_IOV		0x00000004
+#define SCCMD_ESCAPE		0x00000010
+#define SCCMD_TARGET		0x00000020
+
+
+/* definitions for the return status (retsts) */
+#define SCCMD_OK	0x00
+#define SCCMD_TIMEOUT	0x01
+#define SCCMD_BUSY	0x02
+#define SCCMD_SENSE	0x03
+#define SCCMD_UNKNOWN	0x04
+
+#define SCIOCCOMMAND	_IOWR('Q', 1, scsireq_t)
+
+#define SC_DB_CMDS	0x00000001	/* show all scsi cmds and errors */
+#define SC_DB_FLOW	0x00000002	/* show routines entered	*/
+#define SC_DB_FLOW2	0x00000004	/* show path INSIDE routines	*/
+#define SC_DB_DMA	0x00000008	/* show DMA segments etc	*/
+#define SCIOCDEBUG	_IOW('Q', 2, int)	/* from 0 to 15 */
+
+struct	oscsi_addr {
+	int	scbus;		/* -1 if wildcard */
+	int	target;		/* -1 if wildcard */
+	int	lun;		/* -1 if wildcard */
+};
+
+struct	scsi_addr {
+	int type;       /* bus type */
+#define TYPE_SCSI 0
+#define TYPE_ATAPI 1
+	union {
+		struct oscsi_addr scsi;
+		struct _atapi {
+			int atbus;  /* -1 if wildcard */
+			int drive;  /* -1 if wildcard */
+		} atapi;
+	} addr;
+};
+
+/*
+ * SCSI device ioctls
+ */
+
+#define SCIOCIDENTIFY	_IOR('Q', 4, struct scsi_addr) /* where are you? */
+#define  OSCIOCIDENTIFY	_IOR('Q', 4, struct oscsi_addr)
+#define SCIOCDECONFIG	_IO('Q', 5)	/* please disappear */
+#define SCIOCRECONFIG	_IO('Q', 6)	/* please check again */
+#define SCIOCRESET	_IO('Q', 7)	/* reset the device */
+
+/*
+ * SCSI bus ioctls
+ */
+
+/* Scan bus for new devices. */
+struct scbusioscan_args {
+	int	sa_target;	/* target to scan; -1 for wildcard */
+	int	sa_lun;		/* lun to scan; -1 for wildcard */
+};
+#define	SCBUSIOSCAN	_IOW('U', 0, struct scbusioscan_args)
+
+#define	SCBUSIORESET	_IO('U', 1)	/* reset SCSI bus */
+
+struct scbusiodetach_args {
+	int	sa_target;	/* target to scan; -1 for wildcard */
+	int	sa_lun;		/* lun to scan; -1 for wildcard */
+};
+#define	SCBUSIODETACH	_IOW('U', 2, struct scbusiodetach_args)
+
+/* enable/disable device properties */
+struct scbusaccel_args {
+	int	sa_target;	/* target to set property on */
+	int	sa_lun;		/* lun to set property on */
+	int	sa_flags;	/* flags to set or clear */
+};
+#define	SC_ACCEL_SYNC	0x01	/* enable sync mode */
+#define	SC_ACCEL_WIDE	0x02	/* enable wide transfers */
+#define	SC_ACCEL_TAGS	0x04	/* enable tagged queuing */
+#define	SCBUSACCEL	_IOW('U', 2, struct scbusaccel_args)
+
+#define	SCBUSIOLLSCAN	_IO('U', 3)	/* perform low-level scan */
+
+#endif /* _SYS_SCSIIO_H_ */

Property changes on: lab4/.minix-src/include/sys/scsiio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/select.h
===================================================================
--- lab4/.minix-src/include/sys/select.h	(nonexistent)
+++ lab4/.minix-src/include/sys/select.h	(revision 13)
@@ -0,0 +1,77 @@
+/*	$NetBSD: select.h,v 1.37 2014/04/25 15:52:45 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)select.h	8.2 (Berkeley) 1/4/94
+ */
+
+#ifndef _SYS_SELECT_H_
+#define	_SYS_SELECT_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/fd_set.h>
+
+#ifdef _KERNEL
+#include <sys/selinfo.h>		/* for struct selinfo */
+#include <sys/signal.h>			/* for sigset_t */
+
+struct lwp;
+struct proc;
+struct timespec;
+struct cpu_info;
+struct socket;
+
+int	selcommon(register_t *, int, fd_set *, fd_set *, fd_set *,
+    struct timespec *, sigset_t *);
+void	selrecord(struct lwp *selector, struct selinfo *);
+void	selnotify(struct selinfo *, int, long);
+void	selsysinit(struct cpu_info *);
+void	selinit(struct selinfo *);
+void	seldestroy(struct selinfo *);
+
+#else /* _KERNEL */
+
+#include <sys/sigtypes.h>
+#include <time.h>
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+#if !defined(__minix)
+int	pselect(int, fd_set * __restrict, fd_set * __restrict,
+    fd_set * __restrict, const struct timespec * __restrict,
+    const sigset_t * __restrict) __RENAME(__pselect50);
+#endif /* !defined(__minix) */
+int	select(int, fd_set * __restrict, fd_set * __restrict,
+    fd_set * __restrict, struct timeval * __restrict) __RENAME(__select50);
+#endif /* __LIBC12_SOURCE__ */
+__END_DECLS
+#endif /* _KERNEL */
+
+#endif /* !_SYS_SELECT_H_ */

Property changes on: lab4/.minix-src/include/sys/select.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/sem.h
===================================================================
--- lab4/.minix-src/include/sys/sem.h	(nonexistent)
+++ lab4/.minix-src/include/sys/sem.h	(revision 13)
@@ -0,0 +1,244 @@
+/*	$NetBSD: sem.h,v 1.31 2015/05/13 01:16:15 pgoyette Exp $	*/
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * SVID compatible sem.h file
+ *
+ * Author: Daniel Boulet
+ */
+
+#ifndef _SYS_SEM_H_
+#define _SYS_SEM_H_
+
+#include <sys/featuretest.h>
+
+#include <sys/ipc.h>
+
+#ifdef _KERNEL
+struct __sem {
+	unsigned short	semval;		/* semaphore value */
+	pid_t		sempid;		/* pid of last operation */
+	unsigned short	semncnt;	/* # awaiting semval > cval */
+	unsigned short	semzcnt;	/* # awaiting semval = 0 */
+};
+#endif /* _KERNEL */
+
+struct semid_ds {
+	struct ipc_perm	sem_perm;	/* operation permission structure */
+	unsigned short	sem_nsems;	/* number of semaphores in set */
+	time_t		sem_otime;	/* last semop() time */
+	time_t		sem_ctime;	/* last time changed by semctl() */
+
+	/*
+	 * These members are private and used only in the internal
+	 * implementation of this interface.
+	 */
+	struct __sem	*_sem_base;	/* pointer to first semaphore in set */
+};
+
+/*
+ * semop's sops parameter structure
+ */
+struct sembuf {
+	unsigned short	sem_num;	/* semaphore # */
+	short		sem_op;		/* semaphore operation */
+	short		sem_flg;	/* operation flags */
+};
+#define SEM_UNDO	010000		/* undo changes on process exit */
+
+/*
+ * commands for semctl
+ */
+#define GETNCNT	3	/* Return the value of semncnt {READ} */
+#define GETPID	4	/* Return the value of sempid {READ} */
+#define GETVAL	5	/* Return the value of semval {READ} */
+#define GETALL	6	/* Return semvals into arg.array {READ} */
+#define GETZCNT	7	/* Return the value of semzcnt {READ} */
+#define SETVAL	8	/* Set the value of semval to arg.val {ALTER} */
+#define SETALL	9	/* Set semvals from arg.array {ALTER} */
+
+#if defined(_KERNEL) || defined(__minix)
+/*
+ * Kernel implementation stuff
+ */
+#define SEMVMX	32767		/* semaphore maximum value */
+#define SEMAEM	16384		/* adjust on exit max value */
+
+/*
+ * Permissions
+ */
+#define SEM_A		0200	/* alter permission */
+#define SEM_R		0400	/* read permission */
+
+/*
+ * Undo structure (one per process)
+ */
+struct sem_undo_entry {
+	short	un_adjval;	/* adjust on exit values */
+	short	un_num;		/* semaphore # */
+	int	un_id;		/* semid */
+};
+
+struct sem_undo {
+	struct	sem_undo *un_next;	/* ptr to next active undo structure */
+	struct	proc *un_proc;		/* owner of this structure */
+	short	un_cnt;			/* # of active entries */
+	struct	sem_undo_entry un_ent[1];/* undo entries */
+};
+#endif /* _KERNEL */
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * semaphore info struct
+ */
+struct seminfo {
+	int32_t	semmap;		/* # of entries in semaphore map */
+	int32_t	semmni;		/* # of semaphore identifiers */
+	int32_t	semmns;		/* # of semaphores in system */
+	int32_t	semmnu;		/* # of undo structures in system */
+	int32_t	semmsl;		/* max # of semaphores per id */
+	int32_t	semopm;		/* max # of operations per semop call */
+	int32_t	semume;		/* max # of undo entries per process */
+	int32_t	semusz;		/* size in bytes of undo structure */
+	int32_t	semvmx;		/* semaphore maximum value */
+	int32_t	semaem;		/* adjust on exit max value */
+};
+
+/* Warning: 64-bit structure padding is needed here */
+struct semid_ds_sysctl {
+	struct	ipc_perm_sysctl sem_perm;
+	int16_t	sem_nsems;
+	int16_t	pad2;
+	int32_t	pad3;
+	time_t	sem_otime;
+	time_t	sem_ctime;
+};
+struct sem_sysctl_info {
+	struct	seminfo seminfo;
+	struct	semid_ds_sysctl semids[1];
+};
+
+/*
+ * Internal "mode" bits.  The first of these is used by ipcs(1), and so
+ * is defined outside the kernel as well.
+ */
+#define	SEM_ALLOC	01000	/* semaphore is allocated */
+#endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */
+
+#if defined(_KERNEL) || defined(__minix)
+#define	SEM_DEST	02000	/* semaphore will be destroyed on last detach */
+
+/*
+ * Configuration parameters
+ */
+#ifndef SEMMNI
+#define SEMMNI	10		/* # of semaphore identifiers */
+#endif
+#ifndef SEMMNS
+#define SEMMNS	60		/* # of semaphores in system */
+#endif
+#ifndef SEMUME
+#define SEMUME	10		/* max # of undo entries per process */
+#endif
+#ifndef SEMMNU
+#define SEMMNU	30		/* # of undo structures in system */
+#endif
+
+/* shouldn't need tuning */
+#ifndef SEMMAP
+#define SEMMAP	30		/* # of entries in semaphore map */
+#endif
+#ifndef SEMMSL
+#define SEMMSL	SEMMNS		/* max # of semaphores per id */
+#endif
+#ifndef SEMOPM
+#define SEMOPM	100		/* max # of operations per semop call */
+#endif
+
+/* actual size of an undo structure */
+#define SEMUSZ	(sizeof(struct sem_undo)+sizeof(struct sem_undo_entry)*SEMUME)
+
+#ifndef __minix
+/*
+ * Structures allocated in machdep.c
+ */
+extern struct seminfo seminfo;
+extern struct semid_ds *sema;		/* semaphore id pool */
+#endif /* !__minix */
+
+/*
+ * Parameters to the semconfig system call
+ */
+#define	SEM_CONFIG_FREEZE	0	/* Freeze the semaphore facility. */
+#define	SEM_CONFIG_THAW		1	/* Thaw the semaphore facility. */
+
+#define SYSCTL_FILL_SEM(src, dst) do { \
+	SYSCTL_FILL_PERM((src).sem_perm, (dst).sem_perm); \
+	(dst).sem_nsems = (src).sem_nsems; \
+	(dst).sem_otime = (src).sem_otime; \
+	(dst).sem_ctime = (src).sem_ctime; \
+} while (/*CONSTCOND*/ 0)
+
+#endif /* _KERNEL */
+
+#if defined(__minix)
+/* ipcs ctl cmds */
+# define SEM_STAT 18
+# define SEM_INFO 19
+#endif /* defined(__minix) */
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+int	semctl(int, int, int, ...) __RENAME(__semctl50);
+#endif
+int	semget(key_t, int, int);
+int	semop(int, struct sembuf *, size_t);
+#if defined(_NETBSD_SOURCE)
+int	semconfig(int);
+#endif
+__END_DECLS
+#else
+void	seminit(void);
+int	semfini(void);
+void	semexit(struct proc *, void *);
+
+int	semctl1(struct lwp *, int, int, int, void *, register_t *);
+#define get_semctl_arg(cmd, sembuf, arg) \
+    ((cmd) == IPC_SET || (cmd) == IPC_STAT ? (void *)sembuf \
+    : (cmd) == GETALL || (cmd) == SETVAL || (cmd) == SETALL ? (void *)arg \
+    : NULL)
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_SEM_H_ */

Property changes on: lab4/.minix-src/include/sys/sem.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/sigtypes.h
===================================================================
--- lab4/.minix-src/include/sys/sigtypes.h	(nonexistent)
+++ lab4/.minix-src/include/sys/sigtypes.h	(revision 13)
@@ -0,0 +1,122 @@
+/*	$NetBSD: sigtypes.h,v 1.10 2012/02/19 21:07:00 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)signal.h	8.4 (Berkeley) 5/4/95
+ */
+
+#ifndef	_SYS_SIGTYPES_H_
+#define	_SYS_SIGTYPES_H_
+
+/*
+ * This header file defines various signal-related types.  We also keep
+ * the macros to manipulate sigset_t here, to encapsulate knowledge of
+ * its internals.
+ */
+
+#include <sys/featuretest.h>
+#include <machine/int_types.h>
+#include <machine/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+
+typedef struct {
+	__uint32_t	__bits[4];
+} sigset_t;
+
+/*
+ * Macro for manipulating signal masks.
+ */
+#define __sigmask(n)		(1 << (((unsigned int)(n) - 1) & 31))
+#define	__sigword(n)		(((unsigned int)(n) - 1) >> 5)
+#define	__sigaddset(s, n)	((s)->__bits[__sigword(n)] |= __sigmask(n))
+#define	__sigdelset(s, n)	((s)->__bits[__sigword(n)] &= ~__sigmask(n))
+#define	__sigismember(s, n)	(((s)->__bits[__sigword(n)] & __sigmask(n)) != 0)
+#define	__sigemptyset(s)	((s)->__bits[0] = 0x00000000, \
+				 (s)->__bits[1] = 0x00000000, \
+				 (s)->__bits[2] = 0x00000000, \
+				 (s)->__bits[3] = 0x00000000)
+#define __sigsetequal(s1,s2)	((s1)->__bits[0] == (s2)->__bits[0] && \
+				 (s1)->__bits[1] == (s2)->__bits[1] && \
+				 (s1)->__bits[2] == (s2)->__bits[2] && \
+				 (s1)->__bits[3] == (s2)->__bits[3])
+#define	__sigfillset(s)		((s)->__bits[0] = 0xffffffff, \
+				 (s)->__bits[1] = 0xffffffff, \
+				 (s)->__bits[2] = 0xffffffff, \
+				 (s)->__bits[3] = 0xffffffff)
+#define	__sigplusset(s, t) \
+	do {						\
+		(t)->__bits[0] |= (s)->__bits[0];	\
+		(t)->__bits[1] |= (s)->__bits[1];	\
+		(t)->__bits[2] |= (s)->__bits[2];	\
+		(t)->__bits[3] |= (s)->__bits[3];	\
+	} while (/* CONSTCOND */ 0)
+#define	__sigminusset(s, t) \
+	do {						\
+		(t)->__bits[0] &= ~(s)->__bits[0];	\
+		(t)->__bits[1] &= ~(s)->__bits[1];	\
+		(t)->__bits[2] &= ~(s)->__bits[2];	\
+		(t)->__bits[3] &= ~(s)->__bits[3];	\
+	} while (/* CONSTCOND */ 0)
+#define	__sigandset(s, t) \
+	do {						\
+		(t)->__bits[0] &= (s)->__bits[0];	\
+		(t)->__bits[1] &= (s)->__bits[1];	\
+		(t)->__bits[2] &= (s)->__bits[2];	\
+		(t)->__bits[3] &= (s)->__bits[3];	\
+	} while (/* CONSTCOND */ 0)
+
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+typedef struct
+#if defined(_NETBSD_SOURCE)
+               sigaltstack
+#endif /* _NETBSD_SOURCE */
+			   {
+	void	*ss_sp;			/* signal stack base */
+	size_t	ss_size;		/* signal stack length */
+	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
+} stack_t;
+
+#endif /* _XOPEN_SOURCE_EXTENDED || XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+
+#endif	/* _POSIX_C_SOURCE || _XOPEN_SOURCE || ... */
+
+#endif	/* !_SYS_SIGTYPES_H_ */

Property changes on: lab4/.minix-src/include/sys/sigtypes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/sha2.h
===================================================================
--- lab4/.minix-src/include/sys/sha2.h	(nonexistent)
+++ lab4/.minix-src/include/sys/sha2.h	(revision 13)
@@ -0,0 +1,120 @@
+/*	$NetBSD: sha2.h,v 1.3 2009/05/26 08:04:12 joerg Exp $	*/
+/*	$KAME: sha2.h,v 1.4 2003/07/20 00:28:38 itojun Exp $	*/
+
+/*
+ * sha2.h
+ *
+ * Version 1.0.0beta1
+ *
+ * Written by Aaron D. Gifford <me@aarongifford.com>
+ *
+ * Copyright 2000 Aaron D. Gifford.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``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(S) OR CONTRIBUTOR(S) BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef __SHA2_H__
+#define __SHA2_H__
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+
+/*** SHA-224/256/384/512 Various Length Definitions ***********************/
+#define SHA224_BLOCK_LENGTH		64
+#define SHA224_DIGEST_LENGTH		28
+#define SHA224_DIGEST_STRING_LENGTH	(SHA224_DIGEST_LENGTH * 2 + 1)
+#define SHA256_BLOCK_LENGTH		64
+#define SHA256_DIGEST_LENGTH		32
+#define SHA256_DIGEST_STRING_LENGTH	(SHA256_DIGEST_LENGTH * 2 + 1)
+#define SHA384_BLOCK_LENGTH		128
+#define SHA384_DIGEST_LENGTH		48
+#define SHA384_DIGEST_STRING_LENGTH	(SHA384_DIGEST_LENGTH * 2 + 1)
+#define SHA512_BLOCK_LENGTH		128
+#define SHA512_DIGEST_LENGTH		64
+#define SHA512_DIGEST_STRING_LENGTH	(SHA512_DIGEST_LENGTH * 2 + 1)
+
+
+/*** SHA-256/384/512 Context Structures *******************************/
+typedef struct _SHA256_CTX {
+	uint32_t	state[8];
+	uint64_t	bitcount;
+	uint8_t	buffer[SHA256_BLOCK_LENGTH];
+} SHA256_CTX;
+
+typedef struct _SHA512_CTX {
+	uint64_t	state[8];
+	uint64_t	bitcount[2];
+	uint8_t	buffer[SHA512_BLOCK_LENGTH];
+} SHA512_CTX;
+
+typedef SHA256_CTX SHA224_CTX;
+typedef SHA512_CTX SHA384_CTX;
+
+
+/*** SHA-256/384/512 Function Prototypes ******************************/
+__BEGIN_DECLS
+int SHA224_Init(SHA224_CTX *);
+int SHA224_Update(SHA224_CTX*, const uint8_t*, size_t);
+int SHA224_Final(uint8_t[SHA224_DIGEST_LENGTH], SHA224_CTX*);
+#ifndef _KERNEL
+char *SHA224_End(SHA224_CTX *, char[SHA224_DIGEST_STRING_LENGTH]);
+char *SHA224_FileChunk(const char *, char *, off_t, off_t);
+char *SHA224_File(const char *, char *);
+char *SHA224_Data(const uint8_t *, size_t, char[SHA224_DIGEST_STRING_LENGTH]);
+#endif /* !_KERNEL */
+
+int SHA256_Init(SHA256_CTX *);
+int SHA256_Update(SHA256_CTX*, const uint8_t*, size_t);
+int SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
+#ifndef _KERNEL
+char *SHA256_End(SHA256_CTX *, char[SHA256_DIGEST_STRING_LENGTH]);
+char *SHA256_FileChunk(const char *, char *, off_t, off_t);
+char *SHA256_File(const char *, char *);
+char *SHA256_Data(const uint8_t *, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
+#endif /* !_KERNEL */
+
+int SHA384_Init(SHA384_CTX*);
+int SHA384_Update(SHA384_CTX*, const uint8_t*, size_t);
+int SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
+#ifndef _KERNEL
+char *SHA384_End(SHA384_CTX *, char[SHA384_DIGEST_STRING_LENGTH]);
+char *SHA384_FileChunk(const char *, char *, off_t, off_t);
+char *SHA384_File(const char *, char *);
+char *SHA384_Data(const uint8_t *, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
+#endif /* !_KERNEL */
+
+int SHA512_Init(SHA512_CTX*);
+int SHA512_Update(SHA512_CTX*, const uint8_t*, size_t);
+int SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
+#ifndef _KERNEL
+char *SHA512_End(SHA512_CTX *, char[SHA512_DIGEST_STRING_LENGTH]);
+char *SHA512_FileChunk(const char *, char *, off_t, off_t);
+char *SHA512_File(const char *, char *);
+char *SHA512_Data(const uint8_t *, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
+#endif /* !_KERNEL */
+__END_DECLS
+
+#endif /* __SHA2_H__ */

Property changes on: lab4/.minix-src/include/sys/sha2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/signalvar.h
===================================================================
--- lab4/.minix-src/include/sys/signalvar.h	(nonexistent)
+++ lab4/.minix-src/include/sys/signalvar.h	(revision 13)
@@ -0,0 +1,313 @@
+/*	$NetBSD: signalvar.h,v 1.86 2014/05/15 07:11:30 uebayasi Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)signalvar.h	8.6 (Berkeley) 2/19/95
+ */
+
+#ifndef	_SYS_SIGNALVAR_H_
+#define	_SYS_SIGNALVAR_H_
+
+#include <sys/siginfo.h>
+#include <sys/queue.h>
+#include <sys/mutex.h>
+
+/*
+ * Kernel signal definitions and data structures,
+ * not exported to user programs.
+ */
+
+/*
+ * Queue of signals.
+ */
+typedef TAILQ_HEAD(ksiginfoq, ksiginfo) ksiginfoq_t;
+
+/*
+ * Process signal actions, possibly shared between processes.
+ */
+struct sigacts {
+	struct sigact_sigdesc {
+		struct sigaction sd_sigact;
+		const void	*sd_tramp;
+		int		sd_vers;
+	} sa_sigdesc[NSIG];		/* disposition of signals */
+
+	int		sa_refcnt;	/* reference count */
+	kmutex_t	sa_mutex;	/* lock on sa_refcnt */
+};
+
+/*
+ * Pending signals, per LWP and per process.
+ */
+typedef struct sigpend {
+	ksiginfoq_t	sp_info;
+	sigset_t	sp_set;
+} sigpend_t;
+
+/*
+ * Process signal state.
+ */
+struct sigctx {
+	int		ps_signo;	/* for core dump/debugger XXX */
+	int		ps_code;	/* for core dump/debugger XXX */
+	int		ps_lwp;		/* for core dump/debugger XXX */
+	void		*ps_sigcode;	/* address of signal trampoline */
+	sigset_t	ps_sigignore;	/* Signals being ignored. */
+	sigset_t	ps_sigcatch;	/* Signals being caught by user. */
+};
+
+#if !defined(__minix)
+/* additional signal action values, used only temporarily/internally */
+#define	SIG_CATCH	(void (*)(int))2
+#endif /* !defined(__minix) */
+
+/*
+ * get signal action for process and signal; currently only for current process
+ */
+#define SIGACTION(p, sig)	(p->p_sigacts->sa_sigdesc[(sig)].sd_sigact)
+#define	SIGACTION_PS(ps, sig)	(ps->sa_sigdesc[(sig)].sd_sigact)
+
+/*
+ * Signal properties and actions.
+ * The array below categorizes the signals and their default actions
+ * according to the following properties:
+ */
+#define	SA_KILL		0x0001		/* terminates process by default */
+#define	SA_CORE		0x0002		/* ditto and coredumps */
+#define	SA_STOP		0x0004		/* suspend process */
+#define	SA_TTYSTOP	0x0008		/* ditto, from tty */
+#define	SA_IGNORE	0x0010		/* ignore by default */
+#define	SA_CONT		0x0020		/* continue if suspended */
+#define	SA_CANTMASK	0x0040		/* non-maskable, catchable */
+#define	SA_NORESET	0x0080		/* not reset when caught */
+#define	SA_TOLWP	0x0100		/* to LWP that generated, if local */
+#define	SA_TOALL	0x0200		/* always to all LWPs */
+
+#ifdef _KERNEL
+
+#include <sys/systm.h>			/* for copyin_t/copyout_t */
+
+extern sigset_t contsigmask, sigcantmask;
+
+struct vnode;
+struct coredump_iostate;
+
+/*
+ * Machine-independent functions:
+ */
+int	coredump_netbsd(struct lwp *, struct coredump_iostate *);
+void	execsigs(struct proc *);
+int	issignal(struct lwp *);
+void	pgsignal(struct pgrp *, int, int);
+void	kpgsignal(struct pgrp *, struct ksiginfo *, void *, int);
+void	postsig(int);
+void	psignal(struct proc *, int);
+void	kpsignal(struct proc *, struct ksiginfo *, void *);
+void	child_psignal(struct proc *, int);
+void	siginit(struct proc *);
+void	trapsignal(struct lwp *, struct ksiginfo *);
+void	sigexit(struct lwp *, int) __dead;
+void	killproc(struct proc *, const char *);
+void	setsigvec(struct proc *, int, struct sigaction *);
+int	killpg1(struct lwp *, struct ksiginfo *, int, int);
+void	proc_unstop(struct proc *p);
+
+int	sigaction1(struct lwp *, int, const struct sigaction *,
+	    struct sigaction *, const void *, int);
+int	sigprocmask1(struct lwp *, int, const sigset_t *, sigset_t *);
+void	sigpending1(struct lwp *, sigset_t *);
+void	sigsuspendsetup(struct lwp *, const sigset_t *);
+void	sigsuspendteardown(struct lwp *);
+int	sigsuspend1(struct lwp *, const sigset_t *);
+int	sigaltstack1(struct lwp *, const struct sigaltstack *,
+	    struct sigaltstack *);
+int	sigismasked(struct lwp *, int);
+
+int	sigget(sigpend_t *, ksiginfo_t *, int, const sigset_t *);
+void	sigclear(sigpend_t *, const sigset_t *, ksiginfoq_t *);
+void	sigclearall(struct proc *, const sigset_t *, ksiginfoq_t *);
+
+void	kpsignal2(struct proc *, ksiginfo_t *);
+
+void	signal_init(void);
+
+struct sigacts	*sigactsinit(struct proc *, int);
+void	sigactsunshare(struct proc *);
+void	sigactsfree(struct sigacts *);
+
+void	kpsendsig(struct lwp *, const struct ksiginfo *, const sigset_t *);
+void	sendsig_reset(struct lwp *, int);
+void	sendsig(const struct ksiginfo *, const sigset_t *);
+
+ksiginfo_t	*ksiginfo_alloc(struct proc *, ksiginfo_t *, int);
+void	ksiginfo_free(ksiginfo_t *);
+void	ksiginfo_queue_drain0(ksiginfoq_t *);
+
+struct sys_____sigtimedwait50_args;
+int	sigtimedwait1(struct lwp *, const struct sys_____sigtimedwait50_args *,
+    register_t *, copyin_t, copyout_t, copyin_t, copyout_t);
+
+void	signotify(struct lwp *);
+int	sigispending(struct lwp *, int);
+
+/*
+ * Machine-dependent functions:
+ */
+void	sendsig_sigcontext(const struct ksiginfo *, const sigset_t *);
+void	sendsig_siginfo(const struct ksiginfo *, const sigset_t *);
+
+extern	struct pool ksiginfo_pool;
+
+/*
+ * Modularity / compatibility.
+ */
+extern void	(*sendsig_sigcontext_vec)(const struct ksiginfo *,
+					  const sigset_t *);
+extern int	(*coredump_vec)(struct lwp *, const char *);
+
+/*
+ * firstsig:
+ *
+ * 	Return the first signal in a signal set.
+ */
+static inline int
+firstsig(const sigset_t *ss)
+{
+	int sig;
+
+	sig = ffs(ss->__bits[0]);
+	if (sig != 0)
+		return (sig);
+#if NSIG > 33
+	sig = ffs(ss->__bits[1]);
+	if (sig != 0)
+		return (sig + 32);
+#endif
+#if NSIG > 65
+	sig = ffs(ss->__bits[2]);
+	if (sig != 0)
+		return (sig + 64);
+#endif
+#if NSIG > 97
+	sig = ffs(ss->__bits[3]);
+	if (sig != 0)
+		return (sig + 96);
+#endif
+	return (0);
+}
+
+static inline void
+ksiginfo_queue_init(ksiginfoq_t *kq)
+{
+	TAILQ_INIT(kq);
+}
+
+static inline void
+ksiginfo_queue_drain(ksiginfoq_t *kq)
+{
+	if (!TAILQ_EMPTY(kq))
+		ksiginfo_queue_drain0(kq);
+}
+
+#endif	/* _KERNEL */
+
+#ifdef	_KERNEL
+#ifdef	SIGPROP
+const int sigprop[NSIG] = {
+	0,					/* 0 unused */
+	SA_KILL,				/* 1 SIGHUP */
+	SA_KILL,				/* 2 SIGINT */
+	SA_KILL|SA_CORE,			/* 3 SIGQUIT */
+	SA_KILL|SA_CORE|SA_NORESET|SA_TOLWP,	/* 4 SIGILL */
+	SA_KILL|SA_CORE|SA_NORESET|SA_TOLWP,	/* 5 SIGTRAP */
+	SA_KILL|SA_CORE,			/* 6 SIGABRT */
+	SA_KILL|SA_CORE|SA_TOLWP,		/* 7 SIGEMT */
+	SA_KILL|SA_CORE|SA_TOLWP,		/* 8 SIGFPE */
+	SA_KILL|SA_CANTMASK|SA_TOALL,		/* 9 SIGKILL */
+	SA_KILL|SA_CORE|SA_TOLWP,		/* 10 SIGBUS */
+	SA_KILL|SA_CORE|SA_TOLWP,		/* 11 SIGSEGV */
+	SA_KILL|SA_CORE|SA_TOLWP,		/* 12 SIGSYS */
+	SA_KILL,				/* 13 SIGPIPE */
+	SA_KILL,				/* 14 SIGALRM */
+	SA_KILL,				/* 15 SIGTERM */
+	SA_IGNORE,				/* 16 SIGURG */
+	SA_STOP|SA_CANTMASK|SA_TOALL,		/* 17 SIGSTOP */
+	SA_STOP|SA_TTYSTOP|SA_TOALL,		/* 18 SIGTSTP */
+	SA_IGNORE|SA_CONT|SA_TOALL,		/* 19 SIGCONT */
+	SA_IGNORE,				/* 20 SIGCHLD */
+	SA_STOP|SA_TTYSTOP|SA_TOALL,		/* 21 SIGTTIN */
+	SA_STOP|SA_TTYSTOP|SA_TOALL,		/* 22 SIGTTOU */
+	SA_IGNORE,				/* 23 SIGIO */
+	SA_KILL,				/* 24 SIGXCPU */
+	SA_KILL,				/* 25 SIGXFSZ */
+	SA_KILL,				/* 26 SIGVTALRM */
+	SA_KILL,				/* 27 SIGPROF */
+	SA_IGNORE,				/* 28 SIGWINCH  */
+	SA_IGNORE,				/* 29 SIGINFO */
+	SA_KILL,				/* 30 SIGUSR1 */
+	SA_KILL,				/* 31 SIGUSR2 */
+	SA_IGNORE|SA_NORESET,			/* 32 SIGPWR */
+	SA_KILL,				/* 33 SIGRTMIN + 0 */
+	SA_KILL,				/* 34 SIGRTMIN + 1 */
+	SA_KILL,				/* 35 SIGRTMIN + 2 */
+	SA_KILL,				/* 36 SIGRTMIN + 3 */
+	SA_KILL,				/* 37 SIGRTMIN + 4 */
+	SA_KILL,				/* 38 SIGRTMIN + 5 */
+	SA_KILL,				/* 39 SIGRTMIN + 6 */
+	SA_KILL,				/* 40 SIGRTMIN + 7 */
+	SA_KILL,				/* 41 SIGRTMIN + 8 */
+	SA_KILL,				/* 42 SIGRTMIN + 9 */
+	SA_KILL,				/* 43 SIGRTMIN + 10 */
+	SA_KILL,				/* 44 SIGRTMIN + 11 */
+	SA_KILL,				/* 45 SIGRTMIN + 12 */
+	SA_KILL,				/* 46 SIGRTMIN + 13 */
+	SA_KILL,				/* 47 SIGRTMIN + 14 */
+	SA_KILL,				/* 48 SIGRTMIN + 15 */
+	SA_KILL,				/* 49 SIGRTMIN + 16 */
+	SA_KILL,				/* 50 SIGRTMIN + 17 */
+	SA_KILL,				/* 51 SIGRTMIN + 18 */
+	SA_KILL,				/* 52 SIGRTMIN + 19 */
+	SA_KILL,				/* 53 SIGRTMIN + 20 */
+	SA_KILL,				/* 54 SIGRTMIN + 21 */
+	SA_KILL,				/* 55 SIGRTMIN + 22 */
+	SA_KILL,				/* 56 SIGRTMIN + 23 */
+	SA_KILL,				/* 57 SIGRTMIN + 24 */
+	SA_KILL,				/* 58 SIGRTMIN + 25 */
+	SA_KILL,				/* 59 SIGRTMIN + 26 */
+	SA_KILL,				/* 60 SIGRTMIN + 27 */
+	SA_KILL,				/* 61 SIGRTMIN + 28 */
+	SA_KILL,				/* 62 SIGRTMIN + 29 */
+	SA_KILL,				/* 63 SIGRTMIN + 30 */
+};
+#undef	SIGPROP
+#else
+extern const int sigprop[NSIG];
+#endif	/* SIGPROP */
+#endif	/* _KERNEL */
+#endif	/* !_SYS_SIGNALVAR_H_ */

Property changes on: lab4/.minix-src/include/sys/signalvar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/socketvar.h
===================================================================
--- lab4/.minix-src/include/sys/socketvar.h	(nonexistent)
+++ lab4/.minix-src/include/sys/socketvar.h	(revision 13)
@@ -0,0 +1,564 @@
+/*	$NetBSD: socketvar.h,v 1.139 2015/05/09 15:22:47 rtr Exp $	*/
+
+/*-
+ * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)socketvar.h	8.3 (Berkeley) 2/19/95
+ */
+
+#ifndef _SYS_SOCKETVAR_H_
+#define	_SYS_SOCKETVAR_H_
+
+#include <sys/select.h>
+#include <sys/selinfo.h>		/* for struct selinfo */
+#include <sys/queue.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+
+#if !defined(_KERNEL)
+struct uio;
+struct lwp;
+struct uidinfo;
+#else
+#include <sys/uidinfo.h>
+#endif
+
+TAILQ_HEAD(soqhead, socket);
+
+/*
+ * Variables for socket buffering.
+ */
+struct sockbuf {
+	struct selinfo sb_sel;		/* process selecting read/write */
+	struct mowner *sb_mowner;	/* who owns data for this sockbuf */
+	struct socket *sb_so;		/* back pointer to socket */
+	kcondvar_t sb_cv;		/* notifier */
+	/* When re-zeroing this struct, we zero from sb_startzero to the end */
+#define	sb_startzero	sb_cc
+	u_long	sb_cc;			/* actual chars in buffer */
+	u_long	sb_hiwat;		/* max actual char count */
+	u_long	sb_mbcnt;		/* chars of mbufs used */
+	u_long	sb_mbmax;		/* max chars of mbufs to use */
+	long	sb_lowat;		/* low water mark */
+	struct mbuf *sb_mb;		/* the mbuf chain */
+	struct mbuf *sb_mbtail;		/* the last mbuf in the chain */
+	struct mbuf *sb_lastrecord;	/* first mbuf of last record in
+					   socket buffer */
+	int	sb_flags;		/* flags, see below */
+	int	sb_timeo;		/* timeout for read/write */
+	u_long	sb_overflowed;		/* # of drops due to full buffer */
+};
+
+#ifndef SB_MAX
+#define	SB_MAX		(256*1024)	/* default for max chars in sockbuf */
+#endif
+
+#define	SB_LOCK		0x01		/* lock on data queue */
+#define	SB_NOTIFY	0x04		/* someone is waiting for data/space */
+#define	SB_ASYNC	0x10		/* ASYNC I/O, need signals */
+#define	SB_UPCALL	0x20		/* someone wants an upcall */
+#define	SB_NOINTR	0x40		/* operations not interruptible */
+#define	SB_KNOTE	0x100		/* kernel note attached */
+#define	SB_AUTOSIZE	0x800		/* automatically size socket buffer */
+
+/*
+ * Kernel structure per socket.
+ * Contains send and receive buffer queues,
+ * handle on protocol and pointer to protocol
+ * private data and error information.
+ */
+struct so_accf {
+	struct accept_filter	*so_accept_filter;
+	void	*so_accept_filter_arg;	/* saved filter args */
+	char	*so_accept_filter_str;	/* saved user args */
+};
+
+struct sockaddr;
+
+struct socket {
+	kmutex_t * volatile so_lock;	/* pointer to lock on structure */
+	kcondvar_t	so_cv;		/* notifier */
+	short		so_type;	/* generic type, see socket.h */
+	short		so_options;	/* from socket call, see socket.h */
+	u_short		so_linger;	/* time to linger while closing */
+	short		so_state;	/* internal state flags SS_*, below */
+	int		so_unused;	/* used to be so_nbio */
+	void		*so_pcb;	/* protocol control block */
+	const struct protosw *so_proto;	/* protocol handle */
+/*
+ * Variables for connection queueing.
+ * Socket where accepts occur is so_head in all subsidiary sockets.
+ * If so_head is 0, socket is not related to an accept.
+ * For head socket so_q0 queues partially completed connections,
+ * while so_q is a queue of connections ready to be accepted.
+ * If a connection is aborted and it has so_head set, then
+ * it has to be pulled out of either so_q0 or so_q.
+ * We allow connections to queue up based on current queue lengths
+ * and limit on number of queued connections for this socket.
+ */
+	struct socket	*so_head;	/* back pointer to accept socket */
+	struct soqhead	*so_onq;	/* queue (q or q0) that we're on */
+	struct soqhead	so_q0;		/* queue of partial connections */
+	struct soqhead	so_q;		/* queue of incoming connections */
+	TAILQ_ENTRY(socket) so_qe;	/* our queue entry (q or q0) */
+	short		so_q0len;	/* partials on so_q0 */
+	short		so_qlen;	/* number of connections on so_q */
+	short		so_qlimit;	/* max number queued connections */
+	short		so_timeo;	/* connection timeout */
+	u_short		so_error;	/* error affecting connection */
+	u_short		so_aborting;	/* references from soabort() */
+	pid_t		so_pgid;	/* pgid for signals */
+	u_long		so_oobmark;	/* chars to oob mark */
+	struct sockbuf	so_snd;		/* send buffer */
+	struct sockbuf	so_rcv;		/* receive buffer */
+
+	void		*so_internal;	/* Space for svr4 stream data */
+	void		(*so_upcall) (struct socket *, void *, int, int);
+	void *		so_upcallarg;	/* Arg for above */
+	int		(*so_send) (struct socket *, struct sockaddr *,
+					struct uio *, struct mbuf *,
+					struct mbuf *, int, struct lwp *);
+	int		(*so_receive) (struct socket *,
+					struct mbuf **,
+					struct uio *, struct mbuf **,
+					struct mbuf **, int *);
+	struct mowner	*so_mowner;	/* who owns mbufs for this socket */
+	struct uidinfo	*so_uidinfo;	/* who opened the socket */
+	gid_t		so_egid;	/* creator effective gid */
+	pid_t		so_cpid;	/* creator pid */
+	struct so_accf	*so_accf;
+	kauth_cred_t	so_cred;	/* socket credentials */
+};
+
+#define	SB_EMPTY_FIXUP(sb)						\
+do {									\
+	KASSERT(solocked((sb)->sb_so));					\
+	if ((sb)->sb_mb == NULL) {					\
+		(sb)->sb_mbtail = NULL;					\
+		(sb)->sb_lastrecord = NULL;				\
+	}								\
+} while (/*CONSTCOND*/0)
+
+/*
+ * Socket state bits.
+ */
+#define	SS_NOFDREF		0x001	/* no file table ref any more */
+#define	SS_ISCONNECTED		0x002	/* socket connected to a peer */
+#define	SS_ISCONNECTING		0x004	/* in process of connecting to peer */
+#define	SS_ISDISCONNECTING	0x008	/* in process of disconnecting */
+#define	SS_CANTSENDMORE		0x010	/* can't send more data to peer */
+#define	SS_CANTRCVMORE		0x020	/* can't receive more data from peer */
+#define	SS_RCVATMARK		0x040	/* at mark on input */
+#define	SS_ISABORTING		0x080	/* aborting fd references - close() */
+#define	SS_RESTARTSYS		0x100	/* restart blocked system calls */
+#define	SS_ISDISCONNECTED	0x800	/* socket disconnected from peer */
+
+#define	SS_ASYNC		0x100	/* async i/o notify */
+#define	SS_MORETOCOME		0x400	/*
+					 * hint from sosend to lower layer;
+					 * more data coming
+					 */
+#define	SS_ISAPIPE 		0x1000	/* socket is implementing a pipe */
+#define	SS_NBIO			0x2000	/* socket is in non blocking I/O */
+
+#ifdef _KERNEL
+
+struct accept_filter {
+	char	accf_name[16];
+	void	(*accf_callback)
+		(struct socket *, void *, int, int);
+	void *	(*accf_create)
+		(struct socket *, char *);
+	void	(*accf_destroy)
+		(struct socket *);
+	LIST_ENTRY(accept_filter) accf_next;
+	u_int	accf_refcnt;
+};
+
+struct sockopt {
+	int		sopt_level;		/* option level */
+	int		sopt_name;		/* option name */
+	size_t		sopt_size;		/* data length */
+	void *		sopt_data;		/* data pointer */
+	uint8_t		sopt_buf[sizeof(int)];	/* internal storage */
+};
+
+extern u_long		sb_max;
+extern int		somaxkva;
+extern int		sock_loan_thresh;
+extern kmutex_t		*softnet_lock;
+
+struct mbuf;
+struct lwp;
+struct msghdr;
+struct stat;
+struct knote;
+
+struct	mbuf *getsombuf(struct socket *, int);
+
+/*
+ * File operations on sockets.
+ */
+int	soo_read(file_t *, off_t *, struct uio *, kauth_cred_t, int);
+int	soo_write(file_t *, off_t *, struct uio *, kauth_cred_t, int);
+int	soo_fcntl(file_t *, u_int cmd, void *);
+int	soo_ioctl(file_t *, u_long cmd, void *);
+int	soo_poll(file_t *, int);
+int	soo_kqfilter(file_t *, struct knote *);
+int 	soo_close(file_t *);
+int	soo_stat(file_t *, struct stat *);
+void	soo_restart(file_t *);
+void	sbappend(struct sockbuf *, struct mbuf *);
+void	sbappendstream(struct sockbuf *, struct mbuf *);
+int	sbappendaddr(struct sockbuf *, const struct sockaddr *, struct mbuf *,
+	    struct mbuf *);
+int	sbappendaddrchain(struct sockbuf *, const struct sockaddr *,
+	     struct mbuf *, int);
+int	sbappendcontrol(struct sockbuf *, struct mbuf *, struct mbuf *);
+void	sbappendrecord(struct sockbuf *, struct mbuf *);
+void	sbcheck(struct sockbuf *);
+void	sbcompress(struct sockbuf *, struct mbuf *, struct mbuf *);
+struct mbuf *
+	sbcreatecontrol(void *, int, int, int);
+struct mbuf *
+	sbcreatecontrol1(void **, int, int, int, int);
+void	sbdrop(struct sockbuf *, int);
+void	sbdroprecord(struct sockbuf *);
+void	sbflush(struct sockbuf *);
+void	sbinsertoob(struct sockbuf *, struct mbuf *);
+void	sbrelease(struct sockbuf *, struct socket *);
+int	sbreserve(struct sockbuf *, u_long, struct socket *);
+int	sbwait(struct sockbuf *);
+int	sb_max_set(u_long);
+void	soinit(void);
+void	soinit1(void);
+void	soinit2(void);
+int	soabort(struct socket *);
+int	soaccept(struct socket *, struct sockaddr *);
+int	sofamily(const struct socket *);
+int	sobind(struct socket *, struct sockaddr *, struct lwp *);
+void	socantrcvmore(struct socket *);
+void	socantsendmore(struct socket *);
+int	soclose(struct socket *);
+int	soconnect(struct socket *, struct sockaddr *, struct lwp *);
+int	soconnect2(struct socket *, struct socket *);
+int	socreate(int, struct socket **, int, int, struct lwp *,
+		 struct socket *);
+int	fsocreate(int, struct socket **, int, int, int *);
+int	sodisconnect(struct socket *);
+void	sofree(struct socket *);
+int	sogetopt(struct socket *, struct sockopt *);
+void	sohasoutofband(struct socket *);
+void	soisconnected(struct socket *);
+void	soisconnecting(struct socket *);
+void	soisdisconnected(struct socket *);
+void	soisdisconnecting(struct socket *);
+int	solisten(struct socket *, int, struct lwp *);
+struct socket *
+	sonewconn(struct socket *, bool);
+void	soqinsque(struct socket *, struct socket *, int);
+bool	soqremque(struct socket *, int);
+int	soreceive(struct socket *, struct mbuf **, struct uio *,
+	    struct mbuf **, struct mbuf **, int *);
+int	soreserve(struct socket *, u_long, u_long);
+void	sorflush(struct socket *);
+int	sosend(struct socket *, struct sockaddr *, struct uio *,
+	    struct mbuf *, struct mbuf *, int, struct lwp *);
+int	sosetopt(struct socket *, struct sockopt *);
+int	so_setsockopt(struct lwp *, struct socket *, int, int, const void *, size_t);
+int	soshutdown(struct socket *, int);
+void	sorestart(struct socket *);
+void	sowakeup(struct socket *, struct sockbuf *, int);
+int	sockargs(struct mbuf **, const void *, size_t, int);
+int	sopoll(struct socket *, int);
+struct	socket *soget(bool);
+void	soput(struct socket *);
+bool	solocked(struct socket *);
+bool	solocked2(struct socket *, struct socket *);
+int	sblock(struct sockbuf *, int);
+void	sbunlock(struct sockbuf *);
+int	sowait(struct socket *, bool, int);
+void	solockretry(struct socket *, kmutex_t *);
+void	sosetlock(struct socket *);
+void	solockreset(struct socket *, kmutex_t *);
+
+void	sockopt_init(struct sockopt *, int, int, size_t);
+void	sockopt_destroy(struct sockopt *);
+int	sockopt_set(struct sockopt *, const void *, size_t);
+int	sockopt_setint(struct sockopt *, int);
+int	sockopt_get(const struct sockopt *, void *, size_t);
+int	sockopt_getint(const struct sockopt *, int *);
+int	sockopt_setmbuf(struct sockopt *, struct mbuf *);
+struct mbuf *sockopt_getmbuf(const struct sockopt *);
+
+int	copyout_sockname(struct sockaddr *, unsigned int *, int, struct mbuf *);
+int	copyout_msg_control(struct lwp *, struct msghdr *, struct mbuf *);
+void	free_control_mbuf(struct lwp *, struct mbuf *, struct mbuf *);
+
+int	do_sys_getpeername(int, struct sockaddr *);
+int	do_sys_getsockname(int, struct sockaddr *);
+int	do_sys_sendmsg(struct lwp *, int, struct msghdr *, int, register_t *);
+int	do_sys_recvmsg(struct lwp *, int, struct msghdr *, struct mbuf **,
+	    struct mbuf **, register_t *);
+
+int	do_sys_bind(struct lwp *, int, struct sockaddr *);
+int	do_sys_connect(struct lwp *, int, struct sockaddr *);
+int	do_sys_accept(struct lwp *, int, struct sockaddr *, register_t *,
+	    const sigset_t *, int, int);
+
+/*
+ * Inline functions for sockets and socket buffering.
+ */
+
+#include <sys/protosw.h>
+#include <sys/mbuf.h>
+
+/*
+ * Do we need to notify the other side when I/O is possible?
+ */
+static inline int
+sb_notify(struct sockbuf *sb)
+{
+
+	KASSERT(solocked(sb->sb_so));
+
+	return sb->sb_flags & (SB_NOTIFY | SB_ASYNC | SB_UPCALL | SB_KNOTE);
+}
+
+/*
+ * How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
+ * This is problematical if the fields are unsigned, as the space might
+ * still be negative (cc > hiwat or mbcnt > mbmax).  Should detect
+ * overflow and return 0.
+ */
+static inline long
+sbspace(struct sockbuf *sb)
+{
+
+	KASSERT(solocked(sb->sb_so));
+
+	return lmin(sb->sb_hiwat - sb->sb_cc, sb->sb_mbmax - sb->sb_mbcnt);
+}
+
+/* do we have to send all at once on a socket? */
+static inline int
+sosendallatonce(struct socket *so)
+{
+
+	return so->so_proto->pr_flags & PR_ATOMIC;
+}
+
+/* can we read something from so? */
+static inline int
+soreadable(struct socket *so)
+{
+
+	KASSERT(solocked(so));
+
+	return so->so_rcv.sb_cc >= so->so_rcv.sb_lowat ||
+	    (so->so_state & SS_CANTRCVMORE) != 0 ||
+	    so->so_qlen != 0 || so->so_error != 0;
+}
+
+/* can we write something to so? */
+static inline int
+sowritable(struct socket *so)
+{
+
+	KASSERT(solocked(so));
+
+	return (sbspace(&so->so_snd) >= so->so_snd.sb_lowat &&
+	    ((so->so_state & SS_ISCONNECTED) != 0 ||
+	    (so->so_proto->pr_flags & PR_CONNREQUIRED) == 0)) ||
+	    (so->so_state & SS_CANTSENDMORE) != 0 ||
+	    so->so_error != 0;
+}
+
+/* adjust counters in sb reflecting allocation of m */
+static inline void
+sballoc(struct sockbuf *sb, struct mbuf *m)
+{
+
+	KASSERT(solocked(sb->sb_so));
+
+	sb->sb_cc += m->m_len;
+	sb->sb_mbcnt += MSIZE;
+	if (m->m_flags & M_EXT)
+		sb->sb_mbcnt += m->m_ext.ext_size;
+}
+
+/* adjust counters in sb reflecting freeing of m */
+static inline void
+sbfree(struct sockbuf *sb, struct mbuf *m)
+{
+
+	KASSERT(solocked(sb->sb_so));
+
+	sb->sb_cc -= m->m_len;
+	sb->sb_mbcnt -= MSIZE;
+	if (m->m_flags & M_EXT)
+		sb->sb_mbcnt -= m->m_ext.ext_size;
+}
+
+static inline void
+sorwakeup(struct socket *so)
+{
+
+	KASSERT(solocked(so));
+
+	if (sb_notify(&so->so_rcv))
+		sowakeup(so, &so->so_rcv, POLL_IN);
+}
+
+static inline void
+sowwakeup(struct socket *so)
+{
+
+	KASSERT(solocked(so));
+
+	if (sb_notify(&so->so_snd))
+		sowakeup(so, &so->so_snd, POLL_OUT);
+}
+
+static inline void
+solock(struct socket *so)
+{
+	kmutex_t *lock;
+
+	lock = so->so_lock;
+	mutex_enter(lock);
+	if (__predict_false(lock != so->so_lock))
+		solockretry(so, lock);
+}
+	
+static inline void
+sounlock(struct socket *so)
+{
+
+	mutex_exit(so->so_lock);
+}
+
+#ifdef SOCKBUF_DEBUG
+/*
+ * SBLASTRECORDCHK: check sb->sb_lastrecord is maintained correctly.
+ * SBLASTMBUFCHK: check sb->sb_mbtail is maintained correctly.
+ *
+ * => panic if the socket buffer is inconsistent.
+ * => 'where' is used for a panic message.
+ */
+void	sblastrecordchk(struct sockbuf *, const char *);
+#define	SBLASTRECORDCHK(sb, where)	sblastrecordchk((sb), (where))
+
+void	sblastmbufchk(struct sockbuf *, const char *);
+#define	SBLASTMBUFCHK(sb, where)	sblastmbufchk((sb), (where))
+#define	SBCHECK(sb)			sbcheck(sb)
+#else
+#define	SBLASTRECORDCHK(sb, where)	/* nothing */
+#define	SBLASTMBUFCHK(sb, where)	/* nothing */
+#define	SBCHECK(sb)			/* nothing */
+#endif /* SOCKBUF_DEBUG */
+
+/* sosend loan */
+vaddr_t	sokvaalloc(vaddr_t, vsize_t, struct socket *);
+void	sokvafree(vaddr_t, vsize_t);
+void	soloanfree(struct mbuf *, void *, size_t, void *);
+
+/*
+ * Values for socket-buffer-append priority argument to sbappendaddrchain().
+ * The following flags are reserved for future implementation:
+ *
+ *  SB_PRIO_NONE:  honour normal socket-buffer limits.
+ *
+ *  SB_PRIO_ONESHOT_OVERFLOW:  if the socket has any space,
+ *	deliver the entire chain. Intended for large requests
+ *      that should be delivered in their entirety, or not at all.
+ *
+ * SB_PRIO_OVERDRAFT:  allow a small (2*MLEN) overflow, over and
+ *	aboce normal socket limits. Intended messages indicating
+ *      buffer overflow in earlier normal/lower-priority messages .
+ *
+ * SB_PRIO_BESTEFFORT: Ignore  limits entirely.  Intended only for
+ * 	kernel-generated messages to specially-marked scokets which
+ *	require "reliable" delivery, nd where the source socket/protocol
+ *	message generator enforce some hard limit (but possibly well
+ *	above kern.sbmax). It is entirely up to the in-kernel source to
+ *	avoid complete mbuf exhaustion or DoS scenarios.
+ */
+#define SB_PRIO_NONE 	 	0
+#define SB_PRIO_ONESHOT_OVERFLOW 1
+#define SB_PRIO_OVERDRAFT	2
+#define SB_PRIO_BESTEFFORT	3
+
+/*
+ * Accept filter functions (duh).
+ */
+int	accept_filt_getopt(struct socket *, struct sockopt *);
+int	accept_filt_setopt(struct socket *, const struct sockopt *);
+int	accept_filt_clear(struct socket *);
+int	accept_filt_add(struct accept_filter *);
+int	accept_filt_del(struct accept_filter *);
+struct	accept_filter *accept_filt_get(char *);
+#ifdef ACCEPT_FILTER_MOD
+#ifdef SYSCTL_DECL
+SYSCTL_DECL(_net_inet_accf);
+#endif
+void	accept_filter_init(void);
+#endif
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_SOCKETVAR_H_ */

Property changes on: lab4/.minix-src/include/sys/socketvar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/specificdata.h
===================================================================
--- lab4/.minix-src/include/sys/specificdata.h	(nonexistent)
+++ lab4/.minix-src/include/sys/specificdata.h	(revision 13)
@@ -0,0 +1,69 @@
+/*	$NetBSD: specificdata.h,v 1.4 2008/04/28 20:24:11 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_SPECIFICDATA_H_
+#define	_SYS_SPECIFICDATA_H_
+
+#include <sys/mutex.h>
+
+typedef unsigned int specificdata_key_t;
+typedef void (*specificdata_dtor_t)(void *);
+typedef struct specificdata_domain *specificdata_domain_t;
+typedef struct specificdata_container *specificdata_container_t;
+
+typedef struct {
+	specificdata_container_t specdataref_container;
+	kmutex_t specdataref_lock;
+} specificdata_reference;
+
+specificdata_domain_t	specificdata_domain_create(void);
+void			specificdata_domain_delete(specificdata_domain_t);
+
+int	specificdata_key_create(specificdata_domain_t,
+				specificdata_key_t *, specificdata_dtor_t);
+void	specificdata_key_delete(specificdata_domain_t, specificdata_key_t);
+
+int	specificdata_init(specificdata_domain_t, specificdata_reference *);
+void	specificdata_fini(specificdata_domain_t, specificdata_reference *);
+
+void *	specificdata_getspecific(specificdata_domain_t,
+				 specificdata_reference *, specificdata_key_t);
+void *	specificdata_getspecific_unlocked(specificdata_domain_t,
+					  specificdata_reference *,
+					  specificdata_key_t);
+void	specificdata_setspecific(specificdata_domain_t,
+				 specificdata_reference *, specificdata_key_t,
+				 void *);
+int	specificdata_setspecific_nowait(specificdata_domain_t,
+					specificdata_reference *,
+					specificdata_key_t, void *);
+
+#endif /* _SYS_SPECIFICDATA_H_ */

Property changes on: lab4/.minix-src/include/sys/specificdata.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/siginfo.h
===================================================================
--- lab4/.minix-src/include/sys/siginfo.h	(nonexistent)
+++ lab4/.minix-src/include/sys/siginfo.h	(revision 13)
@@ -0,0 +1,247 @@
+/*	$NetBSD: siginfo.h,v 1.25 2013/11/22 21:04:11 christos Exp $	 */
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_SYS_SIGINFO_H_
+#define	_SYS_SIGINFO_H_
+
+#include <machine/signal.h>
+#include <sys/featuretest.h>
+#ifdef _KERNEL
+#include <sys/queue.h>
+#endif
+
+typedef union sigval {
+	int	sival_int;
+	void	*sival_ptr;
+} sigval_t;
+
+struct _ksiginfo {
+	int	_signo;
+	int	_code;
+	int	_errno;
+#ifdef _LP64
+	/* In _LP64 the union starts on an 8-byte boundary. */
+	int	_pad;
+#endif
+	union {
+		struct {
+			pid_t	_pid;
+			uid_t	_uid;
+			sigval_t	_value;
+		} _rt;
+
+		struct {
+			pid_t	_pid;
+			uid_t	_uid;
+			int	_status;
+			clock_t	_utime;
+			clock_t	_stime;
+		} _child;
+
+		struct {
+			void   *_addr;
+			int	_trap;
+			int	_trap2;
+			int	_trap3;
+		} _fault;
+
+		struct {
+			long	_band;
+			int	_fd;
+		} _poll;
+	} _reason;
+};
+
+#ifdef _KERNEL
+typedef struct ksiginfo {
+	u_long			ksi_flags;	/* 4 or 8 bytes (LP64) */
+	TAILQ_ENTRY(ksiginfo)	ksi_list;
+	struct _ksiginfo	ksi_info;
+	lwpid_t			ksi_lid;	/* 0, or directed to LWP */
+} ksiginfo_t;
+
+#define	KSI_TRAP	0x01	/* signal caused by trap */
+#define	KSI_EMPTY	0x02	/* no additional information */
+#define	KSI_QUEUED	0x04	/* on a sigpend_t queue */
+#define	KSI_FROMPOOL	0x08	/* allocated from the ksiginfo pool */
+
+/* Macros to initialize a ksiginfo_t. */
+#define	KSI_INIT(ksi)							\
+do {									\
+	memset((ksi), 0, sizeof(*(ksi)));				\
+} while (/*CONSTCOND*/0)
+
+#define	KSI_INIT_EMPTY(ksi)						\
+do {									\
+	KSI_INIT((ksi));						\
+	(ksi)->ksi_flags = KSI_EMPTY;					\
+} while (/*CONSTCOND*/0)
+
+#define	KSI_INIT_TRAP(ksi)						\
+do {									\
+	KSI_INIT((ksi));						\
+	(ksi)->ksi_flags = KSI_TRAP;					\
+} while (/*CONSTCOND*/0)
+
+/* Copy the part of ksiginfo_t without the queue pointers */
+#define	KSI_COPY(fksi, tksi)						\
+do {									\
+	(tksi)->ksi_info = (fksi)->ksi_info;				\
+	(tksi)->ksi_flags = (fksi)->ksi_flags;				\
+} while (/*CONSTCOND*/0)
+
+
+/* Predicate macros to test how a ksiginfo_t was generated. */
+#define	KSI_TRAP_P(ksi)		(((ksi)->ksi_flags & KSI_TRAP) != 0)
+#define	KSI_EMPTY_P(ksi)	(((ksi)->ksi_flags & KSI_EMPTY) != 0)
+
+/*
+ * Old-style signal handler "code" arguments were only non-zero for
+ * signals caused by traps.
+ */
+#define	KSI_TRAPCODE(ksi)	(KSI_TRAP_P(ksi) ? (ksi)->ksi_trap : 0)
+#endif /* _KERNEL */
+
+typedef union siginfo {
+	char	si_pad[128];	/* Total size; for future expansion */
+	struct _ksiginfo _info;
+} siginfo_t;
+
+/** Field access macros */
+#define	si_signo	_info._signo
+#define	si_code		_info._code
+#define	si_errno	_info._errno
+
+#define	si_value	_info._reason._rt._value
+#define	si_pid		_info._reason._child._pid
+#define	si_uid		_info._reason._child._uid
+#define	si_status	_info._reason._child._status
+#define	si_utime	_info._reason._child._utime
+#define	si_stime	_info._reason._child._stime
+
+#define	si_addr		_info._reason._fault._addr
+#define	si_trap		_info._reason._fault._trap
+#define	si_trap2	_info._reason._fault._trap2
+#define	si_trap3	_info._reason._fault._trap3
+
+#define	si_band		_info._reason._poll._band
+#define	si_fd		_info._reason._poll._fd
+
+#ifdef _KERNEL
+/** Field access macros */
+#define	ksi_signo	ksi_info._signo
+#define	ksi_code	ksi_info._code
+#define	ksi_errno	ksi_info._errno
+
+#define	ksi_value	ksi_info._reason._rt._value
+#define	ksi_pid		ksi_info._reason._child._pid
+#define	ksi_uid		ksi_info._reason._child._uid
+#define	ksi_status	ksi_info._reason._child._status
+#define	ksi_utime	ksi_info._reason._child._utime
+#define	ksi_stime	ksi_info._reason._child._stime
+
+#define	ksi_addr	ksi_info._reason._fault._addr
+#define	ksi_trap	ksi_info._reason._fault._trap
+#define	ksi_trap2	ksi_info._reason._fault._trap2
+#define	ksi_trap3	ksi_info._reason._fault._trap3
+
+#define	ksi_band	ksi_info._reason._poll._band
+#define	ksi_fd		ksi_info._reason._poll._fd
+#endif /* _KERNEL */
+
+/** si_code */
+/* SIGILL */
+#define	ILL_ILLOPC	1	/* Illegal opcode			*/
+#define	ILL_ILLOPN	2	/* Illegal operand			*/
+#define	ILL_ILLADR	3	/* Illegal addressing mode		*/
+#define	ILL_ILLTRP	4	/* Illegal trap				*/
+#define	ILL_PRVOPC	5	/* Privileged opcode			*/
+#define	ILL_PRVREG	6	/* Privileged register			*/
+#define	ILL_COPROC	7	/* Coprocessor error			*/
+#define	ILL_BADSTK	8	/* Internal stack error			*/
+
+/* SIGFPE */
+#define	FPE_INTDIV	1	/* Integer divide by zero		*/
+#define	FPE_INTOVF	2	/* Integer overflow			*/
+#define	FPE_FLTDIV	3	/* Floating point divide by zero	*/
+#define	FPE_FLTOVF	4	/* Floating point overflow		*/
+#define	FPE_FLTUND	5	/* Floating point underflow		*/
+#define	FPE_FLTRES	6	/* Floating point inexact result	*/
+#define	FPE_FLTINV	7	/* Invalid Floating point operation	*/
+#define	FPE_FLTSUB	8	/* Subscript out of range		*/
+
+/* SIGSEGV */
+#define	SEGV_MAPERR	1	/* Address not mapped to object		*/
+#define	SEGV_ACCERR	2	/* Invalid permissions for mapped object*/
+
+/* SIGBUS */
+#define	BUS_ADRALN	1	/* Invalid address alignment		*/
+#define	BUS_ADRERR	2	/* Non-existent physical address	*/
+#define	BUS_OBJERR	3	/* Object specific hardware error	*/
+
+/* SIGTRAP */
+#define	TRAP_BRKPT	1	/* Process breakpoint			*/
+#define	TRAP_TRACE	2	/* Process trace trap			*/
+
+/* SIGCHLD */
+#define	CLD_EXITED	1	/* Child has exited			*/
+#define	CLD_KILLED	2	/* Child has terminated abnormally but	*/
+				/* did not create a core file		*/
+#define	CLD_DUMPED	3	/* Child has terminated abnormally and	*/
+				/* created a core file			*/
+#define	CLD_TRAPPED	4	/* Traced child has trapped		*/
+#define	CLD_STOPPED	5	/* Child has stopped			*/
+#define	CLD_CONTINUED	6	/* Stopped child has continued		*/
+
+/* SIGPOLL */
+#define	POLL_IN		1	/* Data input available			*/
+#define	POLL_OUT	2	/* Output buffers available		*/
+#define	POLL_MSG	3	/* Input message available		*/
+#define	POLL_ERR	4	/* I/O Error				*/
+#define	POLL_PRI	5	/* High priority input available	*/
+#define	POLL_HUP	6	/* Device disconnected			*/
+
+
+/** si_code */
+#define	SI_USER		0	/* Sent by kill(2)			*/
+#define	SI_QUEUE	-1	/* Sent by the sigqueue(2)		*/
+#define	SI_TIMER	-2	/* Generated by expiration of a timer	*/
+				/* set by timer_settime(2)		*/
+#define	SI_ASYNCIO	-3	/* Generated by completion of an	*/
+				/* asynchronous I/O signal		*/
+#define	SI_MESGQ	-4	/* Generated by arrival of a message on	*/
+				/* an empty message queue		*/
+#if defined(_KERNEL) || defined(_NETBSD_SOURCE)
+#define	SI_LWP		-5	/* Generated by _lwp_kill(2)		*/
+#define	SI_NOINFO	32767	/* No signal specific info available	*/
+#endif
+
+#endif /* !_SYS_SIGINFO_H_ */

Property changes on: lab4/.minix-src/include/sys/siginfo.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/sleepq.h
===================================================================
--- lab4/.minix-src/include/sys/sleepq.h	(nonexistent)
+++ lab4/.minix-src/include/sys/sleepq.h	(revision 13)
@@ -0,0 +1,185 @@
+/*	$NetBSD: sleepq.h,v 1.24 2015/02/08 19:39:09 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe and Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_SYS_SLEEPQ_H_
+#define	_SYS_SLEEPQ_H_
+
+#include <sys/lwp.h>
+#include <sys/mutex.h>
+#include <sys/pool.h>
+#include <sys/queue.h>
+#include <sys/sched.h>
+#include <sys/syncobj.h>
+
+/*
+ * Generic sleep queues.
+ */
+
+#define	SLEEPTAB_HASH_SHIFT	7
+#define	SLEEPTAB_HASH_SIZE	(1 << SLEEPTAB_HASH_SHIFT)
+#define	SLEEPTAB_HASH_MASK	(SLEEPTAB_HASH_SIZE - 1)
+#define	SLEEPTAB_HASH(wchan)	(((uintptr_t)(wchan) >> 8) & SLEEPTAB_HASH_MASK)
+
+TAILQ_HEAD(sleepq, lwp);
+
+typedef struct sleepq sleepq_t;
+
+typedef struct sleeptab {
+	struct {
+		kmutex_t	*st_mutex;
+		sleepq_t	st_queue;
+	} st_queues[SLEEPTAB_HASH_SIZE];
+} sleeptab_t;
+
+void	sleepq_init(sleepq_t *);
+void	sleepq_remove(sleepq_t *, lwp_t *);
+void	sleepq_enqueue(sleepq_t *, wchan_t, const char *, struct syncobj *);
+void	sleepq_unsleep(lwp_t *, bool);
+void	sleepq_timeout(void *);
+void	sleepq_wake(sleepq_t *, wchan_t, u_int, kmutex_t *);
+int	sleepq_abort(kmutex_t *, int);
+void	sleepq_changepri(lwp_t *, pri_t);
+void	sleepq_lendpri(lwp_t *, pri_t);
+int	sleepq_block(int, bool);
+
+void	sleeptab_init(sleeptab_t *);
+
+extern sleeptab_t	sleeptab;
+
+#ifdef _KERNEL
+/*
+ * Return non-zero if it is unsafe to sleep.
+ *
+ * XXX This only exists because panic() is broken.
+ */
+static inline bool
+sleepq_dontsleep(lwp_t *l)
+{
+	extern int cold;
+
+	return cold || (doing_shutdown && (panicstr || CURCPU_IDLE_P()));
+}
+
+/*
+ * Find the correct sleep queue for the specified wait channel.  This
+ * acquires and holds the per-queue interlock.
+ */
+static inline sleepq_t *
+sleeptab_lookup(sleeptab_t *st, wchan_t wchan, kmutex_t **mp)
+{
+	sleepq_t *sq;
+
+	sq = &st->st_queues[SLEEPTAB_HASH(wchan)].st_queue;
+	*mp = st->st_queues[SLEEPTAB_HASH(wchan)].st_mutex;
+	mutex_spin_enter(*mp);
+	return sq;
+}
+
+static inline kmutex_t *
+sleepq_hashlock(wchan_t wchan)
+{
+	kmutex_t *mp;
+
+	mp = sleeptab.st_queues[SLEEPTAB_HASH(wchan)].st_mutex;
+	mutex_spin_enter(mp);
+	return mp;
+}
+
+/*
+ * Prepare to block on a sleep queue, after which any interlock can be
+ * safely released.
+ */
+static inline void
+sleepq_enter(sleepq_t *sq, lwp_t *l, kmutex_t *mp)
+{
+
+	/*
+	 * Acquire the per-LWP mutex and lend it ours sleep queue lock.
+	 * Once interlocked, we can release the kernel lock.
+	 */
+	lwp_lock(l);
+	lwp_unlock_to(l, mp);
+	KERNEL_UNLOCK_ALL(NULL, &l->l_biglocks);
+}
+#endif
+
+/*
+ * Turnstiles, specialized sleep queues for use by kernel locks.
+ */
+
+typedef struct turnstile {
+	LIST_ENTRY(turnstile)	ts_chain;	/* link on hash chain */
+	struct turnstile	*ts_free;	/* turnstile free list */
+	wchan_t			ts_obj;		/* lock object */
+	sleepq_t		ts_sleepq[2];	/* sleep queues */
+	u_int			ts_waiters[2];	/* count of waiters */
+
+	/* priority inheritance */
+	pri_t			ts_eprio;
+	lwp_t			*ts_inheritor;
+	SLIST_ENTRY(turnstile)	ts_pichain;
+} turnstile_t;
+
+typedef struct tschain {
+	kmutex_t		*tc_mutex;	/* mutex on structs & queues */
+	LIST_HEAD(, turnstile)	tc_chain;	/* turnstile chain */
+} tschain_t;
+
+#define	TS_READER_Q	0		/* reader sleep queue */
+#define	TS_WRITER_Q	1		/* writer sleep queue */
+
+#define	TS_WAITERS(ts, q)						\
+	(ts)->ts_waiters[(q)]
+
+#define	TS_ALL_WAITERS(ts)						\
+	((ts)->ts_waiters[TS_READER_Q] +				\
+	 (ts)->ts_waiters[TS_WRITER_Q])
+
+#define	TS_FIRST(ts, q)	(TAILQ_FIRST(&(ts)->ts_sleepq[(q)]))
+
+#ifdef	_KERNEL
+
+void	turnstile_init(void);
+turnstile_t	*turnstile_lookup(wchan_t);
+void	turnstile_exit(wchan_t);
+void	turnstile_block(turnstile_t *, int, wchan_t, syncobj_t *);
+void	turnstile_wakeup(turnstile_t *, int, int, lwp_t *);
+void	turnstile_print(volatile void *, void (*)(const char *, ...)
+    __printflike(1, 2));
+void	turnstile_unsleep(lwp_t *, bool);
+void	turnstile_changepri(lwp_t *, pri_t);
+
+extern pool_cache_t turnstile_cache;
+extern turnstile_t turnstile0;
+
+#endif	/* _KERNEL */
+
+#endif	/* _SYS_SLEEPQ_H_ */

Property changes on: lab4/.minix-src/include/sys/sleepq.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/sockio.h
===================================================================
--- lab4/.minix-src/include/sys/sockio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/sockio.h	(revision 13)
@@ -0,0 +1,145 @@
+/*	$NetBSD: sockio.h,v 1.33 2015/05/02 14:41:32 roy Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)sockio.h	8.1 (Berkeley) 3/28/94
+ */
+
+#ifndef	_SYS_SOCKIO_H_
+#define	_SYS_SOCKIO_H_
+
+#include <sys/ioccom.h>
+
+/* Socket ioctl's. */
+#define	SIOCSHIWAT	 _IOW('s',  0, int)		/* set high watermark */
+#define	SIOCGHIWAT	 _IOR('s',  1, int)		/* get high watermark */
+#define	SIOCSLOWAT	 _IOW('s',  2, int)		/* set low watermark */
+#define	SIOCGLOWAT	 _IOR('s',  3, int)		/* get low watermark */
+#define	SIOCATMARK	 _IOR('s',  7, int)		/* at oob mark? */
+#define	SIOCSPGRP	 _IOW('s',  8, int)		/* set process group */
+#define	SIOCGPGRP	 _IOR('s',  9, int)		/* get process group */
+
+#define	SIOCADDRT	 _IOW('r', 10, struct ortentry)	/* add route */
+#define	SIOCDELRT	 _IOW('r', 11, struct ortentry)	/* delete route */
+
+#define	SIOCSIFADDR	 _IOW('i', 12, struct ifreq)	/* set ifnet address */
+#define	SIOCGIFADDR	_IOWR('i', 33, struct ifreq)	/* get ifnet address */
+
+#define	SIOCSIFDSTADDR	 _IOW('i', 14, struct ifreq)	/* set p-p address */
+#define	SIOCGIFDSTADDR	_IOWR('i', 34, struct ifreq)	/* get p-p address */
+
+#define	SIOCSIFFLAGS	 _IOW('i', 16, struct ifreq)	/* set ifnet flags */
+#define	SIOCGIFFLAGS	_IOWR('i', 17, struct ifreq)	/* get ifnet flags */
+
+#define	SIOCGIFBRDADDR	_IOWR('i', 35, struct ifreq)	/* get broadcast addr */
+#define	SIOCSIFBRDADDR	 _IOW('i', 19, struct ifreq)	/* set broadcast addr */
+
+#define	SIOCGIFCONF	_IOWR('i', 38, struct ifconf)	/* get ifnet list */
+
+#define	SIOCGIFNETMASK	_IOWR('i', 37, struct ifreq)	/* get net addr mask */
+#define	SIOCSIFNETMASK	 _IOW('i', 22, struct ifreq)	/* set net addr mask */
+
+#define	SIOCGIFMETRIC	_IOWR('i', 23, struct ifreq)	/* get IF metric */
+#define	SIOCSIFMETRIC	 _IOW('i', 24, struct ifreq)	/* set IF metric */
+
+#define	SIOCDIFADDR	 _IOW('i', 25, struct ifreq)	/* delete IF addr */
+
+#define	SIOCAIFADDR	 _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */
+#define	SIOCGIFALIAS	_IOWR('i', 27, struct ifaliasreq)/* get IF alias */
+#define	SIOCGIFAFLAG_IN _IOWR('i', 39, struct ifreq)	 /* get addr flags */
+
+#define	SIOCALIFADDR	 _IOW('i', 28, struct if_laddrreq) /* add IF addr */
+#define	SIOCGLIFADDR	_IOWR('i', 29, struct if_laddrreq) /* get IF addr */
+#define	SIOCDLIFADDR	 _IOW('i', 30, struct if_laddrreq) /* delete IF addr */
+/* get/set IF addr preference */
+#define	SIOCSIFADDRPREF	 _IOW('i', 31, struct if_addrprefreq)
+#define	SIOCGIFADDRPREF	_IOWR('i', 32, struct if_addrprefreq)
+
+#define	SIOCADDMULTI	 _IOW('i', 49, struct ifreq)	/* add m'cast addr */
+#define	SIOCDELMULTI	 _IOW('i', 50, struct ifreq)	/* del m'cast addr */
+
+#define	SIOCGETVIFCNT	_IOWR('u', 51, struct sioc_vif_req)/* vif pkt cnt */
+#define	SIOCGETSGCNT	_IOWR('u', 52, struct sioc_sg_req) /* sg pkt cnt */
+
+#define	SIOCSIFMEDIA	_IOWR('i', 53, struct ifreq)	/* set net media */
+#define	SIOCGIFMEDIA	_IOWR('i', 54, struct ifmediareq) /* get net media */
+
+#define	SIOCSIFGENERIC	 _IOW('i', 57, struct ifreq)	/* generic IF set op */
+#define	SIOCGIFGENERIC	_IOWR('i', 58, struct ifreq)	/* generic IF get op */
+
+#define	SIOCSIFPHYADDR	 _IOW('i', 70, struct ifaliasreq) /* set gif addres */
+#define	SIOCGIFPSRCADDR	_IOWR('i', 71, struct ifreq)	/* get gif psrc addr */
+#define	SIOCGIFPDSTADDR	_IOWR('i', 72, struct ifreq)	/* get gif pdst addr */
+#define	SIOCDIFPHYADDR	 _IOW('i', 73, struct ifreq)	/* delete gif addrs */
+#define	SIOCSLIFPHYADDR	 _IOW('i', 74, struct if_laddrreq) /* set gif addrs */
+#define	SIOCGLIFPHYADDR	_IOWR('i', 75, struct if_laddrreq) /* get gif addrs */
+
+#define	SIOCSIFMTU	 _IOW('i', 127, struct ifreq)	/* set ifnet mtu */
+#define	SIOCGIFMTU	_IOWR('i', 126, struct ifreq)	/* get ifnet mtu */
+
+/* 128 was SIOCGIFDATA */
+/* 129 was SIOCZIFDATA */
+
+/* 125 was SIOCSIFASYNCMAP */
+/* 124 was SIOCGIFASYNCMAP */
+
+#define	SIOCSDRVSPEC     _IOW('i', 123, struct ifdrv)   /* set driver-specific
+							   parameters */
+#define	SIOCGDRVSPEC    _IOWR('i', 123, struct ifdrv)   /* get driver-specific
+							   parameters */
+
+#define	SIOCIFCREATE	 _IOW('i', 122, struct ifreq)	/* create clone if */
+#define	SIOCIFDESTROY	 _IOW('i', 121, struct ifreq)	/* destroy clone if */
+#define	SIOCIFGCLONERS	_IOWR('i', 120, struct if_clonereq) /* get cloners */
+
+#define	SIOCGIFDLT	_IOWR('i', 119, struct ifreq)	/* get DLT */
+#define	SIOCGIFCAP	_IOWR('i', 118, struct ifcapreq)/* get capabilities */
+#define	SIOCSIFCAP	 _IOW('i', 117, struct ifcapreq)/* set capabilities */
+
+#define	SIOCSVH		_IOWR('i', 130, struct ifreq)	/* set carp param */
+#define	SIOCGVH		_IOWR('i', 131, struct ifreq)	/* get carp param */
+#define	SIOCINITIFADDR	_IOWR('i', 132, struct ifaddr)
+
+#define	SIOCGIFDATA	_IOWR('i', 133, struct ifdatareq) /* get if_data */
+#define	SIOCZIFDATA	_IOWR('i', 134, struct ifdatareq) /* get if_data then
+							     zero ctrs*/
+
+#define SIOCGLINKSTR	_IOWR('i', 135, struct ifdrv)
+#define SIOCSLINKSTR	 _IOW('i', 136, struct ifdrv)
+
+/* 137 is SIOCGATHSTATS in athioctl.h */
+/* 138 is SIOCGATHDIAG in athioctl.h */
+
+#define	SIOCGETHERCAP	_IOWR('i', 139, struct eccapreq) /* get ethercap */
+#define SIOCGIFINDEX  _IOWR('i', 140, struct ifreq)   /* get ifnet index */
+
+#define	SIOCSETPFSYNC	_IOW('i', 247, struct ifreq)	
+#define	SIOCGETPFSYNC	_IOWR('i', 248, struct ifreq)
+
+#endif /* !_SYS_SOCKIO_H_ */

Property changes on: lab4/.minix-src/include/sys/sockio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/stat.h
===================================================================
--- lab4/.minix-src/include/sys/stat.h	(nonexistent)
+++ lab4/.minix-src/include/sys/stat.h	(revision 13)
@@ -0,0 +1,299 @@
+/*	$NetBSD: stat.h,v 1.68 2013/10/17 18:01:11 njoly Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)stat.h	8.12 (Berkeley) 8/17/94
+ */
+
+#ifndef _SYS_STAT_H_
+#define	_SYS_STAT_H_
+
+#include <sys/featuretest.h>
+#include <sys/types.h>		/* XXX */
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
+    defined(_NETBSD_SOURCE)
+/*
+ * POSIX:2008 / XPG7 requires struct timespec to be declared in
+ * this header, but does not provide the usual exemption
+ * "inclusion of this header may make visible symbols defined in <time.h>".
+ *
+ * This is a Standard omission, acknowledged by the committee and
+ * scheduled to be corrected in Technical Corrigendum 2, according to
+ * http://austingroupbugs.net/view.php?id=531
+ */
+#include <sys/time.h>
+#endif
+
+struct stat {
+	dev_t	  st_dev;		/* inode's device */
+	mode_t	  st_mode;		/* inode protection mode */
+	ino_t	  st_ino;		/* inode's number */
+	nlink_t	  st_nlink;		/* number of hard links */
+	uid_t	  st_uid;		/* user ID of the file's owner */
+	gid_t	  st_gid;		/* group ID of the file's group */
+	dev_t	  st_rdev;		/* device type */
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
+    defined(_NETBSD_SOURCE)
+	struct	  timespec st_atim;	/* time of last access */
+	struct	  timespec st_mtim;	/* time of last data modification */
+	struct	  timespec st_ctim;	/* time of last file status change */
+	struct	  timespec st_birthtim;	/* time of creation */
+#else
+	time_t	  st_atime;		/* time of last access */
+	long	  st_atimensec;		/* nsec of last access */
+	time_t	  st_mtime;		/* time of last data modification */
+	long	  st_mtimensec;		/* nsec of last data modification */
+	time_t	  st_ctime;		/* time of last file status change */
+	long	  st_ctimensec;		/* nsec of last file status change */
+	time_t	  st_birthtime;		/* time of creation */
+	long	  st_birthtimensec;	/* nsec of time of creation */
+#endif
+	off_t	  st_size;		/* file size, in bytes */
+	blkcnt_t  st_blocks;		/* blocks allocated for file */
+	blksize_t st_blksize;		/* optimal blocksize for I/O */
+	uint32_t  st_flags;		/* user defined flags for file */
+	uint32_t  st_gen;		/* file generation number */
+	uint32_t  st_spare[2];
+};
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
+    defined(_NETBSD_SOURCE)
+/* Standard-mandated compatibility */
+#define	st_atime		st_atim.tv_sec
+#define	st_mtime		st_mtim.tv_sec
+#define	st_ctime		st_ctim.tv_sec
+#define	st_birthtime		st_birthtim.tv_sec
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#define	st_atimespec		st_atim
+#define	st_atimensec		st_atim.tv_nsec
+#define	st_mtimespec		st_mtim
+#define	st_mtimensec		st_mtim.tv_nsec
+#define	st_ctimespec		st_ctim
+#define	st_ctimensec		st_ctim.tv_nsec
+#define	st_birthtimespec        st_birthtim
+#define st_birthtimensec	st_birthtimespec.tv_nsec
+#endif
+
+#define	S_ISUID	0004000			/* set user id on execution */
+#define	S_ISGID	0002000			/* set group id on execution */
+#if defined(_NETBSD_SOURCE)
+#define	S_ISTXT	0001000			/* sticky bit */
+#endif
+
+#define	S_IRWXU	0000700			/* RWX mask for owner */
+#define	S_IRUSR	0000400			/* R for owner */
+#define	S_IWUSR	0000200			/* W for owner */
+#define	S_IXUSR	0000100			/* X for owner */
+
+#if defined(_NETBSD_SOURCE)
+#define	S_IREAD		S_IRUSR
+#define	S_IWRITE	S_IWUSR
+#define	S_IEXEC		S_IXUSR
+#endif
+
+#define	S_IRWXG	0000070			/* RWX mask for group */
+#define	S_IRGRP	0000040			/* R for group */
+#define	S_IWGRP	0000020			/* W for group */
+#define	S_IXGRP	0000010			/* X for group */
+
+#define	S_IRWXO	0000007			/* RWX mask for other */
+#define	S_IROTH	0000004			/* R for other */
+#define	S_IWOTH	0000002			/* W for other */
+#define	S_IXOTH	0000001			/* X for other */
+
+#define	_S_IFMT	  0170000		/* type of file mask */
+#define	_S_IFIFO  0010000		/* named pipe (fifo) */
+#define	_S_IFCHR  0020000		/* character special */
+#define	_S_IFDIR  0040000		/* directory */
+#define	_S_IFBLK  0060000		/* block special */
+#define	_S_IFREG  0100000		/* regular */
+#define	_S_IFLNK  0120000		/* symbolic link */
+#define	_S_ISVTX  0001000		/* save swapped text even after use */
+#define	_S_IFSOCK 0140000		/* socket */
+#define	_S_IFWHT  0160000		/* whiteout */
+#define	_S_ARCH1  0200000		/* Archive state 1, ls -l shows 'a' */
+#define	_S_ARCH2  0400000		/* Archive state 2, ls -l shows 'A' */
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define	S_IFMT	 _S_IFMT
+#define	S_IFIFO	 _S_IFIFO
+#define	S_IFCHR	 _S_IFCHR
+#define	S_IFDIR	 _S_IFDIR
+#define	S_IFBLK	 _S_IFBLK
+#define	S_IFREG	 _S_IFREG
+#define	S_IFLNK	 _S_IFLNK
+#define	S_ISVTX	 _S_ISVTX
+#endif
+#if ((_XOPEN_SOURCE - 0) >= 600) || defined(_NETBSD_SOURCE)
+#define	S_IFSOCK _S_IFSOCK
+#endif
+#if defined(_NETBSD_SOURCE)
+#define	S_IFWHT  _S_IFWHT
+
+#define	S_ARCH1	_S_ARCH1
+#define	S_ARCH2	_S_ARCH2
+#endif
+
+#define	S_ISDIR(m)	(((m) & _S_IFMT) == _S_IFDIR)	/* directory */
+#define	S_ISCHR(m)	(((m) & _S_IFMT) == _S_IFCHR)	/* char special */
+#define	S_ISBLK(m)	(((m) & _S_IFMT) == _S_IFBLK)	/* block special */
+#define	S_ISREG(m)	(((m) & _S_IFMT) == _S_IFREG)	/* regular file */
+#define	S_ISFIFO(m)	(((m) & _S_IFMT) == _S_IFIFO)	/* fifo */
+#if ((_POSIX_C_SOURCE - 0) >= 200112L) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define	S_ISLNK(m)	(((m) & _S_IFMT) == _S_IFLNK)	/* symbolic link */
+#endif
+#if ((_POSIX_C_SOURCE - 0) >= 200112L) || ((_XOPEN_SOURCE - 0) >= 600) || \
+    defined(_NETBSD_SOURCE)
+#define	S_ISSOCK(m)	(((m) & _S_IFMT) == _S_IFSOCK)	/* socket */
+#endif
+#if defined(_NETBSD_SOURCE)
+#define	S_ISWHT(m)	(((m) & _S_IFMT) == _S_IFWHT)	/* whiteout */
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#define	ACCESSPERMS	(S_IRWXU|S_IRWXG|S_IRWXO)	/* 0777 */
+							/* 7777 */
+#define	ALLPERMS	(S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
+							/* 0666 */
+#define	DEFFILEMODE	(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
+
+#define S_BLKSIZE	512		/* block size used in the stat struct */
+
+/*
+ * Definitions of flags stored in file flags word.
+ *
+ * Super-user and owner changeable flags.
+ */
+#define	UF_SETTABLE	0x0000ffff	/* mask of owner changeable flags */
+#define	UF_NODUMP	0x00000001	/* do not dump file */
+#define	UF_IMMUTABLE	0x00000002	/* file may not be changed */
+#define	UF_APPEND	0x00000004	/* writes to file may only append */
+#define UF_OPAQUE	0x00000008	/* directory is opaque wrt. union */
+/*	UF_NOUNLINK	0x00000010	   [NOT IMPLEMENTED] */
+/*
+ * Super-user changeable flags.
+ */
+#define	SF_SETTABLE	0xffff0000	/* mask of superuser changeable flags */
+#define	SF_ARCHIVED	0x00010000	/* file is archived */
+#define	SF_IMMUTABLE	0x00020000	/* file may not be changed */
+#define	SF_APPEND	0x00040000	/* writes to file may only append */
+/*	SF_NOUNLINK	0x00100000	   [NOT IMPLEMENTED] */
+#define	SF_SNAPSHOT	0x00200000	/* snapshot inode */
+#define	SF_LOG		0x00400000	/* WAPBL log file inode */
+#define	SF_SNAPINVAL	0x00800000	/* snapshot is invalid */
+
+#ifdef _KERNEL
+/*
+ * Shorthand abbreviations of above.
+ */
+#define	OPAQUE		(UF_OPAQUE)
+#define	APPEND		(UF_APPEND | SF_APPEND)
+#define	IMMUTABLE	(UF_IMMUTABLE | SF_IMMUTABLE)
+#endif /* _KERNEL */
+#endif /* _NETBSD_SOURCE */
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
+    defined(_NETBSD_SOURCE)
+/*
+ * Special values for utimensat and futimens
+ */
+#define UTIME_NOW	((1 << 30) - 1)
+#define UTIME_OMIT	((1 << 30) - 2)
+#endif
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	chmod(const char *, mode_t);
+int	mkdir(const char *, mode_t);
+int	mkfifo(const char *, mode_t);
+#ifndef __LIBC12_SOURCE__
+int	stat(const char *, struct stat *) __RENAME(__stat50);
+int	fstat(int, struct stat *) __RENAME(__fstat50);
+#endif
+mode_t	umask(mode_t);
+#if (_POSIX_C_SOURCE - 0) >= 200112L || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+int	lstat(const char *, struct stat *) __RENAME(__lstat50);
+#endif
+#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+int	fchmod(int, mode_t);
+#ifndef __LIBC12_SOURCE__
+int	mknod(const char *, mode_t, dev_t) __RENAME(__mknod50);
+#endif
+#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
+
+#if defined(_NETBSD_SOURCE)
+int	chflags(const char *, unsigned long);
+int	fchflags(int, unsigned long);
+int	lchflags(const char *, unsigned long);
+int	lchmod(const char *, mode_t);
+#endif /* defined(_NETBSD_SOURCE) */
+
+#ifndef __LIBC12_SOURCE__
+/*
+ * X/Open Extended API set 2 (a.k.a. C063)
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
+    defined(_NETBSD_SOURCE) || defined(_INCOMPLETE_XOPEN_C063)
+int     fchmodat(int, const char *, mode_t, int);
+int     fstatat(int, const char *, struct stat *, int);
+int     mkdirat(int, const char *, mode_t);
+int     mkfifoat(int, const char *, mode_t);
+int     mknodat(int, const char *, mode_t, dev_t);
+int     utimensat(int, const char *, const struct timespec *, int);
+#endif
+
+#ifdef _NETBSD_SOURCE
+int utimens(const char *, const struct timespec *);
+int lutimens(const char *, const struct timespec *);
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
+    defined(_NETBSD_SOURCE)
+int futimens(int, const struct timespec *);
+#endif
+#endif
+
+__END_DECLS
+
+#endif /* !_KERNEL && !_STANDALONE */
+#endif /* !_SYS_STAT_H_ */

Property changes on: lab4/.minix-src/include/sys/stat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/poll.h
===================================================================
--- lab4/.minix-src/include/sys/poll.h	(nonexistent)
+++ lab4/.minix-src/include/sys/poll.h	(revision 13)
@@ -0,0 +1,101 @@
+/*	$NetBSD: poll.h,v 1.15 2009/11/11 09:48:51 rmind Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_POLL_H_
+#define	_SYS_POLL_H_
+
+#include <sys/featuretest.h>
+
+typedef unsigned int	nfds_t;
+
+struct pollfd {
+	int	fd;		/* file descriptor */
+	short	events;		/* events to look for */
+	short	revents;	/* events returned */
+};
+
+/*
+ * Testable events (may be specified in events field).
+ */
+#define	POLLIN		0x0001
+#define	POLLPRI		0x0002
+#define	POLLOUT		0x0004
+#define	POLLRDNORM	0x0040
+#define	POLLWRNORM	POLLOUT
+#define	POLLRDBAND	0x0080
+#define	POLLWRBAND	0x0100
+
+/*
+ * Non-testable events (may not be specified in events field).
+ */
+#define	POLLERR		0x0008
+#define	POLLHUP		0x0010
+#define	POLLNVAL	0x0020
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Infinite timeout value.
+ */
+#define	INFTIM		-1
+#endif
+
+#ifdef _KERNEL
+#include <sys/signal.h>		/* for sigset_t */
+
+struct lwp;
+struct timespec;
+
+int	pollcommon(register_t *, struct pollfd *, u_int,
+    struct timespec *, sigset_t *);
+
+#else
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	poll(struct pollfd *, nfds_t, int);
+__END_DECLS
+
+#ifdef _NETBSD_SOURCE
+#include <sys/sigtypes.h>	/* for sigset_t */
+struct timespec;
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+int	pollts(struct pollfd * __restrict, nfds_t,
+    const struct timespec * __restrict, const sigset_t * __restrict)
+    __RENAME(__pollts50);
+#endif /* __LIBC12_SOURCE__ */
+__END_DECLS
+#endif /* _NETBSD_SOURCE */
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_POLL_H_ */

Property changes on: lab4/.minix-src/include/sys/poll.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/procfs.h
===================================================================
--- lab4/.minix-src/include/sys/procfs.h	(nonexistent)
+++ lab4/.minix-src/include/sys/procfs.h	(revision 13)
@@ -0,0 +1,62 @@
+/*
+ * This file mainly provides a definition of the structures used
+ * to describe the notes section of an ELF file. It doesn't have
+ * anything to do with the /proc file system, even though MINIX
+ * has one.
+ *
+ * The whole purpose of this file is for GDB and GDB only.
+ */
+
+#ifndef _SYS_PROCFS_H_
+#define _SYS_PROCFS_H_
+
+#include <sys/param.h>
+#include <sys/elf_core.h>
+#include <i386/stackframe.h>
+
+/*
+ *
+ * These structures define an interface between core files and the debugger.
+ * Never change or delete any elements. These structures are modeled from
+ * the file with the same name from FreeBSD
+ * 
+ * A lot more things should be added to these structures.  At present,
+ * they contain the absolute bare minimum required to allow GDB to work
+ * with ELF core dumps.
+ */
+
+/*
+ * The parenthsized numbers like (1) indicate the minimum version number
+ * for which each element exists in the structure.
+ */
+
+#define PRSTATUS_VERSION	1	/* Current version of prstatus_t */
+
+typedef struct prstatus {
+    int		pr_version;	/* Version number of struct (1) */
+    size_t	pr_statussz;	/* sizeof(prstatus_t) (1) */
+    size_t	pr_gregsetsz;	/* sizeof(gregset_t) (1) */
+    size_t	pr_fpregsetsz;	/* sizeof(fpregset_t) (1) */
+    int		pr_osreldate;	/* Kernel version (1) */
+    int		pr_cursig;	/* Current signal (1) */
+    pid_t	pr_pid;		/* Process ID (1) */
+    gregset_t	pr_reg;		/* General purpose registers (1) */
+} prstatus_t;
+
+#define PRARGSZ		80	/* Maximum argument bytes saved */
+
+#ifndef MAXCOMLEN
+# define MAXCOMLEN      16      /* Maximum command line arguments */
+#endif
+
+#define PRPSINFO_VERSION	1	/* Current version of prpsinfo_t */
+
+typedef struct prpsinfo {
+    int		pr_version;	/* Version number of struct (1) */
+    size_t	pr_psinfosz;	/* sizeof(prpsinfo_t) (1) */
+    char	pr_fname[MAXCOMLEN+1];	/* Command name, null terminated (1) */
+    char	pr_psargs[PRARGSZ+1];	/* Arguments, null terminated (1) */
+} prpsinfo_t;
+
+#endif /* _SYS_PROCFS_H_ */
+

Property changes on: lab4/.minix-src/include/sys/procfs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ptree.h
===================================================================
--- lab4/.minix-src/include/sys/ptree.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ptree.h	(revision 13)
@@ -0,0 +1,194 @@
+/*	$NetBSD: ptree.h,v 1.8 2012/10/06 22:15:09 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas <matt@3am-software.com>
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_PTREE_H_
+#define _SYS_PTREE_H_
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <stdbool.h>
+#include <stdint.h>
+#endif
+
+typedef enum {
+	PT_DESCENDING=-1,
+	PT_ASCENDING=1
+} pt_direction_t;
+
+typedef unsigned int pt_slot_t;
+typedef unsigned int pt_bitoff_t;
+typedef unsigned int pt_bitlen_t;
+
+typedef struct pt_node {
+	uintptr_t ptn_slots[2];		/* must be first */
+#define	PT_SLOT_LEFT			0u
+#define	PT_SLOT_RIGHT			1u
+#ifdef _PT_PRIVATE
+#define	PT_SLOT_ROOT			0u
+#define	PT_SLOT_OTHER			1u
+#define	PT_SLOT_ODDMAN			1u
+#define	PT_TYPE_LEAF			((uintptr_t)0x00000000u)
+#define	PT_TYPE_BRANCH			((uintptr_t)0x00000001u)
+#define	PT_TYPE_MASK			((uintptr_t)0x00000001u)
+#endif /* _PT_PRIVATE */
+
+	uint32_t ptn_nodedata;
+#ifdef _PT_PRIVATE
+#define	PTN_LEAF_POSITION_BITS		8u
+#define	PTN_LEAF_POSITION_SHIFT		0u
+#define	PTN_BRANCH_POSITION_BITS	8u
+#define	PTN_BRANCH_POSITION_SHIFT	8u
+#ifndef PTNOMASK
+#define	PTN_MASK_BITLEN_BITS		15u
+#define	PTN_MASK_BITLEN_SHIFT		16u
+#define	PTN_MASK_FLAG			0x80000000u
+#endif
+#endif /* _PT_PRIVATE */
+
+	uint32_t ptn_branchdata;
+#ifdef _PT_PRIVATE
+#define	PTN_BRANCH_BITOFF_BITS		15u
+#define	PTN_BRANCH_BITOFF_SHIFT		0u
+#define	PTN_BRANCH_BITLEN_BITS		8u
+#define	PTN_BRANCH_BITLEN_SHIFT		16u
+#if 0
+#define	PTN_ORIENTATION_BITS		1u
+#define	PTN_ORIENTATION_SHIFT		30u
+#endif
+#define	PTN_BRANCH_UNUSED		0x3f000000u
+#define	PTN_XBRANCH_FLAG		0x80000000u
+#endif /* _PT_PRIVATE */
+} pt_node_t;
+
+#ifdef _PT_PRIVATE
+#define	PT_NODE(node)		((pt_node_t *)(node & ~PT_TYPE_MASK))
+#define	PT_TYPE(node)		((node) & PT_TYPE_MASK)
+#define	PT_NULL			0
+#define	PT_NULL_P(node)		((node) == PT_NULL)
+#define	PT_LEAF_P(node)		(PT_TYPE(node) == PT_TYPE_LEAF)
+#define	PT_BRANCH_P(node)	(PT_TYPE(node) == PT_TYPE_BRANCH)
+#define	PTN__TYPELESS(ptn)	(((uintptr_t)ptn) & ~PT_TYPE_MASK)
+#define	PTN_LEAF(ptn)		(PTN__TYPELESS(ptn) | PT_TYPE_LEAF)
+#define	PTN_BRANCH(ptn)		(PTN__TYPELESS(ptn) | PT_TYPE_BRANCH)
+
+#ifndef PTNOMASK
+#define	PTN_MARK_MASK(ptn)	((ptn)->ptn_nodedata |= PTN_MASK_FLAG)
+#define	PTN_ISMASK_P(ptn)	(((ptn)->ptn_nodedata & PTN_MASK_FLAG) != 0)
+#endif
+#define	PTN_MARK_XBRANCH(ptn)	((ptn)->ptn_branchdata |= PTN_XBRANCH_FLAG)
+#define	PTN_ISXBRANCH_P(ptn)	(((ptn)->ptn_branchdata & PTN_XBRANCH_FLAG) != 0)
+#define	PTN_ISROOT_P(pt, ptn)	((ptn) == &(pt)->pt_rootnode)
+
+#define	PTN_BRANCH_SLOT(ptn,slot)	((ptn)->ptn_slots[slot])
+#define	PTN_BRANCH_ROOT_SLOT(ptn)	((ptn)->ptn_slots[PT_SLOT_ROOT])
+#define	PTN_BRANCH_ODDMAN_SLOT(ptn)	((ptn)->ptn_slots[PT_SLOT_ODDMAN])
+#define	PTN_COPY_BRANCH_SLOTS(dst,src)	\
+	((dst)->ptn_slots[PT_SLOT_LEFT ] = (src)->ptn_slots[PT_SLOT_LEFT ], \
+	 (dst)->ptn_slots[PT_SLOT_RIGHT] = (src)->ptn_slots[PT_SLOT_RIGHT])
+#define	PTN_ISSLOTVALID_P(ptn,slot)	((slot) < (1 << PTN_BRANCH_BITLEN(pt)))
+
+#define	PT__MASK(n)		((1 << n ## _BITS) - 1)  
+#define	PT__SHIFT(n)		(n ## _SHIFT)
+#define	PTN__EXTRACT(field, b) \
+	(((field) >> PT__SHIFT(b)) & PT__MASK(b))
+#define	PTN__INSERT2(field, v, shift, mask) \
+	((field) = ((field) & ~((mask) << (shift))) | ((v) << (shift)))
+#define	PTN__INSERT(field, b, v) \
+	PTN__INSERT2(field, v, PT__SHIFT(b), PT__MASK(b))
+
+#define	PTN_BRANCH_BITOFF(ptn)		\
+	PTN__EXTRACT((ptn)->ptn_branchdata, PTN_BRANCH_BITOFF)
+#define	PTN_BRANCH_BITLEN(ptn)		\
+	PTN__EXTRACT((ptn)->ptn_branchdata, PTN_BRANCH_BITLEN)
+#define	PTN_SET_BRANCH_BITOFF(ptn,bitoff) \
+	PTN__INSERT((ptn)->ptn_branchdata, PTN_BRANCH_BITOFF, bitoff)
+#define PTN_SET_BRANCH_BITLEN(ptn,bitlen) \
+	PTN__INSERT((ptn)->ptn_branchdata, PTN_BRANCH_BITLEN, bitlen)
+
+#define	PTN_LEAF_POSITION(ptn)		\
+	PTN__EXTRACT((ptn)->ptn_nodedata, PTN_LEAF_POSITION)
+#define	PTN_BRANCH_POSITION(ptn)	\
+	PTN__EXTRACT((ptn)->ptn_nodedata, PTN_BRANCH_POSITION)
+#define	PTN_SET_LEAF_POSITION(ptn,slot) \
+	PTN__INSERT((ptn)->ptn_nodedata, PTN_LEAF_POSITION, slot)
+#define PTN_SET_BRANCH_POSITION(ptn,slot) \
+	PTN__INSERT((ptn)->ptn_nodedata, PTN_BRANCH_POSITION, slot)
+
+#ifndef PTNOMASK
+#define	PTN_MASK_BITLEN(ptn)		\
+	PTN__EXTRACT((ptn)->ptn_nodedata, PTN_MASK_BITLEN)
+#define PTN_SET_MASK_BITLEN(ptn,masklen) \
+	PTN__INSERT((ptn)->ptn_nodedata, PTN_MASK_BITLEN, masklen)
+#endif
+
+#if 0
+#define	PTN_ORIENTATION(ptn)	\
+	PTN__EXTRACT((ptn)->ptn_branchdata, PTN_ORIENTATION)
+#define	PTN_SET_ORIENTATION(ptn,slot) \
+	PTN__INSERT((ptn)->ptn_branchdata, PTN_ORIENTATION, slot)
+#endif
+#endif /* _PT_PRIVATE */
+
+typedef struct pt_tree_ops {
+	bool (*ptto_matchnode)(const void *, const void *,
+		pt_bitoff_t, pt_bitoff_t *, pt_slot_t *, void *);
+	bool (*ptto_matchkey)(const void *, const void *,
+		pt_bitoff_t, pt_bitlen_t, void *);
+	pt_slot_t (*ptto_testnode)(const void *,
+		pt_bitoff_t, pt_bitlen_t, void *);
+	pt_slot_t (*ptto_testkey)(const void *,
+		pt_bitoff_t, pt_bitlen_t, void *);
+} pt_tree_ops_t;
+
+typedef struct pt_tree {
+	pt_node_t pt_rootnode;
+#define	pt_root			pt_rootnode.ptn_slots[PT_SLOT_ROOT]
+#define	pt_oddman		pt_rootnode.ptn_slots[PT_SLOT_ODDMAN]
+	const pt_tree_ops_t *pt_ops;
+	size_t pt_node_offset;
+	size_t pt_key_offset;
+	void *pt_context;
+	uintptr_t pt_spare[3];
+} pt_tree_t;
+
+#define	PT_FILTER_MASK		0x00000001	/* node is a mask */
+typedef bool (*pt_filter_t)(void *, const void *, int);
+
+void	ptree_init(pt_tree_t *, const pt_tree_ops_t *, void *, size_t, size_t);
+bool	ptree_insert_node(pt_tree_t *, void *);
+bool	ptree_insert_mask_node(pt_tree_t *, void *, pt_bitlen_t);
+bool	ptree_mask_node_p(pt_tree_t *, const void *, pt_bitlen_t *);
+void *	ptree_find_filtered_node(pt_tree_t *, const void *, pt_filter_t, void *);
+#define	ptree_find_node(pt,key)	\
+	ptree_find_filtered_node((pt), (key), NULL, NULL)
+void	ptree_remove_node(pt_tree_t *, void *);
+void *	ptree_iterate(pt_tree_t *, const void *, pt_direction_t);
+
+#endif /* _SYS_PTREE_H_ */

Property changes on: lab4/.minix-src/include/sys/ptree.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/soundcard.h
===================================================================
--- lab4/.minix-src/include/sys/soundcard.h	(nonexistent)
+++ lab4/.minix-src/include/sys/soundcard.h	(revision 13)
@@ -0,0 +1 @@
+../soundcard.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/sys/soundcard.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/statfs.h
===================================================================
--- lab4/.minix-src/include/sys/statfs.h	(nonexistent)
+++ lab4/.minix-src/include/sys/statfs.h	(revision 13)
@@ -0,0 +1,15 @@
+/* Data for fstatfs() call. */
+
+#ifndef _STATFS_H
+#define _STATFS_H
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+struct statfs {
+  int f_bsize;		/* file system block size */
+};
+
+int fstatfs(int fd, struct statfs *st);
+
+#endif /* _STATFS_H */

Property changes on: lab4/.minix-src/include/sys/statfs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/stdbool.h
===================================================================
--- lab4/.minix-src/include/sys/stdbool.h	(nonexistent)
+++ lab4/.minix-src/include/sys/stdbool.h	(revision 13)
@@ -0,0 +1,47 @@
+/*	$NetBSD: stdbool.h,v 1.1 2015/07/29 00:10:25 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of Wasabi Systems, Inc.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_STDBOOL_H_
+#define	_SYS_STDBOOL_H_
+
+#ifndef __bool_true_false_are_defined
+#ifndef __cplusplus
+#define	bool	_Bool
+
+#define	true	1
+#define	false	0
+
+#endif /* __cplusplus */
+
+#define	__bool_true_false_are_defined	1
+#endif
+
+#endif /* _SYS_STDBOOL_H_ */

Property changes on: lab4/.minix-src/include/sys/stdbool.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/syncobj.h
===================================================================
--- lab4/.minix-src/include/sys/syncobj.h	(nonexistent)
+++ lab4/.minix-src/include/sys/syncobj.h	(revision 13)
@@ -0,0 +1,65 @@
+/*	$NetBSD: syncobj.h,v 1.8 2009/10/21 21:12:07 rmind Exp $	*/
+
+/*-
+ * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(_SYS_SYNCOBJ_H_)
+#define	_SYS_SYNCOBJ_H_
+
+struct lwp;
+
+typedef volatile const void *wchan_t;
+
+#if defined(_KERNEL)
+
+/*
+ * Synchronisation object operations set.
+ */
+typedef struct syncobj {
+	u_int	sobj_flag;
+	void	(*sobj_unsleep)(struct lwp *, bool);
+	void	(*sobj_changepri)(struct lwp *, pri_t);
+	void	(*sobj_lendpri)(struct lwp *, pri_t);
+	struct lwp *(*sobj_owner)(wchan_t);
+} syncobj_t;
+
+struct lwp *syncobj_noowner(wchan_t);
+
+#define	SOBJ_SLEEPQ_SORTED	0x01
+#define	SOBJ_SLEEPQ_FIFO	0x02
+#define	SOBJ_SLEEPQ_LIFO	0x04
+
+extern syncobj_t	sched_syncobj;
+extern syncobj_t	mutex_syncobj;
+extern syncobj_t	rw_syncobj;
+extern syncobj_t	sleep_syncobj;
+
+#endif /* defined(_KERNEL) */
+
+#endif /* !_SYS_SYNCOBJ_H_ */

Property changes on: lab4/.minix-src/include/sys/syncobj.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/stdarg.h
===================================================================
--- lab4/.minix-src/include/sys/stdarg.h	(nonexistent)
+++ lab4/.minix-src/include/sys/stdarg.h	(revision 13)
@@ -0,0 +1,68 @@
+/*	$NetBSD: stdarg.h,v 1.4 2014/08/15 11:58:13 matt Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)stdarg.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _SYS_STDARG_H_
+#define	_SYS_STDARG_H_
+
+#include <sys/cdefs.h>
+#include <sys/ansi.h>
+#include <sys/featuretest.h>
+
+#ifdef __lint__
+#define __builtin_next_arg(t)		((t) ? 0 : 0)
+#define	__builtin_va_start(a, l)	((a) = (va_list)(void *)&(l))
+#define	__builtin_va_arg(a, t)		((a) ? (t) 0 : (t) 0)
+#define	__builtin_va_end(a)		/* nothing */
+#define	__builtin_va_copy(d, s)		((d) = (s))
+#elif !(__GNUC_PREREQ__(4, 5) || \
+    (__GNUC_PREREQ__(4, 4) && __GNUC_PATCHLEVEL__ > 2))
+#define __builtin_va_start(ap, last)    __builtin_stdarg_start((ap), (last))
+#endif
+
+#ifndef __VA_LIST_DECLARED
+typedef __va_list va_list;
+#define __VA_LIST_DECLARED
+#endif
+
+#define	va_start(ap, last)	__builtin_va_start((ap), (last))
+#define	va_arg			__builtin_va_arg
+#define	va_end(ap)		__builtin_va_end(ap)
+#define	__va_copy(dest, src)	__builtin_va_copy((dest), (src))
+
+#if !defined(_ANSI_SOURCE) && \
+    (defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
+     defined(_NETBSD_SOURCE))
+#define	va_copy(dest, src)	__va_copy((dest), (src))
+#endif
+
+#endif /* !_SYS_STDARG_H_ */

Property changes on: lab4/.minix-src/include/sys/stdarg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/swap.h
===================================================================
--- lab4/.minix-src/include/sys/swap.h	(nonexistent)
+++ lab4/.minix-src/include/sys/swap.h	(revision 13)
@@ -0,0 +1,60 @@
+/*	$NetBSD: swap.h,v 1.8 2009/01/14 02:20:45 mrg Exp $	*/
+
+/*
+ * Copyright (c) 1995, 1996, 1998, 2009 Matthew R. Green
+ * 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.
+ */
+
+#ifndef _SYS_SWAP_H_
+#define _SYS_SWAP_H_
+
+#include <sys/syslimits.h>
+
+/* Thise structure is used to return swap information for userland */
+
+struct swapent {
+	dev_t	se_dev;			/* device id */
+	int	se_flags;		/* flags */
+	int	se_nblks;		/* total blocks */
+	int	se_inuse;		/* blocks in use */
+	int	se_priority;		/* priority of this device */
+	char	se_path[PATH_MAX+1];	/* path name */
+};
+
+#define SWAP_ON		1		/* begin swapping on device */
+#define SWAP_OFF	2		/* stop swapping on device */
+#define SWAP_NSWAP	3		/* how many swap devices ? */
+#define SWAP_STATS13	4		/* old SWAP_STATS, no se_path */
+#define SWAP_CTL	5		/* change priority on device */
+#define SWAP_STATS50	6		/* old SWAP_STATS, 32 bit dev_t */
+#define SWAP_DUMPDEV	7		/* use this device as dump device */
+#define SWAP_GETDUMPDEV	8		/* use this device as dump device */
+#define SWAP_DUMPOFF	9		/* stop using the dump device */
+#define SWAP_STATS	10		/* get device info */
+
+#define SWF_INUSE	0x00000001	/* in use: we have swapped here */
+#define SWF_ENABLE	0x00000002	/* enabled: we can swap here */
+#define SWF_BUSY	0x00000004	/* busy: I/O happening here */
+#define SWF_FAKE	0x00000008	/* fake: still being built */
+
+#endif /* _SYS_SWAP_H_ */

Property changes on: lab4/.minix-src/include/sys/swap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/sysctl.h
===================================================================
--- lab4/.minix-src/include/sys/sysctl.h	(nonexistent)
+++ lab4/.minix-src/include/sys/sysctl.h	(revision 13)
@@ -0,0 +1,1464 @@
+/*	$NetBSD: sysctl.h,v 1.217 2015/09/26 20:28:37 christos Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Mike Karels at Berkeley Software Design, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)sysctl.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_SYSCTL_H_
+#define	_SYS_SYSCTL_H_
+
+#include <sys/param.h> /* precautionary upon removal from ucred.h */
+#include <sys/proc.h>  /* Needed for things like P_ZOMBIE() and LW_SINTR */
+#include <uvm/uvm_param.h>
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+/*
+ * These are for the eproc structure defined below.
+ */
+#include <sys/time.h>
+#include <sys/ucred.h>
+#include <sys/ucontext.h>
+#include <sys/mallocvar.h>
+#include <uvm/uvm_extern.h>
+#endif
+
+
+/* For offsetof() */
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/systm.h>
+#else
+#include <stddef.h>
+#include <stdbool.h>
+#endif
+
+/*
+ * Definitions for sysctl call.  The sysctl call uses a hierarchical name
+ * for objects that can be examined or modified.  The name is expressed as
+ * a sequence of integers.  Like a file path name, the meaning of each
+ * component depends on its place in the hierarchy.  The top-level and kern
+ * identifiers are defined here, and other identifiers are defined in the
+ * respective subsystem header files.
+ */
+
+struct sysctlnode;
+
+#define	CTL_MAXNAME	12	/* largest number of components supported */
+#define SYSCTL_NAMELEN	32	/* longest name allowed for a node */
+
+#define CREATE_BASE	(1024)	/* start of dynamic mib allocation */
+#define SYSCTL_DEFSIZE	8	/* initial size of a child set */
+
+/*
+ * Each subsystem defined by sysctl defines a list of variables
+ * for that subsystem. Each name is either a node with further
+ * levels defined below it, or it is a leaf of some particular
+ * type given below. Each sysctl level defines a set of name/type
+ * pairs to be used by sysctl(1) in manipulating the subsystem.
+ */
+struct ctlname {
+	const char *ctl_name;	/* subsystem name */
+	int	ctl_type;	/* type of name */
+};
+#define	CTLTYPE_NODE	1	/* name is a node */
+#define	CTLTYPE_INT	2	/* name describes an integer */
+#define	CTLTYPE_STRING	3	/* name describes a string */
+#define	CTLTYPE_QUAD	4	/* name describes a 64-bit number */
+#define	CTLTYPE_STRUCT	5	/* name describes a structure */
+#define	CTLTYPE_BOOL	6	/* name describes a bool */
+
+#ifdef _LP64
+#define	CTLTYPE_LONG	CTLTYPE_QUAD
+#else
+#define	CTLTYPE_LONG	CTLTYPE_INT
+#endif
+
+/*
+ * Flags that apply to each node, governing access and other features
+ */
+#define CTLFLAG_READONLY	0x00000000
+/* #define CTLFLAG_UNUSED1		0x00000010 */
+/* #define CTLFLAG_UNUSED2		0x00000020 */
+/* #define CTLFLAG_READ*	0x00000040 */
+#define CTLFLAG_READWRITE	0x00000070
+#define CTLFLAG_ANYWRITE	0x00000080
+#define CTLFLAG_PRIVATE		0x00000100
+#define CTLFLAG_PERMANENT	0x00000200
+#define CTLFLAG_OWNDATA		0x00000400
+#define CTLFLAG_IMMEDIATE	0x00000800
+#define CTLFLAG_HEX		0x00001000
+#define CTLFLAG_ROOT		0x00002000
+#define CTLFLAG_ANYNUMBER	0x00004000
+#define CTLFLAG_HIDDEN		0x00008000
+#define CTLFLAG_ALIAS		0x00010000
+#define CTLFLAG_MMAP		0x00020000
+#define CTLFLAG_OWNDESC		0x00040000
+#define CTLFLAG_UNSIGNED	0x00080000
+
+/*
+ * sysctl API version
+ */
+#define SYSCTL_VERS_MASK	0xff000000
+#define SYSCTL_VERS_0		0x00000000
+#define SYSCTL_VERS_1		0x01000000
+#define SYSCTL_VERSION		SYSCTL_VERS_1
+#define SYSCTL_VERS(f)		((f) & SYSCTL_VERS_MASK)
+
+/*
+ * Flags that can be set by a create request from user-space
+ */
+#define SYSCTL_USERFLAGS	(CTLFLAG_READWRITE|\
+				CTLFLAG_ANYWRITE|\
+				CTLFLAG_PRIVATE|\
+				CTLFLAG_OWNDATA|\
+				CTLFLAG_IMMEDIATE|\
+				CTLFLAG_HEX|\
+				CTLFLAG_HIDDEN)
+
+/*
+ * Accessor macros
+ */
+#define SYSCTL_TYPEMASK		0x0000000f
+#define SYSCTL_TYPE(x)		((x) & SYSCTL_TYPEMASK)
+#define SYSCTL_FLAGMASK		0x00fffff0
+#define SYSCTL_FLAGS(x)		((x) & SYSCTL_FLAGMASK)
+
+/*
+ * Meta-identifiers
+ */
+#define CTL_EOL		(-1)		/* end of createv/destroyv list */
+#define CTL_QUERY	(-2)		/* enumerates children of a node */
+#define CTL_CREATE	(-3)		/* node create request */
+#define CTL_CREATESYM	(-4)		/* node create request with symbol */
+#define CTL_DESTROY	(-5)		/* node destroy request */
+#define CTL_MMAP	(-6)		/* mmap request */
+#define CTL_DESCRIBE	(-7)		/* get node descriptions */
+
+/*
+ * Top-level identifiers
+ */
+#define	CTL_UNSPEC	0		/* unused */
+#define	CTL_KERN	1		/* "high kernel": proc, limits */
+#define	CTL_VM		2		/* virtual memory */
+#define	CTL_VFS		3		/* file system, mount type is next */
+#define	CTL_NET		4		/* network, see socket.h */
+#define	CTL_DEBUG	5		/* debugging parameters */
+#define	CTL_HW		6		/* generic CPU/io */
+#define	CTL_MACHDEP	7		/* machine dependent */
+#define	CTL_USER	8		/* user-level */
+#define	CTL_DDB		9		/* in-kernel debugger */
+#define	CTL_PROC	10		/* per-proc attr */
+#define	CTL_VENDOR	11		/* vendor-specific data */
+#define	CTL_EMUL	12		/* emulation-specific data */
+#define	CTL_SECURITY	13		/* security */
+#define	CTL_MAXID	14		/* number of valid top-level ids */
+
+/*
+ * The "vendor" toplevel name is to be used by vendors who wish to
+ * have their own private MIB tree. If you do that, please use
+ * vendor.<yourname>.*
+ */
+
+/*
+ * CTL_KERN identifiers
+ */
+#define	KERN_OSTYPE	 	 1	/* string: system version */
+#define	KERN_OSRELEASE	 	 2	/* string: system release */
+#define	KERN_OSREV	 	 3	/* int: system revision */
+#define	KERN_VERSION	 	 4	/* string: compile time info */
+#define	KERN_MAXVNODES	 	 5	/* int: max vnodes */
+#define	KERN_MAXPROC	 	 6	/* int: max processes */
+#define	KERN_MAXFILES	 	 7	/* int: max open files */
+#define	KERN_ARGMAX	 	 8	/* int: max arguments to exec */
+#define	KERN_SECURELVL	 	 9	/* int: system security level */
+#define	KERN_HOSTNAME		10	/* string: hostname */
+#define	KERN_HOSTID		11	/* int: host identifier */
+#define	KERN_CLOCKRATE		12	/* struct: struct clockinfo */
+#define	KERN_VNODE		13	/* struct: vnode structures */
+#define	KERN_PROC		14	/* struct: process entries */
+#define	KERN_FILE		15	/* struct: file entries */
+#define	KERN_PROF		16	/* node: kernel profiling info */
+#define	KERN_POSIX1		17	/* int: POSIX.1 version */
+#define	KERN_NGROUPS		18	/* int: # of supplemental group ids */
+#define	KERN_JOB_CONTROL	19	/* int: is job control available */
+#define	KERN_SAVED_IDS		20	/* int: saved set-user/group-ID */
+#define	KERN_OBOOTTIME		21	/* struct: time kernel was booted */
+#define	KERN_DOMAINNAME		22	/* string: (YP) domainname */
+#define	KERN_MAXPARTITIONS	23	/* int: number of partitions/disk */
+#define	KERN_RAWPARTITION	24	/* int: raw partition number */
+#define	KERN_NTPTIME		25	/* struct: extended-precision time */
+#define	KERN_TIMEX		26	/* struct: ntp timekeeping state */
+#define	KERN_AUTONICETIME	27	/* int: proc time before autonice */
+#define	KERN_AUTONICEVAL	28	/* int: auto nice value */
+#define	KERN_RTC_OFFSET		29	/* int: offset of rtc from gmt */
+#define	KERN_ROOT_DEVICE	30	/* string: root device */
+#define	KERN_MSGBUFSIZE		31	/* int: max # of chars in msg buffer */
+#define	KERN_FSYNC		32	/* int: file synchronization support */
+#define	KERN_OLDSYSVMSG		33	/* old: SysV message queue support */
+#define	KERN_OLDSYSVSEM		34	/* old: SysV semaphore support */
+#define	KERN_OLDSYSVSHM		35	/* old: SysV shared memory support */
+#define	KERN_OLDSHORTCORENAME	36	/* old, unimplemented */
+#define	KERN_SYNCHRONIZED_IO	37	/* int: POSIX synchronized I/O */
+#define	KERN_IOV_MAX		38	/* int: max iovec's for readv(2) etc. */
+#define	KERN_MBUF		39	/* node: mbuf parameters */
+#define	KERN_MAPPED_FILES	40	/* int: POSIX memory mapped files */
+#define	KERN_MEMLOCK		41	/* int: POSIX memory locking */
+#define	KERN_MEMLOCK_RANGE	42	/* int: POSIX memory range locking */
+#define	KERN_MEMORY_PROTECTION	43	/* int: POSIX memory protections */
+#define	KERN_LOGIN_NAME_MAX	44	/* int: max length login name + NUL */
+#define	KERN_DEFCORENAME	45	/* old: sort core name format */
+#define	KERN_LOGSIGEXIT		46	/* int: log signaled processes */
+#define	KERN_PROC2		47	/* struct: process entries */
+#define	KERN_PROC_ARGS		48	/* struct: process argv/env */
+#define	KERN_FSCALE		49	/* int: fixpt FSCALE */
+#define	KERN_CCPU		50	/* old: fixpt ccpu */
+#define	KERN_CP_TIME		51	/* struct: CPU time counters */
+#define	KERN_OLDSYSVIPC_INFO	52	/* old: number of valid kern ids */
+#define	KERN_MSGBUF		53	/* kernel message buffer */
+#define	KERN_CONSDEV		54	/* dev_t: console terminal device */
+#define	KERN_MAXPTYS		55	/* int: maximum number of ptys */
+#define	KERN_PIPE		56	/* node: pipe limits */
+#define	KERN_MAXPHYS		57	/* int: kernel value of MAXPHYS */
+#define	KERN_SBMAX		58	/* int: max socket buffer size */
+#define	KERN_TKSTAT		59	/* tty in/out counters */
+#define	KERN_MONOTONIC_CLOCK	60	/* int: POSIX monotonic clock */
+#define	KERN_URND		61	/* int: random integer from urandom */
+#define	KERN_LABELSECTOR	62	/* int: disklabel sector */
+#define	KERN_LABELOFFSET	63	/* int: offset of label within sector */
+#define	KERN_LWP		64	/* struct: lwp entries */
+#define	KERN_FORKFSLEEP		65	/* int: sleep length on failed fork */
+#define	KERN_POSIX_THREADS	66	/* int: POSIX Threads option */
+#define	KERN_POSIX_SEMAPHORES	67	/* int: POSIX Semaphores option */
+#define	KERN_POSIX_BARRIERS	68	/* int: POSIX Barriers option */
+#define	KERN_POSIX_TIMERS	69	/* int: POSIX Timers option */
+#define	KERN_POSIX_SPIN_LOCKS	70	/* int: POSIX Spin Locks option */
+#define	KERN_POSIX_READER_WRITER_LOCKS 71 /* int: POSIX R/W Locks option */
+#define	KERN_DUMP_ON_PANIC	72	/* int: dump on panic */
+#define	KERN_SOMAXKVA		73	/* int: max socket kernel virtual mem */
+#define	KERN_ROOT_PARTITION	74	/* int: root partition */
+#define	KERN_DRIVERS		75	/* struct: driver names and majors #s */
+#define	KERN_BUF		76	/* struct: buffers */
+#define	KERN_FILE2		77	/* struct: file entries */
+#define	KERN_VERIEXEC		78	/* node: verified exec */
+#define	KERN_CP_ID		79	/* struct: cpu id numbers */
+#define	KERN_HARDCLOCK_TICKS	80	/* int: number of hardclock ticks */
+#define	KERN_ARND		81	/* void *buf, size_t siz random */
+#define	KERN_SYSVIPC		82	/* node: SysV IPC parameters */
+#define	KERN_BOOTTIME		83	/* struct: time kernel was booted */
+#define	KERN_EVCNT		84	/* struct: evcnts */
+#define	KERN_MAXID		85	/* number of valid kern ids */
+
+
+#define	CTL_KERN_NAMES { \
+	{ 0, 0 }, \
+	{ "ostype", CTLTYPE_STRING }, \
+	{ "osrelease", CTLTYPE_STRING }, \
+	{ "osrevision", CTLTYPE_INT }, \
+	{ "version", CTLTYPE_STRING }, \
+	{ "maxvnodes", CTLTYPE_INT }, \
+	{ "maxproc", CTLTYPE_INT }, \
+	{ "maxfiles", CTLTYPE_INT }, \
+	{ "argmax", CTLTYPE_INT }, \
+	{ "securelevel", CTLTYPE_INT }, \
+	{ "hostname", CTLTYPE_STRING }, \
+	{ "hostid", CTLTYPE_INT }, \
+	{ "clockrate", CTLTYPE_STRUCT }, \
+	{ "vnode", CTLTYPE_STRUCT }, \
+	{ "proc", CTLTYPE_STRUCT }, \
+	{ "file", CTLTYPE_STRUCT }, \
+	{ "profiling", CTLTYPE_NODE }, \
+	{ "posix1version", CTLTYPE_INT }, \
+	{ "ngroups", CTLTYPE_INT }, \
+	{ "job_control", CTLTYPE_INT }, \
+	{ "saved_ids", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ "domainname", CTLTYPE_STRING }, \
+	{ "maxpartitions", CTLTYPE_INT }, \
+	{ "rawpartition", CTLTYPE_INT }, \
+	{ "ntptime", CTLTYPE_STRUCT }, \
+	{ "timex", CTLTYPE_STRUCT }, \
+	{ "autonicetime", CTLTYPE_INT }, \
+	{ "autoniceval", CTLTYPE_INT }, \
+	{ "rtc_offset", CTLTYPE_INT }, \
+	{ "root_device", CTLTYPE_STRING }, \
+	{ "msgbufsize", CTLTYPE_INT }, \
+	{ "fsync", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "synchronized_io", CTLTYPE_INT }, \
+	{ "iov_max", CTLTYPE_INT }, \
+	{ "mbuf", CTLTYPE_NODE }, \
+	{ "mapped_files", CTLTYPE_INT }, \
+	{ "memlock", CTLTYPE_INT }, \
+	{ "memlock_range", CTLTYPE_INT }, \
+	{ "memory_protection", CTLTYPE_INT }, \
+	{ "login_name_max", CTLTYPE_INT }, \
+	{ "defcorename", CTLTYPE_STRING }, \
+	{ "logsigexit", CTLTYPE_INT }, \
+	{ "proc2", CTLTYPE_STRUCT }, \
+	{ "proc_args", CTLTYPE_STRING }, \
+	{ "fscale", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ "cp_time", CTLTYPE_STRUCT }, \
+	{ 0, 0 }, \
+	{ "msgbuf", CTLTYPE_STRUCT }, \
+	{ "consdev", CTLTYPE_STRUCT }, \
+	{ "maxptys", CTLTYPE_INT }, \
+	{ "pipe", CTLTYPE_NODE }, \
+	{ "maxphys", CTLTYPE_INT }, \
+	{ "sbmax", CTLTYPE_INT }, \
+	{ "tkstat", CTLTYPE_NODE }, \
+	{ "monotonic_clock", CTLTYPE_INT }, \
+	{ "urandom", CTLTYPE_INT }, \
+	{ "labelsector", CTLTYPE_INT }, \
+	{ "labeloffset", CTLTYPE_INT }, \
+	{ "lwp", CTLTYPE_STRUCT }, \
+	{ "forkfsleep", CTLTYPE_INT }, \
+	{ "posix_threads", CTLTYPE_INT }, \
+	{ "posix_semaphores", CTLTYPE_INT }, \
+	{ "posix_barriers", CTLTYPE_INT }, \
+	{ "posix_timers", CTLTYPE_INT }, \
+	{ "posix_spin_locks", CTLTYPE_INT }, \
+	{ "posix_reader_writer_locks", CTLTYPE_INT }, \
+	{ "dump_on_panic", CTLTYPE_INT}, \
+	{ "somaxkva", CTLTYPE_INT}, \
+	{ "root_partition", CTLTYPE_INT}, \
+	{ "drivers", CTLTYPE_STRUCT }, \
+	{ "buf", CTLTYPE_NODE }, \
+	{ "file2", CTLTYPE_STRUCT }, \
+	{ "veriexec", CTLTYPE_NODE }, \
+	{ "cp_id", CTLTYPE_STRUCT }, \
+	{ "hardclock_ticks", CTLTYPE_INT }, \
+	{ "arandom", CTLTYPE_STRUCT }, \
+	{ "sysvipc", CTLTYPE_STRUCT }, \
+	{ "boottime", CTLTYPE_STRUCT }, \
+	{ "evcnt", CTLTYPE_STRUCT }, \
+}
+
+/*
+ *  KERN_CLOCKRATE structure
+ */
+struct clockinfo {
+	int	hz;		/* clock frequency */
+	int	tick;		/* micro-seconds per hz tick */
+	int	tickadj;	/* clock skew rate for adjtime() */
+	int	stathz;		/* statistics clock frequency */
+	int	profhz;		/* profiling clock frequency */
+};
+
+/*
+ * KERN_PROC subtypes
+ */
+#define	KERN_PROC_ALL		 0	/* everything */
+#define	KERN_PROC_PID		 1	/* by process id */
+#define	KERN_PROC_PGRP		 2	/* by process group id */
+#define	KERN_PROC_SESSION	 3	/* by session of pid */
+#define	KERN_PROC_TTY		 4	/* by controlling tty */
+#define	KERN_PROC_UID		 5	/* by effective uid */
+#define	KERN_PROC_RUID		 6	/* by real uid */
+#define	KERN_PROC_GID		 7	/* by effective gid */
+#define	KERN_PROC_RGID		 8	/* by real gid */
+
+/*
+ * KERN_PROC_TTY sub-subtypes
+ */
+#define	KERN_PROC_TTY_NODEV	NODEV		/* no controlling tty */
+#define	KERN_PROC_TTY_REVOKE	((dev_t)-2)	/* revoked tty */
+
+struct ki_pcred {
+	void		*p_pad;
+	uid_t		p_ruid;		/* Real user id */
+	uid_t		p_svuid;	/* Saved effective user id */
+	gid_t		p_rgid;		/* Real group id */
+	gid_t		p_svgid;	/* Saved effective group id */
+	int		p_refcnt;	/* Number of references */
+};
+
+struct ki_ucred {
+	uint32_t	cr_ref;			/* reference count */
+	uid_t		cr_uid;			/* effective user id */
+	gid_t		cr_gid;			/* effective group id */
+	uint32_t	cr_ngroups;		/* number of groups */
+	gid_t		cr_groups[NGROUPS];	/* groups */
+};
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+
+struct	eproc {
+	struct	proc *e_paddr;		/* address of proc */
+	struct	session *e_sess;	/* session pointer */
+	struct	ki_pcred e_pcred;	/* process credentials */
+	struct	ki_ucred e_ucred;	/* current credentials */
+	struct	vmspace e_vm;		/* address space */
+	pid_t	e_ppid;			/* parent process id */
+	pid_t	e_pgid;			/* process group id */
+	short	e_jobc;			/* job control counter */
+	uint32_t e_tdev;		/* XXX: controlling tty dev */
+	pid_t	e_tpgid;		/* tty process group id */
+	struct	session *e_tsess;	/* tty session pointer */
+#define	WMESGLEN	8
+	char	e_wmesg[WMESGLEN];	/* wchan message */
+	segsz_t e_xsize;		/* text size */
+	short	e_xrssize;		/* text rss */
+	short	e_xccount;		/* text references */
+	short	e_xswrss;
+	long	e_flag;			/* see p_eflag  below */
+	char	e_login[MAXLOGNAME];	/* setlogin() name */
+	pid_t	e_sid;			/* session id */
+	long	e_spare[3];
+};
+
+/*
+ * KERN_PROC subtype ops return arrays of augmented proc structures:
+ */
+struct kinfo_proc {
+	struct	proc kp_proc;			/* proc structure */
+	struct	eproc kp_eproc;			/* eproc structure */
+};
+#endif /* defined(_KERNEL) || defined(_KMEMUSER) */
+
+/*
+ * Convert pointer to 64 bit unsigned integer for struct
+ * kinfo_proc2, etc.
+ */
+#define PTRTOUINT64(p) ((uint64_t)(uintptr_t)(p))
+#define UINT64TOPTR(u) ((void *)(uintptr_t)(u))
+
+/*
+ * KERN_PROC2 subtype ops return arrays of relatively fixed size
+ * structures of process info.   Use 8 byte alignment, and new
+ * elements should only be added to the end of this structure so
+ * binary compatibility can be preserved.
+ */
+#define	KI_NGROUPS	16
+#define	KI_MAXCOMLEN	24	/* extra for 8 byte alignment */
+#define	KI_WMESGLEN	8
+#define	KI_MAXLOGNAME	24	/* extra for 8 byte alignment */
+#define	KI_MAXEMULLEN	16
+#define	KI_LNAMELEN	20	/* extra 4 for alignment */
+
+#define KI_NOCPU	(~(uint64_t)0)
+
+typedef struct {
+	uint32_t	__bits[4];
+} ki_sigset_t;
+
+struct kinfo_proc2 {
+	uint64_t p_forw;		/* PTR: linked run/sleep queue. */
+	uint64_t p_back;
+	uint64_t p_paddr;		/* PTR: address of proc */
+
+	uint64_t p_addr;		/* PTR: Kernel virtual addr of u-area */
+	uint64_t p_fd;			/* PTR: Ptr to open files structure. */
+	uint64_t p_cwdi;		/* PTR: cdir/rdir/cmask info */
+	uint64_t p_stats;		/* PTR: Accounting/statistics */
+	uint64_t p_limit;		/* PTR: Process limits. */
+	uint64_t p_vmspace;		/* PTR: Address space. */
+	uint64_t p_sigacts;		/* PTR: Signal actions, state */
+	uint64_t p_sess;		/* PTR: session pointer */
+	uint64_t p_tsess;		/* PTR: tty session pointer */
+	uint64_t p_ru;			/* PTR: Exit information. XXX */
+
+	int32_t	p_eflag;		/* LONG: extra kinfo_proc2 flags */
+#define	EPROC_CTTY	0x01	/* controlling tty vnode active */
+#define	EPROC_SLEADER	0x02	/* session leader */
+	int32_t	p_exitsig;		/* INT: signal to sent to parent on exit */
+	int32_t	p_flag;			/* INT: P_* flags. */
+
+	int32_t	p_pid;			/* PID_T: Process identifier. */
+	int32_t	p_ppid;			/* PID_T: Parent process id */
+	int32_t	p_sid;			/* PID_T: session id */
+	int32_t	p__pgid;		/* PID_T: process group id */
+					/* XXX: <sys/proc.h> hijacks p_pgid */
+	int32_t	p_tpgid;		/* PID_T: tty process group id */
+
+	uint32_t p_uid;			/* UID_T: effective user id */
+	uint32_t p_ruid;		/* UID_T: real user id */
+	uint32_t p_gid;			/* GID_T: effective group id */
+	uint32_t p_rgid;		/* GID_T: real group id */
+
+	uint32_t p_groups[KI_NGROUPS];	/* GID_T: groups */
+	int16_t	p_ngroups;		/* SHORT: number of groups */
+
+	int16_t	p_jobc;			/* SHORT: job control counter */
+	uint32_t p_tdev;		/* XXX: DEV_T: controlling tty dev */
+
+	uint32_t p_estcpu;		/* U_INT: Time averaged value of p_cpticks. */
+	uint32_t p_rtime_sec;		/* STRUCT TIMEVAL: Real time. */
+	uint32_t p_rtime_usec;		/* STRUCT TIMEVAL: Real time. */
+	int32_t	p_cpticks;		/* INT: Ticks of CPU time. */
+	uint32_t p_pctcpu;		/* FIXPT_T: %cpu for this process during p_swtime */
+	uint32_t p_swtime;		/* U_INT: Time swapped in or out. */
+	uint32_t p_slptime;		/* U_INT: Time since last blocked. */
+	int32_t	p_schedflags;		/* INT: PSCHED_* flags */
+
+	uint64_t p_uticks;		/* U_QUAD_T: Statclock hits in user mode. */
+	uint64_t p_sticks;		/* U_QUAD_T: Statclock hits in system mode. */
+	uint64_t p_iticks;		/* U_QUAD_T: Statclock hits processing intr. */
+
+	uint64_t p_tracep;		/* PTR: Trace to vnode or file */
+	int32_t	p_traceflag;		/* INT: Kernel trace points. */
+
+	int32_t	p_holdcnt;              /* INT: If non-zero, don't swap. */
+
+	ki_sigset_t p_siglist;		/* SIGSET_T: Signals arrived but not delivered. */
+	ki_sigset_t p_sigmask;		/* SIGSET_T: Current signal mask. */
+	ki_sigset_t p_sigignore;	/* SIGSET_T: Signals being ignored. */
+	ki_sigset_t p_sigcatch;		/* SIGSET_T: Signals being caught by user. */
+
+	int8_t	p_stat;			/* CHAR: S* process status (from LWP). */
+	uint8_t p_priority;		/* U_CHAR: Process priority. */
+	uint8_t p_usrpri;		/* U_CHAR: User-priority based on p_cpu and p_nice. */
+	uint8_t p_nice;			/* U_CHAR: Process "nice" value. */
+
+	uint16_t p_xstat;		/* U_SHORT: Exit status for wait; also stop signal. */
+	uint16_t p_acflag;		/* U_SHORT: Accounting flags. */
+
+	char	p_comm[KI_MAXCOMLEN];
+
+	char	p_wmesg[KI_WMESGLEN];	/* wchan message */
+	uint64_t p_wchan;		/* PTR: sleep address. */
+
+	char	p_login[KI_MAXLOGNAME];	/* setlogin() name */
+
+	int32_t	p_vm_rssize;		/* SEGSZ_T: current resident set size in pages */
+	int32_t	p_vm_tsize;		/* SEGSZ_T: text size (pages) */
+	int32_t	p_vm_dsize;		/* SEGSZ_T: data size (pages) */
+	int32_t	p_vm_ssize;		/* SEGSZ_T: stack size (pages) */
+
+	int64_t	p_uvalid;		/* CHAR: following p_u* parameters are valid */
+					/* XXX 64 bits for alignment */
+	uint32_t p_ustart_sec;		/* STRUCT TIMEVAL: starting time. */
+	uint32_t p_ustart_usec;		/* STRUCT TIMEVAL: starting time. */
+
+	uint32_t p_uutime_sec;		/* STRUCT TIMEVAL: user time. */
+	uint32_t p_uutime_usec;		/* STRUCT TIMEVAL: user time. */
+	uint32_t p_ustime_sec;		/* STRUCT TIMEVAL: system time. */
+	uint32_t p_ustime_usec;		/* STRUCT TIMEVAL: system time. */
+
+	uint64_t p_uru_maxrss;		/* LONG: max resident set size. */
+	uint64_t p_uru_ixrss;		/* LONG: integral shared memory size. */
+	uint64_t p_uru_idrss;		/* LONG: integral unshared data ". */
+	uint64_t p_uru_isrss;		/* LONG: integral unshared stack ". */
+	uint64_t p_uru_minflt;		/* LONG: page reclaims. */
+	uint64_t p_uru_majflt;		/* LONG: page faults. */
+	uint64_t p_uru_nswap;		/* LONG: swaps. */
+	uint64_t p_uru_inblock;		/* LONG: block input operations. */
+	uint64_t p_uru_oublock;		/* LONG: block output operations. */
+	uint64_t p_uru_msgsnd;		/* LONG: messages sent. */
+	uint64_t p_uru_msgrcv;		/* LONG: messages received. */
+	uint64_t p_uru_nsignals;	/* LONG: signals received. */
+	uint64_t p_uru_nvcsw;		/* LONG: voluntary context switches. */
+	uint64_t p_uru_nivcsw;		/* LONG: involuntary ". */
+
+	uint32_t p_uctime_sec;		/* STRUCT TIMEVAL: child u+s time. */
+	uint32_t p_uctime_usec;		/* STRUCT TIMEVAL: child u+s time. */
+	uint64_t p_cpuid;		/* LONG: CPU id */
+	uint64_t p_realflag;	       	/* INT: P_* flags (not including LWPs). */
+	uint64_t p_nlwps;		/* LONG: Number of LWPs */
+	uint64_t p_nrlwps;		/* LONG: Number of running LWPs */
+	uint64_t p_realstat;		/* LONG: non-LWP process status */
+	uint32_t p_svuid;		/* UID_T: saved user id */
+	uint32_t p_svgid;		/* GID_T: saved group id */
+	char p_ename[KI_MAXEMULLEN];	/* emulation name */
+	int64_t	p_vm_vsize;		/* SEGSZ_T: total map size (pages) */
+	int64_t	p_vm_msize;		/* SEGSZ_T: stack-adjusted map size (pages) */
+};
+
+/*
+ * Compat flags for kinfo_proc, kinfo_proc2.  Not guaranteed to be stable.
+ * Some of them used to be shared with LWP flags.
+ * XXXAD Trim to the minimum necessary...
+ */
+
+#define	P_ADVLOCK		0x00000001
+#define	P_CONTROLT		0x00000002
+#define	L_INMEM			0x00000004
+#define	P_INMEM		     /* 0x00000004 */	L_INMEM
+#define	P_NOCLDSTOP		0x00000008
+#define	P_PPWAIT		0x00000010
+#define	P_PROFIL		0x00000020
+#define	L_SELECT		0x00000040
+#define	P_SELECT	     /* 0x00000040 */	L_SELECT
+#define	L_SINTR			0x00000080
+#define	P_SINTR		     /* 0x00000080 */	L_SINTR
+#define	P_SUGID			0x00000100
+#define	L_SYSTEM	     	0x00000200
+#define	P_SYSTEM	     /*	0x00000200 */	L_SYSTEM
+#define	L_SA			0x00000400
+#define	P_SA		     /* 0x00000400 */	L_SA
+#define	P_TRACED		0x00000800
+#define	P_WAITED		0x00001000
+#define	P_WEXIT			0x00002000
+#define	P_EXEC			0x00004000
+#define	P_OWEUPC		0x00008000
+#define	P_FSTRACE		0x00010000
+#define	P_NOCLDWAIT		0x00020000
+#define	P_32			0x00040000
+#define	P_CLDSIGIGN		0x00080000
+#define	P_SYSTRACE		0x00200000
+#define	P_CHTRACED		0x00400000
+#define	P_STOPFORK		0x00800000
+#define	P_STOPEXEC		0x01000000
+#define	P_STOPEXIT		0x02000000
+#define	P_SYSCALL		0x04000000
+#define	P_PAXMPROTECT		0x08000000
+#define	P_PAXNOMPROTECT		0x10000000
+
+/*
+ * LWP compat flags.
+ */
+#define	L_DETACHED		0x00800000
+
+/*
+ * KERN_LWP structure. See notes on KERN_PROC2 about adding elements.
+ */
+struct kinfo_lwp {
+	uint64_t l_forw;		/* PTR: linked run/sleep queue. */
+	uint64_t l_back;
+	uint64_t l_laddr;		/* PTR: Address of LWP */
+	uint64_t l_addr;		/* PTR: Kernel virtual addr of u-area */
+	int32_t	l_lid;			/* LWPID_T: LWP identifier */
+	int32_t	l_flag;			/* INT: L_* flags. */
+	uint32_t l_swtime;		/* U_INT: Time swapped in or out. */
+	uint32_t l_slptime;		/* U_INT: Time since last blocked. */
+	int32_t	l_schedflags;		/* INT: PSCHED_* flags */
+	int32_t	l_holdcnt;              /* INT: If non-zero, don't swap. */
+	uint8_t l_priority;		/* U_CHAR: Process priority. */
+	uint8_t l_usrpri;		/* U_CHAR: User-priority based on l_cpu and p_nice. */
+	int8_t	l_stat;			/* CHAR: S* process status. */
+	int8_t	l_pad1;			/* fill out to 4-byte boundary */
+	int32_t	l_pad2;			/* .. and then to an 8-byte boundary */
+	char	l_wmesg[KI_WMESGLEN];	/* wchan message */
+	uint64_t l_wchan;		/* PTR: sleep address. */
+	uint64_t l_cpuid;		/* LONG: CPU id */
+	uint32_t l_rtime_sec;		/* STRUCT TIMEVAL: Real time. */
+	uint32_t l_rtime_usec;		/* STRUCT TIMEVAL: Real time. */
+	uint32_t l_cpticks;		/* INT: ticks during l_swtime */
+	uint32_t l_pctcpu;		/* FIXPT_T: cpu usage for ps */
+	uint32_t l_pid;			/* PID_T: process identifier */
+	char	l_name[KI_LNAMELEN];	/* CHAR[]: name, may be empty */
+};
+
+/*
+ * KERN_PROC_ARGS subtypes
+ */
+#define	KERN_PROC_ARGV		1	/* argv */
+#define	KERN_PROC_NARGV		2	/* number of strings in above */
+#define	KERN_PROC_ENV		3	/* environ */
+#define	KERN_PROC_NENV		4	/* number of strings in above */
+#define	KERN_PROC_PATHNAME 	5	/* path to executable */
+
+/*
+ * KERN_SYSVIPC subtypes
+ */
+#define	KERN_SYSVIPC_INFO	1	/* struct: number of valid kern ids */
+#define	KERN_SYSVIPC_MSG	2	/* int: SysV message queue support */
+#define	KERN_SYSVIPC_SEM	3	/* int: SysV semaphore support */
+#define	KERN_SYSVIPC_SHM	4	/* int: SysV shared memory support */
+#define	KERN_SYSVIPC_SHMMAX	5	/* int: max shared memory segment size (bytes) */
+#define	KERN_SYSVIPC_SHMMNI	6	/* int: max number of shared memory identifiers */
+#define	KERN_SYSVIPC_SHMSEG	7	/* int: max shared memory segments per process */
+#define	KERN_SYSVIPC_SHMMAXPGS	8	/* int: max amount of shared memory (pages) */
+#define	KERN_SYSVIPC_SHMUSEPHYS	9	/* int: physical memory usage */
+
+/*
+ * KERN_SYSVIPC_INFO subtypes
+ */
+/* KERN_SYSVIPC_OMSG_INFO		1	*/
+/* KERN_SYSVIPC_OSEM_INFO		2	*/
+/* KERN_SYSVIPC_OSHM_INFO		3	*/
+#define	KERN_SYSVIPC_MSG_INFO		4	/* msginfo and msgid_ds */
+#define	KERN_SYSVIPC_SEM_INFO		5	/* seminfo and semid_ds */
+#define	KERN_SYSVIPC_SHM_INFO		6	/* shminfo and shmid_ds */
+
+/*
+ * tty counter sysctl variables
+ */
+#define	KERN_TKSTAT_NIN			1	/* total input character */
+#define	KERN_TKSTAT_NOUT		2	/* total output character */
+#define	KERN_TKSTAT_CANCC		3	/* canonical input character */
+#define	KERN_TKSTAT_RAWCC		4	/* raw input character */
+#define	KERN_TKSTAT_MAXID		5	/* number of valid TKSTAT ids */
+
+#define	KERN_TKSTAT_NAMES { \
+	{ 0, 0 }, \
+	{ "nin", CTLTYPE_QUAD }, \
+	{ "nout", CTLTYPE_QUAD }, \
+	{ "cancc", CTLTYPE_QUAD }, \
+	{ "rawcc", CTLTYPE_QUAD }, \
+}
+
+/*
+ * kern.drivers returns an array of these.
+ */
+
+struct kinfo_drivers {
+	devmajor_t	d_cmajor;
+	devmajor_t	d_bmajor;
+	char		d_name[24];
+};
+
+/*
+ * KERN_BUF subtypes, like KERN_PROC2, where the four following mib
+ * entries specify "which type of buf", "which particular buf",
+ * "sizeof buf", and "how many".  Currently, only "all buf" is
+ * defined.
+ */
+#define	KERN_BUF_ALL	0		/* all buffers */
+
+/*
+ * kern.buf returns an array of these structures, which are designed
+ * both to be immune to 32/64 bit emulation issues and to provide
+ * backwards compatibility.  Note that the order here differs slightly
+ * from the real struct buf in order to achieve proper 64 bit
+ * alignment.
+ */
+struct buf_sysctl {
+	uint32_t b_flags;	/* LONG: B_* flags */
+	int32_t  b_error;	/* INT: Errno value */
+	int32_t  b_prio;	/* INT: Hint for buffer queue discipline */
+	uint32_t b_dev;		/* DEV_T: Device associated with buffer */
+	uint64_t b_bufsize;	/* LONG: Allocated buffer size */
+	uint64_t b_bcount;	/* LONG: Valid bytes in buffer */
+	uint64_t b_resid;	/* LONG: Remaining I/O */
+	uint64_t b_addr;	/* CADDR_T: Memory, superblocks, indirect... */
+	uint64_t b_blkno;	/* DADDR_T: Underlying physical block number */
+	uint64_t b_rawblkno;	/* DADDR_T: Raw underlying physical block */
+	uint64_t b_iodone;	/* PTR: Function called upon completion */
+	uint64_t b_proc;	/* PTR: Associated proc if B_PHYS set */
+	uint64_t b_vp;		/* PTR: File vnode */
+	uint64_t b_saveaddr;	/* PTR: Original b_addr for physio */
+	uint64_t b_lblkno;	/* DADDR_T: Logical block number */
+};
+
+/*
+ * kern.file2 returns an array of these structures, which are designed
+ * both to be immune to be immune to 32/64 bit emulation issues and to
+ * provide backwards compatibility.  The order differs slightly from
+ * that of the real struct file, and some fields are taken from other
+ * structures (struct vnode, struct proc) in order to make the file
+ * information more useful.
+ */
+struct kinfo_file {
+	uint64_t	ki_fileaddr;	/* PTR: address of struct file */
+	uint32_t	ki_flag;	/* INT: flags (see fcntl.h) */
+	uint32_t	ki_iflags;	/* INT: internal flags */
+	uint32_t	ki_ftype;	/* INT: descriptor type */
+	uint32_t	ki_count;	/* UINT: reference count */
+	uint32_t	ki_msgcount;	/* UINT: references from msg queue */
+	uint32_t	ki_usecount;	/* INT: number active users */
+	uint64_t	ki_fucred;	/* PTR: creds for descriptor */
+	uint32_t	ki_fuid;	/* UID_T: descriptor credentials */
+	uint32_t	ki_fgid;	/* GID_T: descriptor credentials */
+	uint64_t	ki_fops;	/* PTR: address of fileops */
+	uint64_t	ki_foffset;	/* OFF_T: offset */
+	uint64_t	ki_fdata;	/* PTR: descriptor data */
+
+	/* vnode information to glue this file to something */
+	uint64_t	ki_vun;		/* PTR: socket, specinfo, etc */
+	uint64_t	ki_vsize;	/* OFF_T: size of file */
+	uint32_t	ki_vtype;	/* ENUM: vnode type */
+	uint32_t	ki_vtag;	/* ENUM: type of underlying data */
+	uint64_t	ki_vdata;	/* PTR: private data for fs */
+
+	/* process information when retrieved via KERN_FILE_BYPID */
+	uint32_t	ki_pid;		/* PID_T: process id */
+	int32_t		ki_fd;		/* INT: descriptor number */
+	uint32_t	ki_ofileflags;	/* CHAR: open file flags */
+	uint32_t	_ki_padto64bits;
+};
+
+#define	KERN_FILE_BYFILE	1
+#define	KERN_FILE_BYPID		2
+#define	KERN_FILESLOP		10
+
+/*
+ * kern.evcnt returns an array of these structures, which are designed both to
+ * be immune to 32/64 bit emulation issues.  Note that the struct here differs
+ * from the real struct evcnt but contains the same information in order to
+ * accommodate sysctl.
+ */
+struct evcnt_sysctl {
+	uint64_t	ev_count;		/* current count */
+	uint64_t	ev_addr;		/* kernel address of evcnt */
+	uint64_t	ev_parent;		/* kernel address of parent */
+	uint8_t		ev_type;		/* EVCNT_TRAP_* */
+	uint8_t		ev_grouplen;		/* length of group with NUL */
+	uint8_t		ev_namelen;		/* length of name with NUL */
+	uint8_t		ev_len;			/* multiply by 8 */
+	/*
+	 * Now the group and name strings follow (both include the trailing
+	 * NUL).  ev_name start at &ev_strings[ev_grouplen+1]
+	 */
+	char		ev_strings[0];
+};
+
+#define	KERN_EVCNT_COUNT_ANY		0
+#define	KERN_EVCNT_COUNT_NONZERO	1
+
+/*
+ * CTL_VM identifiers in <uvm/uvm_param.h>
+ */
+
+/*
+ * The vm.proc.map sysctl allows a process to dump the VM layout of
+ * another process as a series of entries.
+ */
+#define	KVME_TYPE_NONE		0
+#define	KVME_TYPE_OBJECT	1
+#define	KVME_TYPE_VNODE		2
+#define	KVME_TYPE_KERN		3
+#define	KVME_TYPE_DEVICE	4
+#define	KVME_TYPE_ANON		5
+#define	KVME_TYPE_SUBMAP	6
+#define	KVME_TYPE_UNKNOWN	255
+
+#define	KVME_PROT_READ		0x00000001
+#define	KVME_PROT_WRITE		0x00000002
+#define	KVME_PROT_EXEC		0x00000004
+
+#define	KVME_FLAG_COW		0x00000001
+#define	KVME_FLAG_NEEDS_COPY	0x00000002
+#define	KVME_FLAG_NOCOREDUMP	0x00000004
+#define	KVME_FLAG_PAGEABLE	0x00000008
+#define	KVME_FLAG_GROWS_UP	0x00000010
+#define	KVME_FLAG_GROWS_DOWN	0x00000020
+
+struct kinfo_vmentry {
+	uint64_t kve_start;			/* Starting address. */
+	uint64_t kve_end;			/* Finishing address. */
+	uint64_t kve_offset;			/* Mapping offset in object */
+
+	uint32_t kve_type;			/* Type of map entry. */
+	uint32_t kve_flags;			/* Flags on map entry. */
+
+	uint32_t kve_count;			/* Number of pages/entries */
+	uint32_t kve_wired_count;		/* Number of wired pages */
+
+	uint32_t kve_advice;			/* Advice */
+	uint32_t kve_attributes;		/* Map attribute */
+
+	uint32_t kve_protection;		/* Protection bitmask. */
+	uint32_t kve_max_protection;		/* Max protection bitmask */
+
+	uint32_t kve_ref_count;			/* VM obj ref count. */
+	uint32_t kve_inheritance;		/* Inheritance */
+
+	uint64_t kve_vn_fileid;			/* inode number if vnode */
+	uint64_t kve_vn_size;			/* File size. */
+	uint64_t kve_vn_fsid;			/* dev_t of vnode location */
+	uint64_t kve_vn_rdev;			/* Device id if device. */
+
+	uint32_t kve_vn_type;			/* Vnode type. */
+	uint32_t kve_vn_mode;			/* File mode. */
+
+	char	 kve_path[PATH_MAX];		/* Path to VM obj, if any. */
+};
+
+/*
+ * CTL_HW identifiers
+ */
+#define	HW_MACHINE	 1		/* string: machine class */
+#define	HW_MODEL	 2		/* string: specific machine model */
+#define	HW_NCPU		 3		/* int: number of cpus */
+#define	HW_BYTEORDER	 4		/* int: machine byte order */
+#define	HW_PHYSMEM	 5		/* int: total memory (bytes) */
+#define	HW_USERMEM	 6		/* int: non-kernel memory (bytes) */
+#define	HW_PAGESIZE	 7		/* int: software page size */
+#define	HW_DISKNAMES	 8		/* string: disk drive names */
+#define	HW_IOSTATS	 9		/* struct: iostats[] */
+#define	HW_MACHINE_ARCH	10		/* string: machine architecture */
+#define	HW_ALIGNBYTES	11		/* int: ALIGNBYTES for the kernel */
+#define	HW_CNMAGIC	12		/* string: console magic sequence(s) */
+#define	HW_PHYSMEM64	13		/* quad: total memory (bytes) */
+#define	HW_USERMEM64	14		/* quad: non-kernel memory (bytes) */
+#define	HW_IOSTATNAMES	15		/* string: iostat names */
+#define	HW_MAXID	15		/* number of valid hw ids */
+#define	HW_NCPUONLINE	16		/* number CPUs online */
+
+#define	CTL_HW_NAMES { \
+	{ 0, 0 }, \
+	{ "machine", CTLTYPE_STRING }, \
+	{ "model", CTLTYPE_STRING }, \
+	{ "ncpu", CTLTYPE_INT }, \
+	{ "byteorder", CTLTYPE_INT }, \
+	{ "physmem", CTLTYPE_INT }, \
+	{ "usermem", CTLTYPE_INT }, \
+	{ "pagesize", CTLTYPE_INT }, \
+	{ "drivenames", CTLTYPE_STRING }, \
+	{ "drivestats", CTLTYPE_STRUCT }, \
+	{ "machine_arch", CTLTYPE_STRING }, \
+	{ "alignbytes", CTLTYPE_INT }, \
+	{ "cnmagic", CTLTYPE_STRING }, \
+	{ "physmem64", CTLTYPE_QUAD }, \
+	{ "usermem64", CTLTYPE_QUAD }, \
+	{ "ncpuonline", CTLTYPE_INT }, \
+}
+
+/*
+ * CTL_USER definitions
+ */
+#define	USER_CS_PATH		 1	/* string: _CS_PATH */
+#define	USER_BC_BASE_MAX	 2	/* int: BC_BASE_MAX */
+#define	USER_BC_DIM_MAX		 3	/* int: BC_DIM_MAX */
+#define	USER_BC_SCALE_MAX	 4	/* int: BC_SCALE_MAX */
+#define	USER_BC_STRING_MAX	 5	/* int: BC_STRING_MAX */
+#define	USER_COLL_WEIGHTS_MAX	 6	/* int: COLL_WEIGHTS_MAX */
+#define	USER_EXPR_NEST_MAX	 7	/* int: EXPR_NEST_MAX */
+#define	USER_LINE_MAX		 8	/* int: LINE_MAX */
+#define	USER_RE_DUP_MAX		 9	/* int: RE_DUP_MAX */
+#define	USER_POSIX2_VERSION	10	/* int: POSIX2_VERSION */
+#define	USER_POSIX2_C_BIND	11	/* int: POSIX2_C_BIND */
+#define	USER_POSIX2_C_DEV	12	/* int: POSIX2_C_DEV */
+#define	USER_POSIX2_CHAR_TERM	13	/* int: POSIX2_CHAR_TERM */
+#define	USER_POSIX2_FORT_DEV	14	/* int: POSIX2_FORT_DEV */
+#define	USER_POSIX2_FORT_RUN	15	/* int: POSIX2_FORT_RUN */
+#define	USER_POSIX2_LOCALEDEF	16	/* int: POSIX2_LOCALEDEF */
+#define	USER_POSIX2_SW_DEV	17	/* int: POSIX2_SW_DEV */
+#define	USER_POSIX2_UPE		18	/* int: POSIX2_UPE */
+#define	USER_STREAM_MAX		19	/* int: POSIX2_STREAM_MAX */
+#define	USER_TZNAME_MAX		20	/* int: _POSIX_TZNAME_MAX */
+#define	USER_ATEXIT_MAX		21	/* int: {ATEXIT_MAX} */
+#define	USER_MAXID		22	/* number of valid user ids */
+
+#define	CTL_USER_NAMES { \
+	{ 0, 0 }, \
+	{ "cs_path", CTLTYPE_STRING }, \
+	{ "bc_base_max", CTLTYPE_INT }, \
+	{ "bc_dim_max", CTLTYPE_INT }, \
+	{ "bc_scale_max", CTLTYPE_INT }, \
+	{ "bc_string_max", CTLTYPE_INT }, \
+	{ "coll_weights_max", CTLTYPE_INT }, \
+	{ "expr_nest_max", CTLTYPE_INT }, \
+	{ "line_max", CTLTYPE_INT }, \
+	{ "re_dup_max", CTLTYPE_INT }, \
+	{ "posix2_version", CTLTYPE_INT }, \
+	{ "posix2_c_bind", CTLTYPE_INT }, \
+	{ "posix2_c_dev", CTLTYPE_INT }, \
+	{ "posix2_char_term", CTLTYPE_INT }, \
+	{ "posix2_fort_dev", CTLTYPE_INT }, \
+	{ "posix2_fort_run", CTLTYPE_INT }, \
+	{ "posix2_localedef", CTLTYPE_INT }, \
+	{ "posix2_sw_dev", CTLTYPE_INT }, \
+	{ "posix2_upe", CTLTYPE_INT }, \
+	{ "stream_max", CTLTYPE_INT }, \
+	{ "tzname_max", CTLTYPE_INT }, \
+	{ "atexit_max", CTLTYPE_INT }, \
+}
+
+/*
+ * CTL_DDB definitions
+ */
+#define	DDBCTL_RADIX		1	/* int: Input and output radix */
+#define	DDBCTL_MAXOFF		2	/* int: max symbol offset */
+#define	DDBCTL_MAXWIDTH		3	/* int: width of the display line */
+#define	DDBCTL_LINES		4	/* int: number of display lines */
+#define	DDBCTL_TABSTOPS		5	/* int: tab width */
+#define	DDBCTL_ONPANIC		6	/* int: DDB on panic if non-zero */
+#define	DDBCTL_FROMCONSOLE	7	/* int: DDB via console if non-zero */
+#define	DDBCTL_MAXID		8	/* number of valid DDB ids */
+
+#define	CTL_DDB_NAMES { \
+	{ 0, 0 }, \
+	{ "radix", CTLTYPE_INT }, \
+	{ "maxoff", CTLTYPE_INT }, \
+	{ "maxwidth", CTLTYPE_INT }, \
+	{ "lines", CTLTYPE_INT }, \
+	{ "tabstops", CTLTYPE_INT }, \
+	{ "onpanic", CTLTYPE_INT }, \
+	{ "fromconsole", CTLTYPE_INT }, \
+}
+
+/*
+ * CTL_DEBUG definitions
+ *
+ * Second level identifier specifies which debug variable.
+ * Third level identifier specifies which structure component.
+ */
+#define	CTL_DEBUG_NAME		0	/* string: variable name */
+#define	CTL_DEBUG_VALUE		1	/* int: variable value */
+#define	CTL_DEBUG_MAXID		20
+
+/*
+ * CTL_PROC subtype. Either a PID, or a magic value for the current proc.
+ */
+
+#define	PROC_CURPROC	(~((u_int)1 << 31))
+
+/*
+ * CTL_PROC tree: either corename (string), or a limit
+ * (rlimit.<type>.{hard,soft}, int).
+ */
+#define	PROC_PID_CORENAME	1
+#define	PROC_PID_LIMIT		2
+#define	PROC_PID_STOPFORK	3
+#define	PROC_PID_STOPEXEC	4
+#define	PROC_PID_STOPEXIT	5
+#define	PROC_PID_MAXID		6
+
+#define	PROC_PID_NAMES { \
+	{ 0, 0 }, \
+	{ "corename", CTLTYPE_STRING }, \
+	{ "rlimit", CTLTYPE_NODE }, \
+	{ "stopfork", CTLTYPE_INT }, \
+	{ "stopexec", CTLTYPE_INT }, \
+	{ "stopexit", CTLTYPE_INT }, \
+}
+
+/* Limit types from <sys/resources.h> */
+#define	PROC_PID_LIMIT_CPU	(RLIMIT_CPU+1)
+#define	PROC_PID_LIMIT_FSIZE	(RLIMIT_FSIZE+1)
+#define	PROC_PID_LIMIT_DATA	(RLIMIT_DATA+1)
+#define	PROC_PID_LIMIT_STACK	(RLIMIT_STACK+1)
+#define	PROC_PID_LIMIT_CORE	(RLIMIT_CORE+1)
+#define	PROC_PID_LIMIT_RSS	(RLIMIT_RSS+1)
+#define	PROC_PID_LIMIT_MEMLOCK	(RLIMIT_MEMLOCK+1)
+#define PROC_PID_LIMIT_NPROC	(RLIMIT_NPROC+1)
+#define	PROC_PID_LIMIT_NOFILE	(RLIMIT_NOFILE+1)
+#define	PROC_PID_LIMIT_SBSIZE	(RLIMIT_SBSIZE+1)
+#define	PROC_PID_LIMIT_AS	(RLIMIT_AS+1)
+#define	PROC_PID_LIMIT_NTHR	(RLIMIT_NTHR+1)
+#define	PROC_PID_LIMIT_MAXID 	(RLIM_NLIMITS+1)
+
+#define	PROC_PID_LIMIT_NAMES { \
+	{ 0, 0 }, \
+	{ "cputime", CTLTYPE_NODE }, \
+	{ "filesize", CTLTYPE_NODE }, \
+	{ "datasize", CTLTYPE_NODE }, \
+	{ "stacksize", CTLTYPE_NODE }, \
+	{ "coredumpsize", CTLTYPE_NODE }, \
+	{ "memoryuse", CTLTYPE_NODE }, \
+	{ "memorylocked", CTLTYPE_NODE }, \
+	{ "maxproc", CTLTYPE_NODE }, \
+	{ "descriptors", CTLTYPE_NODE }, \
+	{ "sbsize", CTLTYPE_NODE }, \
+	{ "vmemoryuse", CTLTYPE_NODE }, \
+	{ "maxlwp", CTLTYPE_NODE }, \
+}
+/* for each type, either hard or soft value */
+#define	PROC_PID_LIMIT_TYPE_SOFT	1
+#define	PROC_PID_LIMIT_TYPE_HARD	2
+#define	PROC_PID_LIMIT_TYPE_MAXID	3
+
+#define	PROC_PID_LIMIT_TYPE_NAMES { \
+	{0, 0}, \
+	{ "soft", CTLTYPE_QUAD }, \
+	{ "hard", CTLTYPE_QUAD }, \
+}
+
+/*
+ * CTL_EMUL definitions
+ *
+ * Second level identifier specifies which emulation variable.
+ * Subsequent levels are specified in the emulations themselves.
+ */
+#define	EMUL_LINUX	1
+#define	EMUL_LINUX32	5
+
+#define	EMUL_MAXID	6
+
+#ifdef _KERNEL
+
+#if defined(_KERNEL_OPT)
+#include "opt_sysctl.h"
+#endif
+
+/* Root node of the kernel sysctl tree */
+extern struct sysctlnode sysctl_root;
+
+/*
+ * A log of nodes created by a setup function or set of setup
+ * functions so that they can be torn down in one "transaction"
+ * when no longer needed.
+ *
+ * Users of the log merely pass a pointer to a pointer, and the sysctl
+ * infrastructure takes care of the rest.
+ */
+struct sysctllog;
+
+/*
+ * CTL_DEBUG variables.
+ *
+ * These are declared as separate variables so that they can be
+ * individually initialized at the location of their associated
+ * variable. The loader prevents multiple use by issuing errors
+ * if a variable is initialized in more than one place. They are
+ * aggregated into an array in debug_sysctl(), so that it can
+ * conveniently locate them when queried. If more debugging
+ * variables are added, they must also be declared here and also
+ * entered into the array.
+ *
+ * Note that the debug subtree is largely obsolescent in terms of
+ * functionality now that we have dynamic sysctl, but the
+ * infrastructure is retained for backwards compatibility.
+ */
+struct ctldebug {
+	const char *debugname;	/* name of debugging variable */
+	int	*debugvar;	/* pointer to debugging variable */
+};
+#ifdef	DEBUG
+extern struct ctldebug debug0, debug1, debug2, debug3, debug4;
+extern struct ctldebug debug5, debug6, debug7, debug8, debug9;
+extern struct ctldebug debug10, debug11, debug12, debug13, debug14;
+extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
+#endif	/* DEBUG */
+
+#define SYSCTLFN_PROTO const int *, u_int, void *, \
+	size_t *, const void *, size_t, \
+	const int *, struct lwp *, const struct sysctlnode *
+#define SYSCTLFN_ARGS const int *name, u_int namelen, \
+	void *oldp, size_t *oldlenp, \
+	const void *newp, size_t newlen, \
+	const int *oname, struct lwp *l, \
+	const struct sysctlnode *rnode
+#define SYSCTLFN_CALL(node) name, namelen, oldp, \
+	oldlenp, newp, newlen, \
+	oname, l, node
+
+#ifdef RUMP_USE_CTOR
+struct sysctl_setup_chain {
+	void (*ssc_func)(struct sysctllog **);
+	LIST_ENTRY(sysctl_setup_chain) ssc_entries;
+};
+LIST_HEAD(sysctl_boot_chain, sysctl_setup_chain);
+#define _SYSCTL_REGISTER(name)						\
+static void sysctlctor_##name(void) __attribute__((constructor));	\
+static void sysctlctor_##name(void)					\
+{									\
+        static struct sysctl_setup_chain ssc = {			\
+		.ssc_func = name,					\
+        };								\
+        extern struct sysctl_boot_chain sysctl_boot_chain;		\
+        LIST_INSERT_HEAD(&sysctl_boot_chain, &ssc, ssc_entries);	\
+}
+
+#else /* RUMP_USE_CTOR */
+
+#define _SYSCTL_REGISTER(name) __link_set_add_text(sysctl_funcs, name);
+
+#endif /* RUMP_USE_CTOR */
+
+#ifdef _MODULE
+
+#define SYSCTL_SETUP_PROTO(name)				\
+	void name(struct sysctllog **)
+#ifdef SYSCTL_DEBUG_SETUP
+#define SYSCTL_SETUP(name, desc)				\
+	SYSCTL_SETUP_PROTO(name);				\
+	static void __CONCAT(___,name)(struct sysctllog **);	\
+	void name(struct sysctllog **clog) {			\
+		printf("%s\n", desc);				\
+		__CONCAT(___,name)(clog); }			\
+	_SYSCTL_REGISTER(name);					\
+	static void __CONCAT(___,name)(struct sysctllog **clog)
+#else  /* !SYSCTL_DEBUG_SETUP */
+#define SYSCTL_SETUP(name, desc)				\
+	SYSCTL_SETUP_PROTO(name);				\
+	_SYSCTL_REGISTER(name);					\
+	void name(struct sysctllog **clog)
+#endif /* !SYSCTL_DEBUG_SETUP */
+
+#else /* !_MODULE */
+
+#define SYSCTL_SETUP_PROTO(name)
+#ifdef SYSCTL_DEBUG_SETUP
+#define SYSCTL_SETUP(name, desc)				\
+	static void __CONCAT(___,name)(struct sysctllog **);	\
+	static void name(struct sysctllog **clog) {		\
+		printf("%s\n", desc);				\
+		__CONCAT(___,name)(clog); }			\
+	_SYSCTL_REGISTER(name);					\
+	static void __CONCAT(___,name)(struct sysctllog **clog)
+#else  /* !SYSCTL_DEBUG_SETUP */
+#define SYSCTL_SETUP(name, desc)				\
+	static void name(struct sysctllog **);			\
+	_SYSCTL_REGISTER(name);					\
+	static void name(struct sysctllog **clog)
+#endif /* !SYSCTL_DEBUG_SETUP */
+
+#endif /* !_MODULE */
+
+/*
+ * Internal sysctl function calling convention:
+ *
+ *	(*sysctlfn)(name, namelen, oldval, oldlenp, newval, newlen,
+ *		    origname, lwp, node);
+ *
+ * The name parameter points at the next component of the name to be
+ * interpreted.  The namelen parameter is the number of integers in
+ * the name.  The origname parameter points to the start of the name
+ * being parsed.  The node parameter points to the node on which the
+ * current operation is to be performed.
+ */
+typedef int (*sysctlfn)(SYSCTLFN_PROTO);
+
+/*
+ * used in more than just sysctl
+ */
+void	fill_eproc(struct proc *, struct eproc *, bool);
+void	fill_kproc2(struct proc *, struct kinfo_proc2 *, bool);
+
+/*
+ * subsystem setup
+ */
+void	sysctl_init(void);
+void	sysctl_basenode_init(void);
+void	sysctl_finalize(void);
+
+/*
+ * typical syscall call order
+ */
+void	sysctl_lock(bool);
+int	sysctl_dispatch(SYSCTLFN_PROTO);
+void	sysctl_unlock(void);
+void	sysctl_relock(void);
+
+/*
+ * tree navigation primitives (must obtain lock before using these)
+ */
+int	sysctl_locate(struct lwp *, const int *, u_int,
+		      const struct sysctlnode **, int *);
+int	sysctl_query(SYSCTLFN_PROTO);
+int	sysctl_create(SYSCTLFN_PROTO);
+int	sysctl_destroy(SYSCTLFN_PROTO);
+int	sysctl_lookup(SYSCTLFN_PROTO);
+int	sysctl_describe(SYSCTLFN_PROTO);
+
+/*
+ * simple variadic interface for adding/removing nodes
+ */
+int	sysctl_createv(struct sysctllog **, int,
+		       const struct sysctlnode **, const struct sysctlnode **,
+		       int, int, const char *, const char *,
+		       sysctlfn, u_quad_t, void *, size_t, ...);
+int	sysctl_destroyv(struct sysctlnode *, ...);
+
+#define VERIFY_FN(ctl_type, c_type) \
+__always_inline static __inline void * \
+__sysctl_verify_##ctl_type##_arg(c_type *arg) \
+{ \
+    return arg; \
+}
+
+VERIFY_FN(CTLTYPE_NODE, struct sysctlnode);
+VERIFY_FN(CTLTYPE_INT, int);
+VERIFY_FN(CTLTYPE_STRING, char);
+VERIFY_FN(CTLTYPE_QUAD, int64_t);
+VERIFY_FN(CTLTYPE_STRUCT, void);
+VERIFY_FN(CTLTYPE_BOOL, bool);
+VERIFY_FN(CTLTYPE_LONG, long);
+#undef VERIFY_FN
+
+#define sysctl_createv(lg, cfl, rn, cn, fl, type, nm, desc, fn, qv, newp, ...) \
+    sysctl_createv(lg, cfl, rn, cn, fl, type, nm, desc, fn, qv, \
+	    __sysctl_verify_##type##_arg(newp), __VA_ARGS__)
+
+/*
+ * miscellany
+ */
+void	sysctl_dump(const struct sysctlnode *);
+void	sysctl_free(struct sysctlnode *);
+void	sysctl_teardown(struct sysctllog **);
+void	sysctl_log_print(const struct sysctllog *);
+
+#ifdef SYSCTL_INCLUDE_DESCR
+#define SYSCTL_DESCR(s) s
+#else /* SYSCTL_INCLUDE_DESCR */
+#define SYSCTL_DESCR(s) NULL
+#endif /* SYSCTL_INCLUDE_DESCR */
+
+/*
+ * simple interface similar to old interface for in-kernel consumption
+ */
+int	old_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct lwp *);
+
+/*
+ * these helpers are in other files (XXX so should the nodes be) or
+ * are used by more than one node
+ */
+int	sysctl_hw_tapenames(SYSCTLFN_PROTO);
+int	sysctl_hw_tapestats(SYSCTLFN_PROTO);
+int	sysctl_kern_vnode(SYSCTLFN_PROTO);
+int	sysctl_net_inet_ip_ports(SYSCTLFN_PROTO);
+int	sysctl_consdev(SYSCTLFN_PROTO);
+int	sysctl_root_device(SYSCTLFN_PROTO);
+int	sysctl_vfs_generic_fstypes(SYSCTLFN_PROTO);
+
+/*
+ * primitive helper stubs
+ */
+int	sysctl_needfunc(SYSCTLFN_PROTO);
+int	sysctl_notavail(SYSCTLFN_PROTO);
+int	sysctl_null(SYSCTLFN_PROTO);
+
+int	sysctl_copyin(struct lwp *, const void *, void *, size_t);
+int	sysctl_copyout(struct lwp *, const void *, void *, size_t);
+int	sysctl_copyinstr(struct lwp *, const void *, void *, size_t, size_t *);
+
+u_int	sysctl_map_flags(const u_int *, u_int);
+
+MALLOC_DECLARE(M_SYSCTLNODE);
+MALLOC_DECLARE(M_SYSCTLDATA);
+
+extern const u_int sysctl_lwpflagmap[];
+
+#else	/* !_KERNEL */
+#include <sys/cdefs.h>
+
+typedef void *sysctlfn;
+
+__BEGIN_DECLS
+int	sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
+int	sysctlbyname(const char *, void *, size_t *, const void *, size_t);
+int	sysctlgetmibinfo(const char *, int *, u_int *,
+			 char *, size_t *, struct sysctlnode **, int);
+int	sysctlnametomib(const char *, int *, size_t *);
+int	proc_compare(const struct kinfo_proc2 *, const struct kinfo_lwp *,
+    const struct kinfo_proc2 *, const struct kinfo_lwp *);
+void	*asysctl(const int *, size_t, size_t *);
+void	*asysctlbyname(const char *, size_t *);
+__END_DECLS
+
+#endif	/* !_KERNEL */
+
+#ifdef __COMPAT_SYSCTL
+/*
+ * old node definitions go here
+ */
+#endif /* __COMPAT_SYSCTL */
+
+/*
+ * padding makes alignment magically "work" for 32/64 compatibility at
+ * the expense of making things bigger on 32 bit platforms.
+ */
+#if defined(_LP64) || (BYTE_ORDER == LITTLE_ENDIAN)
+#define __sysc_pad(type) union { uint64_t __sysc_upad; \
+	struct { type __sysc_sdatum; } __sysc_ustr; }
+#else
+#define __sysc_pad(type) union { uint64_t __sysc_upad; \
+	struct { uint32_t __sysc_spad; type __sysc_sdatum; } __sysc_ustr; }
+#endif
+#define __sysc_unpad(x) x.__sysc_ustr.__sysc_sdatum
+
+/*
+ * The following is for gcc2, which doesn't handle __sysc_unpad().
+ * The code gets a little less ugly this way.
+ */
+#define sysc_init_field(field, value) 	\
+	.field = { .__sysc_ustr = { .__sysc_sdatum = (value), }, }
+
+struct sysctlnode {
+	uint32_t sysctl_flags;		/* flags and type */
+	int32_t sysctl_num;		/* mib number */
+	char sysctl_name[SYSCTL_NAMELEN]; /* node name */
+	uint32_t sysctl_ver;		/* node's version vs. rest of tree */
+	uint32_t __rsvd;
+	union {
+		struct {
+			uint32_t suc_csize;	/* size of child node array */
+			uint32_t suc_clen;	/* number of valid children */
+			__sysc_pad(struct sysctlnode*) _suc_child; /* array of child nodes */
+		} scu_child;
+		struct {
+			__sysc_pad(void*) _sud_data; /* pointer to external data */
+			__sysc_pad(size_t) _sud_offset; /* offset to data */
+		} scu_data;
+		int32_t scu_alias;		/* node this node refers to */
+		int32_t scu_idata;		/* immediate "int" data */
+		u_quad_t scu_qdata;		/* immediate "u_quad_t" data */
+		bool scu_bdata;			/* immediate bool data */
+	} sysctl_un;
+	__sysc_pad(size_t) _sysctl_size;	/* size of instrumented data */
+	__sysc_pad(sysctlfn) _sysctl_func;	/* access helper function */
+	__sysc_pad(struct sysctlnode*) _sysctl_parent; /* parent of this node */
+	__sysc_pad(const char *) _sysctl_desc;	/* description of node */
+};
+
+/*
+ * padded data
+ */
+#define suc_child	__sysc_unpad(_suc_child)
+#define sud_data	__sysc_unpad(_sud_data)
+#define sud_offset	__sysc_unpad(_sud_offset)
+#define sysctl_size	__sysc_unpad(_sysctl_size)
+#define sysctl_func	__sysc_unpad(_sysctl_func)
+#define sysctl_parent	__sysc_unpad(_sysctl_parent)
+#define sysctl_desc	__sysc_unpad(_sysctl_desc)
+
+/*
+ * nested data (may also be padded)
+ */
+#define sysctl_csize	sysctl_un.scu_child.suc_csize
+#define sysctl_clen	sysctl_un.scu_child.suc_clen
+#define sysctl_child	sysctl_un.scu_child.suc_child
+#define sysctl_data	sysctl_un.scu_data.sud_data
+#define sysctl_offset	sysctl_un.scu_data.sud_offset
+#define sysctl_alias	sysctl_un.scu_alias
+#define sysctl_idata	sysctl_un.scu_idata
+#define sysctl_qdata	sysctl_un.scu_qdata
+#define sysctl_bdata	sysctl_un.scu_bdata
+
+/*
+ * when requesting a description of a node (a set of nodes, actually),
+ * you get back an "array" of these, where the actual length of the
+ * descr_str is noted in descr_len (which includes the trailing nul
+ * byte), rounded up to the nearest four (sizeof(int32_t) actually).
+ *
+ * NEXT_DESCR() will take a pointer to a description and advance it to
+ * the next description.
+ */
+struct sysctldesc {
+	int32_t		descr_num;	/* mib number of node */
+	uint32_t	descr_ver;	/* version of node */
+	uint32_t	descr_len;	/* length of description string */
+	char		descr_str[1];	/* not really 1...see above */
+};
+
+#define __sysc_desc_roundup(x) ((((x) - 1) | (sizeof(int32_t) - 1)) + 1)
+#define __sysc_desc_adv(d, l) \
+	(/*XXXUNCONST ptr cast*/(struct sysctldesc *) \
+	__UNCONST(((const char*)(d)) + offsetof(struct sysctldesc, descr_str) +\
+		__sysc_desc_roundup(l)))
+#define NEXT_DESCR(d) __sysc_desc_adv((d), (d)->descr_len)
+
+static __inline const struct sysctlnode *
+sysctl_rootof(const struct sysctlnode *n)
+{
+	while (n->sysctl_parent != NULL)
+		n = n->sysctl_parent;
+	return (n);
+}
+
+#endif	/* !_SYS_SYSCTL_H_ */

Property changes on: lab4/.minix-src/include/sys/sysctl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/termios.h
===================================================================
--- lab4/.minix-src/include/sys/termios.h	(nonexistent)
+++ lab4/.minix-src/include/sys/termios.h	(revision 13)
@@ -0,0 +1,304 @@
+/*	$NetBSD: termios.h,v 1.32 2013/07/11 16:46:06 christos Exp $	*/
+
+/*
+ * Copyright (c) 1988, 1989, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)termios.h	8.3 (Berkeley) 3/28/94
+ */
+
+#ifndef _SYS_TERMIOS_H_
+#define _SYS_TERMIOS_H_
+
+#include <sys/ansi.h>
+#include <sys/featuretest.h>
+
+/*
+ * Special Control Characters
+ *
+ * Index into c_cc[] character array.
+ *
+ *	Name	     Subscript	Enabled by
+ */
+#define	VEOF		0	/* ICANON */
+#define	VEOL		1	/* ICANON */
+#if defined(_NETBSD_SOURCE)
+#define	VEOL2		2	/* ICANON */
+#endif
+#define	VERASE		3	/* ICANON */
+#if defined(_NETBSD_SOURCE)
+#define VWERASE 	4	/* ICANON */
+#endif
+#define VKILL		5	/* ICANON */
+#if defined(_NETBSD_SOURCE)
+#define	VREPRINT 	6	/* ICANON */
+#endif
+/*			7	   spare 1 */
+#define VINTR		8	/* ISIG */
+#define VQUIT		9	/* ISIG */
+#define VSUSP		10	/* ISIG */
+#if defined(_NETBSD_SOURCE)
+#define VDSUSP		11	/* ISIG */
+#endif
+#define VSTART		12	/* IXON, IXOFF */
+#define VSTOP		13	/* IXON, IXOFF */
+#if defined(_NETBSD_SOURCE)
+#define	VLNEXT		14	/* IEXTEN */
+#define	VDISCARD	15	/* IEXTEN */
+#endif
+#define VMIN		16	/* !ICANON */
+#define VTIME		17	/* !ICANON */
+#if defined(_NETBSD_SOURCE)
+#define VSTATUS		18	/* ICANON */
+/*			19	   spare 2 */
+#endif
+#define	NCCS		20
+
+#define _POSIX_VDISABLE	__CAST(unsigned char, '\377')
+
+#if defined(_NETBSD_SOURCE)
+#define CCEQ(val, c)	(c == val ? val != _POSIX_VDISABLE : 0)
+#endif
+
+/*
+ * Input flags - software input processing
+ */
+#define	IGNBRK		0x00000001U	/* ignore BREAK condition */
+#define	BRKINT		0x00000002U	/* map BREAK to SIGINT */
+#define	IGNPAR		0x00000004U	/* ignore (discard) parity errors */
+#define	PARMRK		0x00000008U	/* mark parity and framing errors */
+#define	INPCK		0x00000010U	/* enable checking of parity errors */
+#define	ISTRIP		0x00000020U	/* strip 8th bit off chars */
+#define	INLCR		0x00000040U	/* map NL into CR */
+#define	IGNCR		0x00000080U	/* ignore CR */
+#define	ICRNL		0x00000100U	/* map CR to NL (ala CRMOD) */
+#define	IXON		0x00000200U	/* enable output flow control */
+#define	IXOFF		0x00000400U	/* enable input flow control */
+#if defined(_NETBSD_SOURCE)
+#define	IXANY		0x00000800U	/* any char will restart after stop */
+#endif
+#if defined(_NETBSD_SOURCE)
+#define IMAXBEL		0x00002000U	/* ring bell on input queue full */
+#endif
+
+/*
+ * Output flags - software output processing
+ */
+#define	OPOST		0x00000001U	/* enable following output processing */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define ONLCR		0x00000002U	/* map NL to CR-NL (ala CRMOD) */
+#endif
+#if defined(_NETBSD_SOURCE)
+#define OXTABS		0x00000004U	/* expand tabs to spaces */
+#define ONOEOT		0x00000008U	/* discard EOT's (^D) on output */
+#endif
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define OCRNL		0x00000010U	/* map CR to NL */
+#define ONOCR		0x00000020U	/* discard CR's when on column 0 */
+#define ONLRET		0x00000040U	/* move to column 0 on CR */
+#endif  /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
+
+/*
+ * Control flags - hardware control of terminal
+ */
+#if defined(_NETBSD_SOURCE)
+#define	CIGNORE		0x00000001U	/* ignore control flags */
+#endif
+#define CSIZE		0x00000300U	/* character size mask */
+#define     CS5		    0x00000000U	    /* 5 bits (pseudo) */
+#define     CS6		    0x00000100U	    /* 6 bits */
+#define     CS7		    0x00000200U	    /* 7 bits */
+#define     CS8		    0x00000300U	    /* 8 bits */
+#define CSTOPB		0x00000400U	/* send 2 stop bits */
+#define CREAD		0x00000800U	/* enable receiver */
+#define PARENB		0x00001000U	/* parity enable */
+#define PARODD		0x00002000U	/* odd parity, else even */
+#define HUPCL		0x00004000U	/* hang up on last close */
+#define CLOCAL		0x00008000U	/* ignore modem status lines */
+#if defined(_NETBSD_SOURCE)
+#define	CRTSCTS		0x00010000U	/* RTS/CTS full-duplex flow control */
+#define	CRTS_IFLOW	CRTSCTS		/* XXX compat */
+#define	CCTS_OFLOW	CRTSCTS		/* XXX compat */
+#define	CDTRCTS		0x00020000U	/* DTR/CTS full-duplex flow control */
+#define	MDMBUF		0x00100000U	/* DTR/DCD hardware flow control */
+#define	CHWFLOW		(MDMBUF|CRTSCTS|CDTRCTS) /* all types of hw flow control */
+#endif
+
+
+/*
+ * "Local" flags - dumping ground for other state
+ *
+ * Warning: some flags in this structure begin with
+ * the letter "I" and look like they belong in the
+ * input flag.
+ */
+
+#if defined(_NETBSD_SOURCE)
+#define	ECHOKE		0x00000001U	/* visual erase for line kill */
+#endif
+#define	ECHOE		0x00000002U	/* visually erase chars */
+#define	ECHOK		0x00000004U	/* echo NL after line kill */
+#define ECHO		0x00000008U	/* enable echoing */
+#define	ECHONL		0x00000010U	/* echo NL even if ECHO is off */
+#if defined(_NETBSD_SOURCE)
+#define	ECHOPRT		0x00000020U	/* visual erase mode for hardcopy */
+#define ECHOCTL  	0x00000040U	/* echo control chars as ^(Char) */
+#endif  /* defined(_NETBSD_SOURCE) */
+#define	ISIG		0x00000080U	/* enable signals INT, QUIT, [D]SUSP */
+#define	ICANON		0x00000100U	/* canonicalize input lines */
+#if defined(_NETBSD_SOURCE)
+#define ALTWERASE	0x00000200U	/* use alternate WERASE algorithm */
+#endif /* defined(_NETBSD_SOURCE) */
+#define	IEXTEN		0x00000400U	/* enable DISCARD and LNEXT */
+#if defined(_NETBSD_SOURCE)
+#define EXTPROC         0x00000800U	/* external processing */
+#endif /* defined(_NETBSD_SOURCE) */
+#define TOSTOP		0x00400000U	/* stop background jobs on output */
+#if defined(_NETBSD_SOURCE)
+#define FLUSHO		0x00800000U	/* output being flushed (state) */
+#define	NOKERNINFO	0x02000000U	/* no kernel output from VSTATUS */
+#define PENDIN		0x20000000U	/* re-echo input buffer at next read */
+#endif /* defined(_NETBSD_SOURCE) */
+#define	NOFLSH		0x80000000U	/* don't flush output on signal */
+
+typedef unsigned int	tcflag_t;
+typedef unsigned char	cc_t;
+typedef unsigned int	speed_t;
+
+struct termios {
+	tcflag_t	c_iflag;	/* input flags */
+	tcflag_t	c_oflag;	/* output flags */
+	tcflag_t	c_cflag;	/* control flags */
+	tcflag_t	c_lflag;	/* local flags */
+	cc_t		c_cc[NCCS];	/* control chars */
+	int		c_ispeed;	/* input speed */
+	int		c_ospeed;	/* output speed */
+};
+
+/*
+ * Commands passed to tcsetattr() for setting the termios structure.
+ */
+#define	TCSANOW		0		/* make change immediate */
+#define	TCSADRAIN	1		/* drain output, then change */
+#define	TCSAFLUSH	2		/* drain output, flush input */
+#if defined(_NETBSD_SOURCE)
+#define TCSASOFT	0x10		/* flag - don't alter h.w. state */
+#endif
+
+/*
+ * Standard speeds
+ */
+#define B0	0U
+#define B50	50U
+#define B75	75U
+#define B110	110U
+#define B134	134U
+#define B150	150U
+#define B200	200U
+#define B300	300U
+#define B600	600U
+#define B1200	1200U
+#define	B1800	1800U
+#define B2400	2400U
+#define B4800	4800U
+#define B9600	9600U
+#define B19200	19200U
+#define B38400	38400U
+#if defined(_NETBSD_SOURCE)
+#define B7200	7200U
+#define B14400	14400U
+#define B28800	28800U
+#define B57600	57600U
+#define B76800	76800U
+#define B115200	115200U
+#define B230400	230400U
+#define B460800	460800U
+#define B921600	921600U
+#define EXTA	19200U
+#define EXTB	38400U
+#endif  /* defined(_NETBSD_SOURCE) */
+
+#ifndef _KERNEL
+
+#define	TCIFLUSH	1
+#define	TCOFLUSH	2
+#define TCIOFLUSH	3
+#define	TCOOFF		1
+#define	TCOON		2
+#define TCIOFF		3
+#define TCION		4
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#ifndef	pid_t
+typedef	__pid_t		pid_t;
+#define	pid_t		__pid_t
+#endif
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+speed_t	cfgetispeed(const struct termios *);
+speed_t	cfgetospeed(const struct termios *);
+int	cfsetispeed(struct termios *, speed_t);
+int	cfsetospeed(struct termios *, speed_t);
+int	tcgetattr(int, struct termios *);
+int	tcsetattr(int, int, const struct termios *);
+int	tcdrain(int);
+int	tcflow(int, int);
+int	tcflush(int, int);
+int	tcsendbreak(int, int);
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+pid_t	tcgetsid(int);
+#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
+
+
+#if defined(_NETBSD_SOURCE)
+void	cfmakeraw(struct termios *);
+int	cfsetspeed(struct termios *, speed_t);
+#endif /* defined(_NETBSD_SOURCE) */
+__END_DECLS
+
+#endif /* !_KERNEL */
+
+#if defined(_NETBSD_SOURCE)
+
+/*
+ * Include tty ioctl's that aren't just for backwards compatibility
+ * with the old tty driver.  These ioctl definitions were previously
+ * in <sys/ioctl.h>.
+ */
+#include <sys/ttycom.h>
+#endif
+
+/*
+ * END OF PROTECTED INCLUDE.
+ */
+#endif /* !_SYS_TERMIOS_H_ */
+
+#if defined(_NETBSD_SOURCE)
+#include <sys/ttydefaults.h>
+#endif

Property changes on: lab4/.minix-src/include/sys/termios.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/times.h
===================================================================
--- lab4/.minix-src/include/sys/times.h	(nonexistent)
+++ lab4/.minix-src/include/sys/times.h	(revision 13)
@@ -0,0 +1,65 @@
+/*	$NetBSD: times.h,v 1.13 2005/12/11 12:25:21 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)times.h	8.4 (Berkeley) 1/21/94
+ */
+
+#ifndef	_SYS_TIMES_H_
+#define	_SYS_TIMES_H_
+
+#include <machine/ansi.h>
+
+#ifdef	_BSD_CLOCK_T_
+typedef	_BSD_CLOCK_T_	clock_t;
+#undef	_BSD_CLOCK_T_
+#endif
+
+struct tms {
+	clock_t tms_utime;	/* User CPU time */
+	clock_t tms_stime;	/* System CPU time */
+	clock_t tms_cutime;	/* User CPU time of terminated child procs */
+	clock_t tms_cstime;	/* System CPU time of terminated child procs */
+};
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+clock_t times(struct tms *) __RENAME(__times13);
+#endif
+__END_DECLS
+#endif
+#endif /* !_SYS_TIMES_H_ */

Property changes on: lab4/.minix-src/include/sys/times.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/trace.h
===================================================================
--- lab4/.minix-src/include/sys/trace.h	(nonexistent)
+++ lab4/.minix-src/include/sys/trace.h	(revision 13)
@@ -0,0 +1,119 @@
+/*	$NetBSD: trace.h,v 1.11 2005/12/11 12:25:21 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)trace.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_TRACE_H_
+#define _SYS_TRACE_H_
+
+/*
+ * File system buffer tracing points; all trace <pack(dev, size), bn>
+ */
+#define	TR_BREADHIT	0	/* buffer read found in cache */
+#define	TR_BREADMISS	1	/* buffer read not in cache */
+#define	TR_BWRITE	2	/* buffer written */
+#define	TR_BREADHITRA	3	/* buffer read-ahead found in cache */
+#define	TR_BREADMISSRA	4	/* buffer read-ahead not in cache */
+#define	TR_XFODMISS	5	/* exe fod read */
+#define	TR_XFODHIT	6	/* exe fod read */
+#define	TR_BRELSE	7	/* brelse */
+#define	TR_BREALLOC	8	/* expand/contract a buffer */
+
+/*
+ * Memory allocator trace points; all trace the amount of memory involved
+ */
+#define	TR_MALL		10	/* memory allocated */
+
+/*
+ * Paging trace points: all are <vaddr, pid>
+ */
+#define	TR_INTRANS	20	/* page intransit block */
+#define	TR_EINTRANS	21	/* page intransit wait done */
+#define	TR_FRECLAIM	22	/* reclaim from free list */
+#define	TR_RECLAIM	23	/* reclaim from loop */
+#define	TR_XSFREC	24	/* reclaim from free list instead of drum */
+#define	TR_XIFREC	25	/* reclaim from free list instead of fsys */
+#define	TR_WAITMEM	26	/* wait for memory in pagein */
+#define	TR_EWAITMEM	27	/* end memory wait in pagein */
+#define	TR_ZFOD		28	/* zfod page fault */
+#define	TR_EXFOD	29	/* exec fod page fault */
+#define	TR_VRFOD	30	/* vread fod page fault */
+#define	TR_CACHEFOD	31	/* fod in file system cache */
+#define	TR_SWAPIN	32	/* drum page fault */
+#define	TR_PGINDONE	33	/* page in done */
+#define	TR_SWAPIO	34	/* swap i/o request arrives */
+
+/*
+ * System call trace points.
+ */
+#define	TR_VADVISE	40	/* vadvise occurred with <arg, pid> */
+
+/*
+ * Miscellaneous
+ */
+#define	TR_STAMP	45	/* user said vtrace(VTR_STAMP, value); */
+
+/*
+ * This defines the size of the trace flags array.
+ */
+#define	TR_NFLAGS	100	/* generous */
+
+#define	TRCSIZ		4096
+
+/*
+ * Specifications of the vtrace() system call, which takes one argument.
+ */
+#define	VTRACE		64+51
+
+#define	VTR_DISABLE	0		/* set a trace flag to 0 */
+#define	VTR_ENABLE	1		/* set a trace flag to 1 */
+#define	VTR_VALUE	2		/* return value of a trace flag */
+#define	VTR_UALARM	3		/* set alarm to go off (sig 16) */
+					/* in specified number of hz */
+#define	VTR_STAMP	4		/* user specified stamp */
+
+#ifdef _KERNEL
+#ifdef TRACE
+struct	proc *traceproc;
+int	tracewhich, tracebuf[TRCSIZ];
+u_int	tracex;
+char	traceflags[TR_NFLAGS];
+#define	pack(v,b)	(((v)->v_mount->mnt_stat.f_fsidx.__fsid_val[0])<<16)|(b)
+#define	trace(a,b,c) {							\
+	if (traceflags[a])						\
+		trace1(a,b,c);						\
+}
+#else
+#define	trace(a,b,c)
+#endif /* TRACE */
+#endif /* _KERNEL */
+
+#endif /* !_SYS_TRACE_H_ */

Property changes on: lab4/.minix-src/include/sys/trace.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ttycom.h
===================================================================
--- lab4/.minix-src/include/sys/ttycom.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ttycom.h	(revision 13)
@@ -0,0 +1,179 @@
+/*	$NetBSD: ttycom.h,v 1.20 2012/10/19 16:49:21 apb Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ttycom.h	8.1 (Berkeley) 3/28/94
+ */
+
+#ifndef	_SYS_TTYCOM_H_
+#define	_SYS_TTYCOM_H_
+
+#include <sys/syslimits.h>
+#include <sys/ioccom.h>
+
+/*
+ * Tty ioctl's except for those supported only for backwards compatibility
+ * with the old tty driver.
+ */
+
+/*
+ * Window/terminal size structure.  This information is stored by the kernel
+ * in order to provide a consistent interface, but is not used by the kernel.
+ */
+struct winsize {
+	unsigned short	ws_row;		/* rows, in characters */
+	unsigned short	ws_col;		/* columns, in characters */
+	unsigned short	ws_xpixel;	/* horizontal size, pixels */
+	unsigned short	ws_ypixel;	/* vertical size, pixels */
+};
+
+/* ptmget, for /dev/ptm pty getting ioctl TIOCPTMGET, and for TIOCPTSNAME */
+struct ptmget {
+	int	cfd;
+	int	sfd;
+	char	cn[PATH_MAX];
+	char	sn[PATH_MAX];
+};
+
+#define _PATH_PTMDEV	"/dev/ptm"
+
+#define		TIOCM_LE	0001		/* line enable */
+#define		TIOCM_DTR	0002		/* data terminal ready */
+#define		TIOCM_RTS	0004		/* request to send */
+#define		TIOCM_ST	0010		/* secondary transmit */
+#define		TIOCM_SR	0020		/* secondary receive */
+#define		TIOCM_CTS	0040		/* clear to send */
+#define		TIOCM_CAR	0100		/* carrier detect */
+#define		TIOCM_CD	TIOCM_CAR
+#define		TIOCM_RNG	0200		/* ring */
+#define		TIOCM_RI	TIOCM_RNG
+#define		TIOCM_DSR	0400		/* data set ready */
+						/* 8-10 compat */
+#define	TIOCEXCL	 _IO('t', 13)		/* set exclusive use of tty */
+#define	TIOCNXCL	 _IO('t', 14)		/* reset exclusive use of tty */
+						/* 15 unused */
+#define	TIOCFLUSH	_IOW('t', 16, int)	/* flush buffers */
+						/* 17-18 compat */
+#define	TIOCGETA	_IOR('t', 19, struct termios) /* get termios struct */
+#define	TIOCSETA	_IOW('t', 20, struct termios) /* set termios struct */
+#define	TIOCSETAW	_IOW('t', 21, struct termios) /* drain output, set */
+#define	TIOCSETAF	_IOW('t', 22, struct termios) /* drn out, fls in, set */
+#define	TIOCGETD	_IOR('t', 26, int)	/* get line discipline (deprecated) */
+#define	TIOCSETD	_IOW('t', 27, int)	/* set line discipline (deprecated) */
+
+/*
+ * This is the maximum length of a line discipline's name.
+ */
+#define	TTLINEDNAMELEN	32
+typedef char linedn_t[TTLINEDNAMELEN];
+#define TIOCGLINED	_IOR('t', 66, linedn_t)	/* get line discipline (new) */
+#define TIOCSLINED	_IOW('t', 67, linedn_t)	/* set line discipline (new) */
+						/* 127-124 compat */
+#define	TIOCSBRK	 _IO('t', 123)		/* set break bit */
+#define	TIOCCBRK	 _IO('t', 122)		/* clear break bit */
+#define	TIOCSDTR	 _IO('t', 121)		/* set data terminal ready */
+#define	TIOCCDTR	 _IO('t', 120)		/* clear data terminal ready */
+#define	TIOCGPGRP	_IOR('t', 119, int)	/* get pgrp of tty */
+#define	TIOCSPGRP	_IOW('t', 118, int)	/* set pgrp of tty */
+						/* 117-116 compat */
+#define	TIOCOUTQ	_IOR('t', 115, int)	/* output queue size */
+#define	TIOCSTI		_IOW('t', 114, char)	/* simulate terminal input */
+#define	TIOCNOTTY	 _IO('t', 113)		/* void tty association */
+#define	TIOCPKT		_IOW('t', 112, int)	/* pty: set/clear packet mode */
+#define		TIOCPKT_DATA		0x00	/* data packet */
+#define		TIOCPKT_FLUSHREAD	0x01	/* flush packet */
+#define		TIOCPKT_FLUSHWRITE	0x02	/* flush packet */
+#define		TIOCPKT_STOP		0x04	/* stop output */
+#define		TIOCPKT_START		0x08	/* start output */
+#define		TIOCPKT_NOSTOP		0x10	/* no more ^S, ^Q */
+#define		TIOCPKT_DOSTOP		0x20	/* now do ^S ^Q */
+#define		TIOCPKT_IOCTL		0x40	/* state change of pty driver */
+#define	TIOCSTOP	 _IO('t', 111)		/* stop output, like ^S */
+#define	TIOCSTART	 _IO('t', 110)		/* start output, like ^Q */
+#define	TIOCMSET	_IOW('t', 109, int)	/* set all modem bits */
+#define	TIOCMBIS	_IOW('t', 108, int)	/* bis modem bits */
+#define	TIOCMBIC	_IOW('t', 107, int)	/* bic modem bits */
+#define	TIOCMGET	_IOR('t', 106, int)	/* get all modem bits */
+#define	TIOCREMOTE	_IOW('t', 105, int)	/* remote input editing */
+#define	TIOCGWINSZ	_IOR('t', 104, struct winsize)	/* get window size */
+#define	TIOCSWINSZ	_IOW('t', 103, struct winsize)	/* set window size */
+#define	TIOCUCNTL	_IOW('t', 102, int)	/* pty: set/clr usr cntl mode */
+#define	TIOCSTAT	_IOW('t', 101, int)	/* generate status message */
+#define		UIOCCMD(n)	_IO('u', n)	/* usr cntl op "n" */
+#define	TIOCGSID	_IOR('t', 99, int)	/* get session id */
+#define	TIOCCONS	_IOW('t', 98, int)	/* become virtual console */
+#define	TIOCSCTTY	 _IO('t', 97)		/* become controlling tty */
+#define	TIOCEXT		_IOW('t', 96, int)	/* pty: external processing */
+#define	TIOCSIG		 _IO('t', 95)		/* pty: generate signal */
+#define	TIOCDRAIN	 _IO('t', 94)		/* wait till output drained */
+#define	TIOCGFLAGS	_IOR('t', 93, int)	/* get device flags */
+#define	TIOCSFLAGS	_IOW('t', 92, int)	/* set device flags */
+#define		TIOCFLAG_SOFTCAR	0x01	/* ignore hardware carrier */
+#define		TIOCFLAG_CLOCAL		0x02	/* set clocal on open */
+#define		TIOCFLAG_CRTSCTS	0x04	/* set crtscts on open */
+#define		TIOCFLAG_MDMBUF		0x08	/* set mdmbuf on open */
+#define		TIOCFLAG_CDTRCTS	0x10	/* set cdtrcts on open */
+#define	TIOCDCDTIMESTAMP _IOR('t', 88, struct timeval) /* get timestamp of last
+						 * Cd rise, stamp next rise */
+
+#define	TIOCRCVFRAME	_IOW('t', 69, struct mbuf *)/* data frame received */
+#define	TIOCXMTFRAME	_IOW('t', 68, struct mbuf *)/* data frame transmit */
+
+#define TIOCPTMGET 	 _IOR('t', 70, struct ptmget)	/* get ptys */
+#define TIOCGRANTPT 	 _IO('t', 71) 			/* grantpt(3) */
+#define TIOCPTSNAME 	 _IOR('t', 72, struct ptmget)	/* ptsname(3) */
+
+#define TIOCSQSIZE	 _IOW('t', 128, int)	/* set queue size */
+#define TIOCGQSIZE	 _IOR('t', 129, int)	/* get queue size */
+
+#define	TTYDISC		0		/* termios tty line discipline */
+#define	TABLDISC	3		/* tablet discipline */
+#define	SLIPDISC	4		/* serial IP discipline */
+#define	PPPDISC		5		/* ppp discipline */
+#define	STRIPDISC	6		/* metricom wireless IP discipline */
+#define	HDLCDISC	9		/* HDLC discipline */
+
+#if defined(__minix)
+
+/* Terminal ioctls. Use big T. */
+#define TIOCSFON        _IOW_BIG(1, u8_t [8192])	/* new font */
+
+/* Keyboard ioctls. */
+#define KIOCBELL        _IOW('k', 1, struct kio_bell)
+#define KIOCSLEDS       _IOW('k', 2, struct kio_leds)
+#define KIOCSMAP        _IOW('k', 3, keymap_t)
+
+#endif /* defined(__minix) */
+
+#endif /* !_SYS_TTYCOM_H_ */

Property changes on: lab4/.minix-src/include/sys/ttycom.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/stdint.h
===================================================================
--- lab4/.minix-src/include/sys/stdint.h	(nonexistent)
+++ lab4/.minix-src/include/sys/stdint.h	(revision 13)
@@ -0,0 +1,102 @@
+/*	$NetBSD: stdint.h,v 1.7 2013/04/22 21:26:48 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_STDINT_H_
+#define _SYS_STDINT_H_
+
+#include <sys/cdefs.h>
+#include <machine/int_types.h>
+
+#ifndef	int8_t
+typedef	__int8_t	int8_t;
+#define	int8_t		__int8_t
+#endif
+
+#ifndef	uint8_t
+typedef	__uint8_t	uint8_t;
+#define	uint8_t		__uint8_t
+#endif
+
+#ifndef	int16_t
+typedef	__int16_t	int16_t;
+#define	int16_t		__int16_t
+#endif
+
+#ifndef	uint16_t
+typedef	__uint16_t	uint16_t;
+#define	uint16_t	__uint16_t
+#endif
+
+#ifndef	int32_t
+typedef	__int32_t	int32_t;
+#define	int32_t		__int32_t
+#endif
+
+#ifndef	uint32_t
+typedef	__uint32_t	uint32_t;
+#define	uint32_t	__uint32_t
+#endif
+
+#ifndef	int64_t
+typedef	__int64_t	int64_t;
+#define	int64_t		__int64_t
+#endif
+
+#ifndef	uint64_t
+typedef	__uint64_t	uint64_t;
+#define	uint64_t	__uint64_t
+#endif
+
+#ifndef	intptr_t
+typedef	__intptr_t	intptr_t;
+#define	intptr_t	__intptr_t
+#endif
+
+#ifndef	uintptr_t
+typedef	__uintptr_t	uintptr_t;
+#define	uintptr_t	__uintptr_t
+#endif
+
+#include <machine/int_mwgwtypes.h>
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) || \
+    (__cplusplus >= 201103L)
+#include <machine/int_limits.h>
+#endif
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) || \
+    (__cplusplus >= 201103L)
+#include <machine/int_const.h>
+#endif
+
+#include <machine/wchar_limits.h>
+
+#endif /* !_SYS_STDINT_H_ */

Property changes on: lab4/.minix-src/include/sys/stdint.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/syscall.h
===================================================================
--- lab4/.minix-src/include/sys/syscall.h	(nonexistent)
+++ lab4/.minix-src/include/sys/syscall.h	(revision 13)
@@ -0,0 +1,1330 @@
+/* $NetBSD: syscall.h,v 1.285 2015/10/10 03:30:17 pgoyette Exp $ */
+
+/*
+ * System call numbers.
+ *
+ * DO NOT EDIT-- this file is automatically generated.
+ * created from	NetBSD: syscalls.master,v 1.280 2015/10/10 03:27:30 pgoyette Exp
+ */
+
+#ifndef _SYS_SYSCALL_H_
+#define	_SYS_SYSCALL_H_
+
+#define	SYS_MAXSYSARGS	8
+
+/* syscall: "syscall" ret: "int" args: "int" "..." */
+#define	SYS_syscall	0
+
+/* syscall: "exit" ret: "void" args: "int" */
+#define	SYS_exit	1
+
+/* syscall: "fork" ret: "int" args: */
+#define	SYS_fork	2
+
+/* syscall: "read" ret: "ssize_t" args: "int" "void *" "size_t" */
+#define	SYS_read	3
+
+/* syscall: "write" ret: "ssize_t" args: "int" "const void *" "size_t" */
+#define	SYS_write	4
+
+/* syscall: "open" ret: "int" args: "const char *" "int" "..." */
+#define	SYS_open	5
+
+/* syscall: "close" ret: "int" args: "int" */
+#define	SYS_close	6
+
+/* syscall: "compat_50_wait4" ret: "int" args: "pid_t" "int *" "int" "struct rusage50 *" */
+#define	SYS_compat_50_wait4	7
+
+/* syscall: "compat_43_ocreat" ret: "int" args: "const char *" "mode_t" */
+#define	SYS_compat_43_ocreat	8
+
+/* syscall: "link" ret: "int" args: "const char *" "const char *" */
+#define	SYS_link	9
+
+/* syscall: "unlink" ret: "int" args: "const char *" */
+#define	SYS_unlink	10
+
+				/* 11 is obsolete execv */
+/* syscall: "chdir" ret: "int" args: "const char *" */
+#define	SYS_chdir	12
+
+/* syscall: "fchdir" ret: "int" args: "int" */
+#define	SYS_fchdir	13
+
+/* syscall: "compat_50_mknod" ret: "int" args: "const char *" "mode_t" "uint32_t" */
+#define	SYS_compat_50_mknod	14
+
+/* syscall: "chmod" ret: "int" args: "const char *" "mode_t" */
+#define	SYS_chmod	15
+
+/* syscall: "chown" ret: "int" args: "const char *" "uid_t" "gid_t" */
+#define	SYS_chown	16
+
+/* syscall: "break" ret: "int" args: "char *" */
+#define	SYS_break	17
+
+/* syscall: "compat_20_getfsstat" ret: "int" args: "struct statfs12 *" "long" "int" */
+#define	SYS_compat_20_getfsstat	18
+
+/* syscall: "compat_43_olseek" ret: "long" args: "int" "long" "int" */
+#define	SYS_compat_43_olseek	19
+
+/* syscall: "getpid" ret: "pid_t" args: */
+#define	SYS_getpid	20
+
+/* syscall: "compat_40_mount" ret: "int" args: "const char *" "const char *" "int" "void *" */
+#define	SYS_compat_40_mount	21
+
+/* syscall: "unmount" ret: "int" args: "const char *" "int" */
+#define	SYS_unmount	22
+
+/* syscall: "setuid" ret: "int" args: "uid_t" */
+#define	SYS_setuid	23
+
+/* syscall: "getuid" ret: "uid_t" args: */
+#define	SYS_getuid	24
+
+/* syscall: "geteuid" ret: "uid_t" args: */
+#define	SYS_geteuid	25
+
+/* syscall: "ptrace" ret: "int" args: "int" "pid_t" "void *" "int" */
+#define	SYS_ptrace	26
+
+/* syscall: "recvmsg" ret: "ssize_t" args: "int" "struct msghdr *" "int" */
+#define	SYS_recvmsg	27
+
+/* syscall: "sendmsg" ret: "ssize_t" args: "int" "const struct msghdr *" "int" */
+#define	SYS_sendmsg	28
+
+/* syscall: "recvfrom" ret: "ssize_t" args: "int" "void *" "size_t" "int" "struct sockaddr *" "socklen_t *" */
+#define	SYS_recvfrom	29
+
+/* syscall: "accept" ret: "int" args: "int" "struct sockaddr *" "socklen_t *" */
+#define	SYS_accept	30
+
+/* syscall: "getpeername" ret: "int" args: "int" "struct sockaddr *" "socklen_t *" */
+#define	SYS_getpeername	31
+
+/* syscall: "getsockname" ret: "int" args: "int" "struct sockaddr *" "socklen_t *" */
+#define	SYS_getsockname	32
+
+/* syscall: "access" ret: "int" args: "const char *" "int" */
+#define	SYS_access	33
+
+/* syscall: "chflags" ret: "int" args: "const char *" "u_long" */
+#define	SYS_chflags	34
+
+/* syscall: "fchflags" ret: "int" args: "int" "u_long" */
+#define	SYS_fchflags	35
+
+/* syscall: "sync" ret: "void" args: */
+#define	SYS_sync	36
+
+/* syscall: "kill" ret: "int" args: "pid_t" "int" */
+#define	SYS_kill	37
+
+/* syscall: "compat_43_stat43" ret: "int" args: "const char *" "struct stat43 *" */
+#define	SYS_compat_43_stat43	38
+
+/* syscall: "getppid" ret: "pid_t" args: */
+#define	SYS_getppid	39
+
+/* syscall: "compat_43_lstat43" ret: "int" args: "const char *" "struct stat43 *" */
+#define	SYS_compat_43_lstat43	40
+
+/* syscall: "dup" ret: "int" args: "int" */
+#define	SYS_dup	41
+
+/* syscall: "pipe" ret: "int" args: */
+#define	SYS_pipe	42
+
+/* syscall: "getegid" ret: "gid_t" args: */
+#define	SYS_getegid	43
+
+/* syscall: "profil" ret: "int" args: "char *" "size_t" "u_long" "u_int" */
+#define	SYS_profil	44
+
+/* syscall: "ktrace" ret: "int" args: "const char *" "int" "int" "pid_t" */
+#define	SYS_ktrace	45
+
+/* syscall: "compat_13_sigaction13" ret: "int" args: "int" "const struct sigaction13 *" "struct sigaction13 *" */
+#define	SYS_compat_13_sigaction13	46
+
+/* syscall: "getgid" ret: "gid_t" args: */
+#define	SYS_getgid	47
+
+/* syscall: "compat_13_sigprocmask13" ret: "int" args: "int" "int" */
+#define	SYS_compat_13_sigprocmask13	48
+
+/* syscall: "__getlogin" ret: "int" args: "char *" "size_t" */
+#define	SYS___getlogin	49
+
+/* syscall: "__setlogin" ret: "int" args: "const char *" */
+#define	SYS___setlogin	50
+
+/* syscall: "acct" ret: "int" args: "const char *" */
+#define	SYS_acct	51
+
+/* syscall: "compat_13_sigpending13" ret: "int" args: */
+#define	SYS_compat_13_sigpending13	52
+
+/* syscall: "compat_13_sigaltstack13" ret: "int" args: "const struct sigaltstack13 *" "struct sigaltstack13 *" */
+#define	SYS_compat_13_sigaltstack13	53
+
+/* syscall: "ioctl" ret: "int" args: "int" "u_long" "..." */
+#define	SYS_ioctl	54
+
+/* syscall: "compat_12_oreboot" ret: "int" args: "int" */
+#define	SYS_compat_12_oreboot	55
+
+/* syscall: "revoke" ret: "int" args: "const char *" */
+#define	SYS_revoke	56
+
+/* syscall: "symlink" ret: "int" args: "const char *" "const char *" */
+#define	SYS_symlink	57
+
+/* syscall: "readlink" ret: "ssize_t" args: "const char *" "char *" "size_t" */
+#define	SYS_readlink	58
+
+/* syscall: "execve" ret: "int" args: "const char *" "char *const *" "char *const *" */
+#define	SYS_execve	59
+
+/* syscall: "umask" ret: "mode_t" args: "mode_t" */
+#define	SYS_umask	60
+
+/* syscall: "chroot" ret: "int" args: "const char *" */
+#define	SYS_chroot	61
+
+/* syscall: "compat_43_fstat43" ret: "int" args: "int" "struct stat43 *" */
+#define	SYS_compat_43_fstat43	62
+
+/* syscall: "compat_43_ogetkerninfo" ret: "int" args: "int" "char *" "int *" "int" */
+#define	SYS_compat_43_ogetkerninfo	63
+
+/* syscall: "compat_43_ogetpagesize" ret: "int" args: */
+#define	SYS_compat_43_ogetpagesize	64
+
+/* syscall: "compat_12_msync" ret: "int" args: "void *" "size_t" */
+#define	SYS_compat_12_msync	65
+
+/* syscall: "vfork" ret: "int" args: */
+#define	SYS_vfork	66
+
+				/* 67 is obsolete vread */
+				/* 68 is obsolete vwrite */
+/* syscall: "sbrk" ret: "int" args: "intptr_t" */
+#define	SYS_sbrk	69
+
+/* syscall: "sstk" ret: "int" args: "int" */
+#define	SYS_sstk	70
+
+/* syscall: "compat_43_ommap" ret: "int" args: "void *" "size_t" "int" "int" "int" "long" */
+#define	SYS_compat_43_ommap	71
+
+/* syscall: "vadvise" ret: "int" args: "int" */
+#define	SYS_vadvise	72
+
+/* syscall: "munmap" ret: "int" args: "void *" "size_t" */
+#define	SYS_munmap	73
+
+/* syscall: "mprotect" ret: "int" args: "void *" "size_t" "int" */
+#define	SYS_mprotect	74
+
+/* syscall: "madvise" ret: "int" args: "void *" "size_t" "int" */
+#define	SYS_madvise	75
+
+				/* 76 is obsolete vhangup */
+				/* 77 is obsolete vlimit */
+/* syscall: "mincore" ret: "int" args: "void *" "size_t" "char *" */
+#define	SYS_mincore	78
+
+/* syscall: "getgroups" ret: "int" args: "int" "gid_t *" */
+#define	SYS_getgroups	79
+
+/* syscall: "setgroups" ret: "int" args: "int" "const gid_t *" */
+#define	SYS_setgroups	80
+
+/* syscall: "getpgrp" ret: "int" args: */
+#define	SYS_getpgrp	81
+
+/* syscall: "setpgid" ret: "int" args: "pid_t" "pid_t" */
+#define	SYS_setpgid	82
+
+/* syscall: "compat_50_setitimer" ret: "int" args: "int" "const struct itimerval50 *" "struct itimerval50 *" */
+#define	SYS_compat_50_setitimer	83
+
+/* syscall: "compat_43_owait" ret: "int" args: */
+#define	SYS_compat_43_owait	84
+
+/* syscall: "compat_12_oswapon" ret: "int" args: "const char *" */
+#define	SYS_compat_12_oswapon	85
+
+/* syscall: "compat_50_getitimer" ret: "int" args: "int" "struct itimerval50 *" */
+#define	SYS_compat_50_getitimer	86
+
+/* syscall: "compat_43_ogethostname" ret: "int" args: "char *" "u_int" */
+#define	SYS_compat_43_ogethostname	87
+
+/* syscall: "compat_43_osethostname" ret: "int" args: "char *" "u_int" */
+#define	SYS_compat_43_osethostname	88
+
+/* syscall: "compat_43_ogetdtablesize" ret: "int" args: */
+#define	SYS_compat_43_ogetdtablesize	89
+
+/* syscall: "dup2" ret: "int" args: "int" "int" */
+#define	SYS_dup2	90
+
+/* syscall: "fcntl" ret: "int" args: "int" "int" "..." */
+#define	SYS_fcntl	92
+
+/* syscall: "compat_50_select" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "struct timeval50 *" */
+#define	SYS_compat_50_select	93
+
+/* syscall: "fsync" ret: "int" args: "int" */
+#define	SYS_fsync	95
+
+/* syscall: "setpriority" ret: "int" args: "int" "id_t" "int" */
+#define	SYS_setpriority	96
+
+/* syscall: "compat_30_socket" ret: "int" args: "int" "int" "int" */
+#define	SYS_compat_30_socket	97
+
+/* syscall: "connect" ret: "int" args: "int" "const struct sockaddr *" "socklen_t" */
+#define	SYS_connect	98
+
+/* syscall: "compat_43_oaccept" ret: "int" args: "int" "void *" "socklen_t *" */
+#define	SYS_compat_43_oaccept	99
+
+/* syscall: "getpriority" ret: "int" args: "int" "id_t" */
+#define	SYS_getpriority	100
+
+/* syscall: "compat_43_osend" ret: "int" args: "int" "void *" "int" "int" */
+#define	SYS_compat_43_osend	101
+
+/* syscall: "compat_43_orecv" ret: "int" args: "int" "void *" "int" "int" */
+#define	SYS_compat_43_orecv	102
+
+/* syscall: "compat_13_sigreturn13" ret: "int" args: "struct sigcontext13 *" */
+#define	SYS_compat_13_sigreturn13	103
+
+/* syscall: "bind" ret: "int" args: "int" "const struct sockaddr *" "socklen_t" */
+#define	SYS_bind	104
+
+/* syscall: "setsockopt" ret: "int" args: "int" "int" "int" "const void *" "socklen_t" */
+#define	SYS_setsockopt	105
+
+/* syscall: "listen" ret: "int" args: "int" "int" */
+#define	SYS_listen	106
+
+				/* 107 is obsolete vtimes */
+/* syscall: "compat_43_osigvec" ret: "int" args: "int" "struct sigvec *" "struct sigvec *" */
+#define	SYS_compat_43_osigvec	108
+
+/* syscall: "compat_43_osigblock" ret: "int" args: "int" */
+#define	SYS_compat_43_osigblock	109
+
+/* syscall: "compat_43_osigsetmask" ret: "int" args: "int" */
+#define	SYS_compat_43_osigsetmask	110
+
+/* syscall: "compat_13_sigsuspend13" ret: "int" args: "int" */
+#define	SYS_compat_13_sigsuspend13	111
+
+/* syscall: "compat_43_osigstack" ret: "int" args: "struct sigstack *" "struct sigstack *" */
+#define	SYS_compat_43_osigstack	112
+
+/* syscall: "compat_43_orecvmsg" ret: "int" args: "int" "struct omsghdr *" "int" */
+#define	SYS_compat_43_orecvmsg	113
+
+/* syscall: "compat_43_osendmsg" ret: "int" args: "int" "void *" "int" */
+#define	SYS_compat_43_osendmsg	114
+
+				/* 115 is obsolete vtrace */
+/* syscall: "compat_50_gettimeofday" ret: "int" args: "struct timeval50 *" "void *" */
+#define	SYS_compat_50_gettimeofday	116
+
+/* syscall: "compat_50_getrusage" ret: "int" args: "int" "struct rusage50 *" */
+#define	SYS_compat_50_getrusage	117
+
+/* syscall: "getsockopt" ret: "int" args: "int" "int" "int" "void *" "socklen_t *" */
+#define	SYS_getsockopt	118
+
+				/* 119 is obsolete resuba */
+/* syscall: "readv" ret: "ssize_t" args: "int" "const struct iovec *" "int" */
+#define	SYS_readv	120
+
+/* syscall: "writev" ret: "ssize_t" args: "int" "const struct iovec *" "int" */
+#define	SYS_writev	121
+
+/* syscall: "compat_50_settimeofday" ret: "int" args: "const struct timeval50 *" "const void *" */
+#define	SYS_compat_50_settimeofday	122
+
+/* syscall: "fchown" ret: "int" args: "int" "uid_t" "gid_t" */
+#define	SYS_fchown	123
+
+/* syscall: "fchmod" ret: "int" args: "int" "mode_t" */
+#define	SYS_fchmod	124
+
+/* syscall: "compat_43_orecvfrom" ret: "int" args: "int" "void *" "size_t" "int" "void *" "socklen_t *" */
+#define	SYS_compat_43_orecvfrom	125
+
+/* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */
+#define	SYS_setreuid	126
+
+/* syscall: "setregid" ret: "int" args: "gid_t" "gid_t" */
+#define	SYS_setregid	127
+
+/* syscall: "rename" ret: "int" args: "const char *" "const char *" */
+#define	SYS_rename	128
+
+/* syscall: "compat_43_otruncate" ret: "int" args: "const char *" "long" */
+#define	SYS_compat_43_otruncate	129
+
+/* syscall: "compat_43_oftruncate" ret: "int" args: "int" "long" */
+#define	SYS_compat_43_oftruncate	130
+
+/* syscall: "flock" ret: "int" args: "int" "int" */
+#define	SYS_flock	131
+
+/* syscall: "mkfifo" ret: "int" args: "const char *" "mode_t" */
+#define	SYS_mkfifo	132
+
+/* syscall: "sendto" ret: "ssize_t" args: "int" "const void *" "size_t" "int" "const struct sockaddr *" "socklen_t" */
+#define	SYS_sendto	133
+
+/* syscall: "shutdown" ret: "int" args: "int" "int" */
+#define	SYS_shutdown	134
+
+/* syscall: "socketpair" ret: "int" args: "int" "int" "int" "int *" */
+#define	SYS_socketpair	135
+
+/* syscall: "mkdir" ret: "int" args: "const char *" "mode_t" */
+#define	SYS_mkdir	136
+
+/* syscall: "rmdir" ret: "int" args: "const char *" */
+#define	SYS_rmdir	137
+
+/* syscall: "compat_50_utimes" ret: "int" args: "const char *" "const struct timeval50 *" */
+#define	SYS_compat_50_utimes	138
+
+				/* 139 is obsolete 4.2 sigreturn */
+/* syscall: "compat_50_adjtime" ret: "int" args: "const struct timeval50 *" "struct timeval50 *" */
+#define	SYS_compat_50_adjtime	140
+
+/* syscall: "compat_43_ogetpeername" ret: "int" args: "int" "void *" "socklen_t *" */
+#define	SYS_compat_43_ogetpeername	141
+
+/* syscall: "compat_43_ogethostid" ret: "int32_t" args: */
+#define	SYS_compat_43_ogethostid	142
+
+/* syscall: "compat_43_osethostid" ret: "int" args: "int32_t" */
+#define	SYS_compat_43_osethostid	143
+
+/* syscall: "compat_43_ogetrlimit" ret: "int" args: "int" "struct orlimit *" */
+#define	SYS_compat_43_ogetrlimit	144
+
+/* syscall: "compat_43_osetrlimit" ret: "int" args: "int" "const struct orlimit *" */
+#define	SYS_compat_43_osetrlimit	145
+
+/* syscall: "compat_43_okillpg" ret: "int" args: "int" "int" */
+#define	SYS_compat_43_okillpg	146
+
+/* syscall: "setsid" ret: "int" args: */
+#define	SYS_setsid	147
+
+/* syscall: "compat_50_quotactl" ret: "int" args: "const char *" "int" "int" "void *" */
+#define	SYS_compat_50_quotactl	148
+
+/* syscall: "compat_43_oquota" ret: "int" args: */
+#define	SYS_compat_43_oquota	149
+
+/* syscall: "compat_43_ogetsockname" ret: "int" args: "int" "void *" "socklen_t *" */
+#define	SYS_compat_43_ogetsockname	150
+
+/* syscall: "nfssvc" ret: "int" args: "int" "void *" */
+#define	SYS_nfssvc	155
+
+/* syscall: "compat_43_ogetdirentries" ret: "int" args: "int" "char *" "u_int" "long *" */
+#define	SYS_compat_43_ogetdirentries	156
+
+/* syscall: "compat_20_statfs" ret: "int" args: "const char *" "struct statfs12 *" */
+#define	SYS_compat_20_statfs	157
+
+/* syscall: "compat_20_fstatfs" ret: "int" args: "int" "struct statfs12 *" */
+#define	SYS_compat_20_fstatfs	158
+
+/* syscall: "compat_30_getfh" ret: "int" args: "const char *" "struct compat_30_fhandle *" */
+#define	SYS_compat_30_getfh	161
+
+/* syscall: "compat_09_ogetdomainname" ret: "int" args: "char *" "int" */
+#define	SYS_compat_09_ogetdomainname	162
+
+/* syscall: "compat_09_osetdomainname" ret: "int" args: "char *" "int" */
+#define	SYS_compat_09_osetdomainname	163
+
+/* syscall: "compat_09_ouname" ret: "int" args: "struct outsname *" */
+#define	SYS_compat_09_ouname	164
+
+/* syscall: "sysarch" ret: "int" args: "int" "void *" */
+#define	SYS_sysarch	165
+
+#if !defined(_LP64)
+/* syscall: "compat_10_osemsys" ret: "int" args: "int" "int" "int" "int" "int" */
+#define	SYS_compat_10_osemsys	169
+
+#else
+				/* 169 is excluded 1.0 semsys */
+#endif
+#if !defined(_LP64)
+/* syscall: "compat_10_omsgsys" ret: "int" args: "int" "int" "int" "int" "int" "int" */
+#define	SYS_compat_10_omsgsys	170
+
+#else
+				/* 170 is excluded 1.0 msgsys */
+#endif
+#if !defined(_LP64)
+/* syscall: "compat_10_oshmsys" ret: "int" args: "int" "int" "int" "int" */
+#define	SYS_compat_10_oshmsys	171
+
+#else
+				/* 171 is excluded 1.0 shmsys */
+#endif
+/* syscall: "pread" ret: "ssize_t" args: "int" "void *" "size_t" "int" "off_t" */
+#define	SYS_pread	173
+
+/* syscall: "pwrite" ret: "ssize_t" args: "int" "const void *" "size_t" "int" "off_t" */
+#define	SYS_pwrite	174
+
+/* syscall: "compat_30_ntp_gettime" ret: "int" args: "struct ntptimeval30 *" */
+#define	SYS_compat_30_ntp_gettime	175
+
+#if defined(NTP) || !defined(_KERNEL_OPT)
+/* syscall: "ntp_adjtime" ret: "int" args: "struct timex *" */
+#define	SYS_ntp_adjtime	176
+
+#else
+				/* 176 is excluded ntp_adjtime */
+#endif
+/* syscall: "setgid" ret: "int" args: "gid_t" */
+#define	SYS_setgid	181
+
+/* syscall: "setegid" ret: "int" args: "gid_t" */
+#define	SYS_setegid	182
+
+/* syscall: "seteuid" ret: "int" args: "uid_t" */
+#define	SYS_seteuid	183
+
+/* syscall: "lfs_bmapv" ret: "int" args: "fsid_t *" "struct block_info *" "int" */
+#define	SYS_lfs_bmapv	184
+
+/* syscall: "lfs_markv" ret: "int" args: "fsid_t *" "struct block_info *" "int" */
+#define	SYS_lfs_markv	185
+
+/* syscall: "lfs_segclean" ret: "int" args: "fsid_t *" "u_long" */
+#define	SYS_lfs_segclean	186
+
+/* syscall: "compat_50_lfs_segwait" ret: "int" args: "fsid_t *" "struct timeval50 *" */
+#define	SYS_compat_50_lfs_segwait	187
+
+/* syscall: "compat_12_stat12" ret: "int" args: "const char *" "struct stat12 *" */
+#define	SYS_compat_12_stat12	188
+
+/* syscall: "compat_12_fstat12" ret: "int" args: "int" "struct stat12 *" */
+#define	SYS_compat_12_fstat12	189
+
+/* syscall: "compat_12_lstat12" ret: "int" args: "const char *" "struct stat12 *" */
+#define	SYS_compat_12_lstat12	190
+
+/* syscall: "pathconf" ret: "long" args: "const char *" "int" */
+#define	SYS_pathconf	191
+
+/* syscall: "fpathconf" ret: "long" args: "int" "int" */
+#define	SYS_fpathconf	192
+
+/* syscall: "getrlimit" ret: "int" args: "int" "struct rlimit *" */
+#define	SYS_getrlimit	194
+
+/* syscall: "setrlimit" ret: "int" args: "int" "const struct rlimit *" */
+#define	SYS_setrlimit	195
+
+/* syscall: "compat_12_getdirentries" ret: "int" args: "int" "char *" "u_int" "long *" */
+#define	SYS_compat_12_getdirentries	196
+
+/* syscall: "mmap" ret: "void *" args: "void *" "size_t" "int" "int" "int" "long" "off_t" */
+#define	SYS_mmap	197
+
+/* syscall: "__syscall" ret: "quad_t" args: "quad_t" "..." */
+#define	SYS___syscall	198
+
+/* syscall: "lseek" ret: "off_t" args: "int" "int" "off_t" "int" */
+#define	SYS_lseek	199
+
+/* syscall: "truncate" ret: "int" args: "const char *" "int" "off_t" */
+#define	SYS_truncate	200
+
+/* syscall: "ftruncate" ret: "int" args: "int" "int" "off_t" */
+#define	SYS_ftruncate	201
+
+/* syscall: "__sysctl" ret: "int" args: "const int *" "u_int" "void *" "size_t *" "const void *" "size_t" */
+#define	SYS___sysctl	202
+
+/* syscall: "mlock" ret: "int" args: "const void *" "size_t" */
+#define	SYS_mlock	203
+
+/* syscall: "munlock" ret: "int" args: "const void *" "size_t" */
+#define	SYS_munlock	204
+
+/* syscall: "undelete" ret: "int" args: "const char *" */
+#define	SYS_undelete	205
+
+/* syscall: "compat_50_futimes" ret: "int" args: "int" "const struct timeval50 *" */
+#define	SYS_compat_50_futimes	206
+
+/* syscall: "getpgid" ret: "pid_t" args: "pid_t" */
+#define	SYS_getpgid	207
+
+/* syscall: "reboot" ret: "int" args: "int" "char *" */
+#define	SYS_reboot	208
+
+/* syscall: "poll" ret: "int" args: "struct pollfd *" "u_int" "int" */
+#define	SYS_poll	209
+
+/* syscall: "afssys" ret: "int" args: "long" "long" "long" "long" "long" "long" "long" */
+#define	SYS_afssys	210
+
+/* syscall: "compat_14___semctl" ret: "int" args: "int" "int" "int" "union __semun *" */
+#define	SYS_compat_14___semctl	220
+
+/* syscall: "semget" ret: "int" args: "key_t" "int" "int" */
+#define	SYS_semget	221
+
+/* syscall: "semop" ret: "int" args: "int" "struct sembuf *" "size_t" */
+#define	SYS_semop	222
+
+/* syscall: "semconfig" ret: "int" args: "int" */
+#define	SYS_semconfig	223
+
+/* syscall: "compat_14_msgctl" ret: "int" args: "int" "int" "struct msqid_ds14 *" */
+#define	SYS_compat_14_msgctl	224
+
+/* syscall: "msgget" ret: "int" args: "key_t" "int" */
+#define	SYS_msgget	225
+
+/* syscall: "msgsnd" ret: "int" args: "int" "const void *" "size_t" "int" */
+#define	SYS_msgsnd	226
+
+/* syscall: "msgrcv" ret: "ssize_t" args: "int" "void *" "size_t" "long" "int" */
+#define	SYS_msgrcv	227
+
+/* syscall: "shmat" ret: "void *" args: "int" "const void *" "int" */
+#define	SYS_shmat	228
+
+/* syscall: "compat_14_shmctl" ret: "int" args: "int" "int" "struct shmid_ds14 *" */
+#define	SYS_compat_14_shmctl	229
+
+/* syscall: "shmdt" ret: "int" args: "const void *" */
+#define	SYS_shmdt	230
+
+/* syscall: "shmget" ret: "int" args: "key_t" "size_t" "int" */
+#define	SYS_shmget	231
+
+/* syscall: "compat_50_clock_gettime" ret: "int" args: "clockid_t" "struct timespec50 *" */
+#define	SYS_compat_50_clock_gettime	232
+
+/* syscall: "compat_50_clock_settime" ret: "int" args: "clockid_t" "const struct timespec50 *" */
+#define	SYS_compat_50_clock_settime	233
+
+/* syscall: "compat_50_clock_getres" ret: "int" args: "clockid_t" "struct timespec50 *" */
+#define	SYS_compat_50_clock_getres	234
+
+/* syscall: "timer_create" ret: "int" args: "clockid_t" "struct sigevent *" "timer_t *" */
+#define	SYS_timer_create	235
+
+/* syscall: "timer_delete" ret: "int" args: "timer_t" */
+#define	SYS_timer_delete	236
+
+/* syscall: "compat_50_timer_settime" ret: "int" args: "timer_t" "int" "const struct itimerspec50 *" "struct itimerspec50 *" */
+#define	SYS_compat_50_timer_settime	237
+
+/* syscall: "compat_50_timer_gettime" ret: "int" args: "timer_t" "struct itimerspec50 *" */
+#define	SYS_compat_50_timer_gettime	238
+
+/* syscall: "timer_getoverrun" ret: "int" args: "timer_t" */
+#define	SYS_timer_getoverrun	239
+
+/* syscall: "compat_50_nanosleep" ret: "int" args: "const struct timespec50 *" "struct timespec50 *" */
+#define	SYS_compat_50_nanosleep	240
+
+/* syscall: "fdatasync" ret: "int" args: "int" */
+#define	SYS_fdatasync	241
+
+/* syscall: "mlockall" ret: "int" args: "int" */
+#define	SYS_mlockall	242
+
+/* syscall: "munlockall" ret: "int" args: */
+#define	SYS_munlockall	243
+
+/* syscall: "compat_50___sigtimedwait" ret: "int" args: "const sigset_t *" "siginfo_t *" "struct timespec50 *" */
+#define	SYS_compat_50___sigtimedwait	244
+
+/* syscall: "sigqueueinfo" ret: "int" args: "pid_t" "const siginfo_t *" */
+#define	SYS_sigqueueinfo	245
+
+/* syscall: "modctl" ret: "int" args: "int" "void *" */
+#define	SYS_modctl	246
+
+/* syscall: "_ksem_init" ret: "int" args: "unsigned int" "intptr_t *" */
+#define	SYS__ksem_init	247
+
+/* syscall: "_ksem_open" ret: "int" args: "const char *" "int" "mode_t" "unsigned int" "intptr_t *" */
+#define	SYS__ksem_open	248
+
+/* syscall: "_ksem_unlink" ret: "int" args: "const char *" */
+#define	SYS__ksem_unlink	249
+
+/* syscall: "_ksem_close" ret: "int" args: "intptr_t" */
+#define	SYS__ksem_close	250
+
+/* syscall: "_ksem_post" ret: "int" args: "intptr_t" */
+#define	SYS__ksem_post	251
+
+/* syscall: "_ksem_wait" ret: "int" args: "intptr_t" */
+#define	SYS__ksem_wait	252
+
+/* syscall: "_ksem_trywait" ret: "int" args: "intptr_t" */
+#define	SYS__ksem_trywait	253
+
+/* syscall: "_ksem_getvalue" ret: "int" args: "intptr_t" "unsigned int *" */
+#define	SYS__ksem_getvalue	254
+
+/* syscall: "_ksem_destroy" ret: "int" args: "intptr_t" */
+#define	SYS__ksem_destroy	255
+
+/* syscall: "_ksem_timedwait" ret: "int" args: "intptr_t" "const struct timespec *" */
+#define	SYS__ksem_timedwait	256
+
+/* syscall: "mq_open" ret: "mqd_t" args: "const char *" "int" "mode_t" "struct mq_attr *" */
+#define	SYS_mq_open	257
+
+/* syscall: "mq_close" ret: "int" args: "mqd_t" */
+#define	SYS_mq_close	258
+
+/* syscall: "mq_unlink" ret: "int" args: "const char *" */
+#define	SYS_mq_unlink	259
+
+/* syscall: "mq_getattr" ret: "int" args: "mqd_t" "struct mq_attr *" */
+#define	SYS_mq_getattr	260
+
+/* syscall: "mq_setattr" ret: "int" args: "mqd_t" "const struct mq_attr *" "struct mq_attr *" */
+#define	SYS_mq_setattr	261
+
+/* syscall: "mq_notify" ret: "int" args: "mqd_t" "const struct sigevent *" */
+#define	SYS_mq_notify	262
+
+/* syscall: "mq_send" ret: "int" args: "mqd_t" "const char *" "size_t" "unsigned" */
+#define	SYS_mq_send	263
+
+/* syscall: "mq_receive" ret: "ssize_t" args: "mqd_t" "char *" "size_t" "unsigned *" */
+#define	SYS_mq_receive	264
+
+/* syscall: "compat_50_mq_timedsend" ret: "int" args: "mqd_t" "const char *" "size_t" "unsigned" "const struct timespec50 *" */
+#define	SYS_compat_50_mq_timedsend	265
+
+/* syscall: "compat_50_mq_timedreceive" ret: "ssize_t" args: "mqd_t" "char *" "size_t" "unsigned *" "const struct timespec50 *" */
+#define	SYS_compat_50_mq_timedreceive	266
+
+/* syscall: "__posix_rename" ret: "int" args: "const char *" "const char *" */
+#define	SYS___posix_rename	270
+
+/* syscall: "swapctl" ret: "int" args: "int" "void *" "int" */
+#define	SYS_swapctl	271
+
+/* syscall: "compat_30_getdents" ret: "int" args: "int" "char *" "size_t" */
+#define	SYS_compat_30_getdents	272
+
+/* syscall: "minherit" ret: "int" args: "void *" "size_t" "int" */
+#define	SYS_minherit	273
+
+/* syscall: "lchmod" ret: "int" args: "const char *" "mode_t" */
+#define	SYS_lchmod	274
+
+/* syscall: "lchown" ret: "int" args: "const char *" "uid_t" "gid_t" */
+#define	SYS_lchown	275
+
+/* syscall: "compat_50_lutimes" ret: "int" args: "const char *" "const struct timeval50 *" */
+#define	SYS_compat_50_lutimes	276
+
+/* syscall: "__msync13" ret: "int" args: "void *" "size_t" "int" */
+#define	SYS___msync13	277
+
+/* syscall: "compat_30___stat13" ret: "int" args: "const char *" "struct stat13 *" */
+#define	SYS_compat_30___stat13	278
+
+/* syscall: "compat_30___fstat13" ret: "int" args: "int" "struct stat13 *" */
+#define	SYS_compat_30___fstat13	279
+
+/* syscall: "compat_30___lstat13" ret: "int" args: "const char *" "struct stat13 *" */
+#define	SYS_compat_30___lstat13	280
+
+/* syscall: "__sigaltstack14" ret: "int" args: "const struct sigaltstack *" "struct sigaltstack *" */
+#define	SYS___sigaltstack14	281
+
+/* syscall: "__vfork14" ret: "int" args: */
+#define	SYS___vfork14	282
+
+/* syscall: "__posix_chown" ret: "int" args: "const char *" "uid_t" "gid_t" */
+#define	SYS___posix_chown	283
+
+/* syscall: "__posix_fchown" ret: "int" args: "int" "uid_t" "gid_t" */
+#define	SYS___posix_fchown	284
+
+/* syscall: "__posix_lchown" ret: "int" args: "const char *" "uid_t" "gid_t" */
+#define	SYS___posix_lchown	285
+
+/* syscall: "getsid" ret: "pid_t" args: "pid_t" */
+#define	SYS_getsid	286
+
+/* syscall: "__clone" ret: "pid_t" args: "int" "void *" */
+#define	SYS___clone	287
+
+/* syscall: "fktrace" ret: "int" args: "int" "int" "int" "pid_t" */
+#define	SYS_fktrace	288
+
+/* syscall: "preadv" ret: "ssize_t" args: "int" "const struct iovec *" "int" "int" "off_t" */
+#define	SYS_preadv	289
+
+/* syscall: "pwritev" ret: "ssize_t" args: "int" "const struct iovec *" "int" "int" "off_t" */
+#define	SYS_pwritev	290
+
+/* syscall: "compat_16___sigaction14" ret: "int" args: "int" "const struct sigaction *" "struct sigaction *" */
+#define	SYS_compat_16___sigaction14	291
+
+/* syscall: "__sigpending14" ret: "int" args: "sigset_t *" */
+#define	SYS___sigpending14	292
+
+/* syscall: "__sigprocmask14" ret: "int" args: "int" "const sigset_t *" "sigset_t *" */
+#define	SYS___sigprocmask14	293
+
+/* syscall: "__sigsuspend14" ret: "int" args: "const sigset_t *" */
+#define	SYS___sigsuspend14	294
+
+/* syscall: "compat_16___sigreturn14" ret: "int" args: "struct sigcontext *" */
+#define	SYS_compat_16___sigreturn14	295
+
+/* syscall: "__getcwd" ret: "int" args: "char *" "size_t" */
+#define	SYS___getcwd	296
+
+/* syscall: "fchroot" ret: "int" args: "int" */
+#define	SYS_fchroot	297
+
+/* syscall: "compat_30_fhopen" ret: "int" args: "const struct compat_30_fhandle *" "int" */
+#define	SYS_compat_30_fhopen	298
+
+/* syscall: "compat_30_fhstat" ret: "int" args: "const struct compat_30_fhandle *" "struct stat13 *" */
+#define	SYS_compat_30_fhstat	299
+
+/* syscall: "compat_20_fhstatfs" ret: "int" args: "const struct compat_30_fhandle *" "struct statfs12 *" */
+#define	SYS_compat_20_fhstatfs	300
+
+/* syscall: "compat_50_____semctl13" ret: "int" args: "int" "int" "int" "..." */
+#define	SYS_compat_50_____semctl13	301
+
+/* syscall: "compat_50___msgctl13" ret: "int" args: "int" "int" "struct msqid_ds *" */
+#define	SYS_compat_50___msgctl13	302
+
+/* syscall: "compat_50___shmctl13" ret: "int" args: "int" "int" "struct shmid_ds13 *" */
+#define	SYS_compat_50___shmctl13	303
+
+/* syscall: "lchflags" ret: "int" args: "const char *" "u_long" */
+#define	SYS_lchflags	304
+
+/* syscall: "issetugid" ret: "int" args: */
+#define	SYS_issetugid	305
+
+/* syscall: "utrace" ret: "int" args: "const char *" "void *" "size_t" */
+#define	SYS_utrace	306
+
+/* syscall: "getcontext" ret: "int" args: "struct __ucontext *" */
+#define	SYS_getcontext	307
+
+/* syscall: "setcontext" ret: "int" args: "const struct __ucontext *" */
+#define	SYS_setcontext	308
+
+/* syscall: "_lwp_create" ret: "int" args: "const struct __ucontext *" "u_long" "lwpid_t *" */
+#define	SYS__lwp_create	309
+
+/* syscall: "_lwp_exit" ret: "int" args: */
+#define	SYS__lwp_exit	310
+
+/* syscall: "_lwp_self" ret: "lwpid_t" args: */
+#define	SYS__lwp_self	311
+
+/* syscall: "_lwp_wait" ret: "int" args: "lwpid_t" "lwpid_t *" */
+#define	SYS__lwp_wait	312
+
+/* syscall: "_lwp_suspend" ret: "int" args: "lwpid_t" */
+#define	SYS__lwp_suspend	313
+
+/* syscall: "_lwp_continue" ret: "int" args: "lwpid_t" */
+#define	SYS__lwp_continue	314
+
+/* syscall: "_lwp_wakeup" ret: "int" args: "lwpid_t" */
+#define	SYS__lwp_wakeup	315
+
+/* syscall: "_lwp_getprivate" ret: "void *" args: */
+#define	SYS__lwp_getprivate	316
+
+/* syscall: "_lwp_setprivate" ret: "void" args: "void *" */
+#define	SYS__lwp_setprivate	317
+
+/* syscall: "_lwp_kill" ret: "int" args: "lwpid_t" "int" */
+#define	SYS__lwp_kill	318
+
+/* syscall: "_lwp_detach" ret: "int" args: "lwpid_t" */
+#define	SYS__lwp_detach	319
+
+/* syscall: "compat_50__lwp_park" ret: "int" args: "const struct timespec50 *" "lwpid_t" "const void *" "const void *" */
+#define	SYS_compat_50__lwp_park	320
+
+/* syscall: "_lwp_unpark" ret: "int" args: "lwpid_t" "const void *" */
+#define	SYS__lwp_unpark	321
+
+/* syscall: "_lwp_unpark_all" ret: "ssize_t" args: "const lwpid_t *" "size_t" "const void *" */
+#define	SYS__lwp_unpark_all	322
+
+/* syscall: "_lwp_setname" ret: "int" args: "lwpid_t" "const char *" */
+#define	SYS__lwp_setname	323
+
+/* syscall: "_lwp_getname" ret: "int" args: "lwpid_t" "char *" "size_t" */
+#define	SYS__lwp_getname	324
+
+/* syscall: "_lwp_ctl" ret: "int" args: "int" "struct lwpctl **" */
+#define	SYS__lwp_ctl	325
+
+/* syscall: "compat_60_sa_register" ret: "int" args: "void *" "void **" "int" "ssize_t" */
+#define	SYS_compat_60_sa_register	330
+
+/* syscall: "compat_60_sa_stacks" ret: "int" args: "int" "stack_t *" */
+#define	SYS_compat_60_sa_stacks	331
+
+/* syscall: "compat_60_sa_enable" ret: "int" args: */
+#define	SYS_compat_60_sa_enable	332
+
+/* syscall: "compat_60_sa_setconcurrency" ret: "int" args: "int" */
+#define	SYS_compat_60_sa_setconcurrency	333
+
+/* syscall: "compat_60_sa_yield" ret: "int" args: */
+#define	SYS_compat_60_sa_yield	334
+
+/* syscall: "compat_60_sa_preempt" ret: "int" args: "int" */
+#define	SYS_compat_60_sa_preempt	335
+
+				/* 336 is obsolete sys_sa_unblockyield */
+/* syscall: "__sigaction_sigtramp" ret: "int" args: "int" "const struct sigaction *" "struct sigaction *" "const void *" "int" */
+#define	SYS___sigaction_sigtramp	340
+
+/* syscall: "pmc_get_info" ret: "int" args: "int" "int" "void *" */
+#define	SYS_pmc_get_info	341
+
+/* syscall: "pmc_control" ret: "int" args: "int" "int" "void *" */
+#define	SYS_pmc_control	342
+
+/* syscall: "rasctl" ret: "int" args: "void *" "size_t" "int" */
+#define	SYS_rasctl	343
+
+/* syscall: "kqueue" ret: "int" args: */
+#define	SYS_kqueue	344
+
+/* syscall: "compat_50_kevent" ret: "int" args: "int" "const struct kevent *" "size_t" "struct kevent *" "size_t" "const struct timespec50 *" */
+#define	SYS_compat_50_kevent	345
+
+/* syscall: "_sched_setparam" ret: "int" args: "pid_t" "lwpid_t" "int" "const struct sched_param *" */
+#define	SYS__sched_setparam	346
+
+/* syscall: "_sched_getparam" ret: "int" args: "pid_t" "lwpid_t" "int *" "struct sched_param *" */
+#define	SYS__sched_getparam	347
+
+/* syscall: "_sched_setaffinity" ret: "int" args: "pid_t" "lwpid_t" "size_t" "const cpuset_t *" */
+#define	SYS__sched_setaffinity	348
+
+/* syscall: "_sched_getaffinity" ret: "int" args: "pid_t" "lwpid_t" "size_t" "cpuset_t *" */
+#define	SYS__sched_getaffinity	349
+
+/* syscall: "sched_yield" ret: "int" args: */
+#define	SYS_sched_yield	350
+
+/* syscall: "fsync_range" ret: "int" args: "int" "int" "off_t" "off_t" */
+#define	SYS_fsync_range	354
+
+/* syscall: "uuidgen" ret: "int" args: "struct uuid *" "int" */
+#define	SYS_uuidgen	355
+
+/* syscall: "getvfsstat" ret: "int" args: "struct statvfs *" "size_t" "int" */
+#define	SYS_getvfsstat	356
+
+/* syscall: "statvfs1" ret: "int" args: "const char *" "struct statvfs *" "int" */
+#define	SYS_statvfs1	357
+
+/* syscall: "fstatvfs1" ret: "int" args: "int" "struct statvfs *" "int" */
+#define	SYS_fstatvfs1	358
+
+/* syscall: "compat_30_fhstatvfs1" ret: "int" args: "const struct compat_30_fhandle *" "struct statvfs *" "int" */
+#define	SYS_compat_30_fhstatvfs1	359
+
+/* syscall: "extattrctl" ret: "int" args: "const char *" "int" "const char *" "int" "const char *" */
+#define	SYS_extattrctl	360
+
+/* syscall: "extattr_set_file" ret: "int" args: "const char *" "int" "const char *" "const void *" "size_t" */
+#define	SYS_extattr_set_file	361
+
+/* syscall: "extattr_get_file" ret: "ssize_t" args: "const char *" "int" "const char *" "void *" "size_t" */
+#define	SYS_extattr_get_file	362
+
+/* syscall: "extattr_delete_file" ret: "int" args: "const char *" "int" "const char *" */
+#define	SYS_extattr_delete_file	363
+
+/* syscall: "extattr_set_fd" ret: "int" args: "int" "int" "const char *" "const void *" "size_t" */
+#define	SYS_extattr_set_fd	364
+
+/* syscall: "extattr_get_fd" ret: "ssize_t" args: "int" "int" "const char *" "void *" "size_t" */
+#define	SYS_extattr_get_fd	365
+
+/* syscall: "extattr_delete_fd" ret: "int" args: "int" "int" "const char *" */
+#define	SYS_extattr_delete_fd	366
+
+/* syscall: "extattr_set_link" ret: "int" args: "const char *" "int" "const char *" "const void *" "size_t" */
+#define	SYS_extattr_set_link	367
+
+/* syscall: "extattr_get_link" ret: "ssize_t" args: "const char *" "int" "const char *" "void *" "size_t" */
+#define	SYS_extattr_get_link	368
+
+/* syscall: "extattr_delete_link" ret: "int" args: "const char *" "int" "const char *" */
+#define	SYS_extattr_delete_link	369
+
+/* syscall: "extattr_list_fd" ret: "ssize_t" args: "int" "int" "void *" "size_t" */
+#define	SYS_extattr_list_fd	370
+
+/* syscall: "extattr_list_file" ret: "ssize_t" args: "const char *" "int" "void *" "size_t" */
+#define	SYS_extattr_list_file	371
+
+/* syscall: "extattr_list_link" ret: "ssize_t" args: "const char *" "int" "void *" "size_t" */
+#define	SYS_extattr_list_link	372
+
+/* syscall: "compat_50_pselect" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "const struct timespec50 *" "const sigset_t *" */
+#define	SYS_compat_50_pselect	373
+
+/* syscall: "compat_50_pollts" ret: "int" args: "struct pollfd *" "u_int" "const struct timespec50 *" "const sigset_t *" */
+#define	SYS_compat_50_pollts	374
+
+/* syscall: "setxattr" ret: "int" args: "const char *" "const char *" "const void *" "size_t" "int" */
+#define	SYS_setxattr	375
+
+/* syscall: "lsetxattr" ret: "int" args: "const char *" "const char *" "const void *" "size_t" "int" */
+#define	SYS_lsetxattr	376
+
+/* syscall: "fsetxattr" ret: "int" args: "int" "const char *" "const void *" "size_t" "int" */
+#define	SYS_fsetxattr	377
+
+/* syscall: "getxattr" ret: "int" args: "const char *" "const char *" "void *" "size_t" */
+#define	SYS_getxattr	378
+
+/* syscall: "lgetxattr" ret: "int" args: "const char *" "const char *" "void *" "size_t" */
+#define	SYS_lgetxattr	379
+
+/* syscall: "fgetxattr" ret: "int" args: "int" "const char *" "void *" "size_t" */
+#define	SYS_fgetxattr	380
+
+/* syscall: "listxattr" ret: "int" args: "const char *" "char *" "size_t" */
+#define	SYS_listxattr	381
+
+/* syscall: "llistxattr" ret: "int" args: "const char *" "char *" "size_t" */
+#define	SYS_llistxattr	382
+
+/* syscall: "flistxattr" ret: "int" args: "int" "char *" "size_t" */
+#define	SYS_flistxattr	383
+
+/* syscall: "removexattr" ret: "int" args: "const char *" "const char *" */
+#define	SYS_removexattr	384
+
+/* syscall: "lremovexattr" ret: "int" args: "const char *" "const char *" */
+#define	SYS_lremovexattr	385
+
+/* syscall: "fremovexattr" ret: "int" args: "int" "const char *" */
+#define	SYS_fremovexattr	386
+
+/* syscall: "compat_50___stat30" ret: "int" args: "const char *" "struct stat30 *" */
+#define	SYS_compat_50___stat30	387
+
+/* syscall: "compat_50___fstat30" ret: "int" args: "int" "struct stat30 *" */
+#define	SYS_compat_50___fstat30	388
+
+/* syscall: "compat_50___lstat30" ret: "int" args: "const char *" "struct stat30 *" */
+#define	SYS_compat_50___lstat30	389
+
+/* syscall: "__getdents30" ret: "int" args: "int" "char *" "size_t" */
+#define	SYS___getdents30	390
+
+				/* 391 is ignored old posix_fadvise */
+/* syscall: "compat_30___fhstat30" ret: "int" args: "const struct compat_30_fhandle *" "struct stat30 *" */
+#define	SYS_compat_30___fhstat30	392
+
+/* syscall: "compat_50___ntp_gettime30" ret: "int" args: "struct ntptimeval50 *" */
+#define	SYS_compat_50___ntp_gettime30	393
+
+/* syscall: "__socket30" ret: "int" args: "int" "int" "int" */
+#define	SYS___socket30	394
+
+/* syscall: "__getfh30" ret: "int" args: "const char *" "void *" "size_t *" */
+#define	SYS___getfh30	395
+
+/* syscall: "__fhopen40" ret: "int" args: "const void *" "size_t" "int" */
+#define	SYS___fhopen40	396
+
+/* syscall: "__fhstatvfs140" ret: "int" args: "const void *" "size_t" "struct statvfs *" "int" */
+#define	SYS___fhstatvfs140	397
+
+/* syscall: "compat_50___fhstat40" ret: "int" args: "const void *" "size_t" "struct stat30 *" */
+#define	SYS_compat_50___fhstat40	398
+
+/* syscall: "aio_cancel" ret: "int" args: "int" "struct aiocb *" */
+#define	SYS_aio_cancel	399
+
+/* syscall: "aio_error" ret: "int" args: "const struct aiocb *" */
+#define	SYS_aio_error	400
+
+/* syscall: "aio_fsync" ret: "int" args: "int" "struct aiocb *" */
+#define	SYS_aio_fsync	401
+
+/* syscall: "aio_read" ret: "int" args: "struct aiocb *" */
+#define	SYS_aio_read	402
+
+/* syscall: "aio_return" ret: "int" args: "struct aiocb *" */
+#define	SYS_aio_return	403
+
+/* syscall: "compat_50_aio_suspend" ret: "int" args: "const struct aiocb *const *" "int" "const struct timespec50 *" */
+#define	SYS_compat_50_aio_suspend	404
+
+/* syscall: "aio_write" ret: "int" args: "struct aiocb *" */
+#define	SYS_aio_write	405
+
+/* syscall: "lio_listio" ret: "int" args: "int" "struct aiocb *const *" "int" "struct sigevent *" */
+#define	SYS_lio_listio	406
+
+/* syscall: "__mount50" ret: "int" args: "const char *" "const char *" "int" "void *" "size_t" */
+#define	SYS___mount50	410
+
+/* syscall: "mremap" ret: "void *" args: "void *" "size_t" "void *" "size_t" "int" */
+#define	SYS_mremap	411
+
+/* syscall: "pset_create" ret: "int" args: "psetid_t *" */
+#define	SYS_pset_create	412
+
+/* syscall: "pset_destroy" ret: "int" args: "psetid_t" */
+#define	SYS_pset_destroy	413
+
+/* syscall: "pset_assign" ret: "int" args: "psetid_t" "cpuid_t" "psetid_t *" */
+#define	SYS_pset_assign	414
+
+/* syscall: "_pset_bind" ret: "int" args: "idtype_t" "id_t" "id_t" "psetid_t" "psetid_t *" */
+#define	SYS__pset_bind	415
+
+/* syscall: "__posix_fadvise50" ret: "int" args: "int" "int" "off_t" "off_t" "int" */
+#define	SYS___posix_fadvise50	416
+
+/* syscall: "__select50" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "struct timeval *" */
+#define	SYS___select50	417
+
+/* syscall: "__gettimeofday50" ret: "int" args: "struct timeval *" "void *" */
+#define	SYS___gettimeofday50	418
+
+/* syscall: "__settimeofday50" ret: "int" args: "const struct timeval *" "const void *" */
+#define	SYS___settimeofday50	419
+
+/* syscall: "__utimes50" ret: "int" args: "const char *" "const struct timeval *" */
+#define	SYS___utimes50	420
+
+/* syscall: "__adjtime50" ret: "int" args: "const struct timeval *" "struct timeval *" */
+#define	SYS___adjtime50	421
+
+/* syscall: "__lfs_segwait50" ret: "int" args: "fsid_t *" "struct timeval *" */
+#define	SYS___lfs_segwait50	422
+
+/* syscall: "__futimes50" ret: "int" args: "int" "const struct timeval *" */
+#define	SYS___futimes50	423
+
+/* syscall: "__lutimes50" ret: "int" args: "const char *" "const struct timeval *" */
+#define	SYS___lutimes50	424
+
+/* syscall: "__setitimer50" ret: "int" args: "int" "const struct itimerval *" "struct itimerval *" */
+#define	SYS___setitimer50	425
+
+/* syscall: "__getitimer50" ret: "int" args: "int" "struct itimerval *" */
+#define	SYS___getitimer50	426
+
+/* syscall: "__clock_gettime50" ret: "int" args: "clockid_t" "struct timespec *" */
+#define	SYS___clock_gettime50	427
+
+/* syscall: "__clock_settime50" ret: "int" args: "clockid_t" "const struct timespec *" */
+#define	SYS___clock_settime50	428
+
+/* syscall: "__clock_getres50" ret: "int" args: "clockid_t" "struct timespec *" */
+#define	SYS___clock_getres50	429
+
+/* syscall: "__nanosleep50" ret: "int" args: "const struct timespec *" "struct timespec *" */
+#define	SYS___nanosleep50	430
+
+/* syscall: "____sigtimedwait50" ret: "int" args: "const sigset_t *" "siginfo_t *" "struct timespec *" */
+#define	SYS_____sigtimedwait50	431
+
+/* syscall: "__mq_timedsend50" ret: "int" args: "mqd_t" "const char *" "size_t" "unsigned" "const struct timespec *" */
+#define	SYS___mq_timedsend50	432
+
+/* syscall: "__mq_timedreceive50" ret: "ssize_t" args: "mqd_t" "char *" "size_t" "unsigned *" "const struct timespec *" */
+#define	SYS___mq_timedreceive50	433
+
+/* syscall: "compat_60__lwp_park" ret: "int" args: "const struct timespec *" "lwpid_t" "const void *" "const void *" */
+#define	SYS_compat_60__lwp_park	434
+
+/* syscall: "__kevent50" ret: "int" args: "int" "const struct kevent *" "size_t" "struct kevent *" "size_t" "const struct timespec *" */
+#define	SYS___kevent50	435
+
+/* syscall: "__pselect50" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "const struct timespec *" "const sigset_t *" */
+#define	SYS___pselect50	436
+
+/* syscall: "__pollts50" ret: "int" args: "struct pollfd *" "u_int" "const struct timespec *" "const sigset_t *" */
+#define	SYS___pollts50	437
+
+/* syscall: "__aio_suspend50" ret: "int" args: "const struct aiocb *const *" "int" "const struct timespec *" */
+#define	SYS___aio_suspend50	438
+
+/* syscall: "__stat50" ret: "int" args: "const char *" "struct stat *" */
+#define	SYS___stat50	439
+
+/* syscall: "__fstat50" ret: "int" args: "int" "struct stat *" */
+#define	SYS___fstat50	440
+
+/* syscall: "__lstat50" ret: "int" args: "const char *" "struct stat *" */
+#define	SYS___lstat50	441
+
+/* syscall: "____semctl50" ret: "int" args: "int" "int" "int" "..." */
+#define	SYS_____semctl50	442
+
+/* syscall: "__shmctl50" ret: "int" args: "int" "int" "struct shmid_ds *" */
+#define	SYS___shmctl50	443
+
+/* syscall: "__msgctl50" ret: "int" args: "int" "int" "struct msqid_ds *" */
+#define	SYS___msgctl50	444
+
+/* syscall: "__getrusage50" ret: "int" args: "int" "struct rusage *" */
+#define	SYS___getrusage50	445
+
+/* syscall: "__timer_settime50" ret: "int" args: "timer_t" "int" "const struct itimerspec *" "struct itimerspec *" */
+#define	SYS___timer_settime50	446
+
+/* syscall: "__timer_gettime50" ret: "int" args: "timer_t" "struct itimerspec *" */
+#define	SYS___timer_gettime50	447
+
+#if defined(NTP) || !defined(_KERNEL_OPT)
+/* syscall: "__ntp_gettime50" ret: "int" args: "struct ntptimeval *" */
+#define	SYS___ntp_gettime50	448
+
+#else
+				/* 448 is excluded ___ntp_gettime50 */
+#endif
+/* syscall: "__wait450" ret: "int" args: "pid_t" "int *" "int" "struct rusage *" */
+#define	SYS___wait450	449
+
+/* syscall: "__mknod50" ret: "int" args: "const char *" "mode_t" "dev_t" */
+#define	SYS___mknod50	450
+
+/* syscall: "__fhstat50" ret: "int" args: "const void *" "size_t" "struct stat *" */
+#define	SYS___fhstat50	451
+
+				/* 452 is obsolete 5.99 quotactl */
+/* syscall: "pipe2" ret: "int" args: "int *" "int" */
+#define	SYS_pipe2	453
+
+/* syscall: "dup3" ret: "int" args: "int" "int" "int" */
+#define	SYS_dup3	454
+
+/* syscall: "kqueue1" ret: "int" args: "int" */
+#define	SYS_kqueue1	455
+
+/* syscall: "paccept" ret: "int" args: "int" "struct sockaddr *" "socklen_t *" "const sigset_t *" "int" */
+#define	SYS_paccept	456
+
+/* syscall: "linkat" ret: "int" args: "int" "const char *" "int" "const char *" "int" */
+#define	SYS_linkat	457
+
+/* syscall: "renameat" ret: "int" args: "int" "const char *" "int" "const char *" */
+#define	SYS_renameat	458
+
+/* syscall: "mkfifoat" ret: "int" args: "int" "const char *" "mode_t" */
+#define	SYS_mkfifoat	459
+
+/* syscall: "mknodat" ret: "int" args: "int" "const char *" "mode_t" "int" "dev_t" */
+#define	SYS_mknodat	460
+
+/* syscall: "mkdirat" ret: "int" args: "int" "const char *" "mode_t" */
+#define	SYS_mkdirat	461
+
+/* syscall: "faccessat" ret: "int" args: "int" "const char *" "int" "int" */
+#define	SYS_faccessat	462
+
+/* syscall: "fchmodat" ret: "int" args: "int" "const char *" "mode_t" "int" */
+#define	SYS_fchmodat	463
+
+/* syscall: "fchownat" ret: "int" args: "int" "const char *" "uid_t" "gid_t" "int" */
+#define	SYS_fchownat	464
+
+/* syscall: "fexecve" ret: "int" args: "int" "char *const *" "char *const *" */
+#define	SYS_fexecve	465
+
+/* syscall: "fstatat" ret: "int" args: "int" "const char *" "struct stat *" "int" */
+#define	SYS_fstatat	466
+
+/* syscall: "utimensat" ret: "int" args: "int" "const char *" "const struct timespec *" "int" */
+#define	SYS_utimensat	467
+
+/* syscall: "openat" ret: "int" args: "int" "const char *" "int" "..." */
+#define	SYS_openat	468
+
+/* syscall: "readlinkat" ret: "ssize_t" args: "int" "const char *" "char *" "size_t" */
+#define	SYS_readlinkat	469
+
+/* syscall: "symlinkat" ret: "int" args: "const char *" "int" "const char *" */
+#define	SYS_symlinkat	470
+
+/* syscall: "unlinkat" ret: "int" args: "int" "const char *" "int" */
+#define	SYS_unlinkat	471
+
+/* syscall: "futimens" ret: "int" args: "int" "const struct timespec *" */
+#define	SYS_futimens	472
+
+/* syscall: "__quotactl" ret: "int" args: "const char *" "struct quotactl_args *" */
+#define	SYS___quotactl	473
+
+/* syscall: "posix_spawn" ret: "int" args: "pid_t *" "const char *" "const struct posix_spawn_file_actions *" "const struct posix_spawnattr *" "char *const *" "char *const *" */
+#define	SYS_posix_spawn	474
+
+/* syscall: "recvmmsg" ret: "int" args: "int" "struct mmsghdr *" "unsigned int" "unsigned int" "struct timespec *" */
+#define	SYS_recvmmsg	475
+
+/* syscall: "sendmmsg" ret: "int" args: "int" "struct mmsghdr *" "unsigned int" "unsigned int" */
+#define	SYS_sendmmsg	476
+
+/* syscall: "clock_nanosleep" ret: "int" args: "clockid_t" "int" "const struct timespec *" "struct timespec *" */
+#define	SYS_clock_nanosleep	477
+
+/* syscall: "___lwp_park60" ret: "int" args: "clockid_t" "int" "const struct timespec *" "lwpid_t" "const void *" "const void *" */
+#define	SYS____lwp_park60	478
+
+/* syscall: "posix_fallocate" ret: "int" args: "int" "int" "off_t" "off_t" */
+#define	SYS_posix_fallocate	479
+
+/* syscall: "fdiscard" ret: "int" args: "int" "int" "off_t" "off_t" */
+#define	SYS_fdiscard	480
+
+#define	SYS_MAXSYSCALL	481
+#define	SYS_NSYSENT	512
+#endif /* _SYS_SYSCALL_H_ */

Property changes on: lab4/.minix-src/include/sys/syscall.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/syslog.h
===================================================================
--- lab4/.minix-src/include/sys/syslog.h	(nonexistent)
+++ lab4/.minix-src/include/sys/syslog.h	(revision 13)
@@ -0,0 +1,238 @@
+/*	$NetBSD: syslog.h,v 1.36 2014/07/20 20:55:17 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)syslog.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_SYSLOG_H_
+#define _SYS_SYSLOG_H_
+
+#define	_PATH_LOG	"/var/run/log"
+
+/*
+ * priorities/facilities are encoded into a single 32-bit quantity, where the
+ * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
+ * (0-big number).  Both the priorities and the facilities map roughly
+ * one-to-one to strings in the syslogd(8) source code.  This mapping is
+ * included in this file.
+ *
+ * priorities (these are ordered)
+ */
+#define	LOG_EMERG	0	/* system is unusable */
+#define	LOG_ALERT	1	/* action must be taken immediately */
+#define	LOG_CRIT	2	/* critical conditions */
+#define	LOG_ERR		3	/* error conditions */
+#define	LOG_WARNING	4	/* warning conditions */
+#define	LOG_NOTICE	5	/* normal but significant condition */
+#define	LOG_INFO	6	/* informational */
+#define	LOG_DEBUG	7	/* debug-level messages */
+
+#define	LOG_PRIMASK	0x07	/* mask to extract priority part (internal) */
+				/* extract priority */
+#define	LOG_PRI(p)	((p) & LOG_PRIMASK)
+#define	LOG_MAKEPRI(fac, pri)	(((fac) << 3) | (pri))
+
+#ifdef SYSLOG_NAMES
+#define	INTERNAL_NOPRI	0x10	/* the "no priority" priority */
+				/* mark "facility" */
+#define	INTERNAL_MARK	LOG_MAKEPRI(LOG_NFACILITIES, 0)
+typedef struct _code {
+	char	*c_name;
+	int	c_val;
+} CODE;
+
+CODE prioritynames[] = {
+	{ "alert",	LOG_ALERT },
+	{ "crit",	LOG_CRIT },
+	{ "debug",	LOG_DEBUG },
+	{ "emerg",	LOG_EMERG },
+	{ "err",	LOG_ERR },
+	{ "error",	LOG_ERR },		/* DEPRECATED */
+	{ "info",	LOG_INFO },
+	{ "none",	INTERNAL_NOPRI },	/* INTERNAL */
+	{ "notice",	LOG_NOTICE },
+	{ "panic", 	LOG_EMERG },		/* DEPRECATED */
+	{ "warn",	LOG_WARNING },		/* DEPRECATED */
+	{ "warning",	LOG_WARNING },
+	{ NULL,		-1 }
+};
+#endif /* SYSLOG_NAMES */
+
+/* facility codes */
+#define	LOG_KERN	(0<<3)	/* kernel messages */
+#define	LOG_USER	(1<<3)	/* random user-level messages */
+#define	LOG_MAIL	(2<<3)	/* mail system */
+#define	LOG_DAEMON	(3<<3)	/* system daemons */
+#define	LOG_AUTH	(4<<3)	/* security/authorization messages */
+#define	LOG_SYSLOG	(5<<3)	/* messages generated internally by syslogd */
+#define	LOG_LPR		(6<<3)	/* line printer subsystem */
+#define	LOG_NEWS	(7<<3)	/* network news subsystem */
+#define	LOG_UUCP	(8<<3)	/* UUCP subsystem */
+#define	LOG_CRON	(9<<3)	/* clock daemon */
+#define	LOG_AUTHPRIV	(10<<3)	/* security/authorization messages (private) */
+#define	LOG_FTP		(11<<3)	/* ftp daemon */
+
+	/* other codes through 15 reserved for system use */
+#define	LOG_LOCAL0	(16<<3)	/* reserved for local use */
+#define	LOG_LOCAL1	(17<<3)	/* reserved for local use */
+#define	LOG_LOCAL2	(18<<3)	/* reserved for local use */
+#define	LOG_LOCAL3	(19<<3)	/* reserved for local use */
+#define	LOG_LOCAL4	(20<<3)	/* reserved for local use */
+#define	LOG_LOCAL5	(21<<3)	/* reserved for local use */
+#define	LOG_LOCAL6	(22<<3)	/* reserved for local use */
+#define	LOG_LOCAL7	(23<<3)	/* reserved for local use */
+
+#define	LOG_NFACILITIES	24	/* current number of facilities */
+#define	LOG_FACMASK	0x03f8	/* mask to extract facility part */
+				/* facility of pri */
+#define	LOG_FAC(p)	(((p) & LOG_FACMASK) >> 3)
+
+#ifdef SYSLOG_NAMES
+CODE facilitynames[] = {
+	{ "auth",	LOG_AUTH },
+	{ "authpriv",	LOG_AUTHPRIV },
+	{ "cron", 	LOG_CRON },
+	{ "daemon",	LOG_DAEMON },
+	{ "ftp",	LOG_FTP },
+	{ "kern",	LOG_KERN },
+	{ "lpr",	LOG_LPR },
+	{ "mail",	LOG_MAIL },
+	{ "mark", 	INTERNAL_MARK },	/* INTERNAL */
+	{ "news",	LOG_NEWS },
+	{ "security",	LOG_AUTH },		/* DEPRECATED */
+	{ "syslog",	LOG_SYSLOG },
+	{ "user",	LOG_USER },
+	{ "uucp",	LOG_UUCP },
+	{ "local0",	LOG_LOCAL0 },
+	{ "local1",	LOG_LOCAL1 },
+	{ "local2",	LOG_LOCAL2 },
+	{ "local3",	LOG_LOCAL3 },
+	{ "local4",	LOG_LOCAL4 },
+	{ "local5",	LOG_LOCAL5 },
+	{ "local6",	LOG_LOCAL6 },
+	{ "local7",	LOG_LOCAL7 },
+	{ NULL,		-1 }
+};
+#endif /* SYSLOG_NAMES */
+
+#ifdef _KERNEL
+#define	LOG_PRINTF	-1	/* pseudo-priority to indicate use of printf */
+#endif
+
+/*
+ * arguments to setlogmask.
+ */
+#define	LOG_MASK(pri)	(1 << (pri))		/* mask for one priority */
+#define	LOG_UPTO(pri)	((1 << ((pri)+1)) - 1)	/* all priorities through pri */
+
+/*
+ * Option flags for openlog.
+ *
+ * LOG_ODELAY no longer does anything.
+ * LOG_NDELAY is the inverse of what it used to be.
+ */
+#define	LOG_PID		0x01	/* log the pid with each message */
+#define	LOG_CONS	0x02	/* log on the console if errors in sending */
+#define	LOG_ODELAY	0x04	/* delay open until first syslog() (default) */
+#define	LOG_NDELAY	0x08	/* don't delay open */
+#define	LOG_NOWAIT	0x10	/* don't wait for console forks: DEPRECATED */
+#define	LOG_PERROR	0x20	/* log to stderr as well */
+
+#ifndef _KERNEL
+
+/* Used by reentrant functions */
+
+struct syslog_data {
+	int	log_version;
+	int	log_file;
+	int	log_connected;
+	int	log_opened;
+	int	log_stat;
+	const char 	*log_tag;
+	char	log_hostname[256];	/* MAXHOSTNAMELEN */
+	int 	log_fac;
+	int 	log_mask;
+};
+
+#define SYSLOG_DATA_INIT { \
+    .log_version = 1, \
+    .log_file = -1, \
+    .log_connected = 0, \
+    .log_opened = 0, \
+    .log_stat = 0, \
+    .log_tag  = 0, \
+    .log_hostname = { '\0' }, \
+    .log_fac = LOG_USER, \
+    .log_mask = 0xff, \
+}
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/ansi.h>
+
+__BEGIN_DECLS
+void	closelog(void);
+void	openlog(const char *, int, int);
+int	setlogmask(int);
+void	syslog(int, const char *, ...) __printflike(2, 3);
+#if defined(_NETBSD_SOURCE)
+void	vsyslog(int, const char *, __va_list) __printflike(2, 0);
+#ifndef __LIBC12_SOURCE__
+void	closelog_r(struct syslog_data *) __RENAME(__closelog_r60);
+void	openlog_r(const char *, int, int, struct syslog_data *)
+    __RENAME(__openlog_r60);
+int	setlogmask_r(int, struct syslog_data *) __RENAME(__setlogmask_r60);
+void	syslog_r(int, struct syslog_data *, const char *, ...)
+    __RENAME(__syslog_r60) __printflike(3, 4);
+void	vsyslog_r(int, struct syslog_data *, const char *, __va_list)
+    __RENAME(__vsyslog_r60) __printflike(3, 0);
+void	syslogp_r(int, struct syslog_data *, const char *, const char *,
+    const char *, ...) __RENAME(__syslogp_r60) __printflike(5, 6);
+void	vsyslogp_r(int, struct syslog_data *, const char *, const char *,
+    const char *, __va_list) __RENAME(__vsyslogp_r60) __printflike(5, 0);
+#endif
+void	syslogp(int, const char *, const char *, const char *, ...)
+    __printflike(4, 5);
+void	vsyslogp(int, const char *, const char *, const char *, __va_list)
+    __printflike(4, 0);
+#endif
+__END_DECLS
+
+#else /* !_KERNEL */
+
+void	logpri(int);
+void	log(int, const char *, ...) __printflike(2, 3);
+void	vlog(int, const char *, __va_list) __printflike(2, 0);
+void	addlog(const char *, ...) __printflike(1, 2);
+void	logwakeup(void);
+
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_SYSLOG_H_ */

Property changes on: lab4/.minix-src/include/sys/syslog.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/syslimits.h
===================================================================
--- lab4/.minix-src/include/sys/syslimits.h	(nonexistent)
+++ lab4/.minix-src/include/sys/syslimits.h	(revision 13)
@@ -0,0 +1,98 @@
+/*	$NetBSD: syslimits.h,v 1.28 2015/08/21 07:19:39 uebayasi Exp $	*/
+
+/*
+ * Copyright (c) 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)syslimits.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_SYSLIMITS_H_
+#define _SYS_SYSLIMITS_H_
+
+#if defined(__minix)
+#define OPEN_MAX 255
+#endif /* !defined(__minix) */
+
+#include <sys/featuretest.h>
+
+#if defined(_KERNEL_OPT)
+#include "opt_syslimits.h"
+#endif
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define	ARG_MAX		 (256 * 1024)	/* max bytes for an exec function */
+#ifndef CHILD_MAX
+#define	CHILD_MAX		  160	/* max simultaneous processes */
+#endif
+#define	GID_MAX		   2147483647U	/* max value for a gid_t (2^31-2) */
+#define	LINK_MAX		32767	/* max file link count */
+#define	MAX_CANON		  255	/* max bytes in term canon input line */
+#define	MAX_INPUT		  255	/* max bytes in terminal input */
+#define	NAME_MAX		  511	/* max bytes in a file name, must be */
+					/* kept in sync with MAXNAMLEN */
+#define	NGROUPS_MAX		   16	/* max supplemental group id's */
+#define	UID_MAX		   2147483647U	/* max value for a uid_t (2^31-2) */
+#ifndef OPEN_MAX
+#define	OPEN_MAX		  128	/* max open files per process */
+#endif
+#define	PATH_MAX		 1024	/* max bytes in pathname */
+#if defined(__minix)
+#define	PIPE_BUF                32768   /* max bytes for atomic pipe writes */
+#else
+#define	PIPE_BUF		  512	/* max bytes for atomic pipe writes */
+#endif /* defined(__minix) */
+
+#define	BC_BASE_MAX	      INT_MAX	/* max ibase/obase values in bc(1) */
+#define	BC_DIM_MAX		65535	/* max array elements in bc(1) */
+#define	BC_SCALE_MAX	      INT_MAX	/* max scale value in bc(1) */
+#define	BC_STRING_MAX	      INT_MAX	/* max const string length in bc(1) */
+#define	COLL_WEIGHTS_MAX	    2	/* max weights for order keyword */
+#define	EXPR_NEST_MAX		   32	/* max expressions nested in expr(1) */
+#define	LINE_MAX		 2048	/* max bytes in an input line */
+#define	RE_DUP_MAX		  255	/* max RE's in interval notation */
+
+/*
+ * IEEE Std 1003.1c-95, adopted in X/Open CAE Specification Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#define	LOGIN_NAME_MAX		   17	/* max login name length incl. NUL */
+#endif
+
+/*
+ * X/Open CAE Specification Issue 5 Version 2
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define	IOV_MAX			 1024	/* max # of iovec's for readv(2) etc. */
+#define	NZERO			   20	/* default "nice" */
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#endif /* !_ANSI_SOURCE */
+
+#endif /* !_SYS_SYSLIMITS_H_ */

Property changes on: lab4/.minix-src/include/sys/syslimits.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/time.h
===================================================================
--- lab4/.minix-src/include/sys/time.h	(nonexistent)
+++ lab4/.minix-src/include/sys/time.h	(revision 13)
@@ -0,0 +1,332 @@
+/*	$NetBSD: time.h,v 1.70 2015/07/31 12:51:32 kamil Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)time.h	8.5 (Berkeley) 5/4/95
+ */
+
+#ifndef _SYS_TIME_H_
+#define	_SYS_TIME_H_
+
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+/*
+ * Structure returned by gettimeofday(2) system call,
+ * and used in other calls.
+ */
+struct timeval {
+	time_t    	tv_sec;		/* seconds */
+	suseconds_t	tv_usec;	/* and microseconds */
+};
+
+#include <sys/timespec.h>
+
+#if defined(_NETBSD_SOURCE)
+#define	TIMEVAL_TO_TIMESPEC(tv, ts) do {				\
+	(ts)->tv_sec = (tv)->tv_sec;					\
+	(ts)->tv_nsec = (tv)->tv_usec * 1000;				\
+} while (/*CONSTCOND*/0)
+#define	TIMESPEC_TO_TIMEVAL(tv, ts) do {				\
+	(tv)->tv_sec = (ts)->tv_sec;					\
+	(tv)->tv_usec = (suseconds_t)(ts)->tv_nsec / 1000;		\
+} while (/*CONSTCOND*/0)
+
+/*
+ * Note: timezone is obsolete. All timezone handling is now in
+ * userland. Its just here for back compatibility.
+ */
+struct timezone {
+	int	tz_minuteswest;	/* minutes west of Greenwich */
+	int	tz_dsttime;	/* type of dst correction */
+};
+
+/* Operations on timevals. */
+#define	timerclear(tvp)		(tvp)->tv_sec = (tvp)->tv_usec = 0L
+#define	timerisset(tvp)		((tvp)->tv_sec || (tvp)->tv_usec)
+#define	timercmp(tvp, uvp, cmp)						\
+	(((tvp)->tv_sec == (uvp)->tv_sec) ?				\
+	    ((tvp)->tv_usec cmp (uvp)->tv_usec) :			\
+	    ((tvp)->tv_sec cmp (uvp)->tv_sec))
+#define	timeradd(tvp, uvp, vvp)						\
+	do {								\
+		(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;		\
+		(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;	\
+		if ((vvp)->tv_usec >= 1000000) {			\
+			(vvp)->tv_sec++;				\
+			(vvp)->tv_usec -= 1000000;			\
+		}							\
+	} while (/* CONSTCOND */ 0)
+#define	timersub(tvp, uvp, vvp)						\
+	do {								\
+		(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;		\
+		(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;	\
+		if ((vvp)->tv_usec < 0) {				\
+			(vvp)->tv_sec--;				\
+			(vvp)->tv_usec += 1000000;			\
+		}							\
+	} while (/* CONSTCOND */ 0)
+
+/*
+ * hide bintime for _STANDALONE because this header is used for hpcboot.exe,
+ * which is built with compilers which don't recognize LL suffix.
+ *	http://mail-index.NetBSD.org/tech-userlevel/2008/02/27/msg000181.html
+ */
+#if !defined(_STANDALONE)
+struct bintime {
+	time_t	sec;
+	uint64_t frac;
+};
+
+static __inline void
+bintime_addx(struct bintime *bt, uint64_t x)
+{
+	uint64_t u;
+
+	u = bt->frac;
+	bt->frac += x;
+	if (u > bt->frac)
+		bt->sec++;
+}
+
+static __inline void
+bintime_add(struct bintime *bt, const struct bintime *bt2)
+{
+	uint64_t u;
+
+	u = bt->frac;
+	bt->frac += bt2->frac;
+	if (u > bt->frac)
+		bt->sec++;
+	bt->sec += bt2->sec;
+}
+
+static __inline void
+bintime_sub(struct bintime *bt, const struct bintime *bt2)
+{
+	uint64_t u;
+
+	u = bt->frac;
+	bt->frac -= bt2->frac;
+	if (u < bt->frac)
+		bt->sec--;
+	bt->sec -= bt2->sec;
+}
+
+#define	bintimecmp(bta, btb, cmp)					\
+	(((bta)->sec == (btb)->sec) ?					\
+	    ((bta)->frac cmp (btb)->frac) :				\
+	    ((bta)->sec cmp (btb)->sec))
+
+/*-
+ * Background information:
+ *
+ * When converting between timestamps on parallel timescales of differing
+ * resolutions it is historical and scientific practice to round down rather
+ * than doing 4/5 rounding.
+ *
+ *   The date changes at midnight, not at noon.
+ *
+ *   Even at 15:59:59.999999999 it's not four'o'clock.
+ *
+ *   time_second ticks after N.999999999 not after N.4999999999
+ */
+
+static __inline void
+bintime2timespec(const struct bintime *bt, struct timespec *ts)
+{
+
+	ts->tv_sec = bt->sec;
+	ts->tv_nsec =
+	    (long)(((uint64_t)1000000000 * (uint32_t)(bt->frac >> 32)) >> 32);
+}
+
+static __inline void
+timespec2bintime(const struct timespec *ts, struct bintime *bt)
+{
+
+	bt->sec = ts->tv_sec;
+	/* 18446744073 = int(2^64 / 1000000000) */
+	bt->frac = (uint64_t)ts->tv_nsec * (uint64_t)18446744073ULL; 
+}
+
+static __inline void
+bintime2timeval(const struct bintime *bt, struct timeval *tv)
+{
+
+	tv->tv_sec = bt->sec;
+	tv->tv_usec =
+	    (suseconds_t)(((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32);
+}
+
+static __inline void
+timeval2bintime(const struct timeval *tv, struct bintime *bt)
+{
+
+	bt->sec = tv->tv_sec;
+	/* 18446744073709 = int(2^64 / 1000000) */
+	bt->frac = (uint64_t)tv->tv_usec * (uint64_t)18446744073709ULL;
+}
+
+static __inline struct bintime
+ms2bintime(uint64_t ms)
+{
+	struct bintime bt;
+
+	bt.sec = ms / 1000U;
+	bt.frac = (((ms % 1000U) >> 32)/1000U) >> 32;
+
+	return bt;
+}
+
+static __inline struct bintime
+us2bintime(uint64_t us)
+{
+	struct bintime bt;
+
+	bt.sec = us / 1000000U;
+	bt.frac = (((us % 1000000U) >> 32)/1000000U) >> 32;
+
+	return bt;
+}
+
+static __inline struct bintime
+ns2bintime(uint64_t ns)
+{
+	struct bintime bt;
+
+	bt.sec = ns / 1000000000U;
+	bt.frac = (((ns % 1000000000U) >> 32)/1000000000U) >> 32;
+
+	return bt;
+}
+#endif /* !defined(_STANDALONE) */
+
+/* Operations on timespecs. */
+#define	timespecclear(tsp)	(tsp)->tv_sec = (time_t)((tsp)->tv_nsec = 0L)
+#define	timespecisset(tsp)	((tsp)->tv_sec || (tsp)->tv_nsec)
+#define	timespeccmp(tsp, usp, cmp)					\
+	(((tsp)->tv_sec == (usp)->tv_sec) ?				\
+	    ((tsp)->tv_nsec cmp (usp)->tv_nsec) :			\
+	    ((tsp)->tv_sec cmp (usp)->tv_sec))
+#define	timespecadd(tsp, usp, vsp)					\
+	do {								\
+		(vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec;		\
+		(vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec;	\
+		if ((vsp)->tv_nsec >= 1000000000L) {			\
+			(vsp)->tv_sec++;				\
+			(vsp)->tv_nsec -= 1000000000L;			\
+		}							\
+	} while (/* CONSTCOND */ 0)
+#define	timespecsub(tsp, usp, vsp)					\
+	do {								\
+		(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;		\
+		(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;	\
+		if ((vsp)->tv_nsec < 0) {				\
+			(vsp)->tv_sec--;				\
+			(vsp)->tv_nsec += 1000000000L;			\
+		}							\
+	} while (/* CONSTCOND */ 0)
+#define timespec2ns(x) (((uint64_t)(x)->tv_sec) * 1000000000L + (x)->tv_nsec)
+#endif /* _NETBSD_SOURCE */
+
+/*
+ * Names of the interval timers, and structure
+ * defining a timer setting.
+ * NB: Must match the CLOCK_ constants below.
+ */
+#define	ITIMER_REAL		0
+#define	ITIMER_VIRTUAL		1
+#define	ITIMER_PROF		2
+#define	ITIMER_MONOTONIC	3
+
+struct	itimerval {
+	struct	timeval it_interval;	/* timer interval */
+	struct	timeval it_value;	/* current value */
+};
+
+/*
+ * Structure defined by POSIX.1b to be like a itimerval, but with
+ * timespecs. Used in the timer_*() system calls.
+ */
+struct	itimerspec {
+	struct	timespec it_interval;
+	struct	timespec it_value;
+};
+
+#define	CLOCK_REALTIME	0
+#if !defined(__minix)
+#define	CLOCK_VIRTUAL	1
+#define	CLOCK_PROF	2
+#endif /* !defined(__minix) */
+#define	CLOCK_MONOTONIC	3
+
+#if defined(_NETBSD_SOURCE)
+#define	TIMER_RELTIME	0x0	/* relative timer */
+#endif
+#define	TIMER_ABSTIME	0x1	/* absolute timer */
+
+#ifdef _KERNEL
+#include <sys/timevar.h>
+#else /* !_KERNEL */
+#ifndef _STANDALONE
+#if (_POSIX_C_SOURCE - 0) >= 200112L || \
+    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+#include <sys/select.h>
+#endif
+
+#include <sys/cdefs.h>
+#include <time.h>
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+#if (_POSIX_C_SOURCE - 0) >= 200112L || \
+    defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+int	getitimer(int, struct itimerval *) __RENAME(__getitimer50);
+int	gettimeofday(struct timeval * __restrict, void *__restrict)
+    __RENAME(__gettimeofday50);
+int	setitimer(int, const struct itimerval * __restrict,
+	    struct itimerval * __restrict) __RENAME(__setitimer50);
+int	utimes(const char *, const struct timeval [2]) __RENAME(__utimes50);
+#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
+int	adjtime(const struct timeval *, struct timeval *) __RENAME(__adjtime50);
+int	futimes(int, const struct timeval [2]) __RENAME(__futimes50);
+int	lutimes(const char *, const struct timeval [2]) __RENAME(__lutimes50);
+int	settimeofday(const struct timeval * __restrict,
+	    const void *__restrict) __RENAME(__settimeofday50);
+#endif /* _NETBSD_SOURCE */
+#endif /* __LIBC12_SOURCE__ */
+__END_DECLS
+
+#endif	/* !_STANDALONE */
+#endif /* !_KERNEL */
+#endif /* !_SYS_TIME_H_ */

Property changes on: lab4/.minix-src/include/sys/time.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/timespec.h
===================================================================
--- lab4/.minix-src/include/sys/timespec.h	(nonexistent)
+++ lab4/.minix-src/include/sys/timespec.h	(revision 13)
@@ -0,0 +1,52 @@
+/*	$NetBSD: timespec.h,v 1.1 2015/07/31 12:51:32 kamil Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)time.h	8.5 (Berkeley) 5/4/95
+ *
+ * Extracted by Kamil Rytarowski from:
+ * NetBSD: src/sys/sys/time.h,v 1.69 2015/05/19 23:35:11 riastradh Exp
+ */
+
+#ifndef _SYS_TIMESPEC_H_
+#define	_SYS_TIMESPEC_H_
+
+#include <sys/ansi.h>
+
+#ifdef	_BSD_TIME_T_
+typedef	_BSD_TIME_T_	time_t;
+#undef	_BSD_TIME_T_
+#endif
+
+struct timespec {
+	time_t	tv_sec;		/* seconds */
+	long	tv_nsec;	/* and nanoseconds */
+};
+
+#endif /* !_SYS_TIMESPEC_H_ */

Property changes on: lab4/.minix-src/include/sys/timespec.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/tree.h
===================================================================
--- lab4/.minix-src/include/sys/tree.h	(nonexistent)
+++ lab4/.minix-src/include/sys/tree.h	(revision 13)
@@ -0,0 +1,761 @@
+/*	$NetBSD: tree.h,v 1.20 2013/09/14 13:20:45 joerg Exp $	*/
+/*	$OpenBSD: tree.h,v 1.13 2011/07/09 00:19:45 pirofti 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.
+ */
+
+#ifndef	_SYS_TREE_H_
+#define	_SYS_TREE_H_
+
+/*
+ * This file defines data structures for different types of trees:
+ * splay trees and red-black trees.
+ *
+ * A splay tree is a self-organizing data structure.  Every operation
+ * on the tree causes a splay to happen.  The splay moves the requested
+ * node to the root of the tree and partly rebalances it.
+ *
+ * This has the benefit that request locality causes faster lookups as
+ * the requested nodes move to the top of the tree.  On the other hand,
+ * every lookup causes memory writes.
+ *
+ * The Balance Theorem bounds the total access time for m operations
+ * and n inserts on an initially empty tree as O((m + n)lg n).  The
+ * amortized cost for a sequence of m accesses to a splay tree is O(lg n);
+ *
+ * A red-black tree is a binary search tree with the node color as an
+ * extra attribute.  It fulfills a set of conditions:
+ *	- every search path from the root to a leaf consists of the
+ *	  same number of black nodes,
+ *	- each red node (except for the root) has a black parent,
+ *	- each leaf node is black.
+ *
+ * Every operation on a red-black tree is bounded as O(lg n).
+ * The maximum height of a red-black tree is 2lg (n+1).
+ */
+
+#define SPLAY_HEAD(name, type)						\
+struct name {								\
+	struct type *sph_root; /* root of the tree */			\
+}
+
+#define SPLAY_INITIALIZER(root)						\
+	{ NULL }
+
+#define SPLAY_INIT(root) do {						\
+	(root)->sph_root = NULL;					\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ENTRY(type)						\
+struct {								\
+	struct type *spe_left; /* left element */			\
+	struct type *spe_right; /* right element */			\
+}
+
+#define SPLAY_LEFT(elm, field)		(elm)->field.spe_left
+#define SPLAY_RIGHT(elm, field)		(elm)->field.spe_right
+#define SPLAY_ROOT(head)		(head)->sph_root
+#define SPLAY_EMPTY(head)		(SPLAY_ROOT(head) == NULL)
+
+/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */
+#define SPLAY_ROTATE_RIGHT(head, tmp, field) do {			\
+	SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field);	\
+	SPLAY_RIGHT(tmp, field) = (head)->sph_root;			\
+	(head)->sph_root = tmp;						\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ROTATE_LEFT(head, tmp, field) do {			\
+	SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field);	\
+	SPLAY_LEFT(tmp, field) = (head)->sph_root;			\
+	(head)->sph_root = tmp;						\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_LINKLEFT(head, tmp, field) do {				\
+	SPLAY_LEFT(tmp, field) = (head)->sph_root;			\
+	tmp = (head)->sph_root;						\
+	(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);		\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_LINKRIGHT(head, tmp, field) do {				\
+	SPLAY_RIGHT(tmp, field) = (head)->sph_root;			\
+	tmp = (head)->sph_root;						\
+	(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);	\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ASSEMBLE(head, node, left, right, field) do {		\
+	SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field);	\
+	SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
+	SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field);	\
+	SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field);	\
+} while (/*CONSTCOND*/ 0)
+
+/* Generates prototypes and inline functions */
+
+#define SPLAY_PROTOTYPE(name, type, field, cmp)				\
+void name##_SPLAY(struct name *, struct type *);			\
+void name##_SPLAY_MINMAX(struct name *, int);				\
+struct type *name##_SPLAY_INSERT(struct name *, struct type *);		\
+struct type *name##_SPLAY_REMOVE(struct name *, struct type *);		\
+									\
+/* Finds the node with the same key as elm */				\
+static __inline struct type *						\
+name##_SPLAY_FIND(struct name *head, struct type *elm)			\
+{									\
+	if (SPLAY_EMPTY(head))						\
+		return(NULL);						\
+	name##_SPLAY(head, elm);					\
+	if ((cmp)(elm, (head)->sph_root) == 0)				\
+		return (head->sph_root);				\
+	return (NULL);							\
+}									\
+									\
+static __inline __unused struct type *					\
+name##_SPLAY_NEXT(struct name *head, struct type *elm)			\
+{									\
+	name##_SPLAY(head, elm);					\
+	if (SPLAY_RIGHT(elm, field) != NULL) {				\
+		elm = SPLAY_RIGHT(elm, field);				\
+		while (SPLAY_LEFT(elm, field) != NULL) {		\
+			elm = SPLAY_LEFT(elm, field);			\
+		}							\
+	} else								\
+		elm = NULL;						\
+	return (elm);							\
+}									\
+									\
+static __unused __inline struct type *					\
+name##_SPLAY_MIN_MAX(struct name *head, int val)			\
+{									\
+	name##_SPLAY_MINMAX(head, val);					\
+        return (SPLAY_ROOT(head));					\
+}
+
+/* Main splay operation.
+ * Moves node close to the key of elm to top
+ */
+#define SPLAY_GENERATE(name, type, field, cmp)				\
+struct type *								\
+name##_SPLAY_INSERT(struct name *head, struct type *elm)		\
+{									\
+    if (SPLAY_EMPTY(head)) {						\
+	    SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL;	\
+    } else {								\
+	    int __comp;							\
+	    name##_SPLAY(head, elm);					\
+	    __comp = (cmp)(elm, (head)->sph_root);			\
+	    if(__comp < 0) {						\
+		    SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\
+		    SPLAY_RIGHT(elm, field) = (head)->sph_root;		\
+		    SPLAY_LEFT((head)->sph_root, field) = NULL;		\
+	    } else if (__comp > 0) {					\
+		    SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\
+		    SPLAY_LEFT(elm, field) = (head)->sph_root;		\
+		    SPLAY_RIGHT((head)->sph_root, field) = NULL;	\
+	    } else							\
+		    return ((head)->sph_root);				\
+    }									\
+    (head)->sph_root = (elm);						\
+    return (NULL);							\
+}									\
+									\
+struct type *								\
+name##_SPLAY_REMOVE(struct name *head, struct type *elm)		\
+{									\
+	struct type *__tmp;						\
+	if (SPLAY_EMPTY(head))						\
+		return (NULL);						\
+	name##_SPLAY(head, elm);					\
+	if ((cmp)(elm, (head)->sph_root) == 0) {			\
+		if (SPLAY_LEFT((head)->sph_root, field) == NULL) {	\
+			(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\
+		} else {						\
+			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
+			(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\
+			name##_SPLAY(head, elm);			\
+			SPLAY_RIGHT((head)->sph_root, field) = __tmp;	\
+		}							\
+		return (elm);						\
+	}								\
+	return (NULL);							\
+}									\
+									\
+void									\
+name##_SPLAY(struct name *head, struct type *elm)			\
+{									\
+	struct type __node, *__left, *__right, *__tmp;			\
+	int __comp;							\
+\
+	SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
+	__left = __right = &__node;					\
+\
+	while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) {		\
+		if (__comp < 0) {					\
+			__tmp = SPLAY_LEFT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if ((cmp)(elm, __tmp) < 0){			\
+				SPLAY_ROTATE_RIGHT(head, __tmp, field);	\
+				if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKLEFT(head, __right, field);		\
+		} else if (__comp > 0) {				\
+			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if ((cmp)(elm, __tmp) > 0){			\
+				SPLAY_ROTATE_LEFT(head, __tmp, field);	\
+				if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKRIGHT(head, __left, field);		\
+		}							\
+	}								\
+	SPLAY_ASSEMBLE(head, &__node, __left, __right, field);		\
+}									\
+									\
+/* Splay with either the minimum or the maximum element			\
+ * Used to find minimum or maximum element in tree.			\
+ */									\
+void name##_SPLAY_MINMAX(struct name *head, int __comp) \
+{									\
+	struct type __node, *__left, *__right, *__tmp;			\
+\
+	SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
+	__left = __right = &__node;					\
+\
+	while (1) {							\
+		if (__comp < 0) {					\
+			__tmp = SPLAY_LEFT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if (__comp < 0){				\
+				SPLAY_ROTATE_RIGHT(head, __tmp, field);	\
+				if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKLEFT(head, __right, field);		\
+		} else if (__comp > 0) {				\
+			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if (__comp > 0) {				\
+				SPLAY_ROTATE_LEFT(head, __tmp, field);	\
+				if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKRIGHT(head, __left, field);		\
+		}							\
+	}								\
+	SPLAY_ASSEMBLE(head, &__node, __left, __right, field);		\
+}
+
+#define SPLAY_NEGINF	-1
+#define SPLAY_INF	1
+
+#define SPLAY_INSERT(name, x, y)	name##_SPLAY_INSERT(x, y)
+#define SPLAY_REMOVE(name, x, y)	name##_SPLAY_REMOVE(x, y)
+#define SPLAY_FIND(name, x, y)		name##_SPLAY_FIND(x, y)
+#define SPLAY_NEXT(name, x, y)		name##_SPLAY_NEXT(x, y)
+#define SPLAY_MIN(name, x)		(SPLAY_EMPTY(x) ? NULL	\
+					: name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))
+#define SPLAY_MAX(name, x)		(SPLAY_EMPTY(x) ? NULL	\
+					: name##_SPLAY_MIN_MAX(x, SPLAY_INF))
+
+#define SPLAY_FOREACH(x, name, head)					\
+	for ((x) = SPLAY_MIN(name, head);				\
+	     (x) != NULL;						\
+	     (x) = SPLAY_NEXT(name, head, x))
+
+/* Macros that define a red-black tree */
+#define RB_HEAD(name, type)						\
+struct name {								\
+	struct type *rbh_root; /* root of the tree */			\
+}
+
+#define RB_INITIALIZER(root)						\
+	{ NULL }
+
+#define RB_INIT(root) do {						\
+	(root)->rbh_root = NULL;					\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_BLACK	0
+#define RB_RED		1
+#define RB_ENTRY(type)							\
+struct {								\
+	struct type *rbe_left;		/* left element */		\
+	struct type *rbe_right;		/* right element */		\
+	struct type *rbe_parent;	/* parent element */		\
+	int rbe_color;			/* node color */		\
+}
+
+#define RB_LEFT(elm, field)		(elm)->field.rbe_left
+#define RB_RIGHT(elm, field)		(elm)->field.rbe_right
+#define RB_PARENT(elm, field)		(elm)->field.rbe_parent
+#define RB_COLOR(elm, field)		(elm)->field.rbe_color
+#define RB_ROOT(head)			(head)->rbh_root
+#define RB_EMPTY(head)			(RB_ROOT(head) == NULL)
+
+#define RB_SET(elm, parent, field) do {					\
+	RB_PARENT(elm, field) = parent;					\
+	RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL;		\
+	RB_COLOR(elm, field) = RB_RED;					\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_SET_BLACKRED(black, red, field) do {				\
+	RB_COLOR(black, field) = RB_BLACK;				\
+	RB_COLOR(red, field) = RB_RED;					\
+} while (/*CONSTCOND*/ 0)
+
+#ifndef RB_AUGMENT
+#define RB_AUGMENT(x)	do {} while (/*CONSTCOND*/ 0)
+#endif
+
+#define RB_ROTATE_LEFT(head, elm, tmp, field) do {			\
+	(tmp) = RB_RIGHT(elm, field);					\
+	if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) {	\
+		RB_PARENT(RB_LEFT(tmp, field), field) = (elm);		\
+	}								\
+	RB_AUGMENT(elm);						\
+	if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) {	\
+		if ((elm) == RB_LEFT(RB_PARENT(elm, field), field))	\
+			RB_LEFT(RB_PARENT(elm, field), field) = (tmp);	\
+		else							\
+			RB_RIGHT(RB_PARENT(elm, field), field) = (tmp);	\
+	} else								\
+		(head)->rbh_root = (tmp);				\
+	RB_LEFT(tmp, field) = (elm);					\
+	RB_PARENT(elm, field) = (tmp);					\
+	RB_AUGMENT(tmp);						\
+	if ((RB_PARENT(tmp, field)))					\
+		RB_AUGMENT(RB_PARENT(tmp, field));			\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_ROTATE_RIGHT(head, elm, tmp, field) do {			\
+	(tmp) = RB_LEFT(elm, field);					\
+	if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) {	\
+		RB_PARENT(RB_RIGHT(tmp, field), field) = (elm);		\
+	}								\
+	RB_AUGMENT(elm);						\
+	if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) {	\
+		if ((elm) == RB_LEFT(RB_PARENT(elm, field), field))	\
+			RB_LEFT(RB_PARENT(elm, field), field) = (tmp);	\
+		else							\
+			RB_RIGHT(RB_PARENT(elm, field), field) = (tmp);	\
+	} else								\
+		(head)->rbh_root = (tmp);				\
+	RB_RIGHT(tmp, field) = (elm);					\
+	RB_PARENT(elm, field) = (tmp);					\
+	RB_AUGMENT(tmp);						\
+	if ((RB_PARENT(tmp, field)))					\
+		RB_AUGMENT(RB_PARENT(tmp, field));			\
+} while (/*CONSTCOND*/ 0)
+
+/* Generates prototypes and inline functions */
+#define RB_PROTOTYPE(name, type, field, cmp)				\
+	RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
+#define	RB_PROTOTYPE_STATIC(name, type, field, cmp)			\
+	RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr)		\
+attr void name##_RB_INSERT_COLOR(struct name *, struct type *);		\
+attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
+attr struct type *name##_RB_REMOVE(struct name *, struct type *);	\
+attr struct type *name##_RB_INSERT(struct name *, struct type *);	\
+attr struct type *name##_RB_FIND(struct name *, struct type *);		\
+attr struct type *name##_RB_NFIND(struct name *, struct type *);	\
+attr struct type *name##_RB_NEXT(struct type *);			\
+attr struct type *name##_RB_PREV(struct type *);			\
+attr struct type *name##_RB_MINMAX(struct name *, int);			\
+									\
+
+/* Main rb operation.
+ * Moves node close to the key of elm to top
+ */
+#define	RB_GENERATE(name, type, field, cmp)				\
+	RB_GENERATE_INTERNAL(name, type, field, cmp,)
+#define	RB_GENERATE_STATIC(name, type, field, cmp)			\
+	RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr)		\
+attr void								\
+name##_RB_INSERT_COLOR(struct name *head, struct type *elm)		\
+{									\
+	struct type *parent, *gparent, *tmp;				\
+	while ((parent = RB_PARENT(elm, field)) != NULL &&		\
+	    RB_COLOR(parent, field) == RB_RED) {			\
+		gparent = RB_PARENT(parent, field);			\
+		if (parent == RB_LEFT(gparent, field)) {		\
+			tmp = RB_RIGHT(gparent, field);			\
+			if (tmp && RB_COLOR(tmp, field) == RB_RED) {	\
+				RB_COLOR(tmp, field) = RB_BLACK;	\
+				RB_SET_BLACKRED(parent, gparent, field);\
+				elm = gparent;				\
+				continue;				\
+			}						\
+			if (RB_RIGHT(parent, field) == elm) {		\
+				RB_ROTATE_LEFT(head, parent, tmp, field);\
+				tmp = parent;				\
+				parent = elm;				\
+				elm = tmp;				\
+			}						\
+			RB_SET_BLACKRED(parent, gparent, field);	\
+			RB_ROTATE_RIGHT(head, gparent, tmp, field);	\
+		} else {						\
+			tmp = RB_LEFT(gparent, field);			\
+			if (tmp && RB_COLOR(tmp, field) == RB_RED) {	\
+				RB_COLOR(tmp, field) = RB_BLACK;	\
+				RB_SET_BLACKRED(parent, gparent, field);\
+				elm = gparent;				\
+				continue;				\
+			}						\
+			if (RB_LEFT(parent, field) == elm) {		\
+				RB_ROTATE_RIGHT(head, parent, tmp, field);\
+				tmp = parent;				\
+				parent = elm;				\
+				elm = tmp;				\
+			}						\
+			RB_SET_BLACKRED(parent, gparent, field);	\
+			RB_ROTATE_LEFT(head, gparent, tmp, field);	\
+		}							\
+	}								\
+	RB_COLOR(head->rbh_root, field) = RB_BLACK;			\
+}									\
+									\
+attr void								\
+name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
+{									\
+	struct type *tmp;						\
+	while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) &&	\
+	    elm != RB_ROOT(head)) {					\
+		if (RB_LEFT(parent, field) == elm) {			\
+			tmp = RB_RIGHT(parent, field);			\
+			if (RB_COLOR(tmp, field) == RB_RED) {		\
+				RB_SET_BLACKRED(tmp, parent, field);	\
+				RB_ROTATE_LEFT(head, parent, tmp, field);\
+				tmp = RB_RIGHT(parent, field);		\
+			}						\
+			if ((RB_LEFT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
+			    (RB_RIGHT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
+				RB_COLOR(tmp, field) = RB_RED;		\
+				elm = parent;				\
+				parent = RB_PARENT(elm, field);		\
+			} else {					\
+				if (RB_RIGHT(tmp, field) == NULL ||	\
+				    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\
+					struct type *oleft;		\
+					if ((oleft = RB_LEFT(tmp, field)) \
+					    != NULL)			\
+						RB_COLOR(oleft, field) = RB_BLACK;\
+					RB_COLOR(tmp, field) = RB_RED;	\
+					RB_ROTATE_RIGHT(head, tmp, oleft, field);\
+					tmp = RB_RIGHT(parent, field);	\
+				}					\
+				RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
+				RB_COLOR(parent, field) = RB_BLACK;	\
+				if (RB_RIGHT(tmp, field))		\
+					RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK;\
+				RB_ROTATE_LEFT(head, parent, tmp, field);\
+				elm = RB_ROOT(head);			\
+				break;					\
+			}						\
+		} else {						\
+			tmp = RB_LEFT(parent, field);			\
+			if (RB_COLOR(tmp, field) == RB_RED) {		\
+				RB_SET_BLACKRED(tmp, parent, field);	\
+				RB_ROTATE_RIGHT(head, parent, tmp, field);\
+				tmp = RB_LEFT(parent, field);		\
+			}						\
+			if ((RB_LEFT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
+			    (RB_RIGHT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
+				RB_COLOR(tmp, field) = RB_RED;		\
+				elm = parent;				\
+				parent = RB_PARENT(elm, field);		\
+			} else {					\
+				if (RB_LEFT(tmp, field) == NULL ||	\
+				    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\
+					struct type *oright;		\
+					if ((oright = RB_RIGHT(tmp, field)) \
+					    != NULL)			\
+						RB_COLOR(oright, field) = RB_BLACK;\
+					RB_COLOR(tmp, field) = RB_RED;	\
+					RB_ROTATE_LEFT(head, tmp, oright, field);\
+					tmp = RB_LEFT(parent, field);	\
+				}					\
+				RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
+				RB_COLOR(parent, field) = RB_BLACK;	\
+				if (RB_LEFT(tmp, field))		\
+					RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK;\
+				RB_ROTATE_RIGHT(head, parent, tmp, field);\
+				elm = RB_ROOT(head);			\
+				break;					\
+			}						\
+		}							\
+	}								\
+	if (elm)							\
+		RB_COLOR(elm, field) = RB_BLACK;			\
+}									\
+									\
+attr struct type *							\
+name##_RB_REMOVE(struct name *head, struct type *elm)			\
+{									\
+	struct type *child, *parent, *old = elm;			\
+	int color;							\
+	if (RB_LEFT(elm, field) == NULL)				\
+		child = RB_RIGHT(elm, field);				\
+	else if (RB_RIGHT(elm, field) == NULL)				\
+		child = RB_LEFT(elm, field);				\
+	else {								\
+		struct type *left;					\
+		elm = RB_RIGHT(elm, field);				\
+		while ((left = RB_LEFT(elm, field)) != NULL)		\
+			elm = left;					\
+		child = RB_RIGHT(elm, field);				\
+		parent = RB_PARENT(elm, field);				\
+		color = RB_COLOR(elm, field);				\
+		if (child)						\
+			RB_PARENT(child, field) = parent;		\
+		if (parent) {						\
+			if (RB_LEFT(parent, field) == elm)		\
+				RB_LEFT(parent, field) = child;		\
+			else						\
+				RB_RIGHT(parent, field) = child;	\
+			RB_AUGMENT(parent);				\
+		} else							\
+			RB_ROOT(head) = child;				\
+		if (RB_PARENT(elm, field) == old)			\
+			parent = elm;					\
+		(elm)->field = (old)->field;				\
+		if (RB_PARENT(old, field)) {				\
+			if (RB_LEFT(RB_PARENT(old, field), field) == old)\
+				RB_LEFT(RB_PARENT(old, field), field) = elm;\
+			else						\
+				RB_RIGHT(RB_PARENT(old, field), field) = elm;\
+			RB_AUGMENT(RB_PARENT(old, field));		\
+		} else							\
+			RB_ROOT(head) = elm;				\
+		RB_PARENT(RB_LEFT(old, field), field) = elm;		\
+		if (RB_RIGHT(old, field))				\
+			RB_PARENT(RB_RIGHT(old, field), field) = elm;	\
+		if (parent) {						\
+			left = parent;					\
+			do {						\
+				RB_AUGMENT(left);			\
+			} while ((left = RB_PARENT(left, field)) != NULL); \
+		}							\
+		goto color;						\
+	}								\
+	parent = RB_PARENT(elm, field);					\
+	color = RB_COLOR(elm, field);					\
+	if (child)							\
+		RB_PARENT(child, field) = parent;			\
+	if (parent) {							\
+		if (RB_LEFT(parent, field) == elm)			\
+			RB_LEFT(parent, field) = child;			\
+		else							\
+			RB_RIGHT(parent, field) = child;		\
+		RB_AUGMENT(parent);					\
+	} else								\
+		RB_ROOT(head) = child;					\
+color:									\
+	if (color == RB_BLACK)						\
+		name##_RB_REMOVE_COLOR(head, parent, child);		\
+	return (old);							\
+}									\
+									\
+/* Inserts a node into the RB tree */					\
+attr struct type *							\
+name##_RB_INSERT(struct name *head, struct type *elm)			\
+{									\
+	struct type *tmp;						\
+	struct type *parent = NULL;					\
+	int comp = 0;							\
+	tmp = RB_ROOT(head);						\
+	while (tmp) {							\
+		parent = tmp;						\
+		comp = (cmp)(elm, parent);				\
+		if (comp < 0)						\
+			tmp = RB_LEFT(tmp, field);			\
+		else if (comp > 0)					\
+			tmp = RB_RIGHT(tmp, field);			\
+		else							\
+			return (tmp);					\
+	}								\
+	RB_SET(elm, parent, field);					\
+	if (parent != NULL) {						\
+		if (comp < 0)						\
+			RB_LEFT(parent, field) = elm;			\
+		else							\
+			RB_RIGHT(parent, field) = elm;			\
+		RB_AUGMENT(parent);					\
+	} else								\
+		RB_ROOT(head) = elm;					\
+	name##_RB_INSERT_COLOR(head, elm);				\
+	return (NULL);							\
+}									\
+									\
+/* Finds the node with the same key as elm */				\
+attr struct type *							\
+name##_RB_FIND(struct name *head, struct type *elm)			\
+{									\
+	struct type *tmp = RB_ROOT(head);				\
+	int comp;							\
+	while (tmp) {							\
+		comp = cmp(elm, tmp);					\
+		if (comp < 0)						\
+			tmp = RB_LEFT(tmp, field);			\
+		else if (comp > 0)					\
+			tmp = RB_RIGHT(tmp, field);			\
+		else							\
+			return (tmp);					\
+	}								\
+	return (NULL);							\
+}									\
+									\
+/* Finds the first node greater than or equal to the search key */	\
+attr struct type *							\
+name##_RB_NFIND(struct name *head, struct type *elm)			\
+{									\
+	struct type *tmp = RB_ROOT(head);				\
+	struct type *res = NULL;					\
+	int comp;							\
+	while (tmp) {							\
+		comp = cmp(elm, tmp);					\
+		if (comp < 0) {						\
+			res = tmp;					\
+			tmp = RB_LEFT(tmp, field);			\
+		}							\
+		else if (comp > 0)					\
+			tmp = RB_RIGHT(tmp, field);			\
+		else							\
+			return (tmp);					\
+	}								\
+	return (res);							\
+}									\
+									\
+/* ARGSUSED */								\
+attr struct type *							\
+name##_RB_NEXT(struct type *elm)					\
+{									\
+	if (RB_RIGHT(elm, field)) {					\
+		elm = RB_RIGHT(elm, field);				\
+		while (RB_LEFT(elm, field))				\
+			elm = RB_LEFT(elm, field);			\
+	} else {							\
+		if (RB_PARENT(elm, field) &&				\
+		    (elm == RB_LEFT(RB_PARENT(elm, field), field)))	\
+			elm = RB_PARENT(elm, field);			\
+		else {							\
+			while (RB_PARENT(elm, field) &&			\
+			    (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
+				elm = RB_PARENT(elm, field);		\
+			elm = RB_PARENT(elm, field);			\
+		}							\
+	}								\
+	return (elm);							\
+}									\
+									\
+/* ARGSUSED */								\
+attr struct type *							\
+name##_RB_PREV(struct type *elm)					\
+{									\
+	if (RB_LEFT(elm, field)) {					\
+		elm = RB_LEFT(elm, field);				\
+		while (RB_RIGHT(elm, field))				\
+			elm = RB_RIGHT(elm, field);			\
+	} else {							\
+		if (RB_PARENT(elm, field) &&				\
+		    (elm == RB_RIGHT(RB_PARENT(elm, field), field)))	\
+			elm = RB_PARENT(elm, field);			\
+		else {							\
+			while (RB_PARENT(elm, field) &&			\
+			    (elm == RB_LEFT(RB_PARENT(elm, field), field)))\
+				elm = RB_PARENT(elm, field);		\
+			elm = RB_PARENT(elm, field);			\
+		}							\
+	}								\
+	return (elm);							\
+}									\
+									\
+attr struct type *							\
+name##_RB_MINMAX(struct name *head, int val)				\
+{									\
+	struct type *tmp = RB_ROOT(head);				\
+	struct type *parent = NULL;					\
+	while (tmp) {							\
+		parent = tmp;						\
+		if (val < 0)						\
+			tmp = RB_LEFT(tmp, field);			\
+		else							\
+			tmp = RB_RIGHT(tmp, field);			\
+	}								\
+	return (parent);						\
+}
+
+#define RB_NEGINF	-1
+#define RB_INF	1
+
+#define RB_INSERT(name, x, y)	name##_RB_INSERT(x, y)
+#define RB_REMOVE(name, x, y)	name##_RB_REMOVE(x, y)
+#define RB_FIND(name, x, y)	name##_RB_FIND(x, y)
+#define RB_NFIND(name, x, y)	name##_RB_NFIND(x, y)
+#define RB_NEXT(name, x, y)	name##_RB_NEXT(y)
+#define RB_PREV(name, x, y)	name##_RB_PREV(y)
+#define RB_MIN(name, x)		name##_RB_MINMAX(x, RB_NEGINF)
+#define RB_MAX(name, x)		name##_RB_MINMAX(x, RB_INF)
+
+#define RB_FOREACH(x, name, head)					\
+	for ((x) = RB_MIN(name, head);					\
+	     (x) != NULL;						\
+	     (x) = name##_RB_NEXT(x))
+
+#define RB_FOREACH_FROM(x, name, y)					\
+	for ((x) = (y);							\
+	    ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);	\
+	     (x) = (y))
+
+#define RB_FOREACH_SAFE(x, name, head, y)				\
+	for ((x) = RB_MIN(name, head);					\
+	    ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);	\
+	     (x) = (y))
+
+#define RB_FOREACH_REVERSE(x, name, head)				\
+	for ((x) = RB_MAX(name, head);					\
+	     (x) != NULL;						\
+	     (x) = name##_RB_PREV(x))
+
+#define RB_FOREACH_REVERSE_FROM(x, name, y)				\
+	for ((x) = (y);							\
+	    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);	\
+	     (x) = (y))
+
+#define RB_FOREACH_REVERSE_SAFE(x, name, head, y)			\
+	for ((x) = RB_MAX(name, head);					\
+	    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);	\
+	     (x) = (y))
+
+#endif	/* _SYS_TREE_H_ */

Property changes on: lab4/.minix-src/include/sys/tree.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/radioio.h
===================================================================
--- lab4/.minix-src/include/sys/radioio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/radioio.h	(revision 13)
@@ -0,0 +1,70 @@
+/* $NetBSD: radioio.h,v 1.3 2015/09/06 06:01:02 dholland Exp $ */
+/* $OpenBSD: radioio.h,v 1.2 2001/12/05 10:27:05 mickey Exp $ */
+/* $RuOBSD: radioio.h,v 1.4 2001/10/18 16:51:36 pva Exp $ */
+
+/*
+ * Copyright (c) 2001 Maxim Tsyplakov <tm@oganer.net>,
+ *                    Vladimir Popov <jumbo@narod.ru>
+ * 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 AUTHORS ``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 AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_RADIOIO_H_
+#define _SYS_RADIOIO_H_
+
+#include <sys/param.h>
+#include <sys/ioccom.h>
+
+#define MIN_FM_FREQ	87500
+#define MAX_FM_FREQ	108000
+
+#define IF_FREQ	10700
+
+struct radio_info {
+	int	mute;
+	int	volume;
+	int	stereo;
+	int	rfreq;	/* reference frequency */
+	int	lock;	/* locking field strength during an automatic search */
+	uint32_t	freq;	/* in kHz */
+	uint32_t	caps;	/* card capabilities */
+#define RADIO_CAPS_DETECT_STEREO	(1<<0)
+#define RADIO_CAPS_DETECT_SIGNAL	(1<<1)
+#define RADIO_CAPS_SET_MONO		(1<<2)
+#define RADIO_CAPS_HW_SEARCH		(1<<3)
+#define RADIO_CAPS_HW_AFC		(1<<4)
+#define RADIO_CAPS_REFERENCE_FREQ	(1<<5)
+#define RADIO_CAPS_LOCK_SENSITIVITY	(1<<6)
+#define RADIO_CAPS_RESERVED1		(1<<7)
+#define RADIO_CAPS_RESERVED2		(0xFF<<8)
+#define RADIO_CARD_TYPE			(0xFF<<16)
+	uint32_t	info;
+#define RADIO_INFO_STEREO		(1<<0)
+#define RADIO_INFO_SIGNAL		(1<<1)
+};
+
+/* Radio device operations */
+#define RIOCGINFO	_IOR('R', 21, struct radio_info) /* get info */
+#define RIOCSINFO	_IOWR('R', 22, struct radio_info) /* set info */
+#define RIOCSSRCH	_IOW('R', 23, int) /* search up/down */
+
+#endif /* _SYS_RADIOIO_H_ */

Property changes on: lab4/.minix-src/include/sys/radioio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/resource.h
===================================================================
--- lab4/.minix-src/include/sys/resource.h	(nonexistent)
+++ lab4/.minix-src/include/sys/resource.h	(revision 13)
@@ -0,0 +1,142 @@
+/*	$NetBSD: resource.h,v 1.33 2012/06/09 02:31:15 christos Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)resource.h	8.4 (Berkeley) 1/9/95
+ */
+
+#ifndef _SYS_RESOURCE_H_
+#define	_SYS_RESOURCE_H_
+
+#include <sys/featuretest.h>
+#include <sys/time.h>
+
+/*
+ * Process priority specifications to get/setpriority.
+ */
+#define	PRIO_MIN	-20
+#define	PRIO_MAX	20
+
+#define	PRIO_PROCESS	0
+#define	PRIO_PGRP	1
+#define	PRIO_USER	2
+
+/*
+ * Resource utilization information.
+ */
+
+#define	RUSAGE_SELF	0
+#define	RUSAGE_CHILDREN	-1
+
+struct	rusage {
+	struct timeval ru_utime;	/* user time used */
+	struct timeval ru_stime;	/* system time used */
+	long	ru_maxrss;		/* max resident set size */
+#define	ru_first	ru_ixrss
+	long	ru_ixrss;		/* integral shared memory size */
+	long	ru_idrss;		/* integral unshared data " */
+	long	ru_isrss;		/* integral unshared stack " */
+	long	ru_minflt;		/* page reclaims */
+	long	ru_majflt;		/* page faults */
+	long	ru_nswap;		/* swaps */
+	long	ru_inblock;		/* block input operations */
+	long	ru_oublock;		/* block output operations */
+	long	ru_msgsnd;		/* messages sent */
+	long	ru_msgrcv;		/* messages received */
+	long	ru_nsignals;		/* signals received */
+	long	ru_nvcsw;		/* voluntary context switches */
+	long	ru_nivcsw;		/* involuntary " */
+#define	ru_last		ru_nivcsw
+};
+
+/*
+ * Resource limits
+ */
+#define	RLIMIT_CPU	0		/* cpu time in milliseconds */
+#define	RLIMIT_FSIZE	1		/* maximum file size */
+#define	RLIMIT_DATA	2		/* data size */
+#define	RLIMIT_STACK	3		/* stack size */
+#define	RLIMIT_CORE	4		/* core file size */
+#define	RLIMIT_RSS	5		/* resident set size */
+#define	RLIMIT_MEMLOCK	6		/* locked-in-memory address space */
+#define	RLIMIT_NPROC	7		/* number of processes */
+#define	RLIMIT_NOFILE	8		/* number of open files */
+#define	RLIMIT_SBSIZE	9		/* maximum size of all socket buffers */
+#define	RLIMIT_AS	10		/* virtual process size (inclusive of mmap) */
+#define	RLIMIT_VMEM	RLIMIT_AS	/* common alias */
+#define	RLIMIT_NTHR	11		/* number of threads */
+
+#if defined(_NETBSD_SOURCE)
+#define	RLIM_NLIMITS	12		/* number of resource limits */
+#endif
+
+#define	RLIM_INFINITY	(~((u_quad_t)1 << 63))	/* no limit */
+#define	RLIM_SAVED_MAX	RLIM_INFINITY	/* unrepresentable hard limit */
+#define	RLIM_SAVED_CUR	RLIM_INFINITY	/* unrepresentable soft limit */
+
+#if defined(_KERNEL)
+/* 4.3BSD compatibility rlimit argument structure. */
+struct orlimit {
+	int32_t	rlim_cur;		/* current (soft) limit */
+	int32_t	rlim_max;		/* maximum value for rlim_cur */
+};
+#endif
+
+struct rlimit {
+	rlim_t	rlim_cur;		/* current (soft) limit */
+	rlim_t	rlim_max;		/* maximum value for rlim_cur */
+};
+
+#if defined(_NETBSD_SOURCE)
+/* Load average structure. */
+struct loadavg {
+	fixpt_t	ldavg[3];
+	long	fscale;
+};
+#endif
+
+#ifdef _KERNEL
+extern struct loadavg averunnable;
+struct pcred;
+int	dosetrlimit(struct lwp *, struct proc *, int, struct rlimit *);
+#else
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	getpriority(int, id_t);
+int	getrlimit(int, struct rlimit *);
+#ifndef __LIBC12_SOURCE__
+int	getrusage(int, struct rusage *) __RENAME(__getrusage50);
+#endif
+int	setpriority(int, id_t, int);
+int	setrlimit(int, const struct rlimit *);
+__END_DECLS
+
+#endif	/* _KERNEL */
+#endif	/* !_SYS_RESOURCE_H_ */

Property changes on: lab4/.minix-src/include/sys/resource.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/rwlock.h
===================================================================
--- lab4/.minix-src/include/sys/rwlock.h	(nonexistent)
+++ lab4/.minix-src/include/sys/rwlock.h	(revision 13)
@@ -0,0 +1,121 @@
+/*	$NetBSD: rwlock.h,v 1.10 2010/02/08 09:54:27 skrll Exp $	*/
+
+/*-
+ * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe and Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_RWLOCK_H_
+#define	_SYS_RWLOCK_H_
+
+/*
+ * The rwlock provides exclusive access when held as a "writer",
+ * and shared access when held as a "reader".
+ *
+ * Architectures may optionally provide stubs for the following functions to
+ * implement the easy (unlocked, no waiters) cases.  If these stubs are
+ * provided, __HAVE_RW_STUBS should be defined.
+ *
+ *	rw_enter()
+ *	rw_exit()
+ *	rw_tryenter()
+ */
+
+#if defined(_KERNEL_OPT)
+#include "opt_lockdebug.h"
+#endif
+
+#if !defined(_KERNEL)
+#include <sys/types.h>
+#include <sys/inttypes.h>
+#endif
+
+typedef enum krw_t {
+	RW_READER = 0,
+	RW_WRITER = 1
+} krw_t;
+
+typedef struct krwlock krwlock_t;
+
+#ifdef __RWLOCK_PRIVATE
+/*
+ * Bits in the owner field of the lock that indicate lock state.  If the
+ * WRITE_LOCKED bit is clear, then the owner field is actually a count of
+ * the number of readers.  The rw_owner field is laid out like so:
+ *
+ *	 N                    4        3        2        1        0
+ *	+---------------------------------------------------------+
+ *	| owner or read count | nodbug | wrlock | wrwant |  wait  |
+ *	+---------------------------------------------------------+
+ */
+#define	RW_HAS_WAITERS		0x01UL	/* lock has waiters */
+#define	RW_WRITE_WANTED		0x02UL	/* >= 1 waiter is a writer */
+#define	RW_WRITE_LOCKED		0x04UL	/* lock is currently write locked */
+#if defined(LOCKDEBUG)
+#define	RW_NODEBUG		0x08UL	/* LOCKDEBUG disabled */
+#else
+#define	RW_NODEBUG		0x00UL	/* do nothing */
+#endif	/* LOCKDEBUG */
+
+#define	RW_READ_COUNT_SHIFT	4
+#define	RW_READ_INCR		(1UL << RW_READ_COUNT_SHIFT)
+#define	RW_THREAD		((uintptr_t)-RW_READ_INCR)
+#define	RW_OWNER(rw)		((rw)->rw_owner & RW_THREAD)
+#define	RW_COUNT(rw)		((rw)->rw_owner & RW_THREAD)
+#define	RW_FLAGS(rw)		((rw)->rw_owner & ~RW_THREAD)
+
+void	rw_vector_enter(krwlock_t *, const krw_t);
+void	rw_vector_exit(krwlock_t *);
+int	rw_vector_tryenter(krwlock_t *, const krw_t);
+#endif	/* __RWLOCK_PRIVATE */
+
+#include <machine/rwlock.h>
+
+#ifdef _KERNEL
+
+void	rw_init(krwlock_t *);
+void	rw_destroy(krwlock_t *);
+
+int	rw_tryenter(krwlock_t *, const krw_t);
+int	rw_tryupgrade(krwlock_t *);
+void	rw_downgrade(krwlock_t *);
+
+int	rw_read_held(krwlock_t *);
+int	rw_write_held(krwlock_t *);
+int	rw_lock_held(krwlock_t *);
+
+void	rw_enter(krwlock_t *, const krw_t);
+void	rw_exit(krwlock_t *);
+
+void	rw_obj_init(void);
+krwlock_t *rw_obj_alloc(void);
+void	rw_obj_hold(krwlock_t *);
+bool	rw_obj_free(krwlock_t *);
+
+#endif	/* _KERNEL */
+
+#endif /* _SYS_RWLOCK_H_ */

Property changes on: lab4/.minix-src/include/sys/rwlock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/sdt.h
===================================================================
--- lab4/.minix-src/include/sys/sdt.h	(nonexistent)
+++ lab4/.minix-src/include/sys/sdt.h	(revision 13)
@@ -0,0 +1,424 @@
+/*-
+ * Copyright 2006-2008 John Birrell <jb@FreeBSD.org>
+ *
+ * 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: head/sys/sys/sdt.h 270990 2014-09-02 23:43:06Z markj $
+ *
+ * Statically Defined Tracing (SDT) definitions.
+ *
+ */
+
+#ifndef _SYS_SDT_H
+#define	_SYS_SDT_H
+
+#ifndef _KERNEL
+
+#define	_DTRACE_VERSION	1
+
+#define	DTRACE_PROBE(prov, name) {				\
+	extern void __dtrace_##prov##___##name(void);		\
+	__dtrace_##prov##___##name();				\
+}
+
+#define	DTRACE_PROBE1(prov, name, arg1) {			\
+	extern void __dtrace_##prov##___##name(unsigned long);	\
+	__dtrace_##prov##___##name((unsigned long)arg1);	\
+}
+
+#define	DTRACE_PROBE2(prov, name, arg1, arg2) {			\
+	extern void __dtrace_##prov##___##name(unsigned long,	\
+	    unsigned long);					\
+	__dtrace_##prov##___##name((unsigned long)arg1,		\
+	    (unsigned long)arg2);				\
+}
+
+#define	DTRACE_PROBE3(prov, name, arg1, arg2, arg3) {		\
+	extern void __dtrace_##prov##___##name(unsigned long,	\
+	    unsigned long, unsigned long);			\
+	__dtrace_##prov##___##name((unsigned long)arg1,		\
+	    (unsigned long)arg2, (unsigned long)arg3);		\
+}
+
+#define	DTRACE_PROBE4(prov, name, arg1, arg2, arg3, arg4) {	\
+	extern void __dtrace_##prov##___##name(unsigned long,	\
+	    unsigned long, unsigned long, unsigned long);	\
+	__dtrace_##prov##___##name((unsigned long)arg1,		\
+	    (unsigned long)arg2, (unsigned long)arg3,		\
+	    (unsigned long)arg4);				\
+}
+
+#define	DTRACE_PROBE5(prov, name, arg1, arg2, arg3, arg4, arg5) {	\
+	extern void __dtrace_##prov##___##name(unsigned long,		\
+	    unsigned long, unsigned long, unsigned long, unsigned long);\
+	__dtrace_##prov##___##name((unsigned long)arg1,			\
+	    (unsigned long)arg2, (unsigned long)arg3,			\
+	    (unsigned long)arg4, (unsigned long)arg5);			\
+}
+
+#else /* _KERNEL */
+
+#include <sys/cdefs.h>
+
+#ifndef KDTRACE_HOOKS
+
+#define SDT_PROVIDER_DEFINE(prov)
+#define SDT_PROVIDER_DECLARE(prov)
+#define SDT_PROBE_DEFINE(prov, mod, func, name)
+#define SDT_PROBE_DECLARE(prov, mod, func, name)
+#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
+#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype)
+
+#define	SDT_PROBE_DEFINE0(prov, mod, func, name)
+#define	SDT_PROBE_DEFINE1(prov, mod, func, name, arg0)
+#define	SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1)
+#define	SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2)
+#define	SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3)
+#define	SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
+#define	SDT_PROBE_DEFINE6(prov, mod, func, name, arg0, arg1, arg2,      \
+    arg3, arg4, arg5)
+#define	SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2,      \
+    arg3, arg4, arg5, arg6)
+
+#define	SDT_PROBE0(prov, mod, func, name)
+#define	SDT_PROBE1(prov, mod, func, name, arg0)
+#define	SDT_PROBE2(prov, mod, func, name, arg0, arg1)
+#define	SDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2)
+#define	SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3)
+#define	SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
+#define	SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5)
+#define	SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5,  \
+    arg6)
+
+#define	SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name)
+#define	SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, arg0, xarg0)
+#define	SDT_PROBE_DEFINE2_XLATE(prov, mod, func, name, arg0, xarg0,     \
+    arg1, xarg1)
+#define	SDT_PROBE_DEFINE3_XLATE(prov, mod, func, name, arg0, xarg0,     \
+    arg1, xarg1, arg2, xarg2)
+#define SDT_PROBE_DEFINE4_XLATE(prov, mod, func, name, arg0, xarg0,     \
+    arg1, xarg1, arg2, xarg2, arg3, xarg3)
+#define	SDT_PROBE_DEFINE5_XLATE(prov, mod, func, name, arg0, xarg0,     \
+    arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4)
+#define	SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, arg0, xarg0,     \
+    arg1,  xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5)
+#define	SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, arg0, xarg0,     \
+    arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6,     \
+    xarg6)
+
+#define	DTRACE_PROBE(name)
+#define	DTRACE_PROBE1(name, type0, arg0)
+#define	DTRACE_PROBE2(name, type0, arg0, type1, arg1)
+#define	DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2)
+#define	DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3)
+#define	DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3,\
+    type4, arg4)
+
+#else
+
+#define SDT_PROVIDER_DEFINE(prov)						\
+	struct sdt_provider sdt_provider_##prov[1] = {				\
+		{ #prov, { NULL, NULL }, 0, 0 }					\
+	};									\
+	__link_set_add_data(sdt_providers_set, sdt_provider_##prov);
+
+#define SDT_PROVIDER_DECLARE(prov)						\
+	extern struct sdt_provider sdt_provider_##prov[1]
+
+#define SDT_PROBE_DEFINE(prov, mod, func, name)					\
+	struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] = {		\
+		{ sizeof(struct sdt_probe), sdt_provider_##prov,		\
+		    { NULL, NULL }, { NULL, NULL }, #mod, #func, #name, 0, 0,	\
+		    NULL }							\
+	};									\
+	__link_set_add_data(sdt_probes_set, sdt_##prov##_##mod##_##func##_##name);
+
+#define SDT_PROBE_DECLARE(prov, mod, func, name)				\
+	extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1]
+
+#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)	do {	\
+	if (sdt_##prov##_##mod##_##func##_##name->id)				\
+		(*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id,	\
+		    (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2,	\
+		    (uintptr_t) arg3, (uintptr_t) arg4);			\
+} while (0)
+
+#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype)		\
+	static struct sdt_argtype sdta_##prov##_##mod##_##func##_##name##num[1]	\
+	    = { { num, type, xtype, { NULL, NULL },				\
+	    sdt_##prov##_##mod##_##func##_##name }				\
+	};									\
+	__link_set_add_data(sdt_argtypes_set, sdta_##prov##_##mod##_##func##_##name##num);
+
+#define	SDT_PROBE_DEFINE0(prov, mod, func, name)			\
+	SDT_PROBE_DEFINE(prov, mod, func, name)
+
+#define	SDT_PROBE_DEFINE1(prov, mod, func, name, arg0)			\
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL)
+
+#define	SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1)		\
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL)
+
+#define	SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2)\
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL)
+
+#define	SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL)
+
+#define	SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL)
+
+#define	SDT_PROBE_DEFINE6(prov, mod, func, name, arg0, arg1, arg2, arg3,\
+    arg4, arg5) \
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL)
+
+#define	SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2, arg3,\
+    arg4, arg5, arg6) \
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, NULL)
+
+#define	SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name)		\
+	SDT_PROBE_DEFINE(prov, mod, func, name)
+
+#define	SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, arg0, xarg0) \
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0)
+
+#define	SDT_PROBE_DEFINE2_XLATE(prov, mod, func, name, arg0, xarg0, \
+    arg1,  xarg1)							\
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1)
+
+#define	SDT_PROBE_DEFINE3_XLATE(prov, mod, func, name, arg0, xarg0, \
+    arg1, xarg1, arg2, xarg2)						\
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2)
+
+#define	SDT_PROBE_DEFINE4_XLATE(prov, mod, func, name, arg0, xarg0, \
+    arg1, xarg1, arg2, xarg2, arg3, xarg3)				\
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3)
+
+#define	SDT_PROBE_DEFINE5_XLATE(prov, mod, func, name, arg0, xarg0, \
+    arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4)			\
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4)
+
+#define	SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, arg0, xarg0, \
+    arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5)	\
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5)
+
+#define	SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, arg0, xarg0, \
+    arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \
+    xarg6)								\
+	SDT_PROBE_DEFINE(prov, mod, func, name);			\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5);	\
+	SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, xarg6)
+
+#define	SDT_PROBE0(prov, mod, func, name)				\
+	SDT_PROBE(prov, mod, func, name, 0, 0, 0, 0, 0)
+#define	SDT_PROBE1(prov, mod, func, name, arg0)				\
+	SDT_PROBE(prov, mod, func, name, arg0, 0, 0, 0, 0)
+#define	SDT_PROBE2(prov, mod, func, name, arg0, arg1)			\
+	SDT_PROBE(prov, mod, func, name, arg0, arg1, 0, 0, 0)
+#define	SDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2)		\
+	SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2,  0, 0)
+#define	SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3)	\
+	SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, 0)
+#define	SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \
+	SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
+#define	SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5)  \
+	do {								       \
+		if (sdt_##prov##_##mod##_##func##_##name->id)		       \
+			(*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \
+			    uintptr_t, uintptr_t, uintptr_t))sdt_probe_func)(  \
+			    sdt_##prov##_##mod##_##func##_##name->id,	       \
+			    (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \
+			    (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5);\
+	} while (0)
+#define	SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5,  \
+    arg6)								       \
+	do {								       \
+		if (sdt_##prov##_##mod##_##func##_##name->id)		       \
+			(*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \
+			    uintptr_t, uintptr_t, uintptr_t, uintptr_t))       \
+			    sdt_probe_func)(				       \
+			    sdt_##prov##_##mod##_##func##_##name->id,	       \
+			    (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \
+			    (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, \
+			    (uintptr_t)arg6);				       \
+	} while (0)
+
+#define	DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4)	do { \
+	static SDT_PROBE_DEFINE(sdt, , , name);				     \
+	SDT_PROBE(sdt, , , name, arg0, arg1, arg2, arg3, arg4);
+#define DTRACE_PROBE_IMPL_END	} while (0)
+
+#define DTRACE_PROBE(name)						\
+	DTRACE_PROBE_IMPL_START(name, 0, 0, 0, 0, 0)			\
+	DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE1(name, type0, arg0)				\
+	DTRACE_PROBE_IMPL_START(name, arg0, 0, 0, 0, 0) 		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL);		\
+	DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE2(name, type0, arg0, type1, arg1)			\
+	DTRACE_PROBE_IMPL_START(name, arg0, arg1, 0, 0, 0) 		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL);		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL);		\
+	DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2)	\
+	DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, 0, 0)	 	\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL);		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL);		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL);		\
+	DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3)	\
+	DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, 0) 	\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL);		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL);		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL);		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL);		\
+	DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3,	\
+    type4, arg4)								\
+	DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4) 	\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL);		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL);		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL);		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL);		\
+	SDT_PROBE_ARGTYPE(sdt, , , name, 4, #type4, NULL);		\
+	DTRACE_PROBE_IMPL_END
+
+#endif /* KDTRACE_HOOKS */
+
+/*
+ * This type definition must match that of dtrace_probe. It is defined this
+ * way to avoid having to rely on CDDL code.
+ */
+typedef	void (*sdt_probe_func_t)(uint32_t, uintptr_t arg0, uintptr_t arg1,
+    uintptr_t arg2, uintptr_t arg3, uintptr_t arg4);
+
+/*
+ * The 'sdt' provider will set it to dtrace_probe when it loads.
+ */
+extern sdt_probe_func_t	sdt_probe_func;
+
+struct sdt_probe;
+struct sdt_provider;
+struct linker_file;
+
+struct sdt_argtype {
+	int		ndx;		/* Argument index. */
+	const char	*type;		/* Argument type string. */
+	const char	*xtype;		/* Translated argument type. */
+	TAILQ_ENTRY(sdt_argtype)
+			argtype_entry;	/* Argument type list entry. */
+	struct sdt_probe *probe;	/* Ptr to the probe structure. */
+};
+
+struct sdt_probe {
+	int		version;	/* Set to sizeof(struct sdt_probe). */
+	struct sdt_provider *prov;	/* Ptr to the provider structure. */
+	TAILQ_ENTRY(sdt_probe)
+			probe_entry;	/* SDT probe list entry. */
+	TAILQ_HEAD(argtype_list_head, sdt_argtype) argtype_list;
+	const char	*mod;
+	const char	*func;
+	const char	*name;
+	id_t		id;		/* DTrace probe ID. */
+	int		n_args;		/* Number of arguments. */
+	struct linker_file *sdtp_lf;	/* Module in which we're defined. */
+};
+
+struct sdt_provider {
+	const char *name;		/* Provider name. */
+	TAILQ_ENTRY(sdt_provider)
+			prov_entry;	/* SDT provider list entry. */
+	uintptr_t	id;		/* DTrace provider ID. */
+	int		sdt_refs;	/* Number of module references. */
+};
+
+void sdt_probe_stub(uint32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
+    uintptr_t);
+
+SDT_PROVIDER_DECLARE(sdt);
+
+void sdt_init(void *); 
+void sdt_exit(void);
+
+
+#endif /* _KERNEL */
+
+#endif /* _SYS_SDT_H */

Property changes on: lab4/.minix-src/include/sys/sdt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/sha1.h
===================================================================
--- lab4/.minix-src/include/sys/sha1.h	(nonexistent)
+++ lab4/.minix-src/include/sys/sha1.h	(revision 13)
@@ -0,0 +1,37 @@
+/*	$NetBSD: sha1.h,v 1.14 2009/11/06 20:31:19 joerg Exp $	*/
+
+/*
+ * SHA-1 in C
+ * By Steve Reid <steve@edmweb.com>
+ * 100% Public Domain
+ */
+
+#ifndef _SYS_SHA1_H_
+#define	_SYS_SHA1_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#define SHA1_DIGEST_LENGTH		20
+#define SHA1_DIGEST_STRING_LENGTH	41
+
+typedef struct {
+	uint32_t state[5];
+	uint32_t count[2];
+	uint8_t buffer[64];
+} SHA1_CTX;
+
+__BEGIN_DECLS
+void	SHA1Transform(uint32_t[5], const uint8_t[64]);
+void	SHA1Init(SHA1_CTX *);
+void	SHA1Update(SHA1_CTX *, const uint8_t *, unsigned int);
+void	SHA1Final(uint8_t[SHA1_DIGEST_LENGTH], SHA1_CTX *);
+#ifndef _KERNEL
+char	*SHA1End(SHA1_CTX *, char *);
+char	*SHA1FileChunk(const char *, char *, off_t, off_t);
+char	*SHA1File(const char *, char *);
+char	*SHA1Data(const uint8_t *, size_t, char *);
+#endif /* _KERNEL */
+__END_DECLS
+
+#endif /* _SYS_SHA1_H_ */

Property changes on: lab4/.minix-src/include/sys/sha1.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/signal.h
===================================================================
--- lab4/.minix-src/include/sys/signal.h	(nonexistent)
+++ lab4/.minix-src/include/sys/signal.h	(revision 13)
@@ -0,0 +1,290 @@
+/*	$NetBSD: signal.h,v 1.67 2011/01/10 13:56:44 christos Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)signal.h	8.4 (Berkeley) 5/4/95
+ */
+
+#ifndef	_SYS_SIGNAL_H_
+#define	_SYS_SIGNAL_H_
+
+#include <sys/featuretest.h>
+#include <sys/sigtypes.h>
+
+#define _NSIG		64
+
+#if defined(_NETBSD_SOURCE)
+#define NSIG _NSIG
+
+#endif /* _NETBSD_SOURCE */
+
+#define	SIGHUP		1	/* hangup */
+#define	SIGINT		2	/* interrupt */
+#define	SIGQUIT		3	/* quit */
+#define	SIGILL		4	/* illegal instruction (not reset when caught) */
+#define	SIGTRAP		5	/* trace trap (not reset when caught) */
+#define	SIGABRT		6	/* abort() */
+#define	SIGIOT		SIGABRT	/* compatibility */
+#define	SIGEMT		7	/* EMT instruction */
+#define	SIGFPE		8	/* floating point exception */
+#define	SIGKILL		9	/* kill (cannot be caught or ignored) */
+#define	SIGBUS		10	/* bus error */
+#define	SIGSEGV		11	/* segmentation violation */
+#define	SIGSYS		12	/* bad argument to system call */
+#define	SIGPIPE		13	/* write on a pipe with no one to read it */
+#define	SIGALRM		14	/* alarm clock */
+#define	SIGTERM		15	/* software termination signal from kill */
+#define	SIGURG		16	/* urgent condition on IO channel */
+#define	SIGSTOP		17	/* sendable stop signal not from tty */
+#define	SIGTSTP		18	/* stop signal from tty */
+#define	SIGCONT		19	/* continue a stopped process */
+#define	SIGCHLD		20	/* to parent on child stop or exit */
+#define	SIGTTIN		21	/* to readers pgrp upon background tty read */
+#define	SIGTTOU		22	/* like TTIN for output if (tp->t_local&LTOSTOP) */
+#define	SIGIO		23	/* input/output possible signal */
+#define	SIGXCPU		24	/* exceeded CPU time limit */
+#define	SIGXFSZ		25	/* exceeded file size limit */
+#define	SIGVTALRM	26	/* virtual time alarm */
+#define	SIGPROF		27	/* profiling time alarm */
+#define	SIGWINCH	28	/* window size changes */
+#define	SIGINFO		29	/* information request */
+#define	SIGUSR1		30	/* user defined signal 1 */
+#define	SIGUSR2		31	/* user defined signal 2 */
+#define	SIGPWR		32	/* power fail/restart (not reset when caught) */
+
+#if !defined(__minix)
+#ifdef _KERNEL
+#define	SIGRTMIN	33	/* Kernel only; not exposed to userland yet */
+#define	SIGRTMAX	63	/* Kernel only; not exposed to userland yet */
+#endif
+#endif /* !defined(__minix) */
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+#endif
+
+#define	SIG_DFL		((void (*)(int))  0)
+#define	SIG_IGN		((void (*)(int))  1)
+#define	SIG_ERR		((void (*)(int)) -1)
+#define	SIG_HOLD	((void (*)(int))  3)
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+
+#ifdef _KERNEL
+#define	sigaddset(s, n)		__sigaddset(s, n)
+#define	sigdelset(s, n)		__sigdelset(s, n)
+#define	sigismember(s, n)	__sigismember(s, n)
+#define	sigemptyset(s)		__sigemptyset(s)
+#define	sigfillset(s)		__sigfillset(s)
+#define sigplusset(s, t)	__sigplusset(s, t)
+#define sigminusset(s, t)	__sigminusset(s, t)
+#endif /* _KERNEL */
+
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#include <sys/siginfo.h>
+#endif
+
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+#include <sys/ucontext.h>
+#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+
+/*
+ * Signal vector "template" used in sigaction call.
+ */
+struct	sigaction {
+	union {
+		void (*_sa_handler)(int);
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+		void (*_sa_sigaction)(int, siginfo_t *, void *);
+#endif
+	} _sa_u;	/* signal handler */
+	sigset_t sa_mask;		/* signal mask to apply */
+	int	sa_flags;		/* see signal options below */
+};
+
+#define sa_handler _sa_u._sa_handler
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#define sa_sigaction _sa_u._sa_sigaction
+#endif
+
+#include <machine/signal.h>	/* sigcontext; codes for SIGILL, SIGFPE */
+
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+#define SA_ONSTACK	0x0001	/* take signal on signal stack */
+#define SA_RESTART	0x0002	/* restart system call on signal return */
+#define SA_RESETHAND	0x0004	/* reset to SIG_DFL when taking signal */
+#define SA_NODEFER	0x0010	/* don't mask the signal we're delivering */
+#endif /* _XOPEN_SOURCE_EXTENDED || XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+/* Only valid for SIGCHLD. */
+#define SA_NOCLDSTOP	0x0008	/* do not generate SIGCHLD on child stop */
+#define SA_NOCLDWAIT	0x0020	/* do not generate zombies on unwaited child */
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#if !defined(__minix)
+#define SA_SIGINFO	0x0040	/* take sa_sigaction handler */
+#endif /* !defined(__minix) */
+#endif /* (_POSIX_C_SOURCE - 0) >= 199309L || ... */
+#if defined(_NETBSD_SOURCE)
+#define	SA_NOKERNINFO	0x0080	/* siginfo does not print kernel info on tty */
+#endif /*_NETBSD_SOURCE */
+#ifdef _KERNEL
+#define	SA_ALLBITS	0x00ff
+#endif
+
+/*
+ * Flags for sigprocmask():
+ */
+#define	SIG_BLOCK	1	/* block specified signal set */
+#define	SIG_UNBLOCK	2	/* unblock specified signal set */
+#define	SIG_SETMASK	3	/* set specified signal set */
+
+#if defined(__minix)
+#define SIG_INQUIRE    10	/* for internal use only */
+#endif /* defined(__minix) */
+
+#if defined(_NETBSD_SOURCE)
+typedef	void (*sig_t)(int);	/* type of signal function */
+#endif
+
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+/*
+ * Flags used with stack_t/struct sigaltstack.
+ */
+#define SS_ONSTACK	0x0001	/* take signals on alternate stack */
+#define SS_DISABLE	0x0004	/* disable taking signals on alternate stack */
+#ifdef _KERNEL
+#define	SS_ALLBITS	0x0005
+#endif
+#define	MINSIGSTKSZ	8192			/* minimum allowable stack */
+#define	SIGSTKSZ	(MINSIGSTKSZ + 32768)	/* recommended stack size */
+#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+/*
+ * Structure used in sigstack call.
+ */
+struct	sigstack {
+	void	*ss_sp;			/* signal stack pointer */
+	int	ss_onstack;		/* current status */
+};
+#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE) && !defined(_KERNEL)
+/*
+ * Macro for converting signal number to a mask suitable for
+ * sigblock().
+ */
+#define sigmask(n)	__sigmask(n)
+
+#define	BADSIG		SIG_ERR
+#endif /* _NETBSD_SOURCE */
+
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+struct	sigevent {
+	int	sigev_notify;
+	int	sigev_signo;
+	union sigval	sigev_value;
+	void	(*sigev_notify_function)(union sigval);
+	void /* pthread_attr_t */	*sigev_notify_attributes;
+};
+
+#define SIGEV_NONE	0
+#define SIGEV_SIGNAL	1
+#define SIGEV_THREAD	2
+#if defined(_NETBSD_SOURCE)
+#define SIGEV_SA	3
+#endif
+#endif /* (_POSIX_C_SOURCE - 0) >= 199309L || ... */
+
+#endif	/* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+/*
+ * For historical reasons; programs expect signal's return value to be
+ * defined by <sys/signal.h>.
+ */
+__BEGIN_DECLS
+void	(*signal(int, void (*)(int)))(int);
+#if (_POSIX_C_SOURCE - 0) >= 200112L || defined(_NETBSD_SOURCE)
+int	sigqueue(pid_t, int, const union sigval);
+#endif
+#if defined(_NETBSD_SOURCE)
+int	sigqueueinfo(pid_t, const siginfo_t *);
+#endif
+__END_DECLS
+
+#if defined(__minix) && defined(_NETBSD_SOURCE)
+
+/* MINIX specific signals. These signals are not used by user proceses, 
+ * but meant to inform system processes, like the PM, about system events.
+ * The order here determines the order signals are processed by system
+ * processes in user-space. Higher-priority signals should be first.
+ */
+/* Signals delivered by a signal manager. */
+
+#define SIGSNDELAY      70    /* end of delay for signal delivery */
+
+#define SIGS_FIRST       SIGHUP      /* first system signal */
+#define SIGS_LAST        SIGSNDELAY   /* last system signal */
+#define IS_SIGS(signo)    (signo>=SIGS_FIRST && signo<=SIGS_LAST)
+
+/* Signals delivered by the kernel. */
+#define SIGKMEM          71    /* kernel memory request pending */
+#define SIGKMESS         72    /* new kernel message */
+#define SIGKSIGSM        73    /* kernel signal pending for signal manager */
+#define SIGKSIG          74    /* kernel signal pending */
+ 
+#define SIGK_FIRST       SIGKMEM /* first kernel signal */
+#define SIGK_LAST        SIGKSIG /* last kernel signal; _NSIG must cover it! */
+#define IS_SIGK(signo)    (signo>=SIGK_FIRST && signo<=SIGK_LAST)
+
+/* Termination signals for Minix system processes. */
+#define SIGS_IS_LETHAL(sig) \
+    (sig == SIGILL || sig == SIGBUS || sig == SIGFPE || sig == SIGSEGV \
+    || sig == SIGEMT || sig == SIGABRT)
+#define SIGS_IS_TERMINATION(sig) (SIGS_IS_LETHAL(sig) \
+    || (sig == SIGKILL || sig == SIGPIPE))
+#define SIGS_IS_STACKTRACE(sig) (SIGS_IS_LETHAL(sig) && sig != SIGABRT)
+
+#endif /* defined(__minix) && defined(_NETBSD_SOURCE) */
+
+#endif	/* !_SYS_SIGNAL_H_ */

Property changes on: lab4/.minix-src/include/sys/signal.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/socket.h
===================================================================
--- lab4/.minix-src/include/sys/socket.h	(nonexistent)
+++ lab4/.minix-src/include/sys/socket.h	(revision 13)
@@ -0,0 +1,672 @@
+/*	$NetBSD: socket.h,v 1.117 2015/04/03 20:01:08 rtr Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)socket.h	8.6 (Berkeley) 5/3/95
+ */
+
+#ifndef _SYS_SOCKET_H_
+#define	_SYS_SOCKET_H_
+
+#include <sys/featuretest.h>
+
+/*
+ * Definitions related to sockets: types, address families, options.
+ */
+
+/*
+ * Data types.
+ */
+#include <sys/ansi.h>
+
+#ifndef sa_family_t
+typedef __sa_family_t	sa_family_t;
+#define sa_family_t	__sa_family_t
+#endif
+
+#ifndef socklen_t
+typedef __socklen_t	socklen_t;
+#define socklen_t	__socklen_t
+#endif
+
+#include <machine/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#ifdef	_BSD_SSIZE_T_
+typedef	_BSD_SSIZE_T_	ssize_t;
+#undef	_BSD_SSIZE_T_
+#endif
+
+#include <sys/uio.h>
+#include <sys/sigtypes.h>
+
+/*
+ * Socket types.
+ */
+#define	SOCK_STREAM	1		/* stream socket */
+#define	SOCK_DGRAM	2		/* datagram socket */
+#define	SOCK_RAW	3		/* raw-protocol interface */
+#define	SOCK_RDM	4		/* reliably-delivered message */
+#define	SOCK_SEQPACKET	5		/* sequenced packet stream */
+#define	SOCK_CONN_DGRAM	6		/* connection-orientated datagram */
+#define	SOCK_DCCP	SOCK_CONN_DGRAM
+
+#define	SOCK_CLOEXEC	0x10000000	/* set close on exec on socket */
+#define	SOCK_NONBLOCK	0x20000000	/* set non blocking i/o socket */
+#define	SOCK_NOSIGPIPE	0x40000000	/* don't send sigpipe */
+#define	SOCK_FLAGS_MASK	0xf0000000	/* flags mask */
+
+/*
+ * Option flags per-socket.
+ */
+#define	SO_DEBUG	0x0001		/* turn on debugging info recording */
+#define	SO_ACCEPTCONN	0x0002		/* socket has had listen() */
+#define	SO_REUSEADDR	0x0004		/* allow local address reuse */
+#define	SO_KEEPALIVE	0x0008		/* keep connections alive */
+#define	SO_DONTROUTE	0x0010		/* just use interface addresses */
+#define	SO_BROADCAST	0x0020		/* permit sending of broadcast msgs */
+#define	SO_USELOOPBACK	0x0040		/* bypass hardware when possible */
+#define	SO_LINGER	0x0080		/* linger on close if data present */
+#define	SO_OOBINLINE	0x0100		/* leave received OOB data in line */
+#define	SO_REUSEPORT	0x0200		/* allow local address & port reuse */
+/* 	SO_OTIMESTAMP	0x0400		*/
+#define	SO_NOSIGPIPE	0x0800		/* no SIGPIPE from EPIPE */
+#define	SO_ACCEPTFILTER	0x1000		/* there is an accept filter */
+#define	SO_TIMESTAMP	0x2000		/* timestamp received dgram traffic */
+
+/*
+ * Additional options, not kept in so_options.
+ */
+#define SO_SNDBUF	0x1001		/* send buffer size */
+#define SO_RCVBUF	0x1002		/* receive buffer size */
+#define SO_SNDLOWAT	0x1003		/* send low-water mark */
+#define SO_RCVLOWAT	0x1004		/* receive low-water mark */
+/* SO_OSNDTIMEO		0x1005 */
+/* SO_ORCVTIMEO		0x1006 */
+#define	SO_ERROR	0x1007		/* get error status and clear */
+#define	SO_TYPE		0x1008		/* get socket type */
+#define	SO_OVERFLOWED	0x1009		/* datagrams: return packets dropped */
+
+#define	SO_NOHEADER	0x100a		/* user supplies no header to kernel;
+					 * kernel removes header and supplies
+					 * payload
+					 */
+#define SO_SNDTIMEO	0x100b		/* send timeout */
+#define SO_RCVTIMEO	0x100c		/* receive timeout */
+/*
+ * Structure used for manipulating linger option.
+ */
+struct	linger {
+	int	l_onoff;		/* option on/off */
+	int	l_linger;		/* linger time in seconds */
+};
+
+struct	accept_filter_arg {
+	char	af_name[16];
+	char	af_arg[256-16];
+};
+
+/*
+ * Level number for (get/set)sockopt() to apply to socket itself.
+ */
+#define	SOL_SOCKET	0xffff		/* options for socket level */
+
+/*
+ * Address families.
+ */
+#define	AF_UNSPEC	0		/* unspecified */
+#define	AF_LOCAL	1		/* local to host */
+#define	AF_UNIX		AF_LOCAL	/* backward compatibility */
+#define	AF_INET		2		/* internetwork: UDP, TCP, etc. */
+#define	AF_IMPLINK	3		/* arpanet imp addresses */
+#define	AF_PUP		4		/* pup protocols: e.g. BSP */
+#define	AF_CHAOS	5		/* mit CHAOS protocols */
+#define	AF_NS		6		/* XEROX NS protocols */
+#define	AF_ISO		7		/* ISO protocols */
+#define	AF_OSI		AF_ISO
+#define	AF_ECMA		8		/* european computer manufacturers */
+#define	AF_DATAKIT	9		/* datakit protocols */
+#define	AF_CCITT	10		/* CCITT protocols, X.25 etc */
+#define	AF_SNA		11		/* IBM SNA */
+#define AF_DECnet	12		/* DECnet */
+#define AF_DLI		13		/* DEC Direct data link interface */
+#define AF_LAT		14		/* LAT */
+#define	AF_HYLINK	15		/* NSC Hyperchannel */
+#define	AF_APPLETALK	16		/* Apple Talk */
+#define	AF_OROUTE	17		/* Internal Routing Protocol */
+#define	AF_LINK		18		/* Link layer interface */
+#if defined(_NETBSD_SOURCE)
+#define	pseudo_AF_XTP	19		/* eXpress Transfer Protocol (no AF) */
+#endif
+#define	AF_COIP		20		/* connection-oriented IP, aka ST II */
+#define	AF_CNT		21		/* Computer Network Technology */
+#if defined(_NETBSD_SOURCE)
+#define pseudo_AF_RTIP	22		/* Help Identify RTIP packets */
+#endif
+#define	AF_IPX		23		/* Novell Internet Protocol */
+#define	AF_INET6	24		/* IP version 6 */
+#if defined(_NETBSD_SOURCE)
+#define pseudo_AF_PIP	25		/* Help Identify PIP packets */
+#endif
+#define AF_ISDN		26		/* Integrated Services Digital Network*/
+#define AF_E164		AF_ISDN		/* CCITT E.164 recommendation */
+#define AF_NATM		27		/* native ATM access */
+#define AF_ARP		28		/* (rev.) addr. res. prot. (RFC 826) */
+#if defined(_NETBSD_SOURCE)
+#define pseudo_AF_KEY	29		/* Internal key management protocol  */
+#define	pseudo_AF_HDRCMPLT 30		/* Used by BPF to not rewrite hdrs
+					   in interface output routine */
+#endif
+#define AF_BLUETOOTH	31		/* Bluetooth: HCI, SCO, L2CAP, RFCOMM */
+#define	AF_IEEE80211	32		/* IEEE80211 */
+#define	AF_MPLS		33		/* MultiProtocol Label Switching */
+#define	AF_ROUTE	34		/* Internal Routing Protocol */
+#define	AF_MAX		35
+
+/*
+ * Structure used by kernel to store most
+ * addresses.
+ */
+struct sockaddr {
+	__uint8_t	sa_len;		/* total length */
+	sa_family_t	sa_family;	/* address family */
+	char		sa_data[14];	/* actually longer; address value */
+};
+
+#if defined(_KERNEL)
+/*
+ * Structure used by kernel to pass protocol
+ * information in raw sockets.
+ */
+struct sockproto {
+	u_short	sp_family;		/* address family */
+	u_short	sp_protocol;		/* protocol */
+};
+
+/*
+ * we make the entire struct at least UCHAR_MAX + 1 in size since existing
+ * use of sockaddr_un permits a path up to 253 bytes + '\0'.
+ * sizeof(sb_len) + sizeof(sb_family) + 253 + '\0'
+ */
+#define _SB_DATASIZE	254
+struct sockaddr_big {
+    union {
+	struct {
+	    __uint8_t	sb_len;
+	    sa_family_t	sb_family;
+	    char	sb_data[_SB_DATASIZE];
+	};
+	uint64_t dummy; /* solicit natural alignment */
+    };
+};
+
+#endif /* _KERNEL */
+
+#if 1
+/*
+ * RFC 2553: protocol-independent placeholder for socket addresses
+ */
+#define _SS_MAXSIZE	128
+#define _SS_ALIGNSIZE	(sizeof(__int64_t))
+#define _SS_PAD1SIZE	(_SS_ALIGNSIZE - 2)
+#define _SS_PAD2SIZE	(_SS_MAXSIZE - 2 - \
+				_SS_PAD1SIZE - _SS_ALIGNSIZE)
+
+#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+struct sockaddr_storage {
+	__uint8_t	ss_len;		/* address length */
+	sa_family_t	ss_family;	/* address family */
+	char		__ss_pad1[_SS_PAD1SIZE];
+	__int64_t     __ss_align;/* force desired structure storage alignment */
+	char		__ss_pad2[_SS_PAD2SIZE];
+};
+#define	sstosa(__ss)	((struct sockaddr *)(__ss))
+#define	sstocsa(__ss)	((const struct sockaddr *)(__ss))
+#endif /* _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+#endif /* 1 */
+
+/*
+ * Protocol families, same as address families for now.
+ */
+#define	PF_UNSPEC	AF_UNSPEC
+#define	PF_LOCAL	AF_LOCAL
+#define	PF_UNIX		PF_LOCAL	/* backward compatibility */
+#define	PF_INET		AF_INET
+#define	PF_IMPLINK	AF_IMPLINK
+#define	PF_PUP		AF_PUP
+#define	PF_CHAOS	AF_CHAOS
+#define	PF_NS		AF_NS
+#define	PF_ISO		AF_ISO
+#define	PF_OSI		AF_ISO
+#define	PF_ECMA		AF_ECMA
+#define	PF_DATAKIT	AF_DATAKIT
+#define	PF_CCITT	AF_CCITT
+#define	PF_SNA		AF_SNA
+#define PF_DECnet	AF_DECnet
+#define PF_DLI		AF_DLI
+#define PF_LAT		AF_LAT
+#define	PF_HYLINK	AF_HYLINK
+#define	PF_APPLETALK	AF_APPLETALK
+#define	PF_OROUTE	AF_OROUTE
+#define	PF_LINK		AF_LINK
+#if defined(_NETBSD_SOURCE)
+#define	PF_XTP		pseudo_AF_XTP	/* really just proto family, no AF */
+#endif
+#define	PF_COIP		AF_COIP
+#define	PF_CNT		AF_CNT
+#define	PF_INET6	AF_INET6
+#define	PF_IPX		AF_IPX		/* same format as AF_NS */
+#if defined(_NETBSD_SOURCE)
+#define PF_RTIP		pseudo_AF_RTIP	/* same format as AF_INET */
+#define PF_PIP		pseudo_AF_PIP
+#endif
+#define PF_ISDN		AF_ISDN		/* same as E164 */
+#define PF_E164		AF_E164
+#define PF_NATM		AF_NATM
+#define PF_ARP		AF_ARP
+#if defined(_NETBSD_SOURCE)
+#define PF_KEY 		pseudo_AF_KEY	/* like PF_ROUTE, only for key mgmt */
+#endif
+#define PF_BLUETOOTH	AF_BLUETOOTH
+#define	PF_MPLS		AF_MPLS
+#define	PF_ROUTE	AF_ROUTE
+
+#define	PF_MAX		AF_MAX
+
+#if defined(_NETBSD_SOURCE)
+
+#ifndef	gid_t
+typedef	__gid_t		gid_t;		/* group id */
+#define	gid_t		__gid_t
+#endif
+
+#ifndef	uid_t
+typedef	__uid_t		uid_t;		/* user id */
+#define	uid_t		__uid_t
+#endif
+
+/*
+ * Socket credentials.
+ */
+struct sockcred {
+	uid_t	sc_uid;			/* real user id */
+	uid_t	sc_euid;		/* effective user id */
+	gid_t	sc_gid;			/* real group id */
+	gid_t	sc_egid;		/* effective group id */
+	int	sc_ngroups;		/* number of supplemental groups */
+	gid_t	sc_groups[1];		/* variable length */
+};
+
+/*
+ * Compute size of a sockcred structure with groups.
+ */
+#define	SOCKCREDSIZE(ngrps) \
+	(/*CONSTCOND*/sizeof(struct sockcred) + (sizeof(gid_t) * \
+	    ((ngrps) ? ((ngrps) - 1) : 0)))
+#endif /* _NETBSD_SOURCE */
+
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Definitions for network related sysctl, CTL_NET.
+ *
+ * Second level is protocol family.
+ * Third level is protocol number.
+ *
+ * Further levels are defined by the individual families below.
+ */
+#define NET_MAXID	AF_MAX
+
+#define CTL_NET_NAMES { \
+	{ 0, 0 }, \
+	{ "local", CTLTYPE_NODE }, \
+	{ "inet", CTLTYPE_NODE }, \
+	{ "implink", CTLTYPE_NODE }, \
+	{ "pup", CTLTYPE_NODE }, \
+	{ "chaos", CTLTYPE_NODE }, \
+	{ "xerox_ns", CTLTYPE_NODE }, \
+	{ "iso", CTLTYPE_NODE }, \
+	{ "emca", CTLTYPE_NODE }, \
+	{ "datakit", CTLTYPE_NODE }, \
+	{ "ccitt", CTLTYPE_NODE }, \
+	{ "ibm_sna", CTLTYPE_NODE }, \
+	{ "decnet", CTLTYPE_NODE }, \
+	{ "dec_dli", CTLTYPE_NODE }, \
+	{ "lat", CTLTYPE_NODE }, \
+	{ "hylink", CTLTYPE_NODE }, \
+	{ "appletalk", CTLTYPE_NODE }, \
+	{ "oroute", CTLTYPE_NODE }, \
+	{ "link_layer", CTLTYPE_NODE }, \
+	{ "xtp", CTLTYPE_NODE }, \
+	{ "coip", CTLTYPE_NODE }, \
+	{ "cnt", CTLTYPE_NODE }, \
+	{ "rtip", CTLTYPE_NODE }, \
+	{ "ipx", CTLTYPE_NODE }, \
+	{ "inet6", CTLTYPE_NODE }, \
+	{ "pip", CTLTYPE_NODE }, \
+	{ "isdn", CTLTYPE_NODE }, \
+	{ "natm", CTLTYPE_NODE }, \
+	{ "arp", CTLTYPE_NODE }, \
+	{ "key", CTLTYPE_NODE }, \
+	{ "ieee80211", CTLTYPE_NODE }, \
+	{ "mlps", CTLTYPE_NODE }, \
+	{ "route", CTLTYPE_NODE }, \
+}
+
+struct kinfo_pcb {
+	__uint64_t	ki_pcbaddr;	/* PTR: pcb addr */
+	__uint64_t	ki_ppcbaddr;	/* PTR: ppcb addr */
+	__uint64_t	ki_sockaddr;	/* PTR: socket addr */
+
+	__uint32_t	ki_family;	/* INT: protocol family */
+	__uint32_t	ki_type;	/* INT: socket type */
+	__uint32_t	ki_protocol;	/* INT: protocol */
+	__uint32_t	ki_pflags;	/* INT: generic protocol flags */
+
+	__uint32_t	ki_sostate;	/* INT: socket state */
+	__uint32_t	ki_prstate;	/* INT: protocol state */
+	__int32_t	ki_tstate;	/* INT: tcp state */
+	__uint32_t	ki_tflags;	/* INT: tcp flags */
+
+	__uint64_t	ki_rcvq;	/* U_LONG: receive queue len */
+	__uint64_t	ki_sndq;	/* U_LONG: send queue len */
+
+	union {
+		struct sockaddr	_kis_src; /* STRUCT: local address */
+		char _kis_pad[256 + 8];		/* pad to max addr length */
+	} ki_s;
+	union {
+		struct sockaddr	_kid_dst; /* STRUCT: remote address */
+		char _kid_pad[256 + 8];		/* pad to max addr length */
+	} ki_d;
+
+	__uint64_t	ki_inode;	/* INO_T: fake inode number */
+	__uint64_t	ki_vnode;	/* PTR: if associated with file */
+	__uint64_t	ki_conn;	/* PTR: control block of peer */
+	__uint64_t	ki_refs;	/* PTR: referencing socket */
+	__uint64_t	ki_nextref;	/* PTR: link in refs list */
+};
+
+#define ki_src ki_s._kis_src
+#define ki_dst ki_d._kid_dst
+#define ki_spad ki_s._kis_pad
+#define ki_dpad ki_d._kid_pad
+
+#define PCB_SLOP		20
+#define PCB_ALL			0
+
+#endif /* _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * PF_ROUTE - Routing table
+ *
+ * Three additional levels are defined:
+ *	Fourth: address family, 0 is wildcard
+ *	Fifth: type of info, defined below
+ *	Sixth: flag(s) to mask with for NET_RT_FLAGS
+ */
+#define NET_RT_DUMP	1		/* dump; may limit to a.f. */
+#define NET_RT_FLAGS	2		/* by flags, e.g. RESOLVING */
+#define NET_RT_OOIFLIST	3		/* old NET_RT_IFLIST (pre 1.5) */
+#define NET_RT_OIFLIST	4		/* survey interface list */
+#define	NET_RT_IFLIST	5
+#define	NET_RT_MAXID	6
+
+#define CTL_NET_RT_NAMES { \
+	{ 0, 0 }, \
+	{ "dump", CTLTYPE_STRUCT }, \
+	{ "flags", CTLTYPE_STRUCT }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "iflist", CTLTYPE_STRUCT }, \
+}
+#endif /* _NETBSD_SOURCE */
+
+/*
+ * Maximum queue length specifiable by listen(2).
+ */
+#ifndef SOMAXCONN
+#define	SOMAXCONN	128
+#endif
+
+#include <sys/cdefs.h>
+
+/*
+ * Message header for recvmsg and sendmsg calls.
+ * Used value-result for recvmsg, value only for sendmsg.
+ */
+struct msghdr {
+	void		*msg_name;	/* optional address */
+	socklen_t	msg_namelen;	/* size of address */
+	struct iovec	*msg_iov;	/* scatter/gather array */
+	int		msg_iovlen;	/* # elements in msg_iov */
+	void		*msg_control;	/* ancillary data, see below */
+	socklen_t	msg_controllen;	/* ancillary data buffer len */
+	int		msg_flags;	/* flags on received message */
+};
+
+#define	MSG_OOB		0x0001		/* process out-of-band data */
+#define	MSG_PEEK	0x0002		/* peek at incoming message */
+#define	MSG_DONTROUTE	0x0004		/* send without using routing tables */
+#define	MSG_EOR		0x0008		/* data completes record */
+#define	MSG_TRUNC	0x0010		/* data discarded before delivery */
+#define	MSG_CTRUNC	0x0020		/* control data lost before delivery */
+#define	MSG_WAITALL	0x0040		/* wait for full request or error */
+#define	MSG_DONTWAIT	0x0080		/* this message should be nonblocking */
+#define	MSG_BCAST	0x0100		/* this message was rcvd using link-level brdcst */
+#define	MSG_MCAST	0x0200		/* this message was rcvd using link-level mcast */
+#define	MSG_NOSIGNAL	0x0400		/* do not generate SIGPIPE on EOF */
+#if defined(_NETBSD_SOURCE)
+#define	MSG_CMSG_CLOEXEC 0x0800		/* close on exec receiving fd */
+#define	MSG_NBIO	0x1000		/* use non-blocking I/O */
+#define	MSG_WAITFORONE	0x2000		/* recvmmsg() wait for one message */
+
+struct mmsghdr {
+	struct msghdr msg_hdr;
+	unsigned int msg_len;
+};
+#endif
+
+/* Extra flags used internally only */
+#define	MSG_USERFLAGS	0x0ffffff
+#define MSG_NAMEMBUF	0x1000000	/* msg_name is an mbuf */
+#define MSG_CONTROLMBUF	0x2000000	/* msg_control is an mbuf */
+#define MSG_IOVUSRSPACE	0x4000000	/* msg_iov is in user space */
+#define MSG_LENUSRSPACE	0x8000000	/* address length is in user space */
+
+/*
+ * Header for ancillary data objects in msg_control buffer.
+ * Used for additional information with/about a datagram
+ * not expressible by flags.  The format is a sequence
+ * of message elements headed by cmsghdr structures.
+ */
+struct cmsghdr {
+	socklen_t	cmsg_len;	/* data byte count, including hdr */
+	int		cmsg_level;	/* originating protocol */
+	int		cmsg_type;	/* protocol-specific type */
+/* followed by	u_char  cmsg_data[]; */
+};
+
+/*
+ * Alignment requirement for CMSG struct manipulation.
+ * This basically behaves the same as ALIGN() ARCH/include/param.h.
+ * We declare it separately for two reasons:
+ * (1) avoid dependency between machine/param.h, and (2) to sync with kernel's
+ * idea of ALIGNBYTES at runtime.
+ * without (2), we can't guarantee binary compatibility in case of future
+ * changes in ALIGNBYTES.
+ */
+#define __CMSG_ALIGN(n)	(((n) + __ALIGNBYTES) & ~__ALIGNBYTES)
+
+#ifdef _KERNEL
+#define CMSG_ALIGN(n)	__CMSG_ALIGN(n)
+#endif
+
+#define __CMSG_ASIZE	__CMSG_ALIGN(sizeof(struct cmsghdr))
+#define __CMSG_MSGNEXT(cmsg) \
+    (__CASTV(char *, cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len))
+#define __CMSG_MSGEND(mhdr) \
+    (__CASTV(char *, (mhdr)->msg_control) + (mhdr)->msg_controllen)
+
+/* given pointer to struct cmsghdr, return pointer to data */
+#define	CMSG_DATA(cmsg) (__CASTV(u_char *, cmsg) + __CMSG_ASIZE)
+#define	CCMSG_DATA(cmsg) (__CASTCV(const u_char *, cmsg) + __CMSG_ASIZE)
+
+/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
+#define	CMSG_NXTHDR(mhdr, cmsg)	\
+    __CASTV(struct cmsghdr *,  \
+	__CMSG_MSGNEXT(cmsg) + __CMSG_ASIZE > __CMSG_MSGEND(mhdr) ? 0 : \
+	__CMSG_MSGNEXT(cmsg))
+
+/*
+ * RFC 2292 requires to check msg_controllen, in case that the kernel returns
+ * an empty list for some reasons.
+ */
+#define	CMSG_FIRSTHDR(mhdr) \
+    __CASTV(struct cmsghdr *, \
+	(mhdr)->msg_controllen < sizeof(struct cmsghdr) ? 0 : \
+	(mhdr)->msg_control)
+
+#define CMSG_SPACE(l)	(__CMSG_ASIZE + __CMSG_ALIGN(l))
+#define CMSG_LEN(l)	(__CMSG_ASIZE + (l))
+
+/* "Socket"-level control message types: */
+#define	SCM_RIGHTS	0x01		/* access rights (array of int) */
+#if defined(_NETBSD_SOURCE)
+/* 			0x02		   timestamp (struct timeval50) */
+#define	SCM_CREDS	0x04		/* credentials (struct sockcred) */
+#define	SCM_TIMESTAMP	0x08		/* timestamp (struct timeval) */
+#endif
+
+/*
+ * Types of socket shutdown(2).
+ */
+#define	SHUT_RD		0		/* Disallow further receives. */
+#define	SHUT_WR		1		/* Disallow further sends. */
+#define	SHUT_RDWR	2		/* Disallow further sends/receives. */
+
+#ifdef	_KERNEL
+static inline socklen_t
+sockaddr_getlen(const struct sockaddr *sa)
+{
+	return sa->sa_len;
+}
+
+__BEGIN_DECLS
+struct sockaddr *sockaddr_copy(struct sockaddr *, socklen_t,
+    const struct sockaddr *);
+struct sockaddr *sockaddr_externalize(struct sockaddr *, socklen_t,
+    const struct sockaddr *);
+struct sockaddr *sockaddr_alloc(sa_family_t, socklen_t, int);
+const void *sockaddr_const_addr(const struct sockaddr *, socklen_t *);
+void *sockaddr_addr(struct sockaddr *, socklen_t *);
+const struct sockaddr *sockaddr_any(const struct sockaddr *);
+const struct sockaddr *sockaddr_any_by_family(int);
+const void *sockaddr_anyaddr(const struct sockaddr *, socklen_t *);
+int sockaddr_cmp(const struct sockaddr *, const struct sockaddr *);
+struct sockaddr *sockaddr_dup(const struct sockaddr *, int);
+int sockaddr_format(const struct sockaddr *, char *, size_t);
+void sockaddr_free(struct sockaddr *);
+__END_DECLS
+#endif /* _KERNEL */
+
+#ifndef	_KERNEL
+
+__BEGIN_DECLS
+int	accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
+int	bind(int, const struct sockaddr *, socklen_t);
+int	connect(int, const struct sockaddr *, socklen_t);
+int	getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);
+int	getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict);
+int	getsockopt(int, int, int, void *__restrict, socklen_t * __restrict);
+int	listen(int, int);
+int	paccept(int, struct sockaddr * __restrict, socklen_t * __restrict,
+	const sigset_t * __restrict, int);
+ssize_t	recv(int, void *, size_t, int);
+ssize_t	recvfrom(int, void *__restrict, size_t, int,
+	    struct sockaddr * __restrict, socklen_t * __restrict);
+ssize_t	recvmsg(int, struct msghdr *, int);
+ssize_t	send(int, const void *, size_t, int);
+ssize_t	sendto(int, const void *,
+	    size_t, int, const struct sockaddr *, socklen_t);
+ssize_t	sendmsg(int, const struct msghdr *, int);
+int	setsockopt(int, int, int, const void *, socklen_t);
+int	shutdown(int, int);
+int	sockatmark(int);
+int	socket(int, int, int)
+#if !defined(__LIBC12_SOURCE__) && !defined(_STANDALONE)
+__RENAME(__socket30)
+#endif
+			     ;
+int	socketpair(int, int, int, int *);
+
+#if defined(_NETBSD_SOURCE)
+int	sendmmsg(int, struct mmsghdr *, unsigned int, unsigned int);
+struct timespec;
+int	recvmmsg(int, struct mmsghdr *, unsigned int, unsigned int,
+    struct timespec *);
+#endif
+__END_DECLS
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_SOCKET_H_ */

Property changes on: lab4/.minix-src/include/sys/socket.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/timeb.h
===================================================================
--- lab4/.minix-src/include/sys/timeb.h	(nonexistent)
+++ lab4/.minix-src/include/sys/timeb.h	(revision 13)
@@ -0,0 +1,59 @@
+/*	$NetBSD: timeb.h,v 1.14 2005/12/11 12:25:21 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)timeb.h	8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_TIMEB_H_
+#define _SYS_TIMEB_H_
+
+/* The ftime(2) system call structure -- deprecated. */
+struct timeb {
+	time_t	time;			/* seconds since the Epoch */
+	unsigned short millitm;		/* + milliseconds since the Epoch */
+	short	timezone;		/* minutes west of CUT */
+	short	dstflag;		/* DST == non-zero */
+};
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int ftime(struct timeb *);
+__END_DECLS
+#endif /* _KERNEL */
+
+
+#endif /* !_SYS_TIMEB_H_ */

Property changes on: lab4/.minix-src/include/sys/timeb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/timex.h
===================================================================
--- lab4/.minix-src/include/sys/timex.h	(nonexistent)
+++ lab4/.minix-src/include/sys/timex.h	(revision 13)
@@ -0,0 +1,259 @@
+/*	$NetBSD: timex.h,v 1.18 2009/04/05 19:59:26 christos Exp $	*/
+
+/*-
+ ***********************************************************************
+ *								       *
+ * Copyright (c) David L. Mills 1993-2001			       *
+ *								       *
+ * Permission to use, copy, modify, and distribute this software and   *
+ * its documentation for any purpose and without fee is hereby	       *
+ * granted, provided that the above copyright notice appears in all    *
+ * copies and that both the copyright notice and this permission       *
+ * notice appear in supporting documentation, and that the name        *
+ * University of Delaware not be used in advertising or publicity      *
+ * pertaining to distribution of the software without specific,	       *
+ * written prior permission. The University of Delaware makes no       *
+ * representations about the suitability this software for any	       *
+ * purpose. It is provided "as is" without express or implied	       *
+ * warranty.							       *
+ *								       *
+ **********************************************************************/
+
+/*
+ * Modification history timex.h
+ *
+ * 16 Aug 00	David L. Mills
+ *	API Version 4. Added MOD_TAI and tai member of ntptimeval
+ *	structure.
+ *
+ * 17 Nov 98	David L. Mills
+ *	Revised for nanosecond kernel and user interface.
+ *
+ * 26 Sep 94	David L. Mills
+ *	Added defines for hybrid phase/frequency-lock loop.
+ *
+ * 19 Mar 94	David L. Mills
+ *	Moved defines from kernel routines to header file and added new
+ *	defines for PPS phase-lock loop.
+ *
+ * 20 Feb 94	David L. Mills
+ *	Revised status codes and structures for external clock and PPS
+ *	signal discipline.
+ *
+ * 28 Nov 93	David L. Mills
+ *	Adjusted parameters to improve stability and increase poll
+ *	interval.
+ *
+ * 17 Sep 93    David L. Mills
+ *      Created file
+ *
+ * $FreeBSD: src/sys/sys/timex.h,v 1.18 2005/01/07 02:29:24 imp Exp $
+ */
+/*
+ * This header file defines the Network Time Protocol (NTP) interfaces
+ * for user and daemon application programs. These are implemented using
+ * defined syscalls and data structures and require specific kernel
+ * support.
+ *
+ * The original precision time kernels developed from 1993 have an
+ * ultimate resolution of one microsecond; however, the most recent
+ * kernels have an ultimate resolution of one nanosecond. In these
+ * kernels, a ntp_adjtime() syscalls can be used to determine which
+ * resolution is in use and to select either one at any time. The
+ * resolution selected affects the scaling of certain fields in the
+ * ntp_gettime() and ntp_adjtime() syscalls, as described below.
+ *
+ * NAME
+ *	ntp_gettime - NTP user application interface
+ *
+ * SYNOPSIS
+ *	#include <sys/timex.h>
+ *
+ *	int ntp_gettime(struct ntptimeval *ntv);
+ *
+ * DESCRIPTION
+ *	The time returned by ntp_gettime() is in a timespec structure,
+ *	but may be in either microsecond (seconds and microseconds) or
+ *	nanosecond (seconds and nanoseconds) format. The particular
+ *	format in use is determined by the STA_NANO bit of the status
+ *	word returned by the ntp_adjtime() syscall.
+ *
+ * NAME
+ *	ntp_adjtime - NTP daemon application interface
+ *
+ * SYNOPSIS
+ *	#include <sys/timex.h>
+ *	#include <sys/syscall.h>
+ *
+ *	int syscall(SYS_ntp_adjtime, tptr);
+ *	int SYS_ntp_adjtime;
+ *	struct timex *tptr;
+ *
+ * DESCRIPTION
+ *	Certain fields of the timex structure are interpreted in either
+ *	microseconds or nanoseconds according to the state of the
+ *	STA_NANO bit in the status word. See the description below for
+ *	further information.
+ */
+
+#ifndef _SYS_TIMEX_H_
+#define _SYS_TIMEX_H_ 1
+#define NTP_API		4	/* NTP API version */
+
+#include <sys/syscall.h>
+
+/*
+ * The following defines establish the performance envelope of the
+ * kernel discipline loop. Phase or frequency errors greater than
+ * NAXPHASE or MAXFREQ are clamped to these maxima. For update intervals
+ * less than MINSEC, the loop always operates in PLL mode; while, for
+ * update intervals greater than MAXSEC, the loop always operates in FLL
+ * mode. Between these two limits the operating mode is selected by the
+ * STA_FLL bit in the status word.
+ */
+#define MAXPHASE	500000000L /* max phase error (ns) */
+#define MAXFREQ		500000L	/* max freq error (ns/s) */
+#define MINSEC		256	/* min FLL update interval (s) */
+#define MAXSEC		2048	/* max PLL update interval (s) */
+#define NANOSECOND	1000000000L /* nanoseconds in one second */
+#define SCALE_PPM	(65536 / 1000) /* crude ns/s to scaled PPM */
+#define MAXTC		10	/* max time constant */
+
+/*
+ * The following defines and structures define the user interface for
+ * the ntp_gettime() and ntp_adjtime() syscalls.
+ *
+ * Control mode codes (timex.modes)
+ */
+#define MOD_OFFSET	0x0001	/* set time offset */
+#define MOD_FREQUENCY	0x0002	/* set frequency offset */
+#define MOD_MAXERROR	0x0004	/* set maximum time error */
+#define MOD_ESTERROR	0x0008	/* set estimated time error */
+#define MOD_STATUS	0x0010	/* set clock status bits */
+#define MOD_TIMECONST	0x0020	/* set PLL time constant */
+#define MOD_PPSMAX	0x0040	/* set PPS maximum averaging time */
+#define MOD_TAI		0x0080	/* set TAI offset */
+#define	MOD_MICRO	0x1000	/* select microsecond resolution */
+#define	MOD_NANO	0x2000	/* select nanosecond resolution */
+#define MOD_CLKB	0x4000	/* select clock B */
+#define MOD_CLKA	0x8000	/* select clock A */
+
+/*
+ * Status codes (timex.status)
+ */
+#define STA_PLL		0x0001	/* enable PLL updates (rw) */
+#define STA_PPSFREQ	0x0002	/* enable PPS freq discipline (rw) */
+#define STA_PPSTIME	0x0004	/* enable PPS time discipline (rw) */
+#define STA_FLL		0x0008	/* enable FLL mode (rw) */
+#define STA_INS		0x0010	/* insert leap (rw) */
+#define STA_DEL		0x0020	/* delete leap (rw) */
+#define STA_UNSYNC	0x0040	/* clock unsynchronized (rw) */
+#define STA_FREQHOLD	0x0080	/* hold frequency (rw) */
+#define STA_PPSSIGNAL	0x0100	/* PPS signal present (ro) */
+#define STA_PPSJITTER	0x0200	/* PPS signal jitter exceeded (ro) */
+#define STA_PPSWANDER	0x0400	/* PPS signal wander exceeded (ro) */
+#define STA_PPSERROR	0x0800	/* PPS signal calibration error (ro) */
+#define STA_CLOCKERR	0x1000	/* clock hardware fault (ro) */
+#define STA_NANO	0x2000	/* resolution (0 = us, 1 = ns) (ro) */
+#define STA_MODE	0x4000	/* mode (0 = PLL, 1 = FLL) (ro) */
+#define STA_CLK		0x8000	/* clock source (0 = A, 1 = B) (ro) */
+
+#define STA_FMT	"\177\020\
+b\0PLL\0\
+b\1PPSFREQ\0\
+b\2PPSTIME\0\
+b\3FLL\0\
+b\4INS\0\
+b\5DEL\0\
+b\6UNSYNC\0\
+b\7FREQHOLD\0\
+b\10PPSSIGNAL\0\
+b\11PPSJITTER\0\
+b\12PPSWANDER\0\
+b\13PPSERROR\0\
+b\14CLOCKERR\0\
+b\15NANO\0\
+f\16\1MODE\0=\0PLL\0=\1FLL\0\
+f\17\1CLK\0=\0A\0=\1B\0"
+
+#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
+    STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
+
+/*
+ * Clock states (time_state)
+ */
+#define TIME_OK		0	/* no leap second warning */
+#define TIME_INS	1	/* insert leap second warning */
+#define TIME_DEL	2	/* delete leap second warning */
+#define TIME_OOP	3	/* leap second in progress */
+#define TIME_WAIT	4	/* leap second has occured */
+#define TIME_ERROR	5	/* error (see status word) */
+
+/*
+ * NTP user interface (ntp_gettime()) - used to read kernel clock values
+ *
+ * Note: The time member is in microseconds if STA_NANO is zero and
+ * nanoseconds if not.
+ */
+struct ntptimeval {
+	struct timespec time;	/* current time (ns) (ro) */
+	long maxerror;		/* maximum error (us) (ro) */
+	long esterror;		/* estimated error (us) (ro) */
+	long tai;		/* TAI offset */
+	int time_state;		/* time status */
+};
+
+/*
+ * NTP daemon interface (ntp_adjtime()) - used to discipline CPU clock
+ * oscillator and determine status.
+ *
+ * Note: The offset, precision and jitter members are in microseconds if
+ * STA_NANO is zero and nanoseconds if not.
+ */
+struct timex {
+	unsigned int modes;	/* clock mode bits (wo) */
+	long	offset;		/* time offset (ns/us) (rw) */
+	long	freq;		/* frequency offset (scaled PPM) (rw) */
+	long	maxerror;	/* maximum error (us) (rw) */
+	long	esterror;	/* estimated error (us) (rw) */
+	int	status;		/* clock status bits (rw) */
+	long	constant;	/* poll interval (log2 s) (rw) */
+	long	precision;	/* clock precision (ns/us) (ro) */
+	long	tolerance;	/* clock frequency tolerance (scaled
+				 * PPM) (ro) */
+	/*
+	 * The following read-only structure members are implemented
+	 * only if the PPS signal discipline is configured in the
+	 * kernel. They are included in all configurations to insure
+	 * portability.
+	 */
+	long	ppsfreq;	/* PPS frequency (scaled PPM) (ro) */
+	long	jitter;		/* PPS jitter (ns/us) (ro) */
+	int	shift;		/* interval duration (s) (shift) (ro) */
+	long	stabil;		/* PPS stability (scaled PPM) (ro) */
+	long	jitcnt;		/* jitter limit exceeded (ro) */
+	long	calcnt;		/* calibration intervals (ro) */
+	long	errcnt;		/* calibration errors (ro) */
+	long	stbcnt;		/* stability limit exceeded (ro) */
+};
+
+#ifdef _KERNEL
+#include <sys/mutex.h>
+
+void	ntp_update_second(int64_t *adjustment, time_t *newsec);
+void	ntp_adjtime1(struct timex *);
+void	ntp_gettime(struct ntptimeval *);
+int ntp_timestatus(void);
+
+extern kmutex_t timecounter_lock;
+#else /* !_KERNEL */
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+int ntp_gettime(struct ntptimeval *) __RENAME(__ntp_gettime50);
+#endif
+int ntp_adjtime(struct timex *);
+__END_DECLS
+#endif /* _KERNEL */
+
+#endif /* _SYS_TIMEX_H_ */

Property changes on: lab4/.minix-src/include/sys/timex.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/tty.h
===================================================================
--- lab4/.minix-src/include/sys/tty.h	(nonexistent)
+++ lab4/.minix-src/include/sys/tty.h	(revision 13)
@@ -0,0 +1,320 @@
+/*	$NetBSD: tty.h,v 1.93 2014/11/15 19:17:05 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tty.h	8.7 (Berkeley) 1/9/95
+ */
+
+#ifndef _SYS_TTY_H_
+#define _SYS_TTY_H_
+
+#include <sys/termios.h>
+#include <sys/select.h>
+#include <sys/selinfo.h>	/* For struct selinfo. */
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+#include <sys/queue.h>
+#include <sys/callout.h>
+
+/*
+ * Clists are actually ring buffers. The c_cc, c_cf, c_cl fields have
+ * exactly the same behaviour as in true clists.
+ * if c_cq is NULL, the ring buffer has no TTY_QUOTE functionality
+ * (but, saves memory and CPU time)
+ *
+ * *DON'T* play with c_cs, c_ce, c_cq, or c_cl outside tty_subr.c!!!
+ */
+struct clist {
+	u_char	*c_cf;		/* points to first character */
+	u_char	*c_cl;		/* points to next open character */
+	u_char	*c_cs;		/* start of ring buffer */
+	u_char	*c_ce;		/* c_ce + c_len */
+	u_char	*c_cq;		/* N bits/bytes long, see tty_subr.c */
+	int	c_cc;		/* count of characters in queue */
+	int	c_cn;		/* total ring buffer length */
+};
+
+/* tty signal types */
+enum ttysigtype {
+	TTYSIG_PG1,
+	TTYSIG_PG2,
+	TTYSIG_LEADER,
+	TTYSIG_COUNT
+};
+
+/*
+ * Per-tty structure.
+ *
+ * Should be split in two, into device and tty drivers.
+ * Glue could be masks of what to echo and circular buffer
+ * (low, high, timeout).
+ */
+struct tty {
+	TAILQ_ENTRY(tty) tty_link;	/* Link in global tty list. */
+	struct	clist t_rawq;		/* Device raw input queue. */
+	long	t_rawcc;		/* Raw input queue statistics. */
+	kcondvar_t t_rawcv;		/* notifier */
+	kcondvar_t t_rawcvf;		/* notifier */
+	struct	clist t_canq;		/* Device canonical queue. */
+	long	t_cancc;		/* Canonical queue statistics. */
+	kcondvar_t t_cancv;		/* notifier */
+	kcondvar_t t_cancvf;		/* notifier */
+	struct	clist t_outq;		/* Device output queue. */
+	long	t_outcc;		/* Output queue statistics. */
+	kcondvar_t t_outcv;		/* notifier */
+	kcondvar_t t_outcvf;		/* notifier */
+	callout_t t_rstrt_ch;		/* for delayed output start */
+	struct	linesw *t_linesw;	/* Interface to device drivers. */
+	dev_t	t_dev;			/* Device. */
+	int	t_state;		/* Device and driver (TS*) state. */
+	int	t_wopen;		/* Processes waiting for open. */
+	int	t_flags;		/* Tty flags. */
+	int	t_qsize;		/* Tty character queue size */
+	struct	pgrp *t_pgrp;		/* Foreground process group. */
+	struct	session *t_session;	/* Enclosing session. */
+	struct	selinfo t_rsel;		/* Tty read/oob select. */
+	struct	selinfo t_wsel;		/* Tty write select. */
+	struct	termios t_termios;	/* Termios state. */
+	struct	winsize t_winsize;	/* Window size. */
+					/* Start output. */
+	void	(*t_oproc)(struct tty *);
+					/* Set hardware state. */
+	int	(*t_param)(struct tty *, struct termios *);
+					/* Set hardware flow control. */
+	int	(*t_hwiflow)(struct tty *, int);
+	void	*t_sc;			/* XXX: net/if_sl.c:sl_softc. */
+	short	t_column;		/* Tty output column. */
+	short	t_rocount, t_rocol;	/* Tty. */
+	int	t_hiwat;		/* High water mark. */
+	int	t_lowat;		/* Low water mark. */
+	short	t_gen;			/* Generation number. */
+	sigset_t t_sigs[TTYSIG_COUNT];	/* Pending signals */
+	int	t_sigcount;		/* # pending signals */
+	TAILQ_ENTRY(tty) t_sigqueue;	/* entry on pending signal list */
+	void	*t_softc;		/* pointer to driver's softc. */
+};
+
+#ifdef TTY_ALLOW_PRIVATE
+#define	t_cc		t_termios.c_cc
+#endif
+#define	t_cflag		t_termios.c_cflag
+#define	t_iflag		t_termios.c_iflag
+#define	t_ispeed	t_termios.c_ispeed
+#define	t_lflag		t_termios.c_lflag
+#define	t_oflag		t_termios.c_oflag
+#define	t_ospeed	t_termios.c_ospeed
+
+#define	TTIPRI	25			/* Sleep priority for tty reads. */
+#define	TTOPRI	26			/* Sleep priority for tty writes. */
+
+#define	TTMASK	15
+#define	OBUFSIZ	100
+#define	TTYHOG	tp->t_qsize
+
+#ifdef _KERNEL
+#define	TTMAXHIWAT	roundup(tp->t_qsize << 1, 64)
+#define	TTMINHIWAT	roundup(tp->t_qsize >> 3, 64)
+#define	TTMAXLOWAT	(tp->t_qsize >> 2)
+#define	TTMINLOWAT	(tp->t_qsize >> 5)
+#define	TTROUND		64
+#define	TTDIALOUT_MASK	0x80000		/* dialout=524288 in MAKEDEV.tmpl */
+#define	TTCALLUNIT_MASK	0x40000		/* XXX: compat */
+#define	TTUNIT_MASK	0x3ffff
+#define	TTDIALOUT(d)	(minor(d) & TTDIALOUT_MASK)
+#define	TTCALLUNIT(d)	(minor(d) & TTCALLUNIT_MASK)
+#define	TTUNIT(d)	(minor(d) & TTUNIT_MASK)
+#endif /* _KERNEL */
+
+/* These flags are kept in t_state. */
+#define	TS_SIGINFO	0x00001		/* Ignore mask on dispatch SIGINFO */
+#define	TS_ASYNC	0x00002		/* Tty in async I/O mode. */
+#define	TS_BUSY		0x00004		/* Draining output. */
+#define	TS_CARR_ON	0x00008		/* Carrier is present. */
+#define	TS_DIALOUT	0x00010		/* Tty used for dialout. */
+#define	TS_FLUSH	0x00020		/* Outq has been flushed during DMA. */
+#define	TS_ISOPEN	0x00040		/* Open has completed. */
+#define	TS_TBLOCK	0x00080		/* Further input blocked. */
+#define	TS_TIMEOUT	0x00100		/* Wait for output char processing. */
+#define	TS_TTSTOP	0x00200		/* Output paused. */
+#define	TS_XCLUDE	0x00400		/* Tty requires exclusivity. */
+
+/* State for intra-line fancy editing work. */
+#define	TS_BKSL		0x00800		/* State for lowercase \ work. */
+#define	TS_CNTTB	0x01000		/* Counting tab width, ignore FLUSHO. */
+#define	TS_ERASE	0x02000		/* Within a \.../ for PRTRUB. */
+#define	TS_LNCH		0x04000		/* Next character is literal. */
+#define	TS_TYPEN	0x08000		/* Retyping suspended input (PENDIN). */
+#define	TS_LOCAL	(TS_BKSL | TS_CNTTB | TS_ERASE | TS_LNCH | TS_TYPEN)
+
+/* Character type information. */
+#define	ORDINARY	0
+#define	CONTROL		1
+#define	BACKSPACE	2
+#define	NEWLINE		3
+#define	TAB		4
+#define	VTAB		5
+#define	RETURN		6
+
+struct speedtab {
+	int sp_speed;			/* Speed. */
+	int sp_code;			/* Code. */
+};
+
+/* Modem control commands (driver). */
+#define	DMSET		0
+#define	DMBIS		1
+#define	DMBIC		2
+#define	DMGET		3
+
+/* Flags on a character passed to ttyinput. */
+#define	TTY_CHARMASK	0x000000ff	/* Character mask */
+#define	TTY_QUOTE	0x00000100	/* Character quoted */
+#define	TTY_ERRORMASK	0xff000000	/* Error mask */
+#define	TTY_FE		0x01000000	/* Framing error or BREAK condition */
+#define	TTY_PE		0x02000000	/* Parity error */
+
+/* Is tp controlling terminal for p? */
+#define	isctty(p, tp)							\
+	((p)->p_session == (tp)->t_session && (p)->p_lflag & PL_CONTROLT)
+
+/* Is p in background of tp? */
+#define	isbackground(p, tp)						\
+	(isctty((p), (tp)) && (p)->p_pgrp != (tp)->t_pgrp)
+
+/*
+ * ttylist_head is defined here so that user-land has access to it.
+ */
+TAILQ_HEAD(ttylist_head, tty);		/* the ttylist is a TAILQ */
+
+#ifdef _KERNEL
+
+extern kmutex_t	tty_lock;
+
+extern	int tty_count;			/* number of ttys in global ttylist */
+extern	struct ttychars ttydefaults;
+
+/* Symbolic sleep message strings. */
+extern	 const char ttclos[];
+
+int	 b_to_q(const u_char *, int, struct clist *);
+void	 catq(struct clist *, struct clist *);
+void	 clist_init(void);
+int	 getc(struct clist *);
+void	 ndflush(struct clist *, int);
+int	 ndqb(struct clist *, int);
+u_char	*nextc(struct clist *, u_char *, int *);
+int	 putc(int, struct clist *);
+int	 q_to_b(struct clist *, u_char *, int);
+int	 unputc(struct clist *);
+
+int	 nullmodem(struct tty *, int);
+int	 tputchar(int, int, struct tty *);
+int	 ttioctl(struct tty *, u_long, void *, int, struct lwp *);
+int	 ttread(struct tty *, struct uio *, int);
+void	 ttrstrt(void *);
+int	 ttpoll(struct tty *, int, struct lwp *);
+void	 ttsetwater(struct tty *);
+int	 ttspeedtab(int, const struct speedtab *);
+int	 ttstart(struct tty *);
+void	 ttwakeup(struct tty *);
+int	 ttwrite(struct tty *, struct uio *, int);
+void	 ttychars(struct tty *);
+int	 ttycheckoutq(struct tty *, int);
+int	 ttyclose(struct tty *);
+void	 ttyflush(struct tty *, int);
+void	 ttygetinfo(struct tty *, int, char *, size_t);
+void	 ttyputinfo(struct tty *, char *);
+int	 ttyinput(int, struct tty *);
+int	 ttyinput_wlock(int, struct tty *); /* XXX see wsdisplay.c */
+int	 ttylclose(struct tty *, int);
+int	 ttylopen(dev_t, struct tty *);
+int	 ttykqfilter(dev_t, struct knote *);
+int	 ttymodem(struct tty *, int);
+int	 ttyopen(struct tty *, int, int);
+int	 ttyoutput(int, struct tty *);
+void	 ttypend(struct tty *);
+void	 ttyretype(struct tty *);
+void	 ttyrub(int, struct tty *);
+int	 ttysleep(struct tty *, kcondvar_t *, bool, int);
+int	 ttypause(struct tty *, int);
+int	 ttywait(struct tty *);
+int	 ttywflush(struct tty *);
+void	 ttysig(struct tty *, enum ttysigtype, int);
+void	 tty_attach(struct tty *);
+void	 tty_detach(struct tty *);
+void	 tty_init(void);
+struct tty
+	*tty_alloc(void);
+void	 tty_free(struct tty *);
+u_char	*firstc(struct clist *, int *);
+bool	 ttypull(struct tty *);
+
+int	clalloc(struct clist *, int, int);
+void	clfree(struct clist *);
+
+extern int (*ttcompatvec)(struct tty *, u_long, void *, int, struct lwp *);
+
+unsigned char tty_getctrlchar(struct tty *, unsigned /*which*/);
+void tty_setctrlchar(struct tty *, unsigned /*which*/, unsigned char /*val*/);
+int tty_try_xonxoff(struct tty *, unsigned char /*c*/);
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_TTY_H_ */

Property changes on: lab4/.minix-src/include/sys/tty.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ttydev.h
===================================================================
--- lab4/.minix-src/include/sys/ttydev.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ttydev.h	(revision 13)
@@ -0,0 +1,60 @@
+/*	$NetBSD: ttydev.h,v 1.10 2014/05/21 04:24:40 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ttydev.h	8.2 (Berkeley) 1/4/94
+ */
+
+/* COMPATIBILITY HEADER FILE */
+
+#ifndef _SYS_TTYDEV_H_
+#define	_SYS_TTYDEV_H_
+
+#ifdef USE_OLD_TTY
+#define B0	0
+#define B50	1
+#define B75	2
+#define B110	3
+#define B134	4
+#define B150	5
+#define B200	6
+#define B300	7
+#define B600	8
+#define B1200	9
+#define	B1800	10
+#define B2400	11
+#define B4800	12
+#define B9600	13
+#define EXTA	14
+#define EXTB	15
+#define	B57600	16
+#define	B115200	17
+#endif /* USE_OLD_TTY */
+
+#endif /* !_SYS_TTYDEV_H_ */

Property changes on: lab4/.minix-src/include/sys/ttydev.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ttydefaults.h
===================================================================
--- lab4/.minix-src/include/sys/ttydefaults.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ttydefaults.h	(revision 13)
@@ -0,0 +1,123 @@
+/*	$NetBSD: ttydefaults.h,v 1.16 2008/05/24 14:06:39 yamt Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ttydefaults.h	8.4 (Berkeley) 1/21/94
+ */
+
+/*
+ * System wide defaults for terminal state.
+ */
+#ifndef _SYS_TTYDEFAULTS_H_
+#define	_SYS_TTYDEFAULTS_H_
+
+/*
+ * Defaults on "first" open.
+ */
+#define	TTYDEF_IFLAG	(BRKINT | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG	(OPOST | ONLCR | OXTABS)
+#define TTYDEF_LFLAG	(ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG	(CREAD | CS8 | HUPCL)
+#if defined(__minix)
+#define TTYDEF_SPEED	(B115200)
+#else
+#define TTYDEF_SPEED	(B9600)
+#endif /* defined(__minix) */
+
+/*
+ * Control Character Defaults
+ */
+#define CTRL(x)	(x&037)
+#define	CEOF		CTRL('d')
+#define	CEOL		((unsigned char)'\377')	/* XXX avoid _POSIX_VDISABLE */
+#if defined(__minix)
+#define	CERASE		CTRL('h')
+#else
+#define	CERASE		0177
+#endif /* defined(__minix) */
+#define	CINTR		CTRL('c')
+#define	CSTATUS		CTRL('t')
+#define	CKILL		CTRL('u')
+#define	CMIN		1
+#define	CQUIT		034		/* FS, ^\ */
+#define	CSUSP		CTRL('z')
+#define	CTIME		0
+#define	CDSUSP		CTRL('y')
+#define	CSTART		CTRL('q')
+#define	CSTOP		CTRL('s')
+#define	CLNEXT		CTRL('v')
+#define	CDISCARD 	CTRL('o')
+#define	CWERASE 	CTRL('w')
+#define	CREPRINT 	CTRL('r')
+#define	CEOT		CEOF
+/* compat */
+#define	CBRK		CEOL
+#define CRPRNT		CREPRINT
+#define	CFLUSH		CDISCARD
+
+/* PROTECTED INCLUSION ENDS HERE */
+#endif /* !_SYS_TTYDEFAULTS_H_ */
+
+/*
+ * #define TTYDEFCHARS to include an array of default control characters.
+ */
+#ifdef _KERNEL
+#ifdef TTYDEFCHARS
+const cc_t ttydefchars[NCCS] = {
+	[VEOF] = CEOF,
+	[VEOL] = CEOL,
+	[VEOL2] = CEOL,
+	[VERASE] = CERASE,
+	[VWERASE] = CWERASE,
+	[VKILL] = CKILL,
+	[VREPRINT] = CREPRINT,
+	[7] = _POSIX_VDISABLE,	/* spare */
+	[VINTR] = CINTR,
+	[VQUIT] = CQUIT,
+	[VSUSP] = CSUSP,
+	[VDSUSP] = CDSUSP,
+	[VSTART] = CSTART,
+	[VSTOP] = CSTOP,
+	[VLNEXT] = CLNEXT,
+	[VDISCARD] = CDISCARD,
+	[VMIN] = CMIN,
+	[VTIME] = CTIME,
+	[VSTATUS] = CSTATUS,
+	[19] = _POSIX_VDISABLE,	/* spare */
+};
+#undef TTYDEFCHARS
+#else
+extern const cc_t ttydefchars[NCCS];
+#endif
+#endif /* _KERNEL */

Property changes on: lab4/.minix-src/include/sys/ttydefaults.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ucred.h
===================================================================
--- lab4/.minix-src/include/sys/ucred.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ucred.h	(revision 13)
@@ -0,0 +1,56 @@
+/*	$NetBSD: ucred.h,v 1.36 2011/10/12 23:03:36 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ucred.h	8.4 (Berkeley) 1/9/95
+ */
+
+#ifndef _SYS_UCRED_H_
+#define	_SYS_UCRED_H_
+
+#ifdef _KERNEL
+#include <sys/syslimits.h>
+#else
+#include <limits.h>
+#endif
+
+/*
+ * Credentials.
+ */
+
+/* Userland's view of credentials. This should not change */
+struct uucred {
+	unsigned short	cr_unused;		/* not used, compat */
+	uid_t		cr_uid;			/* effective user id */
+	gid_t		cr_gid;			/* effective group id */
+	short		cr_ngroups;		/* number of groups */
+	gid_t		cr_groups[NGROUPS_MAX];	/* groups */
+};
+
+#endif /* !_SYS_UCRED_H_ */

Property changes on: lab4/.minix-src/include/sys/ucred.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/unpcb.h
===================================================================
--- lab4/.minix-src/include/sys/unpcb.h	(nonexistent)
+++ lab4/.minix-src/include/sys/unpcb.h	(revision 13)
@@ -0,0 +1,108 @@
+/*	$NetBSD: unpcb.h,v 1.17 2008/04/24 11:38:39 ad Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)unpcb.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_UNPCB_H_
+#define _SYS_UNPCB_H_
+
+#include <sys/un.h>
+#include <sys/mutex.h>
+
+/*
+ * Protocol control block for an active
+ * instance of a UNIX internal protocol.
+ *
+ * A socket may be associated with an vnode in the
+ * file system.  If so, the unp_vnode pointer holds
+ * a reference count to this vnode, which should be irele'd
+ * when the socket goes away.
+ *
+ * A socket may be connected to another socket, in which
+ * case the control block of the socket to which it is connected
+ * is given by unp_conn.
+ *
+ * A socket may be referenced by a number of sockets (e.g. several
+ * sockets may be connected to a datagram socket.)  These sockets
+ * are in a linked list starting with unp_refs, linked through
+ * unp_nextref and null-terminated.  Note that a socket may be referenced
+ * by a number of other sockets and may also reference a socket (not
+ * necessarily one which is referencing it).  This generates
+ * the need for unp_refs and unp_nextref to be separate fields.
+ *
+ * Stream sockets keep copies of receive sockbuf sb_cc and sb_mbcnt
+ * so that changes in the sockbuf may be computed to modify
+ * back pressure on the sender accordingly.
+ *
+ * The unp_ctime holds the creation time of the socket: it might be part of
+ * a socketpair created by pipe(2), and POSIX requires pipe(2) to initialize
+ * a stat structure's st_[acm]time members with the pipe's creation time.
+ * N.B.: updating st_[am]time when reading/writing the pipe is not required,
+ *       so we just use a single timespec and do not implement that.
+ */
+struct	unpcb {
+	struct	socket *unp_socket;	/* pointer back to socket */
+	struct	vnode *unp_vnode;	/* if associated with file */
+	ino_t	unp_ino;		/* fake inode number */
+	struct	unpcb *unp_conn;	/* control block of connected socket */
+	struct	unpcb *unp_refs;	/* referencing socket linked list */
+	struct 	unpcb *unp_nextref;	/* link in unp_refs list */
+	struct	sockaddr_un *unp_addr;	/* bound address of socket */
+	kmutex_t *unp_streamlock;	/* lock for est. stream connections */
+	size_t	unp_addrlen;		/* size of socket address */
+	int	unp_cc;			/* copy of rcv.sb_cc */
+	int	unp_mbcnt;		/* copy of rcv.sb_mbcnt */
+	struct	timespec unp_ctime;	/* holds creation time */
+	int	unp_flags;		/* misc flags; see below*/
+	struct	unpcbid unp_connid; 	/* pid and eids of peer */
+};
+
+/*
+ * Flags in unp_flags.
+ *
+ * UNP_EIDSVALID - indicates that the unp_connid member is filled in
+ * and is really the effective ids of the connected peer.  This is used
+ * to determine whether the contents should be sent to the user or
+ * not.
+ *
+ * UNP_EIDSBIND - indicates that the unp_connid member is filled
+ * in with data for the listening process.  This is set up in unp_bind() when
+ * it fills in unp_connid for later consumption by unp_connect().
+ */
+#define	UNP_WANTCRED	0x0001		/* credentials wanted */
+#define	UNP_CONNWAIT	0x0002		/* connect blocks until accepted */
+#define	UNP_EIDSVALID	0x0004		/* unp_connid contains valid data */
+#define	UNP_EIDSBIND	0x0008		/* unp_connid was set by bind() */
+#define	UNP_BUSY	0x0010		/* busy connecting or binding */
+
+#define	sotounpcb(so)	((struct unpcb *)((so)->so_pcb))
+
+#endif /* !_SYS_UNPCB_H_ */

Property changes on: lab4/.minix-src/include/sys/unpcb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/vadvise.h
===================================================================
--- lab4/.minix-src/include/sys/vadvise.h	(nonexistent)
+++ lab4/.minix-src/include/sys/vadvise.h	(revision 13)
@@ -0,0 +1,58 @@
+/*	$NetBSD: vadvise.h,v 1.10 2005/12/11 12:25:21 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vadvise.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_VADVISE_H_
+#define _SYS_VADVISE_H_
+
+/*
+ * Parameters to vadvise() to tell system of particular paging
+ * behaviour:
+ *	VA_NORM		Normal strategy
+ *	VA_ANOM		Sampling page behaviour is not a win, don't bother
+ *			Suitable during GCs in LISP, or sequential or random
+ *			page referencing.
+ *	VA_SEQL		Sequential behaviour expected.
+ *	VA_FLUSH	Invalidate all page table entries.
+ */
+#define	VA_NORM		0
+#define	VA_ANOM		1
+#define	VA_SEQL		2
+#define	VA_FLUSH 	3
+
+#ifndef _KERNEL
+__BEGIN_DECLS
+int vadvise(int);
+__END_DECLS
+#endif
+
+#endif /* !_SYS_VADVISE_H_ */

Property changes on: lab4/.minix-src/include/sys/vadvise.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/vmmeter.h
===================================================================
--- lab4/.minix-src/include/sys/vmmeter.h	(nonexistent)
+++ lab4/.minix-src/include/sys/vmmeter.h	(revision 13)
@@ -0,0 +1,94 @@
+/*	$NetBSD: vmmeter.h,v 1.19 2009/10/21 21:12:07 rmind Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vmmeter.h	8.2 (Berkeley) 7/10/94
+ */
+
+#ifndef _SYS_VMMETER_H_
+#define _SYS_VMMETER_H_
+
+/* systemwide totals computed every five seconds */
+struct vmtotal
+{
+	int16_t	t_rq;		/* length of the run queue */
+	int16_t	t_dw;		/* jobs in ``disk wait'' (neg priority) */
+	int16_t	t_pw;		/* jobs in page wait */
+	int16_t	t_sl;		/* jobs sleeping in core */
+	int16_t	_reserved1;
+	int32_t	t_vm;		/* total virtual memory */
+	int32_t	t_avm;		/* active virtual memory */
+	int32_t	t_rm;		/* total real memory in use */
+	int32_t	t_arm;		/* active real memory */
+	int32_t	t_vmshr;	/* shared virtual memory */
+	int32_t	t_avmshr;	/* active shared virtual memory */
+	int32_t	t_rmshr;	/* shared real memory */
+	int32_t	t_armshr;	/* active shared real memory */
+	int32_t	t_free;		/* free memory pages */
+};
+
+/*
+ * Optional instrumentation.
+ */
+#ifdef PGINPROF
+
+#define	NDMON	128
+#define	NSMON	128
+
+#define	DRES	20
+#define	SRES	5
+
+#define	PMONMIN	20
+#define	PRES	50
+#define	NPMON	64
+
+#define	RMONMIN	130
+#define	RRES	5
+#define	NRMON	64
+
+/* data and stack size distribution counters */
+u_int	dmon[NDMON+1];
+u_int	smon[NSMON+1];
+
+/* page in time distribution counters */
+u_int	pmon[NPMON+2];
+
+/* reclaim time distribution counters */
+u_int	rmon[NRMON+2];
+
+int	pmonmin;
+int	pres;
+int	rmonmin;
+int	rres;
+
+u_int rectime;		/* accumulator for reclaim times */
+u_int pgintime;		/* accumulator for page in times */
+#endif /* PGINPROF */
+
+#endif /* !_SYS_VMMETER_H_ */

Property changes on: lab4/.minix-src/include/sys/vmmeter.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ucontext.h
===================================================================
--- lab4/.minix-src/include/sys/ucontext.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ucontext.h	(revision 13)
@@ -0,0 +1,134 @@
+/*	$NetBSD: ucontext.h,v 1.18 2013/03/06 18:16:58 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 1999, 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein, and by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_UCONTEXT_H_
+#define _SYS_UCONTEXT_H_
+
+#include <sys/sigtypes.h>
+#include <machine/mcontext.h>
+
+typedef struct __ucontext	ucontext_t;
+
+struct __ucontext {
+	unsigned int	uc_flags;	/* properties */
+	ucontext_t * 	uc_link;	/* context to resume */
+	sigset_t	uc_sigmask;	/* signals blocked in this context */
+	stack_t		uc_stack;	/* the stack used by this context */
+	mcontext_t	uc_mcontext;	/* machine state */
+#if defined(_UC_MACHINE_PAD)
+	long		__uc_pad[_UC_MACHINE_PAD];
+#endif
+};
+
+#ifndef _UC_UCONTEXT_ALIGN
+#define _UC_UCONTEXT_ALIGN (~0)
+#endif
+
+/* uc_flags */
+#define _UC_SIGMASK	0x01		/* valid uc_sigmask */
+#define _UC_STACK	0x02		/* valid uc_stack */
+#define _UC_CPU		0x04		/* valid GPR context in uc_mcontext */
+#define _UC_FPU		0x08		/* valid FPU context in uc_mcontext */
+#if defined(__minix)
+#define	_UC_SWAPPED	0x10000
+#define _UC_IGNFPU      0x20000
+#define _UC_IGNSIGM     0x40000
+#endif /* defined(__minix) */
+#define	_UC_MD		0x400f0020	/* MD bits.  see below */
+
+/*
+ * if your port needs more MD bits, please try to choose bits from _UC_MD
+ * first, rather than picking random unused bits.
+ *
+ * _UC_MD details
+ *
+ * 	_UC_TLSBASE	Context contains valid pthread private pointer 
+ *			All ports must define this MD flag
+ * 			0x00040000	hppa, mips
+ * 			0x00000020	alpha
+ *			0x00080000	all other ports
+ *
+ *	_UC_SETSTACK	Context uses signal stack
+ *			0x00020000	arm
+ *			[undefined]	alpha, powerpc and vax
+ *			0x00010000	other ports
+ *
+ *	_UC_CLRSTACK	Context does not use signal stack
+ *			0x00040000	arm
+ *			[undefined]	alpha, powerpc and vax
+ *			0x00020000	other ports
+ *
+ *	_UC_POWERPC_VEC Context does not use signal stack
+ *			0x00010000	powerpc only
+ *
+ *	_UC_POWERPC_SPE	Context contains valid SPE context
+ *			0x00020000	powerpc only
+ *
+ *	_UC_M68K_UC_USER Used by m68k machdep code, but undocumented
+ *			0x40000000	m68k only
+ *
+ *	_UC_ARM_VFP	Unused
+ *			0x00010000	arm only
+ *
+ *	_UC_VM		Context contains valid virtual 8086 context
+ *			0x00040000	i386, amd64 only
+ *
+ *	_UC_FXSAVE	Context contains FPU context in that 
+ *			is in FXSAVE format in XMM space 
+ *			0x00000020	i386, amd64 only
+ */
+
+#ifdef _KERNEL
+struct lwp;
+
+void	getucontext(struct lwp *, ucontext_t *);
+int	setucontext(struct lwp *, const ucontext_t *);
+void	cpu_getmcontext(struct lwp *, mcontext_t *, unsigned int *);
+int	cpu_setmcontext(struct lwp *, const mcontext_t *, unsigned int);
+int	cpu_mcontext_validate(struct lwp *, const mcontext_t *);
+
+#ifdef __UCONTEXT_SIZE
+__CTASSERT(sizeof(ucontext_t) == __UCONTEXT_SIZE);
+#endif
+#endif /* _KERNEL */
+
+#if defined(__minix)
+__BEGIN_DECLS
+void resumecontext(ucontext_t *ucp);
+ 
+/* These functions get and set ucontext structure through PM/kernel. They don't
+ * manipulate the stack. */
+int getuctx(ucontext_t *ucp);
+int setuctx(const ucontext_t *ucp);
+__END_DECLS
+#endif /* defined(__minix) */
+
+#endif /* !_SYS_UCONTEXT_H_ */

Property changes on: lab4/.minix-src/include/sys/ucontext.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/unistd.h
===================================================================
--- lab4/.minix-src/include/sys/unistd.h	(nonexistent)
+++ lab4/.minix-src/include/sys/unistd.h	(revision 13)
@@ -0,0 +1,328 @@
+/*	$NetBSD: unistd.h,v 1.55 2013/12/19 19:11:50 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)unistd.h	8.2 (Berkeley) 1/7/94
+ */
+
+#ifndef _SYS_UNISTD_H_
+#define	_SYS_UNISTD_H_
+
+#include <sys/featuretest.h>
+
+/* compile-time symbolic constants */
+#define	_POSIX_JOB_CONTROL	1
+				/* implementation supports job control */
+
+/*
+ * According to POSIX 1003.1:
+ * "The saved set-user-ID capability allows a program to regain the
+ * effective user ID established at the last exec call."
+ * However, the setuid/setgid function as specified by POSIX 1003.1 does
+ * not allow changing the effective ID from the super-user without also
+ * changed the saved ID, so it is impossible to get super-user privileges
+ * back later.  Instead we provide this feature independent of the current
+ * effective ID through the seteuid/setegid function.  In addition, we do
+ * not use the saved ID as specified by POSIX 1003.1 in setuid/setgid,
+ * because this would make it impossible for a set-user-ID executable
+ * owned by a user other than the super-user to permanently revoke its
+ * extra privileges.
+ */
+#ifdef	_NOT_AVAILABLE
+#define	_POSIX_SAVED_IDS	1
+				/* saved set-user-ID and set-group-ID */
+#endif
+
+#define	_POSIX_VERSION			200112L
+#define	_POSIX2_VERSION			200112L
+
+#if !defined(__minix)
+/*
+ * We support the posix_spawn() family of functions (unconditionally).
+ */
+#define	_POSIX_SPAWN			200809L
+#endif /* !defined(__minix) */
+
+/* execution-time symbolic constants */
+
+/*
+ * POSIX options and option groups we unconditionally do or don't
+ * implement.  Those options which are implemented (or not) entirely
+ * in user mode are defined in <unistd.h>.  Please keep this list in
+ * alphabetical order.
+ *
+ * Anything which is defined as zero below **must** have an
+ * implementation for the corresponding sysconf() which is able to
+ * determine conclusively whether or not the feature is supported.
+ * Anything which is defined as other than -1 below **must** have
+ * complete headers, types, and function declarations as specified by
+ * the POSIX standard; however, if the relevant sysconf() function
+ * returns -1, the functions may be stubbed out.
+ */
+					/* Advisory information */
+#undef	_POSIX_ADVISORY_INFO
+					/* asynchronous I/O is available */
+#define	_POSIX_ASYNCHRONOUS_IO		200112L
+					/* barriers */
+#define	_POSIX_BARRIERS			200112L
+					/* chown requires correct privileges */
+#define	_POSIX_CHOWN_RESTRICTED		1
+					/* clock selection */
+#define	_POSIX_CLOCK_SELECTION		-1
+					/* CPU type */
+#undef	_POSIX_CPUTYPE
+					/* file synchronization is available */
+#define	_POSIX_FSYNC			1
+					/* support IPv6 */
+#define	_POSIX_IPV6			0
+					/* job control is available */
+#define	_POSIX_JOB_CONTROL		1
+					/* memory mapped files */
+#define	_POSIX_MAPPED_FILES		1
+					/* memory locking whole address space */
+#define	_POSIX_MEMLOCK			1
+					/* memory locking address ranges */
+#define	_POSIX_MEMLOCK_RANGE		1
+					/* memory access protections */
+#define	_POSIX_MEMORY_PROTECTION	1
+					/* message passing is available */
+#define	_POSIX_MESSAGE_PASSING		200112L
+					/* monotonic clock */
+#define	_POSIX_MONOTONIC_CLOCK		200112L
+					/* too-long path comp generate errors */
+#define	_POSIX_NO_TRUNC			1
+					/* prioritized I/O */
+#define	_POSIX_PRIORITIZED_IO		-1
+					/* priority scheduling */
+#define	_POSIX_PRIORITY_SCHEDULING	200112L
+					/* raw sockets */
+#define	_POSIX_RAW_SOCKETS		200112L
+					/* read/write locks */
+#define	_POSIX_READER_WRITER_LOCKS	200112L
+					/* realtime signals */
+#undef	_POSIX_REALTIME_SIGNALS
+					/* regular expressions */
+#define	_POSIX_REGEXP			1
+					/* semaphores */
+#define	_POSIX_SEMAPHORES		0
+					/* shared memory objects */
+#define	_POSIX_SHARED_MEMORY_OBJECTS	0
+					/* shell */
+#define	_POSIX_SHELL			1
+					/* spin locks */
+#define	_POSIX_SPIN_LOCKS		200112L
+					/* sporadic server */
+#undef	_POSIX_SPORADIC_SERVER
+					/* synchronized I/O is available */
+#define	_POSIX_SYNCHRONIZED_IO		1
+					/* threads */
+#define	_POSIX_THREADS			200112L
+					/* pthread_attr for stack size */
+#define	_POSIX_THREAD_ATTR_STACKSIZE	200112L
+					/* pthread_attr for stack address */
+#define	_POSIX_THREAD_ATTR_STACKADDR	200112L
+					/* _r functions */
+#define	_POSIX_THREAD_SAFE_FUNCTIONS	200112L
+					/* timeouts */
+#undef	_POSIX_TIMEOUTS
+					/* timers */
+#define	_POSIX_TIMERS			200112L
+					/* typed memory objects */
+#undef	_POSIX_TYPED_MEMORY_OBJECTS
+					/* may disable terminal spec chars */
+#define	_POSIX_VDISABLE			__CAST(unsigned char, '\377')
+
+					/* C binding */
+#define	_POSIX2_C_BIND			200112L
+
+					/* XPG4.2 shared memory */
+#define	_XOPEN_SHM			0
+
+/* access function */
+#define	F_OK		0	/* test for existence of file */
+#define	X_OK		0x01	/* test for execute or search permission */
+#define	W_OK		0x02	/* test for write permission */
+#define	R_OK		0x04	/* test for read permission */
+
+/* whence values for lseek(2) */
+#define	SEEK_SET	0	/* set file offset to offset */
+#define	SEEK_CUR	1	/* set file offset to current plus offset */
+#define	SEEK_END	2	/* set file offset to EOF plus offset */
+
+#if defined(_NETBSD_SOURCE)
+/* whence values for lseek(2); renamed by POSIX 1003.1 */
+#define	L_SET		SEEK_SET
+#define	L_INCR		SEEK_CUR
+#define	L_XTND		SEEK_END
+
+/*
+ * fsync_range values.
+ *
+ * Note the following flag values were chosen to not overlap
+ * values for SEEK_XXX flags.  While not currently implemented,
+ * it is possible to extend this call to respect SEEK_CUR and
+ * SEEK_END offset addressing modes.
+ */
+#define	FDATASYNC	0x0010	/* sync data and minimal metadata */
+#define	FFILESYNC	0x0020	/* sync data and metadata */
+#define	FDISKSYNC	0x0040	/* flush disk caches after sync */
+#endif
+
+/* configurable pathname variables; use as argument to pathconf(3) */
+#define	_PC_LINK_MAX		 1
+#define	_PC_MAX_CANON		 2
+#define	_PC_MAX_INPUT		 3
+#define	_PC_NAME_MAX		 4
+#define	_PC_PATH_MAX		 5
+#define	_PC_PIPE_BUF		 6
+#define	_PC_CHOWN_RESTRICTED	 7
+#define	_PC_NO_TRUNC		 8
+#define	_PC_VDISABLE		 9
+#define	_PC_SYNC_IO		10
+#define	_PC_FILESIZEBITS	11
+#define	_PC_SYMLINK_MAX		12
+#define	_PC_2_SYMLINKS		13
+#define	_PC_ACL_EXTENDED	14
+
+/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */
+#define	_PC_MIN_HOLE_SIZE	15
+
+/* configurable system variables; use as argument to sysconf(3) */
+/*
+ * XXX The value of _SC_CLK_TCK is embedded in <time.h>.
+ * XXX The value of _SC_PAGESIZE is embedded in <sys/shm.h>.
+ */
+#define	_SC_ARG_MAX		 1
+#define	_SC_CHILD_MAX		 2
+#define	_O_SC_CLK_TCK		 3 /* Old version, always 100 */
+#define	_SC_NGROUPS_MAX		 4
+#define	_SC_OPEN_MAX		 5
+#define	_SC_JOB_CONTROL		 6
+#define	_SC_SAVED_IDS		 7
+#define	_SC_VERSION		 8
+#define	_SC_BC_BASE_MAX		 9
+#define	_SC_BC_DIM_MAX		10
+#define	_SC_BC_SCALE_MAX	11
+#define	_SC_BC_STRING_MAX	12
+#define	_SC_COLL_WEIGHTS_MAX	13
+#define	_SC_EXPR_NEST_MAX	14
+#define	_SC_LINE_MAX		15
+#define	_SC_RE_DUP_MAX		16
+#define	_SC_2_VERSION		17
+#define	_SC_2_C_BIND		18
+#define	_SC_2_C_DEV		19
+#define	_SC_2_CHAR_TERM		20
+#define	_SC_2_FORT_DEV		21
+#define	_SC_2_FORT_RUN		22
+#define	_SC_2_LOCALEDEF		23
+#define	_SC_2_SW_DEV		24
+#define	_SC_2_UPE		25
+#define	_SC_STREAM_MAX		26
+#define	_SC_TZNAME_MAX		27
+#define	_SC_PAGESIZE		28
+#define	_SC_PAGE_SIZE		_SC_PAGESIZE	/* 1170 compatibility */
+#define	_SC_FSYNC		29
+#define	_SC_XOPEN_SHM		30
+#define	_SC_SYNCHRONIZED_IO	31
+#define	_SC_IOV_MAX		32
+#define	_SC_MAPPED_FILES	33
+#define	_SC_MEMLOCK		34
+#define	_SC_MEMLOCK_RANGE	35
+#define	_SC_MEMORY_PROTECTION	36
+#define	_SC_LOGIN_NAME_MAX	37
+#define	_SC_MONOTONIC_CLOCK	38
+#define	_SC_CLK_TCK		39 /* New, variable version */
+#define	_SC_ATEXIT_MAX		40
+#define	_SC_THREADS		41
+#define	_SC_SEMAPHORES		42
+#define	_SC_BARRIERS		43
+#define	_SC_TIMERS		44
+#define	_SC_SPIN_LOCKS		45
+#define	_SC_READER_WRITER_LOCKS	46
+#define	_SC_GETGR_R_SIZE_MAX	47
+#define	_SC_GETPW_R_SIZE_MAX	48
+#define	_SC_CLOCK_SELECTION	49
+#define	_SC_ASYNCHRONOUS_IO	50
+#define	_SC_AIO_LISTIO_MAX	51
+#define	_SC_AIO_MAX		52
+#define	_SC_MESSAGE_PASSING	53
+#define	_SC_MQ_OPEN_MAX		54
+#define	_SC_MQ_PRIO_MAX		55
+#define	_SC_PRIORITY_SCHEDULING	56
+#define	_SC_THREAD_DESTRUCTOR_ITERATIONS 57
+#define	_SC_THREAD_KEYS_MAX		58
+#define	_SC_THREAD_STACK_MIN		59
+#define	_SC_THREAD_THREADS_MAX		60
+#define	_SC_THREAD_ATTR_STACKADDR	61
+#define	_SC_THREAD_ATTR_STACKSIZE 	62
+#define	_SC_THREAD_PRIORITY_SCHEDULING	63
+#define	_SC_THREAD_PRIO_INHERIT 	64
+#define	_SC_THREAD_PRIO_PROTECT		65
+#define	_SC_THREAD_PROCESS_SHARED	66
+#define	_SC_THREAD_SAFE_FUNCTIONS	67
+#define	_SC_TTY_NAME_MAX		68
+#define	_SC_HOST_NAME_MAX		69
+#define	_SC_PASS_MAX			70
+#define	_SC_REGEXP			71
+#define	_SC_SHELL			72
+#define	_SC_SYMLOOP_MAX			73
+
+/* Actually, they are not supported or implemented yet */
+#define	_SC_V6_ILP32_OFF32		74
+#define	_SC_V6_ILP32_OFFBIG		75
+#define	_SC_V6_LP64_OFF64		76
+#define	_SC_V6_LPBIG_OFFBIG		77
+#define	_SC_2_PBS			80
+#define	_SC_2_PBS_ACCOUNTING		81
+#define	_SC_2_PBS_CHECKPOINT		82
+#define	_SC_2_PBS_LOCATE		83
+#define	_SC_2_PBS_MESSAGE		84
+#define	_SC_2_PBS_TRACK			85
+
+/* These are implemented */
+#define	_SC_SPAWN			86
+#define	_SC_SHARED_MEMORY_OBJECTS	87
+
+/* Extensions found in Solaris and Linux. */
+#define	_SC_PHYS_PAGES		121
+
+#ifdef _NETBSD_SOURCE
+/* Commonly provided sysconf() extensions */
+#define	_SC_NPROCESSORS_CONF	1001
+#define	_SC_NPROCESSORS_ONLN	1002
+/* Native variables */
+#define	_SC_SCHED_RT_TS		2001
+#define	_SC_SCHED_PRI_MIN	2002
+#define	_SC_SCHED_PRI_MAX	2003
+#endif	/* _NETBSD_SOURCE */
+
+/* configurable system strings */
+#define	_CS_PATH		 1
+
+#endif /* !_SYS_UNISTD_H_ */

Property changes on: lab4/.minix-src/include/sys/unistd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/uuid.h
===================================================================
--- lab4/.minix-src/include/sys/uuid.h	(nonexistent)
+++ lab4/.minix-src/include/sys/uuid.h	(revision 13)
@@ -0,0 +1,81 @@
+/*	$NetBSD: uuid.h,v 1.6 2014/10/04 11:15:44 riastradh Exp $	*/
+
+/*
+ * Copyright (c) 2002 Marcel Moolenaar
+ * 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.
+ *
+ * $FreeBSD: /repoman/r/ncvs/src/sys/sys/uuid.h,v 1.3 2003/05/31 16:47:07 phk Exp $
+ */
+
+#ifndef _SYS_UUID_H_
+#define	_SYS_UUID_H_
+
+#include <sys/cdefs.h>
+
+/* Length of a node address (an IEEE 802 address). */
+#define	_UUID_NODE_LEN		6
+
+/* Length of a printed UUID. */
+#define	_UUID_STR_LEN		38
+
+/*
+ * See also:
+ *      http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt
+ *      http://www.opengroup.org/onlinepubs/009629399/apdxa.htm
+ *
+ * A DCE 1.1 compatible source representation of UUIDs.
+ */
+struct uuid {
+	uint32_t	time_low;
+	uint16_t	time_mid;
+	uint16_t	time_hi_and_version;
+	uint8_t		clock_seq_hi_and_reserved;
+	uint8_t		clock_seq_low;
+	uint8_t		node[_UUID_NODE_LEN];
+};
+
+#ifdef _KERNEL
+
+#define	UUID_NODE_LEN	_UUID_NODE_LEN
+#define	UUID_STR_LEN	_UUID_STR_LEN
+
+int	uuid_snprintf(char *, size_t, const struct uuid *);
+int	uuid_printf(const struct uuid *);
+void	uuid_dec_be(const void *, struct uuid *);
+void	uuid_dec_le(const void *, struct uuid *);
+void	uuid_enc_be(void *, const struct uuid *);
+void	uuid_enc_le(void *, const struct uuid *);
+int	uuidgen(struct uuid *, int);
+
+#else	/* _KERNEL */
+
+typedef struct uuid uuid_t;
+
+__BEGIN_DECLS
+int	uuidgen(struct uuid *, int);
+__END_DECLS
+
+#endif	/* _KERNEL */
+
+#endif /* _SYS_UUID_H_ */

Property changes on: lab4/.minix-src/include/sys/uuid.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/videoio.h
===================================================================
--- lab4/.minix-src/include/sys/videoio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/videoio.h	(revision 13)
@@ -0,0 +1,751 @@
+/* $NetBSD: videoio.h,v 1.9 2015/09/06 06:01:02 dholland Exp $ */
+
+/*-
+ * Copyright (c) 2005, 2008 Jared D. McNeill <jmcneill@invisible.ca>
+ * 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+/* See http://v4l2spec.bytesex.org/ for Video4Linux 2 specifications */
+
+#ifndef _HAVE_SYS_VIDEOIO_H
+#define _HAVE_SYS_VIDEOIO_H
+
+#include <sys/types.h>
+#include <sys/ioccom.h>
+#include <sys/time.h>
+#ifdef _KERNEL
+#include <compat/sys/time.h>
+#endif
+
+#ifndef _KERNEL
+#define __u64	uint64_t
+#define __u32	uint32_t
+#define __u16	uint16_t
+#define __u8	uint8_t
+#define __s64	int64_t
+#define __s32	int32_t
+#define __s16	int16_t
+#define __s8	int8_t
+#endif
+
+typedef uint64_t v4l2_std_id;
+#define v4l2_fourcc(a,b,c,d) (((uint32_t)(a) << 0) |	\
+			      ((uint32_t)(b) << 8) |	\
+			      ((uint32_t)(c) << 16) |	\
+			      ((uint32_t)(d) << 24))
+#if 0
+#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+#endif
+
+#define V4L2_CTRL_ID2CLASS(id)	((id >> 16) & 0xfff)
+#define V4L2_CTRL_ID2CID(id)	(id & 0xffff)
+
+enum v4l2_colorspace {
+	V4L2_COLORSPACE_SMPTE170M = 1,
+	V4L2_COLORSPACE_SMPTE240M,
+	V4L2_COLORSPACE_REC709,
+	V4L2_COLORSPACE_BT878,
+	V4L2_COLORSPACE_470_SYSTEM_M,
+	V4L2_COLORSPACE_470_SYSTEM_BG,
+	V4L2_COLORSPACE_JPEG,
+	V4L2_COLORSPACE_SRGB
+};
+
+enum v4l2_field {
+	V4L2_FIELD_ANY = 0,
+	V4L2_FIELD_NONE,
+	V4L2_FIELD_TOP,
+	V4L2_FIELD_BOTTOM,
+	V4L2_FIELD_INTERLACED,
+	V4L2_FIELD_SEQ_TB,
+	V4L2_FIELD_SEQ_BT,
+	V4L2_FIELD_ALTERNATE
+};
+
+enum v4l2_buf_type {
+	V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
+	V4L2_BUF_TYPE_VIDEO_OUTPUT,
+	V4L2_BUF_TYPE_VIDEO_OVERLAY,
+	V4L2_BUF_TYPE_VBI_CAPTURE,
+	V4L2_BUF_TYPE_VBI_OUTPUT,
+	V4L2_BUF_TYPE_PRIVATE = 0x80
+};
+
+enum v4l2_memory {
+	V4L2_MEMORY_MMAP = 1,
+	V4L2_MEMORY_USERPTR,
+	V4L2_MEMORY_OVERLAY
+};
+
+enum v4l2_priority {
+	V4L2_PRIORITY_UNSET = 0,
+	V4L2_PRIORITY_BACKGROUND,
+	V4L2_PRIORITY_INTERACTIVE,
+	V4L2_PRIORITY_RECORD,
+	V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE
+};
+
+enum v4l2_tuner_type {
+	V4L2_TUNER_RADIO = 1,
+	V4L2_TUNER_ANALOG_TV
+};
+
+enum v4l2_ctrl_type {
+	V4L2_CTRL_TYPE_INTEGER = 1,
+	V4L2_CTRL_TYPE_BOOLEAN,
+	V4L2_CTRL_TYPE_MENU,
+	V4L2_CTRL_TYPE_BUTTON
+};
+
+struct v4l2_timecode {
+	uint32_t	type;
+	uint32_t	flags;
+	uint8_t		frames;
+	uint8_t		seconds;
+	uint8_t		minutes;
+	uint8_t		hours;
+	uint8_t		userbits[4];
+};
+
+struct v4l2_pix_format {
+	uint32_t	width;
+	uint32_t	height;
+	uint32_t	pixelformat;
+	enum v4l2_field	field;
+	uint32_t	bytesperline;
+	uint32_t	sizeimage;
+	enum v4l2_colorspace colorspace;
+	uint32_t	priv;
+};
+
+struct v4l2_buffer {
+	uint32_t	index;
+	enum v4l2_buf_type type;
+	uint32_t	bytesused;
+	uint32_t	flags;
+	enum v4l2_field	field;
+	struct timeval	timestamp;
+	struct v4l2_timecode timecode;
+	uint32_t	sequence;
+	enum v4l2_memory memory;
+	union {
+		uint32_t	offset;
+		unsigned long	userptr;
+	} m;
+	uint32_t	length;
+	uint32_t	input;
+	uint32_t	reserved;
+};
+
+#ifdef _KERNEL
+struct v4l2_buffer50 {
+	uint32_t	index;
+	enum v4l2_buf_type type;
+	uint32_t	bytesused;
+	uint32_t	flags;
+	enum v4l2_field	field;
+	struct timeval50 timestamp;
+	struct v4l2_timecode timecode;
+	uint32_t	sequence;
+	enum v4l2_memory memory;
+	union {
+		uint32_t	offset;
+		unsigned long	userptr;
+	} m;
+	uint32_t	length;
+	uint32_t	input;
+	uint32_t	reserved;
+};
+
+#endif
+struct v4l2_rect {
+	int32_t		left;
+	int32_t		top;
+	int32_t		width;
+	int32_t		height;
+};
+
+struct v4l2_fract {
+	uint32_t	numerator;
+	uint32_t	denominator;
+};
+
+struct v4l2_fmtdesc {
+	uint32_t	index;
+	enum v4l2_buf_type type;
+	uint32_t	flags;
+	uint8_t		description[32];
+	uint32_t	pixelformat;
+	uint32_t	reserved[4];
+};
+
+struct v4l2_clip {
+	struct v4l2_rect c;
+	struct v4l2_clip *next;
+};
+
+struct v4l2_window {
+	struct v4l2_rect w;
+	enum v4l2_field	field;
+	uint32_t	chromakey;
+	struct v4l2_clip *clips;
+	uint32_t	clipcount;
+	void		*bitmap;
+};
+
+struct v4l2_vbi_format {
+	uint32_t	sampling_rate;
+	uint32_t	offset;
+	uint32_t	samples_per_line;
+	uint32_t	sample_format;
+	uint32_t	start[2];
+	uint32_t	count[2];
+	uint32_t	flags;
+	uint32_t	reserved[2];
+};
+
+/* In the API docs, but not the Linux implementation
+ *
+ * struct v4l2_sliced_vbi_format {
+ * 	uint32_t	service_set;
+ * 	uint32_t	packet_size;
+ * 	uint32_t	io_size;
+ * 	uint32_t	reserved;
+ * };
+ *
+ *
+ * struct v4l2_sliced_data {
+ * 	uint32_t	id;
+ * 	uint32_t	line;
+ * 	uint8_t		data[];
+ * };
+ */
+
+struct v4l2_cropcap {
+	enum v4l2_buf_type type;
+	struct v4l2_rect bounds;
+	struct v4l2_rect defrect;
+	struct v4l2_fract pixelaspect;
+};
+
+struct v4l2_input {
+	uint32_t	index;
+	uint8_t		name[32];
+	uint32_t	type;
+	uint32_t	audioset;
+	uint32_t	tuner;
+	v4l2_std_id	std;
+	uint32_t	status;
+	uint32_t	reserved[4];
+};
+
+struct v4l2_output {
+	uint32_t	index;
+	uint8_t		name[32];
+	uint32_t	type;
+	uint32_t	audioset;
+	uint32_t	modulator;
+	v4l2_std_id	std;
+	uint32_t	reserved[4];
+};
+
+struct v4l2_audio {
+	uint32_t	index;
+	uint8_t		name[32];
+	uint32_t	capability;
+	uint32_t	mode;
+	uint32_t	reserved[2];
+};
+
+struct v4l2_audioout {
+	uint32_t	index;
+	uint8_t		name[32];
+	uint32_t	capability;
+	uint32_t	mode;
+	uint32_t	reserved[2];
+};
+
+struct v4l2_compression {
+	uint32_t	quality;
+	uint32_t	keyframerate;
+	uint32_t	pframerate;
+	uint32_t	reserved[5];
+};
+
+struct v4l2_crop {
+	enum v4l2_buf_type type;
+	struct v4l2_rect c;
+};
+
+struct v4l2_control {
+	uint32_t	id;
+	int32_t		value;
+};
+
+struct v4l2_framebuffer {
+	uint32_t	capability;
+	uint32_t	flags;
+	void		*base;
+	struct v4l2_pix_format fmt;
+};
+
+struct v4l2_standard {
+	uint32_t	index;
+	v4l2_std_id	id;
+	uint8_t		name[24];
+	struct v4l2_fract frameperiod;
+	uint32_t	framelines;
+	uint32_t	reserved[4];
+};
+
+struct v4l2_format {
+	enum v4l2_buf_type type;
+	union {
+		struct v4l2_pix_format pix;
+		struct v4l2_window win;
+		struct v4l2_vbi_format vbi;
+		uint8_t		raw_data[200];
+	} fmt;
+};
+
+struct v4l2_frequency {
+	uint32_t	tuner;
+	enum v4l2_tuner_type type;
+	uint32_t	frequency;
+	uint32_t	reserved[8];
+};
+
+struct v4l2_jpegcompression {
+	int		quality;
+	int		APPn;
+	int		APP_len;
+	char		APP_data[60];
+	int		COM_len;
+	char		COM_data[60];
+	uint32_t	jpeg_markers;
+};
+
+struct v4l2_modulator {
+	uint32_t	index;
+	uint8_t		name[32];
+	uint32_t	capability;
+	uint32_t	rangelow;
+	uint32_t	rangehigh;
+	uint32_t	txsubchans;
+	uint32_t	reserved[4];
+};
+
+struct v4l2_captureparm {
+	uint32_t	capability;
+	uint32_t	capturemode;
+	struct v4l2_fract timeperframe;
+	uint32_t	extendedmode;
+	uint32_t	readbuffers;
+	uint32_t	reserved[4];
+};
+
+struct v4l2_outputparm {
+	uint32_t	capability;
+	uint32_t	outputmode;
+	struct v4l2_fract timeperframe;
+	uint32_t	extendedmode;
+	uint32_t	writebuffers;
+	uint32_t	reserved[4];
+};
+
+struct v4l2_streamparm {
+	enum v4l2_buf_type type;
+	union {
+		struct v4l2_captureparm capture;
+		struct v4l2_outputparm output;
+		uint8_t		raw_data[200];
+	} parm;
+};
+
+struct v4l2_tuner {
+	uint32_t	index;
+	uint8_t		name[32];
+	enum v4l2_tuner_type type;
+	uint32_t	capability;
+	uint32_t	rangelow;
+	uint32_t	rangehigh;
+	uint32_t	rxsubchans;
+	uint32_t	audmode;
+	uint32_t	signal;
+	int32_t		afc;
+	uint32_t	reserved[4];
+};
+
+struct v4l2_capability {
+	uint8_t		driver[16];
+	uint8_t		card[32];
+	uint8_t		bus_info[32];
+	uint32_t	version;
+	uint32_t	capabilities;
+	uint32_t	reserved[4];
+};
+
+struct v4l2_queryctrl {
+	uint32_t	id;
+	enum v4l2_ctrl_type type;
+	uint8_t		name[32];
+	int32_t		minimum;
+	int32_t		maximum;
+	int32_t		step;
+	int32_t		default_value;
+	uint32_t	flags;
+	uint32_t	reserved[2];
+};
+
+struct v4l2_querymenu {
+	uint32_t	id;
+	uint32_t	index;
+	uint8_t		name[32];
+	uint32_t	reserved;
+};
+
+struct v4l2_requestbuffers {
+	uint32_t	count;
+	enum v4l2_buf_type type;
+	enum v4l2_memory memory;
+	uint32_t	reserved[2];
+};
+
+/* Timecode types */
+#define V4L2_TC_TYPE_24FPS		1
+#define V4L2_TC_TYPE_25FPS		2
+#define V4L2_TC_TYPE_30FPS		3
+#define V4L2_TC_TYPE_50FPS		4
+#define V4L2_TC_TYPE_60FPS		5
+
+/* Timecode flags */
+#define V4L2_TC_FLAG_DROPFRAME		0x0001
+#define V4L2_TC_FLAG_COLORFRAME		0x0002
+#define V4L2_TC_USERBITS_field		0x000c
+#define V4L2_TC_USERBITS_USERDEFINED	0x0000
+#define V4L2_TC_USERBITS_8BITCHARS	0x0008
+
+/* Buffer flags */
+#define V4L2_BUF_FLAG_MAPPED		0x0001
+#define V4L2_BUF_FLAG_QUEUED		0x0002
+#define V4L2_BUF_FLAG_DONE		0x0004
+#define V4L2_BUF_FLAG_KEYFRAME		0x0008
+#define V4L2_BUF_FLAG_PFRAME		0x0010
+#define V4L2_BUF_FLAG_BFRAME		0x0020
+#define V4L2_BUF_FLAG_TIMECODE		0x0100
+#define V4L2_BUF_FLAG_INPUT		0x0200
+
+/* Image format description flags */
+#define V4L2_FMT_FLAG_COMPRESSED	0x0001
+
+/* Input types */
+#define V4L2_INPUT_TYPE_TUNER		1
+#define V4L2_INPUT_TYPE_CAMERA		2
+
+/* Input status flags */
+#define V4L2_IN_ST_NO_POWER		0x00000001
+#define V4L2_IN_ST_NO_SIGNAL		0x00000002
+#define V4L2_IN_ST_NO_COLOR		0x00000004
+#define V4L2_IN_ST_NO_H_LOCK		0x00000100
+#define V4L2_IN_ST_COLOR_KILL		0x00000200
+#define V4L2_IN_ST_NO_SYNC		0x00010000
+#define V4L2_IN_ST_NO_EQU		0x00020000
+#define V4L2_IN_ST_NO_CARRIER		0x00040000
+#define V4L2_IN_ST_MACROVISION		0x01000000
+#define V4L2_IN_ST_NO_ACCESS		0x02000000
+#define V4L2_IN_ST_VTR			0x04000000
+
+/* Output types */
+#define V4L2_OUTPUT_TYPE_MODULATOR		1
+#define V4L2_OUTPUT_TYPE_ANALOG			2
+#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY	3
+
+/* Audio capability flags */
+#define V4L2_AUDCAP_STEREO		0x00001
+#define V4L2_AUDCAP_AVL			0x00002
+
+/* Audio modes */
+#define V4L2_AUDMODE_AVL		0x00001
+
+/* Frame buffer capability flags */
+#define V4L2_FBUF_CAP_EXTERNOVERLAY	0x0001
+#define V4L2_FBUF_CAP_CHROMAKEY		0x0002
+#define V4L2_FBUF_CAP_LIST_CLIPPING	0x0004
+#define V4L2_FBUF_CAP_BITMAP_CLIPPING	0x0008
+
+/* Frame buffer flags */
+#define V4L2_FBUF_FLAG_PRIMARY		0x0001
+#define V4L2_FBUF_FLAG_OVERLAY		0x0002
+#define V4L2_FBUF_FLAG_CHROMAKEY	0x0004
+
+/* JPEG markers flags */
+#define V4L2_JPEG_MARKER_DHT		(1 << 3)
+#define V4L2_JPEG_MARKER_DQT		(1 << 4)
+#define V4L2_JPEG_MARKER_DRI		(1 << 5)
+#define V4L2_JPEG_MARKER_COM		(1 << 6)
+#define V4L2_JPEG_MARKER_APP		(1 << 7)
+
+/* Streaming parameters capabilities */
+#define V4L2_CAP_TIMEPERFRAME		0x1000
+
+/* Capture parameters flags */
+#define V4L2_MODE_HIGHQUALITY		0x0001
+
+/* Tuner and modulator capability flags */
+#define V4L2_TUNER_CAP_LOW		0x0001
+#define V4L2_TUNER_CAP_NORM		0x0002
+#define V4L2_TUNER_CAP_STEREO		0x0010
+#define V4L2_TUNER_CAP_LANG2		0x0020
+#define V4L2_TUNER_CAP_SAP		0x0020
+#define V4L2_TUNER_CAP_LANG1		0x0040
+
+/* Tuner and modulation audio transmission flags */
+#define V4L2_TUNER_SUB_MONO		0x0001
+#define V4L2_TUNER_SUB_STEREO		0x0002
+#define V4L2_TUNER_SUB_LANG2		0x0004
+#define V4L2_TUNER_SUB_SAP		0x0004
+#define V4L2_TUNER_SUB_LANG1		0x0008
+
+/* Tuner audio modes */
+#define V4L2_TUNER_MODE_MONO		0
+#define V4L2_TUNER_MODE_STEREO		1
+#define V4L2_TUNER_MODE_LANG2		2
+#define V4L2_TUNER_MODE_SAP		2
+#define V4L2_TUNER_MODE_LANG1		3
+#define V4L2_TUNER_MODE_LANG1_LANG2	4
+
+/* Control flags */
+#define V4L2_CTRL_FLAG_DISABLED		0x0001
+#define V4L2_CTRL_FLAG_GRABBED		0x0002
+#define V4L2_CTRL_FLAG_READ_ONLY	0x0004
+#define V4L2_CTRL_FLAG_UPDATE		0x0008
+#define V4L2_CTRL_FLAG_INACTIVE		0x0010
+#define V4L2_CTRL_FLAG_SLIDER		0x0020
+
+/* Control IDs defined by V4L2 */
+#define V4L2_CID_BASE			0x00980900
+#define V4L2_CID_PRIVATE_BASE		0x08000000
+
+#define V4L2_CID_BRIGHTNESS		(V4L2_CID_BASE + 0)
+#define V4L2_CID_CONTRAST		(V4L2_CID_BASE + 1)
+#define V4L2_CID_SATURATION		(V4L2_CID_BASE + 2)
+#define V4L2_CID_HUE			(V4L2_CID_BASE + 3)
+#define V4L2_CID_AUDIO_VOLUME		(V4L2_CID_BASE + 5)
+#define V4L2_CID_AUDIO_BALANCE		(V4L2_CID_BASE + 6)
+#define V4L2_CID_AUDIO_BASS		(V4L2_CID_BASE + 7)
+#define V4L2_CID_AUDIO_TREBLE		(V4L2_CID_BASE + 8)
+#define V4L2_CID_AUDIO_MUTE		(V4L2_CID_BASE + 9)
+#define V4L2_CID_AUDIO_LOUDNESS		(V4L2_CID_BASE + 10)
+#define V4L2_CID_BLACK_LEVEL		(V4L2_CID_BASE + 11)
+#define V4L2_CID_AUTO_WHITE_BALANCE	(V4L2_CID_BASE + 12)
+#define V4L2_CID_DO_WHITE_BALANCE	(V4L2_CID_BASE + 13)
+#define V4L2_CID_RED_BALANCE		(V4L2_CID_BASE + 14)
+#define V4L2_CID_BLUE_BALANCE		(V4L2_CID_BASE + 15)
+#define V4L2_CID_GAMMA			(V4L2_CID_BASE + 16)
+#define V4L2_CID_WHITENESS		(V4L2_CID_GAMMA)
+#define V4L2_CID_EXPOSURE		(V4L2_CID_BASE + 17)
+#define V4L2_CID_AUTOGAIN		(V4L2_CID_BASE + 18)
+#define V4L2_CID_GAIN			(V4L2_CID_BASE + 19)
+#define V4L2_CID_HFLIP			(V4L2_CID_BASE + 20)
+#define V4L2_CID_VFLIP			(V4L2_CID_BASE + 21)
+#define V4L2_CID_HCENTER_DEPRECATED	(V4L2_CID_BASE + 22)
+#define V4L2_CID_VCENTER_DEPRECATED	(V4L2_CID_BASE + 23)
+#define V4L2_CID_HCENTER	V4L2_CID_HCENTER_DEPRECATED
+#define V4L2_CID_VCENTER	V4L2_CID_VCENTER_DEPRECATED
+#define V4L2_CID_POWER_LINE_FREQUENCY	(V4L2_CID_BASE + 24)
+#define V4L2_CID_HUE_AUTO		(V4L2_CID_BASE + 25)
+#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE + 26)
+#define V4L2_CID_SHARPNESS		(V4L2_CID_BASE + 27)
+#define V4L2_CID_BACKLIGHT_COMPENSATION	(V4L2_CID_BASE + 28)
+#define V4L2_CID_LASTP1			(V4L2_CID_BASE + 29)
+
+/* Pixel formats */
+#define V4L2_PIX_FMT_RGB332	v4l2_fourcc('R', 'G', 'B', '1')
+#define V4L2_PIX_FMT_RGB555	v4l2_fourcc('R', 'G', 'B', 'O')
+#define V4L2_PIX_FMT_RGB565	v4l2_fourcc('R', 'G', 'B', 'P')
+#define V4L2_PIX_FMT_RGB555X	v4l2_fourcc('R', 'G', 'B', 'Q')
+#define V4L2_PIX_FMT_RGB565X	v4l2_fourcc('R', 'G', 'B', 'R')
+#define V4L2_PIX_FMT_BGR24	v4l2_fourcc('B', 'G', 'R', '3')
+#define V4L2_PIX_FMT_RGB24	v4l2_fourcc('R', 'G', 'B', '3')
+#define V4L2_PIX_FMT_BGR32	v4l2_fourcc('B', 'G', 'R', '4')
+#define V4L2_PIX_FMT_RGB32	v4l2_fourcc('R', 'G', 'B', '4')
+#define V4L2_PIX_FMT_GREY	v4l2_fourcc('G', 'R', 'E', 'Y')
+#define V4L2_PIX_FMT_YUYV	v4l2_fourcc('Y', 'U', 'Y', 'V')
+#define V4L2_PIX_FMT_UYVY	v4l2_fourcc('U', 'Y', 'V', 'Y')
+#define V4L2_PIX_FMT_Y41P	v4l2_fourcc('Y', '4', '1', 'P')
+#define V4L2_PIX_FMT_YVU420	v4l2_fourcc('Y', 'V', '1', '2')
+#define V4L2_PIX_FMT_YUV420	v4l2_fourcc('Y', 'U', '1', '2')
+#define V4L2_PIX_FMT_YVU410	v4l2_fourcc('Y', 'V', 'U', '9')
+#define V4L2_PIX_FMT_YUV410	v4l2_fourcc('Y', 'U', 'V', '9')
+#define V4L2_PIX_FMT_YUV422P	v4l2_fourcc('4', '2', '2', 'P')
+#define V4L2_PIX_FMT_YUV411P	v4l2_fourcc('Y', '1', '1', 'P')
+#define V4L2_PIX_FMT_NV12	v4l2_fourcc('N', 'V', '1', '2')
+#define V4L2_PIX_FMT_NV21	v4l2_fourcc('N', 'V', '2', '1')
+/* http://www.siliconimaging.com/RGB%20Bayer.htm */
+#define V4L2_PIX_FMT_SBGGR8	v4l2_fourcc('B', 'A', '8', '1')
+/* Reserved pixel formats */
+#define V4L2_PIX_FMT_YYUV	v4l2_fourcc('Y', 'Y', 'U', 'V')
+#define V4L2_PIX_FMT_HI240	v4l2_fourcc('H', 'I', '2', '4')
+#define V4L2_PIX_FMT_MJPEG	v4l2_fourcc('M', 'J', 'P', 'G')
+#define V4L2_PIX_FMT_JPEG	v4l2_fourcc('J', 'P', 'E', 'G')
+#define V4L2_PIX_FMT_DV		v4l2_fourcc('d', 'v', 's', 'd')
+#define V4L2_PIX_FMT_MPEG	v4l2_fourcc('M', 'P', 'E', 'G')
+#define V4L2_PIX_FMT_WNVA	v4l2_fourcc('W', 'N', 'V', 'A')
+#define V4L2_PIX_FMT_SN9C10X	v4l2_fourcc('S', '9', '1', '0')
+
+/* Video standards */
+#define V4L2_STD_PAL_B		((v4l2_std_id)0x00000001)
+#define V4L2_STD_PAL_B1		((v4l2_std_id)0x00000002)
+#define V4L2_STD_PAL_G		((v4l2_std_id)0x00000004)
+#define V4L2_STD_PAL_H		((v4l2_std_id)0x00000008)
+#define V4L2_STD_PAL_I		((v4l2_std_id)0x00000010)
+#define V4L2_STD_PAL_D		((v4l2_std_id)0x00000020)
+#define V4L2_STD_PAL_D1		((v4l2_std_id)0x00000040)
+#define V4L2_STD_PAL_K		((v4l2_std_id)0x00000080)
+#define V4L2_STD_PAL_M		((v4l2_std_id)0x00000100)
+#define V4L2_STD_PAL_N		((v4l2_std_id)0x00000200)
+#define V4L2_STD_PAL_Nc		((v4l2_std_id)0x00000400)
+#define V4L2_STD_PAL_60		((v4l2_std_id)0x00000800)
+#define V4L2_STD_NTSC_M		((v4l2_std_id)0x00001000)
+#define V4L2_STD_NTSC_M_JP	((v4l2_std_id)0x00002000)
+#define V4L2_STD_SECAM_B	((v4l2_std_id)0x00010000)
+#define V4L2_STD_SECAM_D	((v4l2_std_id)0x00020000)
+#define V4L2_STD_SECAM_G	((v4l2_std_id)0x00040000)
+#define V4L2_STD_SECAM_H	((v4l2_std_id)0x00080000)
+#define V4L2_STD_SECAM_K	((v4l2_std_id)0x00100000)
+#define V4L2_STD_SECAM_K1	((v4l2_std_id)0x00200000)
+#define V4L2_STD_SECAM_L	((v4l2_std_id)0x00400000)
+#define V4L2_STD_ATSC_8_VSB	((v4l2_std_id)0x01000000)
+#define V4L2_STD_ATSC_16_VSB	((v4l2_std_id)0x02000000)
+#define V4L2_STD_PAL_BG		(V4L2_STD_PAL_B |	\
+				 V4L2_STD_PAL_B1 |	\
+				 V4L2_STD_PAL_G)
+#define V4L2_STD_PAL_DK		(V4L2_STD_PAL_D |	\
+				 V4L2_STD_PAL_D1 |	\
+				 V4L2_STD_PAL_K)
+#define V4L2_STD_PAL		(V4L2_STD_PAL_BG |	\
+				 V4L2_STD_PAL_DK |	\
+				 V4L2_STD_PAL_H |	\
+				 V4L2_STD_PAL_I)
+#define V4L2_STD_NTSC		(V4L2_STD_NTSC_M |	\
+				 V4L2_STD_NTSC_M_JP)
+#define V4L2_STD_SECAM		(V4L2_STD_SECAM_B |	\
+				 V4L2_STD_SECAM_D |	\
+				 V4L2_STD_SECAM_G |	\
+				 V4L2_STD_SECAM_H |	\
+				 V4L2_STD_SECAM_K |	\
+				 V4L2_STD_SECAM_K1 |	\
+				 V4L2_STD_SECAM_L)
+#define V4L2_STD_525_60		(V4L2_STD_PAL_M |	\
+				 V4L2_STD_PAL_60 |	\
+				 V4L2_STD_NTSC)
+#define V4L2_STD_625_50		(V4L2_STD_PAL |		\
+				 V4L2_STD_PAL_N |	\
+				 V4L2_STD_PAL_Nc |	\
+				 V4L2_STD_SECAM)
+#define V4L2_STD_UNKNOWN	0
+#define V4L2_STD_ALL		(V4L2_STD_525_60 |	\
+				 V4L2_STD_625_50)
+
+/* Raw VBI format flags */
+#define V4L2_VBI_UNSYNC			0x0001
+#define V4L2_VBI_INTERLACED		0x0002
+
+/* Device capabilities */
+#define V4L2_CAP_VIDEO_CAPTURE		0x00000001
+#define V4L2_CAP_VIDEO_OUTPUT		0x00000002
+#define V4L2_CAP_VIDEO_OVERLAY		0x00000004
+#define V4L2_CAP_VBI_CAPTURE		0x00000010
+#define V4L2_CAP_VBI_OUTPUT		0x00000020
+#define V4L2_CAP_RDS_CAPTURE		0x00000100
+#define V4L2_CAP_TUNER			0x00010000
+#define V4L2_CAP_AUDIO			0x00020000
+#define V4L2_CAP_READWRITE		0x01000000
+#define V4L2_CAP_ASYNCIO		0x02000000
+#define V4L2_CAP_STREAMING		0x04000000
+#define V4L2_CAP_BITMASK	\
+	"\20\1VIDEO_CAPTURE\2VIDEO_OUTPUT\3VIDEO_OVERLAY"	\
+	"\5VBI_CAPTURE\6VBI_OUTPUT\10RDS_CAPTURE"		\
+	"\21TUNER\22AUDIO\31READWRITE"				\
+	"\32ASYNCIO\33STREAMING"
+
+/* Device ioctls -- try to keep them the same as Linux for compat_linux */
+#define VIDIOC_QUERYCAP		_IOR('V', 0, struct v4l2_capability)
+#define VIDIOC_RESERVED		_IO('V', 1)
+#define VIDIOC_ENUM_FMT		_IOWR('V', 2, struct v4l2_fmtdesc)
+#define VIDIOC_G_FMT		_IOWR('V', 4, struct v4l2_format)
+#define VIDIOC_S_FMT		_IOWR('V', 5, struct v4l2_format)
+/* 6 and 7 are VIDIOC_[SG]_COMP, which are unsupported */
+#define VIDIOC_REQBUFS		_IOWR('V', 8, struct v4l2_requestbuffers)
+#define VIDIOC_QUERYBUF		_IOWR('V', 9, struct v4l2_buffer)
+#define VIDIOC_G_FBUF		_IOR('V', 10, struct v4l2_framebuffer)
+#define VIDIOC_S_FBUF		_IOW('V', 11, struct v4l2_framebuffer)
+#define VIDIOC_OVERLAY		_IOW('V', 14, int)
+#define VIDIOC_QBUF		_IOWR('V', 15, struct v4l2_buffer)
+#define VIDIOC_DQBUF		_IOWR('V', 17, struct v4l2_buffer)
+#define VIDIOC_STREAMON		_IOW('V', 18, int)
+#define VIDIOC_STREAMOFF	_IOW('V', 19, int)
+#define VIDIOC_G_PARM		_IOWR('V', 21, struct v4l2_streamparm)
+#define VIDIOC_S_PARM		_IOWR('V', 22, struct v4l2_streamparm)
+#define VIDIOC_G_STD		_IOR('V', 23, v4l2_std_id)
+#define VIDIOC_S_STD		_IOW('V', 24, v4l2_std_id)
+#define VIDIOC_ENUMSTD		_IOWR('V', 25, struct v4l2_standard)
+#define VIDIOC_ENUMINPUT	_IOWR('V', 26, struct v4l2_input)
+#define VIDIOC_G_CTRL		_IOWR('V', 27, struct v4l2_control)
+#define VIDIOC_S_CTRL		_IOWR('V', 28, struct v4l2_control)
+#define VIDIOC_G_TUNER		_IOWR('V', 29, struct v4l2_tuner)
+#define VIDIOC_S_TUNER		_IOW('V', 30, struct v4l2_tuner)
+#define VIDIOC_G_AUDIO		_IOR('V', 33, struct v4l2_audio)
+#define VIDIOC_S_AUDIO		_IOW('V', 34, struct v4l2_audio)
+#define VIDIOC_QUERYCTRL	_IOWR('V', 36, struct v4l2_queryctrl)
+#define VIDIOC_QUERYMENU	_IOWR('V', 37, struct v4l2_querymenu)
+#define VIDIOC_G_INPUT		_IOR('V', 38, int)
+#define VIDIOC_S_INPUT		_IOWR('V', 39, int)
+#define VIDIOC_G_OUTPUT		_IOR('V', 46, int)
+#define VIDIOC_S_OUTPUT		_IOWR('V', 47, int)
+#define VIDIOC_ENUMOUTPUT	_IOWR('V', 48, struct v4l2_output)
+#define VIDIOC_G_AUDOUT		_IOR('V', 49, struct v4l2_audioout)
+#define VIDIOC_S_AUDOUT		_IOW('V', 50, struct v4l2_audioout)
+#define VIDIOC_G_MODULATOR	_IOWR('V', 54, struct v4l2_modulator)
+#define VIDIOC_S_MODULATOR	_IOW('V', 55, struct v4l2_modulator)
+#define VIDIOC_G_FREQUENCY	_IOWR('V', 56, struct v4l2_frequency)
+#define VIDIOC_S_FREQUENCY	_IOW('V', 57, struct v4l2_frequency)
+#define VIDIOC_CROPCAP		_IOWR('V', 58, struct v4l2_cropcap)
+#define VIDIOC_G_CROP		_IOWR('V', 59, struct v4l2_crop)
+#define VIDIOC_S_CROP		_IOW('V', 60, struct v4l2_crop)
+#define VIDIOC_G_JPEGCOMP	_IOR('V', 61, struct v4l2_jpegcompression)
+#define VIDIOC_S_JPEGCOMP	_IOW('V', 62, struct v4l2_jpegcompression)
+#define VIDIOC_QUERYSTD		_IOR('V', 63, v4l2_std_id)
+#define VIDIOC_TRY_FMT		_IOWR('V', 64, struct v4l2_format)
+#define VIDIOC_ENUMAUDIO	_IOWR('V', 65, struct v4l2_audio)
+#define VIDIOC_ENUMAUDOUT	_IOWR('V', 66, struct v4l2_audioout)
+#define VIDIOC_G_PRIORITY	_IOR('V', 67, enum v4l2_priority)
+#define VIDIOC_S_PRIORITY	_IOW('V', 68, enum v4l2_priority)
+
+#ifdef _KERNEL
+#define VIDIOC_QUERYBUF50	_IOWR('V', 9, struct v4l2_buffer50)
+#define VIDIOC_QBUF50		_IOWR('V', 15, struct v4l2_buffer50)
+#define VIDIOC_DQBUF50		_IOWR('V', 17, struct v4l2_buffer50)
+#endif
+
+#endif /* !_HAVE_SYS_VIDEOIO_H */

Property changes on: lab4/.minix-src/include/sys/videoio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/wait.h
===================================================================
--- lab4/.minix-src/include/sys/wait.h	(nonexistent)
+++ lab4/.minix-src/include/sys/wait.h	(revision 13)
@@ -0,0 +1,186 @@
+/*	$NetBSD: wait.h,v 1.26 2009/01/11 02:45:56 christos Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)wait.h	8.2 (Berkeley) 7/10/94
+ */
+
+#ifndef _SYS_WAIT_H_
+#define _SYS_WAIT_H_
+
+#include <sys/featuretest.h>
+
+/*
+ * This file holds definitions relevent to the wait4 system call
+ * and the alternate interfaces that use it (wait, wait3, waitpid).
+ */
+
+/*
+ * Macros to test the exit status returned by wait
+ * and extract the relevant values.
+ */
+#if !( defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) ) || defined(_KERNEL)
+#define	_W_INT(i)	(i)
+#else
+#define	_W_INT(w)	(*(int *)(void *)&(w))	/* convert union wait to int */
+#endif
+
+#define	_WSTATUS(x)	(_W_INT(x) & 0177)
+#define	_WSTOPPED	0177		/* _WSTATUS if process is stopped */
+#define WIFSTOPPED(x)	(_WSTATUS(x) == _WSTOPPED)
+#define WSTOPSIG(x)	((int)(((unsigned int)_W_INT(x)) >> 8) & 0xff)
+#define WIFSIGNALED(x)	(_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0)
+#define WTERMSIG(x)	(_WSTATUS(x))
+#define WIFEXITED(x)	(_WSTATUS(x) == 0)
+#define WEXITSTATUS(x)	((int)(((unsigned int)_W_INT(x)) >> 8) & 0xff)
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) || defined(_KERNEL)
+#define	WCOREFLAG	0200
+#define WCOREDUMP(x)	(_W_INT(x) & WCOREFLAG)
+
+#define	W_EXITCODE(ret, sig)	((ret) << 8 | (sig))
+#define	W_STOPCODE(sig)		((sig) << 8 | _WSTOPPED)
+#endif
+
+/*
+ * Option bits for the third argument of wait4.  WNOHANG causes the
+ * wait to not hang if there are no stopped or terminated processes, rather
+ * returning an error indication in this case (pid==0).  WUNTRACED
+ * indicates that the caller should receive status about untraced children
+ * which stop due to signals.  If children are stopped and a wait without
+ * this option is done, it is as though they were still running... nothing
+ * about them is returned.
+ */
+#define WNOHANG		0x00000001	/* don't hang in wait */
+#define WUNTRACED	0x00000002	/* tell about stopped,
+					   untraced children */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define	WALTSIG		0x00000004	/* wait for processes that exit
+					   with an alternate signal (i.e.
+					   not SIGCHLD) */
+#define	WALLSIG		0x00000008	/* wait for processes that exit
+					   with any signal, i.e. SIGCHLD
+					   and alternates */
+
+/*
+ * These are the Linux names of some of the above flags, for compatibility
+ * with Linux's clone(2) API.
+ */
+#define	__WCLONE	WALTSIG
+#define	__WALL		WALLSIG
+
+/*
+ * These bits are used in order to support SVR4 (etc) functionality
+ * without replicating sys_wait4 5 times.
+ */
+#define	WNOWAIT		0x00010000	/* Don't mark child 'P_WAITED' */
+#define	WNOZOMBIE	0x00020000	/* Ignore zombies */
+#define	WOPTSCHECKED	0x00040000	/* Compat call, options verified */
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+/* POSIX extensions and 4.2/4.3 compatibility: */
+
+/*
+ * Tokens for special values of the "pid" parameter to wait4.
+ */
+#define	WAIT_ANY	(-1)	/* any process */
+#define	WAIT_MYPGRP	0	/* any process in my process group */
+
+#include <sys/types.h>
+
+/*
+ * Deprecated:
+ * Structure of the information in the status word returned by wait4.
+ * If w_stopval==WSTOPPED, then the second structure describes
+ * the information returned, else the first.
+ */
+union wait {
+	int	w_status;		/* used in syscall */
+	/*
+	 * Terminated process status.
+	 */
+	struct {
+#if BYTE_ORDER == LITTLE_ENDIAN
+		unsigned int	w_Termsig:7,	/* termination signal */
+				w_Coredump:1,	/* core dump indicator */
+				w_Retcode:8,	/* exit code if w_termsig==0 */
+				w_Filler:16;	/* upper bits filler */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+		unsigned int	w_Filler:16,	/* upper bits filler */
+				w_Retcode:8,	/* exit code if w_termsig==0 */
+				w_Coredump:1,	/* core dump indicator */
+				w_Termsig:7;	/* termination signal */
+#endif
+	} w_T;
+	/*
+	 * Stopped process status.  Returned
+	 * only for traced children unless requested
+	 * with the WUNTRACED option bit.
+	 */
+	struct {
+#if BYTE_ORDER == LITTLE_ENDIAN
+		unsigned int	w_Stopval:8,	/* == W_STOPPED if stopped */
+				w_Stopsig:8,	/* signal that stopped us */
+				w_Filler:16;	/* upper bits filler */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+		unsigned int	w_Filler:16,	/* upper bits filler */
+				w_Stopsig:8,	/* signal that stopped us */
+				w_Stopval:8;	/* == W_STOPPED if stopped */
+#endif
+	} w_S;
+};
+#define	w_termsig	w_T.w_Termsig
+#define w_coredump	w_T.w_Coredump
+#define w_retcode	w_T.w_Retcode
+#define w_stopval	w_S.w_Stopval
+#define w_stopsig	w_S.w_Stopsig
+
+#define	WSTOPPED	_WSTOPPED
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+struct rusage;	/* forward declaration */
+
+pid_t	wait(int *);
+pid_t	waitpid(pid_t, int *, int);
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+pid_t	wait3(int *, int, struct rusage *) __RENAME(__wait350);
+pid_t	wait4(pid_t, int *, int, struct rusage *) __RENAME(__wait450);
+#endif
+#endif
+__END_DECLS
+#endif
+
+#endif /* !_SYS_WAIT_H_ */

Property changes on: lab4/.minix-src/include/sys/wait.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/uio.h
===================================================================
--- lab4/.minix-src/include/sys/uio.h	(nonexistent)
+++ lab4/.minix-src/include/sys/uio.h	(revision 13)
@@ -0,0 +1,123 @@
+/*	$NetBSD: uio.h,v 1.36 2011/07/27 13:20:07 uebayasi Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)uio.h	8.5 (Berkeley) 2/22/94
+ */
+
+#ifndef _SYS_UIO_H_
+#define	_SYS_UIO_H_
+
+#ifdef _KERNEL
+#ifndef __UIO_EXPOSE
+#define __UIO_EXPOSE
+#endif
+#endif
+
+#include <machine/ansi.h>
+#include <sys/featuretest.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#ifdef	_BSD_SSIZE_T_
+typedef	_BSD_SSIZE_T_	ssize_t;
+#undef	_BSD_SSIZE_T_
+#endif
+
+struct iovec {
+	void	*iov_base;	/* Base address. */
+	size_t	 iov_len;	/* Length. */
+};
+
+#if defined(_NETBSD_SOURCE)
+#include <sys/ansi.h>
+
+#ifndef	off_t
+typedef	__off_t		off_t;	/* file offset */
+#define	off_t		__off_t
+#endif
+
+enum	uio_rw { UIO_READ, UIO_WRITE };
+
+/* Segment flag values. */
+enum uio_seg {
+	UIO_USERSPACE,		/* from user data space */
+	UIO_SYSSPACE		/* from system space */
+};
+
+#ifdef __UIO_EXPOSE
+
+struct vmspace;
+
+struct uio {
+	struct	iovec *uio_iov;	/* pointer to array of iovecs */
+	int	uio_iovcnt;	/* number of iovecs in array */
+	off_t	uio_offset;	/* offset into file this uio corresponds to */
+	size_t	uio_resid;	/* residual i/o count */
+	enum	uio_rw uio_rw;	/* see above */
+	struct	vmspace *uio_vmspace;
+};
+#define	UIO_SETUP_SYSSPACE(uio)	uio_setup_sysspace(uio)
+
+#endif /* __UIO_EXPOSE */
+
+/*
+ * Limits
+ */
+/* Deprecated: use IOV_MAX from <limits.h> instead. */
+#define UIO_MAXIOV	1024		/* max 1K of iov's */
+#endif /* _NETBSD_SOURCE */
+
+#ifdef _KERNEL
+
+/* 8 on stack, more will be dynamically allocated. */
+#define UIO_SMALLIOV	8
+
+void uio_setup_sysspace(struct uio *);
+#endif
+
+#ifndef	_KERNEL
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#if defined(_NETBSD_SOURCE)
+ssize_t preadv(int, const struct iovec *, int, off_t);
+ssize_t pwritev(int, const struct iovec *, int, off_t);
+#endif /* _NETBSD_SOURCE */
+ssize_t	readv(int, const struct iovec *, int);
+ssize_t	writev(int, const struct iovec *, int);
+__END_DECLS
+#else
+int ureadc(int, struct uio *);
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_UIO_H_ */

Property changes on: lab4/.minix-src/include/sys/uio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/user.h
===================================================================
--- lab4/.minix-src/include/sys/user.h	(nonexistent)
+++ lab4/.minix-src/include/sys/user.h	(revision 13)
@@ -0,0 +1,41 @@
+/*	$NetBSD: user.h,v 1.19 2014/02/19 20:40:40 dsl Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)user.h	8.2 (Berkeley) 9/23/93
+ */
+
+#ifndef _SYS_USER_H_
+#define _SYS_USER_H_
+
+#ifdef _KERNEL
+#error "This header has been obsoleted and will be removed."
+#endif
+
+#endif /* !_SYS_USER_H_ */

Property changes on: lab4/.minix-src/include/sys/user.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/verified_exec.h
===================================================================
--- lab4/.minix-src/include/sys/verified_exec.h	(nonexistent)
+++ lab4/.minix-src/include/sys/verified_exec.h	(revision 13)
@@ -0,0 +1,132 @@
+/*	$NetBSD: verified_exec.h,v 1.58 2010/11/19 06:44:34 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
+ * Copyright (c) 2005, 2006 Brett Lymn <blymn@NetBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the authors may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_VERIFIED_EXEC_H_
+#define _SYS_VERIFIED_EXEC_H_
+
+#include <sys/ioccom.h>
+
+#if defined(_KERNEL) && !defined(HAVE_NBTOOL_CONFIG_H)
+#include <sys/types.h>
+#include <prop/proplib.h>
+
+struct mount;
+struct vnode;
+
+#ifdef notyet
+struct vm_page;
+#endif /* notyet */
+#endif /* _KERNEL */
+
+/* Flags for a Veriexec entry. These can be OR'd together. */
+#define VERIEXEC_DIRECT		0x01 /* Direct execution (exec) */
+#define VERIEXEC_INDIRECT	0x02 /* Indirect execution (#!) */
+#define VERIEXEC_FILE		0x04 /* Plain file (open) */
+#define	VERIEXEC_UNTRUSTED	0x10 /* Untrusted storage */
+
+/* Operations for the Veriexec pseudo-device. */
+#define VERIEXEC_LOAD		_IOW('X',  0x1, struct plistref)
+#define VERIEXEC_TABLESIZE	_IOW('X',  0x2, struct plistref)
+#define VERIEXEC_DELETE		_IOW('X',  0x3, struct plistref)
+#define VERIEXEC_QUERY		_IOWR('X', 0x4, struct plistref)
+#define	VERIEXEC_DUMP		_IOR('X', 0x5, struct plistref)
+#define	VERIEXEC_FLUSH		_IO('X', 0x6)
+
+/* Veriexec modes (strict levels). */
+#define	VERIEXEC_LEARNING	0	/* Learning mode. */
+#define	VERIEXEC_IDS		1	/* Intrusion detection mode. */
+#define	VERIEXEC_IPS		2	/* Intrusion prevention mode. */
+#define	VERIEXEC_LOCKDOWN	3	/* Lockdown mode. */
+
+/* Valid status field values. */
+#define FINGERPRINT_NOTEVAL  0  /* fingerprint has not been evaluated */
+#define FINGERPRINT_VALID    1  /* fingerprint evaluated and matches list */
+#define FINGERPRINT_NOMATCH  2  /* fingerprint evaluated but does not match */
+
+/* Per-page fingerprint status. */
+#define	PAGE_FP_NONE	0	/* no per-page fingerprints. */
+#define	PAGE_FP_READY	1	/* per-page fingerprints ready for use. */
+#define	PAGE_FP_FAIL	2	/* mismatch in per-page fingerprints. */
+
+#if defined(_KERNEL) && !defined(HAVE_NBTOOL_CONFIG_H)
+
+#if NVERIEXEC > 0
+/* FUTURE: remove this macro entirely - dholland 20100215 */
+#define VERIEXEC_PATH_GET(from, cto, to) \
+	do { \
+			to = NULL; \
+			cto = from; \
+		} \
+	} while (/*CONSTCOND*/0)
+#define VERIEXEC_PATH_PUT(to) \
+	do { \
+		(void)(to); \
+	} while (/*CONSTCOND*/0)
+#else
+#define VERIEXEC_PATH_GET(from, cto, to) \
+	cto = from
+#define VERIEXEC_PATH_PUT(to) \
+	(void)to
+	
+#endif
+
+/*
+ * Fingerprint operations vector for Veriexec.
+ * Function types: init, update, final.
+ */
+typedef void (*veriexec_fpop_init_t)(void *);
+typedef void (*veriexec_fpop_update_t)(void *, u_char *, u_int);
+typedef void (*veriexec_fpop_final_t)(u_char *, void *);
+
+void veriexec_init(void);
+int veriexec_fpops_add(const char *, size_t, size_t, veriexec_fpop_init_t,
+    veriexec_fpop_update_t, veriexec_fpop_final_t);
+int veriexec_file_add(struct lwp *, prop_dictionary_t);
+int veriexec_verify(struct lwp *, struct vnode *, const u_char *, int,
+    bool *);
+#ifdef notyet
+int veriexec_page_verify(struct veriexec_file_entry *, struct vm_page *,
+    size_t, struct lwp *);
+#endif /* notyet */
+bool veriexec_lookup(struct vnode *);
+int veriexec_file_delete(struct lwp *, struct vnode *);
+int veriexec_table_delete(struct lwp *, struct mount *);
+int veriexec_convert(struct vnode *, prop_dictionary_t);
+int veriexec_dump(struct lwp *, prop_array_t);
+int veriexec_flush(struct lwp *);
+void veriexec_purge(struct vnode *);
+int veriexec_removechk(struct lwp *, struct vnode *, const char *);
+int veriexec_renamechk(struct lwp *, struct vnode *, const char *,
+    struct vnode *, const char *);
+int veriexec_unmountchk(struct mount *);
+int veriexec_openchk(struct lwp *, struct vnode *, const char *, int);
+#endif /* _KERNEL */
+
+#endif /* !_SYS_VERIFIED_EXEC_H_ */

Property changes on: lab4/.minix-src/include/sys/verified_exec.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/vnode.h
===================================================================
--- lab4/.minix-src/include/sys/vnode.h	(nonexistent)
+++ lab4/.minix-src/include/sys/vnode.h	(revision 13)
@@ -0,0 +1,605 @@
+/*	$NetBSD: vnode.h,v 1.256 2015/07/12 08:11:28 hannken Exp $	*/
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vnode.h	8.17 (Berkeley) 5/20/95
+ */
+
+#ifndef _SYS_VNODE_H_
+#define	_SYS_VNODE_H_
+
+#include <sys/event.h>
+#include <sys/queue.h>
+#include <sys/condvar.h>
+#include <sys/rwlock.h>
+#include <sys/mutex.h>
+
+/* XXX: clean up includes later */
+#include <uvm/uvm_param.h>	/* XXX */
+#include <uvm/uvm_pglist.h>	/* XXX */
+#include <uvm/uvm_object.h>	/* XXX */
+#include <uvm/uvm_extern.h>	/* XXX */
+
+struct namecache;
+struct uvm_ractx;
+
+/*
+ * The vnode is the focus of all file activity in UNIX.  There is a
+ * unique vnode allocated for each active file, each current directory,
+ * each mounted-on file, text file, and the root.
+ */
+
+/*
+ * Vnode types.  VNON means no type.
+ */
+enum vtype	{ VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
+
+#define	VNODE_TYPES \
+    "VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD"
+
+/*
+ * Vnode tag types.
+ * These are for the benefit of external programs only (e.g., pstat)
+ * and should NEVER be inspected by the kernel.
+ */
+enum vtagtype	{
+	VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_MSDOSFS, VT_LFS, VT_LOFS,
+	VT_FDESC, VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS,
+	VT_AFS, VT_ISOFS, VT_UNION, VT_ADOSFS, VT_EXT2FS, VT_CODA,
+	VT_FILECORE, VT_NTFS, VT_VFS, VT_OVERLAY, VT_SMBFS, VT_PTYFS,
+	VT_TMPFS, VT_UDF, VT_SYSVBFS, VT_PUFFS, VT_HFS, VT_EFS, VT_ZFS,
+	VT_RUMP, VT_NILFS, VT_V7FS, VT_CHFS
+};
+
+#define	VNODE_TAGS \
+    "VT_NON", "VT_UFS", "VT_NFS", "VT_MFS", "VT_MSDOSFS", "VT_LFS", "VT_LOFS", \
+    "VT_FDESC", "VT_PORTAL", "VT_NULL", "VT_UMAP", "VT_KERNFS", "VT_PROCFS", \
+    "VT_AFS", "VT_ISOFS", "VT_UNION", "VT_ADOSFS", "VT_EXT2FS", "VT_CODA", \
+    "VT_FILECORE", "VT_NTFS", "VT_VFS", "VT_OVERLAY", "VT_SMBFS", "VT_PTYFS", \
+    "VT_TMPFS", "VT_UDF", "VT_SYSVBFS", "VT_PUFFS", "VT_HFS", "VT_EFS", \
+    "VT_ZFS", "VT_RUMP", "VT_NILFS", "VT_V7FS", "VT_CHFS"
+
+struct vnode;
+struct buf;
+
+LIST_HEAD(buflists, buf);
+TAILQ_HEAD(vnodelst, vnode);
+
+/*
+ * Reading or writing any of these items requires holding the appropriate
+ * lock.  Field markings and the corresponding locks:
+ *
+ *	:	stable, reference to the vnode is required
+ *	f	vnode_free_list_lock, or vrele_lock for vrele_list
+ *	i	v_interlock
+ *	m	mntvnode_lock
+ *	n	namecache_lock
+ *	s	syncer_data_lock
+ *	u	locked by underlying filesystem
+ *	v	vnode lock
+ *	x	v_interlock + bufcache_lock to modify, either to inspect
+ *
+ * Each underlying filesystem allocates its own private area and hangs
+ * it from v_data.
+ */
+struct vnode {
+	struct uvm_object v_uobj;		/* i: the VM object */
+	kcondvar_t	v_cv;			/* i: synchronization */
+	voff_t		v_size;			/* i: size of file */
+	voff_t		v_writesize;		/* i: new size after write */
+	int		v_iflag;		/* i: VI_* flags */
+	int		v_vflag;		/* v: VV_* flags */
+	int		v_uflag;		/* u: VU_* flags */
+	int		v_numoutput;		/* i: # of pending writes */
+	int		v_writecount;		/* i: ref count of writers */
+	int		v_holdcnt;		/* i: page & buffer refs */
+	int		v_synclist_slot;	/* s: synclist slot index */
+	struct mount	*v_mount;		/* v: ptr to vfs we are in */
+	int		(**v_op)(void *);	/* :: vnode operations vector */
+	TAILQ_ENTRY(vnode) v_freelist;		/* f: vnode freelist */
+	struct vnodelst	*v_freelisthd;		/* f: which freelist? */
+	TAILQ_ENTRY(vnode) v_mntvnodes;		/* m: vnodes for mount point */
+	struct buflists	v_cleanblkhd;		/* x: clean blocklist head */
+	struct buflists	v_dirtyblkhd;		/* x: dirty blocklist head */
+	TAILQ_ENTRY(vnode) v_synclist;		/* s: vnodes with dirty bufs */
+	LIST_HEAD(, namecache) v_dnclist;	/* n: namecaches (children) */
+	LIST_HEAD(, namecache) v_nclist;	/* n: namecaches (parent) */
+	union {
+		struct mount	*vu_mountedhere;/* v: ptr to vfs (VDIR) */
+		struct socket	*vu_socket;	/* v: unix ipc (VSOCK) */
+		struct specnode	*vu_specnode;	/* v: device (VCHR, VBLK) */
+		struct fifoinfo	*vu_fifoinfo;	/* v: fifo (VFIFO) */
+		struct uvm_ractx *vu_ractx;	/* i: read-ahead ctx (VREG) */
+	} v_un;
+	enum vtype	v_type;			/* :: vnode type */
+	enum vtagtype	v_tag;			/* :: type of underlying data */
+	krwlock_t	v_lock;			/* v: lock for this vnode */
+	void 		*v_data;		/* :: private data for fs */
+	struct klist	v_klist;		/* i: notes attached to vnode */
+};
+#define	v_usecount	v_uobj.uo_refs
+#define	v_interlock	v_uobj.vmobjlock
+#define	v_mountedhere	v_un.vu_mountedhere
+#define	v_socket	v_un.vu_socket
+#define	v_specnode	v_un.vu_specnode
+#define	v_fifoinfo	v_un.vu_fifoinfo
+#define	v_ractx		v_un.vu_ractx
+
+typedef struct vnodelst vnodelst_t;
+typedef struct vnode vnode_t;
+
+/*
+ * Vnode flags.  The first set are locked by vnode lock or are stable.
+ * VSYSTEM is only used to skip vflush()ing quota files.  VISTTY is used
+ * when reading dead vnodes.
+ */
+#define	VV_ROOT		0x00000001	/* root of its file system */
+#define	VV_SYSTEM	0x00000002	/* vnode being used by kernel */
+#define	VV_ISTTY	0x00000004	/* vnode represents a tty */
+#define	VV_MAPPED	0x00000008	/* vnode might have user mappings */
+#define	VV_MPSAFE	0x00000010	/* file system code is MP safe */
+#define	VV_LOCKSWORK	0x00000020	/* FS supports locking discipline */
+
+/*
+ * The second set are locked by vp->v_interlock.
+ */
+#define	VI_TEXT		0x00000100	/* vnode is a pure text prototype */
+#define	VI_EXECMAP	0x00000200	/* might have PROT_EXEC mappings */
+#define	VI_WRMAP	0x00000400	/* might have PROT_WRITE u. mappings */
+#define	VI_WRMAPDIRTY	0x00000800	/* might have dirty pages */
+#ifdef _VFS_VNODE_PRIVATE
+#define	VI_XLOCK	0x00001000	/* vnode is locked to change type */
+#endif	/* _VFS_VNODE_PRIVATE */
+#define	VI_ONWORKLST	0x00004000	/* On syncer work-list */
+#ifdef _VFS_VNODE_PRIVATE
+#define	VI_MARKER	0x00008000	/* Dummy marker vnode */
+#endif	/* _VFS_VNODE_PRIVATE */
+#ifdef _VFS_VNODE_PRIVATE
+#define	VI_CLEAN	0x00080000	/* has been reclaimed */
+#define	VI_CHANGING	0x00100000	/* vnode changes state */
+#endif	/* _VFS_VNODE_PRIVATE */
+
+/*
+ * The third set are locked by the underlying file system.
+ */
+#define	VU_DIROP	0x01000000	/* LFS: involved in a directory op */
+
+#define	VNODE_FLAGBITS \
+    "\20\1ROOT\2SYSTEM\3ISTTY\4MAPPED\5MPSAFE\6LOCKSWORK\11TEXT\12EXECMAP" \
+    "\13WRMAP\14WRMAPDIRTY\15XLOCK\17ONWORKLST\20MARKER" \
+    "\24CLEAN\25CHANGING\31DIROP"
+
+#define	VSIZENOTSET	((voff_t)-1)
+
+/*
+ * vnode lock flags
+ */
+#define	LK_SHARED	0x00000001	/* shared lock */
+#define	LK_EXCLUSIVE	0x00000002	/* exclusive lock */
+#define	LK_NOWAIT	0x00000010	/* do not sleep to await lock */
+#define	LK_RETRY	0x00020000	/* vn_lock: retry until locked */
+
+/*
+ * Vnode attributes.  A field value of VNOVAL represents a field whose value
+ * is unavailable (getattr) or which is not to be changed (setattr).
+ */
+struct vattr {
+	enum vtype	va_type;	/* vnode type (for create) */
+	mode_t		va_mode;	/* files access mode and type */
+	nlink_t		va_nlink;	/* number of references to file */
+	uid_t		va_uid;		/* owner user id */
+	gid_t		va_gid;		/* owner group id */
+	dev_t		va_fsid;	/* file system id (dev for now) */
+	ino_t		va_fileid;	/* file id */
+	u_quad_t	va_size;	/* file size in bytes */
+	long		va_blocksize;	/* blocksize preferred for i/o */
+	struct timespec	va_atime;	/* time of last access */
+	struct timespec	va_mtime;	/* time of last modification */
+	struct timespec	va_ctime;	/* time file changed */
+	struct timespec va_birthtime;	/* time file created */
+	u_long		va_gen;		/* generation number of file */
+	u_long		va_flags;	/* flags defined for file */
+	dev_t		va_rdev;	/* device the special file represents */
+	u_quad_t	va_bytes;	/* bytes of disk space held by file */
+	u_quad_t	va_filerev;	/* file modification number */
+	u_int		va_vaflags;	/* operations flags, see below */
+	long		va_spare;	/* remain quad aligned */
+};
+
+/*
+ * Flags for va_vaflags.
+ */
+#define	VA_UTIMES_NULL	0x01		/* utimes argument was NULL */
+#define	VA_EXCLUSIVE	0x02		/* exclusive create request */
+
+#ifdef _KERNEL
+
+/*
+ * Flags for ioflag.
+ */
+#define	IO_UNIT		0x00010		/* do I/O as atomic unit */
+#define	IO_APPEND	0x00020		/* append write to end */
+#define	IO_SYNC		(0x40|IO_DSYNC)	/* sync I/O file integrity completion */
+#define	IO_NODELOCKED	0x00080		/* underlying node already locked */
+#define	IO_NDELAY	0x00100		/* FNDELAY flag set in file table */
+#define	IO_DSYNC	0x00200		/* sync I/O data integrity completion */
+#define	IO_ALTSEMANTICS	0x00400		/* use alternate i/o semantics */
+#define	IO_NORMAL	0x00800		/* operate on regular data */
+#define	IO_EXT		0x01000		/* operate on extended attributes */
+#define	IO_DIRECT	0x02000		/* direct I/O hint */
+#define	IO_JOURNALLOCKED 0x04000	/* journal is already locked */
+#define	IO_ADV_MASK	0x00003		/* access pattern hint */
+
+#define	IO_ADV_SHIFT	0
+#define	IO_ADV_ENCODE(adv)	(((adv) << IO_ADV_SHIFT) & IO_ADV_MASK)
+#define	IO_ADV_DECODE(ioflag)	(((ioflag) & IO_ADV_MASK) >> IO_ADV_SHIFT)
+
+/*
+ *  Modes.
+ */
+#define	VREAD	00004		/* read, write, execute permissions */
+#define	VWRITE	00002
+#define	VEXEC	00001
+
+/*
+ * Token indicating no attribute value yet assigned.
+ */
+#define	VNOVAL	(-1)
+
+/*
+ * Convert between vnode types and inode formats (since POSIX.1
+ * defines mode word of stat structure in terms of inode formats).
+ */
+extern const enum vtype	iftovt_tab[];
+extern const int	vttoif_tab[];
+#define	IFTOVT(mode)	(iftovt_tab[((mode) & S_IFMT) >> 12])
+#define	VTTOIF(indx)	(vttoif_tab[(int)(indx)])
+#define	MAKEIMODE(indx, mode)	(int)(VTTOIF(indx) | (mode))
+
+/*
+ * Flags to various vnode functions.
+ */
+#define	SKIPSYSTEM	0x0001		/* vflush: skip vnodes marked VSYSTEM */
+#define	FORCECLOSE	0x0002		/* vflush: force file closeure */
+#define	WRITECLOSE	0x0004		/* vflush: only close writable files */
+#define	V_SAVE		0x0001		/* vinvalbuf: sync file first */
+
+/*
+ * Flags to various vnode operations.
+ */
+#define	REVOKEALL	0x0001		/* revoke: revoke all aliases */
+
+#define	FSYNC_WAIT	0x0001		/* fsync: wait for completion */
+#define	FSYNC_DATAONLY	0x0002		/* fsync: hint: sync file data only */
+#define	FSYNC_RECLAIM	0x0004		/* fsync: hint: vnode is being reclaimed */
+#define	FSYNC_LAZY	0x0008		/* fsync: lazy sync (trickle) */
+#define	FSYNC_NOLOG	0x0010		/* fsync: do not flush the log */
+#define	FSYNC_CACHE	0x0100		/* fsync: flush disk caches too */
+
+#define	UPDATE_WAIT	0x0001		/* update: wait for completion */
+#define	UPDATE_DIROP	0x0002		/* update: hint to fs to wait or not */
+#define	UPDATE_CLOSE	0x0004		/* update: clean up on close */
+
+#define VDEAD_NOWAIT	0x0001		/* vdead_check: do not sleep */
+
+void holdrelel(struct vnode *);
+void vholdl(struct vnode *);
+void vref(struct vnode *);
+
+static __inline void holdrele(struct vnode *) __unused;
+static __inline void vhold(struct vnode *) __unused;
+
+/*
+ * decrease buf or page ref
+ */
+static __inline void
+holdrele(struct vnode *vp)
+{
+
+	mutex_enter(vp->v_interlock);
+	holdrelel(vp);
+	mutex_exit(vp->v_interlock);
+}
+
+/*
+ * increase buf or page ref
+ */
+static __inline void
+vhold(struct vnode *vp)
+{
+
+	mutex_enter(vp->v_interlock);
+	vholdl(vp);
+	mutex_exit(vp->v_interlock);
+}
+
+#define	NULLVP	((struct vnode *)NULL)
+
+static __inline void
+VN_KNOTE(struct vnode *vp, long hint)
+{
+
+	mutex_enter(vp->v_interlock);
+	KNOTE(&vp->v_klist, hint);
+	mutex_exit(vp->v_interlock);
+}
+
+/*
+ * Global vnode data.
+ */
+extern struct vnode	*rootvnode;	/* root (i.e. "/") vnode */
+extern int		desiredvnodes;	/* number of vnodes desired */
+extern u_int		numvnodes;	/* current number of vnodes */
+
+#endif /* _KERNEL */
+
+
+/*
+ * Mods for exensibility.
+ */
+
+/*
+ * Flags for vdesc_flags:
+ */
+#define	VDESC_MAX_VPS		8
+/* Low order 16 flag bits are reserved for willrele flags for vp arguments. */
+#define	VDESC_VP0_WILLRELE	0x00000001
+#define	VDESC_VP1_WILLRELE	0x00000002
+#define	VDESC_VP2_WILLRELE	0x00000004
+#define	VDESC_VP3_WILLRELE	0x00000008
+#define	VDESC_VP0_WILLUNLOCK	0x00000100
+#define	VDESC_VP1_WILLUNLOCK	0x00000200
+#define	VDESC_VP2_WILLUNLOCK	0x00000400
+#define	VDESC_VP3_WILLUNLOCK	0x00000800
+#define	VDESC_VP0_WILLPUT	0x00000101
+#define	VDESC_VP1_WILLPUT	0x00000202
+#define	VDESC_VP2_WILLPUT	0x00000404
+#define	VDESC_VP3_WILLPUT	0x00000808
+
+/*
+ * VDESC_NO_OFFSET is used to identify the end of the offset list
+ * and in places where no such field exists.
+ */
+#define	VDESC_NO_OFFSET -1
+
+/*
+ * This structure describes the vnode operation taking place.
+ */
+struct vnodeop_desc {
+	int		vdesc_offset;	/* offset in vector--first for speed */
+	const char	*vdesc_name;	/* a readable name for debugging */
+	int		vdesc_flags;	/* VDESC_* flags */
+
+	/*
+	 * These ops are used by bypass routines to map and locate arguments.
+	 * Creds and procs are not needed in bypass routines, but sometimes
+	 * they are useful to (for example) transport layers.
+	 * Nameidata is useful because it has a cred in it.
+	 */
+	const int	*vdesc_vp_offsets;	/* list ended by VDESC_NO_OFFSET */
+	int		vdesc_vpp_offset;	/* return vpp location */
+	int		vdesc_cred_offset;	/* cred location, if any */
+	int		vdesc_componentname_offset; /* if any */
+};
+
+#ifdef _KERNEL
+
+/*
+ * Interlock for scanning list of vnodes attached to a mountpoint
+ */
+extern kmutex_t		mntvnode_lock;
+
+/*
+ * Union filesystem hook for vn_readdir().
+ */
+extern int (*vn_union_readdir_hook) (struct vnode **, struct file *, struct lwp *);
+
+/*
+ * Macros for offsets in the vdesc struct.
+ */
+#define	VOPARG_OFFSETOF(type, member)	offsetof(type, member)
+#define	VOPARG_OFFSETTO(type,offset,sp)	((type)(((char *)(sp)) + (offset)))
+
+/*
+ * This structure is used to configure the new vnodeops vector.
+ */
+struct vnodeopv_entry_desc {
+	const struct vnodeop_desc *opve_op;	/* which operation this is */
+	int (*opve_impl)(void *);	/* code implementing this operation */
+};
+
+struct vnodeopv_desc {
+			/* ptr to the ptr to the vector where op should go */
+	int (***opv_desc_vector_p)(void *);
+	const struct vnodeopv_entry_desc *opv_desc_ops; /* null terminated list */
+};
+
+/*
+ * A default routine which just returns an error.
+ */
+int vn_default_error(void *);
+
+/*
+ * A generic structure.
+ * This can be used by bypass routines to identify generic arguments.
+ */
+struct vop_generic_args {
+	struct vnodeop_desc *a_desc;
+	/* other random data follows, presumably */
+};
+
+/*
+ * VOCALL calls an op given an ops vector.  We break it out because BSD's
+ * vclean changes the ops vector and then wants to call ops with the old
+ * vector.
+ */
+/*
+ * actually, vclean doesn't use it anymore, but nfs does,
+ * for device specials and fifos.
+ */
+#define	VOCALL(OPSV,OFF,AP) (( *((OPSV)[(OFF)])) (AP))
+
+/*
+ * This call works for vnodes in the kernel.
+ */
+#define	VCALL(VP,OFF,AP) VOCALL((VP)->v_op,(OFF),(AP))
+#define	VDESC(OP) (& __CONCAT(OP,_desc))
+#define	VOFFSET(OP) (VDESC(OP)->vdesc_offset)
+
+/* XXX This include should go away */
+#include <sys/mount.h>
+
+/*
+ * Finally, include the default set of vnode operations.
+ */
+#include <sys/vnode_if.h>
+
+/*
+ * Public vnode manipulation functions.
+ */
+struct file;
+struct filedesc;
+struct nameidata;
+struct proc;
+struct stat;
+struct uio;
+struct vattr;
+struct vnode;
+
+/* see vnode(9) */
+void	vfs_vnode_sysinit(void);
+int 	bdevvp(dev_t, struct vnode **);
+int 	cdevvp(dev_t, struct vnode **);
+int	vaccess(enum vtype, mode_t, uid_t, gid_t, mode_t, kauth_cred_t);
+void 	vattr_null(struct vattr *);
+void	vdevgone(int, int, int, enum vtype);
+int	vfinddev(dev_t, enum vtype, struct vnode **);
+int	vflush(struct mount *, struct vnode *, int);
+int	vflushbuf(struct vnode *, int);
+int 	vget(struct vnode *, int, bool);
+void 	vgone(struct vnode *);
+int	vinvalbuf(struct vnode *, int, kauth_cred_t, struct lwp *, bool, int);
+void	vprint(const char *, struct vnode *);
+void 	vput(struct vnode *);
+bool	vrecycle(struct vnode *);
+void 	vrele(struct vnode *);
+void 	vrele_async(struct vnode *);
+void	vrele_flush(void);
+int	vtruncbuf(struct vnode *, daddr_t, bool, int);
+void	vwakeup(struct buf *);
+int	vdead_check(struct vnode *, int);
+void	vrevoke(struct vnode *);
+struct vnode *
+	vnalloc(struct mount *);
+void	vnfree(struct vnode *);
+void	vremfree(struct vnode *);
+int	vcache_get(struct mount *, const void *, size_t, struct vnode **);
+int	vcache_new(struct mount *, struct vnode *,
+	    struct vattr *, kauth_cred_t, struct vnode **);
+int	vcache_rekey_enter(struct mount *, struct vnode *,
+	    const void *, size_t, const void *, size_t);
+void	vcache_rekey_exit(struct mount *, struct vnode *,
+	    const void *, size_t, const void *, size_t);
+void	vcache_remove(struct mount *, const void *, size_t);
+
+/* see vnsubr(9) */
+int	vn_bwrite(void *);
+int 	vn_close(struct vnode *, int, kauth_cred_t);
+int	vn_isunder(struct vnode *, struct vnode *, struct lwp *);
+int	vn_lock(struct vnode *, int);
+void	vn_markexec(struct vnode *);
+int	vn_marktext(struct vnode *);
+int 	vn_open(struct nameidata *, int, int);
+int 	vn_rdwr(enum uio_rw, struct vnode *, void *, int, off_t, enum uio_seg,
+    int, kauth_cred_t, size_t *, struct lwp *);
+int	vn_readdir(struct file *, char *, int, u_int, int *, struct lwp *,
+    off_t **, int *);
+int	vn_stat(struct vnode *, struct stat *);
+int	vn_kqfilter(struct file *, struct knote *);
+int	vn_writechk(struct vnode *);
+int	vn_openchk(struct vnode *, kauth_cred_t, int);
+int	vn_extattr_get(struct vnode *, int, int, const char *, size_t *,
+	    void *, struct lwp *);
+int	vn_extattr_set(struct vnode *, int, int, const char *, size_t,
+	    const void *, struct lwp *);
+int	vn_extattr_rm(struct vnode *, int, int, const char *, struct lwp *);
+void	vn_ra_allocctx(struct vnode *);
+int	vn_fifo_bypass(void *);
+
+/* initialise global vnode management */
+void	vntblinit(void);
+
+/* misc stuff */
+void	sched_sync(void *);
+void	vn_syncer_add_to_worklist(struct vnode *, int);
+void	vn_syncer_remove_from_worklist(struct vnode *);
+int	dorevoke(struct vnode *, kauth_cred_t);
+int	rawdev_mounted(struct vnode *, struct vnode **);
+uint8_t	vtype2dt(enum vtype);
+
+/* see vfssubr(9) */
+void	vfs_getnewfsid(struct mount *);
+int	vfs_drainvnodes(long);
+void	vfs_timestamp(struct timespec *);
+#if defined(DDB) || defined(DEBUGPRINT)
+void	vfs_vnode_print(struct vnode *, int, void (*)(const char *, ...)
+    __printflike(1, 2));
+void	vfs_mount_print(struct mount *, int, void (*)(const char *, ...)
+    __printflike(1, 2));
+#endif /* DDB */
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_VNODE_H_ */

Property changes on: lab4/.minix-src/include/sys/vnode.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/wapbl.h
===================================================================
--- lab4/.minix-src/include/sys/wapbl.h	(nonexistent)
+++ lab4/.minix-src/include/sys/wapbl.h	(revision 13)
@@ -0,0 +1,268 @@
+/*	$NetBSD: wapbl.h,v 1.16 2014/09/05 05:42:50 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2003,2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Wasabi Systems, Inc.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_WAPBL_H
+#define	_SYS_WAPBL_H
+
+#include <sys/mutex.h>
+
+#include <miscfs/specfs/specdev.h>
+
+/* This header file describes the api and data structures for
+ * write ahead physical block logging (WAPBL) support.
+ */
+
+#if defined(_KERNEL_OPT)
+#include "opt_wapbl.h"
+#endif
+
+#ifdef WAPBL_DEBUG
+#ifndef WAPBL_DEBUG_PRINT
+#define	WAPBL_DEBUG_PRINT (WAPBL_PRINT_REPLAY | WAPBL_PRINT_OPEN)
+#endif
+
+#if 0
+#define	WAPBL_DEBUG_BUFBYTES
+#endif
+
+#endif
+
+#ifdef WAPBL_DEBUG_PRINT
+
+enum {
+	WAPBL_PRINT_OPEN = 0x1,
+	WAPBL_PRINT_FLUSH = 0x2,
+	WAPBL_PRINT_TRUNCATE = 0x4,
+	WAPBL_PRINT_TRANSACTION = 0x8,
+	WAPBL_PRINT_BUFFER = 0x10,
+	WAPBL_PRINT_BUFFER2 = 0x20,
+	WAPBL_PRINT_ALLOC = 0x40,
+	WAPBL_PRINT_INODE = 0x80,
+	WAPBL_PRINT_WRITE = 0x100,
+	WAPBL_PRINT_IO = 0x200,
+	WAPBL_PRINT_REPLAY = 0x400,
+	WAPBL_PRINT_ERROR = 0x800,
+	WAPBL_PRINT_DISCARD = 0x1000,
+	WAPBL_PRINT_BIODONE = 0x2000,
+};
+
+#define	WAPBL_PRINTF(mask, a) if (wapbl_debug_print & (mask)) printf  a
+extern int wapbl_debug_print;
+#else
+#define	WAPBL_PRINTF(mask, a)
+#endif
+
+/****************************************************************/
+
+#include <sys/queue.h>
+#include <sys/vnode.h>
+#include <sys/buf.h>
+
+#ifdef _KERNEL
+
+struct wapbl_entry;
+struct wapbl_replay;
+struct wapbl;
+
+typedef void (*wapbl_flush_fn_t)(struct mount *, daddr_t *, int *, int);
+
+/*
+ * This structure holds per transaction log information
+ */
+struct wapbl_entry {
+	struct wapbl *we_wapbl;
+	SIMPLEQ_ENTRY(wapbl_entry) we_entries;
+	size_t we_bufcount;		/* Count of unsynced buffers */
+	size_t we_reclaimable_bytes;	/* Number on disk bytes for this
+					   transaction */
+	int	we_error;
+#ifdef WAPBL_DEBUG_BUFBYTES
+	size_t we_unsynced_bufbytes;	/* Byte count of unsynced buffers */
+#endif
+};
+
+/* Start using a log */
+int	wapbl_start(struct wapbl **, struct mount *, struct vnode *, daddr_t,
+		    size_t, size_t, struct wapbl_replay *,
+		    wapbl_flush_fn_t, wapbl_flush_fn_t);
+
+/* Discard the current transaction, potentially dangerous */
+void	wapbl_discard(struct wapbl *);
+
+/* stop using a log */
+int	wapbl_stop(struct wapbl *, int);
+
+/*
+ * Begin a new transaction or increment transaction recursion
+ * level if called while a transaction is already in progress
+ * by the current process.
+ */
+int	wapbl_begin(struct wapbl *, const char *, int);
+
+
+/* End a transaction or decrement the transaction recursion level */
+void	wapbl_end(struct wapbl *);
+
+/*
+ * Add a new buffer to the current transaction.  The buffers
+ * data will be copied to the current transaction log and the
+ * buffer will be marked B_LOCKED so that it will not be
+ * flushed to disk by the syncer or reallocated.
+ */
+void	wapbl_add_buf(struct wapbl *, struct buf *);
+
+/* Remove a buffer from the current transaction. */
+void	wapbl_remove_buf(struct wapbl *, struct buf *);
+
+void	wapbl_resize_buf(struct wapbl *, struct buf *, long, long);
+
+/*
+ * This will flush all completed transactions to disk and
+ * start asynchronous writes on the associated buffers
+ */
+int	wapbl_flush(struct wapbl *, int);
+
+/*
+ * Inodes that are allocated but have zero link count
+ * must be registered with the current transaction
+ * so they may be recorded in the log and cleaned up later.
+ * registration/unregistration of ino numbers already registered is ok.
+ */
+void	wapbl_register_inode(struct wapbl *, ino_t, mode_t);
+void	wapbl_unregister_inode(struct wapbl *, ino_t, mode_t);
+
+/*
+ * Metadata block deallocations must be registered so
+ * that revocations records can be written and to prevent
+ * the corresponding blocks from being reused as data
+ * blocks until the log is on disk.
+ */
+void	wapbl_register_deallocation(struct wapbl *, daddr_t, int);
+
+void	wapbl_jlock_assert(struct wapbl *wl);
+void	wapbl_junlock_assert(struct wapbl *wl);
+
+void	wapbl_print(struct wapbl *wl, int full, void (*pr)(const char *, ...)
+    __printflike(1, 2));
+
+#if defined(WAPBL_DEBUG) || defined(DDB)
+void	wapbl_dump(struct wapbl *);
+#endif
+
+void	wapbl_biodone(struct buf *);
+
+extern struct wapbl_ops wapbl_ops;
+
+static __inline struct mount *
+wapbl_vptomp(struct vnode *vp)
+{
+	struct mount *mp;
+
+	mp = NULL;
+	if (vp != NULL) {
+		if (vp->v_type == VBLK)
+			mp = spec_node_getmountedfs(vp);
+		else
+			mp = vp->v_mount;
+	}
+
+	return mp;
+}
+
+static __inline bool
+wapbl_vphaswapbl(struct vnode *vp)
+{
+	struct mount *mp;
+
+	if (vp == NULL)
+		return false;
+
+	mp = wapbl_vptomp(vp);
+	return mp && mp->mnt_wapbl;
+}
+
+#endif /* _KERNEL */
+
+/****************************************************************/
+/* Replay support */
+
+#ifdef WAPBL_INTERNAL
+LIST_HEAD(wapbl_blk_head, wapbl_blk);
+struct wapbl_replay {
+	struct vnode *wr_logvp;
+	struct vnode *wr_devvp;
+	daddr_t wr_logpbn;
+
+	int wr_log_dev_bshift;
+	int wr_fs_dev_bshift;
+	int64_t wr_circ_off;
+	int64_t wr_circ_size;	
+	uint32_t wr_generation;
+
+	void *wr_scratch;
+
+	struct wapbl_blk_head *wr_blkhash;
+	u_long wr_blkhashmask;
+	int wr_blkhashcnt;
+
+	off_t wr_inodeshead;
+	off_t wr_inodestail;
+	int wr_inodescnt;
+	struct {
+		uint32_t wr_inumber;
+		uint32_t wr_imode;
+	} *wr_inodes;
+};
+
+#define	wapbl_replay_isopen(wr) ((wr)->wr_scratch != 0)
+
+/* Supply this to provide i/o support */
+int wapbl_write(void *, size_t, struct vnode *, daddr_t);
+int wapbl_read(void *, size_t, struct vnode *, daddr_t);
+
+/****************************************************************/
+#else
+struct wapbl_replay;
+#endif /* WAPBL_INTERNAL */
+
+/****************************************************************/
+
+int	wapbl_replay_start(struct wapbl_replay **, struct vnode *,
+	daddr_t, size_t, size_t);
+void	wapbl_replay_stop(struct wapbl_replay *);
+void	wapbl_replay_free(struct wapbl_replay *);
+int	wapbl_replay_write(struct wapbl_replay *, struct vnode *);
+int	wapbl_replay_can_read(struct wapbl_replay *, daddr_t, long);
+int	wapbl_replay_read(struct wapbl_replay *, void *, daddr_t, long);
+
+/****************************************************************/
+
+#endif /* !_SYS_WAPBL_H */

Property changes on: lab4/.minix-src/include/sys/wapbl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ext2fs/ext2fs.h
===================================================================
--- lab4/.minix-src/include/ufs/ext2fs/ext2fs.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ext2fs/ext2fs.h	(revision 13)
@@ -0,0 +1,415 @@
+/*	$NetBSD: ext2fs.h,v 1.36 2013/06/23 07:28:37 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)fs.h	8.10 (Berkeley) 10/27/94
+ *  Modified for ext2fs by Manuel Bouyer.
+ */
+
+/*
+ * Copyright (c) 1997 Manuel Bouyer.
+ *
+ * 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.
+ *
+ *	@(#)fs.h	8.10 (Berkeley) 10/27/94
+ *  Modified for ext2fs by Manuel Bouyer.
+ */
+
+#ifndef _UFS_EXT2FS_EXT2FS_H_
+#define _UFS_EXT2FS_EXT2FS_H_
+
+#include <sys/bswap.h>
+
+/*
+ * Each disk drive contains some number of file systems.
+ * A file system consists of a number of cylinder groups.
+ * Each cylinder group has inodes and data.
+ *
+ * A file system is described by its super-block, which in turn
+ * describes the cylinder groups.  The super-block is critical
+ * data and is replicated in each cylinder group to protect against
+ * catastrophic loss.  This is done at `newfs' time and the critical
+ * super-block data does not change, so the copies need not be
+ * referenced further unless disaster strikes.
+ *
+ * The first boot and super blocks are given in absolute disk addresses.
+ * The byte-offset forms are preferred, as they don't imply a sector size.
+ */
+#define BBSIZE		1024
+#define SBSIZE		1024
+#define	BBOFF		((off_t)(0))
+#define	SBOFF		((off_t)(BBOFF + BBSIZE))
+#define	BBLOCK		((daddr_t)(0))
+#define	SBLOCK		((daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE))
+
+/*
+ * Addresses stored in inodes are capable of addressing blocks
+ * XXX
+ */
+
+/*
+ * MINBSIZE is the smallest allowable block size.
+ * MINBSIZE must be big enough to hold a cylinder group block,
+ * thus changes to (struct cg) must keep its size within MINBSIZE.
+ * Note that super blocks are always of size SBSIZE,
+ * and that both SBSIZE and MAXBSIZE must be >= MINBSIZE.
+ */
+#define LOG_MINBSIZE	10
+#define MINBSIZE	(1 << LOG_MINBSIZE)
+
+/*
+ * The path name on which the file system is mounted is maintained
+ * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
+ * the super block for this name.
+ */
+#define MAXMNTLEN	512
+
+/*
+ * MINFREE gives the minimum acceptable percentage of file system
+ * blocks which may be free. If the freelist drops below this level
+ * only the superuser may continue to allocate blocks. This may
+ * be set to 0 if no reserve of free blocks is deemed necessary,
+ * however throughput drops by fifty percent if the file system
+ * is run at between 95% and 100% full; thus the minimum default
+ * value of fs_minfree is 5%. However, to get good clustering
+ * performance, 10% is a better choice. hence we use 10% as our
+ * default value. With 10% free space, fragmentation is not a
+ * problem, so we choose to optimize for time.
+ */
+#define MINFREE		5
+
+/*
+ * Super block for an ext2fs file system.
+ */
+struct ext2fs {
+	uint32_t  e2fs_icount;		/* Inode count */
+	uint32_t  e2fs_bcount;		/* blocks count */
+	uint32_t  e2fs_rbcount;		/* reserved blocks count */
+	uint32_t  e2fs_fbcount;		/* free blocks count */
+	uint32_t  e2fs_ficount;		/* free inodes count */
+	uint32_t  e2fs_first_dblock;	/* first data block */
+	uint32_t  e2fs_log_bsize;	/* block size = 1024*(2^e2fs_log_bsize) */
+	uint32_t  e2fs_fsize;		/* fragment size */
+	uint32_t  e2fs_bpg;		/* blocks per group */
+	uint32_t  e2fs_fpg;		/* frags per group */
+	uint32_t  e2fs_ipg;		/* inodes per group */
+	uint32_t  e2fs_mtime;		/* mount time */
+	uint32_t  e2fs_wtime;		/* write time */
+	uint16_t  e2fs_mnt_count;	/* mount count */
+	uint16_t  e2fs_max_mnt_count;	/* max mount count */
+	uint16_t  e2fs_magic;		/* magic number */
+	uint16_t  e2fs_state;		/* file system state */
+	uint16_t  e2fs_beh;		/* behavior on errors */
+	uint16_t  e2fs_minrev;		/* minor revision level */
+	uint32_t  e2fs_lastfsck;	/* time of last fsck */
+	uint32_t  e2fs_fsckintv;	/* max time between fscks */
+	uint32_t  e2fs_creator;		/* creator OS */
+	uint32_t  e2fs_rev;		/* revision level */
+	uint16_t  e2fs_ruid;		/* default uid for reserved blocks */
+	uint16_t  e2fs_rgid;		/* default gid for reserved blocks */
+	/* EXT2_DYNAMIC_REV superblocks */
+	uint32_t  e2fs_first_ino;	/* first non-reserved inode */
+	uint16_t  e2fs_inode_size;	/* size of inode structure */
+	uint16_t  e2fs_block_group_nr;	/* block grp number of this sblk*/
+	uint32_t  e2fs_features_compat;	/*  compatible feature set */
+	uint32_t  e2fs_features_incompat; /* incompatible feature set */
+	uint32_t  e2fs_features_rocompat; /* RO-compatible feature set */
+	uint8_t   e2fs_uuid[16];	/* 128-bit uuid for volume */
+	char      e2fs_vname[16];	/* volume name */
+	char      e2fs_fsmnt[64];	/* name mounted on */
+	uint32_t  e2fs_algo;		/* For compression */
+	uint8_t   e2fs_prealloc;	/* # of blocks to preallocate */
+	uint8_t   e2fs_dir_prealloc;	/* # of blocks to preallocate for dir */
+	uint16_t  e2fs_reserved_ngdb;	/* # of reserved gd blocks for resize */
+	uint32_t  reserved2[204];
+};
+
+
+/* in-memory data for ext2fs */
+struct m_ext2fs {
+	struct ext2fs e2fs;
+	u_char	e2fs_fsmnt[MAXMNTLEN];	/* name mounted on */
+	int8_t	e2fs_ronly;	/* mounted read-only flag */
+	int8_t	e2fs_fmod;	/* super block modified flag */
+	int32_t	e2fs_bsize;	/* block size */
+	int32_t e2fs_bshift;	/* ``lblkno'' calc of logical blkno */
+	int32_t e2fs_bmask;	/* ``blkoff'' calc of blk offsets */
+	int64_t e2fs_qbmask;	/* ~fs_bmask - for use with quad size */
+	int32_t	e2fs_fsbtodb;	/* fsbtodb and dbtofsb shift constant */
+	int32_t	e2fs_ncg;	/* number of cylinder groups */
+	int32_t	e2fs_ngdb;	/* number of group descriptor block */
+	int32_t	e2fs_ipb;	/* number of inodes per block */
+	int32_t	e2fs_itpg;	/* number of inode table per group */
+	struct	ext2_gd *e2fs_gd; /* group descripors */
+};
+
+
+
+/*
+ * Filesystem identification
+ */
+#define	E2FS_MAGIC	0xef53	/* the ext2fs magic number */
+#define E2FS_REV0	0	/* GOOD_OLD revision */
+#define E2FS_REV1	1	/* Support compat/incompat features */
+
+/* compatible/incompatible features */
+#define EXT2F_COMPAT_PREALLOC		0x0001
+#define EXT2F_COMPAT_AFS		0x0002
+#define EXT2F_COMPAT_HASJOURNAL		0x0004
+#define EXT2F_COMPAT_EXTATTR		0x0008
+#define EXT2F_COMPAT_RESIZE		0x0010
+#define EXT2F_COMPAT_DIRHASHINDEX	0x0020
+#define	EXT2F_COMPAT_BITS \
+	"\20" \
+	"\06COMPAT_DIRHASHINDEX" \
+	"\05COMPAT_RESIZE" \
+	"\04COMPAT_EXTATTR" \
+	"\03COMPAT_HASJOURNAL" \
+	"\02COMPAT_AFS" \
+	"\01COMPAT_PREALLOC"
+
+#define EXT2F_ROCOMPAT_SPARSESUPER	0x0001
+#define EXT2F_ROCOMPAT_LARGEFILE	0x0002
+#define EXT2F_ROCOMPAT_BTREE_DIR	0x0004
+#define EXT2F_ROCOMPAT_HUGE_FILE	0x0008
+#define EXT2F_ROCOMPAT_GDT_CSUM		0x0010
+#define EXT2F_ROCOMPAT_DIR_NLINK	0x0020
+#define EXT2F_ROCOMPAT_EXTRA_ISIZE	0x0040
+#define	EXT2F_ROCOMPAT_BITS \
+	"\20" \
+	"\07ROCOMPAT_EXTRA_ISIZE" \
+	"\06ROCOMPAT_DIR_NLINK" \
+	"\05ROCOMPAT_GDT_CSUM" \
+	"\04ROCOMPAT_HUGE_FILE" \
+	"\03ROCOMPAT_BTREE_DIR" \
+	"\02ROCOMPAT_LARGEFILE" \
+	"\01ROCOMPAT_SPARSESUPER"
+
+#define EXT2F_INCOMPAT_COMP		0x0001
+#define EXT2F_INCOMPAT_FTYPE		0x0002
+#define	EXT2F_INCOMPAT_REPLAY_JOURNAL	0x0004
+#define	EXT2F_INCOMPAT_USES_JOURNAL	0x0008
+#define EXT2F_INCOMPAT_META_BG		0x0010
+#define EXT2F_INCOMPAT_EXTENTS		0x0040
+#define EXT2F_INCOMPAT_64BIT		0x0080
+#define EXT2F_INCOMPAT_MMP		0x0100
+#define EXT2F_INCOMPAT_FLEX_BG		0x0200
+#define	EXT2F_INCOMPAT_BITS \
+	"\20" \
+	"\012INCOMPAT_FLEX_BG" \
+	"\011INCOMPAT_MMP" \
+	"\010INCOMPAT_64BIT" \
+	"\07INCOMPAT_EXTENTS" \
+	"\05INCOMPAT_META_BG" \
+	"\04INCOMPAT_USES_JOURNAL" \
+	"\03INCOMPAT_REPLAY_JOURNAL" \
+	"\02INCOMPAT_FTYPE" \
+	"\01INCOMPAT_COMP"
+
+/*
+ * Features supported in this implementation
+ *
+ * We support the following REV1 features:
+ * - EXT2F_ROCOMPAT_SPARSESUPER
+ *    superblock backups stored only in cg_has_sb(bno) groups
+ * - EXT2F_ROCOMPAT_LARGEFILE
+ *    use e2di_dacl in struct ext2fs_dinode to store 
+ *    upper 32bit of size for >2GB files
+ * - EXT2F_INCOMPAT_FTYPE
+ *    store file type to e2d_type in struct ext2fs_direct
+ *    (on REV0 e2d_namlen is uint16_t and no e2d_type, like ffs)
+ */
+#define EXT2F_COMPAT_SUPP		0x0000
+#define EXT2F_ROCOMPAT_SUPP		(EXT2F_ROCOMPAT_SPARSESUPER \
+					 | EXT2F_ROCOMPAT_LARGEFILE \
+					 | EXT2F_ROCOMPAT_HUGE_FILE)
+#define EXT2F_INCOMPAT_SUPP		EXT2F_INCOMPAT_FTYPE
+
+/*
+ * Definitions of behavior on errors
+ */
+#define E2FS_BEH_CONTINUE	1	/* continue operation */
+#define E2FS_BEH_READONLY	2	/* remount fs read only */
+#define E2FS_BEH_PANIC		3	/* cause panic */
+#define E2FS_BEH_DEFAULT	E2FS_BEH_CONTINUE
+
+/*
+ * OS identification
+ */
+#define E2FS_OS_LINUX	0
+#define E2FS_OS_HURD	1
+#define E2FS_OS_MASIX	2
+#define E2FS_OS_FREEBSD	3
+#define E2FS_OS_LITES	4
+
+/*
+ * Filesystem clean flags
+ */
+#define	E2FS_ISCLEAN	0x01
+#define	E2FS_ERRORS	0x02
+
+/* ext2 file system block group descriptor */
+
+struct ext2_gd {
+	uint32_t ext2bgd_b_bitmap;	/* blocks bitmap block */
+	uint32_t ext2bgd_i_bitmap;	/* inodes bitmap block */
+	uint32_t ext2bgd_i_tables;	/* inodes table block  */
+	uint16_t ext2bgd_nbfree;	/* number of free blocks */
+	uint16_t ext2bgd_nifree;	/* number of free inodes */
+	uint16_t ext2bgd_ndirs;		/* number of directories */
+	uint16_t reserved;
+	uint32_t reserved2[3];
+};
+
+
+/*
+ * If the EXT2F_ROCOMPAT_SPARSESUPER flag is set, the cylinder group has a
+ * copy of the super and cylinder group descriptors blocks only if it's
+ * 1, a power of 3, 5 or 7
+ */
+
+static __inline int cg_has_sb(int) __unused;
+static __inline int
+cg_has_sb(int i)
+{
+	int a3, a5, a7;
+
+	if (i == 0 || i == 1)
+		return 1;
+	for (a3 = 3, a5 = 5, a7 = 7;
+	    a3 <= i || a5 <= i || a7 <= i;
+	    a3 *= 3, a5 *= 5, a7 *= 7)
+		if (i == a3 || i == a5 || i == a7)
+			return 1;
+	return 0;
+}
+
+/* EXT2FS metadatas are stored in little-endian byte order. These macros
+ * helps reading theses metadatas
+ */
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#	define h2fs16(x) (x)
+#	define h2fs32(x) (x)
+#	define h2fs64(x) (x)
+#	define fs2h16(x) (x)
+#	define fs2h32(x) (x)
+#	define fs2h64(x) (x)
+#	define e2fs_sbload(old, new) memcpy((new), (old), SBSIZE);
+#	define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
+#	define e2fs_sbsave(old, new) memcpy((new), (old), SBSIZE);
+#	define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
+#else
+void e2fs_sb_bswap(struct ext2fs *, struct ext2fs *);
+void e2fs_cg_bswap(struct ext2_gd *, struct ext2_gd *, int);
+#	define h2fs16(x) bswap16(x)
+#	define h2fs32(x) bswap32(x)
+#	define h2fs64(x) bswap64(x)
+#	define fs2h16(x) bswap16(x)
+#	define fs2h32(x) bswap32(x)
+#	define fs2h64(x) bswap64(x)
+#	define e2fs_sbload(old, new) e2fs_sb_bswap((old), (new))
+#	define e2fs_cgload(old, new, size) e2fs_cg_bswap((old), (new), (size));
+#	define e2fs_sbsave(old, new) e2fs_sb_bswap((old), (new))
+#	define e2fs_cgsave(old, new, size) e2fs_cg_bswap((old), (new), (size));
+#endif
+
+/*
+ * Turn file system block numbers into disk block addresses.
+ * This maps file system blocks to device size blocks.
+ */
+#define EXT2_FSBTODB(fs, b)	((b) << (fs)->e2fs_fsbtodb)
+#define EXT2_DBTOFSB(fs, b)	((b) >> (fs)->e2fs_fsbtodb)
+
+/*
+ * Macros for handling inode numbers:
+ *	 inode number to file system block offset.
+ *	 inode number to cylinder group number.
+ *	 inode number to file system block address.
+ */
+#define	ino_to_cg(fs, x)	(((x) - 1) / (fs)->e2fs.e2fs_ipg)
+#define	ino_to_fsba(fs, x)						\
+	((fs)->e2fs_gd[ino_to_cg((fs), (x))].ext2bgd_i_tables +		\
+	(((x) - 1) % (fs)->e2fs.e2fs_ipg) / (fs)->e2fs_ipb)
+#define	ino_to_fsbo(fs, x)	(((x) - 1) % (fs)->e2fs_ipb)
+
+/*
+ * Give cylinder group number for a file system block.
+ * Give cylinder group block number for a file system block.
+ */
+#define	dtog(fs, d) (((d) - (fs)->e2fs.e2fs_first_dblock) / (fs)->e2fs.e2fs_fpg)
+#define	dtogd(fs, d) \
+	(((d) - (fs)->e2fs.e2fs_first_dblock) % (fs)->e2fs.e2fs_fpg)
+
+/*
+ * The following macros optimize certain frequently calculated
+ * quantities by using shifts and masks in place of divisions
+ * modulos and multiplications.
+ */
+#define ext2_blkoff(fs, loc)	/* calculates (loc % fs->e2fs_bsize) */ \
+	((loc) & (fs)->e2fs_qbmask)
+#define ext2_lblktosize(fs, blk) /* calculates (blk * fs->e2fs_bsize) */ \
+	((blk) << (fs)->e2fs_bshift)
+#define ext2_lblkno(fs, loc)	/* calculates (loc / fs->e2fs_bsize) */ \
+	((loc) >> (fs)->e2fs_bshift)
+#define ext2_blkroundup(fs, size) /* calculates roundup(size, fs->e2fs_bsize) */ \
+	(((size) + (fs)->e2fs_qbmask) & (fs)->e2fs_bmask)
+#define ext2_fragroundup(fs, size) /* calculates roundup(size, fs->e2fs_bsize) */ \
+	(((size) + (fs)->e2fs_qbmask) & (fs)->e2fs_bmask)
+/*
+ * Determine the number of available frags given a
+ * percentage to hold in reserve.
+ */
+#define freespace(fs) \
+   ((fs)->e2fs.e2fs_fbcount - (fs)->e2fs.e2fs_rbcount)
+
+/*
+ * Number of indirects in a file system block.
+ */
+#define	EXT2_NINDIR(fs)	((fs)->e2fs_bsize / sizeof(uint32_t))
+
+#endif /* !_UFS_EXT2FS_EXT2FS_H_ */

Property changes on: lab4/.minix-src/include/ufs/ext2fs/ext2fs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ffs/ffs_extern.h
===================================================================
--- lab4/.minix-src/include/ufs/ffs/ffs_extern.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ffs/ffs_extern.h	(revision 13)
@@ -0,0 +1,217 @@
+/*	$NetBSD: ffs_extern.h,v 1.82 2015/03/27 17:27:56 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ffs_extern.h	8.6 (Berkeley) 3/30/95
+ */
+
+#ifndef _UFS_FFS_FFS_EXTERN_H_
+#define _UFS_FFS_FFS_EXTERN_H_
+
+/*
+ * Sysctl values for the fast filesystem.
+ */
+#define FFS_CLUSTERREAD		1	/* cluster reading enabled */
+#define FFS_CLUSTERWRITE	2	/* cluster writing enabled */
+#define FFS_REALLOCBLKS		3	/* block reallocation enabled */
+#define FFS_ASYNCFREE		4	/* asynchronous block freeing enabled */
+#define FFS_LOG_CHANGEOPT	5	/* log optimalization strategy change */
+#define FFS_EXTATTR_AUTOCREATE	6	/* size for backing file autocreation */
+#define FFS_MAXID		7	/* number of valid ffs ids */
+
+struct buf;
+struct fid;
+struct fs;
+struct inode;
+struct ufs1_dinode;
+struct ufs2_dinode;
+struct mount;
+struct nameidata;
+struct lwp;
+struct statvfs;
+struct timeval;
+struct timespec;
+struct ufsmount;
+struct uio;
+struct vnode;
+struct mbuf;
+struct cg;
+
+#if defined(_KERNEL)
+
+#include <sys/pool.h>
+
+#define FFS_NOBLK		((daddr_t)-1)
+
+#define	FFS_ITIMES(ip, acc, mod, cre) \
+	while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
+		ffs_itimes(ip, acc, mod, cre)
+
+extern pool_cache_t ffs_inode_cache;	/* memory pool for inodes */
+extern pool_cache_t ffs_dinode1_cache;	/* memory pool for UFS1 dinodes */
+extern pool_cache_t ffs_dinode2_cache;	/* memory pool for UFS2 dinodes */
+
+#endif /* defined(_KERNEL) */
+
+__BEGIN_DECLS
+
+#if defined(_KERNEL)
+
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/wapbl.h>
+
+/* ffs_alloc.c */
+int	ffs_alloc(struct inode *, daddr_t, daddr_t , int, int, kauth_cred_t,
+		  daddr_t *);
+int	ffs_realloccg(struct inode *, daddr_t, daddr_t, int, int ,
+		      kauth_cred_t, struct buf **, daddr_t *);
+int	ffs_valloc(struct vnode *, int, kauth_cred_t, ino_t *);
+daddr_t	ffs_blkpref_ufs1(struct inode *, daddr_t, int, int, int32_t *);
+daddr_t	ffs_blkpref_ufs2(struct inode *, daddr_t, int, int, int64_t *);
+int	ffs_blkalloc(struct inode *, daddr_t, long);
+int	ffs_blkalloc_ump(struct ufsmount *, daddr_t, long);
+void	ffs_blkfree(struct fs *, struct vnode *, daddr_t, long, ino_t);
+void	*ffs_discard_init(struct vnode *, struct fs *);
+void	ffs_discard_finish(void *, int);
+void	ffs_blkfree_snap(struct fs *, struct vnode *, daddr_t, long, ino_t);
+int	ffs_vfree(struct vnode *, ino_t, int);
+int	ffs_checkfreefile(struct fs *, struct vnode *, ino_t);
+int	ffs_freefile(struct mount *, ino_t, int);
+int	ffs_freefile_snap(struct fs *, struct vnode *, ino_t, int);
+
+/* ffs_balloc.c */
+int	ffs_balloc(struct vnode *, off_t, int, kauth_cred_t, int,
+    struct buf **);
+
+/* ffs_inode.c */
+int	ffs_update(struct vnode *, const struct timespec *,
+    const struct timespec *, int);
+int	ffs_truncate(struct vnode *, off_t, int, kauth_cred_t);
+
+/* ffs_vfsops.c */
+VFS_PROTOS(ffs);
+
+int     ffs_reload(struct mount *, kauth_cred_t, struct lwp *);
+int     ffs_mountfs(struct vnode *, struct mount *, struct lwp *);
+int	ffs_flushfiles(struct mount *, int, struct lwp *);
+int	ffs_sbupdate(struct ufsmount *, int);
+int	ffs_cgupdate(struct ufsmount *, int);
+
+/* ffs_vnops.c */
+int	ffs_read(void *);
+int	ffs_write(void *);
+int	ffs_bufio(enum uio_rw, struct vnode *, void *, size_t, off_t, int,
+	    kauth_cred_t, size_t *, struct lwp *);
+int	ffs_bufrd(struct vnode *, struct uio *, int, kauth_cred_t);
+int	ffs_bufwr(struct vnode *, struct uio *, int, kauth_cred_t);
+int	ffs_fsync(void *);
+int	ffs_spec_fsync(void *);
+int	ffs_reclaim(void *);
+int	ffs_getpages(void *);
+void	ffs_gop_size(struct vnode *, off_t, off_t *, int);
+int	ffs_openextattr(void *);
+int	ffs_closeextattr(void *);
+int	ffs_getextattr(void *);
+int	ffs_setextattr(void *);
+int	ffs_listextattr(void *);
+int	ffs_deleteextattr(void *);
+int	ffs_lock(void *);
+int	ffs_unlock(void *);
+int	ffs_islocked(void *);
+int	ffs_full_fsync(struct vnode *, int);
+
+/*
+ * Snapshot function prototypes.
+ */
+int	ffs_snapshot_init(struct ufsmount *);
+void	ffs_snapshot_fini(struct ufsmount *);
+int	ffs_snapblkfree(struct fs *, struct vnode *, daddr_t, long, ino_t);
+void	ffs_snapremove(struct vnode *);
+int	ffs_snapshot(struct mount *, struct vnode *, struct timespec *);
+void	ffs_snapshot_mount(struct mount *);
+void	ffs_snapshot_unmount(struct mount *);
+void	ffs_snapgone(struct vnode *);
+int	ffs_snapshot_read(struct vnode *, struct uio *, int);
+
+/* Write Ahead Physical Block Logging */
+void	ffs_wapbl_verify_inodes(struct mount *, const char *);
+void	ffs_wapbl_replay_finish(struct mount *);
+int	ffs_wapbl_start(struct mount *);
+int	ffs_wapbl_stop(struct mount *, int);
+int	ffs_wapbl_replay_start(struct mount *, struct fs *, struct vnode *);
+void	ffs_wapbl_blkalloc(struct fs *, struct vnode *, daddr_t, int);
+
+void	ffs_wapbl_sync_metadata(struct mount *, daddr_t *, int *, int);
+void	ffs_wapbl_abort_sync_metadata(struct mount *, daddr_t *, int *, int);
+
+extern int (**ffs_vnodeop_p)(void *);
+extern int (**ffs_specop_p)(void *);
+extern int (**ffs_fifoop_p)(void *);
+
+#endif /* defined(_KERNEL) */
+
+/* ffs_appleufs.c */
+struct appleufslabel;
+u_int16_t ffs_appleufs_cksum(const struct appleufslabel *);
+int	ffs_appleufs_validate(const char*, const struct appleufslabel *,
+			      struct appleufslabel *);
+void	ffs_appleufs_set(struct appleufslabel *, const char *, time_t,
+			 uint64_t);
+
+/* ffs_bswap.c */
+void	ffs_sb_swap(struct fs*, struct fs *);
+void	ffs_dinode1_swap(struct ufs1_dinode *, struct ufs1_dinode *);
+void	ffs_dinode2_swap(struct ufs2_dinode *, struct ufs2_dinode *);
+struct csum;
+void	ffs_csum_swap(struct csum *, struct csum *, int);
+struct csum_total;
+void	ffs_csumtotal_swap(struct csum_total *, struct csum_total *);
+void	ffs_cg_swap(struct cg *, struct cg *, struct fs *);
+
+/* ffs_subr.c */
+#if defined(_KERNEL)
+void	ffs_load_inode(struct buf *, struct inode *, struct fs *, ino_t);
+int	ffs_getblk(struct vnode *, daddr_t, daddr_t, int, bool, buf_t **);
+#endif /* defined(_KERNEL) */
+void	ffs_fragacct(struct fs *, int, int32_t[], int, int);
+int	ffs_isblock(struct fs *, u_char *, int32_t);
+int	ffs_isfreeblock(struct fs *, u_char *, int32_t);
+void	ffs_clrblock(struct fs *, u_char *, int32_t);
+void	ffs_setblock(struct fs *, u_char *, int32_t);
+void	ffs_itimes(struct inode *, const struct timespec *,
+    const struct timespec *, const struct timespec *);
+void	ffs_clusteracct(struct fs *, struct cg *, int32_t, int);
+
+/* ffs_quota2.c */
+int	ffs_quota2_mount(struct mount *);
+
+__END_DECLS
+
+#endif /* !_UFS_FFS_FFS_EXTERN_H_ */

Property changes on: lab4/.minix-src/include/ufs/ffs/ffs_extern.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/spawn.h
===================================================================
--- lab4/.minix-src/include/sys/spawn.h	(nonexistent)
+++ lab4/.minix-src/include/sys/spawn.h	(revision 13)
@@ -0,0 +1,105 @@
+/*	$NetBSD: spawn.h,v 1.5 2014/09/05 05:46:54 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/include/spawn.h,v 1.3.2.1.4.1 2010/06/14 02:09:06 kensmith Exp $
+ */
+
+#ifndef _SYS_SPAWN_H_
+#define _SYS_SPAWN_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+#include <sys/sigtypes.h>
+#include <sys/signal.h>
+#include <sys/sched.h>
+
+struct posix_spawnattr {
+	short			sa_flags;
+	pid_t			sa_pgroup;
+	struct sched_param	sa_schedparam;
+	int			sa_schedpolicy;
+	sigset_t		sa_sigdefault;
+	sigset_t		sa_sigmask;
+};
+
+enum fae_action { FAE_OPEN, FAE_DUP2, FAE_CLOSE };
+typedef struct posix_spawn_file_actions_entry {
+	enum fae_action fae_action;
+
+	int fae_fildes;
+	union {
+		struct {
+			char *path;
+#define fae_path	fae_data.open.path
+			int oflag;
+#define fae_oflag	fae_data.open.oflag
+			mode_t mode;
+#define fae_mode	fae_data.open.mode
+		} open;
+		struct {
+			int newfildes;
+#define fae_newfildes	fae_data.dup2.newfildes
+		} dup2;
+	} fae_data;
+} posix_spawn_file_actions_entry_t;
+
+struct posix_spawn_file_actions {
+	unsigned int size;	/* size of fae array */
+	unsigned int len;	/* how many slots are used */
+	posix_spawn_file_actions_entry_t *fae;
+};
+
+typedef struct posix_spawnattr		posix_spawnattr_t;
+typedef struct posix_spawn_file_actions	posix_spawn_file_actions_t;
+
+#define POSIX_SPAWN_RESETIDS		0x01
+#define POSIX_SPAWN_SETPGROUP		0x02
+#define POSIX_SPAWN_SETSCHEDPARAM	0x04
+#define POSIX_SPAWN_SETSCHEDULER	0x08
+#define POSIX_SPAWN_SETSIGDEF		0x10
+#define POSIX_SPAWN_SETSIGMASK		0x20
+
+#ifdef _NETBSD_SOURCE
+/*
+ * With this flag set, the kernel part of posix_spawn will not try to
+ * maximize parallelism, but instead the parent will wait for the child
+ * process to complete all file/scheduler actions and report back errors
+ * from that via the return value of the posix_spawn syscall. This is
+ * usefull for testing, as it can verify the generated error codes and
+ * match to the supposedly triggered failures.
+ * In general, the kernel will return from the posix_spawn syscall as
+ * early as possible, as soon as creating the new process is known to
+ * work. Errors might either be reported back via the return value in
+ * the parent, or (less explicit) by an error exit of the child
+ * process. Our test cases deal with both behaviours in the general
+ * case, but request the POSIX_SPAWN_RETURNERROR for some tests.
+ */
+#define POSIX_SPAWN_RETURNERROR		0x40
+#endif
+
+#endif /* !_SYS_SPAWN_H_ */

Property changes on: lab4/.minix-src/include/sys/spawn.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/statvfs.h
===================================================================
--- lab4/.minix-src/include/sys/statvfs.h	(nonexistent)
+++ lab4/.minix-src/include/sys/statvfs.h	(revision 13)
@@ -0,0 +1,183 @@
+/*	$NetBSD: statvfs.h,v 1.18 2013/04/05 17:34:27 christos Exp $	 */
+
+/*-
+ * Copyright (c) 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_SYS_STATVFS_H_
+#define	_SYS_STATVFS_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/stdint.h>
+#include <machine/ansi.h>
+#include <sys/ansi.h>
+#include <sys/fstypes.h>
+
+#define	_VFS_NAMELEN	32
+#define	_VFS_MNAMELEN	1024
+
+#ifndef	fsblkcnt_t
+typedef	__fsblkcnt_t	fsblkcnt_t;	/* fs block count (statvfs) */
+#define	fsblkcnt_t	__fsblkcnt_t
+#endif
+
+#ifndef	fsfilcnt_t
+typedef	__fsfilcnt_t	fsfilcnt_t;	/* fs file count */
+#define	fsfilcnt_t	__fsfilcnt_t
+#endif
+
+#ifndef	uid_t
+typedef	__uid_t		uid_t;		/* user id */
+#define	uid_t		__uid_t
+#endif
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_		size_t;
+#define	_SIZE_T
+#undef	_BSD_SIZE_T_
+#endif
+
+struct statvfs {
+	unsigned long	f_flag;		/* copy of mount exported flags */
+	unsigned long	f_bsize;	/* file system block size */
+	unsigned long	f_frsize;	/* fundamental file system block size */
+	unsigned long	f_iosize;	/* optimal file system block size */
+
+	/* The following are in units of f_frsize */
+	fsblkcnt_t	f_blocks;	/* number of blocks in file system, */
+	fsblkcnt_t	f_bfree;	/* free blocks avail in file system */
+	fsblkcnt_t	f_bavail;	/* free blocks avail to non-root */
+	fsblkcnt_t	f_bresvd;	/* blocks reserved for root */
+
+	fsfilcnt_t	f_files;	/* total file nodes in file system */
+	fsfilcnt_t	f_ffree;	/* free file nodes in file system */
+	fsfilcnt_t	f_favail;	/* free file nodes avail to non-root */
+	fsfilcnt_t	f_fresvd;	/* file nodes reserved for root */
+
+	uint64_t  	f_syncreads;	/* count of sync reads since mount */
+	uint64_t  	f_syncwrites;	/* count of sync writes since mount */
+
+	uint64_t  	f_asyncreads;	/* count of async reads since mount */
+	uint64_t  	f_asyncwrites;	/* count of async writes since mount */
+
+	fsid_t		f_fsidx;	/* NetBSD compatible fsid */
+	unsigned long	f_fsid;		/* Posix compatible fsid */
+	unsigned long	f_namemax;	/* maximum filename length */
+	uid_t		f_owner;	/* user that mounted the file system */
+
+	uint32_t	f_spare[4];	/* spare space */
+
+	char	f_fstypename[_VFS_NAMELEN]; /* fs type name */
+	char	f_mntonname[_VFS_MNAMELEN];  /* directory on which mounted */
+	char	f_mntfromname[_VFS_MNAMELEN];  /* mounted file system */
+
+};
+
+#if defined(_NETBSD_SOURCE) && !defined(_POSIX_SOURCE) && \
+    !defined(_XOPEN_SOURCE)
+#define	VFS_NAMELEN	_VFS_NAMELEN
+#define	VFS_MNAMELEN	_VFS_MNAMELEN
+#endif
+
+#define	ST_RDONLY	MNT_RDONLY
+#define	ST_SYNCHRONOUS	MNT_SYNCHRONOUS
+#define	ST_NOEXEC	MNT_NOEXEC
+#define	ST_NOSUID	MNT_NOSUID
+#define	ST_NODEV	MNT_NODEV
+#define	ST_UNION	MNT_UNION
+#define	ST_ASYNC	MNT_ASYNC
+#define	ST_NOCOREDUMP	MNT_NOCOREDUMP
+#define	ST_RELATIME	MNT_RELATIME
+#define	ST_IGNORE	MNT_IGNORE
+#define	ST_NOATIME	MNT_NOATIME
+#define	ST_SYMPERM	MNT_SYMPERM
+#define	ST_NODEVMTIME	MNT_NODEVMTIME
+#define	ST_SOFTDEP	MNT_SOFTDEP
+#define	ST_LOG		MNT_LOG
+#define	ST_EXTATTR	MNT_EXTATTR
+
+#define	ST_EXRDONLY	MNT_EXRDONLY
+#define	ST_EXPORTED	MNT_EXPORTED
+#define	ST_DEFEXPORTED	MNT_DEFEXPORTED
+#define	ST_EXPORTANON	MNT_EXPORTANON
+#define	ST_EXKERB	MNT_EXKERB
+#define	ST_EXNORESPORT	MNT_EXNORESPORT
+#define	ST_EXPUBLIC	MNT_EXPUBLIC
+
+#define	ST_LOCAL	MNT_LOCAL
+#define	ST_QUOTA	MNT_QUOTA
+#define	ST_ROOTFS	MNT_ROOTFS
+
+
+#define	ST_WAIT		MNT_WAIT
+#define	ST_NOWAIT	MNT_NOWAIT
+
+#if defined(__minix)
+#define        ST_NOTRUNC      __MNT_UNUSED1
+#endif /* defined(__minix) */
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+struct mount;
+struct lwp;
+
+int	set_statvfs_info(const char *, int, const char *, int,
+    const char *, struct mount *, struct lwp *);
+void	copy_statvfs_info(struct statvfs *, const struct mount *);
+int	dostatvfs(struct mount *, struct statvfs *, struct lwp *, int, int);
+#else
+__BEGIN_DECLS
+int	statvfs(const char *__restrict, struct statvfs *__restrict);
+int	fstatvfs(int, struct statvfs *);
+int	getvfsstat(struct statvfs *, size_t, int);
+#ifndef __LIBC12_SOURCE__
+int	getmntinfo(struct statvfs **, int) __RENAME(__getmntinfo13);
+#endif /* __LIBC12_SOURCE__ */
+#if defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+int	fhstatvfs(const void *, size_t, struct statvfs *) 
+    __RENAME(__fhstatvfs40);
+#endif
+
+int	statvfs1(const char *__restrict, struct statvfs *__restrict, int);
+int	fstatvfs1(int, struct statvfs *, int);
+#ifndef __LIBC12_SOURCE__
+int	fhstatvfs1(const void *, size_t, struct statvfs *, int)
+    __RENAME(__fhstatvfs140);
+#endif
+#endif /* _NETBSD_SOURCE */
+__END_DECLS
+#endif /* _KERNEL || _STANDALONE */
+
+#if defined(_KERNEL)
+#include <sys/kmem.h>
+#define	STATVFSBUF_GET()	kmem_alloc(sizeof(struct statvfs), KM_SLEEP)
+#define	STATVFSBUF_PUT(sb)	kmem_free(sb, sizeof(struct statvfs))
+#endif /* defined(_KERNEL) */
+
+#endif /* !_SYS_STATVFS_H_ */

Property changes on: lab4/.minix-src/include/sys/statvfs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/svrctl.h
===================================================================
--- lab4/.minix-src/include/sys/svrctl.h	(nonexistent)
+++ lab4/.minix-src/include/sys/svrctl.h	(revision 13)
@@ -0,0 +1,35 @@
+/*
+sys/svrctl.h
+
+Created:	Feb 15, 1994 by Philip Homburg <philip@cs.vu.nl>
+*/
+
+#ifndef _SYS__SVRCTL_H
+#define _SYS__SVRCTL_H
+
+#include <sys/types.h>
+
+/* Server control commands have the same encoding as the commands for ioctls. */
+#include <minix/ioctl.h>
+
+/* PM controls. */
+#define PMGETPARAM	_IOWR('P',  0, struct sysgetenv)
+#define PMSETPARAM	_IOW('P',  1, struct sysgetenv)
+
+#define OPMGETPARAM	_IOW('M',  5, struct sysgetenv)	/* old, phasing out */
+#define OPMSETPARAM	_IOR('M',  7, struct sysgetenv)	/* old, phasing out */
+
+/* VFS controls */
+#define VFSGETPARAM	_IOWR('F', 0, struct sysgetenv)
+#define VFSSETPARAM	_IOW('F', 1, struct sysgetenv)
+
+struct sysgetenv {
+	char		*key;		/* Name requested. */
+	size_t		keylen;		/* Length of name including \0. */
+	char		*val;		/* Buffer for returned data. */
+	size_t		vallen;		/* Size of return data buffer. */
+};
+
+int svrctl(unsigned long _request, void *_data);
+
+#endif /* _SYS__SVRCTL_H */

Property changes on: lab4/.minix-src/include/sys/svrctl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/syscallargs.h
===================================================================
--- lab4/.minix-src/include/sys/syscallargs.h	(nonexistent)
+++ lab4/.minix-src/include/sys/syscallargs.h	(revision 13)
@@ -0,0 +1,4006 @@
+/* $NetBSD: syscallargs.h,v 1.269 2015/10/10 03:30:17 pgoyette Exp $ */
+
+/*
+ * System call argument lists.
+ *
+ * DO NOT EDIT-- this file is automatically generated.
+ * created from	NetBSD: syscalls.master,v 1.280 2015/10/10 03:27:30 pgoyette Exp
+ */
+
+#ifndef _SYS_SYSCALLARGS_H_
+#define	_SYS_SYSCALLARGS_H_
+
+#ifndef RUMP_CLIENT
+#include <sys/mount.h>
+#include <sys/sched.h>
+#endif
+#include <sys/socket.h>
+
+#define	SYS_MAXSYSARGS	8
+
+#undef	syscallarg
+#define	syscallarg(x)							\
+	union {								\
+		register_t pad;						\
+		struct { x datum; } le;					\
+		struct { /* LINTED zero array dimension */		\
+			int8_t pad[  /* CONSTCOND */			\
+				(sizeof (register_t) < sizeof (x))	\
+				? 0					\
+				: sizeof (register_t) - sizeof (x)];	\
+			x datum;					\
+		} be;							\
+	}
+
+#undef check_syscall_args
+#define check_syscall_args(call) /*LINTED*/ \
+	typedef char call##_check_args[sizeof (struct call##_args) \
+		<= SYS_MAXSYSARGS * sizeof (register_t) ? 1 : -1];
+
+#ifndef RUMP_CLIENT
+struct sys_syscall_args {
+	syscallarg(int) code;
+	syscallarg(register_t) args[SYS_MAXSYSARGS];
+};
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_exit_args {
+	syscallarg(int) rval;
+};
+check_syscall_args(sys_exit)
+#endif /* !RUMP_CLIENT */
+
+struct sys_read_args {
+	syscallarg(int) fd;
+	syscallarg(void *) buf;
+	syscallarg(size_t) nbyte;
+};
+check_syscall_args(sys_read)
+
+struct sys_write_args {
+	syscallarg(int) fd;
+	syscallarg(const void *) buf;
+	syscallarg(size_t) nbyte;
+};
+check_syscall_args(sys_write)
+
+struct sys_open_args {
+	syscallarg(const char *) path;
+	syscallarg(int) flags;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(sys_open)
+
+struct sys_close_args {
+	syscallarg(int) fd;
+};
+check_syscall_args(sys_close)
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_wait4_args {
+	syscallarg(pid_t) pid;
+	syscallarg(int *) status;
+	syscallarg(int) options;
+	syscallarg(struct rusage50 *) rusage;
+};
+check_syscall_args(compat_50_sys_wait4)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_creat_args {
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(compat_43_sys_creat)
+#endif /* !RUMP_CLIENT */
+
+struct sys_link_args {
+	syscallarg(const char *) path;
+	syscallarg(const char *) link;
+};
+check_syscall_args(sys_link)
+
+struct sys_unlink_args {
+	syscallarg(const char *) path;
+};
+check_syscall_args(sys_unlink)
+
+struct sys_chdir_args {
+	syscallarg(const char *) path;
+};
+check_syscall_args(sys_chdir)
+
+struct sys_fchdir_args {
+	syscallarg(int) fd;
+};
+check_syscall_args(sys_fchdir)
+
+struct compat_50_sys_mknod_args {
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+	syscallarg(uint32_t) dev;
+};
+check_syscall_args(compat_50_sys_mknod)
+
+struct sys_chmod_args {
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(sys_chmod)
+
+struct sys_chown_args {
+	syscallarg(const char *) path;
+	syscallarg(uid_t) uid;
+	syscallarg(gid_t) gid;
+};
+check_syscall_args(sys_chown)
+
+#ifndef RUMP_CLIENT
+struct sys_obreak_args {
+	syscallarg(char *) nsize;
+};
+check_syscall_args(sys_obreak)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_20_sys_getfsstat_args {
+	syscallarg(struct statfs12 *) buf;
+	syscallarg(long) bufsize;
+	syscallarg(int) flags;
+};
+check_syscall_args(compat_20_sys_getfsstat)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_lseek_args {
+	syscallarg(int) fd;
+	syscallarg(long) offset;
+	syscallarg(int) whence;
+};
+check_syscall_args(compat_43_sys_lseek)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_40_sys_mount_args {
+	syscallarg(const char *) type;
+	syscallarg(const char *) path;
+	syscallarg(int) flags;
+	syscallarg(void *) data;
+};
+check_syscall_args(compat_40_sys_mount)
+#endif /* !RUMP_CLIENT */
+
+struct sys_unmount_args {
+	syscallarg(const char *) path;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_unmount)
+
+struct sys_setuid_args {
+	syscallarg(uid_t) uid;
+};
+check_syscall_args(sys_setuid)
+
+#ifndef RUMP_CLIENT
+struct sys_ptrace_args {
+	syscallarg(int) req;
+	syscallarg(pid_t) pid;
+	syscallarg(void *) addr;
+	syscallarg(int) data;
+};
+check_syscall_args(sys_ptrace)
+#endif /* !RUMP_CLIENT */
+
+struct sys_recvmsg_args {
+	syscallarg(int) s;
+	syscallarg(struct msghdr *) msg;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_recvmsg)
+
+struct sys_sendmsg_args {
+	syscallarg(int) s;
+	syscallarg(const struct msghdr *) msg;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_sendmsg)
+
+struct sys_recvfrom_args {
+	syscallarg(int) s;
+	syscallarg(void *) buf;
+	syscallarg(size_t) len;
+	syscallarg(int) flags;
+	syscallarg(struct sockaddr *) from;
+	syscallarg(socklen_t *) fromlenaddr;
+};
+check_syscall_args(sys_recvfrom)
+
+struct sys_accept_args {
+	syscallarg(int) s;
+	syscallarg(struct sockaddr *) name;
+	syscallarg(socklen_t *) anamelen;
+};
+check_syscall_args(sys_accept)
+
+struct sys_getpeername_args {
+	syscallarg(int) fdes;
+	syscallarg(struct sockaddr *) asa;
+	syscallarg(socklen_t *) alen;
+};
+check_syscall_args(sys_getpeername)
+
+struct sys_getsockname_args {
+	syscallarg(int) fdes;
+	syscallarg(struct sockaddr *) asa;
+	syscallarg(socklen_t *) alen;
+};
+check_syscall_args(sys_getsockname)
+
+struct sys_access_args {
+	syscallarg(const char *) path;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_access)
+
+struct sys_chflags_args {
+	syscallarg(const char *) path;
+	syscallarg(u_long) flags;
+};
+check_syscall_args(sys_chflags)
+
+struct sys_fchflags_args {
+	syscallarg(int) fd;
+	syscallarg(u_long) flags;
+};
+check_syscall_args(sys_fchflags)
+
+#ifndef RUMP_CLIENT
+struct sys_kill_args {
+	syscallarg(pid_t) pid;
+	syscallarg(int) signum;
+};
+check_syscall_args(sys_kill)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_stat_args {
+	syscallarg(const char *) path;
+	syscallarg(struct stat43 *) ub;
+};
+check_syscall_args(compat_43_sys_stat)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_lstat_args {
+	syscallarg(const char *) path;
+	syscallarg(struct stat43 *) ub;
+};
+check_syscall_args(compat_43_sys_lstat)
+#endif /* !RUMP_CLIENT */
+
+struct sys_dup_args {
+	syscallarg(int) fd;
+};
+check_syscall_args(sys_dup)
+
+#ifndef RUMP_CLIENT
+struct sys_profil_args {
+	syscallarg(char *) samples;
+	syscallarg(size_t) size;
+	syscallarg(u_long) offset;
+	syscallarg(u_int) scale;
+};
+check_syscall_args(sys_profil)
+#endif /* !RUMP_CLIENT */
+
+struct sys_ktrace_args {
+	syscallarg(const char *) fname;
+	syscallarg(int) ops;
+	syscallarg(int) facs;
+	syscallarg(pid_t) pid;
+};
+check_syscall_args(sys_ktrace)
+
+#ifndef RUMP_CLIENT
+struct compat_13_sys_sigaction_args {
+	syscallarg(int) signum;
+	syscallarg(const struct sigaction13 *) nsa;
+	syscallarg(struct sigaction13 *) osa;
+};
+check_syscall_args(compat_13_sys_sigaction)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_13_sys_sigprocmask_args {
+	syscallarg(int) how;
+	syscallarg(int) mask;
+};
+check_syscall_args(compat_13_sys_sigprocmask)
+#endif /* !RUMP_CLIENT */
+
+struct sys___getlogin_args {
+	syscallarg(char *) namebuf;
+	syscallarg(size_t) namelen;
+};
+check_syscall_args(sys___getlogin)
+
+struct sys___setlogin_args {
+	syscallarg(const char *) namebuf;
+};
+check_syscall_args(sys___setlogin)
+
+#ifndef RUMP_CLIENT
+struct sys_acct_args {
+	syscallarg(const char *) path;
+};
+check_syscall_args(sys_acct)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_13_sys_sigaltstack_args {
+	syscallarg(const struct sigaltstack13 *) nss;
+	syscallarg(struct sigaltstack13 *) oss;
+};
+check_syscall_args(compat_13_sys_sigaltstack)
+#endif /* !RUMP_CLIENT */
+
+struct sys_ioctl_args {
+	syscallarg(int) fd;
+	syscallarg(u_long) com;
+	syscallarg(void *) data;
+};
+check_syscall_args(sys_ioctl)
+
+#ifndef RUMP_CLIENT
+struct compat_12_sys_reboot_args {
+	syscallarg(int) opt;
+};
+check_syscall_args(compat_12_sys_reboot)
+#endif /* !RUMP_CLIENT */
+
+struct sys_revoke_args {
+	syscallarg(const char *) path;
+};
+check_syscall_args(sys_revoke)
+
+struct sys_symlink_args {
+	syscallarg(const char *) path;
+	syscallarg(const char *) link;
+};
+check_syscall_args(sys_symlink)
+
+struct sys_readlink_args {
+	syscallarg(const char *) path;
+	syscallarg(char *) buf;
+	syscallarg(size_t) count;
+};
+check_syscall_args(sys_readlink)
+
+#ifndef RUMP_CLIENT
+struct sys_execve_args {
+	syscallarg(const char *) path;
+	syscallarg(char *const *) argp;
+	syscallarg(char *const *) envp;
+};
+check_syscall_args(sys_execve)
+#endif /* !RUMP_CLIENT */
+
+struct sys_umask_args {
+	syscallarg(mode_t) newmask;
+};
+check_syscall_args(sys_umask)
+
+struct sys_chroot_args {
+	syscallarg(const char *) path;
+};
+check_syscall_args(sys_chroot)
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_fstat_args {
+	syscallarg(int) fd;
+	syscallarg(struct stat43 *) sb;
+};
+check_syscall_args(compat_43_sys_fstat)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_getkerninfo_args {
+	syscallarg(int) op;
+	syscallarg(char *) where;
+	syscallarg(int *) size;
+	syscallarg(int) arg;
+};
+check_syscall_args(compat_43_sys_getkerninfo)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_12_sys_msync_args {
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+};
+check_syscall_args(compat_12_sys_msync)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_sbrk_args {
+	syscallarg(intptr_t) incr;
+};
+check_syscall_args(sys_sbrk)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_sstk_args {
+	syscallarg(int) incr;
+};
+check_syscall_args(sys_sstk)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_mmap_args {
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+	syscallarg(int) prot;
+	syscallarg(int) flags;
+	syscallarg(int) fd;
+	syscallarg(long) pos;
+};
+check_syscall_args(compat_43_sys_mmap)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_ovadvise_args {
+	syscallarg(int) anom;
+};
+check_syscall_args(sys_ovadvise)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_munmap_args {
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+};
+check_syscall_args(sys_munmap)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_mprotect_args {
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+	syscallarg(int) prot;
+};
+check_syscall_args(sys_mprotect)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_madvise_args {
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+	syscallarg(int) behav;
+};
+check_syscall_args(sys_madvise)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_mincore_args {
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+	syscallarg(char *) vec;
+};
+check_syscall_args(sys_mincore)
+#endif /* !RUMP_CLIENT */
+
+struct sys_getgroups_args {
+	syscallarg(int) gidsetsize;
+	syscallarg(gid_t *) gidset;
+};
+check_syscall_args(sys_getgroups)
+
+struct sys_setgroups_args {
+	syscallarg(int) gidsetsize;
+	syscallarg(const gid_t *) gidset;
+};
+check_syscall_args(sys_setgroups)
+
+struct sys_setpgid_args {
+	syscallarg(pid_t) pid;
+	syscallarg(pid_t) pgid;
+};
+check_syscall_args(sys_setpgid)
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_setitimer_args {
+	syscallarg(int) which;
+	syscallarg(const struct itimerval50 *) itv;
+	syscallarg(struct itimerval50 *) oitv;
+};
+check_syscall_args(compat_50_sys_setitimer)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_12_sys_swapon_args {
+	syscallarg(const char *) name;
+};
+check_syscall_args(compat_12_sys_swapon)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_getitimer_args {
+	syscallarg(int) which;
+	syscallarg(struct itimerval50 *) itv;
+};
+check_syscall_args(compat_50_sys_getitimer)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_gethostname_args {
+	syscallarg(char *) hostname;
+	syscallarg(u_int) len;
+};
+check_syscall_args(compat_43_sys_gethostname)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_sethostname_args {
+	syscallarg(char *) hostname;
+	syscallarg(u_int) len;
+};
+check_syscall_args(compat_43_sys_sethostname)
+#endif /* !RUMP_CLIENT */
+
+struct sys_dup2_args {
+	syscallarg(int) from;
+	syscallarg(int) to;
+};
+check_syscall_args(sys_dup2)
+
+struct sys_fcntl_args {
+	syscallarg(int) fd;
+	syscallarg(int) cmd;
+	syscallarg(void *) arg;
+};
+check_syscall_args(sys_fcntl)
+
+struct compat_50_sys_select_args {
+	syscallarg(int) nd;
+	syscallarg(fd_set *) in;
+	syscallarg(fd_set *) ou;
+	syscallarg(fd_set *) ex;
+	syscallarg(struct timeval50 *) tv;
+};
+check_syscall_args(compat_50_sys_select)
+
+struct sys_fsync_args {
+	syscallarg(int) fd;
+};
+check_syscall_args(sys_fsync)
+
+#ifndef RUMP_CLIENT
+struct sys_setpriority_args {
+	syscallarg(int) which;
+	syscallarg(id_t) who;
+	syscallarg(int) prio;
+};
+check_syscall_args(sys_setpriority)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys_socket_args {
+	syscallarg(int) domain;
+	syscallarg(int) type;
+	syscallarg(int) protocol;
+};
+check_syscall_args(compat_30_sys_socket)
+#endif /* !RUMP_CLIENT */
+
+struct sys_connect_args {
+	syscallarg(int) s;
+	syscallarg(const struct sockaddr *) name;
+	syscallarg(socklen_t) namelen;
+};
+check_syscall_args(sys_connect)
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_accept_args {
+	syscallarg(int) s;
+	syscallarg(void *) name;
+	syscallarg(socklen_t *) anamelen;
+};
+check_syscall_args(compat_43_sys_accept)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_getpriority_args {
+	syscallarg(int) which;
+	syscallarg(id_t) who;
+};
+check_syscall_args(sys_getpriority)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_send_args {
+	syscallarg(int) s;
+	syscallarg(void *) buf;
+	syscallarg(int) len;
+	syscallarg(int) flags;
+};
+check_syscall_args(compat_43_sys_send)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_recv_args {
+	syscallarg(int) s;
+	syscallarg(void *) buf;
+	syscallarg(int) len;
+	syscallarg(int) flags;
+};
+check_syscall_args(compat_43_sys_recv)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_13_sys_sigreturn_args {
+	syscallarg(struct sigcontext13 *) sigcntxp;
+};
+check_syscall_args(compat_13_sys_sigreturn)
+#endif /* !RUMP_CLIENT */
+
+struct sys_bind_args {
+	syscallarg(int) s;
+	syscallarg(const struct sockaddr *) name;
+	syscallarg(socklen_t) namelen;
+};
+check_syscall_args(sys_bind)
+
+struct sys_setsockopt_args {
+	syscallarg(int) s;
+	syscallarg(int) level;
+	syscallarg(int) name;
+	syscallarg(const void *) val;
+	syscallarg(socklen_t) valsize;
+};
+check_syscall_args(sys_setsockopt)
+
+struct sys_listen_args {
+	syscallarg(int) s;
+	syscallarg(int) backlog;
+};
+check_syscall_args(sys_listen)
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_sigvec_args {
+	syscallarg(int) signum;
+	syscallarg(struct sigvec *) nsv;
+	syscallarg(struct sigvec *) osv;
+};
+check_syscall_args(compat_43_sys_sigvec)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_sigblock_args {
+	syscallarg(int) mask;
+};
+check_syscall_args(compat_43_sys_sigblock)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_sigsetmask_args {
+	syscallarg(int) mask;
+};
+check_syscall_args(compat_43_sys_sigsetmask)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_13_sys_sigsuspend_args {
+	syscallarg(int) mask;
+};
+check_syscall_args(compat_13_sys_sigsuspend)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_sigstack_args {
+	syscallarg(struct sigstack *) nss;
+	syscallarg(struct sigstack *) oss;
+};
+check_syscall_args(compat_43_sys_sigstack)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_recvmsg_args {
+	syscallarg(int) s;
+	syscallarg(struct omsghdr *) msg;
+	syscallarg(int) flags;
+};
+check_syscall_args(compat_43_sys_recvmsg)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_sendmsg_args {
+	syscallarg(int) s;
+	syscallarg(void *) msg;
+	syscallarg(int) flags;
+};
+check_syscall_args(compat_43_sys_sendmsg)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_gettimeofday_args {
+	syscallarg(struct timeval50 *) tp;
+	syscallarg(void *) tzp;
+};
+check_syscall_args(compat_50_sys_gettimeofday)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_getrusage_args {
+	syscallarg(int) who;
+	syscallarg(struct rusage50 *) rusage;
+};
+check_syscall_args(compat_50_sys_getrusage)
+#endif /* !RUMP_CLIENT */
+
+struct sys_getsockopt_args {
+	syscallarg(int) s;
+	syscallarg(int) level;
+	syscallarg(int) name;
+	syscallarg(void *) val;
+	syscallarg(socklen_t *) avalsize;
+};
+check_syscall_args(sys_getsockopt)
+
+struct sys_readv_args {
+	syscallarg(int) fd;
+	syscallarg(const struct iovec *) iovp;
+	syscallarg(int) iovcnt;
+};
+check_syscall_args(sys_readv)
+
+struct sys_writev_args {
+	syscallarg(int) fd;
+	syscallarg(const struct iovec *) iovp;
+	syscallarg(int) iovcnt;
+};
+check_syscall_args(sys_writev)
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_settimeofday_args {
+	syscallarg(const struct timeval50 *) tv;
+	syscallarg(const void *) tzp;
+};
+check_syscall_args(compat_50_sys_settimeofday)
+#endif /* !RUMP_CLIENT */
+
+struct sys_fchown_args {
+	syscallarg(int) fd;
+	syscallarg(uid_t) uid;
+	syscallarg(gid_t) gid;
+};
+check_syscall_args(sys_fchown)
+
+struct sys_fchmod_args {
+	syscallarg(int) fd;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(sys_fchmod)
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_recvfrom_args {
+	syscallarg(int) s;
+	syscallarg(void *) buf;
+	syscallarg(size_t) len;
+	syscallarg(int) flags;
+	syscallarg(void *) from;
+	syscallarg(socklen_t *) fromlenaddr;
+};
+check_syscall_args(compat_43_sys_recvfrom)
+#endif /* !RUMP_CLIENT */
+
+struct sys_setreuid_args {
+	syscallarg(uid_t) ruid;
+	syscallarg(uid_t) euid;
+};
+check_syscall_args(sys_setreuid)
+
+struct sys_setregid_args {
+	syscallarg(gid_t) rgid;
+	syscallarg(gid_t) egid;
+};
+check_syscall_args(sys_setregid)
+
+struct sys_rename_args {
+	syscallarg(const char *) from;
+	syscallarg(const char *) to;
+};
+check_syscall_args(sys_rename)
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_truncate_args {
+	syscallarg(const char *) path;
+	syscallarg(long) length;
+};
+check_syscall_args(compat_43_sys_truncate)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_ftruncate_args {
+	syscallarg(int) fd;
+	syscallarg(long) length;
+};
+check_syscall_args(compat_43_sys_ftruncate)
+#endif /* !RUMP_CLIENT */
+
+struct sys_flock_args {
+	syscallarg(int) fd;
+	syscallarg(int) how;
+};
+check_syscall_args(sys_flock)
+
+struct sys_mkfifo_args {
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(sys_mkfifo)
+
+struct sys_sendto_args {
+	syscallarg(int) s;
+	syscallarg(const void *) buf;
+	syscallarg(size_t) len;
+	syscallarg(int) flags;
+	syscallarg(const struct sockaddr *) to;
+	syscallarg(socklen_t) tolen;
+};
+check_syscall_args(sys_sendto)
+
+struct sys_shutdown_args {
+	syscallarg(int) s;
+	syscallarg(int) how;
+};
+check_syscall_args(sys_shutdown)
+
+struct sys_socketpair_args {
+	syscallarg(int) domain;
+	syscallarg(int) type;
+	syscallarg(int) protocol;
+	syscallarg(int *) rsv;
+};
+check_syscall_args(sys_socketpair)
+
+struct sys_mkdir_args {
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(sys_mkdir)
+
+struct sys_rmdir_args {
+	syscallarg(const char *) path;
+};
+check_syscall_args(sys_rmdir)
+
+struct compat_50_sys_utimes_args {
+	syscallarg(const char *) path;
+	syscallarg(const struct timeval50 *) tptr;
+};
+check_syscall_args(compat_50_sys_utimes)
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_adjtime_args {
+	syscallarg(const struct timeval50 *) delta;
+	syscallarg(struct timeval50 *) olddelta;
+};
+check_syscall_args(compat_50_sys_adjtime)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_getpeername_args {
+	syscallarg(int) fdes;
+	syscallarg(void *) asa;
+	syscallarg(socklen_t *) alen;
+};
+check_syscall_args(compat_43_sys_getpeername)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_sethostid_args {
+	syscallarg(int32_t) hostid;
+};
+check_syscall_args(compat_43_sys_sethostid)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_getrlimit_args {
+	syscallarg(int) which;
+	syscallarg(struct orlimit *) rlp;
+};
+check_syscall_args(compat_43_sys_getrlimit)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_setrlimit_args {
+	syscallarg(int) which;
+	syscallarg(const struct orlimit *) rlp;
+};
+check_syscall_args(compat_43_sys_setrlimit)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_killpg_args {
+	syscallarg(int) pgid;
+	syscallarg(int) signum;
+};
+check_syscall_args(compat_43_sys_killpg)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_quotactl_args {
+	syscallarg(const char *) path;
+	syscallarg(int) cmd;
+	syscallarg(int) uid;
+	syscallarg(void *) arg;
+};
+check_syscall_args(compat_50_sys_quotactl)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_getsockname_args {
+	syscallarg(int) fdec;
+	syscallarg(void *) asa;
+	syscallarg(socklen_t *) alen;
+};
+check_syscall_args(compat_43_sys_getsockname)
+#endif /* !RUMP_CLIENT */
+
+struct sys_nfssvc_args {
+	syscallarg(int) flag;
+	syscallarg(void *) argp;
+};
+check_syscall_args(sys_nfssvc)
+
+#ifndef RUMP_CLIENT
+struct compat_43_sys_getdirentries_args {
+	syscallarg(int) fd;
+	syscallarg(char *) buf;
+	syscallarg(u_int) count;
+	syscallarg(long *) basep;
+};
+check_syscall_args(compat_43_sys_getdirentries)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_20_sys_statfs_args {
+	syscallarg(const char *) path;
+	syscallarg(struct statfs12 *) buf;
+};
+check_syscall_args(compat_20_sys_statfs)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_20_sys_fstatfs_args {
+	syscallarg(int) fd;
+	syscallarg(struct statfs12 *) buf;
+};
+check_syscall_args(compat_20_sys_fstatfs)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys_getfh_args {
+	syscallarg(const char *) fname;
+	syscallarg(struct compat_30_fhandle *) fhp;
+};
+check_syscall_args(compat_30_sys_getfh)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_09_sys_getdomainname_args {
+	syscallarg(char *) domainname;
+	syscallarg(int) len;
+};
+check_syscall_args(compat_09_sys_getdomainname)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_09_sys_setdomainname_args {
+	syscallarg(char *) domainname;
+	syscallarg(int) len;
+};
+check_syscall_args(compat_09_sys_setdomainname)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_09_sys_uname_args {
+	syscallarg(struct outsname *) name;
+};
+check_syscall_args(compat_09_sys_uname)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_sysarch_args {
+	syscallarg(int) op;
+	syscallarg(void *) parms;
+};
+check_syscall_args(sys_sysarch)
+#endif /* !RUMP_CLIENT */
+#if !defined(_LP64)
+
+#ifndef RUMP_CLIENT
+struct compat_10_sys_semsys_args {
+	syscallarg(int) which;
+	syscallarg(int) a2;
+	syscallarg(int) a3;
+	syscallarg(int) a4;
+	syscallarg(int) a5;
+};
+check_syscall_args(compat_10_sys_semsys)
+#endif /* !RUMP_CLIENT */
+#else
+#endif
+#if !defined(_LP64)
+
+#ifndef RUMP_CLIENT
+struct compat_10_sys_msgsys_args {
+	syscallarg(int) which;
+	syscallarg(int) a2;
+	syscallarg(int) a3;
+	syscallarg(int) a4;
+	syscallarg(int) a5;
+	syscallarg(int) a6;
+};
+check_syscall_args(compat_10_sys_msgsys)
+#endif /* !RUMP_CLIENT */
+#else
+#endif
+#if !defined(_LP64)
+
+#ifndef RUMP_CLIENT
+struct compat_10_sys_shmsys_args {
+	syscallarg(int) which;
+	syscallarg(int) a2;
+	syscallarg(int) a3;
+	syscallarg(int) a4;
+};
+check_syscall_args(compat_10_sys_shmsys)
+#endif /* !RUMP_CLIENT */
+#else
+#endif
+
+struct sys_pread_args {
+	syscallarg(int) fd;
+	syscallarg(void *) buf;
+	syscallarg(size_t) nbyte;
+	syscallarg(int) PAD;
+	syscallarg(off_t) offset;
+};
+check_syscall_args(sys_pread)
+
+struct sys_pwrite_args {
+	syscallarg(int) fd;
+	syscallarg(const void *) buf;
+	syscallarg(size_t) nbyte;
+	syscallarg(int) PAD;
+	syscallarg(off_t) offset;
+};
+check_syscall_args(sys_pwrite)
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys_ntp_gettime_args {
+	syscallarg(struct ntptimeval30 *) ntvp;
+};
+check_syscall_args(compat_30_sys_ntp_gettime)
+#endif /* !RUMP_CLIENT */
+#if defined(NTP) || !defined(_KERNEL_OPT)
+
+#ifndef RUMP_CLIENT
+struct sys_ntp_adjtime_args {
+	syscallarg(struct timex *) tp;
+};
+check_syscall_args(sys_ntp_adjtime)
+#endif /* !RUMP_CLIENT */
+#else
+#endif
+
+struct sys_setgid_args {
+	syscallarg(gid_t) gid;
+};
+check_syscall_args(sys_setgid)
+
+struct sys_setegid_args {
+	syscallarg(gid_t) egid;
+};
+check_syscall_args(sys_setegid)
+
+struct sys_seteuid_args {
+	syscallarg(uid_t) euid;
+};
+check_syscall_args(sys_seteuid)
+
+#ifndef RUMP_CLIENT
+struct sys_lfs_bmapv_args {
+	syscallarg(fsid_t *) fsidp;
+	syscallarg(struct block_info *) blkiov;
+	syscallarg(int) blkcnt;
+};
+check_syscall_args(sys_lfs_bmapv)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_lfs_markv_args {
+	syscallarg(fsid_t *) fsidp;
+	syscallarg(struct block_info *) blkiov;
+	syscallarg(int) blkcnt;
+};
+check_syscall_args(sys_lfs_markv)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_lfs_segclean_args {
+	syscallarg(fsid_t *) fsidp;
+	syscallarg(u_long) segment;
+};
+check_syscall_args(sys_lfs_segclean)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_lfs_segwait_args {
+	syscallarg(fsid_t *) fsidp;
+	syscallarg(struct timeval50 *) tv;
+};
+check_syscall_args(compat_50_sys_lfs_segwait)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_12_sys_stat_args {
+	syscallarg(const char *) path;
+	syscallarg(struct stat12 *) ub;
+};
+check_syscall_args(compat_12_sys_stat)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_12_sys_fstat_args {
+	syscallarg(int) fd;
+	syscallarg(struct stat12 *) sb;
+};
+check_syscall_args(compat_12_sys_fstat)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_12_sys_lstat_args {
+	syscallarg(const char *) path;
+	syscallarg(struct stat12 *) ub;
+};
+check_syscall_args(compat_12_sys_lstat)
+#endif /* !RUMP_CLIENT */
+
+struct sys_pathconf_args {
+	syscallarg(const char *) path;
+	syscallarg(int) name;
+};
+check_syscall_args(sys_pathconf)
+
+struct sys_fpathconf_args {
+	syscallarg(int) fd;
+	syscallarg(int) name;
+};
+check_syscall_args(sys_fpathconf)
+
+struct sys_getrlimit_args {
+	syscallarg(int) which;
+	syscallarg(struct rlimit *) rlp;
+};
+check_syscall_args(sys_getrlimit)
+
+struct sys_setrlimit_args {
+	syscallarg(int) which;
+	syscallarg(const struct rlimit *) rlp;
+};
+check_syscall_args(sys_setrlimit)
+
+#ifndef RUMP_CLIENT
+struct compat_12_sys_getdirentries_args {
+	syscallarg(int) fd;
+	syscallarg(char *) buf;
+	syscallarg(u_int) count;
+	syscallarg(long *) basep;
+};
+check_syscall_args(compat_12_sys_getdirentries)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_mmap_args {
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+	syscallarg(int) prot;
+	syscallarg(int) flags;
+	syscallarg(int) fd;
+	syscallarg(long) PAD;
+	syscallarg(off_t) pos;
+};
+check_syscall_args(sys_mmap)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___syscall_args {
+	syscallarg(quad_t) code;
+	syscallarg(register_t) args[SYS_MAXSYSARGS];
+};
+#endif /* !RUMP_CLIENT */
+
+struct sys_lseek_args {
+	syscallarg(int) fd;
+	syscallarg(int) PAD;
+	syscallarg(off_t) offset;
+	syscallarg(int) whence;
+};
+check_syscall_args(sys_lseek)
+
+struct sys_truncate_args {
+	syscallarg(const char *) path;
+	syscallarg(int) PAD;
+	syscallarg(off_t) length;
+};
+check_syscall_args(sys_truncate)
+
+struct sys_ftruncate_args {
+	syscallarg(int) fd;
+	syscallarg(int) PAD;
+	syscallarg(off_t) length;
+};
+check_syscall_args(sys_ftruncate)
+
+struct sys___sysctl_args {
+	syscallarg(const int *) name;
+	syscallarg(u_int) namelen;
+	syscallarg(void *) oldv;
+	syscallarg(size_t *) oldlenp;
+	syscallarg(const void *) newv;
+	syscallarg(size_t) newlen;
+};
+check_syscall_args(sys___sysctl)
+
+#ifndef RUMP_CLIENT
+struct sys_mlock_args {
+	syscallarg(const void *) addr;
+	syscallarg(size_t) len;
+};
+check_syscall_args(sys_mlock)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_munlock_args {
+	syscallarg(const void *) addr;
+	syscallarg(size_t) len;
+};
+check_syscall_args(sys_munlock)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_undelete_args {
+	syscallarg(const char *) path;
+};
+check_syscall_args(sys_undelete)
+#endif /* !RUMP_CLIENT */
+
+struct compat_50_sys_futimes_args {
+	syscallarg(int) fd;
+	syscallarg(const struct timeval50 *) tptr;
+};
+check_syscall_args(compat_50_sys_futimes)
+
+struct sys_getpgid_args {
+	syscallarg(pid_t) pid;
+};
+check_syscall_args(sys_getpgid)
+
+struct sys_reboot_args {
+	syscallarg(int) opt;
+	syscallarg(char *) bootstr;
+};
+check_syscall_args(sys_reboot)
+
+struct sys_poll_args {
+	syscallarg(struct pollfd *) fds;
+	syscallarg(u_int) nfds;
+	syscallarg(int) timeout;
+};
+check_syscall_args(sys_poll)
+
+#ifndef RUMP_CLIENT
+struct sys_afssys_args {
+	syscallarg(long) id;
+	syscallarg(long) a1;
+	syscallarg(long) a2;
+	syscallarg(long) a3;
+	syscallarg(long) a4;
+	syscallarg(long) a5;
+	syscallarg(long) a6;
+};
+check_syscall_args(sys_afssys)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_14_sys___semctl_args {
+	syscallarg(int) semid;
+	syscallarg(int) semnum;
+	syscallarg(int) cmd;
+	syscallarg(union __semun *) arg;
+};
+check_syscall_args(compat_14_sys___semctl)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_semget_args {
+	syscallarg(key_t) key;
+	syscallarg(int) nsems;
+	syscallarg(int) semflg;
+};
+check_syscall_args(sys_semget)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_semop_args {
+	syscallarg(int) semid;
+	syscallarg(struct sembuf *) sops;
+	syscallarg(size_t) nsops;
+};
+check_syscall_args(sys_semop)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_semconfig_args {
+	syscallarg(int) flag;
+};
+check_syscall_args(sys_semconfig)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_14_sys_msgctl_args {
+	syscallarg(int) msqid;
+	syscallarg(int) cmd;
+	syscallarg(struct msqid_ds14 *) buf;
+};
+check_syscall_args(compat_14_sys_msgctl)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_msgget_args {
+	syscallarg(key_t) key;
+	syscallarg(int) msgflg;
+};
+check_syscall_args(sys_msgget)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_msgsnd_args {
+	syscallarg(int) msqid;
+	syscallarg(const void *) msgp;
+	syscallarg(size_t) msgsz;
+	syscallarg(int) msgflg;
+};
+check_syscall_args(sys_msgsnd)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_msgrcv_args {
+	syscallarg(int) msqid;
+	syscallarg(void *) msgp;
+	syscallarg(size_t) msgsz;
+	syscallarg(long) msgtyp;
+	syscallarg(int) msgflg;
+};
+check_syscall_args(sys_msgrcv)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_shmat_args {
+	syscallarg(int) shmid;
+	syscallarg(const void *) shmaddr;
+	syscallarg(int) shmflg;
+};
+check_syscall_args(sys_shmat)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_14_sys_shmctl_args {
+	syscallarg(int) shmid;
+	syscallarg(int) cmd;
+	syscallarg(struct shmid_ds14 *) buf;
+};
+check_syscall_args(compat_14_sys_shmctl)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_shmdt_args {
+	syscallarg(const void *) shmaddr;
+};
+check_syscall_args(sys_shmdt)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_shmget_args {
+	syscallarg(key_t) key;
+	syscallarg(size_t) size;
+	syscallarg(int) shmflg;
+};
+check_syscall_args(sys_shmget)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_clock_gettime_args {
+	syscallarg(clockid_t) clock_id;
+	syscallarg(struct timespec50 *) tp;
+};
+check_syscall_args(compat_50_sys_clock_gettime)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_clock_settime_args {
+	syscallarg(clockid_t) clock_id;
+	syscallarg(const struct timespec50 *) tp;
+};
+check_syscall_args(compat_50_sys_clock_settime)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_clock_getres_args {
+	syscallarg(clockid_t) clock_id;
+	syscallarg(struct timespec50 *) tp;
+};
+check_syscall_args(compat_50_sys_clock_getres)
+#endif /* !RUMP_CLIENT */
+
+struct sys_timer_create_args {
+	syscallarg(clockid_t) clock_id;
+	syscallarg(struct sigevent *) evp;
+	syscallarg(timer_t *) timerid;
+};
+check_syscall_args(sys_timer_create)
+
+struct sys_timer_delete_args {
+	syscallarg(timer_t) timerid;
+};
+check_syscall_args(sys_timer_delete)
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_timer_settime_args {
+	syscallarg(timer_t) timerid;
+	syscallarg(int) flags;
+	syscallarg(const struct itimerspec50 *) value;
+	syscallarg(struct itimerspec50 *) ovalue;
+};
+check_syscall_args(compat_50_sys_timer_settime)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_timer_gettime_args {
+	syscallarg(timer_t) timerid;
+	syscallarg(struct itimerspec50 *) value;
+};
+check_syscall_args(compat_50_sys_timer_gettime)
+#endif /* !RUMP_CLIENT */
+
+struct sys_timer_getoverrun_args {
+	syscallarg(timer_t) timerid;
+};
+check_syscall_args(sys_timer_getoverrun)
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_nanosleep_args {
+	syscallarg(const struct timespec50 *) rqtp;
+	syscallarg(struct timespec50 *) rmtp;
+};
+check_syscall_args(compat_50_sys_nanosleep)
+#endif /* !RUMP_CLIENT */
+
+struct sys_fdatasync_args {
+	syscallarg(int) fd;
+};
+check_syscall_args(sys_fdatasync)
+
+#ifndef RUMP_CLIENT
+struct sys_mlockall_args {
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_mlockall)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys___sigtimedwait_args {
+	syscallarg(const sigset_t *) set;
+	syscallarg(siginfo_t *) info;
+	syscallarg(struct timespec50 *) timeout;
+};
+check_syscall_args(compat_50_sys___sigtimedwait)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_sigqueueinfo_args {
+	syscallarg(pid_t) pid;
+	syscallarg(const siginfo_t *) info;
+};
+check_syscall_args(sys_sigqueueinfo)
+#endif /* !RUMP_CLIENT */
+
+struct sys_modctl_args {
+	syscallarg(int) cmd;
+	syscallarg(void *) arg;
+};
+check_syscall_args(sys_modctl)
+
+struct sys__ksem_init_args {
+	syscallarg(unsigned int) value;
+	syscallarg(intptr_t *) idp;
+};
+check_syscall_args(sys__ksem_init)
+
+struct sys__ksem_open_args {
+	syscallarg(const char *) name;
+	syscallarg(int) oflag;
+	syscallarg(mode_t) mode;
+	syscallarg(unsigned int) value;
+	syscallarg(intptr_t *) idp;
+};
+check_syscall_args(sys__ksem_open)
+
+struct sys__ksem_unlink_args {
+	syscallarg(const char *) name;
+};
+check_syscall_args(sys__ksem_unlink)
+
+struct sys__ksem_close_args {
+	syscallarg(intptr_t) id;
+};
+check_syscall_args(sys__ksem_close)
+
+struct sys__ksem_post_args {
+	syscallarg(intptr_t) id;
+};
+check_syscall_args(sys__ksem_post)
+
+struct sys__ksem_wait_args {
+	syscallarg(intptr_t) id;
+};
+check_syscall_args(sys__ksem_wait)
+
+struct sys__ksem_trywait_args {
+	syscallarg(intptr_t) id;
+};
+check_syscall_args(sys__ksem_trywait)
+
+struct sys__ksem_getvalue_args {
+	syscallarg(intptr_t) id;
+	syscallarg(unsigned int *) value;
+};
+check_syscall_args(sys__ksem_getvalue)
+
+struct sys__ksem_destroy_args {
+	syscallarg(intptr_t) id;
+};
+check_syscall_args(sys__ksem_destroy)
+
+struct sys__ksem_timedwait_args {
+	syscallarg(intptr_t) id;
+	syscallarg(const struct timespec *) abstime;
+};
+check_syscall_args(sys__ksem_timedwait)
+
+#ifndef RUMP_CLIENT
+struct sys_mq_open_args {
+	syscallarg(const char *) name;
+	syscallarg(int) oflag;
+	syscallarg(mode_t) mode;
+	syscallarg(struct mq_attr *) attr;
+};
+check_syscall_args(sys_mq_open)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_mq_close_args {
+	syscallarg(mqd_t) mqdes;
+};
+check_syscall_args(sys_mq_close)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_mq_unlink_args {
+	syscallarg(const char *) name;
+};
+check_syscall_args(sys_mq_unlink)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_mq_getattr_args {
+	syscallarg(mqd_t) mqdes;
+	syscallarg(struct mq_attr *) mqstat;
+};
+check_syscall_args(sys_mq_getattr)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_mq_setattr_args {
+	syscallarg(mqd_t) mqdes;
+	syscallarg(const struct mq_attr *) mqstat;
+	syscallarg(struct mq_attr *) omqstat;
+};
+check_syscall_args(sys_mq_setattr)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_mq_notify_args {
+	syscallarg(mqd_t) mqdes;
+	syscallarg(const struct sigevent *) notification;
+};
+check_syscall_args(sys_mq_notify)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_mq_send_args {
+	syscallarg(mqd_t) mqdes;
+	syscallarg(const char *) msg_ptr;
+	syscallarg(size_t) msg_len;
+	syscallarg(unsigned) msg_prio;
+};
+check_syscall_args(sys_mq_send)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_mq_receive_args {
+	syscallarg(mqd_t) mqdes;
+	syscallarg(char *) msg_ptr;
+	syscallarg(size_t) msg_len;
+	syscallarg(unsigned *) msg_prio;
+};
+check_syscall_args(sys_mq_receive)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_mq_timedsend_args {
+	syscallarg(mqd_t) mqdes;
+	syscallarg(const char *) msg_ptr;
+	syscallarg(size_t) msg_len;
+	syscallarg(unsigned) msg_prio;
+	syscallarg(const struct timespec50 *) abs_timeout;
+};
+check_syscall_args(compat_50_sys_mq_timedsend)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_mq_timedreceive_args {
+	syscallarg(mqd_t) mqdes;
+	syscallarg(char *) msg_ptr;
+	syscallarg(size_t) msg_len;
+	syscallarg(unsigned *) msg_prio;
+	syscallarg(const struct timespec50 *) abs_timeout;
+};
+check_syscall_args(compat_50_sys_mq_timedreceive)
+#endif /* !RUMP_CLIENT */
+
+struct sys___posix_rename_args {
+	syscallarg(const char *) from;
+	syscallarg(const char *) to;
+};
+check_syscall_args(sys___posix_rename)
+
+#ifndef RUMP_CLIENT
+struct sys_swapctl_args {
+	syscallarg(int) cmd;
+	syscallarg(void *) arg;
+	syscallarg(int) misc;
+};
+check_syscall_args(sys_swapctl)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys_getdents_args {
+	syscallarg(int) fd;
+	syscallarg(char *) buf;
+	syscallarg(size_t) count;
+};
+check_syscall_args(compat_30_sys_getdents)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_minherit_args {
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+	syscallarg(int) inherit;
+};
+check_syscall_args(sys_minherit)
+#endif /* !RUMP_CLIENT */
+
+struct sys_lchmod_args {
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(sys_lchmod)
+
+struct sys_lchown_args {
+	syscallarg(const char *) path;
+	syscallarg(uid_t) uid;
+	syscallarg(gid_t) gid;
+};
+check_syscall_args(sys_lchown)
+
+struct compat_50_sys_lutimes_args {
+	syscallarg(const char *) path;
+	syscallarg(const struct timeval50 *) tptr;
+};
+check_syscall_args(compat_50_sys_lutimes)
+
+#ifndef RUMP_CLIENT
+struct sys___msync13_args {
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys___msync13)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys___stat13_args {
+	syscallarg(const char *) path;
+	syscallarg(struct stat13 *) ub;
+};
+check_syscall_args(compat_30_sys___stat13)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys___fstat13_args {
+	syscallarg(int) fd;
+	syscallarg(struct stat13 *) sb;
+};
+check_syscall_args(compat_30_sys___fstat13)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys___lstat13_args {
+	syscallarg(const char *) path;
+	syscallarg(struct stat13 *) ub;
+};
+check_syscall_args(compat_30_sys___lstat13)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___sigaltstack14_args {
+	syscallarg(const struct sigaltstack *) nss;
+	syscallarg(struct sigaltstack *) oss;
+};
+check_syscall_args(sys___sigaltstack14)
+#endif /* !RUMP_CLIENT */
+
+struct sys___posix_chown_args {
+	syscallarg(const char *) path;
+	syscallarg(uid_t) uid;
+	syscallarg(gid_t) gid;
+};
+check_syscall_args(sys___posix_chown)
+
+struct sys___posix_fchown_args {
+	syscallarg(int) fd;
+	syscallarg(uid_t) uid;
+	syscallarg(gid_t) gid;
+};
+check_syscall_args(sys___posix_fchown)
+
+struct sys___posix_lchown_args {
+	syscallarg(const char *) path;
+	syscallarg(uid_t) uid;
+	syscallarg(gid_t) gid;
+};
+check_syscall_args(sys___posix_lchown)
+
+struct sys_getsid_args {
+	syscallarg(pid_t) pid;
+};
+check_syscall_args(sys_getsid)
+
+#ifndef RUMP_CLIENT
+struct sys___clone_args {
+	syscallarg(int) flags;
+	syscallarg(void *) stack;
+};
+check_syscall_args(sys___clone)
+#endif /* !RUMP_CLIENT */
+
+struct sys_fktrace_args {
+	syscallarg(int) fd;
+	syscallarg(int) ops;
+	syscallarg(int) facs;
+	syscallarg(pid_t) pid;
+};
+check_syscall_args(sys_fktrace)
+
+struct sys_preadv_args {
+	syscallarg(int) fd;
+	syscallarg(const struct iovec *) iovp;
+	syscallarg(int) iovcnt;
+	syscallarg(int) PAD;
+	syscallarg(off_t) offset;
+};
+check_syscall_args(sys_preadv)
+
+struct sys_pwritev_args {
+	syscallarg(int) fd;
+	syscallarg(const struct iovec *) iovp;
+	syscallarg(int) iovcnt;
+	syscallarg(int) PAD;
+	syscallarg(off_t) offset;
+};
+check_syscall_args(sys_pwritev)
+
+#ifndef RUMP_CLIENT
+struct compat_16_sys___sigaction14_args {
+	syscallarg(int) signum;
+	syscallarg(const struct sigaction *) nsa;
+	syscallarg(struct sigaction *) osa;
+};
+check_syscall_args(compat_16_sys___sigaction14)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___sigpending14_args {
+	syscallarg(sigset_t *) set;
+};
+check_syscall_args(sys___sigpending14)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___sigprocmask14_args {
+	syscallarg(int) how;
+	syscallarg(const sigset_t *) set;
+	syscallarg(sigset_t *) oset;
+};
+check_syscall_args(sys___sigprocmask14)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___sigsuspend14_args {
+	syscallarg(const sigset_t *) set;
+};
+check_syscall_args(sys___sigsuspend14)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_16_sys___sigreturn14_args {
+	syscallarg(struct sigcontext *) sigcntxp;
+};
+check_syscall_args(compat_16_sys___sigreturn14)
+#endif /* !RUMP_CLIENT */
+
+struct sys___getcwd_args {
+	syscallarg(char *) bufp;
+	syscallarg(size_t) length;
+};
+check_syscall_args(sys___getcwd)
+
+struct sys_fchroot_args {
+	syscallarg(int) fd;
+};
+check_syscall_args(sys_fchroot)
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys_fhopen_args {
+	syscallarg(const struct compat_30_fhandle *) fhp;
+	syscallarg(int) flags;
+};
+check_syscall_args(compat_30_sys_fhopen)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys_fhstat_args {
+	syscallarg(const struct compat_30_fhandle *) fhp;
+	syscallarg(struct stat13 *) sb;
+};
+check_syscall_args(compat_30_sys_fhstat)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_20_sys_fhstatfs_args {
+	syscallarg(const struct compat_30_fhandle *) fhp;
+	syscallarg(struct statfs12 *) buf;
+};
+check_syscall_args(compat_20_sys_fhstatfs)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_____semctl13_args {
+	syscallarg(int) semid;
+	syscallarg(int) semnum;
+	syscallarg(int) cmd;
+	syscallarg(union __semun *) arg;
+};
+check_syscall_args(compat_50_sys_____semctl13)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys___msgctl13_args {
+	syscallarg(int) msqid;
+	syscallarg(int) cmd;
+	syscallarg(struct msqid_ds *) buf;
+};
+check_syscall_args(compat_50_sys___msgctl13)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys___shmctl13_args {
+	syscallarg(int) shmid;
+	syscallarg(int) cmd;
+	syscallarg(struct shmid_ds13 *) buf;
+};
+check_syscall_args(compat_50_sys___shmctl13)
+#endif /* !RUMP_CLIENT */
+
+struct sys_lchflags_args {
+	syscallarg(const char *) path;
+	syscallarg(u_long) flags;
+};
+check_syscall_args(sys_lchflags)
+
+struct sys_utrace_args {
+	syscallarg(const char *) label;
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+};
+check_syscall_args(sys_utrace)
+
+#ifndef RUMP_CLIENT
+struct sys_getcontext_args {
+	syscallarg(struct __ucontext *) ucp;
+};
+check_syscall_args(sys_getcontext)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_setcontext_args {
+	syscallarg(const struct __ucontext *) ucp;
+};
+check_syscall_args(sys_setcontext)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_create_args {
+	syscallarg(const struct __ucontext *) ucp;
+	syscallarg(u_long) flags;
+	syscallarg(lwpid_t *) new_lwp;
+};
+check_syscall_args(sys__lwp_create)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_wait_args {
+	syscallarg(lwpid_t) wait_for;
+	syscallarg(lwpid_t *) departed;
+};
+check_syscall_args(sys__lwp_wait)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_suspend_args {
+	syscallarg(lwpid_t) target;
+};
+check_syscall_args(sys__lwp_suspend)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_continue_args {
+	syscallarg(lwpid_t) target;
+};
+check_syscall_args(sys__lwp_continue)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_wakeup_args {
+	syscallarg(lwpid_t) target;
+};
+check_syscall_args(sys__lwp_wakeup)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_setprivate_args {
+	syscallarg(void *) ptr;
+};
+check_syscall_args(sys__lwp_setprivate)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_kill_args {
+	syscallarg(lwpid_t) target;
+	syscallarg(int) signo;
+};
+check_syscall_args(sys__lwp_kill)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_detach_args {
+	syscallarg(lwpid_t) target;
+};
+check_syscall_args(sys__lwp_detach)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys__lwp_park_args {
+	syscallarg(const struct timespec50 *) ts;
+	syscallarg(lwpid_t) unpark;
+	syscallarg(const void *) hint;
+	syscallarg(const void *) unparkhint;
+};
+check_syscall_args(compat_50_sys__lwp_park)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_unpark_args {
+	syscallarg(lwpid_t) target;
+	syscallarg(const void *) hint;
+};
+check_syscall_args(sys__lwp_unpark)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_unpark_all_args {
+	syscallarg(const lwpid_t *) targets;
+	syscallarg(size_t) ntargets;
+	syscallarg(const void *) hint;
+};
+check_syscall_args(sys__lwp_unpark_all)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_setname_args {
+	syscallarg(lwpid_t) target;
+	syscallarg(const char *) name;
+};
+check_syscall_args(sys__lwp_setname)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_getname_args {
+	syscallarg(lwpid_t) target;
+	syscallarg(char *) name;
+	syscallarg(size_t) len;
+};
+check_syscall_args(sys__lwp_getname)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__lwp_ctl_args {
+	syscallarg(int) features;
+	syscallarg(struct lwpctl **) address;
+};
+check_syscall_args(sys__lwp_ctl)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_60_sys_sa_register_args {
+	syscallarg(void *) newv;
+	syscallarg(void **) oldv;
+	syscallarg(int) flags;
+	syscallarg(ssize_t) stackinfo_offset;
+};
+check_syscall_args(compat_60_sys_sa_register)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_60_sys_sa_stacks_args {
+	syscallarg(int) num;
+	syscallarg(stack_t *) stacks;
+};
+check_syscall_args(compat_60_sys_sa_stacks)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_60_sys_sa_setconcurrency_args {
+	syscallarg(int) concurrency;
+};
+check_syscall_args(compat_60_sys_sa_setconcurrency)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_60_sys_sa_preempt_args {
+	syscallarg(int) sa_id;
+};
+check_syscall_args(compat_60_sys_sa_preempt)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___sigaction_sigtramp_args {
+	syscallarg(int) signum;
+	syscallarg(const struct sigaction *) nsa;
+	syscallarg(struct sigaction *) osa;
+	syscallarg(const void *) tramp;
+	syscallarg(int) vers;
+};
+check_syscall_args(sys___sigaction_sigtramp)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_pmc_get_info_args {
+	syscallarg(int) ctr;
+	syscallarg(int) op;
+	syscallarg(void *) args;
+};
+check_syscall_args(sys_pmc_get_info)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_pmc_control_args {
+	syscallarg(int) ctr;
+	syscallarg(int) op;
+	syscallarg(void *) args;
+};
+check_syscall_args(sys_pmc_control)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_rasctl_args {
+	syscallarg(void *) addr;
+	syscallarg(size_t) len;
+	syscallarg(int) op;
+};
+check_syscall_args(sys_rasctl)
+#endif /* !RUMP_CLIENT */
+
+struct compat_50_sys_kevent_args {
+	syscallarg(int) fd;
+	syscallarg(const struct kevent *) changelist;
+	syscallarg(size_t) nchanges;
+	syscallarg(struct kevent *) eventlist;
+	syscallarg(size_t) nevents;
+	syscallarg(const struct timespec50 *) timeout;
+};
+check_syscall_args(compat_50_sys_kevent)
+
+#ifndef RUMP_CLIENT
+struct sys__sched_setparam_args {
+	syscallarg(pid_t) pid;
+	syscallarg(lwpid_t) lid;
+	syscallarg(int) policy;
+	syscallarg(const struct sched_param *) params;
+};
+check_syscall_args(sys__sched_setparam)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__sched_getparam_args {
+	syscallarg(pid_t) pid;
+	syscallarg(lwpid_t) lid;
+	syscallarg(int *) policy;
+	syscallarg(struct sched_param *) params;
+};
+check_syscall_args(sys__sched_getparam)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__sched_setaffinity_args {
+	syscallarg(pid_t) pid;
+	syscallarg(lwpid_t) lid;
+	syscallarg(size_t) size;
+	syscallarg(const cpuset_t *) cpuset;
+};
+check_syscall_args(sys__sched_setaffinity)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__sched_getaffinity_args {
+	syscallarg(pid_t) pid;
+	syscallarg(lwpid_t) lid;
+	syscallarg(size_t) size;
+	syscallarg(cpuset_t *) cpuset;
+};
+check_syscall_args(sys__sched_getaffinity)
+#endif /* !RUMP_CLIENT */
+
+struct sys_fsync_range_args {
+	syscallarg(int) fd;
+	syscallarg(int) flags;
+	syscallarg(off_t) start;
+	syscallarg(off_t) length;
+};
+check_syscall_args(sys_fsync_range)
+
+#ifndef RUMP_CLIENT
+struct sys_uuidgen_args {
+	syscallarg(struct uuid *) store;
+	syscallarg(int) count;
+};
+check_syscall_args(sys_uuidgen)
+#endif /* !RUMP_CLIENT */
+
+struct sys_getvfsstat_args {
+	syscallarg(struct statvfs *) buf;
+	syscallarg(size_t) bufsize;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_getvfsstat)
+
+struct sys_statvfs1_args {
+	syscallarg(const char *) path;
+	syscallarg(struct statvfs *) buf;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_statvfs1)
+
+struct sys_fstatvfs1_args {
+	syscallarg(int) fd;
+	syscallarg(struct statvfs *) buf;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_fstatvfs1)
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys_fhstatvfs1_args {
+	syscallarg(const struct compat_30_fhandle *) fhp;
+	syscallarg(struct statvfs *) buf;
+	syscallarg(int) flags;
+};
+check_syscall_args(compat_30_sys_fhstatvfs1)
+#endif /* !RUMP_CLIENT */
+
+struct sys_extattrctl_args {
+	syscallarg(const char *) path;
+	syscallarg(int) cmd;
+	syscallarg(const char *) filename;
+	syscallarg(int) attrnamespace;
+	syscallarg(const char *) attrname;
+};
+check_syscall_args(sys_extattrctl)
+
+struct sys_extattr_set_file_args {
+	syscallarg(const char *) path;
+	syscallarg(int) attrnamespace;
+	syscallarg(const char *) attrname;
+	syscallarg(const void *) data;
+	syscallarg(size_t) nbytes;
+};
+check_syscall_args(sys_extattr_set_file)
+
+struct sys_extattr_get_file_args {
+	syscallarg(const char *) path;
+	syscallarg(int) attrnamespace;
+	syscallarg(const char *) attrname;
+	syscallarg(void *) data;
+	syscallarg(size_t) nbytes;
+};
+check_syscall_args(sys_extattr_get_file)
+
+struct sys_extattr_delete_file_args {
+	syscallarg(const char *) path;
+	syscallarg(int) attrnamespace;
+	syscallarg(const char *) attrname;
+};
+check_syscall_args(sys_extattr_delete_file)
+
+struct sys_extattr_set_fd_args {
+	syscallarg(int) fd;
+	syscallarg(int) attrnamespace;
+	syscallarg(const char *) attrname;
+	syscallarg(const void *) data;
+	syscallarg(size_t) nbytes;
+};
+check_syscall_args(sys_extattr_set_fd)
+
+struct sys_extattr_get_fd_args {
+	syscallarg(int) fd;
+	syscallarg(int) attrnamespace;
+	syscallarg(const char *) attrname;
+	syscallarg(void *) data;
+	syscallarg(size_t) nbytes;
+};
+check_syscall_args(sys_extattr_get_fd)
+
+struct sys_extattr_delete_fd_args {
+	syscallarg(int) fd;
+	syscallarg(int) attrnamespace;
+	syscallarg(const char *) attrname;
+};
+check_syscall_args(sys_extattr_delete_fd)
+
+struct sys_extattr_set_link_args {
+	syscallarg(const char *) path;
+	syscallarg(int) attrnamespace;
+	syscallarg(const char *) attrname;
+	syscallarg(const void *) data;
+	syscallarg(size_t) nbytes;
+};
+check_syscall_args(sys_extattr_set_link)
+
+struct sys_extattr_get_link_args {
+	syscallarg(const char *) path;
+	syscallarg(int) attrnamespace;
+	syscallarg(const char *) attrname;
+	syscallarg(void *) data;
+	syscallarg(size_t) nbytes;
+};
+check_syscall_args(sys_extattr_get_link)
+
+struct sys_extattr_delete_link_args {
+	syscallarg(const char *) path;
+	syscallarg(int) attrnamespace;
+	syscallarg(const char *) attrname;
+};
+check_syscall_args(sys_extattr_delete_link)
+
+struct sys_extattr_list_fd_args {
+	syscallarg(int) fd;
+	syscallarg(int) attrnamespace;
+	syscallarg(void *) data;
+	syscallarg(size_t) nbytes;
+};
+check_syscall_args(sys_extattr_list_fd)
+
+struct sys_extattr_list_file_args {
+	syscallarg(const char *) path;
+	syscallarg(int) attrnamespace;
+	syscallarg(void *) data;
+	syscallarg(size_t) nbytes;
+};
+check_syscall_args(sys_extattr_list_file)
+
+struct sys_extattr_list_link_args {
+	syscallarg(const char *) path;
+	syscallarg(int) attrnamespace;
+	syscallarg(void *) data;
+	syscallarg(size_t) nbytes;
+};
+check_syscall_args(sys_extattr_list_link)
+
+struct compat_50_sys_pselect_args {
+	syscallarg(int) nd;
+	syscallarg(fd_set *) in;
+	syscallarg(fd_set *) ou;
+	syscallarg(fd_set *) ex;
+	syscallarg(const struct timespec50 *) ts;
+	syscallarg(const sigset_t *) mask;
+};
+check_syscall_args(compat_50_sys_pselect)
+
+struct compat_50_sys_pollts_args {
+	syscallarg(struct pollfd *) fds;
+	syscallarg(u_int) nfds;
+	syscallarg(const struct timespec50 *) ts;
+	syscallarg(const sigset_t *) mask;
+};
+check_syscall_args(compat_50_sys_pollts)
+
+struct sys_setxattr_args {
+	syscallarg(const char *) path;
+	syscallarg(const char *) name;
+	syscallarg(const void *) value;
+	syscallarg(size_t) size;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_setxattr)
+
+struct sys_lsetxattr_args {
+	syscallarg(const char *) path;
+	syscallarg(const char *) name;
+	syscallarg(const void *) value;
+	syscallarg(size_t) size;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_lsetxattr)
+
+struct sys_fsetxattr_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) name;
+	syscallarg(const void *) value;
+	syscallarg(size_t) size;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_fsetxattr)
+
+struct sys_getxattr_args {
+	syscallarg(const char *) path;
+	syscallarg(const char *) name;
+	syscallarg(void *) value;
+	syscallarg(size_t) size;
+};
+check_syscall_args(sys_getxattr)
+
+struct sys_lgetxattr_args {
+	syscallarg(const char *) path;
+	syscallarg(const char *) name;
+	syscallarg(void *) value;
+	syscallarg(size_t) size;
+};
+check_syscall_args(sys_lgetxattr)
+
+struct sys_fgetxattr_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) name;
+	syscallarg(void *) value;
+	syscallarg(size_t) size;
+};
+check_syscall_args(sys_fgetxattr)
+
+struct sys_listxattr_args {
+	syscallarg(const char *) path;
+	syscallarg(char *) list;
+	syscallarg(size_t) size;
+};
+check_syscall_args(sys_listxattr)
+
+struct sys_llistxattr_args {
+	syscallarg(const char *) path;
+	syscallarg(char *) list;
+	syscallarg(size_t) size;
+};
+check_syscall_args(sys_llistxattr)
+
+struct sys_flistxattr_args {
+	syscallarg(int) fd;
+	syscallarg(char *) list;
+	syscallarg(size_t) size;
+};
+check_syscall_args(sys_flistxattr)
+
+struct sys_removexattr_args {
+	syscallarg(const char *) path;
+	syscallarg(const char *) name;
+};
+check_syscall_args(sys_removexattr)
+
+struct sys_lremovexattr_args {
+	syscallarg(const char *) path;
+	syscallarg(const char *) name;
+};
+check_syscall_args(sys_lremovexattr)
+
+struct sys_fremovexattr_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) name;
+};
+check_syscall_args(sys_fremovexattr)
+
+struct compat_50_sys___stat30_args {
+	syscallarg(const char *) path;
+	syscallarg(struct stat30 *) ub;
+};
+check_syscall_args(compat_50_sys___stat30)
+
+struct compat_50_sys___fstat30_args {
+	syscallarg(int) fd;
+	syscallarg(struct stat30 *) sb;
+};
+check_syscall_args(compat_50_sys___fstat30)
+
+struct compat_50_sys___lstat30_args {
+	syscallarg(const char *) path;
+	syscallarg(struct stat30 *) ub;
+};
+check_syscall_args(compat_50_sys___lstat30)
+
+struct sys___getdents30_args {
+	syscallarg(int) fd;
+	syscallarg(char *) buf;
+	syscallarg(size_t) count;
+};
+check_syscall_args(sys___getdents30)
+
+#ifndef RUMP_CLIENT
+struct compat_30_sys___fhstat30_args {
+	syscallarg(const struct compat_30_fhandle *) fhp;
+	syscallarg(struct stat30 *) sb;
+};
+check_syscall_args(compat_30_sys___fhstat30)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys___ntp_gettime30_args {
+	syscallarg(struct ntptimeval50 *) ntvp;
+};
+check_syscall_args(compat_50_sys___ntp_gettime30)
+#endif /* !RUMP_CLIENT */
+
+struct sys___socket30_args {
+	syscallarg(int) domain;
+	syscallarg(int) type;
+	syscallarg(int) protocol;
+};
+check_syscall_args(sys___socket30)
+
+struct sys___getfh30_args {
+	syscallarg(const char *) fname;
+	syscallarg(void *) fhp;
+	syscallarg(size_t *) fh_size;
+};
+check_syscall_args(sys___getfh30)
+
+struct sys___fhopen40_args {
+	syscallarg(const void *) fhp;
+	syscallarg(size_t) fh_size;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys___fhopen40)
+
+struct sys___fhstatvfs140_args {
+	syscallarg(const void *) fhp;
+	syscallarg(size_t) fh_size;
+	syscallarg(struct statvfs *) buf;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys___fhstatvfs140)
+
+struct compat_50_sys___fhstat40_args {
+	syscallarg(const void *) fhp;
+	syscallarg(size_t) fh_size;
+	syscallarg(struct stat30 *) sb;
+};
+check_syscall_args(compat_50_sys___fhstat40)
+
+struct sys_aio_cancel_args {
+	syscallarg(int) fildes;
+	syscallarg(struct aiocb *) aiocbp;
+};
+check_syscall_args(sys_aio_cancel)
+
+struct sys_aio_error_args {
+	syscallarg(const struct aiocb *) aiocbp;
+};
+check_syscall_args(sys_aio_error)
+
+struct sys_aio_fsync_args {
+	syscallarg(int) op;
+	syscallarg(struct aiocb *) aiocbp;
+};
+check_syscall_args(sys_aio_fsync)
+
+struct sys_aio_read_args {
+	syscallarg(struct aiocb *) aiocbp;
+};
+check_syscall_args(sys_aio_read)
+
+struct sys_aio_return_args {
+	syscallarg(struct aiocb *) aiocbp;
+};
+check_syscall_args(sys_aio_return)
+
+#ifndef RUMP_CLIENT
+struct compat_50_sys_aio_suspend_args {
+	syscallarg(const struct aiocb *const *) list;
+	syscallarg(int) nent;
+	syscallarg(const struct timespec50 *) timeout;
+};
+check_syscall_args(compat_50_sys_aio_suspend)
+#endif /* !RUMP_CLIENT */
+
+struct sys_aio_write_args {
+	syscallarg(struct aiocb *) aiocbp;
+};
+check_syscall_args(sys_aio_write)
+
+struct sys_lio_listio_args {
+	syscallarg(int) mode;
+	syscallarg(struct aiocb *const *) list;
+	syscallarg(int) nent;
+	syscallarg(struct sigevent *) sig;
+};
+check_syscall_args(sys_lio_listio)
+
+struct sys___mount50_args {
+	syscallarg(const char *) type;
+	syscallarg(const char *) path;
+	syscallarg(int) flags;
+	syscallarg(void *) data;
+	syscallarg(size_t) data_len;
+};
+check_syscall_args(sys___mount50)
+
+#ifndef RUMP_CLIENT
+struct sys_mremap_args {
+	syscallarg(void *) old_address;
+	syscallarg(size_t) old_size;
+	syscallarg(void *) new_address;
+	syscallarg(size_t) new_size;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_mremap)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_pset_create_args {
+	syscallarg(psetid_t *) psid;
+};
+check_syscall_args(sys_pset_create)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_pset_destroy_args {
+	syscallarg(psetid_t) psid;
+};
+check_syscall_args(sys_pset_destroy)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys_pset_assign_args {
+	syscallarg(psetid_t) psid;
+	syscallarg(cpuid_t) cpuid;
+	syscallarg(psetid_t *) opsid;
+};
+check_syscall_args(sys_pset_assign)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys__pset_bind_args {
+	syscallarg(idtype_t) idtype;
+	syscallarg(id_t) first_id;
+	syscallarg(id_t) second_id;
+	syscallarg(psetid_t) psid;
+	syscallarg(psetid_t *) opsid;
+};
+check_syscall_args(sys__pset_bind)
+#endif /* !RUMP_CLIENT */
+
+struct sys___posix_fadvise50_args {
+	syscallarg(int) fd;
+	syscallarg(int) PAD;
+	syscallarg(off_t) offset;
+	syscallarg(off_t) len;
+	syscallarg(int) advice;
+};
+check_syscall_args(sys___posix_fadvise50)
+
+struct sys___select50_args {
+	syscallarg(int) nd;
+	syscallarg(fd_set *) in;
+	syscallarg(fd_set *) ou;
+	syscallarg(fd_set *) ex;
+	syscallarg(struct timeval *) tv;
+};
+check_syscall_args(sys___select50)
+
+struct sys___gettimeofday50_args {
+	syscallarg(struct timeval *) tp;
+	syscallarg(void *) tzp;
+};
+check_syscall_args(sys___gettimeofday50)
+
+struct sys___settimeofday50_args {
+	syscallarg(const struct timeval *) tv;
+	syscallarg(const void *) tzp;
+};
+check_syscall_args(sys___settimeofday50)
+
+struct sys___utimes50_args {
+	syscallarg(const char *) path;
+	syscallarg(const struct timeval *) tptr;
+};
+check_syscall_args(sys___utimes50)
+
+struct sys___adjtime50_args {
+	syscallarg(const struct timeval *) delta;
+	syscallarg(struct timeval *) olddelta;
+};
+check_syscall_args(sys___adjtime50)
+
+#ifndef RUMP_CLIENT
+struct sys___lfs_segwait50_args {
+	syscallarg(fsid_t *) fsidp;
+	syscallarg(struct timeval *) tv;
+};
+check_syscall_args(sys___lfs_segwait50)
+#endif /* !RUMP_CLIENT */
+
+struct sys___futimes50_args {
+	syscallarg(int) fd;
+	syscallarg(const struct timeval *) tptr;
+};
+check_syscall_args(sys___futimes50)
+
+struct sys___lutimes50_args {
+	syscallarg(const char *) path;
+	syscallarg(const struct timeval *) tptr;
+};
+check_syscall_args(sys___lutimes50)
+
+struct sys___setitimer50_args {
+	syscallarg(int) which;
+	syscallarg(const struct itimerval *) itv;
+	syscallarg(struct itimerval *) oitv;
+};
+check_syscall_args(sys___setitimer50)
+
+struct sys___getitimer50_args {
+	syscallarg(int) which;
+	syscallarg(struct itimerval *) itv;
+};
+check_syscall_args(sys___getitimer50)
+
+struct sys___clock_gettime50_args {
+	syscallarg(clockid_t) clock_id;
+	syscallarg(struct timespec *) tp;
+};
+check_syscall_args(sys___clock_gettime50)
+
+struct sys___clock_settime50_args {
+	syscallarg(clockid_t) clock_id;
+	syscallarg(const struct timespec *) tp;
+};
+check_syscall_args(sys___clock_settime50)
+
+struct sys___clock_getres50_args {
+	syscallarg(clockid_t) clock_id;
+	syscallarg(struct timespec *) tp;
+};
+check_syscall_args(sys___clock_getres50)
+
+struct sys___nanosleep50_args {
+	syscallarg(const struct timespec *) rqtp;
+	syscallarg(struct timespec *) rmtp;
+};
+check_syscall_args(sys___nanosleep50)
+
+#ifndef RUMP_CLIENT
+struct sys_____sigtimedwait50_args {
+	syscallarg(const sigset_t *) set;
+	syscallarg(siginfo_t *) info;
+	syscallarg(struct timespec *) timeout;
+};
+check_syscall_args(sys_____sigtimedwait50)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___mq_timedsend50_args {
+	syscallarg(mqd_t) mqdes;
+	syscallarg(const char *) msg_ptr;
+	syscallarg(size_t) msg_len;
+	syscallarg(unsigned) msg_prio;
+	syscallarg(const struct timespec *) abs_timeout;
+};
+check_syscall_args(sys___mq_timedsend50)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___mq_timedreceive50_args {
+	syscallarg(mqd_t) mqdes;
+	syscallarg(char *) msg_ptr;
+	syscallarg(size_t) msg_len;
+	syscallarg(unsigned *) msg_prio;
+	syscallarg(const struct timespec *) abs_timeout;
+};
+check_syscall_args(sys___mq_timedreceive50)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct compat_60_sys__lwp_park_args {
+	syscallarg(const struct timespec *) ts;
+	syscallarg(lwpid_t) unpark;
+	syscallarg(const void *) hint;
+	syscallarg(const void *) unparkhint;
+};
+check_syscall_args(compat_60_sys__lwp_park)
+#endif /* !RUMP_CLIENT */
+
+struct sys___kevent50_args {
+	syscallarg(int) fd;
+	syscallarg(const struct kevent *) changelist;
+	syscallarg(size_t) nchanges;
+	syscallarg(struct kevent *) eventlist;
+	syscallarg(size_t) nevents;
+	syscallarg(const struct timespec *) timeout;
+};
+check_syscall_args(sys___kevent50)
+
+struct sys___pselect50_args {
+	syscallarg(int) nd;
+	syscallarg(fd_set *) in;
+	syscallarg(fd_set *) ou;
+	syscallarg(fd_set *) ex;
+	syscallarg(const struct timespec *) ts;
+	syscallarg(const sigset_t *) mask;
+};
+check_syscall_args(sys___pselect50)
+
+struct sys___pollts50_args {
+	syscallarg(struct pollfd *) fds;
+	syscallarg(u_int) nfds;
+	syscallarg(const struct timespec *) ts;
+	syscallarg(const sigset_t *) mask;
+};
+check_syscall_args(sys___pollts50)
+
+struct sys___aio_suspend50_args {
+	syscallarg(const struct aiocb *const *) list;
+	syscallarg(int) nent;
+	syscallarg(const struct timespec *) timeout;
+};
+check_syscall_args(sys___aio_suspend50)
+
+struct sys___stat50_args {
+	syscallarg(const char *) path;
+	syscallarg(struct stat *) ub;
+};
+check_syscall_args(sys___stat50)
+
+struct sys___fstat50_args {
+	syscallarg(int) fd;
+	syscallarg(struct stat *) sb;
+};
+check_syscall_args(sys___fstat50)
+
+struct sys___lstat50_args {
+	syscallarg(const char *) path;
+	syscallarg(struct stat *) ub;
+};
+check_syscall_args(sys___lstat50)
+
+#ifndef RUMP_CLIENT
+struct sys_____semctl50_args {
+	syscallarg(int) semid;
+	syscallarg(int) semnum;
+	syscallarg(int) cmd;
+	syscallarg(union __semun *) arg;
+};
+check_syscall_args(sys_____semctl50)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___shmctl50_args {
+	syscallarg(int) shmid;
+	syscallarg(int) cmd;
+	syscallarg(struct shmid_ds *) buf;
+};
+check_syscall_args(sys___shmctl50)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___msgctl50_args {
+	syscallarg(int) msqid;
+	syscallarg(int) cmd;
+	syscallarg(struct msqid_ds *) buf;
+};
+check_syscall_args(sys___msgctl50)
+#endif /* !RUMP_CLIENT */
+
+#ifndef RUMP_CLIENT
+struct sys___getrusage50_args {
+	syscallarg(int) who;
+	syscallarg(struct rusage *) rusage;
+};
+check_syscall_args(sys___getrusage50)
+#endif /* !RUMP_CLIENT */
+
+struct sys___timer_settime50_args {
+	syscallarg(timer_t) timerid;
+	syscallarg(int) flags;
+	syscallarg(const struct itimerspec *) value;
+	syscallarg(struct itimerspec *) ovalue;
+};
+check_syscall_args(sys___timer_settime50)
+
+struct sys___timer_gettime50_args {
+	syscallarg(timer_t) timerid;
+	syscallarg(struct itimerspec *) value;
+};
+check_syscall_args(sys___timer_gettime50)
+#if defined(NTP) || !defined(_KERNEL_OPT)
+
+#ifndef RUMP_CLIENT
+struct sys___ntp_gettime50_args {
+	syscallarg(struct ntptimeval *) ntvp;
+};
+check_syscall_args(sys___ntp_gettime50)
+#endif /* !RUMP_CLIENT */
+#else
+#endif
+
+#ifndef RUMP_CLIENT
+struct sys___wait450_args {
+	syscallarg(pid_t) pid;
+	syscallarg(int *) status;
+	syscallarg(int) options;
+	syscallarg(struct rusage *) rusage;
+};
+check_syscall_args(sys___wait450)
+#endif /* !RUMP_CLIENT */
+
+struct sys___mknod50_args {
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+	syscallarg(dev_t) dev;
+};
+check_syscall_args(sys___mknod50)
+
+struct sys___fhstat50_args {
+	syscallarg(const void *) fhp;
+	syscallarg(size_t) fh_size;
+	syscallarg(struct stat *) sb;
+};
+check_syscall_args(sys___fhstat50)
+
+struct sys_pipe2_args {
+	syscallarg(int *) fildes;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_pipe2)
+
+struct sys_dup3_args {
+	syscallarg(int) from;
+	syscallarg(int) to;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_dup3)
+
+struct sys_kqueue1_args {
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_kqueue1)
+
+struct sys_paccept_args {
+	syscallarg(int) s;
+	syscallarg(struct sockaddr *) name;
+	syscallarg(socklen_t *) anamelen;
+	syscallarg(const sigset_t *) mask;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_paccept)
+
+struct sys_linkat_args {
+	syscallarg(int) fd1;
+	syscallarg(const char *) name1;
+	syscallarg(int) fd2;
+	syscallarg(const char *) name2;
+	syscallarg(int) flags;
+};
+check_syscall_args(sys_linkat)
+
+struct sys_renameat_args {
+	syscallarg(int) fromfd;
+	syscallarg(const char *) from;
+	syscallarg(int) tofd;
+	syscallarg(const char *) to;
+};
+check_syscall_args(sys_renameat)
+
+struct sys_mkfifoat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(sys_mkfifoat)
+
+struct sys_mknodat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+	syscallarg(int) PAD;
+	syscallarg(dev_t) dev;
+};
+check_syscall_args(sys_mknodat)
+
+struct sys_mkdirat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(sys_mkdirat)
+
+struct sys_faccessat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(int) amode;
+	syscallarg(int) flag;
+};
+check_syscall_args(sys_faccessat)
+
+struct sys_fchmodat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+	syscallarg(int) flag;
+};
+check_syscall_args(sys_fchmodat)
+
+struct sys_fchownat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(uid_t) owner;
+	syscallarg(gid_t) group;
+	syscallarg(int) flag;
+};
+check_syscall_args(sys_fchownat)
+
+#ifndef RUMP_CLIENT
+struct sys_fexecve_args {
+	syscallarg(int) fd;
+	syscallarg(char *const *) argp;
+	syscallarg(char *const *) envp;
+};
+check_syscall_args(sys_fexecve)
+#endif /* !RUMP_CLIENT */
+
+struct sys_fstatat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(struct stat *) buf;
+	syscallarg(int) flag;
+};
+check_syscall_args(sys_fstatat)
+
+struct sys_utimensat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(const struct timespec *) tptr;
+	syscallarg(int) flag;
+};
+check_syscall_args(sys_utimensat)
+
+struct sys_openat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(int) oflags;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(sys_openat)
+
+struct sys_readlinkat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(char *) buf;
+	syscallarg(size_t) bufsize;
+};
+check_syscall_args(sys_readlinkat)
+
+struct sys_symlinkat_args {
+	syscallarg(const char *) path1;
+	syscallarg(int) fd;
+	syscallarg(const char *) path2;
+};
+check_syscall_args(sys_symlinkat)
+
+struct sys_unlinkat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(int) flag;
+};
+check_syscall_args(sys_unlinkat)
+
+struct sys_futimens_args {
+	syscallarg(int) fd;
+	syscallarg(const struct timespec *) tptr;
+};
+check_syscall_args(sys_futimens)
+
+struct sys___quotactl_args {
+	syscallarg(const char *) path;
+	syscallarg(struct quotactl_args *) args;
+};
+check_syscall_args(sys___quotactl)
+
+#ifndef RUMP_CLIENT
+struct sys_posix_spawn_args {
+	syscallarg(pid_t *) pid;
+	syscallarg(const char *) path;
+	syscallarg(const struct posix_spawn_file_actions *) file_actions;
+	syscallarg(const struct posix_spawnattr *) attrp;
+	syscallarg(char *const *) argv;
+	syscallarg(char *const *) envp;
+};
+check_syscall_args(sys_posix_spawn)
+#endif /* !RUMP_CLIENT */
+
+struct sys_recvmmsg_args {
+	syscallarg(int) s;
+	syscallarg(struct mmsghdr *) mmsg;
+	syscallarg(unsigned int) vlen;
+	syscallarg(unsigned int) flags;
+	syscallarg(struct timespec *) timeout;
+};
+check_syscall_args(sys_recvmmsg)
+
+struct sys_sendmmsg_args {
+	syscallarg(int) s;
+	syscallarg(struct mmsghdr *) mmsg;
+	syscallarg(unsigned int) vlen;
+	syscallarg(unsigned int) flags;
+};
+check_syscall_args(sys_sendmmsg)
+
+struct sys_clock_nanosleep_args {
+	syscallarg(clockid_t) clock_id;
+	syscallarg(int) flags;
+	syscallarg(const struct timespec *) rqtp;
+	syscallarg(struct timespec *) rmtp;
+};
+check_syscall_args(sys_clock_nanosleep)
+
+#ifndef RUMP_CLIENT
+struct sys____lwp_park60_args {
+	syscallarg(clockid_t) clock_id;
+	syscallarg(int) flags;
+	syscallarg(const struct timespec *) ts;
+	syscallarg(lwpid_t) unpark;
+	syscallarg(const void *) hint;
+	syscallarg(const void *) unparkhint;
+};
+check_syscall_args(sys____lwp_park60)
+#endif /* !RUMP_CLIENT */
+
+struct sys_posix_fallocate_args {
+	syscallarg(int) fd;
+	syscallarg(int) PAD;
+	syscallarg(off_t) pos;
+	syscallarg(off_t) len;
+};
+check_syscall_args(sys_posix_fallocate)
+
+struct sys_fdiscard_args {
+	syscallarg(int) fd;
+	syscallarg(int) PAD;
+	syscallarg(off_t) pos;
+	syscallarg(off_t) len;
+};
+check_syscall_args(sys_fdiscard)
+
+/*
+ * System call prototypes.
+ */
+
+#ifndef RUMP_CLIENT
+int	sys_syscall(struct lwp *, const struct sys_syscall_args *, register_t *);
+
+int	sys_exit(struct lwp *, const struct sys_exit_args *, register_t *);
+
+int	sys_fork(struct lwp *, const void *, register_t *);
+
+int	sys_read(struct lwp *, const struct sys_read_args *, register_t *);
+
+int	sys_write(struct lwp *, const struct sys_write_args *, register_t *);
+
+int	sys_open(struct lwp *, const struct sys_open_args *, register_t *);
+
+int	sys_close(struct lwp *, const struct sys_close_args *, register_t *);
+
+int	compat_50_sys_wait4(struct lwp *, const struct compat_50_sys_wait4_args *, register_t *);
+
+int	compat_43_sys_creat(struct lwp *, const struct compat_43_sys_creat_args *, register_t *);
+
+int	sys_link(struct lwp *, const struct sys_link_args *, register_t *);
+
+int	sys_unlink(struct lwp *, const struct sys_unlink_args *, register_t *);
+
+int	sys_chdir(struct lwp *, const struct sys_chdir_args *, register_t *);
+
+int	sys_fchdir(struct lwp *, const struct sys_fchdir_args *, register_t *);
+
+int	compat_50_sys_mknod(struct lwp *, const struct compat_50_sys_mknod_args *, register_t *);
+
+int	sys_chmod(struct lwp *, const struct sys_chmod_args *, register_t *);
+
+int	sys_chown(struct lwp *, const struct sys_chown_args *, register_t *);
+
+int	sys_obreak(struct lwp *, const struct sys_obreak_args *, register_t *);
+
+int	compat_20_sys_getfsstat(struct lwp *, const struct compat_20_sys_getfsstat_args *, register_t *);
+
+int	compat_43_sys_lseek(struct lwp *, const struct compat_43_sys_lseek_args *, register_t *);
+
+int	sys_getpid_with_ppid(struct lwp *, const void *, register_t *);
+
+int	compat_40_sys_mount(struct lwp *, const struct compat_40_sys_mount_args *, register_t *);
+
+int	sys_unmount(struct lwp *, const struct sys_unmount_args *, register_t *);
+
+int	sys_setuid(struct lwp *, const struct sys_setuid_args *, register_t *);
+
+int	sys_getuid_with_euid(struct lwp *, const void *, register_t *);
+
+int	sys_geteuid(struct lwp *, const void *, register_t *);
+
+int	sys_ptrace(struct lwp *, const struct sys_ptrace_args *, register_t *);
+
+int	sys_recvmsg(struct lwp *, const struct sys_recvmsg_args *, register_t *);
+
+int	sys_sendmsg(struct lwp *, const struct sys_sendmsg_args *, register_t *);
+
+int	sys_recvfrom(struct lwp *, const struct sys_recvfrom_args *, register_t *);
+
+int	sys_accept(struct lwp *, const struct sys_accept_args *, register_t *);
+
+int	sys_getpeername(struct lwp *, const struct sys_getpeername_args *, register_t *);
+
+int	sys_getsockname(struct lwp *, const struct sys_getsockname_args *, register_t *);
+
+int	sys_access(struct lwp *, const struct sys_access_args *, register_t *);
+
+int	sys_chflags(struct lwp *, const struct sys_chflags_args *, register_t *);
+
+int	sys_fchflags(struct lwp *, const struct sys_fchflags_args *, register_t *);
+
+int	sys_sync(struct lwp *, const void *, register_t *);
+
+int	sys_kill(struct lwp *, const struct sys_kill_args *, register_t *);
+
+int	compat_43_sys_stat(struct lwp *, const struct compat_43_sys_stat_args *, register_t *);
+
+int	sys_getppid(struct lwp *, const void *, register_t *);
+
+int	compat_43_sys_lstat(struct lwp *, const struct compat_43_sys_lstat_args *, register_t *);
+
+int	sys_dup(struct lwp *, const struct sys_dup_args *, register_t *);
+
+int	sys_pipe(struct lwp *, const void *, register_t *);
+
+int	sys_getegid(struct lwp *, const void *, register_t *);
+
+int	sys_profil(struct lwp *, const struct sys_profil_args *, register_t *);
+
+int	sys_ktrace(struct lwp *, const struct sys_ktrace_args *, register_t *);
+
+int	compat_13_sys_sigaction(struct lwp *, const struct compat_13_sys_sigaction_args *, register_t *);
+
+int	sys_getgid_with_egid(struct lwp *, const void *, register_t *);
+
+int	compat_13_sys_sigprocmask(struct lwp *, const struct compat_13_sys_sigprocmask_args *, register_t *);
+
+int	sys___getlogin(struct lwp *, const struct sys___getlogin_args *, register_t *);
+
+int	sys___setlogin(struct lwp *, const struct sys___setlogin_args *, register_t *);
+
+int	sys_acct(struct lwp *, const struct sys_acct_args *, register_t *);
+
+int	compat_13_sys_sigpending(struct lwp *, const void *, register_t *);
+
+int	compat_13_sys_sigaltstack(struct lwp *, const struct compat_13_sys_sigaltstack_args *, register_t *);
+
+int	sys_ioctl(struct lwp *, const struct sys_ioctl_args *, register_t *);
+
+int	compat_12_sys_reboot(struct lwp *, const struct compat_12_sys_reboot_args *, register_t *);
+
+int	sys_revoke(struct lwp *, const struct sys_revoke_args *, register_t *);
+
+int	sys_symlink(struct lwp *, const struct sys_symlink_args *, register_t *);
+
+int	sys_readlink(struct lwp *, const struct sys_readlink_args *, register_t *);
+
+int	sys_execve(struct lwp *, const struct sys_execve_args *, register_t *);
+
+int	sys_umask(struct lwp *, const struct sys_umask_args *, register_t *);
+
+int	sys_chroot(struct lwp *, const struct sys_chroot_args *, register_t *);
+
+int	compat_43_sys_fstat(struct lwp *, const struct compat_43_sys_fstat_args *, register_t *);
+
+int	compat_43_sys_getkerninfo(struct lwp *, const struct compat_43_sys_getkerninfo_args *, register_t *);
+
+int	compat_43_sys_getpagesize(struct lwp *, const void *, register_t *);
+
+int	compat_12_sys_msync(struct lwp *, const struct compat_12_sys_msync_args *, register_t *);
+
+int	sys_vfork(struct lwp *, const void *, register_t *);
+
+int	sys_sbrk(struct lwp *, const struct sys_sbrk_args *, register_t *);
+
+int	sys_sstk(struct lwp *, const struct sys_sstk_args *, register_t *);
+
+int	compat_43_sys_mmap(struct lwp *, const struct compat_43_sys_mmap_args *, register_t *);
+
+int	sys_ovadvise(struct lwp *, const struct sys_ovadvise_args *, register_t *);
+
+int	sys_munmap(struct lwp *, const struct sys_munmap_args *, register_t *);
+
+int	sys_mprotect(struct lwp *, const struct sys_mprotect_args *, register_t *);
+
+int	sys_madvise(struct lwp *, const struct sys_madvise_args *, register_t *);
+
+int	sys_mincore(struct lwp *, const struct sys_mincore_args *, register_t *);
+
+int	sys_getgroups(struct lwp *, const struct sys_getgroups_args *, register_t *);
+
+int	sys_setgroups(struct lwp *, const struct sys_setgroups_args *, register_t *);
+
+int	sys_getpgrp(struct lwp *, const void *, register_t *);
+
+int	sys_setpgid(struct lwp *, const struct sys_setpgid_args *, register_t *);
+
+int	compat_50_sys_setitimer(struct lwp *, const struct compat_50_sys_setitimer_args *, register_t *);
+
+int	compat_43_sys_wait(struct lwp *, const void *, register_t *);
+
+int	compat_12_sys_swapon(struct lwp *, const struct compat_12_sys_swapon_args *, register_t *);
+
+int	compat_50_sys_getitimer(struct lwp *, const struct compat_50_sys_getitimer_args *, register_t *);
+
+int	compat_43_sys_gethostname(struct lwp *, const struct compat_43_sys_gethostname_args *, register_t *);
+
+int	compat_43_sys_sethostname(struct lwp *, const struct compat_43_sys_sethostname_args *, register_t *);
+
+int	compat_43_sys_getdtablesize(struct lwp *, const void *, register_t *);
+
+int	sys_dup2(struct lwp *, const struct sys_dup2_args *, register_t *);
+
+int	sys_fcntl(struct lwp *, const struct sys_fcntl_args *, register_t *);
+
+int	compat_50_sys_select(struct lwp *, const struct compat_50_sys_select_args *, register_t *);
+
+int	sys_fsync(struct lwp *, const struct sys_fsync_args *, register_t *);
+
+int	sys_setpriority(struct lwp *, const struct sys_setpriority_args *, register_t *);
+
+int	compat_30_sys_socket(struct lwp *, const struct compat_30_sys_socket_args *, register_t *);
+
+int	sys_connect(struct lwp *, const struct sys_connect_args *, register_t *);
+
+int	compat_43_sys_accept(struct lwp *, const struct compat_43_sys_accept_args *, register_t *);
+
+int	sys_getpriority(struct lwp *, const struct sys_getpriority_args *, register_t *);
+
+int	compat_43_sys_send(struct lwp *, const struct compat_43_sys_send_args *, register_t *);
+
+int	compat_43_sys_recv(struct lwp *, const struct compat_43_sys_recv_args *, register_t *);
+
+int	compat_13_sys_sigreturn(struct lwp *, const struct compat_13_sys_sigreturn_args *, register_t *);
+
+int	sys_bind(struct lwp *, const struct sys_bind_args *, register_t *);
+
+int	sys_setsockopt(struct lwp *, const struct sys_setsockopt_args *, register_t *);
+
+int	sys_listen(struct lwp *, const struct sys_listen_args *, register_t *);
+
+int	compat_43_sys_sigvec(struct lwp *, const struct compat_43_sys_sigvec_args *, register_t *);
+
+int	compat_43_sys_sigblock(struct lwp *, const struct compat_43_sys_sigblock_args *, register_t *);
+
+int	compat_43_sys_sigsetmask(struct lwp *, const struct compat_43_sys_sigsetmask_args *, register_t *);
+
+int	compat_13_sys_sigsuspend(struct lwp *, const struct compat_13_sys_sigsuspend_args *, register_t *);
+
+int	compat_43_sys_sigstack(struct lwp *, const struct compat_43_sys_sigstack_args *, register_t *);
+
+int	compat_43_sys_recvmsg(struct lwp *, const struct compat_43_sys_recvmsg_args *, register_t *);
+
+int	compat_43_sys_sendmsg(struct lwp *, const struct compat_43_sys_sendmsg_args *, register_t *);
+
+int	compat_50_sys_gettimeofday(struct lwp *, const struct compat_50_sys_gettimeofday_args *, register_t *);
+
+int	compat_50_sys_getrusage(struct lwp *, const struct compat_50_sys_getrusage_args *, register_t *);
+
+int	sys_getsockopt(struct lwp *, const struct sys_getsockopt_args *, register_t *);
+
+int	sys_readv(struct lwp *, const struct sys_readv_args *, register_t *);
+
+int	sys_writev(struct lwp *, const struct sys_writev_args *, register_t *);
+
+int	compat_50_sys_settimeofday(struct lwp *, const struct compat_50_sys_settimeofday_args *, register_t *);
+
+int	sys_fchown(struct lwp *, const struct sys_fchown_args *, register_t *);
+
+int	sys_fchmod(struct lwp *, const struct sys_fchmod_args *, register_t *);
+
+int	compat_43_sys_recvfrom(struct lwp *, const struct compat_43_sys_recvfrom_args *, register_t *);
+
+int	sys_setreuid(struct lwp *, const struct sys_setreuid_args *, register_t *);
+
+int	sys_setregid(struct lwp *, const struct sys_setregid_args *, register_t *);
+
+int	sys_rename(struct lwp *, const struct sys_rename_args *, register_t *);
+
+int	compat_43_sys_truncate(struct lwp *, const struct compat_43_sys_truncate_args *, register_t *);
+
+int	compat_43_sys_ftruncate(struct lwp *, const struct compat_43_sys_ftruncate_args *, register_t *);
+
+int	sys_flock(struct lwp *, const struct sys_flock_args *, register_t *);
+
+int	sys_mkfifo(struct lwp *, const struct sys_mkfifo_args *, register_t *);
+
+int	sys_sendto(struct lwp *, const struct sys_sendto_args *, register_t *);
+
+int	sys_shutdown(struct lwp *, const struct sys_shutdown_args *, register_t *);
+
+int	sys_socketpair(struct lwp *, const struct sys_socketpair_args *, register_t *);
+
+int	sys_mkdir(struct lwp *, const struct sys_mkdir_args *, register_t *);
+
+int	sys_rmdir(struct lwp *, const struct sys_rmdir_args *, register_t *);
+
+int	compat_50_sys_utimes(struct lwp *, const struct compat_50_sys_utimes_args *, register_t *);
+
+int	compat_50_sys_adjtime(struct lwp *, const struct compat_50_sys_adjtime_args *, register_t *);
+
+int	compat_43_sys_getpeername(struct lwp *, const struct compat_43_sys_getpeername_args *, register_t *);
+
+int	compat_43_sys_gethostid(struct lwp *, const void *, register_t *);
+
+int	compat_43_sys_sethostid(struct lwp *, const struct compat_43_sys_sethostid_args *, register_t *);
+
+int	compat_43_sys_getrlimit(struct lwp *, const struct compat_43_sys_getrlimit_args *, register_t *);
+
+int	compat_43_sys_setrlimit(struct lwp *, const struct compat_43_sys_setrlimit_args *, register_t *);
+
+int	compat_43_sys_killpg(struct lwp *, const struct compat_43_sys_killpg_args *, register_t *);
+
+int	sys_setsid(struct lwp *, const void *, register_t *);
+
+int	compat_50_sys_quotactl(struct lwp *, const struct compat_50_sys_quotactl_args *, register_t *);
+
+int	compat_43_sys_quota(struct lwp *, const void *, register_t *);
+
+int	compat_43_sys_getsockname(struct lwp *, const struct compat_43_sys_getsockname_args *, register_t *);
+
+int	sys_nfssvc(struct lwp *, const struct sys_nfssvc_args *, register_t *);
+
+int	compat_43_sys_getdirentries(struct lwp *, const struct compat_43_sys_getdirentries_args *, register_t *);
+
+int	compat_20_sys_statfs(struct lwp *, const struct compat_20_sys_statfs_args *, register_t *);
+
+int	compat_20_sys_fstatfs(struct lwp *, const struct compat_20_sys_fstatfs_args *, register_t *);
+
+int	compat_30_sys_getfh(struct lwp *, const struct compat_30_sys_getfh_args *, register_t *);
+
+int	compat_09_sys_getdomainname(struct lwp *, const struct compat_09_sys_getdomainname_args *, register_t *);
+
+int	compat_09_sys_setdomainname(struct lwp *, const struct compat_09_sys_setdomainname_args *, register_t *);
+
+int	compat_09_sys_uname(struct lwp *, const struct compat_09_sys_uname_args *, register_t *);
+
+int	sys_sysarch(struct lwp *, const struct sys_sysarch_args *, register_t *);
+
+#if !defined(_LP64)
+int	compat_10_sys_semsys(struct lwp *, const struct compat_10_sys_semsys_args *, register_t *);
+
+#else
+#endif
+#if !defined(_LP64)
+int	compat_10_sys_msgsys(struct lwp *, const struct compat_10_sys_msgsys_args *, register_t *);
+
+#else
+#endif
+#if !defined(_LP64)
+int	compat_10_sys_shmsys(struct lwp *, const struct compat_10_sys_shmsys_args *, register_t *);
+
+#else
+#endif
+int	sys_pread(struct lwp *, const struct sys_pread_args *, register_t *);
+
+int	sys_pwrite(struct lwp *, const struct sys_pwrite_args *, register_t *);
+
+int	compat_30_sys_ntp_gettime(struct lwp *, const struct compat_30_sys_ntp_gettime_args *, register_t *);
+
+#if defined(NTP) || !defined(_KERNEL_OPT)
+int	sys_ntp_adjtime(struct lwp *, const struct sys_ntp_adjtime_args *, register_t *);
+
+#else
+#endif
+int	sys_setgid(struct lwp *, const struct sys_setgid_args *, register_t *);
+
+int	sys_setegid(struct lwp *, const struct sys_setegid_args *, register_t *);
+
+int	sys_seteuid(struct lwp *, const struct sys_seteuid_args *, register_t *);
+
+int	sys_lfs_bmapv(struct lwp *, const struct sys_lfs_bmapv_args *, register_t *);
+
+int	sys_lfs_markv(struct lwp *, const struct sys_lfs_markv_args *, register_t *);
+
+int	sys_lfs_segclean(struct lwp *, const struct sys_lfs_segclean_args *, register_t *);
+
+int	compat_50_sys_lfs_segwait(struct lwp *, const struct compat_50_sys_lfs_segwait_args *, register_t *);
+
+int	compat_12_sys_stat(struct lwp *, const struct compat_12_sys_stat_args *, register_t *);
+
+int	compat_12_sys_fstat(struct lwp *, const struct compat_12_sys_fstat_args *, register_t *);
+
+int	compat_12_sys_lstat(struct lwp *, const struct compat_12_sys_lstat_args *, register_t *);
+
+int	sys_pathconf(struct lwp *, const struct sys_pathconf_args *, register_t *);
+
+int	sys_fpathconf(struct lwp *, const struct sys_fpathconf_args *, register_t *);
+
+int	sys_getrlimit(struct lwp *, const struct sys_getrlimit_args *, register_t *);
+
+int	sys_setrlimit(struct lwp *, const struct sys_setrlimit_args *, register_t *);
+
+int	compat_12_sys_getdirentries(struct lwp *, const struct compat_12_sys_getdirentries_args *, register_t *);
+
+int	sys_mmap(struct lwp *, const struct sys_mmap_args *, register_t *);
+
+int	sys___syscall(struct lwp *, const struct sys___syscall_args *, register_t *);
+
+int	sys_lseek(struct lwp *, const struct sys_lseek_args *, register_t *);
+
+int	sys_truncate(struct lwp *, const struct sys_truncate_args *, register_t *);
+
+int	sys_ftruncate(struct lwp *, const struct sys_ftruncate_args *, register_t *);
+
+int	sys___sysctl(struct lwp *, const struct sys___sysctl_args *, register_t *);
+
+int	sys_mlock(struct lwp *, const struct sys_mlock_args *, register_t *);
+
+int	sys_munlock(struct lwp *, const struct sys_munlock_args *, register_t *);
+
+int	sys_undelete(struct lwp *, const struct sys_undelete_args *, register_t *);
+
+int	compat_50_sys_futimes(struct lwp *, const struct compat_50_sys_futimes_args *, register_t *);
+
+int	sys_getpgid(struct lwp *, const struct sys_getpgid_args *, register_t *);
+
+int	sys_reboot(struct lwp *, const struct sys_reboot_args *, register_t *);
+
+int	sys_poll(struct lwp *, const struct sys_poll_args *, register_t *);
+
+int	sys_afssys(struct lwp *, const struct sys_afssys_args *, register_t *);
+
+int	compat_14_sys___semctl(struct lwp *, const struct compat_14_sys___semctl_args *, register_t *);
+
+int	sys_semget(struct lwp *, const struct sys_semget_args *, register_t *);
+
+int	sys_semop(struct lwp *, const struct sys_semop_args *, register_t *);
+
+int	sys_semconfig(struct lwp *, const struct sys_semconfig_args *, register_t *);
+
+int	compat_14_sys_msgctl(struct lwp *, const struct compat_14_sys_msgctl_args *, register_t *);
+
+int	sys_msgget(struct lwp *, const struct sys_msgget_args *, register_t *);
+
+int	sys_msgsnd(struct lwp *, const struct sys_msgsnd_args *, register_t *);
+
+int	sys_msgrcv(struct lwp *, const struct sys_msgrcv_args *, register_t *);
+
+int	sys_shmat(struct lwp *, const struct sys_shmat_args *, register_t *);
+
+int	compat_14_sys_shmctl(struct lwp *, const struct compat_14_sys_shmctl_args *, register_t *);
+
+int	sys_shmdt(struct lwp *, const struct sys_shmdt_args *, register_t *);
+
+int	sys_shmget(struct lwp *, const struct sys_shmget_args *, register_t *);
+
+int	compat_50_sys_clock_gettime(struct lwp *, const struct compat_50_sys_clock_gettime_args *, register_t *);
+
+int	compat_50_sys_clock_settime(struct lwp *, const struct compat_50_sys_clock_settime_args *, register_t *);
+
+int	compat_50_sys_clock_getres(struct lwp *, const struct compat_50_sys_clock_getres_args *, register_t *);
+
+int	sys_timer_create(struct lwp *, const struct sys_timer_create_args *, register_t *);
+
+int	sys_timer_delete(struct lwp *, const struct sys_timer_delete_args *, register_t *);
+
+int	compat_50_sys_timer_settime(struct lwp *, const struct compat_50_sys_timer_settime_args *, register_t *);
+
+int	compat_50_sys_timer_gettime(struct lwp *, const struct compat_50_sys_timer_gettime_args *, register_t *);
+
+int	sys_timer_getoverrun(struct lwp *, const struct sys_timer_getoverrun_args *, register_t *);
+
+int	compat_50_sys_nanosleep(struct lwp *, const struct compat_50_sys_nanosleep_args *, register_t *);
+
+int	sys_fdatasync(struct lwp *, const struct sys_fdatasync_args *, register_t *);
+
+int	sys_mlockall(struct lwp *, const struct sys_mlockall_args *, register_t *);
+
+int	sys_munlockall(struct lwp *, const void *, register_t *);
+
+int	compat_50_sys___sigtimedwait(struct lwp *, const struct compat_50_sys___sigtimedwait_args *, register_t *);
+
+int	sys_sigqueueinfo(struct lwp *, const struct sys_sigqueueinfo_args *, register_t *);
+
+int	sys_modctl(struct lwp *, const struct sys_modctl_args *, register_t *);
+
+int	sys__ksem_init(struct lwp *, const struct sys__ksem_init_args *, register_t *);
+
+int	sys__ksem_open(struct lwp *, const struct sys__ksem_open_args *, register_t *);
+
+int	sys__ksem_unlink(struct lwp *, const struct sys__ksem_unlink_args *, register_t *);
+
+int	sys__ksem_close(struct lwp *, const struct sys__ksem_close_args *, register_t *);
+
+int	sys__ksem_post(struct lwp *, const struct sys__ksem_post_args *, register_t *);
+
+int	sys__ksem_wait(struct lwp *, const struct sys__ksem_wait_args *, register_t *);
+
+int	sys__ksem_trywait(struct lwp *, const struct sys__ksem_trywait_args *, register_t *);
+
+int	sys__ksem_getvalue(struct lwp *, const struct sys__ksem_getvalue_args *, register_t *);
+
+int	sys__ksem_destroy(struct lwp *, const struct sys__ksem_destroy_args *, register_t *);
+
+int	sys__ksem_timedwait(struct lwp *, const struct sys__ksem_timedwait_args *, register_t *);
+
+int	sys_mq_open(struct lwp *, const struct sys_mq_open_args *, register_t *);
+
+int	sys_mq_close(struct lwp *, const struct sys_mq_close_args *, register_t *);
+
+int	sys_mq_unlink(struct lwp *, const struct sys_mq_unlink_args *, register_t *);
+
+int	sys_mq_getattr(struct lwp *, const struct sys_mq_getattr_args *, register_t *);
+
+int	sys_mq_setattr(struct lwp *, const struct sys_mq_setattr_args *, register_t *);
+
+int	sys_mq_notify(struct lwp *, const struct sys_mq_notify_args *, register_t *);
+
+int	sys_mq_send(struct lwp *, const struct sys_mq_send_args *, register_t *);
+
+int	sys_mq_receive(struct lwp *, const struct sys_mq_receive_args *, register_t *);
+
+int	compat_50_sys_mq_timedsend(struct lwp *, const struct compat_50_sys_mq_timedsend_args *, register_t *);
+
+int	compat_50_sys_mq_timedreceive(struct lwp *, const struct compat_50_sys_mq_timedreceive_args *, register_t *);
+
+int	sys___posix_rename(struct lwp *, const struct sys___posix_rename_args *, register_t *);
+
+int	sys_swapctl(struct lwp *, const struct sys_swapctl_args *, register_t *);
+
+int	compat_30_sys_getdents(struct lwp *, const struct compat_30_sys_getdents_args *, register_t *);
+
+int	sys_minherit(struct lwp *, const struct sys_minherit_args *, register_t *);
+
+int	sys_lchmod(struct lwp *, const struct sys_lchmod_args *, register_t *);
+
+int	sys_lchown(struct lwp *, const struct sys_lchown_args *, register_t *);
+
+int	compat_50_sys_lutimes(struct lwp *, const struct compat_50_sys_lutimes_args *, register_t *);
+
+int	sys___msync13(struct lwp *, const struct sys___msync13_args *, register_t *);
+
+int	compat_30_sys___stat13(struct lwp *, const struct compat_30_sys___stat13_args *, register_t *);
+
+int	compat_30_sys___fstat13(struct lwp *, const struct compat_30_sys___fstat13_args *, register_t *);
+
+int	compat_30_sys___lstat13(struct lwp *, const struct compat_30_sys___lstat13_args *, register_t *);
+
+int	sys___sigaltstack14(struct lwp *, const struct sys___sigaltstack14_args *, register_t *);
+
+int	sys___vfork14(struct lwp *, const void *, register_t *);
+
+int	sys___posix_chown(struct lwp *, const struct sys___posix_chown_args *, register_t *);
+
+int	sys___posix_fchown(struct lwp *, const struct sys___posix_fchown_args *, register_t *);
+
+int	sys___posix_lchown(struct lwp *, const struct sys___posix_lchown_args *, register_t *);
+
+int	sys_getsid(struct lwp *, const struct sys_getsid_args *, register_t *);
+
+int	sys___clone(struct lwp *, const struct sys___clone_args *, register_t *);
+
+int	sys_fktrace(struct lwp *, const struct sys_fktrace_args *, register_t *);
+
+int	sys_preadv(struct lwp *, const struct sys_preadv_args *, register_t *);
+
+int	sys_pwritev(struct lwp *, const struct sys_pwritev_args *, register_t *);
+
+int	compat_16_sys___sigaction14(struct lwp *, const struct compat_16_sys___sigaction14_args *, register_t *);
+
+int	sys___sigpending14(struct lwp *, const struct sys___sigpending14_args *, register_t *);
+
+int	sys___sigprocmask14(struct lwp *, const struct sys___sigprocmask14_args *, register_t *);
+
+int	sys___sigsuspend14(struct lwp *, const struct sys___sigsuspend14_args *, register_t *);
+
+int	compat_16_sys___sigreturn14(struct lwp *, const struct compat_16_sys___sigreturn14_args *, register_t *);
+
+int	sys___getcwd(struct lwp *, const struct sys___getcwd_args *, register_t *);
+
+int	sys_fchroot(struct lwp *, const struct sys_fchroot_args *, register_t *);
+
+int	compat_30_sys_fhopen(struct lwp *, const struct compat_30_sys_fhopen_args *, register_t *);
+
+int	compat_30_sys_fhstat(struct lwp *, const struct compat_30_sys_fhstat_args *, register_t *);
+
+int	compat_20_sys_fhstatfs(struct lwp *, const struct compat_20_sys_fhstatfs_args *, register_t *);
+
+int	compat_50_sys_____semctl13(struct lwp *, const struct compat_50_sys_____semctl13_args *, register_t *);
+
+int	compat_50_sys___msgctl13(struct lwp *, const struct compat_50_sys___msgctl13_args *, register_t *);
+
+int	compat_50_sys___shmctl13(struct lwp *, const struct compat_50_sys___shmctl13_args *, register_t *);
+
+int	sys_lchflags(struct lwp *, const struct sys_lchflags_args *, register_t *);
+
+int	sys_issetugid(struct lwp *, const void *, register_t *);
+
+int	sys_utrace(struct lwp *, const struct sys_utrace_args *, register_t *);
+
+int	sys_getcontext(struct lwp *, const struct sys_getcontext_args *, register_t *);
+
+int	sys_setcontext(struct lwp *, const struct sys_setcontext_args *, register_t *);
+
+int	sys__lwp_create(struct lwp *, const struct sys__lwp_create_args *, register_t *);
+
+int	sys__lwp_exit(struct lwp *, const void *, register_t *);
+
+int	sys__lwp_self(struct lwp *, const void *, register_t *);
+
+int	sys__lwp_wait(struct lwp *, const struct sys__lwp_wait_args *, register_t *);
+
+int	sys__lwp_suspend(struct lwp *, const struct sys__lwp_suspend_args *, register_t *);
+
+int	sys__lwp_continue(struct lwp *, const struct sys__lwp_continue_args *, register_t *);
+
+int	sys__lwp_wakeup(struct lwp *, const struct sys__lwp_wakeup_args *, register_t *);
+
+int	sys__lwp_getprivate(struct lwp *, const void *, register_t *);
+
+int	sys__lwp_setprivate(struct lwp *, const struct sys__lwp_setprivate_args *, register_t *);
+
+int	sys__lwp_kill(struct lwp *, const struct sys__lwp_kill_args *, register_t *);
+
+int	sys__lwp_detach(struct lwp *, const struct sys__lwp_detach_args *, register_t *);
+
+int	compat_50_sys__lwp_park(struct lwp *, const struct compat_50_sys__lwp_park_args *, register_t *);
+
+int	sys__lwp_unpark(struct lwp *, const struct sys__lwp_unpark_args *, register_t *);
+
+int	sys__lwp_unpark_all(struct lwp *, const struct sys__lwp_unpark_all_args *, register_t *);
+
+int	sys__lwp_setname(struct lwp *, const struct sys__lwp_setname_args *, register_t *);
+
+int	sys__lwp_getname(struct lwp *, const struct sys__lwp_getname_args *, register_t *);
+
+int	sys__lwp_ctl(struct lwp *, const struct sys__lwp_ctl_args *, register_t *);
+
+int	compat_60_sys_sa_register(struct lwp *, const struct compat_60_sys_sa_register_args *, register_t *);
+
+int	compat_60_sys_sa_stacks(struct lwp *, const struct compat_60_sys_sa_stacks_args *, register_t *);
+
+int	compat_60_sys_sa_enable(struct lwp *, const void *, register_t *);
+
+int	compat_60_sys_sa_setconcurrency(struct lwp *, const struct compat_60_sys_sa_setconcurrency_args *, register_t *);
+
+int	compat_60_sys_sa_yield(struct lwp *, const void *, register_t *);
+
+int	compat_60_sys_sa_preempt(struct lwp *, const struct compat_60_sys_sa_preempt_args *, register_t *);
+
+int	sys___sigaction_sigtramp(struct lwp *, const struct sys___sigaction_sigtramp_args *, register_t *);
+
+int	sys_pmc_get_info(struct lwp *, const struct sys_pmc_get_info_args *, register_t *);
+
+int	sys_pmc_control(struct lwp *, const struct sys_pmc_control_args *, register_t *);
+
+int	sys_rasctl(struct lwp *, const struct sys_rasctl_args *, register_t *);
+
+int	sys_kqueue(struct lwp *, const void *, register_t *);
+
+int	compat_50_sys_kevent(struct lwp *, const struct compat_50_sys_kevent_args *, register_t *);
+
+int	sys__sched_setparam(struct lwp *, const struct sys__sched_setparam_args *, register_t *);
+
+int	sys__sched_getparam(struct lwp *, const struct sys__sched_getparam_args *, register_t *);
+
+int	sys__sched_setaffinity(struct lwp *, const struct sys__sched_setaffinity_args *, register_t *);
+
+int	sys__sched_getaffinity(struct lwp *, const struct sys__sched_getaffinity_args *, register_t *);
+
+int	sys_sched_yield(struct lwp *, const void *, register_t *);
+
+int	sys_fsync_range(struct lwp *, const struct sys_fsync_range_args *, register_t *);
+
+int	sys_uuidgen(struct lwp *, const struct sys_uuidgen_args *, register_t *);
+
+int	sys_getvfsstat(struct lwp *, const struct sys_getvfsstat_args *, register_t *);
+
+int	sys_statvfs1(struct lwp *, const struct sys_statvfs1_args *, register_t *);
+
+int	sys_fstatvfs1(struct lwp *, const struct sys_fstatvfs1_args *, register_t *);
+
+int	compat_30_sys_fhstatvfs1(struct lwp *, const struct compat_30_sys_fhstatvfs1_args *, register_t *);
+
+int	sys_extattrctl(struct lwp *, const struct sys_extattrctl_args *, register_t *);
+
+int	sys_extattr_set_file(struct lwp *, const struct sys_extattr_set_file_args *, register_t *);
+
+int	sys_extattr_get_file(struct lwp *, const struct sys_extattr_get_file_args *, register_t *);
+
+int	sys_extattr_delete_file(struct lwp *, const struct sys_extattr_delete_file_args *, register_t *);
+
+int	sys_extattr_set_fd(struct lwp *, const struct sys_extattr_set_fd_args *, register_t *);
+
+int	sys_extattr_get_fd(struct lwp *, const struct sys_extattr_get_fd_args *, register_t *);
+
+int	sys_extattr_delete_fd(struct lwp *, const struct sys_extattr_delete_fd_args *, register_t *);
+
+int	sys_extattr_set_link(struct lwp *, const struct sys_extattr_set_link_args *, register_t *);
+
+int	sys_extattr_get_link(struct lwp *, const struct sys_extattr_get_link_args *, register_t *);
+
+int	sys_extattr_delete_link(struct lwp *, const struct sys_extattr_delete_link_args *, register_t *);
+
+int	sys_extattr_list_fd(struct lwp *, const struct sys_extattr_list_fd_args *, register_t *);
+
+int	sys_extattr_list_file(struct lwp *, const struct sys_extattr_list_file_args *, register_t *);
+
+int	sys_extattr_list_link(struct lwp *, const struct sys_extattr_list_link_args *, register_t *);
+
+int	compat_50_sys_pselect(struct lwp *, const struct compat_50_sys_pselect_args *, register_t *);
+
+int	compat_50_sys_pollts(struct lwp *, const struct compat_50_sys_pollts_args *, register_t *);
+
+int	sys_setxattr(struct lwp *, const struct sys_setxattr_args *, register_t *);
+
+int	sys_lsetxattr(struct lwp *, const struct sys_lsetxattr_args *, register_t *);
+
+int	sys_fsetxattr(struct lwp *, const struct sys_fsetxattr_args *, register_t *);
+
+int	sys_getxattr(struct lwp *, const struct sys_getxattr_args *, register_t *);
+
+int	sys_lgetxattr(struct lwp *, const struct sys_lgetxattr_args *, register_t *);
+
+int	sys_fgetxattr(struct lwp *, const struct sys_fgetxattr_args *, register_t *);
+
+int	sys_listxattr(struct lwp *, const struct sys_listxattr_args *, register_t *);
+
+int	sys_llistxattr(struct lwp *, const struct sys_llistxattr_args *, register_t *);
+
+int	sys_flistxattr(struct lwp *, const struct sys_flistxattr_args *, register_t *);
+
+int	sys_removexattr(struct lwp *, const struct sys_removexattr_args *, register_t *);
+
+int	sys_lremovexattr(struct lwp *, const struct sys_lremovexattr_args *, register_t *);
+
+int	sys_fremovexattr(struct lwp *, const struct sys_fremovexattr_args *, register_t *);
+
+int	compat_50_sys___stat30(struct lwp *, const struct compat_50_sys___stat30_args *, register_t *);
+
+int	compat_50_sys___fstat30(struct lwp *, const struct compat_50_sys___fstat30_args *, register_t *);
+
+int	compat_50_sys___lstat30(struct lwp *, const struct compat_50_sys___lstat30_args *, register_t *);
+
+int	sys___getdents30(struct lwp *, const struct sys___getdents30_args *, register_t *);
+
+int	compat_30_sys___fhstat30(struct lwp *, const struct compat_30_sys___fhstat30_args *, register_t *);
+
+int	compat_50_sys___ntp_gettime30(struct lwp *, const struct compat_50_sys___ntp_gettime30_args *, register_t *);
+
+int	sys___socket30(struct lwp *, const struct sys___socket30_args *, register_t *);
+
+int	sys___getfh30(struct lwp *, const struct sys___getfh30_args *, register_t *);
+
+int	sys___fhopen40(struct lwp *, const struct sys___fhopen40_args *, register_t *);
+
+int	sys___fhstatvfs140(struct lwp *, const struct sys___fhstatvfs140_args *, register_t *);
+
+int	compat_50_sys___fhstat40(struct lwp *, const struct compat_50_sys___fhstat40_args *, register_t *);
+
+int	sys_aio_cancel(struct lwp *, const struct sys_aio_cancel_args *, register_t *);
+
+int	sys_aio_error(struct lwp *, const struct sys_aio_error_args *, register_t *);
+
+int	sys_aio_fsync(struct lwp *, const struct sys_aio_fsync_args *, register_t *);
+
+int	sys_aio_read(struct lwp *, const struct sys_aio_read_args *, register_t *);
+
+int	sys_aio_return(struct lwp *, const struct sys_aio_return_args *, register_t *);
+
+int	compat_50_sys_aio_suspend(struct lwp *, const struct compat_50_sys_aio_suspend_args *, register_t *);
+
+int	sys_aio_write(struct lwp *, const struct sys_aio_write_args *, register_t *);
+
+int	sys_lio_listio(struct lwp *, const struct sys_lio_listio_args *, register_t *);
+
+int	sys___mount50(struct lwp *, const struct sys___mount50_args *, register_t *);
+
+int	sys_mremap(struct lwp *, const struct sys_mremap_args *, register_t *);
+
+int	sys_pset_create(struct lwp *, const struct sys_pset_create_args *, register_t *);
+
+int	sys_pset_destroy(struct lwp *, const struct sys_pset_destroy_args *, register_t *);
+
+int	sys_pset_assign(struct lwp *, const struct sys_pset_assign_args *, register_t *);
+
+int	sys__pset_bind(struct lwp *, const struct sys__pset_bind_args *, register_t *);
+
+int	sys___posix_fadvise50(struct lwp *, const struct sys___posix_fadvise50_args *, register_t *);
+
+int	sys___select50(struct lwp *, const struct sys___select50_args *, register_t *);
+
+int	sys___gettimeofday50(struct lwp *, const struct sys___gettimeofday50_args *, register_t *);
+
+int	sys___settimeofday50(struct lwp *, const struct sys___settimeofday50_args *, register_t *);
+
+int	sys___utimes50(struct lwp *, const struct sys___utimes50_args *, register_t *);
+
+int	sys___adjtime50(struct lwp *, const struct sys___adjtime50_args *, register_t *);
+
+int	sys___lfs_segwait50(struct lwp *, const struct sys___lfs_segwait50_args *, register_t *);
+
+int	sys___futimes50(struct lwp *, const struct sys___futimes50_args *, register_t *);
+
+int	sys___lutimes50(struct lwp *, const struct sys___lutimes50_args *, register_t *);
+
+int	sys___setitimer50(struct lwp *, const struct sys___setitimer50_args *, register_t *);
+
+int	sys___getitimer50(struct lwp *, const struct sys___getitimer50_args *, register_t *);
+
+int	sys___clock_gettime50(struct lwp *, const struct sys___clock_gettime50_args *, register_t *);
+
+int	sys___clock_settime50(struct lwp *, const struct sys___clock_settime50_args *, register_t *);
+
+int	sys___clock_getres50(struct lwp *, const struct sys___clock_getres50_args *, register_t *);
+
+int	sys___nanosleep50(struct lwp *, const struct sys___nanosleep50_args *, register_t *);
+
+int	sys_____sigtimedwait50(struct lwp *, const struct sys_____sigtimedwait50_args *, register_t *);
+
+int	sys___mq_timedsend50(struct lwp *, const struct sys___mq_timedsend50_args *, register_t *);
+
+int	sys___mq_timedreceive50(struct lwp *, const struct sys___mq_timedreceive50_args *, register_t *);
+
+int	compat_60_sys__lwp_park(struct lwp *, const struct compat_60_sys__lwp_park_args *, register_t *);
+
+int	sys___kevent50(struct lwp *, const struct sys___kevent50_args *, register_t *);
+
+int	sys___pselect50(struct lwp *, const struct sys___pselect50_args *, register_t *);
+
+int	sys___pollts50(struct lwp *, const struct sys___pollts50_args *, register_t *);
+
+int	sys___aio_suspend50(struct lwp *, const struct sys___aio_suspend50_args *, register_t *);
+
+int	sys___stat50(struct lwp *, const struct sys___stat50_args *, register_t *);
+
+int	sys___fstat50(struct lwp *, const struct sys___fstat50_args *, register_t *);
+
+int	sys___lstat50(struct lwp *, const struct sys___lstat50_args *, register_t *);
+
+int	sys_____semctl50(struct lwp *, const struct sys_____semctl50_args *, register_t *);
+
+int	sys___shmctl50(struct lwp *, const struct sys___shmctl50_args *, register_t *);
+
+int	sys___msgctl50(struct lwp *, const struct sys___msgctl50_args *, register_t *);
+
+int	sys___getrusage50(struct lwp *, const struct sys___getrusage50_args *, register_t *);
+
+int	sys___timer_settime50(struct lwp *, const struct sys___timer_settime50_args *, register_t *);
+
+int	sys___timer_gettime50(struct lwp *, const struct sys___timer_gettime50_args *, register_t *);
+
+#if defined(NTP) || !defined(_KERNEL_OPT)
+int	sys___ntp_gettime50(struct lwp *, const struct sys___ntp_gettime50_args *, register_t *);
+
+#else
+#endif
+int	sys___wait450(struct lwp *, const struct sys___wait450_args *, register_t *);
+
+int	sys___mknod50(struct lwp *, const struct sys___mknod50_args *, register_t *);
+
+int	sys___fhstat50(struct lwp *, const struct sys___fhstat50_args *, register_t *);
+
+int	sys_pipe2(struct lwp *, const struct sys_pipe2_args *, register_t *);
+
+int	sys_dup3(struct lwp *, const struct sys_dup3_args *, register_t *);
+
+int	sys_kqueue1(struct lwp *, const struct sys_kqueue1_args *, register_t *);
+
+int	sys_paccept(struct lwp *, const struct sys_paccept_args *, register_t *);
+
+int	sys_linkat(struct lwp *, const struct sys_linkat_args *, register_t *);
+
+int	sys_renameat(struct lwp *, const struct sys_renameat_args *, register_t *);
+
+int	sys_mkfifoat(struct lwp *, const struct sys_mkfifoat_args *, register_t *);
+
+int	sys_mknodat(struct lwp *, const struct sys_mknodat_args *, register_t *);
+
+int	sys_mkdirat(struct lwp *, const struct sys_mkdirat_args *, register_t *);
+
+int	sys_faccessat(struct lwp *, const struct sys_faccessat_args *, register_t *);
+
+int	sys_fchmodat(struct lwp *, const struct sys_fchmodat_args *, register_t *);
+
+int	sys_fchownat(struct lwp *, const struct sys_fchownat_args *, register_t *);
+
+int	sys_fexecve(struct lwp *, const struct sys_fexecve_args *, register_t *);
+
+int	sys_fstatat(struct lwp *, const struct sys_fstatat_args *, register_t *);
+
+int	sys_utimensat(struct lwp *, const struct sys_utimensat_args *, register_t *);
+
+int	sys_openat(struct lwp *, const struct sys_openat_args *, register_t *);
+
+int	sys_readlinkat(struct lwp *, const struct sys_readlinkat_args *, register_t *);
+
+int	sys_symlinkat(struct lwp *, const struct sys_symlinkat_args *, register_t *);
+
+int	sys_unlinkat(struct lwp *, const struct sys_unlinkat_args *, register_t *);
+
+int	sys_futimens(struct lwp *, const struct sys_futimens_args *, register_t *);
+
+int	sys___quotactl(struct lwp *, const struct sys___quotactl_args *, register_t *);
+
+int	sys_posix_spawn(struct lwp *, const struct sys_posix_spawn_args *, register_t *);
+
+int	sys_recvmmsg(struct lwp *, const struct sys_recvmmsg_args *, register_t *);
+
+int	sys_sendmmsg(struct lwp *, const struct sys_sendmmsg_args *, register_t *);
+
+int	sys_clock_nanosleep(struct lwp *, const struct sys_clock_nanosleep_args *, register_t *);
+
+int	sys____lwp_park60(struct lwp *, const struct sys____lwp_park60_args *, register_t *);
+
+int	sys_posix_fallocate(struct lwp *, const struct sys_posix_fallocate_args *, register_t *);
+
+int	sys_fdiscard(struct lwp *, const struct sys_fdiscard_args *, register_t *);
+
+#endif /* !RUMP_CLIENT */
+#endif /* _SYS_SYSCALLARGS_H_ */

Property changes on: lab4/.minix-src/include/sys/syscallargs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/tape.h
===================================================================
--- lab4/.minix-src/include/sys/tape.h	(nonexistent)
+++ lab4/.minix-src/include/sys/tape.h	(revision 13)
@@ -0,0 +1,81 @@
+/*	$NetBSD: tape.h,v 1.3 2005/12/26 18:41:36 perry Exp $	*/
+
+/*-
+ * Copyright (c) 2005 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Brett Lymn
+ *
+ * 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. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_TAPE_H_
+#define _SYS_TAPE_H_
+
+#include <sys/queue.h>
+
+#define	TAPENAMELEN	16
+
+/* The following structure is 64-bit alignment safe */
+struct tape_sysctl {
+	char		name[TAPENAMELEN];
+	int32_t		busy;
+	int32_t		pad;
+	uint64_t	xfer;
+	uint64_t	bytes;
+	uint32_t	attachtime_sec;
+	uint32_t	attachtime_usec;
+	uint32_t	timestamp_sec;
+	uint32_t	timestamp_usec;
+	uint32_t	time_sec;
+	uint32_t	time_usec;
+	uint64_t	rxfer;
+	uint64_t	rbytes;
+	uint64_t	wxfer;
+	uint64_t	wbytes;
+};
+
+/*
+ * Statistics for the tape device - in a separate structure so userland can
+ * see them.
+ */
+
+struct tape {
+	char		*name; 		/* name of drive */
+	int		busy;		/* drive is busy */
+	uint64_t       rxfer;		/* total number of read transfers */
+	uint64_t       wxfer;		/* total number of write transfers */
+	uint64_t       rbytes;		/* total bytes read */
+	uint64_t       wbytes;		/* total bytes written */
+	struct timeval  attachtime;	/* time tape was attached */
+	struct timeval  timestamp;	/* timestamp of last unbusy */
+	struct timeval  time;		/* total time spent busy */
+
+	TAILQ_ENTRY(tape) link;
+};
+
+/* Head of the tape stats list, define here so userland can get at it */
+TAILQ_HEAD(tapelist_head, tape);	/* the tapelist is a TAILQ */
+
+#endif
+

Property changes on: lab4/.minix-src/include/sys/tape.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/timepps.h
===================================================================
--- lab4/.minix-src/include/sys/timepps.h	(nonexistent)
+++ lab4/.minix-src/include/sys/timepps.h	(revision 13)
@@ -0,0 +1,247 @@
+/*	$NetBSD: timepps.h,v 1.21 2013/05/26 18:07:42 kardel Exp $	*/
+
+/*
+ * Copyright (c) 1998 Jonathan Stone
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Jonathan Stone for
+ *      the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+#ifndef _SYS_TIMEPPS_H_
+#define _SYS_TIMEPPS_H_
+
+/*
+ * This header file complies with "Pulse-Per-Second API for UNIX-like
+ * Operating Systems, Version 1.0", draft-mogul-pps-api-05.txt
+ */
+
+#include <sys/ioccom.h>
+
+#define PPS_API_VERS_1	1	/* API version number */
+
+/*
+ * PPSAPI type definitions
+ */
+typedef int32_t pps_handle_t;	/* represents a PPS source */
+typedef uint32_t pps_seq_t;	/* sequence number, at least 32 bits */
+
+typedef union pps_timeu {
+	struct timespec	tspec;
+	struct {        /* NTP long fixed-point format */
+		unsigned int     integral;
+		unsigned int     fractional;
+	} ntplfp;
+	unsigned long   longpair[2];
+} pps_timeu_t;
+
+
+/*
+ * timestamp information
+ */
+typedef struct {
+	pps_seq_t	assert_sequence;	/* assert event seq # */
+	pps_seq_t	clear_sequence;		/* clear event seq # */
+	pps_timeu_t	assert_tu;
+	pps_timeu_t	clear_tu;
+	int		current_mode;		/* current mode bits */
+} pps_info_t;
+
+#define assert_timestamp	assert_tu.tspec
+#define clear_timestamp		clear_tu.tspec
+
+
+/*
+ * Parameter structure
+ */
+typedef struct {
+	int api_version;			/* API version number */
+	int mode;				/* mode bits */
+	pps_timeu_t	assert_off_tu;
+	pps_timeu_t	clear_off_tu;
+} pps_params_t;
+#define assert_offset		assert_off_tu.tspec
+#define clear_offset		clear_off_tu.tspec
+
+
+/*
+ * Device/implementation parameters (mode, edge bits)
+ */
+#define PPS_CAPTUREASSERT	0x01
+#define PPS_CAPTURECLEAR	0x02
+#define PPS_CAPTUREBOTH		0x03
+#define PPS_OFFSETASSERT	0x10
+#define PPS_OFFSETCLEAR		0x20
+#define PPS_CANWAIT		0x100
+#define PPS_CANPOLL		0x200
+
+/*
+ * Kernel actions
+ */
+#define PPS_ECHOASSERT		0x40
+#define PPS_ECHOCLEAR		0x80
+
+
+/*
+ * timestamp formats (tsformat, mode)
+ */
+#define PPS_TSFMT_TSPEC		0x1000
+#define PPS_TSFMT_NTPLFP	0x2000
+
+/*
+ * Kernel discipline actions (kernel_consumer)
+ */
+#define PPS_KC_HARDPPS		0
+#define PPS_KC_HARDPPS_PLL	1
+#define PPS_KC_HARDPPS_FLL	2
+
+/*
+ * IOCTL definitions
+ */
+#define PPS_IOC_CREATE		_IO('1', 1)
+#define PPS_IOC_DESTROY		_IO('1', 2)
+#define PPS_IOC_SETPARAMS	_IOW('1', 3, pps_params_t)
+#define PPS_IOC_GETPARAMS	_IOR('1', 4, pps_params_t)
+#define PPS_IOC_GETCAP		_IOR('1', 5, int)
+#define PPS_IOC_FETCH		_IOWR('1', 6, pps_info_t)
+#define PPS_IOC_KCBIND		_IOW('1', 7, int)
+
+#ifdef _KERNEL
+
+#include <sys/mutex.h>
+
+/* flags for pps_ref_event() - bitmask but only 1 bit allowed */
+#define PPS_REFEVNT_CAPTURE	0x01 /* use captume time stamp */
+#define PPS_REFEVNT_CURRENT	0x02 /* use current time stamp */
+#define PPS_REFEVNT_CAPCUR	0x04 /* use average of above */
+#define PPS_REFEVNT_RMASK       0x0F /* mask reference bits */
+
+#define PPS_REFEVNT_PPS		0x10 /* guess PPS second from */
+                                     /* capture timestamp */
+
+extern kmutex_t timecounter_lock;
+
+struct pps_state {
+	/* Capture information. */
+	struct timehands *capth;
+	unsigned	capgen;
+	u_int64_t	capcount;
+	struct bintime  ref_time;
+
+	/* State information. */
+	pps_params_t	ppsparam;
+	pps_info_t	ppsinfo;
+	int		kcmode;
+	int		ppscap;
+	struct timecounter *ppstc;
+	u_int64_t	ppscount[3]; 
+};
+
+void pps_capture(struct pps_state *);
+void pps_event(struct pps_state *, int);
+void pps_ref_event(struct pps_state *, int, struct bintime *, int);
+void pps_init(struct pps_state *);
+int pps_ioctl(unsigned long, void *, struct pps_state *);
+
+#else /* !_KERNEL */
+
+#include <sys/cdefs.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+static __inline int time_pps_create(int, pps_handle_t *);
+static __inline int time_pps_destroy(pps_handle_t);
+static __inline int time_pps_setparams(pps_handle_t, const pps_params_t *);
+static __inline int time_pps_getparams(pps_handle_t, pps_params_t *);
+static __inline int time_pps_getcap(pps_handle_t, int *);
+static __inline int time_pps_fetch(pps_handle_t, const int, pps_info_t *,
+	const struct timespec *);
+#if 0
+static __inline int time_pps_wait(pps_handle_t, const struct timespec *,
+	pps_info_t *);
+#endif
+
+static __inline int time_pps_kcbind(pps_handle_t, const int, const int,
+	const int);
+
+static __inline int
+time_pps_create(int filedes, pps_handle_t *handle)
+{
+
+	*handle = filedes;
+	return (0);
+}
+
+static __inline int
+time_pps_destroy(pps_handle_t handle)
+{
+
+	return (0);
+}
+
+static __inline int
+time_pps_setparams(pps_handle_t handle, const pps_params_t *ppsparams)
+{
+
+	return (ioctl(handle, PPS_IOC_SETPARAMS, __UNCONST(ppsparams)));
+}
+
+static __inline int
+time_pps_getparams(pps_handle_t handle, pps_params_t *ppsparams)
+{
+
+	return (ioctl(handle, PPS_IOC_GETPARAMS, ppsparams));
+}
+
+static __inline int
+time_pps_getcap(pps_handle_t handle, int *mode)
+{
+
+	return (ioctl(handle, PPS_IOC_GETCAP, mode));
+}
+
+static __inline int
+time_pps_fetch(pps_handle_t handle, const int tsformat, pps_info_t *ppsinfobuf,
+	const struct timespec *timeout)
+{
+
+	return (ioctl(handle, PPS_IOC_FETCH, ppsinfobuf));
+}
+
+static __inline int
+time_pps_kcbind(pps_handle_t handle, const int kernel_consumer, const int edge,
+	const int tsformat)
+{
+
+	if (tsformat != PPS_TSFMT_TSPEC) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	return (ioctl(handle, PPS_IOC_KCBIND, __UNCONST(&edge)));
+}
+#endif /* !_KERNEL*/
+#endif /* SYS_TIMEPPS_H_ */

Property changes on: lab4/.minix-src/include/sys/timepps.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/tls.h
===================================================================
--- lab4/.minix-src/include/sys/tls.h	(nonexistent)
+++ lab4/.minix-src/include/sys/tls.h	(revision 13)
@@ -0,0 +1,61 @@
+/*	$NetBSD: tls.h,v 1.1 2011/03/09 23:10:07 joerg Exp $	*/
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_TLS_H_
+#define _SYS_TLS_H_
+
+#include <sys/cdefs.h>
+#include <machine/types.h>
+
+#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
+
+#if defined(__HAVE_TLS_VARIANT_I) && defined(__HAVE_TLS_VARIANT_II)
+#error Only one TLS variant can be supported at a time
+#endif
+
+struct tls_tcb {
+#ifdef __HAVE_TLS_VARIANT_I
+	void	**tcb_dtv;
+	void	*tcb_pthread;
+#else
+	void	*tcb_self;
+	void	**tcb_dtv;
+	void	*tcb_pthread;
+#endif
+};
+
+__BEGIN_PUBLIC_DECLS
+struct tls_tcb	*_rtld_tls_allocate(void);
+void	 	 _rtld_tls_free(struct tls_tcb *);
+void		 _rtld_tls_static_setup(void);
+__END_PUBLIC_DECLS
+#endif /* __HAVE_TLS_VARIANT_I || __HAVE_TLS_VARIANT_II */
+
+#endif /* _SYS_TLS_H_ */

Property changes on: lab4/.minix-src/include/sys/tls.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/wapbl_replay.h
===================================================================
--- lab4/.minix-src/include/sys/wapbl_replay.h	(nonexistent)
+++ lab4/.minix-src/include/sys/wapbl_replay.h	(revision 13)
@@ -0,0 +1,150 @@
+/*	$NetBSD: wapbl_replay.h,v 1.1 2008/11/24 16:05:21 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 2003,2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Wasabi Systems, Inc.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_WAPBL_REPLAY_H
+#define	_SYS_WAPBL_REPLAY_H
+
+#include <sys/types.h>
+
+/* The WAPBL journal layout.
+ * 
+ * The journal consists of a header followed by a circular buffer
+ * region.  The circular data area is described by the header
+ * wc_circ_off, wc_circ_size, wc_head and wc_tail fields as bytes
+ * from the start of the journal header.  New records are inserted
+ * at wc_head and the oldest valid record can be found at wc_tail.
+ * When ((wc_head == wc_tail) && (wc_head == 0)), the journal is empty.
+ * The condition of ((wc_head == wc_tail) && (wc_head != 0))
+ * indicates a full journal, although this condition is rare.
+ *
+ * The journal header as well as its records are marked by a 32bit
+ * type tag and length for ease of parsing.  Journal records are
+ * padded so as to fall on journal device block boundaries.
+ */
+
+/*
+ * The following are the 4 record types used by the journal:
+ * Each tag indicates journal data organized by one of the
+ * structures used below.
+ */
+enum {
+	WAPBL_WC_HEADER = 0x5741424c,	/* "WABL", struct wapbl_wc_header */
+	WAPBL_WC_INODES,		/* struct wapbl_wc_inodelist */
+	WAPBL_WC_REVOCATIONS,		/* struct wapbl_wc_blocklist */
+	WAPBL_WC_BLOCKS,		/* struct wapbl_wc_blocklist */
+};
+
+/* null entry (on disk) */
+/* This structure isn't used directly, but shares its header
+ * layout with all the other log structures for the purpose
+ * of reading a log structure and determining its type
+ */
+struct wapbl_wc_null {
+	uint32_t	wc_type;	/* WAPBL_WC_* */
+	int32_t		wc_len;
+	uint8_t		wc_spare[0];	/* actually longer */
+};
+
+/* journal header (on-disk)
+ * This record is found at the start of the
+ * journal, but not within the circular buffer region.  As well as
+ * describing the journal parameters and matching filesystem, it
+ * additionally serves as the atomic update record for journal
+ * updates.
+ */
+struct wapbl_wc_header {
+	uint32_t	wc_type;	/* WAPBL_WC_HEADER log magic number */
+	int32_t		wc_len;		/* length of this journal entry */
+	uint32_t	wc_checksum;
+	uint32_t	wc_generation;
+	int32_t		wc_fsid[2];
+	uint64_t	wc_time;
+	uint32_t	wc_timensec;
+	uint32_t	wc_version;
+	uint32_t	wc_log_dev_bshift;
+	uint32_t	wc_fs_dev_bshift;
+	int64_t		wc_head;
+	int64_t		wc_tail;
+	int64_t		wc_circ_off;	/* offset of of circ buffer region */
+	int64_t		wc_circ_size;	/* size of circular buffer region */
+	uint8_t		wc_spare[0];	/* actually longer */
+};
+
+/* list of blocks (on disk)
+ * This record is used to describe a set of filesystem blocks,
+ * and is used with two type tags, WAPBL_WC_BLOCKS and
+ * WAPBL_WC_REVOCATIONS.
+ * 
+ * For WAPBL_WC_BLOCKS, a copy of each listed block can be found
+ * starting at the next log device blocksize boundary.  starting at
+ * one log device block since the start of the record.  This contains
+ * the bulk of the filesystem journal data which is written using
+ * these records before being written into the filesystem.
+ *
+ * The WAPBL_WC_REVOCATIONS record is used to indicate that any
+ * previously listed blocks should not be written into the filesystem.
+ * This is important so that deallocated and reallocated data blocks
+ * do not get overwritten with stale data from the journal.  The
+ * revocation records do not contain a copy of any actual block data.
+ */
+struct wapbl_wc_blocklist {
+	uint32_t	wc_type; /* WAPBL_WC_{REVOCATIONS,BLOCKS} */
+	int32_t		wc_len;
+	int32_t		wc_blkcount;
+	int32_t		wc_unused;
+	struct {
+		int64_t	wc_daddr;
+		int32_t	wc_unused;
+		int32_t	wc_dlen;
+	} wc_blocks[0];			/* actually longer */
+};
+
+/* list of inodes (on disk)
+ * This record is used to describe the set of inodes which
+ * may be allocated but are unlinked.  Inodes end up listed here
+ * while they are in the process of being initialized and
+ * deinitialized.  Inodes unlinked while in use by a process
+ * will be listed here and the actual deletion must be completed
+ * on journal replay.
+ */
+struct wapbl_wc_inodelist {
+	uint32_t	wc_type; /* WAPBL_WC_INODES */
+	int32_t		wc_len;
+	int32_t		wc_inocnt;
+	int32_t		wc_clear;	/* set if previously listed inodes 
+					   hould be ignored */
+	struct {
+		uint32_t wc_inumber;
+		uint32_t wc_imode;
+	} wc_inodes[0];		/* actually longer */
+};
+
+#endif /* _SYS_WAPBL_REPLAY_H */

Property changes on: lab4/.minix-src/include/sys/wapbl_replay.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ext2fs/ext2fs_dinode.h
===================================================================
--- lab4/.minix-src/include/ufs/ext2fs/ext2fs_dinode.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ext2fs/ext2fs_dinode.h	(revision 13)
@@ -0,0 +1,201 @@
+/*	$NetBSD: ext2fs_dinode.h,v 1.26 2013/01/22 09:39:15 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dinode.h	8.6 (Berkeley) 9/13/94
+ *  Modified for ext2fs by Manuel Bouyer.
+ */
+
+/*
+ * Copyright (c) 1997 Manuel Bouyer.
+ *
+ * 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.
+ *
+ *	@(#)dinode.h	8.6 (Berkeley) 9/13/94
+ *  Modified for ext2fs by Manuel Bouyer.
+ */
+
+#ifndef _UFS_EXT2FS_EXT2FS_DINODE_H_
+#define _UFS_EXT2FS_EXT2FS_DINODE_H_
+
+#include <sys/stat.h>
+
+/*
+ * The root inode is the root of the file system.  Inode 0 can't be used for
+ * normal purposes and bad blocks are normally linked to inode 1, thus
+ * the root inode is 2.
+ * Inode 3 to 10 are reserved in ext2fs.
+ */
+#define	EXT2_BADBLKINO		((ino_t)1)
+#define	EXT2_ROOTINO		((ino_t)2)
+#define	EXT2_ACLIDXINO		((ino_t)3)
+#define	EXT2_ACLDATAINO		((ino_t)4)
+#define	EXT2_BOOTLOADERINO	((ino_t)5)
+#define	EXT2_UNDELDIRINO	((ino_t)6)
+#define	EXT2_RESIZEINO		((ino_t)7)
+#define	EXT2_JOURNALINO		((ino_t)8)
+#define	EXT2_FIRSTINO		((ino_t)11)
+
+/*
+ * A dinode contains all the meta-data associated with a UFS file.
+ * This structure defines the on-disk format of a dinode. Since
+ * this structure describes an on-disk structure, all its fields
+ * are defined by types with precise widths.
+ */
+
+/*
+ * XXX these are the same values as UFS_NDADDR/UFS_NIADDR and it is
+ * far from clear that there isn't code that relies on them being the
+ * same.
+ */
+#define	EXT2FS_NDADDR	12		/* Direct addresses in inode. */
+#define	EXT2FS_NIADDR	3		/* Indirect addresses in inode. */
+
+#define EXT2_MAXSYMLINKLEN ((EXT2FS_NDADDR+EXT2FS_NIADDR) * sizeof (uint32_t))
+
+struct ext2fs_dinode {
+	uint16_t	e2di_mode;	/*   0: IFMT, permissions; see below. */
+	uint16_t	e2di_uid;	/*   2: Owner UID */
+	uint32_t	e2di_size;	/*   4: Size (in bytes) */
+	uint32_t	e2di_atime;	/*   8: Access time */
+	uint32_t	e2di_ctime;	/*  12: Create time */
+	uint32_t	e2di_mtime;	/*  16: Modification time */
+	uint32_t	e2di_dtime;	/*  20: Deletion time */
+	uint16_t	e2di_gid;	/*  24: Owner GID */
+	uint16_t	e2di_nlink;	/*  26: File link count */
+	uint32_t	e2di_nblock;	/*  28: Blocks count */
+	uint32_t	e2di_flags;	/*  32: Status flags (chflags) */
+	uint32_t	e2di_version;	/*  36: was reserved1 */
+	uint32_t	e2di_blocks[EXT2FS_NDADDR+EXT2FS_NIADDR];
+					/* 40: disk blocks */
+	uint32_t	e2di_gen;	/* 100: generation number */
+	uint32_t	e2di_facl;	/* 104: file ACL (not implemented) */
+	uint32_t	e2di_dacl;	/* 108: dir ACL (not implemented) */
+	uint32_t	e2di_faddr;	/* 112: fragment address */
+	uint16_t	e2di_nblock_high; /* 116: Blocks count bits 47:32 */
+	uint16_t	e2di_facl_high; /* 118: file ACL bits 47:32 */
+	uint16_t	e2di_uid_high;	/* 120: Owner UID top 16 bits */
+	uint16_t	e2di_gid_high;	/* 122: Owner GID top 16 bits */
+	uint32_t	e2di_linux_reserved3; /* 124 */
+};
+
+
+/* XXX how does this differ from EXT2_MAXSYMLINKLEN above? */
+#define	E2MAXSYMLINKLEN	((EXT2FS_NDADDR + EXT2FS_NIADDR) * sizeof(uint32_t))
+
+/* File permissions. */
+#define	EXT2_IEXEC		0000100		/* Executable. */
+#define	EXT2_IWRITE		0000200		/* Writable. */
+#define	EXT2_IREAD		0000400		/* Readable. */
+#define	EXT2_ISVTX		0001000		/* Sticky bit. */
+#define	EXT2_ISGID		0002000		/* Set-gid. */
+#define	EXT2_ISUID		0004000		/* Set-uid. */
+
+/* File types. */
+#define	EXT2_IFMT		0170000		/* Mask of file type. */
+#define	EXT2_IFIFO		0010000		/* Named pipe (fifo). */
+#define	EXT2_IFCHR		0020000		/* Character device. */
+#define	EXT2_IFDIR		0040000		/* Directory file. */
+#define	EXT2_IFBLK		0060000		/* Block device. */
+#define	EXT2_IFREG		0100000		/* Regular file. */
+#define	EXT2_IFLNK		0120000		/* Symbolic link. */
+#define	EXT2_IFSOCK		0140000		/* UNIX domain socket. */
+
+/* file flags */
+#define EXT2_SECRM		0x00000001 /* Secure deletion */
+#define EXT2_UNRM		0x00000002 /* Undelete */
+#define EXT2_COMPR		0x00000004 /* Compress file */
+#define EXT2_SYNC		0x00000008 /* Synchronous updates */
+#define EXT2_IMMUTABLE		0x00000010 /* Immutable file */
+#define EXT2_APPEND		0x00000020 /* writes to file may only append */
+#define EXT2_NODUMP		0x00000040 /* do not dump file */
+#define EXT2_NOATIME		0x00000080 /* do not update atime */
+#define EXT2_INDEX		0x00001000 /* hash-indexed directory */
+#define EXT2_IMAGIC		0x00002000 /* AFS directory */
+#define EXT2_JOURNAL_DATA	0x00004000 /* file data should be journaled */
+#define EXT2_NOTAIL		0x00008000 /* file tail should not be merged */
+#define EXT2_DIRSYNC		0x00010000 /* dirsync behaviour */
+#define EXT2_TOPDIR		0x00020000 /* Top of directory hierarchies*/
+#define EXT2_HUGE_FILE		0x00040000 /* Set to each huge file */
+#define EXT2_EXTENTS		0x00080000 /* Inode uses extents */
+#define EXT2_EOFBLOCKS		0x00400000 /* Blocks allocated beyond EOF */
+
+/* Size of on-disk inode. */
+#define EXT2_REV0_DINODE_SIZE	sizeof(struct ext2fs_dinode)
+#define EXT2_DINODE_SIZE(fs)	((fs)->e2fs.e2fs_rev > E2FS_REV0 ?	\
+				    (fs)->e2fs.e2fs_inode_size :	\
+				    EXT2_REV0_DINODE_SIZE)
+
+/*
+ * The e2di_blocks fields may be overlaid with other information for
+ * file types that do not have associated disk storage. Block
+ * and character devices overlay the first data block with their
+ * dev_t value. Short symbolic links place their path in the
+ * di_db area.
+ */
+
+#define e2di_rdev		e2di_blocks[0]
+#define e2di_shortlink		e2di_blocks
+
+/* e2fs needs byte swapping on big-endian systems */
+#if BYTE_ORDER == LITTLE_ENDIAN
+#	define e2fs_iload(old, new)	\
+		memcpy((new),(old),sizeof(struct ext2fs_dinode))
+#	define e2fs_isave(old, new)	\
+		memcpy((new),(old),sizeof(struct ext2fs_dinode))
+#else
+void e2fs_i_bswap(struct ext2fs_dinode *, struct ext2fs_dinode *);
+#	define e2fs_iload(old, new) e2fs_i_bswap((old), (new))
+#	define e2fs_isave(old, new) e2fs_i_bswap((old), (new))
+#endif
+
+#endif /* !_UFS_EXT2FS_EXT2FS_DINODE_H_ */

Property changes on: lab4/.minix-src/include/ufs/ext2fs/ext2fs_dinode.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ffs/fs.h
===================================================================
--- lab4/.minix-src/include/ufs/ffs/fs.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ffs/fs.h	(revision 13)
@@ -0,0 +1,755 @@
+/*	$NetBSD: fs.h,v 1.66 2015/02/14 09:06:11 maxv Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)fs.h	8.13 (Berkeley) 3/21/95
+ */
+
+/*
+ * NOTE: COORDINATE ON-DISK FORMAT CHANGES WITH THE FREEBSD PROJECT.
+ */
+
+#ifndef	_UFS_FFS_FS_H_
+#define	_UFS_FFS_FS_H_
+
+/*
+ * Each disk drive contains some number of file systems.
+ * A file system consists of a number of cylinder groups.
+ * Each cylinder group has inodes and data.
+ *
+ * A file system is described by its super-block, which in turn
+ * describes the cylinder groups.  The super-block is critical
+ * data and is replicated in each cylinder group to protect against
+ * catastrophic loss.  This is done at `newfs' time and the critical
+ * super-block data does not change, so the copies need not be
+ * referenced further unless disaster strikes.
+ *
+ * For file system fs, the offsets of the various blocks of interest
+ * are given in the super block as:
+ *	[fs->fs_sblkno]		Super-block
+ *	[fs->fs_cblkno]		Cylinder group block
+ *	[fs->fs_iblkno]		Inode blocks
+ *	[fs->fs_dblkno]		Data blocks
+ * The beginning of cylinder group cg in fs, is given by
+ * the ``cgbase(fs, cg)'' macro.
+ *
+ * Depending on the architecture and the media, the superblock may
+ * reside in any one of four places. For tiny media where every block
+ * counts, it is placed at the very front of the partition. Historically,
+ * UFS1 placed it 8K from the front to leave room for the disk label and
+ * a small bootstrap. For UFS2 it got moved to 64K from the front to leave
+ * room for the disk label and a bigger bootstrap, and for really piggy
+ * systems we check at 256K from the front if the first three fail. In
+ * all cases the size of the superblock will be SBLOCKSIZE. All values are
+ * given in byte-offset form, so they do not imply a sector size. The
+ * SBLOCKSEARCH specifies the order in which the locations should be searched.
+ *
+ * Unfortunately the UFS2/FFSv2 change was done without adequate consideration
+ * of backward compatibility.  In particular 'newfs' for a FFSv2 partition
+ * must overwrite any old FFSv1 superblock at 8k, and preferably as many
+ * of the alternates as it can find - otherwise attempting to mount on a
+ * system that only supports FFSv1 is likely to succeed!.
+ * For a small FFSv1 filesystem, an old FFSv2 superblock can be left on
+ * the disk, and a system that tries to find an FFSv2 filesystem in preference
+ * to and FFSv1 one (as NetBSD does) can mount the old FFSv2 filesystem.
+ * As a added bonus, the 'first alternate' superblock of a FFSv1 filesystem
+ * with 64k blocks is at 64k - just where the code looks first when playing
+ * 'hunt the superblock'.
+ *
+ * The ffsv2 superblock layout (which might contain an ffsv1 filesystem)
+ * can be detected by checking for sb->fs_old_flags & FS_FLAGS_UPDATED.
+ * This is the default superblock type for NetBSD since ffsv2 support was added.
+ */
+#define	BBSIZE		8192
+#define	BBOFF		((off_t)(0))
+#define	BBLOCK		((daddr_t)(0))
+
+#define	SBLOCK_FLOPPY      0
+#define	SBLOCK_UFS1     8192
+#define	SBLOCK_UFS2    65536
+#define	SBLOCK_PIGGY  262144
+#define	SBLOCKSIZE      8192
+/*
+ * NB: Do not, under any circumstances, look for an ffsv1 filesystem at
+ * SBLOCK_UFS2.  Doing so will find the wrong superblock for filesystems
+ * with a 64k block size.
+ */
+#define	SBLOCKSEARCH \
+	{ SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }
+
+/*
+ * Max number of fragments per block. This value is NOT tweakable.
+ */
+#define	MAXFRAG		8
+
+
+
+/*
+ * Addresses stored in inodes are capable of addressing fragments
+ * of `blocks'. File system blocks of at most size MAXBSIZE can
+ * be optionally broken into 2, 4, or 8 pieces, each of which is
+ * addressable; these pieces may be DEV_BSIZE, or some multiple of
+ * a DEV_BSIZE unit.
+ *
+ * Large files consist of exclusively large data blocks.  To avoid
+ * undue wasted disk space, the last data block of a small file may be
+ * allocated as only as many fragments of a large block as are
+ * necessary.  The file system format retains only a single pointer
+ * to such a fragment, which is a piece of a single large block that
+ * has been divided.  The size of such a fragment is determinable from
+ * information in the inode, using the ``ffs_blksize(fs, ip, lbn)'' macro.
+ *
+ * The file system records space availability at the fragment level;
+ * to determine block availability, aligned fragments are examined.
+ */
+
+/*
+ * MINBSIZE is the smallest allowable block size.
+ * In order to insure that it is possible to create files of size
+ * 2^32 with only two levels of indirection, MINBSIZE is set to 4096.
+ * MINBSIZE must be big enough to hold a cylinder group block,
+ * thus changes to (struct cg) must keep its size within MINBSIZE.
+ * Note that super blocks are always of size SBSIZE,
+ * and that both SBSIZE and MAXBSIZE must be >= MINBSIZE.
+ */
+#define	MINBSIZE	4096
+
+/*
+ * The path name on which the file system is mounted is maintained
+ * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
+ * the super block for this name.
+ */
+#define	MAXMNTLEN	468
+
+/*
+ * The volume name for this filesystem is maintained in fs_volname.
+ * MAXVOLLEN defines the length of the buffer allocated.
+ * This space used to be part of of fs_fsmnt.
+ */
+#define	MAXVOLLEN	32
+
+/*
+ * There is a 128-byte region in the superblock reserved for in-core
+ * pointers to summary information. Originally this included an array
+ * of pointers to blocks of struct csum; now there are just four
+ * pointers and the remaining space is padded with fs_ocsp[].
+ * NOCSPTRS determines the size of this padding. One pointer (fs_csp)
+ * is taken away to point to a contiguous array of struct csum for
+ * all cylinder groups; a second (fs_maxcluster) points to an array
+ * of cluster sizes that is computed as cylinder groups are inspected;
+ * the third (fs_contigdirs) points to an array that tracks the
+ * creation of new directories; and the fourth (fs_active) is used
+ * by snapshots.
+ */
+#define	NOCSPTRS	((128 / sizeof(void *)) - 4)
+
+/*
+ * A summary of contiguous blocks of various sizes is maintained
+ * in each cylinder group. Normally this is set by the initial
+ * value of fs_maxcontig. To conserve space, a maximum summary size
+ * is set by FS_MAXCONTIG.
+ */
+#define	FS_MAXCONTIG	16
+
+/*
+ * The maximum number of snapshot nodes that can be associated
+ * with each filesystem. This limit affects only the number of
+ * snapshot files that can be recorded within the superblock so
+ * that they can be found when the filesystem is mounted. However,
+ * maintaining too many will slow the filesystem performance, so
+ * having this limit is a good idea.
+ */
+#define	FSMAXSNAP 20
+
+/*
+ * Used to identify special blocks in snapshots:
+ *
+ * BLK_NOCOPY - A block that was unallocated at the time the snapshot
+ *      was taken, hence does not need to be copied when written.
+ * BLK_SNAP - A block held by another snapshot that is not needed by this
+ *      snapshot. When the other snapshot is freed, the BLK_SNAP entries
+ *      are converted to BLK_NOCOPY. These are needed to allow fsck to
+ *      identify blocks that are in use by other snapshots (which are
+ *      expunged from this snapshot).
+ */
+#define	BLK_NOCOPY	((daddr_t)(1))
+#define	BLK_SNAP	((daddr_t)(2))
+
+/*
+ * MINFREE gives the minimum acceptable percentage of file system
+ * blocks which may be free. If the freelist drops below this level
+ * only the superuser may continue to allocate blocks. This may
+ * be set to 0 if no reserve of free blocks is deemed necessary,
+ * however throughput drops by fifty percent if the file system
+ * is run at between 95% and 100% full; thus the minimum default
+ * value of fs_minfree is 5%. However, to get good clustering
+ * performance, 10% is a better choice. This value is used only
+ * when creating a file system and can be overridden from the
+ * command line. By default we choose to optimize for time.
+ */
+#define	MINFREE		5
+#define	DEFAULTOPT	FS_OPTTIME
+
+/*
+ * Grigoriy Orlov <gluk@ptci.ru> has done some extensive work to fine
+ * tune the layout preferences for directories within a filesystem.
+ * His algorithm can be tuned by adjusting the following parameters
+ * which tell the system the average file size and the average number
+ * of files per directory. These defaults are well selected for typical
+ * filesystems, but may need to be tuned for odd cases like filesystems
+ * being used for squid caches or news spools.
+ */
+#define	AVFILESIZ	16384	/* expected average file size */
+#define	AFPDIR		64	/* expected number of files per directory */
+
+/*
+ * Per cylinder group information; summarized in blocks allocated
+ * from first cylinder group data blocks.  These blocks have to be
+ * read in from fs_csaddr (size fs_cssize) in addition to the
+ * super block.
+ */
+struct csum {
+	int32_t	cs_ndir;		/* number of directories */
+	int32_t	cs_nbfree;		/* number of free blocks */
+	int32_t	cs_nifree;		/* number of free inodes */
+	int32_t	cs_nffree;		/* number of free frags */
+};
+
+struct csum_total {
+	int64_t cs_ndir;		/* number of directories */
+	int64_t cs_nbfree;		/* number of free blocks */
+	int64_t cs_nifree;		/* number of free inodes */
+	int64_t cs_nffree;		/* number of free frags */
+	int64_t cs_spare[4];		/* future expansion */
+};
+
+
+/*
+ * Super block for an FFS file system in memory.
+ */
+struct fs {
+	int32_t	 fs_firstfield;		/* historic file system linked list, */
+	int32_t	 fs_unused_1;		/*     used for incore super blocks */
+	int32_t  fs_sblkno;		/* addr of super-block in filesys */
+	int32_t  fs_cblkno;		/* offset of cyl-block in filesys */
+	int32_t  fs_iblkno;		/* offset of inode-blocks in filesys */
+	int32_t  fs_dblkno;		/* offset of first data after cg */
+	int32_t	 fs_old_cgoffset;	/* cylinder group offset in cylinder */
+	int32_t	 fs_old_cgmask;		/* used to calc mod fs_ntrak */
+	int32_t	 fs_old_time;		/* last time written */
+	int32_t	 fs_old_size;		/* number of blocks in fs */
+	int32_t	 fs_old_dsize;		/* number of data blocks in fs */
+	int32_t	 fs_ncg;		/* number of cylinder groups */
+	int32_t	 fs_bsize;		/* size of basic blocks in fs */
+	int32_t	 fs_fsize;		/* size of frag blocks in fs */
+	int32_t	 fs_frag;		/* number of frags in a block in fs */
+/* these are configuration parameters */
+	int32_t	 fs_minfree;		/* minimum percentage of free blocks */
+	int32_t	 fs_old_rotdelay;	/* num of ms for optimal next block */
+	int32_t	 fs_old_rps;		/* disk revolutions per second */
+/* these fields can be computed from the others */
+	int32_t	 fs_bmask;		/* ``blkoff'' calc of blk offsets */
+	int32_t	 fs_fmask;		/* ``fragoff'' calc of frag offsets */
+	int32_t	 fs_bshift;		/* ``lblkno'' calc of logical blkno */
+	int32_t	 fs_fshift;		/* ``numfrags'' calc number of frags */
+/* these are configuration parameters */
+	int32_t	 fs_maxcontig;		/* max number of contiguous blks */
+	int32_t	 fs_maxbpg;		/* max number of blks per cyl group */
+/* these fields can be computed from the others */
+	int32_t	 fs_fragshift;		/* block to frag shift */
+	int32_t	 fs_fsbtodb;		/* fsbtodb and dbtofsb shift constant */
+	int32_t	 fs_sbsize;		/* actual size of super block */
+	int32_t	 fs_spare1[2];		/* old fs_csmask */
+					/* old fs_csshift */
+	int32_t	 fs_nindir;		/* value of FFS_NINDIR */
+	int32_t	 fs_inopb;		/* value of FFS_INOPB */
+	int32_t	 fs_old_nspf;		/* value of NSPF */
+/* yet another configuration parameter */
+	int32_t	 fs_optim;		/* optimization preference, see below */
+/* these fields are derived from the hardware */
+	int32_t	 fs_old_npsect;		/* # sectors/track including spares */
+	int32_t	 fs_old_interleave;	/* hardware sector interleave */
+	int32_t	 fs_old_trackskew;	/* sector 0 skew, per track */
+/* fs_id takes the space of the unused fs_headswitch and fs_trkseek fields */
+	int32_t	 fs_id[2];		/* unique file system id */
+/* sizes determined by number of cylinder groups and their sizes */
+	int32_t  fs_old_csaddr;		/* blk addr of cyl grp summary area */
+	int32_t	 fs_cssize;		/* size of cyl grp summary area */
+	int32_t	 fs_cgsize;		/* cylinder group size */
+/* these fields are derived from the hardware */
+	int32_t	 fs_spare2;		/* old fs_ntrak */
+	int32_t	 fs_old_nsect;		/* sectors per track */
+	int32_t	 fs_old_spc;		/* sectors per cylinder */
+	int32_t	 fs_old_ncyl;		/* cylinders in file system */
+	int32_t	 fs_old_cpg;		/* cylinders per group */
+	int32_t	 fs_ipg;		/* inodes per group */
+	int32_t	 fs_fpg;		/* blocks per group * fs_frag */
+/* this data must be re-computed after crashes */
+	struct	csum fs_old_cstotal;	/* cylinder summary information */
+/* these fields are cleared at mount time */
+	int8_t	 fs_fmod;		/* super block modified flag */
+	uint8_t	 fs_clean;		/* file system is clean flag */
+	int8_t	 fs_ronly;		/* mounted read-only flag */
+	uint8_t	 fs_old_flags;		/* see FS_ flags below */
+	u_char	 fs_fsmnt[MAXMNTLEN];	/* name mounted on */
+	u_char   fs_volname[MAXVOLLEN];	/* volume name */
+	uint64_t fs_swuid;		/* system-wide uid */
+	int32_t	 fs_pad;
+/* these fields retain the current block allocation info */
+	int32_t	 fs_cgrotor;		/* last cg searched (UNUSED) */
+	void 	*fs_ocsp[NOCSPTRS];	/* padding; was list of fs_cs buffers */
+	u_int8_t *fs_contigdirs;	/* # of contiguously allocated dirs */
+	struct csum *fs_csp;		/* cg summary info buffer for fs_cs */
+	int32_t	*fs_maxcluster;		/* max cluster in each cyl group */
+	u_char	*fs_active;		/* used by snapshots to track fs */
+	int32_t	 fs_old_cpc;		/* cyl per cycle in postbl */
+/* this area is otherwise allocated unless fs_old_flags & FS_FLAGS_UPDATED */
+	int32_t	 fs_maxbsize;		/* maximum blocking factor permitted */
+	uint8_t	 fs_journal_version;	/* journal format version */
+	uint8_t	 fs_journal_location;	/* journal location type */
+	uint8_t	 fs_journal_reserved[2];/* reserved for future use */
+	uint32_t fs_journal_flags;	/* journal flags */
+	uint64_t fs_journallocs[4];	/* location info for journal */
+	uint32_t fs_quota_magic;	/* see quota2.h */
+	uint8_t  fs_quota_flags;	/* see quota2.h */
+	uint8_t  fs_quota_reserved[3];	
+	uint64_t fs_quotafile[2];	/* pointer to quota inodes */
+	int64_t	 fs_sparecon64[9];	/* reserved for future use */
+	int64_t	 fs_sblockloc;		/* byte offset of standard superblock */
+	struct	csum_total fs_cstotal;	/* cylinder summary information */
+	int64_t  fs_time;		/* last time written */
+	int64_t	 fs_size;		/* number of blocks in fs */
+	int64_t	 fs_dsize;		/* number of data blocks in fs */
+	int64_t  fs_csaddr;		/* blk addr of cyl grp summary area */
+	int64_t	 fs_pendingblocks;	/* blocks in process of being freed */
+	int32_t	 fs_pendinginodes;	/* inodes in process of being freed */
+	int32_t	 fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */
+/* back to stuff that has been around a while */
+	int32_t	 fs_avgfilesize;	/* expected average file size */
+	int32_t	 fs_avgfpdir;		/* expected # of files per directory */
+	int32_t	 fs_save_cgsize;	/* save real cg size to use fs_bsize */
+	int32_t	 fs_sparecon32[26];	/* reserved for future constants */
+	uint32_t fs_flags;		/* see FS_ flags below */
+/* back to stuff that has been around a while (again) */
+	int32_t	 fs_contigsumsize;	/* size of cluster summary array */
+	int32_t	 fs_maxsymlinklen;	/* max length of an internal symlink */
+	int32_t	 fs_old_inodefmt;	/* format of on-disk inodes */
+	u_int64_t fs_maxfilesize;	/* maximum representable file size */
+	int64_t	 fs_qbmask;		/* ~fs_bmask for use with 64-bit size */
+	int64_t	 fs_qfmask;		/* ~fs_fmask for use with 64-bit size */
+	int32_t	 fs_state;		/* validate fs_clean field (UNUSED) */
+	int32_t	 fs_old_postblformat;	/* format of positional layout tables */
+	int32_t	 fs_old_nrpos;		/* number of rotational positions */
+	int32_t  fs_spare5[2];		/* old fs_postbloff */
+					/* old fs_rotbloff */
+	int32_t	 fs_magic;		/* magic number */
+};
+
+#define	fs_old_postbloff	fs_spare5[0]
+#define	fs_old_rotbloff		fs_spare5[1]
+#define	fs_old_postbl_start	fs_maxbsize
+#define	fs_old_headswitch	fs_id[0]
+#define	fs_old_trkseek	fs_id[1]
+#define	fs_old_csmask	fs_spare1[0]
+#define	fs_old_csshift	fs_spare1[1]
+
+#define	FS_42POSTBLFMT		-1	/* 4.2BSD rotational table format */
+#define	FS_DYNAMICPOSTBLFMT	1	/* dynamic rotational table format */
+
+#define	old_fs_postbl(fs_, cylno, opostblsave) \
+    ((((fs_)->fs_old_postblformat == FS_42POSTBLFMT) || \
+     ((fs_)->fs_old_postbloff == offsetof(struct fs, fs_old_postbl_start))) \
+    ? ((int16_t *)(opostblsave) + (cylno) * (fs_)->fs_old_nrpos) \
+    : ((int16_t *)((uint8_t *)(fs_) + \
+	(fs_)->fs_old_postbloff) + (cylno) * (fs_)->fs_old_nrpos))
+#define	old_fs_rotbl(fs) \
+    (((fs)->fs_old_postblformat == FS_42POSTBLFMT) \
+    ? ((uint8_t *)(&(fs)->fs_magic+1)) \
+    : ((uint8_t *)((uint8_t *)(fs) + (fs)->fs_old_rotbloff)))
+
+/*
+ * File system identification
+ */
+#define	FS_UFS1_MAGIC	0x011954	/* UFS1 fast file system magic number */
+#define	FS_UFS2_MAGIC	0x19540119	/* UFS2 fast file system magic number */
+#define	FS_UFS1_MAGIC_SWAPPED	0x54190100
+#define	FS_UFS2_MAGIC_SWAPPED	0x19015419
+#define	FS_OKAY		0x7c269d38	/* superblock checksum */
+#define	FS_42INODEFMT	-1		/* 4.2BSD inode format */
+#define	FS_44INODEFMT	2		/* 4.4BSD inode format */
+
+/*
+ * File system clean flags
+ */
+#define	FS_ISCLEAN	0x01
+#define	FS_WASCLEAN	0x02
+
+/*
+ * Preference for optimization.
+ */
+#define	FS_OPTTIME	0	/* minimize allocation time */
+#define	FS_OPTSPACE	1	/* minimize disk fragmentation */
+
+/*
+ * File system flags
+ */
+#define	FS_UNCLEAN	0x001	/* file system not clean at mount (unused) */
+#define	FS_DOSOFTDEP	0x002	/* file system using soft dependencies */
+#define	FS_NEEDSFSCK	0x004	/* needs sync fsck (FreeBSD compat, unused) */
+#define	FS_SUJ		0x008	/* file system using journaled softupdates */
+#define	FS_ACLS		0x010	/* file system has ACLs enabled */
+#define	FS_MULTILABEL	0x020	/* file system is MAC multi-label */
+#define	FS_GJOURNAL	0x40	/* gjournaled file system */
+#define	FS_FLAGS_UPDATED 0x80	/* flags have been moved to new location */
+#define	FS_DOWAPBL	0x100	/* Write ahead physical block logging */
+/*     	FS_NFS4ACLS	0x100	   file system has NFSv4 ACLs enabled (FBSD) */
+#define	FS_DOQUOTA2	0x200	/* in-filesystem quotas */
+/*     	FS_INDEXDIRS	0x200	   kernel supports indexed directories (FBSD)*/
+#define	FS_TRIM		0x400	/* discard deleted blocks in storage layer */
+
+/* File system flags that are ok for NetBSD if set in fs_flags */
+#define	FS_KNOWN_FLAGS	(FS_DOSOFTDEP | FS_DOWAPBL | FS_DOQUOTA2)
+
+/*
+ * File system internal flags, also in fs_flags.
+ * (Pick highest number to avoid conflicts with others)
+ */
+#define	FS_SWAPPED	0x80000000	/* file system is endian swapped */
+#define	FS_INTERNAL	0x80000000	/* mask for internal flags */
+
+/*
+ * Macros to access bits in the fs_active array.
+ */
+#define	ACTIVECG_SET(fs, cg)				\
+	do {						\
+		if ((fs)->fs_active != NULL)		\
+			setbit((fs)->fs_active, (cg));	\
+	} while (/*CONSTCOND*/ 0)
+#define	ACTIVECG_CLR(fs, cg)				\
+	do {						\
+		if ((fs)->fs_active != NULL)		\
+			clrbit((fs)->fs_active, (cg));	\
+	} while (/*CONSTCOND*/ 0)
+#define	ACTIVECG_ISSET(fs, cg)				\
+	((fs)->fs_active != NULL && isset((fs)->fs_active, (cg)))
+
+/*
+ * The size of a cylinder group is calculated by CGSIZE. The maximum size
+ * is limited by the fact that cylinder groups are at most one block.
+ * Its size is derived from the size of the maps maintained in the
+ * cylinder group and the (struct cg) size.
+ */
+#define	CGSIZE_IF(fs, ipg, fpg) \
+    /* base cg */	(sizeof(struct cg) + sizeof(int32_t) + \
+    /* old btotoff */	(fs)->fs_old_cpg * sizeof(int32_t) + \
+    /* old boff */	(fs)->fs_old_cpg * sizeof(u_int16_t) + \
+    /* inode map */	howmany((ipg), NBBY) + \
+    /* block map */	howmany((fpg), NBBY) +\
+    /* if present */	((fs)->fs_contigsumsize <= 0 ? 0 : \
+    /* cluster sum */	(fs)->fs_contigsumsize * sizeof(int32_t) + \
+    /* cluster map */	howmany(ffs_fragstoblks(fs, (fpg)), NBBY)))
+
+#define	CGSIZE(fs) CGSIZE_IF((fs), (fs)->fs_ipg, (fs)->fs_fpg)
+
+/*
+ * The minimal number of cylinder groups that should be created.
+ */
+#define	MINCYLGRPS	4
+
+
+/*
+ * Convert cylinder group to base address of its global summary info.
+ */
+#define	fs_cs(fs, indx)	fs_csp[indx]
+
+/*
+ * Cylinder group block for a file system.
+ */
+#define	CG_MAGIC	0x090255
+struct cg {
+	int32_t	 cg_firstfield;		/* historic cyl groups linked list */
+	int32_t	 cg_magic;		/* magic number */
+	int32_t	 cg_old_time;		/* time last written */
+	int32_t	 cg_cgx;		/* we are the cgx'th cylinder group */
+	int16_t	 cg_old_ncyl;		/* number of cyl's this cg */
+	int16_t	 cg_old_niblk;		/* number of inode blocks this cg */
+	int32_t	 cg_ndblk;		/* number of data blocks this cg */
+	struct	csum cg_cs;		/* cylinder summary information */
+	int32_t	 cg_rotor;		/* position of last used block */
+	int32_t	 cg_frotor;		/* position of last used frag */
+	int32_t	 cg_irotor;		/* position of last used inode */
+	int32_t	 cg_frsum[MAXFRAG];	/* counts of available frags */
+	int32_t	 cg_old_btotoff;	/* (int32) block totals per cylinder */
+	int32_t	 cg_old_boff;		/* (u_int16) free block positions */
+	int32_t	 cg_iusedoff;		/* (u_int8) used inode map */
+	int32_t	 cg_freeoff;		/* (u_int8) free block map */
+	int32_t	 cg_nextfreeoff;	/* (u_int8) next available space */
+	int32_t	 cg_clustersumoff;	/* (u_int32) counts of avail clusters */
+	int32_t	 cg_clusteroff;		/* (u_int8) free cluster map */
+	int32_t	 cg_nclusterblks;	/* number of clusters this cg */
+	int32_t  cg_niblk;		/* number of inode blocks this cg */
+	int32_t  cg_initediblk;		/* last initialized inode */
+	int32_t	 cg_sparecon32[3];	/* reserved for future use */
+	int64_t  cg_time;		/* time last written */
+	int64_t  cg_sparecon64[3];	/* reserved for future use */
+	u_int8_t cg_space[1];		/* space for cylinder group maps */
+/* actually longer */
+};
+
+/*
+ * The following structure is defined
+ * for compatibility with old file systems.
+ */
+struct ocg {
+	int32_t  cg_firstfield;		/* historic linked list of cyl groups */
+	int32_t  cg_unused_1;		/*     used for incore cyl groups */
+	int32_t  cg_time;		/* time last written */
+	int32_t  cg_cgx;		/* we are the cgx'th cylinder group */
+	int16_t  cg_ncyl;		/* number of cyl's this cg */
+	int16_t  cg_niblk;		/* number of inode blocks this cg */
+	int32_t  cg_ndblk;		/* number of data blocks this cg */
+	struct  csum cg_cs;		/* cylinder summary information */
+	int32_t  cg_rotor;		/* position of last used block */
+	int32_t  cg_frotor;		/* position of last used frag */
+	int32_t  cg_irotor;		/* position of last used inode */
+	int32_t  cg_frsum[8];		/* counts of available frags */
+	int32_t  cg_btot[32];		/* block totals per cylinder */
+	int16_t  cg_b[32][8];		/* positions of free blocks */
+	u_int8_t cg_iused[256];		/* used inode map */
+	int32_t  cg_magic;		/* magic number */
+	u_int8_t cg_free[1];		/* free block map */
+/* actually longer */
+};
+
+
+/*
+ * Macros for access to cylinder group array structures.
+ */
+#define	old_cg_blktot_old(cgp, ns) \
+    (((struct ocg *)(cgp))->cg_btot)
+#define	old_cg_blks_old(fs, cgp, cylno, ns) \
+    (((struct ocg *)(cgp))->cg_b[cylno])
+
+#define	old_cg_blktot_new(cgp, ns) \
+    ((int32_t *)((u_int8_t *)(cgp) + \
+	ufs_rw32((cgp)->cg_old_btotoff, (ns))))
+#define	old_cg_blks_new(fs, cgp, cylno, ns) \
+    ((int16_t *)((u_int8_t *)(cgp) + \
+	ufs_rw32((cgp)->cg_old_boff, (ns))) + (cylno) * (fs)->fs_old_nrpos)
+
+#define	old_cg_blktot(cgp, ns) \
+    ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
+      old_cg_blktot_old(cgp, ns) : old_cg_blktot_new(cgp, ns))
+#define	old_cg_blks(fs, cgp, cylno, ns) \
+    ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
+      old_cg_blks_old(fs, cgp, cylno, ns) : old_cg_blks_new(fs, cgp, cylno, ns))
+
+#define	cg_inosused_new(cgp, ns) \
+    ((u_int8_t *)((u_int8_t *)(cgp) + \
+	ufs_rw32((cgp)->cg_iusedoff, (ns))))
+#define	cg_blksfree_new(cgp, ns) \
+    ((u_int8_t *)((u_int8_t *)(cgp) + \
+	ufs_rw32((cgp)->cg_freeoff, (ns))))
+#define	cg_chkmagic_new(cgp, ns) \
+    (ufs_rw32((cgp)->cg_magic, (ns)) == CG_MAGIC)
+
+#define	cg_inosused_old(cgp, ns) \
+    (((struct ocg *)(cgp))->cg_iused)
+#define	cg_blksfree_old(cgp, ns) \
+    (((struct ocg *)(cgp))->cg_free)
+#define	cg_chkmagic_old(cgp, ns) \
+    (ufs_rw32(((struct ocg *)(cgp))->cg_magic, (ns)) == CG_MAGIC)
+
+#define	cg_inosused(cgp, ns) \
+    ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
+      cg_inosused_old(cgp, ns) : cg_inosused_new(cgp, ns))
+#define	cg_blksfree(cgp, ns) \
+    ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
+      cg_blksfree_old(cgp, ns) : cg_blksfree_new(cgp, ns))
+#define	cg_chkmagic(cgp, ns) \
+    (cg_chkmagic_new(cgp, ns) || cg_chkmagic_old(cgp, ns))
+
+#define	cg_clustersfree(cgp, ns) \
+    ((u_int8_t *)((u_int8_t *)(cgp) + \
+	ufs_rw32((cgp)->cg_clusteroff, (ns))))
+#define	cg_clustersum(cgp, ns) \
+    ((int32_t *)((u_int8_t *)(cgp) + \
+	ufs_rw32((cgp)->cg_clustersumoff, (ns))))
+
+
+/*
+ * Turn file system block numbers into disk block addresses.
+ * This maps file system blocks to device size blocks.
+ */
+#if defined (_KERNEL)
+#define	FFS_FSBTODB(fs, b)	((b) << ((fs)->fs_fshift - DEV_BSHIFT))
+#define	FFS_DBTOFSB(fs, b)	((b) >> ((fs)->fs_fshift - DEV_BSHIFT))
+#else
+#define	FFS_FSBTODB(fs, b)	((b) << (fs)->fs_fsbtodb)
+#define	FFS_DBTOFSB(fs, b)	((b) >> (fs)->fs_fsbtodb)
+#endif
+
+/*
+ * Cylinder group macros to locate things in cylinder groups.
+ * They calc file system addresses of cylinder group data structures.
+ */
+#define	cgbase(fs, c)	(((daddr_t)(fs)->fs_fpg) * (c))
+#define	cgstart_ufs1(fs, c) \
+    (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))
+#define	cgstart_ufs2(fs, c) cgbase((fs), (c))
+#define	cgstart(fs, c) ((fs)->fs_magic == FS_UFS2_MAGIC \
+			    ? cgstart_ufs2((fs), (c)) : cgstart_ufs1((fs), (c)))
+#define	cgdmin(fs, c)	(cgstart(fs, c) + (fs)->fs_dblkno)	/* 1st data */
+#define	cgimin(fs, c)	(cgstart(fs, c) + (fs)->fs_iblkno)	/* inode blk */
+#define	cgsblock(fs, c)	(cgstart(fs, c) + (fs)->fs_sblkno)	/* super blk */
+#define	cgtod(fs, c)	(cgstart(fs, c) + (fs)->fs_cblkno)	/* cg block */
+
+/*
+ * Macros for handling inode numbers:
+ *     inode number to file system block offset.
+ *     inode number to cylinder group number.
+ *     inode number to file system block address.
+ */
+#define	ino_to_cg(fs, x)	((x) / (fs)->fs_ipg)
+#define	ino_to_fsba(fs, x)						\
+	((daddr_t)(cgimin(fs, ino_to_cg(fs, x)) +			\
+	    (ffs_blkstofrags((fs), (((x) % (fs)->fs_ipg) / FFS_INOPB(fs))))))
+#define	ino_to_fsbo(fs, x)	((x) % FFS_INOPB(fs))
+
+/*
+ * Give cylinder group number for a file system block.
+ * Give cylinder group block number for a file system block.
+ */
+#define	dtog(fs, d)	((d) / (fs)->fs_fpg)
+#define	dtogd(fs, d)	((d) % (fs)->fs_fpg)
+
+/*
+ * Extract the bits for a block from a map.
+ * Compute the cylinder and rotational position of a cyl block addr.
+ */
+#define	blkmap(fs, map, loc) \
+    (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag)))
+#define	old_cbtocylno(fs, bno) \
+    (FFS_FSBTODB(fs, bno) / (fs)->fs_old_spc)
+#define	old_cbtorpos(fs, bno) \
+    ((fs)->fs_old_nrpos <= 1 ? 0 : \
+     (FFS_FSBTODB(fs, bno) % (fs)->fs_old_spc / (fs)->fs_old_nsect * (fs)->fs_old_trackskew + \
+      FFS_FSBTODB(fs, bno) % (fs)->fs_old_spc % (fs)->fs_old_nsect * (fs)->fs_old_interleave) % \
+     (fs)->fs_old_nsect * (fs)->fs_old_nrpos / (fs)->fs_old_npsect)
+
+/*
+ * The following macros optimize certain frequently calculated
+ * quantities by using shifts and masks in place of divisions
+ * modulos and multiplications.
+ */
+#define	ffs_blkoff(fs, loc)	/* calculates (loc % fs->fs_bsize) */ \
+	((loc) & (fs)->fs_qbmask)
+#define	ffs_fragoff(fs, loc)	/* calculates (loc % fs->fs_fsize) */ \
+	((loc) & (fs)->fs_qfmask)
+#define	ffs_lfragtosize(fs, frag) /* calculates ((off_t)frag * fs->fs_fsize) */ \
+	(((off_t)(frag)) << (fs)->fs_fshift)
+#define	ffs_lblktosize(fs, blk)	/* calculates ((off_t)blk * fs->fs_bsize) */ \
+	((uint64_t)(((off_t)(blk)) << (fs)->fs_bshift))
+#define	ffs_lblkno(fs, loc)	/* calculates (loc / fs->fs_bsize) */ \
+	((loc) >> (fs)->fs_bshift)
+#define	ffs_numfrags(fs, loc)	/* calculates (loc / fs->fs_fsize) */ \
+	((loc) >> (fs)->fs_fshift)
+#define	ffs_blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \
+	(((size) + (fs)->fs_qbmask) & (fs)->fs_bmask)
+#define	ffs_fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \
+	(((size) + (fs)->fs_qfmask) & (fs)->fs_fmask)
+#define	ffs_fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \
+	((frags) >> (fs)->fs_fragshift)
+#define	ffs_blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \
+	((blks) << (fs)->fs_fragshift)
+#define	ffs_fragnum(fs, fsb)	/* calculates (fsb % fs->fs_frag) */ \
+	((fsb) & ((fs)->fs_frag - 1))
+#define	ffs_blknum(fs, fsb)	/* calculates rounddown(fsb, fs->fs_frag) */ \
+	((fsb) &~ ((fs)->fs_frag - 1))
+
+/*
+ * Determine the number of available frags given a
+ * percentage to hold in reserve.
+ */
+#define	freespace(fs, percentreserved) \
+	(ffs_blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \
+	(fs)->fs_cstotal.cs_nffree - \
+	(((off_t)((fs)->fs_dsize)) * (percentreserved) / 100))
+
+/*
+ * Determining the size of a file block in the file system.
+ */
+#define	ffs_blksize(fs, ip, lbn) \
+	(((lbn) >= UFS_NDADDR || (ip)->i_size >= ffs_lblktosize(fs, (lbn) + 1)) \
+	    ? (fs)->fs_bsize \
+	    : ((int32_t)ffs_fragroundup(fs, ffs_blkoff(fs, (ip)->i_size))))
+
+#define	ffs_sblksize(fs, size, lbn) \
+	(((lbn) >= UFS_NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \
+	  ? (fs)->fs_bsize \
+	  : ((int32_t)ffs_fragroundup(fs, ffs_blkoff(fs, (uint64_t)(size)))))
+
+
+/*
+ * Number of inodes in a secondary storage block/fragment.
+ */
+#define	FFS_INOPB(fs)	((fs)->fs_inopb)
+#define	FFS_INOPF(fs)	((fs)->fs_inopb >> (fs)->fs_fragshift)
+
+/*
+ * Number of indirects in a file system block.
+ */
+#define	FFS_NINDIR(fs)	((fs)->fs_nindir)
+
+/*
+ * Apple UFS Label:
+ *  We check for this to decide to use APPLEUFS_DIRBLKSIZ
+ */
+#define	APPLEUFS_LABEL_MAGIC		0x4c41424c /* LABL */
+#define	APPLEUFS_LABEL_SIZE		1024
+#define	APPLEUFS_LABEL_OFFSET	(BBSIZE - APPLEUFS_LABEL_SIZE) /* located at 7k */
+#define	APPLEUFS_LABEL_VERSION	1
+#define	APPLEUFS_MAX_LABEL_NAME	512
+
+struct appleufslabel {
+	u_int32_t	ul_magic;
+	u_int16_t	ul_checksum;
+	u_int16_t	ul_unused0;
+	u_int32_t	ul_version;
+	u_int32_t	ul_time;
+	u_int16_t	ul_namelen;
+	u_char	ul_name[APPLEUFS_MAX_LABEL_NAME]; /* Warning: may not be null terminated */
+	u_int16_t	ul_unused1;
+	u_int64_t	ul_uuid;	/* Note this is only 4 byte aligned */
+	u_char	ul_reserved[24];
+	u_char	ul_unused[460];
+} __packed;
+
+
+#endif /* !_UFS_FFS_FS_H_ */

Property changes on: lab4/.minix-src/include/ufs/ffs/fs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/lfs/lfs_inode.h
===================================================================
--- lab4/.minix-src/include/ufs/lfs/lfs_inode.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/lfs/lfs_inode.h	(revision 13)
@@ -0,0 +1,290 @@
+/*	$NetBSD: lfs_inode.h,v 1.11 2015/09/01 06:08:37 dholland Exp $	*/
+/*  from NetBSD: ulfs_inode.h,v 1.5 2013/06/06 00:51:50 dholland Exp  */
+/*  from NetBSD: inode.h,v 1.64 2012/11/19 00:36:21 jakllsch Exp  */
+
+/*
+ * Copyright (c) 1982, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)inode.h	8.9 (Berkeley) 5/14/95
+ */
+
+#ifndef _UFS_LFS_LFS_INODE_H_
+#define	_UFS_LFS_LFS_INODE_H_
+
+/*
+ * Some of the userlevel code (fsck, newfs, lfs_cleanerd) wants to use
+ * the in-memory inode structure in a faked-up kernel environment.
+ * This header file provides a reasonably sanitized version of the
+ * structures and definitions needed for that purpose.
+ */
+
+#include <miscfs/genfs/genfs_node.h>
+#include <ufs/lfs/lfs.h>
+
+/*
+ * Adjustable filesystem parameters
+ */
+#define MIN_FREE_SEGS	20
+#define MIN_RESV_SEGS	15
+
+/*
+ * The following constants define the usage of the quota file array in the
+ * ulfsmount structure and dquot array in the inode structure.  The semantics
+ * of the elements of these arrays are defined in the routine lfs_getinoquota;
+ * the remainder of the quota code treats them generically and need not be
+ * inspected when changing the size of the array.
+ */
+#define	ULFS_MAXQUOTAS	2
+#define	ULFS_USRQUOTA	0	/* element used for user quotas */
+#define	ULFS_GRPQUOTA	1	/* element used for group quotas */
+
+/*
+ * Lookup result state (other than the result inode). This is
+ * currently stashed in the vnode between VOP_LOOKUP and directory
+ * operation VOPs, which is gross.
+ *
+ * XXX ulr_diroff is a lookup hint from the previos call of VOP_LOOKUP.
+ * probably it should not be here.
+ */
+struct ulfs_lookup_results {
+	int32_t	  ulr_count;	/* Size of free slot in directory. */
+	doff_t	  ulr_endoff;	/* End of useful stuff in directory. */
+	doff_t	  ulr_diroff;	/* Offset in dir, where we found last entry. */
+	doff_t	  ulr_offset;	/* Offset of free space in directory. */
+	u_int32_t ulr_reclen;	/* Size of found directory entry. */
+};
+
+/* notyet XXX */
+#define ULFS_CHECK_CRAPCOUNTER(dp) ((void)(dp)->i_crapcounter)
+
+/*
+ * Per-filesystem inode extensions.
+ */
+struct lfs_inode_ext;
+
+/*
+ * The inode is used to describe each active (or recently active) file in the
+ * ULFS filesystem. It is composed of two types of information. The first part
+ * is the information that is needed only while the file is active (such as
+ * the identity of the file and linkage to speed its lookup). The second part
+ * is the permanent meta-data associated with the file which is read in
+ * from the permanent dinode from long term storage when the file becomes
+ * active, and is put back when the file is no longer being used.
+ */
+struct inode {
+	struct genfs_node i_gnode;
+	LIST_ENTRY(inode) i_hash;/* Hash chain. */
+	TAILQ_ENTRY(inode) i_nextsnap; /* snapshot file list. */
+	struct	vnode *i_vnode;	/* Vnode associated with this inode. */
+	struct  ulfsmount *i_ump; /* Mount point associated with this inode. */
+	struct	vnode *i_devvp;	/* Vnode for block I/O. */
+	u_int32_t i_flag;	/* flags, see below */
+	dev_t	  i_dev;	/* Device associated with the inode. */
+	ino_t	  i_number;	/* The identity of the inode. */
+
+	struct lfs *i_lfs;	/* The LFS volume we belong to. */
+
+	void	*i_unused1;	/* Unused. */
+	struct	 dquot *i_dquot[ULFS_MAXQUOTAS]; /* Dquot structures. */
+	u_quad_t i_modrev;	/* Revision level for NFS lease. */
+	struct	 lockf *i_lockf;/* Head of byte-level lock list. */
+
+	/*
+	 * Side effects; used during (and after) directory lookup.
+	 * XXX should not be here.
+	 */
+	struct ulfs_lookup_results i_crap;
+	unsigned i_crapcounter;	/* serial number for i_crap */
+
+	/*
+	 * Inode extensions
+	 */
+	union {
+		/* Other extensions could go here... */
+		struct  lfs_inode_ext *lfs;
+	} inode_ext;
+	/*
+	 * Copies from the on-disk dinode itself.
+	 *
+	 * These fields are currently only used by LFS.
+	 */
+	u_int16_t i_mode;	/* IFMT, permissions; see below. */
+	int16_t   i_nlink;	/* File link count. */
+	u_int64_t i_size;	/* File byte count. */
+	u_int32_t i_flags;	/* Status flags (chflags). */
+	int32_t   i_gen;	/* Generation number. */
+	u_int32_t i_uid;	/* File owner. */
+	u_int32_t i_gid;	/* File group. */
+	u_int16_t i_omode;	/* Old mode, for ulfs_reclaim. */
+
+	struct dirhash *i_dirhash;	/* Hashing for large directories */
+
+	/*
+	 * The on-disk dinode itself.
+	 */
+	union lfs_dinode *i_din;
+};
+
+/* These flags are kept in i_flag. */
+#define	IN_ACCESS	0x0001		/* Access time update request. */
+#define	IN_CHANGE	0x0002		/* Inode change time update request. */
+#define	IN_UPDATE	0x0004		/* Inode was written to; update mtime. */
+#define	IN_MODIFY	0x2000		/* Modification time update request. */
+#define	IN_MODIFIED	0x0008		/* Inode has been modified. */
+#define	IN_ACCESSED	0x0010		/* Inode has been accessed. */
+/* 	   unused	0x0020 */	/* was IN_RENAME */
+#define	IN_SHLOCK	0x0040		/* File has shared lock. */
+#define	IN_EXLOCK	0x0080		/* File has exclusive lock. */
+#define	IN_CLEANING	0x0100		/* LFS: file is being cleaned */
+#define	IN_ADIROP	0x0200		/* LFS: dirop in progress */
+/* 	   unused	0x0400 */	/* was FFS-only IN_SPACECOUNTED */
+#define	IN_PAGING       0x1000		/* LFS: file is on paging queue */
+#define IN_CDIROP       0x4000          /* LFS: dirop completed pending i/o */
+
+/*
+ * LFS inode extensions.
+ */
+struct lfs_inode_ext {
+	off_t	  lfs_osize;		/* size of file on disk */
+	u_int64_t lfs_effnblocks;  /* number of blocks when i/o completes */
+	size_t	  lfs_fragsize[ULFS_NDADDR]; /* size of on-disk direct blocks */
+	TAILQ_ENTRY(inode) lfs_dchain;  /* Dirop chain. */
+	TAILQ_ENTRY(inode) lfs_pchain;  /* Paging chain. */
+#define LFSI_NO_GOP_WRITE 0x01
+#define LFSI_DELETED      0x02
+#define LFSI_WRAPBLOCK    0x04
+#define LFSI_WRAPWAIT     0x08
+#define LFSI_BMAP         0x10
+	u_int32_t lfs_iflags;           /* Inode flags */
+	daddr_t   lfs_hiblk;		/* Highest lbn held by inode */
+#ifdef _KERNEL
+	SPLAY_HEAD(lfs_splay, lbnentry) lfs_lbtree; /* Tree of balloc'd lbns */
+	int	  lfs_nbtree;		/* Size of tree */
+	LIST_HEAD(, segdelta) lfs_segdhd;
+#endif
+	int16_t	  lfs_odnlink;		/* on-disk nlink count for cleaner */
+};
+#define i_lfs_osize		inode_ext.lfs->lfs_osize
+#define i_lfs_effnblks		inode_ext.lfs->lfs_effnblocks
+#define i_lfs_fragsize		inode_ext.lfs->lfs_fragsize
+#define i_lfs_dchain		inode_ext.lfs->lfs_dchain
+#define i_lfs_pchain		inode_ext.lfs->lfs_pchain
+#define i_lfs_iflags		inode_ext.lfs->lfs_iflags
+#define i_lfs_hiblk		inode_ext.lfs->lfs_hiblk
+#define i_lfs_lbtree		inode_ext.lfs->lfs_lbtree
+#define i_lfs_nbtree		inode_ext.lfs->lfs_nbtree
+#define i_lfs_segdhd		inode_ext.lfs->lfs_segdhd
+#define i_lfs_odnlink		inode_ext.lfs->lfs_odnlink
+
+/*
+ * "struct buf" associated definitions
+ */
+
+#ifdef _KERNEL
+
+# define LFS_IS_MALLOC_BUF(bp) ((bp)->b_iodone == lfs_callback)
+
+# ifdef DEBUG
+#  define LFS_DEBUG_COUNTLOCKED(m) do {					\
+	if (lfs_debug_log_subsys[DLOG_LLIST]) {				\
+		lfs_countlocked(&locked_queue_count, &locked_queue_bytes, (m)); \
+		cv_broadcast(&locked_queue_cv);				\
+	}								\
+} while (0)
+# else
+#  define LFS_DEBUG_COUNTLOCKED(m)
+# endif
+
+/* log for debugging writes to the Ifile */
+# ifdef DEBUG
+struct lfs_log_entry {
+	const char *op;
+	const char *file;
+	int pid;
+	int line;
+	daddr_t block;
+	unsigned long flags;
+};
+extern int lfs_lognum;
+extern struct lfs_log_entry lfs_log[LFS_LOGLENGTH];
+#  define LFS_BWRITE_LOG(bp) lfs_bwrite_log((bp), __FILE__, __LINE__)
+#  define LFS_ENTER_LOG(theop, thefile, theline, lbn, theflags, thepid) do {\
+	int _s;								\
+									\
+	mutex_enter(&lfs_lock);						\
+	_s = splbio();							\
+	lfs_log[lfs_lognum].op = theop;					\
+	lfs_log[lfs_lognum].file = thefile;				\
+	lfs_log[lfs_lognum].line = (theline);				\
+	lfs_log[lfs_lognum].pid = (thepid);				\
+	lfs_log[lfs_lognum].block = (lbn);				\
+	lfs_log[lfs_lognum].flags = (theflags);				\
+	lfs_lognum = (lfs_lognum + 1) % LFS_LOGLENGTH;			\
+	splx(_s);							\
+	mutex_exit(&lfs_lock);						\
+} while (0)
+
+#  define LFS_BCLEAN_LOG(fs, bp) do {					\
+	if ((bp)->b_vp == (fs)->lfs_ivnode)				\
+		LFS_ENTER_LOG("clear", __FILE__, __LINE__,		\
+			      bp->b_lblkno, bp->b_flags, curproc->p_pid);\
+} while (0)
+
+/* Must match list in lfs_vfsops.c ! */
+#  define DLOG_RF     0  /* roll forward */
+#  define DLOG_ALLOC  1  /* inode alloc */
+#  define DLOG_AVAIL  2  /* lfs_{,r,f}avail */
+#  define DLOG_FLUSH  3  /* flush */
+#  define DLOG_LLIST  4  /* locked list accounting */
+#  define DLOG_WVNODE 5  /* vflush/writevnodes verbose */
+#  define DLOG_VNODE  6  /* vflush/writevnodes */
+#  define DLOG_SEG    7  /* segwrite */
+#  define DLOG_SU     8  /* seguse accounting */
+#  define DLOG_CLEAN  9  /* cleaner routines */
+#  define DLOG_MOUNT  10 /* mount/unmount */
+#  define DLOG_PAGE   11 /* putpages/gop_write */
+#  define DLOG_DIROP  12 /* dirop accounting */
+#  define DLOG_MALLOC 13 /* lfs_malloc accounting */
+#  define DLOG_MAX    14 /* The terminator */
+#  define DLOG(a) lfs_debug_log a
+# else /* ! DEBUG */
+#  define LFS_BCLEAN_LOG(fs, bp)
+#  define LFS_BWRITE_LOG(bp)		VOP_BWRITE((bp)->b_vp, (bp))
+#  define DLOG(a)
+# endif /* ! DEBUG */
+#else /* ! _KERNEL */
+# define LFS_BWRITE_LOG(bp)		VOP_BWRITE((bp))
+#endif /* _KERNEL */
+
+
+#endif /* _UFS_LFS_LFS_INODE_H_ */

Property changes on: lab4/.minix-src/include/ufs/lfs/lfs_inode.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/lfs/lfs_extern.h
===================================================================
--- lab4/.minix-src/include/ufs/lfs/lfs_extern.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/lfs/lfs_extern.h	(revision 13)
@@ -0,0 +1,281 @@
+/*	$NetBSD: lfs_extern.h,v 1.110 2015/08/12 18:28:01 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Konrad E. Schroder <perseant@hhhh.org>.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)lfs_extern.h	8.6 (Berkeley) 5/8/95
+ */
+
+#ifndef _UFS_LFS_LFS_EXTERN_H_
+#define _UFS_LFS_LFS_EXTERN_H_
+
+#ifdef _KERNEL
+#include <sys/mallocvar.h>
+
+MALLOC_DECLARE(M_SEGMENT);
+#endif
+
+/* Copied from ext2fs for ITIMES.  XXX This is a bogus use of v_tag. */
+#define IS_LFS_VNODE(vp)   (vp->v_tag == VT_LFS)
+
+/*
+ * Sysctl values for LFS.
+ */
+#define LFS_WRITEINDIR	 1 /* flush indirect blocks on non-checkpoint writes */
+#define LFS_CLEAN_VNHEAD 2 /* put prev unrefed cleaned vnodes on head of free list */
+#define LFS_DOSTATS	 3
+#define LFS_MAXPAGES	 4
+#define LFS_FS_PAGETRIP	 5
+#define LFS_STATS	 6
+#define LFS_DO_RFW	 7
+#define LFS_DEBUGLOG	 8
+#define LFS_IGNORE_LAZY_SYNC	9
+#define LFS_MAXID	 10
+
+/* not ours */
+struct fid;
+struct mount;
+struct nameidata;
+struct proc;
+struct statvfs;
+struct timeval;
+struct uio;
+struct mbuf;
+struct buf;
+struct vnode;
+
+/* ours */
+struct inode;
+union lfs_dinode;
+struct dlfs;
+struct lfs;
+struct segment;
+struct block_info;
+
+__BEGIN_DECLS
+
+#if defined(_KERNEL)
+
+extern int lfs_allclean_wakeup;
+extern struct pool lfs_inode_pool;		/* memory pool for inodes */
+extern struct pool lfs_dinode_pool;		/* memory pool for dinodes */
+extern struct pool lfs_inoext_pool;	/* memory pool for inode extension */
+extern struct pool lfs_lbnentry_pool;   /* memory pool for balloc accounting */
+
+extern int locked_queue_count;
+extern long locked_queue_bytes;
+extern int lfs_subsys_pages;
+extern int lfs_dirvcount;
+extern kmutex_t lfs_lock;
+extern int lfs_debug_log_subsys[];
+extern kcondvar_t lfs_writing_cv;
+extern kcondvar_t locked_queue_cv;
+
+/* lfs_alloc.c */
+int lfs_valloc(struct vnode *, int, kauth_cred_t, ino_t *, int *);
+int lfs_valloc_fixed(struct lfs *, ino_t, int);
+int lfs_vfree(struct vnode *, ino_t, int);
+void lfs_order_freelist(struct lfs *);
+int lfs_extend_ifile(struct lfs *, kauth_cred_t);
+void lfs_orphan(struct lfs *, ino_t);
+
+/* lfs_balloc.c */
+int lfs_balloc(struct vnode *, off_t, int, kauth_cred_t, int, struct buf **);
+void lfs_register_block(struct vnode *, daddr_t);
+void lfs_deregister_block(struct vnode *, daddr_t);
+void lfs_deregister_all(struct vnode *);
+
+/* lfs_bio.c */
+int lfs_availwait(struct lfs *, int);
+int lfs_bwrite_ext(struct buf *, int);
+int lfs_fits(struct lfs *, int);
+void lfs_flush_fs(struct lfs *, int);
+void lfs_flush(struct lfs *, int, int);
+int lfs_check(struct vnode *, daddr_t, int);
+void lfs_freebuf(struct lfs *, struct buf *);
+struct buf *lfs_newbuf(struct lfs *, struct vnode *, daddr_t, size_t, int);
+void lfs_countlocked(int *, long *, const char *);
+int lfs_reserve(struct lfs *, struct vnode *, struct vnode *, int);
+
+/* lfs_debug.c */
+#ifdef DEBUG
+int lfs_bwrite_log(struct buf *, const char *, int);
+void lfs_dumplog(void);
+void lfs_dump_super(struct lfs *);
+void lfs_dump_dinode(struct lfs *, union lfs_dinode *);
+void lfs_check_bpp(struct lfs *, struct segment *, char *, int);
+void lfs_check_segsum(struct lfs *, struct segment *, char *, int);
+void lfs_debug_log(int, const char *, ...);
+#endif /* DEBUG */
+
+/* lfs_inode.c */
+int lfs_update(struct vnode *, const struct timespec *, const struct timespec *,
+    int);
+int lfs_truncate(struct vnode *, off_t, int, kauth_cred_t);
+union lfs_dinode *lfs_ifind(struct lfs *, ino_t, struct buf *);
+void lfs_finalize_ino_seguse(struct lfs *, struct inode *);
+void lfs_finalize_fs_seguse(struct lfs *);
+
+/* lfs_rename.c */
+int lfs_rename(void *);
+
+/* lfs_rfw.c */
+int lfs_rf_valloc(struct lfs *, ino_t, int, struct lwp *, struct vnode **);
+void lfs_roll_forward(struct lfs *, struct mount *, struct lwp *);
+
+/* lfs_segment.c */
+void lfs_imtime(struct lfs *);
+int lfs_vflush(struct vnode *);
+int lfs_segwrite(struct mount *, int);
+int lfs_writefile(struct lfs *, struct segment *, struct vnode *);
+int lfs_writeinode(struct lfs *, struct segment *, struct inode *);
+int lfs_gatherblock(struct segment *, struct buf *, kmutex_t *);
+int lfs_gather(struct lfs *, struct segment *, struct vnode *, int (*match )(struct lfs *, struct buf *));
+void lfs_update_single(struct lfs *, struct segment *, struct vnode *,
+    daddr_t, daddr_t, int);
+void lfs_updatemeta(struct segment *);
+int lfs_rewind(struct lfs *, int);
+void lfs_unset_inval_all(struct lfs *);
+int lfs_initseg(struct lfs *);
+int lfs_writeseg(struct lfs *, struct segment *);
+void lfs_writesuper(struct lfs *, daddr_t);
+int lfs_match_data(struct lfs *, struct buf *);
+int lfs_match_indir(struct lfs *, struct buf *);
+int lfs_match_dindir(struct lfs *, struct buf *);
+int lfs_match_tindir(struct lfs *, struct buf *);
+void lfs_callback(struct buf *);
+void lfs_acquire_finfo(struct lfs *fs, ino_t, int);
+void lfs_release_finfo(struct lfs *fs);
+
+/* lfs_subr.c */
+void lfs_setup_resblks(struct lfs *);
+void lfs_pad_check(unsigned char *, int, char *, int);
+void lfs_free_resblks(struct lfs *);
+void *lfs_malloc(struct lfs *, size_t, int);
+void lfs_free(struct lfs *, void *, int);
+int lfs_seglock(struct lfs *, unsigned long);
+void lfs_segunlock(struct lfs *);
+void lfs_segunlock_relock(struct lfs *);
+int lfs_writer_enter(struct lfs *, const char *);
+void lfs_writer_leave(struct lfs *);
+void lfs_wakeup_cleaner(struct lfs *);
+
+/* lfs_syscalls.c */
+int lfs_do_segclean(struct lfs *, unsigned long);
+int lfs_segwait(fsid_t *, struct timeval *);
+int lfs_bmapv(struct lwp *, fsid_t *, struct block_info *, int);
+int lfs_markv(struct lwp *, fsid_t *, struct block_info *, int);
+
+/* lfs_vfsops.c */
+VFS_PROTOS(lfs);
+void lfs_vinit(struct mount *, struct vnode **);
+int lfs_resize_fs(struct lfs *, int);
+
+/* lfs_vnops.c */
+void lfs_mark_vnode(struct vnode *);
+void lfs_unmark_vnode(struct vnode *);
+int lfs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
+void lfs_gop_size(struct vnode *, off_t, off_t *, int);
+int lfs_putpages_ext(void *, int);
+int lfs_gatherpages(struct vnode *);
+int lfs_flush_dirops(struct lfs *);
+int lfs_flush_pchain(struct lfs *);
+
+int lfs_bwrite	 (void *);
+int lfs_fsync	 (void *);
+int lfs_symlink	 (void *);
+int lfs_mknod	 (void *);
+int lfs_create	 (void *);
+int lfs_mkdir	 (void *);
+int lfs_read	 (void *);
+int lfs_remove	 (void *);
+int lfs_rmdir	 (void *);
+int lfs_link	 (void *);
+int lfs_mmap	 (void *);
+int lfs_rename	 (void *);
+int lfs_getattr	 (void *);
+int lfs_setattr	 (void *);
+int lfs_close	 (void *);
+int lfsspec_close(void *);
+int lfsfifo_close(void *);
+int lfs_fcntl	 (void *);
+int lfs_inactive (void *);
+int lfs_reclaim	 (void *);
+int lfs_strategy (void *);
+int lfs_write	 (void *);
+int lfs_getpages (void *);
+int lfs_putpages (void *);
+
+int lfs_bufrd(struct vnode *, struct uio *, int, kauth_cred_t);
+int lfs_bufwr(struct vnode *, struct uio *, int, kauth_cred_t);
+
+extern int lfs_mount_type;
+extern int (**lfs_vnodeop_p)(void *);
+extern int (**lfs_specop_p)(void *);
+extern int (**lfs_fifoop_p)(void *);
+extern const struct genfs_ops lfs_genfsops;
+
+#endif /* defined(_KERNEL) */
+
+/* lfs_cksum.c */
+u_int32_t cksum(void *, size_t);
+u_int32_t lfs_cksum_part(void *, size_t, u_int32_t);
+#define lfs_cksum_fold(sum)	(sum)
+u_int32_t lfs_sb_cksum(struct lfs *);
+
+__END_DECLS
+
+#endif /* !_UFS_LFS_LFS_EXTERN_H_ */

Property changes on: lab4/.minix-src/include/ufs/lfs/lfs_extern.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/dinode.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/dinode.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/dinode.h	(revision 13)
@@ -0,0 +1,176 @@
+/*	$NetBSD: dinode.h,v 1.24 2013/06/09 17:55:46 dholland Exp $	*/
+
+/*
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by Marshall
+ * Kirk McKusick and Network Associates Laboratories, the Security
+ * Research Division of Network Associates, Inc. under DARPA/SPAWAR
+ * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
+ * research program
+ *
+ * Copyright (c) 1982, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dinode.h	8.9 (Berkeley) 3/29/95
+ */
+
+/*
+ * NOTE: COORDINATE ON-DISK FORMAT CHANGES WITH THE FREEBSD PROJECT.
+ */
+
+#ifndef	_UFS_UFS_DINODE_H_
+#define	_UFS_UFS_DINODE_H_
+
+/*
+ * The root inode is the root of the file system.  Inode 0 can't be used for
+ * normal purposes and historically bad blocks were linked to inode 1, thus
+ * the root inode is 2.  (Inode 1 is no longer used for this purpose, however
+ * numerous dump tapes make this assumption, so we are stuck with it).
+ */
+#define	UFS_ROOTINO	((ino_t)2)
+
+/*
+ * The Whiteout inode# is a dummy non-zero inode number which will
+ * never be allocated to a real file.  It is used as a place holder
+ * in the directory entry which has been tagged as a DT_W entry.
+ * See the comments about UFS_ROOTINO above.
+ */
+#define	UFS_WINO	((ino_t)1)
+
+/*
+ * A dinode contains all the meta-data associated with a UFS file.
+ * This structure defines the on-disk format of a dinode. Since
+ * this structure describes an on-disk structure, all its fields
+ * are defined by types with precise widths.
+ */
+
+#define UFS_NXADDR	2
+#define	UFS_NDADDR	12		/* Direct addresses in inode. */
+#define	UFS_NIADDR	3		/* Indirect addresses in inode. */
+
+struct ufs1_dinode {
+	u_int16_t	di_mode;	/*   0: IFMT, permissions; see below. */
+	int16_t		di_nlink;	/*   2: File link count. */
+	u_int16_t	di_oldids[2];	/*   4: Ffs: old user and group ids. */
+	u_int64_t	di_size;	/*   8: File byte count. */
+	int32_t		di_atime;	/*  16: Last access time. */
+	int32_t		di_atimensec;	/*  20: Last access time. */
+	int32_t		di_mtime;	/*  24: Last modified time. */
+	int32_t		di_mtimensec;	/*  28: Last modified time. */
+	int32_t		di_ctime;	/*  32: Last inode change time. */
+	int32_t		di_ctimensec;	/*  36: Last inode change time. */
+	int32_t		di_db[UFS_NDADDR]; /*  40: Direct disk blocks. */
+	int32_t		di_ib[UFS_NIADDR]; /*  88: Indirect disk blocks. */
+	u_int32_t	di_flags;	/* 100: Status flags (chflags). */
+	u_int32_t	di_blocks;	/* 104: Blocks actually held. */
+	int32_t		di_gen;		/* 108: Generation number. */
+	u_int32_t	di_uid;		/* 112: File owner. */
+	u_int32_t	di_gid;		/* 116: File group. */
+	u_int64_t	di_modrev;	/* 120: i_modrev for NFSv4 */
+};
+
+struct ufs2_dinode {
+	u_int16_t	di_mode;	/*   0: IFMT, permissions; see below. */
+	int16_t		di_nlink;	/*   2: File link count. */
+	u_int32_t	di_uid;		/*   4: File owner. */
+	u_int32_t	di_gid;		/*   8: File group. */
+	u_int32_t	di_blksize;	/*  12: Inode blocksize. */
+	u_int64_t	di_size;	/*  16: File byte count. */
+	u_int64_t	di_blocks;	/*  24: Bytes actually held. */
+	int64_t		di_atime;	/*  32: Last access time. */
+	int64_t		di_mtime;	/*  40: Last modified time. */
+	int64_t		di_ctime;	/*  48: Last inode change time. */
+	int64_t		di_birthtime;	/*  56: Inode creation time. */
+	int32_t		di_mtimensec;	/*  64: Last modified time. */
+	int32_t		di_atimensec;	/*  68: Last access time. */
+	int32_t		di_ctimensec;	/*  72: Last inode change time. */
+	int32_t		di_birthnsec;	/*  76: Inode creation time. */
+	int32_t		di_gen;		/*  80: Generation number. */
+	u_int32_t	di_kernflags;	/*  84: Kernel flags. */
+	u_int32_t	di_flags;	/*  88: Status flags (chflags). */
+	int32_t		di_extsize;	/*  92: External attributes block. */
+	int64_t		di_extb[UFS_NXADDR];/* 96: External attributes block. */
+	int64_t		di_db[UFS_NDADDR]; /* 112: Direct disk blocks. */
+	int64_t		di_ib[UFS_NIADDR]; /* 208: Indirect disk blocks. */
+	u_int64_t	di_modrev;	/* 232: i_modrev for NFSv4 */
+	int64_t		di_spare[2];	/* 240: Reserved; currently unused */
+};
+
+/*
+ * The di_db fields may be overlaid with other information for
+ * file types that do not have associated disk storage. Block
+ * and character devices overlay the first data block with their
+ * dev_t value. Short symbolic links place their path in the
+ * di_db area.
+ */
+#define	di_ogid		di_oldids[1]
+#define	di_ouid		di_oldids[0]
+#define	di_rdev		di_db[0]
+#define UFS1_MAXSYMLINKLEN	((UFS_NDADDR + UFS_NIADDR) * sizeof(int32_t))
+#define UFS2_MAXSYMLINKLEN	((UFS_NDADDR + UFS_NIADDR) * sizeof(int64_t))
+
+#define UFS_MAXSYMLINKLEN(ip) \
+	((ip)->i_ump->um_fstype == UFS1) ? \
+	UFS1_MAXSYMLINKLEN : UFS2_MAXSYMLINKLEN
+
+/* NeXT used to keep short symlinks in the inode even when using
+ * FS_42INODEFMT.  In that case fs->fs_maxsymlinklen is probably -1,
+ * but short symlinks were stored in inodes shorter than this:
+ */
+#define	APPLEUFS_MAXSYMLINKLEN 60
+
+/* File permissions. */
+#define	IEXEC		0000100		/* Executable. */
+#define	IWRITE		0000200		/* Writable. */
+#define	IREAD		0000400		/* Readable. */
+#define	ISVTX		0001000		/* Sticky bit. */
+#define	ISGID		0002000		/* Set-gid. */
+#define	ISUID		0004000		/* Set-uid. */
+
+/* File types. */
+#define	IFMT		0170000		/* Mask of file type. */
+#define	IFIFO		0010000		/* Named pipe (fifo). */
+#define	IFCHR		0020000		/* Character device. */
+#define	IFDIR		0040000		/* Directory file. */
+#define	IFBLK		0060000		/* Block device. */
+#define	IFREG		0100000		/* Regular file. */
+#define	IFLNK		0120000		/* Symbolic link. */
+#define	IFSOCK		0140000		/* UNIX domain socket. */
+#define	IFWHT		0160000		/* Whiteout. */
+
+/* Size of the on-disk inode. */
+#define	DINODE1_SIZE	(sizeof(struct ufs1_dinode))		/* 128 */
+#define	DINODE2_SIZE	(sizeof(struct ufs2_dinode))
+
+#endif /* !_UFS_UFS_DINODE_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/dinode.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/quota.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/quota.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/quota.h	(revision 13)
@@ -0,0 +1,105 @@
+/*	$NetBSD: quota.h,v 1.30 2012/08/26 02:32:14 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Elz at The University of Melbourne.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)quota.h	8.3 (Berkeley) 8/19/94
+ */
+
+#ifndef	_UFS_UFS_QUOTA_H_
+#define	_UFS_UFS_QUOTA_H_
+
+/*
+ * These definitions are common to the original disk quota implementation
+ * (quota1) and the newer implementation (quota2)
+ */
+
+/*
+ * The following constants define the usage of the quota file array in the
+ * ufsmount structure and dquot array in the inode structure.  The semantics
+ * of the elements of these arrays are defined in the routine getinoquota;
+ * the remainder of the quota code treats them generically and need not be
+ * inspected when changing the size of the array.
+ */
+#define	MAXQUOTAS	2
+#define	USRQUOTA	0	/* element used for user quotas */
+#define	GRPQUOTA	1	/* element used for group quotas */
+
+/*
+ * Initializer for the strings corresponding to the quota ID types.
+ * (in quota1 these are also the default names of the quota files)
+ */
+#define INITQFNAMES { \
+	"user",		/* USRQUOTA */ \
+	"group",	/* GRPQUOTA */ \
+}
+
+#if !defined(HAVE_NBTOOL_CONFIG_H)
+#include <sys/quota.h>
+__inline static int __unused
+quota_idtype_to_ufs(int idtype)
+{
+	switch (idtype) {
+	case QUOTA_IDTYPE_USER:
+		return USRQUOTA;
+	case QUOTA_IDTYPE_GROUP:
+		return GRPQUOTA;
+	default:
+		return -1;
+	}
+}
+
+static __inline int __unused
+quota_idtype_from_ufs(int ufstype)
+{
+	switch (ufstype) {
+	case USRQUOTA:
+		return QUOTA_IDTYPE_USER;
+	case GRPQUOTA:
+		return QUOTA_IDTYPE_GROUP;
+	default:
+		return -1;
+	}
+}
+#endif /* !defined(HAVE_NBTOOL_CONFIG_H) */
+
+#ifdef _KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+void	dqinit(void);
+void	dqreinit(void);
+void	dqdone(void);
+__END_DECLS
+#endif /* _KERNEL */
+
+#endif /* !_UFS_UFS_QUOTA_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/quota.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/ufs_extern.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/ufs_extern.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/ufs_extern.h	(revision 13)
@@ -0,0 +1,196 @@
+/*	$NetBSD: ufs_extern.h,v 1.79 2015/03/27 17:27:56 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ufs_extern.h	8.10 (Berkeley) 5/14/95
+ */
+
+#ifndef _UFS_UFS_EXTERN_H_
+#define _UFS_UFS_EXTERN_H_
+
+#include <sys/mutex.h>
+
+struct buf;
+struct componentname;
+struct direct;
+struct disklabel;
+struct dquot;
+struct fid;
+struct flock;
+struct indir;
+struct inode;
+struct mbuf;
+struct mount;
+struct nameidata;
+struct lwp;
+struct ufid;
+struct ufs_args;
+struct ufs_lookup_results;
+struct ufsmount;
+struct uio;
+struct vattr;
+struct vnode;
+
+extern pool_cache_t ufs_direct_cache;	/* memory pool for directs */
+
+__BEGIN_DECLS
+#define	ufs_abortop	genfs_abortop
+int	ufs_access(void *);
+int	ufs_advlock(void *);
+int	ufs_bmap(void *);
+int	ufs_close(void *);
+int	ufs_create(void *);
+int	ufs_getattr(void *);
+int	ufs_inactive(void *);
+#define	ufs_fcntl	genfs_fcntl
+#define	ufs_ioctl	genfs_enoioctl
+#define	ufs_islocked	genfs_islocked
+int	ufs_link(void *);
+#define	ufs_lock	genfs_lock
+int	ufs_lookup(void *);
+int	ufs_mkdir(void *);
+int	ufs_mknod(void *);
+#define	ufs_mmap	genfs_mmap
+#define	ufs_revoke	genfs_revoke
+int	ufs_open(void *);
+int	ufs_pathconf(void *);
+int	ufs_print(void *);
+int	ufs_readdir(void *);
+int	ufs_readlink(void *);
+int	ufs_remove(void *);
+int	ufs_rename(void *);
+int	ufs_rmdir(void *);
+#define	ufs_seek	genfs_seek
+#define	ufs_poll	genfs_poll
+int	ufs_setattr(void *);
+int	ufs_strategy(void *);
+int	ufs_symlink(void *);
+#define	ufs_unlock	genfs_unlock
+int	ufs_whiteout(void *);
+int	ufsspec_close(void *);
+int	ufsspec_read(void *);
+int	ufsspec_write(void *);
+
+int	ufsfifo_read(void *);
+int	ufsfifo_write(void *);
+int	ufsfifo_close(void *);
+
+/* ufs_bmap.c */
+typedef	bool (*ufs_issequential_callback_t)(const struct ufsmount *,
+						 daddr_t, daddr_t);
+int	ufs_bmaparray(struct vnode *, daddr_t, daddr_t *, struct indir *,
+		      int *, int *, ufs_issequential_callback_t);
+int	ufs_getlbns(struct vnode *, daddr_t, struct indir *, int *);
+
+/* ufs_inode.c */
+int	ufs_reclaim(struct vnode *);
+int	ufs_balloc_range(struct vnode *, off_t, off_t, kauth_cred_t, int);
+int	ufs_truncate(struct vnode *, uint64_t, kauth_cred_t);
+
+/* ufs_lookup.c */
+void	ufs_dirbad(struct inode *, doff_t, const char *);
+int	ufs_dirbadentry(struct vnode *, struct direct *, int);
+void	ufs_makedirentry(struct inode *, struct componentname *,
+			 struct direct *);
+int	ufs_direnter(struct vnode *, const struct ufs_lookup_results *,
+		     struct vnode *, struct direct *,
+		     struct componentname *, struct buf *);
+int	ufs_dirremove(struct vnode *, const struct ufs_lookup_results *,
+		      struct inode *, int, int);
+int	ufs_dirrewrite(struct inode *, off_t,
+		       struct inode *, ino_t, int, int, int);
+int	ufs_dirempty(struct inode *, ino_t, kauth_cred_t);
+int	ufs_blkatoff(struct vnode *, off_t, char **, struct buf **, bool);
+
+/* ufs_rename.c -- for lfs */
+bool	ufs_gro_directory_empty_p(struct mount *, kauth_cred_t,
+	    struct vnode *, struct vnode *);
+int	ufs_gro_rename_check_possible(struct mount *,
+	    struct vnode *, struct vnode *, struct vnode *, struct vnode *);
+int	ufs_gro_rename_check_permitted(struct mount *, kauth_cred_t,
+	    struct vnode *, struct vnode *, struct vnode *, struct vnode *);
+int	ufs_gro_remove_check_possible(struct mount *,
+	    struct vnode *, struct vnode *);
+int	ufs_gro_remove_check_permitted(struct mount *, kauth_cred_t,
+	    struct vnode *, struct vnode *);
+int	ufs_gro_rename(struct mount *, kauth_cred_t,
+	    struct vnode *, struct componentname *, void *, struct vnode *,
+	    struct vnode *, struct componentname *, void *, struct vnode *);
+int	ufs_gro_remove(struct mount *, kauth_cred_t,
+	    struct vnode *, struct componentname *, void *, struct vnode *);
+int	ufs_gro_lookup(struct mount *, struct vnode *,
+	    struct componentname *, void *, struct vnode **);
+int	ufs_gro_genealogy(struct mount *, kauth_cred_t,
+	    struct vnode *, struct vnode *, struct vnode **);
+int	ufs_gro_lock_directory(struct mount *, struct vnode *);
+
+
+/* ufs_quota.c */
+/*
+ * Flags to chkdq() and chkiq()
+ */
+#define	FORCE	0x01	/* force usage changes independent of limits */
+void	ufsquota_init(struct inode *);
+void	ufsquota_free(struct inode *);
+int	chkdq(struct inode *, int64_t, kauth_cred_t, int);
+int	chkiq(struct inode *, int32_t, kauth_cred_t, int);
+int	quota_handle_cmd(struct mount *, struct lwp *,
+			 struct quotactl_args *);
+
+int	qsync(struct mount *);
+
+/* ufs_quota1.c */
+int	quota1_umount(struct mount *, int);
+
+/* ufs_quota2.c */
+int	quota2_umount(struct mount *, int);
+
+/* ufs_vfsops.c */
+void	ufs_init(void);
+void	ufs_reinit(void);
+void	ufs_done(void);
+int	ufs_start(struct mount *, int);
+int	ufs_root(struct mount *, struct vnode **);
+int	ufs_vget(struct mount *, ino_t, struct vnode **);
+int	ufs_quotactl(struct mount *, struct quotactl_args *);
+int	ufs_fhtovp(struct mount *, struct ufid *, struct vnode **);
+
+/* ufs_vnops.c */
+void	ufs_vinit(struct mount *, int (**)(void *),
+		  int (**)(void *), struct vnode **);
+int	ufs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
+void	ufs_gop_markupdate(struct vnode *, int);
+int	ufs_bufio(enum uio_rw, struct vnode *, void *, size_t, off_t, int,
+	    kauth_cred_t, size_t *, struct lwp *);
+
+__END_DECLS
+
+extern kmutex_t ufs_hashlock;
+
+#endif /* !_UFS_UFS_EXTERN_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/ufs_extern.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/xattr.h
===================================================================
--- lab4/.minix-src/include/sys/xattr.h	(nonexistent)
+++ lab4/.minix-src/include/sys/xattr.h	(revision 13)
@@ -0,0 +1,81 @@
+/*	$NetBSD: xattr.h,v 1.5 2011/09/27 01:40:32 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2005 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Support for file system extended attributes.
+ *
+ * This provides an interface that is compatible with Linux's extended
+ * attribute support.  These calls operate on the same extended attributes
+ * as <sys/extattr.h>, but access only the "user" namespace.
+ */
+
+#ifndef _SYS_XATTR_H_
+#define	_SYS_XATTR_H_
+
+#include <sys/types.h>
+#include <sys/param.h>
+
+/*
+ * This is compatible with EXTATTR_MAXNAMELEN, and also happens to be
+ * the same as Linux (255).
+ */
+#define	XATTR_NAME_MAX		KERNEL_NAME_MAX
+
+#define	XATTR_SIZE_MAX		65536	/* NetBSD does not enforce this */
+
+#define	XATTR_CREATE		0x01	/* create, don't replace xattr */
+#define	XATTR_REPLACE		0x02	/* replace, don't create xattr */
+
+#ifndef _KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	setxattr(const char *, const char *, const void *, size_t, int);
+int	lsetxattr(const char *, const char *, const void *, size_t, int);
+int	fsetxattr(int, const char *, const void *, size_t, int);
+
+ssize_t	getxattr(const char *, const char *, void *, size_t);
+ssize_t	lgetxattr(const char *, const char *, void *, size_t);
+ssize_t	fgetxattr(int, const char *, void *, size_t);
+
+ssize_t	listxattr(const char *, char *, size_t);
+ssize_t	llistxattr(const char *, char *, size_t);
+ssize_t	flistxattr(int, char *, size_t);
+
+int	removexattr(const char *, const char *);
+int	lremovexattr(const char *, const char *);
+int	fremovexattr(int, const char *);
+__END_DECLS
+
+#endif /* ! _KERNEL */
+
+#endif /* _SYS_XATTR_H_ */

Property changes on: lab4/.minix-src/include/sys/xattr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ext2fs/ext2fs_extern.h
===================================================================
--- lab4/.minix-src/include/ufs/ext2fs/ext2fs_extern.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ext2fs/ext2fs_extern.h	(revision 13)
@@ -0,0 +1,183 @@
+/*	$NetBSD: ext2fs_extern.h,v 1.48 2015/03/27 17:27:56 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ffs_extern.h	8.3 (Berkeley) 4/16/94
+ * Modified for ext2fs by Manuel Bouyer.
+ */
+
+/*-
+ * Copyright (c) 1997 Manuel Bouyer.
+ *
+ * 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.
+ *
+ *	@(#)ffs_extern.h	8.3 (Berkeley) 4/16/94
+ * Modified for ext2fs by Manuel Bouyer.
+ */
+
+#ifndef _UFS_EXT2FS_EXT2FS_EXTERN_H_
+#define _UFS_EXT2FS_EXT2FS_EXTERN_H_
+
+struct buf;
+struct fid;
+struct m_ext2fs;
+struct inode;
+struct mount;
+struct nameidata;
+struct lwp;
+struct proc;
+struct statvfs;
+struct timeval;
+struct ufsmount;
+struct uio;
+struct vnode;
+struct mbuf;
+struct componentname;
+struct ufs_lookup_results;
+
+extern struct pool ext2fs_inode_pool;		/* memory pool for inodes */
+extern struct pool ext2fs_dinode_pool;		/* memory pool for dinodes */
+
+#define	EXT2FS_ITIMES(ip, acc, mod, cre) \
+	while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
+		ext2fs_itimes(ip, acc, mod, cre)
+
+__BEGIN_DECLS
+
+/* ext2fs_alloc.c */
+int ext2fs_alloc(struct inode *, daddr_t, daddr_t , kauth_cred_t,
+		   daddr_t *);
+int ext2fs_realloccg(struct inode *, daddr_t, daddr_t, int, int ,
+			  kauth_cred_t, struct buf **);
+int ext2fs_valloc(struct vnode *, int, kauth_cred_t, struct vnode **);
+/* XXX ondisk32 */
+daddr_t ext2fs_blkpref(struct inode *, daddr_t, int, int32_t *);
+void ext2fs_blkfree(struct inode *, daddr_t);
+int ext2fs_vfree(struct vnode *, ino_t, int);
+
+/* ext2fs_balloc.c */
+int ext2fs_balloc(struct inode *, daddr_t, int, kauth_cred_t,
+			struct buf **, int);
+int ext2fs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
+
+/* ext2fs_bmap.c */
+int ext2fs_bmap(void *);
+
+/* ext2fs_inode.c */
+uint64_t ext2fs_size(struct inode *);
+int ext2fs_setsize(struct inode *, uint64_t);
+uint64_t ext2fs_nblock(struct inode *);
+int ext2fs_setnblock(struct inode *, uint64_t);
+int ext2fs_update(struct vnode *, const struct timespec *,
+    const struct timespec *, int);
+int ext2fs_truncate(struct vnode *, off_t, int, kauth_cred_t);
+int ext2fs_inactive(void *);
+
+/* ext2fs_lookup.c */
+int ext2fs_readdir(void *);
+int ext2fs_lookup(void *);
+int ext2fs_direnter(struct inode *, struct vnode *,
+			 const struct ufs_lookup_results *,
+			 struct componentname *);
+int ext2fs_dirremove(struct vnode *, const struct ufs_lookup_results *,
+		     struct componentname *);
+int ext2fs_dirrewrite(struct inode *, const struct ufs_lookup_results *,
+			   struct inode *, struct componentname *);
+int ext2fs_dirempty(struct inode *, ino_t, kauth_cred_t);
+
+/* ext2fs_subr.c */
+int ext2fs_blkatoff(struct vnode *, off_t, char **, struct buf **);
+void ext2fs_fragacct(struct m_ext2fs *, int, int32_t[], int);
+void ext2fs_itimes(struct inode *, const struct timespec *,
+    const struct timespec *, const struct timespec *);
+
+/* ext2fs_vfsops.c */
+VFS_PROTOS(ext2fs);
+int ext2fs_reload(struct mount *, kauth_cred_t, struct lwp *);
+int ext2fs_mountfs(struct vnode *, struct mount *);
+int ext2fs_flushfiles(struct mount *, int);
+int ext2fs_sbupdate(struct ufsmount *, int);
+int ext2fs_cgupdate(struct ufsmount *, int);
+void ext2fs_set_inode_guid(struct inode *);
+
+/* ext2fs_readwrite.c */
+int ext2fs_read(void *);
+int ext2fs_write(void *);
+int ext2fs_bufrd(struct vnode *, struct uio *, int, kauth_cred_t);
+int ext2fs_bufwr(struct vnode *, struct uio *, int, kauth_cred_t);
+
+/* ext2fs_vnops.c */
+int ext2fs_create(void *);
+int ext2fs_mknod(void *);
+int ext2fs_open(void *);
+int ext2fs_access(void *);
+int ext2fs_getattr(void *);
+int ext2fs_setattr(void *);
+int ext2fs_remove(void *);
+int ext2fs_link(void *);
+int ext2fs_rename(void *);
+int ext2fs_mkdir(void *);
+int ext2fs_rmdir(void *);
+int ext2fs_symlink(void *);
+int ext2fs_readlink(void *);
+int ext2fs_advlock(void *);
+int ext2fs_fsync(void *);
+int ext2fs_vinit(struct mount *, int (**specops)(void *),
+		      int (**fifoops)(void *), struct vnode **);
+int ext2fs_makeinode(int, struct vnode *, struct vnode **,
+			  struct componentname *cnp);
+int ext2fs_reclaim(void *);
+
+__END_DECLS
+
+#define IS_EXT2_VNODE(vp)   (vp->v_tag == VT_EXT2FS)
+
+extern int (**ext2fs_vnodeop_p)(void *);
+extern int (**ext2fs_specop_p)(void *);
+extern int (**ext2fs_fifoop_p)(void *);
+
+#endif /* !_UFS_EXT2FS_EXT2FS_EXTERN_H_ */

Property changes on: lab4/.minix-src/include/ufs/ext2fs/ext2fs_extern.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/lfs/lfs_accessors.h
===================================================================
--- lab4/.minix-src/include/ufs/lfs/lfs_accessors.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/lfs/lfs_accessors.h	(revision 13)
@@ -0,0 +1,1524 @@
+/*	$NetBSD: lfs_accessors.h,v 1.36 2015/10/03 08:29:48 dholland Exp $	*/
+
+/*  from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp  */
+/*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
+/*  from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp  */
+
+/*-
+ * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Konrad E. Schroder <perseant@hhhh.org>.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)lfs.h	8.9 (Berkeley) 5/8/95
+ */
+/*
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by Marshall
+ * Kirk McKusick and Network Associates Laboratories, the Security
+ * Research Division of Network Associates, Inc. under DARPA/SPAWAR
+ * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
+ * research program
+ *
+ * Copyright (c) 1982, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dinode.h	8.9 (Berkeley) 3/29/95
+ */
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dir.h	8.5 (Berkeley) 4/27/95
+ */
+
+#ifndef _UFS_LFS_LFS_ACCESSORS_H_
+#define _UFS_LFS_LFS_ACCESSORS_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_lfs.h"
+#endif
+
+#include <sys/bswap.h>
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <assert.h>
+#define KASSERT assert
+#endif
+
+/*
+ * STRUCT_LFS is used by the libsa code to get accessors that work
+ * with struct salfs instead of struct lfs, and by the cleaner to
+ * get accessors that work with struct clfs.
+ */
+
+#ifndef STRUCT_LFS
+#define STRUCT_LFS struct lfs
+#endif
+
+/*
+ * byte order
+ */
+
+/*
+ * For now at least, the bootblocks shall not be endian-independent.
+ * We can see later if it fits in the size budget. Also disable the
+ * byteswapping if LFS_EI is off.
+ *
+ * Caution: these functions "know" that bswap16/32/64 are unsigned,
+ * and if that changes will likely break silently.
+ */
+
+#if defined(_STANDALONE) || (defined(_KERNEL) && !defined(LFS_EI))
+#define LFS_SWAP_int16_t(fs, val) (val)
+#define LFS_SWAP_int32_t(fs, val) (val)
+#define LFS_SWAP_int64_t(fs, val) (val)
+#define LFS_SWAP_uint16_t(fs, val) (val)
+#define LFS_SWAP_uint32_t(fs, val) (val)
+#define LFS_SWAP_uint64_t(fs, val) (val)
+#else
+#define LFS_SWAP_int16_t(fs, val) \
+	((fs)->lfs_dobyteswap ? (int16_t)bswap16(val) : (val))
+#define LFS_SWAP_int32_t(fs, val) \
+	((fs)->lfs_dobyteswap ? (int32_t)bswap32(val) : (val))
+#define LFS_SWAP_int64_t(fs, val) \
+	((fs)->lfs_dobyteswap ? (int64_t)bswap64(val) : (val))
+#define LFS_SWAP_uint16_t(fs, val) \
+	((fs)->lfs_dobyteswap ? bswap16(val) : (val))
+#define LFS_SWAP_uint32_t(fs, val) \
+	((fs)->lfs_dobyteswap ? bswap32(val) : (val))
+#define LFS_SWAP_uint64_t(fs, val) \
+	((fs)->lfs_dobyteswap ? bswap64(val) : (val))
+#endif
+
+/*
+ * For handling directories we will need to know if the volume is
+ * little-endian.
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define LFS_LITTLE_ENDIAN_ONDISK(fs) (!(fs)->lfs_dobyteswap)
+#else
+#define LFS_LITTLE_ENDIAN_ONDISK(fs) ((fs)->lfs_dobyteswap)
+#endif
+
+
+/*
+ * directories
+ */
+
+#define LFS_DIRHEADERSIZE(fs) \
+	((fs)->lfs_is64 ? sizeof(struct lfs_dirheader64) : sizeof(struct lfs_dirheader32))
+
+/*
+ * The LFS_DIRSIZ macro gives the minimum record length which will hold
+ * the directory entry.  This requires the amount of space in struct lfs_direct
+ * without the d_name field, plus enough space for the name with a terminating
+ * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
+ */
+#define	LFS_DIRECTSIZ(fs, namlen) \
+	(LFS_DIRHEADERSIZE(fs) + (((namlen)+1 + 3) &~ 3))
+
+/*
+ * The size of the largest possible directory entry. This is
+ * used by ulfs_dirhash to figure the size of an array, so we
+ * need a single constant value true for both lfs32 and lfs64.
+ */
+#define LFS_MAXDIRENTRYSIZE \
+	(sizeof(struct lfs_dirheader64) + (((LFS_MAXNAMLEN+1)+1 + 3) & ~3))
+
+#if (BYTE_ORDER == LITTLE_ENDIAN)
+#define LFS_OLDDIRSIZ(oldfmt, dp, needswap)	\
+    (((oldfmt) && !(needswap)) ?		\
+    LFS_DIRECTSIZ((dp)->d_type) : LFS_DIRECTSIZ((dp)->d_namlen))
+#else
+#define LFS_OLDDIRSIZ(oldfmt, dp, needswap)	\
+    (((oldfmt) && (needswap)) ?			\
+    LFS_DIRECTSIZ((dp)->d_type) : LFS_DIRECTSIZ((dp)->d_namlen))
+#endif
+
+#define LFS_DIRSIZ(fs, dp) LFS_DIRECTSIZ(fs, lfs_dir_getnamlen(fs, dp))
+
+/* Constants for the first argument of LFS_OLDDIRSIZ */
+#define LFS_OLDDIRFMT	1
+#define LFS_NEWDIRFMT	0
+
+#define LFS_NEXTDIR(fs, dp) \
+	((LFS_DIRHEADER *)((char *)(dp) + lfs_dir_getreclen(fs, dp)))
+
+static __unused inline char *
+lfs_dir_nameptr(const STRUCT_LFS *fs, LFS_DIRHEADER *dh)
+{
+	if (fs->lfs_is64) {
+		return (char *)(&dh->u_64 + 1);
+	} else {
+		return (char *)(&dh->u_32 + 1);
+	}
+}
+
+static __unused inline uint64_t
+lfs_dir_getino(const STRUCT_LFS *fs, const LFS_DIRHEADER *dh)
+{
+	if (fs->lfs_is64) {
+		uint64_t ino;
+
+		/*
+		 * XXX we can probably write this in a way that's both
+		 * still legal and generates better code.
+		 */
+		memcpy(&ino, &dh->u_64.dh_inoA, sizeof(dh->u_64.dh_inoA));
+		memcpy((char *)&ino + sizeof(dh->u_64.dh_inoA),
+		       &dh->u_64.dh_inoB,
+		       sizeof(dh->u_64.dh_inoB));
+		return LFS_SWAP_uint64_t(fs, ino);
+	} else {
+		return LFS_SWAP_uint32_t(fs, dh->u_32.dh_ino);
+	}
+}
+
+static __unused inline uint16_t
+lfs_dir_getreclen(const STRUCT_LFS *fs, const LFS_DIRHEADER *dh)
+{
+	if (fs->lfs_is64) {
+		return LFS_SWAP_uint16_t(fs, dh->u_64.dh_reclen);
+	} else {
+		return LFS_SWAP_uint16_t(fs, dh->u_32.dh_reclen);
+	}
+}
+
+static __unused inline uint8_t
+lfs_dir_gettype(const STRUCT_LFS *fs, const LFS_DIRHEADER *dh)
+{
+	if (fs->lfs_is64) {
+		KASSERT(fs->lfs_hasolddirfmt == 0);
+		return dh->u_64.dh_type;
+	} else if (fs->lfs_hasolddirfmt) {
+		return LFS_DT_UNKNOWN;
+	} else {
+		return dh->u_32.dh_type;
+	}
+}
+
+static __unused inline uint8_t
+lfs_dir_getnamlen(const STRUCT_LFS *fs, const LFS_DIRHEADER *dh)
+{
+	if (fs->lfs_is64) {
+		KASSERT(fs->lfs_hasolddirfmt == 0);
+		return dh->u_64.dh_type;
+	} else if (fs->lfs_hasolddirfmt && LFS_LITTLE_ENDIAN_ONDISK(fs)) {
+		/* low-order byte of old 16-bit namlen field */
+		return dh->u_32.dh_type;
+	} else {
+		return dh->u_32.dh_namlen;
+	}
+}
+
+static __unused inline void
+lfs_dir_setino(STRUCT_LFS *fs, LFS_DIRHEADER *dh, uint64_t ino)
+{
+	if (fs->lfs_is64) {
+
+		ino = LFS_SWAP_uint64_t(fs, ino);
+		/*
+		 * XXX we can probably write this in a way that's both
+		 * still legal and generates better code.
+		 */
+		memcpy(&dh->u_64.dh_inoA, &ino, sizeof(dh->u_64.dh_inoA));
+		memcpy(&dh->u_64.dh_inoB,
+		       (char *)&ino + sizeof(dh->u_64.dh_inoA),
+		       sizeof(dh->u_64.dh_inoB));
+	} else {
+		dh->u_32.dh_ino = LFS_SWAP_uint32_t(fs, ino);
+	}
+}
+
+static __unused inline void
+lfs_dir_setreclen(STRUCT_LFS *fs, LFS_DIRHEADER *dh, uint16_t reclen)
+{
+	if (fs->lfs_is64) {
+		dh->u_64.dh_reclen = LFS_SWAP_uint16_t(fs, reclen);
+	} else {
+		dh->u_32.dh_reclen = LFS_SWAP_uint16_t(fs, reclen);
+	}
+}
+
+static __unused inline void
+lfs_dir_settype(const STRUCT_LFS *fs, LFS_DIRHEADER *dh, uint8_t type)
+{
+	if (fs->lfs_is64) {
+		KASSERT(fs->lfs_hasolddirfmt == 0);
+		dh->u_64.dh_type = type;
+	} else if (fs->lfs_hasolddirfmt) {
+		/* do nothing */
+		return;
+	} else {
+		dh->u_32.dh_type = type;
+	}
+}
+
+static __unused inline void
+lfs_dir_setnamlen(const STRUCT_LFS *fs, LFS_DIRHEADER *dh, uint8_t namlen)
+{
+	if (fs->lfs_is64) {
+		KASSERT(fs->lfs_hasolddirfmt == 0);
+		dh->u_64.dh_namlen = namlen;
+	} else if (fs->lfs_hasolddirfmt && LFS_LITTLE_ENDIAN_ONDISK(fs)) {
+		/* low-order byte of old 16-bit namlen field */
+		dh->u_32.dh_type = namlen;
+	} else {
+		dh->u_32.dh_namlen = namlen;
+	}
+}
+
+static __unused inline void
+lfs_copydirname(STRUCT_LFS *fs, char *dest, const char *src,
+		unsigned namlen, unsigned reclen)
+{
+	unsigned spacelen;
+
+	KASSERT(reclen > LFS_DIRHEADERSIZE(fs));
+	spacelen = reclen - LFS_DIRHEADERSIZE(fs);
+
+	/* must always be at least 1 byte as a null terminator */
+	KASSERT(spacelen > namlen);
+
+	memcpy(dest, src, namlen);
+	memset(dest + namlen, '\0', spacelen - namlen);
+}
+
+static __unused LFS_DIRHEADER *
+lfs_dirtemplate_dotdot(STRUCT_LFS *fs, union lfs_dirtemplate *dt)
+{
+	/* XXX blah, be nice to have a way to do this w/o casts */
+	if (fs->lfs_is64) {
+		return (LFS_DIRHEADER *)&dt->u_64.dotdot_header;
+	} else {
+		return (LFS_DIRHEADER *)&dt->u_32.dotdot_header;
+	}
+}
+
+static __unused char *
+lfs_dirtemplate_dotdotname(STRUCT_LFS *fs, union lfs_dirtemplate *dt)
+{
+	if (fs->lfs_is64) {
+		return dt->u_64.dotdot_name;
+	} else {
+		return dt->u_32.dotdot_name;
+	}
+}
+
+/*
+ * dinodes
+ */
+
+/*
+ * Maximum length of a symlink that can be stored within the inode.
+ */
+#define LFS32_MAXSYMLINKLEN	((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int32_t))
+#define LFS64_MAXSYMLINKLEN	((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int64_t))
+
+#define LFS_MAXSYMLINKLEN(fs) \
+	((fs)->lfs_is64 ? LFS64_MAXSYMLINKLEN : LFS32_MAXSYMLINKLEN)
+
+#define DINOSIZE(fs) ((fs)->lfs_is64 ? sizeof(struct lfs64_dinode) : sizeof(struct lfs32_dinode))
+
+#define DINO_IN_BLOCK(fs, base, ix) \
+	((union lfs_dinode *)((char *)(base) + DINOSIZE(fs) * (ix)))
+
+static __unused inline void
+lfs_copy_dinode(STRUCT_LFS *fs,
+    union lfs_dinode *dst, const union lfs_dinode *src)
+{
+	/*
+	 * We can do structure assignment of the structs, but not of
+	 * the whole union, as the union is the size of the (larger)
+	 * 64-bit struct and on a 32-bit fs the upper half of it might
+	 * be off the end of a buffer or otherwise invalid.
+	 */
+	if (fs->lfs_is64) {
+		dst->u_64 = src->u_64;
+	} else {
+		dst->u_32 = src->u_32;
+	}
+}
+
+#define LFS_DEF_DINO_ACCESSOR(type, type32, field) \
+	static __unused inline type				\
+	lfs_dino_get##field(STRUCT_LFS *fs, union lfs_dinode *dip) \
+	{							\
+		if (fs->lfs_is64) {				\
+			return LFS_SWAP_##type(fs, dip->u_64.di_##field); \
+		} else {					\
+			return LFS_SWAP_##type32(fs, dip->u_32.di_##field); \
+		}						\
+	}							\
+	static __unused inline void				\
+	lfs_dino_set##field(STRUCT_LFS *fs, union lfs_dinode *dip, type val) \
+	{							\
+		if (fs->lfs_is64) {				\
+			type *p = &dip->u_64.di_##field;	\
+			(void)p;				\
+			dip->u_64.di_##field = LFS_SWAP_##type(fs, val); \
+		} else {					\
+			type32 *p = &dip->u_32.di_##field;	\
+			(void)p;				\
+			dip->u_32.di_##field = LFS_SWAP_##type32(fs, val); \
+		}						\
+	}							\
+
+LFS_DEF_DINO_ACCESSOR(uint16_t, uint16_t, mode);
+LFS_DEF_DINO_ACCESSOR(int16_t, int16_t, nlink);
+LFS_DEF_DINO_ACCESSOR(uint64_t, uint32_t, inumber);
+LFS_DEF_DINO_ACCESSOR(uint64_t, uint64_t, size);
+LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, atime);
+LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, atimensec);
+LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, mtime);
+LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, mtimensec);
+LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, ctime);
+LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, ctimensec);
+LFS_DEF_DINO_ACCESSOR(uint32_t, uint32_t, flags);
+LFS_DEF_DINO_ACCESSOR(uint64_t, uint32_t, blocks);
+LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, gen);
+LFS_DEF_DINO_ACCESSOR(uint32_t, uint32_t, uid);
+LFS_DEF_DINO_ACCESSOR(uint32_t, uint32_t, gid);
+
+/* XXX this should be done differently (it's a fake field) */
+LFS_DEF_DINO_ACCESSOR(uint64_t, int32_t, rdev);
+
+static __unused inline daddr_t
+lfs_dino_getdb(STRUCT_LFS *fs, union lfs_dinode *dip, unsigned ix)
+{
+	KASSERT(ix < ULFS_NDADDR);
+	if (fs->lfs_is64) {
+		return dip->u_64.di_db[ix];
+	} else {
+		/* note: this must sign-extend or UNWRITTEN gets trashed */
+		return dip->u_32.di_db[ix];
+	}
+}
+
+static __unused inline daddr_t
+lfs_dino_getib(STRUCT_LFS *fs, union lfs_dinode *dip, unsigned ix)
+{
+	KASSERT(ix < ULFS_NIADDR);
+	if (fs->lfs_is64) {
+		return dip->u_64.di_ib[ix];
+	} else {
+		/* note: this must sign-extend or UNWRITTEN gets trashed */
+		return dip->u_32.di_ib[ix];
+	}
+}
+
+static __unused inline void
+lfs_dino_setdb(STRUCT_LFS *fs, union lfs_dinode *dip, unsigned ix, daddr_t val)
+{
+	KASSERT(ix < ULFS_NDADDR);
+	if (fs->lfs_is64) {
+		dip->u_64.di_db[ix] = val;
+	} else {
+		dip->u_32.di_db[ix] = val;
+	}
+}
+
+static __unused inline void
+lfs_dino_setib(STRUCT_LFS *fs, union lfs_dinode *dip, unsigned ix, daddr_t val)
+{
+	KASSERT(ix < ULFS_NIADDR);
+	if (fs->lfs_is64) {
+		dip->u_64.di_ib[ix] = val;
+	} else {
+		dip->u_32.di_ib[ix] = val;
+	}
+}
+
+/* birthtime is present only in the 64-bit inode */
+static __unused inline void
+lfs_dino_setbirthtime(STRUCT_LFS *fs, union lfs_dinode *dip,
+    const struct timespec *ts)
+{
+	if (fs->lfs_is64) {
+		dip->u_64.di_birthtime = ts->tv_sec;
+		dip->u_64.di_birthnsec = ts->tv_nsec;
+	} else {
+		/* drop it on the floor */
+	}
+}
+
+/*
+ * indirect blocks
+ */
+
+static __unused inline daddr_t
+lfs_iblock_get(STRUCT_LFS *fs, void *block, unsigned ix)
+{
+	if (fs->lfs_is64) {
+		// XXX re-enable these asserts after reorging this file
+		//KASSERT(ix < lfs_sb_getbsize(fs) / sizeof(int64_t));
+		return (daddr_t)(((int64_t *)block)[ix]);
+	} else {
+		//KASSERT(ix < lfs_sb_getbsize(fs) / sizeof(int32_t));
+		/* must sign-extend or UNWRITTEN gets trashed */
+		return (daddr_t)(int64_t)(((int32_t *)block)[ix]);
+	}
+}
+
+static __unused inline void
+lfs_iblock_set(STRUCT_LFS *fs, void *block, unsigned ix, daddr_t val)
+{
+	if (fs->lfs_is64) {
+		//KASSERT(ix < lfs_sb_getbsize(fs) / sizeof(int64_t));
+		((int64_t *)block)[ix] = val;
+	} else {
+		//KASSERT(ix < lfs_sb_getbsize(fs) / sizeof(int32_t));
+		((int32_t *)block)[ix] = val;
+	}
+}
+
+/*
+ * "struct buf" associated definitions
+ */
+
+# define LFS_LOCK_BUF(bp) do {						\
+	if (((bp)->b_flags & B_LOCKED) == 0 && bp->b_iodone == NULL) {	\
+		mutex_enter(&lfs_lock);					\
+		++locked_queue_count;					\
+		locked_queue_bytes += bp->b_bufsize;			\
+		mutex_exit(&lfs_lock);					\
+	}								\
+	(bp)->b_flags |= B_LOCKED;					\
+} while (0)
+
+# define LFS_UNLOCK_BUF(bp) do {					\
+	if (((bp)->b_flags & B_LOCKED) != 0 && bp->b_iodone == NULL) {	\
+		mutex_enter(&lfs_lock);					\
+		--locked_queue_count;					\
+		locked_queue_bytes -= bp->b_bufsize;			\
+		if (locked_queue_count < LFS_WAIT_BUFS &&		\
+		    locked_queue_bytes < LFS_WAIT_BYTES)		\
+			cv_broadcast(&locked_queue_cv);			\
+		mutex_exit(&lfs_lock);					\
+	}								\
+	(bp)->b_flags &= ~B_LOCKED;					\
+} while (0)
+
+/*
+ * "struct inode" associated definitions
+ */
+
+#define LFS_SET_UINO(ip, flags) do {					\
+	if (((flags) & IN_ACCESSED) && !((ip)->i_flag & IN_ACCESSED))	\
+		lfs_sb_adduinodes((ip)->i_lfs, 1);			\
+	if (((flags) & IN_CLEANING) && !((ip)->i_flag & IN_CLEANING))	\
+		lfs_sb_adduinodes((ip)->i_lfs, 1);			\
+	if (((flags) & IN_MODIFIED) && !((ip)->i_flag & IN_MODIFIED))	\
+		lfs_sb_adduinodes((ip)->i_lfs, 1);			\
+	(ip)->i_flag |= (flags);					\
+} while (0)
+
+#define LFS_CLR_UINO(ip, flags) do {					\
+	if (((flags) & IN_ACCESSED) && ((ip)->i_flag & IN_ACCESSED))	\
+		lfs_sb_subuinodes((ip)->i_lfs, 1);			\
+	if (((flags) & IN_CLEANING) && ((ip)->i_flag & IN_CLEANING))	\
+		lfs_sb_subuinodes((ip)->i_lfs, 1);			\
+	if (((flags) & IN_MODIFIED) && ((ip)->i_flag & IN_MODIFIED))	\
+		lfs_sb_subuinodes((ip)->i_lfs, 1);			\
+	(ip)->i_flag &= ~(flags);					\
+	if (lfs_sb_getuinodes((ip)->i_lfs) < 0) {			\
+		panic("lfs_uinodes < 0");				\
+	}								\
+} while (0)
+
+#define LFS_ITIMES(ip, acc, mod, cre) \
+	while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
+		lfs_itimes(ip, acc, mod, cre)
+
+/*
+ * On-disk and in-memory checkpoint segment usage structure.
+ */
+
+#define	SEGUPB(fs)	(lfs_sb_getsepb(fs))
+#define	SEGTABSIZE_SU(fs)						\
+	((lfs_sb_getnseg(fs) + SEGUPB(fs) - 1) / lfs_sb_getsepb(fs))
+
+#ifdef _KERNEL
+# define SHARE_IFLOCK(F) 						\
+  do {									\
+	rw_enter(&(F)->lfs_iflock, RW_READER);				\
+  } while(0)
+# define UNSHARE_IFLOCK(F)						\
+  do {									\
+	rw_exit(&(F)->lfs_iflock);					\
+  } while(0)
+#else /* ! _KERNEL */
+# define SHARE_IFLOCK(F)
+# define UNSHARE_IFLOCK(F)
+#endif /* ! _KERNEL */
+
+/* Read in the block with a specific segment usage entry from the ifile. */
+#define	LFS_SEGENTRY(SP, F, IN, BP) do {				\
+	int _e;								\
+	SHARE_IFLOCK(F);						\
+	VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS;			\
+	if ((_e = bread((F)->lfs_ivnode,				\
+	    ((IN) / lfs_sb_getsepb(F)) + lfs_sb_getcleansz(F),		\
+	    lfs_sb_getbsize(F), 0, &(BP))) != 0)			\
+		panic("lfs: ifile read: %d", _e);			\
+	if (lfs_sb_getversion(F) == 1)					\
+		(SP) = (SEGUSE *)((SEGUSE_V1 *)(BP)->b_data +		\
+			((IN) & (lfs_sb_getsepb(F) - 1)));		\
+	else								\
+		(SP) = (SEGUSE *)(BP)->b_data + ((IN) % lfs_sb_getsepb(F)); \
+	UNSHARE_IFLOCK(F);						\
+} while (0)
+
+#define LFS_WRITESEGENTRY(SP, F, IN, BP) do {				\
+	if ((SP)->su_nbytes == 0)					\
+		(SP)->su_flags |= SEGUSE_EMPTY;				\
+	else								\
+		(SP)->su_flags &= ~SEGUSE_EMPTY;			\
+	(F)->lfs_suflags[(F)->lfs_activesb][(IN)] = (SP)->su_flags;	\
+	LFS_BWRITE_LOG(BP);						\
+} while (0)
+
+/*
+ * FINFO (file info) entries.
+ */
+
+/* Size of an on-disk block pointer, e.g. in an indirect block. */
+/* XXX: move to a more suitable location in this file */
+#define LFS_BLKPTRSIZE(fs) ((fs)->lfs_is64 ? sizeof(int64_t) : sizeof(int32_t))
+
+/* Size of an on-disk inode number. */
+/* XXX: move to a more suitable location in this file */
+#define LFS_INUMSIZE(fs) ((fs)->lfs_is64 ? sizeof(int64_t) : sizeof(int32_t))
+
+/* size of a FINFO, without the block pointers */
+#define	FINFOSIZE(fs)	((fs)->lfs_is64 ? sizeof(FINFO64) : sizeof(FINFO32))
+
+/* Full size of the provided FINFO record, including its block pointers. */
+#define FINFO_FULLSIZE(fs, fip) \
+	(FINFOSIZE(fs) + lfs_fi_getnblocks(fs, fip) * LFS_BLKPTRSIZE(fs))
+
+#define NEXT_FINFO(fs, fip) \
+	((FINFO *)((char *)(fip) + FINFO_FULLSIZE(fs, fip)))
+
+#define LFS_DEF_FI_ACCESSOR(type, type32, field) \
+	static __unused inline type				\
+	lfs_fi_get##field(STRUCT_LFS *fs, FINFO *fip)		\
+	{							\
+		if (fs->lfs_is64) {				\
+			return fip->u_64.fi_##field; 		\
+		} else {					\
+			return fip->u_32.fi_##field; 		\
+		}						\
+	}							\
+	static __unused inline void				\
+	lfs_fi_set##field(STRUCT_LFS *fs, FINFO *fip, type val) \
+	{							\
+		if (fs->lfs_is64) {				\
+			type *p = &fip->u_64.fi_##field;	\
+			(void)p;				\
+			fip->u_64.fi_##field = val;		\
+		} else {					\
+			type32 *p = &fip->u_32.fi_##field;	\
+			(void)p;				\
+			fip->u_32.fi_##field = val;		\
+		}						\
+	}							\
+
+LFS_DEF_FI_ACCESSOR(uint32_t, uint32_t, nblocks);
+LFS_DEF_FI_ACCESSOR(uint32_t, uint32_t, version);
+LFS_DEF_FI_ACCESSOR(uint64_t, uint32_t, ino);
+LFS_DEF_FI_ACCESSOR(uint32_t, uint32_t, lastlength);
+
+static __unused inline daddr_t
+lfs_fi_getblock(STRUCT_LFS *fs, FINFO *fip, unsigned index)
+{
+	void *firstblock;
+
+	firstblock = (char *)fip + FINFOSIZE(fs);
+	KASSERT(index < lfs_fi_getnblocks(fs, fip));
+	if (fs->lfs_is64) {
+		return ((int64_t *)firstblock)[index];
+	} else {
+		return ((int32_t *)firstblock)[index];
+	}
+}
+
+static __unused inline void
+lfs_fi_setblock(STRUCT_LFS *fs, FINFO *fip, unsigned index, daddr_t blk)
+{
+	void *firstblock;
+
+	firstblock = (char *)fip + FINFOSIZE(fs);
+	KASSERT(index < lfs_fi_getnblocks(fs, fip));
+	if (fs->lfs_is64) {
+		((int64_t *)firstblock)[index] = blk;
+	} else {
+		((int32_t *)firstblock)[index] = blk;
+	}
+}
+
+/*
+ * inode info entries (in the segment summary)
+ */
+
+#define IINFOSIZE(fs)	((fs)->lfs_is64 ? sizeof(IINFO64) : sizeof(IINFO32))
+
+/* iinfos scroll backward from the end of the segment summary block */
+#define SEGSUM_IINFOSTART(fs, buf) \
+	((IINFO *)((char *)buf + lfs_sb_getsumsize(fs) - IINFOSIZE(fs)))
+
+#define NEXTLOWER_IINFO(fs, iip) \
+	((IINFO *)((char *)(iip) - IINFOSIZE(fs)))
+
+#define NTH_IINFO(fs, buf, n) \
+	((IINFO *)((char *)SEGSUM_IINFOSTART(fs, buf) - (n)*IINFOSIZE(fs)))
+
+static __unused inline uint64_t
+lfs_ii_getblock(STRUCT_LFS *fs, IINFO *iip)
+{
+	if (fs->lfs_is64) {
+		return iip->u_64.ii_block;
+	} else {
+		return iip->u_32.ii_block;
+	}
+}
+
+static __unused inline void
+lfs_ii_setblock(STRUCT_LFS *fs, IINFO *iip, uint64_t block)
+{
+	if (fs->lfs_is64) {
+		iip->u_64.ii_block = block;
+	} else {
+		iip->u_32.ii_block = block;
+	}
+}
+
+/*
+ * Index file inode entries.
+ */
+
+#define IFILE_ENTRYSIZE(fs) \
+	((fs)->lfs_is64 ? sizeof(IFILE64) : sizeof(IFILE32))
+
+/*
+ * LFSv1 compatibility code is not allowed to touch if_atime, since it
+ * may not be mapped!
+ */
+/* Read in the block with a specific inode from the ifile. */
+#define	LFS_IENTRY(IP, F, IN, BP) do {					\
+	int _e;								\
+	SHARE_IFLOCK(F);						\
+	VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS;			\
+	if ((_e = bread((F)->lfs_ivnode,				\
+	(IN) / lfs_sb_getifpb(F) + lfs_sb_getcleansz(F) + lfs_sb_getsegtabsz(F), \
+	lfs_sb_getbsize(F), 0, &(BP))) != 0)				\
+		panic("lfs: ifile ino %d read %d", (int)(IN), _e);	\
+	if ((F)->lfs_is64) {						\
+		(IP) = (IFILE *)((IFILE64 *)(BP)->b_data +		\
+				 (IN) % lfs_sb_getifpb(F));		\
+	} else if (lfs_sb_getversion(F) > 1) {				\
+		(IP) = (IFILE *)((IFILE32 *)(BP)->b_data +		\
+				(IN) % lfs_sb_getifpb(F)); 		\
+	} else {							\
+		(IP) = (IFILE *)((IFILE_V1 *)(BP)->b_data +		\
+				 (IN) % lfs_sb_getifpb(F));		\
+	}								\
+	UNSHARE_IFLOCK(F);						\
+} while (0)
+#define LFS_IENTRY_NEXT(IP, F) do { \
+	if ((F)->lfs_is64) {						\
+		(IP) = (IFILE *)((IFILE64 *)(IP) + 1);			\
+	} else if (lfs_sb_getversion(F) > 1) {				\
+		(IP) = (IFILE *)((IFILE32 *)(IP) + 1);			\
+	} else {							\
+		(IP) = (IFILE *)((IFILE_V1 *)(IP) + 1);			\
+	}								\
+} while (0)
+
+#define LFS_DEF_IF_ACCESSOR(type, type32, field) \
+	static __unused inline type				\
+	lfs_if_get##field(STRUCT_LFS *fs, IFILE *ifp)		\
+	{							\
+		if (fs->lfs_is64) {				\
+			return ifp->u_64.if_##field; 		\
+		} else {					\
+			return ifp->u_32.if_##field; 		\
+		}						\
+	}							\
+	static __unused inline void				\
+	lfs_if_set##field(STRUCT_LFS *fs, IFILE *ifp, type val) \
+	{							\
+		if (fs->lfs_is64) {				\
+			type *p = &ifp->u_64.if_##field;	\
+			(void)p;				\
+			ifp->u_64.if_##field = val;		\
+		} else {					\
+			type32 *p = &ifp->u_32.if_##field;	\
+			(void)p;				\
+			ifp->u_32.if_##field = val;		\
+		}						\
+	}							\
+
+LFS_DEF_IF_ACCESSOR(u_int32_t, u_int32_t, version);
+LFS_DEF_IF_ACCESSOR(int64_t, int32_t, daddr);
+LFS_DEF_IF_ACCESSOR(u_int64_t, u_int32_t, nextfree);
+LFS_DEF_IF_ACCESSOR(u_int64_t, u_int32_t, atime_sec);
+LFS_DEF_IF_ACCESSOR(u_int32_t, u_int32_t, atime_nsec);
+
+/*
+ * Cleaner information structure.  This resides in the ifile and is used
+ * to pass information from the kernel to the cleaner.
+ */
+
+#define	CLEANSIZE_SU(fs)						\
+	((((fs)->lfs_is64 ? sizeof(CLEANERINFO64) : sizeof(CLEANERINFO32)) + \
+		lfs_sb_getbsize(fs) - 1) >> lfs_sb_getbshift(fs))
+
+#define LFS_DEF_CI_ACCESSOR(type, type32, field) \
+	static __unused inline type				\
+	lfs_ci_get##field(STRUCT_LFS *fs, CLEANERINFO *cip)	\
+	{							\
+		if (fs->lfs_is64) {				\
+			return cip->u_64.field; 		\
+		} else {					\
+			return cip->u_32.field; 		\
+		}						\
+	}							\
+	static __unused inline void				\
+	lfs_ci_set##field(STRUCT_LFS *fs, CLEANERINFO *cip, type val) \
+	{							\
+		if (fs->lfs_is64) {				\
+			type *p = &cip->u_64.field;		\
+			(void)p;				\
+			cip->u_64.field = val;			\
+		} else {					\
+			type32 *p = &cip->u_32.field;		\
+			(void)p;				\
+			cip->u_32.field = val;			\
+		}						\
+	}							\
+
+LFS_DEF_CI_ACCESSOR(u_int32_t, u_int32_t, clean);
+LFS_DEF_CI_ACCESSOR(u_int32_t, u_int32_t, dirty);
+LFS_DEF_CI_ACCESSOR(int64_t, int32_t, bfree);
+LFS_DEF_CI_ACCESSOR(int64_t, int32_t, avail);
+LFS_DEF_CI_ACCESSOR(u_int64_t, u_int32_t, free_head);
+LFS_DEF_CI_ACCESSOR(u_int64_t, u_int32_t, free_tail);
+LFS_DEF_CI_ACCESSOR(u_int32_t, u_int32_t, flags);
+
+static __unused inline void
+lfs_ci_shiftcleantodirty(STRUCT_LFS *fs, CLEANERINFO *cip, unsigned num)
+{
+	lfs_ci_setclean(fs, cip, lfs_ci_getclean(fs, cip) - num);
+	lfs_ci_setdirty(fs, cip, lfs_ci_getdirty(fs, cip) + num);
+}
+
+static __unused inline void
+lfs_ci_shiftdirtytoclean(STRUCT_LFS *fs, CLEANERINFO *cip, unsigned num)
+{
+	lfs_ci_setdirty(fs, cip, lfs_ci_getdirty(fs, cip) - num);
+	lfs_ci_setclean(fs, cip, lfs_ci_getclean(fs, cip) + num);
+}
+
+/* Read in the block with the cleaner info from the ifile. */
+#define LFS_CLEANERINFO(CP, F, BP) do {					\
+	SHARE_IFLOCK(F);						\
+	VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS;			\
+	if (bread((F)->lfs_ivnode,					\
+	    (daddr_t)0, lfs_sb_getbsize(F), 0, &(BP)))			\
+		panic("lfs: ifile read");				\
+	(CP) = (CLEANERINFO *)(BP)->b_data;				\
+	UNSHARE_IFLOCK(F);						\
+} while (0)
+
+/*
+ * Synchronize the Ifile cleaner info with current avail and bfree.
+ */
+#define LFS_SYNC_CLEANERINFO(cip, fs, bp, w) do {		 	\
+    mutex_enter(&lfs_lock);						\
+    if ((w) || lfs_ci_getbfree(fs, cip) != lfs_sb_getbfree(fs) ||	\
+	lfs_ci_getavail(fs, cip) != lfs_sb_getavail(fs) - fs->lfs_ravail - \
+	fs->lfs_favail) {	 					\
+	lfs_ci_setbfree(fs, cip, lfs_sb_getbfree(fs));		 	\
+	lfs_ci_setavail(fs, cip, lfs_sb_getavail(fs) - fs->lfs_ravail -	\
+		fs->lfs_favail);				 	\
+	if (((bp)->b_flags & B_GATHERED) == 0) {		 	\
+		fs->lfs_flags |= LFS_IFDIRTY;				\
+	}								\
+	mutex_exit(&lfs_lock);						\
+	(void) LFS_BWRITE_LOG(bp); /* Ifile */			 	\
+    } else {							 	\
+	mutex_exit(&lfs_lock);						\
+	brelse(bp, 0);						 	\
+    }									\
+} while (0)
+
+/*
+ * Get the head of the inode free list.
+ * Always called with the segment lock held.
+ */
+#define LFS_GET_HEADFREE(FS, CIP, BP, FREEP) do {			\
+	if (lfs_sb_getversion(FS) > 1) {				\
+		LFS_CLEANERINFO((CIP), (FS), (BP));			\
+		lfs_sb_setfreehd(FS, lfs_ci_getfree_head(FS, CIP));	\
+		brelse(BP, 0);						\
+	}								\
+	*(FREEP) = lfs_sb_getfreehd(FS);				\
+} while (0)
+
+#define LFS_PUT_HEADFREE(FS, CIP, BP, VAL) do {				\
+	lfs_sb_setfreehd(FS, VAL);					\
+	if (lfs_sb_getversion(FS) > 1) {				\
+		LFS_CLEANERINFO((CIP), (FS), (BP));			\
+		lfs_ci_setfree_head(FS, CIP, VAL);			\
+		LFS_BWRITE_LOG(BP);					\
+		mutex_enter(&lfs_lock);					\
+		(FS)->lfs_flags |= LFS_IFDIRTY;				\
+		mutex_exit(&lfs_lock);					\
+	}								\
+} while (0)
+
+#define LFS_GET_TAILFREE(FS, CIP, BP, FREEP) do {			\
+	LFS_CLEANERINFO((CIP), (FS), (BP));				\
+	*(FREEP) = lfs_ci_getfree_tail(FS, CIP);			\
+	brelse(BP, 0);							\
+} while (0)
+
+#define LFS_PUT_TAILFREE(FS, CIP, BP, VAL) do {				\
+	LFS_CLEANERINFO((CIP), (FS), (BP));				\
+	lfs_ci_setfree_tail(FS, CIP, VAL);				\
+	LFS_BWRITE_LOG(BP);						\
+	mutex_enter(&lfs_lock);						\
+	(FS)->lfs_flags |= LFS_IFDIRTY;					\
+	mutex_exit(&lfs_lock);						\
+} while (0)
+
+/*
+ * On-disk segment summary information
+ */
+
+#define SEGSUM_SIZE(fs) \
+	(fs->lfs_is64 ? sizeof(SEGSUM64) : \
+	 lfs_sb_getversion(fs) > 1 ? sizeof(SEGSUM32) : sizeof(SEGSUM_V1))
+
+/*
+ * The SEGSUM structure is followed by FINFO structures. Get the pointer
+ * to the first FINFO.
+ *
+ * XXX this can't be a macro yet; this file needs to be resorted.
+ */
+#if 0
+static __unused inline FINFO *
+segsum_finfobase(STRUCT_LFS *fs, SEGSUM *ssp)
+{
+	return (FINFO *)((char *)ssp + SEGSUM_SIZE(fs));
+}
+#else
+#define SEGSUM_FINFOBASE(fs, ssp) \
+	((FINFO *)((char *)(ssp) + SEGSUM_SIZE(fs)));
+#endif
+
+#define LFS_DEF_SS_ACCESSOR(type, type32, field) \
+	static __unused inline type				\
+	lfs_ss_get##field(STRUCT_LFS *fs, SEGSUM *ssp)		\
+	{							\
+		if (fs->lfs_is64) {				\
+			return ssp->u_64.ss_##field; 		\
+		} else {					\
+			return ssp->u_32.ss_##field; 		\
+		}						\
+	}							\
+	static __unused inline void				\
+	lfs_ss_set##field(STRUCT_LFS *fs, SEGSUM *ssp, type val) \
+	{							\
+		if (fs->lfs_is64) {				\
+			type *p = &ssp->u_64.ss_##field;	\
+			(void)p;				\
+			ssp->u_64.ss_##field = val;		\
+		} else {					\
+			type32 *p = &ssp->u_32.ss_##field;	\
+			(void)p;				\
+			ssp->u_32.ss_##field = val;		\
+		}						\
+	}							\
+
+LFS_DEF_SS_ACCESSOR(uint32_t, uint32_t, sumsum);
+LFS_DEF_SS_ACCESSOR(uint32_t, uint32_t, datasum);
+LFS_DEF_SS_ACCESSOR(uint32_t, uint32_t, magic);
+LFS_DEF_SS_ACCESSOR(uint32_t, uint32_t, ident);
+LFS_DEF_SS_ACCESSOR(int64_t, int32_t, next);
+LFS_DEF_SS_ACCESSOR(uint16_t, uint16_t, nfinfo);
+LFS_DEF_SS_ACCESSOR(uint16_t, uint16_t, ninos);
+LFS_DEF_SS_ACCESSOR(uint16_t, uint16_t, flags);
+LFS_DEF_SS_ACCESSOR(uint64_t, uint32_t, reclino);
+LFS_DEF_SS_ACCESSOR(uint64_t, uint64_t, serial);
+LFS_DEF_SS_ACCESSOR(uint64_t, uint64_t, create);
+
+static __unused inline size_t
+lfs_ss_getsumstart(STRUCT_LFS *fs)
+{
+	/* These are actually all the same. */
+	if (fs->lfs_is64) {
+		return offsetof(SEGSUM64, ss_datasum);
+	} else /* if (lfs_sb_getversion(fs) > 1) */ {
+		return offsetof(SEGSUM32, ss_datasum);
+	} /* else {
+		return offsetof(SEGSUM_V1, ss_datasum);
+	} */
+	/*
+	 * XXX ^^^ until this file is resorted lfs_sb_getversion isn't
+	 * defined yet.
+	 */
+}
+
+static __unused inline uint32_t
+lfs_ss_getocreate(STRUCT_LFS *fs, SEGSUM *ssp)
+{
+	KASSERT(fs->lfs_is64 == 0);
+	/* XXX need to resort this file before we can do this */
+	//KASSERT(lfs_sb_getversion(fs) == 1);
+	
+	return ssp->u_v1.ss_create;
+}
+
+static __unused inline void
+lfs_ss_setocreate(STRUCT_LFS *fs, SEGSUM *ssp, uint32_t val)
+{
+	KASSERT(fs->lfs_is64 == 0);
+	/* XXX need to resort this file before we can do this */
+	//KASSERT(lfs_sb_getversion(fs) == 1);
+	
+	ssp->u_v1.ss_create = val;
+}
+
+
+/*
+ * Super block.
+ */
+
+/*
+ * Generate accessors for the on-disk superblock fields with cpp.
+ */
+
+#define LFS_DEF_SB_ACCESSOR_FULL(type, type32, field) \
+	static __unused inline type				\
+	lfs_sb_get##field(STRUCT_LFS *fs)			\
+	{							\
+		if (fs->lfs_is64) {				\
+			return fs->lfs_dlfs_u.u_64.dlfs_##field; \
+		} else {					\
+			return fs->lfs_dlfs_u.u_32.dlfs_##field; \
+		}						\
+	}							\
+	static __unused inline void				\
+	lfs_sb_set##field(STRUCT_LFS *fs, type val)		\
+	{							\
+		if (fs->lfs_is64) {				\
+			fs->lfs_dlfs_u.u_64.dlfs_##field = val;	\
+		} else {					\
+			fs->lfs_dlfs_u.u_32.dlfs_##field = val;	\
+		}						\
+	}							\
+	static __unused inline void				\
+	lfs_sb_add##field(STRUCT_LFS *fs, type val)		\
+	{							\
+		if (fs->lfs_is64) {				\
+			type *p64 = &fs->lfs_dlfs_u.u_64.dlfs_##field; \
+			*p64 += val;				\
+		} else {					\
+			type32 *p32 = &fs->lfs_dlfs_u.u_32.dlfs_##field; \
+			*p32 += val;				\
+		}						\
+	}							\
+	static __unused inline void				\
+	lfs_sb_sub##field(STRUCT_LFS *fs, type val)		\
+	{							\
+		if (fs->lfs_is64) {				\
+			type *p64 = &fs->lfs_dlfs_u.u_64.dlfs_##field; \
+			*p64 -= val;				\
+		} else {					\
+			type32 *p32 = &fs->lfs_dlfs_u.u_32.dlfs_##field; \
+			*p32 -= val;				\
+		}						\
+	}
+
+#define LFS_DEF_SB_ACCESSOR(t, f) LFS_DEF_SB_ACCESSOR_FULL(t, t, f)
+
+#define LFS_DEF_SB_ACCESSOR_32ONLY(type, field, val64) \
+	static __unused inline type				\
+	lfs_sb_get##field(STRUCT_LFS *fs)			\
+	{							\
+		if (fs->lfs_is64) {				\
+			return val64;				\
+		} else {					\
+			return fs->lfs_dlfs_u.u_32.dlfs_##field; \
+		}						\
+	}
+
+#define lfs_magic lfs_dlfs.dlfs_magic
+LFS_DEF_SB_ACCESSOR(u_int32_t, version);
+LFS_DEF_SB_ACCESSOR_FULL(u_int64_t, u_int32_t, size);
+LFS_DEF_SB_ACCESSOR(u_int32_t, ssize);
+LFS_DEF_SB_ACCESSOR_FULL(u_int64_t, u_int32_t, dsize);
+LFS_DEF_SB_ACCESSOR(u_int32_t, bsize);
+LFS_DEF_SB_ACCESSOR(u_int32_t, fsize);
+LFS_DEF_SB_ACCESSOR(u_int32_t, frag);
+LFS_DEF_SB_ACCESSOR_FULL(uint64_t, uint32_t, freehd);
+LFS_DEF_SB_ACCESSOR_FULL(int64_t, int32_t, bfree);
+LFS_DEF_SB_ACCESSOR_FULL(uint64_t, uint32_t, nfiles);
+LFS_DEF_SB_ACCESSOR_FULL(int64_t, int32_t, avail);
+LFS_DEF_SB_ACCESSOR(int32_t, uinodes);
+LFS_DEF_SB_ACCESSOR_FULL(int64_t, int32_t, idaddr);
+LFS_DEF_SB_ACCESSOR_32ONLY(u_int32_t, ifile, LFS_IFILE_INUM);
+LFS_DEF_SB_ACCESSOR_FULL(int64_t, int32_t, lastseg);
+LFS_DEF_SB_ACCESSOR_FULL(int64_t, int32_t, nextseg);
+LFS_DEF_SB_ACCESSOR_FULL(int64_t, int32_t, curseg);
+LFS_DEF_SB_ACCESSOR_FULL(int64_t, int32_t, offset);
+LFS_DEF_SB_ACCESSOR_FULL(int64_t, int32_t, lastpseg);
+LFS_DEF_SB_ACCESSOR(u_int32_t, inopf);
+LFS_DEF_SB_ACCESSOR(u_int32_t, minfree);
+LFS_DEF_SB_ACCESSOR(uint64_t, maxfilesize);
+LFS_DEF_SB_ACCESSOR(u_int32_t, fsbpseg);
+LFS_DEF_SB_ACCESSOR(u_int32_t, inopb);
+LFS_DEF_SB_ACCESSOR(u_int32_t, ifpb);
+LFS_DEF_SB_ACCESSOR(u_int32_t, sepb);
+LFS_DEF_SB_ACCESSOR(u_int32_t, nindir);
+LFS_DEF_SB_ACCESSOR(u_int32_t, nseg);
+LFS_DEF_SB_ACCESSOR(u_int32_t, nspf);
+LFS_DEF_SB_ACCESSOR(u_int32_t, cleansz);
+LFS_DEF_SB_ACCESSOR(u_int32_t, segtabsz);
+LFS_DEF_SB_ACCESSOR_32ONLY(u_int32_t, segmask, 0);
+LFS_DEF_SB_ACCESSOR_32ONLY(u_int32_t, segshift, 0);
+LFS_DEF_SB_ACCESSOR(u_int64_t, bmask);
+LFS_DEF_SB_ACCESSOR(u_int32_t, bshift);
+LFS_DEF_SB_ACCESSOR(u_int64_t, ffmask);
+LFS_DEF_SB_ACCESSOR(u_int32_t, ffshift);
+LFS_DEF_SB_ACCESSOR(u_int64_t, fbmask);
+LFS_DEF_SB_ACCESSOR(u_int32_t, fbshift);
+LFS_DEF_SB_ACCESSOR(u_int32_t, blktodb);
+LFS_DEF_SB_ACCESSOR(u_int32_t, fsbtodb);
+LFS_DEF_SB_ACCESSOR(u_int32_t, sushift);
+LFS_DEF_SB_ACCESSOR(int32_t, maxsymlinklen);
+LFS_DEF_SB_ACCESSOR(u_int32_t, cksum);
+LFS_DEF_SB_ACCESSOR(u_int16_t, pflags);
+LFS_DEF_SB_ACCESSOR(u_int32_t, nclean);
+LFS_DEF_SB_ACCESSOR(int32_t, dmeta);
+LFS_DEF_SB_ACCESSOR(u_int32_t, minfreeseg);
+LFS_DEF_SB_ACCESSOR(u_int32_t, sumsize);
+LFS_DEF_SB_ACCESSOR(u_int64_t, serial);
+LFS_DEF_SB_ACCESSOR(u_int32_t, ibsize);
+LFS_DEF_SB_ACCESSOR_FULL(int64_t, int32_t, s0addr);
+LFS_DEF_SB_ACCESSOR(u_int64_t, tstamp);
+LFS_DEF_SB_ACCESSOR(u_int32_t, inodefmt);
+LFS_DEF_SB_ACCESSOR(u_int32_t, interleave);
+LFS_DEF_SB_ACCESSOR(u_int32_t, ident);
+LFS_DEF_SB_ACCESSOR(u_int32_t, resvseg);
+
+/* special-case accessors */
+
+/*
+ * the v1 otstamp field lives in what's now dlfs_inopf
+ */
+#define lfs_sb_getotstamp(fs) lfs_sb_getinopf(fs)
+#define lfs_sb_setotstamp(fs, val) lfs_sb_setinopf(fs, val)
+
+/*
+ * lfs_sboffs is an array
+ */
+static __unused inline int32_t
+lfs_sb_getsboff(STRUCT_LFS *fs, unsigned n)
+{
+#ifdef KASSERT /* ugh */
+	KASSERT(n < LFS_MAXNUMSB);
+#endif
+	if (fs->lfs_is64) {
+		return fs->lfs_dlfs_u.u_64.dlfs_sboffs[n];
+	} else {
+		return fs->lfs_dlfs_u.u_32.dlfs_sboffs[n];
+	}
+}
+static __unused inline void
+lfs_sb_setsboff(STRUCT_LFS *fs, unsigned n, int32_t val)
+{
+#ifdef KASSERT /* ugh */
+	KASSERT(n < LFS_MAXNUMSB);
+#endif
+	if (fs->lfs_is64) {
+		fs->lfs_dlfs_u.u_64.dlfs_sboffs[n] = val;
+	} else {
+		fs->lfs_dlfs_u.u_32.dlfs_sboffs[n] = val;
+	}
+}
+
+/*
+ * lfs_fsmnt is a string
+ */
+static __unused inline const char *
+lfs_sb_getfsmnt(STRUCT_LFS *fs)
+{
+	if (fs->lfs_is64) {
+		return fs->lfs_dlfs_u.u_64.dlfs_fsmnt;
+	} else {
+		return fs->lfs_dlfs_u.u_32.dlfs_fsmnt;
+	}
+}
+
+static __unused inline void
+lfs_sb_setfsmnt(STRUCT_LFS *fs, const char *str)
+{
+	if (fs->lfs_is64) {
+		(void)strncpy(fs->lfs_dlfs_u.u_64.dlfs_fsmnt, str,
+			sizeof(fs->lfs_dlfs_u.u_64.dlfs_fsmnt));
+	} else {
+		(void)strncpy(fs->lfs_dlfs_u.u_32.dlfs_fsmnt, str,
+			sizeof(fs->lfs_dlfs_u.u_32.dlfs_fsmnt));
+	}
+}
+
+/* Highest addressable fsb */
+#define LFS_MAX_DADDR(fs) \
+	((fs)->lfs_is64 ? 0x7fffffffffffffff : 0x7fffffff)
+
+/* LFS_NINDIR is the number of indirects in a file system block. */
+#define	LFS_NINDIR(fs)	(lfs_sb_getnindir(fs))
+
+/* LFS_INOPB is the number of inodes in a secondary storage block. */
+#define	LFS_INOPB(fs)	(lfs_sb_getinopb(fs))
+/* LFS_INOPF is the number of inodes in a fragment. */
+#define LFS_INOPF(fs)	(lfs_sb_getinopf(fs))
+
+#define	lfs_blkoff(fs, loc)	((int)((loc) & lfs_sb_getbmask(fs)))
+#define lfs_fragoff(fs, loc)    /* calculates (loc % fs->lfs_fsize) */ \
+    ((int)((loc) & lfs_sb_getffmask(fs)))
+
+/* XXX: lowercase these as they're no longer macros */
+/* Frags to diskblocks */
+static __unused inline uint64_t
+LFS_FSBTODB(STRUCT_LFS *fs, uint64_t b)
+{
+#if defined(_KERNEL)
+	return b << (lfs_sb_getffshift(fs) - DEV_BSHIFT);
+#else
+	return b << lfs_sb_getfsbtodb(fs);
+#endif
+}
+/* Diskblocks to frags */
+static __unused inline uint64_t
+LFS_DBTOFSB(STRUCT_LFS *fs, uint64_t b)
+{
+#if defined(_KERNEL)
+	return b >> (lfs_sb_getffshift(fs) - DEV_BSHIFT);
+#else
+	return b >> lfs_sb_getfsbtodb(fs);
+#endif
+}
+
+#define	lfs_lblkno(fs, loc)	((loc) >> lfs_sb_getbshift(fs))
+#define	lfs_lblktosize(fs, blk)	((blk) << lfs_sb_getbshift(fs))
+
+/* Frags to bytes */
+static __unused inline uint64_t
+lfs_fsbtob(STRUCT_LFS *fs, uint64_t b)
+{
+	return b << lfs_sb_getffshift(fs);
+}
+/* Bytes to frags */
+static __unused inline uint64_t
+lfs_btofsb(STRUCT_LFS *fs, uint64_t b)
+{
+	return b >> lfs_sb_getffshift(fs);
+}
+
+#define lfs_numfrags(fs, loc)	/* calculates (loc / fs->lfs_fsize) */	\
+	((loc) >> lfs_sb_getffshift(fs))
+#define lfs_blkroundup(fs, size)/* calculates roundup(size, lfs_sb_getbsize(fs)) */ \
+	((off_t)(((size) + lfs_sb_getbmask(fs)) & (~lfs_sb_getbmask(fs))))
+#define lfs_fragroundup(fs, size)/* calculates roundup(size, fs->lfs_fsize) */ \
+	((off_t)(((size) + lfs_sb_getffmask(fs)) & (~lfs_sb_getffmask(fs))))
+#define lfs_fragstoblks(fs, frags)/* calculates (frags / fs->fs_frag) */ \
+	((frags) >> lfs_sb_getfbshift(fs))
+#define lfs_blkstofrags(fs, blks)/* calculates (blks * fs->fs_frag) */ \
+	((blks) << lfs_sb_getfbshift(fs))
+#define lfs_fragnum(fs, fsb)	/* calculates (fsb % fs->lfs_frag) */	\
+	((fsb) & ((fs)->lfs_frag - 1))
+#define lfs_blknum(fs, fsb)	/* calculates rounddown(fsb, fs->lfs_frag) */ \
+	((fsb) &~ ((fs)->lfs_frag - 1))
+#define lfs_dblksize(fs, dp, lbn) \
+	(((lbn) >= ULFS_NDADDR || lfs_dino_getsize(fs, dp) >= ((lbn) + 1) << lfs_sb_getbshift(fs)) \
+	    ? lfs_sb_getbsize(fs) \
+	    : (lfs_fragroundup(fs, lfs_blkoff(fs, lfs_dino_getsize(fs, dp)))))
+
+#define	lfs_segsize(fs)	(lfs_sb_getversion(fs) == 1 ?	     		\
+			   lfs_lblktosize((fs), lfs_sb_getssize(fs)) :	\
+			   lfs_sb_getssize(fs))
+/* XXX segtod produces a result in frags despite the 'd' */
+#define lfs_segtod(fs, seg) (lfs_btofsb(fs, lfs_segsize(fs)) * (seg))
+#define	lfs_dtosn(fs, daddr)	/* block address to segment number */	\
+	((uint32_t)(((daddr) - lfs_sb_gets0addr(fs)) / lfs_segtod((fs), 1)))
+#define lfs_sntod(fs, sn)	/* segment number to disk address */	\
+	((daddr_t)(lfs_segtod((fs), (sn)) + lfs_sb_gets0addr(fs)))
+
+/* XXX, blah. make this appear only if struct inode is defined */
+#ifdef _UFS_LFS_LFS_INODE_H_
+static __unused inline uint32_t
+lfs_blksize(STRUCT_LFS *fs, struct inode *ip, uint64_t lbn)
+{
+	if (lbn >= ULFS_NDADDR || lfs_dino_getsize(fs, ip->i_din) >= (lbn + 1) << lfs_sb_getbshift(fs)) {
+		return lfs_sb_getbsize(fs);
+	} else {
+		return lfs_fragroundup(fs, lfs_blkoff(fs, lfs_dino_getsize(fs, ip->i_din)));
+	}
+}
+#endif
+
+/*
+ * union lfs_blocks
+ */
+
+static __unused inline void
+lfs_blocks_fromvoid(STRUCT_LFS *fs, union lfs_blocks *bp, void *p)
+{
+	if (fs->lfs_is64) {
+		bp->b64 = p;
+	} else {
+		bp->b32 = p;
+	}
+}
+
+static __unused inline void
+lfs_blocks_fromfinfo(STRUCT_LFS *fs, union lfs_blocks *bp, FINFO *fip)
+{
+	void *firstblock;
+
+	firstblock = (char *)fip + FINFOSIZE(fs);
+	if (fs->lfs_is64) {
+		bp->b64 = (int64_t *)firstblock;
+	}  else {
+		bp->b32 = (int32_t *)firstblock;
+	}
+}
+
+static __unused inline daddr_t
+lfs_blocks_get(STRUCT_LFS *fs, union lfs_blocks *bp, unsigned index)
+{
+	if (fs->lfs_is64) {
+		return bp->b64[index];
+	} else {
+		return bp->b32[index];
+	}
+}
+
+static __unused inline void
+lfs_blocks_set(STRUCT_LFS *fs, union lfs_blocks *bp, unsigned index, daddr_t val)
+{
+	if (fs->lfs_is64) {
+		bp->b64[index] = val;
+	} else {
+		bp->b32[index] = val;
+	}
+}
+
+static __unused inline void
+lfs_blocks_inc(STRUCT_LFS *fs, union lfs_blocks *bp)
+{
+	if (fs->lfs_is64) {
+		bp->b64++;
+	} else {
+		bp->b32++;
+	}
+}
+
+static __unused inline int
+lfs_blocks_eq(STRUCT_LFS *fs, union lfs_blocks *bp1, union lfs_blocks *bp2)
+{
+	if (fs->lfs_is64) {
+		return bp1->b64 == bp2->b64;
+	} else {
+		return bp1->b32 == bp2->b32;
+	}
+}
+
+static __unused inline int
+lfs_blocks_sub(STRUCT_LFS *fs, union lfs_blocks *bp1, union lfs_blocks *bp2)
+{
+	/* (remember that the pointers are typed) */
+	if (fs->lfs_is64) {
+		return bp1->b64 - bp2->b64;
+	} else {
+		return bp1->b32 - bp2->b32;
+	}
+}
+
+/*
+ * struct segment
+ */
+
+
+/*
+ * Macros for determining free space on the disk, with the variable metadata
+ * of segment summaries and inode blocks taken into account.
+ */
+/*
+ * Estimate number of clean blocks not available for writing because
+ * they will contain metadata or overhead.  This is calculated as
+ *
+ *		E = ((C * M / D) * D + (0) * (T - D)) / T
+ * or more simply
+ *		E = (C * M) / T
+ *
+ * where
+ * C is the clean space,
+ * D is the dirty space,
+ * M is the dirty metadata, and
+ * T = C + D is the total space on disk.
+ *
+ * This approximates the old formula of E = C * M / D when D is close to T,
+ * but avoids falsely reporting "disk full" when the sample size (D) is small.
+ */
+#define LFS_EST_CMETA(F) ((						\
+	(lfs_sb_getdmeta(F) * (int64_t)lfs_sb_getnclean(F)) / 		\
+	(lfs_sb_getnseg(F))))
+
+/* Estimate total size of the disk not including metadata */
+#define LFS_EST_NONMETA(F) (lfs_sb_getdsize(F) - lfs_sb_getdmeta(F) - LFS_EST_CMETA(F))
+
+/* Estimate number of blocks actually available for writing */
+#define LFS_EST_BFREE(F) (lfs_sb_getbfree(F) > LFS_EST_CMETA(F) ?	     \
+			  lfs_sb_getbfree(F) - LFS_EST_CMETA(F) : 0)
+
+/* Amount of non-meta space not available to mortal man */
+#define LFS_EST_RSVD(F) ((LFS_EST_NONMETA(F) *			     \
+				   (u_int64_t)lfs_sb_getminfree(F)) /	     \
+				  100)
+
+/* Can credential C write BB blocks? XXX: kauth_cred_geteuid is abusive */
+#define ISSPACE(F, BB, C)						\
+	((((C) == NOCRED || kauth_cred_geteuid(C) == 0) &&		\
+	  LFS_EST_BFREE(F) >= (BB)) ||					\
+	 (kauth_cred_geteuid(C) != 0 && IS_FREESPACE(F, BB)))
+
+/* Can an ordinary user write BB blocks */
+#define IS_FREESPACE(F, BB)						\
+	  (LFS_EST_BFREE(F) >= (BB) + LFS_EST_RSVD(F))
+
+/*
+ * The minimum number of blocks to create a new inode.  This is:
+ * directory direct block (1) + ULFS_NIADDR indirect blocks + inode block (1) +
+ * ifile direct block (1) + ULFS_NIADDR indirect blocks = 3 + 2 * ULFS_NIADDR blocks.
+ */
+#define LFS_NRESERVE(F) (lfs_btofsb((F), (2 * ULFS_NIADDR + 3) << lfs_sb_getbshift(F)))
+
+
+
+#endif /* _UFS_LFS_LFS_ACCESSORS_H_ */

Property changes on: lab4/.minix-src/include/ufs/lfs/lfs_accessors.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/mfs/mfsnode.h
===================================================================
--- lab4/.minix-src/include/ufs/mfs/mfsnode.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/mfs/mfsnode.h	(revision 13)
@@ -0,0 +1,91 @@
+/*	$NetBSD: mfsnode.h,v 1.21 2008/03/26 14:19:43 ad Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)mfsnode.h	8.3 (Berkeley) 5/19/95
+ */
+
+#ifndef _UFS_MFS_MFSNODE_H_
+#define _UFS_MFS_MFSNODE_H_
+
+/*
+ * This structure defines the control data for the memory based file system.
+ */
+
+struct mfsnode {
+	struct vnode *mfs_vnode;	/* vnode associated with this mfsnode */
+	void 	*mfs_baseoff;		/* base of file system in memory */
+	long	mfs_size;		/* size of memory file system */
+	struct proc *mfs_proc;		/* supporting process */
+	int	mfs_shutdown;		/* shutdown this mfsnode */
+#if defined(_KERNEL)
+	kcondvar_t mfs_cv;		/* notifier */
+	int	mfs_refcnt;		/* number of references */
+	struct	bufq_state *mfs_buflist;/* list of I/O requests */
+#endif /* defined(_KERNEL) */
+};
+
+#if defined(_KERNEL)
+/*
+ * Convert between mfsnode pointers and vnode pointers
+ */
+#define VTOMFS(vp)	((struct mfsnode *)(vp)->v_data)
+#define MFSTOV(mfsp)	((mfsp)->mfs_vnode)
+
+/* Prototypes for MFS operations on vnodes. */
+#define	mfs_lookup	genfs_badop
+#define	mfs_create	genfs_badop
+#define	mfs_mknod	genfs_badop
+#define	mfs_access	genfs_badop
+#define	mfs_getattr	genfs_badop
+#define	mfs_setattr	genfs_badop
+#define	mfs_read	genfs_badop
+#define	mfs_write	genfs_badop
+#define	mfs_poll	genfs_badop
+#define	mfs_mmap	genfs_badop
+#define	mfs_seek	genfs_badop
+#define	mfs_remove	genfs_badop
+#define	mfs_link	genfs_badop
+#define	mfs_rename	genfs_badop
+#define	mfs_mkdir	genfs_badop
+#define	mfs_rmdir	genfs_badop
+#define	mfs_symlink	genfs_badop
+#define	mfs_readdir	genfs_badop
+#define	mfs_readlink	genfs_badop
+#define	mfs_abortop	genfs_badop
+#define	mfs_islocked	genfs_noislocked
+#define	mfs_pathconf	genfs_badop
+#define	mfs_advlock	genfs_badop
+#define	mfs_bwrite	vn_bwrite
+#define	mfs_revoke	genfs_revoke
+#define	mfs_putpages	genfs_null_putpages
+
+#endif /* defined(_KERNEL) */
+
+#endif /* !_UFS_MFS_MFSNODE_H_ */

Property changes on: lab4/.minix-src/include/ufs/mfs/mfsnode.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/inode.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/inode.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/inode.h	(revision 13)
@@ -0,0 +1,303 @@
+/*	$NetBSD: inode.h,v 1.71 2014/05/26 19:16:39 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)inode.h	8.9 (Berkeley) 5/14/95
+ */
+
+#ifndef _UFS_UFS_INODE_H_
+#define	_UFS_UFS_INODE_H_
+
+#include <sys/vnode.h>
+#include <ufs/ufs/dinode.h>
+#include <ufs/ufs/dir.h>
+#include <ufs/ufs/quota.h>
+#include <ufs/ext2fs/ext2fs_dinode.h>
+#include <miscfs/genfs/genfs_node.h>
+
+/*
+ * Lookup result state (other than the result inode). This is
+ * currently stashed in the vnode between VOP_LOOKUP and directory
+ * operation VOPs, which is gross.
+ *
+ * XXX ulr_diroff is a lookup hint from the previos call of VOP_LOOKUP.
+ * probably it should not be here.
+ */
+struct ufs_lookup_results {
+	int32_t	  ulr_count;	/* Size of free slot in directory. */
+	doff_t	  ulr_endoff;	/* End of useful stuff in directory. */
+	doff_t	  ulr_diroff;	/* Offset in dir, where we found last entry. */
+	doff_t	  ulr_offset;	/* Offset of free space in directory. */
+	u_int32_t ulr_reclen;	/* Size of found directory entry. */
+};
+
+/* notyet XXX */
+#define UFS_CHECK_CRAPCOUNTER(dp) ((void)(dp)->i_crapcounter)
+
+/*
+ * Per-filesystem inode extensions.
+ */
+struct ffs_inode_ext {
+	daddr_t *ffs_snapblklist;	/* Collect expunged snapshot blocks. */
+	/* follow two fields are used by contiguous allocation code only. */
+	daddr_t ffs_first_data_blk;	/* first data block on disk. */
+	daddr_t ffs_first_indir_blk;	/* first indirect block on disk. */
+};
+
+struct ext2fs_inode_ext {
+	daddr_t ext2fs_last_lblk;	/* last logical block allocated */
+	daddr_t ext2fs_last_blk;	/* last block allocated on disk */
+};
+
+struct lfs_inode_ext;
+
+/*
+ * The inode is used to describe each active (or recently active) file in the
+ * UFS filesystem. It is composed of two types of information. The first part
+ * is the information that is needed only while the file is active (such as
+ * the identity of the file and linkage to speed its lookup). The second part
+ * is the permanent meta-data associated with the file which is read in
+ * from the permanent dinode from long term storage when the file becomes
+ * active, and is put back when the file is no longer being used.
+ */
+struct inode {
+	struct genfs_node i_gnode;
+	TAILQ_ENTRY(inode) i_nextsnap; /* snapshot file list. */
+	struct	vnode *i_vnode;	/* Vnode associated with this inode. */
+	struct  ufsmount *i_ump; /* Mount point associated with this inode. */
+	struct	vnode *i_devvp;	/* Vnode for block I/O. */
+	u_int32_t i_flag;	/* flags, see below */
+	dev_t	  i_dev;	/* Device associated with the inode. */
+	ino_t	  i_number;	/* The identity of the inode. */
+
+	union {			/* Associated filesystem. */
+		struct	fs *fs;		/* FFS */
+		struct	lfs *lfs;	/* LFS */
+		struct	m_ext2fs *e2fs;	/* EXT2FS */
+	} inode_u;
+#define	i_fs	inode_u.fs
+#define	i_lfs	inode_u.lfs
+#define	i_e2fs	inode_u.e2fs
+
+	void	*i_unused1;	/* Unused. */
+	struct	 dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
+	u_quad_t i_modrev;	/* Revision level for NFS lease. */
+	struct	 lockf *i_lockf;/* Head of byte-level lock list. */
+
+	/*
+	 * Side effects; used during (and after) directory lookup.
+	 * XXX should not be here.
+	 */
+	struct ufs_lookup_results i_crap;
+	unsigned i_crapcounter;	/* serial number for i_crap */
+
+	/*
+	 * Inode extensions
+	 */
+	union {
+		/* Other extensions could go here... */
+		struct	ffs_inode_ext ffs;
+		struct	ext2fs_inode_ext e2fs;
+		struct  lfs_inode_ext *lfs;
+	} inode_ext;
+#define	i_snapblklist		inode_ext.ffs.ffs_snapblklist
+#define	i_ffs_first_data_blk	inode_ext.ffs.ffs_first_data_blk
+#define	i_ffs_first_indir_blk	inode_ext.ffs.ffs_first_indir_blk
+#define	i_e2fs_last_lblk	inode_ext.e2fs.ext2fs_last_lblk
+#define	i_e2fs_last_blk		inode_ext.e2fs.ext2fs_last_blk
+	/*
+	 * Copies from the on-disk dinode itself.
+	 *
+	 * These fields are currently only used by FFS and LFS,
+	 * do NOT use them with ext2fs.
+	 */
+	u_int16_t i_mode;	/* IFMT, permissions; see below. */
+	int16_t   i_nlink;	/* File link count. */
+	u_int64_t i_size;	/* File byte count. */
+	u_int32_t i_flags;	/* Status flags (chflags). */
+	int32_t   i_gen;	/* Generation number. */
+	u_int32_t i_uid;	/* File owner. */
+	u_int32_t i_gid;	/* File group. */
+	u_int16_t i_omode;	/* Old mode, for ufs_reclaim. */
+
+	struct dirhash *i_dirhash;	/* Hashing for large directories */
+
+	/*
+	 * The on-disk dinode itself.
+	 */
+	union {
+		struct	ufs1_dinode *ffs1_din;	/* 128 bytes of the on-disk dinode. */
+		struct	ufs2_dinode *ffs2_din;
+		struct	ext2fs_dinode *e2fs_din; /* 128 bytes of the on-disk
+						   dinode. */
+	} i_din;
+};
+
+#define	i_ffs1_atime		i_din.ffs1_din->di_atime
+#define	i_ffs1_atimensec	i_din.ffs1_din->di_atimensec
+#define	i_ffs1_blocks		i_din.ffs1_din->di_blocks
+#define	i_ffs1_ctime		i_din.ffs1_din->di_ctime
+#define	i_ffs1_ctimensec	i_din.ffs1_din->di_ctimensec
+#define	i_ffs1_db		i_din.ffs1_din->di_db
+#define	i_ffs1_flags		i_din.ffs1_din->di_flags
+#define	i_ffs1_gen		i_din.ffs1_din->di_gen
+#define	i_ffs1_gid		i_din.ffs1_din->di_gid
+#define	i_ffs1_ib		i_din.ffs1_din->di_ib
+#define	i_ffs1_mode		i_din.ffs1_din->di_mode
+#define	i_ffs1_mtime		i_din.ffs1_din->di_mtime
+#define	i_ffs1_mtimensec	i_din.ffs1_din->di_mtimensec
+#define	i_ffs1_nlink		i_din.ffs1_din->di_nlink
+#define	i_ffs1_rdev		i_din.ffs1_din->di_rdev
+#define	i_ffs1_size		i_din.ffs1_din->di_size
+#define	i_ffs1_uid		i_din.ffs1_din->di_uid
+#define	i_ffs1_ouid		i_din.ffs1_din->di_oldids[0]
+#define	i_ffs1_ogid		i_din.ffs1_din->di_oldids[1]
+
+#define	i_ffs2_atime		i_din.ffs2_din->di_atime
+#define	i_ffs2_atimensec	i_din.ffs2_din->di_atimensec
+#define	i_ffs2_birthtime	i_din.ffs2_din->di_birthtime
+#define	i_ffs2_birthnsec	i_din.ffs2_din->di_birthnsec
+#define	i_ffs2_blocks		i_din.ffs2_din->di_blocks
+#define	i_ffs2_blksize		i_din.ffs2_din->di_blksize
+#define	i_ffs2_ctime		i_din.ffs2_din->di_ctime
+#define	i_ffs2_ctimensec	i_din.ffs2_din->di_ctimensec
+#define	i_ffs2_db		i_din.ffs2_din->di_db
+#define	i_ffs2_flags		i_din.ffs2_din->di_flags
+#define	i_ffs2_gen		i_din.ffs2_din->di_gen
+#define	i_ffs2_gid		i_din.ffs2_din->di_gid
+#define	i_ffs2_ib		i_din.ffs2_din->di_ib
+#define	i_ffs2_mode		i_din.ffs2_din->di_mode
+#define	i_ffs2_mtime		i_din.ffs2_din->di_mtime
+#define	i_ffs2_mtimensec	i_din.ffs2_din->di_mtimensec
+#define	i_ffs2_nlink		i_din.ffs2_din->di_nlink
+#define	i_ffs2_rdev		i_din.ffs2_din->di_rdev
+#define	i_ffs2_size		i_din.ffs2_din->di_size
+#define	i_ffs2_uid		i_din.ffs2_din->di_uid
+#define	i_ffs2_kernflags	i_din.ffs2_din->di_kernflags
+#define	i_ffs2_extsize		i_din.ffs2_din->di_extsize
+#define	i_ffs2_extb		i_din.ffs2_din->di_extb
+
+#define	i_e2fs_mode		i_din.e2fs_din->e2di_mode
+#define	i_e2fs_uid		i_din.e2fs_din->e2di_uid
+#define	i_e2fs_size		i_din.e2fs_din->e2di_size
+#define	i_e2fs_atime		i_din.e2fs_din->e2di_atime
+#define	i_e2fs_ctime		i_din.e2fs_din->e2di_ctime
+#define	i_e2fs_mtime		i_din.e2fs_din->e2di_mtime
+#define	i_e2fs_dtime		i_din.e2fs_din->e2di_dtime
+#define	i_e2fs_gid		i_din.e2fs_din->e2di_gid
+#define	i_e2fs_nlink		i_din.e2fs_din->e2di_nlink
+#define	i_e2fs_nblock		i_din.e2fs_din->e2di_nblock
+#define	i_e2fs_flags		i_din.e2fs_din->e2di_flags
+#define	i_e2fs_version		i_din.e2fs_din->e2di_version
+#define	i_e2fs_blocks		i_din.e2fs_din->e2di_blocks
+#define	i_e2fs_rdev		i_din.e2fs_din->e2di_rdev
+#define	i_e2fs_gen		i_din.e2fs_din->e2di_gen
+#define	i_e2fs_facl		i_din.e2fs_din->e2di_facl
+#define	i_e2fs_dacl		i_din.e2fs_din->e2di_dacl
+#define	i_e2fs_faddr		i_din.e2fs_din->e2di_faddr
+#define	i_e2fs_nblock_high	i_din.e2fs_din->e2di_nblock_high
+#define	i_e2fs_facl_high	i_din.e2fs_din->e2di_facl_high
+#define	i_e2fs_uid_high		i_din.e2fs_din->e2di_uid_high
+#define	i_e2fs_gid_high		i_din.e2fs_din->e2di_gid_high
+
+/* These flags are kept in i_flag. */
+#define	IN_ACCESS	0x0001		/* Access time update request. */
+#define	IN_CHANGE	0x0002		/* Inode change time update request. */
+#define	IN_UPDATE	0x0004		/* Inode was written to; update mtime. */
+#define	IN_MODIFY	0x2000		/* Modification time update request. */
+#define	IN_MODIFIED	0x0008		/* Inode has been modified. */
+#define	IN_ACCESSED	0x0010		/* Inode has been accessed. */
+/* 	   unused	0x0020 */	/* was IN_RENAME */
+#define	IN_SHLOCK	0x0040		/* File has shared lock. */
+#define	IN_EXLOCK	0x0080		/* File has exclusive lock. */
+/*	   unused	0x0100 */	/* was LFS-only IN_CLEANING */
+/*	   unused	0x0200 */	/* was LFS-only IN_ADIROP */
+#define	IN_SPACECOUNTED	0x0400		/* Blocks to be freed in free count. */
+/*	   unused       0x1000 */	/* was LFS-only IN_PAGING */
+/*	   unused	0x4000 */	/* was LFS-only IN_CDIROP */
+#if defined(_KERNEL)
+
+/*
+ * The DIP macro is used to access fields in the dinode that are
+ * not cached in the inode itself.
+ */
+#define	DIP(ip, field) \
+	(((ip)->i_ump->um_fstype == UFS1) ? \
+	(ip)->i_ffs1_##field : (ip)->i_ffs2_##field)
+
+#define	DIP_ASSIGN(ip, field, value)					\
+	do {								\
+		if ((ip)->i_ump->um_fstype == UFS1)			\
+			(ip)->i_ffs1_##field = (value);			\
+		else							\
+			(ip)->i_ffs2_##field = (value);			\
+	} while(0)
+
+#define	DIP_ADD(ip, field, value)					\
+	do {								\
+		if ((ip)->i_ump->um_fstype == UFS1)			\
+			(ip)->i_ffs1_##field += (value);		\
+		else							\
+			(ip)->i_ffs2_##field += (value);		\
+	} while(0)
+
+#define	 SHORTLINK(ip) \
+	(((ip)->i_ump->um_fstype == UFS1) ? \
+	(void *)(ip)->i_ffs1_db : (void *)(ip)->i_ffs2_db)
+
+
+/*
+ * Structure used to pass around logical block paths generated by
+ * ufs_getlbns and used by truncate and bmap code.
+ */
+struct indir {
+	daddr_t in_lbn;		/* Logical block number. */
+	int	in_off;			/* Offset in buffer. */
+	int	in_exists;		/* Flag if the block exists. */
+};
+
+/* Convert between inode pointers and vnode pointers. */
+#define	VTOI(vp)	((struct inode *)(vp)->v_data)
+#define	ITOV(ip)	((ip)->i_vnode)
+
+/* This overlays the fid structure (see fstypes.h). */
+struct ufid {
+	u_int16_t ufid_len;	/* Length of structure. */
+	u_int16_t ufid_pad;	/* Force 32-bit alignment. */
+	int32_t	  ufid_gen;	/* Generation number. */
+	ino_t     ufid_ino;	/* File number (ino). */
+};
+#endif /* _KERNEL */
+
+#endif /* !_UFS_UFS_INODE_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/inode.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/ufs_bswap.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/ufs_bswap.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/ufs_bswap.h	(revision 13)
@@ -0,0 +1,94 @@
+/*	$NetBSD: ufs_bswap.h,v 1.20 2013/10/19 20:12:18 mrg Exp $	*/
+
+/*
+ * Copyright (c) 1998 Manuel Bouyer.
+ *
+ * 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.
+ *
+ */
+
+#ifndef _UFS_UFS_BSWAP_H_
+#define _UFS_UFS_BSWAP_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_ffs.h"
+#endif
+
+#include <sys/bswap.h>
+
+/* Macros to access UFS flags */
+#ifdef FFS_EI
+#define	UFS_MPNEEDSWAP(ump)	((ump)->um_flags & UFS_NEEDSWAP)
+#define UFS_FSNEEDSWAP(fs)	((fs)->fs_flags & FS_SWAPPED)
+#define	UFS_IPNEEDSWAP(ip)	UFS_MPNEEDSWAP((ip)->i_ump)
+#else
+#define	UFS_MPNEEDSWAP(ump)	(0)
+#define UFS_FSNEEDSWAP(fs)	(0)
+#define	UFS_IPNEEDSWAP(ip)	(0)
+#endif
+
+#if !defined(_KERNEL) || defined(FFS_EI)
+/* inlines for access to swapped data */
+static inline u_int16_t
+ufs_rw16(uint16_t a, int ns)
+{
+	return ((ns) ? bswap16(a) : (a));
+}
+
+static inline u_int32_t
+ufs_rw32(uint32_t a, int ns)
+{
+	return ((ns) ? bswap32(a) : (a));
+}
+
+static inline u_int64_t
+ufs_rw64(uint64_t a, int ns)
+{
+	return ((ns) ? bswap64(a) : (a));
+}
+#else
+static inline u_int16_t
+ufs_rw16(uint16_t a, int ns)
+{
+	return a;
+}
+
+static inline u_int32_t
+ufs_rw32(uint32_t a, int ns)
+{
+	return a;
+}
+
+static inline u_int64_t
+ufs_rw64(uint64_t a, int ns)
+{
+	return a;
+}
+#endif
+
+#define ufs_add16(a, b, ns) \
+	(a) = ufs_rw16(ufs_rw16((a), (ns)) + (b), (ns))
+#define ufs_add32(a, b, ns) \
+	(a) = ufs_rw32(ufs_rw32((a), (ns)) + (b), (ns))
+#define ufs_add64(a, b, ns) \
+	(a) = ufs_rw64(ufs_rw64((a), (ns)) + (b), (ns))
+
+#endif /* !_UFS_UFS_BSWAP_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/ufs_bswap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/dir.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/dir.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/dir.h	(revision 13)
@@ -0,0 +1,204 @@
+/*	$NetBSD: dir.h,v 1.25 2015/09/01 06:16:03 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dir.h	8.5 (Berkeley) 4/27/95
+ */
+
+#ifndef _UFS_UFS_DIR_H_
+#define	_UFS_UFS_DIR_H_
+
+/*
+ * Theoretically, directories can be more than 2Gb in length; however, in
+ * practice this seems unlikely. So, we define the type doff_t as a 32-bit
+ * quantity to keep down the cost of doing lookup on a 32-bit machine.
+ */
+#define	doff_t		int32_t
+#define	UFS_MAXDIRSIZE	(0x7fffffff)
+
+/*
+ * A directory consists of some number of blocks of UFS_DIRBLKSIZ
+ * bytes, where UFS_DIRBLKSIZ is chosen such that it can be transferred
+ * to disk in a single atomic operation (e.g. 512 bytes on most machines).
+ *
+ * Each UFS_DIRBLKSIZ byte block contains some number of directory entry
+ * structures, which are of variable length.  Each directory entry has
+ * a struct direct at the front of it, containing its inode number,
+ * the length of the entry, and the length of the name contained in
+ * the entry.  These are followed by the name padded to a 4 byte boundary.
+ * All names are guaranteed null terminated.
+ * The maximum length of a name in a directory is FFS_MAXNAMLEN.
+ *
+ * The macro UFS_DIRSIZ(fmt, dp) gives the amount of space required to represent
+ * a directory entry.  Free space in a directory is represented by
+ * entries which have dp->d_reclen > DIRSIZ(fmt, dp).  All UFS_DIRBLKSIZ bytes
+ * in a directory block are claimed by the directory entries.  This
+ * usually results in the last entry in a directory having a large
+ * dp->d_reclen.  When entries are deleted from a directory, the
+ * space is returned to the previous entry in the same directory
+ * block by increasing its dp->d_reclen.  If the first entry of
+ * a directory block is free, then its dp->d_ino is set to 0.
+ * Entries other than the first in a directory do not normally have
+ * dp->d_ino set to 0.
+ */
+#undef	UFS_DIRBLKSIZ
+#define	UFS_DIRBLKSIZ	DEV_BSIZE
+#define	FFS_MAXNAMLEN	255
+#define APPLEUFS_DIRBLKSIZ 1024
+
+#define d_ino d_fileno
+struct	direct {
+	u_int32_t d_fileno;		/* inode number of entry */
+	u_int16_t d_reclen;		/* length of this record */
+	u_int8_t  d_type; 		/* file type, see below */
+	u_int8_t  d_namlen;		/* length of string in d_name */
+	char	  d_name[FFS_MAXNAMLEN + 1];/* name with length <= FFS_MAXNAMLEN */
+};
+
+/*
+ * File types
+ */
+#define	DT_UNKNOWN	 0
+#define	DT_FIFO		 1
+#define	DT_CHR		 2
+#define	DT_DIR		 4
+#define	DT_BLK		 6
+#define	DT_REG		 8
+#define	DT_LNK		10
+#define	DT_SOCK		12
+#define	DT_WHT		14
+
+/*
+ * Convert between stat structure types and directory types.
+ */
+#define	IFTODT(mode)	(((mode) & 0170000) >> 12)
+#define	DTTOIF(dirtype)	((dirtype) << 12)
+
+/*
+ * The UFS_DIRSIZ macro gives the minimum record length which will hold
+ * the directory entry.  This requires the amount of space in struct direct
+ * without the d_name field, plus enough space for the name with a terminating
+ * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
+ */
+#define	UFS_DIRECTSIZ(namlen) \
+	((sizeof(struct direct) - (FFS_MAXNAMLEN+1)) + (((namlen)+1 + 3) &~ 3))
+
+#if (BYTE_ORDER == LITTLE_ENDIAN)
+#define UFS_DIRSIZ(oldfmt, dp, needswap)	\
+    (((oldfmt) && !(needswap)) ?		\
+    UFS_DIRECTSIZ((dp)->d_type) : UFS_DIRECTSIZ((dp)->d_namlen))
+#else
+#define UFS_DIRSIZ(oldfmt, dp, needswap)	\
+    (((oldfmt) && (needswap)) ?			\
+    UFS_DIRECTSIZ((dp)->d_type) : UFS_DIRECTSIZ((dp)->d_namlen))
+#endif
+
+/*
+ * UFS_OLDDIRFMT and UFS_NEWDIRFMT are code numbers for a directory
+ * format change that happened in ffs a long time ago. (Back in the
+ * 80s, if I'm not mistaken.)
+ *
+ * These code numbers do not appear on disk. They're generated from
+ * runtime logic that is cued by other things, which is why
+ * UFS_OLDDIRFMT is confusingly 1 and UFS_NEWDIRFMT is confusingly 0.
+ *
+ * Relatedly, the FFS_EI byte swapping logic for directories is a
+ * horrible mess. For example, to access the namlen field, one
+ * currently does the following:
+ *
+ * #if (BYTE_ORDER == LITTLE_ENDIAN)
+ *         swap = (UFS_IPNEEDSWAP(VTOI(vp)) == 0);
+ * #else
+ *         swap = (UFS_IPNEEDSWAP(VTOI(vp)) != 0);
+ * #endif
+ *         return ((FSFMT(vp) && swap) ? dp->d_type : dp->d_namlen);
+ *
+ * UFS_IPNEEDSWAP() returns true if the volume is opposite-endian. This
+ * horrible "swap" logic is cutpasted all over everywhere but amounts
+ * to the following:
+ *
+ *    running code      volume          lfs_dobyteswap  "swap"
+ *    ----------------------------------------------------------
+ *    LITTLE_ENDIAN     LITTLE_ENDIAN   false           true
+ *    LITTLE_ENDIAN     BIG_ENDIAN      true            false
+ *    BIG_ENDIAN        LITTLE_ENDIAN   true            true
+ *    BIG_ENDIAN        BIG_ENDIAN      false           false
+ *
+ * which you'll note boils down to "volume is little-endian".
+ *
+ * Meanwhile, FSFMT(vp) yields UFS_OLDDIRFMT or UFS_NEWDIRFMT via
+ * perverted logic of its own. Since UFS_OLDDIRFMT is 1 (contrary to
+ * what one might expect approaching this cold) what this mess means
+ * is: on OLDDIRFMT volumes that are little-endian, we read the
+ * namlen value out of the type field. This is because on OLDDIRFMT
+ * volumes there is no d_type field, just a 16-bit d_namlen; so if
+ * the 16-bit d_namlen is little-endian, the useful part of it is
+ * in the first byte, which in the NEWDIRFMT structure is the d_type
+ * field.
+ */
+
+#define UFS_OLDDIRFMT	1
+#define UFS_NEWDIRFMT	0
+
+/*
+ * Template for manipulating directories.  Should use struct direct's,
+ * but the name field is FFS_MAXNAMLEN - 1, and this just won't do.
+ */
+struct dirtemplate {
+	u_int32_t	dot_ino;
+	int16_t		dot_reclen;
+	u_int8_t	dot_type;
+	u_int8_t	dot_namlen;
+	char		dot_name[4];	/* must be multiple of 4 */
+	u_int32_t	dotdot_ino;
+	int16_t		dotdot_reclen;
+	u_int8_t	dotdot_type;
+	u_int8_t	dotdot_namlen;
+	char		dotdot_name[4];	/* ditto */
+};
+
+/*
+ * This is the old format of directories, sans type element.
+ */
+struct odirtemplate {
+	u_int32_t	dot_ino;
+	int16_t		dot_reclen;
+	u_int16_t	dot_namlen;
+	char		dot_name[4];	/* must be multiple of 4 */
+	u_int32_t	dotdot_ino;
+	int16_t		dotdot_reclen;
+	u_int16_t	dotdot_namlen;
+	char		dotdot_name[4];	/* ditto */
+};
+#endif /* !_UFS_UFS_DIR_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/dir.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/quota1.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/quota1.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/quota1.h	(revision 13)
@@ -0,0 +1,104 @@
+/*	$NetBSD: quota1.h,v 1.7 2012/08/26 02:32:14 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Elz at The University of Melbourne.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)quota.h	8.3 (Berkeley) 8/19/94
+ */
+
+#ifndef	_UFS_UFS_QUOTA1_H_
+#define	_UFS_UFS_QUOTA1_H_
+
+#include <sys/quota.h>
+#include <ufs/ufs/quota.h>
+
+/*
+ * These definitions are for the original disk quota implementation, which
+ * is deprecated. the newer implementation is defined in quota2.h
+ * and friends
+ */
+
+/*
+ * Definitions for disk quotas imposed on the average user
+ * (big brother finally hits UNIX).
+ *
+ * The following constants define the amount of time given a user before the
+ * soft limits are treated as hard limits (usually resulting in an allocation
+ * failure). The timer is started when the user crosses their soft limit, it
+ * is reset when they go below their soft limit.
+ */
+#define	MAX_IQ_TIME	(7*24*60*60)	/* seconds in 1 week */
+#define	MAX_DQ_TIME	(7*24*60*60)	/* seconds in 1 week */
+
+#define	QUOTAFILENAME	"quota"
+#define	QUOTAGROUP	"operator"
+
+/*
+ * Command definitions for the 'compat_50_quotactl' system call.  The commands
+ * are broken into a main command defined below and a subcommand that is used
+ * to convey the type of quota that is being manipulated (see above).
+ */
+#define SUBCMDMASK	0x00ff
+#define SUBCMDSHIFT	8
+#define	QCMD(cmd, type)	(((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
+
+#define	Q_QUOTAON	0x0100	/* enable quotas */
+#define	Q_QUOTAOFF	0x0200	/* disable quotas */
+#define	Q_GETQUOTA	0x0300	/* get limits and usage */
+#define	Q_SETQUOTA	0x0400	/* set limits and usage */
+#define	Q_SETUSE	0x0500	/* set usage */
+#define	Q_SYNC		0x0600	/* sync disk copy of a filesystems quotas */
+
+/*
+ * The following structure defines the format of the disk quota file
+ * (as it appears on disk) - the file is an array of these structures
+ * indexed by user or group number.  The setquota system call establishes
+ * the vnode for each quota file (a pointer is retained in the ufsmount
+ * structure).
+ */
+struct dqblk {
+	u_int32_t dqb_bhardlimit;	/* absolute limit on disk blks alloc */
+	u_int32_t dqb_bsoftlimit;	/* preferred limit on disk blks */
+	u_int32_t dqb_curblocks;	/* current block count */
+	u_int32_t dqb_ihardlimit;	/* maximum # allocated inodes + 1 */
+	u_int32_t dqb_isoftlimit;	/* preferred inode limit */
+	u_int32_t dqb_curinodes;	/* current # allocated inodes */
+	int32_t	  dqb_btime;		/* time limit for excessive disk use */
+	int32_t	  dqb_itime;		/* time limit for excessive files */
+};
+
+/* quota1_subr.c */
+void dqblk_to_quotavals(const struct dqblk *,
+			struct quotaval *, struct quotaval *);
+void quotavals_to_dqblk(const struct quotaval *, const struct quotaval *,
+			struct dqblk *);
+
+#endif /* !_UFS_UFS_QUOTA1_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/quota1.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_amap.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_amap.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_amap.h	(revision 13)
@@ -0,0 +1,279 @@
+/*	$NetBSD: uvm_amap.h,v 1.37 2011/06/12 03:36:02 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ */
+
+#ifndef _UVM_UVM_AMAP_H_
+#define _UVM_UVM_AMAP_H_
+
+/*
+ * uvm_amap.h: general amap interface and amap implementation-specific info
+ */
+
+/*
+ * an amap structure contains pointers to a set of anons that are
+ * mapped together in virtual memory (an anon is a single page of
+ * anonymous virtual memory -- see uvm_anon.h).  in uvm we hide the
+ * details of the implementation of amaps behind a general amap
+ * interface.  this allows us to change the amap implementation
+ * without having to touch the rest of the code.  this file is divided
+ * into two parts: the definition of the uvm amap interface and the
+ * amap implementation-specific definitions.
+ */
+
+#ifdef _KERNEL
+
+/*
+ * part 1: amap interface
+ */
+
+void	uvm_amap_init(void);
+
+/*
+ * forward definition of vm_amap structure.  only amap
+ * implementation-specific code should directly access the fields of
+ * this structure.
+ */
+
+struct vm_amap;
+
+
+/*
+ * prototypes for the amap interface
+ */
+
+void		amap_add 	/* add an anon to an amap */
+			(struct vm_aref *, vaddr_t,
+			 struct vm_anon *, bool);
+struct vm_amap	*amap_alloc	/* allocate a new amap */
+			(vaddr_t, vaddr_t, int);
+void		amap_copy	/* clear amap needs-copy flag */
+			(struct vm_map *, struct vm_map_entry *, int,
+			 vaddr_t, vaddr_t);
+void		amap_cow_now	/* resolve all COW faults now */
+			(struct vm_map *, struct vm_map_entry *);
+int		amap_extend	/* make amap larger */
+			(struct vm_map_entry *, vsize_t, int);
+int		amap_flags	/* get amap's flags */
+			(struct vm_amap *);
+void		amap_free	/* free amap */
+			(struct vm_amap *);
+void		amap_lock	/* lock amap */
+			(struct vm_amap *);
+struct vm_anon	*amap_lookup	/* lookup an anon @ offset in amap */
+			(struct vm_aref *, vaddr_t);
+void		amap_lookups	/* lookup multiple anons */
+			(struct vm_aref *, vaddr_t,
+			 struct vm_anon **, int);
+void		amap_ref	/* add a reference to an amap */
+			(struct vm_amap *, vaddr_t, vsize_t, int);
+int		amap_refs	/* get number of references of amap */
+			(struct vm_amap *);
+void		amap_share_protect /* protect pages in a shared amap */
+			(struct vm_map_entry *, vm_prot_t);
+void		amap_splitref	/* split reference to amap into two */
+			(struct vm_aref *, struct vm_aref *, vaddr_t);
+void		amap_unadd	/* remove an anon from an amap */
+			(struct vm_aref *, vaddr_t);
+void		amap_unlock	/* unlock amap */
+			(struct vm_amap *);
+void		amap_unref	/* drop reference to an amap */
+			(struct vm_amap *, vaddr_t, vsize_t, bool);
+void		amap_wipeout	/* remove all anons from amap */
+			(struct vm_amap *);
+bool		amap_swap_off
+			(int, int);
+
+/*
+ * amap flag values
+ */
+
+#define AMAP_SHARED	0x1	/* amap is shared */
+#define AMAP_REFALL	0x2	/* amap_ref: reference entire amap */
+#define AMAP_SWAPOFF	0x4	/* amap_swap_off() is in progress */
+
+/*
+ * amap_copy flags
+ */
+
+#define	AMAP_COPY_NOWAIT	0x02	/* not allowed to sleep */
+#define	AMAP_COPY_NOCHUNK	0x04	/* not allowed to chunk */
+#define	AMAP_COPY_NOMERGE	0x08	/* not allowed to merge */
+
+/*
+ * amap_extend flags
+ */
+#define AMAP_EXTEND_BACKWARDS	0x00	/* add "size" to start of map */
+#define AMAP_EXTEND_FORWARDS	0x01	/* add "size" to end of map */
+#define AMAP_EXTEND_NOWAIT	0x02	/* not allowed to sleep */
+
+#endif /* _KERNEL */
+
+/**********************************************************************/
+
+/*
+ * part 2: amap implementation-specific info
+ */
+
+/*
+ * we currently provide an array-based amap implementation.  in this
+ * implementation we provide the option of tracking split references
+ * so that we don't lose track of references during partial unmaps
+ * ... this is enabled with the "UVM_AMAP_PPREF" define.
+ */
+
+#define UVM_AMAP_PPREF		/* track partial references */
+
+/*
+ * here is the definition of the vm_amap structure for this implementation.
+ */
+
+struct vm_amap {
+	kmutex_t *am_lock;	/* lock [locks all vm_amap fields] */
+	int am_ref;		/* reference count */
+	int am_flags;		/* flags */
+	int am_maxslot;		/* max # of slots allocated */
+	int am_nslot;		/* # of slots currently in map ( <= maxslot) */
+	int am_nused;		/* # of slots currently in use */
+	int *am_slots;		/* contig array of active slots */
+	int *am_bckptr;		/* back pointer array to am_slots */
+	struct vm_anon **am_anon; /* array of anonymous pages */
+#ifdef UVM_AMAP_PPREF
+	int *am_ppref;		/* per page reference count (if !NULL) */
+#endif
+	LIST_ENTRY(vm_amap) am_list;
+};
+
+/*
+ * note that am_slots, am_bckptr, and am_anon are arrays.   this allows
+ * fast lookup of pages based on their virual address at the expense of
+ * some extra memory.   in the future we should be smarter about memory
+ * usage and fall back to a non-array based implementation on systems
+ * that are short of memory (XXXCDC).
+ *
+ * the entries in the array are called slots... for example an amap that
+ * covers four pages of virtual memory is said to have four slots.   here
+ * is an example of the array usage for a four slot amap.   note that only
+ * slots one and three have anons assigned to them.  "D/C" means that we
+ * "don't care" about the value.
+ *
+ *            0     1      2     3
+ * am_anon:   NULL, anon0, NULL, anon1		(actual pointers to anons)
+ * am_bckptr: D/C,  1,     D/C,  0		(points to am_slots entry)
+ *
+ * am_slots:  3, 1, D/C, D/C    		(says slots 3 and 1 are in use)
+ *
+ * note that am_bckptr is D/C if the slot in am_anon is set to NULL.
+ * to find the entry in am_slots for an anon, look at am_bckptr[slot],
+ * thus the entry for slot 3 in am_slots[] is at am_slots[am_bckptr[3]].
+ * in general, if am_anon[X] is non-NULL, then the following must be
+ * true: am_slots[am_bckptr[X]] == X
+ *
+ * note that am_slots is always contig-packed.
+ */
+
+/*
+ * defines for handling of large, sparse amaps:
+ *
+ * one of the problems of array-based amaps is that if you allocate a
+ * large, sparsely-used area of virtual memory you end up allocating
+ * large arrays that, for the most part, don't get used.  this is a
+ * problem for BSD in that the kernel likes to make these types of
+ * allocations to "reserve" memory for possible future use.
+ *
+ * for example, the kernel allocates (reserves) a large chunk of user
+ * VM for possible stack growth.  most of the time only a page or two
+ * of this VM is actually used.  since the stack is anonymous memory
+ * it makes sense for it to live in an amap, but if we allocated an
+ * amap for the entire stack range we could end up wasting a large
+ * amount of allocated KVM.
+ *
+ * for example, on the i386 at boot time we allocate two amaps for the stack
+ * of /sbin/init:
+ *  1. a 7680 slot amap at protection 0 (reserve space for stack)
+ *  2. a 512 slot amap at protection 7 (top of stack)
+ *
+ * most of the array allocated for the amaps for this is never used.
+ * the amap interface provides a way for us to avoid this problem by
+ * allowing amap_copy() to break larger amaps up into smaller sized
+ * chunks (controlled by the "canchunk" option).   we use this feature
+ * to reduce our memory usage with the BSD stack management.  if we
+ * are asked to create an amap with more than UVM_AMAP_LARGE slots in it,
+ * we attempt to break it up into a UVM_AMAP_CHUNK sized amap if the
+ * "canchunk" flag is set.
+ *
+ * so, in the i386 example, the 7680 slot area is never referenced so
+ * nothing gets allocated (amap_copy is never called because the protection
+ * is zero).   the 512 slot area for the top of the stack is referenced.
+ * the chunking code breaks it up into 16 slot chunks (hopefully a single
+ * 16 slot chunk is enough to handle the whole stack).
+ */
+
+#define UVM_AMAP_LARGE	256	/* # of slots in "large" amap */
+#define UVM_AMAP_CHUNK	16	/* # of slots to chunk large amaps in */
+
+#ifdef _KERNEL
+
+/*
+ * macros
+ */
+
+/* AMAP_B2SLOT: convert byte offset to slot */
+#define AMAP_B2SLOT(S,B) {						\
+	KASSERT(((B) & (PAGE_SIZE - 1)) == 0);				\
+	(S) = (B) >> PAGE_SHIFT;					\
+}
+
+/*
+ * lock/unlock/refs/flags macros
+ */
+
+#define amap_flags(AMAP)	((AMAP)->am_flags)
+#define amap_lock(AMAP)		mutex_enter((AMAP)->am_lock)
+#define amap_lock_try(AMAP)	mutex_tryenter((AMAP)->am_lock)
+#define amap_refs(AMAP)		((AMAP)->am_ref)
+#define amap_unlock(AMAP)	mutex_exit((AMAP)->am_lock)
+
+/*
+ * if we enable PPREF, then we have a couple of extra functions that
+ * we need to prototype here...
+ */
+
+#ifdef UVM_AMAP_PPREF
+
+#define PPREF_NONE ((int *) -1)	/* not using ppref */
+
+void		amap_pp_adjref		/* adjust references */
+			(struct vm_amap *, int, vsize_t, int,
+			struct vm_anon **);
+void		amap_pp_establish	/* establish ppref */
+			(struct vm_amap *, vaddr_t);
+void		amap_wiperange		/* wipe part of an amap */
+			(struct vm_amap *, int, int, struct vm_anon **);
+#endif	/* UVM_AMAP_PPREF */
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_AMAP_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_amap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_extern.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_extern.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_extern.h	(revision 13)
@@ -0,0 +1,752 @@
+/*	$NetBSD: uvm_extern.h,v 1.194 2015/03/20 15:41:43 riastradh Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ *
+ * from: Id: uvm_extern.h,v 1.1.2.21 1998/02/07 01:16:53 chs Exp
+ */
+
+/*-
+ * Copyright (c) 1991, 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vm_extern.h	8.5 (Berkeley) 5/3/95
+ */
+
+#ifndef _UVM_UVM_EXTERN_H_
+#define _UVM_UVM_EXTERN_H_
+
+/*
+ * uvm_extern.h: this file defines the external interface to the VM system.
+ *
+ * this should be the only file included by non-VM parts of the kernel
+ * which need access to VM services.   if you want to know the interface
+ * to the MI VM layer without knowing the details, this is the file to
+ * learn.
+ *
+ * NOTE: vm system calls are prototyped in syscallargs.h
+ */
+
+/*
+ * defines
+ */
+
+/*
+ * the following defines are for uvm_map and functions which call it.
+ */
+
+/* protections bits */
+#define UVM_PROT_MASK	0x07	/* protection mask */
+#define UVM_PROT_NONE	0x00	/* protection none */
+#define UVM_PROT_ALL	0x07	/* everything */
+#define UVM_PROT_READ	0x01	/* read */
+#define UVM_PROT_WRITE  0x02	/* write */
+#define UVM_PROT_EXEC	0x04	/* exec */
+
+/* protection short codes */
+#define UVM_PROT_R	0x01	/* read */
+#define UVM_PROT_W	0x02	/* write */
+#define UVM_PROT_RW	0x03    /* read-write */
+#define UVM_PROT_X	0x04	/* exec */
+#define UVM_PROT_RX	0x05	/* read-exec */
+#define UVM_PROT_WX	0x06	/* write-exec */
+#define UVM_PROT_RWX	0x07	/* read-write-exec */
+
+/* 0x08: not used */
+
+/* inherit codes */
+#define UVM_INH_MASK	0x30	/* inherit mask */
+#define UVM_INH_SHARE	0x00	/* "share" */
+#define UVM_INH_COPY	0x10	/* "copy" */
+#define UVM_INH_NONE	0x20	/* "none" */
+#define UVM_INH_DONATE	0x30	/* "donate" << not used */
+
+/* 0x40, 0x80: not used */
+
+/* bits 0x700: max protection, 0x800: not used */
+
+/* bits 0x7000: advice, 0x8000: not used */
+/* advice: matches MADV_* from sys/mman.h and POSIX_FADV_* from sys/fcntl.h */
+#define UVM_ADV_NORMAL	0x0	/* 'normal' */
+#define UVM_ADV_RANDOM	0x1	/* 'random' */
+#define UVM_ADV_SEQUENTIAL 0x2	/* 'sequential' */
+#define UVM_ADV_WILLNEED 0x3	/* pages will be needed */
+#define UVM_ADV_DONTNEED 0x4	/* pages won't be needed */
+#define UVM_ADV_NOREUSE	0x5	/* pages will be used only once */
+#define UVM_ADV_MASK	0x7	/* mask */
+
+/* bits 0xffff0000: mapping flags */
+#define UVM_FLAG_FIXED   0x010000 /* find space */
+#define UVM_FLAG_OVERLAY 0x020000 /* establish overlay */
+#define UVM_FLAG_NOMERGE 0x040000 /* don't merge map entries */
+#define UVM_FLAG_COPYONW 0x080000 /* set copy_on_write flag */
+#define UVM_FLAG_AMAPPAD 0x100000 /* for bss: pad amap to reduce allocations */
+#define UVM_FLAG_TRYLOCK 0x200000 /* fail if we can not lock map */
+#define UVM_FLAG_NOWAIT  0x400000 /* not allowed to sleep */
+#define UVM_FLAG_WAITVA  0x800000 /* wait for va */
+#define UVM_FLAG_VAONLY  0x2000000 /* unmap: no pages are mapped */
+#define UVM_FLAG_COLORMATCH 0x4000000 /* match color given in off */
+
+/* macros to extract info */
+#define UVM_PROTECTION(X)	((X) & UVM_PROT_MASK)
+#define UVM_INHERIT(X)		(((X) & UVM_INH_MASK) >> 4)
+#define UVM_MAXPROTECTION(X)	(((X) >> 8) & UVM_PROT_MASK)
+#define UVM_ADVICE(X)		(((X) >> 12) & UVM_ADV_MASK)
+
+#define UVM_MAPFLAG(PROT,MAXPROT,INH,ADVICE,FLAGS) \
+	(((MAXPROT) << 8)|(PROT)|(INH)|((ADVICE) << 12)|(FLAGS))
+
+/* magic offset value: offset not known(obj) or don't care(!obj) */
+#define UVM_UNKNOWN_OFFSET ((voff_t) -1)
+
+/*
+ * the following defines are for uvm_km_alloc/free's flags
+ */
+#define UVM_KMF_WIRED	0x1			/* allocation type: wired */
+#define UVM_KMF_PAGEABLE 0x2			/* allocation type: pageable */
+#define UVM_KMF_VAONLY	0x4			/* allocation type: VA only */
+#define	UVM_KMF_TYPEMASK (UVM_KMF_VAONLY | UVM_KMF_PAGEABLE | UVM_KMF_WIRED)
+#define UVM_KMF_CANFAIL	0x8			/* caller handles failure */
+#define UVM_KMF_ZERO	0x10			/* want zero filled memory */
+#define UVM_KMF_EXEC	0x20			/* need executable mapping */
+#define UVM_KMF_TRYLOCK	UVM_FLAG_TRYLOCK	/* try locking only */
+#define UVM_KMF_NOWAIT	UVM_FLAG_NOWAIT		/* not allowed to sleep */
+#define UVM_KMF_WAITVA	UVM_FLAG_WAITVA		/* sleep for va */
+#define UVM_KMF_COLORMATCH UVM_FLAG_COLORMATCH	/* start at color in align */
+
+/*
+ * the following defines the strategies for uvm_pagealloc_strat()
+ */
+#define	UVM_PGA_STRAT_NORMAL	0	/* priority (low id to high) walk */
+#define	UVM_PGA_STRAT_ONLY	1	/* only specified free list */
+#define	UVM_PGA_STRAT_FALLBACK	2	/* ONLY falls back on NORMAL */
+
+/*
+ * flags for uvm_pagealloc_strat()
+ */
+#define UVM_PGA_USERESERVE	0x0001	/* ok to use reserve pages */
+#define	UVM_PGA_ZERO		0x0002	/* returned page must be zero'd */
+
+/*
+ * flags for ubc_alloc()
+ */
+#define UBC_READ	0x001	/* reading from object */
+#define UBC_WRITE	0x002	/* writing to object */
+#define UBC_FAULTBUSY	0x004	/* nobody else is using these pages, so busy
+				 * them at alloc and unbusy at release (e.g.,
+				 * for writes extending a file) */
+
+/*
+ * flags for ubc_release()
+ */
+#define UBC_UNMAP	0x010	/* unmap pages now -- don't leave the
+				 * mappings cached indefinitely */
+
+/*
+ * flags for ubc_uiomove()
+ */
+#define	UBC_PARTIALOK	0x100	/* return early on error; otherwise, zero all
+				 * remaining bytes after error */
+
+/*
+ * flags for uvn_findpages().
+ */
+#define UFP_ALL		0x00
+#define UFP_NOWAIT	0x01
+#define UFP_NOALLOC	0x02
+#define UFP_NOCACHE	0x04
+#define UFP_NORDONLY	0x08
+#define UFP_DIRTYONLY	0x10
+#define UFP_BACKWARD	0x20
+
+/*
+ * lockflags that control the locking behavior of various functions.
+ */
+#define	UVM_LK_ENTER	0x00000001	/* map locked on entry */
+#define	UVM_LK_EXIT	0x00000002	/* leave map locked on exit */
+
+/*
+ * Default number of pages to allocate on the stack
+ */
+#define	UBC_MAX_PAGES	8
+
+/*
+ * Value representing inactive emap.
+ */
+#define	UVM_EMAP_INACTIVE	(0)
+
+/*
+ * structures
+ */
+
+struct buf;
+struct core;
+struct loadavg;
+struct mount;
+struct pglist;
+struct proc;
+struct uio;
+struct uvm_object;
+struct vm_anon;
+struct vmspace;
+struct pmap;
+struct vnode;
+struct vm_map_entry;
+struct vm_map;
+struct vm_page;
+struct vmtotal;
+
+/*
+ * uvm_pctparam: parameter to be shown as percentage to user.
+ */
+
+#define	UVM_PCTPARAM_SHIFT	8
+#define	UVM_PCTPARAM_SCALE	(1 << UVM_PCTPARAM_SHIFT)
+#define	UVM_PCTPARAM_APPLY(pct, x) \
+	(((x) * (pct)->pct_scaled) >> UVM_PCTPARAM_SHIFT)
+struct uvm_pctparam {
+	int pct_pct;	/* percent [0, 100] */ /* should be the first member */
+	int pct_scaled;
+	int (*pct_check)(struct uvm_pctparam *, int);
+};
+
+/*
+ * uvmexp: global data structures that are exported to parts of the kernel
+ * other than the vm system.
+ */
+
+struct uvmexp {
+	/* vm_page constants */
+	int pagesize;   /* size of a page (PAGE_SIZE): must be power of 2 */
+	int pagemask;   /* page mask */
+	int pageshift;  /* page shift */
+
+	/* vm_page counters */
+	int npages;     /* number of pages we manage */
+	int free;       /* number of free pages */
+	int paging;	/* number of pages in the process of being paged out */
+	int wired;      /* number of wired pages */
+
+	/*
+	 * Adding anything before this line will break binary compatibility
+	 * with top(1) on NetBSD 1.5.
+	 */
+
+	int ncolors;	/* number of page color buckets: must be p-o-2 */
+	int colormask;	/* color bucket mask */
+
+	int zeropages;		/* number of zero'd pages */
+	int reserve_pagedaemon; /* number of pages reserved for pagedaemon */
+	int reserve_kernel;	/* number of pages reserved for kernel */
+	unsigned anonpages;	/* number of pages used by anon mappings */
+	unsigned filepages;	/* number of pages used by cached file data */
+	unsigned execpages;	/* number of pages used by cached exec data */
+
+	/* pageout params */
+	int freemin;    /* min number of free pages */
+	int freetarg;   /* target number of free pages */
+	int wiredmax;   /* max number of wired pages */
+
+	/* swap */
+	int nswapdev;	/* number of configured swap devices in system */
+	int swpages;	/* number of PAGE_SIZE'ed swap pages */
+	int swpgavail;	/* number of swap pages currently available */
+	int swpginuse;	/* number of swap pages in use */
+	int swpgonly;	/* number of swap pages in use, not also in RAM */
+	int nswget;	/* number of times fault calls uvm_swap_get() */
+
+	/* stat counters.  XXX: should be 64-bit counters */
+	int _unused_faults;	/* page fault count */
+	int _unused_traps;	/* trap count */
+	int _unused_intrs;	/* interrupt count */
+	int _unused_swtch;	/* context switch count */
+	int _unused_softs;	/* software interrupt count */
+	int _unused_syscalls;	/* system calls */
+	int pageins;		/* pagein operation count */
+				/* pageouts are in pdpageouts below */
+	int _unused1;
+	int _unused2;
+	int pgswapin;		/* pages swapped in */
+	int pgswapout;		/* pages swapped out */
+	int forks;  		/* forks */
+	int forks_ppwait;	/* forks where parent waits */
+	int forks_sharevm;	/* forks where vmspace is shared */
+	int pga_zerohit;	/* pagealloc where zero wanted and zero
+				   was available */
+	int pga_zeromiss;	/* pagealloc where zero wanted and zero
+				   not available */
+	int zeroaborts;		/* number of times page zeroing was
+				   aborted */
+	int colorhit;		/* pagealloc where we got optimal color */
+	int colormiss;		/* pagealloc where we didn't */
+	int cpuhit;		/* pagealloc where we allocated locally */
+	int cpumiss;		/* pagealloc where we didn't */
+
+	/* fault subcounters.  XXX: should be 64-bit counters */
+	int fltnoram;	/* number of times fault was out of ram */
+	int fltnoanon;	/* number of times fault was out of anons */
+	int fltpgwait;	/* number of times fault had to wait on a page */
+	int fltpgrele;	/* number of times fault found a released page */
+	int fltrelck;	/* number of times fault relock called */
+	int fltrelckok;	/* number of times fault relock is a success */
+	int fltanget;	/* number of times fault gets anon page */
+	int fltanretry;	/* number of times fault retrys an anon get */
+	int fltamcopy;	/* number of times fault clears "needs copy" */
+	int fltnamap;	/* number of times fault maps a neighbor anon page */
+	int fltnomap;	/* number of times fault maps a neighbor obj page */
+	int fltlget;	/* number of times fault does a locked pgo_get */
+	int fltget;	/* number of times fault does an unlocked get */
+	int flt_anon;	/* number of times fault anon (case 1a) */
+	int flt_acow;	/* number of times fault anon cow (case 1b) */
+	int flt_obj;	/* number of times fault is on object page (2a) */
+	int flt_prcopy;	/* number of times fault promotes with copy (2b) */
+	int flt_przero;	/* number of times fault promotes with zerofill (2b) */
+
+	/* daemon counters.  XXX: should be 64-bit counters */
+	int pdwoke;	/* number of times daemon woke up */
+	int pdrevs;	/* number of times daemon rev'd clock hand */
+	int _unused3;
+	int pdfreed;	/* number of pages daemon freed since boot */
+	int pdscans;	/* number of pages daemon scanned since boot */
+	int pdanscan;	/* number of anonymous pages scanned by daemon */
+	int pdobscan;	/* number of object pages scanned by daemon */
+	int pdreact;	/* number of pages daemon reactivated since boot */
+	int pdbusy;	/* number of times daemon found a busy page */
+	int pdpageouts;	/* number of times daemon started a pageout */
+	int pdpending;	/* number of times daemon got a pending pagout */
+	int pddeact;	/* number of pages daemon deactivates */
+	int pdreanon;	/* anon pages reactivated due to thresholds */
+	int pdrefile;	/* file pages reactivated due to thresholds */
+	int pdreexec;	/* executable pages reactivated due to thresholds */
+};
+
+/*
+ * The following structure is 64-bit alignment safe.  New elements
+ * should only be added to the end of this structure so binary
+ * compatibility can be preserved.
+ */
+struct uvmexp_sysctl {
+	int64_t	pagesize;
+	int64_t	pagemask;
+	int64_t	pageshift;
+	int64_t	npages;
+	int64_t	free;
+	int64_t	active;
+	int64_t	inactive;
+	int64_t	paging;
+	int64_t	wired;
+	int64_t	zeropages;
+	int64_t	reserve_pagedaemon;
+	int64_t	reserve_kernel;
+	int64_t	freemin;
+	int64_t	freetarg;
+	int64_t	inactarg;		/* unused */
+	int64_t	wiredmax;
+	int64_t	nswapdev;
+	int64_t	swpages;
+	int64_t	swpginuse;
+	int64_t	swpgonly;
+	int64_t	nswget;
+	int64_t	unused1;		/* unused; was nanon */
+	int64_t cpuhit;
+	int64_t cpumiss;
+	int64_t	faults;
+	int64_t	traps;
+	int64_t	intrs;
+	int64_t	swtch;
+	int64_t	softs;
+	int64_t	syscalls;
+	int64_t	pageins;
+	int64_t	swapins;		/* unused */
+	int64_t	swapouts;		/* unused */
+	int64_t	pgswapin;
+	int64_t	pgswapout;
+	int64_t	forks;
+	int64_t	forks_ppwait;
+	int64_t	forks_sharevm;
+	int64_t	pga_zerohit;
+	int64_t	pga_zeromiss;
+	int64_t	zeroaborts;
+	int64_t	fltnoram;
+	int64_t	fltnoanon;
+	int64_t	fltpgwait;
+	int64_t	fltpgrele;
+	int64_t	fltrelck;
+	int64_t	fltrelckok;
+	int64_t	fltanget;
+	int64_t	fltanretry;
+	int64_t	fltamcopy;
+	int64_t	fltnamap;
+	int64_t	fltnomap;
+	int64_t	fltlget;
+	int64_t	fltget;
+	int64_t	flt_anon;
+	int64_t	flt_acow;
+	int64_t	flt_obj;
+	int64_t	flt_prcopy;
+	int64_t	flt_przero;
+	int64_t	pdwoke;
+	int64_t	pdrevs;
+	int64_t	unused4;
+	int64_t	pdfreed;
+	int64_t	pdscans;
+	int64_t	pdanscan;
+	int64_t	pdobscan;
+	int64_t	pdreact;
+	int64_t	pdbusy;
+	int64_t	pdpageouts;
+	int64_t	pdpending;
+	int64_t	pddeact;
+	int64_t	anonpages;
+	int64_t	filepages;
+	int64_t	execpages;
+	int64_t colorhit;
+	int64_t colormiss;
+	int64_t ncolors;
+};
+
+#ifdef _KERNEL
+/* we need this before including uvm_page.h on some platforms */
+extern struct uvmexp uvmexp;
+/* MD code needs this without including <uvm/uvm.h> */
+extern bool vm_page_zero_enable;
+#endif
+
+/*
+ * Finally, bring in standard UVM headers.
+ */
+#include <sys/vmmeter.h>
+#include <sys/queue.h>
+#include <sys/lock.h>
+#ifdef _KERNEL
+#include <sys/vmem.h>
+#endif
+#include <uvm/uvm_param.h>
+#include <uvm/uvm_prot.h>
+#include <uvm/uvm_pmap.h>
+#include <uvm/uvm_map.h>
+#include <uvm/uvm_pager.h>
+
+/*
+ * helpers for calling ubc_release()
+ */
+#ifdef PMAP_CACHE_VIVT
+#define UBC_WANT_UNMAP(vp) (((vp)->v_iflag & VI_TEXT) != 0)
+#else
+#define UBC_WANT_UNMAP(vp) false
+#endif
+#define UBC_UNMAP_FLAG(vp) (UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0)
+
+/*
+ * Shareable process virtual address space.
+ * May eventually be merged with vm_map.
+ * Several fields are temporary (text, data stuff).
+ */
+struct vmspace {
+	struct	vm_map vm_map;	/* VM address map */
+	int	vm_refcnt;	/* number of references *
+				 * note: protected by vm_map.ref_lock */
+	void *	vm_shm;		/* SYS5 shared memory private data XXX */
+/* we copy from vm_startcopy to the end of the structure on fork */
+#define vm_startcopy vm_rssize
+	segsz_t vm_rssize;	/* current resident set size in pages */
+	segsz_t vm_swrss;	/* resident set size before last swap */
+	segsz_t vm_tsize;	/* text size (pages) XXX */
+	segsz_t vm_dsize;	/* data size (pages) XXX */
+	segsz_t vm_ssize;	/* stack size (pages) */
+	segsz_t vm_issize;	/* initial unmapped stack size (pages) */
+	void *	vm_taddr;	/* user virtual address of text XXX */
+	void *	vm_daddr;	/* user virtual address of data XXX */
+	void *vm_maxsaddr;	/* user VA at max stack growth */
+	void *vm_minsaddr;	/* user VA at top of stack */
+	size_t vm_aslr_delta_mmap;	/* mmap() random delta for ASLR */
+};
+#define	VMSPACE_IS_KERNEL_P(vm)	VM_MAP_IS_KERNEL(&(vm)->vm_map)
+
+#ifdef _KERNEL
+
+/*
+ * used to keep state while iterating over the map for a core dump.
+ */
+struct uvm_coredump_state {
+	void *cookie;		/* opaque for the caller */
+	vaddr_t start;		/* start of region */
+	vaddr_t realend;	/* real end of region */
+	vaddr_t end;		/* virtual end of region */
+	vm_prot_t prot;		/* protection of region */
+	int flags;		/* flags; see below */
+};
+
+#define	UVM_COREDUMP_STACK	0x01	/* region is user stack */
+
+/*
+ * the various kernel maps, owned by MD code
+ */
+extern struct vm_map *kernel_map;
+extern struct vm_map *phys_map;
+
+/*
+ * macros
+ */
+
+#define vm_resident_count(vm) (pmap_resident_count((vm)->vm_map.pmap))
+
+
+/* vm_machdep.c */
+int		vmapbuf(struct buf *, vsize_t);
+void		vunmapbuf(struct buf *, vsize_t);
+
+/* uvm_aobj.c */
+struct uvm_object	*uao_create(vsize_t, int);
+void			uao_set_pgfl(struct uvm_object *, int);
+void			uao_detach(struct uvm_object *);
+void			uao_reference(struct uvm_object *);
+
+/* uvm_bio.c */
+void			ubc_init(void);
+void			ubchist_init(void);
+void *			ubc_alloc(struct uvm_object *, voff_t, vsize_t *, int,
+			    int);
+void			ubc_release(void *, int);
+int			ubc_uiomove(struct uvm_object *, struct uio *, vsize_t,
+			    int, int);
+void			ubc_zerorange(struct uvm_object *, off_t, size_t, int);
+void			ubc_purge(struct uvm_object *);
+
+/* uvm_emap.c */
+void			uvm_emap_sysinit(void);
+#ifdef __HAVE_PMAP_EMAP
+void			uvm_emap_switch(lwp_t *);
+#else
+#define			uvm_emap_switch(l)
+#endif
+
+u_int			uvm_emap_gen_return(void);
+void			uvm_emap_update(u_int);
+
+vaddr_t			uvm_emap_alloc(vsize_t, bool);
+void			uvm_emap_free(vaddr_t, size_t);
+
+void			uvm_emap_enter(vaddr_t, struct vm_page **, u_int);
+void			uvm_emap_remove(vaddr_t, vsize_t);
+
+#ifdef __HAVE_PMAP_EMAP
+void			uvm_emap_consume(u_int);
+u_int			uvm_emap_produce(void);
+#else
+#define			uvm_emap_consume(x)
+#define			uvm_emap_produce()	UVM_EMAP_INACTIVE
+#endif
+
+/* uvm_fault.c */
+#define uvm_fault(m, a, p) uvm_fault_internal(m, a, p, 0)
+int		uvm_fault_internal(struct vm_map *, vaddr_t, vm_prot_t, int);
+			/* handle a page fault */
+
+/* uvm_glue.c */
+#if defined(KGDB)
+void			uvm_chgkprot(void *, size_t, int);
+#endif
+void			uvm_proc_fork(struct proc *, struct proc *, bool);
+void			uvm_lwp_fork(struct lwp *, struct lwp *,
+			    void *, size_t, void (*)(void *), void *);
+int			uvm_coredump_walkmap(struct proc *,
+			    int (*)(struct uvm_coredump_state *), void *);
+int			uvm_coredump_count_segs(struct proc *);
+void			uvm_proc_exit(struct proc *);
+void			uvm_lwp_exit(struct lwp *);
+void			uvm_init_limits(struct proc *);
+bool			uvm_kernacc(void *, size_t, vm_prot_t);
+__dead void		uvm_scheduler(void);
+vaddr_t			uvm_uarea_alloc(void);
+void			uvm_uarea_free(vaddr_t);
+vaddr_t			uvm_uarea_system_alloc(struct cpu_info *);
+void			uvm_uarea_system_free(vaddr_t);
+vaddr_t			uvm_lwp_getuarea(lwp_t *);
+void			uvm_lwp_setuarea(lwp_t *, vaddr_t);
+int			uvm_vslock(struct vmspace *, void *, size_t, vm_prot_t);
+void			uvm_vsunlock(struct vmspace *, void *, size_t);
+void			uvm_cpu_attach(struct cpu_info *);
+
+
+/* uvm_init.c */
+void			uvm_init(void);
+
+/* uvm_io.c */
+int			uvm_io(struct vm_map *, struct uio *);
+
+/* uvm_km.c */
+vaddr_t			uvm_km_alloc(struct vm_map *, vsize_t, vsize_t,
+			    uvm_flag_t);
+void			uvm_km_free(struct vm_map *, vaddr_t, vsize_t,
+			    uvm_flag_t);
+
+struct vm_map		*uvm_km_suballoc(struct vm_map *, vaddr_t *,
+			    vaddr_t *, vsize_t, int, bool,
+			    struct vm_map *);
+#ifdef _KERNEL
+int			uvm_km_kmem_alloc(vmem_t *, vmem_size_t, vm_flag_t,
+			    vmem_addr_t *);
+void			uvm_km_kmem_free(vmem_t *, vmem_addr_t, vmem_size_t);
+bool			uvm_km_va_starved_p(void);
+#endif
+
+/* uvm_map.c */
+int			uvm_map(struct vm_map *, vaddr_t *, vsize_t,
+			    struct uvm_object *, voff_t, vsize_t,
+			    uvm_flag_t);
+int			uvm_map_pageable(struct vm_map *, vaddr_t,
+			    vaddr_t, bool, int);
+int			uvm_map_pageable_all(struct vm_map *, int, vsize_t);
+bool			uvm_map_checkprot(struct vm_map *, vaddr_t,
+			    vaddr_t, vm_prot_t);
+int			uvm_map_protect(struct vm_map *, vaddr_t,
+			    vaddr_t, vm_prot_t, bool);
+struct vmspace		*uvmspace_alloc(vaddr_t, vaddr_t, bool);
+void			uvmspace_init(struct vmspace *, struct pmap *,
+			    vaddr_t, vaddr_t, bool);
+void			uvmspace_exec(struct lwp *, vaddr_t, vaddr_t, bool);
+void			uvmspace_spawn(struct lwp *, vaddr_t, vaddr_t, bool);
+struct vmspace		*uvmspace_fork(struct vmspace *);
+void			uvmspace_addref(struct vmspace *);
+void			uvmspace_free(struct vmspace *);
+void			uvmspace_share(struct proc *, struct proc *);
+void			uvmspace_unshare(struct lwp *);
+
+void			uvm_whatis(uintptr_t, void (*)(const char *, ...));
+
+/* uvm_meter.c */
+int			uvm_sysctl(int *, u_int, void *, size_t *,
+			    void *, size_t, struct proc *);
+int			uvm_pctparam_check(struct uvm_pctparam *, int);
+void			uvm_pctparam_set(struct uvm_pctparam *, int);
+int			uvm_pctparam_get(struct uvm_pctparam *);
+void			uvm_pctparam_init(struct uvm_pctparam *, int,
+			    int (*)(struct uvm_pctparam *, int));
+int			uvm_pctparam_createsysctlnode(struct uvm_pctparam *,
+			    const char *, const char *);
+
+/* uvm_mmap.c */
+int			uvm_mmap_dev(struct proc *, void **, size_t, dev_t,
+			    off_t);
+int			uvm_mmap_anon(struct proc *, void **, size_t);
+vaddr_t			uvm_default_mapaddr(struct proc *, vaddr_t, vsize_t);
+
+/* uvm_mremap.c */
+int			uvm_mremap(struct vm_map *, vaddr_t, vsize_t,
+			    struct vm_map *, vaddr_t *, vsize_t,
+			    struct proc *, int);
+
+/* uvm_object.c */
+void			uvm_obj_init(struct uvm_object *,
+			    const struct uvm_pagerops *, bool, u_int);
+void			uvm_obj_setlock(struct uvm_object *, kmutex_t *);
+void			uvm_obj_destroy(struct uvm_object *, bool);
+int			uvm_obj_wirepages(struct uvm_object *, off_t, off_t,
+			    struct pglist *);
+void			uvm_obj_unwirepages(struct uvm_object *, off_t, off_t);
+
+/* uvm_page.c */
+struct vm_page		*uvm_pagealloc_strat(struct uvm_object *,
+			    voff_t, struct vm_anon *, int, int, int);
+#define	uvm_pagealloc(obj, off, anon, flags) \
+	    uvm_pagealloc_strat((obj), (off), (anon), (flags), \
+				UVM_PGA_STRAT_NORMAL, 0)
+void			uvm_pagereplace(struct vm_page *,
+			    struct vm_page *);
+void			uvm_pagerealloc(struct vm_page *,
+			    struct uvm_object *, voff_t);
+/* Actually, uvm_page_physload takes PF#s which need their own type */
+void			uvm_page_physload(paddr_t, paddr_t, paddr_t,
+			    paddr_t, int);
+void			uvm_setpagesize(void);
+
+/* uvm_pager.c */
+void			uvm_aio_biodone(struct buf *);
+void			uvm_aio_aiodone(struct buf *);
+void			uvm_aio_aiodone_pages(struct vm_page **, int, bool,
+			    int);
+
+/* uvm_pdaemon.c */
+void			uvm_pageout(void *);
+struct work;
+void			uvm_aiodone_worker(struct work *, void *);
+void			uvm_pageout_start(int);
+void			uvm_pageout_done(int);
+void			uvm_estimatepageable(int *, int *);
+
+/* uvm_pglist.c */
+int			uvm_pglistalloc(psize_t, paddr_t, paddr_t,
+			    paddr_t, paddr_t, struct pglist *, int, int);
+void			uvm_pglistfree(struct pglist *);
+
+/* uvm_swap.c */
+void			uvm_swap_init(void);
+
+/* uvm_unix.c */
+int			uvm_grow(struct proc *, vaddr_t);
+
+/* uvm_user.c */
+void			uvm_deallocate(struct vm_map *, vaddr_t, vsize_t);
+
+/* uvm_vnode.c */
+void			uvm_vnp_setsize(struct vnode *, voff_t);
+void			uvm_vnp_setwritesize(struct vnode *, voff_t);
+int			uvn_findpages(struct uvm_object *, voff_t,
+			    int *, struct vm_page **, int);
+bool			uvn_text_p(struct uvm_object *);
+bool			uvn_clean_p(struct uvm_object *);
+bool			uvn_needs_writefault_p(struct uvm_object *);
+
+/* kern_malloc.c */
+void			kmeminit_nkmempages(void);
+extern int		nkmempages;
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_EXTERN_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_extern.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_km.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_km.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_km.h	(revision 13)
@@ -0,0 +1,55 @@
+/*	$NetBSD: uvm_km.h,v 1.20 2012/01/27 19:48:41 para Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ *
+ * from: Id: uvm_km.h,v 1.1.2.2 1997/12/30 12:03:15 mrg Exp
+ */
+
+#ifndef _UVM_UVM_KM_H_
+#define _UVM_UVM_KM_H_
+
+/*
+ * uvm_km.h
+ */
+
+#ifdef _KERNEL
+
+/*
+ * prototypes
+ */
+
+void uvm_km_bootstrap(vaddr_t, vaddr_t);
+void uvm_km_init(void);
+void uvm_km_pgremove(vaddr_t, vaddr_t);
+void uvm_km_pgremove_intrsafe(struct vm_map *, vaddr_t, vaddr_t);
+#if defined(DEBUG)
+void uvm_km_check_empty(struct vm_map *, vaddr_t, vaddr_t);
+#else
+#define	uvm_km_check_empty(a, b, c)	/* nothing */
+#endif /* defined(DEBUG) */
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_KM_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_km.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/ttychars.h
===================================================================
--- lab4/.minix-src/include/sys/ttychars.h	(nonexistent)
+++ lab4/.minix-src/include/sys/ttychars.h	(revision 13)
@@ -0,0 +1,62 @@
+/*	$NetBSD: ttychars.h,v 1.9 2005/12/11 12:25:21 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ttychars.h	8.2 (Berkeley) 1/4/94
+ */
+
+/*
+ * 4.3 COMPATIBILITY FILE
+ *
+ * User visible structures and constants related to terminal handling.
+ */
+#ifndef _SYS_TTYCHARS_H_
+#define	_SYS_TTYCHARS_H_
+
+struct ttychars {
+	char	tc_erase;	/* erase last character */
+	char	tc_kill;	/* erase entire line */
+	char	tc_intrc;	/* interrupt */
+	char	tc_quitc;	/* quit */
+	char	tc_startc;	/* start output */
+	char	tc_stopc;	/* stop output */
+	char	tc_eofc;	/* end-of-file */
+	char	tc_brkc;	/* input delimiter (like nl) */
+	char	tc_suspc;	/* stop process signal */
+	char	tc_dsuspc;	/* delayed stop process signal */
+	char	tc_rprntc;	/* reprint line */
+	char	tc_flushc;	/* flush output (toggles) */
+	char	tc_werasc;	/* word erase */
+	char	tc_lnextc;	/* literal next character */
+};
+#endif /* !_SYS_TTYCHARS_H_ */
+
+#ifdef USE_OLD_TTY
+#include <sys/ttydefaults.h>	/* to pick up character defaults */
+#endif

Property changes on: lab4/.minix-src/include/sys/ttychars.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/types.h
===================================================================
--- lab4/.minix-src/include/sys/types.h	(nonexistent)
+++ lab4/.minix-src/include/sys/types.h	(revision 13)
@@ -0,0 +1,391 @@
+/*	$NetBSD: types.h,v 1.95 2015/08/27 12:30:51 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 1982, 1986, 1991, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)types.h	8.4 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_TYPES_H_
+#define	_SYS_TYPES_H_
+
+#include <sys/featuretest.h>
+
+/* Machine type dependent parameters. */
+#include <machine/types.h>
+
+#include <machine/ansi.h>
+#include <machine/int_types.h>
+
+
+#include <sys/ansi.h>
+
+#ifndef	int8_t
+typedef	__int8_t	int8_t;
+#define	int8_t		__int8_t
+#endif
+
+#ifndef	uint8_t
+typedef	__uint8_t	uint8_t;
+#define	uint8_t		__uint8_t
+#endif
+
+#ifndef	int16_t
+typedef	__int16_t	int16_t;
+#define	int16_t		__int16_t
+#endif
+
+#ifndef	uint16_t
+typedef	__uint16_t	uint16_t;
+#define	uint16_t	__uint16_t
+#endif
+
+#ifndef	int32_t
+typedef	__int32_t	int32_t;
+#define	int32_t		__int32_t
+#endif
+
+#ifndef	uint32_t
+typedef	__uint32_t	uint32_t;
+#define	uint32_t	__uint32_t
+#endif
+
+#ifndef	int64_t
+typedef	__int64_t	int64_t;
+#define	int64_t		__int64_t
+#endif
+
+#ifndef	uint64_t
+typedef	__uint64_t	uint64_t;
+#define	uint64_t	__uint64_t
+#endif
+
+typedef	uint8_t		u_int8_t;
+typedef	uint16_t	u_int16_t;
+typedef	uint32_t	u_int32_t;
+typedef	uint64_t	u_int64_t;
+
+#if defined(__minix)
+typedef uint8_t 	u8_t;
+#define u8_t		uint8_t
+typedef uint16_t	u16_t;
+#define u16_t		uint16_t
+typedef uint32_t	u32_t;
+#define u32_t		uint32_t
+typedef uint64_t 	u64_t;
+#define u64_t		uint64_t
+
+typedef int8_t		i8_t;
+#define i8_t		int8_t
+typedef int16_t		i16_t;
+#define i16_t		int16_t
+typedef int32_t		i32_t;
+#define i32_t		int32_t
+typedef int64_t		i64_t;
+#define i64_t		int64_t
+
+#ifdef _NETBSD_SOURCE
+/* some Minix specific types that do not conflict with posix */
+typedef uint32_t zone_t;      /* zone number */
+typedef uint32_t block_t;     /* block number */
+typedef uint64_t block64_t;   /* block number, 64-bit */
+typedef uint32_t bit_t;       /* bit number in a bit map */
+typedef uint16_t zone1_t;     /* zone number for V1 file systems */
+typedef uint32_t bitchunk_t; /* collection of bits in a bitmap */
+#endif
+#endif /* defined(__minix) */
+
+#include <machine/endian.h>
+
+#if defined(_NETBSD_SOURCE)
+typedef	unsigned char	u_char;
+typedef	unsigned short	u_short;
+typedef	unsigned int	u_int;
+typedef	unsigned long	u_long;
+
+typedef unsigned char	unchar;		/* Sys V compatibility */
+typedef	unsigned short	ushort;		/* Sys V compatibility */
+typedef	unsigned int	uint;		/* Sys V compatibility */
+typedef unsigned long	ulong;		/* Sys V compatibility */
+#endif
+
+typedef	uint64_t	u_quad_t;	/* quads */
+typedef	int64_t		quad_t;
+typedef	quad_t *	qaddr_t;
+
+/*
+ * The types longlong_t and u_longlong_t exist for use with the
+ * Sun-derived XDR routines involving these types, and their usage
+ * in other contexts is discouraged.  Further note that these types
+ * may not be equivalent to "long long" and "unsigned long long",
+ * they are only guaranteed to be signed and unsigned 64-bit types
+ * respectively.  Portable programs that need 64-bit types should use
+ * the C99 types int64_t and uint64_t instead.
+ */
+
+typedef	int64_t		longlong_t;	/* for XDR */
+typedef	uint64_t	u_longlong_t;	/* for XDR */
+
+typedef	int64_t		blkcnt_t;	/* fs block count */
+typedef	int32_t		blksize_t;	/* fs optimal block size */
+
+#ifndef	fsblkcnt_t
+typedef	__fsblkcnt_t	fsblkcnt_t;	/* fs block count (statvfs) */
+#define fsblkcnt_t	__fsblkcnt_t
+#endif
+
+#ifndef	fsfilcnt_t
+typedef	__fsfilcnt_t	fsfilcnt_t;	/* fs file count */
+#define fsfilcnt_t	__fsfilcnt_t
+#endif
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+/* We don't and shouldn't use caddr_t in the kernel anymore */
+#ifndef	caddr_t
+typedef	__caddr_t	caddr_t;	/* core address */
+#define	caddr_t		__caddr_t
+#endif
+#endif
+
+#ifdef __daddr_t
+typedef	__daddr_t	daddr_t;	/* disk address */
+#undef __daddr_t
+#else
+typedef	int64_t		daddr_t;	/* disk address */
+#endif
+
+typedef	uint64_t	dev_t;		/* device number */
+typedef	uint32_t	fixpt_t;	/* fixed point number */
+
+#ifndef	gid_t
+typedef	__gid_t		gid_t;		/* group id */
+#define	gid_t		__gid_t
+#endif
+
+typedef	int		idtype_t;	/* type of the id */
+typedef	uint32_t	id_t;		/* group id, process id or user id */
+typedef	uint64_t	ino_t;		/* inode number */
+typedef	long		key_t;		/* IPC key (for Sys V IPC) */
+
+#ifndef	mode_t
+typedef	__mode_t	mode_t;		/* permissions */
+#define	mode_t		__mode_t
+#endif
+
+typedef	uint32_t	nlink_t;	/* link count */
+
+#ifndef	off_t
+typedef	__off_t		off_t;		/* file offset */
+#define	off_t		__off_t
+#endif
+
+#ifndef	pid_t
+typedef	__pid_t		pid_t;		/* process id */
+#define	pid_t		__pid_t
+#endif
+typedef int32_t		lwpid_t;	/* LWP id */
+typedef uint64_t	rlim_t;		/* resource limit */
+typedef	int32_t		segsz_t;	/* segment size */
+typedef	int32_t		swblk_t;	/* swap offset */
+
+#ifndef	uid_t
+typedef	__uid_t		uid_t;		/* user id */
+#define	uid_t		__uid_t
+#endif
+
+typedef int		mqd_t;
+
+typedef	unsigned long	cpuid_t;
+
+typedef	int		psetid_t;
+
+typedef volatile __cpu_simple_lock_nv_t __cpu_simple_lock_t;
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+
+#include <sys/stdbool.h>
+
+/*
+ * Deprecated Mach-style boolean_t type.  Should not be used by new code.
+ */
+typedef int	boolean_t;
+#ifndef TRUE
+#define	TRUE	1
+#endif
+#ifndef FALSE
+#define	FALSE	0
+#endif
+
+#endif /* _KERNEL || _STANDALONE */
+
+#if defined(_KERNEL) || defined(_LIBC)
+/*
+ * semctl(2)'s argument structure.  This is here for the benefit of
+ * <sys/syscallargs.h>.  It is not in the user's namespace in SUSv2.
+ * The SUSv2 semctl(2) takes variable arguments.
+ */
+union __semun {
+	int		val;		/* value for SETVAL */
+	struct semid_ds	*buf;		/* buffer for IPC_STAT & IPC_SET */
+	unsigned short	*array;		/* array for GETALL & SETALL */
+};
+#include <sys/stdint.h>
+#endif /* _KERNEL || _LIBC */
+
+/*
+ * These belong in unistd.h, but are placed here too to ensure that
+ * long arguments will be promoted to off_t if the program fails to
+ * include that header or explicitly cast them to off_t.
+ */
+#if defined(_NETBSD_SOURCE)
+#ifndef __OFF_T_SYSCALLS_DECLARED
+#define __OFF_T_SYSCALLS_DECLARED
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+off_t	 lseek(int, off_t, int);
+int	 ftruncate(int, off_t);
+int	 truncate(const char *, off_t);
+__END_DECLS
+#endif /* !_KERNEL */
+#endif /* __OFF_T_SYSCALLS_DECLARED */
+#endif /* defined(_NETBSD_SOURCE) */
+
+#if defined(_NETBSD_SOURCE)
+/* Major, minor numbers, dev_t's. */
+typedef int32_t __devmajor_t, __devminor_t;
+#define devmajor_t __devmajor_t
+#define devminor_t __devminor_t
+#define NODEVMAJOR (-1)
+#define	major(x)	((devmajor_t)(((uint32_t)(x) & 0x000fff00) >>  8))
+#define	minor(x)	((devminor_t)((((uint32_t)(x) & 0xfff00000) >> 12) | \
+				   (((uint32_t)(x) & 0x000000ff) >>  0)))
+#define	makedev(x,y)	((dev_t)((((x) <<  8) & 0x000fff00) | \
+				 (((y) << 12) & 0xfff00000) | \
+				 (((y) <<  0) & 0x000000ff)))
+#endif
+
+#ifdef	_BSD_CLOCK_T_
+typedef	_BSD_CLOCK_T_		clock_t;
+#undef	_BSD_CLOCK_T_
+#endif
+
+#ifdef	_BSD_PTRDIFF_T_
+typedef	_BSD_PTRDIFF_T_		ptrdiff_t;
+#undef	_BSD_PTRDIFF_T_
+#endif
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_		size_t;
+#define _SIZE_T
+#undef	_BSD_SIZE_T_
+#endif
+
+#ifdef	_BSD_SSIZE_T_
+typedef	_BSD_SSIZE_T_		ssize_t;
+#undef	_BSD_SSIZE_T_
+#endif
+
+#ifdef	_BSD_TIME_T_
+typedef	_BSD_TIME_T_		time_t;
+#undef	_BSD_TIME_T_
+#endif
+
+#ifdef	_BSD_CLOCKID_T_
+typedef	_BSD_CLOCKID_T_		clockid_t;
+#undef	_BSD_CLOCKID_T_
+#endif
+
+#ifdef	_BSD_TIMER_T_
+typedef	_BSD_TIMER_T_		timer_t;
+#undef	_BSD_TIMER_T_
+#endif
+
+#ifdef	_BSD_SUSECONDS_T_
+typedef	_BSD_SUSECONDS_T_	suseconds_t;
+#undef	_BSD_SUSECONDS_T_
+#endif
+
+#ifdef	_BSD_USECONDS_T_
+typedef	_BSD_USECONDS_T_	useconds_t;
+#undef	_BSD_USECONDS_T_
+#endif
+
+#ifdef _NETBSD_SOURCE
+#include <sys/fd_set.h>
+
+#define	NBBY			8
+
+typedef struct kauth_cred *kauth_cred_t;
+
+typedef int pri_t;
+
+#endif
+
+#if defined(__STDC__) && (defined(_KERNEL) || defined(_KMEMUSER))
+/*
+ * Forward structure declarations for function prototypes.  We include the
+ * common structures that cross subsystem boundaries here; others are mostly
+ * used in the same place that the structure is defined.
+ */
+struct	lwp;
+typedef struct lwp lwp_t;
+struct	__ucontext;
+struct	proc;
+typedef struct proc proc_t;
+struct	pgrp;
+struct	rusage;
+struct	file;
+typedef struct file file_t;
+struct	buf;
+typedef struct buf buf_t;
+struct	tty;
+struct	uio;
+#endif
+
+#ifdef _KERNEL
+#define SET(t, f)	((t) |= (f))
+#define	ISSET(t, f)	((t) & (f))
+#define	CLR(t, f)	((t) &= ~(f))
+#endif
+
+#if !defined(__minix)
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#include <pthread_types.h>
+#endif
+#endif
+#endif /* !defined(__minix) */
+
+#endif /* !_SYS_TYPES_H_ */

Property changes on: lab4/.minix-src/include/sys/types.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/un.h
===================================================================
--- lab4/.minix-src/include/sys/un.h	(nonexistent)
+++ lab4/.minix-src/include/sys/un.h	(revision 13)
@@ -0,0 +1,102 @@
+/*	$NetBSD: un.h,v 1.56 2015/05/02 17:18:04 rtr Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)un.h	8.3 (Berkeley) 2/19/95
+ */
+
+#ifndef _SYS_UN_H_
+#define _SYS_UN_H_
+
+#include <sys/ansi.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+#ifndef sa_family_t
+typedef __sa_family_t	sa_family_t;
+#define sa_family_t	__sa_family_t
+#endif
+
+/*
+ * Definitions for UNIX IPC domain.
+ */
+struct	sockaddr_un {
+	uint8_t		sun_len;	/* total sockaddr length */
+	sa_family_t	sun_family;	/* AF_LOCAL */
+	char		sun_path[104];	/* path name (gag) */
+};
+
+/*
+ * Socket options for UNIX IPC domain.
+ */
+#if defined(_NETBSD_SOURCE)
+#define	LOCAL_CREDS	0x0001		/* pass credentials to receiver */
+#define	LOCAL_CONNWAIT	0x0002		/* connects block until accepted */
+#define	LOCAL_PEEREID	0x0003		/* get peer identification */
+#endif
+
+/*
+ * Data automatically stored inside connect() for use by LOCAL_PEEREID
+ */
+struct unpcbid {
+	pid_t unp_pid;		/* process id */
+	uid_t unp_euid;		/* effective user id */
+	gid_t unp_egid;		/* effective group id */
+};
+
+#ifdef _KERNEL
+
+struct unpcb;
+struct socket;
+struct sockopt;
+struct sockaddr;
+
+extern const struct pr_usrreqs unp_usrreqs;
+
+int	uipc_ctloutput(int, struct socket *, struct sockopt *);
+void	uipc_init(void);
+kmutex_t *uipc_dgramlock(void);
+kmutex_t *uipc_streamlock(void);
+kmutex_t *uipc_rawlock(void);
+
+int	unp_connect(struct socket *, struct sockaddr *, struct lwp *);
+int	unp_connect2(struct socket *, struct socket *);
+void 	unp_dispose(struct mbuf *);
+int 	unp_externalize(struct mbuf *, struct lwp *, int);
+
+#else /* !_KERNEL */
+
+/* actual length of an initialized sockaddr_un */
+#if defined(_NETBSD_SOURCE)
+#define SUN_LEN(su) \
+	(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
+#endif /* !_NetBSD_SOURCE */
+#endif /* _KERNEL */
+
+#endif /* !_SYS_UN_H_ */

Property changes on: lab4/.minix-src/include/sys/un.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/utsname.h
===================================================================
--- lab4/.minix-src/include/sys/utsname.h	(nonexistent)
+++ lab4/.minix-src/include/sys/utsname.h	(revision 13)
@@ -0,0 +1,62 @@
+/*	$NetBSD: utsname.h,v 1.13 2005/12/11 12:25:21 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chuck Karish of Mindcraft, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)utsname.h	8.1 (Berkeley) 1/4/94
+ */
+
+#ifndef	_SYS_UTSNAME_H_
+#define	_SYS_UTSNAME_H_
+
+#include <sys/featuretest.h>
+
+#define	_SYS_NMLN	256
+
+#if defined(_NETBSD_SOURCE)
+#define	SYS_NMLN	_SYS_NMLN
+#endif
+
+struct utsname {
+	char	sysname[_SYS_NMLN];	/* Name of this OS. */
+	char	nodename[_SYS_NMLN];	/* Name of this network node. */
+	char	release[_SYS_NMLN];	/* Release level. */
+	char	version[_SYS_NMLN];	/* Version level. */
+	char	machine[_SYS_NMLN];	/* Hardware type. */
+};
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	uname(struct utsname *);
+__END_DECLS
+
+#endif	/* !_SYS_UTSNAME_H_ */

Property changes on: lab4/.minix-src/include/sys/utsname.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/video.h
===================================================================
--- lab4/.minix-src/include/sys/video.h	(nonexistent)
+++ lab4/.minix-src/include/sys/video.h	(revision 13)
@@ -0,0 +1,38 @@
+
+#ifndef _SYS_VIDEO_H
+#define _SYS_VIDEO_H 1
+
+/* Definitions used by the console driver. */
+#define MONO_BASE    0xB0000L   /* base of mono video memory */
+#define COLOR_BASE   0xB8000L   /* base of color video memory */
+#define MONO_SIZE     0x1000    /* 4K mono video memory */
+#define COLOR_SIZE    0x4000    /* 16K color video memory */
+#define EGA_SIZE      0x8000    /* EGA & VGA have at least 32K */
+#define BLANK_COLOR   0x0700    /* determines cursor color on blank screen */
+#define SCROLL_UP          0    /* scroll forward */
+#define SCROLL_DOWN        1    /* scroll backward */
+#define CONS_RAM_WORDS    80    /* video ram buffer size */
+#define MAX_ESC_PARMS      4    /* number of escape sequence params allowed */
+
+/* Constants relating to the controller chips. */
+#define M_6845         0x3B4    /* port for 6845 mono */
+#define C_6845         0x3D4    /* port for 6845 color */
+#define INDEX              0    /* 6845's index register */
+#define DATA               1    /* 6845's data register */
+#define STATUS             6    /* 6845's status register */
+#define VID_ORG           12    /* 6845's origin register */
+#define CURSOR            14    /* 6845's cursor register */
+
+/* Beeper. */
+#define BEEP_FREQ     0x0533    /* value to put into timer to set beep freq */
+#define B_TIME             3    /* length of CTRL-G beep is ticks */
+
+/* definitions used for font management */
+#define GA_SEQUENCER_INDEX      0x3C4
+#define GA_SEQUENCER_DATA       0x3C5
+#define GA_GRAPHICS_INDEX       0x3CE
+#define GA_GRAPHICS_DATA        0x3CF
+#define GA_VIDEO_ADDRESS        0xA0000L
+#define GA_FONT_SIZE            8192
+
+#endif

Property changes on: lab4/.minix-src/include/sys/video.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/vnode_if.h
===================================================================
--- lab4/.minix-src/include/sys/vnode_if.h	(nonexistent)
+++ lab4/.minix-src/include/sys/vnode_if.h	(revision 13)
@@ -0,0 +1,577 @@
+/*	$NetBSD: vnode_if.h,v 1.90 2015/04/20 23:11:27 riastradh Exp $	*/
+
+/*
+ * Warning: DO NOT EDIT! This file is automatically generated!
+ * (Modifications made here may easily be lost!)
+ *
+ * Created from the file:
+ *	NetBSD: vnode_if.src,v 1.69 2015/04/20 23:08:07 riastradh Exp
+ * by the script:
+ *	NetBSD: vnode_if.sh,v 1.60 2014/01/13 12:07:55 hannken Exp
+ */
+
+/*
+ * Copyright (c) 1992, 1993, 1994, 1995
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_VNODE_IF_H_
+#define _SYS_VNODE_IF_H_
+
+extern const struct vnodeop_desc vop_default_desc;
+
+struct buf;
+
+#ifndef _KERNEL
+#include <stdbool.h>
+#endif
+
+#define VOP_BWRITE_DESCOFFSET 1
+struct vop_bwrite_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	struct buf *a_bp;
+};
+extern const struct vnodeop_desc vop_bwrite_desc;
+int VOP_BWRITE(struct vnode *, struct buf *);
+
+#define VOP_LOOKUP_DESCOFFSET 2
+struct vop_lookup_v2_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_dvp;
+	struct vnode **a_vpp;
+	struct componentname *a_cnp;
+};
+extern const struct vnodeop_desc vop_lookup_desc;
+int VOP_LOOKUP(struct vnode *, struct vnode **, struct componentname *);
+
+#define VOP_CREATE_DESCOFFSET 3
+struct vop_create_v3_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_dvp;
+	struct vnode **a_vpp;
+	struct componentname *a_cnp;
+	struct vattr *a_vap;
+};
+extern const struct vnodeop_desc vop_create_desc;
+int VOP_CREATE(struct vnode *, struct vnode **, struct componentname *, 
+    struct vattr *);
+
+#define VOP_MKNOD_DESCOFFSET 4
+struct vop_mknod_v3_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_dvp;
+	struct vnode **a_vpp;
+	struct componentname *a_cnp;
+	struct vattr *a_vap;
+};
+extern const struct vnodeop_desc vop_mknod_desc;
+int VOP_MKNOD(struct vnode *, struct vnode **, struct componentname *, 
+    struct vattr *);
+
+#define VOP_OPEN_DESCOFFSET 5
+struct vop_open_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_mode;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_open_desc;
+int VOP_OPEN(struct vnode *, int, kauth_cred_t);
+
+#define VOP_CLOSE_DESCOFFSET 6
+struct vop_close_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_fflag;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_close_desc;
+int VOP_CLOSE(struct vnode *, int, kauth_cred_t);
+
+#define VOP_ACCESS_DESCOFFSET 7
+struct vop_access_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_mode;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_access_desc;
+int VOP_ACCESS(struct vnode *, int, kauth_cred_t);
+
+#define VOP_GETATTR_DESCOFFSET 8
+struct vop_getattr_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	struct vattr *a_vap;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_getattr_desc;
+int VOP_GETATTR(struct vnode *, struct vattr *, kauth_cred_t);
+
+#define VOP_SETATTR_DESCOFFSET 9
+struct vop_setattr_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	struct vattr *a_vap;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_setattr_desc;
+int VOP_SETATTR(struct vnode *, struct vattr *, kauth_cred_t);
+
+#define VOP_READ_DESCOFFSET 10
+struct vop_read_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	struct uio *a_uio;
+	int a_ioflag;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_read_desc;
+int VOP_READ(struct vnode *, struct uio *, int, kauth_cred_t);
+
+#define VOP_WRITE_DESCOFFSET 11
+struct vop_write_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	struct uio *a_uio;
+	int a_ioflag;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_write_desc;
+int VOP_WRITE(struct vnode *, struct uio *, int, kauth_cred_t);
+
+#define VOP_FALLOCATE_DESCOFFSET 12
+struct vop_fallocate_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	off_t a_pos;
+	off_t a_len;
+};
+extern const struct vnodeop_desc vop_fallocate_desc;
+int VOP_FALLOCATE(struct vnode *, off_t, off_t);
+
+#define VOP_FDISCARD_DESCOFFSET 13
+struct vop_fdiscard_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	off_t a_pos;
+	off_t a_len;
+};
+extern const struct vnodeop_desc vop_fdiscard_desc;
+int VOP_FDISCARD(struct vnode *, off_t, off_t);
+
+#define VOP_IOCTL_DESCOFFSET 14
+struct vop_ioctl_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	u_long a_command;
+	void *a_data;
+	int a_fflag;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_ioctl_desc;
+int VOP_IOCTL(struct vnode *, u_long, void *, int, kauth_cred_t);
+
+#define VOP_FCNTL_DESCOFFSET 15
+struct vop_fcntl_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	u_int a_command;
+	void *a_data;
+	int a_fflag;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_fcntl_desc;
+int VOP_FCNTL(struct vnode *, u_int, void *, int, kauth_cred_t);
+
+#define VOP_POLL_DESCOFFSET 16
+struct vop_poll_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_events;
+};
+extern const struct vnodeop_desc vop_poll_desc;
+int VOP_POLL(struct vnode *, int);
+
+#define VOP_KQFILTER_DESCOFFSET 17
+struct vop_kqfilter_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	struct knote *a_kn;
+};
+extern const struct vnodeop_desc vop_kqfilter_desc;
+int VOP_KQFILTER(struct vnode *, struct knote *);
+
+#define VOP_REVOKE_DESCOFFSET 18
+struct vop_revoke_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_flags;
+};
+extern const struct vnodeop_desc vop_revoke_desc;
+int VOP_REVOKE(struct vnode *, int);
+
+#define VOP_MMAP_DESCOFFSET 19
+struct vop_mmap_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	vm_prot_t a_prot;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_mmap_desc;
+int VOP_MMAP(struct vnode *, vm_prot_t, kauth_cred_t);
+
+#define VOP_FSYNC_DESCOFFSET 20
+struct vop_fsync_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	kauth_cred_t a_cred;
+	int a_flags;
+	off_t a_offlo;
+	off_t a_offhi;
+};
+extern const struct vnodeop_desc vop_fsync_desc;
+int VOP_FSYNC(struct vnode *, kauth_cred_t, int, off_t, off_t);
+
+#define VOP_SEEK_DESCOFFSET 21
+struct vop_seek_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	off_t a_oldoff;
+	off_t a_newoff;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_seek_desc;
+int VOP_SEEK(struct vnode *, off_t, off_t, kauth_cred_t);
+
+#define VOP_REMOVE_DESCOFFSET 22
+struct vop_remove_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_dvp;
+	struct vnode *a_vp;
+	struct componentname *a_cnp;
+};
+extern const struct vnodeop_desc vop_remove_desc;
+int VOP_REMOVE(struct vnode *, struct vnode *, struct componentname *);
+
+#define VOP_LINK_DESCOFFSET 23
+struct vop_link_v2_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_dvp;
+	struct vnode *a_vp;
+	struct componentname *a_cnp;
+};
+extern const struct vnodeop_desc vop_link_desc;
+int VOP_LINK(struct vnode *, struct vnode *, struct componentname *);
+
+#define VOP_RENAME_DESCOFFSET 24
+struct vop_rename_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_fdvp;
+	struct vnode *a_fvp;
+	struct componentname *a_fcnp;
+	struct vnode *a_tdvp;
+	struct vnode *a_tvp;
+	struct componentname *a_tcnp;
+};
+extern const struct vnodeop_desc vop_rename_desc;
+int VOP_RENAME(struct vnode *, struct vnode *, struct componentname *, 
+    struct vnode *, struct vnode *, struct componentname *);
+
+#define VOP_MKDIR_DESCOFFSET 25
+struct vop_mkdir_v3_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_dvp;
+	struct vnode **a_vpp;
+	struct componentname *a_cnp;
+	struct vattr *a_vap;
+};
+extern const struct vnodeop_desc vop_mkdir_desc;
+int VOP_MKDIR(struct vnode *, struct vnode **, struct componentname *, 
+    struct vattr *);
+
+#define VOP_RMDIR_DESCOFFSET 26
+struct vop_rmdir_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_dvp;
+	struct vnode *a_vp;
+	struct componentname *a_cnp;
+};
+extern const struct vnodeop_desc vop_rmdir_desc;
+int VOP_RMDIR(struct vnode *, struct vnode *, struct componentname *);
+
+#define VOP_SYMLINK_DESCOFFSET 27
+struct vop_symlink_v3_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_dvp;
+	struct vnode **a_vpp;
+	struct componentname *a_cnp;
+	struct vattr *a_vap;
+	char *a_target;
+};
+extern const struct vnodeop_desc vop_symlink_desc;
+int VOP_SYMLINK(struct vnode *, struct vnode **, struct componentname *, 
+    struct vattr *, char *);
+
+#define VOP_READDIR_DESCOFFSET 28
+struct vop_readdir_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	struct uio *a_uio;
+	kauth_cred_t a_cred;
+	int *a_eofflag;
+	off_t **a_cookies;
+	int *a_ncookies;
+};
+extern const struct vnodeop_desc vop_readdir_desc;
+int VOP_READDIR(struct vnode *, struct uio *, kauth_cred_t, int *, off_t **, 
+    int *);
+
+#define VOP_READLINK_DESCOFFSET 29
+struct vop_readlink_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	struct uio *a_uio;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_readlink_desc;
+int VOP_READLINK(struct vnode *, struct uio *, kauth_cred_t);
+
+#define VOP_ABORTOP_DESCOFFSET 30
+struct vop_abortop_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_dvp;
+	struct componentname *a_cnp;
+};
+extern const struct vnodeop_desc vop_abortop_desc;
+int VOP_ABORTOP(struct vnode *, struct componentname *);
+
+#define VOP_INACTIVE_DESCOFFSET 31
+struct vop_inactive_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	bool *a_recycle;
+};
+extern const struct vnodeop_desc vop_inactive_desc;
+int VOP_INACTIVE(struct vnode *, bool *);
+
+#define VOP_RECLAIM_DESCOFFSET 32
+struct vop_reclaim_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+};
+extern const struct vnodeop_desc vop_reclaim_desc;
+int VOP_RECLAIM(struct vnode *);
+
+#define VOP_LOCK_DESCOFFSET 33
+struct vop_lock_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_flags;
+};
+extern const struct vnodeop_desc vop_lock_desc;
+int VOP_LOCK(struct vnode *, int);
+
+#define VOP_UNLOCK_DESCOFFSET 34
+struct vop_unlock_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+};
+extern const struct vnodeop_desc vop_unlock_desc;
+int VOP_UNLOCK(struct vnode *);
+
+#define VOP_BMAP_DESCOFFSET 35
+struct vop_bmap_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	daddr_t a_bn;
+	struct vnode **a_vpp;
+	daddr_t *a_bnp;
+	int *a_runp;
+};
+extern const struct vnodeop_desc vop_bmap_desc;
+int VOP_BMAP(struct vnode *, daddr_t, struct vnode **, daddr_t *, int *);
+
+#define VOP_STRATEGY_DESCOFFSET 36
+struct vop_strategy_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	struct buf *a_bp;
+};
+extern const struct vnodeop_desc vop_strategy_desc;
+int VOP_STRATEGY(struct vnode *, struct buf *);
+
+#define VOP_PRINT_DESCOFFSET 37
+struct vop_print_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+};
+extern const struct vnodeop_desc vop_print_desc;
+int VOP_PRINT(struct vnode *);
+
+#define VOP_ISLOCKED_DESCOFFSET 38
+struct vop_islocked_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+};
+extern const struct vnodeop_desc vop_islocked_desc;
+int VOP_ISLOCKED(struct vnode *);
+
+#define VOP_PATHCONF_DESCOFFSET 39
+struct vop_pathconf_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_name;
+	register_t *a_retval;
+};
+extern const struct vnodeop_desc vop_pathconf_desc;
+int VOP_PATHCONF(struct vnode *, int, register_t *);
+
+#define VOP_ADVLOCK_DESCOFFSET 40
+struct vop_advlock_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	void *a_id;
+	int a_op;
+	struct flock *a_fl;
+	int a_flags;
+};
+extern const struct vnodeop_desc vop_advlock_desc;
+int VOP_ADVLOCK(struct vnode *, void *, int, struct flock *, int);
+
+#define VOP_WHITEOUT_DESCOFFSET 41
+struct vop_whiteout_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_dvp;
+	struct componentname *a_cnp;
+	int a_flags;
+};
+extern const struct vnodeop_desc vop_whiteout_desc;
+int VOP_WHITEOUT(struct vnode *, struct componentname *, int);
+
+#define VOP_GETPAGES_DESCOFFSET 42
+struct vop_getpages_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	voff_t a_offset;
+	struct vm_page **a_m;
+	int *a_count;
+	int a_centeridx;
+	vm_prot_t a_access_type;
+	int a_advice;
+	int a_flags;
+};
+extern const struct vnodeop_desc vop_getpages_desc;
+int VOP_GETPAGES(struct vnode *, voff_t, struct vm_page **, int *, int, 
+    vm_prot_t, int, int);
+
+#define VOP_PUTPAGES_DESCOFFSET 43
+struct vop_putpages_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	voff_t a_offlo;
+	voff_t a_offhi;
+	int a_flags;
+};
+extern const struct vnodeop_desc vop_putpages_desc;
+int VOP_PUTPAGES(struct vnode *, voff_t, voff_t, int);
+
+#define VOP_CLOSEEXTATTR_DESCOFFSET 44
+struct vop_closeextattr_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_commit;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_closeextattr_desc;
+int VOP_CLOSEEXTATTR(struct vnode *, int, kauth_cred_t);
+
+#define VOP_GETEXTATTR_DESCOFFSET 45
+struct vop_getextattr_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_attrnamespace;
+	const char *a_name;
+	struct uio *a_uio;
+	size_t *a_size;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_getextattr_desc;
+int VOP_GETEXTATTR(struct vnode *, int, const char *, struct uio *, 
+    size_t *, kauth_cred_t);
+
+#define VOP_LISTEXTATTR_DESCOFFSET 46
+struct vop_listextattr_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_attrnamespace;
+	struct uio *a_uio;
+	size_t *a_size;
+	int a_flag;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_listextattr_desc;
+int VOP_LISTEXTATTR(struct vnode *, int, struct uio *, size_t *, int, 
+    kauth_cred_t);
+
+#define VOP_OPENEXTATTR_DESCOFFSET 47
+struct vop_openextattr_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_openextattr_desc;
+int VOP_OPENEXTATTR(struct vnode *, kauth_cred_t);
+
+#define VOP_DELETEEXTATTR_DESCOFFSET 48
+struct vop_deleteextattr_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_attrnamespace;
+	const char *a_name;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_deleteextattr_desc;
+int VOP_DELETEEXTATTR(struct vnode *, int, const char *, kauth_cred_t);
+
+#define VOP_SETEXTATTR_DESCOFFSET 49
+struct vop_setextattr_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	int a_attrnamespace;
+	const char *a_name;
+	struct uio *a_uio;
+	kauth_cred_t a_cred;
+};
+extern const struct vnodeop_desc vop_setextattr_desc;
+int VOP_SETEXTATTR(struct vnode *, int, const char *, struct uio *, 
+    kauth_cred_t);
+
+#define VNODE_OPS_COUNT	50
+
+#endif /* !_SYS_VNODE_IF_H_ */

Property changes on: lab4/.minix-src/include/sys/vnode_if.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sys/wdog.h
===================================================================
--- lab4/.minix-src/include/sys/wdog.h	(nonexistent)
+++ lab4/.minix-src/include/sys/wdog.h	(revision 13)
@@ -0,0 +1,109 @@
+/*	$NetBSD: wdog.h,v 1.3 2005/12/11 12:25:21 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2000 Zembu Labs, Inc.
+ * All rights reserved.
+ *
+ * Author: Jason R. Thorpe <thorpej@zembu.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by Zembu Labs, Inc.
+ * 4. Neither the name of Zembu Labs nor the names of its employees may
+ *    be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ZEMBU LABS, INC. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR-
+ * RANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS-
+ * CLAIMED.  IN NO EVENT SHALL ZEMBU LABS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_WDOG_H_
+#define	_SYS_WDOG_H_
+
+#include <sys/ioccom.h>
+
+/*
+ * Definitions for manipulating watchdog timers.
+ */
+
+/* This must match struct device's "dv_xname" size. */
+#define	WDOG_NAMESIZE	16
+
+struct wdog_mode {
+	char wm_name[WDOG_NAMESIZE];
+	int wm_mode;		/* timer mode */
+	u_int wm_period;	/* timer period (seconds) */
+};
+
+/*
+ * GMODE -- get mode of watchdog specified by wm_name.
+ *
+ * SMODE -- set mode of watchdog specified by wm_mame.  If
+ *          wm_mode is not DISARMED, the watchdog is armed,
+ *          if another watchdog is not already running.
+ */
+#define	WDOGIOC_GMODE		_IOWR('w', 0, struct wdog_mode)
+#define	WDOGIOC_SMODE		 _IOW('w', 1, struct wdog_mode)
+
+/*
+ * WHICH -- returns the mode information of the currently armed
+ *          watchdog timer.
+ */
+#define	WDOGIOC_WHICH		 _IOR('w', 2, struct wdog_mode)
+
+/*
+ * TICKLE -- tickle the currently armed watchdog timer if the
+ *           mode of that timer is UTICKLE.
+ */
+#define	WDOGIOC_TICKLE		  _IO('w', 3)
+
+/*
+ * GTICKLER -- get the PID of the last process to tickle the timer.
+ */
+#define	WDOGIOC_GTICKLER	 _IOR('w', 4, pid_t)
+
+/*
+ * GWDOGS -- fill in the character array with the names of all of
+ *           the watchdog timers present on the system.  The names
+ *           will be padded out to WDOG_NAMESIZE.  Thus, the argument
+ *           should be (count * WDOG_NAMESIZE) bytes long.
+ */
+struct wdog_conf {
+	char *wc_names;
+	int wc_count;
+};
+#define	WDOGIOC_GWDOGS		_IOWR('w', 5, struct wdog_conf)
+
+#define	WDOG_MODE_DISARMED	0	/* watchdog is disarmed */
+#define	WDOG_MODE_KTICKLE	1	/* kernel tickles watchdog */
+#define	WDOG_MODE_UTICKLE	2	/* user tickles watchdog */
+#define	WDOG_MODE_ETICKLE	3	/* external program tickles watchdog */
+
+#define	WDOG_MODE_MASK		0x03
+
+#define	WDOG_FEATURE_ALARM	0x10	/* enable audible alarm on expire */
+
+#define	WDOG_FEATURE_MASK	0x10
+
+#define	WDOG_PERIOD_DEFAULT	((u_int)-1)
+
+/* Period is expressed in seconds. */
+#define	WDOG_PERIOD_TO_TICKS(period)	((period) * hz)
+
+#endif /* _SYS_WDOG_H_ */

Property changes on: lab4/.minix-src/include/sys/wdog.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ext2fs/ext2fs_dir.h
===================================================================
--- lab4/.minix-src/include/ufs/ext2fs/ext2fs_dir.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ext2fs/ext2fs_dir.h	(revision 13)
@@ -0,0 +1,182 @@
+/*	$NetBSD: ext2fs_dir.h,v 1.19 2012/05/09 00:21:18 riastradh Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dir.h	8.4 (Berkeley) 8/10/94
+ * Modified for ext2fs by Manuel Bouyer.
+ */
+
+/*
+ * Copyright (c) 1997 Manuel Bouyer.
+ *
+ * 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.
+ *
+ *	@(#)dir.h	8.4 (Berkeley) 8/10/94
+ * Modified for ext2fs by Manuel Bouyer.
+ */
+
+#ifndef _UFS_EXT2FS_EXT2FS_DIR_H_
+#define	_UFS_EXT2FS_EXT2FS_DIR_H_
+
+#include <ufs/ext2fs/ext2fs_dinode.h>
+
+/*
+ * Theoretically, directories can be more than 2Gb in length, however, in
+ * practice this seems unlikely. So, we define the type doff_t as a 32-bit
+ * quantity to keep down the cost of doing lookup on a 32-bit machine.
+ */
+#define	doff_t			int32_t
+#define	EXT2FS_MAXDIRSIZE	INT32_MAX
+
+/*
+ * A directory consists of some number of blocks of e2fs_bsize bytes.
+ *
+ * Each block contains some number of directory entry
+ * structures, which are of variable length.  Each directory entry has
+ * a struct direct at the front of it, containing its inode number,
+ * the length of the entry, and the length of the name contained in
+ * the entry.  These are followed by the name padded to a 4 byte boundary
+ * with null bytes.  All names are guaranteed null terminated.
+ * The maximum length of a name in a directory is EXT2FS_MAXNAMLEN.
+ *
+ * The macro EXT2FS_DIRSIZ(fmt, dp) gives the amount of space required to
+ * represent a directory entry.  Free space in a directory is represented by
+ * entries which have dp->e2d_reclen > DIRSIZ(fmt, dp).  All d2fs_bsize bytes
+ * in a directory block are claimed by the directory entries.  This
+ * usually results in the last entry in a directory having a large
+ * dp->e2d_reclen.  When entries are deleted from a directory, the
+ * space is returned to the previous entry in the same directory
+ * block by increasing its dp->e2d_reclen.  If the first entry of
+ * a directory block is free, then its dp->e2d_ino is set to 0.
+ * Entries other than the first in a directory do not normally have
+ * dp->e2d_ino set to 0.
+ * Ext2 rev 0 has a 16 bits e2d_namlen. For Ext2 vev 1 this has been split
+ * into a 8 bits e2d_namlen and 8 bits e2d_type (looks like ffs, isnt't it ? :)
+ * It's safe to use this for rev 0 as well because all ext2 are little-endian.
+ */
+
+#define	EXT2FS_MAXNAMLEN	255
+
+struct	ext2fs_direct {
+	uint32_t e2d_ino;		/* inode number of entry */
+	uint16_t e2d_reclen;		/* length of this record */
+	uint8_t e2d_namlen;		/* length of string in d_name */
+	uint8_t e2d_type;		/* file type */
+	char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */
+};
+
+/* Ext2 directory file types (not the same as FFS. Sigh.) */
+#define EXT2_FT_UNKNOWN         0
+#define EXT2_FT_REG_FILE        1
+#define EXT2_FT_DIR             2
+#define EXT2_FT_CHRDEV          3
+#define EXT2_FT_BLKDEV          4
+#define EXT2_FT_FIFO            5
+#define EXT2_FT_SOCK            6
+#define EXT2_FT_SYMLINK         7
+
+#define EXT2_FT_MAX             8
+
+#define E2IFTODT(mode)    (((mode) & 0170000) >> 12)
+
+static __inline uint8_t inot2ext2dt(uint16_t) __unused;
+static __inline uint8_t
+inot2ext2dt(uint16_t type)
+{
+
+	switch (type) {
+	case E2IFTODT(EXT2_IFIFO):
+		return EXT2_FT_FIFO;
+	case E2IFTODT(EXT2_IFCHR):
+		return EXT2_FT_CHRDEV;
+	case E2IFTODT(EXT2_IFDIR):
+		return EXT2_FT_DIR;
+	case E2IFTODT(EXT2_IFBLK):
+		return EXT2_FT_BLKDEV;
+	case E2IFTODT(EXT2_IFREG):
+		return EXT2_FT_REG_FILE;
+	case E2IFTODT(EXT2_IFLNK):
+		return EXT2_FT_SYMLINK;
+	case E2IFTODT(EXT2_IFSOCK):
+		return EXT2_FT_SOCK;
+	default:
+		return 0;
+	}
+}
+
+/*
+ * The EXT2FS_DIRSIZ macro gives the minimum record length which will hold
+ * the directory entryfor a name len "len" (without the terminating null byte).
+ * This requires the amount of space in struct direct
+ * without the d_name field, plus enough space for the name without a
+ * terminating null byte, rounded up to a 4 byte boundary.
+ */
+#define EXT2FS_DIRSIZ(len)	roundup2(8 + len, 4)
+
+/*
+ * Template for manipulating directories.  Should use struct direct's,
+ * but the name field is EXT2FS_MAXNAMLEN - 1, and this just won't do.
+ */
+struct ext2fs_dirtemplate {
+	uint32_t	dot_ino;
+	int16_t		dot_reclen;
+	uint8_t		dot_namlen;
+	uint8_t		dot_type;
+	char		dot_name[4];	/* must be multiple of 4 */
+	uint32_t	dotdot_ino;
+	int16_t		dotdot_reclen;
+	uint8_t		dotdot_namlen;
+	uint8_t		dotdot_type;
+	char		dotdot_name[4];	/* ditto */
+};
+
+#endif /* !_UFS_EXT2FS_EXT2FS_DIR_H_ */

Property changes on: lab4/.minix-src/include/ufs/ext2fs/ext2fs_dir.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/ufs_wapbl.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/ufs_wapbl.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/ufs_wapbl.h	(revision 13)
@@ -0,0 +1,178 @@
+/*	$NetBSD: ufs_wapbl.h,v 1.8 2013/11/10 18:28:08 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Wasabi Systems, Inc.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef _UFS_UFS_UFS_WAPBL_H_
+#define	_UFS_UFS_UFS_WAPBL_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_wapbl.h"
+#endif
+
+/*
+ * Information for the journal location stored in the superblock.
+ * We store the journal version, some flags, the journal location
+ * type, and some location specific "locators" that identify where
+ * the log itself is located.
+ */
+
+/* fs->fs_journal_version */
+#define	UFS_WAPBL_VERSION			1
+
+/* fs->fs_journal_location */
+#define	UFS_WAPBL_JOURNALLOC_NONE		0
+
+#define	UFS_WAPBL_JOURNALLOC_END_PARTITION	1
+#define	 UFS_WAPBL_EPART_ADDR			  0 /* locator slots */
+#define	 UFS_WAPBL_EPART_COUNT			  1
+#define	 UFS_WAPBL_EPART_BLKSZ			  2
+#define	 UFS_WAPBL_EPART_UNUSED			  3
+
+#define	UFS_WAPBL_JOURNALLOC_IN_FILESYSTEM	2
+#define	 UFS_WAPBL_INFS_ADDR			  0 /* locator slots */
+#define	 UFS_WAPBL_INFS_COUNT			  1
+#define	 UFS_WAPBL_INFS_BLKSZ			  2
+#define	 UFS_WAPBL_INFS_INO			  3
+
+/* fs->fs_journal_flags */
+#define	UFS_WAPBL_FLAGS_CREATE_LOG		0x1
+#define	UFS_WAPBL_FLAGS_CLEAR_LOG		0x2
+
+
+/*
+ * The journal size is limited to between 1MB and 64MB.
+ * The default journal size is the filesystem size divided by
+ * the scale factor - this is 1M of journal per 1GB of filesystem
+ * space.
+ *
+ * XXX: Is 64MB too limiting?  If user explicitly asks for more, allow it?
+ */
+#define	UFS_WAPBL_JOURNAL_SCALE			1024
+#define	UFS_WAPBL_MIN_JOURNAL_SIZE		(1024 * 1024)
+#define	UFS_WAPBL_MAX_JOURNAL_SIZE		(64 * 1024 * 1024)
+
+
+#if defined(WAPBL)
+
+#if defined(WAPBL_DEBUG)
+#define	WAPBL_DEBUG_INODES
+#endif
+
+#ifdef WAPBL_DEBUG_INODES
+#error Undefine WAPBL_DEBUG_INODES or update the code.  Have a nice day.
+#endif
+
+#ifdef WAPBL_DEBUG_INODES
+void	ufs_wapbl_verify_inodes(struct mount *, const char *);
+#endif
+
+static __inline int
+ufs_wapbl_begin2(struct mount *mp, struct vnode *vp1, struct vnode *vp2,
+		 const char *file, int line)
+{
+	if (mp->mnt_wapbl) {
+		int error;
+
+		if (vp1)
+			vref(vp1);
+		if (vp2)
+			vref(vp2);
+		error = wapbl_begin(mp->mnt_wapbl, file, line);
+		if (error)
+			return error;
+#ifdef WAPBL_DEBUG_INODES
+		if (mp->mnt_wapbl->wl_lock.lk_exclusivecount == 1)
+			ufs_wapbl_verify_inodes(mp, "wapbl_begin");
+#endif
+	}
+	return 0;
+}
+
+static __inline void
+ufs_wapbl_end2(struct mount *mp, struct vnode *vp1, struct vnode *vp2)
+{
+	if (mp->mnt_wapbl) {
+#ifdef WAPBL_DEBUG_INODES
+		if (mp->mnt_wapbl->wl_lock.lk_exclusivecount == 1)
+			ufs_wapbl_verify_inodes(mp, "wapbl_end");
+#endif
+		wapbl_end(mp->mnt_wapbl);
+		if (vp2)
+			vrele(vp2);
+		if (vp1)
+			vrele(vp1);
+	}
+}
+
+#define	UFS_WAPBL_BEGIN(mp)						\
+	ufs_wapbl_begin2(mp, NULL, NULL, __FUNCTION__, __LINE__)
+#define	UFS_WAPBL_BEGIN1(mp, v1)					\
+	ufs_wapbl_begin2(mp, v1, NULL, __FUNCTION__, __LINE__)
+#define	UFS_WAPBL_END(mp)	ufs_wapbl_end2(mp, NULL, NULL)
+#define	UFS_WAPBL_END1(mp, v1)	ufs_wapbl_end2(mp, v1, NULL)
+
+#define	UFS_WAPBL_UPDATE(vp, access, modify, flags)			\
+	if ((vp)->v_mount->mnt_wapbl) {					\
+		UFS_UPDATE(vp, access, modify, flags);			\
+	}
+
+#ifdef UFS_WAPBL_DEBUG_JLOCK
+#define	UFS_WAPBL_JLOCK_ASSERT(mp)					\
+	if (mp->mnt_wapbl) wapbl_jlock_assert(mp->mnt_wapbl)
+#define	UFS_WAPBL_JUNLOCK_ASSERT(mp)					\
+	if (mp->mnt_wapbl) wapbl_junlock_assert(mp->mnt_wapbl)
+#else
+#define	UFS_WAPBL_JLOCK_ASSERT(mp)
+#define	UFS_WAPBL_JUNLOCK_ASSERT(mp)
+#endif
+
+#define	UFS_WAPBL_REGISTER_INODE(mp, ino, mode)				\
+	if (mp->mnt_wapbl) wapbl_register_inode(mp->mnt_wapbl, ino, mode)
+#define	UFS_WAPBL_UNREGISTER_INODE(mp, ino, mode)			\
+	if (mp->mnt_wapbl) wapbl_unregister_inode(mp->mnt_wapbl, ino, mode)
+
+#define	UFS_WAPBL_REGISTER_DEALLOCATION(mp, blk, len)			\
+	if (mp->mnt_wapbl) wapbl_register_deallocation(mp->mnt_wapbl, blk, len)
+
+#else /* ! WAPBL */
+#define	UFS_WAPBL_BEGIN(mp) (__USE(mp), 0)
+#define	UFS_WAPBL_BEGIN1(mp, v1) 0
+#define	UFS_WAPBL_END(mp)	do { } while (0)
+#define	UFS_WAPBL_END1(mp, v1)
+#define	UFS_WAPBL_UPDATE(vp, access, modify, flags)	do { } while (0)
+#define	UFS_WAPBL_JLOCK_ASSERT(mp)
+#define	UFS_WAPBL_JUNLOCK_ASSERT(mp)
+#define	UFS_WAPBL_REGISTER_INODE(mp, ino, mode)		do { } while (0)
+#define	UFS_WAPBL_UNREGISTER_INODE(mp, ino, mode)	do { } while (0)
+#define	UFS_WAPBL_REGISTER_DEALLOCATION(mp, blk, len)
+#endif
+
+#endif /* !_UFS_UFS_UFS_WAPBL_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/ufs_wapbl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_anon.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_anon.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_anon.h	(revision 13)
@@ -0,0 +1,116 @@
+/*	$NetBSD: uvm_anon.h,v 1.30 2011/08/06 17:25:03 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ */
+
+#ifndef _UVM_UVM_ANON_H_
+#define _UVM_UVM_ANON_H_
+
+/*
+ * uvm_anon.h
+ */
+
+#if defined(_KERNEL_OPT)
+#include "opt_vmswap.h"
+#endif
+
+/*
+ * anonymous memory management
+ *
+ * anonymous virtual memory is short term virtual memory that goes away
+ * when the processes referencing it go away.    an anonymous page of
+ * virtual memory is described by the following data structure:
+ */
+
+struct vm_anon {
+	kmutex_t		*an_lock;	/* Lock for an_ref */
+	union {
+		uintptr_t	au_ref;		/* Reference count [an_lock] */
+		struct vm_anon	*au_link;	/* Link for deferred free */
+	} an_u;
+#define	an_ref	an_u.au_ref
+#define	an_link	an_u.au_link
+	struct vm_page		*an_page;	/* If in RAM [an_lock] */
+#if defined(VMSWAP) || 1 /* XXX libkvm */
+	/*
+	 * Drum swap slot # (if != 0) [an_lock.  also, it is ok to read
+	 * an_swslot if we hold an_page PG_BUSY].
+	 */
+	int			an_swslot;
+#endif
+};
+
+/*
+ * for active vm_anon's the data can be in one of the following state:
+ * [1] in a vm_page with no backing store allocated yet, [2] in a vm_page
+ * with backing store allocated, or [3] paged out to backing store
+ * (no vm_page).
+ *
+ * for pageout in case [2]: if the page has been modified then we must
+ * flush it out to backing store, otherwise we can just dump the
+ * vm_page.
+ */
+
+/*
+ * anons are grouped together in anonymous memory maps, or amaps.
+ * amaps are defined in uvm_amap.h.
+ */
+
+/*
+ * processes reference anonymous virtual memory maps with an anonymous
+ * reference structure:
+ */
+
+struct vm_aref {
+	int ar_pageoff;			/* page offset into amap we start */
+	struct vm_amap *ar_amap;	/* pointer to amap */
+};
+
+/*
+ * the offset field indicates which part of the amap we are referencing.
+ * locked by vm_map lock.
+ */
+
+#ifdef _KERNEL
+
+/*
+ * prototypes
+ */
+
+struct vm_anon *uvm_analloc(void);
+void uvm_anon_free(struct vm_anon *);
+void uvm_anon_freelst(struct vm_amap *, struct vm_anon *);
+void uvm_anon_init(void);
+struct vm_page *uvm_anon_lockloanpg(struct vm_anon *);
+#if defined(VMSWAP)
+void uvm_anon_dropswap(struct vm_anon *);
+#else /* defined(VMSWAP) */
+#define	uvm_anon_dropswap(a)	/* nothing */
+#endif /* defined(VMSWAP) */
+void uvm_anon_release(struct vm_anon *);
+bool uvm_anon_pagein(struct vm_amap *, struct vm_anon *);
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_ANON_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_anon.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_fault.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_fault.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_fault.h	(revision 13)
@@ -0,0 +1,68 @@
+/*	$NetBSD: uvm_fault.h,v 1.20 2011/02/02 15:13:34 chuck Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ *
+ * from: Id: uvm_fault.h,v 1.1.2.2 1997/12/08 16:07:12 chuck Exp
+ */
+
+#ifndef _UVM_UVM_FAULT_H_
+#define _UVM_UVM_FAULT_H_
+
+/*
+ * fault data structures
+ */
+
+/*
+ * uvm_faultinfo: to load one of these fill in all orig_* fields and
+ * then call uvmfault_lookup on it.
+ */
+
+
+struct uvm_faultinfo {
+	struct vm_map *orig_map;		/* IN: original map */
+	vaddr_t orig_rvaddr;		/* IN: original rounded VA */
+	vsize_t orig_size;		/* IN: original size of interest */
+	struct vm_map *map;			/* map (could be a submap) */
+	unsigned int mapv;		/* map's version number */
+	struct vm_map_entry *entry;		/* map entry (from 'map') */
+	vsize_t size;			/* size of interest */
+};
+
+#ifdef _KERNEL
+
+/*
+ * fault prototypes
+ */
+
+int uvmfault_anonget(struct uvm_faultinfo *, struct vm_amap *,
+		     struct vm_anon *);
+
+int uvm_fault_wire(struct vm_map *, vaddr_t, vaddr_t, vm_prot_t, int);
+void uvm_fault_unwire(struct vm_map *, vaddr_t, vaddr_t);
+void uvm_fault_unwire_locked(struct vm_map *, vaddr_t, vaddr_t);
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_FAULT_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_fault.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_loan.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_loan.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_loan.h	(revision 13)
@@ -0,0 +1,56 @@
+/*	$NetBSD: uvm_loan.h,v 1.17 2011/02/02 15:13:34 chuck Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ *
+ * from: Id: uvm_loan.h,v 1.1.4.1 1997/12/08 16:07:14 chuck Exp
+ */
+
+#ifndef _UVM_UVM_LOAN_H_
+#define _UVM_UVM_LOAN_H_
+
+#ifdef _KERNEL
+
+/*
+ * flags for uvm_loan()
+ */
+
+#define UVM_LOAN_TOANON		0x1		/* loan to anon */
+#define UVM_LOAN_TOPAGE		0x2		/* loan to page */
+
+/*
+ * loan prototypes
+ */
+
+void uvm_loan_init(void);
+int uvm_loan(struct vm_map *, vaddr_t, vsize_t, void *, int);
+void uvm_unloan(void *, int, int);
+int uvm_loanuobjpages(struct uvm_object *, voff_t, int,
+    struct vm_page **);
+struct vm_page *uvm_loanbreak(struct vm_page *);
+int uvm_loanbreak_anon(struct vm_anon *, struct uvm_object *);
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_LOAN_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_loan.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_pager.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_pager.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_pager.h	(revision 13)
@@ -0,0 +1,183 @@
+/*	$NetBSD: uvm_pager.h,v 1.43 2012/04/29 22:54:01 chs Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ *
+ * from: Id: uvm_pager.h,v 1.1.2.14 1998/01/13 19:00:50 chuck Exp
+ */
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vm_pager.h	8.5 (Berkeley) 7/7/94
+ */
+
+/*
+ * Copyright (c) 1990 University of Utah.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vm_pager.h	8.5 (Berkeley) 7/7/94
+ */
+
+#ifndef _UVM_UVM_PAGER_H_
+#define _UVM_UVM_PAGER_H_
+
+/*
+ * uvm_pager.h
+ */
+
+/*
+ * forward structure declarations
+ */
+
+struct uvm_faultinfo;
+
+/*
+ * pager ops
+ */
+
+struct uvm_pagerops {
+
+	/* init pager */
+	void	(*pgo_init)(void);
+
+	/* add reference to obj */
+	void	(*pgo_reference)(struct uvm_object *);
+
+	/* drop reference to obj */
+	void	(*pgo_detach)(struct uvm_object *);
+
+	/* special non-standard fault processing */
+	int	(*pgo_fault)(struct uvm_faultinfo *, vaddr_t, struct vm_page **,
+			     int, int, vm_prot_t, int);
+
+	/* get/read pages */
+	int	(*pgo_get)(struct uvm_object *, voff_t, struct vm_page **,
+			   int *, int, vm_prot_t, int, int);
+
+	/* put/write pages */
+	int	(*pgo_put)(struct uvm_object *, voff_t, voff_t, int);
+};
+
+/* pager flags [mostly for flush] */
+
+#define PGO_CLEANIT	0x001	/* write dirty pages to backing store */
+#define PGO_SYNCIO	0x002	/* use sync I/O */
+#define PGO_DEACTIVATE	0x004	/* deactivate flushed pages */
+#define PGO_FREE	0x008	/* free flushed pages */
+/* if PGO_FREE is not set then the pages stay where they are. */
+
+#define PGO_ALLPAGES	0x010	/* flush whole object/get all pages */
+#define PGO_JOURNALLOCKED 0x020	/* journal is already locked [put] */
+#define PGO_LOCKED	0x040	/* fault data structures are locked [get] */
+#define PGO_BUSYFAIL	0x080	/* fail if a page is busy [put] */
+#define PGO_OVERWRITE	0x200	/* pages will be overwritten before unlocked */
+#define PGO_PASTEOF	0x400	/* allow allocation of pages past EOF */
+#define PGO_NOBLOCKALLOC 0x800	/* backing block allocation is not needed */
+#define PGO_NOTIMESTAMP 0x1000	/* don't mark object accessed/modified */
+#define PGO_RECLAIM	0x2000	/* object is being reclaimed */
+#define PGO_GLOCKHELD	0x4000	/* genfs_node's lock is already held */
+#define PGO_LAZY	0x8000	/* equivalent of MNT_LAZY / FSYNC_LAZY */
+
+/* page we are not interested in getting */
+#define PGO_DONTCARE ((struct vm_page *) -1L)	/* [get only] */
+
+#ifdef _KERNEL
+
+/*
+ * prototypes
+ */
+
+void	uvm_pager_init(void);
+void	uvm_pager_realloc_emerg(void);
+struct vm_page *uvm_pageratop(vaddr_t);
+vaddr_t	uvm_pagermapin(struct vm_page **, int, int);
+void	uvm_pagermapout(vaddr_t, int);
+
+extern size_t pager_map_size;
+
+/* Flags to uvm_pagermapin() */
+#define	UVMPAGER_MAPIN_WAITOK	0x01	/* it's okay to wait */
+#define	UVMPAGER_MAPIN_READ	0x02	/* device -> host */
+#define	UVMPAGER_MAPIN_WRITE	0x00	/* host -> device (pseudo flag) */
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_PAGER_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_pager.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_pmap.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_pmap.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_pmap.h	(revision 13)
@@ -0,0 +1,218 @@
+/*	$NetBSD: uvm_pmap.h,v 1.38 2013/02/02 14:06:58 matt Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * The Mach Operating System project at Carnegie-Mellon University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)pmap.h	8.1 (Berkeley) 6/11/93
+ *
+ *
+ * Copyright (c) 1987, 1990 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Avadis Tevanian, Jr.
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ *	Machine address mapping definitions -- machine-independent
+ *	section.  [For machine-dependent section, see "machine/pmap.h".]
+ */
+
+#ifndef	_PMAP_VM_
+#define	_PMAP_VM_
+
+struct lwp;		/* for pmap_activate()/pmap_deactivate() proto */
+
+struct pmap;
+typedef struct pmap *pmap_t;
+
+/*
+ * Each machine dependent implementation is expected to
+ * keep certain statistics.  They may do this anyway they
+ * so choose, but are expected to return the statistics
+ * in the following structure.
+ */
+struct pmap_statistics {
+	long		resident_count;	/* # of pages mapped (total)*/
+	long		wired_count;	/* # of pages wired */
+};
+typedef struct pmap_statistics	*pmap_statistics_t;
+
+#ifdef _KERNEL
+
+extern struct pmap	*const kernel_pmap_ptr;
+#define pmap_kernel()	kernel_pmap_ptr
+
+#endif
+
+/*
+ * Cache Type Encodings
+ */
+#define PMAP_CACHE_MASK		0x00000f00
+
+/* All accesses are uncacheable. No speculative accesses. */
+#define PMAP_NOCACHE		0x00000100	/* [BOTH] */
+
+/* All accesses are uncacheable. No speculative accesses.
+ * Writes are combined. */
+#define PMAP_WRITE_COMBINE	0x00000200	/* [BOTH] */
+
+/* On reads, cachelines become shared or exclusive if allocated on cache miss.
+ * On writes, cachelines become modified on a cache miss.  */
+#define PMAP_WRITE_BACK		0x00000300	/* [BOTH] */
+
+/* = PMAP_NOCACHE but overrideable (e.g. on x86 by MTRRs) */
+#define PMAP_NOCACHE_OVR	0x00000400	/* [BOTH] */
+
+#ifdef _KERNEL
+#include <machine/pmap.h>
+#endif
+
+/*
+ * Flags passed to pmap_enter().  Note the bottom 3 bits are VM_PROT_*
+ * bits, used to indicate the access type that was made (to seed modified
+ * and referenced information).
+ *
+ * Flags marked [PA] are for pmap_kenter_pa() only.  Flags marked [BOTH]
+ * apply to pmap_kenter_pa() and pmap_enter().  All other flags are valid
+ * for pmap_enter() only.
+ */
+#define	PMAP_WIRED	0x00000010	/* wired mapping */
+#define	PMAP_CANFAIL	0x00000020	/* can fail if resource shortage */
+#if defined(PMAP_ENABLE_PMAP_KMPAGE)
+#define	PMAP_KMPAGE	0x00000040	/* [PA] page used for kernel memory */
+#else
+#define	PMAP_KMPAGE	0x00000000
+#endif /* PMAP_ENABLE_PMAP_KMPAGE */
+
+#define	PMAP_MD_MASK	0xff000000	/* [BOTH] Machine-dependent bits */
+#define PMAP_PROT_MASK	0x0000000f	/* [BOTH] VM_PROT_* bit mask */
+
+#ifndef PMAP_EXCLUDE_DECLS	/* Used in Sparc port to virtualize pmap mod */
+#ifdef _KERNEL
+void		pmap_activate(struct lwp *);
+void		pmap_deactivate(struct lwp *);
+void		pmap_unwire(pmap_t, vaddr_t);
+
+#if !defined(pmap_clear_modify)
+bool		pmap_clear_modify(struct vm_page *);
+#endif
+#if !defined(pmap_clear_reference)
+bool		pmap_clear_reference(struct vm_page *);
+#endif
+
+#if !defined(pmap_copy)
+void		pmap_copy(pmap_t, pmap_t, vaddr_t, vsize_t, vaddr_t);
+#endif
+#if !defined(pmap_copy_page)
+void		pmap_copy_page(paddr_t, paddr_t);
+#endif
+struct pmap	*pmap_create(void);
+void		pmap_destroy(pmap_t);
+int		pmap_enter(pmap_t, vaddr_t, paddr_t, vm_prot_t, u_int);
+bool		pmap_extract(pmap_t, vaddr_t, paddr_t *);
+#if defined(PMAP_GROWKERNEL)
+vaddr_t		pmap_growkernel(vaddr_t);
+#endif
+
+void		pmap_init(void);
+
+#if !defined(pmap_kenter_pa)
+void		pmap_kenter_pa(vaddr_t, paddr_t, vm_prot_t, u_int);
+#endif
+void		pmap_kremove(vaddr_t, vsize_t);
+#if !defined(pmap_is_modified)
+bool		pmap_is_modified(struct vm_page *);
+#endif
+#if !defined(pmap_is_referenced)
+bool		pmap_is_referenced(struct vm_page *);
+#endif
+
+void		pmap_page_protect(struct vm_page *, vm_prot_t);
+
+#if !defined(pmap_phys_address)
+paddr_t		pmap_phys_address(paddr_t);
+#endif
+#if !defined(pmap_mmap_flags)
+#define pmap_mmap_flags(x)	0
+#endif
+void		pmap_protect(pmap_t, vaddr_t, vaddr_t, vm_prot_t);
+#if !defined(pmap_reference)
+void		pmap_reference(pmap_t);
+#endif
+#if !defined(pmap_remove)
+void		pmap_remove(pmap_t, vaddr_t, vaddr_t);
+#endif
+void		pmap_remove_all(struct pmap *);
+#if !defined(pmap_update)
+void		pmap_update(pmap_t);
+#endif
+#if !defined(pmap_resident_count)
+long		pmap_resident_count(pmap_t);
+#endif
+#if !defined(pmap_wired_count)
+long		pmap_wired_count(pmap_t);
+#endif
+#if !defined(pmap_zero_page)
+void		pmap_zero_page(paddr_t);
+#endif
+
+void		pmap_virtual_space(vaddr_t *, vaddr_t *);
+#if defined(PMAP_STEAL_MEMORY)
+vaddr_t		pmap_steal_memory(vsize_t, vaddr_t *, vaddr_t *);
+#endif
+
+#if defined(PMAP_FORK)
+void		pmap_fork(pmap_t, pmap_t);
+#endif
+#endif	/* kernel*/
+#endif  /* PMAP_EXCLUDE_DECLS */
+
+#endif /* _PMAP_VM_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_pmap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_page.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_page.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_page.h	(revision 13)
@@ -0,0 +1,402 @@
+/*	$NetBSD: uvm_page.h,v 1.80 2015/03/23 07:59:12 riastradh Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * Copyright (c) 1991, 1993, The Regents of the University of California.
+ *
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * The Mach Operating System project at Carnegie-Mellon University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vm_page.h   7.3 (Berkeley) 4/21/91
+ * from: Id: uvm_page.h,v 1.1.2.6 1998/02/04 02:31:42 chuck Exp
+ *
+ *
+ * Copyright (c) 1987, 1990 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _UVM_UVM_PAGE_H_
+#define _UVM_UVM_PAGE_H_
+
+#include <uvm/uvm_extern.h>
+#include <uvm/uvm_pglist.h>
+
+#include <sys/rbtree.h>
+
+/*
+ * Management of resident (logical) pages.
+ *
+ * Each resident page has a vm_page structure, indexed by page number.
+ * There are several lists in the structure:
+ *
+ * - A red-black tree rooted with the containing object is used to
+ *   quickly perform object+offset lookups.
+ * - A list of all pages for a given object, for a quick deactivation
+ *   at a time of deallocation.
+ * - An ordered list of pages due for pageout.
+ *
+ * In addition, the structure contains the object and offset to which
+ * this page belongs (for pageout) and sundry status bits.
+ *
+ * Note that the page structure has no lock of its own.  The page is
+ * generally protected by its owner's lock (UVM object or amap/anon).
+ * It should be noted that UVM has to serialize pmap(9) operations on
+ * the managed pages, e.g. for pmap_enter() calls.  Hence, the lock
+ * order is as follows:
+ *
+ *	[vmpage-owner-lock] ->
+ *		any pmap locks (e.g. PV hash lock)
+ *
+ * Since the kernel is always self-consistent, no serialization is
+ * required for unmanaged mappings, e.g. for pmap_kenter_pa() calls.
+ *
+ * Field markings and the corresponding locks:
+ *
+ * f:	free page queue lock, uvm_fpageqlock
+ * o:	page owner (uvm_object::vmobjlock, vm_amap::am_lock, vm_anon::an_lock)
+ * p:	page queue lock, uvm_pageqlock
+ * o,p:	o|p for read, o&p for write
+ * w:	wired page queue or uvm_pglistalloc:
+ *	  => wired page queue: o&p to change, stable from wire to unwire
+ *		XXX What about concurrent or nested wire?
+ *	  => uvm_pglistalloc: owned by caller
+ * ?:	locked by pmap or assumed page owner's lock
+ *
+ * UVM and pmap(9) may use uvm_page_locked_p() to assert whether the
+ * page owner's lock is acquired.
+ *
+ * A page can have one of four identities:
+ *
+ * o free
+ *   => pageq.list is entry on global free page queue
+ *   => listq.list is entry on per-CPU free page queue
+ *   => uanon is unused (or (void *)0xdeadbeef for DEBUG)
+ *   => uobject is unused (or (void *)0xdeadbeef for DEBUG)
+ *   => PQ_FREE is set in pqflags
+ * o owned by a uvm_object
+ *   => pageq.queue is entry on wired page queue, if any
+ *   => listq.queue is entry on list of pages in object
+ *   => uanon is NULL or the vm_anon to which it has been O->A loaned
+ *   => uobject is owner
+ * o owned by a vm_anon
+ *   => pageq is unused (XXX correct?)
+ *   => listq is unused (XXX correct?)
+ *   => uanon is owner
+ *   => uobject is NULL
+ *   => PQ_ANON is set in pqflags
+ * o allocated by uvm_pglistalloc
+ *   => pageq.queue is entry on resulting pglist, owned by caller
+ *   => listq is unused (XXX correct?)
+ *   => uanon is unused
+ *   => uobject is unused
+ *
+ * The following transitions are allowed:
+ *
+ * - uvm_pagealloc: free -> owned by a uvm_object/vm_anon
+ * - uvm_pagefree: owned by a uvm_object/vm_anon -> free
+ * - uvm_pglistalloc: free -> allocated by uvm_pglistalloc
+ * - uvm_pglistfree: allocated by uvm_pglistalloc -> free
+ */
+
+struct vm_page {
+	struct rb_node		rb_node;	/* o: tree of pages in obj */
+
+	union {
+		TAILQ_ENTRY(vm_page) queue;	/* w: wired page queue
+						 * or uvm_pglistalloc output */
+		LIST_ENTRY(vm_page) list;	/* f: global free page queue */
+	} pageq;
+
+	union {
+		TAILQ_ENTRY(vm_page) queue;	/* o: pages in same object */
+		LIST_ENTRY(vm_page) list;	/* f: CPU free page queue */
+	} listq;
+
+	struct vm_anon		*uanon;		/* o,p: anon */
+	struct uvm_object	*uobject;	/* o,p: object */
+	voff_t			offset;		/* o,p: offset into object */
+	uint16_t		flags;		/* o: object flags */
+	uint16_t		loan_count;	/* o,p: num. active loans */
+	uint16_t		wire_count;	/* p: wired down map refs */
+	uint16_t		pqflags;	/* p: page queue flags */
+	paddr_t			phys_addr;	/* physical address of page */
+
+#ifdef __HAVE_VM_PAGE_MD
+	struct vm_page_md	mdpage;		/* ?: pmap-specific data */
+#endif
+
+#if defined(UVM_PAGE_TRKOWN)
+	/* debugging fields to track page ownership */
+	pid_t			owner;		/* proc that set PG_BUSY */
+	lwpid_t			lowner;		/* lwp that set PG_BUSY */
+	const char		*owner_tag;	/* why it was set busy */
+#endif
+};
+
+/*
+ * Overview of UVM page flags.
+ *
+ * Locking notes:
+ *
+ * PG_, struct vm_page::flags	=> locked by owner
+ * PQ_, struct vm_page::pqflags	=> locked by uvm_pageqlock
+ * PQ_FREE			=> additionally locked by uvm_fpageqlock
+ *
+ * Flag descriptions:
+ *
+ * PG_BUSY:
+ *	Page is long-term locked, usually because of I/O (transfer from the
+ *	page memory to the backing store) is in progress.  LWP attempting
+ *	to access the page shall set PG_WANTED and wait.
+ *
+ * PG_WANTED:
+ *	Indicates that the page, which is currently PG_BUSY, is wanted by
+ *	some other LWP.  The page owner (i.e. LWP which set PG_BUSY) is
+ *	responsible to clear both flags and wake up any waiters once it has
+ *	released the long-term lock (PG_BUSY).
+ *
+ * PG_RELEASED:
+ *	Indicates that the page, which is currently PG_BUSY, should be freed
+ *	after the release of long-term lock.  It is responsibility of the
+ *	owning LWP (i.e. which set PG_BUSY) to do it.
+ *
+ * PG_CLEAN:
+ *	Page has not been modified since it was loaded from the backing
+ *	store.  If this flag is not set, page is considered "dirty".
+ *	XXX: Currently it means that the page *might* be clean; will be
+ *	fixed with yamt-pagecache merge.
+ *
+ * PG_FAKE:
+ *	Page has been allocated, but not yet initialised.  The flag is used
+ *	to avoid overwriting of valid data, e.g. to prevent read from the
+ *	backing store when in-core data is newer.
+ *
+ * PG_TABLED:
+ *	Indicates that the page is currently in the object's offset queue,
+ *	and that it should be removed from it once the page is freed.  Used
+ *	diagnostic purposes.
+ *
+ * PG_PAGEOUT:
+ *	Indicates that the page is being paged-out in preparation for
+ *	being freed.
+ *
+ * PG_RDONLY:
+ *	Indicates that the page must be mapped read-only.
+ *
+ * PG_ZERO:
+ *	Indicates that the page has been pre-zeroed.  This flag is only
+ *	set when the page is not in the queues and is cleared when the
+ *	page is placed on the free list.
+ *
+ * PG_MARKER:
+ *	Dummy marker page.
+ */
+
+#define	PG_BUSY		0x0001
+#define	PG_WANTED	0x0002
+#define	PG_TABLED	0x0004
+#define	PG_CLEAN	0x0008
+#define	PG_PAGEOUT	0x0010
+#define	PG_RELEASED	0x0020
+#define	PG_FAKE		0x0040
+#define	PG_RDONLY	0x0080
+#define	PG_ZERO		0x0100
+#define	PG_MARKER	0x0200
+
+#define PG_PAGER1	0x1000		/* pager-specific flag */
+
+#define	UVM_PGFLAGBITS \
+	"\20\1BUSY\2WANTED\3TABLED\4CLEAN\5PAGEOUT\6RELEASED\7FAKE\10RDONLY" \
+	"\11ZERO\12MARKER\15PAGER1"
+
+#define PQ_FREE		0x0001		/* page is on free list */
+#define PQ_ANON		0x0002		/* page is part of an anon, rather
+					   than an uvm_object */
+#define PQ_AOBJ		0x0004		/* page is part of an anonymous
+					   uvm_object */
+#define PQ_SWAPBACKED	(PQ_ANON|PQ_AOBJ)
+#define PQ_READAHEAD	0x0008	/* read-ahead but has not been "hit" yet */
+
+#define PQ_PRIVATE1	0x0100
+#define PQ_PRIVATE2	0x0200
+#define PQ_PRIVATE3	0x0400
+#define PQ_PRIVATE4	0x0800
+#define PQ_PRIVATE5	0x1000
+#define PQ_PRIVATE6	0x2000
+#define PQ_PRIVATE7	0x4000
+#define PQ_PRIVATE8	0x8000
+
+#define	UVM_PQFLAGBITS \
+	"\20\1FREE\2ANON\3AOBJ\4READAHEAD" \
+	"\11PRIVATE1\12PRIVATE2\13PRIVATE3\14PRIVATE4" \
+	"\15PRIVATE5\16PRIVATE6\17PRIVATE7\20PRIVATE8"
+
+/*
+ * physical memory layout structure
+ *
+ * MD vmparam.h must #define:
+ *   VM_PHYSEG_MAX = max number of physical memory segments we support
+ *		   (if this is "1" then we revert to a "contig" case)
+ *   VM_PHYSSEG_STRAT: memory sort/search options (for VM_PHYSEG_MAX > 1)
+ * 	- VM_PSTRAT_RANDOM:   linear search (random order)
+ *	- VM_PSTRAT_BSEARCH:  binary search (sorted by address)
+ *	- VM_PSTRAT_BIGFIRST: linear search (sorted by largest segment first)
+ *      - others?
+ *   XXXCDC: eventually we should purge all left-over global variables...
+ */
+#define VM_PSTRAT_RANDOM	1
+#define VM_PSTRAT_BSEARCH	2
+#define VM_PSTRAT_BIGFIRST	3
+
+/*
+ * vm_physseg: describes one segment of physical memory
+ */
+struct vm_physseg {
+	paddr_t	start;			/* PF# of first page in segment */
+	paddr_t	end;			/* (PF# of last page in segment) + 1 */
+	paddr_t	avail_start;		/* PF# of first free page in segment */
+	paddr_t	avail_end;		/* (PF# of last free page in segment) +1  */
+	struct	vm_page *pgs;		/* vm_page structures (from start) */
+	struct	vm_page *lastpg;	/* vm_page structure for end */
+	int	free_list;		/* which free list they belong on */
+	u_int	start_hint;		/* start looking for free pages here */
+					/* protected by uvm_fpageqlock */
+#ifdef __HAVE_PMAP_PHYSSEG
+	struct	pmap_physseg pmseg;	/* pmap specific (MD) data */
+#endif
+};
+
+#ifdef _KERNEL
+
+/*
+ * globals
+ */
+
+extern bool vm_page_zero_enable;
+
+/*
+ * physical memory config is stored in vm_physmem.
+ */
+
+#define	VM_PHYSMEM_PTR(i)	(&vm_physmem[i])
+#if VM_PHYSSEG_MAX == 1
+#define VM_PHYSMEM_PTR_SWAP(i, j) /* impossible */
+#else
+#define VM_PHYSMEM_PTR_SWAP(i, j) \
+	do { vm_physmem[(i)] = vm_physmem[(j)]; } while (0)
+#endif
+
+extern struct vm_physseg vm_physmem[VM_PHYSSEG_MAX];
+extern int vm_nphysseg;
+
+/*
+ * prototypes: the following prototypes define the interface to pages
+ */
+
+void uvm_page_init(vaddr_t *, vaddr_t *);
+#if defined(UVM_PAGE_TRKOWN)
+void uvm_page_own(struct vm_page *, const char *);
+#endif
+#if !defined(PMAP_STEAL_MEMORY)
+bool uvm_page_physget(paddr_t *);
+#endif
+void uvm_page_recolor(int);
+void uvm_pageidlezero(void);
+
+void uvm_pageactivate(struct vm_page *);
+vaddr_t uvm_pageboot_alloc(vsize_t);
+void uvm_pagecopy(struct vm_page *, struct vm_page *);
+void uvm_pagedeactivate(struct vm_page *);
+void uvm_pagedequeue(struct vm_page *);
+void uvm_pageenqueue(struct vm_page *);
+void uvm_pagefree(struct vm_page *);
+void uvm_page_unbusy(struct vm_page **, int);
+struct vm_page *uvm_pagelookup(struct uvm_object *, voff_t);
+void uvm_pageunwire(struct vm_page *);
+void uvm_pagewire(struct vm_page *);
+void uvm_pagezero(struct vm_page *);
+bool uvm_pageismanaged(paddr_t);
+bool uvm_page_locked_p(struct vm_page *);
+
+int uvm_page_lookup_freelist(struct vm_page *);
+
+int vm_physseg_find(paddr_t, int *);
+struct vm_page *uvm_phys_to_vm_page(paddr_t);
+paddr_t uvm_vm_page_to_phys(const struct vm_page *);
+
+/*
+ * macros
+ */
+
+#define UVM_PAGE_TREE_PENALTY	4	/* XXX: a guess */
+
+#define VM_PAGE_TO_PHYS(entry)	uvm_vm_page_to_phys(entry)
+
+#ifdef __HAVE_VM_PAGE_MD
+#define	VM_PAGE_TO_MD(pg)	(&(pg)->mdpage)
+#endif
+
+/*
+ * Compute the page color bucket for a given page.
+ */
+#define	VM_PGCOLOR_BUCKET(pg) \
+	(atop(VM_PAGE_TO_PHYS((pg))) & uvmexp.colormask)
+
+#define	PHYS_TO_VM_PAGE(pa)	uvm_phys_to_vm_page(pa)
+
+#define VM_PAGE_IS_FREE(entry)  ((entry)->pqflags & PQ_FREE)
+#define	VM_FREE_PAGE_TO_CPU(pg)	((struct uvm_cpu *)((uintptr_t)pg->offset))
+
+#ifdef DEBUG
+void uvm_pagezerocheck(struct vm_page *);
+#endif /* DEBUG */
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_PAGE_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_page.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_pglist.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_pglist.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_pglist.h	(revision 13)
@@ -0,0 +1,59 @@
+/*	$NetBSD: uvm_pglist.h,v 1.8 2010/11/06 15:48:00 uebayasi Exp $	*/
+
+/*-
+ * Copyright (c) 2000, 2001, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _UVM_UVM_PGLIST_H_
+#define _UVM_UVM_PGLIST_H_
+
+/*
+ * This defines the type of a page queue, e.g. active list, inactive
+ * list, etc.
+ */
+struct vm_page;
+TAILQ_HEAD(pglist, vm_page);
+LIST_HEAD(pgflist, vm_page);
+
+/*
+ * A page free list consists of free pages of unknown contents and free
+ * pages of all zeros.
+ */
+#define	PGFL_UNKNOWN	0
+#define	PGFL_ZEROS	1
+#define	PGFL_NQUEUES	2
+
+struct pgflbucket {
+	struct pgflist pgfl_queues[PGFL_NQUEUES];
+};
+
+struct pgfreelist {
+	struct pgflbucket *pgfl_buckets;
+};
+
+#endif /* _UVM_UVM_PGLIST_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_pglist.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_swap.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_swap.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_swap.h	(revision 13)
@@ -0,0 +1,63 @@
+/*	$NetBSD: uvm_swap.h,v 1.22 2015/07/30 10:25:49 christos Exp $	*/
+
+/*
+ * Copyright (c) 1997 Matthew R. Green
+ * 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.
+ *
+ * from: Id: uvm_swap.h,v 1.1.2.6 1997/12/15 05:39:31 mrg Exp
+ */
+
+#ifndef _UVM_UVM_SWAP_H_
+#define _UVM_UVM_SWAP_H_
+
+#define	SWSLOT_BAD	(-1)
+
+#if defined(_KERNEL) || defined(_MODULE)
+#if defined(_KERNEL_OPT)
+#include "opt_vmswap.h"
+#endif
+
+struct swapent;
+struct lwp;
+
+#if defined(VMSWAP)
+int	uvm_swap_get(struct vm_page *, int, int);
+int	uvm_swap_put(int, struct vm_page **, int, int);
+int	uvm_swap_alloc(int *, bool);
+void	uvm_swap_free(int, int);
+void	uvm_swap_markbad(int, int);
+bool	uvm_swapisfull(void);
+void	swapsys_lock(krw_t);
+void	swapsys_unlock(void);
+void	uvm_swap_stats(int, struct swapent *, int, register_t *);
+
+#else /* defined(VMSWAP) */
+#define	uvm_swapisfull()	true
+#define uvm_swap_stats(c, sep, count, retval) { *retval = 0; }
+#endif /* defined(VMSWAP) */
+void	uvm_swap_shutdown(struct lwp *);
+
+#endif /* _KERNEL || _MODULE */
+
+#endif /* _UVM_UVM_SWAP_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_swap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm.h	(revision 13)
@@ -0,0 +1,195 @@
+/*	$NetBSD: uvm.h,v 1.66 2015/04/13 22:04:44 riastradh Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ *
+ * from: Id: uvm.h,v 1.1.2.14 1998/02/02 20:07:19 chuck Exp
+ */
+
+#ifndef _UVM_UVM_H_
+#define _UVM_UVM_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_lockdebug.h"
+#include "opt_multiprocessor.h"
+#include "opt_uvmhist.h"
+#include "opt_uvm_page_trkown.h"
+#endif
+
+#include <uvm/uvm_extern.h>
+
+#ifdef _KERNEL
+#include <uvm/uvm_stat.h>
+#endif
+
+/*
+ * pull in prototypes
+ */
+
+#include <uvm/uvm_amap.h>
+#include <uvm/uvm_aobj.h>
+#include <uvm/uvm_fault.h>
+#include <uvm/uvm_glue.h>
+#include <uvm/uvm_km.h>
+#include <uvm/uvm_loan.h>
+#include <uvm/uvm_map.h>
+#include <uvm/uvm_object.h>
+#include <uvm/uvm_page.h>
+#include <uvm/uvm_pager.h>
+#include <uvm/uvm_pdaemon.h>
+#include <uvm/uvm_swap.h>
+
+#ifdef _KERNEL
+
+#include <sys/rndsource.h>
+
+/*
+ * pull in VM_NFREELIST
+ */
+#include <machine/vmparam.h>
+
+struct workqueue;
+
+/*
+ * per-cpu data
+ */
+
+struct uvm_cpu {
+	struct pgfreelist page_free[VM_NFREELIST]; /* unallocated pages */
+	int page_free_nextcolor;	/* next color to allocate from */
+	int page_idlezero_next;		/* which color to zero next */
+	bool page_idle_zero;		/* TRUE if we should try to zero
+					   pages in the idle loop */
+	int pages[PGFL_NQUEUES];	/* total of pages in page_free */
+	u_int emap_gen;			/* emap generation number */
+
+	krndsource_t rs;		/* entropy source */
+};
+
+/*
+ * uvm structure (vm global state: collected in one structure for ease
+ * of reference...)
+ */
+
+struct uvm {
+	/* vm_page related parameters */
+
+		/* vm_page queues */
+	struct pgfreelist page_free[VM_NFREELIST]; /* unallocated pages */
+	bool page_init_done;		/* TRUE if uvm_page_init() finished */
+
+		/* page daemon trigger */
+	int pagedaemon;			/* daemon sleeps on this */
+	struct lwp *pagedaemon_lwp;	/* daemon's lid */
+
+		/* aiodone daemon */
+	struct workqueue *aiodone_queue;
+
+	/* aio_done is locked by uvm.pagedaemon_lock and splbio! */
+	TAILQ_HEAD(, buf) aio_done;		/* done async i/o reqs */
+
+	/* per-cpu data */
+	struct uvm_cpu *cpus[MAXCPUS];
+};
+
+/*
+ * kernel object: to support anonymous pageable kernel memory
+ */
+extern struct uvm_object *uvm_kernel_object;
+
+/*
+ * locks (made globals for lockstat).
+ */
+
+extern kmutex_t uvm_pageqlock;		/* lock for active/inactive page q */
+extern kmutex_t uvm_fpageqlock;		/* lock for free page q */
+extern kmutex_t uvm_kentry_lock;
+extern kmutex_t uvm_swap_data_lock;
+
+#endif /* _KERNEL */
+
+/*
+ * vm_map_entry etype bits:
+ */
+
+#define UVM_ET_OBJ		0x01	/* it is a uvm_object */
+#define UVM_ET_SUBMAP		0x02	/* it is a vm_map submap */
+#define UVM_ET_COPYONWRITE 	0x04	/* copy_on_write */
+#define UVM_ET_NEEDSCOPY	0x08	/* needs_copy */
+
+#define UVM_ET_ISOBJ(E)		(((E)->etype & UVM_ET_OBJ) != 0)
+#define UVM_ET_ISSUBMAP(E)	(((E)->etype & UVM_ET_SUBMAP) != 0)
+#define UVM_ET_ISCOPYONWRITE(E)	(((E)->etype & UVM_ET_COPYONWRITE) != 0)
+#define UVM_ET_ISNEEDSCOPY(E)	(((E)->etype & UVM_ET_NEEDSCOPY) != 0)
+
+#ifdef _KERNEL
+
+/*
+ * holds all the internal UVM data
+ */
+extern struct uvm uvm;
+
+/*
+ * historys
+ */
+
+#ifdef UVMHIST
+UVMHIST_DECL(maphist);
+UVMHIST_DECL(pdhist);
+UVMHIST_DECL(ubchist);
+UVMHIST_DECL(loanhist);
+#endif
+
+extern struct evcnt uvm_ra_total;
+extern struct evcnt uvm_ra_hit;
+extern struct evcnt uvm_ra_miss;
+
+/*
+ * UVM_UNLOCK_AND_WAIT: atomic unlock+wait... wrapper around the
+ * interlocked tsleep() function.
+ */
+
+#define	UVM_UNLOCK_AND_WAIT(event, slock, intr, msg, timo)		\
+do {									\
+	(void) mtsleep(event, PVM | PNORELOCK | (intr ? PCATCH : 0),	\
+	    msg, timo, slock);						\
+} while (/*CONSTCOND*/ 0)
+
+void uvm_kick_pdaemon(void);
+
+/*
+ * UVM_PAGE_OWN: track page ownership (only if UVM_PAGE_TRKOWN)
+ */
+
+#if defined(UVM_PAGE_TRKOWN)
+#define UVM_PAGE_OWN(PG, TAG) uvm_page_own(PG, TAG)
+#else
+#define UVM_PAGE_OWN(PG, TAG) /* nothing */
+#endif /* UVM_PAGE_TRKOWN */
+
+#include <uvm/uvm_fault_i.h>
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_device.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_device.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_device.h	(revision 13)
@@ -0,0 +1,69 @@
+/*	$NetBSD: uvm_device.h,v 1.13 2014/12/14 23:48:58 chs Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ *
+ * from: Id: uvm_device.h,v 1.1.2.2 1997/10/03 17:39:44 chuck Exp
+ */
+
+#ifndef _UVM_UVM_DEVICE_H_
+#define _UVM_UVM_DEVICE_H_
+
+/*
+ * uvm_device.h
+ *
+ * device handle into the VM system.
+ */
+
+/*
+ * the uvm_device structure.   object is put at the top of the data structure.
+ * this allows:
+ *   (struct uvm_device *) == (struct uvm_object *)
+ */
+
+struct uvm_device {
+	struct uvm_object u_obj;	/* the actual VM object */
+	int u_flags;			/* flags [LOCKED BY UDV_LOCK!] */
+	dev_t u_device;		/* our device */
+	LIST_ENTRY(uvm_device) u_list; /* list of device objects */
+};
+
+/*
+ * u_flags values
+ */
+
+#define UVM_DEVICE_HOLD		0x1	/* someone has a "hold" on it */
+#define UVM_DEVICE_WANTED	0x2	/* someone wants to put a "hold" on */
+
+#ifdef _KERNEL
+
+/*
+ * prototypes
+ */
+
+struct uvm_object *udv_attach(dev_t, vm_prot_t, voff_t, vsize_t);
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_DEVICE_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_device.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_glue.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_glue.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_glue.h	(revision 13)
@@ -0,0 +1,45 @@
+/*	$NetBSD: uvm_glue.h,v 1.10 2011/02/02 15:13:34 chuck Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ *
+ * from: Id: uvm_glue.h,v 1.1.2.1 1997/08/14 19:10:48 chuck Exp
+ */
+
+#ifndef _UVM_UVM_GLUE_H_
+#define _UVM_UVM_GLUE_H_
+
+#ifdef _KERNEL
+
+/*
+ * uvm_glue.h
+ */
+
+void uvm_swapout_threads(void);
+
+void uvm_uarea_init(void);
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_GLUE_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_glue.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_object.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_object.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_object.h	(revision 13)
@@ -0,0 +1,119 @@
+/*	$NetBSD: uvm_object.h,v 1.33 2012/09/14 22:20:50 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ *
+ * from: Id: uvm_object.h,v 1.1.2.2 1998/01/04 22:44:51 chuck Exp
+ */
+
+#ifndef _UVM_UVM_OBJECT_H_
+#define _UVM_UVM_OBJECT_H_
+
+#include <sys/queue.h>
+#include <sys/rbtree.h>
+#include <uvm/uvm_pglist.h>
+
+/*
+ * The UVM memory object interface.  Notes:
+ *
+ * A UVM memory object represents a list of pages, which are managed by
+ * the object's pager operations (uvm_object::pgops).  All pages belonging
+ * to an object are owned by it and thus protected by the object lock.
+ *
+ * The lock (uvm_object::vmobjlock) may be shared amongst the UVM objects.
+ * By default, the lock is allocated dynamically using mutex_obj(9) cache.
+ * Lock sharing is normally used when there is an underlying object.  For
+ * example, vnode representing a file may have an underlying node, which
+ * is the case for tmpfs and layered file systems.  In such case, vnode's
+ * UVM object and the underlying UVM object shares the lock (note that the
+ * vnode_t::v_interlock points to uvm_object::vmobjlock).
+ *
+ * The reference count is managed atomically for the anonymous UVM objects.
+ * For other objects, it is arbitrary (may use the lock or atomics).
+ */
+
+struct uvm_object {
+	kmutex_t *		vmobjlock;	/* lock on memq */
+	const struct uvm_pagerops *pgops;	/* pager ops */
+	struct pglist		memq;		/* pages in this object */
+	int			uo_npages;	/* # of pages in memq */
+	unsigned		uo_refs;	/* reference count */
+	struct rb_tree		rb_tree;	/* tree of pages */
+	LIST_HEAD(,ubc_map)	uo_ubc;		/* ubc mappings */
+};
+
+/*
+ * UVM_OBJ_KERN is a 'special' uo_refs value which indicates that the
+ * object is a kernel memory object rather than a normal one (kernel
+ * memory objects don't have reference counts -- they never die).
+ *
+ * this value is used to detected kernel object mappings at uvm_unmap()
+ * time.   normally when an object is unmapped its pages eventaully become
+ * deactivated and then paged out and/or freed.    this is not useful
+ * for kernel objects... when a kernel object is unmapped we always want
+ * to free the resources associated with the mapping.   UVM_OBJ_KERN
+ * allows us to decide which type of unmapping we want to do.
+ */
+#define UVM_OBJ_KERN		(-2)
+
+#define	UVM_OBJ_IS_KERN_OBJECT(uobj)					\
+	((uobj)->uo_refs == UVM_OBJ_KERN)
+
+#ifdef _KERNEL
+
+extern const struct uvm_pagerops uvm_vnodeops;
+extern const struct uvm_pagerops uvm_deviceops;
+extern const struct uvm_pagerops ubc_pager;
+extern const struct uvm_pagerops aobj_pager;
+
+#define	UVM_OBJ_IS_VNODE(uobj)						\
+	((uobj)->pgops == &uvm_vnodeops)
+
+#define	UVM_OBJ_IS_DEVICE(uobj)						\
+	((uobj)->pgops == &uvm_deviceops)
+
+#define	UVM_OBJ_IS_VTEXT(uobj)						\
+	(UVM_OBJ_IS_VNODE(uobj) && uvn_text_p(uobj))
+
+#define	UVM_OBJ_IS_CLEAN(uobj)						\
+	(UVM_OBJ_IS_VNODE(uobj) && uvn_clean_p(uobj))
+
+/*
+ * UVM_OBJ_NEEDS_WRITEFAULT: true if the uobj needs to detect modification.
+ * (ie. wants to avoid writable user mappings.)
+ *
+ * XXX bad name
+ */
+
+#define	UVM_OBJ_NEEDS_WRITEFAULT(uobj)					\
+	(UVM_OBJ_IS_VNODE(uobj) && uvn_needs_writefault_p(uobj))
+
+#define	UVM_OBJ_IS_AOBJ(uobj)						\
+	((uobj)->pgops == &aobj_pager)
+
+extern const rb_tree_ops_t uvm_page_tree_ops;
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_OBJECT_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_object.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_pdaemon.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_pdaemon.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_pdaemon.h	(revision 13)
@@ -0,0 +1,89 @@
+/*	$NetBSD: uvm_pdaemon.h,v 1.17 2011/02/02 15:25:27 chuck Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * Copyright (c) 1991, 1993, The Regents of the University of California.
+ *
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * The Mach Operating System project at Carnegie-Mellon University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vm_pageout.h        8.2 (Berkeley) 1/12/94
+ * from: Id: uvm_pdaemon.h,v 1.1.2.4 1998/02/02 20:07:20 chuck Exp
+ *
+ *
+ * Copyright (c) 1987, 1990 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _UVM_UVM_PDAEMON_H_
+#define _UVM_UVM_PDAEMON_H_
+
+/*
+ * uvm_pdaemon.h: page daemon hooks
+ */
+
+#ifdef _KERNEL
+
+/*
+ * prototypes
+ */
+
+void uvm_wait(const char *);
+bool uvm_reclaimable(void);
+
+kmutex_t *uvmpd_trylockowner(struct vm_page *);
+#ifdef VMSWAP
+bool uvmpd_trydropswap(struct vm_page *);
+#else
+#define uvmpd_trydropswap(_a_) (/*CONSTCOND*/false)
+#endif
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_PDAEMON_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_pdaemon.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_stat.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_stat.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_stat.h	(revision 13)
@@ -0,0 +1,78 @@
+/*	$NetBSD: uvm_stat.h,v 1.52 2014/03/05 05:35:55 matt Exp $	*/
+
+/*
+ * Copyright (c) 2011 Matthew R. Green
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+/*
+ * Backwards compat for UVMHIST, in the new KERNHIST form.
+ */
+
+#ifndef _UVM_UVM_STAT_H_
+#define _UVM_UVM_STAT_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_uvmhist.h"
+#include "opt_kernhist.h"
+#endif
+
+/*
+ * Make UVMHIST_PRINT force on KERNHIST_PRINT for at least UVMHIST_* usage.
+ */
+#if defined(UVMHIST_PRINT) && !defined(KERNHIST_PRINT)
+#define KERNHIST_PRINT 1
+#endif
+
+#include <sys/kernhist.h>
+
+#ifdef UVMHIST
+
+#define UVMHIST_DECL(NAME)		KERNHIST_DECL(NAME)
+#define UVMHIST_DEFINE(NAME)		KERNHIST_DEFINE(NAME)
+#define UVMHIST_INIT(NAME,N)		KERNHIST_INIT(NAME,N)
+#define UVMHIST_INIT_STATIC(NAME,BUF)	KERNHIST_INIT_STATIC(NAME,BUF)
+#define UVMHIST_INITIALIZER(NAME,BUF)	KERNHIST_INITIALIZER(NAME,BUF)
+#define UVMHIST_LINK_STATIC(NAME)	KERNHIST_LINK_STATIC(NAME)
+#define UVMHIST_LOG(NAME,FMT,A,B,C,D)	KERNHIST_LOG(NAME,FMT,A,B,C,D)
+#define UVMHIST_CALLED(NAME)		KERNHIST_CALLED(NAME)
+#define UVMHIST_FUNC(FNAME)		KERNHIST_FUNC(FNAME)
+
+#else
+
+#define UVMHIST_DECL(NAME)
+#define UVMHIST_DEFINE(NAME)
+#define UVMHIST_INIT(NAME,N)
+#define UVMHIST_INIT_STATIC(NAME,BUF)
+#define UVMHIST_INITIALIZER(NAME,BUF)
+#define UVMHIST_LINK_STATIC(NAME)
+#define UVMHIST_LOG(NAME,FMT,A,B,C,D)
+#define UVMHIST_CALLED(NAME)
+#define UVMHIST_FUNC(FNAME)
+
+#endif
+
+#endif /* _UVM_UVM_STAT_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_stat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/aout_machdep.h
===================================================================
--- lab4/.minix-src/include/x86/aout_machdep.h	(nonexistent)
+++ lab4/.minix-src/include/x86/aout_machdep.h	(revision 13)
@@ -0,0 +1,49 @@
+/*	$NetBSD: aout_machdep.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $	*/
+
+/*
+ * Copyright (c) 1993 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+#ifndef _X86_EXEC_H_
+#define _X86_EXEC_H_
+
+#define AOUT_LDPGSZ	4096
+
+/* Relocation format. */
+struct relocation_info_i386 {
+	int r_address;			/* offset in text or data segment */
+	unsigned int r_symbolnum : 24,	/* ordinal number of add symbol */
+			 r_pcrel :  1,	/* 1 if value should be pc-relative */
+			r_length :  2,	/* log base 2 of value's width */
+			r_extern :  1,	/* 1 if need to add symbol to value */
+		       r_baserel :  1,	/* linkage table relative */
+		      r_jmptable :  1,	/* relocate to jump table */
+		      r_relative :  1,	/* load address relative */
+			  r_copy :  1;	/* run time copy */
+};
+#define relocation_info	relocation_info_i386
+
+#endif  /* _X86_EXEC_H_ */

Property changes on: lab4/.minix-src/include/x86/aout_machdep.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/cpu_extended_state.h
===================================================================
--- lab4/.minix-src/include/x86/cpu_extended_state.h	(nonexistent)
+++ lab4/.minix-src/include/x86/cpu_extended_state.h	(revision 13)
@@ -0,0 +1,255 @@
+/*	$NetBSD: cpu_extended_state.h,v 1.9 2014/02/25 22:16:52 dsl Exp $	*/
+
+#ifndef _X86_CPU_EXTENDED_STATE_H_
+#define _X86_CPU_EXTENDED_STATE_H_
+
+/*
+ * This file contains definitions of structures that match the memory
+ * layouts used x86 processors to save floating point registers and other
+ * extended cpu state.
+ * This includes registers (etc) used by SSE/SSE2/SSE3/SSSE3/SSE4 and
+ * the later AVX instructions.
+ * The definitions are such that any future 'extended state' should
+ * be handled (provided the kernel doesn't need to know the actual contents.
+ *
+ * The actual structures the cpu accesses must be aligned to 16 for
+ * FXSAVE and 64 for XSAVE. The types aren't aligned because copies
+ * do not need extra alignment.
+ *
+ * The slightly different layout saved by the i387 fsave in also defined.
+ * This is only normally written by pre Pentium II type cpus that don't 
+ * support the fxsave instruction.  
+ *
+ * Associated save instructions:
+ * FNSAVE:  Saves x87 state in 108 bytes (original i387 layout).
+ *          Then reinitialies the fpu.
+ * FSAVE:   Encodes to FWAIT followed by FNSAVE.
+ * FXSAVE:  Saves the x87 state and XMM (aka SSE) registers to the
+ *          first 448 (max) bytes of a 512 byte area.
+ *          This layout does not match that written by FNSAVE.
+ * XSAVE:   Uses the same layout for the x87 and XMM registers,
+ *          followed by a 64byte header and separate save areas
+ *          for additional extended cpu state.
+ *          The x87 state is always saved, the others conditionally.
+ * XSAVEOPT: As XSAVE but (IIRC) only writes the registers blocks
+ *          that have been modified.
+ */
+
+#ifdef __lint__
+/* Lint has different packing rules and doesn't understand __aligned() */
+#define __CTASSERT_NOLINT(x) __CTASSERT(1)
+#else
+#define __CTASSERT_NOLINT(x) __CTASSERT(x)
+#endif
+
+/*
+ * Layout for code/data pointers relating to FP exceptions.
+ * Marked 'packed' because they aren't always 64bit aligned.
+ * Since the x86 cpu supports misaligned accesses it isn't
+ * worth avoiding the 'packed' attribute.
+ */
+union fp_addr {
+	uint64_t fa_64;	/* Linear address for 64bit systems */
+	struct {
+		uint32_t fa_off;	/* linear address for 32 bit */
+		uint16_t fa_seg;	/* code/data (etc) segment */
+		uint16_t fa_opcode;	/* last opcode (sometimes) */
+	} fa_32;
+} __packed __aligned(4);
+
+/* The x87 registers are 80 bits */
+struct fpacc87 {
+	uint64_t	f87_mantissa;	/* mantissa */
+	uint16_t	f87_exp_sign;	/* exponent and sign */
+} __packed __aligned(2);
+
+/* The x87 registers padded out to 16 bytes for fxsave */
+struct fpaccfx {
+	struct fpacc87 r __aligned(16);
+};
+
+/* The SSE/SSE2 registers are 128 bits */
+struct xmmreg {
+	uint8_t xmm_bytes[16];
+};
+
+/* The AVX registers are 256 bits, but the low bits are the xmmregs */
+struct ymmreg {
+	uint8_t ymm_bytes[16];
+};
+
+/*
+ * Floating point unit registers (fsave instruction).
+ * The s87_ac[] and fx_87_ac[] are relative to the stack top.
+ * The 'tag word' contains 2 bits per register and refers to
+ * absolute register numbers.
+ * The cpu sets the tag values 0b01 (zero) and 0b10 (special) when a value
+ * is loaded. The software need only set 0b00 (used) and 0xb11 (unused).
+ * The fxsave 'Abridged tag word' in inverted.
+ */
+struct save87 {
+	uint16_t	s87_cw __aligned(4);	/* control word (16bits) */
+	uint16_t	s87_sw __aligned(4);	/* status word (16bits) */
+	uint16_t	s87_tw __aligned(4);	/* tag word (16bits) */
+	union fp_addr	s87_ip;		/* floating point instruction pointer */
+#define s87_opcode s87_ip.fa_32.fa_opcode	/* opcode last executed (11bits) */
+	union fp_addr	s87_dp;		/* floating operand offset */
+	struct fpacc87	s87_ac[8];	/* accumulator contents, 0-7 */
+};
+__CTASSERT_NOLINT(sizeof (struct save87) == 108);
+
+/* FPU/MMX/SSE/SSE2 context */
+struct fxsave {
+/*0*/	uint16_t	fx_cw;		/* FPU Control Word */
+	uint16_t	fx_sw;		/* FPU Status Word */
+	uint8_t		fx_tw;		/* FPU Tag Word (abridged) */
+	uint16_t	fx_opcode;	/* FPU Opcode */
+	union fp_addr	fx_ip;		/* FPU Instruction Pointer */
+/*16*/	union fp_addr	fx_dp;		/* FPU Data pointer */
+	uint32_t	fx_mxcsr;	/* MXCSR Register State */
+	uint32_t	fx_mxcsr_mask;
+	struct fpaccfx	fx_87_ac[8];	/* 8 x87 registers */
+	struct xmmreg	fx_xmm[16];	/* XMM regs (8 in 32bit modes) */
+	uint8_t		fx_rsvd[48];
+	uint8_t		fx_kernel[48];	/* Not written by the hardware */
+} __aligned(16);
+__CTASSERT_NOLINT(sizeof (struct fxsave) == 512);
+
+/* The end of the fsave buffer can be used by the operating system */
+struct fxsave_os {
+	uint8_t		fxo_fxsave[512 - 48];
+	/* 48 bytes available, NB copied to/from userspace */
+	uint16_t	fxo_dflt_cw;	/* Control word for signal handlers */
+};
+
+/*
+ * For XSAVE a 64byte header follows the fxsave data.
+ * Currently it only contains one field of which only 3 bits are defined.
+ * Some other parts must be zero - zero it all.
+ *
+ * The xsh_xstate_bv bits match those of XCR0:
+ *   XCR0_X87        0x00000001      x87 FPU/MMX state
+ *   XCR0_SSE        0x00000002      SSE state
+ *   XCR0_AVX        0x00000004      AVX state (ymmn registers)
+ *
+ * The offsets and sizes of any save areas can be found by reading
+ * the correct control registers.
+ */
+
+struct xsave_header {
+	uint64_t	xsh_fxsave[64];	/* to align in the union */
+	uint64_t	xsh_xstate_bv;	/* bitmap of saved sub structures */
+	uint64_t	xsh_rsrvd[2];	/* must be zero */
+	uint64_t	xsh_reserved[5];/* best if zero */
+};
+__CTASSERT(sizeof (struct xsave_header) == 512 + 64);
+
+/*
+ * The ymm save area actually follows the xsave_header.
+ */
+struct xsave_ymm {
+	struct ymmreg	xs_ymm[16];	/* High bits of YMM registers */
+};
+__CTASSERT(sizeof (struct xsave_ymm) == 256);
+
+/*
+ * The following union is placed at the end of the pcb.
+ * It is defined this way to separate the definitions and to
+ * minimise the number of union/struct selectors.
+ * NB: Some userspace stuff (eg firefox) uses it to parse ucontext.
+ */
+union savefpu {
+	struct save87		sv_87;
+	struct fxsave		sv_xmm;
+#ifdef _KERNEL
+	struct fxsave_os	sv_os;
+	struct xsave_header	sv_xsave_hdr;
+#endif
+};
+
+/*
+ * 80387 control and status word bits
+ *
+ * The only reference I can find to bits 0x40 and 0x80 in the control word
+ * is for the Weitek 1167/3167.
+ * I (dsl) can't find why the default word has 0x40 set.
+ *
+ * A stack error is signalled as an INVOP that also sets STACK_FAULT
+ * (other INVOP do not clear STACK_FAULT).
+ */
+/* Interrupt masks (set masks interrupt) and status bits */
+#define EN_SW_INVOP		0x0001  /* Invalid operation */
+#define EN_SW_DENORM		0x0002  /* Denormalized operand */
+#define EN_SW_ZERODIV		0x0004  /* Divide by zero */
+#define EN_SW_OVERFLOW		0x0008  /* Overflow */
+#define EN_SW_UNDERFLOW		0x0010  /* Underflow */
+#define EN_SW_PRECLOSS		0x0020  /* Loss of precision */
+/* Status word bits (reserved in control word) */
+#define EN_SW_STACK_FAULT	0x0040	/* Stack under/overflow */
+#define EN_SW_ERROR_SUMMARY	0x0080	/* Unmasked error has ocurred */
+/* Control bits (badly named) */
+#define EN_SW_CTL_PREC		0x0300	/* Precision control */
+#define EN_SW_PREC_24		0x0000	/* Single precision */
+#define EN_SW_PREC_53		0x0200	/* Double precision */
+#define EN_SW_PREC_64		0x0300	/* Extended precision */
+#define EN_SW_CTL_ROUND		0x0c00	/* Rounding control */
+#define EN_SW_ROUND_EVEN	0x0000	/* Round to nearest even */
+#define EN_SW_ROUND_DOWN	0x0400	/* Round towards minus infinity */
+#define EN_SW_ROUND_UP		0x0800	/* Round towards plus infinity */
+#define EN_SW_ROUND_ZERO	0x0c00	/* Round towards zero (truncates) */
+#define EN_SW_CTL_INF		0x1000	/* Infinity control, not used  */
+
+/*
+ * The standard 0x87 control word from finit is 0x37F, giving:
+ *	round to nearest
+ *	64-bit precision
+ *	all exceptions masked.
+ *
+ * NetBSD used to select:
+ *	round to nearest
+ *	53-bit precision
+ *	all exceptions masked.
+ * Stating: 64-bit precision often gives bad results with high level
+ * languages because it makes the results of calculations depend on whether
+ * intermediate values are stored in memory or in FPU registers.
+ * Also some 'pathological divisions' give an error in the LSB because
+ * the value is first rounded up when the 64bit mantissa is generated,
+ * and then again when it is truncated to 53 bits.
+ *
+ * However the C language explicitly allows the extra precision.
+ *
+ * The iBCS control word has underflow, overflow, zero divide, and invalid
+ * operation exceptions unmasked.  But that causes an unexpected exception
+ * in the test program 'paranoia' and makes denormals useless (DBL_MIN / 2
+ * underflows).  It doesn't make a lot of sense to trap underflow without
+ * trapping denormals.
+ */
+#define	__INITIAL_NPXCW__	0x037f
+/* Modern NetBSD uses the default control word.. */
+#define	__NetBSD_NPXCW__	__INITIAL_NPXCW__
+/* NetBSD before 6.99.26 forced IEEE double precision. */
+#define	__NetBSD_COMPAT_NPXCW__	0x127f
+/* FreeBSD leaves some exceptions unmasked as well. */
+#define	__FreeBSD_NPXCW__	0x1272
+/* iBCS2 goes a bit further and leaves the underflow exception unmasked. */
+#define	__iBCS2_NPXCW__		0x0262
+/* Linux just uses the default control word. */
+#define	__Linux_NPXCW__		__INITIAL_NPXCW__
+/* SVR4 uses the same control word as iBCS2. */
+#define	__SVR4_NPXCW__		0x0262
+
+/*
+ * The default MXCSR value at reset is 0x1f80, IA-32 Instruction
+ * Set Reference, pg. 3-369.
+ *
+ * The low 6 bits of the mxcsr are the fp status bits (same order as x87).
+ * Bit 6 is 'denormals are zero' (speeds up calculations).
+ * Bits 7-16 are the interrupt mask bits (same order, 1 to mask).
+ * Bits 13 and 14 are rounding control.
+ * Bit 15 is 'flush to zero' - affects underflow.
+ * Bits 16-31 must be zero.
+ */
+#define	__INITIAL_MXCSR__	0x1f80
+#define	__INITIAL_MXCSR_MASK__	0xffbf
+
+#endif /* _X86_CPU_EXTENDED_STATE_H_ */

Property changes on: lab4/.minix-src/include/x86/cpu_extended_state.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/float.h
===================================================================
--- lab4/.minix-src/include/x86/float.h	(nonexistent)
+++ lab4/.minix-src/include/x86/float.h	(revision 13)
@@ -0,0 +1,29 @@
+/*	$NetBSD: float.h,v 1.6 2013/04/27 21:35:25 joerg Exp $	*/
+
+#ifndef _X86_FLOAT_H_
+#define _X86_FLOAT_H_
+
+#include <sys/featuretest.h>
+
+#define	LDBL_MANT_DIG	64
+#define LDBL_EPSILON	1.0842021724855044340E-19L
+#define LDBL_DIG	18
+#define LDBL_MIN_EXP	(-16381)
+#define LDBL_MIN	3.3621031431120935063E-4932L
+#define LDBL_MIN_10_EXP	(-4931)
+#define LDBL_MAX_EXP	16384
+#define LDBL_MAX	1.1897314953572317650E+4932L
+#define LDBL_MAX_10_EXP	4932
+
+#include <sys/float_ieee754.h>
+
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+    !defined(_XOPEN_SOURCE) || \
+    ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    ((_XOPEN_SOURCE  - 0) >= 600) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+#define	DECIMAL_DIG	21
+#endif /* !defined(_ANSI_SOURCE) && ... */
+
+#endif	/* _X86_FLOAT_H_ */

Property changes on: lab4/.minix-src/include/x86/float.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/cpu.h
===================================================================
--- lab4/.minix-src/include/x86/cpu.h	(nonexistent)
+++ lab4/.minix-src/include/x86/cpu.h	(revision 13)
@@ -0,0 +1,531 @@
+/*	$NetBSD: cpu.h,v 1.66 2014/02/23 22:38:40 dsl Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)cpu.h	5.4 (Berkeley) 5/9/91
+ */
+
+#ifndef _X86_CPU_H_
+#define _X86_CPU_H_
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/types.h>
+#else
+#include <stdint.h>
+#include <stdbool.h>
+#endif /* _KERNEL || _STANDALONE */
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+#if defined(_KERNEL_OPT)
+#include "opt_xen.h"
+#ifdef i386
+#include "opt_user_ldt.h"
+#include "opt_vm86.h"
+#endif
+#endif
+
+/*
+ * Definitions unique to x86 cpu support.
+ */
+#include <machine/frame.h>
+#include <machine/pte.h>
+#include <machine/segments.h>
+#include <machine/tss.h>
+#include <machine/intrdefs.h>
+
+#include <x86/cacheinfo.h>
+
+#include <sys/cpu_data.h>
+#include <sys/evcnt.h>
+#include <sys/device_if.h> /* for device_t */
+
+#ifdef XEN
+#include <xen/xen-public/xen.h>
+#include <xen/xen-public/event_channel.h>
+#include <sys/mutex.h>
+#endif /* XEN */
+
+struct intrsource;
+struct pmap;
+
+#ifdef __x86_64__
+#define	i386tss	x86_64_tss
+#endif
+
+#define	NIOPORTS	1024		/* # of ports we allow to be mapped */
+#define	IOMAPSIZE	(NIOPORTS / 8)	/* I/O bitmap size in bytes */
+
+/*
+ * a bunch of this belongs in cpuvar.h; move it later..
+ */
+
+struct cpu_info {
+	struct cpu_data ci_data;	/* MI per-cpu data */
+	device_t ci_dev;		/* pointer to our device */
+	struct cpu_info *ci_self;	/* self-pointer */
+	volatile struct vcpu_info *ci_vcpu; /* for XEN */
+	void	*ci_tlog_base;		/* Trap log base */
+	int32_t ci_tlog_offset;		/* Trap log current offset */
+
+	/*
+	 * Will be accessed by other CPUs.
+	 */
+	struct cpu_info *ci_next;	/* next cpu */
+	struct lwp *ci_curlwp;		/* current owner of the processor */
+	struct lwp *ci_fpcurlwp;	/* current owner of the FPU */
+	int	_unused1[2];
+	cpuid_t ci_cpuid;		/* our CPU ID */
+	int	_unused;
+	uint32_t ci_acpiid;		/* our ACPI/MADT ID */
+	uint32_t ci_initapicid;		/* our intitial APIC ID */
+
+	/*
+	 * Private members.
+	 */
+	struct evcnt ci_tlb_evcnt;	/* tlb shootdown counter */
+	struct pmap *ci_pmap;		/* current pmap */
+	int ci_need_tlbwait;		/* need to wait for TLB invalidations */
+	int ci_want_pmapload;		/* pmap_load() is needed */
+	volatile int ci_tlbstate;	/* one of TLBSTATE_ states. see below */
+#define	TLBSTATE_VALID	0	/* all user tlbs are valid */
+#define	TLBSTATE_LAZY	1	/* tlbs are valid but won't be kept uptodate */
+#define	TLBSTATE_STALE	2	/* we might have stale user tlbs */
+	int ci_curldt;		/* current LDT descriptor */
+	int ci_nintrhand;	/* number of H/W interrupt handlers */
+	uint64_t ci_scratch;
+	uintptr_t ci_pmap_data[128 / sizeof(uintptr_t)];
+
+#ifdef XEN
+	struct iplsource  *ci_isources[NIPL];
+	u_long ci_evtmask[NR_EVENT_CHANNELS]; /* events allowed on this CPU */
+#else
+	struct intrsource *ci_isources[MAX_INTR_SOURCES];
+#endif
+	volatile int	ci_mtx_count;	/* Negative count of spin mutexes */
+	volatile int	ci_mtx_oldspl;	/* Old SPL at this ci_idepth */
+
+	/* The following must be aligned for cmpxchg8b. */
+	struct {
+		uint32_t	ipending;
+		int		ilevel;
+	} ci_istate __aligned(8);
+#define ci_ipending	ci_istate.ipending
+#define	ci_ilevel	ci_istate.ilevel
+
+	int		ci_idepth;
+	void *		ci_intrstack;
+	uint32_t	ci_imask[NIPL];
+	uint32_t	ci_iunmask[NIPL];
+
+	uint32_t ci_flags;		/* flags; see below */
+	uint32_t ci_ipis;		/* interprocessor interrupts pending */
+	uint32_t sc_apic_version;	/* local APIC version */
+
+	uint32_t	ci_signature;	 /* X86 cpuid type (cpuid.1.%eax) */
+	uint32_t	ci_vendor[4];	 /* vendor string */
+	uint32_t	_unused2;
+	uint32_t	ci_max_cpuid;	/* cpuid.0:%eax */
+	uint32_t	ci_max_ext_cpuid; /* cpuid.80000000:%eax */
+	volatile uint32_t	ci_lapic_counter;
+
+	uint32_t	ci_feat_val[5]; /* X86 CPUID feature bits */
+			/* [0] basic features cpuid.1:%edx
+			 * [1] basic features cpuid.1:%ecx (CPUID2_xxx bits)
+			 * [2] extended features cpuid:80000001:%edx
+			 * [3] extended features cpuid:80000001:%ecx
+			 * [4] VIA padlock features
+			 */
+	
+	const struct cpu_functions *ci_func;  /* start/stop functions */
+	struct trapframe *ci_ddb_regs;
+
+	u_int ci_cflush_lsize;	/* CFLUSH insn line size */
+	struct x86_cache_info ci_cinfo[CAI_COUNT];
+
+	union descriptor *ci_gdt;
+
+#ifdef i386
+	struct i386tss	ci_doubleflt_tss;
+	struct i386tss	ci_ddbipi_tss;
+#endif
+
+#ifdef PAE
+	uint32_t	ci_pae_l3_pdirpa; /* PA of L3 PD */
+	pd_entry_t *	ci_pae_l3_pdir; /* VA pointer to L3 PD */
+#endif
+
+#if defined(XEN) && (defined(PAE) || defined(__x86_64__))
+	/* Currently active user PGD (can't use rcr3() with Xen) */
+	pd_entry_t *	ci_kpm_pdir;	/* per-cpu PMD (va) */
+	paddr_t		ci_kpm_pdirpa;  /* per-cpu PMD (pa) */
+	kmutex_t	ci_kpm_mtx;
+#if defined(__x86_64__)
+	/* per-cpu version of normal_pdes */
+	pd_entry_t *	ci_normal_pdes[3]; /* Ok to hardcode. only for x86_64 && XEN */
+	paddr_t		ci_xen_current_user_pgd;
+#endif /* __x86_64__ */
+#endif /* XEN et.al */
+
+	char *ci_doubleflt_stack;
+	char *ci_ddbipi_stack;
+
+#ifndef XEN
+	struct evcnt ci_ipi_events[X86_NIPI];
+#else   /* XEN */
+	struct evcnt ci_ipi_events[XEN_NIPIS];
+	evtchn_port_t ci_ipi_evtchn;
+#endif  /* XEN */
+
+	device_t	ci_frequency;	/* Frequency scaling technology */
+	device_t	ci_padlock;	/* VIA PadLock private storage */
+	device_t	ci_temperature;	/* Intel coretemp(4) or equivalent */
+	device_t	ci_vm;		/* Virtual machine guest driver */
+
+	struct i386tss	ci_tss;		/* Per-cpu TSS; shared among LWPs */
+	char		ci_iomap[IOMAPSIZE]; /* I/O Bitmap */
+	int ci_tss_sel;			/* TSS selector of this cpu */
+
+	/*
+	 * The following two are actually region_descriptors,
+	 * but that would pollute the namespace.
+	 */
+	uintptr_t	ci_suspend_gdt;
+	uint16_t	ci_suspend_gdt_padding;
+	uintptr_t	ci_suspend_idt;
+	uint16_t	ci_suspend_idt_padding;
+
+	uint16_t	ci_suspend_tr;
+	uint16_t	ci_suspend_ldt;
+	uintptr_t	ci_suspend_fs;
+	uintptr_t	ci_suspend_gs;
+	uintptr_t	ci_suspend_kgs;
+	uintptr_t	ci_suspend_efer;
+	uintptr_t	ci_suspend_reg[12];
+	uintptr_t	ci_suspend_cr0;
+	uintptr_t	ci_suspend_cr2;
+	uintptr_t	ci_suspend_cr3;
+	uintptr_t	ci_suspend_cr4;
+	uintptr_t	ci_suspend_cr8;
+
+	/* The following must be in a single cache line. */
+	int		ci_want_resched __aligned(64);
+	int		ci_padout __aligned(64);
+};
+
+/*
+ * Macros to handle (some) trapframe registers for common x86 code.
+ */
+#ifdef __x86_64__
+#define	X86_TF_RAX(tf)		tf->tf_rax
+#define	X86_TF_RDX(tf)		tf->tf_rdx
+#define	X86_TF_RSP(tf)		tf->tf_rsp
+#define	X86_TF_RIP(tf)		tf->tf_rip
+#define	X86_TF_RFLAGS(tf)	tf->tf_rflags
+#else
+#define	X86_TF_RAX(tf)		tf->tf_eax
+#define	X86_TF_RDX(tf)		tf->tf_edx
+#define	X86_TF_RSP(tf)		tf->tf_esp
+#define	X86_TF_RIP(tf)		tf->tf_eip
+#define	X86_TF_RFLAGS(tf)	tf->tf_eflags
+#endif
+
+/*
+ * Processor flag notes: The "primary" CPU has certain MI-defined
+ * roles (mostly relating to hardclock handling); we distinguish
+ * betwen the processor which booted us, and the processor currently
+ * holding the "primary" role just to give us the flexibility later to
+ * change primaries should we be sufficiently twisted.
+ */
+
+#define	CPUF_BSP	0x0001		/* CPU is the original BSP */
+#define	CPUF_AP		0x0002		/* CPU is an AP */
+#define	CPUF_SP		0x0004		/* CPU is only processor */
+#define	CPUF_PRIMARY	0x0008		/* CPU is active primary processor */
+
+#define	CPUF_SYNCTSC	0x0800		/* Synchronize TSC */
+#define	CPUF_PRESENT	0x1000		/* CPU is present */
+#define	CPUF_RUNNING	0x2000		/* CPU is running */
+#define	CPUF_PAUSE	0x4000		/* CPU is paused in DDB */
+#define	CPUF_GO		0x8000		/* CPU should start running */
+
+#endif /* _KERNEL || __KMEMUSER */
+
+#ifdef _KERNEL
+/*
+ * We statically allocate the CPU info for the primary CPU (or,
+ * the only CPU on uniprocessors), and the primary CPU is the
+ * first CPU on the CPU info list.
+ */
+extern struct cpu_info cpu_info_primary;
+extern struct cpu_info *cpu_info_list;
+
+#define	CPU_INFO_ITERATOR		int __unused
+#define	CPU_INFO_FOREACH(cii, ci)	ci = cpu_info_list; \
+					ci != NULL; ci = ci->ci_next
+
+#define CPU_STARTUP(_ci, _target)	((_ci)->ci_func->start(_ci, _target))
+#define CPU_STOP(_ci)	        	((_ci)->ci_func->stop(_ci))
+#define CPU_START_CLEANUP(_ci)		((_ci)->ci_func->cleanup(_ci))
+
+#if !defined(__GNUC__) || defined(_MODULE)
+/* For non-GCC and modules */
+struct cpu_info	*x86_curcpu(void);
+void	cpu_set_curpri(int);
+# ifdef __GNUC__
+lwp_t	*x86_curlwp(void) __attribute__ ((const));
+# else
+lwp_t   *x86_curlwp(void);
+# endif
+#endif
+
+#define cpu_number() 		(cpu_index(curcpu()))
+
+#define CPU_IS_PRIMARY(ci)	((ci)->ci_flags & CPUF_PRIMARY)
+
+#define	X86_AST_GENERIC		0x01
+#define	X86_AST_PREEMPT		0x02
+
+#define aston(l, why)		((l)->l_md.md_astpending |= (why))
+#define	cpu_did_resched(l)	((l)->l_md.md_astpending &= ~X86_AST_PREEMPT)
+
+void cpu_boot_secondary_processors(void);
+void cpu_init_idle_lwps(void);
+void cpu_init_msrs(struct cpu_info *, bool);
+void cpu_load_pmap(struct pmap *, struct pmap *);
+void cpu_broadcast_halt(void);
+void cpu_kick(struct cpu_info *);
+
+#define	curcpu()		x86_curcpu()
+#define	curlwp			x86_curlwp()
+#define	curpcb			((struct pcb *)lwp_getpcb(curlwp))
+
+/*
+ * Arguments to hardclock, softclock and statclock
+ * encapsulate the previous machine state in an opaque
+ * clockframe; for now, use generic intrframe.
+ */
+struct clockframe {
+	struct intrframe cf_if;
+};
+
+/*
+ * Give a profiling tick to the current process when the user profiling
+ * buffer pages are invalid.  On the i386, request an ast to send us
+ * through trap(), marking the proc as needing a profiling tick.
+ */
+extern void	cpu_need_proftick(struct lwp *l);
+
+/*
+ * Notify the LWP l that it has a signal pending, process as soon as
+ * possible.
+ */
+extern void	cpu_signotify(struct lwp *);
+
+/*
+ * We need a machine-independent name for this.
+ */
+extern void (*delay_func)(unsigned int);
+struct timeval;
+
+#define	DELAY(x)		(*delay_func)(x)
+#define delay(x)		(*delay_func)(x)
+
+extern int biosbasemem;
+extern int biosextmem;
+extern int cputype;
+extern int cpuid_level;
+extern int cpu_class;
+extern char cpu_brand_string[];
+extern int use_pae;
+
+#ifdef __i386__
+extern int i386_fpu_present;
+int npx586bug1(int, int);
+extern int i386_fpu_fdivbug;
+extern int i386_use_fxsave;
+extern int i386_has_sse;
+extern int i386_has_sse2;
+#else
+#define	i386_fpu_present	1
+#define	i386_fpu_fdivbug	0
+#define	i386_use_fxsave		1
+#define	i386_has_sse		1
+#define	i386_has_sse2		1
+#endif
+
+extern int x86_fpu_save;
+#define	FPU_SAVE_FSAVE		0
+#define	FPU_SAVE_FXSAVE		1
+#define	FPU_SAVE_XSAVE		2
+#define	FPU_SAVE_XSAVEOPT	3
+extern unsigned int x86_fpu_save_size;
+extern uint64_t x86_xsave_features;
+
+extern void (*x86_cpu_idle)(void);
+#define	cpu_idle() (*x86_cpu_idle)()
+
+/* machdep.c */
+void	dumpconf(void);
+void	cpu_reset(void);
+void	i386_proc0_tss_ldt_init(void);
+void	dumpconf(void);
+void	cpu_reset(void);
+void	x86_64_proc0_tss_ldt_init(void);
+void	x86_64_init_pcb_tss_ldt(struct cpu_info *);
+
+/* longrun.c */
+u_int 	tmx86_get_longrun_mode(void);
+void 	tmx86_get_longrun_status(u_int *, u_int *, u_int *);
+void 	tmx86_init_longrun(void);
+
+/* identcpu.c */
+void 	cpu_probe(struct cpu_info *);
+void	cpu_identify(struct cpu_info *);
+
+/* cpu_topology.c */
+void	x86_cpu_topology(struct cpu_info *);
+
+/* vm_machdep.c */
+void	cpu_proc_fork(struct proc *, struct proc *);
+
+/* locore.s */
+struct region_descriptor;
+void	lgdt(struct region_descriptor *);
+#ifdef XEN
+void	lgdt_finish(void);
+#endif
+
+struct pcb;
+void	savectx(struct pcb *);
+void	lwp_trampoline(void);
+#ifdef XEN
+void	startrtclock(void);
+void	xen_delay(unsigned int);
+void	xen_initclocks(void);
+void	xen_suspendclocks(struct cpu_info *);
+void	xen_resumeclocks(struct cpu_info *);
+#else
+/* clock.c */
+void	initrtclock(u_long);
+void	startrtclock(void);
+void	i8254_delay(unsigned int);
+void	i8254_microtime(struct timeval *);
+void	i8254_initclocks(void);
+#endif
+
+/* cpu.c */
+
+void	cpu_probe_features(struct cpu_info *);
+
+/* vm_machdep.c */
+paddr_t	kvtop(void *);
+
+#ifdef USER_LDT
+/* sys_machdep.h */
+int	x86_get_ldt(struct lwp *, void *, register_t *);
+int	x86_set_ldt(struct lwp *, void *, register_t *);
+#endif
+
+/* isa_machdep.c */
+void	isa_defaultirq(void);
+int	isa_nmi(void);
+
+#ifdef VM86
+/* vm86.c */
+void	vm86_gpfault(struct lwp *, int);
+#endif /* VM86 */
+
+/* consinit.c */
+void kgdb_port_init(void);
+
+/* bus_machdep.c */
+void x86_bus_space_init(void);
+void x86_bus_space_mallocok(void);
+
+#endif /* _KERNEL */
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+#include <machine/psl.h>	/* Must be after struct cpu_info declaration */
+#endif /* _KERNEL || __KMEMUSER */
+
+/*
+ * CTL_MACHDEP definitions.
+ */
+#define	CPU_CONSDEV		1	/* dev_t: console terminal device */
+#define	CPU_BIOSBASEMEM		2	/* int: bios-reported base mem (K) */
+#define	CPU_BIOSEXTMEM		3	/* int: bios-reported ext. mem (K) */
+/* 	CPU_NKPDE		4	obsolete: int: number of kernel PDEs */
+#define	CPU_BOOTED_KERNEL	5	/* string: booted kernel name */
+#define CPU_DISKINFO		6	/* struct disklist *:
+					 * disk geometry information */
+#define CPU_FPU_PRESENT		7	/* int: FPU is present */
+#define	CPU_OSFXSR		8	/* int: OS uses FXSAVE/FXRSTOR */
+#define	CPU_SSE			9	/* int: OS/CPU supports SSE */
+#define	CPU_SSE2		10	/* int: OS/CPU supports SSE2 */
+#define	CPU_TMLR_MODE		11	/* int: longrun mode
+					 * 0: minimum frequency
+					 * 1: economy
+					 * 2: performance
+					 * 3: maximum frequency
+					 */
+#define	CPU_TMLR_FREQUENCY	12	/* int: current frequency */
+#define	CPU_TMLR_VOLTAGE	13	/* int: curret voltage */
+#define	CPU_TMLR_PERCENTAGE	14	/* int: current clock percentage */
+#define	CPU_MAXID		15	/* number of valid machdep ids */
+
+/*
+ * Structure for CPU_DISKINFO sysctl call.
+ * XXX this should be somewhere else.
+ */
+#define MAX_BIOSDISKS	16
+
+struct disklist {
+	int dl_nbiosdisks;			   /* number of bios disks */
+	struct biosdisk_info {
+		int bi_dev;			   /* BIOS device # (0x80 ..) */
+		int bi_cyl;			   /* cylinders on disk */
+		int bi_head;			   /* heads per track */
+		int bi_sec;			   /* sectors per track */
+		uint64_t bi_lbasecs;		   /* total sec. (iff ext13) */
+#define BIFLAG_INVALID		0x01
+#define BIFLAG_EXTINT13		0x02
+		int bi_flags;
+	} dl_biosdisks[MAX_BIOSDISKS];
+
+	int dl_nnativedisks;			   /* number of native disks */
+	struct nativedisk_info {
+		char ni_devname[16];		   /* native device name */
+		int ni_nmatches; 		   /* # of matches w/ BIOS */
+		int ni_biosmatches[MAX_BIOSDISKS]; /* indices in dl_biosdisks */
+	} dl_nativedisks[1];			   /* actually longer */
+};
+#endif /* !_X86_CPU_H_ */

Property changes on: lab4/.minix-src/include/x86/cpu.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/cpuvar.h
===================================================================
--- lab4/.minix-src/include/x86/cpuvar.h	(nonexistent)
+++ lab4/.minix-src/include/x86/cpuvar.h	(revision 13)
@@ -0,0 +1,132 @@
+/* 	$NetBSD: cpuvar.h,v 1.46 2012/04/20 22:23:24 rmind Exp $ */
+
+/*-
+ * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by RedBack Networks Inc.
+ *
+ * Author: Bill Sommerfeld
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1999 Stefan Grefen
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by the NetBSD
+ *      Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _X86_CPUVAR_H_
+#define	_X86_CPUVAR_H_
+
+struct cpu_functions {
+#ifndef XEN
+	int (*start)(struct cpu_info *, paddr_t);
+#else /* XEN */
+   	int (*start)(struct cpu_info *, vaddr_t);
+#endif /* XEN */
+	int (*stop)(struct cpu_info *);
+	void (*cleanup)(struct cpu_info *);
+};
+
+extern const struct cpu_functions mp_cpu_funcs;
+
+#define CPU_ROLE_SP	0
+#define CPU_ROLE_BP	1
+#define CPU_ROLE_AP	2
+
+struct cpu_attach_args {
+	int cpu_id;
+	int cpu_number;
+	int cpu_role;
+	const struct cpu_functions *cpu_func;
+};
+
+struct cpufeature_attach_args {
+	struct cpu_info *ci;
+	const char *name;
+};
+
+#ifdef _KERNEL
+#include <sys/kcpuset.h>
+#if defined(_KERNEL_OPT)
+#include "opt_multiprocessor.h"
+#endif /* defined(_KERNEL_OPT) */
+
+int x86_ipi(int, int, int);
+void x86_self_ipi(int);
+int x86_ipi_init(int);
+int x86_ipi_startup(int, int);
+void x86_errata(void);
+
+void identifycpu(struct cpu_info *);
+void identifycpu_cpuids(struct cpu_info *);
+void cpu_init(struct cpu_info *);
+void cpu_init_tss(struct cpu_info *);
+void cpu_init_first(void);
+
+void x86_cpu_idle_init(void);
+void x86_cpu_idle_halt(void);
+void x86_cpu_idle_mwait(void);
+#ifdef XEN
+void x86_cpu_idle_xen(void);
+#endif
+
+void	cpu_get_tsc_freq(struct cpu_info *);
+void	pat_init(struct cpu_info *);
+
+extern int cpu_vendor;
+extern bool x86_mp_online;
+
+extern uint32_t cpu_feature[5];
+
+#endif /* _KERNEL */
+
+#endif /* !_X86_CPUVAR_H_ */

Property changes on: lab4/.minix-src/include/x86/cpuvar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/ieeefp.h
===================================================================
--- lab4/.minix-src/include/x86/ieeefp.h	(nonexistent)
+++ lab4/.minix-src/include/x86/ieeefp.h	(revision 13)
@@ -0,0 +1,37 @@
+/*	$NetBSD: ieeefp.h,v 1.4 2011/03/26 19:52:20 christos Exp $	*/
+
+/* 
+ * Written by J.T. Conklin, Apr 6, 1995
+ * Public domain.
+ */
+
+#ifndef _X86_IEEEFP_H_
+#define _X86_IEEEFP_H_
+
+#include <sys/featuretest.h>
+#include <machine/fenv.h>
+
+typedef int fp_except;
+#define FP_X_INV	FE_INVALID	/* invalid operation exception */
+#define FP_X_DNML	FE_DENORMAL	/* denormalization exception */
+#define FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */
+#define FP_X_OFL	FE_OVERFLOW	/* overflow exception */
+#define FP_X_UFL	FE_UNDERFLOW	/* underflow exception */
+#define FP_X_IMP	FE_INEXACT	/* imprecise (loss of precision) */
+
+typedef enum {
+	FP_RN=FE_TONEAREST,		/* round to nearest representable num */
+	FP_RM=FE_DOWNWARD,		/* round toward negative infinity */
+	FP_RP=FE_UPWARD,		/* round toward positive infinity */
+	FP_RZ=FE_TOWARDZERO		/* round to zero (truncate) */
+} fp_rnd;
+
+typedef enum {
+	FP_PS = 0,			/* 24 bit (single-precision) */
+	FP_PRS,				/* reserved */
+	FP_PD,				/* 53 bit (double-precision) */
+	FP_PE				/* 64 bit (extended-precision) */
+} fp_prec;
+
+
+#endif /* _X86_IEEEFP_H_ */

Property changes on: lab4/.minix-src/include/x86/ieeefp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/lfs/lfs.h
===================================================================
--- lab4/.minix-src/include/ufs/lfs/lfs.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/lfs/lfs.h	(revision 13)
@@ -0,0 +1,1213 @@
+/*	$NetBSD: lfs.h,v 1.194 2015/10/03 08:29:34 dholland Exp $	*/
+
+/*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
+/*  from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp  */
+
+/*-
+ * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Konrad E. Schroder <perseant@hhhh.org>.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)lfs.h	8.9 (Berkeley) 5/8/95
+ */
+/*
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by Marshall
+ * Kirk McKusick and Network Associates Laboratories, the Security
+ * Research Division of Network Associates, Inc. under DARPA/SPAWAR
+ * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
+ * research program
+ *
+ * Copyright (c) 1982, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dinode.h	8.9 (Berkeley) 3/29/95
+ */
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dir.h	8.5 (Berkeley) 4/27/95
+ */
+
+/*
+ * NOTE: COORDINATE ON-DISK FORMAT CHANGES WITH THE FREEBSD PROJECT.
+ */
+
+#ifndef _UFS_LFS_LFS_H_
+#define _UFS_LFS_LFS_H_
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <stddef.h> /* for offsetof */
+#endif
+
+#include <sys/rwlock.h>
+#include <sys/mutex.h>
+#include <sys/queue.h>
+#include <sys/condvar.h>
+#include <sys/mount.h>
+#include <sys/pool.h>
+
+/*
+ * Compile-time options for LFS.
+ */
+#define LFS_IFIND_RETRIES  16
+#define LFS_LOGLENGTH      1024 /* size of debugging log */
+#define LFS_MAX_ACTIVE	   10	/* Dirty segments before ckp forced */
+
+/*
+ * Fixed filesystem layout parameters
+ */
+#define	LFS_LABELPAD	8192		/* LFS label size */
+#define	LFS_SBPAD	8192		/* LFS superblock size */
+
+#define	LFS_UNUSED_INUM	0		/* 0: out of band inode number */
+#define	LFS_IFILE_INUM	1		/* 1: IFILE inode number */
+					/* 2: Root inode number */
+#define	LFS_LOSTFOUNDINO 3		/* 3: lost+found inode number */
+#define	LFS_FIRST_INUM	4		/* 4: first free inode number */
+
+/*
+ * The root inode is the root of the file system.  Inode 0 can't be used for
+ * normal purposes and historically bad blocks were linked to inode 1, thus
+ * the root inode is 2.  (Inode 1 is no longer used for this purpose, however
+ * numerous dump tapes make this assumption, so we are stuck with it).
+ */
+#define	ULFS_ROOTINO	((ino_t)2)
+
+/*
+ * The Whiteout inode# is a dummy non-zero inode number which will
+ * never be allocated to a real file.  It is used as a place holder
+ * in the directory entry which has been tagged as a LFS_DT_WHT entry.
+ * See the comments about ULFS_ROOTINO above.
+ */
+#define	ULFS_WINO	((ino_t)1)
+
+
+#define	LFS_V1_SUMMARY_SIZE	512     /* V1 fixed summary size */
+#define	LFS_DFL_SUMMARY_SIZE	512	/* Default summary size */
+
+#define LFS_MAXNAMLEN	255		/* maximum name length in a dir */
+
+#define ULFS_NXADDR	2
+#define	ULFS_NDADDR	12		/* Direct addresses in inode. */
+#define	ULFS_NIADDR	3		/* Indirect addresses in inode. */
+
+/*
+ * Adjustable filesystem parameters
+ */
+#ifndef LFS_ATIME_IFILE
+# define LFS_ATIME_IFILE 0 /* Store atime info in ifile (optional in LFSv1) */
+#endif
+#define LFS_MARKV_MAXBLKCNT	65536	/* Max block count for lfs_markv() */
+
+/*
+ * Directories
+ */
+
+/*
+ * Directories in LFS are files; they use the same inode and block
+ * mapping structures that regular files do. The directory per se is
+ * manifested in the file contents: an unordered, unstructured
+ * sequence of variable-size directory entries.
+ *
+ * This format and structure is taken (via what was originally shared
+ * ufs-level code) from FFS. Each directory entry is a fixed header
+ * followed by a string, the total length padded to a 4-byte boundary.
+ * All strings include a null terminator; the maximum string length
+ * is LFS_MAXNAMLEN, which is 255.
+ *
+ * The directory entry header structure (struct lfs_dirheader) is just
+ * the header information. A complete entry is this plus a null-
+ * terminated name following it, plus some amount of padding. The
+ * length of the name (not including the null terminator) is given by
+ * the namlen field of the header; the complete record length,
+ * including the null terminator and padding, is given by the reclen
+ * field of the header. The record length is always 4-byte aligned.
+ * (Even on 64-bit volumes, the record length is only 4-byte aligned,
+ * not 8-byte.)
+ *
+ * Historically, FFS directories were/are organized into blocks of
+ * size DIRBLKSIZE that can be written atomically to disk at the
+ * hardware level. Directory entries are not allowed to cross the
+ * boundaries of these blocks. The resulting atomicity is important
+ * for the integrity of FFS volumes; however, for LFS it's irrelevant.
+ * All we have to care about is not writing out directories that
+ * confuse earlier ufs-based versions of the LFS code.
+ *
+ * This means [to be determined]. (XXX)
+ *
+ * As DIRBLKSIZE in its FFS sense is hardware-dependent, and file
+ * system images do from time to time move to different hardware, code
+ * that reads directories should be prepared to handle directories
+ * written in a context where DIRBLKSIZE was different (smaller or
+ * larger) than its current value. Note however that it is not
+ * sensible for DIRBLKSIZE to be larger than the volume fragment size,
+ * and not practically possible for it to be larger than the volume
+ * block size.
+ *
+ * Some further notes:
+ *    - the LFS_DIRSIZ macro provides the minimum space needed to hold
+ *      a directory entry.
+ *    - any particular entry may be arbitrarily larger (which is why the
+ *      header stores both the entry size and the name size) to pad out
+ *      unused space.
+ *    - historically the padding in an entry is not necessarily zeroed
+ *      but may contain trash.
+ *    - dp->d_reclen is the size of the entry. This is always 4-byte
+ *      aligned.
+ *    - dp->d_namlen is the length of the string, and should always be
+ *      the same as strlen(dp->d_name).
+ *    - in particular, space available in an entry is given by
+ *      dp->d_reclen - LFS_DIRSIZ(dp), and all space available within a
+ *      directory block is tucked away within an existing entry.
+ *    - all space within a directory block is part of some entry.
+ *    - therefore, inserting a new entry requires finding and
+ *      splitting a suitable existing entry, and when entries are
+ *      removed their space is merged into the entry ahead of them.
+ *    - an empty/unused entry has d_ino set to 0. This normally only
+ *      appears in the first entry in a block, as elsewhere the unused
+ *      entry should have been merged into the one before it. However,
+ *      fsck leaves such entries behind so they must be tolerated
+ *      elsewhere.
+ *    - a completely empty directory block has one entry whose
+ *      d_reclen is DIRBLKSIZ and whose d_ino is 0.
+ *
+ * The "old directory format" referenced by the fs->lfs_isolddirfmt
+ * flag (and some other things) refers to when the type field was
+ * added to directory entries. This change was made to FFS in the 80s,
+ * well before LFS was first written; there should be no LFS volumes
+ * (and certainly no LFS v2-format volumes or LFS64 volumes) where the
+ * old format pertains. All of the related logic should probably be
+ * removed; however, it hasn't been yet, and we get to carry it around
+ * until we can be conclusively sure it isn't needed.
+ *
+ * In the "old directory format" there is no type field and the namlen
+ * field is correspondingly 16 bits wide. On big-endian volumes this
+ * has no effect: namlen cannot exceed 255, so the upper byte is
+ * always 0 and this reads back from the type field as LFS_DT_UNKNOWN.
+ * On little-endian volumes, the namlen field will always be 0 and
+ * the namlen value needs to be read out of the type field. (The type
+ * is always LFS_DT_UNKNOWN.) The directory accessor functions take
+ * care of this so nothing else needs to be aware of it.
+ *
+ * LFS_OLDDIRFMT and LFS_NEWDIRFMT are code numbers for the old and
+ * new directory format respectively. These codes do not appear on
+ * disk; they're generated from a runtime macro called FSFMT() that's
+ * cued by other things. This is why (confusingly) LFS_OLDDIRFMT is 1
+ * and LFS_NEWDIRFMT is 0.
+ *
+ * FSFMT(), LFS_OLDDIRFMT, and LFS_NEWDIRFMT should be removed. (XXX)
+ */
+
+/*
+ * Directory block size.
+ */
+#undef	LFS_DIRBLKSIZ
+#define	LFS_DIRBLKSIZ	DEV_BSIZE
+
+/*
+ * Convert between stat structure type codes and directory entry type codes.
+ */
+#define	LFS_IFTODT(mode)	(((mode) & 0170000) >> 12)
+#define	LFS_DTTOIF(dirtype)	((dirtype) << 12)
+
+/*
+ * Theoretically, directories can be more than 2Gb in length; however, in
+ * practice this seems unlikely. So, we define the type doff_t as a 32-bit
+ * quantity to keep down the cost of doing lookup on a 32-bit machine.
+ */
+#define	doff_t		int32_t
+#define	lfs_doff_t	int32_t
+#define	LFS_MAXDIRSIZE	(0x7fffffff)
+
+/*
+ * File types for d_type
+ */
+#define	LFS_DT_UNKNOWN	 0
+#define	LFS_DT_FIFO	 1
+#define	LFS_DT_CHR	 2
+#define	LFS_DT_DIR	 4
+#define	LFS_DT_BLK	 6
+#define	LFS_DT_REG	 8
+#define	LFS_DT_LNK	10
+#define	LFS_DT_SOCK	12
+#define	LFS_DT_WHT	14
+
+/*
+ * (See notes above)
+ */
+
+struct lfs_dirheader32 {
+	u_int32_t dh_ino;		/* inode number of entry */
+	u_int16_t dh_reclen;		/* length of this record */
+	u_int8_t  dh_type; 		/* file type, see below */
+	u_int8_t  dh_namlen;		/* length of string in d_name */
+};
+
+struct lfs_dirheader64 {
+	u_int32_t dh_inoA;		/* inode number of entry */
+	u_int32_t dh_inoB;		/* inode number of entry */
+	u_int16_t dh_reclen;		/* length of this record */
+	u_int8_t  dh_type; 		/* file type, see below */
+	u_int8_t  dh_namlen;		/* length of string in d_name */
+};
+
+union lfs_dirheader {
+	struct lfs_dirheader64 u_64;
+	struct lfs_dirheader32 u_32;
+};
+
+typedef union lfs_dirheader LFS_DIRHEADER;
+
+/*
+ * Template for manipulating directories.
+ */
+
+struct lfs_dirtemplate32 {
+	struct lfs_dirheader32	dot_header;
+	char			dot_name[4];	/* must be multiple of 4 */
+	struct lfs_dirheader32	dotdot_header;
+	char			dotdot_name[4];	/* ditto */
+};
+
+struct lfs_dirtemplate64 {
+	struct lfs_dirheader64	dot_header;
+	char			dot_name[4];	/* must be multiple of 4 */
+	struct lfs_dirheader64	dotdot_header;
+	char			dotdot_name[4];	/* ditto */
+};
+
+union lfs_dirtemplate {
+	struct lfs_dirtemplate64 u_64;
+	struct lfs_dirtemplate32 u_32;
+};
+
+#if 0
+/*
+ * This is the old format of directories, sans type element.
+ */
+struct lfs_odirtemplate {
+	u_int32_t	dot_ino;
+	int16_t		dot_reclen;
+	u_int16_t	dot_namlen;
+	char		dot_name[4];	/* must be multiple of 4 */
+	u_int32_t	dotdot_ino;
+	int16_t		dotdot_reclen;
+	u_int16_t	dotdot_namlen;
+	char		dotdot_name[4];	/* ditto */
+};
+#endif
+
+/*
+ * Inodes
+ */
+
+/*
+ * A dinode contains all the meta-data associated with a LFS file.
+ * This structure defines the on-disk format of a dinode. Since
+ * this structure describes an on-disk structure, all its fields
+ * are defined by types with precise widths.
+ */
+
+struct lfs32_dinode {
+	u_int16_t	di_mode;	/*   0: IFMT, permissions; see below. */
+	int16_t		di_nlink;	/*   2: File link count. */
+	u_int32_t	di_inumber;	/*   4: Inode number. */
+	u_int64_t	di_size;	/*   8: File byte count. */
+	int32_t		di_atime;	/*  16: Last access time. */
+	int32_t		di_atimensec;	/*  20: Last access time. */
+	int32_t		di_mtime;	/*  24: Last modified time. */
+	int32_t		di_mtimensec;	/*  28: Last modified time. */
+	int32_t		di_ctime;	/*  32: Last inode change time. */
+	int32_t		di_ctimensec;	/*  36: Last inode change time. */
+	int32_t		di_db[ULFS_NDADDR]; /*  40: Direct disk blocks. */
+	int32_t		di_ib[ULFS_NIADDR]; /*  88: Indirect disk blocks. */
+	u_int32_t	di_flags;	/* 100: Status flags (chflags). */
+	u_int32_t	di_blocks;	/* 104: Blocks actually held. */
+	int32_t		di_gen;		/* 108: Generation number. */
+	u_int32_t	di_uid;		/* 112: File owner. */
+	u_int32_t	di_gid;		/* 116: File group. */
+	u_int64_t	di_modrev;	/* 120: i_modrev for NFSv4 */
+};
+
+struct lfs64_dinode {
+	u_int16_t	di_mode;	/*   0: IFMT, permissions; see below. */
+	int16_t		di_nlink;	/*   2: File link count. */
+	u_int32_t	di_uid;		/*   4: File owner. */
+	u_int32_t	di_gid;		/*   8: File group. */
+	u_int32_t	di_blksize;	/*  12: Inode blocksize. */
+	u_int64_t	di_size;	/*  16: File byte count. */
+	u_int64_t	di_blocks;	/*  24: Bytes actually held. */
+	int64_t		di_atime;	/*  32: Last access time. */
+	int64_t		di_mtime;	/*  40: Last modified time. */
+	int64_t		di_ctime;	/*  48: Last inode change time. */
+	int64_t		di_birthtime;	/*  56: Inode creation time. */
+	int32_t		di_mtimensec;	/*  64: Last modified time. */
+	int32_t		di_atimensec;	/*  68: Last access time. */
+	int32_t		di_ctimensec;	/*  72: Last inode change time. */
+	int32_t		di_birthnsec;	/*  76: Inode creation time. */
+	int32_t		di_gen;		/*  80: Generation number. */
+	u_int32_t	di_kernflags;	/*  84: Kernel flags. */
+	u_int32_t	di_flags;	/*  88: Status flags (chflags). */
+	int32_t		di_extsize;	/*  92: External attributes block. */
+	int64_t		di_extb[ULFS_NXADDR];/* 96: External attributes block. */
+	int64_t		di_db[ULFS_NDADDR]; /* 112: Direct disk blocks. */
+	int64_t		di_ib[ULFS_NIADDR]; /* 208: Indirect disk blocks. */
+	u_int64_t	di_modrev;	/* 232: i_modrev for NFSv4 */
+	u_int64_t	di_inumber;	/* 240: Inode number */
+	u_int64_t	di_spare[1];	/* 244: Reserved; currently unused */
+};
+
+union lfs_dinode {
+	struct lfs64_dinode u_64;
+	struct lfs32_dinode u_32;
+};
+
+/*
+ * The di_db fields may be overlaid with other information for
+ * file types that do not have associated disk storage. Block
+ * and character devices overlay the first data block with their
+ * dev_t value. Short symbolic links place their path in the
+ * di_db area.
+ */
+#define	di_rdev		di_db[0]
+
+/* Size of the on-disk inode. */
+//#define	LFS_DINODE1_SIZE	(sizeof(struct ulfs1_dinode))	/* 128 */
+//#define	LFS_DINODE2_SIZE	(sizeof(struct ulfs2_dinode))
+
+/* File types, found in the upper bits of di_mode. */
+#define	LFS_IFMT	0170000		/* Mask of file type. */
+#define	LFS_IFIFO	0010000		/* Named pipe (fifo). */
+#define	LFS_IFCHR	0020000		/* Character device. */
+#define	LFS_IFDIR	0040000		/* Directory file. */
+#define	LFS_IFBLK	0060000		/* Block device. */
+#define	LFS_IFREG	0100000		/* Regular file. */
+#define	LFS_IFLNK	0120000		/* Symbolic link. */
+#define	LFS_IFSOCK	0140000		/* UNIX domain socket. */
+#define	LFS_IFWHT	0160000		/* Whiteout. */
+
+/*
+ * "struct buf" associated definitions
+ */
+
+/* Unassigned disk addresses. */
+#define	UNASSIGNED	-1
+#define UNWRITTEN	-2
+
+/* Unused logical block number */
+#define LFS_UNUSED_LBN	-1
+
+/*
+ * "struct inode" associated definitions
+ */
+
+/* For convenience */
+#define IN_ALLMOD (IN_MODIFIED|IN_ACCESS|IN_CHANGE|IN_UPDATE|IN_MODIFY|IN_ACCESSED|IN_CLEANING)
+
+/*
+ * On-disk and in-memory checkpoint segment usage structure.
+ */
+typedef struct segusage SEGUSE;
+struct segusage {
+	u_int32_t su_nbytes;		/* 0: number of live bytes */
+	u_int32_t su_olastmod;		/* 4: SEGUSE last modified timestamp */
+	u_int16_t su_nsums;		/* 8: number of summaries in segment */
+	u_int16_t su_ninos;		/* 10: number of inode blocks in seg */
+
+#define	SEGUSE_ACTIVE		0x01	/*  segment currently being written */
+#define	SEGUSE_DIRTY		0x02	/*  segment has data in it */
+#define	SEGUSE_SUPERBLOCK	0x04	/*  segment contains a superblock */
+#define SEGUSE_ERROR		0x08	/*  cleaner: do not clean segment */
+#define SEGUSE_EMPTY		0x10	/*  segment is empty */
+#define SEGUSE_INVAL		0x20	/*  segment is invalid */
+	u_int32_t su_flags;		/* 12: segment flags */
+	u_int64_t su_lastmod;		/* 16: last modified timestamp */
+};
+
+typedef struct segusage_v1 SEGUSE_V1;
+struct segusage_v1 {
+	u_int32_t su_nbytes;		/* 0: number of live bytes */
+	u_int32_t su_lastmod;		/* 4: SEGUSE last modified timestamp */
+	u_int16_t su_nsums;		/* 8: number of summaries in segment */
+	u_int16_t su_ninos;		/* 10: number of inode blocks in seg */
+	u_int32_t su_flags;		/* 12: segment flags  */
+};
+
+/*
+ * On-disk file information.  One per file with data blocks in the segment.
+ *
+ * The FINFO structure is a header; it is followed by fi_nblocks block
+ * pointers, which are logical block numbers of the file. (These are the
+ * blocks of the file present in this segment.)
+ */
+
+typedef struct finfo64 FINFO64;
+struct finfo64 {
+	u_int32_t fi_nblocks;		/* number of blocks */
+	u_int32_t fi_version;		/* version number */
+	u_int64_t fi_ino;		/* inode number */
+	u_int32_t fi_lastlength;	/* length of last block in array */
+	u_int32_t fi_pad;		/* unused */
+};
+
+typedef struct finfo32 FINFO32;
+struct finfo32 {
+	u_int32_t fi_nblocks;		/* number of blocks */
+	u_int32_t fi_version;		/* version number */
+	u_int32_t fi_ino;		/* inode number */
+	u_int32_t fi_lastlength;	/* length of last block in array */
+};
+
+typedef union finfo {
+	struct finfo64 u_64;
+	struct finfo32 u_32;
+} FINFO;
+
+/*
+ * inode info (part of the segment summary)
+ *
+ * Each one of these is just a block number; wrapping the structure
+ * around it gives more contextual information in the code about
+ * what's going on.
+ */
+
+typedef struct iinfo64 {
+	uint64_t ii_block;		/* block number */
+} IINFO64;
+
+typedef struct iinfo32 {
+	uint32_t ii_block;		/* block number */
+} IINFO32;
+
+typedef union iinfo {
+	struct iinfo64 u_64;
+	struct iinfo32 u_32;
+} IINFO;
+
+/*
+ * Index file inode entries.
+ */
+
+/* magic value for daddrs */
+#define	LFS_UNUSED_DADDR	0	/* out-of-band daddr */
+/* magic value for if_nextfree */
+#define LFS_ORPHAN_NEXTFREE	(~(u_int32_t)0) /* indicate orphaned file */
+
+typedef struct ifile64 IFILE64;
+struct ifile64 {
+	u_int32_t if_version;		/* inode version number */
+	u_int32_t if_atime_nsec;	/* and nanoseconds */
+	u_int64_t if_atime_sec;		/* Last access time, seconds */
+	int64_t	  if_daddr;		/* inode disk address */
+	u_int64_t if_nextfree;		/* next-unallocated inode */
+};
+
+typedef struct ifile32 IFILE32;
+struct ifile32 {
+	u_int32_t if_version;		/* inode version number */
+	int32_t	  if_daddr;		/* inode disk address */
+	u_int32_t if_nextfree;		/* next-unallocated inode */
+	u_int32_t if_atime_sec;		/* Last access time, seconds */
+	u_int32_t if_atime_nsec;	/* and nanoseconds */
+};
+
+typedef struct ifile_v1 IFILE_V1;
+struct ifile_v1 {
+	u_int32_t if_version;		/* inode version number */
+	int32_t	  if_daddr;		/* inode disk address */
+	u_int32_t if_nextfree;		/* next-unallocated inode */
+#if LFS_ATIME_IFILE
+#error "this cannot work"
+	struct timespec if_atime;	/* Last access time */
+#endif
+};
+
+/*
+ * Note: struct ifile_v1 is often handled by accessing the first three
+ * fields of struct ifile32. (XXX: Blah.  This should be cleaned up as
+ * it may in some cases violate the strict-aliasing rules.)
+ */
+typedef union ifile {
+	struct ifile64 u_64;
+	struct ifile32 u_32;
+	struct ifile_v1 u_v1;
+} IFILE;
+
+/*
+ * Cleaner information structure.  This resides in the ifile and is used
+ * to pass information from the kernel to the cleaner.
+ */
+
+/* flags for ->flags */
+#define LFS_CLEANER_MUST_CLEAN	0x01
+
+typedef struct _cleanerinfo32 {
+	u_int32_t clean;		/* 0: number of clean segments */
+	u_int32_t dirty;		/* 4: number of dirty segments */
+	int32_t   bfree;		/* 8: disk blocks free */
+	int32_t	  avail;		/* 12: disk blocks available */
+	u_int32_t free_head;		/* 16: head of the inode free list */
+	u_int32_t free_tail;		/* 20: tail of the inode free list */
+	u_int32_t flags;		/* 24: status word from the kernel */
+} CLEANERINFO32;
+
+typedef struct _cleanerinfo64 {
+	u_int32_t clean;		/* 0: number of clean segments */
+	u_int32_t dirty;		/* 4: number of dirty segments */
+	int64_t   bfree;		/* 8: disk blocks free */
+	int64_t	  avail;		/* 16: disk blocks available */
+	u_int64_t free_head;		/* 24: head of the inode free list */
+	u_int64_t free_tail;		/* 32: tail of the inode free list */
+	u_int32_t flags;		/* 40: status word from the kernel */
+	u_int32_t pad;			/* 44: must be 64-bit aligned */
+} CLEANERINFO64;
+
+/* this must not go to disk directly of course */
+typedef union _cleanerinfo {
+	CLEANERINFO32 u_32;
+	CLEANERINFO64 u_64;
+} CLEANERINFO;
+
+/*
+ * On-disk segment summary information
+ */
+
+/* magic value for ss_magic */
+#define SS_MAGIC	0x061561
+
+/* flags for ss_flags */
+#define	SS_DIROP	0x01		/* segment begins a dirop */
+#define	SS_CONT		0x02		/* more partials to finish this write*/
+#define	SS_CLEAN	0x04		/* written by the cleaner */
+#define	SS_RFW		0x08		/* written by the roll-forward agent */
+#define	SS_RECLAIM	0x10		/* written by the roll-forward agent */
+
+/* type used for reading checksum signatures from metadata structures */
+typedef uint32_t lfs_checkword;
+
+typedef struct segsum_v1 SEGSUM_V1;
+struct segsum_v1 {
+	u_int32_t ss_sumsum;		/* 0: check sum of summary block */
+	u_int32_t ss_datasum;		/* 4: check sum of data */
+	u_int32_t ss_magic;		/* 8: segment summary magic number */
+	int32_t	  ss_next;		/* 12: next segment */
+	u_int32_t ss_create;		/* 16: creation time stamp */
+	u_int16_t ss_nfinfo;		/* 20: number of file info structures */
+	u_int16_t ss_ninos;		/* 22: number of inodes in summary */
+	u_int16_t ss_flags;		/* 24: used for directory operations */
+	u_int16_t ss_pad;		/* 26: extra space */
+	/* FINFO's and inode daddr's... */
+};
+
+typedef struct segsum32 SEGSUM32;
+struct segsum32 {
+	u_int32_t ss_sumsum;		/* 0: check sum of summary block */
+	u_int32_t ss_datasum;		/* 4: check sum of data */
+	u_int32_t ss_magic;		/* 8: segment summary magic number */
+	int32_t	  ss_next;		/* 12: next segment (disk address) */
+	u_int32_t ss_ident;		/* 16: roll-forward fsid */
+	u_int16_t ss_nfinfo;		/* 20: number of file info structures */
+	u_int16_t ss_ninos;		/* 22: number of inodes in summary */
+	u_int16_t ss_flags;		/* 24: used for directory operations */
+	u_int8_t  ss_pad[2];		/* 26: extra space */
+	u_int32_t ss_reclino;           /* 28: inode being reclaimed */
+	u_int64_t ss_serial;		/* 32: serial number */
+	u_int64_t ss_create;		/* 40: time stamp */
+	/* FINFO's and inode daddr's... */
+};
+
+typedef struct segsum64 SEGSUM64;
+struct segsum64 {
+	u_int32_t ss_sumsum;		/* 0: check sum of summary block */
+	u_int32_t ss_datasum;		/* 4: check sum of data */
+	u_int32_t ss_magic;		/* 8: segment summary magic number */
+	u_int32_t ss_ident;		/* 12: roll-forward fsid */
+	int64_t	  ss_next;		/* 16: next segment (disk address) */
+	u_int16_t ss_nfinfo;		/* 24: number of file info structures */
+	u_int16_t ss_ninos;		/* 26: number of inodes in summary */
+	u_int16_t ss_flags;		/* 28: used for directory operations */
+	u_int8_t  ss_pad[2];		/* 30: extra space */
+	u_int64_t ss_reclino;           /* 32: inode being reclaimed */
+	u_int64_t ss_serial;		/* 40: serial number */
+	u_int64_t ss_create;		/* 48: time stamp */
+	/* FINFO's and inode daddr's... */
+};
+
+typedef union segsum SEGSUM;
+union segsum {
+	struct segsum64 u_64;
+	struct segsum32 u_32;
+	struct segsum_v1 u_v1;
+};
+
+
+/*
+ * On-disk super block.
+ *
+ * We have separate superblock structures for the 32-bit and 64-bit
+ * LFS, and accessor functions to hide the differences.
+ *
+ * For lfs64, the format version is always 2; version 1 lfs is old.
+ * For both, the inode format version is 0; for lfs32 this selects the
+ * same 32-bit inode as always, and for lfs64 this selects the larger
+ * 64-bit inode structure we got from ffsv2.
+ *
+ * In lfs64:
+ *   - inode numbers are still 32 bit
+ *   - segments may not be larger than 4G (counted in bytes)
+ *   - there may not be more than 2^32 (or perhaps 2^31) segments
+ *   - the total volume size is limited to 2^63 frags and/or 2^63
+ *     disk blocks, and probably in practice 2^63 bytes.
+ */
+
+#define	       LFS_MAGIC       		0x070162
+#define        LFS_MAGIC_SWAPPED	0x62010700
+
+#define        LFS64_MAGIC     		0x19620701
+#define        LFS64_MAGIC_SWAPPED      0x01076219
+
+#define	       LFS_VERSION     		2
+
+#define LFS_MIN_SBINTERVAL     5	/* min superblock segment spacing */
+#define LFS_MAXNUMSB	       10	/* max number of superblocks */
+
+/* flags for dlfs_pflags */
+#define LFS_PF_CLEAN 0x1
+
+/* Inode format versions */
+#define LFS_44INODEFMT 0
+#define LFS_MAXINODEFMT 0
+
+struct dlfs {
+	u_int32_t dlfs_magic;	  /* 0: magic number */
+	u_int32_t dlfs_version;	  /* 4: version number */
+
+	u_int32_t dlfs_size;	  /* 8: number of blocks in fs (v1) */
+				  /*	number of frags in fs (v2) */
+	u_int32_t dlfs_ssize;	  /* 12: number of blocks per segment (v1) */
+				  /*	 number of bytes per segment (v2) */
+	u_int32_t dlfs_dsize;	  /* 16: number of disk blocks in fs */
+	u_int32_t dlfs_bsize;	  /* 20: file system block size */
+	u_int32_t dlfs_fsize;	  /* 24: size of frag blocks in fs */
+	u_int32_t dlfs_frag;	  /* 28: number of frags in a block in fs */
+
+/* Checkpoint region. */
+	u_int32_t dlfs_freehd;	  /* 32: start of the free inode list */
+	int32_t   dlfs_bfree;	  /* 36: number of free frags */
+	u_int32_t dlfs_nfiles;	  /* 40: number of allocated inodes */
+	int32_t	  dlfs_avail;	  /* 44: blocks available for writing */
+	int32_t	  dlfs_uinodes;	  /* 48: inodes in cache not yet on disk */
+	int32_t	  dlfs_idaddr;	  /* 52: inode file disk address */
+	u_int32_t dlfs_ifile;	  /* 56: inode file inode number */
+	int32_t	  dlfs_lastseg;	  /* 60: address of last segment written */
+	int32_t	  dlfs_nextseg;	  /* 64: address of next segment to write */
+	int32_t	  dlfs_curseg;	  /* 68: current segment being written */
+	int32_t	  dlfs_offset;	  /* 72: offset in curseg for next partial */
+	int32_t	  dlfs_lastpseg;  /* 76: address of last partial written */
+	u_int32_t dlfs_inopf;	  /* 80: v1: time stamp; v2: inodes per frag */
+
+/* These are configuration parameters. */
+	u_int32_t dlfs_minfree;	  /* 84: minimum percentage of free blocks */
+
+/* These fields can be computed from the others. */
+	u_int64_t dlfs_maxfilesize; /* 88: maximum representable file size */
+	u_int32_t dlfs_fsbpseg;	    /* 96: frags (fsb) per segment */
+	u_int32_t dlfs_inopb;	  /* 100: inodes per block */
+	u_int32_t dlfs_ifpb;	  /* 104: IFILE entries per block */
+	u_int32_t dlfs_sepb;	  /* 108: SEGUSE entries per block */
+	u_int32_t dlfs_nindir;	  /* 112: indirect pointers per block */
+	u_int32_t dlfs_nseg;	  /* 116: number of segments */
+	u_int32_t dlfs_nspf;	  /* 120: number of sectors per fragment */
+	u_int32_t dlfs_cleansz;	  /* 124: cleaner info size in blocks */
+	u_int32_t dlfs_segtabsz;  /* 128: segment table size in blocks */
+	u_int32_t dlfs_segmask;	  /* 132: calculate offset within a segment */
+	u_int32_t dlfs_segshift;  /* 136: fast mult/div for segments */
+	u_int32_t dlfs_bshift;	  /* 140: calc block number from file offset */
+	u_int32_t dlfs_ffshift;	  /* 144: fast mult/div for frag from file */
+	u_int32_t dlfs_fbshift;	  /* 148: fast mult/div for frag from block */
+	u_int64_t dlfs_bmask;	  /* 152: calc block offset from file offset */
+	u_int64_t dlfs_ffmask;	  /* 160: calc frag offset from file offset */
+	u_int64_t dlfs_fbmask;	  /* 168: calc frag offset from block offset */
+	u_int32_t dlfs_blktodb;	  /* 176: blktodb and dbtoblk shift constant */
+	u_int32_t dlfs_sushift;	  /* 180: fast mult/div for segusage table */
+
+	int32_t	  dlfs_maxsymlinklen; /* 184: max length of an internal symlink */
+				  /* 188: superblock disk offsets */
+	int32_t	  dlfs_sboffs[LFS_MAXNUMSB];
+
+	u_int32_t dlfs_nclean;	  /* 228: Number of clean segments */
+	u_char	  dlfs_fsmnt[MNAMELEN];	 /* 232: name mounted on */
+	u_int16_t dlfs_pflags;	  /* 322: file system persistent flags */
+	int32_t	  dlfs_dmeta;	  /* 324: total number of dirty summaries */
+	u_int32_t dlfs_minfreeseg; /* 328: segments not counted in bfree */
+	u_int32_t dlfs_sumsize;	  /* 332: size of summary blocks */
+	u_int64_t dlfs_serial;	  /* 336: serial number */
+	u_int32_t dlfs_ibsize;	  /* 344: size of inode blocks */
+	int32_t	  dlfs_s0addr;	  /* 348: start of segment 0 */
+	u_int64_t dlfs_tstamp;	  /* 352: time stamp */
+	u_int32_t dlfs_inodefmt;  /* 360: inode format version */
+	u_int32_t dlfs_interleave; /* 364: segment interleave */
+	u_int32_t dlfs_ident;	  /* 368: per-fs identifier */
+	u_int32_t dlfs_fsbtodb;	  /* 372: fsbtodb and dbtodsb shift constant */
+	u_int32_t dlfs_resvseg;   /* 376: segments reserved for the cleaner */
+	int8_t	  dlfs_pad[128];  /* 380: round to 512 bytes */
+/* Checksum -- last valid disk field. */
+	u_int32_t dlfs_cksum;	  /* 508: checksum for superblock checking */
+};
+
+struct dlfs64 {
+	u_int32_t dlfs_magic;	  /* 0: magic number */
+	u_int32_t dlfs_version;	  /* 4: version number (2) */
+
+	u_int64_t dlfs_size;	  /* 8: number of frags in fs (v2) */
+	u_int64_t dlfs_dsize;	  /* 16: number of disk blocks in fs */
+	u_int32_t dlfs_ssize;	  /* 24: number of bytes per segment (v2) */
+	u_int32_t dlfs_bsize;	  /* 28: file system block size */
+	u_int32_t dlfs_fsize;	  /* 32: size of frag blocks in fs */
+	u_int32_t dlfs_frag;	  /* 36: number of frags in a block in fs */
+
+/* Checkpoint region. */
+	u_int64_t dlfs_freehd;	  /* 40: start of the free inode list */
+	u_int64_t dlfs_nfiles;	  /* 48: number of allocated inodes */
+	int64_t   dlfs_bfree;	  /* 56: number of free frags */
+	int64_t	  dlfs_avail;	  /* 64: blocks available for writing */
+	int64_t	  dlfs_idaddr;	  /* 72: inode file disk address */
+	int32_t	  dlfs_uinodes;	  /* 80: inodes in cache not yet on disk */
+	u_int32_t dlfs_unused_0;  /* 84: not used */
+	int64_t	  dlfs_lastseg;	  /* 88: address of last segment written */
+	int64_t	  dlfs_nextseg;	  /* 96: address of next segment to write */
+	int64_t	  dlfs_curseg;	  /* 104: current segment being written */
+	int64_t	  dlfs_offset;	  /* 112: offset in curseg for next partial */
+	int64_t	  dlfs_lastpseg;  /* 120: address of last partial written */
+	u_int32_t dlfs_inopf;	  /* 128: inodes per frag */
+
+/* These are configuration parameters. */
+	u_int32_t dlfs_minfree;	  /* 132: minimum percentage of free blocks */
+
+/* These fields can be computed from the others. */
+	u_int64_t dlfs_maxfilesize; /* 136: maximum representable file size */
+	u_int32_t dlfs_fsbpseg;	  /* 144: frags (fsb) per segment */
+	u_int32_t dlfs_inopb;	  /* 148: inodes per block */
+	u_int32_t dlfs_ifpb;	  /* 152: IFILE entries per block */
+	u_int32_t dlfs_sepb;	  /* 156: SEGUSE entries per block */
+	u_int32_t dlfs_nindir;	  /* 160: indirect pointers per block */
+	u_int32_t dlfs_nseg;	  /* 164: number of segments */
+	u_int32_t dlfs_nspf;	  /* 168: number of sectors per fragment */
+	u_int32_t dlfs_cleansz;	  /* 172: cleaner info size in blocks */
+	u_int32_t dlfs_segtabsz;  /* 176: segment table size in blocks */
+	u_int32_t dlfs_bshift;	  /* 180: calc block number from file offset */
+	u_int32_t dlfs_ffshift;	  /* 184: fast mult/div for frag from file */
+	u_int32_t dlfs_fbshift;	  /* 188: fast mult/div for frag from block */
+	u_int64_t dlfs_bmask;	  /* 192: calc block offset from file offset */
+	u_int64_t dlfs_ffmask;	  /* 200: calc frag offset from file offset */
+	u_int64_t dlfs_fbmask;	  /* 208: calc frag offset from block offset */
+	u_int32_t dlfs_blktodb;	  /* 216: blktodb and dbtoblk shift constant */
+	u_int32_t dlfs_sushift;	  /* 220: fast mult/div for segusage table */
+
+				  /* 224: superblock disk offsets */
+	int64_t	   dlfs_sboffs[LFS_MAXNUMSB];
+
+	int32_t	  dlfs_maxsymlinklen; /* 304: max len of an internal symlink */
+	u_int32_t dlfs_nclean;	  /* 308: Number of clean segments */
+	u_char	  dlfs_fsmnt[MNAMELEN];	 /* 312: name mounted on */
+	u_int16_t dlfs_pflags;	  /* 402: file system persistent flags */
+	int32_t	  dlfs_dmeta;	  /* 404: total number of dirty summaries */
+	u_int32_t dlfs_minfreeseg; /* 408: segments not counted in bfree */
+	u_int32_t dlfs_sumsize;	  /* 412: size of summary blocks */
+	u_int32_t dlfs_ibsize;	  /* 416: size of inode blocks */
+	u_int32_t dlfs_inodefmt;  /* 420: inode format version */
+	u_int64_t dlfs_serial;	  /* 424: serial number */
+	int64_t	  dlfs_s0addr;	  /* 432: start of segment 0 */
+	u_int64_t dlfs_tstamp;	  /* 440: time stamp */
+	u_int32_t dlfs_interleave; /* 448: segment interleave */
+	u_int32_t dlfs_ident;	  /* 452: per-fs identifier */
+	u_int32_t dlfs_fsbtodb;	  /* 456: fsbtodb and dbtodsb shift constant */
+	u_int32_t dlfs_resvseg;   /* 460: segments reserved for the cleaner */
+	int8_t	  dlfs_pad[44];   /* 464: round to 512 bytes */
+/* Checksum -- last valid disk field. */
+	u_int32_t dlfs_cksum;	  /* 508: checksum for superblock checking */
+};
+
+/* Type used for the inode bitmap */
+typedef u_int32_t lfs_bm_t;
+
+/*
+ * Linked list of segments whose byte count needs updating following a
+ * file truncation.
+ */
+struct segdelta {
+	long segnum;
+	size_t num;
+	LIST_ENTRY(segdelta) list;
+};
+
+/*
+ * In-memory super block.
+ */
+struct lfs {
+	union {				/* on-disk parameters */
+		struct dlfs u_32;
+		struct dlfs64 u_64;
+	} lfs_dlfs_u;
+
+/* These fields are set at mount time and are meaningless on disk. */
+	unsigned lfs_is64 : 1,		/* are we lfs64 or lfs32? */
+		lfs_dobyteswap : 1,	/* are we opposite-endian? */
+		lfs_hasolddirfmt : 1;	/* dir entries have no d_type */
+
+	struct segment *lfs_sp;		/* current segment being written */
+	struct vnode *lfs_ivnode;	/* vnode for the ifile */
+	u_int32_t  lfs_seglock;		/* single-thread the segment writer */
+	pid_t	  lfs_lockpid;		/* pid of lock holder */
+	lwpid_t	  lfs_locklwp;		/* lwp of lock holder */
+	u_int32_t lfs_iocount;		/* number of ios pending */
+	u_int32_t lfs_writer;		/* don't allow any dirops to start */
+	u_int32_t lfs_dirops;		/* count of active directory ops */
+	u_int32_t lfs_dirvcount;	/* count of VDIROP nodes in this fs */
+	u_int32_t lfs_doifile;		/* Write ifile blocks on next write */
+	u_int32_t lfs_nactive;		/* Number of segments since last ckp */
+	int8_t	  lfs_fmod;		/* super block modified flag */
+	int8_t	  lfs_ronly;		/* mounted read-only flag */
+#define LFS_NOTYET  0x01
+#define LFS_IFDIRTY 0x02
+#define LFS_WARNED  0x04
+#define LFS_UNDIROP 0x08
+	int8_t	  lfs_flags;		/* currently unused flag */
+	u_int16_t lfs_activesb;		/* toggle between superblocks */
+	daddr_t	  lfs_sbactive;		/* disk address of current sb write */
+	struct vnode *lfs_flushvp;	/* vnode being flushed */
+	int lfs_flushvp_fakevref;	/* fake vref count for flushvp */
+	struct vnode *lfs_unlockvp;	/* being inactivated in lfs_segunlock */
+	u_int32_t lfs_diropwait;	/* # procs waiting on dirop flush */
+	size_t lfs_devbsize;		/* Device block size */
+	size_t lfs_devbshift;		/* Device block shift */
+	krwlock_t lfs_fraglock;
+	krwlock_t lfs_iflock;		/* Ifile lock */
+	kcondvar_t lfs_stopcv;		/* Wrap lock */
+	struct lwp *lfs_stoplwp;
+	pid_t lfs_rfpid;		/* Process ID of roll-forward agent */
+	int	  lfs_nadirop;		/* number of active dirop nodes */
+	long	  lfs_ravail;		/* blocks pre-reserved for writing */
+	long	  lfs_favail;		/* blocks pre-reserved for writing */
+	struct lfs_res_blk *lfs_resblk;	/* Reserved memory for pageout */
+	TAILQ_HEAD(, inode) lfs_dchainhd; /* dirop vnodes */
+	TAILQ_HEAD(, inode) lfs_pchainhd; /* paging vnodes */
+#define LFS_RESHASH_WIDTH 17
+	LIST_HEAD(, lfs_res_blk) lfs_reshash[LFS_RESHASH_WIDTH];
+	int	  lfs_pdflush;		 /* pagedaemon wants us to flush */
+	u_int32_t **lfs_suflags;	/* Segment use flags */
+#ifdef _KERNEL
+	struct pool lfs_clpool;		/* Pool for struct lfs_cluster */
+	struct pool lfs_bpppool;	/* Pool for bpp */
+	struct pool lfs_segpool;	/* Pool for struct segment */
+#endif /* _KERNEL */
+#define LFS_MAX_CLEANIND 64
+	daddr_t  lfs_cleanint[LFS_MAX_CLEANIND]; /* Active cleaning intervals */
+	int 	 lfs_cleanind;		/* Index into intervals */
+	int lfs_sleepers;		/* # procs sleeping this fs */
+	int lfs_pages;			/* dirty pages blaming this fs */
+	lfs_bm_t *lfs_ino_bitmap;	/* Inuse inodes bitmap */
+	int lfs_nowrap;			/* Suspend log wrap */
+	int lfs_wrappass;		/* Allow first log wrap requester to pass */
+	int lfs_wrapstatus;		/* Wrap status */
+	int lfs_reclino;		/* Inode being reclaimed */
+	daddr_t lfs_startseg;           /* Segment we started writing at */
+	LIST_HEAD(, segdelta) lfs_segdhd;	/* List of pending trunc accounting events */
+
+#ifdef _KERNEL
+	/* ULFS-level information */
+	u_int32_t um_flags;			/* ULFS flags (below) */
+	u_long	um_nindir;			/* indirect ptrs per block */
+	u_long	um_lognindir;			/* log2 of um_nindir */
+	u_long	um_bptrtodb;			/* indir ptr to disk block */
+	u_long	um_seqinc;			/* inc between seq blocks */
+	int um_maxsymlinklen;
+	int um_dirblksiz;
+	u_int64_t um_maxfilesize;
+
+	/* Stuff used by quota2 code, not currently operable */
+	unsigned lfs_use_quota2 : 1;
+	uint32_t lfs_quota_magic;
+	uint8_t lfs_quota_flags;
+	uint64_t lfs_quotaino[2];
+
+	/* Sleep address replacing &lfs_avail inside the on-disk superblock */
+	/* XXX: should be replaced with a condvar */
+	int lfs_availsleep;
+	/* This one replaces &lfs_nextseg... all ditto */
+	int lfs_nextsegsleep;
+#endif
+};
+
+/*
+ * Structures used by lfs_bmapv and lfs_markv to communicate information
+ * about inodes and data blocks.
+ */
+typedef struct block_info {
+	u_int64_t bi_inode;		/* inode # */
+	int64_t	bi_lbn;			/* logical block w/in file */
+	int64_t	bi_daddr;		/* disk address of block */
+	u_int64_t bi_segcreate;		/* origin segment create time */
+	int	bi_version;		/* file version number */
+	int	bi_size;		/* size of the block (if fragment) */
+	void	*bi_bp;			/* data buffer */
+} BLOCK_INFO;
+
+/* Compatibility for 7.0 binaries */
+typedef struct block_info_70 {
+	u_int32_t bi_inode;		/* inode # */
+	int32_t	bi_lbn;			/* logical block w/in file */
+	int32_t	bi_daddr;		/* disk address of block */
+	u_int64_t bi_segcreate;		/* origin segment create time */
+	int	bi_version;		/* file version number */
+	void	*bi_bp;			/* data buffer */
+	int	bi_size;		/* size of the block (if fragment) */
+} BLOCK_INFO_70;
+
+/* Compatibility for 1.5 binaries */
+typedef struct block_info_15 {
+	u_int32_t bi_inode;		/* inode # */
+	int32_t	bi_lbn;			/* logical block w/in file */
+	int32_t	bi_daddr;		/* disk address of block */
+	u_int32_t bi_segcreate;		/* origin segment create time */
+	int	bi_version;		/* file version number */
+	void	*bi_bp;			/* data buffer */
+	int	bi_size;		/* size of the block (if fragment) */
+} BLOCK_INFO_15;
+
+/*
+ * 32/64-bit-clean pointer to block pointers. This points into
+ * already-existing storage; it is mostly used to access the block
+ * pointers following a FINFO.
+ */
+union lfs_blocks {
+	int64_t *b64;
+	int32_t *b32;
+};
+
+/* In-memory description of a segment about to be written. */
+struct segment {
+	struct lfs	 *fs;		/* file system pointer */
+	struct buf	**bpp;		/* pointer to buffer array */
+	struct buf	**cbpp;		/* pointer to next available bp */
+	struct buf	**start_bpp;	/* pointer to first bp in this set */
+	struct buf	 *ibp;		/* buffer pointer to inode page */
+	union lfs_dinode *idp;          /* pointer to ifile dinode */
+	FINFO *fip;			/* current fileinfo pointer */
+	struct vnode	 *vp;		/* vnode being gathered */
+	void	 *segsum;		/* segment summary info */
+	u_int32_t ninodes;		/* number of inodes in this segment */
+	int32_t seg_bytes_left;		/* bytes left in segment */
+	int32_t sum_bytes_left;		/* bytes left in summary block */
+	u_int32_t seg_number;		/* number of this segment */
+	union lfs_blocks start_lbp;	/* beginning lbn for this set */
+
+#define SEGM_CKP	0x0001		/* doing a checkpoint */
+#define SEGM_CLEAN	0x0002		/* cleaner call; don't sort */
+#define SEGM_SYNC	0x0004		/* wait for segment */
+#define SEGM_PROT	0x0008		/* don't inactivate at segunlock */
+#define SEGM_PAGEDAEMON	0x0010		/* pagedaemon called us */
+#define SEGM_WRITERD	0x0020		/* LFS writed called us */
+#define SEGM_FORCE_CKP	0x0040		/* Force checkpoint right away */
+#define SEGM_RECLAIM	0x0080		/* Writing to reclaim vnode */
+#define SEGM_SINGLE	0x0100		/* Opportunistic writevnodes */
+	u_int16_t seg_flags;		/* run-time flags for this segment */
+	u_int32_t seg_iocount;		/* number of ios pending */
+	int	  ndupino;		/* number of duplicate inodes */
+};
+
+/* Statistics Counters */
+struct lfs_stats {	/* Must match sysctl list in lfs_vfsops.h ! */
+	u_int	segsused;
+	u_int	psegwrites;
+	u_int	psyncwrites;
+	u_int	pcleanwrites;
+	u_int	blocktot;
+	u_int	cleanblocks;
+	u_int	ncheckpoints;
+	u_int	nwrites;
+	u_int	nsync_writes;
+	u_int	wait_exceeded;
+	u_int	write_exceeded;
+	u_int	flush_invoked;
+	u_int	vflush_invoked;
+	u_int	clean_inlocked;
+	u_int	clean_vnlocked;
+	u_int   segs_reclaimed;
+};
+
+/* Fcntls to take the place of the lfs syscalls */
+struct lfs_fcntl_markv {
+	BLOCK_INFO *blkiov;	/* blocks to relocate */
+	int blkcnt;		/* number of blocks (limited to 65536) */
+};
+
+#define LFCNSEGWAITALL	_FCNR_FSPRIV('L', 14, struct timeval)
+#define LFCNSEGWAIT	_FCNR_FSPRIV('L', 15, struct timeval)
+#define LFCNBMAPV	_FCNRW_FSPRIV('L', 16, struct lfs_fcntl_markv)
+#define LFCNMARKV	_FCNRW_FSPRIV('L', 17, struct lfs_fcntl_markv)
+#define LFCNRECLAIM	 _FCNO_FSPRIV('L', 4)
+
+struct lfs_fhandle {
+	char space[28];	/* FHANDLE_SIZE_COMPAT (but used from userland too) */
+};
+#define LFCNREWIND       _FCNR_FSPRIV('L', 6, int)
+#define LFCNINVAL        _FCNR_FSPRIV('L', 7, int)
+#define LFCNRESIZE       _FCNR_FSPRIV('L', 8, int)
+#define LFCNWRAPSTOP	 _FCNR_FSPRIV('L', 9, int)
+#define LFCNWRAPGO	 _FCNR_FSPRIV('L', 10, int)
+#define LFCNIFILEFH	 _FCNW_FSPRIV('L', 11, struct lfs_fhandle)
+#define LFCNWRAPPASS	 _FCNR_FSPRIV('L', 12, int)
+# define LFS_WRAP_GOING   0x0
+# define LFS_WRAP_WAITING 0x1
+#define LFCNWRAPSTATUS	 _FCNW_FSPRIV('L', 13, int)
+
+/* Debug segment lock */
+#ifdef notyet
+# define ASSERT_SEGLOCK(fs) KASSERT(LFS_SEGLOCK_HELD(fs))
+# define ASSERT_NO_SEGLOCK(fs) KASSERT(!LFS_SEGLOCK_HELD(fs))
+# define ASSERT_DUNNO_SEGLOCK(fs)
+# define ASSERT_MAYBE_SEGLOCK(fs)
+#else /* !notyet */
+# define ASSERT_DUNNO_SEGLOCK(fs) \
+	DLOG((DLOG_SEG, "lfs func %s seglock wrong (%d)\n", __func__, \
+		LFS_SEGLOCK_HELD(fs)))
+# define ASSERT_SEGLOCK(fs) do {					\
+	if (!LFS_SEGLOCK_HELD(fs)) {					\
+		DLOG((DLOG_SEG, "lfs func %s seglock wrong (0)\n", __func__)); \
+	}								\
+} while(0)
+# define ASSERT_NO_SEGLOCK(fs) do {					\
+	if (LFS_SEGLOCK_HELD(fs)) {					\
+		DLOG((DLOG_SEG, "lfs func %s seglock wrong (1)\n", __func__)); \
+	}								\
+} while(0)
+# define ASSERT_MAYBE_SEGLOCK(x)
+#endif /* !notyet */
+
+/*
+ * Arguments to mount LFS filesystems
+ */
+struct ulfs_args {
+	char	*fspec;			/* block special device to mount */
+};
+
+__BEGIN_DECLS
+void lfs_itimes(struct inode *, const struct timespec *,
+    const struct timespec *, const struct timespec *);
+__END_DECLS
+
+#endif /* !_UFS_LFS_LFS_H_ */

Property changes on: lab4/.minix-src/include/ufs/lfs/lfs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/mfs/mfs_extern.h
===================================================================
--- lab4/.minix-src/include/ufs/mfs/mfs_extern.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/mfs/mfs_extern.h	(revision 13)
@@ -0,0 +1,79 @@
+/*	$NetBSD: mfs_extern.h,v 1.31 2010/03/02 17:20:02 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)mfs_extern.h	8.4 (Berkeley) 3/30/95
+ */
+
+#ifndef _UFS_MFS_MFS_EXTERN_H_
+#define _UFS_MFS_MFS_EXTERN_H_
+
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/mallocvar.h>
+
+struct buf;
+struct mount;
+struct nameidata;
+struct proc;
+struct statvfs;
+struct vnode;
+
+__BEGIN_DECLS
+#define	mfs_ioctl	genfs_enoioctl
+
+/* mfs_vfsops.c */
+VFS_PROTOS(mfs);
+
+int	mfs_initminiroot(void *);
+
+/* mfs_vnops.c */
+int	mfs_open(void *);
+int	mfs_strategy(void *);
+void	mfs_doio(struct buf *, void *);
+int	mfs_bmap(void *);
+int	mfs_close(void *);
+int	mfs_inactive(void *);
+int	mfs_reclaim(void *);
+int	mfs_print(void *);
+int	mfs_fsync(void *);
+
+#ifdef _KERNEL
+
+#include <sys/mutex.h>
+
+extern kmutex_t	mfs_lock;
+extern void *mfs_rootbase;
+extern u_long mfs_rootsize;
+
+#endif
+
+__END_DECLS
+
+#endif /* !_UFS_MFS_MFS_EXTERN_H_ */

Property changes on: lab4/.minix-src/include/ufs/mfs/mfs_extern.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/extattr.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/extattr.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/extattr.h	(revision 13)
@@ -0,0 +1,128 @@
+/*	$NetBSD: extattr.h,v 1.11 2014/12/19 10:59:21 manu Exp $	*/
+
+/*-
+ * Copyright (c) 1999-2001 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed by Robert Watson for the TrustedBSD Project.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/ufs/ufs/extattr.h,v 1.20 2005/01/31 08:16:45 imp Exp $
+ */
+
+/*
+ * Support for file system extended attributes on the UFS1 file system.
+ * Developed by the TrustedBSD Project.
+ */
+
+#ifndef _UFS_UFS_EXTATTR_H_
+#define	_UFS_UFS_EXTATTR_H_
+
+#define	UFS_EXTATTR_MAGIC		0x00b5d5ec
+#define	UFS_EXTATTR_VERSION		0x00000003
+#define	UFS_EXTATTR_FSROOTSUBDIR	".attribute"
+#define	UFS_EXTATTR_SUBDIR_SYSTEM	"system"
+#define	UFS_EXTATTR_SUBDIR_USER		"user"
+#define	UFS_EXTATTR_MAXEXTATTRNAME	256	/* including null */
+
+#define	UFS_EXTATTR_ATTR_FLAG_INUSE	0x00000001	/* attr has been set */
+#define	UFS_EXTATTR_PERM_KERNEL		0x00000000
+#define	UFS_EXTATTR_PERM_ROOT		0x00000001
+#define	UFS_EXTATTR_PERM_OWNER		0x00000002
+#define	UFS_EXTATTR_PERM_ANYONE		0x00000003
+
+#define	UFS_EXTATTR_UEPM_INITIALIZED	0x00000001
+#define	UFS_EXTATTR_UEPM_STARTED	0x00000002
+
+#define	UFS_EXTATTR_CMD_START		EXTATTR_CMD_START
+#define	UFS_EXTATTR_CMD_STOP		EXTATTR_CMD_STOP
+#define	UFS_EXTATTR_CMD_ENABLE		0x00000003
+#define	UFS_EXTATTR_CMD_DISABLE		0x00000004
+
+struct ufs_extattr_fileheader {
+	uint32_t	uef_magic;	/* magic number for sanity checking */
+	uint32_t	uef_version;	/* version of attribute file */
+	uint32_t	uef_size;	/* size of attributes, w/o header */
+};
+
+struct ufs_extattr_header {
+	uint32_t	ueh_flags;	/* flags for attribute */
+	uint32_t	ueh_len;	/* local defined length; <= uef_size */
+	uint32_t	ueh_i_gen;	/* generation number for sanity */
+	/* data follows the header */
+};
+
+#ifdef _KERNEL
+
+#ifdef MALLOC_DECLARE
+MALLOC_DECLARE(M_EXTATTR);
+#endif
+
+struct vnode;
+LIST_HEAD(ufs_extattr_list_head, ufs_extattr_list_entry);
+struct ufs_extattr_list_entry {
+	LIST_ENTRY(ufs_extattr_list_entry)	uele_entries;
+	struct ufs_extattr_fileheader		uele_fileheader;
+	int		uele_attrnamespace;
+	char		uele_attrname[UFS_EXTATTR_MAXEXTATTRNAME];
+	struct vnode	*uele_backing_vnode;
+	int		uele_flags;
+};
+
+/* uele_flags */
+#define	UELE_F_NEEDSWAP		0x01	/* needs byte swap */
+
+#define	UELE_NEEDSWAP(uele)	((uele)->uele_flags & UELE_F_NEEDSWAP)
+
+struct lock;
+struct ufs_extattr_per_mount {
+	kmutex_t			uepm_lock;
+	struct ufs_extattr_list_head	uepm_list;
+	kauth_cred_t			uepm_ucred;
+	int				uepm_lockcnt;
+	int				uepm_flags;
+};
+
+void	ufs_extattr_uepm_init(struct ufs_extattr_per_mount *uepm);
+void	ufs_extattr_uepm_destroy(struct ufs_extattr_per_mount *uepm);
+int	ufs_extattr_start(struct mount *mp, struct lwp *l);
+int	ufs_extattr_autostart(struct mount *mp, struct lwp *l);
+void	ufs_extattr_stop(struct mount *mp, struct lwp *l);
+int	ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename,
+	    int attrnamespace, const char *attrname);
+struct vop_getextattr_args;
+int	ufs_getextattr(struct vop_getextattr_args *ap);
+struct vop_deleteextattr_args;
+int	ufs_deleteextattr(struct vop_deleteextattr_args *ap);
+struct vop_setextattr_args;
+int	ufs_setextattr(struct vop_setextattr_args *ap);
+struct vop_listextattr_args;
+int	ufs_listextattr(struct vop_listextattr_args *ap);
+void	ufs_extattr_vnode_inactive(struct vnode *vp, struct lwp *l);
+
+void	ufs_extattr_init(void);
+void	ufs_extattr_done(void);
+
+#endif /* !_KERNEL */
+
+#endif /* !_UFS_UFS_EXTATTR_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/extattr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/intr.h
===================================================================
--- lab4/.minix-src/include/x86/intr.h	(nonexistent)
+++ lab4/.minix-src/include/x86/intr.h	(revision 13)
@@ -0,0 +1,213 @@
+/*	$NetBSD: intr.h,v 1.48 2015/08/17 06:16:02 knakahara Exp $	*/
+
+/*-
+ * Copyright (c) 1998, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum, and by Jason R. Thorpe.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _X86_INTR_H_
+#define _X86_INTR_H_
+
+#define	__HAVE_FAST_SOFTINTS
+#define	__HAVE_PREEMPTION
+
+#ifdef _KERNEL
+#include <sys/types.h>
+#else
+#include <stdbool.h>
+#endif
+
+#include <sys/evcnt.h>
+#include <sys/queue.h>
+#include <machine/intrdefs.h>
+
+#ifndef _LOCORE
+#include <machine/pic.h>
+
+/*
+ * Struct describing an interrupt source for a CPU. struct cpu_info
+ * has an array of MAX_INTR_SOURCES of these. The index in the array
+ * is equal to the stub number of the stubcode as present in vector.s
+ *
+ * The primary CPU's array of interrupt sources has its first 16
+ * entries reserved for legacy ISA irq handlers. This means that
+ * they have a 1:1 mapping for arrayindex:irq_num. This is not
+ * true for interrupts that come in through IO APICs, to find
+ * their source, go through ci->ci_isources[index].is_pic
+ *
+ * It's possible to always maintain a 1:1 mapping, but that means
+ * limiting the total number of interrupt sources to MAX_INTR_SOURCES
+ * (32), instead of 32 per CPU. It also would mean that having multiple
+ * IO APICs which deliver interrupts from an equal pin number would
+ * overlap if they were to be sent to the same CPU.
+ */
+
+struct intrstub {
+	void *ist_entry;
+	void *ist_recurse; 
+	void *ist_resume;
+};
+
+struct percpu_evcnt {
+	cpuid_t cpuid;
+	uint64_t count;
+};
+
+struct intrsource {
+	int is_maxlevel;		/* max. IPL for this source */
+	int is_pin;			/* IRQ for legacy; pin for IO APIC,
+					   -1 for MSI */
+	struct intrhand *is_handlers;	/* handler chain */
+	struct pic *is_pic;		/* originating PIC */
+	void *is_recurse;		/* entry for spllower */
+	void *is_resume;		/* entry for doreti */
+	lwp_t *is_lwp;			/* for soft interrupts */
+	struct evcnt is_evcnt;		/* interrupt counter per cpu */
+	int is_flags;			/* see below */
+	int is_type;			/* level, edge */
+	int is_idtvec;
+	int is_minlevel;
+	char is_evname[32];		/* event counter name */
+	char is_intrid[INTRIDBUF];	/* intrid created by create_intrid() */
+	char is_xname[INTRDEVNAMEBUF];	/* device names */
+	cpuid_t is_active_cpu;		/* active cpuid */
+	struct percpu_evcnt *is_saved_evcnt;	/* interrupt count of deactivated cpus */
+	SIMPLEQ_ENTRY(intrsource) is_list;	/* link of intrsources */
+};
+
+#define IS_LEGACY	0x0001		/* legacy ISA irq source */
+#define IS_IPI		0x0002
+#define IS_LOG		0x0004
+
+/*
+ * Interrupt handler chains.  *_intr_establish() insert a handler into
+ * the list.  The handler is called with its (single) argument.
+ */
+
+struct intrhand {
+	int	(*ih_fun)(void *);
+	void	*ih_arg;
+	int	ih_level;
+	int	(*ih_realfun)(void *);
+	void	*ih_realarg;
+	struct	intrhand *ih_next;
+	struct	intrhand **ih_prevp;
+	int	ih_pin;
+	int	ih_slot;
+	struct cpu_info *ih_cpu;
+};
+
+#define IMASK(ci,level) (ci)->ci_imask[(level)]
+#define IUNMASK(ci,level) (ci)->ci_iunmask[(level)]
+
+#ifdef _KERNEL
+
+void Xspllower(int);
+void spllower(int);
+int splraise(int);
+void softintr(int);
+
+/*
+ * Convert spl level to local APIC level
+ */
+
+#define APIC_LEVEL(l)   ((l) << 4)
+
+/*
+ * Miscellaneous
+ */
+
+#define SPL_ASSERT_BELOW(x) KDASSERT(curcpu()->ci_ilevel < (x))
+#define	spl0()		spllower(IPL_NONE)
+#define	splx(x)		spllower(x)
+
+typedef uint8_t ipl_t;
+typedef struct {
+	ipl_t _ipl;
+} ipl_cookie_t;
+
+static inline ipl_cookie_t
+makeiplcookie(ipl_t ipl)
+{
+
+	return (ipl_cookie_t){._ipl = ipl};
+}
+
+static inline int
+splraiseipl(ipl_cookie_t icookie)
+{
+
+	return splraise(icookie._ipl);
+}
+
+#include <sys/spl.h>
+
+/*
+ * Stub declarations.
+ */
+
+void Xsoftintr(void);
+void Xpreemptrecurse(void);
+void Xpreemptresume(void);
+
+extern struct intrstub i8259_stubs[];
+extern struct intrstub ioapic_edge_stubs[];
+extern struct intrstub ioapic_level_stubs[];
+
+struct cpu_info;
+
+struct pcibus_attach_args;
+
+typedef uint64_t intr_handle_t;
+
+void intr_default_setup(void);
+void x86_nmi(void);
+void *intr_establish_xname(int, struct pic *, int, int, int, int (*)(void *),
+			   void *, bool, const char *);
+void *intr_establish(int, struct pic *, int, int, int, int (*)(void *), void *, bool);
+void intr_disestablish(struct intrhand *);
+void intr_add_pcibus(struct pcibus_attach_args *);
+const char *intr_string(intr_handle_t, char *, size_t);
+void cpu_intr_init(struct cpu_info *);
+int intr_find_mpmapping(int, int, intr_handle_t *);
+struct pic *intr_findpic(int);
+void intr_printconfig(void);
+
+struct intrsource *intr_allocate_io_intrsource(const char *);
+void intr_free_io_intrsource(const char *);
+
+int x86_send_ipi(struct cpu_info *, int);
+void x86_broadcast_ipi(int);
+void x86_ipi_handler(void);
+
+extern void (* const ipifunc[X86_NIPI])(struct cpu_info *);
+
+#endif /* _KERNEL */
+
+#endif /* !_LOCORE */
+
+#endif /* !_X86_INTR_H_ */

Property changes on: lab4/.minix-src/include/x86/intr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/mtrr.h
===================================================================
--- lab4/.minix-src/include/x86/mtrr.h	(nonexistent)
+++ lab4/.minix-src/include/x86/mtrr.h	(revision 13)
@@ -0,0 +1,152 @@
+/* $NetBSD: mtrr.h,v 1.5 2011/12/15 09:38:21 abs Exp $ */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Bill Sommerfeld
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _X86_MTRR_H_
+#define _X86_MTRR_H_
+
+#define MTRR_I686_FIXED_IDX64K	0
+#define MTRR_I686_FIXED_IDX16K	1
+#define MTRR_I686_FIXED_IDX4K	3
+
+#define MTRR_I686_NVAR_MAX	16	/* could be upto 255? */
+
+#define MTRR_I686_64K_START		0x00000
+#define MTRR_I686_16K_START		0x80000
+#define MTRR_I686_4K_START		0xc0000
+
+#define MTRR_I686_NFIXED_64K		1
+#define MTRR_I686_NFIXED_16K		2
+#define MTRR_I686_NFIXED_4K		8
+#define MTRR_I686_NFIXED		11
+#define MTRR_I686_NFIXED_SOFT_64K	(MTRR_I686_NFIXED_64K * 8)
+#define MTRR_I686_NFIXED_SOFT_16K	(MTRR_I686_NFIXED_16K * 8)
+#define MTRR_I686_NFIXED_SOFT_4K	(MTRR_I686_NFIXED_4K * 8)
+#define MTRR_I686_NFIXED_SOFT		(MTRR_I686_NFIXED * 8)
+
+#define MTRR_I686_ENABLE_MASK	0x0800
+#define MTRR_I686_FIXED_ENABLE_MASK	0x0400
+
+#define MTRR_I686_CAP_VCNT_MASK	0x00ff
+#define MTRR_I686_CAP_FIX_MASK	0x0100
+#define MTRR_I686_CAP_WC_MASK	0x0400
+
+#define MTRR_TYPE_UC		0
+#define MTRR_TYPE_WC		1
+#define MTRR_TYPE_UNDEF1	2
+#define MTRR_TYPE_UNDEF2	3
+#define MTRR_TYPE_WT		4
+#define MTRR_TYPE_WP		5
+#define MTRR_TYPE_WB		6
+
+struct mtrr_state {
+	uint32_t msraddr;
+	uint64_t msrval;
+};
+	
+#define MTRR_PRIVATE	0x0001		/* 'own' range, reset at exit */
+#define MTRR_FIXED	0x0002		/* use fixed range mtrr */
+#define MTRR_VALID	0x0004		/* entry is valid */
+
+#define MTRR_CANTSET	MTRR_FIXED
+
+#define MTRR_I686_MASK_VALID	(1 << 11)
+
+/*
+ * AMD K6 MTRRs.
+ *
+ * There are two of these MTRR-like registers in the UWCRR.
+ */
+
+#define	MTRR_K6_ADDR_SHIFT 17
+#define	MTRR_K6_ADDR	(0x7fffU << MTRR_K6_ADDR_SHIFT)
+#define	MTRR_K6_MASK_SHIFT 2
+#define	MTRR_K6_MASK	(0x7fffU << MTRR_K6_MASK_SHIFT)
+#define	MTRR_K6_WC	(1U << 1)	/* write-combine */
+#define	MTRR_K6_UC	(1U << 0)	/* uncached */
+
+#define	MTRR_K6_NVAR	2
+
+#ifdef _KERNEL
+
+#define mtrr_base_value(mtrrp) \
+    (((uint64_t)(mtrrp)->base) | ((uint64_t)(mtrrp)->type))
+#define mtrr_mask_value(mtrrp) \
+    ((~((mtrrp)->len - 1) & 0x0000000ffffff000LL))
+	
+
+#define mtrr_len(val) \
+    ((~((val) & 0x0000000ffffff000LL)+1) & 0x0000000ffffff000LL)
+#define mtrr_base(val)		((val) & 0x0000000ffffff000LL)
+#define mtrr_type(val)		((uint8_t)((val) & 0x00000000000000ffLL))
+#define mtrr_valid(val)		(((val) & MTRR_I686_MASK_VALID) != 0)
+
+struct proc;
+struct mtrr;
+
+void i686_mtrr_init_first(void);
+void k6_mtrr_init_first(void);
+
+struct mtrr_funcs {
+	void (*init_cpu)(struct cpu_info *ci);
+	void (*reload_cpu)(struct cpu_info *ci);
+	void (*clean)(struct proc *p);
+	int (*set)(struct mtrr *, int *n, struct proc *p, int flags);
+	int (*get)(struct mtrr *, int *n, struct proc *p, int flags);
+	void (*commit)(void);
+	void (*dump)(const char *tag);
+};
+
+extern struct mtrr_funcs i686_mtrr_funcs;
+extern struct mtrr_funcs k6_mtrr_funcs;
+extern struct mtrr_funcs *mtrr_funcs;
+
+#define mtrr_init_cpu(ci)	mtrr_funcs->init_cpu(ci)
+#define mtrr_reload_cpu(ci)	mtrr_funcs->reload_cpu(ci)
+#define mtrr_clean(p)		mtrr_funcs->clean(p)
+#define mtrr_set(mp,n,p,f)	mtrr_funcs->set(mp,n,p,f)
+#define mtrr_get(mp,n,p,f)	mtrr_funcs->get(mp,n,p,f)
+#define mtrr_dump(s)		mtrr_funcs->dump(s)
+#define mtrr_commit()		mtrr_funcs->commit()
+
+#define MTRR_GETSET_USER	0x0001
+#define MTRR_GETSET_KERNEL	0x0002
+
+#endif /* _KERNEL */
+
+struct mtrr {
+	uint64_t base;		/* physical base address */
+	uint64_t len;
+	uint8_t type;
+	int flags;
+	pid_t owner;		/* valid if MTRR_PRIVATE set in flags */
+};
+
+#endif /* _X86_MTRR_H_ */

Property changes on: lab4/.minix-src/include/x86/mtrr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/math.h
===================================================================
--- lab4/.minix-src/include/x86/math.h	(nonexistent)
+++ lab4/.minix-src/include/x86/math.h	(revision 13)
@@ -0,0 +1,4 @@
+/*	$NetBSD: math.h,v 1.2 2003/10/28 00:55:28 kleink Exp $	*/
+
+#define	__HAVE_LONG_DOUBLE
+#define	__HAVE_NANF

Property changes on: lab4/.minix-src/include/x86/math.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/pmap.h
===================================================================
--- lab4/.minix-src/include/x86/pmap.h	(nonexistent)
+++ lab4/.minix-src/include/x86/pmap.h	(revision 13)
@@ -0,0 +1,511 @@
+/*	$NetBSD: pmap.h,v 1.56 2015/04/03 01:04:23 riastradh Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Frank van der Linden for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+/*
+ * pmap.h: see pmap.c for the history of this pmap module.
+ */
+
+#ifndef _X86_PMAP_H_
+#define	_X86_PMAP_H_
+
+/*
+ * pl*_pi: index in the ptp page for a pde mapping a VA.
+ * (pl*_i below is the index in the virtual array of all pdes per level)
+ */
+#define pl1_pi(VA)	(((VA_SIGN_POS(VA)) & L1_MASK) >> L1_SHIFT)
+#define pl2_pi(VA)	(((VA_SIGN_POS(VA)) & L2_MASK) >> L2_SHIFT)
+#define pl3_pi(VA)	(((VA_SIGN_POS(VA)) & L3_MASK) >> L3_SHIFT)
+#define pl4_pi(VA)	(((VA_SIGN_POS(VA)) & L4_MASK) >> L4_SHIFT)
+
+/*
+ * pl*_i: generate index into pde/pte arrays in virtual space
+ *
+ * pl_i(va, X) == plX_i(va) <= pl_i_roundup(va, X)
+ */
+#define pl1_i(VA)	(((VA_SIGN_POS(VA)) & L1_FRAME) >> L1_SHIFT)
+#define pl2_i(VA)	(((VA_SIGN_POS(VA)) & L2_FRAME) >> L2_SHIFT)
+#define pl3_i(VA)	(((VA_SIGN_POS(VA)) & L3_FRAME) >> L3_SHIFT)
+#define pl4_i(VA)	(((VA_SIGN_POS(VA)) & L4_FRAME) >> L4_SHIFT)
+#define pl_i(va, lvl) \
+        (((VA_SIGN_POS(va)) & ptp_masks[(lvl)-1]) >> ptp_shifts[(lvl)-1])
+
+#define	pl_i_roundup(va, lvl)	pl_i((va)+ ~ptp_masks[(lvl)-1], (lvl))
+
+/*
+ * PTP macros:
+ *   a PTP's index is the PD index of the PDE that points to it
+ *   a PTP's offset is the byte-offset in the PTE space that this PTP is at
+ *   a PTP's VA is the first VA mapped by that PTP
+ */
+
+#define ptp_va2o(va, lvl)	(pl_i(va, (lvl)+1) * PAGE_SIZE)
+
+/* size of a PDP: usually one page, except for PAE */
+#ifdef PAE
+#define PDP_SIZE 4
+#else
+#define PDP_SIZE 1
+#endif
+
+
+#if defined(_KERNEL)
+#include <sys/kcpuset.h>
+
+/*
+ * pmap data structures: see pmap.c for details of locking.
+ */
+
+/*
+ * we maintain a list of all non-kernel pmaps
+ */
+
+LIST_HEAD(pmap_head, pmap); /* struct pmap_head: head of a pmap list */
+
+/*
+ * linked list of all non-kernel pmaps
+ */
+extern struct pmap_head pmaps;
+extern kmutex_t pmaps_lock;    /* protects pmaps */
+
+/*
+ * pool_cache(9) that PDPs are allocated from 
+ */
+extern struct pool_cache pmap_pdp_cache;
+
+/*
+ * the pmap structure
+ *
+ * note that the pm_obj contains the lock pointer, the reference count,
+ * page list, and number of PTPs within the pmap.
+ *
+ * pm_lock is the same as the lock for vm object 0.  Changes to
+ * the other objects may only be made if that lock has been taken
+ * (the other object locks are only used when uvm_pagealloc is called)
+ */
+
+struct pmap {
+	struct uvm_object pm_obj[PTP_LEVELS-1]; /* objects for lvl >= 1) */
+#define	pm_lock	pm_obj[0].vmobjlock
+	kmutex_t pm_obj_lock[PTP_LEVELS-1];	/* locks for pm_objs */
+	LIST_ENTRY(pmap) pm_list;	/* list (lck by pm_list lock) */
+	pd_entry_t *pm_pdir;		/* VA of PD (lck by object lock) */
+	paddr_t pm_pdirpa[PDP_SIZE];	/* PA of PDs (read-only after create) */
+	struct vm_page *pm_ptphint[PTP_LEVELS-1];
+					/* pointer to a PTP in our pmap */
+	struct pmap_statistics pm_stats;  /* pmap stats (lck by object lock) */
+
+#if !defined(__x86_64__)
+	vaddr_t pm_hiexec;		/* highest executable mapping */
+#endif /* !defined(__x86_64__) */
+	int pm_flags;			/* see below */
+
+	union descriptor *pm_ldt;	/* user-set LDT */
+	size_t pm_ldt_len;		/* size of LDT in bytes */
+	int pm_ldt_sel;			/* LDT selector */
+	kcpuset_t *pm_cpus;		/* mask of CPUs using pmap */
+	kcpuset_t *pm_kernel_cpus;	/* mask of CPUs using kernel part
+					 of pmap */
+	kcpuset_t *pm_xen_ptp_cpus;	/* mask of CPUs which have this pmap's
+					 ptp mapped */
+	uint64_t pm_ncsw;		/* for assertions */
+	struct vm_page *pm_gc_ptp;	/* pages from pmap g/c */
+};
+
+/* macro to access pm_pdirpa slots */
+#ifdef PAE
+#define pmap_pdirpa(pmap, index) \
+	((pmap)->pm_pdirpa[l2tol3(index)] + l2tol2(index) * sizeof(pd_entry_t))
+#else
+#define pmap_pdirpa(pmap, index) \
+	((pmap)->pm_pdirpa[0] + (index) * sizeof(pd_entry_t))
+#endif
+
+/* 
+ * flag to be used for kernel mappings: PG_u on Xen/amd64, 
+ * 0 otherwise.
+ */
+#if defined(XEN) && defined(__x86_64__)
+#define PG_k PG_u
+#else
+#define PG_k 0
+#endif
+
+/*
+ * MD flags that we use for pmap_enter and pmap_kenter_pa:
+ */
+
+/*
+ * global kernel variables
+ */
+
+/*
+ * PDPpaddr is the physical address of the kernel's PDP.
+ * - i386 non-PAE and amd64: PDPpaddr corresponds directly to the %cr3
+ * value associated to the kernel process, proc0.
+ * - i386 PAE: it still represents the PA of the kernel's PDP (L2). Due to
+ * the L3 PD, it cannot be considered as the equivalent of a %cr3 any more.
+ * - Xen: it corresponds to the PFN of the kernel's PDP.
+ */
+extern u_long PDPpaddr;
+
+extern int pmap_pg_g;			/* do we support PG_G? */
+extern long nkptp[PTP_LEVELS];
+
+/*
+ * macros
+ */
+
+#define	pmap_resident_count(pmap)	((pmap)->pm_stats.resident_count)
+#define	pmap_wired_count(pmap)		((pmap)->pm_stats.wired_count)
+
+#define pmap_clear_modify(pg)		pmap_clear_attrs(pg, PG_M)
+#define pmap_clear_reference(pg)	pmap_clear_attrs(pg, PG_U)
+#define pmap_copy(DP,SP,D,L,S)		__USE(L)
+#define pmap_is_modified(pg)		pmap_test_attrs(pg, PG_M)
+#define pmap_is_referenced(pg)		pmap_test_attrs(pg, PG_U)
+#define pmap_move(DP,SP,D,L,S)
+#define pmap_phys_address(ppn)		(x86_ptob(ppn) & ~X86_MMAP_FLAG_MASK)
+#define pmap_mmap_flags(ppn)		x86_mmap_flags(ppn)
+#define pmap_valid_entry(E) 		((E) & PG_V) /* is PDE or PTE valid? */
+
+#if defined(__x86_64__) || defined(PAE)
+#define X86_MMAP_FLAG_SHIFT	(64 - PGSHIFT)
+#else
+#define X86_MMAP_FLAG_SHIFT	(32 - PGSHIFT)
+#endif
+
+#define X86_MMAP_FLAG_MASK	0xf
+#define X86_MMAP_FLAG_PREFETCH	0x1
+
+/*
+ * prototypes
+ */
+
+void		pmap_activate(struct lwp *);
+void		pmap_bootstrap(vaddr_t);
+bool		pmap_clear_attrs(struct vm_page *, unsigned);
+bool		pmap_pv_clear_attrs(paddr_t, unsigned);
+void		pmap_deactivate(struct lwp *);
+void		pmap_page_remove(struct vm_page *);
+void		pmap_pv_remove(paddr_t);
+void		pmap_remove(struct pmap *, vaddr_t, vaddr_t);
+bool		pmap_test_attrs(struct vm_page *, unsigned);
+void		pmap_write_protect(struct pmap *, vaddr_t, vaddr_t, vm_prot_t);
+void		pmap_load(void);
+paddr_t		pmap_init_tmp_pgtbl(paddr_t);
+void		pmap_remove_all(struct pmap *);
+void		pmap_ldt_sync(struct pmap *);
+void		pmap_kremove_local(vaddr_t, vsize_t);
+
+void		pmap_emap_enter(vaddr_t, paddr_t, vm_prot_t);
+void		pmap_emap_remove(vaddr_t, vsize_t);
+void		pmap_emap_sync(bool);
+
+#define	__HAVE_PMAP_PV_TRACK	1
+void		pmap_pv_init(void);
+void		pmap_pv_track(paddr_t, psize_t);
+void		pmap_pv_untrack(paddr_t, psize_t);
+
+void		pmap_map_ptes(struct pmap *, struct pmap **, pd_entry_t **,
+		    pd_entry_t * const **);
+void		pmap_unmap_ptes(struct pmap *, struct pmap *);
+
+int		pmap_pdes_invalid(vaddr_t, pd_entry_t * const *, pd_entry_t *);
+
+u_int		x86_mmap_flags(paddr_t);
+
+bool		pmap_is_curpmap(struct pmap *);
+
+vaddr_t reserve_dumppages(vaddr_t); /* XXX: not a pmap fn */
+
+typedef enum tlbwhy {
+	TLBSHOOT_APTE,
+	TLBSHOOT_KENTER,
+	TLBSHOOT_KREMOVE,
+	TLBSHOOT_FREE_PTP1,
+	TLBSHOOT_FREE_PTP2,
+	TLBSHOOT_REMOVE_PTE,
+	TLBSHOOT_REMOVE_PTES,
+	TLBSHOOT_SYNC_PV1,
+	TLBSHOOT_SYNC_PV2,
+	TLBSHOOT_WRITE_PROTECT,
+	TLBSHOOT_ENTER,
+	TLBSHOOT_UPDATE,
+	TLBSHOOT_BUS_DMA,
+	TLBSHOOT_BUS_SPACE,
+	TLBSHOOT__MAX,
+} tlbwhy_t;
+
+void		pmap_tlb_init(void);
+void		pmap_tlb_cpu_init(struct cpu_info *);
+void		pmap_tlb_shootdown(pmap_t, vaddr_t, pt_entry_t, tlbwhy_t);
+void		pmap_tlb_shootnow(void);
+void		pmap_tlb_intr(void);
+
+#define	__HAVE_PMAP_EMAP
+
+#define PMAP_GROWKERNEL		/* turn on pmap_growkernel interface */
+#define PMAP_FORK		/* turn on pmap_fork interface */
+
+/*
+ * Do idle page zero'ing uncached to avoid polluting the cache.
+ */
+bool	pmap_pageidlezero(paddr_t);
+#define	PMAP_PAGEIDLEZERO(pa)	pmap_pageidlezero((pa))
+
+/*
+ * inline functions
+ */
+
+__inline static bool __unused
+pmap_pdes_valid(vaddr_t va, pd_entry_t * const *pdes, pd_entry_t *lastpde)
+{
+	return pmap_pdes_invalid(va, pdes, lastpde) == 0;
+}
+
+/*
+ * pmap_update_pg: flush one page from the TLB (or flush the whole thing
+ *	if hardware doesn't support one-page flushing)
+ */
+
+__inline static void __unused
+pmap_update_pg(vaddr_t va)
+{
+	invlpg(va);
+}
+
+/*
+ * pmap_update_2pg: flush two pages from the TLB
+ */
+
+__inline static void __unused
+pmap_update_2pg(vaddr_t va, vaddr_t vb)
+{
+	invlpg(va);
+	invlpg(vb);
+}
+
+/*
+ * pmap_page_protect: change the protection of all recorded mappings
+ *	of a managed page
+ *
+ * => this function is a frontend for pmap_page_remove/pmap_clear_attrs
+ * => we only have to worry about making the page more protected.
+ *	unprotecting a page is done on-demand at fault time.
+ */
+
+__inline static void __unused
+pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
+{
+	if ((prot & VM_PROT_WRITE) == 0) {
+		if (prot & (VM_PROT_READ|VM_PROT_EXECUTE)) {
+			(void) pmap_clear_attrs(pg, PG_RW);
+		} else {
+			pmap_page_remove(pg);
+		}
+	}
+}
+
+/*
+ * pmap_pv_protect: change the protection of all recorded mappings
+ *	of an unmanaged page
+ */
+
+__inline static void __unused
+pmap_pv_protect(paddr_t pa, vm_prot_t prot)
+{
+	if ((prot & VM_PROT_WRITE) == 0) {
+		if (prot & (VM_PROT_READ|VM_PROT_EXECUTE)) {
+			(void) pmap_pv_clear_attrs(pa, PG_RW);
+		} else {
+			pmap_pv_remove(pa);
+		}
+	}
+}
+
+/*
+ * pmap_protect: change the protection of pages in a pmap
+ *
+ * => this function is a frontend for pmap_remove/pmap_write_protect
+ * => we only have to worry about making the page more protected.
+ *	unprotecting a page is done on-demand at fault time.
+ */
+
+__inline static void __unused
+pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
+{
+	if ((prot & VM_PROT_WRITE) == 0) {
+		if (prot & (VM_PROT_READ|VM_PROT_EXECUTE)) {
+			pmap_write_protect(pmap, sva, eva, prot);
+		} else {
+			pmap_remove(pmap, sva, eva);
+		}
+	}
+}
+
+/*
+ * various address inlines
+ *
+ *  vtopte: return a pointer to the PTE mapping a VA, works only for
+ *  user and PT addresses
+ *
+ *  kvtopte: return a pointer to the PTE mapping a kernel VA
+ */
+
+#include <lib/libkern/libkern.h>
+
+static __inline pt_entry_t * __unused
+vtopte(vaddr_t va)
+{
+
+	KASSERT(va < VM_MIN_KERNEL_ADDRESS);
+
+	return (PTE_BASE + pl1_i(va));
+}
+
+static __inline pt_entry_t * __unused
+kvtopte(vaddr_t va)
+{
+	pd_entry_t *pde;
+
+	KASSERT(va >= VM_MIN_KERNEL_ADDRESS);
+
+	pde = L2_BASE + pl2_i(va);
+	if (*pde & PG_PS)
+		return ((pt_entry_t *)pde);
+
+	return (PTE_BASE + pl1_i(va));
+}
+
+paddr_t vtophys(vaddr_t);
+vaddr_t	pmap_map(vaddr_t, paddr_t, paddr_t, vm_prot_t);
+void	pmap_cpu_init_late(struct cpu_info *);
+bool	sse2_idlezero_page(void *);
+
+#ifdef XEN
+#include <sys/bitops.h>
+
+#define XPTE_MASK	L1_FRAME
+/* Selects the index of a PTE in (A)PTE_BASE */
+#define XPTE_SHIFT	(L1_SHIFT - ilog2(sizeof(pt_entry_t)))
+
+/* PTE access inline fuctions */
+
+/*
+ * Get the machine address of the pointed pte
+ * We use hardware MMU to get value so works only for levels 1-3
+ */
+
+static __inline paddr_t
+xpmap_ptetomach(pt_entry_t *pte)
+{
+	pt_entry_t *up_pte;
+	vaddr_t va = (vaddr_t) pte;
+
+	va = ((va & XPTE_MASK) >> XPTE_SHIFT) | (vaddr_t) PTE_BASE;
+	up_pte = (pt_entry_t *) va;
+
+	return (paddr_t) (((*up_pte) & PG_FRAME) + (((vaddr_t) pte) & (~PG_FRAME & ~VA_SIGN_MASK)));
+}
+
+/* Xen helpers to change bits of a pte */
+#define XPMAP_UPDATE_DIRECT	1	/* Update direct map entry flags too */
+
+paddr_t	vtomach(vaddr_t);
+#define vtomfn(va) (vtomach(va) >> PAGE_SHIFT)
+#endif	/* XEN */
+
+/* pmap functions with machine addresses */
+void	pmap_kenter_ma(vaddr_t, paddr_t, vm_prot_t, u_int);
+int	pmap_enter_ma(struct pmap *, vaddr_t, paddr_t, paddr_t,
+	    vm_prot_t, u_int, int);
+bool	pmap_extract_ma(pmap_t, vaddr_t, paddr_t *);
+
+/*
+ * Hooks for the pool allocator.
+ */
+#define	POOL_VTOPHYS(va)	vtophys((vaddr_t) (va))
+
+#ifdef __HAVE_DIRECT_MAP
+
+#define L4_SLOT_DIRECT		509
+#define PDIR_SLOT_DIRECT	L4_SLOT_DIRECT
+
+#define PMAP_DIRECT_BASE	(VA_SIGN_NEG((L4_SLOT_DIRECT * NBPD_L4)))
+#define PMAP_DIRECT_END		(VA_SIGN_NEG(((L4_SLOT_DIRECT + 1) * NBPD_L4)))
+
+#define PMAP_DIRECT_MAP(pa)	((vaddr_t)PMAP_DIRECT_BASE + (pa))
+#define PMAP_DIRECT_UNMAP(va)	((paddr_t)(va) - PMAP_DIRECT_BASE)
+
+/*
+ * Alternate mapping hooks for pool pages.
+ */
+#define PMAP_MAP_POOLPAGE(pa)	PMAP_DIRECT_MAP((pa))
+#define PMAP_UNMAP_POOLPAGE(va)	PMAP_DIRECT_UNMAP((va))
+
+void	pagezero(vaddr_t);
+
+#endif /* __HAVE_DIRECT_MAP */
+
+#endif /* _KERNEL */
+
+#endif /* _X86_PMAP_H_ */

Property changes on: lab4/.minix-src/include/x86/pmap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/cacheinfo.h
===================================================================
--- lab4/.minix-src/include/x86/cacheinfo.h	(nonexistent)
+++ lab4/.minix-src/include/x86/cacheinfo.h	(revision 13)
@@ -0,0 +1,364 @@
+/*	$NetBSD: cacheinfo.h,v 1.19 2014/09/09 15:11:33 msaitoh Exp $	*/
+
+#ifndef _X86_CACHEINFO_H_
+#define _X86_CACHEINFO_H_
+
+struct x86_cache_info {
+	uint8_t		cai_index;
+	uint8_t		cai_desc;
+	uint8_t		cai_associativity;
+	u_int		cai_totalsize; /* #entries for TLB, bytes for cache */
+	u_int		cai_linesize;	/*
+					 * or page size for TLB,
+					 * or prefetch size
+					 */
+#ifndef _KERNEL
+	const char	*cai_string;
+#endif
+};
+
+#define	CAI_ITLB	0		/* Instruction TLB (4K pages) */
+#define	CAI_ITLB2	1		/* Instruction TLB (2/4M pages) */
+#define	CAI_DTLB	2		/* Data TLB (4K pages) */
+#define	CAI_DTLB2	3		/* Data TLB (2/4M pages) */
+#define	CAI_ICACHE	4		/* Instruction cache */
+#define	CAI_DCACHE	5		/* Data cache */
+#define	CAI_L2CACHE	6		/* Level 2 cache */
+#define	CAI_L3CACHE	7		/* Level 3 cache */
+#define	CAI_L1_1GBITLB	8		/* L1 1GB Page instruction TLB */
+#define	CAI_L1_1GBDTLB	9		/* L1 1GB Page data TLB */
+#define CAI_L2_1GBITLB	10		/* L2 1GB Page instruction TLB */
+#define CAI_L2_1GBDTLB	11		/* L2 1GB Page data TLB */
+#define CAI_L2_ITLB	12		/* L2 Instruction TLB (4K pages) */
+#define CAI_L2_ITLB2	13		/* L2 Instruction TLB (2/4M pages) */
+#define CAI_L2_DTLB	14		/* L2 Data TLB (4K pages) */
+#define CAI_L2_DTLB2	15		/* L2 Data TLB (2/4M pages) */
+#define CAI_L2_STLB	16		/* Shared L2 TLB (4K pages) */
+#define CAI_L2_STLB2	17		/* Shared L2 TLB (4K/2M pages) */
+#define CAI_PREFETCH	18		/* Prefetch */
+
+#define	CAI_COUNT	19
+
+/*
+ * AMD Cache Info:
+ *
+ *      Barcelona, Phenom:
+ *
+ *		Function 8000.0005 L1 TLB/Cache Information
+ *		EAX -- L1 TLB 2/4MB pages
+ *		EBX -- L1 TLB 4K pages
+ *		ECX -- L1 D-cache
+ *		EDX -- L1 I-cache
+ *
+ *		Function 8000.0006 L2 TLB/Cache Information
+ *		EAX -- L2 TLB 2/4MB pages
+ *		EBX -- L2 TLB 4K pages
+ *		ECX -- L2 Unified cache
+ *		EDX -- L3 Unified Cache
+ *
+ *		Function 8000.0019 TLB 1GB Page Information
+ *		EAX -- L1 1GB pages
+ *		EBX -- L2 1GB pages
+ *		ECX -- reserved
+ *		EDX -- reserved
+ *
+ *	Athlon, Duron:
+ *
+ *		Function 8000.0005 L1 TLB/Cache Information
+ *		EAX -- L1 TLB 2/4MB pages
+ *		EBX -- L1 TLB 4K pages
+ *		ECX -- L1 D-cache
+ *		EDX -- L1 I-cache
+ *
+ *		Function 8000.0006 L2 TLB/Cache Information
+ *		EAX -- L2 TLB 2/4MB pages
+ *		EBX -- L2 TLB 4K pages
+ *		ECX -- L2 Unified cache
+ *		EDX -- reserved
+ *
+ *	K5, K6:
+ *
+ *		Function 8000.0005 L1 TLB/Cache Information
+ *		EAX -- reserved
+ *		EBX -- TLB 4K pages
+ *		ECX -- L1 D-cache
+ *		EDX -- L1 I-cache
+ *
+ *	K6-III:
+ *
+ *		Function 8000.0006 L2 Cache Information
+ *		EAX -- reserved
+ *		EBX -- reserved
+ *		ECX -- L2 Unified cache
+ *		EDX -- reserved
+ */
+
+/* L1 TLB 2/4MB pages */
+#define	AMD_L1_EAX_DTLB_ASSOC(x)	(((x) >> 24) & 0xff)
+#define	AMD_L1_EAX_DTLB_ENTRIES(x)	(((x) >> 16) & 0xff)
+#define	AMD_L1_EAX_ITLB_ASSOC(x)	(((x) >> 8)  & 0xff)
+#define	AMD_L1_EAX_ITLB_ENTRIES(x)	( (x)        & 0xff)
+
+/* L1 TLB 4K pages */
+#define	AMD_L1_EBX_DTLB_ASSOC(x)	(((x) >> 24) & 0xff)
+#define	AMD_L1_EBX_DTLB_ENTRIES(x)	(((x) >> 16) & 0xff)
+#define	AMD_L1_EBX_ITLB_ASSOC(x)	(((x) >> 8)  & 0xff)
+#define	AMD_L1_EBX_ITLB_ENTRIES(x)	( (x)        & 0xff)
+
+/* L1 Data Cache */
+#define	AMD_L1_ECX_DC_SIZE(x)		((((x) >> 24) & 0xff) * 1024)
+#define	AMD_L1_ECX_DC_ASSOC(x)		 (((x) >> 16) & 0xff)
+#define	AMD_L1_ECX_DC_LPT(x)		 (((x) >> 8)  & 0xff)
+#define	AMD_L1_ECX_DC_LS(x)		 ( (x)        & 0xff)
+
+/* L1 Instruction Cache */
+#define	AMD_L1_EDX_IC_SIZE(x)		((((x) >> 24) & 0xff) * 1024)
+#define	AMD_L1_EDX_IC_ASSOC(x)		 (((x) >> 16) & 0xff)
+#define	AMD_L1_EDX_IC_LPT(x)		 (((x) >> 8)  & 0xff)
+#define	AMD_L1_EDX_IC_LS(x)		 ( (x)        & 0xff)
+
+/* Note for L2 TLB -- if the upper 16 bits are 0, it is a unified TLB */
+
+/* L2 TLB 2/4MB pages */
+#define	AMD_L2_EAX_DTLB_ASSOC(x)	(((x) >> 28)  & 0xf)
+#define	AMD_L2_EAX_DTLB_ENTRIES(x)	(((x) >> 16)  & 0xfff)
+#define	AMD_L2_EAX_IUTLB_ASSOC(x)	(((x) >> 12)  & 0xf)
+#define	AMD_L2_EAX_IUTLB_ENTRIES(x)	( (x)         & 0xfff)
+
+/* L2 TLB 4K pages */
+#define	AMD_L2_EBX_DTLB_ASSOC(x)	(((x) >> 28)  & 0xf)
+#define	AMD_L2_EBX_DTLB_ENTRIES(x)	(((x) >> 16)  & 0xfff)
+#define	AMD_L2_EBX_IUTLB_ASSOC(x)	(((x) >> 12)  & 0xf)
+#define	AMD_L2_EBX_IUTLB_ENTRIES(x)	( (x)         & 0xfff)
+
+/* L2 Cache */
+#define	AMD_L2_ECX_C_SIZE(x)		((((x) >> 16) & 0xffff) * 1024)
+#define	AMD_L2_ECX_C_ASSOC(x)		 (((x) >> 12) & 0xf)
+#define	AMD_L2_ECX_C_LPT(x)		 (((x) >> 8)  & 0xf)
+#define	AMD_L2_ECX_C_LS(x)		 ( (x)        & 0xff)
+
+/* L3 Cache */
+#define AMD_L3_EDX_C_SIZE(x)		((((x) >> 18) & 0xffff) * 1024 * 512)
+#define AMD_L3_EDX_C_ASSOC(x)		 (((x) >> 12) & 0xff)
+#define AMD_L3_EDX_C_LPT(x)		 (((x) >> 8)  & 0xf)
+#define AMD_L3_EDX_C_LS(x)		 ( (x)        & 0xff)
+
+/* L1 TLB 1GB pages */
+#define AMD_L1_1GB_EAX_DTLB_ASSOC(x)	(((x) >> 28) & 0xf)
+#define AMD_L1_1GB_EAX_DTLB_ENTRIES(x)	(((x) >> 16) & 0xfff)
+#define AMD_L1_1GB_EAX_IUTLB_ASSOC(x)	(((x) >> 12) & 0xf)
+#define AMD_L1_1GB_EAX_IUTLB_ENTRIES(x)	( (x)        & 0xfff)
+
+/* L2 TLB 1GB pages */
+#define AMD_L2_1GB_EBX_DUTLB_ASSOC(x)	(((x) >> 28) & 0xf)
+#define AMD_L2_1GB_EBX_DUTLB_ENTRIES(x)	(((x) >> 16) & 0xfff)
+#define AMD_L2_1GB_EBX_IUTLB_ASSOC(x)	(((x) >> 12) & 0xf)
+#define AMD_L2_1GB_EBX_IUTLB_ENTRIES(x)	( (x)        & 0xfff)
+
+/*
+ * VIA Cache Info:
+ *
+ *	Nehemiah (at least)
+ *
+ *		Function 8000.0005 L1 TLB/Cache Information
+ *		EAX -- reserved
+ *		EBX -- L1 TLB 4K pages
+ *		ECX -- L1 D-cache
+ *		EDX -- L1 I-cache
+ *
+ *		Function 8000.0006 L2 Cache Information
+ *		EAX -- reserved
+ *		EBX -- reserved
+ *		ECX -- L2 Unified cache
+ *		EDX -- reserved
+ */
+
+/* L1 TLB 4K pages */
+#define	VIA_L1_EBX_DTLB_ASSOC(x)	(((x) >> 24) & 0xff)
+#define	VIA_L1_EBX_DTLB_ENTRIES(x)	(((x) >> 16) & 0xff)
+#define	VIA_L1_EBX_ITLB_ASSOC(x)	(((x) >> 8)  & 0xff)
+#define	VIA_L1_EBX_ITLB_ENTRIES(x)	( (x)        & 0xff)
+
+/* L1 Data Cache */
+#define	VIA_L1_ECX_DC_SIZE(x)		((((x) >> 24) & 0xff) * 1024)
+#define	VIA_L1_ECX_DC_ASSOC(x)		 (((x) >> 16) & 0xff)
+#define	VIA_L1_ECX_DC_LPT(x)		 (((x) >> 8)  & 0xff)
+#define	VIA_L1_ECX_DC_LS(x)		 ( (x)        & 0xff)
+
+/* L1 Instruction Cache */
+#define	VIA_L1_EDX_IC_SIZE(x)		((((x) >> 24) & 0xff) * 1024)
+#define	VIA_L1_EDX_IC_ASSOC(x)		 (((x) >> 16) & 0xff)
+#define	VIA_L1_EDX_IC_LPT(x)		 (((x) >> 8)  & 0xff)
+#define	VIA_L1_EDX_IC_LS(x)		 ( (x)        & 0xff)
+
+/* L2 Cache (pre-Nehemiah) */
+#define	VIA_L2_ECX_C_SIZE(x)		((((x) >> 24) & 0xff) * 1024)
+#define	VIA_L2_ECX_C_ASSOC(x)		 (((x) >> 16) & 0xff)
+#define	VIA_L2_ECX_C_LPT(x)		 (((x) >> 8)  & 0xff)
+#define	VIA_L2_ECX_C_LS(x)		 ( (x)        & 0xff)
+
+/* L2 Cache (Nehemiah and newer) */
+#define	VIA_L2N_ECX_C_SIZE(x)		((((x) >> 16) & 0xffff) * 1024)
+#define	VIA_L2N_ECX_C_ASSOC(x)		 (((x) >> 12) & 0xf)
+#define	VIA_L2N_ECX_C_LPT(x)		 (((x) >> 8)  & 0xf)
+#define	VIA_L2N_ECX_C_LS(x)		 ( (x)        & 0xff)
+
+#ifdef _KERNEL
+#define __CI_TBL(a,b,c,d,e,f) { a, b, c, d, e }
+#else
+#define __CI_TBL(a,b,c,d,e,f) { a, b, c, d, e, f }
+#endif
+
+/*
+ * XXX Currently organized mostly by cache type, but would be
+ * XXX easier to maintain if it were in descriptor type order.
+ */
+#define INTEL_CACHE_INFO { \
+__CI_TBL(CAI_ITLB,     0x01,    4, 32,        4 * 1024, NULL), \
+__CI_TBL(CAI_ITLB2,    0x02, 0xff,  2, 4 * 1024 * 1024, NULL), \
+__CI_TBL(CAI_DTLB,     0x03,    4, 64,        4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB2,    0x04,    4,  8, 4 * 1024 * 1024, NULL), \
+__CI_TBL(CAI_DTLB2,    0x05,    4, 32, 4 * 1024 * 1024, NULL), \
+__CI_TBL(CAI_ITLB2,    0x0b,    4,  4, 4 * 1024 * 1024, NULL), \
+__CI_TBL(CAI_ITLB,     0x4f, 0xff, 32,        4 * 1024, NULL), \
+__CI_TBL(CAI_ITLB,     0x50, 0xff, 64,        4 * 1024, "4K/4M: 64 entries"), \
+__CI_TBL(CAI_ITLB,     0x51, 0xff, 64,        4 * 1024, "4K/4M: 128 entries"),\
+__CI_TBL(CAI_ITLB,     0x52, 0xff, 64,        4 * 1024, "4K/4M: 256 entries"),\
+__CI_TBL(CAI_ITLB2,    0x55, 0xff, 64,        4 * 1024, "2M/4M: 7 entries"), \
+__CI_TBL(CAI_DTLB2,    0x56,    4, 16, 4 * 1024 * 1024, NULL), \
+__CI_TBL(CAI_DTLB,     0x57,    4, 16,        4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB,     0x59, 0xff, 16,        4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB2,    0x5a, 0xff, 64,        4 * 1024, "2M/4M: 32 entries (L0)"), \
+__CI_TBL(CAI_DTLB,     0x5b, 0xff, 64,        4 * 1024, "4K/4M: 64 entries"), \
+__CI_TBL(CAI_DTLB,     0x5c, 0xff, 64,        4 * 1024, "4K/4M: 128 entries"),\
+__CI_TBL(CAI_DTLB,     0x5d, 0xff, 64,        4 * 1024, "4K/4M: 256 entries"),\
+__CI_TBL(CAI_ITLB,     0x61, 0xff, 48,        4 * 1024, NULL), \
+__CI_TBL(CAI_L1_1GBDTLB,0x63,   4,  4,1024*1024 * 1024, NULL), \
+__CI_TBL(CAI_ITLB2,    0x76, 0xff,  8, 4 * 1024 * 1024, "2M/4M: 8 entries"), \
+__CI_TBL(CAI_DTLB,     0xa0, 0xff, 32,        4 * 1024, NULL), \
+__CI_TBL(CAI_ITLB,     0xb0,    4,128,        4 * 1024, NULL), \
+__CI_TBL(CAI_ITLB2,    0xb1,    4, 64,               0, "8 2M/4 4M entries"), \
+__CI_TBL(CAI_ITLB,     0xb2,    4, 64,        4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB,     0xb3,    4,128,        4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB,     0xb4,    4,256,        4 * 1024, NULL), \
+__CI_TBL(CAI_ITLB,     0xb5,    8, 64,        4 * 1024, NULL), \
+__CI_TBL(CAI_ITLB,     0xb6,    8,128,        4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB,     0xba,    4, 64,        4 * 1024, NULL), \
+__CI_TBL(CAI_DTLB2,    0xc0,    4,  8,        4 * 1024, "4K/4M: 8 entries"), \
+__CI_TBL(CAI_L2_STLB2, 0xc1,    8,1024,       4 * 1024, "4K/2M: 1024 entries"), \
+__CI_TBL(CAI_DTLB2,    0xc2,    4, 16,        4 * 1024, "4K/2M: 16 entries"), \
+__CI_TBL(CAI_L2_STLB,  0xc3,    6,1536,       4 * 1024, NULL), \
+__CI_TBL(CAI_L2_STLB,  0xca,    4,512,        4 * 1024, NULL), \
+__CI_TBL(CAI_ICACHE,   0x06,    4,        8 * 1024, 32, NULL), \
+__CI_TBL(CAI_ICACHE,   0x08,    4,       16 * 1024, 32, NULL), \
+__CI_TBL(CAI_ICACHE,   0x09,    4,       32 * 1024, 64, NULL), \
+__CI_TBL(CAI_DCACHE,   0x0a,    2,        8 * 1024, 32, NULL), \
+__CI_TBL(CAI_DCACHE,   0x0c,    4,       16 * 1024, 32, NULL), \
+__CI_TBL(CAI_DCACHE,   0x0d,    4,       16 * 1024, 64, NULL), \
+__CI_TBL(CAI_DCACHE,   0x0e,    6,       24 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x21,    8,      256 * 1024, 64, NULL), /* L2 (MLC) */ \
+__CI_TBL(CAI_L3CACHE,  0x22, 0xff,      512 * 1024, 64, "sectored, 4-way "), \
+__CI_TBL(CAI_L3CACHE,  0x23, 0xff, 1 * 1024 * 1024, 64, "sectored, 8-way "), \
+__CI_TBL(CAI_L2CACHE,  0x24,   16, 1 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0x25, 0xff, 2 * 1024 * 1024, 64, "sectored, 8-way "), \
+__CI_TBL(CAI_L3CACHE,  0x29, 0xff, 4 * 1024 * 1024, 64, "sectored, 8-way "), \
+__CI_TBL(CAI_DCACHE,   0x2c,    8,       32 * 1024, 64, NULL), \
+__CI_TBL(CAI_ICACHE,   0x30,    8,       32 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x39,    4,      128 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x3a,    6,      192 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x3b,    2,      128 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x3c,    4,      256 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x3d,    6,      384 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x3e,    4,      512 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x40,    0,               0,  0, "not present"), \
+__CI_TBL(CAI_L2CACHE,  0x41,    4,      128 * 1024, 32, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x42,    4,      256 * 1024, 32, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x43,    4,      512 * 1024, 32, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x44,    4, 1 * 1024 * 1024, 32, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x45,    4, 2 * 1024 * 1024, 32, NULL), \
+__CI_TBL(CAI_L3CACHE,  0x46,    4, 4 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0x47,    8, 8 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x48,   12, 3 * 1024 * 1024, 64, NULL), \
+								\
+/* 0x49 Is L2 on Xeon MP (Family 0f, Model 06), L3 otherwise */	\
+__CI_TBL(CAI_L2CACHE,  0x49,   16, 4 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0x49,   16, 4 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0x4a,   12, 6 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0x4b,   16, 8 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0x4c,   12,12 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0x4d,   16,16 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x4e,   24, 6 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_DCACHE,   0x60,    8,       16 * 1024, 64, NULL), \
+__CI_TBL(CAI_DCACHE,   0x66,    4,        8 * 1024, 64, NULL), \
+__CI_TBL(CAI_DCACHE,   0x67,    4,       16 * 1024, 64, NULL), \
+__CI_TBL(CAI_DCACHE,   0x68,    4,       32 * 1024, 64, NULL), \
+__CI_TBL(CAI_ICACHE,   0x70,    8,       12 * 1024, 64, "12K uOp cache"), \
+__CI_TBL(CAI_ICACHE,   0x71,    8,       16 * 1024, 64, "16K uOp cache"), \
+__CI_TBL(CAI_ICACHE,   0x72,    8,       32 * 1024, 64, "32K uOp cache"), \
+__CI_TBL(CAI_ICACHE,   0x73,    8,       64 * 1024, 64, "64K uOp cache"), \
+__CI_TBL(CAI_L2CACHE,  0x78,    4, 1 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x79,    8,      128 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x7a,    8,      256 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x7b,    8,      512 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x7c,    8, 1 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x7d,    8, 2 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x7f,    2,      512 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x80,    8,      512 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x82,    8,      256 * 1024, 32, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x83,    8,      512 * 1024, 32, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x84,    8, 1 * 1024 * 1024, 32, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x85,    8, 2 * 1024 * 1024, 32, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x86,    4,      512 * 1024, 64, NULL), \
+__CI_TBL(CAI_L2CACHE,  0x87,    8, 1 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xd0,    4,      512 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xd1,    4, 1 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xd2,    4, 2 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xd6,    8, 1 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xd7,    8, 2 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xd8,    8, 4 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xdc,   12, 3 *  512 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xdd,   12, 3 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xde,   12, 6 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xe2,   16, 2 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xe3,   16, 4 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xe4,   16, 8 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xea,   24,12 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xeb,   24,18 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_L3CACHE,  0xec,   24,24 * 1024 * 1024, 64, NULL), \
+__CI_TBL(CAI_PREFETCH, 0xf0,    0,               0, 64, NULL), \
+__CI_TBL(CAI_PREFETCH, 0xf1,    0,               0,128, NULL), \
+/* 0xff means no cache information in CPUID leaf 2 (and use leaf 4) */ \
+__CI_TBL(0,               0,    0,               0,  0, NULL)  \
+}
+
+#define AMD_L2CACHE_INFO { \
+__CI_TBL(0, 0x01,    1, 0, 0, NULL), \
+__CI_TBL(0, 0x02,    2, 0, 0, NULL), \
+__CI_TBL(0, 0x04,    4, 0, 0, NULL), \
+__CI_TBL(0, 0x06,    8, 0, 0, NULL), \
+__CI_TBL(0, 0x08,   16, 0, 0, NULL), \
+__CI_TBL(0, 0x0a,   32, 0, 0, NULL), \
+__CI_TBL(0, 0x0b,   48, 0, 0, NULL), \
+__CI_TBL(0, 0x0c,   64, 0, 0, NULL), \
+__CI_TBL(0, 0x0d,   96, 0, 0, NULL), \
+__CI_TBL(0, 0x0e,  128, 0, 0, NULL), \
+__CI_TBL(0, 0x0f, 0xff, 0, 0, NULL), \
+__CI_TBL(0, 0x00,    0, 0, 0, NULL)  \
+}
+
+#define AMD_L3CACHE_INFO { \
+__CI_TBL(0, 0x01,    1, 0, 0, NULL), \
+__CI_TBL(0, 0x02,    2, 0, 0, NULL), \
+__CI_TBL(0, 0x04,    4, 0, 0, NULL), \
+__CI_TBL(0, 0x06,    8, 0, 0, NULL), \
+__CI_TBL(0, 0x08,   16, 0, 0, NULL), \
+__CI_TBL(0, 0x0a,   32, 0, 0, NULL), \
+__CI_TBL(0, 0x0b,   48, 0, 0, NULL), \
+__CI_TBL(0, 0x0c,   64, 0, 0, NULL), \
+__CI_TBL(0, 0x0d,   96, 0, 0, NULL), \
+__CI_TBL(0, 0x0e,  128, 0, 0, NULL), \
+__CI_TBL(0, 0x0f, 0xff, 0, 0, NULL), \
+__CI_TBL(0, 0x00,    0, 0, 0, NULL)  \
+}
+
+#endif /* _X86_CACHEINFO_H_ */

Property changes on: lab4/.minix-src/include/x86/cacheinfo.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/cputypes.h
===================================================================
--- lab4/.minix-src/include/x86/cputypes.h	(nonexistent)
+++ lab4/.minix-src/include/x86/cputypes.h	(revision 13)
@@ -0,0 +1,79 @@
+/*	$NetBSD: cputypes.h,v 1.4 2013/12/08 18:08:34 dsl Exp $	*/
+
+/*
+ * Copyright (c) 1993 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ */
+
+/*
+ * Classes of Processor. CPU identification code depends on
+ * this starting at 0, and having an increment of one.
+ */
+
+#define	CPUCLASS_386	0
+#define	CPUCLASS_486	1
+#define	CPUCLASS_586	2
+#define	CPUCLASS_686	3
+
+/*
+ * Kinds of Processor. Only the first 7 are used, as they are processors
+ * that might not have a cpuid instruction.
+ */
+
+#define	CPU_386SX	0	/* Intel 80386SX */
+#define	CPU_386		1	/* Intel 80386DX */
+#define	CPU_486SX	2	/* Intel 80486SX */
+#define	CPU_486		3	/* Intel 80486DX */
+#define	CPU_486DLC	4	/* Cyrix 486DLC */
+#define CPU_6x86	5	/* Cyrix/IBM 6x86 */
+#define CPU_NX586	6	/* NexGen 586 */
+#define	CPU_586		7	/* Intel P.....m (I hate lawyers; it's TM) */
+#define CPU_AM586	8	/* AMD Am486 and Am5x86 */
+#define CPU_K5		9	/* AMD K5 */
+#define CPU_K6		10	/* NexGen 686 aka AMD K6 */
+#define CPU_686		11	/* Intel Pentium Pro */
+#define CPU_C6		12	/* IDT WinChip C6 */
+#define CPU_TMX86	13	/* Transmeta TMx86 */
+
+/*
+ * CPU vendors
+ */
+
+#define CPUVENDOR_UNKNOWN	0
+#define CPUVENDOR_INTEL		1
+#define CPUVENDOR_CYRIX		2	
+#define CPUVENDOR_NEXGEN	3
+#define CPUVENDOR_AMD		4
+#define CPUVENDOR_IDT		5
+#define CPUVENDOR_TRANSMETA	6
+#define CPUVENDOR_VORTEX86	7
+
+/*
+ * Some other defines, dealing with values returned by cpuid.
+ */
+
+#define CPU_MINFAMILY	 4	/* Lowest that cpuid can return (486) */
+#define CPU_MAXFAMILY	 7	/* Highest consecutive # we know (fake P4) */
+#define CPU_FAMILY_P4	15	/* Family number for Pentium 4 */

Property changes on: lab4/.minix-src/include/x86/cputypes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/ieee.h
===================================================================
--- lab4/.minix-src/include/x86/ieee.h	(nonexistent)
+++ lab4/.minix-src/include/x86/ieee.h	(revision 13)
@@ -0,0 +1,117 @@
+/*	$NetBSD: ieee.h,v 1.11 2010/09/15 16:11:28 christos Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ieee.h	8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * ieee.h defines the machine-dependent layout of the machine's IEEE
+ * floating point.  It does *not* define (yet?) any of the rounding
+ * mode bits, exceptions, and so forth.
+ */
+
+#include <sys/ieee754.h>
+
+#define	EXT_EXPBITS	15
+#define EXT_FRACHBITS	32
+#define	EXT_FRACLBITS	32
+#define	EXT_FRACBITS	(EXT_FRACLBITS + EXT_FRACHBITS)
+
+#define	EXT_TO_ARRAY32(u, a) do {			\
+	(a)[0] = (uint32_t)(u).extu_ext.ext_fracl;	\
+	(a)[1] = (uint32_t)(u).extu_ext.ext_frach;	\
+} while(/*CONSTCOND*/0)
+
+/*
+ * struct ieee_ext is the raw storage layout of the 80-bit
+ * extended-precision type as implemented by the FPU.  Per the
+ * respective ABI specifications, it is followed by a tail padding of
+ *
+ *   amd64: 48 bits,
+ *   i386:  16 bits.
+ */
+struct ieee_ext {
+	u_int	ext_fracl:EXT_FRACLBITS;
+	u_int	ext_frach:EXT_FRACHBITS;
+#if 0
+	u_int	ext_int:1;
+#endif
+	u_int	ext_exp:EXT_EXPBITS;
+	u_int	ext_sign:1;
+};
+
+/*
+ * Floats whose exponent is in [1..INFNAN) (of whatever type) are
+ * `normal'.  Floats whose exponent is INFNAN are either Inf or NaN.
+ * Floats whose exponent is zero are either zero (iff all fraction
+ * bits are zero) or subnormal values.
+ *
+ * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
+ * high fraction; if the bit is set, it is a `quiet NaN'.
+ */
+#define	EXT_EXP_INFNAN	0x7fff
+#define	EXT_EXP_INF	0x7fff
+#define	EXT_EXP_NAN	0x7fff
+
+#if 0
+#define	SNG_QUIETNAN	(1 << 22)
+#define	DBL_QUIETNAN	(1 << 19)
+#define	EXT_QUIETNAN	(1 << 30)
+#endif
+
+/*
+ * Exponent biases.
+ */
+#define	EXT_EXP_BIAS	16383
+
+/*
+ * Convenience data structures.
+ */
+union ieee_ext_u {
+	long double		extu_ld;
+	struct ieee_ext		extu_ext;
+};
+
+#define extu_exp	extu_ext.ext_exp
+#define extu_sign	extu_ext.ext_sign
+#define extu_fracl	extu_ext.ext_fracl
+#define extu_frach	extu_ext.ext_frach
+
+#define LDBL_NBIT	0x80000000
+#define mask_nbit_l(u)	((u).extu_frach &= ~LDBL_NBIT)

Property changes on: lab4/.minix-src/include/x86/ieee.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/lock.h
===================================================================
--- lab4/.minix-src/include/x86/lock.h	(nonexistent)
+++ lab4/.minix-src/include/x86/lock.h	(revision 13)
@@ -0,0 +1,178 @@
+/*	$NetBSD: lock.h,v 1.27 2013/01/22 22:09:44 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2000, 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe and Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Machine-dependent spin lock operations.
+ */
+
+#ifndef _X86_LOCK_H_
+#define	_X86_LOCK_H_
+
+#include <sys/param.h>
+
+static __inline int
+__SIMPLELOCK_LOCKED_P(__cpu_simple_lock_t *__ptr)
+{
+	return *__ptr == __SIMPLELOCK_LOCKED;
+}
+
+static __inline int
+__SIMPLELOCK_UNLOCKED_P(__cpu_simple_lock_t *__ptr)
+{
+	return *__ptr == __SIMPLELOCK_UNLOCKED;
+}
+
+static __inline void
+__cpu_simple_lock_set(__cpu_simple_lock_t *__ptr)
+{
+
+	*__ptr = __SIMPLELOCK_LOCKED;
+}
+
+static __inline void
+__cpu_simple_lock_clear(__cpu_simple_lock_t *__ptr)
+{
+
+	*__ptr = __SIMPLELOCK_UNLOCKED;
+}
+
+#ifdef _HARDKERNEL
+# include <machine/cpufunc.h>
+# define SPINLOCK_SPIN_HOOK	/* nothing */
+# ifdef SPINLOCK_BACKOFF_HOOK
+#  undef SPINLOCK_BACKOFF_HOOK
+# endif
+# define SPINLOCK_BACKOFF_HOOK	x86_pause()
+# define SPINLOCK_INLINE
+#else /* !_HARDKERNEL */
+# define SPINLOCK_BODY
+# define SPINLOCK_INLINE static __inline __unused
+#endif /* _HARDKERNEL */
+
+SPINLOCK_INLINE void	__cpu_simple_lock_init(__cpu_simple_lock_t *);
+SPINLOCK_INLINE void	__cpu_simple_lock(__cpu_simple_lock_t *);
+SPINLOCK_INLINE int	__cpu_simple_lock_try(__cpu_simple_lock_t *);
+SPINLOCK_INLINE void	__cpu_simple_unlock(__cpu_simple_lock_t *);
+
+#ifdef SPINLOCK_BODY
+SPINLOCK_INLINE void
+__cpu_simple_lock_init(__cpu_simple_lock_t *lockp)
+{
+
+	*lockp = __SIMPLELOCK_UNLOCKED;
+	__insn_barrier();
+}
+
+SPINLOCK_INLINE int
+__cpu_simple_lock_try(__cpu_simple_lock_t *lockp)
+{
+	uint8_t val;
+
+	val = __SIMPLELOCK_LOCKED;
+	__asm volatile ("xchgb %0,(%2)" : 
+	    "=qQ" (val)
+	    :"0" (val), "r" (lockp));
+	__insn_barrier();
+	return val == __SIMPLELOCK_UNLOCKED;
+}
+
+SPINLOCK_INLINE void
+__cpu_simple_lock(__cpu_simple_lock_t *lockp)
+{
+
+	while (!__cpu_simple_lock_try(lockp))
+		/* nothing */;
+	__insn_barrier();
+}
+
+/*
+ * Note on x86 memory ordering
+ *
+ * When releasing a lock we must ensure that no stores or loads from within
+ * the critical section are re-ordered by the CPU to occur outside of it:
+ * they must have completed and be visible to other processors once the lock
+ * has been released.
+ *
+ * NetBSD usually runs with the kernel mapped (via MTRR) in a WB (write
+ * back) memory region.  In that case, memory ordering on x86 platforms
+ * looks like this:
+ *
+ * i386		All loads/stores occur in instruction sequence.
+ *
+ * i486		All loads/stores occur in instruction sequence.  In
+ * Pentium	exceptional circumstances, loads can be re-ordered around
+ *		stores, but for the purposes of releasing a lock it does
+ *		not matter.  Stores may not be immediately visible to other
+ *		processors as they can be buffered.  However, since the
+ *		stores are buffered in order the lock release will always be
+ *		the last operation in the critical section that becomes
+ *		visible to other CPUs.
+ *
+ * Pentium Pro	The "Intel 64 and IA-32 Architectures Software Developer's
+ * onwards	Manual" volume 3A (order number 248966) says that (1) "Reads
+ *		can be carried out speculatively and in any order" and (2)
+ *		"Reads can pass buffered stores, but the processor is
+ *		self-consistent.".  This would be a problem for the below,
+ *		and would mandate a locked instruction cycle or load fence
+ *		before releasing the simple lock.
+ *
+ *		The "Intel Pentium 4 Processor Optimization" guide (order
+ *		number 253668-022US) says: "Loads can be moved before stores
+ *		that occurred earlier in the program if they are not
+ *		predicted to load from the same linear address.".  This is
+ *		not a problem since the only loads that can be re-ordered
+ *		take place once the lock has been released via a store.
+ *
+ *		The above two documents seem to contradict each other,
+ *		however with the exception of early steppings of the Pentium
+ *		Pro, the second document is closer to the truth: a store
+ *		will always act as a load fence for all loads that precede
+ *		the store in instruction order.
+ *
+ *		Again, note that stores can be buffered and will not always
+ *		become immediately visible to other CPUs: they are however
+ *		buffered in order.
+ *
+ * AMD64	Stores occur in order and are buffered.  Loads can be
+ *		reordered, however stores act as load fences, meaning that
+ *		loads can not be reordered around stores.
+ */
+SPINLOCK_INLINE void
+__cpu_simple_unlock(__cpu_simple_lock_t *lockp)
+{
+
+	__insn_barrier();
+	*lockp = __SIMPLELOCK_UNLOCKED;
+}
+
+#endif	/* SPINLOCK_BODY */
+
+#endif /* _X86_LOCK_H_ */

Property changes on: lab4/.minix-src/include/x86/lock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/pio.h
===================================================================
--- lab4/.minix-src/include/x86/pio.h	(nonexistent)
+++ lab4/.minix-src/include/x86/pio.h	(revision 13)
@@ -0,0 +1,53 @@
+/*	$NetBSD: pio.h,v 1.9 2011/05/22 16:01:43 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _X86_PIO_H_
+#define _X86_PIO_H_
+
+/*
+ * Functions to provide access to x86 programmed I/O instructions.
+ */
+
+uint8_t		inb(unsigned);
+void		insb(unsigned, void *, int);
+uint16_t	inw(unsigned);
+void		insw(unsigned, void *, int);
+uint32_t	inl(unsigned);
+void		insl(unsigned, void *, int);
+
+void		outb(unsigned, uint8_t);
+void		outsb(unsigned, void *, int);
+void		outw(unsigned, uint16_t);
+void		outsw(unsigned, void *, int);
+void		outl(unsigned, uint32_t);
+void		outsl(unsigned, void *, int);
+	
+#endif /* _X86_PIO_H_ */

Property changes on: lab4/.minix-src/include/x86/pio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/pte.h
===================================================================
--- lab4/.minix-src/include/x86/pte.h	(nonexistent)
+++ lab4/.minix-src/include/x86/pte.h	(revision 13)
@@ -0,0 +1,50 @@
+/*	$NetBSD: pte.h,v 1.1 2010/07/06 20:50:35 cegger Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christoph Egger.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _X86_PTE_H
+#define _X86_PTE_H
+
+/* Cacheability bits when we are using PAT */
+#define PGC_WB          0               /* The default */
+#define PGC_WC          PG_WT           /* WT and CD is WC */
+#define PGC_UCMINUS     PG_N            /* UC but mtrr can override */
+#define PGC_UC          (PG_WT | PG_N)  /* hard UC */
+
+/*
+ * page protection exception bits
+ */
+
+#define PGEX_P		0x01	/* protection violation (vs. no mapping) */
+#define PGEX_W		0x02	/* exception during a write cycle */
+#define PGEX_U		0x04	/* exception while in user mode (upl) */
+#define PGEX_X		0x10	/* exception during instruction fetch */
+
+#endif /* _X86_PTE_H */

Property changes on: lab4/.minix-src/include/x86/pte.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/trap.h
===================================================================
--- lab4/.minix-src/include/x86/trap.h	(nonexistent)
+++ lab4/.minix-src/include/x86/trap.h	(revision 13)
@@ -0,0 +1,70 @@
+/*	$NetBSD: trap.h,v 1.2 2003/08/07 16:30:33 agc Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)trap.h	5.4 (Berkeley) 5/9/91
+ */
+
+/*
+ * Trap type values
+ * also known in trap.c for name strings
+ */
+
+#define	T_PRIVINFLT	 0	/* privileged instruction */
+#define	T_BPTFLT	 1	/* breakpoint trap */
+#define	T_ARITHTRAP	 2	/* arithmetic trap */
+#define	T_ASTFLT	 3	/* asynchronous system trap */
+#define	T_PROTFLT	 4	/* protection fault */
+#define	T_TRCTRAP	 5	/* trace trap */
+#define	T_PAGEFLT	 6	/* page fault */
+#define	T_ALIGNFLT	 7	/* alignment fault */
+#define	T_DIVIDE	 8	/* integer divide fault */
+#define	T_NMI		 9	/* non-maskable interrupt */
+#define	T_OFLOW		10	/* overflow trap */
+#define	T_BOUND		11	/* bounds check fault */
+#define	T_DNA		12	/* device not available fault */
+#define	T_DOUBLEFLT	13	/* double fault */
+#define	T_FPOPFLT	14	/* fp coprocessor operand fetch fault */
+#define	T_TSSFLT	15	/* invalid tss fault */
+#define	T_SEGNPFLT	16	/* segment not present fault */
+#define	T_STKFLT	17	/* stack fault */
+#define	T_MCA		18	/* machine check */
+#define T_XMM		19	/* SSE FP exception */
+#define T_RESERVED	20	/* reserved fault base */
+
+/* Trap's coming from user mode */
+#define	T_USER	0x100
+
+/* Flags kludged into the trap code */
+
+#define TC_TSS		0x80000000
+#define TC_FLAGMASK	(TC_TSS)

Property changes on: lab4/.minix-src/include/x86/trap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ar.h
===================================================================
--- lab4/.minix-src/include/ar.h	(nonexistent)
+++ lab4/.minix-src/include/ar.h	(revision 13)
@@ -0,0 +1,65 @@
+/*	$NetBSD: ar.h,v 1.5 2003/08/07 09:44:09 agc Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Hugh Smith at The University of Guelph.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ar.h	8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _AR_H_
+#define	_AR_H_
+
+/* Pre-4BSD archives had these magic numbers in them. */
+#define	OARMAG1	0177555
+#define	OARMAG2	0177545
+
+#define	ARMAG		"!<arch>\n"	/* ar "magic number" */
+#define	SARMAG		8		/* strlen(ARMAG); */
+
+#define	AR_EFMT1	"#1/"		/* extended format #1 */
+
+struct ar_hdr {
+	char ar_name[16];		/* name */
+	char ar_date[12];		/* modification time */
+	char ar_uid[6];			/* user id */
+	char ar_gid[6];			/* group id */
+	char ar_mode[8];		/* octal file permissions */
+	char ar_size[10];		/* size in bytes */
+#define	ARFMAG	"`\n"
+	char ar_fmag[2];		/* consistency check */
+};
+
+#endif /* !_AR_H_ */

Property changes on: lab4/.minix-src/include/ar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/pmap_pv.h
===================================================================
--- lab4/.minix-src/include/x86/pmap_pv.h	(nonexistent)
+++ lab4/.minix-src/include/x86/pmap_pv.h	(revision 13)
@@ -0,0 +1,92 @@
+/*	$NetBSD: pmap_pv.h,v 1.3 2011/06/12 03:35:50 rmind Exp $	*/
+
+/*-
+ * Copyright (c)2008 YAMAMOTO Takashi,
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _X86_PMAP_PV_H_
+#define	_X86_PMAP_PV_H_
+
+#include <sys/mutex.h>
+#include <sys/queue.h>
+
+struct vm_page;
+
+/*
+ * structures to track P->V mapping
+ *
+ * this file is intended to be minimum as it's included by <machine/vmparam.h>.
+ */
+
+/*
+ * pv_pte: describe a pte
+ */
+
+struct pv_pte {
+	struct vm_page *pte_ptp;	/* PTP; NULL for pmap_kernel() */
+	vaddr_t pte_va;			/* VA */
+};
+
+/*
+ * pv_entry: plug pv_pte into lists.
+ */
+
+struct pv_entry {
+	struct pv_pte pve_pte;		/* should be the first member */
+	LIST_ENTRY(pv_entry) pve_list;	/* on pv_head::pvh_list */
+	SLIST_ENTRY(pv_entry) pve_hash;
+};
+#define	pve_next	pve_list.le_next
+
+/*
+ * pmap_page: a structure which is embedded in each vm_page.
+ */
+
+struct pmap_page {
+	union {
+		/* PP_EMBEDDED */
+		struct pv_pte u_pte;
+
+		/* !PP_EMBEDDED */
+		struct pv_head {
+			LIST_HEAD(, pv_entry) pvh_list;
+		} u_head;
+
+		/* PTPs */
+		struct vm_page *u_link;
+	} pp_u;
+#define	pp_pte	pp_u.u_pte
+#define	pp_head	pp_u.u_head
+#define	pp_link	pp_u.u_link
+	uint8_t pp_flags;
+	uint8_t pp_attrs;	/* saved PG_M and PG_U */
+};
+
+/* pp_flags */
+#define	PP_EMBEDDED	1
+
+#define	PMAP_PAGE_INIT(pp)	/* none */
+
+#endif /* !_X86_PMAP_PV_H_ */

Property changes on: lab4/.minix-src/include/x86/pmap_pv.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/specialreg.h
===================================================================
--- lab4/.minix-src/include/x86/specialreg.h	(nonexistent)
+++ lab4/.minix-src/include/x86/specialreg.h	(revision 13)
@@ -0,0 +1,1066 @@
+/*	$NetBSD: specialreg.h,v 1.83 2015/08/14 06:54:22 msaitoh Exp $	*/
+
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)specialreg.h	7.1 (Berkeley) 5/9/91
+ */
+
+/*
+ * Bits in 386 special registers:
+ */
+#define	CR0_PE	0x00000001	/* Protected mode Enable */
+#define	CR0_MP	0x00000002	/* "Math" Present (NPX or NPX emulator) */
+#define	CR0_EM	0x00000004	/* EMulate non-NPX coproc. (trap ESC only) */
+#define	CR0_TS	0x00000008	/* Task Switched (if MP, trap ESC and WAIT) */
+#define	CR0_ET	0x00000010	/* Extension Type (387 (if set) vs 287) */
+#define	CR0_PG	0x80000000	/* PaGing enable */
+
+/*
+ * Bits in 486 special registers:
+ */
+#define CR0_NE	0x00000020	/* Numeric Error enable (EX16 vs IRQ13) */
+#define CR0_WP	0x00010000	/* Write Protect (honor PG_RW in all modes) */
+#define CR0_AM	0x00040000	/* Alignment Mask (set to enable AC flag) */
+#define	CR0_NW	0x20000000	/* Not Write-through */
+#define	CR0_CD	0x40000000	/* Cache Disable */
+
+/*
+ * Cyrix 486 DLC special registers, accessible as IO ports.
+ */
+#define CCR0	0xc0		/* configuration control register 0 */
+#define CCR0_NC0	0x01	/* first 64K of each 1M memory region is non-cacheable */
+#define CCR0_NC1	0x02	/* 640K-1M region is non-cacheable */
+#define CCR0_A20M	0x04	/* enables A20M# input pin */
+#define CCR0_KEN	0x08	/* enables KEN# input pin */
+#define CCR0_FLUSH	0x10	/* enables FLUSH# input pin */
+#define CCR0_BARB	0x20	/* flushes internal cache when entering hold state */
+#define CCR0_CO		0x40	/* cache org: 1=direct mapped, 0=2x set assoc */
+#define CCR0_SUSPEND	0x80	/* enables SUSP# and SUSPA# pins */
+
+#define CCR1	0xc1		/* configuration control register 1 */
+#define CCR1_RPL	0x01	/* enables RPLSET and RPLVAL# pins */
+/* the remaining 7 bits of this register are reserved */
+
+/*
+ * bits in the %cr4 control register:
+ */
+#define CR4_VME		0x00000001 /* virtual 8086 mode extension enable */
+#define CR4_PVI		0x00000002 /* protected mode virtual interrupt enable */
+#define CR4_TSD		0x00000004 /* restrict RDTSC instruction to cpl 0 */
+#define CR4_DE		0x00000008 /* debugging extension */
+#define CR4_PSE		0x00000010 /* large (4MB) page size enable */
+#define CR4_PAE		0x00000020 /* physical address extension enable */
+#define CR4_MCE		0x00000040 /* machine check enable */
+#define CR4_PGE		0x00000080 /* page global enable */
+#define CR4_PCE		0x00000100 /* enable RDPMC instruction for all cpls */
+#define CR4_OSFXSR	0x00000200 /* enable fxsave/fxrestor and SSE */
+#define CR4_OSXMMEXCPT	0x00000400 /* enable unmasked SSE exceptions */
+#define CR4_VMXE	0x00002000 /* enable VMX operations */
+#define CR4_SMXE	0x00004000 /* enable SMX operations */
+#define CR4_FSGSBASE	0x00010000 /* enable *FSBASE and *GSBASE instructions */
+#define CR4_PCIDE	0x00020000 /* enable Process Context IDentifiers */
+#define CR4_OSXSAVE	0x00040000 /* enable xsave and xrestore */
+#define CR4_SMEP	0x00100000 /* enable SMEP support */
+#define CR4_SMAP	0x00200000 /* enable SMAP support */
+
+/*
+ * Extended Control Register XCR0
+ */
+#define	XCR0_X87	0x00000001	/* x87 FPU/MMX state */
+#define	XCR0_SSE	0x00000002	/* SSE state */
+#define	XCR0_YMM_Hi128	0x00000004	/* AVX-256 (ymmn registers) */
+#define	XCR0_BNDREGS	0x00000008	/* Memory protection ext bounds */
+#define	XCR0_BNDCSR	0x00000010	/* Memory protection ext state */
+#define	XCR0_Opmask	0x00000020	/* AVX-512 Opmask */
+#define	XCR0_ZMM_Hi256	0x00000040	/* AVX-512 upper 256 bits low regs */
+#define	XCR0_Hi16_ZMM	0x00000080	/* AVX-512 512 bits upper registers */
+
+/*
+ * Known fpu bits - only these get enabled
+ * I think the XCR0_BNDREGS and XCR0_BNDCSR would need saving on
+ * every context switch.
+ * The save are is sized for all the fields below (max 2680 bytes).
+ */
+#define XCR0_FPU	(XCR0_X87 | XCR0_SSE | XCR0_YMM_Hi128 | \
+			XCR0_Opmask | XCR0_ZMM_Hi256 | XCR0_Hi16_ZMM)
+
+#define XCR0_BND	(XCR0_BNDREGS | XCR0_BNDCSR)
+
+#define XCR0_FLAGS1	"\20" \
+	"\1" "x87"	"\2" "SSE"	"\3" "AVX" \
+	"\4" "BNDREGS"	"\5" "BNDCSR" \
+	"\6" "Opmask"	"\7" "ZMM_Hi256" "\10" "Hi16_ZMM"
+
+
+/*
+ * CPUID "features" bits
+ */
+
+/* Fn00000001 %edx features */
+#define	CPUID_FPU	0x00000001	/* processor has an FPU? */
+#define	CPUID_VME	0x00000002	/* has virtual mode (%cr4's VME/PVI) */
+#define	CPUID_DE	0x00000004	/* has debugging extension */
+#define	CPUID_PSE	0x00000008	/* has 4MB page size extension */
+#define	CPUID_TSC	0x00000010	/* has time stamp counter */
+#define	CPUID_MSR	0x00000020	/* has mode specific registers */
+#define	CPUID_PAE	0x00000040	/* has phys address extension */
+#define	CPUID_MCE	0x00000080	/* has machine check exception */
+#define	CPUID_CX8	0x00000100	/* has CMPXCHG8B instruction */
+#define	CPUID_APIC	0x00000200	/* has enabled APIC */
+#define	CPUID_B10	0x00000400	/* reserved, MTRR */
+#define	CPUID_SEP	0x00000800	/* has SYSENTER/SYSEXIT extension */
+#define	CPUID_MTRR	0x00001000	/* has memory type range register */
+#define	CPUID_PGE	0x00002000	/* has page global extension */
+#define	CPUID_MCA	0x00004000	/* has machine check architecture */
+#define	CPUID_CMOV	0x00008000	/* has CMOVcc instruction */
+#define	CPUID_PAT	0x00010000	/* Page Attribute Table */
+#define	CPUID_PSE36	0x00020000	/* 36-bit PSE */
+#define	CPUID_PN	0x00040000	/* processor serial number */
+#define	CPUID_CFLUSH	0x00080000	/* CFLUSH insn supported */
+#define	CPUID_B20	0x00100000	/* reserved */
+#define	CPUID_DS	0x00200000	/* Debug Store */
+#define	CPUID_ACPI	0x00400000	/* ACPI performance modulation regs */
+#define	CPUID_MMX	0x00800000	/* MMX supported */
+#define	CPUID_FXSR	0x01000000	/* fast FP/MMX save/restore */
+#define	CPUID_SSE	0x02000000	/* streaming SIMD extensions */
+#define	CPUID_SSE2	0x04000000	/* streaming SIMD extensions #2 */
+#define	CPUID_SS	0x08000000	/* self-snoop */
+#define	CPUID_HTT	0x10000000	/* Hyper-Threading Technology */
+#define	CPUID_TM	0x20000000	/* thermal monitor (TCC) */
+#define	CPUID_IA64	0x40000000	/* IA-64 architecture */
+#define	CPUID_SBF	0x80000000	/* signal break on FERR */
+
+#define CPUID_FLAGS1	"\20" \
+	"\1" "FPU"	"\2" "VME"	"\3" "DE"	"\4" "PSE" \
+	"\5" "TSC"	"\6" "MSR"	"\7" "PAE"	"\10" "MCE" \
+	"\11" "CX8"	"\12" "APIC"	"\13" "B10"	"\14" "SEP" \
+	"\15" "MTRR"	"\16" "PGE"	"\17" "MCA"	"\20" "CMOV" \
+	"\21" "PAT"	"\22" "PSE36"	"\23" "PN"	"\24" "CFLUSH" \
+	"\25" "B20"	"\26" "DS"	"\27" "ACPI"	"\30" "MMX" \
+	"\31" "FXSR"	"\32" "SSE"	"\33" "SSE2"	"\34" "SS" \
+	"\35" "HTT"	"\36" "TM"	"\37" "IA64"	"\40" "SBF"
+
+/* Blacklists of CPUID flags - used to mask certain features */
+#ifdef XEN
+/* Not on Xen */
+#define CPUID_FEAT_BLACKLIST	 (CPUID_PGE|CPUID_PSE|CPUID_MTRR)
+#else
+#define CPUID_FEAT_BLACKLIST	 0
+#endif /* XEN */
+
+/*
+ * CPUID "features" bits in Fn00000001 %ecx
+ */
+
+#define	CPUID2_SSE3	0x00000001	/* Streaming SIMD Extensions 3 */
+#define	CPUID2_PCLMUL	0x00000002	/* PCLMULQDQ instructions */
+#define	CPUID2_DTES64	0x00000004	/* 64-bit Debug Trace */
+#define	CPUID2_MONITOR	0x00000008	/* MONITOR/MWAIT instructions */
+#define	CPUID2_DS_CPL	0x00000010	/* CPL Qualified Debug Store */
+#define	CPUID2_VMX	0x00000020	/* Virtual Machine Extensions */
+#define	CPUID2_SMX	0x00000040	/* Safer Mode Extensions */
+#define	CPUID2_EST	0x00000080	/* Enhanced SpeedStep Technology */
+#define	CPUID2_TM2	0x00000100	/* Thermal Monitor 2 */
+#define CPUID2_SSSE3	0x00000200	/* Supplemental SSE3 */
+#define	CPUID2_CID	0x00000400	/* Context ID */
+#define	CPUID2_SDBG	0x00000800	/* Silicon Debug */
+#define	CPUID2_FMA	0x00001000	/* has Fused Multiply Add */
+#define	CPUID2_CX16	0x00002000	/* has CMPXCHG16B instruction */
+#define	CPUID2_xTPR	0x00004000	/* Task Priority Messages disabled? */
+#define	CPUID2_PDCM	0x00008000	/* Perf/Debug Capability MSR */
+/* bit 16 unused	0x00010000 */
+#define	CPUID2_PCID	0x00020000	/* Process Context ID */
+#define	CPUID2_DCA	0x00040000	/* Direct Cache Access */
+#define	CPUID2_SSE41	0x00080000	/* Streaming SIMD Extensions 4.1 */
+#define	CPUID2_SSE42	0x00100000	/* Streaming SIMD Extensions 4.2 */
+#define	CPUID2_X2APIC	0x00200000	/* xAPIC Extensions */
+#define	CPUID2_MOVBE	0x00400000	/* MOVBE (move after byteswap) */
+#define	CPUID2_POPCNT	0x00800000	/* popcount instruction available */
+#define	CPUID2_DEADLINE	0x01000000	/* APIC Timer supports TSC Deadline */
+#define	CPUID2_AES	0x02000000	/* AES instructions */
+#define	CPUID2_XSAVE	0x04000000	/* XSAVE instructions */
+#define	CPUID2_OSXSAVE	0x08000000	/* XGETBV/XSETBV instructions */
+#define	CPUID2_AVX	0x10000000	/* AVX instructions */
+#define	CPUID2_F16C	0x20000000	/* half precision conversion */
+#define	CPUID2_RDRAND	0x40000000	/* RDRAND (hardware random number) */
+#define	CPUID2_RAZ	0x80000000	/* RAZ. Indicates guest state. */
+
+#define CPUID2_FLAGS1	"\20" \
+	"\1" "SSE3"	"\2" "PCLMULQDQ" "\3" "DTES64"	"\4" "MONITOR" \
+	"\5" "DS-CPL"	"\6" "VMX"	"\7" "SMX"	"\10" "EST" \
+	"\11" "TM2"	"\12" "SSSE3"	"\13" "CID"	"\14" "SDBG" \
+	"\15" "FMA"	"\16" "CX16"	"\17" "xTPR"	"\20" "PDCM" \
+	"\21" "B16"	"\22" "PCID"	"\23" "DCA"	"\24" "SSE41" \
+	"\25" "SSE42"	"\26" "X2APIC"	"\27" "MOVBE"	"\30" "POPCNT" \
+	"\31" "DEADLINE" "\32" "AES"	"\33" "XSAVE"	"\34" "OSXSAVE" \
+	"\35" "AVX"	"\36" "F16C"	"\37" "RDRAND"	"\40" "RAZ"
+
+/* CPUID Fn00000001 %eax */
+
+#define CPUID_TO_BASEFAMILY(cpuid)	(((cpuid) >> 8) & 0xf)
+#define CPUID_TO_BASEMODEL(cpuid)	(((cpuid) >> 4) & 0xf)
+#define CPUID_TO_STEPPING(cpuid)	((cpuid) & 0xf)
+
+/*
+ * The Extended family bits should only be inspected when CPUID_TO_BASEFAMILY()
+ * returns 15. They are use to encode family value 16 to 270 (add 15).
+ * The Extended model bits are the high 4 bits of the model.
+ * They are only valid for family >= 15 or family 6 (intel, but all amd
+ * family 6 are documented to return zero bits for them).
+ */
+#define CPUID_TO_EXTFAMILY(cpuid)	(((cpuid) >> 20) & 0xff)
+#define CPUID_TO_EXTMODEL(cpuid)	(((cpuid) >> 16) & 0xf)
+
+/* The macros for the Display Family and the Display Model */
+#define CPUID_TO_FAMILY(cpuid)	(CPUID_TO_BASEFAMILY(cpuid)	\
+	    + ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f)		\
+		? 0 : CPUID_TO_EXTFAMILY(cpuid)))
+#define CPUID_TO_MODEL(cpuid)	(CPUID_TO_BASEMODEL(cpuid)	\
+	    | ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f)		\
+		&& (CPUID_TO_BASEFAMILY(cpuid) != 0x06)		\
+		? 0 : (CPUID_TO_EXTMODEL(cpuid) << 4)))
+
+/*
+ * Intel Deterministic Cache Parameter Leaf
+ * Fn0000_0004
+ */
+
+/* %eax */
+#define CPUID_DCP_CACHETYPE	__BITS(4, 0)	/* Cache type */
+#define CPUID_DCP_CACHETYPE_N	0		/*   NULL */
+#define CPUID_DCP_CACHETYPE_D	1		/*   Data cache */
+#define CPUID_DCP_CACHETYPE_I	2		/*   Instruction cache */
+#define CPUID_DCP_CACHETYPE_U	3		/*   Unified cache */
+#define CPUID_DCP_CACHELEVEL	__BITS(7, 5)	/* Cache level (start at 1) */
+#define CPUID_DCP_SELFINITCL	__BIT(8)	/* Self initializing cachelvl*/
+#define CPUID_DCP_FULLASSOC	__BIT(9)	/* Full associative */
+#define CPUID_DCP_SHAREING	__BITS(25, 14)	/* shareing */
+#define CPUID_DCP_CORE_P_PKG	__BITS(31, 26)	/* Cores/package */
+
+/* %ebx */
+#define CPUID_DCP_LINESIZE	__BITS(11, 0)	/* System coherency linesize */
+#define CPUID_DCP_PARTITIONS	__BITS(21, 12)	/* Physical line partitions */
+#define CPUID_DCP_WAYS		__BITS(31, 22)	/* Ways of associativity */
+
+/* Number of sets: %ecx */
+
+/* %edx */
+#define CPUID_DCP_INVALIDATE	__BIT(0)	/* WB invalidate/invalidate */
+#define CPUID_DCP_INCLUSIVE	__BIT(1)	/* Cache inclusiveness */
+#define CPUID_DCP_COMPLEX	__BIT(2)	/* Complex cache indexing */
+
+/*
+ * Intel Digital Thermal Sensor and
+ * Power Management, Fn0000_0006 - %eax.
+ */
+#define CPUID_DSPM_DTS	__BIT(0)	/* Digital Thermal Sensor */
+#define CPUID_DSPM_IDA	__BIT(1)	/* Intel Dynamic Acceleration */
+#define CPUID_DSPM_ARAT	__BIT(2)	/* Always Running APIC Timer */
+#define CPUID_DSPM_PLN	__BIT(4)	/* Power Limit Notification */
+#define CPUID_DSPM_ECMD	__BIT(5)	/* Clock Modulation Extension */
+#define CPUID_DSPM_PTM	__BIT(6)	/* Package Level Thermal Management */
+#define CPUID_DSPM_HWP	__BIT(7)	/* HWP */
+#define CPUID_DSPM_HWP_NOTIFY __BIT(8)	/* HWP Notification */
+#define CPUID_DSPM_HWP_ACTWIN  __BIT(9)	/* HWP Activity Window */
+#define CPUID_DSPM_HWP_EPP __BIT(10)	/* HWP Energy Performance Preference */
+#define CPUID_DSPM_HWP_PLR __BIT(11)	/* HWP Package Level Request */
+#define CPUID_DSPM_HDC	__BIT(13)	/* HDC */
+
+#define CPUID_DSPM_FLAGS	"\20" \
+	"\1" "DTS"	"\2" "IDA"	"\3" "ARAT" 			\
+	"\5" "PLN"	"\6" "ECMD"	"\7" "PTM"	"\10" "HWP"	\
+	"\11" "HWP_NOTIFY" "\12" "HWP_ACTWIN" "\13" "HWP_EPP" "\14" "HWP_PLR" \
+			"\16" "HDC"
+
+/*
+ * Intel Digital Thermal Sensor and
+ * Power Management, Fn0000_0006 - %ecx.
+ */
+#define CPUID_DSPM_HWF	0x00000001	/* MSR_APERF/MSR_MPERF available */
+#define CPUID_DSPM_EPB	0x00000008	/* Energy Performance Bias */
+
+#define CPUID_DSPM_FLAGS1	"\20" "\1" "HWF" "\4" "EPB"
+
+/*
+ * Intel Structured Extended Feature leaf Fn0000_0007
+ * %eax == 0: Subleaf 0
+ *	%eax: The Maximun input value for supported subleaf.
+ *	%ebx: Feature bits.
+ *	%ecx: Feature bits.
+ */
+
+/* %ebx */
+#define CPUID_SEF_FSGSBASE	__BIT(0)
+#define CPUID_SEF_TSC_ADJUST	__BIT(1)
+#define CPUID_SEF_BMI1		__BIT(3)
+#define CPUID_SEF_HLE		__BIT(4)
+#define CPUID_SEF_AVX2		__BIT(5)
+#define CPUID_SEF_SMEP		__BIT(7)
+#define CPUID_SEF_BMI2		__BIT(8)
+#define CPUID_SEF_ERMS		__BIT(9)
+#define CPUID_SEF_INVPCID	__BIT(10)
+#define CPUID_SEF_RTM		__BIT(11)
+#define CPUID_SEF_QM		__BIT(12)
+#define CPUID_SEF_FPUCSDS	__BIT(13)
+#define CPUID_SEF_MPX		__BIT(14)
+#define CPUID_SEF_PQE		__BIT(15)
+#define CPUID_SEF_AVX512F	__BIT(16)
+#define CPUID_SEF_RDSEED	__BIT(18)
+#define CPUID_SEF_ADX		__BIT(19)
+#define CPUID_SEF_SMAP		__BIT(20)
+#define CPUID_SEF_PT		__BIT(25)
+#define CPUID_SEF_AVX512PF	__BIT(26)
+#define CPUID_SEF_AVX512ER	__BIT(27)
+#define CPUID_SEF_AVX512CD	__BIT(28)
+#define CPUID_SEF_SHA		__BIT(29)
+
+#define CPUID_SEF_FLAGS	"\20" \
+	"\1" "FSGSBASE"	"\2" "TSCADJUST"		"\4" "BMI1"	\
+	"\5" "HLE"	"\6" "AVX2"			"\10" "SMEP"	\
+	"\11" "BMI2"	"\12" "ERMS"	"\13" "INVPCID"	"\14" "RTM"	\
+	"\15" "QM"	"\16" "FPUCSDS"	"\17" "MPX"    	"\20" "PQE"	\
+	"\21" "AVX512F"			"\23" "RDSEED"	"\24" "ADX"	\
+	"\25" "SMAP"							\
+			"\32" "PT"	"\33" "AVX512PF""\34" "AVX512ER"\
+	"\35" "AVX512CD""\36" "SHA"
+
+/* %ecx */
+#define CPUID_SEF_PREFETCHWT1	__BIT(0)
+#define CPUID_SEF_PKU		__BIT(3)
+#define CPUID_SEF_OSPKE		__BIT(4)
+
+#define CPUID_SEF_FLAGS1	"\20" \
+	"\1" "PREFETCHWT1"				"\4" "PKU"	\
+	"\5" "OSPKE"
+
+/*
+ * CPUID Processor extended state Enumeration Fn0000000d
+ *
+ * %ecx == 0: supported features info:
+ *	%eax: Valid bits of lower 32bits of XCR0
+ *	%ebx: Maximum save area size for features enabled in XCR0
+ *	%ecx: Maximim save area size for all cpu features
+ *	%edx: Valid bits of upper 32bits of XCR0
+ *
+ * %ecx == 1:
+ *	%eax: Bit 0 => xsaveopt instruction avalaible (sandy bridge onwards)
+ *	%ebx: Save area size for features enabled by XCR0 | IA32_XSS
+ *	%ecx: Valid bits of lower 32bits of IA32_XSS
+ *	%edx: Valid bits of upper 32bits of IA32_XSS
+ *
+ * %ecx >= 2: Save area details for XCR0 bit n
+ *	%eax: size of save area for this feature
+ *	%ebx: offset of save area for this feature
+ *	%ecx, %edx: reserved
+ *	All of %eax, %ebx, %ecx and %edx are zero for unsupported features.
+ */
+
+/* %ecx=1 %eax */
+#define	CPUID_PES1_XSAVEOPT	0x00000001	/* xsaveopt instruction */
+#define	CPUID_PES1_XSAVEC	0x00000002	/* xsavec & compacted XRSTOR */
+#define	CPUID_PES1_XGETBV	0x00000004	/* xgetbv with ECX = 1 */
+#define	CPUID_PES1_XSAVES	0x00000008	/* xsaves/xrstors, IA32_XSS */
+
+#define CPUID_PES1_FLAGS	"\20" \
+	"\1" "XSAVEOPT"	"\2" "XSAVEC"	"\3" "XGETBV"	"\4" "XSAVES"
+
+/* Intel Fn80000001 extended features - %edx */
+#define CPUID_SYSCALL	0x00000800	/* SYSCALL/SYSRET */
+#define CPUID_XD	0x00100000	/* Execute Disable (like CPUID_NOX) */
+#define	CPUID_P1GB	0x04000000	/* 1GB Large Page Support */
+#define	CPUID_RDTSCP	0x08000000	/* Read TSC Pair Instruction */
+#define CPUID_EM64T	0x20000000	/* Intel EM64T */
+
+#define CPUID_INTEL_EXT_FLAGS	"\20" \
+	"\14" "SYSCALL/SYSRET"	"\25" "XD"	"\33" "P1GB" \
+	"\34" "RDTSCP"	"\36" "EM64T"
+
+/* Intel Fn80000001 extended features - %ecx */
+#define	CPUID_LAHF	0x00000001	/* LAHF/SAHF in IA-32e mode, 64bit sub*/
+		/*	0x00000020 */	/* LZCNT. Same as AMD's CPUID_LZCNT */
+#define	CPUID_PREFETCHW	0x00000100	/* PREFETCHW */
+
+#define	CPUID_INTEL_FLAGS4	"\20"				\
+	"\1" "LAHF"	"\02" "B01"	"\03" "B02"		\
+			"\06" "LZCNT"				\
+	"\11" "PREFETCHW"
+
+/* AMD/VIA Fn80000001 extended features - %edx */
+/*	CPUID_SYSCALL			   SYSCALL/SYSRET */
+#define CPUID_MPC	0x00080000	/* Multiprocessing Capable */
+#define CPUID_NOX	0x00100000	/* No Execute Page Protection */
+#define CPUID_MMXX	0x00400000	/* AMD MMX Extensions */
+#define CPUID_FFXSR	0x02000000	/* FXSAVE/FXSTOR Extensions */
+/*	CPUID_P1GB			   1GB Large Page Support */
+/*	CPUID_RDTSCP			   Read TSC Pair Instruction */
+/*	CPUID_EM64T			   Long mode */
+#define CPUID_3DNOW2	0x40000000	/* 3DNow! Instruction Extension */
+#define CPUID_3DNOW	0x80000000	/* 3DNow! Instructions */
+
+#define CPUID_EXT_FLAGS	"\20" \
+	"\14" "SYSCALL/SYSRET"		"\24" "MPC"	"\25" "NOX" \
+	"\27" "MMXX"	"\32" "FFXSR"	"\33" "P1GB"	"\34" "RDTSCP" \
+	"\36" "LONG"	"\37" "3DNOW2"	"\40" "3DNOW"
+
+/* AMD Fn80000001 extended features - %ecx */
+/* 	CPUID_LAHF			   LAHF/SAHF instruction */
+#define CPUID_CMPLEGACY	0x00000002	/* Compare Legacy */
+#define CPUID_SVM	0x00000004	/* Secure Virtual Machine */
+#define CPUID_EAPIC	0x00000008	/* Extended APIC space */
+#define CPUID_ALTMOVCR0	0x00000010	/* Lock Mov Cr0 */
+#define CPUID_LZCNT	0x00000020	/* LZCNT instruction */
+#define CPUID_SSE4A	0x00000040	/* SSE4A instruction set */
+#define CPUID_MISALIGNSSE 0x00000080	/* Misaligned SSE */
+#define CPUID_3DNOWPF	0x00000100	/* 3DNow Prefetch */
+#define CPUID_OSVW	0x00000200	/* OS visible workarounds */
+#define CPUID_IBS	0x00000400	/* Instruction Based Sampling */
+#define CPUID_XOP	0x00000800	/* XOP instruction set */
+#define CPUID_SKINIT	0x00001000	/* SKINIT */
+#define CPUID_WDT	0x00002000	/* watchdog timer support */
+#define CPUID_LWP	0x00008000	/* Light Weight Profiling */
+#define CPUID_FMA4	0x00010000	/* FMA4 instructions */
+#define CPUID_NODEID	0x00080000	/* NodeID MSR available*/
+#define CPUID_TBM	0x00200000	/* TBM instructions */
+#define CPUID_TOPOEXT	0x00400000	/* cpuid Topology Extension */
+#define CPUID_PCEC	0x00800000	/* Perf Ctr Ext Core */
+#define CPUID_PCENB	0x01000000	/* Perf Ctr Ext NB */
+#define CPUID_SPM	0x02000000	/* Stream Perf Mon */
+#define CPUID_DBE	0x04000000	/* Data Breakpoint Extension */
+#define CPUID_PTSC	0x08000000	/* PerfTsc */
+
+#define CPUID_AMD_FLAGS4	"\20" \
+	"\1" "LAHF"	"\2" "CMPLEGACY" "\3" "SVM"	"\4" "EAPIC" \
+	"\5" "ALTMOVCR0" "\6" "LZCNT"	"\7" "SSE4A"	"\10" "MISALIGNSSE" \
+	"\11" "3DNOWPREFETCH" \
+			"\12" "OSVW"	"\13" "IBS"	"\14" "XOP" \
+	"\15" "SKINIT"	"\16" "WDT"	"\17" "B14"	"\20" "LWP" \
+	"\21" "FMA4"	"\22" "B17"	"\23" "B18"	"\24" "NodeID" \
+	"\25" "B20"	"\26" "TBM"	"\27" "TopoExt"	"\30" "PCExtC" \
+	"\31" "PCExtNB"	"\32" "StrmPM"	"\33" "DBExt"	"\34" "PerfTsc" \
+	"\35" "B28"	"\36" "B29"	"\37" "B30"	"\40" "B31"
+
+/*
+ * AMD Advanced Power Management
+ * CPUID Fn8000_0007 %edx
+ */
+#define CPUID_APM_TS	0x00000001	/* Temperature Sensor */
+#define CPUID_APM_FID	0x00000002	/* Frequency ID control */
+#define CPUID_APM_VID	0x00000004	/* Voltage ID control */
+#define CPUID_APM_TTP	0x00000008	/* THERMTRIP (PCI F3xE4 register) */
+#define CPUID_APM_HTC	0x00000010	/* Hardware thermal control (HTC) */
+#define CPUID_APM_STC	0x00000020	/* Software thermal control (STC) */
+#define CPUID_APM_100	0x00000040	/* 100MHz multiplier control */
+#define CPUID_APM_HWP	0x00000080	/* HW P-State control */
+#define CPUID_APM_TSC	0x00000100	/* TSC invariant */
+#define CPUID_APM_CPB	0x00000200	/* Core performance boost */
+#define CPUID_APM_EFF	0x00000400	/* Effective Frequency (read-only) */
+
+#define CPUID_APM_FLAGS		"\20" \
+	"\1" "TS"	"\2" "FID"	"\3" "VID"	"\4" "TTP" \
+	"\5" "HTC"	"\6" "STC"	"\7" "100"	"\10" "HWP" \
+	"\11" "TSC"	"\12" "CPB"	"\13" "EffFreq"	"\14" "B11" \
+	"\15" "B12"
+
+/* AMD Fn8000000a %edx features (SVM features) */
+#define	CPUID_AMD_SVM_NP		0x00000001
+#define	CPUID_AMD_SVM_LbrVirt		0x00000002
+#define	CPUID_AMD_SVM_SVML		0x00000004
+#define	CPUID_AMD_SVM_NRIPS		0x00000008
+#define	CPUID_AMD_SVM_TSCRateCtrl	0x00000010
+#define	CPUID_AMD_SVM_VMCBCleanBits	0x00000020
+#define	CPUID_AMD_SVM_FlushByASID	0x00000040
+#define	CPUID_AMD_SVM_DecodeAssist	0x00000080
+#define	CPUID_AMD_SVM_PauseFilter	0x00000400
+#define	CPUID_AMD_SVM_FLAGS	 "\20" \
+	"\1" "NP"	"\2" "LbrVirt"	"\3" "SVML"	"\4" "NRIPS" \
+	"\5" "TSCRate"	"\6" "VMCBCleanBits" \
+		"\7" "FlushByASID"	"\10" "DecodeAssist" \
+	"\11" "B08"	"\12" "B09"	"\13" "PauseFilter" "\14" "B11" \
+	"\15" "B12"	"\16" "B13"	"\17" "B17"	"\20" "B18" \
+	"\21" "B19"
+
+/*
+ * Centaur Extended Feature flags
+ */
+#define CPUID_VIA_HAS_RNG	0x00000004	/* Random number generator */
+#define CPUID_VIA_DO_RNG	0x00000008
+#define CPUID_VIA_HAS_ACE	0x00000040	/* AES Encryption */
+#define CPUID_VIA_DO_ACE	0x00000080
+#define CPUID_VIA_HAS_ACE2	0x00000100	/* AES+CTR instructions */
+#define CPUID_VIA_DO_ACE2	0x00000200
+#define CPUID_VIA_HAS_PHE	0x00000400	/* SHA1+SHA256 HMAC */
+#define CPUID_VIA_DO_PHE	0x00000800
+#define CPUID_VIA_HAS_PMM	0x00001000	/* RSA Instructions */
+#define CPUID_VIA_DO_PMM	0x00002000
+
+#define CPUID_FLAGS_PADLOCK	"\20" \
+	"\3" "RNG"	"\7" "AES"	"\11" "AES/CTR"	"\13" "SHA1/SHA256" \
+	"\15" "RSA"
+
+/*
+ * Model-specific registers for the i386 family
+ */
+#define MSR_P5_MC_ADDR		0x000	/* P5 only */
+#define MSR_P5_MC_TYPE		0x001	/* P5 only */
+#define MSR_TSC			0x010
+#define	MSR_CESR		0x011	/* P5 only (trap on P6) */
+#define	MSR_CTR0		0x012	/* P5 only (trap on P6) */
+#define	MSR_CTR1		0x013	/* P5 only (trap on P6) */
+#define MSR_IA32_PLATFORM_ID	0x017
+#define MSR_APICBASE		0x01b
+#define MSR_EBL_CR_POWERON	0x02a
+#define MSR_EBC_FREQUENCY_ID	0x02c	/* PIV only */
+#define	MSR_TEST_CTL		0x033
+#define MSR_BIOS_UPDT_TRIG	0x079
+#define	MSR_BBL_CR_D0		0x088	/* PII+ only */
+#define	MSR_BBL_CR_D1		0x089	/* PII+ only */
+#define	MSR_BBL_CR_D2		0x08a	/* PII+ only */
+#define MSR_BIOS_SIGN		0x08b
+#define MSR_PERFCTR0		0x0c1
+#define MSR_PERFCTR1		0x0c2
+#define MSR_FSB_FREQ		0x0cd	/* Core Duo/Solo only */
+#define MSR_MPERF		0x0e7
+#define MSR_APERF		0x0e8
+#define MSR_IA32_EXT_CONFIG	0x0ee	/* Undocumented. Core Solo/Duo only */
+#define MSR_MTRRcap		0x0fe
+#define	MSR_BBL_CR_ADDR		0x116	/* PII+ only */
+#define	MSR_BBL_CR_DECC		0x118	/* PII+ only */
+#define	MSR_BBL_CR_CTL		0x119	/* PII+ only */
+#define	MSR_BBL_CR_TRIG		0x11a	/* PII+ only */
+#define	MSR_BBL_CR_BUSY		0x11b	/* PII+ only */
+#define	MSR_BBL_CR_CTR3		0x11e	/* PII+ only */
+#define	MSR_SYSENTER_CS		0x174 	/* PII+ only */
+#define	MSR_SYSENTER_ESP	0x175 	/* PII+ only */
+#define	MSR_SYSENTER_EIP	0x176   /* PII+ only */
+#define MSR_MCG_CAP		0x179
+#define MSR_MCG_STATUS		0x17a
+#define MSR_MCG_CTL		0x17b
+#define MSR_EVNTSEL0		0x186
+#define MSR_EVNTSEL1		0x187
+#define MSR_PERF_STATUS		0x198	/* Pentium M */
+#define MSR_PERF_CTL		0x199	/* Pentium M */
+#define MSR_THERM_CONTROL	0x19a
+#define MSR_THERM_INTERRUPT	0x19b
+#define MSR_THERM_STATUS	0x19c
+#define MSR_THERM2_CTL		0x19d	/* Pentium M */
+#define MSR_MISC_ENABLE		0x1a0
+#define MSR_TEMPERATURE_TARGET	0x1a2
+#define MSR_DEBUGCTLMSR		0x1d9
+#define MSR_LASTBRANCHFROMIP	0x1db
+#define MSR_LASTBRANCHTOIP	0x1dc
+#define MSR_LASTINTFROMIP	0x1dd
+#define MSR_LASTINTTOIP		0x1de
+#define MSR_ROB_CR_BKUPTMPDR6	0x1e0
+#define	MSR_MTRRphysBase0	0x200
+#define	MSR_MTRRphysMask0	0x201
+#define	MSR_MTRRphysBase1	0x202
+#define	MSR_MTRRphysMask1	0x203
+#define	MSR_MTRRphysBase2	0x204
+#define	MSR_MTRRphysMask2	0x205
+#define	MSR_MTRRphysBase3	0x206
+#define	MSR_MTRRphysMask3	0x207
+#define	MSR_MTRRphysBase4	0x208
+#define	MSR_MTRRphysMask4	0x209
+#define	MSR_MTRRphysBase5	0x20a
+#define	MSR_MTRRphysMask5	0x20b
+#define	MSR_MTRRphysBase6	0x20c
+#define	MSR_MTRRphysMask6	0x20d
+#define	MSR_MTRRphysBase7	0x20e
+#define	MSR_MTRRphysMask7	0x20f
+#define	MSR_MTRRphysBase8	0x210
+#define	MSR_MTRRphysMask8	0x211
+#define	MSR_MTRRphysBase9	0x212
+#define	MSR_MTRRphysMask9	0x213
+#define	MSR_MTRRphysBase10	0x214
+#define	MSR_MTRRphysMask10	0x215
+#define	MSR_MTRRphysBase11	0x216
+#define	MSR_MTRRphysMask11	0x217
+#define	MSR_MTRRphysBase12	0x218
+#define	MSR_MTRRphysMask12	0x219
+#define	MSR_MTRRphysBase13	0x21a
+#define	MSR_MTRRphysMask13	0x21b
+#define	MSR_MTRRphysBase14	0x21c
+#define	MSR_MTRRphysMask14	0x21d
+#define	MSR_MTRRphysBase15	0x21e
+#define	MSR_MTRRphysMask15	0x21f
+#define	MSR_MTRRfix64K_00000	0x250
+#define	MSR_MTRRfix16K_80000	0x258
+#define	MSR_MTRRfix16K_A0000	0x259
+#define	MSR_MTRRfix4K_C0000	0x268
+#define	MSR_MTRRfix4K_C8000	0x269
+#define	MSR_MTRRfix4K_D0000	0x26a
+#define	MSR_MTRRfix4K_D8000	0x26b
+#define	MSR_MTRRfix4K_E0000	0x26c
+#define	MSR_MTRRfix4K_E8000	0x26d
+#define	MSR_MTRRfix4K_F0000	0x26e
+#define	MSR_MTRRfix4K_F8000	0x26f
+#define	MSR_CR_PAT		0x277
+#define MSR_MTRRdefType		0x2ff
+#define MSR_MC0_CTL		0x400
+#define MSR_MC0_STATUS		0x401
+#define MSR_MC0_ADDR		0x402
+#define MSR_MC0_MISC		0x403
+#define MSR_MC1_CTL		0x404
+#define MSR_MC1_STATUS		0x405
+#define MSR_MC1_ADDR		0x406
+#define MSR_MC1_MISC		0x407
+#define MSR_MC2_CTL		0x408
+#define MSR_MC2_STATUS		0x409
+#define MSR_MC2_ADDR		0x40a
+#define MSR_MC2_MISC		0x40b
+#define MSR_MC4_CTL		0x40c
+#define MSR_MC4_STATUS		0x40d
+#define MSR_MC4_ADDR		0x40e
+#define MSR_MC4_MISC		0x40f
+#define MSR_MC3_CTL		0x410
+#define MSR_MC3_STATUS		0x411
+#define MSR_MC3_ADDR		0x412
+#define MSR_MC3_MISC		0x413
+				/* 0x480 - 0x490 VMX */
+
+/*
+ * VIA "Nehemiah" MSRs
+ */
+#define MSR_VIA_RNG		0x0000110b
+#define MSR_VIA_RNG_ENABLE	0x00000040
+#define MSR_VIA_RNG_NOISE_MASK	0x00000300
+#define MSR_VIA_RNG_NOISE_A	0x00000000
+#define MSR_VIA_RNG_NOISE_B	0x00000100
+#define MSR_VIA_RNG_2NOISE	0x00000300
+#define MSR_VIA_ACE		0x00001107
+#define MSR_VIA_ACE_ENABLE	0x10000000
+
+/*
+ * VIA "Eden" MSRs
+ */
+#define MSR_VIA_FCR 		MSR_VIA_ACE
+
+/*
+ * AMD K6/K7 MSRs.
+ */
+#define	MSR_K6_UWCCR		0xc0000085
+#define	MSR_K7_EVNTSEL0		0xc0010000
+#define	MSR_K7_EVNTSEL1		0xc0010001
+#define	MSR_K7_EVNTSEL2		0xc0010002
+#define	MSR_K7_EVNTSEL3		0xc0010003
+#define	MSR_K7_PERFCTR0		0xc0010004
+#define	MSR_K7_PERFCTR1		0xc0010005
+#define	MSR_K7_PERFCTR2		0xc0010006
+#define	MSR_K7_PERFCTR3		0xc0010007
+
+/*
+ * AMD K8 (Opteron) MSRs.
+ */
+#define	MSR_SYSCFG	0xc0000010
+
+#define MSR_EFER	0xc0000080		/* Extended feature enable */
+#define 	EFER_SCE		0x00000001	/* SYSCALL extension */
+#define 	EFER_LME		0x00000100	/* Long Mode Active */
+#define		EFER_LMA		0x00000400	/* Long Mode Enabled */
+#define 	EFER_NXE		0x00000800	/* No-Execute Enabled */
+
+#define MSR_STAR	0xc0000081		/* 32 bit syscall gate addr */
+#define MSR_LSTAR	0xc0000082		/* 64 bit syscall gate addr */
+#define MSR_CSTAR	0xc0000083		/* compat syscall gate addr */
+#define MSR_SFMASK	0xc0000084		/* flags to clear on syscall */
+
+#define MSR_FSBASE	0xc0000100		/* 64bit offset for fs: */
+#define MSR_GSBASE	0xc0000101		/* 64bit offset for gs: */
+#define MSR_KERNELGSBASE 0xc0000102		/* storage for swapgs ins */
+
+#define MSR_VMCR	0xc0010114	/* Virtual Machine Control Register */
+#define 	VMCR_DPD	0x00000001	/* Debug port disable */
+#define		VMCR_RINIT	0x00000002	/* intercept init */
+#define		VMCR_DISA20	0x00000004	/* Disable A20 masking */
+#define		VMCR_LOCK	0x00000008	/* SVM Lock */
+#define		VMCR_SVMED	0x00000010	/* SVME Disable */
+#define MSR_SVMLOCK	0xc0010118	/* SVM Lock key */
+
+/*
+ * These require a 'passcode' for access.  See cpufunc.h.
+ */
+#define	MSR_HWCR	0xc0010015
+#define		HWCR_TLBCACHEDIS	0x00000008
+#define		HWCR_FFDIS		0x00000040
+
+#define	MSR_NB_CFG	0xc001001f
+#define		NB_CFG_DISIOREQLOCK	0x0000000000000008ULL
+#define		NB_CFG_DISDATMSK	0x0000001000000000ULL
+#define		NB_CFG_INITAPICCPUIDLO	(1ULL << 54)
+
+#define	MSR_LS_CFG	0xc0011020
+#define		LS_CFG_DIS_LS2_SQUISH	0x02000000
+
+#define	MSR_IC_CFG	0xc0011021
+#define		IC_CFG_DIS_SEQ_PREFETCH	0x00000800
+
+#define	MSR_DC_CFG	0xc0011022
+#define		DC_CFG_DIS_CNV_WC_SSO	0x00000008
+#define		DC_CFG_DIS_SMC_CHK_BUF	0x00000400
+#define		DC_CFG_ERRATA_261	0x01000000
+
+#define	MSR_BU_CFG	0xc0011023
+#define		BU_CFG_ERRATA_298	0x0000000000000002ULL
+#define		BU_CFG_ERRATA_254	0x0000000000200000ULL
+#define		BU_CFG_ERRATA_309	0x0000000000800000ULL
+#define		BU_CFG_THRL2IDXCMPDIS	0x0000080000000000ULL
+#define		BU_CFG_WBPFSMCCHKDIS	0x0000200000000000ULL
+#define		BU_CFG_WBENHWSBDIS	0x0001000000000000ULL
+
+#define MSR_DE_CFG	0xc0011029
+#define		DE_CFG_ERRATA_721	0x00000001
+
+/* AMD Family10h MSRs */
+#define	MSR_OSVW_ID_LENGTH		0xc0010140
+#define	MSR_OSVW_STATUS			0xc0010141
+#define	MSR_UCODE_AMD_PATCHLEVEL	0x0000008b
+#define	MSR_UCODE_AMD_PATCHLOADER	0xc0010020
+
+/* X86 MSRs */
+#define	MSR_RDTSCP_AUX			0xc0000103
+
+/*
+ * Constants related to MTRRs
+ */
+#define MTRR_N64K		8	/* numbers of fixed-size entries */
+#define MTRR_N16K		16
+#define MTRR_N4K		64
+
+/*
+ * the following four 3-byte registers control the non-cacheable regions.
+ * These registers must be written as three separate bytes.
+ *
+ * NCRx+0: A31-A24 of starting address
+ * NCRx+1: A23-A16 of starting address
+ * NCRx+2: A15-A12 of starting address | NCR_SIZE_xx.
+ * 
+ * The non-cacheable region's starting address must be aligned to the
+ * size indicated by the NCR_SIZE_xx field.
+ */
+#define NCR1	0xc4
+#define NCR2	0xc7
+#define NCR3	0xca
+#define NCR4	0xcd
+
+#define NCR_SIZE_0K	0
+#define NCR_SIZE_4K	1
+#define NCR_SIZE_8K	2
+#define NCR_SIZE_16K	3
+#define NCR_SIZE_32K	4
+#define NCR_SIZE_64K	5
+#define NCR_SIZE_128K	6
+#define NCR_SIZE_256K	7
+#define NCR_SIZE_512K	8
+#define NCR_SIZE_1M	9
+#define NCR_SIZE_2M	10
+#define NCR_SIZE_4M	11
+#define NCR_SIZE_8M	12
+#define NCR_SIZE_16M	13
+#define NCR_SIZE_32M	14
+#define NCR_SIZE_4G	15
+
+/*
+ * Performance monitor events.
+ *
+ * Note that 586-class and 686-class CPUs have different performance
+ * monitors available, and they are accessed differently:
+ *
+ *	686-class: `rdpmc' instruction
+ *	586-class: `rdmsr' instruction, CESR MSR
+ *
+ * The descriptions of these events are too lenghy to include here.
+ * See Appendix A of "Intel Architecture Software Developer's
+ * Manual, Volume 3: System Programming" for more information.
+ */
+
+/*
+ * 586-class CESR MSR format.  Lower 16 bits is CTR0, upper 16 bits
+ * is CTR1.
+ */
+
+#define	PMC5_CESR_EVENT			0x003f
+#define	PMC5_CESR_OS			0x0040
+#define	PMC5_CESR_USR			0x0080
+#define	PMC5_CESR_E			0x0100
+#define	PMC5_CESR_P			0x0200
+
+#define PMC5_DATA_READ			0x00
+#define PMC5_DATA_WRITE			0x01
+#define PMC5_DATA_TLB_MISS		0x02
+#define PMC5_DATA_READ_MISS		0x03
+#define PMC5_DATA_WRITE_MISS		0x04
+#define PMC5_WRITE_M_E			0x05
+#define PMC5_DATA_LINES_WBACK		0x06
+#define PMC5_DATA_CACHE_SNOOP		0x07
+#define PMC5_DATA_CACHE_SNOOP_HIT	0x08
+#define PMC5_MEM_ACCESS_BOTH_PIPES	0x09
+#define PMC5_BANK_CONFLICTS		0x0a
+#define PMC5_MISALIGNED_DATA		0x0b
+#define PMC5_INST_READ			0x0c
+#define PMC5_INST_TLB_MISS		0x0d
+#define PMC5_INST_CACHE_MISS		0x0e
+#define PMC5_SEGMENT_REG_LOAD		0x0f
+#define PMC5_BRANCHES		 	0x12
+#define PMC5_BTB_HITS		 	0x13
+#define PMC5_BRANCH_TAKEN		0x14
+#define PMC5_PIPELINE_FLUSH		0x15
+#define PMC5_INST_EXECUTED		0x16
+#define PMC5_INST_EXECUTED_V_PIPE	0x17
+#define PMC5_BUS_UTILIZATION		0x18
+#define PMC5_WRITE_BACKUP_STALL		0x19
+#define PMC5_DATA_READ_STALL		0x1a
+#define PMC5_WRITE_E_M_STALL		0x1b
+#define PMC5_LOCKED_BUS			0x1c
+#define PMC5_IO_CYCLE			0x1d
+#define PMC5_NONCACHE_MEM_READ		0x1e
+#define PMC5_AGI_STALL			0x1f
+#define PMC5_FLOPS			0x22
+#define PMC5_BP0_MATCH			0x23
+#define PMC5_BP1_MATCH			0x24
+#define PMC5_BP2_MATCH			0x25
+#define PMC5_BP3_MATCH			0x26
+#define PMC5_HARDWARE_INTR		0x27
+#define PMC5_DATA_RW			0x28
+#define PMC5_DATA_RW_MISS		0x29
+
+/*
+ * 686-class Event Selector MSR format.
+ */
+
+#define	PMC6_EVTSEL_EVENT		0x000000ff
+#define	PMC6_EVTSEL_UNIT		0x0000ff00
+#define	PMC6_EVTSEL_UNIT_SHIFT		8
+#define	PMC6_EVTSEL_USR			(1 << 16)
+#define	PMC6_EVTSEL_OS			(1 << 17)
+#define	PMC6_EVTSEL_E			(1 << 18)
+#define	PMC6_EVTSEL_PC			(1 << 19)
+#define	PMC6_EVTSEL_INT			(1 << 20)
+#define	PMC6_EVTSEL_EN			(1 << 22)	/* PerfEvtSel0 only */
+#define	PMC6_EVTSEL_INV			(1 << 23)
+#define	PMC6_EVTSEL_COUNTER_MASK	0xff000000
+#define	PMC6_EVTSEL_COUNTER_MASK_SHIFT	24
+
+/* Data Cache Unit */
+#define	PMC6_DATA_MEM_REFS		0x43
+#define	PMC6_DCU_LINES_IN		0x45
+#define	PMC6_DCU_M_LINES_IN		0x46
+#define	PMC6_DCU_M_LINES_OUT		0x47
+#define	PMC6_DCU_MISS_OUTSTANDING	0x48
+
+/* Instruction Fetch Unit */
+#define	PMC6_IFU_IFETCH			0x80
+#define	PMC6_IFU_IFETCH_MISS		0x81
+#define	PMC6_ITLB_MISS			0x85
+#define	PMC6_IFU_MEM_STALL		0x86
+#define	PMC6_ILD_STALL			0x87
+
+/* L2 Cache */
+#define	PMC6_L2_IFETCH			0x28
+#define	PMC6_L2_LD			0x29
+#define	PMC6_L2_ST			0x2a
+#define	PMC6_L2_LINES_IN		0x24
+#define	PMC6_L2_LINES_OUT		0x26
+#define	PMC6_L2_M_LINES_INM		0x25
+#define	PMC6_L2_M_LINES_OUTM		0x27
+#define	PMC6_L2_RQSTS			0x2e
+#define	PMC6_L2_ADS			0x21
+#define	PMC6_L2_DBUS_BUSY		0x22
+#define	PMC6_L2_DBUS_BUSY_RD		0x23
+
+/* External Bus Logic */
+#define	PMC6_BUS_DRDY_CLOCKS		0x62
+#define	PMC6_BUS_LOCK_CLOCKS		0x63
+#define	PMC6_BUS_REQ_OUTSTANDING	0x60
+#define	PMC6_BUS_TRAN_BRD		0x65
+#define	PMC6_BUS_TRAN_RFO		0x66
+#define	PMC6_BUS_TRANS_WB		0x67
+#define	PMC6_BUS_TRAN_IFETCH		0x68
+#define	PMC6_BUS_TRAN_INVAL		0x69
+#define	PMC6_BUS_TRAN_PWR		0x6a
+#define	PMC6_BUS_TRANS_P		0x6b
+#define	PMC6_BUS_TRANS_IO		0x6c
+#define	PMC6_BUS_TRAN_DEF		0x6d
+#define	PMC6_BUS_TRAN_BURST		0x6e
+#define	PMC6_BUS_TRAN_ANY		0x70
+#define	PMC6_BUS_TRAN_MEM		0x6f
+#define	PMC6_BUS_DATA_RCV		0x64
+#define	PMC6_BUS_BNR_DRV		0x61
+#define	PMC6_BUS_HIT_DRV		0x7a
+#define	PMC6_BUS_HITM_DRDV		0x7b
+#define	PMC6_BUS_SNOOP_STALL		0x7e
+
+/* Floating Point Unit */
+#define	PMC6_FLOPS			0xc1
+#define	PMC6_FP_COMP_OPS_EXE		0x10
+#define	PMC6_FP_ASSIST			0x11
+#define	PMC6_MUL			0x12
+#define	PMC6_DIV			0x12
+#define	PMC6_CYCLES_DIV_BUSY		0x14
+
+/* Memory Ordering */
+#define	PMC6_LD_BLOCKS			0x03
+#define	PMC6_SB_DRAINS			0x04
+#define	PMC6_MISALIGN_MEM_REF		0x05
+#define	PMC6_EMON_KNI_PREF_DISPATCHED	0x07	/* P-III only */
+#define	PMC6_EMON_KNI_PREF_MISS		0x4b	/* P-III only */
+
+/* Instruction Decoding and Retirement */
+#define	PMC6_INST_RETIRED		0xc0
+#define	PMC6_UOPS_RETIRED		0xc2
+#define	PMC6_INST_DECODED		0xd0
+#define	PMC6_EMON_KNI_INST_RETIRED	0xd8
+#define	PMC6_EMON_KNI_COMP_INST_RET	0xd9
+
+/* Interrupts */
+#define	PMC6_HW_INT_RX			0xc8
+#define	PMC6_CYCLES_INT_MASKED		0xc6
+#define	PMC6_CYCLES_INT_PENDING_AND_MASKED 0xc7
+
+/* Branches */
+#define	PMC6_BR_INST_RETIRED		0xc4
+#define	PMC6_BR_MISS_PRED_RETIRED	0xc5
+#define	PMC6_BR_TAKEN_RETIRED		0xc9
+#define	PMC6_BR_MISS_PRED_TAKEN_RET	0xca
+#define	PMC6_BR_INST_DECODED		0xe0
+#define	PMC6_BTB_MISSES			0xe2
+#define	PMC6_BR_BOGUS			0xe4
+#define	PMC6_BACLEARS			0xe6
+
+/* Stalls */
+#define	PMC6_RESOURCE_STALLS		0xa2
+#define	PMC6_PARTIAL_RAT_STALLS		0xd2
+
+/* Segment Register Loads */
+#define	PMC6_SEGMENT_REG_LOADS		0x06
+
+/* Clocks */
+#define	PMC6_CPU_CLK_UNHALTED		0x79
+
+/* MMX Unit */
+#define	PMC6_MMX_INSTR_EXEC		0xb0	/* Celeron, P-II, P-IIX only */
+#define	PMC6_MMX_SAT_INSTR_EXEC		0xb1	/* P-II and P-III only */
+#define	PMC6_MMX_UOPS_EXEC		0xb2	/* P-II and P-III only */
+#define	PMC6_MMX_INSTR_TYPE_EXEC	0xb3	/* P-II and P-III only */
+#define	PMC6_FP_MMX_TRANS		0xcc	/* P-II and P-III only */
+#define	PMC6_MMX_ASSIST			0xcd	/* P-II and P-III only */
+#define	PMC6_MMX_INSTR_RET		0xc3	/* P-II only */
+
+/* Segment Register Renaming */
+#define	PMC6_SEG_RENAME_STALLS		0xd4	/* P-II and P-III only */
+#define	PMC6_SEG_REG_RENAMES		0xd5	/* P-II and P-III only */
+#define	PMC6_RET_SEG_RENAMES		0xd6	/* P-II and P-III only */
+
+/*
+ * AMD K7 Event Selector MSR format.
+ */
+
+#define	K7_EVTSEL_EVENT			0x000000ff
+#define	K7_EVTSEL_UNIT			0x0000ff00
+#define	K7_EVTSEL_UNIT_SHIFT		8
+#define	K7_EVTSEL_USR			(1 << 16)
+#define	K7_EVTSEL_OS			(1 << 17)
+#define	K7_EVTSEL_E			(1 << 18)
+#define	K7_EVTSEL_PC			(1 << 19)
+#define	K7_EVTSEL_INT			(1 << 20)
+#define	K7_EVTSEL_EN			(1 << 22)
+#define	K7_EVTSEL_INV			(1 << 23)
+#define	K7_EVTSEL_COUNTER_MASK		0xff000000
+#define	K7_EVTSEL_COUNTER_MASK_SHIFT	24
+
+/* Segment Register Loads */
+#define	K7_SEGMENT_REG_LOADS		0x20
+
+#define	K7_STORES_TO_ACTIVE_INST_STREAM	0x21
+
+/* Data Cache Unit */
+#define	K7_DATA_CACHE_ACCESS		0x40
+#define	K7_DATA_CACHE_MISS		0x41
+#define	K7_DATA_CACHE_REFILL		0x42
+#define	K7_DATA_CACHE_REFILL_SYSTEM	0x43
+#define	K7_DATA_CACHE_WBACK		0x44
+#define	K7_L2_DTLB_HIT			0x45
+#define	K7_L2_DTLB_MISS			0x46
+#define	K7_MISALIGNED_DATA_REF		0x47
+#define	K7_SYSTEM_REQUEST		0x64
+#define	K7_SYSTEM_REQUEST_TYPE		0x65
+
+#define	K7_SNOOP_HIT			0x73
+#define	K7_SINGLE_BIT_ECC_ERROR		0x74
+#define	K7_CACHE_LINE_INVAL		0x75
+#define	K7_CYCLES_PROCESSOR_IS_RUNNING	0x76
+#define	K7_L2_REQUEST			0x79
+#define	K7_L2_REQUEST_BUSY		0x7a
+
+/* Instruction Fetch Unit */
+#define	K7_IFU_IFETCH			0x80
+#define	K7_IFU_IFETCH_MISS		0x81
+#define	K7_IFU_REFILL_FROM_L2		0x82
+#define	K7_IFU_REFILL_FROM_SYSTEM	0x83
+#define	K7_ITLB_L1_MISS			0x84
+#define	K7_ITLB_L2_MISS			0x85
+#define	K7_SNOOP_RESYNC			0x86
+#define	K7_IFU_STALL			0x87
+
+#define	K7_RETURN_STACK_HITS		0x88
+#define	K7_RETURN_STACK_OVERFLOW	0x89
+
+/* Retired */
+#define	K7_RETIRED_INST			0xc0
+#define	K7_RETIRED_OPS			0xc1
+#define	K7_RETIRED_BRANCHES		0xc2
+#define	K7_RETIRED_BRANCH_MISPREDICTED	0xc3
+#define	K7_RETIRED_TAKEN_BRANCH		0xc4
+#define	K7_RETIRED_TAKEN_BRANCH_MISPREDICTED	0xc5
+#define	K7_RETIRED_FAR_CONTROL_TRANSFER	0xc6
+#define	K7_RETIRED_RESYNC_BRANCH	0xc7
+#define	K7_RETIRED_NEAR_RETURNS		0xc8
+#define	K7_RETIRED_NEAR_RETURNS_MISPREDICTED	0xc9
+#define	K7_RETIRED_INDIRECT_MISPREDICTED	0xca
+
+/* Interrupts */
+#define	K7_CYCLES_INT_MASKED		0xcd
+#define	K7_CYCLES_INT_PENDING_AND_MASKED	0xce
+#define	K7_HW_INTR_RECV			0xcf
+
+#define	K7_INSTRUCTION_DECODER_EMPTY	0xd0
+#define	K7_DISPATCH_STALLS		0xd1
+#define	K7_BRANCH_ABORTS_TO_RETIRE	0xd2
+#define	K7_SERIALIZE			0xd3
+#define	K7_SEGMENT_LOAD_STALL		0xd4
+#define	K7_ICU_FULL			0xd5
+#define	K7_RESERVATION_STATIONS_FULL	0xd6
+#define	K7_FPU_FULL			0xd7
+#define	K7_LS_FULL			0xd8
+#define	K7_ALL_QUIET_STALL		0xd9
+#define	K7_FAR_TRANSFER_OR_RESYNC_BRANCH_PENDING	0xda
+
+#define	K7_BP0_MATCH			0xdc
+#define	K7_BP1_MATCH			0xdd
+#define	K7_BP2_MATCH			0xde
+#define	K7_BP3_MATCH			0xdf

Property changes on: lab4/.minix-src/include/x86/specialreg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/a.out.h
===================================================================
--- lab4/.minix-src/include/a.out.h	(nonexistent)
+++ lab4/.minix-src/include/a.out.h	(revision 13)
@@ -0,0 +1,68 @@
+/*	$NetBSD: a.out.h,v 1.20 2009/08/16 17:12:47 pgoyette Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)a.out.h	8.1 (Berkeley) 6/2/93
+ */
+
+/*-
+ * Copyright (c) 1993 Theo de Raadt.  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, PROUREMENT 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.
+ *
+ *	@(#)a.out.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef	_AOUT_H_
+#define	_AOUT_H_
+
+#include <sys/exec_aout.h>
+
+#define	_AOUT_INCLUDE_
+#include <nlist.h>
+
+#endif /* !_AOUT_H_ */

Property changes on: lab4/.minix-src/include/a.out.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/rwlock.h
===================================================================
--- lab4/.minix-src/include/x86/rwlock.h	(nonexistent)
+++ lab4/.minix-src/include/x86/rwlock.h	(revision 13)
@@ -0,0 +1,62 @@
+/*	$NetBSD: rwlock.h,v 1.5 2008/04/28 20:23:40 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2002, 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe and Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _X86_RWLOCK_H_
+#define	_X86_RWLOCK_H_
+
+struct krwlock {
+	volatile uintptr_t	rw_owner;
+};
+
+#ifdef __RWLOCK_PRIVATE
+
+#define	__HAVE_SIMPLE_RW_LOCKS		1
+#define	__HAVE_RW_STUBS			1
+
+/*
+ * RW_RECEIVE: no memory barrier required, as 'ret' implies a load fence. 
+ */
+#define	RW_RECEIVE(rw)			/* nothing */
+
+/*
+ * RW_GIVE: no memory barrier required, as _lock_cas() will take care of it.
+ */
+#define	RW_GIVE(rw)			/* nothing */
+
+#define	RW_CAS(p, o, n)			\
+    (_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
+
+unsigned long	_atomic_cas_ulong(volatile unsigned long *,
+    unsigned long, unsigned long);
+
+#endif	/* __RWLOCK_PRIVATE */
+
+#endif /* _X86_RWLOCK_H_ */

Property changes on: lab4/.minix-src/include/x86/rwlock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/via_padlock.h
===================================================================
--- lab4/.minix-src/include/x86/via_padlock.h	(nonexistent)
+++ lab4/.minix-src/include/x86/via_padlock.h	(revision 13)
@@ -0,0 +1,90 @@
+/*	$NetBSD: via_padlock.h,v 1.8 2015/04/13 16:03:51 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2003 Jason Wright
+ * Copyright (c) 2003, 2004 Theo de Raadt
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _X86_VIA_PADLOCK_H_
+#define _X86_VIA_PADLOCK_H_
+
+#if defined(_KERNEL)
+
+#include <sys/rndsource.h>
+#include <sys/callout.h>
+#include <crypto/rijndael/rijndael.h>
+
+/* VIA C3 xcrypt-* instruction context control options */
+#define C3_CRYPT_CWLO_ROUND_M		0x0000000f
+#define C3_CRYPT_CWLO_ALG_M		0x00000070
+#define C3_CRYPT_CWLO_ALG_AES		0x00000000
+#define C3_CRYPT_CWLO_KEYGEN_M		0x00000080
+#define C3_CRYPT_CWLO_KEYGEN_HW		0x00000000
+#define C3_CRYPT_CWLO_KEYGEN_SW		0x00000080
+#define C3_CRYPT_CWLO_NORMAL		0x00000000
+#define C3_CRYPT_CWLO_INTERMEDIATE	0x00000100
+#define C3_CRYPT_CWLO_ENCRYPT		0x00000000
+#define C3_CRYPT_CWLO_DECRYPT		0x00000200
+#define C3_CRYPT_CWLO_KEY128		0x0000000a      /* 128bit, 10 rds */
+#define C3_CRYPT_CWLO_KEY192		0x0000040c      /* 192bit, 12 rds */
+#define C3_CRYPT_CWLO_KEY256		0x0000080e      /* 256bit, 15 rds */
+
+struct via_padlock_session {
+        uint32_t	ses_ekey[4 * (RIJNDAEL_MAXNR + 1) + 4];	/* 128 bit aligned */
+        uint32_t	ses_dkey[4 * (RIJNDAEL_MAXNR + 1) + 4];	/* 128 bit aligned */
+        uint8_t	ses_iv[16];				/* 128 bit aligned */
+        uint32_t	ses_cw0;
+        struct swcr_data	*swd;
+        int	ses_klen;
+        int	ses_used;
+};
+
+struct via_padlock_softc {
+	device_t	sc_dev;
+
+	uint32_t	op_cw[4];	/* 128 bit aligned */
+	uint8_t	op_iv[16];	/* 128 bit aligned */
+	void		*op_buf;
+
+	int			sc_rnd_hz;
+	struct callout		sc_rnd_co;
+	krndsource_t	sc_rnd_source;
+	bool			sc_rnd_attached;
+
+	/* normal softc stuff */
+	int32_t		sc_cid;
+	bool		sc_cid_attached;
+	int		sc_nsessions;
+	struct via_padlock_session *sc_sessions;
+};
+
+#define VIAC3_SESSION(sid)	((sid) & 0x0fffffff)
+#define VIAC3_SID(crd,ses)	(((crd) << 28) | ((ses) & 0x0fffffff))
+
+#define VIAC3_RNG_BUFSIZ	16
+
+#endif /* _KERNEL */
+
+#if defined(_KERNEL) || defined(_KMEMUSER)
+struct cpu_info;
+
+struct via_padlock {
+	struct cpu_info		*vp_ci;
+	int			vp_freq;
+};
+
+#endif /* _KERNEL || _KMEMUSER */
+#endif /* _X86_VIA_PADLOCK_H_ */

Property changes on: lab4/.minix-src/include/x86/via_padlock.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/archive.h
===================================================================
--- lab4/.minix-src/include/archive.h	(nonexistent)
+++ lab4/.minix-src/include/archive.h	(revision 13)
@@ -0,0 +1,742 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * 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(S) ``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(S) 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.
+ *
+ * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.50 2008/05/26 17:00:22 kientzle Exp $
+ */
+
+#ifndef ARCHIVE_H_INCLUDED
+#define	ARCHIVE_H_INCLUDED
+
+/*
+ * Note: archive.h is for use outside of libarchive; the configuration
+ * headers (config.h, archive_platform.h, etc.) are purely internal.
+ * Do NOT use HAVE_XXX configuration macros to control the behavior of
+ * this header!  If you must conditionalize, use predefined compiler and/or
+ * platform macros.
+ */
+#if defined(__BORLANDC__) && __BORLANDC__ >= 0x560
+# define __LA_STDINT_H <stdint.h>
+#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__)
+# define __LA_STDINT_H <inttypes.h>
+#endif
+
+#include <sys/stat.h>
+#include <sys/types.h>  /* Linux requires this for off_t */
+#ifdef __LA_STDINT_H
+# include __LA_STDINT_H /* int64_t, etc. */
+#endif
+#include <stdio.h> /* For FILE * */
+
+/* Get appropriate definitions of standard POSIX-style types. */
+/* These should match the types used in 'struct stat' */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define	__LA_INT64_T	__int64
+# if defined(_SSIZE_T_DEFINED)
+#  define	__LA_SSIZE_T	ssize_t
+# elif defined(_WIN64)
+#  define	__LA_SSIZE_T	__int64
+# else
+#  define	__LA_SSIZE_T	long
+# endif
+# if defined(__BORLANDC__)
+#  define	__LA_UID_T	uid_t
+#  define	__LA_GID_T	gid_t
+# else
+#  define	__LA_UID_T	short
+#  define	__LA_GID_T	short
+# endif
+#else
+#include <unistd.h>  /* ssize_t, uid_t, and gid_t */
+#define	__LA_INT64_T	int64_t
+#define	__LA_SSIZE_T	ssize_t
+#define	__LA_UID_T	uid_t
+#define	__LA_GID_T	gid_t
+#endif
+
+/*
+ * On Windows, define LIBARCHIVE_STATIC if you're building or using a
+ * .lib.  The default here assumes you're building a DLL.  Only
+ * libarchive source should ever define __LIBARCHIVE_BUILD.
+ */
+#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
+# ifdef __LIBARCHIVE_BUILD
+#  ifdef __GNUC__
+#   define __LA_DECL	__attribute__((dllexport)) extern
+#  else
+#   define __LA_DECL	__declspec(dllexport)
+#  endif
+# else
+#  ifdef __GNUC__
+#   define __LA_DECL	__attribute__((dllimport)) extern
+#  else
+#   define __LA_DECL	__declspec(dllimport)
+#  endif
+# endif
+#else
+/* Static libraries or non-Windows needs no special declaration. */
+# define __LA_DECL
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The version number is provided as both a macro and a function.
+ * The macro identifies the installed header; the function identifies
+ * the library version (which may not be the same if you're using a
+ * dynamically-linked version of the library).  Of course, if the
+ * header and library are very different, you should expect some
+ * strangeness.  Don't do that.
+ */
+
+/*
+ * The version number is expressed as a single integer that makes it
+ * easy to compare versions at build time: for version a.b.c, the
+ * version number is printf("%d%03d%03d",a,b,c).  For example, if you
+ * know your application requires version 2.12.108 or later, you can
+ * assert that ARCHIVE_VERSION >= 2012108.
+ *
+ * This single-number format was introduced with libarchive 1.9.0 in
+ * the libarchive 1.x family and libarchive 2.2.4 in the libarchive
+ * 2.x family.  The following may be useful if you really want to do
+ * feature detection for earlier libarchive versions (which defined
+ * ARCHIVE_API_VERSION and ARCHIVE_API_FEATURE instead):
+ *
+ * #ifndef ARCHIVE_VERSION_NUMBER
+ * #define ARCHIVE_VERSION_NUMBER	\
+ *             (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
+ * #endif
+ */
+#define	ARCHIVE_VERSION_NUMBER 2008004
+__LA_DECL int		archive_version_number(void);
+
+/*
+ * Textual name/version of the library, useful for version displays.
+ */
+#define	ARCHIVE_VERSION_STRING "libarchive 2.8.4"
+__LA_DECL const char *	archive_version_string(void);
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/*
+ * Deprecated; these are older names that will be removed in favor of
+ * the simpler definitions above.
+ */
+#define	ARCHIVE_VERSION_STAMP	ARCHIVE_VERSION_NUMBER
+__LA_DECL int		archive_version_stamp(void);
+#define	ARCHIVE_LIBRARY_VERSION	ARCHIVE_VERSION_STRING
+__LA_DECL const char *	archive_version(void);
+#define	ARCHIVE_API_VERSION	(ARCHIVE_VERSION_NUMBER / 1000000)
+__LA_DECL int		archive_api_version(void);
+#define	ARCHIVE_API_FEATURE	((ARCHIVE_VERSION_NUMBER / 1000) % 1000)
+__LA_DECL int		archive_api_feature(void);
+#endif
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/* This should never have been here in the first place. */
+/* Legacy of old tar assumptions, will be removed in libarchive 3.0. */
+#define	ARCHIVE_BYTES_PER_RECORD	  512
+#define	ARCHIVE_DEFAULT_BYTES_PER_BLOCK	10240
+#endif
+
+/* Declare our basic types. */
+struct archive;
+struct archive_entry;
+
+/*
+ * Error codes: Use archive_errno() and archive_error_string()
+ * to retrieve details.  Unless specified otherwise, all functions
+ * that return 'int' use these codes.
+ */
+#define	ARCHIVE_EOF	  1	/* Found end of archive. */
+#define	ARCHIVE_OK	  0	/* Operation was successful. */
+#define	ARCHIVE_RETRY	(-10)	/* Retry might succeed. */
+#define	ARCHIVE_WARN	(-20)	/* Partial success. */
+/* For example, if write_header "fails", then you can't push data. */
+#define	ARCHIVE_FAILED	(-25)	/* Current operation cannot complete. */
+/* But if write_header is "fatal," then this archive is dead and useless. */
+#define	ARCHIVE_FATAL	(-30)	/* No more operations are possible. */
+
+/*
+ * As far as possible, archive_errno returns standard platform errno codes.
+ * Of course, the details vary by platform, so the actual definitions
+ * here are stored in "archive_platform.h".  The symbols are listed here
+ * for reference; as a rule, clients should not need to know the exact
+ * platform-dependent error code.
+ */
+/* Unrecognized or invalid file format. */
+/* #define	ARCHIVE_ERRNO_FILE_FORMAT */
+/* Illegal usage of the library. */
+/* #define	ARCHIVE_ERRNO_PROGRAMMER_ERROR */
+/* Unknown or unclassified error. */
+/* #define	ARCHIVE_ERRNO_MISC */
+
+/*
+ * Callbacks are invoked to automatically read/skip/write/open/close the
+ * archive. You can provide your own for complex tasks (like breaking
+ * archives across multiple tapes) or use standard ones built into the
+ * library.
+ */
+
+/* Returns pointer and size of next block of data from archive. */
+typedef __LA_SSIZE_T	archive_read_callback(struct archive *,
+			    void *_client_data, const void **_buffer);
+
+/* Skips at most request bytes from archive and returns the skipped amount */
+#if ARCHIVE_VERSION_NUMBER < 2000000
+/* Libarchive 1.0 used ssize_t for the return, which is only 32 bits
+ * on most 32-bit platforms; not large enough. */
+typedef __LA_SSIZE_T	archive_skip_callback(struct archive *,
+			    void *_client_data, size_t request);
+#elif ARCHIVE_VERSION_NUMBER < 3000000
+/* Libarchive 2.0 used off_t here, but that is a bad idea on Linux and a
+ * few other platforms where off_t varies with build settings. */
+typedef off_t		archive_skip_callback(struct archive *,
+			    void *_client_data, off_t request);
+#else
+/* Libarchive 3.0 uses int64_t here, which is actually guaranteed to be
+ * 64 bits on every platform. */
+typedef __LA_INT64_T	archive_skip_callback(struct archive *,
+			    void *_client_data, __LA_INT64_T request);
+#endif
+
+/* Returns size actually written, zero on EOF, -1 on error. */
+typedef __LA_SSIZE_T	archive_write_callback(struct archive *,
+			    void *_client_data,
+			    const void *_buffer, size_t _length);
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/* Open callback is actually never needed; remove it in libarchive 3.0. */
+typedef int	archive_open_callback(struct archive *, void *_client_data);
+#endif
+
+typedef int	archive_close_callback(struct archive *, void *_client_data);
+
+/*
+ * Codes for archive_compression.
+ */
+#define	ARCHIVE_COMPRESSION_NONE	0
+#define	ARCHIVE_COMPRESSION_GZIP	1
+#define	ARCHIVE_COMPRESSION_BZIP2	2
+#define	ARCHIVE_COMPRESSION_COMPRESS	3
+#define	ARCHIVE_COMPRESSION_PROGRAM	4
+#define	ARCHIVE_COMPRESSION_LZMA	5
+#define	ARCHIVE_COMPRESSION_XZ		6
+#define	ARCHIVE_COMPRESSION_UU		7
+#define	ARCHIVE_COMPRESSION_RPM		8
+
+/*
+ * Codes returned by archive_format.
+ *
+ * Top 16 bits identifies the format family (e.g., "tar"); lower
+ * 16 bits indicate the variant.  This is updated by read_next_header.
+ * Note that the lower 16 bits will often vary from entry to entry.
+ * In some cases, this variation occurs as libarchive learns more about
+ * the archive (for example, later entries might utilize extensions that
+ * weren't necessary earlier in the archive; in this case, libarchive
+ * will change the format code to indicate the extended format that
+ * was used).  In other cases, it's because different tools have
+ * modified the archive and so different parts of the archive
+ * actually have slightly different formts.  (Both tar and cpio store
+ * format codes in each entry, so it is quite possible for each
+ * entry to be in a different format.)
+ */
+#define	ARCHIVE_FORMAT_BASE_MASK		0xff0000
+#define	ARCHIVE_FORMAT_CPIO			0x10000
+#define	ARCHIVE_FORMAT_CPIO_POSIX		(ARCHIVE_FORMAT_CPIO | 1)
+#define	ARCHIVE_FORMAT_CPIO_BIN_LE		(ARCHIVE_FORMAT_CPIO | 2)
+#define	ARCHIVE_FORMAT_CPIO_BIN_BE		(ARCHIVE_FORMAT_CPIO | 3)
+#define	ARCHIVE_FORMAT_CPIO_SVR4_NOCRC		(ARCHIVE_FORMAT_CPIO | 4)
+#define	ARCHIVE_FORMAT_CPIO_SVR4_CRC		(ARCHIVE_FORMAT_CPIO | 5)
+#define	ARCHIVE_FORMAT_SHAR			0x20000
+#define	ARCHIVE_FORMAT_SHAR_BASE		(ARCHIVE_FORMAT_SHAR | 1)
+#define	ARCHIVE_FORMAT_SHAR_DUMP		(ARCHIVE_FORMAT_SHAR | 2)
+#define	ARCHIVE_FORMAT_TAR			0x30000
+#define	ARCHIVE_FORMAT_TAR_USTAR		(ARCHIVE_FORMAT_TAR | 1)
+#define	ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE	(ARCHIVE_FORMAT_TAR | 2)
+#define	ARCHIVE_FORMAT_TAR_PAX_RESTRICTED	(ARCHIVE_FORMAT_TAR | 3)
+#define	ARCHIVE_FORMAT_TAR_GNUTAR		(ARCHIVE_FORMAT_TAR | 4)
+#define	ARCHIVE_FORMAT_ISO9660			0x40000
+#define	ARCHIVE_FORMAT_ISO9660_ROCKRIDGE	(ARCHIVE_FORMAT_ISO9660 | 1)
+#define	ARCHIVE_FORMAT_ZIP			0x50000
+#define	ARCHIVE_FORMAT_EMPTY			0x60000
+#define	ARCHIVE_FORMAT_AR			0x70000
+#define	ARCHIVE_FORMAT_AR_GNU			(ARCHIVE_FORMAT_AR | 1)
+#define	ARCHIVE_FORMAT_AR_BSD			(ARCHIVE_FORMAT_AR | 2)
+#define	ARCHIVE_FORMAT_MTREE			0x80000
+#define	ARCHIVE_FORMAT_RAW			0x90000
+#define	ARCHIVE_FORMAT_XAR			0xA0000
+
+/*-
+ * Basic outline for reading an archive:
+ *   1) Ask archive_read_new for an archive reader object.
+ *   2) Update any global properties as appropriate.
+ *      In particular, you'll certainly want to call appropriate
+ *      archive_read_support_XXX functions.
+ *   3) Call archive_read_open_XXX to open the archive
+ *   4) Repeatedly call archive_read_next_header to get information about
+ *      successive archive entries.  Call archive_read_data to extract
+ *      data for entries of interest.
+ *   5) Call archive_read_finish to end processing.
+ */
+__LA_DECL struct archive	*archive_read_new(void);
+
+/*
+ * The archive_read_support_XXX calls enable auto-detect for this
+ * archive handle.  They also link in the necessary support code.
+ * For example, if you don't want bzlib linked in, don't invoke
+ * support_compression_bzip2().  The "all" functions provide the
+ * obvious shorthand.
+ */
+__LA_DECL int		 archive_read_support_compression_all(struct archive *);
+__LA_DECL int		 archive_read_support_compression_bzip2(struct archive *);
+__LA_DECL int		 archive_read_support_compression_compress(struct archive *);
+__LA_DECL int		 archive_read_support_compression_gzip(struct archive *);
+__LA_DECL int		 archive_read_support_compression_lzma(struct archive *);
+__LA_DECL int		 archive_read_support_compression_none(struct archive *);
+__LA_DECL int		 archive_read_support_compression_program(struct archive *,
+		     const char *command);
+__LA_DECL int		 archive_read_support_compression_program_signature
+				(struct archive *, const char *,
+				    const void * /* match */, size_t);
+
+__LA_DECL int		 archive_read_support_compression_rpm(struct archive *);
+__LA_DECL int		 archive_read_support_compression_uu(struct archive *);
+__LA_DECL int		 archive_read_support_compression_xz(struct archive *);
+
+__LA_DECL int		 archive_read_support_format_all(struct archive *);
+__LA_DECL int		 archive_read_support_format_ar(struct archive *);
+__LA_DECL int		 archive_read_support_format_cpio(struct archive *);
+__LA_DECL int		 archive_read_support_format_empty(struct archive *);
+__LA_DECL int		 archive_read_support_format_gnutar(struct archive *);
+__LA_DECL int		 archive_read_support_format_iso9660(struct archive *);
+__LA_DECL int		 archive_read_support_format_mtree(struct archive *);
+__LA_DECL int		 archive_read_support_format_raw(struct archive *);
+__LA_DECL int		 archive_read_support_format_tar(struct archive *);
+__LA_DECL int		 archive_read_support_format_xar(struct archive *);
+__LA_DECL int		 archive_read_support_format_zip(struct archive *);
+
+
+/* Open the archive using callbacks for archive I/O. */
+__LA_DECL int		 archive_read_open(struct archive *, void *_client_data,
+		     archive_open_callback *, archive_read_callback *,
+		     archive_close_callback *);
+__LA_DECL int		 archive_read_open2(struct archive *, void *_client_data,
+		     archive_open_callback *, archive_read_callback *,
+		     archive_skip_callback *, archive_close_callback *);
+
+/*
+ * A variety of shortcuts that invoke archive_read_open() with
+ * canned callbacks suitable for common situations.  The ones that
+ * accept a block size handle tape blocking correctly.
+ */
+/* Use this if you know the filename.  Note: NULL indicates stdin. */
+__LA_DECL int		 archive_read_open_filename(struct archive *,
+		     const char *_filename, size_t _block_size);
+/* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */
+__LA_DECL int		 archive_read_open_file(struct archive *,
+		     const char *_filename, size_t _block_size);
+/* Read an archive that's stored in memory. */
+__LA_DECL int		 archive_read_open_memory(struct archive *,
+		     void * buff, size_t size);
+/* A more involved version that is only used for internal testing. */
+__LA_DECL int		archive_read_open_memory2(struct archive *a, void *buff,
+		     size_t size, size_t read_size);
+/* Read an archive that's already open, using the file descriptor. */
+__LA_DECL int		 archive_read_open_fd(struct archive *, int _fd,
+		     size_t _block_size);
+/* Read an archive that's already open, using a FILE *. */
+/* Note: DO NOT use this with tape drives. */
+__LA_DECL int		 archive_read_open_FILE(struct archive *, FILE *_file);
+
+/* Parses and returns next entry header. */
+__LA_DECL int		 archive_read_next_header(struct archive *,
+		     struct archive_entry **);
+
+/* Parses and returns next entry header using the archive_entry passed in */
+__LA_DECL int		 archive_read_next_header2(struct archive *,
+		     struct archive_entry *);
+
+/*
+ * Retrieve the byte offset in UNCOMPRESSED data where last-read
+ * header started.
+ */
+__LA_DECL __LA_INT64_T		 archive_read_header_position(struct archive *);
+
+/* Read data from the body of an entry.  Similar to read(2). */
+__LA_DECL __LA_SSIZE_T		 archive_read_data(struct archive *,
+				    void *, size_t);
+
+/*
+ * A zero-copy version of archive_read_data that also exposes the file offset
+ * of each returned block.  Note that the client has no way to specify
+ * the desired size of the block.  The API does guarantee that offsets will
+ * be strictly increasing and that returned blocks will not overlap.
+ */
+#if ARCHIVE_VERSION_NUMBER < 3000000
+__LA_DECL int		 archive_read_data_block(struct archive *a,
+			    const void **buff, size_t *size, off_t *offset);
+#else
+__LA_DECL int		 archive_read_data_block(struct archive *a,
+			    const void **buff, size_t *size,
+			    __LA_INT64_T *offset);
+#endif
+
+/*-
+ * Some convenience functions that are built on archive_read_data:
+ *  'skip': skips entire entry
+ *  'into_buffer': writes data into memory buffer that you provide
+ *  'into_fd': writes data to specified filedes
+ */
+__LA_DECL int		 archive_read_data_skip(struct archive *);
+__LA_DECL int		 archive_read_data_into_buffer(struct archive *,
+			    void *buffer, __LA_SSIZE_T len);
+__LA_DECL int		 archive_read_data_into_fd(struct archive *, int fd);
+
+/*
+ * Set read options.
+ */
+/* Apply option string to the format only. */
+__LA_DECL int		archive_read_set_format_options(struct archive *_a,
+			    const char *s);
+/* Apply option string to the filter only. */
+__LA_DECL int		archive_read_set_filter_options(struct archive *_a,
+			    const char *s);
+/* Apply option string to both the format and the filter. */
+__LA_DECL int		archive_read_set_options(struct archive *_a,
+			    const char *s);
+
+/*-
+ * Convenience function to recreate the current entry (whose header
+ * has just been read) on disk.
+ *
+ * This does quite a bit more than just copy data to disk. It also:
+ *  - Creates intermediate directories as required.
+ *  - Manages directory permissions:  non-writable directories will
+ *    be initially created with write permission enabled; when the
+ *    archive is closed, dir permissions are edited to the values specified
+ *    in the archive.
+ *  - Checks hardlinks:  hardlinks will not be extracted unless the
+ *    linked-to file was also extracted within the same session. (TODO)
+ */
+
+/* The "flags" argument selects optional behavior, 'OR' the flags you want. */
+
+/* Default: Do not try to set owner/group. */
+#define	ARCHIVE_EXTRACT_OWNER			(0x0001)
+/* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */
+#define	ARCHIVE_EXTRACT_PERM			(0x0002)
+/* Default: Do not restore mtime/atime. */
+#define	ARCHIVE_EXTRACT_TIME			(0x0004)
+/* Default: Replace existing files. */
+#define	ARCHIVE_EXTRACT_NO_OVERWRITE 		(0x0008)
+/* Default: Try create first, unlink only if create fails with EEXIST. */
+#define	ARCHIVE_EXTRACT_UNLINK			(0x0010)
+/* Default: Do not restore ACLs. */
+#define	ARCHIVE_EXTRACT_ACL			(0x0020)
+/* Default: Do not restore fflags. */
+#define	ARCHIVE_EXTRACT_FFLAGS			(0x0040)
+/* Default: Do not restore xattrs. */
+#define	ARCHIVE_EXTRACT_XATTR 			(0x0080)
+/* Default: Do not try to guard against extracts redirected by symlinks. */
+/* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */
+#define	ARCHIVE_EXTRACT_SECURE_SYMLINKS		(0x0100)
+/* Default: Do not reject entries with '..' as path elements. */
+#define	ARCHIVE_EXTRACT_SECURE_NODOTDOT		(0x0200)
+/* Default: Create parent directories as needed. */
+#define	ARCHIVE_EXTRACT_NO_AUTODIR		(0x0400)
+/* Default: Overwrite files, even if one on disk is newer. */
+#define	ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER	(0x0800)
+/* Detect blocks of 0 and write holes instead. */
+#define	ARCHIVE_EXTRACT_SPARSE			(0x1000)
+
+__LA_DECL int	 archive_read_extract(struct archive *, struct archive_entry *,
+		     int flags);
+__LA_DECL int	 archive_read_extract2(struct archive *, struct archive_entry *,
+		     struct archive * /* dest */);
+__LA_DECL void	 archive_read_extract_set_progress_callback(struct archive *,
+		     void (*_progress_func)(void *), void *_user_data);
+
+/* Record the dev/ino of a file that will not be written.  This is
+ * generally set to the dev/ino of the archive being read. */
+__LA_DECL void		archive_read_extract_set_skip_file(struct archive *,
+		     dev_t, ino_t);
+
+/* Close the file and release most resources. */
+__LA_DECL int		 archive_read_close(struct archive *);
+/* Release all resources and destroy the object. */
+/* Note that archive_read_finish will call archive_read_close for you. */
+#if ARCHIVE_VERSION_NUMBER < 2000000
+/* Erroneously declared to return void in libarchive 1.x */
+__LA_DECL void		 archive_read_finish(struct archive *);
+#else
+__LA_DECL int		 archive_read_finish(struct archive *);
+#endif
+
+/*-
+ * To create an archive:
+ *   1) Ask archive_write_new for a archive writer object.
+ *   2) Set any global properties.  In particular, you should set
+ *      the compression and format to use.
+ *   3) Call archive_write_open to open the file (most people
+ *       will use archive_write_open_file or archive_write_open_fd,
+ *       which provide convenient canned I/O callbacks for you).
+ *   4) For each entry:
+ *      - construct an appropriate struct archive_entry structure
+ *      - archive_write_header to write the header
+ *      - archive_write_data to write the entry data
+ *   5) archive_write_close to close the output
+ *   6) archive_write_finish to cleanup the writer and release resources
+ */
+__LA_DECL struct archive	*archive_write_new(void);
+__LA_DECL int		 archive_write_set_bytes_per_block(struct archive *,
+		     int bytes_per_block);
+__LA_DECL int		 archive_write_get_bytes_per_block(struct archive *);
+/* XXX This is badly misnamed; suggestions appreciated. XXX */
+__LA_DECL int		 archive_write_set_bytes_in_last_block(struct archive *,
+		     int bytes_in_last_block);
+__LA_DECL int		 archive_write_get_bytes_in_last_block(struct archive *);
+
+/* The dev/ino of a file that won't be archived.  This is used
+ * to avoid recursively adding an archive to itself. */
+__LA_DECL int		 archive_write_set_skip_file(struct archive *, dev_t, ino_t);
+
+__LA_DECL int		 archive_write_set_compression_bzip2(struct archive *);
+__LA_DECL int		 archive_write_set_compression_compress(struct archive *);
+__LA_DECL int		 archive_write_set_compression_gzip(struct archive *);
+__LA_DECL int		 archive_write_set_compression_lzma(struct archive *);
+__LA_DECL int		 archive_write_set_compression_none(struct archive *);
+__LA_DECL int		 archive_write_set_compression_program(struct archive *,
+		     const char *cmd);
+__LA_DECL int		 archive_write_set_compression_xz(struct archive *);
+/* A convenience function to set the format based on the code or name. */
+__LA_DECL int		 archive_write_set_format(struct archive *, int format_code);
+__LA_DECL int		 archive_write_set_format_by_name(struct archive *,
+		     const char *name);
+/* To minimize link pollution, use one or more of the following. */
+__LA_DECL int		 archive_write_set_format_ar_bsd(struct archive *);
+__LA_DECL int		 archive_write_set_format_ar_svr4(struct archive *);
+__LA_DECL int		 archive_write_set_format_cpio(struct archive *);
+__LA_DECL int		 archive_write_set_format_cpio_newc(struct archive *);
+__LA_DECL int		 archive_write_set_format_mtree(struct archive *);
+/* TODO: int archive_write_set_format_old_tar(struct archive *); */
+__LA_DECL int		 archive_write_set_format_pax(struct archive *);
+__LA_DECL int		 archive_write_set_format_pax_restricted(struct archive *);
+__LA_DECL int		 archive_write_set_format_shar(struct archive *);
+__LA_DECL int		 archive_write_set_format_shar_dump(struct archive *);
+__LA_DECL int		 archive_write_set_format_ustar(struct archive *);
+__LA_DECL int		 archive_write_set_format_zip(struct archive *);
+__LA_DECL int		 archive_write_open(struct archive *, void *,
+		     archive_open_callback *, archive_write_callback *,
+		     archive_close_callback *);
+__LA_DECL int		 archive_write_open_fd(struct archive *, int _fd);
+__LA_DECL int		 archive_write_open_filename(struct archive *, const char *_file);
+/* A deprecated synonym for archive_write_open_filename() */
+__LA_DECL int		 archive_write_open_file(struct archive *, const char *_file);
+__LA_DECL int		 archive_write_open_FILE(struct archive *, FILE *);
+/* _buffSize is the size of the buffer, _used refers to a variable that
+ * will be updated after each write into the buffer. */
+__LA_DECL int		 archive_write_open_memory(struct archive *,
+			void *_buffer, size_t _buffSize, size_t *_used);
+
+/*
+ * Note that the library will truncate writes beyond the size provided
+ * to archive_write_header or pad if the provided data is short.
+ */
+__LA_DECL int		 archive_write_header(struct archive *,
+		     struct archive_entry *);
+#if ARCHIVE_VERSION_NUMBER < 2000000
+/* This was erroneously declared to return "int" in libarchive 1.x. */
+__LA_DECL int		 archive_write_data(struct archive *,
+			    const void *, size_t);
+#else
+/* Libarchive 2.0 and later return ssize_t here. */
+__LA_DECL __LA_SSIZE_T	 archive_write_data(struct archive *,
+			    const void *, size_t);
+#endif
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/* Libarchive 1.x and 2.x use off_t for the argument, but that's not
+ * stable on Linux. */
+__LA_DECL __LA_SSIZE_T	 archive_write_data_block(struct archive *,
+				    const void *, size_t, off_t);
+#else
+/* Libarchive 3.0 uses explicit int64_t to ensure consistent 64-bit support. */
+__LA_DECL __LA_SSIZE_T	 archive_write_data_block(struct archive *,
+				    const void *, size_t, __LA_INT64_T);
+#endif
+__LA_DECL int		 archive_write_finish_entry(struct archive *);
+__LA_DECL int		 archive_write_close(struct archive *);
+#if ARCHIVE_VERSION_NUMBER < 2000000
+/* Return value was incorrect in libarchive 1.x. */
+__LA_DECL void		 archive_write_finish(struct archive *);
+#else
+/* Libarchive 2.x and later returns an error if this fails. */
+/* It can fail if the archive wasn't already closed, in which case
+ * archive_write_finish() will implicitly call archive_write_close(). */
+__LA_DECL int		 archive_write_finish(struct archive *);
+#endif
+
+/*
+ * Set write options.
+ */
+/* Apply option string to the format only. */
+__LA_DECL int		archive_write_set_format_options(struct archive *_a,
+			    const char *s);
+/* Apply option string to the compressor only. */
+__LA_DECL int		archive_write_set_compressor_options(struct archive *_a,
+			    const char *s);
+/* Apply option string to both the format and the compressor. */
+__LA_DECL int		archive_write_set_options(struct archive *_a,
+			    const char *s);
+
+
+/*-
+ * ARCHIVE_WRITE_DISK API
+ *
+ * To create objects on disk:
+ *   1) Ask archive_write_disk_new for a new archive_write_disk object.
+ *   2) Set any global properties.  In particular, you probably
+ *      want to set the options.
+ *   3) For each entry:
+ *      - construct an appropriate struct archive_entry structure
+ *      - archive_write_header to create the file/dir/etc on disk
+ *      - archive_write_data to write the entry data
+ *   4) archive_write_finish to cleanup the writer and release resources
+ *
+ * In particular, you can use this in conjunction with archive_read()
+ * to pull entries out of an archive and create them on disk.
+ */
+__LA_DECL struct archive	*archive_write_disk_new(void);
+/* This file will not be overwritten. */
+__LA_DECL int		 archive_write_disk_set_skip_file(struct archive *,
+		     dev_t, ino_t);
+/* Set flags to control how the next item gets created.
+ * This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */
+__LA_DECL int		 archive_write_disk_set_options(struct archive *,
+		     int flags);
+/*
+ * The lookup functions are given uname/uid (or gname/gid) pairs and
+ * return a uid (gid) suitable for this system.  These are used for
+ * restoring ownership and for setting ACLs.  The default functions
+ * are naive, they just return the uid/gid.  These are small, so reasonable
+ * for applications that don't need to preserve ownership; they
+ * are probably also appropriate for applications that are doing
+ * same-system backup and restore.
+ */
+/*
+ * The "standard" lookup functions use common system calls to lookup
+ * the uname/gname, falling back to the uid/gid if the names can't be
+ * found.  They cache lookups and are reasonably fast, but can be very
+ * large, so they are not used unless you ask for them.  In
+ * particular, these match the specifications of POSIX "pax" and old
+ * POSIX "tar".
+ */
+__LA_DECL int	 archive_write_disk_set_standard_lookup(struct archive *);
+/*
+ * If neither the default (naive) nor the standard (big) functions suit
+ * your needs, you can write your own and register them.  Be sure to
+ * include a cleanup function if you have allocated private data.
+ */
+__LA_DECL int	 archive_write_disk_set_group_lookup(struct archive *,
+			    void * /* private_data */,
+			    __LA_GID_T (*)(void *, const char *, __LA_GID_T),
+			    void (* /* cleanup */)(void *));
+__LA_DECL int	 archive_write_disk_set_user_lookup(struct archive *,
+			    void * /* private_data */,
+			    __LA_UID_T (*)(void *, const char *, __LA_UID_T),
+			    void (* /* cleanup */)(void *));
+
+/*
+ * ARCHIVE_READ_DISK API
+ *
+ * This is still evolving and somewhat experimental.
+ */
+__LA_DECL struct archive *archive_read_disk_new(void);
+/* The names for symlink modes here correspond to an old BSD
+ * command-line argument convention: -L, -P, -H */
+/* Follow all symlinks. */
+__LA_DECL int archive_read_disk_set_symlink_logical(struct archive *);
+/* Follow no symlinks. */
+__LA_DECL int archive_read_disk_set_symlink_physical(struct archive *);
+/* Follow symlink initially, then not. */
+__LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *);
+/* TODO: Handle Linux stat32/stat64 ugliness. <sigh> */
+__LA_DECL int archive_read_disk_entry_from_file(struct archive *,
+    struct archive_entry *, int /* fd */, const struct stat *);
+/* Look up gname for gid or uname for uid. */
+/* Default implementations are very, very stupid. */
+__LA_DECL const char *archive_read_disk_gname(struct archive *, __LA_GID_T);
+__LA_DECL const char *archive_read_disk_uname(struct archive *, __LA_UID_T);
+/* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the
+ * results for performance. */
+__LA_DECL int	archive_read_disk_set_standard_lookup(struct archive *);
+/* You can install your own lookups if you like. */
+__LA_DECL int	archive_read_disk_set_gname_lookup(struct archive *,
+    void * /* private_data */,
+    const char *(* /* lookup_fn */)(void *, __LA_GID_T),
+    void (* /* cleanup_fn */)(void *));
+__LA_DECL int	archive_read_disk_set_uname_lookup(struct archive *,
+    void * /* private_data */,
+    const char *(* /* lookup_fn */)(void *, __LA_UID_T),
+    void (* /* cleanup_fn */)(void *));
+
+/*
+ * Accessor functions to read/set various information in
+ * the struct archive object:
+ */
+/* Bytes written after compression or read before decompression. */
+__LA_DECL __LA_INT64_T	 archive_position_compressed(struct archive *);
+/* Bytes written to compressor or read from decompressor. */
+__LA_DECL __LA_INT64_T	 archive_position_uncompressed(struct archive *);
+
+__LA_DECL const char	*archive_compression_name(struct archive *);
+__LA_DECL int		 archive_compression(struct archive *);
+__LA_DECL int		 archive_errno(struct archive *);
+__LA_DECL const char	*archive_error_string(struct archive *);
+__LA_DECL const char	*archive_format_name(struct archive *);
+__LA_DECL int		 archive_format(struct archive *);
+__LA_DECL void		 archive_clear_error(struct archive *);
+__LA_DECL void		 archive_set_error(struct archive *, int _err,
+			    const char *fmt, ...)
+			 __attribute__((__format__(__printf__,3,4)));
+__LA_DECL void		 archive_copy_error(struct archive *dest,
+			    struct archive *src);
+__LA_DECL int		 archive_file_count(struct archive *);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* These are meaningless outside of this header. */
+#undef __LA_DECL
+#undef __LA_GID_T
+#undef __LA_UID_T
+
+/* These need to remain defined because they're used in the
+ * callback type definitions.  XXX Fix this.  This is ugly. XXX */
+/* #undef __LA_INT64_T */
+/* #undef __LA_SSIZE_T */
+
+#endif /* !ARCHIVE_H_INCLUDED */

Property changes on: lab4/.minix-src/include/archive.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c.h
===================================================================
--- lab4/.minix-src/include/atf-c.h	(nonexistent)
+++ lab4/.minix-src/include/atf-c.h	(revision 13)
@@ -0,0 +1,37 @@
+/*
+ * Automated Testing Framework (atf)
+ *
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(ATF_C_H)
+#define ATF_C_H
+
+#include <atf-c/error.h>
+#include <atf-c/macros.h>
+#include <atf-c/utils.h>
+
+#endif /* !defined(ATF_C_H) */

Property changes on: lab4/.minix-src/include/atf-c.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/bm.h
===================================================================
--- lab4/.minix-src/include/bm.h	(nonexistent)
+++ lab4/.minix-src/include/bm.h	(revision 13)
@@ -0,0 +1,57 @@
+/*	$NetBSD: bm.h,v 1.5 2005/02/03 04:39:32 perry Exp $	*/
+
+/*-
+ * Copyright (c) 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Andrew Hume of AT&T Bell Laboratories.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)bm.h	8.6 (Berkeley) 6/21/94
+ */
+
+#ifndef _BM_H_
+#define	_BM_H_
+
+typedef struct {
+	u_char	*pat;			/* pattern */
+	size_t	 patlen;		/* pattern length */
+	size_t	*delta;			/* skip delta */
+	int	 rarec;			/* rare character */
+	size_t	 rareoff;		/* rare offset */
+	size_t	 md2;			/* mini delta */
+} bm_pat;
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+bm_pat	*bm_comp(u_char const *, size_t, u_char const *);
+u_char	*bm_exec(bm_pat *, u_char *, size_t);
+void	 bm_free(bm_pat *);
+__END_DECLS
+
+#endif /* !_BM_H_ */

Property changes on: lab4/.minix-src/include/bm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/archive_entry.h
===================================================================
--- lab4/.minix-src/include/archive_entry.h	(nonexistent)
+++ lab4/.minix-src/include/archive_entry.h	(revision 13)
@@ -0,0 +1,524 @@
+/*-
+ * Copyright (c) 2003-2008 Tim Kientzle
+ * 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(S) ``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(S) 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.
+ *
+ * $FreeBSD: head/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $
+ */
+
+#ifndef ARCHIVE_ENTRY_H_INCLUDED
+#define	ARCHIVE_ENTRY_H_INCLUDED
+
+/*
+ * Note: archive_entry.h is for use outside of libarchive; the
+ * configuration headers (config.h, archive_platform.h, etc.) are
+ * purely internal.  Do NOT use HAVE_XXX configuration macros to
+ * control the behavior of this header!  If you must conditionalize,
+ * use predefined compiler and/or platform macros.
+ */
+
+#include <sys/types.h>
+#include <stddef.h>  /* for wchar_t */
+#include <time.h>
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include <windows.h>
+#endif
+
+/* Get appropriate definitions of standard POSIX-style types. */
+/* These should match the types used in 'struct stat' */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define	__LA_INT64_T	__int64
+# if defined(__BORLANDC__)
+#  define	__LA_UID_T	uid_t
+#  define	__LA_GID_T	gid_t
+#  define	__LA_DEV_T	dev_t
+#  define	__LA_MODE_T	mode_t
+# else
+#  define	__LA_UID_T	short
+#  define	__LA_GID_T	short
+#  define	__LA_DEV_T	unsigned int
+#  define	__LA_MODE_T	unsigned short
+# endif
+#else
+#include <unistd.h>
+#define	__LA_INT64_T	int64_t
+#define	__LA_UID_T	uid_t
+#define	__LA_GID_T	gid_t
+#define	__LA_DEV_T	dev_t
+#define	__LA_MODE_T	mode_t
+#endif
+
+/*
+ * XXX Is this defined for all Windows compilers?  If so, in what
+ * header?  It would be nice to remove the __LA_INO_T indirection and
+ * just use plain ino_t everywhere.  Likewise for the other types just
+ * above.
+ */
+#define	__LA_INO_T	ino_t
+
+
+/*
+ * On Windows, define LIBARCHIVE_STATIC if you're building or using a
+ * .lib.  The default here assumes you're building a DLL.  Only
+ * libarchive source should ever define __LIBARCHIVE_BUILD.
+ */
+#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
+# ifdef __LIBARCHIVE_BUILD
+#  ifdef __GNUC__
+#   define __LA_DECL	__attribute__((dllexport)) extern
+#  else
+#   define __LA_DECL	__declspec(dllexport)
+#  endif
+# else
+#  ifdef __GNUC__
+#   define __LA_DECL	__attribute__((dllimport)) extern
+#  else
+#   define __LA_DECL	__declspec(dllimport)
+#  endif
+# endif
+#else
+/* Static libraries on all platforms and shared libraries on non-Windows. */
+# define __LA_DECL
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Description of an archive entry.
+ *
+ * You can think of this as "struct stat" with some text fields added in.
+ *
+ * TODO: Add "comment", "charset", and possibly other entries that are
+ * supported by "pax interchange" format.  However, GNU, ustar, cpio,
+ * and other variants don't support these features, so they're not an
+ * excruciatingly high priority right now.
+ *
+ * TODO: "pax interchange" format allows essentially arbitrary
+ * key/value attributes to be attached to any entry.  Supporting
+ * such extensions may make this library useful for special
+ * applications (e.g., a package manager could attach special
+ * package-management attributes to each entry).
+ */
+struct archive_entry;
+
+/*
+ * File-type constants.  These are returned from archive_entry_filetype()
+ * and passed to archive_entry_set_filetype().
+ *
+ * These values match S_XXX defines on every platform I've checked,
+ * including Windows, AIX, Linux, Solaris, and BSD.  They're
+ * (re)defined here because platforms generally don't define the ones
+ * they don't support.  For example, Windows doesn't define S_IFLNK or
+ * S_IFBLK.  Instead of having a mass of conditional logic and system
+ * checks to define any S_XXX values that aren't supported locally,
+ * I've just defined a new set of such constants so that
+ * libarchive-based applications can manipulate and identify archive
+ * entries properly even if the hosting platform can't store them on
+ * disk.
+ *
+ * These values are also used directly within some portable formats,
+ * such as cpio.  If you find a platform that varies from these, the
+ * correct solution is to leave these alone and translate from these
+ * portable values to platform-native values when entries are read from
+ * or written to disk.
+ */
+#define	AE_IFMT		0170000
+#define	AE_IFREG	0100000
+#define	AE_IFLNK	0120000
+#define	AE_IFSOCK	0140000
+#define	AE_IFCHR	0020000
+#define	AE_IFBLK	0060000
+#define	AE_IFDIR	0040000
+#define	AE_IFIFO	0010000
+
+/*
+ * Basic object manipulation
+ */
+
+__LA_DECL struct archive_entry	*archive_entry_clear(struct archive_entry *);
+/* The 'clone' function does a deep copy; all of the strings are copied too. */
+__LA_DECL struct archive_entry	*archive_entry_clone(struct archive_entry *);
+__LA_DECL void			 archive_entry_free(struct archive_entry *);
+__LA_DECL struct archive_entry	*archive_entry_new(void);
+
+/*
+ * Retrieve fields from an archive_entry.
+ *
+ * There are a number of implicit conversions among these fields.  For
+ * example, if a regular string field is set and you read the _w wide
+ * character field, the entry will implicitly convert narrow-to-wide
+ * using the current locale.  Similarly, dev values are automatically
+ * updated when you write devmajor or devminor and vice versa.
+ *
+ * In addition, fields can be "set" or "unset."  Unset string fields
+ * return NULL, non-string fields have _is_set() functions to test
+ * whether they've been set.  You can "unset" a string field by
+ * assigning NULL; non-string fields have _unset() functions to
+ * unset them.
+ *
+ * Note: There is one ambiguity in the above; string fields will
+ * also return NULL when implicit character set conversions fail.
+ * This is usually what you want.
+ */
+__LA_DECL time_t	 archive_entry_atime(struct archive_entry *);
+__LA_DECL long		 archive_entry_atime_nsec(struct archive_entry *);
+__LA_DECL int		 archive_entry_atime_is_set(struct archive_entry *);
+__LA_DECL time_t	 archive_entry_birthtime(struct archive_entry *);
+__LA_DECL long		 archive_entry_birthtime_nsec(struct archive_entry *);
+__LA_DECL int		 archive_entry_birthtime_is_set(struct archive_entry *);
+__LA_DECL time_t	 archive_entry_ctime(struct archive_entry *);
+__LA_DECL long		 archive_entry_ctime_nsec(struct archive_entry *);
+__LA_DECL int		 archive_entry_ctime_is_set(struct archive_entry *);
+__LA_DECL dev_t		 archive_entry_dev(struct archive_entry *);
+__LA_DECL dev_t		 archive_entry_devmajor(struct archive_entry *);
+__LA_DECL dev_t		 archive_entry_devminor(struct archive_entry *);
+__LA_DECL __LA_MODE_T	 archive_entry_filetype(struct archive_entry *);
+__LA_DECL void		 archive_entry_fflags(struct archive_entry *,
+			    unsigned long * /* set */,
+			    unsigned long * /* clear */);
+__LA_DECL const char	*archive_entry_fflags_text(struct archive_entry *);
+__LA_DECL __LA_GID_T	 archive_entry_gid(struct archive_entry *);
+__LA_DECL const char	*archive_entry_gname(struct archive_entry *);
+__LA_DECL const wchar_t	*archive_entry_gname_w(struct archive_entry *);
+__LA_DECL const char	*archive_entry_hardlink(struct archive_entry *);
+__LA_DECL const wchar_t	*archive_entry_hardlink_w(struct archive_entry *);
+__LA_DECL __LA_INO_T	 archive_entry_ino(struct archive_entry *);
+__LA_DECL __LA_INT64_T	 archive_entry_ino64(struct archive_entry *);
+__LA_DECL __LA_MODE_T	 archive_entry_mode(struct archive_entry *);
+__LA_DECL time_t	 archive_entry_mtime(struct archive_entry *);
+__LA_DECL long		 archive_entry_mtime_nsec(struct archive_entry *);
+__LA_DECL int		 archive_entry_mtime_is_set(struct archive_entry *);
+__LA_DECL unsigned int	 archive_entry_nlink(struct archive_entry *);
+__LA_DECL const char	*archive_entry_pathname(struct archive_entry *);
+__LA_DECL const wchar_t	*archive_entry_pathname_w(struct archive_entry *);
+__LA_DECL dev_t		 archive_entry_rdev(struct archive_entry *);
+__LA_DECL dev_t		 archive_entry_rdevmajor(struct archive_entry *);
+__LA_DECL dev_t		 archive_entry_rdevminor(struct archive_entry *);
+__LA_DECL const char	*archive_entry_sourcepath(struct archive_entry *);
+__LA_DECL __LA_INT64_T	 archive_entry_size(struct archive_entry *);
+__LA_DECL int		 archive_entry_size_is_set(struct archive_entry *);
+__LA_DECL const char	*archive_entry_strmode(struct archive_entry *);
+__LA_DECL const char	*archive_entry_symlink(struct archive_entry *);
+__LA_DECL const wchar_t	*archive_entry_symlink_w(struct archive_entry *);
+__LA_DECL __LA_UID_T	 archive_entry_uid(struct archive_entry *);
+__LA_DECL const char	*archive_entry_uname(struct archive_entry *);
+__LA_DECL const wchar_t	*archive_entry_uname_w(struct archive_entry *);
+
+/*
+ * Set fields in an archive_entry.
+ *
+ * Note that string 'set' functions do not copy the string, only the pointer.
+ * In contrast, 'copy' functions do copy the object pointed to.
+ *
+ * Note: As of libarchive 2.4, 'set' functions do copy the string and
+ * are therefore exact synonyms for the 'copy' versions.  The 'copy'
+ * names will be retired in libarchive 3.0.
+ */
+
+__LA_DECL void	archive_entry_set_atime(struct archive_entry *, time_t, long);
+__LA_DECL void  archive_entry_unset_atime(struct archive_entry *);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+__LA_DECL void archive_entry_copy_bhfi(struct archive_entry *,
+									   BY_HANDLE_FILE_INFORMATION *);
+#endif
+__LA_DECL void	archive_entry_set_birthtime(struct archive_entry *, time_t, long);
+__LA_DECL void  archive_entry_unset_birthtime(struct archive_entry *);
+__LA_DECL void	archive_entry_set_ctime(struct archive_entry *, time_t, long);
+__LA_DECL void  archive_entry_unset_ctime(struct archive_entry *);
+__LA_DECL void	archive_entry_set_dev(struct archive_entry *, dev_t);
+__LA_DECL void	archive_entry_set_devmajor(struct archive_entry *, dev_t);
+__LA_DECL void	archive_entry_set_devminor(struct archive_entry *, dev_t);
+__LA_DECL void	archive_entry_set_filetype(struct archive_entry *, unsigned int);
+__LA_DECL void	archive_entry_set_fflags(struct archive_entry *,
+	    unsigned long /* set */, unsigned long /* clear */);
+/* Returns pointer to start of first invalid token, or NULL if none. */
+/* Note that all recognized tokens are processed, regardless. */
+__LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *,
+	    const char *);
+__LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,
+	    const wchar_t *);
+__LA_DECL void	archive_entry_set_gid(struct archive_entry *, __LA_GID_T);
+__LA_DECL void	archive_entry_set_gname(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_gname(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int	archive_entry_update_gname_utf8(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_set_hardlink(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_hardlink(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int	archive_entry_update_hardlink_utf8(struct archive_entry *, const char *);
+#if ARCHIVE_VERSION_NUMBER >= 3000000
+/* Starting with libarchive 3.0, this will be synonym for ino64. */
+__LA_DECL void	archive_entry_set_ino(struct archive_entry *, __LA_INT64_T);
+#else
+__LA_DECL void	archive_entry_set_ino(struct archive_entry *, unsigned long);
+#endif
+__LA_DECL void	archive_entry_set_ino64(struct archive_entry *, __LA_INT64_T);
+__LA_DECL void	archive_entry_set_link(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_link(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_link_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int	archive_entry_update_link_utf8(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_set_mode(struct archive_entry *, __LA_MODE_T);
+__LA_DECL void	archive_entry_set_mtime(struct archive_entry *, time_t, long);
+__LA_DECL void  archive_entry_unset_mtime(struct archive_entry *);
+__LA_DECL void	archive_entry_set_nlink(struct archive_entry *, unsigned int);
+__LA_DECL void	archive_entry_set_pathname(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_pathname(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int	archive_entry_update_pathname_utf8(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_set_perm(struct archive_entry *, __LA_MODE_T);
+__LA_DECL void	archive_entry_set_rdev(struct archive_entry *, dev_t);
+__LA_DECL void	archive_entry_set_rdevmajor(struct archive_entry *, dev_t);
+__LA_DECL void	archive_entry_set_rdevminor(struct archive_entry *, dev_t);
+__LA_DECL void	archive_entry_set_size(struct archive_entry *, __LA_INT64_T);
+__LA_DECL void	archive_entry_unset_size(struct archive_entry *);
+__LA_DECL void	archive_entry_copy_sourcepath(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_set_symlink(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_symlink(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int	archive_entry_update_symlink_utf8(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_set_uid(struct archive_entry *, __LA_UID_T);
+__LA_DECL void	archive_entry_set_uname(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_uname(struct archive_entry *, const char *);
+__LA_DECL void	archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int	archive_entry_update_uname_utf8(struct archive_entry *, const char *);
+/*
+ * Routines to bulk copy fields to/from a platform-native "struct
+ * stat."  Libarchive used to just store a struct stat inside of each
+ * archive_entry object, but this created issues when trying to
+ * manipulate archives on systems different than the ones they were
+ * created on.
+ *
+ * TODO: On Linux, provide both stat32 and stat64 versions of these functions.
+ */
+__LA_DECL const struct stat	*archive_entry_stat(struct archive_entry *);
+__LA_DECL void	archive_entry_copy_stat(struct archive_entry *, const struct stat *);
+
+
+/*
+ * ACL routines.  This used to simply store and return text-format ACL
+ * strings, but that proved insufficient for a number of reasons:
+ *   = clients need control over uname/uid and gname/gid mappings
+ *   = there are many different ACL text formats
+ *   = would like to be able to read/convert archives containing ACLs
+ *     on platforms that lack ACL libraries
+ *
+ *  This last point, in particular, forces me to implement a reasonably
+ *  complete set of ACL support routines.
+ *
+ *  TODO: Extend this to support NFSv4/NTFS permissions.  That should
+ *  allow full ACL support on Mac OS, in particular, which uses
+ *  POSIX.1e-style interfaces to manipulate NFSv4/NTFS permissions.
+ */
+
+/*
+ * Permission bits mimic POSIX.1e.  Note that I've not followed POSIX.1e's
+ * "permset"/"perm" abstract type nonsense.  A permset is just a simple
+ * bitmap, following long-standing Unix tradition.
+ */
+#define	ARCHIVE_ENTRY_ACL_EXECUTE	1
+#define	ARCHIVE_ENTRY_ACL_WRITE		2
+#define	ARCHIVE_ENTRY_ACL_READ		4
+
+/* We need to be able to specify either or both of these. */
+#define	ARCHIVE_ENTRY_ACL_TYPE_ACCESS	256
+#define	ARCHIVE_ENTRY_ACL_TYPE_DEFAULT	512
+
+/* Tag values mimic POSIX.1e */
+#define	ARCHIVE_ENTRY_ACL_USER		10001	/* Specified user. */
+#define	ARCHIVE_ENTRY_ACL_USER_OBJ 	10002	/* User who owns the file. */
+#define	ARCHIVE_ENTRY_ACL_GROUP		10003	/* Specified group. */
+#define	ARCHIVE_ENTRY_ACL_GROUP_OBJ	10004	/* Group who owns the file. */
+#define	ARCHIVE_ENTRY_ACL_MASK		10005	/* Modify group access. */
+#define	ARCHIVE_ENTRY_ACL_OTHER		10006	/* Public. */
+
+/*
+ * Set the ACL by clearing it and adding entries one at a time.
+ * Unlike the POSIX.1e ACL routines, you must specify the type
+ * (access/default) for each entry.  Internally, the ACL data is just
+ * a soup of entries.  API calls here allow you to retrieve just the
+ * entries of interest.  This design (which goes against the spirit of
+ * POSIX.1e) is useful for handling archive formats that combine
+ * default and access information in a single ACL list.
+ */
+__LA_DECL void	 archive_entry_acl_clear(struct archive_entry *);
+__LA_DECL void	 archive_entry_acl_add_entry(struct archive_entry *,
+	    int /* type */, int /* permset */, int /* tag */,
+	    int /* qual */, const char * /* name */);
+__LA_DECL void	 archive_entry_acl_add_entry_w(struct archive_entry *,
+	    int /* type */, int /* permset */, int /* tag */,
+	    int /* qual */, const wchar_t * /* name */);
+
+/*
+ * To retrieve the ACL, first "reset", then repeatedly ask for the
+ * "next" entry.  The want_type parameter allows you to request only
+ * access entries or only default entries.
+ */
+__LA_DECL int	 archive_entry_acl_reset(struct archive_entry *, int /* want_type */);
+__LA_DECL int	 archive_entry_acl_next(struct archive_entry *, int /* want_type */,
+	    int * /* type */, int * /* permset */, int * /* tag */,
+	    int * /* qual */, const char ** /* name */);
+__LA_DECL int	 archive_entry_acl_next_w(struct archive_entry *, int /* want_type */,
+	    int * /* type */, int * /* permset */, int * /* tag */,
+	    int * /* qual */, const wchar_t ** /* name */);
+
+/*
+ * Construct a text-format ACL.  The flags argument is a bitmask that
+ * can include any of the following:
+ *
+ * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - Include access entries.
+ * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - Include default entries.
+ * ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in
+ *    each ACL entry.  (As used by 'star'.)
+ * ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include "default:" before each
+ *    default ACL entry.
+ */
+#define	ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID	1024
+#define	ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT	2048
+__LA_DECL const wchar_t	*archive_entry_acl_text_w(struct archive_entry *,
+		    int /* flags */);
+
+/* Return a count of entries matching 'want_type' */
+__LA_DECL int	 archive_entry_acl_count(struct archive_entry *, int /* want_type */);
+
+/*
+ * Private ACL parser.  This is private because it handles some
+ * very weird formats that clients should not be messing with.
+ * Clients should only deal with their platform-native formats.
+ * Because of the need to support many formats cleanly, new arguments
+ * are likely to get added on a regular basis.  Clients who try to use
+ * this interface are likely to be surprised when it changes.
+ *
+ * You were warned!
+ *
+ * TODO: Move this declaration out of the public header and into
+ * a private header.  Warnings above are silly.
+ */
+__LA_DECL int		 __archive_entry_acl_parse_w(struct archive_entry *,
+		    const wchar_t *, int /* type */);
+
+/*
+ * extended attributes
+ */
+
+__LA_DECL void	 archive_entry_xattr_clear(struct archive_entry *);
+__LA_DECL void	 archive_entry_xattr_add_entry(struct archive_entry *,
+	    const char * /* name */, const void * /* value */,
+	    size_t /* size */);
+
+/*
+ * To retrieve the xattr list, first "reset", then repeatedly ask for the
+ * "next" entry.
+ */
+
+__LA_DECL int	archive_entry_xattr_count(struct archive_entry *);
+__LA_DECL int	archive_entry_xattr_reset(struct archive_entry *);
+__LA_DECL int	archive_entry_xattr_next(struct archive_entry *,
+	    const char ** /* name */, const void ** /* value */, size_t *);
+
+/*
+ * Utility to match up hardlinks.
+ *
+ * The 'struct archive_entry_linkresolver' is a cache of archive entries
+ * for files with multiple links.  Here's how to use it:
+ *   1. Create a lookup object with archive_entry_linkresolver_new()
+ *   2. Tell it the archive format you're using.
+ *   3. Hand each archive_entry to archive_entry_linkify().
+ *      That function will return 0, 1, or 2 entries that should
+ *      be written.
+ *   4. Call archive_entry_linkify(resolver, NULL) until
+ *      no more entries are returned.
+ *   5. Call archive_entry_link_resolver_free(resolver) to free resources.
+ *
+ * The entries returned have their hardlink and size fields updated
+ * appropriately.  If an entry is passed in that does not refer to
+ * a file with multiple links, it is returned unchanged.  The intention
+ * is that you should be able to simply filter all entries through
+ * this machine.
+ *
+ * To make things more efficient, be sure that each entry has a valid
+ * nlinks value.  The hardlink cache uses this to track when all links
+ * have been found.  If the nlinks value is zero, it will keep every
+ * name in the cache indefinitely, which can use a lot of memory.
+ *
+ * Note that archive_entry_size() is reset to zero if the file
+ * body should not be written to the archive.  Pay attention!
+ */
+struct archive_entry_linkresolver;
+
+/*
+ * There are three different strategies for marking hardlinks.
+ * The descriptions below name them after the best-known
+ * formats that rely on each strategy:
+ *
+ * "Old cpio" is the simplest, it always returns any entry unmodified.
+ *    As far as I know, only cpio formats use this.  Old cpio archives
+ *    store every link with the full body; the onus is on the dearchiver
+ *    to detect and properly link the files as they are restored.
+ * "tar" is also pretty simple; it caches a copy the first time it sees
+ *    any link.  Subsequent appearances are modified to be hardlink
+ *    references to the first one without any body.  Used by all tar
+ *    formats, although the newest tar formats permit the "old cpio" strategy
+ *    as well.  This strategy is very simple for the dearchiver,
+ *    and reasonably straightforward for the archiver.
+ * "new cpio" is trickier.  It stores the body only with the last
+ *    occurrence.  The complication is that we might not
+ *    see every link to a particular file in a single session, so
+ *    there's no easy way to know when we've seen the last occurrence.
+ *    The solution here is to queue one link until we see the next.
+ *    At the end of the session, you can enumerate any remaining
+ *    entries by calling archive_entry_linkify(NULL) and store those
+ *    bodies.  If you have a file with three links l1, l2, and l3,
+ *    you'll get the following behavior if you see all three links:
+ *           linkify(l1) => NULL   (the resolver stores l1 internally)
+ *           linkify(l2) => l1     (resolver stores l2, you write l1)
+ *           linkify(l3) => l2, l3 (all links seen, you can write both).
+ *    If you only see l1 and l2, you'll get this behavior:
+ *           linkify(l1) => NULL
+ *           linkify(l2) => l1
+ *           linkify(NULL) => l2   (at end, you retrieve remaining links)
+ *    As the name suggests, this strategy is used by newer cpio variants.
+ *    It's noticably more complex for the archiver, slightly more complex
+ *    for the dearchiver than the tar strategy, but makes it straightforward
+ *    to restore a file using any link by simply continuing to scan until
+ *    you see a link that is stored with a body.  In contrast, the tar
+ *    strategy requires you to rescan the archive from the beginning to
+ *    correctly extract an arbitrary link.
+ */
+
+__LA_DECL struct archive_entry_linkresolver *archive_entry_linkresolver_new(void);
+__LA_DECL void archive_entry_linkresolver_set_strategy(
+	struct archive_entry_linkresolver *, int /* format_code */);
+__LA_DECL void archive_entry_linkresolver_free(struct archive_entry_linkresolver *);
+__LA_DECL void archive_entry_linkify(struct archive_entry_linkresolver *,
+    struct archive_entry **, struct archive_entry **);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* This is meaningless outside of this header. */
+#undef __LA_DECL
+
+#endif /* !ARCHIVE_ENTRY_H_INCLUDED */

Property changes on: lab4/.minix-src/include/archive_entry.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atf-c++.hpp
===================================================================
--- lab4/.minix-src/include/atf-c++.hpp	(nonexistent)
+++ lab4/.minix-src/include/atf-c++.hpp	(revision 13)
@@ -0,0 +1,36 @@
+//
+// Automated Testing Framework (atf)
+//
+// Copyright (c) 2007 The NetBSD Foundation, Inc.
+// 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 NETBSD FOUNDATION, INC. AND
+// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#if !defined(_ATF_CXX_HPP_)
+#define _ATF_CXX_HPP_
+
+#include <atf-c++/macros.hpp>
+#include <atf-c++/utils.hpp>
+
+#endif // !defined(_ATF_CXX_HPP_)

Property changes on: lab4/.minix-src/include/atf-c++.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/blacklist.h
===================================================================
--- lab4/.minix-src/include/blacklist.h	(nonexistent)
+++ lab4/.minix-src/include/blacklist.h	(revision 13)
@@ -0,0 +1,46 @@
+/*	$NetBSD: blacklist.h,v 1.3 2015/01/23 18:48:56 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _BLACKLIST_H
+#define _BLACKLIST_H
+
+#include <sys/socket.h>
+
+__BEGIN_DECLS
+struct blacklist *blacklist_open(void);
+void blacklist_close(struct blacklist *);
+int blacklist(int, int, const char *);
+int blacklist_r(struct blacklist *, int, int, const char *);
+int blacklist_sa(int, int, const struct sockaddr *, socklen_t, const char *);
+int blacklist_sa_r(struct blacklist *, int, int,
+    const struct sockaddr *, socklen_t, const char *);
+__END_DECLS
+
+#endif /* _BLACKLIST_H */

Property changes on: lab4/.minix-src/include/blacklist.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/cdbw.h
===================================================================
--- lab4/.minix-src/include/cdbw.h	(nonexistent)
+++ lab4/.minix-src/include/cdbw.h	(revision 13)
@@ -0,0 +1,59 @@
+/*	$NetBSD: cdbw.h,v 1.2 2012/06/03 21:21:45 joerg Exp $	*/
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef	_CDBW_H
+#define	_CDBW_H
+
+#include <sys/cdefs.h>
+#include <inttypes.h>
+#include <stddef.h>
+
+struct cdbw;
+
+__BEGIN_DECLS
+
+struct cdbw	*cdbw_open(void);
+int		 cdbw_put(struct cdbw *, const void *, size_t,
+    const void *, size_t);
+int		 cdbw_put_data(struct cdbw *, const void *, size_t,
+    uint32_t *);
+int		 cdbw_put_key(struct cdbw *, const void *, size_t,
+    uint32_t);
+uint32_t	 cdbw_stable_seeder(void);
+int		 cdbw_output(struct cdbw *, int, const char[16],
+    uint32_t (*)(void));
+void		 cdbw_close(struct cdbw *);
+
+__END_DECLS
+
+#endif /* _CDBW_H */

Property changes on: lab4/.minix-src/include/cdbw.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ctype.h
===================================================================
--- lab4/.minix-src/include/ctype.h	(nonexistent)
+++ lab4/.minix-src/include/ctype.h	(revision 13)
@@ -0,0 +1,102 @@
+/*	$NetBSD: ctype.h,v 1.34 2013/04/28 19:39:56 joerg Exp $	*/
+
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ctype.h	5.3 (Berkeley) 4/3/91
+ */
+
+#ifndef _CTYPE_H_
+#define _CTYPE_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+__BEGIN_DECLS
+int	isalnum(int);
+int	isalpha(int);
+int	iscntrl(int);
+int	isdigit(int);
+int	isgraph(int);
+int	islower(int);
+int	isprint(int);
+int	ispunct(int);
+int	isspace(int);
+int	isupper(int);
+int	isxdigit(int);
+int	tolower(int);
+int	toupper(int);
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+
+int	isalnum_l(int, locale_t);
+int	isalpha_l(int, locale_t);
+int	isblank_l(int, locale_t);
+int	iscntrl_l(int, locale_t);
+int	isdigit_l(int, locale_t);
+int	isgraph_l(int, locale_t);
+int	islower_l(int, locale_t);
+int	isprint_l(int, locale_t);
+int	ispunct_l(int, locale_t);
+int	isspace_l(int, locale_t);
+int	isupper_l(int, locale_t);
+int	isxdigit_l(int, locale_t);
+int	tolower_l(int, locale_t);
+int	toupper_l(int, locale_t);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+int	isascii(int);
+int	toascii(int);
+int	_tolower(int);
+int	_toupper(int);
+#endif
+
+#if defined(_ISOC99_SOURCE) || (_POSIX_C_SOURCE - 0) > 200112L || \
+    (_XOPEN_SOURCE - 0) > 600 || defined(_NETBSD_SOURCE)
+int	isblank(int);
+#endif
+__END_DECLS
+
+#if defined(_NETBSD_SOURCE) && !defined(_CTYPE_NOINLINE) && \
+    !defined(__cplusplus)
+#include <sys/ctype_inline.h>
+#else
+#include <sys/ctype_bits.h>
+#endif
+
+#endif /* !_CTYPE_H_ */

Property changes on: lab4/.minix-src/include/ctype.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dirent.h
===================================================================
--- lab4/.minix-src/include/dirent.h	(nonexistent)
+++ lab4/.minix-src/include/dirent.h	(revision 13)
@@ -0,0 +1,122 @@
+/*	$NetBSD: dirent.h,v 1.35 2012/07/30 23:11:13 yamt Exp $	*/
+
+/*-
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dirent.h	8.2 (Berkeley) 7/28/94
+ */
+
+#ifndef _DIRENT_H_
+#define _DIRENT_H_
+
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+/*
+ * The kernel defines the format of directory entries returned by 
+ * the getdents(2) system call.
+ */
+#include <sys/dirent.h>
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define	d_ino		d_fileno	/* backward compatibility */
+#endif
+
+typedef struct _dirdesc DIR;
+
+#if defined(_NETBSD_SOURCE)
+
+/* definitions for library routines operating on directories. */
+#define	DIRBLKSIZ	1024
+
+/* structure describing an open directory. */
+struct _dirdesc {
+	/*
+	 * dd_fd should be kept intact to preserve ABI compat.  see dirfd().
+	 */
+	int	dd_fd;		/* file descriptor associated with directory */
+	/*
+	 * the rest is hidden from user.
+	 */
+	long	dd_loc;		/* offset in current buffer */
+	long	dd_size;	/* amount of data returned by getdents */
+	char	*dd_buf;	/* data buffer */
+	int	dd_len;		/* size of data buffer */
+	off_t	dd_seek;	/* magic cookie returned by getdents */
+	void	*dd_internal;	/* state for seekdir/telldir */
+	int	dd_flags;	/* flags for readdir */
+	void	*dd_lock;	/* lock for concurrent access */
+};
+
+#define	dirfd(dirp)	((dirp)->dd_fd)
+
+/* flags for __opendir2() */
+#define DTF_HIDEW	0x0001	/* hide whiteout entries */
+#define DTF_NODUP	0x0002	/* don't return duplicate names */
+#define DTF_REWIND	0x0004	/* rewind after reading union stack */
+#define __DTF_READALL	0x0008	/* everything has been read */
+#define __DTF_RETRY_ON_BADCOOKIE 0x0001	/* retry on EINVAL
+					(only valid with __DTF_READALL) */
+
+#include <sys/null.h>
+
+#endif
+
+#ifndef _KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int closedir(DIR *);
+void rewinddir(DIR *);
+#ifndef __LIBC12_SOURCE__
+DIR *opendir(const char *) __RENAME(__opendir30);
+struct dirent *readdir(DIR *) __RENAME(__readdir30);
+int readdir_r(DIR * __restrict, struct dirent * __restrict,
+    struct dirent ** __restrict) __RENAME(__readdir_r30);
+#endif
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+void seekdir(DIR *, long);
+long telldir(DIR *);
+#endif /* defined(_NETBSD_SOURCE) || defined(_XOPEN_SOURCE) */
+#if defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+DIR *fdopendir(int);
+DIR *__opendir2(const char *, int) __RENAME(__opendir230);
+int scandir(const char *, struct dirent ***,
+    int (*)(const struct dirent *), int (*)(const void *, const void *))
+    __RENAME(__scandir30);
+int getdents(int, char *, size_t) __RENAME(__getdents30);
+int alphasort(const void *, const void *) __RENAME(__alphasort30);
+#endif
+#endif /* defined(_NETBSD_SOURCE) */
+__END_DECLS
+
+#endif /* !_KERNEL */
+
+#endif /* !_DIRENT_H_ */

Property changes on: lab4/.minix-src/include/dirent.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/atomic.h
===================================================================
--- lab4/.minix-src/include/atomic.h	(nonexistent)
+++ lab4/.minix-src/include/atomic.h	(revision 13)
@@ -0,0 +1,29 @@
+/*	$NetBSD: atomic.h,v 1.1 2008/05/28 12:28:12 ad Exp $	*/
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/atomic.h>

Property changes on: lab4/.minix-src/include/atomic.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/bzlib.h
===================================================================
--- lab4/.minix-src/include/bzlib.h	(nonexistent)
+++ lab4/.minix-src/include/bzlib.h	(revision 13)
@@ -0,0 +1,284 @@
+/*	$NetBSD: bzlib.h,v 1.1.1.2 2012/05/07 00:41:46 wiz Exp $	*/
+
+
+/*-------------------------------------------------------------*/
+/*--- Public header file for the library.                   ---*/
+/*---                                               bzlib.h ---*/
+/*-------------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.6 of 6 September 2010
+   Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+
+#ifndef _BZLIB_H
+#define _BZLIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define BZ_RUN               0
+#define BZ_FLUSH             1
+#define BZ_FINISH            2
+
+#define BZ_OK                0
+#define BZ_RUN_OK            1
+#define BZ_FLUSH_OK          2
+#define BZ_FINISH_OK         3
+#define BZ_STREAM_END        4
+#define BZ_SEQUENCE_ERROR    (-1)
+#define BZ_PARAM_ERROR       (-2)
+#define BZ_MEM_ERROR         (-3)
+#define BZ_DATA_ERROR        (-4)
+#define BZ_DATA_ERROR_MAGIC  (-5)
+#define BZ_IO_ERROR          (-6)
+#define BZ_UNEXPECTED_EOF    (-7)
+#define BZ_OUTBUFF_FULL      (-8)
+#define BZ_CONFIG_ERROR      (-9)
+
+typedef 
+   struct {
+      char *next_in;
+      unsigned int avail_in;
+      unsigned int total_in_lo32;
+      unsigned int total_in_hi32;
+
+      char *next_out;
+      unsigned int avail_out;
+      unsigned int total_out_lo32;
+      unsigned int total_out_hi32;
+
+      void *state;
+
+      void *(*bzalloc)(void *,int,int);
+      void (*bzfree)(void *,void *);
+      void *opaque;
+   } 
+   bz_stream;
+
+
+#ifndef BZ_IMPORT
+#define BZ_EXPORT
+#endif
+
+#ifndef BZ_NO_STDIO
+/* Need a definitition for FILE */
+#include <stdio.h>
+#endif
+
+#ifdef _WIN32
+#   include <windows.h>
+#   ifdef small
+      /* windows.h define small to char */
+#      undef small
+#   endif
+#   ifdef BZ_EXPORT
+#   define BZ_API(func) WINAPI func
+#   define BZ_EXTERN extern
+#   else
+   /* import windows dll dynamically */
+#   define BZ_API(func) (WINAPI * func)
+#   define BZ_EXTERN
+#   endif
+#else
+#   define BZ_API(func) func
+#   define BZ_EXTERN extern
+#endif
+
+
+/*-- Core (low-level) library functions --*/
+
+BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 
+      bz_stream* strm, 
+      int        blockSize100k, 
+      int        verbosity, 
+      int        workFactor 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 
+      bz_stream* strm, 
+      int action 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 
+      bz_stream* strm 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( 
+      bz_stream *strm, 
+      int       verbosity, 
+      int       small
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 
+      bz_stream* strm 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( 
+      bz_stream *strm 
+   );
+
+
+
+/*-- High(er) level library functions --*/
+
+#ifndef BZ_NO_STDIO
+#define BZ_MAX_UNUSED 5000
+
+typedef void BZFILE;
+
+BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( 
+      int*  bzerror,   
+      FILE* f, 
+      int   verbosity, 
+      int   small,
+      void* unused,    
+      int   nUnused 
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( 
+      int*    bzerror, 
+      BZFILE* b 
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( 
+      int*    bzerror, 
+      BZFILE* b, 
+      void**  unused,  
+      int*    nUnused 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzRead) ( 
+      int*    bzerror, 
+      BZFILE* b, 
+      void*   buf, 
+      int     len 
+   );
+
+BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( 
+      int*  bzerror,      
+      FILE* f, 
+      int   blockSize100k, 
+      int   verbosity, 
+      int   workFactor 
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzWrite) ( 
+      int*    bzerror, 
+      BZFILE* b, 
+      void*   buf, 
+      int     len 
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( 
+      int*          bzerror, 
+      BZFILE*       b, 
+      int           abandon, 
+      unsigned int* nbytes_in, 
+      unsigned int* nbytes_out 
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( 
+      int*          bzerror, 
+      BZFILE*       b, 
+      int           abandon, 
+      unsigned int* nbytes_in_lo32, 
+      unsigned int* nbytes_in_hi32, 
+      unsigned int* nbytes_out_lo32, 
+      unsigned int* nbytes_out_hi32
+   );
+#endif
+
+
+/*-- Utility functions --*/
+
+BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 
+      char*         dest, 
+      unsigned int* destLen,
+      char*         source, 
+      unsigned int  sourceLen,
+      int           blockSize100k, 
+      int           verbosity, 
+      int           workFactor 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 
+      char*         dest, 
+      unsigned int* destLen,
+      char*         source, 
+      unsigned int  sourceLen,
+      int           small, 
+      int           verbosity 
+   );
+
+
+/*--
+   Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
+   to support better zlib compatibility.
+   This code is not _officially_ part of libbzip2 (yet);
+   I haven't tested it, documented it, or considered the
+   threading-safeness of it.
+   If this code breaks, please contact both Yoshioka and me.
+--*/
+
+BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
+      void
+   );
+
+#ifndef BZ_NO_STDIO
+BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
+      const char *path,
+      const char *mode
+   );
+
+BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
+      int        fd,
+      const char *mode
+   );
+         
+BZ_EXTERN int BZ_API(BZ2_bzread) (
+      BZFILE* b, 
+      void* buf, 
+      int len 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzwrite) (
+      BZFILE* b, 
+      void*   buf, 
+      int     len 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzflush) (
+      BZFILE* b
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzclose) (
+      BZFILE* b
+   );
+
+BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
+      BZFILE *b, 
+      int    *errnum
+   );
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/*-------------------------------------------------------------*/
+/*--- end                                           bzlib.h ---*/
+/*-------------------------------------------------------------*/

Property changes on: lab4/.minix-src/include/bzlib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/configfile.h
===================================================================
--- lab4/.minix-src/include/configfile.h	(nonexistent)
+++ lab4/.minix-src/include/configfile.h	(revision 13)
@@ -0,0 +1,44 @@
+/*	configfile.h - Generic configuration file format.
+ *							Author: Kees J. Bot
+ *								5 Jun 1999
+ */
+#ifndef _CONFIGFILE_H
+#define _CONFIGFILE_H
+
+/* Data can only be modified inside the library. */
+#ifndef _c
+#define _c	const
+#endif
+
+typedef _c struct config {	/* Contents of a generic configuration file. */
+_c	struct config	*next;		/* Next configuration file thing. */
+_c	struct config	*list;		/* For a { sublist }. */
+	const char	*file;		/* File and line where this is found. */
+	unsigned	line;
+	int		flags;		/* Special flags. */
+	char		word[1];	/* Payload. */
+} config_t;
+
+#define CFG_CLONG	0x0001		/* strtol(word, &end, 0) is valid. */
+#define CFG_OLONG	0x0002		/* strtol(word, &end, 010). */
+#define CFG_DLONG	0x0004		/* strtol(word, &end, 10). */
+#define CFG_XLONG	0x0008		/* strtol(word, &end, 0x10). */
+#define CFG_CULONG	0x0010		/* strtoul(word, &end, 0). */
+#define CFG_OULONG	0x0020		/* strtoul(word, &end, 010). */
+#define CFG_DULONG	0x0040		/* strtoul(word, &end, 10). */
+#define CFG_XULONG	0x0080		/* strtoul(word, &end, 0x10). */
+#define CFG_STRING	0x0100		/* The word is enclosed in quotes. */
+#define CFG_SUBLIST	0x0200		/* This is a sublist, so no word. */
+#define CFG_ESCAPED	0x0400		/* Escapes are still marked with \. */
+
+config_t *config_read(const char *_file, int flags, config_t *_cfg);
+void config_delete(config_t *_cfg);
+int config_renewed(config_t *_cfg);
+size_t config_length(config_t *_cfg);
+#define config_issub(cfg)	(!!((cfg)->flags & CFG_SUBLIST))
+#define config_isatom(cfg)	(!config_issub(cfg))
+#define config_isstring(cfg)	(!!((cfg)->flags & CFG_STRING))
+
+#undef _c
+
+#endif /* _CONFIGFILE_H */

Property changes on: lab4/.minix-src/include/configfile.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/complex.h
===================================================================
--- lab4/.minix-src/include/complex.h	(nonexistent)
+++ lab4/.minix-src/include/complex.h	(revision 13)
@@ -0,0 +1,139 @@
+/* $NetBSD: complex.h,v 1.4 2013/01/28 23:19:50 matt Exp $ */
+
+/*
+ * Written by Matthias Drochner.
+ * Public domain.
+ */
+
+#ifndef	_COMPLEX_H
+#define	_COMPLEX_H
+
+#define complex _Complex
+#define _Complex_I 1.0fi
+#define I _Complex_I
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+/* 7.3.5 Trigonometric functions */
+/* 7.3.5.1 The cacos functions */
+double complex cacos(double complex);
+float complex cacosf(float complex);
+long double complex cacosl(long double complex);
+
+/* 7.3.5.2 The casin functions */
+double complex casin(double complex);
+float complex casinf(float complex);
+long double complex casinl(long double complex);
+
+/* 7.3.5.1 The catan functions */
+double complex catan(double complex);
+float complex catanf(float complex);
+long double complex catanl(long double complex);
+
+/* 7.3.5.1 The ccos functions */
+double complex ccos(double complex);
+float complex ccosf(float complex);
+long double complex ccosl(long double complex);
+
+/* 7.3.5.1 The csin functions */
+double complex csin(double complex);
+float complex csinf(float complex);
+long double complex csinl(long double complex);
+
+/* 7.3.5.1 The ctan functions */
+double complex ctan(double complex);
+float complex ctanf(float complex);
+long double complex ctanl(long double complex);
+
+/* 7.3.6 Hyperbolic functions */
+/* 7.3.6.1 The cacosh functions */
+double complex cacosh(double complex);
+float complex cacoshf(float complex);
+long double complex cacoshl(long double complex);
+
+/* 7.3.6.2 The casinh functions */
+double complex casinh(double complex);
+float complex casinhf(float complex);
+long double complex casinhl(long double complex);
+
+/* 7.3.6.3 The catanh functions */
+double complex catanh(double complex);
+float complex catanhf(float complex);
+long double complex catanhl(long double complex);
+
+/* 7.3.6.4 The ccosh functions */
+double complex ccosh(double complex);
+float complex ccoshf(float complex);
+long double complex ccoshl(long double complex);
+
+/* 7.3.6.5 The csinh functions */
+double complex csinh(double complex);
+float complex csinhf(float complex);
+long double complex csinhl(long double complex);
+
+/* 7.3.6.6 The ctanh functions */
+double complex ctanh(double complex);
+float complex ctanhf(float complex);
+long double complex ctanhl(long double complex);
+
+/* 7.3.7 Exponential and logarithmic functions */
+/* 7.3.7.1 The cexp functions */
+double complex cexp(double complex);
+float complex cexpf(float complex);
+long double complex cexpl(long double complex);
+
+/* 7.3.7.2 The clog functions */
+double complex clog(double complex);
+float complex clogf(float complex);
+long double complex clogl(long double complex);
+
+/* 7.3.8 Power and absolute-value functions */
+/* 7.3.8.1 The cabs functions */
+#ifndef __LIBM0_SOURCE__
+/* avoid conflict with historical cabs(struct complex) */
+double cabs(double complex) __RENAME(__c99_cabs);
+float cabsf(float complex) __RENAME(__c99_cabsf);
+long double cabsl(long double complex) __RENAME(__c99_cabsl);
+#endif
+
+/* 7.3.8.2 The cpow functions */
+double complex cpow(double complex, double complex);
+float complex cpowf(float complex, float complex);
+long double complex cpowl(long double complex, long double complex);
+
+/* 7.3.8.3 The csqrt functions */
+double complex csqrt(double complex);
+float complex csqrtf(float complex);
+long double complex csqrtl(long double complex);
+
+/* 7.3.9 Manipulation functions */
+/* 7.3.9.1 The carg functions */ 
+double carg(double complex);
+float cargf(float complex);
+long double cargl(long double complex);
+
+/* 7.3.9.2 The cimag functions */
+double cimag(double complex);
+float cimagf(float complex);
+long double cimagl(long double complex);
+
+/* 7.3.9.3 The conj functions */
+double complex conj(double complex);
+float complex conjf(float complex);
+long double complex conjl(long double complex);
+
+/* 7.3.9.4 The cproj functions */
+double complex cproj(double complex);
+float complex cprojf(float complex);
+long double complex cprojl(long double complex);
+
+/* 7.3.9.5 The creal functions */
+double creal(double complex);
+float crealf(float complex);
+long double creall(long double complex);
+
+__END_DECLS
+
+#endif	/* ! _COMPLEX_H */

Property changes on: lab4/.minix-src/include/complex.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/curses.h
===================================================================
--- lab4/.minix-src/include/curses.h	(nonexistent)
+++ lab4/.minix-src/include/curses.h	(revision 13)
@@ -0,0 +1,933 @@
+/*	$NetBSD: curses.h,v 1.107 2015/06/08 12:38:57 joerg Exp $	*/
+
+/*
+ * Copyright (c) 1981, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)curses.h	8.5 (Berkeley) 4/29/95
+ *
+ *	Modified by Ruibiao Qiu <ruibiao@arl.wustl.edu,ruibiao@gmail.com> 2005
+ *	to add wide-character support
+ *  - Add complex character structure (cchar_t)
+ *	- Add definitions of wide-character routines
+ *	- Add KEY_CODE_YES
+ */
+
+#ifndef _CURSES_H_
+#define	_CURSES_H_
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+#include <wchar.h>
+
+#include <stdio.h>
+#include <stdbool.h>
+
+/*
+ * attr_t must be the same size as wchar_t (see <wchar.h>) to avoid padding
+ * in __LDATA.
+ */
+typedef wchar_t	chtype;
+typedef wchar_t	attr_t;
+
+#if !defined(HAVE_WCHAR) && !defined(DISABLE_WCHAR)
+#define HAVE_WCHAR 1
+#endif
+
+#ifdef HAVE_WCHAR
+/* 
+ * The complex character structure required by the X/Open reference and used
+ * in * functions such as in_wchstr(). It includes a string of up to 8 wide
+ * characters and its length, an attribute, and a color-pair.
+ */
+#define CURSES_CCHAR_MAX 8
+#define CCHARW_MAX       5
+typedef struct {
+	attr_t		attributes;		/* character attributes */
+	unsigned	elements;		/* number of wide char in
+						   vals[] */
+	wchar_t		vals[CURSES_CCHAR_MAX]; /* wide chars including
+						   non-spacing */
+} cchar_t;
+#else 
+typedef chtype cchar_t;
+#endif /* HAVE_WCHAR */
+
+#ifndef TRUE
+#define	TRUE	(/*CONSTCOND*/1)
+#endif
+#ifndef FALSE
+#define	FALSE	(/*CONSTCOND*/0)
+#endif
+
+#ifndef _CURSES_PRIVATE
+
+#define _puts(s)        tputs(s, 0, __cputchar)
+#define _putchar(c)     __cputchar(c)
+
+/* Old-style terminal modes access. */
+#define crmode()        cbreak()
+#define nocrmode()      nocbreak()
+#endif /* _CURSES_PRIVATE */
+
+
+/* symbols for values returned by getch in keypad mode */
+#define    KEY_MIN        0x101    /* minimum extended key value */
+#define    KEY_BREAK      0x101    /* break key */
+#define    KEY_DOWN       0x102    /* down arrow */
+#define    KEY_UP         0x103    /* up arrow */
+#define    KEY_LEFT       0x104    /* left arrow */
+#define    KEY_RIGHT      0x105    /* right arrow*/
+#define    KEY_HOME       0x106    /* home key */
+#define    KEY_BACKSPACE  0x107    /* Backspace */
+
+/* First function key (block of 64 follow) */
+#define    KEY_F0         0x108
+/* Function defining other function key values*/
+#define    KEY_F(n)       (KEY_F0+(n))
+
+#define    KEY_DL         0x148    /* Delete Line */
+#define    KEY_IL         0x149    /* Insert Line*/
+#define    KEY_DC         0x14A    /* Delete Character */
+#define    KEY_IC         0x14B    /* Insert Character */
+#define    KEY_EIC        0x14C    /* Exit Insert Char mode */
+#define    KEY_CLEAR      0x14D    /* Clear screen */
+#define    KEY_EOS        0x14E    /* Clear to end of screen */
+#define    KEY_EOL        0x14F    /* Clear to end of line */
+#define    KEY_SF         0x150    /* Scroll one line forward */
+#define    KEY_SR         0x151    /* Scroll one line back */
+#define    KEY_NPAGE      0x152    /* Next Page */
+#define    KEY_PPAGE      0x153    /* Prev Page */
+#define    KEY_STAB       0x154    /* Set Tab */
+#define    KEY_CTAB       0x155    /* Clear Tab */
+#define    KEY_CATAB      0x156    /* Clear All Tabs */
+#define    KEY_ENTER      0x157    /* Enter or Send */
+#define    KEY_SRESET     0x158    /* Soft Reset */
+#define    KEY_RESET      0x159    /* Hard Reset */
+#define    KEY_PRINT      0x15A    /* Print */
+#define    KEY_LL         0x15B    /* Home Down */
+
+/*
+ * "Keypad" keys arranged like this:
+ *
+ *  A1   up  A3
+ * left  B2 right
+ *  C1  down C3
+ *
+ */
+#define    KEY_A1         0x15C    /* Keypad upper left */
+#define    KEY_A3         0x15D    /* Keypad upper right */
+#define    KEY_B2         0x15E    /* Keypad centre key */
+#define    KEY_C1         0x15F    /* Keypad lower left */
+#define    KEY_C3         0x160    /* Keypad lower right */
+
+#define    KEY_BTAB       0x161    /* Back Tab */
+#define    KEY_BEG        0x162    /* Begin key */
+#define    KEY_CANCEL     0x163    /* Cancel key */
+#define    KEY_CLOSE      0x164    /* Close Key */
+#define    KEY_COMMAND    0x165    /* Command Key */
+#define    KEY_COPY       0x166    /* Copy key */
+#define    KEY_CREATE     0x167    /* Create key */
+#define    KEY_END        0x168    /* End key */
+#define    KEY_EXIT       0x169    /* Exit key */
+#define    KEY_FIND       0x16A    /* Find key */
+#define    KEY_HELP       0x16B    /* Help key */
+#define    KEY_MARK       0x16C    /* Mark key */
+#define    KEY_MESSAGE    0x16D    /* Message key */
+#define    KEY_MOVE       0x16E    /* Move key */
+#define    KEY_NEXT       0x16F    /* Next Object key */
+#define    KEY_OPEN       0x170    /* Open key */
+#define    KEY_OPTIONS    0x171    /* Options key */
+#define    KEY_PREVIOUS   0x172    /* Previous Object key */
+#define    KEY_REDO       0x173    /* Redo key */
+#define    KEY_REFERENCE  0x174    /* Ref Key */
+#define    KEY_REFRESH    0x175    /* Refresh key */
+#define    KEY_REPLACE    0x176    /* Replace key */
+#define    KEY_RESTART    0x177    /* Restart key */
+#define    KEY_RESUME     0x178    /* Resume key */
+#define    KEY_SAVE       0x179    /* Save key */
+#define    KEY_SBEG       0x17A    /* Shift begin key */
+#define    KEY_SCANCEL    0x17B    /* Shift Cancel key */
+#define    KEY_SCOMMAND   0x17C    /* Shift Command key */
+#define    KEY_SCOPY      0x17D    /* Shift Copy key */
+#define    KEY_SCREATE    0x17E    /* Shift Create key */
+#define    KEY_SDC        0x17F    /* Shift Delete Character */
+#define    KEY_SDL        0x180    /* Shift Delete Line */
+#define    KEY_SELECT     0x181    /* Select key */
+#define    KEY_SEND       0x182    /* Send key */
+#define    KEY_SEOL       0x183    /* Shift Clear Line key */
+#define    KEY_SEXIT      0x184    /* Shift Exit key */
+#define    KEY_SFIND      0x185    /* Shift Find key */
+#define    KEY_SHELP      0x186    /* Shift Help key */
+#define    KEY_SHOME      0x187    /* Shift Home key */
+#define    KEY_SIC        0x188    /* Shift Input key */
+#define    KEY_SLEFT      0x189    /* Shift Left Arrow key */
+#define    KEY_SMESSAGE   0x18A    /* Shift Message key */
+#define    KEY_SMOVE      0x18B    /* Shift Move key */
+#define    KEY_SNEXT      0x18C    /* Shift Next key */
+#define    KEY_SOPTIONS   0x18D    /* Shift Options key */
+#define    KEY_SPREVIOUS  0x18E    /* Shift Previous key */
+#define    KEY_SPRINT     0x18F    /* Shift Print key */
+#define    KEY_SREDO      0x190    /* Shift Redo key */
+#define    KEY_SREPLACE   0x191    /* Shift Replace key */
+#define    KEY_SRIGHT     0x192    /* Shift Right Arrow key */
+#define    KEY_SRSUME     0x193    /* Shift Resume key */
+#define    KEY_SSAVE      0x194    /* Shift Save key */
+#define    KEY_SSUSPEND   0x195    /* Shift Suspend key */
+#define    KEY_SUNDO      0x196    /* Shift Undo key */
+#define    KEY_SUSPEND    0x197    /* Suspend key */
+#define    KEY_UNDO       0x198    /* Undo key */
+#define    KEY_MOUSE      0x199    /* Mouse event has occurred */
+#define    KEY_RESIZE     0x200    /* Resize event has occurred */
+#define    KEY_MAX        0x240    /* maximum extended key value */
+#define    KEY_CODE_YES   0x241    /* A function key pressed */
+
+#include <unctrl.h>
+
+/*
+ * A window an array of __LINE structures pointed to by the 'lines' pointer.
+ * A line is an array of __LDATA structures pointed to by the 'line' pointer.
+ */
+
+/*
+ * Definitions for characters and attributes in __LDATA
+ */
+#define __CHARTEXT	0x000000ff	/* bits for 8-bit characters */
+#define __NORMAL	0x00000000	/* Added characters are normal. */
+#define __STANDOUT	0x00000100	/* Added characters are standout. */
+#define __UNDERSCORE	0x00000200	/* Added characters are underscored. */
+#define __REVERSE	0x00000400	/* Added characters are reverse
+					   video. */
+#define __BLINK		0x00000800	/* Added characters are blinking. */
+#define __DIM		0x00001000	/* Added characters are dim. */
+#define __BOLD		0x00002000	/* Added characters are bold. */
+#define __BLANK		0x00004000	/* Added characters are blanked. */
+#define __PROTECT	0x00008000	/* Added characters are protected. */
+#define __ALTCHARSET	0x00010000	/* Added characters are ACS */
+#define __COLOR		0x03fe0000	/* Color bits */
+#define __ATTRIBUTES	0x03ffff00	/* All 8-bit attribute bits */
+#ifdef HAVE_WCHAR
+#define __ACS_IS_WACS	0x04000000 /* internal: use wacs table for ACS char */
+#endif
+
+typedef struct __ldata __LDATA;
+typedef struct __line  __LINE;
+typedef struct __window  WINDOW;
+typedef struct __screen SCREEN;
+
+/*
+ * Attribute definitions
+ */
+#define	A_NORMAL	__NORMAL
+#define	A_STANDOUT	__STANDOUT
+#define	A_UNDERLINE	__UNDERSCORE
+#define	A_REVERSE	__REVERSE
+#define	A_BLINK		__BLINK
+#define	A_DIM		__DIM
+#define	A_BOLD		__BOLD
+#define	A_BLANK		__BLANK
+#define	A_INVIS		__BLANK
+#define	A_PROTECT	__PROTECT
+#define	A_ALTCHARSET	__ALTCHARSET
+#define	A_ATTRIBUTES	__ATTRIBUTES
+#define	A_CHARTEXT	__CHARTEXT
+#define	A_COLOR		__COLOR
+
+#ifdef HAVE_WCHAR
+#define WA_ATTRIBUTES	0x03ffffff	/* Wide character attributes mask */
+#define WA_NORMAL	__NORMAL
+#define WA_STANDOUT	__STANDOUT	/* Best highlighting mode */
+#define WA_UNDERLINE	__UNDERSCORE	/* Underlining */
+#define WA_REVERSE	__REVERSE	/* Reverse video */
+#define WA_BLINK	__BLINK		/* Blinking */
+#define WA_DIM		__DIM		/* Half bright */
+#define WA_BOLD		__BOLD		/* Extra bright or bold */
+#define WA_INVIS	__BLANK		/* Invisible */
+#define WA_PROTECT	__PROTECT	/* Protected */
+#define WA_ALTCHARSET	__ALTCHARSET	/* Alternate character set */
+#define WA_LOW		0x00000002	/* Low highlight */
+#define WA_TOP		0x00000004	/* Top highlight */
+#define WA_HORIZONTAL	0x00000008	/* Horizontal highlight */
+#define WA_VERTICAL	0x00000010	/* Vertical highlight */
+#define WA_LEFT		0x00000020	/* Left highlight */
+#define WA_RIGHT	0x00000040	/* Right highlight */
+#endif /* HAVE_WCHAR */
+
+/*
+ * Alternate character set definitions
+ */
+
+#define	NUM_ACS	128
+
+extern chtype _acs_char[NUM_ACS];
+#ifdef __cplusplus
+#define __UC_CAST(a)	static_cast<unsigned char>(a)
+#else
+#define __UC_CAST(a)	(unsigned char)(a)
+#endif
+
+/* Standard definitions */
+#define	ACS_RARROW	_acs_char[__UC_CAST('+')]
+#define	ACS_LARROW	_acs_char[__UC_CAST(',')]
+#define	ACS_UARROW	_acs_char[__UC_CAST('-')]
+#define	ACS_DARROW	_acs_char[__UC_CAST('.')]
+#define	ACS_BLOCK	_acs_char[__UC_CAST('0')]
+#define	ACS_DIAMOND	_acs_char[__UC_CAST('`')]
+#define	ACS_CKBOARD	_acs_char[__UC_CAST('a')]
+#define	ACS_DEGREE	_acs_char[__UC_CAST('f')]
+#define	ACS_PLMINUS	_acs_char[__UC_CAST('g')]
+#define	ACS_BOARD	_acs_char[__UC_CAST('h')]
+#define	ACS_LANTERN	_acs_char[__UC_CAST('i')]
+#define	ACS_LRCORNER	_acs_char[__UC_CAST('j')]
+#define	ACS_URCORNER	_acs_char[__UC_CAST('k')]
+#define	ACS_ULCORNER	_acs_char[__UC_CAST('l')]
+#define	ACS_LLCORNER	_acs_char[__UC_CAST('m')]
+#define	ACS_PLUS	_acs_char[__UC_CAST('n')]
+#define	ACS_HLINE	_acs_char[__UC_CAST('q')]
+#define	ACS_S1		_acs_char[__UC_CAST('o')]
+#define	ACS_S9		_acs_char[__UC_CAST('s')]
+#define	ACS_LTEE	_acs_char[__UC_CAST('t')]
+#define	ACS_RTEE	_acs_char[__UC_CAST('u')]
+#define	ACS_BTEE	_acs_char[__UC_CAST('v')]
+#define	ACS_TTEE	_acs_char[__UC_CAST('w')]
+#define	ACS_VLINE	_acs_char[__UC_CAST('x')]
+#define	ACS_BULLET	_acs_char[__UC_CAST('~')]
+
+/* Extensions */
+#define	ACS_S3		_acs_char[__UC_CAST('p')]
+#define	ACS_S7		_acs_char[__UC_CAST('r')]
+#define	ACS_LEQUAL	_acs_char[__UC_CAST('y')]
+#define	ACS_GEQUAL	_acs_char[__UC_CAST('z')]
+#define	ACS_PI		_acs_char[__UC_CAST('{')]
+#define	ACS_NEQUAL	_acs_char[__UC_CAST('|')]
+#define	ACS_STERLING	_acs_char[__UC_CAST('}')]
+
+#ifdef HAVE_WCHAR
+extern cchar_t _wacs_char[NUM_ACS];
+
+#define	WACS_RARROW     (&_wacs_char[(unsigned char)'+'])
+#define	WACS_LARROW     (&_wacs_char[(unsigned char)','])
+#define	WACS_UARROW     (&_wacs_char[(unsigned char)'-'])
+#define	WACS_DARROW     (&_wacs_char[(unsigned char)'.'])
+#define	WACS_BLOCK      (&_wacs_char[(unsigned char)'0'])
+#define	WACS_DIAMOND    (&_wacs_char[(unsigned char)'`'])
+#define	WACS_CKBOARD    (&_wacs_char[(unsigned char)'a'])
+#define	WACS_DEGREE     (&_wacs_char[(unsigned char)'f'])
+#define	WACS_PLMINUS    (&_wacs_char[(unsigned char)'g'])
+#define	WACS_BOARD      (&_wacs_char[(unsigned char)'h'])
+#define	WACS_LANTERN    (&_wacs_char[(unsigned char)'i'])
+#define	WACS_LRCORNER   (&_wacs_char[(unsigned char)'j'])
+#define	WACS_URCORNER   (&_wacs_char[(unsigned char)'k'])
+#define	WACS_ULCORNER   (&_wacs_char[(unsigned char)'l'])
+#define	WACS_LLCORNER   (&_wacs_char[(unsigned char)'m'])
+#define	WACS_PLUS       (&_wacs_char[(unsigned char)'n'])
+#define	WACS_HLINE      (&_wacs_char[(unsigned char)'q'])
+#define	WACS_S1         (&_wacs_char[(unsigned char)'o'])
+#define	WACS_S9         (&_wacs_char[(unsigned char)'s'])
+#define	WACS_LTEE       (&_wacs_char[(unsigned char)'t'])
+#define	WACS_RTEE       (&_wacs_char[(unsigned char)'u'])
+#define	WACS_BTEE       (&_wacs_char[(unsigned char)'v'])
+#define	WACS_TTEE       (&_wacs_char[(unsigned char)'w'])
+#define	WACS_VLINE      (&_wacs_char[(unsigned char)'x'])
+#define	WACS_BULLET     (&_wacs_char[(unsigned char)'~'])
+#define	WACS_S3		(&_wacs_char[(unsigned char)'p'])
+#define	WACS_S7		(&_wacs_char[(unsigned char)'r'])
+#define	WACS_LEQUAL	(&_wacs_char[(unsigned char)'y'])
+#define	WACS_GEQUAL	(&_wacs_char[(unsigned char)'z'])
+#define	WACS_PI		(&_wacs_char[(unsigned char)'{'])
+#define	WACS_NEQUAL	(&_wacs_char[(unsigned char)'|'])
+#define	WACS_STERLING	(&_wacs_char[(unsigned char)'}'])
+#endif /* HAVE_WCHAR */
+
+/* System V compatibility */
+#define	ACS_SBBS	ACS_LRCORNER
+#define	ACS_BBSS	ACS_URCORNER
+#define	ACS_BSSB	ACS_ULCORNER
+#define	ACS_SSBB	ACS_LLCORNER
+#define	ACS_SSSS	ACS_PLUS
+#define	ACS_BSBS	ACS_HLINE
+#define	ACS_SSSB	ACS_LTEE
+#define	ACS_SBSS	ACS_RTEE
+#define	ACS_SSBS	ACS_BTEE
+#define	ACS_BSSS	ACS_TTEE
+#define	ACS_SBSB	ACS_VLINE
+#define	_acs_map	_acs_char
+
+/*
+ * Color definitions (ANSI color numbers)
+ */
+
+#define	COLOR_BLACK	0x00
+#define	COLOR_RED	0x01
+#define	COLOR_GREEN	0x02
+#define	COLOR_YELLOW	0x03
+#define	COLOR_BLUE	0x04
+#define	COLOR_MAGENTA	0x05
+#define	COLOR_CYAN	0x06
+#define	COLOR_WHITE	0x07
+
+#ifdef __cplusplus
+#define __UINT32_CAST(a)	static_cast<u_int32_t>(a)
+#else
+#define __UINT32_CAST(a)	(u_int32_t)(a)
+#endif
+#define	COLOR_PAIR(n)	(((__UINT32_CAST(n)) << 17) & A_COLOR)
+#define	PAIR_NUMBER(n)	(((__UINT32_CAST(n)) & A_COLOR) >> 17)
+
+/* Curses external declarations. */
+extern WINDOW	*curscr;		/* Current screen. */
+extern WINDOW	*stdscr;		/* Standard screen. */
+
+extern int	__tcaction;		/* If terminal hardware set. */
+
+extern int	 COLS;			/* Columns on the screen. */
+extern int	 LINES;			/* Lines on the screen. */
+extern int	 COLORS;		/* Max colors on the screen. */
+extern int	 COLOR_PAIRS;		/* Max color pairs on the screen. */
+
+extern int	 ESCDELAY;		/* Delay between keys in esc seq's. */
+extern int	 TABSIZE;		/* Size of a tab. */
+
+#ifndef OK
+#define	ERR	(-1)			/* Error return. */
+#define	OK	(0)			/* Success return. */
+#endif
+
+/*
+ * The following have, traditionally, been macros but X/Open say they
+ * need to be functions.  Keep the old macros for debugging.
+ */
+#ifdef _CURSES_USE_MACROS
+/* Standard screen pseudo functions. */
+#define	addbytes(s, n)			__waddbytes(stdscr, s, n, 0)
+#define	addch(ch)			waddch(stdscr, ch)
+#define	addchnstr(s)			waddchnstr(stdscr, s, n)
+#define	addchstr(s)			waddchnstr(stdscr, s, -1)
+#define	addnstr(s, n)			waddnstr(stdscr, s, n)
+#define	addstr(s)			waddnstr(stdscr, s, -1)
+#define attr_get(a, p, o)		wattr_get(stdscr, a, p, o)
+#define attr_off(a, o)			wattr_off(stdscr, a, o)
+#define attr_on(a, o)			wattr_on(stdscr, a, o)
+#define attr_set(a, p, o)		wattr_set(stdscr, a, p, o)
+#define	attroff(attr)			wattroff(stdscr, attr)
+#define	attron(attr)			wattron(stdscr, attr)
+#define	attrset(attr)			wattrset(stdscr, attr)
+#define bkgd(ch)			wbkgd(stdscr, ch)
+#define bkgdset(ch)			wbkgdset(stdscr, ch)
+#define	border(l, r, t, b, tl, tr, bl, br) \
+	wborder(stdscr, l, r, t, b, tl, tr, bl, br)
+#define	clear()				wclear(stdscr)
+#define	clrtobot()			wclrtobot(stdscr)
+#define	clrtoeol()			wclrtoeol(stdscr)
+#define color_set(c, o)			wcolor_set(stdscr, c, o)
+#define	delch()				wdelch(stdscr)
+#define	deleteln()			wdeleteln(stdscr)
+#define	echochar(c)			wechochar(stdscr, c)
+#define	erase()				werase(stdscr)
+#define	getch()				wgetch(stdscr)
+#define	getnstr(s, n)			wgetnstr(stdscr, s, n)
+#define	getstr(s)			wgetstr(stdscr, s)
+#define	inch()				winch(stdscr)
+#define	inchnstr(c)			winchnstr(stdscr, c)
+#define	inchstr(c)			winchstr(stdscr, c)
+#define	innstr(s, n)			winnstr(stdscr, s, n)
+#define	insch(ch)			winsch(stdscr, ch)
+#define	insdelln(n)			winsdelln(stdscr, n)
+#define	insertln()			winsertln(stdscr)
+#define	instr(s)			winstr(stdscr, s)
+#define	move(y, x)			wmove(stdscr, y, x)
+#define	refresh()			wrefresh(stdscr)
+#define	scrl(n)				wscrl(stdscr, n)
+#define	setscrreg(t, b)			wsetscrreg(stdscr, t, b)
+#define	standend()			wstandend(stdscr)
+#define	standout()			wstandout(stdscr)
+#define	timeout(delay)			wtimeout(stdscr, delay)
+#define	underscore()			wunderscore(stdscr)
+#define	underend()			wunderend(stdscr)
+#define	waddbytes(w, s, n)		__waddbytes(w, s, n, 0)
+#define	waddstr(w, s)			waddnstr(w, s, -1)
+
+/* Standard screen plus movement pseudo functions. */
+#define	mvaddbytes(y, x, s, n)		mvwaddbytes(stdscr, y, x, s, n)
+#define	mvaddch(y, x, ch)		mvwaddch(stdscr, y, x, ch)
+#define	mvaddchnstr(y, x, s, n)		mvwaddchnstr(stdscr, y, x, s, n)
+#define	mvaddchstr(y, x, s)		mvwaddchstr(stdscr, y, x, s)
+#define	mvaddnstr(y, x, s, n)		mvwaddnstr(stdscr, y, x, s, n)
+#define	mvaddstr(y, x, s)		mvwaddstr(stdscr, y, x, s)
+#define	mvdelch(y, x)			mvwdelch(stdscr, y, x)
+#define	mvgetch(y, x)			mvwgetch(stdscr, y, x)
+#define	mvgetnstr(y, x, s, n)		mvwgetnstr(stdscr, y, x, s, n)
+#define	mvgetstr(y, x, s)		mvwgetstr(stdscr, y, x, s)
+#define	mvinch(y, x)			mvwinch(stdscr, y, x)
+#define	mvinchnstr(y, x, c, n)		mvwinchnstr(stdscr, y, x, c, n)
+#define	mvinchstr(y, x, c)		mvwinchstr(stdscr, y, x, c)
+#define	mvinnstr(y, x, s, n)		mvwinnstr(stdscr, y, x, s, n)
+#define	mvinsch(y, x, c)		mvwinsch(stdscr, y, x, c)
+#define	mvinstr(y, x, s)		mvwinstr(stdscr, y, x, s)
+#define	mvwaddbytes(w, y, x, s, n) \
+	(wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0))
+#define	mvwaddch(w, y, x, ch) \
+	(wmove(w, y, x) == ERR ? ERR : waddch(w, ch))
+#define	mvwaddchnstr(w, y, x, s, n) \
+	(wmove(w, y, x) == ERR ? ERR : waddchnstr(w, s, n))
+#define	mvwaddchstr(w, y, x, s) \
+	(wmove(w, y, x) == ERR ? ERR : waddchnstr(w, s, -1))
+#define	mvwaddnstr(w, y, x, s, n) \
+	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n))
+#define	mvwaddstr(w, y, x, s) \
+	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, -1))
+#define	mvwdelch(w, y, x) \
+	(wmove(w, y, x) == ERR ? ERR : wdelch(w))
+#define	mvwgetch(w, y, x) \
+	(wmove(w, y, x) == ERR ? ERR : wgetch(w))
+#define	mvwgetnstr(w, y, x, s, n) \
+	(wmove(w, y, x) == ERR ? ERR : wgetnstr(w, s, n))
+#define	mvwgetstr(w, y, x, s) \
+	(wmove(w, y, x) == ERR ? ERR : wgetstr(w, s))
+#define	mvwinch(w, y, x) \
+	(wmove(w, y, x) == ERR ? ERR : winch(w))
+#define	mvwinchnstr(w, y, x, c, n) \
+	(wmove(w, y, x) == ERR ? ERR : winchnstr(w, c, n))
+#define	mvwinchstr(w, y, x, s) \
+	(wmove(w, y, x) == ERR ? ERR : winchstr(w, c))
+#define	mvwinnstr(w, y, x, s, n) \
+	(wmove(w, y, x) == ERR ? ERR : winnstr(w, s, n))
+#define	mvwinsch(w, y, x, c) \
+	(wmove(w, y, x) == ERR ? ERR : winsch(w, c))
+#define	mvwinstr(w, y, x, s) \
+	(wmove(w, y, x) == ERR ? ERR : winstr(w, s))
+
+/* Miscellaneous. */
+#define	noqiflush()		intrflush(stdscr, FALSE)
+#define	qiflush()		intrflush(stdscr, TRUE)
+
+#else
+/* Use functions not macros... */
+__BEGIN_DECLS
+int	 addbytes(const char *, int);
+int	 addch(chtype);
+int	 addchnstr(const chtype *, int);
+int	 addchstr(const chtype *);
+int	 addnstr(const char *, int);
+int	 addstr(const char *);
+int	 attr_get(attr_t *, short *, void *);
+int	 attr_off(attr_t, void *);
+int	 attr_on(attr_t, void *);
+int	 attr_set(attr_t, short, void *);
+int	 attroff(int);
+int	 attron(int);
+int	 attrset(int);
+int	 bkgd(chtype);
+void	 bkgdset(chtype);
+int	 border(chtype, chtype, chtype, chtype,
+	   chtype, chtype, chtype, chtype);
+int	 clear(void);
+int	 clrtobot(void);
+int	 clrtoeol(void);
+int	 color_set(short, void *);
+int	 delch(void);
+int	 deleteln(void);
+int	 echochar(const chtype);
+int	 erase(void);
+int	 getch(void);
+int	 getnstr(char *, int);
+int	 getstr(char *);
+chtype	 inch(void);
+int	 inchnstr(chtype *, int);
+int	 inchstr(chtype *);
+int	 innstr(char *, int);
+int	 insch(chtype);
+int	 insdelln(int);
+int	 insertln(void);
+int	 instr(char *);
+int	 move(int, int);
+int	 refresh(void);
+int	 scrl(int);
+int	 setscrreg(int, int);
+int	 standend(void);
+int	 standout(void);
+void	 timeout(int);
+int	 underscore(void);
+int	 underend(void);
+int	 waddbytes(WINDOW *, const char *, int);
+int	 waddstr(WINDOW *, const char *);
+
+/* Standard screen plus movement functions. */
+int	 mvaddbytes(int, int, const char *, int);
+int	 mvaddch(int, int, chtype);
+int	 mvaddchnstr(int, int, const chtype *, int);
+int	 mvaddchstr(int, int, const chtype *);
+int	 mvaddnstr(int, int, const char *, int);
+int	 mvaddstr(int, int, const char *);
+int	 mvdelch(int, int);
+int	 mvgetch(int, int);
+int	 mvgetnstr(int, int, char *, int);
+int	 mvgetstr(int, int, char *);
+chtype	 mvinch(int, int);
+int	 mvinchnstr(int, int, chtype *, int);
+int	 mvinchstr(int, int, chtype *);
+int	 mvinnstr(int, int, char *, int);
+int	 mvinsch(int, int, chtype);
+int	 mvinstr(int, int, char *);
+
+int	 mvwaddbytes(WINDOW *, int, int, const char *, int);
+int	 mvwaddch(WINDOW *, int, int, chtype);
+int	 mvwaddchnstr(WINDOW *, int, int, const chtype *, int);
+int	 mvwaddchstr(WINDOW *, int, int, const chtype *);
+int	 mvwaddnstr(WINDOW *, int, int, const char *, int);
+int	 mvwaddstr(WINDOW *, int, int, const char *);
+int	 mvwdelch(WINDOW *, int, int);
+int	 mvwgetch(WINDOW *, int, int);
+int	 mvwgetnstr(WINDOW *, int, int, char *, int);
+int	 mvwgetstr(WINDOW *, int, int, char *);
+chtype	 mvwinch(WINDOW *, int, int);
+int	 mvwinsch(WINDOW *, int, int, chtype);
+__END_DECLS
+#endif /* _CURSES_USE_MACROS */
+
+#define	getyx(w, y, x)		(y) = getcury(w), (x) = getcurx(w)
+#define	getbegyx(w, y, x)	(y) = getbegy(w), (x) = getbegx(w)
+#define	getmaxyx(w, y, x)	(y) = getmaxy(w), (x) = getmaxx(w)
+#define	getparyx(w, y, x)	(y) = getpary(w), (x) = getparx(w)
+
+/* Public function prototypes. */
+__BEGIN_DECLS
+int	 assume_default_colors(short, short);
+int	 baudrate(void);
+int	 beep(void);
+int	 box(WINDOW *, chtype, chtype);
+bool	 can_change_color(void);
+int	 cbreak(void);
+int	 clearok(WINDOW *, bool);
+int	 color_content(short, short *, short *, short *);
+int	 copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int);
+int	 curs_set(int);
+int	 def_prog_mode(void);
+int	 def_shell_mode(void);
+int      define_key(char *, int);
+int	 delay_output(int);
+void     delscreen(SCREEN *);
+int	 delwin(WINDOW *);
+WINDOW	*derwin(WINDOW *, int, int, int, int);
+WINDOW	*dupwin(WINDOW *);
+int	 doupdate(void);
+int	 echo(void);
+int	 endwin(void);
+char     erasechar(void);
+int	 flash(void);
+int	 flushinp(void);
+int	 flushok(WINDOW *, bool);
+char	*fullname(const char *, char *);
+chtype	 getattrs(WINDOW *);
+chtype	 getbkgd(WINDOW *);
+int	 getcury(WINDOW *);
+int	 getcurx(WINDOW *);
+int	 getbegy(WINDOW *);
+int	 getbegx(WINDOW *);
+int	 getmaxy(WINDOW *);
+int	 getmaxx(WINDOW *);
+int	 getpary(WINDOW *);
+int	 getparx(WINDOW *);
+int	 gettmode(void);
+WINDOW	*getwin(FILE *);
+int	 halfdelay(int);
+bool	 has_colors(void);
+bool	 has_ic(void);
+bool	 has_il(void);
+int	 hline(chtype, int);
+int	 idcok(WINDOW *, bool);
+int	 idlok(WINDOW *, bool);
+int	 init_color(short, short, short, short);
+int	 init_pair(short, short, short);
+WINDOW	*initscr(void);
+int	 intrflush(WINDOW *, bool);
+bool	 isendwin(void);
+bool	 is_linetouched(WINDOW *, int);
+bool	 is_wintouched(WINDOW *);
+int      keyok(int, bool);
+int	 keypad(WINDOW *, bool);
+char	*keyname(int);
+char     killchar(void);
+int	 leaveok(WINDOW *, bool);
+int	 meta(WINDOW *, bool);
+int	 mvcur(int, int, int, int);
+int      mvderwin(WINDOW *, int, int);
+int	 mvhline(int, int, chtype, int);
+int	 mvprintw(int, int, const char *, ...) __printflike(3, 4);
+int	 mvscanw(int, int, const char *, ...) __scanflike(3, 4);
+int	 mvvline(int, int, chtype, int);
+int	 mvwhline(WINDOW *, int, int, chtype, int);
+int	 mvwvline(WINDOW *, int, int, chtype, int);
+int	 mvwin(WINDOW *, int, int);
+int	 mvwinchnstr(WINDOW *, int, int, chtype *, int);
+int	 mvwinchstr(WINDOW *, int, int, chtype *);
+int	 mvwinnstr(WINDOW *, int, int, char *, int);
+int	 mvwinstr(WINDOW *, int, int, char *);
+int	 mvwprintw(WINDOW *, int, int, const char *, ...) __printflike(4, 5);
+int	 mvwscanw(WINDOW *, int, int, const char *, ...) __scanflike(4, 5);
+int	 napms(int);
+WINDOW	*newpad(int, int);
+SCREEN  *newterm(char *, FILE *, FILE *);
+WINDOW	*newwin(int, int, int, int);
+int	 nl(void);
+attr_t	 no_color_attributes(void);
+int	 nocbreak(void);
+int	 nodelay(WINDOW *, bool);
+int	 noecho(void);
+int	 nonl(void);
+void	 noqiflush(void);
+int	 noraw(void);
+int	 notimeout(WINDOW *, bool);
+int	 overlay(const WINDOW *, WINDOW *);
+int	 overwrite(const WINDOW *, WINDOW *);
+int	 pair_content(short, short *, short *);
+int	 pechochar(WINDOW *, const chtype);
+int	 pnoutrefresh(WINDOW *, int, int, int, int, int, int);
+int	 prefresh(WINDOW *, int, int, int, int, int, int);
+int	 printw(const char *, ...) __printflike(1, 2);
+int	 putwin(WINDOW *, FILE *);
+void	 qiflush(void);
+int	 raw(void);
+int	 redrawwin(WINDOW *);
+int	 reset_prog_mode(void);
+int	 reset_shell_mode(void);
+int	 resetty(void);
+int      resizeterm(int, int);
+int	 savetty(void);
+int	 scanw(const char *, ...) __scanflike(1, 2);
+int	 scroll(WINDOW *);
+int	 scrollok(WINDOW *, bool);
+int	 setterm(char *);
+SCREEN  *set_term(SCREEN *);
+int	 start_color(void);
+WINDOW	*subpad(WINDOW *, int, int, int, int);
+WINDOW	*subwin(WINDOW *, int, int, int, int);
+chtype	 termattrs(void);
+attr_t	 term_attrs(void);
+int	 touchline(WINDOW *, int, int);
+int	 touchoverlap(WINDOW *, WINDOW *);
+int	 touchwin(WINDOW *);
+int	 ungetch(int);
+int	 untouchwin(WINDOW *);
+int	 use_default_colors(void);
+int	 vline(chtype, int);
+int	 vw_printw(WINDOW *, const char *, __va_list) __printflike(2, 0);
+int	 vw_scanw(WINDOW *, const char *, __va_list) __scanflike(2, 0);
+int	 vwprintw(WINDOW *, const char *, __va_list) __printflike(2, 0);
+int	 vwscanw(WINDOW *, const char *, __va_list) __scanflike(2, 0);
+int	 waddch(WINDOW *, chtype);
+int	 waddchnstr(WINDOW *, const chtype *, int);
+int	 waddchstr(WINDOW *, const chtype *);
+int	 waddnstr(WINDOW *, const char *, int);
+int	 wattr_get(WINDOW *, attr_t *, short *, void *);
+int	 wattr_off(WINDOW *, attr_t, void *);
+int	 wattr_on(WINDOW *, attr_t, void *);
+int	 wattr_set(WINDOW *, attr_t, short, void *);
+int	 wattroff(WINDOW *, int);
+int	 wattron(WINDOW *, int);
+int	 wattrset(WINDOW *, int);
+int	 wbkgd(WINDOW *, chtype);
+void	 wbkgdset(WINDOW *, chtype);
+int	 wborder(WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
+		chtype, chtype);
+int	 wclear(WINDOW *);
+int	 wclrtobot(WINDOW *);
+int	 wclrtoeol(WINDOW *);
+int	 wcolor_set(WINDOW *, short, void *);
+void	 wcursyncup(WINDOW *);
+int	 wdelch(WINDOW *);
+int	 wdeleteln(WINDOW *);
+int	 wechochar(WINDOW *, const chtype);
+int	 werase(WINDOW *);
+int	 wgetch(WINDOW *);
+int	 wgetnstr(WINDOW *, char *, int);
+int	 wgetstr(WINDOW *, char *);
+int	 whline(WINDOW *, chtype, int);
+chtype	 winch(WINDOW *);
+int	 winchnstr(WINDOW *, chtype *, int);
+int	 winchstr(WINDOW *, chtype *);
+int	 winnstr(WINDOW *, char *, int);
+int	 winsch(WINDOW *, chtype);
+int	 winsdelln(WINDOW *, int);
+int	 winsertln(WINDOW *);
+int	 winstr(WINDOW *, char *);
+int	 wmove(WINDOW *, int, int);
+int	 wnoutrefresh(WINDOW *);
+int	 wprintw(WINDOW *, const char *, ...)  __printflike(2, 3);
+int	 wredrawln(WINDOW *, int, int);
+int	 wrefresh(WINDOW *);
+int      wresize(WINDOW *, int, int);
+int	 wscanw(WINDOW *, const char *, ...) __scanflike(2, 3);
+int	 wscrl(WINDOW *, int);
+int	 wsetscrreg(WINDOW *, int, int);
+int	 wstandend(WINDOW *);
+int	 wstandout(WINDOW *);
+void	 wsyncdown(WINDOW *);
+void	 wsyncup(WINDOW *);
+void	 wtimeout(WINDOW *, int);
+int	 wtouchln(WINDOW *, int, int, int);
+int	 wunderend(WINDOW *);
+int	 wunderscore(WINDOW *);
+int	 wvline(WINDOW *, chtype, int);
+
+int insnstr(const char *, int);
+int insstr(const char *);
+int mvinsnstr(int, int, const char *, int);
+int mvinsstr(int, int, const char *);
+int mvwinsnstr(WINDOW *, int, int, const char *, int);
+int mvwinsstr(WINDOW *, int, int, const char *);
+int winsnstr(WINDOW *, const char *, int);
+int winsstr(WINDOW *, const char *);
+
+int chgat(int, attr_t, short, const void *);
+int wchgat(WINDOW *, int, attr_t, short, const void *);
+int mvchgat(int, int, int, attr_t, short, const void *);
+int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);
+
+/* wide-character support routines */
+/* return ERR when HAVE_WCHAR is not defined */
+/* add */
+int add_wch(const cchar_t *);
+int wadd_wch(WINDOW *, const cchar_t *);
+int mvadd_wch(int, int, const cchar_t *);
+int mvwadd_wch(WINDOW *, int, int, const cchar_t *);
+
+int add_wchnstr(const cchar_t *, int);
+int add_wchstr(const cchar_t *);
+int wadd_wchnstr(WINDOW *, const cchar_t *, int);
+int wadd_wchstr(WINDOW *, const cchar_t *);
+int mvadd_wchnstr(int, int, const cchar_t *, int);
+int mvadd_wchstr(int, int, const cchar_t *);
+int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int);
+int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *);
+
+int addnwstr(const wchar_t *, int);
+int addwstr(const wchar_t *);
+int mvaddnwstr(int, int x, const wchar_t *, int);
+int mvaddwstr(int, int x, const wchar_t *);
+int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);
+int mvwaddwstr(WINDOW *, int, int, const wchar_t *);
+int waddnwstr(WINDOW *, const wchar_t *, int);
+int waddwstr(WINDOW *, const wchar_t *);
+
+int echo_wchar(const cchar_t *);
+int wecho_wchar(WINDOW *, const cchar_t *);
+int pecho_wchar(WINDOW *, const cchar_t *);
+
+/* insert */
+int ins_wch(const cchar_t *);
+int wins_wch(WINDOW *, const cchar_t *);
+int mvins_wch(int, int, const cchar_t *);
+int mvwins_wch(WINDOW *, int, int, const cchar_t *);
+
+int ins_nwstr(const wchar_t *, int);
+int ins_wstr(const wchar_t *);
+int mvins_nwstr(int, int, const wchar_t *, int);
+int mvins_wstr(int, int, const wchar_t *);
+int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int);
+int mvwins_wstr(WINDOW *, int, int, const wchar_t *);
+int wins_nwstr(WINDOW *, const wchar_t *, int);
+int wins_wstr(WINDOW *, const wchar_t *);
+
+/* input */
+int get_wch(wint_t *);
+int unget_wch(const wchar_t);
+int mvget_wch(int, int, wint_t *);
+int mvwget_wch(WINDOW *, int, int, wint_t *);
+int wget_wch(WINDOW *, wint_t *);
+
+int getn_wstr(wchar_t *, int);
+int get_wstr(wchar_t *);
+int mvgetn_wstr(int, int, wchar_t *, int);
+int mvget_wstr(int, int, wchar_t *);
+int mvwgetn_wstr(WINDOW *, int, int, wchar_t *, int);
+int mvwget_wstr(WINDOW *, int, int, wchar_t *);
+int wgetn_wstr(WINDOW *, wchar_t *, int);
+int wget_wstr(WINDOW *, wchar_t *);
+
+int in_wch(cchar_t *);
+int mvin_wch(int, int, cchar_t *);
+int mvwin_wch(WINDOW *, int, int, cchar_t *);
+int win_wch(WINDOW *, cchar_t *);
+
+int in_wchnstr(cchar_t *, int);
+int in_wchstr(cchar_t *);
+int mvin_wchnstr(int, int, cchar_t *, int);
+int mvin_wchstr(int, int, cchar_t *);
+int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int);
+int mvwin_wchstr(WINDOW *, int, int, cchar_t *);
+int win_wchnstr(WINDOW *, cchar_t *, int);
+int win_wchstr(WINDOW *, cchar_t *);
+
+int innwstr(wchar_t *, int);
+int inwstr(wchar_t *);
+int mvinnwstr(int, int, wchar_t *, int);
+int mvinwstr(int, int, wchar_t *);
+int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
+int mvwinwstr(WINDOW *, int, int, wchar_t *);
+int winnwstr(WINDOW *, wchar_t *, int);
+int winwstr(WINDOW *, wchar_t *);
+
+/* cchar handlgin */
+int setcchar(cchar_t *, const wchar_t *, const attr_t, short, const void *);
+int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *);
+
+/* misc */
+char *key_name( wchar_t );
+int border_set(const cchar_t *, const cchar_t *, const cchar_t *,
+               const cchar_t *, const cchar_t *, const cchar_t *,
+               const cchar_t *, const cchar_t *);
+int wborder_set(WINDOW *, const cchar_t *, const cchar_t *,
+                const cchar_t *, const cchar_t *, const cchar_t *, 
+                const cchar_t *, const cchar_t *, const cchar_t *);
+int box_set(WINDOW *, const cchar_t *, const cchar_t *);
+int erasewchar(wchar_t *);
+int killwchar(wchar_t *);
+int hline_set(const cchar_t *, int);
+int mvhline_set(int, int, const cchar_t *, int);
+int mvvline_set(int, int, const cchar_t *, int);
+int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);
+int mvwvline_set(WINDOW *, int, int, const cchar_t *, int);
+int vline_set(const cchar_t *, int);
+int whline_set(WINDOW *, const cchar_t *, int);
+int wvline_set(WINDOW *, const cchar_t *, int);
+int bkgrnd(const cchar_t *);
+void bkgrndset(const cchar_t *);
+int getbkgrnd(cchar_t *);
+int wbkgrnd(WINDOW *, const cchar_t *);
+void wbkgrndset(WINDOW *, const cchar_t *);
+int wgetbkgrnd(WINDOW *, cchar_t *);
+
+/* Private functions that are needed for user programs prototypes. */
+int	 __cputchar(int);
+int	 __waddbytes(WINDOW *, const char *, int, attr_t);
+#ifdef HAVE_WCHAR
+int __cputwchar( wchar_t );
+#endif /* HAVE_WCHAR */
+__END_DECLS
+
+#endif /* !_CURSES_H_ */

Property changes on: lab4/.minix-src/include/curses.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/disktab.h
===================================================================
--- lab4/.minix-src/include/disktab.h	(nonexistent)
+++ lab4/.minix-src/include/disktab.h	(revision 13)
@@ -0,0 +1,49 @@
+/*	$NetBSD: disktab.h,v 1.10 2005/02/03 04:39:32 perry Exp $	*/
+
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)disktab.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef	_DISKTAB_H_
+#define	_DISKTAB_H_
+
+#include <sys/cdefs.h>
+
+/*
+ * Disk description table, see disktab(5)
+ */
+#define	_PATH_DISKTAB	"/etc/disktab"
+
+__BEGIN_DECLS
+int setdisktab(const char *);
+struct disklabel *getdiskbyname(const char *);
+__END_DECLS
+
+#endif /* !_DISKTAB_H_ */

Property changes on: lab4/.minix-src/include/disktab.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/errno.h
===================================================================
--- lab4/.minix-src/include/errno.h	(nonexistent)
+++ lab4/.minix-src/include/errno.h	(revision 13)
@@ -0,0 +1,66 @@
+/*	$NetBSD: errno.h,v 1.11 2008/03/03 06:57:48 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	from: @(#)errno.h	8.5 (Berkeley) 1/21/94
+ */
+
+#ifndef _ERRNO_H_
+#define _ERRNO_H_
+
+#include <sys/cdefs.h>
+#include <sys/errno.h>
+#include <sys/featuretest.h>
+
+__BEGIN_DECLS
+
+/* note: this appears in both errno.h and signal.h */
+#ifndef __errno
+int *__errno(void);
+#define __errno __errno
+#endif
+
+#ifndef errno
+#define errno (*__errno())
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+extern const int sys_nerr __RENAME(__sys_nerr14);
+extern const char *const *sys_errlist __RENAME(__sys_errlist14);
+#endif
+#endif
+__END_DECLS
+
+#endif /* !_ERRNO_H_ */

Property changes on: lab4/.minix-src/include/errno.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/evhttp.h
===================================================================
--- lab4/.minix-src/include/evhttp.h	(nonexistent)
+++ lab4/.minix-src/include/evhttp.h	(revision 13)
@@ -0,0 +1,46 @@
+/*	$NetBSD: evhttp.h,v 1.1.1.2 2013/04/11 16:43:29 christos Exp $	*/
+/*
+ * Copyright 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVHTTP_H_
+#define _EVHTTP_H_
+
+/** @file evhttp.h
+
+  An http implementation subsystem for Libevent.
+
+  The <evhttp.h> header is deprecated in Libevent 2.0 and later; please
+  use <event2/http.h> instead.  Depending on what functionality you
+  need, you may also want to include more of the other <event2/...>
+  headers.
+ */
+
+#include <event.h>
+#include <event2/http.h>
+#include <event2/http_struct.h>
+#include <event2/http_compat.h>
+
+#endif /* _EVHTTP_H_ */

Property changes on: lab4/.minix-src/include/evhttp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/err.h
===================================================================
--- lab4/.minix-src/include/err.h	(nonexistent)
+++ lab4/.minix-src/include/err.h	(revision 13)
@@ -0,0 +1,67 @@
+/*	$NetBSD: err.h,v 1.17 2014/01/16 17:22:06 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)err.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _ERR_H_
+#define	_ERR_H_
+
+#include <sys/cdefs.h>
+#include <stdarg.h>
+
+__BEGIN_DECLS
+__dead void	err(int, const char *, ...)
+		     __printflike(2, 3) __dead;
+__dead void	verr(int, const char *, va_list)
+		    __printflike(2, 0) __dead;
+__dead void	errx(int, const char *, ...)
+		     __printflike(2, 3) __dead;
+__dead void	verrx(int, const char *, va_list)
+		    __printflike(2, 0) __dead;
+__dead void	errc(int, int, const char *, ...)
+		     __printflike(3, 4) __dead;
+__dead void	verrc(int, int, const char *, va_list)
+		    __printflike(3, 0) __dead;
+void		warn(const char *, ...)
+		    __printflike(1, 2);
+void		vwarn(const char *, va_list)
+		    __printflike(1, 0);
+void		warnx(const char *, ...)
+		    __printflike(1, 2);
+void		vwarnx(const char *, va_list)
+		    __printflike(1, 0);
+void		warnc(int, const char *, ...)
+		    __printflike(2, 3);
+void		vwarnc(int, const char *, va_list)
+		    __printflike(2, 0);
+__END_DECLS
+
+#endif /* !_ERR_H_ */

Property changes on: lab4/.minix-src/include/err.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/event.h
===================================================================
--- lab4/.minix-src/include/event.h	(nonexistent)
+++ lab4/.minix-src/include/event.h	(revision 13)
@@ -0,0 +1,86 @@
+/*	$NetBSD: event.h,v 1.1.1.2 2013/04/11 16:43:20 christos Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVENT_H_
+#define _EVENT_H_
+
+/** @file event.h
+
+  A library for writing event-driven network servers.
+
+  The <event.h> header is deprecated in Libevent 2.0 and later; please
+  use <event2/event.h> instead.  Depending on what functionality you
+  need, you may also want to include more of the other event2/
+  headers.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <event2/event-config.h>
+#ifdef _EVENT_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef _EVENT_HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdarg.h>
+
+/* For int types. */
+#include <evutil.h>
+
+#ifdef WIN32
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <winsock2.h>
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+#endif
+
+#include <event2/event_struct.h>
+#include <event2/event.h>
+#include <event2/event_compat.h>
+#include <event2/buffer.h>
+#include <event2/buffer_compat.h>
+#include <event2/bufferevent.h>
+#include <event2/bufferevent_struct.h>
+#include <event2/bufferevent_compat.h>
+#include <event2/tag.h>
+#include <event2/tag_compat.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EVENT_H_ */

Property changes on: lab4/.minix-src/include/event.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/db.h
===================================================================
--- lab4/.minix-src/include/db.h	(nonexistent)
+++ lab4/.minix-src/include/db.h	(revision 13)
@@ -0,0 +1,228 @@
+/*	$NetBSD: db.h,v 1.26 2013/12/01 00:23:11 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)db.h	8.7 (Berkeley) 6/16/94
+ */
+
+#ifndef _DB_H_
+#define	_DB_H_
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+
+#include <limits.h>
+
+#define	RET_ERROR	-1		/* Return values. */
+#define	RET_SUCCESS	 0
+#define	RET_SPECIAL	 1
+
+#define	MAX_PAGE_NUMBER	0xffffffff	/* >= # of pages in a file */
+typedef uint32_t	pgno_t;
+#define	MAX_PAGE_OFFSET	65535		/* >= # of bytes in a page */
+typedef uint16_t	indx_t;
+#define	MAX_REC_NUMBER	0xffffffff	/* >= # of records in a tree */
+typedef uint32_t	recno_t;
+
+/* Key/data structure -- a Data-Base Thang. */
+typedef struct {
+	void	*data;			/* data */
+	size_t	 size;			/* data length */
+} DBT;
+
+/* Routine flags. */
+#define	R_CURSOR	1		/* del, put, seq */
+#define	__R_UNUSED	2		/* UNUSED */
+#define	R_FIRST		3		/* seq */
+#define	R_IAFTER	4		/* put (RECNO) */
+#define	R_IBEFORE	5		/* put (RECNO) */
+#define	R_LAST		6		/* seq (BTREE, RECNO) */
+#define	R_NEXT		7		/* seq */
+#define	R_NOOVERWRITE	8		/* put */
+#define	R_PREV		9		/* seq (BTREE, RECNO) */
+#define	R_SETCURSOR	10		/* put (RECNO) */
+#define	R_RECNOSYNC	11		/* sync (RECNO) */
+
+typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
+
+/*
+ * !!!
+ * The following flags are included in the dbopen(3) call as part of the
+ * open(2) flags.  In order to avoid conflicts with the open flags, start
+ * at the top of the 16 or 32-bit number space and work our way down.  If
+ * the open flags were significantly expanded in the future, it could be
+ * a problem.  Wish I'd left another flags word in the dbopen call.
+ *
+ * !!!
+ * None of this stuff is implemented yet.  The only reason that it's here
+ * is so that the access methods can skip copying the key/data pair when
+ * the DB_LOCK flag isn't set.
+ */
+#if UINT_MAX > 65535
+#define	DB_LOCK		0x20000000	/* Do locking. */
+#define	DB_SHMEM	0x40000000	/* Use shared memory. */
+#define	DB_TXN		0x80000000	/* Do transactions. */
+#else
+#define	DB_LOCK		    0x2000	/* Do locking. */
+#define	DB_SHMEM	    0x4000	/* Use shared memory. */
+#define	DB_TXN		    0x8000	/* Do transactions. */
+#endif
+
+/* Access method description structure. */
+typedef struct __db {
+	DBTYPE type;			/* Underlying db type. */
+	int (*close)	(struct __db *);
+	int (*del)	(const struct __db *, const DBT *, unsigned int);
+	int (*get)	(const struct __db *, const DBT *, DBT *, unsigned int);
+	int (*put)	(const struct __db *, DBT *, const DBT *, unsigned int);
+	int (*seq)	(const struct __db *, DBT *, DBT *, unsigned int);
+	int (*sync)	(const struct __db *, unsigned int);
+	void *internal;			/* Access method private. */
+	int (*fd)	(const struct __db *);
+} DB;
+
+#define	BTREEMAGIC	0x053162
+#define	BTREEVERSION	3
+
+/* Structure used to pass parameters to the btree routines. */
+typedef struct {
+#define	R_DUP		0x01	/* duplicate keys */
+	unsigned long	flags;
+	unsigned int	cachesize;	/* bytes to cache */
+	int		maxkeypage;	/* maximum keys per page */
+	int		minkeypage;	/* minimum keys per page */
+	unsigned int	psize;		/* page size */
+	int	(*compare)	/* comparison function */
+		(const DBT *, const DBT *);
+	size_t	(*prefix)	/* prefix function */
+		(const DBT *, const DBT *);
+	int	lorder;		/* byte order */
+} BTREEINFO;
+
+#define	HASHMAGIC	0x061561
+#define	HASHVERSION	2
+
+/* Structure used to pass parameters to the hashing routines. */
+typedef struct {
+	unsigned int	bsize;		/* bucket size */
+	unsigned int	ffactor;	/* fill factor */
+	unsigned int	nelem;		/* number of elements */
+	unsigned int	cachesize;	/* bytes to cache */
+	uint32_t		/* hash function */
+		(*hash)(const void *, size_t);
+	int	lorder;		/* byte order */
+} HASHINFO;
+
+/* Structure used to pass parameters to the record routines. */
+typedef struct {
+#define	R_FIXEDLEN	0x01	/* fixed-length records */
+#define	R_NOKEY		0x02	/* key not required */
+#define	R_SNAPSHOT	0x04	/* snapshot the input */
+	unsigned long	flags;
+	unsigned int	cachesize;	/* bytes to cache */
+	unsigned int	psize;		/* page size */
+	int		lorder;		/* byte order */
+	size_t		reclen;		/* record length (fixed-length records) */
+	uint8_t		bval;		/* delimiting byte (variable-length records */
+	char		*bfname;	/* btree file name */ 
+} RECNOINFO;
+
+#ifdef __DBINTERFACE_PRIVATE
+/*
+ * Little endian <==> big endian 32-bit swap macros.
+ *	M_32_SWAP	swap a memory location
+ *	P_32_SWAP	swap a referenced memory location
+ *	P_32_COPY	swap from one location to another
+ */
+#define	M_32_SWAP(a) {							\
+	uint32_t _tmp = a;						\
+	((char *)(void *)&a)[0] = ((char *)(void *)&_tmp)[3];		\
+	((char *)(void *)&a)[1] = ((char *)(void *)&_tmp)[2];		\
+	((char *)(void *)&a)[2] = ((char *)(void *)&_tmp)[1];		\
+	((char *)(void *)&a)[3] = ((char *)(void *)&_tmp)[0];		\
+}
+#define	P_32_SWAP(a) {							\
+	char  _tmp[4];							\
+	_tmp[0] = ((char *)(void *)a)[0];				\
+	_tmp[1] = ((char *)(void *)a)[1];				\
+	_tmp[2] = ((char *)(void *)a)[2];				\
+	_tmp[3] = ((char *)(void *)a)[3];				\
+	((char *)(void *)a)[0] = _tmp[3];				\
+	((char *)(void *)a)[1] = _tmp[2];				\
+	((char *)(void *)a)[2] = _tmp[1];				\
+	((char *)(void *)a)[3] = _tmp[0];				\
+}
+#define	P_32_COPY(a, b) {						\
+	((char *)(void *)&(b))[0] = ((char *)(void *)&(a))[3];		\
+	((char *)(void *)&(b))[1] = ((char *)(void *)&(a))[2];		\
+	((char *)(void *)&(b))[2] = ((char *)(void *)&(a))[1];		\
+	((char *)(void *)&(b))[3] = ((char *)(void *)&(a))[0];		\
+}
+
+/*
+ * Little endian <==> big endian 16-bit swap macros.
+ *	M_16_SWAP	swap a memory location
+ *	P_16_SWAP	swap a referenced memory location
+ *	P_16_COPY	swap from one location to another
+ */
+#define	M_16_SWAP(a) {							\
+	uint16_t _tmp = a;						\
+	((char *)(void *)&a)[0] = ((char *)(void *)&_tmp)[1];		\
+	((char *)(void *)&a)[1] = ((char *)(void *)&_tmp)[0];		\
+}
+#define	P_16_SWAP(a) {							\
+	char  _tmp[2];							\
+	_tmp[0] = ((char *)(void *)a)[0];				\
+	_tmp[1] = ((char *)(void *)a)[1];				\
+	((char *)(void *)a)[0] = _tmp[1];				\
+	((char *)(void *)a)[1] = _tmp[0];				\
+}
+#define	P_16_COPY(a, b) {						\
+	((char *)(void *)&(b))[0] = ((char *)(void *)&(a))[1];		\
+	((char *)(void *)&(b))[1] = ((char *)(void *)&(a))[0];		\
+}
+#endif
+
+__BEGIN_DECLS
+DB *dbopen(const char *, int, mode_t, DBTYPE, const void *);
+
+#ifdef __DBINTERFACE_PRIVATE
+
+#define _DBFIT(a, t) _DIAGASSERT(__type_fit(t, a))
+
+DB	*__bt_open(const char *, int, mode_t, const BTREEINFO *, int);
+DB	*__hash_open(const char *, int, mode_t, const HASHINFO *, int);
+DB	*__rec_open(const char *, int, mode_t, const RECNOINFO *, int);
+void	 __dbpanic(DB *);
+struct stat;
+int	 __dbopen(const char *, int, mode_t, struct stat *);
+int	 __dbtemp(const char *, struct stat *);
+#endif
+__END_DECLS
+#endif /* !_DB_H_ */

Property changes on: lab4/.minix-src/include/db.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/dlfcn.h
===================================================================
--- lab4/.minix-src/include/dlfcn.h	(nonexistent)
+++ lab4/.minix-src/include/dlfcn.h	(revision 13)
@@ -0,0 +1,117 @@
+/*	$NetBSD: dlfcn.h,v 1.24 2012/02/16 23:00:39 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Kranenburg.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _DLFCN_H_
+#define _DLFCN_H_
+
+#include <sys/featuretest.h>
+#include <sys/cdefs.h>
+
+#if defined(_NETBSD_SOURCE)
+typedef struct _dl_info {
+	const char	*dli_fname;	/* File defining the symbol */
+	void		*dli_fbase;	/* Base address */
+	const char	*dli_sname;	/* Symbol name */
+	const void	*dli_saddr;	/* Symbol address */
+} Dl_info;
+#endif /* defined(_NETBSD_SOURCE) */
+
+/*
+ * User interface to the run-time linker.
+ */
+__BEGIN_DECLS
+void *_dlauxinfo(void) __pure;
+
+void	*dlopen(const char *, int);
+int	dlclose(void *);
+void	*dlsym(void * __restrict, const char * __restrict);
+#if defined(_NETBSD_SOURCE)
+int	dladdr(const void * __restrict, Dl_info * __restrict);
+int	dlctl(void *, int, void *);
+int	dlinfo(void *, int, void *);
+void	*dlvsym(void * __restrict, const char * __restrict,
+	    const char * __restrict);
+#endif
+__aconst char *dlerror(void);
+__END_DECLS
+
+/* Values for dlopen `mode'. */
+#define RTLD_LAZY	1
+#define RTLD_NOW	2
+#define RTLD_GLOBAL	0x100		/* Allow global searches in object */
+#define RTLD_LOCAL	0x200
+#define RTLD_NODELETE	0x01000		/* Do not remove members. */
+#define RTLD_NOLOAD	0x02000		/* Do not load if not already loaded. */
+#if defined(_NETBSD_SOURCE)
+#define DL_LAZY		RTLD_LAZY	/* Compat */
+#endif
+
+/* 
+ * Special handle arguments for dlsym().
+ */   
+#define	RTLD_NEXT	((void *) -1)	/* Search subsequent objects. */
+#define	RTLD_DEFAULT	((void *) -2)	/* Use default search algorithm. */
+#define	RTLD_SELF	((void *) -3)	/* Search the caller itself. */
+
+/*
+ * dlctl() commands
+ */
+#if defined(_NETBSD_SOURCE)
+#define DL_GETERRNO	1
+#define DL_GETSYMBOL	2
+#if 0
+#define DL_SETSRCHPATH	x
+#define DL_GETLIST	x
+#define DL_GETREFCNT	x
+#define DL_GETLOADADDR	x
+#endif /* 0 */
+#endif /* defined(_NETBSD_SOURCE) */
+
+/*
+ * dlinfo() commands
+ *
+ * From Solaris: http://docs.sun.com/app/docs/doc/816-5168/dlinfo-3c?a=view
+ */
+#if defined(_NETBSD_SOURCE)
+#define RTLD_DI_LINKMAP		3
+#if 0
+#define RTLD_DI_ARGSINFO	1
+#define RTLD_DI_CONFIGADDR	2
+#define RTLD_DI_LMID		4
+#define RTLD_DI_SERINFO		5
+#define RTLD_DI_SERINFOSIZE	6
+#define RTLD_DI_ORIGIN		7
+#define RTLD_DI_GETSIGNAL	8
+#define RTLD_DI_SETSIGNAL	9
+#endif
+#endif /* _NETBSD_SOURCE */
+
+#endif /* !defined(_DLFCN_H_) */

Property changes on: lab4/.minix-src/include/dlfcn.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/expat.h
===================================================================
--- lab4/.minix-src/include/expat.h	(nonexistent)
+++ lab4/.minix-src/include/expat.h	(revision 13)
@@ -0,0 +1,1047 @@
+/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
+*/
+
+#ifndef Expat_INCLUDED
+#define Expat_INCLUDED 1
+
+#ifdef __VMS
+/*      0        1         2         3      0        1         2         3
+        1234567890123456789012345678901     1234567890123456789012345678901 */
+#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler
+#define XML_SetUnparsedEntityDeclHandler    XML_SetUnparsedEntDeclHandler
+#define XML_SetStartNamespaceDeclHandler    XML_SetStartNamespcDeclHandler
+#define XML_SetExternalEntityRefHandlerArg  XML_SetExternalEntRefHandlerArg
+#endif
+
+#include <stdlib.h>
+#include "expat_external.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct XML_ParserStruct;
+typedef struct XML_ParserStruct *XML_Parser;
+
+/* Should this be defined using stdbool.h when C99 is available? */
+typedef unsigned char XML_Bool;
+#define XML_TRUE   ((XML_Bool) 1)
+#define XML_FALSE  ((XML_Bool) 0)
+
+/* The XML_Status enum gives the possible return values for several
+   API functions.  The preprocessor #defines are included so this
+   stanza can be added to code that still needs to support older
+   versions of Expat 1.95.x:
+
+   #ifndef XML_STATUS_OK
+   #define XML_STATUS_OK    1
+   #define XML_STATUS_ERROR 0
+   #endif
+
+   Otherwise, the #define hackery is quite ugly and would have been
+   dropped.
+*/
+enum XML_Status {
+  XML_STATUS_ERROR = 0,
+#define XML_STATUS_ERROR XML_STATUS_ERROR
+  XML_STATUS_OK = 1,
+#define XML_STATUS_OK XML_STATUS_OK
+  XML_STATUS_SUSPENDED = 2
+#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
+};
+
+enum XML_Error {
+  XML_ERROR_NONE,
+  XML_ERROR_NO_MEMORY,
+  XML_ERROR_SYNTAX,
+  XML_ERROR_NO_ELEMENTS,
+  XML_ERROR_INVALID_TOKEN,
+  XML_ERROR_UNCLOSED_TOKEN,
+  XML_ERROR_PARTIAL_CHAR,
+  XML_ERROR_TAG_MISMATCH,
+  XML_ERROR_DUPLICATE_ATTRIBUTE,
+  XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
+  XML_ERROR_PARAM_ENTITY_REF,
+  XML_ERROR_UNDEFINED_ENTITY,
+  XML_ERROR_RECURSIVE_ENTITY_REF,
+  XML_ERROR_ASYNC_ENTITY,
+  XML_ERROR_BAD_CHAR_REF,
+  XML_ERROR_BINARY_ENTITY_REF,
+  XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
+  XML_ERROR_MISPLACED_XML_PI,
+  XML_ERROR_UNKNOWN_ENCODING,
+  XML_ERROR_INCORRECT_ENCODING,
+  XML_ERROR_UNCLOSED_CDATA_SECTION,
+  XML_ERROR_EXTERNAL_ENTITY_HANDLING,
+  XML_ERROR_NOT_STANDALONE,
+  XML_ERROR_UNEXPECTED_STATE,
+  XML_ERROR_ENTITY_DECLARED_IN_PE,
+  XML_ERROR_FEATURE_REQUIRES_XML_DTD,
+  XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING,
+  /* Added in 1.95.7. */
+  XML_ERROR_UNBOUND_PREFIX,
+  /* Added in 1.95.8. */
+  XML_ERROR_UNDECLARING_PREFIX,
+  XML_ERROR_INCOMPLETE_PE,
+  XML_ERROR_XML_DECL,
+  XML_ERROR_TEXT_DECL,
+  XML_ERROR_PUBLICID,
+  XML_ERROR_SUSPENDED,
+  XML_ERROR_NOT_SUSPENDED,
+  XML_ERROR_ABORTED,
+  XML_ERROR_FINISHED,
+  XML_ERROR_SUSPEND_PE,
+  /* Added in 2.0. */
+  XML_ERROR_RESERVED_PREFIX_XML,
+  XML_ERROR_RESERVED_PREFIX_XMLNS,
+  XML_ERROR_RESERVED_NAMESPACE_URI
+};
+
+enum XML_Content_Type {
+  XML_CTYPE_EMPTY = 1,
+  XML_CTYPE_ANY,
+  XML_CTYPE_MIXED,
+  XML_CTYPE_NAME,
+  XML_CTYPE_CHOICE,
+  XML_CTYPE_SEQ
+};
+
+enum XML_Content_Quant {
+  XML_CQUANT_NONE,
+  XML_CQUANT_OPT,
+  XML_CQUANT_REP,
+  XML_CQUANT_PLUS
+};
+
+/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
+   XML_CQUANT_NONE, and the other fields will be zero or NULL.
+   If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
+   numchildren will contain number of elements that may be mixed in
+   and children point to an array of XML_Content cells that will be
+   all of XML_CTYPE_NAME type with no quantification.
+
+   If type == XML_CTYPE_NAME, then the name points to the name, and
+   the numchildren field will be zero and children will be NULL. The
+   quant fields indicates any quantifiers placed on the name.
+
+   CHOICE and SEQ will have name NULL, the number of children in
+   numchildren and children will point, recursively, to an array
+   of XML_Content cells.
+
+   The EMPTY, ANY, and MIXED types will only occur at top level.
+*/
+
+typedef struct XML_cp XML_Content;
+
+struct XML_cp {
+  enum XML_Content_Type         type;
+  enum XML_Content_Quant        quant;
+  XML_Char *                    name;
+  unsigned int                  numchildren;
+  XML_Content *                 children;
+};
+
+
+/* This is called for an element declaration. See above for
+   description of the model argument. It's the caller's responsibility
+   to free model when finished with it.
+*/
+typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData,
+                                                const XML_Char *name,
+                                                XML_Content *model);
+
+XMLPARSEAPI(void)
+XML_SetElementDeclHandler(XML_Parser parser,
+                          XML_ElementDeclHandler eldecl);
+
+/* The Attlist declaration handler is called for *each* attribute. So
+   a single Attlist declaration with multiple attributes declared will
+   generate multiple calls to this handler. The "default" parameter
+   may be NULL in the case of the "#IMPLIED" or "#REQUIRED"
+   keyword. The "isrequired" parameter will be true and the default
+   value will be NULL in the case of "#REQUIRED". If "isrequired" is
+   true and default is non-NULL, then this is a "#FIXED" default.
+*/
+typedef void (XMLCALL *XML_AttlistDeclHandler) (
+                                    void            *userData,
+                                    const XML_Char  *elname,
+                                    const XML_Char  *attname,
+                                    const XML_Char  *att_type,
+                                    const XML_Char  *dflt,
+                                    int              isrequired);
+
+XMLPARSEAPI(void)
+XML_SetAttlistDeclHandler(XML_Parser parser,
+                          XML_AttlistDeclHandler attdecl);
+
+/* The XML declaration handler is called for *both* XML declarations
+   and text declarations. The way to distinguish is that the version
+   parameter will be NULL for text declarations. The encoding
+   parameter may be NULL for XML declarations. The standalone
+   parameter will be -1, 0, or 1 indicating respectively that there
+   was no standalone parameter in the declaration, that it was given
+   as no, or that it was given as yes.
+*/
+typedef void (XMLCALL *XML_XmlDeclHandler) (void           *userData,
+                                            const XML_Char *version,
+                                            const XML_Char *encoding,
+                                            int             standalone);
+
+XMLPARSEAPI(void)
+XML_SetXmlDeclHandler(XML_Parser parser,
+                      XML_XmlDeclHandler xmldecl);
+
+
+typedef struct {
+  void *(*malloc_fcn)(size_t size);
+  void *(*realloc_fcn)(void *ptr, size_t size);
+  void (*free_fcn)(void *ptr);
+} XML_Memory_Handling_Suite;
+
+/* Constructs a new parser; encoding is the encoding specified by the
+   external protocol or NULL if there is none specified.
+*/
+XMLPARSEAPI(XML_Parser)
+XML_ParserCreate(const XML_Char *encoding);
+
+/* Constructs a new parser and namespace processor.  Element type
+   names and attribute names that belong to a namespace will be
+   expanded; unprefixed attribute names are never expanded; unprefixed
+   element type names are expanded only if there is a default
+   namespace. The expanded name is the concatenation of the namespace
+   URI, the namespace separator character, and the local part of the
+   name.  If the namespace separator is '\0' then the namespace URI
+   and the local part will be concatenated without any separator.
+   It is a programming error to use the separator '\0' with namespace
+   triplets (see XML_SetReturnNSTriplet).
+*/
+XMLPARSEAPI(XML_Parser)
+XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
+
+
+/* Constructs a new parser using the memory management suite referred to
+   by memsuite. If memsuite is NULL, then use the standard library memory
+   suite. If namespaceSeparator is non-NULL it creates a parser with
+   namespace processing as described above. The character pointed at
+   will serve as the namespace separator.
+
+   All further memory operations used for the created parser will come from
+   the given suite.
+*/
+XMLPARSEAPI(XML_Parser)
+XML_ParserCreate_MM(const XML_Char *encoding,
+                    const XML_Memory_Handling_Suite *memsuite,
+                    const XML_Char *namespaceSeparator);
+
+/* Prepare a parser object to be re-used.  This is particularly
+   valuable when memory allocation overhead is disproportionatly high,
+   such as when a large number of small documnents need to be parsed.
+   All handlers are cleared from the parser, except for the
+   unknownEncodingHandler. The parser's external state is re-initialized
+   except for the values of ns and ns_triplets.
+
+   Added in Expat 1.95.3.
+*/
+XMLPARSEAPI(XML_Bool)
+XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
+
+/* atts is array of name/value pairs, terminated by 0;
+   names and values are 0 terminated.
+*/
+typedef void (XMLCALL *XML_StartElementHandler) (void *userData,
+                                                 const XML_Char *name,
+                                                 const XML_Char **atts);
+
+typedef void (XMLCALL *XML_EndElementHandler) (void *userData,
+                                               const XML_Char *name);
+
+
+/* s is not 0 terminated. */
+typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData,
+                                                  const XML_Char *s,
+                                                  int len);
+
+/* target and data are 0 terminated */
+typedef void (XMLCALL *XML_ProcessingInstructionHandler) (
+                                                void *userData,
+                                                const XML_Char *target,
+                                                const XML_Char *data);
+
+/* data is 0 terminated */
+typedef void (XMLCALL *XML_CommentHandler) (void *userData,
+                                            const XML_Char *data);
+
+typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData);
+typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData);
+
+/* This is called for any characters in the XML document for which
+   there is no applicable handler.  This includes both characters that
+   are part of markup which is of a kind that is not reported
+   (comments, markup declarations), or characters that are part of a
+   construct which could be reported but for which no handler has been
+   supplied. The characters are passed exactly as they were in the XML
+   document except that they will be encoded in UTF-8 or UTF-16.
+   Line boundaries are not normalized. Note that a byte order mark
+   character is not passed to the default handler. There are no
+   guarantees about how characters are divided between calls to the
+   default handler: for example, a comment might be split between
+   multiple calls.
+*/
+typedef void (XMLCALL *XML_DefaultHandler) (void *userData,
+                                            const XML_Char *s,
+                                            int len);
+
+/* This is called for the start of the DOCTYPE declaration, before
+   any DTD or internal subset is parsed.
+*/
+typedef void (XMLCALL *XML_StartDoctypeDeclHandler) (
+                                            void *userData,
+                                            const XML_Char *doctypeName,
+                                            const XML_Char *sysid,
+                                            const XML_Char *pubid,
+                                            int has_internal_subset);
+
+/* This is called for the start of the DOCTYPE declaration when the
+   closing > is encountered, but after processing any external
+   subset.
+*/
+typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
+
+/* This is called for entity declarations. The is_parameter_entity
+   argument will be non-zero if the entity is a parameter entity, zero
+   otherwise.
+
+   For internal entities (<!ENTITY foo "bar">), value will
+   be non-NULL and systemId, publicID, and notationName will be NULL.
+   The value string is NOT nul-terminated; the length is provided in
+   the value_length argument. Since it is legal to have zero-length
+   values, do not use this argument to test for internal entities.
+
+   For external entities, value will be NULL and systemId will be
+   non-NULL. The publicId argument will be NULL unless a public
+   identifier was provided. The notationName argument will have a
+   non-NULL value only for unparsed entity declarations.
+
+   Note that is_parameter_entity can't be changed to XML_Bool, since
+   that would break binary compatibility.
+*/
+typedef void (XMLCALL *XML_EntityDeclHandler) (
+                              void *userData,
+                              const XML_Char *entityName,
+                              int is_parameter_entity,
+                              const XML_Char *value,
+                              int value_length,
+                              const XML_Char *base,
+                              const XML_Char *systemId,
+                              const XML_Char *publicId,
+                              const XML_Char *notationName);
+
+XMLPARSEAPI(void)
+XML_SetEntityDeclHandler(XML_Parser parser,
+                         XML_EntityDeclHandler handler);
+
+/* OBSOLETE -- OBSOLETE -- OBSOLETE
+   This handler has been superceded by the EntityDeclHandler above.
+   It is provided here for backward compatibility.
+
+   This is called for a declaration of an unparsed (NDATA) entity.
+   The base argument is whatever was set by XML_SetBase. The
+   entityName, systemId and notationName arguments will never be
+   NULL. The other arguments may be.
+*/
+typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) (
+                                    void *userData,
+                                    const XML_Char *entityName,
+                                    const XML_Char *base,
+                                    const XML_Char *systemId,
+                                    const XML_Char *publicId,
+                                    const XML_Char *notationName);
+
+/* This is called for a declaration of notation.  The base argument is
+   whatever was set by XML_SetBase. The notationName will never be
+   NULL.  The other arguments can be.
+*/
+typedef void (XMLCALL *XML_NotationDeclHandler) (
+                                    void *userData,
+                                    const XML_Char *notationName,
+                                    const XML_Char *base,
+                                    const XML_Char *systemId,
+                                    const XML_Char *publicId);
+
+/* When namespace processing is enabled, these are called once for
+   each namespace declaration. The call to the start and end element
+   handlers occur between the calls to the start and end namespace
+   declaration handlers. For an xmlns attribute, prefix will be
+   NULL.  For an xmlns="" attribute, uri will be NULL.
+*/
+typedef void (XMLCALL *XML_StartNamespaceDeclHandler) (
+                                    void *userData,
+                                    const XML_Char *prefix,
+                                    const XML_Char *uri);
+
+typedef void (XMLCALL *XML_EndNamespaceDeclHandler) (
+                                    void *userData,
+                                    const XML_Char *prefix);
+
+/* This is called if the document is not standalone, that is, it has an
+   external subset or a reference to a parameter entity, but does not
+   have standalone="yes". If this handler returns XML_STATUS_ERROR,
+   then processing will not continue, and the parser will return a
+   XML_ERROR_NOT_STANDALONE error.
+   If parameter entity parsing is enabled, then in addition to the
+   conditions above this handler will only be called if the referenced
+   entity was actually read.
+*/
+typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData);
+
+/* This is called for a reference to an external parsed general
+   entity.  The referenced entity is not automatically parsed.  The
+   application can parse it immediately or later using
+   XML_ExternalEntityParserCreate.
+
+   The parser argument is the parser parsing the entity containing the
+   reference; it can be passed as the parser argument to
+   XML_ExternalEntityParserCreate.  The systemId argument is the
+   system identifier as specified in the entity declaration; it will
+   not be NULL.
+
+   The base argument is the system identifier that should be used as
+   the base for resolving systemId if systemId was relative; this is
+   set by XML_SetBase; it may be NULL.
+
+   The publicId argument is the public identifier as specified in the
+   entity declaration, or NULL if none was specified; the whitespace
+   in the public identifier will have been normalized as required by
+   the XML spec.
+
+   The context argument specifies the parsing context in the format
+   expected by the context argument to XML_ExternalEntityParserCreate;
+   context is valid only until the handler returns, so if the
+   referenced entity is to be parsed later, it must be copied.
+   context is NULL only when the entity is a parameter entity.
+
+   The handler should return XML_STATUS_ERROR if processing should not
+   continue because of a fatal error in the handling of the external
+   entity.  In this case the calling parser will return an
+   XML_ERROR_EXTERNAL_ENTITY_HANDLING error.
+
+   Note that unlike other handlers the first argument is the parser,
+   not userData.
+*/
+typedef int (XMLCALL *XML_ExternalEntityRefHandler) (
+                                    XML_Parser parser,
+                                    const XML_Char *context,
+                                    const XML_Char *base,
+                                    const XML_Char *systemId,
+                                    const XML_Char *publicId);
+
+/* This is called in two situations:
+   1) An entity reference is encountered for which no declaration
+      has been read *and* this is not an error.
+   2) An internal entity reference is read, but not expanded, because
+      XML_SetDefaultHandler has been called.
+   Note: skipped parameter entities in declarations and skipped general
+         entities in attribute values cannot be reported, because
+         the event would be out of sync with the reporting of the
+         declarations or attribute values
+*/
+typedef void (XMLCALL *XML_SkippedEntityHandler) (
+                                    void *userData,
+                                    const XML_Char *entityName,
+                                    int is_parameter_entity);
+
+/* This structure is filled in by the XML_UnknownEncodingHandler to
+   provide information to the parser about encodings that are unknown
+   to the parser.
+
+   The map[b] member gives information about byte sequences whose
+   first byte is b.
+
+   If map[b] is c where c is >= 0, then b by itself encodes the
+   Unicode scalar value c.
+
+   If map[b] is -1, then the byte sequence is malformed.
+
+   If map[b] is -n, where n >= 2, then b is the first byte of an
+   n-byte sequence that encodes a single Unicode scalar value.
+
+   The data member will be passed as the first argument to the convert
+   function.
+
+   The convert function is used to convert multibyte sequences; s will
+   point to a n-byte sequence where map[(unsigned char)*s] == -n.  The
+   convert function must return the Unicode scalar value represented
+   by this byte sequence or -1 if the byte sequence is malformed.
+
+   The convert function may be NULL if the encoding is a single-byte
+   encoding, that is if map[b] >= -1 for all bytes b.
+
+   When the parser is finished with the encoding, then if release is
+   not NULL, it will call release passing it the data member; once
+   release has been called, the convert function will not be called
+   again.
+
+   Expat places certain restrictions on the encodings that are supported
+   using this mechanism.
+
+   1. Every ASCII character that can appear in a well-formed XML document,
+      other than the characters
+
+      $@\^`{}~
+
+      must be represented by a single byte, and that byte must be the
+      same byte that represents that character in ASCII.
+
+   2. No character may require more than 4 bytes to encode.
+
+   3. All characters encoded must have Unicode scalar values <=
+      0xFFFF, (i.e., characters that would be encoded by surrogates in
+      UTF-16 are  not allowed).  Note that this restriction doesn't
+      apply to the built-in support for UTF-8 and UTF-16.
+
+   4. No Unicode character may be encoded by more than one distinct
+      sequence of bytes.
+*/
+typedef struct {
+  int map[256];
+  void *data;
+  int (XMLCALL *convert)(void *data, const char *s);
+  void (XMLCALL *release)(void *data);
+} XML_Encoding;
+
+/* This is called for an encoding that is unknown to the parser.
+
+   The encodingHandlerData argument is that which was passed as the
+   second argument to XML_SetUnknownEncodingHandler.
+
+   The name argument gives the name of the encoding as specified in
+   the encoding declaration.
+
+   If the callback can provide information about the encoding, it must
+   fill in the XML_Encoding structure, and return XML_STATUS_OK.
+   Otherwise it must return XML_STATUS_ERROR.
+
+   If info does not describe a suitable encoding, then the parser will
+   return an XML_UNKNOWN_ENCODING error.
+*/
+typedef int (XMLCALL *XML_UnknownEncodingHandler) (
+                                    void *encodingHandlerData,
+                                    const XML_Char *name,
+                                    XML_Encoding *info);
+
+XMLPARSEAPI(void)
+XML_SetElementHandler(XML_Parser parser,
+                      XML_StartElementHandler start,
+                      XML_EndElementHandler end);
+
+XMLPARSEAPI(void)
+XML_SetStartElementHandler(XML_Parser parser,
+                           XML_StartElementHandler handler);
+
+XMLPARSEAPI(void)
+XML_SetEndElementHandler(XML_Parser parser,
+                         XML_EndElementHandler handler);
+
+XMLPARSEAPI(void)
+XML_SetCharacterDataHandler(XML_Parser parser,
+                            XML_CharacterDataHandler handler);
+
+XMLPARSEAPI(void)
+XML_SetProcessingInstructionHandler(XML_Parser parser,
+                                    XML_ProcessingInstructionHandler handler);
+XMLPARSEAPI(void)
+XML_SetCommentHandler(XML_Parser parser,
+                      XML_CommentHandler handler);
+
+XMLPARSEAPI(void)
+XML_SetCdataSectionHandler(XML_Parser parser,
+                           XML_StartCdataSectionHandler start,
+                           XML_EndCdataSectionHandler end);
+
+XMLPARSEAPI(void)
+XML_SetStartCdataSectionHandler(XML_Parser parser,
+                                XML_StartCdataSectionHandler start);
+
+XMLPARSEAPI(void)
+XML_SetEndCdataSectionHandler(XML_Parser parser,
+                              XML_EndCdataSectionHandler end);
+
+/* This sets the default handler and also inhibits expansion of
+   internal entities. These entity references will be passed to the
+   default handler, or to the skipped entity handler, if one is set.
+*/
+XMLPARSEAPI(void)
+XML_SetDefaultHandler(XML_Parser parser,
+                      XML_DefaultHandler handler);
+
+/* This sets the default handler but does not inhibit expansion of
+   internal entities.  The entity reference will not be passed to the
+   default handler.
+*/
+XMLPARSEAPI(void)
+XML_SetDefaultHandlerExpand(XML_Parser parser,
+                            XML_DefaultHandler handler);
+
+XMLPARSEAPI(void)
+XML_SetDoctypeDeclHandler(XML_Parser parser,
+                          XML_StartDoctypeDeclHandler start,
+                          XML_EndDoctypeDeclHandler end);
+
+XMLPARSEAPI(void)
+XML_SetStartDoctypeDeclHandler(XML_Parser parser,
+                               XML_StartDoctypeDeclHandler start);
+
+XMLPARSEAPI(void)
+XML_SetEndDoctypeDeclHandler(XML_Parser parser,
+                             XML_EndDoctypeDeclHandler end);
+
+XMLPARSEAPI(void)
+XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
+                                 XML_UnparsedEntityDeclHandler handler);
+
+XMLPARSEAPI(void)
+XML_SetNotationDeclHandler(XML_Parser parser,
+                           XML_NotationDeclHandler handler);
+
+XMLPARSEAPI(void)
+XML_SetNamespaceDeclHandler(XML_Parser parser,
+                            XML_StartNamespaceDeclHandler start,
+                            XML_EndNamespaceDeclHandler end);
+
+XMLPARSEAPI(void)
+XML_SetStartNamespaceDeclHandler(XML_Parser parser,
+                                 XML_StartNamespaceDeclHandler start);
+
+XMLPARSEAPI(void)
+XML_SetEndNamespaceDeclHandler(XML_Parser parser,
+                               XML_EndNamespaceDeclHandler end);
+
+XMLPARSEAPI(void)
+XML_SetNotStandaloneHandler(XML_Parser parser,
+                            XML_NotStandaloneHandler handler);
+
+XMLPARSEAPI(void)
+XML_SetExternalEntityRefHandler(XML_Parser parser,
+                                XML_ExternalEntityRefHandler handler);
+
+/* If a non-NULL value for arg is specified here, then it will be
+   passed as the first argument to the external entity ref handler
+   instead of the parser object.
+*/
+XMLPARSEAPI(void)
+XML_SetExternalEntityRefHandlerArg(XML_Parser parser,
+                                   void *arg);
+
+XMLPARSEAPI(void)
+XML_SetSkippedEntityHandler(XML_Parser parser,
+                            XML_SkippedEntityHandler handler);
+
+XMLPARSEAPI(void)
+XML_SetUnknownEncodingHandler(XML_Parser parser,
+                              XML_UnknownEncodingHandler handler,
+                              void *encodingHandlerData);
+
+/* This can be called within a handler for a start element, end
+   element, processing instruction or character data.  It causes the
+   corresponding markup to be passed to the default handler.
+*/
+XMLPARSEAPI(void)
+XML_DefaultCurrent(XML_Parser parser);
+
+/* If do_nst is non-zero, and namespace processing is in effect, and
+   a name has a prefix (i.e. an explicit namespace qualifier) then
+   that name is returned as a triplet in a single string separated by
+   the separator character specified when the parser was created: URI
+   + sep + local_name + sep + prefix.
+
+   If do_nst is zero, then namespace information is returned in the
+   default manner (URI + sep + local_name) whether or not the name
+   has a prefix.
+
+   Note: Calling XML_SetReturnNSTriplet after XML_Parse or
+     XML_ParseBuffer has no effect.
+*/
+
+XMLPARSEAPI(void)
+XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
+
+/* This value is passed as the userData argument to callbacks. */
+XMLPARSEAPI(void)
+XML_SetUserData(XML_Parser parser, void *userData);
+
+/* Returns the last value set by XML_SetUserData or NULL. */
+#define XML_GetUserData(parser) (*(void **)(parser))
+
+/* This is equivalent to supplying an encoding argument to
+   XML_ParserCreate. On success XML_SetEncoding returns non-zero,
+   zero otherwise.
+   Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer
+     has no effect and returns XML_STATUS_ERROR.
+*/
+XMLPARSEAPI(enum XML_Status)
+XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
+
+/* If this function is called, then the parser will be passed as the
+   first argument to callbacks instead of userData.  The userData will
+   still be accessible using XML_GetUserData.
+*/
+XMLPARSEAPI(void)
+XML_UseParserAsHandlerArg(XML_Parser parser);
+
+/* If useDTD == XML_TRUE is passed to this function, then the parser
+   will assume that there is an external subset, even if none is
+   specified in the document. In such a case the parser will call the
+   externalEntityRefHandler with a value of NULL for the systemId
+   argument (the publicId and context arguments will be NULL as well).
+   Note: For the purpose of checking WFC: Entity Declared, passing
+     useDTD == XML_TRUE will make the parser behave as if the document
+     had a DTD with an external subset.
+   Note: If this function is called, then this must be done before
+     the first call to XML_Parse or XML_ParseBuffer, since it will
+     have no effect after that.  Returns
+     XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING.
+   Note: If the document does not have a DOCTYPE declaration at all,
+     then startDoctypeDeclHandler and endDoctypeDeclHandler will not
+     be called, despite an external subset being parsed.
+   Note: If XML_DTD is not defined when Expat is compiled, returns
+     XML_ERROR_FEATURE_REQUIRES_XML_DTD.
+*/
+XMLPARSEAPI(enum XML_Error)
+XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
+
+
+/* Sets the base to be used for resolving relative URIs in system
+   identifiers in declarations.  Resolving relative identifiers is
+   left to the application: this value will be passed through as the
+   base argument to the XML_ExternalEntityRefHandler,
+   XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base
+   argument will be copied.  Returns XML_STATUS_ERROR if out of memory,
+   XML_STATUS_OK otherwise.
+*/
+XMLPARSEAPI(enum XML_Status)
+XML_SetBase(XML_Parser parser, const XML_Char *base);
+
+XMLPARSEAPI(const XML_Char *)
+XML_GetBase(XML_Parser parser);
+
+/* Returns the number of the attribute/value pairs passed in last call
+   to the XML_StartElementHandler that were specified in the start-tag
+   rather than defaulted. Each attribute/value pair counts as 2; thus
+   this correspondds to an index into the atts array passed to the
+   XML_StartElementHandler.
+*/
+XMLPARSEAPI(int)
+XML_GetSpecifiedAttributeCount(XML_Parser parser);
+
+/* Returns the index of the ID attribute passed in the last call to
+   XML_StartElementHandler, or -1 if there is no ID attribute.  Each
+   attribute/value pair counts as 2; thus this correspondds to an
+   index into the atts array passed to the XML_StartElementHandler.
+*/
+XMLPARSEAPI(int)
+XML_GetIdAttributeIndex(XML_Parser parser);
+
+#ifdef XML_ATTR_INFO
+/* Source file byte offsets for the start and end of attribute names and values.
+   The value indices are exclusive of surrounding quotes; thus in a UTF-8 source
+   file an attribute value of "blah" will yield:
+   info->valueEnd - info->valueStart = 4 bytes.
+*/
+typedef struct {
+  XML_Index  nameStart;  /* Offset to beginning of the attribute name. */
+  XML_Index  nameEnd;    /* Offset after the attribute name's last byte. */
+  XML_Index  valueStart; /* Offset to beginning of the attribute value. */
+  XML_Index  valueEnd;   /* Offset after the attribute value's last byte. */
+} XML_AttrInfo;
+
+/* Returns an array of XML_AttrInfo structures for the attribute/value pairs
+   passed in last call to the XML_StartElementHandler that were specified
+   in the start-tag rather than defaulted. Each attribute/value pair counts
+   as 1; thus the number of entries in the array is
+   XML_GetSpecifiedAttributeCount(parser) / 2.
+*/
+XMLPARSEAPI(const XML_AttrInfo *)
+XML_GetAttributeInfo(XML_Parser parser);
+#endif
+
+/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
+   detected.  The last call to XML_Parse must have isFinal true; len
+   may be zero for this call (or any other).
+
+   Though the return values for these functions has always been
+   described as a Boolean value, the implementation, at least for the
+   1.95.x series, has always returned exactly one of the XML_Status
+   values.
+*/
+XMLPARSEAPI(enum XML_Status)
+XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
+
+XMLPARSEAPI(void *)
+XML_GetBuffer(XML_Parser parser, int len);
+
+XMLPARSEAPI(enum XML_Status)
+XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
+
+/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return.
+   Must be called from within a call-back handler, except when aborting
+   (resumable = 0) an already suspended parser. Some call-backs may
+   still follow because they would otherwise get lost. Examples:
+   - endElementHandler() for empty elements when stopped in
+     startElementHandler(), 
+   - endNameSpaceDeclHandler() when stopped in endElementHandler(), 
+   and possibly others.
+
+   Can be called from most handlers, including DTD related call-backs,
+   except when parsing an external parameter entity and resumable != 0.
+   Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise.
+   Possible error codes: 
+   - XML_ERROR_SUSPENDED: when suspending an already suspended parser.
+   - XML_ERROR_FINISHED: when the parser has already finished.
+   - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE.
+
+   When resumable != 0 (true) then parsing is suspended, that is, 
+   XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. 
+   Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer()
+   return XML_STATUS_ERROR with error code XML_ERROR_ABORTED.
+
+   *Note*:
+   This will be applied to the current parser instance only, that is, if
+   there is a parent parser then it will continue parsing when the
+   externalEntityRefHandler() returns. It is up to the implementation of
+   the externalEntityRefHandler() to call XML_StopParser() on the parent
+   parser (recursively), if one wants to stop parsing altogether.
+
+   When suspended, parsing can be resumed by calling XML_ResumeParser(). 
+*/
+XMLPARSEAPI(enum XML_Status)
+XML_StopParser(XML_Parser parser, XML_Bool resumable);
+
+/* Resumes parsing after it has been suspended with XML_StopParser().
+   Must not be called from within a handler call-back. Returns same
+   status codes as XML_Parse() or XML_ParseBuffer().
+   Additional error code XML_ERROR_NOT_SUSPENDED possible.   
+
+   *Note*:
+   This must be called on the most deeply nested child parser instance
+   first, and on its parent parser only after the child parser has finished,
+   to be applied recursively until the document entity's parser is restarted.
+   That is, the parent parser will not resume by itself and it is up to the
+   application to call XML_ResumeParser() on it at the appropriate moment.
+*/
+XMLPARSEAPI(enum XML_Status)
+XML_ResumeParser(XML_Parser parser);
+
+enum XML_Parsing {
+  XML_INITIALIZED,
+  XML_PARSING,
+  XML_FINISHED,
+  XML_SUSPENDED
+};
+
+typedef struct {
+  enum XML_Parsing parsing;
+  XML_Bool finalBuffer;
+} XML_ParsingStatus;
+
+/* Returns status of parser with respect to being initialized, parsing,
+   finished, or suspended and processing the final buffer.
+   XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus,
+   XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED
+*/
+XMLPARSEAPI(void)
+XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
+
+/* Creates an XML_Parser object that can parse an external general
+   entity; context is a '\0'-terminated string specifying the parse
+   context; encoding is a '\0'-terminated string giving the name of
+   the externally specified encoding, or NULL if there is no
+   externally specified encoding.  The context string consists of a
+   sequence of tokens separated by formfeeds (\f); a token consisting
+   of a name specifies that the general entity of the name is open; a
+   token of the form prefix=uri specifies the namespace for a
+   particular prefix; a token of the form =uri specifies the default
+   namespace.  This can be called at any point after the first call to
+   an ExternalEntityRefHandler so longer as the parser has not yet
+   been freed.  The new parser is completely independent and may
+   safely be used in a separate thread.  The handlers and userData are
+   initialized from the parser argument.  Returns NULL if out of memory.
+   Otherwise returns a new XML_Parser object.
+*/
+XMLPARSEAPI(XML_Parser)
+XML_ExternalEntityParserCreate(XML_Parser parser,
+                               const XML_Char *context,
+                               const XML_Char *encoding);
+
+enum XML_ParamEntityParsing {
+  XML_PARAM_ENTITY_PARSING_NEVER,
+  XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
+  XML_PARAM_ENTITY_PARSING_ALWAYS
+};
+
+/* Controls parsing of parameter entities (including the external DTD
+   subset). If parsing of parameter entities is enabled, then
+   references to external parameter entities (including the external
+   DTD subset) will be passed to the handler set with
+   XML_SetExternalEntityRefHandler.  The context passed will be 0.
+
+   Unlike external general entities, external parameter entities can
+   only be parsed synchronously.  If the external parameter entity is
+   to be parsed, it must be parsed during the call to the external
+   entity ref handler: the complete sequence of
+   XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and
+   XML_ParserFree calls must be made during this call.  After
+   XML_ExternalEntityParserCreate has been called to create the parser
+   for the external parameter entity (context must be 0 for this
+   call), it is illegal to make any calls on the old parser until
+   XML_ParserFree has been called on the newly created parser.
+   If the library has been compiled without support for parameter
+   entity parsing (ie without XML_DTD being defined), then
+   XML_SetParamEntityParsing will return 0 if parsing of parameter
+   entities is requested; otherwise it will return non-zero.
+   Note: If XML_SetParamEntityParsing is called after XML_Parse or
+      XML_ParseBuffer, then it has no effect and will always return 0.
+*/
+XMLPARSEAPI(int)
+XML_SetParamEntityParsing(XML_Parser parser,
+                          enum XML_ParamEntityParsing parsing);
+
+/* Sets the hash salt to use for internal hash calculations.
+   Helps in preventing DoS attacks based on predicting hash
+   function behavior. This must be called before parsing is started.
+   Returns 1 if successful, 0 when called after parsing has started.
+*/
+XMLPARSEAPI(int)
+XML_SetHashSalt(XML_Parser parser,
+                unsigned long hash_salt);
+
+/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
+   XML_GetErrorCode returns information about the error.
+*/
+XMLPARSEAPI(enum XML_Error)
+XML_GetErrorCode(XML_Parser parser);
+
+/* These functions return information about the current parse
+   location.  They may be called from any callback called to report
+   some parse event; in this case the location is the location of the
+   first of the sequence of characters that generated the event.  When
+   called from callbacks generated by declarations in the document
+   prologue, the location identified isn't as neatly defined, but will
+   be within the relevant markup.  When called outside of the callback
+   functions, the position indicated will be just past the last parse
+   event (regardless of whether there was an associated callback).
+   
+   They may also be called after returning from a call to XML_Parse
+   or XML_ParseBuffer.  If the return value is XML_STATUS_ERROR then
+   the location is the location of the character at which the error
+   was detected; otherwise the location is the location of the last
+   parse event, as described above.
+*/
+XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);
+XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);
+XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);
+
+/* Return the number of bytes in the current event.
+   Returns 0 if the event is in an internal entity.
+*/
+XMLPARSEAPI(int)
+XML_GetCurrentByteCount(XML_Parser parser);
+
+/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
+   the integer pointed to by offset to the offset within this buffer
+   of the current parse position, and sets the integer pointed to by size
+   to the size of this buffer (the number of input bytes). Otherwise
+   returns a NULL pointer. Also returns a NULL pointer if a parse isn't
+   active.
+
+   NOTE: The character pointer returned should not be used outside
+   the handler that makes the call.
+*/
+XMLPARSEAPI(const char *)
+XML_GetInputContext(XML_Parser parser,
+                    int *offset,
+                    int *size);
+
+/* For backwards compatibility with previous versions. */
+#define XML_GetErrorLineNumber   XML_GetCurrentLineNumber
+#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
+#define XML_GetErrorByteIndex    XML_GetCurrentByteIndex
+
+/* Frees the content model passed to the element declaration handler */
+XMLPARSEAPI(void)
+XML_FreeContentModel(XML_Parser parser, XML_Content *model);
+
+/* Exposing the memory handling functions used in Expat */
+XMLPARSEAPI(void *)
+XML_MemMalloc(XML_Parser parser, size_t size);
+
+XMLPARSEAPI(void *)
+XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
+
+XMLPARSEAPI(void)
+XML_MemFree(XML_Parser parser, void *ptr);
+
+/* Frees memory used by the parser. */
+XMLPARSEAPI(void)
+XML_ParserFree(XML_Parser parser);
+
+/* Returns a string describing the error. */
+XMLPARSEAPI(const XML_LChar *)
+XML_ErrorString(enum XML_Error code);
+
+/* Return a string containing the version number of this expat */
+XMLPARSEAPI(const XML_LChar *)
+XML_ExpatVersion(void);
+
+typedef struct {
+  int major;
+  int minor;
+  int micro;
+} XML_Expat_Version;
+
+/* Return an XML_Expat_Version structure containing numeric version
+   number information for this version of expat.
+*/
+XMLPARSEAPI(XML_Expat_Version)
+XML_ExpatVersionInfo(void);
+
+/* Added in Expat 1.95.5. */
+enum XML_FeatureEnum {
+  XML_FEATURE_END = 0,
+  XML_FEATURE_UNICODE,
+  XML_FEATURE_UNICODE_WCHAR_T,
+  XML_FEATURE_DTD,
+  XML_FEATURE_CONTEXT_BYTES,
+  XML_FEATURE_MIN_SIZE,
+  XML_FEATURE_SIZEOF_XML_CHAR,
+  XML_FEATURE_SIZEOF_XML_LCHAR,
+  XML_FEATURE_NS,
+  XML_FEATURE_LARGE_SIZE,
+  XML_FEATURE_ATTR_INFO
+  /* Additional features must be added to the end of this enum. */
+};
+
+typedef struct {
+  enum XML_FeatureEnum  feature;
+  const XML_LChar       *name;
+  long int              value;
+} XML_Feature;
+
+XMLPARSEAPI(const XML_Feature *)
+XML_GetFeatureList(void);
+
+
+/* Expat follows the GNU/Linux convention of odd number minor version for
+   beta/development releases and even number minor version for stable
+   releases. Micro is bumped with each release, and set to 0 with each
+   change to major or minor version.
+*/
+#define XML_MAJOR_VERSION 2
+#define XML_MINOR_VERSION 1
+#define XML_MICRO_VERSION 0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* not Expat_INCLUDED */

Property changes on: lab4/.minix-src/include/expat.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/eti.h
===================================================================
--- lab4/.minix-src/include/eti.h	(nonexistent)
+++ lab4/.minix-src/include/eti.h	(revision 13)
@@ -0,0 +1,50 @@
+/*	$NetBSD: eti.h,v 1.8 2001/06/13 10:45:59 wiz Exp $	*/
+
+/*-
+ * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au)
+ * 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ *
+ *
+ */
+
+#ifndef	_ETI_H_
+#define	_ETI_H_
+
+/* common return codes for libmenu and libpanel functions */
+
+#define E_OK              (0)
+#define E_SYSTEM_ERROR    (-1)
+#define E_BAD_ARGUMENT    (-2)
+#define E_POSTED          (-3)
+#define E_CONNECTED       (-4)
+#define E_BAD_STATE       (-5)
+#define E_NO_ROOM         (-6)
+#define E_NOT_POSTED      (-7)
+#define E_UNKNOWN_COMMAND (-8)
+#define E_NO_MATCH        (-9)
+#define E_NOT_SELECTABLE  (-10)
+#define E_NOT_CONNECTED   (-11)
+#define E_REQUEST_DENIED  (-12)
+#define E_INVALID_FIELD   (-13)
+#define E_CURRENT         (-14)
+
+#endif /* !_ETI_H_ */

Property changes on: lab4/.minix-src/include/eti.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/execinfo.h
===================================================================
--- lab4/.minix-src/include/execinfo.h	(nonexistent)
+++ lab4/.minix-src/include/execinfo.h	(revision 13)
@@ -0,0 +1,44 @@
+/*	$NetBSD: execinfo.h,v 1.2 2012/06/09 21:22:17 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _EXECINFO_H_
+#define _EXECINFO_H_
+
+#include <stddef.h>
+
+__BEGIN_DECLS
+size_t backtrace(void **, size_t);
+char **backtrace_symbols(void *const *, size_t);
+int backtrace_symbols_fd(void *const *, size_t, int);
+char **backtrace_symbols_fmt(void *const *, size_t, const char *);
+int backtrace_symbols_fd_fmt(void *const *, size_t, int, const char *);
+__END_DECLS
+
+#endif /* _EXECINFO_H_ */

Property changes on: lab4/.minix-src/include/execinfo.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fenv.h
===================================================================
--- lab4/.minix-src/include/fenv.h	(nonexistent)
+++ lab4/.minix-src/include/fenv.h	(revision 13)
@@ -0,0 +1,66 @@
+/*	$NetBSD: fenv.h,v 1.13 2014/12/27 16:54:02 martin Exp $	*/
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(__aarch64__) && !defined(__arm__) && !defined(__i386__) \
+    && !defined(__hppa__) \
+    && !defined(__or1k__) && !defined(__riscv__) && !defined(__sparc__) \
+    && !defined(__x86_64__)
+#error	"fenv.h is currently not supported for this architecture"
+#endif
+
+#ifndef _FENV_H_
+#define _FENV_H_
+
+#include <sys/featuretest.h>
+#include <machine/fenv.h>
+
+__BEGIN_DECLS
+
+/* Function prototypes */
+int	feclearexcept(int);
+int	fegetexceptflag(fexcept_t *, int);
+int	feraiseexcept(int);
+int	fesetexceptflag(const fexcept_t *, int);
+int	fetestexcept(int);
+int	fegetround(void);
+int	fesetround(int);
+int	fegetenv(fenv_t *);
+int	feholdexcept(fenv_t *);
+int	fesetenv(const fenv_t *);
+int	feupdateenv(const fenv_t *);
+
+#if defined(_NETBSD_SOURCE) || defined(_GNU_SOURCE)
+
+int	feenableexcept(int mask);
+int	fedisableexcept(int mask);
+int	fegetexcept(void);
+
+#endif /* _NETBSD_SOURCE || _GNU_SOURCE */
+
+__END_DECLS
+
+#endif /* ! _FENV_H_ */

Property changes on: lab4/.minix-src/include/fenv.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fnmatch.h
===================================================================
--- lab4/.minix-src/include/fnmatch.h	(nonexistent)
+++ lab4/.minix-src/include/fnmatch.h	(revision 13)
@@ -0,0 +1,57 @@
+/*	$NetBSD: fnmatch.h,v 1.13 2011/01/31 04:49:46 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)fnmatch.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef	_FNMATCH_H_
+#define	_FNMATCH_H_
+
+#include <sys/featuretest.h>
+
+#define	FNM_NOMATCH	1	/* Match failed. */
+#define	FNM_NOSYS	2	/* Function not implemented. */
+#define	FNM_NORES	3	/* Out of resources */
+
+#define	FNM_NOESCAPE	0x01	/* Disable backslash escaping. */
+#define	FNM_PATHNAME	0x02	/* Slash must be matched by slash. */
+#define	FNM_PERIOD	0x04	/* Period must be matched by period. */
+#if defined(_NETBSD_SOURCE)
+#define	FNM_CASEFOLD	0x08	/* Pattern is matched case-insensitive */
+#define	FNM_LEADING_DIR	0x10	/* Ignore /<tail> after Imatch. */
+#endif
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	 fnmatch(const char *, const char *, int);
+__END_DECLS
+
+#endif /* !_FNMATCH_H_ */

Property changes on: lab4/.minix-src/include/fnmatch.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ftw.h
===================================================================
--- lab4/.minix-src/include/ftw.h	(nonexistent)
+++ lab4/.minix-src/include/ftw.h	(revision 13)
@@ -0,0 +1,62 @@
+/* $NetBSD: ftw.h,v 1.1 2005/12/30 23:07:33 agc Exp $ */
+
+/*	From OpenBSD: ftw.h,v 1.1 2003/07/21 21:13:18 millert Exp 	*/
+
+/*
+ * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Sponsored in part by the Defense Advanced Research Projects
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.
+ */
+
+#ifndef	_FTW_H
+#define	_FTW_H
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/*
+ * Valid flags for the 3rd argument to the function that is passed as the
+ * second argument to ftw(3) and nftw(3).  Say it three times fast!
+ */
+#define	FTW_F		0	/* File.  */
+#define	FTW_D		1	/* Directory.  */
+#define	FTW_DNR		2	/* Directory without read permission.  */
+#define	FTW_DP		3	/* Directory with subdirectories visited.  */
+#define	FTW_NS		4	/* Unknown type; stat() failed.  */
+#define	FTW_SL		5	/* Symbolic link.  */
+#define	FTW_SLN		6	/* Sym link that names a nonexistent file.  */
+
+/*
+ * Flags for use as the 4th argument to nftw(3).  These may be ORed together.
+ */
+#define	FTW_PHYS	0x01	/* Physical walk, don't follow sym links.  */
+#define	FTW_MOUNT	0x02	/* The walk does not cross a mount point.  */
+#define	FTW_DEPTH	0x04	/* Subdirs visited before the dir itself. */
+#define	FTW_CHDIR	0x08	/* Change to a directory before reading it. */
+
+struct FTW {
+	int base;
+	int level;
+};
+
+__BEGIN_DECLS
+int	ftw(const char *, int (*)(const char *, const struct stat *, int), int);
+int	nftw(const char *, int (*)(const char *, const struct stat *, int,
+	    struct FTW *), int, int);
+__END_DECLS
+
+#endif	/* !_FTW_H */

Property changes on: lab4/.minix-src/include/ftw.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/evrpc.h
===================================================================
--- lab4/.minix-src/include/evrpc.h	(nonexistent)
+++ lab4/.minix-src/include/evrpc.h	(revision 13)
@@ -0,0 +1,46 @@
+/*	$NetBSD: evrpc.h,v 1.1.1.2 2013/04/11 16:43:29 christos Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVRPC_H_
+#define _EVRPC_H_
+
+/** @file evrpc.h
+
+  An RPC system for Libevent.
+
+  The <evrpc.h> header is deprecated in Libevent 2.0 and later; please
+  use <event2/rpc.h> instead.  Depending on what functionality you
+  need, you may also want to include more of the other <event2/...>
+  headers.
+ */
+
+#include <event.h>
+#include <event2/rpc.h>
+#include <event2/rpc_struct.h>
+#include <event2/rpc_compat.h>
+
+#endif /* _EVRPC_H_ */

Property changes on: lab4/.minix-src/include/evrpc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/expat_external.h
===================================================================
--- lab4/.minix-src/include/expat_external.h	(nonexistent)
+++ lab4/.minix-src/include/expat_external.h	(revision 13)
@@ -0,0 +1,115 @@
+/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
+*/
+
+#ifndef Expat_External_INCLUDED
+#define Expat_External_INCLUDED 1
+
+/* External API definitions */
+
+#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
+#define XML_USE_MSC_EXTENSIONS 1
+#endif
+
+/* Expat tries very hard to make the API boundary very specifically
+   defined.  There are two macros defined to control this boundary;
+   each of these can be defined before including this header to
+   achieve some different behavior, but doing so it not recommended or
+   tested frequently.
+
+   XMLCALL    - The calling convention to use for all calls across the
+                "library boundary."  This will default to cdecl, and
+                try really hard to tell the compiler that's what we
+                want.
+
+   XMLIMPORT  - Whatever magic is needed to note that a function is
+                to be imported from a dynamically loaded library
+                (.dll, .so, or .sl, depending on your platform).
+
+   The XMLCALL macro was added in Expat 1.95.7.  The only one which is
+   expected to be directly useful in client code is XMLCALL.
+
+   Note that on at least some Unix versions, the Expat library must be
+   compiled with the cdecl calling convention as the default since
+   system headers may assume the cdecl convention.
+*/
+#ifndef XMLCALL
+#if defined(_MSC_VER)
+#define XMLCALL __cdecl
+#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)
+#define XMLCALL __attribute__((cdecl))
+#else
+/* For any platform which uses this definition and supports more than
+   one calling convention, we need to extend this definition to
+   declare the convention used on that platform, if it's possible to
+   do so.
+
+   If this is the case for your platform, please file a bug report
+   with information on how to identify your platform via the C
+   pre-processor and how to specify the same calling convention as the
+   platform's malloc() implementation.
+*/
+#define XMLCALL
+#endif
+#endif  /* not defined XMLCALL */
+
+
+#if !defined(XML_STATIC) && !defined(XMLIMPORT)
+#ifndef XML_BUILDING_EXPAT
+/* using Expat from an application */
+
+#ifdef XML_USE_MSC_EXTENSIONS
+#define XMLIMPORT __declspec(dllimport)
+#endif
+
+#endif
+#endif  /* not defined XML_STATIC */
+
+
+/* If we didn't define it above, define it away: */
+#ifndef XMLIMPORT
+#define XMLIMPORT
+#endif
+
+
+#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef XML_UNICODE_WCHAR_T
+#define XML_UNICODE
+#endif
+
+#ifdef XML_UNICODE     /* Information is UTF-16 encoded. */
+#ifdef XML_UNICODE_WCHAR_T
+typedef wchar_t XML_Char;
+typedef wchar_t XML_LChar;
+#else
+typedef unsigned short XML_Char;
+typedef char XML_LChar;
+#endif /* XML_UNICODE_WCHAR_T */
+#else                  /* Information is UTF-8 encoded. */
+typedef char XML_Char;
+typedef char XML_LChar;
+#endif /* XML_UNICODE */
+
+#ifdef XML_LARGE_SIZE  /* Use large integers for file/stream positions. */
+#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
+typedef __int64 XML_Index; 
+typedef unsigned __int64 XML_Size;
+#else
+typedef long long XML_Index;
+typedef unsigned long long XML_Size;
+#endif
+#else
+typedef long XML_Index;
+typedef unsigned long XML_Size;
+#endif /* XML_LARGE_SIZE */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* not Expat_External_INCLUDED */

Property changes on: lab4/.minix-src/include/expat_external.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fetch.h
===================================================================
--- lab4/.minix-src/include/fetch.h	(nonexistent)
+++ lab4/.minix-src/include/fetch.h	(revision 13)
@@ -0,0 +1,187 @@
+/*	$NetBSD: fetch.h,v 1.1.1.7 2010/01/30 21:26:11 joerg Exp $	*/
+/*-
+ * Copyright (c) 1998-2004 Dag-Erling Co�dan Sm�rgrav
+ * 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
+ *    in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ *
+ * $FreeBSD: fetch.h,v 1.26 2004/09/21 18:35:20 des Exp $
+ */
+
+#ifndef _FETCH_H_INCLUDED
+#define _FETCH_H_INCLUDED
+
+#include <sys/types.h>
+#include <limits.h>
+#include <stdio.h>
+
+#define _LIBFETCH_VER "libfetch/2.0"
+
+#define URL_HOSTLEN 255
+#define URL_SCHEMELEN 16
+#define URL_USERLEN 256
+#define URL_PWDLEN 256
+
+typedef struct fetchIO fetchIO;
+
+struct url {
+	char		 scheme[URL_SCHEMELEN + 1];
+	char		 user[URL_USERLEN + 1];
+	char		 pwd[URL_PWDLEN + 1];
+	char		 host[URL_HOSTLEN + 1];
+	int		 port;
+	char		*doc;
+	off_t		 offset;
+	size_t		 length;
+	time_t		 last_modified;
+};
+
+struct url_stat {
+	off_t		 size;
+	time_t		 atime;
+	time_t		 mtime;
+};
+
+struct url_list {
+	size_t		 length;
+	size_t		 alloc_size;
+	struct url	*urls;
+};
+
+/* Recognized schemes */
+#define SCHEME_FTP	"ftp"
+#define SCHEME_HTTP	"http"
+#define SCHEME_HTTPS	"https"
+#define SCHEME_FILE	"file"
+
+/* Error codes */
+#define	FETCH_ABORT	 1
+#define	FETCH_AUTH	 2
+#define	FETCH_DOWN	 3
+#define	FETCH_EXISTS	 4
+#define	FETCH_FULL	 5
+#define	FETCH_INFO	 6
+#define	FETCH_MEMORY	 7
+#define	FETCH_MOVED	 8
+#define	FETCH_NETWORK	 9
+#define	FETCH_OK	10
+#define	FETCH_PROTO	11
+#define	FETCH_RESOLV	12
+#define	FETCH_SERVER	13
+#define	FETCH_TEMP	14
+#define	FETCH_TIMEOUT	15
+#define	FETCH_UNAVAIL	16
+#define	FETCH_UNKNOWN	17
+#define	FETCH_URL	18
+#define	FETCH_VERBOSE	19
+#define	FETCH_UNCHANGED	20
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+void		fetchIO_close(fetchIO *);
+ssize_t		fetchIO_read(fetchIO *, void *, size_t);
+ssize_t		fetchIO_write(fetchIO *, const void *, size_t);
+
+/* fetchIO-specific functions */
+fetchIO		*fetchXGetFile(struct url *, struct url_stat *, const char *);
+fetchIO		*fetchGetFile(struct url *, const char *);
+fetchIO		*fetchPutFile(struct url *, const char *);
+int		 fetchStatFile(struct url *, struct url_stat *, const char *);
+int		 fetchListFile(struct url_list *, struct url *, const char *,
+		    const char *);
+
+/* HTTP-specific functions */
+fetchIO		*fetchXGetHTTP(struct url *, struct url_stat *, const char *);
+fetchIO		*fetchGetHTTP(struct url *, const char *);
+fetchIO		*fetchPutHTTP(struct url *, const char *);
+int		 fetchStatHTTP(struct url *, struct url_stat *, const char *);
+int		 fetchListHTTP(struct url_list *, struct url *, const char *,
+		    const char *);
+
+/* FTP-specific functions */
+fetchIO		*fetchXGetFTP(struct url *, struct url_stat *, const char *);
+fetchIO		*fetchGetFTP(struct url *, const char *);
+fetchIO		*fetchPutFTP(struct url *, const char *);
+int		 fetchStatFTP(struct url *, struct url_stat *, const char *);
+int		 fetchListFTP(struct url_list *, struct url *, const char *,
+		    const char *);
+
+/* Generic functions */
+fetchIO		*fetchXGetURL(const char *, struct url_stat *, const char *);
+fetchIO		*fetchGetURL(const char *, const char *);
+fetchIO		*fetchPutURL(const char *, const char *);
+int		 fetchStatURL(const char *, struct url_stat *, const char *);
+int		 fetchListURL(struct url_list *, const char *, const char *,
+		    const char *);
+fetchIO		*fetchXGet(struct url *, struct url_stat *, const char *);
+fetchIO		*fetchGet(struct url *, const char *);
+fetchIO		*fetchPut(struct url *, const char *);
+int		 fetchStat(struct url *, struct url_stat *, const char *);
+int		 fetchList(struct url_list *, struct url *, const char *,
+		    const char *);
+
+/* URL parsing */
+struct url	*fetchMakeURL(const char *, const char *, int,
+		     const char *, const char *, const char *);
+struct url	*fetchParseURL(const char *);
+struct url	*fetchCopyURL(const struct url *);
+char		*fetchStringifyURL(const struct url *);
+void		 fetchFreeURL(struct url *);
+
+/* URL listening */
+void		 fetchInitURLList(struct url_list *);
+int		 fetchAppendURLList(struct url_list *, const struct url_list *);
+void		 fetchFreeURLList(struct url_list *);
+char		*fetchUnquotePath(struct url *);
+char		*fetchUnquoteFilename(struct url *);
+
+/* Connection caching */
+void		 fetchConnectionCacheInit(int, int);
+void		 fetchConnectionCacheClose(void);
+
+/* Authentication */
+typedef int (*auth_t)(struct url *);
+extern auth_t		 fetchAuthMethod;
+
+/* Last error code */
+extern int		 fetchLastErrCode;
+#define MAXERRSTRING 256
+extern char		 fetchLastErrString[MAXERRSTRING];
+
+/* I/O timeout */
+extern int		 fetchTimeout;
+
+/* Restart interrupted syscalls */
+extern volatile int	 fetchRestartCalls;
+
+/* Extra verbosity */
+extern int		 fetchDebug;
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/fetch.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/form.h
===================================================================
--- lab4/.minix-src/include/form.h	(nonexistent)
+++ lab4/.minix-src/include/form.h	(revision 13)
@@ -0,0 +1,382 @@
+/*	$NetBSD: form.h,v 1.23 2015/09/07 15:50:49 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1998-1999 Brett Lymn
+ *               (blymn@baea.com.au, brett_lymn@yahoo.com.au)
+ * All rights reserved.
+ *
+ * This code has been donated to The NetBSD Foundation by the Author.
+ *
+ * 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ *
+ *
+ */
+
+#ifndef FORM_H
+#define FORM_H 1
+#include <sys/queue.h>
+#include <stdarg.h>
+#include <curses.h>
+#include <eti.h>
+
+/* Define the types of field justification that can be used. */
+#define NO_JUSTIFICATION  (0)
+#define JUSTIFY_RIGHT     (1)
+#define JUSTIFY_LEFT      (2)
+#define JUSTIFY_CENTER    (3)
+
+/* Define the max and min valid justification styles for range checking */
+#define MIN_JUST_STYLE    NO_JUSTIFICATION
+#define MAX_JUST_STYLE    JUSTIFY_CENTER
+
+/* Options for the fields */
+typedef unsigned int Form_Options;
+
+/* form options */
+#define O_BS_OVERLOAD (0x001)
+#define O_NL_OVERLOAD (0x002)
+
+/* field options */
+#define O_VISIBLE  (0x001)  /* Field is visible */
+#define O_ACTIVE   (0x002)  /* Field is active in the form */
+#define O_PUBLIC   (0x004)  /* The contents entered into the field is echoed */
+#define O_EDIT     (0x008)  /* Can edit the field */
+#define O_WRAP     (0x010)  /* The field contents can line wrap */
+#define O_BLANK    (0x020)  /* Blank the field on modification */
+#define O_AUTOSKIP (0x040)  /* Skip to next field when current is full */
+#define O_NULLOK   (0x080)  /* Field is allowed to contain no data */
+#define O_STATIC   (0x100)  /* Field is not dynamic */
+#define O_PASSOK   (0x200)  /* An umodified field is OK */
+#define O_REFORMAT (0x400)  /* Insert newlines at linebreaks on buffer get */
+
+/*
+ * Form driver requests - be VERY careful about changing the ordering
+ * of the requests below.  The form driver code depends on a particular
+ * order for the requests.
+ */
+#define REQ_MIN_REQUEST   (KEY_MAX + 0x101) /* must equal value of the
+                                               first request */
+
+#define REQ_NEXT_PAGE     (KEY_MAX + 0x101) /* next page in form */
+#define REQ_PREV_PAGE     (KEY_MAX + 0x102) /* previous page in form */
+#define REQ_FIRST_PAGE    (KEY_MAX + 0x103) /* goto first page in form */
+#define REQ_LAST_PAGE     (KEY_MAX + 0x104) /* goto last page in form */
+
+#define REQ_NEXT_FIELD    (KEY_MAX + 0x105) /* move to the next field */
+#define REQ_PREV_FIELD    (KEY_MAX + 0x106) /* move to the previous field */
+#define REQ_FIRST_FIELD   (KEY_MAX + 0x107) /* goto the first field */
+#define REQ_LAST_FIELD    (KEY_MAX + 0x108) /* goto the last field */
+
+#define REQ_SNEXT_FIELD   (KEY_MAX + 0x109) /* move to the next field
+                                               in sorted order */
+#define REQ_SPREV_FIELD   (KEY_MAX + 0x10a) /* move to the prev field
+                                               in sorted order */
+#define REQ_SFIRST_FIELD  (KEY_MAX + 0x10b) /* move to the first
+                                               sorted field */
+#define REQ_SLAST_FIELD   (KEY_MAX + 0x10c) /* move to the last sorted
+                                               field */
+
+#define REQ_LEFT_FIELD    (KEY_MAX + 0x10d) /* go left one field */
+#define REQ_RIGHT_FIELD   (KEY_MAX + 0x10e) /* go right one field */
+#define REQ_UP_FIELD      (KEY_MAX + 0x10f) /* go up one field */
+#define REQ_DOWN_FIELD    (KEY_MAX + 0x110) /* go down one field */
+
+#define REQ_NEXT_CHAR     (KEY_MAX + 0x111) /* move to the next char
+                                               in field */
+#define REQ_PREV_CHAR     (KEY_MAX + 0x112) /* move to the previous
+                                               char in field */
+#define REQ_NEXT_LINE     (KEY_MAX + 0x113) /* go to the next line in
+                                               the field */
+#define REQ_PREV_LINE     (KEY_MAX + 0x114) /* go to the previous line
+                                               in the field */
+#define REQ_NEXT_WORD     (KEY_MAX + 0x115) /* go to the next word in
+                                               the field */
+#define REQ_PREV_WORD     (KEY_MAX + 0x116) /* go to the previous word
+                                               in the field */
+#define REQ_BEG_FIELD     (KEY_MAX + 0x117) /* go to the beginning of
+                                               the field */
+#define REQ_END_FIELD     (KEY_MAX + 0x118) /* go to the end of the field */
+#define REQ_BEG_LINE      (KEY_MAX + 0x119) /* go to the beginning of
+                                               the line */
+#define REQ_END_LINE      (KEY_MAX + 0x11a) /* go to the end of the
+                                               line */
+#define REQ_LEFT_CHAR     (KEY_MAX + 0x11b) /* move left in the field */
+#define REQ_RIGHT_CHAR    (KEY_MAX + 0x11c) /* move right in the field */
+#define REQ_UP_CHAR       (KEY_MAX + 0x11d) /* move up in the field */
+#define REQ_DOWN_CHAR     (KEY_MAX + 0x11e) /* move down in the field */
+
+#define REQ_NEW_LINE      (KEY_MAX + 0x11f) /* insert/overlay a new line */
+#define REQ_INS_CHAR      (KEY_MAX + 0x120) /* insert a blank char at
+                                               the cursor */
+#define REQ_INS_LINE      (KEY_MAX + 0x121) /* insert a blank line at
+                                               the cursor */
+
+#define REQ_DEL_CHAR      (KEY_MAX + 0x122) /* delete the current character */
+#define REQ_DEL_PREV      (KEY_MAX + 0x123) /* delete the character
+                                               before the current */
+#define REQ_DEL_LINE      (KEY_MAX + 0x124) /* delete the current line */
+#define REQ_DEL_WORD      (KEY_MAX + 0x125) /* delete the word at the cursor */
+#define REQ_CLR_EOL       (KEY_MAX + 0x126) /* clear to the end of the line */
+#define REQ_CLR_EOF       (KEY_MAX + 0x127) /* clear to the end of the field */
+#define REQ_CLR_FIELD     (KEY_MAX + 0x128) /* clear the field */
+
+#define REQ_OVL_MODE      (KEY_MAX + 0x129) /* overlay mode */
+#define REQ_INS_MODE      (KEY_MAX + 0x12a) /* insert mode */
+
+#define REQ_SCR_FLINE     (KEY_MAX + 0x12b) /* scroll field forward one line */
+#define REQ_SCR_BLINE     (KEY_MAX + 0x12c) /* scroll field backward
+                                               one line */
+#define REQ_SCR_FPAGE     (KEY_MAX + 0x12d) /* scroll field forward one page */
+#define REQ_SCR_BPAGE     (KEY_MAX + 0x12e) /* scroll field backward
+                                               one page */
+#define REQ_SCR_FHPAGE    (KEY_MAX + 0x12f) /* scroll field forward
+                                               half a page */
+#define REQ_SCR_BHPAGE    (KEY_MAX + 0x130) /* scroll field backward
+                                               half a page */
+
+#define REQ_SCR_FCHAR     (KEY_MAX + 0x131) /* horizontal scroll
+                                               forward a character */
+#define REQ_SCR_BCHAR     (KEY_MAX + 0x132) /* horizontal scroll
+                                               backward a character */
+#define REQ_SCR_HFLINE    (KEY_MAX + 0x133) /* horizontal scroll
+                                               forward a line */
+#define REQ_SCR_HBLINE    (KEY_MAX + 0x134) /* horizontal scroll
+                                               backward a line */
+#define REQ_SCR_HFHALF    (KEY_MAX + 0x135) /* horizontal scroll
+                                               forward half a line */
+#define REQ_SCR_HBHALF    (KEY_MAX + 0x136) /* horizontal scroll
+                                               backward half a line */
+
+#define REQ_VALIDATION    (KEY_MAX + 0x137) /* validate the field */
+#define REQ_PREV_CHOICE   (KEY_MAX + 0x138) /* display previous field choice */
+#define REQ_NEXT_CHOICE   (KEY_MAX + 0x139) /* display next field choice */
+
+#define REQ_MAX_COMMAND   (KEY_MAX + 0x139) /* must match the last
+                                               driver command */
+
+/* The following defines are for ncurses compatibility */
+#define MIN_FORM_COMMAND	REQ_MIN_REQUEST
+#define MAX_FORM_COMMAND	REQ_MAX_COMMAND
+
+
+typedef struct _form_string {
+	size_t allocated;
+	unsigned int length;
+	char *string;
+} FORM_STR;
+
+typedef struct _form_field FIELD;
+typedef struct _form_struct FORM;
+typedef struct _form_fieldtype FIELDTYPE;
+
+typedef struct _formi_page_struct _FORMI_PAGE_START;
+typedef struct formi_type_link_struct _FORMI_TYPE_LINK;
+typedef struct _formi_field_lines _FORMI_FIELD_LINES;
+
+
+typedef void (*Form_Hook)(FORM *);
+
+/* definition of a field in the form */
+struct _form_field {
+	unsigned int rows; /* rows in the field */
+	unsigned int cols; /* columns in the field */
+	unsigned int drows; /* dynamic rows */
+	unsigned int dcols; /* dynamic columns */
+	unsigned int max; /* maximum growth */
+	unsigned int form_row; /* starting row in the form subwindow */
+	unsigned int form_col; /* starting column in the form subwindow */
+	unsigned int nrows; /* number of off screen rows */
+	int index; /* index of this field in form fields array. */
+	int nbuf; /* number of buffers associated with this field */
+	int buf0_status; /* set to true if buffer 0 has changed. */
+	int justification; /* justification style of the field */
+	int overlay; /* set to true if field is in overlay mode */
+	_FORMI_FIELD_LINES *cur_line; /* pointer to the current line cursor
+					 is on */
+	unsigned int start_char; /* starting char in string (horiz scroll) */
+	_FORMI_FIELD_LINES *start_line; /* start line in field (vert scroll) */
+	unsigned int row_count; /* number of rows actually used in field */
+	unsigned int row_xpos; /* char offset of cursor in field, not same
+				  as cursor_xpos due to tab expansion */
+	unsigned int cursor_xpos; /* x pos of cursor in field */
+	unsigned int cursor_ypos; /* y pos of cursor in field */
+	short page_break; /* start of a new page on the form if 1 */
+	short page; /* number of the page this field is on */
+	chtype fore; /* character attributes for the foreground */
+	chtype back; /* character attributes for the background */
+	int pad; /* padding character */
+	Form_Options opts; /* options for the field */
+	FORM *parent; /* the form this field is bound to, if any */
+	FIELD *up; /* field above this one */
+	FIELD *down; /* field below this one */
+	FIELD *left; /* field to the left of this one */
+	FIELD *right; /* field to the right of this one */
+	void *userptr;  /* user defined pointer. */
+	FIELD *link; /* used if fields are linked */
+	FIELDTYPE *type; /* type struct for the field */
+	TAILQ_ENTRY(_form_field) glue; /* tail queue glue for sorting fields */
+	char *args; /* args for field type. */
+	_FORMI_FIELD_LINES *alines; /* array of the starts and ends of lines */
+	_FORMI_FIELD_LINES *free; /* list of lines available for reuse */
+	FORM_STR *buffers; /* array of buffers for the field */
+};
+
+/* define the types of fields we can have */
+extern FIELDTYPE *TYPE_ALNUM;
+extern FIELDTYPE *TYPE_ALPHA;
+extern FIELDTYPE *TYPE_ENUM;
+extern FIELDTYPE *TYPE_INTEGER;
+extern FIELDTYPE *TYPE_NUMERIC;
+extern FIELDTYPE *TYPE_REGEXP;
+extern FIELDTYPE *TYPE_IPV4;
+extern FIELDTYPE *TYPE_IPV6;
+extern FIELDTYPE *TYPE_USER;
+
+/* definition of a field type. */
+struct _form_fieldtype {
+	unsigned flags; /* status of the type */
+	unsigned refcount; /* in use if > 0 */
+	_FORMI_TYPE_LINK *link; /* set if this type is linked */
+
+	char * (*make_args)(va_list *); /* make the args for the type */
+	char * (*copy_args)(char *); /* copy the args for the type */
+	void (*free_args)(char *); /* free storage used by the args */
+	int (*field_check)(FIELD *, char *); /* field validation routine */
+	int (*char_check)(int, char *); /* char validation routine */
+	int (*next_choice)(FIELD *, char *); /* function to select next
+						choice */
+	int (*prev_choice)(FIELD *, char *); /* function to select prev
+						choice */
+};
+	
+/*definition of a form */
+
+struct _form_struct {
+	int in_init; /* true if performing a init or term function */
+	int posted; /* the form is posted */
+	int wrap; /* wrap from last field to first field if true */
+	WINDOW *win; /* window for the form */
+	WINDOW *subwin; /* subwindow for the form */
+	WINDOW *scrwin; /* this is the window to use for output */
+	void *userptr; /* user defined pointer */
+	Form_Options opts; /* options for the form */
+	Form_Hook form_init; /* function called when form posted and
+				after page change */
+	Form_Hook form_term; /* function called when form is unposted and
+				before page change */
+	Form_Hook field_init; /* function called when form posted and after
+				 current field changes */
+	Form_Hook field_term; /* function called when form unposted and
+				 before current field changes */
+	int field_count; /* number of fields attached */
+	int cur_field; /* current field */
+	int page; /* current page of form */
+	int max_page; /* number of pages in the form */
+	_FORMI_PAGE_START *page_starts; /* dynamic array of fields that start
+					   the pages */
+	TAILQ_HEAD(_formi_sort_head, _form_field) sorted_fields; /* sorted field
+								list */
+	FIELD **fields; /* array of fields attached to this form. */
+};
+
+/* Public function prototypes. */
+__BEGIN_DECLS
+
+FIELD       *current_field(FORM *);
+int          data_ahead(FORM *);
+int          data_behind(FORM *);
+FIELD       *dup_field(FIELD *, int, int);
+int          dynamic_field_info(FIELD *, int *, int *, int *);
+char        *field_arg(FIELD *);
+chtype       field_back(FIELD *);
+char        *field_buffer(FIELD *, int);
+int          field_count(FORM *);
+chtype       field_fore(FIELD *);
+int          field_index(FIELD *);
+int          field_info(FIELD *, int *, int *, int *, int *, int *, int *);
+Form_Hook    field_init(FORM *);
+int          field_just(FIELD *);
+Form_Options field_opts(FIELD *);
+int          field_opts_off(FIELD *, Form_Options);
+int          field_opts_on(FIELD *, Form_Options);
+int          field_pad(FIELD *);
+int          field_status(FIELD *);
+Form_Hook    field_term(FORM *);
+FIELDTYPE   *field_type(FIELD *);
+void        *field_userptr(FIELD *);
+int          form_driver(FORM *, int);
+FIELD      **form_fields(FORM *);
+Form_Hook    form_init(FORM *);
+int          form_max_page(FORM *);
+Form_Options form_opts(FORM *);
+int          form_opts_off(FORM *, Form_Options);
+int          form_opts_on(FORM *, Form_Options);
+int          form_page(FORM *);
+WINDOW      *form_sub(FORM *);
+Form_Hook    form_term(FORM *);
+void        *form_userptr(FORM *);
+WINDOW      *form_win(FORM *);
+int          free_field(FIELD *);
+int          free_fieldtype(FIELDTYPE *);
+int          free_form(FORM *);
+FIELD       *link_field(FIELD *, int, int);
+FIELDTYPE   *link_fieldtype(FIELDTYPE *, FIELDTYPE *);
+int          move_field(FIELD *, int, int);
+FIELD       *new_field(int, int, int, int, int, int);
+FIELDTYPE   *new_fieldtype(int (* field_check)(FIELD *, char *),
+			   int (* char_check)(int, char *));
+FORM        *new_form(FIELD **);
+int          new_page(FIELD *);
+int          pos_form_cursor(FORM *);
+int          post_form(FORM *);
+int          scale_form(FORM *, int *, int *);
+int          set_current_field(FORM *, FIELD *);
+int          set_field_back(FIELD *, chtype);
+int          set_field_buffer(FIELD *, int, const char *);
+int          set_field_fore(FIELD *, chtype);
+int          set_field_init(FORM *, Form_Hook);
+int          set_field_just(FIELD *, int);
+int          set_field_opts(FIELD *, Form_Options);
+int          set_field_pad(FIELD *, int);
+int          set_field_printf(FIELD *, int, char *, ...) __printflike(3, 4);
+int          set_field_status(FIELD *, int);
+int          set_field_term(FORM *, Form_Hook);
+int          set_field_type(FIELD *, FIELDTYPE *, ...);
+int          set_field_userptr(FIELD *, void *);
+int          set_fieldtype_arg(FIELDTYPE *, char *(*)(va_list *),
+			       char *(*)(char *),
+			       void (*)(char *));
+int          set_fieldtype_choice(FIELDTYPE *, int (*)(FIELD *, char *),
+				  int (*)(FIELD *, char *));
+int          set_form_fields(FORM *, FIELD **);
+int          set_form_init(FORM *, Form_Hook);
+int          set_form_opts(FORM *, Form_Options);
+int          set_form_page(FORM *, int);
+int          set_form_sub(FORM *, WINDOW *);
+int          set_form_term(FORM *, Form_Hook);
+int          set_form_userptr(FORM *, void *);
+int          set_form_win(FORM *, WINDOW *);
+int          set_max_field(FIELD *, int);
+int          set_new_page(FIELD *, int);
+int          unpost_form(FORM *);
+
+__END_DECLS
+
+#endif /* FORM_H */

Property changes on: lab4/.minix-src/include/form.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fuse.h
===================================================================
--- lab4/.minix-src/include/fuse.h	(nonexistent)
+++ lab4/.minix-src/include/fuse.h	(revision 13)
@@ -0,0 +1,193 @@
+/* $NetBSD: fuse.h,v 1.21 2008/08/01 15:54:09 dillo Exp $ */
+
+/*
+ * Copyright � 2007 Alistair Crooks.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * 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.
+ */
+#ifndef FUSE_H_
+#define FUSE_H_	20070123
+
+/* set the default version to use for the fuse interface */
+/* this value determines the API to be used */
+#ifndef FUSE_USE_VERSION
+#define FUSE_USE_VERSION	26
+#endif
+
+#include <sys/types.h>
+
+#include <puffs.h>
+#include <utime.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct fuse;
+struct fuse_args; /* XXXsupportme */
+
+struct fuse_file_info {
+	int32_t		flags;
+	uint32_t	fh_old;
+	int32_t		writepage;
+	uint32_t	direct_io:1;
+	uint32_t	keep_cache:1;
+	uint32_t	flush:1;
+	uint32_t	padding:29;
+	uint64_t	fh;
+	uint64_t	lock_owner;
+};
+
+struct fuse_conn_info {
+	uint32_t proto_major;
+	uint32_t proto_minor;
+	uint32_t async_read;
+	uint32_t max_write;
+	uint32_t max_readahead;
+	uint32_t reserved[27];
+};
+
+/* equivalent'ish of puffs_cc */
+struct fuse_context {
+	struct fuse	*fuse;
+	uid_t		uid;
+	gid_t		gid;
+	pid_t		pid;
+	void		*private_data;
+};
+
+/**
+ * Argument list
+ */
+struct fuse_args {
+	int	argc;
+	char	**argv;
+	int	allocated;
+};
+
+/**
+ * Initializer for 'struct fuse_args'
+ */
+#define FUSE_ARGS_INIT(argc, argv) { argc, argv, 0 }
+
+typedef struct puffs_fuse_dirh *fuse_dirh_t;
+
+typedef int (*fuse_fill_dir_t)(void *, const char *, const struct stat *, off_t);
+typedef int (*fuse_dirfil_t)(fuse_dirh_t, const char *, int, ino_t);
+
+#define FUSE_VERSION	26
+#define FUSE_MAJOR_VERSION	2
+#define FUSE_MINOR_VERSION	6
+
+/*
+ * These operations shadow those in puffs_usermount, and are used
+ * as a table of callbacks to make when file system requests come
+ * in.
+ *
+ * NOTE: keep same order as fuse
+ */
+struct fuse_operations {
+	int	(*getattr)(const char *, struct stat *);
+	int	(*readlink)(const char *, char *, size_t);
+	int	(*getdir)(const char *, fuse_dirh_t, fuse_dirfil_t);
+	int	(*mknod)(const char *, mode_t, dev_t);
+	int	(*mkdir)(const char *, mode_t);
+	int	(*unlink)(const char *);
+	int	(*rmdir)(const char *);
+	int	(*symlink)(const char *, const char *);
+	int	(*rename)(const char *, const char *);
+	int	(*link)(const char *, const char *);
+	int	(*chmod)(const char *, mode_t);
+	int	(*chown)(const char *, uid_t, gid_t);
+	int	(*truncate)(const char *, off_t);
+	int	(*utime)(const char *, struct utimbuf *);
+	int	(*open)(const char *, struct fuse_file_info *);
+	int	(*read)(const char *, char *, size_t, off_t, struct fuse_file_info *);
+	int	(*write)(const char *, const char *, size_t, off_t, struct fuse_file_info *);
+	int	(*statfs)(const char *, struct statvfs *);
+	int	(*flush)(const char *, struct fuse_file_info *);
+	int	(*release)(const char *, struct fuse_file_info *);
+	int	(*fsync)(const char *, int, struct fuse_file_info *);
+	int	(*setxattr)(const char *, const char *, const char *, size_t, int);
+	int	(*getxattr)(const char *, const char *, char *, size_t);
+	int	(*listxattr)(const char *, char *, size_t);
+	int	(*removexattr)(const char *, const char *);
+	int	(*opendir)(const char *, struct fuse_file_info *);
+	int	(*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *);
+	int	(*releasedir)(const char *, struct fuse_file_info *);
+	int	(*fsyncdir)(const char *, int, struct fuse_file_info *);
+	void	*(*init)(struct fuse_conn_info *);
+	void	(*destroy)(void *);
+	int	(*access)(const char *, int);
+	int	(*create)(const char *, mode_t, struct fuse_file_info *);
+	int	(*ftruncate)(const char *, off_t, struct fuse_file_info *);
+	int	(*fgetattr)(const char *, struct stat *, struct fuse_file_info *);
+	int	(*lock)(const char *, struct fuse_file_info *, int, struct flock *);
+	int	(*utimens)(const char *, const struct timespec *);
+	int	(*bmap)(const char *, size_t , uint64_t *);
+};
+
+
+struct fuse_chan *fuse_mount(const char *, struct fuse_args *);
+struct fuse *fuse_new(struct fuse_chan *, struct fuse_args *,
+	const struct fuse_operations *, size_t, void *);
+
+int fuse_main_real(int, char **, const struct fuse_operations *, size_t, void *);
+int fuse_loop(struct fuse *);
+struct fuse_context *fuse_get_context(void);
+void fuse_exit(struct fuse *);
+void fuse_destroy(struct fuse *);
+
+void fuse_unmount(const char *, struct fuse_chan *);
+
+struct fuse *fuse_setup(int, char **, const struct fuse_operations *,
+	size_t, char **, int *, int *);
+void fuse_teardown(struct fuse *, char *);
+
+#if FUSE_USE_VERSION == 22
+#define fuse_unmount fuse_unmount_compat22
+#endif
+
+void fuse_unmount_compat22(const char *);
+
+#if FUSE_USE_VERSION >= 26
+#define fuse_main(argc, argv, op, arg) \
+            fuse_main_real(argc, argv, op, sizeof(*(op)), arg)
+#define fuse_setup	fuse_setup26
+#else
+#define fuse_main(argc, argv, op) \
+            fuse_main_real(argc, argv, op, sizeof(*(op)), NULL)
+#endif
+
+struct fuse *fuse_setup26(int, char **, const struct fuse_operations *,
+	size_t, char **, int *, void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <fuse_opt.h>
+
+#endif

Property changes on: lab4/.minix-src/include/fuse.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/getopt.h
===================================================================
--- lab4/.minix-src/include/getopt.h	(nonexistent)
+++ lab4/.minix-src/include/getopt.h	(revision 13)
@@ -0,0 +1,64 @@
+/*	$NetBSD: getopt.h,v 1.11 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dieter Baron and Thomas Klausner.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _GETOPT_H_
+#define _GETOPT_H_
+
+#include <sys/cdefs.h>
+#include <unistd.h>
+
+/*
+ * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
+ */
+#define no_argument        0
+#define required_argument  1
+#define optional_argument  2
+
+struct option {
+	/* name of long option */
+	const char *name;
+	/*
+	 * one of no_argument, required_argument, and optional_argument:
+	 * whether option takes an argument
+	 */
+	int has_arg;
+	/* if not NULL, set *flag to val when option found */
+	int *flag;
+	/* if flag not NULL, value to set *flag to; else return value */
+	int val;
+};
+
+__BEGIN_DECLS
+int getopt_long(int, char * const *, const char *,
+    const struct option *, int *);
+__END_DECLS
+ 
+#endif /* !_GETOPT_H_ */

Property changes on: lab4/.minix-src/include/getopt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/float.h
===================================================================
--- lab4/.minix-src/include/float.h	(nonexistent)
+++ lab4/.minix-src/include/float.h	(revision 13)
@@ -0,0 +1 @@
+machine/float.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/float.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fstab.h
===================================================================
--- lab4/.minix-src/include/fstab.h	(nonexistent)
+++ lab4/.minix-src/include/fstab.h	(revision 13)
@@ -0,0 +1,78 @@
+/*	$NetBSD: fstab.h,v 1.11 2005/02/03 04:39:32 perry Exp $	*/
+
+/*
+ * Copyright (c) 1980, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)fstab.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _FSTAB_H_
+#define _FSTAB_H_
+
+#include <sys/cdefs.h>
+
+/*
+ * File system table, see fstab(5).
+ *
+ * Used by dump, mount, umount, swapon, fsck, df, ...
+ *
+ * For ufs fs_spec field is the block special name.  Programs that want to
+ * use the character special name must create that name by prepending a 'r'
+ * after the right most slash.  Quota files are always named "quotas", so
+ * if type is "rq", then use concatenation of fs_file and "quotas" to locate
+ * quota file.
+ */
+#define	_PATH_FSTAB	"/etc/fstab"
+#define	FSTAB		"/etc/fstab"	/* deprecated */
+
+#define	FSTAB_RW	"rw"		/* read/write device */
+#define	FSTAB_RQ	"rq"		/* read/write with quotas */
+#define	FSTAB_RO	"ro"		/* read-only device */
+#define	FSTAB_SW	"sw"		/* swap device */
+#define	FSTAB_DP	"dp"		/* dump device */
+#define	FSTAB_XX	"xx"		/* ignore totally */
+
+struct fstab {
+	__aconst char *fs_spec;		/* block special device name */
+	__aconst char *fs_file;		/* file system path prefix */
+	__aconst char *fs_vfstype;	/* File system type, ufs, nfs */
+	__aconst char *fs_mntops;	/* Mount options ala -o */
+	__aconst char *fs_type;		/* FSTAB_* from fs_mntops */
+	int	fs_freq;		/* dump frequency, in days */
+	int	fs_passno;		/* pass number on parallel fsck */
+};
+
+__BEGIN_DECLS
+struct fstab *getfsent(void);
+struct fstab *getfsspec(const char *);
+struct fstab *getfsfile(const char *);
+int setfsent(void);
+void endfsent(void);
+__END_DECLS
+
+#endif /* !_FSTAB_H_ */

Property changes on: lab4/.minix-src/include/fstab.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fuse_opt.h
===================================================================
--- lab4/.minix-src/include/fuse_opt.h	(nonexistent)
+++ lab4/.minix-src/include/fuse_opt.h	(revision 13)
@@ -0,0 +1,70 @@
+/*	$NetBSD: fuse_opt.h,v 1.5 2009/04/19 22:25:29 christos Exp $	*/
+
+/*
+ * Copyright (c) 2007 Alistair Crooks.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * 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.
+ */
+
+#ifndef _FUSE_OPT_H_
+#define _FUSE_OPT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif  
+
+enum {
+	FUSE_OPT_KEY_OPT = -1,
+	FUSE_OPT_KEY_NONOPT = -2,
+	FUSE_OPT_KEY_KEEP = -3,
+	FUSE_OPT_KEY_DISCARD = -4
+};
+
+struct fuse_opt {
+	const char	*templ;
+	int32_t		offset;
+	int32_t		value;
+};
+
+#define FUSE_OPT_KEY(templ, key) { templ, -1U, key }
+#define FUSE_OPT_END { .templ = NULL }
+
+typedef int (*fuse_opt_proc_t)(void *, const char *, int, struct fuse_args *);
+
+
+int fuse_opt_add_arg(struct fuse_args *, const char *);
+struct fuse_args *fuse_opt_deep_copy_args(int, char **);
+void fuse_opt_free_args(struct fuse_args *);
+int fuse_opt_insert_arg(struct fuse_args *, int, const char *);
+int fuse_opt_add_opt(char **, const char *);
+int fuse_opt_parse(struct fuse_args *, void *,
+		   const struct fuse_opt *, fuse_opt_proc_t);
+int fuse_opt_match(const struct fuse_opt *, const char *);
+
+#ifdef __cplusplus
+}
+#endif 
+
+#endif /* _FUSE_OPT_H_ */

Property changes on: lab4/.minix-src/include/fuse_opt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/quota2.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/quota2.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/quota2.h	(revision 13)
@@ -0,0 +1,127 @@
+/* $NetBSD: quota2.h,v 1.9 2012/02/05 14:19:04 dholland Exp $ */
+/*-
+  * Copyright (c) 2010 Manuel Bouyer
+  * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  * POSSIBILITY OF SUCH DAMAGE.
+  */
+
+#ifndef _UFS_UFS_QUOTA2_H_
+#define _UFS_UFS_QUOTA2_H_
+#include <ufs/ufs/quota.h>
+
+
+/* New disk quota implementation. In this implementation, the quota datas
+ * (default values, user limits and current usage) are part of the filesystem
+ * metadata. On FFS, this will be in a hidden, unlinked inode. fsck_ffs is
+ * responsible for checking quotas with the rest of the filesystem integrity,
+ * and quotas metadata are also covered by the filesystem journal if any.
+ * quota enable/disable is done on a filesystem basis via flags in the
+ * superblock
+ */
+
+/*
+ * The quota file is comprised of 2 parts, the header and the entries.
+ * The header contains global informations, and head of list of quota entries.
+ * A quota entry can either be in the free list, or one of the hash lists.
+ */
+
+/* description of a block or inode quota */
+struct quota2_val {
+	uint64_t q2v_hardlimit; /* absolute limit */
+	uint64_t q2v_softlimit; /* overflowable limit */
+	uint64_t q2v_cur; /* current usage */
+	int64_t q2v_time; /* grace expiration date for softlimit overflow */
+	int64_t q2v_grace; /* allowed time for softlimit overflow */
+};
+
+/*
+ * On-disk description of a user or group quota
+ * These entries are keept as linked list, either in one of the hash HEAD,
+ * or in the free list.
+ */
+
+#define N_QL 2
+#define QL_BLOCK 0
+#define QL_FILE 1
+#define INITQLNAMES { \
+	[QL_BLOCK] = "block",	\
+	[QL_FILE] =  "file",	\
+}
+
+struct quota2_entry {
+	/* block & inode limits and status */
+	struct quota2_val q2e_val[N_QL];
+	/* pointer to next entry for this list (offset in the file) */
+	uint64_t q2e_next;
+	/* ownership information */
+	uint32_t q2e_uid;
+	uint32_t q2e_pad;
+};
+
+/* header present at the start of the quota file */
+struct quota2_header {
+	uint32_t q2h_magic_number;
+	uint8_t  q2h_type; /* quota type, see below */
+	uint8_t  q2h_hash_shift; /* bytes used for hash index */
+	uint16_t q2h_hash_size; /* size of hash table */
+	/* default values applied to new entries */
+	struct quota2_entry q2h_defentry;
+	/* head of free quota2_entry list */
+	uint64_t q2h_free;
+	/* variable-sized hash table */
+	uint64_t q2h_entries[0];
+};
+
+#define Q2_HEAD_MAGIC	0xb746915e
+
+/* superblock flags */
+#define FS_Q2_DO_TYPE(type)	(0x01 << (type))
+
+#define off2qindex(hsize, off) (((off) - (hsize)) / sizeof(struct quota2_entry))
+#define qindex2off(hsize, idx) \
+	((daddr_t)(idx) * sizeof(struct quota2_entry) + (hsize))
+
+/* quota2_subr.c */
+void quota2_addfreeq2e(struct quota2_header *, void *, uint64_t, uint64_t, int);
+void quota2_create_blk0(uint64_t, void *bp, int, int, int);
+void quota2_ufs_rwq2v(const struct quota2_val *, struct quota2_val *, int);
+void quota2_ufs_rwq2e(const struct quota2_entry *, struct quota2_entry *, int);
+
+/*
+ * Return codes for quota_check_limit()
+ */
+
+#define QL_S_ALLOW_OK	0x00 /* below soft limit */
+#define QL_S_ALLOW_SOFT	0x01 /* over soft limit */
+#define QL_S_DENY_GRACE	0x02 /* over soft limit, grace time expired */
+#define QL_S_DENY_HARD	0x03 /* over hard limit */
+ 
+#define QL_F_CROSS	0x80 /* crossing soft limit */
+
+#define QL_STATUS(x)	((x) & 0x0f)
+#define QL_FLAGS(x)	((x) & 0xf0)
+
+/* check a quota usage against limits (assumes UFS semantic) */
+int quota_check_limit(uint64_t, uint64_t,  uint64_t, uint64_t, time_t, time_t);
+
+#endif /*  _UFS_UFS_QUOTA2_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/quota2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/glob.h
===================================================================
--- lab4/.minix-src/include/glob.h	(nonexistent)
+++ lab4/.minix-src/include/glob.h	(revision 13)
@@ -0,0 +1,113 @@
+/*	$NetBSD: glob.h,v 1.26 2010/09/06 14:38:56 christos Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)glob.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _GLOB_H_
+#define	_GLOB_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifndef __gl_size_t
+#define __gl_size_t	size_t
+#endif
+#ifndef __gl_stat_t
+#define __gl_stat_t	struct stat
+#endif
+
+typedef struct {
+	__gl_size_t gl_pathc;	/* Count of total paths so far. */
+	__gl_size_t gl_matchc;	/* Count of paths matching pattern. */
+	__gl_size_t gl_offs;	/* Reserved at beginning of gl_pathv. */
+	int gl_flags;		/* Copy of flags parameter to glob. */
+	char **gl_pathv;	/* List of paths matching pattern. */
+				/* Copy of errfunc parameter to glob. */
+	int (*gl_errfunc)(const char *, int);
+
+	/*
+	 * Alternate filesystem access methods for glob; replacement
+	 * versions of closedir(3), readdir(3), opendir(3), stat(2)
+	 * and lstat(2).
+	 */
+	void (*gl_closedir)(void *);
+	struct dirent *(*gl_readdir)(void *);	
+	void *(*gl_opendir)(const char *);
+	int (*gl_lstat)(const char *, __gl_stat_t *);
+	int (*gl_stat)(const char *, __gl_stat_t *);
+} glob_t;
+
+#define	GLOB_APPEND	0x0001	/* Append to output from previous call. */
+#define	GLOB_DOOFFS	0x0002	/* Use gl_offs. */
+#define	GLOB_ERR	0x0004	/* Return on error. */
+#define	GLOB_MARK	0x0008	/* Append / to matching directories. */
+#define	GLOB_NOCHECK	0x0010	/* Return pattern itself if nothing matches. */
+#define	GLOB_NOSORT	0x0020	/* Don't sort. */
+#define	GLOB_NOESCAPE	0x1000	/* Disable backslash escaping. */
+
+#define	GLOB_NOSPACE	(-1)	/* Malloc call failed. */
+#define	GLOB_ABORTED	(-2)	/* Unignored error. */
+#define	GLOB_NOMATCH	(-3)	/* No match, and GLOB_NOCHECK was not set. */
+#define	GLOB_NOSYS	(-4)	/* Implementation does not support function. */
+
+#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
+#define	GLOB_ALTDIRFUNC	0x0040	/* Use alternately specified directory funcs. */
+#define	GLOB_BRACE	0x0080	/* Expand braces ala csh. */
+#define	GLOB_MAGCHAR	0x0100	/* Pattern had globbing characters. */
+#define	GLOB_NOMAGIC	0x0200	/* GLOB_NOCHECK without magic chars (csh). */
+#define	GLOB_LIMIT	0x0400	/* Limit memory used by matches to ARG_MAX */
+#define	GLOB_TILDE	0x0800	/* Expand tilde names from the passwd file. */
+/*	GLOB_NOESCAPE	0x1000	above */
+#define	GLOB_PERIOD	0x2000	/* Allow metachars to match leading periods. */
+#define	GLOB_NO_DOTDIRS	0x4000	/* Make . and .. vanish from wildcards. */
+#define	GLOB_STAR	0x8000	/* Use glob ** to recurse directories */
+#define	GLOB_QUOTE	0	/* source compatibility */
+
+#define	GLOB_ABEND	GLOB_ABORTED	/* source compatibility */
+#endif
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+int	glob(const char * __restrict, int,
+    int (*)(const char *, int), glob_t * __restrict)	 __RENAME(__glob30);
+void	globfree(glob_t *)				 __RENAME(__globfree30);
+#endif
+#ifdef _NETBSD_SOURCE
+int	glob_pattern_p(const char *, int);
+#endif
+__END_DECLS
+
+#endif /* !_GLOB_H_ */

Property changes on: lab4/.minix-src/include/glob.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/histedit.h
===================================================================
--- lab4/.minix-src/include/histedit.h	(nonexistent)
+++ lab4/.minix-src/include/histedit.h	(revision 13)
@@ -0,0 +1,322 @@
+/*	$NetBSD: histedit.h,v 1.53 2014/06/18 18:12:28 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)histedit.h	8.2 (Berkeley) 1/3/94
+ */
+
+/*
+ * histedit.h: Line editor and history interface.
+ */
+#ifndef _HISTEDIT_H_
+#define	_HISTEDIT_H_
+
+#define	LIBEDIT_MAJOR 2
+#define	LIBEDIT_MINOR 11
+
+#include <sys/types.h>
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * ==== Editing ====
+ */
+
+typedef struct editline EditLine;
+
+/*
+ * For user-defined function interface
+ */
+typedef struct lineinfo {
+	const char	*buffer;
+	const char	*cursor;
+	const char	*lastchar;
+} LineInfo;
+
+/*
+ * EditLine editor function return codes.
+ * For user-defined function interface
+ */
+#define	CC_NORM		0
+#define	CC_NEWLINE	1
+#define	CC_EOF		2
+#define	CC_ARGHACK	3
+#define	CC_REFRESH	4
+#define	CC_CURSOR	5
+#define	CC_ERROR	6
+#define	CC_FATAL	7
+#define	CC_REDISPLAY	8
+#define	CC_REFRESH_BEEP	9
+
+/*
+ * Initialization, cleanup, and resetting
+ */
+EditLine	*el_init(const char *, FILE *, FILE *, FILE *);
+EditLine	*el_init_fd(const char *, FILE *, FILE *, FILE *,
+    int, int, int);
+void		 el_end(EditLine *);
+void		 el_reset(EditLine *);
+
+/*
+ * Get a line, a character or push a string back in the input queue
+ */
+const char	*el_gets(EditLine *, int *);
+int		 el_getc(EditLine *, char *);
+void		 el_push(EditLine *, const char *);
+
+/*
+ * Beep!
+ */
+void		 el_beep(EditLine *);
+
+/*
+ * High level function internals control
+ * Parses argc, argv array and executes builtin editline commands
+ */
+int		 el_parse(EditLine *, int, const char **);
+
+/*
+ * Low level editline access functions
+ */
+int		 el_set(EditLine *, int, ...);
+int		 el_get(EditLine *, int, ...);
+unsigned char	_el_fn_complete(EditLine *, int);
+
+/*
+ * el_set/el_get parameters
+ *
+ * When using el_wset/el_wget (as opposed to el_set/el_get):
+ *   Char is wchar_t, otherwise it is char.
+ *   prompt_func is el_wpfunc_t, otherwise it is el_pfunc_t .
+
+ * Prompt function prototypes are:
+ *   typedef char    *(*el_pfunct_t)  (EditLine *);
+ *   typedef wchar_t *(*el_wpfunct_t) (EditLine *);
+ *
+ * For operations that support set or set/get, the argument types listed are for
+ * the "set" operation. For "get", each listed type must be a pointer.
+ * E.g. EL_EDITMODE takes an int when set, but an int* when get.
+ * 
+ * Operations that only support "get" have the correct argument types listed.
+ */
+#define	EL_PROMPT	0	/* , prompt_func);		      set/get */
+#define	EL_TERMINAL	1	/* , const char *);		      set/get */
+#define	EL_EDITOR	2	/* , const Char *);		      set/get */
+#define	EL_SIGNAL	3	/* , int);			      set/get */
+#define	EL_BIND		4	/* , const Char *, ..., NULL);	      set     */
+#define	EL_TELLTC	5	/* , const Char *, ..., NULL);	      set     */
+#define	EL_SETTC	6	/* , const Char *, ..., NULL);	      set     */
+#define	EL_ECHOTC	7	/* , const Char *, ..., NULL);        set     */
+#define	EL_SETTY	8	/* , const Char *, ..., NULL);        set     */
+#define	EL_ADDFN	9	/* , const Char *, const Char,        set     */
+				/*   el_func_t);		 	      */
+#define	EL_HIST		10	/* , hist_fun_t, const void *);	      set     */
+#define	EL_EDITMODE	11	/* , int);			      set/get */
+#define	EL_RPROMPT	12	/* , prompt_func);		      set/get */
+#define	EL_GETCFN	13	/* , el_rfunc_t);		      set/get */
+#define	EL_CLIENTDATA	14	/* , void *);			      set/get */
+#define	EL_UNBUFFERED	15	/* , int);			      set/get */
+#define	EL_PREP_TERM	16	/* , int);			      set     */
+#define	EL_GETTC	17	/* , const Char *, ..., NULL);		  get */
+#define	EL_GETFP	18	/* , int, FILE **);		          get */
+#define	EL_SETFP	19	/* , int, FILE *);		      set     */
+#define	EL_REFRESH	20	/* , void);			      set     */
+#define	EL_PROMPT_ESC	21	/* , prompt_func, Char);	      set/get */
+#define	EL_RPROMPT_ESC	22	/* , prompt_func, Char);	      set/get */
+#define	EL_RESIZE	23	/* , el_zfunc_t, void *);	      set     */
+#define	EL_ALIAS_TEXT	24	/* , el_afunc_t, void *);	      set     */
+
+#define	EL_BUILTIN_GETCFN	(NULL)
+
+/*
+ * Source named file or $PWD/.editrc or $HOME/.editrc
+ */
+int		el_source(EditLine *, const char *);
+
+/*
+ * Must be called when the terminal changes size; If EL_SIGNAL
+ * is set this is done automatically otherwise it is the responsibility
+ * of the application
+ */
+void		 el_resize(EditLine *);
+
+/*
+ * User-defined function interface.
+ */
+const LineInfo	*el_line(EditLine *);
+int		 el_insertstr(EditLine *, const char *);
+void		 el_deletestr(EditLine *, int);
+
+
+/*
+ * ==== History ====
+ */
+
+typedef struct history History;
+
+typedef struct HistEvent {
+	int		 num;
+	const char	*str;
+} HistEvent;
+
+/*
+ * History access functions.
+ */
+History *	history_init(void);
+void		history_end(History *);
+
+int		history(History *, HistEvent *, int, ...);
+
+#define	H_FUNC		 0	/* , UTSL		*/
+#define	H_SETSIZE	 1	/* , const int);	*/
+#define	H_GETSIZE	 2	/* , void);		*/
+#define	H_FIRST		 3	/* , void);		*/
+#define	H_LAST		 4	/* , void);		*/
+#define	H_PREV		 5	/* , void);		*/
+#define	H_NEXT		 6	/* , void);		*/
+#define	H_CURR		 8	/* , const int);	*/
+#define	H_SET		 7	/* , int);		*/
+#define	H_ADD		 9	/* , const wchar_t *);	*/
+#define	H_ENTER		10	/* , const wchar_t *);	*/
+#define	H_APPEND	11	/* , const wchar_t *);	*/
+#define	H_END		12	/* , void);		*/
+#define	H_NEXT_STR	13	/* , const wchar_t *);	*/
+#define	H_PREV_STR	14	/* , const wchar_t *);	*/
+#define	H_NEXT_EVENT	15	/* , const int);	*/
+#define	H_PREV_EVENT	16	/* , const int);	*/
+#define	H_LOAD		17	/* , const char *);	*/
+#define	H_SAVE		18	/* , const char *);	*/
+#define	H_CLEAR		19	/* , void);		*/
+#define	H_SETUNIQUE	20	/* , int);		*/
+#define	H_GETUNIQUE	21	/* , void);		*/
+#define	H_DEL		22	/* , int);		*/
+#define	H_NEXT_EVDATA	23	/* , const int, histdata_t *);	*/
+#define	H_DELDATA	24	/* , int, histdata_t *);*/
+#define	H_REPLACE	25	/* , const char *, histdata_t);	*/
+#define	H_SAVE_FP	26	/* , FILE *);		*/
+
+
+
+/*
+ * ==== Tokenization ====
+ */
+
+typedef struct tokenizer Tokenizer;
+
+/*
+ * String tokenization functions, using simplified sh(1) quoting rules
+ */
+Tokenizer	*tok_init(const char *);
+void		 tok_end(Tokenizer *);
+void		 tok_reset(Tokenizer *);
+int		 tok_line(Tokenizer *, const LineInfo *,
+		    int *, const char ***, int *, int *);
+int		 tok_str(Tokenizer *, const char *,
+		    int *, const char ***);
+
+/*
+ * Begin Wide Character Support
+ */
+#ifdef __linux__
+/* Apparently we need _GNU_SOURCE defined to get access to wcsdup on Linux */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#endif
+
+#include <wchar.h>
+#include <wctype.h>
+
+/*
+ * Wide character versions
+ */
+
+/*
+ * ==== Editing ====
+ */
+typedef struct lineinfow {
+	const wchar_t	*buffer;
+	const wchar_t	*cursor;
+	const wchar_t	*lastchar;
+} LineInfoW;
+
+const wchar_t	*el_wgets(EditLine *, int *);
+int		 el_wgetc(EditLine *, wchar_t *);
+void		 el_wpush(EditLine *, const wchar_t *);
+
+int		 el_wparse(EditLine *, int, const wchar_t **);
+
+int		 el_wset(EditLine *, int, ...);
+int		 el_wget(EditLine *, int, ...);
+
+int		 el_cursor(EditLine *, int);
+const LineInfoW	*el_wline(EditLine *);
+int		 el_winsertstr(EditLine *, const wchar_t *);
+#define          el_wdeletestr  el_deletestr
+
+/*
+ * ==== History ====
+ */
+typedef struct histeventW {
+	int		 num;
+	const wchar_t	*str;
+} HistEventW;
+
+typedef struct historyW HistoryW;
+
+HistoryW *	history_winit(void);
+void		history_wend(HistoryW *);
+
+int		history_w(HistoryW *, HistEventW *, int, ...);
+
+/*
+ * ==== Tokenization ====
+ */
+typedef struct tokenizerW TokenizerW;
+
+/* Wide character tokenizer support */
+TokenizerW	*tok_winit(const wchar_t *);
+void		 tok_wend(TokenizerW *);
+void		 tok_wreset(TokenizerW *);
+int		 tok_wline(TokenizerW *, const LineInfoW *,
+		    int *, const wchar_t ***, int *, int *);
+int		 tok_wstr(TokenizerW *, const wchar_t *,
+		    int *, const wchar_t ***);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _HISTEDIT_H_ */

Property changes on: lab4/.minix-src/include/histedit.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/grp.h
===================================================================
--- lab4/.minix-src/include/grp.h	(nonexistent)
+++ lab4/.minix-src/include/grp.h	(revision 13)
@@ -0,0 +1,84 @@
+/*	$NetBSD: grp.h,v 1.24 2007/10/19 15:58:52 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)grp.h	8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _GRP_H_
+#define	_GRP_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+#if defined(_NETBSD_SOURCE)
+#define	_PATH_GROUP		"/etc/group"
+#endif
+
+struct group {
+	__aconst char *gr_name;			/* group name */
+	__aconst char *gr_passwd;		/* group password */
+	gid_t	gr_gid;				/* group id */
+	__aconst char *__aconst *gr_mem;	/* group members */
+};
+
+__BEGIN_DECLS
+struct group	*getgrgid(gid_t);
+struct group	*getgrnam(const char *);
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+int		 getgrgid_r(gid_t, struct group *, char *, size_t,
+				struct group **);
+int		 getgrnam_r(const char *, struct group *, char *, size_t,
+				struct group **);
+#endif
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+struct group	*getgrent(void);
+void		 setgrent(void);
+void		 endgrent(void);
+#endif
+#if defined(_NETBSD_SOURCE)
+void		 setgrfile(const char *);
+int		 setgroupent(int);
+int		 getgrent_r(struct group *, char *, size_t, struct group **);
+const char	*group_from_gid(gid_t, int);
+int		 gid_from_group(const char *, gid_t *);
+int		 pwcache_groupdb(int (*)(int), void (*)(void),
+				    struct group * (*)(const char *),
+				    struct group * (*)(gid_t));
+#endif
+__END_DECLS
+
+#endif /* !_GRP_H_ */

Property changes on: lab4/.minix-src/include/grp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ufs/ufs/ufsmount.h
===================================================================
--- lab4/.minix-src/include/ufs/ufs/ufsmount.h	(nonexistent)
+++ lab4/.minix-src/include/ufs/ufs/ufsmount.h	(revision 13)
@@ -0,0 +1,205 @@
+/*	$NetBSD: ufsmount.h,v 1.43 2015/03/27 17:27:56 riastradh Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ufsmount.h	8.6 (Berkeley) 3/30/95
+ */
+
+#ifndef _UFS_UFS_UFSMOUNT_H_
+#define _UFS_UFS_UFSMOUNT_H_
+
+#include <sys/mount.h> /* struct export_args30 */
+
+/*
+ * Arguments to mount UFS-based filesystems
+ */
+struct ufs_args {
+	char	*fspec;			/* block special device to mount */
+};
+
+#if !defined(__minix)
+/*
+ * Arguments to mount MFS
+ */
+struct mfs_args {
+	char	*fspec;			/* name to export for statfs */
+	struct	export_args30 _pad1; /* compat with old userland tools */
+	void *	base;			/* base of file system in memory */
+	u_long	size;			/* size of file system */
+};
+#endif /* !defined(__minix) */
+
+#ifdef _KERNEL
+
+#if defined(_KERNEL_OPT)
+#include "opt_ffs.h"
+#endif
+
+#include <sys/mutex.h>
+
+#include <ufs/ufs/extattr.h>
+#include <ufs/ufs/quota.h>
+
+struct buf;
+struct inode;
+struct nameidata;
+struct timeval;
+struct uio;
+struct vnode;
+
+/* This structure describes the UFS specific mount structure data. */
+struct ufsmount {
+	struct	mount *um_mountp;		/* filesystem vfs structure */
+	dev_t	um_dev;				/* device mounted */
+	struct	vnode *um_devvp;		/* block device mounted vnode */
+	u_long	um_fstype;
+	u_int32_t um_flags;			/* UFS-specific flags - see below */
+	union {					/* pointer to superblock */
+		struct	fs *fs;			/* FFS */
+		struct	lfs *lfs;		/* LFS */
+		struct  m_ext2fs *e2fs;		/* EXT2FS */
+		struct  chfs_mount *chfs;	/* CHFS */
+	} ufsmount_u;
+#define	um_fs	ufsmount_u.fs
+#define	um_lfs	ufsmount_u.lfs
+#define um_e2fs	ufsmount_u.e2fs
+#define um_e2fsb ufsmount_u.e2fs->s_es
+#define um_chfs	ufsmount_u.chfs
+
+	/* Extended attribute information. */
+	struct ufs_extattr_per_mount um_extattr;
+
+	struct	vnode *um_quotas[MAXQUOTAS];	/* pointer to quota files */
+	kauth_cred_t   um_cred[MAXQUOTAS];	/* quota file access cred */
+	u_long	um_nindir;			/* indirect ptrs per block */
+	u_long	um_lognindir;			/* log2 of um_nindir */
+	u_long	um_bptrtodb;			/* indir ptr to disk block */
+	u_long	um_seqinc;			/* inc between seq blocks */
+	kmutex_t um_lock;			/* lock on global data */
+	union {
+	    struct um_q1 {
+		time_t	q1_btime[MAXQUOTAS];	/* block quota time limit */
+		time_t	q1_itime[MAXQUOTAS];	/* inode quota time limit */
+		char	q1_qflags[MAXQUOTAS];	/* quota specific flags */
+	    } um_q1;
+	    struct um_q2 {
+		uint64_t q2_bsize;		/* block size of quota file */
+		uint64_t q2_bmask;		/* mask for above */
+	    } um_q2;
+	} um_q;
+#define umq1_btime  um_q.um_q1.q1_btime
+#define umq1_itime  um_q.um_q1.q1_itime
+#define umq1_qflags um_q.um_q1.q1_qflags
+#define umq2_bsize  um_q.um_q2.q2_bsize
+#define umq2_bmask  um_q.um_q2.q2_bmask
+
+	void	*um_oldfscompat;		/* save 4.2 rotbl */
+	int	um_maxsymlinklen;
+	int	um_dirblksiz;
+	u_int64_t um_maxfilesize;
+	void	*um_snapinfo;			/* snapshot private data */
+
+	const struct ufs_ops *um_ops;
+
+	void *um_discarddata;
+};
+
+struct ufs_ops {
+	void (*uo_itimes)(struct inode *ip, const struct timespec *,
+	    const struct timespec *, const struct timespec *);
+	int (*uo_update)(struct vnode *, const struct timespec *,
+	    const struct timespec *, int);
+	int (*uo_truncate)(struct vnode *, off_t, int, kauth_cred_t);
+	int (*uo_balloc)(struct vnode *, off_t, int, kauth_cred_t, int,
+	    struct buf **);
+        void (*uo_snapgone)(struct vnode *);
+	int (*uo_bufrd)(struct vnode *, struct uio *, int, kauth_cred_t);
+	int (*uo_bufwr)(struct vnode *, struct uio *, int, kauth_cred_t);
+};
+
+#define	UFS_OPS(vp)	(VFSTOUFS((vp)->v_mount)->um_ops)
+
+#define	UFS_ITIMES(vp, acc, mod, cre) \
+	(*UFS_OPS(vp)->uo_itimes)(VTOI(vp), (acc), (mod), (cre))
+#define	UFS_UPDATE(vp, acc, mod, flags) \
+	(*UFS_OPS(vp)->uo_update)((vp), (acc), (mod), (flags))
+#define	UFS_TRUNCATE(vp, off, flags, cr) \
+	(*UFS_OPS(vp)->uo_truncate)((vp), (off), (flags), (cr))
+#define	UFS_BALLOC(vp, off, size, cr, flags, bpp) \
+	(*UFS_OPS(vp)->uo_balloc)((vp), (off), (size), (cr), (flags), (bpp))
+#define	UFS_SNAPGONE(vp) \
+	(*UFS_OPS(vp)->uo_snapgone)((vp))
+#define	UFS_BUFRD(vp, uio, ioflag, cred) \
+	(*UFS_OPS(vp)->uo_bufrd)((vp), (uio), (ioflag), (cred))
+#define	UFS_BUFWR(vp, uio, ioflag, cred) \
+	(*UFS_OPS(vp)->uo_bufwr)((vp), (uio), (ioflag), (cred))
+
+/* UFS-specific flags */
+#define UFS_NEEDSWAP	0x01	/* filesystem metadata need byte-swapping */
+#define UFS_ISAPPLEUFS	0x02	/* filesystem is Apple UFS */
+#define UFS_QUOTA	0x04	/* filesystem has QUOTA (v1) */
+#define UFS_QUOTA2	0x08	/* filesystem has QUOTA2 */
+
+/*
+ * Filesystem types
+ */
+#define UFS1  1
+#define UFS2  2
+
+
+/*
+ * Flags describing the state of quotas.
+ */
+#define	QTF_OPENING	0x01			/* Q_QUOTAON in progress */
+#define	QTF_CLOSING	0x02			/* Q_QUOTAOFF in progress */
+
+/* Convert mount ptr to ufsmount ptr. */
+#define VFSTOUFS(mp)	((struct ufsmount *)((mp)->mnt_data))
+
+#ifdef APPLE_UFS
+#define UFS_MPISAPPLEUFS(ump)	((ump)->um_flags & UFS_ISAPPLEUFS)
+#else
+#define UFS_MPISAPPLEUFS(ump)	(0)
+#endif
+
+/*
+ * Macros to access file system parameters in the ufsmount structure.
+ * Used by ufs_bmap.
+ */
+#define MNINDIR(ump)			((ump)->um_nindir)
+#define	blkptrtodb(ump, b)		((b) << (ump)->um_bptrtodb)
+
+/*
+ * Predicate for byte-swapping support.
+ */
+#define	FSFMT(vp)	(((vp)->v_mount->mnt_iflag & IMNT_DTYPE) == 0)
+
+#endif /* _KERNEL */
+
+#endif /* !_UFS_UFS_UFSMOUNT_H_ */

Property changes on: lab4/.minix-src/include/ufs/ufs/ufsmount.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/inttypes.h
===================================================================
--- lab4/.minix-src/include/inttypes.h	(nonexistent)
+++ lab4/.minix-src/include/inttypes.h	(revision 13)
@@ -0,0 +1,95 @@
+/*	$NetBSD: inttypes.h,v 1.11 2015/01/16 18:35:59 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _INTTYPES_H_
+#define _INTTYPES_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/inttypes.h>
+#include <machine/ansi.h>
+
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
+typedef	_BSD_WCHAR_T_	wchar_t;
+#undef	_BSD_WCHAR_T_
+#endif
+
+__BEGIN_DECLS
+intmax_t	strtoimax(const char * __restrict,
+		    char ** __restrict, int);
+uintmax_t	strtoumax(const char * __restrict,
+		    char ** __restrict, int);
+intmax_t	wcstoimax(const wchar_t * __restrict,
+		    wchar_t ** __restrict, int);
+uintmax_t	wcstoumax(const wchar_t * __restrict,
+		    wchar_t ** __restrict, int);
+
+intmax_t	imaxabs(intmax_t);
+
+typedef struct {
+	intmax_t quot;
+	intmax_t rem;
+} imaxdiv_t;
+
+imaxdiv_t	imaxdiv(intmax_t, intmax_t);
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+intmax_t	strtoimax_l(const char * __restrict,
+		    char ** __restrict, int, locale_t);
+uintmax_t	strtoumax_l(const char * __restrict,
+		    char ** __restrict, int, locale_t);
+intmax_t	wcstoimax_l(const wchar_t * __restrict,
+		    wchar_t ** __restrict, int, locale_t);
+uintmax_t	wcstoumax_l(const wchar_t * __restrict,
+		    wchar_t ** __restrict, int, locale_t);
+#endif
+
+
+#if defined(_NETBSD_SOURCE)
+intmax_t	strtoi(const char * __restrict, char ** __restrict, int,
+	               intmax_t, intmax_t, int *);
+uintmax_t	strtou(const char * __restrict, char ** __restrict, int,
+	               uintmax_t, uintmax_t, int *);
+
+/* i18n variations */
+intmax_t	strtoi_l(const char * __restrict, char ** __restrict, int,
+	                 intmax_t, intmax_t, int *, locale_t);
+uintmax_t	strtou_l(const char * __restrict, char ** __restrict, int,
+	                 uintmax_t, uintmax_t, int *, locale_t);
+#endif /* defined(_NETBSD_SOURCE) */
+
+__END_DECLS
+
+#endif /* !_INTTYPES_H_ */

Property changes on: lab4/.minix-src/include/inttypes.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ieeefp.h
===================================================================
--- lab4/.minix-src/include/ieeefp.h	(nonexistent)
+++ lab4/.minix-src/include/ieeefp.h	(revision 13)
@@ -0,0 +1,34 @@
+/*	$NetBSD: ieeefp.h,v 1.9 2011/03/27 05:13:15 mrg Exp $	*/
+
+/* 
+ * Written by J.T. Conklin, Apr 6, 1995
+ * Public domain.
+ */
+
+#ifndef _IEEEFP_H_
+#define _IEEEFP_H_
+
+#include <sys/cdefs.h>
+#include <machine/ieeefp.h>
+
+__BEGIN_DECLS
+typedef fp_rnd fp_rnd_t;
+#ifdef _X86_IEEEFP_H_	/* XXX */
+typedef fp_prec fp_prec_t;
+#endif
+typedef fp_except fp_except_t;
+
+fp_rnd_t	fpgetround(void);
+fp_rnd_t	fpsetround(fp_rnd_t);
+#ifdef _X86_IEEEFP_H_	/* XXX */
+fp_prec_t	fpgetprec(void);
+fp_prec_t	fpsetprec(fp_prec_t);
+#endif
+fp_except_t	fpgetmask(void);
+fp_except_t	fpsetmask(fp_except_t);
+fp_except_t	fpgetsticky(void);
+fp_except_t	fpsetsticky(fp_except_t);
+fp_except_t	fpresetsticky(fp_except_t);
+__END_DECLS
+
+#endif /* _IEEEFP_H_ */

Property changes on: lab4/.minix-src/include/ieeefp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/iconv.h
===================================================================
--- lab4/.minix-src/include/iconv.h	(nonexistent)
+++ lab4/.minix-src/include/iconv.h	(revision 13)
@@ -0,0 +1,60 @@
+/*	$NetBSD: iconv.h,v 1.6 2005/02/03 04:39:32 perry Exp $	*/
+
+/*-
+ * Copyright (c)2003 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef _ICONV_H_
+#define _ICONV_H_
+
+#include <sys/cdefs.h>
+#include <machine/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+struct __tag_iconv_t;
+typedef	struct __tag_iconv_t	*iconv_t;
+
+__BEGIN_DECLS
+iconv_t	iconv_open(const char *, const char *);
+size_t	iconv(iconv_t, const char ** __restrict,
+		     size_t * __restrict, char ** __restrict,
+		     size_t * __restrict);
+int	iconv_close(iconv_t);
+/*
+ * non-portable interfaces for iconv
+ */
+int	__iconv_get_list(char ***, size_t *);
+void	__iconv_free_list(char **, size_t);
+size_t	__iconv(iconv_t, const char **, size_t *, char **,
+		     size_t *, __uint32_t, size_t *);
+#define __ICONV_F_HIDE_INVALID	0x0001
+__END_DECLS
+
+#endif /* !_ICONV_H_ */

Property changes on: lab4/.minix-src/include/iconv.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_aobj.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_aobj.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_aobj.h	(revision 13)
@@ -0,0 +1,71 @@
+/*	$NetBSD: uvm_aobj.h,v 1.23 2013/10/18 17:48:44 christos Exp $	*/
+
+/*
+ * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
+ *                    Washington University.
+ * 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.
+ *
+ * from: Id: uvm_aobj.h,v 1.1.2.4 1998/02/06 05:19:28 chs Exp
+ */
+/*
+ * uvm_aobj.h: anonymous memory uvm_object pager
+ *
+ * author: Chuck Silvers <chuq@chuq.com>
+ * started: Jan-1998
+ *
+ * - design mostly from Chuck Cranor
+ */
+
+#ifndef _UVM_UVM_AOBJ_H_
+#define _UVM_UVM_AOBJ_H_
+
+/*
+ * Flags for uao_create: UAO_FLAG_KERNOBJ and UAO_FLAG_KERNSWAP are
+ * used only once, to initialise UVM.
+ */
+#define	UAO_FLAG_KERNOBJ	0x1	/* create kernel object */
+#define	UAO_FLAG_KERNSWAP	0x2	/* enable kernel swap */
+#define	UAO_FLAG_NOSWAP		0x8	/* aobj may not swap */
+
+#ifdef _KERNEL
+#if defined(_KERNEL_OPT)
+#include "opt_vmswap.h"
+#endif
+
+void	uao_init(void);
+int	uao_set_swslot(struct uvm_object *, int, int);
+
+#if	defined(VMSWAP)
+int	uao_find_swslot(struct uvm_object *, int);
+void	uao_dropswap(struct uvm_object *, int);
+bool	uao_swap_off(int, int);
+void	uao_dropswap_range(struct uvm_object *, voff_t, voff_t);
+#else
+#define	uao_find_swslot(obj, off)	(__USE(off), 0)
+#define	uao_dropswap(obj, off)		/* nothing */
+#define	uao_dropswap_range(obj, lo, hi)	/* nothing */
+#endif
+
+#endif /* _KERNEL */
+
+#endif /* _UVM_UVM_AOBJ_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_aobj.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/kvm.h
===================================================================
--- lab4/.minix-src/include/kvm.h	(nonexistent)
+++ lab4/.minix-src/include/kvm.h	(revision 13)
@@ -0,0 +1,89 @@
+/*	$NetBSD: kvm.h,v 1.16 2011/09/12 21:14:29 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)kvm.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _KVM_H_
+#define	_KVM_H_
+
+/* Default version symbol. */
+#define	VRS_SYM		"_version"
+#define	VRS_KEY		"VERSION"
+
+/*
+ * Flag for kvm_open*() to disable opening of kernel files - used
+ * by programs that use only sysctl() function to access kernel
+ * information.
+ */
+#define KVM_NO_FILES	((int)0x80000000)
+
+#include <nlist.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+__BEGIN_DECLS
+
+typedef struct __kvm kvm_t;
+
+struct kinfo_proc;
+struct kinfo_proc2;
+int	  kvm_close(kvm_t *);
+int	  kvm_dump_inval(kvm_t *);
+int	  kvm_dump_mkheader(kvm_t *, off_t);
+int	  kvm_dump_header(kvm_t *, bool (*)(void *, const void *, size_t),
+			  void *, int);
+int	  kvm_dump_wrtheader(kvm_t *, FILE *, int);
+char	**kvm_getargv(kvm_t *, const struct kinfo_proc *, int);
+char	**kvm_getargv2(kvm_t *, const struct kinfo_proc2 *, int);
+char	**kvm_getenvv(kvm_t *, const struct kinfo_proc *, int);
+char	**kvm_getenvv2(kvm_t *, const struct kinfo_proc2 *, int);
+char	 *kvm_geterr(kvm_t *);
+int	  kvm_getloadavg(kvm_t *, double [], int);
+char	 *kvm_getfiles(kvm_t *, int, int, int *);
+struct kinfo_lwp *
+	  kvm_getlwps(kvm_t *, int, u_long, size_t, int *);
+struct kinfo_proc2 *
+	  kvm_getproc2(kvm_t *, int, int, size_t, int *);
+struct kinfo_proc *
+	  kvm_getprocs(kvm_t *, int, int, int *);
+int	  kvm_nlist(kvm_t *, struct nlist *);
+kvm_t	 *kvm_open
+	    (const char *, const char *, const char *, int, const char *);
+kvm_t	 *kvm_openfiles(const char *, const char *, const char *, int, char *);
+ssize_t	  kvm_read(kvm_t *, u_long, void *, size_t);
+ssize_t	  kvm_write(kvm_t *, u_long, const void *, size_t);
+const char *kvm_getkernelname(kvm_t *);
+
+__END_DECLS
+
+#endif /* !_KVM_H_ */

Property changes on: lab4/.minix-src/include/kvm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/iso646.h
===================================================================
--- lab4/.minix-src/include/iso646.h	(nonexistent)
+++ lab4/.minix-src/include/iso646.h	(revision 13)
@@ -0,0 +1,25 @@
+/*	$NetBSD: iso646.h,v 1.2 2013/04/26 10:58:45 joerg Exp $	*/
+
+/* 
+ * Written by J.T. Conklin <jtc@wimsey.com> 02/16/95.
+ * Public domain.
+ */
+
+#ifndef _ISO646_H_
+#define _ISO646_H_
+
+#ifndef __cplusplus
+#define and	&&
+#define and_eq	&=
+#define bitand	&
+#define bitor	|
+#define compl	~
+#define not	!
+#define not_eq	!=
+#define or	||
+#define or_eq	|=
+#define xor	^
+#define xor_eq	^=
+#endif
+
+#endif	/* !_ISO646_H_ */

Property changes on: lab4/.minix-src/include/iso646.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lauxlib.h
===================================================================
--- lab4/.minix-src/include/lauxlib.h	(nonexistent)
+++ lab4/.minix-src/include/lauxlib.h	(revision 13)
@@ -0,0 +1,275 @@
+/*	$NetBSD: lauxlib.h,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+
+/*
+** Id: lauxlib.h,v 1.128 2014/10/29 16:11:17 roberto Exp 
+** Auxiliary functions for building Lua libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lauxlib_h
+#define lauxlib_h
+
+
+#ifndef _KERNEL
+#include <stddef.h>
+#include <stdio.h>
+#endif
+
+#include "lua.h"
+
+
+
+/* extra error code for 'luaL_load' */
+#define LUA_ERRFILE     (LUA_ERRERR+1)
+
+
+typedef struct luaL_Reg {
+  const char *name;
+  lua_CFunction func;
+} luaL_Reg;
+
+
+#define LUAL_NUMSIZES	(sizeof(lua_Integer)*16 + sizeof(lua_Number))
+
+LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz);
+#define luaL_checkversion(L)  \
+	  luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)
+
+LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
+LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
+LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len);
+LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg);
+LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg,
+                                                          size_t *l);
+LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg,
+                                          const char *def, size_t *l);
+LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int arg);
+LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int arg, lua_Number def);
+
+#ifndef _KERNEL
+LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int arg);
+LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int arg,
+                                          lua_Integer def);
+#else /* _KERNEL */
+#define luaL_checkinteger		luaL_checknumber
+#define luaL_optinteger(L,a,d)	luaL_optnumber(L, (a), (lua_Number)(d))
+#endif
+
+LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
+LUALIB_API void (luaL_checktype) (lua_State *L, int arg, int t);
+LUALIB_API void (luaL_checkany) (lua_State *L, int arg);
+
+LUALIB_API int   (luaL_newmetatable) (lua_State *L, const char *tname);
+LUALIB_API void  (luaL_setmetatable) (lua_State *L, const char *tname);
+LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);
+LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
+
+LUALIB_API void (luaL_where) (lua_State *L, int lvl);
+LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
+
+LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def,
+                                   const char *const lst[]);
+
+#ifndef _KERNEL
+LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname);
+LUALIB_API int (luaL_execresult) (lua_State *L, int stat);
+#endif
+
+/* pre-defined references */
+#define LUA_NOREF       (-2)
+#define LUA_REFNIL      (-1)
+
+LUALIB_API int (luaL_ref) (lua_State *L, int t);
+LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
+
+#ifndef _KERNEL
+LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,
+                                               const char *mode);
+
+#define luaL_loadfile(L,f)	luaL_loadfilex(L,f,NULL)
+#endif
+
+LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
+                                   const char *name, const char *mode);
+LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
+
+LUALIB_API lua_State *(luaL_newstate) (void);
+
+LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx);
+
+LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
+                                                  const char *r);
+
+LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
+
+LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname);
+
+LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1,
+                                  const char *msg, int level);
+
+LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
+                                 lua_CFunction openf, int glb);
+
+/*
+** ===============================================================
+** some useful macros
+** ===============================================================
+*/
+
+
+#define luaL_newlibtable(L,l)	\
+  lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
+
+#define luaL_newlib(L,l)  \
+  (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
+
+#define luaL_argcheck(L, cond,arg,extramsg)	\
+		((void)((cond) || luaL_argerror(L, (arg), (extramsg))))
+#define luaL_checkstring(L,n)	(luaL_checklstring(L, (n), NULL))
+#define luaL_optstring(L,n,d)	(luaL_optlstring(L, (n), (d), NULL))
+
+#define luaL_typename(L,i)	lua_typename(L, lua_type(L,(i)))
+
+#ifndef _KERNEL
+#define luaL_dofile(L, fn) \
+	(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
+#endif
+
+#define luaL_dostring(L, s) \
+	(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
+
+#define luaL_getmetatable(L,n)	(lua_getfield(L, LUA_REGISTRYINDEX, (n)))
+
+#define luaL_opt(L,f,n,d)	(lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
+
+#define luaL_loadbuffer(L,s,sz,n)	luaL_loadbufferx(L,s,sz,n,NULL)
+
+
+/*
+** {======================================================
+** Generic Buffer manipulation
+** =======================================================
+*/
+
+typedef struct luaL_Buffer {
+  char *b;  /* buffer address */
+  size_t size;  /* buffer size */
+  size_t n;  /* number of characters in buffer */
+  lua_State *L;
+  char initb[LUAL_BUFFERSIZE];  /* initial buffer */
+} luaL_Buffer;
+
+
+#define luaL_addchar(B,c) \
+  ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \
+   ((B)->b[(B)->n++] = (c)))
+
+#define luaL_addsize(B,s)	((B)->n += (s))
+
+LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
+LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);
+LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
+LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
+LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
+LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
+LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz);
+LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);
+
+#define luaL_prepbuffer(B)	luaL_prepbuffsize(B, LUAL_BUFFERSIZE)
+
+/* }====================================================== */
+
+
+
+#ifndef _KERNEL
+/*
+** {======================================================
+** File handles for IO library
+** =======================================================
+*/
+
+/*
+** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and
+** initial structure 'luaL_Stream' (it may contain other fields
+** after that initial structure).
+*/
+
+#define LUA_FILEHANDLE          "FILE*"
+
+
+typedef struct luaL_Stream {
+  FILE *f;  /* stream (NULL for incompletely created streams) */
+  lua_CFunction closef;  /* to close stream (NULL for closed streams) */
+} luaL_Stream;
+
+/* }====================================================== */
+#endif
+
+
+
+/* compatibility with old module system */
+#if defined(LUA_COMPAT_MODULE)
+
+LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,
+                                   int sizehint);
+LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,
+                                const luaL_Reg *l, int nup);
+
+#define luaL_register(L,n,l)	(luaL_openlib(L,(n),(l),0))
+
+#endif
+
+
+#ifndef _KERNEL
+/*
+** {==================================================================
+** "Abstraction Layer" for basic report of messages and errors
+** ===================================================================
+*/
+
+/* print a string */
+#if !defined(lua_writestring)
+#define lua_writestring(s,l)   fwrite((s), sizeof(char), (l), stdout)
+#endif
+
+/* print a newline and flush the output */
+#if !defined(lua_writeline)
+#define lua_writeline()        (lua_writestring("\n", 1), fflush(stdout))
+#endif
+
+/* print an error message */
+#if !defined(lua_writestringerror)
+#define lua_writestringerror(s,p) \
+        (fprintf(stderr, (s), (p)), fflush(stderr))
+#endif
+
+/* }================================================================== */
+#endif
+
+
+/*
+** {============================================================
+** Compatibility with deprecated conversions
+** =============================================================
+*/
+#if defined(LUA_COMPAT_APIINTCASTS)
+
+#define luaL_checkunsigned(L,a)	((lua_Unsigned)luaL_checkinteger(L,a))
+#define luaL_optunsigned(L,a,d)	\
+	((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d)))
+
+#define luaL_checkint(L,n)	((int)luaL_checkinteger(L, (n)))
+#define luaL_optint(L,n,d)	((int)luaL_optinteger(L, (n), (d)))
+
+#define luaL_checklong(L,n)	((long)luaL_checkinteger(L, (n)))
+#define luaL_optlong(L,n,d)	((long)luaL_optinteger(L, (n), (d)))
+
+#endif
+/* }============================================================ */
+
+
+
+#endif
+
+

Property changes on: lab4/.minix-src/include/lauxlib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_fault_i.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_fault_i.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_fault_i.h	(revision 13)
@@ -0,0 +1,198 @@
+/*	$NetBSD: uvm_fault_i.h,v 1.28 2012/02/19 00:05:56 rmind Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * 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.
+ *
+ * from: Id: uvm_fault_i.h,v 1.1.6.1 1997/12/08 16:07:12 chuck Exp
+ */
+
+#ifndef _UVM_UVM_FAULT_I_H_
+#define _UVM_UVM_FAULT_I_H_
+
+/*
+ * uvm_fault_i.h: fault inline functions
+ */
+
+/*
+ * uvmfault_unlockmaps: unlock the maps
+ */
+
+static inline void
+uvmfault_unlockmaps(struct uvm_faultinfo *ufi, bool write_locked)
+{
+	/*
+	 * ufi can be NULL when this isn't really a fault,
+	 * but merely paging in anon data.
+	 */
+
+	if (ufi == NULL) {
+		return;
+	}
+
+	if (write_locked) {
+		vm_map_unlock(ufi->map);
+	} else {
+		vm_map_unlock_read(ufi->map);
+	}
+}
+
+/*
+ * uvmfault_unlockall: unlock everything passed in.
+ *
+ * => maps must be read-locked (not write-locked).
+ */
+
+static inline void
+uvmfault_unlockall(struct uvm_faultinfo *ufi, struct vm_amap *amap,
+    struct uvm_object *uobj)
+{
+
+	if (uobj)
+		mutex_exit(uobj->vmobjlock);
+	if (amap)
+		amap_unlock(amap);
+	uvmfault_unlockmaps(ufi, false);
+}
+
+/*
+ * uvmfault_lookup: lookup a virtual address in a map
+ *
+ * => caller must provide a uvm_faultinfo structure with the IN
+ *	params properly filled in
+ * => we will lookup the map entry (handling submaps) as we go
+ * => if the lookup is a success we will return with the maps locked
+ * => if "write_lock" is true, we write_lock the map, otherwise we only
+ *	get a read lock.
+ * => note that submaps can only appear in the kernel and they are
+ *	required to use the same virtual addresses as the map they
+ *	are referenced by (thus address translation between the main
+ *	map and the submap is unnecessary).
+ */
+
+static inline bool
+uvmfault_lookup(struct uvm_faultinfo *ufi, bool write_lock)
+{
+	struct vm_map *tmpmap;
+
+	/*
+	 * init ufi values for lookup.
+	 */
+
+	ufi->map = ufi->orig_map;
+	ufi->size = ufi->orig_size;
+
+	/*
+	 * keep going down levels until we are done.   note that there can
+	 * only be two levels so we won't loop very long.
+	 */
+
+	for (;;) {
+		/*
+		 * lock map
+		 */
+		if (write_lock) {
+			vm_map_lock(ufi->map);
+		} else {
+			vm_map_lock_read(ufi->map);
+		}
+
+		/*
+		 * lookup
+		 */
+		if (!uvm_map_lookup_entry(ufi->map, ufi->orig_rvaddr,
+		    &ufi->entry)) {
+			uvmfault_unlockmaps(ufi, write_lock);
+			return(false);
+		}
+
+		/*
+		 * reduce size if necessary
+		 */
+		if (ufi->entry->end - ufi->orig_rvaddr < ufi->size)
+			ufi->size = ufi->entry->end - ufi->orig_rvaddr;
+
+		/*
+		 * submap?    replace map with the submap and lookup again.
+		 * note: VAs in submaps must match VAs in main map.
+		 */
+		if (UVM_ET_ISSUBMAP(ufi->entry)) {
+			tmpmap = ufi->entry->object.sub_map;
+			if (write_lock) {
+				vm_map_unlock(ufi->map);
+			} else {
+				vm_map_unlock_read(ufi->map);
+			}
+			ufi->map = tmpmap;
+			continue;
+		}
+
+		/*
+		 * got it!
+		 */
+
+		ufi->mapv = ufi->map->timestamp;
+		return(true);
+
+	}	/* while loop */
+
+	/*NOTREACHED*/
+}
+
+/*
+ * uvmfault_relock: attempt to relock the same version of the map
+ *
+ * => fault data structures should be unlocked before calling.
+ * => if a success (true) maps will be locked after call.
+ */
+
+static inline bool
+uvmfault_relock(struct uvm_faultinfo *ufi)
+{
+	/*
+	 * ufi can be NULL when this isn't really a fault,
+	 * but merely paging in anon data.
+	 */
+
+	if (ufi == NULL) {
+		return true;
+	}
+
+	uvmexp.fltrelck++;
+
+	/*
+	 * relock map.   fail if version mismatch (in which case nothing
+	 * gets locked).
+	 */
+
+	vm_map_lock_read(ufi->map);
+	if (ufi->mapv != ufi->map->timestamp) {
+		vm_map_unlock_read(ufi->map);
+		return(false);
+	}
+
+	uvmexp.fltrelckok++;
+	return(true);
+}
+
+#endif /* _UVM_UVM_FAULT_I_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_fault_i.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lib.h
===================================================================
--- lab4/.minix-src/include/lib.h	(nonexistent)
+++ lab4/.minix-src/include/lib.h	(revision 13)
@@ -0,0 +1,52 @@
+/* The <lib.h> header is the master header used by the library.
+ * All the C files in the lib subdirectories include it.
+ */
+
+#ifndef _LIB_H
+#define _LIB_H
+
+/* First come the defines. */
+#include <sys/featuretest.h>	/* tell headers to include NetBSD stuff. */
+
+/* The following are so basic, all the lib files get them automatically. */
+#include <minix/config.h>	/* must be first */
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <limits.h>
+#include <errno.h>
+
+#include <minix/const.h>
+#include <minix/com.h>
+#include <minix/type.h>
+#include <minix/callnr.h>
+#include <minix/endpoint.h>
+#include <minix/ipc.h>
+
+struct minix_kerninfo *get_minix_kerninfo(void);
+
+vir_bytes minix_get_user_sp(void);
+
+struct ps_strings; /* forward declaration for minix_stack_fill. */
+
+void minix_stack_params(const char *path, char * const *argv,
+	char * const *envp, size_t *stack_size, char *overflow, int *argc,
+	int *envc);
+void minix_stack_fill(const char *path, int argc, char * const *argv,
+	int envc, char * const *envp, size_t stack_size, char *frame,
+	int *vsp, struct ps_strings **psp);
+
+int __execve(const char *_path, char *const _argv[], char *const
+	_envp[], int _nargs, int _nenvps);
+int _syscall(endpoint_t _who, int _syscallnr, message *_msgptr);
+void _loadname(const char *_name, message *_msgptr);
+int _len(const char *_s);
+void _begsig(int _dummy);
+
+#define _VECTORIO_READ	1
+#define _VECTORIO_WRITE	2
+ssize_t _vectorio_setup(const struct iovec * iov, int iovcnt, char ** ptr,
+	int op);
+void _vectorio_cleanup(const struct iovec * iov, int iovcnt, char * buffer,
+	ssize_t r, int op);
+
+#endif /* _LIB_H */

Property changes on: lab4/.minix-src/include/lib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/libelf.h
===================================================================
--- lab4/.minix-src/include/libelf.h	(nonexistent)
+++ lab4/.minix-src/include/libelf.h	(revision 13)
@@ -0,0 +1,268 @@
+/*	$NetBSD: libelf.h,v 1.4 2015/09/29 22:14:14 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2006,2008-2010 Joseph Koshy
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Id: libelf.h 2366 2011-12-29 06:12:14Z jkoshy 
+ */
+
+#ifndef	_LIBELF_H_
+#define	_LIBELF_H_
+
+#if HAVE_NBTOOL_CONFIG_H
+# include "nbtool_config.h"
+#endif
+
+
+#if HAVE_NBTOOL_CONFIG_H
+# include <nbinclude/sys/exec_elf.h>
+#elif defined(__NetBSD__) || defined(__minix)
+# include <sys/types.h>
+# include <sys/exec_elf.h>
+#elif defined(__FreeBSD__)
+# include <sys/types.h>
+# include <sys/elf32.h>
+# include <sys/elf64.h>
+#else
+# error "Unsupported platform"
+#endif
+
+/* Library private data structures */
+typedef struct _Elf Elf;
+typedef struct _Elf_Scn Elf_Scn;
+
+/* File types */
+typedef enum {
+	ELF_K_NONE = 0,
+	ELF_K_AR,	/* `ar' archives */
+	ELF_K_COFF,	/* COFF files (unsupported) */
+	ELF_K_ELF,	/* ELF files */
+	ELF_K_NUM
+} Elf_Kind;
+
+#define	ELF_K_FIRST	ELF_K_NONE
+#define	ELF_K_LAST	ELF_K_NUM
+
+/* Data types */
+typedef enum {
+	ELF_T_ADDR,
+	ELF_T_BYTE,
+	ELF_T_CAP,
+	ELF_T_DYN,
+	ELF_T_EHDR,
+	ELF_T_HALF,
+	ELF_T_LWORD,
+	ELF_T_MOVE,
+	ELF_T_MOVEP,
+	ELF_T_NOTE,
+	ELF_T_OFF,
+	ELF_T_PHDR,
+	ELF_T_REL,
+	ELF_T_RELA,
+	ELF_T_SHDR,
+	ELF_T_SWORD,
+	ELF_T_SXWORD,
+	ELF_T_SYMINFO,
+	ELF_T_SYM,
+	ELF_T_VDEF,
+	ELF_T_VNEED,
+	ELF_T_WORD,
+	ELF_T_XWORD,
+	ELF_T_GNUHASH,	/* GNU style hash tables. */
+	ELF_T_NUM
+} Elf_Type;
+
+#define	ELF_T_FIRST	ELF_T_ADDR
+#define	ELF_T_LAST	ELF_T_GNUHASH
+
+/* Commands */
+typedef enum {
+	ELF_C_NULL = 0,
+	ELF_C_CLR,
+	ELF_C_FDDONE,
+	ELF_C_FDREAD,
+	ELF_C_RDWR,
+	ELF_C_READ,
+	ELF_C_SET,
+	ELF_C_WRITE,
+	ELF_C_NUM
+} Elf_Cmd;
+
+#define	ELF_C_FIRST	ELF_C_NULL
+#define	ELF_C_LAST	ELF_C_NUM
+
+/*
+ * An `Elf_Data' structure describes data in an
+ * ELF section.
+ */
+typedef struct _Elf_Data {
+	/*
+	 * `Public' members that are part of the ELF(3) API.
+	 */
+	uint64_t	d_align;
+	void		*d_buf;
+	uint64_t	d_off;
+	uint64_t	d_size;
+	Elf_Type	d_type;
+	unsigned int	d_version;
+} Elf_Data;
+
+/*
+ * An `Elf_Arhdr' structure describes an archive
+ * header.
+ */
+typedef struct {
+	time_t		ar_date;
+	char		*ar_name;	/* archive member name */
+	gid_t		ar_gid;
+	mode_t		ar_mode;
+	char		*ar_rawname;	/* 'raw' member name */
+	size_t		ar_size;
+	uid_t		ar_uid;
+
+	/*
+	 * Members that are not part of the public API.
+	 */
+	int		ar_flags;
+} Elf_Arhdr;
+
+/*
+ * An `Elf_Arsym' describes an entry in the archive
+ * symbol table.
+ */
+typedef struct {
+	off_t		as_off;		/* byte offset to member's header */
+	unsigned long	as_hash;	/* elf_hash() value for name */
+	char		*as_name; 	/* null terminated symbol name */
+} Elf_Arsym;
+
+/*
+ * Error numbers.
+ */
+
+enum Elf_Error {
+	ELF_E_NONE,	/* No error */
+	ELF_E_ARCHIVE,	/* Malformed ar(1) archive */
+	ELF_E_ARGUMENT,	/* Invalid argument */
+	ELF_E_CLASS,	/* Mismatched ELF class */
+	ELF_E_DATA,	/* Invalid data descriptor */
+	ELF_E_HEADER,	/* Missing or malformed ELF header */
+	ELF_E_IO,	/* I/O error */
+	ELF_E_LAYOUT,	/* Layout constraint violation */
+	ELF_E_MODE,	/* Wrong mode for ELF descriptor */
+	ELF_E_RANGE,	/* Value out of range */
+	ELF_E_RESOURCE,	/* Resource exhaustion */
+	ELF_E_SECTION,	/* Invalid section descriptor */
+	ELF_E_SEQUENCE,	/* API calls out of sequence */
+	ELF_E_UNIMPL,	/* Feature is unimplemented */
+	ELF_E_VERSION,	/* Unknown API version */
+	ELF_E_NUM	/* Max error number */
+};
+
+/*
+ * Flags defined by the API.
+ */
+
+#define	ELF_F_LAYOUT	0x001U	/* application will layout the file */
+#define	ELF_F_DIRTY	0x002U	/* a section or ELF file is dirty */
+
+/* ELF(3) API extensions. */
+#define	ELF_F_ARCHIVE	   0x100U /* archive creation */
+#define	ELF_F_ARCHIVE_SYSV 0x200U /* SYSV style archive */
+
+__BEGIN_DECLS
+Elf		*elf_begin(int _fd, Elf_Cmd _cmd, Elf *_elf);
+int		elf_cntl(Elf *_elf, Elf_Cmd _cmd);
+int		elf_end(Elf *_elf);
+const char	*elf_errmsg(int _error);
+int		elf_errno(void);
+void		elf_fill(int _fill);
+unsigned int	elf_flagarhdr(Elf_Arhdr *_arh, Elf_Cmd _cmd,
+			unsigned int _flags);
+unsigned int	elf_flagdata(Elf_Data *_data, Elf_Cmd _cmd,
+			unsigned int _flags);
+unsigned int	elf_flagehdr(Elf *_elf, Elf_Cmd _cmd, unsigned int _flags);
+unsigned int	elf_flagelf(Elf *_elf, Elf_Cmd _cmd, unsigned int _flags);
+unsigned int	elf_flagphdr(Elf *_elf, Elf_Cmd _cmd, unsigned int _flags);
+unsigned int	elf_flagscn(Elf_Scn *_scn, Elf_Cmd _cmd, unsigned int _flags);
+unsigned int	elf_flagshdr(Elf_Scn *_scn, Elf_Cmd _cmd, unsigned int _flags);
+Elf_Arhdr	*elf_getarhdr(Elf *_elf);
+Elf_Arsym	*elf_getarsym(Elf *_elf, size_t *_ptr);
+off_t		elf_getbase(Elf *_elf);
+Elf_Data	*elf_getdata(Elf_Scn *, Elf_Data *);
+char		*elf_getident(Elf *_elf, size_t *_ptr);
+int		elf_getphdrnum(Elf *_elf, size_t *_dst);
+int		elf_getphnum(Elf *_elf, size_t *_dst);	/* Deprecated */
+Elf_Scn		*elf_getscn(Elf *_elf, size_t _index);
+int		elf_getshdrnum(Elf *_elf, size_t *_dst);
+int		elf_getshnum(Elf *_elf, size_t *_dst);	/* Deprecated */
+int		elf_getshdrstrndx(Elf *_elf, size_t *_dst);
+int		elf_getshstrndx(Elf *_elf, size_t *_dst); /* Deprecated */
+unsigned long	elf_hash(const void *_name);
+Elf_Kind	elf_kind(Elf *_elf);
+Elf		*elf_memory(char *_image, size_t _size);
+size_t		elf_ndxscn(Elf_Scn *_scn);
+Elf_Data	*elf_newdata(Elf_Scn *_scn);
+Elf_Scn		*elf_newscn(Elf *_elf);
+Elf_Scn		*elf_nextscn(Elf *_elf, Elf_Scn *_scn);
+Elf_Cmd		elf_next(Elf *_elf);
+Elf		*elf_open(int _fd);
+Elf		*elf_openmemory(char *_image, size_t _size);
+off_t		elf_rand(Elf *_elf, off_t _off);
+Elf_Data	*elf_rawdata(Elf_Scn *_scn, Elf_Data *_data);
+char		*elf_rawfile(Elf *_elf, size_t *_size);
+int		elf_setshstrndx(Elf *_elf, size_t _shnum);
+char		*elf_strptr(Elf *_elf, size_t _section, size_t _offset);
+off_t		elf_update(Elf *_elf, Elf_Cmd _cmd);
+unsigned int	elf_version(unsigned int _version);
+
+long		elf32_checksum(Elf *_elf);
+size_t		elf32_fsize(Elf_Type _type, size_t _count,
+			unsigned int _version);
+Elf32_Ehdr	*elf32_getehdr(Elf *_elf);
+Elf32_Phdr	*elf32_getphdr(Elf *_elf);
+Elf32_Shdr	*elf32_getshdr(Elf_Scn *_scn);
+Elf32_Ehdr	*elf32_newehdr(Elf *_elf);
+Elf32_Phdr	*elf32_newphdr(Elf *_elf, size_t _count);
+Elf_Data	*elf32_xlatetof(Elf_Data *_dst, const Elf_Data *_src,
+			unsigned int _enc);
+Elf_Data	*elf32_xlatetom(Elf_Data *_dst, const Elf_Data *_src,
+			unsigned int _enc);
+
+long		elf64_checksum(Elf *_elf);
+size_t		elf64_fsize(Elf_Type _type, size_t _count,
+			unsigned int _version);
+Elf64_Ehdr	*elf64_getehdr(Elf *_elf);
+Elf64_Phdr	*elf64_getphdr(Elf *_elf);
+Elf64_Shdr	*elf64_getshdr(Elf_Scn *_scn);
+Elf64_Ehdr	*elf64_newehdr(Elf *_elf);
+Elf64_Phdr	*elf64_newphdr(Elf *_elf, size_t _count);
+Elf_Data	*elf64_xlatetof(Elf_Data *_dst, const Elf_Data *_src,
+			unsigned int _enc);
+Elf_Data	*elf64_xlatetom(Elf_Data *_dst, const Elf_Data *_src,
+			unsigned int _enc);
+__END_DECLS
+
+#endif	/* _LIBELF_H_ */

Property changes on: lab4/.minix-src/include/libelf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/libgen.h
===================================================================
--- lab4/.minix-src/include/libgen.h	(nonexistent)
+++ lab4/.minix-src/include/libgen.h	(revision 13)
@@ -0,0 +1,42 @@
+/*	$NetBSD: libgen.h,v 1.5 2008/05/10 22:37:42 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LIBGEN_H_
+#define _LIBGEN_H_
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+char	*basename(char *);
+char	*dirname(char *);
+__END_DECLS
+
+#endif /* !_LIBGEN_H_ */

Property changes on: lab4/.minix-src/include/libgen.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/libutil.h
===================================================================
--- lab4/.minix-src/include/libutil.h	(nonexistent)
+++ lab4/.minix-src/include/libutil.h	(revision 13)
@@ -0,0 +1,8 @@
+#ifndef _LIBUTIL_H
+#define _LIBUTIL_H 1
+
+#include <termios.h>
+
+int openpty(int *, int *, char *, struct termios *, struct winsize *);
+
+#endif

Property changes on: lab4/.minix-src/include/libutil.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/libintl.h
===================================================================
--- lab4/.minix-src/include/libintl.h	(nonexistent)
+++ lab4/.minix-src/include/libintl.h	(revision 13)
@@ -0,0 +1,83 @@
+/*	$NetBSD: libintl.h,v 1.8 2015/06/08 15:04:20 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2000 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LIBINTL_H_
+#define _LIBINTL_H_
+
+#include <sys/cdefs.h>
+
+#ifndef _LIBGETTEXT_H
+/*
+ * Avoid defining these if the GNU gettext compatibility header includes
+ * us, since it re-defines those unconditionally and creates inline functions
+ * for some of them. This is horrible.
+ */
+#define pgettext_expr(msgctxt, msgid) pgettext((msgctxt), (msgid))
+#define dpgettext_expr(domainname, msgctxt, msgid) \
+    dpgettext((domainname), (msgctxt), (msgid))
+#define dcpgettext_expr(domainname, msgctxt, msgid, category) \
+    dcpgettext((domainname), (msgctxt), (msgid), (category))
+#define npgettext_expr(msgctxt, msgid1, msgid2, n) \
+    npgettext((msgctxt), (msgid1), (msgid2), (n))
+#define dnpgettext_expr(domainname, msgctxt, msgid1, n) \
+    dnpgettext((domainname), (msgctxt), (msgid1), (msgid2), (n))
+#define dcnpgettext_expr(domainname, msgctxt, msgid1, msgid2, n, category) \
+    dcnpgettext((domainname), (msgctxt), (msgid1), (msgid2), (n), (category))
+#endif
+
+__BEGIN_DECLS
+char *gettext(const char *) __format_arg(1);
+char *dgettext(const char *, const char *) __format_arg(2);
+char *dcgettext(const char *, const char *, int) __format_arg(2);
+char *ngettext(const char *, const char *, unsigned long int)
+	       __format_arg(1) __format_arg(2);
+char *dngettext(const char *, const char *, const char *, unsigned long int)
+		__format_arg(2) __format_arg(3);
+char *dcngettext(const char *, const char *, const char *, unsigned long int,
+		 int) __format_arg(2) __format_arg(3);
+const char *pgettext(const char *, const char *) __format_arg(2);
+const char *dpgettext(const char *, const char *, const char *)
+		      __format_arg(3);
+const char *dcpgettext(const char *, const char *, const char *, int)
+		       __format_arg(3);
+const char *npgettext(const char *, const char *, const char *,
+		      unsigned long int) __format_arg(2) __format_arg(3);
+const char *dnpgettext(const char *, const char *, const char *,
+		       const char *, unsigned long int) __format_arg(3)
+		       __format_arg(4);
+const char *dcnpgettext(const char *, const char *, const char *,
+			const char *, unsigned long int, int) __format_arg(3)
+			__format_arg(4);
+
+char *textdomain(const char *);
+char *bindtextdomain(const char *, const char *);
+char *bind_textdomain_codeset(const char *, const char *);
+
+__END_DECLS
+
+#endif /* _LIBINTL_H_ */

Property changes on: lab4/.minix-src/include/libintl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_map.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_map.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_map.h	(revision 13)
@@ -0,0 +1,342 @@
+/*	$NetBSD: uvm_map.h,v 1.72 2012/10/29 16:00:05 para Exp $	*/
+
+/*
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * Copyright (c) 1991, 1993, The Regents of the University of California.
+ *
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * The Mach Operating System project at Carnegie-Mellon University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vm_map.h    8.3 (Berkeley) 3/15/94
+ * from: Id: uvm_map.h,v 1.1.2.3 1998/02/07 01:16:55 chs Exp
+ *
+ *
+ * Copyright (c) 1987, 1990 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _UVM_UVM_MAP_H_
+#define _UVM_UVM_MAP_H_
+
+/*
+ * uvm_map.h
+ */
+
+#ifdef _KERNEL
+
+/*
+ * macros
+ */
+
+/*
+ * UVM_MAP_CLIP_START: ensure that the entry begins at or after
+ * the starting address, if it doesn't we split the entry.
+ *
+ * => map must be locked by caller
+ */
+
+#define UVM_MAP_CLIP_START(MAP,ENTRY,VA) { \
+	if ((VA) > (ENTRY)->start && (VA) < (ENTRY)->end) { \
+		uvm_map_clip_start(MAP,ENTRY,VA); \
+	} \
+}
+
+/*
+ * UVM_MAP_CLIP_END: ensure that the entry ends at or before
+ *      the ending address, if it does't we split the entry.
+ *
+ * => map must be locked by caller
+ */
+
+#define UVM_MAP_CLIP_END(MAP,ENTRY,VA) { \
+	if ((VA) > (ENTRY)->start && (VA) < (ENTRY)->end) { \
+		uvm_map_clip_end(MAP,ENTRY,VA); \
+	} \
+}
+
+/*
+ * extract flags
+ */
+#define UVM_EXTRACT_REMOVE	0x01	/* remove mapping from old map */
+#define UVM_EXTRACT_CONTIG	0x02	/* try to keep it contig */
+#define UVM_EXTRACT_QREF	0x04	/* use quick refs */
+#define UVM_EXTRACT_FIXPROT	0x08	/* set prot to maxprot as we go */
+#define UVM_EXTRACT_RESERVED	0x10	/* caller did uvm_map_reserve() */
+
+#endif /* _KERNEL */
+
+#include <sys/rbtree.h>
+#include <sys/pool.h>
+#include <sys/rwlock.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+
+#include <uvm/uvm_anon.h>
+
+/*
+ * Address map entries consist of start and end addresses,
+ * a VM object (or sharing map) and offset into that object,
+ * and user-exported inheritance and protection information.
+ * Also included is control information for virtual copy operations.
+ */
+struct vm_map_entry {
+	struct rb_node		rb_node;	/* tree information */
+	vsize_t			gap;		/* free space after */
+	vsize_t			maxgap;		/* space in subtree */
+	struct vm_map_entry	*prev;		/* previous entry */
+	struct vm_map_entry	*next;		/* next entry */
+	vaddr_t			start;		/* start address */
+	vaddr_t			end;		/* end address */
+	union {
+		struct uvm_object *uvm_obj;	/* uvm object */
+		struct vm_map	*sub_map;	/* belongs to another map */
+	} object;				/* object I point to */
+	voff_t			offset;		/* offset into object */
+	int			etype;		/* entry type */
+	vm_prot_t		protection;	/* protection code */
+	vm_prot_t		max_protection;	/* maximum protection */
+	vm_inherit_t		inheritance;	/* inheritance */
+	int			wired_count;	/* can be paged if == 0 */
+	struct vm_aref		aref;		/* anonymous overlay */
+	int			advice;		/* madvise advice */
+	uint32_t		map_attrib;	/* uvm-external map attributes */
+#define uvm_map_entry_stop_copy flags
+	u_int8_t		flags;		/* flags */
+
+#define	UVM_MAP_KERNEL		0x01		/* kernel map entry */
+#define	UVM_MAP_STATIC		0x04		/* special static entries */
+#define	UVM_MAP_NOMERGE		0x08		/* this entry is not mergable */
+
+};
+
+#define	VM_MAPENT_ISWIRED(entry)	((entry)->wired_count != 0)
+
+/*
+ *	Maps are doubly-linked lists of map entries, kept sorted
+ *	by address.  A single hint is provided to start
+ *	searches again from the last successful search,
+ *	insertion, or removal.
+ *
+ *	LOCKING PROTOCOL NOTES:
+ *	-----------------------
+ *
+ *	VM map locking is a little complicated.  There are both shared
+ *	and exclusive locks on maps.  However, it is sometimes required
+ *	to downgrade an exclusive lock to a shared lock, and upgrade to
+ *	an exclusive lock again (to perform error recovery).  However,
+ *	another thread *must not* queue itself to receive an exclusive
+ *	lock while before we upgrade back to exclusive, otherwise the
+ *	error recovery becomes extremely difficult, if not impossible.
+ *
+ *	In order to prevent this scenario, we introduce the notion of
+ *	a `busy' map.  A `busy' map is read-locked, but other threads
+ *	attempting to write-lock wait for this flag to clear before
+ *	entering the lock manager.  A map may only be marked busy
+ *	when the map is write-locked (and then the map must be downgraded
+ *	to read-locked), and may only be marked unbusy by the thread
+ *	which marked it busy (holding *either* a read-lock or a
+ *	write-lock, the latter being gained by an upgrade).
+ *
+ *	Access to the map `flags' member is controlled by the `flags_lock'
+ *	simple lock.  Note that some flags are static (set once at map
+ *	creation time, and never changed), and thus require no locking
+ *	to check those flags.  All flags which are r/w must be set or
+ *	cleared while the `flags_lock' is asserted.  Additional locking
+ *	requirements are:
+ *
+ *		VM_MAP_PAGEABLE		r/o static flag; no locking required
+ *
+ *		VM_MAP_WIREFUTURE	r/w; may only be set or cleared when
+ *					map is write-locked.  may be tested
+ *					without asserting `flags_lock'.
+ *
+ *		VM_MAP_DYING		r/o; set when a vmspace is being
+ *					destroyed to indicate that updates
+ *					to the pmap can be skipped.
+ *
+ *		VM_MAP_TOPDOWN		r/o; set when the vmspace is
+ *					created if the unspecified map
+ *					allocations are to be arranged in
+ *					a "top down" manner.
+ */
+struct vm_map {
+	struct pmap *		pmap;		/* Physical map */
+	krwlock_t		lock;		/* Non-intrsafe lock */
+	struct lwp *		busy;		/* LWP holding map busy */
+	kmutex_t		misc_lock;	/* Lock for ref_count, cv */
+	kcondvar_t		cv;		/* For signalling */
+	int			flags;		/* flags */
+	struct rb_tree		rb_tree;	/* Tree for entries */
+	struct vm_map_entry	header;		/* List of entries */
+	int			nentries;	/* Number of entries */
+	vsize_t			size;		/* virtual size */
+	int			ref_count;	/* Reference count */
+	struct vm_map_entry *	hint;		/* hint for quick lookups */
+	struct vm_map_entry *	first_free;	/* First free space hint */
+	unsigned int		timestamp;	/* Version number */
+};
+
+#if defined(_KERNEL)
+
+#include <sys/callback.h>
+
+#endif /* defined(_KERNEL) */
+
+#define	VM_MAP_IS_KERNEL(map)	(vm_map_pmap(map) == pmap_kernel())
+
+/* vm_map flags */
+#define	VM_MAP_PAGEABLE		0x01		/* ro: entries are pageable */
+#define	VM_MAP_WIREFUTURE	0x04		/* rw: wire future mappings */
+#define	VM_MAP_DYING		0x20		/* rw: map is being destroyed */
+#define	VM_MAP_TOPDOWN		0x40		/* ro: arrange map top-down */
+#define	VM_MAP_WANTVA		0x100		/* rw: want va */
+
+#ifdef _KERNEL
+struct uvm_map_args {
+	struct vm_map_entry *uma_prev;
+
+	vaddr_t uma_start;
+	vsize_t uma_size;
+
+	struct uvm_object *uma_uobj;
+	voff_t uma_uoffset;
+
+	uvm_flag_t uma_flags;
+};
+#endif /* _KERNEL */
+
+/*
+ * globals:
+ */
+
+#ifdef _KERNEL
+
+#include <sys/proc.h>
+
+#ifdef PMAP_GROWKERNEL
+extern vaddr_t	uvm_maxkaddr;
+#endif
+
+/*
+ * protos: the following prototypes define the interface to vm_map
+ */
+
+void		uvm_map_deallocate(struct vm_map *);
+
+int		uvm_map_willneed(struct vm_map *, vaddr_t, vaddr_t);
+int		uvm_map_clean(struct vm_map *, vaddr_t, vaddr_t, int);
+void		uvm_map_clip_start(struct vm_map *, struct vm_map_entry *,
+		    vaddr_t);
+void		uvm_map_clip_end(struct vm_map *, struct vm_map_entry *,
+		    vaddr_t);
+int		uvm_map_extract(struct vm_map *, vaddr_t, vsize_t,
+		    struct vm_map *, vaddr_t *, int);
+struct vm_map_entry *
+		uvm_map_findspace(struct vm_map *, vaddr_t, vsize_t,
+		    vaddr_t *, struct uvm_object *, voff_t, vsize_t, int);
+int		uvm_map_inherit(struct vm_map *, vaddr_t, vaddr_t,
+		    vm_inherit_t);
+int		uvm_map_advice(struct vm_map *, vaddr_t, vaddr_t, int);
+void		uvm_map_init(void);
+void		uvm_map_init_caches(void);
+bool		uvm_map_lookup_entry(struct vm_map *, vaddr_t,
+		    struct vm_map_entry **);
+void		uvm_map_reference(struct vm_map *);
+int		uvm_map_reserve(struct vm_map *, vsize_t, vaddr_t, vsize_t,
+		    vaddr_t *, uvm_flag_t);
+void		uvm_map_setup(struct vm_map *, vaddr_t, vaddr_t, int);
+int		uvm_map_submap(struct vm_map *, vaddr_t, vaddr_t,
+		    struct vm_map *);
+void		uvm_unmap1(struct vm_map *, vaddr_t, vaddr_t, int);
+#define	uvm_unmap(map, s, e)	uvm_unmap1((map), (s), (e), 0)
+void		uvm_unmap_detach(struct vm_map_entry *,int);
+void		uvm_unmap_remove(struct vm_map *, vaddr_t, vaddr_t,
+		    struct vm_map_entry **, int);
+
+int		uvm_map_prepare(struct vm_map *, vaddr_t, vsize_t,
+		    struct uvm_object *, voff_t, vsize_t, uvm_flag_t,
+		    struct uvm_map_args *);
+int		uvm_map_enter(struct vm_map *, const struct uvm_map_args *,
+		    struct vm_map_entry *);
+
+int		uvm_mapent_trymerge(struct vm_map *,
+		    struct vm_map_entry *, int);
+#define	UVM_MERGE_COPYING	1
+
+bool		vm_map_starved_p(struct vm_map *);
+
+/*
+ * VM map locking operations.
+ */
+
+bool		vm_map_lock_try(struct vm_map *);
+void		vm_map_lock(struct vm_map *);
+void		vm_map_unlock(struct vm_map *);
+void		vm_map_unbusy(struct vm_map *);
+void		vm_map_lock_read(struct vm_map *);
+void		vm_map_unlock_read(struct vm_map *);
+void		vm_map_busy(struct vm_map *);
+bool		vm_map_locked_p(struct vm_map *);
+
+void		uvm_map_lock_entry(struct vm_map_entry *);
+void		uvm_map_unlock_entry(struct vm_map_entry *);
+
+#endif /* _KERNEL */
+
+/*
+ *	Functions implemented as macros
+ */
+#define		vm_map_min(map)		((map)->header.end)
+#define		vm_map_max(map)		((map)->header.start)
+#define		vm_map_setmin(map, v)	((map)->header.end = (v))
+#define		vm_map_setmax(map, v)	((map)->header.start = (v))
+
+#define		vm_map_pmap(map)	((map)->pmap)
+
+#endif /* _UVM_UVM_MAP_H_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_map.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/link.h
===================================================================
--- lab4/.minix-src/include/link.h	(nonexistent)
+++ lab4/.minix-src/include/link.h	(revision 13)
@@ -0,0 +1,45 @@
+/*	$NetBSD: link.h,v 1.13 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LINK_H_
+#define	_LINK_H_
+
+/*
+ * Pull in the correct definitions for our toolchain target.
+ */
+#ifdef __ELF__
+#include <link_elf.h>
+#else
+#include <link_aout.h>
+#endif
+
+#endif /* _LINK_H_ */

Property changes on: lab4/.minix-src/include/link.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/link_elf.h
===================================================================
--- lab4/.minix-src/include/link_elf.h	(nonexistent)
+++ lab4/.minix-src/include/link_elf.h	(revision 13)
@@ -0,0 +1,53 @@
+/*	$NetBSD: link_elf.h,v 1.10 2010/10/16 10:27:06 skrll Exp $	*/
+
+#ifndef _LINK_ELF_H_
+#define	_LINK_ELF_H_
+
+#include <sys/types.h>
+#include <sys/exec_elf.h>
+
+typedef struct link_map {
+	caddr_t		 l_addr;	/* Base Address of library */
+#ifdef __mips__
+	caddr_t		 l_offs;	/* Load Offset of library */
+#endif
+	const char	*l_name;	/* Absolute Path to Library */
+	void		*l_ld;		/* Pointer to .dynamic in memory */
+	struct link_map	*l_next;	/* linked list of of mapped libs */
+	struct link_map *l_prev;
+} Link_map;
+
+/*
+ * This only exists for GDB.
+ */
+struct r_debug {
+	int r_version;			/* not used */
+	struct link_map *r_map;		/* list of loaded images */
+	void (*r_brk)(void);		/* pointer to break point */
+	enum {
+		RT_CONSISTENT,		/* things are stable */
+		RT_ADD,			/* adding a shared library */
+		RT_DELETE		/* removing a shared library */
+	} r_state;
+};
+
+struct dl_phdr_info
+{
+	Elf_Addr dlpi_addr;			/* module relocation base */
+	const char *dlpi_name;			/* module name */
+	const Elf_Phdr *dlpi_phdr;		/* pointer to module's phdr */
+	Elf_Half dlpi_phnum;			/* number of entries in phdr */
+	unsigned long long int dlpi_adds;	/* total # of loads */
+	unsigned long long int dlpi_subs;	/* total # of unloads */
+	size_t dlpi_tls_modid;
+	void *dlpi_tls_data;
+};
+
+__BEGIN_DECLS
+
+int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *),
+    void *);
+
+__END_DECLS
+
+#endif	/* _LINK_ELF_H_ */

Property changes on: lab4/.minix-src/include/link_elf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/link_aout.h
===================================================================
--- lab4/.minix-src/include/link_aout.h	(nonexistent)
+++ lab4/.minix-src/include/link_aout.h	(revision 13)
@@ -0,0 +1,288 @@
+/*	$NetBSD: link_aout.h,v 1.21 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Kranenburg.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * RRS section definitions.
+ *
+ * The layout of some data structures defined in this header file is
+ * such that we can provide compatibility with the SunOS 4.x shared
+ * library scheme.
+ */
+
+#ifndef _LINK_AOUT_H_
+#define _LINK_AOUT_H_
+
+#include <dlfcn.h>			/* for Dl_info */
+#include <a.out.h>			/* for struct nlist */
+
+/*
+ * A `Shared Object Descriptor' describes a shared object that is needed
+ * to complete the link edit process of the object containing it.
+ * A list of such objects (chained through `sod_next') is pointed at
+ * by `sdt_sods' in the section_dispatch_table structure.
+ */
+
+struct sod {	/* Shared Object Descriptor */
+	long	sod_name;		/* name (relative to load address) */
+	u_int	sod_library  : 1,	/* Searched for by library rules */
+		sod_reserved : 31;
+	short	sod_major;		/* major version number */
+	short	sod_minor;		/* minor version number */
+	long	sod_next;		/* next sod */
+};
+
+/*
+ * `Shared Object Map's are used by the run-time link editor (ld.so) to
+ * keep track of all shared objects loaded into a process' address space.
+ * These structures are only used at run-time and do not occur within
+ * the text or data segment of an executable or shared library.
+ */
+struct so_map {		/* Shared Object Map */
+	caddr_t		som_addr;	/* Address at which object mapped */
+	char 		*som_path;	/* Path to mmap'ed file */
+	struct so_map	*som_next;	/* Next map in chain */
+	struct sod	*som_sod;	/* Sod responsible for this map */
+	caddr_t		som_sodbase;	/* Base address of this sod */
+	u_int		som_write : 1;	/* Text is currently writable */
+	struct _dynamic	*som_dynamic;	/* _dynamic structure */
+	caddr_t		som_spd;	/* Private data */
+};
+
+/*
+ * Symbol description with size. This is simply an `nlist' with
+ * one field (nz_size) added.
+ * Used to convey size information on items in the data segment
+ * of shared objects. An array of these live in the shared object's
+ * text segment and is addressed by the `sdt_nzlist' field.
+ */
+struct nzlist {
+	struct nlist	nlist;
+	u_long		nz_size;
+#define nz_un		nlist.n_un
+#define nz_strx		nlist.n_un.n_strx
+#define nz_name		nlist.n_un.n_name
+#define nz_type		nlist.n_type
+#define nz_value	nlist.n_value
+#define nz_desc		nlist.n_desc
+#define nz_other	nlist.n_other
+};
+
+#define N_AUX(p)	((p)->n_other & 0xf)
+#define N_BIND(p)	(((unsigned int)(p)->n_other >> 4) & 0xf)
+#define N_OTHER(r, v)	(((unsigned int)(r) << 4) | ((v) & 0xf))
+
+#define AUX_OBJECT	1
+#define AUX_FUNC	2
+#define AUX_LABEL	3
+/*#define BIND_LOCAL	0	not used */
+/*#define BIND_GLOBAL	1	not used */
+#define BIND_WEAK	2
+
+
+/*
+ * The `section_dispatch_table' structure contains offsets to various data
+ * structures needed to do run-time relocation.
+ */
+struct section_dispatch_table {
+	struct so_map *sdt_loaded;	/* List of loaded objects */
+	long	sdt_sods;		/* List of shared objects descriptors */
+	long	sdt_paths;		/* Library search paths */
+	long	sdt_got;		/* Global offset table */
+	long	sdt_plt;		/* Procedure linkage table */
+	long	sdt_rel;		/* Relocation table */
+	long	sdt_hash;		/* Symbol hash table */
+	long	sdt_nzlist;		/* Symbol table itself */
+	long	sdt_filler2;		/* Unused (was: stab_hash) */
+	long	sdt_buckets;		/* Number of hash buckets */
+	long	sdt_strings;		/* Symbol strings */
+	long	sdt_str_sz;		/* Size of symbol strings */
+	long	sdt_text_sz;		/* Size of text area */
+	long	sdt_plt_sz;		/* Size of procedure linkage table */
+};
+
+/*
+ * RRS symbol hash table, addressed by `sdt_hash' in section_dispatch_table.
+ * Used to quickly lookup symbols of the shared object by hashing
+ * on the symbol's name. `rh_symbolnum' is the index of the symbol
+ * in the shared object's symbol list (`sdt_nzlist'), `rh_next' is
+ * the next symbol in the hash bucket (in case of collisions).
+ */
+struct rrs_hash {
+	int	rh_symbolnum;		/* Symbol number */
+	int	rh_next;		/* Next hash entry */
+};
+
+/*
+ * `rt_symbols' is used to keep track of run-time allocated commons
+ * and data items copied from shared objects.
+ */
+struct rt_symbol {
+	struct nzlist		*rt_sp;		/* The symbol */
+	struct rt_symbol	*rt_next;	/* Next in linear list */
+	struct rt_symbol	*rt_link;	/* Next in bucket */
+	caddr_t			rt_srcaddr;	/* Address of "master" copy */
+	struct so_map		*rt_smp;	/* Originating map */
+};
+
+/*
+ * Debugger interface structure.
+ */
+struct so_debug {
+	int	dd_version;		/* Version # of interface */
+	int	dd_in_debugger;		/* Set when run by debugger */
+	int	dd_sym_loaded;		/* Run-time linking brought more
+					   symbols into scope */
+	char   	 *dd_bpt_addr;		/* Address of rtld-generated bpt */
+	int	dd_bpt_shadow;		/* Original contents of bpt */
+	struct rt_symbol *dd_cc;	/* Allocated commons/copied data */
+};
+
+/*
+ * Entry points into ld.so - user interface to the run-time linker.
+ */
+struct ld_entry {
+	void	*(*dlopen)(const char *, int);
+	int	(*dlclose)(void *);
+	void	*(*dlsym)(void *, const char *);
+	int	(*dlctl)(void *, int, void *);
+	void	(*dlexit)(void);
+	int	(*dladdr)(const void *, Dl_info *);
+	void	(*dlrsrvd[2])(void);
+};
+
+/*
+ * This is the structure pointed at by the __DYNAMIC symbol if an
+ * executable requires the attention of the run-time link editor.
+ * __DYNAMIC is given the value zero if no run-time linking needs to
+ * be done (it is always present in shared objects).
+ * The union `d_un' provides for different versions of the dynamic
+ * linking mechanism (switched on by `d_version'). The last version
+ * used by Sun is 3. We leave some room here and go to version number
+ * 8 for NetBSD, the main difference lying in the support for the
+ * `nz_list' type of symbols.
+ */
+
+struct	_dynamic {
+	int		d_version;	/* version # of this interface */
+	struct so_debug	*d_debug;
+	union {
+		struct section_dispatch_table *d_sdt;
+	} d_un;
+	struct ld_entry *d_entry;	/* compat - now in crt_ldso */
+};
+
+#define LD_VERSION_SUN		(3)
+#define LD_VERSION_BSD		(8)
+#define LD_VERSION_NZLIST_P(v)	((v) >= 8)
+
+#define LD_GOT(x)	((x)->d_un.d_sdt->sdt_got)
+#define LD_PLT(x)	((x)->d_un.d_sdt->sdt_plt)
+#define LD_REL(x)	((x)->d_un.d_sdt->sdt_rel)
+#define LD_SYMBOL(x)	((x)->d_un.d_sdt->sdt_nzlist)
+#define LD_HASH(x)	((x)->d_un.d_sdt->sdt_hash)
+#define LD_STRINGS(x)	((x)->d_un.d_sdt->sdt_strings)
+#define LD_NEED(x)	((x)->d_un.d_sdt->sdt_sods)
+#define LD_BUCKETS(x)	((x)->d_un.d_sdt->sdt_buckets)
+#define LD_PATHS(x)	((x)->d_un.d_sdt->sdt_paths)
+
+#define LD_GOTSZ(x)	((x)->d_un.d_sdt->sdt_plt - (x)->d_un.d_sdt->sdt_got)
+#define LD_RELSZ(x)	((x)->d_un.d_sdt->sdt_hash - (x)->d_un.d_sdt->sdt_rel)
+#define LD_HASHSZ(x)	((x)->d_un.d_sdt->sdt_nzlist - (x)->d_un.d_sdt->sdt_hash)
+#define LD_STABSZ(x)	((x)->d_un.d_sdt->sdt_strings - (x)->d_un.d_sdt->sdt_nzlist)
+#define LD_PLTSZ(x)	((x)->d_un.d_sdt->sdt_plt_sz)
+#define LD_STRSZ(x)	((x)->d_un.d_sdt->sdt_str_sz)
+#define LD_TEXTSZ(x)	((x)->d_un.d_sdt->sdt_text_sz)
+
+/*
+ * Interface to ld.so
+ */
+struct crt_ldso {
+	int		crt_ba;		/* Base address of ld.so */
+	int		crt_dzfd;	/* "/dev/zero" file descriptor (SunOS) */
+	int		crt_ldfd;	/* ld.so file descriptor */
+	struct _dynamic	*crt_dp;	/* Main's __DYNAMIC */
+	char		**crt_ep;	/* environment strings */
+	caddr_t		crt_bp;		/* Breakpoint if run from debugger */
+	char		*crt_prog;	/* Program name (v3) */
+	char		*crt_ldso;	/* Link editor name (v4) */
+	struct ld_entry	*crt_ldentry;	/* dl*() access (v4) */
+};
+
+/*
+ * Version passed from crt0 to ld.so (1st argument to _rtld()).
+ */
+#define CRT_VERSION_SUN		1
+#define CRT_VERSION_BSD_2	2
+#define CRT_VERSION_BSD_3	3
+#define CRT_VERSION_BSD_4	4
+
+
+/*
+ * Maximum number of recognized shared object version numbers.
+ */
+#define MAXDEWEY	8
+
+/*
+ * Header of the hints file.
+ */
+struct hints_header {
+	long		hh_magic;
+#define HH_MAGIC	011421044151
+	long		hh_version;	/* Interface version number */
+#define LD_HINTS_VERSION_1	1
+#define LD_HINTS_VERSION_2	2
+	long		hh_hashtab;	/* Location of hash table */
+	long		hh_nbucket;	/* Number of buckets in hashtab */
+	long		hh_strtab;	/* Location of strings */
+	long		hh_strtab_sz;	/* Size of strings */
+	long		hh_ehints;	/* End of hints (max offset in file) */
+	long		hh_dirlist;	/* Colon-separated list of srch dirs */
+};
+
+#define HH_BADMAG(hdr)	((hdr).hh_magic != HH_MAGIC)
+
+/*
+ * Hash table element in hints file.
+ */
+struct hints_bucket {
+	/* namex and pathx are indices into the string table */
+	int		hi_namex;		/* Library name */
+	int		hi_pathx;		/* Full path */
+	int		hi_dewey[MAXDEWEY];	/* The versions */
+	int		hi_ndewey;		/* Number of version numbers */
+#define hi_major hi_dewey[0]
+#define hi_minor hi_dewey[1]
+	int		hi_next;		/* Next in this bucket */
+};
+
+#define _PATH_LD_HINTS		"/var/run/ld.so.hints"
+
+#endif /* _LINK_AOUT_H_ */

Property changes on: lab4/.minix-src/include/link_aout.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_param.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_param.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_param.h	(revision 13)
@@ -0,0 +1,263 @@
+/*	$NetBSD: uvm_param.h,v 1.35 2015/09/26 20:28:38 christos Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * The Mach Operating System project at Carnegie-Mellon University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vm_param.h	8.2 (Berkeley) 1/9/95
+ *
+ *
+ * Copyright (c) 1987, 1990 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Authors: Avadis Tevanian, Jr., Michael Wayne Young
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ *	Machine independent virtual memory parameters.
+ */
+
+#ifndef	_VM_PARAM_
+#define	_VM_PARAM_
+
+#ifdef _KERNEL_OPT
+#include "opt_modular.h"
+#include "opt_uvm.h"
+#endif
+#ifdef _KERNEL
+#include <sys/types.h>
+#include <machine/vmparam.h>
+#include <sys/resourcevar.h>
+#endif
+
+#if defined(_KERNEL)
+
+#if defined(PAGE_SIZE)
+
+/*
+ * If PAGE_SIZE is defined at this stage, it must be a constant.
+ */
+
+#if PAGE_SIZE == 0
+#error Invalid PAGE_SIZE definition
+#endif
+
+/*
+ * If the platform does not need to support a variable PAGE_SIZE,
+ * then provide default values for MIN_PAGE_SIZE and MAX_PAGE_SIZE.
+ */
+
+#if !defined(MIN_PAGE_SIZE)
+#define	MIN_PAGE_SIZE	PAGE_SIZE
+#endif /* ! MIN_PAGE_SIZE */
+
+#if !defined(MAX_PAGE_SIZE)
+#define	MAX_PAGE_SIZE	PAGE_SIZE
+#endif /* ! MAX_PAGE_SIZE */
+
+#else /* ! PAGE_SIZE */
+
+/*
+ * PAGE_SIZE is not a constant; MIN_PAGE_SIZE and MAX_PAGE_SIZE must
+ * be defined.
+ */
+
+#if !defined(MIN_PAGE_SIZE)
+#error MIN_PAGE_SIZE not defined
+#endif
+
+#if !defined(MAX_PAGE_SIZE)
+#error MAX_PAGE_SIZE not defined
+#endif
+
+#endif /* PAGE_SIZE */
+
+/*
+ * MIN_PAGE_SIZE and MAX_PAGE_SIZE must be constants.
+ */
+
+#if MIN_PAGE_SIZE == 0
+#error Invalid MIN_PAGE_SIZE definition
+#endif
+
+#if MAX_PAGE_SIZE == 0
+#error Invalid MAX_PAGE_SIZE definition
+#endif
+
+/*
+ * If MIN_PAGE_SIZE and MAX_PAGE_SIZE are not equal, then we must use
+ * non-constant PAGE_SIZE, et al for LKMs.
+ */
+#if (MIN_PAGE_SIZE != MAX_PAGE_SIZE)
+#define	__uvmexp_pagesize
+#if defined(_LKM) || defined(_MODULE)
+#undef PAGE_SIZE
+#undef PAGE_MASK
+#undef PAGE_SHIFT
+#endif
+#endif
+
+/*
+ * Now provide PAGE_SIZE, PAGE_MASK, and PAGE_SHIFT if we do not
+ * have ones that are compile-time constants.
+ */
+#if !defined(PAGE_SIZE)
+extern const int *const uvmexp_pagesize;
+extern const int *const uvmexp_pagemask;
+extern const int *const uvmexp_pageshift;
+#define	PAGE_SIZE	(*uvmexp_pagesize)	/* size of page */
+#define	PAGE_MASK	(*uvmexp_pagemask)	/* size of page - 1 */
+#define	PAGE_SHIFT	(*uvmexp_pageshift)	/* bits to shift for pages */
+#endif /* PAGE_SIZE */
+
+#endif /* _KERNEL */
+
+/*
+ * CTL_VM identifiers
+ */
+#define	VM_METER	1		/* struct vmmeter */
+#define	VM_LOADAVG	2		/* struct loadavg */
+#define	VM_UVMEXP	3		/* struct uvmexp */
+#define	VM_NKMEMPAGES	4		/* kmem_map pages */
+#define	VM_UVMEXP2	5		/* struct uvmexp_sysctl */
+#define	VM_ANONMIN	6
+#define	VM_EXECMIN	7
+#define	VM_FILEMIN	8
+#define	VM_MAXSLP	9
+#define	VM_USPACE	10
+#define	VM_ANONMAX	11
+#define	VM_EXECMAX	12
+#define	VM_FILEMAX	13
+#define	VM_MINADDRESS	14
+#define	VM_MAXADDRESS	15
+#define	VM_PROC		16		/* process information */
+
+#define	VM_MAXID	17		/* number of valid vm ids */
+
+#define VM_PROC_MAP	1		/* struct kinfo_vmentry */
+
+#define	CTL_VM_NAMES { \
+	{ 0, 0 }, \
+	{ "vmmeter", CTLTYPE_STRUCT }, \
+	{ "loadavg", CTLTYPE_STRUCT }, \
+	{ "uvmexp", CTLTYPE_STRUCT }, \
+	{ "nkmempages", CTLTYPE_INT }, \
+	{ "uvmexp2", CTLTYPE_STRUCT }, \
+	{ "anonmin", CTLTYPE_INT }, \
+	{ "execmin", CTLTYPE_INT }, \
+	{ "filemin", CTLTYPE_INT }, \
+	{ "maxslp", CTLTYPE_INT }, \
+	{ "uspace", CTLTYPE_INT }, \
+	{ "anonmax", CTLTYPE_INT }, \
+	{ "execmax", CTLTYPE_INT }, \
+	{ "filemax", CTLTYPE_INT }, \
+	{ "minaddress", CTLTYPE_LONG }, \
+	{ "maxaddress", CTLTYPE_LONG }, \
+	{ "proc", CTLTYPE_STRUCT }, \
+}
+
+#ifndef ASSEMBLER
+/*
+ *	Convert addresses to pages and vice versa.
+ *	No rounding is used.
+ */
+#ifdef _KERNEL
+#define	atop(x)		(((paddr_t)(x)) >> PAGE_SHIFT)
+#define	ptoa(x)		(((paddr_t)(x)) << PAGE_SHIFT)
+
+/*
+ * Round off or truncate to the nearest page.  These will work
+ * for either addresses or counts (i.e., 1 byte rounds to 1 page).
+ */
+#define	round_page(x)	(((x) + PAGE_MASK) & ~PAGE_MASK)
+#define	trunc_page(x)	((x) & ~PAGE_MASK)
+
+#ifndef VM_DEFAULT_ADDRESS_BOTTOMUP
+#define VM_DEFAULT_ADDRESS_BOTTOMUP(da, sz) \
+    round_page((vaddr_t)(da) + (vsize_t)maxdmap)
+#endif
+
+#ifndef VM_DEFAULT_ADDRESS_TOPDOWN
+#define VM_DEFAULT_ADDRESS_TOPDOWN(da, sz) \
+    trunc_page(VM_MAXUSER_ADDRESS - MAXSSIZ - (sz))
+#endif
+
+extern int		ubc_nwins;	/* number of UBC mapping windows */
+extern int		ubc_winshift;	/* shift for a UBC mapping window */
+extern u_int		uvm_emap_size;	/* size of emap */
+
+#else
+/* out-of-kernel versions of round_page and trunc_page */
+#if !defined(__minix)
+#define	round_page(x) \
+	((((vaddr_t)(x) + (vm_page_size - 1)) / vm_page_size) * \
+	    vm_page_size)
+#define	trunc_page(x) \
+	((((vaddr_t)(x)) / vm_page_size) * vm_page_size)
+#else
+/* LSC: Minix always uses the same definition of those. */
+#define	round_page(x)	(((x) + PAGE_MASK) & ~PAGE_MASK)
+#define	trunc_page(x)	((x) & ~PAGE_MASK)
+#endif /* !defined(__minix) */
+
+#endif /* _KERNEL */
+
+/*
+ * typedefs, necessary for standard UVM headers.
+ */
+
+typedef unsigned int uvm_flag_t;
+
+typedef int vm_inherit_t;	/* XXX: inheritance codes */
+typedef off_t voff_t;		/* XXX: offset within a uvm_object */
+typedef voff_t pgoff_t;		/* XXX: number of pages within a uvm object */
+
+#endif /* ASSEMBLER */
+#endif /* _VM_PARAM_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_param.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/login_cap.h
===================================================================
--- lab4/.minix-src/include/login_cap.h	(nonexistent)
+++ lab4/.minix-src/include/login_cap.h	(revision 13)
@@ -0,0 +1,92 @@
+/*	$NetBSD: login_cap.h,v 1.11 2009/01/11 03:04:12 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1995,1997 Berkeley Software Design, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by Berkeley Software Design,
+ *	Inc.
+ * 4. The name of Berkeley Software Design, Inc.  may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``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 BERKELEY SOFTWARE DESIGN, INC. 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.
+ *
+ *	BSDI login_cap.h,v 2.10 1997/08/07 21:35:19 prb Exp
+ */
+
+#ifndef _LOGIN_CAP_H_
+#define _LOGIN_CAP_H_
+
+#define	LOGIN_DEFCLASS		"default"
+#define	LOGIN_DEFSERVICE	"login"
+#define	LOGIN_DEFUMASK		022
+#define	_PATH_LOGIN_CONF	"/etc/login.conf"
+
+#define	LOGIN_OSETGROUP		0x0001	/* Obsolete setgroup */
+#define	LOGIN_SETLOGIN		0x0002	/* Set login */
+#define	LOGIN_SETPATH		0x0004	/* Set path */
+#define	LOGIN_SETPRIORITY	0x0008	/* Set priority */
+#define	LOGIN_SETRESOURCES	0x0010	/* Set resource limits */
+#define	LOGIN_SETUMASK		0x0020	/* Set umask */
+#define	LOGIN_SETUSER		0x0040	/* Set user */
+#define	LOGIN_SETENV		0x0080	/* Set user environment */
+#define	LOGIN_SETGID		0x0100	/* Set group id */
+#define	LOGIN_SETGROUPS		0x0200	/* Set group membership (initgroups) */
+#define	LOGIN_SETALL		0x03fe	/* Set all. 0x0001 is obsolete! */
+#define	LOGIN_SETGROUP		(LOGIN_SETGID|LOGIN_SETGROUPS) /* Set group */
+
+typedef struct {
+	char	*lc_class;
+	char	*lc_cap;
+	char	*lc_style;
+} login_cap_t;
+
+typedef int (*envfunc_t)(void *, const char *, const char *, int);
+
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+struct passwd;
+
+login_cap_t *login_getclass(const char *);
+#ifndef __LIBC12_SOURCE__
+login_cap_t *login_getpwclass(const struct passwd *)
+    __RENAME(__login_getpwclass50);
+#endif
+void	 login_close(login_cap_t *);
+int	 login_getcapbool(login_cap_t *, const char *, u_int);
+quad_t	 login_getcapnum(login_cap_t *, const char *, quad_t, quad_t);
+quad_t	 login_getcapsize(login_cap_t *, const char *, quad_t, quad_t);
+char	*login_getcapstr(login_cap_t *, const char *, char *, char *);
+quad_t	 login_getcaptime(login_cap_t *, const char *, quad_t, quad_t);
+
+int	setclasscontext(const char *, u_int);
+#ifndef __LIBC12_SOURCE__
+int	setusercontext(login_cap_t *, struct passwd *, uid_t, u_int)
+    __RENAME(__setusercontext50);
+#endif
+void	setuserpath(login_cap_t *, const char *, envfunc_t, void *);
+int	setuserenv(login_cap_t *, envfunc_t, void *);
+
+__END_DECLS
+
+#endif	/* !_LOGIN_CAP_H_ */

Property changes on: lab4/.minix-src/include/login_cap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lua.hpp
===================================================================
--- lab4/.minix-src/include/lua.hpp	(nonexistent)
+++ lab4/.minix-src/include/lua.hpp	(revision 13)
@@ -0,0 +1,9 @@
+// lua.hpp
+// Lua header files for C++
+// <<extern "C">> not supplied automatically because Lua also compiles as C++
+
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}

Property changes on: lab4/.minix-src/include/lua.hpp
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lzma.h
===================================================================
--- lab4/.minix-src/include/lzma.h	(nonexistent)
+++ lab4/.minix-src/include/lzma.h	(revision 13)
@@ -0,0 +1,313 @@
+/**
+ * \file        api/lzma.h
+ * \brief       The public API of liblzma data compression library
+ *
+ * liblzma is a public domain general-purpose data compression library with
+ * a zlib-like API. The native file format is .xz, but also the old .lzma
+ * format and raw (no headers) streams are supported. Multiple compression
+ * algorithms (filters) are supported. Currently LZMA2 is the primary filter.
+ *
+ * liblzma is part of XZ Utils <http://tukaani.org/xz/>. XZ Utils includes
+ * a gzip-like command line tool named xz and some other tools. XZ Utils
+ * is developed and maintained by Lasse Collin.
+ *
+ * Major parts of liblzma are based on Igor Pavlov's public domain LZMA SDK
+ * <http://7-zip.org/sdk.html>.
+ *
+ * The SHA-256 implementation is based on the public domain code found from
+ * 7-Zip <http://7-zip.org/>, which has a modified version of the public
+ * domain SHA-256 code found from Crypto++ <http://www.cryptopp.com/>.
+ * The SHA-256 code in Crypto++ was written by Kevin Springle and Wei Dai.
+ */
+
+/*
+ * Author: Lasse Collin
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ */
+
+#ifndef LZMA_H
+#define LZMA_H
+
+/*****************************
+ * Required standard headers *
+ *****************************/
+
+/*
+ * liblzma API headers need some standard types and macros. To allow
+ * including lzma.h without requiring the application to include other
+ * headers first, lzma.h includes the required standard headers unless
+ * they already seem to be included already or if LZMA_MANUAL_HEADERS
+ * has been defined.
+ *
+ * Here's what types and macros are needed and from which headers:
+ *  - stddef.h: size_t, NULL
+ *  - stdint.h: uint8_t, uint32_t, uint64_t, UINT32_C(n), uint64_C(n),
+ *    UINT32_MAX, UINT64_MAX
+ *
+ * However, inttypes.h is a little more portable than stdint.h, although
+ * inttypes.h declares some unneeded things compared to plain stdint.h.
+ *
+ * The hacks below aren't perfect, specifically they assume that inttypes.h
+ * exists and that it typedefs at least uint8_t, uint32_t, and uint64_t,
+ * and that, in case of incomplete inttypes.h, unsigned int is 32-bit.
+ * If the application already takes care of setting up all the types and
+ * macros properly (for example by using gnulib's stdint.h or inttypes.h),
+ * we try to detect that the macros are already defined and don't include
+ * inttypes.h here again. However, you may define LZMA_MANUAL_HEADERS to
+ * force this file to never include any system headers.
+ *
+ * Some could argue that liblzma API should provide all the required types,
+ * for example lzma_uint64, LZMA_UINT64_C(n), and LZMA_UINT64_MAX. This was
+ * seen as an unnecessary mess, since most systems already provide all the
+ * necessary types and macros in the standard headers.
+ *
+ * Note that liblzma API still has lzma_bool, because using stdbool.h would
+ * break C89 and C++ programs on many systems. sizeof(bool) in C99 isn't
+ * necessarily the same as sizeof(bool) in C++.
+ */
+
+#ifndef LZMA_MANUAL_HEADERS
+	/*
+	 * I suppose this works portably also in C++. Note that in C++,
+	 * we need to get size_t into the global namespace.
+	 */
+#	include <stddef.h>
+
+	/*
+	 * Skip inttypes.h if we already have all the required macros. If we
+	 * have the macros, we assume that we have the matching typedefs too.
+	 */
+#	if !defined(UINT32_C) || !defined(UINT64_C) \
+			|| !defined(UINT32_MAX) || !defined(UINT64_MAX)
+		/*
+		 * MSVC has no C99 support, and thus it cannot be used to
+		 * compile liblzma. The liblzma API has to still be usable
+		 * from MSVC, so we need to define the required standard
+		 * integer types here.
+		 */
+#		if defined(_WIN32) && defined(_MSC_VER)
+			typedef unsigned __int8 uint8_t;
+			typedef unsigned __int32 uint32_t;
+			typedef unsigned __int64 uint64_t;
+#		else
+			/* Use the standard inttypes.h. */
+#			ifdef __cplusplus
+				/*
+				 * C99 sections 7.18.2 and 7.18.4 specify
+				 * that C++ implementations define the limit
+				 * and constant macros only if specifically
+				 * requested. Note that if you want the
+				 * format macros (PRIu64 etc.) too, you need
+				 * to define __STDC_FORMAT_MACROS before
+				 * including lzma.h, since re-including
+				 * inttypes.h with __STDC_FORMAT_MACROS
+				 * defined doesn't necessarily work.
+				 */
+#				ifndef __STDC_LIMIT_MACROS
+#					define __STDC_LIMIT_MACROS 1
+#				endif
+#				ifndef __STDC_CONSTANT_MACROS
+#					define __STDC_CONSTANT_MACROS 1
+#				endif
+#			endif
+
+#			include <inttypes.h>
+#		endif
+
+		/*
+		 * Some old systems have only the typedefs in inttypes.h, and
+		 * lack all the macros. For those systems, we need a few more
+		 * hacks. We assume that unsigned int is 32-bit and unsigned
+		 * long is either 32-bit or 64-bit. If these hacks aren't
+		 * enough, the application has to setup the types manually
+		 * before including lzma.h.
+		 */
+#		ifndef UINT32_C
+#			if defined(_WIN32) && defined(_MSC_VER)
+#				define UINT32_C(n) n ## UI32
+#			else
+#				define UINT32_C(n) n ## U
+#			endif
+#		endif
+
+#		ifndef UINT64_C
+#			if defined(_WIN32) && defined(_MSC_VER)
+#				define UINT64_C(n) n ## UI64
+#			else
+				/* Get ULONG_MAX. */
+#				include <limits.h>
+#				if ULONG_MAX == 4294967295UL
+#					define UINT64_C(n) n ## ULL
+#				else
+#					define UINT64_C(n) n ## UL
+#				endif
+#			endif
+#		endif
+
+#		ifndef UINT32_MAX
+#			define UINT32_MAX (UINT32_C(4294967295))
+#		endif
+
+#		ifndef UINT64_MAX
+#			define UINT64_MAX (UINT64_C(18446744073709551615))
+#		endif
+#	endif
+#endif /* ifdef LZMA_MANUAL_HEADERS */
+
+
+/******************
+ * LZMA_API macro *
+ ******************/
+
+/*
+ * Some systems require that the functions and function pointers are
+ * declared specially in the headers. LZMA_API_IMPORT is for importing
+ * symbols and LZMA_API_CALL is to specify the calling convention.
+ *
+ * By default it is assumed that the application will link dynamically
+ * against liblzma. #define LZMA_API_STATIC in your application if you
+ * want to link against static liblzma. If you don't care about portability
+ * to operating systems like Windows, or at least don't care about linking
+ * against static liblzma on them, don't worry about LZMA_API_STATIC. That
+ * is, most developers will never need to use LZMA_API_STATIC.
+ *
+ * The GCC variants are a special case on Windows (Cygwin and MinGW).
+ * We rely on GCC doing the right thing with its auto-import feature,
+ * and thus don't use __declspec(dllimport). This way developers don't
+ * need to worry about LZMA_API_STATIC. Also the calling convention is
+ * omitted on Cygwin but not on MinGW.
+ */
+#ifndef LZMA_API_IMPORT
+#	if !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__GNUC__)
+#		define LZMA_API_IMPORT __declspec(dllimport)
+#	else
+#		define LZMA_API_IMPORT
+#	endif
+#endif
+
+#ifndef LZMA_API_CALL
+#	if defined(_WIN32) && !defined(__CYGWIN__)
+#		define LZMA_API_CALL __cdecl
+#	else
+#		define LZMA_API_CALL
+#	endif
+#endif
+
+#ifndef LZMA_API
+#	define LZMA_API(type) LZMA_API_IMPORT type LZMA_API_CALL
+#endif
+
+
+/***********
+ * nothrow *
+ ***********/
+
+/*
+ * None of the functions in liblzma may throw an exception. Even
+ * the functions that use callback functions won't throw exceptions,
+ * because liblzma would break if a callback function threw an exception.
+ */
+#ifndef lzma_nothrow
+#	if defined(__cplusplus)
+#		define lzma_nothrow throw()
+#	elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
+#		define lzma_nothrow __attribute__((__nothrow__))
+#	else
+#		define lzma_nothrow
+#	endif
+#endif
+
+
+/********************
+ * GNU C extensions *
+ ********************/
+
+/*
+ * GNU C extensions are used conditionally in the public API. It doesn't
+ * break anything if these are sometimes enabled and sometimes not, only
+ * affects warnings and optimizations.
+ */
+#if __GNUC__ >= 3
+#	ifndef lzma_attribute
+#		define lzma_attribute(attr) __attribute__(attr)
+#	endif
+
+	/* warn_unused_result was added in GCC 3.4. */
+#	ifndef lzma_attr_warn_unused_result
+#		if __GNUC__ == 3 && __GNUC_MINOR__ < 4
+#			define lzma_attr_warn_unused_result
+#		endif
+#	endif
+
+#else
+#	ifndef lzma_attribute
+#		define lzma_attribute(attr)
+#	endif
+#endif
+
+
+#ifndef lzma_attr_pure
+#	define lzma_attr_pure lzma_attribute((__pure__))
+#endif
+
+#ifndef lzma_attr_const
+#	define lzma_attr_const lzma_attribute((__const__))
+#endif
+
+#ifndef lzma_attr_warn_unused_result
+#	define lzma_attr_warn_unused_result \
+		lzma_attribute((__warn_unused_result__))
+#endif
+
+
+/**************
+ * Subheaders *
+ **************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Subheaders check that this is defined. It is to prevent including
+ * them directly from applications.
+ */
+#define LZMA_H_INTERNAL 1
+
+/* Basic features */
+#include "lzma/version.h"
+#include "lzma/base.h"
+#include "lzma/vli.h"
+#include "lzma/check.h"
+
+/* Filters */
+#include "lzma/filter.h"
+#include "lzma/bcj.h"
+#include "lzma/delta.h"
+#include "lzma/lzma12.h"
+
+/* Container formats */
+#include "lzma/container.h"
+
+/* Advanced features */
+#include "lzma/stream_flags.h"
+#include "lzma/block.h"
+#include "lzma/index.h"
+#include "lzma/index_hash.h"
+
+/* Hardware information */
+#include "lzma/hardware.h"
+
+/*
+ * All subheaders included. Undefine LZMA_H_INTERNAL to prevent applications
+ * re-including the subheaders.
+ */
+#undef LZMA_H_INTERNAL
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef LZMA_H */

Property changes on: lab4/.minix-src/include/lzma.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lualib.h
===================================================================
--- lab4/.minix-src/include/lualib.h	(nonexistent)
+++ lab4/.minix-src/include/lualib.h	(revision 13)
@@ -0,0 +1,60 @@
+/*	$NetBSD: lualib.h,v 1.2 2014/07/19 18:38:34 lneto Exp $	*/
+
+/*
+** $Id: lualib.h,v 1.2 2014/07/19 18:38:34 lneto Exp $
+** Lua standard libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lualib_h
+#define lualib_h
+
+#include "lua.h"
+
+
+
+LUAMOD_API int (luaopen_base) (lua_State *L);
+
+#define LUA_COLIBNAME	"coroutine"
+LUAMOD_API int (luaopen_coroutine) (lua_State *L);
+
+#define LUA_TABLIBNAME	"table"
+LUAMOD_API int (luaopen_table) (lua_State *L);
+
+#define LUA_IOLIBNAME	"io"
+LUAMOD_API int (luaopen_io) (lua_State *L);
+
+#define LUA_OSLIBNAME	"os"
+LUAMOD_API int (luaopen_os) (lua_State *L);
+
+#define LUA_STRLIBNAME	"string"
+LUAMOD_API int (luaopen_string) (lua_State *L);
+
+#define LUA_UTF8LIBNAME	"utf8"
+LUAMOD_API int (luaopen_utf8) (lua_State *L);
+
+#define LUA_BITLIBNAME	"bit32"
+LUAMOD_API int (luaopen_bit32) (lua_State *L);
+
+#define LUA_MATHLIBNAME	"math"
+LUAMOD_API int (luaopen_math) (lua_State *L);
+
+#define LUA_DBLIBNAME	"debug"
+LUAMOD_API int (luaopen_debug) (lua_State *L);
+
+#define LUA_LOADLIBNAME	"package"
+LUAMOD_API int (luaopen_package) (lua_State *L);
+
+
+/* open all previous libraries */
+LUALIB_API void (luaL_openlibs) (lua_State *L);
+
+
+
+#if !defined(lua_assert)
+#define lua_assert(x)	((void)0)
+#endif
+
+
+#endif

Property changes on: lab4/.minix-src/include/lualib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lua.h
===================================================================
--- lab4/.minix-src/include/lua.h	(nonexistent)
+++ lab4/.minix-src/include/lua.h	(revision 13)
@@ -0,0 +1,522 @@
+/*	$NetBSD: lua.h,v 1.5 2015/10/08 13:21:00 mbalmer Exp $	*/
+
+/*
+** Id: lua.h,v 1.328 2015/06/03 13:03:38 roberto Exp 
+** Lua - A Scripting Language
+** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
+** See Copyright Notice at the end of this file
+*/
+
+
+#ifndef lua_h
+#define lua_h
+
+#include <stdarg.h>
+#ifndef _KERNEL
+#include <stddef.h>
+#endif
+
+
+#include "luaconf.h"
+
+
+#define LUA_VERSION_MAJOR	"5"
+#define LUA_VERSION_MINOR	"3"
+#define LUA_VERSION_NUM		503
+#ifndef _KERNEL
+#define LUA_VERSION_RELEASE	"1"
+#else /* _KERNEL */
+#define LUA_VERSION_RELEASE	"1 (kernel)"
+#endif
+
+#define LUA_VERSION	"Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
+#define LUA_RELEASE	LUA_VERSION "." LUA_VERSION_RELEASE
+#ifndef _KERNEL
+#define LUA_COPYRIGHT	LUA_RELEASE "  Copyright (C) 1994-2015 Lua.org, PUC-Rio"
+#else /* _KERNEL */
+#define LUA_COPYRIGHT	LUA_RELEASE \
+	"  Copyright (c) 2015, Lourival Vieira Neto <lneto@NetBSD.org>." \
+	"  Copyright (C) 1994-2015 Lua.org, PUC-Rio"
+#endif
+#define LUA_AUTHORS	"R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
+
+
+/* mark for precompiled code ('<esc>Lua') */
+#define LUA_SIGNATURE	"\x1bLua"
+
+/* option for multiple returns in 'lua_pcall' and 'lua_call' */
+#define LUA_MULTRET	(-1)
+
+
+/*
+** Pseudo-indices
+** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty
+** space after that to help overflow detection)
+*/
+#define LUA_REGISTRYINDEX	(-LUAI_MAXSTACK - 1000)
+#define lua_upvalueindex(i)	(LUA_REGISTRYINDEX - (i))
+
+
+/* thread status */
+#define LUA_OK		0
+#define LUA_YIELD	1
+#define LUA_ERRRUN	2
+#define LUA_ERRSYNTAX	3
+#define LUA_ERRMEM	4
+#define LUA_ERRGCMM	5
+#define LUA_ERRERR	6
+
+
+typedef struct lua_State lua_State;
+
+
+/*
+** basic types
+*/
+#define LUA_TNONE		(-1)
+
+#define LUA_TNIL		0
+#define LUA_TBOOLEAN		1
+#define LUA_TLIGHTUSERDATA	2
+#define LUA_TNUMBER		3
+#define LUA_TSTRING		4
+#define LUA_TTABLE		5
+#define LUA_TFUNCTION		6
+#define LUA_TUSERDATA		7
+#define LUA_TTHREAD		8
+
+#define LUA_NUMTAGS		9
+
+
+
+/* minimum Lua stack available to a C function */
+#define LUA_MINSTACK	20
+
+
+/* predefined values in the registry */
+#define LUA_RIDX_MAINTHREAD	1
+#define LUA_RIDX_GLOBALS	2
+#define LUA_RIDX_LAST		LUA_RIDX_GLOBALS
+
+
+/* type of numbers in Lua */
+typedef LUA_NUMBER lua_Number;
+
+
+/* type for integer functions */
+typedef LUA_INTEGER lua_Integer;
+
+/* unsigned integer type */
+typedef LUA_UNSIGNED lua_Unsigned;
+
+/* type for continuation-function contexts */
+typedef LUA_KCONTEXT lua_KContext;
+
+
+/*
+** Type for C functions registered with Lua
+*/
+typedef int (*lua_CFunction) (lua_State *L);
+
+/*
+** Type for continuation functions
+*/
+typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);
+
+
+/*
+** Type for functions that read/write blocks when loading/dumping Lua chunks
+*/
+typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
+
+typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud);
+
+
+/*
+** Type for memory-allocation functions
+*/
+typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
+
+
+
+/*
+** generic extra include file
+*/
+#if defined(LUA_USER_H)
+#include LUA_USER_H
+#endif
+
+
+/*
+** RCS ident string
+*/
+extern const char lua_ident[];
+
+
+/*
+** state manipulation
+*/
+LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
+LUA_API void       (lua_close) (lua_State *L);
+LUA_API lua_State *(lua_newthread) (lua_State *L);
+
+LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
+
+
+LUA_API const lua_Number *(lua_version) (lua_State *L);
+
+
+/*
+** basic stack manipulation
+*/
+LUA_API int   (lua_absindex) (lua_State *L, int idx);
+LUA_API int   (lua_gettop) (lua_State *L);
+LUA_API void  (lua_settop) (lua_State *L, int idx);
+LUA_API void  (lua_pushvalue) (lua_State *L, int idx);
+LUA_API void  (lua_rotate) (lua_State *L, int idx, int n);
+LUA_API void  (lua_copy) (lua_State *L, int fromidx, int toidx);
+LUA_API int   (lua_checkstack) (lua_State *L, int n);
+
+LUA_API void  (lua_xmove) (lua_State *from, lua_State *to, int n);
+
+
+/*
+** access functions (stack -> C)
+*/
+
+LUA_API int             (lua_isnumber) (lua_State *L, int idx);
+LUA_API int             (lua_isstring) (lua_State *L, int idx);
+LUA_API int             (lua_iscfunction) (lua_State *L, int idx);
+LUA_API int             (lua_isinteger) (lua_State *L, int idx);
+LUA_API int             (lua_isuserdata) (lua_State *L, int idx);
+LUA_API int             (lua_type) (lua_State *L, int idx);
+LUA_API const char     *(lua_typename) (lua_State *L, int tp);
+
+#ifndef _KERNEL
+LUA_API lua_Number      (lua_tonumberx) (lua_State *L, int idx, int *isnum);
+#else /* _KERNEL */
+#define lua_tonumberx	(lua_Integer) lua_tointegerx
+#endif
+LUA_API lua_Integer     (lua_tointegerx) (lua_State *L, int idx, int *isnum);
+LUA_API int             (lua_toboolean) (lua_State *L, int idx);
+LUA_API const char     *(lua_tolstring) (lua_State *L, int idx, size_t *len);
+LUA_API size_t          (lua_rawlen) (lua_State *L, int idx);
+LUA_API lua_CFunction   (lua_tocfunction) (lua_State *L, int idx);
+LUA_API void	       *(lua_touserdata) (lua_State *L, int idx);
+LUA_API lua_State      *(lua_tothread) (lua_State *L, int idx);
+LUA_API const void     *(lua_topointer) (lua_State *L, int idx);
+
+
+/*
+** Comparison and arithmetic functions
+*/
+
+#define LUA_OPADD	0	/* ORDER TM, ORDER OP */
+#define LUA_OPSUB	1
+#define LUA_OPMUL	2
+#define LUA_OPMOD	3
+#ifndef _KERNEL
+#define LUA_OPPOW	4
+#define LUA_OPDIV	5
+#define LUA_OPIDIV	6
+#define LUA_OPBAND	7
+#define LUA_OPBOR	8
+#define LUA_OPBXOR	9
+#define LUA_OPSHL	10
+#define LUA_OPSHR	11
+#define LUA_OPUNM	12
+#define LUA_OPBNOT	13
+#else /* _KERNEL */
+#define LUA_OPIDIV	4
+#define LUA_OPBAND	5
+#define LUA_OPBOR	6
+#define LUA_OPBXOR	7
+#define LUA_OPSHL	8
+#define LUA_OPSHR	9
+#define LUA_OPUNM	10
+#define LUA_OPBNOT	11
+#endif
+
+LUA_API void  (lua_arith) (lua_State *L, int op);
+
+#define LUA_OPEQ	0
+#define LUA_OPLT	1
+#define LUA_OPLE	2
+
+LUA_API int   (lua_rawequal) (lua_State *L, int idx1, int idx2);
+LUA_API int   (lua_compare) (lua_State *L, int idx1, int idx2, int op);
+
+
+/*
+** push functions (C -> stack)
+*/
+LUA_API void        (lua_pushnil) (lua_State *L);
+#ifndef _KERNEL
+LUA_API void        (lua_pushnumber) (lua_State *L, lua_Number n);
+#else /* _KERNEL */
+#define lua_pushnumber(L, n)	lua_pushinteger(L, (lua_Integer)(n))
+#endif
+LUA_API void        (lua_pushinteger) (lua_State *L, lua_Integer n);
+LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len);
+LUA_API const char *(lua_pushstring) (lua_State *L, const char *s);
+LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
+                                                      va_list argp);
+LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
+LUA_API void  (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
+LUA_API void  (lua_pushboolean) (lua_State *L, int b);
+LUA_API void  (lua_pushlightuserdata) (lua_State *L, void *p);
+LUA_API int   (lua_pushthread) (lua_State *L);
+
+
+/*
+** get functions (Lua -> stack)
+*/
+LUA_API int (lua_getglobal) (lua_State *L, const char *name);
+LUA_API int (lua_gettable) (lua_State *L, int idx);
+LUA_API int (lua_getfield) (lua_State *L, int idx, const char *k);
+LUA_API int (lua_geti) (lua_State *L, int idx, lua_Integer n);
+LUA_API int (lua_rawget) (lua_State *L, int idx);
+LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n);
+LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p);
+
+LUA_API void  (lua_createtable) (lua_State *L, int narr, int nrec);
+LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
+LUA_API int   (lua_getmetatable) (lua_State *L, int objindex);
+LUA_API int  (lua_getuservalue) (lua_State *L, int idx);
+
+
+/*
+** set functions (stack -> Lua)
+*/
+LUA_API void  (lua_setglobal) (lua_State *L, const char *name);
+LUA_API void  (lua_settable) (lua_State *L, int idx);
+LUA_API void  (lua_setfield) (lua_State *L, int idx, const char *k);
+LUA_API void  (lua_seti) (lua_State *L, int idx, lua_Integer n);
+LUA_API void  (lua_rawset) (lua_State *L, int idx);
+LUA_API void  (lua_rawseti) (lua_State *L, int idx, lua_Integer n);
+LUA_API void  (lua_rawsetp) (lua_State *L, int idx, const void *p);
+LUA_API int   (lua_setmetatable) (lua_State *L, int objindex);
+LUA_API void  (lua_setuservalue) (lua_State *L, int idx);
+
+
+/*
+** 'load' and 'call' functions (load and run Lua code)
+*/
+LUA_API void  (lua_callk) (lua_State *L, int nargs, int nresults,
+                           lua_KContext ctx, lua_KFunction k);
+#define lua_call(L,n,r)		lua_callk(L, (n), (r), 0, NULL)
+
+LUA_API int   (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
+                            lua_KContext ctx, lua_KFunction k);
+#define lua_pcall(L,n,r,f)	lua_pcallk(L, (n), (r), (f), 0, NULL)
+
+LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
+                          const char *chunkname, const char *mode);
+
+LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip);
+
+
+/*
+** coroutine functions
+*/
+LUA_API int  (lua_yieldk)     (lua_State *L, int nresults, lua_KContext ctx,
+                               lua_KFunction k);
+LUA_API int  (lua_resume)     (lua_State *L, lua_State *from, int narg);
+LUA_API int  (lua_status)     (lua_State *L);
+LUA_API int (lua_isyieldable) (lua_State *L);
+
+#define lua_yield(L,n)		lua_yieldk(L, (n), 0, NULL)
+
+
+/*
+** garbage-collection function and options
+*/
+
+#define LUA_GCSTOP		0
+#define LUA_GCRESTART		1
+#define LUA_GCCOLLECT		2
+#define LUA_GCCOUNT		3
+#define LUA_GCCOUNTB		4
+#define LUA_GCSTEP		5
+#define LUA_GCSETPAUSE		6
+#define LUA_GCSETSTEPMUL	7
+#define LUA_GCISRUNNING		9
+
+LUA_API int (lua_gc) (lua_State *L, int what, int data);
+
+
+/*
+** miscellaneous functions
+*/
+
+LUA_API int   (lua_error) (lua_State *L);
+
+LUA_API int   (lua_next) (lua_State *L, int idx);
+
+LUA_API void  (lua_concat) (lua_State *L, int n);
+LUA_API void  (lua_len)    (lua_State *L, int idx);
+
+LUA_API size_t   (lua_stringtonumber) (lua_State *L, const char *s);
+
+LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
+LUA_API void      (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
+
+
+
+/*
+** {==============================================================
+** some useful macros
+** ===============================================================
+*/
+
+#define lua_getextraspace(L)	((void *)((char *)(L) - LUA_EXTRASPACE))
+
+#define lua_tonumber(L,i)	lua_tonumberx(L,(i),NULL)
+#define lua_tointeger(L,i)	lua_tointegerx(L,(i),NULL)
+
+#define lua_pop(L,n)		lua_settop(L, -(n)-1)
+
+#define lua_newtable(L)		lua_createtable(L, 0, 0)
+
+#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
+
+#define lua_pushcfunction(L,f)	lua_pushcclosure(L, (f), 0)
+
+#define lua_isfunction(L,n)	(lua_type(L, (n)) == LUA_TFUNCTION)
+#define lua_istable(L,n)	(lua_type(L, (n)) == LUA_TTABLE)
+#define lua_islightuserdata(L,n)	(lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
+#define lua_isnil(L,n)		(lua_type(L, (n)) == LUA_TNIL)
+#define lua_isboolean(L,n)	(lua_type(L, (n)) == LUA_TBOOLEAN)
+#define lua_isthread(L,n)	(lua_type(L, (n)) == LUA_TTHREAD)
+#define lua_isnone(L,n)		(lua_type(L, (n)) == LUA_TNONE)
+#define lua_isnoneornil(L, n)	(lua_type(L, (n)) <= 0)
+
+#define lua_pushliteral(L, s)	lua_pushstring(L, "" s)
+
+#define lua_pushglobaltable(L)  \
+	lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS)
+
+#define lua_tostring(L,i)	lua_tolstring(L, (i), NULL)
+
+
+#define lua_insert(L,idx)	lua_rotate(L, (idx), 1)
+
+#define lua_remove(L,idx)	(lua_rotate(L, (idx), -1), lua_pop(L, 1))
+
+#define lua_replace(L,idx)	(lua_copy(L, -1, (idx)), lua_pop(L, 1))
+
+/* }============================================================== */
+
+
+/*
+** {==============================================================
+** compatibility macros for unsigned conversions
+** ===============================================================
+*/
+#if defined(LUA_COMPAT_APIINTCASTS)
+
+#define lua_pushunsigned(L,n)	lua_pushinteger(L, (lua_Integer)(n))
+#define lua_tounsignedx(L,i,is)	((lua_Unsigned)lua_tointegerx(L,i,is))
+#define lua_tounsigned(L,i)	lua_tounsignedx(L,(i),NULL)
+
+#endif
+/* }============================================================== */
+
+/*
+** {======================================================================
+** Debug API
+** =======================================================================
+*/
+
+
+/*
+** Event codes
+*/
+#define LUA_HOOKCALL	0
+#define LUA_HOOKRET	1
+#define LUA_HOOKLINE	2
+#define LUA_HOOKCOUNT	3
+#define LUA_HOOKTAILCALL 4
+
+
+/*
+** Event masks
+*/
+#define LUA_MASKCALL	(1 << LUA_HOOKCALL)
+#define LUA_MASKRET	(1 << LUA_HOOKRET)
+#define LUA_MASKLINE	(1 << LUA_HOOKLINE)
+#define LUA_MASKCOUNT	(1 << LUA_HOOKCOUNT)
+
+typedef struct lua_Debug lua_Debug;  /* activation record */
+
+
+/* Functions to be called by the debugger in specific events */
+typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
+
+
+LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar);
+LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);
+LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n);
+LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n);
+LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n);
+LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n);
+
+LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n);
+LUA_API void  (lua_upvaluejoin) (lua_State *L, int fidx1, int n1,
+                                               int fidx2, int n2);
+
+LUA_API void (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count);
+LUA_API lua_Hook (lua_gethook) (lua_State *L);
+LUA_API int (lua_gethookmask) (lua_State *L);
+LUA_API int (lua_gethookcount) (lua_State *L);
+
+
+struct lua_Debug {
+  int event;
+  const char *name;	/* (n) */
+  const char *namewhat;	/* (n) 'global', 'local', 'field', 'method' */
+  const char *what;	/* (S) 'Lua', 'C', 'main', 'tail' */
+  const char *source;	/* (S) */
+  int currentline;	/* (l) */
+  int linedefined;	/* (S) */
+  int lastlinedefined;	/* (S) */
+  unsigned char nups;	/* (u) number of upvalues */
+  unsigned char nparams;/* (u) number of parameters */
+  char isvararg;        /* (u) */
+  char istailcall;	/* (t) */
+  char short_src[LUA_IDSIZE]; /* (S) */
+  /* private part */
+  struct CallInfo *i_ci;  /* active function */
+};
+
+/* }====================================================================== */
+
+
+/******************************************************************************
+#ifdef _KERNEL
+* Copyright (c) 2015, Lourival Vieira Neto <lneto@NetBSD.org>.
+#endif
+* Copyright (C) 1994-2015 Lua.org, PUC-Rio.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, sublicense, and/or sell copies of the Software, and to
+* permit persons to whom the Software is furnished to do so, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be
+* included in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+******************************************************************************/
+
+
+#endif

Property changes on: lab4/.minix-src/include/lua.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uvm/uvm_prot.h
===================================================================
--- lab4/.minix-src/include/uvm/uvm_prot.h	(nonexistent)
+++ lab4/.minix-src/include/uvm/uvm_prot.h	(revision 13)
@@ -0,0 +1,100 @@
+/*	$NetBSD: uvm_prot.h,v 1.4 2005/12/11 12:25:29 christos Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * The Mach Operating System project at Carnegie-Mellon University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vm_prot.h	8.1 (Berkeley) 6/11/93
+ *
+ *
+ * Copyright (c) 1987, 1990 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Authors: Avadis Tevanian, Jr., Michael Wayne Young
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ *	Virtual memory protection definitions.
+ */
+
+#ifndef	_UVM_PROT_
+#define	_UVM_PROT_
+
+/*
+ *	Types defined:
+ *
+ *	vm_prot_t		VM protection values.
+ */
+
+typedef int		vm_prot_t;
+
+/*
+ *	Protection values, defined as bits within the vm_prot_t type
+ */
+
+#define	VM_PROT_NONE	((vm_prot_t) 0x00)
+
+#define VM_PROT_READ	((vm_prot_t) 0x01)	/* read permission */
+#define VM_PROT_WRITE	((vm_prot_t) 0x02)	/* write permission */
+#define VM_PROT_EXECUTE	((vm_prot_t) 0x04)	/* execute permission */
+
+/*
+ *	The default protection for newly-created virtual memory
+ */
+
+#define VM_PROT_DEFAULT	(VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
+
+/*
+ *	The maximum privileges possible, for parameter checking.
+ */
+
+#define VM_PROT_ALL	(VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
+
+#endif /* _UVM_PROT_ */

Property changes on: lab4/.minix-src/include/uvm/uvm_prot.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/math.h
===================================================================
--- lab4/.minix-src/include/math.h	(nonexistent)
+++ lab4/.minix-src/include/math.h	(revision 13)
@@ -0,0 +1,585 @@
+/*	$NetBSD: math.h,v 1.63 2013/09/16 15:54:42 martin Exp $	*/
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * @(#)fdlibm.h 5.1 93/09/24
+ */
+
+#ifndef _MATH_H_
+#define _MATH_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+union __float_u {
+	unsigned char __dummy[sizeof(float)];
+	float __val;
+};
+
+union __double_u {
+	unsigned char __dummy[sizeof(double)];
+	double __val;
+};
+
+union __long_double_u {
+	unsigned char __dummy[sizeof(long double)];
+	long double __val;
+};
+
+#include <machine/math.h>		/* may use __float_u, __double_u,
+					   or __long_double_u */
+#include <limits.h>			/* for INT_{MIN,MAX} */
+
+#if ((_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE))
+#  if defined(__FLT_EVAL_METHOD__) && (__FLT_EVAL_METHOD__ - 0) == 0
+typedef double double_t;
+typedef float float_t;
+#  elif (__FLT_EVAL_METHOD__ - 0) == 1
+typedef double double_t;
+typedef double float_t;
+#  elif (__FLT_EVAL_METHOD__ - 0) == 2
+typedef long double double_t;
+typedef long double float_t;
+#  endif
+#endif
+
+#ifdef __HAVE_LONG_DOUBLE
+#define	__fpmacro_unary_floating(__name, __arg0)			\
+	/* LINTED */							\
+	((sizeof (__arg0) == sizeof (float))				\
+	?	__ ## __name ## f (__arg0)				\
+	: (sizeof (__arg0) == sizeof (double))				\
+	?	__ ## __name ## d (__arg0)				\
+	:	__ ## __name ## l (__arg0))
+#else
+#define	__fpmacro_unary_floating(__name, __arg0)			\
+	/* LINTED */							\
+	((sizeof (__arg0) == sizeof (float))				\
+	?	__ ## __name ## f (__arg0)				\
+	:	__ ## __name ## d (__arg0))
+#endif /* __HAVE_LONG_DOUBLE */
+
+/*
+ * ANSI/POSIX
+ */
+/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
+#if __GNUC_PREREQ__(3, 3)
+#define HUGE_VAL	__builtin_huge_val()
+#else
+extern const union __double_u __infinity;
+#define HUGE_VAL	__infinity.__val
+#endif
+
+/*
+ * ISO C99
+ */
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+    !defined(_XOPEN_SOURCE) || \
+    ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    ((_XOPEN_SOURCE  - 0) >= 600) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
+#if __GNUC_PREREQ__(3, 3)
+#define	HUGE_VALF	__builtin_huge_valf()
+#define	HUGE_VALL	__builtin_huge_vall()
+#else
+extern const union __float_u __infinityf;
+#define	HUGE_VALF	__infinityf.__val
+
+extern const union __long_double_u __infinityl;
+#define	HUGE_VALL	__infinityl.__val
+#endif
+
+/* 7.12#4 INFINITY */
+#if defined(__INFINITY)
+#define	INFINITY	__INFINITY	/* float constant which overflows */
+#elif __GNUC_PREREQ__(3, 3)
+#define	INFINITY	__builtin_inff()
+#else
+#define	INFINITY	HUGE_VALF	/* positive infinity */
+#endif /* __INFINITY */
+
+/* 7.12#5 NAN: a quiet NaN, if supported */
+#ifdef __HAVE_NANF
+#if __GNUC_PREREQ__(3,3)
+#define	NAN	__builtin_nanf("")
+#else
+extern const union __float_u __nanf;
+#define	NAN		__nanf.__val
+#endif
+#endif /* __HAVE_NANF */
+
+/* 7.12#6 number classification macros */
+#define	FP_INFINITE	0x00
+#define	FP_NAN		0x01
+#define	FP_NORMAL	0x02
+#define	FP_SUBNORMAL	0x03
+#define	FP_ZERO		0x04
+/* NetBSD extensions */
+#define	_FP_LOMD	0x80		/* range for machine-specific classes */
+#define	_FP_HIMD	0xff
+
+#define	FP_ILOGB0	INT_MIN
+#define	FP_ILOGBNAN	INT_MAX
+
+#endif /* !_ANSI_SOURCE && ... */
+
+/*
+ * XOPEN/SVID
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define	M_E		2.7182818284590452354	/* e */
+#define	M_LOG2E		1.4426950408889634074	/* log 2e */
+#define	M_LOG10E	0.43429448190325182765	/* log 10e */
+#define	M_LN2		0.69314718055994530942	/* log e2 */
+#define	M_LN10		2.30258509299404568402	/* log e10 */
+#define	M_PI		3.14159265358979323846	/* pi */
+#define	M_PI_2		1.57079632679489661923	/* pi/2 */
+#define	M_PI_4		0.78539816339744830962	/* pi/4 */
+#define	M_1_PI		0.31830988618379067154	/* 1/pi */
+#define	M_2_PI		0.63661977236758134308	/* 2/pi */
+#define	M_2_SQRTPI	1.12837916709551257390	/* 2/sqrt(pi) */
+#define	M_SQRT2		1.41421356237309504880	/* sqrt(2) */
+#define	M_SQRT1_2	0.70710678118654752440	/* 1/sqrt(2) */
+
+#define	MAXFLOAT	((float)3.40282346638528860e+38)
+extern int signgam;
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE)
+enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
+
+#define _LIB_VERSION_TYPE enum fdversion
+#define _LIB_VERSION _fdlib_version
+
+/* if global variable _LIB_VERSION is not desirable, one may
+ * change the following to be a constant by:
+ *	#define _LIB_VERSION_TYPE const enum version
+ * In that case, after one initializes the value _LIB_VERSION (see
+ * s_lib_version.c) during compile time, it cannot be modified
+ * in the middle of a program
+ */
+extern  _LIB_VERSION_TYPE  _LIB_VERSION;
+
+#define _IEEE_  fdlibm_ieee
+#define _SVID_  fdlibm_svid
+#define _XOPEN_ fdlibm_xopen
+#define _POSIX_ fdlibm_posix
+
+#ifndef __cplusplus
+struct exception {
+	int type;
+	const char *name;
+	double arg1;
+	double arg2;
+	double retval;
+};
+#endif
+
+#define	HUGE		MAXFLOAT
+
+/*
+ * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
+ * (one may replace the following line by "#include <values.h>")
+ */
+
+#define X_TLOSS		1.41484755040568800000e+16
+
+#define	DOMAIN		1
+#define	SING		2
+#define	OVERFLOW	3
+#define	UNDERFLOW	4
+#define	TLOSS		5
+#define	PLOSS		6
+
+#endif /* _NETBSD_SOURCE */
+
+__BEGIN_DECLS
+/*
+ * ANSI/POSIX
+ */
+double	acos(double);
+double	asin(double);
+double	atan(double);
+double	atan2(double, double);
+double	cos(double);
+double	sin(double);
+double	tan(double);
+
+double	cosh(double);
+double	sinh(double);
+double	tanh(double);
+
+double	exp(double);
+double	exp2(double);
+double	frexp(double, int *);
+double	ldexp(double, int);
+double	log(double);
+double	log2(double);
+double	log10(double);
+double	modf(double, double *);
+
+double	pow(double, double);
+double	sqrt(double);
+
+double	ceil(double);
+double	fabs(double);
+double	floor(double);
+double	fmod(double, double);
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+double	erf(double);
+double	erfc(double);
+double	gamma(double);
+double	hypot(double, double);
+int	finite(double);
+double	j0(double);
+double	j1(double);
+double	jn(int, double);
+double	lgamma(double);
+double	y0(double);
+double	y1(double);
+double	yn(int, double);
+
+#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+double	acosh(double);
+double	asinh(double);
+double	atanh(double);
+double	cbrt(double);
+double	expm1(double);
+int	ilogb(double);
+double	log1p(double);
+double	logb(double);
+double	nextafter(double, double);
+double	remainder(double, double);
+double	rint(double);
+double	scalb(double, double);
+#endif /* (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)*/
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+/*
+ * ISO C99
+ */
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+    !defined(_XOPEN_SOURCE) || \
+    ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    ((_XOPEN_SOURCE  - 0) >= 600) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+/* 7.12.3.1 int fpclassify(real-floating x) */
+#define	fpclassify(__x)	__fpmacro_unary_floating(fpclassify, __x)
+
+/* 7.12.3.2 int isfinite(real-floating x) */
+#define	isfinite(__x)	__fpmacro_unary_floating(isfinite, __x)
+
+/* 7.12.3.5 int isnormal(real-floating x) */
+#define	isnormal(__x)	(fpclassify(__x) == FP_NORMAL)
+
+/* 7.12.3.6 int signbit(real-floating x) */
+#define	signbit(__x)	__fpmacro_unary_floating(signbit, __x)
+
+/* 7.12.4 trigonometric */
+
+float	acosf(float);
+float	asinf(float);
+float	atanf(float);
+float	atan2f(float, float);
+float	cosf(float);
+float	sinf(float);
+float	tanf(float);
+
+long double	acosl(long double);
+long double	asinl(long double);
+long double	atanl(long double);
+long double	atan2l(long double, long double);
+long double	cosl(long double);
+long double	sinl(long double);
+long double	tanl(long double);
+
+/* 7.12.5 hyperbolic */
+
+float	acoshf(float);
+float	asinhf(float);
+float	atanhf(float);
+float	coshf(float);
+float	sinhf(float);
+float	tanhf(float);
+long double	acoshl(long double);
+long double	asinhl(long double);
+long double	atanhl(long double);
+long double	coshl(long double);
+long double	sinhl(long double);
+long double	tanhl(long double);
+
+/* 7.12.6 exp / log */
+
+float	expf(float);
+float	exp2f(float);
+float	expm1f(float);
+float	frexpf(float, int *);
+int	ilogbf(float);
+float	ldexpf(float, int);
+float	logf(float);
+float	log2f(float);
+float	log10f(float);
+float	log1pf(float);
+float	logbf(float);
+float	modff(float, float *);
+float	scalbnf(float, int);
+float	scalblnf(float, long);
+
+long double	expl(long double);
+long double	exp2l(long double);
+long double	expm1l(long double);
+long double	frexpl(long double, int *);
+int		ilogbl(long double);
+long double	ldexpl(long double, int);
+long double	logl(long double);
+long double	log2l(long double);
+long double	log10l(long double);
+long double	log1pl(long double);
+long double	logbl(long double);
+long double	modfl(long double, long double *);
+long double	scalbnl(long double, int);
+long double	scalblnl(long double, long);
+
+
+/* 7.12.7 power / absolute */
+
+float	cbrtf(float);
+float	fabsf(float);
+float	hypotf(float, float);
+float	powf(float, float);
+float	sqrtf(float);
+long double	cbrtl(long double);
+long double	fabsl(long double);
+long double	hypotl(long double, long double);
+long double	powl(long double, long double);
+long double	sqrtl(long double);
+
+/* 7.12.8 error / gamma */
+
+double	tgamma(double);
+float	erff(float);
+float	erfcf(float);
+float	lgammaf(float);
+float	tgammaf(float);
+long double	erfl(long double);
+long double	erfcl(long double);
+long double	lgammal(long double);
+long double	tgammal(long double);
+
+/* 7.12.9 nearest integer */
+
+/* LONGLONG */
+long long int	llrint(double);
+long int	lround(double);
+/* LONGLONG */
+long long int	llround(double);
+long int	lrint(double);
+double	round(double);
+double	trunc(double);
+
+float	ceilf(float);
+float	floorf(float);
+/* LONGLONG */
+long long int	llrintf(float);
+long int	lroundf(float);
+/* LONGLONG */
+long long int	llroundf(float);
+long int	lrintf(float);
+float	rintf(float);
+float	roundf(float);
+float	truncf(float);
+long double	ceill(long double);
+long double	floorl(long double);
+/* LONGLONG */
+long long int	llrintl(long double);
+long int	lroundl(long double);
+/* LONGLONG */
+long long int	llroundl(long double);
+long int	lrintl(long double);
+long double	rintl(long double);
+long double	roundl(long double);
+long double	truncl(long double);
+
+/* 7.12.10 remainder */
+
+float	fmodf(float, float);
+float	remainderf(float, float);
+long double	fmodl(long double, long double);
+long double	remainderl(long double, long double);
+
+/* 7.12.10.3 The remquo functions */
+double	remquo(double, double, int *);
+float	remquof(float, float, int *);
+long double	remquol(long double, long double, int *);
+
+/* 7.12.11 manipulation */
+
+double	nan(const char *);
+double	nearbyint(double);
+double	nexttoward(double, long double);
+float	copysignf(float, float);
+float	nanf(const char *);
+float	nearbyintf(float);
+float	nextafterf(float, float);
+float	nexttowardf(float, long double);
+long double	copysignl(long double, long double);
+long double	nanl(const char *);
+long double	nearbyintl(long double);
+long double     nextafterl(long double, long double);
+long double	nexttowardl(long double, long double);
+
+/* 7.12.14 comparison */
+
+#define isunordered(x, y)	(isnan(x) || isnan(y))
+#define isgreater(x, y)		(!isunordered((x), (y)) && (x) > (y))
+#define isgreaterequal(x, y)	(!isunordered((x), (y)) && (x) >= (y))
+#define isless(x, y)		(!isunordered((x), (y)) && (x) < (y))
+#define islessequal(x, y)	(!isunordered((x), (y)) && (x) <= (y))
+#define islessgreater(x, y)	(!isunordered((x), (y)) && \
+				 ((x) > (y) || (y) > (x)))
+double	fdim(double, double);
+double	fma(double, double, double);
+double	fmax(double, double);
+double	fmin(double, double);
+float	fdimf(float, float);
+float	fmaf(float, float, float);
+float	fmaxf(float, float);
+float	fminf(float, float);
+long double fdiml(long double, long double);
+long double fmal(long double, long double, long double);
+long double fmaxl(long double, long double);
+long double fminl(long double, long double);
+
+#endif /* !_ANSI_SOURCE && ... */
+
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) || \
+    !defined(_XOPEN_SOURCE) || \
+    ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+/* 7.12.3.3 int isinf(real-floating x) */
+#if defined(__isinf) || defined(__HAVE_INLINE___ISINF)
+#define	isinf(__x)	__isinf(__x)
+#else
+#define	isinf(__x)	__fpmacro_unary_floating(isinf, __x)
+#endif
+
+/* 7.12.3.4 int isnan(real-floating x) */
+#if defined(__isnan) || defined(__HAVE_INLINE___ISNAN)
+#define	isnan(__x)	__isnan(__x)
+#else
+#define	isnan(__x)	__fpmacro_unary_floating(isnan, __x)
+#endif
+#endif /* !_ANSI_SOURCE && ... */
+
+#if defined(_NETBSD_SOURCE)
+#ifndef __cplusplus
+int	matherr(struct exception *);
+#endif
+
+/*
+ * IEEE Test Vector
+ */
+double	significand(double);
+
+/*
+ * Functions callable from C, intended to support IEEE arithmetic.
+ */
+double	copysign(double, double);
+double	scalbn(double, int);
+double	scalbln(double, long);
+
+/*
+ * BSD math library entry points
+ */
+double	drem(double, double);
+
+#endif /* _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)
+/*
+ * Reentrant version of gamma & lgamma; passes signgam back by reference
+ * as the second argument; user must allocate space for signgam.
+ */
+double	gamma_r(double, int *);
+double	lgamma_r(double, int *);
+#endif /* _NETBSD_SOURCE || _REENTRANT */
+
+
+#if defined(_NETBSD_SOURCE)
+
+/* float versions of ANSI/POSIX functions */
+
+float	gammaf(float);
+int	isinff(float);
+int	isnanf(float);
+int	finitef(float);
+float	j0f(float);
+float	j1f(float);
+float	jnf(int, float);
+float	y0f(float);
+float	y1f(float);
+float	ynf(int, float);
+
+float	scalbf(float, float);
+
+/*
+ * float version of IEEE Test Vector
+ */
+float	significandf(float);
+
+/*
+ * float versions of BSD math library entry points
+ */
+float	dremf(float, float);
+#endif /* _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)
+/*
+ * Float versions of reentrant version of gamma & lgamma; passes
+ * signgam back by reference as the second argument; user must
+ * allocate space for signgam.
+ */
+float	gammaf_r(float, int *);
+float	lgammaf_r(float, int *);
+#endif /* !... || _REENTRANT */
+
+/*
+ * Library implementation
+ */
+int	__fpclassifyf(float);
+int	__fpclassifyd(double);
+int	__isfinitef(float);
+int	__isfinited(double);
+int	__isinff(float);
+int	__isinfd(double);
+int	__isnanf(float);
+int	__isnand(double);
+int	__signbitf(float);
+int	__signbitd(double);
+
+#ifdef __HAVE_LONG_DOUBLE
+int	__fpclassifyl(long double);
+int	__isfinitel(long double);
+int	__isinfl(long double);
+int	__isnanl(long double);
+int	__signbitl(long double);
+#endif
+
+__END_DECLS
+
+#endif /* _MATH_H_ */

Property changes on: lab4/.minix-src/include/math.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/magic.h
===================================================================
--- lab4/.minix-src/include/magic.h	(nonexistent)
+++ lab4/.minix-src/include/magic.h	(revision 13)
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) Christos Zoulas 2003.
+ * 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 immediately at the beginning of the file, without modification,
+ *    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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _MAGIC_H
+#define _MAGIC_H
+
+#include <sys/types.h>
+
+#define	MAGIC_NONE		0x000000 /* No flags */
+#define	MAGIC_DEBUG		0x000001 /* Turn on debugging */
+#define	MAGIC_SYMLINK		0x000002 /* Follow symlinks */
+#define	MAGIC_COMPRESS		0x000004 /* Check inside compressed files */
+#define	MAGIC_DEVICES		0x000008 /* Look at the contents of devices */
+#define	MAGIC_MIME_TYPE		0x000010 /* Return the MIME type */
+#define	MAGIC_CONTINUE		0x000020 /* Return all matches */
+#define	MAGIC_CHECK		0x000040 /* Print warnings to stderr */
+#define	MAGIC_PRESERVE_ATIME	0x000080 /* Restore access time on exit */
+#define	MAGIC_RAW		0x000100 /* Don't translate unprintable chars */
+#define	MAGIC_ERROR		0x000200 /* Handle ENOENT etc as real errors */
+#define	MAGIC_MIME_ENCODING	0x000400 /* Return the MIME encoding */
+#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
+#define	MAGIC_APPLE		0x000800 /* Return the Apple creator and type */
+
+#define	MAGIC_NO_CHECK_COMPRESS	0x001000 /* Don't check for compressed files */
+#define	MAGIC_NO_CHECK_TAR	0x002000 /* Don't check for tar files */
+#define	MAGIC_NO_CHECK_SOFT	0x004000 /* Don't check magic entries */
+#define	MAGIC_NO_CHECK_APPTYPE	0x008000 /* Don't check application type */
+#define	MAGIC_NO_CHECK_ELF	0x010000 /* Don't check for elf details */
+#define	MAGIC_NO_CHECK_TEXT	0x020000 /* Don't check for text files */
+#define	MAGIC_NO_CHECK_CDF	0x040000 /* Don't check for cdf files */
+#define	MAGIC_NO_CHECK_TOKENS	0x100000 /* Don't check tokens */
+#define MAGIC_NO_CHECK_ENCODING 0x200000 /* Don't check text encodings */
+
+/* No built-in tests; only consult the magic file */
+#define MAGIC_NO_CHECK_BUILTIN	( \
+	MAGIC_NO_CHECK_COMPRESS	| \
+	MAGIC_NO_CHECK_TAR	| \
+/*	MAGIC_NO_CHECK_SOFT	| */ \
+	MAGIC_NO_CHECK_APPTYPE	| \
+	MAGIC_NO_CHECK_ELF	| \
+	MAGIC_NO_CHECK_TEXT	| \
+	MAGIC_NO_CHECK_CDF	| \
+	MAGIC_NO_CHECK_TOKENS	| \
+	MAGIC_NO_CHECK_ENCODING	| \
+	0			  \
+)
+
+/* Defined for backwards compatibility (renamed) */
+#define	MAGIC_NO_CHECK_ASCII	MAGIC_NO_CHECK_TEXT
+
+/* Defined for backwards compatibility; do nothing */
+#define	MAGIC_NO_CHECK_FORTRAN	0x000000 /* Don't check ascii/fortran */
+#define	MAGIC_NO_CHECK_TROFF	0x000000 /* Don't check ascii/troff */
+
+#define MAGIC_VERSION		522	/* This implementation */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct magic_set *magic_t;
+magic_t magic_open(int);
+void magic_close(magic_t);
+
+const char *magic_getpath(const char *, int);
+const char *magic_file(magic_t, const char *);
+const char *magic_descriptor(magic_t, int);
+const char *magic_buffer(magic_t, const void *, size_t);
+
+const char *magic_error(magic_t);
+int magic_setflags(magic_t, int);
+
+int magic_version(void);
+int magic_load(magic_t, const char *);
+int magic_load_buffers(magic_t, void **, size_t *, size_t);
+
+int magic_compile(magic_t, const char *);
+int magic_check(magic_t, const char *);
+int magic_list(magic_t, const char *);
+int magic_errno(magic_t);
+
+#define MAGIC_PARAM_INDIR_MAX		0
+#define MAGIC_PARAM_NAME_MAX		1
+#define MAGIC_PARAM_ELF_PHNUM_MAX	2
+#define MAGIC_PARAM_ELF_SHNUM_MAX	3
+#define MAGIC_PARAM_ELF_NOTES_MAX	4
+
+int magic_setparam(magic_t, int, const void *);
+int magic_getparam(magic_t, int, void *);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _MAGIC_H */

Property changes on: lab4/.minix-src/include/magic.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/bootinfo.h
===================================================================
--- lab4/.minix-src/include/x86/bootinfo.h	(nonexistent)
+++ lab4/.minix-src/include/x86/bootinfo.h	(revision 13)
@@ -0,0 +1,242 @@
+/*	$NetBSD: bootinfo.h,v 1.23 2013/08/30 16:42:17 jmcneill Exp $	*/
+
+/*
+ * Copyright (c) 1997
+ *	Matthias Drochner.  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.
+ *
+ */
+
+#define BTINFO_BOOTPATH		0
+#define BTINFO_ROOTDEVICE	1
+#define BTINFO_BOOTDISK		3
+#define BTINFO_NETIF		4
+#define BTINFO_CONSOLE		6
+#define BTINFO_BIOSGEOM		7
+#define BTINFO_SYMTAB		8
+#define BTINFO_MEMMAP		9
+#define	BTINFO_BOOTWEDGE	10
+#define BTINFO_MODULELIST	11
+#define BTINFO_FRAMEBUFFER	12
+#define BTINFO_USERCONFCOMMANDS	13
+
+#ifndef _LOCORE
+
+struct btinfo_common {
+	int len;
+	int type;
+};
+
+struct btinfo_bootpath {
+	struct btinfo_common common;
+	char bootpath[80];
+};
+
+struct btinfo_rootdevice {
+	struct btinfo_common common;
+	char devname[16];
+};
+
+struct btinfo_bootdisk {
+	struct btinfo_common common;
+	int labelsector; /* label valid if != -1 */
+	struct {
+		uint16_t type, checksum;
+		char packname[16];
+	} label;
+	int biosdev;
+	int partition;
+};
+
+struct btinfo_bootwedge {
+	struct btinfo_common common;
+	int biosdev;
+	daddr_t startblk;
+	uint64_t nblks;
+	daddr_t matchblk;
+	uint64_t matchnblks;
+	uint8_t matchhash[16];	/* MD5 hash */
+} __packed;
+
+struct btinfo_netif {
+	struct btinfo_common common;
+	char ifname[16];
+	int bus;
+#define BI_BUS_ISA 0
+#define BI_BUS_PCI 1
+	union {
+		unsigned int iobase; /* ISA */
+		unsigned int tag; /* PCI, BIOS format */
+	} addr;
+};
+
+struct btinfo_console {
+	struct btinfo_common common;
+	char devname[16];
+	int addr;
+	int speed;
+};
+
+struct btinfo_symtab {
+	struct btinfo_common common;
+	int nsym;
+	int ssym;
+	int esym;
+};
+
+struct bi_memmap_entry {
+	uint64_t addr;		/* beginning of block */	/* 8 */
+	uint64_t size;		/* size of block */		/* 8 */
+	uint32_t type;		/* type of block */		/* 4 */
+} __packed;				/*	== 20 */
+
+#define	BIM_Memory	1	/* available RAM usable by OS */
+#define	BIM_Reserved	2	/* in use or reserved by the system */
+#define	BIM_ACPI	3	/* ACPI Reclaim memory */
+#define	BIM_NVS		4	/* ACPI NVS memory */
+
+struct btinfo_memmap {
+	struct btinfo_common common;
+	int num;
+	struct bi_memmap_entry entry[1]; /* var len */
+};
+
+#if HAVE_NBTOOL_CONFIG_H
+#include <nbinclude/sys/bootblock.h>
+#else
+#include <sys/bootblock.h>
+#endif /* HAVE_NBTOOL_CONFIG_H */
+
+/*
+ * Structure describing disk info as seen by the BIOS.
+ */
+struct bi_biosgeom_entry {
+	int		sec, head, cyl;		/* geometry */
+	uint64_t	totsec;			/* LBA sectors from ext int13 */
+	int		flags, dev;		/* flags, BIOS device # */
+#define BI_GEOM_INVALID		0x000001
+#define BI_GEOM_EXTINT13	0x000002
+#ifdef BIOSDISK_EXTINFO_V3
+#define BI_GEOM_BADCKSUM	0x000004	/* v3.x checksum invalid */
+#define BI_GEOM_BUS_MASK	0x00ff00	/* connecting bus type */
+#define BI_GEOM_BUS_ISA		0x000100
+#define BI_GEOM_BUS_PCI		0x000200
+#define BI_GEOM_BUS_OTHER	0x00ff00
+#define BI_GEOM_IFACE_MASK	0xff0000	/* interface type */
+#define BI_GEOM_IFACE_ATA	0x010000
+#define BI_GEOM_IFACE_ATAPI	0x020000
+#define BI_GEOM_IFACE_SCSI	0x030000
+#define BI_GEOM_IFACE_USB	0x040000
+#define BI_GEOM_IFACE_1394	0x050000	/* Firewire */
+#define BI_GEOM_IFACE_FIBRE	0x060000	/* Fibre channel */
+#define BI_GEOM_IFACE_OTHER	0xff0000
+	unsigned int	cksum;			/* MBR checksum */
+	unsigned int	interface_path;		/* ISA iobase PCI bus/dev/fun */
+	uint64_t	device_path;
+	int		res0;			/* future expansion; 0 now */
+#else
+	unsigned int	cksum;			/* MBR checksum */
+	int		res0, res1, res2, res3;	/* future expansion; 0 now */
+#endif
+	struct mbr_partition mbrparts[MBR_PART_COUNT]; /* MBR itself */
+} __packed;
+
+struct btinfo_biosgeom {
+	struct btinfo_common common;
+	int num;
+	struct bi_biosgeom_entry disk[1]; /* var len */
+};
+
+struct bi_modulelist_entry {
+	char path[80];
+	int type;
+	int len;
+	uint32_t base;
+};
+#define	BI_MODULE_NONE		0x00
+#define	BI_MODULE_ELF		0x01
+#define	BI_MODULE_IMAGE		0x02
+#define BI_MODULE_RND		0x03
+#define BI_MODULE_FS		0x04
+
+struct btinfo_modulelist {
+	struct btinfo_common common;
+	int num;
+	uint32_t endpa;
+	/* bi_modulelist_entry list follows */
+};
+
+struct btinfo_framebuffer {
+	struct btinfo_common common;
+	uint64_t physaddr;
+	uint32_t flags;
+	uint32_t width;
+	uint32_t height;
+	uint16_t stride;
+	uint8_t depth;
+	uint8_t rnum;
+	uint8_t gnum;
+	uint8_t bnum;
+	uint8_t rpos;
+	uint8_t gpos;
+	uint8_t bpos;
+	uint16_t vbemode;
+	uint8_t reserved[14];
+};
+
+struct bi_userconfcommand {
+	char text[80];
+};
+
+struct btinfo_userconfcommands {
+	struct btinfo_common common;
+	int num;
+	/* bi_userconfcommand list follows */
+};
+
+#endif /* _LOCORE */
+
+#ifdef _KERNEL
+
+#define BOOTINFO_MAXSIZE 4096
+
+#ifndef _LOCORE
+/*
+ * Structure that holds the information passed by the boot loader.
+ */
+struct bootinfo {
+	/* Number of bootinfo_* entries in bi_data. */
+	uint32_t	bi_nentries;
+
+	/* Raw data of bootinfo entries.  The first one (if any) is
+	 * found at bi_data[0] and can be casted to (bootinfo_common *).
+	 * Once this is done, the following entry is found at 'len'
+	 * offset as specified by the previous entry. */
+	uint8_t		bi_data[BOOTINFO_MAXSIZE - sizeof(uint32_t)];
+};
+
+extern struct bootinfo bootinfo;
+
+void *lookup_bootinfo(int);
+#endif /* _LOCORE */
+
+#endif /* _KERNEL */

Property changes on: lab4/.minix-src/include/x86/bootinfo.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/memory.h
===================================================================
--- lab4/.minix-src/include/memory.h	(nonexistent)
+++ lab4/.minix-src/include/memory.h	(revision 13)
@@ -0,0 +1,34 @@
+/*	$NetBSD: memory.h,v 1.5 2003/08/07 09:44:10 agc Exp $	*/
+
+/*
+ * Copyright (c) 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)memory.h	8.1 (Berkeley) 6/2/93
+ */
+
+#include <string.h>

Property changes on: lab4/.minix-src/include/memory.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/lwp.h
===================================================================
--- lab4/.minix-src/include/lwp.h	(nonexistent)
+++ lab4/.minix-src/include/lwp.h	(revision 13)
@@ -0,0 +1,67 @@
+/*	$NetBSD: lwp.h,v 1.12 2014/01/31 20:44:17 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nathan Williams.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LWP_H_
+#define _LWP_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <sys/time.h>
+
+struct lwpctl;
+
+__BEGIN_DECLS
+lwpid_t	_lwp_self(void);
+int	_lwp_create(const ucontext_t *, unsigned  long, lwpid_t *);
+int	_lwp_exit(void);
+int	_lwp_wait(lwpid_t, lwpid_t *);
+int	_lwp_suspend(lwpid_t);
+int	_lwp_continue(lwpid_t);
+int	_lwp_wakeup(lwpid_t);
+void	_lwp_makecontext(ucontext_t *, void (*)(void *), void *, void *, 
+	    caddr_t, size_t);
+void	*_lwp_getprivate(void);
+void	_lwp_setprivate(void *);
+int	_lwp_kill(lwpid_t, int);
+int	_lwp_detach(lwpid_t);
+#ifndef __LIBC12_SOURCE__
+int	_lwp_park(clockid_t, int, const struct timespec *, lwpid_t,
+    const void *, const void *) __RENAME(___lwp_park60);
+#endif
+int	_lwp_unpark(lwpid_t, const void *);
+ssize_t	_lwp_unpark_all(const lwpid_t *, size_t, const void *);
+int	_lwp_setname(lwpid_t, const char *);
+int	_lwp_getname(lwpid_t, char *, size_t);
+int	_lwp_ctl(int, struct lwpctl **);
+__END_DECLS
+
+#endif /* !_LWP_H_ */

Property changes on: lab4/.minix-src/include/lwp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/monetary.h
===================================================================
--- lab4/.minix-src/include/monetary.h	(nonexistent)
+++ lab4/.minix-src/include/monetary.h	(revision 13)
@@ -0,0 +1,52 @@
+/*	$NetBSD: monetary.h,v 1.2 2008/09/21 16:59:46 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/include/monetary.h,v 1.7 2002/09/20 08:22:48 mike Exp $
+ */
+
+#ifndef _MONETARY_H_
+#define	_MONETARY_H_
+
+#include <sys/cdefs.h>
+#include <machine/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#ifdef	_BSD_SSIZE_T_
+typedef	_BSD_SSIZE_T_	ssize_t;
+#undef	_BSD_SSIZE_T_
+#endif
+
+__BEGIN_DECLS
+ssize_t	strfmon(char * __restrict, size_t, const char * __restrict, ...)
+    __attribute__((__format__(__strfmon__, 3, 4)));
+__END_DECLS
+
+#endif /* !_MONETARY_H_ */

Property changes on: lab4/.minix-src/include/monetary.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netconfig.h
===================================================================
--- lab4/.minix-src/include/netconfig.h	(nonexistent)
+++ lab4/.minix-src/include/netconfig.h	(revision 13)
@@ -0,0 +1,123 @@
+/*	$NetBSD: netconfig.h,v 1.6 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Frank van der Linden.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _NETCONFIG_H_
+#define _NETCONFIG_H_
+
+#include <sys/cdefs.h>
+
+#define NETCONFIG	"/etc/netconfig"
+#define NETPATH		"NETPATH"
+
+struct netconfig {
+	char *nc_netid;			/* Network ID */
+	unsigned long nc_semantics;	/* Semantics (see below) */
+	unsigned long nc_flag;		/* Flags (see below) */
+	char *nc_protofmly;		/* Protocol family */
+	char *nc_proto;			/* Protocol name */
+	char *nc_device;		/* Network device pathname */
+	unsigned long nc_nlookups;	/* Number of directory lookup libs */
+	char **nc_lookups;		/* Names of the libraries */
+	unsigned long nc_unused[9];	/* reserved */
+};
+
+typedef struct {
+	struct netconfig **nc_head;
+	struct netconfig **nc_curr;
+} NCONF_HANDLE;
+
+/*
+ * nc_semantics values
+ */
+#define NC_TPI_CLTS	1	/* Connectionless transport */
+#define NC_TPI_COTS	2	/* Connection oriented transport */
+#define NC_TPI_COTS_ORD	3	/* Connection oriented, ordered transport */
+#define NC_TPI_RAW	4	/* Raw connection */
+
+/*
+ * nc_flag values
+ */
+#define NC_NOFLAG	0x00
+#define NC_VISIBLE	0x01
+#define NC_BROADCAST	0x02
+
+/*
+ * nc_protofmly values
+ */
+#define NC_NOPROTOFMLY	"-"
+#define NC_LOOPBACK	"loopback"
+#define NC_INET		"inet"
+#define NC_INET6	"inet6"
+#define NC_IMPLINK	"implink"
+#define NC_PUP		"pup"
+#define NC_CHAOS	"chaos"
+#define NC_NS		"ns"
+#define NC_NBS		"nbs"
+#define NC_ECMA		"ecma"
+#define NC_DATAKIT	"datakit"
+#define NC_CCITT	"ccitt"
+#define NC_SNA		"sna"
+#define NC_DECNET	"decnet"
+#define NC_DLI		"dli"
+#define NC_LAT		"lat"
+#define NC_HYLINK	"hylink"
+#define NC_APPLETALK	"appletalk"
+#define NC_NIT		"nit"
+#define NC_IEEE802	"ieee802"
+#define NC_OSI		"osi"
+#define NC_X25		"x25"
+#define NC_OSINET	"osinet"
+#define NC_GOSIP	"gosip"
+
+/*
+ * nc_proto values
+ */
+#define NC_NOPROTO	"-"
+#define NC_TCP		"tcp"
+#define NC_UDP		"udp"
+#define NC_ICMP		"icmp"
+
+__BEGIN_DECLS
+void *setnetconfig(void);
+struct netconfig *getnetconfig(void *);
+struct netconfig *getnetconfigent(const char *);
+void freenetconfigent(struct netconfig *);
+int endnetconfig(void *);
+
+void *setnetpath(void);
+struct netconfig *getnetpath(void *);
+int endnetpath(void *);
+
+void nc_perror(const char *);
+char *nc_sperror(void);
+__END_DECLS
+
+#endif /* _NETCONFIG_H_ */

Property changes on: lab4/.minix-src/include/netconfig.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/md4.h
===================================================================
--- lab4/.minix-src/include/md4.h	(nonexistent)
+++ lab4/.minix-src/include/md4.h	(revision 13)
@@ -0,0 +1 @@
+sys/md4.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/md4.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/cpu_ucode.h
===================================================================
--- lab4/.minix-src/include/x86/cpu_ucode.h	(nonexistent)
+++ lab4/.minix-src/include/x86/cpu_ucode.h	(revision 13)
@@ -0,0 +1,88 @@
+/* $NetBSD: cpu_ucode.h,v 1.3 2012/10/17 20:19:55 drochner Exp $ */
+/*
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christoph Egger.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE  
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _X86_CPU_UCODE_H_
+#define _X86_CPU_UCODE_H_
+
+#define CPU_UCODE_LOADER_AMD 0
+struct cpu_ucode_version_amd {
+	uint64_t version;
+};
+
+#define CPU_UCODE_LOADER_INTEL1 1
+struct cpu_ucode_version_intel1 {
+	uint32_t ucodeversion;
+	int platformid;
+};
+
+#ifdef _KERNEL
+#include <sys/cpu.h>
+#include <sys/cpuio.h>
+#include <dev/firmload.h>
+
+int cpu_ucode_amd_get_version(struct cpu_ucode_version *);
+#ifdef COMPAT_60
+int compat6_cpu_ucode_amd_get_version(struct compat6_cpu_ucode *);
+#endif
+int cpu_ucode_amd_firmware_open(firmware_handle_t *, const char *);
+int cpu_ucode_amd_apply(struct cpu_ucode_softc *, int);
+
+int cpu_ucode_intel_get_version(struct cpu_ucode_version *);
+int cpu_ucode_intel_firmware_open(firmware_handle_t *, const char *);
+int cpu_ucode_intel_apply(struct cpu_ucode_softc *, int);
+#endif /* _KERNEL */
+
+struct intel1_ucode_header {
+	uint32_t	uh_header_ver;
+	uint32_t	uh_rev;
+	uint32_t	uh_date;
+	uint32_t	uh_signature;
+	uint32_t	uh_checksum;
+	uint32_t	uh_loader_rev;
+	uint32_t	uh_proc_flags;
+	uint32_t	uh_data_size;
+	uint32_t	uh_total_size;
+	uint32_t	uh_reserved[3];
+};
+
+struct intel1_ucode_proc_signature {
+	uint32_t	ups_signature;
+	uint32_t	ups_proc_flags;
+	uint32_t	ups_checksum;
+};
+
+struct intel1_ucode_ext_table {
+	uint32_t	uet_count;
+	uint32_t	uet_checksum;
+	uint32_t	uet_reserved[3];
+	struct intel1_ucode_proc_signature uet_proc_sig[1];
+};
+
+#endif

Property changes on: lab4/.minix-src/include/x86/cpu_ucode.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/malloc.h
===================================================================
--- lab4/.minix-src/include/malloc.h	(nonexistent)
+++ lab4/.minix-src/include/malloc.h	(revision 13)
@@ -0,0 +1,3 @@
+/*	$NetBSD: malloc.h,v 1.3 1994/10/26 00:56:03 cgd Exp $	*/
+
+#include <stdlib.h>

Property changes on: lab4/.minix-src/include/malloc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/nl_types.h
===================================================================
--- lab4/.minix-src/include/nl_types.h	(nonexistent)
+++ lab4/.minix-src/include/nl_types.h	(revision 13)
@@ -0,0 +1,100 @@
+/*	$NetBSD: nl_types.h,v 1.13 2013/08/19 08:03:33 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by J.T. Conklin.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _NL_TYPES_H_
+#define _NL_TYPES_H_
+#include <sys/cdefs.h>
+
+#ifdef _NLS_PRIVATE
+/*
+ * MESSAGE CATALOG FILE FORMAT.
+ *
+ * The NetBSD message catalog format is similar to the format used by
+ * Svr4 systems.  The differences are:
+ *   * fixed byte order (big endian)
+ *   * fixed data field sizes
+ *
+ * A message catalog contains four data types: a catalog header, one
+ * or more set headers, one or more message headers, and one or more
+ * text strings.
+ */
+
+#define _NLS_MAGIC	0xff88ff89
+
+struct _nls_cat_hdr {
+	int32_t __magic;
+	int32_t __nsets;
+	int32_t __mem;
+	int32_t __msg_hdr_offset;
+	int32_t __msg_txt_offset;
+} ;
+
+struct _nls_set_hdr {
+	int32_t __setno;	/* set number: 0 < x <= NL_SETMAX */
+	int32_t __nmsgs;	/* number of messages in the set  */
+	int32_t __index;	/* index of first msg_hdr in msg_hdr table */
+} ;
+
+struct _nls_msg_hdr {
+	int32_t __msgno;	/* msg number: 0 < x <= NL_MSGMAX */
+	int32_t __msglen;
+	int32_t __offset;
+} ;
+
+#endif
+
+#define	NL_SETD		1
+#define NL_CAT_LOCALE   1
+
+typedef struct __nl_cat_d {
+	void	*__data;
+	int	__size;
+} *nl_catd;
+
+typedef long	nl_item;
+
+__BEGIN_DECLS
+nl_catd  catopen(const char *, int);
+char    *catgets(nl_catd, int, int, const char *) __format_arg(4);
+int	 catclose(nl_catd);
+__END_DECLS
+
+#if defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+__BEGIN_DECLS
+nl_catd  catopen_l(const char *, int, locale_t);
+__END_DECLS
+#endif
+
+#endif	/* _NL_TYPES_H_ */

Property changes on: lab4/.minix-src/include/nl_types.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/pcap-namedb.h
===================================================================
--- lab4/.minix-src/include/pcap-namedb.h	(nonexistent)
+++ lab4/.minix-src/include/pcap-namedb.h	(revision 13)
@@ -0,0 +1 @@
+pcap/namedb.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/pcap-namedb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/puffs.h
===================================================================
--- lab4/.minix-src/include/puffs.h	(nonexistent)
+++ lab4/.minix-src/include/puffs.h	(revision 13)
@@ -0,0 +1,737 @@
+/*	$NetBSD: puffs.h,v 1.126 2014/10/31 13:56:04 manu Exp $	*/
+
+/*
+ * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
+ *
+ * Development of this software was supported by the
+ * Google Summer of Code program and the Ulla Tuominen Foundation.
+ * The Google SoC project was mentored by Bill Studenmund.
+ *
+ * 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 OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _PUFFS_H_
+#define _PUFFS_H_
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/mount.h>
+#include <sys/namei.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+#include <sys/time.h>
+#include <sys/vnode.h>
+
+#include <fs/puffs/puffs_msgif.h>
+
+#include <mntopts.h>
+#include <stdbool.h>
+#include <string.h>
+
+/* forwards */
+struct puffs_cc;
+
+struct puffs_getreq;
+struct puffs_cred;
+struct puffs_newinfo;
+
+/* paths */
+struct puffs_pathobj {
+	void 		*po_path;
+	size_t		po_len;
+	uint32_t	po_hash;
+};
+
+/* for prefix rename */
+struct puffs_pathinfo {
+	struct puffs_pathobj *pi_old;
+	struct puffs_pathobj *pi_new;
+};
+
+/* describes one segment cached in the kernel */
+struct puffs_kcache {
+	off_t	pkc_start;
+	off_t	pkc_end;
+
+	LIST_ENTRY(puffs_kcache) pkc_entries;
+};
+
+/* XXX: might disappear from here into a private header */
+struct puffs_node {
+	off_t			pn_size;
+	int			pn_flags;
+	int			pn_nlookup;
+	struct vattr		pn_va;
+
+	void			*pn_data;	/* private data		*/
+
+	struct puffs_pathobj	pn_po;		/* PUFFS_FLAG_BUILDPATH */
+
+	struct puffs_usermount 	*pn_mnt;
+	LIST_ENTRY(puffs_node)	pn_entries;
+
+	LIST_HEAD(,puffs_kcache)pn_cacheinfo;	/* PUFFS_KFLAG_CACHE	*/
+#if defined(__minix)
+	/* MINIX fields */
+	char			pn_mountpoint; /* true if mounted on */
+	unsigned int		pn_count;          /* # times inode used */
+#endif /* defined(__minix) */
+};
+#define PUFFS_NODE_REMOVED	0x01		/* not on entry list	*/
+
+
+struct puffs_usermount;
+
+/*
+ * megaXXX: these are values from inside _KERNEL
+ * need to work on the translation for ALL the necessary values.
+ */
+#define PUFFS_VNOVAL (-1)
+
+#define PUFFS_IO_APPEND 0x020
+#define PUFFS_IO_NDELAY	0x100
+
+#define PUFFS_VEXEC	01
+#define PUFFS_VWRITE	02
+#define PUFFS_VREAD	04
+
+#define PUFFS_FSYNC_DATAONLY 0x0002
+#define PUFFS_FSYNC_CACHE    0x0100
+
+/*
+ * xflags for setattr_ttl and write2
+ */
+#define PUFFS_SETATTR_FAF    0x1
+#define PUFFS_WRITE_FAF      0x1
+
+#define PUFFS_EXTATTR_LIST_LENPREFIX 1
+/*
+ * Magic constants
+ */
+#define PUFFS_CC_STACKSHIFT_DEFAULT 18
+
+struct puffs_cn {
+	struct puffs_kcn	*pcn_pkcnp;	/* kernel input */
+	struct puffs_cred	*pcn_cred;	/* cred used for lookup */
+
+	struct puffs_pathobj	pcn_po_full;	/* PUFFS_FLAG_BUILDPATH */
+};
+#define pcn_nameiop	pcn_pkcnp->pkcn_nameiop
+#define pcn_flags	pcn_pkcnp->pkcn_flags
+#define pcn_name	pcn_pkcnp->pkcn_name
+#define pcn_namelen	pcn_pkcnp->pkcn_namelen
+#define pcn_consume	pcn_pkcnp->pkcn_consume
+
+/*
+ * Puffs options to mount
+ */
+/* kernel */
+#define	PUFFSMOPT_NAMECACHE	{ "namecache", 1, PUFFS_KFLAG_NOCACHE_NAME, 1 }
+#define	PUFFSMOPT_PAGECACHE	{ "pagecache", 1, PUFFS_KFLAG_NOCACHE_PAGE, 1 }
+#define	PUFFSMOPT_ATTRCACHE	{ "attrcache", 1, PUFFS_KFLAG_NOCACHE_ATTR, 1 }
+#define	PUFFSMOPT_CACHE		{ "cache", 1, PUFFS_KFLAG_NOCACHE, 1 }
+#define PUFFSMOPT_ALLOPS	{ "allops", 0, PUFFS_KFLAG_ALLOPS, 1 }
+
+/* libpuffs */
+#define PUFFSMOPT_DUMP		{ "dump", 0, PUFFS_FLAG_OPDUMP, 1 }
+
+#define PUFFSMOPT_STD							\
+	PUFFSMOPT_NAMECACHE,						\
+	PUFFSMOPT_PAGECACHE,						\
+	PUFFSMOPT_ATTRCACHE,						\
+	PUFFSMOPT_CACHE,						\
+	PUFFSMOPT_ALLOPS,						\
+	PUFFSMOPT_DUMP
+
+extern const struct mntopt puffsmopts[]; /* puffs.c */
+
+/* callbacks for operations */
+struct puffs_ops {
+	int (*puffs_fs_unmount)(struct puffs_usermount *, int);
+	int (*puffs_fs_statvfs)(struct puffs_usermount *, struct statvfs *);
+	int (*puffs_fs_sync)(struct puffs_usermount *, int,
+	    const struct puffs_cred *);
+	int (*puffs_fs_fhtonode)(struct puffs_usermount *, void *, size_t,
+	    struct puffs_newinfo *);
+	int (*puffs_fs_nodetofh)(struct puffs_usermount *, puffs_cookie_t,
+	    void *, size_t *);
+	int (*puffs_fs_extattrctl)(struct puffs_usermount *, int,
+	    puffs_cookie_t, int, int, const char *);
+
+	int (*puffs_node_lookup)(struct puffs_usermount *,
+	    puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *);
+	int (*puffs_node_create)(struct puffs_usermount *,
+	    puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
+	    const struct vattr *);
+	int (*puffs_node_mknod)(struct puffs_usermount *,
+	    puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
+	    const struct vattr *);
+	int (*puffs_node_open)(struct puffs_usermount *,
+	    puffs_cookie_t, int, const struct puffs_cred *);
+	int (*puffs_node_close)(struct puffs_usermount *,
+	    puffs_cookie_t, int, const struct puffs_cred *);
+	int (*puffs_node_access)(struct puffs_usermount *,
+	    puffs_cookie_t, int, const struct puffs_cred *);
+	int (*puffs_node_getattr)(struct puffs_usermount *,
+	    puffs_cookie_t, struct vattr *, const struct puffs_cred *);
+	int (*puffs_node_setattr)(struct puffs_usermount *,
+	    puffs_cookie_t, const struct vattr *, const struct puffs_cred *);
+	int (*puffs_node_poll)(struct puffs_usermount *, puffs_cookie_t, int *);
+	int (*puffs_node_mmap)(struct puffs_usermount *,
+	    puffs_cookie_t, vm_prot_t, const struct puffs_cred *);
+	int (*puffs_node_fsync)(struct puffs_usermount *,
+	    puffs_cookie_t, const struct puffs_cred *, int, off_t, off_t);
+	int (*puffs_node_seek)(struct puffs_usermount *,
+	    puffs_cookie_t, off_t, off_t, const struct puffs_cred *);
+	int (*puffs_node_remove)(struct puffs_usermount *,
+	    puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
+	int (*puffs_node_link)(struct puffs_usermount *,
+	    puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
+	int (*puffs_node_rename)(struct puffs_usermount *,
+	    puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *,
+	    puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
+	int (*puffs_node_mkdir)(struct puffs_usermount *,
+	    puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
+	    const struct vattr *);
+	int (*puffs_node_rmdir)(struct puffs_usermount *,
+	    puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
+	int (*puffs_node_symlink)(struct puffs_usermount *,
+	    puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
+	    const struct vattr *,
+	    const char *);
+	int (*puffs_node_readdir)(struct puffs_usermount *,
+	    puffs_cookie_t, struct dirent *, off_t *, size_t *,
+	    const struct puffs_cred *, int *, off_t *, size_t *);
+	int (*puffs_node_readlink)(struct puffs_usermount *,
+	    puffs_cookie_t, const struct puffs_cred *, char *, size_t *);
+	int (*puffs_node_reclaim)(struct puffs_usermount *, puffs_cookie_t);
+	int (*puffs_node_inactive)(struct puffs_usermount *, puffs_cookie_t);
+	int (*puffs_node_print)(struct puffs_usermount *, puffs_cookie_t);
+	int (*puffs_node_pathconf)(struct puffs_usermount *,
+	    puffs_cookie_t, int, register_t *);
+	int (*puffs_node_advlock)(struct puffs_usermount *,
+	    puffs_cookie_t, void *, int, struct flock *, int);
+	int (*puffs_node_read)(struct puffs_usermount *, puffs_cookie_t,
+	    uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
+	int (*puffs_node_write)(struct puffs_usermount *, puffs_cookie_t,
+	    uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
+	int (*puffs_node_abortop)(struct puffs_usermount *, puffs_cookie_t,
+	    const struct puffs_cn *);
+	int (*puffs_node_getextattr)(struct puffs_usermount *, puffs_cookie_t,
+	    int, const char *, size_t *, uint8_t *, size_t *,
+	    const struct puffs_cred *);
+	int (*puffs_node_setextattr)(struct puffs_usermount *, puffs_cookie_t,
+	    int, const char *, uint8_t *, size_t *, const struct puffs_cred *);
+	int (*puffs_node_listextattr)(struct puffs_usermount *, puffs_cookie_t,
+	    int, size_t *, uint8_t *, size_t *, int, const struct puffs_cred *);
+	int (*puffs_node_deleteextattr)(struct puffs_usermount *,
+	    puffs_cookie_t, int, const char *, const struct puffs_cred *);
+	int (*puffs_node_getattr_ttl)(struct puffs_usermount *,
+	    puffs_cookie_t, struct vattr *, const struct puffs_cred *,
+	    struct timespec *);
+	int (*puffs_node_setattr_ttl)(struct puffs_usermount *,
+	    puffs_cookie_t, struct vattr *, const struct puffs_cred *,
+	    struct timespec *, int);
+	int (*puffs_node_write2)(struct puffs_usermount *, puffs_cookie_t,
+	    uint8_t *, off_t, size_t *, const struct puffs_cred *, int, int);
+	int (*puffs_node_reclaim2)(struct puffs_usermount *,
+	    puffs_cookie_t, int);
+	int (*puffs_node_open2)(struct puffs_usermount *,
+	    puffs_cookie_t, int, const struct puffs_cred *, int *);
+	int (*puffs_node_fallocate)(struct puffs_usermount *,
+	    puffs_cookie_t, off_t, off_t);
+	int (*puffs_node_fdiscard)(struct puffs_usermount *,
+	    puffs_cookie_t, off_t, off_t);
+
+	void *puffs_ops_spare[26];
+};
+
+typedef	int (*pu_pathbuild_fn)(struct puffs_usermount *,
+			       const struct puffs_pathobj *,
+			       const struct puffs_pathobj *, size_t,
+			       struct puffs_pathobj *);
+typedef int (*pu_pathtransform_fn)(struct puffs_usermount *,
+				   const struct puffs_pathobj *,
+				   const struct puffs_cn *,
+				   struct puffs_pathobj *);
+typedef int (*pu_pathcmp_fn)(struct puffs_usermount *, struct puffs_pathobj *,
+			  struct puffs_pathobj *, size_t, int);
+typedef void (*pu_pathfree_fn)(struct puffs_usermount *,
+			       struct puffs_pathobj *);
+typedef int (*pu_namemod_fn)(struct puffs_usermount *,
+			     struct puffs_pathobj *, struct puffs_cn *);
+
+typedef void (*pu_errnotify_fn)(struct puffs_usermount *,
+				uint8_t, int, const char *, puffs_cookie_t);
+
+typedef void (*pu_prepost_fn)(struct puffs_usermount *);
+
+typedef struct puffs_node *(*pu_cmap_fn)(struct puffs_usermount *,
+					 puffs_cookie_t);
+
+enum {
+	PUFFS_STATE_BEFOREMOUNT,	PUFFS_STATE_RUNNING,
+	PUFFS_STATE_UNMOUNTING,		PUFFS_STATE_UNMOUNTED
+};
+
+#define PUFFS_FLAG_BUILDPATH	0x80000000	/* node paths in pnode */
+#define PUFFS_FLAG_OPDUMP	0x40000000	/* dump all operations */
+#define PUFFS_FLAG_HASHPATH	0x20000000	/* speedup: hash paths */
+#define PUFFS_FLAG_PNCOOKIE	0x10000000	/* cookies are pnodes */
+#define PUFFS_FLAG_MASK		0xf0000000
+
+#define PUFFS_FLAG_KERN(a)	((a) & PUFFS_KFLAG_MASK)
+#define PUFFS_FLAG_LIB(a)	((a) & PUFFS_FLAG_MASK)
+
+/* blocking mode argument */
+#define PUFFSDEV_BLOCK 0
+#define PUFFSDEV_NONBLOCK 1
+
+#define PUFFS_STACKSIZE_DEFAULT (1<<PUFFS_CC_STACKSHIFT_DEFAULT)
+#define PUFFS_STACKSIZE_MIN ((size_t)-1)
+
+#define		DENT_DOT	0
+#define		DENT_DOTDOT	1
+#define		DENT_ADJ(a)	((a)-2)	/* nth request means dir's n-2th */
+
+
+/*
+ * protos
+ */
+
+#define PUFFSOP_PROTOS(fsname)						\
+	int fsname##_fs_unmount(struct puffs_usermount *, int);		\
+	int fsname##_fs_statvfs(struct puffs_usermount *,		\
+	    struct statvfs *);						\
+	int fsname##_fs_sync(struct puffs_usermount *, int,		\
+	    const struct puffs_cred *cred);				\
+	int fsname##_fs_fhtonode(struct puffs_usermount *, void *,	\
+	    size_t, struct puffs_newinfo *);				\
+	int fsname##_fs_nodetofh(struct puffs_usermount *,		\
+	    puffs_cookie_t, void *, size_t *);				\
+	int fsname##_fs_extattrctl(struct puffs_usermount *, int,	\
+	    puffs_cookie_t, int, int, const char *);			\
+									\
+	int fsname##_node_lookup(struct puffs_usermount *,		\
+	    puffs_cookie_t, struct puffs_newinfo *,			\
+	    const struct puffs_cn *);					\
+	int fsname##_node_create(struct puffs_usermount *,		\
+	    puffs_cookie_t, struct puffs_newinfo *,			\
+	    const struct puffs_cn *, const struct vattr *);		\
+	int fsname##_node_mknod(struct puffs_usermount *,		\
+	    puffs_cookie_t, struct puffs_newinfo *,			\
+	    const struct puffs_cn *, const struct vattr *);		\
+	int fsname##_node_open(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, const struct puffs_cred *);		\
+	int fsname##_node_close(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, const struct puffs_cred *);		\
+	int fsname##_node_access(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, const struct puffs_cred *);		\
+	int fsname##_node_getattr(struct puffs_usermount *,		\
+	    puffs_cookie_t, struct vattr *, const struct puffs_cred *);	\
+	int fsname##_node_setattr(struct puffs_usermount *,		\
+	    puffs_cookie_t, const struct vattr *,			\
+	    const struct puffs_cred *);					\
+	int fsname##_node_poll(struct puffs_usermount *,		\
+	    puffs_cookie_t, int *);					\
+	int fsname##_node_mmap(struct puffs_usermount *,		\
+	    puffs_cookie_t, vm_prot_t, const struct puffs_cred *);	\
+	int fsname##_node_fsync(struct puffs_usermount *,		\
+	    puffs_cookie_t, const struct puffs_cred *, int,		\
+	    off_t, off_t);						\
+	int fsname##_node_seek(struct puffs_usermount *,		\
+	    puffs_cookie_t, off_t, off_t, const struct puffs_cred *);	\
+	int fsname##_node_remove(struct puffs_usermount *,		\
+	    puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);	\
+	int fsname##_node_link(struct puffs_usermount *,		\
+	    puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);	\
+	int fsname##_node_rename(struct puffs_usermount *,		\
+	    puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *,	\
+	    puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);	\
+	int fsname##_node_mkdir(struct puffs_usermount *,		\
+	    puffs_cookie_t, struct puffs_newinfo *,			\
+	    const struct puffs_cn *, const struct vattr *);		\
+	int fsname##_node_rmdir(struct puffs_usermount *,		\
+	    puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);	\
+	int fsname##_node_symlink(struct puffs_usermount *,		\
+	    puffs_cookie_t, struct puffs_newinfo *,			\
+	    const struct puffs_cn *, const struct vattr *,		\
+	    const char *);						\
+	int fsname##_node_readdir(struct puffs_usermount *,		\
+	    puffs_cookie_t, struct dirent *, off_t *, size_t *,		\
+	    const struct puffs_cred *, int *, off_t *, size_t *);	\
+	int fsname##_node_readlink(struct puffs_usermount *,		\
+	    puffs_cookie_t, const struct puffs_cred *, char *,		\
+	    size_t *);							\
+	int fsname##_node_reclaim(struct puffs_usermount *,		\
+	    puffs_cookie_t);						\
+	int fsname##_node_inactive(struct puffs_usermount *,		\
+	    puffs_cookie_t);						\
+	int fsname##_node_print(struct puffs_usermount *,		\
+	    puffs_cookie_t);						\
+	int fsname##_node_pathconf(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, register_t *);				\
+	int fsname##_node_advlock(struct puffs_usermount *,		\
+	    puffs_cookie_t, void *, int, struct flock *, int);		\
+	int fsname##_node_read(struct puffs_usermount *, puffs_cookie_t,\
+	    uint8_t *, off_t, size_t *, const struct puffs_cred *, int);\
+	int fsname##_node_write(struct puffs_usermount *,		\
+	    puffs_cookie_t, uint8_t *, off_t, size_t *,			\
+	    const struct puffs_cred *, int);				\
+	int fsname##_node_abortop(struct puffs_usermount *,		\
+	    puffs_cookie_t, const struct puffs_cn *);			\
+	int fsname##_node_getextattr(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, const char *, size_t *, uint8_t *,	\
+	    size_t *, const struct puffs_cred *);			\
+	int fsname##_node_setextattr(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, const char *, uint8_t *, size_t *,	\
+	    const struct puffs_cred *);					\
+	int fsname##_node_listextattr(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, size_t *, uint8_t *, size_t *,		\
+	    int, const struct puffs_cred *);				\
+	int fsname##_node_deleteextattr(struct puffs_usermount *,	\
+	    puffs_cookie_t, int, const char *,				\
+	    const struct puffs_cred *);					\
+	int fsname##_node_getattr_ttl(struct puffs_usermount *,		\
+	    puffs_cookie_t, struct vattr *, const struct puffs_cred *,	\
+	    struct timespec *);						\
+	int fsname##_node_setattr_ttl(struct puffs_usermount *,		\
+	    puffs_cookie_t, struct vattr *, const struct puffs_cred *,	\
+	    struct timespec *, int);					\
+	int fsname##_node_write2(struct puffs_usermount *,		\
+	    puffs_cookie_t, uint8_t *, off_t, size_t *,			\
+	    const struct puffs_cred *, int, int);			\
+	int fsname##_node_reclaim2(struct puffs_usermount *,		\
+	    puffs_cookie_t, int);					\
+	int fsname##_node_open2(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, const struct puffs_cred *, int *);	\
+	int fsname##_node_fallocate(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, off_t, off_t);				\
+	int fsname##_node_fdiscard(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, off_t, off_t);
+
+
+#define PUFFSOP_INIT(ops)						\
+    ops = malloc(sizeof(struct puffs_ops));				\
+    memset(ops, 0, sizeof(struct puffs_ops))
+#define PUFFSOP_SET(ops, fsname, fsornode, opname)			\
+    (ops)->puffs_##fsornode##_##opname = fsname##_##fsornode##_##opname
+#define PUFFSOP_SETFSNOP(ops, opname)					\
+    (ops)->puffs_fs_##opname = puffs_fsnop_##opname
+
+PUFFSOP_PROTOS(puffs_null)	/* XXX */
+
+#define PNPATH(pnode)	((pnode)->pn_po.po_path)
+#define PNPLEN(pnode)	((pnode)->pn_po.po_len)
+#define PCNPATH(pcnode)	((pcnode)->pcn_po_full.po_path)
+#define PCNPLEN(pcnode)	((pcnode)->pcn_po_full.po_len)
+#define PCNISDOTDOT(pcnode) \
+	((pcnode)->pcn_namelen == 2 && strcmp((pcnode)->pcn_name, "..") == 0)
+
+#define PUFFS_STORE_DCOOKIE(cp, ncp, off)				\
+if (cp)	{								\
+	*((cp)++) = off;						\
+	(*(ncp))++;							\
+}
+
+/* mainloop */
+typedef void (*puffs_ml_loop_fn)(struct puffs_usermount *);
+
+/* framebuf stuff */
+struct puffs_framebuf;
+typedef int (*puffs_framev_readframe_fn)(struct puffs_usermount *,
+					   struct puffs_framebuf *,
+					   int, int *);
+typedef	int (*puffs_framev_writeframe_fn)(struct puffs_usermount *,
+					    struct puffs_framebuf *,
+					    int, int *);
+typedef int (*puffs_framev_cmpframe_fn)(struct puffs_usermount *,
+					 struct puffs_framebuf *,
+					 struct puffs_framebuf *,
+					 int *);
+typedef void (*puffs_framev_fdnotify_fn)(struct puffs_usermount *, int, int);
+typedef void (*puffs_framev_gotframe_fn)(struct puffs_usermount *,
+					struct puffs_framebuf *);
+typedef void (*puffs_framev_cb)(struct puffs_usermount *,
+				struct puffs_framebuf *,
+				void *, int);
+#define PUFFS_FBIO_READ		0x01
+#define PUFFS_FBIO_WRITE	0x02
+#define PUFFS_FBIO_ERROR	0x04
+
+#define PUFFS_FBQUEUE_URGENT	0x01
+
+
+__BEGIN_DECLS
+
+#define PUFFS_DEFER ((void *)-1)
+struct puffs_usermount *puffs_init(struct puffs_ops *, const char *,
+				    const char *, void *, uint32_t);
+int		puffs_mount(struct puffs_usermount *, const char *, int, void*);
+int		puffs_exit(struct puffs_usermount *, int);
+void		puffs_cancel(struct puffs_usermount *, int);
+int		puffs_mainloop(struct puffs_usermount *);
+int		puffs_daemon(struct puffs_usermount *, int, int);
+
+int		puffs_unmountonsignal(int, bool);
+
+
+int	puffs_getselectable(struct puffs_usermount *);
+int	puffs_setblockingmode(struct puffs_usermount *, int);
+int	puffs_getstate(struct puffs_usermount *);
+void	puffs_setstacksize(struct puffs_usermount *, size_t);
+
+void	puffs_ml_setloopfn(struct puffs_usermount *, puffs_ml_loop_fn);
+void	puffs_ml_settimeout(struct puffs_usermount *, struct timespec *);
+
+void			puffs_setroot(struct puffs_usermount *,
+				      struct puffs_node *);
+struct puffs_node 	*puffs_getroot(struct puffs_usermount *);
+void			puffs_setrootinfo(struct puffs_usermount *,
+					  enum vtype, vsize_t, dev_t); 
+
+void			*puffs_getspecific(struct puffs_usermount *);
+void			puffs_setspecific(struct puffs_usermount *, void *);
+void			puffs_setmaxreqlen(struct puffs_usermount *, size_t);
+size_t			puffs_getmaxreqlen(struct puffs_usermount *);
+void			puffs_setfhsize(struct puffs_usermount *, size_t, int);
+void			puffs_setmntinfo(struct puffs_usermount *,
+					 const char *, const char *);
+
+void			puffs_setncookiehash(struct puffs_usermount *, int);
+
+struct puffs_pathobj	*puffs_getrootpathobj(struct puffs_usermount *);
+
+void			puffs_setback(struct puffs_cc *, int);
+
+struct puffs_node	*puffs_pn_new(struct puffs_usermount *, void *);
+void			puffs_pn_remove(struct puffs_node *);
+void			puffs_pn_put(struct puffs_node *);
+struct vattr		*puffs_pn_getvap(struct puffs_node *);
+void *			puffs_pn_getpriv(struct puffs_node *);
+void			puffs_pn_setpriv(struct puffs_node *, void *);
+struct puffs_pathobj	*puffs_pn_getpo(struct puffs_node *);
+struct puffs_usermount	*puffs_pn_getmnt(struct puffs_node *);
+struct timespec		*puffs_pn_getvattl(struct puffs_node *);
+struct timespec		*puffs_pn_getcnttl(struct puffs_node *);
+
+void	puffs_newinfo_setcookie(struct puffs_newinfo *, puffs_cookie_t);
+void	puffs_newinfo_setvtype(struct puffs_newinfo *, enum vtype);
+void	puffs_newinfo_setsize(struct puffs_newinfo *, voff_t);
+void	puffs_newinfo_setrdev(struct puffs_newinfo *, dev_t);
+void	puffs_newinfo_setva(struct puffs_newinfo *, struct vattr *);
+void	puffs_newinfo_setvattl(struct puffs_newinfo *, struct timespec *);
+void	puffs_newinfo_setcnttl(struct puffs_newinfo *, struct timespec *);
+
+void			*puffs_pn_getmntspecific(struct puffs_node *);
+
+typedef		void *	(*puffs_nodewalk_fn)(struct puffs_usermount *,
+					     struct puffs_node *, void *);
+void			*puffs_pn_nodewalk(struct puffs_usermount *,
+					   puffs_nodewalk_fn, void *);
+
+void			puffs_setvattr(struct vattr *, const struct vattr *);
+void			puffs_vattr_null(struct vattr *);
+
+void			puffs_null_setops(struct puffs_ops *);
+
+int			puffs_dispatch_create(struct puffs_usermount *,
+					      struct puffs_framebuf *,
+					      struct puffs_cc **);
+int			puffs_dispatch_exec(struct puffs_cc *,
+					    struct puffs_framebuf **);
+
+/*
+ * generic/dummy routines applicable for some file systems
+ */
+int  puffs_fsnop_unmount(struct puffs_usermount *, int);
+int  puffs_fsnop_statvfs(struct puffs_usermount *, struct statvfs *);
+void puffs_zerostatvfs(struct statvfs *);
+int  puffs_fsnop_sync(struct puffs_usermount *, int waitfor,
+		      const struct puffs_cred *);
+
+int  puffs_genfs_node_getattr(struct puffs_usermount *, puffs_cookie_t,
+			      struct vattr *, const struct puffs_cred *);
+int  puffs_genfs_node_reclaim(struct puffs_usermount *, puffs_cookie_t);
+
+/*
+ * Subroutine stuff
+ */
+
+int		puffs_gendotdent(struct dirent **, ino_t, int, size_t *);
+int		puffs_nextdent(struct dirent **, const char *, ino_t,
+			       uint8_t, size_t *);
+int		puffs_vtype2dt(enum vtype);
+enum vtype	puffs_mode2vt(mode_t);
+void		puffs_stat2vattr(struct vattr *va, const struct stat *);
+mode_t		puffs_addvtype2mode(mode_t, enum vtype);
+
+
+/*
+ * credentials & permissions
+ */
+
+/* Credential fetch */
+int	puffs_cred_getuid(const struct puffs_cred *, uid_t *);
+int	puffs_cred_getgid(const struct puffs_cred *, gid_t *);
+int	puffs_cred_getgroups(const struct puffs_cred *, gid_t *, short *);
+
+/* Credential check */
+bool	puffs_cred_isuid(const struct puffs_cred *, uid_t);
+bool	puffs_cred_hasgroup(const struct puffs_cred *, gid_t);
+bool	puffs_cred_isregular(const struct puffs_cred *);
+bool	puffs_cred_iskernel(const struct puffs_cred *);
+bool	puffs_cred_isfs(const struct puffs_cred *);
+bool	puffs_cred_isjuggernaut(const struct puffs_cred *);
+
+/* misc */
+int	puffs_access(enum vtype, mode_t, uid_t, gid_t, mode_t,
+		     const struct puffs_cred *);
+int	puffs_access_chown(uid_t, gid_t, uid_t, gid_t,
+			   const struct puffs_cred *);
+int	puffs_access_chmod(uid_t, gid_t, enum vtype, mode_t,
+			   const struct puffs_cred *);
+int	puffs_access_times(uid_t, gid_t, mode_t, int,
+			   const struct puffs_cred *);
+
+
+/*
+ * Call Context interfaces relevant for user.
+ */
+
+void			puffs_cc_yield(struct puffs_cc *);
+void			puffs_cc_continue(struct puffs_cc *);
+void			puffs_cc_schedule(struct puffs_cc *);
+int			puffs_cc_getcaller(struct puffs_cc *,pid_t *,lwpid_t *);
+struct puffs_cc		*puffs_cc_getcc(struct puffs_usermount *);
+
+/*
+ * Flushing / invalidation routines
+ */
+
+int	puffs_inval_namecache_dir(struct puffs_usermount *, puffs_cookie_t);
+int	puffs_inval_namecache_all(struct puffs_usermount *);
+
+int	puffs_inval_pagecache_node(struct puffs_usermount *, puffs_cookie_t);
+int	puffs_inval_pagecache_node_range(struct puffs_usermount *,
+					 puffs_cookie_t, off_t, off_t);
+int	puffs_flush_pagecache_node(struct puffs_usermount *, puffs_cookie_t);
+int	puffs_flush_pagecache_node_range(struct puffs_usermount *,
+					 puffs_cookie_t, off_t, off_t);
+
+/*
+ * Path constructicons
+ */
+
+int	puffs_stdpath_buildpath(struct puffs_usermount *,
+			     const struct puffs_pathobj *,
+			     const struct puffs_pathobj *, size_t,
+			     struct puffs_pathobj *);
+int	puffs_stdpath_cmppath(struct puffs_usermount *, struct puffs_pathobj *,
+			   struct puffs_pathobj *, size_t, int);
+void	puffs_stdpath_freepath(struct puffs_usermount *,struct puffs_pathobj *);
+
+void	*puffs_path_walkcmp(struct puffs_usermount *,
+			    struct puffs_node *, void *);
+void	*puffs_path_prefixadj(struct puffs_usermount *,
+			      struct puffs_node *, void *);
+int	puffs_path_pcnbuild(struct puffs_usermount *,
+			    struct puffs_cn *, void *);
+void	puffs_path_buildhash(struct puffs_usermount *, struct puffs_pathobj *);
+void	puffs_set_pathbuild(struct puffs_usermount *, pu_pathbuild_fn); void	puffs_set_pathtransform(struct puffs_usermount *, pu_pathtransform_fn);
+void	puffs_set_pathcmp(struct puffs_usermount *, pu_pathcmp_fn);
+void	puffs_set_pathfree(struct puffs_usermount *, pu_pathfree_fn);
+void	puffs_set_namemod(struct puffs_usermount *, pu_namemod_fn);
+
+void	puffs_set_errnotify(struct puffs_usermount *, pu_errnotify_fn);
+void	puffs_kernerr_log(struct puffs_usermount *, uint8_t, int,
+			  const char *, puffs_cookie_t);
+__dead void	puffs_kernerr_abort(struct puffs_usermount *, uint8_t, int,
+			    const char *, puffs_cookie_t);
+void	puffs_set_prepost(struct puffs_usermount *,
+			  pu_prepost_fn, pu_prepost_fn);
+void	puffs_set_cmap(struct puffs_usermount *, pu_cmap_fn);
+
+/*
+ * Suspension
+ */
+
+int	puffs_fs_suspend(struct puffs_usermount *);
+
+/*
+ * Frame buffering
+ */
+
+void	puffs_framev_init(struct puffs_usermount *,
+			  puffs_framev_readframe_fn,
+			  puffs_framev_writeframe_fn,
+			  puffs_framev_cmpframe_fn,
+			  puffs_framev_gotframe_fn,
+			  puffs_framev_fdnotify_fn);
+
+struct puffs_framebuf 	*puffs_framebuf_make(void);
+void			puffs_framebuf_destroy(struct puffs_framebuf *);
+int			puffs_framebuf_dup(struct puffs_framebuf *,
+					   struct puffs_framebuf **);
+void			puffs_framebuf_recycle(struct puffs_framebuf *);
+int			puffs_framebuf_reserve_space(struct puffs_framebuf *,
+						     size_t);
+
+int	puffs_framebuf_putdata(struct puffs_framebuf *, const void *, size_t);
+int	puffs_framebuf_putdata_atoff(struct puffs_framebuf *, size_t,
+				     const void *, size_t);
+int	puffs_framebuf_getdata(struct puffs_framebuf *, void *, size_t);
+int	puffs_framebuf_getdata_atoff(struct puffs_framebuf *, size_t,
+				     void *, size_t);
+
+size_t	puffs_framebuf_telloff(struct puffs_framebuf *);
+size_t	puffs_framebuf_tellsize(struct puffs_framebuf *);
+size_t	puffs_framebuf_remaining(struct puffs_framebuf *);
+int	puffs_framebuf_seekset(struct puffs_framebuf *, size_t);
+int	puffs_framebuf_getwindow(struct puffs_framebuf *, size_t,
+				 void **, size_t *);
+
+int	puffs_framev_enqueue_cc(struct puffs_cc *, int,
+				struct puffs_framebuf *, int);
+int	puffs_framev_enqueue_cb(struct puffs_usermount *, int,
+				struct puffs_framebuf *,
+				puffs_framev_cb, void *, int);
+int	puffs_framev_enqueue_justsend(struct puffs_usermount *, int,
+				      struct puffs_framebuf *, int, int);
+int	puffs_framev_enqueue_directreceive(struct puffs_cc *, int,
+					   struct puffs_framebuf *, int);
+int	puffs_framev_enqueue_directsend(struct puffs_cc *, int,
+					   struct puffs_framebuf *, int);
+int	puffs_framev_enqueue_waitevent(struct puffs_cc *, int, int *);
+int	puffs_framev_framebuf_ccpromote(struct puffs_framebuf *,
+					struct puffs_cc *);
+
+int	puffs_framev_addfd(struct puffs_usermount *, int, int);
+int	puffs_framev_enablefd(struct puffs_usermount *, int, int);
+int	puffs_framev_disablefd(struct puffs_usermount *, int, int);
+int	puffs_framev_removefd(struct puffs_usermount *, int, int);
+void	puffs_framev_removeonclose(struct puffs_usermount *, int, int);
+void	puffs_framev_unmountonclose(struct puffs_usermount *, int, int);
+
+__END_DECLS
+
+#endif /* _PUFFS_H_ */

Property changes on: lab4/.minix-src/include/puffs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/mj.h
===================================================================
--- lab4/.minix-src/include/mj.h	(nonexistent)
+++ lab4/.minix-src/include/mj.h	(revision 13)
@@ -0,0 +1,79 @@
+/*-
+ * Copyright (c) 2010,2011 Alistair Crooks <agc@NetBSD.org>
+ * 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.
+ */
+#ifndef MJ_H_
+#define MJ_H_	20110607
+
+enum {
+	MJ_NULL		= 1,
+	MJ_FALSE	= 2,
+	MJ_TRUE		= 3,
+	MJ_NUMBER	= 4,
+	MJ_STRING	= 5,
+	MJ_ARRAY	= 6,
+	MJ_OBJECT	= 7,
+
+	MJ_LAST		= MJ_OBJECT,
+
+	MJ_HUMAN	= 0,	/* human readable, not encoded */
+	MJ_JSON_ENCODE	= 1	/* encoded JSON */
+};
+
+/* a minimalist JSON node */
+typedef struct mj_t {
+	unsigned	type;		/* type of JSON node */
+	unsigned	c;		/* # of chars */
+	unsigned	size;		/* size of array */
+	union {
+		struct mj_t	*v;	/* sub-objects */
+		char		*s;	/* string value */
+	} value;
+} mj_t;
+
+/* creation and deletion */
+int mj_create(mj_t */*atom*/, const char */*type*/, .../*value*/);
+int mj_parse(mj_t */*atom*/, const char */*s*/, int */*from*/,
+		int */*to*/, int */*token*/);
+int mj_append(mj_t */*atom*/, const char */*type*/, .../*value*/);
+int mj_append_field(mj_t */*atom*/, const char */*name*/, const char */*type*/,
+		.../*value*/);
+int mj_deepcopy(mj_t */*dst*/, mj_t */*src*/);
+void mj_delete(mj_t */*atom*/);
+
+/* JSON object access */
+int mj_arraycount(mj_t */*atom*/);
+int mj_object_find(mj_t */*atom*/, const char */*name*/,
+		const unsigned /*from*/, const unsigned /*incr*/);
+mj_t *mj_get_atom(mj_t */*atom*/, ...);
+int mj_lint(mj_t */*atom*/);
+
+/* textual output */
+int mj_snprint(char */*buf*/, size_t /*size*/, mj_t */*atom*/, int /*encoded*/);
+int mj_asprint(char **/*bufp*/, mj_t */*atom*/, int /*encoded*/);
+int mj_string_size(mj_t */*atom*/);
+int mj_pretty(mj_t */*atom*/, void */*fp*/, unsigned /*depth*/,
+		const char */*trailer*/);
+const char *mj_string_rep(mj_t */*atom*/);
+
+#endif

Property changes on: lab4/.minix-src/include/mj.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/fpu.h
===================================================================
--- lab4/.minix-src/include/x86/fpu.h	(nonexistent)
+++ lab4/.minix-src/include/x86/fpu.h	(revision 13)
@@ -0,0 +1,44 @@
+/*	$NetBSD: fpu.h,v 1.6 2014/02/25 22:16:52 dsl Exp $	*/
+
+#ifndef	_X86_FPU_H_
+#define	_X86_FPU_H_
+
+#include <x86/cpu_extended_state.h>
+
+#ifdef _KERNEL
+
+struct cpu_info;
+struct lwp;
+struct trapframe;
+
+void fpuinit(struct cpu_info *);
+void fpusave_lwp(struct lwp *, bool);
+void fpusave_cpu(bool);
+
+void fpu_set_default_cw(struct lwp *, unsigned int);
+
+void fputrap(struct trapframe *);
+void fpudna(struct trapframe *);
+
+void process_xmm_to_s87(const struct fxsave *, struct save87 *);
+void process_s87_to_xmm(const struct save87 *, struct fxsave *);
+
+/* Set all to defaults (eg during exec) */
+void fpu_save_area_clear(struct lwp *, unsigned int);
+/* Reset control words only - for signal handlers */
+void fpu_save_area_reset(struct lwp *);
+
+/* Copy data outside pcb during fork */
+void fpu_save_area_fork(struct pcb *, const struct pcb *);
+
+/* Load FP registers with user-supplied values */
+void process_write_fpregs_xmm(struct lwp *lwp, const struct fxsave *fpregs);
+void process_write_fpregs_s87(struct lwp *lwp, const struct save87 *fpregs);
+
+/* Save FP registers for copy to userspace */
+void process_read_fpregs_xmm(struct lwp *lwp, struct fxsave *fpregs);
+void process_read_fpregs_s87(struct lwp *lwp, struct save87 *fpregs);
+
+#endif
+
+#endif /* _X86_FPU_H_ */

Property changes on: lab4/.minix-src/include/x86/fpu.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/md5.h
===================================================================
--- lab4/.minix-src/include/md5.h	(nonexistent)
+++ lab4/.minix-src/include/md5.h	(revision 13)
@@ -0,0 +1 @@
+sys/md5.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/md5.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/mntopts.h
===================================================================
--- lab4/.minix-src/include/mntopts.h	(nonexistent)
+++ lab4/.minix-src/include/mntopts.h	(revision 13)
@@ -0,0 +1,108 @@
+/*	$NetBSD: mntopts.h,v 1.15 2012/10/19 17:09:06 drochner Exp $	*/
+
+/*-
+ * Copyright (c) 1994
+ *      The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)mntopts.h	8.7 (Berkeley) 3/29/95
+ */
+#ifndef _MNTOPTS_H_
+#define _MNTOPTS_H_
+
+struct mntopt {
+	const char *m_option;	/* option name */
+	int m_inverse;		/* if a negative option, eg "dev" */
+	int m_flag;		/* bit to set, eg. MNT_RDONLY */
+	int m_altloc;		/* 1 => set bit in altflags */
+};
+
+/* User-visible MNT_ flags. */
+#define MOPT_ASYNC		{ "async",	0, MNT_ASYNC, 0 }
+#define MOPT_NOCOREDUMP		{ "coredump",	1, MNT_NOCOREDUMP, 0 }
+#define MOPT_NODEV		{ "dev",	1, MNT_NODEV, 0 }
+#define MOPT_NODEVMTIME		{ "devmtime",	1, MNT_NODEVMTIME, 0 }
+#define MOPT_NOEXEC		{ "exec",	1, MNT_NOEXEC, 0 }
+#define MOPT_NOSUID		{ "suid",	1, MNT_NOSUID, 0 }
+#define MOPT_RDONLY		{ "rdonly",	0, MNT_RDONLY, 0 }
+#define MOPT_SYNC		{ "sync",	0, MNT_SYNCHRONOUS, 0 }
+#define MOPT_UNION		{ "union",	0, MNT_UNION, 0 }
+#define MOPT_USERQUOTA		{ "userquota",	0, 0, 0 }
+#define MOPT_GROUPQUOTA		{ "groupquota",	0, 0, 0 }
+#define MOPT_NOATIME		{ "atime",	1, MNT_NOATIME, 0 }
+#define MOPT_SYMPERM		{ "symperm",	0, MNT_SYMPERM, 0 }
+#define MOPT_SOFTDEP		{ "softdep",	0, MNT_SOFTDEP, 0 }
+#define MOPT_LOG		{ "log",	0, MNT_LOG, 0 }
+#define MOPT_IGNORE		{ "hidden",	0, MNT_IGNORE, 0 }
+#define MOPT_EXTATTR		{ "extattr",	0, MNT_EXTATTR, 0 }
+#define MOPT_DISCARD		{ "discard",	0, MNT_DISCARD, 0 }
+
+/* Control flags. */
+#define MOPT_FORCE		{ "force",	0, MNT_FORCE, 0 }
+#define MOPT_UPDATE		{ "update",	0, MNT_UPDATE, 0 }
+#define MOPT_RELOAD		{ "reload",	0, MNT_RELOAD, 0 }
+#define MOPT_GETARGS		{ "getargs",	0, MNT_GETARGS,	0 }
+
+/* Support for old-style "ro", "rw" flags. */
+#define MOPT_RO			{ "ro",		0, MNT_RDONLY, 0 }
+#define MOPT_RW			{ "rw",		1, MNT_RDONLY, 0 }
+
+/* This is parsed by mount(8), but is ignored by specific mount_*(8)s. */
+#define MOPT_AUTO		{ "auto",	0, 0, 0 }
+#define MOPT_RUMP		{ "rump",	0, 0, 0 }
+#define MOPT_NULL		{ NULL,		0, 0, 0 }
+
+#define MOPT_FSTAB_COMPAT						\
+	MOPT_RO,							\
+	MOPT_RW,							\
+	MOPT_AUTO
+
+/* Standard options which all mounts can understand. */
+#define MOPT_STDOPTS							\
+	MOPT_USERQUOTA,							\
+	MOPT_GROUPQUOTA,						\
+	MOPT_FSTAB_COMPAT,						\
+	MOPT_NOCOREDUMP,						\
+	MOPT_NODEV,							\
+	MOPT_NOEXEC,							\
+	MOPT_NOSUID,							\
+	MOPT_RDONLY,							\
+	MOPT_UNION,							\
+	MOPT_IGNORE,							\
+	MOPT_SYMPERM,							\
+	MOPT_RUMP
+
+__BEGIN_DECLS
+typedef struct mntoptparse *mntoptparse_t;
+mntoptparse_t getmntopts(const char *, const struct mntopt *, int *, int *);
+const char *getmntoptstr(mntoptparse_t, const char *);
+long getmntoptnum(mntoptparse_t, const char *);
+void freemntopts(mntoptparse_t);
+
+extern int getmnt_silent;
+__END_DECLS
+
+#endif /* _MNTOPTS_H_ */

Property changes on: lab4/.minix-src/include/mntopts.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/mqueue.h
===================================================================
--- lab4/.minix-src/include/mqueue.h	(nonexistent)
+++ lab4/.minix-src/include/mqueue.h	(revision 13)
@@ -0,0 +1,60 @@
+/*	$NetBSD: mqueue.h,v 1.4 2009/01/11 03:04:12 christos Exp $	*/
+
+/*
+ * Copyright (c) 2007, Mindaugas Rasiukevicius <rmind at NetBSD org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _MQUEUE_H_
+#define _MQUEUE_H_
+
+#include <fcntl.h>
+#include <signal.h>
+#include <time.h>
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/mqueue.h>
+
+__BEGIN_DECLS
+int	mq_close(mqd_t);
+int	mq_getattr(mqd_t, struct mq_attr *);
+int	mq_notify(mqd_t, const struct sigevent *);
+mqd_t	mq_open(const char *, int, ...);
+ssize_t	mq_receive(mqd_t, char *, size_t, unsigned *);
+int	mq_send(mqd_t, const char *, size_t, unsigned);
+int	mq_setattr(mqd_t, const struct mq_attr * __restrict,
+		    struct mq_attr * __restrict);
+#ifndef __LIBC12_SOURCE__
+ssize_t	mq_timedreceive(mqd_t, char * __restrict, size_t,
+    unsigned * __restrict, const struct timespec * __restrict)
+    __RENAME(__mq_timedreceive50);
+int	mq_timedsend(mqd_t, const char *, size_t, unsigned,
+    const struct timespec *) __RENAME(__mq_timedsend50);
+#endif
+int	mq_unlink(const char *);
+__END_DECLS
+
+#endif	/* _MQUEUE_H_ */

Property changes on: lab4/.minix-src/include/mqueue.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/intrdefs.h
===================================================================
--- lab4/.minix-src/include/x86/intrdefs.h	(nonexistent)
+++ lab4/.minix-src/include/x86/intrdefs.h	(revision 13)
@@ -0,0 +1,81 @@
+/*	$NetBSD: intrdefs.h,v 1.20 2014/05/19 22:47:54 rmind Exp $	*/
+
+#ifndef _X86_INTRDEFS_H_
+#define _X86_INTRDEFS_H_
+
+/* Interrupt priority levels. */
+#define	IPL_NONE	0x0	/* nothing */
+#define	IPL_PREEMPT	0x1	/* fake, to prevent recursive preemptions */
+#define	IPL_SOFTCLOCK	0x2	/* timeouts */
+#define	IPL_SOFTBIO	0x3	/* block I/O passdown */
+#define	IPL_SOFTNET	0x4	/* protocol stacks */
+#define	IPL_SOFTSERIAL	0x5	/* serial passdown */
+#define	IPL_VM		0x6	/* low I/O, memory allocation */
+#define IPL_SCHED	0x7	/* medium I/O, scheduler, clock */
+#define	IPL_HIGH	0x8	/* high I/O, statclock, IPIs */
+#define	NIPL		9
+
+/* Interrupt sharing types. */
+#define	IST_NONE	0	/* none */
+#define	IST_PULSE	1	/* pulsed */
+#define	IST_EDGE	2	/* edge-triggered */
+#define	IST_LEVEL	3	/* level-triggered */
+
+/*
+ * Local APIC masks and software interrupt masks, in order
+ * of priority.  Must not conflict with SIR_* below.
+ */
+#define LIR_IPI		31
+#define LIR_TIMER	30
+
+/*
+ * XXX These should be lowest numbered, but right now would
+ * conflict with the legacy IRQs.  Their current position
+ * means that soft interrupt take priority over hardware
+ * interrupts when lowering the priority level!
+ */
+#define	SIR_SERIAL	29
+#define	SIR_NET		28
+#define	SIR_BIO		27
+#define	SIR_CLOCK	26
+#define	SIR_PREEMPT	25
+
+/*
+ * Maximum # of interrupt sources per CPU. 32 to fit in one word.
+ * ioapics can theoretically produce more, but it's not likely to
+ * happen. For multiple ioapics, things can be routed to different
+ * CPUs.
+ */
+#define MAX_INTR_SOURCES	32
+#define NUM_LEGACY_IRQS		16
+
+/*
+ * Low and high boundaries between which interrupt gates will
+ * be allocated in the IDT.
+ */
+#define IDT_INTR_LOW	(0x20 + NUM_LEGACY_IRQS)
+#define IDT_INTR_HIGH	0xef
+
+#ifndef XEN
+
+#define X86_IPI_HALT			0x00000001
+#define X86_IPI_MICROSET		0x00000002
+#define X86_IPI_GENERIC			0x00000004
+#define X86_IPI_SYNCH_FPU		0x00000008
+#define X86_IPI_MTRR			0x00000010
+#define X86_IPI_GDT			0x00000020
+#define X86_IPI_XCALL			0x00000040
+#define X86_IPI_ACPI_CPU_SLEEP		0x00000080
+#define X86_IPI_KPREEMPT		0x00000100
+
+#define X86_NIPI		9
+
+#define X86_IPI_NAMES { "halt IPI", "timeset IPI", "generic IPI", \
+			 "FPU synch IPI", "MTRR update IPI", \
+			 "GDT update IPI", "xcall IPI", \
+			 "ACPI CPU sleep IPI", "kpreempt IPI" }
+#endif /* XEN */
+
+#define IREENT_MAGIC	0x18041969
+
+#endif /* _X86_INTRDEFS_H_ */

Property changes on: lab4/.minix-src/include/x86/intrdefs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ranlib.h
===================================================================
--- lab4/.minix-src/include/ranlib.h	(nonexistent)
+++ lab4/.minix-src/include/ranlib.h	(revision 13)
@@ -0,0 +1,48 @@
+/*	$NetBSD: ranlib.h,v 1.6 2003/08/07 09:44:11 agc Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ranlib.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _RANLIB_H_
+#define	_RANLIB_H_
+
+#define	RANLIBMAG	"__.SYMDEF"	/* archive file name */
+#define	RANLIBSKEW	3		/* creation time offset */
+
+struct ranlib {
+	union {
+		long ran_strx;		/* string table index */
+		char *ran_name;		/* in memory symbol name */
+	} ran_un;
+	long ran_off;			/* archive file offset */
+};
+
+#endif /* !_RANLIB_H_ */

Property changes on: lab4/.minix-src/include/ranlib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/mutex.h
===================================================================
--- lab4/.minix-src/include/x86/mutex.h	(nonexistent)
+++ lab4/.minix-src/include/x86/mutex.h	(revision 13)
@@ -0,0 +1,80 @@
+/*	$NetBSD: mutex.h,v 1.6 2009/04/24 17:49:51 ad Exp $	*/
+
+/*-
+ * Copyright (c) 2002, 2006, 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe and Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _X86_MUTEX_H_
+#define	_X86_MUTEX_H_
+
+struct kmutex {
+	union {
+		volatile uintptr_t	mtxa_owner;
+#ifdef __MUTEX_PRIVATE
+		struct {
+			volatile uint8_t	mtxs_dummy;
+			ipl_cookie_t		mtxs_ipl;
+                        __cpu_simple_lock_t	mtxs_lock;
+			volatile uint8_t	mtxs_unused;
+		} s;
+#endif
+	} u;
+};
+
+#ifdef __MUTEX_PRIVATE
+
+#define	mtx_owner 			u.mtxa_owner
+#define	mtx_ipl 			u.s.mtxs_ipl
+#define	mtx_lock			u.s.mtxs_lock
+
+#define __HAVE_MUTEX_STUBS		1
+#define __HAVE_SPIN_MUTEX_STUBS		1
+#define	__HAVE_SIMPLE_MUTEXES		1
+
+/*
+ * MUTEX_RECEIVE: technically, no memory barrier is required
+ * as 'ret' implies a load fence.  However we need this to
+ * handle a bug with some Opteron revisions.  See patch.c,
+ * lock_stubs.S.
+ */
+#define	MUTEX_RECEIVE(mtx)		membar_consumer()
+
+/*
+ * MUTEX_GIVE: no memory barrier required, as _lock_cas() will take care of it.
+ */
+#define	MUTEX_GIVE(mtx)			/* nothing */
+
+#define	MUTEX_CAS(p, o, n)		\
+    (_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
+
+unsigned long	_atomic_cas_ulong(volatile unsigned long *,
+    unsigned long, unsigned long);
+
+#endif	/* __MUTEX_PRIVATE */
+
+#endif /* _X86_MUTEX_H_ */

Property changes on: lab4/.minix-src/include/x86/mutex.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netgroup.h
===================================================================
--- lab4/.minix-src/include/netgroup.h	(nonexistent)
+++ lab4/.minix-src/include/netgroup.h	(revision 13)
@@ -0,0 +1,71 @@
+/*	$NetBSD: netgroup.h,v 1.10 2009/10/21 01:07:45 snj Exp $	*/
+
+/*
+ * Copyright (c) 1994 Christos Zoulas
+ * 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.
+ */
+
+#ifndef _NETGROUP_H_
+#define	_NETGROUP_H_
+
+#include <sys/cdefs.h>
+
+#define	_PATH_NETGROUP		"/etc/netgroup"
+
+#define	_PATH_NETGROUP_DB	"/var/db/netgroup.db"
+
+#define	_PATH_NETGROUP_MKDB	"/usr/sbin/netgroup_mkdb"
+
+#define	_NG_KEYBYNAME		'1'	/* stored by name */
+#define	_NG_KEYBYUSER		'2'	/* stored by user */
+#define	_NG_KEYBYHOST		'3'	/* stored by host */
+
+#define _NG_ERROR	-1
+#define _NG_NONE	 0
+#define _NG_NAME	 1
+#define _NG_GROUP	 2
+
+struct netgroup {
+	__aconst char *ng_host;		/* host name */
+	__aconst char *ng_user;		/* user name */
+	__aconst char *ng_domain;	/* domain name */
+	struct	netgroup *ng_next;	/* thread */
+};
+
+__BEGIN_DECLS
+void	setnetgrent	(const char *);
+int	getnetgrent	(const char **, const char **, const char **);
+void	endnetgrent	(void);
+int	innetgr		(const char *, const char *, const char *,
+			     const char *);
+#ifdef _NETGROUP_PRIVATE
+char    *_ng_makekey(const char *, const char *, size_t);
+int	_ng_parse(char **, char **, struct netgroup **);
+void	_ng_print(char *, size_t, const struct netgroup *);
+void	_ng_cycle(const char *, const StringList *);
+#endif /* _NETGROUP_PRIVATE */
+
+__END_DECLS
+
+#endif /* !_NETGROUP_H_ */

Property changes on: lab4/.minix-src/include/netgroup.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ndbm.h
===================================================================
--- lab4/.minix-src/include/ndbm.h	(nonexistent)
+++ lab4/.minix-src/include/ndbm.h	(revision 13)
@@ -0,0 +1,89 @@
+/*	$NetBSD: ndbm.h,v 1.15 2010/02/03 15:34:40 roy Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Margo Seltzer.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ndbm.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _NDBM_H_
+#define	_NDBM_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <stdint.h>
+#include <db.h>
+
+#if defined(_NETBSD_SOURCE)
+/* Map dbm interface onto db(3). */
+#define DBM_RDONLY	O_RDONLY
+#endif
+
+/* Flags to dbm_store(). */
+#define DBM_INSERT      0
+#define DBM_REPLACE     1
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * The db(3) support for ndbm(3) always appends this suffix to the
+ * file name to avoid overwriting the user's original database.
+ */
+#define	DBM_SUFFIX	".db"
+#endif
+
+typedef struct {
+	void	*dptr;
+	size_t	 dsize;		/* XPG4.2 */
+} datum;
+
+typedef DB DBM;
+#if defined(_NETBSD_SOURCE)
+#define	dbm_pagfno(a)	DBM_PAGFNO_NOT_AVAILABLE
+#endif
+
+__BEGIN_DECLS
+void	 dbm_close(DBM *);
+DBM	*dbm_open(const char *, int, mode_t);
+int	 dbm_error(DBM *);
+int	 dbm_clearerr(DBM *);
+#if defined(_NETBSD_SOURCE)
+int	 dbm_dirfno(DBM *);
+#endif
+#ifndef __LIBC12_SOURCE__
+int	 dbm_delete(DBM *, datum)		__RENAME(__dbm_delete13);
+datum	 dbm_fetch(DBM *, datum)		__RENAME(__dbm_fetch13);
+datum	 dbm_firstkey(DBM *)			__RENAME(__dbm_firstkey13);
+datum	 dbm_nextkey(DBM *)			__RENAME(__dbm_nextkey13);
+int	 dbm_store(DBM *, datum, datum, int)	__RENAME(__dbm_store13);
+#endif
+__END_DECLS
+
+#endif /* !_NDBM_H_ */

Property changes on: lab4/.minix-src/include/ndbm.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/res_update.h
===================================================================
--- lab4/.minix-src/include/res_update.h	(nonexistent)
+++ lab4/.minix-src/include/res_update.h	(revision 13)
@@ -0,0 +1,67 @@
+/*	$NetBSD: res_update.h,v 1.8 2012/11/15 18:49:37 christos Exp $	*/
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1999 by Internet Software Consortium, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ *	Id: res_update.h,v 1.3 2005/04/27 04:56:15 sra Exp
+ */
+
+#ifndef __RES_UPDATE_H
+#define __RES_UPDATE_H
+
+#include <sys/types.h>
+#include <arpa/nameser.h>
+#include <sys/queue.h>
+#include <resolv.h>
+
+/*%
+ * This RR-like structure is particular to UPDATE.
+ */
+struct ns_updrec {
+	TAILQ_ENTRY(ns_updrec) r_link, r_glink;
+	ns_sect		r_section;	/*%< ZONE/PREREQUISITE/UPDATE */
+	char *		r_dname;	/*%< owner of the RR */
+	ns_class	r_class;	/*%< class number */
+	ns_type		r_type;		/*%< type number */
+	uint32_t	r_ttl;		/*%< time to live */
+	u_char *	r_data;		/*%< rdata fields as text string */
+	u_int		r_size;		/*%< size of r_data field */
+	int		r_opcode;	/*%< type of operation */
+	/* following fields for private use by the resolver/server routines */
+	struct databuf *r_dp;		/*%< databuf to process */
+	struct databuf *r_deldp;	/*%< databuf's deleted/overwritten */
+	u_int		r_zone;		/*%< zone number on server */
+};
+typedef struct ns_updrec ns_updrec;
+typedef	TAILQ_HEAD(ns_updqueu, ns_updrec) ns_updque;
+
+#define res_mkupdate		__res_mkupdate
+#define res_update		__res_update
+#define res_mkupdrec		__res_mkupdrec
+#define res_freeupdrec		__res_freeupdrec
+#define res_nmkupdate		__res_nmkupdate
+#define res_nupdate		__res_nupdate
+
+int		res_mkupdate(ns_updrec *, u_char *, int);
+int		res_update(ns_updrec *);
+ns_updrec *	res_mkupdrec(int, const char *, u_int, u_int, u_long);
+void		res_freeupdrec(ns_updrec *);
+int		res_nmkupdate(res_state, ns_updrec *, u_char *, int);
+int		res_nupdate(res_state, ns_updrec *, ns_tsig_key *);
+
+#endif /*__RES_UPDATE_H*/

Property changes on: lab4/.minix-src/include/res_update.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/psl.h
===================================================================
--- lab4/.minix-src/include/x86/psl.h	(nonexistent)
+++ lab4/.minix-src/include/x86/psl.h	(revision 13)
@@ -0,0 +1,87 @@
+/*	$NetBSD: psl.h,v 1.8 2012/10/04 21:23:45 dsl Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)psl.h	5.2 (Berkeley) 1/18/91
+ */
+
+#ifndef _X86_PSL_H_
+#define _X86_PSL_H_
+
+/*
+ * 386 processor status longword.
+ */
+#define	PSL_C		0x00000001	/* carry flag */
+#define	PSL_PF		0x00000004	/* parity flag */
+#define	PSL_AF		0x00000010	/* auxiliary carry flag */
+#define	PSL_Z		0x00000040	/* zero flag */
+#define	PSL_N		0x00000080	/* sign flag */
+#define	PSL_T		0x00000100	/* trap flag */
+#define	PSL_I		0x00000200	/* interrupt enable flag */
+#define	PSL_D		0x00000400	/* direction flag */
+#define	PSL_V		0x00000800	/* overflow flag */
+#define	PSL_IOPL	0x00003000	/* i/o privilege level */
+#define	PSL_NT		0x00004000	/* nested task */
+#define	PSL_RF		0x00010000	/* resume flag */
+#define	PSL_VM		0x00020000	/* virtual 8086 mode */
+#define	PSL_AC		0x00040000	/* alignment check flag */
+#define	PSL_VIF		0x00080000	/* virtual interrupt enable flag */
+#define	PSL_VIP		0x00100000	/* virtual interrupt pending flag */
+#define	PSL_ID		0x00200000	/* identification flag */
+
+#define	PSL_MBO		0x00000002	/* must be one bits */
+#define	PSL_MBZ		0xffc08028	/* must be zero bits */
+
+#define	PSL_USERSET	(PSL_MBO | PSL_I)
+#ifdef i386
+#if defined(_KERNEL_OPT)
+#include "opt_vm86.h"
+#endif
+#endif
+#ifdef VM86
+#define	PSL_USERSTATIC	(PSL_MBO | PSL_MBZ | PSL_I | PSL_IOPL | PSL_NT | PSL_VIF | PSL_VIP)
+#else
+#define	PSL_USERSTATIC	(PSL_MBO | PSL_MBZ | PSL_I | PSL_IOPL | PSL_NT | PSL_VM | PSL_VIF | PSL_VIP)
+#endif
+#define PSL_USER	(PSL_C | PSL_PF | PSL_AF | PSL_Z | PSL_N | \
+    PSL_T | PSL_V | PSL_D | PSL_AC)
+#define	PSL_CLEARSIG	(PSL_T | PSL_VM | PSL_AC | PSL_D)
+
+
+/*
+ * ???
+ */
+#ifdef _KERNEL
+#include <machine/intr.h>
+#endif
+
+#endif /* !_X86_PSL_H_ */

Property changes on: lab4/.minix-src/include/x86/psl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/nsswitch.h
===================================================================
--- lab4/.minix-src/include/nsswitch.h	(nonexistent)
+++ lab4/.minix-src/include/nsswitch.h	(revision 13)
@@ -0,0 +1,230 @@
+/*	$NetBSD: nsswitch.h,v 1.21 2011/07/17 20:54:34 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1997, 1998, 1999, 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _NSSWITCH_H
+#define _NSSWITCH_H	1
+
+#include <sys/types.h>
+#include <stdarg.h>
+
+#define	NSS_MODULE_INTERFACE_VERSION	0
+
+#ifndef _PATH_NS_CONF
+#define _PATH_NS_CONF	"/etc/nsswitch.conf"
+#endif
+
+#define	NS_CONTINUE	0
+#define	NS_RETURN	1
+
+/*
+ * Layout of:
+ *	uint32_t ns_src.flags
+ */ 
+	/* nsswitch.conf status codes and nsdispatch(3) return values */
+#define	NS_SUCCESS	(1<<0)		/* entry was found */
+#define	NS_UNAVAIL	(1<<1)		/* source not responding, or corrupt */
+#define	NS_NOTFOUND	(1<<2)		/* source responded 'no such entry' */
+#define	NS_TRYAGAIN	(1<<3)		/* source busy, may respond to retrys */
+#define	NS_STATUSMASK	0x000000ff	/* bitmask to get the status flags */
+
+	/* internal nsdispatch(3) flags; not settable in nsswitch.conf(5)  */
+#define	NS_FORCEALL	(1<<8)		/* force all methods to be invoked; */
+
+/*
+ * Currently implemented sources.
+ */
+#define NSSRC_FILES	"files"		/* local files */
+#define	NSSRC_DNS	"dns"		/* DNS; IN for hosts, HS for others */
+#define	NSSRC_NIS	"nis"		/* YP/NIS */
+#define	NSSRC_COMPAT	"compat"	/* passwd,group in YP compat mode */
+
+/*
+ * Currently implemented databases.
+ */
+#define NSDB_HOSTS		"hosts"
+#define NSDB_GROUP		"group"
+#define NSDB_GROUP_COMPAT	"group_compat"
+#define NSDB_NETGROUP		"netgroup"
+#define NSDB_NETWORKS		"networks"
+#define NSDB_PASSWD		"passwd"
+#define NSDB_PASSWD_COMPAT	"passwd_compat"
+#define NSDB_SHELLS		"shells"
+
+/*
+ * Suggested databases to implement.
+ */
+#define NSDB_ALIASES		"aliases"
+#define NSDB_AUTH		"auth"
+#define NSDB_AUTOMOUNT		"automount"
+#define NSDB_BOOTPARAMS		"bootparams"
+#define NSDB_ETHERS		"ethers"
+#define NSDB_EXPORTS		"exports"
+#define NSDB_NETMASKS		"netmasks"
+#define NSDB_PHONES		"phones"
+#define NSDB_PRINTCAP		"printcap"
+#define NSDB_PROTOCOLS		"protocols"
+#define NSDB_REMOTE		"remote"
+#define NSDB_RPC		"rpc"
+#define NSDB_SENDMAILVARS	"sendmailvars"
+#define NSDB_SERVICES		"services"
+#define NSDB_TERMCAP		"termcap"
+#define NSDB_TTYS		"ttys"
+
+/*
+ * ns_dtab `callback' function signature.
+ */
+typedef	int (*nss_method)(void *, void *, va_list);
+
+/*
+ * ns_dtab - `nsswitch dispatch table'
+ * Contains an entry for each source and the appropriate function to call.
+ */
+typedef struct {
+	const char	 *src;
+	nss_method	 callback;
+	void		 *cb_data;
+} ns_dtab;
+
+/*
+ * Macros to help build an ns_dtab[]
+ */
+#define NS_FILES_CB(F,C)	{ NSSRC_FILES,	F,	__UNCONST(C) },
+#define NS_COMPAT_CB(F,C)	{ NSSRC_COMPAT,	F,	__UNCONST(C) },
+ 
+#ifdef HESIOD
+#   define NS_DNS_CB(F,C)	{ NSSRC_DNS,	F,	__UNCONST(C) },
+#else
+#   define NS_DNS_CB(F,C)
+#endif
+
+#ifdef YP
+#   define NS_NIS_CB(F,C)	{ NSSRC_NIS,	F,	__UNCONST(C) },
+#else
+#   define NS_NIS_CB(F,C)
+#endif
+#define	NS_NULL_CB		{ .src = NULL },
+
+/*
+ * ns_src - `nsswitch source'
+ * Used by the nsparser routines to store a mapping between a source
+ * and its dispatch control flags for a given database.
+ */
+typedef struct {
+	const char	*name;
+	uint32_t	 flags;
+} ns_src;
+
+
+/*
+ * Default sourcelists (if nsswitch.conf is missing, corrupt,
+ * or the requested database doesn't have an entry)
+ */
+extern const ns_src __nsdefaultsrc[];
+extern const ns_src __nsdefaultcompat[];
+extern const ns_src __nsdefaultcompat_forceall[];
+extern const ns_src __nsdefaultfiles[];
+extern const ns_src __nsdefaultfiles_forceall[];
+extern const ns_src __nsdefaultnis[];
+extern const ns_src __nsdefaultnis_forceall[];
+
+
+/*
+ * ns_mtab - `nsswitch method table'
+ * An nsswitch module provides a mapping from (database name, method name)
+ * tuples to the nss_method and associated callback data.  Effectively,
+ * ns_dtab, but used for dynamically loaded modules.
+ */
+typedef struct {
+	const char	*database;
+	const char	*name;
+	nss_method	 method;
+	void		*mdata;
+} ns_mtab;
+
+/*
+ * nss_module_register_fn - module registration function
+ *	called at module load
+ * nss_module_unregister_fn - module un-registration function
+ *	called at module unload
+ */
+typedef	void (*nss_module_unregister_fn)(ns_mtab *, u_int);
+typedef	ns_mtab *(*nss_module_register_fn)(const char *, u_int *,
+					   nss_module_unregister_fn *);
+
+#ifdef _NS_PRIVATE
+
+/*
+ * Private data structures for back-end nsswitch implementation.
+ */
+
+/*
+ * ns_dbt - `nsswitch database thang'
+ * For each database in /etc/nsswitch.conf there is a ns_dbt, with its
+ * name and a list of ns_src's containing the source information.
+ */
+typedef struct {
+	const char	*name;		/* name of database */
+	ns_src		*srclist;	/* list of sources */
+	u_int		 srclistsize;	/* size of srclist */
+} ns_dbt;
+
+/*
+ * ns_mod - `nsswitch module'
+ */
+typedef struct {
+	const char	*name;		/* module name */
+	void		*handle;	/* handle from dlopen() */
+	ns_mtab		*mtab;		/* method table */
+	u_int		 mtabsize;	/* size of mtab */
+					/* called to unload module */
+	nss_module_unregister_fn unregister;
+} ns_mod;
+
+#endif /* _NS_PRIVATE */
+
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	nsdispatch(void *, const ns_dtab [], const char *,
+			const char *, const ns_src [], ...);
+
+#ifdef _NS_PRIVATE
+int		 _nsdbtaddsrc(ns_dbt *, const ns_src *);
+void		 _nsdbtdump(const ns_dbt *);
+int		 _nsdbtput(const ns_dbt *);
+void		 _nsyyerror(const char *);
+int		 _nsyylex(void);
+#endif /* _NS_PRIVATE */
+
+__END_DECLS
+
+#endif /* !_NSSWITCH_H */

Property changes on: lab4/.minix-src/include/nsswitch.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netpgp.h
===================================================================
--- lab4/.minix-src/include/netpgp.h	(nonexistent)
+++ lab4/.minix-src/include/netpgp.h	(revision 13)
@@ -0,0 +1,110 @@
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Alistair Crooks (agc@netbsd.org)
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef NETPGP_H_
+#define NETPGP_H_
+
+#ifndef __BEGIN_DECLS
+#  if defined(__cplusplus)
+#  define __BEGIN_DECLS           extern "C" {
+#  define __END_DECLS             }
+#  else
+#  define __BEGIN_DECLS
+#  define __END_DECLS
+#  endif
+#endif
+
+__BEGIN_DECLS
+
+/* structure used to hold (key,value) pair information */
+typedef struct netpgp_t {
+	unsigned	  c;		/* # of elements used */
+	unsigned	  size;		/* size of array */
+	char		**name;		/* key names */
+	char		**value;	/* value information */
+	void		 *pubring;	/* public key ring */
+	void		 *secring;	/* s3kr1t key ring */
+	void		 *io;		/* the io struct for results/errs */
+	void		 *passfp;	/* file pointer for password input */
+} netpgp_t;
+
+/* begin and end */
+int netpgp_init(netpgp_t *);
+int netpgp_end(netpgp_t *);
+
+/* debugging, reflection and information */
+int netpgp_set_debug(const char *);
+int netpgp_get_debug(const char *);
+const char *netpgp_get_info(const char *);
+int netpgp_list_packets(netpgp_t *, char *, int, char *);
+
+/* variables */
+int netpgp_setvar(netpgp_t *, const char *, const char *);
+char *netpgp_getvar(netpgp_t *, const char *);
+int netpgp_incvar(netpgp_t *, const char *, const int);
+int netpgp_unsetvar(netpgp_t *, const char *);
+
+/* set home directory information */
+int netpgp_set_homedir(netpgp_t *, char *, const char *, const int);
+
+/* key management */
+int netpgp_list_keys(netpgp_t *, const int);
+int netpgp_list_keys_json(netpgp_t *, char **, const int);
+int netpgp_find_key(netpgp_t *, char *);
+char *netpgp_get_key(netpgp_t *, const char *, const char *);
+char *netpgp_export_key(netpgp_t *, char *);
+int netpgp_import_key(netpgp_t *, char *);
+int netpgp_generate_key(netpgp_t *, char *, int);
+
+/* file management */
+int netpgp_encrypt_file(netpgp_t *, const char *, const char *, char *, int);
+int netpgp_decrypt_file(netpgp_t *, const char *, char *, int);
+int netpgp_sign_file(netpgp_t *, const char *, const char *, char *, int, int, int);
+int netpgp_verify_file(netpgp_t *, const char *, const char *, int);
+
+/* memory signing and encryption */
+int netpgp_sign_memory(netpgp_t *, const char *, char *, size_t, char *, size_t, const unsigned, const unsigned);
+int netpgp_verify_memory(netpgp_t *, const void *, const size_t, void *, size_t, const int);
+int netpgp_encrypt_memory(netpgp_t *, const char *, void *, const size_t, char *, size_t, int);
+int netpgp_decrypt_memory(netpgp_t *, const void *, const size_t, char *, size_t, const int);
+
+/* match and hkp-related functions */
+int netpgp_match_keys_json(netpgp_t *, char **, char *, const char *, const int);
+int netpgp_match_keys(netpgp_t *, char *, const char *, void *, const int);
+int netpgp_match_pubkeys(netpgp_t *, char *, void *);
+int netpgp_format_json(void *, const char *, const int);
+
+int netpgp_validate_sigs(netpgp_t *);
+
+/* save pgp key in ssh format */
+int netpgp_write_sshkey(netpgp_t *, char *, const char *, char *, size_t);
+
+
+__END_DECLS
+
+#endif /* !NETPGP_H_ */

Property changes on: lab4/.minix-src/include/netpgp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/saslc.h
===================================================================
--- lab4/.minix-src/include/saslc.h	(nonexistent)
+++ lab4/.minix-src/include/saslc.h	(revision 13)
@@ -0,0 +1,91 @@
+/*	$NetBSD: saslc.h,v 1.5 2011/02/16 02:14:22 christos Exp $	*/
+
+/* Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Mateusz Kocielski.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *	  notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *	  must display the following acknowledgement:
+ *		  This product includes software developed by the NetBSD
+ *		  Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *	  contributors may be used to endorse or promote products derived
+ *	  from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.	IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SASLC_H_
+#define _SASLC_H_
+
+#include <sys/types.h>
+
+/* properties */
+#define	SASLC_PROP_AUTHCID	"AUTHCID"
+#define SASLC_PROP_AUTHZID	"AUTHZID"
+#define SASLC_PROP_BASE64IO	"BASE64IO"
+#define SASLC_PROP_CIPHERMASK	"CIPHERMASK"
+#define SASLC_PROP_DEBUG	"DEBUG"
+#define SASLC_PROP_HOSTNAME	"HOSTNAME"
+#define SASLC_PROP_MAXBUF	"MAXBUF"
+#define SASLC_PROP_PASSWD	"PASSWD"
+#define SASLC_PROP_QOPMASK	"QOPMASK"
+#define SASLC_PROP_REALM	"REALM"
+#define SASLC_PROP_SECURITY	"SECURITY"
+#define SASLC_PROP_SERVICE	"SERVICE"
+#define SASLC_PROP_SERVNAME	"SERVNAME"
+
+/* environment variables */
+#define SASLC_ENV_CONFIG	"SASLC_CONFIG"
+#define SASLC_ENV_DEBUG		"SASLC_DEBUG"
+
+/* opaque types */
+typedef struct saslc_t saslc_t;
+typedef struct saslc_sess_t saslc_sess_t;
+
+/* begin and end */
+saslc_t *saslc_alloc(void);
+int saslc_init(saslc_t *, const char *, const char *);
+int saslc_end(saslc_t *);
+
+/* error */
+const char *saslc_strerror(saslc_t *);
+const char *saslc_sess_strerror(saslc_sess_t *);
+
+/* session begin and end */
+saslc_sess_t *saslc_sess_init(saslc_t *, const char *, const char *);
+void saslc_sess_end(saslc_sess_t *);
+
+/* session properties */
+int saslc_sess_setprop(saslc_sess_t *, const char *, const char *);
+const char *saslc_sess_getprop(saslc_sess_t *, const char *);
+const char *saslc_sess_getmech(saslc_sess_t *);
+
+/* session management */
+int saslc_sess_cont(saslc_sess_t *, const void *, size_t, void **, size_t *);
+ssize_t saslc_sess_encode(saslc_sess_t *, const void *, size_t, void **,
+    size_t *);
+ssize_t saslc_sess_decode(saslc_sess_t *, const void *, size_t, void **,
+    size_t *);
+
+#endif /* ! _SASLC_H_ */

Property changes on: lab4/.minix-src/include/saslc.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/x86/sysarch.h
===================================================================
--- lab4/.minix-src/include/x86/sysarch.h	(nonexistent)
+++ lab4/.minix-src/include/x86/sysarch.h	(revision 13)
@@ -0,0 +1,198 @@
+/*	$NetBSD: sysarch.h,v 1.9 2010/07/07 01:14:53 chs Exp $	*/
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _X86_SYSARCH_H_
+#define _X86_SYSARCH_H_
+
+#define X86_GET_LDT		0
+#define X86_SET_LDT		1
+#define	X86_IOPL		2
+#define	X86_GET_IOPERM		3
+#define	X86_SET_IOPERM		4
+#define	X86_OLD_VM86		5
+#define	X86_PMC_INFO		8
+#define	X86_PMC_STARTSTOP	9
+#define	X86_PMC_READ		10
+#define X86_GET_MTRR		11
+#define X86_SET_MTRR		12
+#define	X86_VM86		13
+#define	X86_GET_GSBASE		14
+#define	X86_GET_FSBASE		15
+#define	X86_SET_GSBASE		16
+#define	X86_SET_FSBASE		17
+
+#ifdef _KERNEL
+#define	_X86_SYSARCH_L(x)	x86_##x
+#define	_X86_SYSARCH_U(x)	X86_##x
+#elif defined(__i386__)
+#define	_X86_SYSARCH_L(x)	i386_##x
+#define	_X86_SYSARCH_U(x)	I386_##x
+#define I386_GET_LDT		X86_GET_LDT
+#define I386_SET_LDT		X86_SET_LDT
+#define	I386_IOPL		X86_IOPL
+#define	I386_GET_IOPERM		X86_GET_IOPERM
+#define	I386_SET_IOPERM		X86_SET_IOPERM
+#define	I386_OLD_VM86		X86_OLD_VM86
+#define	I386_PMC_INFO		X86_PMC_INFO
+#define	I386_PMC_STARTSTOP	X86_PMC_STARTSTOP
+#define	I386_PMC_READ		X86_PMC_READ
+#define I386_GET_MTRR		X86_GET_MTRR
+#define I386_SET_MTRR		X86_SET_MTRR
+#define	I386_VM86		X86_VM86
+#define	I386_GET_GSBASE		X86_GET_GSBASE
+#define	I386_GET_FSBASE		X86_GET_FSBASE
+#define	I386_SET_GSBASE		X86_SET_GSBASE
+#define	I386_SET_FSBASE		X86_SET_FSBASE
+#else
+#define	_X86_SYSARCH_L(x)	x86_64_##x
+#define	_X86_SYSARCH_U(x)	X86_64_##x
+#define X86_64_GET_LDT		X86_GET_LDT
+#define X86_64_SET_LDT		X86_SET_LDT
+#define	X86_64_IOPL		X86_IOPL
+#define	X86_64_GET_IOPERM	X86_GET_IOPERM
+#define	X86_64_SET_IOPERM	X86_SET_IOPERM
+#define	X86_64_OLD_VM86		X86_OLD_VM86
+#define	X86_64_PMC_INFO		X86_PMC_INFO
+#define	X86_64_PMC_STARTSTOP	X86_PMC_STARTSTOP
+#define	X86_64_PMC_READ		X86_PMC_READ
+#define X86_64_GET_MTRR		X86_GET_MTRR
+#define X86_64_SET_MTRR		X86_SET_MTRR
+#define	X86_64_VM86		X86_VM86
+#define X86_64_GET_GSBASE	X86_GET_GSBASE
+#define	X86_64_GET_FSBASE	X86_GET_FSBASE
+#define X86_64_SET_GSBASE	X86_SET_GSBASE
+#define	X86_64_SET_FSBASE	X86_SET_FSBASE
+#endif
+
+/*
+ * Architecture specific syscalls (x86)
+ */
+
+struct _X86_SYSARCH_L(get_ldt_args) {
+	int start;
+	union descriptor *desc;
+	int num;
+};
+
+struct _X86_SYSARCH_L(set_ldt_args) {
+	int start;
+	union descriptor *desc;
+	int num;
+};
+
+struct _X86_SYSARCH_L(get_mtrr_args) {
+	struct mtrr *mtrrp;
+	int *n;
+};
+
+struct _X86_SYSARCH_L(set_mtrr_args) {
+	struct mtrr *mtrrp;
+	int *n;
+};
+
+struct _X86_SYSARCH_L(iopl_args) {
+	int iopl;
+};
+
+struct _X86_SYSARCH_L(get_ioperm_args) {
+	u_long *iomap;
+};
+
+struct _X86_SYSARCH_L(set_ioperm_args) {
+	u_long *iomap;
+};
+
+struct _X86_SYSARCH_L(pmc_info_args) {
+	int	type;
+	int	flags;
+};
+
+#define	PMC_TYPE_NONE		0
+#define	PMC_TYPE_I586		1
+#define	PMC_TYPE_I686		2
+#define	PMC_TYPE_K7		3
+
+#define	PMC_INFO_HASTSC		0x01
+
+#ifdef __i386__
+#define	PMC_NCOUNTERS		4
+#else
+#define	PMC_NCOUNTERS		2
+#endif
+
+struct _X86_SYSARCH_L(pmc_startstop_args) {
+	int counter;
+	uint64_t val;
+	uint8_t event;
+	uint8_t unit;
+	uint8_t compare;
+	uint8_t flags;
+};
+
+#define	PMC_SETUP_KERNEL	0x01
+#define	PMC_SETUP_USER		0x02
+#define	PMC_SETUP_EDGE		0x04
+#define	PMC_SETUP_INV		0x08
+
+struct _X86_SYSARCH_L(pmc_read_args) {
+	int counter;
+	uint64_t val;
+	uint64_t time;
+};
+
+struct mtrr;
+
+#ifdef _KERNEL
+int x86_iopl(struct lwp *, void *, register_t *);
+int x86_get_mtrr(struct lwp *, void *, register_t *);
+int x86_set_mtrr(struct lwp *, void *, register_t *);
+int x86_get_ldt(struct lwp *, void *, register_t *);
+int x86_get_ldt1(struct lwp *, struct x86_get_ldt_args *, union descriptor *);
+int x86_set_ldt(struct lwp *, void *, register_t *);
+int x86_set_ldt1(struct lwp *, struct x86_set_ldt_args *, union descriptor *);
+int x86_set_sdbase(void *, char, lwp_t *, bool);
+int x86_get_sdbase(void *, char);
+#else
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+int _X86_SYSARCH_L(get_ldt)(int, union descriptor *, int);
+int _X86_SYSARCH_L(set_ldt)(int, union descriptor *, int);
+int _X86_SYSARCH_L(iopl)(int);
+int _X86_SYSARCH_L(pmc_info)(struct _X86_SYSARCH_L(pmc_info_args *));
+int _X86_SYSARCH_L(pmc_startstop)(struct _X86_SYSARCH_L(pmc_startstop_args *));
+int _X86_SYSARCH_L(pmc_read)(struct _X86_SYSARCH_L(pmc_read_args *));
+int _X86_SYSARCH_L(set_mtrr)(struct mtrr *, int *);
+int _X86_SYSARCH_L(get_mtrr)(struct mtrr *, int *);
+int sysarch(int, void *);
+__END_DECLS
+#endif
+
+#endif /* !_X86_SYSARCH_H_ */

Property changes on: lab4/.minix-src/include/x86/sysarch.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/pci.h
===================================================================
--- lab4/.minix-src/include/pci.h	(nonexistent)
+++ lab4/.minix-src/include/pci.h	(revision 13)
@@ -0,0 +1,62 @@
+/*	$NetBSD: pci.h,v 1.6 2014/09/21 14:32:37 christos Exp $	*/
+
+/*
+ * Copyright 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed for the NetBSD Project by
+ *	Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PCI_H_
+#define	_PCI_H_
+
+/*
+ * Interface to the PCI bus for user programs.
+ */
+
+typedef uint32_t pcireg_t;	/* XXX */
+
+/* pci_bus.c */
+int	pcibus_conf_read(int, u_int, u_int, u_int, u_int, pcireg_t *);
+int	pcibus_conf_write(int, u_int, u_int, u_int, u_int, pcireg_t);
+
+/* pci_device.c */
+int	pcidev_conf_read(int, u_int, pcireg_t *);
+int	pcidev_conf_write(int, u_int, pcireg_t);
+
+/* pci_drvname.c */
+int	pci_drvname(int, u_int, u_int, char *, size_t);
+
+/* pci_subr.c */
+void	pci_devinfo(pcireg_t, pcireg_t, int, char *, size_t);
+void	pci_conf_print(int, u_int, u_int, u_int);
+
+#endif /* _PCI_H_ */

Property changes on: lab4/.minix-src/include/pci.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/paths.h
===================================================================
--- lab4/.minix-src/include/paths.h	(nonexistent)
+++ lab4/.minix-src/include/paths.h	(revision 13)
@@ -0,0 +1,131 @@
+/*	$NetBSD: paths.h,v 1.42 2015/05/06 23:06:26 pgoyette Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)paths.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _PATHS_H_
+#define	_PATHS_H_
+
+/*
+ * Default user search path.
+ * Set by login(1), rshd(8), rexecd(8)
+ * Used by execvp(3) absent PATH from the environ(7)
+ */
+#ifdef RESCUEDIR
+#define	_PATH_DEFPATH	RESCUEDIR ":/usr/bin:/bin:/usr/pkg/bin:/usr/local/bin"
+#else
+#define	_PATH_DEFPATH	"/usr/bin:/bin:/usr/pkg/bin:/usr/local/bin"
+#endif
+
+/*
+ * All standard utilities path.
+ * Set by init(8) for system programs & scripts (e.g. /etc/rc)
+ * Used by ttyaction(3), whereis(1)
+ */
+#define	_PATH_STDPATH \
+	"/usr/bin:/bin:/usr/sbin:/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin"
+
+#define	_PATH_AUDIO	"/dev/audio"
+#define	_PATH_AUDIO0	"/dev/audio0"
+#define	_PATH_AUDIOCTL	"/dev/audioctl"
+#define	_PATH_AUDIOCTL0	"/dev/audioctl0"
+#define	_PATH_BPF	"/dev/bpf"
+#define	_PATH_CLOCKCTL	"/dev/clockctl"
+#define	_PATH_CONSOLE	"/dev/console"
+#define	_PATH_CONSTTY	"/dev/constty"
+#define _PATH_CPUCTL	"/dev/cpuctl"
+#define	_PATH_CSMAPPER	"/usr/share/i18n/csmapper"
+#define	_PATH_DEFTAPE	"/dev/nrst0"
+#define	_PATH_DEVCDB	"/var/run/dev.cdb"
+#define	_PATH_DEVDB	"/var/run/dev.db"
+#define	_PATH_DEVNULL	"/dev/null"
+#define	_PATH_DRUM	"/dev/drum"
+#define	_PATH_ESDB	"/usr/share/i18n/esdb"
+#define	_PATH_FTPUSERS	"/etc/ftpusers"
+#define	_PATH_GETTYTAB	"/etc/gettytab"
+#define	_PATH_I18NMODULE "/usr/lib/i18n"
+#define	_PATH_ICONV	"/usr/share/i18n/iconv"
+#define	_PATH_KMEM	"/dev/kmem"
+#define	_PATH_KSYMS	"/dev/ksyms"
+#define	_PATH_KVMDB	"/var/db/kvm.db"
+#define	_PATH_LOCALE	"/usr/share/locale"
+#define	_PATH_MAILDIR	"/var/mail"
+#define	_PATH_MAN	"/usr/share/man"
+#define	_PATH_MEM	"/dev/mem"
+#define	_PATH_MIXER	"/dev/mixer"
+#define	_PATH_MIXER0	"/dev/mixer0"
+#define	_PATH_NOLOGIN	"/etc/nologin"
+#define _PATH_POWER	"/dev/power"
+#define	_PATH_PRINTCAP	"/etc/printcap"
+#define	_PATH_PUD	"/dev/pud"
+#define	_PATH_PUFFS	"/dev/puffs"
+#define	_PATH_RANDOM	"/dev/random"
+#define	_PATH_SENDMAIL	"/usr/sbin/sendmail"
+#define	_PATH_SHELLS	"/etc/shells"
+#define	_PATH_SKEYKEYS	"/etc/skeykeys"
+#define	_PATH_SOUND	"/dev/sound"
+#define	_PATH_SOUND0	"/dev/sound0"
+#define	_PATH_SYSMON	"/dev/sysmon"
+#define	_PATH_TTY	"/dev/tty"
+#define	_PATH_UNIX	"/netbsd"
+#define	_PATH_URANDOM	"/dev/urandom"
+#define	_PATH_VIDEO	"/dev/video"
+#define	_PATH_VIDEO0	"/dev/video0"
+#define	_PATH_WATCHDOG	"/dev/watchdog"
+
+/*
+ * Provide trailing slash, since mostly used for building pathnames.
+ * See the __CONCAT() macro from <sys/cdefs.h> for cpp examples.
+ */
+#define	_PATH_DEV	"/dev/"
+#define	_PATH_DEV_PTS	"/dev/pts/"
+#define	_PATH_EMUL_AOUT	"/emul/aout/"
+#define	_PATH_TMP	"/tmp/"
+#define	_PATH_VARDB	"/var/db/"
+#define	_PATH_VARRUN	"/var/run/"
+#define	_PATH_VARTMP	"/var/tmp/"
+
+/*
+ * Paths that may change if RESCUEDIR is defined.
+ * Used by tools in /rescue.
+ */
+#ifdef RESCUEDIR
+#define	_PATH_BSHELL	RESCUEDIR "/sh"
+#define	_PATH_CSHELL	RESCUEDIR "/csh"
+#define	_PATH_VI	RESCUEDIR "/vi"
+#else
+#define	_PATH_BSHELL	"/bin/sh"
+#define	_PATH_CSHELL	"/bin/csh"
+#define	_PATH_VI	"/usr/bin/vi"
+#endif
+
+#endif /* !_PATHS_H_ */
+

Property changes on: lab4/.minix-src/include/paths.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/setjmp.h
===================================================================
--- lab4/.minix-src/include/setjmp.h	(nonexistent)
+++ lab4/.minix-src/include/setjmp.h	(revision 13)
@@ -0,0 +1,85 @@
+/*	$NetBSD: setjmp.h,v 1.26 2011/11/05 09:27:06 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)setjmp.h	8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _SETJMP_H_
+#define _SETJMP_H_
+
+#include <sys/featuretest.h>
+
+#include <machine/setjmp.h>
+
+#ifndef _JB_ATTRIBUTES
+#define _JB_ATTRIBUTES	/**/
+#else
+#endif
+#ifndef _BSD_JBSLOT_T_
+#define	_BSD_JBSLOT_T_	long
+#endif
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+typedef _BSD_JBSLOT_T_ sigjmp_buf[_JBLEN + 1] _JB_ATTRIBUTES;
+#endif /* not ANSI */
+
+typedef _BSD_JBSLOT_T_ jmp_buf[_JBLEN] _JB_ATTRIBUTES;
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+int	setjmp(jmp_buf)			 __RENAME(__setjmp14) __returns_twice;
+void	longjmp(jmp_buf, int)		 __RENAME(__longjmp14) __dead;
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+int	sigsetjmp(sigjmp_buf, int)	__RENAME(__sigsetjmp14) __returns_twice;
+void	siglongjmp(sigjmp_buf, int)	 __RENAME(__siglongjmp14) __dead;
+#endif /* not ANSI */
+#endif /* __LIBC12_SOURCE__ */
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+int	_setjmp(jmp_buf) __returns_twice;
+void	_longjmp(jmp_buf, int) __dead;
+#endif
+
+#if defined(_NETBSD_SOURCE)
+void	longjmperror(void);
+#endif
+__END_DECLS
+
+#endif /* !_SETJMP_H_ */

Property changes on: lab4/.minix-src/include/setjmp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/quota.h
===================================================================
--- lab4/.minix-src/include/quota.h	(nonexistent)
+++ lab4/.minix-src/include/quota.h	(revision 13)
@@ -0,0 +1,83 @@
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David A. Holland.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _QUOTA_H_
+#define _QUOTA_H_
+
+#include <sys/types.h>
+#include <sys/quota.h>
+
+struct quotahandle; /* Opaque. */
+struct quotacursor; /* Opaque. */
+
+
+void quotaval_clear(struct quotaval *);
+
+struct quotahandle *quota_open(const char *);
+void quota_close(struct quotahandle *);
+
+const char *quota_getmountpoint(struct quotahandle *);
+const char *quota_getmountdevice(struct quotahandle *);
+
+const char *quota_getimplname(struct quotahandle *);
+unsigned quota_getrestrictions(struct quotahandle *);
+
+int quota_getnumidtypes(struct quotahandle *);
+const char *quota_idtype_getname(struct quotahandle *, int /*idtype*/);
+
+int quota_getnumobjtypes(struct quotahandle *);
+const char *quota_objtype_getname(struct quotahandle *, int /*objtype*/);
+int quota_objtype_isbytes(struct quotahandle *, int /*objtype*/);
+
+int quota_quotaon(struct quotahandle *, int /*idtype*/);
+int quota_quotaoff(struct quotahandle *, int /*idtype*/);
+
+int quota_get(struct quotahandle *, const struct quotakey *,
+	      struct quotaval *);
+
+int quota_put(struct quotahandle *, const struct quotakey *,
+	      const struct quotaval *);
+
+int quota_delete(struct quotahandle *, const struct quotakey *);
+
+struct quotacursor *quota_opencursor(struct quotahandle *);
+void quotacursor_close(struct quotacursor *);
+
+int quotacursor_skipidtype(struct quotacursor *, int /*idtype*/);
+
+int quotacursor_get(struct quotacursor *, struct quotakey *,
+		    struct quotaval *);
+
+int quotacursor_getn(struct quotacursor *, struct quotakey *,
+		     struct quotaval *, unsigned /*maxnum*/);
+
+int quotacursor_atend(struct quotacursor *);
+int quotacursor_rewind(struct quotacursor *);
+
+#endif /* _QUOTA_H_ */

Property changes on: lab4/.minix-src/include/quota.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/aio.h
===================================================================
--- lab4/.minix-src/include/aio.h	(nonexistent)
+++ lab4/.minix-src/include/aio.h	(revision 13)
@@ -0,0 +1,56 @@
+/*	$NetBSD: aio.h,v 1.7 2009/01/13 15:11:09 christos Exp $	*/
+
+/*
+ * Copyright (c) 2007, Mindaugas Rasiukevicius <rmind at NetBSD org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef	_AIO_H_
+#define	_AIO_H_
+
+#include <fcntl.h>
+#include <signal.h>
+#include <time.h>
+
+#include <sys/cdefs.h>
+#include <sys/signal.h>
+
+#include <sys/aio.h>
+
+__BEGIN_DECLS
+int	aio_cancel(int, struct aiocb *);
+int	aio_error(const struct aiocb *);
+int	aio_fsync(int, struct aiocb *);
+int	aio_read(struct aiocb *);
+ssize_t	aio_return(struct aiocb *);
+#ifndef __LIBC12_SOURCE__
+int	aio_suspend(const struct aiocb * const [], int,
+    const struct timespec *) __RENAME(__aio_suspend50);
+#endif
+int	aio_write(struct aiocb *);
+int	lio_listio(int, struct aiocb * const * __restrict,
+		    int, struct sigevent * __restrict);
+__END_DECLS
+
+#endif	/* _AIO_H_ */

Property changes on: lab4/.minix-src/include/aio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/poll.h
===================================================================
--- lab4/.minix-src/include/poll.h	(nonexistent)
+++ lab4/.minix-src/include/poll.h	(revision 13)
@@ -0,0 +1 @@
+sys/poll.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/poll.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/assert.h
===================================================================
--- lab4/.minix-src/include/assert.h	(nonexistent)
+++ lab4/.minix-src/include/assert.h	(revision 13)
@@ -0,0 +1,106 @@
+/*	$NetBSD: assert.h,v 1.21 2011/08/26 01:10:49 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)assert.h	8.2 (Berkeley) 1/21/94
+ */
+
+/*
+ * Unlike other ANSI header files, <assert.h> may usefully be included
+ * multiple times, with and without NDEBUG defined.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/null.h>
+
+#undef assert
+
+#ifdef NDEBUG
+# ifndef __lint__
+#  define assert(e)	(__static_cast(void,0))
+# else /* !__lint__ */
+#  define assert(e)
+# endif /* __lint__ */
+#else /* !NDEBUG */
+# if __STDC__
+#  define assert(e)							\
+	((e) ? __static_cast(void,0) : __assert13(__FILE__, __LINE__,	\
+	                                          __assert_function__, #e))
+# else	/* PCC */
+#  define assert(e)							\
+	((e) ? __static_cast(void,0) : __assert13(__FILE__, __LINE__,	\
+	                                          __assert_function__, "e"))
+# endif /* !__STDC__ */
+#endif /* NDEBUG */
+
+#undef _DIAGASSERT
+#if !defined(_DIAGNOSTIC)
+# if !defined(__lint__)
+#  define _DIAGASSERT(e) (__static_cast(void,0))
+# else /* !__lint__ */
+#  define _DIAGASSERT(e)
+# endif /* __lint__ */
+#else /* _DIAGNOSTIC */
+# if __STDC__
+#  define _DIAGASSERT(e)						\
+	((e) ? __static_cast(void,0) : __diagassert13(__FILE__, __LINE__, \
+	                                              __assert_function__, #e))
+# else	/* !__STDC__ */
+#  define _DIAGASSERT(e)	 					\
+	((e) ? __static_cast(void,0) : __diagassert13(__FILE__, __LINE__, \
+	                                              __assert_function__, "e"))
+# endif
+#endif /* _DIAGNOSTIC */
+
+
+#if defined(__lint__)
+#define	__assert_function__	(__static_cast(const void *,0))
+#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define	__assert_function__	__func__
+#elif __GNUC_PREREQ__(2, 6)
+#define	__assert_function__	__PRETTY_FUNCTION__
+#else
+#define	__assert_function__	(__static_cast(const void *,0))
+#endif
+
+#ifndef __ASSERT_DECLARED
+#define __ASSERT_DECLARED
+__BEGIN_DECLS
+__dead void __assert(const char *, int, const char *);
+__dead void __assert13(const char *, int, const char *, const char *);
+void __diagassert(const char *, int, const char *);
+void __diagassert13(const char *, int, const char *, const char *);
+__END_DECLS
+#endif /* __ASSERT_DECLARED */

Property changes on: lab4/.minix-src/include/assert.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/regex.h
===================================================================
--- lab4/.minix-src/include/regex.h	(nonexistent)
+++ lab4/.minix-src/include/regex.h	(revision 13)
@@ -0,0 +1,142 @@
+/*	$NetBSD: regex.h,v 1.13 2005/09/13 01:44:32 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer of the University of Toronto.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)regex.h	8.2 (Berkeley) 1/3/94
+ */
+
+/*-
+ * Copyright (c) 1992 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer of the University of Toronto.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)regex.h	8.2 (Berkeley) 1/3/94
+ */
+
+#ifndef _REGEX_H_
+#define	_REGEX_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+/* types */
+typedef off_t regoff_t;
+
+typedef struct {
+	int re_magic;
+	size_t re_nsub;		/* number of parenthesized subexpressions */
+	const char *re_endp;	/* end pointer for REG_PEND */
+	struct re_guts *re_g;	/* none of your business :-) */
+} regex_t;
+
+typedef struct {
+	regoff_t rm_so;		/* start of match */
+	regoff_t rm_eo;		/* end of match */
+} regmatch_t;
+
+/* regcomp() flags */
+#define	REG_BASIC	0000
+#define	REG_EXTENDED	0001
+#define	REG_ICASE	0002
+#define	REG_NOSUB	0004
+#define	REG_NEWLINE	0010
+#define	REG_NOSPEC	0020
+#define	REG_PEND	0040
+#define	REG_DUMP	0200
+
+/* regerror() flags */
+#define	REG_NOMATCH	 1
+#define	REG_BADPAT	 2
+#define	REG_ECOLLATE	 3
+#define	REG_ECTYPE	 4
+#define	REG_EESCAPE	 5
+#define	REG_ESUBREG	 6
+#define	REG_EBRACK	 7
+#define	REG_EPAREN	 8
+#define	REG_EBRACE	 9
+#define	REG_BADBR	10
+#define	REG_ERANGE	11
+#define	REG_ESPACE	12
+#define	REG_BADRPT	13
+#define	REG_EMPTY	14
+#define	REG_ASSERT	15
+#define	REG_INVARG	16
+#define	REG_ENOSYS	17
+#define	REG_ATOI	255	/* convert name to number (!) */
+#define	REG_ITOA	0400	/* convert number to name (!) */
+
+/* regexec() flags */
+#define	REG_NOTBOL	00001
+#define	REG_NOTEOL	00002
+#define	REG_STARTEND	00004
+#define	REG_TRACE	00400	/* tracing of execution */
+#define	REG_LARGE	01000	/* force large representation */
+#define	REG_BACKR	02000	/* force use of backref code */
+
+__BEGIN_DECLS
+int	regcomp(regex_t * __restrict, const char * __restrict, int);
+size_t	regerror(int, const regex_t * __restrict, char * __restrict, size_t);
+int	regexec(const regex_t * __restrict,
+	    const char * __restrict, size_t, regmatch_t [], int);
+void	regfree(regex_t *);
+__END_DECLS
+
+#endif /* !_REGEX_H_ */

Property changes on: lab4/.minix-src/include/regex.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/randomid.h
===================================================================
--- lab4/.minix-src/include/randomid.h	(nonexistent)
+++ lab4/.minix-src/include/randomid.h	(revision 13)
@@ -0,0 +1,83 @@
+/*	$NetBSD: randomid.h,v 1.2 2005/12/26 19:01:47 perry Exp $	*/
+/*	$KAME: ip6_id.c,v 1.8 2003/09/06 13:41:06 itojun Exp $	*/
+/*	$OpenBSD: ip_id.c,v 1.6 2002/03/15 18:19:52 millert Exp $	*/
+
+/*
+ * Copyright (C) 2003 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright 1998 Niels Provos <provos@citi.umich.edu>
+ * All rights reserved.
+ *
+ * Theo de Raadt <deraadt@openbsd.org> came up with the idea of using
+ * such a mathematical system to generate more random (yet non-repeating)
+ * ids to solve the resolver/named problem.  But Niels designed the
+ * actual system based on the constraints.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Niels Provos.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+#ifndef _RANDOMID_H_
+#define _RANDOMID_H_
+
+struct randomid_ctx;
+
+typedef struct randomid_ctx *randomid_t;
+
+extern uint32_t randomid(randomid_t);
+extern randomid_t randomid_new(int, long);
+extern void randomid_delete(randomid_t);
+
+#define RANDOMID_TIMEO_MIN	((long)60)
+#define RANDOMID_TIMEO_DEFAULT	((long)180)
+
+#endif /*_RANDOMID_H_*/

Property changes on: lab4/.minix-src/include/randomid.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/spawn.h
===================================================================
--- lab4/.minix-src/include/spawn.h	(nonexistent)
+++ lab4/.minix-src/include/spawn.h	(revision 13)
@@ -0,0 +1,89 @@
+/*	$NetBSD: spawn.h,v 1.4 2012/02/22 17:51:01 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/include/spawn.h,v 1.3.2.1.4.1 2010/06/14 02:09:06 kensmith Exp $
+ */
+
+#ifndef _SPAWN_H
+#define _SPAWN_H
+
+#include <sys/spawn.h>
+
+__BEGIN_DECLS
+/*
+ * Spawn routines
+ *
+ */
+int posix_spawn(pid_t * __restrict, const char * __restrict,
+    const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
+    char * const *__restrict, char * const *__restrict);
+int posix_spawnp(pid_t * __restrict, const char * __restrict,
+    const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
+    char * const *__restrict, char * const *__restrict);
+
+/*
+ * File descriptor actions
+ */
+int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
+int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
+
+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t * __restrict,
+    int, const char * __restrict, int, mode_t);
+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
+int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
+
+/*
+ * Spawn attributes
+ */
+int posix_spawnattr_init(posix_spawnattr_t *);
+int posix_spawnattr_destroy(posix_spawnattr_t *);
+
+int posix_spawnattr_getflags(const posix_spawnattr_t * __restrict,
+    short * __restrict);
+int posix_spawnattr_getpgroup(const posix_spawnattr_t * __restrict,
+    pid_t * __restrict);
+int posix_spawnattr_getschedparam(const posix_spawnattr_t * __restrict,
+    struct sched_param * __restrict);
+int posix_spawnattr_getschedpolicy(const posix_spawnattr_t * __restrict,
+    int * __restrict);
+int posix_spawnattr_getsigdefault(const posix_spawnattr_t * __restrict,
+    sigset_t * __restrict);
+int posix_spawnattr_getsigmask(const posix_spawnattr_t * __restrict,
+    sigset_t * __restrict sigmask);
+
+int posix_spawnattr_setflags(posix_spawnattr_t *, short);
+int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
+int posix_spawnattr_setschedparam(posix_spawnattr_t * __restrict,
+    const struct sched_param * __restrict);
+int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
+int posix_spawnattr_setsigdefault(posix_spawnattr_t * __restrict,
+    const sigset_t * __restrict);
+int posix_spawnattr_setsigmask(posix_spawnattr_t * __restrict,
+    const sigset_t * __restrict);
+__END_DECLS
+
+#endif /* _SPAWN_H */

Property changes on: lab4/.minix-src/include/spawn.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/stdarg.h
===================================================================
--- lab4/.minix-src/include/stdarg.h	(nonexistent)
+++ lab4/.minix-src/include/stdarg.h	(revision 13)
@@ -0,0 +1 @@
+sys/stdarg.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/stdarg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/bitstring.h
===================================================================
--- lab4/.minix-src/include/bitstring.h	(nonexistent)
+++ lab4/.minix-src/include/bitstring.h	(revision 13)
@@ -0,0 +1,134 @@
+/*	$NetBSD: bitstring.h,v 1.9 2010/05/06 18:54:22 christos Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Paul Vixie.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)bitstring.h	8.1 (Berkeley) 7/19/93
+ */
+
+#ifndef _BITSTRING_H_
+#define	_BITSTRING_H_
+
+/* modified for SV/AT and bitstring bugfix by M.R.Murphy, 11oct91
+ * bitstr_size changed gratuitously, but shorter
+ * bit_alloc   spelling error fixed
+ * the following were efficient, but didn't work, they've been made to
+ * work, but are no longer as efficient :-)
+ * bit_nclear, bit_nset, bit_ffc, bit_ffs
+ */
+/*
+ * The comment above may or may not bear any resemblance to reality.
+ * This code has been maintained in a confusing way, with little
+ * information available on the provenance of much of it. "At least it
+ * works."
+ *  /s/ Perry E. Metzger, 2 Feb 98
+ */
+typedef	unsigned char bitstr_t;
+
+/* internal macros */
+				/* byte of the bitstring bit is in */
+#define	_bit_byte(bit) \
+	(uint32_t)((bit) >> 3)
+
+				/* mask for the bit within its byte */
+#define	_bit_mask(bit) \
+	(uint32_t)((1 << (uint32_t)((bit)&0x7)))
+
+/* external macros */
+				/* bytes in a bitstring of nbits bits */
+#define	bitstr_size(nbits) \
+	(size_t)((uint32_t)((nbits) + 7) >> 3)
+
+				/* allocate a bitstring */
+#define	bit_alloc(nbits) \
+	calloc(bitstr_size(nbits), sizeof(bitstr_t))
+
+				/* allocate a bitstring on the stack */
+#define	bit_decl(name, nbits) \
+	((name)[bitstr_size(nbits)])
+
+				/* is bit N of bitstring name set? */
+#define	bit_test(name, bit) \
+	/*LINTED bitwise on signed*/((name)[_bit_byte(bit)] & _bit_mask(bit))
+
+				/* set bit N of bitstring name */
+#define	bit_set(name, bit) \
+	/*LINTED bitwise on signed*/((name)[_bit_byte(bit)] |= _bit_mask(bit))
+
+				/* clear bit N of bitstring name */
+#define	bit_clear(name, bit) \
+	/*LINTED bitwise on signed*/((name)[_bit_byte(bit)] &= ~_bit_mask(bit))
+
+				/* clear bits start ... stop in bitstring */
+#define	bit_nclear(name, start, stop) do { \
+	bitstr_t *_name = name; \
+	int _start = start, _stop = stop; \
+	while (_start <= _stop) { \
+		bit_clear(_name, _start); \
+		_start++; \
+	} \
+} while(/*CONSTCOND*/0)
+
+				/* set bits start ... stop in bitstring */
+#define	bit_nset(name, start, stop) do { \
+	bitstr_t *_name = name; \
+	int _start = start, _stop = stop; \
+	while (_start <= _stop) { \
+		bit_set(_name, _start); \
+		_start++; \
+	} \
+} while(/*CONSTCOND*/0)
+
+				/* find first bit clear in name */
+#define	bit_ffc(name, nbits, value) do { \
+	bitstr_t *_name = name; \
+	int _bit, _nbits = nbits, _value = -1; \
+	for (_bit = 0; _bit < _nbits; ++_bit) \
+		if (!bit_test(_name, _bit)) { \
+			_value = _bit; \
+			break; \
+		} \
+	*(value) = _value; \
+} while(/*CONSTCOND*/0)
+
+				/* find first bit set in name */
+#define	bit_ffs(name, nbits, value) do { \
+	bitstr_t *_name = name; \
+	int _bit, _nbits = nbits, _value = -1; \
+	for (_bit = 0; _bit < _nbits; ++_bit) \
+		if (bit_test(_name, _bit)) { \
+			_value = _bit; \
+			break; \
+		} \
+	*(value) = _value; \
+} while(/*CONSTCOND*/0)
+
+#endif /* !_BITSTRING_H_ */

Property changes on: lab4/.minix-src/include/bitstring.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/regexp.h
===================================================================
--- lab4/.minix-src/include/regexp.h	(nonexistent)
+++ lab4/.minix-src/include/regexp.h	(revision 13)
@@ -0,0 +1,109 @@
+/*	$NetBSD: regexp.h,v 1.7 2005/02/03 04:39:32 perry Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley
+ * by Henry Spencer.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)regexp.h	8.1 (Berkeley) 6/2/93
+ */
+
+/*
+ * Copyright (c) 1986 by University of Toronto.
+ *
+ * This code is derived from software contributed to Berkeley
+ * by Henry Spencer.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)regexp.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef	_REGEXP_H_
+#define	_REGEXP_H_
+
+/*
+ * Definitions etc. for regexp(3) routines.
+ *
+ * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
+ * not the System V one.
+ */
+#define NSUBEXP  10
+typedef struct regexp {
+	char *startp[NSUBEXP];
+	char *endp[NSUBEXP];
+	char regstart;		/* Internal use only. */
+	char reganch;		/* Internal use only. */
+	char *regmust;		/* Internal use only. */
+	int regmlen;		/* Internal use only. */
+	char program[1];	/* Unwarranted chumminess with compiler. */
+} regexp;
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#ifdef __LIBCOMPAT_SOURCE__
+regexp *__compat_regcomp(const char *);
+int __compat_regexec(const  regexp *, const char *);
+void __compat_regsub(const  regexp *, const char *, char *);
+void __compat_regerror(const char *);
+#endif
+regexp *regcomp(const char *) __RENAME(__compat_regcomp);
+int regexec(const  regexp *, const char *) __RENAME(__compat_regexec);
+void regsub(const  regexp *, const char *, char *) __RENAME(__compat_regsub);
+void regerror(const char *) __RENAME(__compat_regerror);
+__END_DECLS
+
+#endif /* !_REGEXP_H_ */

Property changes on: lab4/.minix-src/include/regexp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/rmd160.h
===================================================================
--- lab4/.minix-src/include/rmd160.h	(nonexistent)
+++ lab4/.minix-src/include/rmd160.h	(revision 13)
@@ -0,0 +1 @@
+sys/rmd160.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/rmd160.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/stdio.h
===================================================================
--- lab4/.minix-src/include/stdio.h	(nonexistent)
+++ lab4/.minix-src/include/stdio.h	(revision 13)
@@ -0,0 +1,600 @@
+/*	$NetBSD: stdio.h,v 1.96 2015/03/24 07:44:52 wiz Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)stdio.h	8.5 (Berkeley) 4/29/95
+ */
+
+#ifndef	_STDIO_H_
+#define	_STDIO_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+#ifdef	_BSD_SSIZE_T_
+typedef	_BSD_SSIZE_T_	ssize_t;
+#undef	_BSD_SSIZE_T_
+#endif
+
+#if defined(_POSIX_C_SOURCE)
+#ifndef __VA_LIST_DECLARED
+typedef __va_list va_list;
+#define __VA_LIST_DECLARED
+#endif
+#endif
+
+#include <sys/null.h>
+
+/*      
+ * This is fairly grotesque, but pure ANSI code must not inspect the
+ * innards of an fpos_t anyway.  The library internally uses off_t,
+ * which we assume is exactly as big as eight chars.
+ */
+typedef struct __sfpos {
+	__off_t _pos;
+	__mbstate_t _mbstate_in, _mbstate_out;
+} fpos_t;
+
+#define	_FSTDIO			/* Define for new stdio with functions. */
+
+/*
+ * NB: to fit things in six character monocase externals, the stdio
+ * code uses the prefix `__s' for stdio objects, typically followed
+ * by a three-character attempt at a mnemonic.
+ */
+
+/* stdio buffers */
+struct __sbuf {
+	unsigned char *_base;
+	int	_size;
+};
+
+/*
+ * stdio state variables.
+ *
+ * The following always hold:
+ *
+ *	if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
+ *		_lbfsize is -_bf._size, else _lbfsize is 0
+ *	if _flags&__SRD, _w is 0
+ *	if _flags&__SWR, _r is 0
+ *
+ * This ensures that the getc and putc macros (or inline functions) never
+ * try to write or read from a file that is in `read' or `write' mode.
+ * (Moreover, they can, and do, automatically switch from read mode to
+ * write mode, and back, on "r+" and "w+" files.)
+ *
+ * _lbfsize is used only to make the inline line-buffered output stream
+ * code as compact as possible.
+ *
+ * _ub, _up, and _ur are used when ungetc() pushes back more characters
+ * than fit in the current _bf, or when ungetc() pushes back a character
+ * that does not match the previous one in _bf.  When this happens,
+ * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
+ * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
+ *
+ * NB: see WARNING above before changing the layout of this structure!
+ */
+typedef	struct __sFILE {
+	unsigned char *_p;	/* current position in (some) buffer */
+	int	_r;		/* read space left for getc() */
+	int	_w;		/* write space left for putc() */
+	unsigned short _flags;	/* flags, below; this FILE is free if 0 */
+	short	_file;		/* fileno, if Unix descriptor, else -1 */
+	struct	__sbuf _bf;	/* the buffer (at least 1 byte, if !NULL) */
+	int	_lbfsize;	/* 0 or -_bf._size, for inline putc */
+
+	/* operations */
+	void	*_cookie;	/* cookie passed to io functions */
+	int	(*_close)(void *);
+	ssize_t	(*_read) (void *, void *, size_t);
+	__off_t	(*_seek) (void *, __off_t, int);
+	ssize_t	(*_write)(void *, const void *, size_t);
+
+	/* file extension */
+	struct	__sbuf _ext;
+
+	/* separate buffer for long sequences of ungetc() */
+	unsigned char *_up;	/* saved _p when _p is doing ungetc data */
+	int	_ur;		/* saved _r when _r is counting ungetc data */
+
+	/* tricks to meet minimum requirements even when malloc() fails */
+	unsigned char _ubuf[3];	/* guarantee an ungetc() buffer */
+	unsigned char _nbuf[1];	/* guarantee a getc() buffer */
+
+	int	(*_flush)(void *);
+	/* Formerly used by fgetln/fgetwln; kept for binary compatibility */
+	char	_lb_unused[sizeof(struct __sbuf) - sizeof(int (*)(void *))];
+
+	/* Unix stdio files get aligned to block boundaries on fseek() */
+	int	_blksize;	/* stat.st_blksize (may be != _bf._size) */
+	__off_t	_offset;	/* current lseek offset */
+} FILE;
+
+__BEGIN_DECLS
+extern FILE __sF[3];
+__END_DECLS
+
+#define	__SLBF	0x0001		/* line buffered */
+#define	__SNBF	0x0002		/* unbuffered */
+#define	__SRD	0x0004		/* OK to read */
+#define	__SWR	0x0008		/* OK to write */
+	/* RD and WR are never simultaneously asserted */
+#define	__SRW	0x0010		/* open for reading & writing */
+#define	__SEOF	0x0020		/* found EOF */
+#define	__SERR	0x0040		/* found error */
+#define	__SMBF	0x0080		/* _buf is from malloc */
+#define	__SAPP	0x0100		/* fdopen()ed in append mode */
+#define	__SSTR	0x0200		/* this is an sprintf/snprintf string */
+#define	__SOPT	0x0400		/* do fseek() optimization */
+#define	__SNPT	0x0800		/* do not do fseek() optimization */
+#define	__SOFF	0x1000		/* set iff _offset is in fact correct */
+#define	__SMOD	0x2000		/* true => fgetln modified _p text */
+#define	__SALC	0x4000		/* allocate string space dynamically */
+
+/*
+ * The following three definitions are for ANSI C, which took them
+ * from System V, which brilliantly took internal interface macros and
+ * made them official arguments to setvbuf(), without renaming them.
+ * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
+ *
+ * Although numbered as their counterparts above, the implementation
+ * does not rely on this.
+ */
+#define	_IOFBF	0		/* setvbuf should set fully buffered */
+#define	_IOLBF	1		/* setvbuf should set line buffered */
+#define	_IONBF	2		/* setvbuf should set unbuffered */
+
+#define	BUFSIZ	1024		/* size of buffer used by setbuf */
+#define	EOF	(-1)
+
+/*
+ * FOPEN_MAX is a minimum maximum, and is the number of streams that
+ * stdio can provide without attempting to allocate further resources
+ * (which could fail).  Do not use this for anything.
+ */
+				/* must be == _POSIX_STREAM_MAX <limits.h> */
+#define	FOPEN_MAX	20	/* must be <= OPEN_MAX <sys/syslimits.h> */
+#define	FILENAME_MAX	1024	/* must be <= PATH_MAX <sys/syslimits.h> */
+
+/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define	P_tmpdir	"/var/tmp/"
+#endif
+#define	L_tmpnam	1024	/* XXX must be == PATH_MAX */
+/* Always ensure that this is consistent with <limits.h> */
+#ifndef TMP_MAX
+#define TMP_MAX			308915776	/* Legacy */
+#endif
+
+/* Always ensure that these are consistent with <fcntl.h> and <unistd.h>! */
+#ifndef SEEK_SET
+#define	SEEK_SET	0	/* set file offset to offset */
+#endif
+#ifndef SEEK_CUR
+#define	SEEK_CUR	1	/* set file offset to current plus offset */
+#endif
+#ifndef SEEK_END
+#define	SEEK_END	2	/* set file offset to EOF plus offset */
+#endif
+
+#define	stdin	(&__sF[0])
+#define	stdout	(&__sF[1])
+#define	stderr	(&__sF[2])
+
+/*
+ * Functions defined in ANSI C standard.
+ */
+__BEGIN_DECLS
+void	 clearerr(FILE *);
+int	 fclose(FILE *);
+int	 feof(FILE *);
+int	 ferror(FILE *);
+int	 fflush(FILE *);
+int	 fgetc(FILE *);
+char	*fgets(char * __restrict, int, FILE * __restrict);
+FILE	*fopen(const char * __restrict , const char * __restrict);
+int	 fprintf(FILE * __restrict, const char * __restrict, ...)
+		__printflike(2, 3);
+int	 fputc(int, FILE *);
+int	 fputs(const char * __restrict, FILE * __restrict);
+size_t	 fread(void * __restrict, size_t, size_t, FILE * __restrict);
+FILE	*freopen(const char * __restrict, const char * __restrict,
+	    FILE * __restrict);
+int	 fscanf(FILE * __restrict, const char * __restrict, ...)
+		__scanflike(2, 3);
+int	 fseek(FILE *, long, int);
+long	 ftell(FILE *);
+size_t	 fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
+int	 getc(FILE *);
+int	 getchar(void);
+void	 perror(const char *);
+int	 printf(const char * __restrict, ...)
+		__printflike(1, 2);
+int	 putc(int, FILE *);
+int	 putchar(int);
+int	 puts(const char *);
+int	 remove(const char *);
+void	 rewind(FILE *);
+int	 scanf(const char * __restrict, ...)
+		__scanflike(1, 2);
+void	 setbuf(FILE * __restrict, char * __restrict);
+int	 setvbuf(FILE * __restrict, char * __restrict, int, size_t);
+int	 sscanf(const char * __restrict, const char * __restrict, ...)
+		__scanflike(2, 3);
+FILE	*tmpfile(void);
+int	 ungetc(int, FILE *);
+int	 vfprintf(FILE * __restrict, const char * __restrict, __va_list)
+		__printflike(2, 0);
+int	 vprintf(const char * __restrict, __va_list)
+		__printflike(1, 0);
+
+#ifndef __AUDIT__
+char	*gets(char *);
+int	 sprintf(char * __restrict, const char * __restrict, ...)
+		__printflike(2, 3);
+char	*tmpnam(char *);
+int	 vsprintf(char * __restrict, const char * __restrict,
+    __va_list)
+		__printflike(2, 0);
+#endif
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
+int	 rename (const char *, const char *) __RENAME(__posix_rename);
+#else
+int	 rename (const char *, const char *);
+#endif
+__END_DECLS
+
+#ifndef __LIBC12_SOURCE__
+int	 fgetpos(FILE * __restrict, fpos_t * __restrict) __RENAME(__fgetpos50);
+int	 fsetpos(FILE *, const fpos_t *) __RENAME(__fsetpos50);
+#endif
+/*
+ * IEEE Std 1003.1-90
+ */
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define	L_ctermid	1024	/* size for ctermid(); PATH_MAX */
+#define L_cuserid	9	/* size for cuserid(); UT_NAMESIZE + 1 */
+
+__BEGIN_DECLS
+char	*ctermid(char *);
+#ifndef __CUSERID_DECLARED
+#define __CUSERID_DECLARED
+/* also declared in unistd.h */
+char	*cuserid(char *);
+#endif /* __CUSERID_DECLARED */
+FILE	*fdopen(int, const char *);
+int	 fileno(FILE *);
+__END_DECLS
+#endif /* not ANSI */
+
+/*
+ * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+void	flockfile(FILE *);
+int	ftrylockfile(FILE *);
+void	funlockfile(FILE *);
+int	getc_unlocked(FILE *);
+int	getchar_unlocked(void);
+int	putc_unlocked(int, FILE *);
+int	putchar_unlocked(int);
+__END_DECLS
+#endif /* _POSIX_C_SOURCE >= 1995056 || _XOPEN_SOURCE >= 500 || ... */
+
+/*
+ * Functions defined in POSIX 1003.2 and XPG2 or later.
+ */
+#if (_POSIX_C_SOURCE - 0) >= 2 || (_XOPEN_SOURCE - 0) >= 2 || \
+    defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+int	 pclose(FILE *);
+FILE	*popen(const char *, const char *);
+__END_DECLS
+#endif
+#ifdef _NETBSD_SOURCE
+__BEGIN_DECLS
+FILE	*popenve(const char *, char *const *, char *const *, const char *);
+__END_DECLS
+#endif
+
+/*
+ * Functions defined in ISO XPG4.2, ISO C99, POSIX 1003.1-2001 or later.
+ */
+#if ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    ((_XOPEN_SOURCE - 0) >= 500) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+int	 snprintf(char * __restrict, size_t, const char * __restrict, ...)
+		__printflike(3, 4);
+int	 vsnprintf(char * __restrict, size_t, const char * __restrict,
+	    __va_list)
+		__printflike(3, 0);
+__END_DECLS
+#endif
+
+/*
+ * Functions defined in XPG4.2.
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+int	 getw(FILE *);
+int	 putw(int, FILE *);
+
+#ifndef __AUDIT__
+char	*tempnam(const char *, const char *);
+#endif
+__END_DECLS
+#endif
+
+/*
+ * X/Open CAE Specification Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#ifndef	off_t
+typedef	__off_t		off_t;
+#define	off_t		__off_t
+#endif /* off_t */
+
+__BEGIN_DECLS
+int	 fseeko(FILE *, off_t, int);
+off_t	 ftello(FILE *);
+__END_DECLS
+#endif /* (_POSIX_C_SOURCE - 0) >= 200112L || _XOPEN_SOURCE >= 500 || ... */
+
+/*
+ * Functions defined in ISO C99.  Still put under _NETBSD_SOURCE due to
+ * backward compatible.
+ */
+#if defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+int	 vscanf(const char * __restrict, __va_list)
+		__scanflike(1, 0);
+int	 vfscanf(FILE * __restrict, const char * __restrict, __va_list)
+		__scanflike(2, 0);
+int	 vsscanf(const char * __restrict, const char * __restrict,
+    __va_list)
+    __scanflike(2, 0);
+__END_DECLS
+#endif /* _ISOC99_SOURCE || _NETBSD_SOURCE */
+
+/*
+ * Routines that are purely local.
+ */
+#if defined(_NETBSD_SOURCE)
+
+#define	FPARSELN_UNESCESC	0x01
+#define	FPARSELN_UNESCCONT	0x02
+#define	FPARSELN_UNESCCOMM	0x04
+#define	FPARSELN_UNESCREST	0x08
+#define	FPARSELN_UNESCALL	0x0f
+
+__BEGIN_DECLS
+int	 asprintf(char ** __restrict, const char * __restrict, ...)
+		__printflike(2, 3);
+char	*fgetln(FILE * __restrict, size_t * __restrict);
+char	*fparseln(FILE *, size_t *, size_t *, const char[3], int);
+int	 fpurge(FILE *);
+void	 setbuffer(FILE *, char *, int);
+int	 setlinebuf(FILE *);
+int	 vasprintf(char ** __restrict, const char * __restrict,
+    __va_list)
+		__printflike(2, 0);
+const char *fmtcheck(const char *, const char *)
+		__format_arg(2);
+__END_DECLS
+
+/*
+ * Stdio function-access interface.
+ */
+__BEGIN_DECLS
+FILE	*funopen(const void *,
+    int (*)(void *, char *, int),
+    int (*)(void *, const char *, int),
+    off_t (*)(void *, off_t, int),
+    int (*)(void *));
+FILE	*funopen2(const void *,
+    ssize_t (*)(void *, void *, size_t),
+    ssize_t (*)(void *, const void *, size_t),
+    off_t (*)(void *, off_t, int),
+    int (*)(void *),
+    int (*)(void *));
+__END_DECLS
+#define	fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
+#define	fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
+#define	fropen2(cookie, fn) funopen2(cookie, fn, 0, 0, 0, 0)
+#define	fwopen2(cookie, fn) funopen2(cookie, 0, fn, 0, 0, 0)
+#endif /* _NETBSD_SOURCE */
+
+/*
+ * Functions internal to the implementation.
+ */
+__BEGIN_DECLS
+int	__srget(FILE *);
+int	__swbuf(int, FILE *);
+__END_DECLS
+
+/*
+ * The __sfoo macros are here so that we can 
+ * define function versions in the C library.
+ */
+#define	__sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
+#if defined(__GNUC__) && defined(__STDC__)
+static __inline int __sputc(int _c, FILE *_p) {
+	if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
+		return *_p->_p++ = (unsigned char)_c;
+	else
+		return __swbuf(_c, _p);
+}
+#else
+/*
+ * This has been tuned to generate reasonable code on the vax using pcc.
+ */
+#define	__sputc(c, p) \
+	(--(p)->_w < 0 ? \
+		(p)->_w >= (p)->_lbfsize ? \
+			(*(p)->_p = (c)), *(p)->_p != '\n' ? \
+				(int)*(p)->_p++ : \
+				__swbuf('\n', p) : \
+			__swbuf((int)(c), p) : \
+		(*(p)->_p = (c), (int)*(p)->_p++))
+#endif
+
+#define	__sfeof(p)	(((p)->_flags & __SEOF) != 0)
+#define	__sferror(p)	(((p)->_flags & __SERR) != 0)
+#define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
+#define	__sfileno(p)	\
+    ((p)->_file == -1 ? -1 : (int)(unsigned short)(p)->_file)
+
+#if !defined(__lint__) && !defined(__cplusplus)
+#if !defined(_REENTRANT) && !defined(_PTHREADS)
+#define	feof(p)		__sfeof(p)
+#define	ferror(p)	__sferror(p)
+#define	clearerr(p)	__sclearerr(p)
+
+#define	getc(fp)	__sgetc(fp)
+#define putc(x, fp)	__sputc(x, fp)
+#endif /* !_REENTRANT && !_PTHREADS */
+
+#define	getchar()	getc(stdin)
+#define	putchar(x)	putc(x, stdout)
+
+#endif /* !__lint__ && !__cplusplus */
+
+#if (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)) && !defined(__cplusplus)
+#if !defined(_REENTRANT) && !defined(_PTHREADS)
+#define	fileno(p)	__sfileno(p)
+#endif /* !_REENTRANT && !_PTHREADS */
+#endif /* !_ANSI_SOURCE && !__cplusplus*/
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+int	 vdprintf(int, const char * __restrict, __va_list)
+		__printflike(2, 0);
+int	 dprintf(int, const char * __restrict, ...)
+		__printflike(2, 3);
+__END_DECLS
+#endif /* (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) */
+
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE) && !defined(__cplusplus)
+#define getc_unlocked(fp)	__sgetc(fp)
+#define putc_unlocked(x, fp)	__sputc(x, fp)
+
+#define getchar_unlocked()	getc_unlocked(stdin)
+#define putchar_unlocked(x)	putc_unlocked(x, stdout)
+#endif /* _POSIX_C_SOURCE >= 199506 || _XOPEN_SOURCE >= 500 || _REENTRANT... */
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
+    defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+FILE *fmemopen(void * __restrict, size_t, const char * __restrict);
+FILE *open_memstream(char **, size_t *);
+ssize_t	 getdelim(char ** __restrict, size_t * __restrict, int,
+	    FILE * __restrict);
+ssize_t	 getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
+__END_DECLS
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+__BEGIN_DECLS
+int	 fprintf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
+		__printflike(3, 4);
+int	 vfprintf_l(FILE * __restrict, locale_t, const char * __restrict,
+		__va_list) __printflike(3, 0);
+int	 printf_l(locale_t, const char * __restrict, ...)
+		__printflike(2, 3);
+int	 vprintf_l(locale_t, const char * __restrict, __va_list)
+		__printflike(2, 0);
+int	 asprintf_l(char ** __restrict, locale_t, const char * __restrict, ...)
+		__printflike(3, 4);
+int	 vasprintf_l(char ** __restrict, locale_t, const char * __restrict,
+    __va_list)
+		__printflike(3, 0);
+int	 vdprintf_l(int, locale_t, const char * __restrict, __va_list)
+		__printflike(3, 0);
+int	 dprintf_l(int, locale_t, const char * __restrict, ...)
+		__printflike(3, 4);
+int	 snprintf_l(char * __restrict, size_t, locale_t,
+		    const char * __restrict, ...) __printflike(4, 5);
+int	 vsnprintf_l(char * __restrict, size_t, locale_t,
+		     const char * __restrict, __va_list) __printflike(4, 0);
+#ifndef __AUDIT__
+int	 sprintf_l(char * __restrict, locale_t, const char * __restrict, ...)
+		   __printflike(3, 4);
+int	 vsprintf_l(char * __restrict, locale_t, const char * __restrict,
+		    __va_list) __printflike(3, 0);
+#endif
+
+int	 fscanf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
+    __scanflike(3, 4);
+int	 scanf_l(locale_t, const char * __restrict, ...)
+    __scanflike(2, 3);
+int	 sscanf_l(const char * __restrict, locale_t,
+    const char * __restrict, ...) __scanflike(3, 4);
+int	 vscanf_l(locale_t, const char * __restrict, __va_list)
+    __scanflike(2, 0);
+int	 vfscanf_l(FILE * __restrict, locale_t, const char * __restrict,
+    __va_list) __scanflike(3, 0);
+int	 vsscanf_l(const char * __restrict, locale_t, const char * __restrict,
+    __va_list) __scanflike(3, 0);
+#ifdef _NETBSD_SOURCE
+int	snprintf_ss(char *restrict, size_t, const char * __restrict, ...)
+    __printflike(3, 4);
+int	vsnprintf_ss(char *restrict, size_t, const char * __restrict, __va_list)
+    __printflike(3, 0);
+#endif
+__END_DECLS
+#endif
+
+#if _FORTIFY_SOURCE > 0
+#include <ssp/stdio.h>
+#endif
+
+#endif /* _STDIO_H_ */

Property changes on: lab4/.minix-src/include/stdio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/search.h
===================================================================
--- lab4/.minix-src/include/search.h	(nonexistent)
+++ lab4/.minix-src/include/search.h	(revision 13)
@@ -0,0 +1,88 @@
+/*	$NetBSD: search.h,v 1.22 2014/07/20 20:17:21 christos Exp $	*/
+
+/*
+ * Written by J.T. Conklin <jtc@NetBSD.org>
+ * Public domain.
+ */
+
+#ifndef _SEARCH_H_
+#define _SEARCH_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <machine/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+typedef struct entry {
+	char *key;
+	void *data;
+} ENTRY;
+
+#ifdef _NETBSD_SOURCE
+struct _ENTRY;
+struct hsearch_data {
+	struct _ENTRY *table;
+	size_t size;
+	size_t filled;
+};
+#endif
+
+typedef enum {
+	FIND, ENTER
+} ACTION;
+
+typedef enum {
+	preorder,
+	postorder,
+	endorder,
+	leaf
+} VISIT;
+
+#ifdef _SEARCH_PRIVATE
+typedef struct node {
+	char         *key;
+	struct node  *llink, *rlink;
+} node_t;
+#endif
+
+__BEGIN_DECLS
+#ifndef __BSEARCH_DECLARED
+#define __BSEARCH_DECLARED
+/* also in stdlib.h */
+void	*bsearch(const void *, const void *, size_t, size_t,
+		      int (*)(const void *, const void *));
+#endif /* __BSEARCH_DECLARED */
+
+int	 hcreate(size_t);
+void	 hdestroy(void);
+ENTRY	*hsearch(ENTRY, ACTION);
+
+#ifdef _NETBSD_SOURCE
+void	 hdestroy1(void (*)(void *), void (*)(void *));
+int	 hcreate_r(size_t, struct hsearch_data *);
+void	 hdestroy_r(struct hsearch_data *);
+void	 hdestroy1_r(struct hsearch_data *, void (*)(void *), void (*)(void *));
+int	 hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
+#endif /* _NETBSD_SOURCE */
+
+void	*lfind(const void *, const void *, size_t *, size_t,
+		      int (*)(const void *, const void *));
+void	*lsearch(const void *, void *, size_t *, size_t,
+		      int (*)(const void *, const void *));
+void	 insque(void *, void *);
+void	 remque(void *);
+
+void	*tdelete(const void * __restrict, void ** __restrict,
+		      int (*)(const void *, const void *));
+void	*tfind(const void *, void * const *,
+		      int (*)(const void *, const void *));
+void	*tsearch(const void *, void **, 
+		      int (*)(const void *, const void *));
+void	 twalk(const void *, void (*)(const void *, VISIT, int));
+__END_DECLS
+
+#endif /* !_SEARCH_H_ */

Property changes on: lab4/.minix-src/include/search.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/rmt.h
===================================================================
--- lab4/.minix-src/include/rmt.h	(nonexistent)
+++ lab4/.minix-src/include/rmt.h	(revision 13)
@@ -0,0 +1,64 @@
+/*	$NetBSD: rmt.h,v 1.7 2011/02/16 19:29:35 christos Exp $	*/
+
+/*
+ *	rmt.h
+ *
+ *	Added routines to replace open(), close(), lseek(), ioctl(), etc.
+ *	The preprocessor can be used to remap these the rmtopen(), etc
+ *	thus minimizing source changes.
+ *
+ *	This file must be included before <sys/stat.h>, since it redefines
+ *	stat to be rmtstat, so that struct stat xyzzy; declarations work
+ *	properly.
+ *
+ *	-- Fred Fish (w/some changes by Arnold Robbins)
+ */
+
+#ifndef _RMT_H_
+#define _RMT_H_
+
+#include <sys/cdefs.h>
+
+#if _FORTIFY_SOURCE > 0
+#define __ssp_weak_name(x)	rmt ## x
+#include <ssp/unistd.h>
+#endif 
+
+__BEGIN_DECLS
+int	isrmt(int);
+int	rmtaccess(const char *, int);
+int	rmtclose(int);
+int	rmtcreat(const char *, mode_t);
+int	rmtdup(int);
+int	rmtfcntl(int, int, ...);
+int	rmtfstat(int, struct stat *);
+int	rmtioctl(int, unsigned long, ...);
+int	rmtisatty(int);
+off_t	rmtlseek(int, off_t, int);
+int	rmtlstat(const char *, struct stat *);
+int	rmtopen(const char *, int, ...);
+ssize_t	rmtread(int, void *, size_t);
+int	rmtstat(const char *, struct stat *);
+ssize_t	rmtwrite(int, const void *, size_t);
+__END_DECLS
+
+#ifndef __RMTLIB_PRIVATE	/* don't remap if building librmt */
+#define access rmtaccess
+#define close rmtclose
+#define creat rmtcreat
+#define dup rmtdup
+#define fcntl rmtfcntl
+#define fstat rmtfstat
+#define ioctl rmtioctl
+#define isatty rmtisatty
+#define lseek rmtlseek
+#define lstat rmtlstat
+#define open rmtopen
+#if __SSP_FORTIFY_LEVEL == 0
+#define read rmtread
+#endif
+#define stat rmtstat
+#define write rmtwrite
+#endif /* __RMTLIB_PRIVATE */
+
+#endif /* _RMT_H_ */

Property changes on: lab4/.minix-src/include/rmt.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/cdbr.h
===================================================================
--- lab4/.minix-src/include/cdbr.h	(nonexistent)
+++ lab4/.minix-src/include/cdbr.h	(revision 13)
@@ -0,0 +1 @@
+sys/cdbr.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/cdbr.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/strings.h
===================================================================
--- lab4/.minix-src/include/strings.h	(nonexistent)
+++ lab4/.minix-src/include/strings.h	(revision 13)
@@ -0,0 +1,74 @@
+/*	$NetBSD: strings.h,v 1.18 2011/08/22 01:24:15 dholland Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _STRINGS_H_
+#define _STRINGS_H_
+
+#include <machine/ansi.h>
+#include <sys/featuretest.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#include <sys/null.h>
+#endif
+
+#include <sys/cdefs.h>
+
+#include <machine/int_types.h>
+
+__BEGIN_DECLS
+int	 bcmp(const void *, const void *, size_t);
+void	 bcopy(const void *, void *, size_t);
+void	 bzero(void *, size_t);
+int	 ffs(int);
+char	*index(const char *, int);
+unsigned int	popcount(unsigned int) __constfunc;
+unsigned int	popcountl(unsigned long) __constfunc;
+unsigned int	popcountll(unsigned long long) __constfunc;
+unsigned int	popcount32(__uint32_t) __constfunc;
+unsigned int	popcount64(__uint64_t) __constfunc;
+char	*rindex(const char *, int);
+int	 strcasecmp(const char *, const char *);
+int	 strncasecmp(const char *, const char *, size_t);
+__END_DECLS
+
+#if defined(_NETBSD_SOURCE)
+#include <string.h>
+#endif
+
+#if _FORTIFY_SOURCE > 0
+#include <ssp/strings.h>
+#endif
+#endif /* !defined(_STRINGS_H_) */

Property changes on: lab4/.minix-src/include/strings.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sha1.h
===================================================================
--- lab4/.minix-src/include/sha1.h	(nonexistent)
+++ lab4/.minix-src/include/sha1.h	(revision 13)
@@ -0,0 +1 @@
+sys/sha1.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/sha1.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/semaphore.h
===================================================================
--- lab4/.minix-src/include/semaphore.h	(nonexistent)
+++ lab4/.minix-src/include/semaphore.h	(revision 13)
@@ -0,0 +1,58 @@
+/* $NetBSD: semaphore.h,v 1.4 2012/03/08 21:59:28 joerg Exp $ */
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SEMAPHORE_H_
+#define _SEMAPHORE_H_
+
+/* POSIX 1003.1b semaphores */
+
+struct _sem_st;
+typedef	struct _sem_st *sem_t;
+
+#define	SEM_FAILED	((sem_t *)0)
+#define	SEM_VALUE_MAX	(~0U)
+
+#include <sys/time.h>
+
+__BEGIN_DECLS
+int	 sem_close(sem_t *);
+int	 sem_destroy(sem_t *);
+int	 sem_getvalue(sem_t * __restrict, int * __restrict);
+int	 sem_init(sem_t *, int, unsigned int);
+int	 sem_post(sem_t *);
+int	 sem_timedwait(sem_t *, const struct timespec * __restrict);
+int	 sem_trywait(sem_t *);
+int	 sem_unlink(const char *);
+int	 sem_wait(sem_t *);
+sem_t	*sem_open(const char *, int, ...);
+__END_DECLS
+
+#endif /* !_SEMAPHORE_H_ */

Property changes on: lab4/.minix-src/include/semaphore.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/cpio.h
===================================================================
--- lab4/.minix-src/include/cpio.h	(nonexistent)
+++ lab4/.minix-src/include/cpio.h	(revision 13)
@@ -0,0 +1,58 @@
+/*	$NetBSD: cpio.h,v 1.3 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by J.T. Conklin.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _CPIO_H_
+#define _CPIO_H_
+
+#define C_IRUSR		0000400
+#define C_IWUSR		0000200
+#define C_IXUSR		0000100
+#define C_IRGRP		0000040
+#define C_IWGRP		0000020
+#define C_IXGRP		0000010
+#define C_IROTH		0000004
+#define C_IWOTH		0000002
+#define C_IXOTH		0000001
+#define C_ISUID		0004000
+#define C_ISGID		0002000
+#define C_ISVTX		0001000
+#define C_ISDIR		0040000
+#define C_ISFIFO	0010000
+#define C_ISREG		0100000
+#define C_ISBLK		0060000
+#define C_ISCHR		0020000
+#define C_ISCTG		0110000
+#define C_ISLNK		0120000
+#define C_ISSOCK	0140000
+ 
+#define MAGIC		"070707"
+
+#endif /* _CPIO_H_ */

Property changes on: lab4/.minix-src/include/cpio.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/tar.h
===================================================================
--- lab4/.minix-src/include/tar.h	(nonexistent)
+++ lab4/.minix-src/include/tar.h	(revision 13)
@@ -0,0 +1,71 @@
+/*	$NetBSD: tar.h,v 1.4 2003/08/07 09:44:11 agc Exp $	*/
+
+/*-
+ * Copyright (c) 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chuck Karish of Mindcraft, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tar.h	8.2 (Berkeley) 1/4/94
+ */
+
+#ifndef _TAR_H
+#define _TAR_H
+
+#define	TMAGIC		"ustar"	/* ustar and a null */
+#define	TMAGLEN		6
+#define	TVERSION	"00"	/* 00 and no null */
+#define	TVERSLEN	2
+
+/* Values used in typeflag field */
+#define	REGTYPE		'0'	/* Regular file */
+#define	AREGTYPE	'\0'	/* Regular file */
+#define	LNKTYPE		'1'	/* Link */
+#define	SYMTYPE		'2'	/* Reserved */
+#define	CHRTYPE		'3'	/* Character special */
+#define	BLKTYPE		'4'	/* Block special */
+#define	DIRTYPE		'5'	/* Directory */
+#define	FIFOTYPE	'6'	/* FIFO special */
+#define	CONTTYPE	'7'	/* Reserved */
+
+/* Bits used in the mode field - values in octal */
+#define	TSUID		04000	/* Set UID on execution */
+#define	TSGID		02000	/* Set GID on execution */
+#define	TSVTX		01000	/* Reserved */
+				/* File permissions */
+#define	TUREAD		00400	/* Read by owner */
+#define	TUWRITE		00200	/* Write by owner */
+#define	TUEXEC		00100	/* Execute/Search by owner */
+#define	TGREAD		00040	/* Read by group */
+#define	TGWRITE		00020	/* Write by group */
+#define	TGEXEC		00010	/* Execute/Search by group */
+#define	TOREAD		00004	/* Read by other */
+#define	TOWRITE		00002	/* Write by other */
+#define	TOEXEC		00001	/* Execute/Search by other */
+
+#endif

Property changes on: lab4/.minix-src/include/tar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sha2.h
===================================================================
--- lab4/.minix-src/include/sha2.h	(nonexistent)
+++ lab4/.minix-src/include/sha2.h	(revision 13)
@@ -0,0 +1 @@
+sys/sha2.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/sha2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/des.h
===================================================================
--- lab4/.minix-src/include/des.h	(nonexistent)
+++ lab4/.minix-src/include/des.h	(revision 13)
@@ -0,0 +1,259 @@
+/*	$NetBSD: des.h,v 1.1 2009/07/19 23:30:57 christos Exp $	*/
+
+/* crypto/des/des.h */
+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ * 
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ * 
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ * 
+ * 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 copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from 
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ * 
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * 
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef HEADER_DES_H
+#define HEADER_DES_H
+
+#ifdef _KERBEROS_DES_H
+#error <openssl/des.h> replaces <kerberos/des.h>.
+#endif
+
+#include <sys/types.h>
+#define DES_LONG	u_int32_t
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef unsigned char des_cblock[8];
+typedef /* const */ unsigned char const_des_cblock[8];
+/* With "const", gcc 2.8.1 on Solaris thinks that des_cblock *
+ * and const_des_cblock * are incompatible pointer types. */
+
+#define DES_KEY_SZ 	8	/*(sizeof(des_cblock))*/
+#define DES_SCHEDULE_SZ 128	/*(sizeof(des_key_schedule))*/
+
+typedef DES_LONG des_key_schedule[DES_SCHEDULE_SZ / sizeof(DES_LONG)];
+
+#define DES_ENCRYPT	1
+#define DES_DECRYPT	0
+
+#define DES_CBC_MODE	0
+#define DES_PCBC_MODE	1
+
+#define des_ecb2_encrypt(i,o,k1,k2,e) \
+	des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
+
+#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
+	des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
+
+#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
+	des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
+
+#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
+	des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
+
+extern int des_check_key;	/* defaults to false */
+extern int des_rw_mode;		/* defaults to DES_PCBC_MODE */
+extern int des_set_weak_key_flag; /* set the weak key flag */
+
+const char *des_options(void);
+void des_ecb3_encrypt(const_des_cblock *, des_cblock *,
+		      des_key_schedule,des_key_schedule,
+		      des_key_schedule, int);
+DES_LONG des_cbc_cksum(const unsigned char *,des_cblock *,
+		       long,des_key_schedule,
+		       const_des_cblock *);
+/* des_cbc_encrypt does not update the IV!  Use des_ncbc_encrypt instead. */
+void des_cbc_encrypt(const unsigned char *input,unsigned char *,
+		     long,des_key_schedule,des_cblock *,
+		     int);
+void des_ncbc_encrypt(const unsigned char *input,unsigned char *,
+		      long,des_key_schedule,des_cblock *,
+		      int);
+void des_xcbc_encrypt(const unsigned char *input,unsigned char *,
+		      long,des_key_schedule,des_cblock *,
+		      const_des_cblock *inw,const_des_cblock *w,int);
+void des_cfb_encrypt(const unsigned char *,unsigned char *,int,
+		     long,des_key_schedule,des_cblock *,
+		     int);
+void des_ecb_encrypt(const_des_cblock *input,des_cblock *,
+		     des_key_schedule,int);
+
+/* 	This is the DES encryption function that gets called by just about
+	every other DES routine in the library.  You should not use this
+	function except to implement 'modes' of DES.  I say this because the
+	functions that call this routine do the conversion from 'char *' to
+	long, and this needs to be done to make sure 'non-aligned' memory
+	access do not occur.  The characters are loaded 'little endian'.
+	Data is a pointer to 2 unsigned long's and ks is the
+	des_key_schedule to use.  enc, is non zero specifies encryption,
+	zero if decryption. */
+void des_encrypt1(DES_LONG *,des_key_schedule, int);
+
+/* 	This functions is the same as des_encrypt1() except that the DES
+	initial permutation (IP) and final permutation (FP) have been left
+	out.  As for des_encrypt1(), you should not use this function.
+	It is used by the routines in the library that implement triple DES.
+	IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same
+	as des_encrypt1() des_encrypt1() des_encrypt1() except faster :-). */
+void des_encrypt2(DES_LONG *,des_key_schedule, int);
+
+void des_encrypt3(DES_LONG *, des_key_schedule,
+	des_key_schedule, des_key_schedule);
+void des_decrypt3(DES_LONG *, des_key_schedule,
+	des_key_schedule, des_key_schedule);
+void des_ede3_cbc_encrypt(const unsigned char *,unsigned char *,
+			  long,
+			  des_key_schedule,des_key_schedule,
+			  des_key_schedule,des_cblock *,int);
+void des_ede3_cbcm_encrypt(const unsigned char *,unsigned char *,
+			   long,
+			   des_key_schedule,des_key_schedule,
+			   des_key_schedule,
+			   des_cblock *,des_cblock *,
+			   int);
+void des_ede3_cfb64_encrypt(const unsigned char *,unsigned char *,
+			    long,des_key_schedule,
+			    des_key_schedule,des_key_schedule,
+			    des_cblock *,int *,int);
+void des_ede3_ofb64_encrypt(const unsigned char *,unsigned char *,
+			    long,des_key_schedule,
+			    des_key_schedule,des_key_schedule,
+			    des_cblock *,int *);
+
+void des_xwhite_in2out(const_des_cblock *des_key,const_des_cblock *in_white,
+		       des_cblock *_white);
+
+int des_enc_read(int fd,void *,int len,des_key_schedule,
+		 des_cblock *);
+int des_enc_write(int fd,const void *,int len,des_key_schedule,
+		  des_cblock *);
+char *des_fcrypt(const char *,const char *, char *);
+char *des_crypt(const char *,const char *);
+void des_ofb_encrypt(const unsigned char *,unsigned char *,int,
+		     long,des_key_schedule,des_cblock *);
+void des_pcbc_encrypt(const unsigned char *input,unsigned char *,
+		      long,des_key_schedule,des_cblock *,
+		      int);
+DES_LONG des_quad_cksum(const unsigned char *,des_cblock [],
+			long,int,des_cblock *);
+void des_random_seed(des_cblock *);
+int des_random_key(des_cblock *);
+int des_read_password(des_cblock *,const char *,int);
+int des_read_2passwords(des_cblock *,des_cblock *,
+			const char *,int);
+int des_read_pw_string(char *,int,const char *,int);
+void des_set_odd_parity(des_cblock *);
+void des_fixup_key_parity(des_cblock *);
+int des_check_key_parity(const_des_cblock *);
+int des_is_weak_key(const_des_cblock *);
+/* des_set_key (= set_key = des_key_sched = key_sched) calls
+ * des_set_key_checked if global variable des_check_key is set,
+ * des_set_key_unchecked otherwise. */
+int des_set_key(const_des_cblock *,des_key_schedule);
+int des_key_sched(const_des_cblock *,des_key_schedule);
+int des_set_key_checked(const_des_cblock *,des_key_schedule);
+void des_set_key_unchecked(const_des_cblock *,des_key_schedule);
+void des_string_to_key(const char *,des_cblock *);
+void des_string_to_2keys(const char *,des_cblock *,des_cblock *);
+void des_cfb64_encrypt(const unsigned char *,unsigned char *,long,
+		       des_key_schedule,des_cblock *,int *,
+		       int);
+void des_ofb64_encrypt(const unsigned char *,unsigned char *,long,
+		       des_key_schedule,des_cblock *,int *);
+int des_read_pw(char *,char *,int size,const char *,int);
+
+/* The following functions are not in the normal unix build or the
+ * SSLeay build.  When using the SSLeay build, use RAND_seed()
+ * and RAND_bytes() instead. */
+int des_new_random_key(des_cblock *);
+void des_init_random_number_generator(des_cblock *);
+void des_set_random_generator_seed(des_cblock *);
+
+/* The following definitions provide compatibility with the MIT Kerberos
+ * library. The des_key_schedule structure is not binary compatible. */
+
+#define _KERBEROS_DES_H
+
+#define KRBDES_ENCRYPT DES_ENCRYPT
+#define KRBDES_DECRYPT DES_DECRYPT
+
+#ifdef KERBEROS
+#  define ENCRYPT DES_ENCRYPT
+#  define DECRYPT DES_DECRYPT
+#endif
+
+#ifndef NCOMPAT
+#  define C_Block des_cblock
+#  define Key_schedule des_key_schedule
+#  define KEY_SZ DES_KEY_SZ
+#  define string_to_key des_string_to_key
+#  define read_pw_string des_read_pw_string
+#  define random_key des_random_key
+#  define pcbc_encrypt des_pcbc_encrypt
+#  define set_key des_set_key
+#  define key_sched des_key_sched
+#  define ecb_encrypt des_ecb_encrypt
+#  define cbc_encrypt des_cbc_encrypt
+#  define ncbc_encrypt des_ncbc_encrypt
+#  define xcbc_encrypt des_xcbc_encrypt
+#  define cbc_cksum des_cbc_cksum
+#  define quad_cksum des_quad_cksum
+#  define check_parity des_check_key_parity
+#endif
+
+typedef des_key_schedule bit_64;
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif

Property changes on: lab4/.minix-src/include/des.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sqlite3ext.h
===================================================================
--- lab4/.minix-src/include/sqlite3ext.h	(nonexistent)
+++ lab4/.minix-src/include/sqlite3ext.h	(revision 13)
@@ -0,0 +1,487 @@
+/*
+** 2006 June 7
+**
+** The author disclaims copyright to this source code.  In place of
+** a legal notice, here is a blessing:
+**
+**    May you do good and not evil.
+**    May you find forgiveness for yourself and forgive others.
+**    May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This header file defines the SQLite interface for use by
+** shared libraries that want to be imported as extensions into
+** an SQLite instance.  Shared libraries that intend to be loaded
+** as extensions by SQLite should #include this file instead of 
+** sqlite3.h.
+*/
+#ifndef _SQLITE3EXT_H_
+#define _SQLITE3EXT_H_
+#include "sqlite3.h"
+
+typedef struct sqlite3_api_routines sqlite3_api_routines;
+
+/*
+** The following structure holds pointers to all of the SQLite API
+** routines.
+**
+** WARNING:  In order to maintain backwards compatibility, add new
+** interfaces to the end of this structure only.  If you insert new
+** interfaces in the middle of this structure, then older different
+** versions of SQLite will not be able to load each others' shared
+** libraries!
+*/
+struct sqlite3_api_routines {
+  void * (*aggregate_context)(sqlite3_context*,int nBytes);
+  int  (*aggregate_count)(sqlite3_context*);
+  int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
+  int  (*bind_double)(sqlite3_stmt*,int,double);
+  int  (*bind_int)(sqlite3_stmt*,int,int);
+  int  (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
+  int  (*bind_null)(sqlite3_stmt*,int);
+  int  (*bind_parameter_count)(sqlite3_stmt*);
+  int  (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
+  const char * (*bind_parameter_name)(sqlite3_stmt*,int);
+  int  (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
+  int  (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
+  int  (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
+  int  (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
+  int  (*busy_timeout)(sqlite3*,int ms);
+  int  (*changes)(sqlite3*);
+  int  (*close)(sqlite3*);
+  int  (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,
+                           int eTextRep,const char*));
+  int  (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,
+                             int eTextRep,const void*));
+  const void * (*column_blob)(sqlite3_stmt*,int iCol);
+  int  (*column_bytes)(sqlite3_stmt*,int iCol);
+  int  (*column_bytes16)(sqlite3_stmt*,int iCol);
+  int  (*column_count)(sqlite3_stmt*pStmt);
+  const char * (*column_database_name)(sqlite3_stmt*,int);
+  const void * (*column_database_name16)(sqlite3_stmt*,int);
+  const char * (*column_decltype)(sqlite3_stmt*,int i);
+  const void * (*column_decltype16)(sqlite3_stmt*,int);
+  double  (*column_double)(sqlite3_stmt*,int iCol);
+  int  (*column_int)(sqlite3_stmt*,int iCol);
+  sqlite_int64  (*column_int64)(sqlite3_stmt*,int iCol);
+  const char * (*column_name)(sqlite3_stmt*,int);
+  const void * (*column_name16)(sqlite3_stmt*,int);
+  const char * (*column_origin_name)(sqlite3_stmt*,int);
+  const void * (*column_origin_name16)(sqlite3_stmt*,int);
+  const char * (*column_table_name)(sqlite3_stmt*,int);
+  const void * (*column_table_name16)(sqlite3_stmt*,int);
+  const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
+  const void * (*column_text16)(sqlite3_stmt*,int iCol);
+  int  (*column_type)(sqlite3_stmt*,int iCol);
+  sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
+  void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
+  int  (*complete)(const char*sql);
+  int  (*complete16)(const void*sql);
+  int  (*create_collation)(sqlite3*,const char*,int,void*,
+                           int(*)(void*,int,const void*,int,const void*));
+  int  (*create_collation16)(sqlite3*,const void*,int,void*,
+                             int(*)(void*,int,const void*,int,const void*));
+  int  (*create_function)(sqlite3*,const char*,int,int,void*,
+                          void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+                          void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+                          void (*xFinal)(sqlite3_context*));
+  int  (*create_function16)(sqlite3*,const void*,int,int,void*,
+                            void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+                            void (*xFinal)(sqlite3_context*));
+  int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
+  int  (*data_count)(sqlite3_stmt*pStmt);
+  sqlite3 * (*db_handle)(sqlite3_stmt*);
+  int (*declare_vtab)(sqlite3*,const char*);
+  int  (*enable_shared_cache)(int);
+  int  (*errcode)(sqlite3*db);
+  const char * (*errmsg)(sqlite3*);
+  const void * (*errmsg16)(sqlite3*);
+  int  (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
+  int  (*expired)(sqlite3_stmt*);
+  int  (*finalize)(sqlite3_stmt*pStmt);
+  void  (*free)(void*);
+  void  (*free_table)(char**result);
+  int  (*get_autocommit)(sqlite3*);
+  void * (*get_auxdata)(sqlite3_context*,int);
+  int  (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
+  int  (*global_recover)(void);
+  void  (*interruptx)(sqlite3*);
+  sqlite_int64  (*last_insert_rowid)(sqlite3*);
+  const char * (*libversion)(void);
+  int  (*libversion_number)(void);
+  void *(*malloc)(int);
+  char * (*mprintf)(const char*,...);
+  int  (*open)(const char*,sqlite3**);
+  int  (*open16)(const void*,sqlite3**);
+  int  (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
+  int  (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
+  void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
+  void  (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
+  void *(*realloc)(void*,int);
+  int  (*reset)(sqlite3_stmt*pStmt);
+  void  (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
+  void  (*result_double)(sqlite3_context*,double);
+  void  (*result_error)(sqlite3_context*,const char*,int);
+  void  (*result_error16)(sqlite3_context*,const void*,int);
+  void  (*result_int)(sqlite3_context*,int);
+  void  (*result_int64)(sqlite3_context*,sqlite_int64);
+  void  (*result_null)(sqlite3_context*);
+  void  (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
+  void  (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
+  void  (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
+  void  (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
+  void  (*result_value)(sqlite3_context*,sqlite3_value*);
+  void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
+  int  (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
+                         const char*,const char*),void*);
+  void  (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
+  char * (*snprintf)(int,char*,const char*,...);
+  int  (*step)(sqlite3_stmt*);
+  int  (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
+                                char const**,char const**,int*,int*,int*);
+  void  (*thread_cleanup)(void);
+  int  (*total_changes)(sqlite3*);
+  void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
+  int  (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
+  void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,
+                                         sqlite_int64),void*);
+  void * (*user_data)(sqlite3_context*);
+  const void * (*value_blob)(sqlite3_value*);
+  int  (*value_bytes)(sqlite3_value*);
+  int  (*value_bytes16)(sqlite3_value*);
+  double  (*value_double)(sqlite3_value*);
+  int  (*value_int)(sqlite3_value*);
+  sqlite_int64  (*value_int64)(sqlite3_value*);
+  int  (*value_numeric_type)(sqlite3_value*);
+  const unsigned char * (*value_text)(sqlite3_value*);
+  const void * (*value_text16)(sqlite3_value*);
+  const void * (*value_text16be)(sqlite3_value*);
+  const void * (*value_text16le)(sqlite3_value*);
+  int  (*value_type)(sqlite3_value*);
+  char *(*vmprintf)(const char*,va_list);
+  /* Added ??? */
+  int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
+  /* Added by 3.3.13 */
+  int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
+  int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
+  int (*clear_bindings)(sqlite3_stmt*);
+  /* Added by 3.4.1 */
+  int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,
+                          void (*xDestroy)(void *));
+  /* Added by 3.5.0 */
+  int (*bind_zeroblob)(sqlite3_stmt*,int,int);
+  int (*blob_bytes)(sqlite3_blob*);
+  int (*blob_close)(sqlite3_blob*);
+  int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,
+                   int,sqlite3_blob**);
+  int (*blob_read)(sqlite3_blob*,void*,int,int);
+  int (*blob_write)(sqlite3_blob*,const void*,int,int);
+  int (*create_collation_v2)(sqlite3*,const char*,int,void*,
+                             int(*)(void*,int,const void*,int,const void*),
+                             void(*)(void*));
+  int (*file_control)(sqlite3*,const char*,int,void*);
+  sqlite3_int64 (*memory_highwater)(int);
+  sqlite3_int64 (*memory_used)(void);
+  sqlite3_mutex *(*mutex_alloc)(int);
+  void (*mutex_enter)(sqlite3_mutex*);
+  void (*mutex_free)(sqlite3_mutex*);
+  void (*mutex_leave)(sqlite3_mutex*);
+  int (*mutex_try)(sqlite3_mutex*);
+  int (*open_v2)(const char*,sqlite3**,int,const char*);
+  int (*release_memory)(int);
+  void (*result_error_nomem)(sqlite3_context*);
+  void (*result_error_toobig)(sqlite3_context*);
+  int (*sleep)(int);
+  void (*soft_heap_limit)(int);
+  sqlite3_vfs *(*vfs_find)(const char*);
+  int (*vfs_register)(sqlite3_vfs*,int);
+  int (*vfs_unregister)(sqlite3_vfs*);
+  int (*xthreadsafe)(void);
+  void (*result_zeroblob)(sqlite3_context*,int);
+  void (*result_error_code)(sqlite3_context*,int);
+  int (*test_control)(int, ...);
+  void (*randomness)(int,void*);
+  sqlite3 *(*context_db_handle)(sqlite3_context*);
+  int (*extended_result_codes)(sqlite3*,int);
+  int (*limit)(sqlite3*,int,int);
+  sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
+  const char *(*sql)(sqlite3_stmt*);
+  int (*status)(int,int*,int*,int);
+  int (*backup_finish)(sqlite3_backup*);
+  sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);
+  int (*backup_pagecount)(sqlite3_backup*);
+  int (*backup_remaining)(sqlite3_backup*);
+  int (*backup_step)(sqlite3_backup*,int);
+  const char *(*compileoption_get)(int);
+  int (*compileoption_used)(const char*);
+  int (*create_function_v2)(sqlite3*,const char*,int,int,void*,
+                            void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+                            void (*xFinal)(sqlite3_context*),
+                            void(*xDestroy)(void*));
+  int (*db_config)(sqlite3*,int,...);
+  sqlite3_mutex *(*db_mutex)(sqlite3*);
+  int (*db_status)(sqlite3*,int,int*,int*,int);
+  int (*extended_errcode)(sqlite3*);
+  void (*log)(int,const char*,...);
+  sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);
+  const char *(*sourceid)(void);
+  int (*stmt_status)(sqlite3_stmt*,int,int);
+  int (*strnicmp)(const char*,const char*,int);
+  int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);
+  int (*wal_autocheckpoint)(sqlite3*,int);
+  int (*wal_checkpoint)(sqlite3*,const char*);
+  void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
+  int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
+  int (*vtab_config)(sqlite3*,int op,...);
+  int (*vtab_on_conflict)(sqlite3*);
+  /* Version 3.7.16 and later */
+  int (*close_v2)(sqlite3*);
+  const char *(*db_filename)(sqlite3*,const char*);
+  int (*db_readonly)(sqlite3*,const char*);
+  int (*db_release_memory)(sqlite3*);
+  const char *(*errstr)(int);
+  int (*stmt_busy)(sqlite3_stmt*);
+  int (*stmt_readonly)(sqlite3_stmt*);
+  int (*stricmp)(const char*,const char*);
+  int (*uri_boolean)(const char*,const char*,int);
+  sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
+  const char *(*uri_parameter)(const char*,const char*);
+  char *(*vsnprintf)(int,char*,const char*,va_list);
+  int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
+};
+
+/*
+** The following macros redefine the API routines so that they are
+** redirected throught the global sqlite3_api structure.
+**
+** This header file is also used by the loadext.c source file
+** (part of the main SQLite library - not an extension) so that
+** it can get access to the sqlite3_api_routines structure
+** definition.  But the main library does not want to redefine
+** the API.  So the redefinition macros are only valid if the
+** SQLITE_CORE macros is undefined.
+*/
+#ifndef SQLITE_CORE
+#define sqlite3_aggregate_context      sqlite3_api->aggregate_context
+#ifndef SQLITE_OMIT_DEPRECATED
+#define sqlite3_aggregate_count        sqlite3_api->aggregate_count
+#endif
+#define sqlite3_bind_blob              sqlite3_api->bind_blob
+#define sqlite3_bind_double            sqlite3_api->bind_double
+#define sqlite3_bind_int               sqlite3_api->bind_int
+#define sqlite3_bind_int64             sqlite3_api->bind_int64
+#define sqlite3_bind_null              sqlite3_api->bind_null
+#define sqlite3_bind_parameter_count   sqlite3_api->bind_parameter_count
+#define sqlite3_bind_parameter_index   sqlite3_api->bind_parameter_index
+#define sqlite3_bind_parameter_name    sqlite3_api->bind_parameter_name
+#define sqlite3_bind_text              sqlite3_api->bind_text
+#define sqlite3_bind_text16            sqlite3_api->bind_text16
+#define sqlite3_bind_value             sqlite3_api->bind_value
+#define sqlite3_busy_handler           sqlite3_api->busy_handler
+#define sqlite3_busy_timeout           sqlite3_api->busy_timeout
+#define sqlite3_changes                sqlite3_api->changes
+#define sqlite3_close                  sqlite3_api->close
+#define sqlite3_collation_needed       sqlite3_api->collation_needed
+#define sqlite3_collation_needed16     sqlite3_api->collation_needed16
+#define sqlite3_column_blob            sqlite3_api->column_blob
+#define sqlite3_column_bytes           sqlite3_api->column_bytes
+#define sqlite3_column_bytes16         sqlite3_api->column_bytes16
+#define sqlite3_column_count           sqlite3_api->column_count
+#define sqlite3_column_database_name   sqlite3_api->column_database_name
+#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
+#define sqlite3_column_decltype        sqlite3_api->column_decltype
+#define sqlite3_column_decltype16      sqlite3_api->column_decltype16
+#define sqlite3_column_double          sqlite3_api->column_double
+#define sqlite3_column_int             sqlite3_api->column_int
+#define sqlite3_column_int64           sqlite3_api->column_int64
+#define sqlite3_column_name            sqlite3_api->column_name
+#define sqlite3_column_name16          sqlite3_api->column_name16
+#define sqlite3_column_origin_name     sqlite3_api->column_origin_name
+#define sqlite3_column_origin_name16   sqlite3_api->column_origin_name16
+#define sqlite3_column_table_name      sqlite3_api->column_table_name
+#define sqlite3_column_table_name16    sqlite3_api->column_table_name16
+#define sqlite3_column_text            sqlite3_api->column_text
+#define sqlite3_column_text16          sqlite3_api->column_text16
+#define sqlite3_column_type            sqlite3_api->column_type
+#define sqlite3_column_value           sqlite3_api->column_value
+#define sqlite3_commit_hook            sqlite3_api->commit_hook
+#define sqlite3_complete               sqlite3_api->complete
+#define sqlite3_complete16             sqlite3_api->complete16
+#define sqlite3_create_collation       sqlite3_api->create_collation
+#define sqlite3_create_collation16     sqlite3_api->create_collation16
+#define sqlite3_create_function        sqlite3_api->create_function
+#define sqlite3_create_function16      sqlite3_api->create_function16
+#define sqlite3_create_module          sqlite3_api->create_module
+#define sqlite3_create_module_v2       sqlite3_api->create_module_v2
+#define sqlite3_data_count             sqlite3_api->data_count
+#define sqlite3_db_handle              sqlite3_api->db_handle
+#define sqlite3_declare_vtab           sqlite3_api->declare_vtab
+#define sqlite3_enable_shared_cache    sqlite3_api->enable_shared_cache
+#define sqlite3_errcode                sqlite3_api->errcode
+#define sqlite3_errmsg                 sqlite3_api->errmsg
+#define sqlite3_errmsg16               sqlite3_api->errmsg16
+#define sqlite3_exec                   sqlite3_api->exec
+#ifndef SQLITE_OMIT_DEPRECATED
+#define sqlite3_expired                sqlite3_api->expired
+#endif
+#define sqlite3_finalize               sqlite3_api->finalize
+#define sqlite3_free                   sqlite3_api->free
+#define sqlite3_free_table             sqlite3_api->free_table
+#define sqlite3_get_autocommit         sqlite3_api->get_autocommit
+#define sqlite3_get_auxdata            sqlite3_api->get_auxdata
+#define sqlite3_get_table              sqlite3_api->get_table
+#ifndef SQLITE_OMIT_DEPRECATED
+#define sqlite3_global_recover         sqlite3_api->global_recover
+#endif
+#define sqlite3_interrupt              sqlite3_api->interruptx
+#define sqlite3_last_insert_rowid      sqlite3_api->last_insert_rowid
+#define sqlite3_libversion             sqlite3_api->libversion
+#define sqlite3_libversion_number      sqlite3_api->libversion_number
+#define sqlite3_malloc                 sqlite3_api->malloc
+#define sqlite3_mprintf                sqlite3_api->mprintf
+#define sqlite3_open                   sqlite3_api->open
+#define sqlite3_open16                 sqlite3_api->open16
+#define sqlite3_prepare                sqlite3_api->prepare
+#define sqlite3_prepare16              sqlite3_api->prepare16
+#define sqlite3_prepare_v2             sqlite3_api->prepare_v2
+#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
+#define sqlite3_profile                sqlite3_api->profile
+#define sqlite3_progress_handler       sqlite3_api->progress_handler
+#define sqlite3_realloc                sqlite3_api->realloc
+#define sqlite3_reset                  sqlite3_api->reset
+#define sqlite3_result_blob            sqlite3_api->result_blob
+#define sqlite3_result_double          sqlite3_api->result_double
+#define sqlite3_result_error           sqlite3_api->result_error
+#define sqlite3_result_error16         sqlite3_api->result_error16
+#define sqlite3_result_int             sqlite3_api->result_int
+#define sqlite3_result_int64           sqlite3_api->result_int64
+#define sqlite3_result_null            sqlite3_api->result_null
+#define sqlite3_result_text            sqlite3_api->result_text
+#define sqlite3_result_text16          sqlite3_api->result_text16
+#define sqlite3_result_text16be        sqlite3_api->result_text16be
+#define sqlite3_result_text16le        sqlite3_api->result_text16le
+#define sqlite3_result_value           sqlite3_api->result_value
+#define sqlite3_rollback_hook          sqlite3_api->rollback_hook
+#define sqlite3_set_authorizer         sqlite3_api->set_authorizer
+#define sqlite3_set_auxdata            sqlite3_api->set_auxdata
+#define sqlite3_snprintf               sqlite3_api->snprintf
+#define sqlite3_step                   sqlite3_api->step
+#define sqlite3_table_column_metadata  sqlite3_api->table_column_metadata
+#define sqlite3_thread_cleanup         sqlite3_api->thread_cleanup
+#define sqlite3_total_changes          sqlite3_api->total_changes
+#define sqlite3_trace                  sqlite3_api->trace
+#ifndef SQLITE_OMIT_DEPRECATED
+#define sqlite3_transfer_bindings      sqlite3_api->transfer_bindings
+#endif
+#define sqlite3_update_hook            sqlite3_api->update_hook
+#define sqlite3_user_data              sqlite3_api->user_data
+#define sqlite3_value_blob             sqlite3_api->value_blob
+#define sqlite3_value_bytes            sqlite3_api->value_bytes
+#define sqlite3_value_bytes16          sqlite3_api->value_bytes16
+#define sqlite3_value_double           sqlite3_api->value_double
+#define sqlite3_value_int              sqlite3_api->value_int
+#define sqlite3_value_int64            sqlite3_api->value_int64
+#define sqlite3_value_numeric_type     sqlite3_api->value_numeric_type
+#define sqlite3_value_text             sqlite3_api->value_text
+#define sqlite3_value_text16           sqlite3_api->value_text16
+#define sqlite3_value_text16be         sqlite3_api->value_text16be
+#define sqlite3_value_text16le         sqlite3_api->value_text16le
+#define sqlite3_value_type             sqlite3_api->value_type
+#define sqlite3_vmprintf               sqlite3_api->vmprintf
+#define sqlite3_overload_function      sqlite3_api->overload_function
+#define sqlite3_prepare_v2             sqlite3_api->prepare_v2
+#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
+#define sqlite3_clear_bindings         sqlite3_api->clear_bindings
+#define sqlite3_bind_zeroblob          sqlite3_api->bind_zeroblob
+#define sqlite3_blob_bytes             sqlite3_api->blob_bytes
+#define sqlite3_blob_close             sqlite3_api->blob_close
+#define sqlite3_blob_open              sqlite3_api->blob_open
+#define sqlite3_blob_read              sqlite3_api->blob_read
+#define sqlite3_blob_write             sqlite3_api->blob_write
+#define sqlite3_create_collation_v2    sqlite3_api->create_collation_v2
+#define sqlite3_file_control           sqlite3_api->file_control
+#define sqlite3_memory_highwater       sqlite3_api->memory_highwater
+#define sqlite3_memory_used            sqlite3_api->memory_used
+#define sqlite3_mutex_alloc            sqlite3_api->mutex_alloc
+#define sqlite3_mutex_enter            sqlite3_api->mutex_enter
+#define sqlite3_mutex_free             sqlite3_api->mutex_free
+#define sqlite3_mutex_leave            sqlite3_api->mutex_leave
+#define sqlite3_mutex_try              sqlite3_api->mutex_try
+#define sqlite3_open_v2                sqlite3_api->open_v2
+#define sqlite3_release_memory         sqlite3_api->release_memory
+#define sqlite3_result_error_nomem     sqlite3_api->result_error_nomem
+#define sqlite3_result_error_toobig    sqlite3_api->result_error_toobig
+#define sqlite3_sleep                  sqlite3_api->sleep
+#define sqlite3_soft_heap_limit        sqlite3_api->soft_heap_limit
+#define sqlite3_vfs_find               sqlite3_api->vfs_find
+#define sqlite3_vfs_register           sqlite3_api->vfs_register
+#define sqlite3_vfs_unregister         sqlite3_api->vfs_unregister
+#define sqlite3_threadsafe             sqlite3_api->xthreadsafe
+#define sqlite3_result_zeroblob        sqlite3_api->result_zeroblob
+#define sqlite3_result_error_code      sqlite3_api->result_error_code
+#define sqlite3_test_control           sqlite3_api->test_control
+#define sqlite3_randomness             sqlite3_api->randomness
+#define sqlite3_context_db_handle      sqlite3_api->context_db_handle
+#define sqlite3_extended_result_codes  sqlite3_api->extended_result_codes
+#define sqlite3_limit                  sqlite3_api->limit
+#define sqlite3_next_stmt              sqlite3_api->next_stmt
+#define sqlite3_sql                    sqlite3_api->sql
+#define sqlite3_status                 sqlite3_api->status
+#define sqlite3_backup_finish          sqlite3_api->backup_finish
+#define sqlite3_backup_init            sqlite3_api->backup_init
+#define sqlite3_backup_pagecount       sqlite3_api->backup_pagecount
+#define sqlite3_backup_remaining       sqlite3_api->backup_remaining
+#define sqlite3_backup_step            sqlite3_api->backup_step
+#define sqlite3_compileoption_get      sqlite3_api->compileoption_get
+#define sqlite3_compileoption_used     sqlite3_api->compileoption_used
+#define sqlite3_create_function_v2     sqlite3_api->create_function_v2
+#define sqlite3_db_config              sqlite3_api->db_config
+#define sqlite3_db_mutex               sqlite3_api->db_mutex
+#define sqlite3_db_status              sqlite3_api->db_status
+#define sqlite3_extended_errcode       sqlite3_api->extended_errcode
+#define sqlite3_log                    sqlite3_api->log
+#define sqlite3_soft_heap_limit64      sqlite3_api->soft_heap_limit64
+#define sqlite3_sourceid               sqlite3_api->sourceid
+#define sqlite3_stmt_status            sqlite3_api->stmt_status
+#define sqlite3_strnicmp               sqlite3_api->strnicmp
+#define sqlite3_unlock_notify          sqlite3_api->unlock_notify
+#define sqlite3_wal_autocheckpoint     sqlite3_api->wal_autocheckpoint
+#define sqlite3_wal_checkpoint         sqlite3_api->wal_checkpoint
+#define sqlite3_wal_hook               sqlite3_api->wal_hook
+#define sqlite3_blob_reopen            sqlite3_api->blob_reopen
+#define sqlite3_vtab_config            sqlite3_api->vtab_config
+#define sqlite3_vtab_on_conflict       sqlite3_api->vtab_on_conflict
+/* Version 3.7.16 and later */
+#define sqlite3_close_v2               sqlite3_api->close_v2
+#define sqlite3_db_filename            sqlite3_api->db_filename
+#define sqlite3_db_readonly            sqlite3_api->db_readonly
+#define sqlite3_db_release_memory      sqlite3_api->db_release_memory
+#define sqlite3_errstr                 sqlite3_api->errstr
+#define sqlite3_stmt_busy              sqlite3_api->stmt_busy
+#define sqlite3_stmt_readonly          sqlite3_api->stmt_readonly
+#define sqlite3_stricmp                sqlite3_api->stricmp
+#define sqlite3_uri_boolean            sqlite3_api->uri_boolean
+#define sqlite3_uri_int64              sqlite3_api->uri_int64
+#define sqlite3_uri_parameter          sqlite3_api->uri_parameter
+#define sqlite3_uri_vsnprintf          sqlite3_api->vsnprintf
+#define sqlite3_wal_checkpoint_v2      sqlite3_api->wal_checkpoint_v2
+#endif /* SQLITE_CORE */
+
+#ifndef SQLITE_CORE
+  /* This case when the file really is being compiled as a loadable 
+  ** extension */
+# define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api=0;
+# define SQLITE_EXTENSION_INIT2(v)  sqlite3_api=v;
+# define SQLITE_EXTENSION_INIT3     \
+    extern const sqlite3_api_routines *sqlite3_api;
+#else
+  /* This case when the file is being statically linked into the 
+  ** application */
+# define SQLITE_EXTENSION_INIT1     /*no-op*/
+# define SQLITE_EXTENSION_INIT2(v)  (void)v; /* unused parameter */
+# define SQLITE_EXTENSION_INIT3     /*no-op*/
+#endif
+
+#endif /* _SQLITE3EXT_H_ */

Property changes on: lab4/.minix-src/include/sqlite3ext.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/stab.h
===================================================================
--- lab4/.minix-src/include/stab.h	(nonexistent)
+++ lab4/.minix-src/include/stab.h	(revision 13)
@@ -0,0 +1,70 @@
+/*	$NetBSD: stab.h,v 1.6 2003/08/07 09:44:11 agc Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)stab.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _STAB_H_
+#define _STAB_H_
+
+/*
+ * The following are symbols used by various debuggers and by the Pascal
+ * compiler.  Each of them must have one (or more) of the bits defined by
+ * the N_STAB mask set.
+ */
+
+#define	N_GSYM		0x20	/* global symbol */
+#define	N_FNAME		0x22	/* F77 function name */
+#define	N_FUN		0x24	/* procedure name */
+#define	N_STSYM		0x26	/* data segment variable */
+#define	N_LCSYM		0x28	/* bss segment variable */
+#define	N_MAIN		0x2a	/* main function name */
+#define	N_PC		0x30	/* global Pascal symbol */
+#define	N_RSYM		0x40	/* register variable */
+#define	N_SLINE		0x44	/* text segment line number */
+#define	N_DSLINE	0x46	/* data segment line number */
+#define	N_BSLINE	0x48	/* bss segment line number */
+#define	N_SSYM		0x60	/* structure/union element */
+#define	N_SO		0x64	/* main source file name */
+#define	N_LSYM		0x80	/* stack variable */
+#define	N_BINCL		0x82	/* include file beginning */
+#define	N_SOL		0x84	/* included source file name */
+#define	N_PSYM		0xa0	/* parameter variable */
+#define	N_EINCL		0xa2	/* include file end */
+#define	N_ENTRY		0xa4	/* alternate entry point */
+#define	N_LBRAC		0xc0	/* left bracket */
+#define	N_EXCL		0xc2	/* deleted include file */
+#define	N_RBRAC		0xe0	/* right bracket */
+#define	N_BCOMM		0xe2	/* begin common */
+#define	N_ECOMM		0xe4	/* end common */
+#define	N_ECOML		0xe8	/* end common (local name) */
+#define	N_LENG		0xfe	/* length of preceding entry */
+
+#endif /* !_STAB_H_ */

Property changes on: lab4/.minix-src/include/stab.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/termios.h
===================================================================
--- lab4/.minix-src/include/termios.h	(nonexistent)
+++ lab4/.minix-src/include/termios.h	(revision 13)
@@ -0,0 +1 @@
+sys/termios.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/termios.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/elf.h
===================================================================
--- lab4/.minix-src/include/elf.h	(nonexistent)
+++ lab4/.minix-src/include/elf.h	(revision 13)
@@ -0,0 +1 @@
+sys/exec_elf.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/elf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ucontext.h
===================================================================
--- lab4/.minix-src/include/ucontext.h	(nonexistent)
+++ lab4/.minix-src/include/ucontext.h	(revision 13)
@@ -0,0 +1,45 @@
+/*	$NetBSD: ucontext.h,v 1.7 2011/11/05 09:27:06 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _UCONTEXT_H_
+#define _UCONTEXT_H_
+
+#include <sys/cdefs.h>
+#include <sys/ucontext.h>
+
+__BEGIN_DECLS
+int	getcontext(ucontext_t *) __returns_twice;
+int	setcontext(const ucontext_t *);
+void	makecontext(ucontext_t *, void (*)(), int, ...);
+int	swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict);
+__END_DECLS
+
+#endif /* !_UCONTEXT_H_ */

Property changes on: lab4/.minix-src/include/ucontext.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/stddef.h
===================================================================
--- lab4/.minix-src/include/stddef.h	(nonexistent)
+++ lab4/.minix-src/include/stddef.h	(revision 13)
@@ -0,0 +1,70 @@
+/*	$NetBSD: stddef.h,v 1.17 2013/12/12 17:53:03 matt Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)stddef.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _STDDEF_H_
+#define _STDDEF_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <machine/ansi.h>
+
+#ifdef	_BSD_PTRDIFF_T_
+typedef	_BSD_PTRDIFF_T_	ptrdiff_t;
+#undef	_BSD_PTRDIFF_T_
+#endif
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
+typedef	_BSD_WCHAR_T_	wchar_t;
+#undef	_BSD_WCHAR_T_
+#endif
+
+#include <sys/null.h>
+
+#if __GNUC_PREREQ__(4, 0)
+#define	offsetof(type, member)	__builtin_offsetof(type, member)
+#elif !defined(__cplusplus)
+#define	offsetof(type, member)	((size_t)(unsigned long)(&((type *)0)->member))
+#else
+#if !__GNUC_PREREQ__(3, 4)
+#define __offsetof__(a) a
+#endif
+#define	offsetof(type, member) __offsetof__((reinterpret_cast<size_t> \
+    (&reinterpret_cast<const volatile char &>(static_cast<type *>(0)->member))))
+#endif  
+ 
+#endif /* _STDDEF_H_ */

Property changes on: lab4/.minix-src/include/stddef.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/stdint.h
===================================================================
--- lab4/.minix-src/include/stdint.h	(nonexistent)
+++ lab4/.minix-src/include/stdint.h	(revision 13)
@@ -0,0 +1 @@
+sys/stdint.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/stdint.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/evdns.h
===================================================================
--- lab4/.minix-src/include/evdns.h	(nonexistent)
+++ lab4/.minix-src/include/evdns.h	(revision 13)
@@ -0,0 +1,46 @@
+/*	$NetBSD: evdns.h,v 1.1.1.2 2013/04/11 16:43:28 christos Exp $	*/
+/*
+ * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVDNS_H_
+#define _EVDNS_H_
+
+/** @file evdns.h
+
+  A dns subsystem for Libevent.
+
+  The <evdns.h> header is deprecated in Libevent 2.0 and later; please
+  use <event2/evdns.h> instead.  Depending on what functionality you
+  need, you may also want to include more of the other <event2/...>
+  headers.
+ */
+
+#include <event.h>
+#include <event2/dns.h>
+#include <event2/dns_compat.h>
+#include <event2/dns_struct.h>
+
+#endif /* _EVDNS_H_ */

Property changes on: lab4/.minix-src/include/evdns.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/unistd.h
===================================================================
--- lab4/.minix-src/include/unistd.h	(nonexistent)
+++ lab4/.minix-src/include/unistd.h	(revision 13)
@@ -0,0 +1,435 @@
+/*	$NetBSD: unistd.h,v 1.145 2015/03/24 07:44:52 wiz Exp $	*/
+
+/*-
+ * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1991, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)unistd.h	8.12 (Berkeley) 4/27/95
+ */
+
+#ifndef _UNISTD_H_
+#define	_UNISTD_H_
+
+#include <machine/ansi.h>
+#include <machine/int_types.h>
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+#include <sys/unistd.h>
+
+#if _FORTIFY_SOURCE > 0
+#include <ssp/unistd.h>
+#endif
+
+/*
+ * IEEE Std 1003.1-90
+ */
+#define	STDIN_FILENO	0	/* standard input file descriptor */
+#define	STDOUT_FILENO	1	/* standard output file descriptor */
+#define	STDERR_FILENO	2	/* standard error file descriptor */
+
+#include <sys/null.h>
+
+__BEGIN_DECLS
+__dead	 void _exit(int);
+int	 access(const char *, int);
+unsigned int alarm(unsigned int);
+int	 chdir(const char *);
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
+int	chown(const char *, uid_t, gid_t) __RENAME(__posix_chown);
+#else
+int	chown(const char *, uid_t, gid_t);
+#endif /* defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) */
+int	 close(int);
+size_t	 confstr(int, char *, size_t);
+#ifndef __CUSERID_DECLARED
+#define __CUSERID_DECLARED
+/* also declared in stdio.h */
+char	*cuserid(char *);	/* obsolete */
+#endif /* __CUSERID_DECLARED */
+int	 dup(int);
+int	 dup2(int, int);
+int	 execl(const char *, const char *, ...);
+int	 execle(const char *, const char *, ...);
+int	 execlp(const char *, const char *, ...);
+int	 execv(const char *, char * const *);
+int	 execve(const char *, char * const *, char * const *);
+int	 execvp(const char *, char * const *);
+pid_t	 fork(void);
+long	 fpathconf(int, int);
+#if __SSP_FORTIFY_LEVEL == 0
+char	*getcwd(char *, size_t);
+#endif
+gid_t	 getegid(void);
+uid_t	 geteuid(void);
+gid_t	 getgid(void);
+int	 getgroups(int, gid_t []);
+__aconst char *getlogin(void);
+int	 getlogin_r(char *, size_t);
+pid_t	 getpgrp(void);
+pid_t	 getpid(void);
+pid_t	 getppid(void);
+uid_t	 getuid(void);
+int	 isatty(int);
+int	 link(const char *, const char *);
+long	 pathconf(const char *, int);
+int	 pause(void);
+int	 pipe(int *);
+#if __SSP_FORTIFY_LEVEL == 0
+ssize_t	 read(int, void *, size_t);
+#endif
+int	 rmdir(const char *);
+int	 setgid(gid_t);
+int	 setpgid(pid_t, pid_t);
+pid_t	 setsid(void);
+int	 setuid(uid_t);
+unsigned int	 sleep(unsigned int);
+long	 sysconf(int);
+pid_t	 tcgetpgrp(int);
+int	 tcsetpgrp(int, pid_t);
+__aconst char *ttyname(int);
+int	 unlink(const char *);
+ssize_t	 write(int, const void *, size_t);
+
+
+/*
+ * IEEE Std 1003.2-92, adopted in X/Open Portability Guide Issue 4 and later
+ */
+#if (_POSIX_C_SOURCE - 0) >= 2 || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+int	 getopt(int, char * const [], const char *);
+
+extern	 char *optarg;			/* getopt(3) external variables */
+extern	 int opterr;
+extern	 int optind;
+extern	 int optopt;
+#endif
+
+/*
+ * The Open Group Base Specifications, Issue 5; IEEE Std 1003.1-2001 (POSIX)
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#if __SSP_FORTIFY_LEVEL == 0
+ssize_t	 readlink(const char * __restrict, char * __restrict, size_t);
+#endif
+#endif
+
+/*
+ * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \
+    defined(_NETBSD_SOURCE)
+#if !defined(__minix)
+int	 posix_fallocate(int, off_t, off_t);
+#endif /* !defined(__minix) */
+int	 setegid(gid_t);
+int	 seteuid(uid_t);
+#endif
+
+/*
+ * The following three syscalls are also defined in <sys/types.h>
+ * We protect them against double declarations.
+ */
+#ifndef __OFF_T_SYSCALLS_DECLARED
+#define __OFF_T_SYSCALLS_DECLARED
+off_t	 lseek(int, off_t, int);
+int	 truncate(const char *, off_t);
+/*
+ * IEEE Std 1003.1b-93,
+ * also found in X/Open Portability Guide >= Issue 4 Verion 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199309L || \
+    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+int	 ftruncate(int, off_t);
+#endif
+#endif /* __OFF_T_SYSCALLS_DECLARED */
+
+
+/*
+ * IEEE Std 1003.1b-93, adopted in X/Open CAE Specification Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#if !defined(__minix)
+int	 fdatasync(int);
+#endif /* !defined(__minix) */
+int	 fsync(int);
+#endif
+
+
+/*
+ * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+int	 ttyname_r(int, char *, size_t);
+int	 pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
+#endif
+
+/*
+ * X/Open Portability Guide, all issues
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+int	 chroot(const char *);
+int	 nice(int);
+#endif
+
+
+/*
+ * X/Open Portability Guide >= Issue 4
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+__aconst char *crypt(const char *, const char *);
+int	 encrypt(char *, int);
+char	*getpass(const char *);
+pid_t	 getsid(pid_t);
+#endif
+
+
+/*
+ * X/Open Portability Guide >= Issue 4 Version 2
+ */
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+#ifndef	intptr_t
+typedef	__intptr_t	intptr_t;
+#define	intptr_t	__intptr_t
+#endif
+
+#define F_ULOCK		0
+#define F_LOCK		1
+#define F_TLOCK		2
+#define F_TEST		3
+
+int	 brk(void *);
+int	 fchdir(int);
+#if defined(_XOPEN_SOURCE)
+int	 fchown(int, uid_t, gid_t) __RENAME(__posix_fchown);
+#else
+int	 fchown(int, uid_t, gid_t);
+#endif
+int	 getdtablesize(void);
+long	 gethostid(void);
+int	 gethostname(char *, size_t);
+__pure int
+	 getpagesize(void);		/* legacy */
+#if !defined(__minix)
+pid_t	 getpgid(pid_t);
+#endif /* !defined(__minix) */
+#if defined(_XOPEN_SOURCE)
+int	 lchown(const char *, uid_t, gid_t) __RENAME(__posix_lchown);
+#else
+int	 lchown(const char *, uid_t, gid_t);
+#endif
+int	 lockf(int, int, off_t);
+#if __SSP_FORTIFY_LEVEL == 0
+ssize_t	 readlink(const char * __restrict, char * __restrict, size_t);
+#endif
+void	*sbrk(intptr_t);
+/* XXX prototype wrong! */
+int	 setpgrp(pid_t, pid_t);			/* obsoleted by setpgid() */
+#if !defined(__minix)
+int	 setregid(gid_t, gid_t);
+int	 setreuid(uid_t, uid_t);
+#endif /* !defined(__minix) */
+void	 swab(const void * __restrict, void * __restrict, ssize_t);
+int	 symlink(const char *, const char *);
+void	 sync(void);
+useconds_t ualarm(useconds_t, useconds_t);
+int	 usleep(useconds_t);
+#ifndef __LIBC12_SOURCE__
+pid_t	 vfork(void) __RENAME(__vfork14) __returns_twice;
+#endif
+
+#ifndef __AUDIT__
+char	*getwd(char *);				/* obsoleted by getcwd() */
+#endif
+#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+
+
+/*
+ * X/Open CAE Specification Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+ssize_t	 pread(int, void *, size_t, off_t);
+ssize_t	 pwrite(int, const void *, size_t, off_t);
+#endif /* (_POSIX_C_SOURCE - 0) >= 200112L || ... */
+
+/*
+ * X/Open Extended API set 2 (a.k.a. C063)
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0 >= 700) || \
+    defined(_INCOMPLETE_XOPEN_C063) || defined(_NETBSD_SOURCE)
+int	linkat(int, const char *, int, const char *, int);
+int	renameat(int, const char *, int, const char *);
+int	faccessat(int, const char *, int, int);
+int	fchownat(int, const char *, uid_t, gid_t, int);
+ssize_t	readlinkat(int, const char *, char *, size_t);
+int	symlinkat(const char *, int, const char *);
+int	unlinkat(int, const char *, int);
+#endif
+#if defined(_INCOMPLETE_XOPEN_C063)
+int	fexecve(int, char * const *, char * const *);
+#endif
+
+
+/*
+ * Implementation-defined extensions
+ */
+#if defined(_NETBSD_SOURCE)
+#if !defined(__minix)
+int	 acct(const char *);
+#endif /* !defined(__minix) */
+int	 closefrom(int);
+int	 des_cipher(const char *, char *, long, int);
+int	 des_setkey(const char *);
+int	 dup3(int, int, int);
+void	 endusershell(void);
+int	 exect(const char *, char * const *, char * const *);
+int	 execvpe(const char *, char * const *, char * const *);
+int	 execlpe(const char *, const char *, ...);
+int	 fchroot(int);
+#if !defined(__minix)
+int	 fdiscard(int, off_t, off_t);
+#endif /* !defined(__minix) */
+int	 fsync_range(int, int, off_t, off_t);
+int	 getdomainname(char *, size_t);
+int	 getgrouplist(const char *, gid_t, gid_t *, int *);
+int	 getgroupmembership(const char *, gid_t, gid_t *, int, int *);
+mode_t	 getmode(const void *, mode_t);
+char	*getpassfd(const char *, char *, size_t, int *, int, int);
+#define	GETPASS_NEED_TTY	0x001	/* Fail if we cannot set tty */
+#define	GETPASS_FAIL_EOF	0x002	/* Fail on EOF */
+#define	GETPASS_BUF_LIMIT	0x004	/* beep on buffer limit */
+#define	GETPASS_NO_SIGNAL	0x008	/* don't make ttychars send signals */
+#define	GETPASS_NO_BEEP		0x010	/* don't beep */
+#define	GETPASS_ECHO		0x020	/* echo characters as they are typed */
+#define	GETPASS_ECHO_STAR	0x040	/* echo '*' for each character */
+#define	GETPASS_7BIT		0x080	/* mask the high bit each char */
+#define	GETPASS_FORCE_LOWER	0x100	/* lowercase each char */
+#define	GETPASS_FORCE_UPPER	0x200	/* uppercase each char */
+#define	GETPASS_ECHO_NL		0x400	/* echo a newline if successful */
+
+char	*getpass_r(const char *, char *, size_t);
+int	 getpeereid(int, uid_t *, gid_t *);
+int	 getsubopt(char **, char * const *, char **);
+__aconst char *getusershell(void);
+int	 initgroups(const char *, gid_t);
+int	 iruserok(uint32_t, int, const char *, const char *);
+int      issetugid(void);
+int	 mkstemps(char *, int);
+int	 nfssvc(int, void *);
+int	 pipe2(int *, int);
+#if !defined(__minix)
+int	 profil(char *, size_t, u_long, u_int);
+#endif /* !defined(__minix) */
+#ifndef __PSIGNAL_DECLARED
+#define __PSIGNAL_DECLARED
+/* also in signal.h */
+void	 psignal(int, const char *);
+#endif /* __PSIGNAL_DECLARED */
+int	 rcmd(char **, int, const char *, const char *, const char *, int *);
+int	 reboot(int, char *);
+#if !defined(__minix)
+int	 revoke(const char *);
+#endif /* !defined(__minix) */
+int	 rresvport(int *);
+int	 ruserok(const char *, int, const char *, const char *);
+int	 setdomainname(const char *, size_t);
+int	 setgroups(int, const gid_t *);
+int	 sethostid(long);
+int	 sethostname(const char *, size_t);
+int	 setlogin(const char *);
+void	*setmode(const char *);
+int	 setrgid(gid_t);
+int	 setruid(uid_t);
+void	 setusershell(void);
+void	 strmode(mode_t, char *);
+#ifndef __STRSIGNAL_DECLARED
+#define __STRSIGNAL_DECLARED
+/* backwards-compatibility; also in string.h */
+__aconst char *strsignal(int);
+#endif /* __STRSIGNAL_DECLARED */
+#if !defined(__minix)
+int	 swapctl(int, void *, int);
+int	 swapon(const char *);			/* obsoleted by swapctl() */
+#endif /* !defined(__minix) */
+int	 syscall(int, ...);
+quad_t	 __syscall(quad_t, ...);
+int	 undelete(const char *);
+
+#if 1 /*INET6*/
+int	 rcmd_af(char **, int, const char *,
+	    const char *, const char *, int *, int);
+int	 rresvport_af(int *, int);
+int	 rresvport_af_addr(int *, int, void *);
+int	 iruserok_sa(const void *, int, int, const char *, const char *);
+#endif
+
+#ifndef __SYS_SIGLIST_DECLARED
+#define __SYS_SIGLIST_DECLARED
+/* also in signal.h */
+extern const char *const *sys_siglist __RENAME(__sys_siglist14);
+#endif /* __SYS_SIGLIST_DECLARED */
+extern	 int optreset;		/* getopt(3) external variable */
+extern	 char *suboptarg;	/* getsubopt(3) external variable */
+#endif
+
+__END_DECLS
+#endif /* !_UNISTD_H_ */

Property changes on: lab4/.minix-src/include/unistd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/string.h
===================================================================
--- lab4/.minix-src/include/string.h	(nonexistent)
+++ lab4/.minix-src/include/string.h	(revision 13)
@@ -0,0 +1,127 @@
+/*	$NetBSD: string.h,v 1.49 2014/09/24 18:16:36 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)string.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _STRING_H_
+#define	_STRING_H_
+#include <machine/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#include <sys/null.h>
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+__BEGIN_DECLS
+void	*memchr(const void *, int, size_t);
+int	 memcmp(const void *, const void *, size_t);
+void	*memcpy(void * __restrict, const void * __restrict, size_t);
+void	*memmove(void *, const void *, size_t);
+void	*memset(void *, int, size_t);
+char	*strcat(char * __restrict, const char * __restrict);
+char	*strchr(const char *, int);
+int	 strcmp(const char *, const char *);
+int	 strcoll(const char *, const char *);
+char	*strcpy(char * __restrict, const char * __restrict);
+size_t	 strcspn(const char *, const char *);
+__aconst char *strerror(int);
+size_t	 strlen(const char *);
+char	*strncat(char * __restrict, const char * __restrict, size_t);
+int	 strncmp(const char *, const char *, size_t);
+char	*strncpy(char * __restrict, const char * __restrict, size_t);
+char	*strpbrk(const char *, const char *);
+char	*strrchr(const char *, int);
+size_t	 strspn(const char *, const char *);
+char	*strstr(const char *, const char *);
+char	*strtok(char * __restrict, const char * __restrict);
+#if (_POSIX_C_SOURCE - 0 >= 199506L) || (_XOPEN_SOURCE - 0 >= 500) || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+char	*strtok_r(char *, const char *, char **);
+int	 strerror_r(int, char *, size_t);
+#endif /* _POSIX_C_SOURCE >= 199506 || XOPEN_SOURCE >= 500 || ... */
+size_t	 strxfrm(char * __restrict, const char * __restrict, size_t);
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+void	*memccpy(void *, const void *, int, size_t);
+char	*strdup(const char *);
+#endif
+
+#if (_POSIX_C_SOURCE - 0 >= 200809L) || (_XOPEN_SOURCE - 0 >= 700) || \
+    defined(_NETBSD_SOURCE)
+char	*stpcpy(char * __restrict, const char * __restrict);
+char	*stpncpy(char * __restrict, const char * __restrict, size_t);
+size_t	strnlen(const char *, size_t);
+#ifndef __STRSIGNAL_DECLARED
+#define __STRSIGNAL_DECLARED
+/* also in unistd.h */
+__aconst char *strsignal(int);
+#endif /* __STRSIGNAL_DECLARED */
+#endif
+__END_DECLS
+
+#if defined(_NETBSD_SOURCE)
+#include <strings.h>		/* for backwards-compatibilty */
+__BEGIN_DECLS
+void	*memmem(const void *, size_t, const void *, size_t);
+char	*strcasestr(const char *, const char *);
+size_t	 strlcat(char *, const char *, size_t);
+size_t	 strlcpy(char *, const char *, size_t);
+char	*strsep(char **, const char *);
+char	*stresep(char **, const char *, int);
+char	*strndup(const char *, size_t);
+char	*strnstr(const char *, const char *, size_t);
+void	*memrchr(const void *, int, size_t);
+void	*explicit_memset(void *, int, size_t);
+int	consttime_memequal(const void *, const void *, size_t);
+__END_DECLS
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+__BEGIN_DECLS
+int	 strcoll_l(const char *, const char *, locale_t);
+size_t	 strxfrm_l(char * __restrict, const char * __restrict, size_t, locale_t);
+__aconst char *strerror_l(int, locale_t);
+__END_DECLS
+#endif /* _POSIX_C_SOURCE || _NETBSD_SOURCE */
+
+#if _FORTIFY_SOURCE > 0
+#include <ssp/string.h>
+#endif
+#endif /* !defined(_STRING_H_) */

Property changes on: lab4/.minix-src/include/string.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/stringlist.h
===================================================================
--- lab4/.minix-src/include/stringlist.h	(nonexistent)
+++ lab4/.minix-src/include/stringlist.h	(revision 13)
@@ -0,0 +1,54 @@
+/*	$NetBSD: stringlist.h,v 1.7 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1994 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _STRINGLIST_H
+#define _STRINGLIST_H 
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+/*
+ * Simple string list
+ */
+typedef struct _stringlist {
+	char	**sl_str;
+	size_t	  sl_max;
+	size_t	  sl_cur;
+} StringList;
+
+__BEGIN_DECLS
+StringList 	*sl_init(void);
+int		 sl_add(StringList *, char *);
+void		 sl_free(StringList *, int);
+char 		*sl_find(StringList *, const char *);
+int		 sl_delete(StringList *, const char *, int);
+__END_DECLS
+
+#endif /* _STRINGLIST_H */

Property changes on: lab4/.minix-src/include/stringlist.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/evutil.h
===================================================================
--- lab4/.minix-src/include/evutil.h	(nonexistent)
+++ lab4/.minix-src/include/evutil.h	(revision 13)
@@ -0,0 +1,40 @@
+/*	$NetBSD: evutil.h,v 1.1.1.2 2013/04/11 16:43:29 christos Exp $	*/
+/*
+ * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#ifndef _EVUTIL_H_
+#define _EVUTIL_H_
+
+/** @file evutil.h
+
+  Utility and compatibility functions for Libevent.
+
+  The <evutil.h> header is deprecated in Libevent 2.0 and later; please
+  use <event2/util.h> instead.
+*/
+
+#include <event2/util.h>
+
+#endif /* _EVUTIL_H_ */

Property changes on: lab4/.minix-src/include/evutil.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sysexits.h
===================================================================
--- lab4/.minix-src/include/sysexits.h	(nonexistent)
+++ lab4/.minix-src/include/sysexits.h	(revision 13)
@@ -0,0 +1,118 @@
+/*	$NetBSD: sysexits.h,v 1.7 2005/09/30 20:56:19 rpaulo Exp $	*/
+
+/*
+ * Copyright (c) 1987, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)sysexits.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef	_SYSEXITS_H_
+#define	_SYSEXITS_H_
+
+/*
+ *  SYSEXITS.H -- Exit status codes for system programs.
+ *
+ *	This include file attempts to categorize possible error
+ *	exit statuses for system programs, notably delivermail
+ *	and the Berkeley network.
+ *
+ *	Error numbers begin at EX__BASE to reduce the possibility of
+ *	clashing with other exit statuses that random programs may
+ *	already return.  The meaning of the codes is approximately
+ *	as follows:
+ *
+ *	EX_USAGE -- The command was used incorrectly, e.g., with
+ *		the wrong number of arguments, a bad flag, a bad
+ *		syntax in a parameter, or whatever.
+ *	EX_DATAERR -- The input data was incorrect in some way.
+ *		This should only be used for user's data & not
+ *		system files.
+ *	EX_NOINPUT -- An input file (not a system file) did not
+ *		exist or was not readable.  This could also include
+ *		errors like "No message" to a mailer (if it cared
+ *		to catch it).
+ *	EX_NOUSER -- The user specified did not exist.  This might
+ *		be used for mail addresses or remote logins.
+ *	EX_NOHOST -- The host specified did not exist.  This is used
+ *		in mail addresses or network requests.
+ *	EX_UNAVAILABLE -- A service is unavailable.  This can occur
+ *		if a support program or file does not exist.  This
+ *		can also be used as a catchall message when something
+ *		you wanted to do doesn't work, but you don't know
+ *		why.
+ *	EX_SOFTWARE -- An internal software error has been detected.
+ *		This should be limited to non-operating system related
+ *		errors as possible.
+ *	EX_OSERR -- An operating system error has been detected.
+ *		This is intended to be used for such things as "cannot
+ *		fork", "cannot create pipe", or the like.  It includes
+ *		things like getuid returning a user that does not
+ *		exist in the passwd file.
+ *	EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
+ *		etc.) does not exist, cannot be opened, or has some
+ *		sort of error (e.g., syntax error).
+ *	EX_CANTCREAT -- A (user specified) output file cannot be
+ *		created.
+ *	EX_IOERR -- An error occurred while doing I/O on some file.
+ *	EX_TEMPFAIL -- temporary failure, indicating something that
+ *		is not really an error.  In sendmail, this means
+ *		that a mailer (e.g.) could not create a connection,
+ *		and the request should be reattempted later.
+ *	EX_PROTOCOL -- the remote system returned something that
+ *		was "not possible" during a protocol exchange.
+ *	EX_NOPERM -- You did not have sufficient permission to
+ *		perform the operation.  This is not intended for
+ *		file system problems, which should use NOINPUT or
+ *		CANTCREAT, but rather for higher level permissions.
+ *
+ *	Please update the sysexits(3) man page after adding more entries.
+ */
+
+#define EX_OK		0	/* successful termination */
+
+#define EX__BASE	64	/* base value for error messages */
+
+#define EX_USAGE	64	/* command line usage error */
+#define EX_DATAERR	65	/* data format error */
+#define EX_NOINPUT	66	/* cannot open input */
+#define EX_NOUSER	67	/* addressee unknown */
+#define EX_NOHOST	68	/* host name unknown */
+#define EX_UNAVAILABLE	69	/* service unavailable */
+#define EX_SOFTWARE	70	/* internal software error */
+#define EX_OSERR	71	/* system error (e.g., can't fork) */
+#define EX_OSFILE	72	/* critical OS file missing */
+#define EX_CANTCREAT	73	/* can't create (user) output file */
+#define EX_IOERR	74	/* input/output error */
+#define EX_TEMPFAIL	75	/* temp failure; user is invited to retry */
+#define EX_PROTOCOL	76	/* remote error in protocol */
+#define EX_NOPERM	77	/* permission denied */
+#define EX_CONFIG	78	/* configuration error */
+
+#define EX__MAX	78	/* maximum listed value */
+
+#endif /* !_SYSEXITS_H_ */

Property changes on: lab4/.minix-src/include/sysexits.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/syslog.h
===================================================================
--- lab4/.minix-src/include/syslog.h	(nonexistent)
+++ lab4/.minix-src/include/syslog.h	(revision 13)
@@ -0,0 +1 @@
+sys/syslog.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/syslog.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fcntl.h
===================================================================
--- lab4/.minix-src/include/fcntl.h	(nonexistent)
+++ lab4/.minix-src/include/fcntl.h	(revision 13)
@@ -0,0 +1 @@
+sys/fcntl.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/fcntl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/utmp.h
===================================================================
--- lab4/.minix-src/include/utmp.h	(nonexistent)
+++ lab4/.minix-src/include/utmp.h	(revision 13)
@@ -0,0 +1,72 @@
+/*	$NetBSD: utmp.h,v 1.12 2009/01/11 03:04:12 christos Exp $	*/
+
+/*
+ * Copyright (c) 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)utmp.h	8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef	_UTMP_H_
+#define	_UTMP_H_
+
+#define	_PATH_UTMP	"/var/run/utmp"
+#define	_PATH_WTMP	"/var/log/wtmp"
+#define	_PATH_LASTLOG	"/var/log/lastlog"
+
+#define	UT_NAMESIZE	8
+#define	UT_LINESIZE	8
+#define	UT_HOSTSIZE	16
+
+struct lastlog {
+	time_t	ll_time;
+	char	ll_line[UT_LINESIZE];
+	char	ll_host[UT_HOSTSIZE];
+};
+
+struct utmp {
+	char	ut_line[UT_LINESIZE];
+	char	ut_name[UT_NAMESIZE];
+	char	ut_host[UT_HOSTSIZE];
+	time_t	ut_time;
+};
+
+__BEGIN_DECLS
+int utmpname(const char *);
+void setutent(void);
+#ifndef __LIBC12_SOURCE__
+struct utmp *getutent(void) __RENAME(__getutent50);
+#endif
+void endutent(void);
+__END_DECLS
+
+#endif /* !_UTMP_H_ */

Property changes on: lab4/.minix-src/include/utmp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/termcap.h
===================================================================
--- lab4/.minix-src/include/termcap.h	(nonexistent)
+++ lab4/.minix-src/include/termcap.h	(revision 13)
@@ -0,0 +1,54 @@
+/* $NetBSD: termcap.h,v 1.2 2011/04/11 21:13:09 roy Exp $ */
+
+/*
+ * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Roy Marples.
+ *
+ * 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.
+ */
+
+#ifndef _TERMCAP_H_
+#define	_TERMCAP_H_
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+/* Output functions.
+ * These are still valid for terminfo. */
+int		putp(const char *);
+int		tputs(const char *, int, int (*)(int));
+
+extern short ospeed;
+extern char PC;
+extern char *BC;
+extern char *UP;
+
+int		tgetent(char *, const char *);
+char *		tgetstr(const char *, char **);
+int		tgetflag(const char *);
+int		tgetnum(const char *);
+char *		tgoto(const char *, int, int);
+
+__END_DECLS
+#endif

Property changes on: lab4/.minix-src/include/termcap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/vis.h
===================================================================
--- lab4/.minix-src/include/vis.h	(nonexistent)
+++ lab4/.minix-src/include/vis.h	(revision 13)
@@ -0,0 +1,119 @@
+/*	$NetBSD: vis.h,v 1.23 2015/05/23 11:48:31 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vis.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _VIS_H_
+#define	_VIS_H_
+
+#include <sys/types.h>
+
+/*
+ * to select alternate encoding format
+ */
+#define	VIS_OCTAL	0x0001	/* use octal \ddd format */
+#define	VIS_CSTYLE	0x0002	/* use \[nrft0..] where appropiate */
+
+/*
+ * to alter set of characters encoded (default is to encode all
+ * non-graphic except space, tab, and newline).
+ */
+#define	VIS_SP		0x0004	/* also encode space */
+#define	VIS_TAB		0x0008	/* also encode tab */
+#define	VIS_NL		0x0010	/* also encode newline */
+#define	VIS_WHITE	(VIS_SP | VIS_TAB | VIS_NL)
+#define	VIS_SAFE	0x0020	/* only encode "unsafe" characters */
+
+/*
+ * other
+ */
+#define	VIS_NOSLASH	0x0040	/* inhibit printing '\' */
+#define	VIS_HTTP1808	0x0080	/* http-style escape % hex hex */
+#define	VIS_HTTPSTYLE	0x0080	/* http-style escape % hex hex */
+#define	VIS_MIMESTYLE	0x0100	/* mime-style escape = HEX HEX */
+#define	VIS_HTTP1866	0x0200	/* http-style &#num; or &string; */
+#define	VIS_NOESCAPE	0x0400	/* don't decode `\' */
+#define	_VIS_END	0x0800	/* for unvis */
+#define	VIS_GLOB	0x1000	/* encode glob(3) magic characters */
+#define	VIS_SHELL	0x2000	/* encode shell special characters [not glob] */
+#define	VIS_META	(VIS_WHITE | VIS_GLOB | VIS_SHELL)
+#define	VIS_NOLOCALE	0x4000	/* encode using the C locale */
+
+/*
+ * unvis return codes
+ */
+#define	UNVIS_VALID	 1	/* character valid */
+#define	UNVIS_VALIDPUSH	 2	/* character valid, push back passed char */
+#define	UNVIS_NOCHAR	 3	/* valid sequence, no character produced */
+#define	UNVIS_SYNBAD	-1	/* unrecognized escape sequence */
+#define	UNVIS_ERROR	-2	/* decoder in unknown state (unrecoverable) */
+
+/*
+ * unvis flags
+ */
+#define	UNVIS_END	_VIS_END	/* no more characters */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+char	*vis(char *, int, int, int);
+char	*nvis(char *, size_t, int, int, int);
+
+char	*svis(char *, int, int, int, const char *);
+char	*snvis(char *, size_t, int, int, int, const char *);
+
+int	strvis(char *, const char *, int);
+int	strnvis(char *, size_t, const char *, int);
+
+int	strsvis(char *, const char *, int, const char *);
+int	strsnvis(char *, size_t, const char *, int, const char *);
+
+int	strvisx(char *, const char *, size_t, int);
+int	strnvisx(char *, size_t, const char *, size_t, int);
+int 	strenvisx(char *, size_t, const char *, size_t, int, int *);
+
+int	strsvisx(char *, const char *, size_t, int, const char *);
+int	strsnvisx(char *, size_t, const char *, size_t, int, const char *);
+int	strsenvisx(char *, size_t, const char *, size_t , int, const char *,
+    int *);
+
+int	strunvis(char *, const char *);
+int	strnunvis(char *, size_t, const char *);
+
+int	strunvisx(char *, const char *, int);
+int	strnunvisx(char *, size_t, const char *, int);
+
+#ifndef __LIBC12_SOURCE__
+int	unvis(char *, int, int *, int) __RENAME(__unvis50);
+#endif
+__END_DECLS
+
+#endif /* !_VIS_H_ */

Property changes on: lab4/.minix-src/include/vis.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fmtmsg.h
===================================================================
--- lab4/.minix-src/include/fmtmsg.h	(nonexistent)
+++ lab4/.minix-src/include/fmtmsg.h	(revision 13)
@@ -0,0 +1,81 @@
+/*	$NetBSD: fmtmsg.h,v 1.3 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _FMTMSG_H_
+#define _FMTMSG_H_
+
+/* Major Classifications: identifies the source of the condition. */
+#define MM_HARD		0x01L	/* Hardware */
+#define MM_SOFT		0x02L	/* Software */
+#define MM_FIRM		0x03L	/* Firmware */
+
+/* Message Source Subclassifications: type of software. */
+#define MM_APPL		0x04L	/* Application */
+#define MM_UTIL		0x08L	/* Utility */
+#define MM_OPSYS	0x0cL	/* Operating system */
+
+/* Display Subclassifications: where to display the message. */
+#define MM_PRINT	0x10L	/* Display on standard error */
+#define MM_CONSOLE	0x20L	/* Display on system console */
+
+/* Status subclassifications: whether the application will recover. */
+#define MM_RECOVER	0x40L	/* Recoverable */
+#define MM_NRECOV	0x80L	/* Non-recoverable */
+
+/* Severity: seriousness of the condition. */
+#define MM_NOSEV	0	/* No severity level provided */
+#define MM_HALT		1	/* Error causing application to halt */
+#define MM_ERROR	2	/* Encountered a non-fatal fault */
+#define MM_WARNING	3	/* Unusual non-error condition */
+#define MM_INFO		4	/* Informative message */
+
+/* `Null' values for message components. */
+#define MM_NULLMC	0L		/* `Null' classsification component */
+#define MM_NULLLBL	(char *)0	/* `Null' label component */
+#define MM_NULLSEV	0		/* `Null' severity component */
+#define MM_NULLTXT	(char *)0	/* `Null' text component */
+#define MM_NULLACT	(char *)0	/* `Null' action component */
+#define MM_NULLTAG	(char *)0	/* `Null' tag component */
+
+/* Return values for fmtmsg(). */
+#define MM_OK		0	/* Function succeeded */
+#define MM_NOTOK	(-1)	/* Function failed completely */
+#define MM_NOMSG	0x01	/* Unable to perform MM_PRINT */
+#define MM_NOCON	0x02	/* Unable to perform MM_CONSOLE */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	fmtmsg(long, const char *, int, const char *, const char *,
+	    const char *);
+__END_DECLS
+
+#endif /* !_FMTMSG_H_ */

Property changes on: lab4/.minix-src/include/fmtmsg.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/term.h
===================================================================
--- lab4/.minix-src/include/term.h	(nonexistent)
+++ lab4/.minix-src/include/term.h	(revision 13)
@@ -0,0 +1,2005 @@
+/* $NetBSD: term.h,v 1.16 2013/06/07 13:16:18 roy Exp $ */
+
+/*
+ * Copyright (c) 2009, 2010, 2011, 2013 The NetBSD Foundation, Inc.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Roy Marples.
+ *
+ * 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.
+ */
+
+#ifndef _TERM_H_
+#define	_TERM_H_
+
+#ifndef ERR
+#define	ERR	(-1)	/* Error return */
+#define	OK	(0)	/* Success return */
+#endif
+
+/* Define available terminfo flags */
+enum TIFLAGS {
+	TICODE_bw,
+	TICODE_am,
+	TICODE_bce,
+	TICODE_ccc,
+	TICODE_xhp,
+	TICODE_xhpa,
+	TICODE_cpix,
+	TICODE_crxm,
+	TICODE_xt,
+	TICODE_xenl,
+	TICODE_eo,
+	TICODE_gn,
+	TICODE_hc,
+	TICODE_chts,
+	TICODE_km,
+	TICODE_daisy,
+	TICODE_hs,
+	TICODE_hls,
+	TICODE_in,
+	TICODE_lpix,
+	TICODE_da,
+	TICODE_db,
+	TICODE_mir,
+	TICODE_msgr,
+	TICODE_nxon,
+	TICODE_xsb,
+	TICODE_npc,
+	TICODE_ndscr,
+	TICODE_nrrmc,
+	TICODE_os,
+	TICODE_mc5i,
+	TICODE_xvpa,
+	TICODE_sam,
+	TICODE_eslok,
+	TICODE_hz,
+	TICODE_ul,
+	TICODE_xon
+};
+#define TIFLAGMAX	TICODE_xon
+
+#define t_auto_left_margin(t)		(t)->flags[TICODE_bw]
+#define t_auto_right_margin(t)		(t)->flags[TICODE_am]
+#define t_back_color_erase(t)		(t)->flags[TICODE_bce]
+#define t_can_change(t)			(t)->flags[TICODE_ccc]
+#define t_ceol_standout_glitch(t)	(t)->flags[TICODE_xhp]
+#define t_col_addr_glitch(t)		(t)->flags[TICODE_xhpa]
+#define t_cpi_changes_res(t)		(t)->flags[TICODE_cpix]
+#define t_cr_cancels_micro_mode(t)	(t)->flags[TICODE_crxm]
+#define t_dest_tabs_magic_smso(t)	(t)->flags[TICODE_xt]
+#define t_eat_newline_glitch(t)		(t)->flags[TICODE_xenl]
+#define t_erase_overstrike(t)		(t)->flags[TICODE_eo]
+#define t_generic_type(t)		(t)->flags[TICODE_gn]
+#define t_hard_copy(t)			(t)->flags[TICODE_hc]
+#define t_hard_cursor(t)		(t)->flags[TICODE_chts]
+#define t_has_meta_key(t)		(t)->flags[TICODE_km]
+#define t_has_print_wheel(t)		(t)->flags[TICODE_daisy]
+#define t_has_status_line(t)		(t)->flags[TICODE_hs]
+#define t_hue_light_saturation(t)	(t)->flags[TICODE_hls]
+#define t_insert_null_glitch(t)		(t)->flags[TICODE_in]
+#define t_lpi_changes_yes(t)		(t)->flags[TICODE_lpix]
+#define t_memory_above(t)		(t)->flags[TICODE_da]
+#define t_memory_below(t)		(t)->flags[TICODE_db]
+#define t_move_insert_mode(t)		(t)->flags[TICODE_mir]
+#define t_move_standout_mode(t)		(t)->flags[TICODE_msgr]
+#define t_needs_xon_xoff(t)		(t)->flags[TICODE_nxon]
+#define t_no_esc_ctlc(t)		(t)->flags[TICODE_xsb]
+#define t_no_pad_char(t)		(t)->flags[TICODE_npc]
+#define t_non_dest_scroll_region(t)	(t)->flags[TICODE_ndscr]
+#define t_non_rev_rmcup(t)		(t)->flags[TICODE_nrrmc]
+#define t_over_strike(t)		(t)->flags[TICODE_os]
+#define t_prtr_silent(t)		(t)->flags[TICODE_mc5i]
+#define t_row_addr_glitch(t)		(t)->flags[TICODE_xvpa]
+#define t_semi_auto_right_margin(t)	(t)->flags[TICODE_sam]
+#define t_status_line_esc_ok(t)		(t)->flags[TICODE_eslok]
+#define t_tilde_glitch(t)		(t)->flags[TICODE_hz]
+#define t_transparent_underline(t)	(t)->flags[TICODE_ul]
+#define t_xon_xoff(t)			(t)->flags[TICODE_xon]
+
+#define auto_left_margin		t_auto_left_margin(cur_term)
+#define auto_right_margin		t_auto_right_margin(cur_term)
+#define back_color_erase		t_back_color_erase(cur_term)
+#define can_change			t_can_change(cur_term)
+#define ceol_standout_glitch		t_ceol_standout_glitch(cur_term)
+#define col_addr_glitch			t_col_addr_glitch(cur_term)
+#define cpi_changes_res			t_cpi_changes_res(cur_term)
+#define cr_cancels_micro_mode		t_cr_cancels_micro_mode(cur_term)
+#define dest_tabs_magic_smso		t_dest_tabs_magic_smso(cur_term)
+#define eat_newline_glitch		t_eat_newline_glitch(cur_term)
+#define erase_overstrike		t_erase_overstrike(cur_term)
+#define generic_type			t_generic_type(cur_term)
+#define hard_copy			t_hard_copy(cur_term)
+#define hard_cursor			t_hard_cursor(cur_term)
+#define has_meta_key			t_has_meta_key(cur_term)
+#define has_print_wheel			t_has_print_wheel(cur_term)
+#define has_status_line			t_has_status_line(cur_term)
+#define hue_light_saturation		t_hue_light_saturation(cur_term)
+#define insert_null_glitch		t_insert_null_glitch(cur_term)
+#define lpi_changes_yes			t_lpi_changes_yes(cur_term)
+#define memory_above			t_memory_above(cur_term)
+#define memory_below			t_memory_below(cur_term)
+#define move_insert_mode		t_move_insert_mode(cur_term)
+#define move_standout_mode		t_move_standout_mode(cur_term)
+#define needs_xon_xoff			t_needs_xon_xoff(cur_term)
+#define no_esc_ctlc			t_no_esc_ctlc(cur_term)
+#define no_pad_char			t_no_pad_char(cur_term)
+#define non_dest_scroll_region		t_non_dest_scroll_region(cur_term)
+#define non_rev_rmcup			t_non_rev_rmcup(cur_term)
+#define over_strike			t_over_strike(cur_term)
+#define prtr_silent			t_prtr_silent(cur_term)
+#define row_addr_glitch			t_row_addr_glitch(cur_term)
+#define semi_auto_right_margin		t_semi_auto_right_margin(cur_term)
+#define status_line_esc_ok		t_status_line_esc_ok(cur_term)
+#define tilde_glitch			t_tilde_glitch(cur_term)
+#define transparent_underline		t_transparent_underline(cur_term)
+#define xon_xoff			t_xon_xoff(cur_term)
+
+/*
+ * BOOLEAN DESCRIPTIONS
+ *
+ * auto_left_margin: cub1 wraps from column 0 to last column
+ * auto_right_margin: Terminal has automatic margins
+ * back_color_erase: Screen erased with background colour
+ * can_change: Terminal can re-define existing colour
+ * ceol_standout_glitch: Standout not erased by overwriting (hp)
+ * col_addr_glitch: Only positive motion for hpa/mhba caps
+ * cpi_changes_res: Changing character pitch changes resolution
+ * cr_cancels_micro_mode: Using cr turns off micro mode
+ * dest_tabs_magic_smso: Destructive tabs, magic smso char (t1061)
+ * eat_newline_glitch: Newline ignored after 80 columns (Concept)
+ * erase_overstrike: Can erase overstrikes with a blank line
+ * generic_type: Generic line type (e.g. dialup, switch)
+ * hard_copy: Hardcopy terminal
+ * hard_cursor: Cursor is hard to see
+ * has_meta_key: Has a meta key (shift, sets parity bit)
+ * has_print_wheel: Printer needs operator to change character set
+ * has_status_line: Has extra "status line"
+ * hue_light_saturation: Terminal only uses HLS colour notion (Tektronix)
+ * insert_null_glitch: Insert mode distinguishes nulls
+ * lpi_changes_yes: Changing line pitch changes resolution
+ * memory_above: Display may be retained above the screen
+ * memory_below: Display may be retained below the screen
+ * move_insert_mode: Safe to move while in insert mode
+ * move_standout_mode: Safe to move in standout modes
+ * needs_xon_xoff: Padding won't work, xon/xoff required
+ * no_esc_ctlc: Beehive (f1=escape, f2=ctrl C)
+ * no_pad_char: Pad character doesn't exist
+ * non_dest_scroll_region: Scrolling region is nondestructive
+ * non_rev_rmcup: smcup does not reverse rmcup
+ * over_strike: Terminal overstrikes on hard-copy terminal
+ * prtr_silent: Printer won't echo on screen
+ * row_addr_glitch: Only positive motion for vpa/mvpa caps
+ * semi_auto_right_margin: Printing in last column causes cr
+ * status_line_esc_ok: Escape can be used on the status line
+ * tilde_glitch: Hazeltine; can't print tilde (~)
+ * transparent_underline: Underline character overstrikes
+ * xon_xoff: Terminal uses xon/xoff handshaking
+*/
+
+/* Define available terminfo numbers */
+enum TINUMS {
+	TICODE_bitwin,
+	TICODE_bitype,
+	TICODE_bufsz,
+	TICODE_btns,
+	TICODE_cols,
+	TICODE_spinh,
+	TICODE_spinv,
+	TICODE_it,
+	TICODE_lh,
+	TICODE_lw,
+	TICODE_lines,
+	TICODE_lm,
+	TICODE_ma,
+	TICODE_xmc,
+	TICODE_colors,
+	TICODE_maddr,
+	TICODE_mjump,
+	TICODE_pairs,
+	TICODE_wnum,
+	TICODE_mcs,
+	TICODE_mls,
+	TICODE_ncv,
+	TICODE_nlab,
+	TICODE_npins,
+	TICODE_orc,
+	TICODE_orl,
+	TICODE_orhi,
+	TICODE_orvi,
+	TICODE_pb,
+	TICODE_cps,
+	TICODE_vt,
+	TICODE_widcs,
+	TICODE_wsl
+};
+#define TINUMMAX			TICODE_wsl
+
+#define t_bit_image_entwining(t)	(t)->nums[TICODE_bitwin]
+#define t_bit_image_type(t)		(t)->nums[TICODE_bitype]
+#define t_buffer_capacity(t)		(t)->nums[TICODE_bufsz]
+#define t_buttons(t)			(t)->nums[TICODE_btns]
+#define t_columns(t)			(t)->nums[TICODE_cols]
+#define t_dot_horz_spacing(t)		(t)->nums[TICODE_spinh]
+#define t_dot_vert_spacing(t)		(t)->nums[TICODE_spinv]
+#define t_init_tabs(t)			(t)->nums[TICODE_it]
+#define t_label_height(t)		(t)->nums[TICODE_lh]
+#define t_label_width(t)		(t)->nums[TICODE_lw]
+#define t_lines(t)			(t)->nums[TICODE_lines]
+#define t_lines_of_memory(t)		(t)->nums[TICODE_lm]
+#define t_max_attributes(t)		(t)->nums[TICODE_ma]
+#define t_magic_cookie_glitch(t)	(t)->nums[TICODE_xmc]
+#define t_max_colors(t)			(t)->nums[TICODE_colors]
+#define t_max_micro_address(t)		(t)->nums[TICODE_maddr]
+#define t_max_micro_jump(t)		(t)->nums[TICODE_mjump]
+#define t_max_pairs(t)			(t)->nums[TICODE_pairs]
+#define t_maximum_windows(t)		(t)->nums[TICODE_wnum]
+#define t_micro_col_size(t)		(t)->nums[TICODE_mcs]
+#define t_micro_line_size(t)		(t)->nums[TICODE_mls]
+#define t_no_color_video(t)		(t)->nums[TICODE_ncv]
+#define t_num_labels(t)			(t)->nums[TICODE_nlab]
+#define t_number_of_pins(t)		(t)->nums[TICODE_npins]
+#define t_output_res_char(t)		(t)->nums[TICODE_orc]
+#define t_output_res_line(t)		(t)->nums[TICODE_orl]
+#define t_output_res_horz_inch(t)	(t)->nums[TICODE_orhi]
+#define t_output_res_vert_inch(t)	(t)->nums[TICODE_orvi]
+#define t_padding_baud_rate(t)		(t)->nums[TICODE_pb]
+#define t_print_rate(t)			(t)->nums[TICODE_cps]
+#define t_virtual_terminal(t)		(t)->nums[TICODE_vt]
+#define t_wide_char_size(t)		(t)->nums[TICODE_widcs]
+#define t_width_status_line(t)		(t)->nums[TICODE_wsl]
+
+#define bit_image_entwining		 t_bit_image_entwining(cur_term)
+#define bit_image_type			 t_bit_image_type(cur_term)
+#define buffer_capacity			 t_buffer_capacity(cur_term)
+#define buttons				 t_buttons(cur_term)
+#define columns				 t_columns(cur_term)
+#define dot_horz_spacing		 t_dot_horz_spacing(cur_term)
+#define dot_vert_spacing		 t_dot_vert_spacing(cur_term)
+#define init_tabs			 t_init_tabs(cur_term)
+#define label_height			 t_label_height(cur_term)
+#define label_width			 t_label_width(cur_term)
+#define lines				 t_lines(cur_term)
+#define lines_of_memory			 t_lines_of_memory(cur_term)
+#define max_attributes			 t_max_attributes(cur_term)
+#define magic_cookie_glitch		 t_magic_cookie_glitch(cur_term)
+#define max_colors			 t_max_colors(cur_term)
+#define max_micro_address		 t_max_micro_address(cur_term)
+#define max_micro_jump			 t_max_micro_jump(cur_term)
+#define max_pairs			 t_max_pairs(cur_term)
+#define maximum_windows			 t_maximum_windows(cur_term)
+#define micro_col_size			 t_micro_col_size(cur_term)
+#define micro_line_size			 t_micro_line_size(cur_term)
+#define no_color_video			 t_no_color_video(cur_term)
+#define num_labels			 t_num_labels(cur_term)
+#define number_of_pins			 t_number_of_pins(cur_term)
+#define output_res_char			 t_output_res_char(cur_term)
+#define output_res_line			 t_output_res_line(cur_term)
+#define output_res_horz_inch		 t_output_res_horz_inch(cur_term)
+#define output_res_vert_inch		 t_output_res_vert_inch(cur_term)
+#define padding_baud_rate		 t_padding_baud_rate(cur_term)
+#define print_rate			 t_print_rate(cur_term)
+#define virtual_terminal		 t_virtual_terminal(cur_term)
+#define wide_char_size			 t_wide_char_size(cur_term)
+#define width_status_line		 t_width_status_line(cur_term)
+
+/*
+ * NUMBER DESCRIPTIONS
+ *
+ * bit_image_entwining: Number of passes for each bit-map row
+ * bit_image_type: Type of bit image device
+ * buffer_capacity: Number of bytes buffered before printing
+ * buttons: Number of buttons on the mouse
+ * columns: Number of columns in a line
+ * dot_horz_spacing: Spacing of dots horizontally in dots per inch
+ * dot_vert_spacing: Spacing of pins vertically in pins per inch
+ * init_tabs: Tabs initially every #1 spaces
+ * label_height: Number of rows in each label
+ * label_width: Numbre of columns in each label
+ * lines: Number of lines on a screen or a page
+ * lines_of_memory: Lines of memory of > lines; 0 means varies
+ * max_attributes: Maximum combined video attributes terminal can display
+ * magic_cookie_glitch: Number of blank characters left by smso or rmso
+ * max_colors: Maximum number of colours on the screen
+ * max_micro_address: Maximum value in micro_..._addresss
+ * max_micro_jump: Maximum value in parm_..._micro
+ * max_pairs: Maximum number of colour-pairs on the screen
+ * maximum_windows: Maximum number of definable windows
+ * micro_col_size: Character step size when in micro mode
+ * micro_line_size: Line step size when in micro mode
+ * no_color_video: Video attributes that can't be used with colours
+ * num_labels: Number of labels on screen (start at 1)
+ * number_of_pins: Number of pins in print-head
+ * output_res_char: Horizontal resolution in units per character
+ * output_res_line: Vertical resolution in units per line
+ * output_res_horz_inch: Horizontal resolution in units per inch
+ * output_res_vert_inch: Vertical resolution in units per inch
+ * padding_baud_rate: Lowest baud rate where padding needed
+ * print_rate: Print rate in characters per second
+ * virtual_terminal: Virtual terminal number
+ * wide_char_size: Character step size when in double-wide mode
+ * width_status_line: Number of columns in status line
+ */
+
+/* Define available terminfo strings */
+enum TISTRS{
+	TICODE_acsc,
+	TICODE_scesa,
+	TICODE_cbt,
+	TICODE_bel,
+	TICODE_bicr,
+	TICODE_binel,
+	TICODE_birep,
+	TICODE_cr,
+	TICODE_cpi,
+	TICODE_lpi,
+	TICODE_chr,
+	TICODE_cvr,
+	TICODE_csr,
+	TICODE_rmp,
+	TICODE_csnm,
+	TICODE_tbc,
+	TICODE_mgc,
+	TICODE_clear,
+	TICODE_el1,
+	TICODE_el,
+	TICODE_ed,
+	TICODE_csin,
+	TICODE_colornm,
+	TICODE_hpa,
+	TICODE_cmdch,
+	TICODE_cwin,
+	TICODE_cup,
+	TICODE_cud1,
+	TICODE_home,
+	TICODE_civis,
+	TICODE_cub1,
+	TICODE_mrcup,
+	TICODE_cnorm,
+	TICODE_cuf1,
+	TICODE_ll,
+	TICODE_cuu1,
+	TICODE_cvvis,
+	TICODE_defbi,
+	TICODE_defc,
+	TICODE_dch1,
+	TICODE_dl1,
+	TICODE_devt,
+	TICODE_dial,
+	TICODE_dsl,
+	TICODE_dclk,
+	TICODE_dispc,
+	TICODE_hd,
+	TICODE_enacs,
+	TICODE_endbi,
+	TICODE_smacs,
+	TICODE_smam,
+	TICODE_blink,
+	TICODE_bold,
+	TICODE_smcup,
+	TICODE_smdc,
+	TICODE_dim,
+	TICODE_swidm,
+	TICODE_sdrfq,
+	TICODE_ehhlm,
+	TICODE_smir,
+	TICODE_sitm,
+	TICODE_elhlm,
+	TICODE_slm,
+	TICODE_elohlm,
+	TICODE_smicm,
+	TICODE_snlq,
+	TICODE_snrmq,
+	TICODE_smpch,
+	TICODE_prot,
+	TICODE_rev,
+	TICODE_erhlm,
+	TICODE_smsc,
+	TICODE_invis,
+	TICODE_sshm,
+	TICODE_smso,
+	TICODE_ssubm,
+	TICODE_ssupm,
+	TICODE_ethlm,
+	TICODE_smul,
+	TICODE_sum,
+	TICODE_evhlm,
+	TICODE_smxon,
+	TICODE_ech,
+	TICODE_rmacs,
+	TICODE_rmam,
+	TICODE_sgr0,
+	TICODE_rmcup,
+	TICODE_rmdc,
+	TICODE_rwidm,
+	TICODE_rmir,
+	TICODE_ritm,
+	TICODE_rlm,
+	TICODE_rmicm,
+	TICODE_rmpch,
+	TICODE_rmsc,
+	TICODE_rshm,
+	TICODE_rmso,
+	TICODE_rsubm,
+	TICODE_rsupm,
+	TICODE_rmul,
+	TICODE_rum,
+	TICODE_rmxon,
+	TICODE_pause,
+	TICODE_hook,
+	TICODE_flash,
+	TICODE_ff,
+	TICODE_fsl,
+	TICODE_getm,
+	TICODE_wingo,
+	TICODE_hup,
+	TICODE_is1,
+	TICODE_is2,
+	TICODE_is3,
+	TICODE_if,
+	TICODE_iprog,
+	TICODE_initc,
+	TICODE_initp,
+	TICODE_ich1,
+	TICODE_il1,
+	TICODE_ip,
+	TICODE_ka1,
+	TICODE_ka3,
+	TICODE_kb2,
+	TICODE_kbs,
+	TICODE_kbeg,
+	TICODE_kcbt,
+	TICODE_kc1,
+	TICODE_kc3,
+	TICODE_kcan,
+	TICODE_ktbc,
+	TICODE_kclr,
+	TICODE_kclo,
+	TICODE_kcmd,
+	TICODE_kcpy,
+	TICODE_kcrt,
+	TICODE_kctab,
+	TICODE_kdch1,
+	TICODE_kdl1,
+	TICODE_kcud1,
+	TICODE_krmir,
+	TICODE_kend,
+	TICODE_kent,
+	TICODE_kel,
+	TICODE_ked,
+	TICODE_kext,
+	TICODE_kf0,
+	TICODE_kf1,
+	TICODE_kf2,
+	TICODE_kf3,
+	TICODE_kf4,
+	TICODE_kf5,
+	TICODE_kf6,
+	TICODE_kf7,
+	TICODE_kf8,
+	TICODE_kf9,
+	TICODE_kf10,
+	TICODE_kf11,
+	TICODE_kf12,
+	TICODE_kf13,
+	TICODE_kf14,
+	TICODE_kf15,
+	TICODE_kf16,
+	TICODE_kf17,
+	TICODE_kf18,
+	TICODE_kf19,
+	TICODE_kf20,
+	TICODE_kf21,
+	TICODE_kf22,
+	TICODE_kf23,
+	TICODE_kf24,
+	TICODE_kf25,
+	TICODE_kf26,
+	TICODE_kf27,
+	TICODE_kf28,
+	TICODE_kf29,
+	TICODE_kf30,
+	TICODE_kf31,
+	TICODE_kf32,
+	TICODE_kf33,
+	TICODE_kf34,
+	TICODE_kf35,
+	TICODE_kf36,
+	TICODE_kf37,
+	TICODE_kf38,
+	TICODE_kf39,
+	TICODE_kf40,
+	TICODE_kf41,
+	TICODE_kf42,
+	TICODE_kf43,
+	TICODE_kf44,
+	TICODE_kf45,
+	TICODE_kf46,
+	TICODE_kf47,
+	TICODE_kf48,
+	TICODE_kf49,
+	TICODE_kf50,
+	TICODE_kf51,
+	TICODE_kf52,
+	TICODE_kf53,
+	TICODE_kf54,
+	TICODE_kf55,
+	TICODE_kf56,
+	TICODE_kf57,
+	TICODE_kf58,
+	TICODE_kf59,
+	TICODE_kf60,
+	TICODE_kf61,
+	TICODE_kf62,
+	TICODE_kf63,
+	TICODE_kfnd,
+	TICODE_khlp,
+	TICODE_khome,
+	TICODE_kich1,
+	TICODE_kil1,
+	TICODE_kcub1,
+	TICODE_kll,
+	TICODE_kmrk,
+	TICODE_kmsg,
+	TICODE_kmous,
+	TICODE_kmov,
+	TICODE_knxt,
+	TICODE_knp,
+	TICODE_kopn,
+	TICODE_kopt,
+	TICODE_kpp,
+	TICODE_kprv,
+	TICODE_kprt,
+	TICODE_krdo,
+	TICODE_kref,
+	TICODE_krfr,
+	TICODE_krpl,
+	TICODE_krst,
+	TICODE_kres,
+	TICODE_kcuf1,
+	TICODE_ksav,
+	TICODE_kBEG,
+	TICODE_kCAN,
+	TICODE_kCMD,
+	TICODE_kCPY,
+	TICODE_kCRT,
+	TICODE_kDC,
+	TICODE_kDL,
+	TICODE_kslt,
+	TICODE_kEND,
+	TICODE_kEOL,
+	TICODE_kEXT,
+	TICODE_kind,
+	TICODE_kFND,
+	TICODE_kHLP,
+	TICODE_kHOM,
+	TICODE_kIC,
+	TICODE_kLFT,
+	TICODE_kMSG,
+	TICODE_kMOV,
+	TICODE_kNXT,
+	TICODE_kOPT,
+	TICODE_kPRV,
+	TICODE_kPRT,
+	TICODE_kri,
+	TICODE_kRDO,
+	TICODE_kRPL,
+	TICODE_kRIT,
+	TICODE_kRES,
+	TICODE_kSAV,
+	TICODE_kSPD,
+	TICODE_khts,
+	TICODE_kUND,
+	TICODE_kspd,
+	TICODE_kund,
+	TICODE_kcuu1,
+	TICODE_rmkx,
+	TICODE_smkx,
+	TICODE_lf0,
+	TICODE_lf1,
+	TICODE_lf2,
+	TICODE_lf3,
+	TICODE_lf4,
+	TICODE_lf5,
+	TICODE_lf6,
+	TICODE_lf7,
+	TICODE_lf8,
+	TICODE_lf9,
+	TICODE_lf10,
+	TICODE_fln,
+	TICODE_rmln,
+	TICODE_smln,
+	TICODE_rmm,
+	TICODE_smm,
+	TICODE_mhpa,
+	TICODE_mcud1,
+	TICODE_mcub1,
+	TICODE_mcuf1,
+	TICODE_mvpa,
+	TICODE_mcuu1,
+	TICODE_minfo,
+	TICODE_nel,
+	TICODE_porder,
+	TICODE_oc,
+	TICODE_op,
+	TICODE_pad,
+	TICODE_dch,
+	TICODE_dl,
+	TICODE_cud,
+	TICODE_mcud,
+	TICODE_ich,
+	TICODE_indn,
+	TICODE_il,
+	TICODE_cub,
+	TICODE_mcub,
+	TICODE_cuf,
+	TICODE_mcuf,
+	TICODE_rin,
+	TICODE_cuu,
+	TICODE_mcuu,
+	TICODE_pctrm,
+	TICODE_pfkey,
+	TICODE_pfloc,
+	TICODE_pfxl,
+	TICODE_pfx,
+	TICODE_pln,
+	TICODE_mc0,
+	TICODE_mc5p,
+	TICODE_mc4,
+	TICODE_mc5,
+	TICODE_pulse,
+	TICODE_qdial,
+	TICODE_rmclk,
+	TICODE_rep,
+	TICODE_rfi,
+	TICODE_reqmp,
+	TICODE_rs1,
+	TICODE_rs2,
+	TICODE_rs3,
+	TICODE_rf,
+	TICODE_rc,
+	TICODE_vpa,
+	TICODE_sc,
+	TICODE_scesc,
+	TICODE_ind,
+	TICODE_ri,
+	TICODE_scs,
+	TICODE_s0ds,
+	TICODE_s1ds,
+	TICODE_s2ds,
+	TICODE_s3ds,
+	TICODE_sgr1,
+	TICODE_setab,
+	TICODE_setaf,
+	TICODE_sgr,
+	TICODE_setb,
+	TICODE_smgb,
+	TICODE_smgbp,
+	TICODE_sclk,
+	TICODE_setcolor,
+	TICODE_scp,
+	TICODE_setf,
+	TICODE_smgl,
+	TICODE_smglp,
+	TICODE_smglr,
+	TICODE_slines,
+	TICODE_slength,
+	TICODE_smgr,
+	TICODE_smgrp,
+	TICODE_hts,
+	TICODE_smgtb,
+	TICODE_smgt,
+	TICODE_smgtp,
+	TICODE_wind,
+	TICODE_sbim,
+	TICODE_scsd,
+	TICODE_rbim,
+	TICODE_rcsd,
+	TICODE_subcs,
+	TICODE_supcs,
+	TICODE_ht,
+	TICODE_docr,
+	TICODE_tsl,
+	TICODE_tone,
+	TICODE_u0,
+	TICODE_u1,
+	TICODE_u2,
+	TICODE_u3,
+	TICODE_u4,
+	TICODE_u5,
+	TICODE_u6,
+	TICODE_u7,
+	TICODE_u8,
+	TICODE_u9,
+	TICODE_uc,
+	TICODE_hu,
+	TICODE_wait,
+	TICODE_xoffc,
+	TICODE_xonc,
+	TICODE_zerom
+};
+#define TISTRMAX			TICODE_zerom
+
+#define t_acs_chars(t)			(t)->strs[TICODE_acsc]
+#define t_alt_scancode_esc(t)		(t)->strs[TICODE_scesa]
+#define t_back_tab(t)			(t)->strs[TICODE_cbt]
+#define t_bell(t)			(t)->strs[TICODE_bel]
+#define t_bit_image_carriage_return(t)	(t)->strs[TICODE_bicr]
+#define t_bit_image_newline(t)		(t)->strs[TICODE_binel]
+#define t_bit_image_repeat(t)		(t)->strs[TICODE_birep]
+#define t_carriage_return(t)		(t)->strs[TICODE_cr]
+#define t_change_char_pitch(t)		(t)->strs[TICODE_cpi]
+#define t_change_line_pitch(t)		(t)->strs[TICODE_lpi]
+#define t_change_res_horz(t)		(t)->strs[TICODE_chr]
+#define t_change_res_vert(t)		(t)->strs[TICODE_cvr]
+#define t_change_scroll_region(t)	(t)->strs[TICODE_csr]
+#define t_char_padding(t)		(t)->strs[TICODE_rmp]
+#define t_char_set_names(t)		(t)->strs[TICODE_csnm]
+#define t_clear_all_tabs(t)		(t)->strs[TICODE_tbc]
+#define t_clear_margins(t)		(t)->strs[TICODE_mgc]
+#define t_clear_screen(t)		(t)->strs[TICODE_clear]
+#define t_clr_bol(t)			(t)->strs[TICODE_el1]
+#define t_clr_eol(t)			(t)->strs[TICODE_el]
+#define t_clr_eos(t)			(t)->strs[TICODE_ed]
+#define t_code_set_init(t)		(t)->strs[TICODE_csin]
+#define t_color_names(t)		(t)->strs[TICODE_colornm]
+#define t_column_address(t)		(t)->strs[TICODE_hpa]
+#define t_command_character(t)		(t)->strs[TICODE_cmdch]
+#define t_create_window(t)		(t)->strs[TICODE_cwin]
+#define t_cursor_address(t)		(t)->strs[TICODE_cup]
+#define t_cursor_down(t)		(t)->strs[TICODE_cud1]
+#define t_cursor_home(t)		(t)->strs[TICODE_home]
+#define t_cursor_invisible(t)		(t)->strs[TICODE_civis]
+#define t_cursor_left(t)		(t)->strs[TICODE_cub1]
+#define t_cursor_mem_address(t)		(t)->strs[TICODE_mrcup]
+#define t_cursor_normal(t)		(t)->strs[TICODE_cnorm]
+#define t_cursor_right(t)		(t)->strs[TICODE_cuf1]
+#define t_cursor_to_ll(t)		(t)->strs[TICODE_ll]
+#define t_cursor_up(t)			(t)->strs[TICODE_cuu1]
+#define t_cursor_visible(t)		(t)->strs[TICODE_cvvis]
+#define t_define_bit_image_region(t)	(t)->strs[TICODE_defbi]
+#define t_define_char(t)		(t)->strs[TICODE_defc]
+#define t_delete_character(t)		(t)->strs[TICODE_dch1]
+#define t_delete_line(t)		(t)->strs[TICODE_dl1]
+#define t_device_type(t)		(t)->strs[TICODE_devt]
+#define t_dial_phone(t)			(t)->strs[TICODE_dial]
+#define t_dis_status_line(t)		(t)->strs[TICODE_dsl]
+#define t_display_clock(t)		(t)->strs[TICODE_dclk]
+#define t_display_pc_char(t)		(t)->strs[TICODE_dispc]
+#define t_down_half_time(t)		(t)->strs[TICODE_hd]
+#define t_ena_acs(t)			(t)->strs[TICODE_enacs]
+#define t_end_bit_image_region(t)	(t)->strs[TICODE_endbi]
+#define t_enter_alt_charset_mode(t)	(t)->strs[TICODE_smacs]
+#define t_enter_am_mode(t)		(t)->strs[TICODE_smam]
+#define t_enter_blink_mode(t)		(t)->strs[TICODE_blink]
+#define t_enter_bold_mode(t)		(t)->strs[TICODE_bold]
+#define t_enter_ca_mode(t)		(t)->strs[TICODE_smcup]
+#define t_enter_delete_mode(t)		(t)->strs[TICODE_smdc]
+#define t_enter_dim_mode(t)		(t)->strs[TICODE_dim]
+#define t_enter_doublewide_mode(t)	(t)->strs[TICODE_swidm]
+#define t_enter_draft_quality(t)	(t)->strs[TICODE_sdrfq]
+#define t_enter_horizontal_hl_mode(t)	(t)->strs[TICODE_ehhlm]
+#define t_enter_insert_mode(t)		(t)->strs[TICODE_smir]
+#define t_enter_italics_mode(t)		(t)->strs[TICODE_sitm]
+#define t_enter_left_hl_mode(t)		(t)->strs[TICODE_elhlm]
+#define t_enter_leftward_mode(t)	(t)->strs[TICODE_slm]
+#define t_enter_low_hl_mode(t)		(t)->strs[TICODE_elohlm]
+#define t_enter_micro_mode(t)		(t)->strs[TICODE_smicm]
+#define t_enter_near_quality_letter(t)	(t)->strs[TICODE_snlq]
+#define t_enter_normal_quality(t)	(t)->strs[TICODE_snrmq]
+#define t_enter_pc_charset_mode(t)	(t)->strs[TICODE_smpch]
+#define t_enter_protected_mode(t)	(t)->strs[TICODE_prot]
+#define t_enter_reverse_mode(t)		(t)->strs[TICODE_rev]
+#define t_enter_right_hl_mode(t)	(t)->strs[TICODE_erhlm]
+#define t_enter_scancode_mode(t)	(t)->strs[TICODE_smsc]
+#define t_enter_secure_mode(t)		(t)->strs[TICODE_invis]
+#define t_enter_shadow_mode(t)		(t)->strs[TICODE_sshm]
+#define t_enter_standout_mode(t)	(t)->strs[TICODE_smso]
+#define t_enter_subscript_mode(t)	(t)->strs[TICODE_ssubm]
+#define t_enter_superscript_mode(t)	(t)->strs[TICODE_ssupm]
+#define t_enter_top_hl_mode(t)		(t)->strs[TICODE_ethlm]
+#define t_enter_underline_mode(t)	(t)->strs[TICODE_smul]
+#define t_enter_upward_mode(t)		(t)->strs[TICODE_sum]
+#define t_enter_vertical_hl_mode(t)	(t)->strs[TICODE_evhlm]
+#define t_enter_xon_mode(t)		(t)->strs[TICODE_smxon]
+#define t_erase_chars(t)		(t)->strs[TICODE_ech]
+#define t_exit_alt_charset_mode(t)	(t)->strs[TICODE_rmacs]
+#define t_exit_am_mode(t)		(t)->strs[TICODE_rmam]
+#define t_exit_attribute_mode(t)	(t)->strs[TICODE_sgr0]
+#define t_exit_ca_mode(t)		(t)->strs[TICODE_rmcup]
+#define t_exit_delete_mode(t)		(t)->strs[TICODE_rmdc]
+#define t_exit_doublewide_mode(t)	(t)->strs[TICODE_rwidm]
+#define t_exit_insert_mode(t)		(t)->strs[TICODE_rmir]
+#define t_exit_italics_mode(t)		(t)->strs[TICODE_ritm]
+#define t_exit_leftward_mode(t)		(t)->strs[TICODE_rlm]
+#define t_exit_micro_mode(t)		(t)->strs[TICODE_rmicm]
+#define t_exit_pc_charset_mode(t)	(t)->strs[TICODE_rmpch]
+#define t_exit_scancode_mode(t)		(t)->strs[TICODE_rmsc]
+#define t_exit_shadow_mode(t)		(t)->strs[TICODE_rshm]
+#define t_exit_standout_mode(t)		(t)->strs[TICODE_rmso]
+#define t_exit_subscript_mode(t)	(t)->strs[TICODE_rsubm]
+#define t_exit_superscript_mode(t)	(t)->strs[TICODE_rsupm]
+#define t_exit_underline_mode(t)	(t)->strs[TICODE_rmul]
+#define t_exit_upward_mode(t)		(t)->strs[TICODE_rum]
+#define t_exit_xon_mode(t)		(t)->strs[TICODE_rmxon]
+#define t_fixed_pause(t)		(t)->strs[TICODE_pause]
+#define t_flash_hook(t)			(t)->strs[TICODE_hook]
+#define t_flash_screen(t)		(t)->strs[TICODE_flash]
+#define t_form_feed(t)			(t)->strs[TICODE_ff]
+#define t_from_status_line(t)		(t)->strs[TICODE_fsl]
+#define t_get_mouse(t)			(t)->strs[TICODE_getm]
+#define t_goto_window(t)		(t)->strs[TICODE_wingo]
+#define t_hangup(t)			(t)->strs[TICODE_hup]
+#define t_init_1string(t)		(t)->strs[TICODE_is1]
+#define t_init_2string(t)		(t)->strs[TICODE_is2]
+#define t_init_3string(t)		(t)->strs[TICODE_is3]
+#define t_init_file(t)			(t)->strs[TICODE_if]
+#define t_init_prog(t)			(t)->strs[TICODE_iprog]
+#define t_initialize_color(t)		(t)->strs[TICODE_initc]
+#define t_initialize_pair(t)		(t)->strs[TICODE_initp]
+#define t_insert_character(t)		(t)->strs[TICODE_ich1]
+#define t_insert_line(t)		(t)->strs[TICODE_il1]
+#define t_insert_padding(t)		(t)->strs[TICODE_ip]
+#define t_key_a1(t)			(t)->strs[TICODE_ka1]
+#define t_key_a3(t)			(t)->strs[TICODE_ka3]
+#define t_key_b2(t)			(t)->strs[TICODE_kb2]
+#define t_key_backspace(t)		(t)->strs[TICODE_kbs]
+#define t_key_beg(t)			(t)->strs[TICODE_kbeg]
+#define t_key_btab(t)			(t)->strs[TICODE_kcbt]
+#define t_key_c1(t)			(t)->strs[TICODE_kc1]
+#define t_key_c3(t)			(t)->strs[TICODE_kc3]
+#define t_key_cancel(t)			(t)->strs[TICODE_kcan]
+#define t_key_catab(t)			(t)->strs[TICODE_ktbc]
+#define t_key_clear(t)			(t)->strs[TICODE_kclr]
+#define t_key_close(t)			(t)->strs[TICODE_kclo]
+#define t_key_command(t)		(t)->strs[TICODE_kcmd]
+#define t_key_copy(t)			(t)->strs[TICODE_kcpy]
+#define t_key_create(t)			(t)->strs[TICODE_kcrt]
+#define t_key_ctab(t)			(t)->strs[TICODE_kctab]
+#define t_key_dc(t)			(t)->strs[TICODE_kdch1]
+#define t_key_dl(t)			(t)->strs[TICODE_kdl1]
+#define t_key_down(t)			(t)->strs[TICODE_kcud1]
+#define t_key_eic(t)			(t)->strs[TICODE_krmir]
+#define t_key_end(t)			(t)->strs[TICODE_kend]
+#define t_key_enter(t)			(t)->strs[TICODE_kent]
+#define t_key_eol(t)			(t)->strs[TICODE_kel]
+#define t_key_eos(t)			(t)->strs[TICODE_ked]
+#define t_key_exit(t)			(t)->strs[TICODE_kext]
+#define t_key_f0(t)			(t)->strs[TICODE_kf0]
+#define t_key_f1(t)			(t)->strs[TICODE_kf1]
+#define t_key_f2(t)			(t)->strs[TICODE_kf2]
+#define t_key_f3(t)			(t)->strs[TICODE_kf3]
+#define t_key_f4(t)			(t)->strs[TICODE_kf4]
+#define t_key_f5(t)			(t)->strs[TICODE_kf5]
+#define t_key_f6(t)			(t)->strs[TICODE_kf6]
+#define t_key_f7(t)			(t)->strs[TICODE_kf7]
+#define t_key_f8(t)			(t)->strs[TICODE_kf8]
+#define t_key_f9(t)			(t)->strs[TICODE_kf9]
+#define t_key_f10(t)			(t)->strs[TICODE_kf10]
+#define t_key_f11(t)			(t)->strs[TICODE_kf11]
+#define t_key_f12(t)			(t)->strs[TICODE_kf12]
+#define t_key_f13(t)			(t)->strs[TICODE_kf13]
+#define t_key_f14(t)			(t)->strs[TICODE_kf14]
+#define t_key_f15(t)			(t)->strs[TICODE_kf15]
+#define t_key_f16(t)			(t)->strs[TICODE_kf16]
+#define t_key_f17(t)			(t)->strs[TICODE_kf17]
+#define t_key_f18(t)			(t)->strs[TICODE_kf18]
+#define t_key_f19(t)			(t)->strs[TICODE_kf19]
+#define t_key_f20(t)			(t)->strs[TICODE_kf20]
+#define t_key_f21(t)			(t)->strs[TICODE_kf21]
+#define t_key_f22(t)			(t)->strs[TICODE_kf22]
+#define t_key_f23(t)			(t)->strs[TICODE_kf23]
+#define t_key_f24(t)			(t)->strs[TICODE_kf24]
+#define t_key_f25(t)			(t)->strs[TICODE_kf25]
+#define t_key_f26(t)			(t)->strs[TICODE_kf26]
+#define t_key_f27(t)			(t)->strs[TICODE_kf27]
+#define t_key_f28(t)			(t)->strs[TICODE_kf28]
+#define t_key_f29(t)			(t)->strs[TICODE_kf29]
+#define t_key_f30(t)			(t)->strs[TICODE_kf30]
+#define t_key_f31(t)			(t)->strs[TICODE_kf31]
+#define t_key_f32(t)			(t)->strs[TICODE_kf32]
+#define t_key_f33(t)			(t)->strs[TICODE_kf33]
+#define t_key_f34(t)			(t)->strs[TICODE_kf34]
+#define t_key_f35(t)			(t)->strs[TICODE_kf35]
+#define t_key_f36(t)			(t)->strs[TICODE_kf36]
+#define t_key_f37(t)			(t)->strs[TICODE_kf37]
+#define t_key_f38(t)			(t)->strs[TICODE_kf38]
+#define t_key_f39(t)			(t)->strs[TICODE_kf39]
+#define t_key_f40(t)			(t)->strs[TICODE_kf40]
+#define t_key_f41(t)			(t)->strs[TICODE_kf41]
+#define t_key_f42(t)			(t)->strs[TICODE_kf42]
+#define t_key_f43(t)			(t)->strs[TICODE_kf43]
+#define t_key_f44(t)			(t)->strs[TICODE_kf44]
+#define t_key_f45(t)			(t)->strs[TICODE_kf45]
+#define t_key_f46(t)			(t)->strs[TICODE_kf46]
+#define t_key_f47(t)			(t)->strs[TICODE_kf47]
+#define t_key_f48(t)			(t)->strs[TICODE_kf48]
+#define t_key_f49(t)			(t)->strs[TICODE_kf49]
+#define t_key_f50(t)			(t)->strs[TICODE_kf50]
+#define t_key_f51(t)			(t)->strs[TICODE_kf51]
+#define t_key_f52(t)			(t)->strs[TICODE_kf52]
+#define t_key_f53(t)			(t)->strs[TICODE_kf53]
+#define t_key_f54(t)			(t)->strs[TICODE_kf54]
+#define t_key_f55(t)			(t)->strs[TICODE_kf55]
+#define t_key_f56(t)			(t)->strs[TICODE_kf56]
+#define t_key_f57(t)			(t)->strs[TICODE_kf57]
+#define t_key_f58(t)			(t)->strs[TICODE_kf58]
+#define t_key_f59(t)			(t)->strs[TICODE_kf59]
+#define t_key_f60(t)			(t)->strs[TICODE_kf60]
+#define t_key_f61(t)			(t)->strs[TICODE_kf61]
+#define t_key_f62(t)			(t)->strs[TICODE_kf62]
+#define t_key_f63(t)			(t)->strs[TICODE_kf63]
+#define t_key_find(t)			(t)->strs[TICODE_kfnd]
+#define t_key_help(t)			(t)->strs[TICODE_khlp]
+#define t_key_home(t)			(t)->strs[TICODE_khome]
+#define t_key_ic(t)			(t)->strs[TICODE_kich1]
+#define t_key_il(t)			(t)->strs[TICODE_kil1]
+#define t_key_left(t)			(t)->strs[TICODE_kcub1]
+#define t_key_ll(t)			(t)->strs[TICODE_kll]
+#define t_key_mark(t)			(t)->strs[TICODE_kmrk]
+#define t_key_message(t)		(t)->strs[TICODE_kmsg]
+#define t_key_mouse(t)			(t)->strs[TICODE_kmous]
+#define t_key_move(t)			(t)->strs[TICODE_kmov]
+#define t_key_next(t)			(t)->strs[TICODE_knxt]
+#define t_key_npage(t)			(t)->strs[TICODE_knp]
+#define t_key_open(t)			(t)->strs[TICODE_kopn]
+#define t_key_options(t)		(t)->strs[TICODE_kopt]
+#define t_key_ppage(t)			(t)->strs[TICODE_kpp]
+#define t_key_previous(t)		(t)->strs[TICODE_kprv]
+#define t_key_print(t)			(t)->strs[TICODE_kprt]
+#define t_key_redo(t)			(t)->strs[TICODE_krdo]
+#define t_key_reference(t)		(t)->strs[TICODE_kref]
+#define t_key_refresh(t)		(t)->strs[TICODE_krfr]
+#define t_key_replace(t)		(t)->strs[TICODE_krpl]
+#define t_key_restart(t)		(t)->strs[TICODE_krst]
+#define t_key_resume(t)			(t)->strs[TICODE_kres]
+#define t_key_right(t)			(t)->strs[TICODE_kcuf1]
+#define t_key_save(t)			(t)->strs[TICODE_ksav]
+#define t_key_sbeg(t)			(t)->strs[TICODE_kBEG]
+#define t_key_scancel(t)		(t)->strs[TICODE_kCAN]
+#define t_key_scommand(t)		(t)->strs[TICODE_kCMD]
+#define t_key_scopy(t)			(t)->strs[TICODE_kCPY]
+#define t_key_screate(t)		(t)->strs[TICODE_kCRT]
+#define t_key_sdc(t)			(t)->strs[TICODE_kDC]
+#define t_key_sdl(t)			(t)->strs[TICODE_kDL]
+#define t_key_select(t)			(t)->strs[TICODE_kslt]
+#define t_key_send(t)			(t)->strs[TICODE_kEND]
+#define t_key_seol(t)			(t)->strs[TICODE_kEOL]
+#define t_key_sexit(t)			(t)->strs[TICODE_kEXT]
+#define t_key_sf(t)			(t)->strs[TICODE_kind]
+#define t_key_sfind(t)			(t)->strs[TICODE_kFND]
+#define t_key_shelp(t)			(t)->strs[TICODE_kHLP]
+#define t_key_shome(t)			(t)->strs[TICODE_kHOM]
+#define t_key_sic(t)			(t)->strs[TICODE_kIC]
+#define t_key_sleft(t)			(t)->strs[TICODE_kLFT]
+#define t_key_smessage(t)		(t)->strs[TICODE_kMSG]
+#define t_key_smove(t)			(t)->strs[TICODE_kMOV]
+#define t_key_snext(t)			(t)->strs[TICODE_kNXT]
+#define t_key_soptions(t)		(t)->strs[TICODE_kOPT]
+#define t_key_sprevious(t)		(t)->strs[TICODE_kPRV]
+#define t_key_sprint(t)			(t)->strs[TICODE_kPRT]
+#define t_key_sr(t)			(t)->strs[TICODE_kri]
+#define t_key_sredo(t)			(t)->strs[TICODE_kRDO]
+#define t_key_sreplace(t)		(t)->strs[TICODE_kRPL]
+#define t_key_sright(t)			(t)->strs[TICODE_kRIT]
+#define t_key_srsume(t)			(t)->strs[TICODE_kRES]
+#define t_key_ssave(t)			(t)->strs[TICODE_kSAV]
+#define t_key_ssuspend(t)		(t)->strs[TICODE_kSPD]
+#define t_key_stab(t)			(t)->strs[TICODE_khts]
+#define t_key_sundo(t)			(t)->strs[TICODE_kUND]
+#define t_key_suspend(t)		(t)->strs[TICODE_kspd]
+#define t_key_undo(t)			(t)->strs[TICODE_kund]
+#define t_key_up(t)			(t)->strs[TICODE_kcuu1]
+#define t_keypad_local(t)		(t)->strs[TICODE_rmkx]
+#define t_keypad_xmit(t)		(t)->strs[TICODE_smkx]
+#define t_lab_f0(t)			(t)->strs[TICODE_lf0]
+#define t_lab_f1(t)			(t)->strs[TICODE_lf1]
+#define t_lab_f2(t)			(t)->strs[TICODE_lf2]
+#define t_lab_f3(t)			(t)->strs[TICODE_lf3]
+#define t_lab_f4(t)			(t)->strs[TICODE_lf4]
+#define t_lab_f5(t)			(t)->strs[TICODE_lf5]
+#define t_lab_f6(t)			(t)->strs[TICODE_lf6]
+#define t_lab_f7(t)			(t)->strs[TICODE_lf7]
+#define t_lab_f8(t)			(t)->strs[TICODE_lf8]
+#define t_lab_f9(t)			(t)->strs[TICODE_lf9]
+#define t_lab_f10(t)			(t)->strs[TICODE_lf10]
+#define t_label_format(t)		(t)->strs[TICODE_fln]
+#define t_label_off(t)			(t)->strs[TICODE_rmln]
+#define t_label_on(t)			(t)->strs[TICODE_smln]
+#define t_meta_off(t)			(t)->strs[TICODE_rmm]
+#define t_meta_on(t)			(t)->strs[TICODE_smm]
+#define t_micro_column_address(t)	(t)->strs[TICODE_mhpa]
+#define t_micro_down(t)			(t)->strs[TICODE_mcud1]
+#define t_micro_left(t)			(t)->strs[TICODE_mcub1]
+#define t_micro_right(t)		(t)->strs[TICODE_mcuf1]
+#define t_micro_row_address(t)		(t)->strs[TICODE_mvpa]
+#define t_micro_up(t)			(t)->strs[TICODE_mcuu1]
+#define t_mouse_info(t)			(t)->strs[TICODE_minfo]
+#define t_newline(t)			(t)->strs[TICODE_nel]
+#define t_order_of_pins(t)		(t)->strs[TICODE_porder]
+#define t_orig_colors(t)		(t)->strs[TICODE_oc]
+#define t_orig_pair(t)			(t)->strs[TICODE_op]
+#define t_pad_char(t)			(t)->strs[TICODE_pad]
+#define t_parm_dch(t)			(t)->strs[TICODE_dch]
+#define t_parm_delete_line(t)		(t)->strs[TICODE_dl]
+#define t_parm_down_cursor(t)		(t)->strs[TICODE_cud]
+#define t_parm_down_micro(t)		(t)->strs[TICODE_mcud]
+#define t_parm_ich(t)			(t)->strs[TICODE_ich]
+#define t_parm_index(t)			(t)->strs[TICODE_indn]
+#define t_parm_insert_line(t)		(t)->strs[TICODE_il]
+#define t_parm_left_cursor(t)		(t)->strs[TICODE_cub]
+#define t_parm_left_micro(t)		(t)->strs[TICODE_mcub]
+#define t_parm_right_cursor(t)		(t)->strs[TICODE_cuf]
+#define t_parm_right_micro(t)		(t)->strs[TICODE_mcuf]
+#define t_parm_rindex(t)		(t)->strs[TICODE_rin]
+#define t_parm_up_cursor(t)		(t)->strs[TICODE_cuu]
+#define t_parm_up_micro(t)		(t)->strs[TICODE_mcuu]
+#define t_pc_term_options(t)		(t)->strs[TICODE_pctrm]
+#define t_pkey_key(t)			(t)->strs[TICODE_pfkey]
+#define t_pkey_local(t)			(t)->strs[TICODE_pfloc]
+#define t_pkey_plab(t)			(t)->strs[TICODE_pfxl]
+#define t_pkey_xmit(t)			(t)->strs[TICODE_pfx]
+#define t_pkey_norm(t)			(t)->strs[TICODE_pln]
+#define t_print_screen(t)		(t)->strs[TICODE_mc0]
+#define t_ptr_non(t)			(t)->strs[TICODE_mc5p]
+#define t_ptr_off(t)			(t)->strs[TICODE_mc4]
+#define t_ptr_on(t)			(t)->strs[TICODE_mc5]
+#define t_pulse(t)			(t)->strs[TICODE_pulse]
+#define t_quick_dial(t)			(t)->strs[TICODE_qdial]
+#define t_remove_clock(t)		(t)->strs[TICODE_rmclk]
+#define t_repeat_char(t)		(t)->strs[TICODE_rep]
+#define t_req_for_input(t)		(t)->strs[TICODE_rfi]
+#define t_req_mouse_pos(t)		(t)->strs[TICODE_reqmp]
+#define t_reset_1string(t)		(t)->strs[TICODE_rs1]
+#define t_reset_2string(t)		(t)->strs[TICODE_rs2]
+#define t_reset_3string(t)		(t)->strs[TICODE_rs3]
+#define t_reset_file(t)			(t)->strs[TICODE_rf]
+#define t_restore_cursor(t)		(t)->strs[TICODE_rc]
+#define t_row_address(t)		(t)->strs[TICODE_vpa]
+#define t_save_cursor(t)		(t)->strs[TICODE_sc]
+#define t_scancode_escape(t)		(t)->strs[TICODE_scesc]
+#define t_scroll_forward(t)		(t)->strs[TICODE_ind]
+#define t_scroll_reverse(t)		(t)->strs[TICODE_ri]
+#define t_select_char_set(t)		(t)->strs[TICODE_scs]
+#define t_set0_des_seq(t)		(t)->strs[TICODE_s0ds]
+#define t_set1_des_seq(t)		(t)->strs[TICODE_s1ds]
+#define t_set2_des_seq(t)		(t)->strs[TICODE_s2ds]
+#define t_set3_des_seq(t)		(t)->strs[TICODE_s3ds]
+#define t_set_a_attributes(t)		(t)->strs[TICODE_sgr1]
+#define t_set_a_background(t)		(t)->strs[TICODE_setab]
+#define t_set_a_foreground(t)		(t)->strs[TICODE_setaf]
+#define t_set_attributes(t)		(t)->strs[TICODE_sgr]
+#define t_set_background(t)		(t)->strs[TICODE_setb]
+#define t_set_bottom_margin(t)		(t)->strs[TICODE_smgb]
+#define t_set_bottom_margin_parm(t)	(t)->strs[TICODE_smgbp]
+#define t_set_clock(t)			(t)->strs[TICODE_sclk]
+#define t_set_color_band(t)		(t)->strs[TICODE_setcolor]
+#define t_set_color_pair(t)		(t)->strs[TICODE_scp]
+#define t_set_foreground(t)		(t)->strs[TICODE_setf]
+#define t_set_left_margin(t)		(t)->strs[TICODE_smgl]
+#define t_set_left_margin_parm(t)	(t)->strs[TICODE_smglp]
+#define t_set_lr_margin(t)		(t)->strs[TICODE_smglr]
+#define t_set_page_length(t)		(t)->strs[TICODE_slines]
+#define t_set_pglen_inch(t)		(t)->strs[TICODE_slength]
+#define t_set_right_margin(t)		(t)->strs[TICODE_smgr]
+#define t_set_right_margin_parm(t)	(t)->strs[TICODE_smgrp]
+#define t_set_tab(t)			(t)->strs[TICODE_hts]
+#define t_set_tb_margin(t)		(t)->strs[TICODE_smgtb]
+#define t_set_top_margin(t)		(t)->strs[TICODE_smgt]
+#define t_set_top_margin_parm(t)	(t)->strs[TICODE_smgtp]
+#define t_set_window(t)			(t)->strs[TICODE_wind]
+#define t_start_bit_image(t)		(t)->strs[TICODE_sbim]
+#define t_start_char_set_def(t)		(t)->strs[TICODE_scsd]
+#define t_stop_bit_image(t)		(t)->strs[TICODE_rbim]
+#define t_stop_char_set_def(t)		(t)->strs[TICODE_rcsd]
+#define t_subscript_characters(t)	(t)->strs[TICODE_subcs]
+#define t_superscript_characters(t)	(t)->strs[TICODE_supcs]
+#define t_tab(t)			(t)->strs[TICODE_ht]
+#define t_these_cause_cr(t)		(t)->strs[TICODE_docr]
+#define t_to_status_line(t)		(t)->strs[TICODE_tsl]
+#define t_tone(t)			(t)->strs[TICODE_tone]
+#define t_user0(t)			(t)->strs[TICODE_u0]
+#define t_user1(t)			(t)->strs[TICODE_u1]
+#define t_user2(t)			(t)->strs[TICODE_u2]
+#define t_user3(t)			(t)->strs[TICODE_u3]
+#define t_user4(t)			(t)->strs[TICODE_u4]
+#define t_user5(t)			(t)->strs[TICODE_u5]
+#define t_user6(t)			(t)->strs[TICODE_u6]
+#define t_user7(t)			(t)->strs[TICODE_u7]
+#define t_user8(t)			(t)->strs[TICODE_u8]
+#define t_user9(t)			(t)->strs[TICODE_u9]
+#define t_underline_char(t)		(t)->strs[TICODE_uc]
+#define t_up_half_line(t)		(t)->strs[TICODE_hu]
+#define t_wait_tone(t)			(t)->strs[TICODE_wait]
+#define t_xoff_character(t)		(t)->strs[TICODE_xoffc]
+#define t_xon_character(t)		(t)->strs[TICODE_xonc]
+#define t_zero_motion(t)		(t)->strs[TICODE_zerom]
+
+#define acs_chars			 t_acs_chars(cur_term)
+#define alt_scancode_esc		 t_alt_scancode_esc(cur_term)
+#define back_tab			 t_back_tab(cur_term)
+#define bell				 t_bell(cur_term)
+#define bit_image_carriage_return	 t_bit_image_carriage_return(cur_term)
+#define bit_image_newline		 t_bit_image_newline(cur_term)
+#define bit_image_repeat		 t_bit_image_repeat(cur_term)
+#define carriage_return			 t_carriage_return(cur_term)
+#define change_char_pitch		 t_change_char_pitch(cur_term)
+#define change_line_pitch		 t_change_line_pitch(cur_term)
+#define change_res_horz			 t_change_res_horz(cur_term)
+#define change_res_vert			 t_change_res_vert(cur_term)
+#define change_scroll_region		 t_change_scroll_region(cur_term)
+#define char_padding			 t_char_padding(cur_term)
+#define char_set_names			 t_char_set_names(cur_term)
+#define clear_all_tabs			 t_clear_all_tabs(cur_term)
+#define clear_margins			 t_clear_margins(cur_term)
+#define clear_screen			 t_clear_screen(cur_term)
+#define clr_bol				 t_clr_bol(cur_term)
+#define clr_eol				 t_clr_eol(cur_term)
+#define clr_eos				 t_clr_eos(cur_term)
+#define code_set_init			 t_code_set_init(cur_term)
+#define color_names			 t_color_names(cur_term)
+#define column_address			 t_column_address(cur_term)
+#define command_character		 t_command_character(cur_term)
+#define create_window			 t_create_window(cur_term)
+#define cursor_address			 t_cursor_address(cur_term)
+#define cursor_down			 t_cursor_down(cur_term)
+#define cursor_home			 t_cursor_home(cur_term)
+#define cursor_invisible		 t_cursor_invisible(cur_term)
+#define cursor_left			 t_cursor_left(cur_term)
+#define cursor_mem_address		 t_cursor_mem_address(cur_term)
+#define cursor_normal			 t_cursor_normal(cur_term)
+#define cursor_right			 t_cursor_right(cur_term)
+#define cursor_to_ll			 t_cursor_to_ll(cur_term)
+#define cursor_up			 t_cursor_up(cur_term)
+#define cursor_visible			 t_cursor_visible(cur_term)
+#define define_bit_image_region		 t_define_bit_image_region(cur_term)
+#define define_char			 t_define_char(cur_term)
+#define delete_character		 t_delete_character(cur_term)
+#define delete_line			 t_delete_line(cur_term)
+#define device_type			 t_device_type(cur_term)
+#define dial_phone			 t_dial_phone(cur_term)
+#define dis_status_line			 t_dis_status_line(cur_term)
+#define display_clock			 t_display_clock(cur_term)
+#define display_pc_char			 t_display_pc_char(cur_term)
+#define down_half_time			 t_down_half_time(cur_term)
+#define ena_acs				 t_ena_acs(cur_term)
+#define end_bit_image_region		 t_end_bit_image_region(cur_term)
+#define enter_alt_charset_mode		 t_enter_alt_charset_mode(cur_term)
+#define enter_am_mode			 t_enter_am_mode(cur_term)
+#define enter_blink_mode		 t_enter_blink_mode(cur_term)
+#define enter_bold_mode			 t_enter_bold_mode(cur_term)
+#define enter_ca_mode			 t_enter_ca_mode(cur_term)
+#define enter_delete_mode		 t_enter_delete_mode(cur_term)
+#define enter_dim_mode			 t_enter_dim_mode(cur_term)
+#define enter_doublewide_mode		 t_enter_doublewide_mode(cur_term)
+#define enter_draft_quality		 t_enter_draft_quality(cur_term)
+#define enter_horizontal_hl_mode	 t_enter_horizontal_hl_mode(cur_term)
+#define enter_insert_mode		 t_enter_insert_mode(cur_term)
+#define enter_italics_mode		 t_enter_italics_mode(cur_term)
+#define enter_left_hl_mode		 t_enter_left_hl_mode(cur_term)
+#define enter_leftward_mode		 t_enter_leftward_mode(cur_term)
+#define enter_low_hl_mode		 t_enter_low_hl_mode(cur_term)
+#define enter_micro_mode		 t_enter_micro_mode(cur_term)
+#define enter_near_quality_letter	 t_enter_near_quality_letter(cur_term)
+#define enter_normal_quality		 t_enter_normal_quality(cur_term)
+#define enter_pc_charset_mode		 t_enter_pc_charset_mode(cur_term)
+#define enter_protected_mode		 t_enter_protected_mode(cur_term)
+#define enter_reverse_mode		 t_enter_reverse_mode(cur_term)
+#define enter_right_hl_mode		 t_enter_right_hl_mode(cur_term)
+#define enter_scancode_mode		 t_enter_scancode_mode(cur_term)
+#define enter_secure_mode		 t_enter_secure_mode(cur_term)
+#define enter_shadow_mode		 t_enter_shadow_mode(cur_term)
+#define enter_standout_mode		 t_enter_standout_mode(cur_term)
+#define enter_subscript_mode		 t_enter_subscript_mode(cur_term)
+#define enter_superscript_mode		 t_enter_superscript_mode(cur_term)
+#define enter_top_hl_mode		 t_enter_top_hl_mode(cur_term)
+#define enter_underline_mode		 t_enter_underline_mode(cur_term)
+#define enter_upward_mode		 t_enter_upward_mode(cur_term)
+#define enter_vertical_hl_mode		 t_enter_vertical_hl_mode(cur_term)
+#define enter_xon_mode			 t_enter_xon_mode(cur_term)
+#define erase_chars			 t_erase_chars(cur_term)
+#define exit_alt_charset_mode		 t_exit_alt_charset_mode(cur_term)
+#define exit_am_mode			 t_exit_am_mode(cur_term)
+#define exit_attribute_mode		 t_exit_attribute_mode(cur_term)
+#define exit_ca_mode			 t_exit_ca_mode(cur_term)
+#define exit_delete_mode		 t_exit_delete_mode(cur_term)
+#define exit_doublewide_mode		 t_exit_doublewide_mode(cur_term)
+#define exit_insert_mode		 t_exit_insert_mode(cur_term)
+#define exit_italics_mode		 t_exit_italics_mode(cur_term)
+#define exit_leftward_mode		 t_exit_leftward_mode(cur_term)
+#define exit_micro_mode			 t_exit_micro_mode(cur_term)
+#define exit_pc_charset_mode		 t_exit_pc_charset_mode(cur_term)
+#define exit_scancode_mode		 t_exit_scancode_mode(cur_term)
+#define exit_shadow_mode		 t_exit_shadow_mode(cur_term)
+#define exit_standout_mode		 t_exit_standout_mode(cur_term)
+#define exit_subscript_mode		 t_exit_subscript_mode(cur_term)
+#define exit_superscript_mode		 t_exit_superscript_mode(cur_term)
+#define exit_underline_mode		 t_exit_underline_mode(cur_term)
+#define exit_upward_mode		 t_exit_upward_mode(cur_term)
+#define exit_xon_mode			 t_exit_xon_mode(cur_term)
+#define fixed_pause			 t_fixed_pause(cur_term)
+#define flash_hook			 t_flash_hook(cur_term)
+#define flash_screen			 t_flash_screen(cur_term)
+#define form_feed			 t_form_feed(cur_term)
+#define from_status_line		 t_from_status_line(cur_term)
+#define get_mouse			 t_get_mouse(cur_term)
+#define goto_window			 t_goto_window(cur_term)
+#define hangup				 t_hangup(cur_term)
+#define init_1string			 t_init_1string(cur_term)
+#define init_2string			 t_init_2string(cur_term)
+#define init_3string			 t_init_3string(cur_term)
+#define init_file			 t_init_file(cur_term)
+#define init_prog			 t_init_prog(cur_term)
+#define initialize_color		 t_initialize_color(cur_term)
+#define initialize_pair			 t_initialize_pair(cur_term)
+#define insert_character		 t_insert_character(cur_term)
+#define insert_line			 t_insert_line(cur_term)
+#define insert_padding			 t_insert_padding(cur_term)
+#define key_a1				 t_key_a1(cur_term)
+#define key_a3				 t_key_a3(cur_term)
+#define key_b2				 t_key_b2(cur_term)
+#define key_backspace			 t_key_backspace(cur_term)
+#define key_beg				 t_key_beg(cur_term)
+#define key_btab			 t_key_btab(cur_term)
+#define key_c1				 t_key_c1(cur_term)
+#define key_c3				 t_key_c3(cur_term)
+#define key_cancel			 t_key_cancel(cur_term)
+#define key_catab			 t_key_catab(cur_term)
+#define key_clear			 t_key_clear(cur_term)
+#define key_close			 t_key_close(cur_term)
+#define key_command			 t_key_command(cur_term)
+#define key_copy			 t_key_copy(cur_term)
+#define key_create			 t_key_create(cur_term)
+#define key_ctab			 t_key_ctab(cur_term)
+#define key_dc				 t_key_dc(cur_term)
+#define key_dl				 t_key_dl(cur_term)
+#define key_down			 t_key_down(cur_term)
+#define key_eic				 t_key_eic(cur_term)
+#define key_end				 t_key_end(cur_term)
+#define key_enter			 t_key_enter(cur_term)
+#define key_eol				 t_key_eol(cur_term)
+#define key_eos				 t_key_eos(cur_term)
+#define key_exit			 t_key_exit(cur_term)
+#define key_f0				 t_key_f0(cur_term)
+#define key_f1				 t_key_f1(cur_term)
+#define key_f2				 t_key_f2(cur_term)
+#define key_f3				 t_key_f3(cur_term)
+#define key_f4				 t_key_f4(cur_term)
+#define key_f5				 t_key_f5(cur_term)
+#define key_f6				 t_key_f6(cur_term)
+#define key_f7				 t_key_f7(cur_term)
+#define key_f8				 t_key_f8(cur_term)
+#define key_f9				 t_key_f9(cur_term)
+#define key_f10				 t_key_f10(cur_term)
+#define key_f11				 t_key_f11(cur_term)
+#define key_f12				 t_key_f12(cur_term)
+#define key_f13				 t_key_f13(cur_term)
+#define key_f14				 t_key_f14(cur_term)
+#define key_f15				 t_key_f15(cur_term)
+#define key_f16				 t_key_f16(cur_term)
+#define key_f17				 t_key_f17(cur_term)
+#define key_f18				 t_key_f18(cur_term)
+#define key_f19				 t_key_f19(cur_term)
+#define key_f20				 t_key_f20(cur_term)
+#define key_f21				 t_key_f21(cur_term)
+#define key_f22				 t_key_f22(cur_term)
+#define key_f23				 t_key_f23(cur_term)
+#define key_f24				 t_key_f24(cur_term)
+#define key_f25				 t_key_f25(cur_term)
+#define key_f26				 t_key_f26(cur_term)
+#define key_f27				 t_key_f27(cur_term)
+#define key_f28				 t_key_f28(cur_term)
+#define key_f29				 t_key_f29(cur_term)
+#define key_f30				 t_key_f30(cur_term)
+#define key_f31				 t_key_f31(cur_term)
+#define key_f32				 t_key_f32(cur_term)
+#define key_f33				 t_key_f33(cur_term)
+#define key_f34				 t_key_f34(cur_term)
+#define key_f35				 t_key_f35(cur_term)
+#define key_f36				 t_key_f36(cur_term)
+#define key_f37				 t_key_f37(cur_term)
+#define key_f38				 t_key_f38(cur_term)
+#define key_f39				 t_key_f39(cur_term)
+#define key_f40				 t_key_f40(cur_term)
+#define key_f41				 t_key_f41(cur_term)
+#define key_f42				 t_key_f42(cur_term)
+#define key_f43				 t_key_f43(cur_term)
+#define key_f44				 t_key_f44(cur_term)
+#define key_f45				 t_key_f45(cur_term)
+#define key_f46				 t_key_f46(cur_term)
+#define key_f47				 t_key_f47(cur_term)
+#define key_f48				 t_key_f48(cur_term)
+#define key_f49				 t_key_f49(cur_term)
+#define key_f50				 t_key_f50(cur_term)
+#define key_f51				 t_key_f51(cur_term)
+#define key_f52				 t_key_f52(cur_term)
+#define key_f53				 t_key_f53(cur_term)
+#define key_f54				 t_key_f54(cur_term)
+#define key_f55				 t_key_f55(cur_term)
+#define key_f56				 t_key_f56(cur_term)
+#define key_f57				 t_key_f57(cur_term)
+#define key_f58				 t_key_f58(cur_term)
+#define key_f59				 t_key_f59(cur_term)
+#define key_f60				 t_key_f60(cur_term)
+#define key_f61				 t_key_f61(cur_term)
+#define key_f62				 t_key_f62(cur_term)
+#define key_f63				 t_key_f63(cur_term)
+#define key_find			 t_key_find(cur_term)
+#define key_help			 t_key_help(cur_term)
+#define key_home			 t_key_home(cur_term)
+#define key_ic				 t_key_ic(cur_term)
+#define key_il				 t_key_il(cur_term)
+#define key_left			 t_key_left(cur_term)
+#define key_ll				 t_key_ll(cur_term)
+#define key_mark			 t_key_mark(cur_term)
+#define key_message			 t_key_message(cur_term)
+#define key_mouse			 t_key_mouse(cur_term)
+#define key_move			 t_key_move(cur_term)
+#define key_next			 t_key_next(cur_term)
+#define key_npage			 t_key_npage(cur_term)
+#define key_open			 t_key_open(cur_term)
+#define key_options			 t_key_options(cur_term)
+#define key_ppage			 t_key_ppage(cur_term)
+#define key_previous			 t_key_previous(cur_term)
+#define key_print			 t_key_print(cur_term)
+#define key_redo			 t_key_redo(cur_term)
+#define key_reference			 t_key_reference(cur_term)
+#define key_refresh			 t_key_refresh(cur_term)
+#define key_replace			 t_key_replace(cur_term)
+#define key_restart			 t_key_restart(cur_term)
+#define key_resume			 t_key_resume(cur_term)
+#define key_right			 t_key_right(cur_term)
+#define key_save			 t_key_save(cur_term)
+#define key_sbeg			 t_key_sbeg(cur_term)
+#define key_scancel			 t_key_scancel(cur_term)
+#define key_scommand			 t_key_scommand(cur_term)
+#define key_scopy			 t_key_scopy(cur_term)
+#define key_screate			 t_key_screate(cur_term)
+#define key_sdc				 t_key_sdc(cur_term)
+#define key_sdl				 t_key_sdl(cur_term)
+#define key_select			 t_key_select(cur_term)
+#define key_send			 t_key_send(cur_term)
+#define key_seol			 t_key_seol(cur_term)
+#define key_sexit			 t_key_sexit(cur_term)
+#define key_sf				 t_key_sf(cur_term)
+#define key_sfind			 t_key_sfind(cur_term)
+#define key_shelp			 t_key_shelp(cur_term)
+#define key_shome			 t_key_shome(cur_term)
+#define key_sic				 t_key_sic(cur_term)
+#define key_sleft			 t_key_sleft(cur_term)
+#define key_smessage			 t_key_smessage(cur_term)
+#define key_smove			 t_key_smove(cur_term)
+#define key_snext			 t_key_snext(cur_term)
+#define key_soptions			 t_key_soptions(cur_term)
+#define key_sprevious			 t_key_sprevious(cur_term)
+#define key_sprint			 t_key_sprint(cur_term)
+#define key_sr				 t_key_sr(cur_term)
+#define key_sredo			 t_key_sredo(cur_term)
+#define key_sreplace			 t_key_sreplace(cur_term)
+#define key_sright			 t_key_sright(cur_term)
+#define key_srsume			 t_key_srsume(cur_term)
+#define key_ssave			 t_key_ssave(cur_term)
+#define key_ssuspend			 t_key_ssuspend(cur_term)
+#define key_stab			 t_key_stab(cur_term)
+#define key_sundo			 t_key_sundo(cur_term)
+#define key_suspend			 t_key_suspend(cur_term)
+#define key_undo			 t_key_undo(cur_term)
+#define key_up				 t_key_up(cur_term)
+#define keypad_local			 t_keypad_local(cur_term)
+#define keypad_xmit			 t_keypad_xmit(cur_term)
+#define lab_f0				 t_lab_f0(cur_term)
+#define lab_f1				 t_lab_f1(cur_term)
+#define lab_f2				 t_lab_f2(cur_term)
+#define lab_f3				 t_lab_f3(cur_term)
+#define lab_f4				 t_lab_f4(cur_term)
+#define lab_f5				 t_lab_f5(cur_term)
+#define lab_f6				 t_lab_f6(cur_term)
+#define lab_f7				 t_lab_f7(cur_term)
+#define lab_f8				 t_lab_f8(cur_term)
+#define lab_f9				 t_lab_f9(cur_term)
+#define lab_f10				 t_lab_f10(cur_term)
+#define label_format			 t_label_format(cur_term)
+#define label_off			 t_label_off(cur_term)
+#define label_on			 t_label_on(cur_term)
+#define meta_off			 t_meta_off(cur_term)
+#define meta_on				 t_meta_on(cur_term)
+#define micro_column_address		 t_micro_column_address(cur_term)
+#define micro_down			 t_micro_down(cur_term)
+#define micro_left			 t_micro_left(cur_term)
+#define micro_right			 t_micro_right(cur_term)
+#define micro_row_address		 t_micro_row_address(cur_term)
+#define micro_up			 t_micro_up(cur_term)
+#define mouse_info			 t_mouse_info(cur_term)
+#define newline				 t_newline(cur_term)
+#define order_of_pins			 t_order_of_pins(cur_term)
+#define orig_colors			 t_orig_colors(cur_term)
+#define orig_pair			 t_orig_pair(cur_term)
+#define pad_char			 t_pad_char(cur_term)
+#define parm_dch			 t_parm_dch(cur_term)
+#define parm_delete_line		 t_parm_delete_line(cur_term)
+#define parm_down_cursor		 t_parm_down_cursor(cur_term)
+#define parm_down_micro			 t_parm_down_micro(cur_term)
+#define parm_ich			 t_parm_ich(cur_term)
+#define parm_index			 t_parm_index(cur_term)
+#define parm_insert_line		 t_parm_insert_line(cur_term)
+#define parm_left_cursor		 t_parm_left_cursor(cur_term)
+#define parm_left_micro			 t_parm_left_micro(cur_term)
+#define parm_right_cursor		 t_parm_right_cursor(cur_term)
+#define parm_right_micro		 t_parm_right_micro(cur_term)
+#define parm_rindex			 t_parm_rindex(cur_term)
+#define parm_up_cursor			 t_parm_up_cursor(cur_term)
+#define parm_up_micro			 t_parm_up_micro(cur_term)
+#define pc_term_options			 t_pc_term_options(cur_term)
+#define pkey_key			 t_pkey_key(cur_term)
+#define pkey_local			 t_pkey_local(cur_term)
+#define pkey_plab			 t_pkey_plab(cur_term)
+#define pkey_xmit			 t_pkey_xmit(cur_term)
+#define pkey_norm			 t_pkey_norm(cur_term)
+#define print_screen			 t_print_screen(cur_term)
+#define ptr_non				 t_ptr_non(cur_term)
+#define ptr_off				 t_ptr_off(cur_term)
+#define ptr_on				 t_ptr_on(cur_term)
+#define pulse				 t_pulse(cur_term)
+#define quick_dial			 t_quick_dial(cur_term)
+#define remove_clock			 t_remove_clock(cur_term)
+#define repeat_char			 t_repeat_char(cur_term)
+#define req_for_input			 t_req_for_input(cur_term)
+#define req_mouse_pos			 t_req_mouse_pos(cur_term)
+#define reset_1string			 t_reset_1string(cur_term)
+#define reset_2string			 t_reset_2string(cur_term)
+#define reset_3string			 t_reset_3string(cur_term)
+#define reset_file			 t_reset_file(cur_term)
+#define restore_cursor			 t_restore_cursor(cur_term)
+#define row_address			 t_row_address(cur_term)
+#define save_cursor			 t_save_cursor(cur_term)
+#define scancode_escape			 t_scancode_escape(cur_term)
+#define scroll_forward			 t_scroll_forward(cur_term)
+#define scroll_reverse			 t_scroll_reverse(cur_term)
+#define select_char_set			 t_select_char_set(cur_term)
+#define set0_des_seq			 t_set0_des_seq(cur_term)
+#define set1_des_seq			 t_set1_des_seq(cur_term)
+#define set2_des_seq			 t_set2_des_seq(cur_term)
+#define set3_des_seq			 t_set3_des_seq(cur_term)
+#define set_a_attributes		 t_set_a_attributes(cur_term)
+#define set_a_background		 t_set_a_background(cur_term)
+#define set_a_foreground		 t_set_a_foreground(cur_term)
+#define set_attributes			 t_set_attributes(cur_term)
+#define set_background			 t_set_background(cur_term)
+#define set_bottom_margin		 t_set_bottom_margin(cur_term)
+#define set_bottom_margin_parm		 t_set_bottom_margin_parm(cur_term)
+#define set_clock			 t_set_clock(cur_term)
+#define set_color_band			 t_set_color_band(cur_term)
+#define set_color_pair			 t_set_color_pair(cur_term)
+#define set_foreground			 t_set_foreground(cur_term)
+#define set_left_margin			 t_set_left_margin(cur_term)
+#define set_left_margin_parm		 t_set_left_margin_parm(cur_term)
+#define set_lr_margin			 t_set_lr_margin(cur_term)
+#define set_page_length			 t_set_page_length(cur_term)
+#define set_pglen_inch			 t_set_pglen_inch(cur_term)
+#define set_right_margin		 t_set_right_margin(cur_term)
+#define set_right_margin_parm		 t_set_right_margin_parm(cur_term)
+#define set_tab				 t_set_tab(cur_term)
+#define set_tb_margin			 t_set_tb_margin(cur_term)
+#define set_top_margin			 t_set_top_margin(cur_term)
+#define set_top_margin_parm		 t_set_top_margin_parm(cur_term)
+#define set_window			 t_set_window(cur_term)
+#define start_bit_image			 t_start_bit_image(cur_term)
+#define start_char_set_def		 t_start_char_set_def(cur_term)
+#define stop_bit_image			 t_stop_bit_image(cur_term)
+#define stop_char_set_def		 t_stop_char_set_def(cur_term)
+#define subscript_characters		 t_subscript_characters(cur_term)
+#define superscript_characters		 t_superscript_characters(cur_term)
+#define tab				 t_tab(cur_term)
+#define these_cause_cr			 t_these_cause_cr(cur_term)
+#define to_status_line			 t_to_status_line(cur_term)
+#define tone				 t_tone(cur_term)
+#define user0				 t_user0(cur_term)
+#define user1				 t_user1(cur_term)
+#define user2				 t_user2(cur_term)
+#define user3				 t_user3(cur_term)
+#define user4				 t_user4(cur_term)
+#define user5				 t_user5(cur_term)
+#define user6				 t_user6(cur_term)
+#define user7				 t_user7(cur_term)
+#define user8				 t_user8(cur_term)
+#define user9				 t_user9(cur_term)
+#define underline_char			 t_underline_char(cur_term)
+#define up_half_line			 t_up_half_line(cur_term)
+#define wait_tone			 t_wait_tone(cur_term)
+#define xoff_character			 t_xoff_character(cur_term)
+#define xon_character			 t_xon_character(cur_term)
+#define zero_motion			 t_zero_motion(cur_term)
+
+/*
+ * STRING DESCRIPTIONS
+ *
+ * acs_chars: Graphic charset pairs aAbBcC
+ * alt_scancode_esc: Alternate escape for scancode emulation
+ * back_tab: Back tab
+ * bell: Audible signal (bell)
+ * bit_image_carriage_return: Move to beginning of same row
+ * bit_image_newline: Move to next row of the bit image
+ * bit_image_repeat: Repeat bit-image cell #1 #2 times
+ * carriage_return: Carriage return
+ * change_char_pitch: Change number of characters per inch
+ * change_line_pitch: Change number of lines per inch
+ * change_res_horz: Change horizontal resolution
+ * change_res_vert: Change vertical resolution
+ * change_scroll_region: Change to lines #1 through #2 (VT100)
+ * char_padding: Like ip but when in replace mode
+ * char_set_names: Returns a list of character set names
+ * clear_all_tabs: Clear all tab stops
+ * clear_margins: Clear all margins (top, bottom and sides)
+ * clear_screen: Clear screen and home cursor
+ * clr_bol: Clear to beginning of line, inclusive
+ * clr_eol: Clear to end of line
+ * clr_eos: Clear to end of display
+ * code_set_init: Init sequence for multiple codesets
+ * color_names: Give name for colour #1
+ * column_address: Set horizontal position to absolute #1
+ * command_character: Terminal settable cmd character in prototype
+ * create_window: Define win #1 to go from #2,#3 to #4,#5
+ * cursor_address: Move to row #1, col #2
+ * cursor_down: Down one line
+ * cursor_home: Home cursor (if no cup)
+ * cursor_invisible: Make cursor invisible
+ * cursor_left: Move left one space
+ * cursor_mem_address: Memory relative cursor addressing
+ * cursor_normal: Make cursor appear normal (under vs/vi)
+ * cursor_right: Non-destructive space (cursor or carriage right)
+ * cursor_to_ll: Last line, first column (if no cup)
+ * cursor_up: Upline (cursor up)
+ * cursor_visible: Make cursor very visible
+ * define_bit_image_region: Define rectangular bit-image region
+ * define_char: Define a character in a character set
+ * delete_character: Delete character
+ * delete_line: Delete line
+ * device_type: Indicate language/codeset support
+ * dial_phone: Dial phone number #1
+ * dis_status_line: Disable status line
+ * display_clock: Display time-of-day clock
+ * display_pc_char: Display PC character
+ * down_half_time: Half-line down (forward 1/2 linefeed)
+ * ena_acs: Enable alternate character set
+ * end_bit_image_region: End a bit-image region
+ * enter_alt_charset_mode: Start alternate character set
+ * enter_am_mode: Turn on automatic margins
+ * enter_blink_mode: Turn on blinking
+ * enter_bold_mode: Turn on bold (extra bright) mode
+ * enter_ca_mode: String to begin programs that use cup
+ * enter_delete_mode: Delete mode (enter)
+ * enter_dim_mode: Turn on half-bright mode
+ * enter_doublewide_mode: Enable double wide printing
+ * enter_draft_quality: Set draft qualify print
+ * enter_horizontal_hl_mode: Turn on horizontal highlight mode
+ * enter_insert_mode: Insert mode (enter)
+ * enter_italics_mode: Enable italics
+ * enter_left_hl_mode: Turn on left highlight mode
+ * enter_leftward_mode: Enable leftward carriage motion
+ * enter_low_hl_mode: Turn on low highlight mode
+ * enter_micro_mode: Enable micro motion capabilities
+ * enter_near_quality_letter: Set near-letter quality print
+ * enter_normal_quality: Set normal quality print
+ * enter_pc_charset_mode: Enter PC character display mode
+ * enter_protected_mode: Turn on protected mode
+ * enter_reverse_mode: Turn on reverse video mode
+ * enter_right_hl_mode: Turn on right highlight mode
+ * enter_scancode_mode: Enter PC scancode mode
+ * enter_secure_mode: Turn on blank mode (characters invisible)
+ * enter_shadow_mode: Enable shadow printing
+ * enter_standout_mode: Begin standout mode
+ * enter_subscript_mode: Enable subscript printing
+ * enter_superscript_mode: Enable superscript printing
+ * enter_top_hl_mode: Turn on top highlight mode
+ * enter_underline_mode: Start underscore mode
+ * enter_upward_mode: Enable upward carriage motion
+ * enter_vertical_hl_mode: Turn on verticle highlight mode
+ * enter_xon_mode: Turn on xon/xoff handshaking
+ * erase_chars: Erase #1 characters
+ * exit_alt_charset_mode: End alternate character set
+ * exit_am_mode: Turn off automatic margins
+ * exit_attribute_mode: Turn off all attributes
+ * exit_ca_mode: String to end programs that use cup
+ * exit_delete_mode: End delete mode
+ * exit_doublewide_mode: Disable double wide printing
+ * exit_insert_mode: End insert mode
+ * exit_italics_mode: Disable italics
+ * exit_leftward_mode: Enable rightward (normal) carriage motion
+ * exit_micro_mode: Disable micro motion capabilities
+ * exit_pc_charset_mode: Disable PC character display mode
+ * exit_scancode_mode: Disable PC scancode mode
+ * exit_shadow_mode: Disable shadow printing
+ * exit_standout_mode: End standout mode
+ * exit_subscript_mode: Disable subscript printing
+ * exit_superscript_mode: Disable superscript printing
+ * exit_underline_mode: End underscore mode
+ * exit_upward_mode: Enable downward (normal) carriage motion
+ * exit_xon_mode: Turn off xon/xoff handshaking
+ * fixed_pause: Pause for 2-3 seconds
+ * flash_hook: Flash the switch hook
+ * flash_screen: Visible bell (may move cursor)
+ * form_feed: Hardcopy terminal eject page
+ * from_status_line: Return from status line
+ * get_mouse: Curses should get button events
+ * goto_window: Go to window #1
+ * hangup: Hang-up phone
+ * init_1string: Terminal or printer initialisation string
+ * init_2string: Terminal or printer initialisation string
+ * init_3string: Terminal or printer initialisation string
+ * init_file: Name of initialisation file
+ * init_prog: Path name of program for initialisation
+ * initialize_color: Set colour #1 to RGB #2, #3, #4
+ * initialize_pair: Set colour-pair #1 to fg #2, bg #3
+ * insert_character: Insert character
+ * insert_line: Add new blank line
+ * insert_padding: Insert pad after character inserted
+ * key_a1: upper left of keypad
+ * key_a3: upper right of keypad
+ * key_b2: center of keypad
+ * key_backspace: set by backspace key
+ * key_beg: 1
+ * key_btab: sent by back-tab key
+ * key_c1: lower left of keypad
+ * key_c3: lower right of keypad
+ * key_cancel: 2
+ * key_catab: sent by clear-all-tabs key
+ * key_clear: sent by clear-screen or erase key
+ * key_close: 3
+ * key_command: 4
+ * key_copy: 5
+ * key_create: 6
+ * key_ctab: sent by clear-tab key
+ * key_dc: sent by delete-character key
+ * key_dl: sent by delete-line key
+ * key_down: sent by terminal down-arrow key
+ * key_eic: sent by rmir or smir in insert mode
+ * key_end: 7
+ * key_enter: 8
+ * key_eol: sent by clear-to-end-of-line key
+ * key_eos: sent by clear-to-end-of-screen key
+ * key_exit: 9
+ * key_f0: sent by function key f0
+ * key_f1: sent by function key f1
+ * key_f2: sent by function key f2
+ * key_f3: sent by function key f3
+ * key_f4: sent by function key f4
+ * key_f5: sent by function key f5
+ * key_f6: sent by function key f6
+ * key_f7: sent by function key f7
+ * key_f8: sent by function key f8
+ * key_f9: sent by function key f9
+ * key_f10: sent by function key f10
+ * key_f11: sent by function key f11
+ * key_f12: sent by function key f12
+ * key_f13: sent by function key f13
+ * key_f14: sent by function key f14
+ * key_f15: sent by function key f15
+ * key_f16: sent by function key f16
+ * key_f17: sent by function key f17
+ * key_f18: sent by function key f18
+ * key_f19: sent by function key f19
+ * key_f20: sent by function key f20
+ * key_f21: sent by function key f21
+ * key_f22: sent by function key f22
+ * key_f23: sent by function key f23
+ * key_f24: sent by function key f24
+ * key_f25: sent by function key f25
+ * key_f26: sent by function key f26
+ * key_f27: sent by function key f27
+ * key_f28: sent by function key f28
+ * key_f29: sent by function key f29
+ * key_f30: sent by function key f30
+ * key_f31: sent by function key f31
+ * key_f32: sent by function key f32
+ * key_f33: sent by function key f33
+ * key_f34: sent by function key f34
+ * key_f35: sent by function key f35
+ * key_f36: sent by function key f36
+ * key_f37: sent by function key f37
+ * key_f38: sent by function key f38
+ * key_f39: sent by function key f39
+ * key_f40: sent by function key f40
+ * key_f41: sent by function key f41
+ * key_f42: sent by function key f42
+ * key_f43: sent by function key f43
+ * key_f44: sent by function key f44
+ * key_f45: sent by function key f45
+ * key_f46: sent by function key f46
+ * key_f47: sent by function key f47
+ * key_f48: sent by function key f48
+ * key_f49: sent by function key f49
+ * key_f50: sent by function key f50
+ * key_f51: sent by function key f51
+ * key_f52: sent by function key f52
+ * key_f53: sent by function key f53
+ * key_f54: sent by function key f54
+ * key_f55: sent by function key f55
+ * key_f56: sent by function key f56
+ * key_f57: sent by function key f57
+ * key_f58: sent by function key f58
+ * key_f59: sent by function key f59
+ * key_f60: sent by function key f60
+ * key_f61: sent by function key f61
+ * key_f62: sent by function key f62
+ * key_f63: sent by function key f63
+ * key_find: 0
+ * key_help: sent by help key
+ * key_home: sent by home key
+ * key_ic: sent by ins-char/enter ins-mode key
+ * key_il: sent by insert-line key
+ * key_left: sent by terminal left-arrow key
+ * key_ll: sent by home-down key
+ * key_mark: sent by mark key
+ * key_message: sent by message key
+ * key_mouse: 0631, Mouse event has occured
+ * key_move: sent by move key
+ * key_next: sent by next-object key
+ * key_npage: sent by next-page key
+ * key_open: sent by open key
+ * key_options: sent by options key
+ * key_ppage: sent by previous-page key
+ * key_previous: sent by previous-object key
+ * key_print: sent by print or copy key
+ * key_redo: sent by redo key
+ * key_reference: sent by ref(erence) key
+ * key_refresh: sent by refresh key
+ * key_replace: sent by replace key
+ * key_restart: sent by restart key
+ * key_resume: sent by resume key
+ * key_right: sent by terminal right-arrow key
+ * key_save: sent by save key
+ * key_sbeg: sent by shifted beginning key
+ * key_scancel: sent by shifted cancel key
+ * key_scommand: sent by shifted command key
+ * key_scopy: sent by shifted copy key
+ * key_screate: sent by shifted create key
+ * key_sdc: sent by shifted delete-char key
+ * key_sdl: sent by shifted delete-line key
+ * key_select: sent by select key
+ * key_send: sent by shifted end key
+ * key_seol: sent by shifted clear-line key
+ * key_sexit: sent by shited exit key
+ * key_sf: sent by scroll-forward/down key
+ * key_sfind: sent by shifted find key
+ * key_shelp: sent by shifted help key
+ * key_shome: sent by shifted home key
+ * key_sic: sent by shifted input key
+ * key_sleft: sent by shifted left-arrow key
+ * key_smessage: sent by shifted message key
+ * key_smove: sent by shifted move key
+ * key_snext: sent by shifted next key
+ * key_soptions: sent by shifted options key
+ * key_sprevious: sent by shifted prev key
+ * key_sprint: sent by shifted print key
+ * key_sr: sent by scroll-backwards/up key
+ * key_sredo: sent by shifted redo key
+ * key_sreplace: sent by shifted replace key
+ * key_sright: sent by shifted right-arrow key
+ * key_srsume: sent by shifted resume key
+ * key_ssave: sent by shifted save key
+ * key_ssuspend: sent by shifted suspend key
+ * key_stab: sent by set-tab key
+ * key_sundo: sent by shifted undo key
+ * key_suspend: sent by suspend key
+ * key_undo: sent by undo key
+ * key_up: sent by terminal up-arrow key
+ * keypad_local: Out of "keypad-transmit" mode
+ * keypad_xmit: Put terminal in "keypad-transmit" mode
+ * lab_f0: Labels on function key f0 if not f0
+ * lab_f1: Labels on function key f1 if not f1
+ * lab_f2: Labels on function key f2 if not f2 
+ * lab_f3: Labels on function key f3 if not f3
+ * lab_f4: Labels on function key f4 if not f4
+ * lab_f5: Labels on function key f5 if not f5
+ * lab_f6: Labels on function key f6 if not f6
+ * lab_f7: Labels on function key f7 if not f7
+ * lab_f8: Labels on function key f8 if not f8
+ * lab_f9: Labels on function key f9 if not f9
+ * lab_f10: Labels on function key f10 if not f10
+ * label_format: Label format
+ * label_off: Turn off soft labels
+ * label_on: Turn on soft labels
+ * meta_off: Turn off "meta mode"
+ * meta_on: Turn on "meta mode" (8th bit)
+ * micro_column_address: Like column_address for micro adjustment
+ * micro_down: Like cursor_down for micro adjustment
+ * micro_left: Like cursor_left for micro adjustment
+ * micro_right: Like cursor_right for micro adjustment
+ * micro_row_address: Like row_address for micro adjustment
+ * micro_up: Like cursor_up for micro adjustment
+ * mouse_info: Mouse status information
+ * newline: Newline (behaves like cr followed by lf)
+ * order_of_pins: Matches software bits to print-head pins
+ * orig_colors: Set all colour(-pair)s to original ones
+ * orig_pair: Set default colour-pair to the original one
+ * pad_char: Pad character (rather than NULL)
+ * parm_dch: Delete #1 chars
+ * parm_delete_line: Delete #1 lines
+ * parm_down_cursor: Move down #1 lines
+ * parm_down_micro: Like parm_down_cursor for micro adjustment
+ * parm_ich: Insert #1 blank chars
+ * parm_index: Scroll forward #1 lines
+ * parm_insert_line: Add #1 new blank lines
+ * parm_left_cursor: Move cursor left #1 lines
+ * parm_left_micro: Like parm_left_cursor for micro adjustment
+ * parm_right_cursor: Move right #1 spaces
+ * parm_right_micro: Like parm_right_cursor for micro adjustment
+ * parm_rindex: Scroll backward #1 lines
+ * parm_up_cursor: Move cursor up #1 lines
+ * parm_up_micro: Like parm_up_cursor for micro adjustment
+ * pc_term_options: PC terminal options
+ * pkey_key: Prog funct key #1 to type string #2
+ * pkey_local: Prog funct key #1 to execute string #2
+ * pkey_plab: Prog key #1 to xmit string #2 and show string #3
+ * pkey_xmit: Prog funct key #1 to xmit string #2
+ * pkey_norm: Prog label #1 to show string #3
+ * print_screen: Print contents of screen
+ * ptr_non: Turn off printer for #1 bytes
+ * ptr_off: Turn off the printer
+ * ptr_on: Turn on the printer
+ * pulse: Select pulse dialing
+ * quick_dial: Dial phone number #1, without progress detection
+ * remove_clock: Remove time-of-day clock
+ * repeat_char: Repeat char #1 #2 times
+ * req_for_input: Send next input char (for ptys)
+ * req_mouse_pos: Request mouse position report
+ * reset_1string: Reset terminal completely to sane modes
+ * reset_2string: Reset terminal completely to sane modes
+ * reset_3string: Reset terminal completely to sane modes
+ * reset_file: Name of file containing reset string
+ * restore_cursor: Restore cursor to position of last sc
+ * row_address: Set vertical position to absolute #1
+ * save_cursor: Save cursor position
+ * scancode_escape: Escape for scancode emulation
+ * scroll_forward: Scroll text up
+ * scroll_reverse: Scroll text down
+ * select_char_set: Select character set
+ * set0_des_seq: Shift into codeset 0 (EUC set 0, ASCII)
+ * set1_des_seq: Shift into codeset 1
+ * set2_des_seq: Shift into codeset 2
+ * set3_des_seq: Shift into codeset 3
+ * set_a_attributes: Define second set of video attributes #1-#6
+ * set_a_background: Set background colour to #1 using ANSI escape
+ * set_a_foreground: Set foreground colour to #1 using ANSI escape
+ * set_attributes: Define first set of video attributes #1-#9
+ * set_background: Set background colour to #1
+ * set_bottom_margin: Set bottom margin at current line
+ * set_bottom_margin_parm: Set bottom margin at line #1 or #2 lines from bottom
+ * set_clock: Set clock to hours (#1), minutes (#2), seconds (#3)
+ * set_color_band: Change ribbon to colour #1
+ * set_color_pair: Set current colour pair to #1
+ * set_foreground: Set foreground colour to #1
+ * set_left_margin: Set left margin at current column
+ * set_left_margin_parm: Set left (right) margin at column #1 (#2)
+ * set_lr_margin: Sets both left and right margins
+ * set_page_length: Set page length to #1 lines
+ * set_pglen_inch: Set page length to #1 hundredth of an inch
+ * set_right_margin: Set right margin at current column
+ * set_right_margin_parm: Set right margin at #1
+ * set_tab: Set a tab in all rows, current column
+ * set_tb_margin: Sets both top and bottom margins
+ * set_top_margin: Set top margin at current line
+ * set_top_margin_parm: Set top (bottom) margin at line #1 (#2)
+ * set_window: Current window is lines #1-#2 cols #3-#4
+ * start_bit_image: Start printing bit image graphics
+ * start_char_set_def: Start definition of a character set
+ * stop_bit_image: End printing bit image graphics
+ * stop_char_set_def: End definition of a character set
+ * subscript_characters: List of "subscript-able" characters
+ * superscript_characters: List of "superscript-able" characters
+ * tab: Tab to next 8-space hardware tab stop
+ * these_cause_cr: Printing any of these characters causes cr
+ * to_status_line: Go to status line, col #1
+ * tone: Select tone touch dialing
+ * user0: User string 0
+ * user1: User string 1
+ * user2: User string 2
+ * user3: User string 3
+ * user4: User string 4
+ * user5: User string 5
+ * user6: User string 6
+ * user7: User string 7
+ * user8: User string 8
+ * user9: User string 9
+ * underline_char: Underscore one char and move past it
+ * up_half_line: Half-line up (reverse 1/2 linefeed)
+ * wait_tone: Wait for dial tone
+ * xoff_character: X-off character
+ * xon_character: X-on character
+ * zero_motion: No motion for the subsequent character
+ */
+
+#ifndef _TERMINFO
+typedef struct {
+	int fildes;
+	/* We need to expose these so that the macros work */
+	const char *name;
+	const char *desc;
+	const signed char *flags;
+	const short *nums;
+	const char **strs;
+} TERMINAL;
+#endif
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+extern TERMINAL *cur_term;
+
+/* setup functions */
+int		setupterm(const char *, int, int *);
+TERMINAL *	set_curterm(TERMINAL *);
+int		del_curterm(TERMINAL *);
+char *		termname(void);
+char *		longname(void);
+
+/* information functions */
+int		tigetflag(const char *);
+int		tigetnum(const char *);
+char *		tigetstr(const char *);
+/* You should note that the spec allows stuffing a char * into a long
+ * if the platform allows and the %pN is followed immediately by %l or %s */
+char *		tparm(const char *, long, long, long, long, long,
+		long, long, long, long);
+
+/* Non standard functions, but provide a level of thread safety */
+int		ti_setupterm(TERMINAL **, const char *, int, int *);
+int		ti_getflag(const TERMINAL *, const char *);
+int		ti_getnum(const TERMINAL *, const char *);
+const char *	ti_getstr(const TERMINAL *, const char *);
+char *		ti_parm(TERMINAL *, const char *,
+    long, long, long, long, long, long, long, long, long);
+
+/* These functions do not use PC or speed, but the terminal */
+int		ti_puts(const TERMINAL *, const char *, int,
+    int (*)(int, void *), void *);
+int		ti_putp(const TERMINAL *, const char *);
+
+/* Using tparm can be kunkly, so provide a variadic function
+ * Numbers have to be passed as int */
+/* This is not standard, but ncurses also provides this */
+char *		tiparm(const char *, ...);
+/* And a thread safe version */
+char *		ti_tiparm(TERMINAL *, const char *, ...);
+
+#ifdef TPARM_TLPARM
+/* Same as the above, but numbers have to be passed as long */
+char *		tlparm(const char *, ...);
+/* And a thread safe version */
+char *		ti_tlparm(TERMINAL *, const char *, ...);
+#endif
+
+/* Default to X/Open tparm, but allow it to be variadic also */
+#ifdef TPARM_VARARGS
+#  define tparm	tiparm
+#  define ti_parm ti_tiparm
+#endif
+
+/* Convert a termcap string into a terminfo string.
+ * The passed string is destroyed and the return string needs to be freed. */
+char *		captoinfo(char *);
+
+/* POSIX says that term.h should also pull in our termcap definitions. */
+#include <termcap.h>
+
+__END_DECLS
+#endif

Property changes on: lab4/.minix-src/include/term.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/tzfile.h
===================================================================
--- lab4/.minix-src/include/tzfile.h	(nonexistent)
+++ lab4/.minix-src/include/tzfile.h	(revision 13)
@@ -0,0 +1,170 @@
+/*	$NetBSD: tzfile.h,v 1.8 2015/07/11 16:40:53 christos Exp $	*/
+
+#ifndef _TZFILE_H_
+#define _TZFILE_H_
+
+/*
+** This file is in the public domain, so clarified as of
+** 1996-06-05 by Arthur David Olson.
+*/
+
+/*
+** This header is for use ONLY with the time conversion code.
+** There is no guarantee that it will remain unchanged,
+** or that it will remain at all.
+** Do NOT copy it to any system include directory.
+** Thank you!
+*/
+
+/*
+** Information about time zone files.
+*/
+
+#ifndef TZDIR		/* Time zone object file directory */
+#define TZDIR		"/usr/share/zoneinfo"
+#endif /* !defined TZDIR */
+
+#ifndef TZDEFAULT
+#define TZDEFAULT	"/etc/localtime"
+#endif /* !defined TZDEFAULT */
+
+#ifndef TZDEFRULES
+#define TZDEFRULES	"posixrules"
+#endif /* !defined TZDEFRULES */
+
+/*
+** Each file begins with. . .
+*/
+
+#define	TZ_MAGIC	"TZif"
+
+struct tzhead {
+	char	tzh_magic[4];		/* TZ_MAGIC */
+	char	tzh_version[1];		/* '\0' or '2' or '3' as of 2013 */
+	char	tzh_reserved[15];	/* reserved; must be zero */
+	char	tzh_ttisgmtcnt[4];	/* coded number of trans. time flags */
+	char	tzh_ttisstdcnt[4];	/* coded number of trans. time flags */
+	char	tzh_leapcnt[4];		/* coded number of leap seconds */
+	char	tzh_timecnt[4];		/* coded number of transition times */
+	char	tzh_typecnt[4];		/* coded number of local time types */
+	char	tzh_charcnt[4];		/* coded number of abbr. chars */
+};
+
+/*
+** . . .followed by. . .
+**
+**	tzh_timecnt (char [4])s		coded transition times a la time(2)
+**	tzh_timecnt (unsigned char)s	types of local time starting at above
+**	tzh_typecnt repetitions of
+**		one (char [4])		coded UT offset in seconds
+**		one (unsigned char)	used to set tm_isdst
+**		one (unsigned char)	that's an abbreviation list index
+**	tzh_charcnt (char)s		'\0'-terminated zone abbreviations
+**	tzh_leapcnt repetitions of
+**		one (char [4])		coded leap second transition times
+**		one (char [4])		total correction after above
+**	tzh_ttisstdcnt (char)s		indexed by type; if 1, transition
+**					time is standard time, if 0,
+**					transition time is wall clock time
+**					if absent, transition times are
+**					assumed to be wall clock time
+**	tzh_ttisgmtcnt (char)s		indexed by type; if 1, transition
+**					time is UT, if 0,
+**					transition time is local time
+**					if absent, transition times are
+**					assumed to be local time
+*/
+
+/*
+** If tzh_version is '2' or greater, the above is followed by a second instance
+** of tzhead and a second instance of the data in which each coded transition
+** time uses 8 rather than 4 chars,
+** then a POSIX-TZ-environment-variable-style string for use in handling
+** instants after the last transition time stored in the file
+** (with nothing between the newlines if there is no POSIX representation for
+** such instants).
+**
+** If tz_version is '3' or greater, the above is extended as follows.
+** First, the POSIX TZ string's hour offset may range from -167
+** through 167 as compared to the POSIX-required 0 through 24.
+** Second, its DST start time may be January 1 at 00:00 and its stop
+** time December 31 at 24:00 plus the difference between DST and
+** standard time, indicating DST all year.
+*/
+
+/*
+** In the current implementation, "tzset()" refuses to deal with files that
+** exceed any of the limits below.
+*/
+
+#ifndef TZ_MAX_TIMES
+#define TZ_MAX_TIMES	2000
+#endif /* !defined TZ_MAX_TIMES */
+
+#ifndef TZ_MAX_TYPES
+/* This must be at least 17 for Europe/Samara and Europe/Vilnius.  */
+#define TZ_MAX_TYPES	256 /* Limited by what (unsigned char)'s can hold */
+#endif /* !defined TZ_MAX_TYPES */
+
+#ifndef TZ_MAX_CHARS
+#define TZ_MAX_CHARS	50	/* Maximum number of abbreviation characters */
+				/* (limited by what unsigned chars can hold) */
+#endif /* !defined TZ_MAX_CHARS */
+
+#ifndef TZ_MAX_LEAPS
+#define TZ_MAX_LEAPS	50	/* Maximum number of leap second corrections */
+#endif /* !defined TZ_MAX_LEAPS */
+
+#define SECSPERMIN	60
+#define MINSPERHOUR	60
+#define HOURSPERDAY	24
+#define DAYSPERWEEK	7
+#define DAYSPERNYEAR	365
+#define DAYSPERLYEAR	366
+#define SECSPERHOUR	(SECSPERMIN * MINSPERHOUR)
+#define SECSPERDAY	((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
+#define MONSPERYEAR	12
+
+#define TM_SUNDAY	0
+#define TM_MONDAY	1
+#define TM_TUESDAY	2
+#define TM_WEDNESDAY	3
+#define TM_THURSDAY	4
+#define TM_FRIDAY	5
+#define TM_SATURDAY	6
+
+#define TM_JANUARY	0
+#define TM_FEBRUARY	1
+#define TM_MARCH	2
+#define TM_APRIL	3
+#define TM_MAY		4
+#define TM_JUNE		5
+#define TM_JULY		6
+#define TM_AUGUST	7
+#define TM_SEPTEMBER	8
+#define TM_OCTOBER	9
+#define TM_NOVEMBER	10
+#define TM_DECEMBER	11
+
+#define TM_YEAR_BASE	1900
+
+#define EPOCH_YEAR	1970
+#define EPOCH_WDAY	TM_THURSDAY
+
+#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
+
+/*
+** Since everything in isleap is modulo 400 (or a factor of 400), we know that
+**	isleap(y) == isleap(y % 400)
+** and so
+**	isleap(a + b) == isleap((a + b) % 400)
+** or
+**	isleap(a + b) == isleap(a % 400 + b % 400)
+** This is true even if % means modulo rather than Fortran remainder
+** (which is allowed by C89 but not C99).
+** We use this to avoid addition overflow problems.
+*/
+
+#define isleap_sum(a, b)	isleap((a) % 400 + (b) % 400)
+
+#endif /* !defined _TZFILE_H_ */

Property changes on: lab4/.minix-src/include/tzfile.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/unctrl.h
===================================================================
--- lab4/.minix-src/include/unctrl.h	(nonexistent)
+++ lab4/.minix-src/include/unctrl.h	(revision 13)
@@ -0,0 +1,58 @@
+/*	$NetBSD: unctrl.h,v 1.5 2015/05/28 06:28:37 wiz Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)unctrl.h	8.1 (Berkeley) 5/31/93
+ */
+
+#ifndef _UNCTRL_H_
+#define _UNCTRL_H_
+
+#include <sys/cdefs.h>
+#ifdef HAVE_WCHAR
+#include <wchar.h>
+#include <curses.h>
+#endif /* HAVE_WCHAR */
+
+__BEGIN_DECLS
+extern const char * const  __unctrl[];		/* Control strings. */
+extern const unsigned char __unctrllen[];	/* Control strings length. */
+#ifdef HAVE_WCHAR
+extern const wchar_t * const  __wunctrl[];	/* Wide char control strings. */
+#endif /* HAVE_WCHAR */
+__END_DECLS
+
+/* 8-bit ASCII characters. */
+#define	unctrl(c)		__unctrl[((unsigned char)c) & 0xff]
+#define	unctrllen(c)	__unctrllen[((unsigned char)c) & 0xff]
+
+#ifdef HAVE_WCHAR
+#define	wunctrl(wc)		__wunctrl[( int )((wc)->vals[ 0 ]) & 0xff]
+#endif /* HAVE_WCHAR */
+#endif /* _UNCTRL_H_ */

Property changes on: lab4/.minix-src/include/unctrl.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ttyent.h
===================================================================
--- lab4/.minix-src/include/ttyent.h	(nonexistent)
+++ lab4/.minix-src/include/ttyent.h	(revision 13)
@@ -0,0 +1,80 @@
+/*	$NetBSD: ttyent.h,v 1.15 2013/04/27 21:35:25 joerg Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ttyent.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef	_TTYENT_H_
+#define	_TTYENT_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+#define	_PATH_TTYS	"/etc/ttys"
+
+#define	_TTYS_OFF	"off"
+#define	_TTYS_ON	"on"
+#define	_TTYS_SECURE	"secure"
+#define	_TTYS_WINDOW	"window"
+#define	_TTYS_CLASS	"class"
+#define	_TTYS_LOCAL	"local"
+#define	_TTYS_RTSCTS	"rtscts"
+#define	_TTYS_DTRCTS    "dtrcts"
+#define	_TTYS_SOFTCAR	"softcar"
+#define	_TTYS_MDMBUF	"mdmbuf"
+
+struct ttyent {
+	__aconst char *ty_name;	/* terminal device name */
+	__aconst char *ty_getty;/* command to execute, usually getty */
+	__aconst char *ty_type;	/* terminal type for termcap */
+#define	TTY_ON		0x01	/* enable logins (start ty_getty program) */
+#define	TTY_SECURE	0x02	/* allow uid of 0 to login */
+#define	TTY_LOCAL	0x04	/* set 'CLOCAL' on open (dev. specific) */
+#define	TTY_RTSCTS	0x08	/* set 'CRTSCTS' on open (dev. specific) */
+#define	TTY_SOFTCAR	0x10	/* ignore hardware carrier (dev. spec.) */
+#define	TTY_MDMBUF	0x20	/* set 'MDMBUF' on open (dev. specific) */
+#define TTY_DTRCTS      0x40    /* set 'CDTRCTS' on open (dev. specific) */
+	int	ty_status;	/* status flags */
+	__aconst char *ty_window;/* command to start up window manager */
+	__aconst char *ty_comment;/* comment field */
+	__aconst char *ty_class;/* category of tty usage */
+};
+
+__BEGIN_DECLS
+struct ttyent *getttyent(void);
+struct ttyent *getttynam(const char *);
+#if defined(_NETBSD_SOURCE)
+int setttyentpath(const char *);
+#endif /* defined(_NETBSD_SOURCE) */
+int setttyent(void);
+int endttyent(void);
+__END_DECLS
+
+#endif /* !_TTYENT_H_ */

Property changes on: lab4/.minix-src/include/ttyent.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/utime.h
===================================================================
--- lab4/.minix-src/include/utime.h	(nonexistent)
+++ lab4/.minix-src/include/utime.h	(revision 13)
@@ -0,0 +1,57 @@
+/*	$NetBSD: utime.h,v 1.9 2009/01/11 03:04:12 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)utime.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef	_UTIME_H_
+#define	_UTIME_H_
+
+#include <machine/ansi.h>
+
+#ifdef	_BSD_TIME_T_
+typedef	_BSD_TIME_T_	time_t;
+#undef	_BSD_TIME_T_
+#endif
+
+struct utimbuf {
+	time_t actime;		/* Access time */
+	time_t modtime;		/* Modification time */
+};
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+int utime(const char *, const struct utimbuf *) __RENAME(__utime50);
+#endif
+__END_DECLS
+
+#endif /* !_UTIME_H_ */

Property changes on: lab4/.minix-src/include/utime.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ulimit.h
===================================================================
--- lab4/.minix-src/include/ulimit.h	(nonexistent)
+++ lab4/.minix-src/include/ulimit.h	(revision 13)
@@ -0,0 +1,44 @@
+/*	$NetBSD: ulimit.h,v 1.3 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _ULIMIT_H_
+#define _ULIMIT_H_
+
+#define UL_GETFSIZE	1	/* Get maximum file size */
+#define UL_SETFSIZE	2	/* Set maximum file size */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+long int ulimit(int, ...);
+__END_DECLS
+
+#endif /* !_ULIMIT_H_ */

Property changes on: lab4/.minix-src/include/ulimit.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/varargs.h
===================================================================
--- lab4/.minix-src/include/varargs.h	(nonexistent)
+++ lab4/.minix-src/include/varargs.h	(revision 13)
@@ -0,0 +1,45 @@
+/*	$NetBSD: varargs.h,v 1.3 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matthias Scheler.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _VARARGS_H_
+#define	_VARARGS_H_
+
+#include <sys/cdefs.h>
+
+#if __GNUC_PREREQ__(3, 3)
+#error "GCC 3.3 and newer no longer implements <varargs.h>."
+#error "Revise your code to use <stdarg.h>."
+#else
+#include <machine/varargs.h>
+#endif
+
+#endif /* !_VARARGS_H_ */
+

Property changes on: lab4/.minix-src/include/varargs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/util.h
===================================================================
--- lab4/.minix-src/include/util.h	(nonexistent)
+++ lab4/.minix-src/include/util.h	(revision 13)
@@ -0,0 +1,164 @@
+/*	$NetBSD: util.h,v 1.68 2015/09/24 14:39:37 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1995
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _UTIL_H_
+#define	_UTIL_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/ansi.h>
+#include <sys/inttypes.h>
+
+#ifdef  _BSD_TIME_T_
+typedef _BSD_TIME_T_    time_t;
+#undef  _BSD_TIME_T_
+#endif
+#ifdef  _BSD_SIZE_T_
+typedef _BSD_SIZE_T_    size_t;
+#undef  _BSD_SIZE_T_
+#endif
+ 
+#if defined(_POSIX_C_SOURCE)
+#ifndef __VA_LIST_DECLARED
+typedef __va_list va_list;
+#define __VA_LIST_DECLARED
+#endif
+#endif
+
+#define	PIDLOCK_NONBLOCK	1
+#define	PIDLOCK_USEHOSTNAME	2
+
+#define	PW_POLICY_BYSTRING	0
+#define	PW_POLICY_BYPASSWD	1
+#define	PW_POLICY_BYGROUP	2
+
+__BEGIN_DECLS
+struct disklabel;
+struct iovec;
+struct passwd;
+struct termios;
+struct utmp;
+struct utmpx;
+struct winsize;
+struct sockaddr;
+
+char	       *flags_to_string(unsigned long, const char *);
+pid_t		forkpty(int *, char *, struct termios *, struct winsize *);
+const char     *getbootfile(void);
+int		getbyteorder(void);
+off_t		getlabeloffset(void);
+int		getlabelsector(void);
+int		getlabelusesmbr(void);
+int		getmaxpartitions(void);
+int		getrawpartition(void);
+const char     *getdiskrawname(char *, size_t, const char *);
+const char     *getdiskcookedname(char *, size_t, const char *);
+const char     *getfstypename(int);
+const char     *getfsspecname(char *, size_t, const char *);
+struct kinfo_vmentry *kinfo_getvmmap(pid_t, size_t *);
+#ifndef __LIBC12_SOURCE__
+void		login(const struct utmp *) __RENAME(__login50);
+void		loginx(const struct utmpx *) __RENAME(__loginx50);
+#endif
+int		login_tty(int);
+int		logout(const char *);
+int		logoutx(const char *, int, int);
+void		logwtmp(const char *, const char *, const char *);
+void		logwtmpx(const char *, const char *, const char *, int, int);
+int		opendisk(const char *, int, char *, size_t, int);
+int		opendisk1(const char *, int, char *, size_t, int,
+			  int (*)(const char *, int, ...));
+int		openpty(int *, int *, char *, struct termios *,
+    struct winsize *);
+#ifndef __LIBC12_SOURCE__
+time_t		parsedate(const char *, const time_t *, const int *)
+    __RENAME(__parsedate50);
+#endif
+int		pidfile(const char *);
+int		pidlock(const char *, int, pid_t *, const char *);
+int		pw_abort(void);
+#ifndef __LIBC12_SOURCE__
+void		pw_copy(int, int, struct passwd *, struct passwd *)
+    __RENAME(__pw_copy50);
+int		pw_copyx(int, int, struct passwd *, struct passwd *,
+    char *, size_t) __RENAME(__pw_copyx50);
+#endif
+void		pw_edit(int, const char *);
+__dead void	pw_error(const char *, int, int);
+void		pw_getconf(char *, size_t, const char *, const char *);
+#ifndef __LIBC12_SOURCE__
+void		pw_getpwconf(char *, size_t, const struct passwd *,
+    const char *) __RENAME(__pw_getpwconf50);
+#endif
+const char     *pw_getprefix(void);
+void		pw_init(void);
+int		pw_lock(int);
+int		pw_mkdb(const char *, int);
+void		pw_prompt(void);
+int		pw_setprefix(const char *);
+int		raise_default_signal(int);
+int		secure_path(const char *);
+int		snprintb_m(char *, size_t, const char *, uint64_t, size_t);
+int		snprintb(char *, size_t, const char *, uint64_t);
+int		sockaddr_snprintf(char *, size_t, const char *,
+    const struct sockaddr *);
+char 	       *strpct(char *, size_t, uintmax_t, uintmax_t, size_t);
+char 	       *strspct(char *, size_t, intmax_t, intmax_t, size_t);
+int		string_to_flags(char **, unsigned long *, unsigned long *);
+int		ttyaction(const char *, const char *, const char *);
+int		ttylock(const char *, int, pid_t *);
+char	       *ttymsg(struct iovec *, int, const char *, int);
+int		ttyunlock(const char *);
+
+uint16_t	disklabel_dkcksum(struct disklabel *);
+int		disklabel_scan(struct disklabel *, char *, size_t);
+
+/* Error checked functions */
+void		(*esetfunc(void (*)(int, const char *, ...)))
+    (int, const char *, ...);
+size_t 		estrlcpy(char *, const char *, size_t);
+size_t 		estrlcat(char *, const char *, size_t);
+char 		*estrdup(const char *);
+char 		*estrndup(const char *, size_t);
+intmax_t	estrtoi(const char *, int, intmax_t, intmax_t);
+uintmax_t	estrtou(const char *, int, uintmax_t, uintmax_t);
+void 		*ecalloc(size_t, size_t);
+void 		*emalloc(size_t);
+void 		*erealloc(void *, size_t);
+void 		ereallocarr(void *, size_t, size_t);
+struct __sFILE	*efopen(const char *, const char *);
+int	 	easprintf(char ** __restrict, const char * __restrict, ...)
+			__printflike(2, 3);
+int		evasprintf(char ** __restrict, const char * __restrict,
+    __va_list) __printflike(2, 0);
+__END_DECLS
+
+#endif /* !_UTIL_H_ */

Property changes on: lab4/.minix-src/include/util.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/wordexp.h
===================================================================
--- lab4/.minix-src/include/wordexp.h	(nonexistent)
+++ lab4/.minix-src/include/wordexp.h	(revision 13)
@@ -0,0 +1,81 @@
+/*	$NetBSD: wordexp.h,v 1.2 2008/04/01 19:23:28 drochner Exp $	*/
+
+/*-
+ * Copyright (c) 2002 Tim J. Robbins.
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: /repoman/r/ncvs/src/include/wordexp.h,v 1.4 2003/01/03 12:03:38 tjr Exp $
+ */
+
+#ifndef _WORDEXP_H_
+#define	_WORDEXP_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <machine/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+
+typedef struct {
+	size_t	we_wordc;		/* count of words matched */
+	char		**we_wordv;	/* pointer to list of words */
+	size_t	we_offs;		/* slots to reserve in we_wordv */
+					/* following are internals */
+	char		*we_strings;	/* storage for wordv strings */
+	size_t	we_nbytes;		/* size of we_strings */
+} wordexp_t;
+
+/*
+ * Flags for wordexp().
+ */
+#define	WRDE_APPEND	0x1		/* append to previously generated */
+#define	WRDE_DOOFFS	0x2		/* we_offs member is valid */
+#define	WRDE_NOCMD	0x4		/* disallow command substitution */
+#define	WRDE_REUSE	0x8		/* reuse wordexp_t */
+#define	WRDE_SHOWERR	0x10		/* don't redirect stderr to /dev/null */
+#define	WRDE_UNDEF	0x20		/* disallow undefined shell vars */
+
+/*
+ * Return values from wordexp().
+ */
+#define	WRDE_BADCHAR	1		/* unquoted special character */
+#define	WRDE_BADVAL	2		/* undefined variable */
+#define	WRDE_CMDSUB	3		/* command substitution not allowed */
+#define	WRDE_NOSPACE	4		/* no memory for result */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define	WRDE_NOSYS	5		/* obsolete, reserved */
+#endif
+#define	WRDE_SYNTAX	6		/* shell syntax error */
+#define WRDE_ERRNO	7		/* other errors see errno */
+
+__BEGIN_DECLS
+int	wordexp(const char * __restrict, wordexp_t * __restrict, int);
+void	wordfree(wordexp_t *);
+__END_DECLS
+
+#endif /* !_WORDEXP_H_ */

Property changes on: lab4/.minix-src/include/wordexp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/uuid.h
===================================================================
--- lab4/.minix-src/include/uuid.h	(nonexistent)
+++ lab4/.minix-src/include/uuid.h	(revision 13)
@@ -0,0 +1,60 @@
+/*	$NetBSD: uuid.h,v 1.2 2008/04/23 07:52:32 plunky Exp $	*/
+
+/*-
+ * Copyright (c) 2002 Marcel Moolenaar
+ * Copyright (c) 2002 Hiten Mahesh Pandya
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/include/uuid.h,v 1.2 2002/11/05 10:55:16 jmallett Exp $
+ */
+
+#ifndef _UUID_H_
+#define	_UUID_H_
+
+#include <sys/types.h>
+#include <sys/uuid.h>
+
+/* Status codes returned by the functions. */
+#define	uuid_s_ok			0
+#define	uuid_s_bad_version		1
+#define	uuid_s_invalid_string_uuid	2
+#define	uuid_s_no_memory		3
+
+__BEGIN_DECLS
+int32_t	uuid_compare(const uuid_t *, const uuid_t *, uint32_t *);
+void	uuid_create(uuid_t *, uint32_t *);
+void	uuid_create_nil(uuid_t *, uint32_t *);
+int32_t	uuid_equal(const uuid_t *, const uuid_t *, uint32_t *);
+void	uuid_from_string(const char *, uuid_t *, uint32_t *);
+uint16_t uuid_hash(const uuid_t *, uint32_t *);
+int32_t	uuid_is_nil(const uuid_t *, uint32_t *);
+void	uuid_to_string(const uuid_t *, char **, uint32_t *);
+
+void	uuid_enc_le(void *, const uuid_t *);
+void	uuid_dec_le(const void *, uuid_t *);
+void	uuid_enc_be(void *, const uuid_t *);
+void	uuid_dec_be(const void *, uuid_t *);
+__END_DECLS
+
+#endif	/* _UUID_H_ */

Property changes on: lab4/.minix-src/include/uuid.h
___________________________________________________________________
Added: svn:executable
Index: lab4/MNUM/bis.c
===================================================================
--- lab4/MNUM/bis.c	(nonexistent)
+++ lab4/MNUM/bis.c	(revision 13)
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <math.h>
+
+int main()
+{
+    double x,x1,err,a,b;
+    scanf("%lf %lf %lf",&a,&b,&err);
+
+        x=(a+b)/2;
+    while(1)
+    {
+     if(((2*pow(a,3)-2*pow(a,2)-1)*(2*pow(x,3)-2*pow(x,2)-1))<0)
+        b=x;
+     else
+        a=x;
+     x1=x;
+     x=(a+b)/2;
+     if(x-x1<err && x-x1>-err)
+     break;
+
+    }
+    printf("%lf",x);
+
+}
\ No newline at end of file

Property changes on: lab4/MNUM/bis.c
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/wctype.h
===================================================================
--- lab4/.minix-src/include/wctype.h	(nonexistent)
+++ lab4/.minix-src/include/wctype.h	(revision 13)
@@ -0,0 +1,103 @@
+/*	$NetBSD: wctype.h,v 1.9 2013/04/27 21:35:25 joerg Exp $	*/
+
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp
+ */
+
+#ifndef _WCTYPE_H_
+#define	_WCTYPE_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/ansi.h>
+
+#ifdef	_BSD_WINT_T_
+typedef	_BSD_WINT_T_    wint_t;
+#undef	_BSD_WINT_T_
+#endif
+
+#ifdef	_BSD_WCTRANS_T_
+typedef	_BSD_WCTRANS_T_	wctrans_t;
+#undef	_BSD_WCTRANS_T_
+#endif
+
+#ifdef	_BSD_WCTYPE_T_
+typedef	_BSD_WCTYPE_T_	wctype_t;
+#undef	_BSD_WCTYPE_T_
+#endif
+
+#ifndef WEOF
+#define	WEOF	((wint_t)-1)
+#endif
+
+__BEGIN_DECLS
+int	iswalnum(wint_t);
+int	iswalpha(wint_t);
+int	iswblank(wint_t);
+int	iswcntrl(wint_t);
+int	iswdigit(wint_t);
+int	iswgraph(wint_t);
+int	iswlower(wint_t);
+int	iswprint(wint_t);
+int	iswpunct(wint_t);
+int	iswspace(wint_t);
+int	iswupper(wint_t);
+int	iswxdigit(wint_t);
+int	iswctype(wint_t, wctype_t);
+wint_t	towctrans(wint_t, wctrans_t);
+wint_t	towlower(wint_t);
+wint_t	towupper(wint_t);
+wctrans_t wctrans(const char *);
+wctype_t wctype(const char *);
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+int	iswalnum_l(wint_t, locale_t);
+int	iswalpha_l(wint_t, locale_t);
+int	iswblank_l(wint_t, locale_t);
+int	iswcntrl_l(wint_t, locale_t);
+int	iswdigit_l(wint_t, locale_t);
+int	iswgraph_l(wint_t, locale_t);
+int	iswlower_l(wint_t, locale_t);
+int	iswprint_l(wint_t, locale_t);
+int	iswpunct_l(wint_t, locale_t);
+int	iswspace_l(wint_t, locale_t);
+int	iswupper_l(wint_t, locale_t);
+int	iswxdigit_l(wint_t, locale_t);
+int	iswctype_l(wint_t, wctype_t, locale_t);
+wint_t	towctrans_l(wint_t, wctrans_t, locale_t);
+wint_t	towlower_l(wint_t, locale_t);
+wint_t	towupper_l(wint_t, locale_t);
+wctrans_t wctrans_l(const char *, locale_t);
+wctype_t wctype_l(const char *, locale_t);
+#endif
+__END_DECLS
+
+#endif		/* _WCTYPE_H_ */

Property changes on: lab4/.minix-src/include/wctype.h
___________________________________________________________________
Added: svn:executable
Index: lab4/lab2/lab2/.clang-format
===================================================================
--- lab4/lab2/lab2/.clang-format	(nonexistent)
+++ lab4/lab2/lab2/.clang-format	(revision 13)
@@ -0,0 +1,73 @@
+BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: true
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: false
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      false
+  AfterControlStatement: false
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: true
+  AfterStruct:     false
+  AfterUnion:      false
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+IndentPPDirectives: AfterHash
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+Language: Cpp
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+SpaceAfterCStyleCast: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: true
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 2
+UseTab: Never

Property changes on: lab4/lab2/lab2/.clang-format
___________________________________________________________________
Added: svn:executable
Index: lab4/MNUM/a.out
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-executable
Index: lab4/MNUM/a.out
===================================================================
--- lab4/MNUM/a.out	(nonexistent)
+++ lab4/MNUM/a.out	(revision 13)

Property changes on: lab4/MNUM/a.out
___________________________________________________________________
Added: svn:executable
Added: svn:mime-type
## -0,0 +1 ##
+application/x-executable
\ No newline at end of property
Index: lab4/lab2/lab2/.vscode/settings.json
===================================================================
--- lab4/lab2/lab2/.vscode/settings.json	(nonexistent)
+++ lab4/lab2/lab2/.vscode/settings.json	(revision 13)
@@ -0,0 +1,10 @@
+{
+  "git.ignoreLimitWarning": true,
+  "C_Cpp.clang_format_fallbackStyle": "LLVM",
+  "diffEditor.ignoreTrimWhitespace": true,
+  "editor.formatOnSave": false,
+  "editor.tabSize": 2,
+  "editor.wordWrap": "bounded",
+  "editor.wordWrapColumn": 100,
+  "files.associations": { },
+}
\ No newline at end of file

Property changes on: lab4/lab2/lab2/.vscode/settings.json
___________________________________________________________________
Added: svn:executable
Index: lab4/lab2/lab2/i8254.h
===================================================================
--- lab4/lab2/lab2/i8254.h	(nonexistent)
+++ lab4/lab2/lab2/i8254.h	(revision 13)
@@ -0,0 +1,66 @@
+#ifndef _LCOM_I8254_H_
+#define _LCOM_I8254_H_
+
+#include <lcom/lcf.h>
+
+/** @defgroup i8254 i8254
+ * @{
+ *
+ * Constants for programming the i8254 Timer. Needs to be completed.
+ */
+
+
+
+/*IRQ's*/
+
+#define IRQ_TIMER 0
+#define DEFAULT_FREQ 60
+
+
+#define TIMER_FREQ 1193182 /**< @brief clock frequency for timer in PC and AT */
+#define MIN_FREQ 19
+#define TIMER0_IRQ 0 /**< @brief Timer 0 IRQ line */
+
+/* I/O port addresses */
+
+#define TIMER_0    0x40 /**< @brief Timer 0 count register */
+#define TIMER_1    0x41 /**< @brief Timer 1 count register */
+#define TIMER_2    0x42 /**< @brief Timer 2 count register */
+#define TIMER_CTRL 0x43 /**< @brief Control register */
+
+#define SPEAKER_CTRL 0x61 /**< @brief Register for speaker control  */
+
+/* Timer control */
+
+/* Timer selection: bits 7 and 6 */
+
+#define TIMER_SEL0   0x00              /**< @brief Control Word for Timer 0 */
+#define TIMER_SEL1   BIT(6)            /**< @brief Control Word for Timer 1 */
+#define TIMER_SEL2   BIT(7)            /**< @brief Control Word for Timer 2 */
+#define TIMER_RB_CMD (BIT(7) | BIT(6)) /**< @brief Read Back Command */
+
+/* Register selection: bits 5 and 4 */
+
+#define TIMER_LSB     BIT(4)                  /**< @brief Initialize Counter LSB only */
+#define TIMER_MSB     BIT(5)                  /**< @brief Initialize Counter MSB only */
+#define TIMER_LSB_MSB (TIMER_LSB | TIMER_MSB) /**< @brief Initialize LSB first and MSB afterwards */
+
+/* Operating mode: bits 3, 2 and 1 */
+
+#define TIMER_SQR_WAVE (BIT(2) | BIT(1)) /**< @brief Mode 3: square wave generator */
+#define TIMER_RATE_GEN BIT(2)            /**< @brief Mode 2: rate generator */
+
+/* Counting mode: bit 0 */
+
+#define TIMER_BCD 0x01 /**< @brief Count in BCD */
+#define TIMER_BIN 0x00 /**< @brief Count in binary */
+
+/* READ-BACK COMMAND FORMAT */
+
+#define TIMER_RB_COUNT_  BIT(5)
+#define TIMER_RB_STATUS_ BIT(4)
+#define TIMER_RB_SEL(n)  BIT((n) + 1)
+
+/**@}*/
+
+#endif /* _LCOM_I8254_H */

Property changes on: lab4/lab2/lab2/i8254.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/zconf.h
===================================================================
--- lab4/.minix-src/include/zconf.h	(nonexistent)
+++ lab4/.minix-src/include/zconf.h	(revision 13)
@@ -0,0 +1,340 @@
+/*	$NetBSD: zconf.h,v 1.2 2006/01/14 20:27:34 christos Exp $	*/
+
+/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) Id */
+
+#ifndef ZCONF_H
+#define ZCONF_H
+
+#include <sys/types.h>
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ */
+#ifdef Z_PREFIX
+#  define deflateInit_          z_deflateInit_
+#  define deflate               z_deflate
+#  define deflateEnd            z_deflateEnd
+#  define inflateInit_          z_inflateInit_
+#  define inflate               z_inflate
+#  define inflateEnd            z_inflateEnd
+#  define deflateInit2_         z_deflateInit2_
+#  define deflateSetDictionary  z_deflateSetDictionary
+#  define deflateCopy           z_deflateCopy
+#  define deflateReset          z_deflateReset
+#  define deflateParams         z_deflateParams
+#  define deflateBound          z_deflateBound
+#  define deflatePrime          z_deflatePrime
+#  define inflateInit2_         z_inflateInit2_
+#  define inflateSetDictionary  z_inflateSetDictionary
+#  define inflateSync           z_inflateSync
+#  define inflateSyncPoint      z_inflateSyncPoint
+#  define inflateCopy           z_inflateCopy
+#  define inflateReset          z_inflateReset
+#  define inflateBack           z_inflateBack
+#  define inflateBackEnd        z_inflateBackEnd
+#  define compress              z_compress
+#  define compress2             z_compress2
+#  define compressBound         z_compressBound
+#  define uncompress            z_uncompress
+#  define adler32               z_adler32
+#  define crc32                 z_crc32
+#  define get_crc_table         z_get_crc_table
+#  define zError                z_zError
+
+#  define alloc_func            z_alloc_func
+#  define free_func             z_free_func
+#  define in_func               z_in_func
+#  define out_func              z_out_func
+#  define Byte                  z_Byte
+#  define uInt                  z_uInt
+#  define uLong                 z_uLong
+#  define Bytef                 z_Bytef
+#  define charf                 z_charf
+#  define intf                  z_intf
+#  define uIntf                 z_uIntf
+#  define uLongf                z_uLongf
+#  define voidpf                z_voidpf
+#  define voidp                 z_voidp
+#endif
+
+#if defined(__MSDOS__) && !defined(MSDOS)
+#  define MSDOS
+#endif
+#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
+#  define OS2
+#endif
+#if defined(_WINDOWS) && !defined(WINDOWS)
+#  define WINDOWS
+#endif
+#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
+#  ifndef WIN32
+#    define WIN32
+#  endif
+#endif
+#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
+#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
+#    ifndef SYS16BIT
+#      define SYS16BIT
+#    endif
+#  endif
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#ifdef SYS16BIT
+#  define MAXSEG_64K
+#endif
+#ifdef MSDOS
+#  define UNALIGNED_OK
+#endif
+
+#ifdef __STDC_VERSION__
+#  ifndef STDC
+#    define STDC
+#  endif
+#  if __STDC_VERSION__ >= 199901L
+#    ifndef STDC99
+#      define STDC99
+#    endif
+#  endif
+#endif
+#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
+#  define STDC
+#endif
+
+#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
+#  define STDC
+#endif
+
+#ifndef STDC
+#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+#    define const       /* note: need a more gentle solution here */
+#  endif
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
+#  define NO_DUMMY_DECL
+#endif
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+#  ifdef MAXSEG_64K
+#    define MAX_MEM_LEVEL 8
+#  else
+#    define MAX_MEM_LEVEL 9
+#  endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+#  define MAX_WBITS   15 /* 32K LZ77 window */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+            (1 << (windowBits+2)) +  (1 << (memLevel+9))
+ that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+   The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+                        /* Type declarations */
+
+#ifndef OF /* function prototypes */
+#  ifdef STDC
+#    define OF(args)  args
+#  else
+#    define OF(args)  ()
+#  endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#ifdef SYS16BIT
+#  if defined(M_I86SM) || defined(M_I86MM)
+     /* MSC small or medium model */
+#    define SMALL_MEDIUM
+#    ifdef _MSC_VER
+#      define FAR _far
+#    else
+#      define FAR far
+#    endif
+#  endif
+#  if (defined(__SMALL__) || defined(__MEDIUM__))
+     /* Turbo C small or medium model */
+#    define SMALL_MEDIUM
+#    ifdef __BORLANDC__
+#      define FAR _far
+#    else
+#      define FAR far
+#    endif
+#  endif
+#endif
+
+#if defined(WINDOWS) || defined(WIN32)
+   /* If building or using zlib as a DLL, define ZLIB_DLL.
+    * This is not mandatory, but it offers a little performance increase.
+    */
+#  ifdef ZLIB_DLL
+#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
+#      ifdef ZLIB_INTERNAL
+#        define ZEXTERN extern __declspec(dllexport)
+#      else
+#        define ZEXTERN extern __declspec(dllimport)
+#      endif
+#    endif
+#  endif  /* ZLIB_DLL */
+   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
+    * define ZLIB_WINAPI.
+    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
+    */
+#  ifdef ZLIB_WINAPI
+#    ifdef FAR
+#      undef FAR
+#    endif
+#    include <windows.h>
+     /* No need for _export, use ZLIB.DEF instead. */
+     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
+#    define ZEXPORT WINAPI
+#    ifdef WIN32
+#      define ZEXPORTVA WINAPIV
+#    else
+#      define ZEXPORTVA FAR CDECL
+#    endif
+#  endif
+#endif
+
+#if defined (__BEOS__)
+#  ifdef ZLIB_DLL
+#    ifdef ZLIB_INTERNAL
+#      define ZEXPORT   __declspec(dllexport)
+#      define ZEXPORTVA __declspec(dllexport)
+#    else
+#      define ZEXPORT   __declspec(dllimport)
+#      define ZEXPORTVA __declspec(dllimport)
+#    endif
+#  endif
+#endif
+
+#ifndef ZEXTERN
+#  define ZEXTERN extern
+#endif
+#ifndef ZEXPORT
+#  define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+#  define ZEXPORTVA
+#endif
+
+#ifndef FAR
+#  define FAR
+#endif
+
+#if !defined(__MACTYPES__)
+typedef unsigned char  Byte;  /* 8 bits */
+#endif
+typedef unsigned int   uInt;  /* 16 bits or more */
+typedef unsigned long  uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+#  define Bytef Byte FAR
+#else
+   typedef Byte  FAR Bytef;
+#endif
+typedef char  FAR charf;
+typedef int   FAR intf;
+typedef uInt  FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+   typedef void const *voidpc;
+   typedef void FAR   *voidpf;
+   typedef void       *voidp;
+#else
+   typedef Byte const *voidpc;
+   typedef Byte FAR   *voidpf;
+   typedef Byte       *voidp;
+#endif
+
+#if defined(HAVE_UNISTD_H) || (defined(__NetBSD__) && (!defined(_KERNEL) && !defined(_STANDALONE)))
+#  include <sys/types.h> /* for off_t */
+#  include <unistd.h>    /* for SEEK_* and off_t */
+#  ifdef VMS
+#    include <unixio.h>   /* for off_t */
+#  endif
+#  define z_off_t off_t
+#  define z_ptrdiff_t ptrdiff_t
+#endif
+#ifndef SEEK_SET
+#  define SEEK_SET        0       /* Seek from beginning of file.  */
+#  define SEEK_CUR        1       /* Seek from current position.  */
+#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
+#endif
+#ifndef z_off_t
+#  define z_off_t long
+#endif
+#ifndef z_ptrdiff_t
+#  define z_ptrdiff_t long
+#endif
+
+#if defined(__OS400__)
+#  define NO_vsnprintf
+#endif
+
+#if defined(__MVS__)
+#  define NO_vsnprintf
+#  ifdef FAR
+#    undef FAR
+#  endif
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+#   pragma map(deflateInit_,"DEIN")
+#   pragma map(deflateInit2_,"DEIN2")
+#   pragma map(deflateEnd,"DEEND")
+#   pragma map(deflateBound,"DEBND")
+#   pragma map(inflateInit_,"ININ")
+#   pragma map(inflateInit2_,"ININ2")
+#   pragma map(inflateEnd,"INEND")
+#   pragma map(inflateSync,"INSY")
+#   pragma map(inflateSetDictionary,"INSEDI")
+#   pragma map(compressBound,"CMBND")
+#   pragma map(inflate_table,"INTABL")
+#   pragma map(inflate_fast,"INFA")
+#   pragma map(inflate_copyright,"INCOPY")
+#endif
+
+#endif /* ZCONF_H */

Property changes on: lab4/.minix-src/include/zconf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/lab2/lab2/utils.c
===================================================================
--- lab4/lab2/lab2/utils.c	(nonexistent)
+++ lab4/lab2/lab2/utils.c	(revision 13)
@@ -0,0 +1,37 @@
+#include <lcom/lcf.h>
+
+#include <stdint.h>
+
+int(util_get_LSB)(uint16_t val, uint8_t *lsb) {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  *lsb=val&0xFF;
+  return 0;
+}
+
+int(util_get_MSB)(uint16_t val, uint8_t *msb) {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  *msb=(val&0xFF00)>>8;
+
+  return 0;
+}
+
+int (util_sys_inb)(int port, uint8_t *value) {
+  /* To be implemented by the students */
+  uint32_t b32;
+ if(sys_inb(port,&b32)!=0)return 1;
+ //printf("%x",b32);
+ *value=b32&0xFF;
+ //printf("%x\n",*value);
+  
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  return 0;
+}
+
+/* a = 133
+b = a & 0x0F
+1000 0101
+ */

Property changes on: lab4/lab2/lab2/utils.c
___________________________________________________________________
Added: svn:executable
Index: lab4/lab2/lab2/.vscode/c_cpp_properties.json
===================================================================
--- lab4/lab2/lab2/.vscode/c_cpp_properties.json	(nonexistent)
+++ lab4/lab2/lab2/.vscode/c_cpp_properties.json	(revision 13)
@@ -0,0 +1,18 @@
+{
+  "env": {
+    "minix.include": "${workspaceFolder}/../.minix-src/include"
+  },
+  "configurations": [{
+    "name": "Minix",
+    "compilerPath": "",
+    "cStandard": "c11",
+    "defines": ["__minix", "_MINIX ", "_NETBSD_SOURCE", "__i386__"],
+    "includePath": ["${workspaceFolder}", "${env:minix.include}"],
+    "browse": {
+      "path": ["${workspaceFolder}", "${env:minix.include}"],
+      "limitSymbolsToIncludedHeaders": false,
+      "databaseFilename": ""
+    }
+  }],
+  "version": 4
+}

Property changes on: lab4/lab2/lab2/.vscode/c_cpp_properties.json
___________________________________________________________________
Added: svn:executable
Index: lab4/lab2/lab2/lab2
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-executable
Index: lab4/lab2/lab2/lab2
===================================================================
--- lab4/lab2/lab2/lab2	(nonexistent)
+++ lab4/lab2/lab2/lab2	(revision 13)

Property changes on: lab4/lab2/lab2/lab2
___________________________________________________________________
Added: svn:executable
Added: svn:mime-type
## -0,0 +1 ##
+application/x-executable
\ No newline at end of property
Index: lab4/lab2/lab2/.gdbinit
===================================================================
Index: lab4/lab2/lab2/.gdbinit
===================================================================
--- lab4/lab2/lab2/.gdbinit	(nonexistent)
+++ lab4/lab2/lab2/.gdbinit	(revision 13)

Property changes on: lab4/lab2/lab2/.gdbinit
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/.clang-format
===================================================================
--- lab4/lab3/.clang-format	(nonexistent)
+++ lab4/lab3/.clang-format	(revision 13)
@@ -0,0 +1,73 @@
+BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: true
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: false
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      false
+  AfterControlStatement: false
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: true
+  AfterStruct:     false
+  AfterUnion:      false
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+IndentPPDirectives: AfterHash
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+Language: Cpp
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+SpaceAfterCStyleCast: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: true
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 2
+UseTab: Never

Property changes on: lab4/lab3/.clang-format
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/i8254.h
===================================================================
--- lab4/lab3/i8254.h	(nonexistent)
+++ lab4/lab3/i8254.h	(revision 13)
@@ -0,0 +1,66 @@
+#ifndef _LCOM_I8254_H_
+#define _LCOM_I8254_H_
+
+#include <lcom/lcf.h>
+
+/** @defgroup i8254 i8254
+ * @{
+ *
+ * Constants for programming the i8254 Timer. Needs to be completed.
+ */
+
+
+
+/*IRQ's*/
+
+#define IRQ_TIMER 0
+#define DEFAULT_FREQ 60
+
+
+#define TIMER_FREQ 1193182 /**< @brief clock frequency for timer in PC and AT */
+#define MIN_FREQ 19
+#define TIMER0_IRQ 0 /**< @brief Timer 0 IRQ line */
+
+/* I/O port addresses */
+
+#define TIMER_0    0x40 /**< @brief Timer 0 count register */
+#define TIMER_1    0x41 /**< @brief Timer 1 count register */
+#define TIMER_2    0x42 /**< @brief Timer 2 count register */
+#define TIMER_CTRL 0x43 /**< @brief Control register */
+
+#define SPEAKER_CTRL 0x61 /**< @brief Register for speaker control  */
+
+/* Timer control */
+
+/* Timer selection: bits 7 and 6 */
+
+#define TIMER_SEL0   0x00              /**< @brief Control Word for Timer 0 */
+#define TIMER_SEL1   BIT(6)            /**< @brief Control Word for Timer 1 */
+#define TIMER_SEL2   BIT(7)            /**< @brief Control Word for Timer 2 */
+#define TIMER_RB_CMD (BIT(7) | BIT(6)) /**< @brief Read Back Command */
+
+/* Register selection: bits 5 and 4 */
+
+#define TIMER_LSB     BIT(4)                  /**< @brief Initialize Counter LSB only */
+#define TIMER_MSB     BIT(5)                  /**< @brief Initialize Counter MSB only */
+#define TIMER_LSB_MSB (TIMER_LSB | TIMER_MSB) /**< @brief Initialize LSB first and MSB afterwards */
+
+/* Operating mode: bits 3, 2 and 1 */
+
+#define TIMER_SQR_WAVE (BIT(2) | BIT(1)) /**< @brief Mode 3: square wave generator */
+#define TIMER_RATE_GEN BIT(2)            /**< @brief Mode 2: rate generator */
+
+/* Counting mode: bit 0 */
+
+#define TIMER_BCD 0x01 /**< @brief Count in BCD */
+#define TIMER_BIN 0x00 /**< @brief Count in binary */
+
+/* READ-BACK COMMAND FORMAT */
+
+#define TIMER_RB_COUNT_  BIT(5)
+#define TIMER_RB_STATUS_ BIT(4)
+#define TIMER_RB_SEL(n)  BIT((n) + 1)
+
+/**@}*/
+
+#endif /* _LCOM_I8254_H */

Property changes on: lab4/lab3/i8254.h
___________________________________________________________________
Added: svn:executable
Index: lab4/lab2/lab2/lab2.c
===================================================================
--- lab4/lab2/lab2/lab2.c	(nonexistent)
+++ lab4/lab2/lab2/lab2.c	(revision 13)
@@ -0,0 +1,113 @@
+#include <lcom/lcf.h>
+#include <lcom/lab2.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "i8254.h"
+//#include "timer.c"
+extern uint32_t cont;
+
+
+int main(int argc, char *argv[]) {
+  
+  // sets the language of LCF messages (can be either EN-US or PT-PT)
+  lcf_set_language("EN-US");
+
+  // enables to log function invocations that are being "wrapped" by LCF
+  // [comment this out if you don't want/need it]
+  lcf_trace_calls("/home/lcom/labs/lab2/trace.txt");
+
+  // enables to save the output of printf function calls on a file
+  // [comment this out if you don't want/need it]
+  lcf_log_output("/home/lcom/labs/lab2/output.txt");
+
+  // handles control over to LCF
+  // [LCF handles command line arguments and invokes the right function]
+  if (lcf_start(argc, argv))
+    return 1;
+
+  // LCF clean up tasks
+  // [must be the last statement before return]
+  lcf_cleanup();
+
+  return 0;
+}
+
+int(timer_test_read_config)(uint8_t timer, enum timer_status_field field) {
+  /* To be implemented by the students */
+  uint8_t st;
+  if(timer_get_conf(timer,&st)==1) return 1;
+  if(timer_display_conf(timer,st,field)==1) return 1;
+
+  return 0;
+ // printf("%s is not yet implemented!\n", __func__);
+
+}
+
+int(timer_test_time_base)(uint8_t timer, uint32_t freq) {
+  /* To be implemented by the students */
+  if(freq<MIN_FREQ || freq>TIMER_FREQ)
+  {
+    printf("OUT OF RANGE FREQUENCY\n");
+    return 1;
+  }
+  return(timer_set_frequency(timer,freq));
+  //printf("%s is not yet implemented!\n", __func__);
+
+}
+
+int(timer_test_int)(uint8_t time) {
+  /* To be implemented by the students */
+
+  if(time<0) 
+  {
+    printf("INVALID TIME!");
+  return 1;
+  }
+
+  int ipc_status;
+  message msg;
+  uint8_t r;
+  uint8_t bit_no = 0;
+  timer_subscribe_int(&bit_no);
+  while( (cont/DEFAULT_FREQ)<time )
+ { /* You may want to use a different condition */
+     /* Get a request message. */
+     // printf("1\n");
+     //printf("cont:%d, time:%d\n\n",cont/60,time);
+     if ( (r = driver_receive(ANY, &msg, &ipc_status)) != 0 ) 
+     { 
+        printf("driver_receive failed with: %d", r);
+       continue;
+    }
+    if (is_ipc_notify(ipc_status)) { /* received notification */
+        switch (_ENDPOINT_P(msg.m_source)) {
+            case HARDWARE: /* hardware interrupt notification */				
+                if (msg.m_notify.interrupts  & BIT(0)) { /* subscribed interrupt */
+                   timer_int_handler();
+                   if(cont%DEFAULT_FREQ==0)
+                   timer_print_elapsed_time();
+                   //printf("cont:%d\n",cont);
+               }
+                //printf("msg:%x\n",msg.m_notify.interrupts);
+                break;
+            default:
+                //printf("2\n");
+                break; /* no other notifications expected: do nothing */	
+        }
+    } else {
+     // printf("3\n"); /* received a standard message, not a notification */
+        /* no standard messages expected: do nothing */
+    }
+ }
+ if(timer_unsubscribe_int()!=0) return 1;
+
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  return 0;
+}
+//dois primeiros bits sao 1, (TIMER_RB_CNTRL|BIT(5))
+//SYS_OUTB para controlo->0x43, Config timer 0, dizer que queremos escrever para o controlo, e depois ler a parte corresponder
+//g9

Property changes on: lab4/lab2/lab2/lab2.c
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/.vscode/c_cpp_properties.json
===================================================================
--- lab4/lab3/.vscode/c_cpp_properties.json	(nonexistent)
+++ lab4/lab3/.vscode/c_cpp_properties.json	(revision 13)
@@ -0,0 +1,18 @@
+{
+  "env": {
+    "minix.include": "${workspaceFolder}/../.minix-src/include"
+  },
+  "configurations": [{
+    "name": "Minix",
+    "compilerPath": "",
+    "cStandard": "c11",
+    "defines": ["__minix", "_MINIX ", "_NETBSD_SOURCE", "__i386__"],
+    "includePath": ["${workspaceFolder}", "${env:minix.include}"],
+    "browse": {
+      "path": ["${workspaceFolder}", "${env:minix.include}"],
+      "limitSymbolsToIncludedHeaders": false,
+      "databaseFilename": ""
+    }
+  }],
+  "version": 4
+}

Property changes on: lab4/lab3/.vscode/c_cpp_properties.json
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/.vscode/extensions.json
===================================================================
--- lab4/lab3/.vscode/extensions.json	(nonexistent)
+++ lab4/lab3/.vscode/extensions.json	(revision 13)
@@ -0,0 +1,12 @@
+{
+	// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+	// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+	// List of extensions which should be recommended for users of this workspace.
+	"recommendations": [
+		"austin.code-gnu-global",
+		"ms-vscode.cpptools",
+		"xaver.clang-format"
+	],
+	// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
+	"unwantedRecommendations": []
+}
\ No newline at end of file

Property changes on: lab4/lab3/.vscode/extensions.json
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/.gdbinit
===================================================================
Index: lab4/lab3/.gdbinit
===================================================================
--- lab4/lab3/.gdbinit	(nonexistent)
+++ lab4/lab3/.gdbinit	(revision 13)

Property changes on: lab4/lab3/.gdbinit
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/keyboard.c
===================================================================
--- lab4/lab3/keyboard.c	(nonexistent)
+++ lab4/lab3/keyboard.c	(revision 13)
@@ -0,0 +1,68 @@
+#include "keyboard.h"
+//#include "lab3.c"
+#include <lcom/lcf.h>
+
+#include <minix/sysutil.h>
+#include <stdint.h>
+
+#include "i8042.h"
+#include "i8254.h"
+
+#include <lcom/lab3.h>
+#include <stdbool.h>
+
+extern uint32_t scancode;
+static int hook_id = 1;
+extern uint32_t cnt;
+  extern int flag;
+
+void(kbc_ih)() {
+  uint8_t scan_arr[2] = {0, 0};
+ 
+#ifdef LAB3
+    cnt++;
+#endif
+    sys_inb(IN_BUF, &scancode);
+    if (scancode & O_BUFFER_FULL) {
+#ifdef LAB3
+      cnt++;
+#endif
+      sys_inb(I_O_BUFFER, &scancode);
+              if (scancode != TWO_BYTES && flag == 0) {
+                scan_arr[0] = scancode;
+                kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr);
+              }
+
+              else if (scancode == TWO_BYTES) {
+                scan_arr[0] = scancode;
+                flag = 1;
+              }
+
+              else if (flag == 1) {
+                scan_arr[1] = scancode;
+                kbd_print_scancode(!(scancode & PAR_ERR), 2, scan_arr);
+                flag = 0;
+              }
+    }
+  
+}
+
+int kbd_subscribe_int(uint8_t *bit_no) {
+  *bit_no = hook_id;
+
+  if (sys_irqsetpolicy(IRQ_KB, (IRQ_REENABLE | IRQ_EXCLUSIVE), &hook_id) != OK) {
+    printf("ERROR kbd subscribe failed");
+    return 1;
+  }
+
+  return 0;
+}
+
+int kbd_unsubscribe_int() {
+  if (sys_irqrmpolicy(&hook_id) != OK) {
+    printf("ERROR kbd unsubscribe failed");
+    return 1;
+  }
+
+  return 0;
+}

Property changes on: lab4/lab3/keyboard.c
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/Makefile
===================================================================
--- lab4/lab3/Makefile	(nonexistent)
+++ lab4/lab3/Makefile	(revision 13)
@@ -0,0 +1,16 @@
+# name of the program (Minix service)
+PROG=lab3
+
+# source code files to be compiled
+SRCS = lab3.c keyboard.c 
+
+# additional compilation flags
+# "-Wall -Wextra -Werror -I . -std=c11 -Wno-unused-parameter" are already set
+CPPFLAGS += -pedantic -DLAB3
+
+# list of library dependencies (for Lab 2, only LCF library)
+DPADD += ${LIBLCF}
+LDADD += -llcf
+
+# include LCOM's makefile that does all the "heavy lifting"
+.include <minix.lcom.mk>

Property changes on: lab4/lab3/Makefile
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/keyboard.h
===================================================================
--- lab4/lab3/keyboard.h	(nonexistent)
+++ lab4/lab3/keyboard.h	(revision 13)
@@ -0,0 +1,12 @@
+
+#ifndef KEYBOARD_H
+#define KEYBOARD_H
+#include <stdint.h>
+
+int kbd_subscribe_int(uint8_t*bit_no);
+
+int kbd_unsubscribe_int();
+
+void(kbc_ih)();
+
+#endif /* KEYBOARD.H */

Property changes on: lab4/lab3/keyboard.h
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/lab2.c
===================================================================
--- lab4/lab3/lab2.c	(nonexistent)
+++ lab4/lab3/lab2.c	(revision 13)
@@ -0,0 +1,109 @@
+#include <lcom/lcf.h>
+#include <lcom/lab2.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "i8254.h"
+//#include "timer.c"
+extern uint32_t cont;
+
+
+int main(int argc, char *argv[]) {
+  
+  // sets the language of LCF messages (can be either EN-US or PT-PT)
+  lcf_set_language("EN-US");
+
+  // enables to log function invocations that are being "wrapped" by LCF
+  // [comment this out if you don't want/need it]
+  lcf_trace_calls("/home/lcom/labs/lab2/trace.txt");
+
+  // enables to save the output of printf function calls on a file
+  // [comment this out if you don't want/need it]
+  lcf_log_output("/home/lcom/labs/lab2/output.txt");
+
+  // handles control over to LCF
+  // [LCF handles command line arguments and invokes the right function]
+  if (lcf_start(argc, argv))
+    return 1;
+
+  // LCF clean up tasks
+  // [must be the last statement before return]
+  lcf_cleanup();
+
+  return 0;
+}
+
+int(timer_test_read_config)(uint8_t timer, enum timer_status_field field) {
+  /* To be implemented by the students */
+  uint8_t st;
+  if(timer_get_conf(timer,&st)==1) return 1;
+  if(timer_display_conf(timer,st,field)==1) return 1;
+
+  return 0;
+ // printf("%s is not yet implemented!\n", __func__);
+
+}
+
+int(timer_test_time_base)(uint8_t timer, uint32_t freq) {
+  /* To be implemented by the students */
+  if(freq<MIN_FREQ || freq>TIMER_FREQ)
+  {
+    printf("OUT OF RANGE FREQUENCY\n");
+    return 1;
+  }
+  return(timer_set_frequency(timer,freq));
+  //printf("%s is not yet implemented!\n", __func__);
+
+}
+
+int(timer_test_int)(uint8_t time) {
+  /* To be implemented by the students */
+
+  if(time<0) return 1;
+
+  int ipc_status;
+  message msg;
+  uint8_t r;
+  uint8_t bit_no = 0;
+  timer_subscribe_int(&bit_no);
+  while( (cont/DEFAULT_FREQ)<time )
+ { /* You may want to use a different condition */
+     /* Get a request message. */
+     // printf("1\n");
+     //printf("cont:%d, time:%d\n\n",cont/60,time);
+     if ( (r = driver_receive(ANY, &msg, &ipc_status)) != 0 ) 
+     { 
+        printf("driver_receive failed with: %d", r);
+       continue;
+    }
+    if (is_ipc_notify(ipc_status)) { /* received notification */
+        switch (_ENDPOINT_P(msg.m_source)) {
+            case HARDWARE: /* hardware interrupt notification */				
+                if (msg.m_notify.interrupts  & BIT(0)) { /* subscribed interrupt */
+                   timer_int_handler();
+                   if(cont%DEFAULT_FREQ==0)
+                   timer_print_elapsed_time();
+                   //printf("cont:%d\n",cont);
+               }
+                //printf("msg:%x\n",msg.m_notify.interrupts);
+                break;
+            default:
+                //printf("2\n");
+                break; /* no other notifications expected: do nothing */	
+        }
+    } else {
+     // printf("3\n"); /* received a standard message, not a notification */
+        /* no standard messages expected: do nothing */
+    }
+ }
+ if(timer_unsubscribe_int()!=0) return 1;
+
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  return 0;
+}
+//dois primeiros bits sao 1, (TIMER_RB_CNTRL|BIT(5))
+//SYS_OUTB para controlo->0x43, Config timer 0, dizer que queremos escrever para o controlo, e depois ler a parte corresponder
+//g9

Property changes on: lab4/lab3/lab2.c
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/timer.c
===================================================================
--- lab4/lab3/timer.c	(nonexistent)
+++ lab4/lab3/timer.c	(revision 13)
@@ -0,0 +1,164 @@
+#include <lcom/lcf.h>
+#include <lcom/timer.h>
+
+#include <stdint.h>
+
+#include "i8254.h"
+
+uint32_t cont=0;
+int hook_id;
+
+
+int (timer_set_frequency)(uint8_t timer, uint32_t freq) {
+  /* To be implemented by the students */
+  uint8_t conf;
+  timer_get_conf(timer,&conf);
+  uint32_t tudo;
+  uint8_t msb,lsb;
+  tudo=(TIMER_FREQ/freq);
+  util_get_MSB(tudo,&msb);
+  util_get_LSB(tudo,&lsb);
+  
+  //printf("%x\n%x\n%x\n%d\n",tudo,msb,lsb,timer);
+
+
+  if(timer==0)
+  {
+    conf=(conf&0xF);
+    conf = (conf  | TIMER_SEL0 | TIMER_LSB_MSB);
+  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
+  if(sys_outb(TIMER_0, lsb)!=0) return 1;
+  if(sys_outb(TIMER_0, msb)!=0) return 1;
+  }
+
+  if(timer==1)
+  {
+    conf=(conf&0xF);
+    conf = (conf | TIMER_SEL1 | TIMER_LSB_MSB);
+  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
+  if(sys_outb(TIMER_1, lsb)!=0) return 1;
+  if(sys_outb(TIMER_1, msb)!=0) return 1;
+  }
+
+  if(timer==2)
+  {
+    conf=(conf&0xF);
+    conf = (conf | TIMER_SEL2 | TIMER_LSB_MSB);
+  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
+  if(sys_outb(TIMER_2, lsb)!=0) return 1;
+  if(sys_outb(TIMER_2, msb)!=0) return 1;
+  }
+  return 0;
+
+}
+
+int (timer_subscribe_int)(uint8_t *bit_no) {
+    /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+ /*  int policy;
+  sys_irqrmpolicy(&policy); */
+  hook_id=*bit_no;
+  sys_irqsetpolicy(IRQ_TIMER,IRQ_REENABLE,&hook_id);
+
+  return 1;
+}
+
+int (timer_unsubscribe_int)() {
+  /* To be implemented by the students */
+// printf("%s is not yet implemented!\n", __func__);
+
+sys_irqrmpolicy(&hook_id);
+
+  return 1;
+}
+
+void (timer_int_handler)() {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  cont=cont+1;
+}
+
+int (timer_get_conf)(uint8_t timer, uint8_t *st) {
+  /* To be implemented by the students */
+
+  uint8_t rbc = (TIMER_RB_CMD|TIMER_RB_SEL(4)|TIMER_RB_SEL(timer));
+  if(sys_outb(TIMER_CTRL,rbc)!=0) return 1;
+
+  
+  if(timer==0)
+  return (util_sys_inb(TIMER_0,st));
+  if(timer==1)
+  return (util_sys_inb(TIMER_1,st));
+  if(timer==2)
+  return (util_sys_inb(TIMER_2,st));
+
+  return 1;
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  
+}
+
+int (timer_display_conf)(uint8_t timer, uint8_t st,
+                        enum timer_status_field field) {
+  /* To be implemented by the students */
+  union timer_status_field_val val;
+  
+
+  if(field==tsf_all)
+  {
+    val.byte=st; 
+    
+  }
+ if(field==tsf_initial)
+  {
+    //printf("%d\n",tsf_initial);
+
+  if(((st&0x30)>>4)==0)
+  val.in_mode=INVAL_val;
+
+  if(((st&0x30)>>4)==1)
+  val.in_mode=LSB_only;
+
+  if(((st&0x30)>>4)==2)
+  val.in_mode=MSB_only;
+
+  if(((st&0x30)>>4)==3)
+  val.in_mode=MSB_after_LSB;
+  }
+  
+
+  if(field==tsf_mode)
+  {
+    //printf("%x\n",st);
+    val.count_mode=((st&0xE)>>1);
+
+    /* printf("%x\n",val.count_mode);
+    val.count_mode=(val.count_mode>>1);
+    printf("%x\n",val.count_mode); */
+  //val.count_mode=(st&0x1C)/4;
+
+ if (val.count_mode==6)
+ val.count_mode=2;
+
+ if (val.count_mode==7)
+ val.count_mode=3;
+
+
+  }
+
+  if(field==tsf_base ) //BCD
+  {
+    //printf("%d\n",tsf_base);
+    if((st&BIT(0))==1)
+    val.bcd=true;
+
+    else val.bcd=false;
+  }
+
+
+ return( timer_print_config(timer, field, val));
+  //printf("%s is not yet implemented!\n", __func__);
+
+  //return 0;
+}

Property changes on: lab4/lab3/timer.c
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/lab3.c
===================================================================
--- lab4/lab3/lab3.c	(nonexistent)
+++ lab4/lab3/lab3.c	(revision 13)
@@ -0,0 +1,228 @@
+#include <lcom/lcf.h>
+#include <minix/sysutil.h>
+
+#include <lcom/lab3.h>
+
+#include <stdbool.h>
+#include "i8254.h"
+#include <stdint.h>
+#include "i8042.h"
+#include "keyboard.h"
+//#include <timer.c>
+
+
+/* #define IRQ_KB 1
+#define DELAY_US 20000
+#define EXIT_CODE 0x81
+#define I_O_BUFFER 0x60 */
+
+uint32_t cnt=0;
+ uint32_t scancode;
+int flag=0;
+
+int main(int argc, char *argv[]) {
+  // sets the language of LCF messages (can be either EN-US or PT-PT)
+  lcf_set_language("EN-US");
+
+  // enables to log function invocations that are being "wrapped" by LCF
+  // [comment this out if you don't want/need it]
+  lcf_trace_calls("/home/lcom/labs/lab3/trace.txt");
+
+  // enables to save the output of printf function calls on a file
+  // [comment this out if you don't want/need it]
+  lcf_log_output("/home/lcom/labs/lab3/output.txt");
+
+  // handles control over to LCF
+  // [LCF handles command line arguments and invokes the right function]
+  if (lcf_start(argc, argv))
+    return 1;
+
+  // LCF clean up tasks
+  // [must be the last statement before return]
+  lcf_cleanup();
+
+  return 0;
+}
+
+
+
+int(kbd_test_scan)() {
+  /* To be completed by the students */
+  int ipc_status;
+  uint8_t r, bit_no = 0;
+  message msg;
+  int hook_id = bit_no;
+/*   uint8_t scan_arr[2] = {0, 0};
+
+  int flag = 0; */
+
+  printf("%d\n",
+         sys_irqsetpolicy(IRQ_KB, IRQ_REENABLE | IRQ_EXCLUSIVE, &hook_id));
+  /* sys_outb(0x64, 0x20);
+  sys_inb(0x64, &scancode);
+  printf("%x\n", scancode);
+  if (scancode & 0x10) {
+    scancode = (scancode & 0xEF);
+  }
+
+  printf("%x\n", scancode);
+  sys_outb(0x64, 0x60);
+  sys_outb(0x64, scancode); */
+
+  printf("%x\n", scancode);
+  //kbc_ih();
+  printf("\n");
+  while (scancode !=
+         EXIT_CODE)
+  { /* You may want to use a different condition */
+    /* Get a request message. */
+    // printf("1\n");
+    // printf("cont:%d, time:%d\n\n",cont/60,time);
+    if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
+      printf("driver_receive failed with: %d", r);
+      continue;
+    }
+    if (is_ipc_notify(ipc_status)) { /* received notification */
+      switch (_ENDPOINT_P(msg.m_source)) {
+      case HARDWARE: /* hardware interrupt notification */
+        if (msg.m_notify.interrupts & BIT(0)) { /* subscribed interrupt */
+
+          kbc_ih();
+          }
+
+        
+        // printf("msg:%x\n",msg.m_notify.interrupts);
+        break;
+      default:
+        // printf("2\n");
+        break; /* no other notifications expected: do nothing */
+      }
+    } else {
+      // printf("3\n"); /* received a standard message, not a notification */
+      /* no standard messages expected: do nothing */
+    }
+  }
+  kbd_print_no_sysinb(cnt);
+  if (sys_irqrmpolicy(&hook_id) != 0)
+    return 1;
+
+  return 0;
+}
+
+int(kbd_test_poll)() {
+  /* To be completed by the students */
+  uint32_t key=0;
+  uint8_t scan_arr[2] = {0, 0};
+  //int flag = 0;
+  //uint32_t cnt=0;
+
+  while(scancode != EXIT_CODE)
+  {
+    tickdelay(micros_to_ticks(DELAY_US));
+    #ifdef LAB3 
+    cnt++; 
+    #endif
+    sys_inb(IN_BUF, &scancode);
+          if (scancode & O_BUFFER_FULL) {
+            #ifdef LAB3 
+            cnt++;
+             #endif
+            sys_inb(I_O_BUFFER, &scancode);
+          if (scancode != TWO_BYTES && flag == 0) {
+            scan_arr[0] = scancode;
+            kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr);
+          }
+
+          else if (scancode == TWO_BYTES) {
+            scan_arr[0] = scancode;
+            flag = 1;
+          }
+
+          else if (flag == 1) {
+            scan_arr[1] = scancode;
+            kbd_print_scancode(!(scancode & PAR_ERR), 2, scan_arr);
+            flag = 0;
+          }
+        }
+  }
+  sys_outb(IN_BUF, READ_CMD);        
+  sys_outb(IN_BUF, I_O_BUFFER);
+
+  #ifdef LAB3 
+    cnt++; 
+  #endif
+
+  sys_inb(I_O_BUFFER,&key); 
+
+  sys_outb(IN_BUF,I_O_BUFFER);        //enable interrupts again
+  sys_outb(I_O_BUFFER,  key |  BIT(0));  
+
+  kbd_print_no_sysinb(cnt);
+  return 0;
+}
+
+int(kbd_test_timed_scan)(uint8_t n) {
+  /* To be completed by the students */
+/*   uint8_t scan_arr[2] = {0, 0};
+  int flag=0; */
+   int ipc_status;
+  message msg;
+  uint8_t r;
+  uint8_t bit_no_timer = 0, bit_no_kbd = 1;
+  int hook_id_kbd=bit_no_kbd, hook_id_timer=bit_no_timer;
+  int cont=0;//cnt=0;
+  
+  sys_irqsetpolicy(IRQ_TIMER,IRQ_REENABLE,&hook_id_timer);
+  sys_irqsetpolicy(IRQ_KB, IRQ_REENABLE | IRQ_EXCLUSIVE, &hook_id_kbd);
+  kbc_ih();
+  while( (cont/DEFAULT_FREQ)<n && scancode !=EXIT_CODE) //se não atingir o tempo de espera nem a tecla for ESC
+ { 
+   /* You may want to use a different condition */
+     /* Get a request message. */
+     // printf("1\n");
+     //printf("cont:%d, time:%d\n\n",cont/60,time);
+     if ( (r = driver_receive(ANY, &msg, &ipc_status)) != 0 ) 
+     { 
+        printf("driver_receive failed with: %d", r);
+       continue;
+    }
+    if (is_ipc_notify(ipc_status)) { 
+        switch (_ENDPOINT_P(msg.m_source)) {
+            case HARDWARE: 				
+                if (msg.m_notify.interrupts  & BIT(bit_no_timer)) { 
+                   cont++;
+                   if(cont%DEFAULT_FREQ==0)
+                   timer_print_elapsed_time();
+                   //printf("cont:%d\n",cont);
+               }
+               if (msg.m_notify.interrupts  & BIT(bit_no_kbd)) 
+               { 
+                    
+                  kbc_ih();
+                   cont=0;
+               }
+                //printf("msg:%x\n",msg.m_notify.interrupts);
+                break;
+            default:
+                //printf("2\n");
+                break; /* no other notifications expected: do nothing */	
+        }
+    } 
+     // printf("3\n"); /* received a standard message, not a notification */
+        /* no standard messages expected: do nothing */
+    
+ 
+ }
+  kbd_print_no_sysinb(cnt);
+  
+  if(sys_irqrmpolicy(&hook_id_timer)!=0) return 1;
+  if(sys_irqrmpolicy(&hook_id_kbd)!=0) return 1;
+  
+    
+    return 0;
+
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+ 
+}

Property changes on: lab4/lab3/lab3.c
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/fts.h
===================================================================
--- lab4/.minix-src/include/fts.h	(nonexistent)
+++ lab4/.minix-src/include/fts.h	(revision 13)
@@ -0,0 +1,151 @@
+/*	$NetBSD: fts.h,v 1.19 2009/08/16 19:33:38 christos Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)fts.h	8.3 (Berkeley) 8/14/94
+ */
+
+#ifndef	_FTS_H_
+#define	_FTS_H_
+
+#ifndef	__fts_stat_t
+#define	__fts_stat_t	struct stat
+#endif
+#ifndef	__fts_nlink_t
+#define	__fts_nlink_t	nlink_t
+#endif
+#ifndef	__fts_ino_t
+#define	__fts_ino_t	ino_t
+#endif
+#ifndef	__fts_length_t
+#define	__fts_length_t	unsigned int
+#endif
+#ifndef	__fts_number_t
+#define	__fts_number_t	int64_t
+#endif
+#ifndef	__fts_dev_t
+#define	__fts_dev_t	dev_t
+#endif
+#ifndef	__fts_level_t
+#define	__fts_level_t	int
+#endif
+
+typedef struct {
+	struct _ftsent *fts_cur;	/* current node */
+	struct _ftsent *fts_child;	/* linked list of children */
+	struct _ftsent **fts_array;	/* sort array */
+	dev_t fts_dev;			/* starting device # */
+	char *fts_path;			/* path for this descent */
+	int fts_rfd;			/* fd for root */
+	unsigned int fts_pathlen;	/* sizeof(path) */
+	unsigned int fts_nitems;	/* elements in the sort array */
+	int (*fts_compar)		/* compare function */
+		(const struct _ftsent **, const struct _ftsent **);
+
+#define	FTS_COMFOLLOW	0x001		/* follow command line symlinks */
+#define	FTS_LOGICAL	0x002		/* logical walk */
+#define	FTS_NOCHDIR	0x004		/* don't change directories */
+#define	FTS_NOSTAT	0x008		/* don't get stat info */
+#define	FTS_PHYSICAL	0x010		/* physical walk */
+#define	FTS_SEEDOT	0x020		/* return dot and dot-dot */
+#define	FTS_XDEV	0x040		/* don't cross devices */
+#define	FTS_WHITEOUT	0x080		/* return whiteout information */
+#define	FTS_OPTIONMASK	0x0ff		/* valid user option mask */
+
+#define	FTS_NAMEONLY	0x100		/* (private) child names only */
+#define	FTS_STOP	0x200		/* (private) unrecoverable error */
+	int fts_options;		/* fts_open options, global flags */
+} FTS;
+
+typedef struct _ftsent {
+	struct _ftsent *fts_cycle;	/* cycle node */
+	struct _ftsent *fts_parent;	/* parent directory */
+	struct _ftsent *fts_link;	/* next file in directory */
+	__fts_number_t fts_number;      /* local numeric value */
+	void *fts_pointer;	        /* local address value */
+	char *fts_accpath;		/* access path */
+	char *fts_path;			/* root path */
+	int fts_errno;			/* errno for this node */
+	int fts_symfd;			/* fd for symlink */
+	__fts_length_t fts_pathlen;	/* strlen(fts_path) */
+	__fts_length_t fts_namelen;	/* strlen(fts_name) */
+
+	__fts_ino_t fts_ino;		/* inode */
+	__fts_dev_t fts_dev;		/* device */
+	__fts_nlink_t fts_nlink;	/* link count */
+
+#define	FTS_ROOTPARENTLEVEL	-1
+#define	FTS_ROOTLEVEL		 0
+	__fts_level_t fts_level;		/* depth (-1 to N) */
+
+#define	FTS_D		 1		/* preorder directory */
+#define	FTS_DC		 2		/* directory that causes cycles */
+#define	FTS_DEFAULT	 3		/* none of the above */
+#define	FTS_DNR		 4		/* unreadable directory */
+#define	FTS_DOT		 5		/* dot or dot-dot */
+#define	FTS_DP		 6		/* postorder directory */
+#define	FTS_ERR		 7		/* error; errno is set */
+#define	FTS_F		 8		/* regular file */
+#define	FTS_INIT	 9		/* initialized only */
+#define	FTS_NS		10		/* stat(2) failed */
+#define	FTS_NSOK	11		/* no stat(2) requested */
+#define	FTS_SL		12		/* symbolic link */
+#define	FTS_SLNONE	13		/* symbolic link without target */
+#define	FTS_W		14		/* whiteout object */
+	unsigned short fts_info;	/* user flags for FTSENT structure */
+
+#define	FTS_DONTCHDIR	 0x01		/* don't chdir .. to the parent */
+#define	FTS_SYMFOLLOW	 0x02		/* followed a symlink to get here */
+#define	FTS_ISW		 0x04		/* this is a whiteout object */
+	unsigned short fts_flags;	/* private flags for FTSENT structure */
+
+#define	FTS_AGAIN	 1		/* read node again */
+#define	FTS_FOLLOW	 2		/* follow symbolic link */
+#define	FTS_NOINSTR	 3		/* no instructions */
+#define	FTS_SKIP	 4		/* discard node */
+	unsigned short fts_instr;	/* fts_set() instructions */
+
+	__fts_stat_t *fts_statp;	/* stat(2) information */
+	char fts_name[1];		/* file name */
+} FTSENT;
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#ifndef	__LIBC12_SOURCE__
+FTSENT	*fts_children(FTS *, int)		__RENAME(__fts_children60);
+int	 fts_close(FTS *)			__RENAME(__fts_close60);
+FTS	*fts_open(char * const *, int,
+    int (*)(const FTSENT **, const FTSENT **))	__RENAME(__fts_open60);
+FTSENT	*fts_read(FTS *)			__RENAME(__fts_read60);
+int	 fts_set(FTS *, FTSENT *, int)		__RENAME(__fts_set60);
+#endif
+__END_DECLS
+
+#endif /* !_FTS_H_ */

Property changes on: lab4/.minix-src/include/fts.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/gelf.h
===================================================================
--- lab4/.minix-src/include/gelf.h	(nonexistent)
+++ lab4/.minix-src/include/gelf.h	(revision 13)
@@ -0,0 +1,110 @@
+/*	$NetBSD: gelf.h,v 1.2 2014/03/09 16:58:04 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2006,2008 Joseph Koshy
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Id: gelf.h 1168 2010-09-04 01:03:25Z jkoshy 
+ */
+
+#ifndef	_GELF_H_
+#define	_GELF_H_
+
+#include <sys/cdefs.h>
+
+#include <libelf.h>
+
+typedef Elf64_Addr	GElf_Addr;	/* Addresses */
+typedef Elf64_Half	GElf_Half;	/* Half words (16 bit) */
+typedef Elf64_Off	GElf_Off;	/* Offsets */
+typedef Elf64_Sword	GElf_Sword;	/* Signed words (32 bit) */
+typedef Elf64_Sxword	GElf_Sxword;	/* Signed long words (64 bit) */
+typedef Elf64_Word	GElf_Word;	/* Unsigned words (32 bit) */
+typedef Elf64_Xword	GElf_Xword;	/* Unsigned long words (64 bit) */
+
+typedef Elf64_Dyn	GElf_Dyn;	/* ".dynamic" section entries */
+typedef Elf64_Ehdr	GElf_Ehdr;	/* ELF header */
+typedef Elf64_Phdr	GElf_Phdr;	/* Program header */
+typedef Elf64_Shdr	GElf_Shdr;	/* Section header */
+typedef Elf64_Sym	GElf_Sym;	/* Symbol table entries */
+typedef Elf64_Rel	GElf_Rel;	/* Relocation entries */
+typedef Elf64_Rela	GElf_Rela;	/* Relocation entries with addend */
+
+typedef	Elf64_Cap	GElf_Cap;	/* SW/HW capabilities */
+typedef Elf64_Move	GElf_Move;	/* Move entries */
+typedef Elf64_Syminfo	GElf_Syminfo;	/* Symbol information */
+
+#define	GELF_M_INFO			ELF64_M_INFO
+#define	GELF_M_SIZE			ELF64_M_SIZE
+#define	GELF_M_SYM			ELF64_M_SYM
+
+#define	GELF_R_INFO			ELF64_R_INFO
+#define	GELF_R_SYM			ELF64_R_SYM
+#define	GELF_R_TYPE			ELF64_R_TYPE
+#define	GELF_R_TYPE_DATA		ELF64_R_TYPE_DATA
+#define	GELF_R_TYPE_ID			ELF64_R_TYPE_ID
+#define	GELF_R_TYPE_INFO		ELF64_R_TYPE_INFO
+
+#define	GELF_ST_BIND			ELF64_ST_BIND
+#define	GELF_ST_INFO			ELF64_ST_INFO
+#define	GELF_ST_TYPE			ELF64_ST_TYPE
+#define	GELF_ST_VISIBILITY		ELF64_ST_VISIBILITY
+
+__BEGIN_DECLS
+long		gelf_checksum(Elf *_elf);
+size_t		gelf_fsize(Elf *_elf, Elf_Type _type, size_t _count,
+			unsigned int _version);
+int		gelf_getclass(Elf *_elf);
+GElf_Dyn	*gelf_getdyn(Elf_Data *_data, int _index, GElf_Dyn *_dst);
+GElf_Ehdr	*gelf_getehdr(Elf *_elf, GElf_Ehdr *_dst);
+GElf_Phdr	*gelf_getphdr(Elf *_elf, int _index, GElf_Phdr *_dst);
+GElf_Rel	*gelf_getrel(Elf_Data *_src, int _index, GElf_Rel *_dst);
+GElf_Rela	*gelf_getrela(Elf_Data *_src, int _index, GElf_Rela *_dst);
+GElf_Shdr	*gelf_getshdr(Elf_Scn *_scn, GElf_Shdr *_dst);
+GElf_Sym	*gelf_getsym(Elf_Data *_src, int _index, GElf_Sym *_dst);
+GElf_Sym	*gelf_getsymshndx(Elf_Data *_src, Elf_Data *_shindexsrc,
+			int _index, GElf_Sym *_dst, Elf32_Word *_shindexdst);
+void *		gelf_newehdr(Elf *_elf, int _class);
+void *		gelf_newphdr(Elf *_elf, size_t _phnum);
+int		gelf_update_dyn(Elf_Data *_dst, int _index, GElf_Dyn *_src);
+int		gelf_update_ehdr(Elf *_elf, GElf_Ehdr *_src);
+int		gelf_update_phdr(Elf *_elf, int _index, GElf_Phdr *_src);
+int		gelf_update_rel(Elf_Data *_dst, int _index, GElf_Rel *_src);
+int		gelf_update_rela(Elf_Data *_dst, int _index, GElf_Rela *_src);
+int		gelf_update_shdr(Elf_Scn *_dst, GElf_Shdr *_src);
+int		gelf_update_sym(Elf_Data *_dst, int _index, GElf_Sym *_src);
+int		gelf_update_symshndx(Elf_Data *_symdst, Elf_Data *_shindexdst,
+			int _index, GElf_Sym *_symsrc, Elf32_Word _shindexsrc);
+Elf_Data 	*gelf_xlatetof(Elf *_elf, Elf_Data *_dst, const Elf_Data *_src, unsigned int _encode);
+Elf_Data 	*gelf_xlatetom(Elf *_elf, Elf_Data *_dst, const Elf_Data *_src, unsigned int _encode);
+
+GElf_Cap	*gelf_getcap(Elf_Data *_data, int _index, GElf_Cap *_cap);
+GElf_Move	*gelf_getmove(Elf_Data *_src, int _index, GElf_Move *_dst);
+GElf_Syminfo	*gelf_getsyminfo(Elf_Data *_src, int _index, GElf_Syminfo *_dst);
+int		gelf_update_cap(Elf_Data *_dst, int _index, GElf_Cap *_src);
+int		gelf_update_move(Elf_Data *_dst, int _index, GElf_Move *_src);
+int		gelf_update_syminfo(Elf_Data *_dst, int _index, GElf_Syminfo *_src);
+__END_DECLS
+
+#endif	/* _GELF_H_ */

Property changes on: lab4/.minix-src/include/gelf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/lab4/.vscode/c_cpp_properties.json
===================================================================
--- lab4/lab4/.vscode/c_cpp_properties.json	(nonexistent)
+++ lab4/lab4/.vscode/c_cpp_properties.json	(revision 13)
@@ -0,0 +1,18 @@
+{
+  "env": {
+    "minix.include": "${workspaceFolder}/../.minix-src/include"
+  },
+  "configurations": [{
+    "name": "Minix",
+    "compilerPath": "",
+    "cStandard": "c11",
+    "defines": ["__minix", "_MINIX ", "_NETBSD_SOURCE", "__i386__"],
+    "includePath": ["${workspaceFolder}", "${env:minix.include}"],
+    "browse": {
+      "path": ["${workspaceFolder}", "${env:minix.include}"],
+      "limitSymbolsToIncludedHeaders": false,
+      "databaseFilename": ""
+    }
+  }],
+  "version": 4
+}

Property changes on: lab4/lab4/.vscode/c_cpp_properties.json
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/hesiod.h
===================================================================
--- lab4/.minix-src/include/hesiod.h	(nonexistent)
+++ lab4/.minix-src/include/hesiod.h	(revision 13)
@@ -0,0 +1,89 @@
+/*	$NetBSD: hesiod.h,v 1.5 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1996 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef _HESIOD_H_
+#define _HESIOD_H_
+
+	/* Application-visible indication that we have the new interfaces */
+
+#define HESIOD_INTERFACES
+
+	/* Configuration information. */
+
+#ifndef _PATH_HESIOD_CONF			/* Configuration file. */
+#define _PATH_HESIOD_CONF	"/etc/hesiod.conf"
+#endif
+
+#define DEF_RHS		""			/* Defaults if HESIOD_CONF */
+#define DEF_LHS		""			/*    file is not present. */
+
+	/* Error codes (for backwards compatibility) */
+
+#define	HES_ER_UNINIT	-1	/* uninitialized */
+#define	HES_ER_OK	0	/* no error */
+#define	HES_ER_NOTFOUND	1	/* Hesiod name not found by server */
+#define HES_ER_CONFIG	2	/* local problem (no config file?) */
+#define HES_ER_NET	3	/* network problem */
+
+	/* Declaration of routines */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	hesiod_init	(void **);
+char  **hesiod_resolve	(void *, const char *, const char *);
+void	hesiod_free_list(void *, char **);
+char   *hesiod_to_bind	(void *, const char *, const char *);
+void	hesiod_end	(void *);
+
+				/* backwards compatibility */
+int	hes_init	(void);
+char   *hes_to_bind	(const char *, const char *);
+char  **hes_resolve	(const char *, const char *);
+int	hes_error	(void);
+void	hes_free	(char **);
+__END_DECLS
+
+#endif /* ! _HESIOD_H_ */

Property changes on: lab4/.minix-src/include/hesiod.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ifaddrs.h
===================================================================
--- lab4/.minix-src/include/ifaddrs.h	(nonexistent)
+++ lab4/.minix-src/include/ifaddrs.h	(revision 13)
@@ -0,0 +1,56 @@
+/*	$NetBSD: ifaddrs.h,v 1.5 2005/02/03 04:39:32 perry Exp $	*/
+
+/*
+ * Copyright (c) 1995, 1999
+ *	Berkeley Software Design, Inc.  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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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.
+ *
+ *	BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp
+ */
+
+#ifndef	_IFADDRS_H_
+#define	_IFADDRS_H_
+
+struct ifaddrs {
+	struct ifaddrs  *ifa_next;
+	char		*ifa_name;
+	u_int		 ifa_flags;
+	struct sockaddr	*ifa_addr;
+	struct sockaddr	*ifa_netmask;
+	struct sockaddr	*ifa_dstaddr;
+	void		*ifa_data;
+};
+
+/*
+ * This may have been defined in <net/if.h>.  Note that if <net/if.h> is
+ * to be included it must be included before this header file.
+ */
+#ifndef	ifa_broadaddr
+#define	ifa_broadaddr	ifa_dstaddr	/* broadcast address interface */
+#endif
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int getifaddrs(struct ifaddrs **);
+void freeifaddrs(struct ifaddrs *);
+__END_DECLS
+
+#endif /* !_IFADDRS_H_ */

Property changes on: lab4/.minix-src/include/ifaddrs.h
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/trace.txt
===================================================================
--- lab4/lab3/trace.txt	(nonexistent)
+++ lab4/lab3/trace.txt	(revision 13)
@@ -0,0 +1,5115 @@
+@lcflib.a:2019, lcf_start
+  kbd_test_timed_scan(n)
+> kbd_test_timed_scan(5)
+  @lab3.c:175, kbd_test_timed_scan
+    sys_irqsetpolicy(IRQ_TIMER, IRQ_REENABLE, &hook_id_timer)
+  > sys_irqsetpolicy(0, 1, addr: 0xeffff748 [0])
+  < sys_irqsetpolicy(0, 1, addr: 0xeffff748 [10]) -> (ret: 0)
+  @lab3.c:176, kbd_test_timed_scan
+    sys_irqsetpolicy(IRQ_KB, IRQ_REENABLE | IRQ_EXCLUSIVE, &hook_id_kbd)
+  > sys_irqsetpolicy(1, 3, addr: 0xeffff74c [1])
+  < sys_irqsetpolicy(1, 3, addr: 0xeffff74c [11]) -> (ret: 0)
+  @lab3.c:177, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1c = 0b00011100])
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x9c = 0b10011100])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x9c"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x9c]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:195, kbd_test_timed_scan
+    timer_print_elapsed_time()
+    "timer_test_int:timer_print_elapsed_time 1 s"
+  < timer_print_elapsed_time() -> (ret: 1)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x15 = 0b00010101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x15"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x15]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x95 = 0b10010101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x95"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x95]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x1f = 0b00011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x1f"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x1f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x9f = 0b10011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x9f"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x9f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xa5 = 0b10100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0xa5"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0xa5]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x20 = 0b00100000])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x20"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x20]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xa0 = 0b10100000])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0xa0"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0xa0]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xa5 = 0b10100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0xa5"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0xa5]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x39 = 0b00111001])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x39"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x39]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xb9 = 0b10111001])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0xb9"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0xb9]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xa5 = 0b10100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0xa5"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0xa5]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x22 = 0b00100010])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x22"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x22]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000011]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x21 = 0b00100001])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x21"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x21]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x2d = 0b00101101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x2d"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x2d]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xa2 = 0b10100010])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0xa2"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0xa2]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xa1 = 0b10100001])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0xa1"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0xa1]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000011]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xad = 0b10101101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0xad"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0xad]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xe0 = 0b11100000])
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000011]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x4b = 0b01001011])
+    @keyboard.c:43, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 2, scan_arr)
+      "Makecode: 0x00 0x4b"
+    < kbd_print_scancode(true, 2, addr: 0xeffff67e [0x00, 0x4b]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xe0 = 0b11100000])
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000011]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x50 = 0b01010000])
+    @keyboard.c:43, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 2, scan_arr)
+      "Makecode: 0x00 0x50"
+    < kbd_print_scancode(true, 2, addr: 0xeffff67e [0x00, 0x50]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xe0 = 0b11100000])
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000011]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xcb = 0b11001011])
+    @keyboard.c:43, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 2, scan_arr)
+      "Breakcode: 0x00 0xcb"
+    < kbd_print_scancode(false, 2, addr: 0xeffff67e [0x00, 0xcb]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xe0 = 0b11100000])
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xd0 = 0b11010000])
+    @keyboard.c:43, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 2, scan_arr)
+      "Breakcode: 0x00 0xd0"
+    < kbd_print_scancode(false, 2, addr: 0xeffff67e [0x00, 0xd0]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x25 = 0b00100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x25"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x25]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0xa5 = 0b10100101])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0xa5"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0xa5]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:195, kbd_test_timed_scan
+    timer_print_elapsed_time()
+    "timer_test_int:timer_print_elapsed_time 2 s"
+  < timer_print_elapsed_time() -> (ret: 2)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x1f = 0b00011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x1f"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x1f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x9f = 0b10011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x9f"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x9f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:195, kbd_test_timed_scan
+    timer_print_elapsed_time()
+    "timer_test_int:timer_print_elapsed_time 3 s"
+  < timer_print_elapsed_time() -> (ret: 3)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x1f = 0b00011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x1f"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x1f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x9f = 0b10011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x9f"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x9f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x1f = 0b00011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x1f"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x1f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x9f = 0b10011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x9f"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x9f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x1f = 0b00011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x1f"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x1f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x9f = 0b10011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x9f"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x9f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x1f = 0b00011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x1f"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x1f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x9f = 0b10011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x9f"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x9f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x1f = 0b00011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x1f"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x1f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x9f = 0b10011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x9f"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x9f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x1f = 0b00011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x1f"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x1f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x9f = 0b10011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x9f"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x9f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x1f = 0b00011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Makecode: 0x1f"
+    < kbd_print_scancode(true, 1, addr: 0xeffff67e [0x1f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000010]>)
+  @lab3.c:201, kbd_test_timed_scan
+    kbc_ih()
+    @keyboard.c:25, kbc_ih
+      sys_inb(IN_BUF, &scancode)
+    > sys_inb(0x64, addr: 0x81d6620)
+    < sys_inb(0x64, addr: 0x81d6620 [0x1d = 0b00011101])
+    @keyboard.c:30, kbc_ih
+      sys_inb(I_O_BUFFER, &scancode)
+    > sys_inb(0x60, addr: 0x81d6620)
+    < sys_inb(0x60, addr: 0x81d6620 [0x9f = 0b10011111])
+    @keyboard.c:33, kbc_ih
+      kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr)
+      "Breakcode: 0x9f"
+    < kbd_print_scancode(false, 1, addr: 0xeffff67e [0x9f]) -> (ret: 0)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:195, kbd_test_timed_scan
+    timer_print_elapsed_time()
+    "timer_test_int:timer_print_elapsed_time 4 s"
+  < timer_print_elapsed_time() -> (ret: 4)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:195, kbd_test_timed_scan
+    timer_print_elapsed_time()
+    "timer_test_int:timer_print_elapsed_time 5 s"
+  < timer_print_elapsed_time() -> (ret: 5)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:195, kbd_test_timed_scan
+    timer_print_elapsed_time()
+    "timer_test_int:timer_print_elapsed_time 6 s"
+  < timer_print_elapsed_time() -> (ret: 6)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:195, kbd_test_timed_scan
+    timer_print_elapsed_time()
+    "timer_test_int:timer_print_elapsed_time 7 s"
+  < timer_print_elapsed_time() -> (ret: 7)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:184, kbd_test_timed_scan
+    driver_receive(ANY, &msg, &ipc_status)
+  > driver_receive(ANY, addr: 0xeffff750, addr: 0xeffff798)
+  < driver_receive(<[HARDWARE: 0b0000000000000000000000000000000000000000000000000000000000000001]>)
+  @lab3.c:195, kbd_test_timed_scan
+    timer_print_elapsed_time()
+    "timer_test_int:timer_print_elapsed_time 8 s"
+  < timer_print_elapsed_time() -> (ret: 8)
+  @lab3.c:216, kbd_test_timed_scan
+    kbd_print_no_sysinb(cnt)
+    "sys_inb_calls: 127"
+  @lab3.c:218, kbd_test_timed_scan
+    sys_irqrmpolicy(&hook_id_timer)
+  > sys_irqrmpolicy(addr: 0xeffff748 [10])
+  < sys_irqrmpolicy(addr: 0xeffff748 [10]) -> (ret: 0)
+  @lab3.c:219, kbd_test_timed_scan
+    sys_irqrmpolicy(&hook_id_kbd)
+  > sys_irqrmpolicy(addr: 0xeffff74c [11])
+  < sys_irqrmpolicy(addr: 0xeffff74c [11]) -> (ret: 0)
+< kbd_test_timed_scan(5) -> (ret: 0)

Property changes on: lab4/lab3/trace.txt
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/langinfo.h
===================================================================
--- lab4/.minix-src/include/langinfo.h	(nonexistent)
+++ lab4/.minix-src/include/langinfo.h	(revision 13)
@@ -0,0 +1,101 @@
+/*	$NetBSD: langinfo.h,v 1.10 2013/08/19 08:03:33 joerg Exp $	*/
+
+/*
+ * Written by J.T. Conklin <jtc@NetBSD.org>
+ * Public domain.
+ */
+
+#ifndef _LANGINFO_H_
+#define _LANGINFO_H_
+
+#include <sys/cdefs.h>
+#include <nl_types.h>
+
+#define D_T_FMT		((nl_item)0)	/* String for formatting date and
+					   time */
+#define D_FMT		((nl_item)1)	/* Date format string */
+#define	T_FMT		((nl_item)2)	/* Time format string */
+#define T_FMT_AMPM	((nl_item)3)	/* Time format string with 12 hour
+					   clock */
+#define AM_STR		((nl_item)4)	/* Ante Meridiem afix */
+#define PM_STR		((nl_item)5)	/* Post Meridiem afix */
+
+#define DAY_1		((nl_item)6)	/* Name of the first day of the week */
+#define DAY_2		((nl_item)7)
+#define DAY_3		((nl_item)8)
+#define DAY_4		((nl_item)9)
+#define DAY_5		((nl_item)10)
+#define DAY_6		((nl_item)11)
+#define DAY_7		((nl_item)12)
+
+#define ABDAY_1		((nl_item)13)	/* Abbrev. name of the first day of
+					   the week */
+#define ABDAY_2		((nl_item)14)
+#define ABDAY_3		((nl_item)15)
+#define ABDAY_4		((nl_item)16)
+#define ABDAY_5		((nl_item)17)
+#define ABDAY_6		((nl_item)18)
+#define ABDAY_7		((nl_item)19)
+
+#define MON_1		((nl_item)20)	/* Name of the first month */
+#define MON_2		((nl_item)21)
+#define MON_3		((nl_item)22)
+#define MON_4		((nl_item)23)
+#define MON_5		((nl_item)24)
+#define MON_6		((nl_item)25)
+#define MON_7		((nl_item)26)
+#define MON_8		((nl_item)27)
+#define MON_9		((nl_item)28)
+#define MON_10		((nl_item)29)
+#define MON_11		((nl_item)30)
+#define MON_12		((nl_item)31)
+
+#define ABMON_1		((nl_item)32)	/* Abbrev. name of the first month */
+#define ABMON_2		((nl_item)33)
+#define ABMON_3		((nl_item)34)
+#define ABMON_4		((nl_item)35)
+#define ABMON_5		((nl_item)36)
+#define ABMON_6		((nl_item)37)
+#define ABMON_7		((nl_item)38)
+#define ABMON_8		((nl_item)39)
+#define ABMON_9		((nl_item)40)
+#define ABMON_10	((nl_item)41)
+#define ABMON_11	((nl_item)42)
+#define ABMON_12	((nl_item)43)
+
+#define RADIXCHAR	((nl_item)44)	/* Radix character */
+#define THOUSEP		((nl_item)45)	/* Separator for thousands */
+#define YESSTR		((nl_item)46)	/* Affirmitive response for yes/no
+					   queries */
+#define YESEXPR		((nl_item)47)	/* Affirmitive response for yes/no
+					   queries */
+#define NOSTR		((nl_item)48)	/* Negative response for yes/no
+					   queries */
+#define NOEXPR		((nl_item)49)	/* Negative response for yes/no
+					   queries */
+#define CRNCYSTR	((nl_item)50)	/* Currency symbol */
+
+#define CODESET		((nl_item)51)	/* codeset name */
+
+#define ERA		((nl_item)52)	/* Era description segments */
+#define ERA_D_FMT	((nl_item)53)	/* Era date format string */
+#define ERA_D_T_FMT	((nl_item)54)	/* Era date and time format string */
+#define ERA_T_FMT	((nl_item)55)	/* Era time format string */
+
+#define ALT_DIGITS	((nl_item)56)	/* Alternative symbols for digits */
+
+__BEGIN_DECLS
+char *nl_langinfo(nl_item);
+__END_DECLS
+
+#if defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+__BEGIN_DECLS
+char *nl_langinfo_l(nl_item, locale_t);
+__END_DECLS
+#endif
+
+#endif	/* _LANGINFO_H_ */

Property changes on: lab4/.minix-src/include/langinfo.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/libexec.h
===================================================================
--- lab4/.minix-src/include/libexec.h	(nonexistent)
+++ lab4/.minix-src/include/libexec.h	(revision 13)
@@ -0,0 +1,75 @@
+#ifndef _LIBEXEC_H_
+#define _LIBEXEC_H_ 1
+
+#include <sys/exec_elf.h>
+
+struct exec_info;
+
+typedef int (*libexec_loadfunc_t)(struct exec_info *execi,
+	off_t offset, vir_bytes vaddr, size_t len);
+
+typedef int (*libexec_clearfunc_t)(struct exec_info *execi,
+	vir_bytes vaddr, size_t len);
+
+typedef int (*libexec_allocfunc_t)(struct exec_info *execi,
+	vir_bytes vaddr, size_t len);
+
+typedef int (*libexec_procclearfunc_t)(struct exec_info *execi);
+
+typedef int (*libexec_mmap_t)(struct exec_info *execi,
+	vir_bytes vaddr, vir_bytes len, vir_bytes foffset, u16_t clearend,
+	int protflags);
+
+struct exec_info {
+    /* Filled in by libexec caller */
+    endpoint_t  proc_e;                 /* Process endpoint */
+    char *hdr;                          /* Header or full image */
+    size_t hdr_len;                     /* Size of hdr */
+    vir_bytes frame_len;                /* Stack size */
+    char progname[PROC_NAME_LEN];       /* Program name */
+    uid_t new_uid;                      /* Process UID after exec */
+    gid_t new_gid;                      /* Process GID after exec */
+    int allow_setuid;                   /* Allow set{u,g}id execution? */
+    vir_bytes stack_size;		/* Desired stack size */
+    vir_bytes load_offset;		/* Desired load offset */
+    vir_bytes text_size;		/* Text segment size */
+    vir_bytes data_size;		/* Data segment size */
+    off_t filesize;			/* How big is the file */
+
+    /* Callback pointers for use by libexec */
+    libexec_loadfunc_t copymem;		/* Copy callback */
+    libexec_clearfunc_t clearmem;	/* Clear callback */
+    libexec_allocfunc_t allocmem_prealloc_cleared; /* Alloc callback */
+    libexec_allocfunc_t allocmem_prealloc_junk; /* Alloc callback */
+    libexec_allocfunc_t allocmem_ondemand; /* Alloc callback */
+    libexec_procclearfunc_t clearproc;	/* Clear process callback */
+    libexec_mmap_t memmap;		/* mmap callback */
+    void *opaque;			/* Callback data */
+
+    /* Filled in by libexec load function */
+    vir_bytes load_base;		/* Where executable is loaded */
+    vir_bytes pc;                       /* Entry point of exec file */
+    vir_bytes stack_high;		/* High stack addr */
+};
+
+int elf_has_interpreter(char *exec_hdr, size_t hdr_len, char *interp,
+	size_t maxsz);
+int elf_phdr(char *exec_hdr, size_t hdr_len, vir_bytes *phdr);
+
+int libexec_pm_newexec(endpoint_t proc_e, struct exec_info *execi);
+
+typedef int (*libexec_exec_loadfunc_t)(struct exec_info *execi);
+int libexec_load_elf(struct exec_info *execi);
+
+/* Default callbacks for kernel. */
+int libexec_copy_memcpy(struct exec_info *execi, off_t offset, vir_bytes vaddr, size_t len);
+int libexec_clear_memset(struct exec_info *execi, vir_bytes vaddr, size_t len);
+
+/* Default callbacks. */
+int libexec_alloc_mmap_prealloc_cleared(struct exec_info *execi, vir_bytes vaddr, size_t len);
+int libexec_alloc_mmap_prealloc_junk(struct exec_info *execi, vir_bytes vaddr, size_t len);
+int libexec_alloc_mmap_ondemand(struct exec_info *execi, vir_bytes vaddr, size_t len);
+int libexec_clearproc_vm_procctl(struct exec_info *execi);
+int libexec_clear_sys_memset(struct exec_info *execi, vir_bytes vaddr, size_t len);
+
+#endif /* !_LIBEXEC_H_ */

Property changes on: lab4/.minix-src/include/libexec.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/limits.h
===================================================================
--- lab4/.minix-src/include/limits.h	(nonexistent)
+++ lab4/.minix-src/include/limits.h	(revision 13)
@@ -0,0 +1,164 @@
+/*	$NetBSD: limits.h,v 1.34 2015/05/29 07:37:31 manu Exp $	*/
+
+/*
+ * Copyright (c) 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)limits.h	8.2 (Berkeley) 1/4/94
+ */
+
+#ifndef _LIMITS_H_
+#define	_LIMITS_H_
+
+#include <sys/featuretest.h>
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define	_POSIX_AIO_LISTIO_MAX	2
+#define	_POSIX_AIO_MAX		1
+#define	_POSIX_ARG_MAX		4096
+#define	_POSIX_CHILD_MAX	25
+#define	_POSIX_HOST_NAME_MAX	255
+#define	_POSIX_LINK_MAX		8
+#define	_POSIX_LOGIN_NAME_MAX	9
+#define	_POSIX_MAX_CANON	255
+#define	_POSIX_MAX_INPUT	255
+#define	_POSIX_MQ_OPEN_MAX	8
+#define	_POSIX_MQ_PRIO_MAX	32
+#define	_POSIX_NAME_MAX		14
+#define	_POSIX_NGROUPS_MAX	8
+#define	_POSIX_OPEN_MAX		20
+#define	_POSIX_PATH_MAX		256
+#define	_POSIX_PIPE_BUF		512
+#define	_POSIX_RE_DUP_MAX	255
+#define	_POSIX_SSIZE_MAX	32767
+#define	_POSIX_STREAM_MAX	8
+#define	_POSIX_SYMLINK_MAX	255
+#define	_POSIX_SYMLOOP_MAX	8
+
+/*
+ * We have not implemented these yet
+ *
+ * _POSIX_THREAD_ATTR_STACKADDR
+ * _POSIX_THREAD_ATTR_STACKSIZE
+ * _POSIX_THREAD_CPUTIME
+ * _POSIX_THREAD_PRIORITY_SCHEDULING
+ * _POSIX_THREAD_PRIO_INHERIT
+ * _POSIX_THREAD_PRIO_PROTECT
+ * _POSIX_THREAD_PROCESS_SHARED
+ * _POSIX_THREAD_SAFE_FUNCTIONS
+ * _POSIX_THREAD_SPORADIC_SERVER
+ */
+
+/*
+ * The following 3 are defined in 
+ * Open Group Base Specifications Issue 7
+ */
+#define	_POSIX_THREAD_DESTRUCTOR_ITERATIONS	4
+#define	_POSIX_THREAD_KEYS_MAX			128
+#define	_POSIX_THREAD_THREADS_MAX		64
+
+/*
+ * These are the correct names, defined in terms of the above
+ * except for PTHREAD_KEYS_MAX which is bigger than standard 
+ * mandated minimum value _POSIX_THREAD_KEYS_MAX.
+ */
+#define	PTHREAD_DESTRUCTOR_ITERATIONS 	_POSIX_THREAD_DESTRUCTOR_ITERATIONS
+#define	PTHREAD_KEYS_MAX		256
+/* Not yet: PTHREAD_STACK_MIN */
+#define	PTHREAD_THREADS_MAX		_POSIX_THREAD_THREADS_MAX
+
+#define	_POSIX_TIMER_MAX	32
+#define	_POSIX_TTY_NAME_MAX	9
+#define	_POSIX_TZNAME_MAX	6
+
+#define	_POSIX2_BC_BASE_MAX	99
+#define	_POSIX2_BC_DIM_MAX	2048
+#define	_POSIX2_BC_SCALE_MAX	99
+#define	_POSIX2_BC_STRING_MAX	1000
+#define	_POSIX2_CHARCLASS_NAME_MAX	14
+#define	_POSIX2_COLL_WEIGHTS_MAX	2
+#define	_POSIX2_EXPR_NEST_MAX	32
+#define	_POSIX2_LINE_MAX	2048
+#define	_POSIX2_RE_DUP_MAX	255
+
+/*
+ * X/Open CAE Specifications,
+ * adopted in IEEE Std 1003.1-2001 XSI.
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define	_XOPEN_IOV_MAX		16
+#define	_XOPEN_NAME_MAX		256
+#define	_XOPEN_PATH_MAX		1024
+
+#define PASS_MAX		128		/* Legacy */
+
+#define CHARCLASS_NAME_MAX	14
+#define NL_ARGMAX		9
+#define NL_LANGMAX		14
+#define NL_MSGMAX		32767
+#define NL_NMAX			1
+#define NL_SETMAX		255
+#define NL_TEXTMAX		2048
+
+	/* IEEE Std 1003.1-2001 TSF */
+#define	_GETGR_R_SIZE_MAX	1024
+#define	_GETPW_R_SIZE_MAX	1024
+
+/* Always ensure that this is consistent with <stdio.h> */
+#ifndef TMP_MAX
+#define TMP_MAX			308915776	/* Legacy */
+#endif
+#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#define MB_LEN_MAX		32	/* Allow ISO/IEC 2022 */
+
+/*
+ * X/Open Extended API set 2 (a.k.a. C063)
+ * This hides unimplemented functions from GNU configure until
+ * we are done implementing them.
+ */
+#if !defined(_INCOMPLETE_XOPEN_C063)
+#define __stub_fexecve
+#endif
+
+#include <machine/limits.h>
+
+#ifdef __CHAR_UNSIGNED__
+# define CHAR_MIN     0
+# define CHAR_MAX     UCHAR_MAX
+#else
+# define CHAR_MIN     SCHAR_MIN
+# define CHAR_MAX     SCHAR_MAX
+#endif
+
+#include <sys/syslimits.h>
+
+#endif /* !_LIMITS_H_ */

Property changes on: lab4/.minix-src/include/limits.h
___________________________________________________________________
Added: svn:executable
Index: lab4/lab4/lab4.c
===================================================================
--- lab4/lab4/lab4.c	(nonexistent)
+++ lab4/lab4/lab4.c	(revision 13)
@@ -0,0 +1,56 @@
+// IMPORTANT: you must include the following line in all your C files
+#include <lcom/lcf.h>
+
+#include <stdint.h>
+#include <stdio.h>
+
+// Any header files included below this line should have been created by you
+
+int main(int argc, char *argv[]) {
+  // sets the language of LCF messages (can be either EN-US or PT-PT)
+  lcf_set_language("EN-US");
+
+  // enables to log function invocations that are being "wrapped" by LCF
+  // [comment this out if you don't want/need/ it]
+  lcf_trace_calls("/home/lcom/labs/lab4/trace.txt");
+
+  // enables to save the output of printf function calls on a file
+  // [comment this out if you don't want/need it]
+  lcf_log_output("/home/lcom/labs/lab4/output.txt");
+
+  // handles control over to LCF
+  // [LCF handles command line arguments and invokes the right function]
+  if (lcf_start(argc, argv))
+    return 1;
+
+  // LCF clean up tasks
+  // [must be the last statement before return]
+  lcf_cleanup();
+
+  return 0;
+}
+
+
+int (mouse_test_packet)(uint32_t cnt) {
+    /* To be completed */
+    printf("%s(%u): under construction\n", __func__, cnt);
+    return 1;
+}
+
+int (mouse_test_remote)(uint16_t period, uint8_t cnt) {
+    /* To be completed */
+    printf("%s(%u, %u): under construction\n", __func__, period, cnt);
+    return 1;
+}
+
+int (mouse_test_async)(uint8_t idle_time) {
+    /* To be completed */
+    printf("%s(%u): under construction\n", __func__, idle_time);
+    return 1;
+}
+
+int (mouse_test_gesture)() {
+    /* To be completed */
+    printf("%s: under construction\n", __func__);
+    return 1;
+}

Property changes on: lab4/lab4/lab4.c
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/locale.h
===================================================================
--- lab4/.minix-src/include/locale.h	(nonexistent)
+++ lab4/.minix-src/include/locale.h	(revision 13)
@@ -0,0 +1,127 @@
+/*	$NetBSD: locale.h,v 1.24 2013/05/17 14:11:55 joerg Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)locale.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _LOCALE_H_
+#define _LOCALE_H_
+
+#include <sys/featuretest.h>
+
+struct lconv {
+	char	*decimal_point;
+	char	*thousands_sep;
+	char	*grouping;
+	char	*int_curr_symbol;
+	char	*currency_symbol;
+	char	*mon_decimal_point;
+	char	*mon_thousands_sep;
+	char	*mon_grouping;
+	char	*positive_sign;
+	char	*negative_sign;
+	char	int_frac_digits;
+	char	frac_digits;
+	char	p_cs_precedes;
+	char	p_sep_by_space;
+	char	n_cs_precedes;
+	char	n_sep_by_space;
+	char	p_sign_posn;
+	char	n_sign_posn;
+	char	int_p_cs_precedes;
+	char	int_n_cs_precedes;
+	char	int_p_sep_by_space;
+	char	int_n_sep_by_space;
+	char	int_p_sign_posn;
+	char	int_n_sign_posn;
+};
+
+#include <sys/null.h>
+
+#define	LC_ALL		0
+#define	LC_COLLATE	1
+#define	LC_CTYPE	2
+#define	LC_MONETARY	3
+#define	LC_NUMERIC	4
+#define	LC_TIME		5
+#define LC_MESSAGES	6
+
+#define	_LC_LAST	7		/* marks end */
+
+#include <sys/cdefs.h>
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) || \
+    defined(__SETLOCALE_SOURCE__)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+#endif
+
+__BEGIN_DECLS
+struct lconv *localeconv(void);
+char *setlocale(int, const char *) __RENAME(__setlocale50);
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+#define	LC_ALL_MASK		((int)~0)
+#define	LC_COLLATE_MASK		((int)(1 << LC_COLLATE))
+#define	LC_CTYPE_MASK		((int)(1 << LC_CTYPE))
+#define	LC_MONETARY_MASK	((int)(1 << LC_MONETARY))
+#define	LC_NUMERIC_MASK		((int)(1 << LC_NUMERIC))
+#define	LC_TIME_MASK		((int)(1 << LC_TIME))
+#define	LC_MESSAGES_MASK	((int)(1 << LC_MESSAGES))
+locale_t	duplocale(locale_t);
+void		freelocale(locale_t);
+struct lconv	*localeconv_l(locale_t);
+locale_t	newlocale(int, const char *, locale_t);
+
+#ifndef _LIBC
+extern struct _locale	_lc_global_locale;
+#else
+extern __dso_protected struct _locale	_lc_global_locale;
+#endif
+#define LC_GLOBAL_LOCALE	(&_lc_global_locale)
+#endif /* _POSIX_SOURCE >= 200809 || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE)
+#  ifndef _LIBC
+extern const struct _locale _lc_C_locale;
+#  else
+extern __dso_protected const struct _locale _lc_C_locale;
+#  endif
+#define LC_C_LOCALE		((locale_t)__UNCONST(&_lc_C_locale))
+#endif
+__END_DECLS
+
+#endif /* _LOCALE_H_ */

Property changes on: lab4/.minix-src/include/locale.h
___________________________________________________________________
Added: svn:executable
Index: lab4/lab4/.vscode/settings.json
===================================================================
--- lab4/lab4/.vscode/settings.json	(nonexistent)
+++ lab4/lab4/.vscode/settings.json	(revision 13)
@@ -0,0 +1,10 @@
+{
+  "git.ignoreLimitWarning": true,
+  "C_Cpp.clang_format_fallbackStyle": "LLVM",
+  "diffEditor.ignoreTrimWhitespace": true,
+  "editor.formatOnSave": false,
+  "editor.tabSize": 2,
+  "editor.wordWrap": "bounded",
+  "editor.wordWrapColumn": 100,
+  "files.associations": { },
+}
\ No newline at end of file

Property changes on: lab4/lab4/.vscode/settings.json
___________________________________________________________________
Added: svn:executable
Index: lab4/lab5/.clang-format
===================================================================
--- lab4/lab5/.clang-format	(nonexistent)
+++ lab4/lab5/.clang-format	(revision 13)
@@ -0,0 +1,73 @@
+BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: true
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: false
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      false
+  AfterControlStatement: false
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: true
+  AfterStruct:     false
+  AfterUnion:      false
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+IndentPPDirectives: AfterHash
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+Language: Cpp
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+SpaceAfterCStyleCast: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: true
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 2
+UseTab: Never

Property changes on: lab4/lab5/.clang-format
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/luaconf.h
===================================================================
--- lab4/.minix-src/include/luaconf.h	(nonexistent)
+++ lab4/.minix-src/include/luaconf.h	(revision 13)
@@ -0,0 +1,818 @@
+/*	$NetBSD: luaconf.h,v 1.14 2015/10/08 13:21:00 mbalmer Exp $	*/
+
+/*
+** Id: luaconf.h,v 1.251 2015/05/20 17:39:23 roberto Exp 
+** Configuration file for Lua
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef luaconf_h
+#define luaconf_h
+
+#ifndef _KERNEL
+#include <limits.h>
+#include <stddef.h>
+#else
+#include <machine/limits.h>
+#include <sys/systm.h>
+#endif
+
+
+/*
+** ===================================================================
+** Search for "@@" to find all configurable definitions.
+** ===================================================================
+*/
+
+
+/*
+** {====================================================================
+** System Configuration: macros to adapt (if needed) Lua to some
+** particular platform, for instance compiling it with 32-bit numbers or
+** restricting it to C89.
+** =====================================================================
+*/
+
+/*
+@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You
+** can also define LUA_32BITS in the make file, but changing here you
+** ensure that all software connected to Lua will be compiled with the
+** same configuration.
+*/
+/* #define LUA_32BITS */
+
+
+/*
+@@ LUA_USE_C89 controls the use of non-ISO-C89 features.
+** Define it if you want Lua to avoid the use of a few C99 features
+** or Windows-specific features on Windows.
+*/
+/* #define LUA_USE_C89 */
+
+
+/*
+** By default, Lua on Windows use (some) specific Windows features
+*/
+#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE)
+#define LUA_USE_WINDOWS  /* enable goodies for regular Windows */
+#endif
+
+
+#if defined(LUA_USE_WINDOWS)
+#define LUA_DL_DLL	/* enable support for DLL */
+#define LUA_USE_C89	/* broadly, Windows is C89 */
+#endif
+
+
+#if defined(LUA_USE_LINUX)
+#define LUA_USE_POSIX
+#define LUA_USE_DLOPEN		/* needs an extra library: -ldl */
+#define LUA_USE_READLINE	/* needs some extra libraries */
+#endif
+
+
+#if defined(LUA_USE_MACOSX)
+#define LUA_USE_POSIX
+#define LUA_USE_DLOPEN		/* MacOS does not need -ldl */
+#define LUA_USE_READLINE	/* needs an extra library: -lreadline */
+#endif
+
+
+/*
+@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
+** C89 ('long' and 'double'); Windows always has '__int64', so it does
+** not need to use this case.
+*/
+#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS)
+#define LUA_C89_NUMBERS
+#endif
+
+
+
+/*
+@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'.
+*/
+/* avoid undefined shifts */
+#if ((INT_MAX >> 15) >> 15) >= 1
+#define LUAI_BITSINT	32
+#else
+/* 'int' always must have at least 16 bits */
+#define LUAI_BITSINT	16
+#endif
+
+
+/*
+@@ LUA_INT_TYPE defines the type for Lua integers.
+@@ LUA_FLOAT_TYPE defines the type for Lua floats.
+** Lua should work fine with any mix of these options (if supported
+** by your C compiler). The usual configurations are 64-bit integers
+** and 'double' (the default), 32-bit integers and 'float' (for
+** restricted platforms), and 'long'/'double' (for C compilers not
+** compliant with C99, which may not have support for 'long long').
+*/
+
+/* predefined options for LUA_INT_TYPE */
+#define LUA_INT_INT		1
+#define LUA_INT_LONG		2
+#define LUA_INT_LONGLONG	3
+
+/* predefined options for LUA_FLOAT_TYPE */
+#define LUA_FLOAT_FLOAT		1
+#define LUA_FLOAT_DOUBLE	2
+#define LUA_FLOAT_LONGDOUBLE	3
+
+#if defined(LUA_32BITS)		/* { */
+/*
+** 32-bit integers and 'float'
+*/
+#if LUAI_BITSINT >= 32  /* use 'int' if big enough */
+#define LUA_INT_TYPE	LUA_INT_INT
+#else  /* otherwise use 'long' */
+#define LUA_INT_TYPE	LUA_INT_LONG
+#endif
+#define LUA_FLOAT_TYPE	LUA_FLOAT_FLOAT
+
+#elif defined(LUA_C89_NUMBERS)	/* }{ */
+/*
+** largest types available for C89 ('long' and 'double')
+*/
+#define LUA_INT_TYPE	LUA_INT_LONG
+#define LUA_FLOAT_TYPE	LUA_FLOAT_DOUBLE
+
+#endif				/* } */
+
+
+/*
+** default configuration for 64-bit Lua ('long long' and 'double')
+*/
+#if !defined(LUA_INT_TYPE)
+#define LUA_INT_TYPE	LUA_INT_LONGLONG
+#endif
+
+#if !defined(LUA_FLOAT_TYPE)
+#define LUA_FLOAT_TYPE	LUA_FLOAT_DOUBLE
+#endif								/* } */
+
+/* }================================================================== */
+
+
+
+
+/*
+** {==================================================================
+** Configuration for Paths.
+** ===================================================================
+*/
+
+/*
+@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
+** Lua libraries.
+@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
+** C libraries.
+** CHANGE them if your machine has a non-conventional directory
+** hierarchy or if you want to install your libraries in
+** non-conventional directories.
+*/
+#define LUA_VDIR	LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
+#if defined(_WIN32)	/* { */
+/*
+** In Windows, any exclamation mark ('!') in the path is replaced by the
+** path of the directory of the executable file of the current process.
+*/
+#define LUA_LDIR	"!\\lua\\"
+#define LUA_CDIR	"!\\"
+#define LUA_SHRDIR	"!\\..\\share\\lua\\" LUA_VDIR "\\"
+#define LUA_PATH_DEFAULT  \
+		LUA_LDIR"?.lua;"  LUA_LDIR"?\\init.lua;" \
+		LUA_CDIR"?.lua;"  LUA_CDIR"?\\init.lua;" \
+		LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
+		".\\?.lua;" ".\\?\\init.lua"
+#define LUA_CPATH_DEFAULT \
+		LUA_CDIR"?.dll;" \
+		LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
+		LUA_CDIR"loadall.dll;" ".\\?.dll"
+
+#else			/* }{ */
+
+#define LUA_ROOT	"/usr/local/"
+#define LUA_LDIR	LUA_ROOT "share/lua/" LUA_VDIR "/"
+#define LUA_CDIR	LUA_ROOT "lib/lua/" LUA_VDIR "/"
+#define LUA_PATH_DEFAULT  \
+		LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
+		LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" \
+		"./?.lua;" "./?/init.lua"
+#define LUA_CPATH_DEFAULT \
+		LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
+#endif			/* } */
+
+
+/*
+@@ LUA_DIRSEP is the directory separator (for submodules).
+** CHANGE it if your machine does not use "/" as the directory separator
+** and is not Windows. (On Windows Lua automatically uses "\".)
+*/
+#if defined(_WIN32)
+#define LUA_DIRSEP	"\\"
+#else
+#define LUA_DIRSEP	"/"
+#endif
+
+/* }================================================================== */
+
+
+/*
+** {==================================================================
+** Marks for exported symbols in the C code
+** ===================================================================
+*/
+
+/*
+@@ LUA_API is a mark for all core API functions.
+@@ LUALIB_API is a mark for all auxiliary library functions.
+@@ LUAMOD_API is a mark for all standard library opening functions.
+** CHANGE them if you need to define those functions in some special way.
+** For instance, if you want to create one Windows DLL with the core and
+** the libraries, you may want to use the following definition (define
+** LUA_BUILD_AS_DLL to get it).
+*/
+#if defined(LUA_BUILD_AS_DLL)	/* { */
+
+#if defined(LUA_CORE) || defined(LUA_LIB)	/* { */
+#define LUA_API __declspec(dllexport)
+#else						/* }{ */
+#define LUA_API __declspec(dllimport)
+#endif						/* } */
+
+#else				/* }{ */
+
+#define LUA_API		extern
+
+#endif				/* } */
+
+
+/* more often than not the libs go together with the core */
+#define LUALIB_API	LUA_API
+#define LUAMOD_API	LUALIB_API
+
+
+/*
+@@ LUAI_FUNC is a mark for all extern functions that are not to be
+** exported to outside modules.
+@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables
+** that are not to be exported to outside modules (LUAI_DDEF for
+** definitions and LUAI_DDEC for declarations).
+** CHANGE them if you need to mark them in some special way. Elf/gcc
+** (versions 3.2 and later) mark them as "hidden" to optimize access
+** when Lua is compiled as a shared library. Not all elf targets support
+** this attribute. Unfortunately, gcc does not offer a way to check
+** whether the target offers that support, and those without support
+** give a warning about it. To avoid these warnings, change to the
+** default definition.
+*/
+#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
+    defined(__ELF__)		/* { */
+#define LUAI_FUNC	__attribute__((visibility("hidden"))) extern
+#else				/* }{ */
+#define LUAI_FUNC	extern
+#endif				/* } */
+
+#define LUAI_DDEC	LUAI_FUNC
+#define LUAI_DDEF	/* empty */
+
+/* }================================================================== */
+
+
+/*
+** {==================================================================
+** Compatibility with previous versions
+** ===================================================================
+*/
+
+/*
+@@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2.
+@@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1.
+** You can define it to get all options, or change specific options
+** to fit your specific needs.
+*/
+#if defined(LUA_COMPAT_5_2)	/* { */
+
+/*
+@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated
+** functions in the mathematical library.
+*/
+#define LUA_COMPAT_MATHLIB
+
+/*
+@@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'.
+*/
+#define LUA_COMPAT_BITLIB
+
+/*
+@@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod.
+*/
+#define LUA_COMPAT_IPAIRS
+
+/*
+@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for
+** manipulating other integer types (lua_pushunsigned, lua_tounsigned,
+** luaL_checkint, luaL_checklong, etc.)
+*/
+#define LUA_COMPAT_APIINTCASTS
+
+#endif				/* } */
+
+
+#if defined(LUA_COMPAT_5_1)	/* { */
+
+/* Incompatibilities from 5.2 -> 5.3 */
+#define LUA_COMPAT_MATHLIB
+#define LUA_COMPAT_APIINTCASTS
+
+/*
+@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.
+** You can replace it with 'table.unpack'.
+*/
+#define LUA_COMPAT_UNPACK
+
+/*
+@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'.
+** You can replace it with 'package.searchers'.
+*/
+#define LUA_COMPAT_LOADERS
+
+/*
+@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall.
+** You can call your C function directly (with light C functions).
+*/
+#define lua_cpcall(L,f,u)  \
+	(lua_pushcfunction(L, (f)), \
+	 lua_pushlightuserdata(L,(u)), \
+	 lua_pcall(L,1,0,0))
+
+
+/*
+@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
+** You can rewrite 'log10(x)' as 'log(x, 10)'.
+*/
+#define LUA_COMPAT_LOG10
+
+/*
+@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base
+** library. You can rewrite 'loadstring(s)' as 'load(s)'.
+*/
+#define LUA_COMPAT_LOADSTRING
+
+/*
+@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.
+*/
+#define LUA_COMPAT_MAXN
+
+/*
+@@ The following macros supply trivial compatibility for some
+** changes in the API. The macros themselves document how to
+** change your code to avoid using them.
+*/
+#define lua_strlen(L,i)		lua_rawlen(L, (i))
+
+#define lua_objlen(L,i)		lua_rawlen(L, (i))
+
+#define lua_equal(L,idx1,idx2)		lua_compare(L,(idx1),(idx2),LUA_OPEQ)
+#define lua_lessthan(L,idx1,idx2)	lua_compare(L,(idx1),(idx2),LUA_OPLT)
+
+/*
+@@ LUA_COMPAT_MODULE controls compatibility with previous
+** module functions 'module' (Lua) and 'luaL_register' (C).
+*/
+#define LUA_COMPAT_MODULE
+
+#endif				/* } */
+
+
+/*
+@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a
+@@ a float mark ('.0').
+** This macro is not on by default even in compatibility mode,
+** because this is not really an incompatibility.
+*/
+/* #define LUA_COMPAT_FLOATSTRING */
+
+/* }================================================================== */
+
+
+
+/*
+** {==================================================================
+** Configuration for Numbers.
+** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_*
+** satisfy your needs.
+** ===================================================================
+*/
+
+#ifndef _KERNEL
+/*
+@@ LUA_NUMBER is the floating-point type used by Lua.
+@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
+@@ over a floating number.
+@@ l_mathlim(x) corrects limit name 'x' to the proper float type
+** by prefixing it with one of FLT/DBL/LDBL.
+@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats.
+@@ LUA_NUMBER_FMT is the format for writing floats.
+@@ lua_number2str converts a float to a string.
+@@ l_mathop allows the addition of an 'l' or 'f' to all math operations.
+@@ lua_str2number converts a decimal numeric string to a number.
+*/
+
+#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT		/* { single float */
+
+#define LUA_NUMBER	float
+
+#define l_mathlim(n)		(FLT_##n)
+
+#define LUAI_UACNUMBER	double
+
+#define LUA_NUMBER_FRMLEN	""
+#define LUA_NUMBER_FMT		"%.7g"
+
+#define l_mathop(op)		op##f
+
+#define lua_str2number(s,p)	strtof((s), (p))
+
+
+#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE	/* }{ long double */
+
+#define LUA_NUMBER	long double
+
+#define l_mathlim(n)		(LDBL_##n)
+
+#define LUAI_UACNUMBER	long double
+
+#define LUA_NUMBER_FRMLEN	"L"
+#define LUA_NUMBER_FMT		"%.19Lg"
+
+#define l_mathop(op)		op##l
+
+#define lua_str2number(s,p)	strtold((s), (p))
+
+#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE	/* }{ double */
+
+#define LUA_NUMBER	double
+
+#define l_mathlim(n)		(DBL_##n)
+
+#define LUAI_UACNUMBER	double
+
+#define LUA_NUMBER_FRMLEN	""
+#define LUA_NUMBER_FMT		"%.14g"
+
+#define l_mathop(op)		op
+
+#define lua_str2number(s,p)	strtod((s), (p))
+
+#else						/* }{ */
+
+#error "numeric float type not defined"
+
+#endif					/* } */
+
+
+#define l_floor(x)		(l_mathop(floor)(x))
+
+#define lua_number2str(s,n)	sprintf((s), LUA_NUMBER_FMT, (n))
+
+
+/*
+@@ lua_numbertointeger converts a float number to an integer, or
+** returns 0 if float is not within the range of a lua_Integer.
+** (The range comparisons are tricky because of rounding. The tests
+** here assume a two-complement representation, where MININTEGER always
+** has an exact representation as a float; MAXINTEGER may not have one,
+** and therefore its conversion to float may have an ill-defined value.)
+*/
+#define lua_numbertointeger(n,p) \
+  ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
+   (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
+      (*(p) = (LUA_INTEGER)(n), 1))
+
+#endif /*_KERNEL */
+
+
+/*
+@@ LUA_INTEGER is the integer type used by Lua.
+**
+@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER.
+**
+@@ LUAI_UACINT is the result of an 'usual argument conversion'
+@@ over a lUA_INTEGER.
+@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers.
+@@ LUA_INTEGER_FMT is the format for writing integers.
+@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER.
+@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER.
+@@ lua_integer2str converts an integer to a string.
+*/
+
+
+/* The following definitions are good for most cases here */
+
+#define LUA_INTEGER_FMT		"%" LUA_INTEGER_FRMLEN "d"
+#define lua_integer2str(s,n)	sprintf((s), LUA_INTEGER_FMT, (n))
+
+#define LUAI_UACINT		LUA_INTEGER
+
+/*
+** use LUAI_UACINT here to avoid problems with promotions (which
+** can turn a comparison between unsigneds into a signed comparison)
+*/
+#define LUA_UNSIGNED		unsigned LUAI_UACINT
+
+
+/* now the variable definitions */
+
+#if LUA_INT_TYPE == LUA_INT_INT		/* { int */
+
+#define LUA_INTEGER		int
+#define LUA_INTEGER_FRMLEN	""
+
+#define LUA_MAXINTEGER		INT_MAX
+#define LUA_MININTEGER		INT_MIN
+
+#elif LUA_INT_TYPE == LUA_INT_LONG	/* }{ long */
+
+#define LUA_INTEGER		long
+#define LUA_INTEGER_FRMLEN	"l"
+
+#define LUA_MAXINTEGER		LONG_MAX
+#define LUA_MININTEGER		LONG_MIN
+
+#elif LUA_INT_TYPE == LUA_INT_LONGLONG	/* }{ long long */
+
+#if defined(LLONG_MAX)		/* { */
+/* use ISO C99 stuff */
+
+#define LUA_INTEGER		long long
+#define LUA_INTEGER_FRMLEN	"ll"
+
+#define LUA_MAXINTEGER		LLONG_MAX
+#define LUA_MININTEGER		LLONG_MIN
+
+#elif defined(LUA_USE_WINDOWS) /* }{ */
+/* in Windows, can use specific Windows types */
+
+#define LUA_INTEGER		__int64
+#define LUA_INTEGER_FRMLEN	"I64"
+
+#define LUA_MAXINTEGER		_I64_MAX
+#define LUA_MININTEGER		_I64_MIN
+
+#else				/* }{ */
+
+#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
+  or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
+
+#endif				/* } */
+
+#else				/* }{ */
+
+#error "numeric integer type not defined"
+
+#endif				/* } */
+
+/* }================================================================== */
+
+
+/*
+** {==================================================================
+** Dependencies with C99 and other C details
+** ===================================================================
+*/
+
+/*
+@@ lua_strx2number converts an hexadecimal numeric string to a number.
+** In C99, 'strtod' does that conversion. Otherwise, you can
+** leave 'lua_strx2number' undefined and Lua will provide its own
+** implementation.
+*/
+#if !defined(LUA_USE_C89)
+#define lua_strx2number(s,p)	lua_str2number(s,p)
+#endif
+
+
+/*
+@@ lua_number2strx converts a float to an hexadecimal numeric string. 
+** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that.
+** Otherwise, you can leave 'lua_number2strx' undefined and Lua will
+** provide its own implementation.
+*/
+#if !defined(LUA_USE_C89)
+#define lua_number2strx(L,b,f,n)	sprintf(b,f,n)
+#endif
+
+
+/*
+** 'strtof' and 'opf' variants for math functions are not valid in
+** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the
+** availability of these variants. ('math.h' is already included in
+** all files that use these macros.)
+*/
+#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF))
+#undef l_mathop  /* variants not available */
+#undef lua_str2number
+#define l_mathop(op)		(lua_Number)op  /* no variant */
+#define lua_str2number(s,p)	((lua_Number)strtod((s), (p)))
+#endif
+
+
+/*
+@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation
+** functions.  It must be a numerical type; Lua will use 'intptr_t' if
+** available, otherwise it will use 'ptrdiff_t' (the nearest thing to
+** 'intptr_t' in C89)
+*/
+#define LUA_KCONTEXT	ptrdiff_t
+
+#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \
+    __STDC_VERSION__ >= 199901L
+#include <stdint.h>
+#if defined(INTPTR_MAX)  /* even in C99 this type is optional */
+#undef LUA_KCONTEXT
+#define LUA_KCONTEXT	intptr_t
+#endif
+#endif
+
+
+/*
+@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point).
+** Change that if you do not want to use C locales. (Code using this
+** macro must include header 'locale.h'.)
+*/
+#if !defined(lua_getlocaledecpoint)
+#define lua_getlocaledecpoint()		(localeconv()->decimal_point[0])
+#endif
+
+/* }================================================================== */
+
+
+/*
+** {==================================================================
+** Language Variations
+** =====================================================================
+*/
+
+/*
+@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some
+** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from
+** numbers to strings. Define LUA_NOCVTS2N to turn off automatic
+** coercion from strings to numbers.
+*/
+/* #define LUA_NOCVTN2S */
+/* #define LUA_NOCVTS2N */
+
+
+/*
+@@ LUA_USE_APICHECK turns on several consistency checks on the C API.
+** Define it as a help when debugging C code.
+*/
+#if defined(LUA_USE_APICHECK)
+#include <assert.h>
+#define luai_apicheck(l,e)	assert(e)
+#endif
+
+/* }================================================================== */
+
+
+/*
+** {==================================================================
+** Macros that affect the API and must be stable (that is, must be the
+** same when you compile Lua and when you compile code that links to
+** Lua). You probably do not want/need to change them.
+** =====================================================================
+*/
+
+/*
+@@ LUAI_MAXSTACK limits the size of the Lua stack.
+** CHANGE it if you need a different limit. This limit is arbitrary;
+** its only purpose is to stop Lua from consuming unlimited stack
+** space (and to reserve some numbers for pseudo-indices).
+*/
+#if LUAI_BITSINT >= 32
+#define LUAI_MAXSTACK		1000000
+#else
+#define LUAI_MAXSTACK		15000
+#endif
+
+
+/*
+@@ LUA_EXTRASPACE defines the size of a raw memory area associated with
+** a Lua state with very fast access.
+** CHANGE it if you need a different size.
+*/
+#define LUA_EXTRASPACE		(sizeof(void *))
+
+
+/*
+@@ LUA_IDSIZE gives the maximum size for the description of the source
+@@ of a function in debug information.
+** CHANGE it if you want a different size.
+*/
+#define LUA_IDSIZE	60
+
+
+/*
+@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
+** CHANGE it if it uses too much C-stack space. (For long double,
+** 'string.format("%.99f", 1e4932)' needs ~5030 bytes, so a
+** smaller buffer would force a memory allocation for each call to
+** 'string.format'.)
+*/
+#if defined(LUA_FLOAT_LONGDOUBLE)
+#define LUAL_BUFFERSIZE		8192
+#else
+#define LUAL_BUFFERSIZE   ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer)))
+#endif
+
+/* }================================================================== */
+
+
+/*
+@@ LUA_QL describes how error messages quote program elements.
+** Lua does not use these macros anymore; they are here for
+** compatibility only.
+*/
+#define LUA_QL(x)	"'" x "'"
+#define LUA_QS		LUA_QL("%s")
+
+
+
+
+/* =================================================================== */
+
+/*
+** Local configuration. You can use this space to add your redefinitions
+** without modifying the main part of the file.
+*/
+
+#if defined(__NetBSD__) || defined(__minix)
+
+/* Integer types */
+#undef LUA_INTEGER
+#undef LUA_INTEGER_FRMLEN
+#undef LUA_UNSIGNED
+#undef LUA_MAXUNSIGNED
+#undef LUA_MAXINTEGER
+#undef LUA_MININTEGER
+
+#define LUA_INTEGER		intmax_t
+#define LUA_INTEGER_FRMLEN	"j"
+#define LUA_UNSIGNED		uintmax_t
+#define LUA_MAXUNSIGNED		UINTMAX_MAX
+#define LUA_MAXINTEGER		INTMAX_MAX
+#define LUA_MININTEGER		INTMAX_MIN
+
+/* Path */
+#undef LUA_ROOT
+#undef LUA_PATH_DEFAULT
+#undef LUA_CPATH_DEFAULT
+
+#define LUA_ROOT	"/usr/"
+#define LUA_PATH_DEFAULT  \
+		LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
+		LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua"
+#define LUA_CPATH_DEFAULT \
+		LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
+
+#ifndef _KERNEL
+
+#include <stdint.h>
+
+#else /* _KERNEL */
+
+#define LUA_NUMBER		LUA_INTEGER
+#define LUA_NUMBER_FMT		LUA_INTEGER_FMT
+
+/* setjmp.h */
+#define LUAI_THROW(L,c)		longjmp(&((c)->b))
+#define LUAI_TRY(L,c,a)		if (setjmp(&((c)->b)) == 0) { a }
+#define luai_jmpbuf		label_t
+
+/* time.h */
+#include <sys/time.h>
+#define time(p)			(time_uptime)
+
+/* stdio.h */
+#define lua_writestring(s,l)	printf("%s", (s))
+#define lua_writeline()		printf("\n")
+
+#define sprintf(s,fmt,...)	snprintf(s, sizeof(s), fmt, __VA_ARGS__)
+
+/* string.h */
+#define strcoll strcmp
+
+/* stdlib.h */
+#define abort()			panic("Lua has aborted!")
+
+#endif /* _KERNEL */
+
+#endif /* __NetBSD__ || __minix */
+
+#endif
+

Property changes on: lab4/.minix-src/include/luaconf.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/machine
===================================================================
--- lab4/.minix-src/include/machine	(nonexistent)
+++ lab4/.minix-src/include/machine	(revision 13)
@@ -0,0 +1 @@
+i386
\ No newline at end of file

Property changes on: lab4/.minix-src/include/machine
___________________________________________________________________
Added: svn:executable
Index: lab4/lab5/.vscode/extensions.json
===================================================================
--- lab4/lab5/.vscode/extensions.json	(nonexistent)
+++ lab4/lab5/.vscode/extensions.json	(revision 13)
@@ -0,0 +1,12 @@
+{
+	// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+	// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+	// List of extensions which should be recommended for users of this workspace.
+	"recommendations": [
+		"austin.code-gnu-global",
+		"ms-vscode.cpptools",
+		"xaver.clang-format"
+	],
+	// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
+	"unwantedRecommendations": []
+}
\ No newline at end of file

Property changes on: lab4/lab5/.vscode/extensions.json
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/md2.h
===================================================================
--- lab4/.minix-src/include/md2.h	(nonexistent)
+++ lab4/.minix-src/include/md2.h	(revision 13)
@@ -0,0 +1,29 @@
+/*	$NetBSD: md2.h,v 1.6 2005/12/26 19:01:47 perry Exp $	*/
+
+#ifndef _MD2_H_
+#define _MD2_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#define	MD2_DIGEST_LENGTH		16
+#define	MD2_DIGEST_STRING_LENGTH	33
+
+/* MD2 context. */
+typedef struct MD2Context {
+	uint32_t i;
+	unsigned char C[16];		/* checksum */
+	unsigned char X[48];		/* input buffer */
+} MD2_CTX;
+
+__BEGIN_DECLS
+void	MD2Init(MD2_CTX *);
+void	MD2Update(MD2_CTX *, const unsigned char *, unsigned int);
+void	MD2Final(unsigned char[16], MD2_CTX *);
+char	*MD2End(MD2_CTX *, char *);
+char	*MD2File(const char *, char *);
+char	*MD2FileChunk(const char *, char *, off_t, off_t);
+char	*MD2Data(const unsigned char *, size_t, char *);
+__END_DECLS
+
+#endif /* _MD2_H_ */

Property changes on: lab4/.minix-src/include/md2.h
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/.clang-format
===================================================================
--- lab4/martalab3/lab3/.clang-format	(nonexistent)
+++ lab4/martalab3/lab3/.clang-format	(revision 13)
@@ -0,0 +1,73 @@
+BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: true
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: false
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      false
+  AfterControlStatement: false
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: true
+  AfterStruct:     false
+  AfterUnion:      false
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+IndentPPDirectives: AfterHash
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+Language: Cpp
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+SpaceAfterCStyleCast: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: true
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 2
+UseTab: Never

Property changes on: lab4/martalab3/lab3/.clang-format
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/.vscode/extensions.json
===================================================================
--- lab4/martalab3/lab3/.vscode/extensions.json	(nonexistent)
+++ lab4/martalab3/lab3/.vscode/extensions.json	(revision 13)
@@ -0,0 +1,12 @@
+{
+	// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+	// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+	// List of extensions which should be recommended for users of this workspace.
+	"recommendations": [
+		"austin.code-gnu-global",
+		"ms-vscode.cpptools",
+		"xaver.clang-format"
+	],
+	// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
+	"unwantedRecommendations": []
+}
\ No newline at end of file

Property changes on: lab4/martalab3/lab3/.vscode/extensions.json
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/i8254.h
===================================================================
--- lab4/martalab3/lab3/i8254.h	(nonexistent)
+++ lab4/martalab3/lab3/i8254.h	(revision 13)
@@ -0,0 +1,66 @@
+#ifndef _LCOM_I8254_H_
+#define _LCOM_I8254_H_
+
+#include <lcom/lcf.h>
+
+/** @defgroup i8254 i8254
+ * @{
+ *
+ * Constants for programming the i8254 Timer. Needs to be completed.
+ */
+
+
+
+/*IRQ's*/
+
+#define IRQ_TIMER 0
+#define DEFAULT_FREQ 60
+
+
+#define TIMER_FREQ 1193182 /**< @brief clock frequency for timer in PC and AT */
+#define MIN_FREQ 19
+#define TIMER0_IRQ 0 /**< @brief Timer 0 IRQ line */
+
+/* I/O port addresses */
+
+#define TIMER_0    0x40 /**< @brief Timer 0 count register */
+#define TIMER_1    0x41 /**< @brief Timer 1 count register */
+#define TIMER_2    0x42 /**< @brief Timer 2 count register */
+#define TIMER_CTRL 0x43 /**< @brief Control register */
+
+#define SPEAKER_CTRL 0x61 /**< @brief Register for speaker control  */
+
+/* Timer control */
+
+/* Timer selection: bits 7 and 6 */
+
+#define TIMER_SEL0   0x00              /**< @brief Control Word for Timer 0 */
+#define TIMER_SEL1   BIT(6)            /**< @brief Control Word for Timer 1 */
+#define TIMER_SEL2   BIT(7)            /**< @brief Control Word for Timer 2 */
+#define TIMER_RB_CMD (BIT(7) | BIT(6)) /**< @brief Read Back Command */
+
+/* Register selection: bits 5 and 4 */
+
+#define TIMER_LSB     BIT(4)                  /**< @brief Initialize Counter LSB only */
+#define TIMER_MSB     BIT(5)                  /**< @brief Initialize Counter MSB only */
+#define TIMER_LSB_MSB (TIMER_LSB | TIMER_MSB) /**< @brief Initialize LSB first and MSB afterwards */
+
+/* Operating mode: bits 3, 2 and 1 */
+
+#define TIMER_SQR_WAVE (BIT(2) | BIT(1)) /**< @brief Mode 3: square wave generator */
+#define TIMER_RATE_GEN BIT(2)            /**< @brief Mode 2: rate generator */
+
+/* Counting mode: bit 0 */
+
+#define TIMER_BCD 0x01 /**< @brief Count in BCD */
+#define TIMER_BIN 0x00 /**< @brief Count in binary */
+
+/* READ-BACK COMMAND FORMAT */
+
+#define TIMER_RB_COUNT_  BIT(5)
+#define TIMER_RB_STATUS_ BIT(4)
+#define TIMER_RB_SEL(n)  BIT((n) + 1)
+
+/**@}*/
+
+#endif /* _LCOM_I8254_H */

Property changes on: lab4/martalab3/lab3/i8254.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/menu.h
===================================================================
--- lab4/.minix-src/include/menu.h	(nonexistent)
+++ lab4/.minix-src/include/menu.h	(revision 13)
@@ -0,0 +1,210 @@
+/*	$NetBSD: menu.h,v 1.13 2004/03/22 19:01:09 jdc Exp $	*/
+
+/*-
+ * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au)
+ * 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * 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.
+ *
+ *
+ */
+
+#ifndef	_MENU_H_
+#define	_MENU_H_
+
+#include <curses.h>
+#include <eti.h>
+
+/* requests for the menu_driver call */
+#define REQ_BASE_NUM      (KEY_MAX + 0x200)
+#define REQ_LEFT_ITEM     (KEY_MAX + 0x201)
+#define REQ_RIGHT_ITEM    (KEY_MAX + 0x202)
+#define REQ_UP_ITEM       (KEY_MAX + 0x203)
+#define REQ_DOWN_ITEM     (KEY_MAX + 0x204)
+#define REQ_SCR_ULINE     (KEY_MAX + 0x205)
+#define REQ_SCR_DLINE     (KEY_MAX + 0x206)
+#define REQ_SCR_DPAGE     (KEY_MAX + 0x207)
+#define REQ_SCR_UPAGE     (KEY_MAX + 0x208)
+#define REQ_FIRST_ITEM    (KEY_MAX + 0x209)
+#define REQ_LAST_ITEM     (KEY_MAX + 0x20a)
+#define REQ_NEXT_ITEM     (KEY_MAX + 0x20b)
+#define REQ_PREV_ITEM     (KEY_MAX + 0x20c)
+#define REQ_TOGGLE_ITEM   (KEY_MAX + 0x20d)
+#define REQ_CLEAR_PATTERN (KEY_MAX + 0x20e)
+#define REQ_BACK_PATTERN  (KEY_MAX + 0x20f)
+#define REQ_NEXT_MATCH    (KEY_MAX + 0x210)
+#define REQ_PREV_MATCH    (KEY_MAX + 0x211)
+
+#define MAX_COMMAND       (KEY_MAX + 0x211) /* last menu driver request
+					       - for application defined
+					       commands */
+
+/* Menu options */
+typedef unsigned int OPTIONS;
+
+/* and the values they can have */
+#define O_ONEVALUE   (0x1)
+#define O_SHOWDESC   (0x2)
+#define O_ROWMAJOR   (0x4)
+#define O_IGNORECASE (0x8)
+#define O_SHOWMATCH  (0x10)
+#define O_NONCYCLIC  (0x20)
+#define O_SELECTABLE (0x40)
+#define O_RADIO      (0x80)
+
+typedef struct __menu_str {
+        char *string;
+        int length;
+} MENU_STR;
+
+typedef struct __menu MENU;
+typedef struct __item ITEM;
+
+typedef void (*Menu_Hook) (MENU *);
+
+struct __item {
+        MENU_STR name;
+        MENU_STR description;
+        char *userptr;
+        int visible;  /* set if item is visible */
+        int selected; /* set if item has been selected */
+	int row; /* menu row this item is on */
+	int col; /* menu column this item is on */
+        OPTIONS opts;
+        MENU *parent; /* menu this item is bound to */
+	int index; /* index number for this item, if attached */
+	  /* The following are the item's neighbours - makes menu
+	     navigation easier */
+	ITEM *left;
+	ITEM *right;
+	ITEM *up;
+	ITEM *down;
+};
+
+struct __menu {
+        int rows; /* max number of rows to be displayed */
+        int cols; /* max number of columns to be displayed */
+	int item_rows; /* number of item rows we have */
+	int item_cols; /* number of item columns we have */
+        int cur_row; /* current cursor row */
+        int cur_col; /* current cursor column */
+        MENU_STR mark; /* menu mark string */
+        MENU_STR unmark; /* menu unmark string */
+        OPTIONS opts; /* options for the menu */
+        char *pattern; /* the pattern buffer */
+	int plen;  /* pattern buffer length */
+	int match_len; /* length of pattern matched */
+        int posted; /* set if menu is posted */
+        attr_t fore; /* menu foreground */
+        attr_t back; /* menu background */
+        attr_t grey; /* greyed out (nonselectable) menu item */
+        int pad;  /* filler char between name and description */
+        char *userptr;
+	int top_row; /* the row that is at the top of the menu */
+	int max_item_width; /* widest item */
+	int col_width; /* width of the menu columns - this is not always
+			  the same as the widest item */
+        int item_count; /* number of items attached */
+        ITEM **items; /* items associated with this menu */
+        int  cur_item; /* item cursor is currently positioned at */
+        int in_init; /* set when processing an init or term function call */
+        Menu_Hook menu_init; /* call this when menu is posted */
+        Menu_Hook menu_term; /* call this when menu is unposted */
+        Menu_Hook item_init; /* call this when menu posted & after
+				       current item changes */
+        Menu_Hook item_term; /* call this when menu unposted & just
+				       before current item changes */
+        WINDOW *menu_win; /* the menu window */
+        WINDOW *menu_subwin; /* the menu subwindow */
+	WINDOW *scrwin; /* the window to write to */
+};
+
+
+/* Public function prototypes. */
+__BEGIN_DECLS
+int  menu_driver(MENU *, int);
+int scale_menu(MENU *, int *, int *);
+int set_top_row(MENU *, int);
+int pos_menu_cursor(MENU *);
+int top_row(MENU *);
+
+int  free_menu(MENU *);
+char menu_back(MENU *);
+char menu_fore(MENU *);
+void menu_format(MENU *, int *, int *);
+char menu_grey(MENU *);
+Menu_Hook menu_init(MENU *);
+char *menu_mark(MENU *);
+OPTIONS menu_opts(MENU *);
+int menu_opts_off(MENU *, OPTIONS);
+int menu_opts_on(MENU *, OPTIONS);
+int menu_pad(MENU *);
+char *menu_pattern(MENU *);
+WINDOW *menu_sub(MENU *);
+Menu_Hook menu_term(MENU *);
+char *menu_unmark (MENU *);
+char *menu_userptr(MENU *);
+WINDOW *menu_win(MENU *);
+MENU *new_menu(ITEM **);
+int post_menu(MENU *);
+int set_menu_back(MENU *, attr_t);
+int set_menu_fore(MENU *, attr_t);
+int set_menu_format(MENU *, int, int);
+int set_menu_grey(MENU *, attr_t);
+int set_menu_init(MENU *, Menu_Hook);
+int set_menu_items(MENU *, ITEM **);
+int set_menu_mark(MENU *, char *);
+int set_menu_opts(MENU *, OPTIONS);
+int set_menu_pad(MENU *, int);
+int set_menu_pattern(MENU *, char *);
+int set_menu_sub(MENU *, WINDOW *);
+int set_menu_term(MENU *, Menu_Hook);
+int set_menu_unmark(MENU *, char *);
+int set_menu_userptr(MENU *, char *);
+int  set_menu_win(MENU *, WINDOW *);
+int unpost_menu(MENU *);
+
+ITEM *current_item(MENU *);
+int free_item(ITEM *);
+int item_count(MENU *);
+char *item_description(ITEM *);
+int item_index(ITEM *);
+Menu_Hook item_init(MENU *);
+char *item_name(ITEM *);
+OPTIONS item_opts(ITEM *);
+int item_opts_off(ITEM *, OPTIONS);
+int item_opts_on(ITEM *, OPTIONS);
+int item_selected(MENU *, int **); /* return the item index of selected */
+Menu_Hook item_term(MENU *);
+char *item_userptr(ITEM *);
+int item_value(ITEM *);
+int item_visible(ITEM *);
+ITEM **menu_items(MENU *);
+ITEM *new_item(char *, char *);
+int set_current_item(MENU *, ITEM *);
+int set_item_init(MENU *, Menu_Hook);
+int set_item_opts(ITEM *, OPTIONS);
+int set_item_term(MENU *, Menu_Hook);
+int set_item_userptr(ITEM *, char *);
+int set_item_value(ITEM *, int);
+
+__END_DECLS
+
+#endif /* !_MENU_H_ */

Property changes on: lab4/.minix-src/include/menu.h
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/Makefile
===================================================================
--- lab4/martalab3/lab3/Makefile	(nonexistent)
+++ lab4/martalab3/lab3/Makefile	(revision 13)
@@ -0,0 +1,16 @@
+# name of the program (Minix service)
+PROG=lab3
+
+# source code files to be compiled
+SRCS = lab3.c keyboard.c 
+
+# additional compilation flags
+# "-Wall -Wextra -Werror -I . -std=c11 -Wno-unused-parameter" are already set
+CPPFLAGS += -pedantic -DLAB3
+
+# list of library dependencies (for Lab 2, only LCF library)
+DPADD += ${LIBLCF}
+LDADD += -llcf
+
+# include LCOM's makefile that does all the "heavy lifting"
+.include <minix.lcom.mk>

Property changes on: lab4/martalab3/lab3/Makefile
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/mpool.h
===================================================================
--- lab4/.minix-src/include/mpool.h	(nonexistent)
+++ lab4/.minix-src/include/mpool.h	(revision 13)
@@ -0,0 +1,103 @@
+/*	$NetBSD: mpool.h,v 1.14 2013/11/22 16:25:01 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)mpool.h	8.2 (Berkeley) 7/14/94
+ */
+
+#ifndef _MPOOL_H_
+#define _MPOOL_H_
+
+#include <sys/cdefs.h>
+#include <sys/queue.h>
+
+/*
+ * The memory pool scheme is a simple one.  Each in-memory page is referenced
+ * by a bucket which is threaded in up to two of three ways.  All active pages
+ * are threaded on a hash chain (hashed by page number) and an lru chain.
+ * Inactive pages are threaded on a free chain.  Each reference to a memory
+ * pool is handed an opaque MPOOL cookie which stores all of this information.
+ */
+#define	HASHSIZE	128
+#define	HASHKEY(pgno)	((pgno - 1) % HASHSIZE)
+
+/* The BKT structures are the elements of the queues. */
+typedef struct _bkt {
+	TAILQ_ENTRY(_bkt) hq;		/* hash queue */
+	TAILQ_ENTRY(_bkt) q;		/* lru queue */
+	void    *page;			/* page */
+	pgno_t   pgno;			/* page number */
+
+#define	MPOOL_DIRTY	0x01		/* page needs to be written */
+#define	MPOOL_PINNED	0x02		/* page is pinned into memory */
+	uint8_t flags;			/* flags */
+} BKT;
+
+typedef struct MPOOL {
+	TAILQ_HEAD(_lqh, _bkt) lqh;	/* lru queue head */
+					/* hash queue array */
+	TAILQ_HEAD(_hqh, _bkt) hqh[HASHSIZE];
+	pgno_t	curcache;		/* current number of cached pages */
+	pgno_t	maxcache;		/* max number of cached pages */
+	pgno_t	npages;			/* number of pages in the file */
+	unsigned long	pagesize;		/* file page size */
+	int	fd;			/* file descriptor */
+					/* page in conversion routine */
+	void    (*pgin)(void *, pgno_t, void *);
+					/* page out conversion routine */
+	void    (*pgout)(void *, pgno_t, void *);
+	void	*pgcookie;		/* cookie for page in/out routines */
+#ifdef STATISTICS
+	unsigned long	cachehit;
+	unsigned long	cachemiss;
+	unsigned long	pagealloc;
+	unsigned long	pageflush;
+	unsigned long	pageget;
+	unsigned long	pagenew;
+	unsigned long	pageput;
+	unsigned long	pageread;
+	unsigned long	pagewrite;
+#endif
+} MPOOL;
+
+__BEGIN_DECLS
+MPOOL	*mpool_open(void *, int, pgno_t, pgno_t);
+void	 mpool_filter(MPOOL *, void (*)(void *, pgno_t, void *),
+	    void (*)(void *, pgno_t, void *), void *);
+void	*mpool_new(MPOOL *, pgno_t *);
+void	*mpool_get(MPOOL *, pgno_t, unsigned int);
+int	 mpool_put(MPOOL *, void *, unsigned int);
+int	 mpool_sync(MPOOL *);
+int	 mpool_close(MPOOL *);
+#ifdef STATISTICS
+void	 mpool_stat(MPOOL *);
+#endif
+__END_DECLS
+
+#endif /* _MPOOL_H_ */

Property changes on: lab4/.minix-src/include/mpool.h
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/keyboard.h
===================================================================
--- lab4/martalab3/lab3/keyboard.h	(nonexistent)
+++ lab4/martalab3/lab3/keyboard.h	(revision 13)
@@ -0,0 +1,12 @@
+
+#ifndef KEYBOARD_H
+#define KEYBOARD_H
+#include <stdint.h>
+
+int kbd_subscribe_int(uint8_t*bit_no);
+
+int kbd_unsubscribe_int();
+
+void(kbc_ih)();
+
+#endif /* KEYBOARD.H */

Property changes on: lab4/martalab3/lab3/keyboard.h
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/trace.txt
===================================================================
--- lab4/martalab3/lab3/trace.txt	(nonexistent)
+++ lab4/martalab3/lab3/trace.txt	(revision 13)
@@ -0,0 +1,1264 @@
+@lcflib.a:2019, lcf_start
+  kbd_test_poll()
+  @lab3.c:139, kbd_test_poll
+    sys_outb(0x64, 0x20)
+  > sys_outb(0x64, 0x20 = 0b00100000)
+  @lab3.c:141, kbd_test_poll
+    sys_outb(0x64, 0x60)
+  > sys_outb(0x64, 0x60 = 0b01100000)
+  @lab3.c:142, kbd_test_poll
+    sys_inb(0x60, &key)
+  > sys_inb(0x60, addr: 0xeffff810)
+  < sys_inb(0x60, addr: 0xeffff810 [0x46 = 0b01000110])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x9c = 0b10011100])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Breakcode: 0x9c"
+  < kbd_print_scancode(false, 1, addr: 0xeffff80e [0x9c]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x1f = 0b00011111])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Makecode: 0x1f"
+  < kbd_print_scancode(true, 1, addr: 0xeffff80e [0x1f]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x21 = 0b00100001])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Makecode: 0x21"
+  < kbd_print_scancode(true, 1, addr: 0xeffff80e [0x21]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x9f = 0b10011111])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Breakcode: 0x9f"
+  < kbd_print_scancode(false, 1, addr: 0xeffff80e [0x9f]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0xa1 = 0b10100001])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Breakcode: 0xa1"
+  < kbd_print_scancode(false, 1, addr: 0xeffff80e [0xa1]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x1f = 0b00011111])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Makecode: 0x1f"
+  < kbd_print_scancode(true, 1, addr: 0xeffff80e [0x1f]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x9f = 0b10011111])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Breakcode: 0x9f"
+  < kbd_print_scancode(false, 1, addr: 0xeffff80e [0x9f]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x01 = 0b00000001])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Makecode: 0x01"
+  < kbd_print_scancode(true, 1, addr: 0xeffff80e [0x01]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x81 = 0b10000001])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Breakcode: 0x81"
+  < kbd_print_scancode(false, 1, addr: 0xeffff80e [0x81]) -> (ret: 0)
+  @lab3.c:173, kbd_test_poll
+    kbd_print_no_sysinb(cnt)
+    "sys_inb_calls: 139"
+  @lab3.c:174, kbd_test_poll
+    sys_outb(0x64, 0x60)
+  > sys_outb(0x64, 0x60 = 0b01100000)
+  @lab3.c:175, kbd_test_poll
+    sys_outb(0x60, key | BIT(0))
+  > sys_outb(0x60, 0x47 = 0b01000111)
+< kbd_test_poll() -> (ret: 0)

Property changes on: lab4/martalab3/lab3/trace.txt
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/netdb.h
===================================================================
--- lab4/.minix-src/include/netdb.h	(nonexistent)
+++ lab4/.minix-src/include/netdb.h	(revision 13)
@@ -0,0 +1,363 @@
+/*	$NetBSD: netdb.h,v 1.69 2013/08/19 07:18:42 christos Exp $	*/
+
+/*
+ * ++Copyright++ 1980, 1983, 1988, 1993
+ * -
+ * Copyright (c) 1980, 1983, 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * -
+ * Portions Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    This product includes software developed by WIDE Project and
+ *    its contributors.
+ * 4. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * -
+ * --Copyright--
+ */
+
+/*
+ *      @(#)netdb.h	8.1 (Berkeley) 6/2/93
+ *	Id: netdb.h,v 1.22 2008/02/28 05:34:17 marka Exp
+ */
+
+#ifndef _NETDB_H_
+#define	_NETDB_H_
+
+#include <sys/cdefs.h>
+#include <machine/endian_machdep.h>
+#include <sys/ansi.h>
+#include <sys/featuretest.h>
+#include <inttypes.h>
+/*
+ * Data types
+ */
+#ifndef socklen_t
+typedef __socklen_t	socklen_t;
+#define	socklen_t	__socklen_t
+#endif
+
+#ifdef  _BSD_SIZE_T_
+typedef _BSD_SIZE_T_	size_t;
+#undef  _BSD_SIZE_T_
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#ifndef _PATH_HEQUIV
+#define	_PATH_HEQUIV	"/etc/hosts.equiv"
+#endif
+#ifndef _PATH_HOSTS
+#define	_PATH_HOSTS	"/etc/hosts"
+#endif
+#ifndef _PATH_NETWORKS
+#define	_PATH_NETWORKS	"/etc/networks"
+#endif
+#ifndef _PATH_PROTOCOLS
+#define	_PATH_PROTOCOLS	"/etc/protocols"
+#endif
+#ifndef _PATH_SERVICES
+#define	_PATH_SERVICES	"/etc/services"
+#endif
+#ifndef _PATH_SERVICES_CDB
+#define	_PATH_SERVICES_CDB "/var/db/services.cdb"
+#endif
+#ifndef _PATH_SERVICES_DB
+#define	_PATH_SERVICES_DB "/var/db/services.db"
+#endif
+#endif
+
+__BEGIN_DECLS
+extern int h_errno;
+extern int * __h_errno(void);
+#ifdef _REENTRANT
+#define	h_errno (*__h_errno())
+#endif
+__END_DECLS
+
+/*%
+ * Structures returned by network data base library.  All addresses are
+ * supplied in host order, and returned in network order (suitable for
+ * use in system calls).
+ */
+struct	hostent {
+	char	*h_name;	/*%< official name of host */
+	char	**h_aliases;	/*%< alias list */
+	int	h_addrtype;	/*%< host address type */
+	int	h_length;	/*%< length of address */
+	char	**h_addr_list;	/*%< list of addresses from name server */
+#define	h_addr	h_addr_list[0]	/*%< address, for backward compatiblity */
+};
+
+/*%
+ * Assumption here is that a network number
+ * fits in an unsigned long -- probably a poor one.
+ */
+struct	netent {
+	char		*n_name;	/*%< official name of net */
+	char		**n_aliases;	/*%< alias list */
+	int		n_addrtype;	/*%< net address type */
+#if (defined(__sparc__) && defined(_LP64)) || \
+    (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _BIG_ENDIAN))
+	int		__n_pad0;	/* ABI compatibility */
+#endif
+	uint32_t	n_net;		/*%< network # */
+#if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) || \
+    (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _LITTLE_ENDIAN))
+	int		__n_pad0;	/* ABI compatibility */
+#endif
+};
+
+struct	servent {
+	char	*s_name;	/*%< official service name */
+	char	**s_aliases;	/*%< alias list */
+	int	s_port;		/*%< port # */
+	char	*s_proto;	/*%< protocol to use */
+};
+
+struct	protoent {
+	char	*p_name;	/*%< official protocol name */
+	char	**p_aliases;	/*%< alias list */
+	int	p_proto;	/*%< protocol # */
+};
+
+/*
+ * Note: ai_addrlen used to be a size_t, per RFC 2553.
+ * In XNS5.2, and subsequently in POSIX-2001 and
+ * draft-ietf-ipngwg-rfc2553bis-02.txt it was changed to a socklen_t.
+ * To accommodate for this while preserving binary compatibility with the
+ * old interface, we prepend or append 32 bits of padding, depending on
+ * the (LP64) architecture's endianness.
+ *
+ * This should be deleted the next time the libc major number is
+ * incremented.
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+struct addrinfo {
+	int		ai_flags;	/*%< AI_PASSIVE, AI_CANONNAME */
+	int		ai_family;	/*%< PF_xxx */
+	int		ai_socktype;	/*%< SOCK_xxx */
+	int		ai_protocol;	/*%< 0 or IPPROTO_xxx for IPv4 and IPv6 */
+#if defined(__sparc__) && defined(_LP64)
+	int		__ai_pad0;	/* ABI compatibility */
+#endif
+	socklen_t	 ai_addrlen;	/*%< length of ai_addr */
+#if defined(__alpha__) || (defined(__i386__) && defined(_LP64))
+	int		__ai_pad0;	/* ABI compatibility */
+#endif
+	char		*ai_canonname;	/*%< canonical name for hostname */
+	struct sockaddr	*ai_addr; 	/*%< binary address */
+	struct addrinfo	*ai_next; 	/*%< next structure in linked list */
+};
+#endif
+
+/*%
+ * Error return codes from gethostbyname() and gethostbyaddr()
+ * (left in extern int h_errno).
+ */
+
+#if defined(_NETBSD_SOURCE)
+#define	NETDB_INTERNAL	-1	/*%< see errno */
+#define	NETDB_SUCCESS	0	/*%< no problem */
+#endif
+#define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
+#define	HOST_NOT_FOUND	1 /*%< Authoritative Answer Host not found */
+#define	TRY_AGAIN	2 /*%< Non-Authoritive Host not found, or SERVERFAIL */
+#define	NO_RECOVERY	3 /*%< Non recoverable errors, FORMERR, REFUSED, NOTIMP */
+#define	NO_DATA		4 /*%< Valid name, no data record of requested type */
+#if defined(_NETBSD_SOURCE)
+#define	NO_ADDRESS	NO_DATA		/*%< no address, look for MX record */
+#endif
+
+/*
+ * Error return codes from getaddrinfo()
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+#define	EAI_ADDRFAMILY	 1	/*%< address family for hostname not supported */
+#define	EAI_AGAIN	 2	/*%< temporary failure in name resolution */
+#define	EAI_BADFLAGS	 3	/*%< invalid value for ai_flags */
+#define	EAI_FAIL	 4	/*%< non-recoverable failure in name resolution */
+#define	EAI_FAMILY	 5	/*%< ai_family not supported */
+#define	EAI_MEMORY	 6	/*%< memory allocation failure */
+#define	EAI_NODATA	 7	/*%< no address associated with hostname */
+#define	EAI_NONAME	 8	/*%< hostname nor servname provided, or not known */
+#define	EAI_SERVICE	 9	/*%< servname not supported for ai_socktype */
+#define	EAI_SOCKTYPE	10	/*%< ai_socktype not supported */
+#define	EAI_SYSTEM	11	/*%< system error returned in errno */
+#define	EAI_BADHINTS	12	/* invalid value for hints */
+#define	EAI_PROTOCOL	13	/* resolved protocol is unknown */
+#define	EAI_OVERFLOW	14	/* argument buffer overflow */
+#define	EAI_MAX		15
+#endif /* _POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */
+
+/*%
+ * Flag values for getaddrinfo()
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+#define	AI_PASSIVE	0x00000001 /* get address to use bind() */
+#define	AI_CANONNAME	0x00000002 /* fill ai_canonname */
+#define	AI_NUMERICHOST	0x00000004 /* prevent host name resolution */
+#define	AI_NUMERICSERV	0x00000008 /* prevent service name resolution */
+#define	AI_ADDRCONFIG	0x00000400 /* only if any address is assigned */
+/* valid flags for addrinfo (not a standard def, apps should not use it) */
+#ifdef _NETBSD_SOURCE
+#define	AI_SRV		0x00000800 /* do _srv lookups */
+#define	AI_MASK	\
+    (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
+    AI_ADDRCONFIG | AI_SRV)
+#else
+#define	AI_MASK	\
+    (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
+    AI_ADDRCONFIG)
+#endif
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+/*%
+ * Constants for getnameinfo()
+ */
+#if defined(_NETBSD_SOURCE)
+#define	NI_MAXHOST	1025
+#define	NI_MAXSERV	32
+#endif
+
+/*%
+ * Flag values for getnameinfo()
+ */
+#define	NI_NOFQDN	0x00000001
+#define	NI_NUMERICHOST	0x00000002
+#define	NI_NAMEREQD	0x00000004
+#define	NI_NUMERICSERV	0x00000008
+#define	NI_DGRAM	0x00000010
+#define	NI_WITHSCOPEID	0x00000020
+#define	NI_NUMERICSCOPE	0x00000040
+
+/*%
+ * Scope delimit character
+ */
+#if defined(_NETBSD_SOURCE)
+#define	SCOPE_DELIMITER	'%'
+#endif
+#endif /* (_POSIX_C_SOURCE - 0) >= 200112L || ... */
+
+__BEGIN_DECLS
+void		endhostent(void);
+void		endnetent(void);
+void		endprotoent(void);
+void		endservent(void);
+#if (_XOPEN_SOURCE - 0) >= 520 && (_XOPEN_SOURCE - 0) < 600 || \
+    defined(_NETBSD_SOURCE)
+#if 0 /* we do not ship this */
+void		freehostent(struct hostent *);
+#endif
+#endif
+struct hostent	*gethostbyaddr(const void *, socklen_t, int);
+struct hostent	*gethostbyname(const char *);
+#if defined(_NETBSD_SOURCE)
+struct hostent	*gethostbyname2(const char *, int);
+#endif
+struct hostent	*gethostent(void);
+struct netent	*getnetbyaddr(uint32_t, int);
+struct netent	*getnetbyname(const char *);
+struct netent	*getnetent(void);
+struct protoent	*getprotobyname(const char *);
+struct protoent	*getprotobynumber(int);
+struct protoent	*getprotoent(void);
+struct servent	*getservbyname(const char *, const char *);
+struct servent	*getservbyport(int, const char *);
+struct servent	*getservent(void);
+#if defined(_NETBSD_SOURCE)
+void		herror(const char *);
+const char	*hstrerror(int);
+#endif
+void		sethostent(int);
+#if defined(_NETBSD_SOURCE)
+/* void		sethostfile(const char *); */
+#endif
+void		setnetent(int);
+void		setprotoent(int);
+void		setservent(int);
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+int		getaddrinfo(const char * __restrict, const char * __restrict,
+				 const struct addrinfo * __restrict,
+				 struct addrinfo ** __restrict);
+int		getnameinfo(const struct sockaddr * __restrict, socklen_t,
+				 char * __restrict, socklen_t,
+				 char * __restrict, socklen_t, int);
+struct addrinfo *allocaddrinfo(socklen_t);
+void		freeaddrinfo(struct addrinfo *);
+const char	*gai_strerror(int);
+#endif
+__END_DECLS
+
+#endif /* !_NETDB_H_ */

Property changes on: lab4/.minix-src/include/netdb.h
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/lab3.c
===================================================================
--- lab4/martalab3/lab3/lab3.c	(nonexistent)
+++ lab4/martalab3/lab3/lab3.c	(revision 13)
@@ -0,0 +1,228 @@
+#include <lcom/lcf.h>
+#include <minix/sysutil.h>
+
+#include <lcom/lab3.h>
+
+#include <stdbool.h>
+#include "i8254.h"
+#include <stdint.h>
+#include "i8042.h"
+#include "keyboard.h"
+//#include <timer.c>
+
+
+/* #define IRQ_KB 1
+#define DELAY_US 20000
+#define EXIT_CODE 0x81
+#define I_O_BUFFER 0x60 */
+
+uint32_t cnt=0;
+ uint32_t scancode;
+int flag=0;
+
+int main(int argc, char *argv[]) {
+  // sets the language of LCF messages (can be either EN-US or PT-PT)
+  lcf_set_language("EN-US");
+
+  // enables to log function invocations that are being "wrapped" by LCF
+  // [comment this out if you don't want/need it]
+  lcf_trace_calls("/home/lcom/labs/lab3/trace.txt");
+
+  // enables to save the output of printf function calls on a file
+  // [comment this out if you don't want/need it]
+  lcf_log_output("/home/lcom/labs/lab3/output.txt");
+
+  // handles control over to LCF
+  // [LCF handles command line arguments and invokes the right function]
+  if (lcf_start(argc, argv))
+    return 1;
+
+  // LCF clean up tasks
+  // [must be the last statement before return]
+  lcf_cleanup();
+
+  return 0;
+}
+
+
+
+int(kbd_test_scan)() {
+  /* To be completed by the students */
+  int ipc_status;
+  uint8_t r, bit_no = 0;
+  message msg;
+  int hook_id = bit_no;
+/*   uint8_t scan_arr[2] = {0, 0};
+
+  int flag = 0; */
+
+  printf("%d\n",
+         sys_irqsetpolicy(IRQ_KB, IRQ_REENABLE | IRQ_EXCLUSIVE, &hook_id));
+  /* sys_outb(0x64, 0x20);
+  sys_inb(0x64, &scancode);
+  printf("%x\n", scancode);
+  if (scancode & 0x10) {
+    scancode = (scancode & 0xEF);
+  }
+
+  printf("%x\n", scancode);
+  sys_outb(0x64, 0x60);
+  sys_outb(0x64, scancode); */
+
+  printf("%x\n", scancode);
+  //kbc_ih();
+  printf("\n");
+  while (scancode !=
+         EXIT_CODE)
+  { /* You may want to use a different condition */
+    /* Get a request message. */
+    // printf("1\n");
+    // printf("cont:%d, time:%d\n\n",cont/60,time);
+    if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
+      printf("driver_receive failed with: %d", r);
+      continue;
+    }
+    if (is_ipc_notify(ipc_status)) { /* received notification */
+      switch (_ENDPOINT_P(msg.m_source)) {
+      case HARDWARE: /* hardware interrupt notification */
+        if (msg.m_notify.interrupts & BIT(0)) { /* subscribed interrupt */
+
+          kbc_ih();
+          }
+
+        
+        // printf("msg:%x\n",msg.m_notify.interrupts);
+        break;
+      default:
+        // printf("2\n");
+        break; /* no other notifications expected: do nothing */
+      }
+    } else {
+      // printf("3\n"); /* received a standard message, not a notification */
+      /* no standard messages expected: do nothing */
+    }
+  }
+  kbd_print_no_sysinb(cnt);
+  if (sys_irqrmpolicy(&hook_id) != 0)
+    return 1;
+
+  return 0;
+}
+
+int(kbd_test_poll)() {
+  /* To be completed by the students */
+  uint32_t key=0;
+  uint8_t scan_arr[2] = {0, 0};
+  //int flag = 0;
+  //uint32_t cnt=0;
+
+  while(scancode != EXIT_CODE)
+  {
+    tickdelay(micros_to_ticks(DELAY_US));
+    #ifdef LAB3 
+    cnt++; 
+    #endif
+    sys_inb(IN_BUF, &scancode);
+          if (scancode & O_BUFFER_FULL) {
+            #ifdef LAB3 
+            cnt++;
+             #endif
+            sys_inb(I_O_BUFFER, &scancode);
+          if (scancode != TWO_BYTES && flag == 0) {
+            scan_arr[0] = scancode;
+            kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr);
+          }
+
+          else if (scancode == TWO_BYTES) {
+            scan_arr[0] = scancode;
+            flag = 1;
+          }
+
+          else if (flag == 1) {
+            scan_arr[1] = scancode;
+            kbd_print_scancode(!(scancode & PAR_ERR), 2, scan_arr);
+            flag = 0;
+          }
+        }
+  }
+  sys_outb(IN_BUF, READ_CMD);        
+  sys_outb(IN_BUF, I_O_BUFFER);
+
+  #ifdef LAB3 
+    cnt++; 
+  #endif
+
+  sys_inb(I_O_BUFFER,&key); 
+
+  sys_outb(IN_BUF,I_O_BUFFER);        //enable interrupts again
+  sys_outb(I_O_BUFFER,  key |  BIT(0));  
+
+  kbd_print_no_sysinb(cnt);
+  return 0;
+}
+
+int(kbd_test_timed_scan)(uint8_t n) {
+  /* To be completed by the students */
+/*   uint8_t scan_arr[2] = {0, 0};
+  int flag=0; */
+   int ipc_status;
+  message msg;
+  uint8_t r;
+  uint8_t bit_no_timer = 0, bit_no_kbd = 1;
+  int hook_id_kbd=bit_no_kbd, hook_id_timer=bit_no_timer;
+  int cont=0;//cnt=0;
+  
+  sys_irqsetpolicy(IRQ_TIMER,IRQ_REENABLE,&hook_id_timer);
+  sys_irqsetpolicy(IRQ_KB, IRQ_REENABLE | IRQ_EXCLUSIVE, &hook_id_kbd);
+  kbc_ih();
+  while( (cont/DEFAULT_FREQ)<n && scancode !=EXIT_CODE) //se não atingir o tempo de espera nem a tecla for ESC
+ { 
+   /* You may want to use a different condition */
+     /* Get a request message. */
+     // printf("1\n");
+     //printf("cont:%d, time:%d\n\n",cont/60,time);
+     if ( (r = driver_receive(ANY, &msg, &ipc_status)) != 0 ) 
+     { 
+        printf("driver_receive failed with: %d", r);
+       continue;
+    }
+    if (is_ipc_notify(ipc_status)) { 
+        switch (_ENDPOINT_P(msg.m_source)) {
+            case HARDWARE: 				
+                if (msg.m_notify.interrupts  & BIT(bit_no_timer)) { 
+                   cont++;
+                   if(cont%DEFAULT_FREQ==0)
+                   timer_print_elapsed_time();
+                   //printf("cont:%d\n",cont);
+               }
+               if (msg.m_notify.interrupts  & BIT(bit_no_kbd)) 
+               { 
+                    
+                  kbc_ih();
+                   cont=0;
+               }
+                //printf("msg:%x\n",msg.m_notify.interrupts);
+                break;
+            default:
+                //printf("2\n");
+                break; /* no other notifications expected: do nothing */	
+        }
+    } 
+     // printf("3\n"); /* received a standard message, not a notification */
+        /* no standard messages expected: do nothing */
+    
+ 
+ }
+  kbd_print_no_sysinb(cnt);
+  
+  if(sys_irqrmpolicy(&hook_id_timer)!=0) return 1;
+  if(sys_irqrmpolicy(&hook_id_kbd)!=0) return 1;
+  
+    
+    return 0;
+
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+ 
+}

Property changes on: lab4/martalab3/lab3/lab3.c
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/nlist.h
===================================================================
--- lab4/.minix-src/include/nlist.h	(nonexistent)
+++ lab4/.minix-src/include/nlist.h	(revision 13)
@@ -0,0 +1,94 @@
+/*	$NetBSD: nlist.h,v 1.14 2009/08/21 08:42:02 he Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)nlist.h	8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _NLIST_H_
+#define	_NLIST_H_
+
+#include <sys/cdefs.h>
+
+/*
+ * Symbol table entry format.  The #ifdef's are so that programs including
+ * nlist.h can initialize nlist structures statically.
+ */
+struct nlist {
+#ifdef _AOUT_INCLUDE_
+	union {
+		__aconst char *n_name;	/* symbol name (in memory) */
+		long n_strx;		/* file string table offset (on disk) */
+	} n_un;
+# define N_NAME(nlp)	((nlp)->n_un.n_name)
+#else
+	const char *n_name;		/* symbol name (in memory) */
+# define N_NAME(nlp)	((nlp)->n_name)
+#endif
+
+#define	N_UNDF	0x00		/* undefined */
+#define	N_ABS	0x02		/* absolute address */
+#define	N_TEXT	0x04		/* text segment */
+#define	N_DATA	0x06		/* data segment */
+#define	N_BSS	0x08		/* bss segment */
+#define	N_INDR	0x0a		/* alias definition */
+#define	N_SIZE	0x0c		/* pseudo type, defines a symbol's size */
+#define	N_COMM	0x12		/* common reference */
+#define N_SETA	0x14		/* absolute set element symbol */
+#define N_SETT	0x16		/* text set element symbol */
+#define N_SETD	0x18		/* data set element symbol */
+#define N_SETB	0x1a		/* bss set element symbol */
+#define N_SETV	0x1c		/* set vector symbol */
+#define	N_FN	0x1e		/* file name (N_EXT on) */
+#define	N_WARN	0x1e		/* warning message (N_EXT off) */
+
+#define	N_EXT	0x01		/* external (global) bit, OR'ed in */
+#define	N_TYPE	0x1e		/* mask for all the type bits */
+	unsigned char n_type;	/* type defines */
+
+	char n_other;		/* spare */
+#define	n_hash	n_desc		/* used internally by ld(1); XXX */
+	short n_desc;		/* used by stab entries */
+	unsigned long n_value;	/* address/value of the symbol */
+};
+
+#define	N_FORMAT	"%08x"	/* namelist value format; XXX */
+#define	N_STAB		0x0e0	/* mask for debugger symbols -- stab(5) */
+
+__BEGIN_DECLS
+int nlist(const char *, struct nlist *);
+int __fdnlist(int, struct nlist *);		/* XXX for libkvm */
+__END_DECLS
+
+#endif /* !_NLIST_H_ */

Property changes on: lab4/.minix-src/include/nlist.h
___________________________________________________________________
Added: svn:executable
Index: lab4/proj/.vscode/settings.json
===================================================================
--- lab4/proj/.vscode/settings.json	(nonexistent)
+++ lab4/proj/.vscode/settings.json	(revision 13)
@@ -0,0 +1,10 @@
+{
+  "git.ignoreLimitWarning": true,
+  "C_Cpp.clang_format_fallbackStyle": "LLVM",
+  "diffEditor.ignoreTrimWhitespace": true,
+  "editor.formatOnSave": false,
+  "editor.tabSize": 2,
+  "editor.wordWrap": "bounded",
+  "editor.wordWrapColumn": 100,
+  "files.associations": { },
+}
\ No newline at end of file

Property changes on: lab4/proj/.vscode/settings.json
___________________________________________________________________
Added: svn:executable
Index: lab4/proj/.vscode/c_cpp_properties.json
===================================================================
--- lab4/proj/.vscode/c_cpp_properties.json	(nonexistent)
+++ lab4/proj/.vscode/c_cpp_properties.json	(revision 13)
@@ -0,0 +1,18 @@
+{
+  "env": {
+    "minix.include": "${workspaceFolder}/../.minix-src/include"
+  },
+  "configurations": [{
+    "name": "Minix",
+    "compilerPath": "",
+    "cStandard": "c11",
+    "defines": ["__minix", "_MINIX ", "_NETBSD_SOURCE", "__i386__"],
+    "includePath": ["${workspaceFolder}", "${env:minix.include}"],
+    "browse": {
+      "path": ["${workspaceFolder}", "${env:minix.include}"],
+      "limitSymbolsToIncludedHeaders": false,
+      "databaseFilename": ""
+    }
+  }],
+  "version": 4
+}

Property changes on: lab4/proj/.vscode/c_cpp_properties.json
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/pcap.h
===================================================================
--- lab4/.minix-src/include/pcap.h	(nonexistent)
+++ lab4/.minix-src/include/pcap.h	(revision 13)
@@ -0,0 +1 @@
+pcap/pcap.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/pcap.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/pwd.h
===================================================================
--- lab4/.minix-src/include/pwd.h	(nonexistent)
+++ lab4/.minix-src/include/pwd.h	(revision 13)
@@ -0,0 +1,159 @@
+/*	$NetBSD: pwd.h,v 1.44 2012/11/26 19:53:41 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)pwd.h	8.2 (Berkeley) 1/21/94
+ */
+
+/*-
+ * Portions Copyright(C) 1995, Jason Downs.  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(S) ``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(S) BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _PWD_H_
+#define	_PWD_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
+#define	_PATH_PASSWD		"/etc/passwd"
+#define	_PATH_MASTERPASSWD	"/etc/master.passwd"
+#define	_PATH_MASTERPASSWD_LOCK	"/etc/ptmp"
+
+#define	_PATH_PASSWD_CONF	"/etc/passwd.conf"
+#define	_PATH_PASSWDCONF	_PATH_PASSWD_CONF	/* XXX: compat */
+#define	_PATH_USERMGMT_CONF	"/etc/usermgmt.conf"
+
+#define	_PATH_MP_DB		"/etc/pwd.db"
+#define	_PATH_SMP_DB		"/etc/spwd.db"
+
+#define	_PATH_PWD_MKDB		"/usr/sbin/pwd_mkdb"
+
+#define	_PW_KEYBYNAME		'1'	/* stored by name */
+#define	_PW_KEYBYNUM		'2'	/* stored by entry in the "file" */
+#define	_PW_KEYBYUID		'3'	/* stored by uid */
+
+#define	_PASSWORD_EFMT1		'_'	/* extended DES encryption format */
+#define	_PASSWORD_NONDES	'$'	/* non-DES encryption formats */
+
+#define	_PASSWORD_LEN		128	/* max length, not counting NUL */
+
+#define _PASSWORD_NOUID		0x01	/* flag for no specified uid. */
+#define _PASSWORD_NOGID		0x02	/* flag for no specified gid. */
+#define _PASSWORD_NOCHG		0x04	/* flag for no specified change. */
+#define _PASSWORD_NOEXP		0x08	/* flag for no specified expire. */
+
+#define _PASSWORD_OLDFMT	0x10	/* flag to expect an old style entry */
+#define _PASSWORD_NOWARN	0x20	/* no warnings for bad entries */
+
+#define _PASSWORD_WARNDAYS	14	/* days to warn about expiry */
+#define _PASSWORD_CHGNOW	-1	/* special day to force password
+					 * change at next login */
+#endif
+
+struct passwd {
+	__aconst char *pw_name;		/* user name */
+	__aconst char *pw_passwd;	/* encrypted password */
+	uid_t	       pw_uid;		/* user uid */
+	gid_t	       pw_gid;		/* user gid */
+	time_t	       pw_change;	/* password change time */
+	__aconst char *pw_class;	/* user login class */
+	__aconst char *pw_gecos;	/* general information */
+	__aconst char *pw_dir;		/* home directory */
+	__aconst char *pw_shell;	/* default shell */
+	time_t 	       pw_expire;	/* account expiration */
+};
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+struct passwd	*getpwuid(uid_t) __RENAME(__getpwuid50);
+struct passwd	*getpwnam(const char *) __RENAME(__getpwnam50);
+#endif
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+int		 getpwnam_r(const char *, struct passwd *, char *, size_t,
+    struct passwd **) __RENAME(__getpwnam_r50);
+int		 getpwuid_r(uid_t, struct passwd *, char *, size_t,
+    struct passwd **) __RENAME(__getpwuid_r50);
+#endif
+#endif
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+struct passwd	*getpwent(void) __RENAME(__getpwent50);
+#endif
+void		 setpwent(void);
+void		 endpwent(void);
+#endif
+#if defined(_NETBSD_SOURCE)
+int		 pw_gensalt(char *, size_t, const char *, const char *);
+#ifndef __LIBC12_SOURCE__
+int		 pw_scan(char *, struct passwd *, int *) __RENAME(__pw_scan50);
+int		 getpwent_r(struct passwd *, char *, size_t, struct passwd **)
+    __RENAME(__getpwent_r50);
+#endif
+int		 setpassent(int);
+const char	*user_from_uid(uid_t, int);
+int		 uid_from_user(const char *, uid_t *);
+#ifndef __LIBC12_SOURCE__
+int		 pwcache_userdb(int (*)(int), void (*)(void),
+    struct passwd * (*)(const char *), struct passwd * (*)(uid_t))
+    __RENAME(__pwcache_userdb50);
+#endif
+#endif
+__END_DECLS
+
+#endif /* !_PWD_H_ */

Property changes on: lab4/.minix-src/include/pwd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/.vscode/c_cpp_properties.json
===================================================================
--- lab4/test/lab2/.vscode/c_cpp_properties.json	(nonexistent)
+++ lab4/test/lab2/.vscode/c_cpp_properties.json	(revision 13)
@@ -0,0 +1,18 @@
+{
+  "env": {
+    "minix.include": "${workspaceFolder}/../.minix-src/include"
+  },
+  "configurations": [{
+    "name": "Minix",
+    "compilerPath": "",
+    "cStandard": "c11",
+    "defines": ["__minix", "_MINIX ", "_NETBSD_SOURCE", "__i386__"],
+    "includePath": ["${workspaceFolder}", "${env:minix.include}"],
+    "browse": {
+      "path": ["${workspaceFolder}", "${env:minix.include}"],
+      "limitSymbolsToIncludedHeaders": false,
+      "databaseFilename": ""
+    }
+  }],
+  "version": 4
+}

Property changes on: lab4/test/lab2/.vscode/c_cpp_properties.json
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/re_comp.h
===================================================================
--- lab4/.minix-src/include/re_comp.h	(nonexistent)
+++ lab4/.minix-src/include/re_comp.h	(revision 13)
@@ -0,0 +1,41 @@
+/*	$NetBSD: re_comp.h,v 1.4 2008/04/28 20:22:54 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by J.T. Conklin.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RE_COMP_H_
+#define _RE_COMP_H_
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+char   *re_comp(const char *);
+int	re_exec(const char *);
+__END_DECLS
+
+#endif /* _RE_COMP_H_ */

Property changes on: lab4/.minix-src/include/re_comp.h
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/.gdbinit
===================================================================
Index: lab4/test/lab2/.gdbinit
===================================================================
--- lab4/test/lab2/.gdbinit	(nonexistent)
+++ lab4/test/lab2/.gdbinit	(revision 13)

Property changes on: lab4/test/lab2/.gdbinit
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/.vscode/settings.json
===================================================================
--- lab4/test/lab2/.vscode/settings.json	(nonexistent)
+++ lab4/test/lab2/.vscode/settings.json	(revision 13)
@@ -0,0 +1,10 @@
+{
+  "git.ignoreLimitWarning": true,
+  "C_Cpp.clang_format_fallbackStyle": "LLVM",
+  "diffEditor.ignoreTrimWhitespace": true,
+  "editor.formatOnSave": false,
+  "editor.tabSize": 2,
+  "editor.wordWrap": "bounded",
+  "editor.wordWrapColumn": 100,
+  "files.associations": { },
+}
\ No newline at end of file

Property changes on: lab4/test/lab2/.vscode/settings.json
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/resolv.h
===================================================================
--- lab4/.minix-src/include/resolv.h	(nonexistent)
+++ lab4/.minix-src/include/resolv.h	(revision 13)
@@ -0,0 +1,510 @@
+/*	$NetBSD: resolv.h,v 1.40 2012/11/07 15:45:24 christos Exp $	*/
+
+/*
+ * Portions Copyright (C) 2004, 2005, 2008, 2009  Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (C) 1995-2003  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 1983, 1987, 1989
+ *    The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*%
+ *	@(#)resolv.h	8.1 (Berkeley) 6/2/93
+ *	Id: resolv.h,v 1.30 2009/03/03 01:52:48 each Exp
+ */
+
+#ifndef _RESOLV_H_
+#define	_RESOLV_H_
+
+#include <sys/param.h>
+#if (!defined(BSD)) || (BSD < 199306)
+# include <sys/bitypes.h>
+#else
+#include <sys/types.h>
+#endif
+#include <sys/cdefs.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+/*%
+ * Revision information.  This is the release date in YYYYMMDD format.
+ * It can change every day so the right thing to do with it is use it
+ * in preprocessor commands such as "#if (__RES > 19931104)".  Do not
+ * compare for equality; rather, use it to determine whether your resolver
+ * is new enough to contain a certain feature.
+ */
+
+#define	__RES	20090302
+
+/*%
+ * This used to be defined in res_query.c, now it's in herror.c.
+ * [XXX no it's not.  It's in irs/irs_data.c]
+ * It was
+ * never extern'd by any *.h file before it was placed here.  For thread
+ * aware programs, the last h_errno value set is stored in res->h_errno.
+ *
+ * XXX:	There doesn't seem to be a good reason for exposing RES_SET_H_ERRNO
+ *	(and __h_errno_set) to the public via <resolv.h>.
+ * XXX:	__h_errno_set is really part of IRS, not part of the resolver.
+ *	If somebody wants to build and use a resolver that doesn't use IRS,
+ *	what do they do?  Perhaps something like
+ *		#ifdef WANT_IRS
+ *		# define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
+ *		#else
+ *		# define RES_SET_H_ERRNO(r,x) (h_errno = (r)->res_h_errno = (x))
+ *		#endif
+ */
+
+#define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
+struct __res_state; /*%< forward */
+__BEGIN_DECLS
+void __h_errno_set(struct __res_state *, int);
+__END_DECLS
+
+/*%
+ * Resolver configuration file.
+ * Normally not present, but may contain the address of the
+ * initial name server(s) to query and the domain search list.
+ */
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF        "/etc/resolv.conf"
+#endif
+
+typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
+	res_sendhookact;
+
+typedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *,
+					      const u_char **, int *,
+					      u_char *, int, int *);
+
+typedef res_sendhookact (*res_send_rhook)(const struct sockaddr *,
+					      const u_char *, int, u_char *,
+					      int, int *);
+
+struct res_sym {
+	int		number;	   /*%< Identifying number, like T_MX */
+	const char *	name;	   /*%< Its symbolic name, like "MX" */
+	const char *	humanname; /*%< Its fun name, like "mail exchanger" */
+};
+
+/*%
+ * Global defines and variables for resolver stub.
+ */
+#define	MAXNS			3	/*%< max # name servers we'll track */
+#define	MAXDFLSRCH		3	/*%< # default domain levels to try */
+#define	MAXDNSRCH		6	/*%< max # domains in search path */
+#define	LOCALDOMAINPARTS	2	/*%< min levels in name that is "local" */
+#define	RES_TIMEOUT		5	/*%< min. seconds between retries */
+#define	MAXRESOLVSORT		10	/*%< number of net to sort on */
+#define	RES_MAXNDOTS		15	/*%< should reflect bit field size */
+#define	RES_MAXRETRANS		30	/*%< only for resolv.conf/RES_OPTIONS */
+#define	RES_MAXRETRY		5	/*%< only for resolv.conf/RES_OPTIONS */
+#define	RES_DFLRETRY		2	/*%< Default #/tries. */
+#define	RES_MAXTIME		65535	/*%< Infinity, in milliseconds. */
+
+struct __res_state_ext;
+
+struct __res_state {
+	int	retrans;	 	/*%< retransmission time interval */
+	int	retry;			/*%< number of times to retransmit */
+#ifdef sun
+	u_int	options;		/*%< option flags - see below. */
+#else
+	u_long	options;		/*%< option flags - see below. */
+#endif
+	int	nscount;		/*%< number of name servers */
+	struct sockaddr_in
+		nsaddr_list[MAXNS];	/*%< address of name server */
+#define	nsaddr	nsaddr_list[0]		/*%< for backward compatibility */
+	u_short	id;			/*%< current message id */
+	char	*dnsrch[MAXDNSRCH+1];	/*%< components of domain to search */
+	char	defdname[256];		/*%< default domain (deprecated) */
+#ifdef sun
+	u_int	pfcode;			/*%< RES_PRF_ flags - see below. */
+#else
+	u_long	pfcode;			/*%< RES_PRF_ flags - see below. */
+#endif
+	unsigned ndots:4;		/*%< threshold for initial abs. query */
+	unsigned nsort:4;		/*%< number of elements in sort_list[] */
+	char	unused[3];
+	struct {
+		struct in_addr	addr;
+		uint32_t	mask;
+	} sort_list[MAXRESOLVSORT];
+#ifdef __OLD_RES_STATE
+	char lookups[4];
+#else
+	res_send_qhook qhook;		/*%< query hook */
+	res_send_rhook rhook;		/*%< response hook */
+	int	res_h_errno;		/*%< last one set for this context */
+	int	_vcsock;		/*%< PRIVATE: for res_send VC i/o */
+	u_int	_flags;			/*%< PRIVATE: see below */
+	u_int	_pad;			/*%< make _u 64 bit aligned */
+	union {
+		/* On an 32-bit arch this means 512b total. */
+		char	pad[56 - 4*sizeof (int) - 3*sizeof (void *)];
+		struct {
+			uint16_t		nscount;
+			uint16_t		nstimes[MAXNS];	/*%< ms. */
+			int			nssocks[MAXNS];
+			struct __res_state_ext *ext;	/*%< extention for IPv6 */
+		} _ext;
+	} _u;
+	u_char	*_rnd;			/*%< PRIVATE: random state */
+#endif
+};
+
+typedef struct __res_state *res_state;
+
+union res_sockaddr_union {
+	struct sockaddr_in	sin;
+#ifdef IN6ADDR_ANY_INIT
+	struct sockaddr_in6	sin6;
+#endif
+#ifdef ISC_ALIGN64
+	int64_t			__align64;	/*%< 64bit alignment */
+#else
+	int32_t			__align32;	/*%< 32bit alignment */
+#endif
+	char			__space[128];   /* max size */
+};
+
+/*%
+ * Resolver flags (used to be discrete per-module statics ints).
+ */
+#define	RES_F_VC	0x00000001	/*%< socket is TCP */
+#define	RES_F_CONN	0x00000002	/*%< socket is connected */
+#define	RES_F_EDNS0ERR	0x00000004	/*%< EDNS0 caused errors */
+#define	RES_F__UNUSED	0x00000008	/*%< (unused) */
+#define	RES_F_LASTMASK	0x000000F0	/*%< ordinal server of last res_nsend */
+#define	RES_F_LASTSHIFT	4		/*%< bit position of LASTMASK "flag" */
+#define	RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT)
+
+/* res_findzonecut2() options */
+#define	RES_EXHAUSTIVE	0x00000001	/*%< always do all queries */
+#define	RES_IPV4ONLY	0x00000002	/*%< IPv4 only */
+#define	RES_IPV6ONLY	0x00000004	/*%< IPv6 only */
+
+/*%
+ * Resolver options (keep these in synch with res_debug.c, please)
+ */
+#define RES_INIT	0x00000001	/*%< address initialized */
+#define RES_DEBUG	0x00000002	/*%< print debug messages */
+#define RES_AAONLY	0x00000004	/*%< authoritative answers only (!IMPL)*/
+#define RES_USEVC	0x00000008	/*%< use virtual circuit */
+#define RES_PRIMARY	0x00000010	/*%< query primary server only (!IMPL) */
+#define RES_IGNTC	0x00000020	/*%< ignore trucation errors */
+#define RES_RECURSE	0x00000040	/*%< recursion desired */
+#define RES_DEFNAMES	0x00000080	/*%< use default domain name */
+#define RES_STAYOPEN	0x00000100	/*%< Keep TCP socket open */
+#define RES_DNSRCH	0x00000200	/*%< search up local domain tree */
+#define	RES_INSECURE1	0x00000400	/*%< type 1 security disabled */
+#define	RES_INSECURE2	0x00000800	/*%< type 2 security disabled */
+#define	RES_NOALIASES	0x00001000	/*%< shuts off HOSTALIASES feature */
+#define	RES_USE_INET6	0x00002000	/*%< use/map IPv6 in gethostbyname() */
+#define RES_ROTATE	0x00004000	/*%< rotate ns list after each query */
+#define	RES_NOCHECKNAME	0x00008000	/*%< do not check names for sanity. */
+#define	RES_KEEPTSIG	0x00010000	/*%< do not strip TSIG records */
+#define	RES_BLAST	0x00020000	/*%< blast all recursive servers */
+#define RES_NSID	0x00040000      /*%< request name server ID */
+#define RES_NOTLDQUERY	0x00100000	/*%< don't unqualified name as a tld */
+#define RES_USE_DNSSEC	0x00200000	/*%< use DNSSEC using OK bit in OPT */
+/* #define RES_DEBUG2	0x00400000 */	/* nslookup internal */
+/* KAME extensions: use higher bit to avoid conflict with ISC use */
+#define RES_USE_DNAME	0x10000000	/*%< use DNAME */
+#define RES_USE_EDNS0	0x40000000	/*%< use EDNS0 if configured */
+#define RES_NO_NIBBLE2	0x80000000	/*%< disable alternate nibble lookup */
+
+#define RES_DEFAULT	(RES_RECURSE | RES_DEFNAMES | \
+			 RES_DNSRCH | RES_NO_NIBBLE2 | RES_NOCHECKNAME)
+
+/*%
+ * Resolver "pfcode" values.  Used by dig.
+ */
+#define RES_PRF_STATS	0x00000001
+#define RES_PRF_UPDATE	0x00000002
+#define RES_PRF_CLASS   0x00000004
+#define RES_PRF_CMD	0x00000008
+#define RES_PRF_QUES	0x00000010
+#define RES_PRF_ANS	0x00000020
+#define RES_PRF_AUTH	0x00000040
+#define RES_PRF_ADD	0x00000080
+#define RES_PRF_HEAD1	0x00000100
+#define RES_PRF_HEAD2	0x00000200
+#define RES_PRF_TTLID	0x00000400
+#define RES_PRF_HEADX	0x00000800
+#define RES_PRF_QUERY	0x00001000
+#define RES_PRF_REPLY	0x00002000
+#define RES_PRF_INIT	0x00004000
+#define RES_PRF_TRUNC	0x00008000
+/*			0x00010000	*/
+
+/* Things involving an internal (static) resolver context. */
+__BEGIN_DECLS
+extern struct __res_state *__res_get_state(void);
+extern void __res_put_state(struct __res_state *);
+
+/*
+ * Source and Binary compatibility; _res will not work properly
+ * with multi-threaded programs.
+ */
+extern struct __res_state *__res_state(void);
+#define _res (*__res_state())
+
+__END_DECLS
+
+#ifndef __BIND_NOSTATIC
+#define fp_nquery		__fp_nquery
+#define fp_query		__fp_query
+#define hostalias		__hostalias
+#define p_query			__p_query
+#define res_close		__res_close
+#define res_isourserver		__res_isourserver
+#define	res_opt			__res_opt
+#define	res_querydomain		__res_querydomain
+#define res_send		__res_send
+#define res_sendsigned		__res_sendsigned
+
+#ifdef notdef
+/* NetBSD protects these via weak symbols. */
+#define	res_init		__res_init
+#define	res_query		__res_query
+#define	res_mkquery		__res_mkquery
+#define	dn_expand		__dn_expand
+#define	res_search		__res_search
+#endif
+
+__BEGIN_DECLS
+void		fp_nquery(const u_char *, int, FILE *);
+void		fp_query(const u_char *, FILE *);
+const char *	hostalias(const char *);
+void		p_query(const u_char *);
+void		res_close(void);
+int		res_init(void);
+int		res_opt(int, u_char *, int, int);
+int		res_isourserver(const struct sockaddr_in *);
+int		res_mkquery(int, const char *, int, int, const u_char *,
+				 int, const u_char *, u_char *, int);
+int		res_query(const char *, int, int, u_char *, int);
+int		res_querydomain(const char *, const char *, int, int,
+				     u_char *, int);
+int		res_search(const char *, int, int, u_char *, int);
+int		res_send(const u_char *, int, u_char *, int);
+int		res_sendsigned(const u_char *, int, ns_tsig_key *,
+				    u_char *, int);
+__END_DECLS
+#endif
+
+#if !defined(SHARED_LIBBIND) || defined(LIB)
+/*
+ * If libbind is a shared object (well, DLL anyway)
+ * these externs break the linker when resolv.h is
+ * included by a lib client (like named)
+ * Make them go away if a client is including this
+ *
+ */
+extern const struct res_sym __p_key_syms[];
+extern const struct res_sym __p_cert_syms[];
+extern const struct res_sym __p_class_syms[];
+extern const struct res_sym __p_type_syms[];
+extern const struct res_sym __p_rcode_syms[];
+#endif /* SHARED_LIBBIND */
+
+#define b64_ntop		__b64_ntop
+#define b64_pton		__b64_pton
+#define dn_comp			__dn_comp
+#define dn_count_labels		__dn_count_labels
+#define dn_skipname		__dn_skipname
+#define fp_resstat		__fp_resstat
+#define loc_aton		__loc_aton
+#define loc_ntoa		__loc_ntoa
+#define p_cdname		__p_cdname
+#define p_cdnname		__p_cdnname
+#define p_class			__p_class
+#define p_fqname		__p_fqname
+#define p_fqnname		__p_fqnname
+#define p_option		__p_option
+#define p_secstodate		__p_secstodate
+#define p_section		__p_section
+#define p_time			__p_time
+#define p_type			__p_type
+#define p_rcode			__p_rcode
+#define p_sockun		__p_sockun
+#define putlong			__putlong
+#define putshort		__putshort
+#define	res_check		__res_check
+#define res_dnok		__res_dnok
+#define res_findzonecut		__res_findzonecut
+#define res_findzonecut2	__res_findzonecut2
+#define res_hnok		__res_hnok
+#define res_hostalias		__res_hostalias
+#define res_mailok		__res_mailok
+#define res_nameinquery		__res_nameinquery
+#define res_nclose		__res_nclose
+#define res_ninit		__res_ninit
+#define res_nmkquery		__res_nmkquery
+#define res_pquery		__res_pquery
+#define res_nquery		__res_nquery
+#define res_nquerydomain	__res_nquerydomain
+#define res_nsearch		__res_nsearch
+#define res_nsend		__res_nsend
+#define res_nsendsigned		__res_nsendsigned
+#define res_nisourserver	__res_nisourserver
+#define res_ownok		__res_ownok
+#define res_queriesmatch	__res_queriesmatch
+#define res_rndinit		__res_rndinit
+#define res_randomid		__res_randomid
+#define res_nrandomid		__res_nrandomid
+#define sym_ntop		__sym_ntop
+#define sym_ntos		__sym_ntos
+#define sym_ston		__sym_ston
+#define res_nopt		__res_nopt
+#define res_nopt_rdata       	__res_nopt_rdata
+#define res_ndestroy		__res_ndestroy
+#define	res_nametoclass		__res_nametoclass
+#define	res_nametotype		__res_nametotype
+#define	res_setservers		__res_setservers
+#define	res_getservers		__res_getservers
+#define	res_buildprotolist	__res_buildprotolist
+#define	res_destroyprotolist	__res_destroyprotolist
+#define	res_destroyservicelist	__res_destroyservicelist
+#define	res_get_nibblesuffix	__res_get_nibblesuffix
+#define	res_get_nibblesuffix2	__res_get_nibblesuffix2
+#define	res_ourserver_p		__res_ourserver_p
+#define	res_protocolname	__res_protocolname
+#define	res_protocolnumber	__res_protocolnumber
+#define	res_send_setqhook	__res_send_setqhook
+#define	res_send_setrhook	__res_send_setrhook
+#define	res_servicename		__res_servicename
+#define	res_servicenumber	__res_servicenumber
+__BEGIN_DECLS
+int		res_hnok(const char *);
+int		res_ownok(const char *);
+int		res_mailok(const char *);
+struct timespec;
+int		res_check(res_state, struct timespec *);
+int		res_dnok(const char *);
+int		sym_ston(const struct res_sym *, const char *, int *);
+const char *	sym_ntos(const struct res_sym *, int, int *);
+const char *	sym_ntop(const struct res_sym *, int, int *);
+int		b64_ntop(u_char const *, size_t, char *, size_t);
+int		b64_pton(char const *, u_char *, size_t);
+int		loc_aton(const char *, u_char *);
+const char *	loc_ntoa(const u_char *, char *);
+int		dn_skipname(const u_char *, const u_char *);
+void		putlong(uint32_t, u_char *);
+void		putshort(uint16_t, u_char *);
+#ifndef __ultrix__
+uint16_t	_getshort(const u_char *);
+uint32_t	_getlong(const u_char *);
+#endif
+const char *	p_class(int);
+const char *	p_time(uint32_t);
+const char *	p_type(int);
+const char *	p_rcode(int);
+const char *	p_sockun(union res_sockaddr_union, char *, size_t);
+const u_char *	p_cdnname(const u_char *, const u_char *, int, FILE *);
+const u_char *	p_cdname(const u_char *, const u_char *, FILE *);
+const u_char *	p_fqnname(const u_char *, const u_char *,
+			       int, char *, int);
+const u_char *	p_fqname(const u_char *, const u_char *, FILE *);
+const char *	p_option(u_long);
+char *		p_secstodate(u_long);
+int		dn_count_labels(const char *);
+int		dn_comp(const char *, u_char *, int, u_char **, u_char **);
+int		dn_expand(const u_char *, const u_char *, const u_char *,
+			       char *, int);
+void		res_rndinit(res_state);
+u_int		res_randomid(void);
+u_int		res_nrandomid(res_state);
+int		res_nameinquery(const char *, int, int, const u_char *,
+				     const u_char *);
+int		res_queriesmatch(const u_char *, const u_char *,
+				      const u_char *, const u_char *);
+const char *	p_section(int, int);
+/* Things involving a resolver context. */
+int		res_ninit(res_state);
+int		res_nisourserver(const res_state, const struct sockaddr_in *);
+void		fp_resstat(const res_state, FILE *);
+void		res_pquery(const res_state, const u_char *, int, FILE *);
+const char *	res_hostalias(const res_state, const char *, char *, size_t);
+int		res_nquery(res_state, const char *, int, int, u_char *, int);
+int		res_nsearch(res_state, const char *, int, int, u_char *, int);
+int		res_nquerydomain(res_state, const char *, const char *,
+				      int, int, u_char *, int);
+int		res_nmkquery(res_state, int, const char *, int, int,
+				  const u_char *, int, const u_char *,
+				  u_char *, int);
+int		res_nsend(res_state, const u_char *, int, u_char *, int);
+int		res_nsendsigned(res_state, const u_char *, int,
+				     ns_tsig_key *, u_char *, int);
+int		res_findzonecut(res_state, const char *, ns_class, int,
+				     char *, size_t, struct in_addr *, int);
+int		res_findzonecut2(res_state, const char *, ns_class, int,
+				      char *, size_t,
+				      union res_sockaddr_union *, int);
+void		res_nclose(res_state);
+int		res_nopt(res_state, int, u_char *, int, int);
+int		res_nopt_rdata(res_state, int, u_char *, int, u_char *,
+				    u_short, u_short, u_char *);
+void		res_send_setqhook(res_send_qhook);
+void		res_send_setrhook(res_send_rhook);
+int		__res_vinit(res_state, int);
+void		res_destroyservicelist(void);
+const char *	res_servicename(uint16_t, const char *);
+const char *	res_protocolname(int);
+void		res_destroyprotolist(void);
+void		res_buildprotolist(void);
+const char *	res_get_nibblesuffix(res_state);
+const char *	res_get_nibblesuffix2(res_state);
+void		res_ndestroy(res_state);
+uint16_t	res_nametoclass(const char *, int *);
+uint16_t	res_nametotype(const char *, int *);
+void		res_setservers(res_state,
+				    const union res_sockaddr_union *, int);
+int		res_getservers(res_state,
+				    union res_sockaddr_union *, int);
+__END_DECLS
+
+#endif /* !_RESOLV_H_ */

Property changes on: lab4/.minix-src/include/resolv.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sched.h
===================================================================
--- lab4/.minix-src/include/sched.h	(nonexistent)
+++ lab4/.minix-src/include/sched.h	(revision 13)
@@ -0,0 +1,78 @@
+/*	$NetBSD: sched.h,v 1.12 2009/01/11 03:04:12 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nathan J. Williams.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/sched.h>
+
+/* Required by POSIX 1003.1, section 13.1, lines 12-13. */
+#include <time.h>
+
+__BEGIN_DECLS
+int	sched_setparam(pid_t, const struct sched_param *);
+int	sched_getparam(pid_t, struct sched_param *);
+int	sched_setscheduler(pid_t, int, const struct sched_param *);
+int	sched_getscheduler(pid_t);
+int	sched_get_priority_max(int);
+int	sched_get_priority_min(int);
+#ifndef __LIBC12_SOURCE__
+int	sched_rr_get_interval(pid_t, struct timespec *)
+    __RENAME(__sched_rr_get_interval50);
+#endif
+
+int	sched_yield(void);
+int	__libc_thr_yield(void);
+__END_DECLS
+
+#ifndef __LIBPTHREAD_SOURCE__
+#define sched_yield		__libc_thr_yield
+#endif /* __LIBPTHREAD_SOURCE__ */
+
+#if defined(_NETBSD_SOURCE)
+
+__BEGIN_DECLS
+
+/* Process affinity functions (not portable) */
+int	sched_getaffinity_np(pid_t, size_t, cpuset_t *);
+int	sched_setaffinity_np(pid_t, size_t, cpuset_t *);
+
+/* Historical functions, not defined in standard */
+pid_t	 clone(int (*)(void *), void *, int, void *);
+pid_t	__clone(int (*)(void *), void *, int, void *);
+
+__END_DECLS
+
+#endif /* _NETBSD_SOURCE */
+
+#endif /* _SCHED_H_ */

Property changes on: lab4/.minix-src/include/sched.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sgtty.h
===================================================================
--- lab4/.minix-src/include/sgtty.h	(nonexistent)
+++ lab4/.minix-src/include/sgtty.h	(revision 13)
@@ -0,0 +1,48 @@
+/*	$NetBSD: sgtty.h,v 1.8 2005/02/03 04:39:32 perry Exp $	*/
+
+/*
+ * Copyright (c) 1985, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)sgtty.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SGTTY_H_
+#define _SGTTY_H_
+
+#ifndef USE_OLD_TTY
+#define	USE_OLD_TTY
+#endif
+#include <sys/ioctl.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int gtty(int, struct sgttyb *);
+int stty(int, struct sgttyb *);
+__END_DECLS
+
+#endif /* _SGTTY_H_ */

Property changes on: lab4/.minix-src/include/sgtty.h
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/lab2.c
===================================================================
--- lab4/test/lab2/lab2.c	(nonexistent)
+++ lab4/test/lab2/lab2.c	(revision 13)
@@ -0,0 +1,109 @@
+#include <lcom/lcf.h>
+#include <lcom/lab2.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "i8254.h"
+//#include "timer.c"
+extern uint32_t cont;
+
+
+int main(int argc, char *argv[]) {
+  
+  // sets the language of LCF messages (can be either EN-US or PT-PT)
+  lcf_set_language("EN-US");
+
+  // enables to log function invocations that are being "wrapped" by LCF
+  // [comment this out if you don't want/need it]
+  lcf_trace_calls("/home/lcom/labs/lab2/trace.txt");
+
+  // enables to save the output of printf function calls on a file
+  // [comment this out if you don't want/need it]
+  lcf_log_output("/home/lcom/labs/lab2/output.txt");
+
+  // handles control over to LCF
+  // [LCF handles command line arguments and invokes the right function]
+  if (lcf_start(argc, argv))
+    return 1;
+
+  // LCF clean up tasks
+  // [must be the last statement before return]
+  lcf_cleanup();
+
+  return 0;
+}
+
+int(timer_test_read_config)(uint8_t timer, enum timer_status_field field) {
+  /* To be implemented by the students */
+  uint8_t st;
+  if(timer_get_conf(timer,&st)==1) return 1;
+  if(timer_display_conf(timer,st,field)==1) return 1;
+
+  return 0;
+ // printf("%s is not yet implemented!\n", __func__);
+
+}
+
+int(timer_test_time_base)(uint8_t timer, uint32_t freq) {
+  /* To be implemented by the students */
+  if(freq<MIN_FREQ || freq>TIMER_FREQ)
+  {
+    printf("OUT OF RANGE FREQUENCY\n");
+    return 1;
+  }
+  return(timer_set_frequency(timer,freq));
+  //printf("%s is not yet implemented!\n", __func__);
+
+}
+
+int(timer_test_int)(uint8_t time) {
+  /* To be implemented by the students */
+
+  if(time<0) return 1;
+
+  int ipc_status;
+  message msg;
+  uint8_t r;
+  uint8_t bit_no = 0;
+  timer_subscribe_int(&bit_no);
+  while( (cont/DEFAULT_FREQ)<time )
+ { /* You may want to use a different condition */
+     /* Get a request message. */
+     // printf("1\n");
+     //printf("cont:%d, time:%d\n\n",cont/60,time);
+     if ( (r = driver_receive(ANY, &msg, &ipc_status)) != 0 ) 
+     { 
+        printf("driver_receive failed with: %d", r);
+       continue;
+    }
+    if (is_ipc_notify(ipc_status)) { /* received notification */
+        switch (_ENDPOINT_P(msg.m_source)) {
+            case HARDWARE: /* hardware interrupt notification */				
+                if (msg.m_notify.interrupts  & BIT(0)) { /* subscribed interrupt */
+                   timer_int_handler();
+                   if(cont%DEFAULT_FREQ==0)
+                   timer_print_elapsed_time();
+                   //printf("cont:%d\n",cont);
+               }
+                //printf("msg:%x\n",msg.m_notify.interrupts);
+                break;
+            default:
+                //printf("2\n");
+                break; /* no other notifications expected: do nothing */	
+        }
+    } else {
+     // printf("3\n"); /* received a standard message, not a notification */
+        /* no standard messages expected: do nothing */
+    }
+ }
+ if(timer_unsubscribe_int()!=0) return 1;
+
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  return 0;
+}
+//dois primeiros bits sao 1, (TIMER_RB_CNTRL|BIT(5))
+//SYS_OUTB para controlo->0x43, Config timer 0, dizer que queremos escrever para o controlo, e depois ler a parte corresponder
+//g9

Property changes on: lab4/test/lab2/lab2.c
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/i8254.h
===================================================================
--- lab4/test/lab2/i8254.h	(nonexistent)
+++ lab4/test/lab2/i8254.h	(revision 13)
@@ -0,0 +1,66 @@
+#ifndef _LCOM_I8254_H_
+#define _LCOM_I8254_H_
+
+#include <lcom/lcf.h>
+
+/** @defgroup i8254 i8254
+ * @{
+ *
+ * Constants for programming the i8254 Timer. Needs to be completed.
+ */
+
+
+
+/*IRQ's*/
+
+#define IRQ_TIMER 0
+#define DEFAULT_FREQ 60
+
+
+#define TIMER_FREQ 1193182 /**< @brief clock frequency for timer in PC and AT */
+#define MIN_FREQ 19
+#define TIMER0_IRQ 0 /**< @brief Timer 0 IRQ line */
+
+/* I/O port addresses */
+
+#define TIMER_0    0x40 /**< @brief Timer 0 count register */
+#define TIMER_1    0x41 /**< @brief Timer 1 count register */
+#define TIMER_2    0x42 /**< @brief Timer 2 count register */
+#define TIMER_CTRL 0x43 /**< @brief Control register */
+
+#define SPEAKER_CTRL 0x61 /**< @brief Register for speaker control  */
+
+/* Timer control */
+
+/* Timer selection: bits 7 and 6 */
+
+#define TIMER_SEL0   0x00              /**< @brief Control Word for Timer 0 */
+#define TIMER_SEL1   BIT(6)            /**< @brief Control Word for Timer 1 */
+#define TIMER_SEL2   BIT(7)            /**< @brief Control Word for Timer 2 */
+#define TIMER_RB_CMD (BIT(7) | BIT(6)) /**< @brief Read Back Command */
+
+/* Register selection: bits 5 and 4 */
+
+#define TIMER_LSB     BIT(4)                  /**< @brief Initialize Counter LSB only */
+#define TIMER_MSB     BIT(5)                  /**< @brief Initialize Counter MSB only */
+#define TIMER_LSB_MSB (TIMER_LSB | TIMER_MSB) /**< @brief Initialize LSB first and MSB afterwards */
+
+/* Operating mode: bits 3, 2 and 1 */
+
+#define TIMER_SQR_WAVE (BIT(2) | BIT(1)) /**< @brief Mode 3: square wave generator */
+#define TIMER_RATE_GEN BIT(2)            /**< @brief Mode 2: rate generator */
+
+/* Counting mode: bit 0 */
+
+#define TIMER_BCD 0x01 /**< @brief Count in BCD */
+#define TIMER_BIN 0x00 /**< @brief Count in binary */
+
+/* READ-BACK COMMAND FORMAT */
+
+#define TIMER_RB_COUNT_  BIT(5)
+#define TIMER_RB_STATUS_ BIT(4)
+#define TIMER_RB_SEL(n)  BIT((n) + 1)
+
+/**@}*/
+
+#endif /* _LCOM_I8254_H */

Property changes on: lab4/test/lab2/i8254.h
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/utils.c
===================================================================
--- lab4/test/lab2/utils.c	(nonexistent)
+++ lab4/test/lab2/utils.c	(revision 13)
@@ -0,0 +1,37 @@
+#include <lcom/lcf.h>
+
+#include <stdint.h>
+
+int(util_get_LSB)(uint16_t val, uint8_t *lsb) {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  *lsb=val&0xFF;
+  return 0;
+}
+
+int(util_get_MSB)(uint16_t val, uint8_t *msb) {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  *msb=(val&0xFF00)>>8;
+
+  return 0;
+}
+
+int (util_sys_inb)(int port, uint8_t *value) {
+  /* To be implemented by the students */
+  uint32_t b32;
+ sys_inb(port,&b32);
+ //printf("%x",b32);
+ *value=b32&0xFF;
+ //printf("%x\n",*value);
+  
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  return 0;
+}
+
+/* a = 133
+b = a & 0x0F
+1000 0101
+ */

Property changes on: lab4/test/lab2/utils.c
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/lab3
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-executable
Index: lab4/lab3/lab3
===================================================================
--- lab4/lab3/lab3	(nonexistent)
+++ lab4/lab3/lab3	(revision 13)

Property changes on: lab4/lab3/lab3
___________________________________________________________________
Added: svn:executable
Added: svn:mime-type
## -0,0 +1 ##
+application/x-executable
\ No newline at end of property
Index: lab4/test/lab3/.vscode/extensions.json
===================================================================
--- lab4/test/lab3/.vscode/extensions.json	(nonexistent)
+++ lab4/test/lab3/.vscode/extensions.json	(revision 13)
@@ -0,0 +1,12 @@
+{
+	// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+	// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+	// List of extensions which should be recommended for users of this workspace.
+	"recommendations": [
+		"austin.code-gnu-global",
+		"ms-vscode.cpptools",
+		"xaver.clang-format"
+	],
+	// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
+	"unwantedRecommendations": []
+}
\ No newline at end of file

Property changes on: lab4/test/lab3/.vscode/extensions.json
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/.clang-format
===================================================================
--- lab4/test/lab3/.clang-format	(nonexistent)
+++ lab4/test/lab3/.clang-format	(revision 13)
@@ -0,0 +1,73 @@
+BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: true
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: false
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      false
+  AfterControlStatement: false
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: true
+  AfterStruct:     false
+  AfterUnion:      false
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+IndentPPDirectives: AfterHash
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+Language: Cpp
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+SpaceAfterCStyleCast: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: true
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 2
+UseTab: Never

Property changes on: lab4/test/lab3/.clang-format
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/timer.h
===================================================================
Index: lab4/lab3/timer.h
===================================================================
--- lab4/lab3/timer.h	(nonexistent)
+++ lab4/lab3/timer.h	(revision 13)

Property changes on: lab4/lab3/timer.h
___________________________________________________________________
Added: svn:executable
Index: lab4/lab4/.vscode/extensions.json
===================================================================
--- lab4/lab4/.vscode/extensions.json	(nonexistent)
+++ lab4/lab4/.vscode/extensions.json	(revision 13)
@@ -0,0 +1,12 @@
+{
+	// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+	// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+	// List of extensions which should be recommended for users of this workspace.
+	"recommendations": [
+		"austin.code-gnu-global",
+		"ms-vscode.cpptools",
+		"xaver.clang-format"
+	],
+	// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
+	"unwantedRecommendations": []
+}
\ No newline at end of file

Property changes on: lab4/lab4/.vscode/extensions.json
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/Makefile
===================================================================
--- lab4/test/lab3/Makefile	(nonexistent)
+++ lab4/test/lab3/Makefile	(revision 13)
@@ -0,0 +1,16 @@
+# name of the program (Minix service)
+PROG=lab3
+
+# source code files to be compiled
+SRCS = lab3.c keyboard.c 
+
+# additional compilation flags
+# "-Wall -Wextra -Werror -I . -std=c11 -Wno-unused-parameter" are already set
+CPPFLAGS += -pedantic -DLAB3
+
+# list of library dependencies (for Lab 2, only LCF library)
+DPADD += ${LIBLCF}
+LDADD += -llcf
+
+# include LCOM's makefile that does all the "heavy lifting"
+.include <minix.lcom.mk>

Property changes on: lab4/test/lab3/Makefile
___________________________________________________________________
Added: svn:executable
Index: lab4/lab5/.vscode/c_cpp_properties.json
===================================================================
--- lab4/lab5/.vscode/c_cpp_properties.json	(nonexistent)
+++ lab4/lab5/.vscode/c_cpp_properties.json	(revision 13)
@@ -0,0 +1,18 @@
+{
+  "env": {
+    "minix.include": "${workspaceFolder}/../.minix-src/include"
+  },
+  "configurations": [{
+    "name": "Minix",
+    "compilerPath": "",
+    "cStandard": "c11",
+    "defines": ["__minix", "_MINIX ", "_NETBSD_SOURCE", "__i386__"],
+    "includePath": ["${workspaceFolder}", "${env:minix.include}"],
+    "browse": {
+      "path": ["${workspaceFolder}", "${env:minix.include}"],
+      "limitSymbolsToIncludedHeaders": false,
+      "databaseFilename": ""
+    }
+  }],
+  "version": 4
+}

Property changes on: lab4/lab5/.vscode/c_cpp_properties.json
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/i8254.h
===================================================================
--- lab4/test/lab3/i8254.h	(nonexistent)
+++ lab4/test/lab3/i8254.h	(revision 13)
@@ -0,0 +1,66 @@
+#ifndef _LCOM_I8254_H_
+#define _LCOM_I8254_H_
+
+#include <lcom/lcf.h>
+
+/** @defgroup i8254 i8254
+ * @{
+ *
+ * Constants for programming the i8254 Timer. Needs to be completed.
+ */
+
+
+
+/*IRQ's*/
+
+#define IRQ_TIMER 0
+#define DEFAULT_FREQ 60
+
+
+#define TIMER_FREQ 1193182 /**< @brief clock frequency for timer in PC and AT */
+#define MIN_FREQ 19
+#define TIMER0_IRQ 0 /**< @brief Timer 0 IRQ line */
+
+/* I/O port addresses */
+
+#define TIMER_0    0x40 /**< @brief Timer 0 count register */
+#define TIMER_1    0x41 /**< @brief Timer 1 count register */
+#define TIMER_2    0x42 /**< @brief Timer 2 count register */
+#define TIMER_CTRL 0x43 /**< @brief Control register */
+
+#define SPEAKER_CTRL 0x61 /**< @brief Register for speaker control  */
+
+/* Timer control */
+
+/* Timer selection: bits 7 and 6 */
+
+#define TIMER_SEL0   0x00              /**< @brief Control Word for Timer 0 */
+#define TIMER_SEL1   BIT(6)            /**< @brief Control Word for Timer 1 */
+#define TIMER_SEL2   BIT(7)            /**< @brief Control Word for Timer 2 */
+#define TIMER_RB_CMD (BIT(7) | BIT(6)) /**< @brief Read Back Command */
+
+/* Register selection: bits 5 and 4 */
+
+#define TIMER_LSB     BIT(4)                  /**< @brief Initialize Counter LSB only */
+#define TIMER_MSB     BIT(5)                  /**< @brief Initialize Counter MSB only */
+#define TIMER_LSB_MSB (TIMER_LSB | TIMER_MSB) /**< @brief Initialize LSB first and MSB afterwards */
+
+/* Operating mode: bits 3, 2 and 1 */
+
+#define TIMER_SQR_WAVE (BIT(2) | BIT(1)) /**< @brief Mode 3: square wave generator */
+#define TIMER_RATE_GEN BIT(2)            /**< @brief Mode 2: rate generator */
+
+/* Counting mode: bit 0 */
+
+#define TIMER_BCD 0x01 /**< @brief Count in BCD */
+#define TIMER_BIN 0x00 /**< @brief Count in binary */
+
+/* READ-BACK COMMAND FORMAT */
+
+#define TIMER_RB_COUNT_  BIT(5)
+#define TIMER_RB_STATUS_ BIT(4)
+#define TIMER_RB_SEL(n)  BIT((n) + 1)
+
+/**@}*/
+
+#endif /* _LCOM_I8254_H */

Property changes on: lab4/test/lab3/i8254.h
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/keyboard.h
===================================================================
--- lab4/test/lab3/keyboard.h	(nonexistent)
+++ lab4/test/lab3/keyboard.h	(revision 13)
@@ -0,0 +1,12 @@
+
+#ifndef KEYBOARD_H
+#define KEYBOARD_H
+#include <stdint.h>
+
+int kbd_subscribe_int(uint8_t*bit_no);
+
+int kbd_unsubscribe_int();
+
+void(kbc_ih)();
+
+#endif /* KEYBOARD.H */

Property changes on: lab4/test/lab3/keyboard.h
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/lab3.c
===================================================================
--- lab4/test/lab3/lab3.c	(nonexistent)
+++ lab4/test/lab3/lab3.c	(revision 13)
@@ -0,0 +1,228 @@
+#include <lcom/lcf.h>
+#include <minix/sysutil.h>
+
+#include <lcom/lab3.h>
+
+#include <stdbool.h>
+#include "i8254.h"
+#include <stdint.h>
+#include "i8042.h"
+#include "keyboard.h"
+//#include <timer.c>
+
+
+/* #define IRQ_KB 1
+#define DELAY_US 20000
+#define EXIT_CODE 0x81
+#define I_O_BUFFER 0x60 */
+
+uint32_t cnt=0;
+ uint32_t scancode;
+int flag=0;
+
+int main(int argc, char *argv[]) {
+  // sets the language of LCF messages (can be either EN-US or PT-PT)
+  lcf_set_language("EN-US");
+
+  // enables to log function invocations that are being "wrapped" by LCF
+  // [comment this out if you don't want/need it]
+  lcf_trace_calls("/home/lcom/labs/lab3/trace.txt");
+
+  // enables to save the output of printf function calls on a file
+  // [comment this out if you don't want/need it]
+  lcf_log_output("/home/lcom/labs/lab3/output.txt");
+
+  // handles control over to LCF
+  // [LCF handles command line arguments and invokes the right function]
+  if (lcf_start(argc, argv))
+    return 1;
+
+  // LCF clean up tasks
+  // [must be the last statement before return]
+  lcf_cleanup();
+
+  return 0;
+}
+
+
+
+int(kbd_test_scan)() {
+  /* To be completed by the students */
+  int ipc_status;
+  uint8_t r, bit_no = 0;
+  message msg;
+  int hook_id = bit_no;
+/*   uint8_t scan_arr[2] = {0, 0};
+
+  int flag = 0; */
+
+  printf("%d\n",
+         sys_irqsetpolicy(IRQ_KB, IRQ_REENABLE | IRQ_EXCLUSIVE, &hook_id));
+  /* sys_outb(0x64, 0x20);
+  sys_inb(0x64, &scancode);
+  printf("%x\n", scancode);
+  if (scancode & 0x10) {
+    scancode = (scancode & 0xEF);
+  }
+
+  printf("%x\n", scancode);
+  sys_outb(0x64, 0x60);
+  sys_outb(0x64, scancode); */
+
+  printf("%x\n", scancode);
+  //kbc_ih();
+  printf("\n");
+  while (scancode !=
+         EXIT_CODE)
+  { /* You may want to use a different condition */
+    /* Get a request message. */
+    // printf("1\n");
+    // printf("cont:%d, time:%d\n\n",cont/60,time);
+    if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
+      printf("driver_receive failed with: %d", r);
+      continue;
+    }
+    if (is_ipc_notify(ipc_status)) { /* received notification */
+      switch (_ENDPOINT_P(msg.m_source)) {
+      case HARDWARE: /* hardware interrupt notification */
+        if (msg.m_notify.interrupts & BIT(0)) { /* subscribed interrupt */
+
+          kbc_ih();
+          }
+
+        
+        // printf("msg:%x\n",msg.m_notify.interrupts);
+        break;
+      default:
+        // printf("2\n");
+        break; /* no other notifications expected: do nothing */
+      }
+    } else {
+      // printf("3\n"); /* received a standard message, not a notification */
+      /* no standard messages expected: do nothing */
+    }
+  }
+  kbd_print_no_sysinb(cnt);
+  if (sys_irqrmpolicy(&hook_id) != 0)
+    return 1;
+
+  return 0;
+}
+
+int(kbd_test_poll)() {
+  /* To be completed by the students */
+  uint32_t key=0;
+  uint8_t scan_arr[2] = {0, 0};
+  //int flag = 0;
+  //uint32_t cnt=0;
+
+  while(scancode != EXIT_CODE)
+  {
+    tickdelay(micros_to_ticks(DELAY_US));
+    #ifdef LAB3 
+    cnt++; 
+    #endif
+    sys_inb(IN_BUF, &scancode);
+          if (scancode & O_BUFFER_FULL) {
+            #ifdef LAB3 
+            cnt++;
+             #endif
+            sys_inb(I_O_BUFFER, &scancode);
+          if (scancode != TWO_BYTES && flag == 0) {
+            scan_arr[0] = scancode;
+            kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr);
+          }
+
+          else if (scancode == TWO_BYTES) {
+            scan_arr[0] = scancode;
+            flag = 1;
+          }
+
+          else if (flag == 1) {
+            scan_arr[1] = scancode;
+            kbd_print_scancode(!(scancode & PAR_ERR), 2, scan_arr);
+            flag = 0;
+          }
+        }
+  }
+  sys_outb(IN_BUF, READ_CMD);        
+  sys_outb(IN_BUF, I_O_BUFFER);
+
+  #ifdef LAB3 
+    cnt++; 
+  #endif
+
+  sys_inb(I_O_BUFFER,&key); 
+
+  sys_outb(IN_BUF,I_O_BUFFER);        //enable interrupts again
+  sys_outb(I_O_BUFFER,  key |  BIT(0));  
+
+  kbd_print_no_sysinb(cnt);
+  return 0;
+}
+
+int(kbd_test_timed_scan)(uint8_t n) {
+  /* To be completed by the students */
+/*   uint8_t scan_arr[2] = {0, 0};
+  int flag=0; */
+   int ipc_status;
+  message msg;
+  uint8_t r;
+  uint8_t bit_no_timer = 0, bit_no_kbd = 1;
+  int hook_id_kbd=bit_no_kbd, hook_id_timer=bit_no_timer;
+  int cont=0;//cnt=0;
+  
+  sys_irqsetpolicy(IRQ_TIMER,IRQ_REENABLE,&hook_id_timer);
+  sys_irqsetpolicy(IRQ_KB, IRQ_REENABLE | IRQ_EXCLUSIVE, &hook_id_kbd);
+  kbc_ih();
+  while( (cont/DEFAULT_FREQ)<n && scancode !=EXIT_CODE) //se não atingir o tempo de espera nem a tecla for ESC
+ { 
+   /* You may want to use a different condition */
+     /* Get a request message. */
+     // printf("1\n");
+     //printf("cont:%d, time:%d\n\n",cont/60,time);
+     if ( (r = driver_receive(ANY, &msg, &ipc_status)) != 0 ) 
+     { 
+        printf("driver_receive failed with: %d", r);
+       continue;
+    }
+    if (is_ipc_notify(ipc_status)) { 
+        switch (_ENDPOINT_P(msg.m_source)) {
+            case HARDWARE: 				
+                if (msg.m_notify.interrupts  & BIT(bit_no_timer)) { 
+                   cont++;
+                   if(cont%DEFAULT_FREQ==0)
+                   timer_print_elapsed_time();
+                   //printf("cont:%d\n",cont);
+               }
+               if (msg.m_notify.interrupts  & BIT(bit_no_kbd)) 
+               { 
+                    
+                  kbc_ih();
+                   cont=0;
+               }
+                //printf("msg:%x\n",msg.m_notify.interrupts);
+                break;
+            default:
+                //printf("2\n");
+                break; /* no other notifications expected: do nothing */	
+        }
+    } 
+     // printf("3\n"); /* received a standard message, not a notification */
+        /* no standard messages expected: do nothing */
+    
+ 
+ }
+  kbd_print_no_sysinb(cnt);
+  
+  if(sys_irqrmpolicy(&hook_id_timer)!=0) return 1;
+  if(sys_irqrmpolicy(&hook_id_kbd)!=0) return 1;
+  
+    
+    return 0;
+
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+ 
+}

Property changes on: lab4/test/lab3/lab3.c
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/.vscode/c_cpp_properties.json
===================================================================
--- lab4/martalab3/lab3/.vscode/c_cpp_properties.json	(nonexistent)
+++ lab4/martalab3/lab3/.vscode/c_cpp_properties.json	(revision 13)
@@ -0,0 +1,18 @@
+{
+  "env": {
+    "minix.include": "${workspaceFolder}/../.minix-src/include"
+  },
+  "configurations": [{
+    "name": "Minix",
+    "compilerPath": "",
+    "cStandard": "c11",
+    "defines": ["__minix", "_MINIX ", "_NETBSD_SOURCE", "__i386__"],
+    "includePath": ["${workspaceFolder}", "${env:minix.include}"],
+    "browse": {
+      "path": ["${workspaceFolder}", "${env:minix.include}"],
+      "limitSymbolsToIncludedHeaders": false,
+      "databaseFilename": ""
+    }
+  }],
+  "version": 4
+}

Property changes on: lab4/martalab3/lab3/.vscode/c_cpp_properties.json
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/.gdbinit
===================================================================
Index: lab4/martalab3/lab3/.gdbinit
===================================================================
--- lab4/martalab3/lab3/.gdbinit	(nonexistent)
+++ lab4/martalab3/lab3/.gdbinit	(revision 13)

Property changes on: lab4/martalab3/lab3/.gdbinit
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/keyboard.c
===================================================================
--- lab4/martalab3/lab3/keyboard.c	(nonexistent)
+++ lab4/martalab3/lab3/keyboard.c	(revision 13)
@@ -0,0 +1,68 @@
+#include "keyboard.h"
+//#include "lab3.c"
+#include <lcom/lcf.h>
+
+#include <minix/sysutil.h>
+#include <stdint.h>
+
+#include "i8042.h"
+#include "i8254.h"
+
+#include <lcom/lab3.h>
+#include <stdbool.h>
+
+extern uint32_t scancode;
+static int hook_id = 1;
+extern uint32_t cnt;
+  extern int flag;
+
+void(kbc_ih)() {
+  uint8_t scan_arr[2] = {0, 0};
+ 
+#ifdef LAB3
+    cnt++;
+#endif
+    sys_inb(IN_BUF, &scancode);
+    if (scancode & O_BUFFER_FULL) {
+#ifdef LAB3
+      cnt++;
+#endif
+      sys_inb(I_O_BUFFER, &scancode);
+              if (scancode != TWO_BYTES && flag == 0) {
+                scan_arr[0] = scancode;
+                kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr);
+              }
+
+              else if (scancode == TWO_BYTES) {
+                scan_arr[0] = scancode;
+                flag = 1;
+              }
+
+              else if (flag == 1) {
+                scan_arr[1] = scancode;
+                kbd_print_scancode(!(scancode & PAR_ERR), 2, scan_arr);
+                flag = 0;
+              }
+    }
+  
+}
+
+int kbd_subscribe_int(uint8_t *bit_no) {
+  *bit_no = hook_id;
+
+  if (sys_irqsetpolicy(IRQ_KB, (IRQ_REENABLE | IRQ_EXCLUSIVE), &hook_id) != OK) {
+    printf("ERROR kbd subscribe failed");
+    return 1;
+  }
+
+  return 0;
+}
+
+int kbd_unsubscribe_int() {
+  if (sys_irqrmpolicy(&hook_id) != OK) {
+    printf("ERROR kbd unsubscribe failed");
+    return 1;
+  }
+
+  return 0;
+}

Property changes on: lab4/martalab3/lab3/keyboard.c
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/trace.txt
===================================================================
--- lab4/test/lab3/trace.txt	(nonexistent)
+++ lab4/test/lab3/trace.txt	(revision 13)
@@ -0,0 +1,1264 @@
+@lcflib.a:2019, lcf_start
+  kbd_test_poll()
+  @lab3.c:139, kbd_test_poll
+    sys_outb(0x64, 0x20)
+  > sys_outb(0x64, 0x20 = 0b00100000)
+  @lab3.c:141, kbd_test_poll
+    sys_outb(0x64, 0x60)
+  > sys_outb(0x64, 0x60 = 0b01100000)
+  @lab3.c:142, kbd_test_poll
+    sys_inb(0x60, &key)
+  > sys_inb(0x60, addr: 0xeffff810)
+  < sys_inb(0x60, addr: 0xeffff810 [0x46 = 0b01000110])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x9c = 0b10011100])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Breakcode: 0x9c"
+  < kbd_print_scancode(false, 1, addr: 0xeffff80e [0x9c]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x1f = 0b00011111])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Makecode: 0x1f"
+  < kbd_print_scancode(true, 1, addr: 0xeffff80e [0x1f]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x21 = 0b00100001])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Makecode: 0x21"
+  < kbd_print_scancode(true, 1, addr: 0xeffff80e [0x21]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x9f = 0b10011111])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Breakcode: 0x9f"
+  < kbd_print_scancode(false, 1, addr: 0xeffff80e [0x9f]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0xa1 = 0b10100001])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Breakcode: 0xa1"
+  < kbd_print_scancode(false, 1, addr: 0xeffff80e [0xa1]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x1f = 0b00011111])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Makecode: 0x1f"
+  < kbd_print_scancode(true, 1, addr: 0xeffff80e [0x1f]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x9f = 0b10011111])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Breakcode: 0x9f"
+  < kbd_print_scancode(false, 1, addr: 0xeffff80e [0x9f]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x01 = 0b00000001])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Makecode: 0x01"
+  < kbd_print_scancode(true, 1, addr: 0xeffff80e [0x01]) -> (ret: 0)
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1c = 0b00011100])
+  @lab3.c:145, kbd_test_poll
+    micros_to_ticks(DELAY_US)
+  @lab3.c:145, kbd_test_poll
+    tickdelay(micros_to_ticks(DELAY_US))
+  > tickdelay(1 [16.7 ms])
+  @lab3.c:149, kbd_test_poll
+    sys_inb(0x64, &scancode)
+  > sys_inb(0x64, addr: 0x81978f8)
+  < sys_inb(0x64, addr: 0x81978f8 [0x1d = 0b00011101])
+  @lab3.c:154, kbd_test_poll
+    sys_inb(0x60, &scancode)
+  > sys_inb(0x60, addr: 0x81978f8)
+  < sys_inb(0x60, addr: 0x81978f8 [0x81 = 0b10000001])
+  @lab3.c:157, kbd_test_poll
+    kbd_print_scancode(!(scancode & 0x80), 1, scan_arr)
+    "Breakcode: 0x81"
+  < kbd_print_scancode(false, 1, addr: 0xeffff80e [0x81]) -> (ret: 0)
+  @lab3.c:173, kbd_test_poll
+    kbd_print_no_sysinb(cnt)
+    "sys_inb_calls: 139"
+  @lab3.c:174, kbd_test_poll
+    sys_outb(0x64, 0x60)
+  > sys_outb(0x64, 0x60 = 0b01100000)
+  @lab3.c:175, kbd_test_poll
+    sys_outb(0x60, key | BIT(0))
+  > sys_outb(0x60, 0x47 = 0b01000111)
+< kbd_test_poll() -> (ret: 0)

Property changes on: lab4/test/lab3/trace.txt
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/output.txt
===================================================================
--- lab4/martalab3/lab3/output.txt	(nonexistent)
+++ lab4/martalab3/lab3/output.txt	(revision 13)
@@ -0,0 +1,10 @@
+Breakcode: 0x9c
+Makecode: 0x1f
+Makecode: 0x21
+Breakcode: 0x9f
+Breakcode: 0xa1
+Makecode: 0x1f
+Breakcode: 0x9f
+Makecode: 0x01
+Breakcode: 0x81
+sys_inb_calls: 139

Property changes on: lab4/martalab3/lab3/output.txt
___________________________________________________________________
Added: svn:executable
Index: lab4/proj/.vscode/extensions.json
===================================================================
--- lab4/proj/.vscode/extensions.json	(nonexistent)
+++ lab4/proj/.vscode/extensions.json	(revision 13)
@@ -0,0 +1,12 @@
+{
+	// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+	// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+	// List of extensions which should be recommended for users of this workspace.
+	"recommendations": [
+		"austin.code-gnu-global",
+		"ms-vscode.cpptools",
+		"xaver.clang-format"
+	],
+	// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
+	"unwantedRecommendations": []
+}
\ No newline at end of file

Property changes on: lab4/proj/.vscode/extensions.json
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/.vscode/extensions.json
===================================================================
--- lab4/test/lab2/.vscode/extensions.json	(nonexistent)
+++ lab4/test/lab2/.vscode/extensions.json	(revision 13)
@@ -0,0 +1,12 @@
+{
+	// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+	// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+	// List of extensions which should be recommended for users of this workspace.
+	"recommendations": [
+		"austin.code-gnu-global",
+		"ms-vscode.cpptools",
+		"xaver.clang-format"
+	],
+	// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
+	"unwantedRecommendations": []
+}
\ No newline at end of file

Property changes on: lab4/test/lab2/.vscode/extensions.json
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/Makefile
===================================================================
--- lab4/test/lab2/Makefile	(nonexistent)
+++ lab4/test/lab2/Makefile	(revision 13)
@@ -0,0 +1,16 @@
+# name of the program (Minix service)
+PROG=lab2 
+
+# source code files to be compiled
+SRCS = lab2.c timer.c utils.c
+
+# additional compilation flags
+# "-Wall -Wextra -Werror -I . -std=c11 -Wno-unused-parameter" are already set
+CFLAGS += -pedantic
+
+# list of library dependencies (for Lab 2, only LCF library)
+DPADD += ${LIBLCF}
+LDADD += -llcf
+
+# include LCOM's makefile that does all the "heavy lifting"
+.include <minix.lcom.mk>

Property changes on: lab4/test/lab2/Makefile
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/timer.c
===================================================================
--- lab4/test/lab2/timer.c	(nonexistent)
+++ lab4/test/lab2/timer.c	(revision 13)
@@ -0,0 +1,164 @@
+#include <lcom/lcf.h>
+#include <lcom/timer.h>
+
+#include <stdint.h>
+
+#include "i8254.h"
+
+uint32_t cont=0;
+int hook_id;
+
+
+int (timer_set_frequency)(uint8_t timer, uint32_t freq) {
+  /* To be implemented by the students */
+  uint8_t conf;
+  timer_get_conf(timer,&conf);
+  uint32_t tudo;
+  uint8_t msb,lsb;
+  tudo=(TIMER_FREQ/freq);
+  util_get_MSB(tudo,&msb);
+  util_get_LSB(tudo,&lsb);
+  
+  //printf("%x\n%x\n%x\n%d\n",tudo,msb,lsb,timer);
+
+
+  if(timer==0)
+  {
+    conf=(conf&0xF);
+    conf = (conf  | TIMER_SEL0 | TIMER_LSB_MSB);
+  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
+  if(sys_outb(TIMER_0, lsb)!=0) return 1;
+  if(sys_outb(TIMER_0, msb)!=0) return 1;
+  }
+
+  if(timer==1)
+  {
+    conf=(conf&0xF);
+    conf = (conf | TIMER_SEL1 | TIMER_LSB_MSB);
+  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
+  if(sys_outb(TIMER_1, lsb)!=0) return 1;
+  if(sys_outb(TIMER_1, msb)!=0) return 1;
+  }
+
+  if(timer==2)
+  {
+    conf=(conf&0xF);
+    conf = (conf | TIMER_SEL2 | TIMER_LSB_MSB);
+  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
+  if(sys_outb(TIMER_2, lsb)!=0) return 1;
+  if(sys_outb(TIMER_2, msb)!=0) return 1;
+  }
+  return 0;
+
+}
+
+int (timer_subscribe_int)(uint8_t *bit_no) {
+    /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+ /*  int policy;
+  sys_irqrmpolicy(&policy); */
+  hook_id=*bit_no;
+  sys_irqsetpolicy(IRQ_TIMER,IRQ_REENABLE,&hook_id);
+
+  return 1;
+}
+
+int (timer_unsubscribe_int)() {
+  /* To be implemented by the students */
+// printf("%s is not yet implemented!\n", __func__);
+
+sys_irqrmpolicy(&hook_id);
+
+  return 1;
+}
+
+void (timer_int_handler)() {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  cont=cont+1;
+}
+
+int (timer_get_conf)(uint8_t timer, uint8_t *st) {
+  /* To be implemented by the students */
+
+  uint8_t rbc = (TIMER_RB_CMD|TIMER_RB_SEL(4)|TIMER_RB_SEL(timer));
+  if(sys_outb(TIMER_CTRL,rbc)!=0) return 1;
+
+  
+  if(timer==0)
+  return (util_sys_inb(TIMER_0,st));
+  if(timer==1)
+  return (util_sys_inb(TIMER_1,st));
+  if(timer==2)
+  return (util_sys_inb(TIMER_2,st));
+
+  return 1;
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  
+}
+
+int (timer_display_conf)(uint8_t timer, uint8_t st,
+                        enum timer_status_field field) {
+  /* To be implemented by the students */
+  union timer_status_field_val val;
+  
+
+  if(field==tsf_all)
+  {
+    val.byte=st; 
+    
+  }
+ if(field==tsf_initial)
+  {
+    //printf("%d\n",tsf_initial);
+
+  if(((st&0x30)>>4)==0)
+  val.in_mode=INVAL_val;
+
+  if(((st&0x30)>>4)==1)
+  val.in_mode=LSB_only;
+
+  if(((st&0x30)>>4)==2)
+  val.in_mode=MSB_only;
+
+  if(((st&0x30)>>4)==3)
+  val.in_mode=MSB_after_LSB;
+  }
+  
+
+  if(field==tsf_mode)
+  {
+    //printf("%x\n",st);
+    val.count_mode=((st&0xE)>>1);
+
+    /* printf("%x\n",val.count_mode);
+    val.count_mode=(val.count_mode>>1);
+    printf("%x\n",val.count_mode); */
+  //val.count_mode=(st&0x1C)/4;
+
+ if (val.count_mode==6)
+ val.count_mode=2;
+
+ if (val.count_mode==7)
+ val.count_mode=3;
+
+
+  }
+
+  if(field==tsf_base ) //BCD
+  {
+    //printf("%d\n",tsf_base);
+    if((st&BIT(0))==1)
+    val.bcd=true;
+
+    else val.bcd=false;
+  }
+
+
+ return( timer_print_config(timer, field, val));
+  //printf("%s is not yet implemented!\n", __func__);
+
+  //return 0;
+}

Property changes on: lab4/test/lab2/timer.c
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/sqlite3.h
===================================================================
--- lab4/.minix-src/include/sqlite3.h	(nonexistent)
+++ lab4/.minix-src/include/sqlite3.h	(revision 13)
@@ -0,0 +1,7385 @@
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code.  In place of
+** a legal notice, here is a blessing:
+**
+**    May you do good and not evil.
+**    May you find forgiveness for yourself and forgive others.
+**    May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This header file defines the interface that the SQLite library
+** presents to client programs.  If a C-function, structure, datatype,
+** or constant definition does not appear in this file, then it is
+** not a published API of SQLite, is subject to change without
+** notice, and should not be referenced by programs that use SQLite.
+**
+** Some of the definitions that are in this file are marked as
+** "experimental".  Experimental interfaces are normally new
+** features recently added to SQLite.  We do not anticipate changes
+** to experimental interfaces but reserve the right to make minor changes
+** if experience from use "in the wild" suggest such changes are prudent.
+**
+** The official C-language API documentation for SQLite is derived
+** from comments in this file.  This file is the authoritative source
+** on how SQLite interfaces are suppose to operate.
+**
+** The name of this file under configuration management is "sqlite.h.in".
+** The makefile makes some minor changes to this file (such as inserting
+** the version number) and changes its name to "sqlite3.h" as
+** part of the build process.
+*/
+#ifndef _SQLITE3_H_
+#define _SQLITE3_H_
+#include <stdarg.h>     /* Needed for the definition of va_list */
+
+/*
+** Make sure we can call this stuff from C++.
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+** Add the ability to override 'extern'
+*/
+#ifndef SQLITE_EXTERN
+# define SQLITE_EXTERN extern
+#endif
+
+#ifndef SQLITE_API
+# define SQLITE_API
+#endif
+
+
+/*
+** These no-op macros are used in front of interfaces to mark those
+** interfaces as either deprecated or experimental.  New applications
+** should not use deprecated interfaces - they are support for backwards
+** compatibility only.  Application writers should be aware that
+** experimental interfaces are subject to change in point releases.
+**
+** These macros used to resolve to various kinds of compiler magic that
+** would generate warning messages when they were used.  But that
+** compiler magic ended up generating such a flurry of bug reports
+** that we have taken it all out and gone back to using simple
+** noop macros.
+*/
+#define SQLITE_DEPRECATED
+#define SQLITE_EXPERIMENTAL
+
+/*
+** Ensure these symbols were not defined by some previous header file.
+*/
+#ifdef SQLITE_VERSION
+# undef SQLITE_VERSION
+#endif
+#ifdef SQLITE_VERSION_NUMBER
+# undef SQLITE_VERSION_NUMBER
+#endif
+
+/*
+** CAPI3REF: Compile-Time Library Version Numbers
+**
+** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header
+** evaluates to a string literal that is the SQLite version in the
+** format "X.Y.Z" where X is the major version number (always 3 for
+** SQLite3) and Y is the minor version number and Z is the release number.)^
+** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer
+** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
+** numbers used in [SQLITE_VERSION].)^
+** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
+** be larger than the release from which it is derived.  Either Y will
+** be held constant and Z will be incremented or else Y will be incremented
+** and Z will be reset to zero.
+**
+** Since version 3.6.18, SQLite source code has been stored in the
+** <a href="http://www.fossil-scm.org/">Fossil configuration management
+** system</a>.  ^The SQLITE_SOURCE_ID macro evaluates to
+** a string which identifies a particular check-in of SQLite
+** within its configuration management system.  ^The SQLITE_SOURCE_ID
+** string contains the date and time of the check-in (UTC) and an SHA1
+** hash of the entire source tree.
+**
+** See also: [sqlite3_libversion()],
+** [sqlite3_libversion_number()], [sqlite3_sourceid()],
+** [sqlite_version()] and [sqlite_source_id()].
+*/
+#define SQLITE_VERSION        "3.8.3.1"
+#define SQLITE_VERSION_NUMBER 3008003
+#define SQLITE_SOURCE_ID      "2014-02-11 14:52:19 ea3317a4803d71d88183b29f1d3086f46d68a00e"
+
+/*
+** CAPI3REF: Run-Time Library Version Numbers
+** KEYWORDS: sqlite3_version, sqlite3_sourceid
+**
+** These interfaces provide the same information as the [SQLITE_VERSION],
+** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
+** but are associated with the library instead of the header file.  ^(Cautious
+** programmers might include assert() statements in their application to
+** verify that values returned by these interfaces match the macros in
+** the header, and thus insure that the application is
+** compiled with matching library and header files.
+**
+** <blockquote><pre>
+** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
+** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
+** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
+** </pre></blockquote>)^
+**
+** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]
+** macro.  ^The sqlite3_libversion() function returns a pointer to the
+** to the sqlite3_version[] string constant.  The sqlite3_libversion()
+** function is provided for use in DLLs since DLL users usually do not have
+** direct access to string constants within the DLL.  ^The
+** sqlite3_libversion_number() function returns an integer equal to
+** [SQLITE_VERSION_NUMBER].  ^The sqlite3_sourceid() function returns 
+** a pointer to a string constant whose value is the same as the 
+** [SQLITE_SOURCE_ID] C preprocessor macro.
+**
+** See also: [sqlite_version()] and [sqlite_source_id()].
+*/
+SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
+SQLITE_API const char *sqlite3_libversion(void);
+SQLITE_API const char *sqlite3_sourceid(void);
+SQLITE_API int sqlite3_libversion_number(void);
+
+/*
+** CAPI3REF: Run-Time Library Compilation Options Diagnostics
+**
+** ^The sqlite3_compileoption_used() function returns 0 or 1 
+** indicating whether the specified option was defined at 
+** compile time.  ^The SQLITE_ prefix may be omitted from the 
+** option name passed to sqlite3_compileoption_used().  
+**
+** ^The sqlite3_compileoption_get() function allows iterating
+** over the list of options that were defined at compile time by
+** returning the N-th compile time option string.  ^If N is out of range,
+** sqlite3_compileoption_get() returns a NULL pointer.  ^The SQLITE_ 
+** prefix is omitted from any strings returned by 
+** sqlite3_compileoption_get().
+**
+** ^Support for the diagnostic functions sqlite3_compileoption_used()
+** and sqlite3_compileoption_get() may be omitted by specifying the 
+** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
+**
+** See also: SQL functions [sqlite_compileoption_used()] and
+** [sqlite_compileoption_get()] and the [compile_options pragma].
+*/
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
+SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
+SQLITE_API const char *sqlite3_compileoption_get(int N);
+#endif
+
+/*
+** CAPI3REF: Test To See If The Library Is Threadsafe
+**
+** ^The sqlite3_threadsafe() function returns zero if and only if
+** SQLite was compiled with mutexing code omitted due to the
+** [SQLITE_THREADSAFE] compile-time option being set to 0.
+**
+** SQLite can be compiled with or without mutexes.  When
+** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes
+** are enabled and SQLite is threadsafe.  When the
+** [SQLITE_THREADSAFE] macro is 0, 
+** the mutexes are omitted.  Without the mutexes, it is not safe
+** to use SQLite concurrently from more than one thread.
+**
+** Enabling mutexes incurs a measurable performance penalty.
+** So if speed is of utmost importance, it makes sense to disable
+** the mutexes.  But for maximum safety, mutexes should be enabled.
+** ^The default behavior is for mutexes to be enabled.
+**
+** This interface can be used by an application to make sure that the
+** version of SQLite that it is linking against was compiled with
+** the desired setting of the [SQLITE_THREADSAFE] macro.
+**
+** This interface only reports on the compile-time mutex setting
+** of the [SQLITE_THREADSAFE] flag.  If SQLite is compiled with
+** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but
+** can be fully or partially disabled using a call to [sqlite3_config()]
+** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],
+** or [SQLITE_CONFIG_MUTEX].  ^(The return value of the
+** sqlite3_threadsafe() function shows only the compile-time setting of
+** thread safety, not any run-time changes to that setting made by
+** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
+** is unchanged by calls to sqlite3_config().)^
+**
+** See the [threading mode] documentation for additional information.
+*/
+SQLITE_API int sqlite3_threadsafe(void);
+
+/*
+** CAPI3REF: Database Connection Handle
+** KEYWORDS: {database connection} {database connections}
+**
+** Each open SQLite database is represented by a pointer to an instance of
+** the opaque structure named "sqlite3".  It is useful to think of an sqlite3
+** pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and
+** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
+** and [sqlite3_close_v2()] are its destructors.  There are many other
+** interfaces (such as
+** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
+** [sqlite3_busy_timeout()] to name but three) that are methods on an
+** sqlite3 object.
+*/
+typedef struct sqlite3 sqlite3;
+
+/*
+** CAPI3REF: 64-Bit Integer Types
+** KEYWORDS: sqlite_int64 sqlite_uint64
+**
+** Because there is no cross-platform way to specify 64-bit integer types
+** SQLite includes typedefs for 64-bit signed and unsigned integers.
+**
+** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
+** The sqlite_int64 and sqlite_uint64 types are supported for backwards
+** compatibility only.
+**
+** ^The sqlite3_int64 and sqlite_int64 types can store integer values
+** between -9223372036854775808 and +9223372036854775807 inclusive.  ^The
+** sqlite3_uint64 and sqlite_uint64 types can store integer values 
+** between 0 and +18446744073709551615 inclusive.
+*/
+#ifdef SQLITE_INT64_TYPE
+  typedef SQLITE_INT64_TYPE sqlite_int64;
+  typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
+#elif defined(_MSC_VER) || defined(__BORLANDC__)
+  typedef __int64 sqlite_int64;
+  typedef unsigned __int64 sqlite_uint64;
+#else
+  typedef long long int sqlite_int64;
+  typedef unsigned long long int sqlite_uint64;
+#endif
+typedef sqlite_int64 sqlite3_int64;
+typedef sqlite_uint64 sqlite3_uint64;
+
+/*
+** If compiling for a processor that lacks floating point support,
+** substitute integer for floating-point.
+*/
+#ifdef SQLITE_OMIT_FLOATING_POINT
+# define double sqlite3_int64
+#endif
+
+/*
+** CAPI3REF: Closing A Database Connection
+**
+** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors
+** for the [sqlite3] object.
+** ^Calls to sqlite3_close() and sqlite3_close_v2() return SQLITE_OK if
+** the [sqlite3] object is successfully destroyed and all associated
+** resources are deallocated.
+**
+** ^If the database connection is associated with unfinalized prepared
+** statements or unfinished sqlite3_backup objects then sqlite3_close()
+** will leave the database connection open and return [SQLITE_BUSY].
+** ^If sqlite3_close_v2() is called with unfinalized prepared statements
+** and unfinished sqlite3_backups, then the database connection becomes
+** an unusable "zombie" which will automatically be deallocated when the
+** last prepared statement is finalized or the last sqlite3_backup is
+** finished.  The sqlite3_close_v2() interface is intended for use with
+** host languages that are garbage collected, and where the order in which
+** destructors are called is arbitrary.
+**
+** Applications should [sqlite3_finalize | finalize] all [prepared statements],
+** [sqlite3_blob_close | close] all [BLOB handles], and 
+** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated
+** with the [sqlite3] object prior to attempting to close the object.  ^If
+** sqlite3_close_v2() is called on a [database connection] that still has
+** outstanding [prepared statements], [BLOB handles], and/or
+** [sqlite3_backup] objects then it returns SQLITE_OK but the deallocation
+** of resources is deferred until all [prepared statements], [BLOB handles],
+** and [sqlite3_backup] objects are also destroyed.
+**
+** ^If an [sqlite3] object is destroyed while a transaction is open,
+** the transaction is automatically rolled back.
+**
+** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)]
+** must be either a NULL
+** pointer or an [sqlite3] object pointer obtained
+** from [sqlite3_open()], [sqlite3_open16()], or
+** [sqlite3_open_v2()], and not previously closed.
+** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
+** argument is a harmless no-op.
+*/
+SQLITE_API int sqlite3_close(sqlite3*);
+SQLITE_API int sqlite3_close_v2(sqlite3*);
+
+/*
+** The type for a callback function.
+** This is legacy and deprecated.  It is included for historical
+** compatibility and is not documented.
+*/
+typedef int (*sqlite3_callback)(void*,int,char**, char**);
+
+/*
+** CAPI3REF: One-Step Query Execution Interface
+**
+** The sqlite3_exec() interface is a convenience wrapper around
+** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
+** that allows an application to run multiple statements of SQL
+** without having to use a lot of C code. 
+**
+** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
+** semicolon-separate SQL statements passed into its 2nd argument,
+** in the context of the [database connection] passed in as its 1st
+** argument.  ^If the callback function of the 3rd argument to
+** sqlite3_exec() is not NULL, then it is invoked for each result row
+** coming out of the evaluated SQL statements.  ^The 4th argument to
+** sqlite3_exec() is relayed through to the 1st argument of each
+** callback invocation.  ^If the callback pointer to sqlite3_exec()
+** is NULL, then no callback is ever invoked and result rows are
+** ignored.
+**
+** ^If an error occurs while evaluating the SQL statements passed into
+** sqlite3_exec(), then execution of the current statement stops and
+** subsequent statements are skipped.  ^If the 5th parameter to sqlite3_exec()
+** is not NULL then any error message is written into memory obtained
+** from [sqlite3_malloc()] and passed back through the 5th parameter.
+** To avoid memory leaks, the application should invoke [sqlite3_free()]
+** on error message strings returned through the 5th parameter of
+** of sqlite3_exec() after the error message string is no longer needed.
+** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
+** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
+** NULL before returning.
+**
+** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()
+** routine returns SQLITE_ABORT without invoking the callback again and
+** without running any subsequent SQL statements.
+**
+** ^The 2nd argument to the sqlite3_exec() callback function is the
+** number of columns in the result.  ^The 3rd argument to the sqlite3_exec()
+** callback is an array of pointers to strings obtained as if from
+** [sqlite3_column_text()], one for each column.  ^If an element of a
+** result row is NULL then the corresponding string pointer for the
+** sqlite3_exec() callback is a NULL pointer.  ^The 4th argument to the
+** sqlite3_exec() callback is an array of pointers to strings where each
+** entry represents the name of corresponding result column as obtained
+** from [sqlite3_column_name()].
+**
+** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
+** to an empty string, or a pointer that contains only whitespace and/or 
+** SQL comments, then no SQL statements are evaluated and the database
+** is not changed.
+**
+** Restrictions:
+**
+** <ul>
+** <li> The application must insure that the 1st parameter to sqlite3_exec()
+**      is a valid and open [database connection].
+** <li> The application must not close the [database connection] specified by
+**      the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
+** <li> The application must not modify the SQL statement text passed into
+**      the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
+** </ul>
+*/
+SQLITE_API int sqlite3_exec(
+  sqlite3*,                                  /* An open database */
+  const char *sql,                           /* SQL to be evaluated */
+  int (*callback)(void*,int,char**,char**),  /* Callback function */
+  void *,                                    /* 1st argument to callback */
+  char **errmsg                              /* Error msg written here */
+);
+
+/*
+** CAPI3REF: Result Codes
+** KEYWORDS: SQLITE_OK {error code} {error codes}
+** KEYWORDS: {result code} {result codes}
+**
+** Many SQLite functions return an integer result code from the set shown
+** here in order to indicate success or failure.
+**
+** New error codes may be added in future versions of SQLite.
+**
+** See also: [SQLITE_IOERR_READ | extended result codes],
+** [sqlite3_vtab_on_conflict()] [SQLITE_ROLLBACK | result codes].
+*/
+#define SQLITE_OK           0   /* Successful result */
+/* beginning-of-error-codes */
+#define SQLITE_ERROR        1   /* SQL error or missing database */
+#define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */
+#define SQLITE_PERM         3   /* Access permission denied */
+#define SQLITE_ABORT        4   /* Callback routine requested an abort */
+#define SQLITE_BUSY         5   /* The database file is locked */
+#define SQLITE_LOCKED       6   /* A table in the database is locked */
+#define SQLITE_NOMEM        7   /* A malloc() failed */
+#define SQLITE_READONLY     8   /* Attempt to write a readonly database */
+#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/
+#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */
+#define SQLITE_CORRUPT     11   /* The database disk image is malformed */
+#define SQLITE_NOTFOUND    12   /* Unknown opcode in sqlite3_file_control() */
+#define SQLITE_FULL        13   /* Insertion failed because database is full */
+#define SQLITE_CANTOPEN    14   /* Unable to open the database file */
+#define SQLITE_PROTOCOL    15   /* Database lock protocol error */
+#define SQLITE_EMPTY       16   /* Database is empty */
+#define SQLITE_SCHEMA      17   /* The database schema changed */
+#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */
+#define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */
+#define SQLITE_MISMATCH    20   /* Data type mismatch */
+#define SQLITE_MISUSE      21   /* Library used incorrectly */
+#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
+#define SQLITE_AUTH        23   /* Authorization denied */
+#define SQLITE_FORMAT      24   /* Auxiliary database format error */
+#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */
+#define SQLITE_NOTADB      26   /* File opened that is not a database file */
+#define SQLITE_NOTICE      27   /* Notifications from sqlite3_log() */
+#define SQLITE_WARNING     28   /* Warnings from sqlite3_log() */
+#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */
+#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */
+/* end-of-error-codes */
+
+/*
+** CAPI3REF: Extended Result Codes
+** KEYWORDS: {extended error code} {extended error codes}
+** KEYWORDS: {extended result code} {extended result codes}
+**
+** In its default configuration, SQLite API routines return one of 26 integer
+** [SQLITE_OK | result codes].  However, experience has shown that many of
+** these result codes are too coarse-grained.  They do not provide as
+** much information about problems as programmers might like.  In an effort to
+** address this, newer versions of SQLite (version 3.3.8 and later) include
+** support for additional result codes that provide more detailed information
+** about errors. The extended result codes are enabled or disabled
+** on a per database connection basis using the
+** [sqlite3_extended_result_codes()] API.
+**
+** Some of the available extended result codes are listed here.
+** One may expect the number of extended result codes will increase
+** over time.  Software that uses extended result codes should expect
+** to see new result codes in future releases of SQLite.
+**
+** The SQLITE_OK result code will never be extended.  It will always
+** be exactly zero.
+*/
+#define SQLITE_IOERR_READ              (SQLITE_IOERR | (1<<8))
+#define SQLITE_IOERR_SHORT_READ        (SQLITE_IOERR | (2<<8))
+#define SQLITE_IOERR_WRITE             (SQLITE_IOERR | (3<<8))
+#define SQLITE_IOERR_FSYNC             (SQLITE_IOERR | (4<<8))
+#define SQLITE_IOERR_DIR_FSYNC         (SQLITE_IOERR | (5<<8))
+#define SQLITE_IOERR_TRUNCATE          (SQLITE_IOERR | (6<<8))
+#define SQLITE_IOERR_FSTAT             (SQLITE_IOERR | (7<<8))
+#define SQLITE_IOERR_UNLOCK            (SQLITE_IOERR | (8<<8))
+#define SQLITE_IOERR_RDLOCK            (SQLITE_IOERR | (9<<8))
+#define SQLITE_IOERR_DELETE            (SQLITE_IOERR | (10<<8))
+#define SQLITE_IOERR_BLOCKED           (SQLITE_IOERR | (11<<8))
+#define SQLITE_IOERR_NOMEM             (SQLITE_IOERR | (12<<8))
+#define SQLITE_IOERR_ACCESS            (SQLITE_IOERR | (13<<8))
+#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))
+#define SQLITE_IOERR_LOCK              (SQLITE_IOERR | (15<<8))
+#define SQLITE_IOERR_CLOSE             (SQLITE_IOERR | (16<<8))
+#define SQLITE_IOERR_DIR_CLOSE         (SQLITE_IOERR | (17<<8))
+#define SQLITE_IOERR_SHMOPEN           (SQLITE_IOERR | (18<<8))
+#define SQLITE_IOERR_SHMSIZE           (SQLITE_IOERR | (19<<8))
+#define SQLITE_IOERR_SHMLOCK           (SQLITE_IOERR | (20<<8))
+#define SQLITE_IOERR_SHMMAP            (SQLITE_IOERR | (21<<8))
+#define SQLITE_IOERR_SEEK              (SQLITE_IOERR | (22<<8))
+#define SQLITE_IOERR_DELETE_NOENT      (SQLITE_IOERR | (23<<8))
+#define SQLITE_IOERR_MMAP              (SQLITE_IOERR | (24<<8))
+#define SQLITE_IOERR_GETTEMPPATH       (SQLITE_IOERR | (25<<8))
+#define SQLITE_IOERR_CONVPATH          (SQLITE_IOERR | (26<<8))
+#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
+#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
+#define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))
+#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
+#define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
+#define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))
+#define SQLITE_CANTOPEN_CONVPATH       (SQLITE_CANTOPEN | (4<<8))
+#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))
+#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))
+#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))
+#define SQLITE_READONLY_ROLLBACK       (SQLITE_READONLY | (3<<8))
+#define SQLITE_READONLY_DBMOVED        (SQLITE_READONLY | (4<<8))
+#define SQLITE_ABORT_ROLLBACK          (SQLITE_ABORT | (2<<8))
+#define SQLITE_CONSTRAINT_CHECK        (SQLITE_CONSTRAINT | (1<<8))
+#define SQLITE_CONSTRAINT_COMMITHOOK   (SQLITE_CONSTRAINT | (2<<8))
+#define SQLITE_CONSTRAINT_FOREIGNKEY   (SQLITE_CONSTRAINT | (3<<8))
+#define SQLITE_CONSTRAINT_FUNCTION     (SQLITE_CONSTRAINT | (4<<8))
+#define SQLITE_CONSTRAINT_NOTNULL      (SQLITE_CONSTRAINT | (5<<8))
+#define SQLITE_CONSTRAINT_PRIMARYKEY   (SQLITE_CONSTRAINT | (6<<8))
+#define SQLITE_CONSTRAINT_TRIGGER      (SQLITE_CONSTRAINT | (7<<8))
+#define SQLITE_CONSTRAINT_UNIQUE       (SQLITE_CONSTRAINT | (8<<8))
+#define SQLITE_CONSTRAINT_VTAB         (SQLITE_CONSTRAINT | (9<<8))
+#define SQLITE_CONSTRAINT_ROWID        (SQLITE_CONSTRAINT |(10<<8))
+#define SQLITE_NOTICE_RECOVER_WAL      (SQLITE_NOTICE | (1<<8))
+#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
+#define SQLITE_WARNING_AUTOINDEX       (SQLITE_WARNING | (1<<8))
+
+/*
+** CAPI3REF: Flags For File Open Operations
+**
+** These bit values are intended for use in the
+** 3rd parameter to the [sqlite3_open_v2()] interface and
+** in the 4th parameter to the [sqlite3_vfs.xOpen] method.
+*/
+#define SQLITE_OPEN_READONLY         0x00000001  /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_READWRITE        0x00000002  /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_CREATE           0x00000004  /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_DELETEONCLOSE    0x00000008  /* VFS only */
+#define SQLITE_OPEN_EXCLUSIVE        0x00000010  /* VFS only */
+#define SQLITE_OPEN_AUTOPROXY        0x00000020  /* VFS only */
+#define SQLITE_OPEN_URI              0x00000040  /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_MEMORY           0x00000080  /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_MAIN_DB          0x00000100  /* VFS only */
+#define SQLITE_OPEN_TEMP_DB          0x00000200  /* VFS only */
+#define SQLITE_OPEN_TRANSIENT_DB     0x00000400  /* VFS only */
+#define SQLITE_OPEN_MAIN_JOURNAL     0x00000800  /* VFS only */
+#define SQLITE_OPEN_TEMP_JOURNAL     0x00001000  /* VFS only */
+#define SQLITE_OPEN_SUBJOURNAL       0x00002000  /* VFS only */
+#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000  /* VFS only */
+#define SQLITE_OPEN_NOMUTEX          0x00008000  /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_FULLMUTEX        0x00010000  /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_SHAREDCACHE      0x00020000  /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_PRIVATECACHE     0x00040000  /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_WAL              0x00080000  /* VFS only */
+
+/* Reserved:                         0x00F00000 */
+
+/*
+** CAPI3REF: Device Characteristics
+**
+** The xDeviceCharacteristics method of the [sqlite3_io_methods]
+** object returns an integer which is a vector of these
+** bit values expressing I/O characteristics of the mass storage
+** device that holds the file that the [sqlite3_io_methods]
+** refers to.
+**
+** The SQLITE_IOCAP_ATOMIC property means that all writes of
+** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
+** mean that writes of blocks that are nnn bytes in size and
+** are aligned to an address which is an integer multiple of
+** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
+** that when data is appended to a file, the data is appended
+** first then the size of the file is extended, never the other
+** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
+** information is written to disk in the same order as calls
+** to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
+** after reboot following a crash or power loss, the only bytes in a
+** file that were written at the application level might have changed
+** and that adjacent bytes, even bytes within the same sector are
+** guaranteed to be unchanged.  The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
+** flag indicate that a file cannot be deleted when open.
+*/
+#define SQLITE_IOCAP_ATOMIC                 0x00000001
+#define SQLITE_IOCAP_ATOMIC512              0x00000002
+#define SQLITE_IOCAP_ATOMIC1K               0x00000004
+#define SQLITE_IOCAP_ATOMIC2K               0x00000008
+#define SQLITE_IOCAP_ATOMIC4K               0x00000010
+#define SQLITE_IOCAP_ATOMIC8K               0x00000020
+#define SQLITE_IOCAP_ATOMIC16K              0x00000040
+#define SQLITE_IOCAP_ATOMIC32K              0x00000080
+#define SQLITE_IOCAP_ATOMIC64K              0x00000100
+#define SQLITE_IOCAP_SAFE_APPEND            0x00000200
+#define SQLITE_IOCAP_SEQUENTIAL             0x00000400
+#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN  0x00000800
+#define SQLITE_IOCAP_POWERSAFE_OVERWRITE    0x00001000
+
+/*
+** CAPI3REF: File Locking Levels
+**
+** SQLite uses one of these integer values as the second
+** argument to calls it makes to the xLock() and xUnlock() methods
+** of an [sqlite3_io_methods] object.
+*/
+#define SQLITE_LOCK_NONE          0
+#define SQLITE_LOCK_SHARED        1
+#define SQLITE_LOCK_RESERVED      2
+#define SQLITE_LOCK_PENDING       3
+#define SQLITE_LOCK_EXCLUSIVE     4
+
+/*
+** CAPI3REF: Synchronization Type Flags
+**
+** When SQLite invokes the xSync() method of an
+** [sqlite3_io_methods] object it uses a combination of
+** these integer values as the second argument.
+**
+** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
+** sync operation only needs to flush data to mass storage.  Inode
+** information need not be flushed. If the lower four bits of the flag
+** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
+** If the lower four bits equal SQLITE_SYNC_FULL, that means
+** to use Mac OS X style fullsync instead of fsync().
+**
+** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
+** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
+** settings.  The [synchronous pragma] determines when calls to the
+** xSync VFS method occur and applies uniformly across all platforms.
+** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
+** energetic or rigorous or forceful the sync operations are and
+** only make a difference on Mac OSX for the default SQLite code.
+** (Third-party VFS implementations might also make the distinction
+** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
+** operating systems natively supported by SQLite, only Mac OSX
+** cares about the difference.)
+*/
+#define SQLITE_SYNC_NORMAL        0x00002
+#define SQLITE_SYNC_FULL          0x00003
+#define SQLITE_SYNC_DATAONLY      0x00010
+
+/*
+** CAPI3REF: OS Interface Open File Handle
+**
+** An [sqlite3_file] object represents an open file in the 
+** [sqlite3_vfs | OS interface layer].  Individual OS interface
+** implementations will
+** want to subclass this object by appending additional fields
+** for their own use.  The pMethods entry is a pointer to an
+** [sqlite3_io_methods] object that defines methods for performing
+** I/O operations on the open file.
+*/
+typedef struct sqlite3_file sqlite3_file;
+struct sqlite3_file {
+  const struct sqlite3_io_methods *pMethods;  /* Methods for an open file */
+};
+
+/*
+** CAPI3REF: OS Interface File Virtual Methods Object
+**
+** Every file opened by the [sqlite3_vfs.xOpen] method populates an
+** [sqlite3_file] object (or, more commonly, a subclass of the
+** [sqlite3_file] object) with a pointer to an instance of this object.
+** This object defines the methods used to perform various operations
+** against the open file represented by the [sqlite3_file] object.
+**
+** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element 
+** to a non-NULL pointer, then the sqlite3_io_methods.xClose method
+** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed.  The
+** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]
+** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element
+** to NULL.
+**
+** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
+** [SQLITE_SYNC_FULL].  The first choice is the normal fsync().
+** The second choice is a Mac OS X style fullsync.  The [SQLITE_SYNC_DATAONLY]
+** flag may be ORed in to indicate that only the data of the file
+** and not its inode needs to be synced.
+**
+** The integer values to xLock() and xUnlock() are one of
+** <ul>
+** <li> [SQLITE_LOCK_NONE],
+** <li> [SQLITE_LOCK_SHARED],
+** <li> [SQLITE_LOCK_RESERVED],
+** <li> [SQLITE_LOCK_PENDING], or
+** <li> [SQLITE_LOCK_EXCLUSIVE].
+** </ul>
+** xLock() increases the lock. xUnlock() decreases the lock.
+** The xCheckReservedLock() method checks whether any database connection,
+** either in this process or in some other process, is holding a RESERVED,
+** PENDING, or EXCLUSIVE lock on the file.  It returns true
+** if such a lock exists and false otherwise.
+**
+** The xFileControl() method is a generic interface that allows custom
+** VFS implementations to directly control an open file using the
+** [sqlite3_file_control()] interface.  The second "op" argument is an
+** integer opcode.  The third argument is a generic pointer intended to
+** point to a structure that may contain arguments or space in which to
+** write return values.  Potential uses for xFileControl() might be
+** functions to enable blocking locks with timeouts, to change the
+** locking strategy (for example to use dot-file locks), to inquire
+** about the status of a lock, or to break stale locks.  The SQLite
+** core reserves all opcodes less than 100 for its own use.
+** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.
+** Applications that define a custom xFileControl method should use opcodes
+** greater than 100 to avoid conflicts.  VFS implementations should
+** return [SQLITE_NOTFOUND] for file control opcodes that they do not
+** recognize.
+**
+** The xSectorSize() method returns the sector size of the
+** device that underlies the file.  The sector size is the
+** minimum write that can be performed without disturbing
+** other bytes in the file.  The xDeviceCharacteristics()
+** method returns a bit vector describing behaviors of the
+** underlying device:
+**
+** <ul>
+** <li> [SQLITE_IOCAP_ATOMIC]
+** <li> [SQLITE_IOCAP_ATOMIC512]
+** <li> [SQLITE_IOCAP_ATOMIC1K]
+** <li> [SQLITE_IOCAP_ATOMIC2K]
+** <li> [SQLITE_IOCAP_ATOMIC4K]
+** <li> [SQLITE_IOCAP_ATOMIC8K]
+** <li> [SQLITE_IOCAP_ATOMIC16K]
+** <li> [SQLITE_IOCAP_ATOMIC32K]
+** <li> [SQLITE_IOCAP_ATOMIC64K]
+** <li> [SQLITE_IOCAP_SAFE_APPEND]
+** <li> [SQLITE_IOCAP_SEQUENTIAL]
+** </ul>
+**
+** The SQLITE_IOCAP_ATOMIC property means that all writes of
+** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
+** mean that writes of blocks that are nnn bytes in size and
+** are aligned to an address which is an integer multiple of
+** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
+** that when data is appended to a file, the data is appended
+** first then the size of the file is extended, never the other
+** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
+** information is written to disk in the same order as calls
+** to xWrite().
+**
+** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
+** in the unread portions of the buffer with zeros.  A VFS that
+** fails to zero-fill short reads might seem to work.  However,
+** failure to zero-fill short reads will eventually lead to
+** database corruption.
+*/
+typedef struct sqlite3_io_methods sqlite3_io_methods;
+struct sqlite3_io_methods {
+  int iVersion;
+  int (*xClose)(sqlite3_file*);
+  int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
+  int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
+  int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);
+  int (*xSync)(sqlite3_file*, int flags);
+  int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);
+  int (*xLock)(sqlite3_file*, int);
+  int (*xUnlock)(sqlite3_file*, int);
+  int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);
+  int (*xFileControl)(sqlite3_file*, int op, void *pArg);
+  int (*xSectorSize)(sqlite3_file*);
+  int (*xDeviceCharacteristics)(sqlite3_file*);
+  /* Methods above are valid for version 1 */
+  int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
+  int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
+  void (*xShmBarrier)(sqlite3_file*);
+  int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
+  /* Methods above are valid for version 2 */
+  int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp);
+  int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p);
+  /* Methods above are valid for version 3 */
+  /* Additional methods may be added in future releases */
+};
+
+/*
+** CAPI3REF: Standard File Control Opcodes
+**
+** These integer constants are opcodes for the xFileControl method
+** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
+** interface.
+**
+** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This
+** opcode causes the xFileControl method to write the current state of
+** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
+** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
+** into an integer that the pArg argument points to. This capability
+** is used during testing and only needs to be supported when SQLITE_TEST
+** is defined.
+** <ul>
+** <li>[[SQLITE_FCNTL_SIZE_HINT]]
+** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
+** layer a hint of how large the database file will grow to be during the
+** current transaction.  This hint is not guaranteed to be accurate but it
+** is often close.  The underlying VFS might choose to preallocate database
+** file space based on this hint in order to help writes to the database
+** file run faster.
+**
+** <li>[[SQLITE_FCNTL_CHUNK_SIZE]]
+** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
+** extends and truncates the database file in chunks of a size specified
+** by the user. The fourth argument to [sqlite3_file_control()] should 
+** point to an integer (type int) containing the new chunk-size to use
+** for the nominated database. Allocating database file space in large
+** chunks (say 1MB at a time), may reduce file-system fragmentation and
+** improve performance on some systems.
+**
+** <li>[[SQLITE_FCNTL_FILE_POINTER]]
+** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
+** to the [sqlite3_file] object associated with a particular database
+** connection.  See the [sqlite3_file_control()] documentation for
+** additional information.
+**
+** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
+** No longer in use.
+**
+** <li>[[SQLITE_FCNTL_SYNC]]
+** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
+** sent to the VFS immediately before the xSync method is invoked on a
+** database file descriptor. Or, if the xSync method is not invoked 
+** because the user has configured SQLite with 
+** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place 
+** of the xSync method. In most cases, the pointer argument passed with
+** this file-control is NULL. However, if the database file is being synced
+** as part of a multi-database commit, the argument points to a nul-terminated
+** string containing the transactions master-journal file name. VFSes that 
+** do not need this signal should silently ignore this opcode. Applications 
+** should not call [sqlite3_file_control()] with this opcode as doing so may 
+** disrupt the operation of the specialized VFSes that do require it.  
+**
+** <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]]
+** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite
+** and sent to the VFS after a transaction has been committed immediately
+** but before the database is unlocked. VFSes that do not need this signal
+** should silently ignore this opcode. Applications should not call
+** [sqlite3_file_control()] with this opcode as doing so may disrupt the 
+** operation of the specialized VFSes that do require it.  
+**
+** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]
+** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
+** retry counts and intervals for certain disk I/O operations for the
+** windows [VFS] in order to provide robustness in the presence of
+** anti-virus programs.  By default, the windows VFS will retry file read,
+** file write, and file delete operations up to 10 times, with a delay
+** of 25 milliseconds before the first retry and with the delay increasing
+** by an additional 25 milliseconds with each subsequent retry.  This
+** opcode allows these two values (10 retries and 25 milliseconds of delay)
+** to be adjusted.  The values are changed for all database connections
+** within the same process.  The argument is a pointer to an array of two
+** integers where the first integer i the new retry count and the second
+** integer is the delay.  If either integer is negative, then the setting
+** is not changed but instead the prior value of that setting is written
+** into the array entry, allowing the current retry settings to be
+** interrogated.  The zDbName parameter is ignored.
+**
+** <li>[[SQLITE_FCNTL_PERSIST_WAL]]
+** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
+** persistent [WAL | Write Ahead Log] setting.  By default, the auxiliary
+** write ahead log and shared memory files used for transaction control
+** are automatically deleted when the latest connection to the database
+** closes.  Setting persistent WAL mode causes those files to persist after
+** close.  Persisting the files is useful when other processes that do not
+** have write permission on the directory containing the database file want
+** to read the database file, as the WAL and shared memory files must exist
+** in order for the database to be readable.  The fourth parameter to
+** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
+** That integer is 0 to disable persistent WAL mode or 1 to enable persistent
+** WAL mode.  If the integer is -1, then it is overwritten with the current
+** WAL persistence setting.
+**
+** <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]
+** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the
+** persistent "powersafe-overwrite" or "PSOW" setting.  The PSOW setting
+** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the
+** xDeviceCharacteristics methods. The fourth parameter to
+** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
+** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
+** mode.  If the integer is -1, then it is overwritten with the current
+** zero-damage mode setting.
+**
+** <li>[[SQLITE_FCNTL_OVERWRITE]]
+** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening
+** a write transaction to indicate that, unless it is rolled back for some
+** reason, the entire database file will be overwritten by the current 
+** transaction. This is used by VACUUM operations.
+**
+** <li>[[SQLITE_FCNTL_VFSNAME]]
+** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
+** all [VFSes] in the VFS stack.  The names are of all VFS shims and the
+** final bottom-level VFS are written into memory obtained from 
+** [sqlite3_malloc()] and the result is stored in the char* variable
+** that the fourth parameter of [sqlite3_file_control()] points to.
+** The caller is responsible for freeing the memory when done.  As with
+** all file-control actions, there is no guarantee that this will actually
+** do anything.  Callers should initialize the char* variable to a NULL
+** pointer in case this file-control is not implemented.  This file-control
+** is intended for diagnostic use only.
+**
+** <li>[[SQLITE_FCNTL_PRAGMA]]
+** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] 
+** file control is sent to the open [sqlite3_file] object corresponding
+** to the database file to which the pragma statement refers. ^The argument
+** to the [SQLITE_FCNTL_PRAGMA] file control is an array of
+** pointers to strings (char**) in which the second element of the array
+** is the name of the pragma and the third element is the argument to the
+** pragma or NULL if the pragma has no argument.  ^The handler for an
+** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element
+** of the char** argument point to a string obtained from [sqlite3_mprintf()]
+** or the equivalent and that string will become the result of the pragma or
+** the error message if the pragma fails. ^If the
+** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal 
+** [PRAGMA] processing continues.  ^If the [SQLITE_FCNTL_PRAGMA]
+** file control returns [SQLITE_OK], then the parser assumes that the
+** VFS has handled the PRAGMA itself and the parser generates a no-op
+** prepared statement.  ^If the [SQLITE_FCNTL_PRAGMA] file control returns
+** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
+** that the VFS encountered an error while handling the [PRAGMA] and the
+** compilation of the PRAGMA fails with an error.  ^The [SQLITE_FCNTL_PRAGMA]
+** file control occurs at the beginning of pragma statement analysis and so
+** it is able to override built-in [PRAGMA] statements.
+**
+** <li>[[SQLITE_FCNTL_BUSYHANDLER]]
+** ^The [SQLITE_FCNTL_BUSYHANDLER]
+** file-control may be invoked by SQLite on the database file handle
+** shortly after it is opened in order to provide a custom VFS with access
+** to the connections busy-handler callback. The argument is of type (void **)
+** - an array of two (void *) values. The first (void *) actually points
+** to a function of type (int (*)(void *)). In order to invoke the connections
+** busy-handler, this function should be invoked with the second (void *) in
+** the array as the only argument. If it returns non-zero, then the operation
+** should be retried. If it returns zero, the custom VFS should abandon the
+** current operation.
+**
+** <li>[[SQLITE_FCNTL_TEMPFILENAME]]
+** ^Application can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
+** to have SQLite generate a
+** temporary filename using the same algorithm that is followed to generate
+** temporary filenames for TEMP tables and other internal uses.  The
+** argument should be a char** which will be filled with the filename
+** written into memory obtained from [sqlite3_malloc()].  The caller should
+** invoke [sqlite3_free()] on the result to avoid a memory leak.
+**
+** <li>[[SQLITE_FCNTL_MMAP_SIZE]]
+** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the
+** maximum number of bytes that will be used for memory-mapped I/O.
+** The argument is a pointer to a value of type sqlite3_int64 that
+** is an advisory maximum number of bytes in the file to memory map.  The
+** pointer is overwritten with the old value.  The limit is not changed if
+** the value originally pointed to is negative, and so the current limit 
+** can be queried by passing in a pointer to a negative number.  This
+** file-control is used internally to implement [PRAGMA mmap_size].
+**
+** <li>[[SQLITE_FCNTL_TRACE]]
+** The [SQLITE_FCNTL_TRACE] file control provides advisory information
+** to the VFS about what the higher layers of the SQLite stack are doing.
+** This file control is used by some VFS activity tracing [shims].
+** The argument is a zero-terminated string.  Higher layers in the
+** SQLite stack may generate instances of this file control if
+** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.
+**
+** <li>[[SQLITE_FCNTL_HAS_MOVED]]
+** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a
+** pointer to an integer and it writes a boolean into that integer depending
+** on whether or not the file has been renamed, moved, or deleted since it
+** was first opened.
+**
+** </ul>
+*/
+#define SQLITE_FCNTL_LOCKSTATE               1
+#define SQLITE_GET_LOCKPROXYFILE             2
+#define SQLITE_SET_LOCKPROXYFILE             3
+#define SQLITE_LAST_ERRNO                    4
+#define SQLITE_FCNTL_SIZE_HINT               5
+#define SQLITE_FCNTL_CHUNK_SIZE              6
+#define SQLITE_FCNTL_FILE_POINTER            7
+#define SQLITE_FCNTL_SYNC_OMITTED            8
+#define SQLITE_FCNTL_WIN32_AV_RETRY          9
+#define SQLITE_FCNTL_PERSIST_WAL            10
+#define SQLITE_FCNTL_OVERWRITE              11
+#define SQLITE_FCNTL_VFSNAME                12
+#define SQLITE_FCNTL_POWERSAFE_OVERWRITE    13
+#define SQLITE_FCNTL_PRAGMA                 14
+#define SQLITE_FCNTL_BUSYHANDLER            15
+#define SQLITE_FCNTL_TEMPFILENAME           16
+#define SQLITE_FCNTL_MMAP_SIZE              18
+#define SQLITE_FCNTL_TRACE                  19
+#define SQLITE_FCNTL_HAS_MOVED              20
+#define SQLITE_FCNTL_SYNC                   21
+#define SQLITE_FCNTL_COMMIT_PHASETWO        22
+
+/*
+** CAPI3REF: Mutex Handle
+**
+** The mutex module within SQLite defines [sqlite3_mutex] to be an
+** abstract type for a mutex object.  The SQLite core never looks
+** at the internal representation of an [sqlite3_mutex].  It only
+** deals with pointers to the [sqlite3_mutex] object.
+**
+** Mutexes are created using [sqlite3_mutex_alloc()].
+*/
+typedef struct sqlite3_mutex sqlite3_mutex;
+
+/*
+** CAPI3REF: OS Interface Object
+**
+** An instance of the sqlite3_vfs object defines the interface between
+** the SQLite core and the underlying operating system.  The "vfs"
+** in the name of the object stands for "virtual file system".  See
+** the [VFS | VFS documentation] for further information.
+**
+** The value of the iVersion field is initially 1 but may be larger in
+** future versions of SQLite.  Additional fields may be appended to this
+** object when the iVersion value is increased.  Note that the structure
+** of the sqlite3_vfs object changes in the transaction between
+** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not
+** modified.
+**
+** The szOsFile field is the size of the subclassed [sqlite3_file]
+** structure used by this VFS.  mxPathname is the maximum length of
+** a pathname in this VFS.
+**
+** Registered sqlite3_vfs objects are kept on a linked list formed by
+** the pNext pointer.  The [sqlite3_vfs_register()]
+** and [sqlite3_vfs_unregister()] interfaces manage this list
+** in a thread-safe way.  The [sqlite3_vfs_find()] interface
+** searches the list.  Neither the application code nor the VFS
+** implementation should use the pNext pointer.
+**
+** The pNext field is the only field in the sqlite3_vfs
+** structure that SQLite will ever modify.  SQLite will only access
+** or modify this field while holding a particular static mutex.
+** The application should never modify anything within the sqlite3_vfs
+** object once the object has been registered.
+**
+** The zName field holds the name of the VFS module.  The name must
+** be unique across all VFS modules.
+**
+** [[sqlite3_vfs.xOpen]]
+** ^SQLite guarantees that the zFilename parameter to xOpen
+** is either a NULL pointer or string obtained
+** from xFullPathname() with an optional suffix added.
+** ^If a suffix is added to the zFilename parameter, it will
+** consist of a single "-" character followed by no more than
+** 11 alphanumeric and/or "-" characters.
+** ^SQLite further guarantees that
+** the string will be valid and unchanged until xClose() is
+** called. Because of the previous sentence,
+** the [sqlite3_file] can safely store a pointer to the
+** filename if it needs to remember the filename for some reason.
+** If the zFilename parameter to xOpen is a NULL pointer then xOpen
+** must invent its own temporary name for the file.  ^Whenever the 
+** xFilename parameter is NULL it will also be the case that the
+** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
+**
+** The flags argument to xOpen() includes all bits set in
+** the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
+** or [sqlite3_open16()] is used, then flags includes at least
+** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. 
+** If xOpen() opens a file read-only then it sets *pOutFlags to
+** include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.
+**
+** ^(SQLite will also add one of the following flags to the xOpen()
+** call, depending on the object being opened:
+**
+** <ul>
+** <li>  [SQLITE_OPEN_MAIN_DB]
+** <li>  [SQLITE_OPEN_MAIN_JOURNAL]
+** <li>  [SQLITE_OPEN_TEMP_DB]
+** <li>  [SQLITE_OPEN_TEMP_JOURNAL]
+** <li>  [SQLITE_OPEN_TRANSIENT_DB]
+** <li>  [SQLITE_OPEN_SUBJOURNAL]
+** <li>  [SQLITE_OPEN_MASTER_JOURNAL]
+** <li>  [SQLITE_OPEN_WAL]
+** </ul>)^
+**
+** The file I/O implementation can use the object type flags to
+** change the way it deals with files.  For example, an application
+** that does not care about crash recovery or rollback might make
+** the open of a journal file a no-op.  Writes to this journal would
+** also be no-ops, and any attempt to read the journal would return
+** SQLITE_IOERR.  Or the implementation might recognize that a database
+** file will be doing page-aligned sector reads and writes in a random
+** order and set up its I/O subsystem accordingly.
+**
+** SQLite might also add one of the following flags to the xOpen method:
+**
+** <ul>
+** <li> [SQLITE_OPEN_DELETEONCLOSE]
+** <li> [SQLITE_OPEN_EXCLUSIVE]
+** </ul>
+**
+** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
+** deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]
+** will be set for TEMP databases and their journals, transient
+** databases, and subjournals.
+**
+** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
+** with the [SQLITE_OPEN_CREATE] flag, which are both directly
+** analogous to the O_EXCL and O_CREAT flags of the POSIX open()
+** API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the 
+** SQLITE_OPEN_CREATE, is used to indicate that file should always
+** be created, and that it is an error if it already exists.
+** It is <i>not</i> used to indicate the file should be opened 
+** for exclusive access.
+**
+** ^At least szOsFile bytes of memory are allocated by SQLite
+** to hold the  [sqlite3_file] structure passed as the third
+** argument to xOpen.  The xOpen method does not have to
+** allocate the structure; it should just fill it in.  Note that
+** the xOpen method must set the sqlite3_file.pMethods to either
+** a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
+** this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
+** element will be valid after xOpen returns regardless of the success
+** or failure of the xOpen call.
+**
+** [[sqlite3_vfs.xAccess]]
+** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
+** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
+** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
+** to test whether a file is at least readable.   The file can be a
+** directory.
+**
+** ^SQLite will always allocate at least mxPathname+1 bytes for the
+** output buffer xFullPathname.  The exact size of the output buffer
+** is also passed as a parameter to both  methods. If the output buffer
+** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
+** handled as a fatal error by SQLite, vfs implementations should endeavor
+** to prevent this by setting mxPathname to a sufficiently large value.
+**
+** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
+** interfaces are not strictly a part of the filesystem, but they are
+** included in the VFS structure for completeness.
+** The xRandomness() function attempts to return nBytes bytes
+** of good-quality randomness into zOut.  The return value is
+** the actual number of bytes of randomness obtained.
+** The xSleep() method causes the calling thread to sleep for at
+** least the number of microseconds given.  ^The xCurrentTime()
+** method returns a Julian Day Number for the current date and time as
+** a floating point value.
+** ^The xCurrentTimeInt64() method returns, as an integer, the Julian
+** Day Number multiplied by 86400000 (the number of milliseconds in 
+** a 24-hour day).  
+** ^SQLite will use the xCurrentTimeInt64() method to get the current
+** date and time if that method is available (if iVersion is 2 or 
+** greater and the function pointer is not NULL) and will fall back
+** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
+**
+** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
+** are not used by the SQLite core.  These optional interfaces are provided
+** by some VFSes to facilitate testing of the VFS code. By overriding 
+** system calls with functions under its control, a test program can
+** simulate faults and error conditions that would otherwise be difficult
+** or impossible to induce.  The set of system calls that can be overridden
+** varies from one VFS to another, and from one version of the same VFS to the
+** next.  Applications that use these interfaces must be prepared for any
+** or all of these interfaces to be NULL or for their behavior to change
+** from one release to the next.  Applications must not attempt to access
+** any of these methods if the iVersion of the VFS is less than 3.
+*/
+typedef struct sqlite3_vfs sqlite3_vfs;
+typedef void (*sqlite3_syscall_ptr)(void);
+struct sqlite3_vfs {
+  int iVersion;            /* Structure version number (currently 3) */
+  int szOsFile;            /* Size of subclassed sqlite3_file */
+  int mxPathname;          /* Maximum file pathname length */
+  sqlite3_vfs *pNext;      /* Next registered VFS */
+  const char *zName;       /* Name of this virtual file system */
+  void *pAppData;          /* Pointer to application-specific data */
+  int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,
+               int flags, int *pOutFlags);
+  int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
+  int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
+  int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);
+  void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);
+  void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
+  void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);
+  void (*xDlClose)(sqlite3_vfs*, void*);
+  int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
+  int (*xSleep)(sqlite3_vfs*, int microseconds);
+  int (*xCurrentTime)(sqlite3_vfs*, double*);
+  int (*xGetLastError)(sqlite3_vfs*, int, char *);
+  /*
+  ** The methods above are in version 1 of the sqlite_vfs object
+  ** definition.  Those that follow are added in version 2 or later
+  */
+  int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
+  /*
+  ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
+  ** Those below are for version 3 and greater.
+  */
+  int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);
+  sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);
+  const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
+  /*
+  ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
+  ** New fields may be appended in figure versions.  The iVersion
+  ** value will increment whenever this happens. 
+  */
+};
+
+/*
+** CAPI3REF: Flags for the xAccess VFS method
+**
+** These integer constants can be used as the third parameter to
+** the xAccess method of an [sqlite3_vfs] object.  They determine
+** what kind of permissions the xAccess method is looking for.
+** With SQLITE_ACCESS_EXISTS, the xAccess method
+** simply checks whether the file exists.
+** With SQLITE_ACCESS_READWRITE, the xAccess method
+** checks whether the named directory is both readable and writable
+** (in other words, if files can be added, removed, and renamed within
+** the directory).
+** The SQLITE_ACCESS_READWRITE constant is currently used only by the
+** [temp_store_directory pragma], though this could change in a future
+** release of SQLite.
+** With SQLITE_ACCESS_READ, the xAccess method
+** checks whether the file is readable.  The SQLITE_ACCESS_READ constant is
+** currently unused, though it might be used in a future release of
+** SQLite.
+*/
+#define SQLITE_ACCESS_EXISTS    0
+#define SQLITE_ACCESS_READWRITE 1   /* Used by PRAGMA temp_store_directory */
+#define SQLITE_ACCESS_READ      2   /* Unused */
+
+/*
+** CAPI3REF: Flags for the xShmLock VFS method
+**
+** These integer constants define the various locking operations
+** allowed by the xShmLock method of [sqlite3_io_methods].  The
+** following are the only legal combinations of flags to the
+** xShmLock method:
+**
+** <ul>
+** <li>  SQLITE_SHM_LOCK | SQLITE_SHM_SHARED
+** <li>  SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE
+** <li>  SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
+** <li>  SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
+** </ul>
+**
+** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
+** was given no the corresponding lock.  
+**
+** The xShmLock method can transition between unlocked and SHARED or
+** between unlocked and EXCLUSIVE.  It cannot transition between SHARED
+** and EXCLUSIVE.
+*/
+#define SQLITE_SHM_UNLOCK       1
+#define SQLITE_SHM_LOCK         2
+#define SQLITE_SHM_SHARED       4
+#define SQLITE_SHM_EXCLUSIVE    8
+
+/*
+** CAPI3REF: Maximum xShmLock index
+**
+** The xShmLock method on [sqlite3_io_methods] may use values
+** between 0 and this upper bound as its "offset" argument.
+** The SQLite core will never attempt to acquire or release a
+** lock outside of this range
+*/
+#define SQLITE_SHM_NLOCK        8
+
+
+/*
+** CAPI3REF: Initialize The SQLite Library
+**
+** ^The sqlite3_initialize() routine initializes the
+** SQLite library.  ^The sqlite3_shutdown() routine
+** deallocates any resources that were allocated by sqlite3_initialize().
+** These routines are designed to aid in process initialization and
+** shutdown on embedded systems.  Workstation applications using
+** SQLite normally do not need to invoke either of these routines.
+**
+** A call to sqlite3_initialize() is an "effective" call if it is
+** the first time sqlite3_initialize() is invoked during the lifetime of
+** the process, or if it is the first time sqlite3_initialize() is invoked
+** following a call to sqlite3_shutdown().  ^(Only an effective call
+** of sqlite3_initialize() does any initialization.  All other calls
+** are harmless no-ops.)^
+**
+** A call to sqlite3_shutdown() is an "effective" call if it is the first
+** call to sqlite3_shutdown() since the last sqlite3_initialize().  ^(Only
+** an effective call to sqlite3_shutdown() does any deinitialization.
+** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^
+**
+** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()
+** is not.  The sqlite3_shutdown() interface must only be called from a
+** single thread.  All open [database connections] must be closed and all
+** other SQLite resources must be deallocated prior to invoking
+** sqlite3_shutdown().
+**
+** Among other things, ^sqlite3_initialize() will invoke
+** sqlite3_os_init().  Similarly, ^sqlite3_shutdown()
+** will invoke sqlite3_os_end().
+**
+** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success.
+** ^If for some reason, sqlite3_initialize() is unable to initialize
+** the library (perhaps it is unable to allocate a needed resource such
+** as a mutex) it returns an [error code] other than [SQLITE_OK].
+**
+** ^The sqlite3_initialize() routine is called internally by many other
+** SQLite interfaces so that an application usually does not need to
+** invoke sqlite3_initialize() directly.  For example, [sqlite3_open()]
+** calls sqlite3_initialize() so the SQLite library will be automatically
+** initialized when [sqlite3_open()] is called if it has not be initialized
+** already.  ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
+** compile-time option, then the automatic calls to sqlite3_initialize()
+** are omitted and the application must call sqlite3_initialize() directly
+** prior to using any other SQLite interface.  For maximum portability,
+** it is recommended that applications always invoke sqlite3_initialize()
+** directly prior to using any other SQLite interface.  Future releases
+** of SQLite may require this.  In other words, the behavior exhibited
+** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the
+** default behavior in some future release of SQLite.
+**
+** The sqlite3_os_init() routine does operating-system specific
+** initialization of the SQLite library.  The sqlite3_os_end()
+** routine undoes the effect of sqlite3_os_init().  Typical tasks
+** performed by these routines include allocation or deallocation
+** of static resources, initialization of global variables,
+** setting up a default [sqlite3_vfs] module, or setting up
+** a default configuration using [sqlite3_config()].
+**
+** The application should never invoke either sqlite3_os_init()
+** or sqlite3_os_end() directly.  The application should only invoke
+** sqlite3_initialize() and sqlite3_shutdown().  The sqlite3_os_init()
+** interface is called automatically by sqlite3_initialize() and
+** sqlite3_os_end() is called by sqlite3_shutdown().  Appropriate
+** implementations for sqlite3_os_init() and sqlite3_os_end()
+** are built into SQLite when it is compiled for Unix, Windows, or OS/2.
+** When [custom builds | built for other platforms]
+** (using the [SQLITE_OS_OTHER=1] compile-time
+** option) the application must supply a suitable implementation for
+** sqlite3_os_init() and sqlite3_os_end().  An application-supplied
+** implementation of sqlite3_os_init() or sqlite3_os_end()
+** must return [SQLITE_OK] on success and some other [error code] upon
+** failure.
+*/
+SQLITE_API int sqlite3_initialize(void);
+SQLITE_API int sqlite3_shutdown(void);
+SQLITE_API int sqlite3_os_init(void);
+SQLITE_API int sqlite3_os_end(void);
+
+/*
+** CAPI3REF: Configuring The SQLite Library
+**
+** The sqlite3_config() interface is used to make global configuration
+** changes to SQLite in order to tune SQLite to the specific needs of
+** the application.  The default configuration is recommended for most
+** applications and so this routine is usually not necessary.  It is
+** provided to support rare applications with unusual needs.
+**
+** The sqlite3_config() interface is not threadsafe.  The application
+** must insure that no other SQLite interfaces are invoked by other
+** threads while sqlite3_config() is running.  Furthermore, sqlite3_config()
+** may only be invoked prior to library initialization using
+** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
+** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
+** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
+** Note, however, that ^sqlite3_config() can be called as part of the
+** implementation of an application-defined [sqlite3_os_init()].
+**
+** The first argument to sqlite3_config() is an integer
+** [configuration option] that determines
+** what property of SQLite is to be configured.  Subsequent arguments
+** vary depending on the [configuration option]
+** in the first argument.
+**
+** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
+** ^If the option is unknown or SQLite is unable to set the option
+** then this routine returns a non-zero [error code].
+*/
+SQLITE_API int sqlite3_config(int, ...);
+
+/*
+** CAPI3REF: Configure database connections
+**
+** The sqlite3_db_config() interface is used to make configuration
+** changes to a [database connection].  The interface is similar to
+** [sqlite3_config()] except that the changes apply to a single
+** [database connection] (specified in the first argument).
+**
+** The second argument to sqlite3_db_config(D,V,...)  is the
+** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code 
+** that indicates what aspect of the [database connection] is being configured.
+** Subsequent arguments vary depending on the configuration verb.
+**
+** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
+** the call is considered successful.
+*/
+SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
+
+/*
+** CAPI3REF: Memory Allocation Routines
+**
+** An instance of this object defines the interface between SQLite
+** and low-level memory allocation routines.
+**
+** This object is used in only one place in the SQLite interface.
+** A pointer to an instance of this object is the argument to
+** [sqlite3_config()] when the configuration option is
+** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].  
+** By creating an instance of this object
+** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
+** during configuration, an application can specify an alternative
+** memory allocation subsystem for SQLite to use for all of its
+** dynamic memory needs.
+**
+** Note that SQLite comes with several [built-in memory allocators]
+** that are perfectly adequate for the overwhelming majority of applications
+** and that this object is only useful to a tiny minority of applications
+** with specialized memory allocation requirements.  This object is
+** also used during testing of SQLite in order to specify an alternative
+** memory allocator that simulates memory out-of-memory conditions in
+** order to verify that SQLite recovers gracefully from such
+** conditions.
+**
+** The xMalloc, xRealloc, and xFree methods must work like the
+** malloc(), realloc() and free() functions from the standard C library.
+** ^SQLite guarantees that the second argument to
+** xRealloc is always a value returned by a prior call to xRoundup.
+**
+** xSize should return the allocated size of a memory allocation
+** previously obtained from xMalloc or xRealloc.  The allocated size
+** is always at least as big as the requested size but may be larger.
+**
+** The xRoundup method returns what would be the allocated size of
+** a memory allocation given a particular requested size.  Most memory
+** allocators round up memory allocations at least to the next multiple
+** of 8.  Some allocators round up to a larger multiple or to a power of 2.
+** Every memory allocation request coming in through [sqlite3_malloc()]
+** or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0, 
+** that causes the corresponding memory allocation to fail.
+**
+** The xInit method initializes the memory allocator.  For example,
+** it might allocate any require mutexes or initialize internal data
+** structures.  The xShutdown method is invoked (indirectly) by
+** [sqlite3_shutdown()] and should deallocate any resources acquired
+** by xInit.  The pAppData pointer is used as the only parameter to
+** xInit and xShutdown.
+**
+** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes
+** the xInit method, so the xInit method need not be threadsafe.  The
+** xShutdown method is only called from [sqlite3_shutdown()] so it does
+** not need to be threadsafe either.  For all other methods, SQLite
+** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
+** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
+** it is by default) and so the methods are automatically serialized.
+** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
+** methods must be threadsafe or else make their own arrangements for
+** serialization.
+**
+** SQLite will never invoke xInit() more than once without an intervening
+** call to xShutdown().
+*/
+typedef struct sqlite3_mem_methods sqlite3_mem_methods;
+struct sqlite3_mem_methods {
+  void *(*xMalloc)(int);         /* Memory allocation function */
+  void (*xFree)(void*);          /* Free a prior allocation */
+  void *(*xRealloc)(void*,int);  /* Resize an allocation */
+  int (*xSize)(void*);           /* Return the size of an allocation */
+  int (*xRoundup)(int);          /* Round up request size to allocation size */
+  int (*xInit)(void*);           /* Initialize the memory allocator */
+  void (*xShutdown)(void*);      /* Deinitialize the memory allocator */
+  void *pAppData;                /* Argument to xInit() and xShutdown() */
+};
+
+/*
+** CAPI3REF: Configuration Options
+** KEYWORDS: {configuration option}
+**
+** These constants are the available integer configuration options that
+** can be passed as the first argument to the [sqlite3_config()] interface.
+**
+** New configuration options may be added in future releases of SQLite.
+** Existing configuration options might be discontinued.  Applications
+** should check the return code from [sqlite3_config()] to make sure that
+** the call worked.  The [sqlite3_config()] interface will return a
+** non-zero [error code] if a discontinued or unsupported configuration option
+** is invoked.
+**
+** <dl>
+** [[SQLITE_CONFIG_SINGLETHREAD]] <dt>SQLITE_CONFIG_SINGLETHREAD</dt>
+** <dd>There are no arguments to this option.  ^This option sets the
+** [threading mode] to Single-thread.  In other words, it disables
+** all mutexing and puts SQLite into a mode where it can only be used
+** by a single thread.   ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** it is not possible to change the [threading mode] from its default
+** value of Single-thread and so [sqlite3_config()] will return 
+** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD
+** configuration option.</dd>
+**
+** [[SQLITE_CONFIG_MULTITHREAD]] <dt>SQLITE_CONFIG_MULTITHREAD</dt>
+** <dd>There are no arguments to this option.  ^This option sets the
+** [threading mode] to Multi-thread.  In other words, it disables
+** mutexing on [database connection] and [prepared statement] objects.
+** The application is responsible for serializing access to
+** [database connections] and [prepared statements].  But other mutexes
+** are enabled so that SQLite will be safe to use in a multi-threaded
+** environment as long as no two threads attempt to use the same
+** [database connection] at the same time.  ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** it is not possible to set the Multi-thread [threading mode] and
+** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
+** SQLITE_CONFIG_MULTITHREAD configuration option.</dd>
+**
+** [[SQLITE_CONFIG_SERIALIZED]] <dt>SQLITE_CONFIG_SERIALIZED</dt>
+** <dd>There are no arguments to this option.  ^This option sets the
+** [threading mode] to Serialized. In other words, this option enables
+** all mutexes including the recursive
+** mutexes on [database connection] and [prepared statement] objects.
+** In this mode (which is the default when SQLite is compiled with
+** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access
+** to [database connections] and [prepared statements] so that the
+** application is free to use the same [database connection] or the
+** same [prepared statement] in different threads at the same time.
+** ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** it is not possible to set the Serialized [threading mode] and
+** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
+** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
+**
+** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
+** <dd> ^(This option takes a single argument which is a pointer to an
+** instance of the [sqlite3_mem_methods] structure.  The argument specifies
+** alternative low-level memory allocation routines to be used in place of
+** the memory allocation routines built into SQLite.)^ ^SQLite makes
+** its own private copy of the content of the [sqlite3_mem_methods] structure
+** before the [sqlite3_config()] call returns.</dd>
+**
+** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
+** <dd> ^(This option takes a single argument which is a pointer to an
+** instance of the [sqlite3_mem_methods] structure.  The [sqlite3_mem_methods]
+** structure is filled with the currently defined memory allocation routines.)^
+** This option can be used to overload the default memory allocation
+** routines with a wrapper that simulations memory allocation failure or
+** tracks memory usage, for example. </dd>
+**
+** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
+** <dd> ^This option takes single argument of type int, interpreted as a 
+** boolean, which enables or disables the collection of memory allocation 
+** statistics. ^(When memory allocation statistics are disabled, the 
+** following SQLite interfaces become non-operational:
+**   <ul>
+**   <li> [sqlite3_memory_used()]
+**   <li> [sqlite3_memory_highwater()]
+**   <li> [sqlite3_soft_heap_limit64()]
+**   <li> [sqlite3_status()]
+**   </ul>)^
+** ^Memory allocation statistics are enabled by default unless SQLite is
+** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
+** allocation statistics are disabled by default.
+** </dd>
+**
+** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
+** <dd> ^This option specifies a static memory buffer that SQLite can use for
+** scratch memory.  There are three arguments:  A pointer an 8-byte
+** aligned memory buffer from which the scratch allocations will be
+** drawn, the size of each scratch allocation (sz),
+** and the maximum number of scratch allocations (N).  The sz
+** argument must be a multiple of 16.
+** The first argument must be a pointer to an 8-byte aligned buffer
+** of at least sz*N bytes of memory.
+** ^SQLite will use no more than two scratch buffers per thread.  So
+** N should be set to twice the expected maximum number of threads.
+** ^SQLite will never require a scratch buffer that is more than 6
+** times the database page size. ^If SQLite needs needs additional
+** scratch memory beyond what is provided by this configuration option, then 
+** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
+**
+** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
+** <dd> ^This option specifies a static memory buffer that SQLite can use for
+** the database page cache with the default page cache implementation.  
+** This configuration should not be used if an application-define page
+** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option.
+** There are three arguments to this option: A pointer to 8-byte aligned
+** memory, the size of each page buffer (sz), and the number of pages (N).
+** The sz argument should be the size of the largest database page
+** (a power of two between 512 and 32768) plus a little extra for each
+** page header.  ^The page header size is 20 to 40 bytes depending on
+** the host architecture.  ^It is harmless, apart from the wasted memory,
+** to make sz a little too large.  The first
+** argument should point to an allocation of at least sz*N bytes of memory.
+** ^SQLite will use the memory provided by the first argument to satisfy its
+** memory needs for the first N pages that it adds to cache.  ^If additional
+** page cache memory is needed beyond what is provided by this option, then
+** SQLite goes to [sqlite3_malloc()] for the additional storage space.
+** The pointer in the first argument must
+** be aligned to an 8-byte boundary or subsequent behavior of SQLite
+** will be undefined.</dd>
+**
+** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
+** <dd> ^This option specifies a static memory buffer that SQLite will use
+** for all of its dynamic memory allocation needs beyond those provided
+** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
+** There are three arguments: An 8-byte aligned pointer to the memory,
+** the number of bytes in the memory buffer, and the minimum allocation size.
+** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
+** to using its default memory allocator (the system malloc() implementation),
+** undoing any prior invocation of [SQLITE_CONFIG_MALLOC].  ^If the
+** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
+** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
+** allocator is engaged to handle all of SQLites memory allocation needs.
+** The first pointer (the memory pointer) must be aligned to an 8-byte
+** boundary or subsequent behavior of SQLite will be undefined.
+** The minimum allocation size is capped at 2**12. Reasonable values
+** for the minimum allocation size are 2**5 through 2**8.</dd>
+**
+** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
+** <dd> ^(This option takes a single argument which is a pointer to an
+** instance of the [sqlite3_mutex_methods] structure.  The argument specifies
+** alternative low-level mutex routines to be used in place
+** the mutex routines built into SQLite.)^  ^SQLite makes a copy of the
+** content of the [sqlite3_mutex_methods] structure before the call to
+** [sqlite3_config()] returns. ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** the entire mutexing subsystem is omitted from the build and hence calls to
+** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
+** return [SQLITE_ERROR].</dd>
+**
+** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
+** <dd> ^(This option takes a single argument which is a pointer to an
+** instance of the [sqlite3_mutex_methods] structure.  The
+** [sqlite3_mutex_methods]
+** structure is filled with the currently defined mutex routines.)^
+** This option can be used to overload the default mutex allocation
+** routines with a wrapper used to track mutex usage for performance
+** profiling or testing, for example.   ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** the entire mutexing subsystem is omitted from the build and hence calls to
+** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
+** return [SQLITE_ERROR].</dd>
+**
+** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
+** <dd> ^(This option takes two arguments that determine the default
+** memory allocation for the lookaside memory allocator on each
+** [database connection].  The first argument is the
+** size of each lookaside buffer slot and the second is the number of
+** slots allocated to each database connection.)^  ^(This option sets the
+** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
+** verb to [sqlite3_db_config()] can be used to change the lookaside
+** configuration on individual connections.)^ </dd>
+**
+** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
+** <dd> ^(This option takes a single argument which is a pointer to
+** an [sqlite3_pcache_methods2] object.  This object specifies the interface
+** to a custom page cache implementation.)^  ^SQLite makes a copy of the
+** object and uses it for page cache memory allocations.</dd>
+**
+** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
+** <dd> ^(This option takes a single argument which is a pointer to an
+** [sqlite3_pcache_methods2] object.  SQLite copies of the current
+** page cache implementation into that object.)^ </dd>
+**
+** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
+** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
+** global [error log].
+** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
+** function with a call signature of void(*)(void*,int,const char*), 
+** and a pointer to void. ^If the function pointer is not NULL, it is
+** invoked by [sqlite3_log()] to process each logging event.  ^If the
+** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op.
+** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is
+** passed through as the first parameter to the application-defined logger
+** function whenever that function is invoked.  ^The second parameter to
+** the logger function is a copy of the first parameter to the corresponding
+** [sqlite3_log()] call and is intended to be a [result code] or an
+** [extended result code].  ^The third parameter passed to the logger is
+** log message after formatting via [sqlite3_snprintf()].
+** The SQLite logging interface is not reentrant; the logger function
+** supplied by the application must not invoke any SQLite interface.
+** In a multi-threaded application, the application-defined logger
+** function must be threadsafe. </dd>
+**
+** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
+** <dd>^(This option takes a single argument of type int. If non-zero, then
+** URI handling is globally enabled. If the parameter is zero, then URI handling
+** is globally disabled.)^ ^If URI handling is globally enabled, all filenames
+** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or
+** specified as part of [ATTACH] commands are interpreted as URIs, regardless
+** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
+** connection is opened. ^If it is globally disabled, filenames are
+** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
+** database connection is opened. ^(By default, URI handling is globally
+** disabled. The default value may be changed by compiling with the
+** [SQLITE_USE_URI] symbol defined.)^
+**
+** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
+** <dd>^This option takes a single integer argument which is interpreted as
+** a boolean in order to enable or disable the use of covering indices for
+** full table scans in the query optimizer.  ^The default setting is determined
+** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
+** if that compile-time option is omitted.
+** The ability to disable the use of covering indices for full table scans
+** is because some incorrectly coded legacy applications might malfunction
+** when the optimization is enabled.  Providing the ability to
+** disable the optimization allows the older, buggy application code to work
+** without change even with newer versions of SQLite.
+**
+** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]]
+** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE
+** <dd> These options are obsolete and should not be used by new code.
+** They are retained for backwards compatibility but are now no-ops.
+** </dd>
+**
+** [[SQLITE_CONFIG_SQLLOG]]
+** <dt>SQLITE_CONFIG_SQLLOG
+** <dd>This option is only available if sqlite is compiled with the
+** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should
+** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int).
+** The second should be of type (void*). The callback is invoked by the library
+** in three separate circumstances, identified by the value passed as the
+** fourth parameter. If the fourth parameter is 0, then the database connection
+** passed as the second argument has just been opened. The third argument
+** points to a buffer containing the name of the main database file. If the
+** fourth parameter is 1, then the SQL statement that the third parameter
+** points to has just been executed. Or, if the fourth parameter is 2, then
+** the connection being passed as the second parameter is being closed. The
+** third parameter is passed NULL In this case.  An example of using this
+** configuration option can be seen in the "test_sqllog.c" source file in
+** the canonical SQLite source tree.</dd>
+**
+** [[SQLITE_CONFIG_MMAP_SIZE]]
+** <dt>SQLITE_CONFIG_MMAP_SIZE
+** <dd>^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values
+** that are the default mmap size limit (the default setting for
+** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
+** ^The default setting can be overridden by each database connection using
+** either the [PRAGMA mmap_size] command, or by using the
+** [SQLITE_FCNTL_MMAP_SIZE] file control.  ^(The maximum allowed mmap size
+** cannot be changed at run-time.  Nor may the maximum allowed mmap size
+** exceed the compile-time maximum mmap size set by the
+** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
+** ^If either argument to this option is negative, then that argument is
+** changed to its compile-time default.
+**
+** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
+** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
+** <dd>^This option is only available if SQLite is compiled for Windows
+** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined.
+** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
+** that specifies the maximum size of the created heap.
+** </dl>
+*/
+#define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */
+#define SQLITE_CONFIG_MULTITHREAD   2  /* nil */
+#define SQLITE_CONFIG_SERIALIZED    3  /* nil */
+#define SQLITE_CONFIG_MALLOC        4  /* sqlite3_mem_methods* */
+#define SQLITE_CONFIG_GETMALLOC     5  /* sqlite3_mem_methods* */
+#define SQLITE_CONFIG_SCRATCH       6  /* void*, int sz, int N */
+#define SQLITE_CONFIG_PAGECACHE     7  /* void*, int sz, int N */
+#define SQLITE_CONFIG_HEAP          8  /* void*, int nByte, int min */
+#define SQLITE_CONFIG_MEMSTATUS     9  /* boolean */
+#define SQLITE_CONFIG_MUTEX        10  /* sqlite3_mutex_methods* */
+#define SQLITE_CONFIG_GETMUTEX     11  /* sqlite3_mutex_methods* */
+/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ 
+#define SQLITE_CONFIG_LOOKASIDE    13  /* int int */
+#define SQLITE_CONFIG_PCACHE       14  /* no-op */
+#define SQLITE_CONFIG_GETPCACHE    15  /* no-op */
+#define SQLITE_CONFIG_LOG          16  /* xFunc, void* */
+#define SQLITE_CONFIG_URI          17  /* int */
+#define SQLITE_CONFIG_PCACHE2      18  /* sqlite3_pcache_methods2* */
+#define SQLITE_CONFIG_GETPCACHE2   19  /* sqlite3_pcache_methods2* */
+#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20  /* int */
+#define SQLITE_CONFIG_SQLLOG       21  /* xSqllog, void* */
+#define SQLITE_CONFIG_MMAP_SIZE    22  /* sqlite3_int64, sqlite3_int64 */
+#define SQLITE_CONFIG_WIN32_HEAPSIZE      23  /* int nByte */
+
+/*
+** CAPI3REF: Database Connection Configuration Options
+**
+** These constants are the available integer configuration options that
+** can be passed as the second argument to the [sqlite3_db_config()] interface.
+**
+** New configuration options may be added in future releases of SQLite.
+** Existing configuration options might be discontinued.  Applications
+** should check the return code from [sqlite3_db_config()] to make sure that
+** the call worked.  ^The [sqlite3_db_config()] interface will return a
+** non-zero [error code] if a discontinued or unsupported configuration option
+** is invoked.
+**
+** <dl>
+** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
+** <dd> ^This option takes three additional arguments that determine the 
+** [lookaside memory allocator] configuration for the [database connection].
+** ^The first argument (the third parameter to [sqlite3_db_config()] is a
+** pointer to a memory buffer to use for lookaside memory.
+** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
+** may be NULL in which case SQLite will allocate the
+** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
+** size of each lookaside buffer slot.  ^The third argument is the number of
+** slots.  The size of the buffer in the first argument must be greater than
+** or equal to the product of the second and third arguments.  The buffer
+** must be aligned to an 8-byte boundary.  ^If the second argument to
+** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
+** rounded down to the next smaller multiple of 8.  ^(The lookaside memory
+** configuration for a database connection can only be changed when that
+** connection is not currently using lookaside memory, or in other words
+** when the "current value" returned by
+** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero.
+** Any attempt to change the lookaside memory configuration when lookaside
+** memory is in use leaves the configuration unchanged and returns 
+** [SQLITE_BUSY].)^</dd>
+**
+** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
+** <dd> ^This option is used to enable or disable the enforcement of
+** [foreign key constraints].  There should be two additional arguments.
+** The first argument is an integer which is 0 to disable FK enforcement,
+** positive to enable FK enforcement or negative to leave FK enforcement
+** unchanged.  The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether FK enforcement is off or on
+** following this call.  The second parameter may be a NULL pointer, in
+** which case the FK enforcement setting is not reported back. </dd>
+**
+** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>
+** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].
+** There should be two additional arguments.
+** The first argument is an integer which is 0 to disable triggers,
+** positive to enable triggers or negative to leave the setting unchanged.
+** The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether triggers are disabled or enabled
+** following this call.  The second parameter may be a NULL pointer, in
+** which case the trigger setting is not reported back. </dd>
+**
+** </dl>
+*/
+#define SQLITE_DBCONFIG_LOOKASIDE       1001  /* void* int int */
+#define SQLITE_DBCONFIG_ENABLE_FKEY     1002  /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_TRIGGER  1003  /* int int* */
+
+
+/*
+** CAPI3REF: Enable Or Disable Extended Result Codes
+**
+** ^The sqlite3_extended_result_codes() routine enables or disables the
+** [extended result codes] feature of SQLite. ^The extended result
+** codes are disabled by default for historical compatibility.
+*/
+SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
+
+/*
+** CAPI3REF: Last Insert Rowid
+**
+** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
+** has a unique 64-bit signed
+** integer key called the [ROWID | "rowid"]. ^The rowid is always available
+** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
+** names are not also used by explicitly declared columns. ^If
+** the table has a column of type [INTEGER PRIMARY KEY] then that column
+** is another alias for the rowid.
+**
+** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the 
+** most recent successful [INSERT] into a rowid table or [virtual table]
+** on database connection D.
+** ^Inserts into [WITHOUT ROWID] tables are not recorded.
+** ^If no successful [INSERT]s into rowid tables
+** have ever occurred on the database connection D, 
+** then sqlite3_last_insert_rowid(D) returns zero.
+**
+** ^(If an [INSERT] occurs within a trigger or within a [virtual table]
+** method, then this routine will return the [rowid] of the inserted
+** row as long as the trigger or virtual table method is running.
+** But once the trigger or virtual table method ends, the value returned 
+** by this routine reverts to what it was before the trigger or virtual
+** table method began.)^
+**
+** ^An [INSERT] that fails due to a constraint violation is not a
+** successful [INSERT] and does not change the value returned by this
+** routine.  ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,
+** and INSERT OR ABORT make no changes to the return value of this
+** routine when their insertion fails.  ^(When INSERT OR REPLACE
+** encounters a constraint violation, it does not fail.  The
+** INSERT continues to completion after deleting rows that caused
+** the constraint problem so INSERT OR REPLACE will always change
+** the return value of this interface.)^
+**
+** ^For the purposes of this routine, an [INSERT] is considered to
+** be successful even if it is subsequently rolled back.
+**
+** This function is accessible to SQL statements via the
+** [last_insert_rowid() SQL function].
+**
+** If a separate thread performs a new [INSERT] on the same
+** database connection while the [sqlite3_last_insert_rowid()]
+** function is running and thus changes the last insert [rowid],
+** then the value returned by [sqlite3_last_insert_rowid()] is
+** unpredictable and might not equal either the old or the new
+** last insert [rowid].
+*/
+SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
+
+/*
+** CAPI3REF: Count The Number Of Rows Modified
+**
+** ^This function returns the number of database rows that were changed
+** or inserted or deleted by the most recently completed SQL statement
+** on the [database connection] specified by the first parameter.
+** ^(Only changes that are directly specified by the [INSERT], [UPDATE],
+** or [DELETE] statement are counted.  Auxiliary changes caused by
+** triggers or [foreign key actions] are not counted.)^ Use the
+** [sqlite3_total_changes()] function to find the total number of changes
+** including changes caused by triggers and foreign key actions.
+**
+** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
+** are not counted.  Only real table changes are counted.
+**
+** ^(A "row change" is a change to a single row of a single table
+** caused by an INSERT, DELETE, or UPDATE statement.  Rows that
+** are changed as side effects of [REPLACE] constraint resolution,
+** rollback, ABORT processing, [DROP TABLE], or by any other
+** mechanisms do not count as direct row changes.)^
+**
+** A "trigger context" is a scope of execution that begins and
+** ends with the script of a [CREATE TRIGGER | trigger]. 
+** Most SQL statements are
+** evaluated outside of any trigger.  This is the "top level"
+** trigger context.  If a trigger fires from the top level, a
+** new trigger context is entered for the duration of that one
+** trigger.  Subtriggers create subcontexts for their duration.
+**
+** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
+** not create a new trigger context.
+**
+** ^This function returns the number of direct row changes in the
+** most recent INSERT, UPDATE, or DELETE statement within the same
+** trigger context.
+**
+** ^Thus, when called from the top level, this function returns the
+** number of changes in the most recent INSERT, UPDATE, or DELETE
+** that also occurred at the top level.  ^(Within the body of a trigger,
+** the sqlite3_changes() interface can be called to find the number of
+** changes in the most recently completed INSERT, UPDATE, or DELETE
+** statement within the body of the same trigger.
+** However, the number returned does not include changes
+** caused by subtriggers since those have their own context.)^
+**
+** See also the [sqlite3_total_changes()] interface, the
+** [count_changes pragma], and the [changes() SQL function].
+**
+** If a separate thread makes changes on the same database connection
+** while [sqlite3_changes()] is running then the value returned
+** is unpredictable and not meaningful.
+*/
+SQLITE_API int sqlite3_changes(sqlite3*);
+
+/*
+** CAPI3REF: Total Number Of Rows Modified
+**
+** ^This function returns the number of row changes caused by [INSERT],
+** [UPDATE] or [DELETE] statements since the [database connection] was opened.
+** ^(The count returned by sqlite3_total_changes() includes all changes
+** from all [CREATE TRIGGER | trigger] contexts and changes made by
+** [foreign key actions]. However,
+** the count does not include changes used to implement [REPLACE] constraints,
+** do rollbacks or ABORT processing, or [DROP TABLE] processing.  The
+** count does not include rows of views that fire an [INSTEAD OF trigger],
+** though if the INSTEAD OF trigger makes changes of its own, those changes 
+** are counted.)^
+** ^The sqlite3_total_changes() function counts the changes as soon as
+** the statement that makes them is completed (when the statement handle
+** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).
+**
+** See also the [sqlite3_changes()] interface, the
+** [count_changes pragma], and the [total_changes() SQL function].
+**
+** If a separate thread makes changes on the same database connection
+** while [sqlite3_total_changes()] is running then the value
+** returned is unpredictable and not meaningful.
+*/
+SQLITE_API int sqlite3_total_changes(sqlite3*);
+
+/*
+** CAPI3REF: Interrupt A Long-Running Query
+**
+** ^This function causes any pending database operation to abort and
+** return at its earliest opportunity. This routine is typically
+** called in response to a user action such as pressing "Cancel"
+** or Ctrl-C where the user wants a long query operation to halt
+** immediately.
+**
+** ^It is safe to call this routine from a thread different from the
+** thread that is currently running the database operation.  But it
+** is not safe to call this routine with a [database connection] that
+** is closed or might close before sqlite3_interrupt() returns.
+**
+** ^If an SQL operation is very nearly finished at the time when
+** sqlite3_interrupt() is called, then it might not have an opportunity
+** to be interrupted and might continue to completion.
+**
+** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT].
+** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
+** that is inside an explicit transaction, then the entire transaction
+** will be rolled back automatically.
+**
+** ^The sqlite3_interrupt(D) call is in effect until all currently running
+** SQL statements on [database connection] D complete.  ^Any new SQL statements
+** that are started after the sqlite3_interrupt() call and before the 
+** running statements reaches zero are interrupted as if they had been
+** running prior to the sqlite3_interrupt() call.  ^New SQL statements
+** that are started after the running statement count reaches zero are
+** not effected by the sqlite3_interrupt().
+** ^A call to sqlite3_interrupt(D) that occurs when there are no running
+** SQL statements is a no-op and has no effect on SQL statements
+** that are started after the sqlite3_interrupt() call returns.
+**
+** If the database connection closes while [sqlite3_interrupt()]
+** is running then bad things will likely happen.
+*/
+SQLITE_API void sqlite3_interrupt(sqlite3*);
+
+/*
+** CAPI3REF: Determine If An SQL Statement Is Complete
+**
+** These routines are useful during command-line input to determine if the
+** currently entered text seems to form a complete SQL statement or
+** if additional input is needed before sending the text into
+** SQLite for parsing.  ^These routines return 1 if the input string
+** appears to be a complete SQL statement.  ^A statement is judged to be
+** complete if it ends with a semicolon token and is not a prefix of a
+** well-formed CREATE TRIGGER statement.  ^Semicolons that are embedded within
+** string literals or quoted identifier names or comments are not
+** independent tokens (they are part of the token in which they are
+** embedded) and thus do not count as a statement terminator.  ^Whitespace
+** and comments that follow the final semicolon are ignored.
+**
+** ^These routines return 0 if the statement is incomplete.  ^If a
+** memory allocation fails, then SQLITE_NOMEM is returned.
+**
+** ^These routines do not parse the SQL statements thus
+** will not detect syntactically incorrect SQL.
+**
+** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior 
+** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked
+** automatically by sqlite3_complete16().  If that initialization fails,
+** then the return value from sqlite3_complete16() will be non-zero
+** regardless of whether or not the input SQL is complete.)^
+**
+** The input to [sqlite3_complete()] must be a zero-terminated
+** UTF-8 string.
+**
+** The input to [sqlite3_complete16()] must be a zero-terminated
+** UTF-16 string in native byte order.
+*/
+SQLITE_API int sqlite3_complete(const char *sql);
+SQLITE_API int sqlite3_complete16(const void *sql);
+
+/*
+** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
+**
+** ^This routine sets a callback function that might be invoked whenever
+** an attempt is made to open a database table that another thread
+** or process has locked.
+**
+** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]
+** is returned immediately upon encountering the lock.  ^If the busy callback
+** is not NULL, then the callback might be invoked with two arguments.
+**
+** ^The first argument to the busy handler is a copy of the void* pointer which
+** is the third argument to sqlite3_busy_handler().  ^The second argument to
+** the busy handler callback is the number of times that the busy handler has
+** been invoked for this locking event.  ^If the
+** busy callback returns 0, then no additional attempts are made to
+** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned.
+** ^If the callback returns non-zero, then another attempt
+** is made to open the database for reading and the cycle repeats.
+**
+** The presence of a busy handler does not guarantee that it will be invoked
+** when there is lock contention. ^If SQLite determines that invoking the busy
+** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
+** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler.
+** Consider a scenario where one process is holding a read lock that
+** it is trying to promote to a reserved lock and
+** a second process is holding a reserved lock that it is trying
+** to promote to an exclusive lock.  The first process cannot proceed
+** because it is blocked by the second and the second process cannot
+** proceed because it is blocked by the first.  If both processes
+** invoke the busy handlers, neither will make any progress.  Therefore,
+** SQLite returns [SQLITE_BUSY] for the first process, hoping that this
+** will induce the first process to release its read lock and allow
+** the second process to proceed.
+**
+** ^The default busy callback is NULL.
+**
+** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED]
+** when SQLite is in the middle of a large transaction where all the
+** changes will not fit into the in-memory cache.  SQLite will
+** already hold a RESERVED lock on the database file, but it needs
+** to promote this lock to EXCLUSIVE so that it can spill cache
+** pages into the database file without harm to concurrent
+** readers.  ^If it is unable to promote the lock, then the in-memory
+** cache will be left in an inconsistent state and so the error
+** code is promoted from the relatively benign [SQLITE_BUSY] to
+** the more severe [SQLITE_IOERR_BLOCKED].  ^This error code promotion
+** forces an automatic rollback of the changes.  See the
+** <a href="/cvstrac/wiki?p=CorruptionFollowingBusyError">
+** CorruptionFollowingBusyError</a> wiki page for a discussion of why
+** this is important.
+**
+** ^(There can only be a single busy handler defined for each
+** [database connection].  Setting a new busy handler clears any
+** previously set handler.)^  ^Note that calling [sqlite3_busy_timeout()]
+** will also set or clear the busy handler.
+**
+** The busy callback should not take any actions which modify the
+** database connection that invoked the busy handler.  Any such actions
+** result in undefined behavior.
+** 
+** A busy handler must not close the database connection
+** or [prepared statement] that invoked the busy handler.
+*/
+SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
+
+/*
+** CAPI3REF: Set A Busy Timeout
+**
+** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
+** for a specified amount of time when a table is locked.  ^The handler
+** will sleep multiple times until at least "ms" milliseconds of sleeping
+** have accumulated.  ^After at least "ms" milliseconds of sleeping,
+** the handler returns 0 which causes [sqlite3_step()] to return
+** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED].
+**
+** ^Calling this routine with an argument less than or equal to zero
+** turns off all busy handlers.
+**
+** ^(There can only be a single busy handler for a particular
+** [database connection] any any given moment.  If another busy handler
+** was defined  (using [sqlite3_busy_handler()]) prior to calling
+** this routine, that other busy handler is cleared.)^
+*/
+SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
+
+/*
+** CAPI3REF: Convenience Routines For Running Queries
+**
+** This is a legacy interface that is preserved for backwards compatibility.
+** Use of this interface is not recommended.
+**
+** Definition: A <b>result table</b> is memory data structure created by the
+** [sqlite3_get_table()] interface.  A result table records the
+** complete query results from one or more queries.
+**
+** The table conceptually has a number of rows and columns.  But
+** these numbers are not part of the result table itself.  These
+** numbers are obtained separately.  Let N be the number of rows
+** and M be the number of columns.
+**
+** A result table is an array of pointers to zero-terminated UTF-8 strings.
+** There are (N+1)*M elements in the array.  The first M pointers point
+** to zero-terminated strings that  contain the names of the columns.
+** The remaining entries all point to query results.  NULL values result
+** in NULL pointers.  All other values are in their UTF-8 zero-terminated
+** string representation as returned by [sqlite3_column_text()].
+**
+** A result table might consist of one or more memory allocations.
+** It is not safe to pass a result table directly to [sqlite3_free()].
+** A result table should be deallocated using [sqlite3_free_table()].
+**
+** ^(As an example of the result table format, suppose a query result
+** is as follows:
+**
+** <blockquote><pre>
+**        Name        | Age
+**        -----------------------
+**        Alice       | 43
+**        Bob         | 28
+**        Cindy       | 21
+** </pre></blockquote>
+**
+** There are two column (M==2) and three rows (N==3).  Thus the
+** result table has 8 entries.  Suppose the result table is stored
+** in an array names azResult.  Then azResult holds this content:
+**
+** <blockquote><pre>
+**        azResult&#91;0] = "Name";
+**        azResult&#91;1] = "Age";
+**        azResult&#91;2] = "Alice";
+**        azResult&#91;3] = "43";
+**        azResult&#91;4] = "Bob";
+**        azResult&#91;5] = "28";
+**        azResult&#91;6] = "Cindy";
+**        azResult&#91;7] = "21";
+** </pre></blockquote>)^
+**
+** ^The sqlite3_get_table() function evaluates one or more
+** semicolon-separated SQL statements in the zero-terminated UTF-8
+** string of its 2nd parameter and returns a result table to the
+** pointer given in its 3rd parameter.
+**
+** After the application has finished with the result from sqlite3_get_table(),
+** it must pass the result table pointer to sqlite3_free_table() in order to
+** release the memory that was malloced.  Because of the way the
+** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling
+** function must not try to call [sqlite3_free()] directly.  Only
+** [sqlite3_free_table()] is able to release the memory properly and safely.
+**
+** The sqlite3_get_table() interface is implemented as a wrapper around
+** [sqlite3_exec()].  The sqlite3_get_table() routine does not have access
+** to any internal data structures of SQLite.  It uses only the public
+** interface defined here.  As a consequence, errors that occur in the
+** wrapper layer outside of the internal [sqlite3_exec()] call are not
+** reflected in subsequent calls to [sqlite3_errcode()] or
+** [sqlite3_errmsg()].
+*/
+SQLITE_API int sqlite3_get_table(
+  sqlite3 *db,          /* An open database */
+  const char *zSql,     /* SQL to be evaluated */
+  char ***pazResult,    /* Results of the query */
+  int *pnRow,           /* Number of result rows written here */
+  int *pnColumn,        /* Number of result columns written here */
+  char **pzErrmsg       /* Error msg written here */
+);
+SQLITE_API void sqlite3_free_table(char **result);
+
+/*
+** CAPI3REF: Formatted String Printing Functions
+**
+** These routines are work-alikes of the "printf()" family of functions
+** from the standard C library.
+**
+** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
+** results into memory obtained from [sqlite3_malloc()].
+** The strings returned by these two routines should be
+** released by [sqlite3_free()].  ^Both routines return a
+** NULL pointer if [sqlite3_malloc()] is unable to allocate enough
+** memory to hold the resulting string.
+**
+** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from
+** the standard C library.  The result is written into the
+** buffer supplied as the second parameter whose size is given by
+** the first parameter. Note that the order of the
+** first two parameters is reversed from snprintf().)^  This is an
+** historical accident that cannot be fixed without breaking
+** backwards compatibility.  ^(Note also that sqlite3_snprintf()
+** returns a pointer to its buffer instead of the number of
+** characters actually written into the buffer.)^  We admit that
+** the number of characters written would be a more useful return
+** value but we cannot change the implementation of sqlite3_snprintf()
+** now without breaking compatibility.
+**
+** ^As long as the buffer size is greater than zero, sqlite3_snprintf()
+** guarantees that the buffer is always zero-terminated.  ^The first
+** parameter "n" is the total size of the buffer, including space for
+** the zero terminator.  So the longest string that can be completely
+** written will be n-1 characters.
+**
+** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().
+**
+** These routines all implement some additional formatting
+** options that are useful for constructing SQL statements.
+** All of the usual printf() formatting options apply.  In addition, there
+** is are "%q", "%Q", and "%z" options.
+**
+** ^(The %q option works like %s in that it substitutes a nul-terminated
+** string from the argument list.  But %q also doubles every '\'' character.
+** %q is designed for use inside a string literal.)^  By doubling each '\''
+** character it escapes that character and allows it to be inserted into
+** the string.
+**
+** For example, assume the string variable zText contains text as follows:
+**
+** <blockquote><pre>
+**  char *zText = "It's a happy day!";
+** </pre></blockquote>
+**
+** One can use this text in an SQL statement as follows:
+**
+** <blockquote><pre>
+**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
+**  sqlite3_exec(db, zSQL, 0, 0, 0);
+**  sqlite3_free(zSQL);
+** </pre></blockquote>
+**
+** Because the %q format string is used, the '\'' character in zText
+** is escaped and the SQL generated is as follows:
+**
+** <blockquote><pre>
+**  INSERT INTO table1 VALUES('It''s a happy day!')
+** </pre></blockquote>
+**
+** This is correct.  Had we used %s instead of %q, the generated SQL
+** would have looked like this:
+**
+** <blockquote><pre>
+**  INSERT INTO table1 VALUES('It's a happy day!');
+** </pre></blockquote>
+**
+** This second example is an SQL syntax error.  As a general rule you should
+** always use %q instead of %s when inserting text into a string literal.
+**
+** ^(The %Q option works like %q except it also adds single quotes around
+** the outside of the total string.  Additionally, if the parameter in the
+** argument list is a NULL pointer, %Q substitutes the text "NULL" (without
+** single quotes).)^  So, for example, one could say:
+**
+** <blockquote><pre>
+**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
+**  sqlite3_exec(db, zSQL, 0, 0, 0);
+**  sqlite3_free(zSQL);
+** </pre></blockquote>
+**
+** The code above will render a correct SQL statement in the zSQL
+** variable even if the zText variable is a NULL pointer.
+**
+** ^(The "%z" formatting option works like "%s" but with the
+** addition that after the string has been read and copied into
+** the result, [sqlite3_free()] is called on the input string.)^
+*/
+SQLITE_API char *sqlite3_mprintf(const char*,...);
+SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
+SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
+SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
+
+/*
+** CAPI3REF: Memory Allocation Subsystem
+**
+** The SQLite core uses these three routines for all of its own
+** internal memory allocation needs. "Core" in the previous sentence
+** does not include operating-system specific VFS implementation.  The
+** Windows VFS uses native malloc() and free() for some operations.
+**
+** ^The sqlite3_malloc() routine returns a pointer to a block
+** of memory at least N bytes in length, where N is the parameter.
+** ^If sqlite3_malloc() is unable to obtain sufficient free
+** memory, it returns a NULL pointer.  ^If the parameter N to
+** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
+** a NULL pointer.
+**
+** ^Calling sqlite3_free() with a pointer previously returned
+** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
+** that it might be reused.  ^The sqlite3_free() routine is
+** a no-op if is called with a NULL pointer.  Passing a NULL pointer
+** to sqlite3_free() is harmless.  After being freed, memory
+** should neither be read nor written.  Even reading previously freed
+** memory might result in a segmentation fault or other severe error.
+** Memory corruption, a segmentation fault, or other severe error
+** might result if sqlite3_free() is called with a non-NULL pointer that
+** was not obtained from sqlite3_malloc() or sqlite3_realloc().
+**
+** ^(The sqlite3_realloc() interface attempts to resize a
+** prior memory allocation to be at least N bytes, where N is the
+** second parameter.  The memory allocation to be resized is the first
+** parameter.)^ ^ If the first parameter to sqlite3_realloc()
+** is a NULL pointer then its behavior is identical to calling
+** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc().
+** ^If the second parameter to sqlite3_realloc() is zero or
+** negative then the behavior is exactly the same as calling
+** sqlite3_free(P) where P is the first parameter to sqlite3_realloc().
+** ^sqlite3_realloc() returns a pointer to a memory allocation
+** of at least N bytes in size or NULL if sufficient memory is unavailable.
+** ^If M is the size of the prior allocation, then min(N,M) bytes
+** of the prior allocation are copied into the beginning of buffer returned
+** by sqlite3_realloc() and the prior allocation is freed.
+** ^If sqlite3_realloc() returns NULL, then the prior allocation
+** is not freed.
+**
+** ^The memory returned by sqlite3_malloc() and sqlite3_realloc()
+** is always aligned to at least an 8 byte boundary, or to a
+** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time
+** option is used.
+**
+** In SQLite version 3.5.0 and 3.5.1, it was possible to define
+** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in
+** implementation of these routines to be omitted.  That capability
+** is no longer provided.  Only built-in memory allocators can be used.
+**
+** Prior to SQLite version 3.7.10, the Windows OS interface layer called
+** the system malloc() and free() directly when converting
+** filenames between the UTF-8 encoding used by SQLite
+** and whatever filename encoding is used by the particular Windows
+** installation.  Memory allocation errors were detected, but
+** they were reported back as [SQLITE_CANTOPEN] or
+** [SQLITE_IOERR] rather than [SQLITE_NOMEM].
+**
+** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
+** must be either NULL or else pointers obtained from a prior
+** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
+** not yet been released.
+**
+** The application must not read or write any part of
+** a block of memory after it has been released using
+** [sqlite3_free()] or [sqlite3_realloc()].
+*/
+SQLITE_API void *sqlite3_malloc(int);
+SQLITE_API void *sqlite3_realloc(void*, int);
+SQLITE_API void sqlite3_free(void*);
+
+/*
+** CAPI3REF: Memory Allocator Statistics
+**
+** SQLite provides these two interfaces for reporting on the status
+** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]
+** routines, which form the built-in memory allocation subsystem.
+**
+** ^The [sqlite3_memory_used()] routine returns the number of bytes
+** of memory currently outstanding (malloced but not freed).
+** ^The [sqlite3_memory_highwater()] routine returns the maximum
+** value of [sqlite3_memory_used()] since the high-water mark
+** was last reset.  ^The values returned by [sqlite3_memory_used()] and
+** [sqlite3_memory_highwater()] include any overhead
+** added by SQLite in its implementation of [sqlite3_malloc()],
+** but not overhead added by the any underlying system library
+** routines that [sqlite3_malloc()] may call.
+**
+** ^The memory high-water mark is reset to the current value of
+** [sqlite3_memory_used()] if and only if the parameter to
+** [sqlite3_memory_highwater()] is true.  ^The value returned
+** by [sqlite3_memory_highwater(1)] is the high-water mark
+** prior to the reset.
+*/
+SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
+SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
+
+/*
+** CAPI3REF: Pseudo-Random Number Generator
+**
+** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
+** select random [ROWID | ROWIDs] when inserting new records into a table that
+** already uses the largest possible [ROWID].  The PRNG is also used for
+** the build-in random() and randomblob() SQL functions.  This interface allows
+** applications to access the same PRNG for other purposes.
+**
+** ^A call to this routine stores N bytes of randomness into buffer P.
+** ^If N is less than one, then P can be a NULL pointer.
+**
+** ^If this routine has not been previously called or if the previous
+** call had N less than one, then the PRNG is seeded using randomness
+** obtained from the xRandomness method of the default [sqlite3_vfs] object.
+** ^If the previous call to this routine had an N of 1 or more then
+** the pseudo-randomness is generated
+** internally and without recourse to the [sqlite3_vfs] xRandomness
+** method.
+*/
+SQLITE_API void sqlite3_randomness(int N, void *P);
+
+/*
+** CAPI3REF: Compile-Time Authorization Callbacks
+**
+** ^This routine registers an authorizer callback with a particular
+** [database connection], supplied in the first argument.
+** ^The authorizer callback is invoked as SQL statements are being compiled
+** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
+** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()].  ^At various
+** points during the compilation process, as logic is being created
+** to perform various actions, the authorizer callback is invoked to
+** see if those actions are allowed.  ^The authorizer callback should
+** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the
+** specific action but allow the SQL statement to continue to be
+** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
+** rejected with an error.  ^If the authorizer callback returns
+** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]
+** then the [sqlite3_prepare_v2()] or equivalent call that triggered
+** the authorizer will fail with an error message.
+**
+** When the callback returns [SQLITE_OK], that means the operation
+** requested is ok.  ^When the callback returns [SQLITE_DENY], the
+** [sqlite3_prepare_v2()] or equivalent call that triggered the
+** authorizer will fail with an error message explaining that
+** access is denied. 
+**
+** ^The first parameter to the authorizer callback is a copy of the third
+** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
+** to the callback is an integer [SQLITE_COPY | action code] that specifies
+** the particular action to be authorized. ^The third through sixth parameters
+** to the callback are zero-terminated strings that contain additional
+** details about the action to be authorized.
+**
+** ^If the action code is [SQLITE_READ]
+** and the callback returns [SQLITE_IGNORE] then the
+** [prepared statement] statement is constructed to substitute
+** a NULL value in place of the table column that would have
+** been read if [SQLITE_OK] had been returned.  The [SQLITE_IGNORE]
+** return can be used to deny an untrusted user access to individual
+** columns of a table.
+** ^If the action code is [SQLITE_DELETE] and the callback returns
+** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the
+** [truncate optimization] is disabled and all rows are deleted individually.
+**
+** An authorizer is used when [sqlite3_prepare | preparing]
+** SQL statements from an untrusted source, to ensure that the SQL statements
+** do not try to access data they are not allowed to see, or that they do not
+** try to execute malicious statements that damage the database.  For
+** example, an application may allow a user to enter arbitrary
+** SQL queries for evaluation by a database.  But the application does
+** not want the user to be able to make arbitrary changes to the
+** database.  An authorizer could then be put in place while the
+** user-entered SQL is being [sqlite3_prepare | prepared] that
+** disallows everything except [SELECT] statements.
+**
+** Applications that need to process SQL from untrusted sources
+** might also consider lowering resource limits using [sqlite3_limit()]
+** and limiting database size using the [max_page_count] [PRAGMA]
+** in addition to using an authorizer.
+**
+** ^(Only a single authorizer can be in place on a database connection
+** at a time.  Each call to sqlite3_set_authorizer overrides the
+** previous call.)^  ^Disable the authorizer by installing a NULL callback.
+** The authorizer is disabled by default.
+**
+** The authorizer callback must not do anything that will modify
+** the database connection that invoked the authorizer callback.
+** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
+** database connections for the meaning of "modify" in this paragraph.
+**
+** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the
+** statement might be re-prepared during [sqlite3_step()] due to a 
+** schema change.  Hence, the application should ensure that the
+** correct authorizer callback remains in place during the [sqlite3_step()].
+**
+** ^Note that the authorizer callback is invoked only during
+** [sqlite3_prepare()] or its variants.  Authorization is not
+** performed during statement evaluation in [sqlite3_step()], unless
+** as stated in the previous paragraph, sqlite3_step() invokes
+** sqlite3_prepare_v2() to reprepare a statement after a schema change.
+*/
+SQLITE_API int sqlite3_set_authorizer(
+  sqlite3*,
+  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
+  void *pUserData
+);
+
+/*
+** CAPI3REF: Authorizer Return Codes
+**
+** The [sqlite3_set_authorizer | authorizer callback function] must
+** return either [SQLITE_OK] or one of these two constants in order
+** to signal SQLite whether or not the action is permitted.  See the
+** [sqlite3_set_authorizer | authorizer documentation] for additional
+** information.
+**
+** Note that SQLITE_IGNORE is also used as a [SQLITE_ROLLBACK | return code]
+** from the [sqlite3_vtab_on_conflict()] interface.
+*/
+#define SQLITE_DENY   1   /* Abort the SQL statement with an error */
+#define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */
+
+/*
+** CAPI3REF: Authorizer Action Codes
+**
+** The [sqlite3_set_authorizer()] interface registers a callback function
+** that is invoked to authorize certain SQL statement actions.  The
+** second parameter to the callback is an integer code that specifies
+** what action is being authorized.  These are the integer action codes that
+** the authorizer callback may be passed.
+**
+** These action code values signify what kind of operation is to be
+** authorized.  The 3rd and 4th parameters to the authorization
+** callback function will be parameters or NULL depending on which of these
+** codes is used as the second parameter.  ^(The 5th parameter to the
+** authorizer callback is the name of the database ("main", "temp",
+** etc.) if applicable.)^  ^The 6th parameter to the authorizer callback
+** is the name of the inner-most trigger or view that is responsible for
+** the access attempt or NULL if this access attempt is directly from
+** top-level SQL code.
+*/
+/******************************************* 3rd ************ 4th ***********/
+#define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */
+#define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */
+#define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */
+#define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */
+#define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */
+#define SQLITE_CREATE_TEMP_VIEW      6   /* View Name       NULL            */
+#define SQLITE_CREATE_TRIGGER        7   /* Trigger Name    Table Name      */
+#define SQLITE_CREATE_VIEW           8   /* View Name       NULL            */
+#define SQLITE_DELETE                9   /* Table Name      NULL            */
+#define SQLITE_DROP_INDEX           10   /* Index Name      Table Name      */
+#define SQLITE_DROP_TABLE           11   /* Table Name      NULL            */
+#define SQLITE_DROP_TEMP_INDEX      12   /* Index Name      Table Name      */
+#define SQLITE_DROP_TEMP_TABLE      13   /* Table Name      NULL            */
+#define SQLITE_DROP_TEMP_TRIGGER    14   /* Trigger Name    Table Name      */
+#define SQLITE_DROP_TEMP_VIEW       15   /* View Name       NULL            */
+#define SQLITE_DROP_TRIGGER         16   /* Trigger Name    Table Name      */
+#define SQLITE_DROP_VIEW            17   /* View Name       NULL            */
+#define SQLITE_INSERT               18   /* Table Name      NULL            */
+#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */
+#define SQLITE_READ                 20   /* Table Name      Column Name     */
+#define SQLITE_SELECT               21   /* NULL            NULL            */
+#define SQLITE_TRANSACTION          22   /* Operation       NULL            */
+#define SQLITE_UPDATE               23   /* Table Name      Column Name     */
+#define SQLITE_ATTACH               24   /* Filename        NULL            */
+#define SQLITE_DETACH               25   /* Database Name   NULL            */
+#define SQLITE_ALTER_TABLE          26   /* Database Name   Table Name      */
+#define SQLITE_REINDEX              27   /* Index Name      NULL            */
+#define SQLITE_ANALYZE              28   /* Table Name      NULL            */
+#define SQLITE_CREATE_VTABLE        29   /* Table Name      Module Name     */
+#define SQLITE_DROP_VTABLE          30   /* Table Name      Module Name     */
+#define SQLITE_FUNCTION             31   /* NULL            Function Name   */
+#define SQLITE_SAVEPOINT            32   /* Operation       Savepoint Name  */
+#define SQLITE_COPY                  0   /* No longer used */
+#define SQLITE_RECURSIVE            33   /* NULL            NULL            */
+
+/*
+** CAPI3REF: Tracing And Profiling Functions
+**
+** These routines register callback functions that can be used for
+** tracing and profiling the execution of SQL statements.
+**
+** ^The callback function registered by sqlite3_trace() is invoked at
+** various times when an SQL statement is being run by [sqlite3_step()].
+** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the
+** SQL statement text as the statement first begins executing.
+** ^(Additional sqlite3_trace() callbacks might occur
+** as each triggered subprogram is entered.  The callbacks for triggers
+** contain a UTF-8 SQL comment that identifies the trigger.)^
+**
+** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit
+** the length of [bound parameter] expansion in the output of sqlite3_trace().
+**
+** ^The callback function registered by sqlite3_profile() is invoked
+** as each SQL statement finishes.  ^The profile callback contains
+** the original statement text and an estimate of wall-clock time
+** of how long that statement took to run.  ^The profile callback
+** time is in units of nanoseconds, however the current implementation
+** is only capable of millisecond resolution so the six least significant
+** digits in the time are meaningless.  Future versions of SQLite
+** might provide greater resolution on the profiler callback.  The
+** sqlite3_profile() function is considered experimental and is
+** subject to change in future versions of SQLite.
+*/
+SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
+SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*,
+   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
+
+/*
+** CAPI3REF: Query Progress Callbacks
+**
+** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
+** function X to be invoked periodically during long running calls to
+** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for
+** database connection D.  An example use for this
+** interface is to keep a GUI updated during a large query.
+**
+** ^The parameter P is passed through as the only parameter to the 
+** callback function X.  ^The parameter N is the approximate number of 
+** [virtual machine instructions] that are evaluated between successive
+** invocations of the callback X.  ^If N is less than one then the progress
+** handler is disabled.
+**
+** ^Only a single progress handler may be defined at one time per
+** [database connection]; setting a new progress handler cancels the
+** old one.  ^Setting parameter X to NULL disables the progress handler.
+** ^The progress handler is also disabled by setting N to a value less
+** than 1.
+**
+** ^If the progress callback returns non-zero, the operation is
+** interrupted.  This feature can be used to implement a
+** "Cancel" button on a GUI progress dialog box.
+**
+** The progress handler callback must not do anything that will modify
+** the database connection that invoked the progress handler.
+** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
+** database connections for the meaning of "modify" in this paragraph.
+**
+*/
+SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
+
+/*
+** CAPI3REF: Opening A New Database Connection
+**
+** ^These routines open an SQLite database file as specified by the 
+** filename argument. ^The filename argument is interpreted as UTF-8 for
+** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte
+** order for sqlite3_open16(). ^(A [database connection] handle is usually
+** returned in *ppDb, even if an error occurs.  The only exception is that
+** if SQLite is unable to allocate memory to hold the [sqlite3] object,
+** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]
+** object.)^ ^(If the database is opened (and/or created) successfully, then
+** [SQLITE_OK] is returned.  Otherwise an [error code] is returned.)^ ^The
+** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain
+** an English language description of the error following a failure of any
+** of the sqlite3_open() routines.
+**
+** ^The default encoding for the database will be UTF-8 if
+** sqlite3_open() or sqlite3_open_v2() is called and
+** UTF-16 in the native byte order if sqlite3_open16() is used.
+**
+** Whether or not an error occurs when it is opened, resources
+** associated with the [database connection] handle should be released by
+** passing it to [sqlite3_close()] when it is no longer required.
+**
+** The sqlite3_open_v2() interface works like sqlite3_open()
+** except that it accepts two additional parameters for additional control
+** over the new database connection.  ^(The flags parameter to
+** sqlite3_open_v2() can take one of
+** the following three values, optionally combined with the 
+** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE],
+** [SQLITE_OPEN_PRIVATECACHE], and/or [SQLITE_OPEN_URI] flags:)^
+**
+** <dl>
+** ^(<dt>[SQLITE_OPEN_READONLY]</dt>
+** <dd>The database is opened in read-only mode.  If the database does not
+** already exist, an error is returned.</dd>)^
+**
+** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>
+** <dd>The database is opened for reading and writing if possible, or reading
+** only if the file is write protected by the operating system.  In either
+** case the database must already exist, otherwise an error is returned.</dd>)^
+**
+** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
+** <dd>The database is opened for reading and writing, and is created if
+** it does not already exist. This is the behavior that is always used for
+** sqlite3_open() and sqlite3_open16().</dd>)^
+** </dl>
+**
+** If the 3rd parameter to sqlite3_open_v2() is not one of the
+** combinations shown above optionally combined with other
+** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]
+** then the behavior is undefined.
+**
+** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection
+** opens in the multi-thread [threading mode] as long as the single-thread
+** mode has not been set at compile-time or start-time.  ^If the
+** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens
+** in the serialized [threading mode] unless single-thread was
+** previously selected at compile-time or start-time.
+** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be
+** eligible to use [shared cache mode], regardless of whether or not shared
+** cache is enabled using [sqlite3_enable_shared_cache()].  ^The
+** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not
+** participate in [shared cache mode] even if it is enabled.
+**
+** ^The fourth parameter to sqlite3_open_v2() is the name of the
+** [sqlite3_vfs] object that defines the operating system interface that
+** the new database connection should use.  ^If the fourth parameter is
+** a NULL pointer then the default [sqlite3_vfs] object is used.
+**
+** ^If the filename is ":memory:", then a private, temporary in-memory database
+** is created for the connection.  ^This in-memory database will vanish when
+** the database connection is closed.  Future versions of SQLite might
+** make use of additional special filenames that begin with the ":" character.
+** It is recommended that when a database filename actually does begin with
+** a ":" character you should prefix the filename with a pathname such as
+** "./" to avoid ambiguity.
+**
+** ^If the filename is an empty string, then a private, temporary
+** on-disk database will be created.  ^This private database will be
+** automatically deleted as soon as the database connection is closed.
+**
+** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3>
+**
+** ^If [URI filename] interpretation is enabled, and the filename argument
+** begins with "file:", then the filename is interpreted as a URI. ^URI
+** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is
+** set in the fourth argument to sqlite3_open_v2(), or if it has
+** been enabled globally using the [SQLITE_CONFIG_URI] option with the
+** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
+** As of SQLite version 3.7.7, URI filename interpretation is turned off
+** by default, but future releases of SQLite might enable URI filename
+** interpretation by default.  See "[URI filenames]" for additional
+** information.
+**
+** URI filenames are parsed according to RFC 3986. ^If the URI contains an
+** authority, then it must be either an empty string or the string 
+** "localhost". ^If the authority is not an empty string or "localhost", an 
+** error is returned to the caller. ^The fragment component of a URI, if 
+** present, is ignored.
+**
+** ^SQLite uses the path component of the URI as the name of the disk file
+** which contains the database. ^If the path begins with a '/' character, 
+** then it is interpreted as an absolute path. ^If the path does not begin 
+** with a '/' (meaning that the authority section is omitted from the URI)
+** then the path is interpreted as a relative path. 
+** ^On windows, the first component of an absolute path 
+** is a drive specification (e.g. "C:").
+**
+** [[core URI query parameters]]
+** The query component of a URI may contain parameters that are interpreted
+** either by SQLite itself, or by a [VFS | custom VFS implementation].
+** SQLite interprets the following three query parameters:
+**
+** <ul>
+**   <li> <b>vfs</b>: ^The "vfs" parameter may be used to specify the name of
+**     a VFS object that provides the operating system interface that should
+**     be used to access the database file on disk. ^If this option is set to
+**     an empty string the default VFS object is used. ^Specifying an unknown
+**     VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is
+**     present, then the VFS specified by the option takes precedence over
+**     the value passed as the fourth parameter to sqlite3_open_v2().
+**
+**   <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw",
+**     "rwc", or "memory". Attempting to set it to any other value is
+**     an error)^. 
+**     ^If "ro" is specified, then the database is opened for read-only 
+**     access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the 
+**     third argument to sqlite3_open_v2(). ^If the mode option is set to 
+**     "rw", then the database is opened for read-write (but not create) 
+**     access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had 
+**     been set. ^Value "rwc" is equivalent to setting both 
+**     SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE.  ^If the mode option is
+**     set to "memory" then a pure [in-memory database] that never reads
+**     or writes from disk is used. ^It is an error to specify a value for
+**     the mode parameter that is less restrictive than that specified by
+**     the flags passed in the third parameter to sqlite3_open_v2().
+**
+**   <li> <b>cache</b>: ^The cache parameter may be set to either "shared" or
+**     "private". ^Setting it to "shared" is equivalent to setting the
+**     SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to
+**     sqlite3_open_v2(). ^Setting the cache parameter to "private" is 
+**     equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.
+**     ^If sqlite3_open_v2() is used and the "cache" parameter is present in
+**     a URI filename, its value overrides any behavior requested by setting
+**     SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.
+** </ul>
+**
+** ^Specifying an unknown parameter in the query component of a URI is not an
+** error.  Future versions of SQLite might understand additional query
+** parameters.  See "[query parameters with special meaning to SQLite]" for
+** additional information.
+**
+** [[URI filename examples]] <h3>URI filename examples</h3>
+**
+** <table border="1" align=center cellpadding=5>
+** <tr><th> URI filenames <th> Results
+** <tr><td> file:data.db <td> 
+**          Open the file "data.db" in the current directory.
+** <tr><td> file:/home/fred/data.db<br>
+**          file:///home/fred/data.db <br> 
+**          file://localhost/home/fred/data.db <br> <td> 
+**          Open the database file "/home/fred/data.db".
+** <tr><td> file://darkstar/home/fred/data.db <td> 
+**          An error. "darkstar" is not a recognized authority.
+** <tr><td style="white-space:nowrap"> 
+**          file:///C:/Documents%20and%20Settings/fred/Desktop/data.db
+**     <td> Windows only: Open the file "data.db" on fred's desktop on drive
+**          C:. Note that the %20 escaping in this example is not strictly 
+**          necessary - space characters can be used literally
+**          in URI filenames.
+** <tr><td> file:data.db?mode=ro&cache=private <td> 
+**          Open file "data.db" in the current directory for read-only access.
+**          Regardless of whether or not shared-cache mode is enabled by
+**          default, use a private cache.
+** <tr><td> file:/home/fred/data.db?vfs=unix-nolock <td>
+**          Open file "/home/fred/data.db". Use the special VFS "unix-nolock".
+** <tr><td> file:data.db?mode=readonly <td> 
+**          An error. "readonly" is not a valid option for the "mode" parameter.
+** </table>
+**
+** ^URI hexadecimal escape sequences (%HH) are supported within the path and
+** query components of a URI. A hexadecimal escape sequence consists of a
+** percent sign - "%" - followed by exactly two hexadecimal digits 
+** specifying an octet value. ^Before the path or query components of a
+** URI filename are interpreted, they are encoded using UTF-8 and all 
+** hexadecimal escape sequences replaced by a single byte containing the
+** corresponding octet. If this process generates an invalid UTF-8 encoding,
+** the results are undefined.
+**
+** <b>Note to Windows users:</b>  The encoding used for the filename argument
+** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever
+** codepage is currently defined.  Filenames containing international
+** characters must be converted to UTF-8 prior to passing them into
+** sqlite3_open() or sqlite3_open_v2().
+**
+** <b>Note to Windows Runtime users:</b>  The temporary directory must be set
+** prior to calling sqlite3_open() or sqlite3_open_v2().  Otherwise, various
+** features that require the use of temporary files may fail.
+**
+** See also: [sqlite3_temp_directory]
+*/
+SQLITE_API int sqlite3_open(
+  const char *filename,   /* Database filename (UTF-8) */
+  sqlite3 **ppDb          /* OUT: SQLite db handle */
+);
+SQLITE_API int sqlite3_open16(
+  const void *filename,   /* Database filename (UTF-16) */
+  sqlite3 **ppDb          /* OUT: SQLite db handle */
+);
+SQLITE_API int sqlite3_open_v2(
+  const char *filename,   /* Database filename (UTF-8) */
+  sqlite3 **ppDb,         /* OUT: SQLite db handle */
+  int flags,              /* Flags */
+  const char *zVfs        /* Name of VFS module to use */
+);
+
+/*
+** CAPI3REF: Obtain Values For URI Parameters
+**
+** These are utility routines, useful to VFS implementations, that check
+** to see if a database file was a URI that contained a specific query 
+** parameter, and if so obtains the value of that query parameter.
+**
+** If F is the database filename pointer passed into the xOpen() method of 
+** a VFS implementation when the flags parameter to xOpen() has one or 
+** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and
+** P is the name of the query parameter, then
+** sqlite3_uri_parameter(F,P) returns the value of the P
+** parameter if it exists or a NULL pointer if P does not appear as a 
+** query parameter on F.  If P is a query parameter of F
+** has no explicit value, then sqlite3_uri_parameter(F,P) returns
+** a pointer to an empty string.
+**
+** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
+** parameter and returns true (1) or false (0) according to the value
+** of P.  The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the
+** value of query parameter P is one of "yes", "true", or "on" in any
+** case or if the value begins with a non-zero number.  The 
+** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of
+** query parameter P is one of "no", "false", or "off" in any case or
+** if the value begins with a numeric zero.  If P is not a query
+** parameter on F or if the value of P is does not match any of the
+** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
+**
+** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
+** 64-bit signed integer and returns that integer, or D if P does not
+** exist.  If the value of P is something other than an integer, then
+** zero is returned.
+** 
+** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
+** sqlite3_uri_boolean(F,P,B) returns B.  If F is not a NULL pointer and
+** is not a database file pathname pointer that SQLite passed into the xOpen
+** VFS method, then the behavior of this routine is undefined and probably
+** undesirable.
+*/
+SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
+SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
+SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
+
+
+/*
+** CAPI3REF: Error Codes And Messages
+**
+** ^The sqlite3_errcode() interface returns the numeric [result code] or
+** [extended result code] for the most recent failed sqlite3_* API call
+** associated with a [database connection]. If a prior API call failed
+** but the most recent API call succeeded, the return value from
+** sqlite3_errcode() is undefined.  ^The sqlite3_extended_errcode()
+** interface is the same except that it always returns the 
+** [extended result code] even when extended result codes are
+** disabled.
+**
+** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
+** text that describes the error, as either UTF-8 or UTF-16 respectively.
+** ^(Memory to hold the error message string is managed internally.
+** The application does not need to worry about freeing the result.
+** However, the error string might be overwritten or deallocated by
+** subsequent calls to other SQLite interface functions.)^
+**
+** ^The sqlite3_errstr() interface returns the English-language text
+** that describes the [result code], as UTF-8.
+** ^(Memory to hold the error message string is managed internally
+** and must not be freed by the application)^.
+**
+** When the serialized [threading mode] is in use, it might be the
+** case that a second error occurs on a separate thread in between
+** the time of the first error and the call to these interfaces.
+** When that happens, the second error will be reported since these
+** interfaces always report the most recent result.  To avoid
+** this, each thread can obtain exclusive use of the [database connection] D
+** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning
+** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after
+** all calls to the interfaces listed here are completed.
+**
+** If an interface fails with SQLITE_MISUSE, that means the interface
+** was invoked incorrectly by the application.  In that case, the
+** error code and message may or may not be set.
+*/
+SQLITE_API int sqlite3_errcode(sqlite3 *db);
+SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
+SQLITE_API const char *sqlite3_errmsg(sqlite3*);
+SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
+SQLITE_API const char *sqlite3_errstr(int);
+
+/*
+** CAPI3REF: SQL Statement Object
+** KEYWORDS: {prepared statement} {prepared statements}
+**
+** An instance of this object represents a single SQL statement.
+** This object is variously known as a "prepared statement" or a
+** "compiled SQL statement" or simply as a "statement".
+**
+** The life of a statement object goes something like this:
+**
+** <ol>
+** <li> Create the object using [sqlite3_prepare_v2()] or a related
+**      function.
+** <li> Bind values to [host parameters] using the sqlite3_bind_*()
+**      interfaces.
+** <li> Run the SQL by calling [sqlite3_step()] one or more times.
+** <li> Reset the statement using [sqlite3_reset()] then go back
+**      to step 2.  Do this zero or more times.
+** <li> Destroy the object using [sqlite3_finalize()].
+** </ol>
+**
+** Refer to documentation on individual methods above for additional
+** information.
+*/
+typedef struct sqlite3_stmt sqlite3_stmt;
+
+/*
+** CAPI3REF: Run-time Limits
+**
+** ^(This interface allows the size of various constructs to be limited
+** on a connection by connection basis.  The first parameter is the
+** [database connection] whose limit is to be set or queried.  The
+** second parameter is one of the [limit categories] that define a
+** class of constructs to be size limited.  The third parameter is the
+** new limit for that construct.)^
+**
+** ^If the new limit is a negative number, the limit is unchanged.
+** ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a 
+** [limits | hard upper bound]
+** set at compile-time by a C preprocessor macro called
+** [limits | SQLITE_MAX_<i>NAME</i>].
+** (The "_LIMIT_" in the name is changed to "_MAX_".))^
+** ^Attempts to increase a limit above its hard upper bound are
+** silently truncated to the hard upper bound.
+**
+** ^Regardless of whether or not the limit was changed, the 
+** [sqlite3_limit()] interface returns the prior value of the limit.
+** ^Hence, to find the current value of a limit without changing it,
+** simply invoke this interface with the third parameter set to -1.
+**
+** Run-time limits are intended for use in applications that manage
+** both their own internal database and also databases that are controlled
+** by untrusted external sources.  An example application might be a
+** web browser that has its own databases for storing history and
+** separate databases controlled by JavaScript applications downloaded
+** off the Internet.  The internal databases can be given the
+** large, default limits.  Databases managed by external sources can
+** be given much smaller limits designed to prevent a denial of service
+** attack.  Developers might also want to use the [sqlite3_set_authorizer()]
+** interface to further control untrusted SQL.  The size of the database
+** created by an untrusted script can be contained using the
+** [max_page_count] [PRAGMA].
+**
+** New run-time limit categories may be added in future releases.
+*/
+SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
+
+/*
+** CAPI3REF: Run-Time Limit Categories
+** KEYWORDS: {limit category} {*limit categories}
+**
+** These constants define various performance limits
+** that can be lowered at run-time using [sqlite3_limit()].
+** The synopsis of the meanings of the various limits is shown below.
+** Additional information is available at [limits | Limits in SQLite].
+**
+** <dl>
+** [[SQLITE_LIMIT_LENGTH]] ^(<dt>SQLITE_LIMIT_LENGTH</dt>
+** <dd>The maximum size of any string or BLOB or table row, in bytes.<dd>)^
+**
+** [[SQLITE_LIMIT_SQL_LENGTH]] ^(<dt>SQLITE_LIMIT_SQL_LENGTH</dt>
+** <dd>The maximum length of an SQL statement, in bytes.</dd>)^
+**
+** [[SQLITE_LIMIT_COLUMN]] ^(<dt>SQLITE_LIMIT_COLUMN</dt>
+** <dd>The maximum number of columns in a table definition or in the
+** result set of a [SELECT] or the maximum number of columns in an index
+** or in an ORDER BY or GROUP BY clause.</dd>)^
+**
+** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
+** <dd>The maximum depth of the parse tree on any expression.</dd>)^
+**
+** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>
+** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^
+**
+** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>
+** <dd>The maximum number of instructions in a virtual machine program
+** used to implement an SQL statement.  This limit is not currently
+** enforced, though that might be added in some future release of
+** SQLite.</dd>)^
+**
+** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt>
+** <dd>The maximum number of arguments on a function.</dd>)^
+**
+** [[SQLITE_LIMIT_ATTACHED]] ^(<dt>SQLITE_LIMIT_ATTACHED</dt>
+** <dd>The maximum number of [ATTACH | attached databases].)^</dd>
+**
+** [[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]]
+** ^(<dt>SQLITE_LIMIT_LIKE_PATTERN_LENGTH</dt>
+** <dd>The maximum length of the pattern argument to the [LIKE] or
+** [GLOB] operators.</dd>)^
+**
+** [[SQLITE_LIMIT_VARIABLE_NUMBER]]
+** ^(<dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>
+** <dd>The maximum index number of any [parameter] in an SQL statement.)^
+**
+** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
+** <dd>The maximum depth of recursion for triggers.</dd>)^
+** </dl>
+*/
+#define SQLITE_LIMIT_LENGTH                    0
+#define SQLITE_LIMIT_SQL_LENGTH                1
+#define SQLITE_LIMIT_COLUMN                    2
+#define SQLITE_LIMIT_EXPR_DEPTH                3
+#define SQLITE_LIMIT_COMPOUND_SELECT           4
+#define SQLITE_LIMIT_VDBE_OP                   5
+#define SQLITE_LIMIT_FUNCTION_ARG              6
+#define SQLITE_LIMIT_ATTACHED                  7
+#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH       8
+#define SQLITE_LIMIT_VARIABLE_NUMBER           9
+#define SQLITE_LIMIT_TRIGGER_DEPTH            10
+
+/*
+** CAPI3REF: Compiling An SQL Statement
+** KEYWORDS: {SQL statement compiler}
+**
+** To execute an SQL query, it must first be compiled into a byte-code
+** program using one of these routines.
+**
+** The first argument, "db", is a [database connection] obtained from a
+** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
+** [sqlite3_open16()].  The database connection must not have been closed.
+**
+** The second argument, "zSql", is the statement to be compiled, encoded
+** as either UTF-8 or UTF-16.  The sqlite3_prepare() and sqlite3_prepare_v2()
+** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
+** use UTF-16.
+**
+** ^If the nByte argument is less than zero, then zSql is read up to the
+** first zero terminator. ^If nByte is non-negative, then it is the maximum
+** number of  bytes read from zSql.  ^When nByte is non-negative, the
+** zSql string ends at either the first '\000' or '\u0000' character or
+** the nByte-th byte, whichever comes first. If the caller knows
+** that the supplied string is nul-terminated, then there is a small
+** performance advantage to be gained by passing an nByte parameter that
+** is equal to the number of bytes in the input string <i>including</i>
+** the nul-terminator bytes as this saves SQLite from having to
+** make a copy of the input string.
+**
+** ^If pzTail is not NULL then *pzTail is made to point to the first byte
+** past the end of the first SQL statement in zSql.  These routines only
+** compile the first statement in zSql, so *pzTail is left pointing to
+** what remains uncompiled.
+**
+** ^*ppStmt is left pointing to a compiled [prepared statement] that can be
+** executed using [sqlite3_step()].  ^If there is an error, *ppStmt is set
+** to NULL.  ^If the input text contains no SQL (if the input is an empty
+** string or a comment) then *ppStmt is set to NULL.
+** The calling procedure is responsible for deleting the compiled
+** SQL statement using [sqlite3_finalize()] after it has finished with it.
+** ppStmt may not be NULL.
+**
+** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
+** otherwise an [error code] is returned.
+**
+** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
+** recommended for all new programs. The two older interfaces are retained
+** for backwards compatibility, but their use is discouraged.
+** ^In the "v2" interfaces, the prepared statement
+** that is returned (the [sqlite3_stmt] object) contains a copy of the
+** original SQL text. This causes the [sqlite3_step()] interface to
+** behave differently in three ways:
+**
+** <ol>
+** <li>
+** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
+** always used to do, [sqlite3_step()] will automatically recompile the SQL
+** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY]
+** retries will occur before sqlite3_step() gives up and returns an error.
+** </li>
+**
+** <li>
+** ^When an error occurs, [sqlite3_step()] will return one of the detailed
+** [error codes] or [extended error codes].  ^The legacy behavior was that
+** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
+** and the application would have to make a second call to [sqlite3_reset()]
+** in order to find the underlying cause of the problem. With the "v2" prepare
+** interfaces, the underlying reason for the error is returned immediately.
+** </li>
+**
+** <li>
+** ^If the specific value bound to [parameter | host parameter] in the 
+** WHERE clause might influence the choice of query plan for a statement,
+** then the statement will be automatically recompiled, as if there had been 
+** a schema change, on the first  [sqlite3_step()] call following any change
+** to the [sqlite3_bind_text | bindings] of that [parameter]. 
+** ^The specific value of WHERE-clause [parameter] might influence the 
+** choice of query plan if the parameter is the left-hand side of a [LIKE]
+** or [GLOB] operator or if the parameter is compared to an indexed column
+** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
+** </li>
+** </ol>
+*/
+SQLITE_API int sqlite3_prepare(
+  sqlite3 *db,            /* Database handle */
+  const char *zSql,       /* SQL statement, UTF-8 encoded */
+  int nByte,              /* Maximum length of zSql in bytes. */
+  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
+  const char **pzTail     /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare_v2(
+  sqlite3 *db,            /* Database handle */
+  const char *zSql,       /* SQL statement, UTF-8 encoded */
+  int nByte,              /* Maximum length of zSql in bytes. */
+  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
+  const char **pzTail     /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare16(
+  sqlite3 *db,            /* Database handle */
+  const void *zSql,       /* SQL statement, UTF-16 encoded */
+  int nByte,              /* Maximum length of zSql in bytes. */
+  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
+  const void **pzTail     /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare16_v2(
+  sqlite3 *db,            /* Database handle */
+  const void *zSql,       /* SQL statement, UTF-16 encoded */
+  int nByte,              /* Maximum length of zSql in bytes. */
+  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
+  const void **pzTail     /* OUT: Pointer to unused portion of zSql */
+);
+
+/*
+** CAPI3REF: Retrieving Statement SQL
+**
+** ^This interface can be used to retrieve a saved copy of the original
+** SQL text used to create a [prepared statement] if that statement was
+** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
+*/
+SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Determine If An SQL Statement Writes The Database
+**
+** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if
+** and only if the [prepared statement] X makes no direct changes to
+** the content of the database file.
+**
+** Note that [application-defined SQL functions] or
+** [virtual tables] might change the database indirectly as a side effect.  
+** ^(For example, if an application defines a function "eval()" that 
+** calls [sqlite3_exec()], then the following SQL statement would
+** change the database file through side-effects:
+**
+** <blockquote><pre>
+**    SELECT eval('DELETE FROM t1') FROM t2;
+** </pre></blockquote>
+**
+** But because the [SELECT] statement does not change the database file
+** directly, sqlite3_stmt_readonly() would still return true.)^
+**
+** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK],
+** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true,
+** since the statements themselves do not actually modify the database but
+** rather they control the timing of when other statements modify the 
+** database.  ^The [ATTACH] and [DETACH] statements also cause
+** sqlite3_stmt_readonly() to return true since, while those statements
+** change the configuration of a database connection, they do not make 
+** changes to the content of the database files on disk.
+*/
+SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Determine If A Prepared Statement Has Been Reset
+**
+** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the
+** [prepared statement] S has been stepped at least once using 
+** [sqlite3_step(S)] but has not run to completion and/or has not 
+** been reset using [sqlite3_reset(S)].  ^The sqlite3_stmt_busy(S)
+** interface returns false if S is a NULL pointer.  If S is not a 
+** NULL pointer and is not a pointer to a valid [prepared statement]
+** object, then the behavior is undefined and probably undesirable.
+**
+** This interface can be used in combination [sqlite3_next_stmt()]
+** to locate all prepared statements associated with a database 
+** connection that are in need of being reset.  This can be used,
+** for example, in diagnostic routines to search for prepared 
+** statements that are holding a transaction open.
+*/
+SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Dynamically Typed Value Object
+** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
+**
+** SQLite uses the sqlite3_value object to represent all values
+** that can be stored in a database table. SQLite uses dynamic typing
+** for the values it stores.  ^Values stored in sqlite3_value objects
+** can be integers, floating point values, strings, BLOBs, or NULL.
+**
+** An sqlite3_value object may be either "protected" or "unprotected".
+** Some interfaces require a protected sqlite3_value.  Other interfaces
+** will accept either a protected or an unprotected sqlite3_value.
+** Every interface that accepts sqlite3_value arguments specifies
+** whether or not it requires a protected sqlite3_value.
+**
+** The terms "protected" and "unprotected" refer to whether or not
+** a mutex is held.  An internal mutex is held for a protected
+** sqlite3_value object but no mutex is held for an unprotected
+** sqlite3_value object.  If SQLite is compiled to be single-threaded
+** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
+** or if SQLite is run in one of reduced mutex modes 
+** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
+** then there is no distinction between protected and unprotected
+** sqlite3_value objects and they can be used interchangeably.  However,
+** for maximum code portability it is recommended that applications
+** still make the distinction between protected and unprotected
+** sqlite3_value objects even when not strictly required.
+**
+** ^The sqlite3_value objects that are passed as parameters into the
+** implementation of [application-defined SQL functions] are protected.
+** ^The sqlite3_value object returned by
+** [sqlite3_column_value()] is unprotected.
+** Unprotected sqlite3_value objects may only be used with
+** [sqlite3_result_value()] and [sqlite3_bind_value()].
+** The [sqlite3_value_blob | sqlite3_value_type()] family of
+** interfaces require protected sqlite3_value objects.
+*/
+typedef struct Mem sqlite3_value;
+
+/*
+** CAPI3REF: SQL Function Context Object
+**
+** The context in which an SQL function executes is stored in an
+** sqlite3_context object.  ^A pointer to an sqlite3_context object
+** is always first parameter to [application-defined SQL functions].
+** The application-defined SQL function implementation will pass this
+** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
+** [sqlite3_aggregate_context()], [sqlite3_user_data()],
+** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
+** and/or [sqlite3_set_auxdata()].
+*/
+typedef struct sqlite3_context sqlite3_context;
+
+/*
+** CAPI3REF: Binding Values To Prepared Statements
+** KEYWORDS: {host parameter} {host parameters} {host parameter name}
+** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
+**
+** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
+** literals may be replaced by a [parameter] that matches one of following
+** templates:
+**
+** <ul>
+** <li>  ?
+** <li>  ?NNN
+** <li>  :VVV
+** <li>  @VVV
+** <li>  $VVV
+** </ul>
+**
+** In the templates above, NNN represents an integer literal,
+** and VVV represents an alphanumeric identifier.)^  ^The values of these
+** parameters (also called "host parameter names" or "SQL parameters")
+** can be set using the sqlite3_bind_*() routines defined here.
+**
+** ^The first argument to the sqlite3_bind_*() routines is always
+** a pointer to the [sqlite3_stmt] object returned from
+** [sqlite3_prepare_v2()] or its variants.
+**
+** ^The second argument is the index of the SQL parameter to be set.
+** ^The leftmost SQL parameter has an index of 1.  ^When the same named
+** SQL parameter is used more than once, second and subsequent
+** occurrences have the same index as the first occurrence.
+** ^The index for named parameters can be looked up using the
+** [sqlite3_bind_parameter_index()] API if desired.  ^The index
+** for "?NNN" parameters is the value of NNN.
+** ^The NNN value must be between 1 and the [sqlite3_limit()]
+** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999).
+**
+** ^The third argument is the value to bind to the parameter.
+** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16()
+** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter
+** is ignored and the end result is the same as sqlite3_bind_null().
+**
+** ^(In those routines that have a fourth argument, its value is the
+** number of bytes in the parameter.  To be clear: the value is the
+** number of <u>bytes</u> in the value, not the number of characters.)^
+** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16()
+** is negative, then the length of the string is
+** the number of bytes up to the first zero terminator.
+** If the fourth parameter to sqlite3_bind_blob() is negative, then
+** the behavior is undefined.
+** If a non-negative fourth parameter is provided to sqlite3_bind_text()
+** or sqlite3_bind_text16() then that parameter must be the byte offset
+** where the NUL terminator would occur assuming the string were NUL
+** terminated.  If any NUL characters occur at byte offsets less than 
+** the value of the fourth parameter then the resulting string value will
+** contain embedded NULs.  The result of expressions involving strings
+** with embedded NULs is undefined.
+**
+** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and
+** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or
+** string after SQLite has finished with it.  ^The destructor is called
+** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(),
+** sqlite3_bind_text(), or sqlite3_bind_text16() fails.  
+** ^If the fifth argument is
+** the special value [SQLITE_STATIC], then SQLite assumes that the
+** information is in static, unmanaged space and does not need to be freed.
+** ^If the fifth argument has the value [SQLITE_TRANSIENT], then
+** SQLite makes its own private copy of the data immediately, before
+** the sqlite3_bind_*() routine returns.
+**
+** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
+** is filled with zeroes.  ^A zeroblob uses a fixed amount of memory
+** (just an integer to hold its size) while it is being processed.
+** Zeroblobs are intended to serve as placeholders for BLOBs whose
+** content is later written using
+** [sqlite3_blob_open | incremental BLOB I/O] routines.
+** ^A negative value for the zeroblob results in a zero-length BLOB.
+**
+** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
+** for the [prepared statement] or with a prepared statement for which
+** [sqlite3_step()] has been called more recently than [sqlite3_reset()],
+** then the call will return [SQLITE_MISUSE].  If any sqlite3_bind_()
+** routine is passed a [prepared statement] that has been finalized, the
+** result is undefined and probably harmful.
+**
+** ^Bindings are not cleared by the [sqlite3_reset()] routine.
+** ^Unbound parameters are interpreted as NULL.
+**
+** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an
+** [error code] if anything goes wrong.
+** ^[SQLITE_RANGE] is returned if the parameter
+** index is out of range.  ^[SQLITE_NOMEM] is returned if malloc() fails.
+**
+** See also: [sqlite3_bind_parameter_count()],
+** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
+*/
+SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
+SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
+SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
+SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
+SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
+SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));
+SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
+SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
+SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
+
+/*
+** CAPI3REF: Number Of SQL Parameters
+**
+** ^This routine can be used to find the number of [SQL parameters]
+** in a [prepared statement].  SQL parameters are tokens of the
+** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as
+** placeholders for values that are [sqlite3_bind_blob | bound]
+** to the parameters at a later time.
+**
+** ^(This routine actually returns the index of the largest (rightmost)
+** parameter. For all forms except ?NNN, this will correspond to the
+** number of unique parameters.  If parameters of the ?NNN form are used,
+** there may be gaps in the list.)^
+**
+** See also: [sqlite3_bind_blob|sqlite3_bind()],
+** [sqlite3_bind_parameter_name()], and
+** [sqlite3_bind_parameter_index()].
+*/
+SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Name Of A Host Parameter
+**
+** ^The sqlite3_bind_parameter_name(P,N) interface returns
+** the name of the N-th [SQL parameter] in the [prepared statement] P.
+** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA"
+** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA"
+** respectively.
+** In other words, the initial ":" or "$" or "@" or "?"
+** is included as part of the name.)^
+** ^Parameters of the form "?" without a following integer have no name
+** and are referred to as "nameless" or "anonymous parameters".
+**
+** ^The first host parameter has an index of 1, not 0.
+**
+** ^If the value N is out of range or if the N-th parameter is
+** nameless, then NULL is returned.  ^The returned string is
+** always in UTF-8 encoding even if the named parameter was
+** originally specified as UTF-16 in [sqlite3_prepare16()] or
+** [sqlite3_prepare16_v2()].
+**
+** See also: [sqlite3_bind_blob|sqlite3_bind()],
+** [sqlite3_bind_parameter_count()], and
+** [sqlite3_bind_parameter_index()].
+*/
+SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
+
+/*
+** CAPI3REF: Index Of A Parameter With A Given Name
+**
+** ^Return the index of an SQL parameter given its name.  ^The
+** index value returned is suitable for use as the second
+** parameter to [sqlite3_bind_blob|sqlite3_bind()].  ^A zero
+** is returned if no matching parameter is found.  ^The parameter
+** name must be given in UTF-8 even if the original statement
+** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
+**
+** See also: [sqlite3_bind_blob|sqlite3_bind()],
+** [sqlite3_bind_parameter_count()], and
+** [sqlite3_bind_parameter_index()].
+*/
+SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
+
+/*
+** CAPI3REF: Reset All Bindings On A Prepared Statement
+**
+** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
+** the [sqlite3_bind_blob | bindings] on a [prepared statement].
+** ^Use this routine to reset all host parameters to NULL.
+*/
+SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Number Of Columns In A Result Set
+**
+** ^Return the number of columns in the result set returned by the
+** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
+** statement that does not return data (for example an [UPDATE]).
+**
+** See also: [sqlite3_data_count()]
+*/
+SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Column Names In A Result Set
+**
+** ^These routines return the name assigned to a particular column
+** in the result set of a [SELECT] statement.  ^The sqlite3_column_name()
+** interface returns a pointer to a zero-terminated UTF-8 string
+** and sqlite3_column_name16() returns a pointer to a zero-terminated
+** UTF-16 string.  ^The first parameter is the [prepared statement]
+** that implements the [SELECT] statement. ^The second parameter is the
+** column number.  ^The leftmost column is number 0.
+**
+** ^The returned string pointer is valid until either the [prepared statement]
+** is destroyed by [sqlite3_finalize()] or until the statement is automatically
+** reprepared by the first call to [sqlite3_step()] for a particular run
+** or until the next call to
+** sqlite3_column_name() or sqlite3_column_name16() on the same column.
+**
+** ^If sqlite3_malloc() fails during the processing of either routine
+** (for example during a conversion from UTF-8 to UTF-16) then a
+** NULL pointer is returned.
+**
+** ^The name of a result column is the value of the "AS" clause for
+** that column, if there is an AS clause.  If there is no AS clause
+** then the name of the column is unspecified and may change from
+** one release of SQLite to the next.
+*/
+SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
+SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
+
+/*
+** CAPI3REF: Source Of Data In A Query Result
+**
+** ^These routines provide a means to determine the database, table, and
+** table column that is the origin of a particular result column in
+** [SELECT] statement.
+** ^The name of the database or table or column can be returned as
+** either a UTF-8 or UTF-16 string.  ^The _database_ routines return
+** the database name, the _table_ routines return the table name, and
+** the origin_ routines return the column name.
+** ^The returned string is valid until the [prepared statement] is destroyed
+** using [sqlite3_finalize()] or until the statement is automatically
+** reprepared by the first call to [sqlite3_step()] for a particular run
+** or until the same information is requested
+** again in a different encoding.
+**
+** ^The names returned are the original un-aliased names of the
+** database, table, and column.
+**
+** ^The first argument to these interfaces is a [prepared statement].
+** ^These functions return information about the Nth result column returned by
+** the statement, where N is the second function argument.
+** ^The left-most column is column 0 for these routines.
+**
+** ^If the Nth column returned by the statement is an expression or
+** subquery and is not a column value, then all of these functions return
+** NULL.  ^These routine might also return NULL if a memory allocation error
+** occurs.  ^Otherwise, they return the name of the attached database, table,
+** or column that query result column was extracted from.
+**
+** ^As with all other SQLite APIs, those whose names end with "16" return
+** UTF-16 encoded strings and the other functions return UTF-8.
+**
+** ^These APIs are only available if the library was compiled with the
+** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.
+**
+** If two or more threads call one or more of these routines against the same
+** prepared statement and column at the same time then the results are
+** undefined.
+**
+** If two or more threads call one or more
+** [sqlite3_column_database_name | column metadata interfaces]
+** for the same [prepared statement] and result column
+** at the same time then the results are undefined.
+*/
+SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
+SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
+SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
+
+/*
+** CAPI3REF: Declared Datatype Of A Query Result
+**
+** ^(The first parameter is a [prepared statement].
+** If this statement is a [SELECT] statement and the Nth column of the
+** returned result set of that [SELECT] is a table column (not an
+** expression or subquery) then the declared type of the table
+** column is returned.)^  ^If the Nth column of the result set is an
+** expression or subquery, then a NULL pointer is returned.
+** ^The returned string is always UTF-8 encoded.
+**
+** ^(For example, given the database schema:
+**
+** CREATE TABLE t1(c1 VARIANT);
+**
+** and the following statement to be compiled:
+**
+** SELECT c1 + 1, c1 FROM t1;
+**
+** this routine would return the string "VARIANT" for the second result
+** column (i==1), and a NULL pointer for the first result column (i==0).)^
+**
+** ^SQLite uses dynamic run-time typing.  ^So just because a column
+** is declared to contain a particular type does not mean that the
+** data stored in that column is of the declared type.  SQLite is
+** strongly typed, but the typing is dynamic not static.  ^Type
+** is associated with individual values, not with the containers
+** used to hold those values.
+*/
+SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
+
+/*
+** CAPI3REF: Evaluate An SQL Statement
+**
+** After a [prepared statement] has been prepared using either
+** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
+** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
+** must be called one or more times to evaluate the statement.
+**
+** The details of the behavior of the sqlite3_step() interface depend
+** on whether the statement was prepared using the newer "v2" interface
+** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
+** interface [sqlite3_prepare()] and [sqlite3_prepare16()].  The use of the
+** new "v2" interface is recommended for new applications but the legacy
+** interface will continue to be supported.
+**
+** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
+** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].
+** ^With the "v2" interface, any of the other [result codes] or
+** [extended result codes] might be returned as well.
+**
+** ^[SQLITE_BUSY] means that the database engine was unable to acquire the
+** database locks it needs to do its job.  ^If the statement is a [COMMIT]
+** or occurs outside of an explicit transaction, then you can retry the
+** statement.  If the statement is not a [COMMIT] and occurs within an
+** explicit transaction then you should rollback the transaction before
+** continuing.
+**
+** ^[SQLITE_DONE] means that the statement has finished executing
+** successfully.  sqlite3_step() should not be called again on this virtual
+** machine without first calling [sqlite3_reset()] to reset the virtual
+** machine back to its initial state.
+**
+** ^If the SQL statement being executed returns any data, then [SQLITE_ROW]
+** is returned each time a new row of data is ready for processing by the
+** caller. The values may be accessed using the [column access functions].
+** sqlite3_step() is called again to retrieve the next row of data.
+**
+** ^[SQLITE_ERROR] means that a run-time error (such as a constraint
+** violation) has occurred.  sqlite3_step() should not be called again on
+** the VM. More information may be found by calling [sqlite3_errmsg()].
+** ^With the legacy interface, a more specific error code (for example,
+** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)
+** can be obtained by calling [sqlite3_reset()] on the
+** [prepared statement].  ^In the "v2" interface,
+** the more specific error code is returned directly by sqlite3_step().
+**
+** [SQLITE_MISUSE] means that the this routine was called inappropriately.
+** Perhaps it was called on a [prepared statement] that has
+** already been [sqlite3_finalize | finalized] or on one that had
+** previously returned [SQLITE_ERROR] or [SQLITE_DONE].  Or it could
+** be the case that the same database connection is being used by two or
+** more threads at the same moment in time.
+**
+** For all versions of SQLite up to and including 3.6.23.1, a call to
+** [sqlite3_reset()] was required after sqlite3_step() returned anything
+** other than [SQLITE_ROW] before any subsequent invocation of
+** sqlite3_step().  Failure to reset the prepared statement using 
+** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
+** sqlite3_step().  But after version 3.6.23.1, sqlite3_step() began
+** calling [sqlite3_reset()] automatically in this circumstance rather
+** than returning [SQLITE_MISUSE].  This is not considered a compatibility
+** break because any application that ever receives an SQLITE_MISUSE error
+** is broken by definition.  The [SQLITE_OMIT_AUTORESET] compile-time option
+** can be used to restore the legacy behavior.
+**
+** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()
+** API always returns a generic error code, [SQLITE_ERROR], following any
+** error other than [SQLITE_BUSY] and [SQLITE_MISUSE].  You must call
+** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the
+** specific [error codes] that better describes the error.
+** We admit that this is a goofy design.  The problem has been fixed
+** with the "v2" interface.  If you prepare all of your SQL statements
+** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
+** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
+** then the more specific [error codes] are returned directly
+** by sqlite3_step().  The use of the "v2" interface is recommended.
+*/
+SQLITE_API int sqlite3_step(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Number of columns in a result set
+**
+** ^The sqlite3_data_count(P) interface returns the number of columns in the
+** current row of the result set of [prepared statement] P.
+** ^If prepared statement P does not have results ready to return
+** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of
+** interfaces) then sqlite3_data_count(P) returns 0.
+** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.
+** ^The sqlite3_data_count(P) routine returns 0 if the previous call to
+** [sqlite3_step](P) returned [SQLITE_DONE].  ^The sqlite3_data_count(P)
+** will return non-zero if previous call to [sqlite3_step](P) returned
+** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum]
+** where it always returns zero since each step of that multi-step
+** pragma returns 0 columns of data.
+**
+** See also: [sqlite3_column_count()]
+*/
+SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Fundamental Datatypes
+** KEYWORDS: SQLITE_TEXT
+**
+** ^(Every value in SQLite has one of five fundamental datatypes:
+**
+** <ul>
+** <li> 64-bit signed integer
+** <li> 64-bit IEEE floating point number
+** <li> string
+** <li> BLOB
+** <li> NULL
+** </ul>)^
+**
+** These constants are codes for each of those types.
+**
+** Note that the SQLITE_TEXT constant was also used in SQLite version 2
+** for a completely different meaning.  Software that links against both
+** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not
+** SQLITE_TEXT.
+*/
+#define SQLITE_INTEGER  1
+#define SQLITE_FLOAT    2
+#define SQLITE_BLOB     4
+#define SQLITE_NULL     5
+#ifdef SQLITE_TEXT
+# undef SQLITE_TEXT
+#else
+# define SQLITE_TEXT     3
+#endif
+#define SQLITE3_TEXT     3
+
+/*
+** CAPI3REF: Result Values From A Query
+** KEYWORDS: {column access functions}
+**
+** These routines form the "result set" interface.
+**
+** ^These routines return information about a single column of the current
+** result row of a query.  ^In every case the first argument is a pointer
+** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
+** that was returned from [sqlite3_prepare_v2()] or one of its variants)
+** and the second argument is the index of the column for which information
+** should be returned. ^The leftmost column of the result set has the index 0.
+** ^The number of columns in the result can be determined using
+** [sqlite3_column_count()].
+**
+** If the SQL statement does not currently point to a valid row, or if the
+** column index is out of range, the result is undefined.
+** These routines may only be called when the most recent call to
+** [sqlite3_step()] has returned [SQLITE_ROW] and neither
+** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.
+** If any of these routines are called after [sqlite3_reset()] or
+** [sqlite3_finalize()] or after [sqlite3_step()] has returned
+** something other than [SQLITE_ROW], the results are undefined.
+** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
+** are called from a different thread while any of these routines
+** are pending, then the results are undefined.
+**
+** ^The sqlite3_column_type() routine returns the
+** [SQLITE_INTEGER | datatype code] for the initial data type
+** of the result column.  ^The returned value is one of [SQLITE_INTEGER],
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].  The value
+** returned by sqlite3_column_type() is only meaningful if no type
+** conversions have occurred as described below.  After a type conversion,
+** the value returned by sqlite3_column_type() is undefined.  Future
+** versions of SQLite may change the behavior of sqlite3_column_type()
+** following a type conversion.
+**
+** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
+** routine returns the number of bytes in that BLOB or string.
+** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
+** the string to UTF-8 and then returns the number of bytes.
+** ^If the result is a numeric value then sqlite3_column_bytes() uses
+** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns
+** the number of bytes in that string.
+** ^If the result is NULL, then sqlite3_column_bytes() returns zero.
+**
+** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16()
+** routine returns the number of bytes in that BLOB or string.
+** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts
+** the string to UTF-16 and then returns the number of bytes.
+** ^If the result is a numeric value then sqlite3_column_bytes16() uses
+** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns
+** the number of bytes in that string.
+** ^If the result is NULL, then sqlite3_column_bytes16() returns zero.
+**
+** ^The values returned by [sqlite3_column_bytes()] and 
+** [sqlite3_column_bytes16()] do not include the zero terminators at the end
+** of the string.  ^For clarity: the values returned by
+** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of
+** bytes in the string, not the number of characters.
+**
+** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
+** even empty strings, are always zero-terminated.  ^The return
+** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
+**
+** ^The object returned by [sqlite3_column_value()] is an
+** [unprotected sqlite3_value] object.  An unprotected sqlite3_value object
+** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()].
+** If the [unprotected sqlite3_value] object returned by
+** [sqlite3_column_value()] is used in any other way, including calls
+** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
+** or [sqlite3_value_bytes()], then the behavior is undefined.
+**
+** These routines attempt to convert the value where appropriate.  ^For
+** example, if the internal representation is FLOAT and a text result
+** is requested, [sqlite3_snprintf()] is used internally to perform the
+** conversion automatically.  ^(The following table details the conversions
+** that are applied:
+**
+** <blockquote>
+** <table border="1">
+** <tr><th> Internal<br>Type <th> Requested<br>Type <th>  Conversion
+**
+** <tr><td>  NULL    <td> INTEGER   <td> Result is 0
+** <tr><td>  NULL    <td>  FLOAT    <td> Result is 0.0
+** <tr><td>  NULL    <td>   TEXT    <td> Result is a NULL pointer
+** <tr><td>  NULL    <td>   BLOB    <td> Result is a NULL pointer
+** <tr><td> INTEGER  <td>  FLOAT    <td> Convert from integer to float
+** <tr><td> INTEGER  <td>   TEXT    <td> ASCII rendering of the integer
+** <tr><td> INTEGER  <td>   BLOB    <td> Same as INTEGER->TEXT
+** <tr><td>  FLOAT   <td> INTEGER   <td> [CAST] to INTEGER
+** <tr><td>  FLOAT   <td>   TEXT    <td> ASCII rendering of the float
+** <tr><td>  FLOAT   <td>   BLOB    <td> [CAST] to BLOB
+** <tr><td>  TEXT    <td> INTEGER   <td> [CAST] to INTEGER
+** <tr><td>  TEXT    <td>  FLOAT    <td> [CAST] to REAL
+** <tr><td>  TEXT    <td>   BLOB    <td> No change
+** <tr><td>  BLOB    <td> INTEGER   <td> [CAST] to INTEGER
+** <tr><td>  BLOB    <td>  FLOAT    <td> [CAST] to REAL
+** <tr><td>  BLOB    <td>   TEXT    <td> Add a zero terminator if needed
+** </table>
+** </blockquote>)^
+**
+** The table above makes reference to standard C library functions atoi()
+** and atof().  SQLite does not really use these functions.  It has its
+** own equivalent internal routines.  The atoi() and atof() names are
+** used in the table for brevity and because they are familiar to most
+** C programmers.
+**
+** Note that when type conversions occur, pointers returned by prior
+** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
+** sqlite3_column_text16() may be invalidated.
+** Type conversions and pointer invalidations might occur
+** in the following cases:
+**
+** <ul>
+** <li> The initial content is a BLOB and sqlite3_column_text() or
+**      sqlite3_column_text16() is called.  A zero-terminator might
+**      need to be added to the string.</li>
+** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or
+**      sqlite3_column_text16() is called.  The content must be converted
+**      to UTF-16.</li>
+** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or
+**      sqlite3_column_text() is called.  The content must be converted
+**      to UTF-8.</li>
+** </ul>
+**
+** ^Conversions between UTF-16be and UTF-16le are always done in place and do
+** not invalidate a prior pointer, though of course the content of the buffer
+** that the prior pointer references will have been modified.  Other kinds
+** of conversion are done in place when it is possible, but sometimes they
+** are not possible and in those cases prior pointers are invalidated.
+**
+** The safest and easiest to remember policy is to invoke these routines
+** in one of the following ways:
+**
+** <ul>
+**  <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>
+**  <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>
+**  <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>
+** </ul>
+**
+** In other words, you should call sqlite3_column_text(),
+** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result
+** into the desired format, then invoke sqlite3_column_bytes() or
+** sqlite3_column_bytes16() to find the size of the result.  Do not mix calls
+** to sqlite3_column_text() or sqlite3_column_blob() with calls to
+** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()
+** with calls to sqlite3_column_bytes().
+**
+** ^The pointers returned are valid until a type conversion occurs as
+** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
+** [sqlite3_finalize()] is called.  ^The memory space used to hold strings
+** and BLOBs is freed automatically.  Do <b>not</b> pass the pointers returned
+** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
+** [sqlite3_free()].
+**
+** ^(If a memory allocation error occurs during the evaluation of any
+** of these routines, a default value is returned.  The default value
+** is either the integer 0, the floating point number 0.0, or a NULL
+** pointer.  Subsequent calls to [sqlite3_errcode()] will return
+** [SQLITE_NOMEM].)^
+*/
+SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
+SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
+SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
+SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
+SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
+SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
+
+/*
+** CAPI3REF: Destroy A Prepared Statement Object
+**
+** ^The sqlite3_finalize() function is called to delete a [prepared statement].
+** ^If the most recent evaluation of the statement encountered no errors
+** or if the statement is never been evaluated, then sqlite3_finalize() returns
+** SQLITE_OK.  ^If the most recent evaluation of statement S failed, then
+** sqlite3_finalize(S) returns the appropriate [error code] or
+** [extended error code].
+**
+** ^The sqlite3_finalize(S) routine can be called at any point during
+** the life cycle of [prepared statement] S:
+** before statement S is ever evaluated, after
+** one or more calls to [sqlite3_reset()], or after any call
+** to [sqlite3_step()] regardless of whether or not the statement has
+** completed execution.
+**
+** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op.
+**
+** The application must finalize every [prepared statement] in order to avoid
+** resource leaks.  It is a grievous error for the application to try to use
+** a prepared statement after it has been finalized.  Any use of a prepared
+** statement after it has been finalized can result in undefined and
+** undesirable behavior such as segfaults and heap corruption.
+*/
+SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Reset A Prepared Statement Object
+**
+** The sqlite3_reset() function is called to reset a [prepared statement]
+** object back to its initial state, ready to be re-executed.
+** ^Any SQL statement variables that had values bound to them using
+** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.
+** Use [sqlite3_clear_bindings()] to reset the bindings.
+**
+** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
+** back to the beginning of its program.
+**
+** ^If the most recent call to [sqlite3_step(S)] for the
+** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],
+** or if [sqlite3_step(S)] has never before been called on S,
+** then [sqlite3_reset(S)] returns [SQLITE_OK].
+**
+** ^If the most recent call to [sqlite3_step(S)] for the
+** [prepared statement] S indicated an error, then
+** [sqlite3_reset(S)] returns an appropriate [error code].
+**
+** ^The [sqlite3_reset(S)] interface does not change the values
+** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
+*/
+SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Create Or Redefine SQL Functions
+** KEYWORDS: {function creation routines}
+** KEYWORDS: {application-defined SQL function}
+** KEYWORDS: {application-defined SQL functions}
+**
+** ^These functions (collectively known as "function creation routines")
+** are used to add SQL functions or aggregates or to redefine the behavior
+** of existing SQL functions or aggregates.  The only differences between
+** these routines are the text encoding expected for
+** the second parameter (the name of the function being created)
+** and the presence or absence of a destructor callback for
+** the application data pointer.
+**
+** ^The first parameter is the [database connection] to which the SQL
+** function is to be added.  ^If an application uses more than one database
+** connection then application-defined SQL functions must be added
+** to each database connection separately.
+**
+** ^The second parameter is the name of the SQL function to be created or
+** redefined.  ^The length of the name is limited to 255 bytes in a UTF-8
+** representation, exclusive of the zero-terminator.  ^Note that the name
+** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes.  
+** ^Any attempt to create a function with a longer name
+** will result in [SQLITE_MISUSE] being returned.
+**
+** ^The third parameter (nArg)
+** is the number of arguments that the SQL function or
+** aggregate takes. ^If this parameter is -1, then the SQL function or
+** aggregate may take any number of arguments between 0 and the limit
+** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]).  If the third
+** parameter is less than -1 or greater than 127 then the behavior is
+** undefined.
+**
+** ^The fourth parameter, eTextRep, specifies what
+** [SQLITE_UTF8 | text encoding] this SQL function prefers for
+** its parameters.  The application should set this parameter to
+** [SQLITE_UTF16LE] if the function implementation invokes 
+** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the
+** implementation invokes [sqlite3_value_text16be()] on an input, or
+** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8]
+** otherwise.  ^The same SQL function may be registered multiple times using
+** different preferred text encodings, with different implementations for
+** each encoding.
+** ^When multiple implementations of the same function are available, SQLite
+** will pick the one that involves the least amount of data conversion.
+**
+** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC]
+** to signal that the function will always return the same result given
+** the same inputs within a single SQL statement.  Most SQL functions are
+** deterministic.  The built-in [random()] SQL function is an example of a
+** function that is not deterministic.  The SQLite query planner is able to
+** perform additional optimizations on deterministic functions, so use
+** of the [SQLITE_DETERMINISTIC] flag is recommended where possible.
+**
+** ^(The fifth parameter is an arbitrary pointer.  The implementation of the
+** function can gain access to this pointer using [sqlite3_user_data()].)^
+**
+** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are
+** pointers to C-language functions that implement the SQL function or
+** aggregate. ^A scalar SQL function requires an implementation of the xFunc
+** callback only; NULL pointers must be passed as the xStep and xFinal
+** parameters. ^An aggregate SQL function requires an implementation of xStep
+** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
+** SQL function or aggregate, pass NULL pointers for all three function
+** callbacks.
+**
+** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,
+** then it is destructor for the application data pointer. 
+** The destructor is invoked when the function is deleted, either by being
+** overloaded or when the database connection closes.)^
+** ^The destructor is also invoked if the call to
+** sqlite3_create_function_v2() fails.
+** ^When the destructor callback of the tenth parameter is invoked, it
+** is passed a single argument which is a copy of the application data 
+** pointer which was the fifth parameter to sqlite3_create_function_v2().
+**
+** ^It is permitted to register multiple implementations of the same
+** functions with the same name but with either differing numbers of
+** arguments or differing preferred text encodings.  ^SQLite will use
+** the implementation that most closely matches the way in which the
+** SQL function is used.  ^A function implementation with a non-negative
+** nArg parameter is a better match than a function implementation with
+** a negative nArg.  ^A function where the preferred text encoding
+** matches the database encoding is a better
+** match than a function where the encoding is different.  
+** ^A function where the encoding difference is between UTF16le and UTF16be
+** is a closer match than a function where the encoding difference is
+** between UTF8 and UTF16.
+**
+** ^Built-in functions may be overloaded by new application-defined functions.
+**
+** ^An application-defined function is permitted to call other
+** SQLite interfaces.  However, such calls must not
+** close the database connection nor finalize or reset the prepared
+** statement in which the function is running.
+*/
+SQLITE_API int sqlite3_create_function(
+  sqlite3 *db,
+  const char *zFunctionName,
+  int nArg,
+  int eTextRep,
+  void *pApp,
+  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+  void (*xFinal)(sqlite3_context*)
+);
+SQLITE_API int sqlite3_create_function16(
+  sqlite3 *db,
+  const void *zFunctionName,
+  int nArg,
+  int eTextRep,
+  void *pApp,
+  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+  void (*xFinal)(sqlite3_context*)
+);
+SQLITE_API int sqlite3_create_function_v2(
+  sqlite3 *db,
+  const char *zFunctionName,
+  int nArg,
+  int eTextRep,
+  void *pApp,
+  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+  void (*xFinal)(sqlite3_context*),
+  void(*xDestroy)(void*)
+);
+
+/*
+** CAPI3REF: Text Encodings
+**
+** These constant define integer codes that represent the various
+** text encodings supported by SQLite.
+*/
+#define SQLITE_UTF8           1
+#define SQLITE_UTF16LE        2
+#define SQLITE_UTF16BE        3
+#define SQLITE_UTF16          4    /* Use native byte order */
+#define SQLITE_ANY            5    /* Deprecated */
+#define SQLITE_UTF16_ALIGNED  8    /* sqlite3_create_collation only */
+
+/*
+** CAPI3REF: Function Flags
+**
+** These constants may be ORed together with the 
+** [SQLITE_UTF8 | preferred text encoding] as the fourth argument
+** to [sqlite3_create_function()], [sqlite3_create_function16()], or
+** [sqlite3_create_function_v2()].
+*/
+#define SQLITE_DETERMINISTIC    0x800
+
+/*
+** CAPI3REF: Deprecated Functions
+** DEPRECATED
+**
+** These functions are [deprecated].  In order to maintain
+** backwards compatibility with older code, these functions continue 
+** to be supported.  However, new applications should avoid
+** the use of these functions.  To help encourage people to avoid
+** using these functions, we are not going to tell you what they do.
+*/
+#ifndef SQLITE_OMIT_DEPRECATED
+SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
+SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
+                      void*,sqlite3_int64);
+#endif
+
+/*
+** CAPI3REF: Obtaining SQL Function Parameter Values
+**
+** The C-language implementation of SQL functions and aggregates uses
+** this set of interface routines to access the parameter values on
+** the function or aggregate.
+**
+** The xFunc (for scalar functions) or xStep (for aggregates) parameters
+** to [sqlite3_create_function()] and [sqlite3_create_function16()]
+** define callbacks that implement the SQL functions and aggregates.
+** The 3rd parameter to these callbacks is an array of pointers to
+** [protected sqlite3_value] objects.  There is one [sqlite3_value] object for
+** each parameter to the SQL function.  These routines are used to
+** extract values from the [sqlite3_value] objects.
+**
+** These routines work only with [protected sqlite3_value] objects.
+** Any attempt to use these routines on an [unprotected sqlite3_value]
+** object results in undefined behavior.
+**
+** ^These routines work just like the corresponding [column access functions]
+** except that  these routines take a single [protected sqlite3_value] object
+** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
+**
+** ^The sqlite3_value_text16() interface extracts a UTF-16 string
+** in the native byte-order of the host machine.  ^The
+** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
+** extract UTF-16 strings as big-endian and little-endian respectively.
+**
+** ^(The sqlite3_value_numeric_type() interface attempts to apply
+** numeric affinity to the value.  This means that an attempt is
+** made to convert the value to an integer or floating point.  If
+** such a conversion is possible without loss of information (in other
+** words, if the value is a string that looks like a number)
+** then the conversion is performed.  Otherwise no conversion occurs.
+** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
+**
+** Please pay particular attention to the fact that the pointer returned
+** from [sqlite3_value_blob()], [sqlite3_value_text()], or
+** [sqlite3_value_text16()] can be invalidated by a subsequent call to
+** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
+** or [sqlite3_value_text16()].
+**
+** These routines must be called from the same thread as
+** the SQL function that supplied the [sqlite3_value*] parameters.
+*/
+SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
+SQLITE_API double sqlite3_value_double(sqlite3_value*);
+SQLITE_API int sqlite3_value_int(sqlite3_value*);
+SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
+SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
+SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
+SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
+SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
+SQLITE_API int sqlite3_value_type(sqlite3_value*);
+SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
+
+/*
+** CAPI3REF: Obtain Aggregate Function Context
+**
+** Implementations of aggregate SQL functions use this
+** routine to allocate memory for storing their state.
+**
+** ^The first time the sqlite3_aggregate_context(C,N) routine is called 
+** for a particular aggregate function, SQLite
+** allocates N of memory, zeroes out that memory, and returns a pointer
+** to the new memory. ^On second and subsequent calls to
+** sqlite3_aggregate_context() for the same aggregate function instance,
+** the same buffer is returned.  Sqlite3_aggregate_context() is normally
+** called once for each invocation of the xStep callback and then one
+** last time when the xFinal callback is invoked.  ^(When no rows match
+** an aggregate query, the xStep() callback of the aggregate function
+** implementation is never called and xFinal() is called exactly once.
+** In those cases, sqlite3_aggregate_context() might be called for the
+** first time from within xFinal().)^
+**
+** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer 
+** when first called if N is less than or equal to zero or if a memory
+** allocate error occurs.
+**
+** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
+** determined by the N parameter on first successful call.  Changing the
+** value of N in subsequent call to sqlite3_aggregate_context() within
+** the same aggregate function instance will not resize the memory
+** allocation.)^  Within the xFinal callback, it is customary to set
+** N=0 in calls to sqlite3_aggregate_context(C,N) so that no 
+** pointless memory allocations occur.
+**
+** ^SQLite automatically frees the memory allocated by 
+** sqlite3_aggregate_context() when the aggregate query concludes.
+**
+** The first parameter must be a copy of the
+** [sqlite3_context | SQL function context] that is the first parameter
+** to the xStep or xFinal callback routine that implements the aggregate
+** function.
+**
+** This routine must be called from the same thread in which
+** the aggregate SQL function is running.
+*/
+SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
+
+/*
+** CAPI3REF: User Data For Functions
+**
+** ^The sqlite3_user_data() interface returns a copy of
+** the pointer that was the pUserData parameter (the 5th parameter)
+** of the [sqlite3_create_function()]
+** and [sqlite3_create_function16()] routines that originally
+** registered the application defined function.
+**
+** This routine must be called from the same thread in which
+** the application-defined function is running.
+*/
+SQLITE_API void *sqlite3_user_data(sqlite3_context*);
+
+/*
+** CAPI3REF: Database Connection For Functions
+**
+** ^The sqlite3_context_db_handle() interface returns a copy of
+** the pointer to the [database connection] (the 1st parameter)
+** of the [sqlite3_create_function()]
+** and [sqlite3_create_function16()] routines that originally
+** registered the application defined function.
+*/
+SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
+
+/*
+** CAPI3REF: Function Auxiliary Data
+**
+** These functions may be used by (non-aggregate) SQL functions to
+** associate metadata with argument values. If the same value is passed to
+** multiple invocations of the same SQL function during query execution, under
+** some circumstances the associated metadata may be preserved.  An example
+** of where this might be useful is in a regular-expression matching
+** function. The compiled version of the regular expression can be stored as
+** metadata associated with the pattern string.  
+** Then as long as the pattern string remains the same,
+** the compiled regular expression can be reused on multiple
+** invocations of the same function.
+**
+** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata
+** associated by the sqlite3_set_auxdata() function with the Nth argument
+** value to the application-defined function. ^If there is no metadata
+** associated with the function argument, this sqlite3_get_auxdata() interface
+** returns a NULL pointer.
+**
+** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th
+** argument of the application-defined function.  ^Subsequent
+** calls to sqlite3_get_auxdata(C,N) return P from the most recent
+** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or
+** NULL if the metadata has been discarded.
+** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL,
+** SQLite will invoke the destructor function X with parameter P exactly
+** once, when the metadata is discarded.
+** SQLite is free to discard the metadata at any time, including: <ul>
+** <li> when the corresponding function parameter changes, or
+** <li> when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
+**      SQL statement, or
+** <li> when sqlite3_set_auxdata() is invoked again on the same parameter, or
+** <li> during the original sqlite3_set_auxdata() call when a memory 
+**      allocation error occurs. </ul>)^
+**
+** Note the last bullet in particular.  The destructor X in 
+** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
+** sqlite3_set_auxdata() interface even returns.  Hence sqlite3_set_auxdata()
+** should be called near the end of the function implementation and the
+** function implementation should not make any use of P after
+** sqlite3_set_auxdata() has been called.
+**
+** ^(In practice, metadata is preserved between function calls for
+** function parameters that are compile-time constants, including literal
+** values and [parameters] and expressions composed from the same.)^
+**
+** These routines must be called from the same thread in which
+** the SQL function is running.
+*/
+SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
+SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
+
+
+/*
+** CAPI3REF: Constants Defining Special Destructor Behavior
+**
+** These are special values for the destructor that is passed in as the
+** final argument to routines like [sqlite3_result_blob()].  ^If the destructor
+** argument is SQLITE_STATIC, it means that the content pointer is constant
+** and will never change.  It does not need to be destroyed.  ^The
+** SQLITE_TRANSIENT value means that the content will likely change in
+** the near future and that SQLite should make its own private copy of
+** the content before returning.
+**
+** The typedef is necessary to work around problems in certain
+** C++ compilers.
+*/
+typedef void (*sqlite3_destructor_type)(void*);
+#define SQLITE_STATIC      ((sqlite3_destructor_type)0)
+#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)
+
+/*
+** CAPI3REF: Setting The Result Of An SQL Function
+**
+** These routines are used by the xFunc or xFinal callbacks that
+** implement SQL functions and aggregates.  See
+** [sqlite3_create_function()] and [sqlite3_create_function16()]
+** for additional information.
+**
+** These functions work very much like the [parameter binding] family of
+** functions used to bind values to host parameters in prepared statements.
+** Refer to the [SQL parameter] documentation for additional information.
+**
+** ^The sqlite3_result_blob() interface sets the result from
+** an application-defined function to be the BLOB whose content is pointed
+** to by the second parameter and which is N bytes long where N is the
+** third parameter.
+**
+** ^The sqlite3_result_zeroblob() interfaces set the result of
+** the application-defined function to be a BLOB containing all zero
+** bytes and N bytes in size, where N is the value of the 2nd parameter.
+**
+** ^The sqlite3_result_double() interface sets the result from
+** an application-defined function to be a floating point value specified
+** by its 2nd argument.
+**
+** ^The sqlite3_result_error() and sqlite3_result_error16() functions
+** cause the implemented SQL function to throw an exception.
+** ^SQLite uses the string pointed to by the
+** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()
+** as the text of an error message.  ^SQLite interprets the error
+** message string from sqlite3_result_error() as UTF-8. ^SQLite
+** interprets the string from sqlite3_result_error16() as UTF-16 in native
+** byte order.  ^If the third parameter to sqlite3_result_error()
+** or sqlite3_result_error16() is negative then SQLite takes as the error
+** message all text up through the first zero character.
+** ^If the third parameter to sqlite3_result_error() or
+** sqlite3_result_error16() is non-negative then SQLite takes that many
+** bytes (not characters) from the 2nd parameter as the error message.
+** ^The sqlite3_result_error() and sqlite3_result_error16()
+** routines make a private copy of the error message text before
+** they return.  Hence, the calling function can deallocate or
+** modify the text after they return without harm.
+** ^The sqlite3_result_error_code() function changes the error code
+** returned by SQLite as a result of an error in a function.  ^By default,
+** the error code is SQLITE_ERROR.  ^A subsequent call to sqlite3_result_error()
+** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.
+**
+** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an
+** error indicating that a string or BLOB is too long to represent.
+**
+** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an
+** error indicating that a memory allocation failed.
+**
+** ^The sqlite3_result_int() interface sets the return value
+** of the application-defined function to be the 32-bit signed integer
+** value given in the 2nd argument.
+** ^The sqlite3_result_int64() interface sets the return value
+** of the application-defined function to be the 64-bit signed integer
+** value given in the 2nd argument.
+**
+** ^The sqlite3_result_null() interface sets the return value
+** of the application-defined function to be NULL.
+**
+** ^The sqlite3_result_text(), sqlite3_result_text16(),
+** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces
+** set the return value of the application-defined function to be
+** a text string which is represented as UTF-8, UTF-16 native byte order,
+** UTF-16 little endian, or UTF-16 big endian, respectively.
+** ^SQLite takes the text result from the application from
+** the 2nd parameter of the sqlite3_result_text* interfaces.
+** ^If the 3rd parameter to the sqlite3_result_text* interfaces
+** is negative, then SQLite takes result text from the 2nd parameter
+** through the first zero character.
+** ^If the 3rd parameter to the sqlite3_result_text* interfaces
+** is non-negative, then as many bytes (not characters) of the text
+** pointed to by the 2nd parameter are taken as the application-defined
+** function result.  If the 3rd parameter is non-negative, then it
+** must be the byte offset into the string where the NUL terminator would
+** appear if the string where NUL terminated.  If any NUL characters occur
+** in the string at a byte offset that is less than the value of the 3rd
+** parameter, then the resulting string will contain embedded NULs and the
+** result of expressions operating on strings with embedded NULs is undefined.
+** ^If the 4th parameter to the sqlite3_result_text* interfaces
+** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that
+** function as the destructor on the text or BLOB result when it has
+** finished using that result.
+** ^If the 4th parameter to the sqlite3_result_text* interfaces or to
+** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite
+** assumes that the text or BLOB result is in constant space and does not
+** copy the content of the parameter nor call a destructor on the content
+** when it has finished using that result.
+** ^If the 4th parameter to the sqlite3_result_text* interfaces
+** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
+** then SQLite makes a copy of the result into space obtained from
+** from [sqlite3_malloc()] before it returns.
+**
+** ^The sqlite3_result_value() interface sets the result of
+** the application-defined function to be a copy the
+** [unprotected sqlite3_value] object specified by the 2nd parameter.  ^The
+** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
+** so that the [sqlite3_value] specified in the parameter may change or
+** be deallocated after sqlite3_result_value() returns without harm.
+** ^A [protected sqlite3_value] object may always be used where an
+** [unprotected sqlite3_value] object is required, so either
+** kind of [sqlite3_value] object can be used with this interface.
+**
+** If these routines are called from within the different thread
+** than the one containing the application-defined function that received
+** the [sqlite3_context] pointer, the results are undefined.
+*/
+SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
+SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
+SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
+SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
+SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
+SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
+SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
+SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
+SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
+SQLITE_API void sqlite3_result_null(sqlite3_context*);
+SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
+SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
+SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
+SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
+SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
+SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
+
+/*
+** CAPI3REF: Define New Collating Sequences
+**
+** ^These functions add, remove, or modify a [collation] associated
+** with the [database connection] specified as the first argument.
+**
+** ^The name of the collation is a UTF-8 string
+** for sqlite3_create_collation() and sqlite3_create_collation_v2()
+** and a UTF-16 string in native byte order for sqlite3_create_collation16().
+** ^Collation names that compare equal according to [sqlite3_strnicmp()] are
+** considered to be the same name.
+**
+** ^(The third argument (eTextRep) must be one of the constants:
+** <ul>
+** <li> [SQLITE_UTF8],
+** <li> [SQLITE_UTF16LE],
+** <li> [SQLITE_UTF16BE],
+** <li> [SQLITE_UTF16], or
+** <li> [SQLITE_UTF16_ALIGNED].
+** </ul>)^
+** ^The eTextRep argument determines the encoding of strings passed
+** to the collating function callback, xCallback.
+** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
+** force strings to be UTF16 with native byte order.
+** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
+** on an even byte address.
+**
+** ^The fourth argument, pArg, is an application data pointer that is passed
+** through as the first argument to the collating function callback.
+**
+** ^The fifth argument, xCallback, is a pointer to the collating function.
+** ^Multiple collating functions can be registered using the same name but
+** with different eTextRep parameters and SQLite will use whichever
+** function requires the least amount of data transformation.
+** ^If the xCallback argument is NULL then the collating function is
+** deleted.  ^When all collating functions having the same name are deleted,
+** that collation is no longer usable.
+**
+** ^The collating function callback is invoked with a copy of the pArg 
+** application data pointer and with two strings in the encoding specified
+** by the eTextRep argument.  The collating function must return an
+** integer that is negative, zero, or positive
+** if the first string is less than, equal to, or greater than the second,
+** respectively.  A collating function must always return the same answer
+** given the same inputs.  If two or more collating functions are registered
+** to the same collation name (using different eTextRep values) then all
+** must give an equivalent answer when invoked with equivalent strings.
+** The collating function must obey the following properties for all
+** strings A, B, and C:
+**
+** <ol>
+** <li> If A==B then B==A.
+** <li> If A==B and B==C then A==C.
+** <li> If A&lt;B THEN B&gt;A.
+** <li> If A&lt;B and B&lt;C then A&lt;C.
+** </ol>
+**
+** If a collating function fails any of the above constraints and that
+** collating function is  registered and used, then the behavior of SQLite
+** is undefined.
+**
+** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()
+** with the addition that the xDestroy callback is invoked on pArg when
+** the collating function is deleted.
+** ^Collating functions are deleted when they are overridden by later
+** calls to the collation creation functions or when the
+** [database connection] is closed using [sqlite3_close()].
+**
+** ^The xDestroy callback is <u>not</u> called if the 
+** sqlite3_create_collation_v2() function fails.  Applications that invoke
+** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should 
+** check the return code and dispose of the application data pointer
+** themselves rather than expecting SQLite to deal with it for them.
+** This is different from every other SQLite interface.  The inconsistency 
+** is unfortunate but cannot be changed without breaking backwards 
+** compatibility.
+**
+** See also:  [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
+*/
+SQLITE_API int sqlite3_create_collation(
+  sqlite3*, 
+  const char *zName, 
+  int eTextRep, 
+  void *pArg,
+  int(*xCompare)(void*,int,const void*,int,const void*)
+);
+SQLITE_API int sqlite3_create_collation_v2(
+  sqlite3*, 
+  const char *zName, 
+  int eTextRep, 
+  void *pArg,
+  int(*xCompare)(void*,int,const void*,int,const void*),
+  void(*xDestroy)(void*)
+);
+SQLITE_API int sqlite3_create_collation16(
+  sqlite3*, 
+  const void *zName,
+  int eTextRep, 
+  void *pArg,
+  int(*xCompare)(void*,int,const void*,int,const void*)
+);
+
+/*
+** CAPI3REF: Collation Needed Callbacks
+**
+** ^To avoid having to register all collation sequences before a database
+** can be used, a single callback function may be registered with the
+** [database connection] to be invoked whenever an undefined collation
+** sequence is required.
+**
+** ^If the function is registered using the sqlite3_collation_needed() API,
+** then it is passed the names of undefined collation sequences as strings
+** encoded in UTF-8. ^If sqlite3_collation_needed16() is used,
+** the names are passed as UTF-16 in machine native byte order.
+** ^A call to either function replaces the existing collation-needed callback.
+**
+** ^(When the callback is invoked, the first argument passed is a copy
+** of the second argument to sqlite3_collation_needed() or
+** sqlite3_collation_needed16().  The second argument is the database
+** connection.  The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],
+** or [SQLITE_UTF16LE], indicating the most desirable form of the collation
+** sequence function required.  The fourth parameter is the name of the
+** required collation sequence.)^
+**
+** The callback function should register the desired collation using
+** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
+** [sqlite3_create_collation_v2()].
+*/
+SQLITE_API int sqlite3_collation_needed(
+  sqlite3*, 
+  void*, 
+  void(*)(void*,sqlite3*,int eTextRep,const char*)
+);
+SQLITE_API int sqlite3_collation_needed16(
+  sqlite3*, 
+  void*,
+  void(*)(void*,sqlite3*,int eTextRep,const void*)
+);
+
+#ifdef SQLITE_HAS_CODEC
+/*
+** Specify the key for an encrypted database.  This routine should be
+** called right after sqlite3_open().
+**
+** The code to implement this API is not available in the public release
+** of SQLite.
+*/
+SQLITE_API int sqlite3_key(
+  sqlite3 *db,                   /* Database to be rekeyed */
+  const void *pKey, int nKey     /* The key */
+);
+SQLITE_API int sqlite3_key_v2(
+  sqlite3 *db,                   /* Database to be rekeyed */
+  const char *zDbName,           /* Name of the database */
+  const void *pKey, int nKey     /* The key */
+);
+
+/*
+** Change the key on an open database.  If the current database is not
+** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the
+** database is decrypted.
+**
+** The code to implement this API is not available in the public release
+** of SQLite.
+*/
+SQLITE_API int sqlite3_rekey(
+  sqlite3 *db,                   /* Database to be rekeyed */
+  const void *pKey, int nKey     /* The new key */
+);
+SQLITE_API int sqlite3_rekey_v2(
+  sqlite3 *db,                   /* Database to be rekeyed */
+  const char *zDbName,           /* Name of the database */
+  const void *pKey, int nKey     /* The new key */
+);
+
+/*
+** Specify the activation key for a SEE database.  Unless 
+** activated, none of the SEE routines will work.
+*/
+SQLITE_API void sqlite3_activate_see(
+  const char *zPassPhrase        /* Activation phrase */
+);
+#endif
+
+#ifdef SQLITE_ENABLE_CEROD
+/*
+** Specify the activation key for a CEROD database.  Unless 
+** activated, none of the CEROD routines will work.
+*/
+SQLITE_API void sqlite3_activate_cerod(
+  const char *zPassPhrase        /* Activation phrase */
+);
+#endif
+
+/*
+** CAPI3REF: Suspend Execution For A Short Time
+**
+** The sqlite3_sleep() function causes the current thread to suspend execution
+** for at least a number of milliseconds specified in its parameter.
+**
+** If the operating system does not support sleep requests with
+** millisecond time resolution, then the time will be rounded up to
+** the nearest second. The number of milliseconds of sleep actually
+** requested from the operating system is returned.
+**
+** ^SQLite implements this interface by calling the xSleep()
+** method of the default [sqlite3_vfs] object.  If the xSleep() method
+** of the default VFS is not implemented correctly, or not implemented at
+** all, then the behavior of sqlite3_sleep() may deviate from the description
+** in the previous paragraphs.
+*/
+SQLITE_API int sqlite3_sleep(int);
+
+/*
+** CAPI3REF: Name Of The Folder Holding Temporary Files
+**
+** ^(If this global variable is made to point to a string which is
+** the name of a folder (a.k.a. directory), then all temporary files
+** created by SQLite when using a built-in [sqlite3_vfs | VFS]
+** will be placed in that directory.)^  ^If this variable
+** is a NULL pointer, then SQLite performs a search for an appropriate
+** temporary file directory.
+**
+** It is not safe to read or modify this variable in more than one
+** thread at a time.  It is not safe to read or modify this variable
+** if a [database connection] is being used at the same time in a separate
+** thread.
+** It is intended that this variable be set once
+** as part of process initialization and before any SQLite interface
+** routines have been called and that this variable remain unchanged
+** thereafter.
+**
+** ^The [temp_store_directory pragma] may modify this variable and cause
+** it to point to memory obtained from [sqlite3_malloc].  ^Furthermore,
+** the [temp_store_directory pragma] always assumes that any string
+** that this variable points to is held in memory obtained from 
+** [sqlite3_malloc] and the pragma may attempt to free that memory
+** using [sqlite3_free].
+** Hence, if this variable is modified directly, either it should be
+** made NULL or made to point to memory obtained from [sqlite3_malloc]
+** or else the use of the [temp_store_directory pragma] should be avoided.
+**
+** <b>Note to Windows Runtime users:</b>  The temporary directory must be set
+** prior to calling [sqlite3_open] or [sqlite3_open_v2].  Otherwise, various
+** features that require the use of temporary files may fail.  Here is an
+** example of how to do this using C++ with the Windows Runtime:
+**
+** <blockquote><pre>
+** LPCWSTR zPath = Windows::Storage::ApplicationData::Current->
+** &nbsp;     TemporaryFolder->Path->Data();
+** char zPathBuf&#91;MAX_PATH + 1&#93;;
+** memset(zPathBuf, 0, sizeof(zPathBuf));
+** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf),
+** &nbsp;     NULL, NULL);
+** sqlite3_temp_directory = sqlite3_mprintf("%s", zPathBuf);
+** </pre></blockquote>
+*/
+SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory;
+
+/*
+** CAPI3REF: Name Of The Folder Holding Database Files
+**
+** ^(If this global variable is made to point to a string which is
+** the name of a folder (a.k.a. directory), then all database files
+** specified with a relative pathname and created or accessed by
+** SQLite when using a built-in windows [sqlite3_vfs | VFS] will be assumed
+** to be relative to that directory.)^ ^If this variable is a NULL
+** pointer, then SQLite assumes that all database files specified
+** with a relative pathname are relative to the current directory
+** for the process.  Only the windows VFS makes use of this global
+** variable; it is ignored by the unix VFS.
+**
+** Changing the value of this variable while a database connection is
+** open can result in a corrupt database.
+**
+** It is not safe to read or modify this variable in more than one
+** thread at a time.  It is not safe to read or modify this variable
+** if a [database connection] is being used at the same time in a separate
+** thread.
+** It is intended that this variable be set once
+** as part of process initialization and before any SQLite interface
+** routines have been called and that this variable remain unchanged
+** thereafter.
+**
+** ^The [data_store_directory pragma] may modify this variable and cause
+** it to point to memory obtained from [sqlite3_malloc].  ^Furthermore,
+** the [data_store_directory pragma] always assumes that any string
+** that this variable points to is held in memory obtained from 
+** [sqlite3_malloc] and the pragma may attempt to free that memory
+** using [sqlite3_free].
+** Hence, if this variable is modified directly, either it should be
+** made NULL or made to point to memory obtained from [sqlite3_malloc]
+** or else the use of the [data_store_directory pragma] should be avoided.
+*/
+SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;
+
+/*
+** CAPI3REF: Test For Auto-Commit Mode
+** KEYWORDS: {autocommit mode}
+**
+** ^The sqlite3_get_autocommit() interface returns non-zero or
+** zero if the given database connection is or is not in autocommit mode,
+** respectively.  ^Autocommit mode is on by default.
+** ^Autocommit mode is disabled by a [BEGIN] statement.
+** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].
+**
+** If certain kinds of errors occur on a statement within a multi-statement
+** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],
+** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the
+** transaction might be rolled back automatically.  The only way to
+** find out whether SQLite automatically rolled back the transaction after
+** an error is to use this function.
+**
+** If another thread changes the autocommit status of the database
+** connection while this routine is running, then the return value
+** is undefined.
+*/
+SQLITE_API int sqlite3_get_autocommit(sqlite3*);
+
+/*
+** CAPI3REF: Find The Database Handle Of A Prepared Statement
+**
+** ^The sqlite3_db_handle interface returns the [database connection] handle
+** to which a [prepared statement] belongs.  ^The [database connection]
+** returned by sqlite3_db_handle is the same [database connection]
+** that was the first argument
+** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
+** create the statement in the first place.
+*/
+SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Return The Filename For A Database Connection
+**
+** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename
+** associated with database N of connection D.  ^The main database file
+** has the name "main".  If there is no attached database N on the database
+** connection D, or if database N is a temporary or in-memory database, then
+** a NULL pointer is returned.
+**
+** ^The filename returned by this function is the output of the
+** xFullPathname method of the [VFS].  ^In other words, the filename
+** will be an absolute pathname, even if the filename used
+** to open the database originally was a URI or relative pathname.
+*/
+SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
+
+/*
+** CAPI3REF: Determine if a database is read-only
+**
+** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
+** of connection D is read-only, 0 if it is read/write, or -1 if N is not
+** the name of a database on connection D.
+*/
+SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
+
+/*
+** CAPI3REF: Find the next prepared statement
+**
+** ^This interface returns a pointer to the next [prepared statement] after
+** pStmt associated with the [database connection] pDb.  ^If pStmt is NULL
+** then this interface returns a pointer to the first prepared statement
+** associated with the database connection pDb.  ^If no prepared statement
+** satisfies the conditions of this routine, it returns NULL.
+**
+** The [database connection] pointer D in a call to
+** [sqlite3_next_stmt(D,S)] must refer to an open database
+** connection and in particular must not be a NULL pointer.
+*/
+SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Commit And Rollback Notification Callbacks
+**
+** ^The sqlite3_commit_hook() interface registers a callback
+** function to be invoked whenever a transaction is [COMMIT | committed].
+** ^Any callback set by a previous call to sqlite3_commit_hook()
+** for the same database connection is overridden.
+** ^The sqlite3_rollback_hook() interface registers a callback
+** function to be invoked whenever a transaction is [ROLLBACK | rolled back].
+** ^Any callback set by a previous call to sqlite3_rollback_hook()
+** for the same database connection is overridden.
+** ^The pArg argument is passed through to the callback.
+** ^If the callback on a commit hook function returns non-zero,
+** then the commit is converted into a rollback.
+**
+** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions
+** return the P argument from the previous call of the same function
+** on the same [database connection] D, or NULL for
+** the first call for each function on D.
+**
+** The commit and rollback hook callbacks are not reentrant.
+** The callback implementation must not do anything that will modify
+** the database connection that invoked the callback.  Any actions
+** to modify the database connection must be deferred until after the
+** completion of the [sqlite3_step()] call that triggered the commit
+** or rollback hook in the first place.
+** Note that running any other SQL statements, including SELECT statements,
+** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify
+** the database connections for the meaning of "modify" in this paragraph.
+**
+** ^Registering a NULL function disables the callback.
+**
+** ^When the commit hook callback routine returns zero, the [COMMIT]
+** operation is allowed to continue normally.  ^If the commit hook
+** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].
+** ^The rollback hook is invoked on a rollback that results from a commit
+** hook returning non-zero, just as it would be with any other rollback.
+**
+** ^For the purposes of this API, a transaction is said to have been
+** rolled back if an explicit "ROLLBACK" statement is executed, or
+** an error or constraint causes an implicit rollback to occur.
+** ^The rollback callback is not invoked if a transaction is
+** automatically rolled back because the database connection is closed.
+**
+** See also the [sqlite3_update_hook()] interface.
+*/
+SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
+SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
+
+/*
+** CAPI3REF: Data Change Notification Callbacks
+**
+** ^The sqlite3_update_hook() interface registers a callback function
+** with the [database connection] identified by the first argument
+** to be invoked whenever a row is updated, inserted or deleted in
+** a rowid table.
+** ^Any callback set by a previous call to this function
+** for the same database connection is overridden.
+**
+** ^The second argument is a pointer to the function to invoke when a
+** row is updated, inserted or deleted in a rowid table.
+** ^The first argument to the callback is a copy of the third argument
+** to sqlite3_update_hook().
+** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
+** or [SQLITE_UPDATE], depending on the operation that caused the callback
+** to be invoked.
+** ^The third and fourth arguments to the callback contain pointers to the
+** database and table name containing the affected row.
+** ^The final callback parameter is the [rowid] of the row.
+** ^In the case of an update, this is the [rowid] after the update takes place.
+**
+** ^(The update hook is not invoked when internal system tables are
+** modified (i.e. sqlite_master and sqlite_sequence).)^
+** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified.
+**
+** ^In the current implementation, the update hook
+** is not invoked when duplication rows are deleted because of an
+** [ON CONFLICT | ON CONFLICT REPLACE] clause.  ^Nor is the update hook
+** invoked when rows are deleted using the [truncate optimization].
+** The exceptions defined in this paragraph might change in a future
+** release of SQLite.
+**
+** The update hook implementation must not do anything that will modify
+** the database connection that invoked the update hook.  Any actions
+** to modify the database connection must be deferred until after the
+** completion of the [sqlite3_step()] call that triggered the update hook.
+** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
+** database connections for the meaning of "modify" in this paragraph.
+**
+** ^The sqlite3_update_hook(D,C,P) function
+** returns the P argument from the previous call
+** on the same [database connection] D, or NULL for
+** the first call on D.
+**
+** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]
+** interfaces.
+*/
+SQLITE_API void *sqlite3_update_hook(
+  sqlite3*, 
+  void(*)(void *,int ,char const *,char const *,sqlite3_int64),
+  void*
+);
+
+/*
+** CAPI3REF: Enable Or Disable Shared Pager Cache
+**
+** ^(This routine enables or disables the sharing of the database cache
+** and schema data structures between [database connection | connections]
+** to the same database. Sharing is enabled if the argument is true
+** and disabled if the argument is false.)^
+**
+** ^Cache sharing is enabled and disabled for an entire process.
+** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,
+** sharing was enabled or disabled for each thread separately.
+**
+** ^(The cache sharing mode set by this interface effects all subsequent
+** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
+** Existing database connections continue use the sharing mode
+** that was in effect at the time they were opened.)^
+**
+** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled
+** successfully.  An [error code] is returned otherwise.)^
+**
+** ^Shared cache is disabled by default. But this might change in
+** future releases of SQLite.  Applications that care about shared
+** cache setting should set it explicitly.
+**
+** This interface is threadsafe on processors where writing a
+** 32-bit integer is atomic.
+**
+** See Also:  [SQLite Shared-Cache Mode]
+*/
+SQLITE_API int sqlite3_enable_shared_cache(int);
+
+/*
+** CAPI3REF: Attempt To Free Heap Memory
+**
+** ^The sqlite3_release_memory() interface attempts to free N bytes
+** of heap memory by deallocating non-essential memory allocations
+** held by the database library.   Memory used to cache database
+** pages to improve performance is an example of non-essential memory.
+** ^sqlite3_release_memory() returns the number of bytes actually freed,
+** which might be more or less than the amount requested.
+** ^The sqlite3_release_memory() routine is a no-op returning zero
+** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
+**
+** See also: [sqlite3_db_release_memory()]
+*/
+SQLITE_API int sqlite3_release_memory(int);
+
+/*
+** CAPI3REF: Free Memory Used By A Database Connection
+**
+** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap
+** memory as possible from database connection D. Unlike the
+** [sqlite3_release_memory()] interface, this interface is in effect even
+** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
+** omitted.
+**
+** See also: [sqlite3_release_memory()]
+*/
+SQLITE_API int sqlite3_db_release_memory(sqlite3*);
+
+/*
+** CAPI3REF: Impose A Limit On Heap Size
+**
+** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
+** soft limit on the amount of heap memory that may be allocated by SQLite.
+** ^SQLite strives to keep heap memory utilization below the soft heap
+** limit by reducing the number of pages held in the page cache
+** as heap memory usages approaches the limit.
+** ^The soft heap limit is "soft" because even though SQLite strives to stay
+** below the limit, it will exceed the limit rather than generate
+** an [SQLITE_NOMEM] error.  In other words, the soft heap limit 
+** is advisory only.
+**
+** ^The return value from sqlite3_soft_heap_limit64() is the size of
+** the soft heap limit prior to the call, or negative in the case of an
+** error.  ^If the argument N is negative
+** then no change is made to the soft heap limit.  Hence, the current
+** size of the soft heap limit can be determined by invoking
+** sqlite3_soft_heap_limit64() with a negative argument.
+**
+** ^If the argument N is zero then the soft heap limit is disabled.
+**
+** ^(The soft heap limit is not enforced in the current implementation
+** if one or more of following conditions are true:
+**
+** <ul>
+** <li> The soft heap limit is set to zero.
+** <li> Memory accounting is disabled using a combination of the
+**      [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
+**      the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
+** <li> An alternative page cache implementation is specified using
+**      [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...).
+** <li> The page cache allocates from its own memory pool supplied
+**      by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
+**      from the heap.
+** </ul>)^
+**
+** Beginning with SQLite version 3.7.3, the soft heap limit is enforced
+** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
+** compile-time option is invoked.  With [SQLITE_ENABLE_MEMORY_MANAGEMENT],
+** the soft heap limit is enforced on every memory allocation.  Without
+** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced
+** when memory is allocated by the page cache.  Testing suggests that because
+** the page cache is the predominate memory user in SQLite, most
+** applications will achieve adequate soft heap limit enforcement without
+** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].
+**
+** The circumstances under which SQLite will enforce the soft heap limit may
+** changes in future releases of SQLite.
+*/
+SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
+
+/*
+** CAPI3REF: Deprecated Soft Heap Limit Interface
+** DEPRECATED
+**
+** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
+** interface.  This routine is provided for historical compatibility
+** only.  All new applications should use the
+** [sqlite3_soft_heap_limit64()] interface rather than this one.
+*/
+SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
+
+
+/*
+** CAPI3REF: Extract Metadata About A Column Of A Table
+**
+** ^This routine returns metadata about a specific column of a specific
+** database table accessible using the [database connection] handle
+** passed as the first function argument.
+**
+** ^The column is identified by the second, third and fourth parameters to
+** this function. ^The second parameter is either the name of the database
+** (i.e. "main", "temp", or an attached database) containing the specified
+** table or NULL. ^If it is NULL, then all attached databases are searched
+** for the table using the same algorithm used by the database engine to
+** resolve unqualified table references.
+**
+** ^The third and fourth parameters to this function are the table and column
+** name of the desired column, respectively. Neither of these parameters
+** may be NULL.
+**
+** ^Metadata is returned by writing to the memory locations passed as the 5th
+** and subsequent parameters to this function. ^Any of these arguments may be
+** NULL, in which case the corresponding element of metadata is omitted.
+**
+** ^(<blockquote>
+** <table border="1">
+** <tr><th> Parameter <th> Output<br>Type <th>  Description
+**
+** <tr><td> 5th <td> const char* <td> Data type
+** <tr><td> 6th <td> const char* <td> Name of default collation sequence
+** <tr><td> 7th <td> int         <td> True if column has a NOT NULL constraint
+** <tr><td> 8th <td> int         <td> True if column is part of the PRIMARY KEY
+** <tr><td> 9th <td> int         <td> True if column is [AUTOINCREMENT]
+** </table>
+** </blockquote>)^
+**
+** ^The memory pointed to by the character pointers returned for the
+** declaration type and collation sequence is valid only until the next
+** call to any SQLite API function.
+**
+** ^If the specified table is actually a view, an [error code] is returned.
+**
+** ^If the specified column is "rowid", "oid" or "_rowid_" and an
+** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output
+** parameters are set for the explicitly declared column. ^(If there is no
+** explicitly declared [INTEGER PRIMARY KEY] column, then the output
+** parameters are set as follows:
+**
+** <pre>
+**     data type: "INTEGER"
+**     collation sequence: "BINARY"
+**     not null: 0
+**     primary key: 1
+**     auto increment: 0
+** </pre>)^
+**
+** ^(This function may load one or more schemas from database files. If an
+** error occurs during this process, or if the requested table or column
+** cannot be found, an [error code] is returned and an error message left
+** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^
+**
+** ^This API is only available if the library was compiled with the
+** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined.
+*/
+SQLITE_API int sqlite3_table_column_metadata(
+  sqlite3 *db,                /* Connection handle */
+  const char *zDbName,        /* Database name or NULL */
+  const char *zTableName,     /* Table name */
+  const char *zColumnName,    /* Column name */
+  char const **pzDataType,    /* OUTPUT: Declared data type */
+  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */
+  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */
+  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */
+  int *pAutoinc               /* OUTPUT: True if column is auto-increment */
+);
+
+/*
+** CAPI3REF: Load An Extension
+**
+** ^This interface loads an SQLite extension library from the named file.
+**
+** ^The sqlite3_load_extension() interface attempts to load an
+** [SQLite extension] library contained in the file zFile.  If
+** the file cannot be loaded directly, attempts are made to load
+** with various operating-system specific extensions added.
+** So for example, if "samplelib" cannot be loaded, then names like
+** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
+** be tried also.
+**
+** ^The entry point is zProc.
+** ^(zProc may be 0, in which case SQLite will try to come up with an
+** entry point name on its own.  It first tries "sqlite3_extension_init".
+** If that does not work, it constructs a name "sqlite3_X_init" where the
+** X is consists of the lower-case equivalent of all ASCII alphabetic
+** characters in the filename from the last "/" to the first following
+** "." and omitting any initial "lib".)^
+** ^The sqlite3_load_extension() interface returns
+** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
+** ^If an error occurs and pzErrMsg is not 0, then the
+** [sqlite3_load_extension()] interface shall attempt to
+** fill *pzErrMsg with error message text stored in memory
+** obtained from [sqlite3_malloc()]. The calling function
+** should free this memory by calling [sqlite3_free()].
+**
+** ^Extension loading must be enabled using
+** [sqlite3_enable_load_extension()] prior to calling this API,
+** otherwise an error will be returned.
+**
+** See also the [load_extension() SQL function].
+*/
+SQLITE_API int sqlite3_load_extension(
+  sqlite3 *db,          /* Load the extension into this database connection */
+  const char *zFile,    /* Name of the shared library containing extension */
+  const char *zProc,    /* Entry point.  Derived from zFile if 0 */
+  char **pzErrMsg       /* Put error message here if not 0 */
+);
+
+/*
+** CAPI3REF: Enable Or Disable Extension Loading
+**
+** ^So as not to open security holes in older applications that are
+** unprepared to deal with [extension loading], and as a means of disabling
+** [extension loading] while evaluating user-entered SQL, the following API
+** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
+**
+** ^Extension loading is off by default.
+** ^Call the sqlite3_enable_load_extension() routine with onoff==1
+** to turn extension loading on and call it with onoff==0 to turn
+** it back off again.
+*/
+SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
+
+/*
+** CAPI3REF: Automatically Load Statically Linked Extensions
+**
+** ^This interface causes the xEntryPoint() function to be invoked for
+** each new [database connection] that is created.  The idea here is that
+** xEntryPoint() is the entry point for a statically linked [SQLite extension]
+** that is to be automatically loaded into all new database connections.
+**
+** ^(Even though the function prototype shows that xEntryPoint() takes
+** no arguments and returns void, SQLite invokes xEntryPoint() with three
+** arguments and expects and integer result as if the signature of the
+** entry point where as follows:
+**
+** <blockquote><pre>
+** &nbsp;  int xEntryPoint(
+** &nbsp;    sqlite3 *db,
+** &nbsp;    const char **pzErrMsg,
+** &nbsp;    const struct sqlite3_api_routines *pThunk
+** &nbsp;  );
+** </pre></blockquote>)^
+**
+** If the xEntryPoint routine encounters an error, it should make *pzErrMsg
+** point to an appropriate error message (obtained from [sqlite3_mprintf()])
+** and return an appropriate [error code].  ^SQLite ensures that *pzErrMsg
+** is NULL before calling the xEntryPoint().  ^SQLite will invoke
+** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns.  ^If any
+** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],
+** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail.
+**
+** ^Calling sqlite3_auto_extension(X) with an entry point X that is already
+** on the list of automatic extensions is a harmless no-op. ^No entry point
+** will be called more than once for each database connection that is opened.
+**
+** See also: [sqlite3_reset_auto_extension()]
+** and [sqlite3_cancel_auto_extension()]
+*/
+SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void));
+
+/*
+** CAPI3REF: Cancel Automatic Extension Loading
+**
+** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
+** initialization routine X that was registered using a prior call to
+** [sqlite3_auto_extension(X)].  ^The [sqlite3_cancel_auto_extension(X)]
+** routine returns 1 if initialization routine X was successfully 
+** unregistered and it returns 0 if X was not on the list of initialization
+** routines.
+*/
+SQLITE_API int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
+
+/*
+** CAPI3REF: Reset Automatic Extension Loading
+**
+** ^This interface disables all automatic extensions previously
+** registered using [sqlite3_auto_extension()].
+*/
+SQLITE_API void sqlite3_reset_auto_extension(void);
+
+/*
+** The interface to the virtual-table mechanism is currently considered
+** to be experimental.  The interface might change in incompatible ways.
+** If this is a problem for you, do not use the interface at this time.
+**
+** When the virtual-table mechanism stabilizes, we will declare the
+** interface fixed, support it indefinitely, and remove this comment.
+*/
+
+/*
+** Structures used by the virtual table interface
+*/
+typedef struct sqlite3_vtab sqlite3_vtab;
+typedef struct sqlite3_index_info sqlite3_index_info;
+typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
+typedef struct sqlite3_module sqlite3_module;
+
+/*
+** CAPI3REF: Virtual Table Object
+** KEYWORDS: sqlite3_module {virtual table module}
+**
+** This structure, sometimes called a "virtual table module", 
+** defines the implementation of a [virtual tables].  
+** This structure consists mostly of methods for the module.
+**
+** ^A virtual table module is created by filling in a persistent
+** instance of this structure and passing a pointer to that instance
+** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].
+** ^The registration remains valid until it is replaced by a different
+** module or until the [database connection] closes.  The content
+** of this structure must not change while it is registered with
+** any database connection.
+*/
+struct sqlite3_module {
+  int iVersion;
+  int (*xCreate)(sqlite3*, void *pAux,
+               int argc, const char *const*argv,
+               sqlite3_vtab **ppVTab, char**);
+  int (*xConnect)(sqlite3*, void *pAux,
+               int argc, const char *const*argv,
+               sqlite3_vtab **ppVTab, char**);
+  int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
+  int (*xDisconnect)(sqlite3_vtab *pVTab);
+  int (*xDestroy)(sqlite3_vtab *pVTab);
+  int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
+  int (*xClose)(sqlite3_vtab_cursor*);
+  int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
+                int argc, sqlite3_value **argv);
+  int (*xNext)(sqlite3_vtab_cursor*);
+  int (*xEof)(sqlite3_vtab_cursor*);
+  int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);
+  int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid);
+  int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *);
+  int (*xBegin)(sqlite3_vtab *pVTab);
+  int (*xSync)(sqlite3_vtab *pVTab);
+  int (*xCommit)(sqlite3_vtab *pVTab);
+  int (*xRollback)(sqlite3_vtab *pVTab);
+  int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,
+                       void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
+                       void **ppArg);
+  int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
+  /* The methods above are in version 1 of the sqlite_module object. Those 
+  ** below are for version 2 and greater. */
+  int (*xSavepoint)(sqlite3_vtab *pVTab, int);
+  int (*xRelease)(sqlite3_vtab *pVTab, int);
+  int (*xRollbackTo)(sqlite3_vtab *pVTab, int);
+};
+
+/*
+** CAPI3REF: Virtual Table Indexing Information
+** KEYWORDS: sqlite3_index_info
+**
+** The sqlite3_index_info structure and its substructures is used as part
+** of the [virtual table] interface to
+** pass information into and receive the reply from the [xBestIndex]
+** method of a [virtual table module].  The fields under **Inputs** are the
+** inputs to xBestIndex and are read-only.  xBestIndex inserts its
+** results into the **Outputs** fields.
+**
+** ^(The aConstraint[] array records WHERE clause constraints of the form:
+**
+** <blockquote>column OP expr</blockquote>
+**
+** where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
+** stored in aConstraint[].op using one of the
+** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
+** ^(The index of the column is stored in
+** aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
+** expr on the right-hand side can be evaluated (and thus the constraint
+** is usable) and false if it cannot.)^
+**
+** ^The optimizer automatically inverts terms of the form "expr OP column"
+** and makes other simplifications to the WHERE clause in an attempt to
+** get as many WHERE clause terms into the form shown above as possible.
+** ^The aConstraint[] array only reports WHERE clause terms that are
+** relevant to the particular virtual table being queried.
+**
+** ^Information about the ORDER BY clause is stored in aOrderBy[].
+** ^Each term of aOrderBy records a column of the ORDER BY clause.
+**
+** The [xBestIndex] method must fill aConstraintUsage[] with information
+** about what parameters to pass to xFilter.  ^If argvIndex>0 then
+** the right-hand side of the corresponding aConstraint[] is evaluated
+** and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
+** is true, then the constraint is assumed to be fully handled by the
+** virtual table and is not checked again by SQLite.)^
+**
+** ^The idxNum and idxPtr values are recorded and passed into the
+** [xFilter] method.
+** ^[sqlite3_free()] is used to free idxPtr if and only if
+** needToFreeIdxPtr is true.
+**
+** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
+** the correct order to satisfy the ORDER BY clause so that no separate
+** sorting step is required.
+**
+** ^The estimatedCost value is an estimate of the cost of a particular
+** strategy. A cost of N indicates that the cost of the strategy is similar
+** to a linear scan of an SQLite table with N rows. A cost of log(N) 
+** indicates that the expense of the operation is similar to that of a
+** binary search on a unique indexed field of an SQLite table with N rows.
+**
+** ^The estimatedRows value is an estimate of the number of rows that
+** will be returned by the strategy.
+**
+** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
+** structure for SQLite version 3.8.2. If a virtual table extension is
+** used with an SQLite version earlier than 3.8.2, the results of attempting 
+** to read or write the estimatedRows field are undefined (but are likely 
+** to included crashing the application). The estimatedRows field should
+** therefore only be used if [sqlite3_libversion_number()] returns a
+** value greater than or equal to 3008002.
+*/
+struct sqlite3_index_info {
+  /* Inputs */
+  int nConstraint;           /* Number of entries in aConstraint */
+  struct sqlite3_index_constraint {
+     int iColumn;              /* Column on left-hand side of constraint */
+     unsigned char op;         /* Constraint operator */
+     unsigned char usable;     /* True if this constraint is usable */
+     int iTermOffset;          /* Used internally - xBestIndex should ignore */
+  } *aConstraint;            /* Table of WHERE clause constraints */
+  int nOrderBy;              /* Number of terms in the ORDER BY clause */
+  struct sqlite3_index_orderby {
+     int iColumn;              /* Column number */
+     unsigned char desc;       /* True for DESC.  False for ASC. */
+  } *aOrderBy;               /* The ORDER BY clause */
+  /* Outputs */
+  struct sqlite3_index_constraint_usage {
+    int argvIndex;           /* if >0, constraint is part of argv to xFilter */
+    unsigned char omit;      /* Do not code a test for this constraint */
+  } *aConstraintUsage;
+  int idxNum;                /* Number used to identify the index */
+  char *idxStr;              /* String, possibly obtained from sqlite3_malloc */
+  int needToFreeIdxStr;      /* Free idxStr using sqlite3_free() if true */
+  int orderByConsumed;       /* True if output is already ordered */
+  double estimatedCost;           /* Estimated cost of using this index */
+  /* Fields below are only available in SQLite 3.8.2 and later */
+  sqlite3_int64 estimatedRows;    /* Estimated number of rows returned */
+};
+
+/*
+** CAPI3REF: Virtual Table Constraint Operator Codes
+**
+** These macros defined the allowed values for the
+** [sqlite3_index_info].aConstraint[].op field.  Each value represents
+** an operator that is part of a constraint term in the wHERE clause of
+** a query that uses a [virtual table].
+*/
+#define SQLITE_INDEX_CONSTRAINT_EQ    2
+#define SQLITE_INDEX_CONSTRAINT_GT    4
+#define SQLITE_INDEX_CONSTRAINT_LE    8
+#define SQLITE_INDEX_CONSTRAINT_LT    16
+#define SQLITE_INDEX_CONSTRAINT_GE    32
+#define SQLITE_INDEX_CONSTRAINT_MATCH 64
+
+/*
+** CAPI3REF: Register A Virtual Table Implementation
+**
+** ^These routines are used to register a new [virtual table module] name.
+** ^Module names must be registered before
+** creating a new [virtual table] using the module and before using a
+** preexisting [virtual table] for the module.
+**
+** ^The module name is registered on the [database connection] specified
+** by the first parameter.  ^The name of the module is given by the 
+** second parameter.  ^The third parameter is a pointer to
+** the implementation of the [virtual table module].   ^The fourth
+** parameter is an arbitrary client data pointer that is passed through
+** into the [xCreate] and [xConnect] methods of the virtual table module
+** when a new virtual table is be being created or reinitialized.
+**
+** ^The sqlite3_create_module_v2() interface has a fifth parameter which
+** is a pointer to a destructor for the pClientData.  ^SQLite will
+** invoke the destructor function (if it is not NULL) when SQLite
+** no longer needs the pClientData pointer.  ^The destructor will also
+** be invoked if the call to sqlite3_create_module_v2() fails.
+** ^The sqlite3_create_module()
+** interface is equivalent to sqlite3_create_module_v2() with a NULL
+** destructor.
+*/
+SQLITE_API int sqlite3_create_module(
+  sqlite3 *db,               /* SQLite connection to register module with */
+  const char *zName,         /* Name of the module */
+  const sqlite3_module *p,   /* Methods for the module */
+  void *pClientData          /* Client data for xCreate/xConnect */
+);
+SQLITE_API int sqlite3_create_module_v2(
+  sqlite3 *db,               /* SQLite connection to register module with */
+  const char *zName,         /* Name of the module */
+  const sqlite3_module *p,   /* Methods for the module */
+  void *pClientData,         /* Client data for xCreate/xConnect */
+  void(*xDestroy)(void*)     /* Module destructor function */
+);
+
+/*
+** CAPI3REF: Virtual Table Instance Object
+** KEYWORDS: sqlite3_vtab
+**
+** Every [virtual table module] implementation uses a subclass
+** of this object to describe a particular instance
+** of the [virtual table].  Each subclass will
+** be tailored to the specific needs of the module implementation.
+** The purpose of this superclass is to define certain fields that are
+** common to all module implementations.
+**
+** ^Virtual tables methods can set an error message by assigning a
+** string obtained from [sqlite3_mprintf()] to zErrMsg.  The method should
+** take care that any prior string is freed by a call to [sqlite3_free()]
+** prior to assigning a new string to zErrMsg.  ^After the error message
+** is delivered up to the client application, the string will be automatically
+** freed by sqlite3_free() and the zErrMsg field will be zeroed.
+*/
+struct sqlite3_vtab {
+  const sqlite3_module *pModule;  /* The module for this virtual table */
+  int nRef;                       /* NO LONGER USED */
+  char *zErrMsg;                  /* Error message from sqlite3_mprintf() */
+  /* Virtual table implementations will typically add additional fields */
+};
+
+/*
+** CAPI3REF: Virtual Table Cursor Object
+** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}
+**
+** Every [virtual table module] implementation uses a subclass of the
+** following structure to describe cursors that point into the
+** [virtual table] and are used
+** to loop through the virtual table.  Cursors are created using the
+** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed
+** by the [sqlite3_module.xClose | xClose] method.  Cursors are used
+** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods
+** of the module.  Each module implementation will define
+** the content of a cursor structure to suit its own needs.
+**
+** This superclass exists in order to define fields of the cursor that
+** are common to all implementations.
+*/
+struct sqlite3_vtab_cursor {
+  sqlite3_vtab *pVtab;      /* Virtual table of this cursor */
+  /* Virtual table implementations will typically add additional fields */
+};
+
+/*
+** CAPI3REF: Declare The Schema Of A Virtual Table
+**
+** ^The [xCreate] and [xConnect] methods of a
+** [virtual table module] call this interface
+** to declare the format (the names and datatypes of the columns) of
+** the virtual tables they implement.
+*/
+SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
+
+/*
+** CAPI3REF: Overload A Function For A Virtual Table
+**
+** ^(Virtual tables can provide alternative implementations of functions
+** using the [xFindFunction] method of the [virtual table module].  
+** But global versions of those functions
+** must exist in order to be overloaded.)^
+**
+** ^(This API makes sure a global version of a function with a particular
+** name and number of parameters exists.  If no such function exists
+** before this API is called, a new function is created.)^  ^The implementation
+** of the new function always causes an exception to be thrown.  So
+** the new function is not good for anything by itself.  Its only
+** purpose is to be a placeholder function that can be overloaded
+** by a [virtual table].
+*/
+SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
+
+/*
+** The interface to the virtual-table mechanism defined above (back up
+** to a comment remarkably similar to this one) is currently considered
+** to be experimental.  The interface might change in incompatible ways.
+** If this is a problem for you, do not use the interface at this time.
+**
+** When the virtual-table mechanism stabilizes, we will declare the
+** interface fixed, support it indefinitely, and remove this comment.
+*/
+
+/*
+** CAPI3REF: A Handle To An Open BLOB
+** KEYWORDS: {BLOB handle} {BLOB handles}
+**
+** An instance of this object represents an open BLOB on which
+** [sqlite3_blob_open | incremental BLOB I/O] can be performed.
+** ^Objects of this type are created by [sqlite3_blob_open()]
+** and destroyed by [sqlite3_blob_close()].
+** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces
+** can be used to read or write small subsections of the BLOB.
+** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.
+*/
+typedef struct sqlite3_blob sqlite3_blob;
+
+/*
+** CAPI3REF: Open A BLOB For Incremental I/O
+**
+** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located
+** in row iRow, column zColumn, table zTable in database zDb;
+** in other words, the same BLOB that would be selected by:
+**
+** <pre>
+**     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
+** </pre>)^
+**
+** ^If the flags parameter is non-zero, then the BLOB is opened for read
+** and write access. ^If it is zero, the BLOB is opened for read access.
+** ^It is not possible to open a column that is part of an index or primary 
+** key for writing. ^If [foreign key constraints] are enabled, it is 
+** not possible to open a column that is part of a [child key] for writing.
+**
+** ^Note that the database name is not the filename that contains
+** the database but rather the symbolic name of the database that
+** appears after the AS keyword when the database is connected using [ATTACH].
+** ^For the main database file, the database name is "main".
+** ^For TEMP tables, the database name is "temp".
+**
+** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
+** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
+** to be a null pointer.)^
+** ^This function sets the [database connection] error code and message
+** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
+** functions. ^Note that the *ppBlob variable is always initialized in a
+** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
+** regardless of the success or failure of this routine.
+**
+** ^(If the row that a BLOB handle points to is modified by an
+** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
+** then the BLOB handle is marked as "expired".
+** This is true if any column of the row is changed, even a column
+** other than the one the BLOB handle is open on.)^
+** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
+** an expired BLOB handle fail with a return code of [SQLITE_ABORT].
+** ^(Changes written into a BLOB prior to the BLOB expiring are not
+** rolled back by the expiration of the BLOB.  Such changes will eventually
+** commit if the transaction continues to completion.)^
+**
+** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
+** the opened blob.  ^The size of a blob may not be changed by this
+** interface.  Use the [UPDATE] SQL command to change the size of a
+** blob.
+**
+** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID]
+** table.  Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables.
+**
+** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
+** and the built-in [zeroblob] SQL function can be used, if desired,
+** to create an empty, zero-filled blob in which to read or write using
+** this interface.
+**
+** To avoid a resource leak, every open [BLOB handle] should eventually
+** be released by a call to [sqlite3_blob_close()].
+*/
+SQLITE_API int sqlite3_blob_open(
+  sqlite3*,
+  const char *zDb,
+  const char *zTable,
+  const char *zColumn,
+  sqlite3_int64 iRow,
+  int flags,
+  sqlite3_blob **ppBlob
+);
+
+/*
+** CAPI3REF: Move a BLOB Handle to a New Row
+**
+** ^This function is used to move an existing blob handle so that it points
+** to a different row of the same database table. ^The new row is identified
+** by the rowid value passed as the second argument. Only the row can be
+** changed. ^The database, table and column on which the blob handle is open
+** remain the same. Moving an existing blob handle to a new row can be
+** faster than closing the existing handle and opening a new one.
+**
+** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] -
+** it must exist and there must be either a blob or text value stored in
+** the nominated column.)^ ^If the new row is not present in the table, or if
+** it does not contain a blob or text value, or if another error occurs, an
+** SQLite error code is returned and the blob handle is considered aborted.
+** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or
+** [sqlite3_blob_reopen()] on an aborted blob handle immediately return
+** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
+** always returns zero.
+**
+** ^This function sets the database handle error code and message.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
+
+/*
+** CAPI3REF: Close A BLOB Handle
+**
+** ^Closes an open [BLOB handle].
+**
+** ^Closing a BLOB shall cause the current transaction to commit
+** if there are no other BLOBs, no pending prepared statements, and the
+** database connection is in [autocommit mode].
+** ^If any writes were made to the BLOB, they might be held in cache
+** until the close operation if they will fit.
+**
+** ^(Closing the BLOB often forces the changes
+** out to disk and so if any I/O errors occur, they will likely occur
+** at the time when the BLOB is closed.  Any errors that occur during
+** closing are reported as a non-zero return value.)^
+**
+** ^(The BLOB is closed unconditionally.  Even if this routine returns
+** an error code, the BLOB is still closed.)^
+**
+** ^Calling this routine with a null pointer (such as would be returned
+** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.
+*/
+SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
+
+/*
+** CAPI3REF: Return The Size Of An Open BLOB
+**
+** ^Returns the size in bytes of the BLOB accessible via the 
+** successfully opened [BLOB handle] in its only argument.  ^The
+** incremental blob I/O routines can only read or overwriting existing
+** blob content; they cannot change the size of a blob.
+**
+** This routine only works on a [BLOB handle] which has been created
+** by a prior successful call to [sqlite3_blob_open()] and which has not
+** been closed by [sqlite3_blob_close()].  Passing any other pointer in
+** to this routine results in undefined and probably undesirable behavior.
+*/
+SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
+
+/*
+** CAPI3REF: Read Data From A BLOB Incrementally
+**
+** ^(This function is used to read data from an open [BLOB handle] into a
+** caller-supplied buffer. N bytes of data are copied into buffer Z
+** from the open BLOB, starting at offset iOffset.)^
+**
+** ^If offset iOffset is less than N bytes from the end of the BLOB,
+** [SQLITE_ERROR] is returned and no data is read.  ^If N or iOffset is
+** less than zero, [SQLITE_ERROR] is returned and no data is read.
+** ^The size of the blob (and hence the maximum value of N+iOffset)
+** can be determined using the [sqlite3_blob_bytes()] interface.
+**
+** ^An attempt to read from an expired [BLOB handle] fails with an
+** error code of [SQLITE_ABORT].
+**
+** ^(On success, sqlite3_blob_read() returns SQLITE_OK.
+** Otherwise, an [error code] or an [extended error code] is returned.)^
+**
+** This routine only works on a [BLOB handle] which has been created
+** by a prior successful call to [sqlite3_blob_open()] and which has not
+** been closed by [sqlite3_blob_close()].  Passing any other pointer in
+** to this routine results in undefined and probably undesirable behavior.
+**
+** See also: [sqlite3_blob_write()].
+*/
+SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
+
+/*
+** CAPI3REF: Write Data Into A BLOB Incrementally
+**
+** ^This function is used to write data into an open [BLOB handle] from a
+** caller-supplied buffer. ^N bytes of data are copied from the buffer Z
+** into the open BLOB, starting at offset iOffset.
+**
+** ^If the [BLOB handle] passed as the first argument was not opened for
+** writing (the flags parameter to [sqlite3_blob_open()] was zero),
+** this function returns [SQLITE_READONLY].
+**
+** ^This function may only modify the contents of the BLOB; it is
+** not possible to increase the size of a BLOB using this API.
+** ^If offset iOffset is less than N bytes from the end of the BLOB,
+** [SQLITE_ERROR] is returned and no data is written.  ^If N is
+** less than zero [SQLITE_ERROR] is returned and no data is written.
+** The size of the BLOB (and hence the maximum value of N+iOffset)
+** can be determined using the [sqlite3_blob_bytes()] interface.
+**
+** ^An attempt to write to an expired [BLOB handle] fails with an
+** error code of [SQLITE_ABORT].  ^Writes to the BLOB that occurred
+** before the [BLOB handle] expired are not rolled back by the
+** expiration of the handle, though of course those changes might
+** have been overwritten by the statement that expired the BLOB handle
+** or by other independent statements.
+**
+** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
+** Otherwise, an  [error code] or an [extended error code] is returned.)^
+**
+** This routine only works on a [BLOB handle] which has been created
+** by a prior successful call to [sqlite3_blob_open()] and which has not
+** been closed by [sqlite3_blob_close()].  Passing any other pointer in
+** to this routine results in undefined and probably undesirable behavior.
+**
+** See also: [sqlite3_blob_read()].
+*/
+SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
+
+/*
+** CAPI3REF: Virtual File System Objects
+**
+** A virtual filesystem (VFS) is an [sqlite3_vfs] object
+** that SQLite uses to interact
+** with the underlying operating system.  Most SQLite builds come with a
+** single default VFS that is appropriate for the host computer.
+** New VFSes can be registered and existing VFSes can be unregistered.
+** The following interfaces are provided.
+**
+** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name.
+** ^Names are case sensitive.
+** ^Names are zero-terminated UTF-8 strings.
+** ^If there is no match, a NULL pointer is returned.
+** ^If zVfsName is NULL then the default VFS is returned.
+**
+** ^New VFSes are registered with sqlite3_vfs_register().
+** ^Each new VFS becomes the default VFS if the makeDflt flag is set.
+** ^The same VFS can be registered multiple times without injury.
+** ^To make an existing VFS into the default VFS, register it again
+** with the makeDflt flag set.  If two different VFSes with the
+** same name are registered, the behavior is undefined.  If a
+** VFS is registered with a name that is NULL or an empty string,
+** then the behavior is undefined.
+**
+** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
+** ^(If the default VFS is unregistered, another VFS is chosen as
+** the default.  The choice for the new VFS is arbitrary.)^
+*/
+SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
+SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
+SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
+
+/*
+** CAPI3REF: Mutexes
+**
+** The SQLite core uses these routines for thread
+** synchronization. Though they are intended for internal
+** use by SQLite, code that links against SQLite is
+** permitted to use any of these routines.
+**
+** The SQLite source code contains multiple implementations
+** of these mutex routines.  An appropriate implementation
+** is selected automatically at compile-time.  ^(The following
+** implementations are available in the SQLite core:
+**
+** <ul>
+** <li>   SQLITE_MUTEX_PTHREADS
+** <li>   SQLITE_MUTEX_W32
+** <li>   SQLITE_MUTEX_NOOP
+** </ul>)^
+**
+** ^The SQLITE_MUTEX_NOOP implementation is a set of routines
+** that does no real locking and is appropriate for use in
+** a single-threaded application.  ^The SQLITE_MUTEX_PTHREADS and
+** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
+** and Windows.
+**
+** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
+** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
+** implementation is included with the library. In this case the
+** application must supply a custom mutex implementation using the
+** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
+** before calling sqlite3_initialize() or any other public sqlite3_
+** function that calls sqlite3_initialize().)^
+**
+** ^The sqlite3_mutex_alloc() routine allocates a new
+** mutex and returns a pointer to it. ^If it returns NULL
+** that means that a mutex could not be allocated.  ^SQLite
+** will unwind its stack and return an error.  ^(The argument
+** to sqlite3_mutex_alloc() is one of these integer constants:
+**
+** <ul>
+** <li>  SQLITE_MUTEX_FAST
+** <li>  SQLITE_MUTEX_RECURSIVE
+** <li>  SQLITE_MUTEX_STATIC_MASTER
+** <li>  SQLITE_MUTEX_STATIC_MEM
+** <li>  SQLITE_MUTEX_STATIC_MEM2
+** <li>  SQLITE_MUTEX_STATIC_PRNG
+** <li>  SQLITE_MUTEX_STATIC_LRU
+** <li>  SQLITE_MUTEX_STATIC_LRU2
+** </ul>)^
+**
+** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
+** cause sqlite3_mutex_alloc() to create
+** a new mutex.  ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
+** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
+** The mutex implementation does not need to make a distinction
+** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
+** not want to.  ^SQLite will only request a recursive mutex in
+** cases where it really needs one.  ^If a faster non-recursive mutex
+** implementation is available on the host platform, the mutex subsystem
+** might return such a mutex in response to SQLITE_MUTEX_FAST.
+**
+** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
+** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
+** a pointer to a static preexisting mutex.  ^Six static mutexes are
+** used by the current version of SQLite.  Future versions of SQLite
+** may add additional static mutexes.  Static mutexes are for internal
+** use by SQLite only.  Applications that use SQLite mutexes should
+** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
+** SQLITE_MUTEX_RECURSIVE.
+**
+** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
+** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
+** returns a different mutex on every call.  ^But for the static
+** mutex types, the same mutex is returned on every call that has
+** the same type number.
+**
+** ^The sqlite3_mutex_free() routine deallocates a previously
+** allocated dynamic mutex.  ^SQLite is careful to deallocate every
+** dynamic mutex that it allocates.  The dynamic mutexes must not be in
+** use when they are deallocated.  Attempting to deallocate a static
+** mutex results in undefined behavior.  ^SQLite never deallocates
+** a static mutex.
+**
+** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
+** to enter a mutex.  ^If another thread is already within the mutex,
+** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
+** SQLITE_BUSY.  ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
+** upon successful entry.  ^(Mutexes created using
+** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
+** In such cases the,
+** mutex must be exited an equal number of times before another thread
+** can enter.)^  ^(If the same thread tries to enter any other
+** kind of mutex more than once, the behavior is undefined.
+** SQLite will never exhibit
+** such behavior in its own use of mutexes.)^
+**
+** ^(Some systems (for example, Windows 95) do not support the operation
+** implemented by sqlite3_mutex_try().  On those systems, sqlite3_mutex_try()
+** will always return SQLITE_BUSY.  The SQLite core only ever uses
+** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^
+**
+** ^The sqlite3_mutex_leave() routine exits a mutex that was
+** previously entered by the same thread.   ^(The behavior
+** is undefined if the mutex is not currently entered by the
+** calling thread or is not currently allocated.  SQLite will
+** never do either.)^
+**
+** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
+** sqlite3_mutex_leave() is a NULL pointer, then all three routines
+** behave as no-ops.
+**
+** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
+*/
+SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
+SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
+SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
+SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
+SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
+
+/*
+** CAPI3REF: Mutex Methods Object
+**
+** An instance of this structure defines the low-level routines
+** used to allocate and use mutexes.
+**
+** Usually, the default mutex implementations provided by SQLite are
+** sufficient, however the user has the option of substituting a custom
+** implementation for specialized deployments or systems for which SQLite
+** does not provide a suitable implementation. In this case, the user
+** creates and populates an instance of this structure to pass
+** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
+** Additionally, an instance of this structure can be used as an
+** output variable when querying the system for the current mutex
+** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
+**
+** ^The xMutexInit method defined by this structure is invoked as
+** part of system initialization by the sqlite3_initialize() function.
+** ^The xMutexInit routine is called by SQLite exactly once for each
+** effective call to [sqlite3_initialize()].
+**
+** ^The xMutexEnd method defined by this structure is invoked as
+** part of system shutdown by the sqlite3_shutdown() function. The
+** implementation of this method is expected to release all outstanding
+** resources obtained by the mutex methods implementation, especially
+** those obtained by the xMutexInit method.  ^The xMutexEnd()
+** interface is invoked exactly once for each call to [sqlite3_shutdown()].
+**
+** ^(The remaining seven methods defined by this structure (xMutexAlloc,
+** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
+** xMutexNotheld) implement the following interfaces (respectively):
+**
+** <ul>
+**   <li>  [sqlite3_mutex_alloc()] </li>
+**   <li>  [sqlite3_mutex_free()] </li>
+**   <li>  [sqlite3_mutex_enter()] </li>
+**   <li>  [sqlite3_mutex_try()] </li>
+**   <li>  [sqlite3_mutex_leave()] </li>
+**   <li>  [sqlite3_mutex_held()] </li>
+**   <li>  [sqlite3_mutex_notheld()] </li>
+** </ul>)^
+**
+** The only difference is that the public sqlite3_XXX functions enumerated
+** above silently ignore any invocations that pass a NULL pointer instead
+** of a valid mutex handle. The implementations of the methods defined
+** by this structure are not required to handle this case, the results
+** of passing a NULL pointer instead of a valid mutex handle are undefined
+** (i.e. it is acceptable to provide an implementation that segfaults if
+** it is passed a NULL pointer).
+**
+** The xMutexInit() method must be threadsafe.  ^It must be harmless to
+** invoke xMutexInit() multiple times within the same process and without
+** intervening calls to xMutexEnd().  Second and subsequent calls to
+** xMutexInit() must be no-ops.
+**
+** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
+** and its associates).  ^Similarly, xMutexAlloc() must not use SQLite memory
+** allocation for a static mutex.  ^However xMutexAlloc() may use SQLite
+** memory allocation for a fast or recursive mutex.
+**
+** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
+** called, but only if the prior call to xMutexInit returned SQLITE_OK.
+** If xMutexInit fails in any way, it is expected to clean up after itself
+** prior to returning.
+*/
+typedef struct sqlite3_mutex_methods sqlite3_mutex_methods;
+struct sqlite3_mutex_methods {
+  int (*xMutexInit)(void);
+  int (*xMutexEnd)(void);
+  sqlite3_mutex *(*xMutexAlloc)(int);
+  void (*xMutexFree)(sqlite3_mutex *);
+  void (*xMutexEnter)(sqlite3_mutex *);
+  int (*xMutexTry)(sqlite3_mutex *);
+  void (*xMutexLeave)(sqlite3_mutex *);
+  int (*xMutexHeld)(sqlite3_mutex *);
+  int (*xMutexNotheld)(sqlite3_mutex *);
+};
+
+/*
+** CAPI3REF: Mutex Verification Routines
+**
+** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
+** are intended for use inside assert() statements.  ^The SQLite core
+** never uses these routines except inside an assert() and applications
+** are advised to follow the lead of the core.  ^The SQLite core only
+** provides implementations for these routines when it is compiled
+** with the SQLITE_DEBUG flag.  ^External mutex implementations
+** are only required to provide these routines if SQLITE_DEBUG is
+** defined and if NDEBUG is not defined.
+**
+** ^These routines should return true if the mutex in their argument
+** is held or not held, respectively, by the calling thread.
+**
+** ^The implementation is not required to provide versions of these
+** routines that actually work. If the implementation does not provide working
+** versions of these routines, it should at least provide stubs that always
+** return true so that one does not get spurious assertion failures.
+**
+** ^If the argument to sqlite3_mutex_held() is a NULL pointer then
+** the routine should return 1.   This seems counter-intuitive since
+** clearly the mutex cannot be held if it does not exist.  But
+** the reason the mutex does not exist is because the build is not
+** using mutexes.  And we do not want the assert() containing the
+** call to sqlite3_mutex_held() to fail, so a non-zero return is
+** the appropriate thing to do.  ^The sqlite3_mutex_notheld()
+** interface should also return 1 when given a NULL pointer.
+*/
+#ifndef NDEBUG
+SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
+SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
+#endif
+
+/*
+** CAPI3REF: Mutex Types
+**
+** The [sqlite3_mutex_alloc()] interface takes a single argument
+** which is one of these integer constants.
+**
+** The set of static mutexes may change from one SQLite release to the
+** next.  Applications that override the built-in mutex logic must be
+** prepared to accommodate additional static mutexes.
+*/
+#define SQLITE_MUTEX_FAST             0
+#define SQLITE_MUTEX_RECURSIVE        1
+#define SQLITE_MUTEX_STATIC_MASTER    2
+#define SQLITE_MUTEX_STATIC_MEM       3  /* sqlite3_malloc() */
+#define SQLITE_MUTEX_STATIC_MEM2      4  /* NOT USED */
+#define SQLITE_MUTEX_STATIC_OPEN      4  /* sqlite3BtreeOpen() */
+#define SQLITE_MUTEX_STATIC_PRNG      5  /* sqlite3_random() */
+#define SQLITE_MUTEX_STATIC_LRU       6  /* lru page list */
+#define SQLITE_MUTEX_STATIC_LRU2      7  /* NOT USED */
+#define SQLITE_MUTEX_STATIC_PMEM      7  /* sqlite3PageMalloc() */
+
+/*
+** CAPI3REF: Retrieve the mutex for a database connection
+**
+** ^This interface returns a pointer the [sqlite3_mutex] object that 
+** serializes access to the [database connection] given in the argument
+** when the [threading mode] is Serialized.
+** ^If the [threading mode] is Single-thread or Multi-thread then this
+** routine returns a NULL pointer.
+*/
+SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
+
+/*
+** CAPI3REF: Low-Level Control Of Database Files
+**
+** ^The [sqlite3_file_control()] interface makes a direct call to the
+** xFileControl method for the [sqlite3_io_methods] object associated
+** with a particular database identified by the second argument. ^The
+** name of the database is "main" for the main database or "temp" for the
+** TEMP database, or the name that appears after the AS keyword for
+** databases that are added using the [ATTACH] SQL command.
+** ^A NULL pointer can be used in place of "main" to refer to the
+** main database file.
+** ^The third and fourth parameters to this routine
+** are passed directly through to the second and third parameters of
+** the xFileControl method.  ^The return value of the xFileControl
+** method becomes the return value of this routine.
+**
+** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes
+** a pointer to the underlying [sqlite3_file] object to be written into
+** the space pointed to by the 4th parameter.  ^The SQLITE_FCNTL_FILE_POINTER
+** case is a short-circuit path which does not actually invoke the
+** underlying sqlite3_io_methods.xFileControl method.
+**
+** ^If the second parameter (zDbName) does not match the name of any
+** open database file, then SQLITE_ERROR is returned.  ^This error
+** code is not remembered and will not be recalled by [sqlite3_errcode()]
+** or [sqlite3_errmsg()].  The underlying xFileControl method might
+** also return SQLITE_ERROR.  There is no way to distinguish between
+** an incorrect zDbName and an SQLITE_ERROR return from the underlying
+** xFileControl method.
+**
+** See also: [SQLITE_FCNTL_LOCKSTATE]
+*/
+SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
+
+/*
+** CAPI3REF: Testing Interface
+**
+** ^The sqlite3_test_control() interface is used to read out internal
+** state of SQLite and to inject faults into SQLite for testing
+** purposes.  ^The first parameter is an operation code that determines
+** the number, meaning, and operation of all subsequent parameters.
+**
+** This interface is not for use by applications.  It exists solely
+** for verifying the correct operation of the SQLite library.  Depending
+** on how the SQLite library is compiled, this interface might not exist.
+**
+** The details of the operation codes, their meanings, the parameters
+** they take, and what they do are all subject to change without notice.
+** Unlike most of the SQLite API, this function is not guaranteed to
+** operate consistently from one release to the next.
+*/
+SQLITE_API int sqlite3_test_control(int op, ...);
+
+/*
+** CAPI3REF: Testing Interface Operation Codes
+**
+** These constants are the valid operation code parameters used
+** as the first argument to [sqlite3_test_control()].
+**
+** These parameters and their meanings are subject to change
+** without notice.  These values are for testing purposes only.
+** Applications should not use any of these parameters or the
+** [sqlite3_test_control()] interface.
+*/
+#define SQLITE_TESTCTRL_FIRST                    5
+#define SQLITE_TESTCTRL_PRNG_SAVE                5
+#define SQLITE_TESTCTRL_PRNG_RESTORE             6
+#define SQLITE_TESTCTRL_PRNG_RESET               7
+#define SQLITE_TESTCTRL_BITVEC_TEST              8
+#define SQLITE_TESTCTRL_FAULT_INSTALL            9
+#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS     10
+#define SQLITE_TESTCTRL_PENDING_BYTE            11
+#define SQLITE_TESTCTRL_ASSERT                  12
+#define SQLITE_TESTCTRL_ALWAYS                  13
+#define SQLITE_TESTCTRL_RESERVE                 14
+#define SQLITE_TESTCTRL_OPTIMIZATIONS           15
+#define SQLITE_TESTCTRL_ISKEYWORD               16
+#define SQLITE_TESTCTRL_SCRATCHMALLOC           17
+#define SQLITE_TESTCTRL_LOCALTIME_FAULT         18
+#define SQLITE_TESTCTRL_EXPLAIN_STMT            19
+#define SQLITE_TESTCTRL_NEVER_CORRUPT           20
+#define SQLITE_TESTCTRL_LAST                    20
+
+/*
+** CAPI3REF: SQLite Runtime Status
+**
+** ^This interface is used to retrieve runtime status information
+** about the performance of SQLite, and optionally to reset various
+** highwater marks.  ^The first argument is an integer code for
+** the specific parameter to measure.  ^(Recognized integer codes
+** are of the form [status parameters | SQLITE_STATUS_...].)^
+** ^The current value of the parameter is returned into *pCurrent.
+** ^The highest recorded value is returned in *pHighwater.  ^If the
+** resetFlag is true, then the highest record value is reset after
+** *pHighwater is written.  ^(Some parameters do not record the highest
+** value.  For those parameters
+** nothing is written into *pHighwater and the resetFlag is ignored.)^
+** ^(Other parameters record only the highwater mark and not the current
+** value.  For these latter parameters nothing is written into *pCurrent.)^
+**
+** ^The sqlite3_status() routine returns SQLITE_OK on success and a
+** non-zero [error code] on failure.
+**
+** This routine is threadsafe but is not atomic.  This routine can be
+** called while other threads are running the same or different SQLite
+** interfaces.  However the values returned in *pCurrent and
+** *pHighwater reflect the status of SQLite at different points in time
+** and it is possible that another thread might change the parameter
+** in between the times when *pCurrent and *pHighwater are written.
+**
+** See also: [sqlite3_db_status()]
+*/
+SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
+
+
+/*
+** CAPI3REF: Status Parameters
+** KEYWORDS: {status parameters}
+**
+** These integer constants designate various run-time status parameters
+** that can be returned by [sqlite3_status()].
+**
+** <dl>
+** [[SQLITE_STATUS_MEMORY_USED]] ^(<dt>SQLITE_STATUS_MEMORY_USED</dt>
+** <dd>This parameter is the current amount of memory checked out
+** using [sqlite3_malloc()], either directly or indirectly.  The
+** figure includes calls made to [sqlite3_malloc()] by the application
+** and internal memory usage by the SQLite library.  Scratch memory
+** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache
+** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
+** this parameter.  The amount returned is the sum of the allocation
+** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^
+**
+** [[SQLITE_STATUS_MALLOC_SIZE]] ^(<dt>SQLITE_STATUS_MALLOC_SIZE</dt>
+** <dd>This parameter records the largest memory allocation request
+** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their
+** internal equivalents).  Only the value returned in the
+** *pHighwater parameter to [sqlite3_status()] is of interest.  
+** The value written into the *pCurrent parameter is undefined.</dd>)^
+**
+** [[SQLITE_STATUS_MALLOC_COUNT]] ^(<dt>SQLITE_STATUS_MALLOC_COUNT</dt>
+** <dd>This parameter records the number of separate memory allocations
+** currently checked out.</dd>)^
+**
+** [[SQLITE_STATUS_PAGECACHE_USED]] ^(<dt>SQLITE_STATUS_PAGECACHE_USED</dt>
+** <dd>This parameter returns the number of pages used out of the
+** [pagecache memory allocator] that was configured using 
+** [SQLITE_CONFIG_PAGECACHE].  The
+** value returned is in pages, not in bytes.</dd>)^
+**
+** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]] 
+** ^(<dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>
+** <dd>This parameter returns the number of bytes of page cache
+** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
+** buffer and where forced to overflow to [sqlite3_malloc()].  The
+** returned value includes allocations that overflowed because they
+** where too large (they were larger than the "sz" parameter to
+** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
+** no space was left in the page cache.</dd>)^
+**
+** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>
+** <dd>This parameter records the largest memory allocation request
+** handed to [pagecache memory allocator].  Only the value returned in the
+** *pHighwater parameter to [sqlite3_status()] is of interest.  
+** The value written into the *pCurrent parameter is undefined.</dd>)^
+**
+** [[SQLITE_STATUS_SCRATCH_USED]] ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt>
+** <dd>This parameter returns the number of allocations used out of the
+** [scratch memory allocator] configured using
+** [SQLITE_CONFIG_SCRATCH].  The value returned is in allocations, not
+** in bytes.  Since a single thread may only have one scratch allocation
+** outstanding at time, this parameter also reports the number of threads
+** using scratch memory at the same time.</dd>)^
+**
+** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
+** <dd>This parameter returns the number of bytes of scratch memory
+** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH]
+** buffer and where forced to overflow to [sqlite3_malloc()].  The values
+** returned include overflows because the requested allocation was too
+** larger (that is, because the requested allocation was larger than the
+** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer
+** slots were available.
+** </dd>)^
+**
+** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
+** <dd>This parameter records the largest memory allocation request
+** handed to [scratch memory allocator].  Only the value returned in the
+** *pHighwater parameter to [sqlite3_status()] is of interest.  
+** The value written into the *pCurrent parameter is undefined.</dd>)^
+**
+** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
+** <dd>This parameter records the deepest parser stack.  It is only
+** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^
+** </dl>
+**
+** New status parameters may be added from time to time.
+*/
+#define SQLITE_STATUS_MEMORY_USED          0
+#define SQLITE_STATUS_PAGECACHE_USED       1
+#define SQLITE_STATUS_PAGECACHE_OVERFLOW   2
+#define SQLITE_STATUS_SCRATCH_USED         3
+#define SQLITE_STATUS_SCRATCH_OVERFLOW     4
+#define SQLITE_STATUS_MALLOC_SIZE          5
+#define SQLITE_STATUS_PARSER_STACK         6
+#define SQLITE_STATUS_PAGECACHE_SIZE       7
+#define SQLITE_STATUS_SCRATCH_SIZE         8
+#define SQLITE_STATUS_MALLOC_COUNT         9
+
+/*
+** CAPI3REF: Database Connection Status
+**
+** ^This interface is used to retrieve runtime status information 
+** about a single [database connection].  ^The first argument is the
+** database connection object to be interrogated.  ^The second argument
+** is an integer constant, taken from the set of
+** [SQLITE_DBSTATUS options], that
+** determines the parameter to interrogate.  The set of 
+** [SQLITE_DBSTATUS options] is likely
+** to grow in future releases of SQLite.
+**
+** ^The current value of the requested parameter is written into *pCur
+** and the highest instantaneous value is written into *pHiwtr.  ^If
+** the resetFlg is true, then the highest instantaneous value is
+** reset back down to the current value.
+**
+** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
+** non-zero [error code] on failure.
+**
+** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
+*/
+SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
+
+/*
+** CAPI3REF: Status Parameters for database connections
+** KEYWORDS: {SQLITE_DBSTATUS options}
+**
+** These constants are the available integer "verbs" that can be passed as
+** the second argument to the [sqlite3_db_status()] interface.
+**
+** New verbs may be added in future releases of SQLite. Existing verbs
+** might be discontinued. Applications should check the return code from
+** [sqlite3_db_status()] to make sure that the call worked.
+** The [sqlite3_db_status()] interface will return a non-zero error code
+** if a discontinued or unsupported verb is invoked.
+**
+** <dl>
+** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>
+** <dd>This parameter returns the number of lookaside memory slots currently
+** checked out.</dd>)^
+**
+** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
+** <dd>This parameter returns the number malloc attempts that were 
+** satisfied using lookaside memory. Only the high-water value is meaningful;
+** the current value is always zero.)^
+**
+** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
+** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
+** <dd>This parameter returns the number malloc attempts that might have
+** been satisfied using lookaside memory but failed due to the amount of
+** memory requested being larger than the lookaside slot size.
+** Only the high-water value is meaningful;
+** the current value is always zero.)^
+**
+** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
+** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
+** <dd>This parameter returns the number malloc attempts that might have
+** been satisfied using lookaside memory but failed due to all lookaside
+** memory already being in use.
+** Only the high-water value is meaningful;
+** the current value is always zero.)^
+**
+** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
+** <dd>This parameter returns the approximate number of of bytes of heap
+** memory used by all pager caches associated with the database connection.)^
+** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
+**
+** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
+** <dd>This parameter returns the approximate number of of bytes of heap
+** memory used to store the schema for all databases associated
+** with the connection - main, temp, and any [ATTACH]-ed databases.)^ 
+** ^The full amount of memory used by the schemas is reported, even if the
+** schema memory is shared with other database connections due to
+** [shared cache mode] being enabled.
+** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
+**
+** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
+** <dd>This parameter returns the approximate number of of bytes of heap
+** and lookaside memory used by all prepared statements associated with
+** the database connection.)^
+** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(<dt>SQLITE_DBSTATUS_CACHE_HIT</dt>
+** <dd>This parameter returns the number of pager cache hits that have
+** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT 
+** is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(<dt>SQLITE_DBSTATUS_CACHE_MISS</dt>
+** <dd>This parameter returns the number of pager cache misses that have
+** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS 
+** is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_WRITE]] ^(<dt>SQLITE_DBSTATUS_CACHE_WRITE</dt>
+** <dd>This parameter returns the number of dirty cache entries that have
+** been written to disk. Specifically, the number of pages written to the
+** wal file in wal mode databases, or the number of pages written to the
+** database file in rollback mode databases. Any pages written as part of
+** transaction rollback or database recovery operations are not included.
+** If an IO or other error occurs while writing a page to disk, the effect
+** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
+** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt>
+** <dd>This parameter returns zero for the current value if and only if
+** all foreign key constraints (deferred or immediate) have been
+** resolved.)^  ^The highwater mark is always 0.
+** </dd>
+** </dl>
+*/
+#define SQLITE_DBSTATUS_LOOKASIDE_USED       0
+#define SQLITE_DBSTATUS_CACHE_USED           1
+#define SQLITE_DBSTATUS_SCHEMA_USED          2
+#define SQLITE_DBSTATUS_STMT_USED            3
+#define SQLITE_DBSTATUS_LOOKASIDE_HIT        4
+#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE  5
+#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL  6
+#define SQLITE_DBSTATUS_CACHE_HIT            7
+#define SQLITE_DBSTATUS_CACHE_MISS           8
+#define SQLITE_DBSTATUS_CACHE_WRITE          9
+#define SQLITE_DBSTATUS_DEFERRED_FKS        10
+#define SQLITE_DBSTATUS_MAX                 10   /* Largest defined DBSTATUS */
+
+
+/*
+** CAPI3REF: Prepared Statement Status
+**
+** ^(Each prepared statement maintains various
+** [SQLITE_STMTSTATUS counters] that measure the number
+** of times it has performed specific operations.)^  These counters can
+** be used to monitor the performance characteristics of the prepared
+** statements.  For example, if the number of table steps greatly exceeds
+** the number of table searches or result rows, that would tend to indicate
+** that the prepared statement is using a full table scan rather than
+** an index.  
+**
+** ^(This interface is used to retrieve and reset counter values from
+** a [prepared statement].  The first argument is the prepared statement
+** object to be interrogated.  The second argument
+** is an integer code for a specific [SQLITE_STMTSTATUS counter]
+** to be interrogated.)^
+** ^The current value of the requested counter is returned.
+** ^If the resetFlg is true, then the counter is reset to zero after this
+** interface call returns.
+**
+** See also: [sqlite3_status()] and [sqlite3_db_status()].
+*/
+SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
+
+/*
+** CAPI3REF: Status Parameters for prepared statements
+** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
+**
+** These preprocessor macros define integer codes that name counter
+** values associated with the [sqlite3_stmt_status()] interface.
+** The meanings of the various counters are as follows:
+**
+** <dl>
+** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]] <dt>SQLITE_STMTSTATUS_FULLSCAN_STEP</dt>
+** <dd>^This is the number of times that SQLite has stepped forward in
+** a table as part of a full table scan.  Large numbers for this counter
+** may indicate opportunities for performance improvement through 
+** careful use of indices.</dd>
+**
+** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
+** <dd>^This is the number of sort operations that have occurred.
+** A non-zero value in this counter may indicate an opportunity to
+** improvement performance through careful use of indices.</dd>
+**
+** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
+** <dd>^This is the number of rows inserted into transient indices that
+** were created automatically in order to help joins run faster.
+** A non-zero value in this counter may indicate an opportunity to
+** improvement performance by adding permanent indices that do not
+** need to be reinitialized each time the statement is run.</dd>
+**
+** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
+** <dd>^This is the number of virtual machine operations executed
+** by the prepared statement if that number is less than or equal
+** to 2147483647.  The number of virtual machine operations can be 
+** used as a proxy for the total work done by the prepared statement.
+** If the number of virtual machine operations exceeds 2147483647
+** then the value returned by this statement status code is undefined.
+** </dd>
+** </dl>
+*/
+#define SQLITE_STMTSTATUS_FULLSCAN_STEP     1
+#define SQLITE_STMTSTATUS_SORT              2
+#define SQLITE_STMTSTATUS_AUTOINDEX         3
+#define SQLITE_STMTSTATUS_VM_STEP           4
+
+/*
+** CAPI3REF: Custom Page Cache Object
+**
+** The sqlite3_pcache type is opaque.  It is implemented by
+** the pluggable module.  The SQLite core has no knowledge of
+** its size or internal structure and never deals with the
+** sqlite3_pcache object except by holding and passing pointers
+** to the object.
+**
+** See [sqlite3_pcache_methods2] for additional information.
+*/
+typedef struct sqlite3_pcache sqlite3_pcache;
+
+/*
+** CAPI3REF: Custom Page Cache Object
+**
+** The sqlite3_pcache_page object represents a single page in the
+** page cache.  The page cache will allocate instances of this
+** object.  Various methods of the page cache use pointers to instances
+** of this object as parameters or as their return value.
+**
+** See [sqlite3_pcache_methods2] for additional information.
+*/
+typedef struct sqlite3_pcache_page sqlite3_pcache_page;
+struct sqlite3_pcache_page {
+  void *pBuf;        /* The content of the page */
+  void *pExtra;      /* Extra information associated with the page */
+};
+
+/*
+** CAPI3REF: Application Defined Page Cache.
+** KEYWORDS: {page cache}
+**
+** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
+** register an alternative page cache implementation by passing in an 
+** instance of the sqlite3_pcache_methods2 structure.)^
+** In many applications, most of the heap memory allocated by 
+** SQLite is used for the page cache.
+** By implementing a 
+** custom page cache using this API, an application can better control
+** the amount of memory consumed by SQLite, the way in which 
+** that memory is allocated and released, and the policies used to 
+** determine exactly which parts of a database file are cached and for 
+** how long.
+**
+** The alternative page cache mechanism is an
+** extreme measure that is only needed by the most demanding applications.
+** The built-in page cache is recommended for most uses.
+**
+** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
+** internal buffer by SQLite within the call to [sqlite3_config].  Hence
+** the application may discard the parameter after the call to
+** [sqlite3_config()] returns.)^
+**
+** [[the xInit() page cache method]]
+** ^(The xInit() method is called once for each effective 
+** call to [sqlite3_initialize()])^
+** (usually only once during the lifetime of the process). ^(The xInit()
+** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^
+** The intent of the xInit() method is to set up global data structures 
+** required by the custom page cache implementation. 
+** ^(If the xInit() method is NULL, then the 
+** built-in default page cache is used instead of the application defined
+** page cache.)^
+**
+** [[the xShutdown() page cache method]]
+** ^The xShutdown() method is called by [sqlite3_shutdown()].
+** It can be used to clean up 
+** any outstanding resources before process shutdown, if required.
+** ^The xShutdown() method may be NULL.
+**
+** ^SQLite automatically serializes calls to the xInit method,
+** so the xInit method need not be threadsafe.  ^The
+** xShutdown method is only called from [sqlite3_shutdown()] so it does
+** not need to be threadsafe either.  All other methods must be threadsafe
+** in multithreaded applications.
+**
+** ^SQLite will never invoke xInit() more than once without an intervening
+** call to xShutdown().
+**
+** [[the xCreate() page cache methods]]
+** ^SQLite invokes the xCreate() method to construct a new cache instance.
+** SQLite will typically create one cache instance for each open database file,
+** though this is not guaranteed. ^The
+** first parameter, szPage, is the size in bytes of the pages that must
+** be allocated by the cache.  ^szPage will always a power of two.  ^The
+** second parameter szExtra is a number of bytes of extra storage 
+** associated with each page cache entry.  ^The szExtra parameter will
+** a number less than 250.  SQLite will use the
+** extra szExtra bytes on each page to store metadata about the underlying
+** database page on disk.  The value passed into szExtra depends
+** on the SQLite version, the target platform, and how SQLite was compiled.
+** ^The third argument to xCreate(), bPurgeable, is true if the cache being
+** created will be used to cache database pages of a file stored on disk, or
+** false if it is used for an in-memory database. The cache implementation
+** does not have to do anything special based with the value of bPurgeable;
+** it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will
+** never invoke xUnpin() except to deliberately delete a page.
+** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
+** false will always have the "discard" flag set to true.  
+** ^Hence, a cache created with bPurgeable false will
+** never contain any unpinned pages.
+**
+** [[the xCachesize() page cache method]]
+** ^(The xCachesize() method may be called at any time by SQLite to set the
+** suggested maximum cache-size (number of pages stored by) the cache
+** instance passed as the first argument. This is the value configured using
+** the SQLite "[PRAGMA cache_size]" command.)^  As with the bPurgeable
+** parameter, the implementation is not required to do anything with this
+** value; it is advisory only.
+**
+** [[the xPagecount() page cache methods]]
+** The xPagecount() method must return the number of pages currently
+** stored in the cache, both pinned and unpinned.
+** 
+** [[the xFetch() page cache methods]]
+** The xFetch() method locates a page in the cache and returns a pointer to 
+** an sqlite3_pcache_page object associated with that page, or a NULL pointer.
+** The pBuf element of the returned sqlite3_pcache_page object will be a
+** pointer to a buffer of szPage bytes used to store the content of a 
+** single database page.  The pExtra element of sqlite3_pcache_page will be
+** a pointer to the szExtra bytes of extra storage that SQLite has requested
+** for each entry in the page cache.
+**
+** The page to be fetched is determined by the key. ^The minimum key value
+** is 1.  After it has been retrieved using xFetch, the page is considered
+** to be "pinned".
+**
+** If the requested page is already in the page cache, then the page cache
+** implementation must return a pointer to the page buffer with its content
+** intact.  If the requested page is not already in the cache, then the
+** cache implementation should use the value of the createFlag
+** parameter to help it determined what action to take:
+**
+** <table border=1 width=85% align=center>
+** <tr><th> createFlag <th> Behavior when page is not already in cache
+** <tr><td> 0 <td> Do not allocate a new page.  Return NULL.
+** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
+**                 Otherwise return NULL.
+** <tr><td> 2 <td> Make every effort to allocate a new page.  Only return
+**                 NULL if allocating a new page is effectively impossible.
+** </table>
+**
+** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite
+** will only use a createFlag of 2 after a prior call with a createFlag of 1
+** failed.)^  In between the to xFetch() calls, SQLite may
+** attempt to unpin one or more cache pages by spilling the content of
+** pinned pages to disk and synching the operating system disk cache.
+**
+** [[the xUnpin() page cache method]]
+** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
+** as its second argument.  If the third parameter, discard, is non-zero,
+** then the page must be evicted from the cache.
+** ^If the discard parameter is
+** zero, then the page may be discarded or retained at the discretion of
+** page cache implementation. ^The page cache implementation
+** may choose to evict unpinned pages at any time.
+**
+** The cache must not perform any reference counting. A single 
+** call to xUnpin() unpins the page regardless of the number of prior calls 
+** to xFetch().
+**
+** [[the xRekey() page cache methods]]
+** The xRekey() method is used to change the key value associated with the
+** page passed as the second argument. If the cache
+** previously contains an entry associated with newKey, it must be
+** discarded. ^Any prior cache entry associated with newKey is guaranteed not
+** to be pinned.
+**
+** When SQLite calls the xTruncate() method, the cache must discard all
+** existing cache entries with page numbers (keys) greater than or equal
+** to the value of the iLimit parameter passed to xTruncate(). If any
+** of these pages are pinned, they are implicitly unpinned, meaning that
+** they can be safely discarded.
+**
+** [[the xDestroy() page cache method]]
+** ^The xDestroy() method is used to delete a cache allocated by xCreate().
+** All resources associated with the specified cache should be freed. ^After
+** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
+** handle invalid, and will not use it with any other sqlite3_pcache_methods2
+** functions.
+**
+** [[the xShrink() page cache method]]
+** ^SQLite invokes the xShrink() method when it wants the page cache to
+** free up as much of heap memory as possible.  The page cache implementation
+** is not obligated to free any memory, but well-behaved implementations should
+** do their best.
+*/
+typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
+struct sqlite3_pcache_methods2 {
+  int iVersion;
+  void *pArg;
+  int (*xInit)(void*);
+  void (*xShutdown)(void*);
+  sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable);
+  void (*xCachesize)(sqlite3_pcache*, int nCachesize);
+  int (*xPagecount)(sqlite3_pcache*);
+  sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
+  void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard);
+  void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, 
+      unsigned oldKey, unsigned newKey);
+  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
+  void (*xDestroy)(sqlite3_pcache*);
+  void (*xShrink)(sqlite3_pcache*);
+};
+
+/*
+** This is the obsolete pcache_methods object that has now been replaced
+** by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is
+** retained in the header file for backwards compatibility only.
+*/
+typedef struct sqlite3_pcache_methods sqlite3_pcache_methods;
+struct sqlite3_pcache_methods {
+  void *pArg;
+  int (*xInit)(void*);
+  void (*xShutdown)(void*);
+  sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable);
+  void (*xCachesize)(sqlite3_pcache*, int nCachesize);
+  int (*xPagecount)(sqlite3_pcache*);
+  void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
+  void (*xUnpin)(sqlite3_pcache*, void*, int discard);
+  void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey);
+  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
+  void (*xDestroy)(sqlite3_pcache*);
+};
+
+
+/*
+** CAPI3REF: Online Backup Object
+**
+** The sqlite3_backup object records state information about an ongoing
+** online backup operation.  ^The sqlite3_backup object is created by
+** a call to [sqlite3_backup_init()] and is destroyed by a call to
+** [sqlite3_backup_finish()].
+**
+** See Also: [Using the SQLite Online Backup API]
+*/
+typedef struct sqlite3_backup sqlite3_backup;
+
+/*
+** CAPI3REF: Online Backup API.
+**
+** The backup API copies the content of one database into another.
+** It is useful either for creating backups of databases or
+** for copying in-memory databases to or from persistent files. 
+**
+** See Also: [Using the SQLite Online Backup API]
+**
+** ^SQLite holds a write transaction open on the destination database file
+** for the duration of the backup operation.
+** ^The source database is read-locked only while it is being read;
+** it is not locked continuously for the entire backup operation.
+** ^Thus, the backup may be performed on a live source database without
+** preventing other database connections from
+** reading or writing to the source database while the backup is underway.
+** 
+** ^(To perform a backup operation: 
+**   <ol>
+**     <li><b>sqlite3_backup_init()</b> is called once to initialize the
+**         backup, 
+**     <li><b>sqlite3_backup_step()</b> is called one or more times to transfer 
+**         the data between the two databases, and finally
+**     <li><b>sqlite3_backup_finish()</b> is called to release all resources 
+**         associated with the backup operation. 
+**   </ol>)^
+** There should be exactly one call to sqlite3_backup_finish() for each
+** successful call to sqlite3_backup_init().
+**
+** [[sqlite3_backup_init()]] <b>sqlite3_backup_init()</b>
+**
+** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the 
+** [database connection] associated with the destination database 
+** and the database name, respectively.
+** ^The database name is "main" for the main database, "temp" for the
+** temporary database, or the name specified after the AS keyword in
+** an [ATTACH] statement for an attached database.
+** ^The S and M arguments passed to 
+** sqlite3_backup_init(D,N,S,M) identify the [database connection]
+** and database name of the source database, respectively.
+** ^The source and destination [database connections] (parameters S and D)
+** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
+** an error.
+**
+** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
+** returned and an error code and error message are stored in the
+** destination [database connection] D.
+** ^The error code and message for the failed call to sqlite3_backup_init()
+** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or
+** [sqlite3_errmsg16()] functions.
+** ^A successful call to sqlite3_backup_init() returns a pointer to an
+** [sqlite3_backup] object.
+** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and
+** sqlite3_backup_finish() functions to perform the specified backup 
+** operation.
+**
+** [[sqlite3_backup_step()]] <b>sqlite3_backup_step()</b>
+**
+** ^Function sqlite3_backup_step(B,N) will copy up to N pages between 
+** the source and destination databases specified by [sqlite3_backup] object B.
+** ^If N is negative, all remaining source pages are copied. 
+** ^If sqlite3_backup_step(B,N) successfully copies N pages and there
+** are still more pages to be copied, then the function returns [SQLITE_OK].
+** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages
+** from source to destination, then it returns [SQLITE_DONE].
+** ^If an error occurs while running sqlite3_backup_step(B,N),
+** then an [error code] is returned. ^As well as [SQLITE_OK] and
+** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY],
+** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an
+** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.
+**
+** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if
+** <ol>
+** <li> the destination database was opened read-only, or
+** <li> the destination database is using write-ahead-log journaling
+** and the destination and source page sizes differ, or
+** <li> the destination database is an in-memory database and the
+** destination and source page sizes differ.
+** </ol>)^
+**
+** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then
+** the [sqlite3_busy_handler | busy-handler function]
+** is invoked (if one is specified). ^If the 
+** busy-handler returns non-zero before the lock is available, then 
+** [SQLITE_BUSY] is returned to the caller. ^In this case the call to
+** sqlite3_backup_step() can be retried later. ^If the source
+** [database connection]
+** is being used to write to the source database when sqlite3_backup_step()
+** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this
+** case the call to sqlite3_backup_step() can be retried later on. ^(If
+** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or
+** [SQLITE_READONLY] is returned, then 
+** there is no point in retrying the call to sqlite3_backup_step(). These 
+** errors are considered fatal.)^  The application must accept 
+** that the backup operation has failed and pass the backup operation handle 
+** to the sqlite3_backup_finish() to release associated resources.
+**
+** ^The first call to sqlite3_backup_step() obtains an exclusive lock
+** on the destination file. ^The exclusive lock is not released until either 
+** sqlite3_backup_finish() is called or the backup operation is complete 
+** and sqlite3_backup_step() returns [SQLITE_DONE].  ^Every call to
+** sqlite3_backup_step() obtains a [shared lock] on the source database that
+** lasts for the duration of the sqlite3_backup_step() call.
+** ^Because the source database is not locked between calls to
+** sqlite3_backup_step(), the source database may be modified mid-way
+** through the backup process.  ^If the source database is modified by an
+** external process or via a database connection other than the one being
+** used by the backup operation, then the backup will be automatically
+** restarted by the next call to sqlite3_backup_step(). ^If the source 
+** database is modified by the using the same database connection as is used
+** by the backup operation, then the backup database is automatically
+** updated at the same time.
+**
+** [[sqlite3_backup_finish()]] <b>sqlite3_backup_finish()</b>
+**
+** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the 
+** application wishes to abandon the backup operation, the application
+** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().
+** ^The sqlite3_backup_finish() interfaces releases all
+** resources associated with the [sqlite3_backup] object. 
+** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any
+** active write-transaction on the destination database is rolled back.
+** The [sqlite3_backup] object is invalid
+** and may not be used following a call to sqlite3_backup_finish().
+**
+** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
+** sqlite3_backup_step() errors occurred, regardless or whether or not
+** sqlite3_backup_step() completed.
+** ^If an out-of-memory condition or IO error occurred during any prior
+** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
+** sqlite3_backup_finish() returns the corresponding [error code].
+**
+** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()
+** is not a permanent error and does not affect the return value of
+** sqlite3_backup_finish().
+**
+** [[sqlite3_backup__remaining()]] [[sqlite3_backup_pagecount()]]
+** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b>
+**
+** ^Each call to sqlite3_backup_step() sets two values inside
+** the [sqlite3_backup] object: the number of pages still to be backed
+** up and the total number of pages in the source database file.
+** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces
+** retrieve these two values, respectively.
+**
+** ^The values returned by these functions are only updated by
+** sqlite3_backup_step(). ^If the source database is modified during a backup
+** operation, then the values are not updated to account for any extra
+** pages that need to be updated or the size of the source database file
+** changing.
+**
+** <b>Concurrent Usage of Database Handles</b>
+**
+** ^The source [database connection] may be used by the application for other
+** purposes while a backup operation is underway or being initialized.
+** ^If SQLite is compiled and configured to support threadsafe database
+** connections, then the source database connection may be used concurrently
+** from within other threads.
+**
+** However, the application must guarantee that the destination 
+** [database connection] is not passed to any other API (by any thread) after 
+** sqlite3_backup_init() is called and before the corresponding call to
+** sqlite3_backup_finish().  SQLite does not currently check to see
+** if the application incorrectly accesses the destination [database connection]
+** and so no error code is reported, but the operations may malfunction
+** nevertheless.  Use of the destination database connection while a
+** backup is in progress might also also cause a mutex deadlock.
+**
+** If running in [shared cache mode], the application must
+** guarantee that the shared cache used by the destination database
+** is not accessed while the backup is running. In practice this means
+** that the application must guarantee that the disk file being 
+** backed up to is not accessed by any connection within the process,
+** not just the specific connection that was passed to sqlite3_backup_init().
+**
+** The [sqlite3_backup] object itself is partially threadsafe. Multiple 
+** threads may safely make multiple concurrent calls to sqlite3_backup_step().
+** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
+** APIs are not strictly speaking threadsafe. If they are invoked at the
+** same time as another thread is invoking sqlite3_backup_step() it is
+** possible that they return invalid values.
+*/
+SQLITE_API sqlite3_backup *sqlite3_backup_init(
+  sqlite3 *pDest,                        /* Destination database handle */
+  const char *zDestName,                 /* Destination database name */
+  sqlite3 *pSource,                      /* Source database handle */
+  const char *zSourceName                /* Source database name */
+);
+SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
+SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
+SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
+SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
+
+/*
+** CAPI3REF: Unlock Notification
+**
+** ^When running in shared-cache mode, a database operation may fail with
+** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
+** individual tables within the shared-cache cannot be obtained. See
+** [SQLite Shared-Cache Mode] for a description of shared-cache locking. 
+** ^This API may be used to register a callback that SQLite will invoke 
+** when the connection currently holding the required lock relinquishes it.
+** ^This API is only available if the library was compiled with the
+** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined.
+**
+** See Also: [Using the SQLite Unlock Notification Feature].
+**
+** ^Shared-cache locks are released when a database connection concludes
+** its current transaction, either by committing it or rolling it back. 
+**
+** ^When a connection (known as the blocked connection) fails to obtain a
+** shared-cache lock and SQLITE_LOCKED is returned to the caller, the
+** identity of the database connection (the blocking connection) that
+** has locked the required resource is stored internally. ^After an 
+** application receives an SQLITE_LOCKED error, it may call the
+** sqlite3_unlock_notify() method with the blocked connection handle as 
+** the first argument to register for a callback that will be invoked
+** when the blocking connections current transaction is concluded. ^The
+** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
+** call that concludes the blocking connections transaction.
+**
+** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
+** there is a chance that the blocking connection will have already
+** concluded its transaction by the time sqlite3_unlock_notify() is invoked.
+** If this happens, then the specified callback is invoked immediately,
+** from within the call to sqlite3_unlock_notify().)^
+**
+** ^If the blocked connection is attempting to obtain a write-lock on a
+** shared-cache table, and more than one other connection currently holds
+** a read-lock on the same table, then SQLite arbitrarily selects one of 
+** the other connections to use as the blocking connection.
+**
+** ^(There may be at most one unlock-notify callback registered by a 
+** blocked connection. If sqlite3_unlock_notify() is called when the
+** blocked connection already has a registered unlock-notify callback,
+** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
+** called with a NULL pointer as its second argument, then any existing
+** unlock-notify callback is canceled. ^The blocked connections 
+** unlock-notify callback may also be canceled by closing the blocked
+** connection using [sqlite3_close()].
+**
+** The unlock-notify callback is not reentrant. If an application invokes
+** any sqlite3_xxx API functions from within an unlock-notify callback, a
+** crash or deadlock may be the result.
+**
+** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always
+** returns SQLITE_OK.
+**
+** <b>Callback Invocation Details</b>
+**
+** When an unlock-notify callback is registered, the application provides a 
+** single void* pointer that is passed to the callback when it is invoked.
+** However, the signature of the callback function allows SQLite to pass
+** it an array of void* context pointers. The first argument passed to
+** an unlock-notify callback is a pointer to an array of void* pointers,
+** and the second is the number of entries in the array.
+**
+** When a blocking connections transaction is concluded, there may be
+** more than one blocked connection that has registered for an unlock-notify
+** callback. ^If two or more such blocked connections have specified the
+** same callback function, then instead of invoking the callback function
+** multiple times, it is invoked once with the set of void* context pointers
+** specified by the blocked connections bundled together into an array.
+** This gives the application an opportunity to prioritize any actions 
+** related to the set of unblocked database connections.
+**
+** <b>Deadlock Detection</b>
+**
+** Assuming that after registering for an unlock-notify callback a 
+** database waits for the callback to be issued before taking any further
+** action (a reasonable assumption), then using this API may cause the
+** application to deadlock. For example, if connection X is waiting for
+** connection Y's transaction to be concluded, and similarly connection
+** Y is waiting on connection X's transaction, then neither connection
+** will proceed and the system may remain deadlocked indefinitely.
+**
+** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock
+** detection. ^If a given call to sqlite3_unlock_notify() would put the
+** system in a deadlocked state, then SQLITE_LOCKED is returned and no
+** unlock-notify callback is registered. The system is said to be in
+** a deadlocked state if connection A has registered for an unlock-notify
+** callback on the conclusion of connection B's transaction, and connection
+** B has itself registered for an unlock-notify callback when connection
+** A's transaction is concluded. ^Indirect deadlock is also detected, so
+** the system is also considered to be deadlocked if connection B has
+** registered for an unlock-notify callback on the conclusion of connection
+** C's transaction, where connection C is waiting on connection A. ^Any
+** number of levels of indirection are allowed.
+**
+** <b>The "DROP TABLE" Exception</b>
+**
+** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost 
+** always appropriate to call sqlite3_unlock_notify(). There is however,
+** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement,
+** SQLite checks if there are any currently executing SELECT statements
+** that belong to the same connection. If there are, SQLITE_LOCKED is
+** returned. In this case there is no "blocking connection", so invoking
+** sqlite3_unlock_notify() results in the unlock-notify callback being
+** invoked immediately. If the application then re-attempts the "DROP TABLE"
+** or "DROP INDEX" query, an infinite loop might be the result.
+**
+** One way around this problem is to check the extended error code returned
+** by an sqlite3_step() call. ^(If there is a blocking connection, then the
+** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
+** the special "DROP TABLE/INDEX" case, the extended error code is just 
+** SQLITE_LOCKED.)^
+*/
+SQLITE_API int sqlite3_unlock_notify(
+  sqlite3 *pBlocked,                          /* Waiting connection */
+  void (*xNotify)(void **apArg, int nArg),    /* Callback function to invoke */
+  void *pNotifyArg                            /* Argument to pass to xNotify */
+);
+
+
+/*
+** CAPI3REF: String Comparison
+**
+** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
+** and extensions to compare the contents of two buffers containing UTF-8
+** strings in a case-independent fashion, using the same definition of "case
+** independence" that SQLite uses internally when comparing identifiers.
+*/
+SQLITE_API int sqlite3_stricmp(const char *, const char *);
+SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
+
+/*
+** CAPI3REF: String Globbing
+*
+** ^The [sqlite3_strglob(P,X)] interface returns zero if string X matches
+** the glob pattern P, and it returns non-zero if string X does not match
+** the glob pattern P.  ^The definition of glob pattern matching used in
+** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the
+** SQL dialect used by SQLite.  ^The sqlite3_strglob(P,X) function is case
+** sensitive.
+**
+** Note that this routine returns zero on a match and non-zero if the strings
+** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
+*/
+SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
+
+/*
+** CAPI3REF: Error Logging Interface
+**
+** ^The [sqlite3_log()] interface writes a message into the [error log]
+** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
+** ^If logging is enabled, the zFormat string and subsequent arguments are
+** used with [sqlite3_snprintf()] to generate the final output string.
+**
+** The sqlite3_log() interface is intended for use by extensions such as
+** virtual tables, collating functions, and SQL functions.  While there is
+** nothing to prevent an application from calling sqlite3_log(), doing so
+** is considered bad form.
+**
+** The zFormat string must not be NULL.
+**
+** To avoid deadlocks and other threading problems, the sqlite3_log() routine
+** will not use dynamically allocated memory.  The log message is stored in
+** a fixed-length buffer on the stack.  If the log message is longer than
+** a few hundred characters, it will be truncated to the length of the
+** buffer.
+*/
+SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
+
+/*
+** CAPI3REF: Write-Ahead Log Commit Hook
+**
+** ^The [sqlite3_wal_hook()] function is used to register a callback that
+** will be invoked each time a database connection commits data to a
+** [write-ahead log] (i.e. whenever a transaction is committed in
+** [journal_mode | journal_mode=WAL mode]). 
+**
+** ^The callback is invoked by SQLite after the commit has taken place and 
+** the associated write-lock on the database released, so the implementation 
+** may read, write or [checkpoint] the database as required.
+**
+** ^The first parameter passed to the callback function when it is invoked
+** is a copy of the third parameter passed to sqlite3_wal_hook() when
+** registering the callback. ^The second is a copy of the database handle.
+** ^The third parameter is the name of the database that was written to -
+** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter
+** is the number of pages currently in the write-ahead log file,
+** including those that were just committed.
+**
+** The callback function should normally return [SQLITE_OK].  ^If an error
+** code is returned, that error will propagate back up through the
+** SQLite code base to cause the statement that provoked the callback
+** to report an error, though the commit will have still occurred. If the
+** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value
+** that does not correspond to any valid SQLite error code, the results
+** are undefined.
+**
+** A single database handle may have at most a single write-ahead log callback 
+** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
+** previously registered write-ahead log callback. ^Note that the
+** [sqlite3_wal_autocheckpoint()] interface and the
+** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
+** those overwrite any prior [sqlite3_wal_hook()] settings.
+*/
+SQLITE_API void *sqlite3_wal_hook(
+  sqlite3*, 
+  int(*)(void *,sqlite3*,const char*,int),
+  void*
+);
+
+/*
+** CAPI3REF: Configure an auto-checkpoint
+**
+** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
+** [sqlite3_wal_hook()] that causes any database on [database connection] D
+** to automatically [checkpoint]
+** after committing a transaction if there are N or
+** more frames in the [write-ahead log] file.  ^Passing zero or 
+** a negative value as the nFrame parameter disables automatic
+** checkpoints entirely.
+**
+** ^The callback registered by this function replaces any existing callback
+** registered using [sqlite3_wal_hook()].  ^Likewise, registering a callback
+** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism
+** configured by this function.
+**
+** ^The [wal_autocheckpoint pragma] can be used to invoke this interface
+** from SQL.
+**
+** ^Every new [database connection] defaults to having the auto-checkpoint
+** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
+** pages.  The use of this interface
+** is only necessary if the default setting is found to be suboptimal
+** for a particular application.
+*/
+SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
+
+/*
+** CAPI3REF: Checkpoint a database
+**
+** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
+** on [database connection] D to be [checkpointed].  ^If X is NULL or an
+** empty string, then a checkpoint is run on all databases of
+** connection D.  ^If the database connection D is not in
+** [WAL | write-ahead log mode] then this interface is a harmless no-op.
+**
+** ^The [wal_checkpoint pragma] can be used to invoke this interface
+** from SQL.  ^The [sqlite3_wal_autocheckpoint()] interface and the
+** [wal_autocheckpoint pragma] can be used to cause this interface to be
+** run whenever the WAL reaches a certain size threshold.
+**
+** See also: [sqlite3_wal_checkpoint_v2()]
+*/
+SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
+
+/*
+** CAPI3REF: Checkpoint a database
+**
+** Run a checkpoint operation on WAL database zDb attached to database 
+** handle db. The specific operation is determined by the value of the 
+** eMode parameter:
+**
+** <dl>
+** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
+**   Checkpoint as many frames as possible without waiting for any database 
+**   readers or writers to finish. Sync the db file if all frames in the log
+**   are checkpointed. This mode is the same as calling 
+**   sqlite3_wal_checkpoint(). The busy-handler callback is never invoked.
+**
+** <dt>SQLITE_CHECKPOINT_FULL<dd>
+**   This mode blocks (calls the busy-handler callback) until there is no
+**   database writer and all readers are reading from the most recent database
+**   snapshot. It then checkpoints all frames in the log file and syncs the
+**   database file. This call blocks database writers while it is running,
+**   but not database readers.
+**
+** <dt>SQLITE_CHECKPOINT_RESTART<dd>
+**   This mode works the same way as SQLITE_CHECKPOINT_FULL, except after 
+**   checkpointing the log file it blocks (calls the busy-handler callback)
+**   until all readers are reading from the database file only. This ensures 
+**   that the next client to write to the database file restarts the log file 
+**   from the beginning. This call blocks database writers while it is running,
+**   but not database readers.
+** </dl>
+**
+** If pnLog is not NULL, then *pnLog is set to the total number of frames in
+** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to
+** the total number of checkpointed frames (including any that were already
+** checkpointed when this function is called). *pnLog and *pnCkpt may be
+** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK.
+** If no values are available because of an error, they are both set to -1
+** before returning to communicate this to the caller.
+**
+** All calls obtain an exclusive "checkpoint" lock on the database file. If
+** any other process is running a checkpoint operation at the same time, the 
+** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a 
+** busy-handler configured, it will not be invoked in this case.
+**
+** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive 
+** "writer" lock on the database file. If the writer lock cannot be obtained
+** immediately, and a busy-handler is configured, it is invoked and the writer
+** lock retried until either the busy-handler returns 0 or the lock is
+** successfully obtained. The busy-handler is also invoked while waiting for
+** database readers as described above. If the busy-handler returns 0 before
+** the writer lock is obtained or while waiting for database readers, the
+** checkpoint operation proceeds from that point in the same way as 
+** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible 
+** without blocking any further. SQLITE_BUSY is returned in this case.
+**
+** If parameter zDb is NULL or points to a zero length string, then the
+** specified operation is attempted on all WAL databases. In this case the
+** values written to output parameters *pnLog and *pnCkpt are undefined. If 
+** an SQLITE_BUSY error is encountered when processing one or more of the 
+** attached WAL databases, the operation is still attempted on any remaining 
+** attached databases and SQLITE_BUSY is returned to the caller. If any other 
+** error occurs while processing an attached database, processing is abandoned 
+** and the error code returned to the caller immediately. If no error 
+** (SQLITE_BUSY or otherwise) is encountered while processing the attached 
+** databases, SQLITE_OK is returned.
+**
+** If database zDb is the name of an attached database that is not in WAL
+** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If
+** zDb is not NULL (or a zero length string) and is not the name of any
+** attached database, SQLITE_ERROR is returned to the caller.
+*/
+SQLITE_API int sqlite3_wal_checkpoint_v2(
+  sqlite3 *db,                    /* Database handle */
+  const char *zDb,                /* Name of attached database (or NULL) */
+  int eMode,                      /* SQLITE_CHECKPOINT_* value */
+  int *pnLog,                     /* OUT: Size of WAL log in frames */
+  int *pnCkpt                     /* OUT: Total number of frames checkpointed */
+);
+
+/*
+** CAPI3REF: Checkpoint operation parameters
+**
+** These constants can be used as the 3rd parameter to
+** [sqlite3_wal_checkpoint_v2()].  See the [sqlite3_wal_checkpoint_v2()]
+** documentation for additional information about the meaning and use of
+** each of these values.
+*/
+#define SQLITE_CHECKPOINT_PASSIVE 0
+#define SQLITE_CHECKPOINT_FULL    1
+#define SQLITE_CHECKPOINT_RESTART 2
+
+/*
+** CAPI3REF: Virtual Table Interface Configuration
+**
+** This function may be called by either the [xConnect] or [xCreate] method
+** of a [virtual table] implementation to configure
+** various facets of the virtual table interface.
+**
+** If this interface is invoked outside the context of an xConnect or
+** xCreate virtual table method then the behavior is undefined.
+**
+** At present, there is only one option that may be configured using
+** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].)  Further options
+** may be added in the future.
+*/
+SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
+
+/*
+** CAPI3REF: Virtual Table Configuration Options
+**
+** These macros define the various options to the
+** [sqlite3_vtab_config()] interface that [virtual table] implementations
+** can use to customize and optimize their behavior.
+**
+** <dl>
+** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT
+** <dd>Calls of the form
+** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported,
+** where X is an integer.  If X is zero, then the [virtual table] whose
+** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
+** support constraints.  In this configuration (which is the default) if
+** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
+** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
+** specified as part of the users SQL statement, regardless of the actual
+** ON CONFLICT mode specified.
+**
+** If X is non-zero, then the virtual table implementation guarantees
+** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
+** any modifications to internal or persistent data structures have been made.
+** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite 
+** is able to roll back a statement or database transaction, and abandon
+** or continue processing the current SQL statement as appropriate. 
+** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns
+** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode
+** had been ABORT.
+**
+** Virtual table implementations that are required to handle OR REPLACE
+** must do so within the [xUpdate] method. If a call to the 
+** [sqlite3_vtab_on_conflict()] function indicates that the current ON 
+** CONFLICT policy is REPLACE, the virtual table implementation should 
+** silently replace the appropriate rows within the xUpdate callback and
+** return SQLITE_OK. Or, if this is not possible, it may return
+** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT 
+** constraint handling.
+** </dl>
+*/
+#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
+
+/*
+** CAPI3REF: Determine The Virtual Table Conflict Policy
+**
+** This function may only be called from within a call to the [xUpdate] method
+** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The
+** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
+** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
+** of the SQL statement that triggered the call to the [xUpdate] method of the
+** [virtual table].
+*/
+SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
+
+/*
+** CAPI3REF: Conflict resolution modes
+**
+** These constants are returned by [sqlite3_vtab_on_conflict()] to
+** inform a [virtual table] implementation what the [ON CONFLICT] mode
+** is for the SQL statement being evaluated.
+**
+** Note that the [SQLITE_IGNORE] constant is also used as a potential
+** return value from the [sqlite3_set_authorizer()] callback and that
+** [SQLITE_ABORT] is also a [result code].
+*/
+#define SQLITE_ROLLBACK 1
+/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
+#define SQLITE_FAIL     3
+/* #define SQLITE_ABORT 4  // Also an error code */
+#define SQLITE_REPLACE  5
+
+
+
+/*
+** Undo the hack that converts floating point types to integer for
+** builds on processors without floating point support.
+*/
+#ifdef SQLITE_OMIT_FLOATING_POINT
+# undef double
+#endif
+
+#ifdef __cplusplus
+}  /* End of the 'extern "C"' block */
+#endif
+#endif /* _SQLITE3_H_ */
+
+/*
+** 2010 August 30
+**
+** The author disclaims copyright to this source code.  In place of
+** a legal notice, here is a blessing:
+**
+**    May you do good and not evil.
+**    May you find forgiveness for yourself and forgive others.
+**    May you share freely, never taking more than you give.
+**
+*************************************************************************
+*/
+
+#ifndef _SQLITE3RTREE_H_
+#define _SQLITE3RTREE_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;
+
+/*
+** Register a geometry callback named zGeom that can be used as part of an
+** R-Tree geometry query as follows:
+**
+**   SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
+*/
+SQLITE_API int sqlite3_rtree_geometry_callback(
+  sqlite3 *db,
+  const char *zGeom,
+#ifdef SQLITE_RTREE_INT_ONLY
+  int (*xGeom)(sqlite3_rtree_geometry*, int n, sqlite3_int64 *a, int *pRes),
+#else
+  int (*xGeom)(sqlite3_rtree_geometry*, int n, double *a, int *pRes),
+#endif
+  void *pContext
+);
+
+
+/*
+** A pointer to a structure of the following type is passed as the first
+** argument to callbacks registered using rtree_geometry_callback().
+*/
+struct sqlite3_rtree_geometry {
+  void *pContext;                 /* Copy of pContext passed to s_r_g_c() */
+  int nParam;                     /* Size of array aParam[] */
+  double *aParam;                 /* Parameters passed to SQL geom function */
+  void *pUser;                    /* Callback implementation user data */
+  void (*xDelUser)(void *);       /* Called by SQLite to clean up pUser */
+};
+
+
+#ifdef __cplusplus
+}  /* end of the 'extern "C"' block */
+#endif
+
+#endif  /* ifndef _SQLITE3RTREE_H_ */
+

Property changes on: lab4/.minix-src/include/sqlite3.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/stdbool.h
===================================================================
--- lab4/.minix-src/include/stdbool.h	(nonexistent)
+++ lab4/.minix-src/include/stdbool.h	(revision 13)
@@ -0,0 +1 @@
+sys/stdbool.h
\ No newline at end of file

Property changes on: lab4/.minix-src/include/stdbool.h
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/.vscode/settings.json
===================================================================
--- lab4/test/lab3/.vscode/settings.json	(nonexistent)
+++ lab4/test/lab3/.vscode/settings.json	(revision 13)
@@ -0,0 +1,10 @@
+{
+  "git.ignoreLimitWarning": true,
+  "C_Cpp.clang_format_fallbackStyle": "LLVM",
+  "diffEditor.ignoreTrimWhitespace": true,
+  "editor.formatOnSave": false,
+  "editor.tabSize": 2,
+  "editor.wordWrap": "bounded",
+  "editor.wordWrapColumn": 100,
+  "files.associations": { },
+}
\ No newline at end of file

Property changes on: lab4/test/lab3/.vscode/settings.json
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/i8042.h
===================================================================
--- lab4/test/lab3/i8042.h	(nonexistent)
+++ lab4/test/lab3/i8042.h	(revision 13)
@@ -0,0 +1,17 @@
+/*  #ifndef I8042_H
+#define I8042_H  */
+
+#define IRQ_KB 1
+#define DELAY_US 20000
+#define EXIT_CODE 0x81
+#define READ_CMD 0x20
+#define IN_BUF 0x64
+#define I_O_BUFFER 0x60
+#define O_BUFFER_FULL 0x01
+#define PAR_ERR 0x80
+#define TWO_BYTES 0xe0
+/* #define OBF BIT(0)
+#define TO_ERR BIT(6) */
+
+
+//#endif /* I8042_H */

Property changes on: lab4/test/lab3/i8042.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/stdlib.h
===================================================================
--- lab4/.minix-src/include/stdlib.h	(nonexistent)
+++ lab4/.minix-src/include/stdlib.h	(revision 13)
@@ -0,0 +1,389 @@
+/*	$NetBSD: stdlib.h,v 1.115 2015/02/17 20:33:40 joerg Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
+ */
+
+#ifndef _STDLIB_H_
+#define _STDLIB_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+#if defined(_NETBSD_SOURCE)
+#include <sys/types.h>		/* for quad_t, etc. */
+#endif
+
+#include <machine/ansi.h>
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
+typedef	_BSD_WCHAR_T_	wchar_t;
+#undef	_BSD_WCHAR_T_
+#endif
+
+typedef struct {
+	int quot;		/* quotient */
+	int rem;		/* remainder */
+} div_t;
+
+typedef struct {
+	long quot;		/* quotient */
+	long rem;		/* remainder */
+} ldiv_t;
+
+#if !defined(_ANSI_SOURCE) && \
+    (defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
+     (__cplusplus - 0) >= 201103L || defined(_NETBSD_SOURCE))
+typedef struct {
+	/* LONGLONG */
+	long long int quot;	/* quotient */
+	/* LONGLONG */
+	long long int rem;	/* remainder */
+} lldiv_t;
+#endif
+
+#if defined(_NETBSD_SOURCE)
+typedef struct {
+	quad_t quot;		/* quotient */
+	quad_t rem;		/* remainder */
+} qdiv_t;
+#endif
+
+
+#include <sys/null.h>
+
+#define	EXIT_FAILURE	1
+#define	EXIT_SUCCESS	0
+
+#define	RAND_MAX	0x7fffffff
+
+extern size_t __mb_cur_max;
+#define	MB_CUR_MAX	__mb_cur_max
+
+__BEGIN_DECLS
+__dead	 void _Exit(int);
+__dead	 void abort(void);
+__pure	 int abs(int);
+int	 atexit(void (*)(void));
+double	 atof(const char *);
+int	 atoi(const char *);
+long	 atol(const char *);
+#ifndef __BSEARCH_DECLARED
+#define __BSEARCH_DECLARED
+/* also in search.h */
+void	*bsearch(const void *, const void *, size_t, size_t,
+    int (*)(const void *, const void *));
+#endif /* __BSEARCH_DECLARED */
+void	*calloc(size_t, size_t);
+div_t	 div(int, int);
+__dead	 void exit(int);
+void	 free(void *);
+__aconst char *getenv(const char *);
+__pure long
+	 labs(long);
+ldiv_t	 ldiv(long, long);
+void	*malloc(size_t);
+void	 qsort(void *, size_t, size_t, int (*)(const void *, const void *));
+int	 rand(void);
+void	*realloc(void *, size_t);
+void	 srand(unsigned);
+double	 strtod(const char * __restrict, char ** __restrict);
+long	 strtol(const char * __restrict, char ** __restrict, int);
+unsigned long
+	 strtoul(const char * __restrict, char ** __restrict, int);
+#ifdef _OPENBSD_SOURCE
+long long strtonum(const char *, long long, long long, const char **);
+void	*reallocarray(void *, size_t, size_t);
+#endif
+int	 system(const char *);
+
+/* These are currently just stubs. */
+int	 mblen(const char *, size_t);
+size_t	 mbstowcs(wchar_t * __restrict, const char * __restrict, size_t);
+int	 wctomb(char *, wchar_t);
+int	 mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
+size_t	 wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+
+
+/*
+ * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+int	 rand_r(unsigned int *);
+#endif
+
+
+/*
+ * X/Open Portability Guide >= Issue 4
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+double	 drand48(void);
+double	 erand48(unsigned short[3]);
+long	 jrand48(unsigned short[3]);
+void	 lcong48(unsigned short[7]);
+long	 lrand48(void);
+long	 mrand48(void);
+long	 nrand48(unsigned short[3]);
+unsigned short *
+	 seed48(unsigned short[3]);
+void	 srand48(long);
+
+#ifndef __LIBC12_SOURCE__
+int	 putenv(char *) __RENAME(__putenv50);
+#endif
+#endif
+
+
+/*
+ * X/Open Portability Guide >= Issue 4 Version 2
+ */
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+long	 a64l(const char *);
+char	*l64a(long);
+
+long	 random(void);
+char	*setstate(char *);
+#ifndef __LIBC12_SOURCE__
+char	*initstate(unsigned int, char *, size_t) __RENAME(__initstate60);
+void	 srandom(unsigned int) __RENAME(__srandom60);
+#endif
+#ifdef _NETBSD_SOURCE
+#define	RANDOM_MAX	0x7fffffff	/* (((long)1 << 31) - 1) */
+int	 mkostemp(char *, int);
+int	 mkostemps(char *, int, int);
+#endif
+
+char	*mkdtemp(char *);
+int	 mkstemp(char *);
+char	*mktemp(char *)
+#ifdef __MKTEMP_OK__
+	__RENAME(_mktemp)
+#endif
+	;
+
+int	 setkey(const char *);
+
+char	*realpath(const char * __restrict, char * __restrict);
+
+int	 ttyslot(void);
+
+void	*valloc(size_t);		/* obsoleted by malloc() */
+
+int	 grantpt(int);
+int	 unlockpt(int);
+char	*ptsname(int);
+#endif
+
+/*
+ * ISO C99
+ */
+#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
+    defined(_NETBSD_SOURCE) || (__cplusplus - 0) >= 201103L
+
+/* LONGLONG */
+long long int	atoll(const char *);
+/* LONGLONG */
+long long int	llabs(long long int);
+/* LONGLONG */
+lldiv_t		lldiv(long long int, long long int);
+/* LONGLONG */
+long long int	strtoll(const char * __restrict, char ** __restrict, int);
+/* LONGLONG */
+unsigned long long int
+		strtoull(const char * __restrict, char ** __restrict, int);
+float		strtof(const char * __restrict, char ** __restrict);
+long double	strtold(const char * __restrict, char ** __restrict);
+#endif
+
+#if defined(_ISOC11_SOURCE) || (__STDC_VERSION__ - 0) >= 201101L || \
+    defined(_NETBSD_SOURCE) || (__cplusplus - 0) >= 201103L
+int	at_quick_exit(void (*)(void));
+__dead void quick_exit(int);
+#endif
+
+/*
+ * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \
+    defined(_NETBSD_SOURCE)
+int	 setenv(const char *, const char *, int);
+#ifndef __LIBC12_SOURCE__
+int	 unsetenv(const char *) __RENAME(__unsetenv13);
+#endif
+
+int	 posix_openpt(int);
+int	 posix_memalign(void **, size_t, size_t);
+#endif
+
+/*
+ * Implementation-defined extensions
+ */
+#if defined(_NETBSD_SOURCE)
+#if defined(alloca) && (alloca == __builtin_alloca) && \
+	defined(__GNUC__) && (__GNUC__ < 2)
+void	*alloca(int);     /* built-in for gcc */
+#elif defined(__PCC__) && !defined(__GNUC__)
+#define alloca(size) __builtin_alloca(size)
+#else
+void	*alloca(size_t);
+#endif /* __GNUC__ */
+
+uint32_t arc4random(void);
+void	 arc4random_stir(void);
+void	 arc4random_buf(void *, size_t);
+uint32_t arc4random_uniform(uint32_t);
+void	 arc4random_addrandom(u_char *, int);
+char	*getbsize(int *, long *);
+char	*cgetcap(char *, const char *, int);
+int	 cgetclose(void);
+int	 cgetent(char **, const char * const *, const char *);
+int	 cgetfirst(char **, const char * const *);
+int	 cgetmatch(const char *, const char *);
+int	 cgetnext(char **, const char * const *);
+int	 cgetnum(char *, const char *, long *);
+int	 cgetset(const char *);
+int	 cgetstr(char *, const char *, char **);
+int	 cgetustr(char *, const char *, char **);
+void	 csetexpandtc(int);
+
+int	 daemon(int, int);
+int	 devname_r(dev_t, mode_t, char *, size_t);
+#ifndef __LIBC12_SOURCE__
+__aconst char *devname(dev_t, mode_t) __RENAME(__devname50);
+#endif
+
+#define	HN_DECIMAL		0x01
+#define	HN_NOSPACE		0x02
+#define	HN_B			0x04
+#define	HN_DIVISOR_1000		0x08
+
+#define	HN_GETSCALE		0x10
+#define	HN_AUTOSCALE		0x20
+
+int	 humanize_number(char *, size_t, int64_t, const char *, int, int);
+int	 dehumanize_number(const char *, int64_t *);
+
+devmajor_t getdevmajor(const char *, mode_t);
+int	 getloadavg(double [], int);
+
+int	 getenv_r(const char *, char *, size_t);
+
+void	 cfree(void *);
+
+int	 heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
+int	 mergesort(void *, size_t, size_t,
+	    int (*)(const void *, const void *));
+int	 ptsname_r(int, char *, size_t);
+int	 radixsort(const unsigned char **, int, const unsigned char *,
+	    unsigned);
+int	 sradixsort(const unsigned char **, int, const unsigned char *,
+	    unsigned);
+
+void	 mi_vector_hash(const void * __restrict, size_t, uint32_t,
+	    uint32_t[3]);
+
+void	 setproctitle(const char *, ...)
+	    __printflike(1, 2);
+const char *getprogname(void) __constfunc;
+void	setprogname(const char *);
+
+quad_t	 qabs(quad_t);
+quad_t	 strtoq(const char * __restrict, char ** __restrict, int);
+u_quad_t strtouq(const char * __restrict, char ** __restrict, int);
+
+	/* LONGLONG */
+long long strsuftoll(const char *, const char *, long long, long long);
+	/* LONGLONG */
+long long strsuftollx(const char *, const char *, long long, long long,
+	    		char *, size_t);
+
+int	 l64a_r(long, char *, int);
+
+size_t	shquote(const char *, char *, size_t);
+size_t	shquotev(int, char * const *, char *, size_t);
+
+int	reallocarr(void *, size_t, size_t);
+#endif /* _NETBSD_SOURCE */
+#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE)
+qdiv_t	 qdiv(quad_t, quad_t);
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+double		strtod_l(const char * __restrict, char ** __restrict, locale_t);
+float		strtof_l(const char * __restrict, char ** __restrict, locale_t);
+long double	strtold_l(const char * __restrict, char ** __restrict,
+			  locale_t);
+long	 strtol_l(const char * __restrict, char ** __restrict, int, locale_t);
+unsigned long
+	 strtoul_l(const char * __restrict, char ** __restrict, int, locale_t);
+/* LONGLONG */
+long long int
+	strtoll_l(const char * __restrict, char ** __restrict, int, locale_t);
+/* LONGLONG */
+unsigned long long int
+	strtoull_l(const char * __restrict, char ** __restrict, int, locale_t);
+
+#  if defined(_NETBSD_SOURCE)
+quad_t	 strtoq_l(const char * __restrict, char ** __restrict, int, locale_t);
+u_quad_t strtouq_l(const char * __restrict, char ** __restrict, int, locale_t);
+
+size_t	_mb_cur_max_l(locale_t);
+#define	MB_CUR_MAX_L(loc)	_mb_cur_max_l(loc)
+int	 mblen_l(const char *, size_t, locale_t);
+size_t	 mbstowcs_l(wchar_t * __restrict, const char * __restrict, size_t,
+		    locale_t);
+int	 wctomb_l(char *, wchar_t, locale_t);
+int	 mbtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
+	          locale_t);
+size_t	 wcstombs_l(char * __restrict, const wchar_t * __restrict, size_t,
+		    locale_t);
+
+#  endif /* _NETBSD_SOURCE */
+#endif /* _POSIX_C_SOURCE >= 200809 || _NETBSD_SOURCE */
+
+__END_DECLS
+
+#endif /* !_STDLIB_H_ */

Property changes on: lab4/.minix-src/include/stdlib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/struct.h
===================================================================
--- lab4/.minix-src/include/struct.h	(nonexistent)
+++ lab4/.minix-src/include/struct.h	(revision 13)
@@ -0,0 +1,49 @@
+/*	$NetBSD: struct.h,v 1.5 2003/08/07 09:44:11 agc Exp $	*/
+
+/*-
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)struct.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _STRUCT_H_
+#define	_STRUCT_H_
+
+/* Offset of the field in the structure. */
+#define	fldoff(name, field) \
+	((int)&(((struct name *)0)->field))
+
+/* Size of the field in the structure. */
+#define	fldsiz(name, field) \
+	(sizeof(((struct name *)0)->field))
+
+/* Address of the structure from a field. */
+#define	strbase(name, addr, field) \
+	((struct name *)((char *)(addr) - fldoff(name, field)))
+
+#endif /* !_STRUCT_H_ */

Property changes on: lab4/.minix-src/include/struct.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/tcpd.h
===================================================================
--- lab4/.minix-src/include/tcpd.h	(nonexistent)
+++ lab4/.minix-src/include/tcpd.h	(revision 13)
@@ -0,0 +1,209 @@
+/*	$NetBSD: tcpd.h,v 1.14 2012/03/22 22:59:43 joerg Exp $	*/
+ /*
+  * @(#) tcpd.h 1.5 96/03/19 16:22:24
+  * 
+  * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
+  */
+
+#include <sys/cdefs.h>
+#include <stdio.h>
+
+/* Structure to describe one communications endpoint. */
+
+#define STRING_LENGTH	128		/* hosts, users, processes */
+
+struct host_info {
+    char    name[STRING_LENGTH];	/* access via eval_hostname(host) */
+    char    addr[STRING_LENGTH];	/* access via eval_hostaddr(host) */
+    struct sockaddr *sin;		/* socket address or 0 */
+    struct t_unitdata *unit;		/* TLI transport address or 0 */
+    struct request_info *request;	/* for shared information */
+};
+
+/* Structure to describe what we know about a service request. */
+
+struct request_info {
+    int     fd;				/* socket handle */
+    char    user[STRING_LENGTH];	/* access via eval_user(request) */
+    char    daemon[STRING_LENGTH];	/* access via eval_daemon(request) */
+    char    pid[10];			/* access via eval_pid(request) */
+    struct host_info client[1];		/* client endpoint info */
+    struct host_info server[1];		/* server endpoint info */
+    void (*sink)(int);			/* datagram sink function or 0 */
+    void (*hostname)(struct host_info *); /* address to printable hostname */
+    void (*hostaddr)(struct host_info *); /* address to printable address */
+    void (*cleanup)(void);		/* cleanup function or 0 */
+    struct netconfig *config;		/* netdir handle */
+};
+
+/* Common string operations. Less clutter should be more readable. */
+
+#define STRN_CPY(d,s,l)	{ strncpy((d),(s),(l)); (d)[(l)-1] = 0; }
+
+#define STRN_EQ(x,y,l)	(strncasecmp((x),(y),(l)) == 0)
+#define STRN_NE(x,y,l)	(strncasecmp((x),(y),(l)) != 0)
+#define STR_EQ(x,y)	(strcasecmp((x),(y)) == 0)
+#define STR_NE(x,y)	(strcasecmp((x),(y)) != 0)
+
+ /*
+  * Initially, all above strings have the empty value. Information that
+  * cannot be determined at runtime is set to "unknown", so that we can
+  * distinguish between `unavailable' and `not yet looked up'. A hostname
+  * that we do not believe in is set to "paranoid".
+  */
+
+#define STRING_UNKNOWN	"unknown"	/* lookup failed */
+#define STRING_PARANOID	"paranoid"	/* hostname conflict */
+
+__BEGIN_DECLS
+extern char unknown[];
+extern char paranoid[];
+__END_DECLS
+
+#define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid))
+
+#define NOT_INADDR(s) (s[strspn(s,"01234567890./")] != 0)
+
+/* Global functions. */
+
+__BEGIN_DECLS
+#define fromhost sock_host		/* no TLI support needed */
+
+extern int hosts_access			/* access control */
+		(struct request_info *);
+extern int hosts_ctl			/* limited interface to hosts_access */
+		(char *, char *, char *, char *);
+extern void shell_cmd			/* execute shell command */
+		(char *);
+extern char *percent_x			/* do %<char> expansion */
+		(char *, int, char *, struct request_info *);
+extern void rfc931			/* client name from RFC 931 daemon */
+		(struct sockaddr *, struct sockaddr *, char *);
+__dead extern void clean_exit		/* clean up and exit */
+		(struct request_info *);
+__dead extern void refuse		/* clean up and exit */
+		(struct request_info *);
+extern char *xgets			/* fgets() on steroids */
+		(char *, int, FILE *);
+extern char *split_at			/* strchr() and split */
+		(char *, int);
+extern int dot_quad_addr	/* restricted inet_aton() */
+		(char *, unsigned long *);
+
+/* Global variables. */
+
+extern int allow_severity;		/* for connection logging */
+extern int deny_severity;		/* for connection logging */
+extern const char *hosts_allow_table;	/* for verification mode redirection */
+extern const char *hosts_deny_table;	/* for verification mode redirection */
+extern int hosts_access_verbose;	/* for verbose matching mode */
+extern int rfc931_timeout;		/* user lookup timeout */
+extern int resident;			/* > 0 if resident process */
+
+ /*
+  * Routines for controlled initialization and update of request structure
+  * attributes. Each attribute has its own key.
+  */
+
+extern struct request_info *request_init	/* initialize request */
+		(struct request_info *,...);
+extern struct request_info *request_set		/* update request structure */
+		(struct request_info *,...);
+
+#define RQ_FILE		1		/* file descriptor */
+#define RQ_DAEMON	2		/* server process (argv[0]) */
+#define RQ_USER		3		/* client user name */
+#define RQ_CLIENT_NAME	4		/* client host name */
+#define RQ_CLIENT_ADDR	5		/* client host address */
+#define RQ_CLIENT_SIN	6		/* client endpoint (internal) */
+#define RQ_SERVER_NAME	7		/* server host name */
+#define RQ_SERVER_ADDR	8		/* server host address */
+#define RQ_SERVER_SIN	9		/* server endpoint (internal) */
+
+ /*
+  * Routines for delayed evaluation of request attributes. Each attribute
+  * type has its own access method. The trivial ones are implemented by
+  * macros. The other ones are wrappers around the transport-specific host
+  * name, address, and client user lookup methods. The request_info and
+  * host_info structures serve as caches for the lookup results.
+  */
+
+extern char *eval_user			/* client user */
+		(struct request_info *);
+extern char *eval_hostname		/* printable hostname */
+		(struct host_info *);
+extern char *eval_hostaddr		/* printable host address */
+		(struct host_info *);
+extern char *eval_hostinfo		/* host name or address */
+		(struct host_info *);
+extern char *eval_client		/* whatever is available */
+		(struct request_info *);
+extern char *eval_server		/* whatever is available */
+		(struct request_info *);
+#define eval_daemon(r)	((r)->daemon)	/* daemon process name */
+#define eval_pid(r)	((r)->pid)	/* process id */
+
+/* Socket-specific methods, including DNS hostname lookups. */
+
+extern void sock_host			/* look up endpoint addresses */
+		(struct request_info *);
+extern void sock_hostname		/* translate address to hostname */
+		(struct host_info *);
+extern void sock_hostaddr		/* address to printable address */
+		(struct host_info *);
+#define sock_methods(r) \
+	{ (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }
+
+/* The System V Transport-Level Interface (TLI) interface. */
+
+#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
+extern void tli_host			/* look up endpoint addresses etc. */
+		(struct request_info *);
+#endif
+
+ /*
+  * Problem reporting interface. Additional file/line context is reported
+  * when available. The jump buffer (tcpd_buf) is not declared here, or
+  * everyone would have to include <setjmp.h>.
+  */
+
+/* Report problem and proceed */
+void tcpd_warn(const char *, ...) __printflike(1, 2);
+
+/* Report problem and jump */
+void tcpd_jump(const char *, ...) __dead __printflike(1, 2);
+__END_DECLS
+
+struct tcpd_context {
+    const char *file;			/* current file */
+    int     line;			/* current line */
+};
+__BEGIN_DECLS
+extern struct tcpd_context tcpd_context;
+__END_DECLS
+
+ /*
+  * While processing access control rules, error conditions are handled by
+  * jumping back into the hosts_access() routine. This is cleaner than
+  * checking the return value of each and every silly little function. The
+  * (-1) returns are here because zero is already taken by longjmp().
+  */
+
+#define AC_PERMIT	1		/* permit access */
+#define AC_DENY		(-1)		/* deny_access */
+#define AC_ERROR	AC_DENY		/* XXX */
+
+ /*
+  * In verification mode an option function should just say what it would do,
+  * instead of really doing it. An option function that would not return
+  * should clear the dry_run flag to inform the caller of this unusual
+  * behavior.
+  */
+
+__BEGIN_DECLS
+extern void process_options		/* execute options */
+		(char *, struct request_info *);
+extern int dry_run;			/* verification flag */
+extern void fix_options			/* get rid of IP-level socket options */
+		(struct request_info *);
+__END_DECLS

Property changes on: lab4/.minix-src/include/tcpd.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/time.h
===================================================================
--- lab4/.minix-src/include/time.h	(nonexistent)
+++ lab4/.minix-src/include/time.h	(revision 13)
@@ -0,0 +1,229 @@
+/*	$NetBSD: time.h,v 1.44 2014/10/07 21:50:36 christos Exp $	*/
+
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)time.h	8.3 (Berkeley) 1/21/94
+ */
+
+#ifndef _TIME_H_
+#define	_TIME_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <machine/ansi.h>
+
+#include <sys/null.h>
+
+#ifdef	_BSD_CLOCK_T_
+typedef	_BSD_CLOCK_T_	clock_t;
+#undef	_BSD_CLOCK_T_
+#endif
+
+#ifdef	_BSD_TIME_T_
+typedef	_BSD_TIME_T_	time_t;
+#undef	_BSD_TIME_T_
+#endif
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#ifdef	_BSD_CLOCKID_T_
+typedef	_BSD_CLOCKID_T_	clockid_t;
+#undef	_BSD_CLOCKID_T_
+#endif
+
+#ifdef	_BSD_TIMER_T_
+typedef	_BSD_TIMER_T_	timer_t;
+#undef	_BSD_TIMER_T_
+#endif
+
+#define CLOCKS_PER_SEC	100
+
+struct tm {
+	int	tm_sec;		/* seconds after the minute [0-61] */
+	int	tm_min;		/* minutes after the hour [0-59] */
+	int	tm_hour;	/* hours since midnight [0-23] */
+	int	tm_mday;	/* day of the month [1-31] */
+	int	tm_mon;		/* months since January [0-11] */
+	int	tm_year;	/* years since 1900 */
+	int	tm_wday;	/* days since Sunday [0-6] */
+	int	tm_yday;	/* days since January 1 [0-365] */
+	int	tm_isdst;	/* Daylight Savings Time flag */
+	long	tm_gmtoff;	/* offset from UTC in seconds */
+	__aconst char *tm_zone;	/* timezone abbreviation */
+};
+
+__BEGIN_DECLS
+char *asctime(const struct tm *);
+clock_t clock(void);
+#ifndef __LIBC12_SOURCE__
+char *ctime(const time_t *) __RENAME(__ctime50);
+double difftime(time_t, time_t) __RENAME(__difftime50);
+struct tm *gmtime(const time_t *) __RENAME(__gmtime50);
+struct tm *localtime(const time_t *) __RENAME(__locatime50);
+time_t time(time_t *) __RENAME(__time50);
+time_t mktime(struct tm *) __RENAME(__mktime50);
+#endif
+size_t strftime(char * __restrict, size_t, const char * __restrict,
+    const struct tm * __restrict)
+    __attribute__((__format__(__strftime__, 3, 0)));
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+/*
+ * CLK_TCK uses libc's internal __sysconf() to retrieve the machine's
+ * HZ. The value of _SC_CLK_TCK is 39 -- we hard code it so we do not
+ * need to include unistd.h
+ */
+long __sysconf(int);
+#define CLK_TCK		(__sysconf(39))
+#endif
+#endif
+
+extern __aconst char *tzname[2];
+#ifndef __LIBC12_SOURCE__
+void tzset(void) __RENAME(__tzset50);
+#endif
+
+/*
+ * X/Open Portability Guide >= Issue 4
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+extern int daylight;
+#ifndef __LIBC12_SOURCE__
+extern long int timezone __RENAME(__timezone13);
+#endif
+char *strptime(const char * __restrict, const char * __restrict,
+    struct tm * __restrict);
+#endif
+
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    defined(_NETBSD_SOURCE)
+struct tm *getdate(const char *);
+extern int getdate_err;
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#include <sys/time.h>		/* XXX for struct timespec */
+struct sigevent;
+struct itimerspec;
+int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *);
+#ifndef __LIBC12_SOURCE__
+int clock_getres(clockid_t, struct timespec *)
+    __RENAME(__clock_getres50);
+int clock_gettime(clockid_t, struct timespec *)
+    __RENAME(__clock_gettime50);
+int clock_settime(clockid_t, const struct timespec *)
+    __RENAME(__clock_settime50);
+int nanosleep(const struct timespec *, struct timespec *)
+    __RENAME(__nanosleep50);
+int timer_gettime(timer_t, struct itimerspec *) __RENAME(__timer_gettime50);
+int timer_settime(timer_t, int, const struct itimerspec * __restrict, 
+    struct itimerspec * __restrict) __RENAME(__timer_settime50);
+#endif
+int timer_create(clockid_t, struct sigevent * __restrict,
+    timer_t * __restrict);
+int timer_delete(timer_t);
+int timer_getoverrun(timer_t);
+#endif /* _POSIX_C_SOURCE >= 199309 || _XOPEN_SOURCE >= 500 || ... */
+
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+char *asctime_r(const struct tm * __restrict, char * __restrict);
+#ifndef __LIBC12_SOURCE__
+char *ctime_r(const time_t *, char *) __RENAME(__ctime_r50);
+struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict)
+    __RENAME(__gmtime_r50);
+struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict)
+    __RENAME(__localtime_r50);
+#endif
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+size_t strftime_l(char * __restrict, size_t, const char * __restrict,
+    const struct tm * __restrict, locale_t)
+    __attribute__((__format__(__strftime__, 3, 0)));
+#endif
+
+#if defined(_NETBSD_SOURCE)
+
+typedef struct __state *timezone_t;
+
+#ifndef __LIBC12_SOURCE__
+time_t time2posix(time_t) __RENAME(__time2posix50);
+time_t posix2time(time_t) __RENAME(__posix2time50);
+time_t timegm(struct tm *) __RENAME(__timegm50);
+time_t timeoff(struct tm *, long) __RENAME(__timeoff50);
+time_t timelocal(struct tm *) __RENAME(__timelocal50);
+struct tm *offtime(const time_t *, long) __RENAME(__offtime50);
+void tzsetwall(void) __RENAME(__tzsetwall50);
+
+struct tm *offtime_r(const time_t *, long, struct tm *) __RENAME(__offtime_r50);
+struct tm *localtime_rz(timezone_t __restrict, const time_t * __restrict,
+    struct tm * __restrict) __RENAME(__localtime_rz50);
+char *ctime_rz(timezone_t __restrict, const time_t *, char *)
+    __RENAME(__ctime_rz50);
+time_t mktime_z(timezone_t __restrict, struct tm * __restrict)
+    __RENAME(__mktime_z50);
+time_t timelocal_z(timezone_t __restrict, struct tm *)
+    __RENAME(__timelocal_z50);
+time_t time2posix_z(timezone_t __restrict, time_t) __RENAME(__time2posix_z50);
+time_t posix2time_z(timezone_t __restrict, time_t) __RENAME(__posix2time_z50);
+timezone_t tzalloc(const char *) __RENAME(__tzalloc50);
+void tzfree(timezone_t __restrict) __RENAME(__tzfree50);
+const char *tzgetname(timezone_t __restrict, int) __RENAME(__tzgetname50);
+#endif
+
+size_t strftime_lz(timezone_t __restrict, char * __restrict, size_t,
+    const char * __restrict, const struct tm * __restrict, locale_t)
+    __attribute__((__format__(__strftime__, 4, 0)));
+size_t strftime_z(timezone_t __restrict, char * __restrict, size_t,
+    const char * __restrict, const struct tm * __restrict)
+    __attribute__((__format__(__strftime__, 4, 0)));
+char *strptime_l(const char * __restrict, const char * __restrict,
+    struct tm * __restrict, locale_t);
+
+#endif /* _NETBSD_SOURCE */
+
+__END_DECLS
+
+#endif /* !_TIME_H_ */

Property changes on: lab4/.minix-src/include/time.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/ucontextoffsets.h
===================================================================
--- lab4/.minix-src/include/ucontextoffsets.h	(nonexistent)
+++ lab4/.minix-src/include/ucontextoffsets.h	(revision 13)
@@ -0,0 +1,18 @@
+#define __ucontext_SIZEOF 784
+#define UC_FLAGS 0
+#define UC_LINK 4
+#define MAGIC 760
+#define DI 52
+#define SI 56
+#define BP 60
+#define AX 80
+#define BX 68
+#define CX 76
+#define DX 72
+#define PC 92
+#define SP 64
+#define EFAULT 14
+#define EINVAL 22
+#define MCF_MAGIC 12648430
+#define _UC_IGNFPU 131072
+#define _UC_IGNSIGM 262144

Property changes on: lab4/.minix-src/include/ucontextoffsets.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/unwind.h
===================================================================
--- lab4/.minix-src/include/unwind.h	(nonexistent)
+++ lab4/.minix-src/include/unwind.h	(revision 13)
@@ -0,0 +1,102 @@
+//===------------------------------- unwind.h -----------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//
+// C++ ABI Level 1 ABI documented at:
+//   http://mentorembedded.github.io/cxx-abi/abi-eh.html
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _UNWIND_H
+#define _UNWIND_H
+
+#include <stdint.h>
+#include <stddef.h>
+
+typedef enum {
+  _URC_NO_REASON = 0,
+  _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
+  _URC_FATAL_PHASE2_ERROR = 2,
+  _URC_FATAL_PHASE1_ERROR = 3,
+  _URC_NORMAL_STOP = 4,
+  _URC_END_OF_STACK = 5,
+  _URC_HANDLER_FOUND = 6,
+  _URC_INSTALL_CONTEXT = 7,
+  _URC_CONTINUE_UNWIND = 8
+} _Unwind_Reason_Code;
+
+typedef enum {
+  _UA_SEARCH_PHASE = 1,
+  _UA_CLEANUP_PHASE = 2,
+  _UA_HANDLER_FRAME = 4,
+  _UA_FORCE_UNWIND = 8,
+  _UA_END_OF_STACK = 16 /* GCC extension */
+} _Unwind_Action;
+
+struct _Unwind_Context;
+
+struct _Unwind_Exception {
+  uint64_t exception_class;
+  void (*exception_cleanup)(_Unwind_Reason_Code, struct _Unwind_Exception *);
+  uintptr_t private_1;
+  uintptr_t private_2;
+} __attribute__((__aligned__));
+
+typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int, _Unwind_Action, uint64_t,
+                                               struct _Unwind_Exception *,
+                                               struct _Unwind_Context *,
+                                               void *);
+
+typedef _Unwind_Reason_Code (*__personality_routine)(int, _Unwind_Action,
+                                                     uint64_t,
+                                                     struct _Unwind_Exception *,
+                                                     struct _Unwind_Context *);
+
+#ifdef _UNWIND_GCC_EXTENSIONS
+struct dwarf_eh_bases {
+  void *tbase;
+  void *dbase;
+  void *func;
+};
+#endif
+
+__BEGIN_DECLS
+
+_Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *);
+void _Unwind_Resume(struct _Unwind_Exception *) __dead;
+_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *);
+_Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *,
+                                         _Unwind_Stop_Fn, void *);
+void _Unwind_DeleteException(struct _Unwind_Exception *);
+uintptr_t _Unwind_GetGR(struct _Unwind_Context *, int);
+void _Unwind_SetGR(struct _Unwind_Context *, int, uintptr_t);
+uintptr_t _Unwind_GetIP(struct _Unwind_Context *);
+uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
+uintptr_t _Unwind_GetCFA(struct _Unwind_Context *);
+void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t);
+uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *);
+uintptr_t _Unwind_GetLanguageSpecificData(struct _Unwind_Context *);
+uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context *);
+uintptr_t _Unwind_GetTextRelBase(struct _Unwind_Context *);
+
+typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *,
+                                                void *);
+_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *);
+void *_Unwind_FindEnclosingFunction(void *);
+
+void __register_frame(const void *);
+void __register_frame_info(const void *, void *);
+void __deregister_frame(const void *);
+void *__deregister_frame_info(const void *);
+
+#ifdef _UNWIND_GCC_EXTENSIONS
+void *_Unwind_Find_FDE(void *, struct dwarf_eh_bases *);
+#endif
+
+__END_DECLS
+
+#endif // _UNWIND_H

Property changes on: lab4/.minix-src/include/unwind.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/utmpx.h
===================================================================
--- lab4/.minix-src/include/utmpx.h	(nonexistent)
+++ lab4/.minix-src/include/utmpx.h	(revision 13)
@@ -0,0 +1,159 @@
+/*	$NetBSD: utmpx.h,v 1.17 2009/01/11 19:09:29 christos Exp $	 */
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef	_UTMPX_H_
+#define	_UTMPX_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+
+#define	_PATH_UTMPX		"/var/run/utmpx"
+#define	_PATH_WTMPX		"/var/log/wtmpx"
+#define	_PATH_LASTLOGX		"/var/log/lastlogx"
+#define	_PATH_UTMP_UPDATE	"/usr/libexec/utmp_update"
+
+#define _UTX_USERSIZE	32
+#define _UTX_LINESIZE	32
+#define	_UTX_IDSIZE	4
+#define _UTX_HOSTSIZE	256
+
+#if defined(_NETBSD_SOURCE)
+#define UTX_USERSIZE	_UTX_USERSIZE
+#define UTX_LINESIZE	_UTX_LINESIZE
+#define	UTX_IDSIZE	_UTX_IDSIZE
+#define UTX_HOSTSIZE	_UTX_HOSTSIZE
+#endif
+
+#define EMPTY		0
+#define RUN_LVL		1
+#define BOOT_TIME	2
+#define OLD_TIME	3
+#define NEW_TIME	4
+#define INIT_PROCESS	5
+#define LOGIN_PROCESS	6
+#define USER_PROCESS	7
+#define DEAD_PROCESS	8
+
+#if defined(_NETBSD_SOURCE)
+#define ACCOUNTING	9
+#define SIGNATURE	10
+#define DOWN_TIME	11
+
+/*
+ * Strings placed in the ut_line field to indicate special type entries
+ */
+#define	RUNLVL_MSG	"run-level %c"
+#define	BOOT_MSG	"system boot"
+#define	OTIME_MSG	"old time"
+#define	NTIME_MSG	"new time"
+#define	DOWN_MSG	"system down"
+#endif
+
+/*
+ * The following structure describes the fields of the utmpx entries
+ * stored in _PATH_UTMPX or _PATH_WTMPX. This is not the format the
+ * entries are stored in the files, and application should only access
+ * entries using routines described in getutxent(3).
+ */
+
+#define ut_user ut_name
+#define ut_xtime ut_tv.tv_sec
+
+/*
+ * This should be:
+ * 40 - (sizeof(struct timeval) - sizeof(struct { long s; long u; })))
+ * but g++ does not like it, to retain size compatibility with v1.00,
+ * so we do it manually.
+ */
+#ifdef _LP64
+#define _UTX_PADSIZE 36
+#else
+#define _UTX_PADSIZE 40
+#endif
+
+struct utmpx {
+	char ut_name[_UTX_USERSIZE];	/* login name */
+	char ut_id[_UTX_IDSIZE];	/* inittab id */
+	char ut_line[_UTX_LINESIZE];	/* tty name */
+	char ut_host[_UTX_HOSTSIZE];	/* host name */
+	uint16_t ut_session;		/* session id used for windowing */
+	uint16_t ut_type;		/* type of this entry */
+	pid_t ut_pid;			/* process id creating the entry */
+	struct {
+		uint16_t e_termination;	/* process termination signal */
+		uint16_t e_exit;	/* process exit status */
+	} ut_exit;
+	struct sockaddr_storage ut_ss;	/* address where entry was made from */
+	struct timeval ut_tv;		/* time entry was created */
+	uint8_t ut_pad[_UTX_PADSIZE];	/* reserved for future use */
+};
+
+#if defined(_NETBSD_SOURCE)
+struct lastlogx {
+	struct timeval ll_tv;		/* time entry was created */
+	char ll_line[_UTX_LINESIZE];	/* tty name */
+	char ll_host[_UTX_HOSTSIZE];	/* host name */
+	struct sockaddr_storage ll_ss;	/* address where entry was made from */
+};
+#endif	/* !_XOPEN_SOURCE */
+
+__BEGIN_DECLS
+
+void setutxent(void);
+void endutxent(void);
+
+#ifndef __LIBC12_SOURCE__
+struct utmpx *getutxent(void) __RENAME(__getutxent50);
+struct utmpx *getutxid(const struct utmpx *) __RENAME(__getutxid50);
+struct utmpx *getutxline(const struct utmpx *) __RENAME(__getutxline50);
+struct utmpx *pututxline(const struct utmpx *) __RENAME(__pututxline50);
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+int updwtmpx(const char *, const struct utmpx *) __RENAME(__updwtmpx50);
+struct lastlogx *getlastlogx(const char *, uid_t, struct lastlogx *)
+    __RENAME(__getlastlogx50);
+int updlastlogx(const char *, uid_t, struct lastlogx *)
+    __RENAME(__updlastlogx50);
+struct utmp;
+void getutmp(const struct utmpx *, struct utmp *) __RENAME(__getutmp50);
+void getutmpx(const struct utmp *, struct utmpx *) __RENAME(__getutmpx50);
+#endif
+
+int utmpxname(const char *);
+
+#endif /* _NETBSD_SOURCE */
+
+__END_DECLS
+
+#endif /* !_UTMPX_H_ */

Property changes on: lab4/.minix-src/include/utmpx.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/wchar.h
===================================================================
--- lab4/.minix-src/include/wchar.h	(nonexistent)
+++ lab4/.minix-src/include/wchar.h	(revision 13)
@@ -0,0 +1,295 @@
+/*	$NetBSD: wchar.h,v 1.41 2014/10/13 00:47:03 christos Exp $	*/
+
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Julian Coleman.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _WCHAR_H_
+#define _WCHAR_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <machine/wchar_limits.h>
+#include <sys/ansi.h>
+#include <sys/null.h>
+
+#include <stdio.h> /* for FILE* */
+
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
+typedef	_BSD_WCHAR_T_	wchar_t;
+#undef	_BSD_WCHAR_T_
+#endif
+
+#ifdef	_BSD_MBSTATE_T_
+typedef	_BSD_MBSTATE_T_	mbstate_t;
+#undef	_BSD_MBSTATE_T_
+#endif
+
+#ifdef	_BSD_WINT_T_
+typedef	_BSD_WINT_T_	wint_t;
+#undef	_BSD_WINT_T_
+#endif
+
+#ifdef	_BSD_SIZE_T_
+typedef	_BSD_SIZE_T_	size_t;
+#undef	_BSD_SIZE_T_
+#endif
+
+#if defined(_POSIX_C_SOURCE)
+#ifndef __VA_LIST_DECLARED
+typedef __va_list va_list;
+#define __VA_LIST_DECLARED
+#endif
+#endif
+
+struct tm;
+
+__BEGIN_DECLS
+wint_t	btowc(int);
+size_t	mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
+size_t	mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
+	    mbstate_t * __restrict);
+int	mbsinit(const mbstate_t *);
+size_t	mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
+	    mbstate_t * __restrict);
+size_t	wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
+wchar_t	*wcscat(wchar_t * __restrict, const wchar_t * __restrict);
+wchar_t	*wcschr(const wchar_t *, wchar_t);
+int	wcscmp(const wchar_t *, const wchar_t *);
+int	wcscoll(const wchar_t *, const wchar_t *);
+wchar_t	*wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
+size_t	wcscspn(const wchar_t *, const wchar_t *);
+size_t	wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
+	    const struct tm * __restrict);
+size_t	wcslen(const wchar_t *);
+wchar_t	*wcsncat(wchar_t * __restrict, const wchar_t * __restrict, size_t);
+int	wcsncmp(const wchar_t *, const wchar_t *, size_t);
+wchar_t	*wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
+wchar_t	*wcspbrk(const wchar_t *, const wchar_t *);
+wchar_t	*wcsrchr(const wchar_t *, wchar_t);
+size_t	wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
+	    mbstate_t * __restrict);
+size_t	wcsspn(const wchar_t *, const wchar_t *);
+wchar_t	*wcsstr(const wchar_t *, const wchar_t *);
+wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict,
+		     wchar_t ** __restrict);
+size_t	wcsxfrm(wchar_t *, const wchar_t *, size_t);
+wchar_t	*wcswcs(const wchar_t *, const wchar_t *);
+wchar_t	*wmemchr(const wchar_t *, wchar_t, size_t);
+int	wmemcmp(const wchar_t *, const wchar_t *, size_t);
+wchar_t	*wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
+wchar_t	*wmemmove(wchar_t *, const wchar_t *, size_t);
+wchar_t	*wmemset(wchar_t *, wchar_t, size_t);
+
+size_t	wcslcat(wchar_t *, const wchar_t *, size_t);
+size_t	wcslcpy(wchar_t *, const wchar_t *, size_t);
+int	wcswidth(const wchar_t *, size_t);
+int	wctob(wint_t);
+int	wcwidth(wchar_t);
+
+unsigned long int wcstoul(const wchar_t * __restrict,
+	wchar_t ** __restrict, int);
+long int wcstol(const wchar_t * __restrict,
+	wchar_t ** __restrict, int);
+double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
+
+#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
+    defined(_NETBSD_SOURCE) || \
+	(_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600
+float wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
+long double wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
+
+/* LONGLONG */
+long long int wcstoll(const wchar_t * __restrict,
+	wchar_t ** __restrict, int);
+/* LONGLONG */
+unsigned long long int wcstoull(const wchar_t * __restrict,
+	wchar_t ** __restrict, int);
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
+    defined(_NETBSD_SOURCE)
+FILE	*open_wmemstream(wchar_t **, size_t *);
+#endif
+
+wint_t ungetwc(wint_t, FILE *);
+wint_t fgetwc(FILE *);
+wchar_t *fgetws(wchar_t * __restrict, int, FILE * __restrict);
+wint_t getwc(FILE *);
+wint_t getwchar(void);
+wint_t fputwc(wchar_t, FILE *);
+int fputws(const wchar_t * __restrict, FILE * __restrict);
+wint_t putwc(wchar_t, FILE *);
+wint_t putwchar(wchar_t);
+
+int fwide(FILE *, int);
+
+wchar_t	*fgetwln(FILE * __restrict, size_t * __restrict);
+int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
+int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
+int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, ...);
+int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
+int vfwprintf(FILE * __restrict, const wchar_t * __restrict, __va_list);
+int vswprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict,
+    __va_list);
+int vwprintf(const wchar_t * __restrict, __va_list);
+int wprintf(const wchar_t * __restrict, ...);
+int wscanf(const wchar_t * __restrict, ...);
+#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
+    defined(_NETBSD_SOURCE) || \
+	(_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600
+int vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list);
+int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
+    __va_list);
+int vwscanf(const wchar_t * __restrict, __va_list);
+#endif
+#if defined(_NETBSD_SOURCE)
+struct tinfo;
+int t_putws(struct tinfo *, const wchar_t *, int, void (*)(wchar_t, void *),
+    void *);
+wchar_t *wcsdup (const wchar_t *);
+int wcsncasecmp (const wchar_t *, const wchar_t *, size_t);
+int wcscasecmp(const wchar_t *, const wchar_t *);
+#endif
+__END_DECLS
+
+#ifndef WEOF
+#define	WEOF 	((wint_t)-1)
+#endif
+
+#define getwc(f) fgetwc(f)
+#define getwchar() getwc(stdin)
+#define putwc(wc, f) fputwc((wc), (f))
+#define putwchar(wc) putwc((wc), stdout)
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+__BEGIN_DECLS
+size_t	mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
+	    size_t, mbstate_t * __restrict);
+size_t	wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
+	    size_t, mbstate_t * __restrict);
+
+int	wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
+size_t	wcsxfrm_l(wchar_t *, const wchar_t *, size_t, locale_t);
+int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
+int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
+
+size_t	wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict,
+	    const struct tm * __restrict, locale_t);
+
+float wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
+double wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
+long double wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict,
+    locale_t);
+long int wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
+		  locale_t);
+unsigned long int wcstoul_l(const wchar_t * __restrict,
+	wchar_t ** __restrict, int, locale_t);
+/* LONGLONG */
+long long int wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
+			locale_t);
+/* LONGLONG */
+unsigned long long int wcstoull_l(const wchar_t * __restrict,
+				  wchar_t ** __restrict, int, locale_t);
+int	wcwidth_l(wchar_t, locale_t);
+int	wcswidth_l(const wchar_t *, size_t, locale_t);
+__END_DECLS
+#endif /* _POSIX_C_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+wint_t	btowc_l(int, locale_t);
+size_t	mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict,
+		locale_t);
+size_t	mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
+	    mbstate_t * __restrict, locale_t);
+int	mbsinit_l(const mbstate_t *, locale_t);
+size_t	mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
+	    mbstate_t * __restrict, locale_t);
+size_t	mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
+	    size_t, mbstate_t * __restrict, locale_t);
+size_t	wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t);
+size_t	wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
+	    mbstate_t * __restrict, locale_t);
+size_t	wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
+	    size_t, mbstate_t * __restrict, locale_t);
+int	wctob_l(wint_t, locale_t);
+
+int fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
+int swprintf_l(wchar_t * __restrict, size_t n, locale_t,
+    const wchar_t * __restrict, ...);
+int vfwprintf_l(FILE * __restrict, locale_t,
+    const wchar_t * __restrict, __va_list);
+int vswprintf_l(wchar_t * __restrict, size_t, locale_t,
+    const wchar_t * __restrict, __va_list);
+int vwprintf_l(locale_t, const wchar_t * __restrict, __va_list);
+int wprintf_l(locale_t, const wchar_t * __restrict, ...);
+
+int fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
+int swscanf_l(const wchar_t * __restrict, locale_t, const wchar_t *
+    __restrict, ...);
+int wscanf_l(locale_t, const wchar_t * __restrict, ...);
+int vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
+    __va_list);
+int vswscanf_l(const wchar_t * __restrict, locale_t, const wchar_t * __restrict,
+    __va_list);
+int vwscanf_l(locale_t, const wchar_t * __restrict, __va_list);
+__END_DECLS
+#endif /* _NETBSD_SOURCE */
+
+#endif /* !_WCHAR_H_ */

Property changes on: lab4/.minix-src/include/wchar.h
___________________________________________________________________
Added: svn:executable
Index: lab4/.minix-src/include/zlib.h
===================================================================
--- lab4/.minix-src/include/zlib.h	(nonexistent)
+++ lab4/.minix-src/include/zlib.h	(revision 13)
@@ -0,0 +1,1361 @@
+/*	$NetBSD: zlib.h,v 1.3 2009/03/25 18:41:06 tls Exp $	*/
+
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+  version 1.2.3, July 18th, 2005
+
+  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup@gzip.org          madler@alumni.caltech.edu
+
+
+  The data format used by the zlib library is described by RFCs (Request for
+  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
+  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef ZLIB_H
+#define ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.2.3"
+#define ZLIB_VERNUM 0x1230
+
+/*
+     The 'zlib' compression library provides in-memory compression and
+  decompression functions, including integrity checks of the uncompressed
+  data.  This version of the library supports only one compression method
+  (deflation) but other algorithms will be added later and will have the same
+  stream interface.
+
+     Compression can be done in a single step if the buffers are large
+  enough (for example if an input file is mmap'ed), or can be done by
+  repeated calls of the compression function.  In the latter case, the
+  application must provide more input and/or consume the output
+  (providing more output space) before each call.
+
+     The compressed data format used by default by the in-memory functions is
+  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
+  around a deflate stream, which is itself documented in RFC 1951.
+
+     The library also supports reading and writing files in gzip (.gz) format
+  with an interface similar to that of stdio using the functions that start
+  with "gz".  The gzip format is different from the zlib format.  gzip is a
+  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
+
+     This library can optionally read and write gzip streams in memory as well.
+
+     The zlib format was designed to be compact and fast for use in memory
+  and on communications channels.  The gzip format was designed for single-
+  file compression on file systems, has a larger header than zlib to maintain
+  directory information, and uses a different, slower check method than zlib.
+
+     The library does not install any signal handler. The decoder checks
+  the consistency of the compressed data, so the library should never
+  crash even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+    Bytef    *next_in;  /* next input byte */
+    uInt     avail_in;  /* number of bytes available at next_in */
+    uLong    total_in;  /* total nb of input bytes read so far */
+
+    Bytef    *next_out; /* next output byte should be put there */
+    uInt     avail_out; /* remaining free space at next_out */
+    uLong    total_out; /* total nb of bytes output so far */
+
+    char     *msg;      /* last error message, NULL if no error */
+    struct internal_state FAR *state; /* not visible by applications */
+
+    alloc_func zalloc;  /* used to allocate the internal state */
+    free_func  zfree;   /* used to free the internal state */
+    voidpf     opaque;  /* private data object passed to zalloc and zfree */
+
+    int     data_type;  /* best guess about the data type: binary or text */
+    uLong   adler;      /* adler32 value of the uncompressed data */
+    uLong   reserved;   /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+     gzip header information passed to and from zlib routines.  See RFC 1952
+  for more details on the meanings of these fields.
+*/
+typedef struct gz_header_s {
+    int     text;       /* true if compressed data believed to be text */
+    uLong   time;       /* modification time */
+    int     xflags;     /* extra flags (not used when writing a gzip file) */
+    int     os;         /* operating system */
+    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
+    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
+    uInt    extra_max;  /* space at extra (only when reading header) */
+    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
+    uInt    name_max;   /* space at name (only when reading header) */
+    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
+    uInt    comm_max;   /* space at comment (only when reading header) */
+    int     hcrc;       /* true if there was or will be a header crc */
+    int     done;       /* true when done reading gzip header (not used
+                           when writing a gzip file) */
+} gz_header;
+
+typedef gz_header FAR *gz_headerp;
+
+/*
+   The application must update next_in and avail_in when avail_in has
+   dropped to zero. It must update next_out and avail_out when avail_out
+   has dropped to zero. The application must initialize zalloc, zfree and
+   opaque before calling the init function. All other fields are set by the
+   compression library and must not be updated by the application.
+
+   The opaque value provided by the application will be passed as the first
+   parameter for calls of zalloc and zfree. This can be useful for custom
+   memory management. The compression library attaches no meaning to the
+   opaque value.
+
+   zalloc must return Z_NULL if there is not enough memory for the object.
+   If zlib is used in a multi-threaded application, zalloc and zfree must be
+   thread safe.
+
+   On 16-bit systems, the functions zalloc and zfree must be able to allocate
+   exactly 65536 bytes, but will not be required to allocate more than this
+   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+   pointers returned by zalloc for objects of exactly 65536 bytes *must*
+   have their offset normalized to zero. The default allocation function
+   provided by this library ensures this (see zutil.c). To reduce memory
+   requirements and avoid any allocation of 64K objects, at the expense of
+   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+
+   The fields total_in and total_out can be used for statistics or
+   progress reports. After compression, total_in holds the total size of
+   the uncompressed data and may be saved for use in the decompressor
+   (particularly if the decompressor wants to decompress everything in
+   a single step).
+*/
+
+                        /* constants */
+
+#define Z_NO_FLUSH      0
+#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+#define Z_SYNC_FLUSH    2
+#define Z_FULL_FLUSH    3
+#define Z_FINISH        4
+#define Z_BLOCK         5
+/* Allowed flush values; see deflate() and inflate() below for details */
+
+#define Z_OK            0
+#define Z_STREAM_END    1
+#define Z_NEED_DICT     2
+#define Z_ERRNO        (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR   (-3)
+#define Z_MEM_ERROR    (-4)
+#define Z_BUF_ERROR    (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative
+ * values are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION         0
+#define Z_BEST_SPEED             1
+#define Z_BEST_COMPRESSION       9
+#define Z_DEFAULT_COMPRESSION  (-1)
+/* compression levels */
+
+#define Z_FILTERED            1
+#define Z_HUFFMAN_ONLY        2
+#define Z_RLE                 3
+#define Z_FIXED               4
+#define Z_DEFAULT_STRATEGY    0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY   0
+#define Z_TEXT     1
+#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
+#define Z_UNKNOWN  2
+/* Possible values of the data_type field (though see inflate()) */
+
+#define Z_DEFLATED   8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+                        /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+   If the first character differs, the library code actually used is
+   not compatible with the zlib.h header file used by the application.
+   This check is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+     Initializes the internal stream state for compression. The fields
+   zalloc, zfree and opaque must be initialized before by the caller.
+   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+   use default allocation functions.
+
+     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+   1 gives best speed, 9 gives best compression, 0 gives no compression at
+   all (the input data is simply copied a block at a time).
+   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+   compression (currently equivalent to level 6).
+
+     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+   with the version assumed by the caller (ZLIB_VERSION).
+   msg is set to null if there is no error message.  deflateInit does not
+   perform any compression: this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+    deflate compresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full. It may introduce some
+  output latency (reading input without producing any output) except when
+  forced to flush.
+
+    The detailed semantics are as follows. deflate performs one or both of the
+  following actions:
+
+  - Compress more input starting at next_in and update next_in and avail_in
+    accordingly. If not all input can be processed (because there is not
+    enough room in the output buffer), next_in and avail_in are updated and
+    processing will resume at this point for the next call of deflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly. This action is forced if the parameter flush is non zero.
+    Forcing flush frequently degrades the compression ratio, so this parameter
+    should be set only when necessary (in interactive applications).
+    Some output may be provided even if flush is not set.
+
+  Before the call of deflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming
+  more output, and updating avail_in or avail_out accordingly; avail_out
+  should never be zero before the call. The application can consume the
+  compressed output when it wants, for example when the output buffer is full
+  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+  and with zero avail_out, it must be called again after making room in the
+  output buffer because there might be more output pending.
+
+    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
+  decide how much data to accumualte before producing output, in order to
+  maximize compression.
+
+    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+  flushed to the output buffer and the output is aligned on a byte boundary, so
+  that the decompressor can get all input data available so far. (In particular
+  avail_in is zero after the call if enough output space has been provided
+  before the call.)  Flushing may degrade compression for some compression
+  algorithms and so it should be used only when necessary.
+
+    If flush is set to Z_FULL_FLUSH, all output is flushed as with
+  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+  restart from this point if previous compressed data has been damaged or if
+  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+  compression.
+
+    If deflate returns with avail_out == 0, this function must be called again
+  with the same value of the flush parameter and more output space (updated
+  avail_out), until the flush is complete (deflate returns with non-zero
+  avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
+  avail_out is greater than six to avoid repeated flush markers due to
+  avail_out == 0 on return.
+
+    If the parameter flush is set to Z_FINISH, pending input is processed,
+  pending output is flushed and deflate returns with Z_STREAM_END if there
+  was enough output space; if deflate returns with Z_OK, this function must be
+  called again with Z_FINISH and more output space (updated avail_out) but no
+  more input data, until it returns with Z_STREAM_END or an error. After
+  deflate has returned Z_STREAM_END, the only possible operations on the
+  stream are deflateReset or deflateEnd.
+
+    Z_FINISH can be used immediately after deflateInit if all the compression
+  is to be done in a single step. In this case, avail_out must be at least
+  the value returned by deflateBound (see below). If deflate does not return
+  Z_STREAM_END, then it must be called again as described above.
+
+    deflate() sets strm->adler to the adler32 checksum of all input read
+  so far (that is, total_in bytes).
+
+    deflate() may update strm->data_type if it can make a good guess about
+  the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
+  binary. This field is only for information purposes and does not affect
+  the compression algorithm in any manner.
+
+    deflate() returns Z_OK if some progress has been made (more input
+  processed or more output produced), Z_STREAM_END if all input has been
+  consumed and all output has been produced (only when flush is set to
+  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+  (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
+  fatal, and deflate() can be called again with more input and more output
+  space to continue compressing.
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any
+   pending output.
+
+     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+   prematurely (some input or output was discarded). In the error case,
+   msg may be set but then points to a static string (which must not be
+   deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+     Initializes the internal stream state for decompression. The fields
+   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+   value depends on the compression method), inflateInit determines the
+   compression method from the zlib header and allocates all data structures
+   accordingly; otherwise the allocation will be deferred to the first call of
+   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+   use default allocation functions.
+
+     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+   version assumed by the caller.  msg is set to null if there is no error
+   message. inflateInit does not perform any decompression apart from reading
+   the zlib header if present: this will be done by inflate().  (So next_in and
+   avail_in may be modified, but next_out and avail_out are unchanged.)
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+    inflate decompresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full. It may introduce
+  some output latency (reading input without producing any output) except when
+  forced to flush.
+
+  The detailed semantics are as follows. inflate performs one or both of the
+  following actions:
+
+  - Decompress more input starting at next_in and update next_in and avail_in
+    accordingly. If not all input can be processed (because there is not
+    enough room in the output buffer), next_in is updated and processing
+    will resume at this point for the next call of inflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly.  inflate() provides as much output as possible, until there
+    is no more input data or no more space in the output buffer (see below
+    about the flush parameter).
+
+  Before the call of inflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming
+  more output, and updating the next_* and avail_* values accordingly.
+  The application can consume the uncompressed output when it wants, for
+  example when the output buffer is full (avail_out == 0), or after each
+  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+  must be called again after making room in the output buffer because there
+  might be more output pending.
+
+    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
+  Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
+  output as possible to the output buffer. Z_BLOCK requests that inflate() stop
+  if and when it gets to the next deflate block boundary. When decoding the
+  zlib or gzip format, this will cause inflate() to return immediately after
+  the header and before the first block. When doing a raw inflate, inflate()
+  will go ahead and process the first block, and will return when it gets to
+  the end of that block, or when it runs out of data.
+
+    The Z_BLOCK option assists in appending to or combining deflate streams.
+  Also to assist in this, on return inflate() will set strm->data_type to the
+  number of unused bits in the last byte taken from strm->next_in, plus 64
+  if inflate() is currently decoding the last block in the deflate stream,
+  plus 128 if inflate() returned immediately after decoding an end-of-block
+  code or decoding the complete header up to just before the first byte of the
+  deflate stream. The end-of-block will not be indicated until all of the
+  uncompressed data from that block has been written to strm->next_out.  The
+  number of unused bits may in general be greater than seven, except when
+  bit 7 of data_type is set, in which case the number of unused bits will be
+  less than eight.
+
+    inflate() should normally be called until it returns Z_STREAM_END or an
+  error. However if all decompression is to be performed in a single step
+  (a single call of inflate), the parameter flush should be set to
+  Z_FINISH. In this case all pending input is processed and all pending
+  output is flushed; avail_out must be large enough to hold all the
+  uncompressed data. (The size of the uncompressed data may have been saved
+  by the compressor for this purpose.) The next operation on this stream must
+  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+  is never required, but can be used to inform inflate that a faster approach
+  may be used for the single inflate() call.
+
+     In this implementation, inflate() always flushes as much output as
+  possible to the output buffer, and always uses the faster approach on the
+  first call. So the only effect of the flush parameter in this implementation
+  is on the return value of inflate(), as noted below, or when it returns early
+  because Z_BLOCK is used.
+
+     If a preset dictionary is needed after this call (see inflateSetDictionary
+  below), inflate sets strm->adler to the adler32 checksum of the dictionary
+  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
+  strm->adler to the adler32 checksum of all output produced so far (that is,
+  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
+  below. At the end of the stream, inflate() checks that its computed adler32
+  checksum is equal to that saved by the compressor and returns Z_STREAM_END
+  only if the checksum is correct.
+
+    inflate() will decompress and check either zlib-wrapped or gzip-wrapped
+  deflate data.  The header type is detected automatically.  Any information
+  contained in the gzip header is not retained, so applications that need that
+  information should instead use raw inflate, see inflateInit2() below, or
+  inflateBack() and perform their own processing of the gzip header and
+  trailer.
+
+    inflate() returns Z_OK if some progress has been made (more input processed
+  or more output produced), Z_STREAM_END if the end of the compressed data has
+  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+  corrupted (input stream not conforming to the zlib format or incorrect check
+  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
+  if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
+  Z_BUF_ERROR if no progress is possible or if there was not enough room in the
+  output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
+  inflate() can be called again with more input and more output space to
+  continue decompressing. If Z_DATA_ERROR is returned, the application may then
+  call inflateSync() to look for a good compression block if a partial recovery
+  of the data is desired.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any
+   pending output.
+
+     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+   was inconsistent. In the error case, msg may be set but then points to a
+   static string (which must not be deallocated).
+*/
+
+                        /* Advanced functions */
+
+/*
+    The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+                                     int  level,
+                                     int  method,
+                                     int  windowBits,
+                                     int  memLevel,
+                                     int  strategy));
+
+     This is another version of deflateInit with more compression options. The
+   fields next_in, zalloc, zfree and opaque must be initialized before by
+   the caller.
+
+     The method parameter is the compression method. It must be Z_DEFLATED in
+   this version of the library.
+
+     The windowBits parameter is the base two logarithm of the window size
+   (the size of the history buffer). It should be in the range 8..15 for this
+   version of the library. Larger values of this parameter result in better
+   compression at the expense of memory usage. The default value is 15 if
+   deflateInit is used instead.
+
+     windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
+   determines the window size. deflate() will then generate raw deflate data
+   with no zlib header or trailer, and will not compute an adler32 check value.
+
+     windowBits can also be greater than 15 for optional gzip encoding. Add
+   16 to windowBits to write a simple gzip header and trailer around the
+   compressed data instead of a zlib wrapper. The gzip header will have no
+   file name, no extra data, no comment, no modification time (set to zero),
+   no header crc, and the operating system will be set to 255 (unknown).  If a
+   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
+
+     The memLevel parameter specifies how much memory should be allocated
+   for the internal compression state. memLevel=1 uses minimum memory but
+   is slow and reduces compression ratio; memLevel=9 uses maximum memory
+   for optimal speed. The default value is 8. See zconf.h for total memory
+   usage as a function of windowBits and memLevel.
+
+     The strategy parameter is used to tune the compression algorithm. Use the
+   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
+   string match), or Z_RLE to limit match distances to one (run-length
+   encoding). Filtered data consists mostly of small values with a somewhat
+   random distribution. In this case, the compression algorithm is tuned to
+   compress them better. The effect of Z_FILTERED is to force more Huffman
+   coding and less string matching; it is somewhat intermediate between
+   Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
+   Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
+   parameter only affects the compression ratio but not the correctness of the
+   compressed output even if it is not set appropriately.  Z_FIXED prevents the
+   use of dynamic Huffman codes, allowing for a simpler decoder for special
+   applications.
+
+      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+   method). msg is set to null if there is no error message.  deflateInit2 does
+   not perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the compression dictionary from the given byte sequence
+   without producing any compressed output. This function must be called
+   immediately after deflateInit, deflateInit2 or deflateReset, before any
+   call of deflate. The compressor and decompressor must use exactly the same
+   dictionary (see inflateSetDictionary).
+
+     The dictionary should consist of strings (byte sequences) that are likely
+   to be encountered later in the data to be compressed, with the most commonly
+   used strings preferably put towards the end of the dictionary. Using a
+   dictionary is most useful when the data to be compressed is short and can be
+   predicted with good accuracy; the data can then be compressed better than
+   with the default empty dictionary.
+
+     Depending on the size of the compression data structures selected by
+   deflateInit or deflateInit2, a part of the dictionary may in effect be
+   discarded, for example if the dictionary is larger than the window size in
+   deflate or deflate2. Thus the strings most likely to be useful should be
+   put at the end of the dictionary, not at the front. In addition, the
+   current implementation of deflate will use at most the window size minus
+   262 bytes of the provided dictionary.
+
+     Upon return of this function, strm->adler is set to the adler32 value
+   of the dictionary; the decompressor may later use this value to determine
+   which dictionary has been used by the compressor. (The adler32 value
+   applies to the whole dictionary even if only a subset of the dictionary is
+   actually used by the compressor.) If a raw deflate was requested, then the
+   adler32 value is not computed and strm->adler is not set.
+
+     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+   parameter is invalid (such as NULL dictionary) or the stream state is
+   inconsistent (for example if deflate has already been called for this stream
+   or if the compression method is bsort). deflateSetDictionary does not
+   perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when several compression strategies will be
+   tried, for example when there are several ways of pre-processing the input
+   data with a filter. The streams that will be discarded should then be freed
+   by calling deflateEnd.  Note that deflateCopy duplicates the internal
+   compression state which can be quite large, so this strategy is slow and
+   can consume lots of memory.
+
+     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being NULL). msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to deflateEnd followed by deflateInit,
+   but does not free and reallocate all the internal compression state.
+   The stream will keep the same compression level and any other attributes
+   that may have been set by deflateInit2.
+
+      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+                                      int level,
+                                      int strategy));
+/*
+     Dynamically update the compression level and compression strategy.  The
+   interpretation of level and strategy is as in deflateInit2.  This can be
+   used to switch between compression and straight copy of the input data, or
+   to switch to a different kind of input data requiring a different
+   strategy. If the compression level is changed, the input available so far
+   is compressed with the old level (and may be flushed); the new level will
+   take effect only at the next call of deflate().
+
+     Before the call of deflateParams, the stream state must be set as for
+   a call of deflate(), since the currently available input may have to
+   be compressed and flushed. In particular, strm->avail_out must be non-zero.
+
+     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+   if strm->avail_out was zero.
+*/
+
+ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
+                                    int good_length,
+                                    int max_lazy,
+                                    int nice_length,
+                                    int max_chain));
+/*
+     Fine tune deflate's internal compression parameters.  This should only be
+   used by someone who understands the algorithm used by zlib's deflate for
+   searching for the best matching string, and even then only by the most
+   fanatic optimizer trying to squeeze out the last compressed bit for their
+   specific input data.  Read the deflate.c source code for the meaning of the
+   max_lazy, good_length, nice_length, and max_chain parameters.
+
+     deflateTune() can be called after deflateInit() or deflateInit2(), and
+   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
+ */
+
+ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
+                                       uLong sourceLen));
+/*
+     deflateBound() returns an upper bound on the compressed size after
+   deflation of sourceLen bytes.  It must be called after deflateInit()
+   or deflateInit2().  This would be used to allocate an output buffer
+   for deflation in a single pass, and so would be called before deflate().
+*/
+
+ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
+                                     int bits,
+                                     int value));
+/*
+     deflatePrime() inserts bits in the deflate output stream.  The intent
+  is that this function is used to start off the deflate output with the
+  bits leftover from a previous deflate stream when appending to it.  As such,
+  this function can only be used for raw deflate, and must be used before the
+  first deflate() call after a deflateInit2() or deflateReset().  bits must be
+  less than or equal to 16, and that many of the least significant bits of
+  value will be inserted in the output.
+
+      deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
+                                         gz_headerp head));
+/*
+      deflateSetHeader() provides gzip header information for when a gzip
+   stream is requested by deflateInit2().  deflateSetHeader() may be called
+   after deflateInit2() or deflateReset() and before the first call of
+   deflate().  The text, time, os, extra field, name, and comment information
+   in the provided gz_header structure are written to the gzip header (xflag is
+   ignored -- the extra flags are set according to the compression level).  The
+   caller must assure that, if not Z_NULL, name and comment are terminated with
+   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
+   available there.  If hcrc is true, a gzip header crc is included.  Note that
+   the current versions of the command-line version of gzip (up through version
+   1.3.x) do not support header crc's, and will report that it is a "multi-part
+   gzip file" and give up.
+
+      If deflateSetHeader is not used, the default gzip header has text false,
+   the time set to zero, and os set to 255, with no extra, name, or comment
+   fields.  The gzip header is returned to the default state by deflateReset().
+
+      deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+                                     int  windowBits));
+
+     This is another version of inflateInit with an extra parameter. The
+   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+   before by the caller.
+
+     The windowBits parameter is the base two logarithm of the maximum window
+   size (the size of the history buffer).  It should be in the range 8..15 for
+   this version of the library. The default value is 15 if inflateInit is used
+   instead. windowBits must be greater than or equal to the windowBits value
+   provided to deflateInit2() while compressing, or it must be equal to 15 if
+   deflateInit2() was not used. If a compressed stream with a larger window
+   size is given as input, inflate() will return with the error code
+   Z_DATA_ERROR instead of trying to allocate a larger window.
+
+     windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
+   determines the window size. inflate() will then process raw deflate data,
+   not looking for a zlib or gzip header, not generating a check value, and not
+   looking for any check values for comparison at the end of the stream. This
+   is for use with other formats that use the deflate compressed data format
+   such as zip.  Those formats provide their own check values. If a custom
+   format is developed using the raw deflate format for compressed data, it is
+   recommended that a check value such as an adler32 or a crc32 be applied to
+   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
+   most applications, the zlib format should be used as is. Note that comments
+   above on the use in deflateInit2() applies to the magnitude of windowBits.
+
+     windowBits can also be greater than 15 for optional gzip decoding. Add
+   32 to windowBits to enable zlib and gzip decoding with automatic header
+   detection, or add 16 to decode only the gzip format (the zlib format will
+   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is
+   a crc32 instead of an adler32.
+
+     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
+   is set to null if there is no error message.  inflateInit2 does not perform
+   any decompression apart from reading the zlib header if present: this will
+   be done by inflate(). (So next_in and avail_in may be modified, but next_out
+   and avail_out are unchanged.)
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the decompression dictionary from the given uncompressed byte
+   sequence. This function must be called immediately after a call of inflate,
+   if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
+   can be determined from the adler32 value returned by that call of inflate.
+   The compressor and decompressor must use exactly the same dictionary (see
+   deflateSetDictionary).  For raw inflate, this function can be called
+   immediately after inflateInit2() or inflateReset() and before any call of
+   inflate() to set the dictionary.  The application must insure that the
+   dictionary that was used for compression is provided.
+
+     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+   parameter is invalid (such as NULL dictionary) or the stream state is
+   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+   expected one (incorrect adler32 value). inflateSetDictionary does not
+   perform any decompression: this will be done by subsequent calls of
+   inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+    Skips invalid compressed data until a full flush point (see above the
+  description of deflate with Z_FULL_FLUSH) can be found, or until all
+  available input is skipped. No output is provided.
+
+    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+  if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+  case, the application may save the current current value of total_in which
+  indicates where valid compressed data was found. In the error case, the
+  application may repeatedly call inflateSync, providing more input each time,
+  until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when randomly accessing a large stream.  The
+   first pass through the stream can periodically record the inflate state,
+   allowing restarting inflate at those points when randomly accessing the
+   stream.
+
+     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being NULL). msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to inflateEnd followed by inflateInit,
+   but does not free and reallocate all the internal decompression state.
+   The stream will keep attributes that may have been set by inflateInit2.
+
+      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
+                                     int bits,
+                                     int value));
+/*
+     This function inserts bits in the inflate input stream.  The intent is
+  that this function is used to start inflating at a bit position in the
+  middle of a byte.  The provided bits will be used before any bytes are used
+  from next_in.  This function should only be used with raw inflate, and
+  should be used before the first inflate() call after inflateInit2() or
+  inflateReset().  bits must be less than or equal to 16, and that many of the
+  least significant bits of value will be inserted in the input.
+
+      inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
+                                         gz_headerp head));
+/*
+      inflateGetHeader() requests that gzip header information be stored in the
+   provided gz_header structure.  inflateGetHeader() may be called after
+   inflateInit2() or inflateReset(), and before the first call of inflate().
+   As inflate() processes the gzip stream, head->done is zero until the header
+   is completed, at which time head->done is set to one.  If a zlib stream is
+   being decoded, then head->done is set to -1 to indicate that there will be
+   no gzip header information forthcoming.  Note that Z_BLOCK can be used to
+   force inflate() to return immediately after header processing is complete
+   and before any actual data is decompressed.
+
+      The text, time, xflags, and os fields are filled in with the gzip header
+   contents.  hcrc is set to true if there is a header CRC.  (The header CRC
+   was valid if done is set to one.)  If extra is not Z_NULL, then extra_max
+   contains the maximum number of bytes to write to extra.  Once done is true,
+   extra_len contains the actual extra field length, and extra contains the
+   extra field, or that field truncated if extra_max is less than extra_len.
+   If name is not Z_NULL, then up to name_max characters are written there,
+   terminated with a zero unless the length is greater than name_max.  If
+   comment is not Z_NULL, then up to comm_max characters are written there,
+   terminated with a zero unless the length is greater than comm_max.  When
+   any of extra, name, or comment are not Z_NULL and the respective field is
+   not present in the header, then that field is set to Z_NULL to signal its
+   absence.  This allows the use of deflateSetHeader() with the returned
+   structure to duplicate the header.  However if those fields are set to
+   allocated memory, then the application will need to save those pointers
+   elsewhere so that they can be eventually freed.
+
+      If inflateGetHeader is not used, then the header information is simply
+   discarded.  The header is always checked for validity, including the header
+   CRC if present.  inflateReset() will reset the process to discard the header
+   information.  The application would need to call inflateGetHeader() again to
+   retrieve the header from the next gzip stream.
+
+      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
+                                        unsigned char FAR *window));
+
+     Initialize the internal stream state for decompression using inflateBack()
+   calls.  The fields zalloc, zfree and opaque in strm must be initialized
+   before the call.  If zalloc and zfree are Z_NULL, then the default library-
+   derived memory allocation routines are used.  windowBits is the base two
+   logarithm of the window size, in the range 8..15.  window is a caller
+   supplied buffer of that size.  Except for special applications where it is
+   assured that deflate was used with small window sizes, windowBits must be 15
+   and a 32K byte window must be supplied to be able to decompress general
+   deflate streams.
+
+     See inflateBack() for the usage of these routines.
+
+     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
+   the paramaters are invalid, Z_MEM_ERROR if the internal state could not
+   be allocated, or Z_VERSION_ERROR if the version of the library does not
+   match the version of the header file.
+*/
+
+typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
+typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
+
+ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
+                                    in_func in, void FAR *in_desc,
+                                    out_func out, void FAR *out_desc));
+/*
+     inflateBack() does a raw inflate with a single call using a call-back
+   interface for input and output.  This is more efficient than inflate() for
+   file i/o applications in that it avoids copying between the output and the
+   sliding window by simply making the window itself the output buffer.  This
+   function trusts the application to not change the output buffer passed by
+   the output function, at least until inflateBack() returns.
+
+     inflateBackInit() must be called first to allocate the internal state
+   and to initialize the state with the user-provided window buffer.
+   inflateBack() may then be used multiple times to inflate a complete, raw
+   deflate stream with each call.  inflateBackEnd() is then called to free
+   the allocated state.
+
+     A raw deflate stream is one with no zlib or gzip header or trailer.
+   This routine would normally be used in a utility that reads zip or gzip
+   files and writes out uncompressed files.  The utility would decode the
+   header and process the trailer on its own, hence this routine expects
+   only the raw deflate stream to decompress.  This is different from the
+   normal behavior of inflate(), which expects either a zlib or gzip header and
+   trailer around the deflate stream.
+
+     inflateBack() uses two subroutines supplied by the caller that are then
+   called by inflateBack() for input and output.  inflateBack() calls those
+   routines until it reads a complete deflate stream and writes out all of the
+   uncompressed data, or until it encounters an error.  The function's
+   parameters and return types are defined above in the in_func and out_func
+   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
+   number of bytes of provided input, and a pointer to that input in buf.  If
+   there is no input available, in() must return zero--buf is ignored in that
+   case--and inflateBack() will return a buffer error.  inflateBack() will call
+   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()
+   should return zero on success, or non-zero on failure.  If out() returns
+   non-zero, inflateBack() will return with an error.  Neither in() nor out()
+   are permitted to change the contents of the window provided to
+   inflateBackInit(), which is also the buffer that out() uses to write from.
+   The length written by out() will be at most the window size.  Any non-zero
+   amount of input may be provided by in().
+
+     For convenience, inflateBack() can be provided input on the first call by
+   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
+   in() will be called.  Therefore strm->next_in must be initialized before
+   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
+   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
+   must also be initialized, and then if strm->avail_in is not zero, input will
+   initially be taken from strm->next_in[0 .. strm->avail_in - 1].
+
+     The in_desc and out_desc parameters of inflateBack() is passed as the
+   first parameter of in() and out() respectively when they are called.  These
+   descriptors can be optionally used to pass any information that the caller-
+   supplied in() and out() functions need to do their job.
+
+     On return, inflateBack() will set strm->next_in and strm->avail_in to
+   pass back any unused input that was provided by the last in() call.  The
+   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
+   if in() or out() returned an error, Z_DATA_ERROR if there was a format
+   error in the deflate stream (in which case strm->msg is set to indicate the
+   nature of the error), or Z_STREAM_ERROR if the stream was not properly
+   initialized.  In the case of Z_BUF_ERROR, an input or output error can be
+   distinguished using strm->next_in which will be Z_NULL only if in() returned
+   an error.  If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
+   out() returning non-zero.  (in() will always be called before out(), so
+   strm->next_in is assured to be defined if out() returns non-zero.)  Note
+   that inflateBack() cannot return Z_OK.
+*/
+
+ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
+/*
+     All memory allocated by inflateBackInit() is freed.
+
+     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
+   state was inconsistent.
+*/
+
+ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+/* Return flags indicating compile-time options.
+
+    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
+     1.0: size of uInt
+     3.2: size of uLong
+     5.4: size of voidpf (pointer)
+     7.6: size of z_off_t
+
+    Compiler, assembler, and debug options:
+     8: ZLIB_DEBUG
+     9: ASMV or ASMINF -- use ASM code
+     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
+     11: 0 (reserved)
+
+    One-time table building (smaller code, but not thread-safe if true):
+     12: BUILDFIXED -- build static block decoding tables when needed
+     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
+     14,15: 0 (reserved)
+
+    Library content (indicates missing functionality):
+     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
+                          deflate code when not needed)
+     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
+                    and decode gzip streams (to avoid linking crc code)
+     18-19: 0 (reserved)
+
+    Operation variations (changes in library functionality):
+     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
+     21: FASTEST -- deflate algorithm with only one, lowest compression level
+     22,23: 0 (reserved)
+
+    The sprintf variant used by gzprintf (zero is best):
+     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
+     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
+     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
+
+    Remainder:
+     27-31: 0 (reserved)
+ */
+
+
+                        /* utility functions */
+
+/*
+     The following utility functions are implemented on top of the
+   basic stream-oriented functions. To simplify the interface, some
+   default options are assumed (compression level and memory usage,
+   standard memory allocation functions). The source code of these
+   utility functions can easily be modified if you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
+                                 const Bytef *source, uLong sourceLen));
+/*
+     Compresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be at least the value returned
+   by compressBound(sourceLen). Upon exit, destLen is the actual size of the
+   compressed buffer.
+     This function can be used to compress a whole file at once if the
+   input file is mmap'ed.
+     compress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
+                                  const Bytef *source, uLong sourceLen,
+                                  int level));
+/*
+     Compresses the source buffer into the destination buffer. The level
+   parameter has the same meaning as in deflateInit.  sourceLen is the byte
+   length of the source buffer. Upon entry, destLen is the total size of the
+   destination buffer, which must be at least the value returned by
+   compressBound(sourceLen). Upon exit, destLen is the actual size of the
+   compressed buffer.
+
+     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+   Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
+/*
+     compressBound() returns an upper bound on the compressed size after
+   compress() or compress2() on sourceLen bytes.  It would be used before
+   a compress() or compress2() call to allocate the destination buffer.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
+                                   const Bytef *source, uLong sourceLen));
+/*
+     Decompresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be large enough to hold the
+   entire uncompressed data. (The size of the uncompressed data must have
+   been saved previously by the compressor and transmitted to the decompressor
+   by some mechanism outside the scope of this compression library.)
+   Upon exit, destLen is the actual size of the compressed buffer.
+     This function can be used to decompress a whole file at once if the
+   input file is mmap'ed.
+
+     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
+*/
+
+
+typedef voidp gzFile;
+
+ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
+/*
+     Opens a gzip (.gz) file for reading or writing. The mode parameter
+   is as in fopen ("rb" or "wb") but can also include a compression level
+   ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+   Huffman only compression as in "wb1h", or 'R' for run-length encoding
+   as in "wb1R". (See the description of deflateInit2 for more information
+   about the strategy parameter.)
+
+     gzopen can be used to read a file which is not in gzip format; in this
+   case gzread will directly read from the file without decompression.
+
+     gzopen returns NULL if the file could not be opened or if there was
+   insufficient memory to allocate the (de)compression state; errno
+   can be checked to distinguish the two cases (if errno is zero, the
+   zlib error is Z_MEM_ERROR).  */
+
+ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
+/*
+     gzdopen() associates a gzFile with the file descriptor fd.  File
+   descriptors are obtained from calls like open, dup, creat, pipe or
+   fileno (in the file has been previously opened with fopen).
+   The mode parameter is as in gzopen.
+     The next call of gzclose on the returned gzFile will also close the
+   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+     gzdopen returns NULL if there was insufficient memory to allocate
+   the (de)compression state.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+     Dynamically update the compression level or strategy. See the description
+   of deflateInit2 for the meaning of these parameters.
+     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+   opened for writing.
+*/
+
+ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
+/*
+     Reads the given number of uncompressed bytes from the compressed file.
+   If the input file was not in gzip format, gzread copies the given number
+   of bytes into the buffer.
+     gzread returns the number of uncompressed bytes actually read (0 for
+   end of file, -1 for error). */
+
+ZEXTERN int ZEXPORT    gzwrite OF((gzFile file,
+                                   voidpc buf, unsigned len));
+/*
+     Writes the given number of uncompressed bytes into the compressed file.
+   gzwrite returns the number of uncompressed bytes actually written
+   (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...));
+/*
+     Converts, formats, and writes the args to the compressed file under
+   control of the format string, as in fprintf. gzprintf returns the number of
+   uncompressed bytes actually written (0 in case of error).  The number of
+   uncompressed bytes written is limited to 4095. The caller should assure that
+   this limit is not exceeded. If it is exceeded, then gzprintf() will return
+   return an error (0) with nothing written. In this case, there may also be a
+   buffer overflow with unpredictable consequences, which is possible only if
+   zlib was compiled with the insecure functions sprintf() or vsprintf()
+   because the secure snprintf() or vsnprintf() functions were not available.
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+      Writes the given null-terminated string to the compressed file, excluding
+   the terminating null character.
+      gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+      Reads bytes from the compressed file until len-1 characters are read, or
+   a newline character is read and transferred to buf, or an end-of-file
+   condition is encountered.  The string is then terminated with a null
+   character.
+      gzgets returns buf, or Z_NULL in case of error.
+*/
+
+ZEXTERN int ZEXPORT    gzputc OF((gzFile file, int c));
+/*
+      Writes c, converted to an unsigned char, into the compressed file.
+   gzputc returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT    gzgetc OF((gzFile file));
+/*
+      Reads one byte from the compressed file. gzgetc returns this byte
+   or -1 in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT    gzungetc OF((int c, gzFile file));
+/*
+      Push one character back onto the stream to be read again later.
+   Only one character of push-back is allowed.  gzungetc() returns the
+   character pushed, or -1 on failure.  gzungetc() will fail if a
+   character has been pushed but not read yet, or if c is -1. The pushed
+   character will be discarded if the stream is repositioned with gzseek()
+   or gzrewind().
+*/
+
+ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
+/*
+     Flushes all pending output into the compressed file. The parameter
+   flush is as in the deflate() function. The return value is the zlib
+   error number (see function gzerror below). gzflush returns Z_OK if
+   the flush parameter is Z_FINISH and all output could be flushed.
+     gzflush should be called only when strictly necessary because it can
+   degrade compression.
+*/
+
+ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
+                                      z_off_t offset, int whence));
+/*
+      Sets the starting position for the next gzread or gzwrite on the
+   given compressed file. The offset represents a number of bytes in the
+   uncompressed data stream. The whence parameter is defined as in lseek(2);
+   the value SEEK_END is not supported.
+     If the file is opened for reading, this function is emulated but can be
+   extremely slow. If the file is opened for writing, only forward seeks are
+   supported; gzseek then compresses a sequence of zeroes up to the new
+   starting position.
+
+      gzseek returns the resulting offset location as measured in bytes from
+   the beginning of the uncompressed stream, or -1 in case of error, in
+   particular if the file is opened for writing and the new starting position
+   would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
+/*
+     Rewinds the given file. This function is supported only for reading.
+
+   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
+/*
+     Returns the starting position for the next gzread or gzwrite on the
+   given compressed file. This position represents a number of bytes in the
+   uncompressed data stream.
+
+   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+     Returns 1 when EOF has previously been detected reading the given
+   input stream, otherwise zero.
+*/
+
+ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
+/*
+     Returns 1 if file is being read directly without decompression, otherwise
+   zero.
+*/
+
+ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
+/*
+     Flushes all pending output if necessary, closes the compressed file
+   and deallocates all the (de)compression state. The return value is the zlib
+   error number (see function gzerror below).
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+     Returns the error message for the last error which occurred on the
+   given compressed file. errnum is set to zlib error number. If an
+   error occurred in the file system and not in the compression library,
+   errnum is set to Z_ERRNO and the application may consult errno
+   to get the exact error code.
+*/
+
+ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
+/*
+     Clears the error and end-of-file flags for file. This is analogous to the
+   clearerr() function in stdio. This is useful for continuing to read a gzip
+   file that is being written concurrently.
+*/
+
+                        /* checksum functions */
+
+/*
+     These functions are not related to compression but are exported
+   anyway because they might be useful in applications using the
+   compression library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+/*
+     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+   return the updated checksum. If buf is NULL, this function returns
+   the required initial value for the checksum.
+   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+   much faster. Usage example:
+
+     uLong adler = adler32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       adler = adler32(adler, buffer, length);
+     }
+     if (adler != original_adler) error();
+*/
+
+ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
+                                          z_off_t len2));
+/*
+     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
+   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
+   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
+   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
+*/
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
+#endif
+/*
+     Update a running CRC-32 with the bytes buf[0..len-1] and return the
+   updated CRC-32. If buf is NULL, this function returns the required initial
+   value for the for the crc. Pre- and post-conditioning (one's complement) is
+   performed within this function so it shouldn't be done by the application.
+   Usage example:
+
+     uLong crc = crc32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       crc = crc32(crc, buffer, length);
+     }
+     if (crc != original_crc) error();
+*/
+
+ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
+
+/*
+     Combine two CRC-32 check values into one.  For two sequences of bytes,
+   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
+   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
+   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
+   len2.
+*/
+
+
+                        /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
+                                      int windowBits, int memLevel,
+                                      int strategy, const char *version,
+                                      int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
+                                      const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
+                                         unsigned char FAR *window,
+                                         const char *version,
+                                         int stream_size));
+#define deflateInit(strm, level) \
+        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+#define inflateBackInit(strm, windowBits, window) \
+        inflateBackInit_((strm), (windowBits), (window), \
+        ZLIB_VERSION, sizeof(z_stream))
+
+
+#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
+    struct internal_state {int dummy;}; /* hack for buggy compilers */
+#endif
+
+ZEXTERN const char   * ZEXPORT zError           OF((int));
+ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
+ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZLIB_H */

Property changes on: lab4/.minix-src/include/zlib.h
___________________________________________________________________
Added: svn:executable
Index: lab4/lab2/lab2/.vscode/extensions.json
===================================================================
--- lab4/lab2/lab2/.vscode/extensions.json	(nonexistent)
+++ lab4/lab2/lab2/.vscode/extensions.json	(revision 13)
@@ -0,0 +1,12 @@
+{
+	// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+	// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+	// List of extensions which should be recommended for users of this workspace.
+	"recommendations": [
+		"austin.code-gnu-global",
+		"ms-vscode.cpptools",
+		"xaver.clang-format"
+	],
+	// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
+	"unwantedRecommendations": []
+}
\ No newline at end of file

Property changes on: lab4/lab2/lab2/.vscode/extensions.json
___________________________________________________________________
Added: svn:executable
Index: lab4/lab2/lab2/Makefile
===================================================================
--- lab4/lab2/lab2/Makefile	(nonexistent)
+++ lab4/lab2/lab2/Makefile	(revision 13)
@@ -0,0 +1,16 @@
+# name of the program (Minix service)
+PROG=lab2 
+
+# source code files to be compiled
+SRCS = lab2.c timer.c utils.c
+
+# additional compilation flags
+# "-Wall -Wextra -Werror -I . -std=c11 -Wno-unused-parameter" are already set
+CFLAGS += -pedantic
+
+# list of library dependencies (for Lab 2, only LCF library)
+DPADD += ${LIBLCF}
+LDADD += -llcf
+
+# include LCOM's makefile that does all the "heavy lifting"
+.include <minix.lcom.mk>

Property changes on: lab4/lab2/lab2/Makefile
___________________________________________________________________
Added: svn:executable
Index: lab4/lab2/lab2/timer.c
===================================================================
--- lab4/lab2/lab2/timer.c	(nonexistent)
+++ lab4/lab2/lab2/timer.c	(revision 13)
@@ -0,0 +1,164 @@
+#include <lcom/lcf.h>
+#include <lcom/timer.h>
+
+#include <stdint.h>
+
+#include "i8254.h"
+
+uint32_t cont=0;
+int hook_id;
+
+
+int (timer_set_frequency)(uint8_t timer, uint32_t freq) {
+  /* To be implemented by the students */
+  uint8_t conf;
+  timer_get_conf(timer,&conf);
+  uint32_t tudo;
+  uint8_t msb,lsb;
+  tudo=(TIMER_FREQ/freq);
+  util_get_MSB(tudo,&msb);
+  util_get_LSB(tudo,&lsb);
+  
+  //printf("%x\n%x\n%x\n%d\n",tudo,msb,lsb,timer);
+
+
+  if(timer==0)
+  {
+    conf=(conf&0xF);
+    conf = (conf  | TIMER_SEL0 | TIMER_LSB_MSB);
+  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
+  if(sys_outb(TIMER_0, lsb)!=0) return 1;
+  if(sys_outb(TIMER_0, msb)!=0) return 1;
+  }
+
+  if(timer==1)
+  {
+    conf=(conf&0xF);
+    conf = (conf | TIMER_SEL1 | TIMER_LSB_MSB);
+  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
+  if(sys_outb(TIMER_1, lsb)!=0) return 1;
+  if(sys_outb(TIMER_1, msb)!=0) return 1;
+  }
+
+  if(timer==2)
+  {
+    conf=(conf&0xF);
+    conf = (conf | TIMER_SEL2 | TIMER_LSB_MSB);
+  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
+  if(sys_outb(TIMER_2, lsb)!=0) return 1;
+  if(sys_outb(TIMER_2, msb)!=0) return 1;
+  }
+  return 0;
+
+}
+
+int (timer_subscribe_int)(uint8_t *bit_no) {
+    /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+ /*  int policy;
+  sys_irqrmpolicy(&policy); */
+  hook_id=*bit_no;
+  if(sys_irqsetpolicy(IRQ_TIMER,IRQ_REENABLE,&hook_id)!=0) return 1;
+
+  return 0;
+}
+
+int (timer_unsubscribe_int)() {
+  /* To be implemented by the students */
+// printf("%s is not yet implemented!\n", __func__);
+
+  if(sys_irqrmpolicy(&hook_id)!=0) return 1;
+
+  return 0;
+}
+
+void (timer_int_handler)() {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  cont=cont+1;
+}
+
+int (timer_get_conf)(uint8_t timer, uint8_t *st) {
+  /* To be implemented by the students */
+
+  uint8_t rbc = (TIMER_RB_CMD|TIMER_RB_SEL(4)|TIMER_RB_SEL(timer));
+  if(sys_outb(TIMER_CTRL,rbc)!=0) return 1;
+
+  
+  if(timer==0)
+  return (util_sys_inb(TIMER_0,st));
+  if(timer==1)
+  return (util_sys_inb(TIMER_1,st));
+  if(timer==2)
+  return (util_sys_inb(TIMER_2,st));
+
+  return 1;
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  
+}
+
+int (timer_display_conf)(uint8_t timer, uint8_t st,
+                        enum timer_status_field field) {
+  /* To be implemented by the students */
+  union timer_status_field_val val;
+  
+
+  if(field==tsf_all)
+  {
+    val.byte=st; 
+    
+  }
+ if(field==tsf_initial)
+  {
+    //printf("%d\n",tsf_initial);
+
+  if(((st&0x30)>>4)==0)
+  val.in_mode=INVAL_val;
+
+  if(((st&0x30)>>4)==1)
+  val.in_mode=LSB_only;
+
+  if(((st&0x30)>>4)==2)
+  val.in_mode=MSB_only;
+
+  if(((st&0x30)>>4)==3)
+  val.in_mode=MSB_after_LSB;
+  }
+  
+
+  if(field==tsf_mode)
+  {
+    //printf("%x\n",st);
+    val.count_mode=((st&0xE)>>1);
+
+    /* printf("%x\n",val.count_mode);
+    val.count_mode=(val.count_mode>>1);
+    printf("%x\n",val.count_mode); */
+  //val.count_mode=(st&0x1C)/4;
+
+ if (val.count_mode==6)
+ val.count_mode=2;
+
+ if (val.count_mode==7)
+ val.count_mode=3;
+
+
+  }
+
+  if(field==tsf_base ) //BCD
+  {
+    //printf("%d\n",tsf_base);
+    if((st&BIT(0))==1)
+    val.bcd=true;
+
+    else val.bcd=false;
+  }
+
+
+ return( timer_print_config(timer, field, val));
+  //printf("%s is not yet implemented!\n", __func__);
+
+  //return 0;
+}

Property changes on: lab4/lab2/lab2/timer.c
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/.vscode/settings.json
===================================================================
--- lab4/lab3/.vscode/settings.json	(nonexistent)
+++ lab4/lab3/.vscode/settings.json	(revision 13)
@@ -0,0 +1,10 @@
+{
+  "git.ignoreLimitWarning": true,
+  "C_Cpp.clang_format_fallbackStyle": "LLVM",
+  "diffEditor.ignoreTrimWhitespace": true,
+  "editor.formatOnSave": false,
+  "editor.tabSize": 2,
+  "editor.wordWrap": "bounded",
+  "editor.wordWrapColumn": 100,
+  "files.associations": { },
+}
\ No newline at end of file

Property changes on: lab4/lab3/.vscode/settings.json
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/i8042.h
===================================================================
--- lab4/lab3/i8042.h	(nonexistent)
+++ lab4/lab3/i8042.h	(revision 13)
@@ -0,0 +1,17 @@
+/*  #ifndef I8042_H
+#define I8042_H  */
+
+#define IRQ_KB 1
+#define DELAY_US 20000
+#define EXIT_CODE 0x81
+#define READ_CMD 0x20
+#define IN_BUF 0x64
+#define I_O_BUFFER 0x60
+#define O_BUFFER_FULL 0x01
+#define PAR_ERR 0x80
+#define TWO_BYTES 0xe0
+/* #define OBF BIT(0)
+#define TO_ERR BIT(6) */
+
+
+//#endif /* I8042_H */

Property changes on: lab4/lab3/i8042.h
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/lab3
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-executable
Index: lab4/test/lab3/lab3
===================================================================
--- lab4/test/lab3/lab3	(nonexistent)
+++ lab4/test/lab3/lab3	(revision 13)

Property changes on: lab4/test/lab3/lab3
___________________________________________________________________
Added: svn:executable
Added: svn:mime-type
## -0,0 +1 ##
+application/x-executable
\ No newline at end of property
Index: lab4/test/lab3/utils.c
===================================================================
--- lab4/test/lab3/utils.c	(nonexistent)
+++ lab4/test/lab3/utils.c	(revision 13)
@@ -0,0 +1,37 @@
+#include <lcom/lcf.h>
+
+#include <stdint.h>
+
+int(util_get_LSB)(uint16_t val, uint8_t *lsb) {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  *lsb=val&0xFF;
+  return 0;
+}
+
+int(util_get_MSB)(uint16_t val, uint8_t *msb) {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  *msb=(val&0xFF00)>>8;
+
+  return 0;
+}
+
+int (util_sys_inb)(int port, uint8_t *value) {
+  /* To be implemented by the students */
+  uint32_t b32;
+ sys_inb(port,&b32);
+ //printf("%x",b32);
+ *value=b32&0xFF;
+ //printf("%x\n",*value);
+  
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  return 0;
+}
+
+/* a = 133
+b = a & 0x0F
+1000 0101
+ */

Property changes on: lab4/test/lab3/utils.c
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/lab2
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-executable
Index: lab4/lab3/lab2
===================================================================
--- lab4/lab3/lab2	(nonexistent)
+++ lab4/lab3/lab2	(revision 13)

Property changes on: lab4/lab3/lab2
___________________________________________________________________
Added: svn:executable
Added: svn:mime-type
## -0,0 +1 ##
+application/x-executable
\ No newline at end of property
Index: lab4/lab3/output.txt
===================================================================
--- lab4/lab3/output.txt	(nonexistent)
+++ lab4/lab3/output.txt	(revision 13)
@@ -0,0 +1,68 @@
+Breakcode: 0x9c
+timer_test_int:timer_print_elapsed_time 1 s
+Makecode: 0x15
+Breakcode: 0x95
+Makecode: 0x1f
+Breakcode: 0x9f
+Makecode: 0x25
+Breakcode: 0xa5
+Makecode: 0x20
+Breakcode: 0xa0
+Makecode: 0x25
+Breakcode: 0xa5
+Makecode: 0x39
+Breakcode: 0xb9
+Makecode: 0x25
+Breakcode: 0xa5
+Makecode: 0x22
+Makecode: 0x21
+Makecode: 0x2d
+Breakcode: 0xa2
+Breakcode: 0xa1
+Breakcode: 0xad
+Makecode: 0x00 0x4b
+Makecode: 0x00 0x50
+Breakcode: 0x00 0xcb
+Breakcode: 0x00 0xd0
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Makecode: 0x25
+Breakcode: 0xa5
+timer_test_int:timer_print_elapsed_time 2 s
+Makecode: 0x1f
+Breakcode: 0x9f
+timer_test_int:timer_print_elapsed_time 3 s
+Makecode: 0x1f
+Breakcode: 0x9f
+Makecode: 0x1f
+Breakcode: 0x9f
+Makecode: 0x1f
+Breakcode: 0x9f
+Makecode: 0x1f
+Breakcode: 0x9f
+Makecode: 0x1f
+Breakcode: 0x9f
+Makecode: 0x1f
+Breakcode: 0x9f
+Makecode: 0x1f
+Breakcode: 0x9f
+timer_test_int:timer_print_elapsed_time 4 s
+timer_test_int:timer_print_elapsed_time 5 s
+timer_test_int:timer_print_elapsed_time 6 s
+timer_test_int:timer_print_elapsed_time 7 s
+timer_test_int:timer_print_elapsed_time 8 s
+sys_inb_calls: 127

Property changes on: lab4/lab3/output.txt
___________________________________________________________________
Added: svn:executable
Index: lab4/lab3/utils.c
===================================================================
--- lab4/lab3/utils.c	(nonexistent)
+++ lab4/lab3/utils.c	(revision 13)
@@ -0,0 +1,37 @@
+#include <lcom/lcf.h>
+
+#include <stdint.h>
+
+int(util_get_LSB)(uint16_t val, uint8_t *lsb) {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  *lsb=val&0xFF;
+  return 0;
+}
+
+int(util_get_MSB)(uint16_t val, uint8_t *msb) {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  *msb=(val&0xFF00)>>8;
+
+  return 0;
+}
+
+int (util_sys_inb)(int port, uint8_t *value) {
+  /* To be implemented by the students */
+  uint32_t b32;
+ sys_inb(port,&b32);
+ //printf("%x",b32);
+ *value=b32&0xFF;
+ //printf("%x\n",*value);
+  
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  return 0;
+}
+
+/* a = 133
+b = a & 0x0F
+1000 0101
+ */

Property changes on: lab4/lab3/utils.c
___________________________________________________________________
Added: svn:executable
Index: lab4/lab4/.clang-format
===================================================================
--- lab4/lab4/.clang-format	(nonexistent)
+++ lab4/lab4/.clang-format	(revision 13)
@@ -0,0 +1,73 @@
+BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: true
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: false
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      false
+  AfterControlStatement: false
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: true
+  AfterStruct:     false
+  AfterUnion:      false
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+IndentPPDirectives: AfterHash
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+Language: Cpp
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+SpaceAfterCStyleCast: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: true
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 2
+UseTab: Never

Property changes on: lab4/lab4/.clang-format
___________________________________________________________________
Added: svn:executable
Index: lab4/lab5/.vscode/settings.json
===================================================================
--- lab4/lab5/.vscode/settings.json	(nonexistent)
+++ lab4/lab5/.vscode/settings.json	(revision 13)
@@ -0,0 +1,10 @@
+{
+  "git.ignoreLimitWarning": true,
+  "C_Cpp.clang_format_fallbackStyle": "LLVM",
+  "diffEditor.ignoreTrimWhitespace": true,
+  "editor.formatOnSave": false,
+  "editor.tabSize": 2,
+  "editor.wordWrap": "bounded",
+  "editor.wordWrapColumn": 100,
+  "files.associations": { },
+}
\ No newline at end of file

Property changes on: lab4/lab5/.vscode/settings.json
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/.vscode/settings.json
===================================================================
--- lab4/martalab3/lab3/.vscode/settings.json	(nonexistent)
+++ lab4/martalab3/lab3/.vscode/settings.json	(revision 13)
@@ -0,0 +1,10 @@
+{
+  "git.ignoreLimitWarning": true,
+  "C_Cpp.clang_format_fallbackStyle": "LLVM",
+  "diffEditor.ignoreTrimWhitespace": true,
+  "editor.formatOnSave": false,
+  "editor.tabSize": 2,
+  "editor.wordWrap": "bounded",
+  "editor.wordWrapColumn": 100,
+  "files.associations": { },
+}
\ No newline at end of file

Property changes on: lab4/martalab3/lab3/.vscode/settings.json
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/i8042.h
===================================================================
--- lab4/martalab3/lab3/i8042.h	(nonexistent)
+++ lab4/martalab3/lab3/i8042.h	(revision 13)
@@ -0,0 +1,17 @@
+/*  #ifndef I8042_H
+#define I8042_H  */
+
+#define IRQ_KB 1
+#define DELAY_US 20000
+#define EXIT_CODE 0x81
+#define READ_CMD 0x20
+#define IN_BUF 0x64
+#define I_O_BUFFER 0x60
+#define O_BUFFER_FULL 0x01
+#define PAR_ERR 0x80
+#define TWO_BYTES 0xe0
+/* #define OBF BIT(0)
+#define TO_ERR BIT(6) */
+
+
+//#endif /* I8042_H */

Property changes on: lab4/martalab3/lab3/i8042.h
___________________________________________________________________
Added: svn:executable
Index: lab4/martalab3/lab3/lab3
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-executable
Index: lab4/martalab3/lab3/lab3
===================================================================
--- lab4/martalab3/lab3/lab3	(nonexistent)
+++ lab4/martalab3/lab3/lab3	(revision 13)

Property changes on: lab4/martalab3/lab3/lab3
___________________________________________________________________
Added: svn:executable
Added: svn:mime-type
## -0,0 +1 ##
+application/x-executable
\ No newline at end of property
Index: lab4/martalab3/lab3/utils.c
===================================================================
--- lab4/martalab3/lab3/utils.c	(nonexistent)
+++ lab4/martalab3/lab3/utils.c	(revision 13)
@@ -0,0 +1,37 @@
+#include <lcom/lcf.h>
+
+#include <stdint.h>
+
+int(util_get_LSB)(uint16_t val, uint8_t *lsb) {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  *lsb=val&0xFF;
+  return 0;
+}
+
+int(util_get_MSB)(uint16_t val, uint8_t *msb) {
+  /* To be implemented by the students */
+  //printf("%s is not yet implemented!\n", __func__);
+  *msb=(val&0xFF00)>>8;
+
+  return 0;
+}
+
+int (util_sys_inb)(int port, uint8_t *value) {
+  /* To be implemented by the students */
+  uint32_t b32;
+ sys_inb(port,&b32);
+ //printf("%x",b32);
+ *value=b32&0xFF;
+ //printf("%x\n",*value);
+  
+
+  //printf("%s is not yet implemented!\n", __func__);
+
+  return 0;
+}
+
+/* a = 133
+b = a & 0x0F
+1000 0101
+ */

Property changes on: lab4/martalab3/lab3/utils.c
___________________________________________________________________
Added: svn:executable
Index: lab4/proj/.clang-format
===================================================================
--- lab4/proj/.clang-format	(nonexistent)
+++ lab4/proj/.clang-format	(revision 13)
@@ -0,0 +1,73 @@
+BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: true
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: false
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      false
+  AfterControlStatement: false
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: true
+  AfterStruct:     false
+  AfterUnion:      false
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+IndentPPDirectives: AfterHash
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+Language: Cpp
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+SpaceAfterCStyleCast: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: true
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 2
+UseTab: Never

Property changes on: lab4/proj/.clang-format
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/.clang-format
===================================================================
--- lab4/test/lab2/.clang-format	(nonexistent)
+++ lab4/test/lab2/.clang-format	(revision 13)
@@ -0,0 +1,73 @@
+BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: true
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: false
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      false
+  AfterControlStatement: false
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: true
+  AfterStruct:     false
+  AfterUnion:      false
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+IndentPPDirectives: AfterHash
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+Language: Cpp
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+SpaceAfterCStyleCast: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: true
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 2
+UseTab: Never

Property changes on: lab4/test/lab2/.clang-format
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab2/lab2
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-executable
Index: lab4/test/lab2/lab2
===================================================================
--- lab4/test/lab2/lab2	(nonexistent)
+++ lab4/test/lab2/lab2	(revision 13)

Property changes on: lab4/test/lab2/lab2
___________________________________________________________________
Added: svn:executable
Added: svn:mime-type
## -0,0 +1 ##
+application/x-executable
\ No newline at end of property
Index: lab4/test/lab3/.vscode/c_cpp_properties.json
===================================================================
--- lab4/test/lab3/.vscode/c_cpp_properties.json	(nonexistent)
+++ lab4/test/lab3/.vscode/c_cpp_properties.json	(revision 13)
@@ -0,0 +1,18 @@
+{
+  "env": {
+    "minix.include": "${workspaceFolder}/../.minix-src/include"
+  },
+  "configurations": [{
+    "name": "Minix",
+    "compilerPath": "",
+    "cStandard": "c11",
+    "defines": ["__minix", "_MINIX ", "_NETBSD_SOURCE", "__i386__"],
+    "includePath": ["${workspaceFolder}", "${env:minix.include}"],
+    "browse": {
+      "path": ["${workspaceFolder}", "${env:minix.include}"],
+      "limitSymbolsToIncludedHeaders": false,
+      "databaseFilename": ""
+    }
+  }],
+  "version": 4
+}

Property changes on: lab4/test/lab3/.vscode/c_cpp_properties.json
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/.gdbinit
===================================================================
Index: lab4/test/lab3/.gdbinit
===================================================================
--- lab4/test/lab3/.gdbinit	(nonexistent)
+++ lab4/test/lab3/.gdbinit	(revision 13)

Property changes on: lab4/test/lab3/.gdbinit
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/keyboard.c
===================================================================
--- lab4/test/lab3/keyboard.c	(nonexistent)
+++ lab4/test/lab3/keyboard.c	(revision 13)
@@ -0,0 +1,68 @@
+#include "keyboard.h"
+//#include "lab3.c"
+#include <lcom/lcf.h>
+
+#include <minix/sysutil.h>
+#include <stdint.h>
+
+#include "i8042.h"
+#include "i8254.h"
+
+#include <lcom/lab3.h>
+#include <stdbool.h>
+
+extern uint32_t scancode;
+static int hook_id = 1;
+extern uint32_t cnt;
+  extern int flag;
+
+void(kbc_ih)() {
+  uint8_t scan_arr[2] = {0, 0};
+ 
+#ifdef LAB3
+    cnt++;
+#endif
+    sys_inb(IN_BUF, &scancode);
+    if (scancode & O_BUFFER_FULL) {
+#ifdef LAB3
+      cnt++;
+#endif
+      sys_inb(I_O_BUFFER, &scancode);
+              if (scancode != TWO_BYTES && flag == 0) {
+                scan_arr[0] = scancode;
+                kbd_print_scancode(!(scancode & PAR_ERR), 1, scan_arr);
+              }
+
+              else if (scancode == TWO_BYTES) {
+                scan_arr[0] = scancode;
+                flag = 1;
+              }
+
+              else if (flag == 1) {
+                scan_arr[1] = scancode;
+                kbd_print_scancode(!(scancode & PAR_ERR), 2, scan_arr);
+                flag = 0;
+              }
+    }
+  
+}
+
+int kbd_subscribe_int(uint8_t *bit_no) {
+  *bit_no = hook_id;
+
+  if (sys_irqsetpolicy(IRQ_KB, (IRQ_REENABLE | IRQ_EXCLUSIVE), &hook_id) != OK) {
+    printf("ERROR kbd subscribe failed");
+    return 1;
+  }
+
+  return 0;
+}
+
+int kbd_unsubscribe_int() {
+  if (sys_irqrmpolicy(&hook_id) != OK) {
+    printf("ERROR kbd unsubscribe failed");
+    return 1;
+  }
+
+  return 0;
+}

Property changes on: lab4/test/lab3/keyboard.c
___________________________________________________________________
Added: svn:executable
Index: lab4/test/lab3/output.txt
===================================================================
--- lab4/test/lab3/output.txt	(nonexistent)
+++ lab4/test/lab3/output.txt	(revision 13)
@@ -0,0 +1,10 @@
+Breakcode: 0x9c
+Makecode: 0x1f
+Makecode: 0x21
+Breakcode: 0x9f
+Breakcode: 0xa1
+Makecode: 0x1f
+Breakcode: 0x9f
+Makecode: 0x01
+Breakcode: 0x81
+sys_inb_calls: 139

Property changes on: lab4/test/lab3/output.txt
___________________________________________________________________
Added: svn:executable
